@instantdb/react 1.0.50-branch-log-dashboard-login-code.29876046282.1 → 1.0.50
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/commonjs/index.d.ts +2 -2
- package/dist/commonjs/index.d.ts.map +1 -1
- package/dist/commonjs/index.js.map +1 -1
- package/dist/esm/index.d.ts +2 -2
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/standalone/index.js +1136 -1214
- package/dist/standalone/index.umd.cjs +15 -15
- package/package.json +4 -4
- package/src/index.ts +0 -2
package/dist/standalone/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
var $i = Object.defineProperty;
|
|
2
2
|
var Di = (n, e, t) => e in n ? $i(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
|
|
3
3
|
var p = (n, e, t) => Di(n, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
-
import ys, { useRef as
|
|
5
|
-
function
|
|
6
|
-
const e =
|
|
4
|
+
import ys, { useRef as $e, useCallback as Me, useSyncExternalStore as Vt, useEffect as We, useMemo as Sn, useState as bs, createElement as Ui } from "react";
|
|
5
|
+
function ce(n) {
|
|
6
|
+
const e = Ut(n);
|
|
7
7
|
let t = 3735928559 ^ e.length, r = 1103547991 ^ e.length;
|
|
8
8
|
for (let s = 0; s < e.length; s++) {
|
|
9
9
|
const i = e.charCodeAt(s);
|
|
@@ -11,13 +11,13 @@ function ue(n) {
|
|
|
11
11
|
}
|
|
12
12
|
return t = Math.imul(t ^ t >>> 16, 2246822507) ^ Math.imul(r ^ r >>> 13, 3266489909), r = Math.imul(r ^ r >>> 16, 2246822507) ^ Math.imul(t ^ t >>> 13, 3266489909), `${(r >>> 0).toString(16).padStart(8, "0")}${(t >>> 0).toString(16).padStart(8, "0")}`;
|
|
13
13
|
}
|
|
14
|
-
function
|
|
14
|
+
function Ut(n) {
|
|
15
15
|
if (n && typeof n.toJSON == "function")
|
|
16
|
-
return
|
|
16
|
+
return Ut(n.toJSON());
|
|
17
17
|
if (Array.isArray(n)) {
|
|
18
18
|
let e = "[";
|
|
19
19
|
for (let t = 0; t < n.length; t++)
|
|
20
|
-
t > 0 && (e += ","), e +=
|
|
20
|
+
t > 0 && (e += ","), e += Ut(n[t]);
|
|
21
21
|
return e + "]";
|
|
22
22
|
}
|
|
23
23
|
if (n && typeof n == "object") {
|
|
@@ -26,7 +26,7 @@ function Lt(n) {
|
|
|
26
26
|
let t = "{", r = !0;
|
|
27
27
|
for (let s = 0; s < e.length; s++) {
|
|
28
28
|
const i = e[s], o = n[i];
|
|
29
|
-
o !== void 0 && (r || (t += ","), t += JSON.stringify(i) + ":" +
|
|
29
|
+
o !== void 0 && (r || (t += ","), t += JSON.stringify(i) + ":" + Ut(o), r = !1);
|
|
30
30
|
}
|
|
31
31
|
return t + "}";
|
|
32
32
|
}
|
|
@@ -77,11 +77,11 @@ const te = {
|
|
|
77
77
|
Remove: "remove",
|
|
78
78
|
Replace: "replace",
|
|
79
79
|
Add: "add"
|
|
80
|
-
}, gs = Symbol.for("__MUTATIVE_PROXY_DRAFT__"), Li = Symbol("__MUTATIVE_RAW_RETURN_SYMBOL__"),
|
|
80
|
+
}, gs = Symbol.for("__MUTATIVE_PROXY_DRAFT__"), Li = Symbol("__MUTATIVE_RAW_RETURN_SYMBOL__"), Lt = Symbol.iterator, we = {
|
|
81
81
|
mutable: "mutable",
|
|
82
82
|
immutable: "immutable"
|
|
83
83
|
}, Gn = {};
|
|
84
|
-
function
|
|
84
|
+
function wt(n, e) {
|
|
85
85
|
return n instanceof Map ? n.has(e) : Object.prototype.hasOwnProperty.call(n, e);
|
|
86
86
|
}
|
|
87
87
|
function Er(n, e) {
|
|
@@ -106,17 +106,17 @@ function me(n) {
|
|
|
106
106
|
return (e = n.copy) !== null && e !== void 0 ? e : n.original;
|
|
107
107
|
}
|
|
108
108
|
function qe(n) {
|
|
109
|
-
return !!
|
|
109
|
+
return !!D(n);
|
|
110
110
|
}
|
|
111
|
-
function
|
|
111
|
+
function D(n) {
|
|
112
112
|
return typeof n != "object" ? null : n == null ? void 0 : n[gs];
|
|
113
113
|
}
|
|
114
114
|
function Yn(n) {
|
|
115
115
|
var e;
|
|
116
|
-
const t =
|
|
116
|
+
const t = D(n);
|
|
117
117
|
return t ? (e = t.copy) !== null && e !== void 0 ? e : t.original : n;
|
|
118
118
|
}
|
|
119
|
-
function
|
|
119
|
+
function ke(n, e) {
|
|
120
120
|
if (!n || typeof n != "object")
|
|
121
121
|
return !1;
|
|
122
122
|
let t;
|
|
@@ -124,11 +124,11 @@ function Ae(n, e) {
|
|
|
124
124
|
}
|
|
125
125
|
function _s(n, e = []) {
|
|
126
126
|
if (Object.hasOwnProperty.call(n, "key")) {
|
|
127
|
-
const t = n.parent.copy, r =
|
|
127
|
+
const t = n.parent.copy, r = D(je(t, n.key));
|
|
128
128
|
if (r !== null && (r == null ? void 0 : r.original) !== n.original)
|
|
129
129
|
return null;
|
|
130
130
|
const s = n.parent.type === 3, i = s ? Array.from(n.parent.setMap.keys()).indexOf(n.key) : n.key;
|
|
131
|
-
if (!(s && t.size > i ||
|
|
131
|
+
if (!(s && t.size > i || wt(t, i)))
|
|
132
132
|
return null;
|
|
133
133
|
e.push(i);
|
|
134
134
|
}
|
|
@@ -145,17 +145,17 @@ function _s(n, e = []) {
|
|
|
145
145
|
function ze(n) {
|
|
146
146
|
return Array.isArray(n) ? 1 : n instanceof Map ? 2 : n instanceof Set ? 3 : 0;
|
|
147
147
|
}
|
|
148
|
-
function
|
|
148
|
+
function je(n, e) {
|
|
149
149
|
return ze(n) === 2 ? n.get(e) : n[e];
|
|
150
150
|
}
|
|
151
|
-
function
|
|
151
|
+
function Ot(n, e, t) {
|
|
152
152
|
ze(n) === 2 ? n.set(e, t) : n[e] = t;
|
|
153
153
|
}
|
|
154
154
|
function fn(n, e) {
|
|
155
|
-
const t =
|
|
155
|
+
const t = D(n);
|
|
156
156
|
return (t ? me(t) : n)[e];
|
|
157
157
|
}
|
|
158
|
-
function
|
|
158
|
+
function Re(n, e) {
|
|
159
159
|
return n === e ? n !== 0 || 1 / n === 1 / e : n !== n && e !== e;
|
|
160
160
|
}
|
|
161
161
|
function Tn(n) {
|
|
@@ -172,7 +172,7 @@ function Ne(n, e) {
|
|
|
172
172
|
function Fi(n, e) {
|
|
173
173
|
for (let t = 0; t < e.length - 1; t += 1) {
|
|
174
174
|
const r = e[t];
|
|
175
|
-
if (n =
|
|
175
|
+
if (n = je(ze(n) === 3 ? Array.from(n) : n, r), typeof n != "object")
|
|
176
176
|
throw new Error(`Cannot resolve patch at '${e.join("/")}'.`);
|
|
177
177
|
}
|
|
178
178
|
return n;
|
|
@@ -233,7 +233,7 @@ function de(n) {
|
|
|
233
233
|
n.copy || (n.copy = ms(n.original, n.options));
|
|
234
234
|
}
|
|
235
235
|
function ht(n) {
|
|
236
|
-
if (!
|
|
236
|
+
if (!ke(n))
|
|
237
237
|
return Yn(n);
|
|
238
238
|
if (Array.isArray(n))
|
|
239
239
|
return n.map(ht);
|
|
@@ -261,12 +261,12 @@ function ht(n) {
|
|
|
261
261
|
e[t] = ht(n[t]);
|
|
262
262
|
return e;
|
|
263
263
|
}
|
|
264
|
-
function
|
|
264
|
+
function Ft(n) {
|
|
265
265
|
return qe(n) ? ht(n) : n;
|
|
266
266
|
}
|
|
267
|
-
function
|
|
267
|
+
function Ie(n) {
|
|
268
268
|
var e;
|
|
269
|
-
n.assignedMap = (e = n.assignedMap) !== null && e !== void 0 ? e : /* @__PURE__ */ new Map(), n.operated || (n.operated = !0, n.parent &&
|
|
269
|
+
n.assignedMap = (e = n.assignedMap) !== null && e !== void 0 ? e : /* @__PURE__ */ new Map(), n.operated || (n.operated = !0, n.parent && Ie(n.parent));
|
|
270
270
|
}
|
|
271
271
|
function Or() {
|
|
272
272
|
throw new Error("Cannot modify frozen object");
|
|
@@ -331,16 +331,16 @@ function Zn(n, e) {
|
|
|
331
331
|
n.forEach((r, s) => e(s, r, n));
|
|
332
332
|
}
|
|
333
333
|
function ws(n, e, t) {
|
|
334
|
-
if (qe(n) || !
|
|
334
|
+
if (qe(n) || !ke(n, t) || e.has(n) || Object.isFrozen(n))
|
|
335
335
|
return;
|
|
336
336
|
const r = n instanceof Set, s = r ? /* @__PURE__ */ new Map() : void 0;
|
|
337
337
|
if (e.add(n), Zn(n, (i, o) => {
|
|
338
338
|
var a;
|
|
339
339
|
if (qe(o)) {
|
|
340
|
-
const c =
|
|
340
|
+
const c = D(o);
|
|
341
341
|
de(c);
|
|
342
342
|
const u = !((a = c.assignedMap) === null || a === void 0) && a.size || c.operated ? c.copy : c.original;
|
|
343
|
-
|
|
343
|
+
Ot(r ? s : n, i, u);
|
|
344
344
|
} else
|
|
345
345
|
ws(o, e, t);
|
|
346
346
|
}), s) {
|
|
@@ -352,7 +352,7 @@ function ws(n, e, t) {
|
|
|
352
352
|
}
|
|
353
353
|
function Wi(n, e) {
|
|
354
354
|
const t = n.type === 3 ? n.setMap : n.copy;
|
|
355
|
-
n.finalities.revoke.length > 1 && n.assignedMap.get(e) && t && ws(
|
|
355
|
+
n.finalities.revoke.length > 1 && n.assignedMap.get(e) && t && ws(je(t, e), n.finalities.handledSet, n.options);
|
|
356
356
|
}
|
|
357
357
|
function vn(n) {
|
|
358
358
|
n.type === 3 && n.copy && (n.copy.clear(), n.setMap.forEach((e) => {
|
|
@@ -369,17 +369,17 @@ function En(n, e, t, r) {
|
|
|
369
369
|
}
|
|
370
370
|
}
|
|
371
371
|
function Xn(n, e, t, r) {
|
|
372
|
-
const s =
|
|
372
|
+
const s = D(t);
|
|
373
373
|
s && (s.callbacks || (s.callbacks = []), s.callbacks.push((i, o) => {
|
|
374
374
|
var a;
|
|
375
375
|
const c = n.type === 3 ? n.setMap : n.copy;
|
|
376
|
-
if (je(
|
|
376
|
+
if (Re(je(c, e), t)) {
|
|
377
377
|
let u = s.original;
|
|
378
|
-
s.copy && (u = s.copy), vn(n), En(n, r, i, o), n.options.enableAutoFreeze && (n.options.updatedValues = (a = n.options.updatedValues) !== null && a !== void 0 ? a : /* @__PURE__ */ new WeakMap(), n.options.updatedValues.set(u, s.original)),
|
|
378
|
+
s.copy && (u = s.copy), vn(n), En(n, r, i, o), n.options.enableAutoFreeze && (n.options.updatedValues = (a = n.options.updatedValues) !== null && a !== void 0 ? a : /* @__PURE__ */ new WeakMap(), n.options.updatedValues.set(u, s.original)), Ot(c, e, u);
|
|
379
379
|
}
|
|
380
|
-
}), n.options.enableAutoFreeze && s.finalities !== n.finalities && (n.options.enableAutoFreeze = !1)),
|
|
380
|
+
}), n.options.enableAutoFreeze && s.finalities !== n.finalities && (n.options.enableAutoFreeze = !1)), ke(t, n.options) && n.finalities.draft.push(() => {
|
|
381
381
|
const i = n.type === 3 ? n.setMap : n.copy;
|
|
382
|
-
je(
|
|
382
|
+
Re(je(i, e), t) && Wi(n, e);
|
|
383
383
|
});
|
|
384
384
|
}
|
|
385
385
|
function qi(n, e, t, r, s) {
|
|
@@ -392,12 +392,12 @@ function qi(n, e, t, r, s) {
|
|
|
392
392
|
op: te.Replace,
|
|
393
393
|
path: f,
|
|
394
394
|
// If it is a draft, it needs to be deep cloned, and it may also be non-draft.
|
|
395
|
-
value:
|
|
395
|
+
value: Ft(c[u])
|
|
396
396
|
}), r.push({
|
|
397
397
|
op: te.Replace,
|
|
398
398
|
path: f,
|
|
399
399
|
// If it is a draft, it needs to be deep cloned, and it may also be non-draft.
|
|
400
|
-
value:
|
|
400
|
+
value: Ft(i[u])
|
|
401
401
|
});
|
|
402
402
|
}
|
|
403
403
|
for (let u = i.length; u < c.length; u += 1) {
|
|
@@ -406,7 +406,7 @@ function qi(n, e, t, r, s) {
|
|
|
406
406
|
op: te.Add,
|
|
407
407
|
path: f,
|
|
408
408
|
// If it is a draft, it needs to be deep cloned, and it may also be non-draft.
|
|
409
|
-
value:
|
|
409
|
+
value: Ft(c[u])
|
|
410
410
|
});
|
|
411
411
|
}
|
|
412
412
|
if (i.length < c.length) {
|
|
@@ -430,11 +430,11 @@ function qi(n, e, t, r, s) {
|
|
|
430
430
|
}
|
|
431
431
|
function zi({ original: n, copy: e, assignedMap: t }, r, s, i, o) {
|
|
432
432
|
t.forEach((a, c) => {
|
|
433
|
-
const u =
|
|
434
|
-
if (
|
|
433
|
+
const u = je(n, c), l = Ft(je(e, c)), f = a ? wt(n, c) ? te.Replace : te.Add : te.Remove;
|
|
434
|
+
if (Re(u, l) && f === te.Replace)
|
|
435
435
|
return;
|
|
436
|
-
const d = r.concat(c),
|
|
437
|
-
s.push(f === te.Remove ? { op: f, path:
|
|
436
|
+
const d = r.concat(c), y = Ne(d, o);
|
|
437
|
+
s.push(f === te.Remove ? { op: f, path: y } : { op: f, path: y, value: l }), i.push(f === te.Add ? { op: te.Remove, path: y } : f === te.Remove ? { op: te.Add, path: y, value: u } : { op: te.Replace, path: y, value: u });
|
|
438
438
|
});
|
|
439
439
|
}
|
|
440
440
|
function Vi({ original: n, copy: e }, t, r, s, i) {
|
|
@@ -469,7 +469,7 @@ function Vi({ original: n, copy: e }, t, r, s, i) {
|
|
|
469
469
|
o += 1;
|
|
470
470
|
});
|
|
471
471
|
}
|
|
472
|
-
function
|
|
472
|
+
function Et(n, e, t, r) {
|
|
473
473
|
const { pathAsArray: s = !0 } = n.options.enablePatches;
|
|
474
474
|
switch (n.type) {
|
|
475
475
|
case 0:
|
|
@@ -482,44 +482,44 @@ function Ot(n, e, t, r) {
|
|
|
482
482
|
}
|
|
483
483
|
}
|
|
484
484
|
const Qt = (n, e, t = !1) => {
|
|
485
|
-
if (typeof n == "object" && n !== null && (!
|
|
485
|
+
if (typeof n == "object" && n !== null && (!ke(n, e) || t))
|
|
486
486
|
throw new Error("Strict mode: Mutable data cannot be accessed directly, please use 'unsafe(callback)' wrap.");
|
|
487
487
|
}, On = {
|
|
488
488
|
get size() {
|
|
489
|
-
return me(
|
|
489
|
+
return me(D(this)).size;
|
|
490
490
|
},
|
|
491
491
|
has(n) {
|
|
492
|
-
return me(
|
|
492
|
+
return me(D(this)).has(n);
|
|
493
493
|
},
|
|
494
494
|
set(n, e) {
|
|
495
|
-
const t =
|
|
496
|
-
return (!r.has(n) || !
|
|
495
|
+
const t = D(this), r = me(t);
|
|
496
|
+
return (!r.has(n) || !Re(r.get(n), e)) && (de(t), Ie(t), t.assignedMap.set(n, !0), t.copy.set(n, e), Xn(t, n, e, Et)), this;
|
|
497
497
|
},
|
|
498
498
|
delete(n) {
|
|
499
499
|
if (!this.has(n))
|
|
500
500
|
return !1;
|
|
501
|
-
const e =
|
|
502
|
-
return de(e),
|
|
501
|
+
const e = D(this);
|
|
502
|
+
return de(e), Ie(e), e.original.has(n) ? e.assignedMap.set(n, !1) : e.assignedMap.delete(n), e.copy.delete(n), !0;
|
|
503
503
|
},
|
|
504
504
|
clear() {
|
|
505
|
-
const n =
|
|
505
|
+
const n = D(this);
|
|
506
506
|
if (this.size) {
|
|
507
|
-
de(n),
|
|
507
|
+
de(n), Ie(n), n.assignedMap = /* @__PURE__ */ new Map();
|
|
508
508
|
for (const [e] of n.original)
|
|
509
509
|
n.assignedMap.set(e, !1);
|
|
510
510
|
n.copy.clear();
|
|
511
511
|
}
|
|
512
512
|
},
|
|
513
513
|
forEach(n, e) {
|
|
514
|
-
const t =
|
|
514
|
+
const t = D(this);
|
|
515
515
|
me(t).forEach((r, s) => {
|
|
516
516
|
n.call(e, this.get(s), s, this);
|
|
517
517
|
});
|
|
518
518
|
},
|
|
519
519
|
get(n) {
|
|
520
520
|
var e, t;
|
|
521
|
-
const r =
|
|
522
|
-
if (r.options.strict && Qt(s, r.options, i), i || r.finalized || !
|
|
521
|
+
const r = D(this), s = me(r).get(n), i = ((t = (e = r.options).mark) === null || t === void 0 ? void 0 : t.call(e, s, we)) === we.mutable;
|
|
522
|
+
if (r.options.strict && Qt(s, r.options, i), i || r.finalized || !ke(s, r.options) || s !== r.original.get(n))
|
|
523
523
|
return s;
|
|
524
524
|
const o = Gn.createDraft({
|
|
525
525
|
original: s,
|
|
@@ -531,12 +531,12 @@ const Qt = (n, e, t = !1) => {
|
|
|
531
531
|
return de(r), r.copy.set(n, o), o;
|
|
532
532
|
},
|
|
533
533
|
keys() {
|
|
534
|
-
return me(
|
|
534
|
+
return me(D(this)).keys();
|
|
535
535
|
},
|
|
536
536
|
values() {
|
|
537
537
|
const n = this.keys();
|
|
538
538
|
return {
|
|
539
|
-
[
|
|
539
|
+
[Lt]: () => this.values(),
|
|
540
540
|
next: () => {
|
|
541
541
|
const e = n.next();
|
|
542
542
|
return e.done ? e : {
|
|
@@ -549,7 +549,7 @@ const Qt = (n, e, t = !1) => {
|
|
|
549
549
|
entries() {
|
|
550
550
|
const n = this.keys();
|
|
551
551
|
return {
|
|
552
|
-
[
|
|
552
|
+
[Lt]: () => this.entries(),
|
|
553
553
|
next: () => {
|
|
554
554
|
const e = n.next();
|
|
555
555
|
if (e.done)
|
|
@@ -562,18 +562,18 @@ const Qt = (n, e, t = !1) => {
|
|
|
562
562
|
}
|
|
563
563
|
};
|
|
564
564
|
},
|
|
565
|
-
[
|
|
565
|
+
[Lt]() {
|
|
566
566
|
return this.entries();
|
|
567
567
|
}
|
|
568
|
-
}, Qi = Reflect.ownKeys(On),
|
|
568
|
+
}, Qi = Reflect.ownKeys(On), kr = (n, e, { isValuesIterator: t }) => () => {
|
|
569
569
|
var r, s;
|
|
570
570
|
const i = e.next();
|
|
571
571
|
if (i.done)
|
|
572
572
|
return i;
|
|
573
573
|
const o = i.value;
|
|
574
574
|
let a = n.setMap.get(o);
|
|
575
|
-
const c =
|
|
576
|
-
if (n.options.strict && Qt(o, n.options, u), !u && !c &&
|
|
575
|
+
const c = D(a), u = ((s = (r = n.options).mark) === null || s === void 0 ? void 0 : s.call(r, a, we)) === we.mutable;
|
|
576
|
+
if (n.options.strict && Qt(o, n.options, u), !u && !c && ke(o, n.options) && !n.finalized && n.original.has(o)) {
|
|
577
577
|
const l = Gn.createDraft({
|
|
578
578
|
original: o,
|
|
579
579
|
parentDraft: n,
|
|
@@ -589,53 +589,53 @@ const Qt = (n, e, t = !1) => {
|
|
|
589
589
|
};
|
|
590
590
|
}, Bt = {
|
|
591
591
|
get size() {
|
|
592
|
-
return
|
|
592
|
+
return D(this).setMap.size;
|
|
593
593
|
},
|
|
594
594
|
has(n) {
|
|
595
|
-
const e =
|
|
595
|
+
const e = D(this);
|
|
596
596
|
if (e.setMap.has(n))
|
|
597
597
|
return !0;
|
|
598
598
|
de(e);
|
|
599
|
-
const t =
|
|
599
|
+
const t = D(n);
|
|
600
600
|
return !!(t && e.setMap.has(t.original));
|
|
601
601
|
},
|
|
602
602
|
add(n) {
|
|
603
|
-
const e =
|
|
604
|
-
return this.has(n) || (de(e),
|
|
603
|
+
const e = D(this);
|
|
604
|
+
return this.has(n) || (de(e), Ie(e), e.assignedMap.set(n, !0), e.setMap.set(n, n), Xn(e, n, n, Et)), this;
|
|
605
605
|
},
|
|
606
606
|
delete(n) {
|
|
607
607
|
if (!this.has(n))
|
|
608
608
|
return !1;
|
|
609
|
-
const e =
|
|
610
|
-
de(e),
|
|
611
|
-
const t =
|
|
609
|
+
const e = D(this);
|
|
610
|
+
de(e), Ie(e);
|
|
611
|
+
const t = D(n);
|
|
612
612
|
return t && e.setMap.has(t.original) ? (e.assignedMap.set(t.original, !1), e.setMap.delete(t.original)) : (!t && e.setMap.has(n) ? e.assignedMap.set(n, !1) : e.assignedMap.delete(n), e.setMap.delete(n));
|
|
613
613
|
},
|
|
614
614
|
clear() {
|
|
615
615
|
if (!this.size)
|
|
616
616
|
return;
|
|
617
|
-
const n =
|
|
618
|
-
de(n),
|
|
617
|
+
const n = D(this);
|
|
618
|
+
de(n), Ie(n);
|
|
619
619
|
for (const e of n.original)
|
|
620
620
|
n.assignedMap.set(e, !1);
|
|
621
621
|
n.setMap.clear();
|
|
622
622
|
},
|
|
623
623
|
values() {
|
|
624
|
-
const n =
|
|
624
|
+
const n = D(this);
|
|
625
625
|
de(n);
|
|
626
626
|
const e = n.setMap.keys();
|
|
627
627
|
return {
|
|
628
628
|
[Symbol.iterator]: () => this.values(),
|
|
629
|
-
next:
|
|
629
|
+
next: kr(n, e, { isValuesIterator: !0 })
|
|
630
630
|
};
|
|
631
631
|
},
|
|
632
632
|
entries() {
|
|
633
|
-
const n =
|
|
633
|
+
const n = D(this);
|
|
634
634
|
de(n);
|
|
635
635
|
const e = n.setMap.keys();
|
|
636
636
|
return {
|
|
637
637
|
[Symbol.iterator]: () => this.entries(),
|
|
638
|
-
next:
|
|
638
|
+
next: kr(n, e, {
|
|
639
639
|
isValuesIterator: !1
|
|
640
640
|
})
|
|
641
641
|
};
|
|
@@ -643,7 +643,7 @@ const Qt = (n, e, t = !1) => {
|
|
|
643
643
|
keys() {
|
|
644
644
|
return this.values();
|
|
645
645
|
},
|
|
646
|
-
[
|
|
646
|
+
[Lt]() {
|
|
647
647
|
return this.values();
|
|
648
648
|
},
|
|
649
649
|
forEach(n, e) {
|
|
@@ -705,7 +705,7 @@ const Bi = Reflect.ownKeys(Bt), Ss = /* @__PURE__ */ new WeakSet(), Ts = {
|
|
|
705
705
|
if (u)
|
|
706
706
|
return u.bind(n.proxy);
|
|
707
707
|
}
|
|
708
|
-
if (!
|
|
708
|
+
if (!wt(a, e)) {
|
|
709
709
|
const u = Er(a, e);
|
|
710
710
|
return u ? "value" in u ? u.value : (
|
|
711
711
|
// !case: support for getter
|
|
@@ -713,7 +713,7 @@ const Bi = Reflect.ownKeys(Bt), Ss = /* @__PURE__ */ new WeakSet(), Ts = {
|
|
|
713
713
|
) : void 0;
|
|
714
714
|
}
|
|
715
715
|
const c = a[e];
|
|
716
|
-
if (n.options.strict && Qt(c, n.options), n.finalized || !
|
|
716
|
+
if (n.options.strict && Qt(c, n.options), n.finalized || !ke(c, n.options))
|
|
717
717
|
return c;
|
|
718
718
|
if (c === fn(n.original, e)) {
|
|
719
719
|
if (de(n), n.copy[e] = er({
|
|
@@ -723,8 +723,8 @@ const Bi = Reflect.ownKeys(Bt), Ss = /* @__PURE__ */ new WeakSet(), Ts = {
|
|
|
723
723
|
finalities: n.finalities,
|
|
724
724
|
options: n.options
|
|
725
725
|
}), typeof o == "function") {
|
|
726
|
-
const u =
|
|
727
|
-
return de(u),
|
|
726
|
+
const u = D(n.copy[e]);
|
|
727
|
+
return de(u), Ie(u), u.copy;
|
|
728
728
|
}
|
|
729
729
|
return n.copy[e];
|
|
730
730
|
}
|
|
@@ -740,8 +740,8 @@ const Bi = Reflect.ownKeys(Bt), Ss = /* @__PURE__ */ new WeakSet(), Ts = {
|
|
|
740
740
|
const i = Er(me(n), e);
|
|
741
741
|
if (i != null && i.set)
|
|
742
742
|
return i.set.call(n.proxy, t), !0;
|
|
743
|
-
const o = fn(me(n), e), a =
|
|
744
|
-
return a &&
|
|
743
|
+
const o = fn(me(n), e), a = D(o);
|
|
744
|
+
return a && Re(a.original, t) ? (n.copy[e] = t, n.assignedMap = (r = n.assignedMap) !== null && r !== void 0 ? r : /* @__PURE__ */ new Map(), n.assignedMap.set(e, !1), !0) : (Re(t, o) && (t !== void 0 || wt(n.original, e)) || (de(n), Ie(n), wt(n.original, e) && Re(t, n.original[e]) ? n.assignedMap.delete(e) : n.assignedMap.set(e, !0), n.copy[e] = t, Xn(n, e, t, Et)), !0);
|
|
745
745
|
},
|
|
746
746
|
has(n, e) {
|
|
747
747
|
return e in me(n);
|
|
@@ -769,7 +769,7 @@ const Bi = Reflect.ownKeys(Bt), Ss = /* @__PURE__ */ new WeakSet(), Ts = {
|
|
|
769
769
|
},
|
|
770
770
|
deleteProperty(n, e) {
|
|
771
771
|
var t;
|
|
772
|
-
return n.type === 1 ? Ts.set.call(this, n, e, void 0, n.proxy) : (fn(n.original, e) !== void 0 || e in n.original ? (de(n),
|
|
772
|
+
return n.type === 1 ? Ts.set.call(this, n, e, void 0, n.proxy) : (fn(n.original, e) !== void 0 || e in n.original ? (de(n), Ie(n), n.assignedMap.set(e, !1)) : (n.assignedMap = (t = n.assignedMap) !== null && t !== void 0 ? t : /* @__PURE__ */ new Map(), n.assignedMap.delete(e)), n.copy && delete n.copy[e], !0);
|
|
773
773
|
}
|
|
774
774
|
};
|
|
775
775
|
function er(n) {
|
|
@@ -790,22 +790,22 @@ function er(n) {
|
|
|
790
790
|
if (s.revoke.push(u), Ss.add(c), a.proxy = c, t) {
|
|
791
791
|
const l = t;
|
|
792
792
|
l.finalities.draft.push((f, d) => {
|
|
793
|
-
var
|
|
794
|
-
const g =
|
|
795
|
-
let
|
|
796
|
-
const
|
|
797
|
-
if (
|
|
798
|
-
let w =
|
|
799
|
-
|
|
793
|
+
var y, b;
|
|
794
|
+
const g = D(c);
|
|
795
|
+
let m = l.type === 3 ? l.setMap : l.copy;
|
|
796
|
+
const T = je(m, r), _ = D(T);
|
|
797
|
+
if (_) {
|
|
798
|
+
let w = _.original;
|
|
799
|
+
_.operated && (w = Yn(T)), vn(_), En(_, Et, f, d), l.options.enableAutoFreeze && (l.options.updatedValues = (y = l.options.updatedValues) !== null && y !== void 0 ? y : /* @__PURE__ */ new WeakMap(), l.options.updatedValues.set(w, _.original)), Ot(m, r, w);
|
|
800
800
|
}
|
|
801
|
-
(
|
|
801
|
+
(b = g.callbacks) === null || b === void 0 || b.forEach((w) => {
|
|
802
802
|
w(f, d);
|
|
803
803
|
});
|
|
804
804
|
});
|
|
805
805
|
} else {
|
|
806
|
-
const l =
|
|
806
|
+
const l = D(c);
|
|
807
807
|
l.finalities.draft.push((f, d) => {
|
|
808
|
-
vn(l), En(l,
|
|
808
|
+
vn(l), En(l, Et, f, d);
|
|
809
809
|
});
|
|
810
810
|
}
|
|
811
811
|
return c;
|
|
@@ -813,7 +813,7 @@ function er(n) {
|
|
|
813
813
|
Gn.createDraft = er;
|
|
814
814
|
function Gi(n, e, t, r, s) {
|
|
815
815
|
var i;
|
|
816
|
-
const o =
|
|
816
|
+
const o = D(n), a = (i = o == null ? void 0 : o.original) !== null && i !== void 0 ? i : n, c = !!e.length;
|
|
817
817
|
if (o != null && o.operated)
|
|
818
818
|
for (; o.finalities.draft.length > 0; )
|
|
819
819
|
o.finalities.draft.pop()(t, r);
|
|
@@ -833,7 +833,7 @@ function Hi(n, e) {
|
|
|
833
833
|
};
|
|
834
834
|
let s, i;
|
|
835
835
|
e.enablePatches && (s = [], i = []);
|
|
836
|
-
const a = ((t = e.mark) === null || t === void 0 ? void 0 : t.call(e, n, we)) === we.mutable || !
|
|
836
|
+
const a = ((t = e.mark) === null || t === void 0 ? void 0 : t.call(e, n, we)) === we.mutable || !ke(n, e) ? n : er({
|
|
837
837
|
original: n,
|
|
838
838
|
parentDraft: null,
|
|
839
839
|
finalities: r,
|
|
@@ -847,10 +847,10 @@ function Hi(n, e) {
|
|
|
847
847
|
}
|
|
848
848
|
];
|
|
849
849
|
}
|
|
850
|
-
function
|
|
850
|
+
function kn(n) {
|
|
851
851
|
const { rootDraft: e, value: t, useRawReturn: r = !1, isRoot: s = !0 } = n;
|
|
852
852
|
Zn(t, (i, o, a) => {
|
|
853
|
-
const c =
|
|
853
|
+
const c = D(o);
|
|
854
854
|
if (c && e && c.finalities === e.finalities) {
|
|
855
855
|
n.isContainDraft = !0;
|
|
856
856
|
const u = c.original;
|
|
@@ -858,14 +858,14 @@ function An(n) {
|
|
|
858
858
|
const l = Array.from(a);
|
|
859
859
|
a.clear(), l.forEach((f) => a.add(i === f ? u : f));
|
|
860
860
|
} else
|
|
861
|
-
|
|
862
|
-
} else typeof o == "object" && o !== null && (n.value = o, n.isRoot = !1,
|
|
861
|
+
Ot(a, i, u);
|
|
862
|
+
} else typeof o == "object" && o !== null && (n.value = o, n.isRoot = !1, kn(n));
|
|
863
863
|
}), s && (n.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."));
|
|
864
864
|
}
|
|
865
865
|
function vs(n) {
|
|
866
866
|
var e;
|
|
867
|
-
const t =
|
|
868
|
-
if (!
|
|
867
|
+
const t = D(n);
|
|
868
|
+
if (!ke(n, t == null ? void 0 : t.options))
|
|
869
869
|
return n;
|
|
870
870
|
const r = ze(n);
|
|
871
871
|
if (t && !t.operated)
|
|
@@ -884,17 +884,17 @@ function vs(n) {
|
|
|
884
884
|
} else
|
|
885
885
|
s = n;
|
|
886
886
|
if (Zn(s, (o, a) => {
|
|
887
|
-
if (t && je(
|
|
887
|
+
if (t && Re(je(t.original, o), a))
|
|
888
888
|
return;
|
|
889
889
|
const c = vs(a);
|
|
890
|
-
c !== a && (s === n && i(),
|
|
890
|
+
c !== a && (s === n && i(), Ot(s, o, c));
|
|
891
891
|
}), r === 3) {
|
|
892
892
|
const o = (e = t == null ? void 0 : t.original) !== null && e !== void 0 ? e : s;
|
|
893
893
|
return Hn(o) ? new Set(s) : new (Object.getPrototypeOf(o)).constructor(s);
|
|
894
894
|
}
|
|
895
895
|
return s;
|
|
896
896
|
}
|
|
897
|
-
function
|
|
897
|
+
function Ar(n) {
|
|
898
898
|
if (!qe(n))
|
|
899
899
|
throw new Error(`current() is only used for Draft, parameter: ${n}`);
|
|
900
900
|
return vs(n);
|
|
@@ -902,72 +902,72 @@ function kr(n) {
|
|
|
902
902
|
const Ji = (n) => function e(t, r, s) {
|
|
903
903
|
var i, o, a;
|
|
904
904
|
if (typeof t == "function" && typeof r != "function")
|
|
905
|
-
return function(
|
|
906
|
-
return e(
|
|
905
|
+
return function(v, ...U) {
|
|
906
|
+
return e(v, (I) => t.call(this, I, ...U), r);
|
|
907
907
|
};
|
|
908
908
|
const c = t, u = r;
|
|
909
909
|
let l = s;
|
|
910
910
|
if (typeof r != "function" && (l = r), l !== void 0 && Object.prototype.toString.call(l) !== "[object Object]")
|
|
911
911
|
throw new Error(`Invalid options: ${l}, 'options' should be an object.`);
|
|
912
912
|
l = Object.assign(Object.assign({}, n), l);
|
|
913
|
-
const f = qe(c) ?
|
|
913
|
+
const f = qe(c) ? Ar(c) : c, d = Array.isArray(l.mark) ? (v, U) => {
|
|
914
914
|
for (const I of l.mark) {
|
|
915
915
|
if (typeof I != "function")
|
|
916
916
|
throw new Error(`Invalid mark: ${I}, 'mark' should be a function.`);
|
|
917
|
-
const
|
|
918
|
-
if (
|
|
919
|
-
return
|
|
917
|
+
const P = I(v, U);
|
|
918
|
+
if (P)
|
|
919
|
+
return P;
|
|
920
920
|
}
|
|
921
|
-
} : l.mark,
|
|
921
|
+
} : l.mark, y = (i = l.enablePatches) !== null && i !== void 0 ? i : !1, b = (o = l.strict) !== null && o !== void 0 ? o : !1, m = {
|
|
922
922
|
enableAutoFreeze: (a = l.enableAutoFreeze) !== null && a !== void 0 ? a : !1,
|
|
923
923
|
mark: d,
|
|
924
|
-
strict:
|
|
925
|
-
enablePatches:
|
|
924
|
+
strict: b,
|
|
925
|
+
enablePatches: y
|
|
926
926
|
};
|
|
927
|
-
if (!
|
|
927
|
+
if (!ke(f, m) && typeof f == "object" && f !== null)
|
|
928
928
|
throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");
|
|
929
|
-
const [
|
|
929
|
+
const [T, _] = Hi(f, m);
|
|
930
930
|
if (typeof r != "function") {
|
|
931
|
-
if (!
|
|
931
|
+
if (!ke(f, m))
|
|
932
932
|
throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");
|
|
933
|
-
return [
|
|
933
|
+
return [T, _];
|
|
934
934
|
}
|
|
935
935
|
let w;
|
|
936
936
|
try {
|
|
937
|
-
w = u(
|
|
938
|
-
} catch (
|
|
939
|
-
throw Tn(
|
|
940
|
-
}
|
|
941
|
-
const
|
|
942
|
-
const
|
|
943
|
-
if (!qe(
|
|
944
|
-
if (
|
|
937
|
+
w = u(T);
|
|
938
|
+
} catch (v) {
|
|
939
|
+
throw Tn(D(T)), v;
|
|
940
|
+
}
|
|
941
|
+
const C = (v) => {
|
|
942
|
+
const U = D(T);
|
|
943
|
+
if (!qe(v)) {
|
|
944
|
+
if (v !== void 0 && !Re(v, T) && (U != null && U.operated))
|
|
945
945
|
throw new Error("Either the value is returned as a new non-draft value, or only the draft is modified without returning any value.");
|
|
946
|
-
const
|
|
947
|
-
if (
|
|
948
|
-
const H =
|
|
949
|
-
return
|
|
950
|
-
rootDraft:
|
|
951
|
-
value:
|
|
946
|
+
const P = v == null ? void 0 : v[Li];
|
|
947
|
+
if (P) {
|
|
948
|
+
const H = P[0];
|
|
949
|
+
return m.strict && typeof v == "object" && v !== null && kn({
|
|
950
|
+
rootDraft: U,
|
|
951
|
+
value: v,
|
|
952
952
|
useRawReturn: !0
|
|
953
|
-
}),
|
|
953
|
+
}), _([H]);
|
|
954
954
|
}
|
|
955
|
-
if (
|
|
956
|
-
return typeof
|
|
955
|
+
if (v !== void 0)
|
|
956
|
+
return typeof v == "object" && v !== null && kn({ rootDraft: U, value: v }), _([v]);
|
|
957
957
|
}
|
|
958
|
-
if (
|
|
959
|
-
return
|
|
960
|
-
const I =
|
|
961
|
-
if (
|
|
958
|
+
if (v === T || v === void 0)
|
|
959
|
+
return _([]);
|
|
960
|
+
const I = D(v);
|
|
961
|
+
if (m === I.options) {
|
|
962
962
|
if (I.operated)
|
|
963
963
|
throw new Error("Cannot return a modified child draft.");
|
|
964
|
-
return
|
|
964
|
+
return _([Ar(v)]);
|
|
965
965
|
}
|
|
966
|
-
return
|
|
966
|
+
return _([v]);
|
|
967
967
|
};
|
|
968
|
-
return w instanceof Promise ? w.then(
|
|
969
|
-
throw Tn(
|
|
970
|
-
}) :
|
|
968
|
+
return w instanceof Promise ? w.then(C, (v) => {
|
|
969
|
+
throw Tn(D(T)), v;
|
|
970
|
+
}) : C(w);
|
|
971
971
|
}, Gt = Ji();
|
|
972
972
|
Object.prototype.constructor.toString();
|
|
973
973
|
function Es(n, e) {
|
|
@@ -977,8 +977,8 @@ function Es(n, e) {
|
|
|
977
977
|
function Cr(n, e) {
|
|
978
978
|
return Object.keys(n).length === Object.keys(e).length && Object.keys(n).every((t) => e.hasOwnProperty(t) && n[t] === e[t]);
|
|
979
979
|
}
|
|
980
|
-
function
|
|
981
|
-
return typeof n != "object" || typeof e != "object" || n === null || e === null ? n === e : Es(n, e) ? Object.keys(n).every((t) =>
|
|
980
|
+
function Nt(n, e) {
|
|
981
|
+
return typeof n != "object" || typeof e != "object" || n === null || e === null ? n === e : Es(n, e) ? Object.keys(n).every((t) => Nt(n[t], e[t])) : !1;
|
|
982
982
|
}
|
|
983
983
|
function tr(n) {
|
|
984
984
|
if (!pt(n))
|
|
@@ -1028,7 +1028,7 @@ function Ir(n, e, t) {
|
|
|
1028
1028
|
}
|
|
1029
1029
|
r[e[e.length - 1]] = t;
|
|
1030
1030
|
}
|
|
1031
|
-
function
|
|
1031
|
+
function ks(n, e) {
|
|
1032
1032
|
if (!n || e.length === 0)
|
|
1033
1033
|
return;
|
|
1034
1034
|
const [t, ...r] = e;
|
|
@@ -1037,7 +1037,7 @@ function As(n, e) {
|
|
|
1037
1037
|
Array.isArray(n) ? n.splice(t, 1) : delete n[t];
|
|
1038
1038
|
return;
|
|
1039
1039
|
}
|
|
1040
|
-
|
|
1040
|
+
ks(n[t], r), Zi(n[t]) && delete n[t];
|
|
1041
1041
|
}
|
|
1042
1042
|
}
|
|
1043
1043
|
function Zi(n) {
|
|
@@ -1283,10 +1283,10 @@ function uo(n) {
|
|
|
1283
1283
|
const e = /^(\d+)-(\d{1,2})-(\d{1,2})([ T])(\d{1,2})(?::(\d{1,2}))?(?::(\d{1,2}))?(.*)$/, t = n.match(e);
|
|
1284
1284
|
if (t) {
|
|
1285
1285
|
const [, r, s, i, o, a, c, u, l] = t, f = s.padStart(2, "0"), d = i.padStart(2, "0");
|
|
1286
|
-
let
|
|
1287
|
-
c !== void 0 && (
|
|
1288
|
-
const
|
|
1289
|
-
return new Date(
|
|
1286
|
+
let y = a.padStart(2, "0");
|
|
1287
|
+
c !== void 0 && (y += `:${c.padStart(2, "0")}`), u !== void 0 && (y += `:${u.padStart(2, "0")}`);
|
|
1288
|
+
const b = `${r}-${f}-${d}T${y}${l}`;
|
|
1289
|
+
return new Date(b);
|
|
1290
1290
|
}
|
|
1291
1291
|
return null;
|
|
1292
1292
|
}
|
|
@@ -1338,7 +1338,7 @@ function yo(n, e) {
|
|
|
1338
1338
|
return null;
|
|
1339
1339
|
}
|
|
1340
1340
|
}
|
|
1341
|
-
function
|
|
1341
|
+
function An(n) {
|
|
1342
1342
|
for (const e of po) {
|
|
1343
1343
|
const t = yo(e, n);
|
|
1344
1344
|
if (t)
|
|
@@ -1349,7 +1349,7 @@ function kn(n) {
|
|
|
1349
1349
|
function bo(n) {
|
|
1350
1350
|
try {
|
|
1351
1351
|
const e = JSON.parse(n);
|
|
1352
|
-
return typeof e == "string" ?
|
|
1352
|
+
return typeof e == "string" ? An(e) : null;
|
|
1353
1353
|
} catch {
|
|
1354
1354
|
return null;
|
|
1355
1355
|
}
|
|
@@ -1361,7 +1361,7 @@ function Zt(n) {
|
|
|
1361
1361
|
if (n instanceof Date)
|
|
1362
1362
|
return n;
|
|
1363
1363
|
if (typeof n == "string") {
|
|
1364
|
-
const e =
|
|
1364
|
+
const e = An(n) || bo(n) || An(n.trim());
|
|
1365
1365
|
if (!e)
|
|
1366
1366
|
throw new Error(`Unable to parse \`${n}\` as a date.`);
|
|
1367
1367
|
return e;
|
|
@@ -1477,7 +1477,7 @@ function be(n, e, t) {
|
|
|
1477
1477
|
}
|
|
1478
1478
|
s > -1 && r.set(e[s], t);
|
|
1479
1479
|
}
|
|
1480
|
-
function
|
|
1480
|
+
function As(n, e, t) {
|
|
1481
1481
|
const r = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map();
|
|
1482
1482
|
for (const o of e) {
|
|
1483
1483
|
let [a, c, u] = o;
|
|
@@ -1511,7 +1511,7 @@ function _o(n, e) {
|
|
|
1511
1511
|
return at(n.eav, [e]) !== void 0;
|
|
1512
1512
|
}
|
|
1513
1513
|
function yt(n, e, t, r) {
|
|
1514
|
-
const s =
|
|
1514
|
+
const s = As(n, e, r);
|
|
1515
1515
|
return s.cardinalityInference = t, s.useDateObjects = r, s;
|
|
1516
1516
|
}
|
|
1517
1517
|
function kt(n, e) {
|
|
@@ -1534,14 +1534,14 @@ function kt(n, e) {
|
|
|
1534
1534
|
const l = (i = ge(c, 2).find((g) => g[2] === a)) == null ? void 0 : i[0];
|
|
1535
1535
|
if (!l)
|
|
1536
1536
|
return null;
|
|
1537
|
-
const [f, d,
|
|
1538
|
-
return [t, d, l, ...
|
|
1537
|
+
const [f, d, y, ...b] = e;
|
|
1538
|
+
return [t, d, l, ...b];
|
|
1539
1539
|
} else {
|
|
1540
1540
|
const [o, ...a] = e;
|
|
1541
1541
|
return [t, ...a];
|
|
1542
1542
|
}
|
|
1543
1543
|
}
|
|
1544
|
-
function
|
|
1544
|
+
function Ms(n, e, t) {
|
|
1545
1545
|
const r = kt(n, t);
|
|
1546
1546
|
if (!r)
|
|
1547
1547
|
return;
|
|
@@ -1549,7 +1549,7 @@ function Rs(n, e, t) {
|
|
|
1549
1549
|
a && (Oe(n.eav, [s, i, o]), Oe(n.aev, [i, s, o]), nr(a) && Oe(n.vae, [o, i, s]));
|
|
1550
1550
|
}
|
|
1551
1551
|
let mo = 0;
|
|
1552
|
-
function
|
|
1552
|
+
function Rs(n, e, t) {
|
|
1553
1553
|
const [r, s, i] = t;
|
|
1554
1554
|
let o;
|
|
1555
1555
|
const a = at(n.eav, [r, s, i]);
|
|
@@ -1564,11 +1564,11 @@ function js(n, e, t) {
|
|
|
1564
1564
|
if (!a)
|
|
1565
1565
|
return;
|
|
1566
1566
|
a["checked-data-type"] === "date" && n.useDateObjects && (o = Zt(o));
|
|
1567
|
-
const c = at(n.eav, [s, i, o]), u = (c == null ? void 0 : c[3]) ??
|
|
1567
|
+
const c = at(n.eav, [s, i, o]), u = (c == null ? void 0 : c[3]) ?? Rs(n, a, r), l = [s, i, o, u];
|
|
1568
1568
|
go(a) ? (be(n.eav, [s, i], /* @__PURE__ */ new Map([[o, l]])), be(n.aev, [i, s], /* @__PURE__ */ new Map([[o, l]]))) : (be(n.eav, [s, i, o], l), be(n.aev, [i, s, o], l)), nr(a) && be(n.vae, [o, i, s], l);
|
|
1569
1569
|
}
|
|
1570
1570
|
function wo(n, e, t) {
|
|
1571
|
-
var
|
|
1571
|
+
var y;
|
|
1572
1572
|
const r = kt(n, t);
|
|
1573
1573
|
if (!r)
|
|
1574
1574
|
return;
|
|
@@ -1580,14 +1580,14 @@ function wo(n, e, t) {
|
|
|
1580
1580
|
const c = at(n.eav, [s, i]);
|
|
1581
1581
|
if (!c)
|
|
1582
1582
|
return;
|
|
1583
|
-
const u = (
|
|
1583
|
+
const u = (y = c.values().next()) == null ? void 0 : y.value;
|
|
1584
1584
|
if (!u)
|
|
1585
1585
|
return;
|
|
1586
1586
|
const l = u[2], f = Os(l, o), d = [
|
|
1587
1587
|
s,
|
|
1588
1588
|
i,
|
|
1589
1589
|
f,
|
|
1590
|
-
|
|
1590
|
+
Rs(n, a, u)
|
|
1591
1591
|
];
|
|
1592
1592
|
be(n.eav, [s, i], /* @__PURE__ */ new Map([[f, d]])), be(n.aev, [i, s], /* @__PURE__ */ new Map([[f, d]]));
|
|
1593
1593
|
}
|
|
@@ -1600,9 +1600,9 @@ function Cn(n, e, t) {
|
|
|
1600
1600
|
if (a) {
|
|
1601
1601
|
for (const f of a.keys()) {
|
|
1602
1602
|
const d = e.getAttr(f);
|
|
1603
|
-
d && d["on-delete-reverse"] === "cascade" && ge(a.get(f), 1).forEach(([
|
|
1604
|
-
var
|
|
1605
|
-
return Cn(n, e, [g, (
|
|
1603
|
+
d && d["on-delete-reverse"] === "cascade" && ge(a.get(f), 1).forEach(([y, b, g]) => {
|
|
1604
|
+
var m;
|
|
1605
|
+
return Cn(n, e, [g, (m = d["reverse-identity"]) == null ? void 0 : m[1]]);
|
|
1606
1606
|
}), // Fall back to deleting everything if we've rehydrated tx-steps from
|
|
1607
1607
|
// the store that didn't set `etype` in deleteEntity
|
|
1608
1608
|
(!s || // If we don't know about the attr, let's just get rid of it
|
|
@@ -1613,13 +1613,13 @@ function Cn(n, e, t) {
|
|
|
1613
1613
|
}
|
|
1614
1614
|
const c = n.vae.get(o) && ge(n.vae.get(o), 2);
|
|
1615
1615
|
c && c.forEach((f) => {
|
|
1616
|
-
var
|
|
1617
|
-
const [d,
|
|
1618
|
-
(!s || !g || ((
|
|
1616
|
+
var m, T, _;
|
|
1617
|
+
const [d, y, b] = f, g = e.getAttr(y);
|
|
1618
|
+
(!s || !g || ((m = g["reverse-identity"]) == null ? void 0 : m[1]) === s) && (Oe(n.eav, [d, y, b]), Oe(n.aev, [y, d, b]), Oe(n.vae, [b, y, d])), g && g["on-delete"] === "cascade" && ((T = g["reverse-identity"]) == null ? void 0 : T[1]) === s && Cn(n, e, [d, (_ = g["forward-identity"]) == null ? void 0 : _[1]]);
|
|
1619
1619
|
}), ((l = n.vae.get(o)) == null ? void 0 : l.size) === 0 && Oe(n.vae, [o]);
|
|
1620
1620
|
}
|
|
1621
1621
|
function xs(n, e, t) {
|
|
1622
|
-
const r =
|
|
1622
|
+
const r = As(e, t, n.useDateObjects);
|
|
1623
1623
|
Object.keys(r).forEach((s) => {
|
|
1624
1624
|
n[s] = r[s];
|
|
1625
1625
|
});
|
|
@@ -1649,7 +1649,7 @@ function Eo(n, e, t) {
|
|
|
1649
1649
|
wo(n, e, s);
|
|
1650
1650
|
break;
|
|
1651
1651
|
case "retract-triple":
|
|
1652
|
-
|
|
1652
|
+
Ms(n, e, s);
|
|
1653
1653
|
break;
|
|
1654
1654
|
case "delete-entity":
|
|
1655
1655
|
Cn(n, e, s);
|
|
@@ -1720,7 +1720,7 @@ function Oo(n, e, t) {
|
|
|
1720
1720
|
let r = "";
|
|
1721
1721
|
return n !== void 0 && (r += "e"), e !== void 0 && (r += "a"), t !== void 0 && (r += "v"), r;
|
|
1722
1722
|
}
|
|
1723
|
-
function
|
|
1723
|
+
function ko(n, [e, t, r]) {
|
|
1724
1724
|
var i, o;
|
|
1725
1725
|
switch (Oo(e, t, r)) {
|
|
1726
1726
|
case "e": {
|
|
@@ -1768,7 +1768,7 @@ function Ao(n, [e, t, r]) {
|
|
|
1768
1768
|
return ge(n.eav, 3);
|
|
1769
1769
|
}
|
|
1770
1770
|
}
|
|
1771
|
-
function
|
|
1771
|
+
function Ao(n, e, t) {
|
|
1772
1772
|
var s;
|
|
1773
1773
|
const r = {};
|
|
1774
1774
|
if (!e)
|
|
@@ -1834,25 +1834,25 @@ function Po(n, e, t) {
|
|
|
1834
1834
|
}
|
|
1835
1835
|
});
|
|
1836
1836
|
}
|
|
1837
|
-
function
|
|
1837
|
+
function Mo(n) {
|
|
1838
1838
|
return typeof n == "string" && n.startsWith("?");
|
|
1839
1839
|
}
|
|
1840
|
-
function
|
|
1840
|
+
function Ro(n, e, t) {
|
|
1841
1841
|
if (t.hasOwnProperty(n)) {
|
|
1842
1842
|
const r = t[n];
|
|
1843
1843
|
return Us(r, e, t);
|
|
1844
1844
|
}
|
|
1845
1845
|
return { ...t, [n]: e };
|
|
1846
1846
|
}
|
|
1847
|
-
function
|
|
1847
|
+
function Mr(n, e, t) {
|
|
1848
1848
|
return n === e ? t : null;
|
|
1849
1849
|
}
|
|
1850
1850
|
function jo(n) {
|
|
1851
1851
|
switch (typeof n) {
|
|
1852
1852
|
case "string":
|
|
1853
|
-
return n.startsWith("?") ?
|
|
1853
|
+
return n.startsWith("?") ? Ro : Mr;
|
|
1854
1854
|
default:
|
|
1855
|
-
return
|
|
1855
|
+
return Mr;
|
|
1856
1856
|
}
|
|
1857
1857
|
}
|
|
1858
1858
|
const xo = [
|
|
@@ -1888,23 +1888,23 @@ function In(n, e, t = [{}]) {
|
|
|
1888
1888
|
return e.reduce((r, s) => Lo(n, s, r), t);
|
|
1889
1889
|
}
|
|
1890
1890
|
function sr(n, e) {
|
|
1891
|
-
return Array.isArray(e) ? e.map((t) => sr(n, t)) :
|
|
1891
|
+
return Array.isArray(e) ? e.map((t) => sr(n, t)) : Mo(e) ? n[e] : e;
|
|
1892
1892
|
}
|
|
1893
1893
|
function Fo(n, { find: e, where: t }) {
|
|
1894
1894
|
return In(n, t).map((s) => sr(s, e));
|
|
1895
1895
|
}
|
|
1896
1896
|
function No(n, e, t) {
|
|
1897
|
-
return
|
|
1897
|
+
return ko(n, sr(t, e));
|
|
1898
1898
|
}
|
|
1899
1899
|
const Ko = /^(?:[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;
|
|
1900
1900
|
function it(n) {
|
|
1901
1901
|
return typeof n == "string" && Ko.test(n);
|
|
1902
1902
|
}
|
|
1903
|
-
const
|
|
1903
|
+
const oe = [];
|
|
1904
1904
|
for (let n = 0; n < 256; ++n)
|
|
1905
|
-
|
|
1905
|
+
oe.push((n + 256).toString(16).slice(1));
|
|
1906
1906
|
function Wo(n, e = 0) {
|
|
1907
|
-
return (
|
|
1907
|
+
return (oe[n[e + 0]] + oe[n[e + 1]] + oe[n[e + 2]] + oe[n[e + 3]] + "-" + oe[n[e + 4]] + oe[n[e + 5]] + "-" + oe[n[e + 6]] + oe[n[e + 7]] + "-" + oe[n[e + 8]] + oe[n[e + 9]] + "-" + oe[n[e + 10]] + oe[n[e + 11]] + oe[n[e + 12]] + oe[n[e + 13]] + oe[n[e + 14]] + oe[n[e + 15]]).toLowerCase();
|
|
1908
1908
|
}
|
|
1909
1909
|
let dn;
|
|
1910
1910
|
const qo = new Uint8Array(16);
|
|
@@ -1916,11 +1916,11 @@ function zo() {
|
|
|
1916
1916
|
}
|
|
1917
1917
|
return dn(qo);
|
|
1918
1918
|
}
|
|
1919
|
-
const Vo = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto),
|
|
1919
|
+
const Vo = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), Rr = { randomUUID: Vo };
|
|
1920
1920
|
function Qo(n, e, t) {
|
|
1921
1921
|
var s;
|
|
1922
|
-
if (
|
|
1923
|
-
return
|
|
1922
|
+
if (Rr.randomUUID && !n)
|
|
1923
|
+
return Rr.randomUUID();
|
|
1924
1924
|
n = n || {};
|
|
1925
1925
|
const r = n.random ?? ((s = n.rng) == null ? void 0 : s.call(n)) ?? zo();
|
|
1926
1926
|
if (r.length < 16)
|
|
@@ -1962,11 +1962,11 @@ function Jo() {
|
|
|
1962
1962
|
}
|
|
1963
1963
|
const Yo = Jo();
|
|
1964
1964
|
let Ls = !0;
|
|
1965
|
-
const
|
|
1965
|
+
const ul = (n) => {
|
|
1966
1966
|
Ls = n;
|
|
1967
1967
|
};
|
|
1968
1968
|
let Zo = 0;
|
|
1969
|
-
function
|
|
1969
|
+
function St(n) {
|
|
1970
1970
|
return Xt(`_${n}`, Zo++);
|
|
1971
1971
|
}
|
|
1972
1972
|
function Xt(n, e) {
|
|
@@ -2003,18 +2003,18 @@ function Fs(n, e, t, r, s) {
|
|
|
2003
2003
|
throw new ot(`Could not find attr for ${[t, s]}`);
|
|
2004
2004
|
if (a["value-type"] !== "ref")
|
|
2005
2005
|
throw new Error(`Attr ${a.id} is not a ref`);
|
|
2006
|
-
const [c, u] = a["forward-identity"], [l, f] = a["reverse-identity"], d = r + 1,
|
|
2006
|
+
const [c, u] = a["forward-identity"], [l, f] = a["reverse-identity"], d = r + 1, y = i ? [
|
|
2007
2007
|
n(u, r),
|
|
2008
2008
|
a.id,
|
|
2009
2009
|
n(f, d),
|
|
2010
|
-
|
|
2010
|
+
St("time")
|
|
2011
2011
|
] : [
|
|
2012
2012
|
n(u, d),
|
|
2013
2013
|
a.id,
|
|
2014
2014
|
n(f, r),
|
|
2015
|
-
|
|
2015
|
+
St("time")
|
|
2016
2016
|
];
|
|
2017
|
-
return [i ? f : u, d,
|
|
2017
|
+
return [i ? f : u, d, y, a, !!i];
|
|
2018
2018
|
}
|
|
2019
2019
|
function $r(n, e) {
|
|
2020
2020
|
if (typeof e != "string")
|
|
@@ -2098,20 +2098,20 @@ function ra(n, e, t, r, s, i) {
|
|
|
2098
2098
|
n(t, r),
|
|
2099
2099
|
u.id,
|
|
2100
2100
|
{ $isNull: { attrId: c.id, isNull: i.$isNull, reverse: !o } },
|
|
2101
|
-
|
|
2101
|
+
St("time")
|
|
2102
2102
|
];
|
|
2103
2103
|
}
|
|
2104
2104
|
return o ? [
|
|
2105
2105
|
n(t, r),
|
|
2106
2106
|
c.id,
|
|
2107
2107
|
na(c, i),
|
|
2108
|
-
|
|
2109
|
-
] : [i, c.id, n(t, r),
|
|
2108
|
+
St("time")
|
|
2109
|
+
] : [i, c.id, n(t, r), St("time")];
|
|
2110
2110
|
}
|
|
2111
2111
|
function sa(n, e, t, r, s) {
|
|
2112
2112
|
const [i, o, a] = s.reduce((c, u) => {
|
|
2113
|
-
const [l, f, d] = c, [
|
|
2114
|
-
return [
|
|
2113
|
+
const [l, f, d] = c, [y, b, g] = Fs(n, e, l, f, u);
|
|
2114
|
+
return [y, b, [...d, g]];
|
|
2115
2115
|
}, [t, r, []]);
|
|
2116
2116
|
return [i, o, a];
|
|
2117
2117
|
}
|
|
@@ -2196,24 +2196,24 @@ function da(n, e, t, r, s, i) {
|
|
|
2196
2196
|
function ha(n, e, t, { etype: r, level: s, form: i }, o) {
|
|
2197
2197
|
const a = Object.keys(i).filter((c) => c !== "$");
|
|
2198
2198
|
return a.length ? Object.entries(o).map(function([u, l]) {
|
|
2199
|
-
return a.map(function(
|
|
2200
|
-
var g,
|
|
2201
|
-
const
|
|
2199
|
+
return a.map(function(y) {
|
|
2200
|
+
var g, m, T;
|
|
2201
|
+
const b = !!(e.cardinalityInference && ((T = (m = (g = t.linkIndex) == null ? void 0 : g[r]) == null ? void 0 : m[y]) != null && T.isSingular));
|
|
2202
2202
|
try {
|
|
2203
|
-
const [
|
|
2204
|
-
etype:
|
|
2203
|
+
const [_, w, C] = da(n, t, r, s, y, u), v = qs(e, t, {
|
|
2204
|
+
etype: _,
|
|
2205
2205
|
level: w,
|
|
2206
|
-
form: i[
|
|
2207
|
-
join:
|
|
2208
|
-
}),
|
|
2209
|
-
return { [
|
|
2210
|
-
} catch (
|
|
2211
|
-
if (
|
|
2212
|
-
return { [
|
|
2213
|
-
throw
|
|
2214
|
-
}
|
|
2215
|
-
}).reduce(function(
|
|
2216
|
-
return { ...
|
|
2206
|
+
form: i[y],
|
|
2207
|
+
join: C
|
|
2208
|
+
}), U = b ? v[0] : v;
|
|
2209
|
+
return { [y]: U };
|
|
2210
|
+
} catch (_) {
|
|
2211
|
+
if (_ instanceof ot)
|
|
2212
|
+
return { [y]: b ? void 0 : [] };
|
|
2213
|
+
throw _;
|
|
2214
|
+
}
|
|
2215
|
+
}).reduce(function(y, b) {
|
|
2216
|
+
return { ...y, ...b };
|
|
2217
2217
|
}, l);
|
|
2218
2218
|
}) : Object.values(o);
|
|
2219
2219
|
}
|
|
@@ -2226,7 +2226,7 @@ function bt(n, e, t, r, s) {
|
|
|
2226
2226
|
function Ht([n, e], [t, r], s) {
|
|
2227
2227
|
return bt(n, e, t, r, s);
|
|
2228
2228
|
}
|
|
2229
|
-
function
|
|
2229
|
+
function Mn(n) {
|
|
2230
2230
|
return n == null ? n : new Date(n).getTime();
|
|
2231
2231
|
}
|
|
2232
2232
|
function Ks(n, e, t) {
|
|
@@ -2234,7 +2234,7 @@ function Ks(n, e, t) {
|
|
|
2234
2234
|
const [r, s, i, o] = n;
|
|
2235
2235
|
if (((d = e["forward-identity"]) == null ? void 0 : d[2]) === "id")
|
|
2236
2236
|
return Ht(t, [r, o], null);
|
|
2237
|
-
const [a, c] = t, u = e["checked-data-type"], l = u === "date" ?
|
|
2237
|
+
const [a, c] = t, u = e["checked-data-type"], l = u === "date" ? Mn(c) : c, f = u === "date" ? Mn(i) : i;
|
|
2238
2238
|
return Ht([a, l], [r, f], u);
|
|
2239
2239
|
}
|
|
2240
2240
|
function ya(n, e, t, r) {
|
|
@@ -2275,33 +2275,33 @@ function wa(n, e, t) {
|
|
|
2275
2275
|
return r;
|
|
2276
2276
|
}
|
|
2277
2277
|
function Sa(n, e, { etype: t, pageInfo: r, dq: s, form: i }) {
|
|
2278
|
-
var g,
|
|
2278
|
+
var g, m;
|
|
2279
2279
|
const o = (g = i == null ? void 0 : i.$) == null ? void 0 : g.order, a = Ws(i), c = Ta(i);
|
|
2280
2280
|
let u = Fo(n, s);
|
|
2281
2281
|
const l = r == null ? void 0 : r["start-cursor"], f = r == null ? void 0 : r["end-cursor"], d = ma(e, t, l, o);
|
|
2282
|
-
if (d && ((
|
|
2283
|
-
const
|
|
2282
|
+
if (d && ((m = d == null ? void 0 : d["forward-identity"]) == null ? void 0 : m[2]) !== "id") {
|
|
2283
|
+
const T = d["checked-data-type"] === "date", _ = d.id;
|
|
2284
2284
|
u = u.map(([w]) => {
|
|
2285
|
-
var
|
|
2286
|
-
let
|
|
2287
|
-
return
|
|
2285
|
+
var v, U, I, P, H;
|
|
2286
|
+
let C = (H = (P = (I = (U = (v = n.eav.get(w)) == null ? void 0 : v.get(_)) == null ? void 0 : U.values()) == null ? void 0 : I.next()) == null ? void 0 : P.value) == null ? void 0 : H[2];
|
|
2287
|
+
return T && (C = Mn(C)), [w, C];
|
|
2288
2288
|
});
|
|
2289
2289
|
}
|
|
2290
|
-
u.sort(c === "asc" ? function(
|
|
2291
|
-
return Ht(
|
|
2292
|
-
} : function(
|
|
2293
|
-
return Ht(w,
|
|
2290
|
+
u.sort(c === "asc" ? function(_, w) {
|
|
2291
|
+
return Ht(_, w, d == null ? void 0 : d["checked-data-type"]);
|
|
2292
|
+
} : function(_, w) {
|
|
2293
|
+
return Ht(w, _, d == null ? void 0 : d["checked-data-type"]);
|
|
2294
2294
|
});
|
|
2295
|
-
let
|
|
2296
|
-
const
|
|
2297
|
-
for (const
|
|
2298
|
-
const [
|
|
2299
|
-
if (
|
|
2295
|
+
let y = {};
|
|
2296
|
+
const b = wa(e, t, s);
|
|
2297
|
+
for (const T of u) {
|
|
2298
|
+
const [_] = T;
|
|
2299
|
+
if (y[_] || !a && l && d && ya(l, d, c, T) || !a && f && d && ba(f, d, c, T))
|
|
2300
2300
|
continue;
|
|
2301
|
-
const w =
|
|
2302
|
-
w && (
|
|
2301
|
+
const w = Ao(n, b, _);
|
|
2302
|
+
w && (y[_] = w);
|
|
2303
2303
|
}
|
|
2304
|
-
return
|
|
2304
|
+
return y;
|
|
2305
2305
|
}
|
|
2306
2306
|
function Ta(n) {
|
|
2307
2307
|
var t;
|
|
@@ -2314,19 +2314,19 @@ function Ws(n) {
|
|
|
2314
2314
|
return !e && !t && !r;
|
|
2315
2315
|
}
|
|
2316
2316
|
function va(n, e, { etype: t, level: r, form: s, join: i, pageInfo: o }) {
|
|
2317
|
-
var d,
|
|
2317
|
+
var d, y, b, g, m;
|
|
2318
2318
|
if (!Ws(s) && (!o || !o["start-cursor"]))
|
|
2319
2319
|
return [];
|
|
2320
|
-
const a = ia(la(e, t, r, (d = s.$) == null ? void 0 : d.where), i), c = fa(Xt, t, r), u = (
|
|
2320
|
+
const a = ia(la(e, t, r, (d = s.$) == null ? void 0 : d.where), i), c = fa(Xt, t, r), u = (y = s.$) == null ? void 0 : y.fields, l = Sa(n, e, {
|
|
2321
2321
|
etype: t,
|
|
2322
2322
|
pageInfo: o,
|
|
2323
2323
|
form: s,
|
|
2324
2324
|
dq: { where: a, find: c, fields: u }
|
|
2325
|
-
}), f = ((
|
|
2325
|
+
}), f = ((b = s.$) == null ? void 0 : b.limit) || ((g = s.$) == null ? void 0 : g.first) || ((m = s.$) == null ? void 0 : m.last);
|
|
2326
2326
|
if (f != null) {
|
|
2327
2327
|
r > 0 && Ls && console.warn("WARNING: Limits in child queries are only run client-side. Data returned from the server will not have a limit.");
|
|
2328
|
-
const
|
|
2329
|
-
return
|
|
2328
|
+
const T = Object.entries(l);
|
|
2329
|
+
return T.length <= f ? l : Object.fromEntries(T.slice(0, f));
|
|
2330
2330
|
}
|
|
2331
2331
|
return l;
|
|
2332
2332
|
}
|
|
@@ -2365,7 +2365,7 @@ function zs({ store: n, attrsStore: e, pageInfo: t, aggregate: r }, s) {
|
|
|
2365
2365
|
}, {}) };
|
|
2366
2366
|
return t && (o.pageInfo = Oa(t)), r && (o.aggregate = r), o;
|
|
2367
2367
|
}
|
|
2368
|
-
function
|
|
2368
|
+
function ka() {
|
|
2369
2369
|
const e = {
|
|
2370
2370
|
__etype: 1,
|
|
2371
2371
|
__ops: 1,
|
|
@@ -2379,8 +2379,8 @@ function Aa() {
|
|
|
2379
2379
|
};
|
|
2380
2380
|
return new Set(Object.keys(e));
|
|
2381
2381
|
}
|
|
2382
|
-
const
|
|
2383
|
-
function
|
|
2382
|
+
const Aa = ka();
|
|
2383
|
+
function Kt(n, e, t) {
|
|
2384
2384
|
const r = {
|
|
2385
2385
|
__etype: n,
|
|
2386
2386
|
__ops: t
|
|
@@ -2391,8 +2391,8 @@ function Wt(n, e, t) {
|
|
|
2391
2391
|
return t;
|
|
2392
2392
|
if (i === "__etype")
|
|
2393
2393
|
return n;
|
|
2394
|
-
if (
|
|
2395
|
-
return (o, a) =>
|
|
2394
|
+
if (Aa.has(i))
|
|
2395
|
+
return (o, a) => Kt(n, e, [
|
|
2396
2396
|
...t,
|
|
2397
2397
|
a ? [i, n, e, o, a] : [i, n, e, o]
|
|
2398
2398
|
]);
|
|
@@ -2405,7 +2405,7 @@ function Ca(n, e) {
|
|
|
2405
2405
|
function Jt(n) {
|
|
2406
2406
|
return n.startsWith("lookup__");
|
|
2407
2407
|
}
|
|
2408
|
-
function
|
|
2408
|
+
function Rn(n) {
|
|
2409
2409
|
const [e, t, ...r] = n.split("__");
|
|
2410
2410
|
return [t, JSON.parse(r.join("__"))];
|
|
2411
2411
|
}
|
|
@@ -2415,11 +2415,11 @@ function Ia(n) {
|
|
|
2415
2415
|
}, {
|
|
2416
2416
|
get(e, t) {
|
|
2417
2417
|
if (t === "lookup")
|
|
2418
|
-
return (s, i) =>
|
|
2418
|
+
return (s, i) => Kt(n, Rn(Ca(s, i)), []);
|
|
2419
2419
|
if (t === "__etype")
|
|
2420
2420
|
return n;
|
|
2421
2421
|
const r = t;
|
|
2422
|
-
return Jt(r) ?
|
|
2422
|
+
return Jt(r) ? Kt(n, Rn(r), []) : Kt(n, r, []);
|
|
2423
2423
|
}
|
|
2424
2424
|
});
|
|
2425
2425
|
}
|
|
@@ -2430,11 +2430,11 @@ function ir() {
|
|
|
2430
2430
|
}
|
|
2431
2431
|
});
|
|
2432
2432
|
}
|
|
2433
|
-
const
|
|
2433
|
+
const ll = ir();
|
|
2434
2434
|
function Pa(n) {
|
|
2435
2435
|
return n.__ops;
|
|
2436
2436
|
}
|
|
2437
|
-
function
|
|
2437
|
+
function Ma(n, e) {
|
|
2438
2438
|
const { attrIdMap: t, refSwapAttrIds: r } = n, s = [];
|
|
2439
2439
|
for (const o of e) {
|
|
2440
2440
|
const a = t[o];
|
|
@@ -2453,7 +2453,7 @@ function Ra(n, e) {
|
|
|
2453
2453
|
}
|
|
2454
2454
|
return s;
|
|
2455
2455
|
}
|
|
2456
|
-
function
|
|
2456
|
+
function Ra(n) {
|
|
2457
2457
|
if (Array.isArray(n))
|
|
2458
2458
|
return n;
|
|
2459
2459
|
const e = Object.entries(n);
|
|
@@ -2481,7 +2481,7 @@ function xa(n, e, t) {
|
|
|
2481
2481
|
return s;
|
|
2482
2482
|
}
|
|
2483
2483
|
function xn(n) {
|
|
2484
|
-
return typeof n == "string" && !Jt(n) ? null : typeof n == "string" && Jt(n) ?
|
|
2484
|
+
return typeof n == "string" && !Jt(n) ? null : typeof n == "string" && Jt(n) ? Rn(n) : Ra(n);
|
|
2485
2485
|
}
|
|
2486
2486
|
function _e(n, e, t) {
|
|
2487
2487
|
const r = xn(t);
|
|
@@ -2580,11 +2580,11 @@ function La(n, e) {
|
|
|
2580
2580
|
function Fa(n, e) {
|
|
2581
2581
|
const { attrsStore: t } = n, [r, s, i, o] = e, a = tr(i), c = _e(t, r, s), u = Qs(n, [r, c, i, o]);
|
|
2582
2582
|
return [["id", c]].concat(Object.entries(a)).map(([f, d]) => {
|
|
2583
|
-
const
|
|
2584
|
-
return
|
|
2583
|
+
const y = se(t, r, f);
|
|
2584
|
+
return y["checked-data-type"] === "date" && n.useDateObjects && (d = Zt(d)), [
|
|
2585
2585
|
"add-triple",
|
|
2586
2586
|
c,
|
|
2587
|
-
|
|
2587
|
+
y.id,
|
|
2588
2588
|
d,
|
|
2589
2589
|
...u ? [u] : []
|
|
2590
2590
|
];
|
|
@@ -2594,13 +2594,13 @@ function Na({ attrsStore: n }, [e, t]) {
|
|
|
2594
2594
|
return [["delete-entity", _e(n, e, t), e]];
|
|
2595
2595
|
}
|
|
2596
2596
|
function Ka(n, e) {
|
|
2597
|
-
const { attrsStore: t } = n, [r, s, i, o] = e, a = tr(i), c = _e(t, r, s), u = Qs(n, [r, c, i, o]), l = Object.entries(a).map(([d,
|
|
2598
|
-
const
|
|
2597
|
+
const { attrsStore: t } = n, [r, s, i, o] = e, a = tr(i), c = _e(t, r, s), u = Qs(n, [r, c, i, o]), l = Object.entries(a).map(([d, y]) => {
|
|
2598
|
+
const b = se(t, r, d);
|
|
2599
2599
|
return [
|
|
2600
2600
|
"deep-merge-triple",
|
|
2601
2601
|
c,
|
|
2602
|
-
|
|
2603
|
-
|
|
2602
|
+
b.id,
|
|
2603
|
+
y,
|
|
2604
2604
|
...u ? [u] : []
|
|
2605
2605
|
];
|
|
2606
2606
|
});
|
|
@@ -2668,7 +2668,7 @@ function Qa(n, e, t) {
|
|
|
2668
2668
|
"checked-data-type": o
|
|
2669
2669
|
};
|
|
2670
2670
|
}
|
|
2671
|
-
function
|
|
2671
|
+
function Rt(n, e, t, r) {
|
|
2672
2672
|
const s = n ? Qa(n, e, t) : null, i = Z(), a = [Z(), e, t];
|
|
2673
2673
|
return {
|
|
2674
2674
|
id: i,
|
|
@@ -2749,72 +2749,72 @@ function ec(n) {
|
|
|
2749
2749
|
return e;
|
|
2750
2750
|
}
|
|
2751
2751
|
function tc({ attrsStore: n, schema: e }, t) {
|
|
2752
|
-
var d,
|
|
2752
|
+
var d, y;
|
|
2753
2753
|
const r = /* @__PURE__ */ new Set(), s = [], i = [];
|
|
2754
|
-
function o(
|
|
2755
|
-
return se(n,
|
|
2754
|
+
function o(b, g) {
|
|
2755
|
+
return se(n, b, g) || s.find((m) => m["forward-identity"][1] === b && m["forward-identity"][2] === g);
|
|
2756
2756
|
}
|
|
2757
|
-
function a(
|
|
2758
|
-
return Ve(n,
|
|
2759
|
-
var
|
|
2760
|
-
return ((
|
|
2757
|
+
function a(b, g) {
|
|
2758
|
+
return Ve(n, b, g) || s.find((m) => {
|
|
2759
|
+
var T, _;
|
|
2760
|
+
return ((T = m["reverse-identity"]) == null ? void 0 : T[1]) === b && ((_ = m["reverse-identity"]) == null ? void 0 : _[2]) === g;
|
|
2761
2761
|
});
|
|
2762
2762
|
}
|
|
2763
|
-
function c(
|
|
2764
|
-
s.push(
|
|
2763
|
+
function c(b) {
|
|
2764
|
+
s.push(b), i.push(["add-attr", b]), r.add(b.id);
|
|
2765
2765
|
}
|
|
2766
|
-
function u(
|
|
2767
|
-
|
|
2766
|
+
function u(b) {
|
|
2767
|
+
b && "isUnsynced" in b && b.isUnsynced && !r.has(b.id) && (s.push(b), i.push(["add-attr", b]), r.add(b.id));
|
|
2768
2768
|
}
|
|
2769
|
-
function l(
|
|
2769
|
+
function l(b, g) {
|
|
2770
2770
|
return g.indexOf(".") !== -1 && // attr names can have `.` in them, so use the attr we find with a `.`
|
|
2771
2771
|
// before assuming it's a ref lookup.
|
|
2772
|
-
!o(
|
|
2773
|
-
}
|
|
2774
|
-
function f(
|
|
2775
|
-
const
|
|
2776
|
-
u(
|
|
2777
|
-
}
|
|
2778
|
-
for (const
|
|
2779
|
-
for (const { etype: g, lookupPair:
|
|
2780
|
-
const
|
|
2781
|
-
if (
|
|
2782
|
-
f(g,
|
|
2783
|
-
const w = o(g,
|
|
2784
|
-
u(w), u(
|
|
2785
|
-
const
|
|
2786
|
-
if (l(
|
|
2787
|
-
f(
|
|
2772
|
+
!o(b, g);
|
|
2773
|
+
}
|
|
2774
|
+
function f(b, g) {
|
|
2775
|
+
const m = o(b, g), T = a(b, g);
|
|
2776
|
+
u(m), u(T), !m && !T && c(Lr(e, b, g, Xa));
|
|
2777
|
+
}
|
|
2778
|
+
for (const b of t)
|
|
2779
|
+
for (const { etype: g, lookupPair: m, linkLabel: T } of ec(b)) {
|
|
2780
|
+
const _ = m[0];
|
|
2781
|
+
if (T) {
|
|
2782
|
+
f(g, T);
|
|
2783
|
+
const w = o(g, T), C = a(g, T);
|
|
2784
|
+
u(w), u(C);
|
|
2785
|
+
const v = ((d = w == null ? void 0 : w["reverse-identity"]) == null ? void 0 : d[1]) || ((y = C == null ? void 0 : C["forward-identity"]) == null ? void 0 : y[1]) || T;
|
|
2786
|
+
if (l(v, _))
|
|
2787
|
+
f(v, jn(_));
|
|
2788
2788
|
else {
|
|
2789
|
-
const
|
|
2790
|
-
|
|
2789
|
+
const U = o(v, _);
|
|
2790
|
+
U || c(Rt(e, v, _, $n)), u(U);
|
|
2791
2791
|
}
|
|
2792
|
-
} else if (l(g,
|
|
2793
|
-
f(g, jn(
|
|
2792
|
+
} else if (l(g, _))
|
|
2793
|
+
f(g, jn(_));
|
|
2794
2794
|
else {
|
|
2795
|
-
const w = o(g,
|
|
2796
|
-
w || c(
|
|
2795
|
+
const w = o(g, _);
|
|
2796
|
+
w || c(Rt(e, g, _, $n)), u(w);
|
|
2797
2797
|
}
|
|
2798
2798
|
}
|
|
2799
|
-
for (const
|
|
2800
|
-
const [g,
|
|
2799
|
+
for (const b of t) {
|
|
2800
|
+
const [g, m, T, _] = b;
|
|
2801
2801
|
if (Ha.has(g)) {
|
|
2802
|
-
const w = o(
|
|
2803
|
-
u(w), w || c(
|
|
2804
|
-
for (const
|
|
2805
|
-
const
|
|
2806
|
-
if (u(
|
|
2807
|
-
const
|
|
2808
|
-
!
|
|
2802
|
+
const w = o(m, "id");
|
|
2803
|
+
u(w), w || c(Rt(e, m, "id", { "unique?": !0 }));
|
|
2804
|
+
for (const C of Object.keys(_)) {
|
|
2805
|
+
const v = o(m, C);
|
|
2806
|
+
if (u(v), Ya.has(g) && (v || c(Rt(e, m, C, C === "id" ? { "unique?": !0 } : null))), Ja.has(g)) {
|
|
2807
|
+
const U = a(m, C);
|
|
2808
|
+
!v && !U && c(Lr(e, m, C)), u(U);
|
|
2809
2809
|
}
|
|
2810
2810
|
}
|
|
2811
2811
|
}
|
|
2812
2812
|
}
|
|
2813
2813
|
if (s.length) {
|
|
2814
|
-
const
|
|
2814
|
+
const b = { ...n.attrs };
|
|
2815
2815
|
for (const g of s)
|
|
2816
|
-
|
|
2817
|
-
return [new Ke(
|
|
2816
|
+
b[g.id] = g;
|
|
2817
|
+
return [new Ke(b, n.linkIndex), i];
|
|
2818
2818
|
}
|
|
2819
2819
|
return [n, i];
|
|
2820
2820
|
}
|
|
@@ -2930,10 +2930,10 @@ class Dn {
|
|
|
2930
2930
|
_writeToStorage(e) {
|
|
2931
2931
|
const t = [], r = e == null ? void 0 : e.skipGc;
|
|
2932
2932
|
if (this._meta.isLoading) {
|
|
2933
|
-
const f = new Promise((d,
|
|
2934
|
-
setTimeout(() => this._enqueuePersist(e ? { ...e, attempts: (e.attempts || 0) + 1 } : { attempts: 1 }).then(d).catch(
|
|
2933
|
+
const f = new Promise((d, y) => {
|
|
2934
|
+
setTimeout(() => this._enqueuePersist(e ? { ...e, attempts: (e.attempts || 0) + 1 } : { attempts: 1 }).then(d).catch(y), 10 + ((e == null ? void 0 : e.attempts) ?? 0) * 1e3);
|
|
2935
2935
|
});
|
|
2936
|
-
return t.push(f), Promise.all(t).then((d) => d.reduce((
|
|
2936
|
+
return t.push(f), Promise.all(t).then((d) => d.reduce((y, b) => y + b, 0));
|
|
2937
2937
|
}
|
|
2938
2938
|
const s = this._meta.value;
|
|
2939
2939
|
if (!s)
|
|
@@ -2951,12 +2951,12 @@ class Dn {
|
|
|
2951
2951
|
if (this._loadedKeys.has(f)) {
|
|
2952
2952
|
const d = this.serialize(f, this.currentValue[f]);
|
|
2953
2953
|
c.push([f, d]);
|
|
2954
|
-
const
|
|
2954
|
+
const y = this._objectSize(d), b = u[f] ?? {
|
|
2955
2955
|
createdAt: Date.now(),
|
|
2956
2956
|
updatedAt: Date.now(),
|
|
2957
|
-
size:
|
|
2957
|
+
size: y
|
|
2958
2958
|
};
|
|
2959
|
-
|
|
2959
|
+
b.updatedAt = Date.now(), b.size = y, u[f] = b, this._pendingSaveKeys.delete(f);
|
|
2960
2960
|
} else
|
|
2961
2961
|
a.push(f);
|
|
2962
2962
|
const l = this._persister.multiSet(c);
|
|
@@ -2965,7 +2965,7 @@ class Dn {
|
|
|
2965
2965
|
const d = this._loadKey(f).then(() => this._enqueuePersist(e));
|
|
2966
2966
|
t.push(d);
|
|
2967
2967
|
}
|
|
2968
|
-
return r || this.gc(), Promise.all(t).then((f) => f.reduce((d,
|
|
2968
|
+
return r || this.gc(), Promise.all(t).then((f) => f.reduce((d, y) => d + y, 0));
|
|
2969
2969
|
}
|
|
2970
2970
|
async flush() {
|
|
2971
2971
|
return this._nextSave ? (clearTimeout(this._nextSave), this._nextSave = null, this._writeToStorage()) : void 0;
|
|
@@ -2999,21 +2999,21 @@ class Dn {
|
|
|
2999
2999
|
for (const d of e)
|
|
3000
3000
|
t.has(d) || d in r.objects || (this._log.info("Lost track of key in meta", d), s.push(this._persister.removeItem(d)), i.removed.push(d), i.removedMissingCount++);
|
|
3001
3001
|
const o = Date.now();
|
|
3002
|
-
for (const [d,
|
|
3003
|
-
!t.has(d) &&
|
|
3002
|
+
for (const [d, y] of Object.entries(r.objects))
|
|
3003
|
+
!t.has(d) && y.updatedAt < o - this._gcOpts.maxAgeMs && (s.push(this._persister.removeItem(d)), delete r.objects[d], i.removed.push(d), i.removedOldCount++);
|
|
3004
3004
|
const a = Object.entries(r.objects);
|
|
3005
|
-
a.sort(([d,
|
|
3005
|
+
a.sort(([d, y], [b, g]) => y.updatedAt - g.updatedAt);
|
|
3006
3006
|
const c = a.filter(([d]) => !t.has(d));
|
|
3007
3007
|
if (a.length > this._gcOpts.maxEntries)
|
|
3008
3008
|
for (const [d] of c.slice(0, a.length - this._gcOpts.maxEntries))
|
|
3009
3009
|
s.push(this._persister.removeItem(d)), delete r.objects[d], i.removed.push(d), i.removedThresholdCount++;
|
|
3010
3010
|
const u = Object.entries(r.objects);
|
|
3011
|
-
u.sort(([d,
|
|
3011
|
+
u.sort(([d, y], [b, g]) => y.updatedAt - g.updatedAt);
|
|
3012
3012
|
const l = u.filter(([d]) => !t.has(d));
|
|
3013
|
-
let f = u.reduce((d, [
|
|
3013
|
+
let f = u.reduce((d, [y, b]) => d + b.size, 0);
|
|
3014
3014
|
for (; f > 0 && f > this._gcOpts.maxSize && l.length; ) {
|
|
3015
|
-
const [[d,
|
|
3016
|
-
f -=
|
|
3015
|
+
const [[d, y]] = l.splice(0, 1);
|
|
3016
|
+
f -= y.size, s.push(this._persister.removeItem(d)), delete r.objects[d], i.removed.push(d), i.removedSizeCount++;
|
|
3017
3017
|
}
|
|
3018
3018
|
for (const d of Object.keys(r.objects))
|
|
3019
3019
|
!e.has(d) && !t.has(d) && delete r.objects[d];
|
|
@@ -3109,26 +3109,26 @@ async function cc(n, e, t) {
|
|
|
3109
3109
|
return new Promise((i, o) => {
|
|
3110
3110
|
var l, f, d;
|
|
3111
3111
|
const a = {};
|
|
3112
|
-
for (const [
|
|
3113
|
-
const g = typeof
|
|
3112
|
+
for (const [y, b] of Object.entries(r)) {
|
|
3113
|
+
const g = typeof b == "string" ? JSON.parse(b) : b;
|
|
3114
3114
|
if (g.lastAccessed) {
|
|
3115
|
-
const
|
|
3115
|
+
const T = {
|
|
3116
3116
|
createdAt: g.lastAccessed,
|
|
3117
3117
|
updatedAt: g.lastAccessed,
|
|
3118
3118
|
size: ((d = (f = (l = g.result) == null ? void 0 : l.store) == null ? void 0 : f.triples) == null ? void 0 : d.length) ?? 0
|
|
3119
3119
|
};
|
|
3120
|
-
a[
|
|
3120
|
+
a[y] = T;
|
|
3121
3121
|
}
|
|
3122
|
-
const
|
|
3123
|
-
s.add(
|
|
3122
|
+
const m = t.put(g, y);
|
|
3123
|
+
s.add(m);
|
|
3124
3124
|
}
|
|
3125
3125
|
const c = { objects: a }, u = t.put(c, tt);
|
|
3126
3126
|
s.add(u);
|
|
3127
|
-
for (const
|
|
3128
|
-
|
|
3129
|
-
s.delete(
|
|
3130
|
-
},
|
|
3131
|
-
o(
|
|
3127
|
+
for (const y of s)
|
|
3128
|
+
y.onsuccess = () => {
|
|
3129
|
+
s.delete(y), s.size === 0 && i();
|
|
3130
|
+
}, y.onerror = (b) => {
|
|
3131
|
+
o(b);
|
|
3132
3132
|
};
|
|
3133
3133
|
});
|
|
3134
3134
|
}
|
|
@@ -3143,20 +3143,20 @@ async function uc(n, e) {
|
|
|
3143
3143
|
if (!t)
|
|
3144
3144
|
return;
|
|
3145
3145
|
const r = await new Promise((l, f) => {
|
|
3146
|
-
const
|
|
3147
|
-
|
|
3148
|
-
f(
|
|
3146
|
+
const b = t.transaction(["kv"], "readonly").objectStore("kv").openCursor();
|
|
3147
|
+
b.onerror = (m) => {
|
|
3148
|
+
f(m);
|
|
3149
3149
|
};
|
|
3150
3150
|
const g = [];
|
|
3151
|
-
|
|
3152
|
-
const
|
|
3153
|
-
if (
|
|
3154
|
-
const
|
|
3155
|
-
g.push([
|
|
3151
|
+
b.onsuccess = () => {
|
|
3152
|
+
const m = b.result;
|
|
3153
|
+
if (m) {
|
|
3154
|
+
const T = m.key, _ = m.value;
|
|
3155
|
+
g.push([T, _]), m.continue();
|
|
3156
3156
|
} else
|
|
3157
3157
|
l(g);
|
|
3158
|
-
},
|
|
3159
|
-
f(
|
|
3158
|
+
}, b.onerror = (m) => {
|
|
3159
|
+
f(m);
|
|
3160
3160
|
};
|
|
3161
3161
|
}), s = e.transaction(["kv", "querySubs"], "readwrite"), i = s.objectStore("kv"), o = s.objectStore("querySubs"), a = [], c = { objects: {} };
|
|
3162
3162
|
for (const [l, f] of r)
|
|
@@ -3169,12 +3169,12 @@ async function uc(n, e) {
|
|
|
3169
3169
|
default: {
|
|
3170
3170
|
const d = Nr(l, f, i);
|
|
3171
3171
|
a.push(d);
|
|
3172
|
-
const
|
|
3172
|
+
const y = {
|
|
3173
3173
|
createdAt: Date.now(),
|
|
3174
3174
|
updatedAt: Date.now(),
|
|
3175
3175
|
size: 0
|
|
3176
3176
|
};
|
|
3177
|
-
c.objects[l] =
|
|
3177
|
+
c.objects[l] = y;
|
|
3178
3178
|
break;
|
|
3179
3179
|
}
|
|
3180
3180
|
}
|
|
@@ -3298,20 +3298,20 @@ class Gs {
|
|
|
3298
3298
|
};
|
|
3299
3299
|
}
|
|
3300
3300
|
}
|
|
3301
|
-
class
|
|
3301
|
+
class ue extends Error {
|
|
3302
3302
|
constructor(t, r, s) {
|
|
3303
3303
|
super(t);
|
|
3304
3304
|
p(this, "hint");
|
|
3305
3305
|
p(this, "traceId");
|
|
3306
3306
|
this.hint = r, s && (this.traceId = s);
|
|
3307
3307
|
const i = new.target.prototype;
|
|
3308
|
-
Object.setPrototypeOf && Object.setPrototypeOf(this, i), Error.captureStackTrace && Error.captureStackTrace(this,
|
|
3308
|
+
Object.setPrototypeOf && Object.setPrototypeOf(this, i), Error.captureStackTrace && Error.captureStackTrace(this, ue), this.name = "InstantError";
|
|
3309
3309
|
}
|
|
3310
3310
|
get [Symbol.toStringTag]() {
|
|
3311
3311
|
return "InstantError";
|
|
3312
3312
|
}
|
|
3313
3313
|
}
|
|
3314
|
-
class en extends
|
|
3314
|
+
class en extends ue {
|
|
3315
3315
|
constructor(t) {
|
|
3316
3316
|
var i, o;
|
|
3317
3317
|
const r = ((i = t.body) == null ? void 0 : i.message) || `API Error (${t.status})`;
|
|
@@ -3325,19 +3325,19 @@ class en extends oe {
|
|
|
3325
3325
|
return "InstantAPIError";
|
|
3326
3326
|
}
|
|
3327
3327
|
}
|
|
3328
|
-
async function
|
|
3328
|
+
async function Ae(n, e) {
|
|
3329
3329
|
const t = await fetch(n, e), r = await t.json();
|
|
3330
3330
|
return t.status === 200 ? Promise.resolve(r) : Promise.reject(new en({ status: t.status, body: r }));
|
|
3331
3331
|
}
|
|
3332
3332
|
function lc({ apiURI: n, appId: e, email: t }) {
|
|
3333
|
-
return
|
|
3333
|
+
return Ae(`${n}/runtime/auth/send_magic_code`, {
|
|
3334
3334
|
method: "POST",
|
|
3335
3335
|
headers: { "content-type": "application/json" },
|
|
3336
3336
|
body: JSON.stringify({ "app-id": e, email: t })
|
|
3337
3337
|
});
|
|
3338
3338
|
}
|
|
3339
3339
|
async function fc({ apiURI: n, appId: e, email: t, code: r, refreshToken: s, extraFields: i }) {
|
|
3340
|
-
return await
|
|
3340
|
+
return await Ae(`${n}/runtime/auth/verify_magic_code`, {
|
|
3341
3341
|
method: "POST",
|
|
3342
3342
|
headers: { "content-type": "application/json" },
|
|
3343
3343
|
body: JSON.stringify({
|
|
@@ -3350,7 +3350,7 @@ async function fc({ apiURI: n, appId: e, email: t, code: r, refreshToken: s, ext
|
|
|
3350
3350
|
});
|
|
3351
3351
|
}
|
|
3352
3352
|
async function dc({ apiURI: n, appId: e, refreshToken: t }) {
|
|
3353
|
-
return await
|
|
3353
|
+
return await Ae(`${n}/runtime/auth/verify_refresh_token`, {
|
|
3354
3354
|
method: "POST",
|
|
3355
3355
|
headers: { "content-type": "application/json" },
|
|
3356
3356
|
body: JSON.stringify({
|
|
@@ -3360,7 +3360,7 @@ async function dc({ apiURI: n, appId: e, refreshToken: t }) {
|
|
|
3360
3360
|
});
|
|
3361
3361
|
}
|
|
3362
3362
|
async function hc({ apiURI: n, appId: e }) {
|
|
3363
|
-
return await
|
|
3363
|
+
return await Ae(`${n}/runtime/auth/sign_in_guest`, {
|
|
3364
3364
|
method: "POST",
|
|
3365
3365
|
headers: { "content-type": "application/json" },
|
|
3366
3366
|
body: JSON.stringify({
|
|
@@ -3369,7 +3369,7 @@ async function hc({ apiURI: n, appId: e }) {
|
|
|
3369
3369
|
});
|
|
3370
3370
|
}
|
|
3371
3371
|
async function Wr({ apiURI: n, appId: e, code: t, codeVerifier: r, refreshToken: s, extraFields: i }) {
|
|
3372
|
-
return await
|
|
3372
|
+
return await Ae(`${n}/runtime/oauth/token`, {
|
|
3373
3373
|
method: "POST",
|
|
3374
3374
|
headers: { "content-type": "application/json" },
|
|
3375
3375
|
body: JSON.stringify({
|
|
@@ -3382,7 +3382,7 @@ async function Wr({ apiURI: n, appId: e, code: t, codeVerifier: r, refreshToken:
|
|
|
3382
3382
|
});
|
|
3383
3383
|
}
|
|
3384
3384
|
async function pc({ apiURI: n, appId: e, nonce: t, idToken: r, clientName: s, refreshToken: i, extraFields: o }) {
|
|
3385
|
-
return await
|
|
3385
|
+
return await Ae(`${n}/runtime/oauth/id_token`, {
|
|
3386
3386
|
method: "POST",
|
|
3387
3387
|
headers: { "content-type": "application/json" },
|
|
3388
3388
|
body: JSON.stringify({
|
|
@@ -3396,7 +3396,7 @@ async function pc({ apiURI: n, appId: e, nonce: t, idToken: r, clientName: s, re
|
|
|
3396
3396
|
});
|
|
3397
3397
|
}
|
|
3398
3398
|
async function yc({ apiURI: n, appId: e, refreshToken: t }) {
|
|
3399
|
-
return await
|
|
3399
|
+
return await Ae(`${n}/runtime/signout`, {
|
|
3400
3400
|
method: "POST",
|
|
3401
3401
|
headers: {
|
|
3402
3402
|
"content-type": "application/json"
|
|
@@ -3414,14 +3414,14 @@ async function bc({ apiURI: n, appId: e, path: t, file: r, refreshToken: s, cont
|
|
|
3414
3414
|
authorization: `Bearer ${s}`,
|
|
3415
3415
|
"content-type": i || r.type
|
|
3416
3416
|
};
|
|
3417
|
-
return o && (a["content-disposition"] = o), await
|
|
3417
|
+
return o && (a["content-disposition"] = o), await Ae(`${n}/storage/upload`, {
|
|
3418
3418
|
method: "PUT",
|
|
3419
3419
|
headers: a,
|
|
3420
3420
|
body: r
|
|
3421
3421
|
});
|
|
3422
3422
|
}
|
|
3423
3423
|
async function gc({ apiURI: n, appId: e, path: t, refreshToken: r }) {
|
|
3424
|
-
const { data: s } = await
|
|
3424
|
+
const { data: s } = await Ae(`${n}/storage/files?app_id=${e}&filename=${encodeURIComponent(t)}`, {
|
|
3425
3425
|
method: "DELETE",
|
|
3426
3426
|
headers: {
|
|
3427
3427
|
"content-type": "application/json",
|
|
@@ -3431,7 +3431,7 @@ async function gc({ apiURI: n, appId: e, path: t, refreshToken: r }) {
|
|
|
3431
3431
|
return s;
|
|
3432
3432
|
}
|
|
3433
3433
|
async function _c({ apiURI: n, appId: e, fileName: t, refreshToken: r, metadata: s = {} }) {
|
|
3434
|
-
const { data: i } = await
|
|
3434
|
+
const { data: i } = await Ae(`${n}/storage/signed-upload-url`, {
|
|
3435
3435
|
method: "POST",
|
|
3436
3436
|
headers: {
|
|
3437
3437
|
"content-type": "application/json",
|
|
@@ -3454,7 +3454,7 @@ async function mc(n, e) {
|
|
|
3454
3454
|
})).ok;
|
|
3455
3455
|
}
|
|
3456
3456
|
async function wc({ apiURI: n, appId: e, path: t, refreshToken: r }) {
|
|
3457
|
-
const { data: s } = await
|
|
3457
|
+
const { data: s } = await Ae(`${n}/storage/signed-download-url?app_id=${e}&filename=${encodeURIComponent(t)}`, {
|
|
3458
3458
|
method: "GET",
|
|
3459
3459
|
headers: {
|
|
3460
3460
|
"content-type": "application/json",
|
|
@@ -3541,7 +3541,7 @@ function Qr(n) {
|
|
|
3541
3541
|
}, e;
|
|
3542
3542
|
}, {});
|
|
3543
3543
|
}
|
|
3544
|
-
const ar = "v1.0.50
|
|
3544
|
+
const ar = "v1.0.50";
|
|
3545
3545
|
function vc(n, e, t = console) {
|
|
3546
3546
|
return {
|
|
3547
3547
|
info: n ? (...r) => t.info(...r, e()) : () => {
|
|
@@ -3701,7 +3701,7 @@ const Br = [
|
|
|
3701
3701
|
Oc(u, l, i, e, r, t, `${s}.${u}`);
|
|
3702
3702
|
} else if (!Zs(n, i, o))
|
|
3703
3703
|
throw new B(`Invalid value for attribute '${e}' in entity '${r}'. Expected ${i}, but received: ${typeof n}`, s);
|
|
3704
|
-
},
|
|
3704
|
+
}, kc = (n, e, t, r, s) => {
|
|
3705
3705
|
const i = n.split(".");
|
|
3706
3706
|
if (i.length < 2)
|
|
3707
3707
|
throw new B(`Invalid dot notation path '${n}'. Must contain at least one dot.`, s);
|
|
@@ -3710,12 +3710,12 @@ const Br = [
|
|
|
3710
3710
|
const f = i[l], d = r.entities[o];
|
|
3711
3711
|
if (!d)
|
|
3712
3712
|
throw new B(`Entity '${o}' does not exist in schema while traversing dot notation path '${n}'.`, s);
|
|
3713
|
-
const
|
|
3714
|
-
if (!
|
|
3715
|
-
const
|
|
3716
|
-
throw new B(`Link '${f}' does not exist on entity '${o}' in dot notation path '${n}'. Available links: ${
|
|
3713
|
+
const y = d.links[f];
|
|
3714
|
+
if (!y) {
|
|
3715
|
+
const b = Object.keys(d.links);
|
|
3716
|
+
throw new B(`Link '${f}' does not exist on entity '${o}' in dot notation path '${n}'. Available links: ${b.length > 0 ? b.join(", ") : "none"}`, s);
|
|
3717
3717
|
}
|
|
3718
|
-
o =
|
|
3718
|
+
o = y.entityName;
|
|
3719
3719
|
}
|
|
3720
3720
|
const a = i[i.length - 1], c = r.entities[o];
|
|
3721
3721
|
if (!c)
|
|
@@ -3751,7 +3751,7 @@ const Br = [
|
|
|
3751
3751
|
continue;
|
|
3752
3752
|
}
|
|
3753
3753
|
if (s.includes(".")) {
|
|
3754
|
-
|
|
3754
|
+
kc(s, i, e, t, `${r}.${s}`);
|
|
3755
3755
|
continue;
|
|
3756
3756
|
}
|
|
3757
3757
|
const o = t.entities[e];
|
|
@@ -3771,7 +3771,7 @@ const Br = [
|
|
|
3771
3771
|
rt(i, s, u, e, `${r}.${s}`);
|
|
3772
3772
|
}
|
|
3773
3773
|
}
|
|
3774
|
-
},
|
|
3774
|
+
}, Ac = (n, e, t, r, s = 0) => {
|
|
3775
3775
|
for (const o of Object.keys(n))
|
|
3776
3776
|
if (!Br.includes(o))
|
|
3777
3777
|
throw new B(`Invalid query parameter '${o}' in $ object. Valid parameters are: ${Br.join(", ")}. Found: ${o}`, r);
|
|
@@ -3812,7 +3812,7 @@ const Br = [
|
|
|
3812
3812
|
const a = n[o];
|
|
3813
3813
|
if (typeof a != "object" || a === null)
|
|
3814
3814
|
throw new B(`Query parameter '$' must be an object in entity '${e}', but received: ${typeof a}`, `${r}.$`);
|
|
3815
|
-
|
|
3815
|
+
Ac(a, e, t, `${r}.$`, s);
|
|
3816
3816
|
}
|
|
3817
3817
|
}, Gr = (n, e) => {
|
|
3818
3818
|
if (typeof n != "object" || n === null)
|
|
@@ -3890,7 +3890,7 @@ const ti = (n) => n.length > 0 ? n.join(", ") : "none", Cc = (n, e) => new Te(`E
|
|
|
3890
3890
|
unlink: Jr,
|
|
3891
3891
|
delete: () => {
|
|
3892
3892
|
}
|
|
3893
|
-
},
|
|
3893
|
+
}, Mc = (n, e) => {
|
|
3894
3894
|
if (!e)
|
|
3895
3895
|
return;
|
|
3896
3896
|
const [t, r, s, i] = n;
|
|
@@ -3900,7 +3900,7 @@ const ti = (n) => n.length > 0 ? n.join(", ") : "none", Cc = (n, e) => new Te(`E
|
|
|
3900
3900
|
throw new Te(`Entity name must be a string, but received: ${typeof r}`);
|
|
3901
3901
|
const o = Pc[t];
|
|
3902
3902
|
o && i !== void 0 && o(r, i, e);
|
|
3903
|
-
},
|
|
3903
|
+
}, Rc = (n, e) => {
|
|
3904
3904
|
const t = Array.isArray(n) ? n : [n];
|
|
3905
3905
|
for (const r of t) {
|
|
3906
3906
|
if (!r || typeof r != "object")
|
|
@@ -3910,7 +3910,7 @@ const ti = (n) => n.length > 0 ? n.join(", ") : "none", Cc = (n, e) => new Te(`E
|
|
|
3910
3910
|
for (const s of r.__ops) {
|
|
3911
3911
|
if (!Array.isArray(s))
|
|
3912
3912
|
throw new Te(`Transaction operation must be an array, but received: ${typeof s}`);
|
|
3913
|
-
|
|
3913
|
+
Mc(s, e);
|
|
3914
3914
|
}
|
|
3915
3915
|
}
|
|
3916
3916
|
};
|
|
@@ -4097,7 +4097,7 @@ function Xr(n, e, t) {
|
|
|
4097
4097
|
js(n, e, s);
|
|
4098
4098
|
break;
|
|
4099
4099
|
case "removed":
|
|
4100
|
-
|
|
4100
|
+
Ms(n, e, s);
|
|
4101
4101
|
break;
|
|
4102
4102
|
}
|
|
4103
4103
|
}
|
|
@@ -4110,23 +4110,23 @@ function Uc(n, e, t) {
|
|
|
4110
4110
|
continue;
|
|
4111
4111
|
const d = r[c] ?? {};
|
|
4112
4112
|
r[c] = d;
|
|
4113
|
-
const
|
|
4113
|
+
const y = d[f] ?? {};
|
|
4114
4114
|
switch (o) {
|
|
4115
4115
|
case "added":
|
|
4116
|
-
|
|
4116
|
+
y.newValue = l;
|
|
4117
4117
|
break;
|
|
4118
4118
|
case "removed":
|
|
4119
|
-
|
|
4119
|
+
y.oldValue === void 0 && (y.oldValue = l);
|
|
4120
4120
|
break;
|
|
4121
4121
|
}
|
|
4122
|
-
d[f] =
|
|
4122
|
+
d[f] = y;
|
|
4123
4123
|
}
|
|
4124
4124
|
for (const [o, a] of Object.entries(r))
|
|
4125
4125
|
for (const [c, { oldValue: u, newValue: l }] of Object.entries(a))
|
|
4126
4126
|
u === l && delete a[c];
|
|
4127
4127
|
return r;
|
|
4128
4128
|
}
|
|
4129
|
-
function
|
|
4129
|
+
function jt(n, e) {
|
|
4130
4130
|
return { [n.table]: e.map((t) => t.entity) };
|
|
4131
4131
|
}
|
|
4132
4132
|
function Lc(n, e) {
|
|
@@ -4192,7 +4192,7 @@ class Nc {
|
|
|
4192
4192
|
this.subs.flush();
|
|
4193
4193
|
}
|
|
4194
4194
|
subscribe(e, t) {
|
|
4195
|
-
const r =
|
|
4195
|
+
const r = ce(e);
|
|
4196
4196
|
return this.callbacks[r] = this.callbacks[r] || [], this.callbacks[r].push(t), this.initSubscription(e, r, t), (s) => {
|
|
4197
4197
|
this.unsubscribe(r, t, s == null ? void 0 : s.keepSubscription);
|
|
4198
4198
|
};
|
|
@@ -4235,13 +4235,13 @@ class Nc {
|
|
|
4235
4235
|
if (s && s.state && s.state.txId) {
|
|
4236
4236
|
this.sendResync(s, s.state, s.state.txId), (u = s.values) != null && u.entities && r && r({
|
|
4237
4237
|
type: Ue.LoadFromStorage,
|
|
4238
|
-
data:
|
|
4238
|
+
data: jt(s, (l = s.values) == null ? void 0 : l.entities)
|
|
4239
4239
|
});
|
|
4240
4240
|
return;
|
|
4241
4241
|
}
|
|
4242
4242
|
const i = Object.keys(e)[0], o = ((d = (f = e[i]) == null ? void 0 : f.$) == null ? void 0 : d.order) || { serverCreatedAt: "asc" }, [a, c] = Object.entries(o)[0];
|
|
4243
|
-
this.subs.updateInPlace((
|
|
4244
|
-
|
|
4243
|
+
this.subs.updateInPlace((y) => {
|
|
4244
|
+
y[t] = {
|
|
4245
4245
|
query: e,
|
|
4246
4246
|
hash: t,
|
|
4247
4247
|
table: i,
|
|
@@ -4260,7 +4260,7 @@ class Nc {
|
|
|
4260
4260
|
}
|
|
4261
4261
|
}
|
|
4262
4262
|
onStartSyncOk(e) {
|
|
4263
|
-
const t = e["subscription-id"], r = e.q, s =
|
|
4263
|
+
const t = e["subscription-id"], r = e.q, s = ce(r);
|
|
4264
4264
|
this.idToHash[t] = s, this.subs.updateInPlace((i) => {
|
|
4265
4265
|
const o = i[s];
|
|
4266
4266
|
if (!o)
|
|
@@ -4304,7 +4304,7 @@ class Nc {
|
|
|
4304
4304
|
u[s] = o, u[s].updatedAt = Date.now();
|
|
4305
4305
|
}), o.values && this.notifyCbs(s, {
|
|
4306
4306
|
type: Ue.InitialSyncBatch,
|
|
4307
|
-
data:
|
|
4307
|
+
data: jt(o, o.values.entities),
|
|
4308
4308
|
batch: i
|
|
4309
4309
|
});
|
|
4310
4310
|
}
|
|
@@ -4329,7 +4329,7 @@ class Nc {
|
|
|
4329
4329
|
const s = this.subs.currentValue[r];
|
|
4330
4330
|
s && this.notifyCbs(r, {
|
|
4331
4331
|
type: Ue.InitialSyncComplete,
|
|
4332
|
-
data:
|
|
4332
|
+
data: jt(s, ((i = s.values) == null ? void 0 : i.entities) || [])
|
|
4333
4333
|
});
|
|
4334
4334
|
}
|
|
4335
4335
|
onSyncUpdateTriples(e) {
|
|
@@ -4354,9 +4354,9 @@ class Nc {
|
|
|
4354
4354
|
continue;
|
|
4355
4355
|
i.txId = a["tx-id"];
|
|
4356
4356
|
const c = [], u = {};
|
|
4357
|
-
for (const
|
|
4358
|
-
const
|
|
4359
|
-
u[
|
|
4357
|
+
for (const m of a.changes) {
|
|
4358
|
+
const T = u[m.triple[0]] ?? [];
|
|
4359
|
+
u[m.triple[0]] = T, T.push(m);
|
|
4360
4360
|
}
|
|
4361
4361
|
const l = s.values ?? {
|
|
4362
4362
|
entities: [],
|
|
@@ -4364,48 +4364,48 @@ class Nc {
|
|
|
4364
4364
|
}, f = l.entities;
|
|
4365
4365
|
s.values = l;
|
|
4366
4366
|
const d = [];
|
|
4367
|
-
e: for (const [
|
|
4368
|
-
for (let
|
|
4369
|
-
const w = f[
|
|
4370
|
-
if (_o(w.store,
|
|
4371
|
-
Xr(w.store, l.attrsStore,
|
|
4372
|
-
const
|
|
4373
|
-
|
|
4367
|
+
e: for (const [m, T] of Object.entries(u))
|
|
4368
|
+
for (let _ = 0; _ < f.length; _++) {
|
|
4369
|
+
const w = f[_];
|
|
4370
|
+
if (_o(w.store, m)) {
|
|
4371
|
+
Xr(w.store, l.attrsStore, T);
|
|
4372
|
+
const C = yn(s, w.store, l.attrsStore), v = Uc(w.store, l.attrsStore, T)[m];
|
|
4373
|
+
C ? (d.push({
|
|
4374
4374
|
oldEntity: w.entity,
|
|
4375
|
-
newEntity:
|
|
4376
|
-
changedFields:
|
|
4377
|
-
}), w.entity =
|
|
4375
|
+
newEntity: C,
|
|
4376
|
+
changedFields: v || {}
|
|
4377
|
+
}), w.entity = C) : c.push(_), delete u[m];
|
|
4378
4378
|
continue e;
|
|
4379
4379
|
}
|
|
4380
4380
|
}
|
|
4381
|
-
const
|
|
4382
|
-
for (const [
|
|
4383
|
-
const
|
|
4384
|
-
Xr(
|
|
4385
|
-
const w = yn(s,
|
|
4381
|
+
const y = [];
|
|
4382
|
+
for (const [m, T] of Object.entries(u)) {
|
|
4383
|
+
const _ = this.createStore([]);
|
|
4384
|
+
Xr(_, l.attrsStore, T);
|
|
4385
|
+
const w = yn(s, _, l.attrsStore);
|
|
4386
4386
|
if (!w) {
|
|
4387
4387
|
this.log.error("No entity found after applying change", {
|
|
4388
4388
|
sub: s,
|
|
4389
|
-
changes:
|
|
4390
|
-
store:
|
|
4389
|
+
changes: T,
|
|
4390
|
+
store: _
|
|
4391
4391
|
});
|
|
4392
4392
|
continue;
|
|
4393
4393
|
}
|
|
4394
4394
|
f.push({
|
|
4395
|
-
store:
|
|
4395
|
+
store: _,
|
|
4396
4396
|
entity: w,
|
|
4397
|
-
serverCreatedAt: Zr(s,
|
|
4398
|
-
}),
|
|
4397
|
+
serverCreatedAt: Zr(s, _, l.attrsStore, w.id)
|
|
4398
|
+
}), y.push(w);
|
|
4399
4399
|
}
|
|
4400
|
-
const
|
|
4401
|
-
for (const
|
|
4402
|
-
|
|
4400
|
+
const b = [];
|
|
4401
|
+
for (const m of c.sort().reverse())
|
|
4402
|
+
b.push(f[m].entity), f.splice(m, 1);
|
|
4403
4403
|
const g = Lc(s, this.getAttrs);
|
|
4404
4404
|
Fc(s, g, f), this.notifyCbs(r, {
|
|
4405
4405
|
type: Ue.SyncTransaction,
|
|
4406
|
-
data:
|
|
4407
|
-
added:
|
|
4408
|
-
removed:
|
|
4406
|
+
data: jt(s, (o = s.values) == null ? void 0 : o.entities),
|
|
4407
|
+
added: y,
|
|
4408
|
+
removed: b,
|
|
4409
4409
|
updated: d
|
|
4410
4410
|
});
|
|
4411
4411
|
}
|
|
@@ -4425,7 +4425,7 @@ class Nc {
|
|
|
4425
4425
|
}
|
|
4426
4426
|
}
|
|
4427
4427
|
onStartSyncError(e) {
|
|
4428
|
-
const t =
|
|
4428
|
+
const t = ce(e["original-event"].q), r = {
|
|
4429
4429
|
message: e.message || "Uh-oh, something went wrong. Ping Joe & Stopa.",
|
|
4430
4430
|
status: e.status,
|
|
4431
4431
|
type: e.type,
|
|
@@ -4447,104 +4447,104 @@ function Kc({ WStream: n, opts: e, startStream: t, appendStream: r, registerStre
|
|
|
4447
4447
|
let o = null, a = null, c = null;
|
|
4448
4448
|
const u = Z();
|
|
4449
4449
|
let l = !1, f = !1;
|
|
4450
|
-
const d = [],
|
|
4451
|
-
let g = !1,
|
|
4452
|
-
const
|
|
4453
|
-
function
|
|
4450
|
+
const d = [], y = [], b = [];
|
|
4451
|
+
let g = !1, m = 0, T = 0;
|
|
4452
|
+
const _ = [], w = new TextEncoder();
|
|
4453
|
+
function C() {
|
|
4454
4454
|
f = !0;
|
|
4455
|
-
for (const
|
|
4456
|
-
|
|
4455
|
+
for (const O of d)
|
|
4456
|
+
O(a ?? void 0);
|
|
4457
4457
|
}
|
|
4458
|
-
function O
|
|
4459
|
-
return d.push(
|
|
4460
|
-
const
|
|
4461
|
-
|
|
4458
|
+
function v(O) {
|
|
4459
|
+
return d.push(O), f && O(a ?? void 0), () => {
|
|
4460
|
+
const A = d.indexOf(O);
|
|
4461
|
+
A !== -1 && d.splice(A, 1);
|
|
4462
4462
|
};
|
|
4463
4463
|
}
|
|
4464
|
-
function
|
|
4465
|
-
return
|
|
4466
|
-
const
|
|
4467
|
-
|
|
4464
|
+
function U(O) {
|
|
4465
|
+
return b.push(O), () => {
|
|
4466
|
+
const A = b.indexOf(O);
|
|
4467
|
+
A !== -1 && b.splice(A, 1);
|
|
4468
4468
|
};
|
|
4469
4469
|
}
|
|
4470
|
-
e.waitUntil && e.waitUntil(new Promise((
|
|
4471
|
-
|
|
4470
|
+
e.waitUntil && e.waitUntil(new Promise((O) => {
|
|
4471
|
+
b.push(O);
|
|
4472
4472
|
}));
|
|
4473
4473
|
function I() {
|
|
4474
|
-
for (const
|
|
4474
|
+
for (const O of b)
|
|
4475
4475
|
try {
|
|
4476
|
-
|
|
4476
|
+
O();
|
|
4477
4477
|
} catch {
|
|
4478
4478
|
}
|
|
4479
4479
|
}
|
|
4480
|
-
function
|
|
4481
|
-
return
|
|
4482
|
-
const
|
|
4483
|
-
|
|
4480
|
+
function P(O) {
|
|
4481
|
+
return y.push(O), o && O(o), () => {
|
|
4482
|
+
const A = y.indexOf(O);
|
|
4483
|
+
A !== -1 && y.splice(A, 1);
|
|
4484
4484
|
};
|
|
4485
4485
|
}
|
|
4486
|
-
function H(
|
|
4487
|
-
o =
|
|
4488
|
-
for (const
|
|
4489
|
-
|
|
4486
|
+
function H(O) {
|
|
4487
|
+
o = O;
|
|
4488
|
+
for (const A of y)
|
|
4489
|
+
A(o);
|
|
4490
4490
|
}
|
|
4491
|
-
function
|
|
4491
|
+
function K() {
|
|
4492
4492
|
g = !0;
|
|
4493
4493
|
}
|
|
4494
|
-
function G(
|
|
4495
|
-
let
|
|
4496
|
-
for (const { byteLen: X } of
|
|
4497
|
-
const le =
|
|
4498
|
-
if (le >
|
|
4494
|
+
function G(O) {
|
|
4495
|
+
let A = m, W = 0, J = 0;
|
|
4496
|
+
for (const { byteLen: X } of _) {
|
|
4497
|
+
const le = A + X;
|
|
4498
|
+
if (le > O)
|
|
4499
4499
|
break;
|
|
4500
|
-
|
|
4500
|
+
A = le, W++, J += X;
|
|
4501
4501
|
}
|
|
4502
|
-
W > 0 && (
|
|
4502
|
+
W > 0 && (m += J, T -= J, _.splice(0, W));
|
|
4503
4503
|
}
|
|
4504
|
-
function V(
|
|
4505
|
-
a =
|
|
4504
|
+
function V(O, A) {
|
|
4505
|
+
a = A, C(), O.error(A), I();
|
|
4506
4506
|
}
|
|
4507
4507
|
async function ne() {
|
|
4508
|
-
const
|
|
4508
|
+
const O = await t({
|
|
4509
4509
|
clientId: i,
|
|
4510
4510
|
reconnectToken: u,
|
|
4511
4511
|
ruleParams: e.ruleParams
|
|
4512
4512
|
});
|
|
4513
|
-
switch (
|
|
4513
|
+
switch (O.type) {
|
|
4514
4514
|
case "ok": {
|
|
4515
|
-
const { streamId:
|
|
4516
|
-
o =
|
|
4517
|
-
streamId:
|
|
4518
|
-
chunks:
|
|
4519
|
-
offset:
|
|
4515
|
+
const { streamId: A, offset: W } = O;
|
|
4516
|
+
o = A, G(W), _.length && r({
|
|
4517
|
+
streamId: A,
|
|
4518
|
+
chunks: _.map((J) => J.chunk),
|
|
4519
|
+
offset: m
|
|
4520
4520
|
}), g = !1;
|
|
4521
4521
|
break;
|
|
4522
4522
|
}
|
|
4523
4523
|
case "disconnect": {
|
|
4524
|
-
|
|
4524
|
+
K();
|
|
4525
4525
|
break;
|
|
4526
4526
|
}
|
|
4527
4527
|
case "error": {
|
|
4528
|
-
c && V(c,
|
|
4528
|
+
c && V(c, O.error);
|
|
4529
4529
|
break;
|
|
4530
4530
|
}
|
|
4531
4531
|
}
|
|
4532
4532
|
}
|
|
4533
4533
|
function q() {
|
|
4534
|
-
|
|
4534
|
+
K(), ne();
|
|
4535
4535
|
}
|
|
4536
|
-
function k({ offset:
|
|
4537
|
-
G(
|
|
4536
|
+
function k({ offset: O, done: A }) {
|
|
4537
|
+
G(O), A && (l = !0, I());
|
|
4538
4538
|
}
|
|
4539
|
-
function
|
|
4540
|
-
return l ? (V(
|
|
4539
|
+
function j(O) {
|
|
4540
|
+
return l ? (V(O, new ue("Stream has been closed.")), null) : o || (V(O, new ue("Stream has not been initialized.")), null);
|
|
4541
4541
|
}
|
|
4542
|
-
async function
|
|
4543
|
-
c =
|
|
4544
|
-
let
|
|
4545
|
-
for (;
|
|
4542
|
+
async function R(O) {
|
|
4543
|
+
c = O;
|
|
4544
|
+
let A = !0, W = 0;
|
|
4545
|
+
for (; A; ) {
|
|
4546
4546
|
let J = Date.now() + Math.min(15e3, 500 * (W - 1));
|
|
4547
|
-
|
|
4547
|
+
A = !1;
|
|
4548
4548
|
const X = await t({
|
|
4549
4549
|
clientId: e.clientId,
|
|
4550
4550
|
reconnectToken: u,
|
|
@@ -4554,12 +4554,12 @@ function Kc({ WStream: n, opts: e, startStream: t, appendStream: r, registerStre
|
|
|
4554
4554
|
case "ok": {
|
|
4555
4555
|
const { streamId: le, offset: ct } = X;
|
|
4556
4556
|
if (ct !== 0) {
|
|
4557
|
-
const ve = new
|
|
4558
|
-
V(
|
|
4557
|
+
const ve = new ue("Write stream is corrupted");
|
|
4558
|
+
V(O, ve);
|
|
4559
4559
|
return;
|
|
4560
4560
|
}
|
|
4561
4561
|
H(le), s(le, {
|
|
4562
|
-
onDisconnect:
|
|
4562
|
+
onDisconnect: K,
|
|
4563
4563
|
onFlush: k,
|
|
4564
4564
|
onConnectionReconnect: ne,
|
|
4565
4565
|
onAppendFailed: q
|
|
@@ -4567,75 +4567,75 @@ function Kc({ WStream: n, opts: e, startStream: t, appendStream: r, registerStre
|
|
|
4567
4567
|
return;
|
|
4568
4568
|
}
|
|
4569
4569
|
case "disconnect": {
|
|
4570
|
-
|
|
4570
|
+
A = !0, K(), W++, await new Promise((le) => {
|
|
4571
4571
|
setTimeout(le, Math.max(0, J - Date.now()));
|
|
4572
4572
|
});
|
|
4573
4573
|
break;
|
|
4574
4574
|
}
|
|
4575
4575
|
case "error": {
|
|
4576
|
-
V(
|
|
4576
|
+
V(O, X.error);
|
|
4577
4577
|
return;
|
|
4578
4578
|
}
|
|
4579
4579
|
}
|
|
4580
4580
|
}
|
|
4581
4581
|
}
|
|
4582
|
-
class
|
|
4583
|
-
constructor(
|
|
4584
|
-
super(
|
|
4582
|
+
class F extends n {
|
|
4583
|
+
constructor(A, W) {
|
|
4584
|
+
super(A, W);
|
|
4585
4585
|
}
|
|
4586
4586
|
async streamId() {
|
|
4587
|
-
return o || new Promise((
|
|
4587
|
+
return o || new Promise((A, W) => {
|
|
4588
4588
|
const J = [], X = () => {
|
|
4589
4589
|
for (const ve of J)
|
|
4590
4590
|
ve();
|
|
4591
4591
|
}, le = (ve) => {
|
|
4592
|
-
|
|
4592
|
+
A(ve), X();
|
|
4593
4593
|
}, ct = (ve) => {
|
|
4594
|
-
W(ve || new
|
|
4594
|
+
W(ve || new ue("Stream is closed.")), X();
|
|
4595
4595
|
};
|
|
4596
|
-
J.push(
|
|
4596
|
+
J.push(P(le)), J.push(v(ct));
|
|
4597
4597
|
});
|
|
4598
4598
|
}
|
|
4599
4599
|
}
|
|
4600
4600
|
return {
|
|
4601
|
-
stream: new
|
|
4601
|
+
stream: new F({
|
|
4602
4602
|
// TODO(dww): accept a storage so that write streams can survive across
|
|
4603
4603
|
// browser restarts
|
|
4604
|
-
async start(
|
|
4604
|
+
async start(O) {
|
|
4605
4605
|
try {
|
|
4606
|
-
await
|
|
4607
|
-
} catch (
|
|
4608
|
-
V(
|
|
4606
|
+
await R(O);
|
|
4607
|
+
} catch (A) {
|
|
4608
|
+
V(O, A);
|
|
4609
4609
|
}
|
|
4610
4610
|
},
|
|
4611
|
-
write(
|
|
4612
|
-
const W =
|
|
4611
|
+
write(O, A) {
|
|
4612
|
+
const W = j(A);
|
|
4613
4613
|
if (W) {
|
|
4614
|
-
const J = w.encode(
|
|
4615
|
-
|
|
4616
|
-
const X =
|
|
4617
|
-
|
|
4614
|
+
const J = w.encode(O).length;
|
|
4615
|
+
_.push({ chunk: O, byteLen: J });
|
|
4616
|
+
const X = m + T;
|
|
4617
|
+
T += J, g || r({ streamId: W, chunks: [O], offset: X });
|
|
4618
4618
|
}
|
|
4619
4619
|
},
|
|
4620
4620
|
close() {
|
|
4621
4621
|
o ? r({
|
|
4622
4622
|
streamId: o,
|
|
4623
4623
|
chunks: [],
|
|
4624
|
-
offset:
|
|
4624
|
+
offset: m + T,
|
|
4625
4625
|
isDone: !0
|
|
4626
|
-
}) : I(),
|
|
4626
|
+
}) : I(), C();
|
|
4627
4627
|
},
|
|
4628
|
-
abort(
|
|
4628
|
+
abort(O) {
|
|
4629
4629
|
o ? r({
|
|
4630
4630
|
streamId: o,
|
|
4631
4631
|
chunks: [],
|
|
4632
|
-
offset:
|
|
4632
|
+
offset: m + T,
|
|
4633
4633
|
isDone: !0,
|
|
4634
|
-
abortReason:
|
|
4635
|
-
}) : I(),
|
|
4634
|
+
abortReason: O
|
|
4635
|
+
}) : I(), C();
|
|
4636
4636
|
}
|
|
4637
4637
|
}),
|
|
4638
|
-
addCompleteCb:
|
|
4638
|
+
addCompleteCb: U,
|
|
4639
4639
|
closed() {
|
|
4640
4640
|
return f;
|
|
4641
4641
|
}
|
|
@@ -4680,151 +4680,151 @@ function qc({ RStream: n, opts: e, startStream: t, cancelStream: r }) {
|
|
|
4680
4680
|
const o = new TextDecoder("utf-8"), a = new TextEncoder();
|
|
4681
4681
|
let c, u = !1;
|
|
4682
4682
|
const l = [], f = [];
|
|
4683
|
-
let d = null,
|
|
4684
|
-
function
|
|
4683
|
+
let d = null, y = null;
|
|
4684
|
+
function b(I) {
|
|
4685
4685
|
u = !0;
|
|
4686
|
-
for (const
|
|
4687
|
-
|
|
4686
|
+
for (const P of l)
|
|
4687
|
+
P(I);
|
|
4688
4688
|
}
|
|
4689
4689
|
function g(I) {
|
|
4690
4690
|
return l.push(I), () => {
|
|
4691
|
-
const
|
|
4692
|
-
|
|
4691
|
+
const P = l.indexOf(I);
|
|
4692
|
+
P !== -1 && l.splice(P, 1);
|
|
4693
4693
|
};
|
|
4694
4694
|
}
|
|
4695
|
-
function
|
|
4695
|
+
function m(I) {
|
|
4696
4696
|
return f.push(I), d && I(d), () => {
|
|
4697
|
-
const
|
|
4698
|
-
|
|
4697
|
+
const P = f.indexOf(I);
|
|
4698
|
+
P !== -1 && f.splice(P, 1);
|
|
4699
4699
|
};
|
|
4700
4700
|
}
|
|
4701
|
-
function
|
|
4702
|
-
|
|
4701
|
+
function T(I, P) {
|
|
4702
|
+
y = P, I.error(P), b(P);
|
|
4703
4703
|
}
|
|
4704
|
-
let
|
|
4705
|
-
async function w(I,
|
|
4704
|
+
let _ = 0;
|
|
4705
|
+
async function w(I, P) {
|
|
4706
4706
|
c = Z();
|
|
4707
4707
|
const H = { ...I || {}, eventId: c };
|
|
4708
|
-
for await (const
|
|
4708
|
+
for await (const K of t(H)) {
|
|
4709
4709
|
if (i)
|
|
4710
4710
|
return;
|
|
4711
|
-
if (
|
|
4711
|
+
if (K.type === "reconnect")
|
|
4712
4712
|
return { retry: !0 };
|
|
4713
|
-
if (
|
|
4714
|
-
|
|
4713
|
+
if (K.type === "error") {
|
|
4714
|
+
T(P, K.error);
|
|
4715
4715
|
return;
|
|
4716
4716
|
}
|
|
4717
|
-
if (
|
|
4718
|
-
|
|
4717
|
+
if (K.offset > s) {
|
|
4718
|
+
T(P, new ue("Stream is corrupted.")), i = !0;
|
|
4719
4719
|
return;
|
|
4720
4720
|
}
|
|
4721
|
-
d =
|
|
4721
|
+
d = K.streamId;
|
|
4722
4722
|
for (const V of f)
|
|
4723
4723
|
V(d);
|
|
4724
|
-
let G = s -
|
|
4725
|
-
if (
|
|
4724
|
+
let G = s - K.offset;
|
|
4725
|
+
if (K.files && K.files.length) {
|
|
4726
4726
|
const V = new AbortController();
|
|
4727
|
-
let ne = fetch(
|
|
4727
|
+
let ne = fetch(K.files[0].url, {
|
|
4728
4728
|
signal: V.signal
|
|
4729
4729
|
});
|
|
4730
|
-
for (let q = 0; q <
|
|
4731
|
-
const k =
|
|
4732
|
-
if (k && (ne = fetch(k.url, { signal: V.signal })), !
|
|
4733
|
-
if (
|
|
4734
|
-
|
|
4730
|
+
for (let q = 0; q < K.files.length; q++) {
|
|
4731
|
+
const k = K.files[q + 1], R = await ne;
|
|
4732
|
+
if (k && (ne = fetch(k.url, { signal: V.signal })), !R.ok) {
|
|
4733
|
+
if (_++, _ > 10) {
|
|
4734
|
+
T(P, new ue("Unable to process stream."));
|
|
4735
4735
|
return;
|
|
4736
4736
|
}
|
|
4737
4737
|
return { retry: !0 };
|
|
4738
4738
|
}
|
|
4739
|
-
if (
|
|
4740
|
-
const
|
|
4739
|
+
if (R.body) {
|
|
4740
|
+
const F = R.body.getReader();
|
|
4741
4741
|
try {
|
|
4742
4742
|
for (; ; ) {
|
|
4743
|
-
const { done:
|
|
4744
|
-
if (
|
|
4743
|
+
const { done: N, value: O } = await F.read();
|
|
4744
|
+
if (N)
|
|
4745
4745
|
break;
|
|
4746
4746
|
if (i) {
|
|
4747
4747
|
V.abort();
|
|
4748
4748
|
return;
|
|
4749
4749
|
}
|
|
4750
|
-
let
|
|
4751
|
-
if (G > 0 && (
|
|
4750
|
+
let A = O;
|
|
4751
|
+
if (G > 0 && (A = O.subarray(G), G -= O.length - A.length), !A.length)
|
|
4752
4752
|
continue;
|
|
4753
|
-
s +=
|
|
4754
|
-
const W = o.decode(
|
|
4755
|
-
|
|
4753
|
+
s += A.length;
|
|
4754
|
+
const W = o.decode(A);
|
|
4755
|
+
P.enqueue(W);
|
|
4756
4756
|
}
|
|
4757
4757
|
} finally {
|
|
4758
|
-
|
|
4758
|
+
F.releaseLock();
|
|
4759
4759
|
}
|
|
4760
4760
|
} else {
|
|
4761
|
-
const
|
|
4762
|
-
let
|
|
4761
|
+
const F = await R.arrayBuffer();
|
|
4762
|
+
let N = F;
|
|
4763
4763
|
if (i) {
|
|
4764
4764
|
V.abort();
|
|
4765
4765
|
return;
|
|
4766
4766
|
}
|
|
4767
|
-
if (G > 0 && (
|
|
4767
|
+
if (G > 0 && (N = new Uint8Array(F).subarray(G), G -= F.byteLength - N.length), !N.byteLength)
|
|
4768
4768
|
continue;
|
|
4769
|
-
s +=
|
|
4770
|
-
const
|
|
4771
|
-
|
|
4769
|
+
s += N.byteLength;
|
|
4770
|
+
const O = o.decode(N);
|
|
4771
|
+
P.enqueue(O);
|
|
4772
4772
|
}
|
|
4773
4773
|
}
|
|
4774
4774
|
}
|
|
4775
|
-
if (
|
|
4776
|
-
let V =
|
|
4775
|
+
if (_ = 0, K.content) {
|
|
4776
|
+
let V = K.content, ne = a.encode(K.content);
|
|
4777
4777
|
if (G > 0) {
|
|
4778
4778
|
const q = ne.subarray(G);
|
|
4779
4779
|
if (G -= ne.length - q.length, !q.length)
|
|
4780
4780
|
continue;
|
|
4781
4781
|
ne = q, V = o.decode(q);
|
|
4782
4782
|
}
|
|
4783
|
-
s += ne.length,
|
|
4783
|
+
s += ne.length, P.enqueue(V);
|
|
4784
4784
|
}
|
|
4785
4785
|
}
|
|
4786
4786
|
}
|
|
4787
|
-
async function
|
|
4788
|
-
let
|
|
4789
|
-
for (;
|
|
4790
|
-
|
|
4791
|
-
let
|
|
4787
|
+
async function C(I) {
|
|
4788
|
+
let P = !0, H = 0;
|
|
4789
|
+
for (; P; ) {
|
|
4790
|
+
P = !1;
|
|
4791
|
+
let K = Date.now() + Math.min(15e3, 500 * (H - 1));
|
|
4792
4792
|
const G = await w({ ...e, offset: s }, I);
|
|
4793
|
-
G != null && G.retry && (
|
|
4794
|
-
setTimeout(V, Math.max(0,
|
|
4793
|
+
G != null && G.retry && (P = !0, H++, K < Date.now() - 3e5 && (H = 0), await new Promise((V) => {
|
|
4794
|
+
setTimeout(V, Math.max(0, K - Date.now()));
|
|
4795
4795
|
}));
|
|
4796
4796
|
}
|
|
4797
|
-
!i && !u && (I.close(),
|
|
4797
|
+
!i && !u && (I.close(), b());
|
|
4798
4798
|
}
|
|
4799
|
-
class
|
|
4800
|
-
constructor(
|
|
4801
|
-
super(
|
|
4799
|
+
class v extends n {
|
|
4800
|
+
constructor(P, H) {
|
|
4801
|
+
super(P, H);
|
|
4802
4802
|
}
|
|
4803
4803
|
async streamId() {
|
|
4804
4804
|
if (d)
|
|
4805
4805
|
return d;
|
|
4806
|
-
if (
|
|
4807
|
-
throw
|
|
4808
|
-
return new Promise((
|
|
4809
|
-
const
|
|
4810
|
-
for (const q of
|
|
4806
|
+
if (y)
|
|
4807
|
+
throw y;
|
|
4808
|
+
return new Promise((P, H) => {
|
|
4809
|
+
const K = [], G = () => {
|
|
4810
|
+
for (const q of K)
|
|
4811
4811
|
q();
|
|
4812
4812
|
}, V = (q) => {
|
|
4813
|
-
|
|
4813
|
+
P(q), G();
|
|
4814
4814
|
}, ne = (q) => {
|
|
4815
|
-
H(q || new
|
|
4815
|
+
H(q || new ue("Stream is closed.")), G();
|
|
4816
4816
|
};
|
|
4817
|
-
|
|
4817
|
+
K.push(m(V)), K.push(g(ne));
|
|
4818
4818
|
});
|
|
4819
4819
|
}
|
|
4820
4820
|
}
|
|
4821
4821
|
return {
|
|
4822
|
-
stream: new
|
|
4822
|
+
stream: new v({
|
|
4823
4823
|
start(I) {
|
|
4824
|
-
|
|
4824
|
+
C(I);
|
|
4825
4825
|
},
|
|
4826
4826
|
cancel(I) {
|
|
4827
|
-
i = !0, c && r({ eventId: c }),
|
|
4827
|
+
i = !0, c && r({ eventId: c }), b();
|
|
4828
4828
|
}
|
|
4829
4829
|
}),
|
|
4830
4830
|
addCloseCb: g,
|
|
@@ -4939,7 +4939,7 @@ class zc {
|
|
|
4939
4939
|
if (e.error) {
|
|
4940
4940
|
e.retry ? r.push({ type: "reconnect" }) : r.push({
|
|
4941
4941
|
type: "error",
|
|
4942
|
-
error: new
|
|
4942
|
+
error: new ue(e.error)
|
|
4943
4943
|
}), r.close(), delete this.readStreamIterators[t];
|
|
4944
4944
|
return;
|
|
4945
4945
|
}
|
|
@@ -4977,7 +4977,7 @@ class zc {
|
|
|
4977
4977
|
const r = e["client-event-id"], s = this.startWriteStreamCbs[r];
|
|
4978
4978
|
s && (s({
|
|
4979
4979
|
type: "error",
|
|
4980
|
-
error: new
|
|
4980
|
+
error: new ue(e.message || "Unknown error", e.hint)
|
|
4981
4981
|
}), delete this.startWriteStreamCbs[r]);
|
|
4982
4982
|
break;
|
|
4983
4983
|
}
|
|
@@ -4985,7 +4985,7 @@ class zc {
|
|
|
4985
4985
|
const r = e["client-event-id"], s = this.readStreamIterators[r];
|
|
4986
4986
|
s && (s.push({
|
|
4987
4987
|
type: "error",
|
|
4988
|
-
error: new
|
|
4988
|
+
error: new ue(e.message || "Unknown error", e.hint)
|
|
4989
4989
|
}), s.close(), delete this.readStreamIterators[r]);
|
|
4990
4990
|
break;
|
|
4991
4991
|
}
|
|
@@ -5004,7 +5004,7 @@ const Ce = {
|
|
|
5004
5004
|
}, Vc = 3e4, Qc = 3e4, Bc = 200, Gc = 1e3 * 60, Hc = Gc * 60 * 24, es = "lastSyncedUserCookie", Jc = {
|
|
5005
5005
|
apiURI: "https://api.instantdb.com",
|
|
5006
5006
|
websocketURI: "wss://api.instantdb.com/runtime/session"
|
|
5007
|
-
}, bn = "_instant_oauth_redirect", gn = "_instant_extra_fields_id",
|
|
5007
|
+
}, bn = "_instant_oauth_redirect", gn = "_instant_extra_fields_id", xt = "oauthExtraFields", Ge = "currentUser";
|
|
5008
5008
|
function Yc({ transportType: n, appId: e, apiURI: t, wsURI: r, EventSourceImpl: s }) {
|
|
5009
5009
|
if (!s)
|
|
5010
5010
|
return new Yr(`${r}?app_id=${e}`);
|
|
@@ -5105,13 +5105,6 @@ class su {
|
|
|
5105
5105
|
p(this, "attrsCbs", []);
|
|
5106
5106
|
p(this, "mutationErrorCbs", []);
|
|
5107
5107
|
p(this, "connectionStatusCbs", []);
|
|
5108
|
-
p(this, "appStatusCbs", []);
|
|
5109
|
-
/**
|
|
5110
|
-
* Carries the raw server status off the public type: `disabled` is an
|
|
5111
|
-
* operator-level state we don't surface to apps.
|
|
5112
|
-
* @type {import('./clientTypes.ts').AppStatusState & { status?: 'active' | 'read-only' | 'disabled' }}
|
|
5113
|
-
*/
|
|
5114
|
-
p(this, "_appStatusState", { isLoading: !0, isReadOnly: void 0 });
|
|
5115
5108
|
p(this, "config");
|
|
5116
5109
|
p(this, "mutationDeferredStore", /* @__PURE__ */ new Map());
|
|
5117
5110
|
p(this, "_reconnectTimeoutId", null);
|
|
@@ -5167,14 +5160,14 @@ class su {
|
|
|
5167
5160
|
// Queries
|
|
5168
5161
|
p(this, "getPreviousResult", (e) => {
|
|
5169
5162
|
var r;
|
|
5170
|
-
const t =
|
|
5163
|
+
const t = ce(e);
|
|
5171
5164
|
return (r = this.dataForQuery(t)) == null ? void 0 : r.data;
|
|
5172
5165
|
});
|
|
5173
5166
|
/** Re-run instaql and call all callbacks with new data */
|
|
5174
5167
|
p(this, "notifyOne", (e) => {
|
|
5175
5168
|
var i;
|
|
5176
5169
|
const t = this.queryCbs[e] ?? [], r = (i = this._dataForQueryCache[e]) == null ? void 0 : i.data, s = this.dataForQuery(e);
|
|
5177
|
-
s != null && s.data && (this._dataForQueryCache[e] = s, !
|
|
5170
|
+
s != null && s.data && (this._dataForQueryCache[e] = s, !Nt(s.data, r) && t.forEach((o) => o.cb(s.data)));
|
|
5178
5171
|
});
|
|
5179
5172
|
p(this, "notifyOneQueryOnce", (e) => {
|
|
5180
5173
|
var s;
|
|
@@ -5184,17 +5177,11 @@ class su {
|
|
|
5184
5177
|
});
|
|
5185
5178
|
});
|
|
5186
5179
|
p(this, "notifyQueryError", (e, t) => {
|
|
5187
|
-
|
|
5180
|
+
(this.queryCbs[e] || []).forEach((s) => s.cb({ error: t }));
|
|
5188
5181
|
});
|
|
5189
5182
|
/** Applies transactions locally and sends transact message to server */
|
|
5190
5183
|
p(this, "pushTx", (e) => {
|
|
5191
|
-
|
|
5192
|
-
return Promise.reject(this._appStatusState.status === "disabled" ? new oe("This app is currently disabled.", {
|
|
5193
|
-
status: "disabled"
|
|
5194
|
-
}) : new oe("This app is in read-only mode.", {
|
|
5195
|
-
status: "read-only"
|
|
5196
|
-
}));
|
|
5197
|
-
this.config.disableValidation || Mc(e, this.config.schema);
|
|
5184
|
+
this.config.disableValidation || Rc(e, this.config.schema);
|
|
5198
5185
|
try {
|
|
5199
5186
|
const t = nc({
|
|
5200
5187
|
attrsStore: this.optimisticAttrs(),
|
|
@@ -5422,7 +5409,7 @@ class su {
|
|
|
5422
5409
|
status: o ?? 0
|
|
5423
5410
|
}));
|
|
5424
5411
|
} else
|
|
5425
|
-
s.reject(new
|
|
5412
|
+
s.reject(new ue((r == null ? void 0 : r.message) || "Unknown error", r == null ? void 0 : r.hint, r == null ? void 0 : r.traceId));
|
|
5426
5413
|
}
|
|
5427
5414
|
_setStatus(e, t) {
|
|
5428
5415
|
this.status = e, this._errorMessage = t, this.notifyConnectionStatusSubs(e), this._instantStream.onConnectionStatusChange(e);
|
|
@@ -5446,7 +5433,7 @@ class su {
|
|
|
5446
5433
|
_addQueryData(e, t, r) {
|
|
5447
5434
|
if (!this.attrs)
|
|
5448
5435
|
throw new Error("Attrs in reactor have not been set");
|
|
5449
|
-
const s =
|
|
5436
|
+
const s = ce(e), i = this.ensureAttrs(), o = yt(this.attrs, t.triples, r, this.config.useDateObjects);
|
|
5450
5437
|
this.querySubs.updateInPlace((a) => {
|
|
5451
5438
|
a[s] = {
|
|
5452
5439
|
result: {
|
|
@@ -5461,39 +5448,39 @@ class su {
|
|
|
5461
5448
|
}), this._cleanupPendingMutationsQueries(), this.notifyOne(s), this.notifyOneQueryOnce(s), this._cleanupPendingMutationsTimeout();
|
|
5462
5449
|
}
|
|
5463
5450
|
_handleReceive(e, t) {
|
|
5464
|
-
var s, i, o, a, c, u, l
|
|
5451
|
+
var s, i, o, a, c, u, l;
|
|
5465
5452
|
const r = !!this.config.schema && ("cardinalityInference" in this.config ? !!this.config.cardinalityInference : !0);
|
|
5466
5453
|
switch (ts[t.op] || this._log.info("[receive]", e, t.op, t), t.op) {
|
|
5467
5454
|
case "init-ok": {
|
|
5468
|
-
this._setStatus(Ce.AUTHENTICATED), this._reconnectTimeoutMs = 0, this.
|
|
5455
|
+
this._setStatus(Ce.AUTHENTICATED), this._reconnectTimeoutMs = 0, this._setAttrs(t.attrs), this._flushPendingMessages(), this._sessionId = t["session-id"];
|
|
5469
5456
|
for (const y of Object.keys(this._rooms)) {
|
|
5470
|
-
const
|
|
5471
|
-
this._tryJoinRoom(
|
|
5457
|
+
const b = (i = (s = this._presence[y]) == null ? void 0 : s.result) == null ? void 0 : i.user, g = (o = this._rooms[y]) == null ? void 0 : o.roomType;
|
|
5458
|
+
this._tryJoinRoom(g, y, b);
|
|
5472
5459
|
}
|
|
5473
5460
|
break;
|
|
5474
5461
|
}
|
|
5475
5462
|
case "add-query-exists": {
|
|
5476
|
-
this.notifyOneQueryOnce(
|
|
5463
|
+
this.notifyOneQueryOnce(ce(t.q));
|
|
5477
5464
|
break;
|
|
5478
5465
|
}
|
|
5479
5466
|
case "add-query-ok": {
|
|
5480
|
-
const { q: y, result:
|
|
5481
|
-
if (!this._hasQueryListeners() && !this.querySubs.currentValue[
|
|
5467
|
+
const { q: y, result: b } = t, g = ce(y);
|
|
5468
|
+
if (!this._hasQueryListeners() && !this.querySubs.currentValue[g])
|
|
5482
5469
|
break;
|
|
5483
|
-
const
|
|
5484
|
-
this.querySubs.updateInPlace((
|
|
5485
|
-
if (!
|
|
5486
|
-
this._log.info("Missing value in querySubs", { hash:
|
|
5470
|
+
const m = (c = (a = b == null ? void 0 : b[0]) == null ? void 0 : a.data) == null ? void 0 : c["page-info"], T = (l = (u = b == null ? void 0 : b[0]) == null ? void 0 : u.data) == null ? void 0 : l.aggregate, _ = Vr(b), w = this.ensureAttrs(), C = yt(w, _, r, this.config.useDateObjects);
|
|
5471
|
+
this.querySubs.updateInPlace((v) => {
|
|
5472
|
+
if (!v[g]) {
|
|
5473
|
+
this._log.info("Missing value in querySubs", { hash: g, q: y });
|
|
5487
5474
|
return;
|
|
5488
5475
|
}
|
|
5489
|
-
|
|
5490
|
-
store:
|
|
5491
|
-
attrsStore:
|
|
5492
|
-
pageInfo:
|
|
5493
|
-
aggregate:
|
|
5476
|
+
v[g].result = {
|
|
5477
|
+
store: C,
|
|
5478
|
+
attrsStore: w,
|
|
5479
|
+
pageInfo: m,
|
|
5480
|
+
aggregate: T,
|
|
5494
5481
|
processedTxId: t["processed-tx-id"]
|
|
5495
5482
|
};
|
|
5496
|
-
}), this._cleanupPendingMutationsQueries(), this.notifyOne(
|
|
5483
|
+
}), this._cleanupPendingMutationsQueries(), this.notifyOne(g), this.notifyOneQueryOnce(g), this._cleanupPendingMutationsTimeout();
|
|
5497
5484
|
break;
|
|
5498
5485
|
}
|
|
5499
5486
|
case "start-sync-ok": {
|
|
@@ -5529,65 +5516,65 @@ class su {
|
|
|
5529
5516
|
break;
|
|
5530
5517
|
}
|
|
5531
5518
|
case "refresh-ok": {
|
|
5532
|
-
const { computations: y, attrs:
|
|
5533
|
-
|
|
5534
|
-
const
|
|
5535
|
-
|
|
5536
|
-
|
|
5519
|
+
const { computations: y, attrs: b } = t, g = t["processed-tx-id"];
|
|
5520
|
+
b && this._setAttrs(b), this._cleanupPendingMutationsTimeout();
|
|
5521
|
+
const m = this._rewriteMutations(this.ensureAttrs(), this._pendingMutations(), g);
|
|
5522
|
+
m !== this._pendingMutations() && this.kv.updateInPlace((w) => {
|
|
5523
|
+
w.pendingMutations = m;
|
|
5537
5524
|
});
|
|
5538
|
-
const
|
|
5539
|
-
var
|
|
5540
|
-
const
|
|
5525
|
+
const T = _n(m.entries()), _ = y.map((w) => {
|
|
5526
|
+
var q, k, j, R;
|
|
5527
|
+
const C = w["instaql-query"], v = w["instaql-result"], U = ce(C), I = Vr(v), P = this.ensureAttrs(), H = yt(P, I, r, this.config.useDateObjects), { store: K, attrsStore: G } = this._applyOptimisticUpdates(H, P, T, g), V = (k = (q = v == null ? void 0 : v[0]) == null ? void 0 : q.data) == null ? void 0 : k["page-info"], ne = (R = (j = v == null ? void 0 : v[0]) == null ? void 0 : j.data) == null ? void 0 : R.aggregate;
|
|
5541
5528
|
return {
|
|
5542
|
-
q:
|
|
5543
|
-
hash:
|
|
5544
|
-
store:
|
|
5545
|
-
attrsStore:
|
|
5546
|
-
pageInfo:
|
|
5547
|
-
aggregate:
|
|
5529
|
+
q: C,
|
|
5530
|
+
hash: U,
|
|
5531
|
+
store: K,
|
|
5532
|
+
attrsStore: G,
|
|
5533
|
+
pageInfo: V,
|
|
5534
|
+
aggregate: ne
|
|
5548
5535
|
};
|
|
5549
5536
|
});
|
|
5550
|
-
|
|
5551
|
-
this.querySubs.updateInPlace((
|
|
5552
|
-
if (!
|
|
5553
|
-
this._log.error("Missing value in querySubs", { hash:
|
|
5537
|
+
_.forEach(({ hash: w, q: C, store: v, attrsStore: U, pageInfo: I, aggregate: P }) => {
|
|
5538
|
+
this.querySubs.updateInPlace((H) => {
|
|
5539
|
+
if (!H[w]) {
|
|
5540
|
+
this._log.error("Missing value in querySubs", { hash: w, q: C });
|
|
5554
5541
|
return;
|
|
5555
5542
|
}
|
|
5556
|
-
|
|
5557
|
-
store:
|
|
5558
|
-
attrsStore:
|
|
5559
|
-
pageInfo:
|
|
5560
|
-
aggregate:
|
|
5561
|
-
processedTxId:
|
|
5543
|
+
H[w].result = {
|
|
5544
|
+
store: v,
|
|
5545
|
+
attrsStore: U,
|
|
5546
|
+
pageInfo: I,
|
|
5547
|
+
aggregate: P,
|
|
5548
|
+
processedTxId: g
|
|
5562
5549
|
};
|
|
5563
5550
|
});
|
|
5564
|
-
}), this._cleanupPendingMutationsQueries(),
|
|
5565
|
-
this.notifyOne(
|
|
5551
|
+
}), this._cleanupPendingMutationsQueries(), _.forEach(({ hash: w }) => {
|
|
5552
|
+
this.notifyOne(w);
|
|
5566
5553
|
});
|
|
5567
5554
|
break;
|
|
5568
5555
|
}
|
|
5569
5556
|
case "transact-ok": {
|
|
5570
|
-
const { "client-event-id": y, "tx-id":
|
|
5557
|
+
const { "client-event-id": y, "tx-id": b } = t;
|
|
5571
5558
|
this._inFlightMutationEventIds.delete(y);
|
|
5572
|
-
const
|
|
5573
|
-
if (!
|
|
5559
|
+
const m = this._rewriteMutations(this.ensureAttrs(), this._pendingMutations()).get(y);
|
|
5560
|
+
if (!m)
|
|
5574
5561
|
break;
|
|
5575
|
-
this._updatePendingMutations((
|
|
5576
|
-
|
|
5577
|
-
...
|
|
5578
|
-
"tx-id":
|
|
5562
|
+
this._updatePendingMutations((_) => {
|
|
5563
|
+
_.set(y, {
|
|
5564
|
+
..._.get(y),
|
|
5565
|
+
"tx-id": b,
|
|
5579
5566
|
confirmed: Date.now()
|
|
5580
5567
|
});
|
|
5581
5568
|
});
|
|
5582
|
-
const
|
|
5583
|
-
for (const
|
|
5584
|
-
if (
|
|
5585
|
-
const
|
|
5586
|
-
|
|
5569
|
+
const T = [];
|
|
5570
|
+
for (const _ of m["tx-steps"])
|
|
5571
|
+
if (_[0] === "add-attr") {
|
|
5572
|
+
const w = _[1];
|
|
5573
|
+
T.push(w);
|
|
5587
5574
|
}
|
|
5588
|
-
if (
|
|
5589
|
-
const
|
|
5590
|
-
this._setAttrs([...
|
|
5575
|
+
if (T.length) {
|
|
5576
|
+
const _ = Object.values(this.ensureAttrs().attrs);
|
|
5577
|
+
this._setAttrs([..._, ...T]);
|
|
5591
5578
|
}
|
|
5592
5579
|
this._finishTransaction("synced", y), this._cleanupPendingMutationsTimeout();
|
|
5593
5580
|
break;
|
|
@@ -5603,8 +5590,8 @@ class su {
|
|
|
5603
5590
|
break;
|
|
5604
5591
|
}
|
|
5605
5592
|
case "server-broadcast": {
|
|
5606
|
-
const y = t["room-id"],
|
|
5607
|
-
this._trySetRoomConnected(y, !0), this._notifyBroadcastSubs(y,
|
|
5593
|
+
const y = t["room-id"], b = t.topic;
|
|
5594
|
+
this._trySetRoomConnected(y, !0), this._notifyBroadcastSubs(y, b, t);
|
|
5608
5595
|
break;
|
|
5609
5596
|
}
|
|
5610
5597
|
case "join-room-ok": {
|
|
@@ -5621,21 +5608,9 @@ class su {
|
|
|
5621
5608
|
this._trySetRoomConnected(y, !1);
|
|
5622
5609
|
break;
|
|
5623
5610
|
}
|
|
5624
|
-
case "app-status-changed": {
|
|
5625
|
-
const y = this._appStatusState.status;
|
|
5626
|
-
if (this._setAppStatus(t.status), t.status === "disabled" && y !== "disabled") {
|
|
5627
|
-
const g = {
|
|
5628
|
-
message: "This app is currently disabled.",
|
|
5629
|
-
hint: { status: "disabled" }
|
|
5630
|
-
};
|
|
5631
|
-
Object.keys(this.queryCbs).forEach((_) => this.notifyQueryError(_, g));
|
|
5632
|
-
}
|
|
5633
|
-
y === "disabled" && t.status !== "disabled" && this._startSocket();
|
|
5634
|
-
break;
|
|
5635
|
-
}
|
|
5636
5611
|
case "join-room-error":
|
|
5637
|
-
const
|
|
5638
|
-
|
|
5612
|
+
const f = t["room-id"], d = this._rooms[f];
|
|
5613
|
+
d && (d.error = t.error), this._notifyPresenceSubs(f);
|
|
5639
5614
|
break;
|
|
5640
5615
|
case "error":
|
|
5641
5616
|
this._handleReceiveError(t);
|
|
@@ -5678,7 +5653,7 @@ class su {
|
|
|
5678
5653
|
}
|
|
5679
5654
|
}
|
|
5680
5655
|
_handleReceiveError(e) {
|
|
5681
|
-
var a, c, u, l, f, d,
|
|
5656
|
+
var a, c, u, l, f, d, y, b;
|
|
5682
5657
|
this._log.info("error", e);
|
|
5683
5658
|
const t = e["client-event-id"];
|
|
5684
5659
|
this._inFlightMutationEventIds.delete(t);
|
|
@@ -5686,27 +5661,27 @@ class su {
|
|
|
5686
5661
|
message: e.message || "Uh-oh, something went wrong. Ping Joe & Stopa."
|
|
5687
5662
|
};
|
|
5688
5663
|
if (e.hint && (s.hint = e.hint), e["trace-id"] || (a = e["original-event"]) != null && a["trace-id"]) {
|
|
5689
|
-
const
|
|
5690
|
-
s.traceId =
|
|
5664
|
+
const m = [e["trace-id"], (c = e["original-event"]) == null ? void 0 : c["trace-id"]].filter(Boolean).join(",");
|
|
5665
|
+
s.traceId = m;
|
|
5691
5666
|
}
|
|
5692
5667
|
if (r) {
|
|
5693
5668
|
this._handleMutationError("error", t, s);
|
|
5694
5669
|
return;
|
|
5695
5670
|
}
|
|
5696
5671
|
if ((u = e["original-event"]) != null && u.hasOwnProperty("q") && ((l = e["original-event"]) == null ? void 0 : l.op) === "add-query") {
|
|
5697
|
-
const g = (f = e["original-event"]) == null ? void 0 : f.q,
|
|
5698
|
-
this.notifyQueryError(
|
|
5672
|
+
const g = (f = e["original-event"]) == null ? void 0 : f.q, m = ce(g);
|
|
5673
|
+
this.notifyQueryError(ce(g), s), this.notifyQueryOnceError(g, m, t, s);
|
|
5699
5674
|
return;
|
|
5700
5675
|
}
|
|
5701
5676
|
if (((d = e["original-event"]) == null ? void 0 : d.op) === "init") {
|
|
5702
|
-
if (e.type === "record-not-found" && ((
|
|
5677
|
+
if (e.type === "record-not-found" && ((y = e.hint) == null ? void 0 : y["record-type"]) === "app-user") {
|
|
5703
5678
|
this.changeCurrentUser(null);
|
|
5704
5679
|
return;
|
|
5705
5680
|
}
|
|
5706
5681
|
this._setStatus(Ce.ERRORED, s), this.notifyAll();
|
|
5707
5682
|
return;
|
|
5708
5683
|
}
|
|
5709
|
-
switch ((
|
|
5684
|
+
switch ((b = e["original-event"]) == null ? void 0 : b.op) {
|
|
5710
5685
|
case "resync-table": {
|
|
5711
5686
|
this._syncTable.onResyncError(e);
|
|
5712
5687
|
return;
|
|
@@ -5778,7 +5753,7 @@ class su {
|
|
|
5778
5753
|
*/
|
|
5779
5754
|
subscribeQuery(e, t, r) {
|
|
5780
5755
|
this.config.disableValidation || Gr(e, this.config.schema), r && "ruleParams" in r && (e = { $$ruleParams: r.ruleParams, ...e });
|
|
5781
|
-
const s =
|
|
5756
|
+
const s = ce(e), i = this.getPreviousResult(e);
|
|
5782
5757
|
return i && t(i), this.queryCbs[s] = this.queryCbs[s] ?? [], this.queryCbs[s].push({ q: e, cb: t }), this._startQuerySub(e, s), () => {
|
|
5783
5758
|
this._unsubQuery(e, s, t);
|
|
5784
5759
|
};
|
|
@@ -5790,7 +5765,7 @@ class su {
|
|
|
5790
5765
|
return r.reject(new Error("We can't run `queryOnce`, because the device is offline.")), r.promise;
|
|
5791
5766
|
if (!this.querySubs)
|
|
5792
5767
|
return r.reject(new Error("We can't run `queryOnce` on the backend. Use adminAPI.query instead: https://www.instantdb.com/docs/backend#query")), r.promise;
|
|
5793
|
-
const s =
|
|
5768
|
+
const s = ce(e), i = this._startQuerySub(e, s);
|
|
5794
5769
|
return this.queryOnceDfds[s] = this.queryOnceDfds[s] ?? [], this.queryOnceDfds[s].push({ q: e, dfd: r, eventId: i }), setTimeout(() => r.reject(new Error("Query timed out")), Vc), r.promise;
|
|
5795
5770
|
}
|
|
5796
5771
|
_completeQueryOnce(e, t, r) {
|
|
@@ -5829,36 +5804,36 @@ class su {
|
|
|
5829
5804
|
if (!t)
|
|
5830
5805
|
return /* @__PURE__ */ new Map();
|
|
5831
5806
|
const s = (l) => {
|
|
5832
|
-
const [f, d,
|
|
5833
|
-
return se(e, d,
|
|
5807
|
+
const [f, d, y] = l["forward-identity"];
|
|
5808
|
+
return se(e, d, y);
|
|
5834
5809
|
}, i = (l) => {
|
|
5835
|
-
const [f, d,
|
|
5836
|
-
return Ve(e, d,
|
|
5810
|
+
const [f, d, y] = l["forward-identity"];
|
|
5811
|
+
return Ve(e, d, y);
|
|
5837
5812
|
}, o = { attrIdMap: {}, refSwapAttrIds: /* @__PURE__ */ new Set() };
|
|
5838
5813
|
let a = !1;
|
|
5839
5814
|
const c = (l, f) => {
|
|
5840
5815
|
const d = [];
|
|
5841
|
-
for (const
|
|
5842
|
-
const [
|
|
5843
|
-
if (
|
|
5844
|
-
const [
|
|
5845
|
-
if (
|
|
5846
|
-
o.attrIdMap[
|
|
5816
|
+
for (const y of l) {
|
|
5817
|
+
const [b] = y;
|
|
5818
|
+
if (b === "add-attr") {
|
|
5819
|
+
const [m, T] = y, _ = s(T);
|
|
5820
|
+
if (_ && T.id !== _.id) {
|
|
5821
|
+
o.attrIdMap[T.id] = _.id, a = !0;
|
|
5847
5822
|
continue;
|
|
5848
5823
|
}
|
|
5849
|
-
if (
|
|
5850
|
-
const w = i(
|
|
5824
|
+
if (T["value-type"] === "ref") {
|
|
5825
|
+
const w = i(T);
|
|
5851
5826
|
if (w) {
|
|
5852
|
-
o.attrIdMap[
|
|
5827
|
+
o.attrIdMap[T.id] = w.id, o.refSwapAttrIds.add(T.id), a = !0;
|
|
5853
5828
|
continue;
|
|
5854
5829
|
}
|
|
5855
5830
|
}
|
|
5856
5831
|
}
|
|
5857
|
-
if (r && f && r >= f &&
|
|
5832
|
+
if (r && f && r >= f && b === "add-attr" || b === "update-attr" || b === "delete-attr") {
|
|
5858
5833
|
a = !0;
|
|
5859
5834
|
continue;
|
|
5860
5835
|
}
|
|
5861
|
-
const g = a ?
|
|
5836
|
+
const g = a ? Ma(o, y) : y;
|
|
5862
5837
|
d.push(g);
|
|
5863
5838
|
}
|
|
5864
5839
|
return a ? d : l;
|
|
@@ -5911,12 +5886,12 @@ class su {
|
|
|
5911
5886
|
if (l && s === l.querySubVersion && o === l.pendingMutationsVersion)
|
|
5912
5887
|
return l;
|
|
5913
5888
|
let f = u.store, d = u.attrsStore;
|
|
5914
|
-
const { pageInfo:
|
|
5889
|
+
const { pageInfo: y, aggregate: b, processedTxId: g } = u, m = this._rewriteMutationsSorted(d, a);
|
|
5915
5890
|
if (t) {
|
|
5916
|
-
const
|
|
5917
|
-
f =
|
|
5891
|
+
const _ = this._applyOptimisticUpdates(f, d, m, g);
|
|
5892
|
+
f = _.store, d = _.attrsStore;
|
|
5918
5893
|
}
|
|
5919
|
-
return { data: zs({ store: f, attrsStore: d, pageInfo:
|
|
5894
|
+
return { data: zs({ store: f, attrsStore: d, pageInfo: y, aggregate: b }, c), querySubVersion: s, pendingMutationsVersion: o };
|
|
5920
5895
|
}
|
|
5921
5896
|
_applyOptimisticUpdates(e, t, r, s) {
|
|
5922
5897
|
for (const [i, o] of r)
|
|
@@ -6111,18 +6086,18 @@ class su {
|
|
|
6111
6086
|
this._replaceUrlAfterOAuth();
|
|
6112
6087
|
try {
|
|
6113
6088
|
let u;
|
|
6114
|
-
const l = await this.kv.waitForKeyToLoad(
|
|
6115
|
-
s && l && (u = l[s]), l && this.kv.updateInPlace((
|
|
6116
|
-
delete
|
|
6089
|
+
const l = await this.kv.waitForKeyToLoad(xt);
|
|
6090
|
+
s && l && (u = l[s]), l && this.kv.updateInPlace((b) => {
|
|
6091
|
+
delete b[xt];
|
|
6117
6092
|
});
|
|
6118
|
-
const f = await this._getCurrentUser(), d = (f == null ? void 0 : f.type) === "guest", { user:
|
|
6093
|
+
const f = await this._getCurrentUser(), d = (f == null ? void 0 : f.type) === "guest", { user: y } = await Wr({
|
|
6119
6094
|
apiURI: this.config.apiURI,
|
|
6120
6095
|
appId: this.config.appId,
|
|
6121
6096
|
code: r,
|
|
6122
6097
|
refreshToken: d ? f.refresh_token : void 0,
|
|
6123
6098
|
extraFields: u
|
|
6124
6099
|
});
|
|
6125
|
-
return this.setCurrentUser(
|
|
6100
|
+
return this.setCurrentUser(y), null;
|
|
6126
6101
|
} catch (u) {
|
|
6127
6102
|
return ((i = u == null ? void 0 : u.body) == null ? void 0 : i.type) === "record-not-found" && ((a = (o = u == null ? void 0 : u.body) == null ? void 0 : o.hint) == null ? void 0 : a["record-type"]) === "app-oauth-code" && await this._hasCurrentUser() ? null : { error: { message: ((c = u == null ? void 0 : u.body) == null ? void 0 : c.message) || "Error logging in." } };
|
|
6128
6103
|
}
|
|
@@ -6141,7 +6116,7 @@ class su {
|
|
|
6141
6116
|
t.isLoading || e(this._currentUserCached);
|
|
6142
6117
|
let r = !1;
|
|
6143
6118
|
return this.getCurrentUser().then((s) => {
|
|
6144
|
-
r ||
|
|
6119
|
+
r || Nt(s, t) || e(s);
|
|
6145
6120
|
}), () => {
|
|
6146
6121
|
r = !0, this.authCbs = this.authCbs.filter((s) => s !== e);
|
|
6147
6122
|
};
|
|
@@ -6149,7 +6124,7 @@ class su {
|
|
|
6149
6124
|
async getAuth() {
|
|
6150
6125
|
const { user: e, error: t } = await this.getCurrentUser();
|
|
6151
6126
|
if (t)
|
|
6152
|
-
throw new
|
|
6127
|
+
throw new ue("Could not get current user: " + t.message);
|
|
6153
6128
|
return e ?? null;
|
|
6154
6129
|
}
|
|
6155
6130
|
subscribeConnectionStatus(e) {
|
|
@@ -6157,21 +6132,6 @@ class su {
|
|
|
6157
6132
|
this.connectionStatusCbs = this.connectionStatusCbs.filter((t) => t !== e);
|
|
6158
6133
|
};
|
|
6159
6134
|
}
|
|
6160
|
-
/**
|
|
6161
|
-
* @param {'active' | 'read-only' | 'disabled' | undefined} status
|
|
6162
|
-
*/
|
|
6163
|
-
_setAppStatus(e) {
|
|
6164
|
-
!e || e === this._appStatusState.status || (this._appStatusState = {
|
|
6165
|
-
isLoading: !1,
|
|
6166
|
-
isReadOnly: e !== "active",
|
|
6167
|
-
status: e
|
|
6168
|
-
}, this.notifyAppStatusSubs(this._appStatusState));
|
|
6169
|
-
}
|
|
6170
|
-
subscribeAppStatus(e) {
|
|
6171
|
-
return this.appStatusCbs.push(e), e(this._appStatusState), () => {
|
|
6172
|
-
this.appStatusCbs = this.appStatusCbs.filter((t) => t !== e);
|
|
6173
|
-
};
|
|
6174
|
-
}
|
|
6175
6135
|
subscribeAttrs(e) {
|
|
6176
6136
|
return this.attrsCbs.push(e), this.attrs && e(this.attrs.attrs), () => {
|
|
6177
6137
|
this.attrsCbs = this.attrsCbs.filter((t) => t !== e);
|
|
@@ -6192,9 +6152,6 @@ class su {
|
|
|
6192
6152
|
notifyConnectionStatusSubs(e) {
|
|
6193
6153
|
this.connectionStatusCbs.forEach((t) => t(e));
|
|
6194
6154
|
}
|
|
6195
|
-
notifyAppStatusSubs(e) {
|
|
6196
|
-
this.appStatusCbs.forEach((t) => t(e));
|
|
6197
|
-
}
|
|
6198
6155
|
async setCurrentUser(e) {
|
|
6199
6156
|
this.kv.updateInPlace((t) => {
|
|
6200
6157
|
t[Ge] = e;
|
|
@@ -6243,7 +6200,7 @@ class su {
|
|
|
6243
6200
|
async changeCurrentUser(e) {
|
|
6244
6201
|
var r;
|
|
6245
6202
|
const { user: t } = await this.getCurrentUser();
|
|
6246
|
-
if (!
|
|
6203
|
+
if (!Nt(t, e)) {
|
|
6247
6204
|
this._frameworkClient = null, await this.setCurrentUser(e), await this.updateUser(e);
|
|
6248
6205
|
try {
|
|
6249
6206
|
await this.kv.flush(), (r = this._broadcastChannel) == null || r.postMessage({ type: "auth" });
|
|
@@ -6379,8 +6336,8 @@ class su {
|
|
|
6379
6336
|
if (r) {
|
|
6380
6337
|
const a = `${Math.random().toString(36).slice(2)}`;
|
|
6381
6338
|
this.kv.updateInPlace((c) => {
|
|
6382
|
-
const u = c[
|
|
6383
|
-
u[a] = r, c[
|
|
6339
|
+
const u = c[xt] || {};
|
|
6340
|
+
u[a] = r, c[xt] = u;
|
|
6384
6341
|
}), o = `${t}${t.includes("?") ? "&" : "?"}${gn}=${a}`;
|
|
6385
6342
|
}
|
|
6386
6343
|
return `${s}/runtime/oauth/start?app_id=${i}&client_name=${e}&redirect_uri=${encodeURIComponent(o)}`;
|
|
@@ -6539,7 +6496,7 @@ class su {
|
|
|
6539
6496
|
Ir(u, l, d);
|
|
6540
6497
|
break;
|
|
6541
6498
|
case "-":
|
|
6542
|
-
|
|
6499
|
+
ks(u, l);
|
|
6543
6500
|
break;
|
|
6544
6501
|
}
|
|
6545
6502
|
delete u[this._sessionId];
|
|
@@ -6584,8 +6541,8 @@ class su {
|
|
|
6584
6541
|
_notifyBroadcastSubs(e, t, r) {
|
|
6585
6542
|
var s, i, o;
|
|
6586
6543
|
(o = (i = (s = this._broadcastSubs) == null ? void 0 : s[e]) == null ? void 0 : i[t]) == null || o.forEach((a) => {
|
|
6587
|
-
var l, f, d,
|
|
6588
|
-
const c = (l = r.data) == null ? void 0 : l.data, u = r.data["peer-id"] === this._sessionId ? (d = (f = this._presence[e]) == null ? void 0 : f.result) == null ? void 0 : d.user : (g = (
|
|
6544
|
+
var l, f, d, y, b, g;
|
|
6545
|
+
const c = (l = r.data) == null ? void 0 : l.data, u = r.data["peer-id"] === this._sessionId ? (d = (f = this._presence[e]) == null ? void 0 : f.result) == null ? void 0 : d.user : (g = (b = (y = this._presence[e]) == null ? void 0 : y.result) == null ? void 0 : b.peers) == null ? void 0 : g[r.data["peer-id"]];
|
|
6589
6546
|
return a(c, u);
|
|
6590
6547
|
});
|
|
6591
6548
|
}
|
|
@@ -6701,7 +6658,7 @@ function hu({ entities: n, links: e, rooms: t }) {
|
|
|
6701
6658
|
s
|
|
6702
6659
|
);
|
|
6703
6660
|
}
|
|
6704
|
-
const
|
|
6661
|
+
const fl = {
|
|
6705
6662
|
// constructs
|
|
6706
6663
|
graph: iu,
|
|
6707
6664
|
schema: hu,
|
|
@@ -6714,9 +6671,9 @@ const dl = {
|
|
|
6714
6671
|
json: fu,
|
|
6715
6672
|
any: du
|
|
6716
6673
|
};
|
|
6717
|
-
let
|
|
6674
|
+
let $t;
|
|
6718
6675
|
function pu(n, e) {
|
|
6719
|
-
|
|
6676
|
+
$t == null || $t.dispose();
|
|
6720
6677
|
const t = wu(e), r = gu(e, a), s = bu(yu(n));
|
|
6721
6678
|
function i(l) {
|
|
6722
6679
|
var f;
|
|
@@ -6733,7 +6690,7 @@ function pu(n, e) {
|
|
|
6733
6690
|
t.element.remove(), r.element.remove(), removeEventListener("keydown", o), removeEventListener("message", i);
|
|
6734
6691
|
}
|
|
6735
6692
|
function u() {
|
|
6736
|
-
document.body.appendChild(t.element), document.body.appendChild(r.element), addEventListener("keydown", o), addEventListener("message", i),
|
|
6693
|
+
document.body.appendChild(t.element), document.body.appendChild(r.element), addEventListener("keydown", o), addEventListener("message", i), $t = {
|
|
6737
6694
|
dispose: c
|
|
6738
6695
|
};
|
|
6739
6696
|
}
|
|
@@ -6832,29 +6789,29 @@ function Su(n, e) {
|
|
|
6832
6789
|
}
|
|
6833
6790
|
});
|
|
6834
6791
|
}
|
|
6835
|
-
function
|
|
6792
|
+
function Dt(n, e) {
|
|
6836
6793
|
return new Response(JSON.stringify({ ok: !1, error: e }), {
|
|
6837
6794
|
status: n,
|
|
6838
6795
|
headers: { "Content-Type": "application/json" }
|
|
6839
6796
|
});
|
|
6840
6797
|
}
|
|
6841
|
-
const
|
|
6798
|
+
const dl = (n) => ({
|
|
6842
6799
|
POST: async (e) => {
|
|
6843
6800
|
let t;
|
|
6844
6801
|
try {
|
|
6845
6802
|
t = await e.json();
|
|
6846
6803
|
} catch {
|
|
6847
|
-
return
|
|
6804
|
+
return Dt(400, "Invalid JSON body");
|
|
6848
6805
|
}
|
|
6849
6806
|
if (!t.type)
|
|
6850
|
-
return
|
|
6807
|
+
return Dt(400, 'Missing "type" field');
|
|
6851
6808
|
if (t.appId !== n.appId)
|
|
6852
|
-
return
|
|
6809
|
+
return Dt(403, "App ID mismatch");
|
|
6853
6810
|
switch (t.type) {
|
|
6854
6811
|
case "sync-user":
|
|
6855
6812
|
return Su(n, t.user ?? null);
|
|
6856
6813
|
default:
|
|
6857
|
-
return
|
|
6814
|
+
return Dt(400, `Unknown type: ${t.type}`);
|
|
6858
6815
|
}
|
|
6859
6816
|
}
|
|
6860
6817
|
});
|
|
@@ -6891,157 +6848,157 @@ const Tu = (n) => JSON.stringify(n), gt = (n, e = !1) => JSON.stringify([n, e]),
|
|
|
6891
6848
|
...Array.from(n.values()).flatMap((s) => s.data)
|
|
6892
6849
|
];
|
|
6893
6850
|
return { chunks: t, data: r };
|
|
6894
|
-
}, mn = ["bootstrap", "bootstrap", "bootstrap", 1],
|
|
6851
|
+
}, mn = ["bootstrap", "bootstrap", "bootstrap", 1], ku = (n, e, t, r) => {
|
|
6895
6852
|
var G, V, ne, q;
|
|
6896
6853
|
const { entityName: s, entityQuery: i } = oi(e), o = ((G = i.$) == null ? void 0 : G.limit) || 10, a = s, c = ii((V = i.$) == null ? void 0 : V.order), u = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map(), f = /* @__PURE__ */ new Map();
|
|
6897
|
-
let d = !1,
|
|
6898
|
-
const
|
|
6854
|
+
let d = !1, y = !0, b = null, g = null;
|
|
6855
|
+
const m = (k) => {
|
|
6899
6856
|
t({ error: k, data: void 0, canLoadNextPage: !1 });
|
|
6900
|
-
},
|
|
6901
|
-
if (!
|
|
6857
|
+
}, T = () => {
|
|
6858
|
+
if (!y)
|
|
6902
6859
|
return;
|
|
6903
|
-
const { chunks: k, data:
|
|
6860
|
+
const { chunks: k, data: j } = Ou(u, l);
|
|
6904
6861
|
t({
|
|
6905
|
-
data: { [a]:
|
|
6862
|
+
data: { [a]: j },
|
|
6906
6863
|
// @ts-expect-error hidden debug variable
|
|
6907
6864
|
chunks: k,
|
|
6908
6865
|
canLoadNextPage: Eu(u)
|
|
6909
6866
|
});
|
|
6910
|
-
},
|
|
6911
|
-
u.set(gt(k,
|
|
6912
|
-
}, w = (k,
|
|
6913
|
-
l.set(gt(k),
|
|
6914
|
-
},
|
|
6915
|
-
var
|
|
6916
|
-
const { cursor:
|
|
6917
|
-
|
|
6918
|
-
const
|
|
6867
|
+
}, _ = (k, j) => {
|
|
6868
|
+
u.set(gt(k, j.afterInclusive), j), T();
|
|
6869
|
+
}, w = (k, j) => {
|
|
6870
|
+
l.set(gt(k), j), P(), T();
|
|
6871
|
+
}, C = (k, j) => {
|
|
6872
|
+
var O, A;
|
|
6873
|
+
const { cursor: R } = ns(k), F = f.get(He("reverse", R));
|
|
6874
|
+
F == null || F();
|
|
6875
|
+
const N = n.subscribeQuery({
|
|
6919
6876
|
[a]: {
|
|
6920
6877
|
...i,
|
|
6921
6878
|
$: {
|
|
6922
|
-
after:
|
|
6923
|
-
before:
|
|
6879
|
+
after: R,
|
|
6880
|
+
before: j.endCursor,
|
|
6924
6881
|
beforeInclusive: !0,
|
|
6925
|
-
where: (
|
|
6926
|
-
fields: (
|
|
6882
|
+
where: (O = i.$) == null ? void 0 : O.where,
|
|
6883
|
+
fields: (A = i.$) == null ? void 0 : A.fields,
|
|
6927
6884
|
order: rs(c)
|
|
6928
6885
|
}
|
|
6929
6886
|
}
|
|
6930
6887
|
}, (W) => {
|
|
6931
6888
|
if (W.error)
|
|
6932
|
-
return
|
|
6889
|
+
return m(W.error);
|
|
6933
6890
|
const J = W.data[a], X = W.pageInfo[a];
|
|
6934
|
-
lt(J && X, "Expected query subscription to contain rows and pageInfo"), w(
|
|
6891
|
+
lt(J && X, "Expected query subscription to contain rows and pageInfo"), w(R, {
|
|
6935
6892
|
data: J,
|
|
6936
6893
|
status: "frozen",
|
|
6937
6894
|
hasMore: X.hasNextPage,
|
|
6938
6895
|
endCursor: X.endCursor
|
|
6939
6896
|
});
|
|
6940
6897
|
}, r);
|
|
6941
|
-
f.set(He("reverse",
|
|
6942
|
-
},
|
|
6943
|
-
var
|
|
6944
|
-
const
|
|
6898
|
+
f.set(He("reverse", R), N);
|
|
6899
|
+
}, v = (k) => {
|
|
6900
|
+
var R, F;
|
|
6901
|
+
const j = n.subscribeQuery({
|
|
6945
6902
|
[a]: {
|
|
6946
6903
|
...i,
|
|
6947
6904
|
$: {
|
|
6948
6905
|
limit: o,
|
|
6949
6906
|
after: k,
|
|
6950
|
-
where: (
|
|
6951
|
-
fields: (
|
|
6907
|
+
where: (R = i.$) == null ? void 0 : R.where,
|
|
6908
|
+
fields: (F = i.$) == null ? void 0 : F.fields,
|
|
6952
6909
|
order: rs(c)
|
|
6953
6910
|
}
|
|
6954
6911
|
}
|
|
6955
|
-
}, (
|
|
6956
|
-
if (
|
|
6957
|
-
return
|
|
6958
|
-
const
|
|
6959
|
-
lt(
|
|
6960
|
-
data:
|
|
6912
|
+
}, (N) => {
|
|
6913
|
+
if (N.error)
|
|
6914
|
+
return m(N.error);
|
|
6915
|
+
const O = N.data[a], A = N.pageInfo[a];
|
|
6916
|
+
lt(O && A, "Expected rows and pageInfo"), w(k, {
|
|
6917
|
+
data: O,
|
|
6961
6918
|
status: "bootstrapping",
|
|
6962
|
-
hasMore:
|
|
6963
|
-
endCursor:
|
|
6919
|
+
hasMore: A.hasNextPage,
|
|
6920
|
+
endCursor: A.endCursor
|
|
6964
6921
|
});
|
|
6965
6922
|
}, r);
|
|
6966
|
-
f.set(He("reverse", k),
|
|
6967
|
-
},
|
|
6968
|
-
var
|
|
6969
|
-
const
|
|
6923
|
+
f.set(He("reverse", k), j);
|
|
6924
|
+
}, U = (k, j = !1) => {
|
|
6925
|
+
var F, N;
|
|
6926
|
+
const R = n.subscribeQuery({
|
|
6970
6927
|
[a]: {
|
|
6971
6928
|
...i,
|
|
6972
6929
|
$: {
|
|
6973
6930
|
limit: o,
|
|
6974
6931
|
after: k,
|
|
6975
|
-
afterInclusive:
|
|
6976
|
-
where: (
|
|
6977
|
-
fields: (
|
|
6932
|
+
afterInclusive: j,
|
|
6933
|
+
where: (F = i.$) == null ? void 0 : F.where,
|
|
6934
|
+
fields: (N = i.$) == null ? void 0 : N.fields,
|
|
6978
6935
|
order: c
|
|
6979
6936
|
}
|
|
6980
6937
|
}
|
|
6981
|
-
}, (
|
|
6982
|
-
if (
|
|
6983
|
-
return
|
|
6984
|
-
const
|
|
6985
|
-
lt(
|
|
6986
|
-
data:
|
|
6938
|
+
}, (O) => {
|
|
6939
|
+
if (O.error)
|
|
6940
|
+
return m(O.error);
|
|
6941
|
+
const A = O.data[a], W = O.pageInfo[a];
|
|
6942
|
+
lt(A && W, "Page info and rows"), _(k, {
|
|
6943
|
+
data: A,
|
|
6987
6944
|
status: "bootstrapping",
|
|
6988
6945
|
hasMore: W.hasNextPage,
|
|
6989
6946
|
endCursor: W.endCursor,
|
|
6990
|
-
afterInclusive:
|
|
6947
|
+
afterInclusive: j
|
|
6991
6948
|
});
|
|
6992
6949
|
}, r);
|
|
6993
|
-
f.set(He("forward", k,
|
|
6994
|
-
}, I = (k,
|
|
6995
|
-
var
|
|
6996
|
-
const
|
|
6997
|
-
|
|
6998
|
-
const
|
|
6999
|
-
if (!(
|
|
6950
|
+
f.set(He("forward", k, j), R);
|
|
6951
|
+
}, I = (k, j = !1) => {
|
|
6952
|
+
var A, W;
|
|
6953
|
+
const R = gt(k, j), F = f.get(He("forward", k, j));
|
|
6954
|
+
F == null || F();
|
|
6955
|
+
const N = u.get(R);
|
|
6956
|
+
if (!(N != null && N.endCursor))
|
|
7000
6957
|
return;
|
|
7001
|
-
const
|
|
6958
|
+
const O = n.subscribeQuery({
|
|
7002
6959
|
[a]: {
|
|
7003
6960
|
...i,
|
|
7004
6961
|
$: {
|
|
7005
6962
|
after: k,
|
|
7006
|
-
afterInclusive:
|
|
7007
|
-
before:
|
|
6963
|
+
afterInclusive: N.afterInclusive,
|
|
6964
|
+
before: N.endCursor,
|
|
7008
6965
|
beforeInclusive: !0,
|
|
7009
|
-
where: (
|
|
6966
|
+
where: (A = i.$) == null ? void 0 : A.where,
|
|
7010
6967
|
fields: (W = i.$) == null ? void 0 : W.fields,
|
|
7011
6968
|
order: c
|
|
7012
6969
|
}
|
|
7013
6970
|
}
|
|
7014
6971
|
}, (J) => {
|
|
7015
6972
|
if (J.error)
|
|
7016
|
-
return
|
|
6973
|
+
return m(J.error);
|
|
7017
6974
|
const X = J.data[a], le = J.pageInfo[a];
|
|
7018
|
-
lt(X && le, "Expected rows and pageInfo"),
|
|
6975
|
+
lt(X && le, "Expected rows and pageInfo"), _(k, {
|
|
7019
6976
|
data: X,
|
|
7020
6977
|
status: "frozen",
|
|
7021
6978
|
hasMore: le.hasNextPage,
|
|
7022
6979
|
endCursor: le.endCursor,
|
|
7023
|
-
afterInclusive:
|
|
6980
|
+
afterInclusive: N.afterInclusive
|
|
7024
6981
|
});
|
|
7025
6982
|
}, r);
|
|
7026
|
-
f.set(He("forward", k,
|
|
7027
|
-
},
|
|
6983
|
+
f.set(He("forward", k, j), O);
|
|
6984
|
+
}, P = () => {
|
|
7028
6985
|
const k = Array.from(l.entries()).at(-1);
|
|
7029
6986
|
if (!k)
|
|
7030
6987
|
return;
|
|
7031
|
-
const [
|
|
7032
|
-
if (!(
|
|
6988
|
+
const [j, R] = k;
|
|
6989
|
+
if (!(R != null && R.hasMore) || !vu(R))
|
|
7033
6990
|
return;
|
|
7034
|
-
const
|
|
7035
|
-
|
|
6991
|
+
const F = `${j}:${Tu(R.endCursor)}`;
|
|
6992
|
+
F != b && (b = F, C(j, R), v(R.endCursor));
|
|
7036
6993
|
}, H = () => {
|
|
7037
6994
|
const k = Array.from(u.entries()).at(-1);
|
|
7038
6995
|
if (!k)
|
|
7039
6996
|
return;
|
|
7040
|
-
const [
|
|
7041
|
-
if (!
|
|
6997
|
+
const [j, R] = k;
|
|
6998
|
+
if (!R.endCursor)
|
|
7042
6999
|
return;
|
|
7043
|
-
const { cursor:
|
|
7044
|
-
I(
|
|
7000
|
+
const { cursor: F, afterInclusive: N } = ns(j);
|
|
7001
|
+
I(F, N), U(R.endCursor);
|
|
7045
7002
|
};
|
|
7046
7003
|
return g = n.subscribeQuery({
|
|
7047
7004
|
[a]: {
|
|
@@ -7054,32 +7011,32 @@ const Tu = (n) => JSON.stringify(n), gt = (n, e = !1) => JSON.stringify([n, e]),
|
|
|
7054
7011
|
}
|
|
7055
7012
|
}
|
|
7056
7013
|
}, async (k) => {
|
|
7057
|
-
var
|
|
7014
|
+
var N;
|
|
7058
7015
|
if (d)
|
|
7059
7016
|
return;
|
|
7060
7017
|
if (k.error)
|
|
7061
|
-
return
|
|
7062
|
-
const
|
|
7063
|
-
if (lt(
|
|
7064
|
-
|
|
7065
|
-
data:
|
|
7018
|
+
return m(k.error);
|
|
7019
|
+
const j = k.pageInfo[a], R = (N = k == null ? void 0 : k.data) == null ? void 0 : N[a];
|
|
7020
|
+
if (lt(R && j, "Expected rows and pageInfo"), R.length < o) {
|
|
7021
|
+
_(mn, {
|
|
7022
|
+
data: R,
|
|
7066
7023
|
status: "pre-bootstrap"
|
|
7067
7024
|
});
|
|
7068
7025
|
return;
|
|
7069
7026
|
}
|
|
7070
|
-
const
|
|
7071
|
-
if (!
|
|
7072
|
-
|
|
7073
|
-
data:
|
|
7027
|
+
const F = j.startCursor;
|
|
7028
|
+
if (!F) {
|
|
7029
|
+
_(mn, {
|
|
7030
|
+
data: R,
|
|
7074
7031
|
status: "pre-bootstrap"
|
|
7075
7032
|
});
|
|
7076
7033
|
return;
|
|
7077
7034
|
}
|
|
7078
|
-
u.delete(gt(mn)),
|
|
7035
|
+
u.delete(gt(mn)), U(F, !0), v(j.startCursor), d = !0;
|
|
7079
7036
|
}, r), {
|
|
7080
7037
|
unsubscribe: () => {
|
|
7081
|
-
if (
|
|
7082
|
-
|
|
7038
|
+
if (y) {
|
|
7039
|
+
y = !1, g == null || g(), g = null;
|
|
7083
7040
|
for (const k of f.values())
|
|
7084
7041
|
k == null || k();
|
|
7085
7042
|
f.clear();
|
|
@@ -7124,7 +7081,7 @@ const Tu = (n) => JSON.stringify(n), gt = (n, e = !1) => JSON.stringify([n, e]),
|
|
|
7124
7081
|
if (!t || !r)
|
|
7125
7082
|
throw new B("No query provided for infinite query");
|
|
7126
7083
|
return { entityName: t, entityQuery: r };
|
|
7127
|
-
},
|
|
7084
|
+
}, Au = {
|
|
7128
7085
|
apiURI: "https://api.instantdb.com",
|
|
7129
7086
|
websocketURI: "wss://api.instantdb.com/runtime/session"
|
|
7130
7087
|
};
|
|
@@ -7256,7 +7213,7 @@ class Pu {
|
|
|
7256
7213
|
this.db = e;
|
|
7257
7214
|
}
|
|
7258
7215
|
}
|
|
7259
|
-
class
|
|
7216
|
+
class Mu {
|
|
7260
7217
|
constructor(e) {
|
|
7261
7218
|
p(this, "db");
|
|
7262
7219
|
/**
|
|
@@ -7314,7 +7271,7 @@ class Ru {
|
|
|
7314
7271
|
this.db = e;
|
|
7315
7272
|
}
|
|
7316
7273
|
}
|
|
7317
|
-
class
|
|
7274
|
+
class Ru {
|
|
7318
7275
|
constructor(e) {
|
|
7319
7276
|
p(this, "db");
|
|
7320
7277
|
/**
|
|
@@ -7350,7 +7307,7 @@ class ju {
|
|
|
7350
7307
|
p(this, "storage");
|
|
7351
7308
|
p(this, "streams");
|
|
7352
7309
|
p(this, "tx", ir());
|
|
7353
|
-
this._reactor = e, this.auth = new Pu(this._reactor), this.storage = new
|
|
7310
|
+
this._reactor = e, this.auth = new Pu(this._reactor), this.storage = new Mu(this._reactor), this.streams = new Ru(this._reactor);
|
|
7354
7311
|
}
|
|
7355
7312
|
/**
|
|
7356
7313
|
* Use this to write data! You can create, update, delete, and link objects
|
|
@@ -7428,7 +7385,7 @@ class ju {
|
|
|
7428
7385
|
* });
|
|
7429
7386
|
*/
|
|
7430
7387
|
subscribeInfiniteQuery(e, t, r) {
|
|
7431
|
-
return
|
|
7388
|
+
return ku(this, e, t, r);
|
|
7432
7389
|
}
|
|
7433
7390
|
/**
|
|
7434
7391
|
* Listen for the logged in state. This is useful
|
|
@@ -7484,20 +7441,6 @@ class ju {
|
|
|
7484
7441
|
subscribeConnectionStatus(e) {
|
|
7485
7442
|
return this._reactor.subscribeConnectionStatus(e);
|
|
7486
7443
|
}
|
|
7487
|
-
/**
|
|
7488
|
-
* Observe the app's maintenance-mode state. While read-only, reads and
|
|
7489
|
-
* live queries keep working but writes are rejected. The callback fires
|
|
7490
|
-
* immediately with the current state and again on every change.
|
|
7491
|
-
*
|
|
7492
|
-
* @example
|
|
7493
|
-
* const unsub = db.subscribeAppStatus(({ isLoading, isReadOnly }) => {
|
|
7494
|
-
* if (isLoading) return;
|
|
7495
|
-
* if (isReadOnly) showMaintenanceBanner();
|
|
7496
|
-
* });
|
|
7497
|
-
*/
|
|
7498
|
-
subscribeAppStatus(e) {
|
|
7499
|
-
return this._reactor.subscribeAppStatus(e);
|
|
7500
|
-
}
|
|
7501
7444
|
/**
|
|
7502
7445
|
* Join a room to publish and subscribe to topics and presence.
|
|
7503
7446
|
*
|
|
@@ -7566,7 +7509,7 @@ function os(n) {
|
|
|
7566
7509
|
const e = is.get(n);
|
|
7567
7510
|
if (e)
|
|
7568
7511
|
return e;
|
|
7569
|
-
const t =
|
|
7512
|
+
const t = ce(n);
|
|
7570
7513
|
return is.set(n, t), t;
|
|
7571
7514
|
}
|
|
7572
7515
|
function xu(n, e) {
|
|
@@ -7582,7 +7525,7 @@ function $u(n, e, t, r, s) {
|
|
|
7582
7525
|
if (o)
|
|
7583
7526
|
return xu(o, i.schema) && o._reactor.updateSchema(i.schema), o;
|
|
7584
7527
|
const a = new su({
|
|
7585
|
-
...
|
|
7528
|
+
...Au,
|
|
7586
7529
|
...i,
|
|
7587
7530
|
cardinalityInference: !!i.schema
|
|
7588
7531
|
}, e || Bs, t || Gs, { ...r || {}, "@instantdb/core": ar }, s), c = new ju(a);
|
|
@@ -7614,11 +7557,11 @@ function Uu() {
|
|
|
7614
7557
|
as = 1;
|
|
7615
7558
|
var n = ys, e = Symbol.for("react.element"), t = Symbol.for("react.fragment"), r = Object.prototype.hasOwnProperty, s = n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, i = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
7616
7559
|
function o(a, c, u) {
|
|
7617
|
-
var l, f = {}, d = null,
|
|
7618
|
-
u !== void 0 && (d = "" + u), c.key !== void 0 && (d = "" + c.key), c.ref !== void 0 && (
|
|
7560
|
+
var l, f = {}, d = null, y = null;
|
|
7561
|
+
u !== void 0 && (d = "" + u), c.key !== void 0 && (d = "" + c.key), c.ref !== void 0 && (y = c.ref);
|
|
7619
7562
|
for (l in c) r.call(c, l) && !i.hasOwnProperty(l) && (f[l] = c[l]);
|
|
7620
7563
|
if (a && a.defaultProps) for (l in c = a.defaultProps, c) f[l] === void 0 && (f[l] = c[l]);
|
|
7621
|
-
return { $$typeof: e, type: a, key: d, ref:
|
|
7564
|
+
return { $$typeof: e, type: a, key: d, ref: y, props: f, _owner: s.current };
|
|
7622
7565
|
}
|
|
7623
7566
|
return ft.Fragment = t, ft.jsx = o, ft.jsxs = o, ft;
|
|
7624
7567
|
}
|
|
@@ -7637,46 +7580,46 @@ function Lu() {
|
|
|
7637
7580
|
* LICENSE file in the root directory of this source tree.
|
|
7638
7581
|
*/
|
|
7639
7582
|
return n.NODE_ENV !== "production" && function() {
|
|
7640
|
-
var e = ys, t = Symbol.for("react.element"), r = Symbol.for("react.portal"), s = Symbol.for("react.fragment"), i = Symbol.for("react.strict_mode"), o = Symbol.for("react.profiler"), a = Symbol.for("react.provider"), c = Symbol.for("react.context"), u = Symbol.for("react.forward_ref"), l = Symbol.for("react.suspense"), f = Symbol.for("react.suspense_list"), d = Symbol.for("react.memo"),
|
|
7641
|
-
function
|
|
7583
|
+
var e = ys, t = Symbol.for("react.element"), r = Symbol.for("react.portal"), s = Symbol.for("react.fragment"), i = Symbol.for("react.strict_mode"), o = Symbol.for("react.profiler"), a = Symbol.for("react.provider"), c = Symbol.for("react.context"), u = Symbol.for("react.forward_ref"), l = Symbol.for("react.suspense"), f = Symbol.for("react.suspense_list"), d = Symbol.for("react.memo"), y = Symbol.for("react.lazy"), b = Symbol.for("react.offscreen"), g = Symbol.iterator, m = "@@iterator";
|
|
7584
|
+
function T(h) {
|
|
7642
7585
|
if (h === null || typeof h != "object")
|
|
7643
7586
|
return null;
|
|
7644
|
-
var
|
|
7645
|
-
return typeof
|
|
7587
|
+
var S = g && h[g] || h[m];
|
|
7588
|
+
return typeof S == "function" ? S : null;
|
|
7646
7589
|
}
|
|
7647
|
-
var
|
|
7590
|
+
var _ = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
7648
7591
|
function w(h) {
|
|
7649
7592
|
{
|
|
7650
|
-
for (var
|
|
7651
|
-
|
|
7652
|
-
|
|
7593
|
+
for (var S = arguments.length, E = new Array(S > 1 ? S - 1 : 0), M = 1; M < S; M++)
|
|
7594
|
+
E[M - 1] = arguments[M];
|
|
7595
|
+
C("error", h, E);
|
|
7653
7596
|
}
|
|
7654
7597
|
}
|
|
7655
|
-
function
|
|
7598
|
+
function C(h, S, E) {
|
|
7656
7599
|
{
|
|
7657
|
-
var
|
|
7658
|
-
z !== "" && (
|
|
7659
|
-
var Q =
|
|
7660
|
-
return String(
|
|
7600
|
+
var M = _.ReactDebugCurrentFrame, z = M.getStackAddendum();
|
|
7601
|
+
z !== "" && (S += "%s", E = E.concat([z]));
|
|
7602
|
+
var Q = E.map(function(L) {
|
|
7603
|
+
return String(L);
|
|
7661
7604
|
});
|
|
7662
|
-
Q.unshift("Warning: " +
|
|
7605
|
+
Q.unshift("Warning: " + S), Function.prototype.apply.call(console[h], console, Q);
|
|
7663
7606
|
}
|
|
7664
7607
|
}
|
|
7665
|
-
var
|
|
7666
|
-
|
|
7608
|
+
var v = !1, U = !1, I = !1, P = !1, H = !1, K;
|
|
7609
|
+
K = Symbol.for("react.module.reference");
|
|
7667
7610
|
function G(h) {
|
|
7668
|
-
return !!(typeof h == "string" || typeof h == "function" || h === s || h === o || H || h === i || h === l || h === f ||
|
|
7611
|
+
return !!(typeof h == "string" || typeof h == "function" || h === s || h === o || H || h === i || h === l || h === f || P || h === b || v || U || I || typeof h == "object" && h !== null && (h.$$typeof === y || h.$$typeof === d || h.$$typeof === a || h.$$typeof === c || h.$$typeof === u || // This needs to include all possible module reference object
|
|
7669
7612
|
// types supported by any Flight configuration anywhere since
|
|
7670
7613
|
// we don't know which Flight build this will end up being used
|
|
7671
7614
|
// with.
|
|
7672
|
-
h.$$typeof ===
|
|
7615
|
+
h.$$typeof === K || h.getModuleId !== void 0));
|
|
7673
7616
|
}
|
|
7674
|
-
function V(h,
|
|
7675
|
-
var
|
|
7676
|
-
if (
|
|
7677
|
-
return
|
|
7678
|
-
var z =
|
|
7679
|
-
return z !== "" ?
|
|
7617
|
+
function V(h, S, E) {
|
|
7618
|
+
var M = h.displayName;
|
|
7619
|
+
if (M)
|
|
7620
|
+
return M;
|
|
7621
|
+
var z = S.displayName || S.name || "";
|
|
7622
|
+
return z !== "" ? E + "(" + z + ")" : E;
|
|
7680
7623
|
}
|
|
7681
7624
|
function ne(h) {
|
|
7682
7625
|
return h.displayName || "Context";
|
|
@@ -7705,20 +7648,20 @@ function Lu() {
|
|
|
7705
7648
|
if (typeof h == "object")
|
|
7706
7649
|
switch (h.$$typeof) {
|
|
7707
7650
|
case c:
|
|
7708
|
-
var
|
|
7709
|
-
return ne(
|
|
7651
|
+
var S = h;
|
|
7652
|
+
return ne(S) + ".Consumer";
|
|
7710
7653
|
case a:
|
|
7711
|
-
var
|
|
7712
|
-
return ne(
|
|
7654
|
+
var E = h;
|
|
7655
|
+
return ne(E._context) + ".Provider";
|
|
7713
7656
|
case u:
|
|
7714
7657
|
return V(h, h.render, "ForwardRef");
|
|
7715
7658
|
case d:
|
|
7716
|
-
var
|
|
7717
|
-
return
|
|
7718
|
-
case
|
|
7719
|
-
var z = h, Q = z._payload,
|
|
7659
|
+
var M = h.displayName || null;
|
|
7660
|
+
return M !== null ? M : q(h.type) || "Memo";
|
|
7661
|
+
case y: {
|
|
7662
|
+
var z = h, Q = z._payload, L = z._init;
|
|
7720
7663
|
try {
|
|
7721
|
-
return q(
|
|
7664
|
+
return q(L(Q));
|
|
7722
7665
|
} catch {
|
|
7723
7666
|
return null;
|
|
7724
7667
|
}
|
|
@@ -7726,14 +7669,14 @@ function Lu() {
|
|
|
7726
7669
|
}
|
|
7727
7670
|
return null;
|
|
7728
7671
|
}
|
|
7729
|
-
var k = Object.assign,
|
|
7672
|
+
var k = Object.assign, j = 0, R, F, N, O, A, W, J;
|
|
7730
7673
|
function X() {
|
|
7731
7674
|
}
|
|
7732
7675
|
X.__reactDisabledLog = !0;
|
|
7733
7676
|
function le() {
|
|
7734
7677
|
{
|
|
7735
|
-
if (
|
|
7736
|
-
|
|
7678
|
+
if (j === 0) {
|
|
7679
|
+
R = console.log, F = console.info, N = console.warn, O = console.error, A = console.group, W = console.groupCollapsed, J = console.groupEnd;
|
|
7737
7680
|
var h = {
|
|
7738
7681
|
configurable: !0,
|
|
7739
7682
|
enumerable: !0,
|
|
@@ -7750,12 +7693,12 @@ function Lu() {
|
|
|
7750
7693
|
groupEnd: h
|
|
7751
7694
|
});
|
|
7752
7695
|
}
|
|
7753
|
-
|
|
7696
|
+
j++;
|
|
7754
7697
|
}
|
|
7755
7698
|
}
|
|
7756
7699
|
function ct() {
|
|
7757
7700
|
{
|
|
7758
|
-
if (
|
|
7701
|
+
if (j--, j === 0) {
|
|
7759
7702
|
var h = {
|
|
7760
7703
|
configurable: !0,
|
|
7761
7704
|
enumerable: !0,
|
|
@@ -7763,19 +7706,19 @@ function Lu() {
|
|
|
7763
7706
|
};
|
|
7764
7707
|
Object.defineProperties(console, {
|
|
7765
7708
|
log: k({}, h, {
|
|
7766
|
-
value:
|
|
7709
|
+
value: R
|
|
7767
7710
|
}),
|
|
7768
7711
|
info: k({}, h, {
|
|
7769
|
-
value:
|
|
7712
|
+
value: F
|
|
7770
7713
|
}),
|
|
7771
7714
|
warn: k({}, h, {
|
|
7772
|
-
value:
|
|
7715
|
+
value: N
|
|
7773
7716
|
}),
|
|
7774
7717
|
error: k({}, h, {
|
|
7775
|
-
value:
|
|
7718
|
+
value: O
|
|
7776
7719
|
}),
|
|
7777
7720
|
group: k({}, h, {
|
|
7778
|
-
value:
|
|
7721
|
+
value: A
|
|
7779
7722
|
}),
|
|
7780
7723
|
groupCollapsed: k({}, h, {
|
|
7781
7724
|
value: W
|
|
@@ -7785,88 +7728,88 @@ function Lu() {
|
|
|
7785
7728
|
})
|
|
7786
7729
|
});
|
|
7787
7730
|
}
|
|
7788
|
-
|
|
7731
|
+
j < 0 && w("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
|
|
7789
7732
|
}
|
|
7790
7733
|
}
|
|
7791
|
-
var ve =
|
|
7792
|
-
function
|
|
7734
|
+
var ve = _.ReactCurrentDispatcher, rn;
|
|
7735
|
+
function At(h, S, E) {
|
|
7793
7736
|
{
|
|
7794
7737
|
if (rn === void 0)
|
|
7795
7738
|
try {
|
|
7796
7739
|
throw Error();
|
|
7797
7740
|
} catch (z) {
|
|
7798
|
-
var
|
|
7799
|
-
rn =
|
|
7741
|
+
var M = z.stack.trim().match(/\n( *(at )?)/);
|
|
7742
|
+
rn = M && M[1] || "";
|
|
7800
7743
|
}
|
|
7801
7744
|
return `
|
|
7802
7745
|
` + rn + h;
|
|
7803
7746
|
}
|
|
7804
7747
|
}
|
|
7805
|
-
var sn = !1,
|
|
7748
|
+
var sn = !1, Ct;
|
|
7806
7749
|
{
|
|
7807
7750
|
var li = typeof WeakMap == "function" ? WeakMap : Map;
|
|
7808
|
-
|
|
7751
|
+
Ct = new li();
|
|
7809
7752
|
}
|
|
7810
|
-
function ur(h,
|
|
7753
|
+
function ur(h, S) {
|
|
7811
7754
|
if (!h || sn)
|
|
7812
7755
|
return "";
|
|
7813
7756
|
{
|
|
7814
|
-
var
|
|
7815
|
-
if (
|
|
7816
|
-
return
|
|
7757
|
+
var E = Ct.get(h);
|
|
7758
|
+
if (E !== void 0)
|
|
7759
|
+
return E;
|
|
7817
7760
|
}
|
|
7818
|
-
var
|
|
7761
|
+
var M;
|
|
7819
7762
|
sn = !0;
|
|
7820
7763
|
var z = Error.prepareStackTrace;
|
|
7821
7764
|
Error.prepareStackTrace = void 0;
|
|
7822
7765
|
var Q;
|
|
7823
7766
|
Q = ve.current, ve.current = null, le();
|
|
7824
7767
|
try {
|
|
7825
|
-
if (
|
|
7826
|
-
var
|
|
7768
|
+
if (S) {
|
|
7769
|
+
var L = function() {
|
|
7827
7770
|
throw Error();
|
|
7828
7771
|
};
|
|
7829
|
-
if (Object.defineProperty(
|
|
7772
|
+
if (Object.defineProperty(L.prototype, "props", {
|
|
7830
7773
|
set: function() {
|
|
7831
7774
|
throw Error();
|
|
7832
7775
|
}
|
|
7833
7776
|
}), typeof Reflect == "object" && Reflect.construct) {
|
|
7834
7777
|
try {
|
|
7835
|
-
Reflect.construct(
|
|
7778
|
+
Reflect.construct(L, []);
|
|
7836
7779
|
} catch (pe) {
|
|
7837
|
-
|
|
7780
|
+
M = pe;
|
|
7838
7781
|
}
|
|
7839
|
-
Reflect.construct(h, [],
|
|
7782
|
+
Reflect.construct(h, [], L);
|
|
7840
7783
|
} else {
|
|
7841
7784
|
try {
|
|
7842
|
-
|
|
7785
|
+
L.call();
|
|
7843
7786
|
} catch (pe) {
|
|
7844
|
-
|
|
7787
|
+
M = pe;
|
|
7845
7788
|
}
|
|
7846
|
-
h.call(
|
|
7789
|
+
h.call(L.prototype);
|
|
7847
7790
|
}
|
|
7848
7791
|
} else {
|
|
7849
7792
|
try {
|
|
7850
7793
|
throw Error();
|
|
7851
7794
|
} catch (pe) {
|
|
7852
|
-
|
|
7795
|
+
M = pe;
|
|
7853
7796
|
}
|
|
7854
7797
|
h();
|
|
7855
7798
|
}
|
|
7856
7799
|
} catch (pe) {
|
|
7857
|
-
if (pe &&
|
|
7858
|
-
for (var
|
|
7859
|
-
`), fe =
|
|
7860
|
-
`), ee =
|
|
7800
|
+
if (pe && M && typeof pe.stack == "string") {
|
|
7801
|
+
for (var $ = pe.stack.split(`
|
|
7802
|
+
`), fe = M.stack.split(`
|
|
7803
|
+
`), ee = $.length - 1, re = fe.length - 1; ee >= 1 && re >= 0 && $[ee] !== fe[re]; )
|
|
7861
7804
|
re--;
|
|
7862
7805
|
for (; ee >= 1 && re >= 0; ee--, re--)
|
|
7863
|
-
if (
|
|
7806
|
+
if ($[ee] !== fe[re]) {
|
|
7864
7807
|
if (ee !== 1 || re !== 1)
|
|
7865
7808
|
do
|
|
7866
|
-
if (ee--, re--, re < 0 ||
|
|
7809
|
+
if (ee--, re--, re < 0 || $[ee] !== fe[re]) {
|
|
7867
7810
|
var Se = `
|
|
7868
|
-
` +
|
|
7869
|
-
return h.displayName && Se.includes("<anonymous>") && (Se = Se.replace("<anonymous>", h.displayName)), typeof h == "function" &&
|
|
7811
|
+
` + $[ee].replace(" at new ", " at ");
|
|
7812
|
+
return h.displayName && Se.includes("<anonymous>") && (Se = Se.replace("<anonymous>", h.displayName)), typeof h == "function" && Ct.set(h, Se), Se;
|
|
7870
7813
|
}
|
|
7871
7814
|
while (ee >= 1 && re >= 0);
|
|
7872
7815
|
break;
|
|
@@ -7875,69 +7818,69 @@ function Lu() {
|
|
|
7875
7818
|
} finally {
|
|
7876
7819
|
sn = !1, ve.current = Q, ct(), Error.prepareStackTrace = z;
|
|
7877
7820
|
}
|
|
7878
|
-
var Be = h ? h.displayName || h.name : "", De = Be ?
|
|
7879
|
-
return typeof h == "function" &&
|
|
7821
|
+
var Be = h ? h.displayName || h.name : "", De = Be ? At(Be) : "";
|
|
7822
|
+
return typeof h == "function" && Ct.set(h, De), De;
|
|
7880
7823
|
}
|
|
7881
|
-
function fi(h,
|
|
7824
|
+
function fi(h, S, E) {
|
|
7882
7825
|
return ur(h, !1);
|
|
7883
7826
|
}
|
|
7884
7827
|
function di(h) {
|
|
7885
|
-
var
|
|
7886
|
-
return !!(
|
|
7828
|
+
var S = h.prototype;
|
|
7829
|
+
return !!(S && S.isReactComponent);
|
|
7887
7830
|
}
|
|
7888
|
-
function
|
|
7831
|
+
function It(h, S, E) {
|
|
7889
7832
|
if (h == null)
|
|
7890
7833
|
return "";
|
|
7891
7834
|
if (typeof h == "function")
|
|
7892
7835
|
return ur(h, di(h));
|
|
7893
7836
|
if (typeof h == "string")
|
|
7894
|
-
return
|
|
7837
|
+
return At(h);
|
|
7895
7838
|
switch (h) {
|
|
7896
7839
|
case l:
|
|
7897
|
-
return
|
|
7840
|
+
return At("Suspense");
|
|
7898
7841
|
case f:
|
|
7899
|
-
return
|
|
7842
|
+
return At("SuspenseList");
|
|
7900
7843
|
}
|
|
7901
7844
|
if (typeof h == "object")
|
|
7902
7845
|
switch (h.$$typeof) {
|
|
7903
7846
|
case u:
|
|
7904
7847
|
return fi(h.render);
|
|
7905
7848
|
case d:
|
|
7906
|
-
return
|
|
7907
|
-
case
|
|
7908
|
-
var
|
|
7849
|
+
return It(h.type, S, E);
|
|
7850
|
+
case y: {
|
|
7851
|
+
var M = h, z = M._payload, Q = M._init;
|
|
7909
7852
|
try {
|
|
7910
|
-
return
|
|
7853
|
+
return It(Q(z), S, E);
|
|
7911
7854
|
} catch {
|
|
7912
7855
|
}
|
|
7913
7856
|
}
|
|
7914
7857
|
}
|
|
7915
7858
|
return "";
|
|
7916
7859
|
}
|
|
7917
|
-
var ut = Object.prototype.hasOwnProperty, lr = {}, fr =
|
|
7918
|
-
function
|
|
7860
|
+
var ut = Object.prototype.hasOwnProperty, lr = {}, fr = _.ReactDebugCurrentFrame;
|
|
7861
|
+
function Pt(h) {
|
|
7919
7862
|
if (h) {
|
|
7920
|
-
var
|
|
7921
|
-
fr.setExtraStackFrame(
|
|
7863
|
+
var S = h._owner, E = It(h.type, h._source, S ? S.type : null);
|
|
7864
|
+
fr.setExtraStackFrame(E);
|
|
7922
7865
|
} else
|
|
7923
7866
|
fr.setExtraStackFrame(null);
|
|
7924
7867
|
}
|
|
7925
|
-
function hi(h,
|
|
7868
|
+
function hi(h, S, E, M, z) {
|
|
7926
7869
|
{
|
|
7927
7870
|
var Q = Function.call.bind(ut);
|
|
7928
|
-
for (var
|
|
7929
|
-
if (Q(h,
|
|
7930
|
-
var
|
|
7871
|
+
for (var L in h)
|
|
7872
|
+
if (Q(h, L)) {
|
|
7873
|
+
var $ = void 0;
|
|
7931
7874
|
try {
|
|
7932
|
-
if (typeof h[
|
|
7933
|
-
var fe = Error((
|
|
7875
|
+
if (typeof h[L] != "function") {
|
|
7876
|
+
var fe = Error((M || "React class") + ": " + E + " type `" + L + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof h[L] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
|
|
7934
7877
|
throw fe.name = "Invariant Violation", fe;
|
|
7935
7878
|
}
|
|
7936
|
-
|
|
7879
|
+
$ = h[L](S, L, M, E, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
|
|
7937
7880
|
} catch (ee) {
|
|
7938
|
-
|
|
7881
|
+
$ = ee;
|
|
7939
7882
|
}
|
|
7940
|
-
|
|
7883
|
+
$ && !($ instanceof Error) && (Pt(z), w("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", M || "React class", E, L, typeof $), Pt(null)), $ instanceof Error && !($.message in lr) && (lr[$.message] = !0, Pt(z), w("Failed %s type: %s", E, $.message), Pt(null));
|
|
7941
7884
|
}
|
|
7942
7885
|
}
|
|
7943
7886
|
}
|
|
@@ -7947,8 +7890,8 @@ function Lu() {
|
|
|
7947
7890
|
}
|
|
7948
7891
|
function yi(h) {
|
|
7949
7892
|
{
|
|
7950
|
-
var
|
|
7951
|
-
return
|
|
7893
|
+
var S = typeof Symbol == "function" && Symbol.toStringTag, E = S && h[Symbol.toStringTag] || h.constructor.name || "Object";
|
|
7894
|
+
return E;
|
|
7952
7895
|
}
|
|
7953
7896
|
}
|
|
7954
7897
|
function bi(h) {
|
|
@@ -7965,7 +7908,7 @@ function Lu() {
|
|
|
7965
7908
|
if (bi(h))
|
|
7966
7909
|
return w("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", yi(h)), dr(h);
|
|
7967
7910
|
}
|
|
7968
|
-
var pr =
|
|
7911
|
+
var pr = _.ReactCurrentOwner, gi = {
|
|
7969
7912
|
key: !0,
|
|
7970
7913
|
ref: !0,
|
|
7971
7914
|
__self: !0,
|
|
@@ -7973,97 +7916,97 @@ function Lu() {
|
|
|
7973
7916
|
}, yr, br;
|
|
7974
7917
|
function _i(h) {
|
|
7975
7918
|
if (ut.call(h, "ref")) {
|
|
7976
|
-
var
|
|
7977
|
-
if (
|
|
7919
|
+
var S = Object.getOwnPropertyDescriptor(h, "ref").get;
|
|
7920
|
+
if (S && S.isReactWarning)
|
|
7978
7921
|
return !1;
|
|
7979
7922
|
}
|
|
7980
7923
|
return h.ref !== void 0;
|
|
7981
7924
|
}
|
|
7982
7925
|
function mi(h) {
|
|
7983
7926
|
if (ut.call(h, "key")) {
|
|
7984
|
-
var
|
|
7985
|
-
if (
|
|
7927
|
+
var S = Object.getOwnPropertyDescriptor(h, "key").get;
|
|
7928
|
+
if (S && S.isReactWarning)
|
|
7986
7929
|
return !1;
|
|
7987
7930
|
}
|
|
7988
7931
|
return h.key !== void 0;
|
|
7989
7932
|
}
|
|
7990
|
-
function wi(h,
|
|
7933
|
+
function wi(h, S) {
|
|
7991
7934
|
typeof h.ref == "string" && pr.current;
|
|
7992
7935
|
}
|
|
7993
|
-
function Si(h,
|
|
7936
|
+
function Si(h, S) {
|
|
7994
7937
|
{
|
|
7995
|
-
var
|
|
7996
|
-
yr || (yr = !0, w("%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)",
|
|
7938
|
+
var E = function() {
|
|
7939
|
+
yr || (yr = !0, w("%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)", S));
|
|
7997
7940
|
};
|
|
7998
|
-
|
|
7999
|
-
get:
|
|
7941
|
+
E.isReactWarning = !0, Object.defineProperty(h, "key", {
|
|
7942
|
+
get: E,
|
|
8000
7943
|
configurable: !0
|
|
8001
7944
|
});
|
|
8002
7945
|
}
|
|
8003
7946
|
}
|
|
8004
|
-
function Ti(h,
|
|
7947
|
+
function Ti(h, S) {
|
|
8005
7948
|
{
|
|
8006
|
-
var
|
|
8007
|
-
br || (br = !0, w("%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)",
|
|
7949
|
+
var E = function() {
|
|
7950
|
+
br || (br = !0, w("%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)", S));
|
|
8008
7951
|
};
|
|
8009
|
-
|
|
8010
|
-
get:
|
|
7952
|
+
E.isReactWarning = !0, Object.defineProperty(h, "ref", {
|
|
7953
|
+
get: E,
|
|
8011
7954
|
configurable: !0
|
|
8012
7955
|
});
|
|
8013
7956
|
}
|
|
8014
7957
|
}
|
|
8015
|
-
var vi = function(h,
|
|
8016
|
-
var
|
|
7958
|
+
var vi = function(h, S, E, M, z, Q, L) {
|
|
7959
|
+
var $ = {
|
|
8017
7960
|
// This tag allows us to uniquely identify this as a React Element
|
|
8018
7961
|
$$typeof: t,
|
|
8019
7962
|
// Built-in properties that belong on the element
|
|
8020
7963
|
type: h,
|
|
8021
|
-
key:
|
|
8022
|
-
ref:
|
|
8023
|
-
props:
|
|
7964
|
+
key: S,
|
|
7965
|
+
ref: E,
|
|
7966
|
+
props: L,
|
|
8024
7967
|
// Record the component responsible for creating this element.
|
|
8025
7968
|
_owner: Q
|
|
8026
7969
|
};
|
|
8027
|
-
return
|
|
7970
|
+
return $._store = {}, Object.defineProperty($._store, "validated", {
|
|
8028
7971
|
configurable: !1,
|
|
8029
7972
|
enumerable: !1,
|
|
8030
7973
|
writable: !0,
|
|
8031
7974
|
value: !1
|
|
8032
|
-
}), Object.defineProperty(
|
|
7975
|
+
}), Object.defineProperty($, "_self", {
|
|
8033
7976
|
configurable: !1,
|
|
8034
7977
|
enumerable: !1,
|
|
8035
7978
|
writable: !1,
|
|
8036
|
-
value:
|
|
8037
|
-
}), Object.defineProperty(
|
|
7979
|
+
value: M
|
|
7980
|
+
}), Object.defineProperty($, "_source", {
|
|
8038
7981
|
configurable: !1,
|
|
8039
7982
|
enumerable: !1,
|
|
8040
7983
|
writable: !1,
|
|
8041
7984
|
value: z
|
|
8042
|
-
}), Object.freeze && (Object.freeze(
|
|
7985
|
+
}), Object.freeze && (Object.freeze($.props), Object.freeze($)), $;
|
|
8043
7986
|
};
|
|
8044
|
-
function Ei(h,
|
|
7987
|
+
function Ei(h, S, E, M, z) {
|
|
8045
7988
|
{
|
|
8046
|
-
var Q,
|
|
8047
|
-
|
|
8048
|
-
for (Q in
|
|
8049
|
-
ut.call(
|
|
7989
|
+
var Q, L = {}, $ = null, fe = null;
|
|
7990
|
+
E !== void 0 && (hr(E), $ = "" + E), mi(S) && (hr(S.key), $ = "" + S.key), _i(S) && (fe = S.ref, wi(S, z));
|
|
7991
|
+
for (Q in S)
|
|
7992
|
+
ut.call(S, Q) && !gi.hasOwnProperty(Q) && (L[Q] = S[Q]);
|
|
8050
7993
|
if (h && h.defaultProps) {
|
|
8051
7994
|
var ee = h.defaultProps;
|
|
8052
7995
|
for (Q in ee)
|
|
8053
|
-
|
|
7996
|
+
L[Q] === void 0 && (L[Q] = ee[Q]);
|
|
8054
7997
|
}
|
|
8055
|
-
if (
|
|
7998
|
+
if ($ || fe) {
|
|
8056
7999
|
var re = typeof h == "function" ? h.displayName || h.name || "Unknown" : h;
|
|
8057
|
-
|
|
8000
|
+
$ && Si(L, re), fe && Ti(L, re);
|
|
8058
8001
|
}
|
|
8059
|
-
return vi(h,
|
|
8002
|
+
return vi(h, $, fe, z, M, pr.current, L);
|
|
8060
8003
|
}
|
|
8061
8004
|
}
|
|
8062
|
-
var an =
|
|
8005
|
+
var an = _.ReactCurrentOwner, gr = _.ReactDebugCurrentFrame;
|
|
8063
8006
|
function Qe(h) {
|
|
8064
8007
|
if (h) {
|
|
8065
|
-
var
|
|
8066
|
-
gr.setExtraStackFrame(
|
|
8008
|
+
var S = h._owner, E = It(h.type, h._source, S ? S.type : null);
|
|
8009
|
+
gr.setExtraStackFrame(E);
|
|
8067
8010
|
} else
|
|
8068
8011
|
gr.setExtraStackFrame(null);
|
|
8069
8012
|
}
|
|
@@ -8088,81 +8031,81 @@ Check the render method of \`` + h + "`.";
|
|
|
8088
8031
|
return "";
|
|
8089
8032
|
}
|
|
8090
8033
|
var mr = {};
|
|
8091
|
-
function
|
|
8034
|
+
function ki(h) {
|
|
8092
8035
|
{
|
|
8093
|
-
var
|
|
8094
|
-
if (!
|
|
8095
|
-
var
|
|
8096
|
-
|
|
8036
|
+
var S = _r();
|
|
8037
|
+
if (!S) {
|
|
8038
|
+
var E = typeof h == "string" ? h : h.displayName || h.name;
|
|
8039
|
+
E && (S = `
|
|
8097
8040
|
|
|
8098
|
-
Check the top-level render call using <` +
|
|
8041
|
+
Check the top-level render call using <` + E + ">.");
|
|
8099
8042
|
}
|
|
8100
|
-
return
|
|
8043
|
+
return S;
|
|
8101
8044
|
}
|
|
8102
8045
|
}
|
|
8103
|
-
function wr(h,
|
|
8046
|
+
function wr(h, S) {
|
|
8104
8047
|
{
|
|
8105
8048
|
if (!h._store || h._store.validated || h.key != null)
|
|
8106
8049
|
return;
|
|
8107
8050
|
h._store.validated = !0;
|
|
8108
|
-
var
|
|
8109
|
-
if (mr[
|
|
8051
|
+
var E = ki(S);
|
|
8052
|
+
if (mr[E])
|
|
8110
8053
|
return;
|
|
8111
|
-
mr[
|
|
8112
|
-
var
|
|
8113
|
-
h && h._owner && h._owner !== an.current && (
|
|
8054
|
+
mr[E] = !0;
|
|
8055
|
+
var M = "";
|
|
8056
|
+
h && h._owner && h._owner !== an.current && (M = " It was passed a child from " + q(h._owner.type) + "."), Qe(h), w('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', E, M), Qe(null);
|
|
8114
8057
|
}
|
|
8115
8058
|
}
|
|
8116
|
-
function Sr(h,
|
|
8059
|
+
function Sr(h, S) {
|
|
8117
8060
|
{
|
|
8118
8061
|
if (typeof h != "object")
|
|
8119
8062
|
return;
|
|
8120
8063
|
if (on(h))
|
|
8121
|
-
for (var
|
|
8122
|
-
var
|
|
8123
|
-
un(
|
|
8064
|
+
for (var E = 0; E < h.length; E++) {
|
|
8065
|
+
var M = h[E];
|
|
8066
|
+
un(M) && wr(M, S);
|
|
8124
8067
|
}
|
|
8125
8068
|
else if (un(h))
|
|
8126
8069
|
h._store && (h._store.validated = !0);
|
|
8127
8070
|
else if (h) {
|
|
8128
|
-
var z =
|
|
8071
|
+
var z = T(h);
|
|
8129
8072
|
if (typeof z == "function" && z !== h.entries)
|
|
8130
|
-
for (var Q = z.call(h),
|
|
8131
|
-
un(
|
|
8073
|
+
for (var Q = z.call(h), L; !(L = Q.next()).done; )
|
|
8074
|
+
un(L.value) && wr(L.value, S);
|
|
8132
8075
|
}
|
|
8133
8076
|
}
|
|
8134
8077
|
}
|
|
8135
|
-
function
|
|
8078
|
+
function Ai(h) {
|
|
8136
8079
|
{
|
|
8137
|
-
var
|
|
8138
|
-
if (
|
|
8080
|
+
var S = h.type;
|
|
8081
|
+
if (S == null || typeof S == "string")
|
|
8139
8082
|
return;
|
|
8140
|
-
var
|
|
8141
|
-
if (typeof
|
|
8142
|
-
|
|
8143
|
-
else if (typeof
|
|
8083
|
+
var E;
|
|
8084
|
+
if (typeof S == "function")
|
|
8085
|
+
E = S.propTypes;
|
|
8086
|
+
else if (typeof S == "object" && (S.$$typeof === u || // Note: Memo only checks outer props here.
|
|
8144
8087
|
// Inner props are checked in the reconciler.
|
|
8145
|
-
|
|
8146
|
-
|
|
8088
|
+
S.$$typeof === d))
|
|
8089
|
+
E = S.propTypes;
|
|
8147
8090
|
else
|
|
8148
8091
|
return;
|
|
8149
|
-
if (
|
|
8150
|
-
var
|
|
8151
|
-
hi(
|
|
8152
|
-
} else if (
|
|
8092
|
+
if (E) {
|
|
8093
|
+
var M = q(S);
|
|
8094
|
+
hi(E, h.props, "prop", M, h);
|
|
8095
|
+
} else if (S.PropTypes !== void 0 && !cn) {
|
|
8153
8096
|
cn = !0;
|
|
8154
|
-
var z = q(
|
|
8097
|
+
var z = q(S);
|
|
8155
8098
|
w("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", z || "Unknown");
|
|
8156
8099
|
}
|
|
8157
|
-
typeof
|
|
8100
|
+
typeof S.getDefaultProps == "function" && !S.getDefaultProps.isReactClassApproved && w("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
|
|
8158
8101
|
}
|
|
8159
8102
|
}
|
|
8160
8103
|
function Ci(h) {
|
|
8161
8104
|
{
|
|
8162
|
-
for (var
|
|
8163
|
-
var
|
|
8164
|
-
if (
|
|
8165
|
-
Qe(h), w("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",
|
|
8105
|
+
for (var S = Object.keys(h.props), E = 0; E < S.length; E++) {
|
|
8106
|
+
var M = S[E];
|
|
8107
|
+
if (M !== "children" && M !== "key") {
|
|
8108
|
+
Qe(h), w("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", M), Qe(null);
|
|
8166
8109
|
break;
|
|
8167
8110
|
}
|
|
8168
8111
|
}
|
|
@@ -8170,24 +8113,24 @@ Check the top-level render call using <` + v + ">.");
|
|
|
8170
8113
|
}
|
|
8171
8114
|
}
|
|
8172
8115
|
var Tr = {};
|
|
8173
|
-
function vr(h,
|
|
8116
|
+
function vr(h, S, E, M, z, Q) {
|
|
8174
8117
|
{
|
|
8175
|
-
var
|
|
8176
|
-
if (!
|
|
8177
|
-
var
|
|
8178
|
-
(h === void 0 || typeof h == "object" && h !== null && Object.keys(h).length === 0) && (
|
|
8118
|
+
var L = G(h);
|
|
8119
|
+
if (!L) {
|
|
8120
|
+
var $ = "";
|
|
8121
|
+
(h === void 0 || typeof h == "object" && h !== null && Object.keys(h).length === 0) && ($ += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
|
|
8179
8122
|
var fe = Oi();
|
|
8180
|
-
fe ?
|
|
8123
|
+
fe ? $ += fe : $ += _r();
|
|
8181
8124
|
var ee;
|
|
8182
|
-
h === null ? ee = "null" : on(h) ? ee = "array" : h !== void 0 && h.$$typeof === t ? (ee = "<" + (q(h.type) || "Unknown") + " />",
|
|
8125
|
+
h === null ? ee = "null" : on(h) ? ee = "array" : h !== void 0 && h.$$typeof === t ? (ee = "<" + (q(h.type) || "Unknown") + " />", $ = " Did you accidentally export a JSX literal instead of a component?") : ee = typeof h, w("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", ee, $);
|
|
8183
8126
|
}
|
|
8184
|
-
var re = Ei(h,
|
|
8127
|
+
var re = Ei(h, S, E, z, Q);
|
|
8185
8128
|
if (re == null)
|
|
8186
8129
|
return re;
|
|
8187
|
-
if (
|
|
8188
|
-
var Se =
|
|
8130
|
+
if (L) {
|
|
8131
|
+
var Se = S.children;
|
|
8189
8132
|
if (Se !== void 0)
|
|
8190
|
-
if (
|
|
8133
|
+
if (M)
|
|
8191
8134
|
if (on(Se)) {
|
|
8192
8135
|
for (var Be = 0; Be < Se.length; Be++)
|
|
8193
8136
|
Sr(Se[Be], h);
|
|
@@ -8197,8 +8140,8 @@ Check the top-level render call using <` + v + ">.");
|
|
|
8197
8140
|
else
|
|
8198
8141
|
Sr(Se, h);
|
|
8199
8142
|
}
|
|
8200
|
-
if (ut.call(
|
|
8201
|
-
var De = q(h), pe = Object.keys(
|
|
8143
|
+
if (ut.call(S, "key")) {
|
|
8144
|
+
var De = q(h), pe = Object.keys(S).filter(function(xi) {
|
|
8202
8145
|
return xi !== "key";
|
|
8203
8146
|
}), ln = pe.length > 0 ? "{key: someKey, " + pe.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
8204
8147
|
if (!Tr[De + ln]) {
|
|
@@ -8211,22 +8154,22 @@ React keys must be passed directly to JSX without using spread:
|
|
|
8211
8154
|
<%s key={someKey} {...props} />`, ln, De, ji, De), Tr[De + ln] = !0;
|
|
8212
8155
|
}
|
|
8213
8156
|
}
|
|
8214
|
-
return h === s ? Ci(re) :
|
|
8157
|
+
return h === s ? Ci(re) : Ai(re), re;
|
|
8215
8158
|
}
|
|
8216
8159
|
}
|
|
8217
|
-
function Ii(h,
|
|
8218
|
-
return vr(h,
|
|
8160
|
+
function Ii(h, S, E) {
|
|
8161
|
+
return vr(h, S, E, !0);
|
|
8219
8162
|
}
|
|
8220
|
-
function Pi(h,
|
|
8221
|
-
return vr(h,
|
|
8163
|
+
function Pi(h, S, E) {
|
|
8164
|
+
return vr(h, S, E, !1);
|
|
8222
8165
|
}
|
|
8223
|
-
var
|
|
8224
|
-
dt.Fragment = s, dt.jsx =
|
|
8166
|
+
var Mi = Pi, Ri = Ii;
|
|
8167
|
+
dt.Fragment = s, dt.jsx = Mi, dt.jsxs = Ri;
|
|
8225
8168
|
}(), dt;
|
|
8226
8169
|
}
|
|
8227
8170
|
var Fu = {};
|
|
8228
8171
|
Fu.NODE_ENV === "production" ? Fn.exports = Uu() : Fn.exports = Lu();
|
|
8229
|
-
var
|
|
8172
|
+
var ae = Fn.exports;
|
|
8230
8173
|
const Nu = {
|
|
8231
8174
|
isLoading: !0,
|
|
8232
8175
|
data: void 0,
|
|
@@ -8244,7 +8187,7 @@ function us(n) {
|
|
|
8244
8187
|
}
|
|
8245
8188
|
function Ku(n, e, t, r) {
|
|
8246
8189
|
e && t && "ruleParams" in t && (e = { $$ruleParams: t.ruleParams, ...e });
|
|
8247
|
-
const s = e ? ai(e) : null, i =
|
|
8190
|
+
const s = e ? ai(e) : null, i = ce(s), o = $e(us(n._reactor.getPreviousResult(s))), a = $e(Nu), c = Me(
|
|
8248
8191
|
(l) => (o.current = us(n._reactor.getPreviousResult(s)), l(), s ? n.subscribeQuery(s, (d) => {
|
|
8249
8192
|
o.current = {
|
|
8250
8193
|
isLoading: !d,
|
|
@@ -8261,7 +8204,7 @@ function Ku(n, e, t, r) {
|
|
|
8261
8204
|
// Build a new subscribe function if the query changes
|
|
8262
8205
|
[i]
|
|
8263
8206
|
);
|
|
8264
|
-
return { state:
|
|
8207
|
+
return { state: Vt(c, () => o.current, () => a.current), query: s, queryHash: i };
|
|
8265
8208
|
}
|
|
8266
8209
|
const Wu = {
|
|
8267
8210
|
error: void 0,
|
|
@@ -8270,10 +8213,10 @@ const Wu = {
|
|
|
8270
8213
|
canLoadNextPage: !1
|
|
8271
8214
|
};
|
|
8272
8215
|
function qu({ core: n, query: e, opts: t }) {
|
|
8273
|
-
const r =
|
|
8216
|
+
const r = $e(null), s = ce(e), i = ce(t), o = ss(n, e, t), a = $e({
|
|
8274
8217
|
...o,
|
|
8275
8218
|
isLoading: !o.data && !o.error
|
|
8276
|
-
}), c =
|
|
8219
|
+
}), c = Me((f) => {
|
|
8277
8220
|
r.current = null;
|
|
8278
8221
|
const d = ss(n, e, t);
|
|
8279
8222
|
if (a.current = {
|
|
@@ -8282,18 +8225,18 @@ function qu({ core: n, query: e, opts: t }) {
|
|
|
8282
8225
|
}, f(), !e)
|
|
8283
8226
|
return () => {
|
|
8284
8227
|
};
|
|
8285
|
-
const
|
|
8228
|
+
const y = n.subscribeInfiniteQuery(e, (b) => {
|
|
8286
8229
|
a.current = {
|
|
8287
|
-
...
|
|
8230
|
+
...b,
|
|
8288
8231
|
isLoading: !1
|
|
8289
8232
|
}, f();
|
|
8290
8233
|
}, t);
|
|
8291
|
-
return r.current =
|
|
8292
|
-
|
|
8234
|
+
return r.current = y, () => {
|
|
8235
|
+
y.unsubscribe(), r.current === y && (r.current = null);
|
|
8293
8236
|
};
|
|
8294
8237
|
}, [s, i]);
|
|
8295
8238
|
return {
|
|
8296
|
-
...
|
|
8239
|
+
...Vt(c, () => a.current, () => Wu),
|
|
8297
8240
|
loadNextPage: () => {
|
|
8298
8241
|
var f;
|
|
8299
8242
|
(f = r.current) == null || f.loadNextPage();
|
|
@@ -8301,7 +8244,7 @@ function qu({ core: n, query: e, opts: t }) {
|
|
|
8301
8244
|
};
|
|
8302
8245
|
}
|
|
8303
8246
|
function zu() {
|
|
8304
|
-
const n =
|
|
8247
|
+
const n = $e(null);
|
|
8305
8248
|
We(() => {
|
|
8306
8249
|
t();
|
|
8307
8250
|
}, []);
|
|
@@ -8315,13 +8258,13 @@ function zu() {
|
|
|
8315
8258
|
}
|
|
8316
8259
|
const Vu = 1e3;
|
|
8317
8260
|
function Qu(n, e, t) {
|
|
8318
|
-
const r =
|
|
8261
|
+
const r = $e(t);
|
|
8319
8262
|
r.current = t, We(() => n.core._reactor.subscribeTopic(n.type, n.id, e, (i, o) => {
|
|
8320
8263
|
r.current(i, o);
|
|
8321
8264
|
}), [n.id, e]);
|
|
8322
8265
|
}
|
|
8323
8266
|
function Bu(n, e) {
|
|
8324
|
-
return We(() => n.core._reactor.joinRoom(n.type, n.id), [n.id]),
|
|
8267
|
+
return We(() => n.core._reactor.joinRoom(n.type, n.id), [n.id]), Me((r) => {
|
|
8325
8268
|
n.core._reactor.publishTopic({
|
|
8326
8269
|
roomType: n.type,
|
|
8327
8270
|
roomId: n.id,
|
|
@@ -8339,7 +8282,7 @@ function Gu(n, e = {}) {
|
|
|
8339
8282
|
We(() => n.core._reactor.subscribePresence(n.type, n.id, e, (u) => {
|
|
8340
8283
|
r(u);
|
|
8341
8284
|
}), [n.id, e.user, (o = e.peers) == null ? void 0 : o.join(), (a = e.keys) == null ? void 0 : a.join()]);
|
|
8342
|
-
const s =
|
|
8285
|
+
const s = Me((c) => {
|
|
8343
8286
|
n.core._reactor.publishPresence(n.type, n.id, c);
|
|
8344
8287
|
}, [n.type, n.id]);
|
|
8345
8288
|
return Sn(() => ({
|
|
@@ -8356,7 +8299,7 @@ function Ju(n, e, t = {}) {
|
|
|
8356
8299
|
}), i = Sn(() => {
|
|
8357
8300
|
const l = n._core._reactor.getPresence(n.type, n.id);
|
|
8358
8301
|
return t != null && t.writeOnly ? [] : Object.values((l == null ? void 0 : l.peers) ?? {}).filter((f) => f[e] === !0);
|
|
8359
|
-
}, [t == null ? void 0 : t.writeOnly, s]), o =
|
|
8302
|
+
}, [t == null ? void 0 : t.writeOnly, s]), o = Me((l) => {
|
|
8360
8303
|
n.core._reactor.publishPresence(n.type, n.id, {
|
|
8361
8304
|
[e]: l
|
|
8362
8305
|
}), l && ((t == null ? void 0 : t.timeout) === null || (t == null ? void 0 : t.timeout) === 0 || r.set((t == null ? void 0 : t.timeout) ?? Vu, () => {
|
|
@@ -8364,10 +8307,10 @@ function Ju(n, e, t = {}) {
|
|
|
8364
8307
|
[e]: null
|
|
8365
8308
|
});
|
|
8366
8309
|
}));
|
|
8367
|
-
}, [n.type, n.id, e, t == null ? void 0 : t.timeout, r]), a =
|
|
8310
|
+
}, [n.type, n.id, e, t == null ? void 0 : t.timeout, r]), a = Me((l) => {
|
|
8368
8311
|
const d = !((t == null ? void 0 : t.stopOnEnter) && l.key === "Enter");
|
|
8369
8312
|
o(d);
|
|
8370
|
-
}, [t.stopOnEnter, o]), c =
|
|
8313
|
+
}, [t.stopOnEnter, o]), c = Me(() => {
|
|
8371
8314
|
o(!1);
|
|
8372
8315
|
}, [o]), u = Sn(() => ({ onKeyDown: a, onBlur: c }), [a, c]);
|
|
8373
8316
|
return {
|
|
@@ -8474,11 +8417,8 @@ const Zu = {
|
|
|
8474
8417
|
isLoading: !0,
|
|
8475
8418
|
user: void 0,
|
|
8476
8419
|
error: void 0
|
|
8477
|
-
}, Xu = {
|
|
8478
|
-
isLoading: !0,
|
|
8479
|
-
isReadOnly: void 0
|
|
8480
8420
|
};
|
|
8481
|
-
class
|
|
8421
|
+
class Wt {
|
|
8482
8422
|
constructor(e, t) {
|
|
8483
8423
|
p(this, "tx", ir());
|
|
8484
8424
|
p(this, "auth");
|
|
@@ -8624,7 +8564,7 @@ class qt {
|
|
|
8624
8564
|
p(this, "useUser", () => {
|
|
8625
8565
|
const { user: e } = this.useAuth();
|
|
8626
8566
|
if (!e)
|
|
8627
|
-
throw new
|
|
8567
|
+
throw new ue("useUser must be used within an auth-protected route");
|
|
8628
8568
|
return e;
|
|
8629
8569
|
});
|
|
8630
8570
|
/**
|
|
@@ -8650,34 +8590,16 @@ class qt {
|
|
|
8650
8590
|
* }
|
|
8651
8591
|
*/
|
|
8652
8592
|
p(this, "useConnectionStatus", () => {
|
|
8653
|
-
const e =
|
|
8593
|
+
const e = $e(this.core._reactor.status), t = Me((s) => this.core.subscribeConnectionStatus((o) => {
|
|
8654
8594
|
o !== e.current && (e.current = o, s());
|
|
8655
8595
|
}), []);
|
|
8656
|
-
return
|
|
8596
|
+
return Vt(
|
|
8657
8597
|
t,
|
|
8658
8598
|
() => e.current,
|
|
8659
8599
|
// For SSR, always return 'connecting' as the initial state
|
|
8660
8600
|
() => "connecting"
|
|
8661
8601
|
);
|
|
8662
8602
|
});
|
|
8663
|
-
/**
|
|
8664
|
-
* Observe the app's maintenance-mode state. While read-only, reads and
|
|
8665
|
-
* live queries keep working but writes are rejected.
|
|
8666
|
-
*
|
|
8667
|
-
* @example
|
|
8668
|
-
* function App() {
|
|
8669
|
-
* const { isLoading, isReadOnly } = db.useAppStatus()
|
|
8670
|
-
* if (isLoading) return null
|
|
8671
|
-
* if (isReadOnly) return <MaintenanceBanner />
|
|
8672
|
-
* // ...
|
|
8673
|
-
* }
|
|
8674
|
-
*/
|
|
8675
|
-
p(this, "useAppStatus", () => {
|
|
8676
|
-
const e = Me(this.core._reactor._appStatusState), t = Ie((s) => this.core.subscribeAppStatus((i) => {
|
|
8677
|
-
(i.isLoading !== e.current.isLoading || i.isReadOnly !== e.current.isReadOnly) && (e.current = i, s());
|
|
8678
|
-
}), []);
|
|
8679
|
-
return wt(t, () => e.current, () => Xu);
|
|
8680
|
-
});
|
|
8681
8603
|
/**
|
|
8682
8604
|
* Use this for one-off queries.
|
|
8683
8605
|
* Returns local data if available, otherwise fetches from the server.
|
|
@@ -8732,7 +8654,7 @@ class qt {
|
|
|
8732
8654
|
*/
|
|
8733
8655
|
p(this, "SignedIn", ({ children: e }) => {
|
|
8734
8656
|
const t = this.useAuth();
|
|
8735
|
-
return t.isLoading || t.error || !t.user ? null :
|
|
8657
|
+
return t.isLoading || t.error || !t.user ? null : ae.jsx(ae.Fragment, { children: e });
|
|
8736
8658
|
});
|
|
8737
8659
|
/**
|
|
8738
8660
|
* Only render children if the user is signed out.
|
|
@@ -8746,7 +8668,7 @@ class qt {
|
|
|
8746
8668
|
*/
|
|
8747
8669
|
p(this, "SignedOut", ({ children: e }) => {
|
|
8748
8670
|
const t = this.useAuth();
|
|
8749
|
-
return t.isLoading || t.error || t.user ? null :
|
|
8671
|
+
return t.isLoading || t.error || t.user ? null : ae.jsx(ae.Fragment, { children: e });
|
|
8750
8672
|
});
|
|
8751
8673
|
this.core = $u(
|
|
8752
8674
|
e,
|
|
@@ -8775,10 +8697,10 @@ class qt {
|
|
|
8775
8697
|
return new Yu(this.core, e, t);
|
|
8776
8698
|
}
|
|
8777
8699
|
_useAuth() {
|
|
8778
|
-
const e =
|
|
8700
|
+
const e = $e(this.core._reactor._currentUserCached), t = Me((s) => this.core.subscribeAuth((o) => {
|
|
8779
8701
|
e.current = { isLoading: !1, ...o }, s();
|
|
8780
8702
|
}), []);
|
|
8781
|
-
return
|
|
8703
|
+
return Vt(t, () => e.current, () => Zu);
|
|
8782
8704
|
}
|
|
8783
8705
|
/**
|
|
8784
8706
|
* One time query for the logged in state. This is useful
|
|
@@ -8794,7 +8716,7 @@ class qt {
|
|
|
8794
8716
|
return this.core.getAuth();
|
|
8795
8717
|
}
|
|
8796
8718
|
}
|
|
8797
|
-
p(
|
|
8719
|
+
p(Wt, "Store"), p(Wt, "NetworkListener"), p(Wt, "EventSourceImpl");
|
|
8798
8720
|
class ls extends Error {
|
|
8799
8721
|
constructor(e, t) {
|
|
8800
8722
|
super(e), this.name = "ParseError", this.type = t.type, this.field = t.field, this.value = t.value, this.line = t.line;
|
|
@@ -8802,7 +8724,7 @@ class ls extends Error {
|
|
|
8802
8724
|
}
|
|
8803
8725
|
function wn(n) {
|
|
8804
8726
|
}
|
|
8805
|
-
function
|
|
8727
|
+
function Xu(n) {
|
|
8806
8728
|
if (typeof n == "function")
|
|
8807
8729
|
throw new TypeError(
|
|
8808
8730
|
"`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?"
|
|
@@ -8810,46 +8732,46 @@ function el(n) {
|
|
|
8810
8732
|
const { onEvent: e = wn, onError: t = wn, onRetry: r = wn, onComment: s } = n;
|
|
8811
8733
|
let i = "", o = !0, a, c = "", u = "";
|
|
8812
8734
|
function l(g) {
|
|
8813
|
-
const
|
|
8814
|
-
for (const w of
|
|
8735
|
+
const m = o ? g.replace(/^\xEF\xBB\xBF/, "") : g, [T, _] = el(`${i}${m}`);
|
|
8736
|
+
for (const w of T)
|
|
8815
8737
|
f(w);
|
|
8816
|
-
i =
|
|
8738
|
+
i = _, o = !1;
|
|
8817
8739
|
}
|
|
8818
8740
|
function f(g) {
|
|
8819
8741
|
if (g === "") {
|
|
8820
|
-
|
|
8742
|
+
y();
|
|
8821
8743
|
return;
|
|
8822
8744
|
}
|
|
8823
8745
|
if (g.startsWith(":")) {
|
|
8824
8746
|
s && s(g.slice(g.startsWith(": ") ? 2 : 1));
|
|
8825
8747
|
return;
|
|
8826
8748
|
}
|
|
8827
|
-
const
|
|
8828
|
-
if (
|
|
8829
|
-
const
|
|
8830
|
-
d(
|
|
8749
|
+
const m = g.indexOf(":");
|
|
8750
|
+
if (m !== -1) {
|
|
8751
|
+
const T = g.slice(0, m), _ = g[m + 1] === " " ? 2 : 1, w = g.slice(m + _);
|
|
8752
|
+
d(T, w, g);
|
|
8831
8753
|
return;
|
|
8832
8754
|
}
|
|
8833
8755
|
d(g, "", g);
|
|
8834
8756
|
}
|
|
8835
|
-
function d(g,
|
|
8757
|
+
function d(g, m, T) {
|
|
8836
8758
|
switch (g) {
|
|
8837
8759
|
case "event":
|
|
8838
|
-
u =
|
|
8760
|
+
u = m;
|
|
8839
8761
|
break;
|
|
8840
8762
|
case "data":
|
|
8841
|
-
c = `${c}${
|
|
8763
|
+
c = `${c}${m}
|
|
8842
8764
|
`;
|
|
8843
8765
|
break;
|
|
8844
8766
|
case "id":
|
|
8845
|
-
a =
|
|
8767
|
+
a = m.includes("\0") ? void 0 : m;
|
|
8846
8768
|
break;
|
|
8847
8769
|
case "retry":
|
|
8848
|
-
/^\d+$/.test(
|
|
8849
|
-
new ls(`Invalid \`retry\` value: "${
|
|
8770
|
+
/^\d+$/.test(m) ? r(parseInt(m, 10)) : t(
|
|
8771
|
+
new ls(`Invalid \`retry\` value: "${m}"`, {
|
|
8850
8772
|
type: "invalid-retry",
|
|
8851
|
-
value:
|
|
8852
|
-
line:
|
|
8773
|
+
value: m,
|
|
8774
|
+
line: T
|
|
8853
8775
|
})
|
|
8854
8776
|
);
|
|
8855
8777
|
break;
|
|
@@ -8857,13 +8779,13 @@ function el(n) {
|
|
|
8857
8779
|
t(
|
|
8858
8780
|
new ls(
|
|
8859
8781
|
`Unknown field "${g.length > 20 ? `${g.slice(0, 20)}…` : g}"`,
|
|
8860
|
-
{ type: "unknown-field", field: g, value:
|
|
8782
|
+
{ type: "unknown-field", field: g, value: m, line: T }
|
|
8861
8783
|
)
|
|
8862
8784
|
);
|
|
8863
8785
|
break;
|
|
8864
8786
|
}
|
|
8865
8787
|
}
|
|
8866
|
-
function
|
|
8788
|
+
function y() {
|
|
8867
8789
|
c.length > 0 && e({
|
|
8868
8790
|
id: a,
|
|
8869
8791
|
event: u || void 0,
|
|
@@ -8873,12 +8795,12 @@ function el(n) {
|
|
|
8873
8795
|
`) ? c.slice(0, -1) : c
|
|
8874
8796
|
}), a = void 0, c = "", u = "";
|
|
8875
8797
|
}
|
|
8876
|
-
function
|
|
8798
|
+
function b(g = {}) {
|
|
8877
8799
|
i && g.consume && f(i), o = !0, a = void 0, c = "", u = "", i = "";
|
|
8878
8800
|
}
|
|
8879
|
-
return { feed: l, reset:
|
|
8801
|
+
return { feed: l, reset: b };
|
|
8880
8802
|
}
|
|
8881
|
-
function
|
|
8803
|
+
function el(n) {
|
|
8882
8804
|
const e = [];
|
|
8883
8805
|
let t = "", r = 0;
|
|
8884
8806
|
for (; r < n.length; ) {
|
|
@@ -8938,7 +8860,7 @@ class fs extends Event {
|
|
|
8938
8860
|
return e(ds(this), t);
|
|
8939
8861
|
}
|
|
8940
8862
|
}
|
|
8941
|
-
function
|
|
8863
|
+
function tl(n) {
|
|
8942
8864
|
const e = globalThis.DOMException;
|
|
8943
8865
|
return typeof e == "function" ? new e(n, "SyntaxError") : new SyntaxError(n);
|
|
8944
8866
|
}
|
|
@@ -8957,69 +8879,69 @@ function ds(n) {
|
|
|
8957
8879
|
}
|
|
8958
8880
|
var ci = (n) => {
|
|
8959
8881
|
throw TypeError(n);
|
|
8960
|
-
}, cr = (n, e, t) => e.has(n) || ci("Cannot " + t),
|
|
8961
|
-
class
|
|
8882
|
+
}, cr = (n, e, t) => e.has(n) || ci("Cannot " + t), x = (n, e, t) => (cr(n, e, "read from private field"), t ? t.call(n) : e.get(n)), ie = (n, e, t) => e.has(n) ? ci("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(n) : e.set(n, t), Y = (n, e, t, r) => (cr(n, e, "write to private field"), e.set(n, t), t), Pe = (n, e, t) => (cr(n, e, "access private method"), t), ye, Fe, Ye, qt, Yt, Tt, nt, vt, xe, Ze, st, Xe, _t, Ee, Kn, Wn, qn, hs, zn, Vn, mt, Qn, Bn;
|
|
8883
|
+
class zt extends EventTarget {
|
|
8962
8884
|
constructor(e, t) {
|
|
8963
8885
|
var r, s;
|
|
8964
|
-
super(), ie(this, Ee), this.CONNECTING = 0, this.OPEN = 1, this.CLOSED = 2, ie(this, ye), ie(this, Fe), ie(this, Ye), ie(this,
|
|
8886
|
+
super(), ie(this, Ee), this.CONNECTING = 0, this.OPEN = 1, this.CLOSED = 2, ie(this, ye), ie(this, Fe), ie(this, Ye), ie(this, qt), ie(this, Yt), ie(this, Tt), ie(this, nt), ie(this, vt, null), ie(this, xe), ie(this, Ze), ie(this, st, null), ie(this, Xe, null), ie(this, _t, null), ie(this, Wn, async (i) => {
|
|
8965
8887
|
var o;
|
|
8966
|
-
|
|
8888
|
+
x(this, Ze).reset();
|
|
8967
8889
|
const { body: a, redirected: c, status: u, headers: l } = i;
|
|
8968
8890
|
if (u === 204) {
|
|
8969
|
-
|
|
8891
|
+
Pe(this, Ee, mt).call(this, "Server sent HTTP 204, not reconnecting", 204), this.close();
|
|
8970
8892
|
return;
|
|
8971
8893
|
}
|
|
8972
8894
|
if (c ? Y(this, Ye, new URL(i.url)) : Y(this, Ye, void 0), u !== 200) {
|
|
8973
|
-
|
|
8895
|
+
Pe(this, Ee, mt).call(this, `Non-200 status code (${u})`, u);
|
|
8974
8896
|
return;
|
|
8975
8897
|
}
|
|
8976
8898
|
if (!(l.get("content-type") || "").startsWith("text/event-stream")) {
|
|
8977
|
-
|
|
8899
|
+
Pe(this, Ee, mt).call(this, 'Invalid content type, expected "text/event-stream"', u);
|
|
8978
8900
|
return;
|
|
8979
8901
|
}
|
|
8980
|
-
if (
|
|
8902
|
+
if (x(this, ye) === this.CLOSED)
|
|
8981
8903
|
return;
|
|
8982
8904
|
Y(this, ye, this.OPEN);
|
|
8983
8905
|
const f = new Event("open");
|
|
8984
|
-
if ((o =
|
|
8985
|
-
|
|
8906
|
+
if ((o = x(this, _t)) == null || o.call(this, f), this.dispatchEvent(f), typeof a != "object" || !a || !("getReader" in a)) {
|
|
8907
|
+
Pe(this, Ee, mt).call(this, "Invalid response body, expected a web ReadableStream", u), this.close();
|
|
8986
8908
|
return;
|
|
8987
8909
|
}
|
|
8988
|
-
const d = new TextDecoder(),
|
|
8989
|
-
let
|
|
8910
|
+
const d = new TextDecoder(), y = a.getReader();
|
|
8911
|
+
let b = !0;
|
|
8990
8912
|
do {
|
|
8991
|
-
const { done: g, value:
|
|
8992
|
-
|
|
8993
|
-
} while (
|
|
8913
|
+
const { done: g, value: m } = await y.read();
|
|
8914
|
+
m && x(this, Ze).feed(d.decode(m, { stream: !g })), g && (b = !1, x(this, Ze).reset(), Pe(this, Ee, Qn).call(this));
|
|
8915
|
+
} while (b);
|
|
8994
8916
|
}), ie(this, qn, (i) => {
|
|
8995
|
-
Y(this,
|
|
8917
|
+
Y(this, xe, void 0), !(i.name === "AbortError" || i.type === "aborted") && Pe(this, Ee, Qn).call(this, Nn(i));
|
|
8996
8918
|
}), ie(this, zn, (i) => {
|
|
8997
|
-
typeof i.id == "string" && Y(this,
|
|
8919
|
+
typeof i.id == "string" && Y(this, vt, i.id);
|
|
8998
8920
|
const o = new MessageEvent(i.event || "message", {
|
|
8999
8921
|
data: i.data,
|
|
9000
|
-
origin:
|
|
8922
|
+
origin: x(this, Ye) ? x(this, Ye).origin : x(this, Fe).origin,
|
|
9001
8923
|
lastEventId: i.id || ""
|
|
9002
8924
|
});
|
|
9003
|
-
|
|
8925
|
+
x(this, Xe) && (!i.event || i.event === "message") && x(this, Xe).call(this, o), this.dispatchEvent(o);
|
|
9004
8926
|
}), ie(this, Vn, (i) => {
|
|
9005
|
-
Y(this,
|
|
8927
|
+
Y(this, Tt, i);
|
|
9006
8928
|
}), ie(this, Bn, () => {
|
|
9007
|
-
Y(this, nt, void 0),
|
|
8929
|
+
Y(this, nt, void 0), x(this, ye) === this.CONNECTING && Pe(this, Ee, Kn).call(this);
|
|
9008
8930
|
});
|
|
9009
8931
|
try {
|
|
9010
8932
|
if (e instanceof URL)
|
|
9011
8933
|
Y(this, Fe, e);
|
|
9012
8934
|
else if (typeof e == "string")
|
|
9013
|
-
Y(this, Fe, new URL(e,
|
|
8935
|
+
Y(this, Fe, new URL(e, nl()));
|
|
9014
8936
|
else
|
|
9015
8937
|
throw new Error("Invalid URL");
|
|
9016
8938
|
} catch {
|
|
9017
|
-
throw
|
|
8939
|
+
throw tl("An invalid or illegal string was specified");
|
|
9018
8940
|
}
|
|
9019
|
-
Y(this, Ze,
|
|
9020
|
-
onEvent:
|
|
9021
|
-
onRetry:
|
|
9022
|
-
})), Y(this, ye, this.CONNECTING), Y(this,
|
|
8941
|
+
Y(this, Ze, Xu({
|
|
8942
|
+
onEvent: x(this, zn),
|
|
8943
|
+
onRetry: x(this, Vn)
|
|
8944
|
+
})), Y(this, ye, this.CONNECTING), Y(this, Tt, 3e3), Y(this, Yt, (r = t == null ? void 0 : t.fetch) != null ? r : globalThis.fetch), Y(this, qt, (s = t == null ? void 0 : t.withCredentials) != null ? s : !1), Pe(this, Ee, Kn).call(this);
|
|
9023
8945
|
}
|
|
9024
8946
|
/**
|
|
9025
8947
|
* Returns the state of this EventSource object's connection. It can have the values described below.
|
|
@@ -9032,7 +8954,7 @@ class Vt extends EventTarget {
|
|
|
9032
8954
|
* @public
|
|
9033
8955
|
*/
|
|
9034
8956
|
get readyState() {
|
|
9035
|
-
return
|
|
8957
|
+
return x(this, ye);
|
|
9036
8958
|
}
|
|
9037
8959
|
/**
|
|
9038
8960
|
* Returns the URL providing the event stream.
|
|
@@ -9042,7 +8964,7 @@ class Vt extends EventTarget {
|
|
|
9042
8964
|
* @public
|
|
9043
8965
|
*/
|
|
9044
8966
|
get url() {
|
|
9045
|
-
return
|
|
8967
|
+
return x(this, Fe).href;
|
|
9046
8968
|
}
|
|
9047
8969
|
/**
|
|
9048
8970
|
* Returns true if the credentials mode for connection requests to the URL providing the event stream is set to "include", and false otherwise.
|
|
@@ -9050,25 +8972,25 @@ class Vt extends EventTarget {
|
|
|
9050
8972
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/withCredentials)
|
|
9051
8973
|
*/
|
|
9052
8974
|
get withCredentials() {
|
|
9053
|
-
return
|
|
8975
|
+
return x(this, qt);
|
|
9054
8976
|
}
|
|
9055
8977
|
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/error_event) */
|
|
9056
8978
|
get onerror() {
|
|
9057
|
-
return
|
|
8979
|
+
return x(this, st);
|
|
9058
8980
|
}
|
|
9059
8981
|
set onerror(e) {
|
|
9060
8982
|
Y(this, st, e);
|
|
9061
8983
|
}
|
|
9062
8984
|
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/message_event) */
|
|
9063
8985
|
get onmessage() {
|
|
9064
|
-
return
|
|
8986
|
+
return x(this, Xe);
|
|
9065
8987
|
}
|
|
9066
8988
|
set onmessage(e) {
|
|
9067
8989
|
Y(this, Xe, e);
|
|
9068
8990
|
}
|
|
9069
8991
|
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/open_event) */
|
|
9070
8992
|
get onopen() {
|
|
9071
|
-
return
|
|
8993
|
+
return x(this, _t);
|
|
9072
8994
|
}
|
|
9073
8995
|
set onopen(e) {
|
|
9074
8996
|
Y(this, _t, e);
|
|
@@ -9089,16 +9011,16 @@ class Vt extends EventTarget {
|
|
|
9089
9011
|
* @public
|
|
9090
9012
|
*/
|
|
9091
9013
|
close() {
|
|
9092
|
-
|
|
9014
|
+
x(this, nt) && clearTimeout(x(this, nt)), x(this, ye) !== this.CLOSED && (x(this, xe) && x(this, xe).abort(), Y(this, ye, this.CLOSED), Y(this, xe, void 0));
|
|
9093
9015
|
}
|
|
9094
9016
|
}
|
|
9095
|
-
ye = /* @__PURE__ */ new WeakMap(), Fe = /* @__PURE__ */ new WeakMap(), Ye = /* @__PURE__ */ new WeakMap(),
|
|
9017
|
+
ye = /* @__PURE__ */ new WeakMap(), Fe = /* @__PURE__ */ new WeakMap(), Ye = /* @__PURE__ */ new WeakMap(), qt = /* @__PURE__ */ new WeakMap(), Yt = /* @__PURE__ */ new WeakMap(), Tt = /* @__PURE__ */ new WeakMap(), nt = /* @__PURE__ */ new WeakMap(), vt = /* @__PURE__ */ new WeakMap(), xe = /* @__PURE__ */ new WeakMap(), Ze = /* @__PURE__ */ new WeakMap(), st = /* @__PURE__ */ new WeakMap(), Xe = /* @__PURE__ */ new WeakMap(), _t = /* @__PURE__ */ new WeakMap(), Ee = /* @__PURE__ */ new WeakSet(), /**
|
|
9096
9018
|
* Connect to the given URL and start receiving events
|
|
9097
9019
|
*
|
|
9098
9020
|
* @internal
|
|
9099
9021
|
*/
|
|
9100
9022
|
Kn = function() {
|
|
9101
|
-
Y(this, ye, this.CONNECTING), Y(this,
|
|
9023
|
+
Y(this, ye, this.CONNECTING), Y(this, xe, new AbortController()), x(this, Yt)(x(this, Fe), Pe(this, Ee, hs).call(this)).then(x(this, Wn)).catch(x(this, qn));
|
|
9102
9024
|
}, Wn = /* @__PURE__ */ new WeakMap(), qn = /* @__PURE__ */ new WeakMap(), /**
|
|
9103
9025
|
* Get request options for the `fetch()` request
|
|
9104
9026
|
*
|
|
@@ -9112,9 +9034,9 @@ hs = function() {
|
|
|
9112
9034
|
// [spec] …will have their mode set to "cors"…
|
|
9113
9035
|
mode: "cors",
|
|
9114
9036
|
redirect: "follow",
|
|
9115
|
-
headers: { Accept: "text/event-stream",
|
|
9037
|
+
headers: { Accept: "text/event-stream", ...x(this, vt) ? { "Last-Event-ID": x(this, vt) } : void 0 },
|
|
9116
9038
|
cache: "no-store",
|
|
9117
|
-
signal: (n =
|
|
9039
|
+
signal: (n = x(this, xe)) == null ? void 0 : n.signal
|
|
9118
9040
|
};
|
|
9119
9041
|
return "window" in globalThis && (e.credentials = this.withCredentials ? "include" : "same-origin"), e;
|
|
9120
9042
|
}, zn = /* @__PURE__ */ new WeakMap(), Vn = /* @__PURE__ */ new WeakMap(), /**
|
|
@@ -9126,9 +9048,9 @@ hs = function() {
|
|
|
9126
9048
|
*/
|
|
9127
9049
|
mt = function(n, e) {
|
|
9128
9050
|
var t;
|
|
9129
|
-
|
|
9051
|
+
x(this, ye) !== this.CLOSED && Y(this, ye, this.CLOSED);
|
|
9130
9052
|
const r = new fs("error", { code: e, message: n });
|
|
9131
|
-
(t =
|
|
9053
|
+
(t = x(this, st)) == null || t.call(this, r), this.dispatchEvent(r);
|
|
9132
9054
|
}, /**
|
|
9133
9055
|
* Schedules a reconnection attempt against the EventSource endpoint.
|
|
9134
9056
|
*
|
|
@@ -9138,35 +9060,35 @@ mt = function(n, e) {
|
|
|
9138
9060
|
*/
|
|
9139
9061
|
Qn = function(n, e) {
|
|
9140
9062
|
var t;
|
|
9141
|
-
if (
|
|
9063
|
+
if (x(this, ye) === this.CLOSED)
|
|
9142
9064
|
return;
|
|
9143
9065
|
Y(this, ye, this.CONNECTING);
|
|
9144
9066
|
const r = new fs("error", { code: e, message: n });
|
|
9145
|
-
(t =
|
|
9067
|
+
(t = x(this, st)) == null || t.call(this, r), this.dispatchEvent(r), Y(this, nt, setTimeout(x(this, Bn), x(this, Tt)));
|
|
9146
9068
|
}, Bn = /* @__PURE__ */ new WeakMap(), /**
|
|
9147
9069
|
* ReadyState representing an EventSource currently trying to connect
|
|
9148
9070
|
*
|
|
9149
9071
|
* @public
|
|
9150
9072
|
*/
|
|
9151
|
-
|
|
9073
|
+
zt.CONNECTING = 0, /**
|
|
9152
9074
|
* ReadyState representing an EventSource connection that is open (eg connected)
|
|
9153
9075
|
*
|
|
9154
9076
|
* @public
|
|
9155
9077
|
*/
|
|
9156
|
-
|
|
9078
|
+
zt.OPEN = 1, /**
|
|
9157
9079
|
* ReadyState representing an EventSource connection that is closed (eg disconnected)
|
|
9158
9080
|
*
|
|
9159
9081
|
* @public
|
|
9160
9082
|
*/
|
|
9161
|
-
|
|
9162
|
-
function
|
|
9083
|
+
zt.CLOSED = 2;
|
|
9084
|
+
function nl() {
|
|
9163
9085
|
const n = "document" in globalThis ? globalThis.document : void 0;
|
|
9164
9086
|
return n && typeof n == "object" && "baseURI" in n && typeof n.baseURI == "string" ? n.baseURI : void 0;
|
|
9165
9087
|
}
|
|
9166
|
-
class ui extends
|
|
9088
|
+
class ui extends Wt {
|
|
9167
9089
|
}
|
|
9168
|
-
p(ui, "EventSourceImpl",
|
|
9169
|
-
function
|
|
9090
|
+
p(ui, "EventSourceImpl", zt);
|
|
9091
|
+
function rl(n) {
|
|
9170
9092
|
const e = {
|
|
9171
9093
|
...n,
|
|
9172
9094
|
useDateObjects: n.useDateObjects ?? !1
|
|
@@ -9175,8 +9097,8 @@ function sl(n) {
|
|
|
9175
9097
|
"@instantdb/react": ar
|
|
9176
9098
|
});
|
|
9177
9099
|
}
|
|
9178
|
-
const
|
|
9179
|
-
function
|
|
9100
|
+
const hl = rl;
|
|
9101
|
+
function pl({
|
|
9180
9102
|
as: n = "div",
|
|
9181
9103
|
spaceId: e,
|
|
9182
9104
|
room: t,
|
|
@@ -9191,39 +9113,39 @@ function yl({
|
|
|
9191
9113
|
const l = e || `cursors-space-default--${String(t.type)}-${t.id}`, f = t.usePresence({
|
|
9192
9114
|
keys: [l]
|
|
9193
9115
|
}), d = t._core._reactor.getPresence(t.type, t.id);
|
|
9194
|
-
function
|
|
9195
|
-
const
|
|
9116
|
+
function y(_, w) {
|
|
9117
|
+
const C = w.clientX, v = w.clientY, U = (C - _.left) / _.width * 100, I = (v - _.top) / _.height * 100;
|
|
9196
9118
|
f.publishPresence({
|
|
9197
9119
|
[l]: {
|
|
9198
|
-
x:
|
|
9199
|
-
y:
|
|
9200
|
-
xPercent:
|
|
9120
|
+
x: C,
|
|
9121
|
+
y: v,
|
|
9122
|
+
xPercent: U,
|
|
9201
9123
|
yPercent: I,
|
|
9202
9124
|
color: i
|
|
9203
9125
|
}
|
|
9204
9126
|
});
|
|
9205
9127
|
}
|
|
9206
|
-
function
|
|
9207
|
-
c ||
|
|
9208
|
-
const w =
|
|
9209
|
-
|
|
9128
|
+
function b(_) {
|
|
9129
|
+
c || _.stopPropagation();
|
|
9130
|
+
const w = _.currentTarget.getBoundingClientRect();
|
|
9131
|
+
y(w, _);
|
|
9210
9132
|
}
|
|
9211
|
-
function g(
|
|
9133
|
+
function g(_) {
|
|
9212
9134
|
f.publishPresence({
|
|
9213
9135
|
[l]: void 0
|
|
9214
9136
|
});
|
|
9215
9137
|
}
|
|
9216
|
-
function _
|
|
9217
|
-
if (
|
|
9138
|
+
function m(_) {
|
|
9139
|
+
if (_.touches.length !== 1)
|
|
9218
9140
|
return;
|
|
9219
|
-
const w =
|
|
9141
|
+
const w = _.touches[0];
|
|
9220
9142
|
if (w.target instanceof Element) {
|
|
9221
|
-
c ||
|
|
9222
|
-
const
|
|
9223
|
-
|
|
9143
|
+
c || _.stopPropagation();
|
|
9144
|
+
const C = w.target.getBoundingClientRect();
|
|
9145
|
+
y(C, w);
|
|
9224
9146
|
}
|
|
9225
9147
|
}
|
|
9226
|
-
function
|
|
9148
|
+
function T(_) {
|
|
9227
9149
|
f.publishPresence({
|
|
9228
9150
|
[l]: void 0
|
|
9229
9151
|
});
|
|
@@ -9231,10 +9153,10 @@ function yl({
|
|
|
9231
9153
|
return Ui(
|
|
9232
9154
|
n,
|
|
9233
9155
|
{
|
|
9234
|
-
onMouseMove:
|
|
9156
|
+
onMouseMove: b,
|
|
9235
9157
|
onMouseOut: g,
|
|
9236
|
-
onTouchMove:
|
|
9237
|
-
onTouchEnd:
|
|
9158
|
+
onTouchMove: m,
|
|
9159
|
+
onTouchEnd: T,
|
|
9238
9160
|
className: r,
|
|
9239
9161
|
style: {
|
|
9240
9162
|
position: "relative",
|
|
@@ -9243,31 +9165,31 @@ function yl({
|
|
|
9243
9165
|
},
|
|
9244
9166
|
[
|
|
9245
9167
|
o,
|
|
9246
|
-
/* @__PURE__ */
|
|
9168
|
+
/* @__PURE__ */ ae.jsx(
|
|
9247
9169
|
"div",
|
|
9248
9170
|
{
|
|
9249
9171
|
style: {
|
|
9250
9172
|
...ps,
|
|
9251
|
-
...
|
|
9252
|
-
zIndex: u !== void 0 ? u :
|
|
9173
|
+
...il,
|
|
9174
|
+
zIndex: u !== void 0 ? u : ol
|
|
9253
9175
|
},
|
|
9254
|
-
children: Object.entries(f.peers).map(([
|
|
9255
|
-
const
|
|
9256
|
-
return
|
|
9176
|
+
children: Object.entries(f.peers).map(([_, w]) => {
|
|
9177
|
+
const C = w[l];
|
|
9178
|
+
return C ? /* @__PURE__ */ ae.jsx(
|
|
9257
9179
|
"div",
|
|
9258
9180
|
{
|
|
9259
9181
|
style: {
|
|
9260
9182
|
...ps,
|
|
9261
|
-
transform: `translate(${
|
|
9183
|
+
transform: `translate(${C.xPercent}%, ${C.yPercent}%)`,
|
|
9262
9184
|
transformOrigin: "0 0",
|
|
9263
9185
|
transition: "transform 100ms"
|
|
9264
9186
|
},
|
|
9265
9187
|
children: a ? a({
|
|
9266
|
-
color:
|
|
9267
|
-
presence: d == null ? void 0 : d.peers[
|
|
9268
|
-
}) : /* @__PURE__ */
|
|
9188
|
+
color: C.color,
|
|
9189
|
+
presence: d == null ? void 0 : d.peers[_]
|
|
9190
|
+
}) : /* @__PURE__ */ ae.jsx(sl, { ...C })
|
|
9269
9191
|
},
|
|
9270
|
-
|
|
9192
|
+
_
|
|
9271
9193
|
) : null;
|
|
9272
9194
|
})
|
|
9273
9195
|
},
|
|
@@ -9276,9 +9198,9 @@ function yl({
|
|
|
9276
9198
|
]
|
|
9277
9199
|
);
|
|
9278
9200
|
}
|
|
9279
|
-
function
|
|
9201
|
+
function sl({ color: n }) {
|
|
9280
9202
|
const t = n || "black";
|
|
9281
|
-
return /* @__PURE__ */
|
|
9203
|
+
return /* @__PURE__ */ ae.jsxs(
|
|
9282
9204
|
"svg",
|
|
9283
9205
|
{
|
|
9284
9206
|
style: { height: 35, width: 35 },
|
|
@@ -9286,36 +9208,36 @@ function il({ color: n }) {
|
|
|
9286
9208
|
fill: "none",
|
|
9287
9209
|
xmlns: "http://www.w3.org/2000/svg",
|
|
9288
9210
|
children: [
|
|
9289
|
-
/* @__PURE__ */
|
|
9211
|
+
/* @__PURE__ */ ae.jsxs(
|
|
9290
9212
|
"g",
|
|
9291
9213
|
{
|
|
9292
9214
|
fill: "rgba(0,0,0,.2)",
|
|
9293
9215
|
transform: "matrix(1, 0, 0, 1, -11.999999046325684, -8.406899452209473)",
|
|
9294
9216
|
children: [
|
|
9295
|
-
/* @__PURE__ */
|
|
9296
|
-
/* @__PURE__ */
|
|
9217
|
+
/* @__PURE__ */ ae.jsx("path", { d: "m12 24.4219v-16.015l11.591 11.619h-6.781l-.411.124z" }),
|
|
9218
|
+
/* @__PURE__ */ ae.jsx("path", { d: "m21.0845 25.0962-3.605 1.535-4.682-11.089 3.686-1.553z" })
|
|
9297
9219
|
]
|
|
9298
9220
|
}
|
|
9299
9221
|
),
|
|
9300
|
-
/* @__PURE__ */
|
|
9222
|
+
/* @__PURE__ */ ae.jsxs(
|
|
9301
9223
|
"g",
|
|
9302
9224
|
{
|
|
9303
9225
|
fill: "white",
|
|
9304
9226
|
transform: "matrix(1, 0, 0, 1, -11.999999046325684, -8.406899452209473)",
|
|
9305
9227
|
children: [
|
|
9306
|
-
/* @__PURE__ */
|
|
9307
|
-
/* @__PURE__ */
|
|
9228
|
+
/* @__PURE__ */ ae.jsx("path", { d: "m12 24.4219v-16.015l11.591 11.619h-6.781l-.411.124z" }),
|
|
9229
|
+
/* @__PURE__ */ ae.jsx("path", { d: "m21.0845 25.0962-3.605 1.535-4.682-11.089 3.686-1.553z" })
|
|
9308
9230
|
]
|
|
9309
9231
|
}
|
|
9310
9232
|
),
|
|
9311
|
-
/* @__PURE__ */
|
|
9233
|
+
/* @__PURE__ */ ae.jsxs(
|
|
9312
9234
|
"g",
|
|
9313
9235
|
{
|
|
9314
9236
|
fill: t,
|
|
9315
9237
|
transform: "matrix(1, 0, 0, 1, -11.999999046325684, -8.406899452209473)",
|
|
9316
9238
|
children: [
|
|
9317
|
-
/* @__PURE__ */
|
|
9318
|
-
/* @__PURE__ */
|
|
9239
|
+
/* @__PURE__ */ ae.jsx("path", { d: "m19.751 24.4155-1.844.774-3.1-7.374 1.841-.775z" }),
|
|
9240
|
+
/* @__PURE__ */ ae.jsx("path", { d: "m13 10.814v11.188l2.969-2.866.428-.139h4.768z" })
|
|
9319
9241
|
]
|
|
9320
9242
|
}
|
|
9321
9243
|
)
|
|
@@ -9329,24 +9251,24 @@ const ps = {
|
|
|
9329
9251
|
left: 0,
|
|
9330
9252
|
bottom: 0,
|
|
9331
9253
|
right: 0
|
|
9332
|
-
},
|
|
9254
|
+
}, il = {
|
|
9333
9255
|
overflow: "hidden",
|
|
9334
9256
|
pointerEvents: "none",
|
|
9335
9257
|
userSelect: "none"
|
|
9336
|
-
},
|
|
9258
|
+
}, ol = 99999;
|
|
9337
9259
|
export {
|
|
9338
|
-
|
|
9260
|
+
pl as Cursors,
|
|
9339
9261
|
en as InstantAPIError,
|
|
9340
|
-
|
|
9262
|
+
Wt as InstantReactAbstractDatabase,
|
|
9341
9263
|
ui as InstantReactWebDatabase,
|
|
9342
9264
|
rc as StoreInterface,
|
|
9343
9265
|
Ue as SyncTableCallbackEventType,
|
|
9344
|
-
|
|
9345
|
-
|
|
9266
|
+
dl as createInstantRouteHandler,
|
|
9267
|
+
fl as i,
|
|
9346
9268
|
Z as id,
|
|
9347
|
-
|
|
9348
|
-
|
|
9269
|
+
rl as init,
|
|
9270
|
+
hl as init_experimental,
|
|
9349
9271
|
Ca as lookup,
|
|
9350
|
-
|
|
9351
|
-
|
|
9272
|
+
ul as setInstantWarningsEnabled,
|
|
9273
|
+
ll as tx
|
|
9352
9274
|
};
|