@instantdb/react-common 1.0.39-branch-codex-fix-weakhash-collision.26245034324.1 → 1.0.39

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.
@@ -53,10 +53,10 @@ function Hs() {
53
53
  {
54
54
  for (var w = arguments.length, v = new Array(w > 1 ? w - 1 : 0), I = 1; I < w; I++)
55
55
  v[I - 1] = arguments[I];
56
- M("error", d, v);
56
+ R("error", d, v);
57
57
  }
58
58
  }
59
- function M(d, w, v) {
59
+ function R(d, w, v) {
60
60
  {
61
61
  var I = _.ReactDebugCurrentFrame, W = I.getStackAddendum();
62
62
  W !== "" && (w += "%s", v = v.concat([W]));
@@ -130,14 +130,14 @@ function Hs() {
130
130
  }
131
131
  return null;
132
132
  }
133
- var E = Object.assign, j = 0, R, U, L, A, k, K, H;
133
+ var E = Object.assign, j = 0, M, U, L, A, k, K, H;
134
134
  function Y() {
135
135
  }
136
136
  Y.__reactDisabledLog = !0;
137
137
  function oe() {
138
138
  {
139
139
  if (j === 0) {
140
- R = console.log, U = console.info, L = console.warn, A = console.error, k = console.group, K = console.groupCollapsed, H = console.groupEnd;
140
+ M = console.log, U = console.info, L = console.warn, A = console.error, k = console.group, K = console.groupCollapsed, H = console.groupEnd;
141
141
  var d = {
142
142
  configurable: !0,
143
143
  enumerable: !0,
@@ -167,7 +167,7 @@ function Hs() {
167
167
  };
168
168
  Object.defineProperties(console, {
169
169
  log: E({}, d, {
170
- value: R
170
+ value: M
171
171
  }),
172
172
  info: E({}, d, {
173
173
  value: U
@@ -318,13 +318,13 @@ function Hs() {
318
318
  }
319
319
  return "";
320
320
  }
321
- var He = Object.prototype.hasOwnProperty, Pn = {}, Mn = _.ReactDebugCurrentFrame;
321
+ var He = Object.prototype.hasOwnProperty, Pn = {}, Rn = _.ReactDebugCurrentFrame;
322
322
  function dt(d) {
323
323
  if (d) {
324
324
  var w = d._owner, v = ft(d.type, d._source, w ? w.type : null);
325
- Mn.setExtraStackFrame(v);
325
+ Rn.setExtraStackFrame(v);
326
326
  } else
327
- Mn.setExtraStackFrame(null);
327
+ Rn.setExtraStackFrame(null);
328
328
  }
329
329
  function As(d, w, v, I, W) {
330
330
  {
@@ -357,17 +357,17 @@ function Hs() {
357
357
  }
358
358
  function ks(d) {
359
359
  try {
360
- return Rn(d), !1;
360
+ return Mn(d), !1;
361
361
  } catch {
362
362
  return !0;
363
363
  }
364
364
  }
365
- function Rn(d) {
365
+ function Mn(d) {
366
366
  return "" + d;
367
367
  }
368
368
  function jn(d) {
369
369
  if (ks(d))
370
- return T("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Es(d)), Rn(d);
370
+ return T("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Es(d)), Mn(d);
371
371
  }
372
372
  var $n = _.ReactCurrentOwner, Cs = {
373
373
  key: !0,
@@ -391,10 +391,10 @@ function Hs() {
391
391
  }
392
392
  return d.key !== void 0;
393
393
  }
394
- function Ms(d, w) {
394
+ function Rs(d, w) {
395
395
  typeof d.ref == "string" && $n.current;
396
396
  }
397
- function Rs(d, w) {
397
+ function Ms(d, w) {
398
398
  {
399
399
  var v = function() {
400
400
  xn || (xn = !0, T("%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)", w));
@@ -448,7 +448,7 @@ function Hs() {
448
448
  function xs(d, w, v, I, W) {
449
449
  {
450
450
  var V, D = {}, $ = null, ae = null;
451
- v !== void 0 && (jn(v), $ = "" + v), Ps(w) && (jn(w.key), $ = "" + w.key), Is(w) && (ae = w.ref, Ms(w, W));
451
+ v !== void 0 && (jn(v), $ = "" + v), Ps(w) && (jn(w.key), $ = "" + w.key), Is(w) && (ae = w.ref, Rs(w, W));
452
452
  for (V in w)
453
453
  He.call(w, V) && !Cs.hasOwnProperty(V) && (D[V] = w[V]);
454
454
  if (d && d.defaultProps) {
@@ -458,7 +458,7 @@ function Hs() {
458
458
  }
459
459
  if ($ || ae) {
460
460
  var te = typeof d == "function" ? d.displayName || d.name || "Unknown" : d;
461
- $ && Rs(D, te), ae && js(D, te);
461
+ $ && Ms(D, te), ae && js(D, te);
462
462
  }
463
463
  return $s(d, $, ae, W, I, $n.current, D);
464
464
  }
@@ -706,7 +706,7 @@ const X = {
706
706
  Remove: "remove",
707
707
  Replace: "replace",
708
708
  Add: "add"
709
- }, Mr = Symbol.for("__MUTATIVE_PROXY_DRAFT__"), Ys = Symbol("__MUTATIVE_RAW_RETURN_SYMBOL__"), wt = Symbol.iterator, pe = {
709
+ }, Rr = Symbol.for("__MUTATIVE_PROXY_DRAFT__"), Ys = Symbol("__MUTATIVE_RAW_RETURN_SYMBOL__"), wt = Symbol.iterator, pe = {
710
710
  mutable: "mutable",
711
711
  immutable: "immutable"
712
712
  }, bn = {};
@@ -738,7 +738,7 @@ function $e(n) {
738
738
  return !!x(n);
739
739
  }
740
740
  function x(n) {
741
- return typeof n != "object" ? null : n == null ? void 0 : n[Mr];
741
+ return typeof n != "object" ? null : n == null ? void 0 : n[Rr];
742
742
  }
743
743
  function mn(n) {
744
744
  var e;
@@ -751,7 +751,7 @@ function me(n, e) {
751
751
  let t;
752
752
  return Object.getPrototypeOf(n) === Object.prototype || Array.isArray(n) || n instanceof Map || n instanceof Set || !!(e != null && e.mark) && ((t = e.mark(n, pe)) === pe.immutable || typeof t == "function");
753
753
  }
754
- function Rr(n, e = []) {
754
+ function Mr(n, e = []) {
755
755
  if (Object.hasOwnProperty.call(n, "key")) {
756
756
  const t = n.parent.copy, r = x(Ee(t, n.key));
757
757
  if (r !== null && (r == null ? void 0 : r.original) !== n.original)
@@ -762,7 +762,7 @@ function Rr(n, e = []) {
762
762
  e.push(i);
763
763
  }
764
764
  if (n.parent)
765
- return Rr(n.parent, e);
765
+ return Mr(n.parent, e);
766
766
  e.reverse();
767
767
  try {
768
768
  Zs(n.copy, e);
@@ -792,7 +792,7 @@ function Zt(n) {
792
792
  for (; n.finalities.revoke.length > 0; )
793
793
  n.finalities.revoke.pop()();
794
794
  }
795
- function Me(n, e) {
795
+ function Re(n, e) {
796
796
  return e ? n : [""].concat(n).map((t) => {
797
797
  const r = `${t}`;
798
798
  return r.indexOf("/") === -1 && r.indexOf("~") === -1 ? r : r.replace(/~/g, "~0").replace(/\//g, "~1");
@@ -991,7 +991,7 @@ function Xt(n) {
991
991
  function en(n, e, t, r) {
992
992
  if (n.operated && n.assignedMap && n.assignedMap.size > 0 && !n.finalized) {
993
993
  if (t && r) {
994
- const i = Rr(n);
994
+ const i = Mr(n);
995
995
  i && e(n, i, t, r);
996
996
  }
997
997
  n.finalized = !0;
@@ -1016,7 +1016,7 @@ function ni(n, e, t, r, s) {
1016
1016
  c.length < i.length && ([i, c] = [c, i], [t, r] = [r, t]);
1017
1017
  for (let u = 0; u < i.length; u += 1)
1018
1018
  if (o.get(u.toString()) && c[u] !== i[u]) {
1019
- const l = e.concat([u]), f = Me(l, s);
1019
+ const l = e.concat([u]), f = Re(l, s);
1020
1020
  t.push({
1021
1021
  op: X.Replace,
1022
1022
  path: f,
@@ -1030,7 +1030,7 @@ function ni(n, e, t, r, s) {
1030
1030
  });
1031
1031
  }
1032
1032
  for (let u = i.length; u < c.length; u += 1) {
1033
- const l = e.concat([u]), f = Me(l, s);
1033
+ const l = e.concat([u]), f = Re(l, s);
1034
1034
  t.push({
1035
1035
  op: X.Add,
1036
1036
  path: f,
@@ -1041,7 +1041,7 @@ function ni(n, e, t, r, s) {
1041
1041
  if (i.length < c.length) {
1042
1042
  const { arrayLengthAssignment: u = !0 } = a.enablePatches;
1043
1043
  if (u) {
1044
- const l = e.concat(["length"]), f = Me(l, s);
1044
+ const l = e.concat(["length"]), f = Re(l, s);
1045
1045
  r.push({
1046
1046
  op: X.Replace,
1047
1047
  path: f,
@@ -1049,7 +1049,7 @@ function ni(n, e, t, r, s) {
1049
1049
  });
1050
1050
  } else
1051
1051
  for (let l = c.length; i.length < l; l -= 1) {
1052
- const f = e.concat([l - 1]), h = Me(f, s);
1052
+ const f = e.concat([l - 1]), h = Re(f, s);
1053
1053
  r.push({
1054
1054
  op: X.Remove,
1055
1055
  path: h
@@ -1062,7 +1062,7 @@ function ri({ original: n, copy: e, assignedMap: t }, r, s, i, o) {
1062
1062
  const u = Ee(n, c), l = Tt(Ee(e, c)), f = a ? st(n, c) ? X.Replace : X.Add : X.Remove;
1063
1063
  if (Oe(u, l) && f === X.Replace)
1064
1064
  return;
1065
- const h = r.concat(c), y = Me(h, o);
1065
+ const h = r.concat(c), y = Re(h, o);
1066
1066
  s.push(f === X.Remove ? { op: f, path: y } : { op: f, path: y, value: l }), i.push(f === X.Add ? { op: X.Remove, path: y } : f === X.Remove ? { op: X.Add, path: y, value: u } : { op: X.Replace, path: y, value: u });
1067
1067
  });
1068
1068
  }
@@ -1070,7 +1070,7 @@ function si({ original: n, copy: e }, t, r, s, i) {
1070
1070
  let o = 0;
1071
1071
  n.forEach((a) => {
1072
1072
  if (!e.has(a)) {
1073
- const c = t.concat([o]), u = Me(c, i);
1073
+ const c = t.concat([o]), u = Re(c, i);
1074
1074
  r.push({
1075
1075
  op: X.Remove,
1076
1076
  path: u,
@@ -1084,7 +1084,7 @@ function si({ original: n, copy: e }, t, r, s, i) {
1084
1084
  o += 1;
1085
1085
  }), o = 0, e.forEach((a) => {
1086
1086
  if (!n.has(a)) {
1087
- const c = t.concat([o]), u = Me(c, i);
1087
+ const c = t.concat([o]), u = Re(c, i);
1088
1088
  r.push({
1089
1089
  op: X.Add,
1090
1090
  path: u,
@@ -1311,7 +1311,7 @@ const oi = Reflect.ownKeys(Et), xr = /* @__PURE__ */ new WeakSet(), Dr = {
1311
1311
  const i = (r = n.copy) === null || r === void 0 ? void 0 : r[e];
1312
1312
  if (i && xr.has(i))
1313
1313
  return i;
1314
- if (e === Mr)
1314
+ if (e === Rr)
1315
1315
  return n;
1316
1316
  let o;
1317
1317
  if (n.options.mark) {
@@ -1567,7 +1567,7 @@ const ui = (n) => function e(t, r, s) {
1567
1567
  } catch (O) {
1568
1568
  throw Zt(x(S)), O;
1569
1569
  }
1570
- const M = (O) => {
1570
+ const R = (O) => {
1571
1571
  const F = x(S);
1572
1572
  if (!$e(O)) {
1573
1573
  if (O !== void 0 && !Oe(O, S) && (F != null && F.operated))
@@ -1594,9 +1594,9 @@ const ui = (n) => function e(t, r, s) {
1594
1594
  }
1595
1595
  return _([O]);
1596
1596
  };
1597
- return T instanceof Promise ? T.then(M, (O) => {
1597
+ return T instanceof Promise ? T.then(R, (O) => {
1598
1598
  throw Zt(x(S)), O;
1599
- }) : M(T);
1599
+ }) : R(T);
1600
1600
  }, kt = ui();
1601
1601
  Object.prototype.constructor.toString();
1602
1602
  function Lr(n, e) {
@@ -1999,7 +1999,7 @@ function Pt(n) {
1999
1999
  throw new Error(`Invalid date value \`${n}\`. Expected a date, number, or string, got type ${typeof n}.`);
2000
2000
  }
2001
2001
  }
2002
- class Re {
2002
+ class Me {
2003
2003
  constructor(e, t) {
2004
2004
  p(this, "attrs");
2005
2005
  p(this, "linkIndex");
@@ -2132,9 +2132,9 @@ function Wr(n, e) {
2132
2132
  }
2133
2133
  function zr(n, e) {
2134
2134
  if (n)
2135
- return new Re(n.attrs, n.linkIndex);
2135
+ return new Me(n.attrs, n.linkIndex);
2136
2136
  if (e && "__type" in e)
2137
- return new Re(e.attrs, e.linkIndex);
2137
+ return new Me(e.attrs, e.linkIndex);
2138
2138
  }
2139
2139
  function Pi(n, e) {
2140
2140
  return Be(n.eav, [e]) !== void 0;
@@ -2177,12 +2177,12 @@ function Vr(n, e, t) {
2177
2177
  const [s, i, o] = r, a = e.getAttr(i);
2178
2178
  a && (_e(n.eav, [s, i, o]), _e(n.aev, [i, s, o]), An(a) && _e(n.vae, [o, i, s]));
2179
2179
  }
2180
- let Mi = 0;
2180
+ let Ri = 0;
2181
2181
  function Qr(n, e, t) {
2182
2182
  const [r, s, i] = t;
2183
2183
  let o;
2184
2184
  const a = Be(n.eav, [r, s, i]);
2185
- return a && (o = a[3]), o || Date.now() * 10 + Mi++;
2185
+ return a && (o = a[3]), o || Date.now() * 10 + Ri++;
2186
2186
  }
2187
2187
  function Br(n, e, t) {
2188
2188
  const r = ct(n, t);
@@ -2196,7 +2196,7 @@ function Br(n, e, t) {
2196
2196
  const c = Be(n.eav, [s, i, o]), u = (c == null ? void 0 : c[3]) ?? Qr(n, a, r), l = [s, i, o, u];
2197
2197
  Ii(a) ? (le(n.eav, [s, i], /* @__PURE__ */ new Map([[o, l]])), le(n.aev, [i, s], /* @__PURE__ */ new Map([[o, l]]))) : (le(n.eav, [s, i, o], l), le(n.aev, [i, s, o], l)), An(a) && le(n.vae, [o, i, s], l);
2198
2198
  }
2199
- function Ri(n, e, t) {
2199
+ function Mi(n, e, t) {
2200
2200
  var y;
2201
2201
  const r = ct(n, t);
2202
2202
  if (!r)
@@ -2275,7 +2275,7 @@ function Di(n, e, t) {
2275
2275
  Br(n, e, s);
2276
2276
  break;
2277
2277
  case "deep-merge-triple":
2278
- Ri(n, e, s);
2278
+ Mi(n, e, s);
2279
2279
  break;
2280
2280
  case "retract-triple":
2281
2281
  Vr(n, e, s);
@@ -2458,7 +2458,7 @@ function qi(n, e, t) {
2458
2458
  });
2459
2459
  }, {
2460
2460
  mark: (s) => {
2461
- if (s instanceof Re)
2461
+ if (s instanceof Me)
2462
2462
  return "immutable";
2463
2463
  }
2464
2464
  });
@@ -2592,9 +2592,9 @@ function co() {
2592
2592
  const uo = co();
2593
2593
  let lo = !0, fo = 0;
2594
2594
  function it(n) {
2595
- return Mt(`_${n}`, fo++);
2595
+ return Rt(`_${n}`, fo++);
2596
2596
  }
2597
- function Mt(n, e) {
2597
+ function Rt(n, e) {
2598
2598
  return `?${n}-${e}`;
2599
2599
  }
2600
2600
  class Qe extends Error {
@@ -2808,7 +2808,7 @@ function Xr(n, e, t, r, s) {
2808
2808
  });
2809
2809
  }
2810
2810
  function Ao(n, e, t, r) {
2811
- const s = Mt;
2811
+ const s = Rt;
2812
2812
  return r ? Xr(s, n, e, t, r).concat(nr(s, n, e, t)) : nr(s, n, e, t);
2813
2813
  }
2814
2814
  function Oo(n, e, t) {
@@ -2825,11 +2825,11 @@ function ko(n, e, t, { etype: r, level: s, form: i }, o) {
2825
2825
  var g, m, S;
2826
2826
  const b = !!(e.cardinalityInference && ((S = (m = (g = t.linkIndex) == null ? void 0 : g[r]) == null ? void 0 : m[y]) != null && S.isSingular));
2827
2827
  try {
2828
- const [_, T, M] = Eo(n, t, r, s, y, u), O = ns(e, t, {
2828
+ const [_, T, R] = Eo(n, t, r, s, y, u), O = ns(e, t, {
2829
2829
  etype: _,
2830
2830
  level: T,
2831
2831
  form: i[y],
2832
- join: M
2832
+ join: R
2833
2833
  }), F = b ? O[0] : O;
2834
2834
  return { [y]: F };
2835
2835
  } catch (_) {
@@ -2870,19 +2870,19 @@ function Po(n, e, t, r) {
2870
2870
  const s = es(n, e, r);
2871
2871
  return t === "desc" ? s < 0 : s > 0;
2872
2872
  }
2873
- function Mo(n, e) {
2873
+ function Ro(n, e) {
2874
2874
  const t = e[1];
2875
2875
  return n.getAttr(t);
2876
2876
  }
2877
- function Ro(n, e, t) {
2877
+ function Mo(n, e, t) {
2878
2878
  const r = Object.keys(t)[0];
2879
2879
  return ne(n, e, r);
2880
2880
  }
2881
2881
  function jo(n, e, t, r) {
2882
2882
  if (t)
2883
- return Mo(n, t);
2883
+ return Ro(n, t);
2884
2884
  if (r)
2885
- return Ro(n, e, r);
2885
+ return Mo(n, e, r);
2886
2886
  }
2887
2887
  function $o(n, e, t) {
2888
2888
  var s, i;
@@ -2908,8 +2908,8 @@ function xo(n, e, { etype: t, pageInfo: r, dq: s, form: i }) {
2908
2908
  const S = h["checked-data-type"] === "date", _ = h.id;
2909
2909
  u = u.map(([T]) => {
2910
2910
  var O, F, P, C, G;
2911
- let M = (G = (C = (P = (F = (O = n.eav.get(T)) == null ? void 0 : O.get(_)) == null ? void 0 : F.values()) == null ? void 0 : P.next()) == null ? void 0 : C.value) == null ? void 0 : G[2];
2912
- return S && (M = cn(M)), [T, M];
2911
+ let R = (G = (C = (P = (F = (O = n.eav.get(T)) == null ? void 0 : O.get(_)) == null ? void 0 : F.values()) == null ? void 0 : P.next()) == null ? void 0 : C.value) == null ? void 0 : G[2];
2912
+ return S && (R = cn(R)), [T, R];
2913
2913
  });
2914
2914
  }
2915
2915
  u.sort(c === "asc" ? function(_, T) {
@@ -2942,7 +2942,7 @@ function Uo(n, e, { etype: t, level: r, form: s, join: i, pageInfo: o }) {
2942
2942
  var h, y, b, g, m;
2943
2943
  if (!ts(s) && (!o || !o["start-cursor"]))
2944
2944
  return [];
2945
- const a = mo(Ao(e, t, r, (h = s.$) == null ? void 0 : h.where), i), c = Oo(Mt, t, r), u = (y = s.$) == null ? void 0 : y.fields, l = xo(n, e, {
2945
+ const a = mo(Ao(e, t, r, (h = s.$) == null ? void 0 : h.where), i), c = Oo(Rt, t, r), u = (y = s.$) == null ? void 0 : y.fields, l = xo(n, e, {
2946
2946
  etype: t,
2947
2947
  pageInfo: o,
2948
2948
  form: s,
@@ -2966,7 +2966,7 @@ function Lo(n, e, t) {
2966
2966
  }
2967
2967
  function ns(n, e, t) {
2968
2968
  const r = Lo(n, e, t);
2969
- return ko(Mt, n, e, t, r);
2969
+ return ko(Rt, n, e, t, r);
2970
2970
  }
2971
2971
  function Fo(n) {
2972
2972
  const e = {};
@@ -3405,9 +3405,9 @@ function ya({ attrsStore: n, schema: e }, t) {
3405
3405
  const _ = m[0];
3406
3406
  if (S) {
3407
3407
  f(g, S);
3408
- const T = o(g, S), M = a(g, S);
3409
- u(T), u(M);
3410
- const O = ((h = T == null ? void 0 : T["reverse-identity"]) == null ? void 0 : h[1]) || ((y = M == null ? void 0 : M["forward-identity"]) == null ? void 0 : y[1]) || S;
3408
+ const T = o(g, S), R = a(g, S);
3409
+ u(T), u(R);
3410
+ const O = ((h = T == null ? void 0 : T["reverse-identity"]) == null ? void 0 : h[1]) || ((y = R == null ? void 0 : R["forward-identity"]) == null ? void 0 : y[1]) || S;
3411
3411
  if (l(O, _))
3412
3412
  f(O, ln(_));
3413
3413
  else {
@@ -3426,11 +3426,11 @@ function ya({ attrsStore: n, schema: e }, t) {
3426
3426
  if (ua.has(g)) {
3427
3427
  const T = o(m, "id");
3428
3428
  u(T), T || c(yt(e, m, "id", { "unique?": !0 }));
3429
- for (const M of Object.keys(_)) {
3430
- const O = o(m, M);
3431
- if (u(O), fa.has(g) && (O || c(yt(e, m, M, M === "id" ? { "unique?": !0 } : null))), la.has(g)) {
3432
- const F = a(m, M);
3433
- !O && !F && c(or(e, m, M)), u(F);
3429
+ for (const R of Object.keys(_)) {
3430
+ const O = o(m, R);
3431
+ if (u(O), fa.has(g) && (O || c(yt(e, m, R, R === "id" ? { "unique?": !0 } : null))), la.has(g)) {
3432
+ const F = a(m, R);
3433
+ !O && !F && c(or(e, m, R)), u(F);
3434
3434
  }
3435
3435
  }
3436
3436
  }
@@ -3439,7 +3439,7 @@ function ya({ attrsStore: n, schema: e }, t) {
3439
3439
  const b = { ...n.attrs };
3440
3440
  for (const g of s)
3441
3441
  b[g.id] = g;
3442
- return [new Re(b, n.linkIndex), i];
3442
+ return [new Me(b, n.linkIndex), i];
3443
3443
  }
3444
3444
  return [n, i];
3445
3445
  }
@@ -3936,7 +3936,7 @@ class ie extends Error {
3936
3936
  return "InstantError";
3937
3937
  }
3938
3938
  }
3939
- class Rt extends ie {
3939
+ class Mt extends ie {
3940
3940
  constructor(t) {
3941
3941
  var i, o;
3942
3942
  const r = ((i = t.body) == null ? void 0 : i.message) || `API Error (${t.status})`;
@@ -3944,7 +3944,7 @@ class Rt extends ie {
3944
3944
  p(this, "body");
3945
3945
  p(this, "status");
3946
3946
  const s = new.target.prototype;
3947
- Object.setPrototypeOf && Object.setPrototypeOf(this, s), Error.captureStackTrace && Error.captureStackTrace(this, Rt), this.name = "InstantAPIError", this.status = t.status, this.body = t.body;
3947
+ Object.setPrototypeOf && Object.setPrototypeOf(this, s), Error.captureStackTrace && Error.captureStackTrace(this, Mt), this.name = "InstantAPIError", this.status = t.status, this.body = t.body;
3948
3948
  }
3949
3949
  get [Symbol.toStringTag]() {
3950
3950
  return "InstantAPIError";
@@ -3952,7 +3952,7 @@ class Rt extends ie {
3952
3952
  }
3953
3953
  async function we(n, e) {
3954
3954
  const t = await fetch(n, e), r = await t.json();
3955
- return t.status === 200 ? Promise.resolve(r) : Promise.reject(new Rt({ status: t.status, body: r }));
3955
+ return t.status === 200 ? Promise.resolve(r) : Promise.reject(new Mt({ status: t.status, body: r }));
3956
3956
  }
3957
3957
  function Aa({ apiURI: n, appId: e, email: t }) {
3958
3958
  return we(`${n}/runtime/auth/send_magic_code`, {
@@ -4045,7 +4045,7 @@ async function Pa({ apiURI: n, appId: e, path: t, file: r, refreshToken: s, cont
4045
4045
  body: r
4046
4046
  });
4047
4047
  }
4048
- async function Ma({ apiURI: n, appId: e, path: t, refreshToken: r }) {
4048
+ async function Ra({ apiURI: n, appId: e, path: t, refreshToken: r }) {
4049
4049
  const { data: s } = await we(`${n}/storage/files?app_id=${e}&filename=${encodeURIComponent(t)}`, {
4050
4050
  method: "DELETE",
4051
4051
  headers: {
@@ -4055,7 +4055,7 @@ async function Ma({ apiURI: n, appId: e, path: t, refreshToken: r }) {
4055
4055
  });
4056
4056
  return s;
4057
4057
  }
4058
- async function Ra({ apiURI: n, appId: e, fileName: t, refreshToken: r, metadata: s = {} }) {
4058
+ async function Ma({ apiURI: n, appId: e, fileName: t, refreshToken: r, metadata: s = {} }) {
4059
4059
  const { data: i } = await we(`${n}/storage/signed-upload-url`, {
4060
4060
  method: "POST",
4061
4061
  headers: {
@@ -4166,7 +4166,7 @@ function pr(n) {
4166
4166
  }, e;
4167
4167
  }, {});
4168
4168
  }
4169
- const fs = "v1.0.39-branch-codex-fix-weakhash-collision.26245034324.1";
4169
+ const fs = "v1.0.39";
4170
4170
  function Ua(n, e) {
4171
4171
  return {
4172
4172
  info: n ? (...t) => console.info(...t, e()) : () => {
@@ -4954,12 +4954,12 @@ class ec {
4954
4954
  const T = f[_];
4955
4955
  if (Pi(T.store, m)) {
4956
4956
  Tr(T.store, l.attrsStore, S);
4957
- const M = zt(s, T.store, l.attrsStore), O = Ya(T.store, l.attrsStore, S)[m];
4958
- M ? (h.push({
4957
+ const R = zt(s, T.store, l.attrsStore), O = Ya(T.store, l.attrsStore, S)[m];
4958
+ R ? (h.push({
4959
4959
  oldEntity: T.entity,
4960
- newEntity: M,
4960
+ newEntity: R,
4961
4961
  changedFields: O || {}
4962
- }), T.entity = M) : c.push(_), delete u[m];
4962
+ }), T.entity = R) : c.push(_), delete u[m];
4963
4963
  continue e;
4964
4964
  }
4965
4965
  }
@@ -5035,7 +5035,7 @@ function tc({ WStream: n, opts: e, startStream: t, appendStream: r, registerStre
5035
5035
  const h = [], y = [], b = [];
5036
5036
  let g = !1, m = 0, S = 0;
5037
5037
  const _ = [], T = new TextEncoder();
5038
- function M() {
5038
+ function R() {
5039
5039
  f = !0;
5040
5040
  for (const A of h)
5041
5041
  A(a ?? void 0);
@@ -5087,7 +5087,7 @@ function tc({ WStream: n, opts: e, startStream: t, appendStream: r, registerStre
5087
5087
  K > 0 && (m += H, S -= H, _.splice(0, K));
5088
5088
  }
5089
5089
  function z(A, k) {
5090
- a = k, M(), A.error(k), P();
5090
+ a = k, R(), A.error(k), P();
5091
5091
  }
5092
5092
  async function ee() {
5093
5093
  const A = await t({
@@ -5124,7 +5124,7 @@ function tc({ WStream: n, opts: e, startStream: t, appendStream: r, registerStre
5124
5124
  function j(A) {
5125
5125
  return l ? (z(A, new ie("Stream has been closed.")), null) : o || (z(A, new ie("Stream has not been initialized.")), null);
5126
5126
  }
5127
- async function R(A) {
5127
+ async function M(A) {
5128
5128
  c = A;
5129
5129
  let k = !0, K = 0;
5130
5130
  for (; k; ) {
@@ -5188,7 +5188,7 @@ function tc({ WStream: n, opts: e, startStream: t, appendStream: r, registerStre
5188
5188
  // browser restarts
5189
5189
  async start(A) {
5190
5190
  try {
5191
- await R(A);
5191
+ await M(A);
5192
5192
  } catch (k) {
5193
5193
  z(A, k);
5194
5194
  }
@@ -5208,7 +5208,7 @@ function tc({ WStream: n, opts: e, startStream: t, appendStream: r, registerStre
5208
5208
  chunks: [],
5209
5209
  offset: m + S,
5210
5210
  isDone: !0
5211
- }) : P(), M();
5211
+ }) : P(), R();
5212
5212
  },
5213
5213
  abort(A) {
5214
5214
  o ? r({
@@ -5217,7 +5217,7 @@ function tc({ WStream: n, opts: e, startStream: t, appendStream: r, registerStre
5217
5217
  offset: m + S,
5218
5218
  isDone: !0,
5219
5219
  abortReason: A
5220
- }) : P(), M();
5220
+ }) : P(), R();
5221
5221
  }
5222
5222
  }),
5223
5223
  addCompleteCb: F,
@@ -5313,16 +5313,16 @@ function rc({ RStream: n, opts: e, startStream: t, cancelStream: r }) {
5313
5313
  signal: z.signal
5314
5314
  });
5315
5315
  for (let q = 0; q < N.files.length; q++) {
5316
- const E = N.files[q + 1], R = await ee;
5317
- if (E && (ee = fetch(E.url, { signal: z.signal })), !R.ok) {
5316
+ const E = N.files[q + 1], M = await ee;
5317
+ if (E && (ee = fetch(E.url, { signal: z.signal })), !M.ok) {
5318
5318
  if (_++, _ > 10) {
5319
5319
  S(C, new ie("Unable to process stream."));
5320
5320
  return;
5321
5321
  }
5322
5322
  return { retry: !0 };
5323
5323
  }
5324
- if (R.body) {
5325
- const U = R.body.getReader();
5324
+ if (M.body) {
5325
+ const U = M.body.getReader();
5326
5326
  try {
5327
5327
  for (; ; ) {
5328
5328
  const { done: L, value: A } = await U.read();
@@ -5343,7 +5343,7 @@ function rc({ RStream: n, opts: e, startStream: t, cancelStream: r }) {
5343
5343
  U.releaseLock();
5344
5344
  }
5345
5345
  } else {
5346
- const U = await R.arrayBuffer();
5346
+ const U = await M.arrayBuffer();
5347
5347
  let L = U;
5348
5348
  if (i) {
5349
5349
  z.abort();
@@ -5369,7 +5369,7 @@ function rc({ RStream: n, opts: e, startStream: t, cancelStream: r }) {
5369
5369
  }
5370
5370
  }
5371
5371
  }
5372
- async function M(P) {
5372
+ async function R(P) {
5373
5373
  let C = !0, G = 0;
5374
5374
  for (; C; ) {
5375
5375
  C = !1;
@@ -5406,7 +5406,7 @@ function rc({ RStream: n, opts: e, startStream: t, cancelStream: r }) {
5406
5406
  return {
5407
5407
  stream: new O({
5408
5408
  start(P) {
5409
- M(P);
5409
+ R(P);
5410
5410
  },
5411
5411
  cancel(P) {
5412
5412
  i = !0, c && r({ eventId: c }), b();
@@ -5993,7 +5993,7 @@ class gc {
5993
5993
  s.resolve({ status: e, eventId: t });
5994
5994
  else if (r != null && r.type) {
5995
5995
  const { status: o, ...a } = r;
5996
- s.reject(new Rt({
5996
+ s.reject(new Mt({
5997
5997
  // @ts-expect-error body.type is not constant typed
5998
5998
  body: a,
5999
5999
  status: o ?? 0
@@ -6057,14 +6057,14 @@ class gc {
6057
6057
  const { q: y, result: b } = t, g = se(y);
6058
6058
  if (!this._hasQueryListeners() && !this.querySubs.currentValue[g])
6059
6059
  break;
6060
- const m = (c = (a = b == null ? void 0 : b[0]) == null ? void 0 : a.data) == null ? void 0 : c["page-info"], S = (l = (u = b == null ? void 0 : b[0]) == null ? void 0 : u.data) == null ? void 0 : l.aggregate, _ = hr(b), T = this.ensureAttrs(), M = tt(T, _, r, this.config.useDateObjects);
6060
+ const m = (c = (a = b == null ? void 0 : b[0]) == null ? void 0 : a.data) == null ? void 0 : c["page-info"], S = (l = (u = b == null ? void 0 : b[0]) == null ? void 0 : u.data) == null ? void 0 : l.aggregate, _ = hr(b), T = this.ensureAttrs(), R = tt(T, _, r, this.config.useDateObjects);
6061
6061
  this.querySubs.updateInPlace((O) => {
6062
6062
  if (!O[g]) {
6063
6063
  this._log.info("Missing value in querySubs", { hash: g, q: y });
6064
6064
  return;
6065
6065
  }
6066
6066
  O[g].result = {
6067
- store: M,
6067
+ store: R,
6068
6068
  attrsStore: T,
6069
6069
  pageInfo: m,
6070
6070
  aggregate: S,
@@ -6113,10 +6113,10 @@ class gc {
6113
6113
  T.pendingMutations = m;
6114
6114
  });
6115
6115
  const S = Bt(m.entries()), _ = y.map((T) => {
6116
- var q, E, j, R;
6117
- const M = T["instaql-query"], O = T["instaql-result"], F = se(M), P = hr(O), C = this.ensureAttrs(), G = tt(C, P, r, this.config.useDateObjects), { store: N, attrsStore: B } = this._applyOptimisticUpdates(G, C, S, g), z = (E = (q = O == null ? void 0 : O[0]) == null ? void 0 : q.data) == null ? void 0 : E["page-info"], ee = (R = (j = O == null ? void 0 : O[0]) == null ? void 0 : j.data) == null ? void 0 : R.aggregate;
6116
+ var q, E, j, M;
6117
+ const R = T["instaql-query"], O = T["instaql-result"], F = se(R), P = hr(O), C = this.ensureAttrs(), G = tt(C, P, r, this.config.useDateObjects), { store: N, attrsStore: B } = this._applyOptimisticUpdates(G, C, S, g), z = (E = (q = O == null ? void 0 : O[0]) == null ? void 0 : q.data) == null ? void 0 : E["page-info"], ee = (M = (j = O == null ? void 0 : O[0]) == null ? void 0 : j.data) == null ? void 0 : M.aggregate;
6118
6118
  return {
6119
- q: M,
6119
+ q: R,
6120
6120
  hash: F,
6121
6121
  store: N,
6122
6122
  attrsStore: B,
@@ -6124,10 +6124,10 @@ class gc {
6124
6124
  aggregate: ee
6125
6125
  };
6126
6126
  });
6127
- _.forEach(({ hash: T, q: M, store: O, attrsStore: F, pageInfo: P, aggregate: C }) => {
6127
+ _.forEach(({ hash: T, q: R, store: O, attrsStore: F, pageInfo: P, aggregate: C }) => {
6128
6128
  this.querySubs.updateInPlace((G) => {
6129
6129
  if (!G[T]) {
6130
- this._log.error("Missing value in querySubs", { hash: T, q: M });
6130
+ this._log.error("Missing value in querySubs", { hash: T, q: R });
6131
6131
  return;
6132
6132
  }
6133
6133
  G[T].result = {
@@ -6298,7 +6298,7 @@ class gc {
6298
6298
  i && (i.dfd.reject(s), this._completeQueryOnce(e, t, i.dfd));
6299
6299
  }
6300
6300
  _setAttrs(e) {
6301
- this.attrs = new Re(e.reduce((t, r) => (t[r.id] = r, t), {}), this._linkIndex), this.notifyAttrsSubs();
6301
+ this.attrs = new Me(e.reduce((t, r) => (t[r.id] = r, t), {}), this._linkIndex), this.notifyAttrsSubs();
6302
6302
  }
6303
6303
  _startQuerySub(e, t) {
6304
6304
  const r = J();
@@ -6320,10 +6320,13 @@ class gc {
6320
6320
  return;
6321
6321
  await this.querySubs.waitForKeyToLoad(r);
6322
6322
  const s = this.querySubs.currentValue[r];
6323
- s && (this.querySubs.updateInPlace((i) => {
6324
- const o = i[t];
6325
- o && !o.result && s.result ? o.result = s.result : o || (i[t] = s), delete i[r];
6326
- }), s.result && this.notifyOne(t));
6323
+ if (!s)
6324
+ return;
6325
+ let i = !1;
6326
+ this.querySubs.updateInPlace((o) => {
6327
+ const a = o[t];
6328
+ a && !a.result && s.result ? (a.result = s.result, i = !0) : a || (o[t] = s, i = !!s.result), delete o[r];
6329
+ }), i && this.notifyOne(t);
6327
6330
  }
6328
6331
  subscribeTable(e, t) {
6329
6332
  return this._syncTable.subscribe(e, t);
@@ -6451,13 +6454,13 @@ class gc {
6451
6454
  r.push(u);
6452
6455
  }
6453
6456
  if (!t.size && !r.length)
6454
- return this.attrs || new Re({}, this._linkIndex);
6457
+ return this.attrs || new Me({}, this._linkIndex);
6455
6458
  const s = { ...((o = this.attrs) == null ? void 0 : o.attrs) || {} };
6456
6459
  for (const a of r)
6457
6460
  s[a.id] = a;
6458
6461
  for (const a of t)
6459
6462
  delete s[a];
6460
- return new Re(s, this._linkIndex);
6463
+ return new Me(s, this._linkIndex);
6461
6464
  }
6462
6465
  /** Runs instaql on a query and a store */
6463
6466
  dataForQuery(e, t = !0) {
@@ -7132,7 +7135,7 @@ class gc {
7132
7135
  async deleteFile(e) {
7133
7136
  var i;
7134
7137
  const t = await this.getCurrentUser(), r = (i = t == null ? void 0 : t.user) == null ? void 0 : i.refresh_token;
7135
- return await Ma({
7138
+ return await Ra({
7136
7139
  apiURI: this.config.apiURI,
7137
7140
  appId: this.config.appId,
7138
7141
  path: e,
@@ -7143,7 +7146,7 @@ class gc {
7143
7146
  // ---------------------------------
7144
7147
  async upload(e, t) {
7145
7148
  var c;
7146
- const r = await this.getCurrentUser(), s = (c = r == null ? void 0 : r.user) == null ? void 0 : c.refresh_token, i = e || t.name, o = await Ra({
7149
+ const r = await this.getCurrentUser(), s = (c = r == null ? void 0 : r.user) == null ? void 0 : c.refresh_token, i = e || t.name, o = await Ma({
7147
7150
  apiURI: this.config.apiURI,
7148
7151
  appId: this.config.appId,
7149
7152
  fileName: i,
@@ -7318,15 +7321,15 @@ const Oc = (n) => JSON.stringify(n), rt = (n, e = !1) => JSON.stringify([n, e]),
7318
7321
  u.set(rt(E, j.afterInclusive), j), S();
7319
7322
  }, T = (E, j) => {
7320
7323
  l.set(rt(E), j), C(), S();
7321
- }, M = (E, j) => {
7324
+ }, R = (E, j) => {
7322
7325
  var A, k;
7323
- const { cursor: R } = vr(E), U = f.get(Ne("reverse", R));
7326
+ const { cursor: M } = vr(E), U = f.get(Ne("reverse", M));
7324
7327
  U == null || U();
7325
7328
  const L = n.subscribeQuery({
7326
7329
  [a]: {
7327
7330
  ...i,
7328
7331
  $: {
7329
- after: R,
7332
+ after: M,
7330
7333
  before: j.endCursor,
7331
7334
  beforeInclusive: !0,
7332
7335
  where: (A = i.$) == null ? void 0 : A.where,
@@ -7338,23 +7341,23 @@ const Oc = (n) => JSON.stringify(n), rt = (n, e = !1) => JSON.stringify([n, e]),
7338
7341
  if (K.error)
7339
7342
  return m(K.error);
7340
7343
  const H = K.data[a], Y = K.pageInfo[a];
7341
- Ze(H && Y, "Expected query subscription to contain rows and pageInfo"), T(R, {
7344
+ Ze(H && Y, "Expected query subscription to contain rows and pageInfo"), T(M, {
7342
7345
  data: H,
7343
7346
  status: "frozen",
7344
7347
  hasMore: Y.hasNextPage,
7345
7348
  endCursor: Y.endCursor
7346
7349
  });
7347
7350
  }, r);
7348
- f.set(Ne("reverse", R), L);
7351
+ f.set(Ne("reverse", M), L);
7349
7352
  }, O = (E) => {
7350
- var R, U;
7353
+ var M, U;
7351
7354
  const j = n.subscribeQuery({
7352
7355
  [a]: {
7353
7356
  ...i,
7354
7357
  $: {
7355
7358
  limit: o,
7356
7359
  after: E,
7357
- where: (R = i.$) == null ? void 0 : R.where,
7360
+ where: (M = i.$) == null ? void 0 : M.where,
7358
7361
  fields: (U = i.$) == null ? void 0 : U.fields,
7359
7362
  order: Ar(c)
7360
7363
  }
@@ -7373,7 +7376,7 @@ const Oc = (n) => JSON.stringify(n), rt = (n, e = !1) => JSON.stringify([n, e]),
7373
7376
  f.set(Ne("reverse", E), j);
7374
7377
  }, F = (E, j = !1) => {
7375
7378
  var U, L;
7376
- const R = n.subscribeQuery({
7379
+ const M = n.subscribeQuery({
7377
7380
  [a]: {
7378
7381
  ...i,
7379
7382
  $: {
@@ -7397,12 +7400,12 @@ const Oc = (n) => JSON.stringify(n), rt = (n, e = !1) => JSON.stringify([n, e]),
7397
7400
  afterInclusive: j
7398
7401
  });
7399
7402
  }, r);
7400
- f.set(Ne("forward", E, j), R);
7403
+ f.set(Ne("forward", E, j), M);
7401
7404
  }, P = (E, j = !1) => {
7402
7405
  var k, K;
7403
- const R = rt(E, j), U = f.get(Ne("forward", E, j));
7406
+ const M = rt(E, j), U = f.get(Ne("forward", E, j));
7404
7407
  U == null || U();
7405
- const L = u.get(R);
7408
+ const L = u.get(M);
7406
7409
  if (!(L != null && L.endCursor))
7407
7410
  return;
7408
7411
  const A = n.subscribeQuery({
@@ -7435,20 +7438,20 @@ const Oc = (n) => JSON.stringify(n), rt = (n, e = !1) => JSON.stringify([n, e]),
7435
7438
  const E = Array.from(l.entries()).at(-1);
7436
7439
  if (!E)
7437
7440
  return;
7438
- const [j, R] = E;
7439
- if (!(R != null && R.hasMore) || !Ec(R))
7441
+ const [j, M] = E;
7442
+ if (!(M != null && M.hasMore) || !Ec(M))
7440
7443
  return;
7441
- const U = `${j}:${Oc(R.endCursor)}`;
7442
- U != b && (b = U, M(j, R), O(R.endCursor));
7444
+ const U = `${j}:${Oc(M.endCursor)}`;
7445
+ U != b && (b = U, R(j, M), O(M.endCursor));
7443
7446
  }, G = () => {
7444
7447
  const E = Array.from(u.entries()).at(-1);
7445
7448
  if (!E)
7446
7449
  return;
7447
- const [j, R] = E;
7448
- if (!R.endCursor)
7450
+ const [j, M] = E;
7451
+ if (!M.endCursor)
7449
7452
  return;
7450
7453
  const { cursor: U, afterInclusive: L } = vr(j);
7451
- P(U, L), F(R.endCursor);
7454
+ P(U, L), F(M.endCursor);
7452
7455
  };
7453
7456
  return g = n.subscribeQuery({
7454
7457
  [a]: {
@@ -7466,10 +7469,10 @@ const Oc = (n) => JSON.stringify(n), rt = (n, e = !1) => JSON.stringify([n, e]),
7466
7469
  return;
7467
7470
  if (E.error)
7468
7471
  return m(E.error);
7469
- const j = E.pageInfo[a], R = (L = E == null ? void 0 : E.data) == null ? void 0 : L[a];
7470
- if (Ze(R && j, "Expected rows and pageInfo"), R.length < o) {
7472
+ const j = E.pageInfo[a], M = (L = E == null ? void 0 : E.data) == null ? void 0 : L[a];
7473
+ if (Ze(M && j, "Expected rows and pageInfo"), M.length < o) {
7471
7474
  _(Gt, {
7472
- data: R,
7475
+ data: M,
7473
7476
  status: "pre-bootstrap"
7474
7477
  });
7475
7478
  return;
@@ -7477,7 +7480,7 @@ const Oc = (n) => JSON.stringify(n), rt = (n, e = !1) => JSON.stringify([n, e]),
7477
7480
  const U = j.startCursor;
7478
7481
  if (!U) {
7479
7482
  _(Gt, {
7480
- data: R,
7483
+ data: M,
7481
7484
  status: "pre-bootstrap"
7482
7485
  });
7483
7486
  return;
@@ -7531,11 +7534,11 @@ const Oc = (n) => JSON.stringify(n), rt = (n, e = !1) => JSON.stringify([n, e]),
7531
7534
  if (!t || !r)
7532
7535
  throw new Q("No query provided for infinite query");
7533
7536
  return { entityName: t, entityQuery: r };
7534
- }, Mc = {
7537
+ }, Rc = {
7535
7538
  apiURI: "https://api.instantdb.com",
7536
7539
  websocketURI: "wss://api.instantdb.com/runtime/session"
7537
7540
  };
7538
- function Rc() {
7541
+ function Mc() {
7539
7542
  return globalThis.__instantDbSchemaHashStore = globalThis.__instantDbSchemaHashStore ?? /* @__PURE__ */ new WeakMap(), globalThis.__instantDbSchemaHashStore;
7540
7543
  }
7541
7544
  function jc() {
@@ -7545,7 +7548,7 @@ function pn(n) {
7545
7548
  const e = n.__adminToken, t = n.__extraDedupeKey;
7546
7549
  return n.appId + "_" + (n.websocketURI || "default_ws_uri") + "_" + (n.apiURI || "default_api_uri") + "_" + (e || "client_only") + "_" + n.useDateObjects + "_" + (t || "");
7547
7550
  }
7548
- const yn = jc(), Or = Rc();
7551
+ const yn = jc(), Or = Mc();
7549
7552
  class $c {
7550
7553
  constructor(e) {
7551
7554
  p(this, "db");
@@ -7975,7 +7978,7 @@ function Fc(n, e, t, r, s) {
7975
7978
  if (o)
7976
7979
  return Lc(o, i.schema) && o._reactor.updateSchema(i.schema), o;
7977
7980
  const a = new gc({
7978
- ...Mc,
7981
+ ...Rc,
7979
7982
  ...i,
7980
7983
  cardinalityInference: !!i.schema
7981
7984
  }, e || os, t || as, { ...r || {}, "@instantdb/core": fs }, s), c = new Uc(a);