@instantdb/react 0.22.104 → 0.22.105-experimental.fix1111111.21050884263.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/standalone/index.js +294 -290
- package/dist/standalone/index.umd.cjs +9 -9
- package/package.json +4 -4
package/dist/standalone/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var gi = Object.defineProperty;
|
|
2
2
|
var _i = (t, e, n) => e in t ? gi(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
|
|
3
3
|
var p = (t, e, n) => _i(t, typeof e != "symbol" ? e + "" : e, n);
|
|
4
|
-
import Xr, { useRef as it, useCallback as _e, useSyncExternalStore as
|
|
4
|
+
import Xr, { useRef as it, useCallback as _e, useSyncExternalStore as Xt, useEffect as Oe, useMemo as en, useState as es, createElement as wi } from "react";
|
|
5
5
|
function q(t) {
|
|
6
6
|
if (typeof t == "number")
|
|
7
7
|
return (Math.abs(t * 2654435761) >>> 0).toString(16);
|
|
@@ -47,11 +47,11 @@ const U = {
|
|
|
47
47
|
}, ts = Symbol.for("__MUTATIVE_PROXY_DRAFT__"), Ti = Symbol("__MUTATIVE_RAW_RETURN_SYMBOL__"), _t = Symbol.iterator, ne = {
|
|
48
48
|
mutable: "mutable",
|
|
49
49
|
immutable: "immutable"
|
|
50
|
-
},
|
|
50
|
+
}, Cn = {};
|
|
51
51
|
function et(t, e) {
|
|
52
52
|
return t instanceof Map ? t.has(e) : Object.prototype.hasOwnProperty.call(t, e);
|
|
53
53
|
}
|
|
54
|
-
function
|
|
54
|
+
function dr(t, e) {
|
|
55
55
|
if (e in t) {
|
|
56
56
|
let n = Reflect.getPrototypeOf(t);
|
|
57
57
|
for (; n; ) {
|
|
@@ -62,10 +62,10 @@ function fr(t, e) {
|
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
|
-
function
|
|
65
|
+
function Pn(t) {
|
|
66
66
|
return Object.getPrototypeOf(t) === Set.prototype;
|
|
67
67
|
}
|
|
68
|
-
function
|
|
68
|
+
function In(t) {
|
|
69
69
|
return Object.getPrototypeOf(t) === Map.prototype;
|
|
70
70
|
}
|
|
71
71
|
function te(t) {
|
|
@@ -78,7 +78,7 @@ function Ae(t) {
|
|
|
78
78
|
function P(t) {
|
|
79
79
|
return typeof t != "object" ? null : t == null ? void 0 : t[ts];
|
|
80
80
|
}
|
|
81
|
-
function
|
|
81
|
+
function Mn(t) {
|
|
82
82
|
var e;
|
|
83
83
|
const n = P(t);
|
|
84
84
|
return n ? (e = n.copy) !== null && e !== void 0 ? e : n.original : t;
|
|
@@ -125,7 +125,7 @@ function Vt(t, e) {
|
|
|
125
125
|
function pe(t, e) {
|
|
126
126
|
return t === e ? t !== 0 || 1 / t === 1 / e : t !== t && e !== e;
|
|
127
127
|
}
|
|
128
|
-
function
|
|
128
|
+
function tn(t) {
|
|
129
129
|
if (t)
|
|
130
130
|
for (; t.finalities.revoke.length > 0; )
|
|
131
131
|
t.finalities.revoke.pop()();
|
|
@@ -166,13 +166,13 @@ function rs(t, e) {
|
|
|
166
166
|
if (Array.isArray(t))
|
|
167
167
|
return Array.prototype.concat.call(t);
|
|
168
168
|
if (t instanceof Set) {
|
|
169
|
-
if (!
|
|
169
|
+
if (!Pn(t)) {
|
|
170
170
|
const r = Object.getPrototypeOf(t).constructor;
|
|
171
171
|
return new r(t.values());
|
|
172
172
|
}
|
|
173
173
|
return Set.prototype.difference ? Set.prototype.difference.call(t, /* @__PURE__ */ new Set()) : new Set(t.values());
|
|
174
174
|
} else if (t instanceof Map) {
|
|
175
|
-
if (!
|
|
175
|
+
if (!In(t)) {
|
|
176
176
|
const r = Object.getPrototypeOf(t).constructor;
|
|
177
177
|
return new r(t);
|
|
178
178
|
}
|
|
@@ -201,7 +201,7 @@ function Q(t) {
|
|
|
201
201
|
}
|
|
202
202
|
function Qe(t) {
|
|
203
203
|
if (!ce(t))
|
|
204
|
-
return
|
|
204
|
+
return Mn(t);
|
|
205
205
|
if (Array.isArray(t))
|
|
206
206
|
return t.map(Qe);
|
|
207
207
|
if (t instanceof Map) {
|
|
@@ -209,7 +209,7 @@ function Qe(t) {
|
|
|
209
209
|
r,
|
|
210
210
|
Qe(s)
|
|
211
211
|
]);
|
|
212
|
-
if (!
|
|
212
|
+
if (!In(t)) {
|
|
213
213
|
const r = Object.getPrototypeOf(t).constructor;
|
|
214
214
|
return new r(n);
|
|
215
215
|
}
|
|
@@ -217,7 +217,7 @@ function Qe(t) {
|
|
|
217
217
|
}
|
|
218
218
|
if (t instanceof Set) {
|
|
219
219
|
const n = Array.from(t).map(Qe);
|
|
220
|
-
if (!
|
|
220
|
+
if (!Pn(t)) {
|
|
221
221
|
const r = Object.getPrototypeOf(t).constructor;
|
|
222
222
|
return new r(n);
|
|
223
223
|
}
|
|
@@ -235,7 +235,7 @@ function fe(t) {
|
|
|
235
235
|
var e;
|
|
236
236
|
t.assignedMap = (e = t.assignedMap) !== null && e !== void 0 ? e : /* @__PURE__ */ new Map(), t.operated || (t.operated = !0, t.parent && fe(t.parent));
|
|
237
237
|
}
|
|
238
|
-
function
|
|
238
|
+
function hr() {
|
|
239
239
|
throw new Error("Cannot modify frozen object");
|
|
240
240
|
}
|
|
241
241
|
function Me(t, e, n, r, s) {
|
|
@@ -263,12 +263,12 @@ function Me(t, e, n, r, s) {
|
|
|
263
263
|
case 2:
|
|
264
264
|
for (const [a, c] of t)
|
|
265
265
|
Me(a, a, n, r, s), Me(c, a, n, r, s);
|
|
266
|
-
t.set = t.clear = t.delete =
|
|
266
|
+
t.set = t.clear = t.delete = hr;
|
|
267
267
|
break;
|
|
268
268
|
case 3:
|
|
269
269
|
for (const a of t)
|
|
270
270
|
Me(a, a, n, r, s);
|
|
271
|
-
t.add = t.clear = t.delete =
|
|
271
|
+
t.add = t.clear = t.delete = hr;
|
|
272
272
|
break;
|
|
273
273
|
case 1:
|
|
274
274
|
Object.freeze(t);
|
|
@@ -284,7 +284,7 @@ function Me(t, e, n, r, s) {
|
|
|
284
284
|
}
|
|
285
285
|
r.pop(), s.pop();
|
|
286
286
|
}
|
|
287
|
-
function
|
|
287
|
+
function jn(t, e) {
|
|
288
288
|
const n = ke(t);
|
|
289
289
|
if (n === 0)
|
|
290
290
|
Reflect.ownKeys(t).forEach((r) => {
|
|
@@ -301,7 +301,7 @@ function ss(t, e, n) {
|
|
|
301
301
|
if (Ae(t) || !ce(t, n) || e.has(t) || Object.isFrozen(t))
|
|
302
302
|
return;
|
|
303
303
|
const r = t instanceof Set, s = r ? /* @__PURE__ */ new Map() : void 0;
|
|
304
|
-
if (e.add(t),
|
|
304
|
+
if (e.add(t), jn(t, (i, o) => {
|
|
305
305
|
var a;
|
|
306
306
|
if (Ae(o)) {
|
|
307
307
|
const c = P(o);
|
|
@@ -321,12 +321,12 @@ function Ei(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 && ss(ye(n, e), t.finalities.handledSet, t.options);
|
|
323
323
|
}
|
|
324
|
-
function
|
|
324
|
+
function nn(t) {
|
|
325
325
|
t.type === 3 && t.copy && (t.copy.clear(), t.setMap.forEach((e) => {
|
|
326
|
-
t.copy.add(
|
|
326
|
+
t.copy.add(Mn(e));
|
|
327
327
|
}));
|
|
328
328
|
}
|
|
329
|
-
function
|
|
329
|
+
function rn(t, e, n, r) {
|
|
330
330
|
if (t.operated && t.assignedMap && t.assignedMap.size > 0 && !t.finalized) {
|
|
331
331
|
if (n && r) {
|
|
332
332
|
const i = ns(t);
|
|
@@ -335,14 +335,14 @@ function nn(t, e, n, r) {
|
|
|
335
335
|
t.finalized = !0;
|
|
336
336
|
}
|
|
337
337
|
}
|
|
338
|
-
function
|
|
338
|
+
function Rn(t, e, n, r) {
|
|
339
339
|
const s = P(n);
|
|
340
340
|
s && (s.callbacks || (s.callbacks = []), s.callbacks.push((i, o) => {
|
|
341
341
|
var a;
|
|
342
342
|
const c = t.type === 3 ? t.setMap : t.copy;
|
|
343
343
|
if (pe(ye(c, e), n)) {
|
|
344
344
|
let u = s.original;
|
|
345
|
-
s.copy && (u = s.copy),
|
|
345
|
+
s.copy && (u = s.copy), nn(t), rn(t, r, i, o), t.options.enableAutoFreeze && (t.options.updatedValues = (a = t.options.updatedValues) !== null && a !== void 0 ? a : /* @__PURE__ */ new WeakMap(), t.options.updatedValues.set(u, s.original)), at(c, e, u);
|
|
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;
|
|
@@ -451,7 +451,7 @@ function ot(t, e, n, r) {
|
|
|
451
451
|
const Et = (t, e, n = !1) => {
|
|
452
452
|
if (typeof t == "object" && t !== null && (!ce(t, e) || n))
|
|
453
453
|
throw new Error("Strict mode: Mutable data cannot be accessed directly, please use 'unsafe(callback)' wrap.");
|
|
454
|
-
},
|
|
454
|
+
}, sn = {
|
|
455
455
|
get size() {
|
|
456
456
|
return te(P(this)).size;
|
|
457
457
|
},
|
|
@@ -460,7 +460,7 @@ const Et = (t, e, n = !1) => {
|
|
|
460
460
|
},
|
|
461
461
|
set(t, e) {
|
|
462
462
|
const n = P(this), r = te(n);
|
|
463
|
-
return (!r.has(t) || !pe(r.get(t), e)) && (Q(n), fe(n), n.assignedMap.set(t, !0), n.copy.set(t, e),
|
|
463
|
+
return (!r.has(t) || !pe(r.get(t), e)) && (Q(n), fe(n), n.assignedMap.set(t, !0), n.copy.set(t, e), Rn(n, t, e, ot)), this;
|
|
464
464
|
},
|
|
465
465
|
delete(t) {
|
|
466
466
|
if (!this.has(t))
|
|
@@ -488,7 +488,7 @@ const Et = (t, e, n = !1) => {
|
|
|
488
488
|
const r = P(this), s = te(r).get(t), i = ((n = (e = r.options).mark) === null || n === void 0 ? void 0 : n.call(e, s, ne)) === ne.mutable;
|
|
489
489
|
if (r.options.strict && Et(s, r.options, i), i || r.finalized || !ce(s, r.options) || s !== r.original.get(t))
|
|
490
490
|
return s;
|
|
491
|
-
const o =
|
|
491
|
+
const o = Cn.createDraft({
|
|
492
492
|
original: s,
|
|
493
493
|
parentDraft: r,
|
|
494
494
|
key: t,
|
|
@@ -532,7 +532,7 @@ const Et = (t, e, n = !1) => {
|
|
|
532
532
|
[_t]() {
|
|
533
533
|
return this.entries();
|
|
534
534
|
}
|
|
535
|
-
}, Ci = Reflect.ownKeys(
|
|
535
|
+
}, Ci = Reflect.ownKeys(sn), pr = (t, e, { isValuesIterator: n }) => () => {
|
|
536
536
|
var r, s;
|
|
537
537
|
const i = e.next();
|
|
538
538
|
if (i.done)
|
|
@@ -541,7 +541,7 @@ const Et = (t, e, n = !1) => {
|
|
|
541
541
|
let a = t.setMap.get(o);
|
|
542
542
|
const c = P(a), u = ((s = (r = t.options).mark) === null || s === void 0 ? void 0 : s.call(r, a, ne)) === ne.mutable;
|
|
543
543
|
if (t.options.strict && Et(o, t.options, u), !u && !c && ce(o, t.options) && !t.finalized && t.original.has(o)) {
|
|
544
|
-
const l =
|
|
544
|
+
const l = Cn.createDraft({
|
|
545
545
|
original: o,
|
|
546
546
|
parentDraft: t,
|
|
547
547
|
key: o,
|
|
@@ -568,7 +568,7 @@ const Et = (t, e, n = !1) => {
|
|
|
568
568
|
},
|
|
569
569
|
add(t) {
|
|
570
570
|
const e = P(this);
|
|
571
|
-
return this.has(t) || (Q(e), fe(e), e.assignedMap.set(t, !0), e.setMap.set(t, t),
|
|
571
|
+
return this.has(t) || (Q(e), fe(e), e.assignedMap.set(t, !0), e.setMap.set(t, t), Rn(e, t, t, ot)), this;
|
|
572
572
|
},
|
|
573
573
|
delete(t) {
|
|
574
574
|
if (!this.has(t))
|
|
@@ -593,7 +593,7 @@ const Et = (t, e, n = !1) => {
|
|
|
593
593
|
const e = t.setMap.keys();
|
|
594
594
|
return {
|
|
595
595
|
[Symbol.iterator]: () => this.values(),
|
|
596
|
-
next:
|
|
596
|
+
next: pr(t, e, { isValuesIterator: !0 })
|
|
597
597
|
};
|
|
598
598
|
},
|
|
599
599
|
entries() {
|
|
@@ -602,7 +602,7 @@ const Et = (t, e, n = !1) => {
|
|
|
602
602
|
const e = t.setMap.keys();
|
|
603
603
|
return {
|
|
604
604
|
[Symbol.iterator]: () => this.entries(),
|
|
605
|
-
next:
|
|
605
|
+
next: pr(t, e, {
|
|
606
606
|
isValuesIterator: !1
|
|
607
607
|
})
|
|
608
608
|
};
|
|
@@ -660,8 +660,8 @@ const Pi = Reflect.ownKeys(Ot), is = /* @__PURE__ */ new WeakSet(), os = {
|
|
|
660
660
|
const a = te(t);
|
|
661
661
|
if (a instanceof Map && Ci.includes(e)) {
|
|
662
662
|
if (e === "size")
|
|
663
|
-
return Object.getOwnPropertyDescriptor(
|
|
664
|
-
const u =
|
|
663
|
+
return Object.getOwnPropertyDescriptor(sn, "size").get.call(t.proxy);
|
|
664
|
+
const u = sn[e];
|
|
665
665
|
if (u)
|
|
666
666
|
return u.bind(t.proxy);
|
|
667
667
|
}
|
|
@@ -673,7 +673,7 @@ const Pi = Reflect.ownKeys(Ot), is = /* @__PURE__ */ new WeakSet(), os = {
|
|
|
673
673
|
return u.bind(t.proxy);
|
|
674
674
|
}
|
|
675
675
|
if (!et(a, e)) {
|
|
676
|
-
const u =
|
|
676
|
+
const u = dr(a, e);
|
|
677
677
|
return u ? "value" in u ? u.value : (
|
|
678
678
|
// !case: support for getter
|
|
679
679
|
(s = u.get) === null || s === void 0 ? void 0 : s.call(t.proxy)
|
|
@@ -683,7 +683,7 @@ const Pi = Reflect.ownKeys(Ot), is = /* @__PURE__ */ new WeakSet(), os = {
|
|
|
683
683
|
if (t.options.strict && Et(c, t.options), t.finalized || !ce(c, t.options))
|
|
684
684
|
return c;
|
|
685
685
|
if (c === Vt(t.original, e)) {
|
|
686
|
-
if (Q(t), t.copy[e] =
|
|
686
|
+
if (Q(t), t.copy[e] = xn({
|
|
687
687
|
original: t.original[e],
|
|
688
688
|
parentDraft: t,
|
|
689
689
|
key: t.type === 1 ? Number(e) : e,
|
|
@@ -704,11 +704,11 @@ const Pi = Reflect.ownKeys(Ot), is = /* @__PURE__ */ new WeakSet(), os = {
|
|
|
704
704
|
let s;
|
|
705
705
|
if (t.type === 1 && e !== "length" && !(Number.isInteger(s = Number(e)) && s >= 0 && (e === 0 || s === 0 || String(s) === String(e))))
|
|
706
706
|
throw new Error("Only supports setting array indices and the 'length' property.");
|
|
707
|
-
const i =
|
|
707
|
+
const i = dr(te(t), e);
|
|
708
708
|
if (i != null && i.set)
|
|
709
709
|
return i.set.call(t.proxy, n), !0;
|
|
710
710
|
const o = Vt(te(t), e), a = P(o);
|
|
711
|
-
return a && pe(a.original, n) ? (t.copy[e] = n, t.assignedMap = (r = t.assignedMap) !== null && r !== void 0 ? r : /* @__PURE__ */ new Map(), t.assignedMap.set(e, !1), !0) : (pe(n, o) && (n !== void 0 || et(t.original, e)) || (Q(t), fe(t), et(t.original, e) && pe(n, t.original[e]) ? t.assignedMap.delete(e) : t.assignedMap.set(e, !0), t.copy[e] = n,
|
|
711
|
+
return a && pe(a.original, n) ? (t.copy[e] = n, t.assignedMap = (r = t.assignedMap) !== null && r !== void 0 ? r : /* @__PURE__ */ new Map(), t.assignedMap.set(e, !1), !0) : (pe(n, o) && (n !== void 0 || et(t.original, e)) || (Q(t), fe(t), et(t.original, e) && pe(n, t.original[e]) ? t.assignedMap.delete(e) : t.assignedMap.set(e, !0), t.copy[e] = n, Rn(t, e, n, ot)), !0);
|
|
712
712
|
},
|
|
713
713
|
has(t, e) {
|
|
714
714
|
return e in te(t);
|
|
@@ -739,7 +739,7 @@ const Pi = Reflect.ownKeys(Ot), is = /* @__PURE__ */ new WeakSet(), os = {
|
|
|
739
739
|
return t.type === 1 ? os.set.call(this, t, e, void 0, t.proxy) : (Vt(t.original, e) !== void 0 || e in t.original ? (Q(t), fe(t), t.assignedMap.set(e, !1)) : (t.assignedMap = (n = t.assignedMap) !== null && n !== void 0 ? n : /* @__PURE__ */ new Map(), t.assignedMap.delete(e)), t.copy && delete t.copy[e], !0);
|
|
740
740
|
}
|
|
741
741
|
};
|
|
742
|
-
function
|
|
742
|
+
function xn(t) {
|
|
743
743
|
const { original: e, parentDraft: n, key: r, finalities: s, options: i } = t, o = ke(e), a = {
|
|
744
744
|
type: o,
|
|
745
745
|
finalized: !1,
|
|
@@ -763,7 +763,7 @@ function Rn(t) {
|
|
|
763
763
|
const m = ye(w, r), _ = P(m);
|
|
764
764
|
if (_) {
|
|
765
765
|
let S = _.original;
|
|
766
|
-
_.operated && (S =
|
|
766
|
+
_.operated && (S = Mn(m)), nn(_), rn(_, ot, f, h), l.options.enableAutoFreeze && (l.options.updatedValues = (y = l.options.updatedValues) !== null && y !== void 0 ? y : /* @__PURE__ */ new WeakMap(), l.options.updatedValues.set(S, _.original)), at(w, r, S);
|
|
767
767
|
}
|
|
768
768
|
(b = g.callbacks) === null || b === void 0 || b.forEach((S) => {
|
|
769
769
|
S(f, h);
|
|
@@ -772,12 +772,12 @@ function Rn(t) {
|
|
|
772
772
|
} else {
|
|
773
773
|
const l = P(c);
|
|
774
774
|
l.finalities.draft.push((f, h) => {
|
|
775
|
-
|
|
775
|
+
nn(l), rn(l, ot, f, h);
|
|
776
776
|
});
|
|
777
777
|
}
|
|
778
778
|
return c;
|
|
779
779
|
}
|
|
780
|
-
|
|
780
|
+
Cn.createDraft = xn;
|
|
781
781
|
function Ii(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;
|
|
@@ -785,7 +785,7 @@ function Ii(t, e, n, r, s) {
|
|
|
785
785
|
for (; o.finalities.draft.length > 0; )
|
|
786
786
|
o.finalities.draft.pop()(n, r);
|
|
787
787
|
const u = c ? e[0] : o ? o.operated ? o.copy : o.original : t;
|
|
788
|
-
return o &&
|
|
788
|
+
return o && tn(o), s && Me(u, u, o == null ? void 0 : o.options.updatedValues), [
|
|
789
789
|
u,
|
|
790
790
|
n && c ? [{ op: U.Replace, path: [], value: e[0] }] : n,
|
|
791
791
|
r && c ? [{ op: U.Replace, path: [], value: a }] : r
|
|
@@ -800,7 +800,7 @@ function Mi(t, e) {
|
|
|
800
800
|
};
|
|
801
801
|
let s, i;
|
|
802
802
|
e.enablePatches && (s = [], i = []);
|
|
803
|
-
const a = ((n = e.mark) === null || n === void 0 ? void 0 : n.call(e, t, ne)) === ne.mutable || !ce(t, e) ? t :
|
|
803
|
+
const a = ((n = e.mark) === null || n === void 0 ? void 0 : n.call(e, t, ne)) === ne.mutable || !ce(t, e) ? t : xn({
|
|
804
804
|
original: t,
|
|
805
805
|
parentDraft: null,
|
|
806
806
|
finalities: r,
|
|
@@ -814,9 +814,9 @@ function Mi(t, e) {
|
|
|
814
814
|
}
|
|
815
815
|
];
|
|
816
816
|
}
|
|
817
|
-
function
|
|
817
|
+
function on(t) {
|
|
818
818
|
const { rootDraft: e, value: n, useRawReturn: r = !1, isRoot: s = !0 } = t;
|
|
819
|
-
|
|
819
|
+
jn(n, (i, o, a) => {
|
|
820
820
|
const c = P(o);
|
|
821
821
|
if (c && e && c.finalities === e.finalities) {
|
|
822
822
|
t.isContainDraft = !0;
|
|
@@ -826,7 +826,7 @@ function sn(t) {
|
|
|
826
826
|
a.clear(), l.forEach((f) => a.add(i === f ? u : f));
|
|
827
827
|
} else
|
|
828
828
|
at(a, i, u);
|
|
829
|
-
} else typeof o == "object" && o !== null && (t.value = o, t.isRoot = !1,
|
|
829
|
+
} else typeof o == "object" && o !== null && (t.value = o, t.isRoot = !1, on(t));
|
|
830
830
|
}), s && (t.isContainDraft || console.warn("The return value does not contain any draft, please use 'rawReturn()' to wrap the return value to improve performance."), r && console.warn("The return value contains drafts, please don't use 'rawReturn()' to wrap the return value."));
|
|
831
831
|
}
|
|
832
832
|
function as(t) {
|
|
@@ -839,7 +839,7 @@ function as(t) {
|
|
|
839
839
|
return n.original;
|
|
840
840
|
let s;
|
|
841
841
|
function i() {
|
|
842
|
-
s = r === 2 ?
|
|
842
|
+
s = r === 2 ? In(t) ? new Map(t) : new (Object.getPrototypeOf(t)).constructor(t) : r === 3 ? Array.from(n.setMap.values()) : rs(t, n == null ? void 0 : n.options);
|
|
843
843
|
}
|
|
844
844
|
if (n) {
|
|
845
845
|
n.finalized = !0;
|
|
@@ -850,18 +850,18 @@ function as(t) {
|
|
|
850
850
|
}
|
|
851
851
|
} else
|
|
852
852
|
s = t;
|
|
853
|
-
if (
|
|
853
|
+
if (jn(s, (o, a) => {
|
|
854
854
|
if (n && pe(ye(n.original, o), a))
|
|
855
855
|
return;
|
|
856
856
|
const c = as(a);
|
|
857
857
|
c !== a && (s === t && i(), at(s, o, c));
|
|
858
858
|
}), r === 3) {
|
|
859
859
|
const o = (e = n == null ? void 0 : n.original) !== null && e !== void 0 ? e : s;
|
|
860
|
-
return
|
|
860
|
+
return Pn(o) ? new Set(s) : new (Object.getPrototypeOf(o)).constructor(s);
|
|
861
861
|
}
|
|
862
862
|
return s;
|
|
863
863
|
}
|
|
864
|
-
function
|
|
864
|
+
function yr(t) {
|
|
865
865
|
if (!Ae(t))
|
|
866
866
|
throw new Error(`current() is only used for Draft, parameter: ${t}`);
|
|
867
867
|
return as(t);
|
|
@@ -877,7 +877,7 @@ const ji = (t) => function e(n, r, s) {
|
|
|
877
877
|
if (typeof r != "function" && (l = r), l !== void 0 && Object.prototype.toString.call(l) !== "[object Object]")
|
|
878
878
|
throw new Error(`Invalid options: ${l}, 'options' should be an object.`);
|
|
879
879
|
l = Object.assign(Object.assign({}, t), l);
|
|
880
|
-
const f = Ae(c) ?
|
|
880
|
+
const f = Ae(c) ? yr(c) : c, h = Array.isArray(l.mark) ? (E, j) => {
|
|
881
881
|
for (const L of l.mark) {
|
|
882
882
|
if (typeof L != "function")
|
|
883
883
|
throw new Error(`Invalid mark: ${L}, 'mark' should be a function.`);
|
|
@@ -903,7 +903,7 @@ const ji = (t) => function e(n, r, s) {
|
|
|
903
903
|
try {
|
|
904
904
|
S = u(m);
|
|
905
905
|
} catch (E) {
|
|
906
|
-
throw
|
|
906
|
+
throw tn(P(m)), E;
|
|
907
907
|
}
|
|
908
908
|
const O = (E) => {
|
|
909
909
|
const j = P(m);
|
|
@@ -913,14 +913,14 @@ const ji = (t) => function e(n, r, s) {
|
|
|
913
913
|
const B = E == null ? void 0 : E[Ti];
|
|
914
914
|
if (B) {
|
|
915
915
|
const qe = B[0];
|
|
916
|
-
return w.strict && typeof E == "object" && E !== null &&
|
|
916
|
+
return w.strict && typeof E == "object" && E !== null && on({
|
|
917
917
|
rootDraft: j,
|
|
918
918
|
value: E,
|
|
919
919
|
useRawReturn: !0
|
|
920
920
|
}), _([qe]);
|
|
921
921
|
}
|
|
922
922
|
if (E !== void 0)
|
|
923
|
-
return typeof E == "object" && E !== null &&
|
|
923
|
+
return typeof E == "object" && E !== null && on({ rootDraft: j, value: E }), _([E]);
|
|
924
924
|
}
|
|
925
925
|
if (E === m || E === void 0)
|
|
926
926
|
return _([]);
|
|
@@ -928,12 +928,12 @@ const ji = (t) => function e(n, r, s) {
|
|
|
928
928
|
if (w === L.options) {
|
|
929
929
|
if (L.operated)
|
|
930
930
|
throw new Error("Cannot return a modified child draft.");
|
|
931
|
-
return _([
|
|
931
|
+
return _([yr(E)]);
|
|
932
932
|
}
|
|
933
933
|
return _([E]);
|
|
934
934
|
};
|
|
935
935
|
return S instanceof Promise ? S.then(O, (E) => {
|
|
936
|
-
throw
|
|
936
|
+
throw tn(P(m)), E;
|
|
937
937
|
}) : O(S);
|
|
938
938
|
}, At = ji();
|
|
939
939
|
Object.prototype.constructor.toString();
|
|
@@ -941,13 +941,13 @@ function cs(t, e) {
|
|
|
941
941
|
const n = Object.keys(t), r = Object.keys(e);
|
|
942
942
|
return n.length === r.length && Object.keys(t).every((s) => e.hasOwnProperty(s));
|
|
943
943
|
}
|
|
944
|
-
function
|
|
944
|
+
function br(t, e) {
|
|
945
945
|
return Object.keys(t).length === Object.keys(e).length && Object.keys(t).every((n) => e.hasOwnProperty(n) && t[n] === e[n]);
|
|
946
946
|
}
|
|
947
947
|
function Tt(t, e) {
|
|
948
948
|
return typeof t != "object" || typeof e != "object" || t === null || e === null ? t === e : cs(t, e) ? Object.keys(t).every((n) => Tt(t[n], e[n])) : !1;
|
|
949
949
|
}
|
|
950
|
-
function
|
|
950
|
+
function $n(t) {
|
|
951
951
|
if (!He(t))
|
|
952
952
|
return t;
|
|
953
953
|
const e = {};
|
|
@@ -985,7 +985,7 @@ function Ri(t, e, n) {
|
|
|
985
985
|
const s = e[e.length - 1];
|
|
986
986
|
Array.isArray(r) && typeof s == "number" ? r.splice(s, 0, n) : r[s] = n;
|
|
987
987
|
}
|
|
988
|
-
function
|
|
988
|
+
function gr(t, e, n) {
|
|
989
989
|
if (!t || e.length === 0)
|
|
990
990
|
return;
|
|
991
991
|
let r = t || {};
|
|
@@ -1010,7 +1010,7 @@ function ls(t, e) {
|
|
|
1010
1010
|
function xi(t) {
|
|
1011
1011
|
return t && Object.keys(t).length === 0;
|
|
1012
1012
|
}
|
|
1013
|
-
const
|
|
1013
|
+
const _r = /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$/, $i = {
|
|
1014
1014
|
ZULU: 0,
|
|
1015
1015
|
YEKT: 18e3,
|
|
1016
1016
|
YEKST: 21600,
|
|
@@ -1274,10 +1274,10 @@ function Gi(t) {
|
|
|
1274
1274
|
}
|
|
1275
1275
|
}
|
|
1276
1276
|
function Qi(t) {
|
|
1277
|
-
const e = t.match(
|
|
1277
|
+
const e = t.match(_r);
|
|
1278
1278
|
if (!e)
|
|
1279
1279
|
return null;
|
|
1280
|
-
const [n] = e, r = $i[n], s = new Date(t.replace(
|
|
1280
|
+
const [n] = e, r = $i[n], s = new Date(t.replace(_r, "Z"));
|
|
1281
1281
|
return new Date(s.getTime() - r * 1e3);
|
|
1282
1282
|
}
|
|
1283
1283
|
const Hi = [
|
|
@@ -1302,7 +1302,7 @@ function Ji(t, e) {
|
|
|
1302
1302
|
return null;
|
|
1303
1303
|
}
|
|
1304
1304
|
}
|
|
1305
|
-
function
|
|
1305
|
+
function an(t) {
|
|
1306
1306
|
for (const e of Hi) {
|
|
1307
1307
|
const n = Ji(e, t);
|
|
1308
1308
|
if (n)
|
|
@@ -1313,7 +1313,7 @@ function on(t) {
|
|
|
1313
1313
|
function Yi(t) {
|
|
1314
1314
|
try {
|
|
1315
1315
|
const e = JSON.parse(t);
|
|
1316
|
-
return typeof e == "string" ?
|
|
1316
|
+
return typeof e == "string" ? an(e) : null;
|
|
1317
1317
|
} catch {
|
|
1318
1318
|
return null;
|
|
1319
1319
|
}
|
|
@@ -1325,7 +1325,7 @@ function It(t) {
|
|
|
1325
1325
|
if (t instanceof Date)
|
|
1326
1326
|
return t;
|
|
1327
1327
|
if (typeof t == "string") {
|
|
1328
|
-
const e =
|
|
1328
|
+
const e = an(t) || Yi(t) || an(t.trim());
|
|
1329
1329
|
if (!e)
|
|
1330
1330
|
throw new Error(`Unable to parse \`${t}\` as a date.`);
|
|
1331
1331
|
return e;
|
|
@@ -1365,7 +1365,7 @@ class Ee {
|
|
|
1365
1365
|
return this._blobAttrs;
|
|
1366
1366
|
this._blobAttrs = /* @__PURE__ */ new Map();
|
|
1367
1367
|
for (const e of Object.values(this.attrs))
|
|
1368
|
-
if (
|
|
1368
|
+
if (Un(e)) {
|
|
1369
1369
|
const [n, r, s] = e["forward-identity"];
|
|
1370
1370
|
Z(this.blobAttrs, [r, s], e);
|
|
1371
1371
|
}
|
|
@@ -1412,10 +1412,10 @@ class Ee {
|
|
|
1412
1412
|
function Zi(t) {
|
|
1413
1413
|
return t.cardinality === "one";
|
|
1414
1414
|
}
|
|
1415
|
-
function
|
|
1415
|
+
function Dn(t) {
|
|
1416
1416
|
return t["value-type"] === "ref";
|
|
1417
1417
|
}
|
|
1418
|
-
function
|
|
1418
|
+
function Un(t) {
|
|
1419
1419
|
return t["value-type"] === "blob";
|
|
1420
1420
|
}
|
|
1421
1421
|
function Ke(t, e) {
|
|
@@ -1450,7 +1450,7 @@ function fs(t, e, n) {
|
|
|
1450
1450
|
console.warn("no such attr", c, a);
|
|
1451
1451
|
continue;
|
|
1452
1452
|
}
|
|
1453
|
-
l["checked-data-type"] === "date" && n && (u = It(u), o[2] = u),
|
|
1453
|
+
l["checked-data-type"] === "date" && n && (u = It(u), o[2] = u), Dn(l) && Z(i, [u, c, a], o), Z(r, [a, c, u], o), Z(s, [c, a, u], o);
|
|
1454
1454
|
}
|
|
1455
1455
|
return { eav: r, aev: s, vae: i };
|
|
1456
1456
|
}
|
|
@@ -1510,7 +1510,7 @@ function ys(t, e, n) {
|
|
|
1510
1510
|
if (!r)
|
|
1511
1511
|
return;
|
|
1512
1512
|
const [s, i, o] = r, a = e.getAttr(i);
|
|
1513
|
-
a && (ae(t.eav, [s, i, o]), ae(t.aev, [i, s, o]),
|
|
1513
|
+
a && (ae(t.eav, [s, i, o]), ae(t.aev, [i, s, o]), Dn(a) && ae(t.vae, [o, i, s]));
|
|
1514
1514
|
}
|
|
1515
1515
|
let eo = 0;
|
|
1516
1516
|
function bs(t, e, n) {
|
|
@@ -1529,7 +1529,7 @@ function gs(t, e, n) {
|
|
|
1529
1529
|
return;
|
|
1530
1530
|
a["checked-data-type"] === "date" && t.useDateObjects && (o = It(o));
|
|
1531
1531
|
const c = Ke(t.eav, [s, i, o]), u = (c == null ? void 0 : c[3]) ?? bs(t, a, r), l = [s, i, o, u];
|
|
1532
|
-
Zi(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)),
|
|
1532
|
+
Zi(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)), Dn(a) && Z(t.vae, [o, i, s], l);
|
|
1533
1533
|
}
|
|
1534
1534
|
function to(t, e, n) {
|
|
1535
1535
|
var y;
|
|
@@ -1539,7 +1539,7 @@ function to(t, e, n) {
|
|
|
1539
1539
|
const [s, i, o] = r, a = e.getAttr(i);
|
|
1540
1540
|
if (!a)
|
|
1541
1541
|
return;
|
|
1542
|
-
if (!
|
|
1542
|
+
if (!Un(a))
|
|
1543
1543
|
throw new Error("merge operation is not supported for links");
|
|
1544
1544
|
const c = Ke(t.eav, [s, i]);
|
|
1545
1545
|
if (!c)
|
|
@@ -1555,7 +1555,7 @@ function to(t, e, n) {
|
|
|
1555
1555
|
];
|
|
1556
1556
|
Z(t.eav, [s, i], /* @__PURE__ */ new Map([[f, h]])), Z(t.aev, [i, s], /* @__PURE__ */ new Map([[f, h]]));
|
|
1557
1557
|
}
|
|
1558
|
-
function
|
|
1558
|
+
function cn(t, e, n) {
|
|
1559
1559
|
var u, l;
|
|
1560
1560
|
const [r, s] = n, i = ct(t, [r]);
|
|
1561
1561
|
if (!i)
|
|
@@ -1566,7 +1566,7 @@ function an(t, e, n) {
|
|
|
1566
1566
|
const h = e.getAttr(f);
|
|
1567
1567
|
h && h["on-delete-reverse"] === "cascade" && X(a.get(f), 1).forEach(([y, b, g]) => {
|
|
1568
1568
|
var w;
|
|
1569
|
-
return
|
|
1569
|
+
return cn(t, e, [g, (w = h["reverse-identity"]) == null ? void 0 : w[1]]);
|
|
1570
1570
|
}), // Fall back to deleting everything if we've rehydrated tx-steps from
|
|
1571
1571
|
// the store that didn't set `etype` in deleteEntity
|
|
1572
1572
|
(!s || // If we don't know about the attr, let's just get rid of it
|
|
@@ -1579,7 +1579,7 @@ function an(t, e, n) {
|
|
|
1579
1579
|
c && c.forEach((f) => {
|
|
1580
1580
|
var w, m, _;
|
|
1581
1581
|
const [h, y, b] = f, g = e.getAttr(y);
|
|
1582
|
-
(!s || !g || ((w = g["reverse-identity"]) == null ? void 0 : w[1]) === s) && (ae(t.eav, [h, y, b]), ae(t.aev, [y, h, b]), ae(t.vae, [b, y, h])), g && g["on-delete"] === "cascade" && ((m = g["reverse-identity"]) == null ? void 0 : m[1]) === s &&
|
|
1582
|
+
(!s || !g || ((w = g["reverse-identity"]) == null ? void 0 : w[1]) === s) && (ae(t.eav, [h, y, b]), ae(t.aev, [y, h, b]), ae(t.vae, [b, y, h])), g && g["on-delete"] === "cascade" && ((m = g["reverse-identity"]) == null ? void 0 : m[1]) === s && cn(t, e, [h, (_ = g["forward-identity"]) == null ? void 0 : _[1]]);
|
|
1583
1583
|
}), ((l = t.vae.get(o)) == null ? void 0 : l.size) === 0 && ae(t.vae, [o]);
|
|
1584
1584
|
}
|
|
1585
1585
|
function _s(t, e, n) {
|
|
@@ -1616,7 +1616,7 @@ function io(t, e, n) {
|
|
|
1616
1616
|
ys(t, e, s);
|
|
1617
1617
|
break;
|
|
1618
1618
|
case "delete-entity":
|
|
1619
|
-
|
|
1619
|
+
cn(t, e, s);
|
|
1620
1620
|
break;
|
|
1621
1621
|
case "add-attr":
|
|
1622
1622
|
no(e, s);
|
|
@@ -1808,15 +1808,15 @@ function po(t, e, n) {
|
|
|
1808
1808
|
}
|
|
1809
1809
|
return { ...n, [t]: e };
|
|
1810
1810
|
}
|
|
1811
|
-
function
|
|
1811
|
+
function wr(t, e, n) {
|
|
1812
1812
|
return t === e ? n : null;
|
|
1813
1813
|
}
|
|
1814
1814
|
function yo(t) {
|
|
1815
1815
|
switch (typeof t) {
|
|
1816
1816
|
case "string":
|
|
1817
|
-
return t.startsWith("?") ? po :
|
|
1817
|
+
return t.startsWith("?") ? po : wr;
|
|
1818
1818
|
default:
|
|
1819
|
-
return
|
|
1819
|
+
return wr;
|
|
1820
1820
|
}
|
|
1821
1821
|
}
|
|
1822
1822
|
const bo = [
|
|
@@ -1846,19 +1846,19 @@ function wo(t, e, n) {
|
|
|
1846
1846
|
return So(t, e, n).map((r) => _o(e, r, n)).filter((r) => r);
|
|
1847
1847
|
}
|
|
1848
1848
|
function To(t, e, n) {
|
|
1849
|
-
return e.or ? e.or.patterns.flatMap((r) =>
|
|
1849
|
+
return e.or ? e.or.patterns.flatMap((r) => un(t, r, n)) : e.and ? e.and.patterns.reduce((r, s) => un(t, s, r), n) : n.flatMap((r) => wo(t, e, r));
|
|
1850
1850
|
}
|
|
1851
|
-
function
|
|
1851
|
+
function un(t, e, n = [{}]) {
|
|
1852
1852
|
return e.reduce((r, s) => To(t, s, r), n);
|
|
1853
1853
|
}
|
|
1854
|
-
function
|
|
1855
|
-
return Array.isArray(e) ? e.map((n) =>
|
|
1854
|
+
function Ln(t, e) {
|
|
1855
|
+
return Array.isArray(e) ? e.map((n) => Ln(t, n)) : ho(e) ? t[e] : e;
|
|
1856
1856
|
}
|
|
1857
1857
|
function mo(t, { find: e, where: n }) {
|
|
1858
|
-
return
|
|
1858
|
+
return un(t, n).map((s) => Ln(s, e));
|
|
1859
1859
|
}
|
|
1860
1860
|
function So(t, e, n) {
|
|
1861
|
-
return ao(t,
|
|
1861
|
+
return ao(t, Ln(n, e));
|
|
1862
1862
|
}
|
|
1863
1863
|
const vo = /^(?:[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 Le(t) {
|
|
@@ -1880,18 +1880,18 @@ function Ao() {
|
|
|
1880
1880
|
}
|
|
1881
1881
|
return Bt(Oo);
|
|
1882
1882
|
}
|
|
1883
|
-
const ko = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto),
|
|
1883
|
+
const ko = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), Tr = { randomUUID: ko };
|
|
1884
1884
|
function Co(t, e, n) {
|
|
1885
1885
|
var s;
|
|
1886
|
-
if (
|
|
1887
|
-
return
|
|
1886
|
+
if (Tr.randomUUID && !t)
|
|
1887
|
+
return Tr.randomUUID();
|
|
1888
1888
|
t = t || {};
|
|
1889
1889
|
const r = t.random ?? ((s = t.rng) == null ? void 0 : s.call(t)) ?? Ao();
|
|
1890
1890
|
if (r.length < 16)
|
|
1891
1891
|
throw new Error("Random bytes length must be >= 16");
|
|
1892
1892
|
return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128, Eo(r);
|
|
1893
1893
|
}
|
|
1894
|
-
function
|
|
1894
|
+
function mr(t) {
|
|
1895
1895
|
const e = t.replace(/-/g, ""), n = [];
|
|
1896
1896
|
for (let r = 0; r < e.length; r += 2)
|
|
1897
1897
|
n.push(parseInt(e.substring(r, r + 2), 16));
|
|
@@ -1907,7 +1907,7 @@ function Po(t, e) {
|
|
|
1907
1907
|
return 0;
|
|
1908
1908
|
}
|
|
1909
1909
|
function Io(t, e) {
|
|
1910
|
-
return Po(
|
|
1910
|
+
return Po(mr(t), mr(e));
|
|
1911
1911
|
}
|
|
1912
1912
|
function W() {
|
|
1913
1913
|
return Co();
|
|
@@ -1943,7 +1943,7 @@ function $o(t, e) {
|
|
|
1943
1943
|
throw new Fe(`Could not find id attr for ${e}`);
|
|
1944
1944
|
return n;
|
|
1945
1945
|
}
|
|
1946
|
-
function
|
|
1946
|
+
function Sr(t, e, n, r) {
|
|
1947
1947
|
return [Do(t, e, n, r)];
|
|
1948
1948
|
}
|
|
1949
1949
|
function Do(t, e, n, r) {
|
|
@@ -1976,7 +1976,7 @@ function Ss(t, e, n, r, s) {
|
|
|
1976
1976
|
];
|
|
1977
1977
|
return [i ? f : u, h, y, a, !!i];
|
|
1978
1978
|
}
|
|
1979
|
-
function
|
|
1979
|
+
function vr(t, e) {
|
|
1980
1980
|
if (typeof e != "string")
|
|
1981
1981
|
return function(o) {
|
|
1982
1982
|
return !1;
|
|
@@ -2027,7 +2027,7 @@ function Lo(t, e) {
|
|
|
2027
2027
|
}
|
|
2028
2028
|
};
|
|
2029
2029
|
if (e.hasOwnProperty("$like")) {
|
|
2030
|
-
const r =
|
|
2030
|
+
const r = vr(!0, e.$like);
|
|
2031
2031
|
return {
|
|
2032
2032
|
$comparator: !0,
|
|
2033
2033
|
$op: function(i) {
|
|
@@ -2036,7 +2036,7 @@ function Lo(t, e) {
|
|
|
2036
2036
|
};
|
|
2037
2037
|
}
|
|
2038
2038
|
if (e.hasOwnProperty("$ilike")) {
|
|
2039
|
-
const r =
|
|
2039
|
+
const r = vr(!1, e.$ilike);
|
|
2040
2040
|
return {
|
|
2041
2041
|
$comparator: !0,
|
|
2042
2042
|
$op: function(i) {
|
|
@@ -2075,7 +2075,7 @@ function No(t, e, n, r, s) {
|
|
|
2075
2075
|
}, [n, r, []]);
|
|
2076
2076
|
return [i, o, a];
|
|
2077
2077
|
}
|
|
2078
|
-
function
|
|
2078
|
+
function ln(t, e, n, r, s, i) {
|
|
2079
2079
|
const o = s.slice(0, s.length - 1), a = s[s.length - 1], [c, u, l] = No(t, e, n, r, o), f = Fo(t, e, c, u, a, i);
|
|
2080
2080
|
return l.concat([f]);
|
|
2081
2081
|
}
|
|
@@ -2094,7 +2094,7 @@ function zo(t, e, n) {
|
|
|
2094
2094
|
return e == i ? i : `${i}-${n}`;
|
|
2095
2095
|
};
|
|
2096
2096
|
}
|
|
2097
|
-
function
|
|
2097
|
+
function Er(t, e, n, r, s, i) {
|
|
2098
2098
|
const o = t(r, s), a = i.map((c, u) => {
|
|
2099
2099
|
const l = zo(t, o, u);
|
|
2100
2100
|
return vs(l, n, r, s, c);
|
|
@@ -2107,22 +2107,22 @@ function Vo(t) {
|
|
|
2107
2107
|
e.push(t.slice(0, n));
|
|
2108
2108
|
return e;
|
|
2109
2109
|
}
|
|
2110
|
-
function
|
|
2111
|
-
return Vo(s).map((i) =>
|
|
2110
|
+
function Or(t, e, n, r, s) {
|
|
2111
|
+
return Vo(s).map((i) => ln(t, e, n, r, i, {
|
|
2112
2112
|
$isNull: !0
|
|
2113
2113
|
}));
|
|
2114
2114
|
}
|
|
2115
2115
|
function vs(t, e, n, r, s) {
|
|
2116
2116
|
return Object.entries(s).flatMap(([i, o]) => {
|
|
2117
2117
|
if (qo([i, o]))
|
|
2118
|
-
return
|
|
2118
|
+
return Er(t, "or", e, n, r, o);
|
|
2119
2119
|
if (Wo([i, o]))
|
|
2120
|
-
return
|
|
2120
|
+
return Er(t, "and", e, n, r, o);
|
|
2121
2121
|
if (i === "$entityIdStartsWith")
|
|
2122
2122
|
return [];
|
|
2123
2123
|
const a = i.split(".");
|
|
2124
2124
|
if (o != null && o.hasOwnProperty("$ne") && (o = { ...o, $not: o.$ne }, delete o.$ne), o != null && o.hasOwnProperty("$not")) {
|
|
2125
|
-
const c =
|
|
2125
|
+
const c = ln(t, e, n, r, a, o), u = Or(t, e, n, r, a);
|
|
2126
2126
|
return [
|
|
2127
2127
|
{
|
|
2128
2128
|
or: {
|
|
@@ -2135,16 +2135,16 @@ function vs(t, e, n, r, s) {
|
|
|
2135
2135
|
return o != null && o.hasOwnProperty("$isNull") && o.$isNull === !0 && a.length > 1 ? [
|
|
2136
2136
|
{
|
|
2137
2137
|
or: {
|
|
2138
|
-
patterns:
|
|
2138
|
+
patterns: Or(t, e, n, r, a),
|
|
2139
2139
|
joinSym: t(n, r)
|
|
2140
2140
|
}
|
|
2141
2141
|
}
|
|
2142
|
-
] :
|
|
2142
|
+
] : ln(t, e, n, r, a, o);
|
|
2143
2143
|
});
|
|
2144
2144
|
}
|
|
2145
2145
|
function Bo(t, e, n, r) {
|
|
2146
2146
|
const s = Mt;
|
|
2147
|
-
return r ? vs(s, t, e, n, r).concat(
|
|
2147
|
+
return r ? vs(s, t, e, n, r).concat(Sr(s, t, e, n)) : Sr(s, t, e, n);
|
|
2148
2148
|
}
|
|
2149
2149
|
function Go(t, e, n) {
|
|
2150
2150
|
return [t(e, n), t("time", n)];
|
|
@@ -2186,7 +2186,7 @@ function Ye(t, e, n, r, s) {
|
|
|
2186
2186
|
function kt([t, e], [n, r], s) {
|
|
2187
2187
|
return Ye(t, e, n, r, s);
|
|
2188
2188
|
}
|
|
2189
|
-
function
|
|
2189
|
+
function fn(t) {
|
|
2190
2190
|
return t == null ? t : new Date(t).getTime();
|
|
2191
2191
|
}
|
|
2192
2192
|
function Yo(t, e, n, r) {
|
|
@@ -2194,7 +2194,7 @@ function Yo(t, e, n, r) {
|
|
|
2194
2194
|
const [s, i, o, a] = t, c = n === "desc" ? 1 : -1;
|
|
2195
2195
|
if (((b = e["forward-identity"]) == null ? void 0 : b[2]) === "id")
|
|
2196
2196
|
return kt(r, [s, a], null) === c;
|
|
2197
|
-
const [u, l] = r, f = e["checked-data-type"], h = f === "date" ?
|
|
2197
|
+
const [u, l] = r, f = e["checked-data-type"], h = f === "date" ? fn(l) : l, y = f === "date" ? fn(o) : o;
|
|
2198
2198
|
return kt([u, h], [s, y], f) === c;
|
|
2199
2199
|
}
|
|
2200
2200
|
function Zo(t, e) {
|
|
@@ -2218,7 +2218,7 @@ function ta(t, e, n) {
|
|
|
2218
2218
|
const r = /* @__PURE__ */ new Map();
|
|
2219
2219
|
for (const o of n.fields) {
|
|
2220
2220
|
const a = N(t, e, o), c = (s = a == null ? void 0 : a["forward-identity"]) == null ? void 0 : s[2];
|
|
2221
|
-
c &&
|
|
2221
|
+
c && Un(a) && r.set(c, a);
|
|
2222
2222
|
}
|
|
2223
2223
|
if (!r.has("id")) {
|
|
2224
2224
|
const o = N(t, e, "id"), a = (i = o == null ? void 0 : o["forward-identity"]) == null ? void 0 : i[2];
|
|
@@ -2236,7 +2236,7 @@ function na(t, e, { etype: n, pageInfo: r, dq: s, form: i }) {
|
|
|
2236
2236
|
u = u.map(([_]) => {
|
|
2237
2237
|
var O, E, j, L, B;
|
|
2238
2238
|
let S = (B = (L = (j = (E = (O = t.eav.get(_)) == null ? void 0 : O.get(m)) == null ? void 0 : E.values()) == null ? void 0 : j.next()) == null ? void 0 : L.value) == null ? void 0 : B[2];
|
|
2239
|
-
return w && (S =
|
|
2239
|
+
return w && (S = fn(S)), [_, S];
|
|
2240
2240
|
});
|
|
2241
2241
|
}
|
|
2242
2242
|
u.sort(c === "asc" ? function(m, _) {
|
|
@@ -2332,7 +2332,7 @@ function aa() {
|
|
|
2332
2332
|
return new Set(Object.keys(e));
|
|
2333
2333
|
}
|
|
2334
2334
|
const ca = aa();
|
|
2335
|
-
function
|
|
2335
|
+
function dn(t, e, n) {
|
|
2336
2336
|
const r = {
|
|
2337
2337
|
__etype: t,
|
|
2338
2338
|
__ops: n
|
|
@@ -2344,7 +2344,7 @@ function fn(t, e, n) {
|
|
|
2344
2344
|
if (i === "__etype")
|
|
2345
2345
|
return t;
|
|
2346
2346
|
if (ca.has(i))
|
|
2347
|
-
return (o, a) =>
|
|
2347
|
+
return (o, a) => dn(t, e, [
|
|
2348
2348
|
...n,
|
|
2349
2349
|
a ? [i, t, e, o, a] : [i, t, e, o]
|
|
2350
2350
|
]);
|
|
@@ -2369,18 +2369,18 @@ function ua(t) {
|
|
|
2369
2369
|
if (n === "__etype")
|
|
2370
2370
|
return t;
|
|
2371
2371
|
const r = n;
|
|
2372
|
-
return Ct(r) ?
|
|
2372
|
+
return Ct(r) ? dn(t, ks(r), []) : dn(t, r, []);
|
|
2373
2373
|
}
|
|
2374
2374
|
});
|
|
2375
2375
|
}
|
|
2376
|
-
function
|
|
2376
|
+
function Fn() {
|
|
2377
2377
|
return new Proxy({}, {
|
|
2378
2378
|
get(t, e) {
|
|
2379
2379
|
return ua(e);
|
|
2380
2380
|
}
|
|
2381
2381
|
});
|
|
2382
2382
|
}
|
|
2383
|
-
const Mu =
|
|
2383
|
+
const Mu = Fn();
|
|
2384
2384
|
function la(t) {
|
|
2385
2385
|
return t.__ops;
|
|
2386
2386
|
}
|
|
@@ -2416,7 +2416,7 @@ function ha(t, e, n) {
|
|
|
2416
2416
|
// before assuming it's a ref lookup.
|
|
2417
2417
|
!N(t, e, n);
|
|
2418
2418
|
}
|
|
2419
|
-
function
|
|
2419
|
+
function hn(t) {
|
|
2420
2420
|
const [e, n, ...r] = t.split(".");
|
|
2421
2421
|
if (r.length > 0 || n !== "id")
|
|
2422
2422
|
throw new Error(`${t} is not a valid lookup attribute.`);
|
|
@@ -2425,16 +2425,16 @@ function dn(t) {
|
|
|
2425
2425
|
function pa(t, e, n) {
|
|
2426
2426
|
if (!ha(t, e, n))
|
|
2427
2427
|
return N(t, e, n);
|
|
2428
|
-
const r =
|
|
2428
|
+
const r = hn(n), s = N(t, e, r) || Ce(t, e, r);
|
|
2429
2429
|
if (s && s["value-type"] !== "ref")
|
|
2430
2430
|
throw new Error(`${n} does not reference a valid link attribute.`);
|
|
2431
2431
|
return s;
|
|
2432
2432
|
}
|
|
2433
|
-
function
|
|
2433
|
+
function pn(t) {
|
|
2434
2434
|
return typeof t == "string" && !Ct(t) ? null : typeof t == "string" && Ct(t) ? ks(t) : da(t);
|
|
2435
2435
|
}
|
|
2436
2436
|
function ee(t, e, n) {
|
|
2437
|
-
const r =
|
|
2437
|
+
const r = pn(n);
|
|
2438
2438
|
if (r === null)
|
|
2439
2439
|
return n;
|
|
2440
2440
|
const [s, i] = r, o = pa(t, e, s);
|
|
@@ -2521,14 +2521,14 @@ function Ps({ stores: t, attrsStore: e }, [n, r, s, i]) {
|
|
|
2521
2521
|
return (i == null ? void 0 : i.upsert) === !1 ? { mode: "update" } : (i == null ? void 0 : i.upsert) === !0 ? null : ga(t, e, n, r) ? { mode: "update" } : null;
|
|
2522
2522
|
}
|
|
2523
2523
|
function _a(t, e) {
|
|
2524
|
-
const { attrsStore: n } = t, [r, s, i, o] = e, a =
|
|
2524
|
+
const { attrsStore: n } = t, [r, s, i, o] = e, a = $n(i), c = ee(n, r, s);
|
|
2525
2525
|
return [["id", c]].concat(Object.entries(a)).map(([l, f]) => {
|
|
2526
2526
|
const h = N(n, r, l);
|
|
2527
2527
|
return h["checked-data-type"] === "date" && t.useDateObjects && (f = It(f)), ["add-triple", c, h.id, f, { mode: "create" }];
|
|
2528
2528
|
});
|
|
2529
2529
|
}
|
|
2530
2530
|
function wa(t, e) {
|
|
2531
|
-
const { attrsStore: n } = t, [r, s, i, o] = e, a =
|
|
2531
|
+
const { attrsStore: n } = t, [r, s, i, o] = e, a = $n(i), c = ee(n, r, s), u = Ps(t, [r, c, i, o]);
|
|
2532
2532
|
return [["id", c]].concat(Object.entries(a)).map(([f, h]) => {
|
|
2533
2533
|
const y = N(n, r, f);
|
|
2534
2534
|
return y["checked-data-type"] === "date" && t.useDateObjects && (h = It(h)), [
|
|
@@ -2544,7 +2544,7 @@ function Ta({ attrsStore: t }, [e, n]) {
|
|
|
2544
2544
|
return [["delete-entity", ee(t, e, n), e]];
|
|
2545
2545
|
}
|
|
2546
2546
|
function ma(t, e) {
|
|
2547
|
-
const { attrsStore: n } = t, [r, s, i, o] = e, a =
|
|
2547
|
+
const { attrsStore: n } = t, [r, s, i, o] = e, a = $n(i), c = ee(n, r, s), u = Ps(t, [r, c, i, o]), l = Object.entries(a).map(([h, y]) => {
|
|
2548
2548
|
const b = N(n, r, h);
|
|
2549
2549
|
return [
|
|
2550
2550
|
"deep-merge-triple",
|
|
@@ -2649,7 +2649,7 @@ function Ca(t, e, n) {
|
|
|
2649
2649
|
"on-delete-reverse": i.onDelete
|
|
2650
2650
|
};
|
|
2651
2651
|
}
|
|
2652
|
-
function
|
|
2652
|
+
function Ar(t, e, n, r) {
|
|
2653
2653
|
const s = t ? Ca(t, e, n) : null, i = W(), o = [W(), e, n], a = [W(), n, e];
|
|
2654
2654
|
return {
|
|
2655
2655
|
id: i,
|
|
@@ -2675,20 +2675,20 @@ const Pa = /* @__PURE__ */ new Set(["create", "update", "merge", "link", "unlink
|
|
|
2675
2675
|
"merge",
|
|
2676
2676
|
"delete",
|
|
2677
2677
|
"ruleParams"
|
|
2678
|
-
]),
|
|
2679
|
-
...
|
|
2678
|
+
]), yn = { "unique?": !0, "index?": !0 }, Ra = {
|
|
2679
|
+
...yn,
|
|
2680
2680
|
cardinality: "one"
|
|
2681
2681
|
};
|
|
2682
2682
|
function xa(t) {
|
|
2683
2683
|
const e = [], [n, r, s, i] = t;
|
|
2684
2684
|
if (!ja.has(n))
|
|
2685
2685
|
return e;
|
|
2686
|
-
const o =
|
|
2686
|
+
const o = pn(s);
|
|
2687
2687
|
if (o && e.push({ etype: r, lookupPair: o }), n === "link")
|
|
2688
2688
|
for (const [a, c] of Object.entries(i)) {
|
|
2689
2689
|
const u = Array.isArray(c) ? c : [c];
|
|
2690
2690
|
for (const l of u) {
|
|
2691
|
-
const f =
|
|
2691
|
+
const f = pn(l);
|
|
2692
2692
|
f && e.push({
|
|
2693
2693
|
etype: r,
|
|
2694
2694
|
lookupPair: f,
|
|
@@ -2723,7 +2723,7 @@ function $a({ attrsStore: t, schema: e }, n) {
|
|
|
2723
2723
|
}
|
|
2724
2724
|
function f(b, g) {
|
|
2725
2725
|
const w = o(b, g), m = a(b, g);
|
|
2726
|
-
u(w), u(m), !w && !m && c(
|
|
2726
|
+
u(w), u(m), !w && !m && c(Ar(e, b, g, Ra));
|
|
2727
2727
|
}
|
|
2728
2728
|
for (const b of n)
|
|
2729
2729
|
for (const { etype: g, lookupPair: w, linkLabel: m } of xa(b)) {
|
|
@@ -2734,16 +2734,16 @@ function $a({ attrsStore: t, schema: e }, n) {
|
|
|
2734
2734
|
u(S), u(O);
|
|
2735
2735
|
const E = ((h = S == null ? void 0 : S["reverse-identity"]) == null ? void 0 : h[1]) || ((y = O == null ? void 0 : O["forward-identity"]) == null ? void 0 : y[1]) || m;
|
|
2736
2736
|
if (l(E, _))
|
|
2737
|
-
f(E,
|
|
2737
|
+
f(E, hn(_));
|
|
2738
2738
|
else {
|
|
2739
2739
|
const j = o(E, _);
|
|
2740
|
-
j || c(yt(e, E, _,
|
|
2740
|
+
j || c(yt(e, E, _, yn)), u(j);
|
|
2741
2741
|
}
|
|
2742
2742
|
} else if (l(g, _))
|
|
2743
|
-
f(g,
|
|
2743
|
+
f(g, hn(_));
|
|
2744
2744
|
else {
|
|
2745
2745
|
const S = o(g, _);
|
|
2746
|
-
S || c(yt(e, g, _,
|
|
2746
|
+
S || c(yt(e, g, _, yn)), u(S);
|
|
2747
2747
|
}
|
|
2748
2748
|
}
|
|
2749
2749
|
for (const b of n) {
|
|
@@ -2755,7 +2755,7 @@ function $a({ attrsStore: t, schema: e }, n) {
|
|
|
2755
2755
|
const E = o(w, O);
|
|
2756
2756
|
if (u(E), Ma.has(g) && (E || c(yt(e, w, O, O === "id" ? { "unique?": !0 } : null))), Ia.has(g)) {
|
|
2757
2757
|
const j = a(w, O);
|
|
2758
|
-
!E && !j && c(
|
|
2758
|
+
!E && !j && c(Ar(e, w, O)), u(j);
|
|
2759
2759
|
}
|
|
2760
2760
|
}
|
|
2761
2761
|
}
|
|
@@ -2772,7 +2772,7 @@ function Da(t, e) {
|
|
|
2772
2772
|
const r = (Array.isArray(e) ? e : [e]).flatMap((c) => la(c)), [s, i] = $a(t, r), o = { ...t, attrsStore: s }, a = r.flatMap((c) => Ea(o, c));
|
|
2773
2773
|
return [...i, ...a];
|
|
2774
2774
|
}
|
|
2775
|
-
function
|
|
2775
|
+
function kr(t, e) {
|
|
2776
2776
|
typeof requestIdleCallback > "u" ? t() : requestIdleCallback(t, { timeout: e });
|
|
2777
2777
|
}
|
|
2778
2778
|
const nt = "__meta";
|
|
@@ -2780,7 +2780,7 @@ class Ua {
|
|
|
2780
2780
|
constructor(e, n) {
|
|
2781
2781
|
}
|
|
2782
2782
|
}
|
|
2783
|
-
class
|
|
2783
|
+
class bn {
|
|
2784
2784
|
constructor(e) {
|
|
2785
2785
|
p(this, "currentValue");
|
|
2786
2786
|
p(this, "_subs", []);
|
|
@@ -2973,7 +2973,7 @@ class yn {
|
|
|
2973
2973
|
gc() {
|
|
2974
2974
|
this._nextGc || (this._nextGc = setTimeout(
|
|
2975
2975
|
() => {
|
|
2976
|
-
|
|
2976
|
+
kr(() => {
|
|
2977
2977
|
this._nextGc = null, this._gc();
|
|
2978
2978
|
}, 30 * 1e3);
|
|
2979
2979
|
},
|
|
@@ -2988,7 +2988,7 @@ class yn {
|
|
|
2988
2988
|
return;
|
|
2989
2989
|
}
|
|
2990
2990
|
this._nextSave = setTimeout(() => {
|
|
2991
|
-
|
|
2991
|
+
kr(() => {
|
|
2992
2992
|
this._nextSave = null, this._writeToStorage(e).then(n).catch(r);
|
|
2993
2993
|
}, this._idleCallbackMaxWaitMs);
|
|
2994
2994
|
}, this._saveThrottleMs);
|
|
@@ -3074,7 +3074,7 @@ async function qa(t, e, n) {
|
|
|
3074
3074
|
};
|
|
3075
3075
|
});
|
|
3076
3076
|
}
|
|
3077
|
-
async function
|
|
3077
|
+
async function Cr(t, e, n) {
|
|
3078
3078
|
const r = n.put(e, t);
|
|
3079
3079
|
return new Promise((s, i) => {
|
|
3080
3080
|
r.onsuccess = () => s(), r.onerror = (o) => i(o);
|
|
@@ -3109,7 +3109,7 @@ async function Wa(t, e) {
|
|
|
3109
3109
|
break;
|
|
3110
3110
|
}
|
|
3111
3111
|
default: {
|
|
3112
|
-
const h =
|
|
3112
|
+
const h = Cr(l, f, i);
|
|
3113
3113
|
a.push(h);
|
|
3114
3114
|
const y = {
|
|
3115
3115
|
createdAt: Date.now(),
|
|
@@ -3120,12 +3120,12 @@ async function Wa(t, e) {
|
|
|
3120
3120
|
break;
|
|
3121
3121
|
}
|
|
3122
3122
|
}
|
|
3123
|
-
const u =
|
|
3123
|
+
const u = Cr(nt, c, i);
|
|
3124
3124
|
a.push(u), await Promise.all(a), await new Promise((l, f) => {
|
|
3125
3125
|
s.oncomplete = (h) => l(h), s.onerror = (h) => f(h), s.onabort = (h) => f(h);
|
|
3126
3126
|
});
|
|
3127
3127
|
}
|
|
3128
|
-
const
|
|
3128
|
+
const Pr = /* @__PURE__ */ new Map();
|
|
3129
3129
|
class Is extends Ua {
|
|
3130
3130
|
constructor(n, r) {
|
|
3131
3131
|
super(n, r);
|
|
@@ -3148,9 +3148,9 @@ class Is extends Ua {
|
|
|
3148
3148
|
const u = Wa(this._appId, c).catch((l) => {
|
|
3149
3149
|
Na("Error upgrading store from version 5 to 6.")(l);
|
|
3150
3150
|
});
|
|
3151
|
-
|
|
3151
|
+
Pr.set(this.dbName, u), u.then(() => n(c)).catch(() => n(c));
|
|
3152
3152
|
} else {
|
|
3153
|
-
const u =
|
|
3153
|
+
const u = Pr.get(this.dbName);
|
|
3154
3154
|
u ? u.then(() => n(c)).catch(() => n(c)) : n(c);
|
|
3155
3155
|
}
|
|
3156
3156
|
}, i.onupgradeneeded = (o) => {
|
|
@@ -3308,7 +3308,7 @@ async function Ga({ apiURI: t, appId: e }) {
|
|
|
3308
3308
|
})
|
|
3309
3309
|
});
|
|
3310
3310
|
}
|
|
3311
|
-
async function
|
|
3311
|
+
async function Ir({ apiURI: t, appId: e, code: n, codeVerifier: r, refreshToken: s }) {
|
|
3312
3312
|
return await ue(`${t}/runtime/oauth/token`, {
|
|
3313
3313
|
method: "POST",
|
|
3314
3314
|
headers: { "content-type": "application/json" },
|
|
@@ -3401,9 +3401,9 @@ async function ec({ apiURI: t, appId: e, path: n, refreshToken: r }) {
|
|
|
3401
3401
|
});
|
|
3402
3402
|
return s;
|
|
3403
3403
|
}
|
|
3404
|
-
let
|
|
3405
|
-
typeof window < "u" && typeof window.localStorage < "u" && (
|
|
3406
|
-
function
|
|
3404
|
+
let Nn = !1, js = !1, Rs = !1;
|
|
3405
|
+
typeof window < "u" && typeof window.localStorage < "u" && (Nn = !!window.localStorage.getItem("devBackend"), js = !!window.localStorage.getItem("__instantLogging"), Rs = !!window.localStorage.getItem("__devtoolLocalDash"));
|
|
3406
|
+
function Mr(t, e) {
|
|
3407
3407
|
if (!e)
|
|
3408
3408
|
return t;
|
|
3409
3409
|
const n = {};
|
|
@@ -3416,27 +3416,27 @@ function tc(t, e, n) {
|
|
|
3416
3416
|
peers: {}
|
|
3417
3417
|
};
|
|
3418
3418
|
if (e && "user" in e ? e.user : !0) {
|
|
3419
|
-
const i =
|
|
3419
|
+
const i = Mr(t.user ?? {}, e == null ? void 0 : e.keys);
|
|
3420
3420
|
r.user = { ...i, peerId: n };
|
|
3421
3421
|
}
|
|
3422
3422
|
for (const i of Object.keys(t.peers ?? {})) {
|
|
3423
3423
|
const o = (e == null ? void 0 : e.peers) === void 0, a = Array.isArray(e == null ? void 0 : e.peers) && (e == null ? void 0 : e.peers.includes(i));
|
|
3424
3424
|
if (o || a) {
|
|
3425
|
-
const c =
|
|
3425
|
+
const c = Mr(t.peers[i], e == null ? void 0 : e.keys);
|
|
3426
3426
|
r.peers[i] = { ...c, peerId: i };
|
|
3427
3427
|
}
|
|
3428
3428
|
}
|
|
3429
3429
|
return r;
|
|
3430
3430
|
}
|
|
3431
3431
|
function nc(t, e) {
|
|
3432
|
-
if (t.isLoading !== e.isLoading || t.error !== e.error || (t.user || e.user) && (!t.user || !e.user || !
|
|
3432
|
+
if (t.isLoading !== e.isLoading || t.error !== e.error || (t.user || e.user) && (!t.user || !e.user || !br(t.user, e.user)) || !cs(t.peers, e.peers))
|
|
3433
3433
|
return !0;
|
|
3434
3434
|
for (const r of Object.keys(t.peers))
|
|
3435
|
-
if (!
|
|
3435
|
+
if (!br(t.peers[r], e.peers[r]))
|
|
3436
3436
|
return !0;
|
|
3437
3437
|
return !1;
|
|
3438
3438
|
}
|
|
3439
|
-
class
|
|
3439
|
+
class jr {
|
|
3440
3440
|
constructor() {
|
|
3441
3441
|
p(this, "promise");
|
|
3442
3442
|
p(this, "_resolve");
|
|
@@ -3461,11 +3461,11 @@ function xs(t, e = []) {
|
|
|
3461
3461
|
xs(n["child-nodes"], e);
|
|
3462
3462
|
});
|
|
3463
3463
|
}
|
|
3464
|
-
function
|
|
3464
|
+
function Rr(t) {
|
|
3465
3465
|
const e = [];
|
|
3466
3466
|
return xs(t, e), e;
|
|
3467
3467
|
}
|
|
3468
|
-
function
|
|
3468
|
+
function xr(t) {
|
|
3469
3469
|
return Object.values(t.links).reduce((e, n) => {
|
|
3470
3470
|
var r, s;
|
|
3471
3471
|
return e[r = n.forward.on] ?? (e[r] = {}), e[n.forward.on][n.forward.label] = {
|
|
@@ -3479,7 +3479,7 @@ function Rr(t) {
|
|
|
3479
3479
|
}, e;
|
|
3480
3480
|
}, {});
|
|
3481
3481
|
}
|
|
3482
|
-
const
|
|
3482
|
+
const Kn = "v0.22.105-experimental.fix1111111.21050884263.1";
|
|
3483
3483
|
function rc(t, e) {
|
|
3484
3484
|
return {
|
|
3485
3485
|
info: t ? (...n) => console.info(...n, e()) : () => {
|
|
@@ -3569,7 +3569,7 @@ class x extends Error {
|
|
|
3569
3569
|
super(r), this.name = "QueryValidationError";
|
|
3570
3570
|
}
|
|
3571
3571
|
}
|
|
3572
|
-
const
|
|
3572
|
+
const $r = [
|
|
3573
3573
|
"where",
|
|
3574
3574
|
"order",
|
|
3575
3575
|
"limit",
|
|
@@ -3709,8 +3709,8 @@ const xr = [
|
|
|
3709
3709
|
}
|
|
3710
3710
|
}, ac = (t, e, n, r, s = 0) => {
|
|
3711
3711
|
for (const o of Object.keys(t))
|
|
3712
|
-
if (
|
|
3713
|
-
throw new x(`Invalid query parameter '${o}' in $ object. Valid parameters are: ${
|
|
3712
|
+
if (!$r.includes(o))
|
|
3713
|
+
throw new x(`Invalid query parameter '${o}' in $ object. Valid parameters are: ${$r.join(", ")}. Found: ${o}`, r);
|
|
3714
3714
|
const i = [
|
|
3715
3715
|
// 'limit', // only supported client side
|
|
3716
3716
|
"offset",
|
|
@@ -3748,7 +3748,7 @@ const xr = [
|
|
|
3748
3748
|
throw new x(`Query parameter '$' must be an object in entity '${e}', but received: ${typeof a}`, `${r}.$`);
|
|
3749
3749
|
ac(a, e, n, `${r}.$`, s);
|
|
3750
3750
|
}
|
|
3751
|
-
},
|
|
3751
|
+
}, Dr = (t, e) => {
|
|
3752
3752
|
if (typeof t != "object" || t === null)
|
|
3753
3753
|
throw new x(`Query must be an object, but received: ${typeof t}${t === null ? " (null)" : ""}`);
|
|
3754
3754
|
if (Array.isArray(t))
|
|
@@ -3767,7 +3767,7 @@ const xr = [
|
|
|
3767
3767
|
Us(n[r], r, e, r, 0);
|
|
3768
3768
|
}
|
|
3769
3769
|
}
|
|
3770
|
-
},
|
|
3770
|
+
}, Ur = (t) => typeof t != "string" ? !1 : Ct(t) ? !0 : Le(t);
|
|
3771
3771
|
class se extends Error {
|
|
3772
3772
|
constructor(e) {
|
|
3773
3773
|
super(e), this.name = "TransactionValidationError";
|
|
@@ -3798,7 +3798,7 @@ const Ls = (t) => t.length > 0 ? t.join(", ") : "none", cc = (t, e) => new se(`E
|
|
|
3798
3798
|
if (o && !uc(i, o))
|
|
3799
3799
|
throw new se(`Invalid value for attribute '${s}' in entity '${t}'. Expected ${o.valueType}, but received: ${typeof i}`);
|
|
3800
3800
|
}
|
|
3801
|
-
},
|
|
3801
|
+
}, Lr = (t, e, n) => {
|
|
3802
3802
|
const r = Fs(t, n);
|
|
3803
3803
|
if (typeof e != "object" || e === null)
|
|
3804
3804
|
throw new se(`Arguments for link operation on entity '${t}' must be an object, but received: ${typeof e}`);
|
|
@@ -3810,9 +3810,9 @@ const Ls = (t) => t.length > 0 ? t.join(", ") : "none", cc = (t, e) => new se(`E
|
|
|
3810
3810
|
if (i != null) {
|
|
3811
3811
|
if (Array.isArray(i)) {
|
|
3812
3812
|
for (const a of i)
|
|
3813
|
-
if (!
|
|
3813
|
+
if (!Ur(a))
|
|
3814
3814
|
throw new se(`Invalid entity ID in link '${s}' for entity '${t}'. Expected a UUID or a lookup, but received: ${a}`);
|
|
3815
|
-
} else if (!
|
|
3815
|
+
} else if (!Ur(i))
|
|
3816
3816
|
throw new se(`Invalid UUID in link '${s}' for entity '${t}'. Expected a UUID, but received: ${i}`);
|
|
3817
3817
|
}
|
|
3818
3818
|
}
|
|
@@ -3820,8 +3820,8 @@ const Ls = (t) => t.length > 0 ? t.join(", ") : "none", cc = (t, e) => new se(`E
|
|
|
3820
3820
|
create: Qt,
|
|
3821
3821
|
update: Qt,
|
|
3822
3822
|
merge: Qt,
|
|
3823
|
-
link:
|
|
3824
|
-
unlink:
|
|
3823
|
+
link: Lr,
|
|
3824
|
+
unlink: Lr,
|
|
3825
3825
|
delete: () => {
|
|
3826
3826
|
}
|
|
3827
3827
|
}, fc = (t, e) => {
|
|
@@ -3849,7 +3849,7 @@ const Ls = (t) => t.length > 0 ? t.join(", ") : "none", cc = (t, e) => new se(`E
|
|
|
3849
3849
|
}
|
|
3850
3850
|
};
|
|
3851
3851
|
let Ns = 0;
|
|
3852
|
-
class
|
|
3852
|
+
class Fr {
|
|
3853
3853
|
constructor(e) {
|
|
3854
3854
|
p(this, "type", "ws");
|
|
3855
3855
|
p(this, "conn");
|
|
@@ -4015,7 +4015,7 @@ function bc(t, e, n) {
|
|
|
4015
4015
|
function Ht(t, e, n) {
|
|
4016
4016
|
return As({ store: e, attrsStore: n, pageInfo: null, aggregate: null }, t.query).data[t.table][0];
|
|
4017
4017
|
}
|
|
4018
|
-
function
|
|
4018
|
+
function Nr(t, e, n, r) {
|
|
4019
4019
|
var o;
|
|
4020
4020
|
const s = (o = N(n, t.table, "id")) == null ? void 0 : o.id;
|
|
4021
4021
|
if (!s)
|
|
@@ -4023,7 +4023,7 @@ function Fr(t, e, n, r) {
|
|
|
4023
4023
|
const i = Ke(e.eav, [r, s, r]);
|
|
4024
4024
|
return i ? i[3] : -1;
|
|
4025
4025
|
}
|
|
4026
|
-
function
|
|
4026
|
+
function Kr(t, e, n) {
|
|
4027
4027
|
for (const { action: r, triple: s } of n)
|
|
4028
4028
|
switch (r) {
|
|
4029
4029
|
case "added":
|
|
@@ -4101,7 +4101,7 @@ class Tc {
|
|
|
4101
4101
|
p(this, "log");
|
|
4102
4102
|
p(this, "createStore");
|
|
4103
4103
|
p(this, "getAttrs");
|
|
4104
|
-
this.trySend = e, this.config = r, this.log = s, this.createStore = i, this.getAttrs = o, this.subs = new
|
|
4104
|
+
this.trySend = e, this.config = r, this.log = s, this.createStore = i, this.getAttrs = o, this.subs = new bn({
|
|
4105
4105
|
persister: n,
|
|
4106
4106
|
merge: bc,
|
|
4107
4107
|
serialize: yc,
|
|
@@ -4230,7 +4230,7 @@ class Tc {
|
|
|
4230
4230
|
c.push({
|
|
4231
4231
|
store: l,
|
|
4232
4232
|
entity: f,
|
|
4233
|
-
serverCreatedAt:
|
|
4233
|
+
serverCreatedAt: Nr(o, l, a.attrsStore, f.id)
|
|
4234
4234
|
}), i.push(f);
|
|
4235
4235
|
}
|
|
4236
4236
|
this.subs.updateInPlace((u) => {
|
|
@@ -4301,7 +4301,7 @@ class Tc {
|
|
|
4301
4301
|
for (let _ = 0; _ < f.length; _++) {
|
|
4302
4302
|
const S = f[_];
|
|
4303
4303
|
if (Xi(S.store, w)) {
|
|
4304
|
-
|
|
4304
|
+
Kr(S.store, l.attrsStore, m);
|
|
4305
4305
|
const O = Ht(s, S.store, l.attrsStore), E = gc(S.store, l.attrsStore, m)[w];
|
|
4306
4306
|
O ? (h.push({
|
|
4307
4307
|
oldEntity: S.entity,
|
|
@@ -4314,7 +4314,7 @@ class Tc {
|
|
|
4314
4314
|
const y = [];
|
|
4315
4315
|
for (const [w, m] of Object.entries(u)) {
|
|
4316
4316
|
const _ = this.createStore([]);
|
|
4317
|
-
|
|
4317
|
+
Kr(_, l.attrsStore, m);
|
|
4318
4318
|
const S = Ht(s, _, l.attrsStore);
|
|
4319
4319
|
if (!S) {
|
|
4320
4320
|
this.log.error("No entity found after applying change", {
|
|
@@ -4327,7 +4327,7 @@ class Tc {
|
|
|
4327
4327
|
f.push({
|
|
4328
4328
|
store: _,
|
|
4329
4329
|
entity: S,
|
|
4330
|
-
serverCreatedAt:
|
|
4330
|
+
serverCreatedAt: Nr(s, _, l.attrsStore, S.id)
|
|
4331
4331
|
}), y.push(S);
|
|
4332
4332
|
}
|
|
4333
4333
|
const b = [];
|
|
@@ -4387,10 +4387,10 @@ const de = {
|
|
|
4387
4387
|
}, Jt = "_instant_oauth_redirect", Ve = "currentUser";
|
|
4388
4388
|
function Ac({ transportType: t, appId: e, apiURI: n, wsURI: r, EventSourceImpl: s }) {
|
|
4389
4389
|
if (!s)
|
|
4390
|
-
return new
|
|
4390
|
+
return new Fr(`${r}?app_id=${e}`);
|
|
4391
4391
|
switch (t) {
|
|
4392
4392
|
case "ws":
|
|
4393
|
-
return new
|
|
4393
|
+
return new Fr(`${r}?app_id=${e}`);
|
|
4394
4394
|
case "sse":
|
|
4395
4395
|
return new hc(s, `${n}/runtime/sse?app_id=${e}`);
|
|
4396
4396
|
default:
|
|
@@ -4400,7 +4400,7 @@ function Ac({ transportType: t, appId: e, apiURI: n, wsURI: r, EventSourceImpl:
|
|
|
4400
4400
|
function kc() {
|
|
4401
4401
|
return typeof window < "u" || typeof chrome < "u";
|
|
4402
4402
|
}
|
|
4403
|
-
const
|
|
4403
|
+
const qr = {
|
|
4404
4404
|
"set-presence": !0,
|
|
4405
4405
|
"set-presence-ok": !0,
|
|
4406
4406
|
"refresh-presence": !0,
|
|
@@ -4456,7 +4456,7 @@ function jc(t, e, n) {
|
|
|
4456
4456
|
const r = e == null ? void 0 : e.result, s = n == null ? void 0 : n.result;
|
|
4457
4457
|
return r && !s && n && (n.result = r), n || e;
|
|
4458
4458
|
}
|
|
4459
|
-
function
|
|
4459
|
+
function Yt(t) {
|
|
4460
4460
|
return [...t].sort((e, n) => {
|
|
4461
4461
|
const [r, s] = e, [i, o] = n, a = s.order || 0, c = o.order || 0;
|
|
4462
4462
|
return a == c ? r < i ? -1 : r > i ? 1 : 0 : a - c;
|
|
@@ -4589,7 +4589,7 @@ class Rc {
|
|
|
4589
4589
|
this._updatePendingMutations((c) => {
|
|
4590
4590
|
c.set(r, o);
|
|
4591
4591
|
});
|
|
4592
|
-
const a = new
|
|
4592
|
+
const a = new jr();
|
|
4593
4593
|
return this.mutationDeferredStore.set(r, a), this._sendMutation(r, o), this.notifyAll(), a.promise;
|
|
4594
4594
|
});
|
|
4595
4595
|
p(this, "_transportOnOpen", (e) => {
|
|
@@ -4660,7 +4660,7 @@ class Rc {
|
|
|
4660
4660
|
}
|
|
4661
4661
|
this._log.info("[socket][close]", n.id, "schedule reconnect, ms =", this._reconnectTimeoutMs), this._scheduleReconnect();
|
|
4662
4662
|
});
|
|
4663
|
-
if (this._EventSource = i, this.config = { ...Oc, ...e }, this.queryCacheLimit = this.config.queryCacheLimit ?? 10, this._pendingTxCleanupTimeout = this.config.pendingTxCleanupTimeout ?? Sc, this._pendingMutationCleanupThreshold = this.config.pendingMutationCleanupThreshold ?? vc, this._log = rc(e.verbose ||
|
|
4663
|
+
if (this._EventSource = i, this.config = { ...Oc, ...e }, this.queryCacheLimit = this.config.queryCacheLimit ?? 10, this._pendingTxCleanupTimeout = this.config.pendingTxCleanupTimeout ?? Sc, this._pendingMutationCleanupThreshold = this.config.pendingMutationCleanupThreshold ?? vc, this._log = rc(e.verbose || Nn || js, () => this._reactorStats()), this.versions = { ...s || {}, "@instantdb/core": Kn }, this.config.schema && (this._linkIndex = xr(this.config.schema)), !!kc()) {
|
|
4664
4664
|
if (!e.appId)
|
|
4665
4665
|
throw new Error("Instant must be initialized with an appId.");
|
|
4666
4666
|
if (!Le(e.appId))
|
|
@@ -4699,7 +4699,7 @@ class Rc {
|
|
|
4699
4699
|
...this.config,
|
|
4700
4700
|
schema: e,
|
|
4701
4701
|
cardinalityInference: !!e
|
|
4702
|
-
}, this._linkIndex = e ?
|
|
4702
|
+
}, this._linkIndex = e ? xr(this.config.schema) : null;
|
|
4703
4703
|
}
|
|
4704
4704
|
_reactorStats() {
|
|
4705
4705
|
return {
|
|
@@ -4712,7 +4712,7 @@ class Rc {
|
|
|
4712
4712
|
this.kv.waitForKeyToLoad("pendingMutations").then(() => this.notifyOne(e));
|
|
4713
4713
|
}
|
|
4714
4714
|
_initStorage(e) {
|
|
4715
|
-
this.querySubs = new
|
|
4715
|
+
this.querySubs = new bn({
|
|
4716
4716
|
persister: new e(this.config.appId, "querySubs"),
|
|
4717
4717
|
merge: jc,
|
|
4718
4718
|
serialize: Pc,
|
|
@@ -4732,7 +4732,7 @@ class Rc {
|
|
|
4732
4732
|
maxSize: 1e6
|
|
4733
4733
|
// 1 million triples
|
|
4734
4734
|
}
|
|
4735
|
-
}), this.querySubs.onKeyLoaded = (n) => this._onQuerySubLoaded(n), this.kv = new
|
|
4735
|
+
}), this.querySubs.onKeyLoaded = (n) => this._onQuerySubLoaded(n), this.kv = new bn({
|
|
4736
4736
|
persister: new e(this.config.appId, "kv"),
|
|
4737
4737
|
merge: this._onMergeKv,
|
|
4738
4738
|
serialize: Mc,
|
|
@@ -4815,7 +4815,7 @@ class Rc {
|
|
|
4815
4815
|
_handleReceive(e, n) {
|
|
4816
4816
|
var s, i, o, a, c, u;
|
|
4817
4817
|
const r = !!this.config.schema && ("cardinalityInference" in this.config ? !!this.config.cardinalityInference : !0);
|
|
4818
|
-
switch (
|
|
4818
|
+
switch (qr[n.op] || this._log.info("[receive]", e, n.op, n), n.op) {
|
|
4819
4819
|
case "init-ok": {
|
|
4820
4820
|
this._setStatus(de.AUTHENTICATED), this._reconnectTimeoutMs = 0, this._setAttrs(n.attrs), this._flushPendingMessages(), this._sessionId = n["session-id"];
|
|
4821
4821
|
for (const h of Object.keys(this._rooms)) {
|
|
@@ -4832,7 +4832,7 @@ class Rc {
|
|
|
4832
4832
|
const { q: h, result: y } = n, b = q(h);
|
|
4833
4833
|
if (!this._hasQueryListeners() && !this.querySubs.currentValue[b])
|
|
4834
4834
|
break;
|
|
4835
|
-
const g = (a = (o = y == null ? void 0 : y[0]) == null ? void 0 : o.data) == null ? void 0 : a["page-info"], w = (u = (c = y == null ? void 0 : y[0]) == null ? void 0 : c.data) == null ? void 0 : u.aggregate, m =
|
|
4835
|
+
const g = (a = (o = y == null ? void 0 : y[0]) == null ? void 0 : o.data) == null ? void 0 : a["page-info"], w = (u = (c = y == null ? void 0 : y[0]) == null ? void 0 : c.data) == null ? void 0 : u.aggregate, m = Rr(y), _ = this.ensureAttrs(), S = Je(_, m, r, this.config.useDateObjects);
|
|
4836
4836
|
this.querySubs.updateInPlace((O) => {
|
|
4837
4837
|
if (!O[b]) {
|
|
4838
4838
|
this._log.info("Missing value in querySubs", { hash: b, q: h });
|
|
@@ -4871,9 +4871,9 @@ class Rc {
|
|
|
4871
4871
|
g !== this._pendingMutations() && this.kv.updateInPlace((_) => {
|
|
4872
4872
|
_.pendingMutations = g;
|
|
4873
4873
|
});
|
|
4874
|
-
const w =
|
|
4874
|
+
const w = Yt(g.entries()), m = h.map((_) => {
|
|
4875
4875
|
var We, ie, le, be;
|
|
4876
|
-
const S = _["instaql-query"], O = _["instaql-result"], E = q(S), j =
|
|
4876
|
+
const S = _["instaql-query"], O = _["instaql-result"], E = q(S), j = Rr(O), L = this.ensureAttrs(), B = Je(L, j, r, this.config.useDateObjects), { store: qe, attrsStore: ut } = this._applyOptimisticUpdates(B, L, w, b), $t = (ie = (We = O == null ? void 0 : O[0]) == null ? void 0 : We.data) == null ? void 0 : ie["page-info"], Dt = (be = (le = O == null ? void 0 : O[0]) == null ? void 0 : le.data) == null ? void 0 : be.aggregate;
|
|
4877
4877
|
return {
|
|
4878
4878
|
q: S,
|
|
4879
4879
|
hash: E,
|
|
@@ -5059,15 +5059,15 @@ class Rc {
|
|
|
5059
5059
|
* Returns an unsubscribe function
|
|
5060
5060
|
*/
|
|
5061
5061
|
subscribeQuery(e, n, r) {
|
|
5062
|
-
this.config.disableValidation ||
|
|
5062
|
+
this.config.disableValidation || Dr(e, this.config.schema), r && "ruleParams" in r && (e = { $$ruleParams: r.ruleParams, ...e });
|
|
5063
5063
|
const s = q(e), i = this.getPreviousResult(e);
|
|
5064
5064
|
return i && n(i), this.queryCbs[s] = this.queryCbs[s] ?? [], this.queryCbs[s].push({ q: e, cb: n }), this._startQuerySub(e, s), () => {
|
|
5065
5065
|
this._unsubQuery(e, s, n);
|
|
5066
5066
|
};
|
|
5067
5067
|
}
|
|
5068
5068
|
queryOnce(e, n) {
|
|
5069
|
-
this.config.disableValidation ||
|
|
5070
|
-
const r = new
|
|
5069
|
+
this.config.disableValidation || Dr(e, this.config.schema), n && "ruleParams" in n && (e = { $$ruleParams: n.ruleParams, ...e });
|
|
5070
|
+
const r = new jr();
|
|
5071
5071
|
if (!this._isOnline)
|
|
5072
5072
|
return r.reject(new Error("We can't run `queryOnce`, because the device is offline.")), r.promise;
|
|
5073
5073
|
if (!this.querySubs)
|
|
@@ -5153,7 +5153,7 @@ class Rc {
|
|
|
5153
5153
|
return a ? u : n;
|
|
5154
5154
|
}
|
|
5155
5155
|
_rewriteMutationsSorted(e, n) {
|
|
5156
|
-
return
|
|
5156
|
+
return Yt(this._rewriteMutations(e, n).entries());
|
|
5157
5157
|
}
|
|
5158
5158
|
// ---------------------------
|
|
5159
5159
|
// Transact
|
|
@@ -5254,12 +5254,16 @@ class Rc {
|
|
|
5254
5254
|
// Websocket
|
|
5255
5255
|
/** Send messages we accumulated while we were connecting */
|
|
5256
5256
|
_flushPendingMessages() {
|
|
5257
|
-
Object.keys(this.queryCbs).map((
|
|
5258
|
-
this._trySendAuthed(
|
|
5259
|
-
}), Object.values(this.queryOnceDfds).flat().forEach(({ eventId:
|
|
5260
|
-
this._trySendAuthed(
|
|
5261
|
-
})
|
|
5262
|
-
|
|
5257
|
+
Object.keys(this.queryCbs).map((i) => this.querySubs.currentValue[i]).filter((i) => i).forEach(({ eventId: i, q: o }) => {
|
|
5258
|
+
this._trySendAuthed(i, { op: "add-query", q: o });
|
|
5259
|
+
}), Object.values(this.queryOnceDfds).flat().forEach(({ eventId: i, q: o }) => {
|
|
5260
|
+
this._trySendAuthed(i, { op: "add-query", q: o });
|
|
5261
|
+
});
|
|
5262
|
+
const r = this._rewriteMutations(this.ensureAttrs(), this._pendingMutations());
|
|
5263
|
+
r !== this._pendingMutations() && this.kv.updateInPlace((i) => {
|
|
5264
|
+
i.pendingMutations = r;
|
|
5265
|
+
}), Yt(r.entries()).forEach(([i, o]) => {
|
|
5266
|
+
o["tx-id"] || this._sendMutation(i, o);
|
|
5263
5267
|
}), this._syncTable.flushPending();
|
|
5264
5268
|
}
|
|
5265
5269
|
/**
|
|
@@ -5293,7 +5297,7 @@ class Rc {
|
|
|
5293
5297
|
}
|
|
5294
5298
|
_trySend(e, n, r) {
|
|
5295
5299
|
if (this._transport.isOpen()) {
|
|
5296
|
-
switch (
|
|
5300
|
+
switch (qr[n.op] || this._log.info("[send]", this._transport.id, n.op, n), n.op) {
|
|
5297
5301
|
case "transact": {
|
|
5298
5302
|
this._inFlightMutationEventIds.add(e);
|
|
5299
5303
|
break;
|
|
@@ -5384,7 +5388,7 @@ class Rc {
|
|
|
5384
5388
|
return null;
|
|
5385
5389
|
this._replaceUrlAfterOAuth();
|
|
5386
5390
|
try {
|
|
5387
|
-
const c = await this._getCurrentUser(), u = (c == null ? void 0 : c.type) === "guest", { user: l } = await
|
|
5391
|
+
const c = await this._getCurrentUser(), u = (c == null ? void 0 : c.type) === "guest", { user: l } = await Ir({
|
|
5388
5392
|
apiURI: this.config.apiURI,
|
|
5389
5393
|
appId: this.config.appId,
|
|
5390
5394
|
code: r,
|
|
@@ -5594,7 +5598,7 @@ class Rc {
|
|
|
5594
5598
|
*/
|
|
5595
5599
|
async exchangeCodeForToken({ code: e, codeVerifier: n }) {
|
|
5596
5600
|
var o;
|
|
5597
|
-
const r = await this.getCurrentUser(), s = ((o = r == null ? void 0 : r.user) == null ? void 0 : o.type) === "guest", i = await
|
|
5601
|
+
const r = await this.getCurrentUser(), s = ((o = r == null ? void 0 : r.user) == null ? void 0 : o.type) === "guest", i = await Ir({
|
|
5598
5602
|
apiURI: this.config.apiURI,
|
|
5599
5603
|
appId: this.config.appId,
|
|
5600
5604
|
code: e,
|
|
@@ -5726,7 +5730,7 @@ class Rc {
|
|
|
5726
5730
|
Ri(u, l, h);
|
|
5727
5731
|
break;
|
|
5728
5732
|
case "r":
|
|
5729
|
-
|
|
5733
|
+
gr(u, l, h);
|
|
5730
5734
|
break;
|
|
5731
5735
|
case "-":
|
|
5732
5736
|
ls(u, l);
|
|
@@ -5741,7 +5745,7 @@ class Rc {
|
|
|
5741
5745
|
delete r[this._sessionId];
|
|
5742
5746
|
const s = Object.fromEntries(Object.entries(r).map(([i, o]) => [i, o.data]));
|
|
5743
5747
|
this._presence = At(this._presence, (i) => {
|
|
5744
|
-
|
|
5748
|
+
gr(i, [e, "result", "peers"], s);
|
|
5745
5749
|
});
|
|
5746
5750
|
}
|
|
5747
5751
|
// --------
|
|
@@ -5930,7 +5934,7 @@ function Wc(t, e) {
|
|
|
5930
5934
|
return u();
|
|
5931
5935
|
}
|
|
5932
5936
|
function zc(t) {
|
|
5933
|
-
return `${
|
|
5937
|
+
return `${Nn || Rs ? "http://localhost:3000" : "https://instantdb.com"}/_devtool?appId=${t}`;
|
|
5934
5938
|
}
|
|
5935
5939
|
function Vc(t) {
|
|
5936
5940
|
const e = document.createElement("iframe");
|
|
@@ -6017,11 +6021,11 @@ function Yc() {
|
|
|
6017
6021
|
function Zc() {
|
|
6018
6022
|
return globalThis.__instantDbStore = globalThis.__instantDbStore ?? {}, globalThis.__instantDbStore;
|
|
6019
6023
|
}
|
|
6020
|
-
function
|
|
6024
|
+
function gn(t) {
|
|
6021
6025
|
const e = t.__adminToken;
|
|
6022
6026
|
return t.appId + "_" + (t.websocketURI || "default_ws_uri") + "_" + (t.apiURI || "default_api_uri") + "_" + (e || "client_only") + "_" + t.useDateObjects;
|
|
6023
6027
|
}
|
|
6024
|
-
const
|
|
6028
|
+
const _n = Zc(), Wr = Yc();
|
|
6025
6029
|
class Xc {
|
|
6026
6030
|
constructor(e) {
|
|
6027
6031
|
p(this, "db");
|
|
@@ -6196,7 +6200,7 @@ class nu {
|
|
|
6196
6200
|
p(this, "_reactor");
|
|
6197
6201
|
p(this, "auth");
|
|
6198
6202
|
p(this, "storage");
|
|
6199
|
-
p(this, "tx",
|
|
6203
|
+
p(this, "tx", Fn());
|
|
6200
6204
|
this._reactor = e, this.auth = new Xc(this._reactor), this.storage = new eu(this._reactor);
|
|
6201
6205
|
}
|
|
6202
6206
|
/**
|
|
@@ -6338,7 +6342,7 @@ class nu {
|
|
|
6338
6342
|
};
|
|
6339
6343
|
}
|
|
6340
6344
|
shutdown() {
|
|
6341
|
-
delete gn
|
|
6345
|
+
delete _n[gn(this._reactor.config)], this._reactor.shutdown();
|
|
6342
6346
|
}
|
|
6343
6347
|
/**
|
|
6344
6348
|
* Use this for one-off queries.
|
|
@@ -6389,15 +6393,15 @@ function su(t, e, n, r, s) {
|
|
|
6389
6393
|
...t,
|
|
6390
6394
|
appId: (u = t.appId) == null ? void 0 : u.trim(),
|
|
6391
6395
|
useDateObjects: t.useDateObjects ?? !1
|
|
6392
|
-
}, o = gn
|
|
6396
|
+
}, o = _n[gn(i)];
|
|
6393
6397
|
if (o)
|
|
6394
6398
|
return ru(o, i.schema) && o._reactor.updateSchema(i.schema), o;
|
|
6395
6399
|
const a = new Rc({
|
|
6396
6400
|
...Jc,
|
|
6397
6401
|
...i,
|
|
6398
6402
|
cardinalityInference: !!i.schema
|
|
6399
|
-
}, e || Is, n || Ms, { ...r || {}, "@instantdb/core":
|
|
6400
|
-
return gn
|
|
6403
|
+
}, e || Is, n || Ms, { ...r || {}, "@instantdb/core": Kn }, s), c = new nu(a);
|
|
6404
|
+
return _n[gn(i)] = c, iu(i.appId, i.devtool), c;
|
|
6401
6405
|
}
|
|
6402
6406
|
function iu(t, e) {
|
|
6403
6407
|
if (typeof window > "u" || typeof window.location > "u" || typeof document > "u" || typeof e == "boolean" && !e)
|
|
@@ -6409,7 +6413,7 @@ function iu(t, e) {
|
|
|
6409
6413
|
};
|
|
6410
6414
|
n.allowedHosts.includes(window.location.hostname) && Wc(t, n);
|
|
6411
6415
|
}
|
|
6412
|
-
var
|
|
6416
|
+
var wn = { exports: {} }, Be = {};
|
|
6413
6417
|
/**
|
|
6414
6418
|
* @license React
|
|
6415
6419
|
* react-jsx-runtime.production.min.js
|
|
@@ -6537,18 +6541,18 @@ function au() {
|
|
|
6537
6541
|
}
|
|
6538
6542
|
return null;
|
|
6539
6543
|
}
|
|
6540
|
-
var le = Object.assign, be = 0,
|
|
6541
|
-
function
|
|
6544
|
+
var le = Object.assign, be = 0, Wn, zn, Vn, Bn, Gn, Qn, Hn;
|
|
6545
|
+
function Jn() {
|
|
6542
6546
|
}
|
|
6543
|
-
|
|
6547
|
+
Jn.__reactDisabledLog = !0;
|
|
6544
6548
|
function zs() {
|
|
6545
6549
|
{
|
|
6546
6550
|
if (be === 0) {
|
|
6547
|
-
|
|
6551
|
+
Wn = console.log, zn = console.info, Vn = console.warn, Bn = console.error, Gn = console.group, Qn = console.groupCollapsed, Hn = console.groupEnd;
|
|
6548
6552
|
var d = {
|
|
6549
6553
|
configurable: !0,
|
|
6550
6554
|
enumerable: !0,
|
|
6551
|
-
value:
|
|
6555
|
+
value: Jn,
|
|
6552
6556
|
writable: !0
|
|
6553
6557
|
};
|
|
6554
6558
|
Object.defineProperties(console, {
|
|
@@ -6574,25 +6578,25 @@ function au() {
|
|
|
6574
6578
|
};
|
|
6575
6579
|
Object.defineProperties(console, {
|
|
6576
6580
|
log: le({}, d, {
|
|
6577
|
-
value:
|
|
6581
|
+
value: Wn
|
|
6578
6582
|
}),
|
|
6579
6583
|
info: le({}, d, {
|
|
6580
|
-
value:
|
|
6584
|
+
value: zn
|
|
6581
6585
|
}),
|
|
6582
6586
|
warn: le({}, d, {
|
|
6583
|
-
value:
|
|
6587
|
+
value: Vn
|
|
6584
6588
|
}),
|
|
6585
6589
|
error: le({}, d, {
|
|
6586
|
-
value:
|
|
6590
|
+
value: Bn
|
|
6587
6591
|
}),
|
|
6588
6592
|
group: le({}, d, {
|
|
6589
|
-
value:
|
|
6593
|
+
value: Gn
|
|
6590
6594
|
}),
|
|
6591
6595
|
groupCollapsed: le({}, d, {
|
|
6592
|
-
value:
|
|
6596
|
+
value: Qn
|
|
6593
6597
|
}),
|
|
6594
6598
|
groupEnd: le({}, d, {
|
|
6595
|
-
value:
|
|
6599
|
+
value: Hn
|
|
6596
6600
|
})
|
|
6597
6601
|
});
|
|
6598
6602
|
}
|
|
@@ -6618,7 +6622,7 @@ function au() {
|
|
|
6618
6622
|
var Bs = typeof WeakMap == "function" ? WeakMap : Map;
|
|
6619
6623
|
ft = new Bs();
|
|
6620
6624
|
}
|
|
6621
|
-
function
|
|
6625
|
+
function Yn(d, T) {
|
|
6622
6626
|
if (!d || Ft)
|
|
6623
6627
|
return "";
|
|
6624
6628
|
{
|
|
@@ -6690,7 +6694,7 @@ function au() {
|
|
|
6690
6694
|
return typeof d == "function" && ft.set(d, we), we;
|
|
6691
6695
|
}
|
|
6692
6696
|
function Gs(d, T, v) {
|
|
6693
|
-
return
|
|
6697
|
+
return Yn(d, !1);
|
|
6694
6698
|
}
|
|
6695
6699
|
function Qs(d) {
|
|
6696
6700
|
var T = d.prototype;
|
|
@@ -6700,7 +6704,7 @@ function au() {
|
|
|
6700
6704
|
if (d == null)
|
|
6701
6705
|
return "";
|
|
6702
6706
|
if (typeof d == "function")
|
|
6703
|
-
return
|
|
6707
|
+
return Yn(d, Qs(d));
|
|
6704
6708
|
if (typeof d == "string")
|
|
6705
6709
|
return lt(d);
|
|
6706
6710
|
switch (d) {
|
|
@@ -6725,13 +6729,13 @@ function au() {
|
|
|
6725
6729
|
}
|
|
6726
6730
|
return "";
|
|
6727
6731
|
}
|
|
6728
|
-
var ze = Object.prototype.hasOwnProperty,
|
|
6732
|
+
var ze = Object.prototype.hasOwnProperty, Zn = {}, Xn = _.ReactDebugCurrentFrame;
|
|
6729
6733
|
function ht(d) {
|
|
6730
6734
|
if (d) {
|
|
6731
6735
|
var T = d._owner, v = dt(d.type, d._source, T ? T.type : null);
|
|
6732
|
-
|
|
6736
|
+
Xn.setExtraStackFrame(v);
|
|
6733
6737
|
} else
|
|
6734
|
-
|
|
6738
|
+
Xn.setExtraStackFrame(null);
|
|
6735
6739
|
}
|
|
6736
6740
|
function Hs(d, T, v, A, M) {
|
|
6737
6741
|
{
|
|
@@ -6748,7 +6752,7 @@ function au() {
|
|
|
6748
6752
|
} catch (D) {
|
|
6749
6753
|
C = D;
|
|
6750
6754
|
}
|
|
6751
|
-
C && !(C instanceof Error) && (ht(M), S("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", A || "React class", v, I, typeof C), ht(null)), C instanceof Error && !(C.message in
|
|
6755
|
+
C && !(C instanceof Error) && (ht(M), S("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", A || "React class", v, I, typeof C), ht(null)), C instanceof Error && !(C.message in Zn) && (Zn[C.message] = !0, ht(M), S("Failed %s type: %s", v, C.message), ht(null));
|
|
6752
6756
|
}
|
|
6753
6757
|
}
|
|
6754
6758
|
}
|
|
@@ -6764,24 +6768,24 @@ function au() {
|
|
|
6764
6768
|
}
|
|
6765
6769
|
function Zs(d) {
|
|
6766
6770
|
try {
|
|
6767
|
-
return
|
|
6771
|
+
return er(d), !1;
|
|
6768
6772
|
} catch {
|
|
6769
6773
|
return !0;
|
|
6770
6774
|
}
|
|
6771
6775
|
}
|
|
6772
|
-
function
|
|
6776
|
+
function er(d) {
|
|
6773
6777
|
return "" + d;
|
|
6774
6778
|
}
|
|
6775
|
-
function
|
|
6779
|
+
function tr(d) {
|
|
6776
6780
|
if (Zs(d))
|
|
6777
|
-
return S("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Ys(d)),
|
|
6781
|
+
return S("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Ys(d)), er(d);
|
|
6778
6782
|
}
|
|
6779
|
-
var
|
|
6783
|
+
var nr = _.ReactCurrentOwner, Xs = {
|
|
6780
6784
|
key: !0,
|
|
6781
6785
|
ref: !0,
|
|
6782
6786
|
__self: !0,
|
|
6783
6787
|
__source: !0
|
|
6784
|
-
},
|
|
6788
|
+
}, rr, sr;
|
|
6785
6789
|
function ei(d) {
|
|
6786
6790
|
if (ze.call(d, "ref")) {
|
|
6787
6791
|
var T = Object.getOwnPropertyDescriptor(d, "ref").get;
|
|
@@ -6799,12 +6803,12 @@ function au() {
|
|
|
6799
6803
|
return d.key !== void 0;
|
|
6800
6804
|
}
|
|
6801
6805
|
function ni(d, T) {
|
|
6802
|
-
typeof d.ref == "string" &&
|
|
6806
|
+
typeof d.ref == "string" && nr.current;
|
|
6803
6807
|
}
|
|
6804
6808
|
function ri(d, T) {
|
|
6805
6809
|
{
|
|
6806
6810
|
var v = function() {
|
|
6807
|
-
|
|
6811
|
+
rr || (rr = !0, S("%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));
|
|
6808
6812
|
};
|
|
6809
6813
|
v.isReactWarning = !0, Object.defineProperty(d, "key", {
|
|
6810
6814
|
get: v,
|
|
@@ -6815,7 +6819,7 @@ function au() {
|
|
|
6815
6819
|
function si(d, T) {
|
|
6816
6820
|
{
|
|
6817
6821
|
var v = function() {
|
|
6818
|
-
|
|
6822
|
+
sr || (sr = !0, S("%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));
|
|
6819
6823
|
};
|
|
6820
6824
|
v.isReactWarning = !0, Object.defineProperty(d, "ref", {
|
|
6821
6825
|
get: v,
|
|
@@ -6855,7 +6859,7 @@ function au() {
|
|
|
6855
6859
|
function oi(d, T, v, A, M) {
|
|
6856
6860
|
{
|
|
6857
6861
|
var R, I = {}, C = null, G = null;
|
|
6858
|
-
v !== void 0 && (
|
|
6862
|
+
v !== void 0 && (tr(v), C = "" + v), ti(T) && (tr(T.key), C = "" + T.key), ei(T) && (G = T.ref, ni(T, M));
|
|
6859
6863
|
for (R in T)
|
|
6860
6864
|
ze.call(T, R) && !Xs.hasOwnProperty(R) && (I[R] = T[R]);
|
|
6861
6865
|
if (d && d.defaultProps) {
|
|
@@ -6867,23 +6871,23 @@ function au() {
|
|
|
6867
6871
|
var F = typeof d == "function" ? d.displayName || d.name || "Unknown" : d;
|
|
6868
6872
|
C && ri(I, F), G && si(I, F);
|
|
6869
6873
|
}
|
|
6870
|
-
return ii(d, C, G, M, A,
|
|
6874
|
+
return ii(d, C, G, M, A, nr.current, I);
|
|
6871
6875
|
}
|
|
6872
6876
|
}
|
|
6873
|
-
var Kt = _.ReactCurrentOwner,
|
|
6877
|
+
var Kt = _.ReactCurrentOwner, ir = _.ReactDebugCurrentFrame;
|
|
6874
6878
|
function Pe(d) {
|
|
6875
6879
|
if (d) {
|
|
6876
6880
|
var T = d._owner, v = dt(d.type, d._source, T ? T.type : null);
|
|
6877
|
-
|
|
6881
|
+
ir.setExtraStackFrame(v);
|
|
6878
6882
|
} else
|
|
6879
|
-
|
|
6883
|
+
ir.setExtraStackFrame(null);
|
|
6880
6884
|
}
|
|
6881
6885
|
var qt;
|
|
6882
6886
|
qt = !1;
|
|
6883
6887
|
function Wt(d) {
|
|
6884
6888
|
return typeof d == "object" && d !== null && d.$$typeof === n;
|
|
6885
6889
|
}
|
|
6886
|
-
function
|
|
6890
|
+
function or() {
|
|
6887
6891
|
{
|
|
6888
6892
|
if (Kt.current) {
|
|
6889
6893
|
var d = ie(Kt.current.type);
|
|
@@ -6898,10 +6902,10 @@ Check the render method of \`` + d + "`.";
|
|
|
6898
6902
|
function ai(d) {
|
|
6899
6903
|
return "";
|
|
6900
6904
|
}
|
|
6901
|
-
var
|
|
6905
|
+
var ar = {};
|
|
6902
6906
|
function ci(d) {
|
|
6903
6907
|
{
|
|
6904
|
-
var T =
|
|
6908
|
+
var T = or();
|
|
6905
6909
|
if (!T) {
|
|
6906
6910
|
var v = typeof d == "string" ? d : d.displayName || d.name;
|
|
6907
6911
|
v && (T = `
|
|
@@ -6911,27 +6915,27 @@ Check the top-level render call using <` + v + ">.");
|
|
|
6911
6915
|
return T;
|
|
6912
6916
|
}
|
|
6913
6917
|
}
|
|
6914
|
-
function
|
|
6918
|
+
function cr(d, T) {
|
|
6915
6919
|
{
|
|
6916
6920
|
if (!d._store || d._store.validated || d.key != null)
|
|
6917
6921
|
return;
|
|
6918
6922
|
d._store.validated = !0;
|
|
6919
6923
|
var v = ci(T);
|
|
6920
|
-
if (
|
|
6924
|
+
if (ar[v])
|
|
6921
6925
|
return;
|
|
6922
|
-
|
|
6926
|
+
ar[v] = !0;
|
|
6923
6927
|
var A = "";
|
|
6924
6928
|
d && d._owner && d._owner !== Kt.current && (A = " It was passed a child from " + ie(d._owner.type) + "."), Pe(d), S('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', v, A), Pe(null);
|
|
6925
6929
|
}
|
|
6926
6930
|
}
|
|
6927
|
-
function
|
|
6931
|
+
function ur(d, T) {
|
|
6928
6932
|
{
|
|
6929
6933
|
if (typeof d != "object")
|
|
6930
6934
|
return;
|
|
6931
6935
|
if (Nt(d))
|
|
6932
6936
|
for (var v = 0; v < d.length; v++) {
|
|
6933
6937
|
var A = d[v];
|
|
6934
|
-
Wt(A) &&
|
|
6938
|
+
Wt(A) && cr(A, T);
|
|
6935
6939
|
}
|
|
6936
6940
|
else if (Wt(d))
|
|
6937
6941
|
d._store && (d._store.validated = !0);
|
|
@@ -6939,7 +6943,7 @@ Check the top-level render call using <` + v + ">.");
|
|
|
6939
6943
|
var M = m(d);
|
|
6940
6944
|
if (typeof M == "function" && M !== d.entries)
|
|
6941
6945
|
for (var R = M.call(d), I; !(I = R.next()).done; )
|
|
6942
|
-
Wt(I.value) &&
|
|
6946
|
+
Wt(I.value) && cr(I.value, T);
|
|
6943
6947
|
}
|
|
6944
6948
|
}
|
|
6945
6949
|
}
|
|
@@ -6980,15 +6984,15 @@ Check the top-level render call using <` + v + ">.");
|
|
|
6980
6984
|
d.ref !== null && (Pe(d), S("Invalid attribute `ref` supplied to `React.Fragment`."), Pe(null));
|
|
6981
6985
|
}
|
|
6982
6986
|
}
|
|
6983
|
-
var
|
|
6984
|
-
function
|
|
6987
|
+
var lr = {};
|
|
6988
|
+
function fr(d, T, v, A, M, R) {
|
|
6985
6989
|
{
|
|
6986
6990
|
var I = $t(d);
|
|
6987
6991
|
if (!I) {
|
|
6988
6992
|
var C = "";
|
|
6989
6993
|
(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.");
|
|
6990
6994
|
var G = ai();
|
|
6991
|
-
G ? C += G : C +=
|
|
6995
|
+
G ? C += G : C += or();
|
|
6992
6996
|
var D;
|
|
6993
6997
|
d === null ? D = "null" : Nt(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, S("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);
|
|
6994
6998
|
}
|
|
@@ -7001,43 +7005,43 @@ Check the top-level render call using <` + v + ">.");
|
|
|
7001
7005
|
if (A)
|
|
7002
7006
|
if (Nt(re)) {
|
|
7003
7007
|
for (var Ie = 0; Ie < re.length; Ie++)
|
|
7004
|
-
|
|
7008
|
+
ur(re[Ie], d);
|
|
7005
7009
|
Object.freeze && Object.freeze(re);
|
|
7006
7010
|
} else
|
|
7007
7011
|
S("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
|
|
7008
7012
|
else
|
|
7009
|
-
|
|
7013
|
+
ur(re, d);
|
|
7010
7014
|
}
|
|
7011
7015
|
if (ze.call(T, "key")) {
|
|
7012
7016
|
var we = ie(d), J = Object.keys(T).filter(function(bi) {
|
|
7013
7017
|
return bi !== "key";
|
|
7014
7018
|
}), zt = J.length > 0 ? "{key: someKey, " + J.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
7015
|
-
if (!
|
|
7019
|
+
if (!lr[we + zt]) {
|
|
7016
7020
|
var yi = J.length > 0 ? "{" + J.join(": ..., ") + ": ...}" : "{}";
|
|
7017
7021
|
S(`A props object containing a "key" prop is being spread into JSX:
|
|
7018
7022
|
let props = %s;
|
|
7019
7023
|
<%s {...props} />
|
|
7020
7024
|
React keys must be passed directly to JSX without using spread:
|
|
7021
7025
|
let props = %s;
|
|
7022
|
-
<%s key={someKey} {...props} />`, zt, we, yi, we),
|
|
7026
|
+
<%s key={someKey} {...props} />`, zt, we, yi, we), lr[we + zt] = !0;
|
|
7023
7027
|
}
|
|
7024
7028
|
}
|
|
7025
7029
|
return d === s ? li(F) : ui(F), F;
|
|
7026
7030
|
}
|
|
7027
7031
|
}
|
|
7028
7032
|
function fi(d, T, v) {
|
|
7029
|
-
return
|
|
7033
|
+
return fr(d, T, v, !0);
|
|
7030
7034
|
}
|
|
7031
7035
|
function di(d, T, v) {
|
|
7032
|
-
return
|
|
7036
|
+
return fr(d, T, v, !1);
|
|
7033
7037
|
}
|
|
7034
7038
|
var hi = di, pi = fi;
|
|
7035
7039
|
Ge.Fragment = s, Ge.jsx = hi, Ge.jsxs = pi;
|
|
7036
7040
|
}(), Ge;
|
|
7037
7041
|
}
|
|
7038
7042
|
var cu = {};
|
|
7039
|
-
cu.NODE_ENV === "production" ?
|
|
7040
|
-
var V =
|
|
7043
|
+
cu.NODE_ENV === "production" ? wn.exports = ou() : wn.exports = au();
|
|
7044
|
+
var V = wn.exports;
|
|
7041
7045
|
const uu = {
|
|
7042
7046
|
isLoading: !0,
|
|
7043
7047
|
data: void 0,
|
|
@@ -7072,7 +7076,7 @@ function lu(t, e, n) {
|
|
|
7072
7076
|
// Build a new subscribe function if the query changes
|
|
7073
7077
|
[s]
|
|
7074
7078
|
);
|
|
7075
|
-
return { state:
|
|
7079
|
+
return { state: Xt(o, () => i.current, () => uu), query: r };
|
|
7076
7080
|
}
|
|
7077
7081
|
function fu() {
|
|
7078
7082
|
const t = it(null);
|
|
@@ -7116,7 +7120,7 @@ function yu(t, e = {}) {
|
|
|
7116
7120
|
const s = _e((c) => {
|
|
7117
7121
|
t.core._reactor.publishPresence(t.type, t.id, c);
|
|
7118
7122
|
}, [t.type, t.id]);
|
|
7119
|
-
return
|
|
7123
|
+
return en(() => ({
|
|
7120
7124
|
...n,
|
|
7121
7125
|
publishPresence: s
|
|
7122
7126
|
}), [n, s]);
|
|
@@ -7127,7 +7131,7 @@ function bu(t, e, n) {
|
|
|
7127
7131
|
function gu(t, e, n = {}) {
|
|
7128
7132
|
const r = fu(), s = me.usePresence(t, {
|
|
7129
7133
|
keys: [e]
|
|
7130
|
-
}), i =
|
|
7134
|
+
}), i = en(() => {
|
|
7131
7135
|
const l = t._core._reactor.getPresence(t.type, t.id);
|
|
7132
7136
|
return n != null && n.writeOnly ? [] : Object.values((l == null ? void 0 : l.peers) ?? {}).filter((f) => f[e] === !0);
|
|
7133
7137
|
}, [n == null ? void 0 : n.writeOnly, s]), o = _e((l) => {
|
|
@@ -7143,7 +7147,7 @@ function gu(t, e, n = {}) {
|
|
|
7143
7147
|
o(h);
|
|
7144
7148
|
}, [n.stopOnEnter, o]), c = _e(() => {
|
|
7145
7149
|
o(!1);
|
|
7146
|
-
}, [o]), u =
|
|
7150
|
+
}, [o]), u = en(() => ({ onKeyDown: a, onBlur: c }), [a, c]);
|
|
7147
7151
|
return {
|
|
7148
7152
|
active: i,
|
|
7149
7153
|
setActive: o,
|
|
@@ -7251,7 +7255,7 @@ const wu = {
|
|
|
7251
7255
|
};
|
|
7252
7256
|
class mt {
|
|
7253
7257
|
constructor(e, n) {
|
|
7254
|
-
p(this, "tx",
|
|
7258
|
+
p(this, "tx", Fn());
|
|
7255
7259
|
p(this, "auth");
|
|
7256
7260
|
p(this, "storage");
|
|
7257
7261
|
p(this, "core");
|
|
@@ -7423,7 +7427,7 @@ class mt {
|
|
|
7423
7427
|
const e = it(this.core._reactor.status), n = _e((s) => this.core.subscribeConnectionStatus((o) => {
|
|
7424
7428
|
o !== e.current && (e.current = o, s());
|
|
7425
7429
|
}), []);
|
|
7426
|
-
return
|
|
7430
|
+
return Xt(
|
|
7427
7431
|
n,
|
|
7428
7432
|
() => e.current,
|
|
7429
7433
|
// For SSR, always return 'connecting' as the initial state
|
|
@@ -7502,7 +7506,7 @@ class mt {
|
|
|
7502
7506
|
const e = it(this.core._reactor._currentUserCached), n = _e((s) => this.core.subscribeAuth((o) => {
|
|
7503
7507
|
e.current = { isLoading: !1, ...o }, s();
|
|
7504
7508
|
}), []);
|
|
7505
|
-
return
|
|
7509
|
+
return Xt(n, () => e.current, () => wu);
|
|
7506
7510
|
}
|
|
7507
7511
|
/**
|
|
7508
7512
|
* One time query for the logged in state. This is useful
|
|
@@ -7524,14 +7528,14 @@ class Qr extends Error {
|
|
|
7524
7528
|
super(e), this.name = "ParseError", this.type = n.type, this.field = n.field, this.value = n.value, this.line = n.line;
|
|
7525
7529
|
}
|
|
7526
7530
|
}
|
|
7527
|
-
function
|
|
7531
|
+
function Zt(t) {
|
|
7528
7532
|
}
|
|
7529
7533
|
function Tu(t) {
|
|
7530
7534
|
if (typeof t == "function")
|
|
7531
7535
|
throw new TypeError(
|
|
7532
7536
|
"`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?"
|
|
7533
7537
|
);
|
|
7534
|
-
const { onEvent: e =
|
|
7538
|
+
const { onEvent: e = Zt, onError: n = Zt, onRetry: r = Zt, onComment: s } = t;
|
|
7535
7539
|
let i = "", o = !0, a, c = "", u = "";
|
|
7536
7540
|
function l(g) {
|
|
7537
7541
|
const w = o ? g.replace(/^\xEF\xBB\xBF/, "") : g, [m, _] = mu(`${i}${w}`);
|
|
@@ -7666,8 +7670,8 @@ function Su(t) {
|
|
|
7666
7670
|
const e = globalThis.DOMException;
|
|
7667
7671
|
return typeof e == "function" ? new e(t, "SyntaxError") : new SyntaxError(t);
|
|
7668
7672
|
}
|
|
7669
|
-
function
|
|
7670
|
-
return t instanceof Error ? "errors" in t && Array.isArray(t.errors) ? t.errors.map(
|
|
7673
|
+
function Tn(t) {
|
|
7674
|
+
return t instanceof Error ? "errors" in t && Array.isArray(t.errors) ? t.errors.map(Tn).join(", ") : "cause" in t && t.cause instanceof Error ? `${t}: ${Tn(t.cause)}` : t.message : `${t}`;
|
|
7671
7675
|
}
|
|
7672
7676
|
function Jr(t) {
|
|
7673
7677
|
return {
|
|
@@ -7681,11 +7685,11 @@ function Jr(t) {
|
|
|
7681
7685
|
}
|
|
7682
7686
|
var qs = (t) => {
|
|
7683
7687
|
throw TypeError(t);
|
|
7684
|
-
},
|
|
7688
|
+
}, qn = (t, e, n) => e.has(t) || qs("Cannot " + n), k = (t, e, n) => (qn(t, e, "read from private field"), n ? n.call(t) : e.get(t)), K = (t, e, n) => e.has(t) ? qs("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, n), $ = (t, e, n, r) => (qn(t, e, "write to private field"), e.set(t, n), n), he = (t, e, n) => (qn(t, e, "access private method"), n), Y, Se, je, St, Pt, rt, $e, st, ge, Re, Ue, xe, Ze, oe, mn, Sn, vn, Yr, En, On, Xe, An, kn;
|
|
7685
7689
|
class vt extends EventTarget {
|
|
7686
7690
|
constructor(e, n) {
|
|
7687
7691
|
var r, s;
|
|
7688
|
-
super(), K(this, oe), this.CONNECTING = 0, this.OPEN = 1, this.CLOSED = 2, K(this, Y), K(this, Se), K(this, je), K(this, St), K(this, Pt), K(this, rt), K(this, $e), K(this, st, null), K(this, ge), K(this, Re), K(this, Ue, null), K(this, xe, null), K(this, Ze, null), K(this,
|
|
7692
|
+
super(), K(this, oe), this.CONNECTING = 0, this.OPEN = 1, this.CLOSED = 2, K(this, Y), K(this, Se), K(this, je), K(this, St), K(this, Pt), K(this, rt), K(this, $e), K(this, st, null), K(this, ge), K(this, Re), K(this, Ue, null), K(this, xe, null), K(this, Ze, null), K(this, Sn, async (i) => {
|
|
7689
7693
|
var o;
|
|
7690
7694
|
k(this, Re).reset();
|
|
7691
7695
|
const { body: a, redirected: c, status: u, headers: l } = i;
|
|
@@ -7713,11 +7717,11 @@ class vt extends EventTarget {
|
|
|
7713
7717
|
let b = !0;
|
|
7714
7718
|
do {
|
|
7715
7719
|
const { done: g, value: w } = await y.read();
|
|
7716
|
-
w && k(this, Re).feed(h.decode(w, { stream: !g })), g && (b = !1, k(this, Re).reset(), he(this, oe,
|
|
7720
|
+
w && k(this, Re).feed(h.decode(w, { stream: !g })), g && (b = !1, k(this, Re).reset(), he(this, oe, An).call(this));
|
|
7717
7721
|
} while (b);
|
|
7718
|
-
}), K(this, Sn, (i) => {
|
|
7719
|
-
$(this, ge, void 0), !(i.name === "AbortError" || i.type === "aborted") && he(this, oe, On).call(this, wn(i));
|
|
7720
7722
|
}), K(this, vn, (i) => {
|
|
7723
|
+
$(this, ge, void 0), !(i.name === "AbortError" || i.type === "aborted") && he(this, oe, An).call(this, Tn(i));
|
|
7724
|
+
}), K(this, En, (i) => {
|
|
7721
7725
|
typeof i.id == "string" && $(this, st, i.id);
|
|
7722
7726
|
const o = new MessageEvent(i.event || "message", {
|
|
7723
7727
|
data: i.data,
|
|
@@ -7725,10 +7729,10 @@ class vt extends EventTarget {
|
|
|
7725
7729
|
lastEventId: i.id || ""
|
|
7726
7730
|
});
|
|
7727
7731
|
k(this, xe) && (!i.event || i.event === "message") && k(this, xe).call(this, o), this.dispatchEvent(o);
|
|
7728
|
-
}), K(this,
|
|
7732
|
+
}), K(this, On, (i) => {
|
|
7729
7733
|
$(this, rt, i);
|
|
7730
|
-
}), K(this,
|
|
7731
|
-
$(this, $e, void 0), k(this, Y) === this.CONNECTING && he(this, oe,
|
|
7734
|
+
}), K(this, kn, () => {
|
|
7735
|
+
$(this, $e, void 0), k(this, Y) === this.CONNECTING && he(this, oe, mn).call(this);
|
|
7732
7736
|
});
|
|
7733
7737
|
try {
|
|
7734
7738
|
if (e instanceof URL)
|
|
@@ -7741,9 +7745,9 @@ class vt extends EventTarget {
|
|
|
7741
7745
|
throw Su("An invalid or illegal string was specified");
|
|
7742
7746
|
}
|
|
7743
7747
|
$(this, Re, Tu({
|
|
7744
|
-
onEvent: k(this,
|
|
7745
|
-
onRetry: k(this,
|
|
7746
|
-
})), $(this, Y, this.CONNECTING), $(this, rt, 3e3), $(this, Pt, (r = n == null ? void 0 : n.fetch) != null ? r : globalThis.fetch), $(this, St, (s = n == null ? void 0 : n.withCredentials) != null ? s : !1), he(this, oe,
|
|
7748
|
+
onEvent: k(this, En),
|
|
7749
|
+
onRetry: k(this, On)
|
|
7750
|
+
})), $(this, Y, this.CONNECTING), $(this, rt, 3e3), $(this, Pt, (r = n == null ? void 0 : n.fetch) != null ? r : globalThis.fetch), $(this, St, (s = n == null ? void 0 : n.withCredentials) != null ? s : !1), he(this, oe, mn).call(this);
|
|
7747
7751
|
}
|
|
7748
7752
|
/**
|
|
7749
7753
|
* Returns the state of this EventSource object's connection. It can have the values described below.
|
|
@@ -7821,9 +7825,9 @@ Y = /* @__PURE__ */ new WeakMap(), Se = /* @__PURE__ */ new WeakMap(), je = /* @
|
|
|
7821
7825
|
*
|
|
7822
7826
|
* @internal
|
|
7823
7827
|
*/
|
|
7824
|
-
|
|
7825
|
-
$(this, Y, this.CONNECTING), $(this, ge, new AbortController()), k(this, Pt)(k(this, Se), he(this, oe, Yr).call(this)).then(k(this,
|
|
7826
|
-
},
|
|
7828
|
+
mn = function() {
|
|
7829
|
+
$(this, Y, this.CONNECTING), $(this, ge, new AbortController()), k(this, Pt)(k(this, Se), he(this, oe, Yr).call(this)).then(k(this, Sn)).catch(k(this, vn));
|
|
7830
|
+
}, Sn = /* @__PURE__ */ new WeakMap(), vn = /* @__PURE__ */ new WeakMap(), /**
|
|
7827
7831
|
* Get request options for the `fetch()` request
|
|
7828
7832
|
*
|
|
7829
7833
|
* @returns The request options
|
|
@@ -7841,7 +7845,7 @@ Yr = function() {
|
|
|
7841
7845
|
signal: (t = k(this, ge)) == null ? void 0 : t.signal
|
|
7842
7846
|
};
|
|
7843
7847
|
return "window" in globalThis && (e.credentials = this.withCredentials ? "include" : "same-origin"), e;
|
|
7844
|
-
},
|
|
7848
|
+
}, En = /* @__PURE__ */ new WeakMap(), On = /* @__PURE__ */ new WeakMap(), /**
|
|
7845
7849
|
* Handles the process referred to in the EventSource specification as "failing a connection".
|
|
7846
7850
|
*
|
|
7847
7851
|
* @param error - The error causing the connection to fail
|
|
@@ -7860,14 +7864,14 @@ Xe = function(t, e) {
|
|
|
7860
7864
|
* @param code - The HTTP status code, if available
|
|
7861
7865
|
* @internal
|
|
7862
7866
|
*/
|
|
7863
|
-
|
|
7867
|
+
An = function(t, e) {
|
|
7864
7868
|
var n;
|
|
7865
7869
|
if (k(this, Y) === this.CLOSED)
|
|
7866
7870
|
return;
|
|
7867
7871
|
$(this, Y, this.CONNECTING);
|
|
7868
7872
|
const r = new Hr("error", { code: e, message: t });
|
|
7869
|
-
(n = k(this, Ue)) == null || n.call(this, r), this.dispatchEvent(r), $(this, $e, setTimeout(k(this,
|
|
7870
|
-
},
|
|
7873
|
+
(n = k(this, Ue)) == null || n.call(this, r), this.dispatchEvent(r), $(this, $e, setTimeout(k(this, kn), k(this, rt)));
|
|
7874
|
+
}, kn = /* @__PURE__ */ new WeakMap(), /**
|
|
7871
7875
|
* ReadyState representing an EventSource currently trying to connect
|
|
7872
7876
|
*
|
|
7873
7877
|
* @public
|
|
@@ -7896,7 +7900,7 @@ function Eu(t) {
|
|
|
7896
7900
|
useDateObjects: t.useDateObjects ?? !1
|
|
7897
7901
|
};
|
|
7898
7902
|
return new Ws(e, {
|
|
7899
|
-
"@instantdb/react":
|
|
7903
|
+
"@instantdb/react": Kn
|
|
7900
7904
|
});
|
|
7901
7905
|
}
|
|
7902
7906
|
const Ru = Eu;
|