@instantdb/react 0.22.105-experimental.drewh-typesafe-lookup-syntax.21149330970.1 → 0.22.105-experimental.drewh-clief.21154267631.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 +715 -717
- package/dist/standalone/index.umd.cjs +12 -12
- 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
|
|
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);
|
|
@@ -44,14 +44,14 @@ const U = {
|
|
|
44
44
|
Remove: "remove",
|
|
45
45
|
Replace: "replace",
|
|
46
46
|
Add: "add"
|
|
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 hr(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) {
|
|
@@ -76,9 +76,9 @@ function Ae(t) {
|
|
|
76
76
|
return !!P(t);
|
|
77
77
|
}
|
|
78
78
|
function P(t) {
|
|
79
|
-
return typeof t != "object" ? null : t == null ? void 0 : t[
|
|
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;
|
|
@@ -89,7 +89,7 @@ function ce(t, e) {
|
|
|
89
89
|
let n;
|
|
90
90
|
return Object.getPrototypeOf(t) === Object.prototype || Array.isArray(t) || t instanceof Map || t instanceof Set || !!(e != null && e.mark) && ((n = e.mark(t, ne)) === ne.immutable || typeof n == "function");
|
|
91
91
|
}
|
|
92
|
-
function
|
|
92
|
+
function ns(t, e = []) {
|
|
93
93
|
if (Object.hasOwnProperty.call(t, "key")) {
|
|
94
94
|
const n = t.parent.copy, r = P(ye(n, t.key));
|
|
95
95
|
if (r !== null && (r == null ? void 0 : r.original) !== t.original)
|
|
@@ -100,7 +100,7 @@ function rs(t, e = []) {
|
|
|
100
100
|
e.push(i);
|
|
101
101
|
}
|
|
102
102
|
if (t.parent)
|
|
103
|
-
return
|
|
103
|
+
return ns(t.parent, e);
|
|
104
104
|
e.reverse();
|
|
105
105
|
try {
|
|
106
106
|
mi(t.copy, e);
|
|
@@ -118,14 +118,14 @@ function ye(t, e) {
|
|
|
118
118
|
function at(t, e, n) {
|
|
119
119
|
ke(t) === 2 ? t.set(e, n) : t[e] = n;
|
|
120
120
|
}
|
|
121
|
-
function
|
|
121
|
+
function Vt(t, e) {
|
|
122
122
|
const n = P(t);
|
|
123
123
|
return (n ? te(n) : t)[e];
|
|
124
124
|
}
|
|
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()();
|
|
@@ -161,18 +161,18 @@ function Si(t) {
|
|
|
161
161
|
}), e;
|
|
162
162
|
}
|
|
163
163
|
const vi = Object.prototype.propertyIsEnumerable;
|
|
164
|
-
function
|
|
164
|
+
function rs(t, e) {
|
|
165
165
|
let n;
|
|
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
|
}
|
|
@@ -197,11 +197,11 @@ function ss(t, e) {
|
|
|
197
197
|
throw new Error("Please check mark() to ensure that it is a stable marker draftable function.");
|
|
198
198
|
}
|
|
199
199
|
function Q(t) {
|
|
200
|
-
t.copy || (t.copy =
|
|
200
|
+
t.copy || (t.copy = rs(t.original, t.options));
|
|
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) => {
|
|
@@ -297,11 +297,11 @@ function Rn(t, e) {
|
|
|
297
297
|
} else
|
|
298
298
|
t.forEach((r, s) => e(s, r, t));
|
|
299
299
|
}
|
|
300
|
-
function
|
|
300
|
+
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);
|
|
@@ -309,7 +309,7 @@ function is(t, e, n) {
|
|
|
309
309
|
const u = !((a = c.assignedMap) === null || a === void 0) && a.size || c.operated ? c.copy : c.original;
|
|
310
310
|
at(r ? s : t, i, u);
|
|
311
311
|
} else
|
|
312
|
-
|
|
312
|
+
ss(o, e, n);
|
|
313
313
|
}), s) {
|
|
314
314
|
const i = t, o = Array.from(i);
|
|
315
315
|
i.clear(), o.forEach((a) => {
|
|
@@ -319,30 +319,30 @@ function is(t, e, n) {
|
|
|
319
319
|
}
|
|
320
320
|
function Ei(t, e) {
|
|
321
321
|
const n = t.type === 3 ? t.setMap : t.copy;
|
|
322
|
-
t.finalities.revoke.length > 1 && t.assignedMap.get(e) && n &&
|
|
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
|
-
const i =
|
|
332
|
+
const i = ns(t);
|
|
333
333
|
i && e(t, i, n, r);
|
|
334
334
|
}
|
|
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;
|
|
@@ -448,10 +448,10 @@ function ot(t, e, n, r) {
|
|
|
448
448
|
return ki(t, e, n, r, s);
|
|
449
449
|
}
|
|
450
450
|
}
|
|
451
|
-
const
|
|
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 Ot = (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))
|
|
@@ -486,9 +486,9 @@ const Ot = (t, e, n = !1) => {
|
|
|
486
486
|
get(t) {
|
|
487
487
|
var e, n;
|
|
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
|
-
if (r.options.strict &&
|
|
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 Ot = (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)
|
|
@@ -540,8 +540,8 @@ const Ot = (t, e, n = !1) => {
|
|
|
540
540
|
const o = i.value;
|
|
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
|
-
if (t.options.strict &&
|
|
544
|
-
const l =
|
|
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 = Cn.createDraft({
|
|
545
545
|
original: o,
|
|
546
546
|
parentDraft: t,
|
|
547
547
|
key: o,
|
|
@@ -554,7 +554,7 @@ const Ot = (t, e, n = !1) => {
|
|
|
554
554
|
done: !1,
|
|
555
555
|
value: n ? a : [a, a]
|
|
556
556
|
};
|
|
557
|
-
},
|
|
557
|
+
}, Ot = {
|
|
558
558
|
get size() {
|
|
559
559
|
return P(this).setMap.size;
|
|
560
560
|
},
|
|
@@ -568,7 +568,7 @@ const Ot = (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 Ot = (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 Ot = (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
|
};
|
|
@@ -620,7 +620,7 @@ const Ot = (t, e, n = !1) => {
|
|
|
620
620
|
t.call(e, r.value, r.value, this), r = n.next();
|
|
621
621
|
}
|
|
622
622
|
};
|
|
623
|
-
Set.prototype.difference && Object.assign(
|
|
623
|
+
Set.prototype.difference && Object.assign(Ot, {
|
|
624
624
|
intersection(t) {
|
|
625
625
|
return Set.prototype.intersection.call(new Set(this.values()), t);
|
|
626
626
|
},
|
|
@@ -643,47 +643,47 @@ Set.prototype.difference && Object.assign(At, {
|
|
|
643
643
|
return Set.prototype.isDisjointFrom.call(new Set(this.values()), t);
|
|
644
644
|
}
|
|
645
645
|
});
|
|
646
|
-
const Pi = Reflect.ownKeys(
|
|
646
|
+
const Pi = Reflect.ownKeys(Ot), is = /* @__PURE__ */ new WeakSet(), os = {
|
|
647
647
|
get(t, e, n) {
|
|
648
648
|
var r, s;
|
|
649
649
|
const i = (r = t.copy) === null || r === void 0 ? void 0 : r[e];
|
|
650
|
-
if (i &&
|
|
650
|
+
if (i && is.has(i))
|
|
651
651
|
return i;
|
|
652
|
-
if (e ===
|
|
652
|
+
if (e === ts)
|
|
653
653
|
return t;
|
|
654
654
|
let o;
|
|
655
655
|
if (t.options.mark) {
|
|
656
656
|
const u = e === "size" && (t.original instanceof Map || t.original instanceof Set) ? Reflect.get(t.original, e) : Reflect.get(t.original, e, n);
|
|
657
657
|
if (o = t.options.mark(u, ne), o === ne.mutable)
|
|
658
|
-
return t.options.strict &&
|
|
658
|
+
return t.options.strict && Et(u, t.options, !0), u;
|
|
659
659
|
}
|
|
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
|
}
|
|
668
668
|
if (a instanceof Set && Pi.includes(e)) {
|
|
669
669
|
if (e === "size")
|
|
670
|
-
return Object.getOwnPropertyDescriptor(
|
|
671
|
-
const u =
|
|
670
|
+
return Object.getOwnPropertyDescriptor(Ot, "size").get.call(t.proxy);
|
|
671
|
+
const u = Ot[e];
|
|
672
672
|
if (u)
|
|
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)
|
|
680
680
|
) : void 0;
|
|
681
681
|
}
|
|
682
682
|
const c = a[e];
|
|
683
|
-
if (t.options.strict &&
|
|
683
|
+
if (t.options.strict && Et(c, t.options), t.finalized || !ce(c, t.options))
|
|
684
684
|
return c;
|
|
685
|
-
if (c ===
|
|
686
|
-
if (Q(t), t.copy[e] =
|
|
685
|
+
if (c === Vt(t.original, 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(At), os = /* @__PURE__ */ new WeakSet(), as = {
|
|
|
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
|
-
const 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,
|
|
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, Rn(t, e, n, ot)), !0);
|
|
712
712
|
},
|
|
713
713
|
has(t, e) {
|
|
714
714
|
return e in te(t);
|
|
@@ -736,10 +736,10 @@ const Pi = Reflect.ownKeys(At), os = /* @__PURE__ */ new WeakSet(), as = {
|
|
|
736
736
|
},
|
|
737
737
|
deleteProperty(t, e) {
|
|
738
738
|
var n;
|
|
739
|
-
return t.type === 1 ?
|
|
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,
|
|
@@ -753,8 +753,8 @@ function $n(t) {
|
|
|
753
753
|
setMap: o === 3 ? new Map(e.entries()) : void 0
|
|
754
754
|
};
|
|
755
755
|
(r || "key" in t) && (a.key = r);
|
|
756
|
-
const { proxy: c, revoke: u } = Proxy.revocable(o === 1 ? Object.assign([], a) : a,
|
|
757
|
-
if (s.revoke.push(u),
|
|
756
|
+
const { proxy: c, revoke: u } = Proxy.revocable(o === 1 ? Object.assign([], a) : a, os);
|
|
757
|
+
if (s.revoke.push(u), is.add(c), a.proxy = c, n) {
|
|
758
758
|
const l = n;
|
|
759
759
|
l.finalities.draft.push((f, h) => {
|
|
760
760
|
var y, b;
|
|
@@ -763,7 +763,7 @@ function $n(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 $n(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,10 +826,10 @@ function an(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
|
-
function
|
|
832
|
+
function as(t) {
|
|
833
833
|
var e;
|
|
834
834
|
const n = P(t);
|
|
835
835
|
if (!ce(t, n == null ? void 0 : n.options))
|
|
@@ -839,7 +839,7 @@ function cs(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,21 +850,21 @@ function cs(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
|
-
const c =
|
|
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
|
-
return
|
|
867
|
+
return as(t);
|
|
868
868
|
}
|
|
869
869
|
const ji = (t) => function e(n, r, s) {
|
|
870
870
|
var i, o, a;
|
|
@@ -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,26 +928,26 @@ 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();
|
|
940
|
-
function
|
|
940
|
+
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
|
-
return typeof t != "object" || typeof e != "object" || t === null || e === null ? t === e :
|
|
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 = {};
|
|
@@ -955,7 +955,7 @@ function Dn(t) {
|
|
|
955
955
|
r !== void 0 && (e[n] = r);
|
|
956
956
|
return e;
|
|
957
957
|
}
|
|
958
|
-
function
|
|
958
|
+
function us(t, e) {
|
|
959
959
|
if (!He(t) || !He(e))
|
|
960
960
|
return e;
|
|
961
961
|
const n = { ...t };
|
|
@@ -967,7 +967,7 @@ function ls(t, e) {
|
|
|
967
967
|
continue;
|
|
968
968
|
}
|
|
969
969
|
const s = He(t[r]) && He(e[r]);
|
|
970
|
-
n[r] = s ?
|
|
970
|
+
n[r] = s ? us(t[r], e[r]) : e[r];
|
|
971
971
|
}
|
|
972
972
|
return n;
|
|
973
973
|
}
|
|
@@ -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 || {};
|
|
@@ -995,7 +995,7 @@ function _r(t, e, n) {
|
|
|
995
995
|
}
|
|
996
996
|
r[e[e.length - 1]] = n;
|
|
997
997
|
}
|
|
998
|
-
function
|
|
998
|
+
function ls(t, e) {
|
|
999
999
|
if (!t || e.length === 0)
|
|
1000
1000
|
return;
|
|
1001
1001
|
const [n, ...r] = e;
|
|
@@ -1004,13 +1004,13 @@ function fs(t, e) {
|
|
|
1004
1004
|
Array.isArray(t) ? t.splice(n, 1) : delete t[n];
|
|
1005
1005
|
return;
|
|
1006
1006
|
}
|
|
1007
|
-
|
|
1007
|
+
ls(t[n], r), xi(t[n]) && delete t[n];
|
|
1008
1008
|
}
|
|
1009
1009
|
}
|
|
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,19 +1313,19 @@ function cn(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
|
}
|
|
1320
1320
|
}
|
|
1321
|
-
function
|
|
1321
|
+
function It(t) {
|
|
1322
1322
|
if (t !== void 0) {
|
|
1323
1323
|
if (t === null)
|
|
1324
1324
|
return null;
|
|
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) {
|
|
@@ -1441,7 +1441,7 @@ function Z(t, e, n) {
|
|
|
1441
1441
|
}
|
|
1442
1442
|
s > -1 && r.set(e[s], n);
|
|
1443
1443
|
}
|
|
1444
|
-
function
|
|
1444
|
+
function fs(t, e, n) {
|
|
1445
1445
|
const r = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map();
|
|
1446
1446
|
for (const o of e) {
|
|
1447
1447
|
let [a, c, u] = o;
|
|
@@ -1450,11 +1450,11 @@ function ds(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 =
|
|
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
|
}
|
|
1457
|
-
function
|
|
1457
|
+
function ds(t) {
|
|
1458
1458
|
return {
|
|
1459
1459
|
triples: X(t.eav, 3),
|
|
1460
1460
|
cardinalityInference: t.cardinalityInference,
|
|
@@ -1462,10 +1462,10 @@ function hs(t) {
|
|
|
1462
1462
|
version: 1
|
|
1463
1463
|
};
|
|
1464
1464
|
}
|
|
1465
|
-
function
|
|
1465
|
+
function hs(t, e) {
|
|
1466
1466
|
return Je(t, e.triples, e.cardinalityInference, e.useDateObjects);
|
|
1467
1467
|
}
|
|
1468
|
-
function
|
|
1468
|
+
function ps(t, e) {
|
|
1469
1469
|
if (t)
|
|
1470
1470
|
return new Ee(t.attrs, t.linkIndex);
|
|
1471
1471
|
if (e && "__type" in e)
|
|
@@ -1475,7 +1475,7 @@ function Xi(t, e) {
|
|
|
1475
1475
|
return Ke(t.eav, [e]) !== void 0;
|
|
1476
1476
|
}
|
|
1477
1477
|
function Je(t, e, n, r) {
|
|
1478
|
-
const s =
|
|
1478
|
+
const s = fs(t, e, r);
|
|
1479
1479
|
return s.cardinalityInference = n, s.useDateObjects = r, s;
|
|
1480
1480
|
}
|
|
1481
1481
|
function ct(t, e) {
|
|
@@ -1505,21 +1505,21 @@ function ct(t, e) {
|
|
|
1505
1505
|
return [n, ...a];
|
|
1506
1506
|
}
|
|
1507
1507
|
}
|
|
1508
|
-
function
|
|
1508
|
+
function ys(t, e, n) {
|
|
1509
1509
|
const r = ct(t, 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
|
-
function
|
|
1516
|
+
function bs(t, e, n) {
|
|
1517
1517
|
const [r, s, i] = n;
|
|
1518
1518
|
let o;
|
|
1519
1519
|
const a = Ke(t.eav, [r, s, i]);
|
|
1520
1520
|
return a && (o = a[3]), o || Date.now() * 10 + eo++;
|
|
1521
1521
|
}
|
|
1522
|
-
function
|
|
1522
|
+
function gs(t, e, n) {
|
|
1523
1523
|
const r = ct(t, n);
|
|
1524
1524
|
if (!r)
|
|
1525
1525
|
return;
|
|
@@ -1527,9 +1527,9 @@ function _s(t, e, n) {
|
|
|
1527
1527
|
const a = e.getAttr(i);
|
|
1528
1528
|
if (!a)
|
|
1529
1529
|
return;
|
|
1530
|
-
a["checked-data-type"] === "date" && t.useDateObjects && (o =
|
|
1531
|
-
const c = Ke(t.eav, [s, i, o]), u = (c == null ? void 0 : c[3]) ??
|
|
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)),
|
|
1530
|
+
a["checked-data-type"] === "date" && t.useDateObjects && (o = It(o));
|
|
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)), 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)
|
|
@@ -1547,15 +1547,15 @@ function to(t, e, n) {
|
|
|
1547
1547
|
const u = (y = c.values().next()) == null ? void 0 : y.value;
|
|
1548
1548
|
if (!u)
|
|
1549
1549
|
return;
|
|
1550
|
-
const l = u[2], f =
|
|
1550
|
+
const l = u[2], f = us(l, o), h = [
|
|
1551
1551
|
s,
|
|
1552
1552
|
i,
|
|
1553
1553
|
f,
|
|
1554
|
-
|
|
1554
|
+
bs(t, a, u)
|
|
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 un(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,11 +1579,11 @@ function un(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
|
-
function
|
|
1586
|
-
const r =
|
|
1585
|
+
function _s(t, e, n) {
|
|
1586
|
+
const r = fs(e, n, t.useDateObjects);
|
|
1587
1587
|
Object.keys(r).forEach((s) => {
|
|
1588
1588
|
t[s] = r[s];
|
|
1589
1589
|
});
|
|
@@ -1591,32 +1591,32 @@ function ws(t, e, n) {
|
|
|
1591
1591
|
function no(t, [e]) {
|
|
1592
1592
|
t.addAttr(e);
|
|
1593
1593
|
}
|
|
1594
|
-
function
|
|
1594
|
+
function ws(t) {
|
|
1595
1595
|
return X(t.eav, 3);
|
|
1596
1596
|
}
|
|
1597
1597
|
function ro(t, e, [n]) {
|
|
1598
1598
|
if (!e.getAttr(n))
|
|
1599
1599
|
return;
|
|
1600
|
-
const r =
|
|
1601
|
-
e.deleteAttr(n),
|
|
1600
|
+
const r = ws(t).filter(([s, i]) => i !== n);
|
|
1601
|
+
e.deleteAttr(n), _s(t, e, r);
|
|
1602
1602
|
}
|
|
1603
1603
|
function so(t, e, [n]) {
|
|
1604
|
-
e.getAttr(n.id) && (e.updateAttr(n),
|
|
1604
|
+
e.getAttr(n.id) && (e.updateAttr(n), _s(t, e, ws(t)));
|
|
1605
1605
|
}
|
|
1606
1606
|
function io(t, e, n) {
|
|
1607
1607
|
const [r, ...s] = n;
|
|
1608
1608
|
switch (r) {
|
|
1609
1609
|
case "add-triple":
|
|
1610
|
-
|
|
1610
|
+
gs(t, e, s);
|
|
1611
1611
|
break;
|
|
1612
1612
|
case "deep-merge-triple":
|
|
1613
1613
|
to(t, e, s);
|
|
1614
1614
|
break;
|
|
1615
1615
|
case "retract-triple":
|
|
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);
|
|
@@ -1755,7 +1755,7 @@ function Ce(t, e, n) {
|
|
|
1755
1755
|
function uo(t, e) {
|
|
1756
1756
|
return t.blobAttrs.get(e);
|
|
1757
1757
|
}
|
|
1758
|
-
function
|
|
1758
|
+
function Ts(t, e) {
|
|
1759
1759
|
var r;
|
|
1760
1760
|
const n = t.primaryKeys.get(e);
|
|
1761
1761
|
return n || ((r = t.forwardIdents.get(e)) == null ? void 0 : r.get("id"));
|
|
@@ -1778,7 +1778,7 @@ function fo(t, e, n) {
|
|
|
1778
1778
|
let l = !1;
|
|
1779
1779
|
const f = e.getAttr(o);
|
|
1780
1780
|
if (f) {
|
|
1781
|
-
const h =
|
|
1781
|
+
const h = Ts(e, f["forward-identity"][1]);
|
|
1782
1782
|
l = !!lo(t, e, [
|
|
1783
1783
|
i,
|
|
1784
1784
|
h == null ? void 0 : h.id,
|
|
@@ -1787,7 +1787,7 @@ function fo(t, e, n) {
|
|
|
1787
1787
|
}
|
|
1788
1788
|
return !(u === "create" && l || u === "update" && !l);
|
|
1789
1789
|
});
|
|
1790
|
-
return
|
|
1790
|
+
return At({ store: t, attrsStore: e }, (s) => {
|
|
1791
1791
|
r.forEach((i) => {
|
|
1792
1792
|
io(s.store, s.attrsStore, i);
|
|
1793
1793
|
});
|
|
@@ -1804,19 +1804,19 @@ function ho(t) {
|
|
|
1804
1804
|
function po(t, e, n) {
|
|
1805
1805
|
if (n.hasOwnProperty(t)) {
|
|
1806
1806
|
const r = n[t];
|
|
1807
|
-
return
|
|
1807
|
+
return ms(r, 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 = [
|
|
@@ -1833,32 +1833,32 @@ function go(t) {
|
|
|
1833
1833
|
return !0;
|
|
1834
1834
|
return !1;
|
|
1835
1835
|
}
|
|
1836
|
-
function
|
|
1836
|
+
function ms(t, e, n) {
|
|
1837
1837
|
return n ? typeof t == "object" ? go(t) ? n : null : yo(t)(t, e, n) : null;
|
|
1838
1838
|
}
|
|
1839
1839
|
function _o(t, e, n) {
|
|
1840
1840
|
return t.reduce((r, s, i) => {
|
|
1841
1841
|
const o = e[i];
|
|
1842
|
-
return
|
|
1842
|
+
return ms(s, o, r);
|
|
1843
1843
|
}, n);
|
|
1844
1844
|
}
|
|
1845
1845
|
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) {
|
|
@@ -1870,28 +1870,28 @@ for (let t = 0; t < 256; ++t)
|
|
|
1870
1870
|
function Eo(t, e = 0) {
|
|
1871
1871
|
return (z[t[e + 0]] + z[t[e + 1]] + z[t[e + 2]] + z[t[e + 3]] + "-" + z[t[e + 4]] + z[t[e + 5]] + "-" + z[t[e + 6]] + z[t[e + 7]] + "-" + z[t[e + 8]] + z[t[e + 9]] + "-" + z[t[e + 10]] + z[t[e + 11]] + z[t[e + 12]] + z[t[e + 13]] + z[t[e + 14]] + z[t[e + 15]]).toLowerCase();
|
|
1872
1872
|
}
|
|
1873
|
-
let
|
|
1873
|
+
let Bt;
|
|
1874
1874
|
const Oo = new Uint8Array(16);
|
|
1875
1875
|
function Ao() {
|
|
1876
|
-
if (!
|
|
1876
|
+
if (!Bt) {
|
|
1877
1877
|
if (typeof crypto > "u" || !crypto.getRandomValues)
|
|
1878
1878
|
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
1879
|
-
|
|
1879
|
+
Bt = crypto.getRandomValues.bind(crypto);
|
|
1880
1880
|
}
|
|
1881
|
-
return
|
|
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();
|
|
@@ -1927,9 +1927,9 @@ function jo() {
|
|
|
1927
1927
|
const Ro = jo();
|
|
1928
1928
|
let xo = 0;
|
|
1929
1929
|
function tt(t) {
|
|
1930
|
-
return
|
|
1930
|
+
return Mt(`_${t}`, xo++);
|
|
1931
1931
|
}
|
|
1932
|
-
function
|
|
1932
|
+
function Mt(t, e) {
|
|
1933
1933
|
return `?${t}-${e}`;
|
|
1934
1934
|
}
|
|
1935
1935
|
class Fe extends Error {
|
|
@@ -1938,12 +1938,12 @@ class Fe extends Error {
|
|
|
1938
1938
|
}
|
|
1939
1939
|
}
|
|
1940
1940
|
function $o(t, e) {
|
|
1941
|
-
const n =
|
|
1941
|
+
const n = Ts(t, e);
|
|
1942
1942
|
if (!n)
|
|
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) {
|
|
@@ -1957,7 +1957,7 @@ function Do(t, e, n, r) {
|
|
|
1957
1957
|
function Uo(t, e, n) {
|
|
1958
1958
|
return t.map((r) => r === e ? n : r);
|
|
1959
1959
|
}
|
|
1960
|
-
function
|
|
1960
|
+
function Ss(t, e, n, r, s) {
|
|
1961
1961
|
const i = N(e, n, s), o = Ce(e, n, s), a = i || o;
|
|
1962
1962
|
if (!a)
|
|
1963
1963
|
throw new Fe(`Could not find attr for ${[n, s]}`);
|
|
@@ -1976,7 +1976,7 @@ function vs(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) {
|
|
@@ -2070,12 +2070,12 @@ function Fo(t, e, n, r, s, i) {
|
|
|
2070
2070
|
}
|
|
2071
2071
|
function No(t, e, n, r, s) {
|
|
2072
2072
|
const [i, o, a] = s.reduce((c, u) => {
|
|
2073
|
-
const [l, f, h] = c, [y, b, g] =
|
|
2073
|
+
const [l, f, h] = c, [y, b, g] = Ss(t, e, l, f, u);
|
|
2074
2074
|
return [y, b, [...h, g]];
|
|
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,10 +2094,10 @@ 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
|
-
return
|
|
2100
|
+
return vs(l, n, r, s, c);
|
|
2101
2101
|
});
|
|
2102
2102
|
return { [e]: { patterns: a, joinSym: o } };
|
|
2103
2103
|
}
|
|
@@ -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
|
-
function
|
|
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,22 +2135,22 @@ function Es(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
|
-
const s =
|
|
2147
|
-
return r ?
|
|
2146
|
+
const s = Mt;
|
|
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)];
|
|
2151
2151
|
}
|
|
2152
2152
|
function Qo(t, e, n, r, s, i) {
|
|
2153
|
-
const [o, a, c, u, l] =
|
|
2153
|
+
const [o, a, c, u, l] = Ss(t, e, n, r, s), f = Uo(c, t(n, r), i);
|
|
2154
2154
|
return [o, a, f, u, l];
|
|
2155
2155
|
}
|
|
2156
2156
|
function Ho(t, e, n, { etype: r, level: s, form: i }, o) {
|
|
@@ -2160,7 +2160,7 @@ function Ho(t, e, n, { etype: r, level: s, form: i }, o) {
|
|
|
2160
2160
|
var g, w, m;
|
|
2161
2161
|
const b = !!(e.cardinalityInference && ((m = (w = (g = n.linkIndex) == null ? void 0 : g[r]) == null ? void 0 : w[y]) != null && m.isSingular));
|
|
2162
2162
|
try {
|
|
2163
|
-
const [_, S, O] = Qo(t, n, r, s, y, u), E =
|
|
2163
|
+
const [_, S, O] = Qo(t, n, r, s, y, u), E = Os(e, n, {
|
|
2164
2164
|
etype: _,
|
|
2165
2165
|
level: S,
|
|
2166
2166
|
form: i[y],
|
|
@@ -2183,19 +2183,19 @@ function Jo(t, e, n) {
|
|
|
2183
2183
|
function Ye(t, e, n, r, s) {
|
|
2184
2184
|
return e === r || e == null && r == null ? Io(t, n) : r == null ? 1 : e == null ? -1 : Jo(e, r, s);
|
|
2185
2185
|
}
|
|
2186
|
-
function
|
|
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) {
|
|
2193
2193
|
var b;
|
|
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
|
-
return
|
|
2197
|
-
const [u, l] = r, f = e["checked-data-type"], h = f === "date" ?
|
|
2198
|
-
return
|
|
2196
|
+
return kt(r, [s, a], null) === c;
|
|
2197
|
+
const [u, l] = r, f = e["checked-data-type"], h = f === "date" ? fn(l) : l, y = f === "date" ? fn(o) : o;
|
|
2198
|
+
return kt([u, h], [s, y], f) === c;
|
|
2199
2199
|
}
|
|
2200
2200
|
function Zo(t, e) {
|
|
2201
2201
|
const n = e[1];
|
|
@@ -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];
|
|
@@ -2228,7 +2228,7 @@ function ta(t, e, n) {
|
|
|
2228
2228
|
}
|
|
2229
2229
|
function na(t, e, { etype: n, pageInfo: r, dq: s, form: i }) {
|
|
2230
2230
|
var b, g;
|
|
2231
|
-
const o = (b = i == null ? void 0 : i.$) == null ? void 0 : b.order, a =
|
|
2231
|
+
const o = (b = i == null ? void 0 : i.$) == null ? void 0 : b.order, a = Es(i), c = ra(i);
|
|
2232
2232
|
let u = mo(t, s);
|
|
2233
2233
|
const l = r == null ? void 0 : r["start-cursor"], f = ea(e, n, l, o);
|
|
2234
2234
|
if (f && ((g = f == null ? void 0 : f["forward-identity"]) == null ? void 0 : g[2]) !== "id") {
|
|
@@ -2236,13 +2236,13 @@ 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, _) {
|
|
2243
|
-
return
|
|
2243
|
+
return kt(m, _, f == null ? void 0 : f["checked-data-type"]);
|
|
2244
2244
|
} : function(m, _) {
|
|
2245
|
-
return
|
|
2245
|
+
return kt(_, m, f == null ? void 0 : f["checked-data-type"]);
|
|
2246
2246
|
});
|
|
2247
2247
|
let h = {};
|
|
2248
2248
|
const y = ta(e, n, s);
|
|
@@ -2260,16 +2260,16 @@ function ra(t) {
|
|
|
2260
2260
|
const e = (n = t.$) == null ? void 0 : n.order;
|
|
2261
2261
|
return e && e[Object.keys(e)[0]] || "asc";
|
|
2262
2262
|
}
|
|
2263
|
-
function
|
|
2263
|
+
function Es(t) {
|
|
2264
2264
|
var s, i, o;
|
|
2265
2265
|
const e = (s = t.$) == null ? void 0 : s.offset, n = (i = t.$) == null ? void 0 : i.before, r = (o = t.$) == null ? void 0 : o.after;
|
|
2266
2266
|
return !e && !n && !r;
|
|
2267
2267
|
}
|
|
2268
2268
|
function sa(t, e, { etype: n, level: r, form: s, join: i, pageInfo: o }) {
|
|
2269
2269
|
var h, y, b, g, w;
|
|
2270
|
-
if (!
|
|
2270
|
+
if (!Es(s) && (!o || !o["start-cursor"]))
|
|
2271
2271
|
return [];
|
|
2272
|
-
const a = Ko(Bo(e, n, r, (h = s.$) == null ? void 0 : h.where), i), c = Go(
|
|
2272
|
+
const a = Ko(Bo(e, n, r, (h = s.$) == null ? void 0 : h.where), i), c = Go(Mt, n, r), u = (y = s.$) == null ? void 0 : y.fields, l = na(t, e, {
|
|
2273
2273
|
etype: n,
|
|
2274
2274
|
pageInfo: o,
|
|
2275
2275
|
form: s,
|
|
@@ -2291,9 +2291,9 @@ function ia(t, e, n) {
|
|
|
2291
2291
|
throw r;
|
|
2292
2292
|
}
|
|
2293
2293
|
}
|
|
2294
|
-
function
|
|
2294
|
+
function Os(t, e, n) {
|
|
2295
2295
|
const r = ia(t, e, n);
|
|
2296
|
-
return Ho(
|
|
2296
|
+
return Ho(Mt, t, e, n, r);
|
|
2297
2297
|
}
|
|
2298
2298
|
function oa(t) {
|
|
2299
2299
|
const e = {};
|
|
@@ -2306,9 +2306,9 @@ function oa(t) {
|
|
|
2306
2306
|
};
|
|
2307
2307
|
return e;
|
|
2308
2308
|
}
|
|
2309
|
-
function
|
|
2309
|
+
function As({ store: t, attrsStore: e, pageInfo: n, aggregate: r }, s) {
|
|
2310
2310
|
const o = { data: Object.keys(s).reduce(function(c, u) {
|
|
2311
|
-
return r != null && r[u] || u === "$$ruleParams" || (c[u] =
|
|
2311
|
+
return r != null && r[u] || u === "$$ruleParams" || (c[u] = Os(t, e, {
|
|
2312
2312
|
etype: u,
|
|
2313
2313
|
form: s[u],
|
|
2314
2314
|
level: 0,
|
|
@@ -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,49 +2344,47 @@ function mt(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
|
]);
|
|
2351
2351
|
}
|
|
2352
2352
|
});
|
|
2353
2353
|
}
|
|
2354
|
-
function
|
|
2354
|
+
function Iu(t, e) {
|
|
2355
2355
|
return `lookup__${t}__${JSON.stringify(e)}`;
|
|
2356
2356
|
}
|
|
2357
|
-
function
|
|
2357
|
+
function Ct(t) {
|
|
2358
2358
|
return t.startsWith("lookup__");
|
|
2359
2359
|
}
|
|
2360
|
-
function
|
|
2360
|
+
function ks(t) {
|
|
2361
2361
|
const [e, n, ...r] = t.split("__");
|
|
2362
2362
|
return [n, JSON.parse(r.join("__"))];
|
|
2363
2363
|
}
|
|
2364
|
-
function
|
|
2364
|
+
function ua(t) {
|
|
2365
2365
|
return new Proxy({
|
|
2366
2366
|
__etype: t
|
|
2367
2367
|
}, {
|
|
2368
2368
|
get(e, n) {
|
|
2369
|
-
if (n === "lookup")
|
|
2370
|
-
return (s, i) => mt(t, hn(ua(s, i)), []);
|
|
2371
2369
|
if (n === "__etype")
|
|
2372
2370
|
return t;
|
|
2373
2371
|
const r = n;
|
|
2374
|
-
return
|
|
2372
|
+
return Ct(r) ? dn(t, ks(r), []) : dn(t, r, []);
|
|
2375
2373
|
}
|
|
2376
2374
|
});
|
|
2377
2375
|
}
|
|
2378
|
-
function
|
|
2376
|
+
function Fn() {
|
|
2379
2377
|
return new Proxy({}, {
|
|
2380
2378
|
get(t, e) {
|
|
2381
|
-
return
|
|
2379
|
+
return ua(e);
|
|
2382
2380
|
}
|
|
2383
2381
|
});
|
|
2384
2382
|
}
|
|
2385
|
-
const Mu =
|
|
2386
|
-
function
|
|
2383
|
+
const Mu = Fn();
|
|
2384
|
+
function la(t) {
|
|
2387
2385
|
return t.__ops;
|
|
2388
2386
|
}
|
|
2389
|
-
function
|
|
2387
|
+
function fa(t, e) {
|
|
2390
2388
|
const { attrIdMap: n, refSwapAttrIds: r } = t, s = [];
|
|
2391
2389
|
for (const o of e) {
|
|
2392
2390
|
const a = n[o];
|
|
@@ -2405,7 +2403,7 @@ function da(t, e) {
|
|
|
2405
2403
|
}
|
|
2406
2404
|
return s;
|
|
2407
2405
|
}
|
|
2408
|
-
function
|
|
2406
|
+
function da(t) {
|
|
2409
2407
|
if (Array.isArray(t))
|
|
2410
2408
|
return t;
|
|
2411
2409
|
const e = Object.entries(t);
|
|
@@ -2413,33 +2411,33 @@ function ha(t) {
|
|
|
2413
2411
|
throw new Error("lookup must be an object with a single unique attr and value.");
|
|
2414
2412
|
return e[0];
|
|
2415
2413
|
}
|
|
2416
|
-
function
|
|
2414
|
+
function ha(t, e, n) {
|
|
2417
2415
|
return n.indexOf(".") !== -1 && // attr names can have `.` in them, so use the attr we find with a `.`
|
|
2418
2416
|
// before assuming it's a ref lookup.
|
|
2419
2417
|
!N(t, e, n);
|
|
2420
2418
|
}
|
|
2421
|
-
function
|
|
2419
|
+
function hn(t) {
|
|
2422
2420
|
const [e, n, ...r] = t.split(".");
|
|
2423
2421
|
if (r.length > 0 || n !== "id")
|
|
2424
2422
|
throw new Error(`${t} is not a valid lookup attribute.`);
|
|
2425
2423
|
return e;
|
|
2426
2424
|
}
|
|
2427
|
-
function
|
|
2428
|
-
if (!
|
|
2425
|
+
function pa(t, e, n) {
|
|
2426
|
+
if (!ha(t, e, n))
|
|
2429
2427
|
return N(t, e, n);
|
|
2430
|
-
const r =
|
|
2428
|
+
const r = hn(n), s = N(t, e, r) || Ce(t, e, r);
|
|
2431
2429
|
if (s && s["value-type"] !== "ref")
|
|
2432
2430
|
throw new Error(`${n} does not reference a valid link attribute.`);
|
|
2433
2431
|
return s;
|
|
2434
2432
|
}
|
|
2435
|
-
function
|
|
2436
|
-
return typeof t == "string" && !
|
|
2433
|
+
function pn(t) {
|
|
2434
|
+
return typeof t == "string" && !Ct(t) ? null : typeof t == "string" && Ct(t) ? ks(t) : da(t);
|
|
2437
2435
|
}
|
|
2438
2436
|
function ee(t, e, n) {
|
|
2439
|
-
const r =
|
|
2437
|
+
const r = pn(n);
|
|
2440
2438
|
if (r === null)
|
|
2441
2439
|
return n;
|
|
2442
|
-
const [s, i] = r, o =
|
|
2440
|
+
const [s, i] = r, o = pa(t, e, s);
|
|
2443
2441
|
if (!o || !o["unique?"])
|
|
2444
2442
|
throw new Error(`${s} is not a unique attribute.`);
|
|
2445
2443
|
return [o.id, i];
|
|
@@ -2454,7 +2452,7 @@ function Cs(t, e, n, r) {
|
|
|
2454
2452
|
s
|
|
2455
2453
|
]].concat(r) : r;
|
|
2456
2454
|
}
|
|
2457
|
-
function
|
|
2455
|
+
function ya({ attrsStore: t }, [e, n, r]) {
|
|
2458
2456
|
const s = Object.entries(r).flatMap(([i, o]) => {
|
|
2459
2457
|
const a = Array.isArray(o) ? o : [o], c = N(t, e, i), u = Ce(t, e, i);
|
|
2460
2458
|
return a.map((l) => c ? [
|
|
@@ -2475,7 +2473,7 @@ function ba({ attrsStore: t }, [e, n, r]) {
|
|
|
2475
2473
|
});
|
|
2476
2474
|
return Cs(t, e, n, s);
|
|
2477
2475
|
}
|
|
2478
|
-
function
|
|
2476
|
+
function ba({ attrsStore: t }, [e, n, r]) {
|
|
2479
2477
|
const s = Object.entries(r).flatMap(([i, o]) => {
|
|
2480
2478
|
const a = Array.isArray(o) ? o : [o], c = N(t, e, i), u = Ce(t, e, i);
|
|
2481
2479
|
return a.map((l) => c ? [
|
|
@@ -2496,7 +2494,7 @@ function ga({ attrsStore: t }, [e, n, r]) {
|
|
|
2496
2494
|
});
|
|
2497
2495
|
return Cs(t, e, n, s);
|
|
2498
2496
|
}
|
|
2499
|
-
function
|
|
2497
|
+
function ga(t, e, n, r) {
|
|
2500
2498
|
var s;
|
|
2501
2499
|
if (Array.isArray(r)) {
|
|
2502
2500
|
const [i, o] = r;
|
|
@@ -2520,20 +2518,20 @@ function _a(t, e, n, r) {
|
|
|
2520
2518
|
return !1;
|
|
2521
2519
|
}
|
|
2522
2520
|
function Ps({ stores: t, attrsStore: e }, [n, r, s, i]) {
|
|
2523
|
-
return (i == null ? void 0 : i.upsert) === !1 ? { mode: "update" } : (i == null ? void 0 : i.upsert) === !0 ? null :
|
|
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;
|
|
2524
2522
|
}
|
|
2525
|
-
function
|
|
2526
|
-
const { attrsStore: n } = t, [r, s, i, o] = e, a =
|
|
2523
|
+
function _a(t, e) {
|
|
2524
|
+
const { attrsStore: n } = t, [r, s, i, o] = e, a = $n(i), c = ee(n, r, s);
|
|
2527
2525
|
return [["id", c]].concat(Object.entries(a)).map(([l, f]) => {
|
|
2528
2526
|
const h = N(n, r, l);
|
|
2529
|
-
return h["checked-data-type"] === "date" && t.useDateObjects && (f =
|
|
2527
|
+
return h["checked-data-type"] === "date" && t.useDateObjects && (f = It(f)), ["add-triple", c, h.id, f, { mode: "create" }];
|
|
2530
2528
|
});
|
|
2531
2529
|
}
|
|
2532
|
-
function
|
|
2533
|
-
const { attrsStore: n } = t, [r, s, i, o] = e, a =
|
|
2530
|
+
function wa(t, e) {
|
|
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]);
|
|
2534
2532
|
return [["id", c]].concat(Object.entries(a)).map(([f, h]) => {
|
|
2535
2533
|
const y = N(n, r, f);
|
|
2536
|
-
return y["checked-data-type"] === "date" && t.useDateObjects && (h =
|
|
2534
|
+
return y["checked-data-type"] === "date" && t.useDateObjects && (h = It(h)), [
|
|
2537
2535
|
"add-triple",
|
|
2538
2536
|
c,
|
|
2539
2537
|
y.id,
|
|
@@ -2542,11 +2540,11 @@ function Ta(t, e) {
|
|
|
2542
2540
|
];
|
|
2543
2541
|
});
|
|
2544
2542
|
}
|
|
2545
|
-
function
|
|
2543
|
+
function Ta({ attrsStore: t }, [e, n]) {
|
|
2546
2544
|
return [["delete-entity", ee(t, e, n), e]];
|
|
2547
2545
|
}
|
|
2548
|
-
function
|
|
2549
|
-
const { attrsStore: n } = t, [r, s, i, o] = e, a =
|
|
2546
|
+
function ma(t, e) {
|
|
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]) => {
|
|
2550
2548
|
const b = N(n, r, h);
|
|
2551
2549
|
return [
|
|
2552
2550
|
"deep-merge-triple",
|
|
@@ -2564,38 +2562,38 @@ function Sa(t, e) {
|
|
|
2564
2562
|
...u ? [u] : []
|
|
2565
2563
|
]].concat(l);
|
|
2566
2564
|
}
|
|
2567
|
-
function
|
|
2565
|
+
function Sa({ attrsStore: t }, [e, n, r]) {
|
|
2568
2566
|
return [["rule-params", ee(t, e, n), e, r]];
|
|
2569
2567
|
}
|
|
2570
|
-
function
|
|
2568
|
+
function va(t) {
|
|
2571
2569
|
const [e, n, r, s, i] = t;
|
|
2572
2570
|
if (!s)
|
|
2573
2571
|
return t;
|
|
2574
2572
|
const o = { ...s };
|
|
2575
2573
|
return delete o.id, [e, n, r, o, ...i ? [i] : []];
|
|
2576
2574
|
}
|
|
2577
|
-
function
|
|
2578
|
-
const [n, ...r] =
|
|
2575
|
+
function Ea(t, e) {
|
|
2576
|
+
const [n, ...r] = va(e);
|
|
2579
2577
|
switch (n) {
|
|
2580
2578
|
case "merge":
|
|
2581
|
-
return
|
|
2579
|
+
return ma(t, r);
|
|
2582
2580
|
case "create":
|
|
2583
|
-
return
|
|
2581
|
+
return _a(t, r);
|
|
2584
2582
|
case "update":
|
|
2585
|
-
return
|
|
2583
|
+
return wa(t, r);
|
|
2586
2584
|
case "link":
|
|
2587
|
-
return
|
|
2585
|
+
return ya(t, r);
|
|
2588
2586
|
case "unlink":
|
|
2589
|
-
return
|
|
2587
|
+
return ba(t, r);
|
|
2590
2588
|
case "delete":
|
|
2591
|
-
return
|
|
2589
|
+
return Ta(t, r);
|
|
2592
2590
|
case "ruleParams":
|
|
2593
|
-
return
|
|
2591
|
+
return Sa(t, r);
|
|
2594
2592
|
default:
|
|
2595
2593
|
throw new Error(`unsupported action ${n}`);
|
|
2596
2594
|
}
|
|
2597
2595
|
}
|
|
2598
|
-
function
|
|
2596
|
+
function Oa(t) {
|
|
2599
2597
|
switch (t) {
|
|
2600
2598
|
case "string":
|
|
2601
2599
|
case "date":
|
|
@@ -2606,14 +2604,14 @@ function Aa(t) {
|
|
|
2606
2604
|
return;
|
|
2607
2605
|
}
|
|
2608
2606
|
}
|
|
2609
|
-
function
|
|
2607
|
+
function Aa(t, e, n) {
|
|
2610
2608
|
var a, c;
|
|
2611
2609
|
const r = (c = (a = t.entities[e]) == null ? void 0 : a.attrs) == null ? void 0 : c[n];
|
|
2612
2610
|
if (n === "id")
|
|
2613
2611
|
return null;
|
|
2614
2612
|
if (!r)
|
|
2615
2613
|
throw new Error(`${e}.${n} does not exist in your schema`);
|
|
2616
|
-
const { unique: s, indexed: i } = r == null ? void 0 : r.config, o =
|
|
2614
|
+
const { unique: s, indexed: i } = r == null ? void 0 : r.config, o = Oa(r == null ? void 0 : r.valueType);
|
|
2617
2615
|
return {
|
|
2618
2616
|
"index?": i,
|
|
2619
2617
|
"unique?": s,
|
|
@@ -2621,7 +2619,7 @@ function ka(t, e, n) {
|
|
|
2621
2619
|
};
|
|
2622
2620
|
}
|
|
2623
2621
|
function yt(t, e, n, r) {
|
|
2624
|
-
const s = t ?
|
|
2622
|
+
const s = t ? Aa(t, e, n) : null, i = W(), a = [W(), e, n];
|
|
2625
2623
|
return {
|
|
2626
2624
|
id: i,
|
|
2627
2625
|
"forward-identity": a,
|
|
@@ -2634,11 +2632,11 @@ function yt(t, e, n, r) {
|
|
|
2634
2632
|
...r || {}
|
|
2635
2633
|
};
|
|
2636
2634
|
}
|
|
2637
|
-
function
|
|
2635
|
+
function ka(t, e, n) {
|
|
2638
2636
|
return Object.values(t.links).find((i) => i.forward.on === e && i.forward.label === n || i.reverse.on === e && i.reverse.label === n);
|
|
2639
2637
|
}
|
|
2640
|
-
function
|
|
2641
|
-
const r =
|
|
2638
|
+
function Ca(t, e, n) {
|
|
2639
|
+
const r = ka(t, e, n);
|
|
2642
2640
|
if (!r)
|
|
2643
2641
|
throw new Error(`Couldn't find the link ${e}.${n} in your schema`);
|
|
2644
2642
|
const { forward: s, reverse: i } = r;
|
|
@@ -2651,8 +2649,8 @@ function Pa(t, e, n) {
|
|
|
2651
2649
|
"on-delete-reverse": i.onDelete
|
|
2652
2650
|
};
|
|
2653
2651
|
}
|
|
2654
|
-
function
|
|
2655
|
-
const s = t ?
|
|
2652
|
+
function Ar(t, e, n, r) {
|
|
2653
|
+
const s = t ? Ca(t, e, n) : null, i = W(), o = [W(), e, n], a = [W(), n, e];
|
|
2656
2654
|
return {
|
|
2657
2655
|
id: i,
|
|
2658
2656
|
// @ts-ignore: ts thinks it's any[]
|
|
@@ -2669,7 +2667,7 @@ function kr(t, e, n, r) {
|
|
|
2669
2667
|
...r || {}
|
|
2670
2668
|
};
|
|
2671
2669
|
}
|
|
2672
|
-
const
|
|
2670
|
+
const Pa = /* @__PURE__ */ new Set(["create", "update", "merge", "link", "unlink"]), Ia = /* @__PURE__ */ new Set(["link", "unlink"]), Ma = /* @__PURE__ */ new Set(["create", "update", "merge"]), ja = /* @__PURE__ */ new Set([
|
|
2673
2671
|
"link",
|
|
2674
2672
|
"unlink",
|
|
2675
2673
|
"create",
|
|
@@ -2677,20 +2675,20 @@ const Ia = /* @__PURE__ */ new Set(["create", "update", "merge", "link", "unlink
|
|
|
2677
2675
|
"merge",
|
|
2678
2676
|
"delete",
|
|
2679
2677
|
"ruleParams"
|
|
2680
|
-
]),
|
|
2681
|
-
...
|
|
2678
|
+
]), yn = { "unique?": !0, "index?": !0 }, Ra = {
|
|
2679
|
+
...yn,
|
|
2682
2680
|
cardinality: "one"
|
|
2683
2681
|
};
|
|
2684
|
-
function
|
|
2682
|
+
function xa(t) {
|
|
2685
2683
|
const e = [], [n, r, s, i] = t;
|
|
2686
|
-
if (!
|
|
2684
|
+
if (!ja.has(n))
|
|
2687
2685
|
return e;
|
|
2688
|
-
const o =
|
|
2686
|
+
const o = pn(s);
|
|
2689
2687
|
if (o && e.push({ etype: r, lookupPair: o }), n === "link")
|
|
2690
2688
|
for (const [a, c] of Object.entries(i)) {
|
|
2691
2689
|
const u = Array.isArray(c) ? c : [c];
|
|
2692
2690
|
for (const l of u) {
|
|
2693
|
-
const f =
|
|
2691
|
+
const f = pn(l);
|
|
2694
2692
|
f && e.push({
|
|
2695
2693
|
etype: r,
|
|
2696
2694
|
lookupPair: f,
|
|
@@ -2700,7 +2698,7 @@ function $a(t) {
|
|
|
2700
2698
|
}
|
|
2701
2699
|
return e;
|
|
2702
2700
|
}
|
|
2703
|
-
function
|
|
2701
|
+
function $a({ attrsStore: t, schema: e }, n) {
|
|
2704
2702
|
var h, y;
|
|
2705
2703
|
const r = /* @__PURE__ */ new Set(), s = [], i = [];
|
|
2706
2704
|
function o(b, g) {
|
|
@@ -2725,10 +2723,10 @@ function Da({ attrsStore: t, schema: e }, n) {
|
|
|
2725
2723
|
}
|
|
2726
2724
|
function f(b, g) {
|
|
2727
2725
|
const w = o(b, g), m = a(b, g);
|
|
2728
|
-
u(w), u(m), !w && !m && c(
|
|
2726
|
+
u(w), u(m), !w && !m && c(Ar(e, b, g, Ra));
|
|
2729
2727
|
}
|
|
2730
2728
|
for (const b of n)
|
|
2731
|
-
for (const { etype: g, lookupPair: w, linkLabel: m } of
|
|
2729
|
+
for (const { etype: g, lookupPair: w, linkLabel: m } of xa(b)) {
|
|
2732
2730
|
const _ = w[0];
|
|
2733
2731
|
if (m) {
|
|
2734
2732
|
f(g, m);
|
|
@@ -2736,28 +2734,28 @@ function Da({ attrsStore: t, schema: e }, n) {
|
|
|
2736
2734
|
u(S), u(O);
|
|
2737
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;
|
|
2738
2736
|
if (l(E, _))
|
|
2739
|
-
f(E,
|
|
2737
|
+
f(E, hn(_));
|
|
2740
2738
|
else {
|
|
2741
2739
|
const j = o(E, _);
|
|
2742
|
-
j || c(yt(e, E, _,
|
|
2740
|
+
j || c(yt(e, E, _, yn)), u(j);
|
|
2743
2741
|
}
|
|
2744
2742
|
} else if (l(g, _))
|
|
2745
|
-
f(g,
|
|
2743
|
+
f(g, hn(_));
|
|
2746
2744
|
else {
|
|
2747
2745
|
const S = o(g, _);
|
|
2748
|
-
S || c(yt(e, g, _,
|
|
2746
|
+
S || c(yt(e, g, _, yn)), u(S);
|
|
2749
2747
|
}
|
|
2750
2748
|
}
|
|
2751
2749
|
for (const b of n) {
|
|
2752
2750
|
const [g, w, m, _] = b;
|
|
2753
|
-
if (
|
|
2751
|
+
if (Pa.has(g)) {
|
|
2754
2752
|
const S = o(w, "id");
|
|
2755
2753
|
u(S), S || c(yt(e, w, "id", { "unique?": !0 }));
|
|
2756
2754
|
for (const O of Object.keys(_)) {
|
|
2757
2755
|
const E = o(w, O);
|
|
2758
|
-
if (u(E),
|
|
2756
|
+
if (u(E), Ma.has(g) && (E || c(yt(e, w, O, O === "id" ? { "unique?": !0 } : null))), Ia.has(g)) {
|
|
2759
2757
|
const j = a(w, O);
|
|
2760
|
-
!E && !j && c(
|
|
2758
|
+
!E && !j && c(Ar(e, w, O)), u(j);
|
|
2761
2759
|
}
|
|
2762
2760
|
}
|
|
2763
2761
|
}
|
|
@@ -2770,19 +2768,19 @@ function Da({ attrsStore: t, schema: e }, n) {
|
|
|
2770
2768
|
}
|
|
2771
2769
|
return [t, i];
|
|
2772
2770
|
}
|
|
2773
|
-
function
|
|
2774
|
-
const r = (Array.isArray(e) ? e : [e]).flatMap((c) =>
|
|
2771
|
+
function Da(t, e) {
|
|
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));
|
|
2775
2773
|
return [...i, ...a];
|
|
2776
2774
|
}
|
|
2777
|
-
function
|
|
2775
|
+
function kr(t, e) {
|
|
2778
2776
|
typeof requestIdleCallback > "u" ? t() : requestIdleCallback(t, { timeout: e });
|
|
2779
2777
|
}
|
|
2780
2778
|
const nt = "__meta";
|
|
2781
|
-
class
|
|
2779
|
+
class Ua {
|
|
2782
2780
|
constructor(e, n) {
|
|
2783
2781
|
}
|
|
2784
2782
|
}
|
|
2785
|
-
class
|
|
2783
|
+
class bn {
|
|
2786
2784
|
constructor(e) {
|
|
2787
2785
|
p(this, "currentValue");
|
|
2788
2786
|
p(this, "_subs", []);
|
|
@@ -2975,7 +2973,7 @@ class gn {
|
|
|
2975
2973
|
gc() {
|
|
2976
2974
|
this._nextGc || (this._nextGc = setTimeout(
|
|
2977
2975
|
() => {
|
|
2978
|
-
|
|
2976
|
+
kr(() => {
|
|
2979
2977
|
this._nextGc = null, this._gc();
|
|
2980
2978
|
}, 30 * 1e3);
|
|
2981
2979
|
},
|
|
@@ -2990,7 +2988,7 @@ class gn {
|
|
|
2990
2988
|
return;
|
|
2991
2989
|
}
|
|
2992
2990
|
this._nextSave = setTimeout(() => {
|
|
2993
|
-
|
|
2991
|
+
kr(() => {
|
|
2994
2992
|
this._nextSave = null, this._writeToStorage(e).then(n).catch(r);
|
|
2995
2993
|
}, this._idleCallbackMaxWaitMs);
|
|
2996
2994
|
}, this._saveThrottleMs);
|
|
@@ -3004,7 +3002,7 @@ class gn {
|
|
|
3004
3002
|
// so that we know which entries we need to persist to the store.
|
|
3005
3003
|
updateInPlace(e) {
|
|
3006
3004
|
this._version++;
|
|
3007
|
-
const [n, r] =
|
|
3005
|
+
const [n, r] = At(this.currentValue, e, {
|
|
3008
3006
|
enablePatches: !0
|
|
3009
3007
|
});
|
|
3010
3008
|
for (const s of r) {
|
|
@@ -3022,13 +3020,13 @@ class gn {
|
|
|
3022
3020
|
};
|
|
3023
3021
|
}
|
|
3024
3022
|
}
|
|
3025
|
-
const
|
|
3026
|
-
function
|
|
3023
|
+
const La = 6, Fa = ["kv", "querySubs", "syncSubs"];
|
|
3024
|
+
function Na(t) {
|
|
3027
3025
|
return function(n) {
|
|
3028
3026
|
console.error("Error in IndexedDB event", { source: t, event: n });
|
|
3029
3027
|
};
|
|
3030
3028
|
}
|
|
3031
|
-
async function
|
|
3029
|
+
async function Ka(t) {
|
|
3032
3030
|
return new Promise((e) => {
|
|
3033
3031
|
const n = indexedDB.open(t);
|
|
3034
3032
|
n.onerror = (r) => {
|
|
@@ -3042,7 +3040,7 @@ async function qa(t) {
|
|
|
3042
3040
|
};
|
|
3043
3041
|
});
|
|
3044
3042
|
}
|
|
3045
|
-
async function
|
|
3043
|
+
async function qa(t, e, n) {
|
|
3046
3044
|
const r = (
|
|
3047
3045
|
// Backwards compatibility for older versions where we JSON.stringified before storing
|
|
3048
3046
|
typeof e == "string" ? JSON.parse(e) : e
|
|
@@ -3076,14 +3074,14 @@ async function Wa(t, e, n) {
|
|
|
3076
3074
|
};
|
|
3077
3075
|
});
|
|
3078
3076
|
}
|
|
3079
|
-
async function
|
|
3077
|
+
async function Cr(t, e, n) {
|
|
3080
3078
|
const r = n.put(e, t);
|
|
3081
3079
|
return new Promise((s, i) => {
|
|
3082
3080
|
r.onsuccess = () => s(), r.onerror = (o) => i(o);
|
|
3083
3081
|
});
|
|
3084
3082
|
}
|
|
3085
|
-
async function
|
|
3086
|
-
const n = await
|
|
3083
|
+
async function Wa(t, e) {
|
|
3084
|
+
const n = await Ka(`instant_${t}_5`);
|
|
3087
3085
|
if (!n)
|
|
3088
3086
|
return;
|
|
3089
3087
|
const r = await new Promise((l, f) => {
|
|
@@ -3106,12 +3104,12 @@ async function za(t, e) {
|
|
|
3106
3104
|
for (const [l, f] of r)
|
|
3107
3105
|
switch (l) {
|
|
3108
3106
|
case "querySubs": {
|
|
3109
|
-
const h =
|
|
3107
|
+
const h = qa(l, f, o);
|
|
3110
3108
|
a.push(h);
|
|
3111
3109
|
break;
|
|
3112
3110
|
}
|
|
3113
3111
|
default: {
|
|
3114
|
-
const h =
|
|
3112
|
+
const h = Cr(l, f, i);
|
|
3115
3113
|
a.push(h);
|
|
3116
3114
|
const y = {
|
|
3117
3115
|
createdAt: Date.now(),
|
|
@@ -3122,13 +3120,13 @@ async function za(t, e) {
|
|
|
3122
3120
|
break;
|
|
3123
3121
|
}
|
|
3124
3122
|
}
|
|
3125
|
-
const u =
|
|
3123
|
+
const u = Cr(nt, c, i);
|
|
3126
3124
|
a.push(u), await Promise.all(a), await new Promise((l, f) => {
|
|
3127
3125
|
s.oncomplete = (h) => l(h), s.onerror = (h) => f(h), s.onabort = (h) => f(h);
|
|
3128
3126
|
});
|
|
3129
3127
|
}
|
|
3130
|
-
const
|
|
3131
|
-
class Is extends
|
|
3128
|
+
const Pr = /* @__PURE__ */ new Map();
|
|
3129
|
+
class Is extends Ua {
|
|
3132
3130
|
constructor(n, r) {
|
|
3133
3131
|
super(n, r);
|
|
3134
3132
|
p(this, "dbName");
|
|
@@ -3136,7 +3134,7 @@ class Is extends La {
|
|
|
3136
3134
|
p(this, "_appId");
|
|
3137
3135
|
p(this, "_prefix");
|
|
3138
3136
|
p(this, "_dbPromise");
|
|
3139
|
-
this.dbName = `instant_${n}_${
|
|
3137
|
+
this.dbName = `instant_${n}_${La}`, this._storeName = r, this._appId = n, this._dbPromise = this._init();
|
|
3140
3138
|
}
|
|
3141
3139
|
_init() {
|
|
3142
3140
|
return new Promise((n, r) => {
|
|
@@ -3147,12 +3145,12 @@ class Is extends La {
|
|
|
3147
3145
|
}, i.onsuccess = (o) => {
|
|
3148
3146
|
const c = o.target.result;
|
|
3149
3147
|
if (s) {
|
|
3150
|
-
const u =
|
|
3151
|
-
|
|
3148
|
+
const u = Wa(this._appId, c).catch((l) => {
|
|
3149
|
+
Na("Error upgrading store from version 5 to 6.")(l);
|
|
3152
3150
|
});
|
|
3153
|
-
|
|
3151
|
+
Pr.set(this.dbName, u), u.then(() => n(c)).catch(() => n(c));
|
|
3154
3152
|
} else {
|
|
3155
|
-
const u =
|
|
3153
|
+
const u = Pr.get(this.dbName);
|
|
3156
3154
|
u ? u.then(() => n(c)).catch(() => n(c)) : n(c);
|
|
3157
3155
|
}
|
|
3158
3156
|
}, i.onupgradeneeded = (o) => {
|
|
@@ -3162,7 +3160,7 @@ class Is extends La {
|
|
|
3162
3160
|
}
|
|
3163
3161
|
_upgradeStore(n) {
|
|
3164
3162
|
const s = n.target.result;
|
|
3165
|
-
for (const i of
|
|
3163
|
+
for (const i of Fa)
|
|
3166
3164
|
s.objectStoreNames.contains(i) || s.createObjectStore(i);
|
|
3167
3165
|
}
|
|
3168
3166
|
async getItem(n) {
|
|
@@ -3254,7 +3252,7 @@ class Ne extends Error {
|
|
|
3254
3252
|
return "InstantError";
|
|
3255
3253
|
}
|
|
3256
3254
|
}
|
|
3257
|
-
class
|
|
3255
|
+
class jt extends Ne {
|
|
3258
3256
|
constructor(n) {
|
|
3259
3257
|
var i;
|
|
3260
3258
|
const r = ((i = n.body) == null ? void 0 : i.message) || `API Error (${n.status})`;
|
|
@@ -3262,7 +3260,7 @@ class Rt extends Ne {
|
|
|
3262
3260
|
p(this, "body");
|
|
3263
3261
|
p(this, "status");
|
|
3264
3262
|
const s = new.target.prototype;
|
|
3265
|
-
Object.setPrototypeOf && Object.setPrototypeOf(this, s), Error.captureStackTrace && Error.captureStackTrace(this,
|
|
3263
|
+
Object.setPrototypeOf && Object.setPrototypeOf(this, s), Error.captureStackTrace && Error.captureStackTrace(this, jt), this.name = "InstantAPIError", this.status = n.status, this.body = n.body;
|
|
3266
3264
|
}
|
|
3267
3265
|
get [Symbol.toStringTag]() {
|
|
3268
3266
|
return "InstantAPIError";
|
|
@@ -3270,16 +3268,16 @@ class Rt extends Ne {
|
|
|
3270
3268
|
}
|
|
3271
3269
|
async function ue(t, e) {
|
|
3272
3270
|
const n = await fetch(t, e), r = await n.json();
|
|
3273
|
-
return n.status === 200 ? Promise.resolve(r) : Promise.reject(new
|
|
3271
|
+
return n.status === 200 ? Promise.resolve(r) : Promise.reject(new jt({ status: n.status, body: r }));
|
|
3274
3272
|
}
|
|
3275
|
-
function
|
|
3273
|
+
function za({ apiURI: t, appId: e, email: n }) {
|
|
3276
3274
|
return ue(`${t}/runtime/auth/send_magic_code`, {
|
|
3277
3275
|
method: "POST",
|
|
3278
3276
|
headers: { "content-type": "application/json" },
|
|
3279
3277
|
body: JSON.stringify({ "app-id": e, email: n })
|
|
3280
3278
|
});
|
|
3281
3279
|
}
|
|
3282
|
-
async function
|
|
3280
|
+
async function Va({ apiURI: t, appId: e, email: n, code: r, refreshToken: s }) {
|
|
3283
3281
|
return await ue(`${t}/runtime/auth/verify_magic_code`, {
|
|
3284
3282
|
method: "POST",
|
|
3285
3283
|
headers: { "content-type": "application/json" },
|
|
@@ -3291,7 +3289,7 @@ async function Ba({ apiURI: t, appId: e, email: n, code: r, refreshToken: s }) {
|
|
|
3291
3289
|
})
|
|
3292
3290
|
});
|
|
3293
3291
|
}
|
|
3294
|
-
async function
|
|
3292
|
+
async function Ba({ apiURI: t, appId: e, refreshToken: n }) {
|
|
3295
3293
|
return await ue(`${t}/runtime/auth/verify_refresh_token`, {
|
|
3296
3294
|
method: "POST",
|
|
3297
3295
|
headers: { "content-type": "application/json" },
|
|
@@ -3301,7 +3299,7 @@ async function Ga({ apiURI: t, appId: e, refreshToken: n }) {
|
|
|
3301
3299
|
})
|
|
3302
3300
|
});
|
|
3303
3301
|
}
|
|
3304
|
-
async function
|
|
3302
|
+
async function Ga({ apiURI: t, appId: e }) {
|
|
3305
3303
|
return await ue(`${t}/runtime/auth/sign_in_guest`, {
|
|
3306
3304
|
method: "POST",
|
|
3307
3305
|
headers: { "content-type": "application/json" },
|
|
@@ -3310,7 +3308,7 @@ async function Qa({ apiURI: t, appId: e }) {
|
|
|
3310
3308
|
})
|
|
3311
3309
|
});
|
|
3312
3310
|
}
|
|
3313
|
-
async function
|
|
3311
|
+
async function Ir({ apiURI: t, appId: e, code: n, codeVerifier: r, refreshToken: s }) {
|
|
3314
3312
|
return await ue(`${t}/runtime/oauth/token`, {
|
|
3315
3313
|
method: "POST",
|
|
3316
3314
|
headers: { "content-type": "application/json" },
|
|
@@ -3322,7 +3320,7 @@ async function Mr({ apiURI: t, appId: e, code: n, codeVerifier: r, refreshToken:
|
|
|
3322
3320
|
})
|
|
3323
3321
|
});
|
|
3324
3322
|
}
|
|
3325
|
-
async function
|
|
3323
|
+
async function Qa({ apiURI: t, appId: e, nonce: n, idToken: r, clientName: s, refreshToken: i }) {
|
|
3326
3324
|
return await ue(`${t}/runtime/oauth/id_token`, {
|
|
3327
3325
|
method: "POST",
|
|
3328
3326
|
headers: { "content-type": "application/json" },
|
|
@@ -3335,7 +3333,7 @@ async function Ha({ apiURI: t, appId: e, nonce: n, idToken: r, clientName: s, re
|
|
|
3335
3333
|
})
|
|
3336
3334
|
});
|
|
3337
3335
|
}
|
|
3338
|
-
async function
|
|
3336
|
+
async function Ha({ apiURI: t, appId: e, refreshToken: n }) {
|
|
3339
3337
|
return await ue(`${t}/runtime/signout`, {
|
|
3340
3338
|
method: "POST",
|
|
3341
3339
|
headers: {
|
|
@@ -3347,7 +3345,7 @@ async function Ja({ apiURI: t, appId: e, refreshToken: n }) {
|
|
|
3347
3345
|
})
|
|
3348
3346
|
});
|
|
3349
3347
|
}
|
|
3350
|
-
async function
|
|
3348
|
+
async function Ja({ apiURI: t, appId: e, path: n, file: r, refreshToken: s, contentType: i, contentDisposition: o }) {
|
|
3351
3349
|
const a = {
|
|
3352
3350
|
app_id: e,
|
|
3353
3351
|
path: n,
|
|
@@ -3360,7 +3358,7 @@ async function Ya({ apiURI: t, appId: e, path: n, file: r, refreshToken: s, cont
|
|
|
3360
3358
|
body: r
|
|
3361
3359
|
});
|
|
3362
3360
|
}
|
|
3363
|
-
async function
|
|
3361
|
+
async function Ya({ apiURI: t, appId: e, path: n, refreshToken: r }) {
|
|
3364
3362
|
const { data: s } = await ue(`${t}/storage/files?app_id=${e}&filename=${encodeURIComponent(n)}`, {
|
|
3365
3363
|
method: "DELETE",
|
|
3366
3364
|
headers: {
|
|
@@ -3370,7 +3368,7 @@ async function Za({ apiURI: t, appId: e, path: n, refreshToken: r }) {
|
|
|
3370
3368
|
});
|
|
3371
3369
|
return s;
|
|
3372
3370
|
}
|
|
3373
|
-
async function
|
|
3371
|
+
async function Za({ apiURI: t, appId: e, fileName: n, refreshToken: r, metadata: s = {} }) {
|
|
3374
3372
|
const { data: i } = await ue(`${t}/storage/signed-upload-url`, {
|
|
3375
3373
|
method: "POST",
|
|
3376
3374
|
headers: {
|
|
@@ -3384,7 +3382,7 @@ async function Xa({ apiURI: t, appId: e, fileName: n, refreshToken: r, metadata:
|
|
|
3384
3382
|
});
|
|
3385
3383
|
return i;
|
|
3386
3384
|
}
|
|
3387
|
-
async function
|
|
3385
|
+
async function Xa(t, e) {
|
|
3388
3386
|
return (await fetch(t, {
|
|
3389
3387
|
method: "PUT",
|
|
3390
3388
|
body: e,
|
|
@@ -3393,7 +3391,7 @@ async function ec(t, e) {
|
|
|
3393
3391
|
}
|
|
3394
3392
|
})).ok;
|
|
3395
3393
|
}
|
|
3396
|
-
async function
|
|
3394
|
+
async function ec({ apiURI: t, appId: e, path: n, refreshToken: r }) {
|
|
3397
3395
|
const { data: s } = await ue(`${t}/storage/signed-download-url?app_id=${e}&filename=${encodeURIComponent(n)}`, {
|
|
3398
3396
|
method: "GET",
|
|
3399
3397
|
headers: {
|
|
@@ -3403,9 +3401,9 @@ async function tc({ apiURI: t, appId: e, path: n, refreshToken: r }) {
|
|
|
3403
3401
|
});
|
|
3404
3402
|
return s;
|
|
3405
3403
|
}
|
|
3406
|
-
let
|
|
3407
|
-
typeof window < "u" && typeof window.localStorage < "u" && (
|
|
3408
|
-
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) {
|
|
3409
3407
|
if (!e)
|
|
3410
3408
|
return t;
|
|
3411
3409
|
const n = {};
|
|
@@ -3413,32 +3411,32 @@ function jr(t, e) {
|
|
|
3413
3411
|
n[r] = t[r];
|
|
3414
3412
|
}), n;
|
|
3415
3413
|
}
|
|
3416
|
-
function
|
|
3414
|
+
function tc(t, e, n) {
|
|
3417
3415
|
const r = {
|
|
3418
3416
|
peers: {}
|
|
3419
3417
|
};
|
|
3420
3418
|
if (e && "user" in e ? e.user : !0) {
|
|
3421
|
-
const i =
|
|
3419
|
+
const i = Mr(t.user ?? {}, e == null ? void 0 : e.keys);
|
|
3422
3420
|
r.user = { ...i, peerId: n };
|
|
3423
3421
|
}
|
|
3424
3422
|
for (const i of Object.keys(t.peers ?? {})) {
|
|
3425
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));
|
|
3426
3424
|
if (o || a) {
|
|
3427
|
-
const c =
|
|
3425
|
+
const c = Mr(t.peers[i], e == null ? void 0 : e.keys);
|
|
3428
3426
|
r.peers[i] = { ...c, peerId: i };
|
|
3429
3427
|
}
|
|
3430
3428
|
}
|
|
3431
3429
|
return r;
|
|
3432
3430
|
}
|
|
3433
|
-
function
|
|
3434
|
-
if (t.isLoading !== e.isLoading || t.error !== e.error || (t.user || e.user) && (!t.user || !e.user || !
|
|
3431
|
+
function nc(t, e) {
|
|
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))
|
|
3435
3433
|
return !0;
|
|
3436
3434
|
for (const r of Object.keys(t.peers))
|
|
3437
|
-
if (!
|
|
3435
|
+
if (!br(t.peers[r], e.peers[r]))
|
|
3438
3436
|
return !0;
|
|
3439
3437
|
return !1;
|
|
3440
3438
|
}
|
|
3441
|
-
class
|
|
3439
|
+
class jr {
|
|
3442
3440
|
constructor() {
|
|
3443
3441
|
p(this, "promise");
|
|
3444
3442
|
p(this, "_resolve");
|
|
@@ -3463,11 +3461,11 @@ function xs(t, e = []) {
|
|
|
3463
3461
|
xs(n["child-nodes"], e);
|
|
3464
3462
|
});
|
|
3465
3463
|
}
|
|
3466
|
-
function
|
|
3464
|
+
function Rr(t) {
|
|
3467
3465
|
const e = [];
|
|
3468
3466
|
return xs(t, e), e;
|
|
3469
3467
|
}
|
|
3470
|
-
function
|
|
3468
|
+
function xr(t) {
|
|
3471
3469
|
return Object.values(t.links).reduce((e, n) => {
|
|
3472
3470
|
var r, s;
|
|
3473
3471
|
return e[r = n.forward.on] ?? (e[r] = {}), e[n.forward.on][n.forward.label] = {
|
|
@@ -3481,8 +3479,8 @@ function $r(t) {
|
|
|
3481
3479
|
}, e;
|
|
3482
3480
|
}, {});
|
|
3483
3481
|
}
|
|
3484
|
-
const
|
|
3485
|
-
function
|
|
3482
|
+
const Kn = "v0.22.105-experimental.drewh-clief.21154267631.1";
|
|
3483
|
+
function rc(t, e) {
|
|
3486
3484
|
return {
|
|
3487
3485
|
info: t ? (...n) => console.info(...n, e()) : () => {
|
|
3488
3486
|
},
|
|
@@ -3525,17 +3523,17 @@ class H {
|
|
|
3525
3523
|
});
|
|
3526
3524
|
}
|
|
3527
3525
|
}
|
|
3528
|
-
class
|
|
3526
|
+
class Rt {
|
|
3529
3527
|
constructor(e, n) {
|
|
3530
3528
|
p(this, "attrs");
|
|
3531
3529
|
p(this, "links");
|
|
3532
3530
|
this.attrs = e, this.links = n;
|
|
3533
3531
|
}
|
|
3534
3532
|
asType() {
|
|
3535
|
-
return new
|
|
3533
|
+
return new Rt(this.attrs, this.links);
|
|
3536
3534
|
}
|
|
3537
3535
|
}
|
|
3538
|
-
class
|
|
3536
|
+
class xt {
|
|
3539
3537
|
constructor(e, n, r) {
|
|
3540
3538
|
p(this, "entities");
|
|
3541
3539
|
p(this, "links");
|
|
@@ -3562,7 +3560,7 @@ class $t {
|
|
|
3562
3560
|
* @see https://instantdb.com/docs/presence-and-topics#typesafety
|
|
3563
3561
|
*/
|
|
3564
3562
|
withRoomSchema() {
|
|
3565
|
-
return new
|
|
3563
|
+
return new xt(this.entities, this.links, {});
|
|
3566
3564
|
}
|
|
3567
3565
|
}
|
|
3568
3566
|
class x extends Error {
|
|
@@ -3571,7 +3569,7 @@ class x extends Error {
|
|
|
3571
3569
|
super(r), this.name = "QueryValidationError";
|
|
3572
3570
|
}
|
|
3573
3571
|
}
|
|
3574
|
-
const
|
|
3572
|
+
const $r = [
|
|
3575
3573
|
"where",
|
|
3576
3574
|
"order",
|
|
3577
3575
|
"limit",
|
|
@@ -3582,7 +3580,7 @@ const Dr = [
|
|
|
3582
3580
|
"before",
|
|
3583
3581
|
"fields",
|
|
3584
3582
|
"aggregate"
|
|
3585
|
-
],
|
|
3583
|
+
], sc = (t) => t.valueType || "unknown", $s = (t, e, n = !1) => {
|
|
3586
3584
|
if (n || t == null)
|
|
3587
3585
|
return !0;
|
|
3588
3586
|
switch (e) {
|
|
@@ -3597,7 +3595,7 @@ const Dr = [
|
|
|
3597
3595
|
default:
|
|
3598
3596
|
return !0;
|
|
3599
3597
|
}
|
|
3600
|
-
},
|
|
3598
|
+
}, ic = (t, e, n, r, s, i, o) => {
|
|
3601
3599
|
const a = i.valueType === "json", c = (u, l, f) => {
|
|
3602
3600
|
if (!$s(f, l, a))
|
|
3603
3601
|
throw new x(`Invalid value for operator '${u}' on attribute '${r}' in entity '${s}'. Expected ${l}, but received: ${typeof f}`, o);
|
|
@@ -3630,16 +3628,16 @@ const Dr = [
|
|
|
3630
3628
|
throw new x(`Unknown operator '${t}' for attribute '${r}' in entity '${s}'`, o);
|
|
3631
3629
|
}
|
|
3632
3630
|
}, De = (t, e, n, r, s) => {
|
|
3633
|
-
const i =
|
|
3631
|
+
const i = sc(n), o = n.valueType === "json";
|
|
3634
3632
|
if (typeof t == "object" && t !== null && !Array.isArray(t)) {
|
|
3635
3633
|
if (o)
|
|
3636
3634
|
return;
|
|
3637
3635
|
const c = t;
|
|
3638
3636
|
for (const [u, l] of Object.entries(c))
|
|
3639
|
-
|
|
3637
|
+
ic(u, l, i, e, r, n, `${s}.${u}`);
|
|
3640
3638
|
} else if (!$s(t, i, o))
|
|
3641
3639
|
throw new x(`Invalid value for attribute '${e}' in entity '${r}'. Expected ${i}, but received: ${typeof t}`, s);
|
|
3642
|
-
},
|
|
3640
|
+
}, oc = (t, e, n, r, s) => {
|
|
3643
3641
|
const i = t.split(".");
|
|
3644
3642
|
if (i.length < 2)
|
|
3645
3643
|
throw new x(`Invalid dot notation path '${t}'. Must contain at least one dot.`, s);
|
|
@@ -3689,7 +3687,7 @@ const Dr = [
|
|
|
3689
3687
|
continue;
|
|
3690
3688
|
}
|
|
3691
3689
|
if (s.includes(".")) {
|
|
3692
|
-
|
|
3690
|
+
oc(s, i, e, n, `${r}.${s}`);
|
|
3693
3691
|
continue;
|
|
3694
3692
|
}
|
|
3695
3693
|
const o = n.entities[e];
|
|
@@ -3709,10 +3707,10 @@ const Dr = [
|
|
|
3709
3707
|
De(i, s, u, e, `${r}.${s}`);
|
|
3710
3708
|
}
|
|
3711
3709
|
}
|
|
3712
|
-
},
|
|
3710
|
+
}, ac = (t, e, n, r, s = 0) => {
|
|
3713
3711
|
for (const o of Object.keys(t))
|
|
3714
|
-
if (
|
|
3715
|
-
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);
|
|
3716
3714
|
const i = [
|
|
3717
3715
|
// 'limit', // only supported client side
|
|
3718
3716
|
"offset",
|
|
@@ -3748,9 +3746,9 @@ const Dr = [
|
|
|
3748
3746
|
const a = t[o];
|
|
3749
3747
|
if (typeof a != "object" || a === null)
|
|
3750
3748
|
throw new x(`Query parameter '$' must be an object in entity '${e}', but received: ${typeof a}`, `${r}.$`);
|
|
3751
|
-
|
|
3749
|
+
ac(a, e, n, `${r}.$`, s);
|
|
3752
3750
|
}
|
|
3753
|
-
},
|
|
3751
|
+
}, Dr = (t, e) => {
|
|
3754
3752
|
if (typeof t != "object" || t === null)
|
|
3755
3753
|
throw new x(`Query must be an object, but received: ${typeof t}${t === null ? " (null)" : ""}`);
|
|
3756
3754
|
if (Array.isArray(t))
|
|
@@ -3769,27 +3767,27 @@ const Dr = [
|
|
|
3769
3767
|
Us(n[r], r, e, r, 0);
|
|
3770
3768
|
}
|
|
3771
3769
|
}
|
|
3772
|
-
},
|
|
3770
|
+
}, Ur = (t) => typeof t != "string" ? !1 : Ct(t) ? !0 : Le(t);
|
|
3773
3771
|
class se extends Error {
|
|
3774
3772
|
constructor(e) {
|
|
3775
3773
|
super(e), this.name = "TransactionValidationError";
|
|
3776
3774
|
}
|
|
3777
3775
|
}
|
|
3778
|
-
const Ls = (t) => t.length > 0 ? t.join(", ") : "none",
|
|
3776
|
+
const Ls = (t) => t.length > 0 ? t.join(", ") : "none", cc = (t, e) => new se(`Entity '${t}' does not exist in schema. Available entities: ${Ls(e)}`), Gt = {
|
|
3779
3777
|
string: (t) => typeof t == "string",
|
|
3780
3778
|
number: (t) => typeof t == "number" && !isNaN(t),
|
|
3781
3779
|
boolean: (t) => typeof t == "boolean",
|
|
3782
3780
|
date: (t) => t instanceof Date || typeof t == "string" || typeof t == "number",
|
|
3783
3781
|
json: () => !0
|
|
3784
|
-
},
|
|
3782
|
+
}, uc = (t, e) => {
|
|
3785
3783
|
var n;
|
|
3786
|
-
return t == null ? !0 : ((n =
|
|
3784
|
+
return t == null ? !0 : ((n = Gt[e.valueType]) == null ? void 0 : n.call(Gt, t)) ?? !1;
|
|
3787
3785
|
}, Fs = (t, e) => {
|
|
3788
3786
|
const n = e.entities[t];
|
|
3789
3787
|
if (!n)
|
|
3790
|
-
throw
|
|
3788
|
+
throw cc(t, Object.keys(e.entities));
|
|
3791
3789
|
return n;
|
|
3792
|
-
},
|
|
3790
|
+
}, Qt = (t, e, n) => {
|
|
3793
3791
|
const r = Fs(t, n);
|
|
3794
3792
|
if (typeof e != "object" || e === null)
|
|
3795
3793
|
throw new se(`Arguments for data operation on entity '${t}' must be an object, but received: ${typeof e}`);
|
|
@@ -3797,10 +3795,10 @@ const Ls = (t) => t.length > 0 ? t.join(", ") : "none", uc = (t, e) => new se(`E
|
|
|
3797
3795
|
if (s === "id")
|
|
3798
3796
|
continue;
|
|
3799
3797
|
const o = r.attrs[s];
|
|
3800
|
-
if (o && !
|
|
3798
|
+
if (o && !uc(i, o))
|
|
3801
3799
|
throw new se(`Invalid value for attribute '${s}' in entity '${t}'. Expected ${o.valueType}, but received: ${typeof i}`);
|
|
3802
3800
|
}
|
|
3803
|
-
},
|
|
3801
|
+
}, Lr = (t, e, n) => {
|
|
3804
3802
|
const r = Fs(t, n);
|
|
3805
3803
|
if (typeof e != "object" || e === null)
|
|
3806
3804
|
throw new se(`Arguments for link operation on entity '${t}' must be an object, but received: ${typeof e}`);
|
|
@@ -3812,21 +3810,21 @@ const Ls = (t) => t.length > 0 ? t.join(", ") : "none", uc = (t, e) => new se(`E
|
|
|
3812
3810
|
if (i != null) {
|
|
3813
3811
|
if (Array.isArray(i)) {
|
|
3814
3812
|
for (const a of i)
|
|
3815
|
-
if (!
|
|
3813
|
+
if (!Ur(a))
|
|
3816
3814
|
throw new se(`Invalid entity ID in link '${s}' for entity '${t}'. Expected a UUID or a lookup, but received: ${a}`);
|
|
3817
|
-
} else if (!
|
|
3815
|
+
} else if (!Ur(i))
|
|
3818
3816
|
throw new se(`Invalid UUID in link '${s}' for entity '${t}'. Expected a UUID, but received: ${i}`);
|
|
3819
3817
|
}
|
|
3820
3818
|
}
|
|
3821
|
-
},
|
|
3822
|
-
create:
|
|
3823
|
-
update:
|
|
3824
|
-
merge:
|
|
3825
|
-
link:
|
|
3826
|
-
unlink:
|
|
3819
|
+
}, lc = {
|
|
3820
|
+
create: Qt,
|
|
3821
|
+
update: Qt,
|
|
3822
|
+
merge: Qt,
|
|
3823
|
+
link: Lr,
|
|
3824
|
+
unlink: Lr,
|
|
3827
3825
|
delete: () => {
|
|
3828
3826
|
}
|
|
3829
|
-
},
|
|
3827
|
+
}, fc = (t, e) => {
|
|
3830
3828
|
if (!e)
|
|
3831
3829
|
return;
|
|
3832
3830
|
const [n, r, s, i] = t;
|
|
@@ -3834,9 +3832,9 @@ const Ls = (t) => t.length > 0 ? t.join(", ") : "none", uc = (t, e) => new se(`E
|
|
|
3834
3832
|
throw new se(`Invalid id for entity '${r}'. Expected a UUID, but received: ${s}`);
|
|
3835
3833
|
if (typeof r != "string")
|
|
3836
3834
|
throw new se(`Entity name must be a string, but received: ${typeof r}`);
|
|
3837
|
-
const o =
|
|
3835
|
+
const o = lc[n];
|
|
3838
3836
|
o && i !== void 0 && o(r, i, e);
|
|
3839
|
-
},
|
|
3837
|
+
}, dc = (t, e) => {
|
|
3840
3838
|
const n = Array.isArray(t) ? t : [t];
|
|
3841
3839
|
for (const r of n) {
|
|
3842
3840
|
if (!r || typeof r != "object")
|
|
@@ -3846,12 +3844,12 @@ const Ls = (t) => t.length > 0 ? t.join(", ") : "none", uc = (t, e) => new se(`E
|
|
|
3846
3844
|
for (const s of r.__ops) {
|
|
3847
3845
|
if (!Array.isArray(s))
|
|
3848
3846
|
throw new se(`Transaction operation must be an array, but received: ${typeof s}`);
|
|
3849
|
-
|
|
3847
|
+
fc(s, e);
|
|
3850
3848
|
}
|
|
3851
3849
|
}
|
|
3852
3850
|
};
|
|
3853
3851
|
let Ns = 0;
|
|
3854
|
-
class
|
|
3852
|
+
class Fr {
|
|
3855
3853
|
constructor(e) {
|
|
3856
3854
|
p(this, "type", "ws");
|
|
3857
3855
|
p(this, "conn");
|
|
@@ -3886,7 +3884,7 @@ class Nr {
|
|
|
3886
3884
|
return this.conn.send(JSON.stringify(e));
|
|
3887
3885
|
}
|
|
3888
3886
|
}
|
|
3889
|
-
class
|
|
3887
|
+
class hc {
|
|
3890
3888
|
constructor(e, n) {
|
|
3891
3889
|
p(this, "type", "sse");
|
|
3892
3890
|
p(this, "initParams", null);
|
|
@@ -3982,24 +3980,24 @@ class pc {
|
|
|
3982
3980
|
this.handleClose();
|
|
3983
3981
|
}
|
|
3984
3982
|
}
|
|
3985
|
-
function
|
|
3983
|
+
function pc(t, e) {
|
|
3986
3984
|
const n = t.values;
|
|
3987
3985
|
if (n) {
|
|
3988
|
-
const r =
|
|
3986
|
+
const r = ps(n.attrsStore, null);
|
|
3989
3987
|
if (r) {
|
|
3990
3988
|
for (const s of n.entities || [])
|
|
3991
|
-
s.store.useDateObjects = e, s.store =
|
|
3989
|
+
s.store.useDateObjects = e, s.store = hs(r, s.store);
|
|
3992
3990
|
n.attrsStore = r;
|
|
3993
3991
|
}
|
|
3994
3992
|
}
|
|
3995
3993
|
return t;
|
|
3996
3994
|
}
|
|
3997
|
-
function
|
|
3995
|
+
function yc(t, e) {
|
|
3998
3996
|
var n;
|
|
3999
3997
|
if (e.values) {
|
|
4000
3998
|
const r = [];
|
|
4001
3999
|
for (const s of (n = e.values) == null ? void 0 : n.entities) {
|
|
4002
|
-
const i =
|
|
4000
|
+
const i = ds(s.store);
|
|
4003
4001
|
r.push({ ...s, store: i });
|
|
4004
4002
|
}
|
|
4005
4003
|
return {
|
|
@@ -4009,15 +4007,15 @@ function bc(t, e) {
|
|
|
4009
4007
|
} else
|
|
4010
4008
|
return e;
|
|
4011
4009
|
}
|
|
4012
|
-
function
|
|
4010
|
+
function bc(t, e, n) {
|
|
4013
4011
|
var i, o;
|
|
4014
4012
|
const r = (i = e == null ? void 0 : e.state) == null ? void 0 : i.txId, s = (o = n == null ? void 0 : n.state) == null ? void 0 : o.txId;
|
|
4015
4013
|
return r && (!s || r > s) ? e : s && (!r || s > r) ? n : e || n;
|
|
4016
4014
|
}
|
|
4017
|
-
function
|
|
4018
|
-
return
|
|
4015
|
+
function Ht(t, e, n) {
|
|
4016
|
+
return As({ store: e, attrsStore: n, pageInfo: null, aggregate: null }, t.query).data[t.table][0];
|
|
4019
4017
|
}
|
|
4020
|
-
function
|
|
4018
|
+
function Nr(t, e, n, r) {
|
|
4021
4019
|
var o;
|
|
4022
4020
|
const s = (o = N(n, t.table, "id")) == null ? void 0 : o.id;
|
|
4023
4021
|
if (!s)
|
|
@@ -4025,18 +4023,18 @@ function Kr(t, e, n, r) {
|
|
|
4025
4023
|
const i = Ke(e.eav, [r, s, r]);
|
|
4026
4024
|
return i ? i[3] : -1;
|
|
4027
4025
|
}
|
|
4028
|
-
function
|
|
4026
|
+
function Kr(t, e, n) {
|
|
4029
4027
|
for (const { action: r, triple: s } of n)
|
|
4030
4028
|
switch (r) {
|
|
4031
4029
|
case "added":
|
|
4032
|
-
|
|
4030
|
+
gs(t, e, s);
|
|
4033
4031
|
break;
|
|
4034
4032
|
case "removed":
|
|
4035
|
-
|
|
4033
|
+
ys(t, e, s);
|
|
4036
4034
|
break;
|
|
4037
4035
|
}
|
|
4038
4036
|
}
|
|
4039
|
-
function
|
|
4037
|
+
function gc(t, e, n) {
|
|
4040
4038
|
var s, i;
|
|
4041
4039
|
const r = {};
|
|
4042
4040
|
for (const { action: o, triple: a } of n) {
|
|
@@ -4064,14 +4062,14 @@ function _c(t, e, n) {
|
|
|
4064
4062
|
function bt(t, e) {
|
|
4065
4063
|
return { [t.table]: e.map((n) => n.entity) };
|
|
4066
4064
|
}
|
|
4067
|
-
function
|
|
4065
|
+
function _c(t, e) {
|
|
4068
4066
|
var r;
|
|
4069
4067
|
if (t.orderFieldType)
|
|
4070
4068
|
return t.orderFieldType;
|
|
4071
4069
|
const n = t.orderField === "serverCreatedAt" ? "number" : (r = N(e(), t.table, t.orderField)) == null ? void 0 : r["checked-data-type"];
|
|
4072
4070
|
return t.orderFieldType = n, n;
|
|
4073
4071
|
}
|
|
4074
|
-
function
|
|
4072
|
+
function wc(t, e, n) {
|
|
4075
4073
|
const r = e;
|
|
4076
4074
|
if (t.orderField === "serverCreatedAt") {
|
|
4077
4075
|
n.sort(t.orderDirection === "asc" ? function(o, a) {
|
|
@@ -4092,7 +4090,7 @@ var Te;
|
|
|
4092
4090
|
(function(t) {
|
|
4093
4091
|
t.InitialSyncBatch = "InitialSyncBatch", t.InitialSyncComplete = "InitialSyncComplete", t.LoadFromStorage = "LoadFromStorage", t.SyncTransaction = "SyncTransaction", t.Error = "Error";
|
|
4094
4092
|
})(Te || (Te = {}));
|
|
4095
|
-
class
|
|
4093
|
+
class Tc {
|
|
4096
4094
|
constructor(e, n, r, s, i, o) {
|
|
4097
4095
|
p(this, "trySend");
|
|
4098
4096
|
p(this, "subs");
|
|
@@ -4103,11 +4101,11 @@ class mc {
|
|
|
4103
4101
|
p(this, "log");
|
|
4104
4102
|
p(this, "createStore");
|
|
4105
4103
|
p(this, "getAttrs");
|
|
4106
|
-
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({
|
|
4107
4105
|
persister: n,
|
|
4108
|
-
merge:
|
|
4109
|
-
serialize:
|
|
4110
|
-
parse: (a, c) =>
|
|
4106
|
+
merge: bc,
|
|
4107
|
+
serialize: yc,
|
|
4108
|
+
parse: (a, c) => pc(c, this.config.useDateObjects),
|
|
4111
4109
|
objectSize: (a) => {
|
|
4112
4110
|
var c;
|
|
4113
4111
|
return ((c = a.values) == null ? void 0 : c.entities.length) || 0;
|
|
@@ -4228,11 +4226,11 @@ class mc {
|
|
|
4228
4226
|
o.values = a;
|
|
4229
4227
|
const c = a.entities;
|
|
4230
4228
|
for (const u of r) {
|
|
4231
|
-
const l = this.createStore(u), f =
|
|
4229
|
+
const l = this.createStore(u), f = Ht(o, l, a.attrsStore);
|
|
4232
4230
|
c.push({
|
|
4233
4231
|
store: l,
|
|
4234
4232
|
entity: f,
|
|
4235
|
-
serverCreatedAt:
|
|
4233
|
+
serverCreatedAt: Nr(o, l, a.attrsStore, f.id)
|
|
4236
4234
|
}), i.push(f);
|
|
4237
4235
|
}
|
|
4238
4236
|
this.subs.updateInPlace((u) => {
|
|
@@ -4303,8 +4301,8 @@ class mc {
|
|
|
4303
4301
|
for (let _ = 0; _ < f.length; _++) {
|
|
4304
4302
|
const S = f[_];
|
|
4305
4303
|
if (Xi(S.store, w)) {
|
|
4306
|
-
|
|
4307
|
-
const O =
|
|
4304
|
+
Kr(S.store, l.attrsStore, m);
|
|
4305
|
+
const O = Ht(s, S.store, l.attrsStore), E = gc(S.store, l.attrsStore, m)[w];
|
|
4308
4306
|
O ? (h.push({
|
|
4309
4307
|
oldEntity: S.entity,
|
|
4310
4308
|
newEntity: O,
|
|
@@ -4316,8 +4314,8 @@ class mc {
|
|
|
4316
4314
|
const y = [];
|
|
4317
4315
|
for (const [w, m] of Object.entries(u)) {
|
|
4318
4316
|
const _ = this.createStore([]);
|
|
4319
|
-
|
|
4320
|
-
const S =
|
|
4317
|
+
Kr(_, l.attrsStore, m);
|
|
4318
|
+
const S = Ht(s, _, l.attrsStore);
|
|
4321
4319
|
if (!S) {
|
|
4322
4320
|
this.log.error("No entity found after applying change", {
|
|
4323
4321
|
sub: s,
|
|
@@ -4329,14 +4327,14 @@ class mc {
|
|
|
4329
4327
|
f.push({
|
|
4330
4328
|
store: _,
|
|
4331
4329
|
entity: S,
|
|
4332
|
-
serverCreatedAt:
|
|
4330
|
+
serverCreatedAt: Nr(s, _, l.attrsStore, S.id)
|
|
4333
4331
|
}), y.push(S);
|
|
4334
4332
|
}
|
|
4335
4333
|
const b = [];
|
|
4336
4334
|
for (const w of c.sort().reverse())
|
|
4337
4335
|
b.push(f[w].entity), f.splice(w, 1);
|
|
4338
|
-
const g =
|
|
4339
|
-
|
|
4336
|
+
const g = _c(s, this.getAttrs);
|
|
4337
|
+
wc(s, g, f), this.notifyCbs(r, {
|
|
4340
4338
|
type: Te.SyncTransaction,
|
|
4341
4339
|
data: bt(s, (o = s.values) == null ? void 0 : o.entities),
|
|
4342
4340
|
added: y,
|
|
@@ -4383,39 +4381,39 @@ const de = {
|
|
|
4383
4381
|
AUTHENTICATED: "authenticated",
|
|
4384
4382
|
CLOSED: "closed",
|
|
4385
4383
|
ERRORED: "errored"
|
|
4386
|
-
},
|
|
4384
|
+
}, mc = 3e4, Sc = 3e4, vc = 200, Ec = 1e3 * 60, Oc = {
|
|
4387
4385
|
apiURI: "https://api.instantdb.com",
|
|
4388
4386
|
websocketURI: "wss://api.instantdb.com/runtime/session"
|
|
4389
|
-
},
|
|
4390
|
-
function
|
|
4387
|
+
}, Jt = "_instant_oauth_redirect", Ve = "currentUser";
|
|
4388
|
+
function Ac({ transportType: t, appId: e, apiURI: n, wsURI: r, EventSourceImpl: s }) {
|
|
4391
4389
|
if (!s)
|
|
4392
|
-
return new
|
|
4390
|
+
return new Fr(`${r}?app_id=${e}`);
|
|
4393
4391
|
switch (t) {
|
|
4394
4392
|
case "ws":
|
|
4395
|
-
return new
|
|
4393
|
+
return new Fr(`${r}?app_id=${e}`);
|
|
4396
4394
|
case "sse":
|
|
4397
|
-
return new
|
|
4395
|
+
return new hc(s, `${n}/runtime/sse?app_id=${e}`);
|
|
4398
4396
|
default:
|
|
4399
4397
|
throw new Error("Unknown transport type " + t);
|
|
4400
4398
|
}
|
|
4401
4399
|
}
|
|
4402
|
-
function
|
|
4400
|
+
function kc() {
|
|
4403
4401
|
return typeof window < "u" || typeof chrome < "u";
|
|
4404
4402
|
}
|
|
4405
|
-
const
|
|
4403
|
+
const qr = {
|
|
4406
4404
|
"set-presence": !0,
|
|
4407
4405
|
"set-presence-ok": !0,
|
|
4408
4406
|
"refresh-presence": !0,
|
|
4409
4407
|
"patch-presence": !0
|
|
4410
4408
|
};
|
|
4411
|
-
function
|
|
4409
|
+
function Cc(t, e) {
|
|
4412
4410
|
var r;
|
|
4413
4411
|
const n = typeof t == "string" ? JSON.parse(t) : t;
|
|
4414
4412
|
if ((r = n == null ? void 0 : n.result) != null && r.store) {
|
|
4415
|
-
const s =
|
|
4413
|
+
const s = ps(n.result.attrsStore, n.result.store);
|
|
4416
4414
|
if (s) {
|
|
4417
4415
|
const i = n.result.store;
|
|
4418
|
-
n.result.store =
|
|
4416
|
+
n.result.store = hs(s, {
|
|
4419
4417
|
...i,
|
|
4420
4418
|
useDateObjects: e
|
|
4421
4419
|
}), n.result.attrsStore = s;
|
|
@@ -4423,7 +4421,7 @@ function Pc(t, e) {
|
|
|
4423
4421
|
}
|
|
4424
4422
|
return n;
|
|
4425
4423
|
}
|
|
4426
|
-
function
|
|
4424
|
+
function Pc(t, e) {
|
|
4427
4425
|
const { result: n, ...r } = e, s = (
|
|
4428
4426
|
/** @type {import('./reactorTypes.ts').QuerySubInStorage} */
|
|
4429
4427
|
r
|
|
@@ -4431,14 +4429,14 @@ function Ic(t, e) {
|
|
|
4431
4429
|
if (n) {
|
|
4432
4430
|
const i = {
|
|
4433
4431
|
...n,
|
|
4434
|
-
store:
|
|
4432
|
+
store: ds(n.store),
|
|
4435
4433
|
attrsStore: n.attrsStore.toJSON()
|
|
4436
4434
|
};
|
|
4437
4435
|
s.result = i;
|
|
4438
4436
|
}
|
|
4439
4437
|
return s;
|
|
4440
4438
|
}
|
|
4441
|
-
function
|
|
4439
|
+
function Ic(t, e) {
|
|
4442
4440
|
switch (t) {
|
|
4443
4441
|
case "pendingMutations":
|
|
4444
4442
|
return new Map(typeof e == "string" ? JSON.parse(e) : e);
|
|
@@ -4446,7 +4444,7 @@ function Mc(t, e) {
|
|
|
4446
4444
|
return e;
|
|
4447
4445
|
}
|
|
4448
4446
|
}
|
|
4449
|
-
function
|
|
4447
|
+
function Mc(t, e) {
|
|
4450
4448
|
switch (t) {
|
|
4451
4449
|
case "pendingMutations":
|
|
4452
4450
|
return [...e.entries()];
|
|
@@ -4454,17 +4452,17 @@ function jc(t, e) {
|
|
|
4454
4452
|
return e;
|
|
4455
4453
|
}
|
|
4456
4454
|
}
|
|
4457
|
-
function
|
|
4455
|
+
function jc(t, e, n) {
|
|
4458
4456
|
const r = e == null ? void 0 : e.result, s = n == null ? void 0 : n.result;
|
|
4459
4457
|
return r && !s && n && (n.result = r), n || e;
|
|
4460
4458
|
}
|
|
4461
|
-
function
|
|
4459
|
+
function Yt(t) {
|
|
4462
4460
|
return [...t].sort((e, n) => {
|
|
4463
4461
|
const [r, s] = e, [i, o] = n, a = s.order || 0, c = o.order || 0;
|
|
4464
4462
|
return a == c ? r < i ? -1 : r > i ? 1 : 0 : a - c;
|
|
4465
4463
|
});
|
|
4466
4464
|
}
|
|
4467
|
-
class
|
|
4465
|
+
class Rc {
|
|
4468
4466
|
constructor(e, n = Is, r = Ms, s, i) {
|
|
4469
4467
|
/** @type {s.AttrsStore | undefined} */
|
|
4470
4468
|
p(this, "attrs");
|
|
@@ -4559,9 +4557,9 @@ class xc {
|
|
|
4559
4557
|
});
|
|
4560
4558
|
/** Applies transactions locally and sends transact message to server */
|
|
4561
4559
|
p(this, "pushTx", (e) => {
|
|
4562
|
-
this.config.disableValidation ||
|
|
4560
|
+
this.config.disableValidation || dc(e, this.config.schema);
|
|
4563
4561
|
try {
|
|
4564
|
-
const n =
|
|
4562
|
+
const n = Da({
|
|
4565
4563
|
attrsStore: this.optimisticAttrs(),
|
|
4566
4564
|
schema: this.config.schema,
|
|
4567
4565
|
stores: Object.values(this.querySubs.currentValue).map((r) => {
|
|
@@ -4591,7 +4589,7 @@ class xc {
|
|
|
4591
4589
|
this._updatePendingMutations((c) => {
|
|
4592
4590
|
c.set(r, o);
|
|
4593
4591
|
});
|
|
4594
|
-
const a = new
|
|
4592
|
+
const a = new jr();
|
|
4595
4593
|
return this.mutationDeferredStore.set(r, a), this._sendMutation(r, o), this.notifyAll(), a.promise;
|
|
4596
4594
|
});
|
|
4597
4595
|
p(this, "_transportOnOpen", (e) => {
|
|
@@ -4662,7 +4660,7 @@ class xc {
|
|
|
4662
4660
|
}
|
|
4663
4661
|
this._log.info("[socket][close]", n.id, "schedule reconnect, ms =", this._reconnectTimeoutMs), this._scheduleReconnect();
|
|
4664
4662
|
});
|
|
4665
|
-
if (this._EventSource = i, this.config = { ...
|
|
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()) {
|
|
4666
4664
|
if (!e.appId)
|
|
4667
4665
|
throw new Error("Instant must be initialized with an appId.");
|
|
4668
4666
|
if (!Le(e.appId))
|
|
@@ -4677,14 +4675,14 @@ class xc {
|
|
|
4677
4675
|
} catch (c) {
|
|
4678
4676
|
this._log.error("[error] handle broadcast channel", c);
|
|
4679
4677
|
}
|
|
4680
|
-
})), this._initStorage(n), this._syncTable = new
|
|
4678
|
+
})), this._initStorage(n), this._syncTable = new Tc(this._trySendAuthed.bind(this), new n(this.config.appId, "syncSubs"), {
|
|
4681
4679
|
useDateObjects: this.config.useDateObjects
|
|
4682
4680
|
}, this._log, (o) => Je(this.ensureAttrs(), o, this.config.enableCardinalityInference, this.config.useDateObjects), () => this.ensureAttrs()), this._oauthCallbackResponse = this._oauthLoginInit(), this.getCurrentUser().then((o) => {
|
|
4683
4681
|
this.syncUserToEndpoint(o.user);
|
|
4684
4682
|
}), setInterval(async () => {
|
|
4685
4683
|
const o = await this.getCurrentUser();
|
|
4686
4684
|
this.syncUserToEndpoint(o.user);
|
|
4687
|
-
},
|
|
4685
|
+
}, Ec), r.getIsOnline().then((o) => {
|
|
4688
4686
|
this._isOnline = o, this._startSocket(), r.listen((a) => {
|
|
4689
4687
|
a !== this._isOnline && (this._log.info("[network] online =", a), this._isOnline = a, this._isOnline ? this._startSocket() : (this._log.info("Changing status from", this.status, "to", de.CLOSED), this._setStatus(de.CLOSED)));
|
|
4690
4688
|
});
|
|
@@ -4701,7 +4699,7 @@ class xc {
|
|
|
4701
4699
|
...this.config,
|
|
4702
4700
|
schema: e,
|
|
4703
4701
|
cardinalityInference: !!e
|
|
4704
|
-
}, this._linkIndex = e ?
|
|
4702
|
+
}, this._linkIndex = e ? xr(this.config.schema) : null;
|
|
4705
4703
|
}
|
|
4706
4704
|
_reactorStats() {
|
|
4707
4705
|
return {
|
|
@@ -4714,11 +4712,11 @@ class xc {
|
|
|
4714
4712
|
this.kv.waitForKeyToLoad("pendingMutations").then(() => this.notifyOne(e));
|
|
4715
4713
|
}
|
|
4716
4714
|
_initStorage(e) {
|
|
4717
|
-
this.querySubs = new
|
|
4715
|
+
this.querySubs = new bn({
|
|
4718
4716
|
persister: new e(this.config.appId, "querySubs"),
|
|
4719
|
-
merge:
|
|
4720
|
-
serialize:
|
|
4721
|
-
parse: (n, r) =>
|
|
4717
|
+
merge: jc,
|
|
4718
|
+
serialize: Pc,
|
|
4719
|
+
parse: (n, r) => Cc(r, this.config.useDateObjects),
|
|
4722
4720
|
// objectSize
|
|
4723
4721
|
objectSize: (n) => {
|
|
4724
4722
|
var r, s, i;
|
|
@@ -4734,11 +4732,11 @@ class xc {
|
|
|
4734
4732
|
maxSize: 1e6
|
|
4735
4733
|
// 1 million triples
|
|
4736
4734
|
}
|
|
4737
|
-
}), this.querySubs.onKeyLoaded = (n) => this._onQuerySubLoaded(n), this.kv = new
|
|
4735
|
+
}), this.querySubs.onKeyLoaded = (n) => this._onQuerySubLoaded(n), this.kv = new bn({
|
|
4738
4736
|
persister: new e(this.config.appId, "kv"),
|
|
4739
4737
|
merge: this._onMergeKv,
|
|
4740
|
-
serialize:
|
|
4741
|
-
parse:
|
|
4738
|
+
serialize: Mc,
|
|
4739
|
+
parse: Ic,
|
|
4742
4740
|
objectSize: () => 0,
|
|
4743
4741
|
logger: this._log,
|
|
4744
4742
|
saveThrottleMs: 100,
|
|
@@ -4770,7 +4768,7 @@ class xc {
|
|
|
4770
4768
|
s.resolve({ status: e, eventId: n });
|
|
4771
4769
|
else if (r != null && r.type) {
|
|
4772
4770
|
const { status: o, ...a } = r;
|
|
4773
|
-
s.reject(new
|
|
4771
|
+
s.reject(new jt({
|
|
4774
4772
|
// @ts-expect-error body.type is not constant typed
|
|
4775
4773
|
body: a,
|
|
4776
4774
|
status: o ?? 0
|
|
@@ -4817,7 +4815,7 @@ class xc {
|
|
|
4817
4815
|
_handleReceive(e, n) {
|
|
4818
4816
|
var s, i, o, a, c, u;
|
|
4819
4817
|
const r = !!this.config.schema && ("cardinalityInference" in this.config ? !!this.config.cardinalityInference : !0);
|
|
4820
|
-
switch (
|
|
4818
|
+
switch (qr[n.op] || this._log.info("[receive]", e, n.op, n), n.op) {
|
|
4821
4819
|
case "init-ok": {
|
|
4822
4820
|
this._setStatus(de.AUTHENTICATED), this._reconnectTimeoutMs = 0, this._setAttrs(n.attrs), this._flushPendingMessages(), this._sessionId = n["session-id"];
|
|
4823
4821
|
for (const h of Object.keys(this._rooms)) {
|
|
@@ -4834,7 +4832,7 @@ class xc {
|
|
|
4834
4832
|
const { q: h, result: y } = n, b = q(h);
|
|
4835
4833
|
if (!this._hasQueryListeners() && !this.querySubs.currentValue[b])
|
|
4836
4834
|
break;
|
|
4837
|
-
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);
|
|
4838
4836
|
this.querySubs.updateInPlace((O) => {
|
|
4839
4837
|
if (!O[b]) {
|
|
4840
4838
|
this._log.info("Missing value in querySubs", { hash: b, q: h });
|
|
@@ -4873,16 +4871,16 @@ class xc {
|
|
|
4873
4871
|
g !== this._pendingMutations() && this.kv.updateInPlace((_) => {
|
|
4874
4872
|
_.pendingMutations = g;
|
|
4875
4873
|
});
|
|
4876
|
-
const w =
|
|
4874
|
+
const w = Yt(g.entries()), m = h.map((_) => {
|
|
4877
4875
|
var We, ie, le, be;
|
|
4878
|
-
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;
|
|
4879
4877
|
return {
|
|
4880
4878
|
q: S,
|
|
4881
4879
|
hash: E,
|
|
4882
4880
|
store: qe,
|
|
4883
4881
|
attrsStore: ut,
|
|
4884
|
-
pageInfo:
|
|
4885
|
-
aggregate:
|
|
4882
|
+
pageInfo: $t,
|
|
4883
|
+
aggregate: Dt
|
|
4886
4884
|
};
|
|
4887
4885
|
});
|
|
4888
4886
|
m.forEach(({ hash: _, q: S, store: O, attrsStore: E, pageInfo: j, aggregate: L }) => {
|
|
@@ -5061,21 +5059,21 @@ class xc {
|
|
|
5061
5059
|
* Returns an unsubscribe function
|
|
5062
5060
|
*/
|
|
5063
5061
|
subscribeQuery(e, n, r) {
|
|
5064
|
-
this.config.disableValidation ||
|
|
5062
|
+
this.config.disableValidation || Dr(e, this.config.schema), r && "ruleParams" in r && (e = { $$ruleParams: r.ruleParams, ...e });
|
|
5065
5063
|
const s = q(e), i = this.getPreviousResult(e);
|
|
5066
5064
|
return i && n(i), this.queryCbs[s] = this.queryCbs[s] ?? [], this.queryCbs[s].push({ q: e, cb: n }), this._startQuerySub(e, s), () => {
|
|
5067
5065
|
this._unsubQuery(e, s, n);
|
|
5068
5066
|
};
|
|
5069
5067
|
}
|
|
5070
5068
|
queryOnce(e, n) {
|
|
5071
|
-
this.config.disableValidation ||
|
|
5072
|
-
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();
|
|
5073
5071
|
if (!this._isOnline)
|
|
5074
5072
|
return r.reject(new Error("We can't run `queryOnce`, because the device is offline.")), r.promise;
|
|
5075
5073
|
if (!this.querySubs)
|
|
5076
5074
|
return r.reject(new Error("We can't run `queryOnce` on the backend. Use adminAPI.query instead: https://www.instantdb.com/docs/backend#query")), r.promise;
|
|
5077
5075
|
const s = q(e), i = this._startQuerySub(e, s);
|
|
5078
|
-
return this.queryOnceDfds[s] = this.queryOnceDfds[s] ?? [], this.queryOnceDfds[s].push({ q: e, dfd: r, eventId: i }), setTimeout(() => r.reject(new Error("Query timed out")),
|
|
5076
|
+
return this.queryOnceDfds[s] = this.queryOnceDfds[s] ?? [], this.queryOnceDfds[s].push({ q: e, dfd: r, eventId: i }), setTimeout(() => r.reject(new Error("Query timed out")), mc), r.promise;
|
|
5079
5077
|
}
|
|
5080
5078
|
_completeQueryOnce(e, n, r) {
|
|
5081
5079
|
this.queryOnceDfds[n] && (this.queryOnceDfds[n] = this.queryOnceDfds[n].filter((s) => s.dfd !== r), this._cleanupQuery(e, n));
|
|
@@ -5142,7 +5140,7 @@ class xc {
|
|
|
5142
5140
|
a = !0;
|
|
5143
5141
|
continue;
|
|
5144
5142
|
}
|
|
5145
|
-
const g = a ?
|
|
5143
|
+
const g = a ? fa(o, y) : y;
|
|
5146
5144
|
h.push(g);
|
|
5147
5145
|
}
|
|
5148
5146
|
return a ? h : l;
|
|
@@ -5155,7 +5153,7 @@ class xc {
|
|
|
5155
5153
|
return a ? u : n;
|
|
5156
5154
|
}
|
|
5157
5155
|
_rewriteMutationsSorted(e, n) {
|
|
5158
|
-
return
|
|
5156
|
+
return Yt(this._rewriteMutations(e, n).entries());
|
|
5159
5157
|
}
|
|
5160
5158
|
// ---------------------------
|
|
5161
5159
|
// Transact
|
|
@@ -5200,7 +5198,7 @@ class xc {
|
|
|
5200
5198
|
const _ = this._applyOptimisticUpdates(f, h, w, g);
|
|
5201
5199
|
f = _.store, h = _.attrsStore;
|
|
5202
5200
|
}
|
|
5203
|
-
return { data:
|
|
5201
|
+
return { data: As({ store: f, attrsStore: h, pageInfo: y, aggregate: b }, c), querySubVersion: s, pendingMutationsVersion: o };
|
|
5204
5202
|
}
|
|
5205
5203
|
_applyOptimisticUpdates(e, n, r, s) {
|
|
5206
5204
|
for (const [i, o] of r)
|
|
@@ -5264,7 +5262,7 @@ class xc {
|
|
|
5264
5262
|
const r = this._rewriteMutations(this.ensureAttrs(), this._pendingMutations());
|
|
5265
5263
|
r !== this._pendingMutations() && this.kv.updateInPlace((i) => {
|
|
5266
5264
|
i.pendingMutations = r;
|
|
5267
|
-
}),
|
|
5265
|
+
}), Yt(r.entries()).forEach(([i, o]) => {
|
|
5268
5266
|
o["tx-id"] || this._sendMutation(i, o);
|
|
5269
5267
|
}), this._syncTable.flushPending();
|
|
5270
5268
|
}
|
|
@@ -5299,7 +5297,7 @@ class xc {
|
|
|
5299
5297
|
}
|
|
5300
5298
|
_trySend(e, n, r) {
|
|
5301
5299
|
if (this._transport.isOpen()) {
|
|
5302
|
-
switch (
|
|
5300
|
+
switch (qr[n.op] || this._log.info("[send]", this._transport.id, n.op, n), n.op) {
|
|
5303
5301
|
case "transact": {
|
|
5304
5302
|
this._inFlightMutationEventIds.add(e);
|
|
5305
5303
|
break;
|
|
@@ -5320,7 +5318,7 @@ class xc {
|
|
|
5320
5318
|
return;
|
|
5321
5319
|
}
|
|
5322
5320
|
const e = this._transport;
|
|
5323
|
-
this._transport =
|
|
5321
|
+
this._transport = Ac({
|
|
5324
5322
|
transportType: this._transportType,
|
|
5325
5323
|
appId: this.config.appId,
|
|
5326
5324
|
apiURI: this.config.apiURI,
|
|
@@ -5354,9 +5352,9 @@ class xc {
|
|
|
5354
5352
|
if (typeof URL > "u")
|
|
5355
5353
|
return;
|
|
5356
5354
|
const e = new URL(window.location.href);
|
|
5357
|
-
if (e.searchParams.get(
|
|
5355
|
+
if (e.searchParams.get(Jt)) {
|
|
5358
5356
|
const n = e.toString();
|
|
5359
|
-
e.searchParams.delete(
|
|
5357
|
+
e.searchParams.delete(Jt), e.searchParams.delete("code"), e.searchParams.delete("error");
|
|
5360
5358
|
const r = e.pathname + (e.searchParams.size ? "?" + e.searchParams : "") + e.hash;
|
|
5361
5359
|
if (history.replaceState(history.state, "", r), // @ts-ignore (waiting for ts support)
|
|
5362
5360
|
typeof navigation == "object" && // @ts-ignore (waiting for ts support)
|
|
@@ -5380,7 +5378,7 @@ class xc {
|
|
|
5380
5378
|
if (typeof window > "u" || typeof window.location > "u" || typeof URLSearchParams > "u")
|
|
5381
5379
|
return null;
|
|
5382
5380
|
const e = new URLSearchParams(window.location.search);
|
|
5383
|
-
if (!e.get(
|
|
5381
|
+
if (!e.get(Jt))
|
|
5384
5382
|
return null;
|
|
5385
5383
|
const n = e.get("error");
|
|
5386
5384
|
if (n)
|
|
@@ -5390,7 +5388,7 @@ class xc {
|
|
|
5390
5388
|
return null;
|
|
5391
5389
|
this._replaceUrlAfterOAuth();
|
|
5392
5390
|
try {
|
|
5393
|
-
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({
|
|
5394
5392
|
apiURI: this.config.apiURI,
|
|
5395
5393
|
appId: this.config.appId,
|
|
5396
5394
|
code: r,
|
|
@@ -5527,7 +5525,7 @@ class xc {
|
|
|
5527
5525
|
}), this._reconnectTimeoutMs = 0, this._transport.close(), this._oauthCallbackResponse = null, this.notifyAuthSubs(n);
|
|
5528
5526
|
}
|
|
5529
5527
|
sendMagicCode({ email: e }) {
|
|
5530
|
-
return
|
|
5528
|
+
return za({
|
|
5531
5529
|
apiURI: this.config.apiURI,
|
|
5532
5530
|
appId: this.config.appId,
|
|
5533
5531
|
email: e
|
|
@@ -5535,7 +5533,7 @@ class xc {
|
|
|
5535
5533
|
}
|
|
5536
5534
|
async signInWithMagicCode({ email: e, code: n }) {
|
|
5537
5535
|
var o;
|
|
5538
|
-
const r = await this.getCurrentUser(), s = ((o = r == null ? void 0 : r.user) == null ? void 0 : o.type) === "guest", i = await
|
|
5536
|
+
const r = await this.getCurrentUser(), s = ((o = r == null ? void 0 : r.user) == null ? void 0 : o.type) === "guest", i = await Va({
|
|
5539
5537
|
apiURI: this.config.apiURI,
|
|
5540
5538
|
appId: this.config.appId,
|
|
5541
5539
|
email: e,
|
|
@@ -5545,7 +5543,7 @@ class xc {
|
|
|
5545
5543
|
return await this.changeCurrentUser(i.user), i;
|
|
5546
5544
|
}
|
|
5547
5545
|
async signInWithCustomToken(e) {
|
|
5548
|
-
const n = await
|
|
5546
|
+
const n = await Ba({
|
|
5549
5547
|
apiURI: this.config.apiURI,
|
|
5550
5548
|
appId: this.config.appId,
|
|
5551
5549
|
refreshToken: e
|
|
@@ -5553,7 +5551,7 @@ class xc {
|
|
|
5553
5551
|
return await this.changeCurrentUser(n.user), n;
|
|
5554
5552
|
}
|
|
5555
5553
|
async signInAsGuest() {
|
|
5556
|
-
const e = await
|
|
5554
|
+
const e = await Ga({
|
|
5557
5555
|
apiURI: this.config.apiURI,
|
|
5558
5556
|
appId: this.config.appId
|
|
5559
5557
|
});
|
|
@@ -5568,7 +5566,7 @@ class xc {
|
|
|
5568
5566
|
this._log.info("[auth-invalidate] skipped invalidateToken");
|
|
5569
5567
|
return;
|
|
5570
5568
|
}
|
|
5571
|
-
|
|
5569
|
+
Ha({
|
|
5572
5570
|
apiURI: this.config.apiURI,
|
|
5573
5571
|
appId: this.config.appId,
|
|
5574
5572
|
refreshToken: r
|
|
@@ -5600,7 +5598,7 @@ class xc {
|
|
|
5600
5598
|
*/
|
|
5601
5599
|
async exchangeCodeForToken({ code: e, codeVerifier: n }) {
|
|
5602
5600
|
var o;
|
|
5603
|
-
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({
|
|
5604
5602
|
apiURI: this.config.apiURI,
|
|
5605
5603
|
appId: this.config.appId,
|
|
5606
5604
|
code: e,
|
|
@@ -5621,7 +5619,7 @@ class xc {
|
|
|
5621
5619
|
*/
|
|
5622
5620
|
async signInWithIdToken({ idToken: e, clientName: n, nonce: r }) {
|
|
5623
5621
|
var a;
|
|
5624
|
-
const s = await this.getCurrentUser(), i = (a = s == null ? void 0 : s.user) == null ? void 0 : a.refresh_token, o = await
|
|
5622
|
+
const s = await this.getCurrentUser(), i = (a = s == null ? void 0 : s.user) == null ? void 0 : a.refresh_token, o = await Qa({
|
|
5625
5623
|
apiURI: this.config.apiURI,
|
|
5626
5624
|
appId: this.config.appId,
|
|
5627
5625
|
idToken: e,
|
|
@@ -5662,7 +5660,7 @@ class xc {
|
|
|
5662
5660
|
getPresence(e, n, r = {}) {
|
|
5663
5661
|
const s = this._rooms[n], i = this._presence[n];
|
|
5664
5662
|
return !s || !i || !i.result ? null : {
|
|
5665
|
-
...
|
|
5663
|
+
...tc(i.result, r, this._sessionId),
|
|
5666
5664
|
isLoading: !s.isConnected,
|
|
5667
5665
|
error: s.error
|
|
5668
5666
|
};
|
|
@@ -5718,24 +5716,24 @@ class xc {
|
|
|
5718
5716
|
}
|
|
5719
5717
|
_notifyPresenceSub(e, n) {
|
|
5720
5718
|
const r = this.getPresence("", e, n);
|
|
5721
|
-
r && (n.prev && !
|
|
5719
|
+
r && (n.prev && !nc(r, n.prev) || (n.prev = r, n.cb(r)));
|
|
5722
5720
|
}
|
|
5723
5721
|
_patchPresencePeers(e, n) {
|
|
5724
5722
|
var o, a, c;
|
|
5725
5723
|
const r = ((a = (o = this._presence[e]) == null ? void 0 : o.result) == null ? void 0 : a.peers) || {};
|
|
5726
5724
|
let s = Object.fromEntries(Object.entries(r).map(([u, l]) => [u, { data: l }]));
|
|
5727
5725
|
(c = this._presence[e]) == null || c.result;
|
|
5728
|
-
const i =
|
|
5726
|
+
const i = At(s, (u) => {
|
|
5729
5727
|
for (let [l, f, h] of n)
|
|
5730
5728
|
switch (f) {
|
|
5731
5729
|
case "+":
|
|
5732
5730
|
Ri(u, l, h);
|
|
5733
5731
|
break;
|
|
5734
5732
|
case "r":
|
|
5735
|
-
|
|
5733
|
+
gr(u, l, h);
|
|
5736
5734
|
break;
|
|
5737
5735
|
case "-":
|
|
5738
|
-
|
|
5736
|
+
ls(u, l);
|
|
5739
5737
|
break;
|
|
5740
5738
|
}
|
|
5741
5739
|
delete u[this._sessionId];
|
|
@@ -5746,8 +5744,8 @@ class xc {
|
|
|
5746
5744
|
const r = { ...n };
|
|
5747
5745
|
delete r[this._sessionId];
|
|
5748
5746
|
const s = Object.fromEntries(Object.entries(r).map(([i, o]) => [i, o.data]));
|
|
5749
|
-
this._presence =
|
|
5750
|
-
|
|
5747
|
+
this._presence = At(this._presence, (i) => {
|
|
5748
|
+
gr(i, [e, "result", "peers"], s);
|
|
5751
5749
|
});
|
|
5752
5750
|
}
|
|
5753
5751
|
// --------
|
|
@@ -5790,7 +5788,7 @@ class xc {
|
|
|
5790
5788
|
async uploadFile(e, n, r) {
|
|
5791
5789
|
var o;
|
|
5792
5790
|
const s = await this.getCurrentUser(), i = (o = s == null ? void 0 : s.user) == null ? void 0 : o.refresh_token;
|
|
5793
|
-
return
|
|
5791
|
+
return Ja({
|
|
5794
5792
|
...r,
|
|
5795
5793
|
apiURI: this.config.apiURI,
|
|
5796
5794
|
appId: this.config.appId,
|
|
@@ -5802,7 +5800,7 @@ class xc {
|
|
|
5802
5800
|
async deleteFile(e) {
|
|
5803
5801
|
var i;
|
|
5804
5802
|
const n = await this.getCurrentUser(), r = (i = n == null ? void 0 : n.user) == null ? void 0 : i.refresh_token;
|
|
5805
|
-
return await
|
|
5803
|
+
return await Ya({
|
|
5806
5804
|
apiURI: this.config.apiURI,
|
|
5807
5805
|
appId: this.config.appId,
|
|
5808
5806
|
path: e,
|
|
@@ -5813,18 +5811,18 @@ class xc {
|
|
|
5813
5811
|
// ---------------------------------
|
|
5814
5812
|
async upload(e, n) {
|
|
5815
5813
|
var c;
|
|
5816
|
-
const r = await this.getCurrentUser(), s = (c = r == null ? void 0 : r.user) == null ? void 0 : c.refresh_token, i = e || n.name, o = await
|
|
5814
|
+
const r = await this.getCurrentUser(), s = (c = r == null ? void 0 : r.user) == null ? void 0 : c.refresh_token, i = e || n.name, o = await Za({
|
|
5817
5815
|
apiURI: this.config.apiURI,
|
|
5818
5816
|
appId: this.config.appId,
|
|
5819
5817
|
fileName: i,
|
|
5820
5818
|
refreshToken: s
|
|
5821
5819
|
});
|
|
5822
|
-
return await
|
|
5820
|
+
return await Xa(o, n);
|
|
5823
5821
|
}
|
|
5824
5822
|
async getDownloadUrl(e) {
|
|
5825
5823
|
var i;
|
|
5826
5824
|
const n = await this.getCurrentUser(), r = (i = n == null ? void 0 : n.user) == null ? void 0 : i.refresh_token;
|
|
5827
|
-
return await
|
|
5825
|
+
return await ec({
|
|
5828
5826
|
apiURI: this.config.apiURI,
|
|
5829
5827
|
appId: this.config.appId,
|
|
5830
5828
|
path: e,
|
|
@@ -5832,8 +5830,8 @@ class xc {
|
|
|
5832
5830
|
});
|
|
5833
5831
|
}
|
|
5834
5832
|
}
|
|
5835
|
-
function
|
|
5836
|
-
return new
|
|
5833
|
+
function xc(t, e) {
|
|
5834
|
+
return new xt(
|
|
5837
5835
|
Ks(t, e),
|
|
5838
5836
|
// (XXX): LinksDef<any> stems from TypeScript’s inability to reconcile the
|
|
5839
5837
|
// type EntitiesWithLinks<EntitiesWithoutLinks, Links> with
|
|
@@ -5844,25 +5842,25 @@ function $c(t, e) {
|
|
|
5844
5842
|
void 0
|
|
5845
5843
|
);
|
|
5846
5844
|
}
|
|
5847
|
-
function
|
|
5848
|
-
return new
|
|
5845
|
+
function $c(t) {
|
|
5846
|
+
return new Rt(t, {});
|
|
5849
5847
|
}
|
|
5850
|
-
function
|
|
5848
|
+
function Dc() {
|
|
5851
5849
|
return new H("string", !0, !1);
|
|
5852
5850
|
}
|
|
5853
|
-
function
|
|
5851
|
+
function Uc() {
|
|
5854
5852
|
return new H("number", !0, !1);
|
|
5855
5853
|
}
|
|
5856
|
-
function
|
|
5854
|
+
function Lc() {
|
|
5857
5855
|
return new H("boolean", !0, !1);
|
|
5858
5856
|
}
|
|
5859
|
-
function
|
|
5857
|
+
function Fc() {
|
|
5860
5858
|
return new H("date", !0, !1);
|
|
5861
5859
|
}
|
|
5862
|
-
function
|
|
5860
|
+
function Nc() {
|
|
5863
5861
|
return new H("json", !0, !1);
|
|
5864
5862
|
}
|
|
5865
|
-
function
|
|
5863
|
+
function Kc() {
|
|
5866
5864
|
return new H("json", !0, !1);
|
|
5867
5865
|
}
|
|
5868
5866
|
function Ks(t, e) {
|
|
@@ -5878,15 +5876,15 @@ function Ks(t, e) {
|
|
|
5878
5876
|
};
|
|
5879
5877
|
return Object.fromEntries(Object.entries(t).map(([c, u]) => [
|
|
5880
5878
|
c,
|
|
5881
|
-
new
|
|
5879
|
+
new Rt(u.attrs, {
|
|
5882
5880
|
...n.fwd[c],
|
|
5883
5881
|
...n.rev[c]
|
|
5884
5882
|
})
|
|
5885
5883
|
]));
|
|
5886
5884
|
}
|
|
5887
|
-
function
|
|
5885
|
+
function qc({ entities: t, links: e, rooms: n }) {
|
|
5888
5886
|
const r = e ?? {}, s = n ?? {};
|
|
5889
|
-
return new
|
|
5887
|
+
return new xt(
|
|
5890
5888
|
Ks(t, r),
|
|
5891
5889
|
// (XXX): LinksDef<any> stems from TypeScript's inability to reconcile the
|
|
5892
5890
|
// type EntitiesWithLinks<EntitiesWithoutLinks, Links> with
|
|
@@ -5899,21 +5897,21 @@ function Wc({ entities: t, links: e, rooms: n }) {
|
|
|
5899
5897
|
}
|
|
5900
5898
|
const ju = {
|
|
5901
5899
|
// constructs
|
|
5902
|
-
graph:
|
|
5903
|
-
schema:
|
|
5904
|
-
entity:
|
|
5900
|
+
graph: xc,
|
|
5901
|
+
schema: qc,
|
|
5902
|
+
entity: $c,
|
|
5905
5903
|
// value types
|
|
5906
|
-
string:
|
|
5907
|
-
number:
|
|
5908
|
-
boolean:
|
|
5909
|
-
date:
|
|
5910
|
-
json:
|
|
5911
|
-
any:
|
|
5904
|
+
string: Dc,
|
|
5905
|
+
number: Uc,
|
|
5906
|
+
boolean: Lc,
|
|
5907
|
+
date: Fc,
|
|
5908
|
+
json: Nc,
|
|
5909
|
+
any: Kc
|
|
5912
5910
|
};
|
|
5913
5911
|
let gt;
|
|
5914
|
-
function
|
|
5912
|
+
function Wc(t, e) {
|
|
5915
5913
|
gt == null || gt.dispose();
|
|
5916
|
-
const n =
|
|
5914
|
+
const n = Hc(e), r = Bc(e, a), s = Vc(zc(t));
|
|
5917
5915
|
function i(l) {
|
|
5918
5916
|
var f;
|
|
5919
5917
|
l.source === s.element.contentWindow && ((f = l.data) == null ? void 0 : f.type) === "close" && n.isVisible() && a();
|
|
@@ -5935,10 +5933,10 @@ function zc(t, e) {
|
|
|
5935
5933
|
}
|
|
5936
5934
|
return u();
|
|
5937
5935
|
}
|
|
5938
|
-
function
|
|
5939
|
-
return `${
|
|
5936
|
+
function zc(t) {
|
|
5937
|
+
return `${Nn || Rs ? "http://localhost:3000" : "https://instantdb.com"}/_devtool?appId=${t}`;
|
|
5940
5938
|
}
|
|
5941
|
-
function
|
|
5939
|
+
function Vc(t) {
|
|
5942
5940
|
const e = document.createElement("iframe");
|
|
5943
5941
|
return e.src = t, e.className = "instant-devtool-iframe", Object.assign(e.style, {
|
|
5944
5942
|
width: "100%",
|
|
@@ -5947,7 +5945,7 @@ function Bc(t) {
|
|
|
5947
5945
|
border: "none"
|
|
5948
5946
|
}), { element: e };
|
|
5949
5947
|
}
|
|
5950
|
-
function
|
|
5948
|
+
function Bc(t, e) {
|
|
5951
5949
|
const n = `
|
|
5952
5950
|
<svg width="32" height="32" viewBox="0 0 512 512" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
5953
5951
|
<rect width="512" height="512" fill="black"/>
|
|
@@ -5957,7 +5955,7 @@ function Gc(t, e) {
|
|
|
5957
5955
|
return r.innerHTML = n, r.className = "instant-devtool-toggler", Object.assign(r.style, {
|
|
5958
5956
|
// pos
|
|
5959
5957
|
position: "fixed",
|
|
5960
|
-
...
|
|
5958
|
+
...Gc(t.position),
|
|
5961
5959
|
height: "32px",
|
|
5962
5960
|
width: "32px",
|
|
5963
5961
|
// layout
|
|
@@ -5972,7 +5970,7 @@ function Gc(t, e) {
|
|
|
5972
5970
|
cursor: "pointer"
|
|
5973
5971
|
}), r.addEventListener("click", e), { element: r };
|
|
5974
5972
|
}
|
|
5975
|
-
function
|
|
5973
|
+
function Gc(t) {
|
|
5976
5974
|
switch (t) {
|
|
5977
5975
|
case "bottom-left":
|
|
5978
5976
|
return { bottom: "24px", left: "24px" };
|
|
@@ -5984,7 +5982,7 @@ function Qc(t) {
|
|
|
5984
5982
|
return { top: "24px", left: "24px" };
|
|
5985
5983
|
}
|
|
5986
5984
|
}
|
|
5987
|
-
function
|
|
5985
|
+
function Qc(t) {
|
|
5988
5986
|
switch (t) {
|
|
5989
5987
|
case "bottom-left":
|
|
5990
5988
|
return { bottom: "24px", right: "24px", left: "60px", top: "72px" };
|
|
@@ -5996,11 +5994,11 @@ function Hc(t) {
|
|
|
5996
5994
|
return { top: "24px", right: "24px", left: "60px", bottom: "72px" };
|
|
5997
5995
|
}
|
|
5998
5996
|
}
|
|
5999
|
-
function
|
|
5997
|
+
function Hc(t) {
|
|
6000
5998
|
const e = document.createElement("div");
|
|
6001
5999
|
Object.assign(e.style, {
|
|
6002
6000
|
position: "fixed",
|
|
6003
|
-
...
|
|
6001
|
+
...Qc(t.position),
|
|
6004
6002
|
display: "block",
|
|
6005
6003
|
borderRadius: "4px",
|
|
6006
6004
|
border: "1px #ccc solid",
|
|
@@ -6013,22 +6011,22 @@ function Jc(t) {
|
|
|
6013
6011
|
}
|
|
6014
6012
|
return { element: e, isVisible: n };
|
|
6015
6013
|
}
|
|
6016
|
-
const
|
|
6014
|
+
const Jc = {
|
|
6017
6015
|
apiURI: "https://api.instantdb.com",
|
|
6018
6016
|
websocketURI: "wss://api.instantdb.com/runtime/session"
|
|
6019
6017
|
};
|
|
6020
|
-
function
|
|
6018
|
+
function Yc() {
|
|
6021
6019
|
return globalThis.__instantDbSchemaHashStore = globalThis.__instantDbSchemaHashStore ?? /* @__PURE__ */ new WeakMap(), globalThis.__instantDbSchemaHashStore;
|
|
6022
6020
|
}
|
|
6023
|
-
function
|
|
6021
|
+
function Zc() {
|
|
6024
6022
|
return globalThis.__instantDbStore = globalThis.__instantDbStore ?? {}, globalThis.__instantDbStore;
|
|
6025
6023
|
}
|
|
6026
|
-
function
|
|
6024
|
+
function gn(t) {
|
|
6027
6025
|
const e = t.__adminToken;
|
|
6028
6026
|
return t.appId + "_" + (t.websocketURI || "default_ws_uri") + "_" + (t.apiURI || "default_api_uri") + "_" + (e || "client_only") + "_" + t.useDateObjects;
|
|
6029
6027
|
}
|
|
6030
|
-
const
|
|
6031
|
-
class
|
|
6028
|
+
const _n = Zc(), Wr = Yc();
|
|
6029
|
+
class Xc {
|
|
6032
6030
|
constructor(e) {
|
|
6033
6031
|
p(this, "db");
|
|
6034
6032
|
/**
|
|
@@ -6145,7 +6143,7 @@ class eu {
|
|
|
6145
6143
|
this.db = e;
|
|
6146
6144
|
}
|
|
6147
6145
|
}
|
|
6148
|
-
class
|
|
6146
|
+
class eu {
|
|
6149
6147
|
constructor(e) {
|
|
6150
6148
|
p(this, "db");
|
|
6151
6149
|
/**
|
|
@@ -6194,16 +6192,16 @@ class tu {
|
|
|
6194
6192
|
this.db = e;
|
|
6195
6193
|
}
|
|
6196
6194
|
}
|
|
6197
|
-
function
|
|
6195
|
+
function tu(t) {
|
|
6198
6196
|
return JSON.parse(JSON.stringify(t));
|
|
6199
6197
|
}
|
|
6200
|
-
class
|
|
6198
|
+
class nu {
|
|
6201
6199
|
constructor(e) {
|
|
6202
6200
|
p(this, "_reactor");
|
|
6203
6201
|
p(this, "auth");
|
|
6204
6202
|
p(this, "storage");
|
|
6205
|
-
p(this, "tx",
|
|
6206
|
-
this._reactor = e, this.auth = new
|
|
6203
|
+
p(this, "tx", Fn());
|
|
6204
|
+
this._reactor = e, this.auth = new Xc(this._reactor), this.storage = new eu(this._reactor);
|
|
6207
6205
|
}
|
|
6208
6206
|
/**
|
|
6209
6207
|
* Use this to write data! You can create, update, delete, and link objects
|
|
@@ -6344,7 +6342,7 @@ class ru {
|
|
|
6344
6342
|
};
|
|
6345
6343
|
}
|
|
6346
6344
|
shutdown() {
|
|
6347
|
-
delete
|
|
6345
|
+
delete _n[gn(this._reactor.config)], this._reactor.shutdown();
|
|
6348
6346
|
}
|
|
6349
6347
|
/**
|
|
6350
6348
|
* Use this for one-off queries.
|
|
@@ -6377,35 +6375,35 @@ class ru {
|
|
|
6377
6375
|
return this._reactor.subscribeTable(e, n);
|
|
6378
6376
|
}
|
|
6379
6377
|
}
|
|
6380
|
-
function
|
|
6378
|
+
function zr(t) {
|
|
6381
6379
|
if (!t)
|
|
6382
6380
|
return "0";
|
|
6383
|
-
const e =
|
|
6381
|
+
const e = Wr.get(t);
|
|
6384
6382
|
if (e)
|
|
6385
6383
|
return e;
|
|
6386
6384
|
const n = q(t);
|
|
6387
|
-
return
|
|
6385
|
+
return Wr.set(t, n), n;
|
|
6388
6386
|
}
|
|
6389
|
-
function
|
|
6390
|
-
return
|
|
6387
|
+
function ru(t, e) {
|
|
6388
|
+
return zr(t._reactor.config.schema) !== zr(e);
|
|
6391
6389
|
}
|
|
6392
|
-
function
|
|
6390
|
+
function su(t, e, n, r, s) {
|
|
6393
6391
|
var u;
|
|
6394
6392
|
const i = {
|
|
6395
6393
|
...t,
|
|
6396
6394
|
appId: (u = t.appId) == null ? void 0 : u.trim(),
|
|
6397
6395
|
useDateObjects: t.useDateObjects ?? !1
|
|
6398
|
-
}, o =
|
|
6396
|
+
}, o = _n[gn(i)];
|
|
6399
6397
|
if (o)
|
|
6400
|
-
return
|
|
6401
|
-
const a = new
|
|
6402
|
-
...
|
|
6398
|
+
return ru(o, i.schema) && o._reactor.updateSchema(i.schema), o;
|
|
6399
|
+
const a = new Rc({
|
|
6400
|
+
...Jc,
|
|
6403
6401
|
...i,
|
|
6404
6402
|
cardinalityInference: !!i.schema
|
|
6405
|
-
}, e || Is, n || Ms, { ...r || {}, "@instantdb/core":
|
|
6406
|
-
return
|
|
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;
|
|
6407
6405
|
}
|
|
6408
|
-
function
|
|
6406
|
+
function iu(t, e) {
|
|
6409
6407
|
if (typeof window > "u" || typeof window.location > "u" || typeof document > "u" || typeof e == "boolean" && !e)
|
|
6410
6408
|
return;
|
|
6411
6409
|
const n = {
|
|
@@ -6413,9 +6411,9 @@ function ou(t, e) {
|
|
|
6413
6411
|
allowedHosts: ["localhost"],
|
|
6414
6412
|
...typeof e == "object" ? e : {}
|
|
6415
6413
|
};
|
|
6416
|
-
n.allowedHosts.includes(window.location.hostname) &&
|
|
6414
|
+
n.allowedHosts.includes(window.location.hostname) && Wc(t, n);
|
|
6417
6415
|
}
|
|
6418
|
-
var
|
|
6416
|
+
var wn = { exports: {} }, Be = {};
|
|
6419
6417
|
/**
|
|
6420
6418
|
* @license React
|
|
6421
6419
|
* react-jsx-runtime.production.min.js
|
|
@@ -6425,11 +6423,11 @@ var Tn = { exports: {} }, Be = {};
|
|
|
6425
6423
|
* This source code is licensed under the MIT license found in the
|
|
6426
6424
|
* LICENSE file in the root directory of this source tree.
|
|
6427
6425
|
*/
|
|
6428
|
-
var
|
|
6429
|
-
function
|
|
6430
|
-
if (
|
|
6431
|
-
|
|
6432
|
-
var t =
|
|
6426
|
+
var Vr;
|
|
6427
|
+
function ou() {
|
|
6428
|
+
if (Vr) return Be;
|
|
6429
|
+
Vr = 1;
|
|
6430
|
+
var t = Xr, e = Symbol.for("react.element"), n = Symbol.for("react.fragment"), r = Object.prototype.hasOwnProperty, s = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, i = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
6433
6431
|
function o(a, c, u) {
|
|
6434
6432
|
var l, f = {}, h = null, y = null;
|
|
6435
6433
|
u !== void 0 && (h = "" + u), c.key !== void 0 && (h = "" + c.key), c.ref !== void 0 && (y = c.ref);
|
|
@@ -6439,10 +6437,10 @@ function au() {
|
|
|
6439
6437
|
}
|
|
6440
6438
|
return Be.Fragment = n, Be.jsx = o, Be.jsxs = o, Be;
|
|
6441
6439
|
}
|
|
6442
|
-
var Ge = {},
|
|
6443
|
-
function
|
|
6444
|
-
if (
|
|
6445
|
-
|
|
6440
|
+
var Ge = {}, Br;
|
|
6441
|
+
function au() {
|
|
6442
|
+
if (Br) return Ge;
|
|
6443
|
+
Br = 1;
|
|
6446
6444
|
var t = {};
|
|
6447
6445
|
/**
|
|
6448
6446
|
* @license React
|
|
@@ -6454,7 +6452,7 @@ function cu() {
|
|
|
6454
6452
|
* LICENSE file in the root directory of this source tree.
|
|
6455
6453
|
*/
|
|
6456
6454
|
return t.NODE_ENV !== "production" && function() {
|
|
6457
|
-
var e =
|
|
6455
|
+
var e = Xr, n = Symbol.for("react.element"), r = Symbol.for("react.portal"), s = Symbol.for("react.fragment"), i = Symbol.for("react.strict_mode"), o = Symbol.for("react.profiler"), a = Symbol.for("react.provider"), c = Symbol.for("react.context"), u = Symbol.for("react.forward_ref"), l = Symbol.for("react.suspense"), f = Symbol.for("react.suspense_list"), h = Symbol.for("react.memo"), y = Symbol.for("react.lazy"), b = Symbol.for("react.offscreen"), g = Symbol.iterator, w = "@@iterator";
|
|
6458
6456
|
function m(d) {
|
|
6459
6457
|
if (d === null || typeof d != "object")
|
|
6460
6458
|
return null;
|
|
@@ -6481,14 +6479,14 @@ function cu() {
|
|
|
6481
6479
|
}
|
|
6482
6480
|
var E = !1, j = !1, L = !1, B = !1, qe = !1, ut;
|
|
6483
6481
|
ut = Symbol.for("react.module.reference");
|
|
6484
|
-
function
|
|
6482
|
+
function $t(d) {
|
|
6485
6483
|
return !!(typeof d == "string" || typeof d == "function" || d === s || d === o || qe || d === i || d === l || d === f || B || d === b || E || j || L || typeof d == "object" && d !== null && (d.$$typeof === y || d.$$typeof === h || d.$$typeof === a || d.$$typeof === c || d.$$typeof === u || // This needs to include all possible module reference object
|
|
6486
6484
|
// types supported by any Flight configuration anywhere since
|
|
6487
6485
|
// we don't know which Flight build this will end up being used
|
|
6488
6486
|
// with.
|
|
6489
6487
|
d.$$typeof === ut || d.getModuleId !== void 0));
|
|
6490
6488
|
}
|
|
6491
|
-
function
|
|
6489
|
+
function Dt(d, T, v) {
|
|
6492
6490
|
var A = d.displayName;
|
|
6493
6491
|
if (A)
|
|
6494
6492
|
return A;
|
|
@@ -6528,7 +6526,7 @@ function cu() {
|
|
|
6528
6526
|
var v = d;
|
|
6529
6527
|
return We(v._context) + ".Provider";
|
|
6530
6528
|
case u:
|
|
6531
|
-
return
|
|
6529
|
+
return Dt(d, d.render, "ForwardRef");
|
|
6532
6530
|
case h:
|
|
6533
6531
|
var A = d.displayName || null;
|
|
6534
6532
|
return A !== null ? A : ie(d.type) || "Memo";
|
|
@@ -6543,18 +6541,18 @@ function cu() {
|
|
|
6543
6541
|
}
|
|
6544
6542
|
return null;
|
|
6545
6543
|
}
|
|
6546
|
-
var le = Object.assign, be = 0, zn, Vn, Bn, Gn, Qn, Hn
|
|
6547
|
-
function
|
|
6544
|
+
var le = Object.assign, be = 0, Wn, zn, Vn, Bn, Gn, Qn, Hn;
|
|
6545
|
+
function Jn() {
|
|
6548
6546
|
}
|
|
6549
|
-
|
|
6547
|
+
Jn.__reactDisabledLog = !0;
|
|
6550
6548
|
function zs() {
|
|
6551
6549
|
{
|
|
6552
6550
|
if (be === 0) {
|
|
6553
|
-
|
|
6551
|
+
Wn = console.log, zn = console.info, Vn = console.warn, Bn = console.error, Gn = console.group, Qn = console.groupCollapsed, Hn = console.groupEnd;
|
|
6554
6552
|
var d = {
|
|
6555
6553
|
configurable: !0,
|
|
6556
6554
|
enumerable: !0,
|
|
6557
|
-
value:
|
|
6555
|
+
value: Jn,
|
|
6558
6556
|
writable: !0
|
|
6559
6557
|
};
|
|
6560
6558
|
Object.defineProperties(console, {
|
|
@@ -6580,52 +6578,52 @@ function cu() {
|
|
|
6580
6578
|
};
|
|
6581
6579
|
Object.defineProperties(console, {
|
|
6582
6580
|
log: le({}, d, {
|
|
6583
|
-
value:
|
|
6581
|
+
value: Wn
|
|
6584
6582
|
}),
|
|
6585
6583
|
info: le({}, d, {
|
|
6586
|
-
value:
|
|
6584
|
+
value: zn
|
|
6587
6585
|
}),
|
|
6588
6586
|
warn: le({}, d, {
|
|
6589
|
-
value:
|
|
6587
|
+
value: Vn
|
|
6590
6588
|
}),
|
|
6591
6589
|
error: le({}, d, {
|
|
6592
|
-
value:
|
|
6590
|
+
value: Bn
|
|
6593
6591
|
}),
|
|
6594
6592
|
group: le({}, d, {
|
|
6595
|
-
value:
|
|
6593
|
+
value: Gn
|
|
6596
6594
|
}),
|
|
6597
6595
|
groupCollapsed: le({}, d, {
|
|
6598
|
-
value:
|
|
6596
|
+
value: Qn
|
|
6599
6597
|
}),
|
|
6600
6598
|
groupEnd: le({}, d, {
|
|
6601
|
-
value:
|
|
6599
|
+
value: Hn
|
|
6602
6600
|
})
|
|
6603
6601
|
});
|
|
6604
6602
|
}
|
|
6605
6603
|
be < 0 && S("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
|
|
6606
6604
|
}
|
|
6607
6605
|
}
|
|
6608
|
-
var
|
|
6606
|
+
var Ut = _.ReactCurrentDispatcher, Lt;
|
|
6609
6607
|
function lt(d, T, v) {
|
|
6610
6608
|
{
|
|
6611
|
-
if (
|
|
6609
|
+
if (Lt === void 0)
|
|
6612
6610
|
try {
|
|
6613
6611
|
throw Error();
|
|
6614
6612
|
} catch (M) {
|
|
6615
6613
|
var A = M.stack.trim().match(/\n( *(at )?)/);
|
|
6616
|
-
|
|
6614
|
+
Lt = A && A[1] || "";
|
|
6617
6615
|
}
|
|
6618
6616
|
return `
|
|
6619
|
-
` +
|
|
6617
|
+
` + Lt + d;
|
|
6620
6618
|
}
|
|
6621
6619
|
}
|
|
6622
|
-
var
|
|
6620
|
+
var Ft = !1, ft;
|
|
6623
6621
|
{
|
|
6624
6622
|
var Bs = typeof WeakMap == "function" ? WeakMap : Map;
|
|
6625
6623
|
ft = new Bs();
|
|
6626
6624
|
}
|
|
6627
|
-
function
|
|
6628
|
-
if (!d ||
|
|
6625
|
+
function Yn(d, T) {
|
|
6626
|
+
if (!d || Ft)
|
|
6629
6627
|
return "";
|
|
6630
6628
|
{
|
|
6631
6629
|
var v = ft.get(d);
|
|
@@ -6633,11 +6631,11 @@ function cu() {
|
|
|
6633
6631
|
return v;
|
|
6634
6632
|
}
|
|
6635
6633
|
var A;
|
|
6636
|
-
|
|
6634
|
+
Ft = !0;
|
|
6637
6635
|
var M = Error.prepareStackTrace;
|
|
6638
6636
|
Error.prepareStackTrace = void 0;
|
|
6639
6637
|
var R;
|
|
6640
|
-
R =
|
|
6638
|
+
R = Ut.current, Ut.current = null, zs();
|
|
6641
6639
|
try {
|
|
6642
6640
|
if (T) {
|
|
6643
6641
|
var I = function() {
|
|
@@ -6690,13 +6688,13 @@ function cu() {
|
|
|
6690
6688
|
}
|
|
6691
6689
|
}
|
|
6692
6690
|
} finally {
|
|
6693
|
-
|
|
6691
|
+
Ft = !1, Ut.current = R, Vs(), Error.prepareStackTrace = M;
|
|
6694
6692
|
}
|
|
6695
6693
|
var Ie = d ? d.displayName || d.name : "", we = Ie ? lt(Ie) : "";
|
|
6696
6694
|
return typeof d == "function" && ft.set(d, we), we;
|
|
6697
6695
|
}
|
|
6698
6696
|
function Gs(d, T, v) {
|
|
6699
|
-
return
|
|
6697
|
+
return Yn(d, !1);
|
|
6700
6698
|
}
|
|
6701
6699
|
function Qs(d) {
|
|
6702
6700
|
var T = d.prototype;
|
|
@@ -6706,7 +6704,7 @@ function cu() {
|
|
|
6706
6704
|
if (d == null)
|
|
6707
6705
|
return "";
|
|
6708
6706
|
if (typeof d == "function")
|
|
6709
|
-
return
|
|
6707
|
+
return Yn(d, Qs(d));
|
|
6710
6708
|
if (typeof d == "string")
|
|
6711
6709
|
return lt(d);
|
|
6712
6710
|
switch (d) {
|
|
@@ -6731,13 +6729,13 @@ function cu() {
|
|
|
6731
6729
|
}
|
|
6732
6730
|
return "";
|
|
6733
6731
|
}
|
|
6734
|
-
var ze = Object.prototype.hasOwnProperty,
|
|
6732
|
+
var ze = Object.prototype.hasOwnProperty, Zn = {}, Xn = _.ReactDebugCurrentFrame;
|
|
6735
6733
|
function ht(d) {
|
|
6736
6734
|
if (d) {
|
|
6737
6735
|
var T = d._owner, v = dt(d.type, d._source, T ? T.type : null);
|
|
6738
|
-
|
|
6736
|
+
Xn.setExtraStackFrame(v);
|
|
6739
6737
|
} else
|
|
6740
|
-
|
|
6738
|
+
Xn.setExtraStackFrame(null);
|
|
6741
6739
|
}
|
|
6742
6740
|
function Hs(d, T, v, A, M) {
|
|
6743
6741
|
{
|
|
@@ -6754,12 +6752,12 @@ function cu() {
|
|
|
6754
6752
|
} catch (D) {
|
|
6755
6753
|
C = D;
|
|
6756
6754
|
}
|
|
6757
|
-
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));
|
|
6758
6756
|
}
|
|
6759
6757
|
}
|
|
6760
6758
|
}
|
|
6761
6759
|
var Js = Array.isArray;
|
|
6762
|
-
function
|
|
6760
|
+
function Nt(d) {
|
|
6763
6761
|
return Js(d);
|
|
6764
6762
|
}
|
|
6765
6763
|
function Ys(d) {
|
|
@@ -6770,24 +6768,24 @@ function cu() {
|
|
|
6770
6768
|
}
|
|
6771
6769
|
function Zs(d) {
|
|
6772
6770
|
try {
|
|
6773
|
-
return
|
|
6771
|
+
return er(d), !1;
|
|
6774
6772
|
} catch {
|
|
6775
6773
|
return !0;
|
|
6776
6774
|
}
|
|
6777
6775
|
}
|
|
6778
|
-
function
|
|
6776
|
+
function er(d) {
|
|
6779
6777
|
return "" + d;
|
|
6780
6778
|
}
|
|
6781
|
-
function
|
|
6779
|
+
function tr(d) {
|
|
6782
6780
|
if (Zs(d))
|
|
6783
|
-
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);
|
|
6784
6782
|
}
|
|
6785
|
-
var
|
|
6783
|
+
var nr = _.ReactCurrentOwner, Xs = {
|
|
6786
6784
|
key: !0,
|
|
6787
6785
|
ref: !0,
|
|
6788
6786
|
__self: !0,
|
|
6789
6787
|
__source: !0
|
|
6790
|
-
},
|
|
6788
|
+
}, rr, sr;
|
|
6791
6789
|
function ei(d) {
|
|
6792
6790
|
if (ze.call(d, "ref")) {
|
|
6793
6791
|
var T = Object.getOwnPropertyDescriptor(d, "ref").get;
|
|
@@ -6805,12 +6803,12 @@ function cu() {
|
|
|
6805
6803
|
return d.key !== void 0;
|
|
6806
6804
|
}
|
|
6807
6805
|
function ni(d, T) {
|
|
6808
|
-
typeof d.ref == "string" &&
|
|
6806
|
+
typeof d.ref == "string" && nr.current;
|
|
6809
6807
|
}
|
|
6810
6808
|
function ri(d, T) {
|
|
6811
6809
|
{
|
|
6812
6810
|
var v = function() {
|
|
6813
|
-
|
|
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));
|
|
6814
6812
|
};
|
|
6815
6813
|
v.isReactWarning = !0, Object.defineProperty(d, "key", {
|
|
6816
6814
|
get: v,
|
|
@@ -6821,7 +6819,7 @@ function cu() {
|
|
|
6821
6819
|
function si(d, T) {
|
|
6822
6820
|
{
|
|
6823
6821
|
var v = function() {
|
|
6824
|
-
|
|
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));
|
|
6825
6823
|
};
|
|
6826
6824
|
v.isReactWarning = !0, Object.defineProperty(d, "ref", {
|
|
6827
6825
|
get: v,
|
|
@@ -6861,7 +6859,7 @@ function cu() {
|
|
|
6861
6859
|
function oi(d, T, v, A, M) {
|
|
6862
6860
|
{
|
|
6863
6861
|
var R, I = {}, C = null, G = null;
|
|
6864
|
-
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));
|
|
6865
6863
|
for (R in T)
|
|
6866
6864
|
ze.call(T, R) && !Xs.hasOwnProperty(R) && (I[R] = T[R]);
|
|
6867
6865
|
if (d && d.defaultProps) {
|
|
@@ -6873,26 +6871,26 @@ function cu() {
|
|
|
6873
6871
|
var F = typeof d == "function" ? d.displayName || d.name || "Unknown" : d;
|
|
6874
6872
|
C && ri(I, F), G && si(I, F);
|
|
6875
6873
|
}
|
|
6876
|
-
return ii(d, C, G, M, A,
|
|
6874
|
+
return ii(d, C, G, M, A, nr.current, I);
|
|
6877
6875
|
}
|
|
6878
6876
|
}
|
|
6879
|
-
var
|
|
6877
|
+
var Kt = _.ReactCurrentOwner, ir = _.ReactDebugCurrentFrame;
|
|
6880
6878
|
function Pe(d) {
|
|
6881
6879
|
if (d) {
|
|
6882
6880
|
var T = d._owner, v = dt(d.type, d._source, T ? T.type : null);
|
|
6883
|
-
|
|
6881
|
+
ir.setExtraStackFrame(v);
|
|
6884
6882
|
} else
|
|
6885
|
-
|
|
6883
|
+
ir.setExtraStackFrame(null);
|
|
6886
6884
|
}
|
|
6887
|
-
var
|
|
6888
|
-
|
|
6889
|
-
function
|
|
6885
|
+
var qt;
|
|
6886
|
+
qt = !1;
|
|
6887
|
+
function Wt(d) {
|
|
6890
6888
|
return typeof d == "object" && d !== null && d.$$typeof === n;
|
|
6891
6889
|
}
|
|
6892
|
-
function
|
|
6890
|
+
function or() {
|
|
6893
6891
|
{
|
|
6894
|
-
if (
|
|
6895
|
-
var d = ie(
|
|
6892
|
+
if (Kt.current) {
|
|
6893
|
+
var d = ie(Kt.current.type);
|
|
6896
6894
|
if (d)
|
|
6897
6895
|
return `
|
|
6898
6896
|
|
|
@@ -6904,10 +6902,10 @@ Check the render method of \`` + d + "`.";
|
|
|
6904
6902
|
function ai(d) {
|
|
6905
6903
|
return "";
|
|
6906
6904
|
}
|
|
6907
|
-
var
|
|
6905
|
+
var ar = {};
|
|
6908
6906
|
function ci(d) {
|
|
6909
6907
|
{
|
|
6910
|
-
var T =
|
|
6908
|
+
var T = or();
|
|
6911
6909
|
if (!T) {
|
|
6912
6910
|
var v = typeof d == "string" ? d : d.displayName || d.name;
|
|
6913
6911
|
v && (T = `
|
|
@@ -6917,35 +6915,35 @@ Check the top-level render call using <` + v + ">.");
|
|
|
6917
6915
|
return T;
|
|
6918
6916
|
}
|
|
6919
6917
|
}
|
|
6920
|
-
function
|
|
6918
|
+
function cr(d, T) {
|
|
6921
6919
|
{
|
|
6922
6920
|
if (!d._store || d._store.validated || d.key != null)
|
|
6923
6921
|
return;
|
|
6924
6922
|
d._store.validated = !0;
|
|
6925
6923
|
var v = ci(T);
|
|
6926
|
-
if (
|
|
6924
|
+
if (ar[v])
|
|
6927
6925
|
return;
|
|
6928
|
-
|
|
6926
|
+
ar[v] = !0;
|
|
6929
6927
|
var A = "";
|
|
6930
|
-
d && d._owner && d._owner !==
|
|
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);
|
|
6931
6929
|
}
|
|
6932
6930
|
}
|
|
6933
|
-
function
|
|
6931
|
+
function ur(d, T) {
|
|
6934
6932
|
{
|
|
6935
6933
|
if (typeof d != "object")
|
|
6936
6934
|
return;
|
|
6937
|
-
if (
|
|
6935
|
+
if (Nt(d))
|
|
6938
6936
|
for (var v = 0; v < d.length; v++) {
|
|
6939
6937
|
var A = d[v];
|
|
6940
|
-
|
|
6938
|
+
Wt(A) && cr(A, T);
|
|
6941
6939
|
}
|
|
6942
|
-
else if (
|
|
6940
|
+
else if (Wt(d))
|
|
6943
6941
|
d._store && (d._store.validated = !0);
|
|
6944
6942
|
else if (d) {
|
|
6945
6943
|
var M = m(d);
|
|
6946
6944
|
if (typeof M == "function" && M !== d.entries)
|
|
6947
6945
|
for (var R = M.call(d), I; !(I = R.next()).done; )
|
|
6948
|
-
|
|
6946
|
+
Wt(I.value) && cr(I.value, T);
|
|
6949
6947
|
}
|
|
6950
6948
|
}
|
|
6951
6949
|
}
|
|
@@ -6966,8 +6964,8 @@ Check the top-level render call using <` + v + ">.");
|
|
|
6966
6964
|
if (v) {
|
|
6967
6965
|
var A = ie(T);
|
|
6968
6966
|
Hs(v, d.props, "prop", A, d);
|
|
6969
|
-
} else if (T.PropTypes !== void 0 && !
|
|
6970
|
-
|
|
6967
|
+
} else if (T.PropTypes !== void 0 && !qt) {
|
|
6968
|
+
qt = !0;
|
|
6971
6969
|
var M = ie(T);
|
|
6972
6970
|
S("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", M || "Unknown");
|
|
6973
6971
|
}
|
|
@@ -6986,17 +6984,17 @@ Check the top-level render call using <` + v + ">.");
|
|
|
6986
6984
|
d.ref !== null && (Pe(d), S("Invalid attribute `ref` supplied to `React.Fragment`."), Pe(null));
|
|
6987
6985
|
}
|
|
6988
6986
|
}
|
|
6989
|
-
var
|
|
6990
|
-
function
|
|
6987
|
+
var lr = {};
|
|
6988
|
+
function fr(d, T, v, A, M, R) {
|
|
6991
6989
|
{
|
|
6992
|
-
var I =
|
|
6990
|
+
var I = $t(d);
|
|
6993
6991
|
if (!I) {
|
|
6994
6992
|
var C = "";
|
|
6995
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.");
|
|
6996
6994
|
var G = ai();
|
|
6997
|
-
G ? C += G : C +=
|
|
6995
|
+
G ? C += G : C += or();
|
|
6998
6996
|
var D;
|
|
6999
|
-
d === null ? D = "null" :
|
|
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);
|
|
7000
6998
|
}
|
|
7001
6999
|
var F = oi(d, T, v, M, R);
|
|
7002
7000
|
if (F == null)
|
|
@@ -7005,52 +7003,52 @@ Check the top-level render call using <` + v + ">.");
|
|
|
7005
7003
|
var re = T.children;
|
|
7006
7004
|
if (re !== void 0)
|
|
7007
7005
|
if (A)
|
|
7008
|
-
if (
|
|
7006
|
+
if (Nt(re)) {
|
|
7009
7007
|
for (var Ie = 0; Ie < re.length; Ie++)
|
|
7010
|
-
|
|
7008
|
+
ur(re[Ie], d);
|
|
7011
7009
|
Object.freeze && Object.freeze(re);
|
|
7012
7010
|
} else
|
|
7013
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.");
|
|
7014
7012
|
else
|
|
7015
|
-
|
|
7013
|
+
ur(re, d);
|
|
7016
7014
|
}
|
|
7017
7015
|
if (ze.call(T, "key")) {
|
|
7018
7016
|
var we = ie(d), J = Object.keys(T).filter(function(bi) {
|
|
7019
7017
|
return bi !== "key";
|
|
7020
|
-
}),
|
|
7021
|
-
if (!
|
|
7018
|
+
}), zt = J.length > 0 ? "{key: someKey, " + J.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
7019
|
+
if (!lr[we + zt]) {
|
|
7022
7020
|
var yi = J.length > 0 ? "{" + J.join(": ..., ") + ": ...}" : "{}";
|
|
7023
7021
|
S(`A props object containing a "key" prop is being spread into JSX:
|
|
7024
7022
|
let props = %s;
|
|
7025
7023
|
<%s {...props} />
|
|
7026
7024
|
React keys must be passed directly to JSX without using spread:
|
|
7027
7025
|
let props = %s;
|
|
7028
|
-
<%s key={someKey} {...props} />`,
|
|
7026
|
+
<%s key={someKey} {...props} />`, zt, we, yi, we), lr[we + zt] = !0;
|
|
7029
7027
|
}
|
|
7030
7028
|
}
|
|
7031
7029
|
return d === s ? li(F) : ui(F), F;
|
|
7032
7030
|
}
|
|
7033
7031
|
}
|
|
7034
7032
|
function fi(d, T, v) {
|
|
7035
|
-
return
|
|
7033
|
+
return fr(d, T, v, !0);
|
|
7036
7034
|
}
|
|
7037
7035
|
function di(d, T, v) {
|
|
7038
|
-
return
|
|
7036
|
+
return fr(d, T, v, !1);
|
|
7039
7037
|
}
|
|
7040
7038
|
var hi = di, pi = fi;
|
|
7041
7039
|
Ge.Fragment = s, Ge.jsx = hi, Ge.jsxs = pi;
|
|
7042
7040
|
}(), Ge;
|
|
7043
7041
|
}
|
|
7044
|
-
var
|
|
7045
|
-
|
|
7046
|
-
var V =
|
|
7047
|
-
const
|
|
7042
|
+
var cu = {};
|
|
7043
|
+
cu.NODE_ENV === "production" ? wn.exports = ou() : wn.exports = au();
|
|
7044
|
+
var V = wn.exports;
|
|
7045
|
+
const uu = {
|
|
7048
7046
|
isLoading: !0,
|
|
7049
7047
|
data: void 0,
|
|
7050
7048
|
pageInfo: void 0,
|
|
7051
7049
|
error: void 0
|
|
7052
7050
|
};
|
|
7053
|
-
function
|
|
7051
|
+
function Gr(t) {
|
|
7054
7052
|
return {
|
|
7055
7053
|
isLoading: !t,
|
|
7056
7054
|
data: void 0,
|
|
@@ -7059,10 +7057,10 @@ function Qr(t) {
|
|
|
7059
7057
|
...t || {}
|
|
7060
7058
|
};
|
|
7061
7059
|
}
|
|
7062
|
-
function
|
|
7060
|
+
function lu(t, e, n) {
|
|
7063
7061
|
e && n && "ruleParams" in n && (e = { $$ruleParams: n.ruleParams, ...e });
|
|
7064
|
-
const r = e ?
|
|
7065
|
-
(c) => (i.current =
|
|
7062
|
+
const r = e ? tu(e) : null, s = q(r), i = it(Gr(t._reactor.getPreviousResult(r))), o = _e(
|
|
7063
|
+
(c) => (i.current = Gr(t._reactor.getPreviousResult(r)), c(), r ? t.subscribeQuery(r, (l) => {
|
|
7066
7064
|
i.current = {
|
|
7067
7065
|
isLoading: !l,
|
|
7068
7066
|
// @ts-expect-error: ts thinks this will always be overwritten
|
|
@@ -7078,9 +7076,9 @@ function fu(t, e, n) {
|
|
|
7078
7076
|
// Build a new subscribe function if the query changes
|
|
7079
7077
|
[s]
|
|
7080
7078
|
);
|
|
7081
|
-
return { state:
|
|
7079
|
+
return { state: Xt(o, () => i.current, () => uu), query: r };
|
|
7082
7080
|
}
|
|
7083
|
-
function
|
|
7081
|
+
function fu() {
|
|
7084
7082
|
const t = it(null);
|
|
7085
7083
|
Oe(() => {
|
|
7086
7084
|
n();
|
|
@@ -7093,14 +7091,14 @@ function du() {
|
|
|
7093
7091
|
}
|
|
7094
7092
|
return { set: e, clear: n };
|
|
7095
7093
|
}
|
|
7096
|
-
const
|
|
7097
|
-
function
|
|
7094
|
+
const du = 1e3;
|
|
7095
|
+
function hu(t, e, n) {
|
|
7098
7096
|
const r = it(n);
|
|
7099
7097
|
r.current = n, Oe(() => t.core._reactor.subscribeTopic(t.id, e, (i, o) => {
|
|
7100
7098
|
r.current(i, o);
|
|
7101
7099
|
}), [t.id, e]);
|
|
7102
7100
|
}
|
|
7103
|
-
function
|
|
7101
|
+
function pu(t, e) {
|
|
7104
7102
|
return Oe(() => t.core._reactor.joinRoom(t.id), [t.id]), _e((r) => {
|
|
7105
7103
|
t.core._reactor.publishTopic({
|
|
7106
7104
|
roomType: t.type,
|
|
@@ -7110,9 +7108,9 @@ function yu(t, e) {
|
|
|
7110
7108
|
});
|
|
7111
7109
|
}, [t.id, e]);
|
|
7112
7110
|
}
|
|
7113
|
-
function
|
|
7111
|
+
function yu(t, e = {}) {
|
|
7114
7112
|
var o, a;
|
|
7115
|
-
const [n, r] =
|
|
7113
|
+
const [n, r] = es(() => t.core._reactor.getPresence(t.type, t.id, e) ?? {
|
|
7116
7114
|
peers: {},
|
|
7117
7115
|
isLoading: !0
|
|
7118
7116
|
});
|
|
@@ -7122,24 +7120,24 @@ function bu(t, e = {}) {
|
|
|
7122
7120
|
const s = _e((c) => {
|
|
7123
7121
|
t.core._reactor.publishPresence(t.type, t.id, c);
|
|
7124
7122
|
}, [t.type, t.id]);
|
|
7125
|
-
return
|
|
7123
|
+
return en(() => ({
|
|
7126
7124
|
...n,
|
|
7127
7125
|
publishPresence: s
|
|
7128
7126
|
}), [n, s]);
|
|
7129
7127
|
}
|
|
7130
|
-
function
|
|
7128
|
+
function bu(t, e, n) {
|
|
7131
7129
|
Oe(() => t.core._reactor.joinRoom(t.id, e), [t.id]), Oe(() => t.core._reactor.publishPresence(t.type, t.id, e), [t.type, t.id, n ?? JSON.stringify(e)]);
|
|
7132
7130
|
}
|
|
7133
|
-
function
|
|
7134
|
-
const r =
|
|
7131
|
+
function gu(t, e, n = {}) {
|
|
7132
|
+
const r = fu(), s = me.usePresence(t, {
|
|
7135
7133
|
keys: [e]
|
|
7136
|
-
}), i =
|
|
7134
|
+
}), i = en(() => {
|
|
7137
7135
|
const l = t._core._reactor.getPresence(t.type, t.id);
|
|
7138
7136
|
return n != null && n.writeOnly ? [] : Object.values((l == null ? void 0 : l.peers) ?? {}).filter((f) => f[e] === !0);
|
|
7139
7137
|
}, [n == null ? void 0 : n.writeOnly, s]), o = _e((l) => {
|
|
7140
7138
|
t.core._reactor.publishPresence(t.type, t.id, {
|
|
7141
7139
|
[e]: l
|
|
7142
|
-
}), l && ((n == null ? void 0 : n.timeout) === null || (n == null ? void 0 : n.timeout) === 0 || r.set((n == null ? void 0 : n.timeout) ??
|
|
7140
|
+
}), l && ((n == null ? void 0 : n.timeout) === null || (n == null ? void 0 : n.timeout) === 0 || r.set((n == null ? void 0 : n.timeout) ?? du, () => {
|
|
7143
7141
|
t.core._reactor.publishPresence(t.type, t.id, {
|
|
7144
7142
|
[e]: null
|
|
7145
7143
|
});
|
|
@@ -7149,7 +7147,7 @@ function _u(t, e, n = {}) {
|
|
|
7149
7147
|
o(h);
|
|
7150
7148
|
}, [n.stopOnEnter, o]), c = _e(() => {
|
|
7151
7149
|
o(!1);
|
|
7152
|
-
}, [o]), u =
|
|
7150
|
+
}, [o]), u = en(() => ({ onKeyDown: a, onBlur: c }), [a, c]);
|
|
7153
7151
|
return {
|
|
7154
7152
|
active: i,
|
|
7155
7153
|
setActive: o,
|
|
@@ -7157,13 +7155,13 @@ function _u(t, e, n = {}) {
|
|
|
7157
7155
|
};
|
|
7158
7156
|
}
|
|
7159
7157
|
const me = {
|
|
7160
|
-
useTopicEffect:
|
|
7161
|
-
usePublishTopic:
|
|
7162
|
-
usePresence:
|
|
7163
|
-
useSyncPresence:
|
|
7164
|
-
useTypingIndicator:
|
|
7158
|
+
useTopicEffect: hu,
|
|
7159
|
+
usePublishTopic: pu,
|
|
7160
|
+
usePresence: yu,
|
|
7161
|
+
useSyncPresence: bu,
|
|
7162
|
+
useTypingIndicator: gu
|
|
7165
7163
|
};
|
|
7166
|
-
class
|
|
7164
|
+
class _u {
|
|
7167
7165
|
constructor(e, n, r) {
|
|
7168
7166
|
p(this, "core");
|
|
7169
7167
|
/** @deprecated use `core` instead */
|
|
@@ -7250,14 +7248,14 @@ class wu {
|
|
|
7250
7248
|
this.core = e, this._core = this.core, this.type = n, this.id = r;
|
|
7251
7249
|
}
|
|
7252
7250
|
}
|
|
7253
|
-
const
|
|
7251
|
+
const wu = {
|
|
7254
7252
|
isLoading: !0,
|
|
7255
7253
|
user: void 0,
|
|
7256
7254
|
error: void 0
|
|
7257
7255
|
};
|
|
7258
|
-
class
|
|
7256
|
+
class mt {
|
|
7259
7257
|
constructor(e, n) {
|
|
7260
|
-
p(this, "tx",
|
|
7258
|
+
p(this, "tx", Fn());
|
|
7261
7259
|
p(this, "auth");
|
|
7262
7260
|
p(this, "storage");
|
|
7263
7261
|
p(this, "core");
|
|
@@ -7285,7 +7283,7 @@ class St {
|
|
|
7285
7283
|
* console.log('Device ID:', deviceId)
|
|
7286
7284
|
*/
|
|
7287
7285
|
p(this, "useLocalId", (e) => {
|
|
7288
|
-
const [n, r] =
|
|
7286
|
+
const [n, r] = es(null);
|
|
7289
7287
|
return Oe(() => {
|
|
7290
7288
|
(async () => {
|
|
7291
7289
|
const i = await this.getLocalId(e);
|
|
@@ -7353,7 +7351,7 @@ class St {
|
|
|
7353
7351
|
* auth.user ? { goals: {} } : null,
|
|
7354
7352
|
* );
|
|
7355
7353
|
*/
|
|
7356
|
-
p(this, "useQuery", (e, n) =>
|
|
7354
|
+
p(this, "useQuery", (e, n) => lu(this.core, e, n).state);
|
|
7357
7355
|
/**
|
|
7358
7356
|
* Listen for the logged in state. This is useful
|
|
7359
7357
|
* for deciding when to show a login screen.
|
|
@@ -7429,7 +7427,7 @@ class St {
|
|
|
7429
7427
|
const e = it(this.core._reactor.status), n = _e((s) => this.core.subscribeConnectionStatus((o) => {
|
|
7430
7428
|
o !== e.current && (e.current = o, s());
|
|
7431
7429
|
}), []);
|
|
7432
|
-
return
|
|
7430
|
+
return Xt(
|
|
7433
7431
|
n,
|
|
7434
7432
|
() => e.current,
|
|
7435
7433
|
// For SSR, always return 'connecting' as the initial state
|
|
@@ -7478,7 +7476,7 @@ class St {
|
|
|
7478
7476
|
const n = this.useAuth();
|
|
7479
7477
|
return n.isLoading || n.error || n.user ? null : V.jsx(V.Fragment, { children: e });
|
|
7480
7478
|
});
|
|
7481
|
-
this.core =
|
|
7479
|
+
this.core = su(
|
|
7482
7480
|
e,
|
|
7483
7481
|
// @ts-expect-error because TS can't resolve subclass statics
|
|
7484
7482
|
this.constructor.Storage,
|
|
@@ -7502,13 +7500,13 @@ class St {
|
|
|
7502
7500
|
* const { peers } = db.rooms.usePresence(room);
|
|
7503
7501
|
*/
|
|
7504
7502
|
room(e = "_defaultRoomType", n = "_defaultRoomId") {
|
|
7505
|
-
return new
|
|
7503
|
+
return new _u(this.core, e, n);
|
|
7506
7504
|
}
|
|
7507
7505
|
_useAuth() {
|
|
7508
7506
|
const e = it(this.core._reactor._currentUserCached), n = _e((s) => this.core.subscribeAuth((o) => {
|
|
7509
7507
|
e.current = { isLoading: !1, ...o }, s();
|
|
7510
7508
|
}), []);
|
|
7511
|
-
return
|
|
7509
|
+
return Xt(n, () => e.current, () => wu);
|
|
7512
7510
|
}
|
|
7513
7511
|
/**
|
|
7514
7512
|
* One time query for the logged in state. This is useful
|
|
@@ -7524,23 +7522,23 @@ class St {
|
|
|
7524
7522
|
return this.core.getAuth();
|
|
7525
7523
|
}
|
|
7526
7524
|
}
|
|
7527
|
-
p(
|
|
7528
|
-
class
|
|
7525
|
+
p(mt, "Storage"), p(mt, "NetworkListener"), p(mt, "EventSourceImpl");
|
|
7526
|
+
class Qr extends Error {
|
|
7529
7527
|
constructor(e, n) {
|
|
7530
7528
|
super(e), this.name = "ParseError", this.type = n.type, this.field = n.field, this.value = n.value, this.line = n.line;
|
|
7531
7529
|
}
|
|
7532
7530
|
}
|
|
7533
|
-
function
|
|
7531
|
+
function Zt(t) {
|
|
7534
7532
|
}
|
|
7535
|
-
function
|
|
7533
|
+
function Tu(t) {
|
|
7536
7534
|
if (typeof t == "function")
|
|
7537
7535
|
throw new TypeError(
|
|
7538
7536
|
"`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?"
|
|
7539
7537
|
);
|
|
7540
|
-
const { onEvent: e =
|
|
7538
|
+
const { onEvent: e = Zt, onError: n = Zt, onRetry: r = Zt, onComment: s } = t;
|
|
7541
7539
|
let i = "", o = !0, a, c = "", u = "";
|
|
7542
7540
|
function l(g) {
|
|
7543
|
-
const w = o ? g.replace(/^\xEF\xBB\xBF/, "") : g, [m, _] =
|
|
7541
|
+
const w = o ? g.replace(/^\xEF\xBB\xBF/, "") : g, [m, _] = mu(`${i}${w}`);
|
|
7544
7542
|
for (const S of m)
|
|
7545
7543
|
f(S);
|
|
7546
7544
|
i = _, o = !1;
|
|
@@ -7576,7 +7574,7 @@ function mu(t) {
|
|
|
7576
7574
|
break;
|
|
7577
7575
|
case "retry":
|
|
7578
7576
|
/^\d+$/.test(w) ? r(parseInt(w, 10)) : n(
|
|
7579
|
-
new
|
|
7577
|
+
new Qr(`Invalid \`retry\` value: "${w}"`, {
|
|
7580
7578
|
type: "invalid-retry",
|
|
7581
7579
|
value: w,
|
|
7582
7580
|
line: m
|
|
@@ -7585,7 +7583,7 @@ function mu(t) {
|
|
|
7585
7583
|
break;
|
|
7586
7584
|
default:
|
|
7587
7585
|
n(
|
|
7588
|
-
new
|
|
7586
|
+
new Qr(
|
|
7589
7587
|
`Unknown field "${g.length > 20 ? `${g.slice(0, 20)}…` : g}"`,
|
|
7590
7588
|
{ type: "unknown-field", field: g, value: w, line: m }
|
|
7591
7589
|
)
|
|
@@ -7608,7 +7606,7 @@ function mu(t) {
|
|
|
7608
7606
|
}
|
|
7609
7607
|
return { feed: l, reset: b };
|
|
7610
7608
|
}
|
|
7611
|
-
function
|
|
7609
|
+
function mu(t) {
|
|
7612
7610
|
const e = [];
|
|
7613
7611
|
let n = "", r = 0;
|
|
7614
7612
|
for (; r < t.length; ) {
|
|
@@ -7626,7 +7624,7 @@ function Su(t) {
|
|
|
7626
7624
|
}
|
|
7627
7625
|
return [e, n];
|
|
7628
7626
|
}
|
|
7629
|
-
class
|
|
7627
|
+
class Hr extends Event {
|
|
7630
7628
|
/**
|
|
7631
7629
|
* Constructs a new `ErrorEvent` instance. This is typically not called directly,
|
|
7632
7630
|
* but rather emitted by the `EventSource` object when an error occurs.
|
|
@@ -7651,7 +7649,7 @@ class Jr extends Event {
|
|
|
7651
7649
|
* @returns A string representation of the error
|
|
7652
7650
|
*/
|
|
7653
7651
|
[Symbol.for("nodejs.util.inspect.custom")](e, n, r) {
|
|
7654
|
-
return r(
|
|
7652
|
+
return r(Jr(this), n);
|
|
7655
7653
|
}
|
|
7656
7654
|
/**
|
|
7657
7655
|
* Deno "hides" the `message` and `code` properties of the `ErrorEvent` instance,
|
|
@@ -7665,17 +7663,17 @@ class Jr extends Event {
|
|
|
7665
7663
|
* @returns A string representation of the error
|
|
7666
7664
|
*/
|
|
7667
7665
|
[Symbol.for("Deno.customInspect")](e, n) {
|
|
7668
|
-
return e(
|
|
7666
|
+
return e(Jr(this), n);
|
|
7669
7667
|
}
|
|
7670
7668
|
}
|
|
7671
|
-
function
|
|
7669
|
+
function Su(t) {
|
|
7672
7670
|
const e = globalThis.DOMException;
|
|
7673
7671
|
return typeof e == "function" ? new e(t, "SyntaxError") : new SyntaxError(t);
|
|
7674
7672
|
}
|
|
7675
|
-
function
|
|
7676
|
-
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}`;
|
|
7677
7675
|
}
|
|
7678
|
-
function
|
|
7676
|
+
function Jr(t) {
|
|
7679
7677
|
return {
|
|
7680
7678
|
type: t.type,
|
|
7681
7679
|
message: t.message,
|
|
@@ -7687,11 +7685,11 @@ function Yr(t) {
|
|
|
7687
7685
|
}
|
|
7688
7686
|
var qs = (t) => {
|
|
7689
7687
|
throw TypeError(t);
|
|
7690
|
-
},
|
|
7691
|
-
class
|
|
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;
|
|
7689
|
+
class vt extends EventTarget {
|
|
7692
7690
|
constructor(e, n) {
|
|
7693
7691
|
var r, s;
|
|
7694
|
-
super(), K(this, oe), this.CONNECTING = 0, this.OPEN = 1, this.CLOSED = 2, K(this, Y), K(this, Se), K(this, je), 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) => {
|
|
7695
7693
|
var o;
|
|
7696
7694
|
k(this, Re).reset();
|
|
7697
7695
|
const { body: a, redirected: c, status: u, headers: l } = i;
|
|
@@ -7719,11 +7717,11 @@ class Et extends EventTarget {
|
|
|
7719
7717
|
let b = !0;
|
|
7720
7718
|
do {
|
|
7721
7719
|
const { done: g, value: w } = await y.read();
|
|
7722
|
-
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));
|
|
7723
7721
|
} while (b);
|
|
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
7724
|
}), K(this, En, (i) => {
|
|
7725
|
-
$(this, ge, void 0), !(i.name === "AbortError" || i.type === "aborted") && he(this, oe, kn).call(this, mn(i));
|
|
7726
|
-
}), K(this, On, (i) => {
|
|
7727
7725
|
typeof i.id == "string" && $(this, st, i.id);
|
|
7728
7726
|
const o = new MessageEvent(i.event || "message", {
|
|
7729
7727
|
data: i.data,
|
|
@@ -7731,25 +7729,25 @@ class Et extends EventTarget {
|
|
|
7731
7729
|
lastEventId: i.id || ""
|
|
7732
7730
|
});
|
|
7733
7731
|
k(this, xe) && (!i.event || i.event === "message") && k(this, xe).call(this, o), this.dispatchEvent(o);
|
|
7734
|
-
}), K(this,
|
|
7732
|
+
}), K(this, On, (i) => {
|
|
7735
7733
|
$(this, rt, i);
|
|
7736
|
-
}), K(this,
|
|
7737
|
-
$(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);
|
|
7738
7736
|
});
|
|
7739
7737
|
try {
|
|
7740
7738
|
if (e instanceof URL)
|
|
7741
7739
|
$(this, Se, e);
|
|
7742
7740
|
else if (typeof e == "string")
|
|
7743
|
-
$(this, Se, new URL(e,
|
|
7741
|
+
$(this, Se, new URL(e, vu()));
|
|
7744
7742
|
else
|
|
7745
7743
|
throw new Error("Invalid URL");
|
|
7746
7744
|
} catch {
|
|
7747
|
-
throw
|
|
7745
|
+
throw Su("An invalid or illegal string was specified");
|
|
7748
7746
|
}
|
|
7749
|
-
$(this, Re,
|
|
7750
|
-
onEvent: k(this,
|
|
7751
|
-
onRetry: k(this,
|
|
7752
|
-
})), $(this, Y, this.CONNECTING), $(this, rt, 3e3), $(this,
|
|
7747
|
+
$(this, Re, Tu({
|
|
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);
|
|
7753
7751
|
}
|
|
7754
7752
|
/**
|
|
7755
7753
|
* Returns the state of this EventSource object's connection. It can have the values described below.
|
|
@@ -7780,7 +7778,7 @@ class Et extends EventTarget {
|
|
|
7780
7778
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/withCredentials)
|
|
7781
7779
|
*/
|
|
7782
7780
|
get withCredentials() {
|
|
7783
|
-
return k(this,
|
|
7781
|
+
return k(this, St);
|
|
7784
7782
|
}
|
|
7785
7783
|
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/error_event) */
|
|
7786
7784
|
get onerror() {
|
|
@@ -7822,20 +7820,20 @@ class Et extends EventTarget {
|
|
|
7822
7820
|
k(this, $e) && clearTimeout(k(this, $e)), k(this, Y) !== this.CLOSED && (k(this, ge) && k(this, ge).abort(), $(this, Y, this.CLOSED), $(this, ge, void 0));
|
|
7823
7821
|
}
|
|
7824
7822
|
}
|
|
7825
|
-
Y = /* @__PURE__ */ new WeakMap(), Se = /* @__PURE__ */ new WeakMap(), je = /* @__PURE__ */ new WeakMap(),
|
|
7823
|
+
Y = /* @__PURE__ */ new WeakMap(), Se = /* @__PURE__ */ new WeakMap(), je = /* @__PURE__ */ new WeakMap(), St = /* @__PURE__ */ new WeakMap(), Pt = /* @__PURE__ */ new WeakMap(), rt = /* @__PURE__ */ new WeakMap(), $e = /* @__PURE__ */ new WeakMap(), st = /* @__PURE__ */ new WeakMap(), ge = /* @__PURE__ */ new WeakMap(), Re = /* @__PURE__ */ new WeakMap(), Ue = /* @__PURE__ */ new WeakMap(), xe = /* @__PURE__ */ new WeakMap(), Ze = /* @__PURE__ */ new WeakMap(), oe = /* @__PURE__ */ new WeakSet(), /**
|
|
7826
7824
|
* Connect to the given URL and start receiving events
|
|
7827
7825
|
*
|
|
7828
7826
|
* @internal
|
|
7829
7827
|
*/
|
|
7830
|
-
|
|
7831
|
-
$(this, Y, this.CONNECTING), $(this, ge, new AbortController()), k(this,
|
|
7832
|
-
},
|
|
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(), /**
|
|
7833
7831
|
* Get request options for the `fetch()` request
|
|
7834
7832
|
*
|
|
7835
7833
|
* @returns The request options
|
|
7836
7834
|
* @internal
|
|
7837
7835
|
*/
|
|
7838
|
-
|
|
7836
|
+
Yr = function() {
|
|
7839
7837
|
var t;
|
|
7840
7838
|
const e = {
|
|
7841
7839
|
// [spec] Let `corsAttributeState` be `Anonymous`…
|
|
@@ -7847,7 +7845,7 @@ Zr = function() {
|
|
|
7847
7845
|
signal: (t = k(this, ge)) == null ? void 0 : t.signal
|
|
7848
7846
|
};
|
|
7849
7847
|
return "window" in globalThis && (e.credentials = this.withCredentials ? "include" : "same-origin"), e;
|
|
7850
|
-
},
|
|
7848
|
+
}, En = /* @__PURE__ */ new WeakMap(), On = /* @__PURE__ */ new WeakMap(), /**
|
|
7851
7849
|
* Handles the process referred to in the EventSource specification as "failing a connection".
|
|
7852
7850
|
*
|
|
7853
7851
|
* @param error - The error causing the connection to fail
|
|
@@ -7857,7 +7855,7 @@ Zr = function() {
|
|
|
7857
7855
|
Xe = function(t, e) {
|
|
7858
7856
|
var n;
|
|
7859
7857
|
k(this, Y) !== this.CLOSED && $(this, Y, this.CLOSED);
|
|
7860
|
-
const r = new
|
|
7858
|
+
const r = new Hr("error", { code: e, message: t });
|
|
7861
7859
|
(n = k(this, Ue)) == null || n.call(this, r), this.dispatchEvent(r);
|
|
7862
7860
|
}, /**
|
|
7863
7861
|
* Schedules a reconnection attempt against the EventSource endpoint.
|
|
@@ -7866,46 +7864,46 @@ Xe = function(t, e) {
|
|
|
7866
7864
|
* @param code - The HTTP status code, if available
|
|
7867
7865
|
* @internal
|
|
7868
7866
|
*/
|
|
7869
|
-
|
|
7867
|
+
An = function(t, e) {
|
|
7870
7868
|
var n;
|
|
7871
7869
|
if (k(this, Y) === this.CLOSED)
|
|
7872
7870
|
return;
|
|
7873
7871
|
$(this, Y, this.CONNECTING);
|
|
7874
|
-
const r = new
|
|
7875
|
-
(n = k(this, Ue)) == null || n.call(this, r), this.dispatchEvent(r), $(this, $e, setTimeout(k(this,
|
|
7876
|
-
},
|
|
7872
|
+
const r = new Hr("error", { code: e, message: t });
|
|
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(), /**
|
|
7877
7875
|
* ReadyState representing an EventSource currently trying to connect
|
|
7878
7876
|
*
|
|
7879
7877
|
* @public
|
|
7880
7878
|
*/
|
|
7881
|
-
|
|
7879
|
+
vt.CONNECTING = 0, /**
|
|
7882
7880
|
* ReadyState representing an EventSource connection that is open (eg connected)
|
|
7883
7881
|
*
|
|
7884
7882
|
* @public
|
|
7885
7883
|
*/
|
|
7886
|
-
|
|
7884
|
+
vt.OPEN = 1, /**
|
|
7887
7885
|
* ReadyState representing an EventSource connection that is closed (eg disconnected)
|
|
7888
7886
|
*
|
|
7889
7887
|
* @public
|
|
7890
7888
|
*/
|
|
7891
|
-
|
|
7892
|
-
function
|
|
7889
|
+
vt.CLOSED = 2;
|
|
7890
|
+
function vu() {
|
|
7893
7891
|
const t = "document" in globalThis ? globalThis.document : void 0;
|
|
7894
7892
|
return t && typeof t == "object" && "baseURI" in t && typeof t.baseURI == "string" ? t.baseURI : void 0;
|
|
7895
7893
|
}
|
|
7896
|
-
class Ws extends
|
|
7894
|
+
class Ws extends mt {
|
|
7897
7895
|
}
|
|
7898
|
-
p(Ws, "EventSourceImpl",
|
|
7899
|
-
function
|
|
7896
|
+
p(Ws, "EventSourceImpl", vt);
|
|
7897
|
+
function Eu(t) {
|
|
7900
7898
|
const e = {
|
|
7901
7899
|
...t,
|
|
7902
7900
|
useDateObjects: t.useDateObjects ?? !1
|
|
7903
7901
|
};
|
|
7904
7902
|
return new Ws(e, {
|
|
7905
|
-
"@instantdb/react":
|
|
7903
|
+
"@instantdb/react": Kn
|
|
7906
7904
|
});
|
|
7907
7905
|
}
|
|
7908
|
-
const Ru =
|
|
7906
|
+
const Ru = Eu;
|
|
7909
7907
|
function xu({
|
|
7910
7908
|
as: t = "div",
|
|
7911
7909
|
spaceId: e,
|
|
@@ -7977,9 +7975,9 @@ function xu({
|
|
|
7977
7975
|
"div",
|
|
7978
7976
|
{
|
|
7979
7977
|
style: {
|
|
7980
|
-
...
|
|
7981
|
-
...
|
|
7982
|
-
zIndex: u !== void 0 ? u :
|
|
7978
|
+
...Zr,
|
|
7979
|
+
...Au,
|
|
7980
|
+
zIndex: u !== void 0 ? u : ku
|
|
7983
7981
|
},
|
|
7984
7982
|
children: Object.entries(f.peers).map(([_, S]) => {
|
|
7985
7983
|
const O = S[l];
|
|
@@ -7987,7 +7985,7 @@ function xu({
|
|
|
7987
7985
|
"div",
|
|
7988
7986
|
{
|
|
7989
7987
|
style: {
|
|
7990
|
-
...
|
|
7988
|
+
...Zr,
|
|
7991
7989
|
transform: `translate(${O.xPercent}%, ${O.yPercent}%)`,
|
|
7992
7990
|
transformOrigin: "0 0",
|
|
7993
7991
|
transition: "transform 100ms"
|
|
@@ -7995,7 +7993,7 @@ function xu({
|
|
|
7995
7993
|
children: a ? a({
|
|
7996
7994
|
color: O.color,
|
|
7997
7995
|
presence: h == null ? void 0 : h.peers[_]
|
|
7998
|
-
}) : /* @__PURE__ */ V.jsx(
|
|
7996
|
+
}) : /* @__PURE__ */ V.jsx(Ou, { ...O })
|
|
7999
7997
|
},
|
|
8000
7998
|
_
|
|
8001
7999
|
) : null;
|
|
@@ -8006,7 +8004,7 @@ function xu({
|
|
|
8006
8004
|
]
|
|
8007
8005
|
);
|
|
8008
8006
|
}
|
|
8009
|
-
function
|
|
8007
|
+
function Ou({ color: t }) {
|
|
8010
8008
|
const n = t || "black";
|
|
8011
8009
|
return /* @__PURE__ */ V.jsxs(
|
|
8012
8010
|
"svg",
|
|
@@ -8053,27 +8051,27 @@ function Au({ color: t }) {
|
|
|
8053
8051
|
}
|
|
8054
8052
|
);
|
|
8055
8053
|
}
|
|
8056
|
-
const
|
|
8054
|
+
const Zr = {
|
|
8057
8055
|
position: "absolute",
|
|
8058
8056
|
top: 0,
|
|
8059
8057
|
left: 0,
|
|
8060
8058
|
bottom: 0,
|
|
8061
8059
|
right: 0
|
|
8062
|
-
},
|
|
8060
|
+
}, Au = {
|
|
8063
8061
|
overflow: "hidden",
|
|
8064
8062
|
pointerEvents: "none",
|
|
8065
8063
|
userSelect: "none"
|
|
8066
|
-
},
|
|
8064
|
+
}, ku = 99999;
|
|
8067
8065
|
export {
|
|
8068
8066
|
xu as Cursors,
|
|
8069
|
-
|
|
8070
|
-
|
|
8067
|
+
jt as InstantAPIError,
|
|
8068
|
+
mt as InstantReactAbstractDatabase,
|
|
8071
8069
|
Ws as InstantReactWebDatabase,
|
|
8072
8070
|
Te as SyncTableCallbackEventType,
|
|
8073
8071
|
ju as i,
|
|
8074
8072
|
W as id,
|
|
8075
|
-
|
|
8073
|
+
Eu as init,
|
|
8076
8074
|
Ru as init_experimental,
|
|
8077
|
-
|
|
8075
|
+
Iu as lookup,
|
|
8078
8076
|
Mu as tx
|
|
8079
8077
|
};
|