@instantdb/react-common 0.22.34 → 0.22.35-experimental.drewh-cookie-sync-endpoint.18847838801.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.
@@ -9,10 +9,10 @@ var xt = { exports: {} }, De = {};
9
9
  * This source code is licensed under the MIT license found in the
10
10
  * LICENSE file in the root directory of this source tree.
11
11
  */
12
- var Rn;
12
+ var Mn;
13
13
  function Oi() {
14
- if (Rn) return De;
15
- Rn = 1;
14
+ if (Mn) return De;
15
+ Mn = 1;
16
16
  var e = hr, t = Symbol.for("react.element"), n = Symbol.for("react.fragment"), r = Object.prototype.hasOwnProperty, i = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, s = { key: !0, ref: !0, __self: !0, __source: !0 };
17
17
  function o(u, a, d) {
18
18
  var c, f = {}, h = null, p = null;
@@ -23,10 +23,10 @@ function Oi() {
23
23
  }
24
24
  return De.Fragment = n, De.jsx = o, De.jsxs = o, De;
25
25
  }
26
- var xe = {}, Mn;
26
+ var xe = {}, Rn;
27
27
  function Ei() {
28
- if (Mn) return xe;
29
- Mn = 1;
28
+ if (Rn) return xe;
29
+ Rn = 1;
30
30
  var e = {};
31
31
  /**
32
32
  * @license React
@@ -57,20 +57,20 @@ function Ei() {
57
57
  {
58
58
  var v = m.ReactDebugCurrentFrame, j = v.getStackAddendum();
59
59
  j !== "" && (y += "%s", _ = _.concat([j]));
60
- var P = _.map(function(C) {
60
+ var k = _.map(function(C) {
61
61
  return String(C);
62
62
  });
63
- P.unshift("Warning: " + y), Function.prototype.apply.call(console[l], console, P);
63
+ k.unshift("Warning: " + y), Function.prototype.apply.call(console[l], console, k);
64
64
  }
65
65
  }
66
- var O = !1, x = !1, N = !1, de = !1, ae = !1, Me;
67
- Me = Symbol.for("react.module.reference");
66
+ var O = !1, x = !1, N = !1, de = !1, ae = !1, Re;
67
+ Re = Symbol.for("react.module.reference");
68
68
  function Be(l) {
69
69
  return !!(typeof l == "string" || typeof l == "function" || l === i || l === o || ae || l === s || l === c || l === f || de || l === b || O || x || N || typeof l == "object" && l !== null && (l.$$typeof === p || l.$$typeof === h || l.$$typeof === u || l.$$typeof === a || l.$$typeof === d || // This needs to include all possible module reference object
70
70
  // types supported by any Flight configuration anywhere since
71
71
  // we don't know which Flight build this will end up being used
72
72
  // with.
73
- l.$$typeof === Me || l.getModuleId !== void 0));
73
+ l.$$typeof === Re || l.getModuleId !== void 0));
74
74
  }
75
75
  function Qe(l, y, _) {
76
76
  var v = l.displayName;
@@ -79,7 +79,7 @@ function Ei() {
79
79
  var j = y.displayName || y.name || "";
80
80
  return j !== "" ? _ + "(" + j + ")" : _;
81
81
  }
82
- function k(l) {
82
+ function P(l) {
83
83
  return l.displayName || "Context";
84
84
  }
85
85
  function U(l) {
@@ -107,19 +107,19 @@ function Ei() {
107
107
  switch (l.$$typeof) {
108
108
  case a:
109
109
  var y = l;
110
- return k(y) + ".Consumer";
110
+ return P(y) + ".Consumer";
111
111
  case u:
112
112
  var _ = l;
113
- return k(_._context) + ".Provider";
113
+ return P(_._context) + ".Provider";
114
114
  case d:
115
115
  return Qe(l, l.render, "ForwardRef");
116
116
  case h:
117
117
  var v = l.displayName || null;
118
118
  return v !== null ? v : U(l.type) || "Memo";
119
119
  case p: {
120
- var j = l, P = j._payload, C = j._init;
120
+ var j = l, k = j._payload, C = j._init;
121
121
  try {
122
- return U(C(P));
122
+ return U(C(k));
123
123
  } catch {
124
124
  return null;
125
125
  }
@@ -127,7 +127,7 @@ function Ei() {
127
127
  }
128
128
  return null;
129
129
  }
130
- var z = Object.assign, B = 0, re, ie, Z, Ge, Ye, He, Je;
130
+ var K = Object.assign, B = 0, re, ie, Z, Ge, Ye, He, Je;
131
131
  function Ze() {
132
132
  }
133
133
  Ze.__reactDisabledLog = !0;
@@ -163,25 +163,25 @@ function Ei() {
163
163
  writable: !0
164
164
  };
165
165
  Object.defineProperties(console, {
166
- log: z({}, l, {
166
+ log: K({}, l, {
167
167
  value: re
168
168
  }),
169
- info: z({}, l, {
169
+ info: K({}, l, {
170
170
  value: ie
171
171
  }),
172
- warn: z({}, l, {
172
+ warn: K({}, l, {
173
173
  value: Z
174
174
  }),
175
- error: z({}, l, {
175
+ error: K({}, l, {
176
176
  value: Ge
177
177
  }),
178
- group: z({}, l, {
178
+ group: K({}, l, {
179
179
  value: Ye
180
180
  }),
181
- groupCollapsed: z({}, l, {
181
+ groupCollapsed: K({}, l, {
182
182
  value: He
183
183
  }),
184
- groupEnd: z({}, l, {
184
+ groupEnd: K({}, l, {
185
185
  value: Je
186
186
  })
187
187
  });
@@ -220,8 +220,8 @@ function Ei() {
220
220
  St = !0;
221
221
  var j = Error.prepareStackTrace;
222
222
  Error.prepareStackTrace = void 0;
223
- var P;
224
- P = wt.current, wt.current = null, Tt();
223
+ var k;
224
+ k = wt.current, wt.current = null, Tt();
225
225
  try {
226
226
  if (y) {
227
227
  var C = function() {
@@ -258,23 +258,23 @@ function Ei() {
258
258
  if (Q && v && typeof Q.stack == "string") {
259
259
  for (var E = Q.stack.split(`
260
260
  `), W = v.stack.split(`
261
- `), R = E.length - 1, $ = W.length - 1; R >= 1 && $ >= 0 && E[R] !== W[$]; )
262
- $--;
263
- for (; R >= 1 && $ >= 0; R--, $--)
264
- if (E[R] !== W[$]) {
265
- if (R !== 1 || $ !== 1)
261
+ `), M = E.length - 1, D = W.length - 1; M >= 1 && D >= 0 && E[M] !== W[D]; )
262
+ D--;
263
+ for (; M >= 1 && D >= 0; M--, D--)
264
+ if (E[M] !== W[D]) {
265
+ if (M !== 1 || D !== 1)
266
266
  do
267
- if (R--, $--, $ < 0 || E[R] !== W[$]) {
267
+ if (M--, D--, D < 0 || E[M] !== W[D]) {
268
268
  var te = `
269
- ` + E[R].replace(" at new ", " at ");
269
+ ` + E[M].replace(" at new ", " at ");
270
270
  return l.displayName && te.includes("<anonymous>") && (te = te.replace("<anonymous>", l.displayName)), typeof l == "function" && et.set(l, te), te;
271
271
  }
272
- while (R >= 1 && $ >= 0);
272
+ while (M >= 1 && D >= 0);
273
273
  break;
274
274
  }
275
275
  }
276
276
  } finally {
277
- St = !1, wt.current = P, Zr(), Error.prepareStackTrace = j;
277
+ St = !1, wt.current = k, Zr(), Error.prepareStackTrace = j;
278
278
  }
279
279
  var Oe = l ? l.displayName || l.name : "", be = Oe ? Xe(Oe) : "";
280
280
  return typeof l == "function" && et.set(l, be), be;
@@ -306,9 +306,9 @@ function Ei() {
306
306
  case h:
307
307
  return tt(l.type, y, _);
308
308
  case p: {
309
- var v = l, j = v._payload, P = v._init;
309
+ var v = l, j = v._payload, k = v._init;
310
310
  try {
311
- return tt(P(j), y, _);
311
+ return tt(k(j), y, _);
312
312
  } catch {
313
313
  }
314
314
  }
@@ -325,9 +325,9 @@ function Ei() {
325
325
  }
326
326
  function ni(l, y, _, v, j) {
327
327
  {
328
- var P = Function.call.bind($e);
328
+ var k = Function.call.bind($e);
329
329
  for (var C in l)
330
- if (P(l, C)) {
330
+ if (k(l, C)) {
331
331
  var E = void 0;
332
332
  try {
333
333
  if (typeof l[C] != "function") {
@@ -335,8 +335,8 @@ function Ei() {
335
335
  throw W.name = "Invariant Violation", W;
336
336
  }
337
337
  E = l[C](y, C, v, _, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
338
- } catch (R) {
339
- E = R;
338
+ } catch (M) {
339
+ E = M;
340
340
  }
341
341
  E && !(E instanceof Error) && (nt(j), S("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", v || "React class", _, C, typeof E), nt(null)), E instanceof Error && !(E.message in gn) && (gn[E.message] = !0, nt(j), S("Failed %s type: %s", _, E.message), nt(null));
342
342
  }
@@ -413,7 +413,7 @@ function Ei() {
413
413
  });
414
414
  }
415
415
  }
416
- var li = function(l, y, _, v, j, P, C) {
416
+ var li = function(l, y, _, v, j, k, C) {
417
417
  var E = {
418
418
  // This tag allows us to uniquely identify this as a React Element
419
419
  $$typeof: n,
@@ -423,7 +423,7 @@ function Ei() {
423
423
  ref: _,
424
424
  props: C,
425
425
  // Record the component responsible for creating this element.
426
- _owner: P
426
+ _owner: k
427
427
  };
428
428
  return E._store = {}, Object.defineProperty(E._store, "validated", {
429
429
  configurable: !1,
@@ -444,18 +444,18 @@ function Ei() {
444
444
  };
445
445
  function hi(l, y, _, v, j) {
446
446
  {
447
- var P, C = {}, E = null, W = null;
447
+ var k, C = {}, E = null, W = null;
448
448
  _ !== void 0 && (mn(_), E = "" + _), ai(y) && (mn(y.key), E = "" + y.key), ui(y) && (W = y.ref, ci(y, j));
449
- for (P in y)
450
- $e.call(y, P) && !oi.hasOwnProperty(P) && (C[P] = y[P]);
449
+ for (k in y)
450
+ $e.call(y, k) && !oi.hasOwnProperty(k) && (C[k] = y[k]);
451
451
  if (l && l.defaultProps) {
452
- var R = l.defaultProps;
453
- for (P in R)
454
- C[P] === void 0 && (C[P] = R[P]);
452
+ var M = l.defaultProps;
453
+ for (k in M)
454
+ C[k] === void 0 && (C[k] = M[k]);
455
455
  }
456
456
  if (E || W) {
457
- var $ = typeof l == "function" ? l.displayName || l.name || "Unknown" : l;
458
- E && di(C, $), W && fi(C, $);
457
+ var D = typeof l == "function" ? l.displayName || l.name || "Unknown" : l;
458
+ E && di(C, D), W && fi(C, D);
459
459
  }
460
460
  return li(l, E, W, j, v, Sn.current, C);
461
461
  }
@@ -528,7 +528,7 @@ Check the top-level render call using <` + _ + ">.");
528
528
  else if (l) {
529
529
  var j = T(l);
530
530
  if (typeof j == "function" && j !== l.entries)
531
- for (var P = j.call(l), C; !(C = P.next()).done; )
531
+ for (var k = j.call(l), C; !(C = k.next()).done; )
532
532
  At(C.value) && jn(C.value, y);
533
533
  }
534
534
  }
@@ -571,7 +571,7 @@ Check the top-level render call using <` + _ + ">.");
571
571
  }
572
572
  }
573
573
  var kn = {};
574
- function In(l, y, _, v, j, P) {
574
+ function In(l, y, _, v, j, k) {
575
575
  {
576
576
  var C = Be(l);
577
577
  if (!C) {
@@ -579,12 +579,12 @@ Check the top-level render call using <` + _ + ">.");
579
579
  (l === void 0 || typeof l == "object" && l !== null && Object.keys(l).length === 0) && (E += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
580
580
  var W = pi();
581
581
  W ? E += W : E += An();
582
- var R;
583
- l === null ? R = "null" : vt(l) ? R = "array" : l !== void 0 && l.$$typeof === n ? (R = "<" + (U(l.type) || "Unknown") + " />", E = " Did you accidentally export a JSX literal instead of a component?") : R = typeof l, S("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", R, E);
582
+ var M;
583
+ l === null ? M = "null" : vt(l) ? M = "array" : l !== void 0 && l.$$typeof === n ? (M = "<" + (U(l.type) || "Unknown") + " />", E = " Did you accidentally export a JSX literal instead of a component?") : M = typeof l, S("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", M, E);
584
584
  }
585
- var $ = hi(l, y, _, j, P);
586
- if ($ == null)
587
- return $;
585
+ var D = hi(l, y, _, j, k);
586
+ if (D == null)
587
+ return D;
588
588
  if (C) {
589
589
  var te = y.children;
590
590
  if (te !== void 0)
@@ -612,7 +612,7 @@ React keys must be passed directly to JSX without using spread:
612
612
  <%s key={someKey} {...props} />`, Ct, be, Si, be), kn[be + Ct] = !0;
613
613
  }
614
614
  }
615
- return l === i ? _i($) : bi($), $;
615
+ return l === i ? _i(D) : bi(D), D;
616
616
  }
617
617
  }
618
618
  function gi(l, y, _) {
@@ -666,7 +666,7 @@ function G(e) {
666
666
  }
667
667
  return G(String(e));
668
668
  }
669
- const M = {
669
+ const $ = {
670
670
  Remove: "remove",
671
671
  Replace: "replace",
672
672
  Add: "add"
@@ -822,7 +822,7 @@ function _r(e, t) {
822
822
  } else
823
823
  throw new Error("Please check mark() to ensure that it is a stable marker draftable function.");
824
824
  }
825
- function K(e) {
825
+ function z(e) {
826
826
  e.copy || (e.copy = _r(e.original, e.options));
827
827
  }
828
828
  function Le(e) {
@@ -931,7 +931,7 @@ function gr(e, t, n) {
931
931
  var u;
932
932
  if (me(o)) {
933
933
  const a = A(o);
934
- K(a);
934
+ z(a);
935
935
  const d = !((u = a.assignedMap) === null || u === void 0) && u.size || a.operated ? a.copy : a.original;
936
936
  We(r ? i : e, s, d);
937
937
  } else
@@ -975,19 +975,19 @@ function an(e, t, n, r) {
975
975
  he(pe(s, t), n) && Ii(e, t);
976
976
  });
977
977
  }
978
- function Ri(e, t, n, r, i) {
978
+ function Mi(e, t, n, r, i) {
979
979
  let { original: s, assignedMap: o, options: u } = e, a = e.copy;
980
980
  a.length < s.length && ([s, a] = [a, s], [n, r] = [r, n]);
981
981
  for (let d = 0; d < s.length; d += 1)
982
982
  if (o.get(d.toString()) && a[d] !== s[d]) {
983
983
  const c = t.concat([d]), f = ge(c, i);
984
984
  n.push({
985
- op: M.Replace,
985
+ op: $.Replace,
986
986
  path: f,
987
987
  // If it is a draft, it needs to be deep cloned, and it may also be non-draft.
988
988
  value: at(a[d])
989
989
  }), r.push({
990
- op: M.Replace,
990
+ op: $.Replace,
991
991
  path: f,
992
992
  // If it is a draft, it needs to be deep cloned, and it may also be non-draft.
993
993
  value: at(s[d])
@@ -996,7 +996,7 @@ function Ri(e, t, n, r, i) {
996
996
  for (let d = s.length; d < a.length; d += 1) {
997
997
  const c = t.concat([d]), f = ge(c, i);
998
998
  n.push({
999
- op: M.Add,
999
+ op: $.Add,
1000
1000
  path: f,
1001
1001
  // If it is a draft, it needs to be deep cloned, and it may also be non-draft.
1002
1002
  value: at(a[d])
@@ -1007,7 +1007,7 @@ function Ri(e, t, n, r, i) {
1007
1007
  if (d) {
1008
1008
  const c = t.concat(["length"]), f = ge(c, i);
1009
1009
  r.push({
1010
- op: M.Replace,
1010
+ op: $.Replace,
1011
1011
  path: f,
1012
1012
  value: s.length
1013
1013
  });
@@ -1015,19 +1015,19 @@ function Ri(e, t, n, r, i) {
1015
1015
  for (let c = a.length; s.length < c; c -= 1) {
1016
1016
  const f = t.concat([c - 1]), h = ge(f, i);
1017
1017
  r.push({
1018
- op: M.Remove,
1018
+ op: $.Remove,
1019
1019
  path: h
1020
1020
  });
1021
1021
  }
1022
1022
  }
1023
1023
  }
1024
- function Mi({ original: e, copy: t, assignedMap: n }, r, i, s, o) {
1024
+ function Ri({ original: e, copy: t, assignedMap: n }, r, i, s, o) {
1025
1025
  n.forEach((u, a) => {
1026
- const d = pe(e, a), c = at(pe(t, a)), f = u ? Ne(e, a) ? M.Replace : M.Add : M.Remove;
1027
- if (he(d, c) && f === M.Replace)
1026
+ const d = pe(e, a), c = at(pe(t, a)), f = u ? Ne(e, a) ? $.Replace : $.Add : $.Remove;
1027
+ if (he(d, c) && f === $.Replace)
1028
1028
  return;
1029
1029
  const h = r.concat(a), p = ge(h, o);
1030
- i.push(f === M.Remove ? { op: f, path: p } : { op: f, path: p, value: c }), s.push(f === M.Add ? { op: M.Remove, path: p } : f === M.Remove ? { op: M.Add, path: p, value: d } : { op: M.Replace, path: p, value: d });
1030
+ i.push(f === $.Remove ? { op: f, path: p } : { op: f, path: p, value: c }), s.push(f === $.Add ? { op: $.Remove, path: p } : f === $.Remove ? { op: $.Add, path: p, value: d } : { op: $.Replace, path: p, value: d });
1031
1031
  });
1032
1032
  }
1033
1033
  function $i({ original: e, copy: t }, n, r, i, s) {
@@ -1036,11 +1036,11 @@ function $i({ original: e, copy: t }, n, r, i, s) {
1036
1036
  if (!t.has(u)) {
1037
1037
  const a = n.concat([o]), d = ge(a, s);
1038
1038
  r.push({
1039
- op: M.Remove,
1039
+ op: $.Remove,
1040
1040
  path: d,
1041
1041
  value: u
1042
1042
  }), i.unshift({
1043
- op: M.Add,
1043
+ op: $.Add,
1044
1044
  path: d,
1045
1045
  value: u
1046
1046
  });
@@ -1050,11 +1050,11 @@ function $i({ original: e, copy: t }, n, r, i, s) {
1050
1050
  if (!e.has(u)) {
1051
1051
  const a = n.concat([o]), d = ge(a, s);
1052
1052
  r.push({
1053
- op: M.Add,
1053
+ op: $.Add,
1054
1054
  path: d,
1055
1055
  value: u
1056
1056
  }), i.unshift({
1057
- op: M.Remove,
1057
+ op: $.Remove,
1058
1058
  path: d,
1059
1059
  value: u
1060
1060
  });
@@ -1067,9 +1067,9 @@ function qe(e, t, n, r) {
1067
1067
  switch (e.type) {
1068
1068
  case 0:
1069
1069
  case 2:
1070
- return Mi(e, t, n, r, i);
1071
- case 1:
1072
1070
  return Ri(e, t, n, r, i);
1071
+ case 1:
1072
+ return Mi(e, t, n, r, i);
1073
1073
  case 3:
1074
1074
  return $i(e, t, n, r, i);
1075
1075
  }
@@ -1086,18 +1086,18 @@ const ft = (e, t, n = !1) => {
1086
1086
  },
1087
1087
  set(e, t) {
1088
1088
  const n = A(this), r = X(n);
1089
- return (!r.has(e) || !he(r.get(e), t)) && (K(n), ce(n), n.assignedMap.set(e, !0), n.copy.set(e, t), an(n, e, t, qe)), this;
1089
+ return (!r.has(e) || !he(r.get(e), t)) && (z(n), ce(n), n.assignedMap.set(e, !0), n.copy.set(e, t), an(n, e, t, qe)), this;
1090
1090
  },
1091
1091
  delete(e) {
1092
1092
  if (!this.has(e))
1093
1093
  return !1;
1094
1094
  const t = A(this);
1095
- return K(t), ce(t), t.original.has(e) ? t.assignedMap.set(e, !1) : t.assignedMap.delete(e), t.copy.delete(e), !0;
1095
+ return z(t), ce(t), t.original.has(e) ? t.assignedMap.set(e, !1) : t.assignedMap.delete(e), t.copy.delete(e), !0;
1096
1096
  },
1097
1097
  clear() {
1098
1098
  const e = A(this);
1099
1099
  if (this.size) {
1100
- K(e), ce(e), e.assignedMap = /* @__PURE__ */ new Map();
1100
+ z(e), ce(e), e.assignedMap = /* @__PURE__ */ new Map();
1101
1101
  for (const [t] of e.original)
1102
1102
  e.assignedMap.set(t, !1);
1103
1103
  e.copy.clear();
@@ -1121,7 +1121,7 @@ const ft = (e, t, n = !1) => {
1121
1121
  finalities: r.finalities,
1122
1122
  options: r.options
1123
1123
  });
1124
- return K(r), r.copy.set(e, o), o;
1124
+ return z(r), r.copy.set(e, o), o;
1125
1125
  },
1126
1126
  keys() {
1127
1127
  return X(A(this)).keys();
@@ -1188,19 +1188,19 @@ const ft = (e, t, n = !1) => {
1188
1188
  const t = A(this);
1189
1189
  if (t.setMap.has(e))
1190
1190
  return !0;
1191
- K(t);
1191
+ z(t);
1192
1192
  const n = A(e);
1193
1193
  return !!(n && t.setMap.has(n.original));
1194
1194
  },
1195
1195
  add(e) {
1196
1196
  const t = A(this);
1197
- return this.has(e) || (K(t), ce(t), t.assignedMap.set(e, !0), t.setMap.set(e, e), an(t, e, e, qe)), this;
1197
+ return this.has(e) || (z(t), ce(t), t.assignedMap.set(e, !0), t.setMap.set(e, e), an(t, e, e, qe)), this;
1198
1198
  },
1199
1199
  delete(e) {
1200
1200
  if (!this.has(e))
1201
1201
  return !1;
1202
1202
  const t = A(this);
1203
- K(t), ce(t);
1203
+ z(t), ce(t);
1204
1204
  const n = A(e);
1205
1205
  return n && t.setMap.has(n.original) ? (t.assignedMap.set(n.original, !1), t.setMap.delete(n.original)) : (!n && t.setMap.has(e) ? t.assignedMap.set(e, !1) : t.assignedMap.delete(e), t.setMap.delete(e));
1206
1206
  },
@@ -1208,14 +1208,14 @@ const ft = (e, t, n = !1) => {
1208
1208
  if (!this.size)
1209
1209
  return;
1210
1210
  const e = A(this);
1211
- K(e), ce(e);
1211
+ z(e), ce(e);
1212
1212
  for (const t of e.original)
1213
1213
  e.assignedMap.set(t, !1);
1214
1214
  e.setMap.clear();
1215
1215
  },
1216
1216
  values() {
1217
1217
  const e = A(this);
1218
- K(e);
1218
+ z(e);
1219
1219
  const t = e.setMap.keys();
1220
1220
  return {
1221
1221
  [Symbol.iterator]: () => this.values(),
@@ -1224,7 +1224,7 @@ const ft = (e, t, n = !1) => {
1224
1224
  },
1225
1225
  entries() {
1226
1226
  const e = A(this);
1227
- K(e);
1227
+ z(e);
1228
1228
  const t = e.setMap.keys();
1229
1229
  return {
1230
1230
  [Symbol.iterator]: () => this.entries(),
@@ -1309,7 +1309,7 @@ const xi = Reflect.ownKeys(lt), Tr = /* @__PURE__ */ new WeakSet(), wr = {
1309
1309
  if (e.options.strict && ft(a, e.options), e.finalized || !oe(a, e.options))
1310
1310
  return a;
1311
1311
  if (a === jt(e.original, t)) {
1312
- if (K(e), e.copy[t] = cn({
1312
+ if (z(e), e.copy[t] = cn({
1313
1313
  original: e.original[t],
1314
1314
  parentDraft: e,
1315
1315
  key: e.type === 1 ? Number(t) : t,
@@ -1317,7 +1317,7 @@ const xi = Reflect.ownKeys(lt), Tr = /* @__PURE__ */ new WeakSet(), wr = {
1317
1317
  options: e.options
1318
1318
  }), typeof o == "function") {
1319
1319
  const d = A(e.copy[t]);
1320
- return K(d), ce(d), d.copy;
1320
+ return z(d), ce(d), d.copy;
1321
1321
  }
1322
1322
  return e.copy[t];
1323
1323
  }
@@ -1334,7 +1334,7 @@ const xi = Reflect.ownKeys(lt), Tr = /* @__PURE__ */ new WeakSet(), wr = {
1334
1334
  if (s != null && s.set)
1335
1335
  return s.set.call(e.proxy, n), !0;
1336
1336
  const o = jt(X(e), t), u = A(o);
1337
- return u && he(u.original, n) ? (e.copy[t] = n, e.assignedMap = (r = e.assignedMap) !== null && r !== void 0 ? r : /* @__PURE__ */ new Map(), e.assignedMap.set(t, !1), !0) : (he(n, o) && (n !== void 0 || Ne(e.original, t)) || (K(e), ce(e), Ne(e.original, t) && he(n, e.original[t]) ? e.assignedMap.delete(t) : e.assignedMap.set(t, !0), e.copy[t] = n, an(e, t, n, qe)), !0);
1337
+ return u && he(u.original, n) ? (e.copy[t] = n, e.assignedMap = (r = e.assignedMap) !== null && r !== void 0 ? r : /* @__PURE__ */ new Map(), e.assignedMap.set(t, !1), !0) : (he(n, o) && (n !== void 0 || Ne(e.original, t)) || (z(e), ce(e), Ne(e.original, t) && he(n, e.original[t]) ? e.assignedMap.delete(t) : e.assignedMap.set(t, !0), e.copy[t] = n, an(e, t, n, qe)), !0);
1338
1338
  },
1339
1339
  has(e, t) {
1340
1340
  return t in X(e);
@@ -1362,7 +1362,7 @@ const xi = Reflect.ownKeys(lt), Tr = /* @__PURE__ */ new WeakSet(), wr = {
1362
1362
  },
1363
1363
  deleteProperty(e, t) {
1364
1364
  var n;
1365
- return e.type === 1 ? wr.set.call(this, e, t, void 0, e.proxy) : (jt(e.original, t) !== void 0 || t in e.original ? (K(e), ce(e), e.assignedMap.set(t, !1)) : (e.assignedMap = (n = e.assignedMap) !== null && n !== void 0 ? n : /* @__PURE__ */ new Map(), e.assignedMap.delete(t)), e.copy && delete e.copy[t], !0);
1365
+ return e.type === 1 ? wr.set.call(this, e, t, void 0, e.proxy) : (jt(e.original, t) !== void 0 || t in e.original ? (z(e), ce(e), e.assignedMap.set(t, !1)) : (e.assignedMap = (n = e.assignedMap) !== null && n !== void 0 ? n : /* @__PURE__ */ new Map(), e.assignedMap.delete(t)), e.copy && delete e.copy[t], !0);
1366
1366
  }
1367
1367
  };
1368
1368
  function cn(e) {
@@ -1413,8 +1413,8 @@ function Ui(e, t, n, r, i) {
1413
1413
  const d = a ? t[0] : o ? o.operated ? o.copy : o.original : e;
1414
1414
  return o && Ut(o), i && Ee(d, d, o == null ? void 0 : o.options.updatedValues), [
1415
1415
  d,
1416
- n && a ? [{ op: M.Replace, path: [], value: t[0] }] : n,
1417
- r && a ? [{ op: M.Replace, path: [], value: u }] : r
1416
+ n && a ? [{ op: $.Replace, path: [], value: t[0] }] : n,
1417
+ r && a ? [{ op: $.Replace, path: [], value: u }] : r
1418
1418
  ];
1419
1419
  }
1420
1420
  function Li(e, t) {
@@ -1835,12 +1835,12 @@ const Nn = /ZULU|YEKT|YEKST|YAPT|YAKT|YAKST|XJT|WGT|WGST|WFT|WETDST|WET|WDT|WAT|
1835
1835
  function Wi(e) {
1836
1836
  return new Date(e);
1837
1837
  }
1838
- function Ki(e) {
1838
+ function zi(e) {
1839
1839
  return /* @__PURE__ */ new Date(e + "Z");
1840
1840
  }
1841
- const zi = /^(\d+)[\./-](\d+)[\./-](\d+)$/;
1841
+ const Ki = /^(\d+)[\./-](\d+)[\./-](\d+)$/;
1842
1842
  function Bi(e) {
1843
- const t = e.match(zi);
1843
+ const t = e.match(Ki);
1844
1844
  if (!t)
1845
1845
  return null;
1846
1846
  const [n, r, i, s] = t;
@@ -1904,7 +1904,7 @@ const ts = [
1904
1904
  Hi,
1905
1905
  Zi,
1906
1906
  Yi,
1907
- Ki,
1907
+ zi,
1908
1908
  Ji,
1909
1909
  Qi,
1910
1910
  Wi,
@@ -2022,16 +2022,16 @@ function ss(e) {
2022
2022
  };
2023
2023
  }
2024
2024
  function os(e) {
2025
- return Kt(e.attrs, e.triples, e.cardinalityInference, e.linkIndex, e.useDateObjects);
2025
+ return zt(e.attrs, e.triples, e.cardinalityInference, e.linkIndex, e.useDateObjects);
2026
2026
  }
2027
2027
  function hn(e) {
2028
2028
  e.attrIndexes = Ar(e.attrs);
2029
2029
  }
2030
- function Kt(e, t, n, r, i) {
2030
+ function zt(e, t, n, r, i) {
2031
2031
  const s = Er(e, t, i);
2032
2032
  return s.useDateObjects = i, s.attrs = e, s.attrIndexes = Ar(e), s.cardinalityInference = n, s.linkIndex = r, s.__type = "store", s;
2033
2033
  }
2034
- function Ke(e, t) {
2034
+ function ze(e, t) {
2035
2035
  var n, r;
2036
2036
  let i;
2037
2037
  if (Array.isArray(t[0])) {
@@ -2059,7 +2059,7 @@ function Ke(e, t) {
2059
2059
  }
2060
2060
  }
2061
2061
  function us(e, t) {
2062
- const n = Ke(e, t);
2062
+ const n = ze(e, t);
2063
2063
  if (!n)
2064
2064
  return;
2065
2065
  const [r, i, s] = n, o = Ie(e.attrs, i);
@@ -2074,7 +2074,7 @@ function Cr(e, t, n) {
2074
2074
  }
2075
2075
  function cs(e, t) {
2076
2076
  var n;
2077
- const r = Ke(e, t);
2077
+ const r = ze(e, t);
2078
2078
  if (!r)
2079
2079
  return;
2080
2080
  let [i, s, o] = r;
@@ -2087,7 +2087,7 @@ function cs(e, t) {
2087
2087
  }
2088
2088
  function ds(e, t) {
2089
2089
  var n;
2090
- const r = Ke(e, t);
2090
+ const r = ze(e, t);
2091
2091
  if (!r)
2092
2092
  return;
2093
2093
  const [i, s, o] = r, u = Ie(e.attrs, s);
@@ -2109,9 +2109,9 @@ function ds(e, t) {
2109
2109
  ];
2110
2110
  Y(e.eav, [i, s], /* @__PURE__ */ new Map([[f, h]]));
2111
2111
  }
2112
- function zt(e, t) {
2112
+ function Kt(e, t) {
2113
2113
  var n, r;
2114
- const [i, s] = t, o = Ke(e, [i]);
2114
+ const [i, s] = t, o = ze(e, [i]);
2115
2115
  if (!o)
2116
2116
  return;
2117
2117
  const [u] = o, a = e.eav.get(u);
@@ -2120,7 +2120,7 @@ function zt(e, t) {
2120
2120
  const f = e.attrs[c];
2121
2121
  f && f["on-delete-reverse"] === "cascade" && H(a.get(c), 1).forEach(([h, p, b]) => {
2122
2122
  var g;
2123
- return zt(e, [b, (g = f["reverse-identity"]) === null || g === void 0 ? void 0 : g[1]]);
2123
+ return Kt(e, [b, (g = f["reverse-identity"]) === null || g === void 0 ? void 0 : g[1]]);
2124
2124
  }), // Fall back to deleting everything if we've rehydrated tx-steps from
2125
2125
  // the store that didn't set `etype` in deleteEntity
2126
2126
  (!s || // If we don't know about the attr, let's just get rid of it
@@ -2133,7 +2133,7 @@ function zt(e, t) {
2133
2133
  d && d.forEach((c) => {
2134
2134
  var f, h, p;
2135
2135
  const [b, g, w] = c, T = e.attrs[g];
2136
- (!s || !T || ((f = T["reverse-identity"]) === null || f === void 0 ? void 0 : f[1]) === s) && (se(e.eav, [b, g, w]), se(e.aev, [g, b, w]), se(e.vae, [w, g, b])), T && T["on-delete"] === "cascade" && ((h = T["reverse-identity"]) === null || h === void 0 ? void 0 : h[1]) === s && zt(e, [b, (p = T["forward-identity"]) === null || p === void 0 ? void 0 : p[1]]);
2136
+ (!s || !T || ((f = T["reverse-identity"]) === null || f === void 0 ? void 0 : f[1]) === s) && (se(e.eav, [b, g, w]), se(e.aev, [g, b, w]), se(e.vae, [w, g, b])), T && T["on-delete"] === "cascade" && ((h = T["reverse-identity"]) === null || h === void 0 ? void 0 : h[1]) === s && Kt(e, [b, (p = T["forward-identity"]) === null || p === void 0 ? void 0 : p[1]]);
2137
2137
  }), ((r = e.vae.get(u)) === null || r === void 0 ? void 0 : r.size) === 0 && se(e.vae, [u]);
2138
2138
  }
2139
2139
  function jr(e, t) {
@@ -2171,7 +2171,7 @@ function ps(e, t) {
2171
2171
  us(e, r);
2172
2172
  break;
2173
2173
  case "delete-entity":
2174
- zt(e, r);
2174
+ Kt(e, r);
2175
2175
  break;
2176
2176
  case "add-attr":
2177
2177
  fs(e, r);
@@ -2314,7 +2314,7 @@ function Ir(e, t) {
2314
2314
  return r || ((n = e.attrIndexes.forwardIdents.get(t)) === null || n === void 0 ? void 0 : n.get("id"));
2315
2315
  }
2316
2316
  function Ts(e, t) {
2317
- const n = Ke(e, t);
2317
+ const n = ze(e, t);
2318
2318
  if (!n)
2319
2319
  return;
2320
2320
  const [r, i, s] = n;
@@ -2348,7 +2348,7 @@ function ms(e) {
2348
2348
  function Ss(e, t, n) {
2349
2349
  if (n.hasOwnProperty(e)) {
2350
2350
  const r = n[e];
2351
- return Rr(r, t, n);
2351
+ return Mr(r, t, n);
2352
2352
  }
2353
2353
  return Object.assign(Object.assign({}, n), { [e]: t });
2354
2354
  }
@@ -2377,13 +2377,13 @@ function Es(e) {
2377
2377
  return !0;
2378
2378
  return !1;
2379
2379
  }
2380
- function Rr(e, t, n) {
2380
+ function Mr(e, t, n) {
2381
2381
  return n ? typeof e == "object" ? Es(e) ? n : null : vs(e)(e, t, n) : null;
2382
2382
  }
2383
2383
  function As(e, t, n) {
2384
2384
  return e.reduce((r, i, s) => {
2385
2385
  const o = t[s];
2386
- return Rr(i, o, r);
2386
+ return Mr(i, o, r);
2387
2387
  }, n);
2388
2388
  }
2389
2389
  function Cs(e, t, n) {
@@ -2411,18 +2411,18 @@ function je(e) {
2411
2411
  const L = [];
2412
2412
  for (let e = 0; e < 256; ++e)
2413
2413
  L.push((e + 256).toString(16).slice(1));
2414
- function Rs(e, t = 0) {
2414
+ function Ms(e, t = 0) {
2415
2415
  return (L[e[t + 0]] + L[e[t + 1]] + L[e[t + 2]] + L[e[t + 3]] + "-" + L[e[t + 4]] + L[e[t + 5]] + "-" + L[e[t + 6]] + L[e[t + 7]] + "-" + L[e[t + 8]] + L[e[t + 9]] + "-" + L[e[t + 10]] + L[e[t + 11]] + L[e[t + 12]] + L[e[t + 13]] + L[e[t + 14]] + L[e[t + 15]]).toLowerCase();
2416
2416
  }
2417
2417
  let Pt;
2418
- const Ms = new Uint8Array(16);
2418
+ const Rs = new Uint8Array(16);
2419
2419
  function $s() {
2420
2420
  if (!Pt) {
2421
2421
  if (typeof crypto > "u" || !crypto.getRandomValues)
2422
2422
  throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
2423
2423
  Pt = crypto.getRandomValues.bind(crypto);
2424
2424
  }
2425
- return Pt(Ms);
2425
+ return Pt(Rs);
2426
2426
  }
2427
2427
  const Ds = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), qn = { randomUUID: Ds };
2428
2428
  function xs(e, t, n) {
@@ -2433,7 +2433,7 @@ function xs(e, t, n) {
2433
2433
  const r = e.random ?? ((i = e.rng) == null ? void 0 : i.call(e)) ?? $s();
2434
2434
  if (r.length < 16)
2435
2435
  throw new Error("Random bytes length must be >= 16");
2436
- return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128, Rs(r);
2436
+ return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128, Ms(r);
2437
2437
  }
2438
2438
  function Wn(e) {
2439
2439
  const t = e.replace(/-/g, ""), n = [];
@@ -2487,10 +2487,10 @@ function Ws(e, t) {
2487
2487
  throw new Pe(`Could not find id attr for ${t}`);
2488
2488
  return n;
2489
2489
  }
2490
- function Kn(e, t, n, r) {
2491
- return [Ks(e, t, n, r)];
2490
+ function zn(e, t, n, r) {
2491
+ return [zs(e, t, n, r)];
2492
2492
  }
2493
- function Ks(e, t, n, r) {
2493
+ function zs(e, t, n, r) {
2494
2494
  return [
2495
2495
  e(n, r),
2496
2496
  Ws(t, n).id,
@@ -2498,10 +2498,10 @@ function Ks(e, t, n, r) {
2498
2498
  e("time", r)
2499
2499
  ];
2500
2500
  }
2501
- function zs(e, t, n) {
2501
+ function Ks(e, t, n) {
2502
2502
  return e.map((r) => r === t ? n : r);
2503
2503
  }
2504
- function Mr(e, t, n, r, i) {
2504
+ function Rr(e, t, n, r, i) {
2505
2505
  const s = Ce(t, n, i), o = kr(t, n, i), u = s || o;
2506
2506
  if (!u)
2507
2507
  throw new Pe(`Could not find attr for ${[n, i]}`);
@@ -2520,7 +2520,7 @@ function Mr(e, t, n, r, i) {
2520
2520
  ];
2521
2521
  return [s ? f : d, h, p, u, !!s];
2522
2522
  }
2523
- function zn(e, t) {
2523
+ function Kn(e, t) {
2524
2524
  if (typeof t != "string")
2525
2525
  return function(o) {
2526
2526
  return !1;
@@ -2571,7 +2571,7 @@ function Bs(e, t) {
2571
2571
  }
2572
2572
  };
2573
2573
  if (t.hasOwnProperty("$like")) {
2574
- const r = zn(!0, t.$like);
2574
+ const r = Kn(!0, t.$like);
2575
2575
  return {
2576
2576
  $comparator: !0,
2577
2577
  $op: function(s) {
@@ -2580,7 +2580,7 @@ function Bs(e, t) {
2580
2580
  };
2581
2581
  }
2582
2582
  if (t.hasOwnProperty("$ilike")) {
2583
- const r = zn(!1, t.$ilike);
2583
+ const r = Kn(!1, t.$ilike);
2584
2584
  return {
2585
2585
  $comparator: !0,
2586
2586
  $op: function(s) {
@@ -2614,7 +2614,7 @@ function Qs(e, t, n, r, i, s) {
2614
2614
  }
2615
2615
  function Gs(e, t, n, r, i) {
2616
2616
  const [s, o, u] = i.reduce((a, d) => {
2617
- const [c, f, h] = a, [p, b, g] = Mr(e, t, c, f, d);
2617
+ const [c, f, h] = a, [p, b, g] = Rr(e, t, c, f, d);
2618
2618
  return [p, b, [...h, g]];
2619
2619
  }, [n, r, []]);
2620
2620
  return [s, o, u];
@@ -2686,13 +2686,13 @@ function $r(e, t, n, r, i) {
2686
2686
  }
2687
2687
  function eo(e, t, n, r) {
2688
2688
  const i = _t;
2689
- return r ? $r(i, e, t, n, r).concat(Kn(i, e, t, n)) : Kn(i, e, t, n);
2689
+ return r ? $r(i, e, t, n, r).concat(zn(i, e, t, n)) : zn(i, e, t, n);
2690
2690
  }
2691
2691
  function to(e, t, n) {
2692
2692
  return [e(t, n), e("time", n)];
2693
2693
  }
2694
2694
  function no(e, t, n, r, i, s) {
2695
- const [o, u, a, d, c] = Mr(e, t, n, r, i), f = zs(a, e(n, r), s);
2695
+ const [o, u, a, d, c] = Rr(e, t, n, r, i), f = Ks(a, e(n, r), s);
2696
2696
  return [o, u, f, d, c];
2697
2697
  }
2698
2698
  function ro(e, t, { etype: n, level: r, form: i }, s) {
@@ -3105,15 +3105,15 @@ function ko(e, t) {
3105
3105
  function Io({ attrs: e }, [t, n, r]) {
3106
3106
  return [["rule-params", J(e, t, n), t, r]];
3107
3107
  }
3108
- function Ro(e) {
3108
+ function Mo(e) {
3109
3109
  const [t, n, r, i, s] = e;
3110
3110
  if (!i)
3111
3111
  return e;
3112
3112
  const o = Object.assign({}, i);
3113
3113
  return delete o.id, [t, n, r, o, ...s ? [s] : []];
3114
3114
  }
3115
- function Mo(e, t) {
3116
- const [n, ...r] = Ro(t);
3115
+ function Ro(e, t) {
3116
+ const [n, ...r] = Mo(t);
3117
3117
  switch (n) {
3118
3118
  case "merge":
3119
3119
  return ko(e, r);
@@ -3211,7 +3211,7 @@ function Wo(e) {
3211
3211
  }
3212
3212
  return t;
3213
3213
  }
3214
- function Ko({ attrs: e, schema: t }, n) {
3214
+ function zo({ attrs: e, schema: t }, n) {
3215
3215
  var r, i;
3216
3216
  const [s, o, u] = [/* @__PURE__ */ new Set(), Object.assign({}, e), []];
3217
3217
  function a(f) {
@@ -3261,8 +3261,8 @@ function Ko({ attrs: e, schema: t }, n) {
3261
3261
  }
3262
3262
  return [o, u];
3263
3263
  }
3264
- function zo(e, t) {
3265
- const r = (Array.isArray(t) ? t : [t]).flatMap((a) => wo(a)), [i, s] = Ko(e, r), o = Object.assign(Object.assign({}, e), { attrs: i }), u = r.flatMap((a) => Mo(o, a));
3264
+ function Ko(e, t) {
3265
+ const r = (Array.isArray(t) ? t : [t]).flatMap((a) => wo(a)), [i, s] = zo(e, r), o = Object.assign(Object.assign({}, e), { attrs: i }), u = r.flatMap((a) => Ro(o, a));
3266
3266
  return [...s, ...u];
3267
3267
  }
3268
3268
  var Yn = function(e, t, n, r) {
@@ -3435,7 +3435,7 @@ function ue(e, t) {
3435
3435
  return n.status === 200 ? Promise.resolve(r) : Promise.reject(new gt({ status: n.status, body: r }));
3436
3436
  });
3437
3437
  }
3438
- var Re = function(e, t, n, r) {
3438
+ var Me = function(e, t, n, r) {
3439
3439
  function i(s) {
3440
3440
  return s instanceof n ? s : new n(function(o) {
3441
3441
  o(s);
@@ -3470,7 +3470,7 @@ function Go({ apiURI: e, appId: t, email: n }) {
3470
3470
  });
3471
3471
  }
3472
3472
  function Yo(e) {
3473
- return Re(this, arguments, void 0, function* ({ apiURI: t, appId: n, email: r, code: i, refreshToken: s }) {
3473
+ return Me(this, arguments, void 0, function* ({ apiURI: t, appId: n, email: r, code: i, refreshToken: s }) {
3474
3474
  return yield ue(`${t}/runtime/auth/verify_magic_code`, {
3475
3475
  method: "POST",
3476
3476
  headers: { "content-type": "application/json" },
@@ -3483,7 +3483,7 @@ function Yo(e) {
3483
3483
  });
3484
3484
  }
3485
3485
  function Ho(e) {
3486
- return Re(this, arguments, void 0, function* ({ apiURI: t, appId: n, refreshToken: r }) {
3486
+ return Me(this, arguments, void 0, function* ({ apiURI: t, appId: n, refreshToken: r }) {
3487
3487
  return yield ue(`${t}/runtime/auth/verify_refresh_token`, {
3488
3488
  method: "POST",
3489
3489
  headers: { "content-type": "application/json" },
@@ -3495,7 +3495,7 @@ function Ho(e) {
3495
3495
  });
3496
3496
  }
3497
3497
  function Jo(e) {
3498
- return Re(this, arguments, void 0, function* ({ apiURI: t, appId: n }) {
3498
+ return Me(this, arguments, void 0, function* ({ apiURI: t, appId: n }) {
3499
3499
  return yield ue(`${t}/runtime/auth/sign_in_guest`, {
3500
3500
  method: "POST",
3501
3501
  headers: { "content-type": "application/json" },
@@ -3506,7 +3506,7 @@ function Jo(e) {
3506
3506
  });
3507
3507
  }
3508
3508
  function Hn(e) {
3509
- return Re(this, arguments, void 0, function* ({ apiURI: t, appId: n, code: r, codeVerifier: i, refreshToken: s }) {
3509
+ return Me(this, arguments, void 0, function* ({ apiURI: t, appId: n, code: r, codeVerifier: i, refreshToken: s }) {
3510
3510
  return yield ue(`${t}/runtime/oauth/token`, {
3511
3511
  method: "POST",
3512
3512
  headers: { "content-type": "application/json" },
@@ -3520,7 +3520,7 @@ function Hn(e) {
3520
3520
  });
3521
3521
  }
3522
3522
  function Zo(e) {
3523
- return Re(this, arguments, void 0, function* ({ apiURI: t, appId: n, nonce: r, idToken: i, clientName: s, refreshToken: o }) {
3523
+ return Me(this, arguments, void 0, function* ({ apiURI: t, appId: n, nonce: r, idToken: i, clientName: s, refreshToken: o }) {
3524
3524
  return yield ue(`${t}/runtime/oauth/id_token`, {
3525
3525
  method: "POST",
3526
3526
  headers: { "content-type": "application/json" },
@@ -3535,7 +3535,7 @@ function Zo(e) {
3535
3535
  });
3536
3536
  }
3537
3537
  function Xo(e) {
3538
- return Re(this, arguments, void 0, function* ({ apiURI: t, appId: n, refreshToken: r }) {
3538
+ return Me(this, arguments, void 0, function* ({ apiURI: t, appId: n, refreshToken: r }) {
3539
3539
  return yield ue(`${t}/runtime/signout`, {
3540
3540
  method: "POST",
3541
3541
  headers: {
@@ -3548,7 +3548,7 @@ function Xo(e) {
3548
3548
  });
3549
3549
  });
3550
3550
  }
3551
- var ze = function(e, t, n, r) {
3551
+ var Ke = function(e, t, n, r) {
3552
3552
  function i(s) {
3553
3553
  return s instanceof n ? s : new n(function(o) {
3554
3554
  o(s);
@@ -3576,7 +3576,7 @@ var ze = function(e, t, n, r) {
3576
3576
  });
3577
3577
  };
3578
3578
  function eu(e) {
3579
- return ze(this, arguments, void 0, function* ({ apiURI: t, appId: n, path: r, file: i, refreshToken: s, contentType: o, contentDisposition: u }) {
3579
+ return Ke(this, arguments, void 0, function* ({ apiURI: t, appId: n, path: r, file: i, refreshToken: s, contentType: o, contentDisposition: u }) {
3580
3580
  const a = {
3581
3581
  app_id: n,
3582
3582
  path: r,
@@ -3591,7 +3591,7 @@ function eu(e) {
3591
3591
  });
3592
3592
  }
3593
3593
  function tu(e) {
3594
- return ze(this, arguments, void 0, function* ({ apiURI: t, appId: n, path: r, refreshToken: i }) {
3594
+ return Ke(this, arguments, void 0, function* ({ apiURI: t, appId: n, path: r, refreshToken: i }) {
3595
3595
  const { data: s } = yield ue(`${t}/storage/files?app_id=${n}&filename=${encodeURIComponent(r)}`, {
3596
3596
  method: "DELETE",
3597
3597
  headers: {
@@ -3603,7 +3603,7 @@ function tu(e) {
3603
3603
  });
3604
3604
  }
3605
3605
  function nu(e) {
3606
- return ze(this, arguments, void 0, function* ({ apiURI: t, appId: n, fileName: r, refreshToken: i, metadata: s = {} }) {
3606
+ return Ke(this, arguments, void 0, function* ({ apiURI: t, appId: n, fileName: r, refreshToken: i, metadata: s = {} }) {
3607
3607
  const { data: o } = yield ue(`${t}/storage/signed-upload-url`, {
3608
3608
  method: "POST",
3609
3609
  headers: {
@@ -3619,7 +3619,7 @@ function nu(e) {
3619
3619
  });
3620
3620
  }
3621
3621
  function ru(e, t) {
3622
- return ze(this, void 0, void 0, function* () {
3622
+ return Ke(this, void 0, void 0, function* () {
3623
3623
  return (yield fetch(e, {
3624
3624
  method: "PUT",
3625
3625
  body: t,
@@ -3630,7 +3630,7 @@ function ru(e, t) {
3630
3630
  });
3631
3631
  }
3632
3632
  function iu(e) {
3633
- return ze(this, arguments, void 0, function* ({ apiURI: t, appId: n, path: r, refreshToken: i }) {
3633
+ return Ke(this, arguments, void 0, function* ({ apiURI: t, appId: n, path: r, refreshToken: i }) {
3634
3634
  const { data: s } = yield ue(`${t}/storage/signed-download-url?app_id=${n}&filename=${encodeURIComponent(r)}`, {
3635
3635
  method: "GET",
3636
3636
  headers: {
@@ -3798,18 +3798,18 @@ class Xn {
3798
3798
  };
3799
3799
  }
3800
3800
  }
3801
- function Kr(e, t = []) {
3801
+ function zr(e, t = []) {
3802
3802
  e.forEach((n) => {
3803
3803
  const { data: r } = n, { "datalog-result": i } = r, { "join-rows": s } = i;
3804
3804
  for (const o of s)
3805
3805
  for (const u of o)
3806
3806
  t.push(u);
3807
- Kr(n["child-nodes"], t);
3807
+ zr(n["child-nodes"], t);
3808
3808
  });
3809
3809
  }
3810
3810
  function er(e) {
3811
3811
  const t = [];
3812
- return Kr(e, t), t;
3812
+ return zr(e, t), t;
3813
3813
  }
3814
3814
  function tr(e) {
3815
3815
  return Object.values(e.links).reduce((t, n) => {
@@ -3825,14 +3825,14 @@ function tr(e) {
3825
3825
  }, t;
3826
3826
  }, {});
3827
3827
  }
3828
- const zr = "v0.22.34";
3829
- function au(e) {
3828
+ const Kr = "v0.22.35-experimental.drewh-cookie-sync-endpoint.18847838801.1";
3829
+ function au(e, t) {
3830
3830
  return {
3831
- info: e ? console.info.bind(console) : () => {
3831
+ info: e ? (...n) => console.info(...n, t()) : () => {
3832
3832
  },
3833
- debug: e ? console.debug.bind(console) : () => {
3833
+ debug: e ? (...n) => console.debug(...n, t()) : () => {
3834
3834
  },
3835
- error: e ? console.error.bind(console) : () => {
3835
+ error: e ? (...n) => console.error(...n, t()) : () => {
3836
3836
  }
3837
3837
  };
3838
3838
  }
@@ -4277,7 +4277,7 @@ class gu {
4277
4277
  this.handleClose();
4278
4278
  }
4279
4279
  }
4280
- var D = function(e, t, n, r) {
4280
+ var R = function(e, t, n, r) {
4281
4281
  function i(s) {
4282
4282
  return s instanceof n ? s : new n(function(o) {
4283
4283
  o(s);
@@ -4320,7 +4320,7 @@ const fe = {
4320
4320
  }, wu = 3e4, mu = 3e4, Su = 200, vu = {
4321
4321
  apiURI: "https://api.instantdb.com",
4322
4322
  websocketURI: "wss://api.instantdb.com/runtime/session"
4323
- }, It = "_instant_oauth_redirect", Rt = "currentUser";
4323
+ }, It = "_instant_oauth_redirect", Mt = "currentUser";
4324
4324
  function Ou({ transportType: e, appId: t, apiURI: n, wsURI: r, EventSourceImpl: i }) {
4325
4325
  if (!i)
4326
4326
  return new ar(`${r}?app_id=${t}`);
@@ -4372,7 +4372,7 @@ function dr(e) {
4372
4372
  class ju {
4373
4373
  constructor(t, n = Nr, r = Vr, i, s) {
4374
4374
  var o, u, a;
4375
- if (this._isOnline = !0, this._isShutdown = !1, this.status = fe.CONNECTING, this.queryCbs = {}, this.queryOnceDfds = {}, this.authCbs = [], this.attrsCbs = [], this.mutationErrorCbs = [], this.connectionStatusCbs = [], this.mutationDeferredStore = /* @__PURE__ */ new Map(), this._reconnectTimeoutId = null, this._reconnectTimeoutMs = 0, this._transportType = "ws", this._wsOk = null, this._localIdPromises = {}, this._errorMessage = null, this._oauthCallbackResponse = null, this._linkIndex = null, this._rooms = {}, this._roomsPendingLeave = {}, this._presence = {}, this._broadcastQueue = [], this._broadcastSubs = {}, this._currentUserCached = { isLoading: !0, error: void 0, user: void 0 }, this._beforeUnloadCbs = [], this._dataForQueryCache = {}, this._onMergeQuerySubs = (d, c) => {
4375
+ if (this._isOnline = !0, this._isShutdown = !1, this.status = fe.CONNECTING, this.queryCbs = {}, this.queryOnceDfds = {}, this.authCbs = [], this.attrsCbs = [], this.mutationErrorCbs = [], this.connectionStatusCbs = [], this.mutationDeferredStore = /* @__PURE__ */ new Map(), this._reconnectTimeoutId = null, this._reconnectTimeoutMs = 0, this._transportType = "ws", this._wsOk = null, this._localIdPromises = {}, this._errorMessage = null, this._oauthCallbackResponse = null, this._linkIndex = null, this._rooms = {}, this._roomsPendingLeave = {}, this._presence = {}, this._broadcastQueue = [], this._broadcastSubs = {}, this._currentUserCached = { isLoading: !0, error: void 0, user: void 0 }, this._beforeUnloadCbs = [], this._dataForQueryCache = {}, this._inFlightMutationEventIds = /* @__PURE__ */ new Set(), this._onMergeQuerySubs = (d, c) => {
4376
4376
  const f = d || {}, h = Object.assign({}, c);
4377
4377
  Object.entries(c).forEach(([b, g]) => {
4378
4378
  var w;
@@ -4408,7 +4408,7 @@ class ju {
4408
4408
  }, this.pushTx = (d) => {
4409
4409
  this.config.disableValidation || _u(d, this.config.schema);
4410
4410
  try {
4411
- const c = zo({
4411
+ const c = Ko({
4412
4412
  attrs: this.optimisticAttrs(),
4413
4413
  schema: this.config.schema,
4414
4414
  stores: Object.values(this.querySubs.currentValue).map((f) => {
@@ -4491,12 +4491,12 @@ class ju {
4491
4491
  return;
4492
4492
  }
4493
4493
  this._log.info("[socket][close]", c.id, "schedule reconnect, ms =", this._reconnectTimeoutMs), this._scheduleReconnect();
4494
- }, this._EventSource = s, this.config = Object.assign(Object.assign({}, vu), t), this.queryCacheLimit = (o = this.config.queryCacheLimit) !== null && o !== void 0 ? o : 10, this._pendingTxCleanupTimeout = (u = this.config.pendingTxCleanupTimeout) !== null && u !== void 0 ? u : mu, this._pendingMutationCleanupThreshold = (a = this.config.pendingMutationCleanupThreshold) !== null && a !== void 0 ? a : Su, this._log = au(t.verbose || bn || qr), this.versions = Object.assign(Object.assign({}, i || {}), { "@instantdb/core": zr }), this.config.schema && (this._linkIndex = tr(this.config.schema)), !!Eu()) {
4494
+ }, this._EventSource = s, this.config = Object.assign(Object.assign({}, vu), t), this.queryCacheLimit = (o = this.config.queryCacheLimit) !== null && o !== void 0 ? o : 10, this._pendingTxCleanupTimeout = (u = this.config.pendingTxCleanupTimeout) !== null && u !== void 0 ? u : mu, this._pendingMutationCleanupThreshold = (a = this.config.pendingMutationCleanupThreshold) !== null && a !== void 0 ? a : Su, this._log = au(t.verbose || bn || qr, () => this._reactorStats()), this.versions = Object.assign(Object.assign({}, i || {}), { "@instantdb/core": Kr }), this.config.schema && (this._linkIndex = tr(this.config.schema)), !!Eu()) {
4495
4495
  if (!t.appId)
4496
4496
  throw new Error("Instant must be initialized with an appId.");
4497
4497
  if (!je(t.appId))
4498
4498
  throw new Error(`Instant must be initialized with a valid appId. \`${t.appId}\` is not a valid uuid.`);
4499
- typeof BroadcastChannel == "function" && (this._broadcastChannel = new BroadcastChannel("@instantdb"), this._broadcastChannel.addEventListener("message", (d) => D(this, void 0, void 0, function* () {
4499
+ typeof BroadcastChannel == "function" && (this._broadcastChannel = new BroadcastChannel("@instantdb"), this._broadcastChannel.addEventListener("message", (d) => R(this, void 0, void 0, function* () {
4500
4500
  var c;
4501
4501
  try {
4502
4502
  if (((c = d.data) === null || c === void 0 ? void 0 : c.type) === "auth") {
@@ -4506,7 +4506,9 @@ class ju {
4506
4506
  } catch (f) {
4507
4507
  this._log.error("[error] handle broadcast channel", f);
4508
4508
  }
4509
- }))), this._initStorage(n), this._oauthCallbackResponse = this._oauthLoginInit(), this.getCurrentUser(), r.getIsOnline().then((d) => {
4509
+ }))), this._initStorage(n), this._oauthCallbackResponse = this._oauthLoginInit(), this.getCurrentUser().then((d) => {
4510
+ this.syncUserToEndpoint(d.user);
4511
+ }), r.getIsOnline().then((d) => {
4510
4512
  this._isOnline = d, this._startSocket(), r.listen((c) => {
4511
4513
  c !== this._isOnline && (this._log.info("[network] online =", c), this._isOnline = c, this._isOnline ? this._startSocket() : (this._log.info("Changing status from", this.status, "to", fe.CLOSED), this._setStatus(fe.CLOSED)));
4512
4514
  });
@@ -4516,6 +4518,13 @@ class ju {
4516
4518
  updateSchema(t) {
4517
4519
  this.config = Object.assign(Object.assign({}, this.config), { schema: t, cardinalityInference: !!t }), this._linkIndex = t ? tr(this.config.schema) : null;
4518
4520
  }
4521
+ _reactorStats() {
4522
+ return {
4523
+ inFlightMutationCount: this._inFlightMutationEventIds.size,
4524
+ pendingMutationCount: this.pendingMutations.currentValue.size,
4525
+ transportType: this._transportType
4526
+ };
4527
+ }
4519
4528
  _initStorage(t) {
4520
4529
  this._persister = new t(`instant_${this.config.appId}_5`), this.querySubs = new Xn(this._persister, "querySubs", {}, this._onMergeQuerySubs, Cu, (n) => Au(n, this.config.useDateObjects)), this.pendingMutations = new Xn(
4521
4530
  this._persister,
@@ -4575,56 +4584,58 @@ class ju {
4575
4584
  switch (cr[n.op] || this._log.info("[receive]", t, n.op, n), n.op) {
4576
4585
  case "init-ok":
4577
4586
  this._setStatus(fe.AUTHENTICATED), this._reconnectTimeoutMs = 0, this._setAttrs(n.attrs), this._flushPendingMessages(), this._sessionId = n["session-id"];
4578
- for (const k of Object.keys(this._rooms)) {
4579
- const U = (i = (r = this._presence[k]) === null || r === void 0 ? void 0 : r.result) === null || i === void 0 ? void 0 : i.user;
4580
- this._tryJoinRoom(k, U);
4587
+ for (const P of Object.keys(this._rooms)) {
4588
+ const U = (i = (r = this._presence[P]) === null || r === void 0 ? void 0 : r.result) === null || i === void 0 ? void 0 : i.user;
4589
+ this._tryJoinRoom(P, U);
4581
4590
  }
4582
4591
  break;
4583
4592
  case "add-query-exists":
4584
4593
  this.notifyOneQueryOnce(G(n.q));
4585
4594
  break;
4586
4595
  case "add-query-ok":
4587
- const { q: c, result: f } = n, h = G(c), p = (o = (s = f == null ? void 0 : f[0]) === null || s === void 0 ? void 0 : s.data) === null || o === void 0 ? void 0 : o["page-info"], b = (a = (u = f == null ? void 0 : f[0]) === null || u === void 0 ? void 0 : u.data) === null || a === void 0 ? void 0 : a.aggregate, g = er(f), w = Kt(this.attrs, g, d, this._linkIndex, this.config.useDateObjects);
4588
- this.querySubs.set((k) => (k[h].result = {
4596
+ const { q: c, result: f } = n, h = G(c), p = (o = (s = f == null ? void 0 : f[0]) === null || s === void 0 ? void 0 : s.data) === null || o === void 0 ? void 0 : o["page-info"], b = (a = (u = f == null ? void 0 : f[0]) === null || u === void 0 ? void 0 : u.data) === null || a === void 0 ? void 0 : a.aggregate, g = er(f), w = zt(this.attrs, g, d, this._linkIndex, this.config.useDateObjects);
4597
+ this.querySubs.set((P) => (P[h].result = {
4589
4598
  store: w,
4590
4599
  pageInfo: p,
4591
4600
  aggregate: b,
4592
4601
  processedTxId: n["processed-tx-id"]
4593
- }, k)), this._cleanupPendingMutationsQueries(), this.notifyOne(h), this.notifyOneQueryOnce(h), this._cleanupPendingMutationsTimeout();
4602
+ }, P)), this._cleanupPendingMutationsQueries(), this.notifyOne(h), this.notifyOneQueryOnce(h), this._cleanupPendingMutationsTimeout();
4594
4603
  break;
4595
4604
  case "refresh-ok":
4596
4605
  const { computations: T, attrs: m } = n, S = n["processed-tx-id"];
4597
4606
  m && this._setAttrs(m), this._cleanupPendingMutationsTimeout();
4598
4607
  const q = this._rewriteMutations(this.attrs, this.pendingMutations.currentValue, S);
4599
4608
  q !== this.pendingMutations.currentValue && this.pendingMutations.set(() => q);
4600
- const O = dr(q.entries()), x = T.map((k) => {
4601
- var U, z, B, re;
4602
- const ie = k["instaql-query"], Z = k["instaql-result"], Ge = G(ie), Ye = er(Z), He = Kt(this.attrs, Ye, d, this._linkIndex, this.config.useDateObjects), Je = this._applyOptimisticUpdates(He, O, S), Ze = (z = (U = Z == null ? void 0 : Z[0]) === null || U === void 0 ? void 0 : U.data) === null || z === void 0 ? void 0 : z["page-info"], Tt = (re = (B = Z == null ? void 0 : Z[0]) === null || B === void 0 ? void 0 : B.data) === null || re === void 0 ? void 0 : re.aggregate;
4609
+ const O = dr(q.entries()), x = T.map((P) => {
4610
+ var U, K, B, re;
4611
+ const ie = P["instaql-query"], Z = P["instaql-result"], Ge = G(ie), Ye = er(Z), He = zt(this.attrs, Ye, d, this._linkIndex, this.config.useDateObjects), Je = this._applyOptimisticUpdates(He, O, S), Ze = (K = (U = Z == null ? void 0 : Z[0]) === null || U === void 0 ? void 0 : U.data) === null || K === void 0 ? void 0 : K["page-info"], Tt = (re = (B = Z == null ? void 0 : Z[0]) === null || B === void 0 ? void 0 : B.data) === null || re === void 0 ? void 0 : re.aggregate;
4603
4612
  return { hash: Ge, store: Je, pageInfo: Ze, aggregate: Tt };
4604
4613
  });
4605
- x.forEach(({ hash: k, store: U, pageInfo: z, aggregate: B }) => {
4606
- this.querySubs.set((re) => (re[k].result = { store: U, pageInfo: z, aggregate: B, processedTxId: S }, re));
4607
- }), this._cleanupPendingMutationsQueries(), x.forEach(({ hash: k }) => {
4608
- this.notifyOne(k);
4614
+ x.forEach(({ hash: P, store: U, pageInfo: K, aggregate: B }) => {
4615
+ this.querySubs.set((re) => (re[P].result = { store: U, pageInfo: K, aggregate: B, processedTxId: S }, re));
4616
+ }), this._cleanupPendingMutationsQueries(), x.forEach(({ hash: P }) => {
4617
+ this.notifyOne(P);
4609
4618
  });
4610
4619
  break;
4611
4620
  case "transact-ok": {
4612
- const { "client-event-id": k, "tx-id": U } = n, B = this._rewriteMutations(this.attrs, this.pendingMutations.currentValue).get(k);
4621
+ const { "client-event-id": P, "tx-id": U } = n;
4622
+ this._inFlightMutationEventIds.delete(P);
4623
+ const B = this._rewriteMutations(this.attrs, this.pendingMutations.currentValue).get(P);
4613
4624
  if (!B)
4614
4625
  break;
4615
- this.pendingMutations.set((ie) => (ie.set(k, Object.assign(Object.assign({}, ie.get(k)), { "tx-id": U, confirmed: Date.now() })), ie));
4626
+ this.pendingMutations.set((ie) => (ie.set(P, Object.assign(Object.assign({}, ie.get(P)), { "tx-id": U, confirmed: Date.now() })), ie));
4616
4627
  const re = B["tx-steps"].filter(([ie, ...Z]) => ie === "add-attr").map(([ie, Z]) => Z).concat(Object.values(this.attrs));
4617
- this._setAttrs(re), this._finishTransaction("synced", k), this._cleanupPendingMutationsTimeout();
4628
+ this._setAttrs(re), this._finishTransaction("synced", P), this._cleanupPendingMutationsTimeout();
4618
4629
  break;
4619
4630
  }
4620
4631
  case "patch-presence": {
4621
- const k = n["room-id"];
4622
- this._patchPresencePeers(k, n.edits), this._notifyPresenceSubs(k);
4632
+ const P = n["room-id"];
4633
+ this._patchPresencePeers(P, n.edits), this._notifyPresenceSubs(P);
4623
4634
  break;
4624
4635
  }
4625
4636
  case "refresh-presence": {
4626
- const k = n["room-id"];
4627
- this._setPresencePeers(k, n.data), this._notifyPresenceSubs(k);
4637
+ const P = n["room-id"];
4638
+ this._setPresencePeers(P, n.data), this._notifyPresenceSubs(P);
4628
4639
  break;
4629
4640
  }
4630
4641
  case "server-broadcast":
@@ -4632,12 +4643,12 @@ class ju {
4632
4643
  this._notifyBroadcastSubs(N, de, n);
4633
4644
  break;
4634
4645
  case "join-room-ok":
4635
- const ae = n["room-id"], Me = this._rooms[ae];
4636
- if (!Me) {
4646
+ const ae = n["room-id"], Re = this._rooms[ae];
4647
+ if (!Re) {
4637
4648
  this._roomsPendingLeave[ae] && (this._tryLeaveRoom(ae), delete this._roomsPendingLeave[ae]);
4638
4649
  break;
4639
4650
  }
4640
- Me.isConnected = !0, this._notifyPresenceSubs(ae), this._flushEnqueuedRoomData(ae);
4651
+ Re.isConnected = !0, this._notifyPresenceSubs(ae), this._flushEnqueuedRoomData(ae);
4641
4652
  break;
4642
4653
  case "join-room-error":
4643
4654
  const Be = n["room-id"], Qe = this._rooms[Be];
@@ -4656,7 +4667,7 @@ class ju {
4656
4667
  _handleMutationError(t, n, r) {
4657
4668
  const i = this.pendingMutations.currentValue.get(n);
4658
4669
  if (i && (t !== "timeout" || !i["tx-id"])) {
4659
- this.pendingMutations.set((o) => (o.delete(n), o));
4670
+ this.pendingMutations.set((o) => (o.delete(n), o)), this._inFlightMutationEventIds.delete(n);
4660
4671
  const s = {
4661
4672
  message: r.message,
4662
4673
  hint: r.hint
@@ -4667,7 +4678,9 @@ class ju {
4667
4678
  _handleReceiveError(t) {
4668
4679
  var n, r, i, s, o;
4669
4680
  console.log("error", t);
4670
- const u = t["client-event-id"], a = this.pendingMutations.currentValue.get(u), d = {
4681
+ const u = t["client-event-id"];
4682
+ this._inFlightMutationEventIds.delete(u);
4683
+ const a = this.pendingMutations.currentValue.get(u), d = {
4671
4684
  message: t.message || "Uh-oh, something went wrong. Ping Joe & Stopa."
4672
4685
  };
4673
4686
  if (t.hint && (d.hint = t.hint), a) {
@@ -4874,7 +4887,11 @@ class ju {
4874
4887
  this._finishTransaction("enqueued", t);
4875
4888
  return;
4876
4889
  }
4877
- const r = Math.max(5e3, this.pendingMutations.currentValue.size * 5e3);
4890
+ const r = Math.max(6e3, Math.min(
4891
+ this._inFlightMutationEventIds.size + 1,
4892
+ // Defensive code in case we don't clean up in flight mutation event ids
4893
+ this.pendingMutations.currentValue.size + 1
4894
+ ) * 6e3);
4878
4895
  this._isOnline ? (this._trySend(t, n), setTimeout(() => {
4879
4896
  this._isOnline && this._handleMutationError("timeout", t, {
4880
4897
  message: "transaction timed out"
@@ -4925,7 +4942,17 @@ class ju {
4925
4942
  this.status === fe.AUTHENTICATED && this._trySend(...t);
4926
4943
  }
4927
4944
  _trySend(t, n, r) {
4928
- this._transport.isOpen() && (cr[n.op] || this._log.info("[send]", this._transport.id, n.op, n), this._transport.send(Object.assign({ "client-event-id": t }, n)));
4945
+ if (this._transport.isOpen()) {
4946
+ switch (cr[n.op] || this._log.info("[send]", this._transport.id, n.op, n), n.op) {
4947
+ case "transact": {
4948
+ this._inFlightMutationEventIds.add(t);
4949
+ break;
4950
+ }
4951
+ case "init":
4952
+ this._inFlightMutationEventIds.clear();
4953
+ }
4954
+ this._transport.send(Object.assign({ "client-event-id": t }, n));
4955
+ }
4929
4956
  }
4930
4957
  _startSocket() {
4931
4958
  if (this._wsOk = null, this._isShutdown) {
@@ -4956,7 +4983,7 @@ class ju {
4956
4983
  * id once, even if multiple callers call this function concurrently.
4957
4984
  */
4958
4985
  getLocalId(t) {
4959
- return D(this, void 0, void 0, function* () {
4986
+ return R(this, void 0, void 0, function* () {
4960
4987
  const n = `localToken_${t}`, r = yield this._persister.getItem(n);
4961
4988
  if (r)
4962
4989
  return r;
@@ -4994,7 +5021,7 @@ class ju {
4994
5021
  * @returns Promise<null | {error: {message: string}}>
4995
5022
  */
4996
5023
  _oauthLoginInit() {
4997
- return D(this, void 0, void 0, function* () {
5024
+ return R(this, void 0, void 0, function* () {
4998
5025
  var t, n, r, i;
4999
5026
  if (typeof window > "u" || typeof window.location > "u" || typeof URLSearchParams > "u")
5000
5027
  return null;
@@ -5022,7 +5049,7 @@ class ju {
5022
5049
  });
5023
5050
  }
5024
5051
  _waitForOAuthCallbackResponse() {
5025
- return D(this, void 0, void 0, function* () {
5052
+ return R(this, void 0, void 0, function* () {
5026
5053
  return yield this._oauthCallbackResponse;
5027
5054
  });
5028
5055
  }
@@ -5043,7 +5070,7 @@ class ju {
5043
5070
  };
5044
5071
  }
5045
5072
  getAuth() {
5046
- return D(this, void 0, void 0, function* () {
5073
+ return R(this, void 0, void 0, function* () {
5047
5074
  const { user: t, error: n } = yield this.getCurrentUser();
5048
5075
  if (n)
5049
5076
  throw new ke("Could not get current user: " + n.message);
@@ -5076,21 +5103,21 @@ class ju {
5076
5103
  this.connectionStatusCbs.forEach((n) => n(t));
5077
5104
  }
5078
5105
  setCurrentUser(t) {
5079
- return D(this, void 0, void 0, function* () {
5080
- yield this._persister.setItem(Rt, t);
5106
+ return R(this, void 0, void 0, function* () {
5107
+ yield this._persister.setItem(Mt, t);
5081
5108
  });
5082
5109
  }
5083
5110
  getCurrentUserCached() {
5084
5111
  return this._currentUserCached;
5085
5112
  }
5086
5113
  _getCurrentUser() {
5087
- return D(this, void 0, void 0, function* () {
5088
- const t = yield this._persister.getItem(Rt);
5114
+ return R(this, void 0, void 0, function* () {
5115
+ const t = yield this._persister.getItem(Mt);
5089
5116
  return typeof t == "string" ? JSON.parse(t) : t;
5090
5117
  });
5091
5118
  }
5092
5119
  getCurrentUser() {
5093
- return D(this, void 0, void 0, function* () {
5120
+ return R(this, void 0, void 0, function* () {
5094
5121
  const t = yield this._waitForOAuthCallbackResponse();
5095
5122
  if (t != null && t.error) {
5096
5123
  const i = { error: t.error, user: void 0 };
@@ -5101,13 +5128,13 @@ class ju {
5101
5128
  });
5102
5129
  }
5103
5130
  _hasCurrentUser() {
5104
- return D(this, void 0, void 0, function* () {
5105
- const t = yield this._persister.getItem(Rt);
5131
+ return R(this, void 0, void 0, function* () {
5132
+ const t = yield this._persister.getItem(Mt);
5106
5133
  return JSON.parse(t) != null;
5107
5134
  });
5108
5135
  }
5109
5136
  changeCurrentUser(t) {
5110
- return D(this, void 0, void 0, function* () {
5137
+ return R(this, void 0, void 0, function* () {
5111
5138
  var n;
5112
5139
  const { user: r } = yield this.getCurrentUser();
5113
5140
  if (!ct(r, t)) {
@@ -5120,7 +5147,21 @@ class ju {
5120
5147
  }
5121
5148
  });
5122
5149
  }
5150
+ syncUserToEndpoint(t) {
5151
+ return R(this, void 0, void 0, function* () {
5152
+ this.config.endpointURI && fetch(this.config.endpointURI + "/sync-auth", {
5153
+ method: "POST",
5154
+ body: JSON.stringify({
5155
+ user: t
5156
+ }),
5157
+ headers: {
5158
+ "Content-Type": "application/json"
5159
+ }
5160
+ });
5161
+ });
5162
+ }
5123
5163
  updateUser(t) {
5164
+ this.syncUserToEndpoint(t);
5124
5165
  const n = { error: void 0, user: t };
5125
5166
  this._currentUserCached = Object.assign({ isLoading: !1 }, n), this._dataForQueryCache = {}, this.querySubs.set((r) => (Object.keys(r).forEach((i) => {
5126
5167
  delete r[i].result;
@@ -5134,7 +5175,7 @@ class ju {
5134
5175
  });
5135
5176
  }
5136
5177
  signInWithMagicCode(t) {
5137
- return D(this, arguments, void 0, function* ({ email: n, code: r }) {
5178
+ return R(this, arguments, void 0, function* ({ email: n, code: r }) {
5138
5179
  var i;
5139
5180
  const s = yield this.getCurrentUser(), o = ((i = s == null ? void 0 : s.user) === null || i === void 0 ? void 0 : i.type) === "guest", u = yield Yo({
5140
5181
  apiURI: this.config.apiURI,
@@ -5147,7 +5188,7 @@ class ju {
5147
5188
  });
5148
5189
  }
5149
5190
  signInWithCustomToken(t) {
5150
- return D(this, void 0, void 0, function* () {
5191
+ return R(this, void 0, void 0, function* () {
5151
5192
  const n = yield Ho({
5152
5193
  apiURI: this.config.apiURI,
5153
5194
  appId: this.config.appId,
@@ -5157,7 +5198,7 @@ class ju {
5157
5198
  });
5158
5199
  }
5159
5200
  signInAsGuest() {
5160
- return D(this, void 0, void 0, function* () {
5201
+ return R(this, void 0, void 0, function* () {
5161
5202
  const t = yield Jo({
5162
5203
  apiURI: this.config.apiURI,
5163
5204
  appId: this.config.appId
@@ -5184,7 +5225,7 @@ class ju {
5184
5225
  });
5185
5226
  }
5186
5227
  signOut(t) {
5187
- return D(this, void 0, void 0, function* () {
5228
+ return R(this, void 0, void 0, function* () {
5188
5229
  const n = yield this.getCurrentUser();
5189
5230
  this.potentiallyInvalidateToken(n, t), yield this.changeCurrentUser(null);
5190
5231
  });
@@ -5207,7 +5248,7 @@ class ju {
5207
5248
  * @param {string} [params.codeVerifier] - The code verifier used to generate the code challenge.
5208
5249
  */
5209
5250
  exchangeCodeForToken(t) {
5210
- return D(this, arguments, void 0, function* ({ code: n, codeVerifier: r }) {
5251
+ return R(this, arguments, void 0, function* ({ code: n, codeVerifier: r }) {
5211
5252
  var i;
5212
5253
  const s = yield this.getCurrentUser(), o = ((i = s == null ? void 0 : s.user) === null || i === void 0 ? void 0 : i.type) === "guest", u = yield Hn({
5213
5254
  apiURI: this.config.apiURI,
@@ -5230,7 +5271,7 @@ class ju {
5230
5271
  * @param {string | null | undefined} [params.nonce] - The nonce used when requesting the id_token from the external service
5231
5272
  */
5232
5273
  signInWithIdToken(t) {
5233
- return D(this, arguments, void 0, function* ({ idToken: n, clientName: r, nonce: i }) {
5274
+ return R(this, arguments, void 0, function* ({ idToken: n, clientName: r, nonce: i }) {
5234
5275
  var s;
5235
5276
  const o = yield this.getCurrentUser(), u = (s = o == null ? void 0 : o.user) === null || s === void 0 ? void 0 : s.refresh_token, a = yield Zo({
5236
5277
  apiURI: this.config.apiURI,
@@ -5381,14 +5422,14 @@ class ju {
5381
5422
  // --------
5382
5423
  // Storage
5383
5424
  uploadFile(t, n, r) {
5384
- return D(this, void 0, void 0, function* () {
5425
+ return R(this, void 0, void 0, function* () {
5385
5426
  var i;
5386
5427
  const s = yield this.getCurrentUser(), o = (i = s == null ? void 0 : s.user) === null || i === void 0 ? void 0 : i.refresh_token;
5387
5428
  return eu(Object.assign(Object.assign({}, r), { apiURI: this.config.apiURI, appId: this.config.appId, path: t, file: n, refreshToken: o }));
5388
5429
  });
5389
5430
  }
5390
5431
  deleteFile(t) {
5391
- return D(this, void 0, void 0, function* () {
5432
+ return R(this, void 0, void 0, function* () {
5392
5433
  var n;
5393
5434
  const r = yield this.getCurrentUser(), i = (n = r == null ? void 0 : r.user) === null || n === void 0 ? void 0 : n.refresh_token;
5394
5435
  return yield tu({
@@ -5402,7 +5443,7 @@ class ju {
5402
5443
  // Deprecated Storage API (Jan 2025)
5403
5444
  // ---------------------------------
5404
5445
  upload(t, n) {
5405
- return D(this, void 0, void 0, function* () {
5446
+ return R(this, void 0, void 0, function* () {
5406
5447
  var r;
5407
5448
  const i = yield this.getCurrentUser(), s = (r = i == null ? void 0 : i.user) === null || r === void 0 ? void 0 : r.refresh_token, o = t || n.name, u = yield nu({
5408
5449
  apiURI: this.config.apiURI,
@@ -5414,7 +5455,7 @@ class ju {
5414
5455
  });
5415
5456
  }
5416
5457
  getDownloadUrl(t) {
5417
- return D(this, void 0, void 0, function* () {
5458
+ return R(this, void 0, void 0, function* () {
5418
5459
  var n;
5419
5460
  const r = yield this.getCurrentUser(), i = (n = r == null ? void 0 : r.user) === null || n === void 0 ? void 0 : n.refresh_token;
5420
5461
  return yield iu({
@@ -5429,7 +5470,7 @@ class ju {
5429
5470
  let ot;
5430
5471
  function Pu(e, t) {
5431
5472
  ot == null || ot.dispose();
5432
- const n = Du(t), r = Ru(t, u), i = Iu(ku(e));
5473
+ const n = Du(t), r = Mu(t, u), i = Iu(ku(e));
5433
5474
  function s(c) {
5434
5475
  var f;
5435
5476
  c.source === i.element.contentWindow && ((f = c.data) === null || f === void 0 ? void 0 : f.type) === "close" && n.isVisible() && u();
@@ -5463,7 +5504,7 @@ function Iu(e) {
5463
5504
  border: "none"
5464
5505
  }), { element: t };
5465
5506
  }
5466
- function Ru(e, t) {
5507
+ function Mu(e, t) {
5467
5508
  const n = `
5468
5509
  <svg width="32" height="32" viewBox="0 0 512 512" fill="none" xmlns="http://www.w3.org/2000/svg">
5469
5510
  <rect width="512" height="512" fill="black"/>
@@ -5473,7 +5514,7 @@ function Ru(e, t) {
5473
5514
  return r.innerHTML = n, r.className = "instant-devtool-toggler", Object.assign(r.style, Object.assign(Object.assign({
5474
5515
  // pos
5475
5516
  position: "fixed"
5476
- }, Mu(e.position)), {
5517
+ }, Ru(e.position)), {
5477
5518
  height: "32px",
5478
5519
  width: "32px",
5479
5520
  // layout
@@ -5488,7 +5529,7 @@ function Ru(e, t) {
5488
5529
  cursor: "pointer"
5489
5530
  })), r.addEventListener("click", t), { element: r };
5490
5531
  }
5491
- function Mu(e) {
5532
+ function Ru(e) {
5492
5533
  switch (e) {
5493
5534
  case "bottom-left":
5494
5535
  return { bottom: "24px", left: "24px" };
@@ -5536,7 +5577,7 @@ function en(e) {
5536
5577
  const t = e.__adminToken;
5537
5578
  return e.appId + "_" + (e.websocketURI || "default_ws_uri") + "_" + (e.apiURI || "default_api_uri") + "_" + (t || "client_only") + "_" + e.useDateObjects;
5538
5579
  }
5539
- const tn = Lu(), Mt = Uu();
5580
+ const tn = Lu(), Rt = Uu();
5540
5581
  class Fu {
5541
5582
  constructor(t) {
5542
5583
  this.db = t, this.sendMagicCode = (n) => this.db.sendMagicCode(n), this.signInWithMagicCode = (n) => this.db.signInWithMagicCode(n), this.signInWithToken = (n) => this.db.signInWithCustomToken(n), this.signInAsGuest = () => this.db.signInAsGuest(), this.createAuthorizationURL = (n) => this.db.createAuthorizationURL(n), this.signInWithIdToken = (n) => this.db.signInWithIdToken(n), this.exchangeOAuthCode = (n) => this.db.exchangeCodeForToken(n), this.issuerURI = () => this.db.issuerURI(), this.signOut = (n = { invalidateToken: !0 }) => this.db.signOut(n);
@@ -5715,22 +5756,22 @@ class qu {
5715
5756
  function fr(e) {
5716
5757
  if (!e)
5717
5758
  return "0";
5718
- if (Mt.get(e))
5719
- return Mt.get(e);
5759
+ if (Rt.get(e))
5760
+ return Rt.get(e);
5720
5761
  const t = G(e);
5721
- return Mt.set(e, t), t;
5762
+ return Rt.set(e, t), t;
5722
5763
  }
5723
5764
  function Wu(e, t) {
5724
5765
  return fr(e._reactor.config.schema) !== fr(t);
5725
5766
  }
5726
- function Ku(e, t, n, r, i) {
5767
+ function zu(e, t, n, r, i) {
5727
5768
  const s = tn[en(e)];
5728
5769
  if (s)
5729
5770
  return Wu(s, e.schema) && s._reactor.updateSchema(e.schema), s;
5730
- const o = new ju(Object.assign(Object.assign(Object.assign({}, xu), e), { cardinalityInference: !!e.schema }), t || Nr, n || Vr, Object.assign(Object.assign({}, r || {}), { "@instantdb/core": zr }), i), u = new qu(o);
5731
- return tn[en(e)] = u, zu(e.appId, e.devtool), u;
5771
+ const o = new ju(Object.assign(Object.assign(Object.assign({}, xu), e), { cardinalityInference: !!e.schema }), t || Nr, n || Vr, Object.assign(Object.assign({}, r || {}), { "@instantdb/core": Kr }), i), u = new qu(o);
5772
+ return tn[en(e)] = u, Ku(e.appId, e.devtool), u;
5732
5773
  }
5733
- function zu(e, t) {
5774
+ function Ku(e, t) {
5734
5775
  if (typeof window > "u" || typeof window.location > "u" || typeof document > "u" || typeof t == "boolean" && !t)
5735
5776
  return;
5736
5777
  const n = Object.assign({ position: "bottom-right", allowedHosts: ["localhost"] }, typeof t == "object" ? t : {});
@@ -5947,7 +5988,7 @@ class ia {
5947
5988
  }, this.SignedOut = ({ children: r }) => {
5948
5989
  const i = this.useAuth();
5949
5990
  return i.isLoading || i.error || i.user ? null : /* @__PURE__ */ rt.jsx(rt.Fragment, { children: r });
5950
- }, this.core = Ku(
5991
+ }, this.core = zu(
5951
5992
  t,
5952
5993
  // @ts-expect-error because TS can't resolve subclass statics
5953
5994
  this.constructor.Storage,