@instantdb/react 0.22.119-experimental.drewh-tanstack-start.21533425240.1 → 0.22.119-experimental.streams.21539576498.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 +1159 -964
- package/dist/standalone/index.umd.cjs +14 -14
- package/package.json +4 -4
package/dist/standalone/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
var
|
|
2
|
-
var wi = (t, e, n) => e in t ?
|
|
1
|
+
var gi = Object.defineProperty;
|
|
2
|
+
var wi = (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) => wi(t, typeof e != "symbol" ? e + "" : e, n);
|
|
4
|
-
import ts, { useRef as it, useCallback as
|
|
4
|
+
import ts, { useRef as it, useCallback as ge, useSyncExternalStore as tn, useEffect as Oe, useMemo as nn, useState as ns, createElement as mi } from "react";
|
|
5
5
|
function q(t) {
|
|
6
6
|
if (typeof t == "number")
|
|
7
7
|
return (Math.abs(t * 2654435761) >>> 0).toString(16);
|
|
@@ -44,10 +44,10 @@ const U = {
|
|
|
44
44
|
Remove: "remove",
|
|
45
45
|
Replace: "replace",
|
|
46
46
|
Add: "add"
|
|
47
|
-
}, rs = Symbol.for("__MUTATIVE_PROXY_DRAFT__"),
|
|
47
|
+
}, rs = Symbol.for("__MUTATIVE_PROXY_DRAFT__"), Ti = Symbol("__MUTATIVE_RAW_RETURN_SYMBOL__"), wt = Symbol.iterator, ne = {
|
|
48
48
|
mutable: "mutable",
|
|
49
49
|
immutable: "immutable"
|
|
50
|
-
},
|
|
50
|
+
}, Pn = {};
|
|
51
51
|
function et(t, e) {
|
|
52
52
|
return t instanceof Map ? t.has(e) : Object.prototype.hasOwnProperty.call(t, e);
|
|
53
53
|
}
|
|
@@ -65,7 +65,7 @@ function pr(t, e) {
|
|
|
65
65
|
function Mn(t) {
|
|
66
66
|
return Object.getPrototypeOf(t) === Set.prototype;
|
|
67
67
|
}
|
|
68
|
-
function
|
|
68
|
+
function Rn(t) {
|
|
69
69
|
return Object.getPrototypeOf(t) === Map.prototype;
|
|
70
70
|
}
|
|
71
71
|
function te(t) {
|
|
@@ -73,14 +73,14 @@ function te(t) {
|
|
|
73
73
|
return (e = t.copy) !== null && e !== void 0 ? e : t.original;
|
|
74
74
|
}
|
|
75
75
|
function Ae(t) {
|
|
76
|
-
return !!
|
|
76
|
+
return !!I(t);
|
|
77
77
|
}
|
|
78
|
-
function
|
|
78
|
+
function I(t) {
|
|
79
79
|
return typeof t != "object" ? null : t == null ? void 0 : t[rs];
|
|
80
80
|
}
|
|
81
|
-
function
|
|
81
|
+
function jn(t) {
|
|
82
82
|
var e;
|
|
83
|
-
const n =
|
|
83
|
+
const n = I(t);
|
|
84
84
|
return n ? (e = n.copy) !== null && e !== void 0 ? e : n.original : t;
|
|
85
85
|
}
|
|
86
86
|
function ce(t, e) {
|
|
@@ -91,7 +91,7 @@ function ce(t, e) {
|
|
|
91
91
|
}
|
|
92
92
|
function ss(t, e = []) {
|
|
93
93
|
if (Object.hasOwnProperty.call(t, "key")) {
|
|
94
|
-
const n = t.parent.copy, r =
|
|
94
|
+
const n = t.parent.copy, r = I(ye(n, t.key));
|
|
95
95
|
if (r !== null && (r == null ? void 0 : r.original) !== t.original)
|
|
96
96
|
return null;
|
|
97
97
|
const s = t.parent.type === 3, i = s ? Array.from(t.parent.setMap.keys()).indexOf(t.key) : t.key;
|
|
@@ -119,7 +119,7 @@ function at(t, e, n) {
|
|
|
119
119
|
ke(t) === 2 ? t.set(e, n) : t[e] = n;
|
|
120
120
|
}
|
|
121
121
|
function Gt(t, e) {
|
|
122
|
-
const n =
|
|
122
|
+
const n = I(t);
|
|
123
123
|
return (n ? te(n) : t)[e];
|
|
124
124
|
}
|
|
125
125
|
function pe(t, e) {
|
|
@@ -172,7 +172,7 @@ function is(t, e) {
|
|
|
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 (!Rn(t)) {
|
|
176
176
|
const r = Object.getPrototypeOf(t).constructor;
|
|
177
177
|
return new r(t);
|
|
178
178
|
}
|
|
@@ -201,7 +201,7 @@ function Q(t) {
|
|
|
201
201
|
}
|
|
202
202
|
function Qe(t) {
|
|
203
203
|
if (!ce(t))
|
|
204
|
-
return
|
|
204
|
+
return jn(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 (!Rn(t)) {
|
|
213
213
|
const r = Object.getPrototypeOf(t).constructor;
|
|
214
214
|
return new r(n);
|
|
215
215
|
}
|
|
@@ -228,7 +228,7 @@ function Qe(t) {
|
|
|
228
228
|
e[n] = Qe(t[n]);
|
|
229
229
|
return e;
|
|
230
230
|
}
|
|
231
|
-
function
|
|
231
|
+
function mt(t) {
|
|
232
232
|
return Ae(t) ? Qe(t) : t;
|
|
233
233
|
}
|
|
234
234
|
function fe(t) {
|
|
@@ -304,7 +304,7 @@ function os(t, e, n) {
|
|
|
304
304
|
if (e.add(t), xn(t, (i, o) => {
|
|
305
305
|
var a;
|
|
306
306
|
if (Ae(o)) {
|
|
307
|
-
const c =
|
|
307
|
+
const c = I(o);
|
|
308
308
|
Q(c);
|
|
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);
|
|
@@ -323,7 +323,7 @@ function Oi(t, e) {
|
|
|
323
323
|
}
|
|
324
324
|
function sn(t) {
|
|
325
325
|
t.type === 3 && t.copy && (t.copy.clear(), t.setMap.forEach((e) => {
|
|
326
|
-
t.copy.add(
|
|
326
|
+
t.copy.add(jn(e));
|
|
327
327
|
}));
|
|
328
328
|
}
|
|
329
329
|
function on(t, e, n, r) {
|
|
@@ -336,7 +336,7 @@ function on(t, e, n, r) {
|
|
|
336
336
|
}
|
|
337
337
|
}
|
|
338
338
|
function $n(t, e, n, r) {
|
|
339
|
-
const s =
|
|
339
|
+
const s = I(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;
|
|
@@ -359,12 +359,12 @@ function Ai(t, e, n, r, s) {
|
|
|
359
359
|
op: U.Replace,
|
|
360
360
|
path: f,
|
|
361
361
|
// If it is a draft, it needs to be deep cloned, and it may also be non-draft.
|
|
362
|
-
value:
|
|
362
|
+
value: mt(c[u])
|
|
363
363
|
}), r.push({
|
|
364
364
|
op: U.Replace,
|
|
365
365
|
path: f,
|
|
366
366
|
// If it is a draft, it needs to be deep cloned, and it may also be non-draft.
|
|
367
|
-
value:
|
|
367
|
+
value: mt(i[u])
|
|
368
368
|
});
|
|
369
369
|
}
|
|
370
370
|
for (let u = i.length; u < c.length; u += 1) {
|
|
@@ -373,7 +373,7 @@ function Ai(t, e, n, r, s) {
|
|
|
373
373
|
op: U.Add,
|
|
374
374
|
path: f,
|
|
375
375
|
// If it is a draft, it needs to be deep cloned, and it may also be non-draft.
|
|
376
|
-
value:
|
|
376
|
+
value: mt(c[u])
|
|
377
377
|
});
|
|
378
378
|
}
|
|
379
379
|
if (i.length < c.length) {
|
|
@@ -387,20 +387,20 @@ function Ai(t, e, n, r, s) {
|
|
|
387
387
|
});
|
|
388
388
|
} else
|
|
389
389
|
for (let l = c.length; i.length < l; l -= 1) {
|
|
390
|
-
const f = e.concat([l - 1]),
|
|
390
|
+
const f = e.concat([l - 1]), d = ve(f, s);
|
|
391
391
|
r.push({
|
|
392
392
|
op: U.Remove,
|
|
393
|
-
path:
|
|
393
|
+
path: d
|
|
394
394
|
});
|
|
395
395
|
}
|
|
396
396
|
}
|
|
397
397
|
}
|
|
398
398
|
function ki({ original: t, copy: e, assignedMap: n }, r, s, i, o) {
|
|
399
399
|
n.forEach((a, c) => {
|
|
400
|
-
const u = ye(t, c), l =
|
|
400
|
+
const u = ye(t, c), l = mt(ye(e, c)), f = a ? et(t, c) ? U.Replace : U.Add : U.Remove;
|
|
401
401
|
if (pe(u, l) && f === U.Replace)
|
|
402
402
|
return;
|
|
403
|
-
const
|
|
403
|
+
const d = r.concat(c), y = ve(d, o);
|
|
404
404
|
s.push(f === U.Remove ? { op: f, path: y } : { op: f, path: y, value: l }), i.push(f === U.Add ? { op: U.Remove, path: y } : f === U.Remove ? { op: U.Add, path: y, value: u } : { op: U.Replace, path: y, value: u });
|
|
405
405
|
});
|
|
406
406
|
}
|
|
@@ -453,23 +453,23 @@ const At = (t, e, n = !1) => {
|
|
|
453
453
|
throw new Error("Strict mode: Mutable data cannot be accessed directly, please use 'unsafe(callback)' wrap.");
|
|
454
454
|
}, an = {
|
|
455
455
|
get size() {
|
|
456
|
-
return te(
|
|
456
|
+
return te(I(this)).size;
|
|
457
457
|
},
|
|
458
458
|
has(t) {
|
|
459
|
-
return te(
|
|
459
|
+
return te(I(this)).has(t);
|
|
460
460
|
},
|
|
461
461
|
set(t, e) {
|
|
462
|
-
const n =
|
|
462
|
+
const n = I(this), r = te(n);
|
|
463
463
|
return (!r.has(t) || !pe(r.get(t), e)) && (Q(n), fe(n), n.assignedMap.set(t, !0), n.copy.set(t, e), $n(n, t, e, ot)), this;
|
|
464
464
|
},
|
|
465
465
|
delete(t) {
|
|
466
466
|
if (!this.has(t))
|
|
467
467
|
return !1;
|
|
468
|
-
const e =
|
|
468
|
+
const e = I(this);
|
|
469
469
|
return Q(e), fe(e), e.original.has(t) ? e.assignedMap.set(t, !1) : e.assignedMap.delete(t), e.copy.delete(t), !0;
|
|
470
470
|
},
|
|
471
471
|
clear() {
|
|
472
|
-
const t =
|
|
472
|
+
const t = I(this);
|
|
473
473
|
if (this.size) {
|
|
474
474
|
Q(t), fe(t), t.assignedMap = /* @__PURE__ */ new Map();
|
|
475
475
|
for (const [e] of t.original)
|
|
@@ -478,17 +478,17 @@ const At = (t, e, n = !1) => {
|
|
|
478
478
|
}
|
|
479
479
|
},
|
|
480
480
|
forEach(t, e) {
|
|
481
|
-
const n =
|
|
481
|
+
const n = I(this);
|
|
482
482
|
te(n).forEach((r, s) => {
|
|
483
483
|
t.call(e, this.get(s), s, this);
|
|
484
484
|
});
|
|
485
485
|
},
|
|
486
486
|
get(t) {
|
|
487
487
|
var e, n;
|
|
488
|
-
const r =
|
|
488
|
+
const r = I(this), s = te(r).get(t), i = ((n = (e = r.options).mark) === null || n === void 0 ? void 0 : n.call(e, s, ne)) === ne.mutable;
|
|
489
489
|
if (r.options.strict && At(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 = Pn.createDraft({
|
|
492
492
|
original: s,
|
|
493
493
|
parentDraft: r,
|
|
494
494
|
key: t,
|
|
@@ -498,7 +498,7 @@ const At = (t, e, n = !1) => {
|
|
|
498
498
|
return Q(r), r.copy.set(t, o), o;
|
|
499
499
|
},
|
|
500
500
|
keys() {
|
|
501
|
-
return te(
|
|
501
|
+
return te(I(this)).keys();
|
|
502
502
|
},
|
|
503
503
|
values() {
|
|
504
504
|
const t = this.keys();
|
|
@@ -532,16 +532,16 @@ const At = (t, e, n = !1) => {
|
|
|
532
532
|
[wt]() {
|
|
533
533
|
return this.entries();
|
|
534
534
|
}
|
|
535
|
-
},
|
|
535
|
+
}, Ii = Reflect.ownKeys(an), br = (t, e, { isValuesIterator: n }) => () => {
|
|
536
536
|
var r, s;
|
|
537
537
|
const i = e.next();
|
|
538
538
|
if (i.done)
|
|
539
539
|
return i;
|
|
540
540
|
const o = i.value;
|
|
541
541
|
let a = t.setMap.get(o);
|
|
542
|
-
const c =
|
|
542
|
+
const c = I(a), u = ((s = (r = t.options).mark) === null || s === void 0 ? void 0 : s.call(r, a, ne)) === ne.mutable;
|
|
543
543
|
if (t.options.strict && At(o, t.options, u), !u && !c && ce(o, t.options) && !t.finalized && t.original.has(o)) {
|
|
544
|
-
const l =
|
|
544
|
+
const l = Pn.createDraft({
|
|
545
545
|
original: o,
|
|
546
546
|
parentDraft: t,
|
|
547
547
|
key: o,
|
|
@@ -556,39 +556,39 @@ const At = (t, e, n = !1) => {
|
|
|
556
556
|
};
|
|
557
557
|
}, kt = {
|
|
558
558
|
get size() {
|
|
559
|
-
return
|
|
559
|
+
return I(this).setMap.size;
|
|
560
560
|
},
|
|
561
561
|
has(t) {
|
|
562
|
-
const e =
|
|
562
|
+
const e = I(this);
|
|
563
563
|
if (e.setMap.has(t))
|
|
564
564
|
return !0;
|
|
565
565
|
Q(e);
|
|
566
|
-
const n =
|
|
566
|
+
const n = I(t);
|
|
567
567
|
return !!(n && e.setMap.has(n.original));
|
|
568
568
|
},
|
|
569
569
|
add(t) {
|
|
570
|
-
const e =
|
|
570
|
+
const e = I(this);
|
|
571
571
|
return this.has(t) || (Q(e), fe(e), e.assignedMap.set(t, !0), e.setMap.set(t, t), $n(e, t, t, ot)), this;
|
|
572
572
|
},
|
|
573
573
|
delete(t) {
|
|
574
574
|
if (!this.has(t))
|
|
575
575
|
return !1;
|
|
576
|
-
const e =
|
|
576
|
+
const e = I(this);
|
|
577
577
|
Q(e), fe(e);
|
|
578
|
-
const n =
|
|
578
|
+
const n = I(t);
|
|
579
579
|
return n && e.setMap.has(n.original) ? (e.assignedMap.set(n.original, !1), e.setMap.delete(n.original)) : (!n && e.setMap.has(t) ? e.assignedMap.set(t, !1) : e.assignedMap.delete(t), e.setMap.delete(t));
|
|
580
580
|
},
|
|
581
581
|
clear() {
|
|
582
582
|
if (!this.size)
|
|
583
583
|
return;
|
|
584
|
-
const t =
|
|
584
|
+
const t = I(this);
|
|
585
585
|
Q(t), fe(t);
|
|
586
586
|
for (const e of t.original)
|
|
587
587
|
t.assignedMap.set(e, !1);
|
|
588
588
|
t.setMap.clear();
|
|
589
589
|
},
|
|
590
590
|
values() {
|
|
591
|
-
const t =
|
|
591
|
+
const t = I(this);
|
|
592
592
|
Q(t);
|
|
593
593
|
const e = t.setMap.keys();
|
|
594
594
|
return {
|
|
@@ -597,7 +597,7 @@ const At = (t, e, n = !1) => {
|
|
|
597
597
|
};
|
|
598
598
|
},
|
|
599
599
|
entries() {
|
|
600
|
-
const t =
|
|
600
|
+
const t = I(this);
|
|
601
601
|
Q(t);
|
|
602
602
|
const e = t.setMap.keys();
|
|
603
603
|
return {
|
|
@@ -643,7 +643,7 @@ Set.prototype.difference && Object.assign(kt, {
|
|
|
643
643
|
return Set.prototype.isDisjointFrom.call(new Set(this.values()), t);
|
|
644
644
|
}
|
|
645
645
|
});
|
|
646
|
-
const
|
|
646
|
+
const Pi = Reflect.ownKeys(kt), as = /* @__PURE__ */ new WeakSet(), cs = {
|
|
647
647
|
get(t, e, n) {
|
|
648
648
|
var r, s;
|
|
649
649
|
const i = (r = t.copy) === null || r === void 0 ? void 0 : r[e];
|
|
@@ -658,14 +658,14 @@ const Ii = Reflect.ownKeys(kt), as = /* @__PURE__ */ new WeakSet(), cs = {
|
|
|
658
658
|
return t.options.strict && At(u, t.options, !0), u;
|
|
659
659
|
}
|
|
660
660
|
const a = te(t);
|
|
661
|
-
if (a instanceof Map &&
|
|
661
|
+
if (a instanceof Map && Ii.includes(e)) {
|
|
662
662
|
if (e === "size")
|
|
663
663
|
return Object.getOwnPropertyDescriptor(an, "size").get.call(t.proxy);
|
|
664
664
|
const u = an[e];
|
|
665
665
|
if (u)
|
|
666
666
|
return u.bind(t.proxy);
|
|
667
667
|
}
|
|
668
|
-
if (a instanceof Set &&
|
|
668
|
+
if (a instanceof Set && Pi.includes(e)) {
|
|
669
669
|
if (e === "size")
|
|
670
670
|
return Object.getOwnPropertyDescriptor(kt, "size").get.call(t.proxy);
|
|
671
671
|
const u = kt[e];
|
|
@@ -690,7 +690,7 @@ const Ii = Reflect.ownKeys(kt), as = /* @__PURE__ */ new WeakSet(), cs = {
|
|
|
690
690
|
finalities: t.finalities,
|
|
691
691
|
options: t.options
|
|
692
692
|
}), typeof o == "function") {
|
|
693
|
-
const u =
|
|
693
|
+
const u = I(t.copy[e]);
|
|
694
694
|
return Q(u), fe(u), u.copy;
|
|
695
695
|
}
|
|
696
696
|
return t.copy[e];
|
|
@@ -707,7 +707,7 @@ const Ii = Reflect.ownKeys(kt), as = /* @__PURE__ */ new WeakSet(), cs = {
|
|
|
707
707
|
const i = pr(te(t), e);
|
|
708
708
|
if (i != null && i.set)
|
|
709
709
|
return i.set.call(t.proxy, n), !0;
|
|
710
|
-
const o = Gt(te(t), e), a =
|
|
710
|
+
const o = Gt(te(t), e), a = I(o);
|
|
711
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, $n(t, e, n, ot)), !0);
|
|
712
712
|
},
|
|
713
713
|
has(t, e) {
|
|
@@ -756,31 +756,31 @@ function Dn(t) {
|
|
|
756
756
|
const { proxy: c, revoke: u } = Proxy.revocable(o === 1 ? Object.assign([], a) : a, cs);
|
|
757
757
|
if (s.revoke.push(u), as.add(c), a.proxy = c, n) {
|
|
758
758
|
const l = n;
|
|
759
|
-
l.finalities.draft.push((f,
|
|
759
|
+
l.finalities.draft.push((f, d) => {
|
|
760
760
|
var y, b;
|
|
761
|
-
const
|
|
761
|
+
const _ = I(c);
|
|
762
762
|
let w = l.type === 3 ? l.setMap : l.copy;
|
|
763
|
-
const
|
|
764
|
-
if (
|
|
765
|
-
let S =
|
|
766
|
-
|
|
763
|
+
const T = ye(w, r), g = I(T);
|
|
764
|
+
if (g) {
|
|
765
|
+
let S = g.original;
|
|
766
|
+
g.operated && (S = jn(T)), sn(g), on(g, ot, f, d), l.options.enableAutoFreeze && (l.options.updatedValues = (y = l.options.updatedValues) !== null && y !== void 0 ? y : /* @__PURE__ */ new WeakMap(), l.options.updatedValues.set(S, g.original)), at(w, r, S);
|
|
767
767
|
}
|
|
768
|
-
(b =
|
|
769
|
-
S(f,
|
|
768
|
+
(b = _.callbacks) === null || b === void 0 || b.forEach((S) => {
|
|
769
|
+
S(f, d);
|
|
770
770
|
});
|
|
771
771
|
});
|
|
772
772
|
} else {
|
|
773
|
-
const l =
|
|
774
|
-
l.finalities.draft.push((f,
|
|
775
|
-
sn(l), on(l, ot, f,
|
|
773
|
+
const l = I(c);
|
|
774
|
+
l.finalities.draft.push((f, d) => {
|
|
775
|
+
sn(l), on(l, ot, f, d);
|
|
776
776
|
});
|
|
777
777
|
}
|
|
778
778
|
return c;
|
|
779
779
|
}
|
|
780
|
-
|
|
780
|
+
Pn.createDraft = Dn;
|
|
781
781
|
function Mi(t, e, n, r, s) {
|
|
782
782
|
var i;
|
|
783
|
-
const o =
|
|
783
|
+
const o = I(t), a = (i = o == null ? void 0 : o.original) !== null && i !== void 0 ? i : t, c = !!e.length;
|
|
784
784
|
if (o != null && o.operated)
|
|
785
785
|
for (; o.finalities.draft.length > 0; )
|
|
786
786
|
o.finalities.draft.pop()(n, r);
|
|
@@ -791,7 +791,7 @@ function Mi(t, e, n, r, s) {
|
|
|
791
791
|
r && c ? [{ op: U.Replace, path: [], value: a }] : r
|
|
792
792
|
];
|
|
793
793
|
}
|
|
794
|
-
function
|
|
794
|
+
function Ri(t, e) {
|
|
795
795
|
var n;
|
|
796
796
|
const r = {
|
|
797
797
|
draft: [],
|
|
@@ -817,7 +817,7 @@ function ji(t, e) {
|
|
|
817
817
|
function cn(t) {
|
|
818
818
|
const { rootDraft: e, value: n, useRawReturn: r = !1, isRoot: s = !0 } = t;
|
|
819
819
|
xn(n, (i, o, a) => {
|
|
820
|
-
const c =
|
|
820
|
+
const c = I(o);
|
|
821
821
|
if (c && e && c.finalities === e.finalities) {
|
|
822
822
|
t.isContainDraft = !0;
|
|
823
823
|
const u = c.original;
|
|
@@ -831,7 +831,7 @@ function cn(t) {
|
|
|
831
831
|
}
|
|
832
832
|
function us(t) {
|
|
833
833
|
var e;
|
|
834
|
-
const n =
|
|
834
|
+
const n = I(t);
|
|
835
835
|
if (!ce(t, n == null ? void 0 : n.options))
|
|
836
836
|
return t;
|
|
837
837
|
const r = ke(t);
|
|
@@ -839,7 +839,7 @@ function us(t) {
|
|
|
839
839
|
return n.original;
|
|
840
840
|
let s;
|
|
841
841
|
function i() {
|
|
842
|
-
s = r === 2 ?
|
|
842
|
+
s = r === 2 ? Rn(t) ? new Map(t) : new (Object.getPrototypeOf(t)).constructor(t) : r === 3 ? Array.from(n.setMap.values()) : is(t, n == null ? void 0 : n.options);
|
|
843
843
|
}
|
|
844
844
|
if (n) {
|
|
845
845
|
n.finalized = !0;
|
|
@@ -861,91 +861,91 @@ function us(t) {
|
|
|
861
861
|
}
|
|
862
862
|
return s;
|
|
863
863
|
}
|
|
864
|
-
function
|
|
864
|
+
function _r(t) {
|
|
865
865
|
if (!Ae(t))
|
|
866
866
|
throw new Error(`current() is only used for Draft, parameter: ${t}`);
|
|
867
867
|
return us(t);
|
|
868
868
|
}
|
|
869
|
-
const
|
|
869
|
+
const ji = (t) => function e(n, r, s) {
|
|
870
870
|
var i, o, a;
|
|
871
871
|
if (typeof n == "function" && typeof r != "function")
|
|
872
|
-
return function(E, ...
|
|
873
|
-
return e(E, (
|
|
872
|
+
return function(E, ...R) {
|
|
873
|
+
return e(E, (F) => n.call(this, F, ...R), r);
|
|
874
874
|
};
|
|
875
875
|
const c = n, u = r;
|
|
876
876
|
let l = 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) ?
|
|
881
|
-
for (const
|
|
882
|
-
if (typeof
|
|
883
|
-
throw new Error(`Invalid mark: ${
|
|
884
|
-
const B =
|
|
880
|
+
const f = Ae(c) ? _r(c) : c, d = Array.isArray(l.mark) ? (E, R) => {
|
|
881
|
+
for (const F of l.mark) {
|
|
882
|
+
if (typeof F != "function")
|
|
883
|
+
throw new Error(`Invalid mark: ${F}, 'mark' should be a function.`);
|
|
884
|
+
const B = F(E, R);
|
|
885
885
|
if (B)
|
|
886
886
|
return B;
|
|
887
887
|
}
|
|
888
888
|
} : l.mark, y = (i = l.enablePatches) !== null && i !== void 0 ? i : !1, b = (o = l.strict) !== null && o !== void 0 ? o : !1, w = {
|
|
889
889
|
enableAutoFreeze: (a = l.enableAutoFreeze) !== null && a !== void 0 ? a : !1,
|
|
890
|
-
mark:
|
|
890
|
+
mark: d,
|
|
891
891
|
strict: b,
|
|
892
892
|
enablePatches: y
|
|
893
893
|
};
|
|
894
894
|
if (!ce(f, w) && typeof f == "object" && f !== null)
|
|
895
895
|
throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");
|
|
896
|
-
const [
|
|
896
|
+
const [T, g] = Ri(f, w);
|
|
897
897
|
if (typeof r != "function") {
|
|
898
898
|
if (!ce(f, w))
|
|
899
899
|
throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");
|
|
900
|
-
return [
|
|
900
|
+
return [T, g];
|
|
901
901
|
}
|
|
902
902
|
let S;
|
|
903
903
|
try {
|
|
904
|
-
S = u(
|
|
904
|
+
S = u(T);
|
|
905
905
|
} catch (E) {
|
|
906
|
-
throw rn(
|
|
906
|
+
throw rn(I(T)), E;
|
|
907
907
|
}
|
|
908
908
|
const O = (E) => {
|
|
909
|
-
const
|
|
909
|
+
const R = I(T);
|
|
910
910
|
if (!Ae(E)) {
|
|
911
|
-
if (E !== void 0 && !pe(E,
|
|
911
|
+
if (E !== void 0 && !pe(E, T) && (R != null && R.operated))
|
|
912
912
|
throw new Error("Either the value is returned as a new non-draft value, or only the draft is modified without returning any value.");
|
|
913
|
-
const B = E == null ? void 0 : E[
|
|
913
|
+
const B = E == null ? void 0 : E[Ti];
|
|
914
914
|
if (B) {
|
|
915
|
-
const
|
|
915
|
+
const We = B[0];
|
|
916
916
|
return w.strict && typeof E == "object" && E !== null && cn({
|
|
917
|
-
rootDraft:
|
|
917
|
+
rootDraft: R,
|
|
918
918
|
value: E,
|
|
919
919
|
useRawReturn: !0
|
|
920
|
-
}),
|
|
920
|
+
}), g([We]);
|
|
921
921
|
}
|
|
922
922
|
if (E !== void 0)
|
|
923
|
-
return typeof E == "object" && E !== null && cn({ rootDraft:
|
|
923
|
+
return typeof E == "object" && E !== null && cn({ rootDraft: R, value: E }), g([E]);
|
|
924
924
|
}
|
|
925
|
-
if (E ===
|
|
926
|
-
return
|
|
927
|
-
const
|
|
928
|
-
if (w ===
|
|
929
|
-
if (
|
|
925
|
+
if (E === T || E === void 0)
|
|
926
|
+
return g([]);
|
|
927
|
+
const F = I(E);
|
|
928
|
+
if (w === F.options) {
|
|
929
|
+
if (F.operated)
|
|
930
930
|
throw new Error("Cannot return a modified child draft.");
|
|
931
|
-
return
|
|
931
|
+
return g([_r(E)]);
|
|
932
932
|
}
|
|
933
|
-
return
|
|
933
|
+
return g([E]);
|
|
934
934
|
};
|
|
935
935
|
return S instanceof Promise ? S.then(O, (E) => {
|
|
936
|
-
throw rn(
|
|
936
|
+
throw rn(I(T)), E;
|
|
937
937
|
}) : O(S);
|
|
938
|
-
}, Ct =
|
|
938
|
+
}, Ct = ji();
|
|
939
939
|
Object.prototype.constructor.toString();
|
|
940
940
|
function ls(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 gr(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
|
-
function
|
|
948
|
-
return typeof t != "object" || typeof e != "object" || t === null || e === null ? t === e : ls(t, e) ? Object.keys(t).every((n) =>
|
|
947
|
+
function Tt(t, e) {
|
|
948
|
+
return typeof t != "object" || typeof e != "object" || t === null || e === null ? t === e : ls(t, e) ? Object.keys(t).every((n) => Tt(t[n], e[n])) : !1;
|
|
949
949
|
}
|
|
950
950
|
function Un(t) {
|
|
951
951
|
if (!He(t))
|
|
@@ -1010,7 +1010,7 @@ function ds(t, e) {
|
|
|
1010
1010
|
function $i(t) {
|
|
1011
1011
|
return t && Object.keys(t).length === 0;
|
|
1012
1012
|
}
|
|
1013
|
-
const
|
|
1013
|
+
const mr = /ZULU|YEKT|YEKST|YAPT|YAKT|YAKST|XJT|WGT|WGST|WFT|WETDST|WET|WDT|WAT|WAST|WAKT|WADT|VUT|VOLT|VLAT|VLAST|VET|UZT|UZST|UYT|UYST|UTC|UT|ULAT|ULAST|UCT|TVT|TRUT|TOT|TMT|TKT|TJT|TFT|TAHT|SGT|SCT|SAST|SADT|RET|PYT|PYST|PWT|PST|PONT|PMST|PMDT|PKT|PKST|PHT|PGT|PETT|PETST|PET|PDT|OMST|OMSST|NZT|NZST|NZDT|NUT|NST|NPT|NOVT|NOVST|NFT|NDT|MYT|MVT|MUT|MUST|MST|MSK|MSD|MPT|MMT|MHT|MEZ|METDST|MET|MESZ|MEST|MDT|MAWT|MART|MAGT|MAGST|LKT|LINT|LIGT|LHST|LHDT|KST|KRAT|KRAST|KOST|KGT|KGST|KDT|JST|JAYT|IST|IRT|IRKT|IRKST|IOT|IDT|ICT|HST|HKT|GYT|GMT|GILT|GFT|GET|GEST|GAMT|GALT|FNT|FNST|FKT|FKST|FJT|FJST|FET|EST|EGT|EGST|EETDST|EET|EEST|EDT|EAT|EAST|EASST|DDUT|DAVT|CXT|CST|COT|CLT|CLST|CKT|CHUT|CHAST|CHADT|CETDST|CET|CEST|CDT|CCT|CAST|CADT|BTT|BST|BRT|BRST|BRA|BOT|BORT|BNT|BDT|BDST|AZT|AZST|AZOT|AZOST|AWST|AWSST|AST|ART|ARST|ANAT|ANAST|AMT|AMST|ALMT|ALMST|AKST|AKDT|AFT|AEST|AESST|AEDT|ADT|ACWST|ACT|ACST|ACSST|ACDT$/, Di = {
|
|
1014
1014
|
ZULU: 0,
|
|
1015
1015
|
YEKT: 18e3,
|
|
1016
1016
|
YEKST: 21600,
|
|
@@ -1224,11 +1224,11 @@ function Ki(t) {
|
|
|
1224
1224
|
const [e, n] = t.split(" ");
|
|
1225
1225
|
return /* @__PURE__ */ new Date(e + "T" + n + "Z");
|
|
1226
1226
|
}
|
|
1227
|
-
function
|
|
1227
|
+
function Wi(t) {
|
|
1228
1228
|
const [e, n] = t.split(" ");
|
|
1229
1229
|
return /* @__PURE__ */ new Date(e + "T" + n + "Z");
|
|
1230
1230
|
}
|
|
1231
|
-
function
|
|
1231
|
+
function qi(t) {
|
|
1232
1232
|
return new Date(t);
|
|
1233
1233
|
}
|
|
1234
1234
|
function zi(t) {
|
|
@@ -1274,18 +1274,18 @@ function Qi(t) {
|
|
|
1274
1274
|
}
|
|
1275
1275
|
}
|
|
1276
1276
|
function Hi(t) {
|
|
1277
|
-
const e = t.match(
|
|
1277
|
+
const e = t.match(mr);
|
|
1278
1278
|
if (!e)
|
|
1279
1279
|
return null;
|
|
1280
|
-
const [n] = e, r = Di[n], s = new Date(t.replace(
|
|
1280
|
+
const [n] = e, r = Di[n], s = new Date(t.replace(mr, "Z"));
|
|
1281
1281
|
return new Date(s.getTime() - r * 1e3);
|
|
1282
1282
|
}
|
|
1283
1283
|
const Ji = [
|
|
1284
1284
|
Ni,
|
|
1285
|
-
|
|
1285
|
+
Wi,
|
|
1286
1286
|
zi,
|
|
1287
1287
|
Gi,
|
|
1288
|
-
|
|
1288
|
+
qi,
|
|
1289
1289
|
Li,
|
|
1290
1290
|
Vi,
|
|
1291
1291
|
Ki,
|
|
@@ -1318,7 +1318,7 @@ function Zi(t) {
|
|
|
1318
1318
|
return null;
|
|
1319
1319
|
}
|
|
1320
1320
|
}
|
|
1321
|
-
function
|
|
1321
|
+
function Rt(t) {
|
|
1322
1322
|
if (t !== void 0) {
|
|
1323
1323
|
if (t === null)
|
|
1324
1324
|
return null;
|
|
@@ -1450,7 +1450,7 @@ function hs(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 = Rt(u), o[2] = u), Ln(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
|
}
|
|
@@ -1495,17 +1495,17 @@ function ct(t, e) {
|
|
|
1495
1495
|
const [o, a] = r, c = t.aev.get(o);
|
|
1496
1496
|
if (!c)
|
|
1497
1497
|
return null;
|
|
1498
|
-
const l = (i = X(c, 2).find((
|
|
1498
|
+
const l = (i = X(c, 2).find((_) => _[2] === a)) == null ? void 0 : i[0];
|
|
1499
1499
|
if (!l)
|
|
1500
1500
|
return null;
|
|
1501
|
-
const [f,
|
|
1502
|
-
return [n,
|
|
1501
|
+
const [f, d, y, ...b] = e;
|
|
1502
|
+
return [n, d, l, ...b];
|
|
1503
1503
|
} else {
|
|
1504
1504
|
const [o, ...a] = e;
|
|
1505
1505
|
return [n, ...a];
|
|
1506
1506
|
}
|
|
1507
1507
|
}
|
|
1508
|
-
function
|
|
1508
|
+
function _s(t, e, n) {
|
|
1509
1509
|
const r = ct(t, n);
|
|
1510
1510
|
if (!r)
|
|
1511
1511
|
return;
|
|
@@ -1513,7 +1513,7 @@ function gs(t, e, n) {
|
|
|
1513
1513
|
a && (ae(t.eav, [s, i, o]), ae(t.aev, [i, s, o]), Ln(a) && ae(t.vae, [o, i, s]));
|
|
1514
1514
|
}
|
|
1515
1515
|
let to = 0;
|
|
1516
|
-
function
|
|
1516
|
+
function gs(t, e, n) {
|
|
1517
1517
|
const [r, s, i] = n;
|
|
1518
1518
|
let o;
|
|
1519
1519
|
const a = Ke(t.eav, [r, s, i]);
|
|
@@ -1527,8 +1527,8 @@ function ws(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]) ??
|
|
1530
|
+
a["checked-data-type"] === "date" && t.useDateObjects && (o = Rt(o));
|
|
1531
|
+
const c = Ke(t.eav, [s, i, o]), u = (c == null ? void 0 : c[3]) ?? gs(t, a, r), l = [s, i, o, u];
|
|
1532
1532
|
Xi(a) ? (Z(t.eav, [s, i], /* @__PURE__ */ new Map([[o, l]])), Z(t.aev, [i, s], /* @__PURE__ */ new Map([[o, l]]))) : (Z(t.eav, [s, i, o], l), Z(t.aev, [i, s, o], l)), Ln(a) && Z(t.vae, [o, i, s], l);
|
|
1533
1533
|
}
|
|
1534
1534
|
function no(t, e, n) {
|
|
@@ -1547,13 +1547,13 @@ function no(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 = fs(l, o),
|
|
1550
|
+
const l = u[2], f = fs(l, o), d = [
|
|
1551
1551
|
s,
|
|
1552
1552
|
i,
|
|
1553
1553
|
f,
|
|
1554
|
-
|
|
1554
|
+
gs(t, a, u)
|
|
1555
1555
|
];
|
|
1556
|
-
Z(t.eav, [s, i], /* @__PURE__ */ new Map([[f,
|
|
1556
|
+
Z(t.eav, [s, i], /* @__PURE__ */ new Map([[f, d]])), Z(t.aev, [i, s], /* @__PURE__ */ new Map([[f, d]]));
|
|
1557
1557
|
}
|
|
1558
1558
|
function ln(t, e, n) {
|
|
1559
1559
|
var u, l;
|
|
@@ -1563,26 +1563,26 @@ function ln(t, e, n) {
|
|
|
1563
1563
|
const [o] = i, a = t.eav.get(o);
|
|
1564
1564
|
if (a) {
|
|
1565
1565
|
for (const f of a.keys()) {
|
|
1566
|
-
const
|
|
1567
|
-
|
|
1566
|
+
const d = e.getAttr(f);
|
|
1567
|
+
d && d["on-delete-reverse"] === "cascade" && X(a.get(f), 1).forEach(([y, b, _]) => {
|
|
1568
1568
|
var w;
|
|
1569
|
-
return ln(t, e, [
|
|
1569
|
+
return ln(t, e, [_, (w = d["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
|
|
1573
|
-
!
|
|
1574
|
-
((u =
|
|
1573
|
+
!d || // Make sure it matches the etype
|
|
1574
|
+
((u = d["forward-identity"]) == null ? void 0 : u[1]) === s) && (ae(t.aev, [f, o]), ae(t.eav, [o, f]));
|
|
1575
1575
|
}
|
|
1576
1576
|
a.size === 0 && ae(t.eav, [o]);
|
|
1577
1577
|
}
|
|
1578
1578
|
const c = t.vae.get(o) && X(t.vae.get(o), 2);
|
|
1579
1579
|
c && c.forEach((f) => {
|
|
1580
|
-
var w,
|
|
1581
|
-
const [
|
|
1582
|
-
(!s || !
|
|
1580
|
+
var w, T, g;
|
|
1581
|
+
const [d, y, b] = f, _ = e.getAttr(y);
|
|
1582
|
+
(!s || !_ || ((w = _["reverse-identity"]) == null ? void 0 : w[1]) === s) && (ae(t.eav, [d, y, b]), ae(t.aev, [y, d, b]), ae(t.vae, [b, y, d])), _ && _["on-delete"] === "cascade" && ((T = _["reverse-identity"]) == null ? void 0 : T[1]) === s && ln(t, e, [d, (g = _["forward-identity"]) == null ? void 0 : g[1]]);
|
|
1583
1583
|
}), ((l = t.vae.get(o)) == null ? void 0 : l.size) === 0 && ae(t.vae, [o]);
|
|
1584
1584
|
}
|
|
1585
|
-
function
|
|
1585
|
+
function ms(t, e, n) {
|
|
1586
1586
|
const r = hs(e, n, t.useDateObjects);
|
|
1587
1587
|
Object.keys(r).forEach((s) => {
|
|
1588
1588
|
t[s] = r[s];
|
|
@@ -1591,17 +1591,17 @@ function Ts(t, e, n) {
|
|
|
1591
1591
|
function ro(t, [e]) {
|
|
1592
1592
|
t.addAttr(e);
|
|
1593
1593
|
}
|
|
1594
|
-
function
|
|
1594
|
+
function Ts(t) {
|
|
1595
1595
|
return X(t.eav, 3);
|
|
1596
1596
|
}
|
|
1597
1597
|
function so(t, e, [n]) {
|
|
1598
1598
|
if (!e.getAttr(n))
|
|
1599
1599
|
return;
|
|
1600
|
-
const r =
|
|
1601
|
-
e.deleteAttr(n),
|
|
1600
|
+
const r = Ts(t).filter(([s, i]) => i !== n);
|
|
1601
|
+
e.deleteAttr(n), ms(t, e, r);
|
|
1602
1602
|
}
|
|
1603
1603
|
function io(t, e, [n]) {
|
|
1604
|
-
e.getAttr(n.id) && (e.updateAttr(n),
|
|
1604
|
+
e.getAttr(n.id) && (e.updateAttr(n), ms(t, e, Ts(t)));
|
|
1605
1605
|
}
|
|
1606
1606
|
function oo(t, e, n) {
|
|
1607
1607
|
const [r, ...s] = n;
|
|
@@ -1613,7 +1613,7 @@ function oo(t, e, n) {
|
|
|
1613
1613
|
no(t, e, s);
|
|
1614
1614
|
break;
|
|
1615
1615
|
case "retract-triple":
|
|
1616
|
-
|
|
1616
|
+
_s(t, e, s);
|
|
1617
1617
|
break;
|
|
1618
1618
|
case "delete-entity":
|
|
1619
1619
|
ln(t, e, s);
|
|
@@ -1744,7 +1744,7 @@ function uo(t, e, n) {
|
|
|
1744
1744
|
}
|
|
1745
1745
|
return r;
|
|
1746
1746
|
}
|
|
1747
|
-
function
|
|
1747
|
+
function K(t, e, n) {
|
|
1748
1748
|
var r;
|
|
1749
1749
|
return (r = t.forwardIdents.get(e)) == null ? void 0 : r.get(n);
|
|
1750
1750
|
}
|
|
@@ -1778,10 +1778,10 @@ function ho(t, e, n) {
|
|
|
1778
1778
|
let l = !1;
|
|
1779
1779
|
const f = e.getAttr(o);
|
|
1780
1780
|
if (f) {
|
|
1781
|
-
const
|
|
1781
|
+
const d = Ss(e, f["forward-identity"][1]);
|
|
1782
1782
|
l = !!fo(t, e, [
|
|
1783
1783
|
i,
|
|
1784
|
-
|
|
1784
|
+
d == null ? void 0 : d.id,
|
|
1785
1785
|
i
|
|
1786
1786
|
]);
|
|
1787
1787
|
}
|
|
@@ -1808,18 +1808,18 @@ function yo(t, e, n) {
|
|
|
1808
1808
|
}
|
|
1809
1809
|
return { ...n, [t]: e };
|
|
1810
1810
|
}
|
|
1811
|
-
function
|
|
1811
|
+
function Tr(t, e, n) {
|
|
1812
1812
|
return t === e ? n : null;
|
|
1813
1813
|
}
|
|
1814
1814
|
function bo(t) {
|
|
1815
1815
|
switch (typeof t) {
|
|
1816
1816
|
case "string":
|
|
1817
|
-
return t.startsWith("?") ? yo :
|
|
1817
|
+
return t.startsWith("?") ? yo : Tr;
|
|
1818
1818
|
default:
|
|
1819
|
-
return
|
|
1819
|
+
return Tr;
|
|
1820
1820
|
}
|
|
1821
1821
|
}
|
|
1822
|
-
const
|
|
1822
|
+
const _o = [
|
|
1823
1823
|
"in",
|
|
1824
1824
|
"$in",
|
|
1825
1825
|
"$not",
|
|
@@ -1827,14 +1827,14 @@ const go = [
|
|
|
1827
1827
|
"$comparator"
|
|
1828
1828
|
// covers all of $gt, $lt, etc.
|
|
1829
1829
|
];
|
|
1830
|
-
function
|
|
1831
|
-
for (const e of
|
|
1830
|
+
function go(t) {
|
|
1831
|
+
for (const e of _o)
|
|
1832
1832
|
if (t.hasOwnProperty(e))
|
|
1833
1833
|
return !0;
|
|
1834
1834
|
return !1;
|
|
1835
1835
|
}
|
|
1836
1836
|
function vs(t, e, n) {
|
|
1837
|
-
return n ? typeof t == "object" ?
|
|
1837
|
+
return n ? typeof t == "object" ? go(t) ? n : null : bo(t)(t, e, n) : null;
|
|
1838
1838
|
}
|
|
1839
1839
|
function wo(t, e, n) {
|
|
1840
1840
|
return t.reduce((r, s, i) => {
|
|
@@ -1842,14 +1842,14 @@ function wo(t, e, n) {
|
|
|
1842
1842
|
return vs(s, o, r);
|
|
1843
1843
|
}, n);
|
|
1844
1844
|
}
|
|
1845
|
-
function
|
|
1845
|
+
function mo(t, e, n) {
|
|
1846
1846
|
return vo(t, e, n).map((r) => wo(e, r, n)).filter((r) => r);
|
|
1847
1847
|
}
|
|
1848
|
-
function
|
|
1849
|
-
return e.or ? e.or.patterns.flatMap((r) => fn(t, r, n)) : e.and ? e.and.patterns.reduce((r, s) => fn(t, s, r), n) : n.flatMap((r) =>
|
|
1848
|
+
function To(t, e, n) {
|
|
1849
|
+
return e.or ? e.or.patterns.flatMap((r) => fn(t, r, n)) : e.and ? e.and.patterns.reduce((r, s) => fn(t, s, r), n) : n.flatMap((r) => mo(t, e, r));
|
|
1850
1850
|
}
|
|
1851
1851
|
function fn(t, e, n = [{}]) {
|
|
1852
|
-
return e.reduce((r, s) =>
|
|
1852
|
+
return e.reduce((r, s) => To(t, s, r), n);
|
|
1853
1853
|
}
|
|
1854
1854
|
function Nn(t, e) {
|
|
1855
1855
|
return Array.isArray(e) ? e.map((n) => Nn(t, n)) : po(e) ? t[e] : e;
|
|
@@ -1881,7 +1881,7 @@ function ko() {
|
|
|
1881
1881
|
return Qt(Ao);
|
|
1882
1882
|
}
|
|
1883
1883
|
const Co = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), Sr = { randomUUID: Co };
|
|
1884
|
-
function
|
|
1884
|
+
function Io(t, e, n) {
|
|
1885
1885
|
var s;
|
|
1886
1886
|
if (Sr.randomUUID && !t)
|
|
1887
1887
|
return Sr.randomUUID();
|
|
@@ -1897,7 +1897,7 @@ function vr(t) {
|
|
|
1897
1897
|
n.push(parseInt(e.substring(r, r + 2), 16));
|
|
1898
1898
|
return n;
|
|
1899
1899
|
}
|
|
1900
|
-
function
|
|
1900
|
+
function Po(t, e) {
|
|
1901
1901
|
for (let n = 0; n < t.length; n++) {
|
|
1902
1902
|
if (t[n] < e[n])
|
|
1903
1903
|
return -1;
|
|
@@ -1907,16 +1907,16 @@ function Io(t, e) {
|
|
|
1907
1907
|
return 0;
|
|
1908
1908
|
}
|
|
1909
1909
|
function Mo(t, e) {
|
|
1910
|
-
return
|
|
1910
|
+
return Po(vr(t), vr(e));
|
|
1911
1911
|
}
|
|
1912
|
-
function
|
|
1913
|
-
return
|
|
1912
|
+
function L() {
|
|
1913
|
+
return Io();
|
|
1914
1914
|
}
|
|
1915
|
-
function
|
|
1915
|
+
function Ro(t, e) {
|
|
1916
1916
|
return t.localeCompare(e);
|
|
1917
1917
|
}
|
|
1918
|
-
function
|
|
1919
|
-
let t =
|
|
1918
|
+
function jo() {
|
|
1919
|
+
let t = Ro;
|
|
1920
1920
|
if (typeof Intl == "object" && Intl.hasOwnProperty("Collator"))
|
|
1921
1921
|
try {
|
|
1922
1922
|
t = Intl.Collator("en-US").compare;
|
|
@@ -1924,12 +1924,12 @@ function Ro() {
|
|
|
1924
1924
|
}
|
|
1925
1925
|
return t;
|
|
1926
1926
|
}
|
|
1927
|
-
const xo =
|
|
1927
|
+
const xo = jo();
|
|
1928
1928
|
let $o = 0;
|
|
1929
1929
|
function tt(t) {
|
|
1930
|
-
return
|
|
1930
|
+
return jt(`_${t}`, $o++);
|
|
1931
1931
|
}
|
|
1932
|
-
function
|
|
1932
|
+
function jt(t, e) {
|
|
1933
1933
|
return `?${t}-${e}`;
|
|
1934
1934
|
}
|
|
1935
1935
|
class Fe extends Error {
|
|
@@ -1958,23 +1958,23 @@ function Lo(t, e, n) {
|
|
|
1958
1958
|
return t.map((r) => r === e ? n : r);
|
|
1959
1959
|
}
|
|
1960
1960
|
function Es(t, e, n, r, s) {
|
|
1961
|
-
const i =
|
|
1961
|
+
const i = K(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]}`);
|
|
1964
1964
|
if (a["value-type"] !== "ref")
|
|
1965
1965
|
throw new Error(`Attr ${a.id} is not a ref`);
|
|
1966
|
-
const [c, u] = a["forward-identity"], [l, f] = a["reverse-identity"],
|
|
1966
|
+
const [c, u] = a["forward-identity"], [l, f] = a["reverse-identity"], d = r + 1, y = i ? [
|
|
1967
1967
|
t(u, r),
|
|
1968
1968
|
a.id,
|
|
1969
|
-
t(f,
|
|
1969
|
+
t(f, d),
|
|
1970
1970
|
tt("time")
|
|
1971
1971
|
] : [
|
|
1972
|
-
t(u,
|
|
1972
|
+
t(u, d),
|
|
1973
1973
|
a.id,
|
|
1974
1974
|
t(f, r),
|
|
1975
1975
|
tt("time")
|
|
1976
1976
|
];
|
|
1977
|
-
return [i ? f : u,
|
|
1977
|
+
return [i ? f : u, d, y, a, !!i];
|
|
1978
1978
|
}
|
|
1979
1979
|
function Or(t, e) {
|
|
1980
1980
|
if (typeof e != "string")
|
|
@@ -2047,11 +2047,11 @@ function Fo(t, e) {
|
|
|
2047
2047
|
return e;
|
|
2048
2048
|
}
|
|
2049
2049
|
function No(t, e, n, r, s, i) {
|
|
2050
|
-
const o =
|
|
2050
|
+
const o = K(e, n, s), a = Ce(e, n, s), c = o || a;
|
|
2051
2051
|
if (!c)
|
|
2052
2052
|
throw new Fe(`No attr for etype = ${n} label = ${s}`);
|
|
2053
2053
|
if (i != null && i.hasOwnProperty("$isNull")) {
|
|
2054
|
-
const u =
|
|
2054
|
+
const u = K(e, n, "id");
|
|
2055
2055
|
if (!u)
|
|
2056
2056
|
throw new Fe(`No attr for etype = ${n} label = id`);
|
|
2057
2057
|
return [
|
|
@@ -2070,8 +2070,8 @@ function No(t, e, n, r, s, i) {
|
|
|
2070
2070
|
}
|
|
2071
2071
|
function Ko(t, e, n, r, s) {
|
|
2072
2072
|
const [i, o, a] = s.reduce((c, u) => {
|
|
2073
|
-
const [l, f,
|
|
2074
|
-
return [y, b, [...
|
|
2073
|
+
const [l, f, d] = c, [y, b, _] = Es(t, e, l, f, u);
|
|
2074
|
+
return [y, b, [...d, _]];
|
|
2075
2075
|
}, [n, r, []]);
|
|
2076
2076
|
return [i, o, a];
|
|
2077
2077
|
}
|
|
@@ -2079,10 +2079,10 @@ function dn(t, e, n, r, s, i) {
|
|
|
2079
2079
|
const o = s.slice(0, s.length - 1), a = s[s.length - 1], [c, u, l] = Ko(t, e, n, r, o), f = No(t, e, c, u, a, i);
|
|
2080
2080
|
return l.concat([f]);
|
|
2081
2081
|
}
|
|
2082
|
-
function
|
|
2082
|
+
function Wo(t, e) {
|
|
2083
2083
|
return e ? [e].concat(t) : t;
|
|
2084
2084
|
}
|
|
2085
|
-
function
|
|
2085
|
+
function qo([t, e]) {
|
|
2086
2086
|
return t === "or" && Array.isArray(e);
|
|
2087
2087
|
}
|
|
2088
2088
|
function zo([t, e]) {
|
|
@@ -2114,7 +2114,7 @@ function kr(t, e, n, r, s) {
|
|
|
2114
2114
|
}
|
|
2115
2115
|
function Os(t, e, n, r, s) {
|
|
2116
2116
|
return Object.entries(s).flatMap(([i, o]) => {
|
|
2117
|
-
if (
|
|
2117
|
+
if (qo([i, o]))
|
|
2118
2118
|
return Ar(t, "or", e, n, r, o);
|
|
2119
2119
|
if (zo([i, o]))
|
|
2120
2120
|
return Ar(t, "and", e, n, r, o);
|
|
@@ -2143,7 +2143,7 @@ function Os(t, e, n, r, s) {
|
|
|
2143
2143
|
});
|
|
2144
2144
|
}
|
|
2145
2145
|
function Go(t, e, n, r) {
|
|
2146
|
-
const s =
|
|
2146
|
+
const s = jt;
|
|
2147
2147
|
return r ? Os(s, t, e, n, r).concat(Er(s, t, e, n)) : Er(s, t, e, n);
|
|
2148
2148
|
}
|
|
2149
2149
|
function Qo(t, e, n) {
|
|
@@ -2157,20 +2157,20 @@ function Jo(t, e, n, { etype: r, level: s, form: i }, o) {
|
|
|
2157
2157
|
const a = Object.keys(i).filter((c) => c !== "$");
|
|
2158
2158
|
return a.length ? Object.entries(o).map(function([u, l]) {
|
|
2159
2159
|
return a.map(function(y) {
|
|
2160
|
-
var
|
|
2161
|
-
const b = !!(e.cardinalityInference && ((
|
|
2160
|
+
var _, w, T;
|
|
2161
|
+
const b = !!(e.cardinalityInference && ((T = (w = (_ = n.linkIndex) == null ? void 0 : _[r]) == null ? void 0 : w[y]) != null && T.isSingular));
|
|
2162
2162
|
try {
|
|
2163
|
-
const [
|
|
2164
|
-
etype:
|
|
2163
|
+
const [g, S, O] = Ho(t, n, r, s, y, u), E = ks(e, n, {
|
|
2164
|
+
etype: g,
|
|
2165
2165
|
level: S,
|
|
2166
2166
|
form: i[y],
|
|
2167
2167
|
join: O
|
|
2168
|
-
}),
|
|
2169
|
-
return { [y]:
|
|
2170
|
-
} catch (
|
|
2171
|
-
if (
|
|
2168
|
+
}), R = b ? E[0] : E;
|
|
2169
|
+
return { [y]: R };
|
|
2170
|
+
} catch (g) {
|
|
2171
|
+
if (g instanceof Fe)
|
|
2172
2172
|
return { [y]: b ? void 0 : [] };
|
|
2173
|
-
throw
|
|
2173
|
+
throw g;
|
|
2174
2174
|
}
|
|
2175
2175
|
}).reduce(function(y, b) {
|
|
2176
2176
|
return { ...y, ...b };
|
|
@@ -2183,7 +2183,7 @@ function Yo(t, e, n) {
|
|
|
2183
2183
|
function Ye(t, e, n, r, s) {
|
|
2184
2184
|
return e === r || e == null && r == null ? Mo(t, n) : r == null ? 1 : e == null ? -1 : Yo(e, r, s);
|
|
2185
2185
|
}
|
|
2186
|
-
function
|
|
2186
|
+
function It([t, e], [n, r], s) {
|
|
2187
2187
|
return Ye(t, e, n, r, s);
|
|
2188
2188
|
}
|
|
2189
2189
|
function hn(t) {
|
|
@@ -2193,9 +2193,9 @@ function Zo(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"],
|
|
2198
|
-
return
|
|
2196
|
+
return It(r, [s, a], null) === c;
|
|
2197
|
+
const [u, l] = r, f = e["checked-data-type"], d = f === "date" ? hn(l) : l, y = f === "date" ? hn(o) : o;
|
|
2198
|
+
return It([u, d], [s, y], f) === c;
|
|
2199
2199
|
}
|
|
2200
2200
|
function Xo(t, e) {
|
|
2201
2201
|
const n = e[1];
|
|
@@ -2203,7 +2203,7 @@ function Xo(t, e) {
|
|
|
2203
2203
|
}
|
|
2204
2204
|
function ea(t, e, n) {
|
|
2205
2205
|
const r = Object.keys(n)[0];
|
|
2206
|
-
return
|
|
2206
|
+
return K(t, e, r);
|
|
2207
2207
|
}
|
|
2208
2208
|
function ta(t, e, n, r) {
|
|
2209
2209
|
if (n)
|
|
@@ -2217,43 +2217,43 @@ function na(t, e, n) {
|
|
|
2217
2217
|
return lo(t, e);
|
|
2218
2218
|
const r = /* @__PURE__ */ new Map();
|
|
2219
2219
|
for (const o of n.fields) {
|
|
2220
|
-
const a =
|
|
2220
|
+
const a = K(t, e, o), c = (s = a == null ? void 0 : a["forward-identity"]) == null ? void 0 : s[2];
|
|
2221
2221
|
c && Fn(a) && r.set(c, a);
|
|
2222
2222
|
}
|
|
2223
2223
|
if (!r.has("id")) {
|
|
2224
|
-
const o =
|
|
2224
|
+
const o = K(t, e, "id"), a = (i = o == null ? void 0 : o["forward-identity"]) == null ? void 0 : i[2];
|
|
2225
2225
|
a && r.set(a, o);
|
|
2226
2226
|
}
|
|
2227
2227
|
return r;
|
|
2228
2228
|
}
|
|
2229
2229
|
function ra(t, e, { etype: n, pageInfo: r, dq: s, form: i }) {
|
|
2230
|
-
var b,
|
|
2230
|
+
var b, _;
|
|
2231
2231
|
const o = (b = i == null ? void 0 : i.$) == null ? void 0 : b.order, a = As(i), c = sa(i);
|
|
2232
2232
|
let u = So(t, s);
|
|
2233
2233
|
const l = r == null ? void 0 : r["start-cursor"], f = ta(e, n, l, o);
|
|
2234
|
-
if (f && ((
|
|
2235
|
-
const w = f["checked-data-type"] === "date",
|
|
2236
|
-
u = u.map(([
|
|
2237
|
-
var O, E,
|
|
2238
|
-
let S = (B = (
|
|
2239
|
-
return w && (S = hn(S)), [
|
|
2234
|
+
if (f && ((_ = f == null ? void 0 : f["forward-identity"]) == null ? void 0 : _[2]) !== "id") {
|
|
2235
|
+
const w = f["checked-data-type"] === "date", T = f.id;
|
|
2236
|
+
u = u.map(([g]) => {
|
|
2237
|
+
var O, E, R, F, B;
|
|
2238
|
+
let S = (B = (F = (R = (E = (O = t.eav.get(g)) == null ? void 0 : O.get(T)) == null ? void 0 : E.values()) == null ? void 0 : R.next()) == null ? void 0 : F.value) == null ? void 0 : B[2];
|
|
2239
|
+
return w && (S = hn(S)), [g, S];
|
|
2240
2240
|
});
|
|
2241
2241
|
}
|
|
2242
|
-
u.sort(c === "asc" ? function(
|
|
2243
|
-
return
|
|
2244
|
-
} : function(
|
|
2245
|
-
return
|
|
2242
|
+
u.sort(c === "asc" ? function(T, g) {
|
|
2243
|
+
return It(T, g, f == null ? void 0 : f["checked-data-type"]);
|
|
2244
|
+
} : function(T, g) {
|
|
2245
|
+
return It(g, T, f == null ? void 0 : f["checked-data-type"]);
|
|
2246
2246
|
});
|
|
2247
|
-
let
|
|
2247
|
+
let d = {};
|
|
2248
2248
|
const y = na(e, n, s);
|
|
2249
2249
|
for (const w of u) {
|
|
2250
|
-
const [
|
|
2251
|
-
if (
|
|
2250
|
+
const [T] = w;
|
|
2251
|
+
if (d[T] || !a && l && f && Zo(l, f, c, w))
|
|
2252
2252
|
continue;
|
|
2253
|
-
const
|
|
2254
|
-
|
|
2253
|
+
const g = uo(t, y, T);
|
|
2254
|
+
g && (d[T] = g);
|
|
2255
2255
|
}
|
|
2256
|
-
return
|
|
2256
|
+
return d;
|
|
2257
2257
|
}
|
|
2258
2258
|
function sa(t) {
|
|
2259
2259
|
var n;
|
|
@@ -2266,19 +2266,19 @@ function As(t) {
|
|
|
2266
2266
|
return !e && !n && !r;
|
|
2267
2267
|
}
|
|
2268
2268
|
function ia(t, e, { etype: n, level: r, form: s, join: i, pageInfo: o }) {
|
|
2269
|
-
var
|
|
2269
|
+
var d, y, b, _, w;
|
|
2270
2270
|
if (!As(s) && (!o || !o["start-cursor"]))
|
|
2271
2271
|
return [];
|
|
2272
|
-
const a =
|
|
2272
|
+
const a = Wo(Go(e, n, r, (d = s.$) == null ? void 0 : d.where), i), c = Qo(jt, n, r), u = (y = s.$) == null ? void 0 : y.fields, l = ra(t, e, {
|
|
2273
2273
|
etype: n,
|
|
2274
2274
|
pageInfo: o,
|
|
2275
2275
|
form: s,
|
|
2276
2276
|
dq: { where: a, find: c, fields: u }
|
|
2277
|
-
}), f = ((b = s.$) == null ? void 0 : b.limit) || ((
|
|
2277
|
+
}), f = ((b = s.$) == null ? void 0 : b.limit) || ((_ = s.$) == null ? void 0 : _.first) || ((w = s.$) == null ? void 0 : w.last);
|
|
2278
2278
|
if (f != null) {
|
|
2279
2279
|
r > 0 && console.warn("WARNING: Limits in child queries are only run client-side. Data returned from the server will not have a limit.");
|
|
2280
|
-
const
|
|
2281
|
-
return
|
|
2280
|
+
const T = Object.entries(l);
|
|
2281
|
+
return T.length <= f ? l : Object.fromEntries(T.slice(0, f));
|
|
2282
2282
|
}
|
|
2283
2283
|
return l;
|
|
2284
2284
|
}
|
|
@@ -2293,7 +2293,7 @@ function oa(t, e, n) {
|
|
|
2293
2293
|
}
|
|
2294
2294
|
function ks(t, e, n) {
|
|
2295
2295
|
const r = oa(t, e, n);
|
|
2296
|
-
return Jo(
|
|
2296
|
+
return Jo(jt, t, e, n, r);
|
|
2297
2297
|
}
|
|
2298
2298
|
function aa(t) {
|
|
2299
2299
|
const e = {};
|
|
@@ -2354,7 +2354,7 @@ function St(t, e, n) {
|
|
|
2354
2354
|
function la(t, e) {
|
|
2355
2355
|
return `lookup__${t}__${JSON.stringify(e)}`;
|
|
2356
2356
|
}
|
|
2357
|
-
function
|
|
2357
|
+
function Pt(t) {
|
|
2358
2358
|
return t.startsWith("lookup__");
|
|
2359
2359
|
}
|
|
2360
2360
|
function pn(t) {
|
|
@@ -2371,7 +2371,7 @@ function fa(t) {
|
|
|
2371
2371
|
if (n === "__etype")
|
|
2372
2372
|
return t;
|
|
2373
2373
|
const r = n;
|
|
2374
|
-
return
|
|
2374
|
+
return Pt(r) ? St(t, pn(r), []) : St(t, r, []);
|
|
2375
2375
|
}
|
|
2376
2376
|
});
|
|
2377
2377
|
}
|
|
@@ -2382,7 +2382,7 @@ function Kn() {
|
|
|
2382
2382
|
}
|
|
2383
2383
|
});
|
|
2384
2384
|
}
|
|
2385
|
-
const
|
|
2385
|
+
const Uu = Kn();
|
|
2386
2386
|
function da(t) {
|
|
2387
2387
|
return t.__ops;
|
|
2388
2388
|
}
|
|
@@ -2416,7 +2416,7 @@ function pa(t) {
|
|
|
2416
2416
|
function ya(t, e, n) {
|
|
2417
2417
|
return n.indexOf(".") !== -1 && // attr names can have `.` in them, so use the attr we find with a `.`
|
|
2418
2418
|
// before assuming it's a ref lookup.
|
|
2419
|
-
!
|
|
2419
|
+
!K(t, e, n);
|
|
2420
2420
|
}
|
|
2421
2421
|
function yn(t) {
|
|
2422
2422
|
const [e, n, ...r] = t.split(".");
|
|
@@ -2426,14 +2426,14 @@ function yn(t) {
|
|
|
2426
2426
|
}
|
|
2427
2427
|
function ba(t, e, n) {
|
|
2428
2428
|
if (!ya(t, e, n))
|
|
2429
|
-
return
|
|
2430
|
-
const r = yn(n), s =
|
|
2429
|
+
return K(t, e, n);
|
|
2430
|
+
const r = yn(n), s = K(t, e, r) || Ce(t, e, r);
|
|
2431
2431
|
if (s && s["value-type"] !== "ref")
|
|
2432
2432
|
throw new Error(`${n} does not reference a valid link attribute.`);
|
|
2433
2433
|
return s;
|
|
2434
2434
|
}
|
|
2435
2435
|
function bn(t) {
|
|
2436
|
-
return typeof t == "string" && !
|
|
2436
|
+
return typeof t == "string" && !Pt(t) ? null : typeof t == "string" && Pt(t) ? pn(t) : pa(t);
|
|
2437
2437
|
}
|
|
2438
2438
|
function ee(t, e, n) {
|
|
2439
2439
|
const r = bn(n);
|
|
@@ -2444,19 +2444,19 @@ function ee(t, e, n) {
|
|
|
2444
2444
|
throw new Error(`${s} is not a unique attribute.`);
|
|
2445
2445
|
return [o.id, i];
|
|
2446
2446
|
}
|
|
2447
|
-
function
|
|
2447
|
+
function Is(t, e, n, r) {
|
|
2448
2448
|
var o;
|
|
2449
2449
|
const s = ee(t, e, n);
|
|
2450
2450
|
return Array.isArray(s) ? [[
|
|
2451
2451
|
"add-triple",
|
|
2452
2452
|
s,
|
|
2453
|
-
(o =
|
|
2453
|
+
(o = K(t, e, "id")) == null ? void 0 : o.id,
|
|
2454
2454
|
s
|
|
2455
2455
|
]].concat(r) : r;
|
|
2456
2456
|
}
|
|
2457
|
-
function
|
|
2457
|
+
function _a({ attrsStore: t }, [e, n, r]) {
|
|
2458
2458
|
const s = Object.entries(r).flatMap(([i, o]) => {
|
|
2459
|
-
const a = Array.isArray(o) ? o : [o], c =
|
|
2459
|
+
const a = Array.isArray(o) ? o : [o], c = K(t, e, i), u = Ce(t, e, i);
|
|
2460
2460
|
return a.map((l) => c ? [
|
|
2461
2461
|
"add-triple",
|
|
2462
2462
|
ee(t, e, n),
|
|
@@ -2473,11 +2473,11 @@ function ga({ attrsStore: t }, [e, n, r]) {
|
|
|
2473
2473
|
ee(t, e, n)
|
|
2474
2474
|
]);
|
|
2475
2475
|
});
|
|
2476
|
-
return
|
|
2476
|
+
return Is(t, e, n, s);
|
|
2477
2477
|
}
|
|
2478
|
-
function
|
|
2478
|
+
function ga({ attrsStore: t }, [e, n, r]) {
|
|
2479
2479
|
const s = Object.entries(r).flatMap(([i, o]) => {
|
|
2480
|
-
const a = Array.isArray(o) ? o : [o], c =
|
|
2480
|
+
const a = Array.isArray(o) ? o : [o], c = K(t, e, i), u = Ce(t, e, i);
|
|
2481
2481
|
return a.map((l) => c ? [
|
|
2482
2482
|
"retract-triple",
|
|
2483
2483
|
ee(t, e, n),
|
|
@@ -2494,7 +2494,7 @@ function _a({ attrsStore: t }, [e, n, r]) {
|
|
|
2494
2494
|
ee(t, e, n)
|
|
2495
2495
|
]);
|
|
2496
2496
|
});
|
|
2497
|
-
return
|
|
2497
|
+
return Is(t, e, n, s);
|
|
2498
2498
|
}
|
|
2499
2499
|
function wa(t, e, n, r) {
|
|
2500
2500
|
var s;
|
|
@@ -2519,25 +2519,25 @@ function wa(t, e, n, r) {
|
|
|
2519
2519
|
}
|
|
2520
2520
|
return !1;
|
|
2521
2521
|
}
|
|
2522
|
-
function
|
|
2522
|
+
function Ps({ stores: t, attrsStore: e }, [n, r, s, i]) {
|
|
2523
2523
|
return (i == null ? void 0 : i.upsert) === !1 ? { mode: "update" } : (i == null ? void 0 : i.upsert) === !0 ? null : wa(t, e, n, r) ? { mode: "update" } : null;
|
|
2524
2524
|
}
|
|
2525
|
-
function
|
|
2525
|
+
function ma(t, e) {
|
|
2526
2526
|
const { attrsStore: n } = t, [r, s, i, o] = e, a = Un(i), c = ee(n, r, s);
|
|
2527
2527
|
return [["id", c]].concat(Object.entries(a)).map(([l, f]) => {
|
|
2528
|
-
const
|
|
2529
|
-
return
|
|
2528
|
+
const d = K(n, r, l);
|
|
2529
|
+
return d["checked-data-type"] === "date" && t.useDateObjects && (f = Rt(f)), ["add-triple", c, d.id, f, { mode: "create" }];
|
|
2530
2530
|
});
|
|
2531
2531
|
}
|
|
2532
|
-
function
|
|
2533
|
-
const { attrsStore: n } = t, [r, s, i, o] = e, a = Un(i), c = ee(n, r, s), u =
|
|
2534
|
-
return [["id", c]].concat(Object.entries(a)).map(([f,
|
|
2535
|
-
const y =
|
|
2536
|
-
return y["checked-data-type"] === "date" && t.useDateObjects && (
|
|
2532
|
+
function Ta(t, e) {
|
|
2533
|
+
const { attrsStore: n } = t, [r, s, i, o] = e, a = Un(i), c = ee(n, r, s), u = Ps(t, [r, c, i, o]);
|
|
2534
|
+
return [["id", c]].concat(Object.entries(a)).map(([f, d]) => {
|
|
2535
|
+
const y = K(n, r, f);
|
|
2536
|
+
return y["checked-data-type"] === "date" && t.useDateObjects && (d = Rt(d)), [
|
|
2537
2537
|
"add-triple",
|
|
2538
2538
|
c,
|
|
2539
2539
|
y.id,
|
|
2540
|
-
|
|
2540
|
+
d,
|
|
2541
2541
|
...u ? [u] : []
|
|
2542
2542
|
];
|
|
2543
2543
|
});
|
|
@@ -2546,8 +2546,8 @@ function Sa({ attrsStore: t }, [e, n]) {
|
|
|
2546
2546
|
return [["delete-entity", ee(t, e, n), e]];
|
|
2547
2547
|
}
|
|
2548
2548
|
function va(t, e) {
|
|
2549
|
-
const { attrsStore: n } = t, [r, s, i, o] = e, a = Un(i), c = ee(n, r, s), u =
|
|
2550
|
-
const b =
|
|
2549
|
+
const { attrsStore: n } = t, [r, s, i, o] = e, a = Un(i), c = ee(n, r, s), u = Ps(t, [r, c, i, o]), l = Object.entries(a).map(([d, y]) => {
|
|
2550
|
+
const b = K(n, r, d);
|
|
2551
2551
|
return [
|
|
2552
2552
|
"deep-merge-triple",
|
|
2553
2553
|
c,
|
|
@@ -2559,7 +2559,7 @@ function va(t, e) {
|
|
|
2559
2559
|
return [[
|
|
2560
2560
|
"add-triple",
|
|
2561
2561
|
c,
|
|
2562
|
-
|
|
2562
|
+
K(n, r, "id").id,
|
|
2563
2563
|
c,
|
|
2564
2564
|
...u ? [u] : []
|
|
2565
2565
|
]].concat(l);
|
|
@@ -2580,13 +2580,13 @@ function Aa(t, e) {
|
|
|
2580
2580
|
case "merge":
|
|
2581
2581
|
return va(t, r);
|
|
2582
2582
|
case "create":
|
|
2583
|
-
return Ta(t, r);
|
|
2584
|
-
case "update":
|
|
2585
2583
|
return ma(t, r);
|
|
2584
|
+
case "update":
|
|
2585
|
+
return Ta(t, r);
|
|
2586
2586
|
case "link":
|
|
2587
|
-
return ga(t, r);
|
|
2588
|
-
case "unlink":
|
|
2589
2587
|
return _a(t, r);
|
|
2588
|
+
case "unlink":
|
|
2589
|
+
return ga(t, r);
|
|
2590
2590
|
case "delete":
|
|
2591
2591
|
return Sa(t, r);
|
|
2592
2592
|
case "ruleParams":
|
|
@@ -2621,7 +2621,7 @@ function Ca(t, e, n) {
|
|
|
2621
2621
|
};
|
|
2622
2622
|
}
|
|
2623
2623
|
function yt(t, e, n, r) {
|
|
2624
|
-
const s = t ? Ca(t, e, n) : null, i =
|
|
2624
|
+
const s = t ? Ca(t, e, n) : null, i = L(), a = [L(), e, n];
|
|
2625
2625
|
return {
|
|
2626
2626
|
id: i,
|
|
2627
2627
|
"forward-identity": a,
|
|
@@ -2634,17 +2634,17 @@ function yt(t, e, n, r) {
|
|
|
2634
2634
|
...r || {}
|
|
2635
2635
|
};
|
|
2636
2636
|
}
|
|
2637
|
-
function
|
|
2637
|
+
function Ia(t, e, n) {
|
|
2638
2638
|
return Object.values(t.links).find((i) => i.forward.on === e && i.forward.label === n || i.reverse.on === e && i.reverse.label === n);
|
|
2639
2639
|
}
|
|
2640
|
-
function
|
|
2641
|
-
const r =
|
|
2640
|
+
function Pa(t, e, n) {
|
|
2641
|
+
const r = Ia(t, e, n);
|
|
2642
2642
|
if (!r)
|
|
2643
2643
|
throw new Error(`Couldn't find the link ${e}.${n} in your schema`);
|
|
2644
2644
|
const { forward: s, reverse: i } = r;
|
|
2645
2645
|
return {
|
|
2646
|
-
"forward-identity": [
|
|
2647
|
-
"reverse-identity": [
|
|
2646
|
+
"forward-identity": [L(), s.on, s.label],
|
|
2647
|
+
"reverse-identity": [L(), i.on, i.label],
|
|
2648
2648
|
cardinality: s.has === "one" ? "one" : "many",
|
|
2649
2649
|
"unique?": i.has === "one",
|
|
2650
2650
|
"on-delete": s.onDelete,
|
|
@@ -2652,7 +2652,7 @@ function Ia(t, e, n) {
|
|
|
2652
2652
|
};
|
|
2653
2653
|
}
|
|
2654
2654
|
function Cr(t, e, n, r) {
|
|
2655
|
-
const s = t ?
|
|
2655
|
+
const s = t ? Pa(t, e, n) : null, i = L(), o = [L(), e, n], a = [L(), n, e];
|
|
2656
2656
|
return {
|
|
2657
2657
|
id: i,
|
|
2658
2658
|
// @ts-ignore: ts thinks it's any[]
|
|
@@ -2669,7 +2669,7 @@ function Cr(t, e, n, r) {
|
|
|
2669
2669
|
...r || {}
|
|
2670
2670
|
};
|
|
2671
2671
|
}
|
|
2672
|
-
const Ma = /* @__PURE__ */ new Set(["create", "update", "merge", "link", "unlink"]),
|
|
2672
|
+
const Ma = /* @__PURE__ */ new Set(["create", "update", "merge", "link", "unlink"]), Ra = /* @__PURE__ */ new Set(["link", "unlink"]), ja = /* @__PURE__ */ new Set(["create", "update", "merge"]), xa = /* @__PURE__ */ new Set([
|
|
2673
2673
|
"link",
|
|
2674
2674
|
"unlink",
|
|
2675
2675
|
"create",
|
|
@@ -2677,8 +2677,8 @@ const Ma = /* @__PURE__ */ new Set(["create", "update", "merge", "link", "unlink
|
|
|
2677
2677
|
"merge",
|
|
2678
2678
|
"delete",
|
|
2679
2679
|
"ruleParams"
|
|
2680
|
-
]),
|
|
2681
|
-
...
|
|
2680
|
+
]), _n = { "unique?": !0, "index?": !0 }, $a = {
|
|
2681
|
+
..._n,
|
|
2682
2682
|
cardinality: "one"
|
|
2683
2683
|
};
|
|
2684
2684
|
function Da(t) {
|
|
@@ -2701,15 +2701,15 @@ function Da(t) {
|
|
|
2701
2701
|
return e;
|
|
2702
2702
|
}
|
|
2703
2703
|
function Ua({ attrsStore: t, schema: e }, n) {
|
|
2704
|
-
var
|
|
2704
|
+
var d, y;
|
|
2705
2705
|
const r = /* @__PURE__ */ new Set(), s = [], i = [];
|
|
2706
|
-
function o(b,
|
|
2707
|
-
return
|
|
2706
|
+
function o(b, _) {
|
|
2707
|
+
return K(t, b, _) || s.find((w) => w["forward-identity"][1] === b && w["forward-identity"][2] === _);
|
|
2708
2708
|
}
|
|
2709
|
-
function a(b,
|
|
2710
|
-
return Ce(t, b,
|
|
2711
|
-
var
|
|
2712
|
-
return ((
|
|
2709
|
+
function a(b, _) {
|
|
2710
|
+
return Ce(t, b, _) || s.find((w) => {
|
|
2711
|
+
var T, g;
|
|
2712
|
+
return ((T = w["reverse-identity"]) == null ? void 0 : T[1]) === b && ((g = w["reverse-identity"]) == null ? void 0 : g[2]) === _;
|
|
2713
2713
|
});
|
|
2714
2714
|
}
|
|
2715
2715
|
function c(b) {
|
|
@@ -2718,54 +2718,54 @@ function Ua({ attrsStore: t, schema: e }, n) {
|
|
|
2718
2718
|
function u(b) {
|
|
2719
2719
|
b && "isUnsynced" in b && b.isUnsynced && !r.has(b.id) && (s.push(b), i.push(["add-attr", b]), r.add(b.id));
|
|
2720
2720
|
}
|
|
2721
|
-
function l(b,
|
|
2722
|
-
return
|
|
2721
|
+
function l(b, _) {
|
|
2722
|
+
return _.indexOf(".") !== -1 && // attr names can have `.` in them, so use the attr we find with a `.`
|
|
2723
2723
|
// before assuming it's a ref lookup.
|
|
2724
|
-
!o(b,
|
|
2724
|
+
!o(b, _);
|
|
2725
2725
|
}
|
|
2726
|
-
function f(b,
|
|
2727
|
-
const w = o(b,
|
|
2728
|
-
u(w), u(
|
|
2726
|
+
function f(b, _) {
|
|
2727
|
+
const w = o(b, _), T = a(b, _);
|
|
2728
|
+
u(w), u(T), !w && !T && c(Cr(e, b, _, $a));
|
|
2729
2729
|
}
|
|
2730
2730
|
for (const b of n)
|
|
2731
|
-
for (const { etype:
|
|
2732
|
-
const
|
|
2733
|
-
if (
|
|
2734
|
-
f(
|
|
2735
|
-
const S = o(
|
|
2731
|
+
for (const { etype: _, lookupPair: w, linkLabel: T } of Da(b)) {
|
|
2732
|
+
const g = w[0];
|
|
2733
|
+
if (T) {
|
|
2734
|
+
f(_, T);
|
|
2735
|
+
const S = o(_, T), O = a(_, T);
|
|
2736
2736
|
u(S), u(O);
|
|
2737
|
-
const E = ((
|
|
2738
|
-
if (l(E,
|
|
2739
|
-
f(E, yn(
|
|
2737
|
+
const E = ((d = S == null ? void 0 : S["reverse-identity"]) == null ? void 0 : d[1]) || ((y = O == null ? void 0 : O["forward-identity"]) == null ? void 0 : y[1]) || T;
|
|
2738
|
+
if (l(E, g))
|
|
2739
|
+
f(E, yn(g));
|
|
2740
2740
|
else {
|
|
2741
|
-
const
|
|
2742
|
-
|
|
2741
|
+
const R = o(E, g);
|
|
2742
|
+
R || c(yt(e, E, g, _n)), u(R);
|
|
2743
2743
|
}
|
|
2744
|
-
} else if (l(
|
|
2745
|
-
f(
|
|
2744
|
+
} else if (l(_, g))
|
|
2745
|
+
f(_, yn(g));
|
|
2746
2746
|
else {
|
|
2747
|
-
const S = o(
|
|
2748
|
-
S || c(yt(e,
|
|
2747
|
+
const S = o(_, g);
|
|
2748
|
+
S || c(yt(e, _, g, _n)), u(S);
|
|
2749
2749
|
}
|
|
2750
2750
|
}
|
|
2751
2751
|
for (const b of n) {
|
|
2752
|
-
const [
|
|
2753
|
-
if (Ma.has(
|
|
2752
|
+
const [_, w, T, g] = b;
|
|
2753
|
+
if (Ma.has(_)) {
|
|
2754
2754
|
const S = o(w, "id");
|
|
2755
2755
|
u(S), S || c(yt(e, w, "id", { "unique?": !0 }));
|
|
2756
|
-
for (const O of Object.keys(
|
|
2756
|
+
for (const O of Object.keys(g)) {
|
|
2757
2757
|
const E = o(w, O);
|
|
2758
|
-
if (u(E),
|
|
2759
|
-
const
|
|
2760
|
-
!E && !
|
|
2758
|
+
if (u(E), ja.has(_) && (E || c(yt(e, w, O, O === "id" ? { "unique?": !0 } : null))), Ra.has(_)) {
|
|
2759
|
+
const R = a(w, O);
|
|
2760
|
+
!E && !R && c(Cr(e, w, O)), u(R);
|
|
2761
2761
|
}
|
|
2762
2762
|
}
|
|
2763
2763
|
}
|
|
2764
2764
|
}
|
|
2765
2765
|
if (s.length) {
|
|
2766
2766
|
const b = { ...t.attrs };
|
|
2767
|
-
for (const
|
|
2768
|
-
b[
|
|
2767
|
+
for (const _ of s)
|
|
2768
|
+
b[_.id] = _;
|
|
2769
2769
|
return [new Ee(b, t.linkIndex), i];
|
|
2770
2770
|
}
|
|
2771
2771
|
return [t, i];
|
|
@@ -2774,7 +2774,7 @@ function La(t, e) {
|
|
|
2774
2774
|
const r = (Array.isArray(e) ? e : [e]).flatMap((c) => da(c)), [s, i] = Ua(t, r), o = { ...t, attrsStore: s }, a = r.flatMap((c) => Aa(o, c));
|
|
2775
2775
|
return [...i, ...a];
|
|
2776
2776
|
}
|
|
2777
|
-
function
|
|
2777
|
+
function Ir(t, e) {
|
|
2778
2778
|
typeof requestIdleCallback > "u" ? t() : requestIdleCallback(t, { timeout: e });
|
|
2779
2779
|
}
|
|
2780
2780
|
const nt = "__meta";
|
|
@@ -2782,7 +2782,7 @@ class Fa {
|
|
|
2782
2782
|
constructor(e, n) {
|
|
2783
2783
|
}
|
|
2784
2784
|
}
|
|
2785
|
-
class
|
|
2785
|
+
class gn {
|
|
2786
2786
|
constructor(e) {
|
|
2787
2787
|
p(this, "currentValue");
|
|
2788
2788
|
p(this, "_subs", []);
|
|
@@ -2882,10 +2882,10 @@ class _n {
|
|
|
2882
2882
|
_writeToStorage(e) {
|
|
2883
2883
|
const n = [], r = e == null ? void 0 : e.skipGc;
|
|
2884
2884
|
if (this._meta.isLoading) {
|
|
2885
|
-
const f = new Promise((
|
|
2886
|
-
setTimeout(() => this._enqueuePersist(e ? { ...e, attempts: (e.attempts || 0) + 1 } : { attempts: 1 }).then(
|
|
2885
|
+
const f = new Promise((d, y) => {
|
|
2886
|
+
setTimeout(() => this._enqueuePersist(e ? { ...e, attempts: (e.attempts || 0) + 1 } : { attempts: 1 }).then(d).catch(y), 10 + ((e == null ? void 0 : e.attempts) ?? 0) * 1e3);
|
|
2887
2887
|
});
|
|
2888
|
-
return n.push(f), Promise.all(n).then((
|
|
2888
|
+
return n.push(f), Promise.all(n).then((d) => d.reduce((y, b) => y + b, 0));
|
|
2889
2889
|
}
|
|
2890
2890
|
const s = this._meta.value;
|
|
2891
2891
|
if (!s)
|
|
@@ -2894,16 +2894,16 @@ class _n {
|
|
|
2894
2894
|
for (const f of this._pendingSaveKeys)
|
|
2895
2895
|
f in this.currentValue ? o.push(f) : (i.push(f), delete s.objects[f]);
|
|
2896
2896
|
for (const f of i) {
|
|
2897
|
-
const
|
|
2898
|
-
n.push(
|
|
2897
|
+
const d = this._persister.removeItem(f);
|
|
2898
|
+
n.push(d.then(() => 1)), this._loadedKeys.delete(f), this._pendingSaveKeys.delete(f);
|
|
2899
2899
|
}
|
|
2900
2900
|
const a = [], c = [[nt, s]], u = s.objects ?? {};
|
|
2901
2901
|
s.objects = u;
|
|
2902
2902
|
for (const f of o)
|
|
2903
2903
|
if (this._loadedKeys.has(f)) {
|
|
2904
|
-
const
|
|
2905
|
-
c.push([f,
|
|
2906
|
-
const y = this._objectSize(
|
|
2904
|
+
const d = this.serialize(f, this.currentValue[f]);
|
|
2905
|
+
c.push([f, d]);
|
|
2906
|
+
const y = this._objectSize(d), b = u[f] ?? {
|
|
2907
2907
|
createdAt: Date.now(),
|
|
2908
2908
|
updatedAt: Date.now(),
|
|
2909
2909
|
size: y
|
|
@@ -2914,10 +2914,10 @@ class _n {
|
|
|
2914
2914
|
const l = this._persister.multiSet(c);
|
|
2915
2915
|
n.push(l.then(() => 1));
|
|
2916
2916
|
for (const f of a) {
|
|
2917
|
-
const
|
|
2918
|
-
n.push(
|
|
2917
|
+
const d = this._loadKey(f).then(() => this._enqueuePersist(e));
|
|
2918
|
+
n.push(d);
|
|
2919
2919
|
}
|
|
2920
|
-
return r || this.gc(), Promise.all(n).then((f) => f.reduce((
|
|
2920
|
+
return r || this.gc(), Promise.all(n).then((f) => f.reduce((d, y) => d + y, 0));
|
|
2921
2921
|
}
|
|
2922
2922
|
async flush() {
|
|
2923
2923
|
return this._nextSave ? (clearTimeout(this._nextSave), this._nextSave = null, this._writeToStorage()) : void 0;
|
|
@@ -2928,10 +2928,10 @@ class _n {
|
|
|
2928
2928
|
const e = new Set(await this._persister.getAllKeys());
|
|
2929
2929
|
e.delete(nt);
|
|
2930
2930
|
const n = new Set(Object.keys(this.currentValue));
|
|
2931
|
-
for (const
|
|
2932
|
-
n.add(
|
|
2933
|
-
for (const
|
|
2934
|
-
n.add(
|
|
2931
|
+
for (const d of Object.keys(this._loadingKeys))
|
|
2932
|
+
n.add(d);
|
|
2933
|
+
for (const d of this._loadedKeys)
|
|
2934
|
+
n.add(d);
|
|
2935
2935
|
const r = await this._refreshMeta();
|
|
2936
2936
|
if (!r) {
|
|
2937
2937
|
this._log.info("Could not gc because we were not able to load meta");
|
|
@@ -2948,34 +2948,34 @@ class _n {
|
|
|
2948
2948
|
removedThresholdCount: 0,
|
|
2949
2949
|
removedSizeCount: 0
|
|
2950
2950
|
};
|
|
2951
|
-
for (const
|
|
2952
|
-
n.has(
|
|
2951
|
+
for (const d of e)
|
|
2952
|
+
n.has(d) || d in r.objects || (this._log.info("Lost track of key in meta", d), s.push(this._persister.removeItem(d)), i.removed.push(d), i.removedMissingCount++);
|
|
2953
2953
|
const o = Date.now();
|
|
2954
|
-
for (const [
|
|
2955
|
-
!n.has(
|
|
2954
|
+
for (const [d, y] of Object.entries(r.objects))
|
|
2955
|
+
!n.has(d) && y.updatedAt < o - this._gcOpts.maxAgeMs && (s.push(this._persister.removeItem(d)), delete r.objects[d], i.removed.push(d), i.removedOldCount++);
|
|
2956
2956
|
const a = Object.entries(r.objects);
|
|
2957
|
-
a.sort(([
|
|
2958
|
-
const c = a.filter(([
|
|
2957
|
+
a.sort(([d, y], [b, _]) => y.updatedAt - _.updatedAt);
|
|
2958
|
+
const c = a.filter(([d]) => !n.has(d));
|
|
2959
2959
|
if (a.length > this._gcOpts.maxEntries)
|
|
2960
|
-
for (const [
|
|
2961
|
-
s.push(this._persister.removeItem(
|
|
2960
|
+
for (const [d] of c.slice(0, a.length - this._gcOpts.maxEntries))
|
|
2961
|
+
s.push(this._persister.removeItem(d)), delete r.objects[d], i.removed.push(d), i.removedThresholdCount++;
|
|
2962
2962
|
const u = Object.entries(r.objects);
|
|
2963
|
-
u.sort(([
|
|
2964
|
-
const l = u.filter(([
|
|
2965
|
-
let f = u.reduce((
|
|
2963
|
+
u.sort(([d, y], [b, _]) => y.updatedAt - _.updatedAt);
|
|
2964
|
+
const l = u.filter(([d]) => !n.has(d));
|
|
2965
|
+
let f = u.reduce((d, [y, b]) => d + b.size, 0);
|
|
2966
2966
|
for (; f > 0 && f > this._gcOpts.maxSize && l.length; ) {
|
|
2967
|
-
const [[
|
|
2968
|
-
f -= y.size, s.push(this._persister.removeItem(
|
|
2967
|
+
const [[d, y]] = l.splice(0, 1);
|
|
2968
|
+
f -= y.size, s.push(this._persister.removeItem(d)), delete r.objects[d], i.removed.push(d), i.removedSizeCount++;
|
|
2969
2969
|
}
|
|
2970
|
-
for (const
|
|
2971
|
-
!e.has(
|
|
2970
|
+
for (const d of Object.keys(r.objects))
|
|
2971
|
+
!e.has(d) && !n.has(d) && delete r.objects[d];
|
|
2972
2972
|
return (i.removed.length || i.metaRemoved.length) && s.push(this._enqueuePersist({ skipGc: !0 })), this._log.info("Completed GC", i), await Promise.all(s), i;
|
|
2973
2973
|
}
|
|
2974
2974
|
// Schedules a GC to run in one minute (unless it is already scheduled)
|
|
2975
2975
|
gc() {
|
|
2976
2976
|
this._nextGc || (this._nextGc = setTimeout(
|
|
2977
2977
|
() => {
|
|
2978
|
-
|
|
2978
|
+
Ir(() => {
|
|
2979
2979
|
this._nextGc = null, this._gc();
|
|
2980
2980
|
}, 30 * 1e3);
|
|
2981
2981
|
},
|
|
@@ -2990,7 +2990,7 @@ class _n {
|
|
|
2990
2990
|
return;
|
|
2991
2991
|
}
|
|
2992
2992
|
this._nextSave = setTimeout(() => {
|
|
2993
|
-
|
|
2993
|
+
Ir(() => {
|
|
2994
2994
|
this._nextSave = null, this._writeToStorage(e).then(n).catch(r);
|
|
2995
2995
|
}, this._idleCallbackMaxWaitMs);
|
|
2996
2996
|
}, this._saveThrottleMs);
|
|
@@ -3023,12 +3023,12 @@ class _n {
|
|
|
3023
3023
|
}
|
|
3024
3024
|
}
|
|
3025
3025
|
const Na = 6, Ka = ["kv", "querySubs", "syncSubs"];
|
|
3026
|
-
function
|
|
3026
|
+
function Wa(t) {
|
|
3027
3027
|
return function(n) {
|
|
3028
3028
|
console.error("Error in IndexedDB event", { source: t, event: n });
|
|
3029
3029
|
};
|
|
3030
3030
|
}
|
|
3031
|
-
async function
|
|
3031
|
+
async function qa(t) {
|
|
3032
3032
|
return new Promise((e) => {
|
|
3033
3033
|
const n = indexedDB.open(t);
|
|
3034
3034
|
n.onerror = (r) => {
|
|
@@ -3051,19 +3051,19 @@ async function za(t, e, n) {
|
|
|
3051
3051
|
return;
|
|
3052
3052
|
const s = /* @__PURE__ */ new Set();
|
|
3053
3053
|
return new Promise((i, o) => {
|
|
3054
|
-
var l, f,
|
|
3054
|
+
var l, f, d;
|
|
3055
3055
|
const a = {};
|
|
3056
3056
|
for (const [y, b] of Object.entries(r)) {
|
|
3057
|
-
const
|
|
3058
|
-
if (
|
|
3059
|
-
const
|
|
3060
|
-
createdAt:
|
|
3061
|
-
updatedAt:
|
|
3062
|
-
size: ((
|
|
3057
|
+
const _ = typeof b == "string" ? JSON.parse(b) : b;
|
|
3058
|
+
if (_.lastAccessed) {
|
|
3059
|
+
const T = {
|
|
3060
|
+
createdAt: _.lastAccessed,
|
|
3061
|
+
updatedAt: _.lastAccessed,
|
|
3062
|
+
size: ((d = (f = (l = _.result) == null ? void 0 : l.store) == null ? void 0 : f.triples) == null ? void 0 : d.length) ?? 0
|
|
3063
3063
|
};
|
|
3064
|
-
a[y] =
|
|
3064
|
+
a[y] = T;
|
|
3065
3065
|
}
|
|
3066
|
-
const w = n.put(
|
|
3066
|
+
const w = n.put(_, y);
|
|
3067
3067
|
s.add(w);
|
|
3068
3068
|
}
|
|
3069
3069
|
const c = { objects: a }, u = n.put(c, nt);
|
|
@@ -3076,14 +3076,14 @@ async function za(t, e, n) {
|
|
|
3076
3076
|
};
|
|
3077
3077
|
});
|
|
3078
3078
|
}
|
|
3079
|
-
async function
|
|
3079
|
+
async function Pr(t, e, n) {
|
|
3080
3080
|
const r = n.put(e, t);
|
|
3081
3081
|
return new Promise((s, i) => {
|
|
3082
3082
|
r.onsuccess = () => s(), r.onerror = (o) => i(o);
|
|
3083
3083
|
});
|
|
3084
3084
|
}
|
|
3085
3085
|
async function Va(t, e) {
|
|
3086
|
-
const n = await
|
|
3086
|
+
const n = await qa(`instant_${t}_5`);
|
|
3087
3087
|
if (!n)
|
|
3088
3088
|
return;
|
|
3089
3089
|
const r = await new Promise((l, f) => {
|
|
@@ -3091,14 +3091,14 @@ async function Va(t, e) {
|
|
|
3091
3091
|
b.onerror = (w) => {
|
|
3092
3092
|
f(w);
|
|
3093
3093
|
};
|
|
3094
|
-
const
|
|
3094
|
+
const _ = [];
|
|
3095
3095
|
b.onsuccess = () => {
|
|
3096
3096
|
const w = b.result;
|
|
3097
3097
|
if (w) {
|
|
3098
|
-
const
|
|
3099
|
-
|
|
3098
|
+
const T = w.key, g = w.value;
|
|
3099
|
+
_.push([T, g]), w.continue();
|
|
3100
3100
|
} else
|
|
3101
|
-
l(
|
|
3101
|
+
l(_);
|
|
3102
3102
|
}, b.onerror = (w) => {
|
|
3103
3103
|
f(w);
|
|
3104
3104
|
};
|
|
@@ -3106,13 +3106,13 @@ async function Va(t, e) {
|
|
|
3106
3106
|
for (const [l, f] of r)
|
|
3107
3107
|
switch (l) {
|
|
3108
3108
|
case "querySubs": {
|
|
3109
|
-
const
|
|
3110
|
-
a.push(
|
|
3109
|
+
const d = za(l, f, o);
|
|
3110
|
+
a.push(d);
|
|
3111
3111
|
break;
|
|
3112
3112
|
}
|
|
3113
3113
|
default: {
|
|
3114
|
-
const
|
|
3115
|
-
a.push(
|
|
3114
|
+
const d = Pr(l, f, i);
|
|
3115
|
+
a.push(d);
|
|
3116
3116
|
const y = {
|
|
3117
3117
|
createdAt: Date.now(),
|
|
3118
3118
|
updatedAt: Date.now(),
|
|
@@ -3122,9 +3122,9 @@ async function Va(t, e) {
|
|
|
3122
3122
|
break;
|
|
3123
3123
|
}
|
|
3124
3124
|
}
|
|
3125
|
-
const u =
|
|
3125
|
+
const u = Pr(nt, c, i);
|
|
3126
3126
|
a.push(u), await Promise.all(a), await new Promise((l, f) => {
|
|
3127
|
-
s.oncomplete = (
|
|
3127
|
+
s.oncomplete = (d) => l(d), s.onerror = (d) => f(d), s.onabort = (d) => f(d);
|
|
3128
3128
|
});
|
|
3129
3129
|
}
|
|
3130
3130
|
const Mr = /* @__PURE__ */ new Map();
|
|
@@ -3148,7 +3148,7 @@ class Ms extends Fa {
|
|
|
3148
3148
|
const c = o.target.result;
|
|
3149
3149
|
if (s) {
|
|
3150
3150
|
const u = Va(this._appId, c).catch((l) => {
|
|
3151
|
-
|
|
3151
|
+
Wa("Error upgrading store from version 5 to 6.")(l);
|
|
3152
3152
|
});
|
|
3153
3153
|
Mr.set(this.dbName, u), u.then(() => n(c)).catch(() => n(c));
|
|
3154
3154
|
} else {
|
|
@@ -3227,7 +3227,7 @@ class Ms extends Fa {
|
|
|
3227
3227
|
});
|
|
3228
3228
|
}
|
|
3229
3229
|
}
|
|
3230
|
-
class
|
|
3230
|
+
class Rs {
|
|
3231
3231
|
static async getIsOnline() {
|
|
3232
3232
|
return navigator.onLine;
|
|
3233
3233
|
}
|
|
@@ -3310,7 +3310,7 @@ async function Ha({ apiURI: t, appId: e }) {
|
|
|
3310
3310
|
})
|
|
3311
3311
|
});
|
|
3312
3312
|
}
|
|
3313
|
-
async function
|
|
3313
|
+
async function Rr({ apiURI: t, appId: e, code: n, codeVerifier: r, refreshToken: s }) {
|
|
3314
3314
|
return await ue(`${t}/runtime/oauth/token`, {
|
|
3315
3315
|
method: "POST",
|
|
3316
3316
|
headers: { "content-type": "application/json" },
|
|
@@ -3403,9 +3403,9 @@ async function nc({ apiURI: t, appId: e, path: n, refreshToken: r }) {
|
|
|
3403
3403
|
});
|
|
3404
3404
|
return s;
|
|
3405
3405
|
}
|
|
3406
|
-
let
|
|
3407
|
-
typeof window < "u" && typeof window.localStorage < "u" && (
|
|
3408
|
-
function
|
|
3406
|
+
let Wn = !1, js = !1, xs = !1;
|
|
3407
|
+
typeof window < "u" && typeof window.localStorage < "u" && (Wn = !!window.localStorage.getItem("devBackend"), js = !!window.localStorage.getItem("__instantLogging"), xs = !!window.localStorage.getItem("__devtoolLocalDash"));
|
|
3408
|
+
function jr(t, e) {
|
|
3409
3409
|
if (!e)
|
|
3410
3410
|
return t;
|
|
3411
3411
|
const n = {};
|
|
@@ -3418,23 +3418,23 @@ function rc(t, e, n) {
|
|
|
3418
3418
|
peers: {}
|
|
3419
3419
|
};
|
|
3420
3420
|
if (e && "user" in e ? e.user : !0) {
|
|
3421
|
-
const i =
|
|
3421
|
+
const i = jr(t.user ?? {}, e == null ? void 0 : e.keys);
|
|
3422
3422
|
r.user = { ...i, peerId: n };
|
|
3423
3423
|
}
|
|
3424
3424
|
for (const i of Object.keys(t.peers ?? {})) {
|
|
3425
3425
|
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
3426
|
if (o || a) {
|
|
3427
|
-
const c =
|
|
3427
|
+
const c = jr(t.peers[i], e == null ? void 0 : e.keys);
|
|
3428
3428
|
r.peers[i] = { ...c, peerId: i };
|
|
3429
3429
|
}
|
|
3430
3430
|
}
|
|
3431
3431
|
return r;
|
|
3432
3432
|
}
|
|
3433
3433
|
function sc(t, e) {
|
|
3434
|
-
if (t.isLoading !== e.isLoading || t.error !== e.error || (t.user || e.user) && (!t.user || !e.user || !
|
|
3434
|
+
if (t.isLoading !== e.isLoading || t.error !== e.error || (t.user || e.user) && (!t.user || !e.user || !gr(t.user, e.user)) || !ls(t.peers, e.peers))
|
|
3435
3435
|
return !0;
|
|
3436
3436
|
for (const r of Object.keys(t.peers))
|
|
3437
|
-
if (!
|
|
3437
|
+
if (!gr(t.peers[r], e.peers[r]))
|
|
3438
3438
|
return !0;
|
|
3439
3439
|
return !1;
|
|
3440
3440
|
}
|
|
@@ -3481,7 +3481,7 @@ function Dr(t) {
|
|
|
3481
3481
|
}, e;
|
|
3482
3482
|
}, {});
|
|
3483
3483
|
}
|
|
3484
|
-
const
|
|
3484
|
+
const qn = "v0.22.119-experimental.streams.21539576498.1";
|
|
3485
3485
|
function ic(t, e) {
|
|
3486
3486
|
return {
|
|
3487
3487
|
info: t ? (...n) => console.info(...n, e()) : () => {
|
|
@@ -3645,12 +3645,12 @@ const Ur = [
|
|
|
3645
3645
|
throw new x(`Invalid dot notation path '${t}'. Must contain at least one dot.`, s);
|
|
3646
3646
|
let o = n;
|
|
3647
3647
|
for (let l = 0; l < i.length - 1; l++) {
|
|
3648
|
-
const f = i[l],
|
|
3649
|
-
if (!
|
|
3648
|
+
const f = i[l], d = r.entities[o];
|
|
3649
|
+
if (!d)
|
|
3650
3650
|
throw new x(`Entity '${o}' does not exist in schema while traversing dot notation path '${t}'.`, s);
|
|
3651
|
-
const y =
|
|
3651
|
+
const y = d.links[f];
|
|
3652
3652
|
if (!y) {
|
|
3653
|
-
const b = Object.keys(
|
|
3653
|
+
const b = Object.keys(d.links);
|
|
3654
3654
|
throw new x(`Link '${f}' does not exist on entity '${o}' in dot notation path '${t}'. Available links: ${b.length > 0 ? b.join(", ") : "none"}`, s);
|
|
3655
3655
|
}
|
|
3656
3656
|
o = y.entityName;
|
|
@@ -3769,7 +3769,7 @@ const Ur = [
|
|
|
3769
3769
|
Ls(n[r], r, e, r, 0);
|
|
3770
3770
|
}
|
|
3771
3771
|
}
|
|
3772
|
-
}, Fr = (t) => typeof t != "string" ? !1 :
|
|
3772
|
+
}, Fr = (t) => typeof t != "string" ? !1 : Pt(t) ? !0 : Le(t);
|
|
3773
3773
|
class se extends Error {
|
|
3774
3774
|
constructor(e) {
|
|
3775
3775
|
super(e), this.name = "TransactionValidationError";
|
|
@@ -3994,7 +3994,7 @@ function bc(t, e) {
|
|
|
3994
3994
|
}
|
|
3995
3995
|
return t;
|
|
3996
3996
|
}
|
|
3997
|
-
function
|
|
3997
|
+
function _c(t, e) {
|
|
3998
3998
|
var n;
|
|
3999
3999
|
if (e.values) {
|
|
4000
4000
|
const r = [];
|
|
@@ -4009,7 +4009,7 @@ function gc(t, e) {
|
|
|
4009
4009
|
} else
|
|
4010
4010
|
return e;
|
|
4011
4011
|
}
|
|
4012
|
-
function
|
|
4012
|
+
function gc(t, e, n) {
|
|
4013
4013
|
var i, o;
|
|
4014
4014
|
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
4015
|
return r && (!s || r > s) ? e : s && (!r || s > r) ? n : e || n;
|
|
@@ -4017,22 +4017,22 @@ function _c(t, e, n) {
|
|
|
4017
4017
|
function Yt(t, e, n) {
|
|
4018
4018
|
return Cs({ store: e, attrsStore: n, pageInfo: null, aggregate: null }, t.query).data[t.table][0];
|
|
4019
4019
|
}
|
|
4020
|
-
function
|
|
4020
|
+
function Wr(t, e, n, r) {
|
|
4021
4021
|
var o;
|
|
4022
|
-
const s = (o =
|
|
4022
|
+
const s = (o = K(n, t.table, "id")) == null ? void 0 : o.id;
|
|
4023
4023
|
if (!s)
|
|
4024
4024
|
return -1;
|
|
4025
4025
|
const i = Ke(e.eav, [r, s, r]);
|
|
4026
4026
|
return i ? i[3] : -1;
|
|
4027
4027
|
}
|
|
4028
|
-
function
|
|
4028
|
+
function qr(t, e, n) {
|
|
4029
4029
|
for (const { action: r, triple: s } of n)
|
|
4030
4030
|
switch (r) {
|
|
4031
4031
|
case "added":
|
|
4032
4032
|
ws(t, e, s);
|
|
4033
4033
|
break;
|
|
4034
4034
|
case "removed":
|
|
4035
|
-
|
|
4035
|
+
_s(t, e, s);
|
|
4036
4036
|
break;
|
|
4037
4037
|
}
|
|
4038
4038
|
}
|
|
@@ -4043,9 +4043,9 @@ function wc(t, e, n) {
|
|
|
4043
4043
|
const [c, u, l] = a, f = (i = (s = e.getAttr(u)) == null ? void 0 : s["forward-identity"]) == null ? void 0 : i[2];
|
|
4044
4044
|
if (!f)
|
|
4045
4045
|
continue;
|
|
4046
|
-
const
|
|
4047
|
-
r[c] =
|
|
4048
|
-
const y =
|
|
4046
|
+
const d = r[c] ?? {};
|
|
4047
|
+
r[c] = d;
|
|
4048
|
+
const y = d[f] ?? {};
|
|
4049
4049
|
switch (o) {
|
|
4050
4050
|
case "added":
|
|
4051
4051
|
y.newValue = l;
|
|
@@ -4054,7 +4054,7 @@ function wc(t, e, n) {
|
|
|
4054
4054
|
y.oldValue === void 0 && (y.oldValue = l);
|
|
4055
4055
|
break;
|
|
4056
4056
|
}
|
|
4057
|
-
|
|
4057
|
+
d[f] = y;
|
|
4058
4058
|
}
|
|
4059
4059
|
for (const [o, a] of Object.entries(r))
|
|
4060
4060
|
for (const [c, { oldValue: u, newValue: l }] of Object.entries(a))
|
|
@@ -4064,14 +4064,14 @@ function wc(t, e, n) {
|
|
|
4064
4064
|
function bt(t, e) {
|
|
4065
4065
|
return { [t.table]: e.map((n) => n.entity) };
|
|
4066
4066
|
}
|
|
4067
|
-
function
|
|
4067
|
+
function mc(t, e) {
|
|
4068
4068
|
var r;
|
|
4069
4069
|
if (t.orderFieldType)
|
|
4070
4070
|
return t.orderFieldType;
|
|
4071
|
-
const n = t.orderField === "serverCreatedAt" ? "number" : (r =
|
|
4071
|
+
const n = t.orderField === "serverCreatedAt" ? "number" : (r = K(e(), t.table, t.orderField)) == null ? void 0 : r["checked-data-type"];
|
|
4072
4072
|
return t.orderFieldType = n, n;
|
|
4073
4073
|
}
|
|
4074
|
-
function
|
|
4074
|
+
function Tc(t, e, n) {
|
|
4075
4075
|
const r = e;
|
|
4076
4076
|
if (t.orderField === "serverCreatedAt") {
|
|
4077
4077
|
n.sort(t.orderDirection === "asc" ? function(o, a) {
|
|
@@ -4088,10 +4088,10 @@ function mc(t, e, n) {
|
|
|
4088
4088
|
return Ye(a.entity.id, a.entity[s], o.entity.id, o.entity[s], r);
|
|
4089
4089
|
});
|
|
4090
4090
|
}
|
|
4091
|
-
var
|
|
4091
|
+
var me;
|
|
4092
4092
|
(function(t) {
|
|
4093
4093
|
t.InitialSyncBatch = "InitialSyncBatch", t.InitialSyncComplete = "InitialSyncComplete", t.LoadFromStorage = "LoadFromStorage", t.SyncTransaction = "SyncTransaction", t.Error = "Error";
|
|
4094
|
-
})(
|
|
4094
|
+
})(me || (me = {}));
|
|
4095
4095
|
class Sc {
|
|
4096
4096
|
constructor(e, n, r, s, i, o) {
|
|
4097
4097
|
p(this, "trySend");
|
|
@@ -4103,10 +4103,10 @@ class Sc {
|
|
|
4103
4103
|
p(this, "log");
|
|
4104
4104
|
p(this, "createStore");
|
|
4105
4105
|
p(this, "getAttrs");
|
|
4106
|
-
this.trySend = e, this.config = r, this.log = s, this.createStore = i, this.getAttrs = o, this.subs = new
|
|
4106
|
+
this.trySend = e, this.config = r, this.log = s, this.createStore = i, this.getAttrs = o, this.subs = new gn({
|
|
4107
4107
|
persister: n,
|
|
4108
|
-
merge:
|
|
4109
|
-
serialize:
|
|
4108
|
+
merge: gc,
|
|
4109
|
+
serialize: _c,
|
|
4110
4110
|
parse: (a, c) => bc(c, this.config.useDateObjects),
|
|
4111
4111
|
objectSize: (a) => {
|
|
4112
4112
|
var c;
|
|
@@ -4143,7 +4143,7 @@ class Sc {
|
|
|
4143
4143
|
}
|
|
4144
4144
|
}
|
|
4145
4145
|
sendStart(e) {
|
|
4146
|
-
this.trySend(
|
|
4146
|
+
this.trySend(L(), {
|
|
4147
4147
|
op: "start-sync",
|
|
4148
4148
|
q: e
|
|
4149
4149
|
});
|
|
@@ -4157,24 +4157,24 @@ class Sc {
|
|
|
4157
4157
|
});
|
|
4158
4158
|
}
|
|
4159
4159
|
sendRemove(e, n) {
|
|
4160
|
-
this.trySend(
|
|
4160
|
+
this.trySend(L(), {
|
|
4161
4161
|
op: "remove-sync",
|
|
4162
4162
|
"subscription-id": e.subscriptionId,
|
|
4163
4163
|
"keep-subscription": n
|
|
4164
4164
|
});
|
|
4165
4165
|
}
|
|
4166
4166
|
async initSubscription(e, n, r) {
|
|
4167
|
-
var u, l, f,
|
|
4167
|
+
var u, l, f, d;
|
|
4168
4168
|
await this.subs.waitForKeyToLoad(n);
|
|
4169
4169
|
const s = this.subs.currentValue[n];
|
|
4170
4170
|
if (s && s.state && s.state.txId) {
|
|
4171
4171
|
this.sendResync(s, s.state, s.state.txId), (u = s.values) != null && u.entities && r && r({
|
|
4172
|
-
type:
|
|
4172
|
+
type: me.LoadFromStorage,
|
|
4173
4173
|
data: bt(s, (l = s.values) == null ? void 0 : l.entities)
|
|
4174
4174
|
});
|
|
4175
4175
|
return;
|
|
4176
4176
|
}
|
|
4177
|
-
const i = Object.keys(e)[0], o = ((
|
|
4177
|
+
const i = Object.keys(e)[0], o = ((d = (f = e[i]) == null ? void 0 : f.$) == null ? void 0 : d.order) || { serverCreatedAt: "asc" }, [a, c] = Object.entries(o)[0];
|
|
4178
4178
|
this.subs.updateInPlace((y) => {
|
|
4179
4179
|
y[n] = {
|
|
4180
4180
|
query: e,
|
|
@@ -4232,13 +4232,13 @@ class Sc {
|
|
|
4232
4232
|
c.push({
|
|
4233
4233
|
store: l,
|
|
4234
4234
|
entity: f,
|
|
4235
|
-
serverCreatedAt:
|
|
4235
|
+
serverCreatedAt: Wr(o, l, a.attrsStore, f.id)
|
|
4236
4236
|
}), i.push(f);
|
|
4237
4237
|
}
|
|
4238
4238
|
this.subs.updateInPlace((u) => {
|
|
4239
4239
|
u[s] = o, u[s].updatedAt = Date.now();
|
|
4240
4240
|
}), o.values && this.notifyCbs(s, {
|
|
4241
|
-
type:
|
|
4241
|
+
type: me.InitialSyncBatch,
|
|
4242
4242
|
data: bt(o, o.values.entities),
|
|
4243
4243
|
batch: i
|
|
4244
4244
|
});
|
|
@@ -4263,7 +4263,7 @@ class Sc {
|
|
|
4263
4263
|
});
|
|
4264
4264
|
const s = this.subs.currentValue[r];
|
|
4265
4265
|
s && this.notifyCbs(r, {
|
|
4266
|
-
type:
|
|
4266
|
+
type: me.InitialSyncComplete,
|
|
4267
4267
|
data: bt(s, ((i = s.values) == null ? void 0 : i.entities) || [])
|
|
4268
4268
|
});
|
|
4269
4269
|
}
|
|
@@ -4290,58 +4290,58 @@ class Sc {
|
|
|
4290
4290
|
i.txId = a["tx-id"];
|
|
4291
4291
|
const c = [], u = {};
|
|
4292
4292
|
for (const w of a.changes) {
|
|
4293
|
-
const
|
|
4294
|
-
u[w.triple[0]] =
|
|
4293
|
+
const T = u[w.triple[0]] ?? [];
|
|
4294
|
+
u[w.triple[0]] = T, T.push(w);
|
|
4295
4295
|
}
|
|
4296
4296
|
const l = s.values ?? {
|
|
4297
4297
|
entities: [],
|
|
4298
4298
|
attrsStore: this.getAttrs()
|
|
4299
4299
|
}, f = l.entities;
|
|
4300
4300
|
s.values = l;
|
|
4301
|
-
const
|
|
4302
|
-
e: for (const [w,
|
|
4303
|
-
for (let
|
|
4304
|
-
const S = f[
|
|
4301
|
+
const d = [];
|
|
4302
|
+
e: for (const [w, T] of Object.entries(u))
|
|
4303
|
+
for (let g = 0; g < f.length; g++) {
|
|
4304
|
+
const S = f[g];
|
|
4305
4305
|
if (eo(S.store, w)) {
|
|
4306
|
-
|
|
4307
|
-
const O = Yt(s, S.store, l.attrsStore), E = wc(S.store, l.attrsStore,
|
|
4308
|
-
O ? (
|
|
4306
|
+
qr(S.store, l.attrsStore, T);
|
|
4307
|
+
const O = Yt(s, S.store, l.attrsStore), E = wc(S.store, l.attrsStore, T)[w];
|
|
4308
|
+
O ? (d.push({
|
|
4309
4309
|
oldEntity: S.entity,
|
|
4310
4310
|
newEntity: O,
|
|
4311
4311
|
changedFields: E || {}
|
|
4312
|
-
}), S.entity = O) : c.push(
|
|
4312
|
+
}), S.entity = O) : c.push(g), delete u[w];
|
|
4313
4313
|
continue e;
|
|
4314
4314
|
}
|
|
4315
4315
|
}
|
|
4316
4316
|
const y = [];
|
|
4317
|
-
for (const [w,
|
|
4318
|
-
const
|
|
4319
|
-
|
|
4320
|
-
const S = Yt(s,
|
|
4317
|
+
for (const [w, T] of Object.entries(u)) {
|
|
4318
|
+
const g = this.createStore([]);
|
|
4319
|
+
qr(g, l.attrsStore, T);
|
|
4320
|
+
const S = Yt(s, g, l.attrsStore);
|
|
4321
4321
|
if (!S) {
|
|
4322
4322
|
this.log.error("No entity found after applying change", {
|
|
4323
4323
|
sub: s,
|
|
4324
|
-
changes:
|
|
4325
|
-
store:
|
|
4324
|
+
changes: T,
|
|
4325
|
+
store: g
|
|
4326
4326
|
});
|
|
4327
4327
|
continue;
|
|
4328
4328
|
}
|
|
4329
4329
|
f.push({
|
|
4330
|
-
store:
|
|
4330
|
+
store: g,
|
|
4331
4331
|
entity: S,
|
|
4332
|
-
serverCreatedAt:
|
|
4332
|
+
serverCreatedAt: Wr(s, g, l.attrsStore, S.id)
|
|
4333
4333
|
}), y.push(S);
|
|
4334
4334
|
}
|
|
4335
4335
|
const b = [];
|
|
4336
4336
|
for (const w of c.sort().reverse())
|
|
4337
4337
|
b.push(f[w].entity), f.splice(w, 1);
|
|
4338
|
-
const
|
|
4339
|
-
|
|
4340
|
-
type:
|
|
4338
|
+
const _ = mc(s, this.getAttrs);
|
|
4339
|
+
Tc(s, _, f), this.notifyCbs(r, {
|
|
4340
|
+
type: me.SyncTransaction,
|
|
4341
4341
|
data: bt(s, (o = s.values) == null ? void 0 : o.entities),
|
|
4342
4342
|
added: y,
|
|
4343
4343
|
removed: b,
|
|
4344
|
-
updated:
|
|
4344
|
+
updated: d
|
|
4345
4345
|
});
|
|
4346
4346
|
}
|
|
4347
4347
|
this.subs.updateInPlace((a) => {
|
|
@@ -4367,7 +4367,7 @@ class Sc {
|
|
|
4367
4367
|
hint: e.hint
|
|
4368
4368
|
}, s = Object.keys(e["original-event"].q)[0];
|
|
4369
4369
|
this.notifyCbs(n, {
|
|
4370
|
-
type:
|
|
4370
|
+
type: me.Error,
|
|
4371
4371
|
data: { [s]: [] },
|
|
4372
4372
|
error: r
|
|
4373
4373
|
});
|
|
@@ -4377,17 +4377,188 @@ class Sc {
|
|
|
4377
4377
|
r && this.initSubscription(r.query, r.hash);
|
|
4378
4378
|
}
|
|
4379
4379
|
}
|
|
4380
|
+
function vc({ WStream: t, opts: e, startStream: n, appendStream: r }) {
|
|
4381
|
+
let s = null, i = null, o = 0, a = 0;
|
|
4382
|
+
const c = new TextEncoder();
|
|
4383
|
+
function u(l) {
|
|
4384
|
+
return s || l.error("Stream has not been initialized."), s;
|
|
4385
|
+
}
|
|
4386
|
+
return new t({
|
|
4387
|
+
// We could make this a little more resilient to network interrupts
|
|
4388
|
+
// Maybe we should put the segments into storage?
|
|
4389
|
+
async start(l) {
|
|
4390
|
+
try {
|
|
4391
|
+
const { streamId: f, reconnectToken: d } = await n(e);
|
|
4392
|
+
s = f, i = d;
|
|
4393
|
+
} catch (f) {
|
|
4394
|
+
l.error(f.message);
|
|
4395
|
+
}
|
|
4396
|
+
},
|
|
4397
|
+
write(l, f) {
|
|
4398
|
+
const d = u(f);
|
|
4399
|
+
if (d) {
|
|
4400
|
+
const y = c.encode(l).length, b = o + a;
|
|
4401
|
+
a += y, r({ streamId: d, chunks: [l], offset: b });
|
|
4402
|
+
}
|
|
4403
|
+
},
|
|
4404
|
+
close() {
|
|
4405
|
+
s && r({
|
|
4406
|
+
streamId: s,
|
|
4407
|
+
chunks: [],
|
|
4408
|
+
offset: o + a,
|
|
4409
|
+
isDone: !0
|
|
4410
|
+
});
|
|
4411
|
+
},
|
|
4412
|
+
abort(l) {
|
|
4413
|
+
console.log("abort", l), s && r({
|
|
4414
|
+
streamId: s,
|
|
4415
|
+
chunks: [],
|
|
4416
|
+
offset: o + a,
|
|
4417
|
+
isDone: !0,
|
|
4418
|
+
abortReason: l
|
|
4419
|
+
});
|
|
4420
|
+
}
|
|
4421
|
+
});
|
|
4422
|
+
}
|
|
4423
|
+
class Ec {
|
|
4424
|
+
constructor() {
|
|
4425
|
+
p(this, "items", []);
|
|
4426
|
+
p(this, "resolvers", []);
|
|
4427
|
+
p(this, "isClosed", !1);
|
|
4428
|
+
}
|
|
4429
|
+
push(e) {
|
|
4430
|
+
if (this.isClosed)
|
|
4431
|
+
return;
|
|
4432
|
+
const n = this.resolvers.shift();
|
|
4433
|
+
n ? n({ value: e, done: !1 }) : this.items.push(e);
|
|
4434
|
+
}
|
|
4435
|
+
close() {
|
|
4436
|
+
for (this.isClosed = !0; this.resolvers.length > 0; )
|
|
4437
|
+
this.resolvers.shift()({ value: void 0, done: !0 });
|
|
4438
|
+
}
|
|
4439
|
+
async *[Symbol.asyncIterator]() {
|
|
4440
|
+
for (; ; )
|
|
4441
|
+
if (this.items.length > 0)
|
|
4442
|
+
yield this.items.shift();
|
|
4443
|
+
else {
|
|
4444
|
+
if (this.isClosed)
|
|
4445
|
+
return;
|
|
4446
|
+
{
|
|
4447
|
+
const { value: e, done: n } = await new Promise((r) => {
|
|
4448
|
+
this.resolvers.push(r);
|
|
4449
|
+
});
|
|
4450
|
+
if (n || !e)
|
|
4451
|
+
return;
|
|
4452
|
+
yield e;
|
|
4453
|
+
}
|
|
4454
|
+
}
|
|
4455
|
+
}
|
|
4456
|
+
}
|
|
4457
|
+
function Oc({ RStream: t, opts: e, startStream: n }) {
|
|
4458
|
+
const r = new TextDecoder("utf-8");
|
|
4459
|
+
async function s(i) {
|
|
4460
|
+
for await (const o of n(e)) {
|
|
4461
|
+
if (o.files)
|
|
4462
|
+
for (const a of o.files) {
|
|
4463
|
+
const c = await fetch(a.url);
|
|
4464
|
+
if (c.body)
|
|
4465
|
+
for await (const u of c.body) {
|
|
4466
|
+
const l = r.decode(u);
|
|
4467
|
+
i.enqueue(l);
|
|
4468
|
+
}
|
|
4469
|
+
}
|
|
4470
|
+
o.content && i.enqueue(o.content);
|
|
4471
|
+
}
|
|
4472
|
+
i.close();
|
|
4473
|
+
}
|
|
4474
|
+
return new t({
|
|
4475
|
+
start(i) {
|
|
4476
|
+
s(i);
|
|
4477
|
+
}
|
|
4478
|
+
});
|
|
4479
|
+
}
|
|
4480
|
+
class Ac {
|
|
4481
|
+
constructor({ WStream: e, RStream: n, trySend: r, log: s }) {
|
|
4482
|
+
p(this, "trySend");
|
|
4483
|
+
p(this, "WStream");
|
|
4484
|
+
p(this, "RStream");
|
|
4485
|
+
p(this, "startStreamCbs", {});
|
|
4486
|
+
p(this, "readStreamIterators", {});
|
|
4487
|
+
p(this, "log");
|
|
4488
|
+
this.WStream = e, this.RStream = n, this.trySend = r, this.log = s;
|
|
4489
|
+
}
|
|
4490
|
+
createWriteStream(e) {
|
|
4491
|
+
return vc({
|
|
4492
|
+
WStream: this.WStream,
|
|
4493
|
+
startStream: this.startWriteStream.bind(this),
|
|
4494
|
+
appendStream: this.appendStream.bind(this),
|
|
4495
|
+
opts: e
|
|
4496
|
+
});
|
|
4497
|
+
}
|
|
4498
|
+
createReadStream(e) {
|
|
4499
|
+
return Oc({
|
|
4500
|
+
RStream: this.RStream,
|
|
4501
|
+
opts: e,
|
|
4502
|
+
startStream: this.startReadStream.bind(this)
|
|
4503
|
+
});
|
|
4504
|
+
}
|
|
4505
|
+
startWriteStream(e) {
|
|
4506
|
+
const n = L();
|
|
4507
|
+
let r = null;
|
|
4508
|
+
const s = new Promise((o) => {
|
|
4509
|
+
r = o;
|
|
4510
|
+
});
|
|
4511
|
+
this.startStreamCbs[n] = r;
|
|
4512
|
+
const i = { op: "create-stream" };
|
|
4513
|
+
return e != null && e.clientId && (i["client-id"] = e.clientId), this.trySend(n, i), s;
|
|
4514
|
+
}
|
|
4515
|
+
appendStream({ streamId: e, chunks: n, isDone: r, offset: s, abortReason: i }) {
|
|
4516
|
+
const o = {
|
|
4517
|
+
op: "append-stream",
|
|
4518
|
+
"stream-id": e,
|
|
4519
|
+
chunks: n,
|
|
4520
|
+
offset: s,
|
|
4521
|
+
done: !!r
|
|
4522
|
+
};
|
|
4523
|
+
i && (o["abort-reason"] = i), this.trySend(L(), o);
|
|
4524
|
+
}
|
|
4525
|
+
onCreateStreamOk(e) {
|
|
4526
|
+
const n = this.startStreamCbs[e["client-event-id"]];
|
|
4527
|
+
if (!n) {
|
|
4528
|
+
this.log.info("No stream for start-stream-ok", e);
|
|
4529
|
+
return;
|
|
4530
|
+
}
|
|
4531
|
+
n({ streamId: e["stream-id"], reconnectToken: e["reconnect-token"] });
|
|
4532
|
+
}
|
|
4533
|
+
// XXX: Need some kind of flow control...
|
|
4534
|
+
startReadStream({ clientId: e, streamId: n }) {
|
|
4535
|
+
const r = { op: "subscribe-stream" };
|
|
4536
|
+
if (!n && !e)
|
|
4537
|
+
throw new Error("Must provide one of streamId or clientId to subscribe to the stream.");
|
|
4538
|
+
n && (r["stream-id"] = n), e && (r["client-id"] = e);
|
|
4539
|
+
const s = new Ec(), i = L();
|
|
4540
|
+
return this.readStreamIterators[i] = s, this.trySend(i, r), s;
|
|
4541
|
+
}
|
|
4542
|
+
onStreamAppend(e) {
|
|
4543
|
+
const n = e["client-event-id"], r = this.readStreamIterators[n];
|
|
4544
|
+
if (!r) {
|
|
4545
|
+
this.log.info("No iterator for read stream", e);
|
|
4546
|
+
return;
|
|
4547
|
+
}
|
|
4548
|
+
e.error || (e.files && r.push({ offset: e.offset, files: e.files }), e.content && r.push({ offset: e.offset, content: e.content }), e.done && r.close());
|
|
4549
|
+
}
|
|
4550
|
+
}
|
|
4380
4551
|
const de = {
|
|
4381
4552
|
CONNECTING: "connecting",
|
|
4382
4553
|
OPENED: "opened",
|
|
4383
4554
|
AUTHENTICATED: "authenticated",
|
|
4384
4555
|
CLOSED: "closed",
|
|
4385
4556
|
ERRORED: "errored"
|
|
4386
|
-
},
|
|
4557
|
+
}, kc = 3e4, Cc = 3e4, Ic = 200, Pc = 1e3 * 60, Mc = {
|
|
4387
4558
|
apiURI: "https://api.instantdb.com",
|
|
4388
4559
|
websocketURI: "wss://api.instantdb.com/runtime/session"
|
|
4389
4560
|
}, Zt = "_instant_oauth_redirect", Ve = "currentUser";
|
|
4390
|
-
function
|
|
4561
|
+
function Rc({ transportType: t, appId: e, apiURI: n, wsURI: r, EventSourceImpl: s }) {
|
|
4391
4562
|
if (!s)
|
|
4392
4563
|
return new Kr(`${r}?app_id=${e}`);
|
|
4393
4564
|
switch (t) {
|
|
@@ -4399,7 +4570,7 @@ function Cc({ transportType: t, appId: e, apiURI: n, wsURI: r, EventSourceImpl:
|
|
|
4399
4570
|
throw new Error("Unknown transport type " + t);
|
|
4400
4571
|
}
|
|
4401
4572
|
}
|
|
4402
|
-
function
|
|
4573
|
+
function jc() {
|
|
4403
4574
|
return typeof window < "u" || typeof chrome < "u";
|
|
4404
4575
|
}
|
|
4405
4576
|
const zr = {
|
|
@@ -4408,7 +4579,7 @@ const zr = {
|
|
|
4408
4579
|
"refresh-presence": !0,
|
|
4409
4580
|
"patch-presence": !0
|
|
4410
4581
|
};
|
|
4411
|
-
function
|
|
4582
|
+
function xc(t, e) {
|
|
4412
4583
|
var r;
|
|
4413
4584
|
const n = typeof t == "string" ? JSON.parse(t) : t;
|
|
4414
4585
|
if ((r = n == null ? void 0 : n.result) != null && r.store) {
|
|
@@ -4423,7 +4594,7 @@ function Ic(t, e) {
|
|
|
4423
4594
|
}
|
|
4424
4595
|
return n;
|
|
4425
4596
|
}
|
|
4426
|
-
function
|
|
4597
|
+
function $c(t, e) {
|
|
4427
4598
|
const { result: n, ...r } = e, s = (
|
|
4428
4599
|
/** @type {import('./reactorTypes.ts').QuerySubInStorage} */
|
|
4429
4600
|
r
|
|
@@ -4438,7 +4609,7 @@ function Mc(t, e) {
|
|
|
4438
4609
|
}
|
|
4439
4610
|
return s;
|
|
4440
4611
|
}
|
|
4441
|
-
function
|
|
4612
|
+
function Dc(t, e) {
|
|
4442
4613
|
switch (t) {
|
|
4443
4614
|
case "pendingMutations":
|
|
4444
4615
|
return new Map(typeof e == "string" ? JSON.parse(e) : e);
|
|
@@ -4446,7 +4617,7 @@ function jc(t, e) {
|
|
|
4446
4617
|
return e;
|
|
4447
4618
|
}
|
|
4448
4619
|
}
|
|
4449
|
-
function
|
|
4620
|
+
function Uc(t, e) {
|
|
4450
4621
|
switch (t) {
|
|
4451
4622
|
case "pendingMutations":
|
|
4452
4623
|
return [...e.entries()];
|
|
@@ -4454,7 +4625,7 @@ function Rc(t, e) {
|
|
|
4454
4625
|
return e;
|
|
4455
4626
|
}
|
|
4456
4627
|
}
|
|
4457
|
-
function
|
|
4628
|
+
function Lc(t, e, n) {
|
|
4458
4629
|
const r = e == null ? void 0 : e.result, s = n == null ? void 0 : n.result;
|
|
4459
4630
|
return r && !s && n && (n.result = r), n || e;
|
|
4460
4631
|
}
|
|
@@ -4464,8 +4635,8 @@ function Xt(t) {
|
|
|
4464
4635
|
return a == c ? r < i ? -1 : r > i ? 1 : 0 : a - c;
|
|
4465
4636
|
});
|
|
4466
4637
|
}
|
|
4467
|
-
class
|
|
4468
|
-
constructor(e, n = Ms, r =
|
|
4638
|
+
class Fc {
|
|
4639
|
+
constructor(e, n = Ms, r = Rs, s, i) {
|
|
4469
4640
|
/** @type {s.AttrsStore | undefined} */
|
|
4470
4641
|
p(this, "attrs");
|
|
4471
4642
|
p(this, "_isOnline", !0);
|
|
@@ -4477,6 +4648,8 @@ class $c {
|
|
|
4477
4648
|
p(this, "kv");
|
|
4478
4649
|
/** @type {SyncTable} */
|
|
4479
4650
|
p(this, "_syncTable");
|
|
4651
|
+
/** @type {InstantStream} */
|
|
4652
|
+
p(this, "_instantStream");
|
|
4480
4653
|
/** @type {Record<string, Array<{ q: any, cb: (data: any) => any }>>} */
|
|
4481
4654
|
p(this, "queryCbs", {});
|
|
4482
4655
|
/** @type {Record<string, Array<{ q: any, eventId: string, dfd: Deferred }>>} */
|
|
@@ -4545,7 +4718,7 @@ class $c {
|
|
|
4545
4718
|
p(this, "notifyOne", (e) => {
|
|
4546
4719
|
var i;
|
|
4547
4720
|
const n = this.queryCbs[e] ?? [], r = (i = this._dataForQueryCache[e]) == null ? void 0 : i.data, s = this.dataForQuery(e);
|
|
4548
|
-
s != null && s.data && (this._dataForQueryCache[e] = s, !
|
|
4721
|
+
s != null && s.data && (this._dataForQueryCache[e] = s, !Tt(s.data, r) && n.forEach((o) => o.cb(s.data)));
|
|
4549
4722
|
});
|
|
4550
4723
|
p(this, "notifyOneQueryOnce", (e) => {
|
|
4551
4724
|
var s;
|
|
@@ -4581,7 +4754,7 @@ class $c {
|
|
|
4581
4754
|
* @returns
|
|
4582
4755
|
*/
|
|
4583
4756
|
p(this, "pushOps", (e, n) => {
|
|
4584
|
-
const r =
|
|
4757
|
+
const r = L(), s = [...this._pendingMutations().values()], i = Math.max(0, ...s.map((c) => c.order || 0)) + 1, o = {
|
|
4585
4758
|
op: "transact",
|
|
4586
4759
|
"tx-steps": e,
|
|
4587
4760
|
created: Date.now(),
|
|
@@ -4602,7 +4775,7 @@ class $c {
|
|
|
4602
4775
|
}
|
|
4603
4776
|
this._log.info("[socket][open]", this._transport.id), this._setStatus(de.OPENED), this.getCurrentUser().then((r) => {
|
|
4604
4777
|
var s;
|
|
4605
|
-
this._trySend(
|
|
4778
|
+
this._trySend(L(), {
|
|
4606
4779
|
op: "init",
|
|
4607
4780
|
"app-id": this.config.appId,
|
|
4608
4781
|
"refresh-token": (s = r.user) == null ? void 0 : s.refresh_token,
|
|
@@ -4662,7 +4835,7 @@ class $c {
|
|
|
4662
4835
|
}
|
|
4663
4836
|
this._log.info("[socket][close]", n.id, "schedule reconnect, ms =", this._reconnectTimeoutMs), this._scheduleReconnect();
|
|
4664
4837
|
});
|
|
4665
|
-
if (this._EventSource = i, this.config = { ...
|
|
4838
|
+
if (this._EventSource = i, this.config = { ...Mc, ...e }, this.queryCacheLimit = this.config.queryCacheLimit ?? 10, this._pendingTxCleanupTimeout = this.config.pendingTxCleanupTimeout ?? Cc, this._pendingMutationCleanupThreshold = this.config.pendingMutationCleanupThreshold ?? Ic, this._log = ic(e.verbose || Wn || js, () => this._reactorStats()), this.versions = { ...s || {}, "@instantdb/core": qn }, this.config.schema && (this._linkIndex = Dr(this.config.schema)), !!jc()) {
|
|
4666
4839
|
if (!e.appId)
|
|
4667
4840
|
throw new Error("Instant must be initialized with an appId.");
|
|
4668
4841
|
if (!Le(e.appId))
|
|
@@ -4679,12 +4852,19 @@ class $c {
|
|
|
4679
4852
|
}
|
|
4680
4853
|
})), this._initStorage(n), this._syncTable = new Sc(this._trySendAuthed.bind(this), new n(this.config.appId, "syncSubs"), {
|
|
4681
4854
|
useDateObjects: this.config.useDateObjects
|
|
4682
|
-
}, this._log, (o) => Je(this.ensureAttrs(), o, this.config.enableCardinalityInference, this.config.useDateObjects), () => this.ensureAttrs()), this.
|
|
4855
|
+
}, this._log, (o) => Je(this.ensureAttrs(), o, this.config.enableCardinalityInference, this.config.useDateObjects), () => this.ensureAttrs()), this._instantStream = new Ac({
|
|
4856
|
+
WStream: WritableStream,
|
|
4857
|
+
// XXX: needs to be passed in from above
|
|
4858
|
+
RStream: ReadableStream,
|
|
4859
|
+
// XXX: needs to be passed in from above
|
|
4860
|
+
trySend: this._trySendAuthed.bind(this),
|
|
4861
|
+
log: this._log
|
|
4862
|
+
}), this._oauthCallbackResponse = this._oauthLoginInit(), this.getCurrentUser().then((o) => {
|
|
4683
4863
|
this.syncUserToEndpoint(o.user);
|
|
4684
4864
|
}), setInterval(async () => {
|
|
4685
4865
|
const o = await this.getCurrentUser();
|
|
4686
4866
|
this.syncUserToEndpoint(o.user);
|
|
4687
|
-
},
|
|
4867
|
+
}, Pc), r.getIsOnline().then((o) => {
|
|
4688
4868
|
this._isOnline = o, this._startSocket(), r.listen((a) => {
|
|
4689
4869
|
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
4870
|
});
|
|
@@ -4714,11 +4894,11 @@ class $c {
|
|
|
4714
4894
|
this.kv.waitForKeyToLoad("pendingMutations").then(() => this.notifyOne(e));
|
|
4715
4895
|
}
|
|
4716
4896
|
_initStorage(e) {
|
|
4717
|
-
this.querySubs = new
|
|
4897
|
+
this.querySubs = new gn({
|
|
4718
4898
|
persister: new e(this.config.appId, "querySubs"),
|
|
4719
|
-
merge:
|
|
4720
|
-
serialize:
|
|
4721
|
-
parse: (n, r) =>
|
|
4899
|
+
merge: Lc,
|
|
4900
|
+
serialize: $c,
|
|
4901
|
+
parse: (n, r) => xc(r, this.config.useDateObjects),
|
|
4722
4902
|
// objectSize
|
|
4723
4903
|
objectSize: (n) => {
|
|
4724
4904
|
var r, s, i;
|
|
@@ -4734,11 +4914,11 @@ class $c {
|
|
|
4734
4914
|
maxSize: 1e6
|
|
4735
4915
|
// 1 million triples
|
|
4736
4916
|
}
|
|
4737
|
-
}), this.querySubs.onKeyLoaded = (n) => this._onQuerySubLoaded(n), this.kv = new
|
|
4917
|
+
}), this.querySubs.onKeyLoaded = (n) => this._onQuerySubLoaded(n), this.kv = new gn({
|
|
4738
4918
|
persister: new e(this.config.appId, "kv"),
|
|
4739
4919
|
merge: this._onMergeKv,
|
|
4740
|
-
serialize:
|
|
4741
|
-
parse:
|
|
4920
|
+
serialize: Uc,
|
|
4921
|
+
parse: Dc,
|
|
4742
4922
|
objectSize: () => 0,
|
|
4743
4923
|
logger: this._log,
|
|
4744
4924
|
saveThrottleMs: 100,
|
|
@@ -4820,9 +5000,9 @@ class $c {
|
|
|
4820
5000
|
switch (zr[n.op] || this._log.info("[receive]", e, n.op, n), n.op) {
|
|
4821
5001
|
case "init-ok": {
|
|
4822
5002
|
this._setStatus(de.AUTHENTICATED), this._reconnectTimeoutMs = 0, this._setAttrs(n.attrs), this._flushPendingMessages(), this._sessionId = n["session-id"];
|
|
4823
|
-
for (const
|
|
4824
|
-
const y = (i = (s = this._presence[
|
|
4825
|
-
this._tryJoinRoom(
|
|
5003
|
+
for (const d of Object.keys(this._rooms)) {
|
|
5004
|
+
const y = (i = (s = this._presence[d]) == null ? void 0 : s.result) == null ? void 0 : i.user;
|
|
5005
|
+
this._tryJoinRoom(d, y);
|
|
4826
5006
|
}
|
|
4827
5007
|
break;
|
|
4828
5008
|
}
|
|
@@ -4831,19 +5011,19 @@ class $c {
|
|
|
4831
5011
|
break;
|
|
4832
5012
|
}
|
|
4833
5013
|
case "add-query-ok": {
|
|
4834
|
-
const { q:
|
|
5014
|
+
const { q: d, result: y } = n, b = q(d);
|
|
4835
5015
|
if (!this._hasQueryListeners() && !this.querySubs.currentValue[b])
|
|
4836
5016
|
break;
|
|
4837
|
-
const
|
|
5017
|
+
const _ = (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, T = $r(y), g = this.ensureAttrs(), S = Je(g, T, r, this.config.useDateObjects);
|
|
4838
5018
|
this.querySubs.updateInPlace((O) => {
|
|
4839
5019
|
if (!O[b]) {
|
|
4840
|
-
this._log.info("Missing value in querySubs", { hash: b, q:
|
|
5020
|
+
this._log.info("Missing value in querySubs", { hash: b, q: d });
|
|
4841
5021
|
return;
|
|
4842
5022
|
}
|
|
4843
5023
|
O[b].result = {
|
|
4844
5024
|
store: S,
|
|
4845
|
-
attrsStore:
|
|
4846
|
-
pageInfo:
|
|
5025
|
+
attrsStore: g,
|
|
5026
|
+
pageInfo: _,
|
|
4847
5027
|
aggregate: w,
|
|
4848
5028
|
processedTxId: n["processed-tx-id"]
|
|
4849
5029
|
};
|
|
@@ -4866,97 +5046,105 @@ class $c {
|
|
|
4866
5046
|
this._syncTable.onSyncUpdateTriples(n);
|
|
4867
5047
|
break;
|
|
4868
5048
|
}
|
|
5049
|
+
case "create-stream-ok": {
|
|
5050
|
+
this._instantStream.onCreateStreamOk(n);
|
|
5051
|
+
break;
|
|
5052
|
+
}
|
|
5053
|
+
case "stream-append": {
|
|
5054
|
+
this._instantStream.onStreamAppend(n);
|
|
5055
|
+
break;
|
|
5056
|
+
}
|
|
4869
5057
|
case "refresh-ok": {
|
|
4870
|
-
const { computations:
|
|
5058
|
+
const { computations: d, attrs: y } = n, b = n["processed-tx-id"];
|
|
4871
5059
|
y && this._setAttrs(y), this._cleanupPendingMutationsTimeout();
|
|
4872
|
-
const
|
|
4873
|
-
|
|
4874
|
-
|
|
5060
|
+
const _ = this._rewriteMutations(this.ensureAttrs(), this._pendingMutations(), b);
|
|
5061
|
+
_ !== this._pendingMutations() && this.kv.updateInPlace((g) => {
|
|
5062
|
+
g.pendingMutations = _;
|
|
4875
5063
|
});
|
|
4876
|
-
const w = Xt(
|
|
4877
|
-
var
|
|
4878
|
-
const S =
|
|
5064
|
+
const w = Xt(_.entries()), T = d.map((g) => {
|
|
5065
|
+
var qe, ie, le, be;
|
|
5066
|
+
const S = g["instaql-query"], O = g["instaql-result"], E = q(S), R = $r(O), F = this.ensureAttrs(), B = Je(F, R, r, this.config.useDateObjects), { store: We, attrsStore: ut } = this._applyOptimisticUpdates(B, F, w, b), Ut = (ie = (qe = O == null ? void 0 : O[0]) == null ? void 0 : qe.data) == null ? void 0 : ie["page-info"], Lt = (be = (le = O == null ? void 0 : O[0]) == null ? void 0 : le.data) == null ? void 0 : be.aggregate;
|
|
4879
5067
|
return {
|
|
4880
5068
|
q: S,
|
|
4881
5069
|
hash: E,
|
|
4882
|
-
store:
|
|
5070
|
+
store: We,
|
|
4883
5071
|
attrsStore: ut,
|
|
4884
5072
|
pageInfo: Ut,
|
|
4885
5073
|
aggregate: Lt
|
|
4886
5074
|
};
|
|
4887
5075
|
});
|
|
4888
|
-
|
|
5076
|
+
T.forEach(({ hash: g, q: S, store: O, attrsStore: E, pageInfo: R, aggregate: F }) => {
|
|
4889
5077
|
this.querySubs.updateInPlace((B) => {
|
|
4890
|
-
if (!B[
|
|
4891
|
-
this._log.error("Missing value in querySubs", { hash:
|
|
5078
|
+
if (!B[g]) {
|
|
5079
|
+
this._log.error("Missing value in querySubs", { hash: g, q: S });
|
|
4892
5080
|
return;
|
|
4893
5081
|
}
|
|
4894
|
-
B[
|
|
5082
|
+
B[g].result = {
|
|
4895
5083
|
store: O,
|
|
4896
5084
|
attrsStore: E,
|
|
4897
|
-
pageInfo:
|
|
4898
|
-
aggregate:
|
|
5085
|
+
pageInfo: R,
|
|
5086
|
+
aggregate: F,
|
|
4899
5087
|
processedTxId: b
|
|
4900
5088
|
};
|
|
4901
5089
|
});
|
|
4902
|
-
}), this._cleanupPendingMutationsQueries(),
|
|
4903
|
-
this.notifyOne(
|
|
5090
|
+
}), this._cleanupPendingMutationsQueries(), T.forEach(({ hash: g }) => {
|
|
5091
|
+
this.notifyOne(g);
|
|
4904
5092
|
});
|
|
4905
5093
|
break;
|
|
4906
5094
|
}
|
|
4907
5095
|
case "transact-ok": {
|
|
4908
|
-
const { "client-event-id":
|
|
4909
|
-
this._inFlightMutationEventIds.delete(
|
|
4910
|
-
const
|
|
4911
|
-
if (!
|
|
5096
|
+
const { "client-event-id": d, "tx-id": y } = n;
|
|
5097
|
+
this._inFlightMutationEventIds.delete(d);
|
|
5098
|
+
const _ = this._rewriteMutations(this.ensureAttrs(), this._pendingMutations()).get(d);
|
|
5099
|
+
if (!_)
|
|
4912
5100
|
break;
|
|
4913
|
-
this._updatePendingMutations((
|
|
4914
|
-
|
|
4915
|
-
...
|
|
5101
|
+
this._updatePendingMutations((T) => {
|
|
5102
|
+
T.set(d, {
|
|
5103
|
+
...T.get(d),
|
|
4916
5104
|
"tx-id": y,
|
|
4917
5105
|
confirmed: Date.now()
|
|
4918
5106
|
});
|
|
4919
5107
|
});
|
|
4920
5108
|
const w = [];
|
|
4921
|
-
for (const
|
|
4922
|
-
if (
|
|
4923
|
-
const
|
|
4924
|
-
w.push(
|
|
5109
|
+
for (const T of _["tx-steps"])
|
|
5110
|
+
if (T[0] === "add-attr") {
|
|
5111
|
+
const g = T[1];
|
|
5112
|
+
w.push(g);
|
|
4925
5113
|
}
|
|
4926
5114
|
if (w.length) {
|
|
4927
|
-
const
|
|
4928
|
-
this._setAttrs([...
|
|
5115
|
+
const T = Object.values(this.ensureAttrs().attrs);
|
|
5116
|
+
this._setAttrs([...T, ...w]);
|
|
4929
5117
|
}
|
|
4930
|
-
this._finishTransaction("synced",
|
|
5118
|
+
this._finishTransaction("synced", d), this._cleanupPendingMutationsTimeout();
|
|
4931
5119
|
break;
|
|
4932
5120
|
}
|
|
4933
5121
|
case "patch-presence": {
|
|
4934
|
-
const
|
|
4935
|
-
this._trySetRoomConnected(
|
|
5122
|
+
const d = n["room-id"];
|
|
5123
|
+
this._trySetRoomConnected(d, !0), this._patchPresencePeers(d, n.edits), this._notifyPresenceSubs(d);
|
|
4936
5124
|
break;
|
|
4937
5125
|
}
|
|
4938
5126
|
case "refresh-presence": {
|
|
4939
|
-
const
|
|
4940
|
-
this._trySetRoomConnected(
|
|
5127
|
+
const d = n["room-id"];
|
|
5128
|
+
this._trySetRoomConnected(d, !0), this._setPresencePeers(d, n.data), this._notifyPresenceSubs(d);
|
|
4941
5129
|
break;
|
|
4942
5130
|
}
|
|
4943
5131
|
case "server-broadcast": {
|
|
4944
|
-
const
|
|
4945
|
-
this._trySetRoomConnected(
|
|
5132
|
+
const d = n["room-id"], y = n.topic;
|
|
5133
|
+
this._trySetRoomConnected(d, !0), this._notifyBroadcastSubs(d, y, n);
|
|
4946
5134
|
break;
|
|
4947
5135
|
}
|
|
4948
5136
|
case "join-room-ok": {
|
|
4949
|
-
const
|
|
4950
|
-
if (!this._rooms[
|
|
4951
|
-
this._roomsPendingLeave[
|
|
5137
|
+
const d = n["room-id"];
|
|
5138
|
+
if (!this._rooms[d]) {
|
|
5139
|
+
this._roomsPendingLeave[d] && (this._tryLeaveRoom(d), delete this._roomsPendingLeave[d]);
|
|
4952
5140
|
break;
|
|
4953
5141
|
}
|
|
4954
|
-
this._trySetRoomConnected(
|
|
5142
|
+
this._trySetRoomConnected(d, !0), this._flushEnqueuedRoomData(d);
|
|
4955
5143
|
break;
|
|
4956
5144
|
}
|
|
4957
5145
|
case "leave-room-ok": {
|
|
4958
|
-
const
|
|
4959
|
-
this._trySetRoomConnected(
|
|
5146
|
+
const d = n["room-id"];
|
|
5147
|
+
this._trySetRoomConnected(d, !1);
|
|
4960
5148
|
break;
|
|
4961
5149
|
}
|
|
4962
5150
|
case "join-room-error":
|
|
@@ -4971,6 +5159,13 @@ class $c {
|
|
|
4971
5159
|
break;
|
|
4972
5160
|
}
|
|
4973
5161
|
}
|
|
5162
|
+
// XXX: I think we need the clientId?
|
|
5163
|
+
createWriteStream(e) {
|
|
5164
|
+
return this._instantStream.createWriteStream(e);
|
|
5165
|
+
}
|
|
5166
|
+
createReadStream(e) {
|
|
5167
|
+
return this._instantStream.createReadStream(e);
|
|
5168
|
+
}
|
|
4974
5169
|
_pendingMutations() {
|
|
4975
5170
|
return this.kv.currentValue.pendingMutations ?? /* @__PURE__ */ new Map();
|
|
4976
5171
|
}
|
|
@@ -4997,7 +5192,7 @@ class $c {
|
|
|
4997
5192
|
}
|
|
4998
5193
|
}
|
|
4999
5194
|
_handleReceiveError(e) {
|
|
5000
|
-
var a, c, u, l, f,
|
|
5195
|
+
var a, c, u, l, f, d, y;
|
|
5001
5196
|
console.log("error", e);
|
|
5002
5197
|
const n = e["client-event-id"];
|
|
5003
5198
|
this._inFlightMutationEventIds.delete(n);
|
|
@@ -5009,8 +5204,8 @@ class $c {
|
|
|
5009
5204
|
return;
|
|
5010
5205
|
}
|
|
5011
5206
|
if ((a = e["original-event"]) != null && a.hasOwnProperty("q") && ((c = e["original-event"]) == null ? void 0 : c.op) === "add-query") {
|
|
5012
|
-
const b = (u = e["original-event"]) == null ? void 0 : u.q,
|
|
5013
|
-
this.notifyQueryError(q(b), s), this.notifyQueryOnceError(b,
|
|
5207
|
+
const b = (u = e["original-event"]) == null ? void 0 : u.q, _ = q(b);
|
|
5208
|
+
this.notifyQueryError(q(b), s), this.notifyQueryOnceError(b, _, n, s);
|
|
5014
5209
|
return;
|
|
5015
5210
|
}
|
|
5016
5211
|
if (((l = e["original-event"]) == null ? void 0 : l.op) === "init") {
|
|
@@ -5021,7 +5216,7 @@ class $c {
|
|
|
5021
5216
|
this._setStatus(de.ERRORED, s), this.notifyAll();
|
|
5022
5217
|
return;
|
|
5023
5218
|
}
|
|
5024
|
-
if (((
|
|
5219
|
+
if (((d = e["original-event"]) == null ? void 0 : d.op) === "resync-table") {
|
|
5025
5220
|
this._syncTable.onResyncError(e);
|
|
5026
5221
|
return;
|
|
5027
5222
|
}
|
|
@@ -5042,7 +5237,7 @@ class $c {
|
|
|
5042
5237
|
this.attrs = new Ee(e.reduce((n, r) => (n[r.id] = r, n), {}), this._linkIndex), this.notifyAttrsSubs();
|
|
5043
5238
|
}
|
|
5044
5239
|
_startQuerySub(e, n) {
|
|
5045
|
-
const r =
|
|
5240
|
+
const r = L();
|
|
5046
5241
|
return this.querySubs.updateInPlace((s) => {
|
|
5047
5242
|
s[n] = s[n] || { q: e, result: null, eventId: r }, s[n].lastAccessed = Date.now();
|
|
5048
5243
|
}), this._trySendAuthed(r, { op: "add-query", q: e }), r;
|
|
@@ -5075,7 +5270,7 @@ class $c {
|
|
|
5075
5270
|
if (!this.querySubs)
|
|
5076
5271
|
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
5272
|
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")),
|
|
5273
|
+
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")), kc), r.promise;
|
|
5079
5274
|
}
|
|
5080
5275
|
_completeQueryOnce(e, n, r) {
|
|
5081
5276
|
this.queryOnceDfds[n] && (this.queryOnceDfds[n] = this.queryOnceDfds[n].filter((s) => s.dfd !== r), this._cleanupQuery(e, n));
|
|
@@ -5088,7 +5283,7 @@ class $c {
|
|
|
5088
5283
|
return !!((n = this.queryCbs[e]) != null && n.length || (r = this.queryOnceDfds[e]) != null && r.length);
|
|
5089
5284
|
}
|
|
5090
5285
|
_cleanupQuery(e, n) {
|
|
5091
|
-
this._hasQueryListeners(n) || (delete this.queryCbs[n], delete this.queryOnceDfds[n], delete this._dataForQueryCache[n], this.querySubs.unloadKey(n), this._trySendAuthed(
|
|
5286
|
+
this._hasQueryListeners(n) || (delete this.queryCbs[n], delete this.queryOnceDfds[n], delete this._dataForQueryCache[n], this.querySubs.unloadKey(n), this._trySendAuthed(L(), { op: "remove-query", q: e }));
|
|
5092
5287
|
}
|
|
5093
5288
|
// When we `pushTx`, it's possible that we don't yet have `this.attrs`
|
|
5094
5289
|
// This means that `tx-steps` in `pendingMutations` will include `add-attr`
|
|
@@ -5113,27 +5308,27 @@ class $c {
|
|
|
5113
5308
|
if (!n)
|
|
5114
5309
|
return /* @__PURE__ */ new Map();
|
|
5115
5310
|
const s = (l) => {
|
|
5116
|
-
const [f,
|
|
5117
|
-
return
|
|
5311
|
+
const [f, d, y] = l["forward-identity"];
|
|
5312
|
+
return K(e, d, y);
|
|
5118
5313
|
}, i = (l) => {
|
|
5119
|
-
const [f,
|
|
5120
|
-
return Ce(e,
|
|
5314
|
+
const [f, d, y] = l["forward-identity"];
|
|
5315
|
+
return Ce(e, d, y);
|
|
5121
5316
|
}, o = { attrIdMap: {}, refSwapAttrIds: /* @__PURE__ */ new Set() };
|
|
5122
5317
|
let a = !1;
|
|
5123
5318
|
const c = (l, f) => {
|
|
5124
|
-
const
|
|
5319
|
+
const d = [];
|
|
5125
5320
|
for (const y of l) {
|
|
5126
5321
|
const [b] = y;
|
|
5127
5322
|
if (b === "add-attr") {
|
|
5128
|
-
const [w,
|
|
5129
|
-
if (
|
|
5130
|
-
o.attrIdMap[
|
|
5323
|
+
const [w, T] = y, g = s(T);
|
|
5324
|
+
if (g && T.id !== g.id) {
|
|
5325
|
+
o.attrIdMap[T.id] = g.id, a = !0;
|
|
5131
5326
|
continue;
|
|
5132
5327
|
}
|
|
5133
|
-
if (
|
|
5134
|
-
const S = i(
|
|
5328
|
+
if (T["value-type"] === "ref") {
|
|
5329
|
+
const S = i(T);
|
|
5135
5330
|
if (S) {
|
|
5136
|
-
o.attrIdMap[
|
|
5331
|
+
o.attrIdMap[T.id] = S.id, o.refSwapAttrIds.add(T.id), a = !0;
|
|
5137
5332
|
continue;
|
|
5138
5333
|
}
|
|
5139
5334
|
}
|
|
@@ -5142,10 +5337,10 @@ class $c {
|
|
|
5142
5337
|
a = !0;
|
|
5143
5338
|
continue;
|
|
5144
5339
|
}
|
|
5145
|
-
const
|
|
5146
|
-
|
|
5340
|
+
const _ = a ? ha(o, y) : y;
|
|
5341
|
+
d.push(_);
|
|
5147
5342
|
}
|
|
5148
|
-
return a ?
|
|
5343
|
+
return a ? d : l;
|
|
5149
5344
|
}, u = /* @__PURE__ */ new Map();
|
|
5150
5345
|
for (const [l, f] of n.entries())
|
|
5151
5346
|
u.set(l, {
|
|
@@ -5194,13 +5389,13 @@ class $c {
|
|
|
5194
5389
|
const l = this._dataForQueryCache[e];
|
|
5195
5390
|
if (l && s === l.querySubVersion && o === l.pendingMutationsVersion)
|
|
5196
5391
|
return l;
|
|
5197
|
-
let f = u.store,
|
|
5198
|
-
const { pageInfo: y, aggregate: b, processedTxId:
|
|
5392
|
+
let f = u.store, d = u.attrsStore;
|
|
5393
|
+
const { pageInfo: y, aggregate: b, processedTxId: _ } = u, w = this._rewriteMutationsSorted(d, a);
|
|
5199
5394
|
if (n) {
|
|
5200
|
-
const
|
|
5201
|
-
f =
|
|
5395
|
+
const g = this._applyOptimisticUpdates(f, d, w, _);
|
|
5396
|
+
f = g.store, d = g.attrsStore;
|
|
5202
5397
|
}
|
|
5203
|
-
return { data: Cs({ store: f, attrsStore:
|
|
5398
|
+
return { data: Cs({ store: f, attrsStore: d, pageInfo: y, aggregate: b }, c), querySubVersion: s, pendingMutationsVersion: o };
|
|
5204
5399
|
}
|
|
5205
5400
|
_applyOptimisticUpdates(e, n, r, s) {
|
|
5206
5401
|
for (const [i, o] of r)
|
|
@@ -5320,7 +5515,7 @@ class $c {
|
|
|
5320
5515
|
return;
|
|
5321
5516
|
}
|
|
5322
5517
|
const e = this._transport;
|
|
5323
|
-
this._transport =
|
|
5518
|
+
this._transport = Rc({
|
|
5324
5519
|
transportType: this._transportType,
|
|
5325
5520
|
appId: this.config.appId,
|
|
5326
5521
|
apiURI: this.config.apiURI,
|
|
@@ -5343,7 +5538,7 @@ class $c {
|
|
|
5343
5538
|
const r = await this.kv.waitForKeyToLoad(n);
|
|
5344
5539
|
if (r)
|
|
5345
5540
|
return r;
|
|
5346
|
-
const s =
|
|
5541
|
+
const s = L();
|
|
5347
5542
|
return this.kv.updateInPlace((i) => {
|
|
5348
5543
|
i[n] || (i[n] = s);
|
|
5349
5544
|
}), await this.kv.waitForKeyToLoad(n);
|
|
@@ -5390,7 +5585,7 @@ class $c {
|
|
|
5390
5585
|
return null;
|
|
5391
5586
|
this._replaceUrlAfterOAuth();
|
|
5392
5587
|
try {
|
|
5393
|
-
const c = await this._getCurrentUser(), u = (c == null ? void 0 : c.type) === "guest", { user: l } = await
|
|
5588
|
+
const c = await this._getCurrentUser(), u = (c == null ? void 0 : c.type) === "guest", { user: l } = await Rr({
|
|
5394
5589
|
apiURI: this.config.apiURI,
|
|
5395
5590
|
appId: this.config.appId,
|
|
5396
5591
|
code: r,
|
|
@@ -5415,7 +5610,7 @@ class $c {
|
|
|
5415
5610
|
n.isLoading || e(this._currentUserCached);
|
|
5416
5611
|
let r = !1;
|
|
5417
5612
|
return this.getCurrentUser().then((s) => {
|
|
5418
|
-
r ||
|
|
5613
|
+
r || Tt(s, n) || e(s);
|
|
5419
5614
|
}), () => {
|
|
5420
5615
|
r = !0, this.authCbs = this.authCbs.filter((s) => s !== e);
|
|
5421
5616
|
};
|
|
@@ -5490,7 +5685,7 @@ class $c {
|
|
|
5490
5685
|
async changeCurrentUser(e) {
|
|
5491
5686
|
var r;
|
|
5492
5687
|
const { user: n } = await this.getCurrentUser();
|
|
5493
|
-
if (!
|
|
5688
|
+
if (!Tt(n, e)) {
|
|
5494
5689
|
await this.setCurrentUser(e), this.updateUser(e);
|
|
5495
5690
|
try {
|
|
5496
5691
|
(r = this._broadcastChannel) == null || r.postMessage({ type: "auth" });
|
|
@@ -5600,7 +5795,7 @@ class $c {
|
|
|
5600
5795
|
*/
|
|
5601
5796
|
async exchangeCodeForToken({ code: e, codeVerifier: n }) {
|
|
5602
5797
|
var o;
|
|
5603
|
-
const r = await this.getCurrentUser(), s = ((o = r == null ? void 0 : r.user) == null ? void 0 : o.type) === "guest", i = await
|
|
5798
|
+
const r = await this.getCurrentUser(), s = ((o = r == null ? void 0 : r.user) == null ? void 0 : o.type) === "guest", i = await Rr({
|
|
5604
5799
|
apiURI: this.config.apiURI,
|
|
5605
5800
|
appId: this.config.appId,
|
|
5606
5801
|
code: e,
|
|
@@ -5680,17 +5875,17 @@ class $c {
|
|
|
5680
5875
|
i.result.user = o, s.isConnected && (this._trySetPresence(n, o), this._notifyPresenceSubs(n));
|
|
5681
5876
|
}
|
|
5682
5877
|
_trySetPresence(e, n) {
|
|
5683
|
-
this._trySendAuthed(
|
|
5878
|
+
this._trySendAuthed(L(), {
|
|
5684
5879
|
op: "set-presence",
|
|
5685
5880
|
"room-id": e,
|
|
5686
5881
|
data: n
|
|
5687
5882
|
});
|
|
5688
5883
|
}
|
|
5689
5884
|
_tryJoinRoom(e, n) {
|
|
5690
|
-
this._trySendAuthed(
|
|
5885
|
+
this._trySendAuthed(L(), { op: "join-room", "room-id": e, data: n }), delete this._roomsPendingLeave[e];
|
|
5691
5886
|
}
|
|
5692
5887
|
_tryLeaveRoom(e) {
|
|
5693
|
-
this._trySendAuthed(
|
|
5888
|
+
this._trySendAuthed(L(), { op: "leave-room", "room-id": e });
|
|
5694
5889
|
}
|
|
5695
5890
|
_trySetRoomConnected(e, n) {
|
|
5696
5891
|
const r = this._rooms[e];
|
|
@@ -5726,13 +5921,13 @@ class $c {
|
|
|
5726
5921
|
let s = Object.fromEntries(Object.entries(r).map(([u, l]) => [u, { data: l }]));
|
|
5727
5922
|
(c = this._presence[e]) == null || c.result;
|
|
5728
5923
|
const i = Ct(s, (u) => {
|
|
5729
|
-
for (let [l, f,
|
|
5924
|
+
for (let [l, f, d] of n)
|
|
5730
5925
|
switch (f) {
|
|
5731
5926
|
case "+":
|
|
5732
|
-
xi(u, l,
|
|
5927
|
+
xi(u, l, d);
|
|
5733
5928
|
break;
|
|
5734
5929
|
case "r":
|
|
5735
|
-
wr(u, l,
|
|
5930
|
+
wr(u, l, d);
|
|
5736
5931
|
break;
|
|
5737
5932
|
case "-":
|
|
5738
5933
|
ds(u, l);
|
|
@@ -5763,7 +5958,7 @@ class $c {
|
|
|
5763
5958
|
}
|
|
5764
5959
|
}
|
|
5765
5960
|
_tryBroadcast(e, n, r, s) {
|
|
5766
|
-
this._trySendAuthed(
|
|
5961
|
+
this._trySendAuthed(L(), {
|
|
5767
5962
|
op: "client-broadcast",
|
|
5768
5963
|
"room-id": e,
|
|
5769
5964
|
roomType: n,
|
|
@@ -5780,8 +5975,8 @@ class $c {
|
|
|
5780
5975
|
_notifyBroadcastSubs(e, n, r) {
|
|
5781
5976
|
var s, i, o;
|
|
5782
5977
|
(o = (i = (s = this._broadcastSubs) == null ? void 0 : s[e]) == null ? void 0 : i[n]) == null || o.forEach((a) => {
|
|
5783
|
-
var l, f,
|
|
5784
|
-
const c = (l = r.data) == null ? void 0 : l.data, u = r.data["peer-id"] === this._sessionId ? (
|
|
5978
|
+
var l, f, d, y, b, _;
|
|
5979
|
+
const c = (l = r.data) == null ? void 0 : l.data, u = r.data["peer-id"] === this._sessionId ? (d = (f = this._presence[e]) == null ? void 0 : f.result) == null ? void 0 : d.user : (_ = (b = (y = this._presence[e]) == null ? void 0 : y.result) == null ? void 0 : b.peers) == null ? void 0 : _[r.data["peer-id"]];
|
|
5785
5980
|
return a(c, u);
|
|
5786
5981
|
});
|
|
5787
5982
|
}
|
|
@@ -5832,9 +6027,9 @@ class $c {
|
|
|
5832
6027
|
});
|
|
5833
6028
|
}
|
|
5834
6029
|
}
|
|
5835
|
-
function
|
|
6030
|
+
function Nc(t, e) {
|
|
5836
6031
|
return new Dt(
|
|
5837
|
-
|
|
6032
|
+
Ws(t, e),
|
|
5838
6033
|
// (XXX): LinksDef<any> stems from TypeScript’s inability to reconcile the
|
|
5839
6034
|
// type EntitiesWithLinks<EntitiesWithoutLinks, Links> with
|
|
5840
6035
|
// EntitiesWithoutLinks. TypeScript is strict about ensuring that types are
|
|
@@ -5844,28 +6039,28 @@ function Dc(t, e) {
|
|
|
5844
6039
|
void 0
|
|
5845
6040
|
);
|
|
5846
6041
|
}
|
|
5847
|
-
function
|
|
6042
|
+
function Kc(t) {
|
|
5848
6043
|
return new $t(t, {});
|
|
5849
6044
|
}
|
|
5850
|
-
function
|
|
6045
|
+
function Wc() {
|
|
5851
6046
|
return new H("string", !0, !1);
|
|
5852
6047
|
}
|
|
5853
|
-
function
|
|
6048
|
+
function qc() {
|
|
5854
6049
|
return new H("number", !0, !1);
|
|
5855
6050
|
}
|
|
5856
|
-
function
|
|
6051
|
+
function zc() {
|
|
5857
6052
|
return new H("boolean", !0, !1);
|
|
5858
6053
|
}
|
|
5859
|
-
function
|
|
6054
|
+
function Vc() {
|
|
5860
6055
|
return new H("date", !0, !1);
|
|
5861
6056
|
}
|
|
5862
|
-
function
|
|
6057
|
+
function Bc() {
|
|
5863
6058
|
return new H("json", !0, !1);
|
|
5864
6059
|
}
|
|
5865
|
-
function
|
|
6060
|
+
function Gc() {
|
|
5866
6061
|
return new H("json", !0, !1);
|
|
5867
6062
|
}
|
|
5868
|
-
function
|
|
6063
|
+
function Ws(t, e) {
|
|
5869
6064
|
var s, i, o, a;
|
|
5870
6065
|
const n = { fwd: {}, rev: {} };
|
|
5871
6066
|
for (const c of Object.values(e))
|
|
@@ -5884,10 +6079,10 @@ function qs(t, e) {
|
|
|
5884
6079
|
})
|
|
5885
6080
|
]));
|
|
5886
6081
|
}
|
|
5887
|
-
function
|
|
6082
|
+
function Qc({ entities: t, links: e, rooms: n }) {
|
|
5888
6083
|
const r = e ?? {}, s = n ?? {};
|
|
5889
6084
|
return new Dt(
|
|
5890
|
-
|
|
6085
|
+
Ws(t, r),
|
|
5891
6086
|
// (XXX): LinksDef<any> stems from TypeScript's inability to reconcile the
|
|
5892
6087
|
// type EntitiesWithLinks<EntitiesWithoutLinks, Links> with
|
|
5893
6088
|
// EntitiesWithoutLinks. TypeScript is strict about ensuring that types are
|
|
@@ -5897,30 +6092,30 @@ function zc({ entities: t, links: e, rooms: n }) {
|
|
|
5897
6092
|
s
|
|
5898
6093
|
);
|
|
5899
6094
|
}
|
|
5900
|
-
const
|
|
6095
|
+
const Lu = {
|
|
5901
6096
|
// constructs
|
|
5902
|
-
graph:
|
|
5903
|
-
schema:
|
|
5904
|
-
entity:
|
|
6097
|
+
graph: Nc,
|
|
6098
|
+
schema: Qc,
|
|
6099
|
+
entity: Kc,
|
|
5905
6100
|
// value types
|
|
5906
|
-
string:
|
|
5907
|
-
number:
|
|
5908
|
-
boolean:
|
|
5909
|
-
date:
|
|
5910
|
-
json:
|
|
5911
|
-
any:
|
|
6101
|
+
string: Wc,
|
|
6102
|
+
number: qc,
|
|
6103
|
+
boolean: zc,
|
|
6104
|
+
date: Vc,
|
|
6105
|
+
json: Bc,
|
|
6106
|
+
any: Gc
|
|
5912
6107
|
};
|
|
5913
|
-
let
|
|
5914
|
-
function
|
|
5915
|
-
|
|
5916
|
-
const n =
|
|
6108
|
+
let _t;
|
|
6109
|
+
function Hc(t, e) {
|
|
6110
|
+
_t == null || _t.dispose();
|
|
6111
|
+
const n = tu(e), r = Zc(e, a), s = Yc(Jc(t));
|
|
5917
6112
|
function i(l) {
|
|
5918
6113
|
var f;
|
|
5919
6114
|
l.source === s.element.contentWindow && ((f = l.data) == null ? void 0 : f.type) === "close" && n.isVisible() && a();
|
|
5920
6115
|
}
|
|
5921
6116
|
function o(l) {
|
|
5922
|
-
const f = l.shiftKey && l.ctrlKey && l.key === "0",
|
|
5923
|
-
(f ||
|
|
6117
|
+
const f = l.shiftKey && l.ctrlKey && l.key === "0", d = l.key === "Escape" || l.key === "Esc";
|
|
6118
|
+
(f || d && n.isVisible()) && a();
|
|
5924
6119
|
}
|
|
5925
6120
|
function a() {
|
|
5926
6121
|
n.isVisible() ? n.element.style.display = "none" : (n.element.style.display = "block", n.element.contains(s.element) || n.element.appendChild(s.element));
|
|
@@ -5929,16 +6124,16 @@ function Vc(t, e) {
|
|
|
5929
6124
|
n.element.remove(), r.element.remove(), removeEventListener("keydown", o), removeEventListener("message", i);
|
|
5930
6125
|
}
|
|
5931
6126
|
function u() {
|
|
5932
|
-
document.body.appendChild(n.element), document.body.appendChild(r.element), addEventListener("keydown", o), addEventListener("message", i),
|
|
6127
|
+
document.body.appendChild(n.element), document.body.appendChild(r.element), addEventListener("keydown", o), addEventListener("message", i), _t = {
|
|
5933
6128
|
dispose: c
|
|
5934
6129
|
};
|
|
5935
6130
|
}
|
|
5936
6131
|
return u();
|
|
5937
6132
|
}
|
|
5938
|
-
function
|
|
5939
|
-
return `${
|
|
6133
|
+
function Jc(t) {
|
|
6134
|
+
return `${Wn || xs ? "http://localhost:3000" : "https://instantdb.com"}/_devtool?appId=${t}`;
|
|
5940
6135
|
}
|
|
5941
|
-
function
|
|
6136
|
+
function Yc(t) {
|
|
5942
6137
|
const e = document.createElement("iframe");
|
|
5943
6138
|
return e.src = t, e.className = "instant-devtool-iframe", Object.assign(e.style, {
|
|
5944
6139
|
width: "100%",
|
|
@@ -5947,7 +6142,7 @@ function Gc(t) {
|
|
|
5947
6142
|
border: "none"
|
|
5948
6143
|
}), { element: e };
|
|
5949
6144
|
}
|
|
5950
|
-
function
|
|
6145
|
+
function Zc(t, e) {
|
|
5951
6146
|
const n = `
|
|
5952
6147
|
<svg width="32" height="32" viewBox="0 0 512 512" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
5953
6148
|
<rect width="512" height="512" fill="black"/>
|
|
@@ -5957,7 +6152,7 @@ function Qc(t, e) {
|
|
|
5957
6152
|
return r.innerHTML = n, r.className = "instant-devtool-toggler", Object.assign(r.style, {
|
|
5958
6153
|
// pos
|
|
5959
6154
|
position: "fixed",
|
|
5960
|
-
...
|
|
6155
|
+
...Xc(t.position),
|
|
5961
6156
|
height: "32px",
|
|
5962
6157
|
width: "32px",
|
|
5963
6158
|
// layout
|
|
@@ -5972,7 +6167,7 @@ function Qc(t, e) {
|
|
|
5972
6167
|
cursor: "pointer"
|
|
5973
6168
|
}), r.addEventListener("click", e), { element: r };
|
|
5974
6169
|
}
|
|
5975
|
-
function
|
|
6170
|
+
function Xc(t) {
|
|
5976
6171
|
switch (t) {
|
|
5977
6172
|
case "bottom-left":
|
|
5978
6173
|
return { bottom: "24px", left: "24px" };
|
|
@@ -5984,7 +6179,7 @@ function Hc(t) {
|
|
|
5984
6179
|
return { top: "24px", left: "24px" };
|
|
5985
6180
|
}
|
|
5986
6181
|
}
|
|
5987
|
-
function
|
|
6182
|
+
function eu(t) {
|
|
5988
6183
|
switch (t) {
|
|
5989
6184
|
case "bottom-left":
|
|
5990
6185
|
return { bottom: "24px", right: "24px", left: "60px", top: "72px" };
|
|
@@ -5996,11 +6191,11 @@ function Jc(t) {
|
|
|
5996
6191
|
return { top: "24px", right: "24px", left: "60px", bottom: "72px" };
|
|
5997
6192
|
}
|
|
5998
6193
|
}
|
|
5999
|
-
function
|
|
6194
|
+
function tu(t) {
|
|
6000
6195
|
const e = document.createElement("div");
|
|
6001
6196
|
Object.assign(e.style, {
|
|
6002
6197
|
position: "fixed",
|
|
6003
|
-
...
|
|
6198
|
+
...eu(t.position),
|
|
6004
6199
|
display: "block",
|
|
6005
6200
|
borderRadius: "4px",
|
|
6006
6201
|
border: "1px #ccc solid",
|
|
@@ -6013,7 +6208,7 @@ function Yc(t) {
|
|
|
6013
6208
|
}
|
|
6014
6209
|
return { element: e, isVisible: n };
|
|
6015
6210
|
}
|
|
6016
|
-
function
|
|
6211
|
+
function nu(t, e) {
|
|
6017
6212
|
return e && e.refresh_token ? new Response(JSON.stringify({ ok: !0 }), {
|
|
6018
6213
|
headers: {
|
|
6019
6214
|
"Content-Type": "application/json",
|
|
@@ -6028,47 +6223,47 @@ function Zc(t, e) {
|
|
|
6028
6223
|
}
|
|
6029
6224
|
});
|
|
6030
6225
|
}
|
|
6031
|
-
function
|
|
6226
|
+
function gt(t, e) {
|
|
6032
6227
|
return new Response(JSON.stringify({ ok: !1, error: e }), {
|
|
6033
6228
|
status: t,
|
|
6034
6229
|
headers: { "Content-Type": "application/json" }
|
|
6035
6230
|
});
|
|
6036
6231
|
}
|
|
6037
|
-
const
|
|
6232
|
+
const Fu = (t) => ({
|
|
6038
6233
|
POST: async (e) => {
|
|
6039
6234
|
let n;
|
|
6040
6235
|
try {
|
|
6041
6236
|
n = await e.json();
|
|
6042
6237
|
} catch {
|
|
6043
|
-
return
|
|
6238
|
+
return gt(400, "Invalid JSON body");
|
|
6044
6239
|
}
|
|
6045
6240
|
if (!n.type)
|
|
6046
|
-
return
|
|
6241
|
+
return gt(400, 'Missing "type" field');
|
|
6047
6242
|
if (n.appId !== t.appId)
|
|
6048
|
-
return
|
|
6243
|
+
return gt(403, "App ID mismatch");
|
|
6049
6244
|
switch (n.type) {
|
|
6050
6245
|
case "sync-user":
|
|
6051
|
-
return
|
|
6246
|
+
return nu(t, n.user ?? null);
|
|
6052
6247
|
default:
|
|
6053
|
-
return
|
|
6248
|
+
return gt(400, `Unknown type: ${n.type}`);
|
|
6054
6249
|
}
|
|
6055
6250
|
}
|
|
6056
|
-
}),
|
|
6251
|
+
}), ru = {
|
|
6057
6252
|
apiURI: "https://api.instantdb.com",
|
|
6058
6253
|
websocketURI: "wss://api.instantdb.com/runtime/session"
|
|
6059
6254
|
};
|
|
6060
|
-
function
|
|
6255
|
+
function su() {
|
|
6061
6256
|
return globalThis.__instantDbSchemaHashStore = globalThis.__instantDbSchemaHashStore ?? /* @__PURE__ */ new WeakMap(), globalThis.__instantDbSchemaHashStore;
|
|
6062
6257
|
}
|
|
6063
|
-
function
|
|
6258
|
+
function iu() {
|
|
6064
6259
|
return globalThis.__instantDbStore = globalThis.__instantDbStore ?? {}, globalThis.__instantDbStore;
|
|
6065
6260
|
}
|
|
6066
6261
|
function wn(t) {
|
|
6067
6262
|
const e = t.__adminToken;
|
|
6068
6263
|
return t.appId + "_" + (t.websocketURI || "default_ws_uri") + "_" + (t.apiURI || "default_api_uri") + "_" + (e || "client_only") + "_" + t.useDateObjects;
|
|
6069
6264
|
}
|
|
6070
|
-
const
|
|
6071
|
-
class
|
|
6265
|
+
const mn = iu(), Vr = su();
|
|
6266
|
+
class ou {
|
|
6072
6267
|
constructor(e) {
|
|
6073
6268
|
p(this, "db");
|
|
6074
6269
|
/**
|
|
@@ -6185,7 +6380,7 @@ class nu {
|
|
|
6185
6380
|
this.db = e;
|
|
6186
6381
|
}
|
|
6187
6382
|
}
|
|
6188
|
-
class
|
|
6383
|
+
class au {
|
|
6189
6384
|
constructor(e) {
|
|
6190
6385
|
p(this, "db");
|
|
6191
6386
|
/**
|
|
@@ -6234,16 +6429,16 @@ class ru {
|
|
|
6234
6429
|
this.db = e;
|
|
6235
6430
|
}
|
|
6236
6431
|
}
|
|
6237
|
-
function
|
|
6432
|
+
function cu(t) {
|
|
6238
6433
|
return JSON.parse(JSON.stringify(t));
|
|
6239
6434
|
}
|
|
6240
|
-
class
|
|
6435
|
+
class uu {
|
|
6241
6436
|
constructor(e) {
|
|
6242
6437
|
p(this, "_reactor");
|
|
6243
6438
|
p(this, "auth");
|
|
6244
6439
|
p(this, "storage");
|
|
6245
6440
|
p(this, "tx", Kn());
|
|
6246
|
-
this._reactor = e, this.auth = new
|
|
6441
|
+
this._reactor = e, this.auth = new ou(this._reactor), this.storage = new au(this._reactor);
|
|
6247
6442
|
}
|
|
6248
6443
|
/**
|
|
6249
6444
|
* Use this to write data! You can create, update, delete, and link objects
|
|
@@ -6384,7 +6579,7 @@ class iu {
|
|
|
6384
6579
|
};
|
|
6385
6580
|
}
|
|
6386
6581
|
shutdown() {
|
|
6387
|
-
delete
|
|
6582
|
+
delete mn[wn(this._reactor.config)], this._reactor.shutdown();
|
|
6388
6583
|
}
|
|
6389
6584
|
/**
|
|
6390
6585
|
* Use this for one-off queries.
|
|
@@ -6426,26 +6621,26 @@ function Br(t) {
|
|
|
6426
6621
|
const n = q(t);
|
|
6427
6622
|
return Vr.set(t, n), n;
|
|
6428
6623
|
}
|
|
6429
|
-
function
|
|
6624
|
+
function lu(t, e) {
|
|
6430
6625
|
return Br(t._reactor.config.schema) !== Br(e);
|
|
6431
6626
|
}
|
|
6432
|
-
function
|
|
6627
|
+
function fu(t, e, n, r, s) {
|
|
6433
6628
|
var u;
|
|
6434
6629
|
const i = {
|
|
6435
6630
|
...t,
|
|
6436
6631
|
appId: (u = t.appId) == null ? void 0 : u.trim(),
|
|
6437
6632
|
useDateObjects: t.useDateObjects ?? !1
|
|
6438
|
-
}, o =
|
|
6633
|
+
}, o = mn[wn(i)];
|
|
6439
6634
|
if (o)
|
|
6440
|
-
return
|
|
6441
|
-
const a = new
|
|
6442
|
-
...
|
|
6635
|
+
return lu(o, i.schema) && o._reactor.updateSchema(i.schema), o;
|
|
6636
|
+
const a = new Fc({
|
|
6637
|
+
...ru,
|
|
6443
6638
|
...i,
|
|
6444
6639
|
cardinalityInference: !!i.schema
|
|
6445
|
-
}, e || Ms, n ||
|
|
6446
|
-
return
|
|
6640
|
+
}, e || Ms, n || Rs, { ...r || {}, "@instantdb/core": qn }, s), c = new uu(a);
|
|
6641
|
+
return mn[wn(i)] = c, du(i.appId, i.devtool), c;
|
|
6447
6642
|
}
|
|
6448
|
-
function
|
|
6643
|
+
function du(t, e) {
|
|
6449
6644
|
if (typeof window > "u" || typeof window.location > "u" || typeof document > "u" || typeof e == "boolean" && !e)
|
|
6450
6645
|
return;
|
|
6451
6646
|
const n = {
|
|
@@ -6453,9 +6648,9 @@ function cu(t, e) {
|
|
|
6453
6648
|
allowedHosts: ["localhost"],
|
|
6454
6649
|
...typeof e == "object" ? e : {}
|
|
6455
6650
|
};
|
|
6456
|
-
n.allowedHosts.includes(window.location.hostname) &&
|
|
6651
|
+
n.allowedHosts.includes(window.location.hostname) && Hc(t, n);
|
|
6457
6652
|
}
|
|
6458
|
-
var
|
|
6653
|
+
var Tn = { exports: {} }, Be = {};
|
|
6459
6654
|
/**
|
|
6460
6655
|
* @license React
|
|
6461
6656
|
* react-jsx-runtime.production.min.js
|
|
@@ -6466,21 +6661,21 @@ var mn = { exports: {} }, Be = {};
|
|
|
6466
6661
|
* LICENSE file in the root directory of this source tree.
|
|
6467
6662
|
*/
|
|
6468
6663
|
var Gr;
|
|
6469
|
-
function
|
|
6664
|
+
function hu() {
|
|
6470
6665
|
if (Gr) return Be;
|
|
6471
6666
|
Gr = 1;
|
|
6472
6667
|
var t = ts, e = Symbol.for("react.element"), n = Symbol.for("react.fragment"), r = Object.prototype.hasOwnProperty, s = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, i = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
6473
6668
|
function o(a, c, u) {
|
|
6474
|
-
var l, f = {},
|
|
6475
|
-
u !== void 0 && (
|
|
6669
|
+
var l, f = {}, d = null, y = null;
|
|
6670
|
+
u !== void 0 && (d = "" + u), c.key !== void 0 && (d = "" + c.key), c.ref !== void 0 && (y = c.ref);
|
|
6476
6671
|
for (l in c) r.call(c, l) && !i.hasOwnProperty(l) && (f[l] = c[l]);
|
|
6477
6672
|
if (a && a.defaultProps) for (l in c = a.defaultProps, c) f[l] === void 0 && (f[l] = c[l]);
|
|
6478
|
-
return { $$typeof: e, type: a, key:
|
|
6673
|
+
return { $$typeof: e, type: a, key: d, ref: y, props: f, _owner: s.current };
|
|
6479
6674
|
}
|
|
6480
6675
|
return Be.Fragment = n, Be.jsx = o, Be.jsxs = o, Be;
|
|
6481
6676
|
}
|
|
6482
6677
|
var Ge = {}, Qr;
|
|
6483
|
-
function
|
|
6678
|
+
function pu() {
|
|
6484
6679
|
if (Qr) return Ge;
|
|
6485
6680
|
Qr = 1;
|
|
6486
6681
|
var t = {};
|
|
@@ -6494,58 +6689,58 @@ function lu() {
|
|
|
6494
6689
|
* LICENSE file in the root directory of this source tree.
|
|
6495
6690
|
*/
|
|
6496
6691
|
return t.NODE_ENV !== "production" && function() {
|
|
6497
|
-
var e = ts, 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"),
|
|
6498
|
-
function
|
|
6499
|
-
if (
|
|
6692
|
+
var e = ts, 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"), d = Symbol.for("react.memo"), y = Symbol.for("react.lazy"), b = Symbol.for("react.offscreen"), _ = Symbol.iterator, w = "@@iterator";
|
|
6693
|
+
function T(h) {
|
|
6694
|
+
if (h === null || typeof h != "object")
|
|
6500
6695
|
return null;
|
|
6501
|
-
var
|
|
6502
|
-
return typeof
|
|
6696
|
+
var m = _ && h[_] || h[w];
|
|
6697
|
+
return typeof m == "function" ? m : null;
|
|
6503
6698
|
}
|
|
6504
|
-
var
|
|
6505
|
-
function S(
|
|
6699
|
+
var g = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
6700
|
+
function S(h) {
|
|
6506
6701
|
{
|
|
6507
|
-
for (var
|
|
6702
|
+
for (var m = arguments.length, v = new Array(m > 1 ? m - 1 : 0), A = 1; A < m; A++)
|
|
6508
6703
|
v[A - 1] = arguments[A];
|
|
6509
|
-
O("error",
|
|
6704
|
+
O("error", h, v);
|
|
6510
6705
|
}
|
|
6511
6706
|
}
|
|
6512
|
-
function O(
|
|
6707
|
+
function O(h, m, v) {
|
|
6513
6708
|
{
|
|
6514
|
-
var A =
|
|
6515
|
-
M !== "" && (
|
|
6516
|
-
var
|
|
6517
|
-
return String(
|
|
6709
|
+
var A = g.ReactDebugCurrentFrame, M = A.getStackAddendum();
|
|
6710
|
+
M !== "" && (m += "%s", v = v.concat([M]));
|
|
6711
|
+
var j = v.map(function(P) {
|
|
6712
|
+
return String(P);
|
|
6518
6713
|
});
|
|
6519
|
-
|
|
6714
|
+
j.unshift("Warning: " + m), Function.prototype.apply.call(console[h], console, j);
|
|
6520
6715
|
}
|
|
6521
6716
|
}
|
|
6522
|
-
var E = !1,
|
|
6717
|
+
var E = !1, R = !1, F = !1, B = !1, We = !1, ut;
|
|
6523
6718
|
ut = Symbol.for("react.module.reference");
|
|
6524
|
-
function Ut(
|
|
6525
|
-
return !!(typeof
|
|
6719
|
+
function Ut(h) {
|
|
6720
|
+
return !!(typeof h == "string" || typeof h == "function" || h === s || h === o || We || h === i || h === l || h === f || B || h === b || E || R || F || typeof h == "object" && h !== null && (h.$$typeof === y || h.$$typeof === d || h.$$typeof === a || h.$$typeof === c || h.$$typeof === u || // This needs to include all possible module reference object
|
|
6526
6721
|
// types supported by any Flight configuration anywhere since
|
|
6527
6722
|
// we don't know which Flight build this will end up being used
|
|
6528
6723
|
// with.
|
|
6529
|
-
|
|
6724
|
+
h.$$typeof === ut || h.getModuleId !== void 0));
|
|
6530
6725
|
}
|
|
6531
|
-
function Lt(
|
|
6532
|
-
var A =
|
|
6726
|
+
function Lt(h, m, v) {
|
|
6727
|
+
var A = h.displayName;
|
|
6533
6728
|
if (A)
|
|
6534
6729
|
return A;
|
|
6535
|
-
var M =
|
|
6730
|
+
var M = m.displayName || m.name || "";
|
|
6536
6731
|
return M !== "" ? v + "(" + M + ")" : v;
|
|
6537
6732
|
}
|
|
6538
|
-
function
|
|
6539
|
-
return
|
|
6733
|
+
function qe(h) {
|
|
6734
|
+
return h.displayName || "Context";
|
|
6540
6735
|
}
|
|
6541
|
-
function ie(
|
|
6542
|
-
if (
|
|
6736
|
+
function ie(h) {
|
|
6737
|
+
if (h == null)
|
|
6543
6738
|
return null;
|
|
6544
|
-
if (typeof
|
|
6545
|
-
return
|
|
6546
|
-
if (typeof
|
|
6547
|
-
return
|
|
6548
|
-
switch (
|
|
6739
|
+
if (typeof h.tag == "number" && S("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof h == "function")
|
|
6740
|
+
return h.displayName || h.name || null;
|
|
6741
|
+
if (typeof h == "string")
|
|
6742
|
+
return h;
|
|
6743
|
+
switch (h) {
|
|
6549
6744
|
case s:
|
|
6550
6745
|
return "Fragment";
|
|
6551
6746
|
case r:
|
|
@@ -6559,23 +6754,23 @@ function lu() {
|
|
|
6559
6754
|
case f:
|
|
6560
6755
|
return "SuspenseList";
|
|
6561
6756
|
}
|
|
6562
|
-
if (typeof
|
|
6563
|
-
switch (
|
|
6757
|
+
if (typeof h == "object")
|
|
6758
|
+
switch (h.$$typeof) {
|
|
6564
6759
|
case c:
|
|
6565
|
-
var
|
|
6566
|
-
return
|
|
6760
|
+
var m = h;
|
|
6761
|
+
return qe(m) + ".Consumer";
|
|
6567
6762
|
case a:
|
|
6568
|
-
var v =
|
|
6569
|
-
return
|
|
6763
|
+
var v = h;
|
|
6764
|
+
return qe(v._context) + ".Provider";
|
|
6570
6765
|
case u:
|
|
6571
|
-
return Lt(
|
|
6572
|
-
case
|
|
6573
|
-
var A =
|
|
6574
|
-
return A !== null ? A : ie(
|
|
6766
|
+
return Lt(h, h.render, "ForwardRef");
|
|
6767
|
+
case d:
|
|
6768
|
+
var A = h.displayName || null;
|
|
6769
|
+
return A !== null ? A : ie(h.type) || "Memo";
|
|
6575
6770
|
case y: {
|
|
6576
|
-
var M =
|
|
6771
|
+
var M = h, j = M._payload, P = M._init;
|
|
6577
6772
|
try {
|
|
6578
|
-
return ie(
|
|
6773
|
+
return ie(P(j));
|
|
6579
6774
|
} catch {
|
|
6580
6775
|
return null;
|
|
6581
6776
|
}
|
|
@@ -6591,20 +6786,20 @@ function lu() {
|
|
|
6591
6786
|
{
|
|
6592
6787
|
if (be === 0) {
|
|
6593
6788
|
Vn = console.log, Bn = console.info, Gn = console.warn, Qn = console.error, Hn = console.group, Jn = console.groupCollapsed, Yn = console.groupEnd;
|
|
6594
|
-
var
|
|
6789
|
+
var h = {
|
|
6595
6790
|
configurable: !0,
|
|
6596
6791
|
enumerable: !0,
|
|
6597
6792
|
value: Zn,
|
|
6598
6793
|
writable: !0
|
|
6599
6794
|
};
|
|
6600
6795
|
Object.defineProperties(console, {
|
|
6601
|
-
info:
|
|
6602
|
-
log:
|
|
6603
|
-
warn:
|
|
6604
|
-
error:
|
|
6605
|
-
group:
|
|
6606
|
-
groupCollapsed:
|
|
6607
|
-
groupEnd:
|
|
6796
|
+
info: h,
|
|
6797
|
+
log: h,
|
|
6798
|
+
warn: h,
|
|
6799
|
+
error: h,
|
|
6800
|
+
group: h,
|
|
6801
|
+
groupCollapsed: h,
|
|
6802
|
+
groupEnd: h
|
|
6608
6803
|
});
|
|
6609
6804
|
}
|
|
6610
6805
|
be++;
|
|
@@ -6613,31 +6808,31 @@ function lu() {
|
|
|
6613
6808
|
function Bs() {
|
|
6614
6809
|
{
|
|
6615
6810
|
if (be--, be === 0) {
|
|
6616
|
-
var
|
|
6811
|
+
var h = {
|
|
6617
6812
|
configurable: !0,
|
|
6618
6813
|
enumerable: !0,
|
|
6619
6814
|
writable: !0
|
|
6620
6815
|
};
|
|
6621
6816
|
Object.defineProperties(console, {
|
|
6622
|
-
log: le({},
|
|
6817
|
+
log: le({}, h, {
|
|
6623
6818
|
value: Vn
|
|
6624
6819
|
}),
|
|
6625
|
-
info: le({},
|
|
6820
|
+
info: le({}, h, {
|
|
6626
6821
|
value: Bn
|
|
6627
6822
|
}),
|
|
6628
|
-
warn: le({},
|
|
6823
|
+
warn: le({}, h, {
|
|
6629
6824
|
value: Gn
|
|
6630
6825
|
}),
|
|
6631
|
-
error: le({},
|
|
6826
|
+
error: le({}, h, {
|
|
6632
6827
|
value: Qn
|
|
6633
6828
|
}),
|
|
6634
|
-
group: le({},
|
|
6829
|
+
group: le({}, h, {
|
|
6635
6830
|
value: Hn
|
|
6636
6831
|
}),
|
|
6637
|
-
groupCollapsed: le({},
|
|
6832
|
+
groupCollapsed: le({}, h, {
|
|
6638
6833
|
value: Jn
|
|
6639
6834
|
}),
|
|
6640
|
-
groupEnd: le({},
|
|
6835
|
+
groupEnd: le({}, h, {
|
|
6641
6836
|
value: Yn
|
|
6642
6837
|
})
|
|
6643
6838
|
});
|
|
@@ -6645,8 +6840,8 @@ function lu() {
|
|
|
6645
6840
|
be < 0 && S("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
|
|
6646
6841
|
}
|
|
6647
6842
|
}
|
|
6648
|
-
var Ft =
|
|
6649
|
-
function lt(
|
|
6843
|
+
var Ft = g.ReactCurrentDispatcher, Nt;
|
|
6844
|
+
function lt(h, m, v) {
|
|
6650
6845
|
{
|
|
6651
6846
|
if (Nt === void 0)
|
|
6652
6847
|
try {
|
|
@@ -6656,7 +6851,7 @@ function lu() {
|
|
|
6656
6851
|
Nt = A && A[1] || "";
|
|
6657
6852
|
}
|
|
6658
6853
|
return `
|
|
6659
|
-
` + Nt +
|
|
6854
|
+
` + Nt + h;
|
|
6660
6855
|
}
|
|
6661
6856
|
}
|
|
6662
6857
|
var Kt = !1, ft;
|
|
@@ -6664,11 +6859,11 @@ function lu() {
|
|
|
6664
6859
|
var Gs = typeof WeakMap == "function" ? WeakMap : Map;
|
|
6665
6860
|
ft = new Gs();
|
|
6666
6861
|
}
|
|
6667
|
-
function Xn(
|
|
6668
|
-
if (!
|
|
6862
|
+
function Xn(h, m) {
|
|
6863
|
+
if (!h || Kt)
|
|
6669
6864
|
return "";
|
|
6670
6865
|
{
|
|
6671
|
-
var v = ft.get(
|
|
6866
|
+
var v = ft.get(h);
|
|
6672
6867
|
if (v !== void 0)
|
|
6673
6868
|
return v;
|
|
6674
6869
|
}
|
|
@@ -6676,31 +6871,31 @@ function lu() {
|
|
|
6676
6871
|
Kt = !0;
|
|
6677
6872
|
var M = Error.prepareStackTrace;
|
|
6678
6873
|
Error.prepareStackTrace = void 0;
|
|
6679
|
-
var
|
|
6680
|
-
|
|
6874
|
+
var j;
|
|
6875
|
+
j = Ft.current, Ft.current = null, Vs();
|
|
6681
6876
|
try {
|
|
6682
|
-
if (
|
|
6683
|
-
var
|
|
6877
|
+
if (m) {
|
|
6878
|
+
var P = function() {
|
|
6684
6879
|
throw Error();
|
|
6685
6880
|
};
|
|
6686
|
-
if (Object.defineProperty(
|
|
6881
|
+
if (Object.defineProperty(P.prototype, "props", {
|
|
6687
6882
|
set: function() {
|
|
6688
6883
|
throw Error();
|
|
6689
6884
|
}
|
|
6690
6885
|
}), typeof Reflect == "object" && Reflect.construct) {
|
|
6691
6886
|
try {
|
|
6692
|
-
Reflect.construct(
|
|
6887
|
+
Reflect.construct(P, []);
|
|
6693
6888
|
} catch (J) {
|
|
6694
6889
|
A = J;
|
|
6695
6890
|
}
|
|
6696
|
-
Reflect.construct(
|
|
6891
|
+
Reflect.construct(h, [], P);
|
|
6697
6892
|
} else {
|
|
6698
6893
|
try {
|
|
6699
|
-
|
|
6894
|
+
P.call();
|
|
6700
6895
|
} catch (J) {
|
|
6701
6896
|
A = J;
|
|
6702
6897
|
}
|
|
6703
|
-
|
|
6898
|
+
h.call(P.prototype);
|
|
6704
6899
|
}
|
|
6705
6900
|
} else {
|
|
6706
6901
|
try {
|
|
@@ -6708,178 +6903,178 @@ function lu() {
|
|
|
6708
6903
|
} catch (J) {
|
|
6709
6904
|
A = J;
|
|
6710
6905
|
}
|
|
6711
|
-
|
|
6906
|
+
h();
|
|
6712
6907
|
}
|
|
6713
6908
|
} catch (J) {
|
|
6714
6909
|
if (J && A && typeof J.stack == "string") {
|
|
6715
6910
|
for (var C = J.stack.split(`
|
|
6716
6911
|
`), G = A.stack.split(`
|
|
6717
|
-
`), D = C.length - 1,
|
|
6718
|
-
|
|
6719
|
-
for (; D >= 1 &&
|
|
6720
|
-
if (C[D] !== G[
|
|
6721
|
-
if (D !== 1 ||
|
|
6912
|
+
`), D = C.length - 1, N = G.length - 1; D >= 1 && N >= 0 && C[D] !== G[N]; )
|
|
6913
|
+
N--;
|
|
6914
|
+
for (; D >= 1 && N >= 0; D--, N--)
|
|
6915
|
+
if (C[D] !== G[N]) {
|
|
6916
|
+
if (D !== 1 || N !== 1)
|
|
6722
6917
|
do
|
|
6723
|
-
if (D--,
|
|
6918
|
+
if (D--, N--, N < 0 || C[D] !== G[N]) {
|
|
6724
6919
|
var re = `
|
|
6725
6920
|
` + C[D].replace(" at new ", " at ");
|
|
6726
|
-
return
|
|
6921
|
+
return h.displayName && re.includes("<anonymous>") && (re = re.replace("<anonymous>", h.displayName)), typeof h == "function" && ft.set(h, re), re;
|
|
6727
6922
|
}
|
|
6728
|
-
while (D >= 1 &&
|
|
6923
|
+
while (D >= 1 && N >= 0);
|
|
6729
6924
|
break;
|
|
6730
6925
|
}
|
|
6731
6926
|
}
|
|
6732
6927
|
} finally {
|
|
6733
|
-
Kt = !1, Ft.current =
|
|
6928
|
+
Kt = !1, Ft.current = j, Bs(), Error.prepareStackTrace = M;
|
|
6734
6929
|
}
|
|
6735
|
-
var
|
|
6736
|
-
return typeof
|
|
6930
|
+
var Pe = h ? h.displayName || h.name : "", we = Pe ? lt(Pe) : "";
|
|
6931
|
+
return typeof h == "function" && ft.set(h, we), we;
|
|
6737
6932
|
}
|
|
6738
|
-
function Qs(
|
|
6739
|
-
return Xn(
|
|
6933
|
+
function Qs(h, m, v) {
|
|
6934
|
+
return Xn(h, !1);
|
|
6740
6935
|
}
|
|
6741
|
-
function Hs(
|
|
6742
|
-
var
|
|
6743
|
-
return !!(
|
|
6936
|
+
function Hs(h) {
|
|
6937
|
+
var m = h.prototype;
|
|
6938
|
+
return !!(m && m.isReactComponent);
|
|
6744
6939
|
}
|
|
6745
|
-
function dt(
|
|
6746
|
-
if (
|
|
6940
|
+
function dt(h, m, v) {
|
|
6941
|
+
if (h == null)
|
|
6747
6942
|
return "";
|
|
6748
|
-
if (typeof
|
|
6749
|
-
return Xn(
|
|
6750
|
-
if (typeof
|
|
6751
|
-
return lt(
|
|
6752
|
-
switch (
|
|
6943
|
+
if (typeof h == "function")
|
|
6944
|
+
return Xn(h, Hs(h));
|
|
6945
|
+
if (typeof h == "string")
|
|
6946
|
+
return lt(h);
|
|
6947
|
+
switch (h) {
|
|
6753
6948
|
case l:
|
|
6754
6949
|
return lt("Suspense");
|
|
6755
6950
|
case f:
|
|
6756
6951
|
return lt("SuspenseList");
|
|
6757
6952
|
}
|
|
6758
|
-
if (typeof
|
|
6759
|
-
switch (
|
|
6953
|
+
if (typeof h == "object")
|
|
6954
|
+
switch (h.$$typeof) {
|
|
6760
6955
|
case u:
|
|
6761
|
-
return Qs(
|
|
6762
|
-
case
|
|
6763
|
-
return dt(
|
|
6956
|
+
return Qs(h.render);
|
|
6957
|
+
case d:
|
|
6958
|
+
return dt(h.type, m, v);
|
|
6764
6959
|
case y: {
|
|
6765
|
-
var A =
|
|
6960
|
+
var A = h, M = A._payload, j = A._init;
|
|
6766
6961
|
try {
|
|
6767
|
-
return dt(
|
|
6962
|
+
return dt(j(M), m, v);
|
|
6768
6963
|
} catch {
|
|
6769
6964
|
}
|
|
6770
6965
|
}
|
|
6771
6966
|
}
|
|
6772
6967
|
return "";
|
|
6773
6968
|
}
|
|
6774
|
-
var ze = Object.prototype.hasOwnProperty, er = {}, tr =
|
|
6775
|
-
function ht(
|
|
6776
|
-
if (
|
|
6777
|
-
var
|
|
6969
|
+
var ze = Object.prototype.hasOwnProperty, er = {}, tr = g.ReactDebugCurrentFrame;
|
|
6970
|
+
function ht(h) {
|
|
6971
|
+
if (h) {
|
|
6972
|
+
var m = h._owner, v = dt(h.type, h._source, m ? m.type : null);
|
|
6778
6973
|
tr.setExtraStackFrame(v);
|
|
6779
6974
|
} else
|
|
6780
6975
|
tr.setExtraStackFrame(null);
|
|
6781
6976
|
}
|
|
6782
|
-
function Js(
|
|
6977
|
+
function Js(h, m, v, A, M) {
|
|
6783
6978
|
{
|
|
6784
|
-
var
|
|
6785
|
-
for (var
|
|
6786
|
-
if (
|
|
6979
|
+
var j = Function.call.bind(ze);
|
|
6980
|
+
for (var P in h)
|
|
6981
|
+
if (j(h, P)) {
|
|
6787
6982
|
var C = void 0;
|
|
6788
6983
|
try {
|
|
6789
|
-
if (typeof
|
|
6790
|
-
var G = Error((A || "React class") + ": " + v + " type `" +
|
|
6984
|
+
if (typeof h[P] != "function") {
|
|
6985
|
+
var G = Error((A || "React class") + ": " + v + " type `" + P + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof h[P] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
|
|
6791
6986
|
throw G.name = "Invariant Violation", G;
|
|
6792
6987
|
}
|
|
6793
|
-
C =
|
|
6988
|
+
C = h[P](m, P, A, v, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
|
|
6794
6989
|
} catch (D) {
|
|
6795
6990
|
C = D;
|
|
6796
6991
|
}
|
|
6797
|
-
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,
|
|
6992
|
+
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, P, typeof C), ht(null)), C instanceof Error && !(C.message in er) && (er[C.message] = !0, ht(M), S("Failed %s type: %s", v, C.message), ht(null));
|
|
6798
6993
|
}
|
|
6799
6994
|
}
|
|
6800
6995
|
}
|
|
6801
6996
|
var Ys = Array.isArray;
|
|
6802
|
-
function
|
|
6803
|
-
return Ys(
|
|
6997
|
+
function Wt(h) {
|
|
6998
|
+
return Ys(h);
|
|
6804
6999
|
}
|
|
6805
|
-
function Zs(
|
|
7000
|
+
function Zs(h) {
|
|
6806
7001
|
{
|
|
6807
|
-
var
|
|
7002
|
+
var m = typeof Symbol == "function" && Symbol.toStringTag, v = m && h[Symbol.toStringTag] || h.constructor.name || "Object";
|
|
6808
7003
|
return v;
|
|
6809
7004
|
}
|
|
6810
7005
|
}
|
|
6811
|
-
function Xs(
|
|
7006
|
+
function Xs(h) {
|
|
6812
7007
|
try {
|
|
6813
|
-
return nr(
|
|
7008
|
+
return nr(h), !1;
|
|
6814
7009
|
} catch {
|
|
6815
7010
|
return !0;
|
|
6816
7011
|
}
|
|
6817
7012
|
}
|
|
6818
|
-
function nr(
|
|
6819
|
-
return "" +
|
|
7013
|
+
function nr(h) {
|
|
7014
|
+
return "" + h;
|
|
6820
7015
|
}
|
|
6821
|
-
function rr(
|
|
6822
|
-
if (Xs(
|
|
6823
|
-
return S("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Zs(
|
|
7016
|
+
function rr(h) {
|
|
7017
|
+
if (Xs(h))
|
|
7018
|
+
return S("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Zs(h)), nr(h);
|
|
6824
7019
|
}
|
|
6825
|
-
var sr =
|
|
7020
|
+
var sr = g.ReactCurrentOwner, ei = {
|
|
6826
7021
|
key: !0,
|
|
6827
7022
|
ref: !0,
|
|
6828
7023
|
__self: !0,
|
|
6829
7024
|
__source: !0
|
|
6830
7025
|
}, ir, or;
|
|
6831
|
-
function ti(
|
|
6832
|
-
if (ze.call(
|
|
6833
|
-
var
|
|
6834
|
-
if (
|
|
7026
|
+
function ti(h) {
|
|
7027
|
+
if (ze.call(h, "ref")) {
|
|
7028
|
+
var m = Object.getOwnPropertyDescriptor(h, "ref").get;
|
|
7029
|
+
if (m && m.isReactWarning)
|
|
6835
7030
|
return !1;
|
|
6836
7031
|
}
|
|
6837
|
-
return
|
|
7032
|
+
return h.ref !== void 0;
|
|
6838
7033
|
}
|
|
6839
|
-
function ni(
|
|
6840
|
-
if (ze.call(
|
|
6841
|
-
var
|
|
6842
|
-
if (
|
|
7034
|
+
function ni(h) {
|
|
7035
|
+
if (ze.call(h, "key")) {
|
|
7036
|
+
var m = Object.getOwnPropertyDescriptor(h, "key").get;
|
|
7037
|
+
if (m && m.isReactWarning)
|
|
6843
7038
|
return !1;
|
|
6844
7039
|
}
|
|
6845
|
-
return
|
|
7040
|
+
return h.key !== void 0;
|
|
6846
7041
|
}
|
|
6847
|
-
function ri(
|
|
6848
|
-
typeof
|
|
7042
|
+
function ri(h, m) {
|
|
7043
|
+
typeof h.ref == "string" && sr.current;
|
|
6849
7044
|
}
|
|
6850
|
-
function si(
|
|
7045
|
+
function si(h, m) {
|
|
6851
7046
|
{
|
|
6852
7047
|
var v = function() {
|
|
6853
|
-
ir || (ir = !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)",
|
|
7048
|
+
ir || (ir = !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)", m));
|
|
6854
7049
|
};
|
|
6855
|
-
v.isReactWarning = !0, Object.defineProperty(
|
|
7050
|
+
v.isReactWarning = !0, Object.defineProperty(h, "key", {
|
|
6856
7051
|
get: v,
|
|
6857
7052
|
configurable: !0
|
|
6858
7053
|
});
|
|
6859
7054
|
}
|
|
6860
7055
|
}
|
|
6861
|
-
function ii(
|
|
7056
|
+
function ii(h, m) {
|
|
6862
7057
|
{
|
|
6863
7058
|
var v = function() {
|
|
6864
|
-
or || (or = !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)",
|
|
7059
|
+
or || (or = !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)", m));
|
|
6865
7060
|
};
|
|
6866
|
-
v.isReactWarning = !0, Object.defineProperty(
|
|
7061
|
+
v.isReactWarning = !0, Object.defineProperty(h, "ref", {
|
|
6867
7062
|
get: v,
|
|
6868
7063
|
configurable: !0
|
|
6869
7064
|
});
|
|
6870
7065
|
}
|
|
6871
7066
|
}
|
|
6872
|
-
var oi = function(
|
|
7067
|
+
var oi = function(h, m, v, A, M, j, P) {
|
|
6873
7068
|
var C = {
|
|
6874
7069
|
// This tag allows us to uniquely identify this as a React Element
|
|
6875
7070
|
$$typeof: n,
|
|
6876
7071
|
// Built-in properties that belong on the element
|
|
6877
|
-
type:
|
|
6878
|
-
key:
|
|
7072
|
+
type: h,
|
|
7073
|
+
key: m,
|
|
6879
7074
|
ref: v,
|
|
6880
|
-
props:
|
|
7075
|
+
props: P,
|
|
6881
7076
|
// Record the component responsible for creating this element.
|
|
6882
|
-
_owner:
|
|
7077
|
+
_owner: j
|
|
6883
7078
|
};
|
|
6884
7079
|
return C._store = {}, Object.defineProperty(C._store, "validated", {
|
|
6885
7080
|
configurable: !1,
|
|
@@ -6898,165 +7093,165 @@ function lu() {
|
|
|
6898
7093
|
value: M
|
|
6899
7094
|
}), Object.freeze && (Object.freeze(C.props), Object.freeze(C)), C;
|
|
6900
7095
|
};
|
|
6901
|
-
function ai(
|
|
7096
|
+
function ai(h, m, v, A, M) {
|
|
6902
7097
|
{
|
|
6903
|
-
var
|
|
6904
|
-
v !== void 0 && (rr(v), C = "" + v), ni(
|
|
6905
|
-
for (
|
|
6906
|
-
ze.call(
|
|
6907
|
-
if (
|
|
6908
|
-
var D =
|
|
6909
|
-
for (
|
|
6910
|
-
|
|
7098
|
+
var j, P = {}, C = null, G = null;
|
|
7099
|
+
v !== void 0 && (rr(v), C = "" + v), ni(m) && (rr(m.key), C = "" + m.key), ti(m) && (G = m.ref, ri(m, M));
|
|
7100
|
+
for (j in m)
|
|
7101
|
+
ze.call(m, j) && !ei.hasOwnProperty(j) && (P[j] = m[j]);
|
|
7102
|
+
if (h && h.defaultProps) {
|
|
7103
|
+
var D = h.defaultProps;
|
|
7104
|
+
for (j in D)
|
|
7105
|
+
P[j] === void 0 && (P[j] = D[j]);
|
|
6911
7106
|
}
|
|
6912
7107
|
if (C || G) {
|
|
6913
|
-
var
|
|
6914
|
-
C && si(
|
|
7108
|
+
var N = typeof h == "function" ? h.displayName || h.name || "Unknown" : h;
|
|
7109
|
+
C && si(P, N), G && ii(P, N);
|
|
6915
7110
|
}
|
|
6916
|
-
return oi(
|
|
7111
|
+
return oi(h, C, G, M, A, sr.current, P);
|
|
6917
7112
|
}
|
|
6918
7113
|
}
|
|
6919
|
-
var
|
|
6920
|
-
function
|
|
6921
|
-
if (
|
|
6922
|
-
var
|
|
7114
|
+
var qt = g.ReactCurrentOwner, ar = g.ReactDebugCurrentFrame;
|
|
7115
|
+
function Ie(h) {
|
|
7116
|
+
if (h) {
|
|
7117
|
+
var m = h._owner, v = dt(h.type, h._source, m ? m.type : null);
|
|
6923
7118
|
ar.setExtraStackFrame(v);
|
|
6924
7119
|
} else
|
|
6925
7120
|
ar.setExtraStackFrame(null);
|
|
6926
7121
|
}
|
|
6927
7122
|
var zt;
|
|
6928
7123
|
zt = !1;
|
|
6929
|
-
function Vt(
|
|
6930
|
-
return typeof
|
|
7124
|
+
function Vt(h) {
|
|
7125
|
+
return typeof h == "object" && h !== null && h.$$typeof === n;
|
|
6931
7126
|
}
|
|
6932
7127
|
function cr() {
|
|
6933
7128
|
{
|
|
6934
|
-
if (
|
|
6935
|
-
var
|
|
6936
|
-
if (
|
|
7129
|
+
if (qt.current) {
|
|
7130
|
+
var h = ie(qt.current.type);
|
|
7131
|
+
if (h)
|
|
6937
7132
|
return `
|
|
6938
7133
|
|
|
6939
|
-
Check the render method of \`` +
|
|
7134
|
+
Check the render method of \`` + h + "`.";
|
|
6940
7135
|
}
|
|
6941
7136
|
return "";
|
|
6942
7137
|
}
|
|
6943
7138
|
}
|
|
6944
|
-
function ci(
|
|
7139
|
+
function ci(h) {
|
|
6945
7140
|
return "";
|
|
6946
7141
|
}
|
|
6947
7142
|
var ur = {};
|
|
6948
|
-
function ui(
|
|
7143
|
+
function ui(h) {
|
|
6949
7144
|
{
|
|
6950
|
-
var
|
|
6951
|
-
if (!
|
|
6952
|
-
var v = typeof
|
|
6953
|
-
v && (
|
|
7145
|
+
var m = cr();
|
|
7146
|
+
if (!m) {
|
|
7147
|
+
var v = typeof h == "string" ? h : h.displayName || h.name;
|
|
7148
|
+
v && (m = `
|
|
6954
7149
|
|
|
6955
7150
|
Check the top-level render call using <` + v + ">.");
|
|
6956
7151
|
}
|
|
6957
|
-
return
|
|
7152
|
+
return m;
|
|
6958
7153
|
}
|
|
6959
7154
|
}
|
|
6960
|
-
function lr(
|
|
7155
|
+
function lr(h, m) {
|
|
6961
7156
|
{
|
|
6962
|
-
if (!
|
|
7157
|
+
if (!h._store || h._store.validated || h.key != null)
|
|
6963
7158
|
return;
|
|
6964
|
-
|
|
6965
|
-
var v = ui(
|
|
7159
|
+
h._store.validated = !0;
|
|
7160
|
+
var v = ui(m);
|
|
6966
7161
|
if (ur[v])
|
|
6967
7162
|
return;
|
|
6968
7163
|
ur[v] = !0;
|
|
6969
7164
|
var A = "";
|
|
6970
|
-
|
|
7165
|
+
h && h._owner && h._owner !== qt.current && (A = " It was passed a child from " + ie(h._owner.type) + "."), Ie(h), 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), Ie(null);
|
|
6971
7166
|
}
|
|
6972
7167
|
}
|
|
6973
|
-
function fr(
|
|
7168
|
+
function fr(h, m) {
|
|
6974
7169
|
{
|
|
6975
|
-
if (typeof
|
|
7170
|
+
if (typeof h != "object")
|
|
6976
7171
|
return;
|
|
6977
|
-
if (
|
|
6978
|
-
for (var v = 0; v <
|
|
6979
|
-
var A =
|
|
6980
|
-
Vt(A) && lr(A,
|
|
7172
|
+
if (Wt(h))
|
|
7173
|
+
for (var v = 0; v < h.length; v++) {
|
|
7174
|
+
var A = h[v];
|
|
7175
|
+
Vt(A) && lr(A, m);
|
|
6981
7176
|
}
|
|
6982
|
-
else if (Vt(
|
|
6983
|
-
|
|
6984
|
-
else if (
|
|
6985
|
-
var M =
|
|
6986
|
-
if (typeof M == "function" && M !==
|
|
6987
|
-
for (var
|
|
6988
|
-
Vt(
|
|
7177
|
+
else if (Vt(h))
|
|
7178
|
+
h._store && (h._store.validated = !0);
|
|
7179
|
+
else if (h) {
|
|
7180
|
+
var M = T(h);
|
|
7181
|
+
if (typeof M == "function" && M !== h.entries)
|
|
7182
|
+
for (var j = M.call(h), P; !(P = j.next()).done; )
|
|
7183
|
+
Vt(P.value) && lr(P.value, m);
|
|
6989
7184
|
}
|
|
6990
7185
|
}
|
|
6991
7186
|
}
|
|
6992
|
-
function li(
|
|
7187
|
+
function li(h) {
|
|
6993
7188
|
{
|
|
6994
|
-
var
|
|
6995
|
-
if (
|
|
7189
|
+
var m = h.type;
|
|
7190
|
+
if (m == null || typeof m == "string")
|
|
6996
7191
|
return;
|
|
6997
7192
|
var v;
|
|
6998
|
-
if (typeof
|
|
6999
|
-
v =
|
|
7000
|
-
else if (typeof
|
|
7193
|
+
if (typeof m == "function")
|
|
7194
|
+
v = m.propTypes;
|
|
7195
|
+
else if (typeof m == "object" && (m.$$typeof === u || // Note: Memo only checks outer props here.
|
|
7001
7196
|
// Inner props are checked in the reconciler.
|
|
7002
|
-
|
|
7003
|
-
v =
|
|
7197
|
+
m.$$typeof === d))
|
|
7198
|
+
v = m.propTypes;
|
|
7004
7199
|
else
|
|
7005
7200
|
return;
|
|
7006
7201
|
if (v) {
|
|
7007
|
-
var A = ie(
|
|
7008
|
-
Js(v,
|
|
7009
|
-
} else if (
|
|
7202
|
+
var A = ie(m);
|
|
7203
|
+
Js(v, h.props, "prop", A, h);
|
|
7204
|
+
} else if (m.PropTypes !== void 0 && !zt) {
|
|
7010
7205
|
zt = !0;
|
|
7011
|
-
var M = ie(
|
|
7206
|
+
var M = ie(m);
|
|
7012
7207
|
S("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", M || "Unknown");
|
|
7013
7208
|
}
|
|
7014
|
-
typeof
|
|
7209
|
+
typeof m.getDefaultProps == "function" && !m.getDefaultProps.isReactClassApproved && S("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
|
|
7015
7210
|
}
|
|
7016
7211
|
}
|
|
7017
|
-
function fi(
|
|
7212
|
+
function fi(h) {
|
|
7018
7213
|
{
|
|
7019
|
-
for (var
|
|
7020
|
-
var A =
|
|
7214
|
+
for (var m = Object.keys(h.props), v = 0; v < m.length; v++) {
|
|
7215
|
+
var A = m[v];
|
|
7021
7216
|
if (A !== "children" && A !== "key") {
|
|
7022
|
-
|
|
7217
|
+
Ie(h), S("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", A), Ie(null);
|
|
7023
7218
|
break;
|
|
7024
7219
|
}
|
|
7025
7220
|
}
|
|
7026
|
-
|
|
7221
|
+
h.ref !== null && (Ie(h), S("Invalid attribute `ref` supplied to `React.Fragment`."), Ie(null));
|
|
7027
7222
|
}
|
|
7028
7223
|
}
|
|
7029
7224
|
var dr = {};
|
|
7030
|
-
function hr(
|
|
7225
|
+
function hr(h, m, v, A, M, j) {
|
|
7031
7226
|
{
|
|
7032
|
-
var
|
|
7033
|
-
if (!
|
|
7227
|
+
var P = Ut(h);
|
|
7228
|
+
if (!P) {
|
|
7034
7229
|
var C = "";
|
|
7035
|
-
(
|
|
7230
|
+
(h === void 0 || typeof h == "object" && h !== null && Object.keys(h).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.");
|
|
7036
7231
|
var G = ci();
|
|
7037
7232
|
G ? C += G : C += cr();
|
|
7038
7233
|
var D;
|
|
7039
|
-
|
|
7234
|
+
h === null ? D = "null" : Wt(h) ? D = "array" : h !== void 0 && h.$$typeof === n ? (D = "<" + (ie(h.type) || "Unknown") + " />", C = " Did you accidentally export a JSX literal instead of a component?") : D = typeof h, 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);
|
|
7040
7235
|
}
|
|
7041
|
-
var
|
|
7042
|
-
if (
|
|
7043
|
-
return
|
|
7044
|
-
if (
|
|
7045
|
-
var re =
|
|
7236
|
+
var N = ai(h, m, v, M, j);
|
|
7237
|
+
if (N == null)
|
|
7238
|
+
return N;
|
|
7239
|
+
if (P) {
|
|
7240
|
+
var re = m.children;
|
|
7046
7241
|
if (re !== void 0)
|
|
7047
7242
|
if (A)
|
|
7048
|
-
if (
|
|
7049
|
-
for (var
|
|
7050
|
-
fr(re[
|
|
7243
|
+
if (Wt(re)) {
|
|
7244
|
+
for (var Pe = 0; Pe < re.length; Pe++)
|
|
7245
|
+
fr(re[Pe], h);
|
|
7051
7246
|
Object.freeze && Object.freeze(re);
|
|
7052
7247
|
} else
|
|
7053
7248
|
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.");
|
|
7054
7249
|
else
|
|
7055
|
-
fr(re,
|
|
7250
|
+
fr(re, h);
|
|
7056
7251
|
}
|
|
7057
|
-
if (ze.call(
|
|
7058
|
-
var we = ie(
|
|
7059
|
-
return
|
|
7252
|
+
if (ze.call(m, "key")) {
|
|
7253
|
+
var we = ie(h), J = Object.keys(m).filter(function(_i) {
|
|
7254
|
+
return _i !== "key";
|
|
7060
7255
|
}), Bt = J.length > 0 ? "{key: someKey, " + J.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
7061
7256
|
if (!dr[we + Bt]) {
|
|
7062
7257
|
var bi = J.length > 0 ? "{" + J.join(": ..., ") + ": ...}" : "{}";
|
|
@@ -7068,23 +7263,23 @@ React keys must be passed directly to JSX without using spread:
|
|
|
7068
7263
|
<%s key={someKey} {...props} />`, Bt, we, bi, we), dr[we + Bt] = !0;
|
|
7069
7264
|
}
|
|
7070
7265
|
}
|
|
7071
|
-
return
|
|
7266
|
+
return h === s ? fi(N) : li(N), N;
|
|
7072
7267
|
}
|
|
7073
7268
|
}
|
|
7074
|
-
function di(
|
|
7075
|
-
return hr(
|
|
7269
|
+
function di(h, m, v) {
|
|
7270
|
+
return hr(h, m, v, !0);
|
|
7076
7271
|
}
|
|
7077
|
-
function hi(
|
|
7078
|
-
return hr(
|
|
7272
|
+
function hi(h, m, v) {
|
|
7273
|
+
return hr(h, m, v, !1);
|
|
7079
7274
|
}
|
|
7080
7275
|
var pi = hi, yi = di;
|
|
7081
7276
|
Ge.Fragment = s, Ge.jsx = pi, Ge.jsxs = yi;
|
|
7082
7277
|
}(), Ge;
|
|
7083
7278
|
}
|
|
7084
|
-
var
|
|
7085
|
-
|
|
7086
|
-
var V =
|
|
7087
|
-
const
|
|
7279
|
+
var yu = {};
|
|
7280
|
+
yu.NODE_ENV === "production" ? Tn.exports = hu() : Tn.exports = pu();
|
|
7281
|
+
var V = Tn.exports;
|
|
7282
|
+
const bu = {
|
|
7088
7283
|
isLoading: !0,
|
|
7089
7284
|
data: void 0,
|
|
7090
7285
|
pageInfo: void 0,
|
|
@@ -7099,9 +7294,9 @@ function Hr(t) {
|
|
|
7099
7294
|
...t || {}
|
|
7100
7295
|
};
|
|
7101
7296
|
}
|
|
7102
|
-
function
|
|
7297
|
+
function _u(t, e, n) {
|
|
7103
7298
|
e && n && "ruleParams" in n && (e = { $$ruleParams: n.ruleParams, ...e });
|
|
7104
|
-
const r = e ?
|
|
7299
|
+
const r = e ? cu(e) : null, s = q(r), i = it(Hr(t._reactor.getPreviousResult(r))), o = ge(
|
|
7105
7300
|
(c) => (i.current = Hr(t._reactor.getPreviousResult(r)), c(), r ? t.subscribeQuery(r, (l) => {
|
|
7106
7301
|
i.current = {
|
|
7107
7302
|
isLoading: !l,
|
|
@@ -7118,9 +7313,9 @@ function hu(t, e, n) {
|
|
|
7118
7313
|
// Build a new subscribe function if the query changes
|
|
7119
7314
|
[s]
|
|
7120
7315
|
);
|
|
7121
|
-
return { state: tn(o, () => i.current, () =>
|
|
7316
|
+
return { state: tn(o, () => i.current, () => bu), query: r };
|
|
7122
7317
|
}
|
|
7123
|
-
function
|
|
7318
|
+
function gu() {
|
|
7124
7319
|
const t = it(null);
|
|
7125
7320
|
Oe(() => {
|
|
7126
7321
|
n();
|
|
@@ -7133,15 +7328,15 @@ function pu() {
|
|
|
7133
7328
|
}
|
|
7134
7329
|
return { set: e, clear: n };
|
|
7135
7330
|
}
|
|
7136
|
-
const
|
|
7137
|
-
function
|
|
7331
|
+
const wu = 1e3;
|
|
7332
|
+
function mu(t, e, n) {
|
|
7138
7333
|
const r = it(n);
|
|
7139
7334
|
r.current = n, Oe(() => t.core._reactor.subscribeTopic(t.id, e, (i, o) => {
|
|
7140
7335
|
r.current(i, o);
|
|
7141
7336
|
}), [t.id, e]);
|
|
7142
7337
|
}
|
|
7143
|
-
function
|
|
7144
|
-
return Oe(() => t.core._reactor.joinRoom(t.id), [t.id]),
|
|
7338
|
+
function Tu(t, e) {
|
|
7339
|
+
return Oe(() => t.core._reactor.joinRoom(t.id), [t.id]), ge((r) => {
|
|
7145
7340
|
t.core._reactor.publishTopic({
|
|
7146
7341
|
roomType: t.type,
|
|
7147
7342
|
roomId: t.id,
|
|
@@ -7150,7 +7345,7 @@ function gu(t, e) {
|
|
|
7150
7345
|
});
|
|
7151
7346
|
}, [t.id, e]);
|
|
7152
7347
|
}
|
|
7153
|
-
function
|
|
7348
|
+
function Su(t, e = {}) {
|
|
7154
7349
|
var o, a;
|
|
7155
7350
|
const [n, r] = ns(() => t.core._reactor.getPresence(t.type, t.id, e) ?? {
|
|
7156
7351
|
peers: {},
|
|
@@ -7159,7 +7354,7 @@ function _u(t, e = {}) {
|
|
|
7159
7354
|
Oe(() => t.core._reactor.subscribePresence(t.type, t.id, e, (u) => {
|
|
7160
7355
|
r(u);
|
|
7161
7356
|
}), [t.id, e.user, (o = e.peers) == null ? void 0 : o.join(), (a = e.keys) == null ? void 0 : a.join()]);
|
|
7162
|
-
const s =
|
|
7357
|
+
const s = ge((c) => {
|
|
7163
7358
|
t.core._reactor.publishPresence(t.type, t.id, c);
|
|
7164
7359
|
}, [t.type, t.id]);
|
|
7165
7360
|
return nn(() => ({
|
|
@@ -7167,27 +7362,27 @@ function _u(t, e = {}) {
|
|
|
7167
7362
|
publishPresence: s
|
|
7168
7363
|
}), [n, s]);
|
|
7169
7364
|
}
|
|
7170
|
-
function
|
|
7365
|
+
function vu(t, e, n) {
|
|
7171
7366
|
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)]);
|
|
7172
7367
|
}
|
|
7173
|
-
function
|
|
7174
|
-
const r =
|
|
7368
|
+
function Eu(t, e, n = {}) {
|
|
7369
|
+
const r = gu(), s = Te.usePresence(t, {
|
|
7175
7370
|
keys: [e]
|
|
7176
7371
|
}), i = nn(() => {
|
|
7177
7372
|
const l = t._core._reactor.getPresence(t.type, t.id);
|
|
7178
7373
|
return n != null && n.writeOnly ? [] : Object.values((l == null ? void 0 : l.peers) ?? {}).filter((f) => f[e] === !0);
|
|
7179
|
-
}, [n == null ? void 0 : n.writeOnly, s]), o =
|
|
7374
|
+
}, [n == null ? void 0 : n.writeOnly, s]), o = ge((l) => {
|
|
7180
7375
|
t.core._reactor.publishPresence(t.type, t.id, {
|
|
7181
7376
|
[e]: l
|
|
7182
|
-
}), l && ((n == null ? void 0 : n.timeout) === null || (n == null ? void 0 : n.timeout) === 0 || r.set((n == null ? void 0 : n.timeout) ??
|
|
7377
|
+
}), l && ((n == null ? void 0 : n.timeout) === null || (n == null ? void 0 : n.timeout) === 0 || r.set((n == null ? void 0 : n.timeout) ?? wu, () => {
|
|
7183
7378
|
t.core._reactor.publishPresence(t.type, t.id, {
|
|
7184
7379
|
[e]: null
|
|
7185
7380
|
});
|
|
7186
7381
|
}));
|
|
7187
|
-
}, [t.type, t.id, e, n == null ? void 0 : n.timeout, r]), a =
|
|
7188
|
-
const
|
|
7189
|
-
o(
|
|
7190
|
-
}, [n.stopOnEnter, o]), c =
|
|
7382
|
+
}, [t.type, t.id, e, n == null ? void 0 : n.timeout, r]), a = ge((l) => {
|
|
7383
|
+
const d = !((n == null ? void 0 : n.stopOnEnter) && l.key === "Enter");
|
|
7384
|
+
o(d);
|
|
7385
|
+
}, [n.stopOnEnter, o]), c = ge(() => {
|
|
7191
7386
|
o(!1);
|
|
7192
7387
|
}, [o]), u = nn(() => ({ onKeyDown: a, onBlur: c }), [a, c]);
|
|
7193
7388
|
return {
|
|
@@ -7196,14 +7391,14 @@ function Tu(t, e, n = {}) {
|
|
|
7196
7391
|
inputProps: u
|
|
7197
7392
|
};
|
|
7198
7393
|
}
|
|
7199
|
-
const
|
|
7200
|
-
useTopicEffect:
|
|
7201
|
-
usePublishTopic:
|
|
7202
|
-
usePresence:
|
|
7203
|
-
useSyncPresence:
|
|
7204
|
-
useTypingIndicator:
|
|
7394
|
+
const Te = {
|
|
7395
|
+
useTopicEffect: mu,
|
|
7396
|
+
usePublishTopic: Tu,
|
|
7397
|
+
usePresence: Su,
|
|
7398
|
+
useSyncPresence: vu,
|
|
7399
|
+
useTypingIndicator: Eu
|
|
7205
7400
|
};
|
|
7206
|
-
class
|
|
7401
|
+
class Ou {
|
|
7207
7402
|
constructor(e, n, r) {
|
|
7208
7403
|
p(this, "core");
|
|
7209
7404
|
/** @deprecated use `core` instead */
|
|
@@ -7225,7 +7420,7 @@ class mu {
|
|
|
7225
7420
|
* db.rooms.useTopicEffect(room, 'emoji', (message, peer) => { });
|
|
7226
7421
|
*/
|
|
7227
7422
|
p(this, "useTopicEffect", (e, n) => {
|
|
7228
|
-
|
|
7423
|
+
Te.useTopicEffect(this, e, n);
|
|
7229
7424
|
});
|
|
7230
7425
|
/**
|
|
7231
7426
|
* @deprecated
|
|
@@ -7241,7 +7436,7 @@ class mu {
|
|
|
7241
7436
|
* const room = db.room('chat', 'room-id');
|
|
7242
7437
|
* const publish = db.rooms.usePublishTopic(room, 'emoji');
|
|
7243
7438
|
*/
|
|
7244
|
-
p(this, "usePublishTopic", (e) =>
|
|
7439
|
+
p(this, "usePublishTopic", (e) => Te.usePublishTopic(this, e));
|
|
7245
7440
|
/**
|
|
7246
7441
|
* @deprecated
|
|
7247
7442
|
* `db.room(...).usePresence` is deprecated. You can replace it with `db.rooms.usePresence`.
|
|
@@ -7256,7 +7451,7 @@ class mu {
|
|
|
7256
7451
|
* const room = db.room('chat', 'room-id');
|
|
7257
7452
|
* const { peers } = db.rooms.usePresence(room, { keys: ["name", "avatar"] });
|
|
7258
7453
|
*/
|
|
7259
|
-
p(this, "usePresence", (e = {}) =>
|
|
7454
|
+
p(this, "usePresence", (e = {}) => Te.usePresence(this, e));
|
|
7260
7455
|
/**
|
|
7261
7456
|
* @deprecated
|
|
7262
7457
|
* `db.room(...).useSyncPresence` is deprecated. You can replace it with `db.rooms.useSyncPresence`.
|
|
@@ -7271,7 +7466,7 @@ class mu {
|
|
|
7271
7466
|
* const room = db.room('chat', 'room-id');
|
|
7272
7467
|
* db.rooms.useSyncPresence(room, { nickname });
|
|
7273
7468
|
*/
|
|
7274
|
-
p(this, "useSyncPresence", (e, n) =>
|
|
7469
|
+
p(this, "useSyncPresence", (e, n) => Te.useSyncPresence(this, e, n));
|
|
7275
7470
|
/**
|
|
7276
7471
|
* @deprecated
|
|
7277
7472
|
* `db.room(...).useTypingIndicator` is deprecated. You can replace it with `db.rooms.useTypingIndicator`.
|
|
@@ -7286,11 +7481,11 @@ class mu {
|
|
|
7286
7481
|
* const room = db.room('chat', 'room-id');
|
|
7287
7482
|
* const typing = db.rooms.useTypingIndiactor(room, 'chat-input');
|
|
7288
7483
|
*/
|
|
7289
|
-
p(this, "useTypingIndicator", (e, n = {}) =>
|
|
7484
|
+
p(this, "useTypingIndicator", (e, n = {}) => Te.useTypingIndicator(this, e, n));
|
|
7290
7485
|
this.core = e, this._core = this.core, this.type = n, this.id = r;
|
|
7291
7486
|
}
|
|
7292
7487
|
}
|
|
7293
|
-
const
|
|
7488
|
+
const Au = {
|
|
7294
7489
|
isLoading: !0,
|
|
7295
7490
|
user: void 0,
|
|
7296
7491
|
error: void 0
|
|
@@ -7344,7 +7539,7 @@ class vt {
|
|
|
7344
7539
|
* const publish = db.rooms.usePublishTopic(room, 'emoji');
|
|
7345
7540
|
* // ...
|
|
7346
7541
|
*/
|
|
7347
|
-
p(this, "rooms",
|
|
7542
|
+
p(this, "rooms", Te);
|
|
7348
7543
|
/**
|
|
7349
7544
|
* Use this to write data! You can create, update, delete, and link objects
|
|
7350
7545
|
*
|
|
@@ -7393,7 +7588,7 @@ class vt {
|
|
|
7393
7588
|
* auth.user ? { goals: {} } : null,
|
|
7394
7589
|
* );
|
|
7395
7590
|
*/
|
|
7396
|
-
p(this, "useQuery", (e, n) =>
|
|
7591
|
+
p(this, "useQuery", (e, n) => _u(this.core, e, n).state);
|
|
7397
7592
|
/**
|
|
7398
7593
|
* Listen for the logged in state. This is useful
|
|
7399
7594
|
* for deciding when to show a login screen.
|
|
@@ -7466,7 +7661,7 @@ class vt {
|
|
|
7466
7661
|
* }
|
|
7467
7662
|
*/
|
|
7468
7663
|
p(this, "useConnectionStatus", () => {
|
|
7469
|
-
const e = it(this.core._reactor.status), n =
|
|
7664
|
+
const e = it(this.core._reactor.status), n = ge((s) => this.core.subscribeConnectionStatus((o) => {
|
|
7470
7665
|
o !== e.current && (e.current = o, s());
|
|
7471
7666
|
}), []);
|
|
7472
7667
|
return tn(
|
|
@@ -7518,7 +7713,7 @@ class vt {
|
|
|
7518
7713
|
const n = this.useAuth();
|
|
7519
7714
|
return n.isLoading || n.error || n.user ? null : V.jsx(V.Fragment, { children: e });
|
|
7520
7715
|
});
|
|
7521
|
-
this.core =
|
|
7716
|
+
this.core = fu(
|
|
7522
7717
|
e,
|
|
7523
7718
|
// @ts-expect-error because TS can't resolve subclass statics
|
|
7524
7719
|
e.Store || this.constructor.Store,
|
|
@@ -7542,13 +7737,13 @@ class vt {
|
|
|
7542
7737
|
* const { peers } = db.rooms.usePresence(room);
|
|
7543
7738
|
*/
|
|
7544
7739
|
room(e = "_defaultRoomType", n = "_defaultRoomId") {
|
|
7545
|
-
return new
|
|
7740
|
+
return new Ou(this.core, e, n);
|
|
7546
7741
|
}
|
|
7547
7742
|
_useAuth() {
|
|
7548
|
-
const e = it(this.core._reactor._currentUserCached), n =
|
|
7743
|
+
const e = it(this.core._reactor._currentUserCached), n = ge((s) => this.core.subscribeAuth((o) => {
|
|
7549
7744
|
e.current = { isLoading: !1, ...o }, s();
|
|
7550
7745
|
}), []);
|
|
7551
|
-
return tn(n, () => e.current, () =>
|
|
7746
|
+
return tn(n, () => e.current, () => Au);
|
|
7552
7747
|
}
|
|
7553
7748
|
/**
|
|
7554
7749
|
* One time query for the logged in state. This is useful
|
|
@@ -7572,38 +7767,38 @@ class Jr extends Error {
|
|
|
7572
7767
|
}
|
|
7573
7768
|
function en(t) {
|
|
7574
7769
|
}
|
|
7575
|
-
function
|
|
7770
|
+
function ku(t) {
|
|
7576
7771
|
if (typeof t == "function")
|
|
7577
7772
|
throw new TypeError(
|
|
7578
7773
|
"`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?"
|
|
7579
7774
|
);
|
|
7580
7775
|
const { onEvent: e = en, onError: n = en, onRetry: r = en, onComment: s } = t;
|
|
7581
7776
|
let i = "", o = !0, a, c = "", u = "";
|
|
7582
|
-
function l(
|
|
7583
|
-
const w = o ?
|
|
7584
|
-
for (const S of
|
|
7777
|
+
function l(_) {
|
|
7778
|
+
const w = o ? _.replace(/^\xEF\xBB\xBF/, "") : _, [T, g] = Cu(`${i}${w}`);
|
|
7779
|
+
for (const S of T)
|
|
7585
7780
|
f(S);
|
|
7586
|
-
i =
|
|
7781
|
+
i = g, o = !1;
|
|
7587
7782
|
}
|
|
7588
|
-
function f(
|
|
7589
|
-
if (
|
|
7783
|
+
function f(_) {
|
|
7784
|
+
if (_ === "") {
|
|
7590
7785
|
y();
|
|
7591
7786
|
return;
|
|
7592
7787
|
}
|
|
7593
|
-
if (
|
|
7594
|
-
s && s(
|
|
7788
|
+
if (_.startsWith(":")) {
|
|
7789
|
+
s && s(_.slice(_.startsWith(": ") ? 2 : 1));
|
|
7595
7790
|
return;
|
|
7596
7791
|
}
|
|
7597
|
-
const w =
|
|
7792
|
+
const w = _.indexOf(":");
|
|
7598
7793
|
if (w !== -1) {
|
|
7599
|
-
const
|
|
7600
|
-
|
|
7794
|
+
const T = _.slice(0, w), g = _[w + 1] === " " ? 2 : 1, S = _.slice(w + g);
|
|
7795
|
+
d(T, S, _);
|
|
7601
7796
|
return;
|
|
7602
7797
|
}
|
|
7603
|
-
|
|
7798
|
+
d(_, "", _);
|
|
7604
7799
|
}
|
|
7605
|
-
function
|
|
7606
|
-
switch (
|
|
7800
|
+
function d(_, w, T) {
|
|
7801
|
+
switch (_) {
|
|
7607
7802
|
case "event":
|
|
7608
7803
|
u = w;
|
|
7609
7804
|
break;
|
|
@@ -7619,15 +7814,15 @@ function vu(t) {
|
|
|
7619
7814
|
new Jr(`Invalid \`retry\` value: "${w}"`, {
|
|
7620
7815
|
type: "invalid-retry",
|
|
7621
7816
|
value: w,
|
|
7622
|
-
line:
|
|
7817
|
+
line: T
|
|
7623
7818
|
})
|
|
7624
7819
|
);
|
|
7625
7820
|
break;
|
|
7626
7821
|
default:
|
|
7627
7822
|
n(
|
|
7628
7823
|
new Jr(
|
|
7629
|
-
`Unknown field "${
|
|
7630
|
-
{ type: "unknown-field", field:
|
|
7824
|
+
`Unknown field "${_.length > 20 ? `${_.slice(0, 20)}…` : _}"`,
|
|
7825
|
+
{ type: "unknown-field", field: _, value: w, line: T }
|
|
7631
7826
|
)
|
|
7632
7827
|
);
|
|
7633
7828
|
break;
|
|
@@ -7643,12 +7838,12 @@ function vu(t) {
|
|
|
7643
7838
|
`) ? c.slice(0, -1) : c
|
|
7644
7839
|
}), a = void 0, c = "", u = "";
|
|
7645
7840
|
}
|
|
7646
|
-
function b(
|
|
7647
|
-
i &&
|
|
7841
|
+
function b(_ = {}) {
|
|
7842
|
+
i && _.consume && f(i), o = !0, a = void 0, c = "", u = "", i = "";
|
|
7648
7843
|
}
|
|
7649
7844
|
return { feed: l, reset: b };
|
|
7650
7845
|
}
|
|
7651
|
-
function
|
|
7846
|
+
function Cu(t) {
|
|
7652
7847
|
const e = [];
|
|
7653
7848
|
let n = "", r = 0;
|
|
7654
7849
|
for (; r < t.length; ) {
|
|
@@ -7708,7 +7903,7 @@ class Yr extends Event {
|
|
|
7708
7903
|
return e(Zr(this), n);
|
|
7709
7904
|
}
|
|
7710
7905
|
}
|
|
7711
|
-
function
|
|
7906
|
+
function Iu(t) {
|
|
7712
7907
|
const e = globalThis.DOMException;
|
|
7713
7908
|
return typeof e == "function" ? new e(t, "SyntaxError") : new SyntaxError(t);
|
|
7714
7909
|
}
|
|
@@ -7725,21 +7920,21 @@ function Zr(t) {
|
|
|
7725
7920
|
timeStamp: t.timeStamp
|
|
7726
7921
|
};
|
|
7727
7922
|
}
|
|
7728
|
-
var
|
|
7923
|
+
var qs = (t) => {
|
|
7729
7924
|
throw TypeError(t);
|
|
7730
|
-
}, zn = (t, e, n) => e.has(t) ||
|
|
7925
|
+
}, zn = (t, e, n) => e.has(t) || qs("Cannot " + n), k = (t, e, n) => (zn(t, e, "read from private field"), n ? n.call(t) : e.get(t)), W = (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) => (zn(t, e, "write to private field"), e.set(t, n), n), he = (t, e, n) => (zn(t, e, "access private method"), n), Y, Se, Re, Et, Mt, rt, $e, st, _e, je, Ue, xe, Ze, oe, vn, En, On, Xr, An, kn, Xe, Cn, In;
|
|
7731
7926
|
class Ot extends EventTarget {
|
|
7732
7927
|
constructor(e, n) {
|
|
7733
7928
|
var r, s;
|
|
7734
|
-
super(),
|
|
7929
|
+
super(), W(this, oe), this.CONNECTING = 0, this.OPEN = 1, this.CLOSED = 2, W(this, Y), W(this, Se), W(this, Re), W(this, Et), W(this, Mt), W(this, rt), W(this, $e), W(this, st, null), W(this, _e), W(this, je), W(this, Ue, null), W(this, xe, null), W(this, Ze, null), W(this, En, async (i) => {
|
|
7735
7930
|
var o;
|
|
7736
|
-
k(this,
|
|
7931
|
+
k(this, je).reset();
|
|
7737
7932
|
const { body: a, redirected: c, status: u, headers: l } = i;
|
|
7738
7933
|
if (u === 204) {
|
|
7739
7934
|
he(this, oe, Xe).call(this, "Server sent HTTP 204, not reconnecting", 204), this.close();
|
|
7740
7935
|
return;
|
|
7741
7936
|
}
|
|
7742
|
-
if (c ? $(this,
|
|
7937
|
+
if (c ? $(this, Re, new URL(i.url)) : $(this, Re, void 0), u !== 200) {
|
|
7743
7938
|
he(this, oe, Xe).call(this, `Non-200 status code (${u})`, u);
|
|
7744
7939
|
return;
|
|
7745
7940
|
}
|
|
@@ -7755,38 +7950,38 @@ class Ot extends EventTarget {
|
|
|
7755
7950
|
he(this, oe, Xe).call(this, "Invalid response body, expected a web ReadableStream", u), this.close();
|
|
7756
7951
|
return;
|
|
7757
7952
|
}
|
|
7758
|
-
const
|
|
7953
|
+
const d = new TextDecoder(), y = a.getReader();
|
|
7759
7954
|
let b = !0;
|
|
7760
7955
|
do {
|
|
7761
|
-
const { done:
|
|
7762
|
-
w && k(this,
|
|
7956
|
+
const { done: _, value: w } = await y.read();
|
|
7957
|
+
w && k(this, je).feed(d.decode(w, { stream: !_ })), _ && (b = !1, k(this, je).reset(), he(this, oe, Cn).call(this));
|
|
7763
7958
|
} while (b);
|
|
7764
|
-
}),
|
|
7765
|
-
$(this,
|
|
7766
|
-
}),
|
|
7959
|
+
}), W(this, On, (i) => {
|
|
7960
|
+
$(this, _e, void 0), !(i.name === "AbortError" || i.type === "aborted") && he(this, oe, Cn).call(this, Sn(i));
|
|
7961
|
+
}), W(this, An, (i) => {
|
|
7767
7962
|
typeof i.id == "string" && $(this, st, i.id);
|
|
7768
7963
|
const o = new MessageEvent(i.event || "message", {
|
|
7769
7964
|
data: i.data,
|
|
7770
|
-
origin: k(this,
|
|
7965
|
+
origin: k(this, Re) ? k(this, Re).origin : k(this, Se).origin,
|
|
7771
7966
|
lastEventId: i.id || ""
|
|
7772
7967
|
});
|
|
7773
7968
|
k(this, xe) && (!i.event || i.event === "message") && k(this, xe).call(this, o), this.dispatchEvent(o);
|
|
7774
|
-
}),
|
|
7969
|
+
}), W(this, kn, (i) => {
|
|
7775
7970
|
$(this, rt, i);
|
|
7776
|
-
}),
|
|
7971
|
+
}), W(this, In, () => {
|
|
7777
7972
|
$(this, $e, void 0), k(this, Y) === this.CONNECTING && he(this, oe, vn).call(this);
|
|
7778
7973
|
});
|
|
7779
7974
|
try {
|
|
7780
7975
|
if (e instanceof URL)
|
|
7781
7976
|
$(this, Se, e);
|
|
7782
7977
|
else if (typeof e == "string")
|
|
7783
|
-
$(this, Se, new URL(e,
|
|
7978
|
+
$(this, Se, new URL(e, Pu()));
|
|
7784
7979
|
else
|
|
7785
7980
|
throw new Error("Invalid URL");
|
|
7786
7981
|
} catch {
|
|
7787
|
-
throw
|
|
7982
|
+
throw Iu("An invalid or illegal string was specified");
|
|
7788
7983
|
}
|
|
7789
|
-
$(this,
|
|
7984
|
+
$(this, je, ku({
|
|
7790
7985
|
onEvent: k(this, An),
|
|
7791
7986
|
onRetry: k(this, kn)
|
|
7792
7987
|
})), $(this, Y, this.CONNECTING), $(this, rt, 3e3), $(this, Mt, (r = n == null ? void 0 : n.fetch) != null ? r : globalThis.fetch), $(this, Et, (s = n == null ? void 0 : n.withCredentials) != null ? s : !1), he(this, oe, vn).call(this);
|
|
@@ -7859,16 +8054,16 @@ class Ot extends EventTarget {
|
|
|
7859
8054
|
* @public
|
|
7860
8055
|
*/
|
|
7861
8056
|
close() {
|
|
7862
|
-
k(this, $e) && clearTimeout(k(this, $e)), k(this, Y) !== this.CLOSED && (k(this,
|
|
8057
|
+
k(this, $e) && clearTimeout(k(this, $e)), k(this, Y) !== this.CLOSED && (k(this, _e) && k(this, _e).abort(), $(this, Y, this.CLOSED), $(this, _e, void 0));
|
|
7863
8058
|
}
|
|
7864
8059
|
}
|
|
7865
|
-
Y = /* @__PURE__ */ new WeakMap(), Se = /* @__PURE__ */ new WeakMap(),
|
|
8060
|
+
Y = /* @__PURE__ */ new WeakMap(), Se = /* @__PURE__ */ new WeakMap(), Re = /* @__PURE__ */ new WeakMap(), Et = /* @__PURE__ */ new WeakMap(), Mt = /* @__PURE__ */ new WeakMap(), rt = /* @__PURE__ */ new WeakMap(), $e = /* @__PURE__ */ new WeakMap(), st = /* @__PURE__ */ new WeakMap(), _e = /* @__PURE__ */ new WeakMap(), je = /* @__PURE__ */ new WeakMap(), Ue = /* @__PURE__ */ new WeakMap(), xe = /* @__PURE__ */ new WeakMap(), Ze = /* @__PURE__ */ new WeakMap(), oe = /* @__PURE__ */ new WeakSet(), /**
|
|
7866
8061
|
* Connect to the given URL and start receiving events
|
|
7867
8062
|
*
|
|
7868
8063
|
* @internal
|
|
7869
8064
|
*/
|
|
7870
8065
|
vn = function() {
|
|
7871
|
-
$(this, Y, this.CONNECTING), $(this,
|
|
8066
|
+
$(this, Y, this.CONNECTING), $(this, _e, new AbortController()), k(this, Mt)(k(this, Se), he(this, oe, Xr).call(this)).then(k(this, En)).catch(k(this, On));
|
|
7872
8067
|
}, En = /* @__PURE__ */ new WeakMap(), On = /* @__PURE__ */ new WeakMap(), /**
|
|
7873
8068
|
* Get request options for the `fetch()` request
|
|
7874
8069
|
*
|
|
@@ -7884,7 +8079,7 @@ Xr = function() {
|
|
|
7884
8079
|
redirect: "follow",
|
|
7885
8080
|
headers: { Accept: "text/event-stream", ...k(this, st) ? { "Last-Event-ID": k(this, st) } : void 0 },
|
|
7886
8081
|
cache: "no-store",
|
|
7887
|
-
signal: (t = k(this,
|
|
8082
|
+
signal: (t = k(this, _e)) == null ? void 0 : t.signal
|
|
7888
8083
|
};
|
|
7889
8084
|
return "window" in globalThis && (e.credentials = this.withCredentials ? "include" : "same-origin"), e;
|
|
7890
8085
|
}, An = /* @__PURE__ */ new WeakMap(), kn = /* @__PURE__ */ new WeakMap(), /**
|
|
@@ -7912,8 +8107,8 @@ Cn = function(t, e) {
|
|
|
7912
8107
|
return;
|
|
7913
8108
|
$(this, Y, this.CONNECTING);
|
|
7914
8109
|
const r = new Yr("error", { code: e, message: t });
|
|
7915
|
-
(n = k(this, Ue)) == null || n.call(this, r), this.dispatchEvent(r), $(this, $e, setTimeout(k(this,
|
|
7916
|
-
},
|
|
8110
|
+
(n = k(this, Ue)) == null || n.call(this, r), this.dispatchEvent(r), $(this, $e, setTimeout(k(this, In), k(this, rt)));
|
|
8111
|
+
}, In = /* @__PURE__ */ new WeakMap(), /**
|
|
7917
8112
|
* ReadyState representing an EventSource currently trying to connect
|
|
7918
8113
|
*
|
|
7919
8114
|
* @public
|
|
@@ -7929,24 +8124,24 @@ Ot.OPEN = 1, /**
|
|
|
7929
8124
|
* @public
|
|
7930
8125
|
*/
|
|
7931
8126
|
Ot.CLOSED = 2;
|
|
7932
|
-
function
|
|
8127
|
+
function Pu() {
|
|
7933
8128
|
const t = "document" in globalThis ? globalThis.document : void 0;
|
|
7934
8129
|
return t && typeof t == "object" && "baseURI" in t && typeof t.baseURI == "string" ? t.baseURI : void 0;
|
|
7935
8130
|
}
|
|
7936
8131
|
class zs extends vt {
|
|
7937
8132
|
}
|
|
7938
8133
|
p(zs, "EventSourceImpl", Ot);
|
|
7939
|
-
function
|
|
8134
|
+
function Mu(t) {
|
|
7940
8135
|
const e = {
|
|
7941
8136
|
...t,
|
|
7942
8137
|
useDateObjects: t.useDateObjects ?? !1
|
|
7943
8138
|
};
|
|
7944
8139
|
return new zs(e, {
|
|
7945
|
-
"@instantdb/react":
|
|
8140
|
+
"@instantdb/react": qn
|
|
7946
8141
|
});
|
|
7947
8142
|
}
|
|
7948
|
-
const
|
|
7949
|
-
function
|
|
8143
|
+
const Nu = Mu;
|
|
8144
|
+
function Ku({
|
|
7950
8145
|
as: t = "div",
|
|
7951
8146
|
spaceId: e,
|
|
7952
8147
|
room: n,
|
|
@@ -7960,51 +8155,51 @@ function Uu({
|
|
|
7960
8155
|
}) {
|
|
7961
8156
|
const l = e || `cursors-space-default--${String(n.type)}-${n.id}`, f = n.usePresence({
|
|
7962
8157
|
keys: [l]
|
|
7963
|
-
}),
|
|
7964
|
-
function y(
|
|
7965
|
-
const O = S.clientX, E = S.clientY,
|
|
8158
|
+
}), d = n._core._reactor.getPresence(n.type, n.id);
|
|
8159
|
+
function y(g, S) {
|
|
8160
|
+
const O = S.clientX, E = S.clientY, R = (O - g.left) / g.width * 100, F = (E - g.top) / g.height * 100;
|
|
7966
8161
|
f.publishPresence({
|
|
7967
8162
|
[l]: {
|
|
7968
8163
|
x: O,
|
|
7969
8164
|
y: E,
|
|
7970
|
-
xPercent:
|
|
7971
|
-
yPercent:
|
|
8165
|
+
xPercent: R,
|
|
8166
|
+
yPercent: F,
|
|
7972
8167
|
color: i
|
|
7973
8168
|
}
|
|
7974
8169
|
});
|
|
7975
8170
|
}
|
|
7976
|
-
function b(
|
|
7977
|
-
c ||
|
|
7978
|
-
const S =
|
|
7979
|
-
y(S,
|
|
8171
|
+
function b(g) {
|
|
8172
|
+
c || g.stopPropagation();
|
|
8173
|
+
const S = g.currentTarget.getBoundingClientRect();
|
|
8174
|
+
y(S, g);
|
|
7980
8175
|
}
|
|
7981
|
-
function g
|
|
8176
|
+
function _(g) {
|
|
7982
8177
|
f.publishPresence({
|
|
7983
8178
|
[l]: void 0
|
|
7984
8179
|
});
|
|
7985
8180
|
}
|
|
7986
|
-
function w(
|
|
7987
|
-
if (
|
|
8181
|
+
function w(g) {
|
|
8182
|
+
if (g.touches.length !== 1)
|
|
7988
8183
|
return;
|
|
7989
|
-
const S =
|
|
8184
|
+
const S = g.touches[0];
|
|
7990
8185
|
if (S.target instanceof Element) {
|
|
7991
|
-
c ||
|
|
8186
|
+
c || g.stopPropagation();
|
|
7992
8187
|
const O = S.target.getBoundingClientRect();
|
|
7993
8188
|
y(O, S);
|
|
7994
8189
|
}
|
|
7995
8190
|
}
|
|
7996
|
-
function
|
|
8191
|
+
function T(g) {
|
|
7997
8192
|
f.publishPresence({
|
|
7998
8193
|
[l]: void 0
|
|
7999
8194
|
});
|
|
8000
8195
|
}
|
|
8001
|
-
return
|
|
8196
|
+
return mi(
|
|
8002
8197
|
t,
|
|
8003
8198
|
{
|
|
8004
8199
|
onMouseMove: b,
|
|
8005
|
-
onMouseOut:
|
|
8200
|
+
onMouseOut: _,
|
|
8006
8201
|
onTouchMove: w,
|
|
8007
|
-
onTouchEnd:
|
|
8202
|
+
onTouchEnd: T,
|
|
8008
8203
|
className: r,
|
|
8009
8204
|
style: {
|
|
8010
8205
|
position: "relative",
|
|
@@ -8018,10 +8213,10 @@ function Uu({
|
|
|
8018
8213
|
{
|
|
8019
8214
|
style: {
|
|
8020
8215
|
...es,
|
|
8021
|
-
...
|
|
8022
|
-
zIndex: u !== void 0 ? u :
|
|
8216
|
+
...ju,
|
|
8217
|
+
zIndex: u !== void 0 ? u : xu
|
|
8023
8218
|
},
|
|
8024
|
-
children: Object.entries(f.peers).map(([
|
|
8219
|
+
children: Object.entries(f.peers).map(([g, S]) => {
|
|
8025
8220
|
const O = S[l];
|
|
8026
8221
|
return O ? /* @__PURE__ */ V.jsx(
|
|
8027
8222
|
"div",
|
|
@@ -8034,10 +8229,10 @@ function Uu({
|
|
|
8034
8229
|
},
|
|
8035
8230
|
children: a ? a({
|
|
8036
8231
|
color: O.color,
|
|
8037
|
-
presence:
|
|
8038
|
-
}) : /* @__PURE__ */ V.jsx(
|
|
8232
|
+
presence: d == null ? void 0 : d.peers[g]
|
|
8233
|
+
}) : /* @__PURE__ */ V.jsx(Ru, { ...O })
|
|
8039
8234
|
},
|
|
8040
|
-
|
|
8235
|
+
g
|
|
8041
8236
|
) : null;
|
|
8042
8237
|
})
|
|
8043
8238
|
},
|
|
@@ -8046,7 +8241,7 @@ function Uu({
|
|
|
8046
8241
|
]
|
|
8047
8242
|
);
|
|
8048
8243
|
}
|
|
8049
|
-
function
|
|
8244
|
+
function Ru({ color: t }) {
|
|
8050
8245
|
const n = t || "black";
|
|
8051
8246
|
return /* @__PURE__ */ V.jsxs(
|
|
8052
8247
|
"svg",
|
|
@@ -8099,23 +8294,23 @@ const es = {
|
|
|
8099
8294
|
left: 0,
|
|
8100
8295
|
bottom: 0,
|
|
8101
8296
|
right: 0
|
|
8102
|
-
},
|
|
8297
|
+
}, ju = {
|
|
8103
8298
|
overflow: "hidden",
|
|
8104
8299
|
pointerEvents: "none",
|
|
8105
8300
|
userSelect: "none"
|
|
8106
|
-
},
|
|
8301
|
+
}, xu = 99999;
|
|
8107
8302
|
export {
|
|
8108
|
-
|
|
8303
|
+
Ku as Cursors,
|
|
8109
8304
|
xt as InstantAPIError,
|
|
8110
8305
|
vt as InstantReactAbstractDatabase,
|
|
8111
8306
|
zs as InstantReactWebDatabase,
|
|
8112
8307
|
Fa as StoreInterface,
|
|
8113
|
-
|
|
8114
|
-
|
|
8115
|
-
|
|
8116
|
-
|
|
8117
|
-
|
|
8118
|
-
|
|
8308
|
+
me as SyncTableCallbackEventType,
|
|
8309
|
+
Fu as createInstantRouteHandler,
|
|
8310
|
+
Lu as i,
|
|
8311
|
+
L as id,
|
|
8312
|
+
Mu as init,
|
|
8313
|
+
Nu as init_experimental,
|
|
8119
8314
|
la as lookup,
|
|
8120
|
-
|
|
8315
|
+
Uu as tx
|
|
8121
8316
|
};
|