@instantdb/react 0.22.56-experimental.persisted-object-2.19546098511.1 → 0.22.56-experimental.persisted-object-2.19546840155.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.
@@ -48,7 +48,7 @@ const U = {
48
48
  function nt(t, e) {
49
49
  return t instanceof Map ? t.has(e) : Object.prototype.hasOwnProperty.call(t, e);
50
50
  }
51
- function Tr(t, e) {
51
+ function wr(t, e) {
52
52
  if (e in t) {
53
53
  let n = Reflect.getPrototypeOf(t);
54
54
  for (; n; ) {
@@ -232,7 +232,7 @@ function fe(t) {
232
232
  var e;
233
233
  t.assignedMap = (e = t.assignedMap) !== null && e !== void 0 ? e : /* @__PURE__ */ new Map(), t.operated || (t.operated = !0, t.parent && fe(t.parent));
234
234
  }
235
- function wr() {
235
+ function Tr() {
236
236
  throw new Error("Cannot modify frozen object");
237
237
  }
238
238
  function Re(t, e, n, r, i) {
@@ -260,12 +260,12 @@ function Re(t, e, n, r, i) {
260
260
  case 2:
261
261
  for (const [a, u] of t)
262
262
  Re(a, a, n, r, i), Re(u, a, n, r, i);
263
- t.set = t.clear = t.delete = wr;
263
+ t.set = t.clear = t.delete = Tr;
264
264
  break;
265
265
  case 3:
266
266
  for (const a of t)
267
267
  Re(a, a, n, r, i);
268
- t.add = t.clear = t.delete = wr;
268
+ t.add = t.clear = t.delete = Tr;
269
269
  break;
270
270
  case 1:
271
271
  Object.freeze(t);
@@ -670,7 +670,7 @@ const Us = Reflect.ownKeys(Ct), yi = /* @__PURE__ */ new WeakSet(), bi = {
670
670
  return d.bind(t.proxy);
671
671
  }
672
672
  if (!nt(a, e)) {
673
- const d = Tr(a, e);
673
+ const d = wr(a, e);
674
674
  return d ? "value" in d ? d.value : (
675
675
  // !case: support for getter
676
676
  (i = d.get) === null || i === void 0 ? void 0 : i.call(t.proxy)
@@ -701,7 +701,7 @@ const Us = Reflect.ownKeys(Ct), yi = /* @__PURE__ */ new WeakSet(), bi = {
701
701
  let i;
702
702
  if (t.type === 1 && e !== "length" && !(Number.isInteger(i = Number(e)) && i >= 0 && (e === 0 || i === 0 || String(i) === String(e))))
703
703
  throw new Error("Only supports setting array indices and the 'length' property.");
704
- const s = Tr(te(t), e);
704
+ const s = wr(te(t), e);
705
705
  if (s != null && s.set)
706
706
  return s.set.call(t.proxy, n), !0;
707
707
  const o = Ht(te(t), e), a = j(o);
@@ -757,10 +757,10 @@ function Fn(t) {
757
757
  var p, y;
758
758
  const b = j(u);
759
759
  let _ = c.type === 3 ? c.setMap : c.copy;
760
- const w = be(_, r), T = j(w);
761
- if (T) {
762
- let m = T.original;
763
- T.operated && (m = Dn(w)), on(T), an(T, at, f, l), c.options.enableAutoFreeze && (c.options.updatedValues = (p = c.options.updatedValues) !== null && p !== void 0 ? p : /* @__PURE__ */ new WeakMap(), c.options.updatedValues.set(m, T.original)), ut(_, r, m);
760
+ const T = be(_, r), w = j(T);
761
+ if (w) {
762
+ let m = w.original;
763
+ w.operated && (m = Dn(T)), on(w), an(w, at, f, l), c.options.enableAutoFreeze && (c.options.updatedValues = (p = c.options.updatedValues) !== null && p !== void 0 ? p : /* @__PURE__ */ new WeakMap(), c.options.updatedValues.set(m, w.original)), ut(_, r, m);
764
764
  }
765
765
  (y = b.callbacks) === null || y === void 0 || y.forEach((m) => {
766
766
  m(f, l);
@@ -890,47 +890,47 @@ const Ns = (t) => function e(n, r, i) {
890
890
  };
891
891
  if (!ae(f, _) && typeof f == "object" && f !== null)
892
892
  throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");
893
- const [w, T] = Fs(f, _);
893
+ const [T, w] = Fs(f, _);
894
894
  if (typeof r != "function") {
895
895
  if (!ae(f, _))
896
896
  throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");
897
- return [w, T];
897
+ return [T, w];
898
898
  }
899
899
  let m;
900
900
  try {
901
- m = d(w);
901
+ m = d(T);
902
902
  } catch (S) {
903
- throw sn(j(w)), S;
903
+ throw sn(j(T)), S;
904
904
  }
905
905
  const E = (S) => {
906
- const I = j(w);
906
+ const I = j(T);
907
907
  if (!Ce(S)) {
908
- if (S !== void 0 && !ye(S, w) && (I != null && I.operated))
908
+ if (S !== void 0 && !ye(S, T) && (I != null && I.operated))
909
909
  throw new Error("Either the value is returned as a new non-draft value, or only the draft is modified without returning any value.");
910
910
  const q = S == null ? void 0 : S[js];
911
911
  if (q) {
912
- const we = q[0];
912
+ const Te = q[0];
913
913
  return _.strict && typeof S == "object" && S !== null && cn({
914
914
  rootDraft: I,
915
915
  value: S,
916
916
  useRawReturn: !0
917
- }), T([we]);
917
+ }), w([Te]);
918
918
  }
919
919
  if (S !== void 0)
920
- return typeof S == "object" && S !== null && cn({ rootDraft: I, value: S }), T([S]);
920
+ return typeof S == "object" && S !== null && cn({ rootDraft: I, value: S }), w([S]);
921
921
  }
922
- if (S === w || S === void 0)
923
- return T([]);
922
+ if (S === T || S === void 0)
923
+ return w([]);
924
924
  const x = j(S);
925
925
  if (_ === x.options) {
926
926
  if (x.operated)
927
927
  throw new Error("Cannot return a modified child draft.");
928
- return T([vr(S)]);
928
+ return w([vr(S)]);
929
929
  }
930
- return T([S]);
930
+ return w([S]);
931
931
  };
932
932
  return m instanceof Promise ? m.then(E, (S) => {
933
- throw sn(j(w)), S;
933
+ throw sn(j(T)), S;
934
934
  }) : E(m);
935
935
  }, Pt = Ns();
936
936
  Object.prototype.constructor.toString();
@@ -952,7 +952,7 @@ function Nn(t) {
952
952
  r !== void 0 && (e[n] = r);
953
953
  return e;
954
954
  }
955
- function Ti(t, e) {
955
+ function wi(t, e) {
956
956
  if (!Ze(t) || !Ze(e))
957
957
  return e;
958
958
  const n = Object.assign({}, t);
@@ -964,7 +964,7 @@ function Ti(t, e) {
964
964
  continue;
965
965
  }
966
966
  const i = Ze(t[r]) && Ze(e[r]);
967
- n[r] = i ? Ti(t[r], e[r]) : e[r];
967
+ n[r] = i ? wi(t[r], e[r]) : e[r];
968
968
  }
969
969
  return n;
970
970
  }
@@ -992,7 +992,7 @@ function Or(t, e, n) {
992
992
  }
993
993
  r[e[e.length - 1]] = n;
994
994
  }
995
- function wi(t, e) {
995
+ function Ti(t, e) {
996
996
  if (!t || e.length === 0)
997
997
  return;
998
998
  const [n, ...r] = e;
@@ -1001,7 +1001,7 @@ function wi(t, e) {
1001
1001
  Array.isArray(t) ? t.splice(n, 1) : delete t[n];
1002
1002
  return;
1003
1003
  }
1004
- wi(t[n], r), qs(t[n]) && delete t[n];
1004
+ Ti(t[n], r), qs(t[n]) && delete t[n];
1005
1005
  }
1006
1006
  }
1007
1007
  function qs(t) {
@@ -1209,9 +1209,9 @@ function zs(t) {
1209
1209
  function Vs(t) {
1210
1210
  return /* @__PURE__ */ new Date(t + "Z");
1211
1211
  }
1212
- const Gs = /^(\d+)[\./-](\d+)[\./-](\d+)$/;
1213
- function Bs(t) {
1214
- const e = t.match(Gs);
1212
+ const Bs = /^(\d+)[\./-](\d+)[\./-](\d+)$/;
1213
+ function Gs(t) {
1214
+ const e = t.match(Bs);
1215
1215
  if (!e)
1216
1216
  return null;
1217
1217
  const [n, r, i, s] = e;
@@ -1270,7 +1270,7 @@ function to(t) {
1270
1270
  return new Date(i.getTime() - r * 1e3);
1271
1271
  }
1272
1272
  const no = [
1273
- Bs,
1273
+ Gs,
1274
1274
  Hs,
1275
1275
  Js,
1276
1276
  Xs,
@@ -1475,7 +1475,7 @@ function uo(t, e) {
1475
1475
  const d = (n = u.values().next()) === null || n === void 0 ? void 0 : n.value;
1476
1476
  if (!d)
1477
1477
  return;
1478
- const c = d[2], f = Ti(c, o), l = [
1478
+ const c = d[2], f = wi(c, o), l = [
1479
1479
  i,
1480
1480
  s,
1481
1481
  f,
@@ -1506,8 +1506,8 @@ function fn(t, e) {
1506
1506
  const d = t.vae.get(a) && X(t.vae.get(a), 2);
1507
1507
  d && d.forEach((c) => {
1508
1508
  var f, l, p;
1509
- const [y, b, _] = c, w = t.attrs[b];
1510
- (!s || !w || ((f = w["reverse-identity"]) === null || f === void 0 ? void 0 : f[1]) === s) && (oe(t.eav, [y, b, _]), oe(t.aev, [b, y, _]), oe(t.vae, [_, b, y])), w && w["on-delete"] === "cascade" && ((l = w["reverse-identity"]) === null || l === void 0 ? void 0 : l[1]) === s && fn(t, [y, (p = w["forward-identity"]) === null || p === void 0 ? void 0 : p[1]]);
1509
+ const [y, b, _] = c, T = t.attrs[b];
1510
+ (!s || !T || ((f = T["reverse-identity"]) === null || f === void 0 ? void 0 : f[1]) === s) && (oe(t.eav, [y, b, _]), oe(t.aev, [b, y, _]), oe(t.vae, [_, b, y])), T && T["on-delete"] === "cascade" && ((l = T["reverse-identity"]) === null || l === void 0 ? void 0 : l[1]) === s && fn(t, [y, (p = T["forward-identity"]) === null || p === void 0 ? void 0 : p[1]]);
1511
1511
  }), ((r = t.vae.get(a)) === null || r === void 0 ? void 0 : r.size) === 0 && oe(t.vae, [a]);
1512
1512
  }
1513
1513
  function ji(t, e) {
@@ -1671,7 +1671,7 @@ function bo(t, e, n) {
1671
1671
  }
1672
1672
  return i;
1673
1673
  }
1674
- function Te(t, e, n) {
1674
+ function we(t, e, n) {
1675
1675
  var r;
1676
1676
  return (r = t.attrIndexes.forwardIdents.get(e)) === null || r === void 0 ? void 0 : r.get(n);
1677
1677
  }
@@ -1695,7 +1695,7 @@ function go(t, e) {
1695
1695
  if (We(t.attrs, i))
1696
1696
  return ze(t.eav, [r, i]);
1697
1697
  }
1698
- function To(t, e) {
1698
+ function wo(t, e) {
1699
1699
  const n = e.filter(([r, i, s, o, a]) => {
1700
1700
  if (r !== "add-triple" && r !== "deep-merge-triple")
1701
1701
  return !0;
@@ -1716,7 +1716,7 @@ function To(t, e) {
1716
1716
  });
1717
1717
  });
1718
1718
  }
1719
- function wo(t) {
1719
+ function To(t) {
1720
1720
  return typeof t == "string" && t.startsWith("?");
1721
1721
  }
1722
1722
  function mo(t, e, n) {
@@ -1770,7 +1770,7 @@ function ln(t, e, n = [{}]) {
1770
1770
  return e.reduce((r, i) => ko(t, i, r), n);
1771
1771
  }
1772
1772
  function zn(t, e) {
1773
- return Array.isArray(e) ? e.map((n) => zn(t, n)) : wo(e) ? t[e] : e;
1773
+ return Array.isArray(e) ? e.map((n) => zn(t, n)) : To(e) ? t[e] : e;
1774
1774
  }
1775
1775
  function jo(t, { find: e, where: n }) {
1776
1776
  return ln(t, n).map((i) => zn(i, e));
@@ -1876,7 +1876,7 @@ function zo(t, e, n) {
1876
1876
  return t.map((r) => r === e ? n : r);
1877
1877
  }
1878
1878
  function Ri(t, e, n, r, i) {
1879
- const s = Te(e, n, i), o = Pi(e, n, i), a = s || o;
1879
+ const s = we(e, n, i), o = Pi(e, n, i), a = s || o;
1880
1880
  if (!a)
1881
1881
  throw new Ke(`Could not find attr for ${[n, i]}`);
1882
1882
  if (a["value-type"] !== "ref")
@@ -1964,12 +1964,12 @@ function Vo(t, e) {
1964
1964
  }
1965
1965
  return e;
1966
1966
  }
1967
- function Go(t, e, n, r, i, s) {
1968
- const o = Te(e, n, i), a = Pi(e, n, i), u = o || a;
1967
+ function Bo(t, e, n, r, i, s) {
1968
+ const o = we(e, n, i), a = Pi(e, n, i), u = o || a;
1969
1969
  if (!u)
1970
1970
  throw new Ke(`No attr for etype = ${n} label = ${i}`);
1971
1971
  if (s != null && s.hasOwnProperty("$isNull")) {
1972
- const d = Te(e, n, "id");
1972
+ const d = we(e, n, "id");
1973
1973
  if (!d)
1974
1974
  throw new Ke(`No attr for etype = ${n} label = id`);
1975
1975
  return [
@@ -1986,7 +1986,7 @@ function Go(t, e, n, r, i, s) {
1986
1986
  rt("time")
1987
1987
  ] : [s, u.id, t(n, r), rt("time")];
1988
1988
  }
1989
- function Bo(t, e, n, r, i) {
1989
+ function Go(t, e, n, r, i) {
1990
1990
  const [s, o, a] = i.reduce((u, d) => {
1991
1991
  const [c, f, l] = u, [p, y, b] = Ri(t, e, c, f, d);
1992
1992
  return [p, y, [...l, b]];
@@ -1994,7 +1994,7 @@ function Bo(t, e, n, r, i) {
1994
1994
  return [s, o, a];
1995
1995
  }
1996
1996
  function hn(t, e, n, r, i, s) {
1997
- const o = i.slice(0, i.length - 1), a = i[i.length - 1], [u, d, c] = Bo(t, e, n, r, o), f = Go(t, e, u, d, a, s);
1997
+ const o = i.slice(0, i.length - 1), a = i[i.length - 1], [u, d, c] = Go(t, e, n, r, o), f = Bo(t, e, u, d, a, s);
1998
1998
  return c.concat([f]);
1999
1999
  }
2000
2000
  function Qo(t, e) {
@@ -2076,17 +2076,17 @@ function na(t, e, { etype: n, level: r, form: i }, s) {
2076
2076
  var p, y, b;
2077
2077
  const _ = !!(e.cardinalityInference && (!((b = (y = (p = e.linkIndex) === null || p === void 0 ? void 0 : p[n]) === null || y === void 0 ? void 0 : y[l]) === null || b === void 0) && b.isSingular));
2078
2078
  try {
2079
- const [w, T, m] = ta(t, e, n, r, l, u), E = Di(e, {
2080
- etype: w,
2081
- level: T,
2079
+ const [T, w, m] = ta(t, e, n, r, l, u), E = Di(e, {
2080
+ etype: T,
2081
+ level: w,
2082
2082
  form: i[l],
2083
2083
  join: m
2084
2084
  }), S = _ ? E[0] : E;
2085
2085
  return { [l]: S };
2086
- } catch (w) {
2087
- if (w instanceof Ke)
2086
+ } catch (T) {
2087
+ if (T instanceof Ke)
2088
2088
  return { [l]: _ ? void 0 : [] };
2089
- throw w;
2089
+ throw T;
2090
2090
  }
2091
2091
  }).reduce(function(l, p) {
2092
2092
  return Object.assign(Object.assign({}, l), p);
@@ -2119,7 +2119,7 @@ function sa(t, e) {
2119
2119
  }
2120
2120
  function oa(t, e, n) {
2121
2121
  const r = Object.keys(n)[0];
2122
- return Te(t, e, r);
2122
+ return we(t, e, r);
2123
2123
  }
2124
2124
  function aa(t, e, n, r) {
2125
2125
  if (n)
@@ -2133,11 +2133,11 @@ function ua(t, e, n) {
2133
2133
  return _o(t, e);
2134
2134
  const s = /* @__PURE__ */ new Map();
2135
2135
  for (const o of n.fields) {
2136
- const a = Te(t, e, o), u = (r = a == null ? void 0 : a["forward-identity"]) === null || r === void 0 ? void 0 : r[2];
2136
+ const a = we(t, e, o), u = (r = a == null ? void 0 : a["forward-identity"]) === null || r === void 0 ? void 0 : r[2];
2137
2137
  u && qn(a) && s.set(u, a);
2138
2138
  }
2139
2139
  if (!s.has("id")) {
2140
- const o = Te(t, e, "id"), a = (i = o == null ? void 0 : o["forward-identity"]) === null || i === void 0 ? void 0 : i[2];
2140
+ const o = we(t, e, "id"), a = (i = o == null ? void 0 : o["forward-identity"]) === null || i === void 0 ? void 0 : i[2];
2141
2141
  a && s.set(a, o);
2142
2142
  }
2143
2143
  return s;
@@ -2149,16 +2149,16 @@ function ca(t, { etype: e, pageInfo: n, dq: r, form: i }) {
2149
2149
  const f = n == null ? void 0 : n["start-cursor"], l = aa(t, e, f, a);
2150
2150
  if (l && ((o = l == null ? void 0 : l["forward-identity"]) === null || o === void 0 ? void 0 : o[2]) !== "id") {
2151
2151
  const b = l["checked-data-type"] === "date", _ = l.id;
2152
- c = c.map(([w]) => {
2153
- var T, m, E, S, I;
2154
- let x = (I = (S = (E = (m = (T = t.eav.get(w)) === null || T === void 0 ? void 0 : T.get(_)) === null || m === void 0 ? void 0 : m.values()) === null || E === void 0 ? void 0 : E.next()) === null || S === void 0 ? void 0 : S.value) === null || I === void 0 ? void 0 : I[2];
2155
- return b && (x = pn(x)), [w, x];
2152
+ c = c.map(([T]) => {
2153
+ var w, m, E, S, I;
2154
+ let x = (I = (S = (E = (m = (w = t.eav.get(T)) === null || w === void 0 ? void 0 : w.get(_)) === null || m === void 0 ? void 0 : m.values()) === null || E === void 0 ? void 0 : E.next()) === null || S === void 0 ? void 0 : S.value) === null || I === void 0 ? void 0 : I[2];
2155
+ return b && (x = pn(x)), [T, x];
2156
2156
  });
2157
2157
  }
2158
- c.sort(d === "asc" ? function(_, w) {
2159
- return It(_, w, l == null ? void 0 : l["checked-data-type"]);
2160
- } : function(_, w) {
2161
- return It(w, _, l == null ? void 0 : l["checked-data-type"]);
2158
+ c.sort(d === "asc" ? function(_, T) {
2159
+ return It(_, T, l == null ? void 0 : l["checked-data-type"]);
2160
+ } : function(_, T) {
2161
+ return It(T, _, l == null ? void 0 : l["checked-data-type"]);
2162
2162
  });
2163
2163
  let p = {};
2164
2164
  const y = ua(t, e, r);
@@ -2166,8 +2166,8 @@ function ca(t, { etype: e, pageInfo: n, dq: r, form: i }) {
2166
2166
  const [_] = b;
2167
2167
  if (p[_] || !u && f && l && ia(f, l, d, b))
2168
2168
  continue;
2169
- const w = bo(t, y, _);
2170
- w && (p[_] = w);
2169
+ const T = bo(t, y, _);
2170
+ T && (p[_] = T);
2171
2171
  }
2172
2172
  return p;
2173
2173
  }
@@ -2319,7 +2319,7 @@ function ga(t, e) {
2319
2319
  }
2320
2320
  return i;
2321
2321
  }
2322
- function G(t, e, n) {
2322
+ function B(t, e, n) {
2323
2323
  return Object.values(t).find((r) => {
2324
2324
  const [i, s, o] = r["forward-identity"];
2325
2325
  return s === e && o === n;
@@ -2334,7 +2334,7 @@ function ke(t, e, n) {
2334
2334
  return o === e && a === n;
2335
2335
  });
2336
2336
  }
2337
- function Ta(t) {
2337
+ function wa(t) {
2338
2338
  if (Array.isArray(t))
2339
2339
  return t;
2340
2340
  const e = Object.entries(t);
@@ -2345,7 +2345,7 @@ function Ta(t) {
2345
2345
  function bn(t, e, n) {
2346
2346
  return n.indexOf(".") !== -1 && // attr names can have `.` in them, so use the attr we find with a `.`
2347
2347
  // before assuming it's a ref lookup.
2348
- !G(t, e, n);
2348
+ !B(t, e, n);
2349
2349
  }
2350
2350
  function _n(t) {
2351
2351
  const [e, n, ...r] = t.split(".");
@@ -2353,22 +2353,22 @@ function _n(t) {
2353
2353
  throw new Error(`${t} is not a valid lookup attribute.`);
2354
2354
  return e;
2355
2355
  }
2356
- function wa(t, e, n) {
2356
+ function Ta(t, e, n) {
2357
2357
  if (!bn(t, e, n))
2358
- return G(t, e, n);
2359
- const r = _n(n), i = G(t, e, r) || ke(t, e, r);
2358
+ return B(t, e, n);
2359
+ const r = _n(n), i = B(t, e, r) || ke(t, e, r);
2360
2360
  if (i && i["value-type"] !== "ref")
2361
2361
  throw new Error(`${n} does not reference a valid link attribute.`);
2362
2362
  return i;
2363
2363
  }
2364
2364
  function gn(t) {
2365
- return typeof t == "string" && !Mt(t) ? null : typeof t == "string" && Mt(t) ? Li(t) : Ta(t);
2365
+ return typeof t == "string" && !Mt(t) ? null : typeof t == "string" && Mt(t) ? Li(t) : wa(t);
2366
2366
  }
2367
2367
  function ee(t, e, n) {
2368
2368
  const r = gn(n);
2369
2369
  if (r === null)
2370
2370
  return n;
2371
- const [i, s] = r, o = wa(t, e, i);
2371
+ const [i, s] = r, o = Ta(t, e, i);
2372
2372
  if (!o || !o["unique?"])
2373
2373
  throw new Error(`${i} is not a unique attribute.`);
2374
2374
  return [o.id, s];
@@ -2378,13 +2378,13 @@ function Fi(t, e, n, r) {
2378
2378
  return Array.isArray(i) ? [[
2379
2379
  "add-triple",
2380
2380
  i,
2381
- G(t, e, "id").id,
2381
+ B(t, e, "id").id,
2382
2382
  i
2383
2383
  ]].concat(r) : r;
2384
2384
  }
2385
2385
  function ma({ attrs: t }, [e, n, r]) {
2386
2386
  const i = Object.entries(r).flatMap(([s, o]) => {
2387
- const a = Array.isArray(o) ? o : [o], u = G(t, e, s), d = ke(t, e, s);
2387
+ const a = Array.isArray(o) ? o : [o], u = B(t, e, s), d = ke(t, e, s);
2388
2388
  return a.map((c) => u ? [
2389
2389
  "add-triple",
2390
2390
  ee(t, e, n),
@@ -2401,7 +2401,7 @@ function ma({ attrs: t }, [e, n, r]) {
2401
2401
  }
2402
2402
  function va({ attrs: t }, [e, n, r]) {
2403
2403
  const i = Object.entries(r).flatMap(([s, o]) => {
2404
- const a = Array.isArray(o) ? o : [o], u = G(t, e, s), d = ke(t, e, s);
2404
+ const a = Array.isArray(o) ? o : [o], u = B(t, e, s), d = ke(t, e, s);
2405
2405
  return a.map((c) => u ? [
2406
2406
  "retract-triple",
2407
2407
  ee(t, e, n),
@@ -2444,14 +2444,14 @@ function Ni({ stores: t, attrs: e }, [n, r, i, s]) {
2444
2444
  function Oa(t, e) {
2445
2445
  const { stores: n, attrs: r } = t, [i, s, o, a] = e, u = Nn(o), d = ee(r, i, s);
2446
2446
  return [["id", d]].concat(Object.entries(u)).map(([f, l]) => {
2447
- const p = G(r, i, f);
2447
+ const p = B(r, i, f);
2448
2448
  return p["checked-data-type"] === "date" && t.useDateObjects && (l = xt(l)), ["add-triple", d, p.id, l, { mode: "create" }];
2449
2449
  });
2450
2450
  }
2451
2451
  function Ea(t, e) {
2452
2452
  const { stores: n, attrs: r } = t, [i, s, o, a] = e, u = Nn(o), d = ee(r, i, s), c = Ni(t, [i, d, o, a]);
2453
2453
  return [["id", d]].concat(Object.entries(u)).map(([l, p]) => {
2454
- const y = G(r, i, l);
2454
+ const y = B(r, i, l);
2455
2455
  return y["checked-data-type"] === "date" && t.useDateObjects && (p = xt(p)), [
2456
2456
  "add-triple",
2457
2457
  d,
@@ -2466,7 +2466,7 @@ function Aa({ attrs: t }, [e, n]) {
2466
2466
  }
2467
2467
  function ka(t, e) {
2468
2468
  const { stores: n, attrs: r } = t, [i, s, o, a] = e, u = Nn(o), d = ee(r, i, s), c = Ni(t, [i, d, o, a]), f = Object.entries(u).map(([p, y]) => {
2469
- const b = G(r, i, p);
2469
+ const b = B(r, i, p);
2470
2470
  return [
2471
2471
  "deep-merge-triple",
2472
2472
  d,
@@ -2478,7 +2478,7 @@ function ka(t, e) {
2478
2478
  return [[
2479
2479
  "add-triple",
2480
2480
  d,
2481
- G(r, i, "id").id,
2481
+ B(r, i, "id").id,
2482
2482
  d,
2483
2483
  ...c ? [c] : []
2484
2484
  ]].concat(f);
@@ -2572,7 +2572,7 @@ const $a = /* @__PURE__ */ new Set(["create", "update", "merge", "link", "unlink
2572
2572
  "merge",
2573
2573
  "delete",
2574
2574
  "ruleParams"
2575
- ]), Tn = { "unique?": !0, "index?": !0 }, Fa = Object.assign(Object.assign({}, Tn), { cardinality: "one" });
2575
+ ]), wn = { "unique?": !0, "index?": !0 }, Fa = Object.assign(Object.assign({}, wn), { cardinality: "one" });
2576
2576
  function Na(t) {
2577
2577
  const e = [], [n, r, i, s] = t;
2578
2578
  if (!La.has(n))
@@ -2602,7 +2602,7 @@ function Ka({ attrs: t, schema: e }, n) {
2602
2602
  f != null && f.isUnsynced && !s.has(f.id) && (a.push(["add-attr", f]), s.add(f.id));
2603
2603
  }
2604
2604
  function c(f, l) {
2605
- const p = G(o, f, l), y = ke(o, f, l);
2605
+ const p = B(o, f, l), y = ke(o, f, l);
2606
2606
  d(p), d(y), !p && !y && u(Rr(e, f, l, Fa));
2607
2607
  }
2608
2608
  for (const f of n)
@@ -2610,32 +2610,32 @@ function Ka({ attrs: t, schema: e }, n) {
2610
2610
  const b = p[0];
2611
2611
  if (y) {
2612
2612
  c(l, y);
2613
- const _ = G(o, l, y), w = ke(o, l, y);
2614
- d(_), d(w);
2615
- const T = ((r = _ == null ? void 0 : _["reverse-identity"]) === null || r === void 0 ? void 0 : r[1]) || ((i = w == null ? void 0 : w["forward-identity"]) === null || i === void 0 ? void 0 : i[1]) || y;
2616
- if (bn(o, T, b))
2617
- c(T, _n(b));
2613
+ const _ = B(o, l, y), T = ke(o, l, y);
2614
+ d(_), d(T);
2615
+ const w = ((r = _ == null ? void 0 : _["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]) || y;
2616
+ if (bn(o, w, b))
2617
+ c(w, _n(b));
2618
2618
  else {
2619
- const m = G(o, T, b);
2620
- m || u(gt(e, T, b, Tn)), d(m);
2619
+ const m = B(o, w, b);
2620
+ m || u(gt(e, w, b, wn)), d(m);
2621
2621
  }
2622
2622
  } else if (bn(o, l, b))
2623
2623
  c(l, _n(b));
2624
2624
  else {
2625
- const _ = G(o, l, b);
2626
- _ || u(gt(e, l, b, Tn)), d(_);
2625
+ const _ = B(o, l, b);
2626
+ _ || u(gt(e, l, b, wn)), d(_);
2627
2627
  }
2628
2628
  }
2629
2629
  for (const f of n) {
2630
2630
  const [l, p, y, b] = f;
2631
2631
  if ($a.has(l)) {
2632
- const _ = G(o, p, "id");
2632
+ const _ = B(o, p, "id");
2633
2633
  d(_), _ || u(gt(e, p, "id", { "unique?": !0 }));
2634
- for (const w of Object.keys(b)) {
2635
- const T = G(o, p, w);
2636
- if (d(T), Ua.has(l) && (T || u(gt(e, p, w, w === "id" ? { "unique?": !0 } : null))), Da.has(l)) {
2637
- const m = ke(o, p, w);
2638
- !T && !m && u(Rr(e, p, w)), d(m);
2634
+ for (const T of Object.keys(b)) {
2635
+ const w = B(o, p, T);
2636
+ if (d(w), Ua.has(l) && (w || u(gt(e, p, T, T === "id" ? { "unique?": !0 } : null))), Da.has(l)) {
2637
+ const m = ke(o, p, T);
2638
+ !w && !m && u(Rr(e, p, T)), d(m);
2639
2639
  }
2640
2640
  }
2641
2641
  }
@@ -2681,7 +2681,7 @@ class Wa {
2681
2681
  constructor(e, n) {
2682
2682
  }
2683
2683
  }
2684
- class wn {
2684
+ class Tn {
2685
2685
  constructor(e) {
2686
2686
  var n, r;
2687
2687
  this._subs = [], this._nextSave = null, this._nextGc = null, this._pendingSaveKeys = /* @__PURE__ */ new Set(), this._loadedKeys = /* @__PURE__ */ new Set(), this._version = 0, this._meta = {
@@ -2819,6 +2819,8 @@ class wn {
2819
2819
  }
2820
2820
  _gc() {
2821
2821
  return de(this, void 0, void 0, function* () {
2822
+ if (!this._gcOpts)
2823
+ return;
2822
2824
  const e = new Set(yield this._persister.getAllKeys());
2823
2825
  e.delete(it);
2824
2826
  const n = new Set(Object.keys(this.currentValue));
@@ -2948,12 +2950,12 @@ var pe = function(t, e, n, r) {
2948
2950
  });
2949
2951
  };
2950
2952
  const za = 6, Va = ["kv", "querySubs", "syncSubs"];
2951
- function Ga(t) {
2953
+ function Ba(t) {
2952
2954
  return function(n) {
2953
2955
  console.error("Error in IndexedDB event", { source: t, event: n });
2954
2956
  };
2955
2957
  }
2956
- function Ba(t) {
2958
+ function Ga(t) {
2957
2959
  return pe(this, void 0, void 0, function* () {
2958
2960
  return new Promise((e) => {
2959
2961
  const n = indexedDB.open(t);
@@ -2983,15 +2985,15 @@ function Qa(t, e, n) {
2983
2985
  for (const [y, b] of Object.entries(r)) {
2984
2986
  const _ = typeof b == "string" ? JSON.parse(b) : b;
2985
2987
  if (_.lastAccessed) {
2986
- const T = {
2988
+ const w = {
2987
2989
  createdAt: _.lastAccessed,
2988
2990
  updatedAt: _.lastAccessed,
2989
2991
  size: (c = (d = (u = (a = _.result) === null || a === void 0 ? void 0 : a.store) === null || u === void 0 ? void 0 : u.triples) === null || d === void 0 ? void 0 : d.length) !== null && c !== void 0 ? c : 0
2990
2992
  };
2991
- f[y] = T;
2993
+ f[y] = w;
2992
2994
  }
2993
- const w = n.put(_, y);
2994
- i.add(w);
2995
+ const T = n.put(_, y);
2996
+ i.add(T);
2995
2997
  }
2996
2998
  const l = { objects: f }, p = n.put(l, it);
2997
2999
  i.add(p);
@@ -3014,7 +3016,7 @@ function $r(t, e, n) {
3014
3016
  }
3015
3017
  function Ha(t, e) {
3016
3018
  return pe(this, void 0, void 0, function* () {
3017
- const n = yield Ba(`instant_${t}_5`);
3019
+ const n = yield Ga(`instant_${t}_5`);
3018
3020
  if (!n)
3019
3021
  return;
3020
3022
  const r = yield new Promise((c, f) => {
@@ -3026,8 +3028,8 @@ function Ha(t, e) {
3026
3028
  y.onsuccess = () => {
3027
3029
  const _ = y.result;
3028
3030
  if (_) {
3029
- const w = _.key, T = _.value;
3030
- b.push([w, T]), _.continue();
3031
+ const T = _.key, w = _.value;
3032
+ b.push([T, w]), _.continue();
3031
3033
  } else
3032
3034
  c(b);
3033
3035
  }, y.onerror = (_) => {
@@ -3074,7 +3076,7 @@ class Ki extends Wa {
3074
3076
  const a = s.target.result;
3075
3077
  if (r) {
3076
3078
  const u = Ha(this._appId, a).catch((d) => {
3077
- Ga("Error upgrading store from version 5 to 6.")(d);
3079
+ Ba("Error upgrading store from version 5 to 6.")(d);
3078
3080
  });
3079
3081
  Dr.set(this.dbName, u), u.then(() => e(a)).catch(() => e(a));
3080
3082
  } else {
@@ -3153,7 +3155,7 @@ class Ki extends Wa {
3153
3155
  return pe(this, void 0, void 0, function* () {
3154
3156
  const e = yield this._dbPromise;
3155
3157
  return new Promise((n, r) => {
3156
- const o = e.transaction([this._storeName], "readwrite").objectStore(this._storeName).getAllKeys();
3158
+ const o = e.transaction([this._storeName], "readonly").objectStore(this._storeName).getAllKeys();
3157
3159
  o.onerror = (a) => {
3158
3160
  r(a);
3159
3161
  }, o.onsuccess = (a) => {
@@ -3468,8 +3470,8 @@ function uu(t) {
3468
3470
  return s;
3469
3471
  });
3470
3472
  }
3471
- let Gn = !1, Wi = !1, zi = !1;
3472
- typeof window < "u" && typeof window.localStorage < "u" && (Gn = !!window.localStorage.getItem("devBackend"), Wi = !!window.localStorage.getItem("__instantLogging"), zi = !!window.localStorage.getItem("__devtoolLocalDash"));
3473
+ let Bn = !1, Wi = !1, zi = !1;
3474
+ typeof window < "u" && typeof window.localStorage < "u" && (Bn = !!window.localStorage.getItem("devBackend"), Wi = !!window.localStorage.getItem("__instantLogging"), zi = !!window.localStorage.getItem("__devtoolLocalDash"));
3473
3475
  function Lr(t, e) {
3474
3476
  if (!e)
3475
3477
  return t;
@@ -3544,7 +3546,7 @@ function Kr(t) {
3544
3546
  }, e;
3545
3547
  }, {});
3546
3548
  }
3547
- const Bn = "v0.22.56-experimental.persisted-object-2.19546098511.1";
3549
+ const Gn = "v0.22.56-experimental.persisted-object-2.19546840155.1";
3548
3550
  function fu(t, e) {
3549
3551
  return {
3550
3552
  info: t ? (...n) => console.info(...n, e()) : () => {
@@ -3629,7 +3631,7 @@ const qr = [
3629
3631
  "before",
3630
3632
  "fields",
3631
3633
  "aggregate"
3632
- ], lu = (t) => t.valueType || "unknown", Gi = (t, e, n = !1) => {
3634
+ ], lu = (t) => t.valueType || "unknown", Bi = (t, e, n = !1) => {
3633
3635
  if (n || t == null)
3634
3636
  return !0;
3635
3637
  switch (e) {
@@ -3646,7 +3648,7 @@ const qr = [
3646
3648
  }
3647
3649
  }, hu = (t, e, n, r, i, s, o) => {
3648
3650
  const a = s.valueType === "json", u = (d, c, f) => {
3649
- if (!Gi(f, c, a))
3651
+ if (!Bi(f, c, a))
3650
3652
  throw new R(`Invalid value for operator '${d}' on attribute '${r}' in entity '${i}'. Expected ${c}, but received: ${typeof f}`, o);
3651
3653
  };
3652
3654
  switch (t) {
@@ -3684,7 +3686,7 @@ const qr = [
3684
3686
  const u = t;
3685
3687
  for (const [d, c] of Object.entries(u))
3686
3688
  hu(d, c, s, e, r, n, `${i}.${d}`);
3687
- } else if (!Gi(t, s, o))
3689
+ } else if (!Bi(t, s, o))
3688
3690
  throw new R(`Invalid value for attribute '${e}' in entity '${r}'. Expected ${s}, but received: ${typeof t}`, i);
3689
3691
  }, pu = (t, e, n, r, i) => {
3690
3692
  const s = t.split(".");
@@ -3723,12 +3725,12 @@ const qr = [
3723
3725
  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);
3724
3726
  }
3725
3727
  Le(e, t, d, n, i);
3726
- }, Bi = (t, e, n, r) => {
3728
+ }, Gi = (t, e, n, r) => {
3727
3729
  for (const [i, s] of Object.entries(t)) {
3728
3730
  if (i === "or" || i === "and") {
3729
3731
  if (Array.isArray(s))
3730
3732
  for (const d of s)
3731
- typeof d == "object" && d !== null && Bi(d, e, n, `${r}.${i}[${d}]`);
3733
+ typeof d == "object" && d !== null && Gi(d, e, n, `${r}.${i}[${d}]`);
3732
3734
  continue;
3733
3735
  }
3734
3736
  if (i === "id") {
@@ -3774,7 +3776,7 @@ const qr = [
3774
3776
  if (t.where && n) {
3775
3777
  if (typeof t.where != "object" || t.where === null)
3776
3778
  throw new R(`'where' clause must be an object in entity '${e}', but received: ${typeof t.where}`, r ? `${r}.where` : void 0);
3777
- Bi(t.where, e, n, r ? `${r}.where` : "where");
3779
+ Gi(t.where, e, n, r ? `${r}.where` : "where");
3778
3780
  }
3779
3781
  }, Qi = (t, e, n, r, i = 0) => {
3780
3782
  var s;
@@ -3847,7 +3849,7 @@ const Hi = (t) => t.length > 0 ? t.join(", ") : "none", bu = (t, e) => new ie(`E
3847
3849
  if (o && !_u(s, o))
3848
3850
  throw new ie(`Invalid value for attribute '${i}' in entity '${t}'. Expected ${o.valueType}, but received: ${typeof s}`);
3849
3851
  }
3850
- }, Gr = (t, e, n) => {
3852
+ }, Br = (t, e, n) => {
3851
3853
  const r = Yi(t, n);
3852
3854
  if (typeof e != "object" || e === null)
3853
3855
  throw new ie(`Arguments for link operation on entity '${t}' must be an object, but received: ${typeof e}`);
@@ -3869,11 +3871,11 @@ const Hi = (t) => t.length > 0 ? t.join(", ") : "none", bu = (t, e) => new ie(`E
3869
3871
  create: Jt,
3870
3872
  update: Jt,
3871
3873
  merge: Jt,
3872
- link: Gr,
3873
- unlink: Gr,
3874
+ link: Br,
3875
+ unlink: Br,
3874
3876
  delete: () => {
3875
3877
  }
3876
- }, Tu = (t, e) => {
3878
+ }, wu = (t, e) => {
3877
3879
  if (!e)
3878
3880
  return;
3879
3881
  const [n, r, i, s] = t;
@@ -3883,7 +3885,7 @@ const Hi = (t) => t.length > 0 ? t.join(", ") : "none", bu = (t, e) => new ie(`E
3883
3885
  throw new ie(`Entity name must be a string, but received: ${typeof r}`);
3884
3886
  const o = gu[n];
3885
3887
  o && s !== void 0 && o(r, s, e);
3886
- }, wu = (t, e) => {
3888
+ }, Tu = (t, e) => {
3887
3889
  const n = Array.isArray(t) ? t : [t];
3888
3890
  for (const r of n) {
3889
3891
  if (!r || typeof r != "object")
@@ -3893,11 +3895,11 @@ const Hi = (t) => t.length > 0 ? t.join(", ") : "none", bu = (t, e) => new ie(`E
3893
3895
  for (const i of r.__ops) {
3894
3896
  if (!Array.isArray(i))
3895
3897
  throw new ie(`Transaction operation must be an array, but received: ${typeof i}`);
3896
- Tu(i, e);
3898
+ wu(i, e);
3897
3899
  }
3898
3900
  }
3899
3901
  };
3900
- var Br = function(t, e, n, r) {
3902
+ var Gr = function(t, e, n, r) {
3901
3903
  function i(s) {
3902
3904
  return s instanceof n ? s : new n(function(o) {
3903
3905
  o(s);
@@ -3987,7 +3989,7 @@ class mu {
3987
3989
  this.conn.close(), this.onclose && !this.closeFired && (this.closeFired = !0, this.onclose({ target: this }));
3988
3990
  }
3989
3991
  postMessages(e) {
3990
- return Br(this, void 0, void 0, function* () {
3992
+ return Gr(this, void 0, void 0, function* () {
3991
3993
  try {
3992
3994
  (yield fetch(this.url, {
3993
3995
  method: "POST",
@@ -4005,7 +4007,7 @@ class mu {
4005
4007
  });
4006
4008
  }
4007
4009
  flushQueue() {
4008
- return Br(this, void 0, void 0, function* () {
4010
+ return Gr(this, void 0, void 0, function* () {
4009
4011
  if (this.sendPromise || !this.sendQueue.length)
4010
4012
  return;
4011
4013
  const e = this.sendQueue;
@@ -4086,7 +4088,7 @@ function Zt(t, e) {
4086
4088
  }
4087
4089
  function Yr(t, e, n) {
4088
4090
  var r;
4089
- const i = (r = Te(e, t.table, "id")) === null || r === void 0 ? void 0 : r.id;
4091
+ const i = (r = we(e, t.table, "id")) === null || r === void 0 ? void 0 : r.id;
4090
4092
  if (!i)
4091
4093
  return -1;
4092
4094
  const s = ze(e.eav, [n, i, n]);
@@ -4124,7 +4126,7 @@ function Eu(t, e) {
4124
4126
  }
4125
4127
  return o;
4126
4128
  }
4127
- function Tt(t, e) {
4129
+ function wt(t, e) {
4128
4130
  return { [t.table]: e.map((n) => n.entity) };
4129
4131
  }
4130
4132
  function Au(t, e) {
@@ -4150,7 +4152,7 @@ var Se;
4150
4152
  })(Se || (Se = {}));
4151
4153
  class ku {
4152
4154
  constructor(e, n, r, i, s) {
4153
- this.callbacks = {}, this.idToHash = {}, this.trySend = e, this.config = r, this.log = i, this.createStore = s, this.subs = new wn({
4155
+ this.callbacks = {}, this.idToHash = {}, this.trySend = e, this.config = r, this.log = i, this.createStore = s, this.subs = new Tn({
4154
4156
  persister: n,
4155
4157
  merge: Ou,
4156
4158
  serialize: Su,
@@ -4218,11 +4220,11 @@ class ku {
4218
4220
  if (d && d.state && d.state.txId) {
4219
4221
  this.sendResync(d, d.state), !((i = d.values) === null || i === void 0) && i.entities && r && (Object.keys(e)[0], r({
4220
4222
  type: Se.LoadFromStorage,
4221
- data: Tt(d, (s = d.values) === null || s === void 0 ? void 0 : s.entities)
4223
+ data: wt(d, (s = d.values) === null || s === void 0 ? void 0 : s.entities)
4222
4224
  }));
4223
4225
  return;
4224
4226
  }
4225
- const c = Object.keys(e)[0], f = ((a = (o = e[c]) === null || o === void 0 ? void 0 : o.$) === null || a === void 0 ? void 0 : a.order) || { serverCreatedAt: "asc" }, [l, p] = Object.entries(f)[0], y = l === "serverCreatedAt" ? "number" : (u = Te(this.createStore([]), c, l)) === null || u === void 0 ? void 0 : u["checked-data-type"];
4227
+ const c = Object.keys(e)[0], f = ((a = (o = e[c]) === null || o === void 0 ? void 0 : o.$) === null || a === void 0 ? void 0 : a.order) || { serverCreatedAt: "asc" }, [l, p] = Object.entries(f)[0], y = l === "serverCreatedAt" ? "number" : (u = we(this.createStore([]), c, l)) === null || u === void 0 ? void 0 : u["checked-data-type"];
4226
4228
  this.subs.updateInPlace((b) => {
4227
4229
  b[n] = {
4228
4230
  query: e,
@@ -4294,7 +4296,7 @@ class ku {
4294
4296
  c[s] = a, c[s].updatedAt = Date.now();
4295
4297
  }), a.values && this.notifyCbs(s, {
4296
4298
  type: Se.InitialSyncBatch,
4297
- data: Tt(a, a.values.entities),
4299
+ data: wt(a, a.values.entities),
4298
4300
  batch: o
4299
4301
  });
4300
4302
  }
@@ -4319,7 +4321,7 @@ class ku {
4319
4321
  const s = this.subs.currentValue[i];
4320
4322
  s && this.notifyCbs(i, {
4321
4323
  type: Se.InitialSyncComplete,
4322
- data: Tt(s, ((n = s.values) === null || n === void 0 ? void 0 : n.entities) || [])
4324
+ data: wt(s, ((n = s.values) === null || n === void 0 ? void 0 : n.entities) || [])
4323
4325
  });
4324
4326
  }
4325
4327
  onSyncUpdateTriples(e) {
@@ -4344,9 +4346,9 @@ class ku {
4344
4346
  continue;
4345
4347
  u.txId = d["tx-id"];
4346
4348
  const c = [], f = {};
4347
- for (const w of d.changes) {
4348
- const T = (n = f[w.triple[0]]) !== null && n !== void 0 ? n : [];
4349
- f[w.triple[0]] = T, T.push(w);
4349
+ for (const T of d.changes) {
4350
+ const w = (n = f[T.triple[0]]) !== null && n !== void 0 ? n : [];
4351
+ f[T.triple[0]] = w, w.push(T);
4350
4352
  }
4351
4353
  const l = (r = a.values) !== null && r !== void 0 ? r : {
4352
4354
  entities: [],
@@ -4354,29 +4356,29 @@ class ku {
4354
4356
  }, p = l.entities;
4355
4357
  a.values = l;
4356
4358
  const y = [];
4357
- e: for (const [w, T] of Object.entries(f))
4359
+ e: for (const [T, w] of Object.entries(f))
4358
4360
  for (const [m, E] of Object.entries(p))
4359
- if (oo(E.store, w)) {
4360
- Jr(E.store, T);
4361
- const S = Zt(a, E.store), I = Eu(E.store, T)[w];
4362
- for (const [x, { oldValue: q, newValue: we }] of Object.entries(I || {}))
4363
- q === we && delete I[x];
4361
+ if (oo(E.store, T)) {
4362
+ Jr(E.store, w);
4363
+ const S = Zt(a, E.store), I = Eu(E.store, w)[T];
4364
+ for (const [x, { oldValue: q, newValue: Te }] of Object.entries(I || {}))
4365
+ q === Te && delete I[x];
4364
4366
  S ? (y.push({
4365
4367
  oldEntity: E.entity,
4366
4368
  newEntity: S,
4367
4369
  changedFields: I || {}
4368
- }), E.entity = S) : c.push(m), delete f[w];
4370
+ }), E.entity = S) : c.push(m), delete f[T];
4369
4371
  continue e;
4370
4372
  }
4371
4373
  const b = [];
4372
- for (const [w, T] of Object.entries(f)) {
4374
+ for (const [T, w] of Object.entries(f)) {
4373
4375
  const m = this.createStore([]);
4374
- l.attrs = m.attrs, Jr(m, T);
4376
+ l.attrs = m.attrs, Jr(m, w);
4375
4377
  const E = Zt(a, m);
4376
4378
  if (!E) {
4377
4379
  this.log.error("No entity found after applying change", {
4378
4380
  sub: a,
4379
- changes: T,
4381
+ changes: w,
4380
4382
  store: m
4381
4383
  });
4382
4384
  continue;
@@ -4388,11 +4390,11 @@ class ku {
4388
4390
  }), b.push(E);
4389
4391
  }
4390
4392
  const _ = [];
4391
- for (const w of c.sort().reverse())
4392
- _.push(p[w].entity), p.splice(w, 1);
4393
+ for (const T of c.sort().reverse())
4394
+ _.push(p[T].entity), p.splice(T, 1);
4393
4395
  Au(a, p), this.notifyCbs(o, {
4394
4396
  type: Se.SyncTransaction,
4395
- data: Tt(a, (i = a.values) === null || i === void 0 ? void 0 : i.entities),
4397
+ data: wt(a, (i = a.values) === null || i === void 0 ? void 0 : i.entities),
4396
4398
  added: b,
4397
4399
  removed: _,
4398
4400
  updated: y
@@ -4544,9 +4546,9 @@ class Nu {
4544
4546
  switch (d) {
4545
4547
  case "pendingMutations": {
4546
4548
  const y = (l = c == null ? void 0 : c.entries()) !== null && l !== void 0 ? l : [], b = (p = f == null ? void 0 : f.entries()) !== null && p !== void 0 ? p : [], _ = new Map([...y, ...b]);
4547
- return (c ? this._rewriteMutationsSorted(this.attrs, c) : []).forEach(([T, m]) => {
4549
+ return (c ? this._rewriteMutationsSorted(this.attrs, c) : []).forEach(([w, m]) => {
4548
4550
  var E;
4549
- !(!((E = f == null ? void 0 : f.pendingMutations) === null || E === void 0) && E.has(T)) && !m["tx-id"] && this._sendMutation(T, m);
4551
+ !(!((E = f == null ? void 0 : f.pendingMutations) === null || E === void 0) && E.has(w)) && !m["tx-id"] && this._sendMutation(w, m);
4550
4552
  }), _;
4551
4553
  }
4552
4554
  default:
@@ -4568,7 +4570,7 @@ class Nu {
4568
4570
  }, this.notifyQueryError = (d, c) => {
4569
4571
  (this.queryCbs[d] || []).forEach((l) => l.cb({ error: c }));
4570
4572
  }, this.pushTx = (d) => {
4571
- this.config.disableValidation || wu(d, this.config.schema);
4573
+ this.config.disableValidation || Tu(d, this.config.schema);
4572
4574
  try {
4573
4575
  const c = qa({
4574
4576
  attrs: this.optimisticAttrs(),
@@ -4655,7 +4657,7 @@ class Nu {
4655
4657
  return;
4656
4658
  }
4657
4659
  this._log.info("[socket][close]", c.id, "schedule reconnect, ms =", this._reconnectTimeoutMs), this._scheduleReconnect();
4658
- }, this._EventSource = s, this.config = Object.assign(Object.assign({}, Mu), e), this.queryCacheLimit = (o = this.config.queryCacheLimit) !== null && o !== void 0 ? o : 10, this._pendingTxCleanupTimeout = (a = this.config.pendingTxCleanupTimeout) !== null && a !== void 0 ? a : Pu, this._pendingMutationCleanupThreshold = (u = this.config.pendingMutationCleanupThreshold) !== null && u !== void 0 ? u : Iu, this._log = fu(e.verbose || Gn || Wi, () => this._reactorStats()), this.versions = Object.assign(Object.assign({}, i || {}), { "@instantdb/core": Bn }), this.config.schema && (this._linkIndex = Kr(this.config.schema)), !!xu()) {
4660
+ }, this._EventSource = s, this.config = Object.assign(Object.assign({}, Mu), e), this.queryCacheLimit = (o = this.config.queryCacheLimit) !== null && o !== void 0 ? o : 10, this._pendingTxCleanupTimeout = (a = this.config.pendingTxCleanupTimeout) !== null && a !== void 0 ? a : Pu, this._pendingMutationCleanupThreshold = (u = this.config.pendingMutationCleanupThreshold) !== null && u !== void 0 ? u : Iu, this._log = fu(e.verbose || Bn || Wi, () => this._reactorStats()), this.versions = Object.assign(Object.assign({}, i || {}), { "@instantdb/core": Gn }), this.config.schema && (this._linkIndex = Kr(this.config.schema)), !!xu()) {
4659
4661
  if (!e.appId)
4660
4662
  throw new Error("Instant must be initialized with an appId.");
4661
4663
  if (!Ne(e.appId))
@@ -4693,7 +4695,7 @@ class Nu {
4693
4695
  this.kv.waitForKeyToLoad("pendingMutations").then(() => this.notifyOne(e));
4694
4696
  }
4695
4697
  _initStorage(e) {
4696
- this.querySubs = new wn({
4698
+ this.querySubs = new Tn({
4697
4699
  persister: new e(this.config.appId, "querySubs"),
4698
4700
  merge: Fu,
4699
4701
  serialize: Du,
@@ -4713,7 +4715,7 @@ class Nu {
4713
4715
  maxSize: 1e6
4714
4716
  // 1 million triples
4715
4717
  }
4716
- }), this.querySubs.onKeyLoaded = (n) => this._onQuerySubLoaded(n), this.kv = new wn({
4718
+ }), this.querySubs.onKeyLoaded = (n) => this._onQuerySubLoaded(n), this.kv = new Tn({
4717
4719
  persister: new e(this.config.appId, "kv"),
4718
4720
  merge: this._onMergeKv,
4719
4721
  serialize: Lu,
@@ -4722,11 +4724,8 @@ class Nu {
4722
4724
  logger: this._log,
4723
4725
  saveThrottleMs: 100,
4724
4726
  idleCallbackMaxWaitMs: 100,
4725
- gc: {
4726
- maxAgeMs: Number.MAX_SAFE_INTEGER,
4727
- maxEntries: Number.MAX_SAFE_INTEGER,
4728
- maxSize: Number.MAX_SAFE_INTEGER
4729
- }
4727
+ // Don't GC the kv store
4728
+ gc: null
4730
4729
  }), this.kv.onKeyLoaded = (n) => {
4731
4730
  n === "pendingMutations" && this.notifyAll();
4732
4731
  }, this.kv.waitForKeyToLoad("pendingMutations"), this.kv.waitForKeyToLoad(Qe), this._beforeUnloadCbs.push(() => {
@@ -4792,14 +4791,14 @@ class Nu {
4792
4791
  const { q: l, result: p } = n, y = V(l);
4793
4792
  if (!this._hasQueryListeners() && !this.querySubs.currentValue[y])
4794
4793
  break;
4795
- const b = (o = (s = p == null ? void 0 : p[0]) === null || s === void 0 ? void 0 : s.data) === null || o === void 0 ? void 0 : o["page-info"], _ = (u = (a = p == null ? void 0 : p[0]) === null || a === void 0 ? void 0 : a.data) === null || u === void 0 ? void 0 : u.aggregate, w = Nr(p), T = Ot(this.attrs, w, d, this._linkIndex, this.config.useDateObjects);
4794
+ const b = (o = (s = p == null ? void 0 : p[0]) === null || s === void 0 ? void 0 : s.data) === null || o === void 0 ? void 0 : o["page-info"], _ = (u = (a = p == null ? void 0 : p[0]) === null || a === void 0 ? void 0 : a.data) === null || u === void 0 ? void 0 : u.aggregate, T = Nr(p), w = Ot(this.attrs, T, d, this._linkIndex, this.config.useDateObjects);
4796
4795
  this.querySubs.updateInPlace((m) => {
4797
4796
  if (!m[y]) {
4798
4797
  this._log.info("Missing value in querySubs", { hash: y, q: l });
4799
4798
  return;
4800
4799
  }
4801
4800
  m[y].result = {
4802
- store: T,
4801
+ store: w,
4803
4802
  pageInfo: b,
4804
4803
  aggregate: _,
4805
4804
  processedTxId: n["processed-tx-id"]
@@ -4827,24 +4826,24 @@ class Nu {
4827
4826
  const { computations: l, attrs: p } = n, y = n["processed-tx-id"];
4828
4827
  p && this._setAttrs(p), this._cleanupPendingMutationsTimeout();
4829
4828
  const b = this._rewriteMutations(this.attrs, this._pendingMutations(), y);
4830
- b !== this._pendingMutations() && this.kv.updateInPlace((T) => {
4831
- T.pendingMutations = b;
4829
+ b !== this._pendingMutations() && this.kv.updateInPlace((w) => {
4830
+ w.pendingMutations = b;
4832
4831
  });
4833
- const _ = Xr(b.entries()), w = l.map((T) => {
4832
+ const _ = Xr(b.entries()), T = l.map((w) => {
4834
4833
  var m, E, S, I;
4835
- const x = T["instaql-query"], q = T["instaql-result"], we = V(x), ft = Nr(q), Ft = Ot(this.attrs, ft, d, this._linkIndex, this.config.useDateObjects), Nt = this._applyOptimisticUpdates(Ft, _, y), lt = (E = (m = q == null ? void 0 : q[0]) === null || m === void 0 ? void 0 : m.data) === null || E === void 0 ? void 0 : E["page-info"], ce = (I = (S = q == null ? void 0 : q[0]) === null || S === void 0 ? void 0 : S.data) === null || I === void 0 ? void 0 : I.aggregate;
4836
- return { q: x, hash: we, store: Nt, pageInfo: lt, aggregate: ce };
4834
+ const x = w["instaql-query"], q = w["instaql-result"], Te = V(x), ft = Nr(q), Ft = Ot(this.attrs, ft, d, this._linkIndex, this.config.useDateObjects), Nt = this._applyOptimisticUpdates(Ft, _, y), lt = (E = (m = q == null ? void 0 : q[0]) === null || m === void 0 ? void 0 : m.data) === null || E === void 0 ? void 0 : E["page-info"], ce = (I = (S = q == null ? void 0 : q[0]) === null || S === void 0 ? void 0 : S.data) === null || I === void 0 ? void 0 : I.aggregate;
4835
+ return { q: x, hash: Te, store: Nt, pageInfo: lt, aggregate: ce };
4837
4836
  });
4838
- w.forEach(({ hash: T, q: m, store: E, pageInfo: S, aggregate: I }) => {
4837
+ T.forEach(({ hash: w, q: m, store: E, pageInfo: S, aggregate: I }) => {
4839
4838
  this.querySubs.updateInPlace((x) => {
4840
- if (!x[T]) {
4841
- this._log.error("Missing value in querySubs", { hash: T, q: m });
4839
+ if (!x[w]) {
4840
+ this._log.error("Missing value in querySubs", { hash: w, q: m });
4842
4841
  return;
4843
4842
  }
4844
- x[T].result = { store: E, pageInfo: S, aggregate: I, processedTxId: y };
4843
+ x[w].result = { store: E, pageInfo: S, aggregate: I, processedTxId: y };
4845
4844
  });
4846
- }), this._cleanupPendingMutationsQueries(), w.forEach(({ hash: T }) => {
4847
- this.notifyOne(T);
4845
+ }), this._cleanupPendingMutationsQueries(), T.forEach(({ hash: w }) => {
4846
+ this.notifyOne(w);
4848
4847
  });
4849
4848
  break;
4850
4849
  }
@@ -4854,10 +4853,10 @@ class Nu {
4854
4853
  const b = this._rewriteMutations(this.attrs, this._pendingMutations()).get(l);
4855
4854
  if (!b)
4856
4855
  break;
4857
- this._updatePendingMutations((w) => {
4858
- w.set(l, Object.assign(Object.assign({}, w.get(l)), { "tx-id": p, confirmed: Date.now() }));
4856
+ this._updatePendingMutations((T) => {
4857
+ T.set(l, Object.assign(Object.assign({}, T.get(l)), { "tx-id": p, confirmed: Date.now() }));
4859
4858
  });
4860
- const _ = b["tx-steps"].filter(([w, ...T]) => w === "add-attr").map(([w, T]) => T).concat(Object.values(this.attrs));
4859
+ const _ = b["tx-steps"].filter(([T, ...w]) => T === "add-attr").map(([T, w]) => w).concat(Object.values(this.attrs));
4861
4860
  this._setAttrs(_), this._finishTransaction("synced", l), this._cleanupPendingMutationsTimeout();
4862
4861
  break;
4863
4862
  }
@@ -5043,7 +5042,7 @@ class Nu {
5043
5042
  return /* @__PURE__ */ new Map();
5044
5043
  const i = (c) => {
5045
5044
  const [f, l, p] = c["forward-identity"];
5046
- return G(e, l, p);
5045
+ return B(e, l, p);
5047
5046
  }, s = (c) => {
5048
5047
  const [f, l, p] = c["forward-identity"];
5049
5048
  return ke(e, l, p);
@@ -5054,15 +5053,15 @@ class Nu {
5054
5053
  for (const p of c) {
5055
5054
  const [y] = p;
5056
5055
  if (y === "add-attr") {
5057
- const [_, w] = p, T = i(w);
5058
- if (T && w.id !== T.id) {
5059
- o.attrIdMap[w.id] = T.id, a = !0;
5056
+ const [_, T] = p, w = i(T);
5057
+ if (w && T.id !== w.id) {
5058
+ o.attrIdMap[T.id] = w.id, a = !0;
5060
5059
  continue;
5061
5060
  }
5062
- if (w["value-type"] === "ref") {
5063
- const m = s(w);
5061
+ if (T["value-type"] === "ref") {
5062
+ const m = s(T);
5064
5063
  if (m) {
5065
- o.attrIdMap[w.id] = m.id, o.refSwapAttrIds.add(w.id), a = !0;
5064
+ o.attrIdMap[T.id] = m.id, o.refSwapAttrIds.add(T.id), a = !0;
5066
5065
  continue;
5067
5066
  }
5068
5067
  }
@@ -5123,7 +5122,7 @@ class Nu {
5123
5122
  }
5124
5123
  _applyOptimisticUpdates(e, n, r) {
5125
5124
  for (const [i, s] of n)
5126
- (!s["tx-id"] || r && s["tx-id"] > r) && (e = To(e, s["tx-steps"]));
5125
+ (!s["tx-id"] || r && s["tx-id"] > r) && (e = wo(e, s["tx-steps"]));
5127
5126
  return e;
5128
5127
  }
5129
5128
  /** Re-compute all subscriptions */
@@ -5648,7 +5647,7 @@ class Nu {
5648
5647
  Or(d, c, l);
5649
5648
  break;
5650
5649
  case "-":
5651
- wi(d, c);
5650
+ Ti(d, c);
5652
5651
  break;
5653
5652
  }
5654
5653
  delete d[this._sessionId];
@@ -5771,10 +5770,10 @@ function zu() {
5771
5770
  function Vu() {
5772
5771
  return new H("boolean", !0, !1);
5773
5772
  }
5774
- function Gu() {
5773
+ function Bu() {
5775
5774
  return new H("date", !0, !1);
5776
5775
  }
5777
- function Bu() {
5776
+ function Gu() {
5778
5777
  return new H("json", !0, !1);
5779
5778
  }
5780
5779
  function Qu() {
@@ -5818,13 +5817,13 @@ const Nc = {
5818
5817
  string: Wu,
5819
5818
  number: zu,
5820
5819
  boolean: Vu,
5821
- date: Gu,
5822
- json: Bu,
5820
+ date: Bu,
5821
+ json: Gu,
5823
5822
  any: Qu
5824
5823
  };
5825
- let wt;
5824
+ let Tt;
5826
5825
  function Yu(t, e) {
5827
- wt == null || wt.dispose();
5826
+ Tt == null || Tt.dispose();
5828
5827
  const n = nc(e), r = Xu(e, a), i = Zu(Ju(t));
5829
5828
  function s(c) {
5830
5829
  var f;
@@ -5841,14 +5840,14 @@ function Yu(t, e) {
5841
5840
  n.element.remove(), r.element.remove(), removeEventListener("keydown", o), removeEventListener("message", s);
5842
5841
  }
5843
5842
  function d() {
5844
- document.body.appendChild(n.element), document.body.appendChild(r.element), addEventListener("keydown", o), addEventListener("message", s), wt = {
5843
+ document.body.appendChild(n.element), document.body.appendChild(r.element), addEventListener("keydown", o), addEventListener("message", s), Tt = {
5845
5844
  dispose: u
5846
5845
  };
5847
5846
  }
5848
5847
  return d();
5849
5848
  }
5850
5849
  function Ju(t) {
5851
- return `${Gn || zi ? "http://localhost:3000" : "https://instantdb.com"}/_devtool?appId=${t}`;
5850
+ return `${Bn || zi ? "http://localhost:3000" : "https://instantdb.com"}/_devtool?appId=${t}`;
5852
5851
  }
5853
5852
  function Zu(t) {
5854
5853
  const e = document.createElement("iframe");
@@ -6137,7 +6136,7 @@ function fc(t, e, n, r, i) {
6137
6136
  const s = vn[mn(t)];
6138
6137
  if (s)
6139
6138
  return dc(s, t.schema) && s._reactor.updateSchema(t.schema), s;
6140
- const o = new Nu(Object.assign(Object.assign(Object.assign({}, rc), t), { cardinalityInference: !!t.schema }), e || Ki, n || qi, Object.assign(Object.assign({}, r || {}), { "@instantdb/core": Bn }), i), a = new cc(o);
6139
+ const o = new Nu(Object.assign(Object.assign(Object.assign({}, rc), t), { cardinalityInference: !!t.schema }), e || Ki, n || qi, Object.assign(Object.assign({}, r || {}), { "@instantdb/core": Gn }), i), a = new cc(o);
6141
6140
  return vn[mn(t)] = a, lc(t.appId, t.devtool), a;
6142
6141
  }
6143
6142
  function lc(t, e) {
@@ -6186,13 +6185,13 @@ function pc() {
6186
6185
  */
6187
6186
  return t.NODE_ENV !== "production" && function() {
6188
6187
  var e = ci, 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"), l = Symbol.for("react.memo"), p = Symbol.for("react.lazy"), y = Symbol.for("react.offscreen"), b = Symbol.iterator, _ = "@@iterator";
6189
- function w(h) {
6188
+ function T(h) {
6190
6189
  if (h === null || typeof h != "object")
6191
6190
  return null;
6192
6191
  var g = b && h[b] || h[_];
6193
6192
  return typeof g == "function" ? g : null;
6194
6193
  }
6195
- var T = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
6194
+ var w = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
6196
6195
  function m(h) {
6197
6196
  {
6198
6197
  for (var g = arguments.length, v = new Array(g > 1 ? g - 1 : 0), O = 1; O < g; O++)
@@ -6202,7 +6201,7 @@ function pc() {
6202
6201
  }
6203
6202
  function E(h, g, v) {
6204
6203
  {
6205
- var O = T.ReactDebugCurrentFrame, P = O.getStackAddendum();
6204
+ var O = w.ReactDebugCurrentFrame, P = O.getStackAddendum();
6206
6205
  P !== "" && (g += "%s", v = v.concat([P]));
6207
6206
  var M = v.map(function(C) {
6208
6207
  return String(C);
@@ -6210,10 +6209,10 @@ function pc() {
6210
6209
  M.unshift("Warning: " + g), Function.prototype.apply.call(console[h], console, M);
6211
6210
  }
6212
6211
  }
6213
- var S = !1, I = !1, x = !1, q = !1, we = !1, ft;
6212
+ var S = !1, I = !1, x = !1, q = !1, Te = !1, ft;
6214
6213
  ft = Symbol.for("react.module.reference");
6215
6214
  function Ft(h) {
6216
- return !!(typeof h == "string" || typeof h == "function" || h === i || h === o || we || h === s || h === c || h === f || q || h === y || S || I || x || typeof h == "object" && h !== null && (h.$$typeof === p || h.$$typeof === l || h.$$typeof === a || h.$$typeof === u || h.$$typeof === d || // This needs to include all possible module reference object
6215
+ return !!(typeof h == "string" || typeof h == "function" || h === i || h === o || Te || h === s || h === c || h === f || q || h === y || S || I || x || typeof h == "object" && h !== null && (h.$$typeof === p || h.$$typeof === l || h.$$typeof === a || h.$$typeof === u || h.$$typeof === d || // This needs to include all possible module reference object
6217
6216
  // types supported by any Flight configuration anywhere since
6218
6217
  // we don't know which Flight build this will end up being used
6219
6218
  // with.
@@ -6274,13 +6273,13 @@ function pc() {
6274
6273
  }
6275
6274
  return null;
6276
6275
  }
6277
- var me = Object.assign, Ge = 0, Yn, Jn, Zn, Xn, er, tr, nr;
6276
+ var me = Object.assign, Be = 0, Yn, Jn, Zn, Xn, er, tr, nr;
6278
6277
  function rr() {
6279
6278
  }
6280
6279
  rr.__reactDisabledLog = !0;
6281
6280
  function es() {
6282
6281
  {
6283
- if (Ge === 0) {
6282
+ if (Be === 0) {
6284
6283
  Yn = console.log, Jn = console.info, Zn = console.warn, Xn = console.error, er = console.group, tr = console.groupCollapsed, nr = console.groupEnd;
6285
6284
  var h = {
6286
6285
  configurable: !0,
@@ -6298,12 +6297,12 @@ function pc() {
6298
6297
  groupEnd: h
6299
6298
  });
6300
6299
  }
6301
- Ge++;
6300
+ Be++;
6302
6301
  }
6303
6302
  }
6304
6303
  function ts() {
6305
6304
  {
6306
- if (Ge--, Ge === 0) {
6305
+ if (Be--, Be === 0) {
6307
6306
  var h = {
6308
6307
  configurable: !0,
6309
6308
  enumerable: !0,
@@ -6333,10 +6332,10 @@ function pc() {
6333
6332
  })
6334
6333
  });
6335
6334
  }
6336
- Ge < 0 && m("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
6335
+ Be < 0 && m("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
6337
6336
  }
6338
6337
  }
6339
- var Kt = T.ReactCurrentDispatcher, qt;
6338
+ var Kt = w.ReactCurrentDispatcher, qt;
6340
6339
  function ht(h, g, v) {
6341
6340
  {
6342
6341
  if (qt === void 0)
@@ -6404,14 +6403,14 @@ function pc() {
6404
6403
  } catch (Y) {
6405
6404
  if (Y && O && typeof Y.stack == "string") {
6406
6405
  for (var k = Y.stack.split(`
6407
- `), B = O.stack.split(`
6408
- `), D = k.length - 1, L = B.length - 1; D >= 1 && L >= 0 && k[D] !== B[L]; )
6406
+ `), G = O.stack.split(`
6407
+ `), D = k.length - 1, L = G.length - 1; D >= 1 && L >= 0 && k[D] !== G[L]; )
6409
6408
  L--;
6410
6409
  for (; D >= 1 && L >= 0; D--, L--)
6411
- if (k[D] !== B[L]) {
6410
+ if (k[D] !== G[L]) {
6412
6411
  if (D !== 1 || L !== 1)
6413
6412
  do
6414
- if (D--, L--, L < 0 || k[D] !== B[L]) {
6413
+ if (D--, L--, L < 0 || k[D] !== G[L]) {
6415
6414
  var re = `
6416
6415
  ` + k[D].replace(" at new ", " at ");
6417
6416
  return h.displayName && re.includes("<anonymous>") && (re = re.replace("<anonymous>", h.displayName)), typeof h == "function" && pt.set(h, re), re;
@@ -6462,7 +6461,7 @@ function pc() {
6462
6461
  }
6463
6462
  return "";
6464
6463
  }
6465
- var Be = Object.prototype.hasOwnProperty, sr = {}, or = T.ReactDebugCurrentFrame;
6464
+ var Ge = Object.prototype.hasOwnProperty, sr = {}, or = w.ReactDebugCurrentFrame;
6466
6465
  function bt(h) {
6467
6466
  if (h) {
6468
6467
  var g = h._owner, v = yt(h.type, h._source, g ? g.type : null);
@@ -6472,14 +6471,14 @@ function pc() {
6472
6471
  }
6473
6472
  function ss(h, g, v, O, P) {
6474
6473
  {
6475
- var M = Function.call.bind(Be);
6474
+ var M = Function.call.bind(Ge);
6476
6475
  for (var C in h)
6477
6476
  if (M(h, C)) {
6478
6477
  var k = void 0;
6479
6478
  try {
6480
6479
  if (typeof h[C] != "function") {
6481
- var B = Error((O || "React class") + ": " + v + " type `" + C + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof h[C] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
6482
- throw B.name = "Invariant Violation", B;
6480
+ var G = Error((O || "React class") + ": " + v + " type `" + C + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof h[C] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
6481
+ throw G.name = "Invariant Violation", G;
6483
6482
  }
6484
6483
  k = h[C](g, C, O, v, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
6485
6484
  } catch (D) {
@@ -6513,14 +6512,14 @@ function pc() {
6513
6512
  if (us(h))
6514
6513
  return m("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", as(h)), ar(h);
6515
6514
  }
6516
- var cr = T.ReactCurrentOwner, cs = {
6515
+ var cr = w.ReactCurrentOwner, cs = {
6517
6516
  key: !0,
6518
6517
  ref: !0,
6519
6518
  __self: !0,
6520
6519
  __source: !0
6521
6520
  }, dr, fr;
6522
6521
  function ds(h) {
6523
- if (Be.call(h, "ref")) {
6522
+ if (Ge.call(h, "ref")) {
6524
6523
  var g = Object.getOwnPropertyDescriptor(h, "ref").get;
6525
6524
  if (g && g.isReactWarning)
6526
6525
  return !1;
@@ -6528,7 +6527,7 @@ function pc() {
6528
6527
  return h.ref !== void 0;
6529
6528
  }
6530
6529
  function fs(h) {
6531
- if (Be.call(h, "key")) {
6530
+ if (Ge.call(h, "key")) {
6532
6531
  var g = Object.getOwnPropertyDescriptor(h, "key").get;
6533
6532
  if (g && g.isReactWarning)
6534
6533
  return !1;
@@ -6591,23 +6590,23 @@ function pc() {
6591
6590
  };
6592
6591
  function bs(h, g, v, O, P) {
6593
6592
  {
6594
- var M, C = {}, k = null, B = null;
6595
- v !== void 0 && (ur(v), k = "" + v), fs(g) && (ur(g.key), k = "" + g.key), ds(g) && (B = g.ref, ls(g, P));
6593
+ var M, C = {}, k = null, G = null;
6594
+ v !== void 0 && (ur(v), k = "" + v), fs(g) && (ur(g.key), k = "" + g.key), ds(g) && (G = g.ref, ls(g, P));
6596
6595
  for (M in g)
6597
- Be.call(g, M) && !cs.hasOwnProperty(M) && (C[M] = g[M]);
6596
+ Ge.call(g, M) && !cs.hasOwnProperty(M) && (C[M] = g[M]);
6598
6597
  if (h && h.defaultProps) {
6599
6598
  var D = h.defaultProps;
6600
6599
  for (M in D)
6601
6600
  C[M] === void 0 && (C[M] = D[M]);
6602
6601
  }
6603
- if (k || B) {
6602
+ if (k || G) {
6604
6603
  var L = typeof h == "function" ? h.displayName || h.name || "Unknown" : h;
6605
- k && hs(C, L), B && ps(C, L);
6604
+ k && hs(C, L), G && ps(C, L);
6606
6605
  }
6607
- return ys(h, k, B, P, O, cr.current, C);
6606
+ return ys(h, k, G, P, O, cr.current, C);
6608
6607
  }
6609
6608
  }
6610
- var Vt = T.ReactCurrentOwner, lr = T.ReactDebugCurrentFrame;
6609
+ var Vt = w.ReactCurrentOwner, lr = w.ReactDebugCurrentFrame;
6611
6610
  function Ie(h) {
6612
6611
  if (h) {
6613
6612
  var g = h._owner, v = yt(h.type, h._source, g ? g.type : null);
@@ -6615,9 +6614,9 @@ function pc() {
6615
6614
  } else
6616
6615
  lr.setExtraStackFrame(null);
6617
6616
  }
6618
- var Gt;
6619
- Gt = !1;
6620
- function Bt(h) {
6617
+ var Bt;
6618
+ Bt = !1;
6619
+ function Gt(h) {
6621
6620
  return typeof h == "object" && h !== null && h.$$typeof === n;
6622
6621
  }
6623
6622
  function hr() {
@@ -6668,19 +6667,19 @@ Check the top-level render call using <` + v + ">.");
6668
6667
  if (zt(h))
6669
6668
  for (var v = 0; v < h.length; v++) {
6670
6669
  var O = h[v];
6671
- Bt(O) && yr(O, g);
6670
+ Gt(O) && yr(O, g);
6672
6671
  }
6673
- else if (Bt(h))
6672
+ else if (Gt(h))
6674
6673
  h._store && (h._store.validated = !0);
6675
6674
  else if (h) {
6676
- var P = w(h);
6675
+ var P = T(h);
6677
6676
  if (typeof P == "function" && P !== h.entries)
6678
6677
  for (var M = P.call(h), C; !(C = M.next()).done; )
6679
- Bt(C.value) && yr(C.value, g);
6678
+ Gt(C.value) && yr(C.value, g);
6680
6679
  }
6681
6680
  }
6682
6681
  }
6683
- function Ts(h) {
6682
+ function ws(h) {
6684
6683
  {
6685
6684
  var g = h.type;
6686
6685
  if (g == null || typeof g == "string")
@@ -6697,15 +6696,15 @@ Check the top-level render call using <` + v + ">.");
6697
6696
  if (v) {
6698
6697
  var O = ce(g);
6699
6698
  ss(v, h.props, "prop", O, h);
6700
- } else if (g.PropTypes !== void 0 && !Gt) {
6701
- Gt = !0;
6699
+ } else if (g.PropTypes !== void 0 && !Bt) {
6700
+ Bt = !0;
6702
6701
  var P = ce(g);
6703
6702
  m("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", P || "Unknown");
6704
6703
  }
6705
6704
  typeof g.getDefaultProps == "function" && !g.getDefaultProps.isReactClassApproved && m("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
6706
6705
  }
6707
6706
  }
6708
- function ws(h) {
6707
+ function Ts(h) {
6709
6708
  {
6710
6709
  for (var g = Object.keys(h.props), v = 0; v < g.length; v++) {
6711
6710
  var O = g[v];
@@ -6724,8 +6723,8 @@ Check the top-level render call using <` + v + ">.");
6724
6723
  if (!C) {
6725
6724
  var k = "";
6726
6725
  (h === void 0 || typeof h == "object" && h !== null && Object.keys(h).length === 0) && (k += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
6727
- var B = _s();
6728
- B ? k += B : k += hr();
6726
+ var G = _s();
6727
+ G ? k += G : k += hr();
6729
6728
  var D;
6730
6729
  h === null ? D = "null" : zt(h) ? D = "array" : h !== void 0 && h.$$typeof === n ? (D = "<" + (ce(h.type) || "Unknown") + " />", k = " Did you accidentally export a JSX literal instead of a component?") : D = typeof h, m("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", D, k);
6731
6730
  }
@@ -6745,7 +6744,7 @@ Check the top-level render call using <` + v + ">.");
6745
6744
  else
6746
6745
  br(re, h);
6747
6746
  }
6748
- if (Be.call(g, "key")) {
6747
+ if (Ge.call(g, "key")) {
6749
6748
  var ve = ce(h), Y = Object.keys(g).filter(function(As) {
6750
6749
  return As !== "key";
6751
6750
  }), Qt = Y.length > 0 ? "{key: someKey, " + Y.join(": ..., ") + ": ...}" : "{key: someKey}";
@@ -6759,7 +6758,7 @@ React keys must be passed directly to JSX without using spread:
6759
6758
  <%s key={someKey} {...props} />`, Qt, ve, Es, ve), _r[ve + Qt] = !0;
6760
6759
  }
6761
6760
  }
6762
- return h === i ? ws(L) : Ts(L), L;
6761
+ return h === i ? Ts(L) : ws(L), L;
6763
6762
  }
6764
6763
  }
6765
6764
  function ms(h, g, v) {
@@ -6809,8 +6808,8 @@ function gc() {
6809
6808
  }
6810
6809
  return { set: e, clear: n };
6811
6810
  }
6812
- const Tc = 1e3;
6813
- function wc(t, e, n) {
6811
+ const wc = 1e3;
6812
+ function Tc(t, e, n) {
6814
6813
  je(() => t.core._reactor.subscribeTopic(t.id, e, (i, s) => {
6815
6814
  n(i, s);
6816
6815
  }), [t.id, e]);
@@ -6856,7 +6855,7 @@ function Oc(t, e, n = {}) {
6856
6855
  var f;
6857
6856
  t.core._reactor.publishPresence(t.type, t.id, {
6858
6857
  [e]: c
6859
- }), 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 : Tc, () => {
6858
+ }), 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 : wc, () => {
6860
6859
  t.core._reactor.publishPresence(t.type, t.id, {
6861
6860
  [e]: null
6862
6861
  });
@@ -6874,7 +6873,7 @@ function Oc(t, e, n = {}) {
6874
6873
  };
6875
6874
  }
6876
6875
  const Oe = {
6877
- useTopicEffect: wc,
6876
+ useTopicEffect: Tc,
6878
6877
  usePublishTopic: mc,
6879
6878
  usePresence: vc,
6880
6879
  useSyncPresence: Sc,
@@ -7010,10 +7009,10 @@ function Cc(t) {
7010
7009
  const { onEvent: e = tn, onError: n = tn, onRetry: r = tn, onComment: i } = t;
7011
7010
  let s = "", o = !0, a, u = "", d = "";
7012
7011
  function c(b) {
7013
- const _ = o ? b.replace(/^\xEF\xBB\xBF/, "") : b, [w, T] = Pc(`${s}${_}`);
7014
- for (const m of w)
7012
+ const _ = o ? b.replace(/^\xEF\xBB\xBF/, "") : b, [T, w] = Pc(`${s}${_}`);
7013
+ for (const m of T)
7015
7014
  f(m);
7016
- s = T, o = !1;
7015
+ s = w, o = !1;
7017
7016
  }
7018
7017
  function f(b) {
7019
7018
  if (b === "") {
@@ -7026,13 +7025,13 @@ function Cc(t) {
7026
7025
  }
7027
7026
  const _ = b.indexOf(":");
7028
7027
  if (_ !== -1) {
7029
- const w = b.slice(0, _), T = b[_ + 1] === " " ? 2 : 1, m = b.slice(_ + T);
7030
- l(w, m, b);
7028
+ const T = b.slice(0, _), w = b[_ + 1] === " " ? 2 : 1, m = b.slice(_ + w);
7029
+ l(T, m, b);
7031
7030
  return;
7032
7031
  }
7033
7032
  l(b, "", b);
7034
7033
  }
7035
- function l(b, _, w) {
7034
+ function l(b, _, T) {
7036
7035
  switch (b) {
7037
7036
  case "event":
7038
7037
  d = _;
@@ -7049,7 +7048,7 @@ function Cc(t) {
7049
7048
  new ii(`Invalid \`retry\` value: "${_}"`, {
7050
7049
  type: "invalid-retry",
7051
7050
  value: _,
7052
- line: w
7051
+ line: T
7053
7052
  })
7054
7053
  );
7055
7054
  break;
@@ -7057,7 +7056,7 @@ function Cc(t) {
7057
7056
  n(
7058
7057
  new ii(
7059
7058
  `Unknown field "${b.length > 20 ? `${b.slice(0, 20)}…` : b}"`,
7060
- { type: "unknown-field", field: b, value: _, line: w }
7059
+ { type: "unknown-field", field: b, value: _, line: T }
7061
7060
  )
7062
7061
  );
7063
7062
  break;
@@ -7371,7 +7370,7 @@ function Rc(t) {
7371
7370
  return new Mn(
7372
7371
  t,
7373
7372
  {
7374
- "@instantdb/react": Bn
7373
+ "@instantdb/react": Gn
7375
7374
  }
7376
7375
  );
7377
7376
  }
@@ -7391,8 +7390,8 @@ function qc({
7391
7390
  const c = e || `cursors-space-default--${String(n.type)}-${n.id}`, f = n.usePresence({
7392
7391
  keys: [c]
7393
7392
  }), l = n._core._reactor.getPresence(n.type, n.id);
7394
- function p(T, m) {
7395
- const E = m.clientX, S = m.clientY, I = (E - T.left) / T.width * 100, x = (S - T.top) / T.height * 100;
7393
+ function p(w, m) {
7394
+ const E = m.clientX, S = m.clientY, I = (E - w.left) / w.width * 100, x = (S - w.top) / w.height * 100;
7396
7395
  f.publishPresence({
7397
7396
  [c]: {
7398
7397
  x: E,
@@ -7403,27 +7402,27 @@ function qc({
7403
7402
  }
7404
7403
  });
7405
7404
  }
7406
- function y(T) {
7407
- u || T.stopPropagation();
7408
- const m = T.currentTarget.getBoundingClientRect();
7409
- p(m, T);
7405
+ function y(w) {
7406
+ u || w.stopPropagation();
7407
+ const m = w.currentTarget.getBoundingClientRect();
7408
+ p(m, w);
7410
7409
  }
7411
- function b(T) {
7410
+ function b(w) {
7412
7411
  f.publishPresence({
7413
7412
  [c]: void 0
7414
7413
  });
7415
7414
  }
7416
- function _(T) {
7417
- if (T.touches.length !== 1)
7415
+ function _(w) {
7416
+ if (w.touches.length !== 1)
7418
7417
  return;
7419
- const m = T.touches[0];
7418
+ const m = w.touches[0];
7420
7419
  if (m.target instanceof Element) {
7421
- u || T.stopPropagation();
7420
+ u || w.stopPropagation();
7422
7421
  const E = m.target.getBoundingClientRect();
7423
7422
  p(E, m);
7424
7423
  }
7425
7424
  }
7426
- function w(T) {
7425
+ function T(w) {
7427
7426
  f.publishPresence({
7428
7427
  [c]: void 0
7429
7428
  });
@@ -7434,7 +7433,7 @@ function qc({
7434
7433
  onMouseMove: y,
7435
7434
  onMouseOut: b,
7436
7435
  onTouchMove: _,
7437
- onTouchEnd: w,
7436
+ onTouchEnd: T,
7438
7437
  className: r,
7439
7438
  style: {
7440
7439
  position: "relative",
@@ -7451,7 +7450,7 @@ function qc({
7451
7450
  ...$c,
7452
7451
  zIndex: d !== void 0 ? d : Dc
7453
7452
  },
7454
- children: Object.entries(f.peers).map(([T, m]) => {
7453
+ children: Object.entries(f.peers).map(([w, m]) => {
7455
7454
  const E = m[c];
7456
7455
  return E ? /* @__PURE__ */ z.jsx(
7457
7456
  "div",
@@ -7464,10 +7463,10 @@ function qc({
7464
7463
  },
7465
7464
  children: a ? a({
7466
7465
  color: E.color,
7467
- presence: l.peers[T]
7466
+ presence: l.peers[w]
7468
7467
  }) : /* @__PURE__ */ z.jsx(xc, { ...E })
7469
7468
  },
7470
- T
7469
+ w
7471
7470
  ) : null;
7472
7471
  })
7473
7472
  },