@instantdb/react 0.22.133 → 0.22.134

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.
@@ -1,7 +1,7 @@
1
- var _i = Object.defineProperty;
2
- var wi = (t, e, n) => e in t ? _i(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
3
- var p = (t, e, n) => wi(t, typeof e != "symbol" ? e + "" : e, n);
4
- import ts, { useRef as it, useCallback as we, useSyncExternalStore as nn, useEffect as Ae, useMemo as rn, useState as ns, createElement as Ti } from "react";
1
+ var wi = Object.defineProperty;
2
+ var Ti = (t, e, n) => e in t ? wi(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
3
+ var p = (t, e, n) => Ti(t, typeof e != "symbol" ? e + "" : e, n);
4
+ import ts, { useRef as it, useCallback as we, useSyncExternalStore as nn, useEffect as Ae, useMemo as rn, useState as ns, createElement as mi } from "react";
5
5
  function q(t) {
6
6
  if (typeof t == "number")
7
7
  return (Math.abs(t * 2654435761) >>> 0).toString(16);
@@ -44,7 +44,7 @@ const U = {
44
44
  Remove: "remove",
45
45
  Replace: "replace",
46
46
  Add: "add"
47
- }, rs = Symbol.for("__MUTATIVE_PROXY_DRAFT__"), mi = Symbol("__MUTATIVE_RAW_RETURN_SYMBOL__"), Tt = Symbol.iterator, ne = {
47
+ }, rs = Symbol.for("__MUTATIVE_PROXY_DRAFT__"), Si = Symbol("__MUTATIVE_RAW_RETURN_SYMBOL__"), Tt = Symbol.iterator, ne = {
48
48
  mutable: "mutable",
49
49
  immutable: "immutable"
50
50
  }, Mn = {};
@@ -103,7 +103,7 @@ function ss(t, e = []) {
103
103
  return ss(t.parent, e);
104
104
  e.reverse();
105
105
  try {
106
- Si(t.copy, e);
106
+ vi(t.copy, e);
107
107
  } catch {
108
108
  return null;
109
109
  }
@@ -136,7 +136,7 @@ function Ee(t, e) {
136
136
  return r.indexOf("/") === -1 && r.indexOf("~") === -1 ? r : r.replace(/~/g, "~0").replace(/\//g, "~1");
137
137
  }).join("/");
138
138
  }
139
- function Si(t, e) {
139
+ function vi(t, e) {
140
140
  for (let n = 0; n < e.length - 1; n += 1) {
141
141
  const r = e[n];
142
142
  if (t = ye(Ce(t) === 3 ? Array.from(t) : t, r), typeof t != "object")
@@ -144,7 +144,7 @@ function Si(t, e) {
144
144
  }
145
145
  return t;
146
146
  }
147
- function vi(t) {
147
+ function Ei(t) {
148
148
  const e = Object.create(Object.getPrototypeOf(t));
149
149
  return Reflect.ownKeys(t).forEach((n) => {
150
150
  let r = Reflect.getOwnPropertyDescriptor(t, n);
@@ -160,7 +160,7 @@ function vi(t) {
160
160
  }), Reflect.defineProperty(e, n, r);
161
161
  }), e;
162
162
  }
163
- const Ei = Object.prototype.propertyIsEnumerable;
163
+ const Oi = Object.prototype.propertyIsEnumerable;
164
164
  function is(t, e) {
165
165
  let n;
166
166
  if (Array.isArray(t))
@@ -179,7 +179,7 @@ function is(t, e) {
179
179
  return new Map(t);
180
180
  } else if (e != null && e.mark && (n = e.mark(t, ne), n !== void 0) && n !== ne.mutable) {
181
181
  if (n === ne.immutable)
182
- return vi(t);
182
+ return Ei(t);
183
183
  if (typeof n == "function") {
184
184
  if (e.enablePatches || e.enableAutoFreeze)
185
185
  throw new Error("You can't use mark and patches or auto freeze together.");
@@ -191,7 +191,7 @@ function is(t, e) {
191
191
  return Object.keys(t).forEach((s) => {
192
192
  r[s] = t[s];
193
193
  }), Object.getOwnPropertySymbols(t).forEach((s) => {
194
- Ei.call(t, s) && (r[s] = t[s]);
194
+ Oi.call(t, s) && (r[s] = t[s]);
195
195
  }), r;
196
196
  } else
197
197
  throw new Error("Please check mark() to ensure that it is a stable marker draftable function.");
@@ -317,7 +317,7 @@ function os(t, e, n) {
317
317
  });
318
318
  }
319
319
  }
320
- function Oi(t, e) {
320
+ function Ai(t, e) {
321
321
  const n = t.type === 3 ? t.setMap : t.copy;
322
322
  t.finalities.revoke.length > 1 && t.assignedMap.get(e) && n && os(ye(n, e), t.finalities.handledSet, t.options);
323
323
  }
@@ -346,10 +346,10 @@ function Dn(t, e, n, r) {
346
346
  }
347
347
  }), t.options.enableAutoFreeze && s.finalities !== t.finalities && (t.options.enableAutoFreeze = !1)), ce(n, t.options) && t.finalities.draft.push(() => {
348
348
  const i = t.type === 3 ? t.setMap : t.copy;
349
- pe(ye(i, e), n) && Oi(t, e);
349
+ pe(ye(i, e), n) && Ai(t, e);
350
350
  });
351
351
  }
352
- function Ai(t, e, n, r, s) {
352
+ function ki(t, e, n, r, s) {
353
353
  let { original: i, assignedMap: o, options: a } = t, c = t.copy;
354
354
  c.length < i.length && ([i, c] = [c, i], [n, r] = [r, n]);
355
355
  for (let u = 0; u < i.length; u += 1)
@@ -395,7 +395,7 @@ function Ai(t, e, n, r, s) {
395
395
  }
396
396
  }
397
397
  }
398
- function ki({ original: t, copy: e, assignedMap: n }, r, s, i, o) {
398
+ function Ci({ original: t, copy: e, assignedMap: n }, r, s, i, o) {
399
399
  n.forEach((a, c) => {
400
400
  const u = ye(t, c), l = mt(ye(e, c)), f = a ? et(t, c) ? U.Replace : U.Add : U.Remove;
401
401
  if (pe(u, l) && f === U.Replace)
@@ -404,7 +404,7 @@ function ki({ original: t, copy: e, assignedMap: n }, r, s, i, o) {
404
404
  s.push(f === U.Remove ? { op: f, path: y } : { op: f, path: y, value: l }), i.push(f === U.Add ? { op: U.Remove, path: y } : f === U.Remove ? { op: U.Add, path: y, value: u } : { op: U.Replace, path: y, value: u });
405
405
  });
406
406
  }
407
- function Ci({ original: t, copy: e }, n, r, s, i) {
407
+ function Pi({ original: t, copy: e }, n, r, s, i) {
408
408
  let o = 0;
409
409
  t.forEach((a) => {
410
410
  if (!e.has(a)) {
@@ -441,11 +441,11 @@ function ot(t, e, n, r) {
441
441
  switch (t.type) {
442
442
  case 0:
443
443
  case 2:
444
- return ki(t, e, n, r, s);
444
+ return Ci(t, e, n, r, s);
445
445
  case 1:
446
- return Ai(t, e, n, r, s);
446
+ return ki(t, e, n, r, s);
447
447
  case 3:
448
- return Ci(t, e, n, r, s);
448
+ return Pi(t, e, n, r, s);
449
449
  }
450
450
  }
451
451
  const kt = (t, e, n = !1) => {
@@ -532,7 +532,7 @@ const kt = (t, e, n = !1) => {
532
532
  [Tt]() {
533
533
  return this.entries();
534
534
  }
535
- }, Pi = Reflect.ownKeys(cn), br = (t, e, { isValuesIterator: n }) => () => {
535
+ }, Ii = Reflect.ownKeys(cn), br = (t, e, { isValuesIterator: n }) => () => {
536
536
  var r, s;
537
537
  const i = e.next();
538
538
  if (i.done)
@@ -643,7 +643,7 @@ Set.prototype.difference && Object.assign(Ct, {
643
643
  return Set.prototype.isDisjointFrom.call(new Set(this.values()), t);
644
644
  }
645
645
  });
646
- const Ii = Reflect.ownKeys(Ct), as = /* @__PURE__ */ new WeakSet(), cs = {
646
+ const Mi = Reflect.ownKeys(Ct), as = /* @__PURE__ */ new WeakSet(), cs = {
647
647
  get(t, e, n) {
648
648
  var r, s;
649
649
  const i = (r = t.copy) === null || r === void 0 ? void 0 : r[e];
@@ -658,14 +658,14 @@ const Ii = Reflect.ownKeys(Ct), as = /* @__PURE__ */ new WeakSet(), cs = {
658
658
  return t.options.strict && kt(u, t.options, !0), u;
659
659
  }
660
660
  const a = te(t);
661
- if (a instanceof Map && Pi.includes(e)) {
661
+ if (a instanceof Map && Ii.includes(e)) {
662
662
  if (e === "size")
663
663
  return Object.getOwnPropertyDescriptor(cn, "size").get.call(t.proxy);
664
664
  const u = cn[e];
665
665
  if (u)
666
666
  return u.bind(t.proxy);
667
667
  }
668
- if (a instanceof Set && Ii.includes(e)) {
668
+ if (a instanceof Set && Mi.includes(e)) {
669
669
  if (e === "size")
670
670
  return Object.getOwnPropertyDescriptor(Ct, "size").get.call(t.proxy);
671
671
  const u = Ct[e];
@@ -778,7 +778,7 @@ function Un(t) {
778
778
  return c;
779
779
  }
780
780
  Mn.createDraft = Un;
781
- function Mi(t, e, n, r, s) {
781
+ function ji(t, e, n, r, s) {
782
782
  var i;
783
783
  const o = P(t), a = (i = o == null ? void 0 : o.original) !== null && i !== void 0 ? i : t, c = !!e.length;
784
784
  if (o != null && o.operated)
@@ -791,7 +791,7 @@ function Mi(t, e, n, r, s) {
791
791
  r && c ? [{ op: U.Replace, path: [], value: a }] : r
792
792
  ];
793
793
  }
794
- function ji(t, e) {
794
+ function Ri(t, e) {
795
795
  var n;
796
796
  const r = {
797
797
  draft: [],
@@ -809,7 +809,7 @@ function ji(t, e) {
809
809
  return [
810
810
  a,
811
811
  (c = []) => {
812
- const [u, l, f] = Mi(a, c, s, i, e.enableAutoFreeze);
812
+ const [u, l, f] = ji(a, c, s, i, e.enableAutoFreeze);
813
813
  return e.enablePatches ? [u, l, f] : u;
814
814
  }
815
815
  ];
@@ -866,7 +866,7 @@ function gr(t) {
866
866
  throw new Error(`current() is only used for Draft, parameter: ${t}`);
867
867
  return us(t);
868
868
  }
869
- const Ri = (t) => function e(n, r, s) {
869
+ const xi = (t) => function e(n, r, s) {
870
870
  var i, o, a;
871
871
  if (typeof n == "function" && typeof r != "function")
872
872
  return function(E, ...j) {
@@ -893,7 +893,7 @@ const Ri = (t) => function e(n, r, s) {
893
893
  };
894
894
  if (!ce(f, w) && typeof f == "object" && f !== null)
895
895
  throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");
896
- const [S, _] = ji(f, w);
896
+ const [S, _] = Ri(f, w);
897
897
  if (typeof r != "function") {
898
898
  if (!ce(f, w))
899
899
  throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");
@@ -910,7 +910,7 @@ const Ri = (t) => function e(n, r, s) {
910
910
  if (!ke(E)) {
911
911
  if (E !== void 0 && !pe(E, S) && (j != null && j.operated))
912
912
  throw new Error("Either the value is returned as a new non-draft value, or only the draft is modified without returning any value.");
913
- const B = E == null ? void 0 : E[mi];
913
+ const B = E == null ? void 0 : E[Si];
914
914
  if (B) {
915
915
  const be = B[0];
916
916
  return w.strict && typeof E == "object" && E !== null && un({
@@ -935,7 +935,7 @@ const Ri = (t) => function e(n, r, s) {
935
935
  return m instanceof Promise ? m.then(A, (E) => {
936
936
  throw sn(P(S)), E;
937
937
  }) : A(m);
938
- }, Pt = Ri();
938
+ }, Pt = xi();
939
939
  Object.prototype.constructor.toString();
940
940
  function ls(t, e) {
941
941
  const n = Object.keys(t), r = Object.keys(e);
@@ -974,7 +974,7 @@ function fs(t, e) {
974
974
  function He(t) {
975
975
  return typeof t == "object" && t !== null && !Array.isArray(t);
976
976
  }
977
- function xi(t, e, n) {
977
+ function $i(t, e, n) {
978
978
  if (!t || e.length === 0)
979
979
  return;
980
980
  let r = t || {};
@@ -1004,13 +1004,13 @@ function ds(t, e) {
1004
1004
  Array.isArray(t) ? t.splice(n, 1) : delete t[n];
1005
1005
  return;
1006
1006
  }
1007
- ds(t[n], r), $i(t[n]) && delete t[n];
1007
+ ds(t[n], r), Di(t[n]) && delete t[n];
1008
1008
  }
1009
1009
  }
1010
- function $i(t) {
1010
+ function Di(t) {
1011
1011
  return t && Object.keys(t).length === 0;
1012
1012
  }
1013
- const Tr = /ZULU|YEKT|YEKST|YAPT|YAKT|YAKST|XJT|WGT|WGST|WFT|WETDST|WET|WDT|WAT|WAST|WAKT|WADT|VUT|VOLT|VLAT|VLAST|VET|UZT|UZST|UYT|UYST|UTC|UT|ULAT|ULAST|UCT|TVT|TRUT|TOT|TMT|TKT|TJT|TFT|TAHT|SGT|SCT|SAST|SADT|RET|PYT|PYST|PWT|PST|PONT|PMST|PMDT|PKT|PKST|PHT|PGT|PETT|PETST|PET|PDT|OMST|OMSST|NZT|NZST|NZDT|NUT|NST|NPT|NOVT|NOVST|NFT|NDT|MYT|MVT|MUT|MUST|MST|MSK|MSD|MPT|MMT|MHT|MEZ|METDST|MET|MESZ|MEST|MDT|MAWT|MART|MAGT|MAGST|LKT|LINT|LIGT|LHST|LHDT|KST|KRAT|KRAST|KOST|KGT|KGST|KDT|JST|JAYT|IST|IRT|IRKT|IRKST|IOT|IDT|ICT|HST|HKT|GYT|GMT|GILT|GFT|GET|GEST|GAMT|GALT|FNT|FNST|FKT|FKST|FJT|FJST|FET|EST|EGT|EGST|EETDST|EET|EEST|EDT|EAT|EAST|EASST|DDUT|DAVT|CXT|CST|COT|CLT|CLST|CKT|CHUT|CHAST|CHADT|CETDST|CET|CEST|CDT|CCT|CAST|CADT|BTT|BST|BRT|BRST|BRA|BOT|BORT|BNT|BDT|BDST|AZT|AZST|AZOT|AZOST|AWST|AWSST|AST|ART|ARST|ANAT|ANAST|AMT|AMST|ALMT|ALMST|AKST|AKDT|AFT|AEST|AESST|AEDT|ADT|ACWST|ACT|ACST|ACSST|ACDT$/, Di = {
1013
+ const Tr = /ZULU|YEKT|YEKST|YAPT|YAKT|YAKST|XJT|WGT|WGST|WFT|WETDST|WET|WDT|WAT|WAST|WAKT|WADT|VUT|VOLT|VLAT|VLAST|VET|UZT|UZST|UYT|UYST|UTC|UT|ULAT|ULAST|UCT|TVT|TRUT|TOT|TMT|TKT|TJT|TFT|TAHT|SGT|SCT|SAST|SADT|RET|PYT|PYST|PWT|PST|PONT|PMST|PMDT|PKT|PKST|PHT|PGT|PETT|PETST|PET|PDT|OMST|OMSST|NZT|NZST|NZDT|NUT|NST|NPT|NOVT|NOVST|NFT|NDT|MYT|MVT|MUT|MUST|MST|MSK|MSD|MPT|MMT|MHT|MEZ|METDST|MET|MESZ|MEST|MDT|MAWT|MART|MAGT|MAGST|LKT|LINT|LIGT|LHST|LHDT|KST|KRAT|KRAST|KOST|KGT|KGST|KDT|JST|JAYT|IST|IRT|IRKT|IRKST|IOT|IDT|ICT|HST|HKT|GYT|GMT|GILT|GFT|GET|GEST|GAMT|GALT|FNT|FNST|FKT|FKST|FJT|FJST|FET|EST|EGT|EGST|EETDST|EET|EEST|EDT|EAT|EAST|EASST|DDUT|DAVT|CXT|CST|COT|CLT|CLST|CKT|CHUT|CHAST|CHADT|CETDST|CET|CEST|CDT|CCT|CAST|CADT|BTT|BST|BRT|BRST|BRA|BOT|BORT|BNT|BDT|BDST|AZT|AZST|AZOT|AZOST|AWST|AWSST|AST|ART|ARST|ANAT|ANAST|AMT|AMST|ALMT|ALMST|AKST|AKDT|AFT|AEST|AESST|AEDT|ADT|ACWST|ACT|ACST|ACSST|ACDT$/, Ui = {
1014
1014
  ZULU: 0,
1015
1015
  YEKT: 18e3,
1016
1016
  YEKST: 21600,
@@ -1206,39 +1206,39 @@ const Tr = /ZULU|YEKT|YEKST|YAPT|YAKT|YAKST|XJT|WGT|WGST|WFT|WETDST|WET|WDT|WAT|
1206
1206
  ACSST: 37800,
1207
1207
  ACDT: 37800
1208
1208
  };
1209
- function Ui(t) {
1209
+ function Li(t) {
1210
1210
  return new Date(t);
1211
1211
  }
1212
- function Li(t) {
1212
+ function Fi(t) {
1213
1213
  return /* @__PURE__ */ new Date(t + "Z");
1214
1214
  }
1215
- const Fi = /^(\d+)[\./-](\d+)[\./-](\d+)$/;
1216
- function Ni(t) {
1217
- const e = t.match(Fi);
1215
+ const Ni = /^(\d+)[\./-](\d+)[\./-](\d+)$/;
1216
+ function Ki(t) {
1217
+ const e = t.match(Ni);
1218
1218
  if (!e)
1219
1219
  return null;
1220
1220
  const [n, r, s, i] = e;
1221
1221
  return r <= 0 || s <= 0 || i <= 0 ? null : r > 999 ? new Date(Date.UTC(r, s - 1, i, 0, 0, 0, 0)) : new Date(Date.UTC(i, r - 1, s, 0, 0, 0, 0));
1222
1222
  }
1223
- function Ki(t) {
1223
+ function qi(t) {
1224
1224
  const [e, n] = t.split(" ");
1225
1225
  return /* @__PURE__ */ new Date(e + "T" + n + "Z");
1226
1226
  }
1227
- function qi(t) {
1227
+ function Wi(t) {
1228
1228
  const [e, n] = t.split(" ");
1229
1229
  return /* @__PURE__ */ new Date(e + "T" + n + "Z");
1230
1230
  }
1231
- function Wi(t) {
1231
+ function zi(t) {
1232
1232
  return new Date(t);
1233
1233
  }
1234
- function zi(t) {
1234
+ function Vi(t) {
1235
1235
  const e = /^(\w{3}) (\w{3}) (\d{2}) (\d{4})$/;
1236
1236
  if (!t.match(e))
1237
1237
  throw new Error(`Unable to parse \`${t}\` as a date.`);
1238
1238
  const r = /* @__PURE__ */ new Date(t + " UTC");
1239
1239
  return new Date(Date.UTC(r.getUTCFullYear(), r.getUTCMonth(), r.getUTCDate(), 0, 0, 0, 0));
1240
1240
  }
1241
- function Vi(t) {
1241
+ function Bi(t) {
1242
1242
  const e = /^(.+T.+)([+-])(\d{2})$/, n = t.match(e);
1243
1243
  if (n) {
1244
1244
  const [, r, s, i] = n, o = `${r}${s}${i}:00`;
@@ -1246,7 +1246,7 @@ function Vi(t) {
1246
1246
  }
1247
1247
  return null;
1248
1248
  }
1249
- function Bi(t) {
1249
+ function Gi(t) {
1250
1250
  const e = /^(\d+)-(\d{1,2})-(\d{1,2})([ T])(.+)$/, n = t.match(e);
1251
1251
  if (n) {
1252
1252
  const [, r, s, i, o, a] = n, c = s.padStart(2, "0"), u = i.padStart(2, "0"), l = `${r}-${c}-${u}T${a}`;
@@ -1254,14 +1254,14 @@ function Bi(t) {
1254
1254
  }
1255
1255
  return null;
1256
1256
  }
1257
- function Gi(t) {
1257
+ function Qi(t) {
1258
1258
  const [e, n] = t.split(", "), [r, s, i] = e.split("/").map(Number), o = n.match(/(\d{1,2}):(\d{2}):(\d{2}) (AM|PM)/);
1259
1259
  if (!o)
1260
1260
  throw new Error(`Unable to parse time from: ${t}`);
1261
1261
  let [, a, c, u, l] = o;
1262
1262
  return a = Number(a), c = Number(c), u = Number(u), l === "PM" && a !== 12 ? a += 12 : l === "AM" && a === 12 && (a = 0), new Date(Date.UTC(i, r - 1, s, a, c, u));
1263
1263
  }
1264
- function Qi(t) {
1264
+ function Hi(t) {
1265
1265
  switch (t) {
1266
1266
  case "epoch":
1267
1267
  return /* @__PURE__ */ new Date(0);
@@ -1273,28 +1273,28 @@ function Qi(t) {
1273
1273
  return null;
1274
1274
  }
1275
1275
  }
1276
- function Hi(t) {
1276
+ function Ji(t) {
1277
1277
  const e = t.match(Tr);
1278
1278
  if (!e)
1279
1279
  return null;
1280
- const [n] = e, r = Di[n], s = new Date(t.replace(Tr, "Z"));
1280
+ const [n] = e, r = Ui[n], s = new Date(t.replace(Tr, "Z"));
1281
1281
  return new Date(s.getTime() - r * 1e3);
1282
1282
  }
1283
- const Ji = [
1284
- Ni,
1285
- qi,
1286
- zi,
1287
- Gi,
1283
+ const Yi = [
1284
+ Ki,
1288
1285
  Wi,
1289
- Li,
1290
1286
  Vi,
1291
- Ki,
1292
- Ui,
1293
1287
  Qi,
1288
+ zi,
1289
+ Fi,
1290
+ Bi,
1291
+ qi,
1292
+ Li,
1294
1293
  Hi,
1295
- Bi
1294
+ Ji,
1295
+ Gi
1296
1296
  ];
1297
- function Yi(t, e) {
1297
+ function Zi(t, e) {
1298
1298
  try {
1299
1299
  const n = t(e);
1300
1300
  return n instanceof Date && !isNaN(n.getTime()) ? n : null;
@@ -1303,14 +1303,14 @@ function Yi(t, e) {
1303
1303
  }
1304
1304
  }
1305
1305
  function ln(t) {
1306
- for (const e of Ji) {
1307
- const n = Yi(e, t);
1306
+ for (const e of Yi) {
1307
+ const n = Zi(e, t);
1308
1308
  if (n)
1309
1309
  return n;
1310
1310
  }
1311
1311
  return null;
1312
1312
  }
1313
- function Zi(t) {
1313
+ function Xi(t) {
1314
1314
  try {
1315
1315
  const e = JSON.parse(t);
1316
1316
  return typeof e == "string" ? ln(e) : null;
@@ -1325,7 +1325,7 @@ function Rt(t) {
1325
1325
  if (t instanceof Date)
1326
1326
  return t;
1327
1327
  if (typeof t == "string") {
1328
- const e = ln(t) || Zi(t) || ln(t.trim());
1328
+ const e = ln(t) || Xi(t) || ln(t.trim());
1329
1329
  if (!e)
1330
1330
  throw new Error(`Unable to parse \`${t}\` as a date.`);
1331
1331
  return e;
@@ -1409,7 +1409,7 @@ class Oe {
1409
1409
  return { attrs: this.attrs, linkIndex: this.linkIndex };
1410
1410
  }
1411
1411
  }
1412
- function Xi(t) {
1412
+ function eo(t) {
1413
1413
  return t.cardinality === "one";
1414
1414
  }
1415
1415
  function Fn(t) {
@@ -1471,7 +1471,7 @@ function bs(t, e) {
1471
1471
  if (e && "__type" in e)
1472
1472
  return new Oe(e.attrs, e.linkIndex);
1473
1473
  }
1474
- function eo(t, e) {
1474
+ function to(t, e) {
1475
1475
  return qe(t.eav, [e]) !== void 0;
1476
1476
  }
1477
1477
  function Je(t, e, n, r) {
@@ -1512,12 +1512,12 @@ function gs(t, e, n) {
1512
1512
  const [s, i, o] = r, a = e.getAttr(i);
1513
1513
  a && (ae(t.eav, [s, i, o]), ae(t.aev, [i, s, o]), Fn(a) && ae(t.vae, [o, i, s]));
1514
1514
  }
1515
- let to = 0;
1515
+ let no = 0;
1516
1516
  function _s(t, e, n) {
1517
1517
  const [r, s, i] = n;
1518
1518
  let o;
1519
1519
  const a = qe(t.eav, [r, s, i]);
1520
- return a && (o = a[3]), o || Date.now() * 10 + to++;
1520
+ return a && (o = a[3]), o || Date.now() * 10 + no++;
1521
1521
  }
1522
1522
  function ws(t, e, n) {
1523
1523
  const r = ct(t, n);
@@ -1529,9 +1529,9 @@ function ws(t, e, n) {
1529
1529
  return;
1530
1530
  a["checked-data-type"] === "date" && t.useDateObjects && (o = Rt(o));
1531
1531
  const c = qe(t.eav, [s, i, o]), u = (c == null ? void 0 : c[3]) ?? _s(t, a, r), l = [s, i, o, u];
1532
- Xi(a) ? (Z(t.eav, [s, i], /* @__PURE__ */ new Map([[o, l]])), Z(t.aev, [i, s], /* @__PURE__ */ new Map([[o, l]]))) : (Z(t.eav, [s, i, o], l), Z(t.aev, [i, s, o], l)), Fn(a) && Z(t.vae, [o, i, s], l);
1532
+ eo(a) ? (Z(t.eav, [s, i], /* @__PURE__ */ new Map([[o, l]])), Z(t.aev, [i, s], /* @__PURE__ */ new Map([[o, l]]))) : (Z(t.eav, [s, i, o], l), Z(t.aev, [i, s, o], l)), Fn(a) && Z(t.vae, [o, i, s], l);
1533
1533
  }
1534
- function no(t, e, n) {
1534
+ function ro(t, e, n) {
1535
1535
  var y;
1536
1536
  const r = ct(t, n);
1537
1537
  if (!r)
@@ -1588,29 +1588,29 @@ function Ts(t, e, n) {
1588
1588
  t[s] = r[s];
1589
1589
  });
1590
1590
  }
1591
- function ro(t, [e]) {
1591
+ function so(t, [e]) {
1592
1592
  t.addAttr(e);
1593
1593
  }
1594
1594
  function ms(t) {
1595
1595
  return X(t.eav, 3);
1596
1596
  }
1597
- function so(t, e, [n]) {
1597
+ function io(t, e, [n]) {
1598
1598
  if (!e.getAttr(n))
1599
1599
  return;
1600
1600
  const r = ms(t).filter(([s, i]) => i !== n);
1601
1601
  e.deleteAttr(n), Ts(t, e, r);
1602
1602
  }
1603
- function io(t, e, [n]) {
1603
+ function oo(t, e, [n]) {
1604
1604
  e.getAttr(n.id) && (e.updateAttr(n), Ts(t, e, ms(t)));
1605
1605
  }
1606
- function oo(t, e, n) {
1606
+ function ao(t, e, n) {
1607
1607
  const [r, ...s] = n;
1608
1608
  switch (r) {
1609
1609
  case "add-triple":
1610
1610
  ws(t, e, s);
1611
1611
  break;
1612
1612
  case "deep-merge-triple":
1613
- no(t, e, s);
1613
+ ro(t, e, s);
1614
1614
  break;
1615
1615
  case "retract-triple":
1616
1616
  gs(t, e, s);
@@ -1619,13 +1619,13 @@ function oo(t, e, n) {
1619
1619
  fn(t, e, s);
1620
1620
  break;
1621
1621
  case "add-attr":
1622
- ro(e, s);
1622
+ so(e, s);
1623
1623
  break;
1624
1624
  case "delete-attr":
1625
- so(t, e, s);
1625
+ io(t, e, s);
1626
1626
  break;
1627
1627
  case "update-attr":
1628
- io(t, e, s);
1628
+ oo(t, e, s);
1629
1629
  break;
1630
1630
  case "restore-attr":
1631
1631
  break;
@@ -1680,13 +1680,13 @@ function yt(t, e, n) {
1680
1680
  }
1681
1681
  return r;
1682
1682
  }
1683
- function ao(t, e, n) {
1683
+ function co(t, e, n) {
1684
1684
  let r = "";
1685
1685
  return t !== void 0 && (r += "e"), e !== void 0 && (r += "a"), n !== void 0 && (r += "v"), r;
1686
1686
  }
1687
- function co(t, [e, n, r]) {
1687
+ function uo(t, [e, n, r]) {
1688
1688
  var i, o;
1689
- switch (ao(e, n, r)) {
1689
+ switch (co(e, n, r)) {
1690
1690
  case "e": {
1691
1691
  const a = t.eav.get(e);
1692
1692
  return X(a, 2);
@@ -1732,7 +1732,7 @@ function co(t, [e, n, r]) {
1732
1732
  return X(t.eav, 3);
1733
1733
  }
1734
1734
  }
1735
- function uo(t, e, n) {
1735
+ function lo(t, e, n) {
1736
1736
  var s;
1737
1737
  const r = {};
1738
1738
  if (!e)
@@ -1752,7 +1752,7 @@ function Pe(t, e, n) {
1752
1752
  var r;
1753
1753
  return (r = t.revIdents.get(e)) == null ? void 0 : r.get(n);
1754
1754
  }
1755
- function lo(t, e) {
1755
+ function fo(t, e) {
1756
1756
  return t.blobAttrs.get(e);
1757
1757
  }
1758
1758
  function Ss(t, e) {
@@ -1760,7 +1760,7 @@ function Ss(t, e) {
1760
1760
  const n = t.primaryKeys.get(e);
1761
1761
  return n || ((r = t.forwardIdents.get(e)) == null ? void 0 : r.get("id"));
1762
1762
  }
1763
- function fo(t, e, n) {
1763
+ function ho(t, e, n) {
1764
1764
  const r = ct(t, n);
1765
1765
  if (!r)
1766
1766
  return;
@@ -1768,7 +1768,7 @@ function fo(t, e, n) {
1768
1768
  if (e.getAttr(i))
1769
1769
  return qe(t.eav, [s, i]);
1770
1770
  }
1771
- function ho(t, e, n) {
1771
+ function po(t, e, n) {
1772
1772
  const r = n.filter(([s, i, o, a, c]) => {
1773
1773
  if (s !== "add-triple" && s !== "deep-merge-triple")
1774
1774
  return !0;
@@ -1779,7 +1779,7 @@ function ho(t, e, n) {
1779
1779
  const f = e.getAttr(o);
1780
1780
  if (f) {
1781
1781
  const h = Ss(e, f["forward-identity"][1]);
1782
- l = !!fo(t, e, [
1782
+ l = !!ho(t, e, [
1783
1783
  i,
1784
1784
  h == null ? void 0 : h.id,
1785
1785
  i
@@ -1789,7 +1789,7 @@ function ho(t, e, n) {
1789
1789
  });
1790
1790
  return Pt({ store: t, attrsStore: e }, (s) => {
1791
1791
  r.forEach((i) => {
1792
- oo(s.store, s.attrsStore, i);
1792
+ ao(s.store, s.attrsStore, i);
1793
1793
  });
1794
1794
  }, {
1795
1795
  mark: (s) => {
@@ -1798,10 +1798,10 @@ function ho(t, e, n) {
1798
1798
  }
1799
1799
  });
1800
1800
  }
1801
- function po(t) {
1801
+ function yo(t) {
1802
1802
  return typeof t == "string" && t.startsWith("?");
1803
1803
  }
1804
- function yo(t, e, n) {
1804
+ function bo(t, e, n) {
1805
1805
  if (n.hasOwnProperty(t)) {
1806
1806
  const r = n[t];
1807
1807
  return vs(r, e, n);
@@ -1811,15 +1811,15 @@ function yo(t, e, n) {
1811
1811
  function mr(t, e, n) {
1812
1812
  return t === e ? n : null;
1813
1813
  }
1814
- function bo(t) {
1814
+ function go(t) {
1815
1815
  switch (typeof t) {
1816
1816
  case "string":
1817
- return t.startsWith("?") ? yo : mr;
1817
+ return t.startsWith("?") ? bo : mr;
1818
1818
  default:
1819
1819
  return mr;
1820
1820
  }
1821
1821
  }
1822
- const go = [
1822
+ const _o = [
1823
1823
  "in",
1824
1824
  "$in",
1825
1825
  "$not",
@@ -1827,69 +1827,69 @@ const go = [
1827
1827
  "$comparator"
1828
1828
  // covers all of $gt, $lt, etc.
1829
1829
  ];
1830
- function _o(t) {
1831
- for (const e of go)
1830
+ function wo(t) {
1831
+ for (const e of _o)
1832
1832
  if (t.hasOwnProperty(e))
1833
1833
  return !0;
1834
1834
  return !1;
1835
1835
  }
1836
1836
  function vs(t, e, n) {
1837
- return n ? typeof t == "object" ? _o(t) ? n : null : bo(t)(t, e, n) : null;
1837
+ return n ? typeof t == "object" ? wo(t) ? n : null : go(t)(t, e, n) : null;
1838
1838
  }
1839
- function wo(t, e, n) {
1839
+ function To(t, e, n) {
1840
1840
  return t.reduce((r, s, i) => {
1841
1841
  const o = e[i];
1842
1842
  return vs(s, o, r);
1843
1843
  }, n);
1844
1844
  }
1845
- function To(t, e, n) {
1846
- return vo(t, e, n).map((r) => wo(e, r, n)).filter((r) => r);
1847
- }
1848
1845
  function mo(t, e, n) {
1849
- return e.or ? e.or.patterns.flatMap((r) => dn(t, r, n)) : e.and ? e.and.patterns.reduce((r, s) => dn(t, s, r), n) : n.flatMap((r) => To(t, e, r));
1846
+ return Eo(t, e, n).map((r) => To(e, r, n)).filter((r) => r);
1847
+ }
1848
+ function So(t, e, n) {
1849
+ return e.or ? e.or.patterns.flatMap((r) => dn(t, r, n)) : e.and ? e.and.patterns.reduce((r, s) => dn(t, s, r), n) : n.flatMap((r) => mo(t, e, r));
1850
1850
  }
1851
1851
  function dn(t, e, n = [{}]) {
1852
- return e.reduce((r, s) => mo(t, s, r), n);
1852
+ return e.reduce((r, s) => So(t, s, r), n);
1853
1853
  }
1854
1854
  function Kn(t, e) {
1855
- return Array.isArray(e) ? e.map((n) => Kn(t, n)) : po(e) ? t[e] : e;
1855
+ return Array.isArray(e) ? e.map((n) => Kn(t, n)) : yo(e) ? t[e] : e;
1856
1856
  }
1857
- function So(t, { find: e, where: n }) {
1857
+ function vo(t, { find: e, where: n }) {
1858
1858
  return dn(t, n).map((s) => Kn(s, e));
1859
1859
  }
1860
- function vo(t, e, n) {
1861
- return co(t, Kn(n, e));
1860
+ function Eo(t, e, n) {
1861
+ return uo(t, Kn(n, e));
1862
1862
  }
1863
- const Eo = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;
1863
+ const Oo = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;
1864
1864
  function Fe(t) {
1865
- return typeof t == "string" && Eo.test(t);
1865
+ return typeof t == "string" && Oo.test(t);
1866
1866
  }
1867
1867
  const z = [];
1868
1868
  for (let t = 0; t < 256; ++t)
1869
1869
  z.push((t + 256).toString(16).slice(1));
1870
- function Oo(t, e = 0) {
1870
+ function Ao(t, e = 0) {
1871
1871
  return (z[t[e + 0]] + z[t[e + 1]] + z[t[e + 2]] + z[t[e + 3]] + "-" + z[t[e + 4]] + z[t[e + 5]] + "-" + z[t[e + 6]] + z[t[e + 7]] + "-" + z[t[e + 8]] + z[t[e + 9]] + "-" + z[t[e + 10]] + z[t[e + 11]] + z[t[e + 12]] + z[t[e + 13]] + z[t[e + 14]] + z[t[e + 15]]).toLowerCase();
1872
1872
  }
1873
1873
  let Ht;
1874
- const Ao = new Uint8Array(16);
1875
- function ko() {
1874
+ const ko = new Uint8Array(16);
1875
+ function Co() {
1876
1876
  if (!Ht) {
1877
1877
  if (typeof crypto > "u" || !crypto.getRandomValues)
1878
1878
  throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
1879
1879
  Ht = crypto.getRandomValues.bind(crypto);
1880
1880
  }
1881
- return Ht(Ao);
1881
+ return Ht(ko);
1882
1882
  }
1883
- const Co = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), Sr = { randomUUID: Co };
1884
- function Po(t, e, n) {
1883
+ const Po = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), Sr = { randomUUID: Po };
1884
+ function Io(t, e, n) {
1885
1885
  var s;
1886
1886
  if (Sr.randomUUID && !t)
1887
1887
  return Sr.randomUUID();
1888
1888
  t = t || {};
1889
- const r = t.random ?? ((s = t.rng) == null ? void 0 : s.call(t)) ?? ko();
1889
+ const r = t.random ?? ((s = t.rng) == null ? void 0 : s.call(t)) ?? Co();
1890
1890
  if (r.length < 16)
1891
1891
  throw new Error("Random bytes length must be >= 16");
1892
- return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128, Oo(r);
1892
+ return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128, Ao(r);
1893
1893
  }
1894
1894
  function vr(t) {
1895
1895
  const e = t.replace(/-/g, ""), n = [];
@@ -1897,7 +1897,7 @@ function vr(t) {
1897
1897
  n.push(parseInt(e.substring(r, r + 2), 16));
1898
1898
  return n;
1899
1899
  }
1900
- function Io(t, e) {
1900
+ function Mo(t, e) {
1901
1901
  for (let n = 0; n < t.length; n++) {
1902
1902
  if (t[n] < e[n])
1903
1903
  return -1;
@@ -1906,17 +1906,17 @@ function Io(t, e) {
1906
1906
  }
1907
1907
  return 0;
1908
1908
  }
1909
- function Mo(t, e) {
1910
- return Io(vr(t), vr(e));
1909
+ function jo(t, e) {
1910
+ return Mo(vr(t), vr(e));
1911
1911
  }
1912
1912
  function W() {
1913
- return Po();
1913
+ return Io();
1914
1914
  }
1915
- function jo(t, e) {
1915
+ function Ro(t, e) {
1916
1916
  return t.localeCompare(e);
1917
1917
  }
1918
- function Ro() {
1919
- let t = jo;
1918
+ function xo() {
1919
+ let t = Ro;
1920
1920
  if (typeof Intl == "object" && Intl.hasOwnProperty("Collator"))
1921
1921
  try {
1922
1922
  t = Intl.Collator("en-US").compare;
@@ -1924,10 +1924,14 @@ function Ro() {
1924
1924
  }
1925
1925
  return t;
1926
1926
  }
1927
- const xo = Ro();
1928
- let $o = 0;
1927
+ const $o = xo();
1928
+ let Es = !0;
1929
+ const xu = (t) => {
1930
+ Es = t;
1931
+ };
1932
+ let Do = 0;
1929
1933
  function tt(t) {
1930
- return xt(`_${t}`, $o++);
1934
+ return xt(`_${t}`, Do++);
1931
1935
  }
1932
1936
  function xt(t, e) {
1933
1937
  return `?${t}-${e}`;
@@ -1937,27 +1941,27 @@ class Ne extends Error {
1937
1941
  super(e), this.name = "AttrNotFoundError";
1938
1942
  }
1939
1943
  }
1940
- function Do(t, e) {
1944
+ function Uo(t, e) {
1941
1945
  const n = Ss(t, e);
1942
1946
  if (!n)
1943
1947
  throw new Ne(`Could not find id attr for ${e}`);
1944
1948
  return n;
1945
1949
  }
1946
1950
  function Er(t, e, n, r) {
1947
- return [Uo(t, e, n, r)];
1951
+ return [Lo(t, e, n, r)];
1948
1952
  }
1949
- function Uo(t, e, n, r) {
1953
+ function Lo(t, e, n, r) {
1950
1954
  return [
1951
1955
  t(n, r),
1952
- Do(e, n).id,
1956
+ Uo(e, n).id,
1953
1957
  t(n, r),
1954
1958
  t("time", r)
1955
1959
  ];
1956
1960
  }
1957
- function Lo(t, e, n) {
1961
+ function Fo(t, e, n) {
1958
1962
  return t.map((r) => r === e ? n : r);
1959
1963
  }
1960
- function Es(t, e, n, r, s) {
1964
+ function Os(t, e, n, r, s) {
1961
1965
  const i = F(e, n, s), o = Pe(e, n, s), a = i || o;
1962
1966
  if (!a)
1963
1967
  throw new Ne(`Could not find attr for ${[n, s]}`);
@@ -1986,7 +1990,7 @@ function Or(t, e) {
1986
1990
  return typeof o != "string" ? !1 : s.test(o);
1987
1991
  };
1988
1992
  }
1989
- function Fo(t, e) {
1993
+ function No(t, e) {
1990
1994
  if (typeof e != "object" || e.hasOwnProperty("$in") || e.hasOwnProperty("in"))
1991
1995
  return e;
1992
1996
  const n = t["checked-data-type"] === "date";
@@ -2046,7 +2050,7 @@ function Fo(t, e) {
2046
2050
  }
2047
2051
  return e;
2048
2052
  }
2049
- function No(t, e, n, r, s, i) {
2053
+ function Ko(t, e, n, r, s, i) {
2050
2054
  const o = F(e, n, s), a = Pe(e, n, s), c = o || a;
2051
2055
  if (!c)
2052
2056
  throw new Ne(`No attr for etype = ${n} label = ${s}`);
@@ -2064,31 +2068,31 @@ function No(t, e, n, r, s, i) {
2064
2068
  return o ? [
2065
2069
  t(n, r),
2066
2070
  c.id,
2067
- Fo(c, i),
2071
+ No(c, i),
2068
2072
  tt("time")
2069
2073
  ] : [i, c.id, t(n, r), tt("time")];
2070
2074
  }
2071
- function Ko(t, e, n, r, s) {
2075
+ function qo(t, e, n, r, s) {
2072
2076
  const [i, o, a] = s.reduce((c, u) => {
2073
- const [l, f, h] = c, [y, b, g] = Es(t, e, l, f, u);
2077
+ const [l, f, h] = c, [y, b, g] = Os(t, e, l, f, u);
2074
2078
  return [y, b, [...h, g]];
2075
2079
  }, [n, r, []]);
2076
2080
  return [i, o, a];
2077
2081
  }
2078
2082
  function hn(t, e, n, r, s, i) {
2079
- const o = s.slice(0, s.length - 1), a = s[s.length - 1], [c, u, l] = Ko(t, e, n, r, o), f = No(t, e, c, u, a, i);
2083
+ const o = s.slice(0, s.length - 1), a = s[s.length - 1], [c, u, l] = qo(t, e, n, r, o), f = Ko(t, e, c, u, a, i);
2080
2084
  return l.concat([f]);
2081
2085
  }
2082
- function qo(t, e) {
2086
+ function Wo(t, e) {
2083
2087
  return e ? [e].concat(t) : t;
2084
2088
  }
2085
- function Wo([t, e]) {
2089
+ function zo([t, e]) {
2086
2090
  return t === "or" && Array.isArray(e);
2087
2091
  }
2088
- function zo([t, e]) {
2092
+ function Vo([t, e]) {
2089
2093
  return t === "and" && Array.isArray(e);
2090
2094
  }
2091
- function Vo(t, e, n) {
2095
+ function Bo(t, e, n) {
2092
2096
  return (r, s) => {
2093
2097
  const i = t(r, s);
2094
2098
  return e == i ? i : `${i}-${n}`;
@@ -2096,27 +2100,27 @@ function Vo(t, e, n) {
2096
2100
  }
2097
2101
  function Ar(t, e, n, r, s, i) {
2098
2102
  const o = t(r, s), a = i.map((c, u) => {
2099
- const l = Vo(t, o, u);
2100
- return Os(l, n, r, s, c);
2103
+ const l = Bo(t, o, u);
2104
+ return As(l, n, r, s, c);
2101
2105
  });
2102
2106
  return { [e]: { patterns: a, joinSym: o } };
2103
2107
  }
2104
- function Bo(t) {
2108
+ function Go(t) {
2105
2109
  const e = [];
2106
2110
  for (let n = 1; n <= t.length; n++)
2107
2111
  e.push(t.slice(0, n));
2108
2112
  return e;
2109
2113
  }
2110
2114
  function kr(t, e, n, r, s) {
2111
- return Bo(s).map((i) => hn(t, e, n, r, i, {
2115
+ return Go(s).map((i) => hn(t, e, n, r, i, {
2112
2116
  $isNull: !0
2113
2117
  }));
2114
2118
  }
2115
- function Os(t, e, n, r, s) {
2119
+ function As(t, e, n, r, s) {
2116
2120
  return Object.entries(s).flatMap(([i, o]) => {
2117
- if (Wo([i, o]))
2118
- return Ar(t, "or", e, n, r, o);
2119
2121
  if (zo([i, o]))
2122
+ return Ar(t, "or", e, n, r, o);
2123
+ if (Vo([i, o]))
2120
2124
  return Ar(t, "and", e, n, r, o);
2121
2125
  if (i === "$entityIdStartsWith")
2122
2126
  return [];
@@ -2142,25 +2146,25 @@ function Os(t, e, n, r, s) {
2142
2146
  ] : hn(t, e, n, r, a, o);
2143
2147
  });
2144
2148
  }
2145
- function Go(t, e, n, r) {
2149
+ function Qo(t, e, n, r) {
2146
2150
  const s = xt;
2147
- return r ? Os(s, t, e, n, r).concat(Er(s, t, e, n)) : Er(s, t, e, n);
2151
+ return r ? As(s, t, e, n, r).concat(Er(s, t, e, n)) : Er(s, t, e, n);
2148
2152
  }
2149
- function Qo(t, e, n) {
2153
+ function Ho(t, e, n) {
2150
2154
  return [t(e, n), t("time", n)];
2151
2155
  }
2152
- function Ho(t, e, n, r, s, i) {
2153
- const [o, a, c, u, l] = Es(t, e, n, r, s), f = Lo(c, t(n, r), i);
2156
+ function Jo(t, e, n, r, s, i) {
2157
+ const [o, a, c, u, l] = Os(t, e, n, r, s), f = Fo(c, t(n, r), i);
2154
2158
  return [o, a, f, u, l];
2155
2159
  }
2156
- function Jo(t, e, n, { etype: r, level: s, form: i }, o) {
2160
+ function Yo(t, e, n, { etype: r, level: s, form: i }, o) {
2157
2161
  const a = Object.keys(i).filter((c) => c !== "$");
2158
2162
  return a.length ? Object.entries(o).map(function([u, l]) {
2159
2163
  return a.map(function(y) {
2160
2164
  var g, w, S;
2161
2165
  const b = !!(e.cardinalityInference && ((S = (w = (g = n.linkIndex) == null ? void 0 : g[r]) == null ? void 0 : w[y]) != null && S.isSingular));
2162
2166
  try {
2163
- const [_, m, A] = Ho(t, n, r, s, y, u), E = ks(e, n, {
2167
+ const [_, m, A] = Jo(t, n, r, s, y, u), E = Cs(e, n, {
2164
2168
  etype: _,
2165
2169
  level: m,
2166
2170
  form: i[y],
@@ -2177,11 +2181,11 @@ function Jo(t, e, n, { etype: r, level: s, form: i }, o) {
2177
2181
  }, l);
2178
2182
  }) : Object.values(o);
2179
2183
  }
2180
- function Yo(t, e, n) {
2181
- return n === "string" ? xo(t, e) : t > e ? 1 : -1;
2184
+ function Zo(t, e, n) {
2185
+ return n === "string" ? $o(t, e) : t > e ? 1 : -1;
2182
2186
  }
2183
2187
  function Ye(t, e, n, r, s) {
2184
- return e === r || e == null && r == null ? Mo(t, n) : r == null ? 1 : e == null ? -1 : Yo(e, r, s);
2188
+ return e === r || e == null && r == null ? jo(t, n) : r == null ? 1 : e == null ? -1 : Zo(e, r, s);
2185
2189
  }
2186
2190
  function It([t, e], [n, r], s) {
2187
2191
  return Ye(t, e, n, r, s);
@@ -2189,7 +2193,7 @@ function It([t, e], [n, r], s) {
2189
2193
  function pn(t) {
2190
2194
  return t == null ? t : new Date(t).getTime();
2191
2195
  }
2192
- function Zo(t, e, n, r) {
2196
+ function Xo(t, e, n, r) {
2193
2197
  var b;
2194
2198
  const [s, i, o, a] = t, c = n === "desc" ? 1 : -1;
2195
2199
  if (((b = e["forward-identity"]) == null ? void 0 : b[2]) === "id")
@@ -2197,24 +2201,24 @@ function Zo(t, e, n, r) {
2197
2201
  const [u, l] = r, f = e["checked-data-type"], h = f === "date" ? pn(l) : l, y = f === "date" ? pn(o) : o;
2198
2202
  return It([u, h], [s, y], f) === c;
2199
2203
  }
2200
- function Xo(t, e) {
2204
+ function ea(t, e) {
2201
2205
  const n = e[1];
2202
2206
  return t.getAttr(n);
2203
2207
  }
2204
- function ea(t, e, n) {
2208
+ function ta(t, e, n) {
2205
2209
  const r = Object.keys(n)[0];
2206
2210
  return F(t, e, r);
2207
2211
  }
2208
- function ta(t, e, n, r) {
2212
+ function na(t, e, n, r) {
2209
2213
  if (n)
2210
- return Xo(t, n);
2214
+ return ea(t, n);
2211
2215
  if (r)
2212
- return ea(t, e, r);
2216
+ return ta(t, e, r);
2213
2217
  }
2214
- function na(t, e, n) {
2218
+ function ra(t, e, n) {
2215
2219
  var s, i;
2216
2220
  if (!Array.isArray(n.fields))
2217
- return lo(t, e);
2221
+ return fo(t, e);
2218
2222
  const r = /* @__PURE__ */ new Map();
2219
2223
  for (const o of n.fields) {
2220
2224
  const a = F(t, e, o), c = (s = a == null ? void 0 : a["forward-identity"]) == null ? void 0 : s[2];
@@ -2226,11 +2230,11 @@ function na(t, e, n) {
2226
2230
  }
2227
2231
  return r;
2228
2232
  }
2229
- function ra(t, e, { etype: n, pageInfo: r, dq: s, form: i }) {
2233
+ function sa(t, e, { etype: n, pageInfo: r, dq: s, form: i }) {
2230
2234
  var b, g;
2231
- const o = (b = i == null ? void 0 : i.$) == null ? void 0 : b.order, a = As(i), c = sa(i);
2232
- let u = So(t, s);
2233
- const l = r == null ? void 0 : r["start-cursor"], f = ta(e, n, l, o);
2235
+ const o = (b = i == null ? void 0 : i.$) == null ? void 0 : b.order, a = ks(i), c = ia(i);
2236
+ let u = vo(t, s);
2237
+ const l = r == null ? void 0 : r["start-cursor"], f = na(e, n, l, o);
2234
2238
  if (f && ((g = f == null ? void 0 : f["forward-identity"]) == null ? void 0 : g[2]) !== "id") {
2235
2239
  const w = f["checked-data-type"] === "date", S = f.id;
2236
2240
  u = u.map(([_]) => {
@@ -2245,57 +2249,57 @@ function ra(t, e, { etype: n, pageInfo: r, dq: s, form: i }) {
2245
2249
  return It(_, S, f == null ? void 0 : f["checked-data-type"]);
2246
2250
  });
2247
2251
  let h = {};
2248
- const y = na(e, n, s);
2252
+ const y = ra(e, n, s);
2249
2253
  for (const w of u) {
2250
2254
  const [S] = w;
2251
- if (h[S] || !a && l && f && Zo(l, f, c, w))
2255
+ if (h[S] || !a && l && f && Xo(l, f, c, w))
2252
2256
  continue;
2253
- const _ = uo(t, y, S);
2257
+ const _ = lo(t, y, S);
2254
2258
  _ && (h[S] = _);
2255
2259
  }
2256
2260
  return h;
2257
2261
  }
2258
- function sa(t) {
2262
+ function ia(t) {
2259
2263
  var n;
2260
2264
  const e = (n = t.$) == null ? void 0 : n.order;
2261
2265
  return e && e[Object.keys(e)[0]] || "asc";
2262
2266
  }
2263
- function As(t) {
2267
+ function ks(t) {
2264
2268
  var s, i, o;
2265
2269
  const e = (s = t.$) == null ? void 0 : s.offset, n = (i = t.$) == null ? void 0 : i.before, r = (o = t.$) == null ? void 0 : o.after;
2266
2270
  return !e && !n && !r;
2267
2271
  }
2268
- function ia(t, e, { etype: n, level: r, form: s, join: i, pageInfo: o }) {
2272
+ function oa(t, e, { etype: n, level: r, form: s, join: i, pageInfo: o }) {
2269
2273
  var h, y, b, g, w;
2270
- if (!As(s) && (!o || !o["start-cursor"]))
2274
+ if (!ks(s) && (!o || !o["start-cursor"]))
2271
2275
  return [];
2272
- const a = qo(Go(e, n, r, (h = s.$) == null ? void 0 : h.where), i), c = Qo(xt, n, r), u = (y = s.$) == null ? void 0 : y.fields, l = ra(t, e, {
2276
+ const a = Wo(Qo(e, n, r, (h = s.$) == null ? void 0 : h.where), i), c = Ho(xt, n, r), u = (y = s.$) == null ? void 0 : y.fields, l = sa(t, e, {
2273
2277
  etype: n,
2274
2278
  pageInfo: o,
2275
2279
  form: s,
2276
2280
  dq: { where: a, find: c, fields: u }
2277
2281
  }), f = ((b = s.$) == null ? void 0 : b.limit) || ((g = s.$) == null ? void 0 : g.first) || ((w = s.$) == null ? void 0 : w.last);
2278
2282
  if (f != null) {
2279
- r > 0 && console.warn("WARNING: Limits in child queries are only run client-side. Data returned from the server will not have a limit.");
2283
+ r > 0 && Es && console.warn("WARNING: Limits in child queries are only run client-side. Data returned from the server will not have a limit.");
2280
2284
  const S = Object.entries(l);
2281
2285
  return S.length <= f ? l : Object.fromEntries(S.slice(0, f));
2282
2286
  }
2283
2287
  return l;
2284
2288
  }
2285
- function oa(t, e, n) {
2289
+ function aa(t, e, n) {
2286
2290
  try {
2287
- return ia(t, e, n);
2291
+ return oa(t, e, n);
2288
2292
  } catch (r) {
2289
2293
  if (r instanceof Ne)
2290
2294
  return {};
2291
2295
  throw r;
2292
2296
  }
2293
2297
  }
2294
- function ks(t, e, n) {
2295
- const r = oa(t, e, n);
2296
- return Jo(xt, t, e, n, r);
2298
+ function Cs(t, e, n) {
2299
+ const r = aa(t, e, n);
2300
+ return Yo(xt, t, e, n, r);
2297
2301
  }
2298
- function aa(t) {
2302
+ function ca(t) {
2299
2303
  const e = {};
2300
2304
  for (const [n, r] of Object.entries(t))
2301
2305
  e[n] = {
@@ -2306,18 +2310,18 @@ function aa(t) {
2306
2310
  };
2307
2311
  return e;
2308
2312
  }
2309
- function Cs({ store: t, attrsStore: e, pageInfo: n, aggregate: r }, s) {
2313
+ function Ps({ store: t, attrsStore: e, pageInfo: n, aggregate: r }, s) {
2310
2314
  const o = { data: Object.keys(s).reduce(function(c, u) {
2311
- return r != null && r[u] || u === "$$ruleParams" || (c[u] = ks(t, e, {
2315
+ return r != null && r[u] || u === "$$ruleParams" || (c[u] = Cs(t, e, {
2312
2316
  etype: u,
2313
2317
  form: s[u],
2314
2318
  level: 0,
2315
2319
  pageInfo: n == null ? void 0 : n[u]
2316
2320
  })), c;
2317
2321
  }, {}) };
2318
- return n && (o.pageInfo = aa(n)), r && (o.aggregate = r), o;
2322
+ return n && (o.pageInfo = ca(n)), r && (o.aggregate = r), o;
2319
2323
  }
2320
- function ca() {
2324
+ function ua() {
2321
2325
  const e = {
2322
2326
  __etype: 1,
2323
2327
  __ops: 1,
@@ -2331,7 +2335,7 @@ function ca() {
2331
2335
  };
2332
2336
  return new Set(Object.keys(e));
2333
2337
  }
2334
- const ua = ca();
2338
+ const la = ua();
2335
2339
  function vt(t, e, n) {
2336
2340
  const r = {
2337
2341
  __etype: t,
@@ -2343,7 +2347,7 @@ function vt(t, e, n) {
2343
2347
  return n;
2344
2348
  if (i === "__etype")
2345
2349
  return t;
2346
- if (ua.has(i))
2350
+ if (la.has(i))
2347
2351
  return (o, a) => vt(t, e, [
2348
2352
  ...n,
2349
2353
  a ? [i, t, e, o, a] : [i, t, e, o]
@@ -2351,7 +2355,7 @@ function vt(t, e, n) {
2351
2355
  }
2352
2356
  });
2353
2357
  }
2354
- function la(t, e) {
2358
+ function fa(t, e) {
2355
2359
  return `lookup__${t}__${JSON.stringify(e)}`;
2356
2360
  }
2357
2361
  function Mt(t) {
@@ -2361,13 +2365,13 @@ function yn(t) {
2361
2365
  const [e, n, ...r] = t.split("__");
2362
2366
  return [n, JSON.parse(r.join("__"))];
2363
2367
  }
2364
- function fa(t) {
2368
+ function da(t) {
2365
2369
  return new Proxy({
2366
2370
  __etype: t
2367
2371
  }, {
2368
2372
  get(e, n) {
2369
2373
  if (n === "lookup")
2370
- return (s, i) => vt(t, yn(la(s, i)), []);
2374
+ return (s, i) => vt(t, yn(fa(s, i)), []);
2371
2375
  if (n === "__etype")
2372
2376
  return t;
2373
2377
  const r = n;
@@ -2378,15 +2382,15 @@ function fa(t) {
2378
2382
  function qn() {
2379
2383
  return new Proxy({}, {
2380
2384
  get(t, e) {
2381
- return fa(e);
2385
+ return da(e);
2382
2386
  }
2383
2387
  });
2384
2388
  }
2385
- const Ru = qn();
2386
- function da(t) {
2389
+ const $u = qn();
2390
+ function ha(t) {
2387
2391
  return t.__ops;
2388
2392
  }
2389
- function ha(t, e) {
2393
+ function pa(t, e) {
2390
2394
  const { attrIdMap: n, refSwapAttrIds: r } = t, s = [];
2391
2395
  for (const o of e) {
2392
2396
  const a = n[o];
@@ -2405,7 +2409,7 @@ function ha(t, e) {
2405
2409
  }
2406
2410
  return s;
2407
2411
  }
2408
- function pa(t) {
2412
+ function ya(t) {
2409
2413
  if (Array.isArray(t))
2410
2414
  return t;
2411
2415
  const e = Object.entries(t);
@@ -2413,7 +2417,7 @@ function pa(t) {
2413
2417
  throw new Error("lookup must be an object with a single unique attr and value.");
2414
2418
  return e[0];
2415
2419
  }
2416
- function ya(t, e, n) {
2420
+ function ba(t, e, n) {
2417
2421
  return n.indexOf(".") !== -1 && // attr names can have `.` in them, so use the attr we find with a `.`
2418
2422
  // before assuming it's a ref lookup.
2419
2423
  !F(t, e, n);
@@ -2424,8 +2428,8 @@ function bn(t) {
2424
2428
  throw new Error(`${t} is not a valid lookup attribute.`);
2425
2429
  return e;
2426
2430
  }
2427
- function ba(t, e, n) {
2428
- if (!ya(t, e, n))
2431
+ function ga(t, e, n) {
2432
+ if (!ba(t, e, n))
2429
2433
  return F(t, e, n);
2430
2434
  const r = bn(n), s = F(t, e, r) || Pe(t, e, r);
2431
2435
  if (s && s["value-type"] !== "ref")
@@ -2433,18 +2437,18 @@ function ba(t, e, n) {
2433
2437
  return s;
2434
2438
  }
2435
2439
  function gn(t) {
2436
- return typeof t == "string" && !Mt(t) ? null : typeof t == "string" && Mt(t) ? yn(t) : pa(t);
2440
+ return typeof t == "string" && !Mt(t) ? null : typeof t == "string" && Mt(t) ? yn(t) : ya(t);
2437
2441
  }
2438
2442
  function ee(t, e, n) {
2439
2443
  const r = gn(n);
2440
2444
  if (r === null)
2441
2445
  return n;
2442
- const [s, i] = r, o = ba(t, e, s);
2446
+ const [s, i] = r, o = ga(t, e, s);
2443
2447
  if (!o || !o["unique?"])
2444
2448
  throw new Error(`${s} is not a unique attribute.`);
2445
2449
  return [o.id, i];
2446
2450
  }
2447
- function Ps(t, e, n, r) {
2451
+ function Is(t, e, n, r) {
2448
2452
  var o;
2449
2453
  const s = ee(t, e, n);
2450
2454
  return Array.isArray(s) ? [[
@@ -2454,7 +2458,7 @@ function Ps(t, e, n, r) {
2454
2458
  s
2455
2459
  ]].concat(r) : r;
2456
2460
  }
2457
- function ga({ attrsStore: t }, [e, n, r]) {
2461
+ function _a({ attrsStore: t }, [e, n, r]) {
2458
2462
  const s = Object.entries(r).flatMap(([i, o]) => {
2459
2463
  const a = Array.isArray(o) ? o : [o], c = F(t, e, i), u = Pe(t, e, i);
2460
2464
  return a.map((l) => c ? [
@@ -2473,9 +2477,9 @@ function ga({ attrsStore: t }, [e, n, r]) {
2473
2477
  ee(t, e, n)
2474
2478
  ]);
2475
2479
  });
2476
- return Ps(t, e, n, s);
2480
+ return Is(t, e, n, s);
2477
2481
  }
2478
- function _a({ attrsStore: t }, [e, n, r]) {
2482
+ function wa({ attrsStore: t }, [e, n, r]) {
2479
2483
  const s = Object.entries(r).flatMap(([i, o]) => {
2480
2484
  const a = Array.isArray(o) ? o : [o], c = F(t, e, i), u = Pe(t, e, i);
2481
2485
  return a.map((l) => c ? [
@@ -2494,9 +2498,9 @@ function _a({ attrsStore: t }, [e, n, r]) {
2494
2498
  ee(t, e, n)
2495
2499
  ]);
2496
2500
  });
2497
- return Ps(t, e, n, s);
2501
+ return Is(t, e, n, s);
2498
2502
  }
2499
- function wa(t, e, n, r) {
2503
+ function Ta(t, e, n, r) {
2500
2504
  var s;
2501
2505
  if (Array.isArray(r)) {
2502
2506
  const [i, o] = r;
@@ -2519,18 +2523,18 @@ function wa(t, e, n, r) {
2519
2523
  }
2520
2524
  return !1;
2521
2525
  }
2522
- function Is({ stores: t, attrsStore: e }, [n, r, s, i]) {
2523
- return (i == null ? void 0 : i.upsert) === !1 ? { mode: "update" } : (i == null ? void 0 : i.upsert) === !0 ? null : wa(t, e, n, r) ? { mode: "update" } : null;
2526
+ function Ms({ stores: t, attrsStore: e }, [n, r, s, i]) {
2527
+ return (i == null ? void 0 : i.upsert) === !1 ? { mode: "update" } : (i == null ? void 0 : i.upsert) === !0 ? null : Ta(t, e, n, r) ? { mode: "update" } : null;
2524
2528
  }
2525
- function Ta(t, e) {
2529
+ function ma(t, e) {
2526
2530
  const { attrsStore: n } = t, [r, s, i, o] = e, a = Ln(i), c = ee(n, r, s);
2527
2531
  return [["id", c]].concat(Object.entries(a)).map(([l, f]) => {
2528
2532
  const h = F(n, r, l);
2529
2533
  return h["checked-data-type"] === "date" && t.useDateObjects && (f = Rt(f)), ["add-triple", c, h.id, f, { mode: "create" }];
2530
2534
  });
2531
2535
  }
2532
- function ma(t, e) {
2533
- const { attrsStore: n } = t, [r, s, i, o] = e, a = Ln(i), c = ee(n, r, s), u = Is(t, [r, c, i, o]);
2536
+ function Sa(t, e) {
2537
+ const { attrsStore: n } = t, [r, s, i, o] = e, a = Ln(i), c = ee(n, r, s), u = Ms(t, [r, c, i, o]);
2534
2538
  return [["id", c]].concat(Object.entries(a)).map(([f, h]) => {
2535
2539
  const y = F(n, r, f);
2536
2540
  return y["checked-data-type"] === "date" && t.useDateObjects && (h = Rt(h)), [
@@ -2542,11 +2546,11 @@ function ma(t, e) {
2542
2546
  ];
2543
2547
  });
2544
2548
  }
2545
- function Sa({ attrsStore: t }, [e, n]) {
2549
+ function va({ attrsStore: t }, [e, n]) {
2546
2550
  return [["delete-entity", ee(t, e, n), e]];
2547
2551
  }
2548
- function va(t, e) {
2549
- const { attrsStore: n } = t, [r, s, i, o] = e, a = Ln(i), c = ee(n, r, s), u = Is(t, [r, c, i, o]), l = Object.entries(a).map(([h, y]) => {
2552
+ function Ea(t, e) {
2553
+ const { attrsStore: n } = t, [r, s, i, o] = e, a = Ln(i), c = ee(n, r, s), u = Ms(t, [r, c, i, o]), l = Object.entries(a).map(([h, y]) => {
2550
2554
  const b = F(n, r, h);
2551
2555
  return [
2552
2556
  "deep-merge-triple",
@@ -2564,38 +2568,38 @@ function va(t, e) {
2564
2568
  ...u ? [u] : []
2565
2569
  ]].concat(l);
2566
2570
  }
2567
- function Ea({ attrsStore: t }, [e, n, r]) {
2571
+ function Oa({ attrsStore: t }, [e, n, r]) {
2568
2572
  return [["rule-params", ee(t, e, n), e, r]];
2569
2573
  }
2570
- function Oa(t) {
2574
+ function Aa(t) {
2571
2575
  const [e, n, r, s, i] = t;
2572
2576
  if (!s)
2573
2577
  return t;
2574
2578
  const o = { ...s };
2575
2579
  return delete o.id, [e, n, r, o, ...i ? [i] : []];
2576
2580
  }
2577
- function Aa(t, e) {
2578
- const [n, ...r] = Oa(e);
2581
+ function ka(t, e) {
2582
+ const [n, ...r] = Aa(e);
2579
2583
  switch (n) {
2580
2584
  case "merge":
2581
- return va(t, r);
2585
+ return Ea(t, r);
2582
2586
  case "create":
2583
- return Ta(t, r);
2584
- case "update":
2585
2587
  return ma(t, r);
2588
+ case "update":
2589
+ return Sa(t, r);
2586
2590
  case "link":
2587
- return ga(t, r);
2588
- case "unlink":
2589
2591
  return _a(t, r);
2592
+ case "unlink":
2593
+ return wa(t, r);
2590
2594
  case "delete":
2591
- return Sa(t, r);
2595
+ return va(t, r);
2592
2596
  case "ruleParams":
2593
- return Ea(t, r);
2597
+ return Oa(t, r);
2594
2598
  default:
2595
2599
  throw new Error(`unsupported action ${n}`);
2596
2600
  }
2597
2601
  }
2598
- function ka(t) {
2602
+ function Ca(t) {
2599
2603
  switch (t) {
2600
2604
  case "string":
2601
2605
  case "date":
@@ -2606,14 +2610,14 @@ function ka(t) {
2606
2610
  return;
2607
2611
  }
2608
2612
  }
2609
- function Ca(t, e, n) {
2613
+ function Pa(t, e, n) {
2610
2614
  var a, c;
2611
2615
  const r = (c = (a = t.entities[e]) == null ? void 0 : a.attrs) == null ? void 0 : c[n];
2612
2616
  if (n === "id")
2613
2617
  return null;
2614
2618
  if (!r)
2615
2619
  throw new Error(`${e}.${n} does not exist in your schema`);
2616
- const { unique: s, indexed: i } = r == null ? void 0 : r.config, o = ka(r == null ? void 0 : r.valueType);
2620
+ const { unique: s, indexed: i } = r == null ? void 0 : r.config, o = Ca(r == null ? void 0 : r.valueType);
2617
2621
  return {
2618
2622
  "index?": i,
2619
2623
  "unique?": s,
@@ -2621,7 +2625,7 @@ function Ca(t, e, n) {
2621
2625
  };
2622
2626
  }
2623
2627
  function bt(t, e, n, r) {
2624
- const s = t ? Ca(t, e, n) : null, i = W(), a = [W(), e, n];
2628
+ const s = t ? Pa(t, e, n) : null, i = W(), a = [W(), e, n];
2625
2629
  return {
2626
2630
  id: i,
2627
2631
  "forward-identity": a,
@@ -2634,11 +2638,11 @@ function bt(t, e, n, r) {
2634
2638
  ...r || {}
2635
2639
  };
2636
2640
  }
2637
- function Pa(t, e, n) {
2641
+ function Ia(t, e, n) {
2638
2642
  return Object.values(t.links).find((i) => i.forward.on === e && i.forward.label === n || i.reverse.on === e && i.reverse.label === n);
2639
2643
  }
2640
- function Ia(t, e, n) {
2641
- const r = Pa(t, e, n);
2644
+ function Ma(t, e, n) {
2645
+ const r = Ia(t, e, n);
2642
2646
  if (!r)
2643
2647
  throw new Error(`Couldn't find the link ${e}.${n} in your schema`);
2644
2648
  const { forward: s, reverse: i } = r;
@@ -2652,7 +2656,7 @@ function Ia(t, e, n) {
2652
2656
  };
2653
2657
  }
2654
2658
  function Cr(t, e, n, r) {
2655
- const s = t ? Ia(t, e, n) : null, i = W(), o = [W(), e, n], a = [W(), n, e];
2659
+ const s = t ? Ma(t, e, n) : null, i = W(), o = [W(), e, n], a = [W(), n, e];
2656
2660
  return {
2657
2661
  id: i,
2658
2662
  // @ts-ignore: ts thinks it's any[]
@@ -2669,7 +2673,7 @@ function Cr(t, e, n, r) {
2669
2673
  ...r || {}
2670
2674
  };
2671
2675
  }
2672
- const Ma = /* @__PURE__ */ new Set(["create", "update", "merge", "link", "unlink"]), ja = /* @__PURE__ */ new Set(["link", "unlink"]), Ra = /* @__PURE__ */ new Set(["create", "update", "merge"]), xa = /* @__PURE__ */ new Set([
2676
+ const ja = /* @__PURE__ */ new Set(["create", "update", "merge", "link", "unlink"]), Ra = /* @__PURE__ */ new Set(["link", "unlink"]), xa = /* @__PURE__ */ new Set(["create", "update", "merge"]), $a = /* @__PURE__ */ new Set([
2673
2677
  "link",
2674
2678
  "unlink",
2675
2679
  "create",
@@ -2677,13 +2681,13 @@ const Ma = /* @__PURE__ */ new Set(["create", "update", "merge", "link", "unlink
2677
2681
  "merge",
2678
2682
  "delete",
2679
2683
  "ruleParams"
2680
- ]), _n = { "unique?": !0, "index?": !0 }, $a = {
2684
+ ]), _n = { "unique?": !0, "index?": !0 }, Da = {
2681
2685
  ..._n,
2682
2686
  cardinality: "one"
2683
2687
  };
2684
- function Da(t) {
2688
+ function Ua(t) {
2685
2689
  const e = [], [n, r, s, i] = t;
2686
- if (!xa.has(n))
2690
+ if (!$a.has(n))
2687
2691
  return e;
2688
2692
  const o = gn(s);
2689
2693
  if (o && e.push({ etype: r, lookupPair: o }), n === "link")
@@ -2700,7 +2704,7 @@ function Da(t) {
2700
2704
  }
2701
2705
  return e;
2702
2706
  }
2703
- function Ua({ attrsStore: t, schema: e }, n) {
2707
+ function La({ attrsStore: t, schema: e }, n) {
2704
2708
  var h, y;
2705
2709
  const r = /* @__PURE__ */ new Set(), s = [], i = [];
2706
2710
  function o(b, g) {
@@ -2725,10 +2729,10 @@ function Ua({ attrsStore: t, schema: e }, n) {
2725
2729
  }
2726
2730
  function f(b, g) {
2727
2731
  const w = o(b, g), S = a(b, g);
2728
- u(w), u(S), !w && !S && c(Cr(e, b, g, $a));
2732
+ u(w), u(S), !w && !S && c(Cr(e, b, g, Da));
2729
2733
  }
2730
2734
  for (const b of n)
2731
- for (const { etype: g, lookupPair: w, linkLabel: S } of Da(b)) {
2735
+ for (const { etype: g, lookupPair: w, linkLabel: S } of Ua(b)) {
2732
2736
  const _ = w[0];
2733
2737
  if (S) {
2734
2738
  f(g, S);
@@ -2750,12 +2754,12 @@ function Ua({ attrsStore: t, schema: e }, n) {
2750
2754
  }
2751
2755
  for (const b of n) {
2752
2756
  const [g, w, S, _] = b;
2753
- if (Ma.has(g)) {
2757
+ if (ja.has(g)) {
2754
2758
  const m = o(w, "id");
2755
2759
  u(m), m || c(bt(e, w, "id", { "unique?": !0 }));
2756
2760
  for (const A of Object.keys(_)) {
2757
2761
  const E = o(w, A);
2758
- if (u(E), Ra.has(g) && (E || c(bt(e, w, A, A === "id" ? { "unique?": !0 } : null))), ja.has(g)) {
2762
+ if (u(E), xa.has(g) && (E || c(bt(e, w, A, A === "id" ? { "unique?": !0 } : null))), Ra.has(g)) {
2759
2763
  const j = a(w, A);
2760
2764
  !E && !j && c(Cr(e, w, A)), u(j);
2761
2765
  }
@@ -2770,15 +2774,15 @@ function Ua({ attrsStore: t, schema: e }, n) {
2770
2774
  }
2771
2775
  return [t, i];
2772
2776
  }
2773
- function La(t, e) {
2774
- const r = (Array.isArray(e) ? e : [e]).flatMap((c) => da(c)), [s, i] = Ua(t, r), o = { ...t, attrsStore: s }, a = r.flatMap((c) => Aa(o, c));
2777
+ function Fa(t, e) {
2778
+ const r = (Array.isArray(e) ? e : [e]).flatMap((c) => ha(c)), [s, i] = La(t, r), o = { ...t, attrsStore: s }, a = r.flatMap((c) => ka(o, c));
2775
2779
  return [...i, ...a];
2776
2780
  }
2777
2781
  function Pr(t, e) {
2778
2782
  typeof requestIdleCallback > "u" ? t() : requestIdleCallback(t, { timeout: e });
2779
2783
  }
2780
2784
  const nt = "__meta";
2781
- class Fa {
2785
+ class Na {
2782
2786
  constructor(e, n) {
2783
2787
  }
2784
2788
  }
@@ -3022,13 +3026,13 @@ class wn {
3022
3026
  };
3023
3027
  }
3024
3028
  }
3025
- const Na = 6, Ka = ["kv", "querySubs", "syncSubs"];
3026
- function qa(t) {
3029
+ const Ka = 6, qa = ["kv", "querySubs", "syncSubs"];
3030
+ function Wa(t) {
3027
3031
  return function(n) {
3028
3032
  console.error("Error in IndexedDB event", { source: t, event: n });
3029
3033
  };
3030
3034
  }
3031
- async function Wa(t) {
3035
+ async function za(t) {
3032
3036
  return new Promise((e) => {
3033
3037
  const n = indexedDB.open(t);
3034
3038
  n.onerror = (r) => {
@@ -3042,7 +3046,7 @@ async function Wa(t) {
3042
3046
  };
3043
3047
  });
3044
3048
  }
3045
- async function za(t, e, n) {
3049
+ async function Va(t, e, n) {
3046
3050
  const r = (
3047
3051
  // Backwards compatibility for older versions where we JSON.stringified before storing
3048
3052
  typeof e == "string" ? JSON.parse(e) : e
@@ -3082,8 +3086,8 @@ async function Ir(t, e, n) {
3082
3086
  r.onsuccess = () => s(), r.onerror = (o) => i(o);
3083
3087
  });
3084
3088
  }
3085
- async function Va(t, e) {
3086
- const n = await Wa(`instant_${t}_5`);
3089
+ async function Ba(t, e) {
3090
+ const n = await za(`instant_${t}_5`);
3087
3091
  if (!n)
3088
3092
  return;
3089
3093
  const r = await new Promise((l, f) => {
@@ -3106,7 +3110,7 @@ async function Va(t, e) {
3106
3110
  for (const [l, f] of r)
3107
3111
  switch (l) {
3108
3112
  case "querySubs": {
3109
- const h = za(l, f, o);
3113
+ const h = Va(l, f, o);
3110
3114
  a.push(h);
3111
3115
  break;
3112
3116
  }
@@ -3128,7 +3132,7 @@ async function Va(t, e) {
3128
3132
  });
3129
3133
  }
3130
3134
  const Mr = /* @__PURE__ */ new Map();
3131
- class Ms extends Fa {
3135
+ class js extends Na {
3132
3136
  constructor(n, r) {
3133
3137
  super(n, r);
3134
3138
  p(this, "dbName");
@@ -3136,7 +3140,7 @@ class Ms extends Fa {
3136
3140
  p(this, "_appId");
3137
3141
  p(this, "_prefix");
3138
3142
  p(this, "_dbPromise");
3139
- this.dbName = `instant_${n}_${Na}`, this._storeName = r, this._appId = n, this._dbPromise = this._init();
3143
+ this.dbName = `instant_${n}_${Ka}`, this._storeName = r, this._appId = n, this._dbPromise = this._init();
3140
3144
  }
3141
3145
  _init() {
3142
3146
  return new Promise((n, r) => {
@@ -3147,8 +3151,8 @@ class Ms extends Fa {
3147
3151
  }, i.onsuccess = (o) => {
3148
3152
  const c = o.target.result;
3149
3153
  if (s) {
3150
- const u = Va(this._appId, c).catch((l) => {
3151
- qa("Error upgrading store from version 5 to 6.")(l);
3154
+ const u = Ba(this._appId, c).catch((l) => {
3155
+ Wa("Error upgrading store from version 5 to 6.")(l);
3152
3156
  });
3153
3157
  Mr.set(this.dbName, u), u.then(() => n(c)).catch(() => n(c));
3154
3158
  } else {
@@ -3162,7 +3166,7 @@ class Ms extends Fa {
3162
3166
  }
3163
3167
  _upgradeStore(n) {
3164
3168
  const s = n.target.result;
3165
- for (const i of Ka)
3169
+ for (const i of qa)
3166
3170
  s.objectStoreNames.contains(i) || s.createObjectStore(i);
3167
3171
  }
3168
3172
  async getItem(n) {
@@ -3227,7 +3231,7 @@ class Ms extends Fa {
3227
3231
  });
3228
3232
  }
3229
3233
  }
3230
- class js {
3234
+ class Rs {
3231
3235
  static async getIsOnline() {
3232
3236
  return navigator.onLine;
3233
3237
  }
@@ -3272,14 +3276,14 @@ async function ue(t, e) {
3272
3276
  const n = await fetch(t, e), r = await n.json();
3273
3277
  return n.status === 200 ? Promise.resolve(r) : Promise.reject(new $t({ status: n.status, body: r }));
3274
3278
  }
3275
- function Ba({ apiURI: t, appId: e, email: n }) {
3279
+ function Ga({ apiURI: t, appId: e, email: n }) {
3276
3280
  return ue(`${t}/runtime/auth/send_magic_code`, {
3277
3281
  method: "POST",
3278
3282
  headers: { "content-type": "application/json" },
3279
3283
  body: JSON.stringify({ "app-id": e, email: n })
3280
3284
  });
3281
3285
  }
3282
- async function Ga({ apiURI: t, appId: e, email: n, code: r, refreshToken: s }) {
3286
+ async function Qa({ apiURI: t, appId: e, email: n, code: r, refreshToken: s }) {
3283
3287
  return await ue(`${t}/runtime/auth/verify_magic_code`, {
3284
3288
  method: "POST",
3285
3289
  headers: { "content-type": "application/json" },
@@ -3291,7 +3295,7 @@ async function Ga({ apiURI: t, appId: e, email: n, code: r, refreshToken: s }) {
3291
3295
  })
3292
3296
  });
3293
3297
  }
3294
- async function Qa({ apiURI: t, appId: e, refreshToken: n }) {
3298
+ async function Ha({ apiURI: t, appId: e, refreshToken: n }) {
3295
3299
  return await ue(`${t}/runtime/auth/verify_refresh_token`, {
3296
3300
  method: "POST",
3297
3301
  headers: { "content-type": "application/json" },
@@ -3301,7 +3305,7 @@ async function Qa({ apiURI: t, appId: e, refreshToken: n }) {
3301
3305
  })
3302
3306
  });
3303
3307
  }
3304
- async function Ha({ apiURI: t, appId: e }) {
3308
+ async function Ja({ apiURI: t, appId: e }) {
3305
3309
  return await ue(`${t}/runtime/auth/sign_in_guest`, {
3306
3310
  method: "POST",
3307
3311
  headers: { "content-type": "application/json" },
@@ -3322,7 +3326,7 @@ async function jr({ apiURI: t, appId: e, code: n, codeVerifier: r, refreshToken:
3322
3326
  })
3323
3327
  });
3324
3328
  }
3325
- async function Ja({ apiURI: t, appId: e, nonce: n, idToken: r, clientName: s, refreshToken: i }) {
3329
+ async function Ya({ apiURI: t, appId: e, nonce: n, idToken: r, clientName: s, refreshToken: i }) {
3326
3330
  return await ue(`${t}/runtime/oauth/id_token`, {
3327
3331
  method: "POST",
3328
3332
  headers: { "content-type": "application/json" },
@@ -3335,7 +3339,7 @@ async function Ja({ apiURI: t, appId: e, nonce: n, idToken: r, clientName: s, re
3335
3339
  })
3336
3340
  });
3337
3341
  }
3338
- async function Ya({ apiURI: t, appId: e, refreshToken: n }) {
3342
+ async function Za({ apiURI: t, appId: e, refreshToken: n }) {
3339
3343
  return await ue(`${t}/runtime/signout`, {
3340
3344
  method: "POST",
3341
3345
  headers: {
@@ -3347,7 +3351,7 @@ async function Ya({ apiURI: t, appId: e, refreshToken: n }) {
3347
3351
  })
3348
3352
  });
3349
3353
  }
3350
- async function Za({ apiURI: t, appId: e, path: n, file: r, refreshToken: s, contentType: i, contentDisposition: o }) {
3354
+ async function Xa({ apiURI: t, appId: e, path: n, file: r, refreshToken: s, contentType: i, contentDisposition: o }) {
3351
3355
  const a = {
3352
3356
  app_id: e,
3353
3357
  path: n,
@@ -3360,7 +3364,7 @@ async function Za({ apiURI: t, appId: e, path: n, file: r, refreshToken: s, cont
3360
3364
  body: r
3361
3365
  });
3362
3366
  }
3363
- async function Xa({ apiURI: t, appId: e, path: n, refreshToken: r }) {
3367
+ async function ec({ apiURI: t, appId: e, path: n, refreshToken: r }) {
3364
3368
  const { data: s } = await ue(`${t}/storage/files?app_id=${e}&filename=${encodeURIComponent(n)}`, {
3365
3369
  method: "DELETE",
3366
3370
  headers: {
@@ -3370,7 +3374,7 @@ async function Xa({ apiURI: t, appId: e, path: n, refreshToken: r }) {
3370
3374
  });
3371
3375
  return s;
3372
3376
  }
3373
- async function ec({ apiURI: t, appId: e, fileName: n, refreshToken: r, metadata: s = {} }) {
3377
+ async function tc({ apiURI: t, appId: e, fileName: n, refreshToken: r, metadata: s = {} }) {
3374
3378
  const { data: i } = await ue(`${t}/storage/signed-upload-url`, {
3375
3379
  method: "POST",
3376
3380
  headers: {
@@ -3384,7 +3388,7 @@ async function ec({ apiURI: t, appId: e, fileName: n, refreshToken: r, metadata:
3384
3388
  });
3385
3389
  return i;
3386
3390
  }
3387
- async function tc(t, e) {
3391
+ async function nc(t, e) {
3388
3392
  return (await fetch(t, {
3389
3393
  method: "PUT",
3390
3394
  body: e,
@@ -3393,7 +3397,7 @@ async function tc(t, e) {
3393
3397
  }
3394
3398
  })).ok;
3395
3399
  }
3396
- async function nc({ apiURI: t, appId: e, path: n, refreshToken: r }) {
3400
+ async function rc({ apiURI: t, appId: e, path: n, refreshToken: r }) {
3397
3401
  const { data: s } = await ue(`${t}/storage/signed-download-url?app_id=${e}&filename=${encodeURIComponent(n)}`, {
3398
3402
  method: "GET",
3399
3403
  headers: {
@@ -3403,8 +3407,8 @@ async function nc({ apiURI: t, appId: e, path: n, refreshToken: r }) {
3403
3407
  });
3404
3408
  return s;
3405
3409
  }
3406
- let Wn = !1, Rs = !1, xs = !1;
3407
- typeof window < "u" && typeof window.localStorage < "u" && (Wn = !!window.localStorage.getItem("devBackend"), Rs = !!window.localStorage.getItem("__instantLogging"), xs = !!window.localStorage.getItem("__devtoolLocalDash"));
3410
+ let Wn = !1, xs = !1, $s = !1;
3411
+ typeof window < "u" && typeof window.localStorage < "u" && (Wn = !!window.localStorage.getItem("devBackend"), xs = !!window.localStorage.getItem("__instantLogging"), $s = !!window.localStorage.getItem("__devtoolLocalDash"));
3408
3412
  function Rr(t, e) {
3409
3413
  if (!e)
3410
3414
  return t;
@@ -3413,7 +3417,7 @@ function Rr(t, e) {
3413
3417
  n[r] = t[r];
3414
3418
  }), n;
3415
3419
  }
3416
- function rc(t, e, n) {
3420
+ function sc(t, e, n) {
3417
3421
  const r = {
3418
3422
  peers: {}
3419
3423
  };
@@ -3430,7 +3434,7 @@ function rc(t, e, n) {
3430
3434
  }
3431
3435
  return r;
3432
3436
  }
3433
- function sc(t, e) {
3437
+ function ic(t, e) {
3434
3438
  if (t.isLoading !== e.isLoading || t.error !== e.error || (t.user || e.user) && (!t.user || !e.user || !_r(t.user, e.user)) || !ls(t.peers, e.peers))
3435
3439
  return !0;
3436
3440
  for (const r of Object.keys(t.peers))
@@ -3454,18 +3458,18 @@ class xr {
3454
3458
  this._reject(e);
3455
3459
  }
3456
3460
  }
3457
- function $s(t, e = []) {
3461
+ function Ds(t, e = []) {
3458
3462
  t.forEach((n) => {
3459
3463
  const { data: r } = n, { "datalog-result": s } = r, { "join-rows": i } = s;
3460
3464
  for (const o of i)
3461
3465
  for (const a of o)
3462
3466
  e.push(a);
3463
- $s(n["child-nodes"], e);
3467
+ Ds(n["child-nodes"], e);
3464
3468
  });
3465
3469
  }
3466
3470
  function $r(t) {
3467
3471
  const e = [];
3468
- return $s(t, e), e;
3472
+ return Ds(t, e), e;
3469
3473
  }
3470
3474
  function Dr(t) {
3471
3475
  return Object.values(t.links).reduce((e, n) => {
@@ -3481,8 +3485,8 @@ function Dr(t) {
3481
3485
  }, e;
3482
3486
  }, {});
3483
3487
  }
3484
- const zn = "v0.22.133";
3485
- function ic(t, e) {
3488
+ const zn = "v0.22.134";
3489
+ function oc(t, e) {
3486
3490
  return {
3487
3491
  info: t ? (...n) => console.info(...n, e()) : () => {
3488
3492
  },
@@ -3582,7 +3586,7 @@ const Ur = [
3582
3586
  "before",
3583
3587
  "fields",
3584
3588
  "aggregate"
3585
- ], oc = (t) => t.valueType || "unknown", Ds = (t, e, n = !1) => {
3589
+ ], ac = (t) => t.valueType || "unknown", Us = (t, e, n = !1) => {
3586
3590
  if (n || t == null)
3587
3591
  return !0;
3588
3592
  switch (e) {
@@ -3597,9 +3601,9 @@ const Ur = [
3597
3601
  default:
3598
3602
  return !0;
3599
3603
  }
3600
- }, ac = (t, e, n, r, s, i, o) => {
3604
+ }, cc = (t, e, n, r, s, i, o) => {
3601
3605
  const a = i.valueType === "json", c = (u, l, f) => {
3602
- if (!Ds(f, l, a))
3606
+ if (!Us(f, l, a))
3603
3607
  throw new x(`Invalid value for operator '${u}' on attribute '${r}' in entity '${s}'. Expected ${l}, but received: ${typeof f}`, o);
3604
3608
  };
3605
3609
  switch (t) {
@@ -3630,16 +3634,16 @@ const Ur = [
3630
3634
  throw new x(`Unknown operator '${t}' for attribute '${r}' in entity '${s}'`, o);
3631
3635
  }
3632
3636
  }, Ue = (t, e, n, r, s) => {
3633
- const i = oc(n), o = n.valueType === "json";
3637
+ const i = ac(n), o = n.valueType === "json";
3634
3638
  if (typeof t == "object" && t !== null && !Array.isArray(t)) {
3635
3639
  if (o)
3636
3640
  return;
3637
3641
  const c = t;
3638
3642
  for (const [u, l] of Object.entries(c))
3639
- ac(u, l, i, e, r, n, `${s}.${u}`);
3640
- } else if (!Ds(t, i, o))
3643
+ cc(u, l, i, e, r, n, `${s}.${u}`);
3644
+ } else if (!Us(t, i, o))
3641
3645
  throw new x(`Invalid value for attribute '${e}' in entity '${r}'. Expected ${i}, but received: ${typeof t}`, s);
3642
- }, cc = (t, e, n, r, s) => {
3646
+ }, uc = (t, e, n, r, s) => {
3643
3647
  const i = t.split(".");
3644
3648
  if (i.length < 2)
3645
3649
  throw new x(`Invalid dot notation path '${t}'. Must contain at least one dot.`, s);
@@ -3676,12 +3680,12 @@ const Ur = [
3676
3680
  throw new x(`Attribute '${a}' does not exist on entity '${o}' in dot notation path '${t}'. Available attributes: ${l.length > 0 ? l.join(", ") + ", id" : "id"}`, s);
3677
3681
  }
3678
3682
  Ue(e, t, u, n, s);
3679
- }, Us = (t, e, n, r) => {
3683
+ }, Ls = (t, e, n, r) => {
3680
3684
  for (const [s, i] of Object.entries(t)) {
3681
3685
  if (s === "or" || s === "and") {
3682
3686
  if (Array.isArray(i))
3683
3687
  for (const u of i)
3684
- typeof u == "object" && u !== null && Us(u, e, n, `${r}.${s}[${u}]`);
3688
+ typeof u == "object" && u !== null && Ls(u, e, n, `${r}.${s}[${u}]`);
3685
3689
  continue;
3686
3690
  }
3687
3691
  if (s === "id") {
@@ -3689,7 +3693,7 @@ const Ur = [
3689
3693
  continue;
3690
3694
  }
3691
3695
  if (s.includes(".")) {
3692
- cc(s, i, e, n, `${r}.${s}`);
3696
+ uc(s, i, e, n, `${r}.${s}`);
3693
3697
  continue;
3694
3698
  }
3695
3699
  const o = n.entities[e];
@@ -3709,7 +3713,7 @@ const Ur = [
3709
3713
  Ue(i, s, u, e, `${r}.${s}`);
3710
3714
  }
3711
3715
  }
3712
- }, uc = (t, e, n, r, s = 0) => {
3716
+ }, lc = (t, e, n, r, s = 0) => {
3713
3717
  for (const o of Object.keys(t))
3714
3718
  if (!Ur.includes(o))
3715
3719
  throw new x(`Invalid query parameter '${o}' in $ object. Valid parameters are: ${Ur.join(", ")}. Found: ${o}`, r);
@@ -3727,9 +3731,9 @@ const Ur = [
3727
3731
  if (t.where && n) {
3728
3732
  if (typeof t.where != "object" || t.where === null)
3729
3733
  throw new x(`'where' clause must be an object in entity '${e}', but received: ${typeof t.where}`, r ? `${r}.where` : void 0);
3730
- Us(t.where, e, n, r ? `${r}.where` : "where");
3734
+ Ls(t.where, e, n, r ? `${r}.where` : "where");
3731
3735
  }
3732
- }, Ls = (t, e, n, r, s = 0) => {
3736
+ }, Fs = (t, e, n, r, s = 0) => {
3733
3737
  var i;
3734
3738
  if (!t || typeof t != "object")
3735
3739
  throw new x(`Query part for entity '${e}' must be an object, but received: ${typeof t}`, r);
@@ -3742,13 +3746,13 @@ const Ur = [
3742
3746
  const a = t[o];
3743
3747
  if (typeof a == "object" && a !== null) {
3744
3748
  const c = (i = n == null ? void 0 : n.entities[e].links[o]) == null ? void 0 : i.entityName;
3745
- c && Ls(a, c, n, `${r}.${o}`, s + 1);
3749
+ c && Fs(a, c, n, `${r}.${o}`, s + 1);
3746
3750
  }
3747
3751
  } else {
3748
3752
  const a = t[o];
3749
3753
  if (typeof a != "object" || a === null)
3750
3754
  throw new x(`Query parameter '$' must be an object in entity '${e}', but received: ${typeof a}`, `${r}.$`);
3751
- uc(a, e, n, `${r}.$`, s);
3755
+ lc(a, e, n, `${r}.$`, s);
3752
3756
  }
3753
3757
  }, Lr = (t, e) => {
3754
3758
  if (typeof t != "object" || t === null)
@@ -3766,7 +3770,7 @@ const Ur = [
3766
3770
  const s = Object.keys(e.entities);
3767
3771
  throw new x(`Entity '${r}' does not exist in schema. Available entities: ${s.length > 0 ? s.join(", ") : "none"}`, r);
3768
3772
  }
3769
- Ls(n[r], r, e, r, 0);
3773
+ Fs(n[r], r, e, r, 0);
3770
3774
  }
3771
3775
  }
3772
3776
  }, Fr = (t) => typeof t != "string" ? !1 : Mt(t) ? !0 : Fe(t);
@@ -3775,39 +3779,39 @@ class se extends Error {
3775
3779
  super(e), this.name = "TransactionValidationError";
3776
3780
  }
3777
3781
  }
3778
- const Fs = (t) => t.length > 0 ? t.join(", ") : "none", lc = (t, e) => new se(`Entity '${t}' does not exist in schema. Available entities: ${Fs(e)}`), Jt = {
3782
+ const Ns = (t) => t.length > 0 ? t.join(", ") : "none", fc = (t, e) => new se(`Entity '${t}' does not exist in schema. Available entities: ${Ns(e)}`), Jt = {
3779
3783
  string: (t) => typeof t == "string",
3780
3784
  number: (t) => typeof t == "number" && !isNaN(t),
3781
3785
  boolean: (t) => typeof t == "boolean",
3782
3786
  date: (t) => t instanceof Date || typeof t == "string" || typeof t == "number",
3783
3787
  json: () => !0
3784
- }, fc = (t, e) => {
3788
+ }, dc = (t, e) => {
3785
3789
  var n;
3786
3790
  return t == null ? !0 : ((n = Jt[e.valueType]) == null ? void 0 : n.call(Jt, t)) ?? !1;
3787
- }, Ns = (t, e) => {
3791
+ }, Ks = (t, e) => {
3788
3792
  const n = e.entities[t];
3789
3793
  if (!n)
3790
- throw lc(t, Object.keys(e.entities));
3794
+ throw fc(t, Object.keys(e.entities));
3791
3795
  return n;
3792
3796
  }, Yt = (t, e, n) => {
3793
- const r = Ns(t, n);
3797
+ const r = Ks(t, n);
3794
3798
  if (typeof e != "object" || e === null)
3795
3799
  throw new se(`Arguments for data operation on entity '${t}' must be an object, but received: ${typeof e}`);
3796
3800
  for (const [s, i] of Object.entries(e)) {
3797
3801
  if (s === "id")
3798
3802
  continue;
3799
3803
  const o = r.attrs[s];
3800
- if (o && !fc(i, o))
3804
+ if (o && !dc(i, o))
3801
3805
  throw new se(`Invalid value for attribute '${s}' in entity '${t}'. Expected ${o.valueType}, but received: ${typeof i}`);
3802
3806
  }
3803
3807
  }, Nr = (t, e, n) => {
3804
- const r = Ns(t, n);
3808
+ const r = Ks(t, n);
3805
3809
  if (typeof e != "object" || e === null)
3806
3810
  throw new se(`Arguments for link operation on entity '${t}' must be an object, but received: ${typeof e}`);
3807
3811
  for (const [s, i] of Object.entries(e)) {
3808
3812
  if (!r.links[s]) {
3809
3813
  const a = Object.keys(r.links);
3810
- throw new se(`Link '${s}' does not exist on entity '${t}'. Available links: ${Fs(a)}`);
3814
+ throw new se(`Link '${s}' does not exist on entity '${t}'. Available links: ${Ns(a)}`);
3811
3815
  }
3812
3816
  if (i != null) {
3813
3817
  if (Array.isArray(i)) {
@@ -3818,7 +3822,7 @@ const Fs = (t) => t.length > 0 ? t.join(", ") : "none", lc = (t, e) => new se(`E
3818
3822
  throw new se(`Invalid UUID in link '${s}' for entity '${t}'. Expected a UUID, but received: ${i}`);
3819
3823
  }
3820
3824
  }
3821
- }, dc = {
3825
+ }, hc = {
3822
3826
  create: Yt,
3823
3827
  update: Yt,
3824
3828
  merge: Yt,
@@ -3826,7 +3830,7 @@ const Fs = (t) => t.length > 0 ? t.join(", ") : "none", lc = (t, e) => new se(`E
3826
3830
  unlink: Nr,
3827
3831
  delete: () => {
3828
3832
  }
3829
- }, hc = (t, e) => {
3833
+ }, pc = (t, e) => {
3830
3834
  if (!e)
3831
3835
  return;
3832
3836
  const [n, r, s, i] = t;
@@ -3834,9 +3838,9 @@ const Fs = (t) => t.length > 0 ? t.join(", ") : "none", lc = (t, e) => new se(`E
3834
3838
  throw new se(`Invalid id for entity '${r}'. Expected a UUID, but received: ${s}`);
3835
3839
  if (typeof r != "string")
3836
3840
  throw new se(`Entity name must be a string, but received: ${typeof r}`);
3837
- const o = dc[n];
3841
+ const o = hc[n];
3838
3842
  o && i !== void 0 && o(r, i, e);
3839
- }, pc = (t, e) => {
3843
+ }, yc = (t, e) => {
3840
3844
  const n = Array.isArray(t) ? t : [t];
3841
3845
  for (const r of n) {
3842
3846
  if (!r || typeof r != "object")
@@ -3846,11 +3850,11 @@ const Fs = (t) => t.length > 0 ? t.join(", ") : "none", lc = (t, e) => new se(`E
3846
3850
  for (const s of r.__ops) {
3847
3851
  if (!Array.isArray(s))
3848
3852
  throw new se(`Transaction operation must be an array, but received: ${typeof s}`);
3849
- hc(s, e);
3853
+ pc(s, e);
3850
3854
  }
3851
3855
  }
3852
3856
  };
3853
- let Ks = 0;
3857
+ let qs = 0;
3854
3858
  class Kr {
3855
3859
  constructor(e) {
3856
3860
  p(this, "type", "ws");
@@ -3860,7 +3864,7 @@ class Kr {
3860
3864
  p(this, "onmessage");
3861
3865
  p(this, "onclose");
3862
3866
  p(this, "onerror");
3863
- this.id = `${this.type}_${Ks++}`, this.conn = new WebSocket(e), this.conn.onopen = (n) => {
3867
+ this.id = `${this.type}_${qs++}`, this.conn = new WebSocket(e), this.conn.onopen = (n) => {
3864
3868
  this.onopen && this.onopen({ target: this });
3865
3869
  }, this.conn.onmessage = (n) => {
3866
3870
  this.onmessage && this.onmessage({
@@ -3886,7 +3890,7 @@ class Kr {
3886
3890
  return this.conn.send(JSON.stringify(e));
3887
3891
  }
3888
3892
  }
3889
- class yc {
3893
+ class bc {
3890
3894
  constructor(e, n) {
3891
3895
  p(this, "type", "sse");
3892
3896
  p(this, "initParams", null);
@@ -3902,7 +3906,7 @@ class yc {
3902
3906
  p(this, "onmessage");
3903
3907
  p(this, "onclose");
3904
3908
  p(this, "onerror");
3905
- this.id = `${this.type}_${Ks++}`, this.url = n, this.ES = e, this.conn = new e(n), this.sseInitTimeout = setTimeout(() => {
3909
+ this.id = `${this.type}_${qs++}`, this.url = n, this.ES = e, this.conn = new e(n), this.sseInitTimeout = setTimeout(() => {
3906
3910
  this.initParams || this.handleError();
3907
3911
  }, 1e4), this.conn.onmessage = (r) => {
3908
3912
  const s = JSON.parse(r.data);
@@ -3982,7 +3986,7 @@ class yc {
3982
3986
  this.handleClose();
3983
3987
  }
3984
3988
  }
3985
- function bc(t, e) {
3989
+ function gc(t, e) {
3986
3990
  const n = t.values;
3987
3991
  if (n) {
3988
3992
  const r = bs(n.attrsStore, null);
@@ -3994,7 +3998,7 @@ function bc(t, e) {
3994
3998
  }
3995
3999
  return t;
3996
4000
  }
3997
- function gc(t, e) {
4001
+ function _c(t, e) {
3998
4002
  var n;
3999
4003
  if (e.values) {
4000
4004
  const r = [];
@@ -4009,13 +4013,13 @@ function gc(t, e) {
4009
4013
  } else
4010
4014
  return e;
4011
4015
  }
4012
- function _c(t, e, n) {
4016
+ function wc(t, e, n) {
4013
4017
  var i, o;
4014
4018
  const r = (i = e == null ? void 0 : e.state) == null ? void 0 : i.txId, s = (o = n == null ? void 0 : n.state) == null ? void 0 : o.txId;
4015
4019
  return r && (!s || r > s) ? e : s && (!r || s > r) ? n : e || n;
4016
4020
  }
4017
4021
  function Zt(t, e, n) {
4018
- return Cs({ store: e, attrsStore: n, pageInfo: null, aggregate: null }, t.query).data[t.table][0];
4022
+ return Ps({ store: e, attrsStore: n, pageInfo: null, aggregate: null }, t.query).data[t.table][0];
4019
4023
  }
4020
4024
  function qr(t, e, n, r) {
4021
4025
  var o;
@@ -4036,7 +4040,7 @@ function Wr(t, e, n) {
4036
4040
  break;
4037
4041
  }
4038
4042
  }
4039
- function wc(t, e, n) {
4043
+ function Tc(t, e, n) {
4040
4044
  var s, i;
4041
4045
  const r = {};
4042
4046
  for (const { action: o, triple: a } of n) {
@@ -4064,14 +4068,14 @@ function wc(t, e, n) {
4064
4068
  function gt(t, e) {
4065
4069
  return { [t.table]: e.map((n) => n.entity) };
4066
4070
  }
4067
- function Tc(t, e) {
4071
+ function mc(t, e) {
4068
4072
  var r;
4069
4073
  if (t.orderFieldType)
4070
4074
  return t.orderFieldType;
4071
4075
  const n = t.orderField === "serverCreatedAt" ? "number" : (r = F(e(), t.table, t.orderField)) == null ? void 0 : r["checked-data-type"];
4072
4076
  return t.orderFieldType = n, n;
4073
4077
  }
4074
- function mc(t, e, n) {
4078
+ function Sc(t, e, n) {
4075
4079
  const r = e;
4076
4080
  if (t.orderField === "serverCreatedAt") {
4077
4081
  n.sort(t.orderDirection === "asc" ? function(o, a) {
@@ -4092,7 +4096,7 @@ var me;
4092
4096
  (function(t) {
4093
4097
  t.InitialSyncBatch = "InitialSyncBatch", t.InitialSyncComplete = "InitialSyncComplete", t.LoadFromStorage = "LoadFromStorage", t.SyncTransaction = "SyncTransaction", t.Error = "Error";
4094
4098
  })(me || (me = {}));
4095
- class Sc {
4099
+ class vc {
4096
4100
  constructor(e, n, r, s, i, o) {
4097
4101
  p(this, "trySend");
4098
4102
  p(this, "subs");
@@ -4105,9 +4109,9 @@ class Sc {
4105
4109
  p(this, "getAttrs");
4106
4110
  this.trySend = e, this.config = r, this.log = s, this.createStore = i, this.getAttrs = o, this.subs = new wn({
4107
4111
  persister: n,
4108
- merge: _c,
4109
- serialize: gc,
4110
- parse: (a, c) => bc(c, this.config.useDateObjects),
4112
+ merge: wc,
4113
+ serialize: _c,
4114
+ parse: (a, c) => gc(c, this.config.useDateObjects),
4111
4115
  objectSize: (a) => {
4112
4116
  var c;
4113
4117
  return ((c = a.values) == null ? void 0 : c.entities.length) || 0;
@@ -4302,9 +4306,9 @@ class Sc {
4302
4306
  e: for (const [w, S] of Object.entries(u))
4303
4307
  for (let _ = 0; _ < f.length; _++) {
4304
4308
  const m = f[_];
4305
- if (eo(m.store, w)) {
4309
+ if (to(m.store, w)) {
4306
4310
  Wr(m.store, l.attrsStore, S);
4307
- const A = Zt(s, m.store, l.attrsStore), E = wc(m.store, l.attrsStore, S)[w];
4311
+ const A = Zt(s, m.store, l.attrsStore), E = Tc(m.store, l.attrsStore, S)[w];
4308
4312
  A ? (h.push({
4309
4313
  oldEntity: m.entity,
4310
4314
  newEntity: A,
@@ -4335,8 +4339,8 @@ class Sc {
4335
4339
  const b = [];
4336
4340
  for (const w of c.sort().reverse())
4337
4341
  b.push(f[w].entity), f.splice(w, 1);
4338
- const g = Tc(s, this.getAttrs);
4339
- mc(s, g, f), this.notifyCbs(r, {
4342
+ const g = mc(s, this.getAttrs);
4343
+ Sc(s, g, f), this.notifyCbs(r, {
4340
4344
  type: me.SyncTransaction,
4341
4345
  data: gt(s, (o = s.values) == null ? void 0 : o.entities),
4342
4346
  added: y,
@@ -4383,23 +4387,23 @@ const de = {
4383
4387
  AUTHENTICATED: "authenticated",
4384
4388
  CLOSED: "closed",
4385
4389
  ERRORED: "errored"
4386
- }, vc = 3e4, Ec = 3e4, Oc = 200, Ac = 1e3 * 60, kc = {
4390
+ }, Ec = 3e4, Oc = 3e4, Ac = 200, kc = 1e3 * 60, Cc = {
4387
4391
  apiURI: "https://api.instantdb.com",
4388
4392
  websocketURI: "wss://api.instantdb.com/runtime/session"
4389
4393
  }, Xt = "_instant_oauth_redirect", Ve = "currentUser";
4390
- function Cc({ transportType: t, appId: e, apiURI: n, wsURI: r, EventSourceImpl: s }) {
4394
+ function Pc({ transportType: t, appId: e, apiURI: n, wsURI: r, EventSourceImpl: s }) {
4391
4395
  if (!s)
4392
4396
  return new Kr(`${r}?app_id=${e}`);
4393
4397
  switch (t) {
4394
4398
  case "ws":
4395
4399
  return new Kr(`${r}?app_id=${e}`);
4396
4400
  case "sse":
4397
- return new yc(s, `${n}/runtime/sse?app_id=${e}`);
4401
+ return new bc(s, `${n}/runtime/sse?app_id=${e}`);
4398
4402
  default:
4399
4403
  throw new Error("Unknown transport type " + t);
4400
4404
  }
4401
4405
  }
4402
- function Pc() {
4406
+ function Ic() {
4403
4407
  return typeof window < "u" || typeof chrome < "u";
4404
4408
  }
4405
4409
  const zr = {
@@ -4408,7 +4412,7 @@ const zr = {
4408
4412
  "refresh-presence": !0,
4409
4413
  "patch-presence": !0
4410
4414
  };
4411
- function Ic(t, e) {
4415
+ function Mc(t, e) {
4412
4416
  var r;
4413
4417
  const n = typeof t == "string" ? JSON.parse(t) : t;
4414
4418
  if ((r = n == null ? void 0 : n.result) != null && r.store) {
@@ -4423,7 +4427,7 @@ function Ic(t, e) {
4423
4427
  }
4424
4428
  return n;
4425
4429
  }
4426
- function Mc(t, e) {
4430
+ function jc(t, e) {
4427
4431
  const { result: n, ...r } = e, s = (
4428
4432
  /** @type {import('./reactorTypes.ts').QuerySubInStorage} */
4429
4433
  r
@@ -4438,7 +4442,7 @@ function Mc(t, e) {
4438
4442
  }
4439
4443
  return s;
4440
4444
  }
4441
- function jc(t, e) {
4445
+ function Rc(t, e) {
4442
4446
  switch (t) {
4443
4447
  case "pendingMutations":
4444
4448
  return new Map(typeof e == "string" ? JSON.parse(e) : e);
@@ -4446,7 +4450,7 @@ function jc(t, e) {
4446
4450
  return e;
4447
4451
  }
4448
4452
  }
4449
- function Rc(t, e) {
4453
+ function xc(t, e) {
4450
4454
  switch (t) {
4451
4455
  case "pendingMutations":
4452
4456
  return [...e.entries()];
@@ -4454,7 +4458,7 @@ function Rc(t, e) {
4454
4458
  return e;
4455
4459
  }
4456
4460
  }
4457
- function xc(t, e, n) {
4461
+ function $c(t, e, n) {
4458
4462
  const r = e == null ? void 0 : e.result, s = n == null ? void 0 : n.result;
4459
4463
  return r && !s && n && (n.result = r), n || e;
4460
4464
  }
@@ -4464,8 +4468,8 @@ function en(t) {
4464
4468
  return a == c ? r < i ? -1 : r > i ? 1 : 0 : a - c;
4465
4469
  });
4466
4470
  }
4467
- class $c {
4468
- constructor(e, n = Ms, r = js, s, i) {
4471
+ class Dc {
4472
+ constructor(e, n = js, r = Rs, s, i) {
4469
4473
  /** @type {s.AttrsStore | undefined} */
4470
4474
  p(this, "attrs");
4471
4475
  p(this, "_isOnline", !0);
@@ -4559,9 +4563,9 @@ class $c {
4559
4563
  });
4560
4564
  /** Applies transactions locally and sends transact message to server */
4561
4565
  p(this, "pushTx", (e) => {
4562
- this.config.disableValidation || pc(e, this.config.schema);
4566
+ this.config.disableValidation || yc(e, this.config.schema);
4563
4567
  try {
4564
- const n = La({
4568
+ const n = Fa({
4565
4569
  attrsStore: this.optimisticAttrs(),
4566
4570
  schema: this.config.schema,
4567
4571
  stores: Object.values(this.querySubs.currentValue).map((r) => {
@@ -4662,7 +4666,7 @@ class $c {
4662
4666
  }
4663
4667
  this._log.info("[socket][close]", n.id, "schedule reconnect, ms =", this._reconnectTimeoutMs), this._scheduleReconnect();
4664
4668
  });
4665
- if (this._EventSource = i, this.config = { ...kc, ...e }, this.queryCacheLimit = this.config.queryCacheLimit ?? 10, this._pendingTxCleanupTimeout = this.config.pendingTxCleanupTimeout ?? Ec, this._pendingMutationCleanupThreshold = this.config.pendingMutationCleanupThreshold ?? Oc, this._log = ic(e.verbose || Wn || Rs, () => this._reactorStats()), this.versions = { ...s || {}, "@instantdb/core": zn }, this.config.schema && (this._linkIndex = Dr(this.config.schema)), !!Pc()) {
4669
+ if (this._EventSource = i, this.config = { ...Cc, ...e }, this.queryCacheLimit = this.config.queryCacheLimit ?? 10, this._pendingTxCleanupTimeout = this.config.pendingTxCleanupTimeout ?? Oc, this._pendingMutationCleanupThreshold = this.config.pendingMutationCleanupThreshold ?? Ac, this._log = oc(e.verbose || Wn || xs, () => this._reactorStats()), this.versions = { ...s || {}, "@instantdb/core": zn }, this.config.schema && (this._linkIndex = Dr(this.config.schema)), !!Ic()) {
4666
4670
  if (!e.appId)
4667
4671
  throw new Error("Instant must be initialized with an appId.");
4668
4672
  if (!Fe(e.appId))
@@ -4679,14 +4683,14 @@ class $c {
4679
4683
  } catch (c) {
4680
4684
  this._log.error("[error] handle broadcast channel", c);
4681
4685
  }
4682
- })), this._initStorage(n), this._syncTable = new Sc(this._trySendAuthed.bind(this), new n(this.config.appId, "syncSubs"), {
4686
+ })), this._initStorage(n), this._syncTable = new vc(this._trySendAuthed.bind(this), new n(this.config.appId, "syncSubs"), {
4683
4687
  useDateObjects: this.config.useDateObjects
4684
4688
  }, this._log, (o) => Je(this.ensureAttrs(), o, this.config.enableCardinalityInference, this.config.useDateObjects), () => this.ensureAttrs()), this._oauthCallbackResponse = this._oauthLoginInit(), this.getCurrentUser().then((o) => {
4685
4689
  this.syncUserToEndpoint(o.user);
4686
4690
  }), setInterval(async () => {
4687
4691
  const o = await this.getCurrentUser();
4688
4692
  this.syncUserToEndpoint(o.user);
4689
- }, Ac), r.getIsOnline().then((o) => {
4693
+ }, kc), r.getIsOnline().then((o) => {
4690
4694
  this._isOnline = o, this._startSocket(), r.listen((a) => {
4691
4695
  a !== this._isOnline && (this._log.info("[network] online =", a), this._isOnline = a, this._isOnline ? this._startSocket() : (this._log.info("Changing status from", this.status, "to", de.CLOSED), this._setStatus(de.CLOSED)));
4692
4696
  });
@@ -4718,9 +4722,9 @@ class $c {
4718
4722
  _initStorage(e) {
4719
4723
  this.querySubs = new wn({
4720
4724
  persister: new e(this.config.appId, "querySubs"),
4721
- merge: xc,
4722
- serialize: Mc,
4723
- parse: (n, r) => Ic(r, this.config.useDateObjects),
4725
+ merge: $c,
4726
+ serialize: jc,
4727
+ parse: (n, r) => Mc(r, this.config.useDateObjects),
4724
4728
  // objectSize
4725
4729
  objectSize: (n) => {
4726
4730
  var r, s, i;
@@ -4739,8 +4743,8 @@ class $c {
4739
4743
  }), this.querySubs.onKeyLoaded = (n) => this._onQuerySubLoaded(n), this.kv = new wn({
4740
4744
  persister: new e(this.config.appId, "kv"),
4741
4745
  merge: this._onMergeKv,
4742
- serialize: Rc,
4743
- parse: jc,
4746
+ serialize: xc,
4747
+ parse: Rc,
4744
4748
  objectSize: () => 0,
4745
4749
  logger: this._log,
4746
4750
  saveThrottleMs: 100,
@@ -5077,7 +5081,7 @@ class $c {
5077
5081
  if (!this.querySubs)
5078
5082
  return r.reject(new Error("We can't run `queryOnce` on the backend. Use adminAPI.query instead: https://www.instantdb.com/docs/backend#query")), r.promise;
5079
5083
  const s = q(e), i = this._startQuerySub(e, s);
5080
- return this.queryOnceDfds[s] = this.queryOnceDfds[s] ?? [], this.queryOnceDfds[s].push({ q: e, dfd: r, eventId: i }), setTimeout(() => r.reject(new Error("Query timed out")), vc), r.promise;
5084
+ return this.queryOnceDfds[s] = this.queryOnceDfds[s] ?? [], this.queryOnceDfds[s].push({ q: e, dfd: r, eventId: i }), setTimeout(() => r.reject(new Error("Query timed out")), Ec), r.promise;
5081
5085
  }
5082
5086
  _completeQueryOnce(e, n, r) {
5083
5087
  this.queryOnceDfds[n] && (this.queryOnceDfds[n] = this.queryOnceDfds[n].filter((s) => s.dfd !== r), this._cleanupQuery(e, n));
@@ -5144,7 +5148,7 @@ class $c {
5144
5148
  a = !0;
5145
5149
  continue;
5146
5150
  }
5147
- const g = a ? ha(o, y) : y;
5151
+ const g = a ? pa(o, y) : y;
5148
5152
  h.push(g);
5149
5153
  }
5150
5154
  return a ? h : l;
@@ -5202,12 +5206,12 @@ class $c {
5202
5206
  const _ = this._applyOptimisticUpdates(f, h, w, g);
5203
5207
  f = _.store, h = _.attrsStore;
5204
5208
  }
5205
- return { data: Cs({ store: f, attrsStore: h, pageInfo: y, aggregate: b }, c), querySubVersion: s, pendingMutationsVersion: o };
5209
+ return { data: Ps({ store: f, attrsStore: h, pageInfo: y, aggregate: b }, c), querySubVersion: s, pendingMutationsVersion: o };
5206
5210
  }
5207
5211
  _applyOptimisticUpdates(e, n, r, s) {
5208
5212
  for (const [i, o] of r)
5209
5213
  if (!o["tx-id"] || s && o["tx-id"] > s) {
5210
- const a = ho(e, n, o["tx-steps"]);
5214
+ const a = po(e, n, o["tx-steps"]);
5211
5215
  e = a.store, n = a.attrsStore;
5212
5216
  }
5213
5217
  return { store: e, attrsStore: n };
@@ -5322,7 +5326,7 @@ class $c {
5322
5326
  return;
5323
5327
  }
5324
5328
  const e = this._transport;
5325
- this._transport = Cc({
5329
+ this._transport = Pc({
5326
5330
  transportType: this._transportType,
5327
5331
  appId: this.config.appId,
5328
5332
  apiURI: this.config.apiURI,
@@ -5533,7 +5537,7 @@ class $c {
5533
5537
  }), this._reconnectTimeoutMs = 0, this._transport.close(), this._oauthCallbackResponse = null, this.notifyAuthSubs(n);
5534
5538
  }
5535
5539
  sendMagicCode({ email: e }) {
5536
- return Ba({
5540
+ return Ga({
5537
5541
  apiURI: this.config.apiURI,
5538
5542
  appId: this.config.appId,
5539
5543
  email: e
@@ -5541,7 +5545,7 @@ class $c {
5541
5545
  }
5542
5546
  async signInWithMagicCode({ email: e, code: n }) {
5543
5547
  var o;
5544
- const r = await this.getCurrentUser(), s = ((o = r == null ? void 0 : r.user) == null ? void 0 : o.type) === "guest", i = await Ga({
5548
+ const r = await this.getCurrentUser(), s = ((o = r == null ? void 0 : r.user) == null ? void 0 : o.type) === "guest", i = await Qa({
5545
5549
  apiURI: this.config.apiURI,
5546
5550
  appId: this.config.appId,
5547
5551
  email: e,
@@ -5551,7 +5555,7 @@ class $c {
5551
5555
  return await this.changeCurrentUser(i.user), i;
5552
5556
  }
5553
5557
  async signInWithCustomToken(e) {
5554
- const n = await Qa({
5558
+ const n = await Ha({
5555
5559
  apiURI: this.config.apiURI,
5556
5560
  appId: this.config.appId,
5557
5561
  refreshToken: e
@@ -5559,7 +5563,7 @@ class $c {
5559
5563
  return await this.changeCurrentUser(n.user), n;
5560
5564
  }
5561
5565
  async signInAsGuest() {
5562
- const e = await Ha({
5566
+ const e = await Ja({
5563
5567
  apiURI: this.config.apiURI,
5564
5568
  appId: this.config.appId
5565
5569
  });
@@ -5574,7 +5578,7 @@ class $c {
5574
5578
  this._log.info("[auth-invalidate] skipped invalidateToken");
5575
5579
  return;
5576
5580
  }
5577
- Ya({
5581
+ Za({
5578
5582
  apiURI: this.config.apiURI,
5579
5583
  appId: this.config.appId,
5580
5584
  refreshToken: r
@@ -5627,7 +5631,7 @@ class $c {
5627
5631
  */
5628
5632
  async signInWithIdToken({ idToken: e, clientName: n, nonce: r }) {
5629
5633
  var a;
5630
- const s = await this.getCurrentUser(), i = (a = s == null ? void 0 : s.user) == null ? void 0 : a.refresh_token, o = await Ja({
5634
+ const s = await this.getCurrentUser(), i = (a = s == null ? void 0 : s.user) == null ? void 0 : a.refresh_token, o = await Ya({
5631
5635
  apiURI: this.config.apiURI,
5632
5636
  appId: this.config.appId,
5633
5637
  idToken: e,
@@ -5670,7 +5674,7 @@ class $c {
5670
5674
  getPresence(e, n, r = {}) {
5671
5675
  const s = this._rooms[n], i = this._presence[n];
5672
5676
  return !s || !i || !i.result ? null : {
5673
- ...rc(i.result, r, this._sessionId),
5677
+ ...sc(i.result, r, this._sessionId),
5674
5678
  isLoading: !s.isConnected,
5675
5679
  error: s.error
5676
5680
  };
@@ -5732,7 +5736,7 @@ class $c {
5732
5736
  }
5733
5737
  _notifyPresenceSub(e, n) {
5734
5738
  const r = this.getPresence("", e, n);
5735
- r && (n.prev && !sc(r, n.prev) || (n.prev = r, n.cb(r)));
5739
+ r && (n.prev && !ic(r, n.prev) || (n.prev = r, n.cb(r)));
5736
5740
  }
5737
5741
  _patchPresencePeers(e, n) {
5738
5742
  var o, a, c;
@@ -5743,7 +5747,7 @@ class $c {
5743
5747
  for (let [l, f, h] of n)
5744
5748
  switch (f) {
5745
5749
  case "+":
5746
- xi(u, l, h);
5750
+ $i(u, l, h);
5747
5751
  break;
5748
5752
  case "r":
5749
5753
  wr(u, l, h);
@@ -5804,7 +5808,7 @@ class $c {
5804
5808
  async uploadFile(e, n, r) {
5805
5809
  var o;
5806
5810
  const s = await this.getCurrentUser(), i = (o = s == null ? void 0 : s.user) == null ? void 0 : o.refresh_token;
5807
- return Za({
5811
+ return Xa({
5808
5812
  ...r,
5809
5813
  apiURI: this.config.apiURI,
5810
5814
  appId: this.config.appId,
@@ -5816,7 +5820,7 @@ class $c {
5816
5820
  async deleteFile(e) {
5817
5821
  var i;
5818
5822
  const n = await this.getCurrentUser(), r = (i = n == null ? void 0 : n.user) == null ? void 0 : i.refresh_token;
5819
- return await Xa({
5823
+ return await ec({
5820
5824
  apiURI: this.config.apiURI,
5821
5825
  appId: this.config.appId,
5822
5826
  path: e,
@@ -5827,18 +5831,18 @@ class $c {
5827
5831
  // ---------------------------------
5828
5832
  async upload(e, n) {
5829
5833
  var c;
5830
- const r = await this.getCurrentUser(), s = (c = r == null ? void 0 : r.user) == null ? void 0 : c.refresh_token, i = e || n.name, o = await ec({
5834
+ const r = await this.getCurrentUser(), s = (c = r == null ? void 0 : r.user) == null ? void 0 : c.refresh_token, i = e || n.name, o = await tc({
5831
5835
  apiURI: this.config.apiURI,
5832
5836
  appId: this.config.appId,
5833
5837
  fileName: i,
5834
5838
  refreshToken: s
5835
5839
  });
5836
- return await tc(o, n);
5840
+ return await nc(o, n);
5837
5841
  }
5838
5842
  async getDownloadUrl(e) {
5839
5843
  var i;
5840
5844
  const n = await this.getCurrentUser(), r = (i = n == null ? void 0 : n.user) == null ? void 0 : i.refresh_token;
5841
- return await nc({
5845
+ return await rc({
5842
5846
  apiURI: this.config.apiURI,
5843
5847
  appId: this.config.appId,
5844
5848
  path: e,
@@ -5846,9 +5850,9 @@ class $c {
5846
5850
  });
5847
5851
  }
5848
5852
  }
5849
- function Dc(t, e) {
5853
+ function Uc(t, e) {
5850
5854
  return new Ut(
5851
- qs(t, e),
5855
+ Ws(t, e),
5852
5856
  // (XXX): LinksDef<any> stems from TypeScript’s inability to reconcile the
5853
5857
  // type EntitiesWithLinks<EntitiesWithoutLinks, Links> with
5854
5858
  // EntitiesWithoutLinks. TypeScript is strict about ensuring that types are
@@ -5858,28 +5862,28 @@ function Dc(t, e) {
5858
5862
  void 0
5859
5863
  );
5860
5864
  }
5861
- function Uc(t) {
5865
+ function Lc(t) {
5862
5866
  return new Dt(t, {});
5863
5867
  }
5864
- function Lc() {
5868
+ function Fc() {
5865
5869
  return new H("string", !0, !1);
5866
5870
  }
5867
- function Fc() {
5871
+ function Nc() {
5868
5872
  return new H("number", !0, !1);
5869
5873
  }
5870
- function Nc() {
5874
+ function Kc() {
5871
5875
  return new H("boolean", !0, !1);
5872
5876
  }
5873
- function Kc() {
5877
+ function qc() {
5874
5878
  return new H("date", !0, !1);
5875
5879
  }
5876
- function qc() {
5880
+ function Wc() {
5877
5881
  return new H("json", !0, !1);
5878
5882
  }
5879
- function Wc() {
5883
+ function zc() {
5880
5884
  return new H("json", !0, !1);
5881
5885
  }
5882
- function qs(t, e) {
5886
+ function Ws(t, e) {
5883
5887
  var s, i, o, a;
5884
5888
  const n = { fwd: {}, rev: {} };
5885
5889
  for (const c of Object.values(e))
@@ -5898,10 +5902,10 @@ function qs(t, e) {
5898
5902
  })
5899
5903
  ]));
5900
5904
  }
5901
- function zc({ entities: t, links: e, rooms: n }) {
5905
+ function Vc({ entities: t, links: e, rooms: n }) {
5902
5906
  const r = e ?? {}, s = n ?? {};
5903
5907
  return new Ut(
5904
- qs(t, r),
5908
+ Ws(t, r),
5905
5909
  // (XXX): LinksDef<any> stems from TypeScript's inability to reconcile the
5906
5910
  // type EntitiesWithLinks<EntitiesWithoutLinks, Links> with
5907
5911
  // EntitiesWithoutLinks. TypeScript is strict about ensuring that types are
@@ -5911,23 +5915,23 @@ function zc({ entities: t, links: e, rooms: n }) {
5911
5915
  s
5912
5916
  );
5913
5917
  }
5914
- const xu = {
5918
+ const Du = {
5915
5919
  // constructs
5916
- graph: Dc,
5917
- schema: zc,
5918
- entity: Uc,
5920
+ graph: Uc,
5921
+ schema: Vc,
5922
+ entity: Lc,
5919
5923
  // value types
5920
- string: Lc,
5921
- number: Fc,
5922
- boolean: Nc,
5923
- date: Kc,
5924
- json: qc,
5925
- any: Wc
5924
+ string: Fc,
5925
+ number: Nc,
5926
+ boolean: Kc,
5927
+ date: qc,
5928
+ json: Wc,
5929
+ any: zc
5926
5930
  };
5927
5931
  let _t;
5928
- function Vc(t, e) {
5932
+ function Bc(t, e) {
5929
5933
  _t == null || _t.dispose();
5930
- const n = Yc(e), r = Qc(e, a), s = Gc(Bc(t));
5934
+ const n = Zc(e), r = Hc(e, a), s = Qc(Gc(t));
5931
5935
  function i(l) {
5932
5936
  var f;
5933
5937
  l.source === s.element.contentWindow && ((f = l.data) == null ? void 0 : f.type) === "close" && n.isVisible() && a();
@@ -5949,10 +5953,10 @@ function Vc(t, e) {
5949
5953
  }
5950
5954
  return u();
5951
5955
  }
5952
- function Bc(t) {
5953
- return `${Wn || xs ? "http://localhost:3000" : "https://instantdb.com"}/_devtool?appId=${t}`;
5954
- }
5955
5956
  function Gc(t) {
5957
+ return `${Wn || $s ? "http://localhost:3000" : "https://instantdb.com"}/_devtool?appId=${t}`;
5958
+ }
5959
+ function Qc(t) {
5956
5960
  const e = document.createElement("iframe");
5957
5961
  return e.src = t, e.className = "instant-devtool-iframe", Object.assign(e.style, {
5958
5962
  width: "100%",
@@ -5961,7 +5965,7 @@ function Gc(t) {
5961
5965
  border: "none"
5962
5966
  }), { element: e };
5963
5967
  }
5964
- function Qc(t, e) {
5968
+ function Hc(t, e) {
5965
5969
  const n = `
5966
5970
  <svg width="32" height="32" viewBox="0 0 512 512" fill="none" xmlns="http://www.w3.org/2000/svg">
5967
5971
  <rect width="512" height="512" fill="black"/>
@@ -5971,7 +5975,7 @@ function Qc(t, e) {
5971
5975
  return r.innerHTML = n, r.className = "instant-devtool-toggler", Object.assign(r.style, {
5972
5976
  // pos
5973
5977
  position: "fixed",
5974
- ...Hc(t.position),
5978
+ ...Jc(t.position),
5975
5979
  height: "32px",
5976
5980
  width: "32px",
5977
5981
  // layout
@@ -5986,7 +5990,7 @@ function Qc(t, e) {
5986
5990
  cursor: "pointer"
5987
5991
  }), r.addEventListener("click", e), { element: r };
5988
5992
  }
5989
- function Hc(t) {
5993
+ function Jc(t) {
5990
5994
  switch (t) {
5991
5995
  case "bottom-left":
5992
5996
  return { bottom: "24px", left: "24px" };
@@ -5998,7 +6002,7 @@ function Hc(t) {
5998
6002
  return { top: "24px", left: "24px" };
5999
6003
  }
6000
6004
  }
6001
- function Jc(t) {
6005
+ function Yc(t) {
6002
6006
  switch (t) {
6003
6007
  case "bottom-left":
6004
6008
  return { bottom: "24px", right: "24px", left: "60px", top: "72px" };
@@ -6010,11 +6014,11 @@ function Jc(t) {
6010
6014
  return { top: "24px", right: "24px", left: "60px", bottom: "72px" };
6011
6015
  }
6012
6016
  }
6013
- function Yc(t) {
6017
+ function Zc(t) {
6014
6018
  const e = document.createElement("div");
6015
6019
  Object.assign(e.style, {
6016
6020
  position: "fixed",
6017
- ...Jc(t.position),
6021
+ ...Yc(t.position),
6018
6022
  display: "block",
6019
6023
  borderRadius: "4px",
6020
6024
  border: "1px #ccc solid",
@@ -6027,7 +6031,7 @@ function Yc(t) {
6027
6031
  }
6028
6032
  return { element: e, isVisible: n };
6029
6033
  }
6030
- function Zc(t, e) {
6034
+ function Xc(t, e) {
6031
6035
  return e && e.refresh_token ? new Response(JSON.stringify({ ok: !0 }), {
6032
6036
  headers: {
6033
6037
  "Content-Type": "application/json",
@@ -6048,7 +6052,7 @@ function wt(t, e) {
6048
6052
  headers: { "Content-Type": "application/json" }
6049
6053
  });
6050
6054
  }
6051
- const $u = (t) => ({
6055
+ const Uu = (t) => ({
6052
6056
  POST: async (e) => {
6053
6057
  let n;
6054
6058
  try {
@@ -6062,27 +6066,27 @@ const $u = (t) => ({
6062
6066
  return wt(403, "App ID mismatch");
6063
6067
  switch (n.type) {
6064
6068
  case "sync-user":
6065
- return Zc(t, n.user ?? null);
6069
+ return Xc(t, n.user ?? null);
6066
6070
  default:
6067
6071
  return wt(400, `Unknown type: ${n.type}`);
6068
6072
  }
6069
6073
  }
6070
- }), Xc = {
6074
+ }), eu = {
6071
6075
  apiURI: "https://api.instantdb.com",
6072
6076
  websocketURI: "wss://api.instantdb.com/runtime/session"
6073
6077
  };
6074
- function eu() {
6078
+ function tu() {
6075
6079
  return globalThis.__instantDbSchemaHashStore = globalThis.__instantDbSchemaHashStore ?? /* @__PURE__ */ new WeakMap(), globalThis.__instantDbSchemaHashStore;
6076
6080
  }
6077
- function tu() {
6081
+ function nu() {
6078
6082
  return globalThis.__instantDbStore = globalThis.__instantDbStore ?? {}, globalThis.__instantDbStore;
6079
6083
  }
6080
6084
  function Tn(t) {
6081
6085
  const e = t.__adminToken;
6082
6086
  return t.appId + "_" + (t.websocketURI || "default_ws_uri") + "_" + (t.apiURI || "default_api_uri") + "_" + (e || "client_only") + "_" + t.useDateObjects;
6083
6087
  }
6084
- const mn = tu(), Vr = eu();
6085
- class nu {
6088
+ const mn = nu(), Vr = tu();
6089
+ class ru {
6086
6090
  constructor(e) {
6087
6091
  p(this, "db");
6088
6092
  /**
@@ -6199,7 +6203,7 @@ class nu {
6199
6203
  this.db = e;
6200
6204
  }
6201
6205
  }
6202
- class ru {
6206
+ class su {
6203
6207
  constructor(e) {
6204
6208
  p(this, "db");
6205
6209
  /**
@@ -6248,16 +6252,16 @@ class ru {
6248
6252
  this.db = e;
6249
6253
  }
6250
6254
  }
6251
- function su(t) {
6255
+ function iu(t) {
6252
6256
  return JSON.parse(JSON.stringify(t));
6253
6257
  }
6254
- class iu {
6258
+ class ou {
6255
6259
  constructor(e) {
6256
6260
  p(this, "_reactor");
6257
6261
  p(this, "auth");
6258
6262
  p(this, "storage");
6259
6263
  p(this, "tx", qn());
6260
- this._reactor = e, this.auth = new nu(this._reactor), this.storage = new ru(this._reactor);
6264
+ this._reactor = e, this.auth = new ru(this._reactor), this.storage = new su(this._reactor);
6261
6265
  }
6262
6266
  /**
6263
6267
  * Use this to write data! You can create, update, delete, and link objects
@@ -6440,10 +6444,10 @@ function Br(t) {
6440
6444
  const n = q(t);
6441
6445
  return Vr.set(t, n), n;
6442
6446
  }
6443
- function ou(t, e) {
6447
+ function au(t, e) {
6444
6448
  return Br(t._reactor.config.schema) !== Br(e);
6445
6449
  }
6446
- function au(t, e, n, r, s) {
6450
+ function cu(t, e, n, r, s) {
6447
6451
  var u;
6448
6452
  const i = {
6449
6453
  ...t,
@@ -6451,15 +6455,15 @@ function au(t, e, n, r, s) {
6451
6455
  useDateObjects: t.useDateObjects ?? !1
6452
6456
  }, o = mn[Tn(i)];
6453
6457
  if (o)
6454
- return ou(o, i.schema) && o._reactor.updateSchema(i.schema), o;
6455
- const a = new $c({
6456
- ...Xc,
6458
+ return au(o, i.schema) && o._reactor.updateSchema(i.schema), o;
6459
+ const a = new Dc({
6460
+ ...eu,
6457
6461
  ...i,
6458
6462
  cardinalityInference: !!i.schema
6459
- }, e || Ms, n || js, { ...r || {}, "@instantdb/core": zn }, s), c = new iu(a);
6460
- return mn[Tn(i)] = c, cu(i.appId, i.devtool), c;
6463
+ }, e || js, n || Rs, { ...r || {}, "@instantdb/core": zn }, s), c = new ou(a);
6464
+ return mn[Tn(i)] = c, uu(i.appId, i.devtool), c;
6461
6465
  }
6462
- function cu(t, e) {
6466
+ function uu(t, e) {
6463
6467
  if (typeof window > "u" || typeof window.location > "u" || typeof document > "u" || typeof e == "boolean" && !e)
6464
6468
  return;
6465
6469
  const n = {
@@ -6467,7 +6471,7 @@ function cu(t, e) {
6467
6471
  allowedHosts: ["localhost"],
6468
6472
  ...typeof e == "object" ? e : {}
6469
6473
  };
6470
- n.allowedHosts.includes(window.location.hostname) && Vc(t, n);
6474
+ n.allowedHosts.includes(window.location.hostname) && Bc(t, n);
6471
6475
  }
6472
6476
  var Sn = { exports: {} }, Be = {};
6473
6477
  /**
@@ -6480,7 +6484,7 @@ var Sn = { exports: {} }, Be = {};
6480
6484
  * LICENSE file in the root directory of this source tree.
6481
6485
  */
6482
6486
  var Gr;
6483
- function uu() {
6487
+ function lu() {
6484
6488
  if (Gr) return Be;
6485
6489
  Gr = 1;
6486
6490
  var t = ts, e = Symbol.for("react.element"), n = Symbol.for("react.fragment"), r = Object.prototype.hasOwnProperty, s = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, i = { key: !0, ref: !0, __self: !0, __source: !0 };
@@ -6494,7 +6498,7 @@ function uu() {
6494
6498
  return Be.Fragment = n, Be.jsx = o, Be.jsxs = o, Be;
6495
6499
  }
6496
6500
  var Ge = {}, Qr;
6497
- function lu() {
6501
+ function fu() {
6498
6502
  if (Qr) return Ge;
6499
6503
  Qr = 1;
6500
6504
  var t = {};
@@ -6601,7 +6605,7 @@ function lu() {
6601
6605
  function Zn() {
6602
6606
  }
6603
6607
  Zn.__reactDisabledLog = !0;
6604
- function Vs() {
6608
+ function Bs() {
6605
6609
  {
6606
6610
  if (ge === 0) {
6607
6611
  We = console.log, Bn = console.info, Gn = console.warn, Qn = console.error, Hn = console.group, Jn = console.groupCollapsed, Yn = console.groupEnd;
@@ -6624,7 +6628,7 @@ function lu() {
6624
6628
  ge++;
6625
6629
  }
6626
6630
  }
6627
- function Bs() {
6631
+ function Gs() {
6628
6632
  {
6629
6633
  if (ge--, ge === 0) {
6630
6634
  var d = {
@@ -6675,8 +6679,8 @@ function lu() {
6675
6679
  }
6676
6680
  var qt = !1, dt;
6677
6681
  {
6678
- var Gs = typeof WeakMap == "function" ? WeakMap : Map;
6679
- dt = new Gs();
6682
+ var Qs = typeof WeakMap == "function" ? WeakMap : Map;
6683
+ dt = new Qs();
6680
6684
  }
6681
6685
  function Xn(d, T) {
6682
6686
  if (!d || qt)
@@ -6691,7 +6695,7 @@ function lu() {
6691
6695
  var M = Error.prepareStackTrace;
6692
6696
  Error.prepareStackTrace = void 0;
6693
6697
  var R;
6694
- R = Nt.current, Nt.current = null, Vs();
6698
+ R = Nt.current, Nt.current = null, Bs();
6695
6699
  try {
6696
6700
  if (T) {
6697
6701
  var I = function() {
@@ -6744,15 +6748,15 @@ function lu() {
6744
6748
  }
6745
6749
  }
6746
6750
  } finally {
6747
- qt = !1, Nt.current = R, Bs(), Error.prepareStackTrace = M;
6751
+ qt = !1, Nt.current = R, Gs(), Error.prepareStackTrace = M;
6748
6752
  }
6749
6753
  var Me = d ? d.displayName || d.name : "", Te = Me ? ft(Me) : "";
6750
6754
  return typeof d == "function" && dt.set(d, Te), Te;
6751
6755
  }
6752
- function Qs(d, T, v) {
6756
+ function Hs(d, T, v) {
6753
6757
  return Xn(d, !1);
6754
6758
  }
6755
- function Hs(d) {
6759
+ function Js(d) {
6756
6760
  var T = d.prototype;
6757
6761
  return !!(T && T.isReactComponent);
6758
6762
  }
@@ -6760,7 +6764,7 @@ function lu() {
6760
6764
  if (d == null)
6761
6765
  return "";
6762
6766
  if (typeof d == "function")
6763
- return Xn(d, Hs(d));
6767
+ return Xn(d, Js(d));
6764
6768
  if (typeof d == "string")
6765
6769
  return ft(d);
6766
6770
  switch (d) {
@@ -6772,7 +6776,7 @@ function lu() {
6772
6776
  if (typeof d == "object")
6773
6777
  switch (d.$$typeof) {
6774
6778
  case u:
6775
- return Qs(d.render);
6779
+ return Hs(d.render);
6776
6780
  case h:
6777
6781
  return ht(d.type, T, v);
6778
6782
  case y: {
@@ -6793,7 +6797,7 @@ function lu() {
6793
6797
  } else
6794
6798
  tr.setExtraStackFrame(null);
6795
6799
  }
6796
- function Js(d, T, v, O, M) {
6800
+ function Ys(d, T, v, O, M) {
6797
6801
  {
6798
6802
  var R = Function.call.bind(ze);
6799
6803
  for (var I in d)
@@ -6812,17 +6816,17 @@ function lu() {
6812
6816
  }
6813
6817
  }
6814
6818
  }
6815
- var Ys = Array.isArray;
6819
+ var Zs = Array.isArray;
6816
6820
  function Wt(d) {
6817
- return Ys(d);
6821
+ return Zs(d);
6818
6822
  }
6819
- function Zs(d) {
6823
+ function Xs(d) {
6820
6824
  {
6821
6825
  var T = typeof Symbol == "function" && Symbol.toStringTag, v = T && d[Symbol.toStringTag] || d.constructor.name || "Object";
6822
6826
  return v;
6823
6827
  }
6824
6828
  }
6825
- function Xs(d) {
6829
+ function ei(d) {
6826
6830
  try {
6827
6831
  return nr(d), !1;
6828
6832
  } catch {
@@ -6833,16 +6837,16 @@ function lu() {
6833
6837
  return "" + d;
6834
6838
  }
6835
6839
  function rr(d) {
6836
- if (Xs(d))
6837
- return m("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Zs(d)), nr(d);
6840
+ if (ei(d))
6841
+ return m("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Xs(d)), nr(d);
6838
6842
  }
6839
- var sr = _.ReactCurrentOwner, ei = {
6843
+ var sr = _.ReactCurrentOwner, ti = {
6840
6844
  key: !0,
6841
6845
  ref: !0,
6842
6846
  __self: !0,
6843
6847
  __source: !0
6844
6848
  }, ir, or;
6845
- function ti(d) {
6849
+ function ni(d) {
6846
6850
  if (ze.call(d, "ref")) {
6847
6851
  var T = Object.getOwnPropertyDescriptor(d, "ref").get;
6848
6852
  if (T && T.isReactWarning)
@@ -6850,7 +6854,7 @@ function lu() {
6850
6854
  }
6851
6855
  return d.ref !== void 0;
6852
6856
  }
6853
- function ni(d) {
6857
+ function ri(d) {
6854
6858
  if (ze.call(d, "key")) {
6855
6859
  var T = Object.getOwnPropertyDescriptor(d, "key").get;
6856
6860
  if (T && T.isReactWarning)
@@ -6858,10 +6862,10 @@ function lu() {
6858
6862
  }
6859
6863
  return d.key !== void 0;
6860
6864
  }
6861
- function ri(d, T) {
6865
+ function si(d, T) {
6862
6866
  typeof d.ref == "string" && sr.current;
6863
6867
  }
6864
- function si(d, T) {
6868
+ function ii(d, T) {
6865
6869
  {
6866
6870
  var v = function() {
6867
6871
  ir || (ir = !0, m("%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)", T));
@@ -6872,7 +6876,7 @@ function lu() {
6872
6876
  });
6873
6877
  }
6874
6878
  }
6875
- function ii(d, T) {
6879
+ function oi(d, T) {
6876
6880
  {
6877
6881
  var v = function() {
6878
6882
  or || (or = !0, m("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", T));
@@ -6883,7 +6887,7 @@ function lu() {
6883
6887
  });
6884
6888
  }
6885
6889
  }
6886
- var oi = function(d, T, v, O, M, R, I) {
6890
+ var ai = function(d, T, v, O, M, R, I) {
6887
6891
  var C = {
6888
6892
  // This tag allows us to uniquely identify this as a React Element
6889
6893
  $$typeof: n,
@@ -6912,12 +6916,12 @@ function lu() {
6912
6916
  value: M
6913
6917
  }), Object.freeze && (Object.freeze(C.props), Object.freeze(C)), C;
6914
6918
  };
6915
- function ai(d, T, v, O, M) {
6919
+ function ci(d, T, v, O, M) {
6916
6920
  {
6917
6921
  var R, I = {}, C = null, G = null;
6918
- v !== void 0 && (rr(v), C = "" + v), ni(T) && (rr(T.key), C = "" + T.key), ti(T) && (G = T.ref, ri(T, M));
6922
+ v !== void 0 && (rr(v), C = "" + v), ri(T) && (rr(T.key), C = "" + T.key), ni(T) && (G = T.ref, si(T, M));
6919
6923
  for (R in T)
6920
- ze.call(T, R) && !ei.hasOwnProperty(R) && (I[R] = T[R]);
6924
+ ze.call(T, R) && !ti.hasOwnProperty(R) && (I[R] = T[R]);
6921
6925
  if (d && d.defaultProps) {
6922
6926
  var D = d.defaultProps;
6923
6927
  for (R in D)
@@ -6925,9 +6929,9 @@ function lu() {
6925
6929
  }
6926
6930
  if (C || G) {
6927
6931
  var L = typeof d == "function" ? d.displayName || d.name || "Unknown" : d;
6928
- C && si(I, L), G && ii(I, L);
6932
+ C && ii(I, L), G && oi(I, L);
6929
6933
  }
6930
- return oi(d, C, G, M, O, sr.current, I);
6934
+ return ai(d, C, G, M, O, sr.current, I);
6931
6935
  }
6932
6936
  }
6933
6937
  var zt = _.ReactCurrentOwner, ar = _.ReactDebugCurrentFrame;
@@ -6955,11 +6959,11 @@ Check the render method of \`` + d + "`.";
6955
6959
  return "";
6956
6960
  }
6957
6961
  }
6958
- function ci(d) {
6962
+ function ui(d) {
6959
6963
  return "";
6960
6964
  }
6961
6965
  var ur = {};
6962
- function ui(d) {
6966
+ function li(d) {
6963
6967
  {
6964
6968
  var T = cr();
6965
6969
  if (!T) {
@@ -6976,7 +6980,7 @@ Check the top-level render call using <` + v + ">.");
6976
6980
  if (!d._store || d._store.validated || d.key != null)
6977
6981
  return;
6978
6982
  d._store.validated = !0;
6979
- var v = ui(T);
6983
+ var v = li(T);
6980
6984
  if (ur[v])
6981
6985
  return;
6982
6986
  ur[v] = !0;
@@ -7003,7 +7007,7 @@ Check the top-level render call using <` + v + ">.");
7003
7007
  }
7004
7008
  }
7005
7009
  }
7006
- function li(d) {
7010
+ function fi(d) {
7007
7011
  {
7008
7012
  var T = d.type;
7009
7013
  if (T == null || typeof T == "string")
@@ -7019,7 +7023,7 @@ Check the top-level render call using <` + v + ">.");
7019
7023
  return;
7020
7024
  if (v) {
7021
7025
  var O = ie(T);
7022
- Js(v, d.props, "prop", O, d);
7026
+ Ys(v, d.props, "prop", O, d);
7023
7027
  } else if (T.PropTypes !== void 0 && !Vt) {
7024
7028
  Vt = !0;
7025
7029
  var M = ie(T);
@@ -7028,7 +7032,7 @@ Check the top-level render call using <` + v + ">.");
7028
7032
  typeof T.getDefaultProps == "function" && !T.getDefaultProps.isReactClassApproved && m("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
7029
7033
  }
7030
7034
  }
7031
- function fi(d) {
7035
+ function di(d) {
7032
7036
  {
7033
7037
  for (var T = Object.keys(d.props), v = 0; v < T.length; v++) {
7034
7038
  var O = T[v];
@@ -7047,12 +7051,12 @@ Check the top-level render call using <` + v + ">.");
7047
7051
  if (!I) {
7048
7052
  var C = "";
7049
7053
  (d === void 0 || typeof d == "object" && d !== null && Object.keys(d).length === 0) && (C += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
7050
- var G = ci();
7054
+ var G = ui();
7051
7055
  G ? C += G : C += cr();
7052
7056
  var D;
7053
7057
  d === null ? D = "null" : Wt(d) ? D = "array" : d !== void 0 && d.$$typeof === n ? (D = "<" + (ie(d.type) || "Unknown") + " />", C = " Did you accidentally export a JSX literal instead of a component?") : D = typeof d, m("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", D, C);
7054
7058
  }
7055
- var L = ai(d, T, v, M, R);
7059
+ var L = ci(d, T, v, M, R);
7056
7060
  if (L == null)
7057
7061
  return L;
7058
7062
  if (I) {
@@ -7069,36 +7073,36 @@ Check the top-level render call using <` + v + ">.");
7069
7073
  fr(re, d);
7070
7074
  }
7071
7075
  if (ze.call(T, "key")) {
7072
- var Te = ie(d), J = Object.keys(T).filter(function(gi) {
7073
- return gi !== "key";
7076
+ var Te = ie(d), J = Object.keys(T).filter(function(_i) {
7077
+ return _i !== "key";
7074
7078
  }), Gt = J.length > 0 ? "{key: someKey, " + J.join(": ..., ") + ": ...}" : "{key: someKey}";
7075
7079
  if (!dr[Te + Gt]) {
7076
- var bi = J.length > 0 ? "{" + J.join(": ..., ") + ": ...}" : "{}";
7080
+ var gi = J.length > 0 ? "{" + J.join(": ..., ") + ": ...}" : "{}";
7077
7081
  m(`A props object containing a "key" prop is being spread into JSX:
7078
7082
  let props = %s;
7079
7083
  <%s {...props} />
7080
7084
  React keys must be passed directly to JSX without using spread:
7081
7085
  let props = %s;
7082
- <%s key={someKey} {...props} />`, Gt, Te, bi, Te), dr[Te + Gt] = !0;
7086
+ <%s key={someKey} {...props} />`, Gt, Te, gi, Te), dr[Te + Gt] = !0;
7083
7087
  }
7084
7088
  }
7085
- return d === s ? fi(L) : li(L), L;
7089
+ return d === s ? di(L) : fi(L), L;
7086
7090
  }
7087
7091
  }
7088
- function di(d, T, v) {
7092
+ function hi(d, T, v) {
7089
7093
  return hr(d, T, v, !0);
7090
7094
  }
7091
- function hi(d, T, v) {
7095
+ function pi(d, T, v) {
7092
7096
  return hr(d, T, v, !1);
7093
7097
  }
7094
- var pi = hi, yi = di;
7095
- Ge.Fragment = s, Ge.jsx = pi, Ge.jsxs = yi;
7098
+ var yi = pi, bi = hi;
7099
+ Ge.Fragment = s, Ge.jsx = yi, Ge.jsxs = bi;
7096
7100
  }(), Ge;
7097
7101
  }
7098
- var fu = {};
7099
- fu.NODE_ENV === "production" ? Sn.exports = uu() : Sn.exports = lu();
7102
+ var du = {};
7103
+ du.NODE_ENV === "production" ? Sn.exports = lu() : Sn.exports = fu();
7100
7104
  var V = Sn.exports;
7101
- const du = {
7105
+ const hu = {
7102
7106
  isLoading: !0,
7103
7107
  data: void 0,
7104
7108
  pageInfo: void 0,
@@ -7113,9 +7117,9 @@ function Hr(t) {
7113
7117
  ...t || {}
7114
7118
  };
7115
7119
  }
7116
- function hu(t, e, n) {
7120
+ function pu(t, e, n) {
7117
7121
  e && n && "ruleParams" in n && (e = { $$ruleParams: n.ruleParams, ...e });
7118
- const r = e ? su(e) : null, s = q(r), i = it(Hr(t._reactor.getPreviousResult(r))), o = we(
7122
+ const r = e ? iu(e) : null, s = q(r), i = it(Hr(t._reactor.getPreviousResult(r))), o = we(
7119
7123
  (c) => (i.current = Hr(t._reactor.getPreviousResult(r)), c(), r ? t.subscribeQuery(r, (l) => {
7120
7124
  i.current = {
7121
7125
  isLoading: !l,
@@ -7132,9 +7136,9 @@ function hu(t, e, n) {
7132
7136
  // Build a new subscribe function if the query changes
7133
7137
  [s]
7134
7138
  );
7135
- return { state: nn(o, () => i.current, () => du), query: r };
7139
+ return { state: nn(o, () => i.current, () => hu), query: r };
7136
7140
  }
7137
- function pu() {
7141
+ function yu() {
7138
7142
  const t = it(null);
7139
7143
  Ae(() => {
7140
7144
  n();
@@ -7147,14 +7151,14 @@ function pu() {
7147
7151
  }
7148
7152
  return { set: e, clear: n };
7149
7153
  }
7150
- const yu = 1e3;
7151
- function bu(t, e, n) {
7154
+ const bu = 1e3;
7155
+ function gu(t, e, n) {
7152
7156
  const r = it(n);
7153
7157
  r.current = n, Ae(() => t.core._reactor.subscribeTopic(t.type, t.id, e, (i, o) => {
7154
7158
  r.current(i, o);
7155
7159
  }), [t.id, e]);
7156
7160
  }
7157
- function gu(t, e) {
7161
+ function _u(t, e) {
7158
7162
  return Ae(() => t.core._reactor.joinRoom(t.type, t.id), [t.id]), we((r) => {
7159
7163
  t.core._reactor.publishTopic({
7160
7164
  roomType: t.type,
@@ -7164,7 +7168,7 @@ function gu(t, e) {
7164
7168
  });
7165
7169
  }, [t.id, e]);
7166
7170
  }
7167
- function _u(t, e = {}) {
7171
+ function wu(t, e = {}) {
7168
7172
  var o, a;
7169
7173
  const [n, r] = ns(() => t.core._reactor.getPresence(t.type, t.id, e) ?? {
7170
7174
  peers: {},
@@ -7181,11 +7185,11 @@ function _u(t, e = {}) {
7181
7185
  publishPresence: s
7182
7186
  }), [n, s]);
7183
7187
  }
7184
- function wu(t, e, n) {
7188
+ function Tu(t, e, n) {
7185
7189
  Ae(() => t.core._reactor.joinRoom(t.type, t.id, e), [t.id]), Ae(() => t.core._reactor.publishPresence(t.type, t.id, e), [t.type, t.id, n ?? JSON.stringify(e)]);
7186
7190
  }
7187
- function Tu(t, e, n = {}) {
7188
- const r = pu(), s = Se.usePresence(t, {
7191
+ function mu(t, e, n = {}) {
7192
+ const r = yu(), s = Se.usePresence(t, {
7189
7193
  keys: [e]
7190
7194
  }), i = rn(() => {
7191
7195
  const l = t._core._reactor.getPresence(t.type, t.id);
@@ -7193,7 +7197,7 @@ function Tu(t, e, n = {}) {
7193
7197
  }, [n == null ? void 0 : n.writeOnly, s]), o = we((l) => {
7194
7198
  t.core._reactor.publishPresence(t.type, t.id, {
7195
7199
  [e]: l
7196
- }), l && ((n == null ? void 0 : n.timeout) === null || (n == null ? void 0 : n.timeout) === 0 || r.set((n == null ? void 0 : n.timeout) ?? yu, () => {
7200
+ }), l && ((n == null ? void 0 : n.timeout) === null || (n == null ? void 0 : n.timeout) === 0 || r.set((n == null ? void 0 : n.timeout) ?? bu, () => {
7197
7201
  t.core._reactor.publishPresence(t.type, t.id, {
7198
7202
  [e]: null
7199
7203
  });
@@ -7211,13 +7215,13 @@ function Tu(t, e, n = {}) {
7211
7215
  };
7212
7216
  }
7213
7217
  const Se = {
7214
- useTopicEffect: bu,
7215
- usePublishTopic: gu,
7216
- usePresence: _u,
7217
- useSyncPresence: wu,
7218
- useTypingIndicator: Tu
7218
+ useTopicEffect: gu,
7219
+ usePublishTopic: _u,
7220
+ usePresence: wu,
7221
+ useSyncPresence: Tu,
7222
+ useTypingIndicator: mu
7219
7223
  };
7220
- class mu {
7224
+ class Su {
7221
7225
  constructor(e, n, r) {
7222
7226
  p(this, "core");
7223
7227
  /** @deprecated use `core` instead */
@@ -7304,7 +7308,7 @@ class mu {
7304
7308
  this.core = e, this._core = this.core, this.type = n, this.id = r;
7305
7309
  }
7306
7310
  }
7307
- const Su = {
7311
+ const vu = {
7308
7312
  isLoading: !0,
7309
7313
  user: void 0,
7310
7314
  error: void 0
@@ -7407,7 +7411,7 @@ class Et {
7407
7411
  * auth.user ? { goals: {} } : null,
7408
7412
  * );
7409
7413
  */
7410
- p(this, "useQuery", (e, n) => hu(this.core, e, n).state);
7414
+ p(this, "useQuery", (e, n) => pu(this.core, e, n).state);
7411
7415
  /**
7412
7416
  * Listen for the logged in state. This is useful
7413
7417
  * for deciding when to show a login screen.
@@ -7532,7 +7536,7 @@ class Et {
7532
7536
  const n = this.useAuth();
7533
7537
  return n.isLoading || n.error || n.user ? null : V.jsx(V.Fragment, { children: e });
7534
7538
  });
7535
- this.core = au(
7539
+ this.core = cu(
7536
7540
  e,
7537
7541
  // @ts-expect-error because TS can't resolve subclass statics
7538
7542
  e.Store || this.constructor.Storage,
@@ -7556,13 +7560,13 @@ class Et {
7556
7560
  * const { peers } = db.rooms.usePresence(room);
7557
7561
  */
7558
7562
  room(e = "_defaultRoomType", n = "_defaultRoomId") {
7559
- return new mu(this.core, e, n);
7563
+ return new Su(this.core, e, n);
7560
7564
  }
7561
7565
  _useAuth() {
7562
7566
  const e = it(this.core._reactor._currentUserCached), n = we((s) => this.core.subscribeAuth((o) => {
7563
7567
  e.current = { isLoading: !1, ...o }, s();
7564
7568
  }), []);
7565
- return nn(n, () => e.current, () => Su);
7569
+ return nn(n, () => e.current, () => vu);
7566
7570
  }
7567
7571
  /**
7568
7572
  * One time query for the logged in state. This is useful
@@ -7586,7 +7590,7 @@ class Jr extends Error {
7586
7590
  }
7587
7591
  function tn(t) {
7588
7592
  }
7589
- function vu(t) {
7593
+ function Eu(t) {
7590
7594
  if (typeof t == "function")
7591
7595
  throw new TypeError(
7592
7596
  "`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?"
@@ -7594,7 +7598,7 @@ function vu(t) {
7594
7598
  const { onEvent: e = tn, onError: n = tn, onRetry: r = tn, onComment: s } = t;
7595
7599
  let i = "", o = !0, a, c = "", u = "";
7596
7600
  function l(g) {
7597
- const w = o ? g.replace(/^\xEF\xBB\xBF/, "") : g, [S, _] = Eu(`${i}${w}`);
7601
+ const w = o ? g.replace(/^\xEF\xBB\xBF/, "") : g, [S, _] = Ou(`${i}${w}`);
7598
7602
  for (const m of S)
7599
7603
  f(m);
7600
7604
  i = _, o = !1;
@@ -7662,7 +7666,7 @@ function vu(t) {
7662
7666
  }
7663
7667
  return { feed: l, reset: b };
7664
7668
  }
7665
- function Eu(t) {
7669
+ function Ou(t) {
7666
7670
  const e = [];
7667
7671
  let n = "", r = 0;
7668
7672
  for (; r < t.length; ) {
@@ -7722,7 +7726,7 @@ class Yr extends Event {
7722
7726
  return e(Zr(this), n);
7723
7727
  }
7724
7728
  }
7725
- function Ou(t) {
7729
+ function Au(t) {
7726
7730
  const e = globalThis.DOMException;
7727
7731
  return typeof e == "function" ? new e(t, "SyntaxError") : new SyntaxError(t);
7728
7732
  }
@@ -7739,9 +7743,9 @@ function Zr(t) {
7739
7743
  timeStamp: t.timeStamp
7740
7744
  };
7741
7745
  }
7742
- var Ws = (t) => {
7746
+ var zs = (t) => {
7743
7747
  throw TypeError(t);
7744
- }, Vn = (t, e, n) => e.has(t) || Ws("Cannot " + n), k = (t, e, n) => (Vn(t, e, "read from private field"), n ? n.call(t) : e.get(t)), K = (t, e, n) => e.has(t) ? Ws("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, n), $ = (t, e, n, r) => (Vn(t, e, "write to private field"), e.set(t, n), n), he = (t, e, n) => (Vn(t, e, "access private method"), n), Y, ve, Re, Ot, jt, rt, De, st, _e, xe, Le, $e, Ze, oe, En, On, An, Xr, kn, Cn, Xe, Pn, In;
7748
+ }, Vn = (t, e, n) => e.has(t) || zs("Cannot " + n), k = (t, e, n) => (Vn(t, e, "read from private field"), n ? n.call(t) : e.get(t)), K = (t, e, n) => e.has(t) ? zs("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, n), $ = (t, e, n, r) => (Vn(t, e, "write to private field"), e.set(t, n), n), he = (t, e, n) => (Vn(t, e, "access private method"), n), Y, ve, Re, Ot, jt, rt, De, st, _e, xe, Le, $e, Ze, oe, En, On, An, Xr, kn, Cn, Xe, Pn, In;
7745
7749
  class At extends EventTarget {
7746
7750
  constructor(e, n) {
7747
7751
  var r, s;
@@ -7794,13 +7798,13 @@ class At extends EventTarget {
7794
7798
  if (e instanceof URL)
7795
7799
  $(this, ve, e);
7796
7800
  else if (typeof e == "string")
7797
- $(this, ve, new URL(e, Au()));
7801
+ $(this, ve, new URL(e, ku()));
7798
7802
  else
7799
7803
  throw new Error("Invalid URL");
7800
7804
  } catch {
7801
- throw Ou("An invalid or illegal string was specified");
7805
+ throw Au("An invalid or illegal string was specified");
7802
7806
  }
7803
- $(this, xe, vu({
7807
+ $(this, xe, Eu({
7804
7808
  onEvent: k(this, kn),
7805
7809
  onRetry: k(this, Cn)
7806
7810
  })), $(this, Y, this.CONNECTING), $(this, rt, 3e3), $(this, jt, (r = n == null ? void 0 : n.fetch) != null ? r : globalThis.fetch), $(this, Ot, (s = n == null ? void 0 : n.withCredentials) != null ? s : !1), he(this, oe, En).call(this);
@@ -7943,24 +7947,24 @@ At.OPEN = 1, /**
7943
7947
  * @public
7944
7948
  */
7945
7949
  At.CLOSED = 2;
7946
- function Au() {
7950
+ function ku() {
7947
7951
  const t = "document" in globalThis ? globalThis.document : void 0;
7948
7952
  return t && typeof t == "object" && "baseURI" in t && typeof t.baseURI == "string" ? t.baseURI : void 0;
7949
7953
  }
7950
- class zs extends Et {
7954
+ class Vs extends Et {
7951
7955
  }
7952
- p(zs, "EventSourceImpl", At);
7953
- function ku(t) {
7956
+ p(Vs, "EventSourceImpl", At);
7957
+ function Cu(t) {
7954
7958
  const e = {
7955
7959
  ...t,
7956
7960
  useDateObjects: t.useDateObjects ?? !1
7957
7961
  };
7958
- return new zs(e, {
7962
+ return new Vs(e, {
7959
7963
  "@instantdb/react": zn
7960
7964
  });
7961
7965
  }
7962
- const Du = ku;
7963
- function Uu({
7966
+ const Lu = Cu;
7967
+ function Fu({
7964
7968
  as: t = "div",
7965
7969
  spaceId: e,
7966
7970
  room: n,
@@ -8012,7 +8016,7 @@ function Uu({
8012
8016
  [l]: void 0
8013
8017
  });
8014
8018
  }
8015
- return Ti(
8019
+ return mi(
8016
8020
  t,
8017
8021
  {
8018
8022
  onMouseMove: b,
@@ -8032,8 +8036,8 @@ function Uu({
8032
8036
  {
8033
8037
  style: {
8034
8038
  ...es,
8035
- ...Pu,
8036
- zIndex: u !== void 0 ? u : Iu
8039
+ ...Iu,
8040
+ zIndex: u !== void 0 ? u : Mu
8037
8041
  },
8038
8042
  children: Object.entries(f.peers).map(([_, m]) => {
8039
8043
  const A = m[l];
@@ -8049,7 +8053,7 @@ function Uu({
8049
8053
  children: a ? a({
8050
8054
  color: A.color,
8051
8055
  presence: h == null ? void 0 : h.peers[_]
8052
- }) : /* @__PURE__ */ V.jsx(Cu, { ...A })
8056
+ }) : /* @__PURE__ */ V.jsx(Pu, { ...A })
8053
8057
  },
8054
8058
  _
8055
8059
  ) : null;
@@ -8060,7 +8064,7 @@ function Uu({
8060
8064
  ]
8061
8065
  );
8062
8066
  }
8063
- function Cu({ color: t }) {
8067
+ function Pu({ color: t }) {
8064
8068
  const n = t || "black";
8065
8069
  return /* @__PURE__ */ V.jsxs(
8066
8070
  "svg",
@@ -8113,23 +8117,24 @@ const es = {
8113
8117
  left: 0,
8114
8118
  bottom: 0,
8115
8119
  right: 0
8116
- }, Pu = {
8120
+ }, Iu = {
8117
8121
  overflow: "hidden",
8118
8122
  pointerEvents: "none",
8119
8123
  userSelect: "none"
8120
- }, Iu = 99999;
8124
+ }, Mu = 99999;
8121
8125
  export {
8122
- Uu as Cursors,
8126
+ Fu as Cursors,
8123
8127
  $t as InstantAPIError,
8124
8128
  Et as InstantReactAbstractDatabase,
8125
- zs as InstantReactWebDatabase,
8126
- Fa as StoreInterface,
8129
+ Vs as InstantReactWebDatabase,
8130
+ Na as StoreInterface,
8127
8131
  me as SyncTableCallbackEventType,
8128
- $u as createInstantRouteHandler,
8129
- xu as i,
8132
+ Uu as createInstantRouteHandler,
8133
+ Du as i,
8130
8134
  W as id,
8131
- ku as init,
8132
- Du as init_experimental,
8133
- la as lookup,
8134
- Ru as tx
8135
+ Cu as init,
8136
+ Lu as init_experimental,
8137
+ fa as lookup,
8138
+ xu as setInstantWarningsEnabled,
8139
+ $u as tx
8135
8140
  };