@instantdb/react 0.22.56-experimental.persisted-object-2.19512376560.1 → 0.22.56-experimental.persisted-object-2.19516969593.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 +1284 -1256
- package/dist/standalone/index.umd.cjs +13 -13
- package/package.json +4 -4
package/dist/standalone/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import ui, { useRef as At, useCallback as ge, useSyncExternalStore as nn, useEffect as je, useMemo as rn, useState as ci, createElement as As } from "react";
|
|
2
2
|
function V(t) {
|
|
3
3
|
if (typeof t == "number")
|
|
4
4
|
return (Math.abs(t * 2654435761) >>> 0).toString(16);
|
|
@@ -41,7 +41,7 @@ const U = {
|
|
|
41
41
|
Remove: "remove",
|
|
42
42
|
Replace: "replace",
|
|
43
43
|
Add: "add"
|
|
44
|
-
},
|
|
44
|
+
}, di = Symbol.for("__MUTATIVE_PROXY_DRAFT__"), ks = Symbol("__MUTATIVE_RAW_RETURN_SYMBOL__"), wt = Symbol.iterator, ne = {
|
|
45
45
|
mutable: "mutable",
|
|
46
46
|
immutable: "immutable"
|
|
47
47
|
}, Rn = {};
|
|
@@ -73,7 +73,7 @@ function Ce(t) {
|
|
|
73
73
|
return !!j(t);
|
|
74
74
|
}
|
|
75
75
|
function j(t) {
|
|
76
|
-
return typeof t != "object" ? null : t == null ? void 0 : t[
|
|
76
|
+
return typeof t != "object" ? null : t == null ? void 0 : t[di];
|
|
77
77
|
}
|
|
78
78
|
function Dn(t) {
|
|
79
79
|
var e;
|
|
@@ -86,7 +86,7 @@ function ae(t, e) {
|
|
|
86
86
|
let n;
|
|
87
87
|
return Object.getPrototypeOf(t) === Object.prototype || Array.isArray(t) || t instanceof Map || t instanceof Set || !!(e != null && e.mark) && ((n = e.mark(t, ne)) === ne.immutable || typeof n == "function");
|
|
88
88
|
}
|
|
89
|
-
function
|
|
89
|
+
function fi(t, e = []) {
|
|
90
90
|
if (Object.hasOwnProperty.call(t, "key")) {
|
|
91
91
|
const n = t.parent.copy, r = j(be(n, t.key));
|
|
92
92
|
if (r !== null && (r == null ? void 0 : r.original) !== t.original)
|
|
@@ -97,10 +97,10 @@ function di(t, e = []) {
|
|
|
97
97
|
e.push(s);
|
|
98
98
|
}
|
|
99
99
|
if (t.parent)
|
|
100
|
-
return
|
|
100
|
+
return fi(t.parent, e);
|
|
101
101
|
e.reverse();
|
|
102
102
|
try {
|
|
103
|
-
|
|
103
|
+
js(t.copy, e);
|
|
104
104
|
} catch {
|
|
105
105
|
return null;
|
|
106
106
|
}
|
|
@@ -133,7 +133,7 @@ function Ae(t, e) {
|
|
|
133
133
|
return r.indexOf("/") === -1 && r.indexOf("~") === -1 ? r : r.replace(/~/g, "~0").replace(/\//g, "~1");
|
|
134
134
|
}).join("/");
|
|
135
135
|
}
|
|
136
|
-
function
|
|
136
|
+
function js(t, e) {
|
|
137
137
|
for (let n = 0; n < e.length - 1; n += 1) {
|
|
138
138
|
const r = e[n];
|
|
139
139
|
if (t = be(Pe(t) === 3 ? Array.from(t) : t, r), typeof t != "object")
|
|
@@ -141,7 +141,7 @@ function ks(t, e) {
|
|
|
141
141
|
}
|
|
142
142
|
return t;
|
|
143
143
|
}
|
|
144
|
-
function
|
|
144
|
+
function Cs(t) {
|
|
145
145
|
const e = Object.create(Object.getPrototypeOf(t));
|
|
146
146
|
return Reflect.ownKeys(t).forEach((n) => {
|
|
147
147
|
let r = Reflect.getOwnPropertyDescriptor(t, n);
|
|
@@ -157,8 +157,8 @@ function js(t) {
|
|
|
157
157
|
}), Reflect.defineProperty(e, n, r);
|
|
158
158
|
}), e;
|
|
159
159
|
}
|
|
160
|
-
const
|
|
161
|
-
function
|
|
160
|
+
const Ps = Object.prototype.propertyIsEnumerable;
|
|
161
|
+
function li(t, e) {
|
|
162
162
|
let n;
|
|
163
163
|
if (Array.isArray(t))
|
|
164
164
|
return Array.prototype.concat.call(t);
|
|
@@ -176,7 +176,7 @@ function fi(t, e) {
|
|
|
176
176
|
return new Map(t);
|
|
177
177
|
} else if (e != null && e.mark && (n = e.mark(t, ne), n !== void 0) && n !== ne.mutable) {
|
|
178
178
|
if (n === ne.immutable)
|
|
179
|
-
return
|
|
179
|
+
return Cs(t);
|
|
180
180
|
if (typeof n == "function") {
|
|
181
181
|
if (e.enablePatches || e.enableAutoFreeze)
|
|
182
182
|
throw new Error("You can't use mark and patches or auto freeze together.");
|
|
@@ -188,13 +188,13 @@ function fi(t, e) {
|
|
|
188
188
|
return Object.keys(t).forEach((i) => {
|
|
189
189
|
r[i] = t[i];
|
|
190
190
|
}), Object.getOwnPropertySymbols(t).forEach((i) => {
|
|
191
|
-
|
|
191
|
+
Ps.call(t, i) && (r[i] = t[i]);
|
|
192
192
|
}), r;
|
|
193
193
|
} else
|
|
194
194
|
throw new Error("Please check mark() to ensure that it is a stable marker draftable function.");
|
|
195
195
|
}
|
|
196
196
|
function Q(t) {
|
|
197
|
-
t.copy || (t.copy =
|
|
197
|
+
t.copy || (t.copy = li(t.original, t.options));
|
|
198
198
|
}
|
|
199
199
|
function Je(t) {
|
|
200
200
|
if (!ae(t))
|
|
@@ -294,7 +294,7 @@ function Un(t, e) {
|
|
|
294
294
|
} else
|
|
295
295
|
t.forEach((r, i) => e(i, r, t));
|
|
296
296
|
}
|
|
297
|
-
function
|
|
297
|
+
function hi(t, e, n) {
|
|
298
298
|
if (Ce(t) || !ae(t, n) || e.has(t) || Object.isFrozen(t))
|
|
299
299
|
return;
|
|
300
300
|
const r = t instanceof Set, i = r ? /* @__PURE__ */ new Map() : void 0;
|
|
@@ -306,7 +306,7 @@ function li(t, e, n) {
|
|
|
306
306
|
const c = !((a = u.assignedMap) === null || a === void 0) && a.size || u.operated ? u.copy : u.original;
|
|
307
307
|
at(r ? i : t, s, c);
|
|
308
308
|
} else
|
|
309
|
-
|
|
309
|
+
hi(o, e, n);
|
|
310
310
|
}), i) {
|
|
311
311
|
const s = t, o = Array.from(s);
|
|
312
312
|
s.clear(), o.forEach((a) => {
|
|
@@ -314,9 +314,9 @@ function li(t, e, n) {
|
|
|
314
314
|
});
|
|
315
315
|
}
|
|
316
316
|
}
|
|
317
|
-
function
|
|
317
|
+
function Is(t, e) {
|
|
318
318
|
const n = t.type === 3 ? t.setMap : t.copy;
|
|
319
|
-
t.finalities.revoke.length > 1 && t.assignedMap.get(e) && n &&
|
|
319
|
+
t.finalities.revoke.length > 1 && t.assignedMap.get(e) && n && hi(be(n, e), t.finalities.handledSet, t.options);
|
|
320
320
|
}
|
|
321
321
|
function on(t) {
|
|
322
322
|
t.type === 3 && t.copy && (t.copy.clear(), t.setMap.forEach((e) => {
|
|
@@ -326,7 +326,7 @@ function on(t) {
|
|
|
326
326
|
function an(t, e, n, r) {
|
|
327
327
|
if (t.operated && t.assignedMap && t.assignedMap.size > 0 && !t.finalized) {
|
|
328
328
|
if (n && r) {
|
|
329
|
-
const s =
|
|
329
|
+
const s = fi(t);
|
|
330
330
|
s && e(t, s, n, r);
|
|
331
331
|
}
|
|
332
332
|
t.finalized = !0;
|
|
@@ -343,10 +343,10 @@ function Ln(t, e, n, r) {
|
|
|
343
343
|
}
|
|
344
344
|
}), t.options.enableAutoFreeze && i.finalities !== t.finalities && (t.options.enableAutoFreeze = !1)), ae(n, t.options) && t.finalities.draft.push(() => {
|
|
345
345
|
const s = t.type === 3 ? t.setMap : t.copy;
|
|
346
|
-
ye(be(s, e), n) &&
|
|
346
|
+
ye(be(s, e), n) && Is(t, e);
|
|
347
347
|
});
|
|
348
348
|
}
|
|
349
|
-
function
|
|
349
|
+
function Ms(t, e, n, r, i) {
|
|
350
350
|
let { original: s, assignedMap: o, options: a } = t, u = t.copy;
|
|
351
351
|
u.length < s.length && ([s, u] = [u, s], [n, r] = [r, n]);
|
|
352
352
|
for (let c = 0; c < s.length; c += 1)
|
|
@@ -392,7 +392,7 @@ function Is(t, e, n, r, i) {
|
|
|
392
392
|
}
|
|
393
393
|
}
|
|
394
394
|
}
|
|
395
|
-
function
|
|
395
|
+
function Rs({ original: t, copy: e, assignedMap: n }, r, i, s, o) {
|
|
396
396
|
n.forEach((a, u) => {
|
|
397
397
|
const c = be(t, u), d = mt(be(e, u)), f = a ? nt(t, u) ? U.Replace : U.Add : U.Remove;
|
|
398
398
|
if (ye(c, d) && f === U.Replace)
|
|
@@ -401,7 +401,7 @@ function Ms({ original: t, copy: e, assignedMap: n }, r, i, s, o) {
|
|
|
401
401
|
i.push(f === U.Remove ? { op: f, path: p } : { op: f, path: p, value: d }), s.push(f === U.Add ? { op: U.Remove, path: p } : f === U.Remove ? { op: U.Add, path: p, value: c } : { op: U.Replace, path: p, value: c });
|
|
402
402
|
});
|
|
403
403
|
}
|
|
404
|
-
function
|
|
404
|
+
function xs({ original: t, copy: e }, n, r, i, s) {
|
|
405
405
|
let o = 0;
|
|
406
406
|
t.forEach((a) => {
|
|
407
407
|
if (!e.has(a)) {
|
|
@@ -438,11 +438,11 @@ function ot(t, e, n, r) {
|
|
|
438
438
|
switch (t.type) {
|
|
439
439
|
case 0:
|
|
440
440
|
case 2:
|
|
441
|
-
return
|
|
441
|
+
return Rs(t, e, n, r, i);
|
|
442
442
|
case 1:
|
|
443
|
-
return
|
|
443
|
+
return Ms(t, e, n, r, i);
|
|
444
444
|
case 3:
|
|
445
|
-
return
|
|
445
|
+
return xs(t, e, n, r, i);
|
|
446
446
|
}
|
|
447
447
|
}
|
|
448
448
|
const kt = (t, e, n = !1) => {
|
|
@@ -529,7 +529,7 @@ const kt = (t, e, n = !1) => {
|
|
|
529
529
|
[wt]() {
|
|
530
530
|
return this.entries();
|
|
531
531
|
}
|
|
532
|
-
},
|
|
532
|
+
}, $s = Reflect.ownKeys(un), mr = (t, e, { isValuesIterator: n }) => () => {
|
|
533
533
|
var r, i;
|
|
534
534
|
const s = e.next();
|
|
535
535
|
if (s.done)
|
|
@@ -640,13 +640,13 @@ Set.prototype.difference && Object.assign(jt, {
|
|
|
640
640
|
return Set.prototype.isDisjointFrom.call(new Set(this.values()), t);
|
|
641
641
|
}
|
|
642
642
|
});
|
|
643
|
-
const
|
|
643
|
+
const Ds = Reflect.ownKeys(jt), pi = /* @__PURE__ */ new WeakSet(), yi = {
|
|
644
644
|
get(t, e, n) {
|
|
645
645
|
var r, i;
|
|
646
646
|
const s = (r = t.copy) === null || r === void 0 ? void 0 : r[e];
|
|
647
|
-
if (s &&
|
|
647
|
+
if (s && pi.has(s))
|
|
648
648
|
return s;
|
|
649
|
-
if (e ===
|
|
649
|
+
if (e === di)
|
|
650
650
|
return t;
|
|
651
651
|
let o;
|
|
652
652
|
if (t.options.mark) {
|
|
@@ -655,14 +655,14 @@ const $s = Reflect.ownKeys(jt), hi = /* @__PURE__ */ new WeakSet(), pi = {
|
|
|
655
655
|
return t.options.strict && kt(c, t.options, !0), c;
|
|
656
656
|
}
|
|
657
657
|
const a = te(t);
|
|
658
|
-
if (a instanceof Map &&
|
|
658
|
+
if (a instanceof Map && $s.includes(e)) {
|
|
659
659
|
if (e === "size")
|
|
660
660
|
return Object.getOwnPropertyDescriptor(un, "size").get.call(t.proxy);
|
|
661
661
|
const c = un[e];
|
|
662
662
|
if (c)
|
|
663
663
|
return c.bind(t.proxy);
|
|
664
664
|
}
|
|
665
|
-
if (a instanceof Set &&
|
|
665
|
+
if (a instanceof Set && Ds.includes(e)) {
|
|
666
666
|
if (e === "size")
|
|
667
667
|
return Object.getOwnPropertyDescriptor(jt, "size").get.call(t.proxy);
|
|
668
668
|
const c = jt[e];
|
|
@@ -733,7 +733,7 @@ const $s = Reflect.ownKeys(jt), hi = /* @__PURE__ */ new WeakSet(), pi = {
|
|
|
733
733
|
},
|
|
734
734
|
deleteProperty(t, e) {
|
|
735
735
|
var n;
|
|
736
|
-
return t.type === 1 ?
|
|
736
|
+
return t.type === 1 ? yi.set.call(this, t, e, void 0, t.proxy) : (Qt(t.original, e) !== void 0 || e in t.original ? (Q(t), fe(t), t.assignedMap.set(e, !1)) : (t.assignedMap = (n = t.assignedMap) !== null && n !== void 0 ? n : /* @__PURE__ */ new Map(), t.assignedMap.delete(e)), t.copy && delete t.copy[e], !0);
|
|
737
737
|
}
|
|
738
738
|
};
|
|
739
739
|
function Fn(t) {
|
|
@@ -750,8 +750,8 @@ function Fn(t) {
|
|
|
750
750
|
setMap: o === 3 ? new Map(e.entries()) : void 0
|
|
751
751
|
};
|
|
752
752
|
(r || "key" in t) && (a.key = r);
|
|
753
|
-
const { proxy: u, revoke: c } = Proxy.revocable(o === 1 ? Object.assign([], a) : a,
|
|
754
|
-
if (i.revoke.push(c),
|
|
753
|
+
const { proxy: u, revoke: c } = Proxy.revocable(o === 1 ? Object.assign([], a) : a, yi);
|
|
754
|
+
if (i.revoke.push(c), pi.add(u), a.proxy = u, n) {
|
|
755
755
|
const d = n;
|
|
756
756
|
d.finalities.draft.push((f, l) => {
|
|
757
757
|
var p, y;
|
|
@@ -775,7 +775,7 @@ function Fn(t) {
|
|
|
775
775
|
return u;
|
|
776
776
|
}
|
|
777
777
|
Rn.createDraft = Fn;
|
|
778
|
-
function
|
|
778
|
+
function Us(t, e, n, r, i) {
|
|
779
779
|
var s;
|
|
780
780
|
const o = j(t), a = (s = o == null ? void 0 : o.original) !== null && s !== void 0 ? s : t, u = !!e.length;
|
|
781
781
|
if (o != null && o.operated)
|
|
@@ -788,7 +788,7 @@ function Ds(t, e, n, r, i) {
|
|
|
788
788
|
r && u ? [{ op: U.Replace, path: [], value: a }] : r
|
|
789
789
|
];
|
|
790
790
|
}
|
|
791
|
-
function
|
|
791
|
+
function Ls(t, e) {
|
|
792
792
|
var n;
|
|
793
793
|
const r = {
|
|
794
794
|
draft: [],
|
|
@@ -806,7 +806,7 @@ function Us(t, e) {
|
|
|
806
806
|
return [
|
|
807
807
|
a,
|
|
808
808
|
(u = []) => {
|
|
809
|
-
const [c, d, f] =
|
|
809
|
+
const [c, d, f] = Us(a, u, i, s, e.enableAutoFreeze);
|
|
810
810
|
return e.enablePatches ? [c, d, f] : c;
|
|
811
811
|
}
|
|
812
812
|
];
|
|
@@ -826,7 +826,7 @@ function cn(t) {
|
|
|
826
826
|
} else typeof o == "object" && o !== null && (t.value = o, t.isRoot = !1, cn(t));
|
|
827
827
|
}), i && (t.isContainDraft || console.warn("The return value does not contain any draft, please use 'rawReturn()' to wrap the return value to improve performance."), r && console.warn("The return value contains drafts, please don't use 'rawReturn()' to wrap the return value."));
|
|
828
828
|
}
|
|
829
|
-
function
|
|
829
|
+
function bi(t) {
|
|
830
830
|
var e;
|
|
831
831
|
const n = j(t);
|
|
832
832
|
if (!ae(t, n == null ? void 0 : n.options))
|
|
@@ -836,7 +836,7 @@ function yi(t) {
|
|
|
836
836
|
return n.original;
|
|
837
837
|
let i;
|
|
838
838
|
function s() {
|
|
839
|
-
i = r === 2 ? $n(t) ? new Map(t) : new (Object.getPrototypeOf(t)).constructor(t) : r === 3 ? Array.from(n.setMap.values()) :
|
|
839
|
+
i = r === 2 ? $n(t) ? new Map(t) : new (Object.getPrototypeOf(t)).constructor(t) : r === 3 ? Array.from(n.setMap.values()) : li(t, n == null ? void 0 : n.options);
|
|
840
840
|
}
|
|
841
841
|
if (n) {
|
|
842
842
|
n.finalized = !0;
|
|
@@ -850,7 +850,7 @@ function yi(t) {
|
|
|
850
850
|
if (Un(i, (o, a) => {
|
|
851
851
|
if (n && ye(be(n.original, o), a))
|
|
852
852
|
return;
|
|
853
|
-
const u =
|
|
853
|
+
const u = bi(a);
|
|
854
854
|
u !== a && (i === t && s(), at(i, o, u));
|
|
855
855
|
}), r === 3) {
|
|
856
856
|
const o = (e = n == null ? void 0 : n.original) !== null && e !== void 0 ? e : i;
|
|
@@ -861,9 +861,9 @@ function yi(t) {
|
|
|
861
861
|
function vr(t) {
|
|
862
862
|
if (!Ce(t))
|
|
863
863
|
throw new Error(`current() is only used for Draft, parameter: ${t}`);
|
|
864
|
-
return
|
|
864
|
+
return bi(t);
|
|
865
865
|
}
|
|
866
|
-
const
|
|
866
|
+
const Fs = (t) => function e(n, r, i) {
|
|
867
867
|
var s, o, a;
|
|
868
868
|
if (typeof n == "function" && typeof r != "function")
|
|
869
869
|
return function(S, ...I) {
|
|
@@ -890,7 +890,7 @@ const Ls = (t) => function e(n, r, i) {
|
|
|
890
890
|
};
|
|
891
891
|
if (!ae(f, g) && typeof f == "object" && f !== null)
|
|
892
892
|
throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");
|
|
893
|
-
const [w, T] =
|
|
893
|
+
const [w, T] = Ls(f, g);
|
|
894
894
|
if (typeof r != "function") {
|
|
895
895
|
if (!ae(f, g))
|
|
896
896
|
throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");
|
|
@@ -907,7 +907,7 @@ const Ls = (t) => function e(n, r, i) {
|
|
|
907
907
|
if (!Ce(S)) {
|
|
908
908
|
if (S !== void 0 && !ye(S, w) && (I != null && I.operated))
|
|
909
909
|
throw new Error("Either the value is returned as a new non-draft value, or only the draft is modified without returning any value.");
|
|
910
|
-
const q = S == null ? void 0 : S[
|
|
910
|
+
const q = S == null ? void 0 : S[ks];
|
|
911
911
|
if (q) {
|
|
912
912
|
const we = q[0];
|
|
913
913
|
return g.strict && typeof S == "object" && S !== null && cn({
|
|
@@ -932,9 +932,9 @@ const Ls = (t) => function e(n, r, i) {
|
|
|
932
932
|
return m instanceof Promise ? m.then(E, (S) => {
|
|
933
933
|
throw sn(j(w)), S;
|
|
934
934
|
}) : E(m);
|
|
935
|
-
}, Ct =
|
|
935
|
+
}, Ct = Fs();
|
|
936
936
|
Object.prototype.constructor.toString();
|
|
937
|
-
function
|
|
937
|
+
function _i(t, e) {
|
|
938
938
|
const n = Object.keys(t), r = Object.keys(e);
|
|
939
939
|
return n.length === r.length && Object.keys(t).every((i) => e.hasOwnProperty(i));
|
|
940
940
|
}
|
|
@@ -942,7 +942,7 @@ function Sr(t, e) {
|
|
|
942
942
|
return Object.keys(t).length === Object.keys(e).length && Object.keys(t).every((n) => e.hasOwnProperty(n) && t[n] === e[n]);
|
|
943
943
|
}
|
|
944
944
|
function vt(t, e) {
|
|
945
|
-
return typeof t != "object" || typeof e != "object" || t === null || e === null ? t === e :
|
|
945
|
+
return typeof t != "object" || typeof e != "object" || t === null || e === null ? t === e : _i(t, e) ? Object.keys(t).every((n) => vt(t[n], e[n])) : !1;
|
|
946
946
|
}
|
|
947
947
|
function Nn(t) {
|
|
948
948
|
if (!Ze(t))
|
|
@@ -952,7 +952,7 @@ function Nn(t) {
|
|
|
952
952
|
r !== void 0 && (e[n] = r);
|
|
953
953
|
return e;
|
|
954
954
|
}
|
|
955
|
-
function
|
|
955
|
+
function gi(t, e) {
|
|
956
956
|
if (!Ze(t) || !Ze(e))
|
|
957
957
|
return e;
|
|
958
958
|
const n = Object.assign({}, t);
|
|
@@ -964,14 +964,14 @@ function _i(t, e) {
|
|
|
964
964
|
continue;
|
|
965
965
|
}
|
|
966
966
|
const i = Ze(t[r]) && Ze(e[r]);
|
|
967
|
-
n[r] = i ?
|
|
967
|
+
n[r] = i ? gi(t[r], e[r]) : e[r];
|
|
968
968
|
}
|
|
969
969
|
return n;
|
|
970
970
|
}
|
|
971
971
|
function Ze(t) {
|
|
972
972
|
return typeof t == "object" && t !== null && !Array.isArray(t);
|
|
973
973
|
}
|
|
974
|
-
function
|
|
974
|
+
function Ns(t, e, n) {
|
|
975
975
|
if (!t || e.length === 0)
|
|
976
976
|
return;
|
|
977
977
|
let r = t || {};
|
|
@@ -992,7 +992,7 @@ function Or(t, e, n) {
|
|
|
992
992
|
}
|
|
993
993
|
r[e[e.length - 1]] = n;
|
|
994
994
|
}
|
|
995
|
-
function
|
|
995
|
+
function Ti(t, e) {
|
|
996
996
|
if (!t || e.length === 0)
|
|
997
997
|
return;
|
|
998
998
|
const [n, ...r] = e;
|
|
@@ -1001,13 +1001,13 @@ function gi(t, e) {
|
|
|
1001
1001
|
Array.isArray(t) ? t.splice(n, 1) : delete t[n];
|
|
1002
1002
|
return;
|
|
1003
1003
|
}
|
|
1004
|
-
|
|
1004
|
+
Ti(t[n], r), Ks(t[n]) && delete t[n];
|
|
1005
1005
|
}
|
|
1006
1006
|
}
|
|
1007
|
-
function
|
|
1007
|
+
function Ks(t) {
|
|
1008
1008
|
return t && Object.keys(t).length === 0;
|
|
1009
1009
|
}
|
|
1010
|
-
const Er = /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$/,
|
|
1010
|
+
const Er = /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$/, qs = {
|
|
1011
1011
|
ZULU: 0,
|
|
1012
1012
|
YEKT: 18e3,
|
|
1013
1013
|
YEKST: 21600,
|
|
@@ -1203,39 +1203,39 @@ const Er = /ZULU|YEKT|YEKST|YAPT|YAKT|YAKST|XJT|WGT|WGST|WFT|WETDST|WET|WDT|WAT|
|
|
|
1203
1203
|
ACSST: 37800,
|
|
1204
1204
|
ACDT: 37800
|
|
1205
1205
|
};
|
|
1206
|
-
function
|
|
1206
|
+
function Ws(t) {
|
|
1207
1207
|
return new Date(t);
|
|
1208
1208
|
}
|
|
1209
|
-
function
|
|
1209
|
+
function zs(t) {
|
|
1210
1210
|
return /* @__PURE__ */ new Date(t + "Z");
|
|
1211
1211
|
}
|
|
1212
|
-
const
|
|
1213
|
-
function
|
|
1214
|
-
const e = t.match(
|
|
1212
|
+
const Vs = /^(\d+)[\./-](\d+)[\./-](\d+)$/;
|
|
1213
|
+
function Gs(t) {
|
|
1214
|
+
const e = t.match(Vs);
|
|
1215
1215
|
if (!e)
|
|
1216
1216
|
return null;
|
|
1217
1217
|
const [n, r, i, s] = e;
|
|
1218
1218
|
return r <= 0 || i <= 0 || s <= 0 ? null : r > 999 ? new Date(Date.UTC(r, i - 1, s, 0, 0, 0, 0)) : new Date(Date.UTC(s, r - 1, i, 0, 0, 0, 0));
|
|
1219
1219
|
}
|
|
1220
|
-
function
|
|
1220
|
+
function Bs(t) {
|
|
1221
1221
|
const [e, n] = t.split(" ");
|
|
1222
1222
|
return /* @__PURE__ */ new Date(e + "T" + n + "Z");
|
|
1223
1223
|
}
|
|
1224
|
-
function
|
|
1224
|
+
function Qs(t) {
|
|
1225
1225
|
const [e, n] = t.split(" ");
|
|
1226
1226
|
return /* @__PURE__ */ new Date(e + "T" + n + "Z");
|
|
1227
1227
|
}
|
|
1228
|
-
function
|
|
1228
|
+
function Hs(t) {
|
|
1229
1229
|
return new Date(t);
|
|
1230
1230
|
}
|
|
1231
|
-
function
|
|
1231
|
+
function Ys(t) {
|
|
1232
1232
|
const e = /^(\w{3}) (\w{3}) (\d{2}) (\d{4})$/;
|
|
1233
1233
|
if (!t.match(e))
|
|
1234
1234
|
throw new Error(`Unable to parse \`${t}\` as a date.`);
|
|
1235
1235
|
const r = /* @__PURE__ */ new Date(t + " UTC");
|
|
1236
1236
|
return new Date(Date.UTC(r.getUTCFullYear(), r.getUTCMonth(), r.getUTCDate(), 0, 0, 0, 0));
|
|
1237
1237
|
}
|
|
1238
|
-
function
|
|
1238
|
+
function Js(t) {
|
|
1239
1239
|
const e = /^(.+T.+)([+-])(\d{2})$/, n = t.match(e);
|
|
1240
1240
|
if (n) {
|
|
1241
1241
|
const [, r, i, s] = n, o = `${r}${i}${s}:00`;
|
|
@@ -1243,14 +1243,14 @@ function Ys(t) {
|
|
|
1243
1243
|
}
|
|
1244
1244
|
return null;
|
|
1245
1245
|
}
|
|
1246
|
-
function
|
|
1246
|
+
function Zs(t) {
|
|
1247
1247
|
const [e, n] = t.split(", "), [r, i, s] = e.split("/").map(Number), o = n.match(/(\d{1,2}):(\d{2}):(\d{2}) (AM|PM)/);
|
|
1248
1248
|
if (!o)
|
|
1249
1249
|
throw new Error(`Unable to parse time from: ${t}`);
|
|
1250
1250
|
let [, a, u, c, d] = o;
|
|
1251
1251
|
return a = Number(a), u = Number(u), c = Number(c), d === "PM" && a !== 12 ? a += 12 : d === "AM" && a === 12 && (a = 0), new Date(Date.UTC(s, r - 1, i, a, u, c));
|
|
1252
1252
|
}
|
|
1253
|
-
function
|
|
1253
|
+
function Xs(t) {
|
|
1254
1254
|
switch (t) {
|
|
1255
1255
|
case "epoch":
|
|
1256
1256
|
return /* @__PURE__ */ new Date(0);
|
|
@@ -1262,27 +1262,27 @@ function Zs(t) {
|
|
|
1262
1262
|
return null;
|
|
1263
1263
|
}
|
|
1264
1264
|
}
|
|
1265
|
-
function
|
|
1265
|
+
function eo(t) {
|
|
1266
1266
|
const e = t.match(Er);
|
|
1267
1267
|
if (!e)
|
|
1268
1268
|
return null;
|
|
1269
|
-
const [n] = e, r =
|
|
1269
|
+
const [n] = e, r = qs[n], i = new Date(t.replace(Er, "Z"));
|
|
1270
1270
|
return new Date(i.getTime() - r * 1e3);
|
|
1271
1271
|
}
|
|
1272
|
-
const
|
|
1273
|
-
|
|
1274
|
-
Bs,
|
|
1275
|
-
Hs,
|
|
1276
|
-
Js,
|
|
1272
|
+
const to = [
|
|
1273
|
+
Gs,
|
|
1277
1274
|
Qs,
|
|
1278
|
-
Ws,
|
|
1279
1275
|
Ys,
|
|
1280
|
-
Gs,
|
|
1281
|
-
qs,
|
|
1282
1276
|
Zs,
|
|
1283
|
-
|
|
1277
|
+
Hs,
|
|
1278
|
+
zs,
|
|
1279
|
+
Js,
|
|
1280
|
+
Bs,
|
|
1281
|
+
Ws,
|
|
1282
|
+
Xs,
|
|
1283
|
+
eo
|
|
1284
1284
|
];
|
|
1285
|
-
function
|
|
1285
|
+
function no(t, e) {
|
|
1286
1286
|
try {
|
|
1287
1287
|
const n = t(e);
|
|
1288
1288
|
return n instanceof Date && !isNaN(n.getTime()) ? n : null;
|
|
@@ -1291,14 +1291,14 @@ function to(t, e) {
|
|
|
1291
1291
|
}
|
|
1292
1292
|
}
|
|
1293
1293
|
function dn(t) {
|
|
1294
|
-
for (const e of
|
|
1295
|
-
const n =
|
|
1294
|
+
for (const e of to) {
|
|
1295
|
+
const n = no(e, t);
|
|
1296
1296
|
if (n)
|
|
1297
1297
|
return n;
|
|
1298
1298
|
}
|
|
1299
1299
|
return null;
|
|
1300
1300
|
}
|
|
1301
|
-
function
|
|
1301
|
+
function ro(t) {
|
|
1302
1302
|
try {
|
|
1303
1303
|
const e = JSON.parse(t);
|
|
1304
1304
|
return typeof e == "string" ? dn(e) : null;
|
|
@@ -1313,7 +1313,7 @@ function Rt(t) {
|
|
|
1313
1313
|
if (t instanceof Date)
|
|
1314
1314
|
return t;
|
|
1315
1315
|
if (typeof t == "string") {
|
|
1316
|
-
const e = dn(t) ||
|
|
1316
|
+
const e = dn(t) || ro(t) || dn(t.trim());
|
|
1317
1317
|
if (!e)
|
|
1318
1318
|
throw new Error(`Unable to parse \`${t}\` as a date.`);
|
|
1319
1319
|
return e;
|
|
@@ -1322,7 +1322,7 @@ function Rt(t) {
|
|
|
1322
1322
|
throw new Error(`Invalid date value \`${t}\`. Expected a date, number, or string, got type ${typeof t}.`);
|
|
1323
1323
|
}
|
|
1324
1324
|
}
|
|
1325
|
-
function
|
|
1325
|
+
function io(t) {
|
|
1326
1326
|
return t.cardinality === "one";
|
|
1327
1327
|
}
|
|
1328
1328
|
function Kn(t) {
|
|
@@ -1358,7 +1358,7 @@ function Z(t, e, n) {
|
|
|
1358
1358
|
let s = t.get(r);
|
|
1359
1359
|
s || (s = /* @__PURE__ */ new Map(), t.set(r, s)), Z(s, i, n);
|
|
1360
1360
|
}
|
|
1361
|
-
function
|
|
1361
|
+
function wi(t, e, n) {
|
|
1362
1362
|
const r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map();
|
|
1363
1363
|
for (const o of e) {
|
|
1364
1364
|
let [a, u, c, d] = o;
|
|
@@ -1371,7 +1371,7 @@ function Ti(t, e, n) {
|
|
|
1371
1371
|
}
|
|
1372
1372
|
return { eav: r, aev: i, vae: s };
|
|
1373
1373
|
}
|
|
1374
|
-
function
|
|
1374
|
+
function mi(t) {
|
|
1375
1375
|
const e = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map();
|
|
1376
1376
|
for (const s of Object.values(t)) {
|
|
1377
1377
|
const o = s["forward-identity"], [a, u, c] = o, d = s["reverse-identity"];
|
|
@@ -1382,7 +1382,7 @@ function wi(t) {
|
|
|
1382
1382
|
}
|
|
1383
1383
|
return { blobAttrs: e, primaryKeys: n, forwardIdents: r, revIdents: i };
|
|
1384
1384
|
}
|
|
1385
|
-
function
|
|
1385
|
+
function vi(t) {
|
|
1386
1386
|
return {
|
|
1387
1387
|
__type: t.__type,
|
|
1388
1388
|
attrs: t.attrs,
|
|
@@ -1392,18 +1392,18 @@ function mi(t) {
|
|
|
1392
1392
|
useDateObjects: t.useDateObjects
|
|
1393
1393
|
};
|
|
1394
1394
|
}
|
|
1395
|
-
function
|
|
1395
|
+
function Si(t) {
|
|
1396
1396
|
return St(t.attrs, t.triples, t.cardinalityInference, t.linkIndex, t.useDateObjects);
|
|
1397
1397
|
}
|
|
1398
|
-
function
|
|
1398
|
+
function so(t, e) {
|
|
1399
1399
|
return ze(t.eav, [e]) !== void 0;
|
|
1400
1400
|
}
|
|
1401
1401
|
function Wn(t) {
|
|
1402
|
-
t.attrIndexes =
|
|
1402
|
+
t.attrIndexes = mi(t.attrs);
|
|
1403
1403
|
}
|
|
1404
1404
|
function St(t, e, n, r, i) {
|
|
1405
|
-
const s =
|
|
1406
|
-
return s.useDateObjects = i, s.attrs = t, s.attrIndexes =
|
|
1405
|
+
const s = wi(t, e, i);
|
|
1406
|
+
return s.useDateObjects = i, s.attrs = t, s.attrIndexes = mi(t), s.cardinalityInference = n, s.linkIndex = r, s.__type = "store", s;
|
|
1407
1407
|
}
|
|
1408
1408
|
function ut(t, e) {
|
|
1409
1409
|
var n, r;
|
|
@@ -1432,21 +1432,21 @@ function ut(t, e) {
|
|
|
1432
1432
|
return [i, ...a];
|
|
1433
1433
|
}
|
|
1434
1434
|
}
|
|
1435
|
-
function
|
|
1435
|
+
function Oi(t, e) {
|
|
1436
1436
|
const n = ut(t, e);
|
|
1437
1437
|
if (!n)
|
|
1438
1438
|
return;
|
|
1439
1439
|
const [r, i, s] = n, o = We(t.attrs, i);
|
|
1440
1440
|
o && (oe(t.eav, [r, i, s]), oe(t.aev, [i, r, s]), Kn(o) && oe(t.vae, [s, i, r]));
|
|
1441
1441
|
}
|
|
1442
|
-
let
|
|
1443
|
-
function
|
|
1442
|
+
let oo = 0;
|
|
1443
|
+
function Ei(t, e, n) {
|
|
1444
1444
|
const [r, i, s] = n;
|
|
1445
1445
|
let o;
|
|
1446
1446
|
const a = ze(t.ea, [r, i, s]);
|
|
1447
|
-
return a && (o = a[3]), o || Date.now() * 10 +
|
|
1447
|
+
return a && (o = a[3]), o || Date.now() * 10 + oo++;
|
|
1448
1448
|
}
|
|
1449
|
-
function
|
|
1449
|
+
function Ai(t, e) {
|
|
1450
1450
|
var n;
|
|
1451
1451
|
const r = ut(t, e);
|
|
1452
1452
|
if (!r)
|
|
@@ -1456,10 +1456,10 @@ function Ei(t, e) {
|
|
|
1456
1456
|
if (!a)
|
|
1457
1457
|
return;
|
|
1458
1458
|
a["checked-data-type"] === "date" && t.useDateObjects && (o = Rt(o));
|
|
1459
|
-
const u = ze(t.eav, [i, s, o]), c = (n = u == null ? void 0 : u[3]) !== null && n !== void 0 ? n :
|
|
1460
|
-
|
|
1459
|
+
const u = ze(t.eav, [i, s, o]), c = (n = u == null ? void 0 : u[3]) !== null && n !== void 0 ? n : Ei(t, a, r), d = [i, s, o, c];
|
|
1460
|
+
io(a) ? (Z(t.eav, [i, s], /* @__PURE__ */ new Map([[o, d]])), Z(t.aev, [s, i], /* @__PURE__ */ new Map([[o, d]]))) : (Z(t.eav, [i, s, o], d), Z(t.aev, [s, i, o], d)), Kn(a) && Z(t.vae, [o, s, i], d);
|
|
1461
1461
|
}
|
|
1462
|
-
function
|
|
1462
|
+
function ao(t, e) {
|
|
1463
1463
|
var n;
|
|
1464
1464
|
const r = ut(t, e);
|
|
1465
1465
|
if (!r)
|
|
@@ -1475,11 +1475,11 @@ function oo(t, e) {
|
|
|
1475
1475
|
const c = (n = u.values().next()) === null || n === void 0 ? void 0 : n.value;
|
|
1476
1476
|
if (!c)
|
|
1477
1477
|
return;
|
|
1478
|
-
const d = c[2], f =
|
|
1478
|
+
const d = c[2], f = gi(d, o), l = [
|
|
1479
1479
|
i,
|
|
1480
1480
|
s,
|
|
1481
1481
|
f,
|
|
1482
|
-
|
|
1482
|
+
Ei(t, a, c)
|
|
1483
1483
|
];
|
|
1484
1484
|
Z(t.eav, [i, s], /* @__PURE__ */ new Map([[f, l]]));
|
|
1485
1485
|
}
|
|
@@ -1510,51 +1510,51 @@ function fn(t, e) {
|
|
|
1510
1510
|
(!s || !w || ((f = w["reverse-identity"]) === null || f === void 0 ? void 0 : f[1]) === s) && (oe(t.eav, [y, b, g]), oe(t.aev, [b, y, g]), oe(t.vae, [g, b, y])), w && w["on-delete"] === "cascade" && ((l = w["reverse-identity"]) === null || l === void 0 ? void 0 : l[1]) === s && fn(t, [y, (p = w["forward-identity"]) === null || p === void 0 ? void 0 : p[1]]);
|
|
1511
1511
|
}), ((r = t.vae.get(a)) === null || r === void 0 ? void 0 : r.size) === 0 && oe(t.vae, [a]);
|
|
1512
1512
|
}
|
|
1513
|
-
function
|
|
1514
|
-
const n =
|
|
1513
|
+
function ki(t, e) {
|
|
1514
|
+
const n = wi(t.attrs, e, t.useDateObjects);
|
|
1515
1515
|
Object.keys(n).forEach((r) => {
|
|
1516
1516
|
t[r] = n[r];
|
|
1517
1517
|
});
|
|
1518
1518
|
}
|
|
1519
|
-
function
|
|
1519
|
+
function uo(t, [e]) {
|
|
1520
1520
|
t.attrs[e.id] = e, Wn(t);
|
|
1521
1521
|
}
|
|
1522
|
-
function
|
|
1522
|
+
function ji(t) {
|
|
1523
1523
|
return X(t.eav, 3);
|
|
1524
1524
|
}
|
|
1525
|
-
function
|
|
1525
|
+
function co(t, [e]) {
|
|
1526
1526
|
if (!t.attrs[e])
|
|
1527
1527
|
return;
|
|
1528
|
-
const n =
|
|
1529
|
-
delete t.attrs[e], Wn(t),
|
|
1528
|
+
const n = ji(t).filter(([r, i]) => i !== e);
|
|
1529
|
+
delete t.attrs[e], Wn(t), ki(t, n);
|
|
1530
1530
|
}
|
|
1531
|
-
function
|
|
1531
|
+
function fo(t, [e]) {
|
|
1532
1532
|
const n = t.attrs[e.id];
|
|
1533
|
-
n && (t.attrs[e.id] = Object.assign(Object.assign({}, n), e), Wn(t),
|
|
1533
|
+
n && (t.attrs[e.id] = Object.assign(Object.assign({}, n), e), Wn(t), ki(t, ji(t)));
|
|
1534
1534
|
}
|
|
1535
|
-
function
|
|
1535
|
+
function lo(t, e) {
|
|
1536
1536
|
const [n, ...r] = e;
|
|
1537
1537
|
switch (n) {
|
|
1538
1538
|
case "add-triple":
|
|
1539
|
-
|
|
1539
|
+
Ai(t, r);
|
|
1540
1540
|
break;
|
|
1541
1541
|
case "deep-merge-triple":
|
|
1542
|
-
|
|
1542
|
+
ao(t, r);
|
|
1543
1543
|
break;
|
|
1544
1544
|
case "retract-triple":
|
|
1545
|
-
|
|
1545
|
+
Oi(t, r);
|
|
1546
1546
|
break;
|
|
1547
1547
|
case "delete-entity":
|
|
1548
1548
|
fn(t, r);
|
|
1549
1549
|
break;
|
|
1550
1550
|
case "add-attr":
|
|
1551
|
-
|
|
1551
|
+
uo(t, r);
|
|
1552
1552
|
break;
|
|
1553
1553
|
case "delete-attr":
|
|
1554
|
-
|
|
1554
|
+
co(t, r);
|
|
1555
1555
|
break;
|
|
1556
1556
|
case "update-attr":
|
|
1557
|
-
|
|
1557
|
+
fo(t, r);
|
|
1558
1558
|
break;
|
|
1559
1559
|
case "restore-attr":
|
|
1560
1560
|
break;
|
|
@@ -1609,13 +1609,13 @@ function bt(t, e, n) {
|
|
|
1609
1609
|
}
|
|
1610
1610
|
return s;
|
|
1611
1611
|
}
|
|
1612
|
-
function
|
|
1612
|
+
function ho(t, e, n) {
|
|
1613
1613
|
let r = "";
|
|
1614
1614
|
return t !== void 0 && (r += "e"), e !== void 0 && (r += "a"), n !== void 0 && (r += "v"), r;
|
|
1615
1615
|
}
|
|
1616
|
-
function
|
|
1616
|
+
function po(t, [e, n, r]) {
|
|
1617
1617
|
var i, s;
|
|
1618
|
-
switch (
|
|
1618
|
+
switch (ho(e, n, r)) {
|
|
1619
1619
|
case "e": {
|
|
1620
1620
|
const a = t.eav.get(e);
|
|
1621
1621
|
return X(a, 2);
|
|
@@ -1661,7 +1661,7 @@ function ho(t, [e, n, r]) {
|
|
|
1661
1661
|
return X(t.eav, 3);
|
|
1662
1662
|
}
|
|
1663
1663
|
}
|
|
1664
|
-
function
|
|
1664
|
+
function yo(t, e, n) {
|
|
1665
1665
|
var r;
|
|
1666
1666
|
const i = {};
|
|
1667
1667
|
for (const [s, o] of e.entries()) {
|
|
@@ -1675,19 +1675,19 @@ function Te(t, e, n) {
|
|
|
1675
1675
|
var r;
|
|
1676
1676
|
return (r = t.attrIndexes.forwardIdents.get(e)) === null || r === void 0 ? void 0 : r.get(n);
|
|
1677
1677
|
}
|
|
1678
|
-
function
|
|
1678
|
+
function Ci(t, e, n) {
|
|
1679
1679
|
var r;
|
|
1680
1680
|
return (r = t.attrIndexes.revIdents.get(e)) === null || r === void 0 ? void 0 : r.get(n);
|
|
1681
1681
|
}
|
|
1682
|
-
function
|
|
1682
|
+
function bo(t, e) {
|
|
1683
1683
|
return t.attrIndexes.blobAttrs.get(e);
|
|
1684
1684
|
}
|
|
1685
|
-
function
|
|
1685
|
+
function Pi(t, e) {
|
|
1686
1686
|
var n;
|
|
1687
1687
|
const r = t.attrIndexes.primaryKeys.get(e);
|
|
1688
1688
|
return r || ((n = t.attrIndexes.forwardIdents.get(e)) === null || n === void 0 ? void 0 : n.get("id"));
|
|
1689
1689
|
}
|
|
1690
|
-
function
|
|
1690
|
+
function _o(t, e) {
|
|
1691
1691
|
const n = ut(t, e);
|
|
1692
1692
|
if (!n)
|
|
1693
1693
|
return;
|
|
@@ -1695,7 +1695,7 @@ function bo(t, e) {
|
|
|
1695
1695
|
if (We(t.attrs, i))
|
|
1696
1696
|
return ze(t.eav, [r, i]);
|
|
1697
1697
|
}
|
|
1698
|
-
function
|
|
1698
|
+
function go(t, e) {
|
|
1699
1699
|
const n = e.filter(([r, i, s, o, a]) => {
|
|
1700
1700
|
if (r !== "add-triple" && r !== "deep-merge-triple")
|
|
1701
1701
|
return !0;
|
|
@@ -1705,39 +1705,39 @@ function _o(t, e) {
|
|
|
1705
1705
|
let c = !1;
|
|
1706
1706
|
const d = We(t.attrs, s);
|
|
1707
1707
|
if (d) {
|
|
1708
|
-
const f =
|
|
1709
|
-
c = !!
|
|
1708
|
+
const f = Pi(t, d["forward-identity"][1]);
|
|
1709
|
+
c = !!_o(t, [i, f.id, i]);
|
|
1710
1710
|
}
|
|
1711
1711
|
return !(u === "create" && c || u === "update" && !c);
|
|
1712
1712
|
});
|
|
1713
1713
|
return Ct(t, (r) => {
|
|
1714
1714
|
n.forEach((i) => {
|
|
1715
|
-
|
|
1715
|
+
lo(r, i);
|
|
1716
1716
|
});
|
|
1717
1717
|
});
|
|
1718
1718
|
}
|
|
1719
|
-
function
|
|
1719
|
+
function To(t) {
|
|
1720
1720
|
return typeof t == "string" && t.startsWith("?");
|
|
1721
1721
|
}
|
|
1722
|
-
function
|
|
1722
|
+
function wo(t, e, n) {
|
|
1723
1723
|
if (n.hasOwnProperty(t)) {
|
|
1724
1724
|
const r = n[t];
|
|
1725
|
-
return
|
|
1725
|
+
return Ii(r, e, n);
|
|
1726
1726
|
}
|
|
1727
1727
|
return Object.assign(Object.assign({}, n), { [t]: e });
|
|
1728
1728
|
}
|
|
1729
1729
|
function Ar(t, e, n) {
|
|
1730
1730
|
return t === e ? n : null;
|
|
1731
1731
|
}
|
|
1732
|
-
function
|
|
1732
|
+
function mo(t) {
|
|
1733
1733
|
switch (typeof t) {
|
|
1734
1734
|
case "string":
|
|
1735
|
-
return t.startsWith("?") ?
|
|
1735
|
+
return t.startsWith("?") ? wo : Ar;
|
|
1736
1736
|
default:
|
|
1737
1737
|
return Ar;
|
|
1738
1738
|
}
|
|
1739
1739
|
}
|
|
1740
|
-
const
|
|
1740
|
+
const vo = [
|
|
1741
1741
|
"in",
|
|
1742
1742
|
"$in",
|
|
1743
1743
|
"$not",
|
|
@@ -1745,69 +1745,69 @@ const mo = [
|
|
|
1745
1745
|
"$comparator"
|
|
1746
1746
|
// covers all of $gt, $lt, etc.
|
|
1747
1747
|
];
|
|
1748
|
-
function
|
|
1749
|
-
for (const e of
|
|
1748
|
+
function So(t) {
|
|
1749
|
+
for (const e of vo)
|
|
1750
1750
|
if (t.hasOwnProperty(e))
|
|
1751
1751
|
return !0;
|
|
1752
1752
|
return !1;
|
|
1753
1753
|
}
|
|
1754
|
-
function
|
|
1755
|
-
return n ? typeof t == "object" ?
|
|
1754
|
+
function Ii(t, e, n) {
|
|
1755
|
+
return n ? typeof t == "object" ? So(t) ? n : null : mo(t)(t, e, n) : null;
|
|
1756
1756
|
}
|
|
1757
|
-
function
|
|
1757
|
+
function Oo(t, e, n) {
|
|
1758
1758
|
return t.reduce((r, i, s) => {
|
|
1759
1759
|
const o = e[s];
|
|
1760
|
-
return
|
|
1760
|
+
return Ii(i, o, r);
|
|
1761
1761
|
}, n);
|
|
1762
1762
|
}
|
|
1763
|
-
function Oo(t, e, n) {
|
|
1764
|
-
return ko(t, e, n).map((r) => So(e, r, n)).filter((r) => r);
|
|
1765
|
-
}
|
|
1766
1763
|
function Eo(t, e, n) {
|
|
1767
|
-
return
|
|
1764
|
+
return jo(t, e, n).map((r) => Oo(e, r, n)).filter((r) => r);
|
|
1765
|
+
}
|
|
1766
|
+
function Ao(t, e, n) {
|
|
1767
|
+
return e.or ? e.or.patterns.flatMap((r) => ln(t, r, n)) : e.and ? e.and.patterns.reduce((r, i) => ln(t, i, r), n) : n.flatMap((r) => Eo(t, e, r));
|
|
1768
1768
|
}
|
|
1769
1769
|
function ln(t, e, n = [{}]) {
|
|
1770
|
-
return e.reduce((r, i) =>
|
|
1770
|
+
return e.reduce((r, i) => Ao(t, i, r), n);
|
|
1771
1771
|
}
|
|
1772
1772
|
function zn(t, e) {
|
|
1773
|
-
return Array.isArray(e) ? e.map((n) => zn(t, n)) :
|
|
1773
|
+
return Array.isArray(e) ? e.map((n) => zn(t, n)) : To(e) ? t[e] : e;
|
|
1774
1774
|
}
|
|
1775
|
-
function
|
|
1775
|
+
function ko(t, { find: e, where: n }) {
|
|
1776
1776
|
return ln(t, n).map((i) => zn(i, e));
|
|
1777
1777
|
}
|
|
1778
|
-
function
|
|
1779
|
-
return
|
|
1778
|
+
function jo(t, e, n) {
|
|
1779
|
+
return po(t, zn(n, e));
|
|
1780
1780
|
}
|
|
1781
|
-
const
|
|
1781
|
+
const Co = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;
|
|
1782
1782
|
function Ne(t) {
|
|
1783
|
-
return typeof t == "string" &&
|
|
1783
|
+
return typeof t == "string" && Co.test(t);
|
|
1784
1784
|
}
|
|
1785
1785
|
const W = [];
|
|
1786
1786
|
for (let t = 0; t < 256; ++t)
|
|
1787
1787
|
W.push((t + 256).toString(16).slice(1));
|
|
1788
|
-
function
|
|
1788
|
+
function Po(t, e = 0) {
|
|
1789
1789
|
return (W[t[e + 0]] + W[t[e + 1]] + W[t[e + 2]] + W[t[e + 3]] + "-" + W[t[e + 4]] + W[t[e + 5]] + "-" + W[t[e + 6]] + W[t[e + 7]] + "-" + W[t[e + 8]] + W[t[e + 9]] + "-" + W[t[e + 10]] + W[t[e + 11]] + W[t[e + 12]] + W[t[e + 13]] + W[t[e + 14]] + W[t[e + 15]]).toLowerCase();
|
|
1790
1790
|
}
|
|
1791
1791
|
let Ht;
|
|
1792
|
-
const
|
|
1793
|
-
function
|
|
1792
|
+
const Io = new Uint8Array(16);
|
|
1793
|
+
function Mo() {
|
|
1794
1794
|
if (!Ht) {
|
|
1795
1795
|
if (typeof crypto > "u" || !crypto.getRandomValues)
|
|
1796
1796
|
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
1797
1797
|
Ht = crypto.getRandomValues.bind(crypto);
|
|
1798
1798
|
}
|
|
1799
|
-
return Ht(
|
|
1799
|
+
return Ht(Io);
|
|
1800
1800
|
}
|
|
1801
|
-
const
|
|
1802
|
-
function
|
|
1801
|
+
const Ro = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), kr = { randomUUID: Ro };
|
|
1802
|
+
function xo(t, e, n) {
|
|
1803
1803
|
var i;
|
|
1804
1804
|
if (kr.randomUUID && !t)
|
|
1805
1805
|
return kr.randomUUID();
|
|
1806
1806
|
t = t || {};
|
|
1807
|
-
const r = t.random ?? ((i = t.rng) == null ? void 0 : i.call(t)) ??
|
|
1807
|
+
const r = t.random ?? ((i = t.rng) == null ? void 0 : i.call(t)) ?? Mo();
|
|
1808
1808
|
if (r.length < 16)
|
|
1809
1809
|
throw new Error("Random bytes length must be >= 16");
|
|
1810
|
-
return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128,
|
|
1810
|
+
return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128, Po(r);
|
|
1811
1811
|
}
|
|
1812
1812
|
function jr(t) {
|
|
1813
1813
|
const e = t.replace(/-/g, ""), n = [];
|
|
@@ -1815,7 +1815,7 @@ function jr(t) {
|
|
|
1815
1815
|
n.push(parseInt(e.substring(r, r + 2), 16));
|
|
1816
1816
|
return n;
|
|
1817
1817
|
}
|
|
1818
|
-
function
|
|
1818
|
+
function $o(t, e) {
|
|
1819
1819
|
for (let n = 0; n < t.length; n++) {
|
|
1820
1820
|
if (t[n] < e[n])
|
|
1821
1821
|
return -1;
|
|
@@ -1824,17 +1824,17 @@ function xo(t, e) {
|
|
|
1824
1824
|
}
|
|
1825
1825
|
return 0;
|
|
1826
1826
|
}
|
|
1827
|
-
function
|
|
1828
|
-
return
|
|
1827
|
+
function Do(t, e) {
|
|
1828
|
+
return $o(jr(t), jr(e));
|
|
1829
1829
|
}
|
|
1830
1830
|
function K() {
|
|
1831
|
-
return
|
|
1831
|
+
return xo();
|
|
1832
1832
|
}
|
|
1833
|
-
function
|
|
1833
|
+
function Uo(t, e) {
|
|
1834
1834
|
return t.localeCompare(e);
|
|
1835
1835
|
}
|
|
1836
|
-
function
|
|
1837
|
-
let t =
|
|
1836
|
+
function Lo() {
|
|
1837
|
+
let t = Uo;
|
|
1838
1838
|
if (typeof Intl == "object" && Intl.hasOwnProperty("Collator"))
|
|
1839
1839
|
try {
|
|
1840
1840
|
t = Intl.Collator("en-US").compare;
|
|
@@ -1842,10 +1842,10 @@ function Uo() {
|
|
|
1842
1842
|
}
|
|
1843
1843
|
return t;
|
|
1844
1844
|
}
|
|
1845
|
-
const
|
|
1846
|
-
let
|
|
1845
|
+
const Fo = Lo();
|
|
1846
|
+
let No = 0;
|
|
1847
1847
|
function rt(t) {
|
|
1848
|
-
return xt(`_${t}`,
|
|
1848
|
+
return xt(`_${t}`, No++);
|
|
1849
1849
|
}
|
|
1850
1850
|
function xt(t, e) {
|
|
1851
1851
|
return `?${t}-${e}`;
|
|
@@ -1855,28 +1855,28 @@ class Ke extends Error {
|
|
|
1855
1855
|
super(e), this.name = "AttrNotFoundError";
|
|
1856
1856
|
}
|
|
1857
1857
|
}
|
|
1858
|
-
function
|
|
1859
|
-
const n =
|
|
1858
|
+
function Ko(t, e) {
|
|
1859
|
+
const n = Pi(t, e);
|
|
1860
1860
|
if (!n)
|
|
1861
1861
|
throw new Ke(`Could not find id attr for ${e}`);
|
|
1862
1862
|
return n;
|
|
1863
1863
|
}
|
|
1864
1864
|
function Cr(t, e, n, r) {
|
|
1865
|
-
return [
|
|
1865
|
+
return [qo(t, e, n, r)];
|
|
1866
1866
|
}
|
|
1867
|
-
function
|
|
1867
|
+
function qo(t, e, n, r) {
|
|
1868
1868
|
return [
|
|
1869
1869
|
t(n, r),
|
|
1870
|
-
|
|
1870
|
+
Ko(e, n).id,
|
|
1871
1871
|
t(n, r),
|
|
1872
1872
|
t("time", r)
|
|
1873
1873
|
];
|
|
1874
1874
|
}
|
|
1875
|
-
function
|
|
1875
|
+
function Wo(t, e, n) {
|
|
1876
1876
|
return t.map((r) => r === e ? n : r);
|
|
1877
1877
|
}
|
|
1878
|
-
function
|
|
1879
|
-
const s = Te(e, n, i), o =
|
|
1878
|
+
function Mi(t, e, n, r, i) {
|
|
1879
|
+
const s = Te(e, n, i), o = Ci(e, n, i), a = s || o;
|
|
1880
1880
|
if (!a)
|
|
1881
1881
|
throw new Ke(`Could not find attr for ${[n, i]}`);
|
|
1882
1882
|
if (a["value-type"] !== "ref")
|
|
@@ -1904,7 +1904,7 @@ function Pr(t, e) {
|
|
|
1904
1904
|
return typeof o != "string" ? !1 : i.test(o);
|
|
1905
1905
|
};
|
|
1906
1906
|
}
|
|
1907
|
-
function
|
|
1907
|
+
function zo(t, e) {
|
|
1908
1908
|
if (typeof e != "object" || e.hasOwnProperty("$in") || e.hasOwnProperty("in"))
|
|
1909
1909
|
return e;
|
|
1910
1910
|
const n = t["checked-data-type"] === "date";
|
|
@@ -1964,8 +1964,8 @@ function Wo(t, e) {
|
|
|
1964
1964
|
}
|
|
1965
1965
|
return e;
|
|
1966
1966
|
}
|
|
1967
|
-
function
|
|
1968
|
-
const o = Te(e, n, i), a =
|
|
1967
|
+
function Vo(t, e, n, r, i, s) {
|
|
1968
|
+
const o = Te(e, n, i), a = Ci(e, n, i), u = o || a;
|
|
1969
1969
|
if (!u)
|
|
1970
1970
|
throw new Ke(`No attr for etype = ${n} label = ${i}`);
|
|
1971
1971
|
if (s != null && s.hasOwnProperty("$isNull")) {
|
|
@@ -1982,31 +1982,31 @@ function zo(t, e, n, r, i, s) {
|
|
|
1982
1982
|
return o ? [
|
|
1983
1983
|
t(n, r),
|
|
1984
1984
|
u.id,
|
|
1985
|
-
|
|
1985
|
+
zo(u, s),
|
|
1986
1986
|
rt("time")
|
|
1987
1987
|
] : [s, u.id, t(n, r), rt("time")];
|
|
1988
1988
|
}
|
|
1989
|
-
function
|
|
1989
|
+
function Go(t, e, n, r, i) {
|
|
1990
1990
|
const [s, o, a] = i.reduce((u, c) => {
|
|
1991
|
-
const [d, f, l] = u, [p, y, b] =
|
|
1991
|
+
const [d, f, l] = u, [p, y, b] = Mi(t, e, d, f, c);
|
|
1992
1992
|
return [p, y, [...l, b]];
|
|
1993
1993
|
}, [n, r, []]);
|
|
1994
1994
|
return [s, o, a];
|
|
1995
1995
|
}
|
|
1996
1996
|
function hn(t, e, n, r, i, s) {
|
|
1997
|
-
const o = i.slice(0, i.length - 1), a = i[i.length - 1], [u, c, d] =
|
|
1997
|
+
const o = i.slice(0, i.length - 1), a = i[i.length - 1], [u, c, d] = Go(t, e, n, r, o), f = Vo(t, e, u, c, a, s);
|
|
1998
1998
|
return d.concat([f]);
|
|
1999
1999
|
}
|
|
2000
|
-
function
|
|
2000
|
+
function Bo(t, e) {
|
|
2001
2001
|
return e ? [e].concat(t) : t;
|
|
2002
2002
|
}
|
|
2003
|
-
function
|
|
2003
|
+
function Qo([t, e]) {
|
|
2004
2004
|
return t === "or" && Array.isArray(e);
|
|
2005
2005
|
}
|
|
2006
|
-
function
|
|
2006
|
+
function Ho([t, e]) {
|
|
2007
2007
|
return t === "and" && Array.isArray(e);
|
|
2008
2008
|
}
|
|
2009
|
-
function
|
|
2009
|
+
function Yo(t, e, n) {
|
|
2010
2010
|
return (r, i) => {
|
|
2011
2011
|
const s = t(r, i);
|
|
2012
2012
|
return e == s ? s : `${s}-${n}`;
|
|
@@ -2014,25 +2014,25 @@ function Ho(t, e, n) {
|
|
|
2014
2014
|
}
|
|
2015
2015
|
function Ir(t, e, n, r, i, s) {
|
|
2016
2016
|
const o = t(r, i), a = s.map((u, c) => {
|
|
2017
|
-
const d =
|
|
2018
|
-
return
|
|
2017
|
+
const d = Yo(t, o, c);
|
|
2018
|
+
return Ri(d, n, r, i, u);
|
|
2019
2019
|
});
|
|
2020
2020
|
return { [e]: { patterns: a, joinSym: o } };
|
|
2021
2021
|
}
|
|
2022
|
-
function
|
|
2022
|
+
function Jo(t) {
|
|
2023
2023
|
const e = [];
|
|
2024
2024
|
for (let n = 1; n <= t.length; n++)
|
|
2025
2025
|
e.push(t.slice(0, n));
|
|
2026
2026
|
return e;
|
|
2027
2027
|
}
|
|
2028
2028
|
function Mr(t, e, n, r, i) {
|
|
2029
|
-
return
|
|
2029
|
+
return Jo(i).map((s) => hn(t, e, n, r, s, { $isNull: !0 }));
|
|
2030
2030
|
}
|
|
2031
|
-
function
|
|
2031
|
+
function Ri(t, e, n, r, i) {
|
|
2032
2032
|
return Object.entries(i).flatMap(([s, o]) => {
|
|
2033
|
-
if (Bo([s, o]))
|
|
2034
|
-
return Ir(t, "or", e, n, r, o);
|
|
2035
2033
|
if (Qo([s, o]))
|
|
2034
|
+
return Ir(t, "or", e, n, r, o);
|
|
2035
|
+
if (Ho([s, o]))
|
|
2036
2036
|
return Ir(t, "and", e, n, r, o);
|
|
2037
2037
|
if (s === "$entityIdStartsWith")
|
|
2038
2038
|
return [];
|
|
@@ -2058,25 +2058,25 @@ function Mi(t, e, n, r, i) {
|
|
|
2058
2058
|
] : hn(t, e, n, r, a, o);
|
|
2059
2059
|
});
|
|
2060
2060
|
}
|
|
2061
|
-
function
|
|
2061
|
+
function Zo(t, e, n, r) {
|
|
2062
2062
|
const i = xt;
|
|
2063
|
-
return r ?
|
|
2063
|
+
return r ? Ri(i, t, e, n, r).concat(Cr(i, t, e, n)) : Cr(i, t, e, n);
|
|
2064
2064
|
}
|
|
2065
|
-
function
|
|
2065
|
+
function Xo(t, e, n) {
|
|
2066
2066
|
return [t(e, n), t("time", n)];
|
|
2067
2067
|
}
|
|
2068
|
-
function
|
|
2069
|
-
const [o, a, u, c, d] =
|
|
2068
|
+
function ea(t, e, n, r, i, s) {
|
|
2069
|
+
const [o, a, u, c, d] = Mi(t, e, n, r, i), f = Wo(u, t(n, r), s);
|
|
2070
2070
|
return [o, a, f, c, d];
|
|
2071
2071
|
}
|
|
2072
|
-
function
|
|
2072
|
+
function ta(t, e, { etype: n, level: r, form: i }, s) {
|
|
2073
2073
|
const o = Object.keys(i).filter((a) => a !== "$");
|
|
2074
2074
|
return o.length ? Object.entries(s).map(function([u, c]) {
|
|
2075
2075
|
return o.map(function(l) {
|
|
2076
2076
|
var p, y, b;
|
|
2077
2077
|
const g = !!(e.cardinalityInference && (!((b = (y = (p = e.linkIndex) === null || p === void 0 ? void 0 : p[n]) === null || y === void 0 ? void 0 : y[l]) === null || b === void 0) && b.isSingular));
|
|
2078
2078
|
try {
|
|
2079
|
-
const [w, T, m] =
|
|
2079
|
+
const [w, T, m] = ea(t, e, n, r, l, u), E = $i(e, {
|
|
2080
2080
|
etype: w,
|
|
2081
2081
|
level: T,
|
|
2082
2082
|
form: i[l],
|
|
@@ -2093,11 +2093,11 @@ function ea(t, e, { etype: n, level: r, form: i }, s) {
|
|
|
2093
2093
|
}, c);
|
|
2094
2094
|
}) : Object.values(s);
|
|
2095
2095
|
}
|
|
2096
|
-
function
|
|
2097
|
-
return n === "string" ?
|
|
2096
|
+
function na(t, e, n) {
|
|
2097
|
+
return n === "string" ? Fo(t, e) : t > e ? 1 : -1;
|
|
2098
2098
|
}
|
|
2099
2099
|
function Xe(t, e, n, r, i) {
|
|
2100
|
-
return e === r || e == null && r == null ?
|
|
2100
|
+
return e === r || e == null && r == null ? Do(t, n) : r == null ? 1 : e == null ? -1 : na(e, r, i);
|
|
2101
2101
|
}
|
|
2102
2102
|
function Pt([t, e], [n, r], i) {
|
|
2103
2103
|
return Xe(t, e, n, r, i);
|
|
@@ -2105,7 +2105,7 @@ function Pt([t, e], [n, r], i) {
|
|
|
2105
2105
|
function pn(t) {
|
|
2106
2106
|
return t == null ? t : new Date(t).getTime();
|
|
2107
2107
|
}
|
|
2108
|
-
function
|
|
2108
|
+
function ra(t, e, n, r) {
|
|
2109
2109
|
var i;
|
|
2110
2110
|
const [s, o, a, u] = t, c = n === "desc" ? 1 : -1;
|
|
2111
2111
|
if (((i = e["forward-identity"]) === null || i === void 0 ? void 0 : i[2]) === "id")
|
|
@@ -2113,24 +2113,24 @@ function na(t, e, n, r) {
|
|
|
2113
2113
|
const [d, f] = r, l = e["checked-data-type"], p = l === "date" ? pn(f) : f, y = l === "date" ? pn(a) : a;
|
|
2114
2114
|
return Pt([d, p], [s, y], l) === c;
|
|
2115
2115
|
}
|
|
2116
|
-
function
|
|
2116
|
+
function ia(t, e) {
|
|
2117
2117
|
const n = e[1];
|
|
2118
2118
|
return t.attrs[n];
|
|
2119
2119
|
}
|
|
2120
|
-
function
|
|
2120
|
+
function sa(t, e, n) {
|
|
2121
2121
|
const r = Object.keys(n)[0];
|
|
2122
2122
|
return Te(t, e, r);
|
|
2123
2123
|
}
|
|
2124
|
-
function
|
|
2124
|
+
function oa(t, e, n, r) {
|
|
2125
2125
|
if (n)
|
|
2126
|
-
return
|
|
2126
|
+
return ia(t, n);
|
|
2127
2127
|
if (r)
|
|
2128
|
-
return
|
|
2128
|
+
return sa(t, e, r);
|
|
2129
2129
|
}
|
|
2130
|
-
function
|
|
2130
|
+
function aa(t, e, n) {
|
|
2131
2131
|
var r, i;
|
|
2132
2132
|
if (!Array.isArray(n.fields))
|
|
2133
|
-
return
|
|
2133
|
+
return bo(t, e);
|
|
2134
2134
|
const s = /* @__PURE__ */ new Map();
|
|
2135
2135
|
for (const o of n.fields) {
|
|
2136
2136
|
const a = Te(t, e, o), u = (r = a == null ? void 0 : a["forward-identity"]) === null || r === void 0 ? void 0 : r[2];
|
|
@@ -2142,11 +2142,11 @@ function oa(t, e, n) {
|
|
|
2142
2142
|
}
|
|
2143
2143
|
return s;
|
|
2144
2144
|
}
|
|
2145
|
-
function
|
|
2145
|
+
function ua(t, { etype: e, pageInfo: n, dq: r, form: i }) {
|
|
2146
2146
|
var s, o;
|
|
2147
|
-
const a = (s = i == null ? void 0 : i.$) === null || s === void 0 ? void 0 : s.order, u =
|
|
2148
|
-
let d =
|
|
2149
|
-
const f = n == null ? void 0 : n["start-cursor"], l =
|
|
2147
|
+
const a = (s = i == null ? void 0 : i.$) === null || s === void 0 ? void 0 : s.order, u = xi(i), c = ca(i);
|
|
2148
|
+
let d = ko(t, r);
|
|
2149
|
+
const f = n == null ? void 0 : n["start-cursor"], l = oa(t, e, f, a);
|
|
2150
2150
|
if (l && ((o = l == null ? void 0 : l["forward-identity"]) === null || o === void 0 ? void 0 : o[2]) !== "id") {
|
|
2151
2151
|
const b = l["checked-data-type"] === "date", g = l.id;
|
|
2152
2152
|
d = d.map(([w]) => {
|
|
@@ -2161,31 +2161,31 @@ function aa(t, { etype: e, pageInfo: n, dq: r, form: i }) {
|
|
|
2161
2161
|
return Pt(w, g, l == null ? void 0 : l["checked-data-type"]);
|
|
2162
2162
|
});
|
|
2163
2163
|
let p = {};
|
|
2164
|
-
const y =
|
|
2164
|
+
const y = aa(t, e, r);
|
|
2165
2165
|
for (const b of d) {
|
|
2166
2166
|
const [g] = b;
|
|
2167
|
-
if (p[g] || !u && f && l &&
|
|
2167
|
+
if (p[g] || !u && f && l && ra(f, l, c, b))
|
|
2168
2168
|
continue;
|
|
2169
|
-
const w =
|
|
2169
|
+
const w = yo(t, y, g);
|
|
2170
2170
|
w && (p[g] = w);
|
|
2171
2171
|
}
|
|
2172
2172
|
return p;
|
|
2173
2173
|
}
|
|
2174
|
-
function
|
|
2174
|
+
function ca(t) {
|
|
2175
2175
|
var e;
|
|
2176
2176
|
const n = (e = t.$) === null || e === void 0 ? void 0 : e.order;
|
|
2177
2177
|
return n && n[Object.keys(n)[0]] || "asc";
|
|
2178
2178
|
}
|
|
2179
|
-
function
|
|
2179
|
+
function xi(t) {
|
|
2180
2180
|
var e, n, r;
|
|
2181
2181
|
const i = (e = t.$) === null || e === void 0 ? void 0 : e.offset, s = (n = t.$) === null || n === void 0 ? void 0 : n.before, o = (r = t.$) === null || r === void 0 ? void 0 : r.after;
|
|
2182
2182
|
return !i && !s && !o;
|
|
2183
2183
|
}
|
|
2184
|
-
function
|
|
2184
|
+
function da(t, { etype: e, level: n, form: r, join: i, pageInfo: s }) {
|
|
2185
2185
|
var o, a, u, c, d;
|
|
2186
|
-
if (!
|
|
2186
|
+
if (!xi(r) && (!s || !s["start-cursor"]))
|
|
2187
2187
|
return [];
|
|
2188
|
-
const f =
|
|
2188
|
+
const f = Bo(Zo(t, e, n, (o = r.$) === null || o === void 0 ? void 0 : o.where), i), l = Xo(xt, e, n), p = (a = r.$) === null || a === void 0 ? void 0 : a.fields, y = ua(t, {
|
|
2189
2189
|
etype: e,
|
|
2190
2190
|
pageInfo: s,
|
|
2191
2191
|
form: r,
|
|
@@ -2198,20 +2198,20 @@ function ca(t, { etype: e, level: n, form: r, join: i, pageInfo: s }) {
|
|
|
2198
2198
|
}
|
|
2199
2199
|
return y;
|
|
2200
2200
|
}
|
|
2201
|
-
function
|
|
2201
|
+
function fa(t, e) {
|
|
2202
2202
|
try {
|
|
2203
|
-
return
|
|
2203
|
+
return da(t, e);
|
|
2204
2204
|
} catch (n) {
|
|
2205
2205
|
if (n instanceof Ke)
|
|
2206
2206
|
return {};
|
|
2207
2207
|
throw n;
|
|
2208
2208
|
}
|
|
2209
2209
|
}
|
|
2210
|
-
function
|
|
2211
|
-
const n =
|
|
2212
|
-
return
|
|
2210
|
+
function $i(t, e) {
|
|
2211
|
+
const n = fa(t, e);
|
|
2212
|
+
return ta(xt, t, e, n);
|
|
2213
2213
|
}
|
|
2214
|
-
function
|
|
2214
|
+
function la(t) {
|
|
2215
2215
|
const e = {};
|
|
2216
2216
|
for (const [n, r] of Object.entries(t))
|
|
2217
2217
|
e[n] = {
|
|
@@ -2222,18 +2222,18 @@ function fa(t) {
|
|
|
2222
2222
|
};
|
|
2223
2223
|
return e;
|
|
2224
2224
|
}
|
|
2225
|
-
function
|
|
2225
|
+
function Di({ store: t, pageInfo: e, aggregate: n }, r) {
|
|
2226
2226
|
const s = { data: Object.keys(r).reduce(function(a, u) {
|
|
2227
|
-
return n != null && n[u] || u === "$$ruleParams" || (a[u] =
|
|
2227
|
+
return n != null && n[u] || u === "$$ruleParams" || (a[u] = $i(t, {
|
|
2228
2228
|
etype: u,
|
|
2229
2229
|
form: r[u],
|
|
2230
2230
|
level: 0,
|
|
2231
2231
|
pageInfo: e == null ? void 0 : e[u]
|
|
2232
2232
|
})), a;
|
|
2233
2233
|
}, {}) };
|
|
2234
|
-
return e && (s.pageInfo =
|
|
2234
|
+
return e && (s.pageInfo = la(e)), n && (s.aggregate = n), s;
|
|
2235
2235
|
}
|
|
2236
|
-
function
|
|
2236
|
+
function ha() {
|
|
2237
2237
|
const e = {
|
|
2238
2238
|
__etype: 1,
|
|
2239
2239
|
__ops: 1,
|
|
@@ -2247,7 +2247,7 @@ function la() {
|
|
|
2247
2247
|
};
|
|
2248
2248
|
return new Set(Object.keys(e));
|
|
2249
2249
|
}
|
|
2250
|
-
const
|
|
2250
|
+
const pa = ha();
|
|
2251
2251
|
function yn(t, e, n) {
|
|
2252
2252
|
const r = {
|
|
2253
2253
|
__etype: t,
|
|
@@ -2259,7 +2259,7 @@ function yn(t, e, n) {
|
|
|
2259
2259
|
return n;
|
|
2260
2260
|
if (s === "__etype")
|
|
2261
2261
|
return t;
|
|
2262
|
-
if (
|
|
2262
|
+
if (pa.has(s))
|
|
2263
2263
|
return (o, a) => yn(t, e, [
|
|
2264
2264
|
...n,
|
|
2265
2265
|
a ? [s, t, e, o, a] : [s, t, e, o]
|
|
@@ -2267,17 +2267,17 @@ function yn(t, e, n) {
|
|
|
2267
2267
|
}
|
|
2268
2268
|
});
|
|
2269
2269
|
}
|
|
2270
|
-
function
|
|
2270
|
+
function Lc(t, e) {
|
|
2271
2271
|
return `lookup__${t}__${JSON.stringify(e)}`;
|
|
2272
2272
|
}
|
|
2273
2273
|
function It(t) {
|
|
2274
2274
|
return t.startsWith("lookup__");
|
|
2275
2275
|
}
|
|
2276
|
-
function
|
|
2276
|
+
function Ui(t) {
|
|
2277
2277
|
const [e, n, ...r] = t.split("__");
|
|
2278
2278
|
return [n, JSON.parse(r.join("__"))];
|
|
2279
2279
|
}
|
|
2280
|
-
function
|
|
2280
|
+
function ya(t) {
|
|
2281
2281
|
return new Proxy({
|
|
2282
2282
|
__etype: t
|
|
2283
2283
|
}, {
|
|
@@ -2285,22 +2285,22 @@ function pa(t) {
|
|
|
2285
2285
|
if (n === "__etype")
|
|
2286
2286
|
return t;
|
|
2287
2287
|
const r = n;
|
|
2288
|
-
return It(r) ? yn(t,
|
|
2288
|
+
return It(r) ? yn(t, Ui(r), []) : yn(t, r, []);
|
|
2289
2289
|
}
|
|
2290
2290
|
});
|
|
2291
2291
|
}
|
|
2292
2292
|
function Vn() {
|
|
2293
2293
|
return new Proxy({}, {
|
|
2294
2294
|
get(t, e) {
|
|
2295
|
-
return
|
|
2295
|
+
return ya(e);
|
|
2296
2296
|
}
|
|
2297
2297
|
});
|
|
2298
2298
|
}
|
|
2299
|
-
const
|
|
2300
|
-
function
|
|
2299
|
+
const Fc = Vn();
|
|
2300
|
+
function ba(t) {
|
|
2301
2301
|
return t.__ops;
|
|
2302
2302
|
}
|
|
2303
|
-
function
|
|
2303
|
+
function _a(t, e) {
|
|
2304
2304
|
const { attrIdMap: n, refSwapAttrIds: r } = t, i = [];
|
|
2305
2305
|
for (const o of e) {
|
|
2306
2306
|
const a = n[o];
|
|
@@ -2334,7 +2334,7 @@ function ke(t, e, n) {
|
|
|
2334
2334
|
return o === e && a === n;
|
|
2335
2335
|
});
|
|
2336
2336
|
}
|
|
2337
|
-
function
|
|
2337
|
+
function ga(t) {
|
|
2338
2338
|
if (Array.isArray(t))
|
|
2339
2339
|
return t;
|
|
2340
2340
|
const e = Object.entries(t);
|
|
@@ -2353,7 +2353,7 @@ function _n(t) {
|
|
|
2353
2353
|
throw new Error(`${t} is not a valid lookup attribute.`);
|
|
2354
2354
|
return e;
|
|
2355
2355
|
}
|
|
2356
|
-
function
|
|
2356
|
+
function Ta(t, e, n) {
|
|
2357
2357
|
if (!bn(t, e, n))
|
|
2358
2358
|
return G(t, e, n);
|
|
2359
2359
|
const r = _n(n), i = G(t, e, r) || ke(t, e, r);
|
|
@@ -2362,18 +2362,18 @@ function ga(t, e, n) {
|
|
|
2362
2362
|
return i;
|
|
2363
2363
|
}
|
|
2364
2364
|
function gn(t) {
|
|
2365
|
-
return typeof t == "string" && !It(t) ? null : typeof t == "string" && It(t) ?
|
|
2365
|
+
return typeof t == "string" && !It(t) ? null : typeof t == "string" && It(t) ? Ui(t) : ga(t);
|
|
2366
2366
|
}
|
|
2367
2367
|
function ee(t, e, n) {
|
|
2368
2368
|
const r = gn(n);
|
|
2369
2369
|
if (r === null)
|
|
2370
2370
|
return n;
|
|
2371
|
-
const [i, s] = r, o =
|
|
2371
|
+
const [i, s] = r, o = Ta(t, e, i);
|
|
2372
2372
|
if (!o || !o["unique?"])
|
|
2373
2373
|
throw new Error(`${i} is not a unique attribute.`);
|
|
2374
2374
|
return [o.id, s];
|
|
2375
2375
|
}
|
|
2376
|
-
function
|
|
2376
|
+
function Li(t, e, n, r) {
|
|
2377
2377
|
const i = ee(t, e, n);
|
|
2378
2378
|
return Array.isArray(i) ? [[
|
|
2379
2379
|
"add-triple",
|
|
@@ -2382,7 +2382,7 @@ function Ui(t, e, n, r) {
|
|
|
2382
2382
|
i
|
|
2383
2383
|
]].concat(r) : r;
|
|
2384
2384
|
}
|
|
2385
|
-
function
|
|
2385
|
+
function wa({ attrs: t }, [e, n, r]) {
|
|
2386
2386
|
const i = Object.entries(r).flatMap(([s, o]) => {
|
|
2387
2387
|
const a = Array.isArray(o) ? o : [o], u = G(t, e, s), c = ke(t, e, s);
|
|
2388
2388
|
return a.map((d) => u ? [
|
|
@@ -2397,9 +2397,9 @@ function Ta({ attrs: t }, [e, n, r]) {
|
|
|
2397
2397
|
ee(t, e, n)
|
|
2398
2398
|
]);
|
|
2399
2399
|
});
|
|
2400
|
-
return
|
|
2400
|
+
return Li(t, e, n, i);
|
|
2401
2401
|
}
|
|
2402
|
-
function
|
|
2402
|
+
function ma({ attrs: t }, [e, n, r]) {
|
|
2403
2403
|
const i = Object.entries(r).flatMap(([s, o]) => {
|
|
2404
2404
|
const a = Array.isArray(o) ? o : [o], u = G(t, e, s), c = ke(t, e, s);
|
|
2405
2405
|
return a.map((d) => u ? [
|
|
@@ -2414,9 +2414,9 @@ function wa({ attrs: t }, [e, n, r]) {
|
|
|
2414
2414
|
ee(t, e, n)
|
|
2415
2415
|
]);
|
|
2416
2416
|
});
|
|
2417
|
-
return
|
|
2417
|
+
return Li(t, e, n, i);
|
|
2418
2418
|
}
|
|
2419
|
-
function
|
|
2419
|
+
function va(t, e, n) {
|
|
2420
2420
|
if (Array.isArray(n)) {
|
|
2421
2421
|
const [r, i] = n;
|
|
2422
2422
|
for (const s of t || []) {
|
|
@@ -2438,18 +2438,18 @@ function ma(t, e, n) {
|
|
|
2438
2438
|
}
|
|
2439
2439
|
return !1;
|
|
2440
2440
|
}
|
|
2441
|
-
function
|
|
2442
|
-
return (s == null ? void 0 : s.upsert) === !1 ? { mode: "update" } : (s == null ? void 0 : s.upsert) === !0 ? null :
|
|
2441
|
+
function Fi({ stores: t, attrs: e }, [n, r, i, s]) {
|
|
2442
|
+
return (s == null ? void 0 : s.upsert) === !1 ? { mode: "update" } : (s == null ? void 0 : s.upsert) === !0 ? null : va(t, n, r) ? { mode: "update" } : null;
|
|
2443
2443
|
}
|
|
2444
|
-
function
|
|
2444
|
+
function Sa(t, e) {
|
|
2445
2445
|
const { stores: n, attrs: r } = t, [i, s, o, a] = e, u = Nn(o), c = ee(r, i, s);
|
|
2446
2446
|
return [["id", c]].concat(Object.entries(u)).map(([f, l]) => {
|
|
2447
2447
|
const p = G(r, i, f);
|
|
2448
2448
|
return p["checked-data-type"] === "date" && t.useDateObjects && (l = Rt(l)), ["add-triple", c, p.id, l, { mode: "create" }];
|
|
2449
2449
|
});
|
|
2450
2450
|
}
|
|
2451
|
-
function
|
|
2452
|
-
const { stores: n, attrs: r } = t, [i, s, o, a] = e, u = Nn(o), c = ee(r, i, s), d =
|
|
2451
|
+
function Oa(t, e) {
|
|
2452
|
+
const { stores: n, attrs: r } = t, [i, s, o, a] = e, u = Nn(o), c = ee(r, i, s), d = Fi(t, [i, c, o, a]);
|
|
2453
2453
|
return [["id", c]].concat(Object.entries(u)).map(([l, p]) => {
|
|
2454
2454
|
const y = G(r, i, l);
|
|
2455
2455
|
return y["checked-data-type"] === "date" && t.useDateObjects && (p = Rt(p)), [
|
|
@@ -2461,11 +2461,11 @@ function Sa(t, e) {
|
|
|
2461
2461
|
];
|
|
2462
2462
|
});
|
|
2463
2463
|
}
|
|
2464
|
-
function
|
|
2464
|
+
function Ea({ attrs: t }, [e, n]) {
|
|
2465
2465
|
return [["delete-entity", ee(t, e, n), e]];
|
|
2466
2466
|
}
|
|
2467
|
-
function
|
|
2468
|
-
const { stores: n, attrs: r } = t, [i, s, o, a] = e, u = Nn(o), c = ee(r, i, s), d =
|
|
2467
|
+
function Aa(t, e) {
|
|
2468
|
+
const { stores: n, attrs: r } = t, [i, s, o, a] = e, u = Nn(o), c = ee(r, i, s), d = Fi(t, [i, c, o, a]), f = Object.entries(u).map(([p, y]) => {
|
|
2469
2469
|
const b = G(r, i, p);
|
|
2470
2470
|
return [
|
|
2471
2471
|
"deep-merge-triple",
|
|
@@ -2483,38 +2483,38 @@ function Ea(t, e) {
|
|
|
2483
2483
|
...d ? [d] : []
|
|
2484
2484
|
]].concat(f);
|
|
2485
2485
|
}
|
|
2486
|
-
function
|
|
2486
|
+
function ka({ attrs: t }, [e, n, r]) {
|
|
2487
2487
|
return [["rule-params", ee(t, e, n), e, r]];
|
|
2488
2488
|
}
|
|
2489
|
-
function
|
|
2489
|
+
function ja(t) {
|
|
2490
2490
|
const [e, n, r, i, s] = t;
|
|
2491
2491
|
if (!i)
|
|
2492
2492
|
return t;
|
|
2493
2493
|
const o = Object.assign({}, i);
|
|
2494
2494
|
return delete o.id, [e, n, r, o, ...s ? [s] : []];
|
|
2495
2495
|
}
|
|
2496
|
-
function
|
|
2497
|
-
const [n, ...r] =
|
|
2496
|
+
function Ca(t, e) {
|
|
2497
|
+
const [n, ...r] = ja(e);
|
|
2498
2498
|
switch (n) {
|
|
2499
2499
|
case "merge":
|
|
2500
|
-
return
|
|
2500
|
+
return Aa(t, r);
|
|
2501
2501
|
case "create":
|
|
2502
|
-
return va(t, r);
|
|
2503
|
-
case "update":
|
|
2504
2502
|
return Sa(t, r);
|
|
2503
|
+
case "update":
|
|
2504
|
+
return Oa(t, r);
|
|
2505
2505
|
case "link":
|
|
2506
|
-
return Ta(t, r);
|
|
2507
|
-
case "unlink":
|
|
2508
2506
|
return wa(t, r);
|
|
2507
|
+
case "unlink":
|
|
2508
|
+
return ma(t, r);
|
|
2509
2509
|
case "delete":
|
|
2510
|
-
return
|
|
2510
|
+
return Ea(t, r);
|
|
2511
2511
|
case "ruleParams":
|
|
2512
|
-
return
|
|
2512
|
+
return ka(t, r);
|
|
2513
2513
|
default:
|
|
2514
2514
|
throw new Error(`unsupported action ${n}`);
|
|
2515
2515
|
}
|
|
2516
2516
|
}
|
|
2517
|
-
function
|
|
2517
|
+
function Pa(t) {
|
|
2518
2518
|
switch (t) {
|
|
2519
2519
|
case "string":
|
|
2520
2520
|
case "date":
|
|
@@ -2525,14 +2525,14 @@ function Ca(t) {
|
|
|
2525
2525
|
return;
|
|
2526
2526
|
}
|
|
2527
2527
|
}
|
|
2528
|
-
function
|
|
2528
|
+
function Ia(t, e, n) {
|
|
2529
2529
|
var r, i;
|
|
2530
2530
|
const s = (i = (r = t.entities[e]) === null || r === void 0 ? void 0 : r.attrs) === null || i === void 0 ? void 0 : i[n];
|
|
2531
2531
|
if (n === "id")
|
|
2532
2532
|
return null;
|
|
2533
2533
|
if (!s)
|
|
2534
2534
|
throw new Error(`${e}.${n} does not exist in your schema`);
|
|
2535
|
-
const { unique: o, indexed: a } = s == null ? void 0 : s.config, u =
|
|
2535
|
+
const { unique: o, indexed: a } = s == null ? void 0 : s.config, u = Pa(s == null ? void 0 : s.valueType);
|
|
2536
2536
|
return {
|
|
2537
2537
|
"index?": a,
|
|
2538
2538
|
"unique?": o,
|
|
@@ -2540,14 +2540,14 @@ function Pa(t, e, n) {
|
|
|
2540
2540
|
};
|
|
2541
2541
|
}
|
|
2542
2542
|
function _t(t, e, n, r) {
|
|
2543
|
-
const i = t ?
|
|
2543
|
+
const i = t ? Ia(t, e, n) : null, s = K(), a = [K(), e, n];
|
|
2544
2544
|
return Object.assign(Object.assign({ id: s, "forward-identity": a, "value-type": "blob", cardinality: "one", "unique?": !1, "index?": !1, isUnsynced: !0 }, i || {}), r || {});
|
|
2545
2545
|
}
|
|
2546
|
-
function
|
|
2546
|
+
function Ma(t, e, n) {
|
|
2547
2547
|
return Object.values(t.links).find((i) => i.forward.on === e && i.forward.label === n || i.reverse.on === e && i.reverse.label === n);
|
|
2548
2548
|
}
|
|
2549
|
-
function
|
|
2550
|
-
const r =
|
|
2549
|
+
function Ra(t, e, n) {
|
|
2550
|
+
const r = Ma(t, e, n);
|
|
2551
2551
|
if (!r)
|
|
2552
2552
|
throw new Error(`Couldn't find the link ${e}.${n} in your schema`);
|
|
2553
2553
|
const { forward: i, reverse: s } = r;
|
|
@@ -2561,10 +2561,10 @@ function Ma(t, e, n) {
|
|
|
2561
2561
|
};
|
|
2562
2562
|
}
|
|
2563
2563
|
function Rr(t, e, n, r) {
|
|
2564
|
-
const i = t ?
|
|
2564
|
+
const i = t ? Ra(t, e, n) : null, s = K(), o = [K(), e, n], a = [K(), n, e];
|
|
2565
2565
|
return Object.assign(Object.assign({ id: s, "forward-identity": o, "reverse-identity": a, "value-type": "ref", cardinality: "many", "unique?": !1, "index?": !1, isUnsynced: !0 }, i || {}), r || {});
|
|
2566
2566
|
}
|
|
2567
|
-
const
|
|
2567
|
+
const xa = /* @__PURE__ */ new Set(["create", "update", "merge", "link", "unlink"]), $a = /* @__PURE__ */ new Set(["link", "unlink"]), Da = /* @__PURE__ */ new Set(["create", "update", "merge"]), Ua = /* @__PURE__ */ new Set([
|
|
2568
2568
|
"link",
|
|
2569
2569
|
"unlink",
|
|
2570
2570
|
"create",
|
|
@@ -2572,10 +2572,10 @@ const Ra = /* @__PURE__ */ new Set(["create", "update", "merge", "link", "unlink
|
|
|
2572
2572
|
"merge",
|
|
2573
2573
|
"delete",
|
|
2574
2574
|
"ruleParams"
|
|
2575
|
-
]), Tn = { "unique?": !0, "index?": !0 },
|
|
2576
|
-
function
|
|
2575
|
+
]), Tn = { "unique?": !0, "index?": !0 }, La = Object.assign(Object.assign({}, Tn), { cardinality: "one" });
|
|
2576
|
+
function Fa(t) {
|
|
2577
2577
|
const e = [], [n, r, i, s] = t;
|
|
2578
|
-
if (!
|
|
2578
|
+
if (!Ua.has(n))
|
|
2579
2579
|
return e;
|
|
2580
2580
|
const o = gn(i);
|
|
2581
2581
|
if (o && e.push({ etype: r, lookupPair: o }), n === "link")
|
|
@@ -2592,7 +2592,7 @@ function La(t) {
|
|
|
2592
2592
|
}
|
|
2593
2593
|
return e;
|
|
2594
2594
|
}
|
|
2595
|
-
function
|
|
2595
|
+
function Na({ attrs: t, schema: e }, n) {
|
|
2596
2596
|
var r, i;
|
|
2597
2597
|
const [s, o, a] = [/* @__PURE__ */ new Set(), Object.assign({}, t), []];
|
|
2598
2598
|
function u(f) {
|
|
@@ -2603,10 +2603,10 @@ function Fa({ attrs: t, schema: e }, n) {
|
|
|
2603
2603
|
}
|
|
2604
2604
|
function d(f, l) {
|
|
2605
2605
|
const p = G(o, f, l), y = ke(o, f, l);
|
|
2606
|
-
c(p), c(y), !p && !y && u(Rr(e, f, l,
|
|
2606
|
+
c(p), c(y), !p && !y && u(Rr(e, f, l, La));
|
|
2607
2607
|
}
|
|
2608
2608
|
for (const f of n)
|
|
2609
|
-
for (const { etype: l, lookupPair: p, linkLabel: y } of
|
|
2609
|
+
for (const { etype: l, lookupPair: p, linkLabel: y } of Fa(f)) {
|
|
2610
2610
|
const b = p[0];
|
|
2611
2611
|
if (y) {
|
|
2612
2612
|
d(l, y);
|
|
@@ -2628,12 +2628,12 @@ function Fa({ attrs: t, schema: e }, n) {
|
|
|
2628
2628
|
}
|
|
2629
2629
|
for (const f of n) {
|
|
2630
2630
|
const [l, p, y, b] = f;
|
|
2631
|
-
if (
|
|
2631
|
+
if (xa.has(l)) {
|
|
2632
2632
|
const g = G(o, p, "id");
|
|
2633
2633
|
c(g), g || u(_t(e, p, "id", { "unique?": !0 }));
|
|
2634
2634
|
for (const w of Object.keys(b)) {
|
|
2635
2635
|
const T = G(o, p, w);
|
|
2636
|
-
if (c(T),
|
|
2636
|
+
if (c(T), Da.has(l) && (T || u(_t(e, p, w, w === "id" ? { "unique?": !0 } : null))), $a.has(l)) {
|
|
2637
2637
|
const m = ke(o, p, w);
|
|
2638
2638
|
!T && !m && u(Rr(e, p, w)), c(m);
|
|
2639
2639
|
}
|
|
@@ -2642,11 +2642,11 @@ function Fa({ attrs: t, schema: e }, n) {
|
|
|
2642
2642
|
}
|
|
2643
2643
|
return [o, a];
|
|
2644
2644
|
}
|
|
2645
|
-
function
|
|
2646
|
-
const r = (Array.isArray(e) ? e : [e]).flatMap((u) =>
|
|
2645
|
+
function Ka(t, e) {
|
|
2646
|
+
const r = (Array.isArray(e) ? e : [e]).flatMap((u) => ba(u)), [i, s] = Na(t, r), o = Object.assign(Object.assign({}, t), { attrs: i }), a = r.flatMap((u) => Ca(o, u));
|
|
2647
2647
|
return [...s, ...a];
|
|
2648
2648
|
}
|
|
2649
|
-
var
|
|
2649
|
+
var de = function(t, e, n, r) {
|
|
2650
2650
|
function i(s) {
|
|
2651
2651
|
return s instanceof n ? s : new n(function(o) {
|
|
2652
2652
|
o(s);
|
|
@@ -2673,286 +2673,254 @@ var pe = function(t, e, n, r) {
|
|
|
2673
2673
|
c((r = r.apply(t, e || [])).next());
|
|
2674
2674
|
});
|
|
2675
2675
|
};
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
return function(n) {
|
|
2679
|
-
console.error("Error in IndexedDB event", { source: t, event: n });
|
|
2680
|
-
};
|
|
2676
|
+
function xr(t, e) {
|
|
2677
|
+
typeof requestIdleCallback > "u" ? t() : requestIdleCallback(t, { timeout: e });
|
|
2681
2678
|
}
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
n.onerror = (r) => {
|
|
2687
|
-
e(null);
|
|
2688
|
-
}, n.onsuccess = (r) => {
|
|
2689
|
-
const s = r.target.result;
|
|
2690
|
-
e(s);
|
|
2691
|
-
}, n.onupgradeneeded = (r) => {
|
|
2692
|
-
r.target.transaction.abort(), e(null);
|
|
2693
|
-
};
|
|
2694
|
-
});
|
|
2695
|
-
});
|
|
2679
|
+
const Yt = "__meta";
|
|
2680
|
+
class qa {
|
|
2681
|
+
constructor(e, n) {
|
|
2682
|
+
}
|
|
2696
2683
|
}
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
|
|
2684
|
+
class wn {
|
|
2685
|
+
constructor(e, n, r, i, s, o, a) {
|
|
2686
|
+
var u, c;
|
|
2687
|
+
this._subs = [], this._nextSave = null, this._nextGc = null, this._pendingSaveKeys = /* @__PURE__ */ new Set(), this._loadedKeys = /* @__PURE__ */ new Set(), this._version = 0, this._meta = {
|
|
2688
|
+
isLoading: !0,
|
|
2689
|
+
onLoadCbs: [],
|
|
2690
|
+
value: null,
|
|
2691
|
+
error: null,
|
|
2692
|
+
attempts: 0
|
|
2693
|
+
}, this._persister = e, this._onMerge = n, this.serialize = r, this.parse = i, this._objectSize = s, this._log = o, this._saveThrottleMs = (u = a.saveThrottleMs) !== null && u !== void 0 ? u : 100, this._idleCallbackMaxWaitMs = (c = a.idleCallbackMaxWaitMs) !== null && c !== void 0 ? c : 1e3, this._gcOpts = a.gc, this.currentValue = {}, this._loadedKeys = /* @__PURE__ */ new Set(), this._loadingKeys = {}, this._initMeta(), a.preloadEntryCount && this._preloadEntries(a.preloadEntryCount);
|
|
2694
|
+
}
|
|
2695
|
+
_initMeta() {
|
|
2696
|
+
return de(this, void 0, void 0, function* () {
|
|
2697
|
+
var e, n, r;
|
|
2698
|
+
this._meta.loadingPromise && (yield this._meta.loadingPromise);
|
|
2699
|
+
try {
|
|
2700
|
+
const i = this._persister.getItem(Yt);
|
|
2701
|
+
this._meta.loadingPromise = i;
|
|
2702
|
+
const s = yield i;
|
|
2703
|
+
this._meta.isLoading = !1, this._meta.error = null, this._meta.loadingPromise = null, this._meta.attempts = 0;
|
|
2704
|
+
const o = (n = (e = this._meta.value) === null || e === void 0 ? void 0 : e.objects) !== null && n !== void 0 ? n : {}, a = s ?? {}, u = (r = a.objects) !== null && r !== void 0 ? r : {};
|
|
2705
|
+
this._meta.value = Object.assign(Object.assign({}, a), { objects: Object.assign(Object.assign({}, o), u) });
|
|
2706
|
+
} catch (i) {
|
|
2707
|
+
this._meta.error = i, this._meta.attempts++, this._meta.loadingPromise = null;
|
|
2710
2708
|
}
|
|
2711
|
-
for (const a of i)
|
|
2712
|
-
a.onsuccess = () => {
|
|
2713
|
-
i.delete(a), i.size === 0 && s();
|
|
2714
|
-
}, a.onerror = (u) => {
|
|
2715
|
-
o(u);
|
|
2716
|
-
};
|
|
2717
|
-
});
|
|
2718
|
-
});
|
|
2719
|
-
}
|
|
2720
|
-
function Ga(t, e, n) {
|
|
2721
|
-
return pe(this, void 0, void 0, function* () {
|
|
2722
|
-
const r = n.put(e, t);
|
|
2723
|
-
return new Promise((i, s) => {
|
|
2724
|
-
r.onsuccess = () => i(), r.onerror = (o) => s(o);
|
|
2725
2709
|
});
|
|
2726
|
-
}
|
|
2727
|
-
|
|
2728
|
-
|
|
2729
|
-
|
|
2730
|
-
const n = yield za(`instant_${t}_5`);
|
|
2731
|
-
if (!n)
|
|
2732
|
-
return;
|
|
2733
|
-
const r = e.objectStore("kv"), i = e.objectStore("querySubs");
|
|
2734
|
-
return new Promise((s, o) => {
|
|
2735
|
-
const c = n.transaction(["kv"], "readwrite").objectStore("kv").openCursor();
|
|
2736
|
-
c.onerror = (f) => {
|
|
2737
|
-
o(f);
|
|
2738
|
-
};
|
|
2739
|
-
const d = [];
|
|
2740
|
-
c.onsuccess = () => {
|
|
2741
|
-
const f = c.result;
|
|
2742
|
-
if (f) {
|
|
2743
|
-
const l = f.key, p = f.value;
|
|
2744
|
-
switch (l) {
|
|
2745
|
-
case "querySubs": {
|
|
2746
|
-
const y = Va(l, p, i);
|
|
2747
|
-
d.push(y);
|
|
2748
|
-
break;
|
|
2749
|
-
}
|
|
2750
|
-
default: {
|
|
2751
|
-
const y = Ga(l, p, r);
|
|
2752
|
-
d.push(y);
|
|
2753
|
-
break;
|
|
2754
|
-
}
|
|
2755
|
-
}
|
|
2756
|
-
} else
|
|
2757
|
-
Promise.all(d).then(() => s()).catch(o);
|
|
2758
|
-
};
|
|
2710
|
+
}
|
|
2711
|
+
_getMeta() {
|
|
2712
|
+
return de(this, void 0, void 0, function* () {
|
|
2713
|
+
return this._meta.value ? this._meta.value : this._meta.loadingPromise ? (yield this._meta.loadingPromise, this._meta.value) : (this._initMeta(), yield this._meta.loadingPromise, this._meta.value);
|
|
2759
2714
|
});
|
|
2760
|
-
});
|
|
2761
|
-
}
|
|
2762
|
-
class Fi {
|
|
2763
|
-
constructor(e, n) {
|
|
2764
|
-
this.dbName = `instant_${e}_${Ka}`, this._storeName = n, this._appId = e, this._dbPromise = this._init();
|
|
2765
2715
|
}
|
|
2766
|
-
|
|
2767
|
-
return
|
|
2768
|
-
|
|
2769
|
-
r.onerror = (i) => {
|
|
2770
|
-
n(i);
|
|
2771
|
-
}, r.onsuccess = (i) => {
|
|
2772
|
-
const o = i.target.result;
|
|
2773
|
-
e(o);
|
|
2774
|
-
}, r.onupgradeneeded = (i) => this._upgradeStore(i);
|
|
2716
|
+
_refreshMeta() {
|
|
2717
|
+
return de(this, void 0, void 0, function* () {
|
|
2718
|
+
return yield this._initMeta(), this._meta.value;
|
|
2775
2719
|
});
|
|
2776
2720
|
}
|
|
2777
|
-
|
|
2778
|
-
|
|
2779
|
-
|
|
2780
|
-
r.
|
|
2781
|
-
|
|
2782
|
-
|
|
2721
|
+
_preloadEntries(e) {
|
|
2722
|
+
return de(this, void 0, void 0, function* () {
|
|
2723
|
+
const n = yield this.waitForMetaToLoad(), r = Object.entries(n.objects);
|
|
2724
|
+
r.sort(([i, s], [o, a]) => a.updatedAt - s.updatedAt);
|
|
2725
|
+
for (const [i] of r.slice(0, e))
|
|
2726
|
+
this._loadKey(i);
|
|
2727
|
+
});
|
|
2783
2728
|
}
|
|
2784
|
-
|
|
2785
|
-
return
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
a.result ? r(a.result) : r(null);
|
|
2793
|
-
};
|
|
2794
|
-
});
|
|
2729
|
+
_getFromStorage(e) {
|
|
2730
|
+
return de(this, void 0, void 0, function* () {
|
|
2731
|
+
try {
|
|
2732
|
+
const n = yield this._persister.getItem(e);
|
|
2733
|
+
return n && this.parse(e, n);
|
|
2734
|
+
} catch (n) {
|
|
2735
|
+
return console.error(`Unable to read from storage for key=${e}`, n), null;
|
|
2736
|
+
}
|
|
2795
2737
|
});
|
|
2796
2738
|
}
|
|
2797
|
-
|
|
2798
|
-
return
|
|
2799
|
-
|
|
2800
|
-
return new Promise((i, s) => {
|
|
2801
|
-
const u = r.transaction([this._storeName], "readwrite").objectStore(this._storeName).put(n, e);
|
|
2802
|
-
u.onerror = (c) => {
|
|
2803
|
-
s(c);
|
|
2804
|
-
}, u.onsuccess = (c) => {
|
|
2805
|
-
i();
|
|
2806
|
-
};
|
|
2807
|
-
});
|
|
2739
|
+
waitForKeyToLoad(e) {
|
|
2740
|
+
return de(this, void 0, void 0, function* () {
|
|
2741
|
+
return this._loadedKeys.has(e) ? this.currentValue[e] : (yield this._loadingKeys[e] || this._loadKey(e), this.currentValue[e]);
|
|
2808
2742
|
});
|
|
2809
2743
|
}
|
|
2810
|
-
//
|
|
2811
|
-
|
|
2812
|
-
return
|
|
2813
|
-
|
|
2814
|
-
return new Promise((r, i) => {
|
|
2815
|
-
const s = n.transaction([this._storeName], "readwrite"), o = s.objectStore(this._storeName), a = /* @__PURE__ */ new Set();
|
|
2816
|
-
for (const [u, c] of e) {
|
|
2817
|
-
const d = o.put(c, u);
|
|
2818
|
-
a.add(d);
|
|
2819
|
-
}
|
|
2820
|
-
for (const u of a)
|
|
2821
|
-
u.onerror = (c) => {
|
|
2822
|
-
s.abort(), i(c);
|
|
2823
|
-
}, u.onsuccess = (c) => {
|
|
2824
|
-
a.delete(u), a.size === 0 && r();
|
|
2825
|
-
};
|
|
2826
|
-
});
|
|
2744
|
+
// Used for tests
|
|
2745
|
+
waitForMetaToLoad() {
|
|
2746
|
+
return de(this, void 0, void 0, function* () {
|
|
2747
|
+
return this._getMeta();
|
|
2827
2748
|
});
|
|
2828
2749
|
}
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2750
|
+
// Unloads the key so that it can be garbage collected, but does not
|
|
2751
|
+
// delete it. Removes the key from currentValue.
|
|
2752
|
+
unloadKey(e) {
|
|
2753
|
+
this._loadedKeys.delete(e), delete this._loadingKeys[e], delete this.currentValue[e];
|
|
2754
|
+
}
|
|
2755
|
+
_loadKey(e) {
|
|
2756
|
+
return de(this, void 0, void 0, function* () {
|
|
2757
|
+
if (this._loadedKeys.has(e) || e in this._loadingKeys)
|
|
2758
|
+
return;
|
|
2759
|
+
const n = this._getFromStorage(e);
|
|
2760
|
+
this._loadingKeys[e] = n;
|
|
2761
|
+
const r = yield n;
|
|
2762
|
+
if (delete this._loadingKeys[e], this._loadedKeys.add(e), r) {
|
|
2763
|
+
const i = this._onMerge(e, r, this.currentValue[e]);
|
|
2764
|
+
i && (this.currentValue[e] = i);
|
|
2765
|
+
}
|
|
2766
|
+
this.onKeyLoaded && this.onKeyLoaded(e);
|
|
2840
2767
|
});
|
|
2841
2768
|
}
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
|
|
2845
|
-
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
|
|
2849
|
-
|
|
2850
|
-
|
|
2851
|
-
|
|
2769
|
+
// Returns a promise with a number so that we can wait for flush
|
|
2770
|
+
// to finish in the tests. The number is the number of operations
|
|
2771
|
+
// it performed, but it's mostly there so that typescript will warn
|
|
2772
|
+
// us if we forget to retun the promise from the function.
|
|
2773
|
+
_writeToStorage(e) {
|
|
2774
|
+
var n, r;
|
|
2775
|
+
const i = [], s = e == null ? void 0 : e.skipGc;
|
|
2776
|
+
if (this._meta.isLoading) {
|
|
2777
|
+
const p = new Promise((y, b) => {
|
|
2778
|
+
var g;
|
|
2779
|
+
setTimeout(() => this._enqueuePersist(e ? Object.assign(Object.assign({}, e), { attempts: (e.attempts || 0) + 1 }) : { attempts: 1 }).then(y).catch(b), 10 + ((g = e == null ? void 0 : e.attempts) !== null && g !== void 0 ? g : 0) * 1e3);
|
|
2852
2780
|
});
|
|
2853
|
-
|
|
2781
|
+
return i.push(p), Promise.all(i).then((y) => y.reduce((b, g) => b + g, 0));
|
|
2782
|
+
}
|
|
2783
|
+
const o = this._meta.value;
|
|
2784
|
+
if (!o)
|
|
2785
|
+
return Promise.resolve(0);
|
|
2786
|
+
const a = [], u = [];
|
|
2787
|
+
for (const p of this._pendingSaveKeys)
|
|
2788
|
+
p in this.currentValue ? u.push(p) : (a.push(p), delete o.objects[p]);
|
|
2789
|
+
for (const p of a) {
|
|
2790
|
+
const y = this._persister.removeItem(p);
|
|
2791
|
+
i.push(y.then(() => 1)), this._loadedKeys.delete(p), this._pendingSaveKeys.delete(p);
|
|
2792
|
+
}
|
|
2793
|
+
const c = [], d = [[Yt, o]], f = (n = o.objects) !== null && n !== void 0 ? n : {};
|
|
2794
|
+
o.objects = f;
|
|
2795
|
+
for (const p of u)
|
|
2796
|
+
if (this._loadedKeys.has(p)) {
|
|
2797
|
+
const y = this.serialize(p, this.currentValue[p]);
|
|
2798
|
+
d.push([p, y]);
|
|
2799
|
+
const b = this._objectSize(y), g = (r = f[p]) !== null && r !== void 0 ? r : {
|
|
2800
|
+
createdAt: Date.now(),
|
|
2801
|
+
updatedAt: Date.now(),
|
|
2802
|
+
size: b
|
|
2803
|
+
};
|
|
2804
|
+
g.updatedAt = Date.now(), g.size = b, f[p] = g, this._pendingSaveKeys.delete(p);
|
|
2805
|
+
} else
|
|
2806
|
+
c.push(p);
|
|
2807
|
+
const l = this._persister.multiSet(d);
|
|
2808
|
+
i.push(l.then(() => 1));
|
|
2809
|
+
for (const p of c) {
|
|
2810
|
+
const y = this._loadKey(p).then(() => this._enqueuePersist(e));
|
|
2811
|
+
i.push(y);
|
|
2812
|
+
}
|
|
2813
|
+
return s || this.gc(), Promise.all(i).then((p) => p.reduce((y, b) => y + b, 0));
|
|
2854
2814
|
}
|
|
2855
|
-
|
|
2856
|
-
|
|
2857
|
-
|
|
2858
|
-
return s instanceof n ? s : new n(function(o) {
|
|
2859
|
-
o(s);
|
|
2815
|
+
flush() {
|
|
2816
|
+
return de(this, void 0, void 0, function* () {
|
|
2817
|
+
return this._nextSave ? (clearTimeout(this._nextSave), this._nextSave = null, this._writeToStorage()) : void 0;
|
|
2860
2818
|
});
|
|
2861
2819
|
}
|
|
2862
|
-
|
|
2863
|
-
function
|
|
2864
|
-
|
|
2865
|
-
|
|
2866
|
-
|
|
2867
|
-
|
|
2820
|
+
_gc() {
|
|
2821
|
+
return de(this, void 0, void 0, function* () {
|
|
2822
|
+
const e = new Set(yield this._persister.getAllKeys());
|
|
2823
|
+
e.delete(Yt);
|
|
2824
|
+
const n = new Set(Object.keys(this.currentValue));
|
|
2825
|
+
for (const l of Object.keys(this._loadingKeys))
|
|
2826
|
+
n.add(l);
|
|
2827
|
+
for (const l of this._loadedKeys)
|
|
2828
|
+
n.add(l);
|
|
2829
|
+
const r = yield this._refreshMeta();
|
|
2830
|
+
if (!r) {
|
|
2831
|
+
this._log.info("Could not gc because we were not able to load meta");
|
|
2832
|
+
return;
|
|
2868
2833
|
}
|
|
2869
|
-
|
|
2870
|
-
|
|
2871
|
-
|
|
2872
|
-
|
|
2873
|
-
|
|
2874
|
-
|
|
2834
|
+
const i = [], s = {
|
|
2835
|
+
gcOpts: this._gcOpts,
|
|
2836
|
+
keys: e,
|
|
2837
|
+
sacredKeys: n,
|
|
2838
|
+
removed: [],
|
|
2839
|
+
metaRemoved: [],
|
|
2840
|
+
removedMissingCount: 0,
|
|
2841
|
+
removedOldCount: 0,
|
|
2842
|
+
removedThresholdCount: 0,
|
|
2843
|
+
removedSizeCount: 0
|
|
2844
|
+
};
|
|
2845
|
+
for (const l of e)
|
|
2846
|
+
n.has(l) || l in r.objects || (this._log.info("Lost track of key in meta", l), i.push(this._persister.removeItem(l)), s.removed.push(l), s.removedMissingCount++);
|
|
2847
|
+
const o = Date.now();
|
|
2848
|
+
for (const [l, p] of Object.entries(r.objects))
|
|
2849
|
+
!n.has(l) && p.updatedAt < o - this._gcOpts.maxAgeMs && (i.push(this._persister.removeItem(l)), delete r.objects[l], s.removed.push(l), s.removedOldCount++);
|
|
2850
|
+
const a = Object.entries(r.objects);
|
|
2851
|
+
a.sort(([l, p], [y, b]) => p.updatedAt - b.updatedAt);
|
|
2852
|
+
const u = a.filter(([l]) => !n.has(l));
|
|
2853
|
+
if (a.length > this._gcOpts.maxEntries)
|
|
2854
|
+
for (const [l] of u.slice(0, a.length - this._gcOpts.maxEntries))
|
|
2855
|
+
i.push(this._persister.removeItem(l)), delete r.objects[l], s.removed.push(l), s.removedThresholdCount++;
|
|
2856
|
+
const c = Object.entries(r.objects);
|
|
2857
|
+
c.sort(([l, p], [y, b]) => p.updatedAt - b.updatedAt);
|
|
2858
|
+
const d = c.filter(([l]) => !n.has(l));
|
|
2859
|
+
let f = c.reduce((l, [p, y]) => l + y.size, 0);
|
|
2860
|
+
for (; f > 0 && f > this._gcOpts.maxSize && d.length; ) {
|
|
2861
|
+
const [[l, p]] = d.splice(0, 1);
|
|
2862
|
+
f -= p.size, i.push(this._persister.removeItem(l)), delete r.objects[l], s.removed.push(l), s.removedSizeCount++;
|
|
2875
2863
|
}
|
|
2876
|
-
|
|
2877
|
-
|
|
2878
|
-
|
|
2879
|
-
}
|
|
2880
|
-
c((r = r.apply(t, e || [])).next());
|
|
2881
|
-
});
|
|
2882
|
-
};
|
|
2883
|
-
class Ni {
|
|
2884
|
-
static getIsOnline() {
|
|
2885
|
-
return Qa(this, void 0, void 0, function* () {
|
|
2886
|
-
return navigator.onLine;
|
|
2864
|
+
for (const l of Object.keys(r.objects))
|
|
2865
|
+
!e.has(l) && !n.has(l) && delete r.objects[l];
|
|
2866
|
+
return (s.removed.length || s.metaRemoved.length) && i.push(this._enqueuePersist({ skipGc: !0 })), this._log.info("Completed GC", s), yield Promise.all(i), s;
|
|
2887
2867
|
});
|
|
2888
2868
|
}
|
|
2889
|
-
|
|
2890
|
-
|
|
2891
|
-
|
|
2892
|
-
|
|
2893
|
-
|
|
2894
|
-
|
|
2895
|
-
|
|
2896
|
-
|
|
2897
|
-
|
|
2869
|
+
// Schedules a GC to run in one minute (unless it is already scheduled)
|
|
2870
|
+
gc() {
|
|
2871
|
+
this._nextGc || (this._nextGc = setTimeout(
|
|
2872
|
+
() => {
|
|
2873
|
+
xr(() => {
|
|
2874
|
+
this._nextGc = null, this._gc();
|
|
2875
|
+
}, 30 * 1e3);
|
|
2876
|
+
},
|
|
2877
|
+
// 1 minute + some jitter to keep multiple tabs from running at same time
|
|
2878
|
+
1e3 * 60 + Math.random() * 500
|
|
2879
|
+
));
|
|
2898
2880
|
}
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
2881
|
+
_enqueuePersist(e) {
|
|
2882
|
+
return new Promise((n, r) => {
|
|
2883
|
+
if (this._nextSave) {
|
|
2884
|
+
n(0);
|
|
2885
|
+
return;
|
|
2886
|
+
}
|
|
2887
|
+
this._nextSave = setTimeout(() => {
|
|
2888
|
+
xr(() => {
|
|
2889
|
+
this._nextSave = null, this._writeToStorage(e).then(n).catch(r);
|
|
2890
|
+
}, this._idleCallbackMaxWaitMs);
|
|
2891
|
+
}, this._saveThrottleMs);
|
|
2892
|
+
});
|
|
2905
2893
|
}
|
|
2906
|
-
|
|
2907
|
-
return
|
|
2894
|
+
version() {
|
|
2895
|
+
return this._version;
|
|
2908
2896
|
}
|
|
2909
|
-
|
|
2910
|
-
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
|
|
2897
|
+
// Takes a function that updates the store in place.
|
|
2898
|
+
// Uses `mutative` to get a list of keys that were changed
|
|
2899
|
+
// so that we know which entries we need to persist to the store.
|
|
2900
|
+
updateInPlace(e) {
|
|
2901
|
+
this._version++;
|
|
2902
|
+
const [n, r] = Ct(this.currentValue, e, {
|
|
2903
|
+
enablePatches: !0
|
|
2914
2904
|
});
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
try {
|
|
2919
|
-
c(r.next(d));
|
|
2920
|
-
} catch (f) {
|
|
2921
|
-
o(f);
|
|
2922
|
-
}
|
|
2923
|
-
}
|
|
2924
|
-
function u(d) {
|
|
2925
|
-
try {
|
|
2926
|
-
c(r.throw(d));
|
|
2927
|
-
} catch (f) {
|
|
2928
|
-
o(f);
|
|
2929
|
-
}
|
|
2930
|
-
}
|
|
2931
|
-
function c(d) {
|
|
2932
|
-
d.done ? s(d.value) : i(d.value).then(a, u);
|
|
2905
|
+
for (const i of r) {
|
|
2906
|
+
const s = i.path[0];
|
|
2907
|
+
s && typeof s == "string" && (this._pendingSaveKeys.add(s), this._loadedKeys.has(s) || this._loadKey(s));
|
|
2933
2908
|
}
|
|
2934
|
-
|
|
2935
|
-
|
|
2936
|
-
|
|
2937
|
-
|
|
2938
|
-
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
super(r, e.body.hint);
|
|
2942
|
-
const i = new.target.prototype;
|
|
2943
|
-
Object.setPrototypeOf && Object.setPrototypeOf(this, i), Error.captureStackTrace && Error.captureStackTrace(this, $t), this.name = "InstantAPIError", this.status = e.status, this.body = e.body;
|
|
2909
|
+
for (const i of Object.keys(n))
|
|
2910
|
+
if (!n[i])
|
|
2911
|
+
debugger;
|
|
2912
|
+
this.currentValue = n, this._enqueuePersist();
|
|
2913
|
+
for (const i of this._subs)
|
|
2914
|
+
i(this.currentValue);
|
|
2915
|
+
return n;
|
|
2944
2916
|
}
|
|
2945
|
-
|
|
2946
|
-
return
|
|
2917
|
+
subscribe(e) {
|
|
2918
|
+
return this._subs.push(e), e(this.currentValue), () => {
|
|
2919
|
+
this._subs = this._subs.filter((n) => n !== e);
|
|
2920
|
+
};
|
|
2947
2921
|
}
|
|
2948
2922
|
}
|
|
2949
|
-
function
|
|
2950
|
-
return Ha(this, void 0, void 0, function* () {
|
|
2951
|
-
const n = yield fetch(t, e), r = yield n.json();
|
|
2952
|
-
return n.status === 200 ? Promise.resolve(r) : Promise.reject(new $t({ status: n.status, body: r }));
|
|
2953
|
-
});
|
|
2954
|
-
}
|
|
2955
|
-
var Ve = function(t, e, n, r) {
|
|
2923
|
+
var pe = function(t, e, n, r) {
|
|
2956
2924
|
function i(s) {
|
|
2957
2925
|
return s instanceof n ? s : new n(function(o) {
|
|
2958
2926
|
o(s);
|
|
@@ -2979,93 +2947,203 @@ var Ve = function(t, e, n, r) {
|
|
|
2979
2947
|
c((r = r.apply(t, e || [])).next());
|
|
2980
2948
|
});
|
|
2981
2949
|
};
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
});
|
|
2950
|
+
const Wa = 6, za = ["kv", "querySubs", "syncSubs"];
|
|
2951
|
+
function Va(t) {
|
|
2952
|
+
return function(n) {
|
|
2953
|
+
console.error("Error in IndexedDB event", { source: t, event: n });
|
|
2954
|
+
};
|
|
2988
2955
|
}
|
|
2989
|
-
function
|
|
2990
|
-
return
|
|
2991
|
-
return
|
|
2992
|
-
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
},
|
|
2956
|
+
function Ga(t) {
|
|
2957
|
+
return pe(this, void 0, void 0, function* () {
|
|
2958
|
+
return new Promise((e) => {
|
|
2959
|
+
const n = indexedDB.open(t);
|
|
2960
|
+
n.onerror = (r) => {
|
|
2961
|
+
e(null);
|
|
2962
|
+
}, n.onsuccess = (r) => {
|
|
2963
|
+
const s = r.target.result;
|
|
2964
|
+
e(s);
|
|
2965
|
+
}, n.onupgradeneeded = (r) => {
|
|
2966
|
+
r.target.transaction.abort(), e(null);
|
|
2967
|
+
};
|
|
2999
2968
|
});
|
|
3000
2969
|
});
|
|
3001
2970
|
}
|
|
3002
|
-
function
|
|
3003
|
-
return
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
|
|
3010
|
-
|
|
2971
|
+
function Ba(t, e, n) {
|
|
2972
|
+
return pe(this, void 0, void 0, function* () {
|
|
2973
|
+
const r = (
|
|
2974
|
+
// Backwards compatibility for older versions where we JSON.stringified before storing
|
|
2975
|
+
typeof e == "string" ? JSON.parse(e) : e
|
|
2976
|
+
);
|
|
2977
|
+
if (!r)
|
|
2978
|
+
return;
|
|
2979
|
+
const i = /* @__PURE__ */ new Set();
|
|
2980
|
+
return new Promise((s, o) => {
|
|
2981
|
+
for (const [a, u] of Object.entries(r)) {
|
|
2982
|
+
const c = n.put(u, a);
|
|
2983
|
+
i.add(c);
|
|
2984
|
+
}
|
|
2985
|
+
for (const a of i)
|
|
2986
|
+
a.onsuccess = () => {
|
|
2987
|
+
i.delete(a), i.size === 0 && s();
|
|
2988
|
+
}, a.onerror = (u) => {
|
|
2989
|
+
o(u);
|
|
2990
|
+
};
|
|
3011
2991
|
});
|
|
3012
2992
|
});
|
|
3013
2993
|
}
|
|
3014
|
-
function
|
|
3015
|
-
return
|
|
3016
|
-
|
|
3017
|
-
|
|
3018
|
-
|
|
3019
|
-
body: JSON.stringify({
|
|
3020
|
-
"app-id": n
|
|
3021
|
-
})
|
|
2994
|
+
function Qa(t, e, n) {
|
|
2995
|
+
return pe(this, void 0, void 0, function* () {
|
|
2996
|
+
const r = n.put(e, t);
|
|
2997
|
+
return new Promise((i, s) => {
|
|
2998
|
+
r.onsuccess = () => i(), r.onerror = (o) => s(o);
|
|
3022
2999
|
});
|
|
3023
3000
|
});
|
|
3024
3001
|
}
|
|
3025
|
-
function
|
|
3026
|
-
return
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
|
|
3035
|
-
|
|
3002
|
+
function Ha(t, e) {
|
|
3003
|
+
return pe(this, void 0, void 0, function* () {
|
|
3004
|
+
const n = yield Ga(`instant_${t}_5`);
|
|
3005
|
+
if (!n)
|
|
3006
|
+
return;
|
|
3007
|
+
const r = yield new Promise((u, c) => {
|
|
3008
|
+
const l = n.transaction(["kv"], "readonly").objectStore("kv").openCursor();
|
|
3009
|
+
l.onerror = (y) => {
|
|
3010
|
+
c(y);
|
|
3011
|
+
};
|
|
3012
|
+
const p = [];
|
|
3013
|
+
l.onsuccess = () => {
|
|
3014
|
+
const y = l.result;
|
|
3015
|
+
if (y) {
|
|
3016
|
+
const b = y.key, g = y.value;
|
|
3017
|
+
p.push([b, g]), y.continue();
|
|
3018
|
+
} else
|
|
3019
|
+
u(p);
|
|
3020
|
+
}, l.onerror = (y) => {
|
|
3021
|
+
c(y);
|
|
3022
|
+
};
|
|
3023
|
+
}), i = e.transaction(["kv", "querySubs"], "readwrite"), s = i.objectStore("kv"), o = i.objectStore("querySubs"), a = [];
|
|
3024
|
+
for (const [u, c] of r)
|
|
3025
|
+
switch (u) {
|
|
3026
|
+
case "querySubs": {
|
|
3027
|
+
const d = Ba(u, c, o);
|
|
3028
|
+
a.push(d);
|
|
3029
|
+
break;
|
|
3030
|
+
}
|
|
3031
|
+
default: {
|
|
3032
|
+
const d = Qa(u, c, s);
|
|
3033
|
+
a.push(d);
|
|
3034
|
+
break;
|
|
3035
|
+
}
|
|
3036
|
+
}
|
|
3037
|
+
yield Promise.all(a), yield new Promise((u, c) => {
|
|
3038
|
+
i.oncomplete = (d) => u(d), i.onerror = (d) => c(d), i.onabort = (d) => c(d);
|
|
3036
3039
|
});
|
|
3037
3040
|
});
|
|
3038
3041
|
}
|
|
3039
|
-
|
|
3040
|
-
|
|
3041
|
-
|
|
3042
|
-
|
|
3043
|
-
|
|
3044
|
-
|
|
3045
|
-
|
|
3046
|
-
|
|
3047
|
-
|
|
3048
|
-
|
|
3049
|
-
|
|
3050
|
-
})
|
|
3042
|
+
const $r = /* @__PURE__ */ new Map();
|
|
3043
|
+
class Ni extends qa {
|
|
3044
|
+
constructor(e, n) {
|
|
3045
|
+
super(e, n), this.dbName = `instant_${e}_${Wa}`, this._storeName = n, this._appId = e, this._dbPromise = this._init();
|
|
3046
|
+
}
|
|
3047
|
+
_init() {
|
|
3048
|
+
return new Promise((e, n) => {
|
|
3049
|
+
let r = !1;
|
|
3050
|
+
const i = indexedDB.open(this.dbName, 1);
|
|
3051
|
+
i.onerror = (s) => {
|
|
3052
|
+
n(s);
|
|
3053
|
+
}, i.onsuccess = (s) => {
|
|
3054
|
+
const a = s.target.result;
|
|
3055
|
+
if (r) {
|
|
3056
|
+
const u = Ha(this._appId, a).catch((c) => {
|
|
3057
|
+
Va("Error upgrading store from version 5 to 6.")(c);
|
|
3058
|
+
});
|
|
3059
|
+
$r.set(this.dbName, u), u.then(() => e(a)).catch(() => e(a));
|
|
3060
|
+
} else {
|
|
3061
|
+
const u = $r.get(this.dbName);
|
|
3062
|
+
u ? u.then(() => e(a)).catch(() => e(a)) : e(a);
|
|
3063
|
+
}
|
|
3064
|
+
}, i.onupgradeneeded = (s) => {
|
|
3065
|
+
r = !0, this._upgradeStore(s);
|
|
3066
|
+
};
|
|
3051
3067
|
});
|
|
3052
|
-
}
|
|
3053
|
-
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
|
|
3057
|
-
|
|
3058
|
-
|
|
3059
|
-
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
|
|
3064
|
-
|
|
3068
|
+
}
|
|
3069
|
+
_upgradeStore(e) {
|
|
3070
|
+
const r = e.target.result;
|
|
3071
|
+
for (const i of za)
|
|
3072
|
+
r.objectStoreNames.contains(i) || r.createObjectStore(i);
|
|
3073
|
+
}
|
|
3074
|
+
getItem(e) {
|
|
3075
|
+
return pe(this, void 0, void 0, function* () {
|
|
3076
|
+
const n = yield this._dbPromise;
|
|
3077
|
+
return new Promise((r, i) => {
|
|
3078
|
+
const a = n.transaction([this._storeName], "readonly").objectStore(this._storeName).get(e);
|
|
3079
|
+
a.onerror = (u) => {
|
|
3080
|
+
i(u);
|
|
3081
|
+
}, a.onsuccess = (u) => {
|
|
3082
|
+
a.result ? r(a.result) : r(null);
|
|
3083
|
+
};
|
|
3084
|
+
});
|
|
3065
3085
|
});
|
|
3066
|
-
}
|
|
3086
|
+
}
|
|
3087
|
+
setItem(e, n) {
|
|
3088
|
+
return pe(this, void 0, void 0, function* () {
|
|
3089
|
+
const r = yield this._dbPromise;
|
|
3090
|
+
return new Promise((i, s) => {
|
|
3091
|
+
const u = r.transaction([this._storeName], "readwrite").objectStore(this._storeName).put(n, e);
|
|
3092
|
+
u.onerror = (c) => {
|
|
3093
|
+
s(c);
|
|
3094
|
+
}, u.onsuccess = (c) => {
|
|
3095
|
+
i();
|
|
3096
|
+
};
|
|
3097
|
+
});
|
|
3098
|
+
});
|
|
3099
|
+
}
|
|
3100
|
+
// Performs all writes in a transaction so that all succeed or none succeed.
|
|
3101
|
+
multiSet(e) {
|
|
3102
|
+
return pe(this, void 0, void 0, function* () {
|
|
3103
|
+
const n = yield this._dbPromise;
|
|
3104
|
+
return new Promise((r, i) => {
|
|
3105
|
+
const s = n.transaction([this._storeName], "readwrite"), o = s.objectStore(this._storeName), a = /* @__PURE__ */ new Set();
|
|
3106
|
+
for (const [u, c] of e) {
|
|
3107
|
+
const d = o.put(c, u);
|
|
3108
|
+
a.add(d);
|
|
3109
|
+
}
|
|
3110
|
+
for (const u of a)
|
|
3111
|
+
u.onerror = (c) => {
|
|
3112
|
+
s.abort(), i(c);
|
|
3113
|
+
}, u.onsuccess = (c) => {
|
|
3114
|
+
a.delete(u), a.size === 0 && r();
|
|
3115
|
+
};
|
|
3116
|
+
});
|
|
3117
|
+
});
|
|
3118
|
+
}
|
|
3119
|
+
removeItem(e) {
|
|
3120
|
+
return pe(this, void 0, void 0, function* () {
|
|
3121
|
+
const n = yield this._dbPromise;
|
|
3122
|
+
return new Promise((r, i) => {
|
|
3123
|
+
const a = n.transaction([this._storeName], "readwrite").objectStore(this._storeName).delete(e);
|
|
3124
|
+
a.onerror = (u) => {
|
|
3125
|
+
i(u);
|
|
3126
|
+
}, a.onsuccess = (u) => {
|
|
3127
|
+
r();
|
|
3128
|
+
};
|
|
3129
|
+
});
|
|
3130
|
+
});
|
|
3131
|
+
}
|
|
3132
|
+
getAllKeys() {
|
|
3133
|
+
return pe(this, void 0, void 0, function* () {
|
|
3134
|
+
const e = yield this._dbPromise;
|
|
3135
|
+
return new Promise((n, r) => {
|
|
3136
|
+
const o = e.transaction([this._storeName], "readwrite").objectStore(this._storeName).getAllKeys();
|
|
3137
|
+
o.onerror = (a) => {
|
|
3138
|
+
r(a);
|
|
3139
|
+
}, o.onsuccess = (a) => {
|
|
3140
|
+
n(o.result.filter((u) => typeof u == "string"));
|
|
3141
|
+
};
|
|
3142
|
+
});
|
|
3143
|
+
});
|
|
3144
|
+
}
|
|
3067
3145
|
}
|
|
3068
|
-
var
|
|
3146
|
+
var Ya = function(t, e, n, r) {
|
|
3069
3147
|
function i(s) {
|
|
3070
3148
|
return s instanceof n ? s : new n(function(o) {
|
|
3071
3149
|
o(s);
|
|
@@ -3092,122 +3170,79 @@ var ct = function(t, e, n, r) {
|
|
|
3092
3170
|
c((r = r.apply(t, e || [])).next());
|
|
3093
3171
|
});
|
|
3094
3172
|
};
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
path: r,
|
|
3100
|
-
authorization: `Bearer ${s}`,
|
|
3101
|
-
"content-type": o || i.type
|
|
3102
|
-
};
|
|
3103
|
-
return a && (u["content-disposition"] = a), yield ue(`${e}/storage/upload`, {
|
|
3104
|
-
method: "PUT",
|
|
3105
|
-
headers: u,
|
|
3106
|
-
body: i
|
|
3173
|
+
class Ki {
|
|
3174
|
+
static getIsOnline() {
|
|
3175
|
+
return Ya(this, void 0, void 0, function* () {
|
|
3176
|
+
return navigator.onLine;
|
|
3107
3177
|
});
|
|
3108
|
-
}
|
|
3178
|
+
}
|
|
3179
|
+
static listen(e) {
|
|
3180
|
+
const n = () => {
|
|
3181
|
+
e(!0);
|
|
3182
|
+
}, r = () => {
|
|
3183
|
+
e(!1);
|
|
3184
|
+
};
|
|
3185
|
+
return addEventListener("online", n), addEventListener("offline", r), () => {
|
|
3186
|
+
removeEventListener("online", n), removeEventListener("offline", r);
|
|
3187
|
+
};
|
|
3188
|
+
}
|
|
3109
3189
|
}
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
return s;
|
|
3120
|
-
});
|
|
3190
|
+
class qe extends Error {
|
|
3191
|
+
constructor(e, n) {
|
|
3192
|
+
super(e), this.hint = n;
|
|
3193
|
+
const r = new.target.prototype;
|
|
3194
|
+
Object.setPrototypeOf && Object.setPrototypeOf(this, r), Error.captureStackTrace && Error.captureStackTrace(this, qe), this.name = "InstantError";
|
|
3195
|
+
}
|
|
3196
|
+
get [Symbol.toStringTag]() {
|
|
3197
|
+
return "InstantError";
|
|
3198
|
+
}
|
|
3121
3199
|
}
|
|
3122
|
-
function
|
|
3123
|
-
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
headers: {
|
|
3127
|
-
"content-type": "application/json",
|
|
3128
|
-
authorization: `Bearer ${i}`
|
|
3129
|
-
},
|
|
3130
|
-
body: JSON.stringify({
|
|
3131
|
-
app_id: n,
|
|
3132
|
-
filename: r
|
|
3133
|
-
})
|
|
3200
|
+
var Ja = function(t, e, n, r) {
|
|
3201
|
+
function i(s) {
|
|
3202
|
+
return s instanceof n ? s : new n(function(o) {
|
|
3203
|
+
o(s);
|
|
3134
3204
|
});
|
|
3135
|
-
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
|
|
3139
|
-
|
|
3140
|
-
|
|
3141
|
-
|
|
3142
|
-
body: e,
|
|
3143
|
-
headers: {
|
|
3144
|
-
"Content-Type": e.type
|
|
3145
|
-
}
|
|
3146
|
-
})).ok;
|
|
3147
|
-
});
|
|
3148
|
-
}
|
|
3149
|
-
function ou(t) {
|
|
3150
|
-
return ct(this, arguments, void 0, function* ({ apiURI: e, appId: n, path: r, refreshToken: i }) {
|
|
3151
|
-
const { data: s } = yield ue(`${e}/storage/signed-download-url?app_id=${n}&filename=${encodeURIComponent(r)}`, {
|
|
3152
|
-
method: "GET",
|
|
3153
|
-
headers: {
|
|
3154
|
-
"content-type": "application/json",
|
|
3155
|
-
authorization: `Bearer ${i}`
|
|
3205
|
+
}
|
|
3206
|
+
return new (n || (n = Promise))(function(s, o) {
|
|
3207
|
+
function a(d) {
|
|
3208
|
+
try {
|
|
3209
|
+
c(r.next(d));
|
|
3210
|
+
} catch (f) {
|
|
3211
|
+
o(f);
|
|
3156
3212
|
}
|
|
3157
|
-
}
|
|
3158
|
-
|
|
3213
|
+
}
|
|
3214
|
+
function u(d) {
|
|
3215
|
+
try {
|
|
3216
|
+
c(r.throw(d));
|
|
3217
|
+
} catch (f) {
|
|
3218
|
+
o(f);
|
|
3219
|
+
}
|
|
3220
|
+
}
|
|
3221
|
+
function c(d) {
|
|
3222
|
+
d.done ? s(d.value) : i(d.value).then(a, u);
|
|
3223
|
+
}
|
|
3224
|
+
c((r = r.apply(t, e || [])).next());
|
|
3159
3225
|
});
|
|
3160
|
-
}
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
|
|
3164
|
-
|
|
3165
|
-
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
n[r] = t[r];
|
|
3169
|
-
}), n;
|
|
3170
|
-
}
|
|
3171
|
-
function au(t, e, n) {
|
|
3172
|
-
var r, i;
|
|
3173
|
-
const s = {
|
|
3174
|
-
peers: {}
|
|
3175
|
-
};
|
|
3176
|
-
if (e && "user" in e ? e.user : !0) {
|
|
3177
|
-
const a = $r((r = t.user) !== null && r !== void 0 ? r : {}, e == null ? void 0 : e.keys);
|
|
3178
|
-
s.user = Object.assign(Object.assign({}, a), { peerId: n });
|
|
3226
|
+
};
|
|
3227
|
+
class $t extends qe {
|
|
3228
|
+
constructor(e) {
|
|
3229
|
+
var n;
|
|
3230
|
+
const r = ((n = e.body) === null || n === void 0 ? void 0 : n.message) || `API Error (${e.status})`;
|
|
3231
|
+
super(r, e.body.hint);
|
|
3232
|
+
const i = new.target.prototype;
|
|
3233
|
+
Object.setPrototypeOf && Object.setPrototypeOf(this, i), Error.captureStackTrace && Error.captureStackTrace(this, $t), this.name = "InstantAPIError", this.status = e.status, this.body = e.body;
|
|
3179
3234
|
}
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
if (u || c) {
|
|
3183
|
-
const d = $r(t.peers[a], e == null ? void 0 : e.keys);
|
|
3184
|
-
s.peers[a] = Object.assign(Object.assign({}, d), { peerId: a });
|
|
3185
|
-
}
|
|
3235
|
+
get [Symbol.toStringTag]() {
|
|
3236
|
+
return "InstantAPIError";
|
|
3186
3237
|
}
|
|
3187
|
-
return s;
|
|
3188
3238
|
}
|
|
3189
|
-
function
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
return !0;
|
|
3195
|
-
return !1;
|
|
3196
|
-
}
|
|
3197
|
-
class Dr {
|
|
3198
|
-
constructor() {
|
|
3199
|
-
this.promise = new Promise((e, n) => {
|
|
3200
|
-
this._resolve = e, this._reject = n;
|
|
3201
|
-
});
|
|
3202
|
-
}
|
|
3203
|
-
resolve(e) {
|
|
3204
|
-
this._resolve(e);
|
|
3205
|
-
}
|
|
3206
|
-
reject(e) {
|
|
3207
|
-
this._reject(e);
|
|
3208
|
-
}
|
|
3239
|
+
function ue(t, e) {
|
|
3240
|
+
return Ja(this, void 0, void 0, function* () {
|
|
3241
|
+
const n = yield fetch(t, e), r = yield n.json();
|
|
3242
|
+
return n.status === 200 ? Promise.resolve(r) : Promise.reject(new $t({ status: n.status, body: r }));
|
|
3243
|
+
});
|
|
3209
3244
|
}
|
|
3210
|
-
var
|
|
3245
|
+
var Ve = function(t, e, n, r) {
|
|
3211
3246
|
function i(s) {
|
|
3212
3247
|
return s instanceof n ? s : new n(function(o) {
|
|
3213
3248
|
o(s);
|
|
@@ -3234,255 +3269,248 @@ var de = function(t, e, n, r) {
|
|
|
3234
3269
|
c((r = r.apply(t, e || [])).next());
|
|
3235
3270
|
});
|
|
3236
3271
|
};
|
|
3237
|
-
function
|
|
3238
|
-
|
|
3272
|
+
function Za({ apiURI: t, appId: e, email: n }) {
|
|
3273
|
+
return ue(`${t}/runtime/auth/send_magic_code`, {
|
|
3274
|
+
method: "POST",
|
|
3275
|
+
headers: { "content-type": "application/json" },
|
|
3276
|
+
body: JSON.stringify({ "app-id": e, email: n })
|
|
3277
|
+
});
|
|
3239
3278
|
}
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
}, this._persister = e, this._onMerge = n, this.serialize = r, this.parse = i, this._objectSize = s, this._log = o, this._saveThrottleMs = (u = a.saveThrottleMs) !== null && u !== void 0 ? u : 100, this._idleCallbackMaxWaitMs = (c = a.idleCallbackMaxWaitMs) !== null && c !== void 0 ? c : 1e3, this._gcOpts = a.gc, this.currentValue = {}, this._loadedKeys = /* @__PURE__ */ new Set(), this._loadingKeys = {}, this._initMeta(), a.preloadEntryCount && this._preloadEntries(a.preloadEntryCount);
|
|
3251
|
-
}
|
|
3252
|
-
_initMeta() {
|
|
3253
|
-
return de(this, void 0, void 0, function* () {
|
|
3254
|
-
var e, n, r;
|
|
3255
|
-
this._meta.loadingPromise && (yield this._meta.loadingPromise);
|
|
3256
|
-
try {
|
|
3257
|
-
const i = this._persister.getItem(Yt);
|
|
3258
|
-
this._meta.loadingPromise = i;
|
|
3259
|
-
const s = yield i;
|
|
3260
|
-
this._meta.isLoading = !1, this._meta.error = null, this._meta.loadingPromise = null, this._meta.attempts = 0;
|
|
3261
|
-
const o = (n = (e = this._meta.value) === null || e === void 0 ? void 0 : e.objects) !== null && n !== void 0 ? n : {}, a = s ?? {}, u = (r = a.objects) !== null && r !== void 0 ? r : {};
|
|
3262
|
-
this._meta.value = Object.assign(Object.assign({}, a), { objects: Object.assign(Object.assign({}, o), u) });
|
|
3263
|
-
} catch (i) {
|
|
3264
|
-
this._meta.error = i, this._meta.attempts++, this._meta.loadingPromise = null;
|
|
3265
|
-
}
|
|
3266
|
-
});
|
|
3267
|
-
}
|
|
3268
|
-
_getMeta() {
|
|
3269
|
-
return de(this, void 0, void 0, function* () {
|
|
3270
|
-
return this._meta.value ? this._meta.value : this._meta.loadingPromise ? (yield this._meta.loadingPromise, this._meta.value) : (this._initMeta(), yield this._meta.loadingPromise, this._meta.value);
|
|
3271
|
-
});
|
|
3272
|
-
}
|
|
3273
|
-
_refreshMeta() {
|
|
3274
|
-
return de(this, void 0, void 0, function* () {
|
|
3275
|
-
return yield this._initMeta(), this._meta.value;
|
|
3276
|
-
});
|
|
3277
|
-
}
|
|
3278
|
-
_preloadEntries(e) {
|
|
3279
|
-
return de(this, void 0, void 0, function* () {
|
|
3280
|
-
const n = yield this.waitForMetaToLoad(), r = Object.entries(n.objects);
|
|
3281
|
-
r.sort(([i, s], [o, a]) => a.updatedAt - s.updatedAt);
|
|
3282
|
-
for (const [i] of r.slice(0, e))
|
|
3283
|
-
this._loadKey(i);
|
|
3279
|
+
function Xa(t) {
|
|
3280
|
+
return Ve(this, arguments, void 0, function* ({ apiURI: e, appId: n, email: r, code: i, refreshToken: s }) {
|
|
3281
|
+
return yield ue(`${e}/runtime/auth/verify_magic_code`, {
|
|
3282
|
+
method: "POST",
|
|
3283
|
+
headers: { "content-type": "application/json" },
|
|
3284
|
+
body: JSON.stringify(Object.assign({
|
|
3285
|
+
"app-id": n,
|
|
3286
|
+
email: r,
|
|
3287
|
+
code: i
|
|
3288
|
+
}, s ? { "refresh-token": s } : {}))
|
|
3284
3289
|
});
|
|
3285
|
-
}
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
|
|
3289
|
-
|
|
3290
|
-
|
|
3291
|
-
|
|
3292
|
-
|
|
3293
|
-
|
|
3290
|
+
});
|
|
3291
|
+
}
|
|
3292
|
+
function eu(t) {
|
|
3293
|
+
return Ve(this, arguments, void 0, function* ({ apiURI: e, appId: n, refreshToken: r }) {
|
|
3294
|
+
return yield ue(`${e}/runtime/auth/verify_refresh_token`, {
|
|
3295
|
+
method: "POST",
|
|
3296
|
+
headers: { "content-type": "application/json" },
|
|
3297
|
+
body: JSON.stringify({
|
|
3298
|
+
"app-id": n,
|
|
3299
|
+
"refresh-token": r
|
|
3300
|
+
})
|
|
3294
3301
|
});
|
|
3295
|
-
}
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
|
|
3302
|
+
});
|
|
3303
|
+
}
|
|
3304
|
+
function tu(t) {
|
|
3305
|
+
return Ve(this, arguments, void 0, function* ({ apiURI: e, appId: n }) {
|
|
3306
|
+
return yield ue(`${e}/runtime/auth/sign_in_guest`, {
|
|
3307
|
+
method: "POST",
|
|
3308
|
+
headers: { "content-type": "application/json" },
|
|
3309
|
+
body: JSON.stringify({
|
|
3310
|
+
"app-id": n
|
|
3311
|
+
})
|
|
3299
3312
|
});
|
|
3300
|
-
}
|
|
3301
|
-
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
|
|
3313
|
+
});
|
|
3314
|
+
}
|
|
3315
|
+
function Dr(t) {
|
|
3316
|
+
return Ve(this, arguments, void 0, function* ({ apiURI: e, appId: n, code: r, codeVerifier: i, refreshToken: s }) {
|
|
3317
|
+
return yield ue(`${e}/runtime/oauth/token`, {
|
|
3318
|
+
method: "POST",
|
|
3319
|
+
headers: { "content-type": "application/json" },
|
|
3320
|
+
body: JSON.stringify({
|
|
3321
|
+
app_id: n,
|
|
3322
|
+
code: r,
|
|
3323
|
+
code_verifier: i,
|
|
3324
|
+
refresh_token: s
|
|
3325
|
+
})
|
|
3305
3326
|
});
|
|
3306
|
-
}
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
|
|
3311
|
-
|
|
3312
|
-
|
|
3313
|
-
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
|
|
3317
|
-
|
|
3318
|
-
|
|
3319
|
-
|
|
3320
|
-
const i = this._onMerge(e, r, this.currentValue[e]);
|
|
3321
|
-
i && (this.currentValue[e] = i);
|
|
3322
|
-
}
|
|
3323
|
-
this.onKeyLoaded && this.onKeyLoaded(e);
|
|
3327
|
+
});
|
|
3328
|
+
}
|
|
3329
|
+
function nu(t) {
|
|
3330
|
+
return Ve(this, arguments, void 0, function* ({ apiURI: e, appId: n, nonce: r, idToken: i, clientName: s, refreshToken: o }) {
|
|
3331
|
+
return yield ue(`${e}/runtime/oauth/id_token`, {
|
|
3332
|
+
method: "POST",
|
|
3333
|
+
headers: { "content-type": "application/json" },
|
|
3334
|
+
body: JSON.stringify({
|
|
3335
|
+
app_id: n,
|
|
3336
|
+
nonce: r,
|
|
3337
|
+
id_token: i,
|
|
3338
|
+
client_name: s,
|
|
3339
|
+
refresh_token: o
|
|
3340
|
+
})
|
|
3324
3341
|
});
|
|
3325
|
-
}
|
|
3326
|
-
|
|
3327
|
-
|
|
3328
|
-
|
|
3329
|
-
|
|
3330
|
-
|
|
3331
|
-
|
|
3332
|
-
|
|
3333
|
-
|
|
3334
|
-
|
|
3335
|
-
|
|
3336
|
-
|
|
3337
|
-
})
|
|
3338
|
-
|
|
3339
|
-
|
|
3340
|
-
|
|
3341
|
-
|
|
3342
|
-
|
|
3343
|
-
|
|
3344
|
-
|
|
3345
|
-
p in this.currentValue ? u.push(p) : (a.push(p), delete o.objects[p]);
|
|
3346
|
-
for (const p of a) {
|
|
3347
|
-
const y = this._persister.removeItem(p);
|
|
3348
|
-
i.push(y.then(() => 1)), this._loadedKeys.delete(p), this._pendingSaveKeys.delete(p);
|
|
3349
|
-
}
|
|
3350
|
-
const c = [], d = [[Yt, o]], f = (n = o.objects) !== null && n !== void 0 ? n : {};
|
|
3351
|
-
o.objects = f;
|
|
3352
|
-
for (const p of u)
|
|
3353
|
-
if (this._loadedKeys.has(p)) {
|
|
3354
|
-
const y = this.serialize(p, this.currentValue[p]);
|
|
3355
|
-
d.push([p, y]);
|
|
3356
|
-
const b = this._objectSize(y), g = (r = f[p]) !== null && r !== void 0 ? r : {
|
|
3357
|
-
createdAt: Date.now(),
|
|
3358
|
-
updatedAt: Date.now(),
|
|
3359
|
-
size: b
|
|
3360
|
-
};
|
|
3361
|
-
g.updatedAt = Date.now(), g.size = b, f[p] = g, this._pendingSaveKeys.delete(p);
|
|
3362
|
-
} else
|
|
3363
|
-
c.push(p);
|
|
3364
|
-
const l = this._persister.multiSet(d);
|
|
3365
|
-
i.push(l.then(() => 1));
|
|
3366
|
-
for (const p of c) {
|
|
3367
|
-
const y = this._loadKey(p).then(() => this._enqueuePersist(e));
|
|
3368
|
-
i.push(y);
|
|
3369
|
-
}
|
|
3370
|
-
return s || this.gc(), Promise.all(i).then((p) => p.reduce((y, b) => y + b, 0));
|
|
3371
|
-
}
|
|
3372
|
-
flush() {
|
|
3373
|
-
return de(this, void 0, void 0, function* () {
|
|
3374
|
-
return this._nextSave ? (clearTimeout(this._nextSave), this._nextSave = null, this._writeToStorage()) : void 0;
|
|
3342
|
+
});
|
|
3343
|
+
}
|
|
3344
|
+
function ru(t) {
|
|
3345
|
+
return Ve(this, arguments, void 0, function* ({ apiURI: e, appId: n, refreshToken: r }) {
|
|
3346
|
+
return yield ue(`${e}/runtime/signout`, {
|
|
3347
|
+
method: "POST",
|
|
3348
|
+
headers: {
|
|
3349
|
+
"content-type": "application/json"
|
|
3350
|
+
},
|
|
3351
|
+
body: JSON.stringify({
|
|
3352
|
+
app_id: n,
|
|
3353
|
+
refresh_token: r
|
|
3354
|
+
})
|
|
3355
|
+
});
|
|
3356
|
+
});
|
|
3357
|
+
}
|
|
3358
|
+
var ct = function(t, e, n, r) {
|
|
3359
|
+
function i(s) {
|
|
3360
|
+
return s instanceof n ? s : new n(function(o) {
|
|
3361
|
+
o(s);
|
|
3375
3362
|
});
|
|
3376
3363
|
}
|
|
3377
|
-
|
|
3378
|
-
|
|
3379
|
-
|
|
3380
|
-
|
|
3381
|
-
|
|
3382
|
-
|
|
3383
|
-
n.add(l);
|
|
3384
|
-
for (const l of this._loadedKeys)
|
|
3385
|
-
n.add(l);
|
|
3386
|
-
const r = yield this._refreshMeta();
|
|
3387
|
-
if (!r) {
|
|
3388
|
-
this._log.info("Could not gc because we were not able to load meta");
|
|
3389
|
-
return;
|
|
3364
|
+
return new (n || (n = Promise))(function(s, o) {
|
|
3365
|
+
function a(d) {
|
|
3366
|
+
try {
|
|
3367
|
+
c(r.next(d));
|
|
3368
|
+
} catch (f) {
|
|
3369
|
+
o(f);
|
|
3390
3370
|
}
|
|
3391
|
-
|
|
3392
|
-
|
|
3393
|
-
|
|
3394
|
-
|
|
3395
|
-
|
|
3396
|
-
|
|
3397
|
-
removedMissingCount: 0,
|
|
3398
|
-
removedOldCount: 0,
|
|
3399
|
-
removedThresholdCount: 0,
|
|
3400
|
-
removedSizeCount: 0
|
|
3401
|
-
};
|
|
3402
|
-
for (const l of e)
|
|
3403
|
-
n.has(l) || l in r.objects || (this._log.info("Lost track of key in meta", l), i.push(this._persister.removeItem(l)), s.removed.push(l), s.removedMissingCount++);
|
|
3404
|
-
const o = Date.now();
|
|
3405
|
-
for (const [l, p] of Object.entries(r.objects))
|
|
3406
|
-
!n.has(l) && p.updatedAt < o - this._gcOpts.maxAgeMs && (i.push(this._persister.removeItem(l)), delete r.objects[l], s.removed.push(l), s.removedOldCount++);
|
|
3407
|
-
const a = Object.entries(r.objects);
|
|
3408
|
-
a.sort(([l, p], [y, b]) => p.updatedAt - b.updatedAt);
|
|
3409
|
-
const u = a.filter(([l]) => !n.has(l));
|
|
3410
|
-
if (a.length > this._gcOpts.maxEntries)
|
|
3411
|
-
for (const [l] of u.slice(0, a.length - this._gcOpts.maxEntries))
|
|
3412
|
-
i.push(this._persister.removeItem(l)), delete r.objects[l], s.removed.push(l), s.removedThresholdCount++;
|
|
3413
|
-
const c = Object.entries(r.objects);
|
|
3414
|
-
c.sort(([l, p], [y, b]) => p.updatedAt - b.updatedAt);
|
|
3415
|
-
const d = c.filter(([l]) => !n.has(l));
|
|
3416
|
-
let f = c.reduce((l, [p, y]) => l + y.size, 0);
|
|
3417
|
-
for (; f > 0 && f > this._gcOpts.maxSize && d.length; ) {
|
|
3418
|
-
const [[l, p]] = d.splice(0, 1);
|
|
3419
|
-
f -= p.size, i.push(this._persister.removeItem(l)), delete r.objects[l], s.removed.push(l), s.removedSizeCount++;
|
|
3371
|
+
}
|
|
3372
|
+
function u(d) {
|
|
3373
|
+
try {
|
|
3374
|
+
c(r.throw(d));
|
|
3375
|
+
} catch (f) {
|
|
3376
|
+
o(f);
|
|
3420
3377
|
}
|
|
3421
|
-
|
|
3422
|
-
|
|
3423
|
-
|
|
3378
|
+
}
|
|
3379
|
+
function c(d) {
|
|
3380
|
+
d.done ? s(d.value) : i(d.value).then(a, u);
|
|
3381
|
+
}
|
|
3382
|
+
c((r = r.apply(t, e || [])).next());
|
|
3383
|
+
});
|
|
3384
|
+
};
|
|
3385
|
+
function iu(t) {
|
|
3386
|
+
return ct(this, arguments, void 0, function* ({ apiURI: e, appId: n, path: r, file: i, refreshToken: s, contentType: o, contentDisposition: a }) {
|
|
3387
|
+
const u = {
|
|
3388
|
+
app_id: n,
|
|
3389
|
+
path: r,
|
|
3390
|
+
authorization: `Bearer ${s}`,
|
|
3391
|
+
"content-type": o || i.type
|
|
3392
|
+
};
|
|
3393
|
+
return a && (u["content-disposition"] = a), yield ue(`${e}/storage/upload`, {
|
|
3394
|
+
method: "PUT",
|
|
3395
|
+
headers: u,
|
|
3396
|
+
body: i
|
|
3424
3397
|
});
|
|
3425
|
-
}
|
|
3426
|
-
|
|
3427
|
-
|
|
3428
|
-
|
|
3429
|
-
|
|
3430
|
-
|
|
3431
|
-
|
|
3432
|
-
|
|
3433
|
-
|
|
3434
|
-
|
|
3435
|
-
|
|
3436
|
-
|
|
3437
|
-
|
|
3398
|
+
});
|
|
3399
|
+
}
|
|
3400
|
+
function su(t) {
|
|
3401
|
+
return ct(this, arguments, void 0, function* ({ apiURI: e, appId: n, path: r, refreshToken: i }) {
|
|
3402
|
+
const { data: s } = yield ue(`${e}/storage/files?app_id=${n}&filename=${encodeURIComponent(r)}`, {
|
|
3403
|
+
method: "DELETE",
|
|
3404
|
+
headers: {
|
|
3405
|
+
"content-type": "application/json",
|
|
3406
|
+
authorization: `Bearer ${i}`
|
|
3407
|
+
}
|
|
3408
|
+
});
|
|
3409
|
+
return s;
|
|
3410
|
+
});
|
|
3411
|
+
}
|
|
3412
|
+
function ou(t) {
|
|
3413
|
+
return ct(this, arguments, void 0, function* ({ apiURI: e, appId: n, fileName: r, refreshToken: i, metadata: s = {} }) {
|
|
3414
|
+
const { data: o } = yield ue(`${e}/storage/signed-upload-url`, {
|
|
3415
|
+
method: "POST",
|
|
3416
|
+
headers: {
|
|
3417
|
+
"content-type": "application/json",
|
|
3418
|
+
authorization: `Bearer ${i}`
|
|
3419
|
+
},
|
|
3420
|
+
body: JSON.stringify({
|
|
3421
|
+
app_id: n,
|
|
3422
|
+
filename: r
|
|
3423
|
+
})
|
|
3424
|
+
});
|
|
3425
|
+
return o;
|
|
3426
|
+
});
|
|
3427
|
+
}
|
|
3428
|
+
function au(t, e) {
|
|
3429
|
+
return ct(this, void 0, void 0, function* () {
|
|
3430
|
+
return (yield fetch(t, {
|
|
3431
|
+
method: "PUT",
|
|
3432
|
+
body: e,
|
|
3433
|
+
headers: {
|
|
3434
|
+
"Content-Type": e.type
|
|
3435
|
+
}
|
|
3436
|
+
})).ok;
|
|
3437
|
+
});
|
|
3438
|
+
}
|
|
3439
|
+
function uu(t) {
|
|
3440
|
+
return ct(this, arguments, void 0, function* ({ apiURI: e, appId: n, path: r, refreshToken: i }) {
|
|
3441
|
+
const { data: s } = yield ue(`${e}/storage/signed-download-url?app_id=${n}&filename=${encodeURIComponent(r)}`, {
|
|
3442
|
+
method: "GET",
|
|
3443
|
+
headers: {
|
|
3444
|
+
"content-type": "application/json",
|
|
3445
|
+
authorization: `Bearer ${i}`
|
|
3438
3446
|
}
|
|
3439
|
-
this._nextSave = setTimeout(() => {
|
|
3440
|
-
Ur(() => {
|
|
3441
|
-
this._nextSave = null, this._writeToStorage(e).then(n).catch(r);
|
|
3442
|
-
}, this._idleCallbackMaxWaitMs);
|
|
3443
|
-
}, this._saveThrottleMs);
|
|
3444
3447
|
});
|
|
3448
|
+
return s;
|
|
3449
|
+
});
|
|
3450
|
+
}
|
|
3451
|
+
let Gn = !1, qi = !1, Wi = !1;
|
|
3452
|
+
typeof window < "u" && typeof window.localStorage < "u" && (Gn = !!window.localStorage.getItem("devBackend"), qi = !!window.localStorage.getItem("__instantLogging"), Wi = !!window.localStorage.getItem("__devtoolLocalDash"));
|
|
3453
|
+
function Ur(t, e) {
|
|
3454
|
+
if (!e)
|
|
3455
|
+
return t;
|
|
3456
|
+
const n = {};
|
|
3457
|
+
return e.forEach((r) => {
|
|
3458
|
+
n[r] = t[r];
|
|
3459
|
+
}), n;
|
|
3460
|
+
}
|
|
3461
|
+
function cu(t, e, n) {
|
|
3462
|
+
var r, i;
|
|
3463
|
+
const s = {
|
|
3464
|
+
peers: {}
|
|
3465
|
+
};
|
|
3466
|
+
if (e && "user" in e ? e.user : !0) {
|
|
3467
|
+
const a = Ur((r = t.user) !== null && r !== void 0 ? r : {}, e == null ? void 0 : e.keys);
|
|
3468
|
+
s.user = Object.assign(Object.assign({}, a), { peerId: n });
|
|
3445
3469
|
}
|
|
3446
|
-
|
|
3447
|
-
|
|
3470
|
+
for (const a of Object.keys((i = t.peers) !== null && i !== void 0 ? i : {})) {
|
|
3471
|
+
const u = (e == null ? void 0 : e.peers) === void 0, c = Array.isArray(e == null ? void 0 : e.peers) && (e == null ? void 0 : e.peers.includes(a));
|
|
3472
|
+
if (u || c) {
|
|
3473
|
+
const d = Ur(t.peers[a], e == null ? void 0 : e.keys);
|
|
3474
|
+
s.peers[a] = Object.assign(Object.assign({}, d), { peerId: a });
|
|
3475
|
+
}
|
|
3448
3476
|
}
|
|
3449
|
-
|
|
3450
|
-
|
|
3451
|
-
|
|
3452
|
-
|
|
3477
|
+
return s;
|
|
3478
|
+
}
|
|
3479
|
+
function du(t, e) {
|
|
3480
|
+
if (t.isLoading !== e.isLoading || t.error !== e.error || (t.user || e.user) && (!t.user || !e.user || !Sr(t.user, e.user)) || !_i(t.peers, e.peers))
|
|
3481
|
+
return !0;
|
|
3482
|
+
for (const r of Object.keys(t.peers))
|
|
3483
|
+
if (!Sr(t.peers[r], e.peers[r]))
|
|
3484
|
+
return !0;
|
|
3485
|
+
return !1;
|
|
3486
|
+
}
|
|
3487
|
+
class Lr {
|
|
3488
|
+
constructor() {
|
|
3489
|
+
this.promise = new Promise((e, n) => {
|
|
3490
|
+
this._resolve = e, this._reject = n;
|
|
3453
3491
|
});
|
|
3454
|
-
for (const i of r) {
|
|
3455
|
-
const s = i.path[0];
|
|
3456
|
-
s && typeof s == "string" && (this._pendingSaveKeys.add(s), this._loadedKeys.has(s) || this._loadKey(s));
|
|
3457
|
-
}
|
|
3458
|
-
for (const i of Object.keys(n))
|
|
3459
|
-
if (!n[i])
|
|
3460
|
-
debugger;
|
|
3461
|
-
this.currentValue = n, this._enqueuePersist();
|
|
3462
|
-
for (const i of this._subs)
|
|
3463
|
-
i(this.currentValue);
|
|
3464
|
-
return n;
|
|
3465
3492
|
}
|
|
3466
|
-
|
|
3467
|
-
|
|
3468
|
-
|
|
3469
|
-
|
|
3493
|
+
resolve(e) {
|
|
3494
|
+
this._resolve(e);
|
|
3495
|
+
}
|
|
3496
|
+
reject(e) {
|
|
3497
|
+
this._reject(e);
|
|
3470
3498
|
}
|
|
3471
3499
|
}
|
|
3472
|
-
function
|
|
3500
|
+
function zi(t, e = []) {
|
|
3473
3501
|
t.forEach((n) => {
|
|
3474
3502
|
const { data: r } = n, { "datalog-result": i } = r, { "join-rows": s } = i;
|
|
3475
3503
|
for (const o of s)
|
|
3476
3504
|
for (const a of o)
|
|
3477
3505
|
e.push(a);
|
|
3478
|
-
|
|
3506
|
+
zi(n["child-nodes"], e);
|
|
3479
3507
|
});
|
|
3480
3508
|
}
|
|
3481
|
-
function
|
|
3509
|
+
function Fr(t) {
|
|
3482
3510
|
const e = [];
|
|
3483
|
-
return
|
|
3511
|
+
return zi(t, e), e;
|
|
3484
3512
|
}
|
|
3485
|
-
function
|
|
3513
|
+
function Nr(t) {
|
|
3486
3514
|
return Object.values(t.links).reduce((e, n) => {
|
|
3487
3515
|
var r, i, s, o;
|
|
3488
3516
|
return (r = e[s = n.forward.on]) !== null && r !== void 0 || (e[s] = {}), e[n.forward.on][n.forward.label] = {
|
|
@@ -3496,8 +3524,8 @@ function Fr(t) {
|
|
|
3496
3524
|
}, e;
|
|
3497
3525
|
}, {});
|
|
3498
3526
|
}
|
|
3499
|
-
const Bn = "v0.22.56-experimental.persisted-object-2.
|
|
3500
|
-
function
|
|
3527
|
+
const Bn = "v0.22.56-experimental.persisted-object-2.19516969593.1";
|
|
3528
|
+
function fu(t, e) {
|
|
3501
3529
|
return {
|
|
3502
3530
|
info: t ? (...n) => console.info(...n, e()) : () => {
|
|
3503
3531
|
},
|
|
@@ -3570,7 +3598,7 @@ class R extends Error {
|
|
|
3570
3598
|
super(r), this.name = "QueryValidationError";
|
|
3571
3599
|
}
|
|
3572
3600
|
}
|
|
3573
|
-
const
|
|
3601
|
+
const Kr = [
|
|
3574
3602
|
"where",
|
|
3575
3603
|
"order",
|
|
3576
3604
|
"limit",
|
|
@@ -3581,7 +3609,7 @@ const Nr = [
|
|
|
3581
3609
|
"before",
|
|
3582
3610
|
"fields",
|
|
3583
3611
|
"aggregate"
|
|
3584
|
-
],
|
|
3612
|
+
], lu = (t) => t.valueType || "unknown", Vi = (t, e, n = !1) => {
|
|
3585
3613
|
if (n || t == null)
|
|
3586
3614
|
return !0;
|
|
3587
3615
|
switch (e) {
|
|
@@ -3596,9 +3624,9 @@ const Nr = [
|
|
|
3596
3624
|
default:
|
|
3597
3625
|
return !0;
|
|
3598
3626
|
}
|
|
3599
|
-
},
|
|
3627
|
+
}, hu = (t, e, n, r, i, s, o) => {
|
|
3600
3628
|
const a = s.valueType === "json", u = (c, d, f) => {
|
|
3601
|
-
if (!
|
|
3629
|
+
if (!Vi(f, d, a))
|
|
3602
3630
|
throw new R(`Invalid value for operator '${c}' on attribute '${r}' in entity '${i}'. Expected ${d}, but received: ${typeof f}`, o);
|
|
3603
3631
|
};
|
|
3604
3632
|
switch (t) {
|
|
@@ -3629,16 +3657,16 @@ const Nr = [
|
|
|
3629
3657
|
throw new R(`Unknown operator '${t}' for attribute '${r}' in entity '${i}'`, o);
|
|
3630
3658
|
}
|
|
3631
3659
|
}, Le = (t, e, n, r, i) => {
|
|
3632
|
-
const s =
|
|
3660
|
+
const s = lu(n), o = n.valueType === "json";
|
|
3633
3661
|
if (typeof t == "object" && t !== null && !Array.isArray(t)) {
|
|
3634
3662
|
if (o)
|
|
3635
3663
|
return;
|
|
3636
3664
|
const u = t;
|
|
3637
3665
|
for (const [c, d] of Object.entries(u))
|
|
3638
|
-
|
|
3639
|
-
} else if (!
|
|
3666
|
+
hu(c, d, s, e, r, n, `${i}.${c}`);
|
|
3667
|
+
} else if (!Vi(t, s, o))
|
|
3640
3668
|
throw new R(`Invalid value for attribute '${e}' in entity '${r}'. Expected ${s}, but received: ${typeof t}`, i);
|
|
3641
|
-
},
|
|
3669
|
+
}, pu = (t, e, n, r, i) => {
|
|
3642
3670
|
const s = t.split(".");
|
|
3643
3671
|
if (s.length < 2)
|
|
3644
3672
|
throw new R(`Invalid dot notation path '${t}'. Must contain at least one dot.`, i);
|
|
@@ -3675,12 +3703,12 @@ const Nr = [
|
|
|
3675
3703
|
throw new R(`Attribute '${a}' does not exist on entity '${o}' in dot notation path '${t}'. Available attributes: ${d.length > 0 ? d.join(", ") + ", id" : "id"}`, i);
|
|
3676
3704
|
}
|
|
3677
3705
|
Le(e, t, c, n, i);
|
|
3678
|
-
},
|
|
3706
|
+
}, Gi = (t, e, n, r) => {
|
|
3679
3707
|
for (const [i, s] of Object.entries(t)) {
|
|
3680
3708
|
if (i === "or" || i === "and") {
|
|
3681
3709
|
if (Array.isArray(s))
|
|
3682
3710
|
for (const c of s)
|
|
3683
|
-
typeof c == "object" && c !== null &&
|
|
3711
|
+
typeof c == "object" && c !== null && Gi(c, e, n, `${r}.${i}[${c}]`);
|
|
3684
3712
|
continue;
|
|
3685
3713
|
}
|
|
3686
3714
|
if (i === "id") {
|
|
@@ -3688,7 +3716,7 @@ const Nr = [
|
|
|
3688
3716
|
continue;
|
|
3689
3717
|
}
|
|
3690
3718
|
if (i.includes(".")) {
|
|
3691
|
-
|
|
3719
|
+
pu(i, s, e, n, `${r}.${i}`);
|
|
3692
3720
|
continue;
|
|
3693
3721
|
}
|
|
3694
3722
|
const o = n.entities[e];
|
|
@@ -3708,10 +3736,10 @@ const Nr = [
|
|
|
3708
3736
|
Le(s, i, c, e, `${r}.${i}`);
|
|
3709
3737
|
}
|
|
3710
3738
|
}
|
|
3711
|
-
},
|
|
3739
|
+
}, yu = (t, e, n, r, i = 0) => {
|
|
3712
3740
|
for (const o of Object.keys(t))
|
|
3713
|
-
if (!
|
|
3714
|
-
throw new R(`Invalid query parameter '${o}' in $ object. Valid parameters are: ${
|
|
3741
|
+
if (!Kr.includes(o))
|
|
3742
|
+
throw new R(`Invalid query parameter '${o}' in $ object. Valid parameters are: ${Kr.join(", ")}. Found: ${o}`, r);
|
|
3715
3743
|
const s = [
|
|
3716
3744
|
// 'limit', // only supported client side
|
|
3717
3745
|
"offset",
|
|
@@ -3726,9 +3754,9 @@ const Nr = [
|
|
|
3726
3754
|
if (t.where && n) {
|
|
3727
3755
|
if (typeof t.where != "object" || t.where === null)
|
|
3728
3756
|
throw new R(`'where' clause must be an object in entity '${e}', but received: ${typeof t.where}`, r ? `${r}.where` : void 0);
|
|
3729
|
-
|
|
3757
|
+
Gi(t.where, e, n, r ? `${r}.where` : "where");
|
|
3730
3758
|
}
|
|
3731
|
-
},
|
|
3759
|
+
}, Bi = (t, e, n, r, i = 0) => {
|
|
3732
3760
|
var s;
|
|
3733
3761
|
if (!t || typeof t != "object")
|
|
3734
3762
|
throw new R(`Query part for entity '${e}' must be an object, but received: ${typeof t}`, r);
|
|
@@ -3741,15 +3769,15 @@ const Nr = [
|
|
|
3741
3769
|
const a = t[o];
|
|
3742
3770
|
if (typeof a == "object" && a !== null) {
|
|
3743
3771
|
const u = (s = n == null ? void 0 : n.entities[e].links[o]) === null || s === void 0 ? void 0 : s.entityName;
|
|
3744
|
-
u &&
|
|
3772
|
+
u && Bi(a, u, n, `${r}.${o}`, i + 1);
|
|
3745
3773
|
}
|
|
3746
3774
|
} else {
|
|
3747
3775
|
const a = t[o];
|
|
3748
3776
|
if (typeof a != "object" || a === null)
|
|
3749
3777
|
throw new R(`Query parameter '$' must be an object in entity '${e}', but received: ${typeof a}`, `${r}.$`);
|
|
3750
|
-
|
|
3778
|
+
yu(a, e, n, `${r}.$`, i);
|
|
3751
3779
|
}
|
|
3752
|
-
},
|
|
3780
|
+
}, qr = (t, e) => {
|
|
3753
3781
|
if (typeof t != "object" || t === null)
|
|
3754
3782
|
throw new R(`Query must be an object, but received: ${typeof t}${t === null ? " (null)" : ""}`);
|
|
3755
3783
|
if (Array.isArray(t))
|
|
@@ -3765,67 +3793,67 @@ const Nr = [
|
|
|
3765
3793
|
const i = Object.keys(e.entities);
|
|
3766
3794
|
throw new R(`Entity '${r}' does not exist in schema. Available entities: ${i.length > 0 ? i.join(", ") : "none"}`, r);
|
|
3767
3795
|
}
|
|
3768
|
-
|
|
3796
|
+
Bi(n[r], r, e, r, 0);
|
|
3769
3797
|
}
|
|
3770
3798
|
}
|
|
3771
|
-
},
|
|
3799
|
+
}, Wr = (t) => typeof t != "string" ? !1 : It(t) ? !0 : Ne(t);
|
|
3772
3800
|
class ie extends Error {
|
|
3773
3801
|
constructor(e) {
|
|
3774
3802
|
super(e), this.name = "TransactionValidationError";
|
|
3775
3803
|
}
|
|
3776
3804
|
}
|
|
3777
|
-
const
|
|
3805
|
+
const Qi = (t) => t.length > 0 ? t.join(", ") : "none", bu = (t, e) => new ie(`Entity '${t}' does not exist in schema. Available entities: ${Qi(e)}`), zr = {
|
|
3778
3806
|
string: (t) => typeof t == "string",
|
|
3779
3807
|
number: (t) => typeof t == "number" && !isNaN(t),
|
|
3780
3808
|
boolean: (t) => typeof t == "boolean",
|
|
3781
3809
|
date: (t) => t instanceof Date || typeof t == "string" || typeof t == "number",
|
|
3782
3810
|
json: () => !0
|
|
3783
|
-
},
|
|
3811
|
+
}, _u = (t, e) => {
|
|
3784
3812
|
var n, r;
|
|
3785
|
-
return t == null ? !0 : (r = (n =
|
|
3786
|
-
},
|
|
3813
|
+
return t == null ? !0 : (r = (n = zr[e.valueType]) === null || n === void 0 ? void 0 : n.call(zr, t)) !== null && r !== void 0 ? r : !1;
|
|
3814
|
+
}, Hi = (t, e) => {
|
|
3787
3815
|
const n = e.entities[t];
|
|
3788
3816
|
if (!n)
|
|
3789
|
-
throw
|
|
3817
|
+
throw bu(t, Object.keys(e.entities));
|
|
3790
3818
|
return n;
|
|
3791
3819
|
}, Jt = (t, e, n) => {
|
|
3792
|
-
const r =
|
|
3820
|
+
const r = Hi(t, n);
|
|
3793
3821
|
if (typeof e != "object" || e === null)
|
|
3794
3822
|
throw new ie(`Arguments for data operation on entity '${t}' must be an object, but received: ${typeof e}`);
|
|
3795
3823
|
for (const [i, s] of Object.entries(e)) {
|
|
3796
3824
|
if (i === "id")
|
|
3797
3825
|
continue;
|
|
3798
3826
|
const o = r.attrs[i];
|
|
3799
|
-
if (o && !
|
|
3827
|
+
if (o && !_u(s, o))
|
|
3800
3828
|
throw new ie(`Invalid value for attribute '${i}' in entity '${t}'. Expected ${o.valueType}, but received: ${typeof s}`);
|
|
3801
3829
|
}
|
|
3802
|
-
},
|
|
3803
|
-
const r =
|
|
3830
|
+
}, Vr = (t, e, n) => {
|
|
3831
|
+
const r = Hi(t, n);
|
|
3804
3832
|
if (typeof e != "object" || e === null)
|
|
3805
3833
|
throw new ie(`Arguments for link operation on entity '${t}' must be an object, but received: ${typeof e}`);
|
|
3806
3834
|
for (const [i, s] of Object.entries(e)) {
|
|
3807
3835
|
if (!r.links[i]) {
|
|
3808
3836
|
const a = Object.keys(r.links);
|
|
3809
|
-
throw new ie(`Link '${i}' does not exist on entity '${t}'. Available links: ${
|
|
3837
|
+
throw new ie(`Link '${i}' does not exist on entity '${t}'. Available links: ${Qi(a)}`);
|
|
3810
3838
|
}
|
|
3811
3839
|
if (s != null) {
|
|
3812
3840
|
if (Array.isArray(s)) {
|
|
3813
3841
|
for (const a of s)
|
|
3814
|
-
if (!
|
|
3842
|
+
if (!Wr(a))
|
|
3815
3843
|
throw new ie(`Invalid entity ID in link '${i}' for entity '${t}'. Expected a UUID or a lookup, but received: ${a}`);
|
|
3816
|
-
} else if (!
|
|
3844
|
+
} else if (!Wr(s))
|
|
3817
3845
|
throw new ie(`Invalid UUID in link '${i}' for entity '${t}'. Expected a UUID, but received: ${s}`);
|
|
3818
3846
|
}
|
|
3819
3847
|
}
|
|
3820
|
-
},
|
|
3848
|
+
}, gu = {
|
|
3821
3849
|
create: Jt,
|
|
3822
3850
|
update: Jt,
|
|
3823
3851
|
merge: Jt,
|
|
3824
|
-
link:
|
|
3825
|
-
unlink:
|
|
3852
|
+
link: Vr,
|
|
3853
|
+
unlink: Vr,
|
|
3826
3854
|
delete: () => {
|
|
3827
3855
|
}
|
|
3828
|
-
},
|
|
3856
|
+
}, Tu = (t, e) => {
|
|
3829
3857
|
if (!e)
|
|
3830
3858
|
return;
|
|
3831
3859
|
const [n, r, i, s] = t;
|
|
@@ -3833,9 +3861,9 @@ const Bi = (t) => t.length > 0 ? t.join(", ") : "none", pu = (t, e) => new ie(`E
|
|
|
3833
3861
|
throw new ie(`Invalid id for entity '${r}'. Expected a UUID, but received: ${i}`);
|
|
3834
3862
|
if (typeof r != "string")
|
|
3835
3863
|
throw new ie(`Entity name must be a string, but received: ${typeof r}`);
|
|
3836
|
-
const o =
|
|
3864
|
+
const o = gu[n];
|
|
3837
3865
|
o && s !== void 0 && o(r, s, e);
|
|
3838
|
-
},
|
|
3866
|
+
}, wu = (t, e) => {
|
|
3839
3867
|
const n = Array.isArray(t) ? t : [t];
|
|
3840
3868
|
for (const r of n) {
|
|
3841
3869
|
if (!r || typeof r != "object")
|
|
@@ -3845,11 +3873,11 @@ const Bi = (t) => t.length > 0 ? t.join(", ") : "none", pu = (t, e) => new ie(`E
|
|
|
3845
3873
|
for (const i of r.__ops) {
|
|
3846
3874
|
if (!Array.isArray(i))
|
|
3847
3875
|
throw new ie(`Transaction operation must be an array, but received: ${typeof i}`);
|
|
3848
|
-
|
|
3876
|
+
Tu(i, e);
|
|
3849
3877
|
}
|
|
3850
3878
|
}
|
|
3851
3879
|
};
|
|
3852
|
-
var
|
|
3880
|
+
var Gr = function(t, e, n, r) {
|
|
3853
3881
|
function i(s) {
|
|
3854
3882
|
return s instanceof n ? s : new n(function(o) {
|
|
3855
3883
|
o(s);
|
|
@@ -3876,10 +3904,10 @@ var Vr = function(t, e, n, r) {
|
|
|
3876
3904
|
c((r = r.apply(t, e || [])).next());
|
|
3877
3905
|
});
|
|
3878
3906
|
};
|
|
3879
|
-
let
|
|
3880
|
-
class
|
|
3907
|
+
let Yi = 0;
|
|
3908
|
+
class Br {
|
|
3881
3909
|
constructor(e) {
|
|
3882
|
-
this.type = "ws", this.id = `${this.type}_${
|
|
3910
|
+
this.type = "ws", this.id = `${this.type}_${Yi++}`, this.conn = new WebSocket(e), this.conn.onopen = (n) => {
|
|
3883
3911
|
this.onopen && this.onopen({ target: this });
|
|
3884
3912
|
}, this.conn.onmessage = (n) => {
|
|
3885
3913
|
this.onmessage && this.onmessage({
|
|
@@ -3905,9 +3933,9 @@ class Gr {
|
|
|
3905
3933
|
return this.conn.send(JSON.stringify(e));
|
|
3906
3934
|
}
|
|
3907
3935
|
}
|
|
3908
|
-
class
|
|
3936
|
+
class mu {
|
|
3909
3937
|
constructor(e, n) {
|
|
3910
|
-
this.type = "sse", this.initParams = null, this.sendQueue = [], this.closeFired = !1, this.sseInitTimeout = null, this.id = `${this.type}_${
|
|
3938
|
+
this.type = "sse", this.initParams = null, this.sendQueue = [], this.closeFired = !1, this.sseInitTimeout = null, this.id = `${this.type}_${Yi++}`, this.url = n, this.ES = e, this.conn = new e(n), this.sseInitTimeout = setTimeout(() => {
|
|
3911
3939
|
this.initParams || this.handleError();
|
|
3912
3940
|
}, 1e4), this.conn.onmessage = (r) => {
|
|
3913
3941
|
const i = JSON.parse(r.data);
|
|
@@ -3939,7 +3967,7 @@ class Tu {
|
|
|
3939
3967
|
this.conn.close(), this.onclose && !this.closeFired && (this.closeFired = !0, this.onclose({ target: this }));
|
|
3940
3968
|
}
|
|
3941
3969
|
postMessages(e) {
|
|
3942
|
-
return
|
|
3970
|
+
return Gr(this, void 0, void 0, function* () {
|
|
3943
3971
|
try {
|
|
3944
3972
|
(yield fetch(this.url, {
|
|
3945
3973
|
method: "POST",
|
|
@@ -3957,7 +3985,7 @@ class Tu {
|
|
|
3957
3985
|
});
|
|
3958
3986
|
}
|
|
3959
3987
|
flushQueue() {
|
|
3960
|
-
return
|
|
3988
|
+
return Gr(this, void 0, void 0, function* () {
|
|
3961
3989
|
if (this.sendPromise || !this.sendQueue.length)
|
|
3962
3990
|
return;
|
|
3963
3991
|
const e = this.sendQueue;
|
|
@@ -3983,7 +4011,7 @@ class Tu {
|
|
|
3983
4011
|
this.handleClose();
|
|
3984
4012
|
}
|
|
3985
4013
|
}
|
|
3986
|
-
var
|
|
4014
|
+
var Qr = function(t, e, n, r) {
|
|
3987
4015
|
function i(s) {
|
|
3988
4016
|
return s instanceof n ? s : new n(function(o) {
|
|
3989
4017
|
o(s);
|
|
@@ -4010,33 +4038,33 @@ var Br = function(t, e, n, r) {
|
|
|
4010
4038
|
c((r = r.apply(t, e || [])).next());
|
|
4011
4039
|
});
|
|
4012
4040
|
};
|
|
4013
|
-
function
|
|
4041
|
+
function vu(t, e) {
|
|
4014
4042
|
const n = t.values;
|
|
4015
4043
|
if (n)
|
|
4016
4044
|
for (const r of n.entities || [])
|
|
4017
|
-
r.store.useDateObjects = e, r.store.attrs = n.attrs, r.store =
|
|
4045
|
+
r.store.useDateObjects = e, r.store.attrs = n.attrs, r.store = Si(r.store);
|
|
4018
4046
|
return t;
|
|
4019
4047
|
}
|
|
4020
|
-
function
|
|
4048
|
+
function Su(t, e) {
|
|
4021
4049
|
var n, r;
|
|
4022
4050
|
if (!((n = e.values) === null || n === void 0) && n.entities) {
|
|
4023
4051
|
const i = [];
|
|
4024
4052
|
for (const s of (r = e.values) === null || r === void 0 ? void 0 : r.entities) {
|
|
4025
|
-
const o =
|
|
4053
|
+
const o = vi(s.store);
|
|
4026
4054
|
delete o.attrs, i.push(Object.assign(Object.assign({}, s), { store: o }));
|
|
4027
4055
|
}
|
|
4028
4056
|
return Object.assign(Object.assign({}, e), { values: Object.assign(Object.assign({}, e.values), { entities: i }) });
|
|
4029
4057
|
} else
|
|
4030
4058
|
return e;
|
|
4031
4059
|
}
|
|
4032
|
-
function
|
|
4060
|
+
function Ou(t, e, n) {
|
|
4033
4061
|
const r = e == null ? void 0 : e.state.txId, i = n == null ? void 0 : n.state.txId;
|
|
4034
4062
|
return r && (!i || r > i) ? e : i && (!r || i > r) ? n : e || n;
|
|
4035
4063
|
}
|
|
4036
4064
|
function Zt(t, e) {
|
|
4037
|
-
return
|
|
4065
|
+
return Di({ store: e, pageInfo: null, aggregate: null }, t.query).data[t.table][0];
|
|
4038
4066
|
}
|
|
4039
|
-
function
|
|
4067
|
+
function Hr(t, e, n) {
|
|
4040
4068
|
var r;
|
|
4041
4069
|
const i = (r = Te(e, t.table, "id")) === null || r === void 0 ? void 0 : r.id;
|
|
4042
4070
|
if (!i)
|
|
@@ -4044,18 +4072,18 @@ function Qr(t, e, n) {
|
|
|
4044
4072
|
const s = ze(e.eav, [n, i, n]);
|
|
4045
4073
|
return s ? s[3] : -1;
|
|
4046
4074
|
}
|
|
4047
|
-
function
|
|
4075
|
+
function Yr(t, e) {
|
|
4048
4076
|
for (const { action: n, triple: r } of e)
|
|
4049
4077
|
switch (n) {
|
|
4050
4078
|
case "added":
|
|
4051
|
-
|
|
4079
|
+
Ai(t, r);
|
|
4052
4080
|
break;
|
|
4053
4081
|
case "removed":
|
|
4054
|
-
|
|
4082
|
+
Oi(t, r);
|
|
4055
4083
|
break;
|
|
4056
4084
|
}
|
|
4057
4085
|
}
|
|
4058
|
-
function
|
|
4086
|
+
function Eu(t, e) {
|
|
4059
4087
|
var n, r, i, s;
|
|
4060
4088
|
const o = {};
|
|
4061
4089
|
for (const { action: a, triple: u } of e) {
|
|
@@ -4079,7 +4107,7 @@ function Su(t, e) {
|
|
|
4079
4107
|
function gt(t, e) {
|
|
4080
4108
|
return { [t.table]: e.map((n) => n.entity) };
|
|
4081
4109
|
}
|
|
4082
|
-
function
|
|
4110
|
+
function Au(t, e) {
|
|
4083
4111
|
const n = t.orderFieldType;
|
|
4084
4112
|
if (t.orderField === "serverCreatedAt") {
|
|
4085
4113
|
e.sort(t.orderDirection === "asc" ? function(s, o) {
|
|
@@ -4100,9 +4128,9 @@ var Se;
|
|
|
4100
4128
|
(function(t) {
|
|
4101
4129
|
t.InitialSyncBatch = "InitialSyncBatch", t.InitialSyncComplete = "InitialSyncComplete", t.LoadFromStorage = "LoadFromStorage", t.SyncTransaction = "SyncTransaction", t.Error = "Error";
|
|
4102
4130
|
})(Se || (Se = {}));
|
|
4103
|
-
class
|
|
4131
|
+
class ku {
|
|
4104
4132
|
constructor(e, n, r, i, s) {
|
|
4105
|
-
this.callbacks = {}, this.idToHash = {}, this.trySend = e, this.config = r, this.log = i, this.createStore = s, this.subs = new wn(n,
|
|
4133
|
+
this.callbacks = {}, this.idToHash = {}, this.trySend = e, this.config = r, this.log = i, this.createStore = s, this.subs = new wn(n, Ou, Su, (o, a) => vu(a, this.config.useDateObjects), (o) => {
|
|
4106
4134
|
var a;
|
|
4107
4135
|
return ((a = o.values) === null || a === void 0 ? void 0 : a.entities.length) || 0;
|
|
4108
4136
|
}, i, {
|
|
@@ -4157,7 +4185,7 @@ class Eu {
|
|
|
4157
4185
|
});
|
|
4158
4186
|
}
|
|
4159
4187
|
initSubscription(e, n, r) {
|
|
4160
|
-
return
|
|
4188
|
+
return Qr(this, void 0, void 0, function* () {
|
|
4161
4189
|
var i, s, o, a, u;
|
|
4162
4190
|
yield this.subs.waitForKeyToLoad(n);
|
|
4163
4191
|
const c = this.subs.currentValue[n];
|
|
@@ -4184,7 +4212,7 @@ class Eu {
|
|
|
4184
4212
|
});
|
|
4185
4213
|
}
|
|
4186
4214
|
flushPending() {
|
|
4187
|
-
return
|
|
4215
|
+
return Qr(this, void 0, void 0, function* () {
|
|
4188
4216
|
for (const e of Object.keys(this.callbacks)) {
|
|
4189
4217
|
yield this.subs.waitForKeyToLoad(e);
|
|
4190
4218
|
const n = this.subs.currentValue[e];
|
|
@@ -4233,7 +4261,7 @@ class Eu {
|
|
|
4233
4261
|
c.push({
|
|
4234
4262
|
store: f,
|
|
4235
4263
|
entity: l,
|
|
4236
|
-
serverCreatedAt:
|
|
4264
|
+
serverCreatedAt: Hr(a, f, l.id)
|
|
4237
4265
|
}), o.push(l);
|
|
4238
4266
|
}
|
|
4239
4267
|
this.subs.updateInPlace((d) => {
|
|
@@ -4302,9 +4330,9 @@ class Eu {
|
|
|
4302
4330
|
const y = [];
|
|
4303
4331
|
e: for (const [w, T] of Object.entries(f))
|
|
4304
4332
|
for (const [m, E] of Object.entries(p))
|
|
4305
|
-
if (
|
|
4306
|
-
|
|
4307
|
-
const S = Zt(a, E.store), I =
|
|
4333
|
+
if (so(E.store, w)) {
|
|
4334
|
+
Yr(E.store, T);
|
|
4335
|
+
const S = Zt(a, E.store), I = Eu(E.store, T)[w];
|
|
4308
4336
|
for (const [x, { oldValue: q, newValue: we }] of Object.entries(I || {}))
|
|
4309
4337
|
q === we && delete I[x];
|
|
4310
4338
|
S ? (y.push({
|
|
@@ -4317,7 +4345,7 @@ class Eu {
|
|
|
4317
4345
|
const b = [];
|
|
4318
4346
|
for (const [w, T] of Object.entries(f)) {
|
|
4319
4347
|
const m = this.createStore([]);
|
|
4320
|
-
l.attrs = m.attrs,
|
|
4348
|
+
l.attrs = m.attrs, Yr(m, T);
|
|
4321
4349
|
const E = Zt(a, m);
|
|
4322
4350
|
if (!E) {
|
|
4323
4351
|
this.log.error("No entity found after applying change", {
|
|
@@ -4330,13 +4358,13 @@ class Eu {
|
|
|
4330
4358
|
p.push({
|
|
4331
4359
|
store: m,
|
|
4332
4360
|
entity: E,
|
|
4333
|
-
serverCreatedAt:
|
|
4361
|
+
serverCreatedAt: Hr(a, m, E.id)
|
|
4334
4362
|
}), b.push(E);
|
|
4335
4363
|
}
|
|
4336
4364
|
const g = [];
|
|
4337
4365
|
for (const w of d.sort().reverse())
|
|
4338
4366
|
g.push(p[w].entity), p.splice(w, 1);
|
|
4339
|
-
|
|
4367
|
+
Au(a, p), this.notifyCbs(o, {
|
|
4340
4368
|
type: Se.SyncTransaction,
|
|
4341
4369
|
data: gt(a, (i = a.values) === null || i === void 0 ? void 0 : i.entities),
|
|
4342
4370
|
added: b,
|
|
@@ -4403,7 +4431,7 @@ var F = function(t, e, n, r) {
|
|
|
4403
4431
|
}
|
|
4404
4432
|
c((r = r.apply(t, e || [])).next());
|
|
4405
4433
|
});
|
|
4406
|
-
},
|
|
4434
|
+
}, ju = function(t, e) {
|
|
4407
4435
|
var n = {};
|
|
4408
4436
|
for (var r in t) Object.prototype.hasOwnProperty.call(t, r) && e.indexOf(r) < 0 && (n[r] = t[r]);
|
|
4409
4437
|
if (t != null && typeof Object.getOwnPropertySymbols == "function")
|
|
@@ -4417,46 +4445,46 @@ const le = {
|
|
|
4417
4445
|
AUTHENTICATED: "authenticated",
|
|
4418
4446
|
CLOSED: "closed",
|
|
4419
4447
|
ERRORED: "errored"
|
|
4420
|
-
},
|
|
4448
|
+
}, Cu = 3e4, Pu = 3e4, Iu = 200, Mu = {
|
|
4421
4449
|
apiURI: "https://api.instantdb.com",
|
|
4422
4450
|
websocketURI: "wss://api.instantdb.com/runtime/session"
|
|
4423
4451
|
}, Xt = "_instant_oauth_redirect", Qe = "currentUser";
|
|
4424
|
-
function
|
|
4452
|
+
function Ru({ transportType: t, appId: e, apiURI: n, wsURI: r, EventSourceImpl: i }) {
|
|
4425
4453
|
if (!i)
|
|
4426
|
-
return new
|
|
4454
|
+
return new Br(`${r}?app_id=${e}`);
|
|
4427
4455
|
switch (t) {
|
|
4428
4456
|
case "ws":
|
|
4429
|
-
return new
|
|
4457
|
+
return new Br(`${r}?app_id=${e}`);
|
|
4430
4458
|
case "sse":
|
|
4431
|
-
return new
|
|
4459
|
+
return new mu(i, `${n}/runtime/sse?app_id=${e}`);
|
|
4432
4460
|
default:
|
|
4433
4461
|
throw new Error("Unknown transport type " + t);
|
|
4434
4462
|
}
|
|
4435
4463
|
}
|
|
4436
|
-
function
|
|
4464
|
+
function xu() {
|
|
4437
4465
|
return typeof window < "u" || typeof chrome < "u";
|
|
4438
4466
|
}
|
|
4439
|
-
const
|
|
4467
|
+
const Jr = {
|
|
4440
4468
|
"set-presence": !0,
|
|
4441
4469
|
"set-presence-ok": !0,
|
|
4442
4470
|
"refresh-presence": !0,
|
|
4443
4471
|
"patch-presence": !0
|
|
4444
4472
|
};
|
|
4445
|
-
function
|
|
4473
|
+
function $u(t, e) {
|
|
4446
4474
|
var n;
|
|
4447
4475
|
const r = typeof t == "string" ? JSON.parse(t) : t;
|
|
4448
4476
|
if (!((n = r == null ? void 0 : r.result) === null || n === void 0) && n.store) {
|
|
4449
4477
|
const i = r.result.store;
|
|
4450
|
-
r.result.store =
|
|
4478
|
+
r.result.store = Si(Object.assign(Object.assign({}, i), { useDateObjects: e }));
|
|
4451
4479
|
}
|
|
4452
4480
|
return r;
|
|
4453
4481
|
}
|
|
4454
|
-
function
|
|
4482
|
+
function Du(t, e) {
|
|
4455
4483
|
var n;
|
|
4456
4484
|
const r = Object.assign({}, e);
|
|
4457
|
-
return !((n = e.result) === null || n === void 0) && n.store && (r.result = Object.assign(Object.assign({}, e.result), { store:
|
|
4485
|
+
return !((n = e.result) === null || n === void 0) && n.store && (r.result = Object.assign(Object.assign({}, e.result), { store: vi(e.result.store) })), r;
|
|
4458
4486
|
}
|
|
4459
|
-
function
|
|
4487
|
+
function Uu(t, e) {
|
|
4460
4488
|
switch (t) {
|
|
4461
4489
|
case "pendingMutations":
|
|
4462
4490
|
return new Map(typeof e == "string" ? JSON.parse(e) : e);
|
|
@@ -4464,7 +4492,7 @@ function $u(t, e) {
|
|
|
4464
4492
|
return e;
|
|
4465
4493
|
}
|
|
4466
4494
|
}
|
|
4467
|
-
function
|
|
4495
|
+
function Lu(t, e) {
|
|
4468
4496
|
switch (t) {
|
|
4469
4497
|
case "pendingMutations":
|
|
4470
4498
|
return [...e.entries()];
|
|
@@ -4472,18 +4500,18 @@ function Du(t, e) {
|
|
|
4472
4500
|
return e;
|
|
4473
4501
|
}
|
|
4474
4502
|
}
|
|
4475
|
-
function
|
|
4503
|
+
function Fu(t, e, n) {
|
|
4476
4504
|
const r = e == null ? void 0 : e.result, i = n == null ? void 0 : n.result;
|
|
4477
4505
|
return r && !i && n && (n.result = r), n || e;
|
|
4478
4506
|
}
|
|
4479
|
-
function
|
|
4507
|
+
function Zr(t) {
|
|
4480
4508
|
return [...t].sort((e, n) => {
|
|
4481
4509
|
const [r, i] = e, [s, o] = n, a = i.order || 0, u = o.order || 0;
|
|
4482
4510
|
return a == u ? r < s ? -1 : r > s ? 1 : 0 : a - u;
|
|
4483
4511
|
});
|
|
4484
4512
|
}
|
|
4485
|
-
class
|
|
4486
|
-
constructor(e, n =
|
|
4513
|
+
class Nu {
|
|
4514
|
+
constructor(e, n = Ni, r = Ki, i, s) {
|
|
4487
4515
|
var o, a, u;
|
|
4488
4516
|
if (this._isOnline = !0, this._isShutdown = !1, this.status = le.CONNECTING, this.queryCbs = {}, this.queryOnceDfds = {}, this.authCbs = [], this.attrsCbs = [], this.mutationErrorCbs = [], this.connectionStatusCbs = [], this.mutationDeferredStore = /* @__PURE__ */ new Map(), this._reconnectTimeoutId = null, this._reconnectTimeoutMs = 0, this._transportType = "ws", this._wsOk = null, this._localIdPromises = {}, this._errorMessage = null, this._oauthCallbackResponse = null, this._linkIndex = null, this._rooms = {}, this._roomsPendingLeave = {}, this._presence = {}, this._broadcastQueue = [], this._broadcastSubs = {}, this._currentUserCached = { isLoading: !0, error: void 0, user: void 0 }, this._beforeUnloadCbs = [], this._dataForQueryCache = {}, this._inFlightMutationEventIds = /* @__PURE__ */ new Set(), this._onMergeKv = (c, d, f) => {
|
|
4489
4517
|
var l, p;
|
|
@@ -4514,9 +4542,9 @@ class Lu {
|
|
|
4514
4542
|
}, this.notifyQueryError = (c, d) => {
|
|
4515
4543
|
(this.queryCbs[c] || []).forEach((l) => l.cb({ error: d }));
|
|
4516
4544
|
}, this.pushTx = (c) => {
|
|
4517
|
-
this.config.disableValidation ||
|
|
4545
|
+
this.config.disableValidation || wu(c, this.config.schema);
|
|
4518
4546
|
try {
|
|
4519
|
-
const d =
|
|
4547
|
+
const d = Ka({
|
|
4520
4548
|
attrs: this.optimisticAttrs(),
|
|
4521
4549
|
schema: this.config.schema,
|
|
4522
4550
|
stores: Object.values(this.querySubs.currentValue).map((f) => {
|
|
@@ -4540,7 +4568,7 @@ class Lu {
|
|
|
4540
4568
|
this._updatePendingMutations((g) => {
|
|
4541
4569
|
g.set(f, y);
|
|
4542
4570
|
});
|
|
4543
|
-
const b = new
|
|
4571
|
+
const b = new Lr();
|
|
4544
4572
|
return this.mutationDeferredStore.set(f, b), this._sendMutation(f, y), this.notifyAll(), b.promise;
|
|
4545
4573
|
}, this._transportOnOpen = (c) => {
|
|
4546
4574
|
const d = c.target;
|
|
@@ -4601,7 +4629,7 @@ class Lu {
|
|
|
4601
4629
|
return;
|
|
4602
4630
|
}
|
|
4603
4631
|
this._log.info("[socket][close]", d.id, "schedule reconnect, ms =", this._reconnectTimeoutMs), this._scheduleReconnect();
|
|
4604
|
-
}, this._EventSource = s, this.config = Object.assign(Object.assign({},
|
|
4632
|
+
}, this._EventSource = s, this.config = Object.assign(Object.assign({}, Mu), e), this.queryCacheLimit = (o = this.config.queryCacheLimit) !== null && o !== void 0 ? o : 10, this._pendingTxCleanupTimeout = (a = this.config.pendingTxCleanupTimeout) !== null && a !== void 0 ? a : Pu, this._pendingMutationCleanupThreshold = (u = this.config.pendingMutationCleanupThreshold) !== null && u !== void 0 ? u : Iu, this._log = fu(e.verbose || Gn || qi, () => this._reactorStats()), this.versions = Object.assign(Object.assign({}, i || {}), { "@instantdb/core": Bn }), this.config.schema && (this._linkIndex = Nr(this.config.schema)), !!xu()) {
|
|
4605
4633
|
if (!e.appId)
|
|
4606
4634
|
throw new Error("Instant must be initialized with an appId.");
|
|
4607
4635
|
if (!Ne(e.appId))
|
|
@@ -4616,7 +4644,7 @@ class Lu {
|
|
|
4616
4644
|
} catch (f) {
|
|
4617
4645
|
this._log.error("[error] handle broadcast channel", f);
|
|
4618
4646
|
}
|
|
4619
|
-
}))), this._initStorage(n), this._syncTable = new
|
|
4647
|
+
}))), this._initStorage(n), this._syncTable = new ku(this._trySendAuthed.bind(this), new n(this.config.appId, "syncSubs"), {
|
|
4620
4648
|
useDateObjects: this.config.useDateObjects
|
|
4621
4649
|
}, this._log, (c) => St(this.attrs, c, this.config.enableCardinalityInference, this._linkIndex, this.config.useDateObjects)), this._oauthCallbackResponse = this._oauthLoginInit(), this.getCurrentUser(), r.getIsOnline().then((c) => {
|
|
4622
4650
|
this._isOnline = c, this._startSocket(), r.listen((d) => {
|
|
@@ -4626,7 +4654,7 @@ class Lu {
|
|
|
4626
4654
|
}
|
|
4627
4655
|
}
|
|
4628
4656
|
updateSchema(e) {
|
|
4629
|
-
this.config = Object.assign(Object.assign({}, this.config), { schema: e, cardinalityInference: !!e }), this._linkIndex = e ?
|
|
4657
|
+
this.config = Object.assign(Object.assign({}, this.config), { schema: e, cardinalityInference: !!e }), this._linkIndex = e ? Nr(this.config.schema) : null;
|
|
4630
4658
|
}
|
|
4631
4659
|
_reactorStats() {
|
|
4632
4660
|
return {
|
|
@@ -4641,9 +4669,9 @@ class Lu {
|
|
|
4641
4669
|
_initStorage(e) {
|
|
4642
4670
|
this.querySubs = new wn(
|
|
4643
4671
|
new e(this.config.appId, "querySubs"),
|
|
4644
|
-
|
|
4645
|
-
|
|
4646
|
-
(n, r) =>
|
|
4672
|
+
Fu,
|
|
4673
|
+
Du,
|
|
4674
|
+
(n, r) => $u(r, this.config.useDateObjects),
|
|
4647
4675
|
// objectSize
|
|
4648
4676
|
(n) => {
|
|
4649
4677
|
var r, i, s, o;
|
|
@@ -4661,7 +4689,7 @@ class Lu {
|
|
|
4661
4689
|
// 1 million triples
|
|
4662
4690
|
}
|
|
4663
4691
|
}
|
|
4664
|
-
), this.querySubs.onKeyLoaded = (n) => this._onQuerySubLoaded(n), this.kv = new wn(new e(this.config.appId, "kv"), this._onMergeKv,
|
|
4692
|
+
), this.querySubs.onKeyLoaded = (n) => this._onQuerySubLoaded(n), this.kv = new wn(new e(this.config.appId, "kv"), this._onMergeKv, Lu, Uu, () => 0, this._log, {
|
|
4665
4693
|
saveThrottleMs: 100,
|
|
4666
4694
|
idleCallbackMaxWaitMs: 100,
|
|
4667
4695
|
gc: {
|
|
@@ -4693,7 +4721,7 @@ class Lu {
|
|
|
4693
4721
|
if (s)
|
|
4694
4722
|
i.resolve({ status: e, eventId: n });
|
|
4695
4723
|
else if (r.type) {
|
|
4696
|
-
const { status: o } = r, a =
|
|
4724
|
+
const { status: o } = r, a = ju(r, ["status"]);
|
|
4697
4725
|
i.reject(new $t({
|
|
4698
4726
|
// @ts-expect-error body.type is not constant typed
|
|
4699
4727
|
body: a,
|
|
@@ -4717,7 +4745,7 @@ class Lu {
|
|
|
4717
4745
|
_handleReceive(e, n) {
|
|
4718
4746
|
var r, i, s, o, a, u;
|
|
4719
4747
|
const c = !!this.config.schema && ("cardinalityInference" in this.config ? !!this.config.cardinalityInference : !0);
|
|
4720
|
-
switch (
|
|
4748
|
+
switch (Jr[n.op] || this._log.info("[receive]", e, n.op, n), n.op) {
|
|
4721
4749
|
case "init-ok": {
|
|
4722
4750
|
this._setStatus(le.AUTHENTICATED), this._reconnectTimeoutMs = 0, this._setAttrs(n.attrs), this._flushPendingMessages(), this._sessionId = n["session-id"];
|
|
4723
4751
|
for (const l of Object.keys(this._rooms)) {
|
|
@@ -4734,7 +4762,7 @@ class Lu {
|
|
|
4734
4762
|
const { q: l, result: p } = n, y = V(l);
|
|
4735
4763
|
if (!this._hasQueryListeners() && !this.querySubs.currentValue[y])
|
|
4736
4764
|
break;
|
|
4737
|
-
const b = (o = (s = p == null ? void 0 : p[0]) === null || s === void 0 ? void 0 : s.data) === null || o === void 0 ? void 0 : o["page-info"], g = (u = (a = p == null ? void 0 : p[0]) === null || a === void 0 ? void 0 : a.data) === null || u === void 0 ? void 0 : u.aggregate, w =
|
|
4765
|
+
const b = (o = (s = p == null ? void 0 : p[0]) === null || s === void 0 ? void 0 : s.data) === null || o === void 0 ? void 0 : o["page-info"], g = (u = (a = p == null ? void 0 : p[0]) === null || a === void 0 ? void 0 : a.data) === null || u === void 0 ? void 0 : u.aggregate, w = Fr(p), T = St(this.attrs, w, c, this._linkIndex, this.config.useDateObjects);
|
|
4738
4766
|
this.querySubs.updateInPlace((m) => {
|
|
4739
4767
|
if (!m[y]) {
|
|
4740
4768
|
this._log.error("Missing value in querySubs", { hash: y, q: l });
|
|
@@ -4772,9 +4800,9 @@ class Lu {
|
|
|
4772
4800
|
b !== this._pendingMutations() && this.kv.updateInPlace((T) => {
|
|
4773
4801
|
T.pendingMutations = b;
|
|
4774
4802
|
});
|
|
4775
|
-
const g =
|
|
4803
|
+
const g = Zr(b.entries()), w = l.map((T) => {
|
|
4776
4804
|
var m, E, S, I;
|
|
4777
|
-
const x = T["instaql-query"], q = T["instaql-result"], we = V(x), dt =
|
|
4805
|
+
const x = T["instaql-query"], q = T["instaql-result"], we = V(x), dt = Fr(q), Lt = St(this.attrs, dt, c, this._linkIndex, this.config.useDateObjects), Ft = this._applyOptimisticUpdates(Lt, g, y), ft = (E = (m = q == null ? void 0 : q[0]) === null || m === void 0 ? void 0 : m.data) === null || E === void 0 ? void 0 : E["page-info"], ce = (I = (S = q == null ? void 0 : q[0]) === null || S === void 0 ? void 0 : S.data) === null || I === void 0 ? void 0 : I.aggregate;
|
|
4778
4806
|
return { q: x, hash: we, store: Ft, pageInfo: ft, aggregate: ce };
|
|
4779
4807
|
});
|
|
4780
4808
|
w.forEach(({ hash: T, q: m, store: E, pageInfo: S, aggregate: I }) => {
|
|
@@ -4937,7 +4965,7 @@ class Lu {
|
|
|
4937
4965
|
*/
|
|
4938
4966
|
subscribeQuery(e, n, r) {
|
|
4939
4967
|
var i;
|
|
4940
|
-
this.config.disableValidation ||
|
|
4968
|
+
this.config.disableValidation || qr(e, this.config.schema), r && "ruleParams" in r && (e = Object.assign({ $$ruleParams: r.ruleParams }, e));
|
|
4941
4969
|
const s = V(e), o = this.getPreviousResult(e);
|
|
4942
4970
|
return o && n(o), this.queryCbs[s] = (i = this.queryCbs[s]) !== null && i !== void 0 ? i : [], this.queryCbs[s].push({ q: e, cb: n }), this._startQuerySub(e, s), () => {
|
|
4943
4971
|
this._unsubQuery(e, s, n);
|
|
@@ -4945,14 +4973,14 @@ class Lu {
|
|
|
4945
4973
|
}
|
|
4946
4974
|
queryOnce(e, n) {
|
|
4947
4975
|
var r;
|
|
4948
|
-
this.config.disableValidation ||
|
|
4949
|
-
const i = new
|
|
4976
|
+
this.config.disableValidation || qr(e, this.config.schema), n && "ruleParams" in n && (e = Object.assign({ $$ruleParams: n.ruleParams }, e));
|
|
4977
|
+
const i = new Lr();
|
|
4950
4978
|
if (!this._isOnline)
|
|
4951
4979
|
return i.reject(new Error("We can't run `queryOnce`, because the device is offline.")), i.promise;
|
|
4952
4980
|
if (!this.querySubs)
|
|
4953
4981
|
return i.reject(new Error("We can't run `queryOnce` on the backend. Use adminAPI.query instead: https://www.instantdb.com/docs/backend#query")), i.promise;
|
|
4954
4982
|
const s = V(e), o = this._startQuerySub(e, s);
|
|
4955
|
-
return this.queryOnceDfds[s] = (r = this.queryOnceDfds[s]) !== null && r !== void 0 ? r : [], this.queryOnceDfds[s].push({ q: e, dfd: i, eventId: o }), setTimeout(() => i.reject(new Error("Query timed out")),
|
|
4983
|
+
return this.queryOnceDfds[s] = (r = this.queryOnceDfds[s]) !== null && r !== void 0 ? r : [], this.queryOnceDfds[s].push({ q: e, dfd: i, eventId: o }), setTimeout(() => i.reject(new Error("Query timed out")), Cu), i.promise;
|
|
4956
4984
|
}
|
|
4957
4985
|
_completeQueryOnce(e, n, r) {
|
|
4958
4986
|
this.queryOnceDfds[n] && (this.queryOnceDfds[n] = this.queryOnceDfds[n].filter((i) => i.dfd !== r), this._cleanupQuery(e, n));
|
|
@@ -5013,7 +5041,7 @@ class Lu {
|
|
|
5013
5041
|
a = !0;
|
|
5014
5042
|
continue;
|
|
5015
5043
|
}
|
|
5016
|
-
const b = a ?
|
|
5044
|
+
const b = a ? _a(o, p) : p;
|
|
5017
5045
|
l.push(b);
|
|
5018
5046
|
}
|
|
5019
5047
|
return a ? l : d;
|
|
@@ -5023,7 +5051,7 @@ class Lu {
|
|
|
5023
5051
|
return a ? c : n;
|
|
5024
5052
|
}
|
|
5025
5053
|
_rewriteMutationsSorted(e, n) {
|
|
5026
|
-
return
|
|
5054
|
+
return Zr(this._rewriteMutations(e, n).entries());
|
|
5027
5055
|
}
|
|
5028
5056
|
// ---------------------------
|
|
5029
5057
|
// Transact
|
|
@@ -5056,7 +5084,7 @@ class Lu {
|
|
|
5056
5084
|
const c = this._dataForQueryCache[e];
|
|
5057
5085
|
if (c && r === c.querySubVersion && s === c.pendingMutationsVersion)
|
|
5058
5086
|
return c.data;
|
|
5059
|
-
const { store: d, pageInfo: f, aggregate: l, processedTxId: p } = u, y = this._rewriteMutationsSorted(d.attrs, o), b = this._applyOptimisticUpdates(d, y, p), g =
|
|
5087
|
+
const { store: d, pageInfo: f, aggregate: l, processedTxId: p } = u, y = this._rewriteMutationsSorted(d.attrs, o), b = this._applyOptimisticUpdates(d, y, p), g = Di({ store: b, pageInfo: f, aggregate: l }, a);
|
|
5060
5088
|
return this._dataForQueryCache[e] = {
|
|
5061
5089
|
querySubVersion: r,
|
|
5062
5090
|
pendingMutationsVersion: s,
|
|
@@ -5065,7 +5093,7 @@ class Lu {
|
|
|
5065
5093
|
}
|
|
5066
5094
|
_applyOptimisticUpdates(e, n, r) {
|
|
5067
5095
|
for (const [i, s] of n)
|
|
5068
|
-
(!s["tx-id"] || r && s["tx-id"] > r) && (e =
|
|
5096
|
+
(!s["tx-id"] || r && s["tx-id"] > r) && (e = go(e, s["tx-steps"]));
|
|
5069
5097
|
return e;
|
|
5070
5098
|
}
|
|
5071
5099
|
/** Re-compute all subscriptions */
|
|
@@ -5153,7 +5181,7 @@ class Lu {
|
|
|
5153
5181
|
}
|
|
5154
5182
|
_trySend(e, n, r) {
|
|
5155
5183
|
if (this._transport.isOpen()) {
|
|
5156
|
-
switch (
|
|
5184
|
+
switch (Jr[n.op] || this._log.info("[send]", this._transport.id, n.op, n), n.op) {
|
|
5157
5185
|
case "transact": {
|
|
5158
5186
|
this._inFlightMutationEventIds.add(e);
|
|
5159
5187
|
break;
|
|
@@ -5174,7 +5202,7 @@ class Lu {
|
|
|
5174
5202
|
return;
|
|
5175
5203
|
}
|
|
5176
5204
|
const e = this._transport;
|
|
5177
|
-
this._transport =
|
|
5205
|
+
this._transport = Ru({
|
|
5178
5206
|
transportType: this._transportType,
|
|
5179
5207
|
appId: this.config.appId,
|
|
5180
5208
|
apiURI: this.config.apiURI,
|
|
@@ -5247,7 +5275,7 @@ class Lu {
|
|
|
5247
5275
|
return null;
|
|
5248
5276
|
this._replaceUrlAfterOAuth();
|
|
5249
5277
|
try {
|
|
5250
|
-
const u = yield this._getCurrentUser(), c = (u == null ? void 0 : u.type) === "guest", { user: d } = yield
|
|
5278
|
+
const u = yield this._getCurrentUser(), c = (u == null ? void 0 : u.type) === "guest", { user: d } = yield Dr({
|
|
5251
5279
|
apiURI: this.config.apiURI,
|
|
5252
5280
|
appId: this.config.appId,
|
|
5253
5281
|
code: a,
|
|
@@ -5377,7 +5405,7 @@ class Lu {
|
|
|
5377
5405
|
}), this._reconnectTimeoutMs = 0, this._transport.close(), this._oauthCallbackResponse = null, this.notifyAuthSubs(n);
|
|
5378
5406
|
}
|
|
5379
5407
|
sendMagicCode({ email: e }) {
|
|
5380
|
-
return
|
|
5408
|
+
return Za({
|
|
5381
5409
|
apiURI: this.config.apiURI,
|
|
5382
5410
|
appId: this.config.appId,
|
|
5383
5411
|
email: e
|
|
@@ -5386,7 +5414,7 @@ class Lu {
|
|
|
5386
5414
|
signInWithMagicCode(e) {
|
|
5387
5415
|
return F(this, arguments, void 0, function* ({ email: n, code: r }) {
|
|
5388
5416
|
var i;
|
|
5389
|
-
const s = yield this.getCurrentUser(), o = ((i = s == null ? void 0 : s.user) === null || i === void 0 ? void 0 : i.type) === "guest", a = yield
|
|
5417
|
+
const s = yield this.getCurrentUser(), o = ((i = s == null ? void 0 : s.user) === null || i === void 0 ? void 0 : i.type) === "guest", a = yield Xa({
|
|
5390
5418
|
apiURI: this.config.apiURI,
|
|
5391
5419
|
appId: this.config.appId,
|
|
5392
5420
|
email: n,
|
|
@@ -5398,7 +5426,7 @@ class Lu {
|
|
|
5398
5426
|
}
|
|
5399
5427
|
signInWithCustomToken(e) {
|
|
5400
5428
|
return F(this, void 0, void 0, function* () {
|
|
5401
|
-
const n = yield
|
|
5429
|
+
const n = yield eu({
|
|
5402
5430
|
apiURI: this.config.apiURI,
|
|
5403
5431
|
appId: this.config.appId,
|
|
5404
5432
|
refreshToken: e
|
|
@@ -5408,7 +5436,7 @@ class Lu {
|
|
|
5408
5436
|
}
|
|
5409
5437
|
signInAsGuest() {
|
|
5410
5438
|
return F(this, void 0, void 0, function* () {
|
|
5411
|
-
const e = yield
|
|
5439
|
+
const e = yield tu({
|
|
5412
5440
|
apiURI: this.config.apiURI,
|
|
5413
5441
|
appId: this.config.appId
|
|
5414
5442
|
});
|
|
@@ -5424,7 +5452,7 @@ class Lu {
|
|
|
5424
5452
|
this._log.info("[auth-invalidate] skipped invalidateToken");
|
|
5425
5453
|
return;
|
|
5426
5454
|
}
|
|
5427
|
-
|
|
5455
|
+
ru({
|
|
5428
5456
|
apiURI: this.config.apiURI,
|
|
5429
5457
|
appId: this.config.appId,
|
|
5430
5458
|
refreshToken: i
|
|
@@ -5459,7 +5487,7 @@ class Lu {
|
|
|
5459
5487
|
exchangeCodeForToken(e) {
|
|
5460
5488
|
return F(this, arguments, void 0, function* ({ code: n, codeVerifier: r }) {
|
|
5461
5489
|
var i;
|
|
5462
|
-
const s = yield this.getCurrentUser(), o = ((i = s == null ? void 0 : s.user) === null || i === void 0 ? void 0 : i.type) === "guest", a = yield
|
|
5490
|
+
const s = yield this.getCurrentUser(), o = ((i = s == null ? void 0 : s.user) === null || i === void 0 ? void 0 : i.type) === "guest", a = yield Dr({
|
|
5463
5491
|
apiURI: this.config.apiURI,
|
|
5464
5492
|
appId: this.config.appId,
|
|
5465
5493
|
code: n,
|
|
@@ -5482,7 +5510,7 @@ class Lu {
|
|
|
5482
5510
|
signInWithIdToken(e) {
|
|
5483
5511
|
return F(this, arguments, void 0, function* ({ idToken: n, clientName: r, nonce: i }) {
|
|
5484
5512
|
var s;
|
|
5485
|
-
const o = yield this.getCurrentUser(), a = (s = o == null ? void 0 : o.user) === null || s === void 0 ? void 0 : s.refresh_token, u = yield
|
|
5513
|
+
const o = yield this.getCurrentUser(), a = (s = o == null ? void 0 : o.user) === null || s === void 0 ? void 0 : s.refresh_token, u = yield nu({
|
|
5486
5514
|
apiURI: this.config.apiURI,
|
|
5487
5515
|
appId: this.config.appId,
|
|
5488
5516
|
idToken: n,
|
|
@@ -5523,7 +5551,7 @@ class Lu {
|
|
|
5523
5551
|
// TODO: look into typing again
|
|
5524
5552
|
getPresence(e, n, r = {}) {
|
|
5525
5553
|
const i = this._rooms[n], s = this._presence[n];
|
|
5526
|
-
return !i || !s || !s.result ? null : Object.assign(Object.assign({},
|
|
5554
|
+
return !i || !s || !s.result ? null : Object.assign(Object.assign({}, cu(s.result, r, this._sessionId)), { isLoading: !i.isConnected, error: i.error });
|
|
5527
5555
|
}
|
|
5528
5556
|
// TODO: look into typing again
|
|
5529
5557
|
publishPresence(e, n, r) {
|
|
@@ -5573,7 +5601,7 @@ class Lu {
|
|
|
5573
5601
|
}
|
|
5574
5602
|
_notifyPresenceSub(e, n) {
|
|
5575
5603
|
const r = this.getPresence("", e, n);
|
|
5576
|
-
r && (n.prev && !
|
|
5604
|
+
r && (n.prev && !du(r, n.prev) || (n.prev = r, n.cb(r)));
|
|
5577
5605
|
}
|
|
5578
5606
|
_patchPresencePeers(e, n) {
|
|
5579
5607
|
var r, i, s;
|
|
@@ -5584,13 +5612,13 @@ class Lu {
|
|
|
5584
5612
|
for (let [d, f, l] of n)
|
|
5585
5613
|
switch (f) {
|
|
5586
5614
|
case "+":
|
|
5587
|
-
|
|
5615
|
+
Ns(c, d, l);
|
|
5588
5616
|
break;
|
|
5589
5617
|
case "r":
|
|
5590
5618
|
Or(c, d, l);
|
|
5591
5619
|
break;
|
|
5592
5620
|
case "-":
|
|
5593
|
-
|
|
5621
|
+
Ti(c, d);
|
|
5594
5622
|
break;
|
|
5595
5623
|
}
|
|
5596
5624
|
delete c[this._sessionId];
|
|
@@ -5647,14 +5675,14 @@ class Lu {
|
|
|
5647
5675
|
return F(this, void 0, void 0, function* () {
|
|
5648
5676
|
var i;
|
|
5649
5677
|
const s = yield this.getCurrentUser(), o = (i = s == null ? void 0 : s.user) === null || i === void 0 ? void 0 : i.refresh_token;
|
|
5650
|
-
return
|
|
5678
|
+
return iu(Object.assign(Object.assign({}, r), { apiURI: this.config.apiURI, appId: this.config.appId, path: e, file: n, refreshToken: o }));
|
|
5651
5679
|
});
|
|
5652
5680
|
}
|
|
5653
5681
|
deleteFile(e) {
|
|
5654
5682
|
return F(this, void 0, void 0, function* () {
|
|
5655
5683
|
var n;
|
|
5656
5684
|
const r = yield this.getCurrentUser(), i = (n = r == null ? void 0 : r.user) === null || n === void 0 ? void 0 : n.refresh_token;
|
|
5657
|
-
return yield
|
|
5685
|
+
return yield su({
|
|
5658
5686
|
apiURI: this.config.apiURI,
|
|
5659
5687
|
appId: this.config.appId,
|
|
5660
5688
|
path: e,
|
|
@@ -5667,20 +5695,20 @@ class Lu {
|
|
|
5667
5695
|
upload(e, n) {
|
|
5668
5696
|
return F(this, void 0, void 0, function* () {
|
|
5669
5697
|
var r;
|
|
5670
|
-
const i = yield this.getCurrentUser(), s = (r = i == null ? void 0 : i.user) === null || r === void 0 ? void 0 : r.refresh_token, o = e || n.name, a = yield
|
|
5698
|
+
const i = yield this.getCurrentUser(), s = (r = i == null ? void 0 : i.user) === null || r === void 0 ? void 0 : r.refresh_token, o = e || n.name, a = yield ou({
|
|
5671
5699
|
apiURI: this.config.apiURI,
|
|
5672
5700
|
appId: this.config.appId,
|
|
5673
5701
|
fileName: o,
|
|
5674
5702
|
refreshToken: s
|
|
5675
5703
|
});
|
|
5676
|
-
return yield
|
|
5704
|
+
return yield au(a, n);
|
|
5677
5705
|
});
|
|
5678
5706
|
}
|
|
5679
5707
|
getDownloadUrl(e) {
|
|
5680
5708
|
return F(this, void 0, void 0, function* () {
|
|
5681
5709
|
var n;
|
|
5682
5710
|
const r = yield this.getCurrentUser(), i = (n = r == null ? void 0 : r.user) === null || n === void 0 ? void 0 : n.refresh_token;
|
|
5683
|
-
return yield
|
|
5711
|
+
return yield uu({
|
|
5684
5712
|
apiURI: this.config.apiURI,
|
|
5685
5713
|
appId: this.config.appId,
|
|
5686
5714
|
path: e,
|
|
@@ -5689,9 +5717,9 @@ class Lu {
|
|
|
5689
5717
|
});
|
|
5690
5718
|
}
|
|
5691
5719
|
}
|
|
5692
|
-
function
|
|
5720
|
+
function Ku(t, e) {
|
|
5693
5721
|
return new Ut(
|
|
5694
|
-
|
|
5722
|
+
Ji(t, e),
|
|
5695
5723
|
// (XXX): LinksDef<any> stems from TypeScript’s inability to reconcile the
|
|
5696
5724
|
// type EntitiesWithLinks<EntitiesWithoutLinks, Links> with
|
|
5697
5725
|
// EntitiesWithoutLinks. TypeScript is strict about ensuring that types are
|
|
@@ -5701,28 +5729,28 @@ function Fu(t, e) {
|
|
|
5701
5729
|
void 0
|
|
5702
5730
|
);
|
|
5703
5731
|
}
|
|
5704
|
-
function
|
|
5732
|
+
function qu(t) {
|
|
5705
5733
|
return new Dt(t, {});
|
|
5706
5734
|
}
|
|
5707
|
-
function
|
|
5735
|
+
function Wu() {
|
|
5708
5736
|
return new H("string", !0, !1);
|
|
5709
5737
|
}
|
|
5710
|
-
function
|
|
5738
|
+
function zu() {
|
|
5711
5739
|
return new H("number", !0, !1);
|
|
5712
5740
|
}
|
|
5713
|
-
function
|
|
5741
|
+
function Vu() {
|
|
5714
5742
|
return new H("boolean", !0, !1);
|
|
5715
5743
|
}
|
|
5716
|
-
function
|
|
5744
|
+
function Gu() {
|
|
5717
5745
|
return new H("date", !0, !1);
|
|
5718
5746
|
}
|
|
5719
|
-
function
|
|
5747
|
+
function Bu() {
|
|
5720
5748
|
return new H("json", !0, !1);
|
|
5721
5749
|
}
|
|
5722
|
-
function
|
|
5750
|
+
function Qu() {
|
|
5723
5751
|
return new H("json", !0, !1);
|
|
5724
5752
|
}
|
|
5725
|
-
function
|
|
5753
|
+
function Ji(t, e) {
|
|
5726
5754
|
var n, r, i, s;
|
|
5727
5755
|
const o = { fwd: {}, rev: {} };
|
|
5728
5756
|
for (const u of Object.values(e))
|
|
@@ -5738,10 +5766,10 @@ function Yi(t, e) {
|
|
|
5738
5766
|
new Dt(c.attrs, Object.assign(Object.assign({}, o.fwd[u]), o.rev[u]))
|
|
5739
5767
|
]));
|
|
5740
5768
|
}
|
|
5741
|
-
function
|
|
5769
|
+
function Hu({ entities: t, links: e, rooms: n }) {
|
|
5742
5770
|
const r = e ?? {}, i = n ?? {};
|
|
5743
5771
|
return new Ut(
|
|
5744
|
-
|
|
5772
|
+
Ji(t, r),
|
|
5745
5773
|
// (XXX): LinksDef<any> stems from TypeScript's inability to reconcile the
|
|
5746
5774
|
// type EntitiesWithLinks<EntitiesWithoutLinks, Links> with
|
|
5747
5775
|
// EntitiesWithoutLinks. TypeScript is strict about ensuring that types are
|
|
@@ -5751,23 +5779,23 @@ function Bu({ entities: t, links: e, rooms: n }) {
|
|
|
5751
5779
|
i
|
|
5752
5780
|
);
|
|
5753
5781
|
}
|
|
5754
|
-
const
|
|
5782
|
+
const Nc = {
|
|
5755
5783
|
// constructs
|
|
5756
|
-
graph:
|
|
5757
|
-
schema:
|
|
5758
|
-
entity:
|
|
5784
|
+
graph: Ku,
|
|
5785
|
+
schema: Hu,
|
|
5786
|
+
entity: qu,
|
|
5759
5787
|
// value types
|
|
5760
|
-
string:
|
|
5761
|
-
number:
|
|
5762
|
-
boolean:
|
|
5763
|
-
date:
|
|
5764
|
-
json:
|
|
5765
|
-
any:
|
|
5788
|
+
string: Wu,
|
|
5789
|
+
number: zu,
|
|
5790
|
+
boolean: Vu,
|
|
5791
|
+
date: Gu,
|
|
5792
|
+
json: Bu,
|
|
5793
|
+
any: Qu
|
|
5766
5794
|
};
|
|
5767
5795
|
let Tt;
|
|
5768
|
-
function
|
|
5796
|
+
function Yu(t, e) {
|
|
5769
5797
|
Tt == null || Tt.dispose();
|
|
5770
|
-
const n =
|
|
5798
|
+
const n = nc(e), r = Xu(e, a), i = Zu(Ju(t));
|
|
5771
5799
|
function s(d) {
|
|
5772
5800
|
var f;
|
|
5773
5801
|
d.source === i.element.contentWindow && ((f = d.data) === null || f === void 0 ? void 0 : f.type) === "close" && n.isVisible() && a();
|
|
@@ -5789,10 +5817,10 @@ function Qu(t, e) {
|
|
|
5789
5817
|
}
|
|
5790
5818
|
return c();
|
|
5791
5819
|
}
|
|
5792
|
-
function
|
|
5793
|
-
return `${Gn ||
|
|
5820
|
+
function Ju(t) {
|
|
5821
|
+
return `${Gn || Wi ? "http://localhost:3000" : "https://instantdb.com"}/_devtool?appId=${t}`;
|
|
5794
5822
|
}
|
|
5795
|
-
function
|
|
5823
|
+
function Zu(t) {
|
|
5796
5824
|
const e = document.createElement("iframe");
|
|
5797
5825
|
return e.src = t, e.className = "instant-devtool-iframe", Object.assign(e.style, {
|
|
5798
5826
|
width: "100%",
|
|
@@ -5801,7 +5829,7 @@ function Yu(t) {
|
|
|
5801
5829
|
border: "none"
|
|
5802
5830
|
}), { element: e };
|
|
5803
5831
|
}
|
|
5804
|
-
function
|
|
5832
|
+
function Xu(t, e) {
|
|
5805
5833
|
const n = `
|
|
5806
5834
|
<svg width="32" height="32" viewBox="0 0 512 512" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
5807
5835
|
<rect width="512" height="512" fill="black"/>
|
|
@@ -5811,7 +5839,7 @@ function Ju(t, e) {
|
|
|
5811
5839
|
return r.innerHTML = n, r.className = "instant-devtool-toggler", Object.assign(r.style, Object.assign(Object.assign({
|
|
5812
5840
|
// pos
|
|
5813
5841
|
position: "fixed"
|
|
5814
|
-
},
|
|
5842
|
+
}, ec(t.position)), {
|
|
5815
5843
|
height: "32px",
|
|
5816
5844
|
width: "32px",
|
|
5817
5845
|
// layout
|
|
@@ -5826,7 +5854,7 @@ function Ju(t, e) {
|
|
|
5826
5854
|
cursor: "pointer"
|
|
5827
5855
|
})), r.addEventListener("click", e), { element: r };
|
|
5828
5856
|
}
|
|
5829
|
-
function
|
|
5857
|
+
function ec(t) {
|
|
5830
5858
|
switch (t) {
|
|
5831
5859
|
case "bottom-left":
|
|
5832
5860
|
return { bottom: "24px", left: "24px" };
|
|
@@ -5838,7 +5866,7 @@ function Zu(t) {
|
|
|
5838
5866
|
return { top: "24px", left: "24px" };
|
|
5839
5867
|
}
|
|
5840
5868
|
}
|
|
5841
|
-
function
|
|
5869
|
+
function tc(t) {
|
|
5842
5870
|
switch (t) {
|
|
5843
5871
|
case "bottom-left":
|
|
5844
5872
|
return { bottom: "24px", right: "24px", left: "60px", top: "72px" };
|
|
@@ -5850,23 +5878,23 @@ function Xu(t) {
|
|
|
5850
5878
|
return { top: "24px", right: "24px", left: "60px", bottom: "72px" };
|
|
5851
5879
|
}
|
|
5852
5880
|
}
|
|
5853
|
-
function
|
|
5881
|
+
function nc(t) {
|
|
5854
5882
|
const e = document.createElement("div");
|
|
5855
|
-
Object.assign(e.style, Object.assign(Object.assign({ position: "fixed" },
|
|
5883
|
+
Object.assign(e.style, Object.assign(Object.assign({ position: "fixed" }, tc(t.position)), { display: "block", borderRadius: "4px", border: "1px #ccc solid", boxShadow: "0px 0px 8px #00000044", backgroundColor: "#eee", zIndex: "999990" })), e.style.display = "none", e.className = "instant-devtool-container";
|
|
5856
5884
|
function n() {
|
|
5857
5885
|
return e.style.display !== "none";
|
|
5858
5886
|
}
|
|
5859
5887
|
return { element: e, isVisible: n };
|
|
5860
5888
|
}
|
|
5861
|
-
const
|
|
5889
|
+
const rc = {
|
|
5862
5890
|
apiURI: "https://api.instantdb.com",
|
|
5863
5891
|
websocketURI: "wss://api.instantdb.com/runtime/session"
|
|
5864
5892
|
};
|
|
5865
|
-
function
|
|
5893
|
+
function ic() {
|
|
5866
5894
|
var t;
|
|
5867
5895
|
return globalThis.__instantDbSchemaHashStore = (t = globalThis.__instantDbSchemaHashStore) !== null && t !== void 0 ? t : /* @__PURE__ */ new WeakMap(), globalThis.__instantDbSchemaHashStore;
|
|
5868
5896
|
}
|
|
5869
|
-
function
|
|
5897
|
+
function sc() {
|
|
5870
5898
|
var t;
|
|
5871
5899
|
return globalThis.__instantDbStore = (t = globalThis.__instantDbStore) !== null && t !== void 0 ? t : {}, globalThis.__instantDbStore;
|
|
5872
5900
|
}
|
|
@@ -5874,23 +5902,23 @@ function mn(t) {
|
|
|
5874
5902
|
const e = t.__adminToken;
|
|
5875
5903
|
return t.appId + "_" + (t.websocketURI || "default_ws_uri") + "_" + (t.apiURI || "default_api_uri") + "_" + (e || "client_only") + "_" + t.useDateObjects;
|
|
5876
5904
|
}
|
|
5877
|
-
const vn =
|
|
5878
|
-
class
|
|
5905
|
+
const vn = sc(), en = ic();
|
|
5906
|
+
class oc {
|
|
5879
5907
|
constructor(e) {
|
|
5880
5908
|
this.db = e, this.sendMagicCode = (n) => this.db.sendMagicCode(n), this.signInWithMagicCode = (n) => this.db.signInWithMagicCode(n), this.signInWithToken = (n) => this.db.signInWithCustomToken(n), this.signInAsGuest = () => this.db.signInAsGuest(), this.createAuthorizationURL = (n) => this.db.createAuthorizationURL(n), this.signInWithIdToken = (n) => this.db.signInWithIdToken(n), this.exchangeOAuthCode = (n) => this.db.exchangeCodeForToken(n), this.issuerURI = () => this.db.issuerURI(), this.signOut = (n = { invalidateToken: !0 }) => this.db.signOut(n);
|
|
5881
5909
|
}
|
|
5882
5910
|
}
|
|
5883
|
-
class
|
|
5911
|
+
class ac {
|
|
5884
5912
|
constructor(e) {
|
|
5885
5913
|
this.db = e, this.uploadFile = (n, r, i = {}) => this.db.uploadFile(n, r, i), this.delete = (n) => this.db.deleteFile(n), this.upload = (n, r) => this.db.upload(n, r), this.put = this.upload, this.getDownloadUrl = (n) => this.db.getDownloadUrl(n);
|
|
5886
5914
|
}
|
|
5887
5915
|
}
|
|
5888
|
-
function
|
|
5916
|
+
function uc(t) {
|
|
5889
5917
|
return JSON.parse(JSON.stringify(t));
|
|
5890
5918
|
}
|
|
5891
|
-
class
|
|
5919
|
+
class cc {
|
|
5892
5920
|
constructor(e) {
|
|
5893
|
-
this.tx = Vn(), this._reactor = e, this.auth = new
|
|
5921
|
+
this.tx = Vn(), this._reactor = e, this.auth = new oc(this._reactor), this.storage = new ac(this._reactor);
|
|
5894
5922
|
}
|
|
5895
5923
|
/**
|
|
5896
5924
|
* Use this to write data! You can create, update, delete, and link objects
|
|
@@ -6064,7 +6092,7 @@ class ac {
|
|
|
6064
6092
|
return this._reactor.subscribeTable(e, n);
|
|
6065
6093
|
}
|
|
6066
6094
|
}
|
|
6067
|
-
function
|
|
6095
|
+
function Xr(t) {
|
|
6068
6096
|
if (!t)
|
|
6069
6097
|
return "0";
|
|
6070
6098
|
if (en.get(t))
|
|
@@ -6072,21 +6100,21 @@ function Zr(t) {
|
|
|
6072
6100
|
const e = V(t);
|
|
6073
6101
|
return en.set(t, e), e;
|
|
6074
6102
|
}
|
|
6075
|
-
function
|
|
6076
|
-
return
|
|
6103
|
+
function dc(t, e) {
|
|
6104
|
+
return Xr(t._reactor.config.schema) !== Xr(e);
|
|
6077
6105
|
}
|
|
6078
|
-
function
|
|
6106
|
+
function fc(t, e, n, r, i) {
|
|
6079
6107
|
const s = vn[mn(t)];
|
|
6080
6108
|
if (s)
|
|
6081
|
-
return
|
|
6082
|
-
const o = new
|
|
6083
|
-
return vn[mn(t)] = a,
|
|
6109
|
+
return dc(s, t.schema) && s._reactor.updateSchema(t.schema), s;
|
|
6110
|
+
const o = new Nu(Object.assign(Object.assign(Object.assign({}, rc), t), { cardinalityInference: !!t.schema }), e || Ni, n || Ki, Object.assign(Object.assign({}, r || {}), { "@instantdb/core": Bn }), i), a = new cc(o);
|
|
6111
|
+
return vn[mn(t)] = a, lc(t.appId, t.devtool), a;
|
|
6084
6112
|
}
|
|
6085
|
-
function
|
|
6113
|
+
function lc(t, e) {
|
|
6086
6114
|
if (typeof window > "u" || typeof window.location > "u" || typeof document > "u" || typeof e == "boolean" && !e)
|
|
6087
6115
|
return;
|
|
6088
6116
|
const n = Object.assign({ position: "bottom-right", allowedHosts: ["localhost"] }, typeof e == "object" ? e : {});
|
|
6089
|
-
n.allowedHosts.includes(window.location.hostname) &&
|
|
6117
|
+
n.allowedHosts.includes(window.location.hostname) && Yu(t, n);
|
|
6090
6118
|
}
|
|
6091
6119
|
var Sn = { exports: {} }, He = {};
|
|
6092
6120
|
/**
|
|
@@ -6098,11 +6126,11 @@ var Sn = { exports: {} }, He = {};
|
|
|
6098
6126
|
* This source code is licensed under the MIT license found in the
|
|
6099
6127
|
* LICENSE file in the root directory of this source tree.
|
|
6100
6128
|
*/
|
|
6101
|
-
var
|
|
6102
|
-
function
|
|
6103
|
-
if (
|
|
6104
|
-
|
|
6105
|
-
var t =
|
|
6129
|
+
var ei;
|
|
6130
|
+
function hc() {
|
|
6131
|
+
if (ei) return He;
|
|
6132
|
+
ei = 1;
|
|
6133
|
+
var t = ui, e = Symbol.for("react.element"), n = Symbol.for("react.fragment"), r = Object.prototype.hasOwnProperty, i = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, s = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
6106
6134
|
function o(a, u, c) {
|
|
6107
6135
|
var d, f = {}, l = null, p = null;
|
|
6108
6136
|
c !== void 0 && (l = "" + c), u.key !== void 0 && (l = "" + u.key), u.ref !== void 0 && (p = u.ref);
|
|
@@ -6112,10 +6140,10 @@ function fc() {
|
|
|
6112
6140
|
}
|
|
6113
6141
|
return He.Fragment = n, He.jsx = o, He.jsxs = o, He;
|
|
6114
6142
|
}
|
|
6115
|
-
var Ye = {},
|
|
6116
|
-
function
|
|
6117
|
-
if (
|
|
6118
|
-
|
|
6143
|
+
var Ye = {}, ti;
|
|
6144
|
+
function pc() {
|
|
6145
|
+
if (ti) return Ye;
|
|
6146
|
+
ti = 1;
|
|
6119
6147
|
var t = {};
|
|
6120
6148
|
/**
|
|
6121
6149
|
* @license React
|
|
@@ -6127,7 +6155,7 @@ function lc() {
|
|
|
6127
6155
|
* LICENSE file in the root directory of this source tree.
|
|
6128
6156
|
*/
|
|
6129
6157
|
return t.NODE_ENV !== "production" && function() {
|
|
6130
|
-
var e =
|
|
6158
|
+
var e = ui, n = Symbol.for("react.element"), r = Symbol.for("react.portal"), i = Symbol.for("react.fragment"), s = Symbol.for("react.strict_mode"), o = Symbol.for("react.profiler"), a = Symbol.for("react.provider"), u = Symbol.for("react.context"), c = Symbol.for("react.forward_ref"), d = Symbol.for("react.suspense"), f = Symbol.for("react.suspense_list"), l = Symbol.for("react.memo"), p = Symbol.for("react.lazy"), y = Symbol.for("react.offscreen"), b = Symbol.iterator, g = "@@iterator";
|
|
6131
6159
|
function w(h) {
|
|
6132
6160
|
if (h === null || typeof h != "object")
|
|
6133
6161
|
return null;
|
|
@@ -6220,7 +6248,7 @@ function lc() {
|
|
|
6220
6248
|
function rr() {
|
|
6221
6249
|
}
|
|
6222
6250
|
rr.__reactDisabledLog = !0;
|
|
6223
|
-
function
|
|
6251
|
+
function Xi() {
|
|
6224
6252
|
{
|
|
6225
6253
|
if (Ge === 0) {
|
|
6226
6254
|
Yn = console.log, Jn = console.info, Zn = console.warn, Xn = console.error, er = console.group, tr = console.groupCollapsed, nr = console.groupEnd;
|
|
@@ -6243,7 +6271,7 @@ function lc() {
|
|
|
6243
6271
|
Ge++;
|
|
6244
6272
|
}
|
|
6245
6273
|
}
|
|
6246
|
-
function
|
|
6274
|
+
function es() {
|
|
6247
6275
|
{
|
|
6248
6276
|
if (Ge--, Ge === 0) {
|
|
6249
6277
|
var h = {
|
|
@@ -6294,8 +6322,8 @@ function lc() {
|
|
|
6294
6322
|
}
|
|
6295
6323
|
var qt = !1, ht;
|
|
6296
6324
|
{
|
|
6297
|
-
var
|
|
6298
|
-
ht = new
|
|
6325
|
+
var ts = typeof WeakMap == "function" ? WeakMap : Map;
|
|
6326
|
+
ht = new ts();
|
|
6299
6327
|
}
|
|
6300
6328
|
function ir(h, _) {
|
|
6301
6329
|
if (!h || qt)
|
|
@@ -6310,7 +6338,7 @@ function lc() {
|
|
|
6310
6338
|
var P = Error.prepareStackTrace;
|
|
6311
6339
|
Error.prepareStackTrace = void 0;
|
|
6312
6340
|
var M;
|
|
6313
|
-
M = Nt.current, Nt.current = null,
|
|
6341
|
+
M = Nt.current, Nt.current = null, Xi();
|
|
6314
6342
|
try {
|
|
6315
6343
|
if (_) {
|
|
6316
6344
|
var C = function() {
|
|
@@ -6363,15 +6391,15 @@ function lc() {
|
|
|
6363
6391
|
}
|
|
6364
6392
|
}
|
|
6365
6393
|
} finally {
|
|
6366
|
-
qt = !1, Nt.current = M,
|
|
6394
|
+
qt = !1, Nt.current = M, es(), Error.prepareStackTrace = P;
|
|
6367
6395
|
}
|
|
6368
6396
|
var Me = h ? h.displayName || h.name : "", ve = Me ? lt(Me) : "";
|
|
6369
6397
|
return typeof h == "function" && ht.set(h, ve), ve;
|
|
6370
6398
|
}
|
|
6371
|
-
function
|
|
6399
|
+
function ns(h, _, v) {
|
|
6372
6400
|
return ir(h, !1);
|
|
6373
6401
|
}
|
|
6374
|
-
function
|
|
6402
|
+
function rs(h) {
|
|
6375
6403
|
var _ = h.prototype;
|
|
6376
6404
|
return !!(_ && _.isReactComponent);
|
|
6377
6405
|
}
|
|
@@ -6379,7 +6407,7 @@ function lc() {
|
|
|
6379
6407
|
if (h == null)
|
|
6380
6408
|
return "";
|
|
6381
6409
|
if (typeof h == "function")
|
|
6382
|
-
return ir(h,
|
|
6410
|
+
return ir(h, rs(h));
|
|
6383
6411
|
if (typeof h == "string")
|
|
6384
6412
|
return lt(h);
|
|
6385
6413
|
switch (h) {
|
|
@@ -6391,7 +6419,7 @@ function lc() {
|
|
|
6391
6419
|
if (typeof h == "object")
|
|
6392
6420
|
switch (h.$$typeof) {
|
|
6393
6421
|
case c:
|
|
6394
|
-
return
|
|
6422
|
+
return ns(h.render);
|
|
6395
6423
|
case l:
|
|
6396
6424
|
return pt(h.type, _, v);
|
|
6397
6425
|
case p: {
|
|
@@ -6412,7 +6440,7 @@ function lc() {
|
|
|
6412
6440
|
} else
|
|
6413
6441
|
or.setExtraStackFrame(null);
|
|
6414
6442
|
}
|
|
6415
|
-
function
|
|
6443
|
+
function is(h, _, v, O, P) {
|
|
6416
6444
|
{
|
|
6417
6445
|
var M = Function.call.bind(Be);
|
|
6418
6446
|
for (var C in h)
|
|
@@ -6431,17 +6459,17 @@ function lc() {
|
|
|
6431
6459
|
}
|
|
6432
6460
|
}
|
|
6433
6461
|
}
|
|
6434
|
-
var
|
|
6462
|
+
var ss = Array.isArray;
|
|
6435
6463
|
function Wt(h) {
|
|
6436
|
-
return
|
|
6464
|
+
return ss(h);
|
|
6437
6465
|
}
|
|
6438
|
-
function
|
|
6466
|
+
function os(h) {
|
|
6439
6467
|
{
|
|
6440
6468
|
var _ = typeof Symbol == "function" && Symbol.toStringTag, v = _ && h[Symbol.toStringTag] || h.constructor.name || "Object";
|
|
6441
6469
|
return v;
|
|
6442
6470
|
}
|
|
6443
6471
|
}
|
|
6444
|
-
function
|
|
6472
|
+
function as(h) {
|
|
6445
6473
|
try {
|
|
6446
6474
|
return ar(h), !1;
|
|
6447
6475
|
} catch {
|
|
@@ -6452,16 +6480,16 @@ function lc() {
|
|
|
6452
6480
|
return "" + h;
|
|
6453
6481
|
}
|
|
6454
6482
|
function ur(h) {
|
|
6455
|
-
if (
|
|
6456
|
-
return m("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",
|
|
6483
|
+
if (as(h))
|
|
6484
|
+
return m("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", os(h)), ar(h);
|
|
6457
6485
|
}
|
|
6458
|
-
var cr = T.ReactCurrentOwner,
|
|
6486
|
+
var cr = T.ReactCurrentOwner, us = {
|
|
6459
6487
|
key: !0,
|
|
6460
6488
|
ref: !0,
|
|
6461
6489
|
__self: !0,
|
|
6462
6490
|
__source: !0
|
|
6463
6491
|
}, dr, fr;
|
|
6464
|
-
function
|
|
6492
|
+
function cs(h) {
|
|
6465
6493
|
if (Be.call(h, "ref")) {
|
|
6466
6494
|
var _ = Object.getOwnPropertyDescriptor(h, "ref").get;
|
|
6467
6495
|
if (_ && _.isReactWarning)
|
|
@@ -6469,7 +6497,7 @@ function lc() {
|
|
|
6469
6497
|
}
|
|
6470
6498
|
return h.ref !== void 0;
|
|
6471
6499
|
}
|
|
6472
|
-
function
|
|
6500
|
+
function ds(h) {
|
|
6473
6501
|
if (Be.call(h, "key")) {
|
|
6474
6502
|
var _ = Object.getOwnPropertyDescriptor(h, "key").get;
|
|
6475
6503
|
if (_ && _.isReactWarning)
|
|
@@ -6477,10 +6505,10 @@ function lc() {
|
|
|
6477
6505
|
}
|
|
6478
6506
|
return h.key !== void 0;
|
|
6479
6507
|
}
|
|
6480
|
-
function
|
|
6508
|
+
function fs(h, _) {
|
|
6481
6509
|
typeof h.ref == "string" && cr.current;
|
|
6482
6510
|
}
|
|
6483
|
-
function
|
|
6511
|
+
function ls(h, _) {
|
|
6484
6512
|
{
|
|
6485
6513
|
var v = function() {
|
|
6486
6514
|
dr || (dr = !0, m("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", _));
|
|
@@ -6491,7 +6519,7 @@ function lc() {
|
|
|
6491
6519
|
});
|
|
6492
6520
|
}
|
|
6493
6521
|
}
|
|
6494
|
-
function
|
|
6522
|
+
function hs(h, _) {
|
|
6495
6523
|
{
|
|
6496
6524
|
var v = function() {
|
|
6497
6525
|
fr || (fr = !0, m("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", _));
|
|
@@ -6502,7 +6530,7 @@ function lc() {
|
|
|
6502
6530
|
});
|
|
6503
6531
|
}
|
|
6504
6532
|
}
|
|
6505
|
-
var
|
|
6533
|
+
var ps = function(h, _, v, O, P, M, C) {
|
|
6506
6534
|
var k = {
|
|
6507
6535
|
// This tag allows us to uniquely identify this as a React Element
|
|
6508
6536
|
$$typeof: n,
|
|
@@ -6531,12 +6559,12 @@ function lc() {
|
|
|
6531
6559
|
value: P
|
|
6532
6560
|
}), Object.freeze && (Object.freeze(k.props), Object.freeze(k)), k;
|
|
6533
6561
|
};
|
|
6534
|
-
function
|
|
6562
|
+
function ys(h, _, v, O, P) {
|
|
6535
6563
|
{
|
|
6536
6564
|
var M, C = {}, k = null, B = null;
|
|
6537
|
-
v !== void 0 && (ur(v), k = "" + v),
|
|
6565
|
+
v !== void 0 && (ur(v), k = "" + v), ds(_) && (ur(_.key), k = "" + _.key), cs(_) && (B = _.ref, fs(_, P));
|
|
6538
6566
|
for (M in _)
|
|
6539
|
-
Be.call(_, M) && !
|
|
6567
|
+
Be.call(_, M) && !us.hasOwnProperty(M) && (C[M] = _[M]);
|
|
6540
6568
|
if (h && h.defaultProps) {
|
|
6541
6569
|
var D = h.defaultProps;
|
|
6542
6570
|
for (M in D)
|
|
@@ -6544,9 +6572,9 @@ function lc() {
|
|
|
6544
6572
|
}
|
|
6545
6573
|
if (k || B) {
|
|
6546
6574
|
var L = typeof h == "function" ? h.displayName || h.name || "Unknown" : h;
|
|
6547
|
-
k &&
|
|
6575
|
+
k && ls(C, L), B && hs(C, L);
|
|
6548
6576
|
}
|
|
6549
|
-
return
|
|
6577
|
+
return ps(h, k, B, P, O, cr.current, C);
|
|
6550
6578
|
}
|
|
6551
6579
|
}
|
|
6552
6580
|
var zt = T.ReactCurrentOwner, lr = T.ReactDebugCurrentFrame;
|
|
@@ -6574,11 +6602,11 @@ Check the render method of \`` + h + "`.";
|
|
|
6574
6602
|
return "";
|
|
6575
6603
|
}
|
|
6576
6604
|
}
|
|
6577
|
-
function
|
|
6605
|
+
function bs(h) {
|
|
6578
6606
|
return "";
|
|
6579
6607
|
}
|
|
6580
6608
|
var pr = {};
|
|
6581
|
-
function
|
|
6609
|
+
function _s(h) {
|
|
6582
6610
|
{
|
|
6583
6611
|
var _ = hr();
|
|
6584
6612
|
if (!_) {
|
|
@@ -6595,7 +6623,7 @@ Check the top-level render call using <` + v + ">.");
|
|
|
6595
6623
|
if (!h._store || h._store.validated || h.key != null)
|
|
6596
6624
|
return;
|
|
6597
6625
|
h._store.validated = !0;
|
|
6598
|
-
var v =
|
|
6626
|
+
var v = _s(_);
|
|
6599
6627
|
if (pr[v])
|
|
6600
6628
|
return;
|
|
6601
6629
|
pr[v] = !0;
|
|
@@ -6622,7 +6650,7 @@ Check the top-level render call using <` + v + ">.");
|
|
|
6622
6650
|
}
|
|
6623
6651
|
}
|
|
6624
6652
|
}
|
|
6625
|
-
function
|
|
6653
|
+
function gs(h) {
|
|
6626
6654
|
{
|
|
6627
6655
|
var _ = h.type;
|
|
6628
6656
|
if (_ == null || typeof _ == "string")
|
|
@@ -6638,7 +6666,7 @@ Check the top-level render call using <` + v + ">.");
|
|
|
6638
6666
|
return;
|
|
6639
6667
|
if (v) {
|
|
6640
6668
|
var O = ce(_);
|
|
6641
|
-
|
|
6669
|
+
is(v, h.props, "prop", O, h);
|
|
6642
6670
|
} else if (_.PropTypes !== void 0 && !Vt) {
|
|
6643
6671
|
Vt = !0;
|
|
6644
6672
|
var P = ce(_);
|
|
@@ -6647,7 +6675,7 @@ Check the top-level render call using <` + v + ">.");
|
|
|
6647
6675
|
typeof _.getDefaultProps == "function" && !_.getDefaultProps.isReactClassApproved && m("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
|
|
6648
6676
|
}
|
|
6649
6677
|
}
|
|
6650
|
-
function
|
|
6678
|
+
function Ts(h) {
|
|
6651
6679
|
{
|
|
6652
6680
|
for (var _ = Object.keys(h.props), v = 0; v < _.length; v++) {
|
|
6653
6681
|
var O = _[v];
|
|
@@ -6666,12 +6694,12 @@ Check the top-level render call using <` + v + ">.");
|
|
|
6666
6694
|
if (!C) {
|
|
6667
6695
|
var k = "";
|
|
6668
6696
|
(h === void 0 || typeof h == "object" && h !== null && Object.keys(h).length === 0) && (k += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
|
|
6669
|
-
var B =
|
|
6697
|
+
var B = bs();
|
|
6670
6698
|
B ? k += B : k += hr();
|
|
6671
6699
|
var D;
|
|
6672
6700
|
h === null ? D = "null" : Wt(h) ? D = "array" : h !== void 0 && h.$$typeof === n ? (D = "<" + (ce(h.type) || "Unknown") + " />", k = " Did you accidentally export a JSX literal instead of a component?") : D = typeof h, m("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", D, k);
|
|
6673
6701
|
}
|
|
6674
|
-
var L =
|
|
6702
|
+
var L = ys(h, _, v, P, M);
|
|
6675
6703
|
if (L == null)
|
|
6676
6704
|
return L;
|
|
6677
6705
|
if (C) {
|
|
@@ -6688,57 +6716,57 @@ Check the top-level render call using <` + v + ">.");
|
|
|
6688
6716
|
br(re, h);
|
|
6689
6717
|
}
|
|
6690
6718
|
if (Be.call(_, "key")) {
|
|
6691
|
-
var ve = ce(h), Y = Object.keys(_).filter(function(
|
|
6692
|
-
return
|
|
6719
|
+
var ve = ce(h), Y = Object.keys(_).filter(function(Es) {
|
|
6720
|
+
return Es !== "key";
|
|
6693
6721
|
}), Bt = Y.length > 0 ? "{key: someKey, " + Y.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
6694
6722
|
if (!_r[ve + Bt]) {
|
|
6695
|
-
var
|
|
6723
|
+
var Os = Y.length > 0 ? "{" + Y.join(": ..., ") + ": ...}" : "{}";
|
|
6696
6724
|
m(`A props object containing a "key" prop is being spread into JSX:
|
|
6697
6725
|
let props = %s;
|
|
6698
6726
|
<%s {...props} />
|
|
6699
6727
|
React keys must be passed directly to JSX without using spread:
|
|
6700
6728
|
let props = %s;
|
|
6701
|
-
<%s key={someKey} {...props} />`, Bt, ve,
|
|
6729
|
+
<%s key={someKey} {...props} />`, Bt, ve, Os, ve), _r[ve + Bt] = !0;
|
|
6702
6730
|
}
|
|
6703
6731
|
}
|
|
6704
|
-
return h === i ?
|
|
6732
|
+
return h === i ? Ts(L) : gs(L), L;
|
|
6705
6733
|
}
|
|
6706
6734
|
}
|
|
6707
|
-
function
|
|
6735
|
+
function ws(h, _, v) {
|
|
6708
6736
|
return gr(h, _, v, !0);
|
|
6709
6737
|
}
|
|
6710
|
-
function
|
|
6738
|
+
function ms(h, _, v) {
|
|
6711
6739
|
return gr(h, _, v, !1);
|
|
6712
6740
|
}
|
|
6713
|
-
var
|
|
6714
|
-
Ye.Fragment = i, Ye.jsx =
|
|
6741
|
+
var vs = ms, Ss = ws;
|
|
6742
|
+
Ye.Fragment = i, Ye.jsx = vs, Ye.jsxs = Ss;
|
|
6715
6743
|
}(), Ye;
|
|
6716
6744
|
}
|
|
6717
|
-
var
|
|
6718
|
-
|
|
6745
|
+
var yc = {};
|
|
6746
|
+
yc.NODE_ENV === "production" ? Sn.exports = hc() : Sn.exports = pc();
|
|
6719
6747
|
var z = Sn.exports;
|
|
6720
|
-
const
|
|
6748
|
+
const bc = {
|
|
6721
6749
|
isLoading: !0,
|
|
6722
6750
|
data: void 0,
|
|
6723
6751
|
pageInfo: void 0,
|
|
6724
6752
|
error: void 0
|
|
6725
6753
|
};
|
|
6726
|
-
function
|
|
6754
|
+
function ni(t) {
|
|
6727
6755
|
return Object.assign({ isLoading: !t, data: void 0, pageInfo: void 0, error: void 0 }, t || {});
|
|
6728
6756
|
}
|
|
6729
|
-
function
|
|
6757
|
+
function _c(t, e, n) {
|
|
6730
6758
|
e && n && "ruleParams" in n && (e = Object.assign({ $$ruleParams: n.ruleParams }, e));
|
|
6731
|
-
const r = e ?
|
|
6732
|
-
(u) => (s.current =
|
|
6759
|
+
const r = e ? uc(e) : null, i = V(r), s = At(ni(t._reactor.getPreviousResult(r))), o = ge(
|
|
6760
|
+
(u) => (s.current = ni(t._reactor.getPreviousResult(r)), r ? t.subscribeQuery(r, (d) => {
|
|
6733
6761
|
s.current = Object.assign({ isLoading: !d, data: void 0, pageInfo: void 0, error: void 0 }, d), u();
|
|
6734
6762
|
}) : () => {
|
|
6735
6763
|
}),
|
|
6736
6764
|
// Build a new subscribe function if the query changes
|
|
6737
6765
|
[i]
|
|
6738
6766
|
);
|
|
6739
|
-
return { state: nn(o, () => s.current, () =>
|
|
6767
|
+
return { state: nn(o, () => s.current, () => bc), query: r };
|
|
6740
6768
|
}
|
|
6741
|
-
function
|
|
6769
|
+
function gc() {
|
|
6742
6770
|
const t = At(null);
|
|
6743
6771
|
je(() => {
|
|
6744
6772
|
n();
|
|
@@ -6751,13 +6779,13 @@ function bc() {
|
|
|
6751
6779
|
}
|
|
6752
6780
|
return { set: e, clear: n };
|
|
6753
6781
|
}
|
|
6754
|
-
const
|
|
6755
|
-
function
|
|
6782
|
+
const Tc = 1e3;
|
|
6783
|
+
function wc(t, e, n) {
|
|
6756
6784
|
je(() => t.core._reactor.subscribeTopic(t.id, e, (i, s) => {
|
|
6757
6785
|
n(i, s);
|
|
6758
6786
|
}), [t.id, e]);
|
|
6759
6787
|
}
|
|
6760
|
-
function
|
|
6788
|
+
function mc(t, e) {
|
|
6761
6789
|
return je(() => t.core._reactor.joinRoom(t.id), [t.id]), ge((r) => {
|
|
6762
6790
|
t.core._reactor.publishTopic({
|
|
6763
6791
|
roomType: t.type,
|
|
@@ -6767,9 +6795,9 @@ function Tc(t, e) {
|
|
|
6767
6795
|
});
|
|
6768
6796
|
}, [t.id, e]);
|
|
6769
6797
|
}
|
|
6770
|
-
function
|
|
6798
|
+
function vc(t, e = {}) {
|
|
6771
6799
|
var n, r;
|
|
6772
|
-
const [i, s] =
|
|
6800
|
+
const [i, s] = ci(() => {
|
|
6773
6801
|
var u;
|
|
6774
6802
|
return (u = t.core._reactor.getPresence(t.type, t.id, e)) !== null && u !== void 0 ? u : {
|
|
6775
6803
|
peers: {},
|
|
@@ -6784,11 +6812,11 @@ function wc(t, e = {}) {
|
|
|
6784
6812
|
}, [t.type, t.id]);
|
|
6785
6813
|
return rn(() => Object.assign(Object.assign({}, i), { publishPresence: o }), [i, o]);
|
|
6786
6814
|
}
|
|
6787
|
-
function
|
|
6815
|
+
function Sc(t, e, n) {
|
|
6788
6816
|
je(() => t.core._reactor.joinRoom(t.id, e), [t.id]), je(() => t.core._reactor.publishPresence(t.type, t.id, e), [t.type, t.id, n ?? JSON.stringify(e)]);
|
|
6789
6817
|
}
|
|
6790
|
-
function
|
|
6791
|
-
const r =
|
|
6818
|
+
function Oc(t, e, n = {}) {
|
|
6819
|
+
const r = gc(), i = Oe.usePresence(t, {
|
|
6792
6820
|
keys: [e]
|
|
6793
6821
|
}), s = rn(() => {
|
|
6794
6822
|
var d;
|
|
@@ -6798,7 +6826,7 @@ function vc(t, e, n = {}) {
|
|
|
6798
6826
|
var f;
|
|
6799
6827
|
t.core._reactor.publishPresence(t.type, t.id, {
|
|
6800
6828
|
[e]: d
|
|
6801
|
-
}), d && ((n == null ? void 0 : n.timeout) === null || (n == null ? void 0 : n.timeout) === 0 || r.set((f = n == null ? void 0 : n.timeout) !== null && f !== void 0 ? f :
|
|
6829
|
+
}), d && ((n == null ? void 0 : n.timeout) === null || (n == null ? void 0 : n.timeout) === 0 || r.set((f = n == null ? void 0 : n.timeout) !== null && f !== void 0 ? f : Tc, () => {
|
|
6802
6830
|
t.core._reactor.publishPresence(t.type, t.id, {
|
|
6803
6831
|
[e]: null
|
|
6804
6832
|
});
|
|
@@ -6816,20 +6844,20 @@ function vc(t, e, n = {}) {
|
|
|
6816
6844
|
};
|
|
6817
6845
|
}
|
|
6818
6846
|
const Oe = {
|
|
6819
|
-
useTopicEffect:
|
|
6820
|
-
usePublishTopic:
|
|
6821
|
-
usePresence:
|
|
6822
|
-
useSyncPresence:
|
|
6823
|
-
useTypingIndicator:
|
|
6847
|
+
useTopicEffect: wc,
|
|
6848
|
+
usePublishTopic: mc,
|
|
6849
|
+
usePresence: vc,
|
|
6850
|
+
useSyncPresence: Sc,
|
|
6851
|
+
useTypingIndicator: Oc
|
|
6824
6852
|
};
|
|
6825
|
-
class
|
|
6853
|
+
class Ec {
|
|
6826
6854
|
constructor(e, n, r) {
|
|
6827
6855
|
this.useTopicEffect = (i, s) => {
|
|
6828
6856
|
Oe.useTopicEffect(this, i, s);
|
|
6829
6857
|
}, this.usePublishTopic = (i) => Oe.usePublishTopic(this, i), this.usePresence = (i = {}) => Oe.usePresence(this, i), this.useSyncPresence = (i, s) => Oe.useSyncPresence(this, i, s), this.useTypingIndicator = (i, s = {}) => Oe.useTypingIndicator(this, i, s), this.core = e, this._core = this.core, this.type = n, this.id = r;
|
|
6830
6858
|
}
|
|
6831
6859
|
}
|
|
6832
|
-
var
|
|
6860
|
+
var Ac = function(t, e, n, r) {
|
|
6833
6861
|
function i(s) {
|
|
6834
6862
|
return s instanceof n ? s : new n(function(o) {
|
|
6835
6863
|
o(s);
|
|
@@ -6856,26 +6884,26 @@ var Oc = function(t, e, n, r) {
|
|
|
6856
6884
|
c((r = r.apply(t, e || [])).next());
|
|
6857
6885
|
});
|
|
6858
6886
|
};
|
|
6859
|
-
const
|
|
6887
|
+
const kc = {
|
|
6860
6888
|
isLoading: !0,
|
|
6861
6889
|
user: void 0,
|
|
6862
6890
|
error: void 0
|
|
6863
6891
|
};
|
|
6864
|
-
class
|
|
6892
|
+
class jc {
|
|
6865
6893
|
constructor(e, n) {
|
|
6866
6894
|
this.tx = Vn(), this.getLocalId = (r) => this.core.getLocalId(r), this.useLocalId = (r) => {
|
|
6867
|
-
const [i, s] =
|
|
6895
|
+
const [i, s] = ci(null);
|
|
6868
6896
|
return je(() => {
|
|
6869
|
-
|
|
6897
|
+
Ac(this, void 0, void 0, function* () {
|
|
6870
6898
|
const a = yield this.getLocalId(r);
|
|
6871
6899
|
s(a);
|
|
6872
6900
|
});
|
|
6873
6901
|
}, [r]), i;
|
|
6874
|
-
}, this.rooms = Oe, this.transact = (r) => this.core.transact(r), this.useQuery = (r, i) =>
|
|
6902
|
+
}, this.rooms = Oe, this.transact = (r) => this.core.transact(r), this.useQuery = (r, i) => _c(this.core, r, i).state, this.useAuth = () => {
|
|
6875
6903
|
const r = At(this.core._reactor._currentUserCached), i = ge((o) => this.core.subscribeAuth((u) => {
|
|
6876
6904
|
r.current = Object.assign({ isLoading: !1 }, u), o();
|
|
6877
6905
|
}), []);
|
|
6878
|
-
return nn(i, () => r.current, () =>
|
|
6906
|
+
return nn(i, () => r.current, () => kc);
|
|
6879
6907
|
}, this.useUser = () => {
|
|
6880
6908
|
const { user: r } = this.useAuth();
|
|
6881
6909
|
if (!r)
|
|
@@ -6897,7 +6925,7 @@ class Ac {
|
|
|
6897
6925
|
}, this.SignedOut = ({ children: r }) => {
|
|
6898
6926
|
const i = this.useAuth();
|
|
6899
6927
|
return i.isLoading || i.error || i.user ? null : z.jsx(z.Fragment, { children: r });
|
|
6900
|
-
}, this.core =
|
|
6928
|
+
}, this.core = fc(
|
|
6901
6929
|
e,
|
|
6902
6930
|
// @ts-expect-error because TS can't resolve subclass statics
|
|
6903
6931
|
this.constructor.Storage,
|
|
@@ -6921,7 +6949,7 @@ class Ac {
|
|
|
6921
6949
|
* const { peers } = db.rooms.usePresence(room);
|
|
6922
6950
|
*/
|
|
6923
6951
|
room(e = "_defaultRoomType", n = "_defaultRoomId") {
|
|
6924
|
-
return new
|
|
6952
|
+
return new Ec(this.core, e, n);
|
|
6925
6953
|
}
|
|
6926
6954
|
/**
|
|
6927
6955
|
* One time query for the logged in state. This is useful
|
|
@@ -6937,14 +6965,14 @@ class Ac {
|
|
|
6937
6965
|
return this.core.getAuth();
|
|
6938
6966
|
}
|
|
6939
6967
|
}
|
|
6940
|
-
class
|
|
6968
|
+
class ri extends Error {
|
|
6941
6969
|
constructor(e, n) {
|
|
6942
6970
|
super(e), this.name = "ParseError", this.type = n.type, this.field = n.field, this.value = n.value, this.line = n.line;
|
|
6943
6971
|
}
|
|
6944
6972
|
}
|
|
6945
6973
|
function tn(t) {
|
|
6946
6974
|
}
|
|
6947
|
-
function
|
|
6975
|
+
function Cc(t) {
|
|
6948
6976
|
if (typeof t == "function")
|
|
6949
6977
|
throw new TypeError(
|
|
6950
6978
|
"`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?"
|
|
@@ -6952,7 +6980,7 @@ function kc(t) {
|
|
|
6952
6980
|
const { onEvent: e = tn, onError: n = tn, onRetry: r = tn, onComment: i } = t;
|
|
6953
6981
|
let s = "", o = !0, a, u = "", c = "";
|
|
6954
6982
|
function d(b) {
|
|
6955
|
-
const g = o ? b.replace(/^\xEF\xBB\xBF/, "") : b, [w, T] =
|
|
6983
|
+
const g = o ? b.replace(/^\xEF\xBB\xBF/, "") : b, [w, T] = Pc(`${s}${g}`);
|
|
6956
6984
|
for (const m of w)
|
|
6957
6985
|
f(m);
|
|
6958
6986
|
s = T, o = !1;
|
|
@@ -6988,7 +7016,7 @@ function kc(t) {
|
|
|
6988
7016
|
break;
|
|
6989
7017
|
case "retry":
|
|
6990
7018
|
/^\d+$/.test(g) ? r(parseInt(g, 10)) : n(
|
|
6991
|
-
new
|
|
7019
|
+
new ri(`Invalid \`retry\` value: "${g}"`, {
|
|
6992
7020
|
type: "invalid-retry",
|
|
6993
7021
|
value: g,
|
|
6994
7022
|
line: w
|
|
@@ -6997,7 +7025,7 @@ function kc(t) {
|
|
|
6997
7025
|
break;
|
|
6998
7026
|
default:
|
|
6999
7027
|
n(
|
|
7000
|
-
new
|
|
7028
|
+
new ri(
|
|
7001
7029
|
`Unknown field "${b.length > 20 ? `${b.slice(0, 20)}…` : b}"`,
|
|
7002
7030
|
{ type: "unknown-field", field: b, value: g, line: w }
|
|
7003
7031
|
)
|
|
@@ -7020,7 +7048,7 @@ function kc(t) {
|
|
|
7020
7048
|
}
|
|
7021
7049
|
return { feed: d, reset: y };
|
|
7022
7050
|
}
|
|
7023
|
-
function
|
|
7051
|
+
function Pc(t) {
|
|
7024
7052
|
const e = [];
|
|
7025
7053
|
let n = "", r = 0;
|
|
7026
7054
|
for (; r < t.length; ) {
|
|
@@ -7038,7 +7066,7 @@ function jc(t) {
|
|
|
7038
7066
|
}
|
|
7039
7067
|
return [e, n];
|
|
7040
7068
|
}
|
|
7041
|
-
class
|
|
7069
|
+
class ii extends Event {
|
|
7042
7070
|
/**
|
|
7043
7071
|
* Constructs a new `ErrorEvent` instance. This is typically not called directly,
|
|
7044
7072
|
* but rather emitted by the `EventSource` object when an error occurs.
|
|
@@ -7063,7 +7091,7 @@ class ri extends Event {
|
|
|
7063
7091
|
* @returns A string representation of the error
|
|
7064
7092
|
*/
|
|
7065
7093
|
[Symbol.for("nodejs.util.inspect.custom")](e, n, r) {
|
|
7066
|
-
return r(
|
|
7094
|
+
return r(si(this), n);
|
|
7067
7095
|
}
|
|
7068
7096
|
/**
|
|
7069
7097
|
* Deno "hides" the `message` and `code` properties of the `ErrorEvent` instance,
|
|
@@ -7077,17 +7105,17 @@ class ri extends Event {
|
|
|
7077
7105
|
* @returns A string representation of the error
|
|
7078
7106
|
*/
|
|
7079
7107
|
[Symbol.for("Deno.customInspect")](e, n) {
|
|
7080
|
-
return e(
|
|
7108
|
+
return e(si(this), n);
|
|
7081
7109
|
}
|
|
7082
7110
|
}
|
|
7083
|
-
function
|
|
7111
|
+
function Ic(t) {
|
|
7084
7112
|
const e = globalThis.DOMException;
|
|
7085
7113
|
return typeof e == "function" ? new e(t, "SyntaxError") : new SyntaxError(t);
|
|
7086
7114
|
}
|
|
7087
7115
|
function On(t) {
|
|
7088
7116
|
return t instanceof Error ? "errors" in t && Array.isArray(t.errors) ? t.errors.map(On).join(", ") : "cause" in t && t.cause instanceof Error ? `${t}: ${On(t.cause)}` : t.message : `${t}`;
|
|
7089
7117
|
}
|
|
7090
|
-
function
|
|
7118
|
+
function si(t) {
|
|
7091
7119
|
return {
|
|
7092
7120
|
type: t.type,
|
|
7093
7121
|
message: t.message,
|
|
@@ -7097,9 +7125,9 @@ function ii(t) {
|
|
|
7097
7125
|
timeStamp: t.timeStamp
|
|
7098
7126
|
};
|
|
7099
7127
|
}
|
|
7100
|
-
var
|
|
7128
|
+
var Zi = (t) => {
|
|
7101
7129
|
throw TypeError(t);
|
|
7102
|
-
}, Qn = (t, e, n) => e.has(t) ||
|
|
7130
|
+
}, Qn = (t, e, n) => e.has(t) || Zi("Cannot " + n), A = (t, e, n) => (Qn(t, e, "read from private field"), n ? n.call(t) : e.get(t)), N = (t, e, n) => e.has(t) ? Zi("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, n), $ = (t, e, n, r) => (Qn(t, e, "write to private field"), e.set(t, n), n), he = (t, e, n) => (Qn(t, e, "access private method"), n), J, Ee, xe, Ot, Mt, it, Ue, st, _e, $e, Fe, De, et, se, En, An, kn, oi, jn, Cn, tt, Pn, In;
|
|
7103
7131
|
class Et extends EventTarget {
|
|
7104
7132
|
constructor(e, n) {
|
|
7105
7133
|
var r, i;
|
|
@@ -7152,13 +7180,13 @@ class Et extends EventTarget {
|
|
|
7152
7180
|
if (e instanceof URL)
|
|
7153
7181
|
$(this, Ee, e);
|
|
7154
7182
|
else if (typeof e == "string")
|
|
7155
|
-
$(this, Ee, new URL(e,
|
|
7183
|
+
$(this, Ee, new URL(e, Mc()));
|
|
7156
7184
|
else
|
|
7157
7185
|
throw new Error("Invalid URL");
|
|
7158
7186
|
} catch {
|
|
7159
|
-
throw
|
|
7187
|
+
throw Ic("An invalid or illegal string was specified");
|
|
7160
7188
|
}
|
|
7161
|
-
$(this, $e,
|
|
7189
|
+
$(this, $e, Cc({
|
|
7162
7190
|
onEvent: A(this, jn),
|
|
7163
7191
|
onRetry: A(this, Cn)
|
|
7164
7192
|
})), $(this, J, this.CONNECTING), $(this, it, 3e3), $(this, Mt, (r = n == null ? void 0 : n.fetch) != null ? r : globalThis.fetch), $(this, Ot, (i = n == null ? void 0 : n.withCredentials) != null ? i : !1), he(this, se, En).call(this);
|
|
@@ -7240,14 +7268,14 @@ J = /* @__PURE__ */ new WeakMap(), Ee = /* @__PURE__ */ new WeakMap(), xe = /* @
|
|
|
7240
7268
|
* @internal
|
|
7241
7269
|
*/
|
|
7242
7270
|
En = function() {
|
|
7243
|
-
$(this, J, this.CONNECTING), $(this, _e, new AbortController()), A(this, Mt)(A(this, Ee), he(this, se,
|
|
7271
|
+
$(this, J, this.CONNECTING), $(this, _e, new AbortController()), A(this, Mt)(A(this, Ee), he(this, se, oi).call(this)).then(A(this, An)).catch(A(this, kn));
|
|
7244
7272
|
}, An = /* @__PURE__ */ new WeakMap(), kn = /* @__PURE__ */ new WeakMap(), /**
|
|
7245
7273
|
* Get request options for the `fetch()` request
|
|
7246
7274
|
*
|
|
7247
7275
|
* @returns The request options
|
|
7248
7276
|
* @internal
|
|
7249
7277
|
*/
|
|
7250
|
-
|
|
7278
|
+
oi = function() {
|
|
7251
7279
|
var t;
|
|
7252
7280
|
const e = {
|
|
7253
7281
|
// [spec] Let `corsAttributeState` be `Anonymous`…
|
|
@@ -7269,7 +7297,7 @@ si = function() {
|
|
|
7269
7297
|
tt = function(t, e) {
|
|
7270
7298
|
var n;
|
|
7271
7299
|
A(this, J) !== this.CLOSED && $(this, J, this.CLOSED);
|
|
7272
|
-
const r = new
|
|
7300
|
+
const r = new ii("error", { code: e, message: t });
|
|
7273
7301
|
(n = A(this, Fe)) == null || n.call(this, r), this.dispatchEvent(r);
|
|
7274
7302
|
}, /**
|
|
7275
7303
|
* Schedules a reconnection attempt against the EventSource endpoint.
|
|
@@ -7283,7 +7311,7 @@ Pn = function(t, e) {
|
|
|
7283
7311
|
if (A(this, J) === this.CLOSED)
|
|
7284
7312
|
return;
|
|
7285
7313
|
$(this, J, this.CONNECTING);
|
|
7286
|
-
const r = new
|
|
7314
|
+
const r = new ii("error", { code: e, message: t });
|
|
7287
7315
|
(n = A(this, Fe)) == null || n.call(this, r), this.dispatchEvent(r), $(this, Ue, setTimeout(A(this, In), A(this, it)));
|
|
7288
7316
|
}, In = /* @__PURE__ */ new WeakMap(), /**
|
|
7289
7317
|
* ReadyState representing an EventSource currently trying to connect
|
|
@@ -7301,15 +7329,15 @@ Et.OPEN = 1, /**
|
|
|
7301
7329
|
* @public
|
|
7302
7330
|
*/
|
|
7303
7331
|
Et.CLOSED = 2;
|
|
7304
|
-
function
|
|
7332
|
+
function Mc() {
|
|
7305
7333
|
const t = "document" in globalThis ? globalThis.document : void 0;
|
|
7306
7334
|
return t && typeof t == "object" && "baseURI" in t && typeof t.baseURI == "string" ? t.baseURI : void 0;
|
|
7307
7335
|
}
|
|
7308
|
-
const Hn = class Hn extends
|
|
7336
|
+
const Hn = class Hn extends jc {
|
|
7309
7337
|
};
|
|
7310
7338
|
Hn.EventSourceImpl = Et;
|
|
7311
7339
|
let Mn = Hn;
|
|
7312
|
-
function
|
|
7340
|
+
function Rc(t) {
|
|
7313
7341
|
return new Mn(
|
|
7314
7342
|
t,
|
|
7315
7343
|
{
|
|
@@ -7317,8 +7345,8 @@ function Ic(t) {
|
|
|
7317
7345
|
}
|
|
7318
7346
|
);
|
|
7319
7347
|
}
|
|
7320
|
-
const
|
|
7321
|
-
function
|
|
7348
|
+
const Kc = Rc;
|
|
7349
|
+
function qc({
|
|
7322
7350
|
as: t = "div",
|
|
7323
7351
|
spaceId: e,
|
|
7324
7352
|
room: n,
|
|
@@ -7370,7 +7398,7 @@ function Nc({
|
|
|
7370
7398
|
[d]: void 0
|
|
7371
7399
|
});
|
|
7372
7400
|
}
|
|
7373
|
-
return
|
|
7401
|
+
return As(
|
|
7374
7402
|
t,
|
|
7375
7403
|
{
|
|
7376
7404
|
onMouseMove: y,
|
|
@@ -7389,9 +7417,9 @@ function Nc({
|
|
|
7389
7417
|
"div",
|
|
7390
7418
|
{
|
|
7391
7419
|
style: {
|
|
7392
|
-
...
|
|
7393
|
-
|
|
7394
|
-
zIndex: c !== void 0 ? c :
|
|
7420
|
+
...ai,
|
|
7421
|
+
...$c,
|
|
7422
|
+
zIndex: c !== void 0 ? c : Dc
|
|
7395
7423
|
},
|
|
7396
7424
|
children: Object.entries(f.peers).map(([T, m]) => {
|
|
7397
7425
|
const E = m[d];
|
|
@@ -7399,7 +7427,7 @@ function Nc({
|
|
|
7399
7427
|
"div",
|
|
7400
7428
|
{
|
|
7401
7429
|
style: {
|
|
7402
|
-
...
|
|
7430
|
+
...ai,
|
|
7403
7431
|
transform: `translate(${E.xPercent}%, ${E.yPercent}%)`,
|
|
7404
7432
|
transformOrigin: "0 0",
|
|
7405
7433
|
transition: "transform 100ms"
|
|
@@ -7407,7 +7435,7 @@ function Nc({
|
|
|
7407
7435
|
children: a ? a({
|
|
7408
7436
|
color: E.color,
|
|
7409
7437
|
presence: l.peers[T]
|
|
7410
|
-
}) : /* @__PURE__ */ z.jsx(
|
|
7438
|
+
}) : /* @__PURE__ */ z.jsx(xc, { ...E })
|
|
7411
7439
|
},
|
|
7412
7440
|
T
|
|
7413
7441
|
) : null;
|
|
@@ -7418,7 +7446,7 @@ function Nc({
|
|
|
7418
7446
|
]
|
|
7419
7447
|
);
|
|
7420
7448
|
}
|
|
7421
|
-
function
|
|
7449
|
+
function xc({ color: t }) {
|
|
7422
7450
|
const n = t || "black";
|
|
7423
7451
|
return /* @__PURE__ */ z.jsxs(
|
|
7424
7452
|
"svg",
|
|
@@ -7465,27 +7493,27 @@ function Mc({ color: t }) {
|
|
|
7465
7493
|
}
|
|
7466
7494
|
);
|
|
7467
7495
|
}
|
|
7468
|
-
const
|
|
7496
|
+
const ai = {
|
|
7469
7497
|
position: "absolute",
|
|
7470
7498
|
top: 0,
|
|
7471
7499
|
left: 0,
|
|
7472
7500
|
bottom: 0,
|
|
7473
7501
|
right: 0
|
|
7474
|
-
},
|
|
7502
|
+
}, $c = {
|
|
7475
7503
|
overflow: "hidden",
|
|
7476
7504
|
pointerEvents: "none",
|
|
7477
7505
|
userSelect: "none"
|
|
7478
|
-
},
|
|
7506
|
+
}, Dc = 99999;
|
|
7479
7507
|
export {
|
|
7480
|
-
|
|
7508
|
+
qc as Cursors,
|
|
7481
7509
|
$t as InstantAPIError,
|
|
7482
|
-
|
|
7510
|
+
jc as InstantReactAbstractDatabase,
|
|
7483
7511
|
Mn as InstantReactWebDatabase,
|
|
7484
7512
|
Se as SyncTableCallbackEventType,
|
|
7485
|
-
|
|
7513
|
+
Nc as i,
|
|
7486
7514
|
K as id,
|
|
7487
|
-
|
|
7488
|
-
|
|
7489
|
-
|
|
7490
|
-
|
|
7515
|
+
Rc as init,
|
|
7516
|
+
Kc as init_experimental,
|
|
7517
|
+
Lc as lookup,
|
|
7518
|
+
Fc as tx
|
|
7491
7519
|
};
|