@instantdb/react 0.22.49-experimental.persisted-object-2.19448682144.1 → 0.22.49-experimental.persisted-object-2.19477253536.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.
@@ -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) {
@@ -338,8 +338,8 @@ function Nn(t, e, n, r) {
338
338
  var a;
339
339
  const u = t.type === 3 ? t.setMap : t.copy;
340
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);
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;
@@ -349,42 +349,42 @@ function Nn(t, e, n, r) {
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 = me(t, u), c = Ot(me(e, u)), f = a ? rt(t, u) ? D.Replace : D.Add : D.Remove;
398
+ if (ge(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
  }
@@ -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
  }
@@ -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;
759
+ let g = c.type === 3 ? c.setMap : c.copy;
760
760
  const T = me(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
  }
@@ -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,7 +898,7 @@ 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
  }
@@ -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;
@@ -3154,24 +3154,24 @@ var Te = function(t, e, n, r) {
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,14 +3180,14 @@ 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();
3191
3191
  }
3192
3192
  _initMeta() {
3193
3193
  return Te(this, void 0, void 0, function* () {
@@ -3253,11 +3253,11 @@ class $r {
3253
3253
  var n, r;
3254
3254
  const i = [], s = e == null ? void 0 : e.skipGc;
3255
3255
  if (this._meta.isLoading) {
3256
- const p = new Promise((b, y) => {
3256
+ const p = new Promise((_, y) => {
3257
3257
  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);
3258
+ 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
3259
  });
3260
- return i.push(p), Promise.all(i).then((b) => b.reduce((y, g) => y + g, 0));
3260
+ return i.push(p), Promise.all(i).then((_) => _.reduce((y, g) => y + g, 0));
3261
3261
  }
3262
3262
  const o = this._meta.value;
3263
3263
  if (!o)
@@ -3266,30 +3266,30 @@ class $r {
3266
3266
  for (const p of this._pendingSaveKeys)
3267
3267
  p in this.currentValue ? u.push(p) : (a.push(p), delete o.objects[p]);
3268
3268
  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);
3269
+ const _ = this._persister.removeItem(p);
3270
+ i.push(_.then(() => 1)), this._loadedKeys.delete(p), this._pendingSaveKeys.delete(p);
3271
3271
  }
3272
- const c = [], d = [[Zt, o]], f = (n = o.objects) !== null && n !== void 0 ? n : {};
3272
+ const d = [], c = [[Zt, o]], f = (n = o.objects) !== null && n !== void 0 ? n : {};
3273
3273
  o.objects = f;
3274
3274
  for (const p of u)
3275
3275
  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 : {
3276
+ const _ = this.serialize(p, this.currentValue[p]);
3277
+ c.push([p, _]);
3278
+ const y = this._objectSize(_), g = (r = f[p]) !== null && r !== void 0 ? r : {
3279
3279
  createdAt: Date.now(),
3280
3280
  updatedAt: Date.now(),
3281
3281
  size: y
3282
3282
  };
3283
3283
  g.updatedAt = Date.now(), g.size = y, f[p] = g, this._pendingSaveKeys.delete(p);
3284
3284
  } else
3285
- c.push(p);
3286
- const h = this._persister.multiSet(d);
3285
+ d.push(p);
3286
+ const h = this._persister.multiSet(c);
3287
3287
  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);
3288
+ for (const p of d) {
3289
+ const _ = this._loadKey(p).then(() => this._enqueuePersist(e));
3290
+ i.push(_);
3291
3291
  }
3292
- return s || this.gc(), Promise.all(i).then((p) => p.reduce((b, y) => b + y, 0));
3292
+ return s || this.gc(), Promise.all(i).then((p) => p.reduce((_, y) => _ + y, 0));
3293
3293
  }
3294
3294
  flush() {
3295
3295
  return Te(this, void 0, void 0, function* () {
@@ -3301,44 +3301,48 @@ class $r {
3301
3301
  const e = new Set(yield this._persister.getAllKeys());
3302
3302
  e.delete(Zt);
3303
3303
  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);
3304
+ for (const h of Object.keys(this._loadingKeys))
3305
+ n.add(h);
3306
+ for (const h of this._loadedKeys)
3307
+ n.add(h);
3308
3308
  const r = yield this._getMeta();
3309
3309
  if (!r) {
3310
3310
  this._log.info("Could not gc because we were not able to load meta");
3311
3311
  return;
3312
3312
  }
3313
- const i = {
3313
+ const i = [], s = {
3314
3314
  gcOpts: this._gcOpts,
3315
3315
  keys: e,
3316
3316
  sacredKeys: n,
3317
3317
  removed: [],
3318
3318
  metaRemoved: [],
3319
- removedMetaCount: 0,
3320
3319
  removedMissingCount: 0,
3321
3320
  removedOldCount: 0,
3322
3321
  removedThresholdCount: 0,
3323
3322
  removedSizeCount: 0
3324
3323
  };
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++;
3324
+ for (const h of e)
3325
+ 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++);
3326
+ const o = Date.now();
3327
+ for (const [h, p] of Object.entries(r.objects))
3328
+ !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++);
3329
+ const a = Object.entries(r.objects);
3330
+ a.sort(([h, p], [_, y]) => p.updatedAt - y.updatedAt);
3331
+ const u = a.filter(([h]) => !n.has(h));
3332
+ if (a.length > this._gcOpts.maxEntries)
3333
+ for (const [h] of u.slice(0, a.length - this._gcOpts.maxEntries))
3334
+ i.push(this._persister.removeItem(h)), delete r.objects[h], s.removed.push(h), s.removedThresholdCount++;
3335
+ const d = Object.entries(r.objects);
3336
+ d.sort(([h, p], [_, y]) => p.updatedAt - y.updatedAt);
3337
+ const c = d.filter(([h]) => !n.has(h));
3338
+ let f = d.reduce((h, [p, _]) => h + _.size, 0);
3339
+ for (; f > 0 && f > this._gcOpts.maxSize && c.length; ) {
3340
+ const [[h, p]] = c.splice(0, 1);
3341
+ f -= p.size, i.push(this._persister.removeItem(h)), delete r.objects[h], s.removed.push(h), s.removedSizeCount++;
3338
3342
  }
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);
3343
+ for (const h of Object.keys(r.objects))
3344
+ !e.has(h) && !n.has(h) && delete r.objects[h];
3345
+ 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
3346
  });
3343
3347
  }
3344
3348
  gc() {
@@ -3346,7 +3350,7 @@ class $r {
3346
3350
  Rr(() => {
3347
3351
  this._nextGc = null, this._gc();
3348
3352
  }, 30 * 1e3);
3349
- }, 1e3));
3353
+ }, 1e3 * 60));
3350
3354
  }
3351
3355
  _enqueuePersist(e) {
3352
3356
  return new Promise((n, r) => {
@@ -3414,7 +3418,7 @@ function Dr(t) {
3414
3418
  }, e;
3415
3419
  }, {});
3416
3420
  }
3417
- const Qn = "v0.22.49-experimental.persisted-object-2.19448682144.1";
3421
+ const Qn = "v0.22.49-experimental.persisted-object-2.19477253536.1";
3418
3422
  function Ja(t, e) {
3419
3423
  return {
3420
3424
  info: t ? (...n) => console.info(...n, e()) : () => {
@@ -3515,17 +3519,17 @@ const Ur = [
3515
3519
  return !0;
3516
3520
  }
3517
3521
  }, 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);
3522
+ const a = s.valueType === "json", u = (d, c, f) => {
3523
+ if (!Ri(f, c, a))
3524
+ throw new R(`Invalid value for operator '${d}' on attribute '${r}' in entity '${i}'. Expected ${c}, but received: ${typeof f}`, o);
3521
3525
  };
3522
3526
  switch (t) {
3523
3527
  case "in":
3524
3528
  case "$in":
3525
3529
  if (!Array.isArray(e))
3526
3530
  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);
3531
+ for (const d of e)
3532
+ u(t, n, d);
3529
3533
  break;
3530
3534
  case "$not":
3531
3535
  case "$ne":
@@ -3552,8 +3556,8 @@ const Ur = [
3552
3556
  if (o)
3553
3557
  return;
3554
3558
  const u = t;
3555
- for (const [c, d] of Object.entries(u))
3556
- Xa(c, d, s, e, r, n, `${i}.${c}`);
3559
+ for (const [d, c] of Object.entries(u))
3560
+ Xa(d, c, s, e, r, n, `${i}.${d}`);
3557
3561
  } else if (!Ri(t, s, o))
3558
3562
  throw new R(`Invalid value for attribute '${e}' in entity '${r}'. Expected ${s}, but received: ${typeof t}`, i);
3559
3563
  }, eu = (t, e, n, r, i) => {
@@ -3561,14 +3565,14 @@ const Ur = [
3561
3565
  if (s.length < 2)
3562
3566
  throw new R(`Invalid dot notation path '${t}'. Must contain at least one dot.`, i);
3563
3567
  let o = n;
3564
- for (let d = 0; d < s.length - 1; d++) {
3565
- const f = s[d], h = r.entities[o];
3568
+ for (let c = 0; c < s.length - 1; c++) {
3569
+ const f = s[c], h = r.entities[o];
3566
3570
  if (!h)
3567
3571
  throw new R(`Entity '${o}' does not exist in schema while traversing dot notation path '${t}'.`, i);
3568
3572
  const p = h.links[f];
3569
3573
  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);
3574
+ const _ = Object.keys(h.links);
3575
+ throw new R(`Link '${f}' does not exist on entity '${o}' in dot notation path '${t}'. Available links: ${_.length > 0 ? _.join(", ") : "none"}`, i);
3572
3576
  }
3573
3577
  o = p.entityName;
3574
3578
  }
@@ -3581,24 +3585,24 @@ const Ur = [
3581
3585
  Fe(e, t, new J("string", !1, !0), n, i);
3582
3586
  return;
3583
3587
  }
3584
- const c = u.attrs[a];
3588
+ const d = u.attrs[a];
3585
3589
  if (Object.keys(u.links).includes(a)) {
3586
3590
  if (typeof e == "string" && !qe(e))
3587
3591
  throw new R(`Invalid value for link '${a}' in entity '${o}'. Expected a UUID, but received: ${e}`, i);
3588
3592
  Fe(e, t, new J("string", !1, !0), n, i);
3589
3593
  return;
3590
3594
  }
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);
3595
+ if (!d) {
3596
+ const c = Object.keys(u.attrs);
3597
+ 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
3598
  }
3595
- Fe(e, t, c, n, i);
3599
+ Fe(e, t, d, n, i);
3596
3600
  }, $i = (t, e, n, r) => {
3597
3601
  for (const [i, s] of Object.entries(t)) {
3598
3602
  if (i === "or" || i === "and") {
3599
3603
  if (Array.isArray(s))
3600
- for (const c of s)
3601
- typeof c == "object" && c !== null && $i(c, e, n, `${r}.${i}[${c}]`);
3604
+ for (const d of s)
3605
+ typeof d == "object" && d !== null && $i(d, e, n, `${r}.${i}[${d}]`);
3602
3606
  continue;
3603
3607
  }
3604
3608
  if (i === "id") {
@@ -3614,16 +3618,16 @@ const Ur = [
3614
3618
  continue;
3615
3619
  const a = o.attrs[i], u = o.links[i];
3616
3620
  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}`);
3621
+ const d = Object.keys(o.attrs), c = Object.keys(o.links);
3622
+ 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
3623
  }
3620
3624
  if (a)
3621
3625
  Fe(s, i, a, e, `${r}.${i}`);
3622
3626
  else if (u) {
3623
3627
  if (typeof s == "string" && !qe(s))
3624
3628
  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}`);
3629
+ const d = new J("string", !1, !0);
3630
+ Fe(s, i, d, e, `${r}.${i}`);
3627
3631
  }
3628
3632
  }
3629
3633
  }, tu = (t, e, n, r, i = 0) => {
@@ -3774,24 +3778,24 @@ var Wr = function(t, e, n, r) {
3774
3778
  });
3775
3779
  }
3776
3780
  return new (n || (n = Promise))(function(s, o) {
3777
- function a(d) {
3781
+ function a(c) {
3778
3782
  try {
3779
- c(r.next(d));
3783
+ d(r.next(c));
3780
3784
  } catch (f) {
3781
3785
  o(f);
3782
3786
  }
3783
3787
  }
3784
- function u(d) {
3788
+ function u(c) {
3785
3789
  try {
3786
- c(r.throw(d));
3790
+ d(r.throw(c));
3787
3791
  } catch (f) {
3788
3792
  o(f);
3789
3793
  }
3790
3794
  }
3791
- function c(d) {
3792
- d.done ? s(d.value) : i(d.value).then(a, u);
3795
+ function d(c) {
3796
+ c.done ? s(c.value) : i(c.value).then(a, u);
3793
3797
  }
3794
- c((r = r.apply(t, e || [])).next());
3798
+ d((r = r.apply(t, e || [])).next());
3795
3799
  });
3796
3800
  };
3797
3801
  let Li = 0;
@@ -3908,24 +3912,24 @@ var N = function(t, e, n, r) {
3908
3912
  });
3909
3913
  }
3910
3914
  return new (n || (n = Promise))(function(s, o) {
3911
- function a(d) {
3915
+ function a(c) {
3912
3916
  try {
3913
- c(r.next(d));
3917
+ d(r.next(c));
3914
3918
  } catch (f) {
3915
3919
  o(f);
3916
3920
  }
3917
3921
  }
3918
- function u(d) {
3922
+ function u(c) {
3919
3923
  try {
3920
- c(r.throw(d));
3924
+ d(r.throw(c));
3921
3925
  } catch (f) {
3922
3926
  o(f);
3923
3927
  }
3924
3928
  }
3925
- function c(d) {
3926
- d.done ? s(d.value) : i(d.value).then(a, u);
3929
+ function d(c) {
3930
+ c.done ? s(c.value) : i(c.value).then(a, u);
3927
3931
  }
3928
- c((r = r.apply(t, e || [])).next());
3932
+ d((r = r.apply(t, e || [])).next());
3929
3933
  });
3930
3934
  }, uu = function(t, e) {
3931
3935
  var n = {};
@@ -4005,41 +4009,41 @@ function Vr(t) {
4005
4009
  class mu {
4006
4010
  constructor(e, n = ki, r = Ci, i, s) {
4007
4011
  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) => {
4012
+ 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 = (d, c, f) => {
4013
+ const h = c == null ? void 0 : c.result, p = f == null ? void 0 : f.result;
4014
+ return h && !p && f && (f.result = h), f || c;
4015
+ }, this._onMergeKv = (d, c, f) => {
4012
4016
  var h, p;
4013
- switch (c) {
4017
+ switch (d) {
4014
4018
  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]) => {
4019
+ 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]);
4020
+ return (c ? this._rewriteMutationsSorted(this.attrs, c) : []).forEach(([w, v]) => {
4017
4021
  var P;
4018
4022
  !(!((P = f == null ? void 0 : f.pendingMutations) === null || P === void 0) && P.has(w)) && !v["tx-id"] && this._sendMutation(w, v);
4019
4023
  }), g;
4020
4024
  }
4021
4025
  default:
4022
- return d || f;
4026
+ return c || f;
4023
4027
  }
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);
4028
+ }, this.getPreviousResult = (d) => {
4029
+ const c = X(d);
4030
+ return this.dataForQuery(c);
4031
+ }, this.notifyOne = (d) => {
4032
+ var c, f;
4033
+ 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);
4034
+ _ && (Et(_, p) || h.forEach((y) => y.cb(_)));
4035
+ }, this.notifyOneQueryOnce = (d) => {
4036
+ var c;
4037
+ const f = (c = this.queryOnceDfds[d]) !== null && c !== void 0 ? c : [], h = this.dataForQuery(d);
4034
4038
  f.forEach((p) => {
4035
- this._completeQueryOnce(p.q, c, p.dfd), p.dfd.resolve(h);
4039
+ this._completeQueryOnce(p.q, d, p.dfd), p.dfd.resolve(h);
4036
4040
  });
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);
4041
+ }, this.notifyQueryError = (d, c) => {
4042
+ (this.queryCbs[d] || []).forEach((h) => h.cb({ error: c }));
4043
+ }, this.pushTx = (d) => {
4044
+ this.config.disableValidation || ou(d, this.config.schema);
4041
4045
  try {
4042
- const d = Ra({
4046
+ const c = Ra({
4043
4047
  attrs: this.optimisticAttrs(),
4044
4048
  schema: this.config.schema,
4045
4049
  // XXX: How are we going to do this?
@@ -4049,28 +4053,28 @@ class mu {
4049
4053
  return (h = f == null ? void 0 : f.result) === null || h === void 0 ? void 0 : h.store;
4050
4054
  }),
4051
4055
  useDateObjects: this.config.useDateObjects
4052
- }, c);
4053
- return this.pushOps(d);
4054
- } catch (d) {
4055
- return this.pushOps([], d);
4056
+ }, d);
4057
+ return this.pushOps(c);
4058
+ } catch (c) {
4059
+ return this.pushOps([], c);
4056
4060
  }
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 = {
4061
+ }, this.pushOps = (d, c) => {
4062
+ const f = B(), h = [...this._pendingMutations().values()], p = Math.max(0, ...h.map((g) => g.order || 0)) + 1, _ = {
4059
4063
  op: "transact",
4060
- "tx-steps": c,
4064
+ "tx-steps": d,
4061
4065
  created: Date.now(),
4062
- error: d,
4066
+ error: c,
4063
4067
  order: p
4064
4068
  };
4065
4069
  this._updatePendingMutations((g) => {
4066
- g.set(f, b);
4070
+ g.set(f, _);
4067
4071
  });
4068
4072
  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");
4073
+ return this.mutationDeferredStore.set(f, y), this._sendMutation(f, _), this.notifyAll(), y.promise;
4074
+ }, this._transportOnOpen = (d) => {
4075
+ const c = d.target;
4076
+ if (this._transport !== c) {
4077
+ this._log.info("[socket][open]", c.id, "skip; this is no longer the current transport");
4074
4078
  return;
4075
4079
  }
4076
4080
  this._log.info("[socket][open]", this._transport.id), this._setStatus(_e.OPENED), this.getCurrentUser().then((f) => {
@@ -4088,22 +4092,22 @@ class mu {
4088
4092
  "__admin-token": this.config.__adminToken
4089
4093
  });
4090
4094
  }).catch((f) => {
4091
- this._log.error("[socket][error]", d.id, f);
4095
+ this._log.error("[socket][error]", c.id, f);
4092
4096
  });
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");
4097
+ }, this._transportOnMessage = (d) => {
4098
+ const c = d.target, f = d.message;
4099
+ if (this._transport !== c) {
4100
+ this._log.info("[socket][message]", c.id, f, "skip; this is no longer the current transport");
4097
4101
  return;
4098
4102
  }
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");
4103
+ !this._wsOk && c.type === "ws" && (this._wsOk = !0), this._transportType = "ws", this._handleReceive(c.id, d.message);
4104
+ }, this._transportOnError = (d) => {
4105
+ const c = d.target;
4106
+ if (this._transport !== c) {
4107
+ this._log.info("[socket][error]", c.id, "skip; this is no longer the current transport");
4104
4108
  return;
4105
4109
  }
4106
- this._log.error("[socket][error]", d.id, c);
4110
+ this._log.error("[socket][error]", c.id, d);
4107
4111
  }, this._scheduleReconnect = () => {
4108
4112
  !this._wsOk && this._transportType !== "sse" && (this._transportType = "sse", this._reconnectTimeoutMs = 0), setTimeout(() => {
4109
4113
  if (this._reconnectTimeoutMs = Math.min(this._reconnectTimeoutMs + 1e3, 1e4), !this._isOnline) {
@@ -4112,38 +4116,38 @@ class mu {
4112
4116
  }
4113
4117
  this._startSocket();
4114
4118
  }, 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");
4119
+ }, this._transportOnClose = (d) => {
4120
+ const c = d.target;
4121
+ if (this._transport !== c) {
4122
+ this._log.info("[socket][close]", c.id, "skip; this is no longer the current transport");
4119
4123
  return;
4120
4124
  }
4121
4125
  this._setStatus(_e.CLOSED);
4122
4126
  for (const f of Object.values(this._rooms))
4123
4127
  f.isConnected = !1;
4124
4128
  if (this._isShutdown) {
4125
- this._log.info("[socket][close]", d.id, "Reactor has been shut down and will not reconnect");
4129
+ this._log.info("[socket][close]", c.id, "Reactor has been shut down and will not reconnect");
4126
4130
  return;
4127
4131
  }
4128
- this._log.info("[socket][close]", d.id, "schedule reconnect, ms =", this._reconnectTimeoutMs), this._scheduleReconnect();
4132
+ this._log.info("[socket][close]", c.id, "schedule reconnect, ms =", this._reconnectTimeoutMs), this._scheduleReconnect();
4129
4133
  }, 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
4134
  if (!e.appId)
4131
4135
  throw new Error("Instant must be initialized with an appId.");
4132
4136
  if (!qe(e.appId))
4133
4137
  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;
4138
+ typeof BroadcastChannel == "function" && (this._broadcastChannel = new BroadcastChannel("@instantdb"), this._broadcastChannel.addEventListener("message", (d) => N(this, void 0, void 0, function* () {
4139
+ var c;
4136
4140
  try {
4137
- if (((d = c.data) === null || d === void 0 ? void 0 : d.type) === "auth") {
4141
+ if (((c = d.data) === null || c === void 0 ? void 0 : c.type) === "auth") {
4138
4142
  const f = yield this.getCurrentUser();
4139
4143
  this.updateUser(f.user);
4140
4144
  }
4141
4145
  } catch (f) {
4142
4146
  this._log.error("[error] handle broadcast channel", f);
4143
4147
  }
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)));
4148
+ }))), this._initStorage(n), this._oauthCallbackResponse = this._oauthLoginInit(), this.getCurrentUser(), r.getIsOnline().then((d) => {
4149
+ this._isOnline = d, this._startSocket(), r.listen((c) => {
4150
+ 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", _e.CLOSED), this._setStatus(_e.CLOSED)));
4147
4151
  });
4148
4152
  }), typeof addEventListener < "u" && (this._beforeUnload = this._beforeUnload.bind(this), addEventListener("beforeunload", this._beforeUnload));
4149
4153
  }
@@ -4240,13 +4244,13 @@ class mu {
4240
4244
  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
4245
  if (this._broadcastQueue[e] = [], i && this._trySetPresence(e, i), s)
4242
4246
  for (const o of s) {
4243
- const { topic: a, roomType: u, data: c } = o;
4244
- this._tryBroadcast(e, u, a, c);
4247
+ const { topic: a, roomType: u, data: d } = o;
4248
+ this._tryBroadcast(e, u, a, d);
4245
4249
  }
4246
4250
  }
4247
4251
  _handleReceive(e, n) {
4248
4252
  var r, i, s, o, a, u;
4249
- const c = !!this.config.schema && ("cardinalityInference" in this.config ? !!this.config.cardinalityInference : !0);
4253
+ const d = !!this.config.schema && ("cardinalityInference" in this.config ? !!this.config.cardinalityInference : !0);
4250
4254
  switch (zr[n.op] || this._log.info("[receive]", e, n.op, n), n.op) {
4251
4255
  case "init-ok":
4252
4256
  this._setStatus(_e.AUTHENTICATED), this._reconnectTimeoutMs = 0, this._setAttrs(n.attrs), this._flushPendingMessages(), this._sessionId = n["session-id"];
@@ -4259,14 +4263,14 @@ class mu {
4259
4263
  this.notifyOneQueryOnce(X(n.q));
4260
4264
  break;
4261
4265
  case "add-query-ok":
4262
- const { q: d, result: f } = n, h = X(d);
4266
+ const { q: c, result: f } = n, h = X(c);
4263
4267
  if (!this._hasQueryListeners() && !this.querySubs.currentValue[h])
4264
4268
  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);
4269
+ 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
4270
  this.querySubs.updateInPlace((O) => (O[h].result = {
4267
4271
  store: g,
4268
4272
  pageInfo: p,
4269
- aggregate: b,
4273
+ aggregate: _,
4270
4274
  processedTxId: n["processed-tx-id"]
4271
4275
  }, O)), this._cleanupPendingMutationsQueries(), this.notifyOne(h), this.notifyOneQueryOnce(h), this._cleanupPendingMutationsTimeout();
4272
4276
  break;
@@ -4279,7 +4283,7 @@ class mu {
4279
4283
  });
4280
4284
  const E = Vr(P.entries()), U = T.map((O) => {
4281
4285
  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;
4286
+ 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 = (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;
4283
4287
  return { hash: Oe, store: ht, pageInfo: pt, aggregate: yt };
4284
4288
  });
4285
4289
  U.forEach(({ hash: O, store: Q, pageInfo: we, aggregate: pe }) => {
@@ -4372,16 +4376,16 @@ class mu {
4372
4376
  console.log("error", e);
4373
4377
  const a = e["client-event-id"];
4374
4378
  this._inFlightMutationEventIds.delete(a);
4375
- const u = this._pendingMutations().get(a), c = {
4379
+ const u = this._pendingMutations().get(a), d = {
4376
4380
  message: e.message || "Uh-oh, something went wrong. Ping Joe & Stopa."
4377
4381
  };
4378
- if (e.hint && (c.hint = e.hint), u) {
4382
+ if (e.hint && (d.hint = e.hint), u) {
4379
4383
  this._handleMutationError("error", a, e);
4380
4384
  return;
4381
4385
  }
4382
4386
  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
4387
  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);
4388
+ this.notifyQueryError(X(h), d), this.notifyQueryOnceError(h, p, a, d);
4385
4389
  return;
4386
4390
  }
4387
4391
  if (((s = e["original-event"]) === null || s === void 0 ? void 0 : s.op) === "init") {
@@ -4389,7 +4393,7 @@ class mu {
4389
4393
  this.changeCurrentUser(null);
4390
4394
  return;
4391
4395
  }
4392
- this._setStatus(_e.ERRORED, c), this.notifyAll();
4396
+ this._setStatus(_e.ERRORED, d), this.notifyAll();
4393
4397
  return;
4394
4398
  }
4395
4399
  const f = Object.assign({}, e);
@@ -4450,7 +4454,7 @@ class mu {
4450
4454
  return !!(!((n = this.queryCbs[e]) === null || n === void 0) && n.length || !((r = this.queryOnceDfds[e]) === null || r === void 0) && r.length);
4451
4455
  }
4452
4456
  _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 }));
4457
+ 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
4458
  }
4455
4459
  // When we `pushTx`, it's possible that we don't yet have `this.attrs`
4456
4460
  // This means that `tx-steps` in `pendingMutations` will include `add-attr`
@@ -4468,19 +4472,19 @@ class mu {
4468
4472
  return n;
4469
4473
  if (!n)
4470
4474
  return /* @__PURE__ */ new Map();
4471
- const i = (d) => {
4472
- const [f, h, p] = d["forward-identity"];
4475
+ const i = (c) => {
4476
+ const [f, h, p] = c["forward-identity"];
4473
4477
  return V(e, h, p);
4474
- }, s = (d) => {
4475
- const [f, h, p] = d["forward-identity"];
4478
+ }, s = (c) => {
4479
+ const [f, h, p] = c["forward-identity"];
4476
4480
  return Ce(e, h, p);
4477
4481
  }, o = { attrIdMap: {}, refSwapAttrIds: /* @__PURE__ */ new Set() };
4478
4482
  let a = !1;
4479
- const u = (d, f) => {
4483
+ const u = (c, f) => {
4480
4484
  const h = [];
4481
- for (const p of d) {
4482
- const [b] = p;
4483
- if (b === "add-attr") {
4485
+ for (const p of c) {
4486
+ const [_] = p;
4487
+ if (_ === "add-attr") {
4484
4488
  const [g, T] = p, w = i(T);
4485
4489
  if (w && T.id !== w.id) {
4486
4490
  o.attrIdMap[T.id] = w.id, a = !0;
@@ -4494,18 +4498,18 @@ class mu {
4494
4498
  }
4495
4499
  }
4496
4500
  }
4497
- if (r && f && r >= f && b === "add-attr" || b === "update-attr" || b === "delete-attr") {
4501
+ if (r && f && r >= f && _ === "add-attr" || _ === "update-attr" || _ === "delete-attr") {
4498
4502
  a = !0;
4499
4503
  continue;
4500
4504
  }
4501
4505
  const y = a ? ca(o, p) : p;
4502
4506
  h.push(y);
4503
4507
  }
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;
4508
+ return a ? h : c;
4509
+ }, d = /* @__PURE__ */ new Map();
4510
+ for (const [c, f] of n.entries())
4511
+ d.set(c, Object.assign(Object.assign({}, f), { "tx-steps": u(f["tx-steps"], f["tx-id"]) }));
4512
+ return a ? d : n;
4509
4513
  }
4510
4514
  _rewriteMutationsSorted(e, n) {
4511
4515
  return Vr(this._rewriteMutations(e, n).entries());
@@ -4519,8 +4523,8 @@ class mu {
4519
4523
  if (a === "add-attr")
4520
4524
  i.push(u);
4521
4525
  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);
4526
+ const d = Object.assign(Object.assign({}, this.attrs[u.id]), u);
4527
+ i.push(d);
4524
4528
  }
4525
4529
  const s = [
4526
4530
  ...Object.values(this.attrs || {}),
@@ -4538,10 +4542,10 @@ class mu {
4538
4542
  const r = this.querySubs.version(), i = this.querySubs.currentValue, s = this.kv.version(), o = this._pendingMutations(), { q: a, result: u } = i[e] || {};
4539
4543
  if (!u)
4540
4544
  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);
4545
+ const d = this._dataForQueryCache[e];
4546
+ if (d && r === d.querySubVersion && s === d.pendingMutationsVersion)
4547
+ return d.data;
4548
+ 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
4549
  return this._dataForQueryCache[e] = {
4546
4550
  querySubVersion: r,
4547
4551
  pendingMutationsVersion: s,
@@ -4733,13 +4737,13 @@ class mu {
4733
4737
  return null;
4734
4738
  this._replaceUrlAfterOAuth();
4735
4739
  try {
4736
- const u = yield this._getCurrentUser(), c = (u == null ? void 0 : u.type) === "guest", { user: d } = yield Pr({
4740
+ const u = yield this._getCurrentUser(), d = (u == null ? void 0 : u.type) === "guest", { user: c } = yield Pr({
4737
4741
  apiURI: this.config.apiURI,
4738
4742
  appId: this.config.appId,
4739
4743
  code: a,
4740
- refreshToken: c ? u.refresh_token : void 0
4744
+ refreshToken: d ? u.refresh_token : void 0
4741
4745
  });
4742
- return this.setCurrentUser(d), null;
4746
+ return this.setCurrentUser(c), null;
4743
4747
  } catch (u) {
4744
4748
  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
4749
  }
@@ -5039,8 +5043,8 @@ class mu {
5039
5043
  r.initialPresence || r.initialData
5040
5044
  ), o = Object.assign(Object.assign({}, r), { roomId: n, cb: i, prev: null });
5041
5045
  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();
5046
+ var a, u, d;
5047
+ 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
5048
  };
5045
5049
  }
5046
5050
  _notifyPresenceSubs(e) {
@@ -5056,22 +5060,22 @@ class mu {
5056
5060
  _patchPresencePeers(e, n) {
5057
5061
  var r, i, s;
5058
5062
  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 }]));
5063
+ let a = Object.fromEntries(Object.entries(o).map(([d, c]) => [d, { data: c }]));
5060
5064
  (s = this._presence[e]) === null || s === void 0 || s.result;
5061
- const u = Mt(a, (c) => {
5062
- for (let [d, f, h] of n)
5065
+ const u = Mt(a, (d) => {
5066
+ for (let [c, f, h] of n)
5063
5067
  switch (f) {
5064
5068
  case "+":
5065
- ks(c, d, h);
5069
+ ks(d, c, h);
5066
5070
  break;
5067
5071
  case "r":
5068
- wr(c, d, h);
5072
+ wr(d, c, h);
5069
5073
  break;
5070
5074
  case "-":
5071
- li(c, d);
5075
+ li(d, c);
5072
5076
  break;
5073
5077
  }
5074
- delete c[this._sessionId];
5078
+ delete d[this._sessionId];
5075
5079
  });
5076
5080
  this._setPresencePeers(e, u);
5077
5081
  }
@@ -5114,9 +5118,9 @@ class mu {
5114
5118
  _notifyBroadcastSubs(e, n, r) {
5115
5119
  var i, s, o;
5116
5120
  (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);
5121
+ var u, d, c, f, h, p;
5122
+ 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"]];
5123
+ return a(_, y);
5120
5124
  });
5121
5125
  }
5122
5126
  // --------
@@ -5211,9 +5215,9 @@ function Ni(t, e) {
5211
5215
  entityName: u.forward.on,
5212
5216
  cardinality: u.reverse.has
5213
5217
  };
5214
- return Object.fromEntries(Object.entries(t).map(([u, c]) => [
5218
+ return Object.fromEntries(Object.entries(t).map(([u, d]) => [
5215
5219
  u,
5216
- new Nt(c.attrs, Object.assign(Object.assign({}, o.fwd[u]), o.rev[u]))
5220
+ new Nt(d.attrs, Object.assign(Object.assign({}, o.fwd[u]), o.rev[u]))
5217
5221
  ]));
5218
5222
  }
5219
5223
  function ku({ entities: t, links: e, rooms: n }) {
@@ -5246,12 +5250,12 @@ let vt;
5246
5250
  function Cu(t, e) {
5247
5251
  vt == null || vt.dispose();
5248
5252
  const n = xu(e), r = Iu(e, a), i = Mu(Pu(t));
5249
- function s(d) {
5253
+ function s(c) {
5250
5254
  var f;
5251
- d.source === i.element.contentWindow && ((f = d.data) === null || f === void 0 ? void 0 : f.type) === "close" && n.isVisible() && a();
5255
+ c.source === i.element.contentWindow && ((f = c.data) === null || f === void 0 ? void 0 : f.type) === "close" && n.isVisible() && a();
5252
5256
  }
5253
- function o(d) {
5254
- const f = d.shiftKey && d.ctrlKey && d.key === "0", h = d.key === "Escape" || d.key === "Esc";
5257
+ function o(c) {
5258
+ const f = c.shiftKey && c.ctrlKey && c.key === "0", h = c.key === "Escape" || c.key === "Esc";
5255
5259
  (f || h && n.isVisible()) && a();
5256
5260
  }
5257
5261
  function a() {
@@ -5260,12 +5264,12 @@ function Cu(t, e) {
5260
5264
  function u() {
5261
5265
  n.element.remove(), r.element.remove(), removeEventListener("keydown", o), removeEventListener("message", s);
5262
5266
  }
5263
- function c() {
5267
+ function d() {
5264
5268
  document.body.appendChild(n.element), document.body.appendChild(r.element), addEventListener("keydown", o), addEventListener("message", s), vt = {
5265
5269
  dispose: u
5266
5270
  };
5267
5271
  }
5268
- return c();
5272
+ return d();
5269
5273
  }
5270
5274
  function Pu(t) {
5271
5275
  return `${Bn || Mi ? "http://localhost:3000" : "https://instantdb.com"}/_devtool?appId=${t}`;
@@ -5567,11 +5571,11 @@ function Gu() {
5567
5571
  if (Br) return Je;
5568
5572
  Br = 1;
5569
5573
  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]);
5574
+ function o(a, u, d) {
5575
+ var c, f = {}, h = null, p = null;
5576
+ d !== void 0 && (h = "" + d), u.key !== void 0 && (h = "" + u.key), u.ref !== void 0 && (p = u.ref);
5577
+ for (c in u) r.call(u, c) && !s.hasOwnProperty(c) && (f[c] = u[c]);
5578
+ if (a && a.defaultProps) for (c in u = a.defaultProps, u) f[c] === void 0 && (f[c] = u[c]);
5575
5579
  return { $$typeof: e, type: a, key: h, ref: p, props: f, _owner: i.current };
5576
5580
  }
5577
5581
  return Je.Fragment = n, Je.jsx = o, Je.jsxs = o, Je;
@@ -5591,45 +5595,45 @@ function Bu() {
5591
5595
  * LICENSE file in the root directory of this source tree.
5592
5596
  */
5593
5597
  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";
5598
+ 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
5599
  function T(l) {
5596
5600
  if (l === null || typeof l != "object")
5597
5601
  return null;
5598
- var _ = y && l[y] || l[g];
5599
- return typeof _ == "function" ? _ : null;
5602
+ var b = y && l[y] || l[g];
5603
+ return typeof b == "function" ? b : null;
5600
5604
  }
5601
5605
  var w = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
5602
5606
  function v(l) {
5603
5607
  {
5604
- for (var _ = arguments.length, m = new Array(_ > 1 ? _ - 1 : 0), S = 1; S < _; S++)
5608
+ for (var b = arguments.length, m = new Array(b > 1 ? b - 1 : 0), S = 1; S < b; S++)
5605
5609
  m[S - 1] = arguments[S];
5606
5610
  P("error", l, m);
5607
5611
  }
5608
5612
  }
5609
- function P(l, _, m) {
5613
+ function P(l, b, m) {
5610
5614
  {
5611
5615
  var S = w.ReactDebugCurrentFrame, M = S.getStackAddendum();
5612
- M !== "" && (_ += "%s", m = m.concat([M]));
5616
+ M !== "" && (b += "%s", m = m.concat([M]));
5613
5617
  var I = m.map(function(C) {
5614
5618
  return String(C);
5615
5619
  });
5616
- I.unshift("Warning: " + _), Function.prototype.apply.call(console[l], console, I);
5620
+ I.unshift("Warning: " + b), Function.prototype.apply.call(console[l], console, I);
5617
5621
  }
5618
5622
  }
5619
5623
  var E = !1, U = !1, F = !1, he = !1, O = !1, Q;
5620
5624
  Q = Symbol.for("react.module.reference");
5621
5625
  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
5626
+ 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
5627
  // types supported by any Flight configuration anywhere since
5624
5628
  // we don't know which Flight build this will end up being used
5625
5629
  // with.
5626
5630
  l.$$typeof === Q || l.getModuleId !== void 0));
5627
5631
  }
5628
- function pe(l, _, m) {
5632
+ function pe(l, b, m) {
5629
5633
  var S = l.displayName;
5630
5634
  if (S)
5631
5635
  return S;
5632
- var M = _.displayName || _.name || "";
5636
+ var M = b.displayName || b.name || "";
5633
5637
  return M !== "" ? m + "(" + M + ")" : m;
5634
5638
  }
5635
5639
  function ue(l) {
@@ -5651,7 +5655,7 @@ function Bu() {
5651
5655
  return "Profiler";
5652
5656
  case s:
5653
5657
  return "StrictMode";
5654
- case d:
5658
+ case c:
5655
5659
  return "Suspense";
5656
5660
  case f:
5657
5661
  return "SuspenseList";
@@ -5659,12 +5663,12 @@ function Bu() {
5659
5663
  if (typeof l == "object")
5660
5664
  switch (l.$$typeof) {
5661
5665
  case u:
5662
- var _ = l;
5663
- return ue(_) + ".Consumer";
5666
+ var b = l;
5667
+ return ue(b) + ".Consumer";
5664
5668
  case a:
5665
5669
  var m = l;
5666
5670
  return ue(m._context) + ".Provider";
5667
- case c:
5671
+ case d:
5668
5672
  return pe(l, l.render, "ForwardRef");
5669
5673
  case h:
5670
5674
  var S = l.displayName || null;
@@ -5743,7 +5747,7 @@ function Bu() {
5743
5747
  }
5744
5748
  }
5745
5749
  var Kt = w.ReactCurrentDispatcher, Wt;
5746
- function _t(l, _, m) {
5750
+ function _t(l, b, m) {
5747
5751
  {
5748
5752
  if (Wt === void 0)
5749
5753
  try {
@@ -5761,7 +5765,7 @@ function Bu() {
5761
5765
  var qi = typeof WeakMap == "function" ? WeakMap : Map;
5762
5766
  bt = new qi();
5763
5767
  }
5764
- function er(l, _) {
5768
+ function er(l, b) {
5765
5769
  if (!l || qt)
5766
5770
  return "";
5767
5771
  {
@@ -5776,7 +5780,7 @@ function Bu() {
5776
5780
  var I;
5777
5781
  I = Kt.current, Kt.current = null, Ki();
5778
5782
  try {
5779
- if (_) {
5783
+ if (b) {
5780
5784
  var C = function() {
5781
5785
  throw Error();
5782
5786
  };
@@ -5832,14 +5836,14 @@ function Bu() {
5832
5836
  var $e = l ? l.displayName || l.name : "", Ee = $e ? _t($e) : "";
5833
5837
  return typeof l == "function" && bt.set(l, Ee), Ee;
5834
5838
  }
5835
- function zi(l, _, m) {
5839
+ function zi(l, b, m) {
5836
5840
  return er(l, !1);
5837
5841
  }
5838
5842
  function Vi(l) {
5839
- var _ = l.prototype;
5840
- return !!(_ && _.isReactComponent);
5843
+ var b = l.prototype;
5844
+ return !!(b && b.isReactComponent);
5841
5845
  }
5842
- function gt(l, _, m) {
5846
+ function gt(l, b, m) {
5843
5847
  if (l == null)
5844
5848
  return "";
5845
5849
  if (typeof l == "function")
@@ -5847,21 +5851,21 @@ function Bu() {
5847
5851
  if (typeof l == "string")
5848
5852
  return _t(l);
5849
5853
  switch (l) {
5850
- case d:
5854
+ case c:
5851
5855
  return _t("Suspense");
5852
5856
  case f:
5853
5857
  return _t("SuspenseList");
5854
5858
  }
5855
5859
  if (typeof l == "object")
5856
5860
  switch (l.$$typeof) {
5857
- case c:
5861
+ case d:
5858
5862
  return zi(l.render);
5859
5863
  case h:
5860
- return gt(l.type, _, m);
5864
+ return gt(l.type, b, m);
5861
5865
  case p: {
5862
5866
  var S = l, M = S._payload, I = S._init;
5863
5867
  try {
5864
- return gt(I(M), _, m);
5868
+ return gt(I(M), b, m);
5865
5869
  } catch {
5866
5870
  }
5867
5871
  }
@@ -5871,12 +5875,12 @@ function Bu() {
5871
5875
  var Qe = Object.prototype.hasOwnProperty, tr = {}, nr = w.ReactDebugCurrentFrame;
5872
5876
  function mt(l) {
5873
5877
  if (l) {
5874
- var _ = l._owner, m = gt(l.type, l._source, _ ? _.type : null);
5878
+ var b = l._owner, m = gt(l.type, l._source, b ? b.type : null);
5875
5879
  nr.setExtraStackFrame(m);
5876
5880
  } else
5877
5881
  nr.setExtraStackFrame(null);
5878
5882
  }
5879
- function Gi(l, _, m, S, M) {
5883
+ function Gi(l, b, m, S, M) {
5880
5884
  {
5881
5885
  var I = Function.call.bind(Qe);
5882
5886
  for (var C in l)
@@ -5887,7 +5891,7 @@ function Bu() {
5887
5891
  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
5892
  throw Y.name = "Invariant Violation", Y;
5889
5893
  }
5890
- j = l[C](_, C, S, m, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
5894
+ j = l[C](b, C, S, m, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
5891
5895
  } catch (x) {
5892
5896
  j = x;
5893
5897
  }
@@ -5901,7 +5905,7 @@ function Bu() {
5901
5905
  }
5902
5906
  function Qi(l) {
5903
5907
  {
5904
- var _ = typeof Symbol == "function" && Symbol.toStringTag, m = _ && l[Symbol.toStringTag] || l.constructor.name || "Object";
5908
+ var b = typeof Symbol == "function" && Symbol.toStringTag, m = b && l[Symbol.toStringTag] || l.constructor.name || "Object";
5905
5909
  return m;
5906
5910
  }
5907
5911
  }
@@ -5927,27 +5931,27 @@ function Bu() {
5927
5931
  }, or, ar;
5928
5932
  function Ji(l) {
5929
5933
  if (Qe.call(l, "ref")) {
5930
- var _ = Object.getOwnPropertyDescriptor(l, "ref").get;
5931
- if (_ && _.isReactWarning)
5934
+ var b = Object.getOwnPropertyDescriptor(l, "ref").get;
5935
+ if (b && b.isReactWarning)
5932
5936
  return !1;
5933
5937
  }
5934
5938
  return l.ref !== void 0;
5935
5939
  }
5936
5940
  function Zi(l) {
5937
5941
  if (Qe.call(l, "key")) {
5938
- var _ = Object.getOwnPropertyDescriptor(l, "key").get;
5939
- if (_ && _.isReactWarning)
5942
+ var b = Object.getOwnPropertyDescriptor(l, "key").get;
5943
+ if (b && b.isReactWarning)
5940
5944
  return !1;
5941
5945
  }
5942
5946
  return l.key !== void 0;
5943
5947
  }
5944
- function Xi(l, _) {
5948
+ function Xi(l, b) {
5945
5949
  typeof l.ref == "string" && sr.current;
5946
5950
  }
5947
- function es(l, _) {
5951
+ function es(l, b) {
5948
5952
  {
5949
5953
  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)", _));
5954
+ 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
5955
  };
5952
5956
  m.isReactWarning = !0, Object.defineProperty(l, "key", {
5953
5957
  get: m,
@@ -5955,10 +5959,10 @@ function Bu() {
5955
5959
  });
5956
5960
  }
5957
5961
  }
5958
- function ts(l, _) {
5962
+ function ts(l, b) {
5959
5963
  {
5960
5964
  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)", _));
5965
+ 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
5966
  };
5963
5967
  m.isReactWarning = !0, Object.defineProperty(l, "ref", {
5964
5968
  get: m,
@@ -5966,13 +5970,13 @@ function Bu() {
5966
5970
  });
5967
5971
  }
5968
5972
  }
5969
- var ns = function(l, _, m, S, M, I, C) {
5973
+ var ns = function(l, b, m, S, M, I, C) {
5970
5974
  var j = {
5971
5975
  // This tag allows us to uniquely identify this as a React Element
5972
5976
  $$typeof: n,
5973
5977
  // Built-in properties that belong on the element
5974
5978
  type: l,
5975
- key: _,
5979
+ key: b,
5976
5980
  ref: m,
5977
5981
  props: C,
5978
5982
  // Record the component responsible for creating this element.
@@ -5995,12 +5999,12 @@ function Bu() {
5995
5999
  value: M
5996
6000
  }), Object.freeze && (Object.freeze(j.props), Object.freeze(j)), j;
5997
6001
  };
5998
- function rs(l, _, m, S, M) {
6002
+ function rs(l, b, m, S, M) {
5999
6003
  {
6000
6004
  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]);
6005
+ m !== void 0 && (ir(m), j = "" + m), Zi(b) && (ir(b.key), j = "" + b.key), Ji(b) && (Y = b.ref, Xi(b, M));
6006
+ for (I in b)
6007
+ Qe.call(b, I) && !Hi.hasOwnProperty(I) && (C[I] = b[I]);
6004
6008
  if (l && l.defaultProps) {
6005
6009
  var x = l.defaultProps;
6006
6010
  for (I in x)
@@ -6016,7 +6020,7 @@ function Bu() {
6016
6020
  var Vt = w.ReactCurrentOwner, ur = w.ReactDebugCurrentFrame;
6017
6021
  function Re(l) {
6018
6022
  if (l) {
6019
- var _ = l._owner, m = gt(l.type, l._source, _ ? _.type : null);
6023
+ var b = l._owner, m = gt(l.type, l._source, b ? b.type : null);
6020
6024
  ur.setExtraStackFrame(m);
6021
6025
  } else
6022
6026
  ur.setExtraStackFrame(null);
@@ -6044,22 +6048,22 @@ Check the render method of \`` + l + "`.";
6044
6048
  var dr = {};
6045
6049
  function ss(l) {
6046
6050
  {
6047
- var _ = cr();
6048
- if (!_) {
6051
+ var b = cr();
6052
+ if (!b) {
6049
6053
  var m = typeof l == "string" ? l : l.displayName || l.name;
6050
- m && (_ = `
6054
+ m && (b = `
6051
6055
 
6052
6056
  Check the top-level render call using <` + m + ">.");
6053
6057
  }
6054
- return _;
6058
+ return b;
6055
6059
  }
6056
6060
  }
6057
- function fr(l, _) {
6061
+ function fr(l, b) {
6058
6062
  {
6059
6063
  if (!l._store || l._store.validated || l.key != null)
6060
6064
  return;
6061
6065
  l._store.validated = !0;
6062
- var m = ss(_);
6066
+ var m = ss(b);
6063
6067
  if (dr[m])
6064
6068
  return;
6065
6069
  dr[m] = !0;
@@ -6067,14 +6071,14 @@ Check the top-level render call using <` + m + ">.");
6067
6071
  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
6072
  }
6069
6073
  }
6070
- function lr(l, _) {
6074
+ function lr(l, b) {
6071
6075
  {
6072
6076
  if (typeof l != "object")
6073
6077
  return;
6074
6078
  if (zt(l))
6075
6079
  for (var m = 0; m < l.length; m++) {
6076
6080
  var S = l[m];
6077
- Bt(S) && fr(S, _);
6081
+ Bt(S) && fr(S, b);
6078
6082
  }
6079
6083
  else if (Bt(l))
6080
6084
  l._store && (l._store.validated = !0);
@@ -6082,39 +6086,39 @@ Check the top-level render call using <` + m + ">.");
6082
6086
  var M = T(l);
6083
6087
  if (typeof M == "function" && M !== l.entries)
6084
6088
  for (var I = M.call(l), C; !(C = I.next()).done; )
6085
- Bt(C.value) && fr(C.value, _);
6089
+ Bt(C.value) && fr(C.value, b);
6086
6090
  }
6087
6091
  }
6088
6092
  }
6089
6093
  function os(l) {
6090
6094
  {
6091
- var _ = l.type;
6092
- if (_ == null || typeof _ == "string")
6095
+ var b = l.type;
6096
+ if (b == null || typeof b == "string")
6093
6097
  return;
6094
6098
  var m;
6095
- if (typeof _ == "function")
6096
- m = _.propTypes;
6097
- else if (typeof _ == "object" && (_.$$typeof === c || // Note: Memo only checks outer props here.
6099
+ if (typeof b == "function")
6100
+ m = b.propTypes;
6101
+ else if (typeof b == "object" && (b.$$typeof === d || // Note: Memo only checks outer props here.
6098
6102
  // Inner props are checked in the reconciler.
6099
- _.$$typeof === h))
6100
- m = _.propTypes;
6103
+ b.$$typeof === h))
6104
+ m = b.propTypes;
6101
6105
  else
6102
6106
  return;
6103
6107
  if (m) {
6104
- var S = G(_);
6108
+ var S = G(b);
6105
6109
  Gi(m, l.props, "prop", S, l);
6106
- } else if (_.PropTypes !== void 0 && !Gt) {
6110
+ } else if (b.PropTypes !== void 0 && !Gt) {
6107
6111
  Gt = !0;
6108
- var M = G(_);
6112
+ var M = G(b);
6109
6113
  v("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", M || "Unknown");
6110
6114
  }
6111
- typeof _.getDefaultProps == "function" && !_.getDefaultProps.isReactClassApproved && v("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
6115
+ 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
6116
  }
6113
6117
  }
6114
6118
  function as(l) {
6115
6119
  {
6116
- for (var _ = Object.keys(l.props), m = 0; m < _.length; m++) {
6117
- var S = _[m];
6120
+ for (var b = Object.keys(l.props), m = 0; m < b.length; m++) {
6121
+ var S = b[m];
6118
6122
  if (S !== "children" && S !== "key") {
6119
6123
  Re(l), v("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", S), Re(null);
6120
6124
  break;
@@ -6124,7 +6128,7 @@ Check the top-level render call using <` + m + ">.");
6124
6128
  }
6125
6129
  }
6126
6130
  var hr = {};
6127
- function pr(l, _, m, S, M, I) {
6131
+ function pr(l, b, m, S, M, I) {
6128
6132
  {
6129
6133
  var C = we(l);
6130
6134
  if (!C) {
@@ -6135,11 +6139,11 @@ Check the top-level render call using <` + m + ">.");
6135
6139
  var x;
6136
6140
  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
6141
  }
6138
- var L = rs(l, _, m, M, I);
6142
+ var L = rs(l, b, m, M, I);
6139
6143
  if (L == null)
6140
6144
  return L;
6141
6145
  if (C) {
6142
- var oe = _.children;
6146
+ var oe = b.children;
6143
6147
  if (oe !== void 0)
6144
6148
  if (S)
6145
6149
  if (zt(oe)) {
@@ -6151,8 +6155,8 @@ Check the top-level render call using <` + m + ">.");
6151
6155
  else
6152
6156
  lr(oe, l);
6153
6157
  }
6154
- if (Qe.call(_, "key")) {
6155
- var Ee = G(l), Z = Object.keys(_).filter(function(hs) {
6158
+ if (Qe.call(b, "key")) {
6159
+ var Ee = G(l), Z = Object.keys(b).filter(function(hs) {
6156
6160
  return hs !== "key";
6157
6161
  }), Qt = Z.length > 0 ? "{key: someKey, " + Z.join(": ..., ") + ": ...}" : "{key: someKey}";
6158
6162
  if (!hr[Ee + Qt]) {
@@ -6168,11 +6172,11 @@ React keys must be passed directly to JSX without using spread:
6168
6172
  return l === i ? as(L) : os(L), L;
6169
6173
  }
6170
6174
  }
6171
- function us(l, _, m) {
6172
- return pr(l, _, m, !0);
6175
+ function us(l, b, m) {
6176
+ return pr(l, b, m, !0);
6173
6177
  }
6174
- function cs(l, _, m) {
6175
- return pr(l, _, m, !1);
6178
+ function cs(l, b, m) {
6179
+ return pr(l, b, m, !1);
6176
6180
  }
6177
6181
  var ds = cs, fs = us;
6178
6182
  Ze.Fragment = i, Ze.jsx = ds, Ze.jsxs = fs;
@@ -6193,8 +6197,8 @@ function Yr(t) {
6193
6197
  function Hu(t, e, n) {
6194
6198
  e && n && "ruleParams" in n && (e = Object.assign({ $$ruleParams: n.ruleParams }, e));
6195
6199
  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();
6200
+ (u) => (s.current = Yr(t._reactor.getPreviousResult(r)), r ? t.subscribeQuery(r, (c) => {
6201
+ s.current = Object.assign({ isLoading: !c, data: void 0, pageInfo: void 0, error: void 0 }, c), u();
6198
6202
  }) : () => {
6199
6203
  }),
6200
6204
  // Build a new subscribe function if the query changes
@@ -6240,8 +6244,8 @@ function tc(t, e = {}) {
6240
6244
  isLoading: !0
6241
6245
  };
6242
6246
  });
6243
- Pe(() => t.core._reactor.subscribePresence(t.type, t.id, e, (c) => {
6244
- s(c);
6247
+ Pe(() => t.core._reactor.subscribePresence(t.type, t.id, e, (d) => {
6248
+ s(d);
6245
6249
  }), [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
6250
  const o = Se((u) => {
6247
6251
  t.core._reactor.publishPresence(t.type, t.id, u);
@@ -6255,28 +6259,28 @@ function rc(t, e, n = {}) {
6255
6259
  const r = Ju(), i = Ae.usePresence(t, {
6256
6260
  keys: [e]
6257
6261
  }), s = sn(() => {
6258
- var d;
6262
+ var c;
6259
6263
  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) => {
6264
+ return n != null && n.writeOnly ? [] : Object.values((c = f == null ? void 0 : f.peers) !== null && c !== void 0 ? c : {}).filter((h) => h[e] === !0);
6265
+ }, [n == null ? void 0 : n.writeOnly, i]), o = Se((c) => {
6262
6266
  var f;
6263
6267
  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, () => {
6268
+ [e]: c
6269
+ }), 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
6270
  t.core._reactor.publishPresence(t.type, t.id, {
6267
6271
  [e]: null
6268
6272
  });
6269
6273
  }));
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");
6274
+ }, [t.type, t.id, e, n == null ? void 0 : n.timeout, r]), a = Se((c) => {
6275
+ const h = !((n == null ? void 0 : n.stopOnEnter) && c.key === "Enter");
6272
6276
  o(h);
6273
6277
  }, [n.stopOnEnter, o]), u = Se(() => {
6274
6278
  o(!1);
6275
- }, [o]), c = sn(() => ({ onKeyDown: a, onBlur: u }), [a, u]);
6279
+ }, [o]), d = sn(() => ({ onKeyDown: a, onBlur: u }), [a, u]);
6276
6280
  return {
6277
6281
  active: s,
6278
6282
  setActive: o,
6279
- inputProps: c
6283
+ inputProps: d
6280
6284
  };
6281
6285
  }
6282
6286
  const Ae = {
@@ -6300,24 +6304,24 @@ var sc = function(t, e, n, r) {
6300
6304
  });
6301
6305
  }
6302
6306
  return new (n || (n = Promise))(function(s, o) {
6303
- function a(d) {
6307
+ function a(c) {
6304
6308
  try {
6305
- c(r.next(d));
6309
+ d(r.next(c));
6306
6310
  } catch (f) {
6307
6311
  o(f);
6308
6312
  }
6309
6313
  }
6310
- function u(d) {
6314
+ function u(c) {
6311
6315
  try {
6312
- c(r.throw(d));
6316
+ d(r.throw(c));
6313
6317
  } catch (f) {
6314
6318
  o(f);
6315
6319
  }
6316
6320
  }
6317
- function c(d) {
6318
- d.done ? s(d.value) : i(d.value).then(a, u);
6321
+ function d(c) {
6322
+ c.done ? s(c.value) : i(c.value).then(a, u);
6319
6323
  }
6320
- c((r = r.apply(t, e || [])).next());
6324
+ d((r = r.apply(t, e || [])).next());
6321
6325
  });
6322
6326
  };
6323
6327
  const oc = {
@@ -6414,8 +6418,8 @@ function uc(t) {
6414
6418
  "`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?"
6415
6419
  );
6416
6420
  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) {
6421
+ let s = "", o = !0, a, u = "", d = "";
6422
+ function c(y) {
6419
6423
  const g = o ? y.replace(/^\xEF\xBB\xBF/, "") : y, [T, w] = cc(`${s}${g}`);
6420
6424
  for (const v of T)
6421
6425
  f(v);
@@ -6441,7 +6445,7 @@ function uc(t) {
6441
6445
  function h(y, g, T) {
6442
6446
  switch (y) {
6443
6447
  case "event":
6444
- c = g;
6448
+ d = g;
6445
6449
  break;
6446
6450
  case "data":
6447
6451
  u = `${u}${g}
@@ -6472,17 +6476,17 @@ function uc(t) {
6472
6476
  function p() {
6473
6477
  u.length > 0 && e({
6474
6478
  id: a,
6475
- event: c || void 0,
6479
+ event: d || void 0,
6476
6480
  // If the data buffer's last character is a U+000A LINE FEED (LF) character,
6477
6481
  // then remove the last character from the data buffer.
6478
6482
  data: u.endsWith(`
6479
6483
  `) ? u.slice(0, -1) : u
6480
- }), a = void 0, u = "", c = "";
6484
+ }), a = void 0, u = "", d = "";
6481
6485
  }
6482
- function b(y = {}) {
6483
- s && y.consume && f(s), o = !0, a = void 0, u = "", c = "", s = "";
6486
+ function _(y = {}) {
6487
+ s && y.consume && f(s), o = !0, a = void 0, u = "", d = "", s = "";
6484
6488
  }
6485
- return { feed: d, reset: b };
6489
+ return { feed: c, reset: _ };
6486
6490
  }
6487
6491
  function cc(t) {
6488
6492
  const e = [];
@@ -6570,17 +6574,17 @@ class jt extends EventTarget {
6570
6574
  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
6575
  var o;
6572
6576
  A(this, Ue).reset();
6573
- const { body: a, redirected: u, status: c, headers: d } = s;
6574
- if (c === 204) {
6577
+ const { body: a, redirected: u, status: d, headers: c } = s;
6578
+ if (d === 204) {
6575
6579
  be(this, ce, nt).call(this, "Server sent HTTP 204, not reconnecting", 204), this.close();
6576
6580
  return;
6577
6581
  }
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);
6582
+ if (u ? $(this, De, new URL(s.url)) : $(this, De, void 0), d !== 200) {
6583
+ be(this, ce, nt).call(this, `Non-200 status code (${d})`, d);
6580
6584
  return;
6581
6585
  }
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);
6586
+ if (!(c.get("content-type") || "").startsWith("text/event-stream")) {
6587
+ be(this, ce, nt).call(this, 'Invalid content type, expected "text/event-stream"', d);
6584
6588
  return;
6585
6589
  }
6586
6590
  if (A(this, ee) === this.CLOSED)
@@ -6588,15 +6592,15 @@ class jt extends EventTarget {
6588
6592
  $(this, ee, this.OPEN);
6589
6593
  const f = new Event("open");
6590
6594
  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();
6595
+ be(this, ce, nt).call(this, "Invalid response body, expected a web ReadableStream", d), this.close();
6592
6596
  return;
6593
6597
  }
6594
6598
  const h = new TextDecoder(), p = a.getReader();
6595
- let b = !0;
6599
+ let _ = !0;
6596
6600
  do {
6597
6601
  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);
6602
+ g && A(this, Ue).feed(h.decode(g, { stream: !y })), y && (_ = !1, A(this, Ue).reset(), be(this, ce, Mn).call(this));
6603
+ } while (_);
6600
6604
  }), K(this, kn, (s) => {
6601
6605
  $(this, ve, void 0), !(s.name === "AbortError" || s.type === "aborted") && be(this, ce, Mn).call(this, En(s));
6602
6606
  }), K(this, Cn, (s) => {
@@ -6792,15 +6796,15 @@ function Tc({
6792
6796
  children: o,
6793
6797
  renderCursor: a,
6794
6798
  propagate: u,
6795
- zIndex: c
6799
+ zIndex: d
6796
6800
  }) {
6797
- const d = e || `cursors-space-default--${String(n.type)}-${n.id}`, f = n.usePresence({
6798
- keys: [d]
6801
+ const c = e || `cursors-space-default--${String(n.type)}-${n.id}`, f = n.usePresence({
6802
+ keys: [c]
6799
6803
  }), h = n._core._reactor.getPresence(n.type, n.id);
6800
6804
  function p(w, v) {
6801
6805
  const P = v.clientX, E = v.clientY, U = (P - w.left) / w.width * 100, F = (E - w.top) / w.height * 100;
6802
6806
  f.publishPresence({
6803
- [d]: {
6807
+ [c]: {
6804
6808
  x: P,
6805
6809
  y: E,
6806
6810
  xPercent: U,
@@ -6809,14 +6813,14 @@ function Tc({
6809
6813
  }
6810
6814
  });
6811
6815
  }
6812
- function b(w) {
6816
+ function _(w) {
6813
6817
  u || w.stopPropagation();
6814
6818
  const v = w.currentTarget.getBoundingClientRect();
6815
6819
  p(v, w);
6816
6820
  }
6817
6821
  function y(w) {
6818
6822
  f.publishPresence({
6819
- [d]: void 0
6823
+ [c]: void 0
6820
6824
  });
6821
6825
  }
6822
6826
  function g(w) {
@@ -6831,13 +6835,13 @@ function Tc({
6831
6835
  }
6832
6836
  function T(w) {
6833
6837
  f.publishPresence({
6834
- [d]: void 0
6838
+ [c]: void 0
6835
6839
  });
6836
6840
  }
6837
6841
  return ps(
6838
6842
  t,
6839
6843
  {
6840
- onMouseMove: b,
6844
+ onMouseMove: _,
6841
6845
  onMouseOut: y,
6842
6846
  onTouchMove: g,
6843
6847
  onTouchEnd: T,
@@ -6855,10 +6859,10 @@ function Tc({
6855
6859
  style: {
6856
6860
  ...ei,
6857
6861
  ...pc,
6858
- zIndex: c !== void 0 ? c : yc
6862
+ zIndex: d !== void 0 ? d : yc
6859
6863
  },
6860
6864
  children: Object.entries(f.peers).map(([w, v]) => {
6861
- const P = v[d];
6865
+ const P = v[c];
6862
6866
  return P ? /* @__PURE__ */ z.jsx(
6863
6867
  "div",
6864
6868
  {
@@ -6877,7 +6881,7 @@ function Tc({
6877
6881
  ) : null;
6878
6882
  })
6879
6883
  },
6880
- d
6884
+ c
6881
6885
  )
6882
6886
  ]
6883
6887
  );