@instantdb/react 0.22.49-experimental.persisted-object-2.19448798235.1 → 0.22.49-experimental.persisted-object-2.19477901153.1

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.
@@ -88,7 +88,7 @@ function fe(t, e) {
88
88
  }
89
89
  function ii(t, e = []) {
90
90
  if (Object.hasOwnProperty.call(t, "key")) {
91
- const n = t.parent.copy, r = k(me(n, t.key));
91
+ const n = t.parent.copy, r = k(we(n, t.key));
92
92
  if (r !== null && (r == null ? void 0 : r.original) !== t.original)
93
93
  return null;
94
94
  const i = t.parent.type === 3, s = i ? Array.from(t.parent.setMap.keys()).indexOf(t.key) : t.key;
@@ -109,7 +109,7 @@ function ii(t, e = []) {
109
109
  function Ie(t) {
110
110
  return Array.isArray(t) ? 1 : t instanceof Map ? 2 : t instanceof Set ? 3 : 0;
111
111
  }
112
- function me(t, e) {
112
+ function we(t, e) {
113
113
  return Ie(t) === 2 ? t.get(e) : t[e];
114
114
  }
115
115
  function ut(t, e, n) {
@@ -119,7 +119,7 @@ function Yt(t, e) {
119
119
  const n = k(t);
120
120
  return (n ? ie(n) : t)[e];
121
121
  }
122
- function ge(t, e) {
122
+ function me(t, e) {
123
123
  return t === e ? t !== 0 || 1 / t === 1 / e : t !== t && e !== e;
124
124
  }
125
125
  function on(t) {
@@ -136,7 +136,7 @@ function ke(t, e) {
136
136
  function _s(t, e) {
137
137
  for (let n = 0; n < e.length - 1; n += 1) {
138
138
  const r = e[n];
139
- if (t = me(Ie(t) === 3 ? Array.from(t) : t, r), typeof t != "object")
139
+ if (t = we(Ie(t) === 3 ? Array.from(t) : t, r), typeof t != "object")
140
140
  throw new Error(`Cannot resolve patch at '${e.join("/")}'.`);
141
141
  }
142
142
  return t;
@@ -242,11 +242,11 @@ function xe(t, e, n, r, i) {
242
242
  if (r.length > 0) {
243
243
  const a = r.indexOf(o);
244
244
  if (o && typeof o == "object" && a !== -1)
245
- throw r[0] === o ? new Error("Forbids circular reference") : new Error(`Forbids circular reference: ~/${i.slice(0, a).map((u, c) => {
245
+ throw r[0] === o ? new Error("Forbids circular reference") : new Error(`Forbids circular reference: ~/${i.slice(0, a).map((u, d) => {
246
246
  if (typeof u == "symbol")
247
247
  return `[${u.toString()}]`;
248
- const d = r[c];
249
- return typeof u == "object" && (d instanceof Map || d instanceof Set) ? Array.from(d.keys()).indexOf(u) : u;
248
+ const c = r[d];
249
+ return typeof u == "object" && (c instanceof Map || c instanceof Set) ? Array.from(c.keys()).indexOf(u) : u;
250
250
  }).join("/")}`);
251
251
  r.push(o), i.push(e);
252
252
  } else
@@ -303,8 +303,8 @@ function oi(t, e, n) {
303
303
  if (Me(o)) {
304
304
  const u = k(o);
305
305
  H(u);
306
- const c = !((a = u.assignedMap) === null || a === void 0) && a.size || u.operated ? u.copy : u.original;
307
- ut(r ? i : t, s, c);
306
+ const d = !((a = u.assignedMap) === null || a === void 0) && a.size || u.operated ? u.copy : u.original;
307
+ ut(r ? i : t, s, d);
308
308
  } else
309
309
  oi(o, e, n);
310
310
  }), i) {
@@ -316,7 +316,7 @@ function oi(t, e, n) {
316
316
  }
317
317
  function ms(t, e) {
318
318
  const n = t.type === 3 ? t.setMap : t.copy;
319
- t.finalities.revoke.length > 1 && t.assignedMap.get(e) && n && oi(me(n, e), t.finalities.handledSet, t.options);
319
+ t.finalities.revoke.length > 1 && t.assignedMap.get(e) && n && oi(we(n, e), t.finalities.handledSet, t.options);
320
320
  }
321
321
  function an(t) {
322
322
  t.type === 3 && t.copy && (t.copy.clear(), t.setMap.forEach((e) => {
@@ -337,54 +337,54 @@ function Nn(t, e, n, r) {
337
337
  i && (i.callbacks || (i.callbacks = []), i.callbacks.push((s, o) => {
338
338
  var a;
339
339
  const u = t.type === 3 ? t.setMap : t.copy;
340
- if (ge(me(u, e), n)) {
341
- let c = i.original;
342
- i.copy && (c = i.copy), an(t), un(t, r, s, o), t.options.enableAutoFreeze && (t.options.updatedValues = (a = t.options.updatedValues) !== null && a !== void 0 ? a : /* @__PURE__ */ new WeakMap(), t.options.updatedValues.set(c, i.original)), ut(u, e, c);
340
+ if (me(we(u, e), n)) {
341
+ let d = i.original;
342
+ i.copy && (d = i.copy), an(t), un(t, r, s, o), t.options.enableAutoFreeze && (t.options.updatedValues = (a = t.options.updatedValues) !== null && a !== void 0 ? a : /* @__PURE__ */ new WeakMap(), t.options.updatedValues.set(d, i.original)), ut(u, e, d);
343
343
  }
344
344
  }), t.options.enableAutoFreeze && i.finalities !== t.finalities && (t.options.enableAutoFreeze = !1)), fe(n, t.options) && t.finalities.draft.push(() => {
345
345
  const s = t.type === 3 ? t.setMap : t.copy;
346
- ge(me(s, e), n) && ms(t, e);
346
+ me(we(s, e), n) && ms(t, e);
347
347
  });
348
348
  }
349
349
  function ws(t, e, n, r, i) {
350
350
  let { original: s, assignedMap: o, options: a } = t, u = t.copy;
351
351
  u.length < s.length && ([s, u] = [u, s], [n, r] = [r, n]);
352
- for (let c = 0; c < s.length; c += 1)
353
- if (o.get(c.toString()) && u[c] !== s[c]) {
354
- const d = e.concat([c]), f = ke(d, i);
352
+ for (let d = 0; d < s.length; d += 1)
353
+ if (o.get(d.toString()) && u[d] !== s[d]) {
354
+ const c = e.concat([d]), f = ke(c, i);
355
355
  n.push({
356
356
  op: D.Replace,
357
357
  path: f,
358
358
  // If it is a draft, it needs to be deep cloned, and it may also be non-draft.
359
- value: Ot(u[c])
359
+ value: Ot(u[d])
360
360
  }), r.push({
361
361
  op: D.Replace,
362
362
  path: f,
363
363
  // If it is a draft, it needs to be deep cloned, and it may also be non-draft.
364
- value: Ot(s[c])
364
+ value: Ot(s[d])
365
365
  });
366
366
  }
367
- for (let c = s.length; c < u.length; c += 1) {
368
- const d = e.concat([c]), f = ke(d, i);
367
+ for (let d = s.length; d < u.length; d += 1) {
368
+ const c = e.concat([d]), f = ke(c, i);
369
369
  n.push({
370
370
  op: D.Add,
371
371
  path: f,
372
372
  // If it is a draft, it needs to be deep cloned, and it may also be non-draft.
373
- value: Ot(u[c])
373
+ value: Ot(u[d])
374
374
  });
375
375
  }
376
376
  if (s.length < u.length) {
377
- const { arrayLengthAssignment: c = !0 } = a.enablePatches;
378
- if (c) {
379
- const d = e.concat(["length"]), f = ke(d, i);
377
+ const { arrayLengthAssignment: d = !0 } = a.enablePatches;
378
+ if (d) {
379
+ const c = e.concat(["length"]), f = ke(c, i);
380
380
  r.push({
381
381
  op: D.Replace,
382
382
  path: f,
383
383
  value: s.length
384
384
  });
385
385
  } else
386
- for (let d = u.length; s.length < d; d -= 1) {
387
- const f = e.concat([d - 1]), h = ke(f, i);
386
+ for (let c = u.length; s.length < c; c -= 1) {
387
+ const f = e.concat([c - 1]), h = ke(f, i);
388
388
  r.push({
389
389
  op: D.Remove,
390
390
  path: h
@@ -394,39 +394,39 @@ function ws(t, e, n, r, i) {
394
394
  }
395
395
  function Ts({ original: t, copy: e, assignedMap: n }, r, i, s, o) {
396
396
  n.forEach((a, u) => {
397
- const c = me(t, u), d = Ot(me(e, u)), f = a ? rt(t, u) ? D.Replace : D.Add : D.Remove;
398
- if (ge(c, d) && f === D.Replace)
397
+ const d = we(t, u), c = Ot(we(e, u)), f = a ? rt(t, u) ? D.Replace : D.Add : D.Remove;
398
+ if (me(d, c) && f === D.Replace)
399
399
  return;
400
400
  const h = r.concat(u), p = ke(h, o);
401
- i.push(f === D.Remove ? { op: f, path: p } : { op: f, path: p, value: d }), s.push(f === D.Add ? { op: D.Remove, path: p } : f === D.Remove ? { op: D.Add, path: p, value: c } : { op: D.Replace, path: p, value: c });
401
+ i.push(f === D.Remove ? { op: f, path: p } : { op: f, path: p, value: c }), s.push(f === D.Add ? { op: D.Remove, path: p } : f === D.Remove ? { op: D.Add, path: p, value: d } : { op: D.Replace, path: p, value: d });
402
402
  });
403
403
  }
404
404
  function vs({ original: t, copy: e }, n, r, i, s) {
405
405
  let o = 0;
406
406
  t.forEach((a) => {
407
407
  if (!e.has(a)) {
408
- const u = n.concat([o]), c = ke(u, s);
408
+ const u = n.concat([o]), d = ke(u, s);
409
409
  r.push({
410
410
  op: D.Remove,
411
- path: c,
411
+ path: d,
412
412
  value: a
413
413
  }), i.unshift({
414
414
  op: D.Add,
415
- path: c,
415
+ path: d,
416
416
  value: a
417
417
  });
418
418
  }
419
419
  o += 1;
420
420
  }), o = 0, e.forEach((a) => {
421
421
  if (!t.has(a)) {
422
- const u = n.concat([o]), c = ke(u, s);
422
+ const u = n.concat([o]), d = ke(u, s);
423
423
  r.push({
424
424
  op: D.Add,
425
- path: c,
425
+ path: d,
426
426
  value: a
427
427
  }), i.unshift({
428
428
  op: D.Remove,
429
- path: c,
429
+ path: d,
430
430
  value: a
431
431
  });
432
432
  }
@@ -457,7 +457,7 @@ const Ct = (t, e, n = !1) => {
457
457
  },
458
458
  set(t, e) {
459
459
  const n = k(this), r = ie(n);
460
- return (!r.has(t) || !ge(r.get(t), e)) && (H(n), ye(n), n.assignedMap.set(t, !0), n.copy.set(t, e), Nn(n, t, e, at)), this;
460
+ return (!r.has(t) || !me(r.get(t), e)) && (H(n), ye(n), n.assignedMap.set(t, !0), n.copy.set(t, e), Nn(n, t, e, at)), this;
461
461
  },
462
462
  delete(t) {
463
463
  if (!this.has(t))
@@ -536,16 +536,16 @@ const Ct = (t, e, n = !1) => {
536
536
  return s;
537
537
  const o = s.value;
538
538
  let a = t.setMap.get(o);
539
- const u = k(a), c = ((i = (r = t.options).mark) === null || i === void 0 ? void 0 : i.call(r, a, se)) === se.mutable;
540
- if (t.options.strict && Ct(o, t.options, c), !c && !u && fe(o, t.options) && !t.finalized && t.original.has(o)) {
541
- const d = $n.createDraft({
539
+ const u = k(a), d = ((i = (r = t.options).mark) === null || i === void 0 ? void 0 : i.call(r, a, se)) === se.mutable;
540
+ if (t.options.strict && Ct(o, t.options, d), !d && !u && fe(o, t.options) && !t.finalized && t.original.has(o)) {
541
+ const c = $n.createDraft({
542
542
  original: o,
543
543
  parentDraft: t,
544
544
  key: o,
545
545
  finalities: t.finalities,
546
546
  options: t.options
547
547
  });
548
- t.setMap.set(o, d), a = d;
548
+ t.setMap.set(o, c), a = c;
549
549
  } else u && (a = u.proxy);
550
550
  return {
551
551
  done: !1,
@@ -650,30 +650,30 @@ const Os = Reflect.ownKeys(Pt), ai = /* @__PURE__ */ new WeakSet(), ui = {
650
650
  return t;
651
651
  let o;
652
652
  if (t.options.mark) {
653
- const c = e === "size" && (t.original instanceof Map || t.original instanceof Set) ? Reflect.get(t.original, e) : Reflect.get(t.original, e, n);
654
- if (o = t.options.mark(c, se), o === se.mutable)
655
- return t.options.strict && Ct(c, t.options, !0), c;
653
+ const d = e === "size" && (t.original instanceof Map || t.original instanceof Set) ? Reflect.get(t.original, e) : Reflect.get(t.original, e, n);
654
+ if (o = t.options.mark(d, se), o === se.mutable)
655
+ return t.options.strict && Ct(d, t.options, !0), d;
656
656
  }
657
657
  const a = ie(t);
658
658
  if (a instanceof Map && Ss.includes(e)) {
659
659
  if (e === "size")
660
660
  return Object.getOwnPropertyDescriptor(cn, "size").get.call(t.proxy);
661
- const c = cn[e];
662
- if (c)
663
- return c.bind(t.proxy);
661
+ const d = cn[e];
662
+ if (d)
663
+ return d.bind(t.proxy);
664
664
  }
665
665
  if (a instanceof Set && Os.includes(e)) {
666
666
  if (e === "size")
667
667
  return Object.getOwnPropertyDescriptor(Pt, "size").get.call(t.proxy);
668
- const c = Pt[e];
669
- if (c)
670
- return c.bind(t.proxy);
668
+ const d = Pt[e];
669
+ if (d)
670
+ return d.bind(t.proxy);
671
671
  }
672
672
  if (!rt(a, e)) {
673
- const c = yr(a, e);
674
- return c ? "value" in c ? c.value : (
673
+ const d = yr(a, e);
674
+ return d ? "value" in d ? d.value : (
675
675
  // !case: support for getter
676
- (i = c.get) === null || i === void 0 ? void 0 : i.call(t.proxy)
676
+ (i = d.get) === null || i === void 0 ? void 0 : i.call(t.proxy)
677
677
  ) : void 0;
678
678
  }
679
679
  const u = a[e];
@@ -687,8 +687,8 @@ const Os = Reflect.ownKeys(Pt), ai = /* @__PURE__ */ new WeakSet(), ui = {
687
687
  finalities: t.finalities,
688
688
  options: t.options
689
689
  }), typeof o == "function") {
690
- const c = k(t.copy[e]);
691
- return H(c), ye(c), c.copy;
690
+ const d = k(t.copy[e]);
691
+ return H(d), ye(d), d.copy;
692
692
  }
693
693
  return t.copy[e];
694
694
  }
@@ -705,7 +705,7 @@ const Os = Reflect.ownKeys(Pt), ai = /* @__PURE__ */ new WeakSet(), ui = {
705
705
  if (s != null && s.set)
706
706
  return s.set.call(t.proxy, n), !0;
707
707
  const o = Yt(ie(t), e), a = k(o);
708
- return a && ge(a.original, n) ? (t.copy[e] = n, t.assignedMap = (r = t.assignedMap) !== null && r !== void 0 ? r : /* @__PURE__ */ new Map(), t.assignedMap.set(e, !1), !0) : (ge(n, o) && (n !== void 0 || rt(t.original, e)) || (H(t), ye(t), rt(t.original, e) && ge(n, t.original[e]) ? t.assignedMap.delete(e) : t.assignedMap.set(e, !0), t.copy[e] = n, Nn(t, e, n, at)), !0);
708
+ return a && me(a.original, n) ? (t.copy[e] = n, t.assignedMap = (r = t.assignedMap) !== null && r !== void 0 ? r : /* @__PURE__ */ new Map(), t.assignedMap.set(e, !1), !0) : (me(n, o) && (n !== void 0 || rt(t.original, e)) || (H(t), ye(t), rt(t.original, e) && me(n, t.original[e]) ? t.assignedMap.delete(e) : t.assignedMap.set(e, !0), t.copy[e] = n, Nn(t, e, n, at)), !0);
709
709
  },
710
710
  has(t, e) {
711
711
  return e in ie(t);
@@ -750,26 +750,26 @@ function Fn(t) {
750
750
  setMap: o === 3 ? new Map(e.entries()) : void 0
751
751
  };
752
752
  (r || "key" in t) && (a.key = r);
753
- const { proxy: u, revoke: c } = Proxy.revocable(o === 1 ? Object.assign([], a) : a, ui);
754
- if (i.revoke.push(c), ai.add(u), a.proxy = u, n) {
755
- const d = n;
756
- d.finalities.draft.push((f, h) => {
757
- var p, b;
753
+ const { proxy: u, revoke: d } = Proxy.revocable(o === 1 ? Object.assign([], a) : a, ui);
754
+ if (i.revoke.push(d), ai.add(u), a.proxy = u, n) {
755
+ const c = n;
756
+ c.finalities.draft.push((f, h) => {
757
+ var p, _;
758
758
  const y = k(u);
759
- let g = d.type === 3 ? d.setMap : d.copy;
760
- const T = me(g, r), w = k(T);
759
+ let g = c.type === 3 ? c.setMap : c.copy;
760
+ const T = we(g, r), w = k(T);
761
761
  if (w) {
762
762
  let v = w.original;
763
- w.operated && (v = Un(T)), an(w), un(w, at, f, h), d.options.enableAutoFreeze && (d.options.updatedValues = (p = d.options.updatedValues) !== null && p !== void 0 ? p : /* @__PURE__ */ new WeakMap(), d.options.updatedValues.set(v, w.original)), ut(g, r, v);
763
+ w.operated && (v = Un(T)), an(w), un(w, at, f, h), c.options.enableAutoFreeze && (c.options.updatedValues = (p = c.options.updatedValues) !== null && p !== void 0 ? p : /* @__PURE__ */ new WeakMap(), c.options.updatedValues.set(v, w.original)), ut(g, r, v);
764
764
  }
765
- (b = y.callbacks) === null || b === void 0 || b.forEach((v) => {
765
+ (_ = y.callbacks) === null || _ === void 0 || _.forEach((v) => {
766
766
  v(f, h);
767
767
  });
768
768
  });
769
769
  } else {
770
- const d = k(u);
771
- d.finalities.draft.push((f, h) => {
772
- an(d), un(d, at, f, h);
770
+ const c = k(u);
771
+ c.finalities.draft.push((f, h) => {
772
+ an(c), un(c, at, f, h);
773
773
  });
774
774
  }
775
775
  return u;
@@ -781,9 +781,9 @@ function Es(t, e, n, r, i) {
781
781
  if (o != null && o.operated)
782
782
  for (; o.finalities.draft.length > 0; )
783
783
  o.finalities.draft.pop()(n, r);
784
- const c = u ? e[0] : o ? o.operated ? o.copy : o.original : t;
785
- return o && on(o), i && xe(c, c, o == null ? void 0 : o.options.updatedValues), [
786
- c,
784
+ const d = u ? e[0] : o ? o.operated ? o.copy : o.original : t;
785
+ return o && on(o), i && xe(d, d, o == null ? void 0 : o.options.updatedValues), [
786
+ d,
787
787
  n && u ? [{ op: D.Replace, path: [], value: e[0] }] : n,
788
788
  r && u ? [{ op: D.Replace, path: [], value: a }] : r
789
789
  ];
@@ -806,8 +806,8 @@ function As(t, e) {
806
806
  return [
807
807
  a,
808
808
  (u = []) => {
809
- const [c, d, f] = Es(a, u, i, s, e.enableAutoFreeze);
810
- return e.enablePatches ? [c, d, f] : c;
809
+ const [d, c, f] = Es(a, u, i, s, e.enableAutoFreeze);
810
+ return e.enablePatches ? [d, c, f] : d;
811
811
  }
812
812
  ];
813
813
  }
@@ -817,12 +817,12 @@ function dn(t) {
817
817
  const u = k(o);
818
818
  if (u && e && u.finalities === e.finalities) {
819
819
  t.isContainDraft = !0;
820
- const c = u.original;
820
+ const d = u.original;
821
821
  if (a instanceof Set) {
822
- const d = Array.from(a);
823
- a.clear(), d.forEach((f) => a.add(s === f ? c : f));
822
+ const c = Array.from(a);
823
+ a.clear(), c.forEach((f) => a.add(s === f ? d : f));
824
824
  } else
825
- ut(a, s, c);
825
+ ut(a, s, d);
826
826
  } else typeof o == "object" && o !== null && (t.value = o, t.isRoot = !1, dn(t));
827
827
  }), i && (t.isContainDraft || console.warn("The return value does not contain any draft, please use 'rawReturn()' to wrap the return value to improve performance."), r && console.warn("The return value contains drafts, please don't use 'rawReturn()' to wrap the return value."));
828
828
  }
@@ -848,7 +848,7 @@ function ci(t) {
848
848
  } else
849
849
  i = t;
850
850
  if (Ln(i, (o, a) => {
851
- if (n && ge(me(n.original, o), a))
851
+ if (n && me(we(n.original, o), a))
852
852
  return;
853
853
  const u = ci(a);
854
854
  u !== a && (i === t && s(), ut(i, o, u));
@@ -869,23 +869,23 @@ const js = (t) => function e(n, r, i) {
869
869
  return function(E, ...U) {
870
870
  return e(E, (F) => n.call(this, F, ...U), r);
871
871
  };
872
- const u = n, c = r;
873
- let d = i;
874
- if (typeof r != "function" && (d = r), d !== void 0 && Object.prototype.toString.call(d) !== "[object Object]")
875
- throw new Error(`Invalid options: ${d}, 'options' should be an object.`);
876
- d = Object.assign(Object.assign({}, t), d);
877
- const f = Me(u) ? gr(u) : u, h = Array.isArray(d.mark) ? (E, U) => {
878
- for (const F of d.mark) {
872
+ const u = n, d = r;
873
+ let c = i;
874
+ if (typeof r != "function" && (c = r), c !== void 0 && Object.prototype.toString.call(c) !== "[object Object]")
875
+ throw new Error(`Invalid options: ${c}, 'options' should be an object.`);
876
+ c = Object.assign(Object.assign({}, t), c);
877
+ const f = Me(u) ? gr(u) : u, h = Array.isArray(c.mark) ? (E, U) => {
878
+ for (const F of c.mark) {
879
879
  if (typeof F != "function")
880
880
  throw new Error(`Invalid mark: ${F}, 'mark' should be a function.`);
881
881
  const he = F(E, U);
882
882
  if (he)
883
883
  return he;
884
884
  }
885
- } : d.mark, p = (s = d.enablePatches) !== null && s !== void 0 ? s : !1, b = (o = d.strict) !== null && o !== void 0 ? o : !1, g = {
886
- enableAutoFreeze: (a = d.enableAutoFreeze) !== null && a !== void 0 ? a : !1,
885
+ } : c.mark, p = (s = c.enablePatches) !== null && s !== void 0 ? s : !1, _ = (o = c.strict) !== null && o !== void 0 ? o : !1, g = {
886
+ enableAutoFreeze: (a = c.enableAutoFreeze) !== null && a !== void 0 ? a : !1,
887
887
  mark: h,
888
- strict: b,
888
+ strict: _,
889
889
  enablePatches: p
890
890
  };
891
891
  if (!fe(f, g) && typeof f == "object" && f !== null)
@@ -898,14 +898,14 @@ const js = (t) => function e(n, r, i) {
898
898
  }
899
899
  let v;
900
900
  try {
901
- v = c(T);
901
+ v = d(T);
902
902
  } catch (E) {
903
903
  throw on(k(T)), E;
904
904
  }
905
905
  const P = (E) => {
906
906
  const U = k(T);
907
907
  if (!Me(E)) {
908
- if (E !== void 0 && !ge(E, T) && (U != null && U.operated))
908
+ if (E !== void 0 && !me(E, T) && (U != null && U.operated))
909
909
  throw new Error("Either the value is returned as a new non-draft value, or only the draft is modified without returning any value.");
910
910
  const he = E == null ? void 0 : E[ys];
911
911
  if (he) {
@@ -1247,8 +1247,8 @@ function Fs(t) {
1247
1247
  const [e, n] = t.split(", "), [r, i, s] = e.split("/").map(Number), o = n.match(/(\d{1,2}):(\d{2}):(\d{2}) (AM|PM)/);
1248
1248
  if (!o)
1249
1249
  throw new Error(`Unable to parse time from: ${t}`);
1250
- let [, a, u, c, d] = o;
1251
- return a = Number(a), u = Number(u), c = Number(c), d === "PM" && a !== 12 ? a += 12 : d === "AM" && a === 12 && (a = 0), new Date(Date.UTC(s, r - 1, i, a, u, c));
1250
+ let [, a, u, d, c] = o;
1251
+ return a = Number(a), u = Number(u), d = Number(d), c === "PM" && a !== 12 ? a += 12 : c === "AM" && a === 12 && (a = 0), new Date(Date.UTC(s, r - 1, i, a, u, d));
1252
1252
  }
1253
1253
  function Ks(t) {
1254
1254
  switch (t) {
@@ -1361,22 +1361,22 @@ function te(t, e, n) {
1361
1361
  function hi(t, e, n) {
1362
1362
  const r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map();
1363
1363
  for (const o of e) {
1364
- let [a, u, c, d] = o;
1364
+ let [a, u, d, c] = o;
1365
1365
  const f = Ge(t, u);
1366
1366
  if (!f) {
1367
1367
  console.warn("no such attr", a, t);
1368
1368
  continue;
1369
1369
  }
1370
- f["checked-data-type"] === "date" && n && (c = xt(c), o[2] = c), Wn(f) && te(s, [c, u, a], o), te(r, [a, u, c], o), te(i, [u, a, c], o);
1370
+ f["checked-data-type"] === "date" && n && (d = xt(d), o[2] = d), Wn(f) && te(s, [d, u, a], o), te(r, [a, u, d], o), te(i, [u, a, d], o);
1371
1371
  }
1372
1372
  return { eav: r, aev: i, vae: s };
1373
1373
  }
1374
1374
  function pi(t) {
1375
1375
  const e = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map();
1376
1376
  for (const s of Object.values(t)) {
1377
- const o = s["forward-identity"], [a, u, c] = o, d = s["reverse-identity"];
1378
- if (te(r, [u, c], s), qn(s) && te(e, [u, c], s), s["primary?"] && te(n, [u], s), d) {
1379
- const [f, h, p] = d;
1377
+ const o = s["forward-identity"], [a, u, d] = o, c = s["reverse-identity"];
1378
+ if (te(r, [u, d], s), qn(s) && te(e, [u, d], s), s["primary?"] && te(n, [u], s), c) {
1379
+ const [f, h, p] = c;
1380
1380
  te(i, [h, p], s);
1381
1381
  }
1382
1382
  }
@@ -1409,7 +1409,7 @@ function ct(t, e) {
1409
1409
  const [o, a] = e[0], u = t.aev.get(o);
1410
1410
  if (!u)
1411
1411
  return null;
1412
- i = (n = ne(u, 2).find((d) => d[2] === a)) === null || n === void 0 ? void 0 : n[0];
1412
+ i = (n = ne(u, 2).find((c) => c[2] === a)) === null || n === void 0 ? void 0 : n[0];
1413
1413
  } else
1414
1414
  i = e[0];
1415
1415
  if (!i)
@@ -1419,11 +1419,11 @@ function ct(t, e) {
1419
1419
  const [o, a] = s, u = t.aev.get(o);
1420
1420
  if (!u)
1421
1421
  return null;
1422
- const d = (r = ne(u, 2).find((y) => y[2] === a)) === null || r === void 0 ? void 0 : r[0];
1423
- if (!d)
1422
+ const c = (r = ne(u, 2).find((y) => y[2] === a)) === null || r === void 0 ? void 0 : r[0];
1423
+ if (!c)
1424
1424
  return null;
1425
- const [f, h, p, ...b] = e;
1426
- return [i, h, d, ...b];
1425
+ const [f, h, p, ..._] = e;
1426
+ return [i, h, c, ..._];
1427
1427
  } else {
1428
1428
  const [o, ...a] = e;
1429
1429
  return [i, ...a];
@@ -1453,8 +1453,8 @@ function Js(t, e) {
1453
1453
  if (!a)
1454
1454
  return;
1455
1455
  a["checked-data-type"] === "date" && t.useDateObjects && (o = xt(o));
1456
- const u = Dt(t.eav, [i, s, o]), c = (n = u == null ? void 0 : u[3]) !== null && n !== void 0 ? n : yi(t, a, r), d = [i, s, o, c];
1457
- Gs(a) ? (te(t.eav, [i, s], /* @__PURE__ */ new Map([[o, d]])), te(t.aev, [s, i], /* @__PURE__ */ new Map([[o, d]]))) : (te(t.eav, [i, s, o], d), te(t.aev, [s, i, o], d)), Wn(a) && te(t.vae, [o, s, i], d);
1456
+ const u = Dt(t.eav, [i, s, o]), d = (n = u == null ? void 0 : u[3]) !== null && n !== void 0 ? n : yi(t, a, r), c = [i, s, o, d];
1457
+ Gs(a) ? (te(t.eav, [i, s], /* @__PURE__ */ new Map([[o, c]])), te(t.aev, [s, i], /* @__PURE__ */ new Map([[o, c]]))) : (te(t.eav, [i, s, o], c), te(t.aev, [s, i, o], c)), Wn(a) && te(t.vae, [o, s, i], c);
1458
1458
  }
1459
1459
  function Zs(t, e) {
1460
1460
  var n;
@@ -1469,14 +1469,14 @@ function Zs(t, e) {
1469
1469
  const u = Dt(t.eav, [i, s]);
1470
1470
  if (!u)
1471
1471
  return;
1472
- const c = (n = u.values().next()) === null || n === void 0 ? void 0 : n.value;
1473
- if (!c)
1472
+ const d = (n = u.values().next()) === null || n === void 0 ? void 0 : n.value;
1473
+ if (!d)
1474
1474
  return;
1475
- const d = c[2], f = fi(d, o), h = [
1475
+ const c = d[2], f = fi(c, o), h = [
1476
1476
  i,
1477
1477
  s,
1478
1478
  f,
1479
- yi(t, a, c)
1479
+ yi(t, a, d)
1480
1480
  ];
1481
1481
  te(t.eav, [i, s], /* @__PURE__ */ new Map([[f, h]]));
1482
1482
  }
@@ -1487,24 +1487,24 @@ function hn(t, e) {
1487
1487
  return;
1488
1488
  const [a] = o, u = t.eav.get(a);
1489
1489
  if (u) {
1490
- for (const d of u.keys()) {
1491
- const f = t.attrs[d];
1492
- f && f["on-delete-reverse"] === "cascade" && ne(u.get(d), 1).forEach(([h, p, b]) => {
1490
+ for (const c of u.keys()) {
1491
+ const f = t.attrs[c];
1492
+ f && f["on-delete-reverse"] === "cascade" && ne(u.get(c), 1).forEach(([h, p, _]) => {
1493
1493
  var y;
1494
- return hn(t, [b, (y = f["reverse-identity"]) === null || y === void 0 ? void 0 : y[1]]);
1494
+ return hn(t, [_, (y = f["reverse-identity"]) === null || y === void 0 ? void 0 : y[1]]);
1495
1495
  }), // Fall back to deleting everything if we've rehydrated tx-steps from
1496
1496
  // the store that didn't set `etype` in deleteEntity
1497
1497
  (!s || // If we don't know about the attr, let's just get rid of it
1498
1498
  !f || // Make sure it matches the etype
1499
- ((n = f["forward-identity"]) === null || n === void 0 ? void 0 : n[1]) === s) && (de(t.aev, [d, a]), de(t.eav, [a, d]));
1499
+ ((n = f["forward-identity"]) === null || n === void 0 ? void 0 : n[1]) === s) && (de(t.aev, [c, a]), de(t.eav, [a, c]));
1500
1500
  }
1501
1501
  u.size === 0 && de(t.eav, [a]);
1502
1502
  }
1503
- const c = t.vae.get(a) && ne(t.vae.get(a), 2);
1504
- c && c.forEach((d) => {
1503
+ const d = t.vae.get(a) && ne(t.vae.get(a), 2);
1504
+ d && d.forEach((c) => {
1505
1505
  var f, h, p;
1506
- const [b, y, g] = d, T = t.attrs[y];
1507
- (!s || !T || ((f = T["reverse-identity"]) === null || f === void 0 ? void 0 : f[1]) === s) && (de(t.eav, [b, y, g]), de(t.aev, [y, b, g]), de(t.vae, [g, y, b])), T && T["on-delete"] === "cascade" && ((h = T["reverse-identity"]) === null || h === void 0 ? void 0 : h[1]) === s && hn(t, [b, (p = T["forward-identity"]) === null || p === void 0 ? void 0 : p[1]]);
1506
+ const [_, y, g] = c, T = t.attrs[y];
1507
+ (!s || !T || ((f = T["reverse-identity"]) === null || f === void 0 ? void 0 : f[1]) === s) && (de(t.eav, [_, y, g]), de(t.aev, [y, _, g]), de(t.vae, [g, y, _])), T && T["on-delete"] === "cascade" && ((h = T["reverse-identity"]) === null || h === void 0 ? void 0 : h[1]) === s && hn(t, [_, (p = T["forward-identity"]) === null || p === void 0 ? void 0 : p[1]]);
1508
1508
  }), ((r = t.vae.get(a)) === null || r === void 0 ? void 0 : r.size) === 0 && de(t.vae, [a]);
1509
1509
  }
1510
1510
  function _i(t, e) {
@@ -1582,16 +1582,16 @@ function wt(t, e, n) {
1582
1582
  return s;
1583
1583
  }
1584
1584
  if (n != null && n.hasOwnProperty("$isNull")) {
1585
- const { attrId: a, isNull: u, reverse: c } = n.$isNull;
1586
- if (c)
1587
- for (const d of e.keys()) {
1588
- const f = t.vae.get(d), h = !f || ((r = f.get(a)) === null || r === void 0 ? void 0 : r.get(null)) || !f.get(a);
1589
- (u ? h : !h) && s.push(e.get(d));
1585
+ const { attrId: a, isNull: u, reverse: d } = n.$isNull;
1586
+ if (d)
1587
+ for (const c of e.keys()) {
1588
+ const f = t.vae.get(c), h = !f || ((r = f.get(a)) === null || r === void 0 ? void 0 : r.get(null)) || !f.get(a);
1589
+ (u ? h : !h) && s.push(e.get(c));
1590
1590
  }
1591
1591
  else {
1592
- const d = t.aev.get(a);
1592
+ const c = t.aev.get(a);
1593
1593
  for (const f of e.keys()) {
1594
- const h = !d || ((i = d.get(f)) === null || i === void 0 ? void 0 : i.get(null)) || !d.get(f);
1594
+ const h = !c || ((i = c.get(f)) === null || i === void 0 ? void 0 : i.get(null)) || !c.get(f);
1595
1595
  (u ? h : !h) && s.push(e.get(f));
1596
1596
  }
1597
1597
  }
@@ -1630,8 +1630,8 @@ function io(t, [e, n, r]) {
1630
1630
  if (!a)
1631
1631
  return [];
1632
1632
  const u = [];
1633
- for (const c of a.values())
1634
- u.push(...wt(t, c, r));
1633
+ for (const d of a.values())
1634
+ u.push(...wt(t, d, r));
1635
1635
  return u;
1636
1636
  }
1637
1637
  case "a": {
@@ -1643,15 +1643,15 @@ function io(t, [e, n, r]) {
1643
1643
  if (!a)
1644
1644
  return [];
1645
1645
  const u = [];
1646
- for (const c of a.values())
1647
- u.push(...wt(t, c, r));
1646
+ for (const d of a.values())
1647
+ u.push(...wt(t, d, r));
1648
1648
  return u;
1649
1649
  }
1650
1650
  case "v": {
1651
1651
  const a = [];
1652
1652
  for (const u of t.eav.values())
1653
- for (const c of u.values())
1654
- a.push(...wt(t, c, r));
1653
+ for (const d of u.values())
1654
+ a.push(...wt(t, d, r));
1655
1655
  return a;
1656
1656
  }
1657
1657
  default:
@@ -1663,8 +1663,8 @@ function so(t, e, n) {
1663
1663
  const i = {};
1664
1664
  for (const [s, o] of e.entries()) {
1665
1665
  const a = (r = t.eav.get(n)) === null || r === void 0 ? void 0 : r.get(o.id), u = ne(a, 1);
1666
- for (const c of u)
1667
- i[s] = c[2];
1666
+ for (const d of u)
1667
+ i[s] = d[2];
1668
1668
  }
1669
1669
  return i;
1670
1670
  }
@@ -1699,13 +1699,13 @@ function uo(t, e) {
1699
1699
  const u = a == null ? void 0 : a.mode;
1700
1700
  if (u !== "create" && u !== "update")
1701
1701
  return !0;
1702
- let c = !1;
1703
- const d = Ge(t.attrs, s);
1704
- if (d) {
1705
- const f = mi(t, d["forward-identity"][1]);
1706
- c = !!ao(t, [i, f.id, i]);
1702
+ let d = !1;
1703
+ const c = Ge(t.attrs, s);
1704
+ if (c) {
1705
+ const f = mi(t, c["forward-identity"][1]);
1706
+ d = !!ao(t, [i, f.id, i]);
1707
1707
  }
1708
- return !(u === "create" && c || u === "update" && !c);
1708
+ return !(u === "create" && d || u === "update" && !d);
1709
1709
  });
1710
1710
  return Mt(t, (r) => {
1711
1711
  n.forEach((i) => {
@@ -1878,18 +1878,18 @@ function Ti(t, e, n, r, i) {
1878
1878
  throw new ze(`Could not find attr for ${[n, i]}`);
1879
1879
  if (a["value-type"] !== "ref")
1880
1880
  throw new Error(`Attr ${a.id} is not a ref`);
1881
- const [u, c] = a["forward-identity"], [d, f] = a["reverse-identity"], h = r + 1, p = s ? [
1882
- t(c, r),
1881
+ const [u, d] = a["forward-identity"], [c, f] = a["reverse-identity"], h = r + 1, p = s ? [
1882
+ t(d, r),
1883
1883
  a.id,
1884
1884
  t(f, h),
1885
1885
  it("time")
1886
1886
  ] : [
1887
- t(c, h),
1887
+ t(d, h),
1888
1888
  a.id,
1889
1889
  t(f, r),
1890
1890
  it("time")
1891
1891
  ];
1892
- return [s ? f : c, h, p, a, !!s];
1892
+ return [s ? f : d, h, p, a, !!s];
1893
1893
  }
1894
1894
  function Ar(t, e) {
1895
1895
  if (typeof e != "string")
@@ -1966,12 +1966,12 @@ function Do(t, e, n, r, i, s) {
1966
1966
  if (!u)
1967
1967
  throw new ze(`No attr for etype = ${n} label = ${i}`);
1968
1968
  if (s != null && s.hasOwnProperty("$isNull")) {
1969
- const c = We(e, n, "id");
1970
- if (!c)
1969
+ const d = We(e, n, "id");
1970
+ if (!d)
1971
1971
  throw new ze(`No attr for etype = ${n} label = id`);
1972
1972
  return [
1973
1973
  t(n, r),
1974
- c.id,
1974
+ d.id,
1975
1975
  { $isNull: { attrId: u.id, isNull: s.$isNull, reverse: !o } },
1976
1976
  it("time")
1977
1977
  ];
@@ -1984,15 +1984,15 @@ function Do(t, e, n, r, i, s) {
1984
1984
  ] : [s, u.id, t(n, r), it("time")];
1985
1985
  }
1986
1986
  function Uo(t, e, n, r, i) {
1987
- const [s, o, a] = i.reduce((u, c) => {
1988
- const [d, f, h] = u, [p, b, y] = Ti(t, e, d, f, c);
1989
- return [p, b, [...h, y]];
1987
+ const [s, o, a] = i.reduce((u, d) => {
1988
+ const [c, f, h] = u, [p, _, y] = Ti(t, e, c, f, d);
1989
+ return [p, _, [...h, y]];
1990
1990
  }, [n, r, []]);
1991
1991
  return [s, o, a];
1992
1992
  }
1993
1993
  function yn(t, e, n, r, i, s) {
1994
- const o = i.slice(0, i.length - 1), a = i[i.length - 1], [u, c, d] = Uo(t, e, n, r, o), f = Do(t, e, u, c, a, s);
1995
- return d.concat([f]);
1994
+ const o = i.slice(0, i.length - 1), a = i[i.length - 1], [u, d, c] = Uo(t, e, n, r, o), f = Do(t, e, u, d, a, s);
1995
+ return c.concat([f]);
1996
1996
  }
1997
1997
  function Lo(t, e) {
1998
1998
  return e ? [e].concat(t) : t;
@@ -2010,9 +2010,9 @@ function Ko(t, e, n) {
2010
2010
  };
2011
2011
  }
2012
2012
  function jr(t, e, n, r, i, s) {
2013
- const o = t(r, i), a = s.map((u, c) => {
2014
- const d = Ko(t, o, c);
2015
- return vi(d, n, r, i, u);
2013
+ const o = t(r, i), a = s.map((u, d) => {
2014
+ const c = Ko(t, o, d);
2015
+ return vi(c, n, r, i, u);
2016
2016
  });
2017
2017
  return { [e]: { patterns: a, joinSym: o } };
2018
2018
  }
@@ -2035,11 +2035,11 @@ function vi(t, e, n, r, i) {
2035
2035
  return [];
2036
2036
  const a = s.split(".");
2037
2037
  if (o != null && o.hasOwnProperty("$ne") && (o = Object.assign(Object.assign({}, o), { $not: o.$ne }), delete o.$ne), o != null && o.hasOwnProperty("$not")) {
2038
- const u = yn(t, e, n, r, a, o), c = kr(t, e, n, r, a);
2038
+ const u = yn(t, e, n, r, a, o), d = kr(t, e, n, r, a);
2039
2039
  return [
2040
2040
  {
2041
2041
  or: {
2042
- patterns: [u, ...c],
2042
+ patterns: [u, ...d],
2043
2043
  joinSym: t(n, r)
2044
2044
  }
2045
2045
  }
@@ -2063,15 +2063,15 @@ function zo(t, e, n) {
2063
2063
  return [t(e, n), t("time", n)];
2064
2064
  }
2065
2065
  function Vo(t, e, n, r, i, s) {
2066
- const [o, a, u, c, d] = Ti(t, e, n, r, i), f = $o(u, t(n, r), s);
2067
- return [o, a, f, c, d];
2066
+ const [o, a, u, d, c] = Ti(t, e, n, r, i), f = $o(u, t(n, r), s);
2067
+ return [o, a, f, d, c];
2068
2068
  }
2069
2069
  function Go(t, e, { etype: n, level: r, form: i }, s) {
2070
2070
  const o = Object.keys(i).filter((a) => a !== "$");
2071
- return o.length ? Object.entries(s).map(function([u, c]) {
2071
+ return o.length ? Object.entries(s).map(function([u, d]) {
2072
2072
  return o.map(function(h) {
2073
- var p, b, y;
2074
- const g = !!(e.cardinalityInference && (!((y = (b = (p = e.linkIndex) === null || p === void 0 ? void 0 : p[n]) === null || b === void 0 ? void 0 : b[h]) === null || y === void 0) && y.isSingular));
2073
+ var p, _, y;
2074
+ const g = !!(e.cardinalityInference && (!((y = (_ = (p = e.linkIndex) === null || p === void 0 ? void 0 : p[n]) === null || _ === void 0 ? void 0 : _[h]) === null || y === void 0) && y.isSingular));
2075
2075
  try {
2076
2076
  const [T, w, v] = Vo(t, e, n, r, h, u), P = Oi(e, {
2077
2077
  etype: T,
@@ -2087,7 +2087,7 @@ function Go(t, e, { etype: n, level: r, form: i }, s) {
2087
2087
  }
2088
2088
  }).reduce(function(h, p) {
2089
2089
  return Object.assign(Object.assign({}, h), p);
2090
- }, c);
2090
+ }, d);
2091
2091
  }) : Object.values(s);
2092
2092
  }
2093
2093
  function Bo(t, e, n) {
@@ -2101,11 +2101,11 @@ function _n(t) {
2101
2101
  }
2102
2102
  function Qo(t, e, n, r) {
2103
2103
  var i;
2104
- const [s, o, a, u] = t, c = n === "desc" ? 1 : -1;
2104
+ const [s, o, a, u] = t, d = n === "desc" ? 1 : -1;
2105
2105
  if (((i = e["forward-identity"]) === null || i === void 0 ? void 0 : i[2]) === "id")
2106
- return It(r, [s, u], null) === c;
2107
- const [d, f] = r, h = e["checked-data-type"], p = h === "date" ? _n(f) : f, b = h === "date" ? _n(a) : a;
2108
- return It([d, p], [s, b], h) === c;
2106
+ return It(r, [s, u], null) === d;
2107
+ const [c, f] = r, h = e["checked-data-type"], p = h === "date" ? _n(f) : f, _ = h === "date" ? _n(a) : a;
2108
+ return It([c, p], [s, _], h) === d;
2109
2109
  }
2110
2110
  function Yo(t, e) {
2111
2111
  const n = e[1];
@@ -2138,29 +2138,29 @@ function Zo(t, e, n) {
2138
2138
  }
2139
2139
  function Xo(t, { etype: e, pageInfo: n, dq: r, form: i }) {
2140
2140
  var s, o;
2141
- const a = (s = i == null ? void 0 : i.$) === null || s === void 0 ? void 0 : s.order, u = Si(i), c = ea(i);
2142
- let d = go(t, r);
2141
+ const a = (s = i == null ? void 0 : i.$) === null || s === void 0 ? void 0 : s.order, u = Si(i), d = ea(i);
2142
+ let c = go(t, r);
2143
2143
  const f = n == null ? void 0 : n["start-cursor"], h = Jo(t, e, f, a);
2144
2144
  if (h && ((o = h == null ? void 0 : h["forward-identity"]) === null || o === void 0 ? void 0 : o[2]) !== "id") {
2145
2145
  const y = h["checked-data-type"] === "date", g = h.id;
2146
- d = d.map(([T]) => {
2146
+ c = c.map(([T]) => {
2147
2147
  var w, v, P, E, U;
2148
2148
  let F = (U = (E = (P = (v = (w = t.eav.get(T)) === null || w === void 0 ? void 0 : w.get(g)) === null || v === void 0 ? void 0 : v.values()) === null || P === void 0 ? void 0 : P.next()) === null || E === void 0 ? void 0 : E.value) === null || U === void 0 ? void 0 : U[2];
2149
2149
  return y && (F = _n(F)), [T, F];
2150
2150
  });
2151
2151
  }
2152
- d.sort(c === "asc" ? function(g, T) {
2152
+ c.sort(d === "asc" ? function(g, T) {
2153
2153
  return It(g, T, h == null ? void 0 : h["checked-data-type"]);
2154
2154
  } : function(g, T) {
2155
2155
  return It(T, g, h == null ? void 0 : h["checked-data-type"]);
2156
2156
  });
2157
2157
  let p = {};
2158
- const b = Zo(t, e, r);
2159
- for (const y of d) {
2158
+ const _ = Zo(t, e, r);
2159
+ for (const y of c) {
2160
2160
  const [g] = y;
2161
- if (p[g] || !u && f && h && Qo(f, h, c, y))
2161
+ if (p[g] || !u && f && h && Qo(f, h, d, y))
2162
2162
  continue;
2163
- const T = so(t, b, g);
2163
+ const T = so(t, _, g);
2164
2164
  T && (p[g] = T);
2165
2165
  }
2166
2166
  return p;
@@ -2176,21 +2176,21 @@ function Si(t) {
2176
2176
  return !i && !s && !o;
2177
2177
  }
2178
2178
  function ta(t, { etype: e, level: n, form: r, join: i, pageInfo: s }) {
2179
- var o, a, u, c, d;
2179
+ var o, a, u, d, c;
2180
2180
  if (!Si(r) && (!s || !s["start-cursor"]))
2181
2181
  return [];
2182
- const f = Lo(qo(t, e, n, (o = r.$) === null || o === void 0 ? void 0 : o.where), i), h = zo(Ut, e, n), p = (a = r.$) === null || a === void 0 ? void 0 : a.fields, b = Xo(t, {
2182
+ const f = Lo(qo(t, e, n, (o = r.$) === null || o === void 0 ? void 0 : o.where), i), h = zo(Ut, e, n), p = (a = r.$) === null || a === void 0 ? void 0 : a.fields, _ = Xo(t, {
2183
2183
  etype: e,
2184
2184
  pageInfo: s,
2185
2185
  form: r,
2186
2186
  dq: { where: f, find: h, fields: p }
2187
- }), y = ((u = r.$) === null || u === void 0 ? void 0 : u.limit) || ((c = r.$) === null || c === void 0 ? void 0 : c.first) || ((d = r.$) === null || d === void 0 ? void 0 : d.last);
2187
+ }), y = ((u = r.$) === null || u === void 0 ? void 0 : u.limit) || ((d = r.$) === null || d === void 0 ? void 0 : d.first) || ((c = r.$) === null || c === void 0 ? void 0 : c.last);
2188
2188
  if (y != null) {
2189
2189
  n > 0 && console.warn("WARNING: Limits in child queries are only run client-side. Data returned from the server will not have a limit.");
2190
- const g = Object.entries(b);
2191
- return g.length <= y ? b : Object.fromEntries(g.slice(0, y));
2190
+ const g = Object.entries(_);
2191
+ return g.length <= y ? _ : Object.fromEntries(g.slice(0, y));
2192
2192
  }
2193
- return b;
2193
+ return _;
2194
2194
  }
2195
2195
  function na(t, e) {
2196
2196
  try {
@@ -2301,8 +2301,8 @@ function ca(t, e) {
2301
2301
  if (a)
2302
2302
  i.push(a);
2303
2303
  else if (Array.isArray(o) && o.length == 2 && n[o[0]]) {
2304
- const [u, c] = o;
2305
- i.push([n[u], c]);
2304
+ const [u, d] = o;
2305
+ i.push([n[u], d]);
2306
2306
  } else
2307
2307
  i.push(o);
2308
2308
  }
@@ -2378,16 +2378,16 @@ function Ai(t, e, n, r) {
2378
2378
  }
2379
2379
  function la({ attrs: t }, [e, n, r]) {
2380
2380
  const i = Object.entries(r).flatMap(([s, o]) => {
2381
- const a = Array.isArray(o) ? o : [o], u = V(t, e, s), c = Ce(t, e, s);
2382
- return a.map((d) => u ? [
2381
+ const a = Array.isArray(o) ? o : [o], u = V(t, e, s), d = Ce(t, e, s);
2382
+ return a.map((c) => u ? [
2383
2383
  "add-triple",
2384
2384
  re(t, e, n),
2385
2385
  u.id,
2386
- re(t, u["reverse-identity"][1], d)
2386
+ re(t, u["reverse-identity"][1], c)
2387
2387
  ] : [
2388
2388
  "add-triple",
2389
- re(t, c["forward-identity"][1], d),
2390
- c.id,
2389
+ re(t, d["forward-identity"][1], c),
2390
+ d.id,
2391
2391
  re(t, e, n)
2392
2392
  ]);
2393
2393
  });
@@ -2395,16 +2395,16 @@ function la({ attrs: t }, [e, n, r]) {
2395
2395
  }
2396
2396
  function ha({ attrs: t }, [e, n, r]) {
2397
2397
  const i = Object.entries(r).flatMap(([s, o]) => {
2398
- const a = Array.isArray(o) ? o : [o], u = V(t, e, s), c = Ce(t, e, s);
2399
- return a.map((d) => u ? [
2398
+ const a = Array.isArray(o) ? o : [o], u = V(t, e, s), d = Ce(t, e, s);
2399
+ return a.map((c) => u ? [
2400
2400
  "retract-triple",
2401
2401
  re(t, e, n),
2402
2402
  u.id,
2403
- re(t, u["reverse-identity"][1], d)
2403
+ re(t, u["reverse-identity"][1], c)
2404
2404
  ] : [
2405
2405
  "retract-triple",
2406
- re(t, c["forward-identity"][1], d),
2407
- c.id,
2406
+ re(t, d["forward-identity"][1], c),
2407
+ d.id,
2408
2408
  re(t, e, n)
2409
2409
  ]);
2410
2410
  });
@@ -2416,8 +2416,8 @@ function pa(t, e, n) {
2416
2416
  for (const s of t || []) {
2417
2417
  const o = s == null ? void 0 : s.aev.get(r);
2418
2418
  if (o) {
2419
- for (const [a, u, c] of ne(o, 2))
2420
- if (c === i)
2419
+ for (const [a, u, d] of ne(o, 2))
2420
+ if (d === i)
2421
2421
  return !0;
2422
2422
  }
2423
2423
  }
@@ -2436,22 +2436,22 @@ function ji({ stores: t, attrs: e }, [n, r, i, s]) {
2436
2436
  return (s == null ? void 0 : s.upsert) === !1 ? { mode: "update" } : (s == null ? void 0 : s.upsert) === !0 ? null : pa(t, n, r) ? { mode: "update" } : null;
2437
2437
  }
2438
2438
  function ya(t, e) {
2439
- const { stores: n, attrs: r } = t, [i, s, o, a] = e, u = Kn(o), c = re(r, i, s);
2440
- return [["id", c]].concat(Object.entries(u)).map(([f, h]) => {
2439
+ const { stores: n, attrs: r } = t, [i, s, o, a] = e, u = Kn(o), d = re(r, i, s);
2440
+ return [["id", d]].concat(Object.entries(u)).map(([f, h]) => {
2441
2441
  const p = V(r, i, f);
2442
- return p["checked-data-type"] === "date" && t.useDateObjects && (h = xt(h)), ["add-triple", c, p.id, h, { mode: "create" }];
2442
+ return p["checked-data-type"] === "date" && t.useDateObjects && (h = xt(h)), ["add-triple", d, p.id, h, { mode: "create" }];
2443
2443
  });
2444
2444
  }
2445
2445
  function _a(t, e) {
2446
- const { stores: n, attrs: r } = t, [i, s, o, a] = e, u = Kn(o), c = re(r, i, s), d = ji(t, [i, c, o, a]);
2447
- return [["id", c]].concat(Object.entries(u)).map(([h, p]) => {
2448
- const b = V(r, i, h);
2449
- return b["checked-data-type"] === "date" && t.useDateObjects && (p = xt(p)), [
2446
+ const { stores: n, attrs: r } = t, [i, s, o, a] = e, u = Kn(o), d = re(r, i, s), c = ji(t, [i, d, o, a]);
2447
+ return [["id", d]].concat(Object.entries(u)).map(([h, p]) => {
2448
+ const _ = V(r, i, h);
2449
+ return _["checked-data-type"] === "date" && t.useDateObjects && (p = xt(p)), [
2450
2450
  "add-triple",
2451
- c,
2452
- b.id,
2451
+ d,
2452
+ _.id,
2453
2453
  p,
2454
- ...d ? [d] : []
2454
+ ...c ? [c] : []
2455
2455
  ];
2456
2456
  });
2457
2457
  }
@@ -2459,22 +2459,22 @@ function ba({ attrs: t }, [e, n]) {
2459
2459
  return [["delete-entity", re(t, e, n), e]];
2460
2460
  }
2461
2461
  function ga(t, e) {
2462
- const { stores: n, attrs: r } = t, [i, s, o, a] = e, u = Kn(o), c = re(r, i, s), d = ji(t, [i, c, o, a]), f = Object.entries(u).map(([p, b]) => {
2462
+ const { stores: n, attrs: r } = t, [i, s, o, a] = e, u = Kn(o), d = re(r, i, s), c = ji(t, [i, d, o, a]), f = Object.entries(u).map(([p, _]) => {
2463
2463
  const y = V(r, i, p);
2464
2464
  return [
2465
2465
  "deep-merge-triple",
2466
- c,
2466
+ d,
2467
2467
  y.id,
2468
- b,
2469
- ...d ? [d] : []
2468
+ _,
2469
+ ...c ? [c] : []
2470
2470
  ];
2471
2471
  });
2472
2472
  return [[
2473
2473
  "add-triple",
2474
- c,
2474
+ d,
2475
2475
  V(r, i, "id").id,
2476
- c,
2477
- ...d ? [d] : []
2476
+ d,
2477
+ ...c ? [c] : []
2478
2478
  ]].concat(f);
2479
2479
  }
2480
2480
  function ma({ attrs: t }, [e, n, r]) {
@@ -2574,9 +2574,9 @@ function Ma(t) {
2574
2574
  const o = wn(i);
2575
2575
  if (o && e.push({ etype: r, lookupPair: o }), n === "link")
2576
2576
  for (const [a, u] of Object.entries(s)) {
2577
- const c = Array.isArray(u) ? u : [u];
2578
- for (const d of c) {
2579
- const f = wn(d);
2577
+ const d = Array.isArray(u) ? u : [u];
2578
+ for (const c of d) {
2579
+ const f = wn(c);
2580
2580
  f && e.push({
2581
2581
  etype: r,
2582
2582
  lookupPair: f,
@@ -2592,44 +2592,44 @@ function Ia({ attrs: t, schema: e }, n) {
2592
2592
  function u(f) {
2593
2593
  o[f.id] = f, a.push(["add-attr", f]), s.add(f.id);
2594
2594
  }
2595
- function c(f) {
2595
+ function d(f) {
2596
2596
  f != null && f.isUnsynced && !s.has(f.id) && (a.push(["add-attr", f]), s.add(f.id));
2597
2597
  }
2598
- function d(f, h) {
2599
- const p = V(o, f, h), b = Ce(o, f, h);
2600
- c(p), c(b), !p && !b && u(Cr(e, f, h, Pa));
2598
+ function c(f, h) {
2599
+ const p = V(o, f, h), _ = Ce(o, f, h);
2600
+ d(p), d(_), !p && !_ && u(Cr(e, f, h, Pa));
2601
2601
  }
2602
2602
  for (const f of n)
2603
- for (const { etype: h, lookupPair: p, linkLabel: b } of Ma(f)) {
2603
+ for (const { etype: h, lookupPair: p, linkLabel: _ } of Ma(f)) {
2604
2604
  const y = p[0];
2605
- if (b) {
2606
- d(h, b);
2607
- const g = V(o, h, b), T = Ce(o, h, b);
2608
- c(g), c(T);
2609
- const w = ((r = g == null ? void 0 : g["reverse-identity"]) === null || r === void 0 ? void 0 : r[1]) || ((i = T == null ? void 0 : T["forward-identity"]) === null || i === void 0 ? void 0 : i[1]) || b;
2605
+ if (_) {
2606
+ c(h, _);
2607
+ const g = V(o, h, _), T = Ce(o, h, _);
2608
+ d(g), d(T);
2609
+ const w = ((r = g == null ? void 0 : g["reverse-identity"]) === null || r === void 0 ? void 0 : r[1]) || ((i = T == null ? void 0 : T["forward-identity"]) === null || i === void 0 ? void 0 : i[1]) || _;
2610
2610
  if (gn(o, w, y))
2611
- d(w, mn(y));
2611
+ c(w, mn(y));
2612
2612
  else {
2613
2613
  const v = V(o, w, y);
2614
- v || u(Tt(e, w, y, Tn)), c(v);
2614
+ v || u(Tt(e, w, y, Tn)), d(v);
2615
2615
  }
2616
2616
  } else if (gn(o, h, y))
2617
- d(h, mn(y));
2617
+ c(h, mn(y));
2618
2618
  else {
2619
2619
  const g = V(o, h, y);
2620
- g || u(Tt(e, h, y, Tn)), c(g);
2620
+ g || u(Tt(e, h, y, Tn)), d(g);
2621
2621
  }
2622
2622
  }
2623
2623
  for (const f of n) {
2624
- const [h, p, b, y] = f;
2624
+ const [h, p, _, y] = f;
2625
2625
  if (Aa.has(h)) {
2626
2626
  const g = V(o, p, "id");
2627
- c(g), g || u(Tt(e, p, "id", { "unique?": !0 }));
2627
+ d(g), g || u(Tt(e, p, "id", { "unique?": !0 }));
2628
2628
  for (const T of Object.keys(y)) {
2629
2629
  const w = V(o, p, T);
2630
- if (c(w), ka.has(h) && (w || u(Tt(e, p, T, T === "id" ? { "unique?": !0 } : null))), ja.has(h)) {
2630
+ if (d(w), ka.has(h) && (w || u(Tt(e, p, T, T === "id" ? { "unique?": !0 } : null))), ja.has(h)) {
2631
2631
  const v = Ce(o, p, T);
2632
- !w && !v && u(Cr(e, p, T)), c(v);
2632
+ !w && !v && u(Cr(e, p, T)), d(v);
2633
2633
  }
2634
2634
  }
2635
2635
  }
@@ -2647,24 +2647,24 @@ var Ye = function(t, e, n, r) {
2647
2647
  });
2648
2648
  }
2649
2649
  return new (n || (n = Promise))(function(s, o) {
2650
- function a(d) {
2650
+ function a(c) {
2651
2651
  try {
2652
- c(r.next(d));
2652
+ d(r.next(c));
2653
2653
  } catch (f) {
2654
2654
  o(f);
2655
2655
  }
2656
2656
  }
2657
- function u(d) {
2657
+ function u(c) {
2658
2658
  try {
2659
- c(r.throw(d));
2659
+ d(r.throw(c));
2660
2660
  } catch (f) {
2661
2661
  o(f);
2662
2662
  }
2663
2663
  }
2664
- function c(d) {
2665
- d.done ? s(d.value) : i(d.value).then(a, u);
2664
+ function d(c) {
2665
+ c.done ? s(c.value) : i(c.value).then(a, u);
2666
2666
  }
2667
- c((r = r.apply(t, e || [])).next());
2667
+ d((r = r.apply(t, e || [])).next());
2668
2668
  });
2669
2669
  };
2670
2670
  const $a = 2, xa = ["kv", "querySubs"];
@@ -2699,15 +2699,15 @@ class ki {
2699
2699
  if (!o)
2700
2700
  return;
2701
2701
  const a = /* @__PURE__ */ new Set();
2702
- for (const [u, c] of Object.entries(o)) {
2703
- const d = r.put(c, u);
2704
- d.onerror = Jt(`Move ${u} to querySubs store failed`), a.add(d);
2702
+ for (const [u, d] of Object.entries(o)) {
2703
+ const c = r.put(d, u);
2704
+ c.onerror = Jt(`Move ${u} to querySubs store failed`), a.add(c);
2705
2705
  }
2706
2706
  for (const u of a)
2707
2707
  u.onsuccess = () => {
2708
2708
  if (a.delete(u), a.size === 0) {
2709
- const c = n.delete("querySubs");
2710
- c.onerror = Jt("Cleanup querySubs from kv store failed");
2709
+ const d = n.delete("querySubs");
2710
+ d.onerror = Jt("Cleanup querySubs from kv store failed");
2711
2711
  }
2712
2712
  };
2713
2713
  };
@@ -2739,9 +2739,9 @@ class ki {
2739
2739
  const r = yield this._dbPromise;
2740
2740
  return new Promise((i, s) => {
2741
2741
  const u = r.transaction([this._storeName], "readwrite").objectStore(this._storeName).put(n, e);
2742
- u.onerror = (c) => {
2743
- s(c);
2744
- }, u.onsuccess = (c) => {
2742
+ u.onerror = (d) => {
2743
+ s(d);
2744
+ }, u.onsuccess = (d) => {
2745
2745
  i();
2746
2746
  };
2747
2747
  });
@@ -2753,14 +2753,14 @@ class ki {
2753
2753
  const n = yield this._dbPromise;
2754
2754
  return new Promise((r, i) => {
2755
2755
  const s = n.transaction([this._storeName], "readwrite"), o = s.objectStore(this._storeName), a = /* @__PURE__ */ new Set();
2756
- for (const [u, c] of e) {
2757
- const d = o.put(c, u);
2758
- a.add(d);
2756
+ for (const [u, d] of e) {
2757
+ const c = o.put(d, u);
2758
+ a.add(c);
2759
2759
  }
2760
2760
  for (const u of a)
2761
- u.onerror = (c) => {
2762
- s.abort(), i(c);
2763
- }, u.onsuccess = (c) => {
2761
+ u.onerror = (d) => {
2762
+ s.abort(), i(d);
2763
+ }, u.onsuccess = (d) => {
2764
2764
  a.delete(u), a.size === 0 && r();
2765
2765
  };
2766
2766
  });
@@ -2800,24 +2800,24 @@ var Da = function(t, e, n, r) {
2800
2800
  });
2801
2801
  }
2802
2802
  return new (n || (n = Promise))(function(s, o) {
2803
- function a(d) {
2803
+ function a(c) {
2804
2804
  try {
2805
- c(r.next(d));
2805
+ d(r.next(c));
2806
2806
  } catch (f) {
2807
2807
  o(f);
2808
2808
  }
2809
2809
  }
2810
- function u(d) {
2810
+ function u(c) {
2811
2811
  try {
2812
- c(r.throw(d));
2812
+ d(r.throw(c));
2813
2813
  } catch (f) {
2814
2814
  o(f);
2815
2815
  }
2816
2816
  }
2817
- function c(d) {
2818
- d.done ? s(d.value) : i(d.value).then(a, u);
2817
+ function d(c) {
2818
+ c.done ? s(c.value) : i(c.value).then(a, u);
2819
2819
  }
2820
- c((r = r.apply(t, e || [])).next());
2820
+ d((r = r.apply(t, e || [])).next());
2821
2821
  });
2822
2822
  };
2823
2823
  class Ci {
@@ -2854,24 +2854,24 @@ var Ua = function(t, e, n, r) {
2854
2854
  });
2855
2855
  }
2856
2856
  return new (n || (n = Promise))(function(s, o) {
2857
- function a(d) {
2857
+ function a(c) {
2858
2858
  try {
2859
- c(r.next(d));
2859
+ d(r.next(c));
2860
2860
  } catch (f) {
2861
2861
  o(f);
2862
2862
  }
2863
2863
  }
2864
- function u(d) {
2864
+ function u(c) {
2865
2865
  try {
2866
- c(r.throw(d));
2866
+ d(r.throw(c));
2867
2867
  } catch (f) {
2868
2868
  o(f);
2869
2869
  }
2870
2870
  }
2871
- function c(d) {
2872
- d.done ? s(d.value) : i(d.value).then(a, u);
2871
+ function d(c) {
2872
+ c.done ? s(c.value) : i(c.value).then(a, u);
2873
2873
  }
2874
- c((r = r.apply(t, e || [])).next());
2874
+ d((r = r.apply(t, e || [])).next());
2875
2875
  });
2876
2876
  };
2877
2877
  class Lt extends Ve {
@@ -2899,24 +2899,24 @@ var Be = function(t, e, n, r) {
2899
2899
  });
2900
2900
  }
2901
2901
  return new (n || (n = Promise))(function(s, o) {
2902
- function a(d) {
2902
+ function a(c) {
2903
2903
  try {
2904
- c(r.next(d));
2904
+ d(r.next(c));
2905
2905
  } catch (f) {
2906
2906
  o(f);
2907
2907
  }
2908
2908
  }
2909
- function u(d) {
2909
+ function u(c) {
2910
2910
  try {
2911
- c(r.throw(d));
2911
+ d(r.throw(c));
2912
2912
  } catch (f) {
2913
2913
  o(f);
2914
2914
  }
2915
2915
  }
2916
- function c(d) {
2917
- d.done ? s(d.value) : i(d.value).then(a, u);
2916
+ function d(c) {
2917
+ c.done ? s(c.value) : i(c.value).then(a, u);
2918
2918
  }
2919
- c((r = r.apply(t, e || [])).next());
2919
+ d((r = r.apply(t, e || [])).next());
2920
2920
  });
2921
2921
  };
2922
2922
  function La({ apiURI: t, appId: e, email: n }) {
@@ -3012,24 +3012,24 @@ var dt = function(t, e, n, r) {
3012
3012
  });
3013
3013
  }
3014
3014
  return new (n || (n = Promise))(function(s, o) {
3015
- function a(d) {
3015
+ function a(c) {
3016
3016
  try {
3017
- c(r.next(d));
3017
+ d(r.next(c));
3018
3018
  } catch (f) {
3019
3019
  o(f);
3020
3020
  }
3021
3021
  }
3022
- function u(d) {
3022
+ function u(c) {
3023
3023
  try {
3024
- c(r.throw(d));
3024
+ d(r.throw(c));
3025
3025
  } catch (f) {
3026
3026
  o(f);
3027
3027
  }
3028
3028
  }
3029
- function c(d) {
3030
- d.done ? s(d.value) : i(d.value).then(a, u);
3029
+ function d(c) {
3030
+ c.done ? s(c.value) : i(c.value).then(a, u);
3031
3031
  }
3032
- c((r = r.apply(t, e || [])).next());
3032
+ d((r = r.apply(t, e || [])).next());
3033
3033
  });
3034
3034
  };
3035
3035
  function za(t) {
@@ -3118,10 +3118,10 @@ function Ya(t, e, n) {
3118
3118
  s.user = Object.assign(Object.assign({}, a), { peerId: n });
3119
3119
  }
3120
3120
  for (const a of Object.keys((i = t.peers) !== null && i !== void 0 ? i : {})) {
3121
- const u = (e == null ? void 0 : e.peers) === void 0, c = Array.isArray(e == null ? void 0 : e.peers) && (e == null ? void 0 : e.peers.includes(a));
3122
- if (u || c) {
3123
- const d = Mr(t.peers[a], e == null ? void 0 : e.keys);
3124
- s.peers[a] = Object.assign(Object.assign({}, d), { peerId: a });
3121
+ const u = (e == null ? void 0 : e.peers) === void 0, d = Array.isArray(e == null ? void 0 : e.peers) && (e == null ? void 0 : e.peers.includes(a));
3122
+ if (u || d) {
3123
+ const c = Mr(t.peers[a], e == null ? void 0 : e.keys);
3124
+ s.peers[a] = Object.assign(Object.assign({}, c), { peerId: a });
3125
3125
  }
3126
3126
  }
3127
3127
  return s;
@@ -3147,31 +3147,31 @@ class Ir {
3147
3147
  this._reject(e);
3148
3148
  }
3149
3149
  }
3150
- var Te = function(t, e, n, r) {
3150
+ var _e = function(t, e, n, r) {
3151
3151
  function i(s) {
3152
3152
  return s instanceof n ? s : new n(function(o) {
3153
3153
  o(s);
3154
3154
  });
3155
3155
  }
3156
3156
  return new (n || (n = Promise))(function(s, o) {
3157
- function a(d) {
3157
+ function a(c) {
3158
3158
  try {
3159
- c(r.next(d));
3159
+ d(r.next(c));
3160
3160
  } catch (f) {
3161
3161
  o(f);
3162
3162
  }
3163
3163
  }
3164
- function u(d) {
3164
+ function u(c) {
3165
3165
  try {
3166
- c(r.throw(d));
3166
+ d(r.throw(c));
3167
3167
  } catch (f) {
3168
3168
  o(f);
3169
3169
  }
3170
3170
  }
3171
- function c(d) {
3172
- d.done ? s(d.value) : i(d.value).then(a, u);
3171
+ function d(c) {
3172
+ c.done ? s(c.value) : i(c.value).then(a, u);
3173
3173
  }
3174
- c((r = r.apply(t, e || [])).next());
3174
+ d((r = r.apply(t, e || [])).next());
3175
3175
  });
3176
3176
  };
3177
3177
  function Rr(t, e) {
@@ -3180,35 +3180,43 @@ function Rr(t, e) {
3180
3180
  const Zt = "__meta";
3181
3181
  class $r {
3182
3182
  constructor(e, n, r, i, s, o, a) {
3183
- var u, c;
3183
+ var u, d;
3184
3184
  this._subs = [], this._nextSave = null, this._nextGc = null, this._pendingSaveKeys = /* @__PURE__ */ new Set(), this._loadedKeys = /* @__PURE__ */ new Set(), this._version = 0, this._meta = {
3185
3185
  isLoading: !0,
3186
3186
  onLoadCbs: [],
3187
3187
  value: null,
3188
3188
  error: null,
3189
3189
  attempts: 0
3190
- }, this._persister = e, this._onMerge = n, this.serialize = r, this.parse = i, this._objectSize = s, this._log = o, this._saveThrottleMs = (u = a.saveThrottleMs) !== null && u !== void 0 ? u : 100, this._idleCallbackMaxWaitMs = (c = a.idleCallbackMaxWaitMs) !== null && c !== void 0 ? c : 1e3, this._gcOpts = a.gc, this.currentValue = {}, this._loadedKeys = /* @__PURE__ */ new Set(), this._loadingKeys = {}, this._initMeta();
3190
+ }, this._persister = e, this._onMerge = n, this.serialize = r, this.parse = i, this._objectSize = s, this._log = o, this._saveThrottleMs = (u = a.saveThrottleMs) !== null && u !== void 0 ? u : 100, this._idleCallbackMaxWaitMs = (d = a.idleCallbackMaxWaitMs) !== null && d !== void 0 ? d : 1e3, this._gcOpts = a.gc, this.currentValue = {}, this._loadedKeys = /* @__PURE__ */ new Set(), this._loadingKeys = {}, this._initMeta(), a.preloadEntryCount && this._preloadEntries(a.preloadEntryCount);
3191
3191
  }
3192
3192
  _initMeta() {
3193
- return Te(this, void 0, void 0, function* () {
3193
+ return _e(this, void 0, void 0, function* () {
3194
3194
  this._meta.loadingPromise && (yield this._meta.loadingPromise);
3195
3195
  try {
3196
3196
  const e = this._persister.getItem(Zt);
3197
3197
  this._meta.loadingPromise = e;
3198
3198
  const n = yield e;
3199
- this._meta.isLoading = !1, this._meta.error = null, this._meta.value = n || {};
3199
+ this._meta.isLoading = !1, this._meta.error = null, this._meta.value = n || { objects: {} };
3200
3200
  } catch (e) {
3201
3201
  this._meta.error = e, this._meta.attempts++, this._meta.loadingPromise = null;
3202
3202
  }
3203
3203
  });
3204
3204
  }
3205
3205
  _getMeta() {
3206
- return Te(this, void 0, void 0, function* () {
3206
+ return _e(this, void 0, void 0, function* () {
3207
3207
  return this._meta.value ? this._meta.value : this._meta.loadingPromise ? (yield this._meta.loadingPromise, this._meta.value) : (this._initMeta(), yield this._meta.loadingPromise, this._meta.value);
3208
3208
  });
3209
3209
  }
3210
+ _preloadEntries(e) {
3211
+ return _e(this, void 0, void 0, function* () {
3212
+ const n = yield this.waitForMetaToLoad(), r = Object.entries(n.objects);
3213
+ r.sort(([i, s], [o, a]) => a.updatedAt - s.updatedAt);
3214
+ for (const [i] of r.slice(0, e))
3215
+ this._loadKey(i);
3216
+ });
3217
+ }
3210
3218
  _getFromStorage(e) {
3211
- return Te(this, void 0, void 0, function* () {
3219
+ return _e(this, void 0, void 0, function* () {
3212
3220
  try {
3213
3221
  const n = yield this._persister.getItem(e);
3214
3222
  return this.parse(e, n);
@@ -3218,13 +3226,13 @@ class $r {
3218
3226
  });
3219
3227
  }
3220
3228
  waitForKeyToLoad(e) {
3221
- return Te(this, void 0, void 0, function* () {
3229
+ return _e(this, void 0, void 0, function* () {
3222
3230
  return this._loadedKeys.has(e) ? this.currentValue[e] : (yield this._loadingKeys[e] || this._loadKey(e), this.currentValue[e]);
3223
3231
  });
3224
3232
  }
3225
3233
  // Used for tests
3226
3234
  waitForMetaToLoad() {
3227
- return Te(this, void 0, void 0, function* () {
3235
+ return _e(this, void 0, void 0, function* () {
3228
3236
  return this._getMeta();
3229
3237
  });
3230
3238
  }
@@ -3234,7 +3242,7 @@ class $r {
3234
3242
  this._loadedKeys.delete(e), delete this._loadingKeys[e], delete this.currentValue[e];
3235
3243
  }
3236
3244
  _loadKey(e) {
3237
- return Te(this, void 0, void 0, function* () {
3245
+ return _e(this, void 0, void 0, function* () {
3238
3246
  if (this._loadedKeys.has(e) || e in this._loadingKeys)
3239
3247
  return;
3240
3248
  const n = this._getFromStorage(e);
@@ -3253,11 +3261,11 @@ class $r {
3253
3261
  var n, r;
3254
3262
  const i = [], s = e == null ? void 0 : e.skipGc;
3255
3263
  if (this._meta.isLoading) {
3256
- const p = new Promise((b, y) => {
3264
+ const p = new Promise((_, y) => {
3257
3265
  var g;
3258
- setTimeout(() => this._enqueuePersist(e ? Object.assign(Object.assign({}, e), { attempts: (e.attempts || 0) + 1 }) : { attempts: 1 }).then(b).catch(y), 10 + ((g = e == null ? void 0 : e.attempts) !== null && g !== void 0 ? g : 0) * 1e3);
3266
+ setTimeout(() => this._enqueuePersist(e ? Object.assign(Object.assign({}, e), { attempts: (e.attempts || 0) + 1 }) : { attempts: 1 }).then(_).catch(y), 10 + ((g = e == null ? void 0 : e.attempts) !== null && g !== void 0 ? g : 0) * 1e3);
3259
3267
  });
3260
- return i.push(p), Promise.all(i).then((b) => b.reduce((y, g) => y + g, 0));
3268
+ return i.push(p), Promise.all(i).then((_) => _.reduce((y, g) => y + g, 0));
3261
3269
  }
3262
3270
  const o = this._meta.value;
3263
3271
  if (!o)
@@ -3266,79 +3274,83 @@ class $r {
3266
3274
  for (const p of this._pendingSaveKeys)
3267
3275
  p in this.currentValue ? u.push(p) : (a.push(p), delete o.objects[p]);
3268
3276
  for (const p of a) {
3269
- const b = this._persister.removeItem(p);
3270
- i.push(b.then(() => 1)), this._loadedKeys.delete(p), this._pendingSaveKeys.delete(p);
3277
+ const _ = this._persister.removeItem(p);
3278
+ i.push(_.then(() => 1)), this._loadedKeys.delete(p), this._pendingSaveKeys.delete(p);
3271
3279
  }
3272
- const c = [], d = [[Zt, o]], f = (n = o.objects) !== null && n !== void 0 ? n : {};
3280
+ const d = [], c = [[Zt, o]], f = (n = o.objects) !== null && n !== void 0 ? n : {};
3273
3281
  o.objects = f;
3274
3282
  for (const p of u)
3275
3283
  if (this._loadedKeys.has(p)) {
3276
- const b = this.serialize(p, this.currentValue[p]);
3277
- d.push([p, b]);
3278
- const y = this._objectSize(b), g = (r = f[p]) !== null && r !== void 0 ? r : {
3284
+ const _ = this.serialize(p, this.currentValue[p]);
3285
+ c.push([p, _]);
3286
+ const y = this._objectSize(_), g = (r = f[p]) !== null && r !== void 0 ? r : {
3279
3287
  createdAt: Date.now(),
3280
3288
  updatedAt: Date.now(),
3281
3289
  size: y
3282
3290
  };
3283
3291
  g.updatedAt = Date.now(), g.size = y, f[p] = g, this._pendingSaveKeys.delete(p);
3284
3292
  } else
3285
- c.push(p);
3286
- const h = this._persister.multiSet(d);
3293
+ d.push(p);
3294
+ const h = this._persister.multiSet(c);
3287
3295
  i.push(h.then(() => 1));
3288
- for (const p of c) {
3289
- const b = this._loadKey(p).then(() => this._enqueuePersist(e));
3290
- i.push(b);
3296
+ for (const p of d) {
3297
+ const _ = this._loadKey(p).then(() => this._enqueuePersist(e));
3298
+ i.push(_);
3291
3299
  }
3292
- return s || this.gc(), Promise.all(i).then((p) => p.reduce((b, y) => b + y, 0));
3300
+ return s || this.gc(), Promise.all(i).then((p) => p.reduce((_, y) => _ + y, 0));
3293
3301
  }
3294
3302
  flush() {
3295
- return Te(this, void 0, void 0, function* () {
3303
+ return _e(this, void 0, void 0, function* () {
3296
3304
  return this._nextSave ? (clearTimeout(this._nextSave), this._nextSave = null, this._writeToStorage()) : void 0;
3297
3305
  });
3298
3306
  }
3299
3307
  _gc() {
3300
- return Te(this, void 0, void 0, function* () {
3308
+ return _e(this, void 0, void 0, function* () {
3301
3309
  const e = new Set(yield this._persister.getAllKeys());
3302
3310
  e.delete(Zt);
3303
3311
  const n = new Set(Object.keys(this.currentValue));
3304
- for (const u of Object.keys(this._loadingKeys))
3305
- n.add(u);
3306
- for (const u of this._loadedKeys)
3307
- n.add(u);
3312
+ for (const h of Object.keys(this._loadingKeys))
3313
+ n.add(h);
3314
+ for (const h of this._loadedKeys)
3315
+ n.add(h);
3308
3316
  const r = yield this._getMeta();
3309
3317
  if (!r) {
3310
3318
  this._log.info("Could not gc because we were not able to load meta");
3311
3319
  return;
3312
3320
  }
3313
- const i = {
3321
+ const i = [], s = {
3314
3322
  gcOpts: this._gcOpts,
3315
3323
  keys: e,
3316
3324
  sacredKeys: n,
3317
3325
  removed: [],
3318
3326
  metaRemoved: [],
3319
- removedMetaCount: 0,
3320
3327
  removedMissingCount: 0,
3321
3328
  removedOldCount: 0,
3322
3329
  removedThresholdCount: 0,
3323
3330
  removedSizeCount: 0
3324
3331
  };
3325
- for (const u of e)
3326
- n.has(u) || u in r.objects || (this._log.info("Lost track of key in meta", u), this._persister.removeItem(u), i.removed.push(u), i.removedMissingCount++);
3327
- const s = Date.now();
3328
- for (const [u, c] of Object.entries(r.objects))
3329
- !n.has(u) && c.updatedAt < s - this._gcOpts.maxAgeMs && (this._persister.removeItem(u), delete r.objects[u], i.removed.push(u), i.removedOldCount++);
3330
- const o = Object.entries(r.objects);
3331
- if (o.sort(([u, c], [d, f]) => c.updatedAt - f.updatedAt), o.length > this._gcOpts.maxEntries)
3332
- for (const [u] of o.slice(0, o.length - this._gcOpts.maxEntries))
3333
- this._persister.removeItem(u), delete r.objects[u], i.removed.push(u), i.removedThresholdCount++, o.splice(0, 1);
3334
- let a = o.reduce((u, [c, d]) => u + d.size, 0);
3335
- for (; a > 0 && a > this._gcOpts.maxSize && o.length; ) {
3336
- const [[u, c]] = o.splice(0, 1);
3337
- a -= c.size, this._persister.removeItem(u), delete r.objects[u], i.removed.push(u), i.removedSizeCount++;
3332
+ for (const h of e)
3333
+ n.has(h) || h in r.objects || (this._log.info("Lost track of key in meta", h), i.push(this._persister.removeItem(h)), s.removed.push(h), s.removedMissingCount++);
3334
+ const o = Date.now();
3335
+ for (const [h, p] of Object.entries(r.objects))
3336
+ !n.has(h) && p.updatedAt < o - this._gcOpts.maxAgeMs && (i.push(this._persister.removeItem(h)), delete r.objects[h], s.removed.push(h), s.removedOldCount++);
3337
+ const a = Object.entries(r.objects);
3338
+ a.sort(([h, p], [_, y]) => p.updatedAt - y.updatedAt);
3339
+ const u = a.filter(([h]) => !n.has(h));
3340
+ if (a.length > this._gcOpts.maxEntries)
3341
+ for (const [h] of u.slice(0, a.length - this._gcOpts.maxEntries))
3342
+ i.push(this._persister.removeItem(h)), delete r.objects[h], s.removed.push(h), s.removedThresholdCount++;
3343
+ const d = Object.entries(r.objects);
3344
+ d.sort(([h, p], [_, y]) => p.updatedAt - y.updatedAt);
3345
+ const c = d.filter(([h]) => !n.has(h));
3346
+ let f = d.reduce((h, [p, _]) => h + _.size, 0);
3347
+ for (; f > 0 && f > this._gcOpts.maxSize && c.length; ) {
3348
+ const [[h, p]] = c.splice(0, 1);
3349
+ f -= p.size, i.push(this._persister.removeItem(h)), delete r.objects[h], s.removed.push(h), s.removedSizeCount++;
3338
3350
  }
3339
- for (const u of Object.keys(r.objects))
3340
- !e.has(u) && !n.has(u) && delete r.objects[u];
3341
- (i.removed.length || i.metaRemoved.length) && this._enqueuePersist({ skipGc: !0 }), this._log.info("Completed GC", i);
3351
+ for (const h of Object.keys(r.objects))
3352
+ !e.has(h) && !n.has(h) && delete r.objects[h];
3353
+ return (s.removed.length || s.metaRemoved.length) && i.push(this._enqueuePersist({ skipGc: !0 })), this._log.info("Completed GC", s), yield Promise.all(i), s;
3342
3354
  });
3343
3355
  }
3344
3356
  gc() {
@@ -3346,7 +3358,7 @@ class $r {
3346
3358
  Rr(() => {
3347
3359
  this._nextGc = null, this._gc();
3348
3360
  }, 30 * 1e3);
3349
- }, 1e3));
3361
+ }, 1e3 * 60));
3350
3362
  }
3351
3363
  _enqueuePersist(e) {
3352
3364
  return new Promise((n, r) => {
@@ -3414,7 +3426,7 @@ function Dr(t) {
3414
3426
  }, e;
3415
3427
  }, {});
3416
3428
  }
3417
- const Qn = "v0.22.49-experimental.persisted-object-2.19448798235.1";
3429
+ const Qn = "v0.22.49-experimental.persisted-object-2.19477901153.1";
3418
3430
  function Ja(t, e) {
3419
3431
  return {
3420
3432
  info: t ? (...n) => console.info(...n, e()) : () => {
@@ -3515,17 +3527,17 @@ const Ur = [
3515
3527
  return !0;
3516
3528
  }
3517
3529
  }, Xa = (t, e, n, r, i, s, o) => {
3518
- const a = s.valueType === "json", u = (c, d, f) => {
3519
- if (!Ri(f, d, a))
3520
- throw new R(`Invalid value for operator '${c}' on attribute '${r}' in entity '${i}'. Expected ${d}, but received: ${typeof f}`, o);
3530
+ const a = s.valueType === "json", u = (d, c, f) => {
3531
+ if (!Ri(f, c, a))
3532
+ throw new R(`Invalid value for operator '${d}' on attribute '${r}' in entity '${i}'. Expected ${c}, but received: ${typeof f}`, o);
3521
3533
  };
3522
3534
  switch (t) {
3523
3535
  case "in":
3524
3536
  case "$in":
3525
3537
  if (!Array.isArray(e))
3526
3538
  throw new R(`Operator '${t}' for attribute '${r}' in entity '${i}' must be an array, but received: ${typeof e}`, o);
3527
- for (const c of e)
3528
- u(t, n, c);
3539
+ for (const d of e)
3540
+ u(t, n, d);
3529
3541
  break;
3530
3542
  case "$not":
3531
3543
  case "$ne":
@@ -3552,8 +3564,8 @@ const Ur = [
3552
3564
  if (o)
3553
3565
  return;
3554
3566
  const u = t;
3555
- for (const [c, d] of Object.entries(u))
3556
- Xa(c, d, s, e, r, n, `${i}.${c}`);
3567
+ for (const [d, c] of Object.entries(u))
3568
+ Xa(d, c, s, e, r, n, `${i}.${d}`);
3557
3569
  } else if (!Ri(t, s, o))
3558
3570
  throw new R(`Invalid value for attribute '${e}' in entity '${r}'. Expected ${s}, but received: ${typeof t}`, i);
3559
3571
  }, eu = (t, e, n, r, i) => {
@@ -3561,14 +3573,14 @@ const Ur = [
3561
3573
  if (s.length < 2)
3562
3574
  throw new R(`Invalid dot notation path '${t}'. Must contain at least one dot.`, i);
3563
3575
  let o = n;
3564
- for (let d = 0; d < s.length - 1; d++) {
3565
- const f = s[d], h = r.entities[o];
3576
+ for (let c = 0; c < s.length - 1; c++) {
3577
+ const f = s[c], h = r.entities[o];
3566
3578
  if (!h)
3567
3579
  throw new R(`Entity '${o}' does not exist in schema while traversing dot notation path '${t}'.`, i);
3568
3580
  const p = h.links[f];
3569
3581
  if (!p) {
3570
- const b = Object.keys(h.links);
3571
- throw new R(`Link '${f}' does not exist on entity '${o}' in dot notation path '${t}'. Available links: ${b.length > 0 ? b.join(", ") : "none"}`, i);
3582
+ const _ = Object.keys(h.links);
3583
+ throw new R(`Link '${f}' does not exist on entity '${o}' in dot notation path '${t}'. Available links: ${_.length > 0 ? _.join(", ") : "none"}`, i);
3572
3584
  }
3573
3585
  o = p.entityName;
3574
3586
  }
@@ -3581,24 +3593,24 @@ const Ur = [
3581
3593
  Fe(e, t, new J("string", !1, !0), n, i);
3582
3594
  return;
3583
3595
  }
3584
- const c = u.attrs[a];
3596
+ const d = u.attrs[a];
3585
3597
  if (Object.keys(u.links).includes(a)) {
3586
3598
  if (typeof e == "string" && !qe(e))
3587
3599
  throw new R(`Invalid value for link '${a}' in entity '${o}'. Expected a UUID, but received: ${e}`, i);
3588
3600
  Fe(e, t, new J("string", !1, !0), n, i);
3589
3601
  return;
3590
3602
  }
3591
- if (!c) {
3592
- const d = Object.keys(u.attrs);
3593
- throw new R(`Attribute '${a}' does not exist on entity '${o}' in dot notation path '${t}'. Available attributes: ${d.length > 0 ? d.join(", ") + ", id" : "id"}`, i);
3603
+ if (!d) {
3604
+ const c = Object.keys(u.attrs);
3605
+ throw new R(`Attribute '${a}' does not exist on entity '${o}' in dot notation path '${t}'. Available attributes: ${c.length > 0 ? c.join(", ") + ", id" : "id"}`, i);
3594
3606
  }
3595
- Fe(e, t, c, n, i);
3607
+ Fe(e, t, d, n, i);
3596
3608
  }, $i = (t, e, n, r) => {
3597
3609
  for (const [i, s] of Object.entries(t)) {
3598
3610
  if (i === "or" || i === "and") {
3599
3611
  if (Array.isArray(s))
3600
- for (const c of s)
3601
- typeof c == "object" && c !== null && $i(c, e, n, `${r}.${i}[${c}]`);
3612
+ for (const d of s)
3613
+ typeof d == "object" && d !== null && $i(d, e, n, `${r}.${i}[${d}]`);
3602
3614
  continue;
3603
3615
  }
3604
3616
  if (i === "id") {
@@ -3614,16 +3626,16 @@ const Ur = [
3614
3626
  continue;
3615
3627
  const a = o.attrs[i], u = o.links[i];
3616
3628
  if (!a && !u) {
3617
- const c = Object.keys(o.attrs), d = Object.keys(o.links);
3618
- throw new R(`Attribute or link '${i}' does not exist on entity '${e}'. Available attributes: ${c.length > 0 ? c.join(", ") : "none"}. Available links: ${d.length > 0 ? d.join(", ") : "none"}`, `${r}.${i}`);
3629
+ const d = Object.keys(o.attrs), c = Object.keys(o.links);
3630
+ throw new R(`Attribute or link '${i}' does not exist on entity '${e}'. Available attributes: ${d.length > 0 ? d.join(", ") : "none"}. Available links: ${c.length > 0 ? c.join(", ") : "none"}`, `${r}.${i}`);
3619
3631
  }
3620
3632
  if (a)
3621
3633
  Fe(s, i, a, e, `${r}.${i}`);
3622
3634
  else if (u) {
3623
3635
  if (typeof s == "string" && !qe(s))
3624
3636
  throw new R(`Invalid value for link '${i}' in entity '${e}'. Expected a UUID, but received: ${s}`, `${r}.${i}`);
3625
- const c = new J("string", !1, !0);
3626
- Fe(s, i, c, e, `${r}.${i}`);
3637
+ const d = new J("string", !1, !0);
3638
+ Fe(s, i, d, e, `${r}.${i}`);
3627
3639
  }
3628
3640
  }
3629
3641
  }, tu = (t, e, n, r, i = 0) => {
@@ -3774,24 +3786,24 @@ var Wr = function(t, e, n, r) {
3774
3786
  });
3775
3787
  }
3776
3788
  return new (n || (n = Promise))(function(s, o) {
3777
- function a(d) {
3789
+ function a(c) {
3778
3790
  try {
3779
- c(r.next(d));
3791
+ d(r.next(c));
3780
3792
  } catch (f) {
3781
3793
  o(f);
3782
3794
  }
3783
3795
  }
3784
- function u(d) {
3796
+ function u(c) {
3785
3797
  try {
3786
- c(r.throw(d));
3798
+ d(r.throw(c));
3787
3799
  } catch (f) {
3788
3800
  o(f);
3789
3801
  }
3790
3802
  }
3791
- function c(d) {
3792
- d.done ? s(d.value) : i(d.value).then(a, u);
3803
+ function d(c) {
3804
+ c.done ? s(c.value) : i(c.value).then(a, u);
3793
3805
  }
3794
- c((r = r.apply(t, e || [])).next());
3806
+ d((r = r.apply(t, e || [])).next());
3795
3807
  });
3796
3808
  };
3797
3809
  let Li = 0;
@@ -3908,24 +3920,24 @@ var N = function(t, e, n, r) {
3908
3920
  });
3909
3921
  }
3910
3922
  return new (n || (n = Promise))(function(s, o) {
3911
- function a(d) {
3923
+ function a(c) {
3912
3924
  try {
3913
- c(r.next(d));
3925
+ d(r.next(c));
3914
3926
  } catch (f) {
3915
3927
  o(f);
3916
3928
  }
3917
3929
  }
3918
- function u(d) {
3930
+ function u(c) {
3919
3931
  try {
3920
- c(r.throw(d));
3932
+ d(r.throw(c));
3921
3933
  } catch (f) {
3922
3934
  o(f);
3923
3935
  }
3924
3936
  }
3925
- function c(d) {
3926
- d.done ? s(d.value) : i(d.value).then(a, u);
3937
+ function d(c) {
3938
+ c.done ? s(c.value) : i(c.value).then(a, u);
3927
3939
  }
3928
- c((r = r.apply(t, e || [])).next());
3940
+ d((r = r.apply(t, e || [])).next());
3929
3941
  });
3930
3942
  }, uu = function(t, e) {
3931
3943
  var n = {};
@@ -3935,7 +3947,7 @@ var N = function(t, e, n, r) {
3935
3947
  e.indexOf(r[i]) < 0 && Object.prototype.propertyIsEnumerable.call(t, r[i]) && (n[r[i]] = t[r[i]]);
3936
3948
  return n;
3937
3949
  };
3938
- const _e = {
3950
+ const be = {
3939
3951
  CONNECTING: "connecting",
3940
3952
  OPENED: "opened",
3941
3953
  AUTHENTICATED: "authenticated",
@@ -4005,41 +4017,41 @@ function Vr(t) {
4005
4017
  class mu {
4006
4018
  constructor(e, n = ki, r = Ci, i, s) {
4007
4019
  var o, a, u;
4008
- if (this._isOnline = !0, this._isShutdown = !1, this.status = _e.CONNECTING, this.queryCbs = {}, this.queryOnceDfds = {}, this.authCbs = [], this.attrsCbs = [], this.mutationErrorCbs = [], this.connectionStatusCbs = [], this.mutationDeferredStore = /* @__PURE__ */ new Map(), this._reconnectTimeoutId = null, this._reconnectTimeoutMs = 0, this._transportType = "ws", this._wsOk = null, this._localIdPromises = {}, this._errorMessage = null, this._oauthCallbackResponse = null, this._linkIndex = null, this._rooms = {}, this._roomsPendingLeave = {}, this._presence = {}, this._broadcastQueue = [], this._broadcastSubs = {}, this._currentUserCached = { isLoading: !0, error: void 0, user: void 0 }, this._beforeUnloadCbs = [], this._dataForQueryCache = {}, this._inFlightMutationEventIds = /* @__PURE__ */ new Set(), this._onMergeQuerySub = (c, d, f) => {
4009
- const h = d == null ? void 0 : d.result, p = f == null ? void 0 : f.result;
4010
- return h && !p && f && (f.result = h), f || d;
4011
- }, this._onMergeKv = (c, d, f) => {
4020
+ if (this._isOnline = !0, this._isShutdown = !1, this.status = be.CONNECTING, this.queryCbs = {}, this.queryOnceDfds = {}, this.authCbs = [], this.attrsCbs = [], this.mutationErrorCbs = [], this.connectionStatusCbs = [], this.mutationDeferredStore = /* @__PURE__ */ new Map(), this._reconnectTimeoutId = null, this._reconnectTimeoutMs = 0, this._transportType = "ws", this._wsOk = null, this._localIdPromises = {}, this._errorMessage = null, this._oauthCallbackResponse = null, this._linkIndex = null, this._rooms = {}, this._roomsPendingLeave = {}, this._presence = {}, this._broadcastQueue = [], this._broadcastSubs = {}, this._currentUserCached = { isLoading: !0, error: void 0, user: void 0 }, this._beforeUnloadCbs = [], this._dataForQueryCache = {}, this._inFlightMutationEventIds = /* @__PURE__ */ new Set(), this._onMergeQuerySub = (d, c, f) => {
4021
+ const h = c == null ? void 0 : c.result, p = f == null ? void 0 : f.result;
4022
+ return h && !p && f && (f.result = h), f || c;
4023
+ }, this._onMergeKv = (d, c, f) => {
4012
4024
  var h, p;
4013
- switch (c) {
4025
+ switch (d) {
4014
4026
  case "pendingMutations": {
4015
- const b = (h = d == null ? void 0 : d.entries()) !== null && h !== void 0 ? h : [], y = (p = f == null ? void 0 : f.entries()) !== null && p !== void 0 ? p : [], g = new Map([...b, ...y]);
4016
- return (d ? this._rewriteMutationsSorted(this.attrs, d) : []).forEach(([w, v]) => {
4027
+ const _ = (h = c == null ? void 0 : c.entries()) !== null && h !== void 0 ? h : [], y = (p = f == null ? void 0 : f.entries()) !== null && p !== void 0 ? p : [], g = new Map([..._, ...y]);
4028
+ return (c ? this._rewriteMutationsSorted(this.attrs, c) : []).forEach(([w, v]) => {
4017
4029
  var P;
4018
4030
  !(!((P = f == null ? void 0 : f.pendingMutations) === null || P === void 0) && P.has(w)) && !v["tx-id"] && this._sendMutation(w, v);
4019
4031
  }), g;
4020
4032
  }
4021
4033
  default:
4022
- return d || f;
4034
+ return c || f;
4023
4035
  }
4024
- }, this.getPreviousResult = (c) => {
4025
- const d = X(c);
4026
- return this.dataForQuery(d);
4027
- }, this.notifyOne = (c) => {
4028
- var d, f;
4029
- const h = (d = this.queryCbs[c]) !== null && d !== void 0 ? d : [], p = (f = this._dataForQueryCache[c]) === null || f === void 0 ? void 0 : f.data, b = this.dataForQuery(c);
4030
- b && (Et(b, p) || h.forEach((y) => y.cb(b)));
4031
- }, this.notifyOneQueryOnce = (c) => {
4032
- var d;
4033
- const f = (d = this.queryOnceDfds[c]) !== null && d !== void 0 ? d : [], h = this.dataForQuery(c);
4036
+ }, this.getPreviousResult = (d) => {
4037
+ const c = X(d);
4038
+ return this.dataForQuery(c);
4039
+ }, this.notifyOne = (d) => {
4040
+ var c, f;
4041
+ const h = (c = this.queryCbs[d]) !== null && c !== void 0 ? c : [], p = (f = this._dataForQueryCache[d]) === null || f === void 0 ? void 0 : f.data, _ = this.dataForQuery(d);
4042
+ _ && (Et(_, p) || h.forEach((y) => y.cb(_)));
4043
+ }, this.notifyOneQueryOnce = (d) => {
4044
+ var c;
4045
+ const f = (c = this.queryOnceDfds[d]) !== null && c !== void 0 ? c : [], h = this.dataForQuery(d);
4034
4046
  f.forEach((p) => {
4035
- this._completeQueryOnce(p.q, c, p.dfd), p.dfd.resolve(h);
4047
+ this._completeQueryOnce(p.q, d, p.dfd), p.dfd.resolve(h);
4036
4048
  });
4037
- }, this.notifyQueryError = (c, d) => {
4038
- (this.queryCbs[c] || []).forEach((h) => h.cb({ error: d }));
4039
- }, this.pushTx = (c) => {
4040
- this.config.disableValidation || ou(c, this.config.schema);
4049
+ }, this.notifyQueryError = (d, c) => {
4050
+ (this.queryCbs[d] || []).forEach((h) => h.cb({ error: c }));
4051
+ }, this.pushTx = (d) => {
4052
+ this.config.disableValidation || ou(d, this.config.schema);
4041
4053
  try {
4042
- const d = Ra({
4054
+ const c = Ra({
4043
4055
  attrs: this.optimisticAttrs(),
4044
4056
  schema: this.config.schema,
4045
4057
  // XXX: How are we going to do this?
@@ -4049,31 +4061,31 @@ class mu {
4049
4061
  return (h = f == null ? void 0 : f.result) === null || h === void 0 ? void 0 : h.store;
4050
4062
  }),
4051
4063
  useDateObjects: this.config.useDateObjects
4052
- }, c);
4053
- return this.pushOps(d);
4054
- } catch (d) {
4055
- return this.pushOps([], d);
4064
+ }, d);
4065
+ return this.pushOps(c);
4066
+ } catch (c) {
4067
+ return this.pushOps([], c);
4056
4068
  }
4057
- }, this.pushOps = (c, d) => {
4058
- const f = B(), h = [...this._pendingMutations().values()], p = Math.max(0, ...h.map((g) => g.order || 0)) + 1, b = {
4069
+ }, this.pushOps = (d, c) => {
4070
+ const f = B(), h = [...this._pendingMutations().values()], p = Math.max(0, ...h.map((g) => g.order || 0)) + 1, _ = {
4059
4071
  op: "transact",
4060
- "tx-steps": c,
4072
+ "tx-steps": d,
4061
4073
  created: Date.now(),
4062
- error: d,
4074
+ error: c,
4063
4075
  order: p
4064
4076
  };
4065
4077
  this._updatePendingMutations((g) => {
4066
- g.set(f, b);
4078
+ g.set(f, _);
4067
4079
  });
4068
4080
  const y = new Ir();
4069
- return this.mutationDeferredStore.set(f, y), this._sendMutation(f, b), this.notifyAll(), y.promise;
4070
- }, this._transportOnOpen = (c) => {
4071
- const d = c.target;
4072
- if (this._transport !== d) {
4073
- this._log.info("[socket][open]", d.id, "skip; this is no longer the current transport");
4081
+ return this.mutationDeferredStore.set(f, y), this._sendMutation(f, _), this.notifyAll(), y.promise;
4082
+ }, this._transportOnOpen = (d) => {
4083
+ const c = d.target;
4084
+ if (this._transport !== c) {
4085
+ this._log.info("[socket][open]", c.id, "skip; this is no longer the current transport");
4074
4086
  return;
4075
4087
  }
4076
- this._log.info("[socket][open]", this._transport.id), this._setStatus(_e.OPENED), this.getCurrentUser().then((f) => {
4088
+ this._log.info("[socket][open]", this._transport.id), this._setStatus(be.OPENED), this.getCurrentUser().then((f) => {
4077
4089
  var h;
4078
4090
  this._trySend(B(), {
4079
4091
  op: "init",
@@ -4088,22 +4100,22 @@ class mu {
4088
4100
  "__admin-token": this.config.__adminToken
4089
4101
  });
4090
4102
  }).catch((f) => {
4091
- this._log.error("[socket][error]", d.id, f);
4103
+ this._log.error("[socket][error]", c.id, f);
4092
4104
  });
4093
- }, this._transportOnMessage = (c) => {
4094
- const d = c.target, f = c.message;
4095
- if (this._transport !== d) {
4096
- this._log.info("[socket][message]", d.id, f, "skip; this is no longer the current transport");
4105
+ }, this._transportOnMessage = (d) => {
4106
+ const c = d.target, f = d.message;
4107
+ if (this._transport !== c) {
4108
+ this._log.info("[socket][message]", c.id, f, "skip; this is no longer the current transport");
4097
4109
  return;
4098
4110
  }
4099
- !this._wsOk && d.type === "ws" && (this._wsOk = !0), this._transportType = "ws", this._handleReceive(d.id, c.message);
4100
- }, this._transportOnError = (c) => {
4101
- const d = c.target;
4102
- if (this._transport !== d) {
4103
- this._log.info("[socket][error]", d.id, "skip; this is no longer the current transport");
4111
+ !this._wsOk && c.type === "ws" && (this._wsOk = !0), this._transportType = "ws", this._handleReceive(c.id, d.message);
4112
+ }, this._transportOnError = (d) => {
4113
+ const c = d.target;
4114
+ if (this._transport !== c) {
4115
+ this._log.info("[socket][error]", c.id, "skip; this is no longer the current transport");
4104
4116
  return;
4105
4117
  }
4106
- this._log.error("[socket][error]", d.id, c);
4118
+ this._log.error("[socket][error]", c.id, d);
4107
4119
  }, this._scheduleReconnect = () => {
4108
4120
  !this._wsOk && this._transportType !== "sse" && (this._transportType = "sse", this._reconnectTimeoutMs = 0), setTimeout(() => {
4109
4121
  if (this._reconnectTimeoutMs = Math.min(this._reconnectTimeoutMs + 1e3, 1e4), !this._isOnline) {
@@ -4112,38 +4124,38 @@ class mu {
4112
4124
  }
4113
4125
  this._startSocket();
4114
4126
  }, this._reconnectTimeoutMs);
4115
- }, this._transportOnClose = (c) => {
4116
- const d = c.target;
4117
- if (this._transport !== d) {
4118
- this._log.info("[socket][close]", d.id, "skip; this is no longer the current transport");
4127
+ }, this._transportOnClose = (d) => {
4128
+ const c = d.target;
4129
+ if (this._transport !== c) {
4130
+ this._log.info("[socket][close]", c.id, "skip; this is no longer the current transport");
4119
4131
  return;
4120
4132
  }
4121
- this._setStatus(_e.CLOSED);
4133
+ this._setStatus(be.CLOSED);
4122
4134
  for (const f of Object.values(this._rooms))
4123
4135
  f.isConnected = !1;
4124
4136
  if (this._isShutdown) {
4125
- this._log.info("[socket][close]", d.id, "Reactor has been shut down and will not reconnect");
4137
+ this._log.info("[socket][close]", c.id, "Reactor has been shut down and will not reconnect");
4126
4138
  return;
4127
4139
  }
4128
- this._log.info("[socket][close]", d.id, "schedule reconnect, ms =", this._reconnectTimeoutMs), this._scheduleReconnect();
4140
+ this._log.info("[socket][close]", c.id, "schedule reconnect, ms =", this._reconnectTimeoutMs), this._scheduleReconnect();
4129
4141
  }, this._EventSource = s, this.config = Object.assign(Object.assign({}, lu), e), this.queryCacheLimit = (o = this.config.queryCacheLimit) !== null && o !== void 0 ? o : 10, this._pendingTxCleanupTimeout = (a = this.config.pendingTxCleanupTimeout) !== null && a !== void 0 ? a : du, this._pendingMutationCleanupThreshold = (u = this.config.pendingMutationCleanupThreshold) !== null && u !== void 0 ? u : fu, this._log = Ja(e.verbose || Bn || Pi, () => this._reactorStats()), this.versions = Object.assign(Object.assign({}, i || {}), { "@instantdb/core": Qn }), this.config.schema && (this._linkIndex = Dr(this.config.schema)), !!pu()) {
4130
4142
  if (!e.appId)
4131
4143
  throw new Error("Instant must be initialized with an appId.");
4132
4144
  if (!qe(e.appId))
4133
4145
  throw new Error(`Instant must be initialized with a valid appId. \`${e.appId}\` is not a valid uuid.`);
4134
- typeof BroadcastChannel == "function" && (this._broadcastChannel = new BroadcastChannel("@instantdb"), this._broadcastChannel.addEventListener("message", (c) => N(this, void 0, void 0, function* () {
4135
- var d;
4146
+ typeof BroadcastChannel == "function" && (this._broadcastChannel = new BroadcastChannel("@instantdb"), this._broadcastChannel.addEventListener("message", (d) => N(this, void 0, void 0, function* () {
4147
+ var c;
4136
4148
  try {
4137
- if (((d = c.data) === null || d === void 0 ? void 0 : d.type) === "auth") {
4149
+ if (((c = d.data) === null || c === void 0 ? void 0 : c.type) === "auth") {
4138
4150
  const f = yield this.getCurrentUser();
4139
4151
  this.updateUser(f.user);
4140
4152
  }
4141
4153
  } catch (f) {
4142
4154
  this._log.error("[error] handle broadcast channel", f);
4143
4155
  }
4144
- }))), this._initStorage(n), this._oauthCallbackResponse = this._oauthLoginInit(), this.getCurrentUser(), r.getIsOnline().then((c) => {
4145
- this._isOnline = c, this._startSocket(), r.listen((d) => {
4146
- d !== this._isOnline && (this._log.info("[network] online =", d), this._isOnline = d, this._isOnline ? this._startSocket() : (this._log.info("Changing status from", this.status, "to", _e.CLOSED), this._setStatus(_e.CLOSED)));
4156
+ }))), this._initStorage(n), this._oauthCallbackResponse = this._oauthLoginInit(), this.getCurrentUser(), r.getIsOnline().then((d) => {
4157
+ this._isOnline = d, this._startSocket(), r.listen((c) => {
4158
+ c !== this._isOnline && (this._log.info("[network] online =", c), this._isOnline = c, this._isOnline ? this._startSocket() : (this._log.info("Changing status from", this.status, "to", be.CLOSED), this._setStatus(be.CLOSED)));
4147
4159
  });
4148
4160
  }), typeof addEventListener < "u" && (this._beforeUnload = this._beforeUnload.bind(this), addEventListener("beforeunload", this._beforeUnload));
4149
4161
  }
@@ -4174,6 +4186,7 @@ class mu {
4174
4186
  },
4175
4187
  this._log,
4176
4188
  {
4189
+ preloadEntryCount: 10,
4177
4190
  gc: {
4178
4191
  maxAgeMs: 1e3 * 60 * 60 * 24 * 7 * 52,
4179
4192
  // 1 year
@@ -4240,16 +4253,16 @@ class mu {
4240
4253
  const i = (r = (n = this._presence[e]) === null || n === void 0 ? void 0 : n.result) === null || r === void 0 ? void 0 : r.user, s = this._broadcastQueue[e];
4241
4254
  if (this._broadcastQueue[e] = [], i && this._trySetPresence(e, i), s)
4242
4255
  for (const o of s) {
4243
- const { topic: a, roomType: u, data: c } = o;
4244
- this._tryBroadcast(e, u, a, c);
4256
+ const { topic: a, roomType: u, data: d } = o;
4257
+ this._tryBroadcast(e, u, a, d);
4245
4258
  }
4246
4259
  }
4247
4260
  _handleReceive(e, n) {
4248
4261
  var r, i, s, o, a, u;
4249
- const c = !!this.config.schema && ("cardinalityInference" in this.config ? !!this.config.cardinalityInference : !0);
4262
+ const d = !!this.config.schema && ("cardinalityInference" in this.config ? !!this.config.cardinalityInference : !0);
4250
4263
  switch (zr[n.op] || this._log.info("[receive]", e, n.op, n), n.op) {
4251
4264
  case "init-ok":
4252
- this._setStatus(_e.AUTHENTICATED), this._reconnectTimeoutMs = 0, this._setAttrs(n.attrs), this._flushPendingMessages(), this._sessionId = n["session-id"];
4265
+ this._setStatus(be.AUTHENTICATED), this._reconnectTimeoutMs = 0, this._setAttrs(n.attrs), this._flushPendingMessages(), this._sessionId = n["session-id"];
4253
4266
  for (const O of Object.keys(this._rooms)) {
4254
4267
  const Q = (i = (r = this._presence[O]) === null || r === void 0 ? void 0 : r.result) === null || i === void 0 ? void 0 : i.user;
4255
4268
  this._tryJoinRoom(O, Q);
@@ -4259,14 +4272,14 @@ class mu {
4259
4272
  this.notifyOneQueryOnce(X(n.q));
4260
4273
  break;
4261
4274
  case "add-query-ok":
4262
- const { q: d, result: f } = n, h = X(d);
4275
+ const { q: c, result: f } = n, h = X(c);
4263
4276
  if (!this._hasQueryListeners() && !this.querySubs.currentValue[h])
4264
4277
  break;
4265
- const p = (o = (s = f == null ? void 0 : f[0]) === null || s === void 0 ? void 0 : s.data) === null || o === void 0 ? void 0 : o["page-info"], b = (u = (a = f == null ? void 0 : f[0]) === null || a === void 0 ? void 0 : a.data) === null || u === void 0 ? void 0 : u.aggregate, y = xr(f), g = ln(this.attrs, y, c, this._linkIndex, this.config.useDateObjects);
4278
+ const p = (o = (s = f == null ? void 0 : f[0]) === null || s === void 0 ? void 0 : s.data) === null || o === void 0 ? void 0 : o["page-info"], _ = (u = (a = f == null ? void 0 : f[0]) === null || a === void 0 ? void 0 : a.data) === null || u === void 0 ? void 0 : u.aggregate, y = xr(f), g = ln(this.attrs, y, d, this._linkIndex, this.config.useDateObjects);
4266
4279
  this.querySubs.updateInPlace((O) => (O[h].result = {
4267
4280
  store: g,
4268
4281
  pageInfo: p,
4269
- aggregate: b,
4282
+ aggregate: _,
4270
4283
  processedTxId: n["processed-tx-id"]
4271
4284
  }, O)), this._cleanupPendingMutationsQueries(), this.notifyOne(h), this.notifyOneQueryOnce(h), this._cleanupPendingMutationsTimeout();
4272
4285
  break;
@@ -4278,12 +4291,12 @@ class mu {
4278
4291
  O.pendingMutations = P;
4279
4292
  });
4280
4293
  const E = Vr(P.entries()), U = T.map((O) => {
4281
- var Q, we, pe, ue;
4282
- const G = O["instaql-query"], W = O["instaql-result"], Oe = X(G), ft = xr(W), lt = ln(this.attrs, ft, c, this._linkIndex, this.config.useDateObjects), ht = this._applyOptimisticUpdates(lt, E, v), pt = (we = (Q = W == null ? void 0 : W[0]) === null || Q === void 0 ? void 0 : Q.data) === null || we === void 0 ? void 0 : we["page-info"], yt = (ue = (pe = W == null ? void 0 : W[0]) === null || pe === void 0 ? void 0 : pe.data) === null || ue === void 0 ? void 0 : ue.aggregate;
4294
+ var Q, Te, pe, ue;
4295
+ const G = O["instaql-query"], W = O["instaql-result"], Oe = X(G), ft = xr(W), lt = ln(this.attrs, ft, d, this._linkIndex, this.config.useDateObjects), ht = this._applyOptimisticUpdates(lt, E, v), pt = (Te = (Q = W == null ? void 0 : W[0]) === null || Q === void 0 ? void 0 : Q.data) === null || Te === void 0 ? void 0 : Te["page-info"], yt = (ue = (pe = W == null ? void 0 : W[0]) === null || pe === void 0 ? void 0 : pe.data) === null || ue === void 0 ? void 0 : ue.aggregate;
4283
4296
  return { hash: Oe, store: ht, pageInfo: pt, aggregate: yt };
4284
4297
  });
4285
- U.forEach(({ hash: O, store: Q, pageInfo: we, aggregate: pe }) => {
4286
- this.querySubs.updateInPlace((ue) => (ue[O].result = { store: Q, pageInfo: we, aggregate: pe, processedTxId: v }, ue));
4298
+ U.forEach(({ hash: O, store: Q, pageInfo: Te, aggregate: pe }) => {
4299
+ this.querySubs.updateInPlace((ue) => (ue[O].result = { store: Q, pageInfo: Te, aggregate: pe, processedTxId: v }, ue));
4287
4300
  }), this._cleanupPendingMutationsQueries(), U.forEach(({ hash: O }) => {
4288
4301
  this.notifyOne(O);
4289
4302
  });
@@ -4372,16 +4385,16 @@ class mu {
4372
4385
  console.log("error", e);
4373
4386
  const a = e["client-event-id"];
4374
4387
  this._inFlightMutationEventIds.delete(a);
4375
- const u = this._pendingMutations().get(a), c = {
4388
+ const u = this._pendingMutations().get(a), d = {
4376
4389
  message: e.message || "Uh-oh, something went wrong. Ping Joe & Stopa."
4377
4390
  };
4378
- if (e.hint && (c.hint = e.hint), u) {
4391
+ if (e.hint && (d.hint = e.hint), u) {
4379
4392
  this._handleMutationError("error", a, e);
4380
4393
  return;
4381
4394
  }
4382
4395
  if (!((n = e["original-event"]) === null || n === void 0) && n.hasOwnProperty("q") && ((r = e["original-event"]) === null || r === void 0 ? void 0 : r.op) === "add-query") {
4383
4396
  const h = (i = e["original-event"]) === null || i === void 0 ? void 0 : i.q, p = X(h);
4384
- this.notifyQueryError(X(h), c), this.notifyQueryOnceError(h, p, a, c);
4397
+ this.notifyQueryError(X(h), d), this.notifyQueryOnceError(h, p, a, d);
4385
4398
  return;
4386
4399
  }
4387
4400
  if (((s = e["original-event"]) === null || s === void 0 ? void 0 : s.op) === "init") {
@@ -4389,7 +4402,7 @@ class mu {
4389
4402
  this.changeCurrentUser(null);
4390
4403
  return;
4391
4404
  }
4392
- this._setStatus(_e.ERRORED, c), this.notifyAll();
4405
+ this._setStatus(be.ERRORED, d), this.notifyAll();
4393
4406
  return;
4394
4407
  }
4395
4408
  const f = Object.assign({}, e);
@@ -4450,7 +4463,7 @@ class mu {
4450
4463
  return !!(!((n = this.queryCbs[e]) === null || n === void 0) && n.length || !((r = this.queryOnceDfds[e]) === null || r === void 0) && r.length);
4451
4464
  }
4452
4465
  _cleanupQuery(e, n) {
4453
- this._hasQueryListeners(n) || (delete this.queryCbs[n], delete this.queryOnceDfds[n], this.querySubs.unloadKey(n), this._trySendAuthed(B(), { op: "remove-query", q: e }));
4466
+ this._hasQueryListeners(n) || (delete this.queryCbs[n], delete this.queryOnceDfds[n], delete this._dataForQueryCache[n], this.querySubs.unloadKey(n), this._trySendAuthed(B(), { op: "remove-query", q: e }));
4454
4467
  }
4455
4468
  // When we `pushTx`, it's possible that we don't yet have `this.attrs`
4456
4469
  // This means that `tx-steps` in `pendingMutations` will include `add-attr`
@@ -4468,19 +4481,19 @@ class mu {
4468
4481
  return n;
4469
4482
  if (!n)
4470
4483
  return /* @__PURE__ */ new Map();
4471
- const i = (d) => {
4472
- const [f, h, p] = d["forward-identity"];
4484
+ const i = (c) => {
4485
+ const [f, h, p] = c["forward-identity"];
4473
4486
  return V(e, h, p);
4474
- }, s = (d) => {
4475
- const [f, h, p] = d["forward-identity"];
4487
+ }, s = (c) => {
4488
+ const [f, h, p] = c["forward-identity"];
4476
4489
  return Ce(e, h, p);
4477
4490
  }, o = { attrIdMap: {}, refSwapAttrIds: /* @__PURE__ */ new Set() };
4478
4491
  let a = !1;
4479
- const u = (d, f) => {
4492
+ const u = (c, f) => {
4480
4493
  const h = [];
4481
- for (const p of d) {
4482
- const [b] = p;
4483
- if (b === "add-attr") {
4494
+ for (const p of c) {
4495
+ const [_] = p;
4496
+ if (_ === "add-attr") {
4484
4497
  const [g, T] = p, w = i(T);
4485
4498
  if (w && T.id !== w.id) {
4486
4499
  o.attrIdMap[T.id] = w.id, a = !0;
@@ -4494,18 +4507,18 @@ class mu {
4494
4507
  }
4495
4508
  }
4496
4509
  }
4497
- if (r && f && r >= f && b === "add-attr" || b === "update-attr" || b === "delete-attr") {
4510
+ if (r && f && r >= f && _ === "add-attr" || _ === "update-attr" || _ === "delete-attr") {
4498
4511
  a = !0;
4499
4512
  continue;
4500
4513
  }
4501
4514
  const y = a ? ca(o, p) : p;
4502
4515
  h.push(y);
4503
4516
  }
4504
- return a ? h : d;
4505
- }, c = /* @__PURE__ */ new Map();
4506
- for (const [d, f] of n.entries())
4507
- c.set(d, Object.assign(Object.assign({}, f), { "tx-steps": u(f["tx-steps"], f["tx-id"]) }));
4508
- return a ? c : n;
4517
+ return a ? h : c;
4518
+ }, d = /* @__PURE__ */ new Map();
4519
+ for (const [c, f] of n.entries())
4520
+ d.set(c, Object.assign(Object.assign({}, f), { "tx-steps": u(f["tx-steps"], f["tx-id"]) }));
4521
+ return a ? d : n;
4509
4522
  }
4510
4523
  _rewriteMutationsSorted(e, n) {
4511
4524
  return Vr(this._rewriteMutations(e, n).entries());
@@ -4519,8 +4532,8 @@ class mu {
4519
4532
  if (a === "add-attr")
4520
4533
  i.push(u);
4521
4534
  else if (a === "update-attr" && u.id && (!((e = this.attrs) === null || e === void 0) && e[u.id])) {
4522
- const c = Object.assign(Object.assign({}, this.attrs[u.id]), u);
4523
- i.push(c);
4535
+ const d = Object.assign(Object.assign({}, this.attrs[u.id]), u);
4536
+ i.push(d);
4524
4537
  }
4525
4538
  const s = [
4526
4539
  ...Object.values(this.attrs || {}),
@@ -4538,10 +4551,10 @@ class mu {
4538
4551
  const r = this.querySubs.version(), i = this.querySubs.currentValue, s = this.kv.version(), o = this._pendingMutations(), { q: a, result: u } = i[e] || {};
4539
4552
  if (!u)
4540
4553
  return;
4541
- const c = this._dataForQueryCache[e];
4542
- if (c && r === c.querySubVersion && s === c.pendingMutationsVersion)
4543
- return c.data;
4544
- const { store: d, pageInfo: f, aggregate: h, processedTxId: p } = u, b = this._rewriteMutationsSorted(d.attrs, o), y = this._applyOptimisticUpdates(d, b, p), g = ia({ store: y, pageInfo: f, aggregate: h }, a);
4554
+ const d = this._dataForQueryCache[e];
4555
+ if (d && r === d.querySubVersion && s === d.pendingMutationsVersion)
4556
+ return d.data;
4557
+ const { store: c, pageInfo: f, aggregate: h, processedTxId: p } = u, _ = this._rewriteMutationsSorted(c.attrs, o), y = this._applyOptimisticUpdates(c, _, p), g = ia({ store: y, pageInfo: f, aggregate: h }, a);
4545
4558
  return this._dataForQueryCache[e] = {
4546
4559
  querySubVersion: r,
4547
4560
  pendingMutationsVersion: s,
@@ -4581,7 +4594,7 @@ class mu {
4581
4594
  });
4582
4595
  return;
4583
4596
  }
4584
- if (this.status !== _e.AUTHENTICATED) {
4597
+ if (this.status !== be.AUTHENTICATED) {
4585
4598
  this._finishTransaction("enqueued", e);
4586
4599
  return;
4587
4600
  }
@@ -4635,7 +4648,7 @@ class mu {
4635
4648
  });
4636
4649
  }
4637
4650
  _trySendAuthed(...e) {
4638
- this.status === _e.AUTHENTICATED && this._trySend(...e);
4651
+ this.status === be.AUTHENTICATED && this._trySend(...e);
4639
4652
  }
4640
4653
  _trySend(e, n, r) {
4641
4654
  if (this._transport.isOpen()) {
@@ -4733,13 +4746,13 @@ class mu {
4733
4746
  return null;
4734
4747
  this._replaceUrlAfterOAuth();
4735
4748
  try {
4736
- const u = yield this._getCurrentUser(), c = (u == null ? void 0 : u.type) === "guest", { user: d } = yield Pr({
4749
+ const u = yield this._getCurrentUser(), d = (u == null ? void 0 : u.type) === "guest", { user: c } = yield Pr({
4737
4750
  apiURI: this.config.apiURI,
4738
4751
  appId: this.config.appId,
4739
4752
  code: a,
4740
- refreshToken: c ? u.refresh_token : void 0
4753
+ refreshToken: d ? u.refresh_token : void 0
4741
4754
  });
4742
- return this.setCurrentUser(d), null;
4755
+ return this.setCurrentUser(c), null;
4743
4756
  } catch (u) {
4744
4757
  return ((e = u == null ? void 0 : u.body) === null || e === void 0 ? void 0 : e.type) === "record-not-found" && ((r = (n = u == null ? void 0 : u.body) === null || n === void 0 ? void 0 : n.hint) === null || r === void 0 ? void 0 : r["record-type"]) === "app-oauth-code" && (yield this._hasCurrentUser()) ? null : { error: { message: ((i = u == null ? void 0 : u.body) === null || i === void 0 ? void 0 : i.message) || "Error logging in." } };
4745
4758
  }
@@ -5039,8 +5052,8 @@ class mu {
5039
5052
  r.initialPresence || r.initialData
5040
5053
  ), o = Object.assign(Object.assign({}, r), { roomId: n, cb: i, prev: null });
5041
5054
  return this._presence[n] = this._presence[n] || {}, this._presence[n].handlers = this._presence[n].handlers || [], this._presence[n].handlers.push(o), this._notifyPresenceSub(n, o), () => {
5042
- var a, u, c;
5043
- this._presence[n].handlers = (c = (u = (a = this._presence[n]) === null || a === void 0 ? void 0 : a.handlers) === null || u === void 0 ? void 0 : u.filter((d) => d !== o)) !== null && c !== void 0 ? c : [], s();
5055
+ var a, u, d;
5056
+ this._presence[n].handlers = (d = (u = (a = this._presence[n]) === null || a === void 0 ? void 0 : a.handlers) === null || u === void 0 ? void 0 : u.filter((c) => c !== o)) !== null && d !== void 0 ? d : [], s();
5044
5057
  };
5045
5058
  }
5046
5059
  _notifyPresenceSubs(e) {
@@ -5056,22 +5069,22 @@ class mu {
5056
5069
  _patchPresencePeers(e, n) {
5057
5070
  var r, i, s;
5058
5071
  const o = ((i = (r = this._presence[e]) === null || r === void 0 ? void 0 : r.result) === null || i === void 0 ? void 0 : i.peers) || {};
5059
- let a = Object.fromEntries(Object.entries(o).map(([c, d]) => [c, { data: d }]));
5072
+ let a = Object.fromEntries(Object.entries(o).map(([d, c]) => [d, { data: c }]));
5060
5073
  (s = this._presence[e]) === null || s === void 0 || s.result;
5061
- const u = Mt(a, (c) => {
5062
- for (let [d, f, h] of n)
5074
+ const u = Mt(a, (d) => {
5075
+ for (let [c, f, h] of n)
5063
5076
  switch (f) {
5064
5077
  case "+":
5065
- ks(c, d, h);
5078
+ ks(d, c, h);
5066
5079
  break;
5067
5080
  case "r":
5068
- wr(c, d, h);
5081
+ wr(d, c, h);
5069
5082
  break;
5070
5083
  case "-":
5071
- li(c, d);
5084
+ li(d, c);
5072
5085
  break;
5073
5086
  }
5074
- delete c[this._sessionId];
5087
+ delete d[this._sessionId];
5075
5088
  });
5076
5089
  this._setPresencePeers(e, u);
5077
5090
  }
@@ -5114,9 +5127,9 @@ class mu {
5114
5127
  _notifyBroadcastSubs(e, n, r) {
5115
5128
  var i, s, o;
5116
5129
  (o = (s = (i = this._broadcastSubs) === null || i === void 0 ? void 0 : i[e]) === null || s === void 0 ? void 0 : s[n]) === null || o === void 0 || o.forEach((a) => {
5117
- var u, c, d, f, h, p;
5118
- const b = (u = r.data) === null || u === void 0 ? void 0 : u.data, y = r.data["peer-id"] === this._sessionId ? (d = (c = this._presence[e]) === null || c === void 0 ? void 0 : c.result) === null || d === void 0 ? void 0 : d.user : (p = (h = (f = this._presence[e]) === null || f === void 0 ? void 0 : f.result) === null || h === void 0 ? void 0 : h.peers) === null || p === void 0 ? void 0 : p[r.data["peer-id"]];
5119
- return a(b, y);
5130
+ var u, d, c, f, h, p;
5131
+ const _ = (u = r.data) === null || u === void 0 ? void 0 : u.data, y = r.data["peer-id"] === this._sessionId ? (c = (d = this._presence[e]) === null || d === void 0 ? void 0 : d.result) === null || c === void 0 ? void 0 : c.user : (p = (h = (f = this._presence[e]) === null || f === void 0 ? void 0 : f.result) === null || h === void 0 ? void 0 : h.peers) === null || p === void 0 ? void 0 : p[r.data["peer-id"]];
5132
+ return a(_, y);
5120
5133
  });
5121
5134
  }
5122
5135
  // --------
@@ -5211,9 +5224,9 @@ function Ni(t, e) {
5211
5224
  entityName: u.forward.on,
5212
5225
  cardinality: u.reverse.has
5213
5226
  };
5214
- return Object.fromEntries(Object.entries(t).map(([u, c]) => [
5227
+ return Object.fromEntries(Object.entries(t).map(([u, d]) => [
5215
5228
  u,
5216
- new Nt(c.attrs, Object.assign(Object.assign({}, o.fwd[u]), o.rev[u]))
5229
+ new Nt(d.attrs, Object.assign(Object.assign({}, o.fwd[u]), o.rev[u]))
5217
5230
  ]));
5218
5231
  }
5219
5232
  function ku({ entities: t, links: e, rooms: n }) {
@@ -5246,12 +5259,12 @@ let vt;
5246
5259
  function Cu(t, e) {
5247
5260
  vt == null || vt.dispose();
5248
5261
  const n = xu(e), r = Iu(e, a), i = Mu(Pu(t));
5249
- function s(d) {
5262
+ function s(c) {
5250
5263
  var f;
5251
- d.source === i.element.contentWindow && ((f = d.data) === null || f === void 0 ? void 0 : f.type) === "close" && n.isVisible() && a();
5264
+ c.source === i.element.contentWindow && ((f = c.data) === null || f === void 0 ? void 0 : f.type) === "close" && n.isVisible() && a();
5252
5265
  }
5253
- function o(d) {
5254
- const f = d.shiftKey && d.ctrlKey && d.key === "0", h = d.key === "Escape" || d.key === "Esc";
5266
+ function o(c) {
5267
+ const f = c.shiftKey && c.ctrlKey && c.key === "0", h = c.key === "Escape" || c.key === "Esc";
5255
5268
  (f || h && n.isVisible()) && a();
5256
5269
  }
5257
5270
  function a() {
@@ -5260,12 +5273,12 @@ function Cu(t, e) {
5260
5273
  function u() {
5261
5274
  n.element.remove(), r.element.remove(), removeEventListener("keydown", o), removeEventListener("message", s);
5262
5275
  }
5263
- function c() {
5276
+ function d() {
5264
5277
  document.body.appendChild(n.element), document.body.appendChild(r.element), addEventListener("keydown", o), addEventListener("message", s), vt = {
5265
5278
  dispose: u
5266
5279
  };
5267
5280
  }
5268
- return c();
5281
+ return d();
5269
5282
  }
5270
5283
  function Pu(t) {
5271
5284
  return `${Bn || Mi ? "http://localhost:3000" : "https://instantdb.com"}/_devtool?appId=${t}`;
@@ -5567,11 +5580,11 @@ function Gu() {
5567
5580
  if (Br) return Je;
5568
5581
  Br = 1;
5569
5582
  var t = ti, e = Symbol.for("react.element"), n = Symbol.for("react.fragment"), r = Object.prototype.hasOwnProperty, i = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, s = { key: !0, ref: !0, __self: !0, __source: !0 };
5570
- function o(a, u, c) {
5571
- var d, f = {}, h = null, p = null;
5572
- c !== void 0 && (h = "" + c), u.key !== void 0 && (h = "" + u.key), u.ref !== void 0 && (p = u.ref);
5573
- for (d in u) r.call(u, d) && !s.hasOwnProperty(d) && (f[d] = u[d]);
5574
- if (a && a.defaultProps) for (d in u = a.defaultProps, u) f[d] === void 0 && (f[d] = u[d]);
5583
+ function o(a, u, d) {
5584
+ var c, f = {}, h = null, p = null;
5585
+ d !== void 0 && (h = "" + d), u.key !== void 0 && (h = "" + u.key), u.ref !== void 0 && (p = u.ref);
5586
+ for (c in u) r.call(u, c) && !s.hasOwnProperty(c) && (f[c] = u[c]);
5587
+ if (a && a.defaultProps) for (c in u = a.defaultProps, u) f[c] === void 0 && (f[c] = u[c]);
5575
5588
  return { $$typeof: e, type: a, key: h, ref: p, props: f, _owner: i.current };
5576
5589
  }
5577
5590
  return Je.Fragment = n, Je.jsx = o, Je.jsxs = o, Je;
@@ -5591,45 +5604,45 @@ function Bu() {
5591
5604
  * LICENSE file in the root directory of this source tree.
5592
5605
  */
5593
5606
  return t.NODE_ENV !== "production" && function() {
5594
- var e = ti, n = Symbol.for("react.element"), r = Symbol.for("react.portal"), i = Symbol.for("react.fragment"), s = Symbol.for("react.strict_mode"), o = Symbol.for("react.profiler"), a = Symbol.for("react.provider"), u = Symbol.for("react.context"), c = Symbol.for("react.forward_ref"), d = Symbol.for("react.suspense"), f = Symbol.for("react.suspense_list"), h = Symbol.for("react.memo"), p = Symbol.for("react.lazy"), b = Symbol.for("react.offscreen"), y = Symbol.iterator, g = "@@iterator";
5607
+ var e = ti, n = Symbol.for("react.element"), r = Symbol.for("react.portal"), i = Symbol.for("react.fragment"), s = Symbol.for("react.strict_mode"), o = Symbol.for("react.profiler"), a = Symbol.for("react.provider"), u = Symbol.for("react.context"), d = Symbol.for("react.forward_ref"), c = Symbol.for("react.suspense"), f = Symbol.for("react.suspense_list"), h = Symbol.for("react.memo"), p = Symbol.for("react.lazy"), _ = Symbol.for("react.offscreen"), y = Symbol.iterator, g = "@@iterator";
5595
5608
  function T(l) {
5596
5609
  if (l === null || typeof l != "object")
5597
5610
  return null;
5598
- var _ = y && l[y] || l[g];
5599
- return typeof _ == "function" ? _ : null;
5611
+ var b = y && l[y] || l[g];
5612
+ return typeof b == "function" ? b : null;
5600
5613
  }
5601
5614
  var w = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
5602
5615
  function v(l) {
5603
5616
  {
5604
- for (var _ = arguments.length, m = new Array(_ > 1 ? _ - 1 : 0), S = 1; S < _; S++)
5617
+ for (var b = arguments.length, m = new Array(b > 1 ? b - 1 : 0), S = 1; S < b; S++)
5605
5618
  m[S - 1] = arguments[S];
5606
5619
  P("error", l, m);
5607
5620
  }
5608
5621
  }
5609
- function P(l, _, m) {
5622
+ function P(l, b, m) {
5610
5623
  {
5611
5624
  var S = w.ReactDebugCurrentFrame, M = S.getStackAddendum();
5612
- M !== "" && (_ += "%s", m = m.concat([M]));
5625
+ M !== "" && (b += "%s", m = m.concat([M]));
5613
5626
  var I = m.map(function(C) {
5614
5627
  return String(C);
5615
5628
  });
5616
- I.unshift("Warning: " + _), Function.prototype.apply.call(console[l], console, I);
5629
+ I.unshift("Warning: " + b), Function.prototype.apply.call(console[l], console, I);
5617
5630
  }
5618
5631
  }
5619
5632
  var E = !1, U = !1, F = !1, he = !1, O = !1, Q;
5620
5633
  Q = Symbol.for("react.module.reference");
5621
- function we(l) {
5622
- return !!(typeof l == "string" || typeof l == "function" || l === i || l === o || O || l === s || l === d || l === f || he || l === b || E || U || F || typeof l == "object" && l !== null && (l.$$typeof === p || l.$$typeof === h || l.$$typeof === a || l.$$typeof === u || l.$$typeof === c || // This needs to include all possible module reference object
5634
+ function Te(l) {
5635
+ return !!(typeof l == "string" || typeof l == "function" || l === i || l === o || O || l === s || l === c || l === f || he || l === _ || E || U || F || typeof l == "object" && l !== null && (l.$$typeof === p || l.$$typeof === h || l.$$typeof === a || l.$$typeof === u || l.$$typeof === d || // This needs to include all possible module reference object
5623
5636
  // types supported by any Flight configuration anywhere since
5624
5637
  // we don't know which Flight build this will end up being used
5625
5638
  // with.
5626
5639
  l.$$typeof === Q || l.getModuleId !== void 0));
5627
5640
  }
5628
- function pe(l, _, m) {
5641
+ function pe(l, b, m) {
5629
5642
  var S = l.displayName;
5630
5643
  if (S)
5631
5644
  return S;
5632
- var M = _.displayName || _.name || "";
5645
+ var M = b.displayName || b.name || "";
5633
5646
  return M !== "" ? m + "(" + M + ")" : m;
5634
5647
  }
5635
5648
  function ue(l) {
@@ -5651,7 +5664,7 @@ function Bu() {
5651
5664
  return "Profiler";
5652
5665
  case s:
5653
5666
  return "StrictMode";
5654
- case d:
5667
+ case c:
5655
5668
  return "Suspense";
5656
5669
  case f:
5657
5670
  return "SuspenseList";
@@ -5659,12 +5672,12 @@ function Bu() {
5659
5672
  if (typeof l == "object")
5660
5673
  switch (l.$$typeof) {
5661
5674
  case u:
5662
- var _ = l;
5663
- return ue(_) + ".Consumer";
5675
+ var b = l;
5676
+ return ue(b) + ".Consumer";
5664
5677
  case a:
5665
5678
  var m = l;
5666
5679
  return ue(m._context) + ".Provider";
5667
- case c:
5680
+ case d:
5668
5681
  return pe(l, l.render, "ForwardRef");
5669
5682
  case h:
5670
5683
  var S = l.displayName || null;
@@ -5743,7 +5756,7 @@ function Bu() {
5743
5756
  }
5744
5757
  }
5745
5758
  var Kt = w.ReactCurrentDispatcher, Wt;
5746
- function _t(l, _, m) {
5759
+ function _t(l, b, m) {
5747
5760
  {
5748
5761
  if (Wt === void 0)
5749
5762
  try {
@@ -5761,7 +5774,7 @@ function Bu() {
5761
5774
  var qi = typeof WeakMap == "function" ? WeakMap : Map;
5762
5775
  bt = new qi();
5763
5776
  }
5764
- function er(l, _) {
5777
+ function er(l, b) {
5765
5778
  if (!l || qt)
5766
5779
  return "";
5767
5780
  {
@@ -5776,7 +5789,7 @@ function Bu() {
5776
5789
  var I;
5777
5790
  I = Kt.current, Kt.current = null, Ki();
5778
5791
  try {
5779
- if (_) {
5792
+ if (b) {
5780
5793
  var C = function() {
5781
5794
  throw Error();
5782
5795
  };
@@ -5832,14 +5845,14 @@ function Bu() {
5832
5845
  var $e = l ? l.displayName || l.name : "", Ee = $e ? _t($e) : "";
5833
5846
  return typeof l == "function" && bt.set(l, Ee), Ee;
5834
5847
  }
5835
- function zi(l, _, m) {
5848
+ function zi(l, b, m) {
5836
5849
  return er(l, !1);
5837
5850
  }
5838
5851
  function Vi(l) {
5839
- var _ = l.prototype;
5840
- return !!(_ && _.isReactComponent);
5852
+ var b = l.prototype;
5853
+ return !!(b && b.isReactComponent);
5841
5854
  }
5842
- function gt(l, _, m) {
5855
+ function gt(l, b, m) {
5843
5856
  if (l == null)
5844
5857
  return "";
5845
5858
  if (typeof l == "function")
@@ -5847,21 +5860,21 @@ function Bu() {
5847
5860
  if (typeof l == "string")
5848
5861
  return _t(l);
5849
5862
  switch (l) {
5850
- case d:
5863
+ case c:
5851
5864
  return _t("Suspense");
5852
5865
  case f:
5853
5866
  return _t("SuspenseList");
5854
5867
  }
5855
5868
  if (typeof l == "object")
5856
5869
  switch (l.$$typeof) {
5857
- case c:
5870
+ case d:
5858
5871
  return zi(l.render);
5859
5872
  case h:
5860
- return gt(l.type, _, m);
5873
+ return gt(l.type, b, m);
5861
5874
  case p: {
5862
5875
  var S = l, M = S._payload, I = S._init;
5863
5876
  try {
5864
- return gt(I(M), _, m);
5877
+ return gt(I(M), b, m);
5865
5878
  } catch {
5866
5879
  }
5867
5880
  }
@@ -5871,12 +5884,12 @@ function Bu() {
5871
5884
  var Qe = Object.prototype.hasOwnProperty, tr = {}, nr = w.ReactDebugCurrentFrame;
5872
5885
  function mt(l) {
5873
5886
  if (l) {
5874
- var _ = l._owner, m = gt(l.type, l._source, _ ? _.type : null);
5887
+ var b = l._owner, m = gt(l.type, l._source, b ? b.type : null);
5875
5888
  nr.setExtraStackFrame(m);
5876
5889
  } else
5877
5890
  nr.setExtraStackFrame(null);
5878
5891
  }
5879
- function Gi(l, _, m, S, M) {
5892
+ function Gi(l, b, m, S, M) {
5880
5893
  {
5881
5894
  var I = Function.call.bind(Qe);
5882
5895
  for (var C in l)
@@ -5887,7 +5900,7 @@ function Bu() {
5887
5900
  var Y = Error((S || "React class") + ": " + m + " type `" + C + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof l[C] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
5888
5901
  throw Y.name = "Invariant Violation", Y;
5889
5902
  }
5890
- j = l[C](_, C, S, m, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
5903
+ j = l[C](b, C, S, m, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
5891
5904
  } catch (x) {
5892
5905
  j = x;
5893
5906
  }
@@ -5901,7 +5914,7 @@ function Bu() {
5901
5914
  }
5902
5915
  function Qi(l) {
5903
5916
  {
5904
- var _ = typeof Symbol == "function" && Symbol.toStringTag, m = _ && l[Symbol.toStringTag] || l.constructor.name || "Object";
5917
+ var b = typeof Symbol == "function" && Symbol.toStringTag, m = b && l[Symbol.toStringTag] || l.constructor.name || "Object";
5905
5918
  return m;
5906
5919
  }
5907
5920
  }
@@ -5927,27 +5940,27 @@ function Bu() {
5927
5940
  }, or, ar;
5928
5941
  function Ji(l) {
5929
5942
  if (Qe.call(l, "ref")) {
5930
- var _ = Object.getOwnPropertyDescriptor(l, "ref").get;
5931
- if (_ && _.isReactWarning)
5943
+ var b = Object.getOwnPropertyDescriptor(l, "ref").get;
5944
+ if (b && b.isReactWarning)
5932
5945
  return !1;
5933
5946
  }
5934
5947
  return l.ref !== void 0;
5935
5948
  }
5936
5949
  function Zi(l) {
5937
5950
  if (Qe.call(l, "key")) {
5938
- var _ = Object.getOwnPropertyDescriptor(l, "key").get;
5939
- if (_ && _.isReactWarning)
5951
+ var b = Object.getOwnPropertyDescriptor(l, "key").get;
5952
+ if (b && b.isReactWarning)
5940
5953
  return !1;
5941
5954
  }
5942
5955
  return l.key !== void 0;
5943
5956
  }
5944
- function Xi(l, _) {
5957
+ function Xi(l, b) {
5945
5958
  typeof l.ref == "string" && sr.current;
5946
5959
  }
5947
- function es(l, _) {
5960
+ function es(l, b) {
5948
5961
  {
5949
5962
  var m = function() {
5950
- or || (or = !0, v("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", _));
5963
+ or || (or = !0, v("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", b));
5951
5964
  };
5952
5965
  m.isReactWarning = !0, Object.defineProperty(l, "key", {
5953
5966
  get: m,
@@ -5955,10 +5968,10 @@ function Bu() {
5955
5968
  });
5956
5969
  }
5957
5970
  }
5958
- function ts(l, _) {
5971
+ function ts(l, b) {
5959
5972
  {
5960
5973
  var m = function() {
5961
- ar || (ar = !0, v("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", _));
5974
+ ar || (ar = !0, v("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", b));
5962
5975
  };
5963
5976
  m.isReactWarning = !0, Object.defineProperty(l, "ref", {
5964
5977
  get: m,
@@ -5966,13 +5979,13 @@ function Bu() {
5966
5979
  });
5967
5980
  }
5968
5981
  }
5969
- var ns = function(l, _, m, S, M, I, C) {
5982
+ var ns = function(l, b, m, S, M, I, C) {
5970
5983
  var j = {
5971
5984
  // This tag allows us to uniquely identify this as a React Element
5972
5985
  $$typeof: n,
5973
5986
  // Built-in properties that belong on the element
5974
5987
  type: l,
5975
- key: _,
5988
+ key: b,
5976
5989
  ref: m,
5977
5990
  props: C,
5978
5991
  // Record the component responsible for creating this element.
@@ -5995,12 +6008,12 @@ function Bu() {
5995
6008
  value: M
5996
6009
  }), Object.freeze && (Object.freeze(j.props), Object.freeze(j)), j;
5997
6010
  };
5998
- function rs(l, _, m, S, M) {
6011
+ function rs(l, b, m, S, M) {
5999
6012
  {
6000
6013
  var I, C = {}, j = null, Y = null;
6001
- m !== void 0 && (ir(m), j = "" + m), Zi(_) && (ir(_.key), j = "" + _.key), Ji(_) && (Y = _.ref, Xi(_, M));
6002
- for (I in _)
6003
- Qe.call(_, I) && !Hi.hasOwnProperty(I) && (C[I] = _[I]);
6014
+ m !== void 0 && (ir(m), j = "" + m), Zi(b) && (ir(b.key), j = "" + b.key), Ji(b) && (Y = b.ref, Xi(b, M));
6015
+ for (I in b)
6016
+ Qe.call(b, I) && !Hi.hasOwnProperty(I) && (C[I] = b[I]);
6004
6017
  if (l && l.defaultProps) {
6005
6018
  var x = l.defaultProps;
6006
6019
  for (I in x)
@@ -6016,7 +6029,7 @@ function Bu() {
6016
6029
  var Vt = w.ReactCurrentOwner, ur = w.ReactDebugCurrentFrame;
6017
6030
  function Re(l) {
6018
6031
  if (l) {
6019
- var _ = l._owner, m = gt(l.type, l._source, _ ? _.type : null);
6032
+ var b = l._owner, m = gt(l.type, l._source, b ? b.type : null);
6020
6033
  ur.setExtraStackFrame(m);
6021
6034
  } else
6022
6035
  ur.setExtraStackFrame(null);
@@ -6044,22 +6057,22 @@ Check the render method of \`` + l + "`.";
6044
6057
  var dr = {};
6045
6058
  function ss(l) {
6046
6059
  {
6047
- var _ = cr();
6048
- if (!_) {
6060
+ var b = cr();
6061
+ if (!b) {
6049
6062
  var m = typeof l == "string" ? l : l.displayName || l.name;
6050
- m && (_ = `
6063
+ m && (b = `
6051
6064
 
6052
6065
  Check the top-level render call using <` + m + ">.");
6053
6066
  }
6054
- return _;
6067
+ return b;
6055
6068
  }
6056
6069
  }
6057
- function fr(l, _) {
6070
+ function fr(l, b) {
6058
6071
  {
6059
6072
  if (!l._store || l._store.validated || l.key != null)
6060
6073
  return;
6061
6074
  l._store.validated = !0;
6062
- var m = ss(_);
6075
+ var m = ss(b);
6063
6076
  if (dr[m])
6064
6077
  return;
6065
6078
  dr[m] = !0;
@@ -6067,14 +6080,14 @@ Check the top-level render call using <` + m + ">.");
6067
6080
  l && l._owner && l._owner !== Vt.current && (S = " It was passed a child from " + G(l._owner.type) + "."), Re(l), v('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', m, S), Re(null);
6068
6081
  }
6069
6082
  }
6070
- function lr(l, _) {
6083
+ function lr(l, b) {
6071
6084
  {
6072
6085
  if (typeof l != "object")
6073
6086
  return;
6074
6087
  if (zt(l))
6075
6088
  for (var m = 0; m < l.length; m++) {
6076
6089
  var S = l[m];
6077
- Bt(S) && fr(S, _);
6090
+ Bt(S) && fr(S, b);
6078
6091
  }
6079
6092
  else if (Bt(l))
6080
6093
  l._store && (l._store.validated = !0);
@@ -6082,39 +6095,39 @@ Check the top-level render call using <` + m + ">.");
6082
6095
  var M = T(l);
6083
6096
  if (typeof M == "function" && M !== l.entries)
6084
6097
  for (var I = M.call(l), C; !(C = I.next()).done; )
6085
- Bt(C.value) && fr(C.value, _);
6098
+ Bt(C.value) && fr(C.value, b);
6086
6099
  }
6087
6100
  }
6088
6101
  }
6089
6102
  function os(l) {
6090
6103
  {
6091
- var _ = l.type;
6092
- if (_ == null || typeof _ == "string")
6104
+ var b = l.type;
6105
+ if (b == null || typeof b == "string")
6093
6106
  return;
6094
6107
  var m;
6095
- if (typeof _ == "function")
6096
- m = _.propTypes;
6097
- else if (typeof _ == "object" && (_.$$typeof === c || // Note: Memo only checks outer props here.
6108
+ if (typeof b == "function")
6109
+ m = b.propTypes;
6110
+ else if (typeof b == "object" && (b.$$typeof === d || // Note: Memo only checks outer props here.
6098
6111
  // Inner props are checked in the reconciler.
6099
- _.$$typeof === h))
6100
- m = _.propTypes;
6112
+ b.$$typeof === h))
6113
+ m = b.propTypes;
6101
6114
  else
6102
6115
  return;
6103
6116
  if (m) {
6104
- var S = G(_);
6117
+ var S = G(b);
6105
6118
  Gi(m, l.props, "prop", S, l);
6106
- } else if (_.PropTypes !== void 0 && !Gt) {
6119
+ } else if (b.PropTypes !== void 0 && !Gt) {
6107
6120
  Gt = !0;
6108
- var M = G(_);
6121
+ var M = G(b);
6109
6122
  v("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", M || "Unknown");
6110
6123
  }
6111
- typeof _.getDefaultProps == "function" && !_.getDefaultProps.isReactClassApproved && v("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
6124
+ typeof b.getDefaultProps == "function" && !b.getDefaultProps.isReactClassApproved && v("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
6112
6125
  }
6113
6126
  }
6114
6127
  function as(l) {
6115
6128
  {
6116
- for (var _ = Object.keys(l.props), m = 0; m < _.length; m++) {
6117
- var S = _[m];
6129
+ for (var b = Object.keys(l.props), m = 0; m < b.length; m++) {
6130
+ var S = b[m];
6118
6131
  if (S !== "children" && S !== "key") {
6119
6132
  Re(l), v("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", S), Re(null);
6120
6133
  break;
@@ -6124,9 +6137,9 @@ Check the top-level render call using <` + m + ">.");
6124
6137
  }
6125
6138
  }
6126
6139
  var hr = {};
6127
- function pr(l, _, m, S, M, I) {
6140
+ function pr(l, b, m, S, M, I) {
6128
6141
  {
6129
- var C = we(l);
6142
+ var C = Te(l);
6130
6143
  if (!C) {
6131
6144
  var j = "";
6132
6145
  (l === void 0 || typeof l == "object" && l !== null && Object.keys(l).length === 0) && (j += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
@@ -6135,11 +6148,11 @@ Check the top-level render call using <` + m + ">.");
6135
6148
  var x;
6136
6149
  l === null ? x = "null" : zt(l) ? x = "array" : l !== void 0 && l.$$typeof === n ? (x = "<" + (G(l.type) || "Unknown") + " />", j = " Did you accidentally export a JSX literal instead of a component?") : x = typeof l, v("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", x, j);
6137
6150
  }
6138
- var L = rs(l, _, m, M, I);
6151
+ var L = rs(l, b, m, M, I);
6139
6152
  if (L == null)
6140
6153
  return L;
6141
6154
  if (C) {
6142
- var oe = _.children;
6155
+ var oe = b.children;
6143
6156
  if (oe !== void 0)
6144
6157
  if (S)
6145
6158
  if (zt(oe)) {
@@ -6151,8 +6164,8 @@ Check the top-level render call using <` + m + ">.");
6151
6164
  else
6152
6165
  lr(oe, l);
6153
6166
  }
6154
- if (Qe.call(_, "key")) {
6155
- var Ee = G(l), Z = Object.keys(_).filter(function(hs) {
6167
+ if (Qe.call(b, "key")) {
6168
+ var Ee = G(l), Z = Object.keys(b).filter(function(hs) {
6156
6169
  return hs !== "key";
6157
6170
  }), Qt = Z.length > 0 ? "{key: someKey, " + Z.join(": ..., ") + ": ...}" : "{key: someKey}";
6158
6171
  if (!hr[Ee + Qt]) {
@@ -6168,11 +6181,11 @@ React keys must be passed directly to JSX without using spread:
6168
6181
  return l === i ? as(L) : os(L), L;
6169
6182
  }
6170
6183
  }
6171
- function us(l, _, m) {
6172
- return pr(l, _, m, !0);
6184
+ function us(l, b, m) {
6185
+ return pr(l, b, m, !0);
6173
6186
  }
6174
- function cs(l, _, m) {
6175
- return pr(l, _, m, !1);
6187
+ function cs(l, b, m) {
6188
+ return pr(l, b, m, !1);
6176
6189
  }
6177
6190
  var ds = cs, fs = us;
6178
6191
  Ze.Fragment = i, Ze.jsx = ds, Ze.jsxs = fs;
@@ -6193,8 +6206,8 @@ function Yr(t) {
6193
6206
  function Hu(t, e, n) {
6194
6207
  e && n && "ruleParams" in n && (e = Object.assign({ $$ruleParams: n.ruleParams }, e));
6195
6208
  const r = e ? Ku(e) : null, i = X(r), s = kt(Yr(t._reactor.getPreviousResult(r))), o = Se(
6196
- (u) => (s.current = Yr(t._reactor.getPreviousResult(r)), r ? t.subscribeQuery(r, (d) => {
6197
- s.current = Object.assign({ isLoading: !d, data: void 0, pageInfo: void 0, error: void 0 }, d), u();
6209
+ (u) => (s.current = Yr(t._reactor.getPreviousResult(r)), r ? t.subscribeQuery(r, (c) => {
6210
+ s.current = Object.assign({ isLoading: !c, data: void 0, pageInfo: void 0, error: void 0 }, c), u();
6198
6211
  }) : () => {
6199
6212
  }),
6200
6213
  // Build a new subscribe function if the query changes
@@ -6240,8 +6253,8 @@ function tc(t, e = {}) {
6240
6253
  isLoading: !0
6241
6254
  };
6242
6255
  });
6243
- Pe(() => t.core._reactor.subscribePresence(t.type, t.id, e, (c) => {
6244
- s(c);
6256
+ Pe(() => t.core._reactor.subscribePresence(t.type, t.id, e, (d) => {
6257
+ s(d);
6245
6258
  }), [t.id, e.user, (n = e.peers) === null || n === void 0 ? void 0 : n.join(), (r = e.keys) === null || r === void 0 ? void 0 : r.join()]);
6246
6259
  const o = Se((u) => {
6247
6260
  t.core._reactor.publishPresence(t.type, t.id, u);
@@ -6255,28 +6268,28 @@ function rc(t, e, n = {}) {
6255
6268
  const r = Ju(), i = Ae.usePresence(t, {
6256
6269
  keys: [e]
6257
6270
  }), s = sn(() => {
6258
- var d;
6271
+ var c;
6259
6272
  const f = t._core._reactor.getPresence(t.type, t.id);
6260
- return n != null && n.writeOnly ? [] : Object.values((d = f == null ? void 0 : f.peers) !== null && d !== void 0 ? d : {}).filter((h) => h[e] === !0);
6261
- }, [n == null ? void 0 : n.writeOnly, i]), o = Se((d) => {
6273
+ return n != null && n.writeOnly ? [] : Object.values((c = f == null ? void 0 : f.peers) !== null && c !== void 0 ? c : {}).filter((h) => h[e] === !0);
6274
+ }, [n == null ? void 0 : n.writeOnly, i]), o = Se((c) => {
6262
6275
  var f;
6263
6276
  t.core._reactor.publishPresence(t.type, t.id, {
6264
- [e]: d
6265
- }), d && ((n == null ? void 0 : n.timeout) === null || (n == null ? void 0 : n.timeout) === 0 || r.set((f = n == null ? void 0 : n.timeout) !== null && f !== void 0 ? f : Zu, () => {
6277
+ [e]: c
6278
+ }), c && ((n == null ? void 0 : n.timeout) === null || (n == null ? void 0 : n.timeout) === 0 || r.set((f = n == null ? void 0 : n.timeout) !== null && f !== void 0 ? f : Zu, () => {
6266
6279
  t.core._reactor.publishPresence(t.type, t.id, {
6267
6280
  [e]: null
6268
6281
  });
6269
6282
  }));
6270
- }, [t.type, t.id, e, n == null ? void 0 : n.timeout, r]), a = Se((d) => {
6271
- const h = !((n == null ? void 0 : n.stopOnEnter) && d.key === "Enter");
6283
+ }, [t.type, t.id, e, n == null ? void 0 : n.timeout, r]), a = Se((c) => {
6284
+ const h = !((n == null ? void 0 : n.stopOnEnter) && c.key === "Enter");
6272
6285
  o(h);
6273
6286
  }, [n.stopOnEnter, o]), u = Se(() => {
6274
6287
  o(!1);
6275
- }, [o]), c = sn(() => ({ onKeyDown: a, onBlur: u }), [a, u]);
6288
+ }, [o]), d = sn(() => ({ onKeyDown: a, onBlur: u }), [a, u]);
6276
6289
  return {
6277
6290
  active: s,
6278
6291
  setActive: o,
6279
- inputProps: c
6292
+ inputProps: d
6280
6293
  };
6281
6294
  }
6282
6295
  const Ae = {
@@ -6300,24 +6313,24 @@ var sc = function(t, e, n, r) {
6300
6313
  });
6301
6314
  }
6302
6315
  return new (n || (n = Promise))(function(s, o) {
6303
- function a(d) {
6316
+ function a(c) {
6304
6317
  try {
6305
- c(r.next(d));
6318
+ d(r.next(c));
6306
6319
  } catch (f) {
6307
6320
  o(f);
6308
6321
  }
6309
6322
  }
6310
- function u(d) {
6323
+ function u(c) {
6311
6324
  try {
6312
- c(r.throw(d));
6325
+ d(r.throw(c));
6313
6326
  } catch (f) {
6314
6327
  o(f);
6315
6328
  }
6316
6329
  }
6317
- function c(d) {
6318
- d.done ? s(d.value) : i(d.value).then(a, u);
6330
+ function d(c) {
6331
+ c.done ? s(c.value) : i(c.value).then(a, u);
6319
6332
  }
6320
- c((r = r.apply(t, e || [])).next());
6333
+ d((r = r.apply(t, e || [])).next());
6321
6334
  });
6322
6335
  };
6323
6336
  const oc = {
@@ -6414,8 +6427,8 @@ function uc(t) {
6414
6427
  "`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?"
6415
6428
  );
6416
6429
  const { onEvent: e = nn, onError: n = nn, onRetry: r = nn, onComment: i } = t;
6417
- let s = "", o = !0, a, u = "", c = "";
6418
- function d(y) {
6430
+ let s = "", o = !0, a, u = "", d = "";
6431
+ function c(y) {
6419
6432
  const g = o ? y.replace(/^\xEF\xBB\xBF/, "") : y, [T, w] = cc(`${s}${g}`);
6420
6433
  for (const v of T)
6421
6434
  f(v);
@@ -6441,7 +6454,7 @@ function uc(t) {
6441
6454
  function h(y, g, T) {
6442
6455
  switch (y) {
6443
6456
  case "event":
6444
- c = g;
6457
+ d = g;
6445
6458
  break;
6446
6459
  case "data":
6447
6460
  u = `${u}${g}
@@ -6472,17 +6485,17 @@ function uc(t) {
6472
6485
  function p() {
6473
6486
  u.length > 0 && e({
6474
6487
  id: a,
6475
- event: c || void 0,
6488
+ event: d || void 0,
6476
6489
  // If the data buffer's last character is a U+000A LINE FEED (LF) character,
6477
6490
  // then remove the last character from the data buffer.
6478
6491
  data: u.endsWith(`
6479
6492
  `) ? u.slice(0, -1) : u
6480
- }), a = void 0, u = "", c = "";
6493
+ }), a = void 0, u = "", d = "";
6481
6494
  }
6482
- function b(y = {}) {
6483
- s && y.consume && f(s), o = !0, a = void 0, u = "", c = "", s = "";
6495
+ function _(y = {}) {
6496
+ s && y.consume && f(s), o = !0, a = void 0, u = "", d = "", s = "";
6484
6497
  }
6485
- return { feed: d, reset: b };
6498
+ return { feed: c, reset: _ };
6486
6499
  }
6487
6500
  function cc(t) {
6488
6501
  const e = [];
@@ -6563,24 +6576,24 @@ function Zr(t) {
6563
6576
  }
6564
6577
  var Fi = (t) => {
6565
6578
  throw TypeError(t);
6566
- }, Yn = (t, e, n) => e.has(t) || Fi("Cannot " + n), A = (t, e, n) => (Yn(t, e, "read from private field"), n ? n.call(t) : e.get(t)), K = (t, e, n) => e.has(t) ? Fi("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, n), $ = (t, e, n, r) => (Yn(t, e, "write to private field"), e.set(t, n), n), be = (t, e, n) => (Yn(t, e, "access private method"), n), ee, je, De, At, $t, st, Ne, ot, ve, Ue, Ke, Le, tt, ce, An, jn, kn, Xr, Cn, Pn, nt, Mn, In;
6579
+ }, Yn = (t, e, n) => e.has(t) || Fi("Cannot " + n), A = (t, e, n) => (Yn(t, e, "read from private field"), n ? n.call(t) : e.get(t)), K = (t, e, n) => e.has(t) ? Fi("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, n), $ = (t, e, n, r) => (Yn(t, e, "write to private field"), e.set(t, n), n), ge = (t, e, n) => (Yn(t, e, "access private method"), n), ee, je, De, At, $t, st, Ne, ot, ve, Ue, Ke, Le, tt, ce, An, jn, kn, Xr, Cn, Pn, nt, Mn, In;
6567
6580
  class jt extends EventTarget {
6568
6581
  constructor(e, n) {
6569
6582
  var r, i;
6570
6583
  super(), K(this, ce), this.CONNECTING = 0, this.OPEN = 1, this.CLOSED = 2, K(this, ee), K(this, je), K(this, De), K(this, At), K(this, $t), K(this, st), K(this, Ne), K(this, ot, null), K(this, ve), K(this, Ue), K(this, Ke, null), K(this, Le, null), K(this, tt, null), K(this, jn, async (s) => {
6571
6584
  var o;
6572
6585
  A(this, Ue).reset();
6573
- const { body: a, redirected: u, status: c, headers: d } = s;
6574
- if (c === 204) {
6575
- be(this, ce, nt).call(this, "Server sent HTTP 204, not reconnecting", 204), this.close();
6586
+ const { body: a, redirected: u, status: d, headers: c } = s;
6587
+ if (d === 204) {
6588
+ ge(this, ce, nt).call(this, "Server sent HTTP 204, not reconnecting", 204), this.close();
6576
6589
  return;
6577
6590
  }
6578
- if (u ? $(this, De, new URL(s.url)) : $(this, De, void 0), c !== 200) {
6579
- be(this, ce, nt).call(this, `Non-200 status code (${c})`, c);
6591
+ if (u ? $(this, De, new URL(s.url)) : $(this, De, void 0), d !== 200) {
6592
+ ge(this, ce, nt).call(this, `Non-200 status code (${d})`, d);
6580
6593
  return;
6581
6594
  }
6582
- if (!(d.get("content-type") || "").startsWith("text/event-stream")) {
6583
- be(this, ce, nt).call(this, 'Invalid content type, expected "text/event-stream"', c);
6595
+ if (!(c.get("content-type") || "").startsWith("text/event-stream")) {
6596
+ ge(this, ce, nt).call(this, 'Invalid content type, expected "text/event-stream"', d);
6584
6597
  return;
6585
6598
  }
6586
6599
  if (A(this, ee) === this.CLOSED)
@@ -6588,17 +6601,17 @@ class jt extends EventTarget {
6588
6601
  $(this, ee, this.OPEN);
6589
6602
  const f = new Event("open");
6590
6603
  if ((o = A(this, tt)) == null || o.call(this, f), this.dispatchEvent(f), typeof a != "object" || !a || !("getReader" in a)) {
6591
- be(this, ce, nt).call(this, "Invalid response body, expected a web ReadableStream", c), this.close();
6604
+ ge(this, ce, nt).call(this, "Invalid response body, expected a web ReadableStream", d), this.close();
6592
6605
  return;
6593
6606
  }
6594
6607
  const h = new TextDecoder(), p = a.getReader();
6595
- let b = !0;
6608
+ let _ = !0;
6596
6609
  do {
6597
6610
  const { done: y, value: g } = await p.read();
6598
- g && A(this, Ue).feed(h.decode(g, { stream: !y })), y && (b = !1, A(this, Ue).reset(), be(this, ce, Mn).call(this));
6599
- } while (b);
6611
+ g && A(this, Ue).feed(h.decode(g, { stream: !y })), y && (_ = !1, A(this, Ue).reset(), ge(this, ce, Mn).call(this));
6612
+ } while (_);
6600
6613
  }), K(this, kn, (s) => {
6601
- $(this, ve, void 0), !(s.name === "AbortError" || s.type === "aborted") && be(this, ce, Mn).call(this, En(s));
6614
+ $(this, ve, void 0), !(s.name === "AbortError" || s.type === "aborted") && ge(this, ce, Mn).call(this, En(s));
6602
6615
  }), K(this, Cn, (s) => {
6603
6616
  typeof s.id == "string" && $(this, ot, s.id);
6604
6617
  const o = new MessageEvent(s.event || "message", {
@@ -6610,7 +6623,7 @@ class jt extends EventTarget {
6610
6623
  }), K(this, Pn, (s) => {
6611
6624
  $(this, st, s);
6612
6625
  }), K(this, In, () => {
6613
- $(this, Ne, void 0), A(this, ee) === this.CONNECTING && be(this, ce, An).call(this);
6626
+ $(this, Ne, void 0), A(this, ee) === this.CONNECTING && ge(this, ce, An).call(this);
6614
6627
  });
6615
6628
  try {
6616
6629
  if (e instanceof URL)
@@ -6625,7 +6638,7 @@ class jt extends EventTarget {
6625
6638
  $(this, Ue, uc({
6626
6639
  onEvent: A(this, Cn),
6627
6640
  onRetry: A(this, Pn)
6628
- })), $(this, ee, this.CONNECTING), $(this, st, 3e3), $(this, $t, (r = n == null ? void 0 : n.fetch) != null ? r : globalThis.fetch), $(this, At, (i = n == null ? void 0 : n.withCredentials) != null ? i : !1), be(this, ce, An).call(this);
6641
+ })), $(this, ee, this.CONNECTING), $(this, st, 3e3), $(this, $t, (r = n == null ? void 0 : n.fetch) != null ? r : globalThis.fetch), $(this, At, (i = n == null ? void 0 : n.withCredentials) != null ? i : !1), ge(this, ce, An).call(this);
6629
6642
  }
6630
6643
  /**
6631
6644
  * Returns the state of this EventSource object's connection. It can have the values described below.
@@ -6704,7 +6717,7 @@ ee = /* @__PURE__ */ new WeakMap(), je = /* @__PURE__ */ new WeakMap(), De = /*
6704
6717
  * @internal
6705
6718
  */
6706
6719
  An = function() {
6707
- $(this, ee, this.CONNECTING), $(this, ve, new AbortController()), A(this, $t)(A(this, je), be(this, ce, Xr).call(this)).then(A(this, jn)).catch(A(this, kn));
6720
+ $(this, ee, this.CONNECTING), $(this, ve, new AbortController()), A(this, $t)(A(this, je), ge(this, ce, Xr).call(this)).then(A(this, jn)).catch(A(this, kn));
6708
6721
  }, jn = /* @__PURE__ */ new WeakMap(), kn = /* @__PURE__ */ new WeakMap(), /**
6709
6722
  * Get request options for the `fetch()` request
6710
6723
  *
@@ -6792,15 +6805,15 @@ function Tc({
6792
6805
  children: o,
6793
6806
  renderCursor: a,
6794
6807
  propagate: u,
6795
- zIndex: c
6808
+ zIndex: d
6796
6809
  }) {
6797
- const d = e || `cursors-space-default--${String(n.type)}-${n.id}`, f = n.usePresence({
6798
- keys: [d]
6810
+ const c = e || `cursors-space-default--${String(n.type)}-${n.id}`, f = n.usePresence({
6811
+ keys: [c]
6799
6812
  }), h = n._core._reactor.getPresence(n.type, n.id);
6800
6813
  function p(w, v) {
6801
6814
  const P = v.clientX, E = v.clientY, U = (P - w.left) / w.width * 100, F = (E - w.top) / w.height * 100;
6802
6815
  f.publishPresence({
6803
- [d]: {
6816
+ [c]: {
6804
6817
  x: P,
6805
6818
  y: E,
6806
6819
  xPercent: U,
@@ -6809,14 +6822,14 @@ function Tc({
6809
6822
  }
6810
6823
  });
6811
6824
  }
6812
- function b(w) {
6825
+ function _(w) {
6813
6826
  u || w.stopPropagation();
6814
6827
  const v = w.currentTarget.getBoundingClientRect();
6815
6828
  p(v, w);
6816
6829
  }
6817
6830
  function y(w) {
6818
6831
  f.publishPresence({
6819
- [d]: void 0
6832
+ [c]: void 0
6820
6833
  });
6821
6834
  }
6822
6835
  function g(w) {
@@ -6831,13 +6844,13 @@ function Tc({
6831
6844
  }
6832
6845
  function T(w) {
6833
6846
  f.publishPresence({
6834
- [d]: void 0
6847
+ [c]: void 0
6835
6848
  });
6836
6849
  }
6837
6850
  return ps(
6838
6851
  t,
6839
6852
  {
6840
- onMouseMove: b,
6853
+ onMouseMove: _,
6841
6854
  onMouseOut: y,
6842
6855
  onTouchMove: g,
6843
6856
  onTouchEnd: T,
@@ -6855,10 +6868,10 @@ function Tc({
6855
6868
  style: {
6856
6869
  ...ei,
6857
6870
  ...pc,
6858
- zIndex: c !== void 0 ? c : yc
6871
+ zIndex: d !== void 0 ? d : yc
6859
6872
  },
6860
6873
  children: Object.entries(f.peers).map(([w, v]) => {
6861
- const P = v[d];
6874
+ const P = v[c];
6862
6875
  return P ? /* @__PURE__ */ z.jsx(
6863
6876
  "div",
6864
6877
  {
@@ -6877,7 +6890,7 @@ function Tc({
6877
6890
  ) : null;
6878
6891
  })
6879
6892
  },
6880
- d
6893
+ c
6881
6894
  )
6882
6895
  ]
6883
6896
  );