@instantdb/react 0.22.84-experimental.drewh-entity-caching.20110692986.1 → 0.22.84-experimental.drewh-explorer-component.20110784260.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/standalone/index.js +886 -889
- package/dist/standalone/index.umd.cjs +13 -13
- package/package.json +4 -4
package/dist/standalone/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import ci, { useRef as at, useCallback as ge, useSyncExternalStore as tn, useEffect as je, useMemo as nn, useState as di, createElement as js } from "react";
|
|
2
2
|
function z(t) {
|
|
3
3
|
if (typeof t == "number")
|
|
4
4
|
return (Math.abs(t * 2654435761) >>> 0).toString(16);
|
|
@@ -41,14 +41,14 @@ const U = {
|
|
|
41
41
|
Remove: "remove",
|
|
42
42
|
Replace: "replace",
|
|
43
43
|
Add: "add"
|
|
44
|
-
},
|
|
44
|
+
}, fi = Symbol.for("__MUTATIVE_PROXY_DRAFT__"), ks = Symbol("__MUTATIVE_RAW_RETURN_SYMBOL__"), vt = Symbol.iterator, ne = {
|
|
45
45
|
mutable: "mutable",
|
|
46
46
|
immutable: "immutable"
|
|
47
|
-
},
|
|
47
|
+
}, Mn = {};
|
|
48
48
|
function nt(t, e) {
|
|
49
49
|
return t instanceof Map ? t.has(e) : Object.prototype.hasOwnProperty.call(t, e);
|
|
50
50
|
}
|
|
51
|
-
function
|
|
51
|
+
function gr(t, e) {
|
|
52
52
|
if (e in t) {
|
|
53
53
|
let n = Reflect.getPrototypeOf(t);
|
|
54
54
|
for (; n; ) {
|
|
@@ -59,10 +59,10 @@ function Tr(t, e) {
|
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
|
-
function
|
|
62
|
+
function Rn(t) {
|
|
63
63
|
return Object.getPrototypeOf(t) === Set.prototype;
|
|
64
64
|
}
|
|
65
|
-
function
|
|
65
|
+
function xn(t) {
|
|
66
66
|
return Object.getPrototypeOf(t) === Map.prototype;
|
|
67
67
|
}
|
|
68
68
|
function te(t) {
|
|
@@ -73,9 +73,9 @@ function ke(t) {
|
|
|
73
73
|
return !!k(t);
|
|
74
74
|
}
|
|
75
75
|
function k(t) {
|
|
76
|
-
return typeof t != "object" ? null : t == null ? void 0 : t[
|
|
76
|
+
return typeof t != "object" ? null : t == null ? void 0 : t[fi];
|
|
77
77
|
}
|
|
78
|
-
function
|
|
78
|
+
function $n(t) {
|
|
79
79
|
var e;
|
|
80
80
|
const n = k(t);
|
|
81
81
|
return n ? (e = n.copy) !== null && e !== void 0 ? e : n.original : t;
|
|
@@ -86,7 +86,7 @@ function ae(t, e) {
|
|
|
86
86
|
let n;
|
|
87
87
|
return Object.getPrototypeOf(t) === Object.prototype || Array.isArray(t) || t instanceof Map || t instanceof Set || !!(e != null && e.mark) && ((n = e.mark(t, ne)) === ne.immutable || typeof n == "function");
|
|
88
88
|
}
|
|
89
|
-
function
|
|
89
|
+
function li(t, e = []) {
|
|
90
90
|
if (Object.hasOwnProperty.call(t, "key")) {
|
|
91
91
|
const n = t.parent.copy, r = k(be(n, t.key));
|
|
92
92
|
if (r !== null && (r == null ? void 0 : r.original) !== t.original)
|
|
@@ -97,10 +97,10 @@ function hi(t, e = []) {
|
|
|
97
97
|
e.push(s);
|
|
98
98
|
}
|
|
99
99
|
if (t.parent)
|
|
100
|
-
return
|
|
100
|
+
return li(t.parent, e);
|
|
101
101
|
e.reverse();
|
|
102
102
|
try {
|
|
103
|
-
|
|
103
|
+
Cs(t.copy, e);
|
|
104
104
|
} catch {
|
|
105
105
|
return null;
|
|
106
106
|
}
|
|
@@ -122,7 +122,7 @@ function Ht(t, e) {
|
|
|
122
122
|
function ye(t, e) {
|
|
123
123
|
return t === e ? t !== 0 || 1 / t === 1 / e : t !== t && e !== e;
|
|
124
124
|
}
|
|
125
|
-
function
|
|
125
|
+
function rn(t) {
|
|
126
126
|
if (t)
|
|
127
127
|
for (; t.finalities.revoke.length > 0; )
|
|
128
128
|
t.finalities.revoke.pop()();
|
|
@@ -133,7 +133,7 @@ function Ee(t, e) {
|
|
|
133
133
|
return r.indexOf("/") === -1 && r.indexOf("~") === -1 ? r : r.replace(/~/g, "~0").replace(/\//g, "~1");
|
|
134
134
|
}).join("/");
|
|
135
135
|
}
|
|
136
|
-
function
|
|
136
|
+
function Cs(t, e) {
|
|
137
137
|
for (let n = 0; n < e.length - 1; n += 1) {
|
|
138
138
|
const r = e[n];
|
|
139
139
|
if (t = be(Ce(t) === 3 ? Array.from(t) : t, r), typeof t != "object")
|
|
@@ -141,7 +141,7 @@ function Ps(t, e) {
|
|
|
141
141
|
}
|
|
142
142
|
return t;
|
|
143
143
|
}
|
|
144
|
-
function
|
|
144
|
+
function Ps(t) {
|
|
145
145
|
const e = Object.create(Object.getPrototypeOf(t));
|
|
146
146
|
return Reflect.ownKeys(t).forEach((n) => {
|
|
147
147
|
let r = Reflect.getOwnPropertyDescriptor(t, n);
|
|
@@ -157,26 +157,26 @@ function Is(t) {
|
|
|
157
157
|
}), Reflect.defineProperty(e, n, r);
|
|
158
158
|
}), e;
|
|
159
159
|
}
|
|
160
|
-
const
|
|
161
|
-
function
|
|
160
|
+
const Is = Object.prototype.propertyIsEnumerable;
|
|
161
|
+
function hi(t, e) {
|
|
162
162
|
let n;
|
|
163
163
|
if (Array.isArray(t))
|
|
164
164
|
return Array.prototype.concat.call(t);
|
|
165
165
|
if (t instanceof Set) {
|
|
166
|
-
if (!
|
|
166
|
+
if (!Rn(t)) {
|
|
167
167
|
const r = Object.getPrototypeOf(t).constructor;
|
|
168
168
|
return new r(t.values());
|
|
169
169
|
}
|
|
170
170
|
return Set.prototype.difference ? Set.prototype.difference.call(t, /* @__PURE__ */ new Set()) : new Set(t.values());
|
|
171
171
|
} else if (t instanceof Map) {
|
|
172
|
-
if (
|
|
172
|
+
if (!xn(t)) {
|
|
173
173
|
const r = Object.getPrototypeOf(t).constructor;
|
|
174
174
|
return new r(t);
|
|
175
175
|
}
|
|
176
176
|
return new Map(t);
|
|
177
177
|
} else if (e != null && e.mark && (n = e.mark(t, ne), n !== void 0) && n !== ne.mutable) {
|
|
178
178
|
if (n === ne.immutable)
|
|
179
|
-
return
|
|
179
|
+
return Ps(t);
|
|
180
180
|
if (typeof n == "function") {
|
|
181
181
|
if (e.enablePatches || e.enableAutoFreeze)
|
|
182
182
|
throw new Error("You can't use mark and patches or auto freeze together.");
|
|
@@ -188,17 +188,17 @@ function pi(t, e) {
|
|
|
188
188
|
return Object.keys(t).forEach((i) => {
|
|
189
189
|
r[i] = t[i];
|
|
190
190
|
}), Object.getOwnPropertySymbols(t).forEach((i) => {
|
|
191
|
-
|
|
191
|
+
Is.call(t, i) && (r[i] = t[i]);
|
|
192
192
|
}), r;
|
|
193
193
|
} else
|
|
194
194
|
throw new Error("Please check mark() to ensure that it is a stable marker draftable function.");
|
|
195
195
|
}
|
|
196
196
|
function Q(t) {
|
|
197
|
-
t.copy || (t.copy =
|
|
197
|
+
t.copy || (t.copy = hi(t.original, t.options));
|
|
198
198
|
}
|
|
199
199
|
function Je(t) {
|
|
200
200
|
if (!ae(t))
|
|
201
|
-
return
|
|
201
|
+
return $n(t);
|
|
202
202
|
if (Array.isArray(t))
|
|
203
203
|
return t.map(Je);
|
|
204
204
|
if (t instanceof Map) {
|
|
@@ -206,7 +206,7 @@ function Je(t) {
|
|
|
206
206
|
r,
|
|
207
207
|
Je(i)
|
|
208
208
|
]);
|
|
209
|
-
if (
|
|
209
|
+
if (!xn(t)) {
|
|
210
210
|
const r = Object.getPrototypeOf(t).constructor;
|
|
211
211
|
return new r(n);
|
|
212
212
|
}
|
|
@@ -214,7 +214,7 @@ function Je(t) {
|
|
|
214
214
|
}
|
|
215
215
|
if (t instanceof Set) {
|
|
216
216
|
const n = Array.from(t).map(Je);
|
|
217
|
-
if (!
|
|
217
|
+
if (!Rn(t)) {
|
|
218
218
|
const r = Object.getPrototypeOf(t).constructor;
|
|
219
219
|
return new r(n);
|
|
220
220
|
}
|
|
@@ -232,7 +232,7 @@ function fe(t) {
|
|
|
232
232
|
var e;
|
|
233
233
|
t.assignedMap = (e = t.assignedMap) !== null && e !== void 0 ? e : /* @__PURE__ */ new Map(), t.operated || (t.operated = !0, t.parent && fe(t.parent));
|
|
234
234
|
}
|
|
235
|
-
function
|
|
235
|
+
function Tr() {
|
|
236
236
|
throw new Error("Cannot modify frozen object");
|
|
237
237
|
}
|
|
238
238
|
function Me(t, e, n, r, i) {
|
|
@@ -260,12 +260,12 @@ function Me(t, e, n, r, i) {
|
|
|
260
260
|
case 2:
|
|
261
261
|
for (const [a, u] of t)
|
|
262
262
|
Me(a, a, n, r, i), Me(u, a, n, r, i);
|
|
263
|
-
t.set = t.clear = t.delete =
|
|
263
|
+
t.set = t.clear = t.delete = Tr;
|
|
264
264
|
break;
|
|
265
265
|
case 3:
|
|
266
266
|
for (const a of t)
|
|
267
267
|
Me(a, a, n, r, i);
|
|
268
|
-
t.add = t.clear = t.delete =
|
|
268
|
+
t.add = t.clear = t.delete = Tr;
|
|
269
269
|
break;
|
|
270
270
|
case 1:
|
|
271
271
|
Object.freeze(t);
|
|
@@ -281,7 +281,7 @@ function Me(t, e, n, r, i) {
|
|
|
281
281
|
}
|
|
282
282
|
r.pop(), i.pop();
|
|
283
283
|
}
|
|
284
|
-
function
|
|
284
|
+
function Dn(t, e) {
|
|
285
285
|
const n = Ce(t);
|
|
286
286
|
if (n === 0)
|
|
287
287
|
Reflect.ownKeys(t).forEach((r) => {
|
|
@@ -294,11 +294,11 @@ function Un(t, e) {
|
|
|
294
294
|
} else
|
|
295
295
|
t.forEach((r, i) => e(i, r, t));
|
|
296
296
|
}
|
|
297
|
-
function
|
|
297
|
+
function pi(t, e, n) {
|
|
298
298
|
if (ke(t) || !ae(t, n) || e.has(t) || Object.isFrozen(t))
|
|
299
299
|
return;
|
|
300
300
|
const r = t instanceof Set, i = r ? /* @__PURE__ */ new Map() : void 0;
|
|
301
|
-
if (e.add(t),
|
|
301
|
+
if (e.add(t), Dn(t, (s, o) => {
|
|
302
302
|
var a;
|
|
303
303
|
if (ke(o)) {
|
|
304
304
|
const u = k(o);
|
|
@@ -306,7 +306,7 @@ function yi(t, e, n) {
|
|
|
306
306
|
const c = !((a = u.assignedMap) === null || a === void 0) && a.size || u.operated ? u.copy : u.original;
|
|
307
307
|
ct(r ? i : t, s, c);
|
|
308
308
|
} else
|
|
309
|
-
|
|
309
|
+
pi(o, e, n);
|
|
310
310
|
}), i) {
|
|
311
311
|
const s = t, o = Array.from(s);
|
|
312
312
|
s.clear(), o.forEach((a) => {
|
|
@@ -314,39 +314,39 @@ function yi(t, e, n) {
|
|
|
314
314
|
});
|
|
315
315
|
}
|
|
316
316
|
}
|
|
317
|
-
function
|
|
317
|
+
function Ms(t, e) {
|
|
318
318
|
const n = t.type === 3 ? t.setMap : t.copy;
|
|
319
|
-
t.finalities.revoke.length > 1 && t.assignedMap.get(e) && n &&
|
|
319
|
+
t.finalities.revoke.length > 1 && t.assignedMap.get(e) && n && pi(be(n, e), t.finalities.handledSet, t.options);
|
|
320
320
|
}
|
|
321
|
-
function
|
|
321
|
+
function sn(t) {
|
|
322
322
|
t.type === 3 && t.copy && (t.copy.clear(), t.setMap.forEach((e) => {
|
|
323
|
-
t.copy.add(
|
|
323
|
+
t.copy.add($n(e));
|
|
324
324
|
}));
|
|
325
325
|
}
|
|
326
|
-
function
|
|
326
|
+
function on(t, e, n, r) {
|
|
327
327
|
if (t.operated && t.assignedMap && t.assignedMap.size > 0 && !t.finalized) {
|
|
328
328
|
if (n && r) {
|
|
329
|
-
const s =
|
|
329
|
+
const s = li(t);
|
|
330
330
|
s && e(t, s, n, r);
|
|
331
331
|
}
|
|
332
332
|
t.finalized = !0;
|
|
333
333
|
}
|
|
334
334
|
}
|
|
335
|
-
function
|
|
335
|
+
function Un(t, e, n, r) {
|
|
336
336
|
const i = k(n);
|
|
337
337
|
i && (i.callbacks || (i.callbacks = []), i.callbacks.push((s, o) => {
|
|
338
338
|
var a;
|
|
339
339
|
const u = t.type === 3 ? t.setMap : t.copy;
|
|
340
340
|
if (ye(be(u, e), n)) {
|
|
341
341
|
let c = i.original;
|
|
342
|
-
i.copy && (c = i.copy),
|
|
342
|
+
i.copy && (c = i.copy), sn(t), on(t, r, s, o), t.options.enableAutoFreeze && (t.options.updatedValues = (a = t.options.updatedValues) !== null && a !== void 0 ? a : /* @__PURE__ */ new WeakMap(), t.options.updatedValues.set(c, i.original)), ct(u, e, c);
|
|
343
343
|
}
|
|
344
344
|
}), t.options.enableAutoFreeze && i.finalities !== t.finalities && (t.options.enableAutoFreeze = !1)), ae(n, t.options) && t.finalities.draft.push(() => {
|
|
345
345
|
const s = t.type === 3 ? t.setMap : t.copy;
|
|
346
|
-
ye(be(s, e), n) &&
|
|
346
|
+
ye(be(s, e), n) && Ms(t, e);
|
|
347
347
|
});
|
|
348
348
|
}
|
|
349
|
-
function
|
|
349
|
+
function Rs(t, e, n, r, i) {
|
|
350
350
|
let { original: s, assignedMap: o, options: a } = t, u = t.copy;
|
|
351
351
|
u.length < s.length && ([s, u] = [u, s], [n, r] = [r, n]);
|
|
352
352
|
for (let c = 0; c < s.length; c += 1)
|
|
@@ -392,7 +392,7 @@ function xs(t, e, n, r, i) {
|
|
|
392
392
|
}
|
|
393
393
|
}
|
|
394
394
|
}
|
|
395
|
-
function
|
|
395
|
+
function xs({ original: t, copy: e, assignedMap: n }, r, i, s, o) {
|
|
396
396
|
n.forEach((a, u) => {
|
|
397
397
|
const c = be(t, u), d = St(be(e, u)), f = a ? nt(t, u) ? U.Replace : U.Add : U.Remove;
|
|
398
398
|
if (ye(c, d) && f === U.Replace)
|
|
@@ -401,7 +401,7 @@ function $s({ original: t, copy: e, assignedMap: n }, r, i, s, o) {
|
|
|
401
401
|
i.push(f === U.Remove ? { op: f, path: p } : { op: f, path: p, value: d }), s.push(f === U.Add ? { op: U.Remove, path: p } : f === U.Remove ? { op: U.Add, path: p, value: c } : { op: U.Replace, path: p, value: c });
|
|
402
402
|
});
|
|
403
403
|
}
|
|
404
|
-
function
|
|
404
|
+
function $s({ original: t, copy: e }, n, r, i, s) {
|
|
405
405
|
let o = 0;
|
|
406
406
|
t.forEach((a) => {
|
|
407
407
|
if (!e.has(a)) {
|
|
@@ -438,17 +438,17 @@ function ut(t, e, n, r) {
|
|
|
438
438
|
switch (t.type) {
|
|
439
439
|
case 0:
|
|
440
440
|
case 2:
|
|
441
|
-
return $s(t, e, n, r, i);
|
|
442
|
-
case 1:
|
|
443
441
|
return xs(t, e, n, r, i);
|
|
442
|
+
case 1:
|
|
443
|
+
return Rs(t, e, n, r, i);
|
|
444
444
|
case 3:
|
|
445
|
-
return
|
|
445
|
+
return $s(t, e, n, r, i);
|
|
446
446
|
}
|
|
447
447
|
}
|
|
448
448
|
const kt = (t, e, n = !1) => {
|
|
449
449
|
if (typeof t == "object" && t !== null && (!ae(t, e) || n))
|
|
450
450
|
throw new Error("Strict mode: Mutable data cannot be accessed directly, please use 'unsafe(callback)' wrap.");
|
|
451
|
-
},
|
|
451
|
+
}, an = {
|
|
452
452
|
get size() {
|
|
453
453
|
return te(k(this)).size;
|
|
454
454
|
},
|
|
@@ -457,7 +457,7 @@ const kt = (t, e, n = !1) => {
|
|
|
457
457
|
},
|
|
458
458
|
set(t, e) {
|
|
459
459
|
const n = k(this), r = te(n);
|
|
460
|
-
return (!r.has(t) || !ye(r.get(t), e)) && (Q(n), fe(n), n.assignedMap.set(t, !0), n.copy.set(t, e),
|
|
460
|
+
return (!r.has(t) || !ye(r.get(t), e)) && (Q(n), fe(n), n.assignedMap.set(t, !0), n.copy.set(t, e), Un(n, t, e, ut)), this;
|
|
461
461
|
},
|
|
462
462
|
delete(t) {
|
|
463
463
|
if (!this.has(t))
|
|
@@ -485,7 +485,7 @@ const kt = (t, e, n = !1) => {
|
|
|
485
485
|
const r = k(this), i = te(r).get(t), s = ((n = (e = r.options).mark) === null || n === void 0 ? void 0 : n.call(e, i, ne)) === ne.mutable;
|
|
486
486
|
if (r.options.strict && kt(i, r.options, s), s || r.finalized || !ae(i, r.options) || i !== r.original.get(t))
|
|
487
487
|
return i;
|
|
488
|
-
const o =
|
|
488
|
+
const o = Mn.createDraft({
|
|
489
489
|
original: i,
|
|
490
490
|
parentDraft: r,
|
|
491
491
|
key: t,
|
|
@@ -529,7 +529,7 @@ const kt = (t, e, n = !1) => {
|
|
|
529
529
|
[vt]() {
|
|
530
530
|
return this.entries();
|
|
531
531
|
}
|
|
532
|
-
},
|
|
532
|
+
}, Ds = Reflect.ownKeys(an), wr = (t, e, { isValuesIterator: n }) => () => {
|
|
533
533
|
var r, i;
|
|
534
534
|
const s = e.next();
|
|
535
535
|
if (s.done)
|
|
@@ -538,7 +538,7 @@ const kt = (t, e, n = !1) => {
|
|
|
538
538
|
let a = t.setMap.get(o);
|
|
539
539
|
const u = k(a), c = ((i = (r = t.options).mark) === null || i === void 0 ? void 0 : i.call(r, a, ne)) === ne.mutable;
|
|
540
540
|
if (t.options.strict && kt(o, t.options, c), !c && !u && ae(o, t.options) && !t.finalized && t.original.has(o)) {
|
|
541
|
-
const d =
|
|
541
|
+
const d = Mn.createDraft({
|
|
542
542
|
original: o,
|
|
543
543
|
parentDraft: t,
|
|
544
544
|
key: o,
|
|
@@ -565,7 +565,7 @@ const kt = (t, e, n = !1) => {
|
|
|
565
565
|
},
|
|
566
566
|
add(t) {
|
|
567
567
|
const e = k(this);
|
|
568
|
-
return this.has(t) || (Q(e), fe(e), e.assignedMap.set(t, !0), e.setMap.set(t, t),
|
|
568
|
+
return this.has(t) || (Q(e), fe(e), e.assignedMap.set(t, !0), e.setMap.set(t, t), Un(e, t, t, ut)), this;
|
|
569
569
|
},
|
|
570
570
|
delete(t) {
|
|
571
571
|
if (!this.has(t))
|
|
@@ -590,7 +590,7 @@ const kt = (t, e, n = !1) => {
|
|
|
590
590
|
const e = t.setMap.keys();
|
|
591
591
|
return {
|
|
592
592
|
[Symbol.iterator]: () => this.values(),
|
|
593
|
-
next:
|
|
593
|
+
next: wr(t, e, { isValuesIterator: !0 })
|
|
594
594
|
};
|
|
595
595
|
},
|
|
596
596
|
entries() {
|
|
@@ -599,7 +599,7 @@ const kt = (t, e, n = !1) => {
|
|
|
599
599
|
const e = t.setMap.keys();
|
|
600
600
|
return {
|
|
601
601
|
[Symbol.iterator]: () => this.entries(),
|
|
602
|
-
next:
|
|
602
|
+
next: wr(t, e, {
|
|
603
603
|
isValuesIterator: !1
|
|
604
604
|
})
|
|
605
605
|
};
|
|
@@ -640,13 +640,13 @@ Set.prototype.difference && Object.assign(Ct, {
|
|
|
640
640
|
return Set.prototype.isDisjointFrom.call(new Set(this.values()), t);
|
|
641
641
|
}
|
|
642
642
|
});
|
|
643
|
-
const
|
|
643
|
+
const Us = Reflect.ownKeys(Ct), yi = /* @__PURE__ */ new WeakSet(), bi = {
|
|
644
644
|
get(t, e, n) {
|
|
645
645
|
var r, i;
|
|
646
646
|
const s = (r = t.copy) === null || r === void 0 ? void 0 : r[e];
|
|
647
|
-
if (s &&
|
|
647
|
+
if (s && yi.has(s))
|
|
648
648
|
return s;
|
|
649
|
-
if (e ===
|
|
649
|
+
if (e === fi)
|
|
650
650
|
return t;
|
|
651
651
|
let o;
|
|
652
652
|
if (t.options.mark) {
|
|
@@ -655,14 +655,14 @@ const Ls = Reflect.ownKeys(Ct), bi = /* @__PURE__ */ new WeakSet(), _i = {
|
|
|
655
655
|
return t.options.strict && kt(c, t.options, !0), c;
|
|
656
656
|
}
|
|
657
657
|
const a = te(t);
|
|
658
|
-
if (a instanceof Map &&
|
|
658
|
+
if (a instanceof Map && Ds.includes(e)) {
|
|
659
659
|
if (e === "size")
|
|
660
|
-
return Object.getOwnPropertyDescriptor(
|
|
661
|
-
const c =
|
|
660
|
+
return Object.getOwnPropertyDescriptor(an, "size").get.call(t.proxy);
|
|
661
|
+
const c = an[e];
|
|
662
662
|
if (c)
|
|
663
663
|
return c.bind(t.proxy);
|
|
664
664
|
}
|
|
665
|
-
if (a instanceof Set &&
|
|
665
|
+
if (a instanceof Set && Us.includes(e)) {
|
|
666
666
|
if (e === "size")
|
|
667
667
|
return Object.getOwnPropertyDescriptor(Ct, "size").get.call(t.proxy);
|
|
668
668
|
const c = Ct[e];
|
|
@@ -670,7 +670,7 @@ const Ls = Reflect.ownKeys(Ct), bi = /* @__PURE__ */ new WeakSet(), _i = {
|
|
|
670
670
|
return c.bind(t.proxy);
|
|
671
671
|
}
|
|
672
672
|
if (!nt(a, e)) {
|
|
673
|
-
const c =
|
|
673
|
+
const c = gr(a, e);
|
|
674
674
|
return c ? "value" in c ? c.value : (
|
|
675
675
|
// !case: support for getter
|
|
676
676
|
(i = c.get) === null || i === void 0 ? void 0 : i.call(t.proxy)
|
|
@@ -680,7 +680,7 @@ const Ls = Reflect.ownKeys(Ct), bi = /* @__PURE__ */ new WeakSet(), _i = {
|
|
|
680
680
|
if (t.options.strict && kt(u, t.options), t.finalized || !ae(u, t.options))
|
|
681
681
|
return u;
|
|
682
682
|
if (u === Ht(t.original, e)) {
|
|
683
|
-
if (Q(t), t.copy[e] =
|
|
683
|
+
if (Q(t), t.copy[e] = Ln({
|
|
684
684
|
original: t.original[e],
|
|
685
685
|
parentDraft: t,
|
|
686
686
|
key: t.type === 1 ? Number(e) : e,
|
|
@@ -701,11 +701,11 @@ const Ls = Reflect.ownKeys(Ct), bi = /* @__PURE__ */ new WeakSet(), _i = {
|
|
|
701
701
|
let i;
|
|
702
702
|
if (t.type === 1 && e !== "length" && !(Number.isInteger(i = Number(e)) && i >= 0 && (e === 0 || i === 0 || String(i) === String(e))))
|
|
703
703
|
throw new Error("Only supports setting array indices and the 'length' property.");
|
|
704
|
-
const s =
|
|
704
|
+
const s = gr(te(t), e);
|
|
705
705
|
if (s != null && s.set)
|
|
706
706
|
return s.set.call(t.proxy, n), !0;
|
|
707
707
|
const o = Ht(te(t), e), a = k(o);
|
|
708
|
-
return a && ye(a.original, n) ? (t.copy[e] = n, t.assignedMap = (r = t.assignedMap) !== null && r !== void 0 ? r : /* @__PURE__ */ new Map(), t.assignedMap.set(e, !1), !0) : (ye(n, o) && (n !== void 0 || nt(t.original, e)) || (Q(t), fe(t), nt(t.original, e) && ye(n, t.original[e]) ? t.assignedMap.delete(e) : t.assignedMap.set(e, !0), t.copy[e] = n,
|
|
708
|
+
return a && ye(a.original, n) ? (t.copy[e] = n, t.assignedMap = (r = t.assignedMap) !== null && r !== void 0 ? r : /* @__PURE__ */ new Map(), t.assignedMap.set(e, !1), !0) : (ye(n, o) && (n !== void 0 || nt(t.original, e)) || (Q(t), fe(t), nt(t.original, e) && ye(n, t.original[e]) ? t.assignedMap.delete(e) : t.assignedMap.set(e, !0), t.copy[e] = n, Un(t, e, n, ut)), !0);
|
|
709
709
|
},
|
|
710
710
|
has(t, e) {
|
|
711
711
|
return e in te(t);
|
|
@@ -733,10 +733,10 @@ const Ls = Reflect.ownKeys(Ct), bi = /* @__PURE__ */ new WeakSet(), _i = {
|
|
|
733
733
|
},
|
|
734
734
|
deleteProperty(t, e) {
|
|
735
735
|
var n;
|
|
736
|
-
return t.type === 1 ?
|
|
736
|
+
return t.type === 1 ? bi.set.call(this, t, e, void 0, t.proxy) : (Ht(t.original, e) !== void 0 || e in t.original ? (Q(t), fe(t), t.assignedMap.set(e, !1)) : (t.assignedMap = (n = t.assignedMap) !== null && n !== void 0 ? n : /* @__PURE__ */ new Map(), t.assignedMap.delete(e)), t.copy && delete t.copy[e], !0);
|
|
737
737
|
}
|
|
738
738
|
};
|
|
739
|
-
function
|
|
739
|
+
function Ln(t) {
|
|
740
740
|
const { original: e, parentDraft: n, key: r, finalities: i, options: s } = t, o = Ce(e), a = {
|
|
741
741
|
type: o,
|
|
742
742
|
finalized: !1,
|
|
@@ -750,8 +750,8 @@ function Fn(t) {
|
|
|
750
750
|
setMap: o === 3 ? new Map(e.entries()) : void 0
|
|
751
751
|
};
|
|
752
752
|
(r || "key" in t) && (a.key = r);
|
|
753
|
-
const { proxy: u, revoke: c } = Proxy.revocable(o === 1 ? Object.assign([], a) : a,
|
|
754
|
-
if (i.revoke.push(c),
|
|
753
|
+
const { proxy: u, revoke: c } = Proxy.revocable(o === 1 ? Object.assign([], a) : a, bi);
|
|
754
|
+
if (i.revoke.push(c), yi.add(u), a.proxy = u, n) {
|
|
755
755
|
const d = n;
|
|
756
756
|
d.finalities.draft.push((f, l) => {
|
|
757
757
|
var p, y;
|
|
@@ -760,7 +760,7 @@ function Fn(t) {
|
|
|
760
760
|
const w = be(_, r), g = k(w);
|
|
761
761
|
if (g) {
|
|
762
762
|
let m = g.original;
|
|
763
|
-
g.operated && (m =
|
|
763
|
+
g.operated && (m = $n(w)), sn(g), on(g, ut, f, l), d.options.enableAutoFreeze && (d.options.updatedValues = (p = d.options.updatedValues) !== null && p !== void 0 ? p : /* @__PURE__ */ new WeakMap(), d.options.updatedValues.set(m, g.original)), ct(_, r, m);
|
|
764
764
|
}
|
|
765
765
|
(y = b.callbacks) === null || y === void 0 || y.forEach((m) => {
|
|
766
766
|
m(f, l);
|
|
@@ -769,26 +769,26 @@ function Fn(t) {
|
|
|
769
769
|
} else {
|
|
770
770
|
const d = k(u);
|
|
771
771
|
d.finalities.draft.push((f, l) => {
|
|
772
|
-
|
|
772
|
+
sn(d), on(d, ut, f, l);
|
|
773
773
|
});
|
|
774
774
|
}
|
|
775
775
|
return u;
|
|
776
776
|
}
|
|
777
|
-
|
|
778
|
-
function
|
|
777
|
+
Mn.createDraft = Ln;
|
|
778
|
+
function Ls(t, e, n, r, i) {
|
|
779
779
|
var s;
|
|
780
780
|
const o = k(t), a = (s = o == null ? void 0 : o.original) !== null && s !== void 0 ? s : t, u = !!e.length;
|
|
781
781
|
if (o != null && o.operated)
|
|
782
782
|
for (; o.finalities.draft.length > 0; )
|
|
783
783
|
o.finalities.draft.pop()(n, r);
|
|
784
784
|
const c = u ? e[0] : o ? o.operated ? o.copy : o.original : t;
|
|
785
|
-
return o &&
|
|
785
|
+
return o && rn(o), i && Me(c, c, o == null ? void 0 : o.options.updatedValues), [
|
|
786
786
|
c,
|
|
787
787
|
n && u ? [{ op: U.Replace, path: [], value: e[0] }] : n,
|
|
788
788
|
r && u ? [{ op: U.Replace, path: [], value: a }] : r
|
|
789
789
|
];
|
|
790
790
|
}
|
|
791
|
-
function
|
|
791
|
+
function Fs(t, e) {
|
|
792
792
|
var n;
|
|
793
793
|
const r = {
|
|
794
794
|
draft: [],
|
|
@@ -797,7 +797,7 @@ function Ns(t, e) {
|
|
|
797
797
|
};
|
|
798
798
|
let i, s;
|
|
799
799
|
e.enablePatches && (i = [], s = []);
|
|
800
|
-
const a = ((n = e.mark) === null || n === void 0 ? void 0 : n.call(e, t, ne)) === ne.mutable || !ae(t, e) ? t :
|
|
800
|
+
const a = ((n = e.mark) === null || n === void 0 ? void 0 : n.call(e, t, ne)) === ne.mutable || !ae(t, e) ? t : Ln({
|
|
801
801
|
original: t,
|
|
802
802
|
parentDraft: null,
|
|
803
803
|
finalities: r,
|
|
@@ -806,14 +806,14 @@ function Ns(t, e) {
|
|
|
806
806
|
return [
|
|
807
807
|
a,
|
|
808
808
|
(u = []) => {
|
|
809
|
-
const [c, d, f] =
|
|
809
|
+
const [c, d, f] = Ls(a, u, i, s, e.enableAutoFreeze);
|
|
810
810
|
return e.enablePatches ? [c, d, f] : c;
|
|
811
811
|
}
|
|
812
812
|
];
|
|
813
813
|
}
|
|
814
|
-
function
|
|
814
|
+
function un(t) {
|
|
815
815
|
const { rootDraft: e, value: n, useRawReturn: r = !1, isRoot: i = !0 } = t;
|
|
816
|
-
|
|
816
|
+
Dn(n, (s, o, a) => {
|
|
817
817
|
const u = k(o);
|
|
818
818
|
if (u && e && u.finalities === e.finalities) {
|
|
819
819
|
t.isContainDraft = !0;
|
|
@@ -823,10 +823,10 @@ function cn(t) {
|
|
|
823
823
|
a.clear(), d.forEach((f) => a.add(s === f ? c : f));
|
|
824
824
|
} else
|
|
825
825
|
ct(a, s, c);
|
|
826
|
-
} else typeof o == "object" && o !== null && (t.value = o, t.isRoot = !1,
|
|
826
|
+
} else typeof o == "object" && o !== null && (t.value = o, t.isRoot = !1, un(t));
|
|
827
827
|
}), i && (t.isContainDraft || console.warn("The return value does not contain any draft, please use 'rawReturn()' to wrap the return value to improve performance."), r && console.warn("The return value contains drafts, please don't use 'rawReturn()' to wrap the return value."));
|
|
828
828
|
}
|
|
829
|
-
function
|
|
829
|
+
function _i(t) {
|
|
830
830
|
var e;
|
|
831
831
|
const n = k(t);
|
|
832
832
|
if (!ae(t, n == null ? void 0 : n.options))
|
|
@@ -836,7 +836,7 @@ function gi(t) {
|
|
|
836
836
|
return n.original;
|
|
837
837
|
let i;
|
|
838
838
|
function s() {
|
|
839
|
-
i = r === 2 ?
|
|
839
|
+
i = r === 2 ? xn(t) ? new Map(t) : new (Object.getPrototypeOf(t)).constructor(t) : r === 3 ? Array.from(n.setMap.values()) : hi(t, n == null ? void 0 : n.options);
|
|
840
840
|
}
|
|
841
841
|
if (n) {
|
|
842
842
|
n.finalized = !0;
|
|
@@ -847,23 +847,23 @@ function gi(t) {
|
|
|
847
847
|
}
|
|
848
848
|
} else
|
|
849
849
|
i = t;
|
|
850
|
-
if (
|
|
850
|
+
if (Dn(i, (o, a) => {
|
|
851
851
|
if (n && ye(be(n.original, o), a))
|
|
852
852
|
return;
|
|
853
|
-
const u =
|
|
853
|
+
const u = _i(a);
|
|
854
854
|
u !== a && (i === t && s(), ct(i, o, u));
|
|
855
855
|
}), r === 3) {
|
|
856
856
|
const o = (e = n == null ? void 0 : n.original) !== null && e !== void 0 ? e : i;
|
|
857
|
-
return
|
|
857
|
+
return Rn(o) ? new Set(i) : new (Object.getPrototypeOf(o)).constructor(i);
|
|
858
858
|
}
|
|
859
859
|
return i;
|
|
860
860
|
}
|
|
861
|
-
function
|
|
861
|
+
function mr(t) {
|
|
862
862
|
if (!ke(t))
|
|
863
863
|
throw new Error(`current() is only used for Draft, parameter: ${t}`);
|
|
864
|
-
return
|
|
864
|
+
return _i(t);
|
|
865
865
|
}
|
|
866
|
-
const
|
|
866
|
+
const Ns = (t) => function e(n, r, i) {
|
|
867
867
|
var s, o, a;
|
|
868
868
|
if (typeof n == "function" && typeof r != "function")
|
|
869
869
|
return function(S, ...I) {
|
|
@@ -874,7 +874,7 @@ const Ks = (t) => function e(n, r, i) {
|
|
|
874
874
|
if (typeof r != "function" && (d = r), d !== void 0 && Object.prototype.toString.call(d) !== "[object Object]")
|
|
875
875
|
throw new Error(`Invalid options: ${d}, 'options' should be an object.`);
|
|
876
876
|
d = Object.assign(Object.assign({}, t), d);
|
|
877
|
-
const f = ke(u) ?
|
|
877
|
+
const f = ke(u) ? mr(u) : u, l = Array.isArray(d.mark) ? (S, I) => {
|
|
878
878
|
for (const x of d.mark) {
|
|
879
879
|
if (typeof x != "function")
|
|
880
880
|
throw new Error(`Invalid mark: ${x}, 'mark' should be a function.`);
|
|
@@ -890,7 +890,7 @@ const Ks = (t) => function e(n, r, i) {
|
|
|
890
890
|
};
|
|
891
891
|
if (!ae(f, _) && typeof f == "object" && f !== null)
|
|
892
892
|
throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");
|
|
893
|
-
const [w, g] =
|
|
893
|
+
const [w, g] = Fs(f, _);
|
|
894
894
|
if (typeof r != "function") {
|
|
895
895
|
if (!ae(f, _))
|
|
896
896
|
throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");
|
|
@@ -900,24 +900,24 @@ const Ks = (t) => function e(n, r, i) {
|
|
|
900
900
|
try {
|
|
901
901
|
m = c(w);
|
|
902
902
|
} catch (S) {
|
|
903
|
-
throw
|
|
903
|
+
throw rn(k(w)), S;
|
|
904
904
|
}
|
|
905
905
|
const E = (S) => {
|
|
906
906
|
const I = k(w);
|
|
907
907
|
if (!ke(S)) {
|
|
908
908
|
if (S !== void 0 && !ye(S, w) && (I != null && I.operated))
|
|
909
909
|
throw new Error("Either the value is returned as a new non-draft value, or only the draft is modified without returning any value.");
|
|
910
|
-
const B = S == null ? void 0 : S[
|
|
910
|
+
const B = S == null ? void 0 : S[ks];
|
|
911
911
|
if (B) {
|
|
912
912
|
const Ve = B[0];
|
|
913
|
-
return _.strict && typeof S == "object" && S !== null &&
|
|
913
|
+
return _.strict && typeof S == "object" && S !== null && un({
|
|
914
914
|
rootDraft: I,
|
|
915
915
|
value: S,
|
|
916
916
|
useRawReturn: !0
|
|
917
917
|
}), g([Ve]);
|
|
918
918
|
}
|
|
919
919
|
if (S !== void 0)
|
|
920
|
-
return typeof S == "object" && S !== null &&
|
|
920
|
+
return typeof S == "object" && S !== null && un({ rootDraft: I, value: S }), g([S]);
|
|
921
921
|
}
|
|
922
922
|
if (S === w || S === void 0)
|
|
923
923
|
return g([]);
|
|
@@ -925,26 +925,26 @@ const Ks = (t) => function e(n, r, i) {
|
|
|
925
925
|
if (_ === x.options) {
|
|
926
926
|
if (x.operated)
|
|
927
927
|
throw new Error("Cannot return a modified child draft.");
|
|
928
|
-
return g([
|
|
928
|
+
return g([mr(S)]);
|
|
929
929
|
}
|
|
930
930
|
return g([S]);
|
|
931
931
|
};
|
|
932
932
|
return m instanceof Promise ? m.then(E, (S) => {
|
|
933
|
-
throw
|
|
933
|
+
throw rn(k(w)), S;
|
|
934
934
|
}) : E(m);
|
|
935
|
-
}, Pt =
|
|
935
|
+
}, Pt = Ns();
|
|
936
936
|
Object.prototype.constructor.toString();
|
|
937
|
-
function
|
|
937
|
+
function gi(t, e) {
|
|
938
938
|
const n = Object.keys(t), r = Object.keys(e);
|
|
939
939
|
return n.length === r.length && Object.keys(t).every((i) => e.hasOwnProperty(i));
|
|
940
940
|
}
|
|
941
|
-
function
|
|
941
|
+
function vr(t, e) {
|
|
942
942
|
return Object.keys(t).length === Object.keys(e).length && Object.keys(t).every((n) => e.hasOwnProperty(n) && t[n] === e[n]);
|
|
943
943
|
}
|
|
944
944
|
function Ot(t, e) {
|
|
945
|
-
return typeof t != "object" || typeof e != "object" || t === null || e === null ? t === e :
|
|
945
|
+
return typeof t != "object" || typeof e != "object" || t === null || e === null ? t === e : gi(t, e) ? Object.keys(t).every((n) => Ot(t[n], e[n])) : !1;
|
|
946
946
|
}
|
|
947
|
-
function
|
|
947
|
+
function Fn(t) {
|
|
948
948
|
if (!Ze(t))
|
|
949
949
|
return t;
|
|
950
950
|
const e = {};
|
|
@@ -952,7 +952,7 @@ function Nn(t) {
|
|
|
952
952
|
r !== void 0 && (e[n] = r);
|
|
953
953
|
return e;
|
|
954
954
|
}
|
|
955
|
-
function
|
|
955
|
+
function Ti(t, e) {
|
|
956
956
|
if (!Ze(t) || !Ze(e))
|
|
957
957
|
return e;
|
|
958
958
|
const n = Object.assign({}, t);
|
|
@@ -964,14 +964,14 @@ function wi(t, e) {
|
|
|
964
964
|
continue;
|
|
965
965
|
}
|
|
966
966
|
const i = Ze(t[r]) && Ze(e[r]);
|
|
967
|
-
n[r] = i ?
|
|
967
|
+
n[r] = i ? Ti(t[r], e[r]) : e[r];
|
|
968
968
|
}
|
|
969
969
|
return n;
|
|
970
970
|
}
|
|
971
971
|
function Ze(t) {
|
|
972
972
|
return typeof t == "object" && t !== null && !Array.isArray(t);
|
|
973
973
|
}
|
|
974
|
-
function
|
|
974
|
+
function Ks(t, e, n) {
|
|
975
975
|
if (!t || e.length === 0)
|
|
976
976
|
return;
|
|
977
977
|
let r = t || {};
|
|
@@ -982,7 +982,7 @@ function qs(t, e, n) {
|
|
|
982
982
|
const i = e[e.length - 1];
|
|
983
983
|
Array.isArray(r) && typeof i == "number" ? r.splice(i, 0, n) : r[i] = n;
|
|
984
984
|
}
|
|
985
|
-
function
|
|
985
|
+
function Sr(t, e, n) {
|
|
986
986
|
if (!t || e.length === 0)
|
|
987
987
|
return;
|
|
988
988
|
let r = t || {};
|
|
@@ -992,7 +992,7 @@ function Or(t, e, n) {
|
|
|
992
992
|
}
|
|
993
993
|
r[e[e.length - 1]] = n;
|
|
994
994
|
}
|
|
995
|
-
function
|
|
995
|
+
function wi(t, e) {
|
|
996
996
|
if (!t || e.length === 0)
|
|
997
997
|
return;
|
|
998
998
|
const [n, ...r] = e;
|
|
@@ -1001,13 +1001,13 @@ function mi(t, e) {
|
|
|
1001
1001
|
Array.isArray(t) ? t.splice(n, 1) : delete t[n];
|
|
1002
1002
|
return;
|
|
1003
1003
|
}
|
|
1004
|
-
|
|
1004
|
+
wi(t[n], r), qs(t[n]) && delete t[n];
|
|
1005
1005
|
}
|
|
1006
1006
|
}
|
|
1007
|
-
function
|
|
1007
|
+
function qs(t) {
|
|
1008
1008
|
return t && Object.keys(t).length === 0;
|
|
1009
1009
|
}
|
|
1010
|
-
const
|
|
1010
|
+
const Or = /ZULU|YEKT|YEKST|YAPT|YAKT|YAKST|XJT|WGT|WGST|WFT|WETDST|WET|WDT|WAT|WAST|WAKT|WADT|VUT|VOLT|VLAT|VLAST|VET|UZT|UZST|UYT|UYST|UTC|UT|ULAT|ULAST|UCT|TVT|TRUT|TOT|TMT|TKT|TJT|TFT|TAHT|SGT|SCT|SAST|SADT|RET|PYT|PYST|PWT|PST|PONT|PMST|PMDT|PKT|PKST|PHT|PGT|PETT|PETST|PET|PDT|OMST|OMSST|NZT|NZST|NZDT|NUT|NST|NPT|NOVT|NOVST|NFT|NDT|MYT|MVT|MUT|MUST|MST|MSK|MSD|MPT|MMT|MHT|MEZ|METDST|MET|MESZ|MEST|MDT|MAWT|MART|MAGT|MAGST|LKT|LINT|LIGT|LHST|LHDT|KST|KRAT|KRAST|KOST|KGT|KGST|KDT|JST|JAYT|IST|IRT|IRKT|IRKST|IOT|IDT|ICT|HST|HKT|GYT|GMT|GILT|GFT|GET|GEST|GAMT|GALT|FNT|FNST|FKT|FKST|FJT|FJST|FET|EST|EGT|EGST|EETDST|EET|EEST|EDT|EAT|EAST|EASST|DDUT|DAVT|CXT|CST|COT|CLT|CLST|CKT|CHUT|CHAST|CHADT|CETDST|CET|CEST|CDT|CCT|CAST|CADT|BTT|BST|BRT|BRST|BRA|BOT|BORT|BNT|BDT|BDST|AZT|AZST|AZOT|AZOST|AWST|AWSST|AST|ART|ARST|ANAT|ANAST|AMT|AMST|ALMT|ALMST|AKST|AKDT|AFT|AEST|AESST|AEDT|ADT|ACWST|ACT|ACST|ACSST|ACDT$/, Ws = {
|
|
1011
1011
|
ZULU: 0,
|
|
1012
1012
|
YEKT: 18e3,
|
|
1013
1013
|
YEKST: 21600,
|
|
@@ -1203,39 +1203,39 @@ const Er = /ZULU|YEKT|YEKST|YAPT|YAKT|YAKST|XJT|WGT|WGST|WFT|WETDST|WET|WDT|WAT|
|
|
|
1203
1203
|
ACSST: 37800,
|
|
1204
1204
|
ACDT: 37800
|
|
1205
1205
|
};
|
|
1206
|
-
function
|
|
1206
|
+
function zs(t) {
|
|
1207
1207
|
return new Date(t);
|
|
1208
1208
|
}
|
|
1209
|
-
function
|
|
1209
|
+
function Vs(t) {
|
|
1210
1210
|
return /* @__PURE__ */ new Date(t + "Z");
|
|
1211
1211
|
}
|
|
1212
|
-
const
|
|
1213
|
-
function
|
|
1214
|
-
const e = t.match(
|
|
1212
|
+
const Bs = /^(\d+)[\./-](\d+)[\./-](\d+)$/;
|
|
1213
|
+
function Gs(t) {
|
|
1214
|
+
const e = t.match(Bs);
|
|
1215
1215
|
if (!e)
|
|
1216
1216
|
return null;
|
|
1217
1217
|
const [n, r, i, s] = e;
|
|
1218
1218
|
return r <= 0 || i <= 0 || s <= 0 ? null : r > 999 ? new Date(Date.UTC(r, i - 1, s, 0, 0, 0, 0)) : new Date(Date.UTC(s, r - 1, i, 0, 0, 0, 0));
|
|
1219
1219
|
}
|
|
1220
|
-
function
|
|
1220
|
+
function Qs(t) {
|
|
1221
1221
|
const [e, n] = t.split(" ");
|
|
1222
1222
|
return /* @__PURE__ */ new Date(e + "T" + n + "Z");
|
|
1223
1223
|
}
|
|
1224
|
-
function
|
|
1224
|
+
function Hs(t) {
|
|
1225
1225
|
const [e, n] = t.split(" ");
|
|
1226
1226
|
return /* @__PURE__ */ new Date(e + "T" + n + "Z");
|
|
1227
1227
|
}
|
|
1228
|
-
function
|
|
1228
|
+
function Ys(t) {
|
|
1229
1229
|
return new Date(t);
|
|
1230
1230
|
}
|
|
1231
|
-
function
|
|
1231
|
+
function Js(t) {
|
|
1232
1232
|
const e = /^(\w{3}) (\w{3}) (\d{2}) (\d{4})$/;
|
|
1233
1233
|
if (!t.match(e))
|
|
1234
1234
|
throw new Error(`Unable to parse \`${t}\` as a date.`);
|
|
1235
1235
|
const r = /* @__PURE__ */ new Date(t + " UTC");
|
|
1236
1236
|
return new Date(Date.UTC(r.getUTCFullYear(), r.getUTCMonth(), r.getUTCDate(), 0, 0, 0, 0));
|
|
1237
1237
|
}
|
|
1238
|
-
function
|
|
1238
|
+
function Zs(t) {
|
|
1239
1239
|
const e = /^(.+T.+)([+-])(\d{2})$/, n = t.match(e);
|
|
1240
1240
|
if (n) {
|
|
1241
1241
|
const [, r, i, s] = n, o = `${r}${i}${s}:00`;
|
|
@@ -1243,7 +1243,7 @@ function Xs(t) {
|
|
|
1243
1243
|
}
|
|
1244
1244
|
return null;
|
|
1245
1245
|
}
|
|
1246
|
-
function
|
|
1246
|
+
function Xs(t) {
|
|
1247
1247
|
const e = /^(\d+)-(\d{1,2})-(\d{1,2})([ T])(.+)$/, n = t.match(e);
|
|
1248
1248
|
if (n) {
|
|
1249
1249
|
const [, r, i, s, o, a] = n, u = i.padStart(2, "0"), c = s.padStart(2, "0"), d = `${r}-${u}-${c}T${a}`;
|
|
@@ -1251,14 +1251,14 @@ function eo(t) {
|
|
|
1251
1251
|
}
|
|
1252
1252
|
return null;
|
|
1253
1253
|
}
|
|
1254
|
-
function
|
|
1254
|
+
function eo(t) {
|
|
1255
1255
|
const [e, n] = t.split(", "), [r, i, s] = e.split("/").map(Number), o = n.match(/(\d{1,2}):(\d{2}):(\d{2}) (AM|PM)/);
|
|
1256
1256
|
if (!o)
|
|
1257
1257
|
throw new Error(`Unable to parse time from: ${t}`);
|
|
1258
1258
|
let [, a, u, c, d] = o;
|
|
1259
1259
|
return a = Number(a), u = Number(u), c = Number(c), d === "PM" && a !== 12 ? a += 12 : d === "AM" && a === 12 && (a = 0), new Date(Date.UTC(s, r - 1, i, a, u, c));
|
|
1260
1260
|
}
|
|
1261
|
-
function
|
|
1261
|
+
function to(t) {
|
|
1262
1262
|
switch (t) {
|
|
1263
1263
|
case "epoch":
|
|
1264
1264
|
return /* @__PURE__ */ new Date(0);
|
|
@@ -1270,28 +1270,28 @@ function no(t) {
|
|
|
1270
1270
|
return null;
|
|
1271
1271
|
}
|
|
1272
1272
|
}
|
|
1273
|
-
function
|
|
1274
|
-
const e = t.match(
|
|
1273
|
+
function no(t) {
|
|
1274
|
+
const e = t.match(Or);
|
|
1275
1275
|
if (!e)
|
|
1276
1276
|
return null;
|
|
1277
|
-
const [n] = e, r =
|
|
1277
|
+
const [n] = e, r = Ws[n], i = new Date(t.replace(Or, "Z"));
|
|
1278
1278
|
return new Date(i.getTime() - r * 1e3);
|
|
1279
1279
|
}
|
|
1280
|
-
const
|
|
1281
|
-
|
|
1280
|
+
const ro = [
|
|
1281
|
+
Gs,
|
|
1282
|
+
Hs,
|
|
1283
|
+
Js,
|
|
1284
|
+
eo,
|
|
1282
1285
|
Ys,
|
|
1286
|
+
Vs,
|
|
1283
1287
|
Zs,
|
|
1288
|
+
Qs,
|
|
1289
|
+
zs,
|
|
1284
1290
|
to,
|
|
1285
|
-
Js,
|
|
1286
|
-
Bs,
|
|
1287
|
-
Xs,
|
|
1288
|
-
Hs,
|
|
1289
|
-
Vs,
|
|
1290
1291
|
no,
|
|
1291
|
-
|
|
1292
|
-
eo
|
|
1292
|
+
Xs
|
|
1293
1293
|
];
|
|
1294
|
-
function
|
|
1294
|
+
function io(t, e) {
|
|
1295
1295
|
try {
|
|
1296
1296
|
const n = t(e);
|
|
1297
1297
|
return n instanceof Date && !isNaN(n.getTime()) ? n : null;
|
|
@@ -1299,18 +1299,18 @@ function so(t, e) {
|
|
|
1299
1299
|
return null;
|
|
1300
1300
|
}
|
|
1301
1301
|
}
|
|
1302
|
-
function
|
|
1303
|
-
for (const e of
|
|
1304
|
-
const n =
|
|
1302
|
+
function cn(t) {
|
|
1303
|
+
for (const e of ro) {
|
|
1304
|
+
const n = io(e, t);
|
|
1305
1305
|
if (n)
|
|
1306
1306
|
return n;
|
|
1307
1307
|
}
|
|
1308
1308
|
return null;
|
|
1309
1309
|
}
|
|
1310
|
-
function
|
|
1310
|
+
function so(t) {
|
|
1311
1311
|
try {
|
|
1312
1312
|
const e = JSON.parse(t);
|
|
1313
|
-
return typeof e == "string" ?
|
|
1313
|
+
return typeof e == "string" ? cn(e) : null;
|
|
1314
1314
|
} catch {
|
|
1315
1315
|
return null;
|
|
1316
1316
|
}
|
|
@@ -1322,7 +1322,7 @@ function xt(t) {
|
|
|
1322
1322
|
if (t instanceof Date)
|
|
1323
1323
|
return t;
|
|
1324
1324
|
if (typeof t == "string") {
|
|
1325
|
-
const e =
|
|
1325
|
+
const e = cn(t) || so(t) || cn(t.trim());
|
|
1326
1326
|
if (!e)
|
|
1327
1327
|
throw new Error(`Unable to parse \`${t}\` as a date.`);
|
|
1328
1328
|
return e;
|
|
@@ -1331,13 +1331,13 @@ function xt(t) {
|
|
|
1331
1331
|
throw new Error(`Invalid date value \`${t}\`. Expected a date, number, or string, got type ${typeof t}.`);
|
|
1332
1332
|
}
|
|
1333
1333
|
}
|
|
1334
|
-
function
|
|
1334
|
+
function oo(t) {
|
|
1335
1335
|
return t.cardinality === "one";
|
|
1336
1336
|
}
|
|
1337
|
-
function
|
|
1337
|
+
function Nn(t) {
|
|
1338
1338
|
return t["value-type"] === "ref";
|
|
1339
1339
|
}
|
|
1340
|
-
function
|
|
1340
|
+
function Kn(t) {
|
|
1341
1341
|
return t["value-type"] === "blob";
|
|
1342
1342
|
}
|
|
1343
1343
|
function qe(t, e) {
|
|
@@ -1367,7 +1367,7 @@ function Z(t, e, n) {
|
|
|
1367
1367
|
let s = t.get(r);
|
|
1368
1368
|
s || (s = /* @__PURE__ */ new Map(), t.set(r, s)), Z(s, i, n);
|
|
1369
1369
|
}
|
|
1370
|
-
function
|
|
1370
|
+
function mi(t, e, n) {
|
|
1371
1371
|
const r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map();
|
|
1372
1372
|
for (const o of e) {
|
|
1373
1373
|
let [a, u, c, d] = o;
|
|
@@ -1376,22 +1376,22 @@ function vi(t, e, n) {
|
|
|
1376
1376
|
console.warn("no such attr", a, t);
|
|
1377
1377
|
continue;
|
|
1378
1378
|
}
|
|
1379
|
-
f["checked-data-type"] === "date" && n && (c = xt(c), o[2] = c),
|
|
1379
|
+
f["checked-data-type"] === "date" && n && (c = xt(c), o[2] = c), Nn(f) && Z(s, [c, u, a], o), Z(r, [a, u, c], o), Z(i, [u, a, c], o);
|
|
1380
1380
|
}
|
|
1381
1381
|
return { eav: r, aev: i, vae: s };
|
|
1382
1382
|
}
|
|
1383
|
-
function
|
|
1383
|
+
function vi(t) {
|
|
1384
1384
|
const e = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map();
|
|
1385
1385
|
for (const s of Object.values(t)) {
|
|
1386
1386
|
const o = s["forward-identity"], [a, u, c] = o, d = s["reverse-identity"];
|
|
1387
|
-
if (Z(r, [u, c], s),
|
|
1387
|
+
if (Z(r, [u, c], s), Kn(s) && Z(e, [u, c], s), s["primary?"] && Z(n, [u], s), d) {
|
|
1388
1388
|
const [f, l, p] = d;
|
|
1389
1389
|
Z(i, [l, p], s);
|
|
1390
1390
|
}
|
|
1391
1391
|
}
|
|
1392
1392
|
return { blobAttrs: e, primaryKeys: n, forwardIdents: r, revIdents: i };
|
|
1393
1393
|
}
|
|
1394
|
-
function
|
|
1394
|
+
function Si(t) {
|
|
1395
1395
|
return {
|
|
1396
1396
|
__type: t.__type,
|
|
1397
1397
|
attrs: t.attrs,
|
|
@@ -1401,18 +1401,18 @@ function Oi(t) {
|
|
|
1401
1401
|
useDateObjects: t.useDateObjects
|
|
1402
1402
|
};
|
|
1403
1403
|
}
|
|
1404
|
-
function
|
|
1404
|
+
function Oi(t) {
|
|
1405
1405
|
return Et(t.attrs, t.triples, t.cardinalityInference, t.linkIndex, t.useDateObjects);
|
|
1406
1406
|
}
|
|
1407
|
-
function
|
|
1407
|
+
function ao(t, e) {
|
|
1408
1408
|
return We(t.eav, [e]) !== void 0;
|
|
1409
1409
|
}
|
|
1410
|
-
function
|
|
1411
|
-
t.attrIndexes =
|
|
1410
|
+
function qn(t) {
|
|
1411
|
+
t.attrIndexes = vi(t.attrs);
|
|
1412
1412
|
}
|
|
1413
1413
|
function Et(t, e, n, r, i) {
|
|
1414
|
-
const s =
|
|
1415
|
-
return s.useDateObjects = i, s.attrs = t, s.attrIndexes =
|
|
1414
|
+
const s = mi(t, e, i);
|
|
1415
|
+
return s.useDateObjects = i, s.attrs = t, s.attrIndexes = vi(t), s.cardinalityInference = n, s.linkIndex = r, s.__type = "store", s;
|
|
1416
1416
|
}
|
|
1417
1417
|
function dt(t, e) {
|
|
1418
1418
|
var n, r;
|
|
@@ -1441,21 +1441,21 @@ function dt(t, e) {
|
|
|
1441
1441
|
return [i, ...a];
|
|
1442
1442
|
}
|
|
1443
1443
|
}
|
|
1444
|
-
function
|
|
1444
|
+
function Ei(t, e) {
|
|
1445
1445
|
const n = dt(t, e);
|
|
1446
1446
|
if (!n)
|
|
1447
1447
|
return;
|
|
1448
1448
|
const [r, i, s] = n, o = qe(t.attrs, i);
|
|
1449
|
-
o && (oe(t.eav, [r, i, s]), oe(t.aev, [i, r, s]),
|
|
1449
|
+
o && (oe(t.eav, [r, i, s]), oe(t.aev, [i, r, s]), Nn(o) && oe(t.vae, [s, i, r]));
|
|
1450
1450
|
}
|
|
1451
|
-
let
|
|
1452
|
-
function
|
|
1451
|
+
let uo = 0;
|
|
1452
|
+
function Ai(t, e, n) {
|
|
1453
1453
|
const [r, i, s] = n;
|
|
1454
1454
|
let o;
|
|
1455
1455
|
const a = We(t.eav, [r, i, s]);
|
|
1456
|
-
return a && (o = a[3]), o || Date.now() * 10 +
|
|
1456
|
+
return a && (o = a[3]), o || Date.now() * 10 + uo++;
|
|
1457
1457
|
}
|
|
1458
|
-
function
|
|
1458
|
+
function ji(t, e) {
|
|
1459
1459
|
var n;
|
|
1460
1460
|
const r = dt(t, e);
|
|
1461
1461
|
if (!r)
|
|
@@ -1465,10 +1465,10 @@ function ki(t, e) {
|
|
|
1465
1465
|
if (!a)
|
|
1466
1466
|
return;
|
|
1467
1467
|
a["checked-data-type"] === "date" && t.useDateObjects && (o = xt(o));
|
|
1468
|
-
const u = We(t.eav, [i, s, o]), c = (n = u == null ? void 0 : u[3]) !== null && n !== void 0 ? n :
|
|
1469
|
-
|
|
1468
|
+
const u = We(t.eav, [i, s, o]), c = (n = u == null ? void 0 : u[3]) !== null && n !== void 0 ? n : Ai(t, a, r), d = [i, s, o, c];
|
|
1469
|
+
oo(a) ? (Z(t.eav, [i, s], /* @__PURE__ */ new Map([[o, d]])), Z(t.aev, [s, i], /* @__PURE__ */ new Map([[o, d]]))) : (Z(t.eav, [i, s, o], d), Z(t.aev, [s, i, o], d)), Nn(a) && Z(t.vae, [o, s, i], d);
|
|
1470
1470
|
}
|
|
1471
|
-
function
|
|
1471
|
+
function co(t, e) {
|
|
1472
1472
|
var n;
|
|
1473
1473
|
const r = dt(t, e);
|
|
1474
1474
|
if (!r)
|
|
@@ -1476,7 +1476,7 @@ function fo(t, e) {
|
|
|
1476
1476
|
const [i, s, o] = r, a = qe(t.attrs, s);
|
|
1477
1477
|
if (!a)
|
|
1478
1478
|
return;
|
|
1479
|
-
if (!
|
|
1479
|
+
if (!Kn(a))
|
|
1480
1480
|
throw new Error("merge operation is not supported for links");
|
|
1481
1481
|
const u = We(t.eav, [i, s]);
|
|
1482
1482
|
if (!u)
|
|
@@ -1484,15 +1484,15 @@ function fo(t, e) {
|
|
|
1484
1484
|
const c = (n = u.values().next()) === null || n === void 0 ? void 0 : n.value;
|
|
1485
1485
|
if (!c)
|
|
1486
1486
|
return;
|
|
1487
|
-
const d = c[2], f =
|
|
1487
|
+
const d = c[2], f = Ti(d, o), l = [
|
|
1488
1488
|
i,
|
|
1489
1489
|
s,
|
|
1490
1490
|
f,
|
|
1491
|
-
|
|
1491
|
+
Ai(t, a, c)
|
|
1492
1492
|
];
|
|
1493
1493
|
Z(t.eav, [i, s], /* @__PURE__ */ new Map([[f, l]]));
|
|
1494
1494
|
}
|
|
1495
|
-
function
|
|
1495
|
+
function dn(t, e) {
|
|
1496
1496
|
var n, r;
|
|
1497
1497
|
const [i, s] = e, o = dt(t, [i]);
|
|
1498
1498
|
if (!o)
|
|
@@ -1503,7 +1503,7 @@ function fn(t, e) {
|
|
|
1503
1503
|
const f = t.attrs[d];
|
|
1504
1504
|
f && f["on-delete-reverse"] === "cascade" && X(u.get(d), 1).forEach(([l, p, y]) => {
|
|
1505
1505
|
var b;
|
|
1506
|
-
return
|
|
1506
|
+
return dn(t, [y, (b = f["reverse-identity"]) === null || b === void 0 ? void 0 : b[1]]);
|
|
1507
1507
|
}), // Fall back to deleting everything if we've rehydrated tx-steps from
|
|
1508
1508
|
// the store that didn't set `etype` in deleteEntity
|
|
1509
1509
|
(!s || // If we don't know about the attr, let's just get rid of it
|
|
@@ -1516,54 +1516,54 @@ function fn(t, e) {
|
|
|
1516
1516
|
c && c.forEach((d) => {
|
|
1517
1517
|
var f, l, p;
|
|
1518
1518
|
const [y, b, _] = d, w = t.attrs[b];
|
|
1519
|
-
(!s || !w || ((f = w["reverse-identity"]) === null || f === void 0 ? void 0 : f[1]) === s) && (oe(t.eav, [y, b, _]), oe(t.aev, [b, y, _]), oe(t.vae, [_, b, y])), w && w["on-delete"] === "cascade" && ((l = w["reverse-identity"]) === null || l === void 0 ? void 0 : l[1]) === s &&
|
|
1519
|
+
(!s || !w || ((f = w["reverse-identity"]) === null || f === void 0 ? void 0 : f[1]) === s) && (oe(t.eav, [y, b, _]), oe(t.aev, [b, y, _]), oe(t.vae, [_, b, y])), w && w["on-delete"] === "cascade" && ((l = w["reverse-identity"]) === null || l === void 0 ? void 0 : l[1]) === s && dn(t, [y, (p = w["forward-identity"]) === null || p === void 0 ? void 0 : p[1]]);
|
|
1520
1520
|
}), ((r = t.vae.get(a)) === null || r === void 0 ? void 0 : r.size) === 0 && oe(t.vae, [a]);
|
|
1521
1521
|
}
|
|
1522
|
-
function
|
|
1523
|
-
const n =
|
|
1522
|
+
function ki(t, e) {
|
|
1523
|
+
const n = mi(t.attrs, e, t.useDateObjects);
|
|
1524
1524
|
Object.keys(n).forEach((r) => {
|
|
1525
1525
|
t[r] = n[r];
|
|
1526
1526
|
});
|
|
1527
1527
|
}
|
|
1528
|
-
function
|
|
1529
|
-
t.attrs[e.id] = e,
|
|
1528
|
+
function fo(t, [e]) {
|
|
1529
|
+
t.attrs[e.id] = e, qn(t);
|
|
1530
1530
|
}
|
|
1531
|
-
function
|
|
1531
|
+
function Ci(t) {
|
|
1532
1532
|
return X(t.eav, 3);
|
|
1533
1533
|
}
|
|
1534
|
-
function
|
|
1534
|
+
function lo(t, [e]) {
|
|
1535
1535
|
if (!t.attrs[e])
|
|
1536
1536
|
return;
|
|
1537
|
-
const n =
|
|
1538
|
-
delete t.attrs[e],
|
|
1537
|
+
const n = Ci(t).filter(([r, i]) => i !== e);
|
|
1538
|
+
delete t.attrs[e], qn(t), ki(t, n);
|
|
1539
1539
|
}
|
|
1540
|
-
function
|
|
1540
|
+
function ho(t, [e]) {
|
|
1541
1541
|
const n = t.attrs[e.id];
|
|
1542
|
-
n && (t.attrs[e.id] = Object.assign(Object.assign({}, n), e),
|
|
1542
|
+
n && (t.attrs[e.id] = Object.assign(Object.assign({}, n), e), qn(t), ki(t, Ci(t)));
|
|
1543
1543
|
}
|
|
1544
|
-
function
|
|
1544
|
+
function po(t, e) {
|
|
1545
1545
|
const [n, ...r] = e;
|
|
1546
1546
|
switch (n) {
|
|
1547
1547
|
case "add-triple":
|
|
1548
|
-
|
|
1548
|
+
ji(t, r);
|
|
1549
1549
|
break;
|
|
1550
1550
|
case "deep-merge-triple":
|
|
1551
|
-
|
|
1551
|
+
co(t, r);
|
|
1552
1552
|
break;
|
|
1553
1553
|
case "retract-triple":
|
|
1554
|
-
|
|
1554
|
+
Ei(t, r);
|
|
1555
1555
|
break;
|
|
1556
1556
|
case "delete-entity":
|
|
1557
|
-
|
|
1557
|
+
dn(t, r);
|
|
1558
1558
|
break;
|
|
1559
1559
|
case "add-attr":
|
|
1560
|
-
|
|
1560
|
+
fo(t, r);
|
|
1561
1561
|
break;
|
|
1562
1562
|
case "delete-attr":
|
|
1563
|
-
|
|
1563
|
+
lo(t, r);
|
|
1564
1564
|
break;
|
|
1565
1565
|
case "update-attr":
|
|
1566
|
-
|
|
1566
|
+
ho(t, r);
|
|
1567
1567
|
break;
|
|
1568
1568
|
case "restore-attr":
|
|
1569
1569
|
break;
|
|
@@ -1618,13 +1618,13 @@ function gt(t, e, n) {
|
|
|
1618
1618
|
}
|
|
1619
1619
|
return i;
|
|
1620
1620
|
}
|
|
1621
|
-
function
|
|
1621
|
+
function yo(t, e, n) {
|
|
1622
1622
|
let r = "";
|
|
1623
1623
|
return t !== void 0 && (r += "e"), e !== void 0 && (r += "a"), n !== void 0 && (r += "v"), r;
|
|
1624
1624
|
}
|
|
1625
|
-
function
|
|
1625
|
+
function bo(t, [e, n, r]) {
|
|
1626
1626
|
var i, s;
|
|
1627
|
-
switch (
|
|
1627
|
+
switch (yo(e, n, r)) {
|
|
1628
1628
|
case "e": {
|
|
1629
1629
|
const a = t.eav.get(e);
|
|
1630
1630
|
return X(a, 2);
|
|
@@ -1670,36 +1670,33 @@ function _o(t, [e, n, r]) {
|
|
|
1670
1670
|
return X(t.eav, 3);
|
|
1671
1671
|
}
|
|
1672
1672
|
}
|
|
1673
|
-
|
|
1674
|
-
function go(t, e, n) {
|
|
1673
|
+
function _o(t, e, n) {
|
|
1675
1674
|
var r;
|
|
1676
|
-
if (Yt[n])
|
|
1677
|
-
return Yt[n];
|
|
1678
1675
|
const i = {};
|
|
1679
1676
|
for (const [s, o] of e.entries()) {
|
|
1680
1677
|
const a = (r = t.eav.get(n)) === null || r === void 0 ? void 0 : r.get(o.id), u = X(a, 1);
|
|
1681
1678
|
for (const c of u)
|
|
1682
1679
|
i[s] = c[2];
|
|
1683
1680
|
}
|
|
1684
|
-
return
|
|
1681
|
+
return i;
|
|
1685
1682
|
}
|
|
1686
1683
|
function Te(t, e, n) {
|
|
1687
1684
|
var r;
|
|
1688
1685
|
return (r = t.attrIndexes.forwardIdents.get(e)) === null || r === void 0 ? void 0 : r.get(n);
|
|
1689
1686
|
}
|
|
1690
|
-
function
|
|
1687
|
+
function Pi(t, e, n) {
|
|
1691
1688
|
var r;
|
|
1692
1689
|
return (r = t.attrIndexes.revIdents.get(e)) === null || r === void 0 ? void 0 : r.get(n);
|
|
1693
1690
|
}
|
|
1694
|
-
function
|
|
1691
|
+
function go(t, e) {
|
|
1695
1692
|
return t.attrIndexes.blobAttrs.get(e);
|
|
1696
1693
|
}
|
|
1697
|
-
function
|
|
1694
|
+
function Ii(t, e) {
|
|
1698
1695
|
var n;
|
|
1699
1696
|
const r = t.attrIndexes.primaryKeys.get(e);
|
|
1700
1697
|
return r || ((n = t.attrIndexes.forwardIdents.get(e)) === null || n === void 0 ? void 0 : n.get("id"));
|
|
1701
1698
|
}
|
|
1702
|
-
function
|
|
1699
|
+
function To(t, e) {
|
|
1703
1700
|
const n = dt(t, e);
|
|
1704
1701
|
if (!n)
|
|
1705
1702
|
return;
|
|
@@ -1707,7 +1704,7 @@ function wo(t, e) {
|
|
|
1707
1704
|
if (qe(t.attrs, i))
|
|
1708
1705
|
return We(t.eav, [r, i]);
|
|
1709
1706
|
}
|
|
1710
|
-
function
|
|
1707
|
+
function wo(t, e) {
|
|
1711
1708
|
const n = e.filter(([r, i, s, o, a]) => {
|
|
1712
1709
|
if (r !== "add-triple" && r !== "deep-merge-triple")
|
|
1713
1710
|
return !0;
|
|
@@ -1717,8 +1714,8 @@ function mo(t, e) {
|
|
|
1717
1714
|
let c = !1;
|
|
1718
1715
|
const d = qe(t.attrs, s);
|
|
1719
1716
|
if (d) {
|
|
1720
|
-
const f =
|
|
1721
|
-
c = !!
|
|
1717
|
+
const f = Ii(t, d["forward-identity"][1]);
|
|
1718
|
+
c = !!To(t, [
|
|
1722
1719
|
i,
|
|
1723
1720
|
f == null ? void 0 : f.id,
|
|
1724
1721
|
i
|
|
@@ -1728,32 +1725,32 @@ function mo(t, e) {
|
|
|
1728
1725
|
});
|
|
1729
1726
|
return Pt(t, (r) => {
|
|
1730
1727
|
n.forEach((i) => {
|
|
1731
|
-
|
|
1728
|
+
po(r, i);
|
|
1732
1729
|
});
|
|
1733
1730
|
});
|
|
1734
1731
|
}
|
|
1735
|
-
function
|
|
1732
|
+
function mo(t) {
|
|
1736
1733
|
return typeof t == "string" && t.startsWith("?");
|
|
1737
1734
|
}
|
|
1738
|
-
function
|
|
1735
|
+
function vo(t, e, n) {
|
|
1739
1736
|
if (n.hasOwnProperty(t)) {
|
|
1740
1737
|
const r = n[t];
|
|
1741
|
-
return
|
|
1738
|
+
return Mi(r, e, n);
|
|
1742
1739
|
}
|
|
1743
1740
|
return Object.assign(Object.assign({}, n), { [t]: e });
|
|
1744
1741
|
}
|
|
1745
|
-
function
|
|
1742
|
+
function Er(t, e, n) {
|
|
1746
1743
|
return t === e ? n : null;
|
|
1747
1744
|
}
|
|
1748
|
-
function
|
|
1745
|
+
function So(t) {
|
|
1749
1746
|
switch (typeof t) {
|
|
1750
1747
|
case "string":
|
|
1751
|
-
return t.startsWith("?") ?
|
|
1748
|
+
return t.startsWith("?") ? vo : Er;
|
|
1752
1749
|
default:
|
|
1753
|
-
return
|
|
1750
|
+
return Er;
|
|
1754
1751
|
}
|
|
1755
1752
|
}
|
|
1756
|
-
const
|
|
1753
|
+
const Oo = [
|
|
1757
1754
|
"in",
|
|
1758
1755
|
"$in",
|
|
1759
1756
|
"$not",
|
|
@@ -1761,77 +1758,77 @@ const Eo = [
|
|
|
1761
1758
|
"$comparator"
|
|
1762
1759
|
// covers all of $gt, $lt, etc.
|
|
1763
1760
|
];
|
|
1764
|
-
function
|
|
1765
|
-
for (const e of
|
|
1761
|
+
function Eo(t) {
|
|
1762
|
+
for (const e of Oo)
|
|
1766
1763
|
if (t.hasOwnProperty(e))
|
|
1767
1764
|
return !0;
|
|
1768
1765
|
return !1;
|
|
1769
1766
|
}
|
|
1770
|
-
function
|
|
1771
|
-
return n ? typeof t == "object" ?
|
|
1767
|
+
function Mi(t, e, n) {
|
|
1768
|
+
return n ? typeof t == "object" ? Eo(t) ? n : null : So(t)(t, e, n) : null;
|
|
1772
1769
|
}
|
|
1773
|
-
function
|
|
1770
|
+
function Ao(t, e, n) {
|
|
1774
1771
|
return t.reduce((r, i, s) => {
|
|
1775
1772
|
const o = e[s];
|
|
1776
|
-
return
|
|
1773
|
+
return Mi(i, o, r);
|
|
1777
1774
|
}, n);
|
|
1778
1775
|
}
|
|
1779
|
-
function
|
|
1780
|
-
return
|
|
1776
|
+
function jo(t, e, n) {
|
|
1777
|
+
return Po(t, e, n).map((r) => Ao(e, r, n)).filter((r) => r);
|
|
1781
1778
|
}
|
|
1782
|
-
function
|
|
1783
|
-
return e.or ? e.or.patterns.flatMap((r) =>
|
|
1779
|
+
function ko(t, e, n) {
|
|
1780
|
+
return e.or ? e.or.patterns.flatMap((r) => fn(t, r, n)) : e.and ? e.and.patterns.reduce((r, i) => fn(t, i, r), n) : n.flatMap((r) => jo(t, e, r));
|
|
1784
1781
|
}
|
|
1785
|
-
function
|
|
1786
|
-
return e.reduce((r, i) =>
|
|
1782
|
+
function fn(t, e, n = [{}]) {
|
|
1783
|
+
return e.reduce((r, i) => ko(t, i, r), n);
|
|
1787
1784
|
}
|
|
1788
|
-
function
|
|
1789
|
-
return Array.isArray(e) ? e.map((n) =>
|
|
1785
|
+
function Wn(t, e) {
|
|
1786
|
+
return Array.isArray(e) ? e.map((n) => Wn(t, n)) : mo(e) ? t[e] : e;
|
|
1790
1787
|
}
|
|
1791
|
-
function
|
|
1792
|
-
return
|
|
1788
|
+
function Co(t, { find: e, where: n }) {
|
|
1789
|
+
return fn(t, n).map((i) => Wn(i, e));
|
|
1793
1790
|
}
|
|
1794
|
-
function
|
|
1795
|
-
return
|
|
1791
|
+
function Po(t, e, n) {
|
|
1792
|
+
return bo(t, Wn(n, e));
|
|
1796
1793
|
}
|
|
1797
|
-
const
|
|
1794
|
+
const Io = /^(?:[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;
|
|
1798
1795
|
function Fe(t) {
|
|
1799
|
-
return typeof t == "string" &&
|
|
1796
|
+
return typeof t == "string" && Io.test(t);
|
|
1800
1797
|
}
|
|
1801
1798
|
const q = [];
|
|
1802
1799
|
for (let t = 0; t < 256; ++t)
|
|
1803
1800
|
q.push((t + 256).toString(16).slice(1));
|
|
1804
|
-
function
|
|
1801
|
+
function Mo(t, e = 0) {
|
|
1805
1802
|
return (q[t[e + 0]] + q[t[e + 1]] + q[t[e + 2]] + q[t[e + 3]] + "-" + q[t[e + 4]] + q[t[e + 5]] + "-" + q[t[e + 6]] + q[t[e + 7]] + "-" + q[t[e + 8]] + q[t[e + 9]] + "-" + q[t[e + 10]] + q[t[e + 11]] + q[t[e + 12]] + q[t[e + 13]] + q[t[e + 14]] + q[t[e + 15]]).toLowerCase();
|
|
1806
1803
|
}
|
|
1807
|
-
let
|
|
1808
|
-
const
|
|
1809
|
-
function
|
|
1810
|
-
if (!
|
|
1804
|
+
let Yt;
|
|
1805
|
+
const Ro = new Uint8Array(16);
|
|
1806
|
+
function xo() {
|
|
1807
|
+
if (!Yt) {
|
|
1811
1808
|
if (typeof crypto > "u" || !crypto.getRandomValues)
|
|
1812
1809
|
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
1813
|
-
|
|
1810
|
+
Yt = crypto.getRandomValues.bind(crypto);
|
|
1814
1811
|
}
|
|
1815
|
-
return
|
|
1812
|
+
return Yt(Ro);
|
|
1816
1813
|
}
|
|
1817
|
-
const
|
|
1818
|
-
function
|
|
1814
|
+
const $o = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), Ar = { randomUUID: $o };
|
|
1815
|
+
function Do(t, e, n) {
|
|
1819
1816
|
var i;
|
|
1820
|
-
if (
|
|
1821
|
-
return
|
|
1817
|
+
if (Ar.randomUUID && !t)
|
|
1818
|
+
return Ar.randomUUID();
|
|
1822
1819
|
t = t || {};
|
|
1823
|
-
const r = t.random ?? ((i = t.rng) == null ? void 0 : i.call(t)) ??
|
|
1820
|
+
const r = t.random ?? ((i = t.rng) == null ? void 0 : i.call(t)) ?? xo();
|
|
1824
1821
|
if (r.length < 16)
|
|
1825
1822
|
throw new Error("Random bytes length must be >= 16");
|
|
1826
|
-
return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128,
|
|
1823
|
+
return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128, Mo(r);
|
|
1827
1824
|
}
|
|
1828
|
-
function
|
|
1825
|
+
function jr(t) {
|
|
1829
1826
|
const e = t.replace(/-/g, ""), n = [];
|
|
1830
1827
|
for (let r = 0; r < e.length; r += 2)
|
|
1831
1828
|
n.push(parseInt(e.substring(r, r + 2), 16));
|
|
1832
1829
|
return n;
|
|
1833
1830
|
}
|
|
1834
|
-
function
|
|
1831
|
+
function Uo(t, e) {
|
|
1835
1832
|
for (let n = 0; n < t.length; n++) {
|
|
1836
1833
|
if (t[n] < e[n])
|
|
1837
1834
|
return -1;
|
|
@@ -1840,17 +1837,17 @@ function Lo(t, e) {
|
|
|
1840
1837
|
}
|
|
1841
1838
|
return 0;
|
|
1842
1839
|
}
|
|
1843
|
-
function
|
|
1844
|
-
return
|
|
1840
|
+
function Lo(t, e) {
|
|
1841
|
+
return Uo(jr(t), jr(e));
|
|
1845
1842
|
}
|
|
1846
1843
|
function K() {
|
|
1847
|
-
return
|
|
1844
|
+
return Do();
|
|
1848
1845
|
}
|
|
1849
|
-
function
|
|
1846
|
+
function Fo(t, e) {
|
|
1850
1847
|
return t.localeCompare(e);
|
|
1851
1848
|
}
|
|
1852
|
-
function
|
|
1853
|
-
let t =
|
|
1849
|
+
function No() {
|
|
1850
|
+
let t = Fo;
|
|
1854
1851
|
if (typeof Intl == "object" && Intl.hasOwnProperty("Collator"))
|
|
1855
1852
|
try {
|
|
1856
1853
|
t = Intl.Collator("en-US").compare;
|
|
@@ -1858,10 +1855,10 @@ function Ko() {
|
|
|
1858
1855
|
}
|
|
1859
1856
|
return t;
|
|
1860
1857
|
}
|
|
1861
|
-
const
|
|
1862
|
-
let
|
|
1858
|
+
const Ko = No();
|
|
1859
|
+
let qo = 0;
|
|
1863
1860
|
function rt(t) {
|
|
1864
|
-
return $t(`_${t}`,
|
|
1861
|
+
return $t(`_${t}`, qo++);
|
|
1865
1862
|
}
|
|
1866
1863
|
function $t(t, e) {
|
|
1867
1864
|
return `?${t}-${e}`;
|
|
@@ -1871,28 +1868,28 @@ class Ne extends Error {
|
|
|
1871
1868
|
super(e), this.name = "AttrNotFoundError";
|
|
1872
1869
|
}
|
|
1873
1870
|
}
|
|
1874
|
-
function
|
|
1875
|
-
const n =
|
|
1871
|
+
function Wo(t, e) {
|
|
1872
|
+
const n = Ii(t, e);
|
|
1876
1873
|
if (!n)
|
|
1877
1874
|
throw new Ne(`Could not find id attr for ${e}`);
|
|
1878
1875
|
return n;
|
|
1879
1876
|
}
|
|
1880
|
-
function
|
|
1881
|
-
return [
|
|
1877
|
+
function kr(t, e, n, r) {
|
|
1878
|
+
return [zo(t, e, n, r)];
|
|
1882
1879
|
}
|
|
1883
|
-
function
|
|
1880
|
+
function zo(t, e, n, r) {
|
|
1884
1881
|
return [
|
|
1885
1882
|
t(n, r),
|
|
1886
|
-
|
|
1883
|
+
Wo(e, n).id,
|
|
1887
1884
|
t(n, r),
|
|
1888
1885
|
t("time", r)
|
|
1889
1886
|
];
|
|
1890
1887
|
}
|
|
1891
|
-
function
|
|
1888
|
+
function Vo(t, e, n) {
|
|
1892
1889
|
return t.map((r) => r === e ? n : r);
|
|
1893
1890
|
}
|
|
1894
|
-
function
|
|
1895
|
-
const s = Te(e, n, i), o =
|
|
1891
|
+
function Ri(t, e, n, r, i) {
|
|
1892
|
+
const s = Te(e, n, i), o = Pi(e, n, i), a = s || o;
|
|
1896
1893
|
if (!a)
|
|
1897
1894
|
throw new Ne(`Could not find attr for ${[n, i]}`);
|
|
1898
1895
|
if (a["value-type"] !== "ref")
|
|
@@ -1910,7 +1907,7 @@ function xi(t, e, n, r, i) {
|
|
|
1910
1907
|
];
|
|
1911
1908
|
return [s ? f : c, l, p, a, !!s];
|
|
1912
1909
|
}
|
|
1913
|
-
function
|
|
1910
|
+
function Cr(t, e) {
|
|
1914
1911
|
if (typeof e != "string")
|
|
1915
1912
|
return function(o) {
|
|
1916
1913
|
return !1;
|
|
@@ -1920,7 +1917,7 @@ function Pr(t, e) {
|
|
|
1920
1917
|
return typeof o != "string" ? !1 : i.test(o);
|
|
1921
1918
|
};
|
|
1922
1919
|
}
|
|
1923
|
-
function
|
|
1920
|
+
function Bo(t, e) {
|
|
1924
1921
|
if (typeof e != "object" || e.hasOwnProperty("$in") || e.hasOwnProperty("in"))
|
|
1925
1922
|
return e;
|
|
1926
1923
|
const n = t["checked-data-type"] === "date";
|
|
@@ -1961,7 +1958,7 @@ function Go(t, e) {
|
|
|
1961
1958
|
}
|
|
1962
1959
|
};
|
|
1963
1960
|
if (e.hasOwnProperty("$like")) {
|
|
1964
|
-
const r =
|
|
1961
|
+
const r = Cr(!0, e.$like);
|
|
1965
1962
|
return {
|
|
1966
1963
|
$comparator: !0,
|
|
1967
1964
|
$op: function(s) {
|
|
@@ -1970,7 +1967,7 @@ function Go(t, e) {
|
|
|
1970
1967
|
};
|
|
1971
1968
|
}
|
|
1972
1969
|
if (e.hasOwnProperty("$ilike")) {
|
|
1973
|
-
const r =
|
|
1970
|
+
const r = Cr(!1, e.$ilike);
|
|
1974
1971
|
return {
|
|
1975
1972
|
$comparator: !0,
|
|
1976
1973
|
$op: function(s) {
|
|
@@ -1980,8 +1977,8 @@ function Go(t, e) {
|
|
|
1980
1977
|
}
|
|
1981
1978
|
return e;
|
|
1982
1979
|
}
|
|
1983
|
-
function
|
|
1984
|
-
const o = Te(e, n, i), a =
|
|
1980
|
+
function Go(t, e, n, r, i, s) {
|
|
1981
|
+
const o = Te(e, n, i), a = Pi(e, n, i), u = o || a;
|
|
1985
1982
|
if (!u)
|
|
1986
1983
|
throw new Ne(`No attr for etype = ${n} label = ${i}`);
|
|
1987
1984
|
if (s != null && s.hasOwnProperty("$isNull")) {
|
|
@@ -1998,63 +1995,63 @@ function Qo(t, e, n, r, i, s) {
|
|
|
1998
1995
|
return o ? [
|
|
1999
1996
|
t(n, r),
|
|
2000
1997
|
u.id,
|
|
2001
|
-
|
|
1998
|
+
Bo(u, s),
|
|
2002
1999
|
rt("time")
|
|
2003
2000
|
] : [s, u.id, t(n, r), rt("time")];
|
|
2004
2001
|
}
|
|
2005
|
-
function
|
|
2002
|
+
function Qo(t, e, n, r, i) {
|
|
2006
2003
|
const [s, o, a] = i.reduce((u, c) => {
|
|
2007
|
-
const [d, f, l] = u, [p, y, b] =
|
|
2004
|
+
const [d, f, l] = u, [p, y, b] = Ri(t, e, d, f, c);
|
|
2008
2005
|
return [p, y, [...l, b]];
|
|
2009
2006
|
}, [n, r, []]);
|
|
2010
2007
|
return [s, o, a];
|
|
2011
2008
|
}
|
|
2012
|
-
function
|
|
2013
|
-
const o = i.slice(0, i.length - 1), a = i[i.length - 1], [u, c, d] =
|
|
2009
|
+
function ln(t, e, n, r, i, s) {
|
|
2010
|
+
const o = i.slice(0, i.length - 1), a = i[i.length - 1], [u, c, d] = Qo(t, e, n, r, o), f = Go(t, e, u, c, a, s);
|
|
2014
2011
|
return d.concat([f]);
|
|
2015
2012
|
}
|
|
2016
|
-
function
|
|
2013
|
+
function Ho(t, e) {
|
|
2017
2014
|
return e ? [e].concat(t) : t;
|
|
2018
2015
|
}
|
|
2019
|
-
function
|
|
2016
|
+
function Yo([t, e]) {
|
|
2020
2017
|
return t === "or" && Array.isArray(e);
|
|
2021
2018
|
}
|
|
2022
|
-
function
|
|
2019
|
+
function Jo([t, e]) {
|
|
2023
2020
|
return t === "and" && Array.isArray(e);
|
|
2024
2021
|
}
|
|
2025
|
-
function
|
|
2022
|
+
function Zo(t, e, n) {
|
|
2026
2023
|
return (r, i) => {
|
|
2027
2024
|
const s = t(r, i);
|
|
2028
2025
|
return e == s ? s : `${s}-${n}`;
|
|
2029
2026
|
};
|
|
2030
2027
|
}
|
|
2031
|
-
function
|
|
2028
|
+
function Pr(t, e, n, r, i, s) {
|
|
2032
2029
|
const o = t(r, i), a = s.map((u, c) => {
|
|
2033
|
-
const d =
|
|
2034
|
-
return
|
|
2030
|
+
const d = Zo(t, o, c);
|
|
2031
|
+
return xi(d, n, r, i, u);
|
|
2035
2032
|
});
|
|
2036
2033
|
return { [e]: { patterns: a, joinSym: o } };
|
|
2037
2034
|
}
|
|
2038
|
-
function
|
|
2035
|
+
function Xo(t) {
|
|
2039
2036
|
const e = [];
|
|
2040
2037
|
for (let n = 1; n <= t.length; n++)
|
|
2041
2038
|
e.push(t.slice(0, n));
|
|
2042
2039
|
return e;
|
|
2043
2040
|
}
|
|
2044
|
-
function
|
|
2045
|
-
return
|
|
2041
|
+
function Ir(t, e, n, r, i) {
|
|
2042
|
+
return Xo(i).map((s) => ln(t, e, n, r, s, { $isNull: !0 }));
|
|
2046
2043
|
}
|
|
2047
|
-
function
|
|
2044
|
+
function xi(t, e, n, r, i) {
|
|
2048
2045
|
return Object.entries(i).flatMap(([s, o]) => {
|
|
2046
|
+
if (Yo([s, o]))
|
|
2047
|
+
return Pr(t, "or", e, n, r, o);
|
|
2049
2048
|
if (Jo([s, o]))
|
|
2050
|
-
return
|
|
2051
|
-
if (Zo([s, o]))
|
|
2052
|
-
return Ir(t, "and", e, n, r, o);
|
|
2049
|
+
return Pr(t, "and", e, n, r, o);
|
|
2053
2050
|
if (s === "$entityIdStartsWith")
|
|
2054
2051
|
return [];
|
|
2055
2052
|
const a = s.split(".");
|
|
2056
2053
|
if (o != null && o.hasOwnProperty("$ne") && (o = Object.assign(Object.assign({}, o), { $not: o.$ne }), delete o.$ne), o != null && o.hasOwnProperty("$not")) {
|
|
2057
|
-
const u =
|
|
2054
|
+
const u = ln(t, e, n, r, a, o), c = Ir(t, e, n, r, a);
|
|
2058
2055
|
return [
|
|
2059
2056
|
{
|
|
2060
2057
|
or: {
|
|
@@ -2067,32 +2064,32 @@ function $i(t, e, n, r, i) {
|
|
|
2067
2064
|
return o != null && o.hasOwnProperty("$isNull") && o.$isNull === !0 && a.length > 1 ? [
|
|
2068
2065
|
{
|
|
2069
2066
|
or: {
|
|
2070
|
-
patterns:
|
|
2067
|
+
patterns: Ir(t, e, n, r, a),
|
|
2071
2068
|
joinSym: t(n, r)
|
|
2072
2069
|
}
|
|
2073
2070
|
}
|
|
2074
|
-
] :
|
|
2071
|
+
] : ln(t, e, n, r, a, o);
|
|
2075
2072
|
});
|
|
2076
2073
|
}
|
|
2077
|
-
function
|
|
2074
|
+
function ea(t, e, n, r) {
|
|
2078
2075
|
const i = $t;
|
|
2079
|
-
return r ?
|
|
2076
|
+
return r ? xi(i, t, e, n, r).concat(kr(i, t, e, n)) : kr(i, t, e, n);
|
|
2080
2077
|
}
|
|
2081
|
-
function
|
|
2078
|
+
function ta(t, e, n) {
|
|
2082
2079
|
return [t(e, n), t("time", n)];
|
|
2083
2080
|
}
|
|
2084
|
-
function
|
|
2085
|
-
const [o, a, u, c, d] =
|
|
2081
|
+
function na(t, e, n, r, i, s) {
|
|
2082
|
+
const [o, a, u, c, d] = Ri(t, e, n, r, i), f = Vo(u, t(n, r), s);
|
|
2086
2083
|
return [o, a, f, c, d];
|
|
2087
2084
|
}
|
|
2088
|
-
function
|
|
2085
|
+
function ra(t, e, { etype: n, level: r, form: i }, s) {
|
|
2089
2086
|
const o = Object.keys(i).filter((a) => a !== "$");
|
|
2090
2087
|
return o.length ? Object.entries(s).map(function([u, c]) {
|
|
2091
2088
|
return o.map(function(l) {
|
|
2092
2089
|
var p, y, b;
|
|
2093
2090
|
const _ = !!(e.cardinalityInference && (!((b = (y = (p = e.linkIndex) === null || p === void 0 ? void 0 : p[n]) === null || y === void 0 ? void 0 : y[l]) === null || b === void 0) && b.isSingular));
|
|
2094
2091
|
try {
|
|
2095
|
-
const [w, g, m] =
|
|
2092
|
+
const [w, g, m] = na(t, e, n, r, l, u), E = Di(e, {
|
|
2096
2093
|
etype: w,
|
|
2097
2094
|
level: g,
|
|
2098
2095
|
form: i[l],
|
|
@@ -2109,48 +2106,48 @@ function ia(t, e, { etype: n, level: r, form: i }, s) {
|
|
|
2109
2106
|
}, c);
|
|
2110
2107
|
}) : Object.values(s);
|
|
2111
2108
|
}
|
|
2112
|
-
function
|
|
2113
|
-
return n === "string" ?
|
|
2109
|
+
function ia(t, e, n) {
|
|
2110
|
+
return n === "string" ? Ko(t, e) : t > e ? 1 : -1;
|
|
2114
2111
|
}
|
|
2115
2112
|
function Xe(t, e, n, r, i) {
|
|
2116
|
-
return e === r || e == null && r == null ?
|
|
2113
|
+
return e === r || e == null && r == null ? Lo(t, n) : r == null ? 1 : e == null ? -1 : ia(e, r, i);
|
|
2117
2114
|
}
|
|
2118
2115
|
function It([t, e], [n, r], i) {
|
|
2119
2116
|
return Xe(t, e, n, r, i);
|
|
2120
2117
|
}
|
|
2121
|
-
function
|
|
2118
|
+
function hn(t) {
|
|
2122
2119
|
return t == null ? t : new Date(t).getTime();
|
|
2123
2120
|
}
|
|
2124
|
-
function
|
|
2121
|
+
function sa(t, e, n, r) {
|
|
2125
2122
|
var i;
|
|
2126
2123
|
const [s, o, a, u] = t, c = n === "desc" ? 1 : -1;
|
|
2127
2124
|
if (((i = e["forward-identity"]) === null || i === void 0 ? void 0 : i[2]) === "id")
|
|
2128
2125
|
return It(r, [s, u], null) === c;
|
|
2129
|
-
const [d, f] = r, l = e["checked-data-type"], p = l === "date" ?
|
|
2126
|
+
const [d, f] = r, l = e["checked-data-type"], p = l === "date" ? hn(f) : f, y = l === "date" ? hn(a) : a;
|
|
2130
2127
|
return It([d, p], [s, y], l) === c;
|
|
2131
2128
|
}
|
|
2132
|
-
function
|
|
2129
|
+
function oa(t, e) {
|
|
2133
2130
|
const n = e[1];
|
|
2134
2131
|
return t.attrs[n];
|
|
2135
2132
|
}
|
|
2136
|
-
function
|
|
2133
|
+
function aa(t, e, n) {
|
|
2137
2134
|
const r = Object.keys(n)[0];
|
|
2138
2135
|
return Te(t, e, r);
|
|
2139
2136
|
}
|
|
2140
|
-
function
|
|
2137
|
+
function ua(t, e, n, r) {
|
|
2141
2138
|
if (n)
|
|
2142
|
-
return
|
|
2139
|
+
return oa(t, n);
|
|
2143
2140
|
if (r)
|
|
2144
|
-
return
|
|
2141
|
+
return aa(t, e, r);
|
|
2145
2142
|
}
|
|
2146
|
-
function
|
|
2143
|
+
function ca(t, e, n) {
|
|
2147
2144
|
var r, i;
|
|
2148
2145
|
if (!Array.isArray(n.fields))
|
|
2149
|
-
return
|
|
2146
|
+
return go(t, e);
|
|
2150
2147
|
const s = /* @__PURE__ */ new Map();
|
|
2151
2148
|
for (const o of n.fields) {
|
|
2152
2149
|
const a = Te(t, e, o), u = (r = a == null ? void 0 : a["forward-identity"]) === null || r === void 0 ? void 0 : r[2];
|
|
2153
|
-
u &&
|
|
2150
|
+
u && Kn(a) && s.set(u, a);
|
|
2154
2151
|
}
|
|
2155
2152
|
if (!s.has("id")) {
|
|
2156
2153
|
const o = Te(t, e, "id"), a = (i = o == null ? void 0 : o["forward-identity"]) === null || i === void 0 ? void 0 : i[2];
|
|
@@ -2158,17 +2155,17 @@ function da(t, e, n) {
|
|
|
2158
2155
|
}
|
|
2159
2156
|
return s;
|
|
2160
2157
|
}
|
|
2161
|
-
function
|
|
2158
|
+
function da(t, { etype: e, pageInfo: n, dq: r, form: i }) {
|
|
2162
2159
|
var s, o;
|
|
2163
|
-
const a = (s = i == null ? void 0 : i.$) === null || s === void 0 ? void 0 : s.order, u =
|
|
2164
|
-
let d =
|
|
2165
|
-
const f = n == null ? void 0 : n["start-cursor"], l =
|
|
2160
|
+
const a = (s = i == null ? void 0 : i.$) === null || s === void 0 ? void 0 : s.order, u = $i(i), c = fa(i);
|
|
2161
|
+
let d = Co(t, r);
|
|
2162
|
+
const f = n == null ? void 0 : n["start-cursor"], l = ua(t, e, f, a);
|
|
2166
2163
|
if (l && ((o = l == null ? void 0 : l["forward-identity"]) === null || o === void 0 ? void 0 : o[2]) !== "id") {
|
|
2167
2164
|
const b = l["checked-data-type"] === "date", _ = l.id;
|
|
2168
2165
|
d = d.map(([w]) => {
|
|
2169
2166
|
var g, m, E, S, I;
|
|
2170
2167
|
let x = (I = (S = (E = (m = (g = t.eav.get(w)) === null || g === void 0 ? void 0 : g.get(_)) === null || m === void 0 ? void 0 : m.values()) === null || E === void 0 ? void 0 : E.next()) === null || S === void 0 ? void 0 : S.value) === null || I === void 0 ? void 0 : I[2];
|
|
2171
|
-
return b && (x =
|
|
2168
|
+
return b && (x = hn(x)), [w, x];
|
|
2172
2169
|
});
|
|
2173
2170
|
}
|
|
2174
2171
|
d.sort(c === "asc" ? function(_, w) {
|
|
@@ -2177,31 +2174,31 @@ function fa(t, { etype: e, pageInfo: n, dq: r, form: i }) {
|
|
|
2177
2174
|
return It(w, _, l == null ? void 0 : l["checked-data-type"]);
|
|
2178
2175
|
});
|
|
2179
2176
|
let p = {};
|
|
2180
|
-
const y =
|
|
2177
|
+
const y = ca(t, e, r);
|
|
2181
2178
|
for (const b of d) {
|
|
2182
2179
|
const [_] = b;
|
|
2183
|
-
if (p[_] || !u && f && l &&
|
|
2180
|
+
if (p[_] || !u && f && l && sa(f, l, c, b))
|
|
2184
2181
|
continue;
|
|
2185
|
-
const w =
|
|
2182
|
+
const w = _o(t, y, _);
|
|
2186
2183
|
w && (p[_] = w);
|
|
2187
2184
|
}
|
|
2188
2185
|
return p;
|
|
2189
2186
|
}
|
|
2190
|
-
function
|
|
2187
|
+
function fa(t) {
|
|
2191
2188
|
var e;
|
|
2192
2189
|
const n = (e = t.$) === null || e === void 0 ? void 0 : e.order;
|
|
2193
2190
|
return n && n[Object.keys(n)[0]] || "asc";
|
|
2194
2191
|
}
|
|
2195
|
-
function
|
|
2192
|
+
function $i(t) {
|
|
2196
2193
|
var e, n, r;
|
|
2197
2194
|
const i = (e = t.$) === null || e === void 0 ? void 0 : e.offset, s = (n = t.$) === null || n === void 0 ? void 0 : n.before, o = (r = t.$) === null || r === void 0 ? void 0 : r.after;
|
|
2198
2195
|
return !i && !s && !o;
|
|
2199
2196
|
}
|
|
2200
|
-
function
|
|
2197
|
+
function la(t, { etype: e, level: n, form: r, join: i, pageInfo: s }) {
|
|
2201
2198
|
var o, a, u, c, d;
|
|
2202
|
-
if (
|
|
2199
|
+
if (!$i(r) && (!s || !s["start-cursor"]))
|
|
2203
2200
|
return [];
|
|
2204
|
-
const f =
|
|
2201
|
+
const f = Ho(ea(t, e, n, (o = r.$) === null || o === void 0 ? void 0 : o.where), i), l = ta($t, e, n), p = (a = r.$) === null || a === void 0 ? void 0 : a.fields, y = da(t, {
|
|
2205
2202
|
etype: e,
|
|
2206
2203
|
pageInfo: s,
|
|
2207
2204
|
form: r,
|
|
@@ -2214,20 +2211,20 @@ function ha(t, { etype: e, level: n, form: r, join: i, pageInfo: s }) {
|
|
|
2214
2211
|
}
|
|
2215
2212
|
return y;
|
|
2216
2213
|
}
|
|
2217
|
-
function
|
|
2214
|
+
function ha(t, e) {
|
|
2218
2215
|
try {
|
|
2219
|
-
return
|
|
2216
|
+
return la(t, e);
|
|
2220
2217
|
} catch (n) {
|
|
2221
2218
|
if (n instanceof Ne)
|
|
2222
2219
|
return {};
|
|
2223
2220
|
throw n;
|
|
2224
2221
|
}
|
|
2225
2222
|
}
|
|
2226
|
-
function
|
|
2227
|
-
const n =
|
|
2228
|
-
return
|
|
2223
|
+
function Di(t, e) {
|
|
2224
|
+
const n = ha(t, e);
|
|
2225
|
+
return ra($t, t, e, n);
|
|
2229
2226
|
}
|
|
2230
|
-
function
|
|
2227
|
+
function pa(t) {
|
|
2231
2228
|
const e = {};
|
|
2232
2229
|
for (const [n, r] of Object.entries(t))
|
|
2233
2230
|
e[n] = {
|
|
@@ -2238,18 +2235,18 @@ function ya(t) {
|
|
|
2238
2235
|
};
|
|
2239
2236
|
return e;
|
|
2240
2237
|
}
|
|
2241
|
-
function
|
|
2238
|
+
function Ui({ store: t, pageInfo: e, aggregate: n }, r) {
|
|
2242
2239
|
const s = { data: Object.keys(r).reduce(function(a, u) {
|
|
2243
|
-
return n != null && n[u] || u === "$$ruleParams" || (a[u] =
|
|
2240
|
+
return n != null && n[u] || u === "$$ruleParams" || (a[u] = Di(t, {
|
|
2244
2241
|
etype: u,
|
|
2245
2242
|
form: r[u],
|
|
2246
2243
|
level: 0,
|
|
2247
2244
|
pageInfo: e == null ? void 0 : e[u]
|
|
2248
2245
|
})), a;
|
|
2249
2246
|
}, {}) };
|
|
2250
|
-
return e && (s.pageInfo =
|
|
2247
|
+
return e && (s.pageInfo = pa(e)), n && (s.aggregate = n), s;
|
|
2251
2248
|
}
|
|
2252
|
-
function
|
|
2249
|
+
function ya() {
|
|
2253
2250
|
const e = {
|
|
2254
2251
|
__etype: 1,
|
|
2255
2252
|
__ops: 1,
|
|
@@ -2263,8 +2260,8 @@ function ba() {
|
|
|
2263
2260
|
};
|
|
2264
2261
|
return new Set(Object.keys(e));
|
|
2265
2262
|
}
|
|
2266
|
-
const
|
|
2267
|
-
function
|
|
2263
|
+
const ba = ya();
|
|
2264
|
+
function pn(t, e, n) {
|
|
2268
2265
|
const r = {
|
|
2269
2266
|
__etype: t,
|
|
2270
2267
|
__ops: n
|
|
@@ -2275,25 +2272,25 @@ function yn(t, e, n) {
|
|
|
2275
2272
|
return n;
|
|
2276
2273
|
if (s === "__etype")
|
|
2277
2274
|
return t;
|
|
2278
|
-
if (
|
|
2279
|
-
return (o, a) =>
|
|
2275
|
+
if (ba.has(s))
|
|
2276
|
+
return (o, a) => pn(t, e, [
|
|
2280
2277
|
...n,
|
|
2281
2278
|
a ? [s, t, e, o, a] : [s, t, e, o]
|
|
2282
2279
|
]);
|
|
2283
2280
|
}
|
|
2284
2281
|
});
|
|
2285
2282
|
}
|
|
2286
|
-
function
|
|
2283
|
+
function Nc(t, e) {
|
|
2287
2284
|
return `lookup__${t}__${JSON.stringify(e)}`;
|
|
2288
2285
|
}
|
|
2289
2286
|
function Mt(t) {
|
|
2290
2287
|
return t.startsWith("lookup__");
|
|
2291
2288
|
}
|
|
2292
|
-
function
|
|
2289
|
+
function Li(t) {
|
|
2293
2290
|
const [e, n, ...r] = t.split("__");
|
|
2294
2291
|
return [n, JSON.parse(r.join("__"))];
|
|
2295
2292
|
}
|
|
2296
|
-
function
|
|
2293
|
+
function _a(t) {
|
|
2297
2294
|
return new Proxy({
|
|
2298
2295
|
__etype: t
|
|
2299
2296
|
}, {
|
|
@@ -2301,22 +2298,22 @@ function ga(t) {
|
|
|
2301
2298
|
if (n === "__etype")
|
|
2302
2299
|
return t;
|
|
2303
2300
|
const r = n;
|
|
2304
|
-
return Mt(r) ?
|
|
2301
|
+
return Mt(r) ? pn(t, Li(r), []) : pn(t, r, []);
|
|
2305
2302
|
}
|
|
2306
2303
|
});
|
|
2307
2304
|
}
|
|
2308
|
-
function
|
|
2305
|
+
function zn() {
|
|
2309
2306
|
return new Proxy({}, {
|
|
2310
2307
|
get(t, e) {
|
|
2311
|
-
return
|
|
2308
|
+
return _a(e);
|
|
2312
2309
|
}
|
|
2313
2310
|
});
|
|
2314
2311
|
}
|
|
2315
|
-
const
|
|
2316
|
-
function
|
|
2312
|
+
const Kc = zn();
|
|
2313
|
+
function ga(t) {
|
|
2317
2314
|
return t.__ops;
|
|
2318
2315
|
}
|
|
2319
|
-
function
|
|
2316
|
+
function Ta(t, e) {
|
|
2320
2317
|
const { attrIdMap: n, refSwapAttrIds: r } = t, i = [];
|
|
2321
2318
|
for (const o of e) {
|
|
2322
2319
|
const a = n[o];
|
|
@@ -2350,7 +2347,7 @@ function Ae(t, e, n) {
|
|
|
2350
2347
|
return o === e && a === n;
|
|
2351
2348
|
});
|
|
2352
2349
|
}
|
|
2353
|
-
function
|
|
2350
|
+
function wa(t) {
|
|
2354
2351
|
if (Array.isArray(t))
|
|
2355
2352
|
return t;
|
|
2356
2353
|
const e = Object.entries(t);
|
|
@@ -2358,38 +2355,38 @@ function ma(t) {
|
|
|
2358
2355
|
throw new Error("lookup must be an object with a single unique attr and value.");
|
|
2359
2356
|
return e[0];
|
|
2360
2357
|
}
|
|
2361
|
-
function
|
|
2358
|
+
function yn(t, e, n) {
|
|
2362
2359
|
return n.indexOf(".") !== -1 && // attr names can have `.` in them, so use the attr we find with a `.`
|
|
2363
2360
|
// before assuming it's a ref lookup.
|
|
2364
2361
|
!V(t, e, n);
|
|
2365
2362
|
}
|
|
2366
|
-
function
|
|
2363
|
+
function bn(t) {
|
|
2367
2364
|
const [e, n, ...r] = t.split(".");
|
|
2368
2365
|
if (r.length > 0 || n !== "id")
|
|
2369
2366
|
throw new Error(`${t} is not a valid lookup attribute.`);
|
|
2370
2367
|
return e;
|
|
2371
2368
|
}
|
|
2372
|
-
function
|
|
2373
|
-
if (!
|
|
2369
|
+
function ma(t, e, n) {
|
|
2370
|
+
if (!yn(t, e, n))
|
|
2374
2371
|
return V(t, e, n);
|
|
2375
|
-
const r =
|
|
2372
|
+
const r = bn(n), i = V(t, e, r) || Ae(t, e, r);
|
|
2376
2373
|
if (i && i["value-type"] !== "ref")
|
|
2377
2374
|
throw new Error(`${n} does not reference a valid link attribute.`);
|
|
2378
2375
|
return i;
|
|
2379
2376
|
}
|
|
2380
|
-
function
|
|
2381
|
-
return typeof t == "string" && !Mt(t) ? null : typeof t == "string" && Mt(t) ?
|
|
2377
|
+
function _n(t) {
|
|
2378
|
+
return typeof t == "string" && !Mt(t) ? null : typeof t == "string" && Mt(t) ? Li(t) : wa(t);
|
|
2382
2379
|
}
|
|
2383
2380
|
function ee(t, e, n) {
|
|
2384
|
-
const r =
|
|
2381
|
+
const r = _n(n);
|
|
2385
2382
|
if (r === null)
|
|
2386
2383
|
return n;
|
|
2387
|
-
const [i, s] = r, o =
|
|
2384
|
+
const [i, s] = r, o = ma(t, e, i);
|
|
2388
2385
|
if (!o || !o["unique?"])
|
|
2389
2386
|
throw new Error(`${i} is not a unique attribute.`);
|
|
2390
2387
|
return [o.id, s];
|
|
2391
2388
|
}
|
|
2392
|
-
function
|
|
2389
|
+
function Fi(t, e, n, r) {
|
|
2393
2390
|
const i = ee(t, e, n);
|
|
2394
2391
|
return Array.isArray(i) ? [[
|
|
2395
2392
|
"add-triple",
|
|
@@ -2398,7 +2395,7 @@ function Ni(t, e, n, r) {
|
|
|
2398
2395
|
i
|
|
2399
2396
|
]].concat(r) : r;
|
|
2400
2397
|
}
|
|
2401
|
-
function
|
|
2398
|
+
function va({ attrs: t }, [e, n, r]) {
|
|
2402
2399
|
const i = Object.entries(r).flatMap(([s, o]) => {
|
|
2403
2400
|
const a = Array.isArray(o) ? o : [o], u = V(t, e, s), c = Ae(t, e, s);
|
|
2404
2401
|
return a.map((d) => u ? [
|
|
@@ -2413,9 +2410,9 @@ function Sa({ attrs: t }, [e, n, r]) {
|
|
|
2413
2410
|
ee(t, e, n)
|
|
2414
2411
|
]);
|
|
2415
2412
|
});
|
|
2416
|
-
return
|
|
2413
|
+
return Fi(t, e, n, i);
|
|
2417
2414
|
}
|
|
2418
|
-
function
|
|
2415
|
+
function Sa({ attrs: t }, [e, n, r]) {
|
|
2419
2416
|
const i = Object.entries(r).flatMap(([s, o]) => {
|
|
2420
2417
|
const a = Array.isArray(o) ? o : [o], u = V(t, e, s), c = Ae(t, e, s);
|
|
2421
2418
|
return a.map((d) => u ? [
|
|
@@ -2430,9 +2427,9 @@ function Oa({ attrs: t }, [e, n, r]) {
|
|
|
2430
2427
|
ee(t, e, n)
|
|
2431
2428
|
]);
|
|
2432
2429
|
});
|
|
2433
|
-
return
|
|
2430
|
+
return Fi(t, e, n, i);
|
|
2434
2431
|
}
|
|
2435
|
-
function
|
|
2432
|
+
function Oa(t, e, n) {
|
|
2436
2433
|
if (Array.isArray(n)) {
|
|
2437
2434
|
const [r, i] = n;
|
|
2438
2435
|
for (const s of t || []) {
|
|
@@ -2454,18 +2451,18 @@ function Ea(t, e, n) {
|
|
|
2454
2451
|
}
|
|
2455
2452
|
return !1;
|
|
2456
2453
|
}
|
|
2457
|
-
function
|
|
2458
|
-
return (s == null ? void 0 : s.upsert) === !1 ? { mode: "update" } : (s == null ? void 0 : s.upsert) === !0 ? null :
|
|
2454
|
+
function Ni({ stores: t, attrs: e }, [n, r, i, s]) {
|
|
2455
|
+
return (s == null ? void 0 : s.upsert) === !1 ? { mode: "update" } : (s == null ? void 0 : s.upsert) === !0 ? null : Oa(t, n, r) ? { mode: "update" } : null;
|
|
2459
2456
|
}
|
|
2460
|
-
function
|
|
2461
|
-
const { stores: n, attrs: r } = t, [i, s, o, a] = e, u =
|
|
2457
|
+
function Ea(t, e) {
|
|
2458
|
+
const { stores: n, attrs: r } = t, [i, s, o, a] = e, u = Fn(o), c = ee(r, i, s);
|
|
2462
2459
|
return [["id", c]].concat(Object.entries(u)).map(([f, l]) => {
|
|
2463
2460
|
const p = V(r, i, f);
|
|
2464
2461
|
return p["checked-data-type"] === "date" && t.useDateObjects && (l = xt(l)), ["add-triple", c, p.id, l, { mode: "create" }];
|
|
2465
2462
|
});
|
|
2466
2463
|
}
|
|
2467
|
-
function
|
|
2468
|
-
const { stores: n, attrs: r } = t, [i, s, o, a] = e, u =
|
|
2464
|
+
function Aa(t, e) {
|
|
2465
|
+
const { stores: n, attrs: r } = t, [i, s, o, a] = e, u = Fn(o), c = ee(r, i, s), d = Ni(t, [i, c, o, a]);
|
|
2469
2466
|
return [["id", c]].concat(Object.entries(u)).map(([l, p]) => {
|
|
2470
2467
|
const y = V(r, i, l);
|
|
2471
2468
|
return y["checked-data-type"] === "date" && t.useDateObjects && (p = xt(p)), [
|
|
@@ -2477,11 +2474,11 @@ function ja(t, e) {
|
|
|
2477
2474
|
];
|
|
2478
2475
|
});
|
|
2479
2476
|
}
|
|
2480
|
-
function
|
|
2477
|
+
function ja({ attrs: t }, [e, n]) {
|
|
2481
2478
|
return [["delete-entity", ee(t, e, n), e]];
|
|
2482
2479
|
}
|
|
2483
|
-
function
|
|
2484
|
-
const { stores: n, attrs: r } = t, [i, s, o, a] = e, u =
|
|
2480
|
+
function ka(t, e) {
|
|
2481
|
+
const { stores: n, attrs: r } = t, [i, s, o, a] = e, u = Fn(o), c = ee(r, i, s), d = Ni(t, [i, c, o, a]), f = Object.entries(u).map(([p, y]) => {
|
|
2485
2482
|
const b = V(r, i, p);
|
|
2486
2483
|
return [
|
|
2487
2484
|
"deep-merge-triple",
|
|
@@ -2499,38 +2496,38 @@ function Ca(t, e) {
|
|
|
2499
2496
|
...d ? [d] : []
|
|
2500
2497
|
]].concat(f);
|
|
2501
2498
|
}
|
|
2502
|
-
function
|
|
2499
|
+
function Ca({ attrs: t }, [e, n, r]) {
|
|
2503
2500
|
return [["rule-params", ee(t, e, n), e, r]];
|
|
2504
2501
|
}
|
|
2505
|
-
function
|
|
2502
|
+
function Pa(t) {
|
|
2506
2503
|
const [e, n, r, i, s] = t;
|
|
2507
2504
|
if (!i)
|
|
2508
2505
|
return t;
|
|
2509
2506
|
const o = Object.assign({}, i);
|
|
2510
2507
|
return delete o.id, [e, n, r, o, ...s ? [s] : []];
|
|
2511
2508
|
}
|
|
2512
|
-
function
|
|
2513
|
-
const [n, ...r] =
|
|
2509
|
+
function Ia(t, e) {
|
|
2510
|
+
const [n, ...r] = Pa(e);
|
|
2514
2511
|
switch (n) {
|
|
2515
2512
|
case "merge":
|
|
2516
|
-
return
|
|
2513
|
+
return ka(t, r);
|
|
2517
2514
|
case "create":
|
|
2518
|
-
return
|
|
2515
|
+
return Ea(t, r);
|
|
2519
2516
|
case "update":
|
|
2520
|
-
return
|
|
2517
|
+
return Aa(t, r);
|
|
2521
2518
|
case "link":
|
|
2522
|
-
return
|
|
2519
|
+
return va(t, r);
|
|
2523
2520
|
case "unlink":
|
|
2524
|
-
return
|
|
2521
|
+
return Sa(t, r);
|
|
2525
2522
|
case "delete":
|
|
2526
|
-
return
|
|
2523
|
+
return ja(t, r);
|
|
2527
2524
|
case "ruleParams":
|
|
2528
|
-
return
|
|
2525
|
+
return Ca(t, r);
|
|
2529
2526
|
default:
|
|
2530
2527
|
throw new Error(`unsupported action ${n}`);
|
|
2531
2528
|
}
|
|
2532
2529
|
}
|
|
2533
|
-
function
|
|
2530
|
+
function Ma(t) {
|
|
2534
2531
|
switch (t) {
|
|
2535
2532
|
case "string":
|
|
2536
2533
|
case "date":
|
|
@@ -2541,14 +2538,14 @@ function Ra(t) {
|
|
|
2541
2538
|
return;
|
|
2542
2539
|
}
|
|
2543
2540
|
}
|
|
2544
|
-
function
|
|
2541
|
+
function Ra(t, e, n) {
|
|
2545
2542
|
var r, i;
|
|
2546
2543
|
const s = (i = (r = t.entities[e]) === null || r === void 0 ? void 0 : r.attrs) === null || i === void 0 ? void 0 : i[n];
|
|
2547
2544
|
if (n === "id")
|
|
2548
2545
|
return null;
|
|
2549
2546
|
if (!s)
|
|
2550
2547
|
throw new Error(`${e}.${n} does not exist in your schema`);
|
|
2551
|
-
const { unique: o, indexed: a } = s == null ? void 0 : s.config, u =
|
|
2548
|
+
const { unique: o, indexed: a } = s == null ? void 0 : s.config, u = Ma(s == null ? void 0 : s.valueType);
|
|
2552
2549
|
return {
|
|
2553
2550
|
"index?": a,
|
|
2554
2551
|
"unique?": o,
|
|
@@ -2556,14 +2553,14 @@ function xa(t, e, n) {
|
|
|
2556
2553
|
};
|
|
2557
2554
|
}
|
|
2558
2555
|
function Tt(t, e, n, r) {
|
|
2559
|
-
const i = t ?
|
|
2556
|
+
const i = t ? Ra(t, e, n) : null, s = K(), a = [K(), e, n];
|
|
2560
2557
|
return Object.assign(Object.assign({ id: s, "forward-identity": a, "value-type": "blob", cardinality: "one", "unique?": !1, "index?": !1, isUnsynced: !0 }, i || {}), r || {});
|
|
2561
2558
|
}
|
|
2562
|
-
function
|
|
2559
|
+
function xa(t, e, n) {
|
|
2563
2560
|
return Object.values(t.links).find((i) => i.forward.on === e && i.forward.label === n || i.reverse.on === e && i.reverse.label === n);
|
|
2564
2561
|
}
|
|
2565
|
-
function
|
|
2566
|
-
const r =
|
|
2562
|
+
function $a(t, e, n) {
|
|
2563
|
+
const r = xa(t, e, n);
|
|
2567
2564
|
if (!r)
|
|
2568
2565
|
throw new Error(`Couldn't find the link ${e}.${n} in your schema`);
|
|
2569
2566
|
const { forward: i, reverse: s } = r;
|
|
@@ -2576,11 +2573,11 @@ function Da(t, e, n) {
|
|
|
2576
2573
|
"on-delete-reverse": s.onDelete
|
|
2577
2574
|
};
|
|
2578
2575
|
}
|
|
2579
|
-
function
|
|
2580
|
-
const i = t ?
|
|
2576
|
+
function Mr(t, e, n, r) {
|
|
2577
|
+
const i = t ? $a(t, e, n) : null, s = K(), o = [K(), e, n], a = [K(), n, e];
|
|
2581
2578
|
return Object.assign(Object.assign({ id: s, "forward-identity": o, "reverse-identity": a, "value-type": "ref", cardinality: "many", "unique?": !1, "index?": !1, isUnsynced: !0 }, i || {}), r || {});
|
|
2582
2579
|
}
|
|
2583
|
-
const
|
|
2580
|
+
const Da = /* @__PURE__ */ new Set(["create", "update", "merge", "link", "unlink"]), Ua = /* @__PURE__ */ new Set(["link", "unlink"]), La = /* @__PURE__ */ new Set(["create", "update", "merge"]), Fa = /* @__PURE__ */ new Set([
|
|
2584
2581
|
"link",
|
|
2585
2582
|
"unlink",
|
|
2586
2583
|
"create",
|
|
@@ -2588,17 +2585,17 @@ const Ua = /* @__PURE__ */ new Set(["create", "update", "merge", "link", "unlink
|
|
|
2588
2585
|
"merge",
|
|
2589
2586
|
"delete",
|
|
2590
2587
|
"ruleParams"
|
|
2591
|
-
]),
|
|
2592
|
-
function
|
|
2588
|
+
]), gn = { "unique?": !0, "index?": !0 }, Na = Object.assign(Object.assign({}, gn), { cardinality: "one" });
|
|
2589
|
+
function Ka(t) {
|
|
2593
2590
|
const e = [], [n, r, i, s] = t;
|
|
2594
|
-
if (!
|
|
2591
|
+
if (!Fa.has(n))
|
|
2595
2592
|
return e;
|
|
2596
|
-
const o =
|
|
2593
|
+
const o = _n(i);
|
|
2597
2594
|
if (o && e.push({ etype: r, lookupPair: o }), n === "link")
|
|
2598
2595
|
for (const [a, u] of Object.entries(s)) {
|
|
2599
2596
|
const c = Array.isArray(u) ? u : [u];
|
|
2600
2597
|
for (const d of c) {
|
|
2601
|
-
const f =
|
|
2598
|
+
const f = _n(d);
|
|
2602
2599
|
f && e.push({
|
|
2603
2600
|
etype: r,
|
|
2604
2601
|
lookupPair: f,
|
|
@@ -2608,7 +2605,7 @@ function qa(t) {
|
|
|
2608
2605
|
}
|
|
2609
2606
|
return e;
|
|
2610
2607
|
}
|
|
2611
|
-
function
|
|
2608
|
+
function qa({ attrs: t, schema: e }, n) {
|
|
2612
2609
|
var r, i;
|
|
2613
2610
|
const [s, o, a] = [/* @__PURE__ */ new Set(), Object.assign({}, t), []];
|
|
2614
2611
|
function u(f) {
|
|
@@ -2619,47 +2616,47 @@ function Wa({ attrs: t, schema: e }, n) {
|
|
|
2619
2616
|
}
|
|
2620
2617
|
function d(f, l) {
|
|
2621
2618
|
const p = V(o, f, l), y = Ae(o, f, l);
|
|
2622
|
-
c(p), c(y), !p && !y && u(
|
|
2619
|
+
c(p), c(y), !p && !y && u(Mr(e, f, l, Na));
|
|
2623
2620
|
}
|
|
2624
2621
|
for (const f of n)
|
|
2625
|
-
for (const { etype: l, lookupPair: p, linkLabel: y } of
|
|
2622
|
+
for (const { etype: l, lookupPair: p, linkLabel: y } of Ka(f)) {
|
|
2626
2623
|
const b = p[0];
|
|
2627
2624
|
if (y) {
|
|
2628
2625
|
d(l, y);
|
|
2629
2626
|
const _ = V(o, l, y), w = Ae(o, l, y);
|
|
2630
2627
|
c(_), c(w);
|
|
2631
2628
|
const g = ((r = _ == null ? void 0 : _["reverse-identity"]) === null || r === void 0 ? void 0 : r[1]) || ((i = w == null ? void 0 : w["forward-identity"]) === null || i === void 0 ? void 0 : i[1]) || y;
|
|
2632
|
-
if (
|
|
2633
|
-
d(g,
|
|
2629
|
+
if (yn(o, g, b))
|
|
2630
|
+
d(g, bn(b));
|
|
2634
2631
|
else {
|
|
2635
2632
|
const m = V(o, g, b);
|
|
2636
|
-
m || u(Tt(e, g, b,
|
|
2633
|
+
m || u(Tt(e, g, b, gn)), c(m);
|
|
2637
2634
|
}
|
|
2638
|
-
} else if (
|
|
2639
|
-
d(l,
|
|
2635
|
+
} else if (yn(o, l, b))
|
|
2636
|
+
d(l, bn(b));
|
|
2640
2637
|
else {
|
|
2641
2638
|
const _ = V(o, l, b);
|
|
2642
|
-
_ || u(Tt(e, l, b,
|
|
2639
|
+
_ || u(Tt(e, l, b, gn)), c(_);
|
|
2643
2640
|
}
|
|
2644
2641
|
}
|
|
2645
2642
|
for (const f of n) {
|
|
2646
2643
|
const [l, p, y, b] = f;
|
|
2647
|
-
if (
|
|
2644
|
+
if (Da.has(l)) {
|
|
2648
2645
|
const _ = V(o, p, "id");
|
|
2649
2646
|
c(_), _ || u(Tt(e, p, "id", { "unique?": !0 }));
|
|
2650
2647
|
for (const w of Object.keys(b)) {
|
|
2651
2648
|
const g = V(o, p, w);
|
|
2652
|
-
if (c(g),
|
|
2649
|
+
if (c(g), La.has(l) && (g || u(Tt(e, p, w, w === "id" ? { "unique?": !0 } : null))), Ua.has(l)) {
|
|
2653
2650
|
const m = Ae(o, p, w);
|
|
2654
|
-
!g && !m && u(
|
|
2651
|
+
!g && !m && u(Mr(e, p, w)), c(m);
|
|
2655
2652
|
}
|
|
2656
2653
|
}
|
|
2657
2654
|
}
|
|
2658
2655
|
}
|
|
2659
2656
|
return [o, a];
|
|
2660
2657
|
}
|
|
2661
|
-
function
|
|
2662
|
-
const r = (Array.isArray(e) ? e : [e]).flatMap((u) =>
|
|
2658
|
+
function Wa(t, e) {
|
|
2659
|
+
const r = (Array.isArray(e) ? e : [e]).flatMap((u) => ga(u)), [i, s] = qa(t, r), o = Object.assign(Object.assign({}, t), { attrs: i }), a = r.flatMap((u) => Ia(o, u));
|
|
2663
2660
|
return [...s, ...a];
|
|
2664
2661
|
}
|
|
2665
2662
|
var de = function(t, e, n, r) {
|
|
@@ -2689,15 +2686,15 @@ var de = function(t, e, n, r) {
|
|
|
2689
2686
|
c((r = r.apply(t, e || [])).next());
|
|
2690
2687
|
});
|
|
2691
2688
|
};
|
|
2692
|
-
function
|
|
2689
|
+
function Rr(t, e) {
|
|
2693
2690
|
typeof requestIdleCallback > "u" ? t() : requestIdleCallback(t, { timeout: e });
|
|
2694
2691
|
}
|
|
2695
2692
|
const it = "__meta";
|
|
2696
|
-
class
|
|
2693
|
+
class za {
|
|
2697
2694
|
constructor(e, n) {
|
|
2698
2695
|
}
|
|
2699
2696
|
}
|
|
2700
|
-
class
|
|
2697
|
+
class Tn {
|
|
2701
2698
|
constructor(e) {
|
|
2702
2699
|
var n, r;
|
|
2703
2700
|
this._subs = [], this._nextSave = null, this._nextGc = null, this._pendingSaveKeys = /* @__PURE__ */ new Set(), this._loadedKeys = /* @__PURE__ */ new Set(), this._version = 0, this._meta = {
|
|
@@ -2891,7 +2888,7 @@ class wn {
|
|
|
2891
2888
|
gc() {
|
|
2892
2889
|
this._nextGc || (this._nextGc = setTimeout(
|
|
2893
2890
|
() => {
|
|
2894
|
-
|
|
2891
|
+
Rr(() => {
|
|
2895
2892
|
this._nextGc = null, this._gc();
|
|
2896
2893
|
}, 30 * 1e3);
|
|
2897
2894
|
},
|
|
@@ -2906,7 +2903,7 @@ class wn {
|
|
|
2906
2903
|
return;
|
|
2907
2904
|
}
|
|
2908
2905
|
this._nextSave = setTimeout(() => {
|
|
2909
|
-
|
|
2906
|
+
Rr(() => {
|
|
2910
2907
|
this._nextSave = null, this._writeToStorage(e).then(n).catch(r);
|
|
2911
2908
|
}, this._idleCallbackMaxWaitMs);
|
|
2912
2909
|
}, this._saveThrottleMs);
|
|
@@ -2965,13 +2962,13 @@ var pe = function(t, e, n, r) {
|
|
|
2965
2962
|
c((r = r.apply(t, e || [])).next());
|
|
2966
2963
|
});
|
|
2967
2964
|
};
|
|
2968
|
-
const
|
|
2969
|
-
function
|
|
2965
|
+
const Va = 6, Ba = ["kv", "querySubs", "syncSubs"];
|
|
2966
|
+
function Ga(t) {
|
|
2970
2967
|
return function(n) {
|
|
2971
2968
|
console.error("Error in IndexedDB event", { source: t, event: n });
|
|
2972
2969
|
};
|
|
2973
2970
|
}
|
|
2974
|
-
function
|
|
2971
|
+
function Qa(t) {
|
|
2975
2972
|
return pe(this, void 0, void 0, function* () {
|
|
2976
2973
|
return new Promise((e) => {
|
|
2977
2974
|
const n = indexedDB.open(t);
|
|
@@ -2987,7 +2984,7 @@ function Ha(t) {
|
|
|
2987
2984
|
});
|
|
2988
2985
|
});
|
|
2989
2986
|
}
|
|
2990
|
-
function
|
|
2987
|
+
function Ha(t, e, n) {
|
|
2991
2988
|
return pe(this, void 0, void 0, function* () {
|
|
2992
2989
|
const r = (
|
|
2993
2990
|
// Backwards compatibility for older versions where we JSON.stringified before storing
|
|
@@ -3023,7 +3020,7 @@ function Ya(t, e, n) {
|
|
|
3023
3020
|
});
|
|
3024
3021
|
});
|
|
3025
3022
|
}
|
|
3026
|
-
function
|
|
3023
|
+
function xr(t, e, n) {
|
|
3027
3024
|
return pe(this, void 0, void 0, function* () {
|
|
3028
3025
|
const r = n.put(e, t);
|
|
3029
3026
|
return new Promise((i, s) => {
|
|
@@ -3031,9 +3028,9 @@ function $r(t, e, n) {
|
|
|
3031
3028
|
});
|
|
3032
3029
|
});
|
|
3033
3030
|
}
|
|
3034
|
-
function
|
|
3031
|
+
function Ya(t, e) {
|
|
3035
3032
|
return pe(this, void 0, void 0, function* () {
|
|
3036
|
-
const n = yield
|
|
3033
|
+
const n = yield Qa(`instant_${t}_5`);
|
|
3037
3034
|
if (!n)
|
|
3038
3035
|
return;
|
|
3039
3036
|
const r = yield new Promise((d, f) => {
|
|
@@ -3056,12 +3053,12 @@ function Ja(t, e) {
|
|
|
3056
3053
|
for (const [d, f] of r)
|
|
3057
3054
|
switch (d) {
|
|
3058
3055
|
case "querySubs": {
|
|
3059
|
-
const l =
|
|
3056
|
+
const l = Ha(d, f, o);
|
|
3060
3057
|
a.push(l);
|
|
3061
3058
|
break;
|
|
3062
3059
|
}
|
|
3063
3060
|
default: {
|
|
3064
|
-
const l =
|
|
3061
|
+
const l = xr(d, f, s);
|
|
3065
3062
|
a.push(l);
|
|
3066
3063
|
const p = {
|
|
3067
3064
|
createdAt: Date.now(),
|
|
@@ -3072,16 +3069,16 @@ function Ja(t, e) {
|
|
|
3072
3069
|
break;
|
|
3073
3070
|
}
|
|
3074
3071
|
}
|
|
3075
|
-
const c =
|
|
3072
|
+
const c = xr(it, u, s);
|
|
3076
3073
|
a.push(c), yield Promise.all(a), yield new Promise((d, f) => {
|
|
3077
3074
|
i.oncomplete = (l) => d(l), i.onerror = (l) => f(l), i.onabort = (l) => f(l);
|
|
3078
3075
|
});
|
|
3079
3076
|
});
|
|
3080
3077
|
}
|
|
3081
|
-
const
|
|
3082
|
-
class
|
|
3078
|
+
const $r = /* @__PURE__ */ new Map();
|
|
3079
|
+
class Ki extends za {
|
|
3083
3080
|
constructor(e, n) {
|
|
3084
|
-
super(e, n), this.dbName = `instant_${e}_${
|
|
3081
|
+
super(e, n), this.dbName = `instant_${e}_${Va}`, this._storeName = n, this._appId = e, this._dbPromise = this._init();
|
|
3085
3082
|
}
|
|
3086
3083
|
_init() {
|
|
3087
3084
|
return new Promise((e, n) => {
|
|
@@ -3092,12 +3089,12 @@ class qi extends Va {
|
|
|
3092
3089
|
}, i.onsuccess = (s) => {
|
|
3093
3090
|
const a = s.target.result;
|
|
3094
3091
|
if (r) {
|
|
3095
|
-
const u =
|
|
3096
|
-
|
|
3092
|
+
const u = Ya(this._appId, a).catch((c) => {
|
|
3093
|
+
Ga("Error upgrading store from version 5 to 6.")(c);
|
|
3097
3094
|
});
|
|
3098
|
-
|
|
3095
|
+
$r.set(this.dbName, u), u.then(() => e(a)).catch(() => e(a));
|
|
3099
3096
|
} else {
|
|
3100
|
-
const u =
|
|
3097
|
+
const u = $r.get(this.dbName);
|
|
3101
3098
|
u ? u.then(() => e(a)).catch(() => e(a)) : e(a);
|
|
3102
3099
|
}
|
|
3103
3100
|
}, i.onupgradeneeded = (s) => {
|
|
@@ -3107,7 +3104,7 @@ class qi extends Va {
|
|
|
3107
3104
|
}
|
|
3108
3105
|
_upgradeStore(e) {
|
|
3109
3106
|
const r = e.target.result;
|
|
3110
|
-
for (const i of
|
|
3107
|
+
for (const i of Ba)
|
|
3111
3108
|
r.objectStoreNames.contains(i) || r.createObjectStore(i);
|
|
3112
3109
|
}
|
|
3113
3110
|
getItem(e) {
|
|
@@ -3182,7 +3179,7 @@ class qi extends Va {
|
|
|
3182
3179
|
});
|
|
3183
3180
|
}
|
|
3184
3181
|
}
|
|
3185
|
-
var
|
|
3182
|
+
var Ja = function(t, e, n, r) {
|
|
3186
3183
|
function i(s) {
|
|
3187
3184
|
return s instanceof n ? s : new n(function(o) {
|
|
3188
3185
|
o(s);
|
|
@@ -3209,9 +3206,9 @@ var Za = function(t, e, n, r) {
|
|
|
3209
3206
|
c((r = r.apply(t, e || [])).next());
|
|
3210
3207
|
});
|
|
3211
3208
|
};
|
|
3212
|
-
class
|
|
3209
|
+
class qi {
|
|
3213
3210
|
static getIsOnline() {
|
|
3214
|
-
return
|
|
3211
|
+
return Ja(this, void 0, void 0, function* () {
|
|
3215
3212
|
return navigator.onLine;
|
|
3216
3213
|
});
|
|
3217
3214
|
}
|
|
@@ -3236,7 +3233,7 @@ class Ke extends Error {
|
|
|
3236
3233
|
return "InstantError";
|
|
3237
3234
|
}
|
|
3238
3235
|
}
|
|
3239
|
-
var
|
|
3236
|
+
var Za = function(t, e, n, r) {
|
|
3240
3237
|
function i(s) {
|
|
3241
3238
|
return s instanceof n ? s : new n(function(o) {
|
|
3242
3239
|
o(s);
|
|
@@ -3276,7 +3273,7 @@ class Dt extends Ke {
|
|
|
3276
3273
|
}
|
|
3277
3274
|
}
|
|
3278
3275
|
function ue(t, e) {
|
|
3279
|
-
return
|
|
3276
|
+
return Za(this, void 0, void 0, function* () {
|
|
3280
3277
|
const n = yield fetch(t, e), r = yield n.json();
|
|
3281
3278
|
return n.status === 200 ? Promise.resolve(r) : Promise.reject(new Dt({ status: n.status, body: r }));
|
|
3282
3279
|
});
|
|
@@ -3308,14 +3305,14 @@ var ze = function(t, e, n, r) {
|
|
|
3308
3305
|
c((r = r.apply(t, e || [])).next());
|
|
3309
3306
|
});
|
|
3310
3307
|
};
|
|
3311
|
-
function
|
|
3308
|
+
function Xa({ apiURI: t, appId: e, email: n }) {
|
|
3312
3309
|
return ue(`${t}/runtime/auth/send_magic_code`, {
|
|
3313
3310
|
method: "POST",
|
|
3314
3311
|
headers: { "content-type": "application/json" },
|
|
3315
3312
|
body: JSON.stringify({ "app-id": e, email: n })
|
|
3316
3313
|
});
|
|
3317
3314
|
}
|
|
3318
|
-
function
|
|
3315
|
+
function eu(t) {
|
|
3319
3316
|
return ze(this, arguments, void 0, function* ({ apiURI: e, appId: n, email: r, code: i, refreshToken: s }) {
|
|
3320
3317
|
return yield ue(`${e}/runtime/auth/verify_magic_code`, {
|
|
3321
3318
|
method: "POST",
|
|
@@ -3328,7 +3325,7 @@ function tu(t) {
|
|
|
3328
3325
|
});
|
|
3329
3326
|
});
|
|
3330
3327
|
}
|
|
3331
|
-
function
|
|
3328
|
+
function tu(t) {
|
|
3332
3329
|
return ze(this, arguments, void 0, function* ({ apiURI: e, appId: n, refreshToken: r }) {
|
|
3333
3330
|
return yield ue(`${e}/runtime/auth/verify_refresh_token`, {
|
|
3334
3331
|
method: "POST",
|
|
@@ -3340,7 +3337,7 @@ function nu(t) {
|
|
|
3340
3337
|
});
|
|
3341
3338
|
});
|
|
3342
3339
|
}
|
|
3343
|
-
function
|
|
3340
|
+
function nu(t) {
|
|
3344
3341
|
return ze(this, arguments, void 0, function* ({ apiURI: e, appId: n }) {
|
|
3345
3342
|
return yield ue(`${e}/runtime/auth/sign_in_guest`, {
|
|
3346
3343
|
method: "POST",
|
|
@@ -3351,7 +3348,7 @@ function ru(t) {
|
|
|
3351
3348
|
});
|
|
3352
3349
|
});
|
|
3353
3350
|
}
|
|
3354
|
-
function
|
|
3351
|
+
function Dr(t) {
|
|
3355
3352
|
return ze(this, arguments, void 0, function* ({ apiURI: e, appId: n, code: r, codeVerifier: i, refreshToken: s }) {
|
|
3356
3353
|
return yield ue(`${e}/runtime/oauth/token`, {
|
|
3357
3354
|
method: "POST",
|
|
@@ -3365,7 +3362,7 @@ function Ur(t) {
|
|
|
3365
3362
|
});
|
|
3366
3363
|
});
|
|
3367
3364
|
}
|
|
3368
|
-
function
|
|
3365
|
+
function ru(t) {
|
|
3369
3366
|
return ze(this, arguments, void 0, function* ({ apiURI: e, appId: n, nonce: r, idToken: i, clientName: s, refreshToken: o }) {
|
|
3370
3367
|
return yield ue(`${e}/runtime/oauth/id_token`, {
|
|
3371
3368
|
method: "POST",
|
|
@@ -3380,7 +3377,7 @@ function iu(t) {
|
|
|
3380
3377
|
});
|
|
3381
3378
|
});
|
|
3382
3379
|
}
|
|
3383
|
-
function
|
|
3380
|
+
function iu(t) {
|
|
3384
3381
|
return ze(this, arguments, void 0, function* ({ apiURI: e, appId: n, refreshToken: r }) {
|
|
3385
3382
|
return yield ue(`${e}/runtime/signout`, {
|
|
3386
3383
|
method: "POST",
|
|
@@ -3421,7 +3418,7 @@ var ft = function(t, e, n, r) {
|
|
|
3421
3418
|
c((r = r.apply(t, e || [])).next());
|
|
3422
3419
|
});
|
|
3423
3420
|
};
|
|
3424
|
-
function
|
|
3421
|
+
function su(t) {
|
|
3425
3422
|
return ft(this, arguments, void 0, function* ({ apiURI: e, appId: n, path: r, file: i, refreshToken: s, contentType: o, contentDisposition: a }) {
|
|
3426
3423
|
const u = {
|
|
3427
3424
|
app_id: n,
|
|
@@ -3436,7 +3433,7 @@ function ou(t) {
|
|
|
3436
3433
|
});
|
|
3437
3434
|
});
|
|
3438
3435
|
}
|
|
3439
|
-
function
|
|
3436
|
+
function ou(t) {
|
|
3440
3437
|
return ft(this, arguments, void 0, function* ({ apiURI: e, appId: n, path: r, refreshToken: i }) {
|
|
3441
3438
|
const { data: s } = yield ue(`${e}/storage/files?app_id=${n}&filename=${encodeURIComponent(r)}`, {
|
|
3442
3439
|
method: "DELETE",
|
|
@@ -3448,7 +3445,7 @@ function au(t) {
|
|
|
3448
3445
|
return s;
|
|
3449
3446
|
});
|
|
3450
3447
|
}
|
|
3451
|
-
function
|
|
3448
|
+
function au(t) {
|
|
3452
3449
|
return ft(this, arguments, void 0, function* ({ apiURI: e, appId: n, fileName: r, refreshToken: i, metadata: s = {} }) {
|
|
3453
3450
|
const { data: o } = yield ue(`${e}/storage/signed-upload-url`, {
|
|
3454
3451
|
method: "POST",
|
|
@@ -3464,7 +3461,7 @@ function uu(t) {
|
|
|
3464
3461
|
return o;
|
|
3465
3462
|
});
|
|
3466
3463
|
}
|
|
3467
|
-
function
|
|
3464
|
+
function uu(t, e) {
|
|
3468
3465
|
return ft(this, void 0, void 0, function* () {
|
|
3469
3466
|
return (yield fetch(t, {
|
|
3470
3467
|
method: "PUT",
|
|
@@ -3475,7 +3472,7 @@ function cu(t, e) {
|
|
|
3475
3472
|
})).ok;
|
|
3476
3473
|
});
|
|
3477
3474
|
}
|
|
3478
|
-
function
|
|
3475
|
+
function cu(t) {
|
|
3479
3476
|
return ft(this, arguments, void 0, function* ({ apiURI: e, appId: n, path: r, refreshToken: i }) {
|
|
3480
3477
|
const { data: s } = yield ue(`${e}/storage/signed-download-url?app_id=${n}&filename=${encodeURIComponent(r)}`, {
|
|
3481
3478
|
method: "GET",
|
|
@@ -3487,9 +3484,9 @@ function du(t) {
|
|
|
3487
3484
|
return s;
|
|
3488
3485
|
});
|
|
3489
3486
|
}
|
|
3490
|
-
let
|
|
3491
|
-
typeof window < "u" && typeof window.localStorage < "u" && (
|
|
3492
|
-
function
|
|
3487
|
+
let Vn = !1, Wi = !1, zi = !1;
|
|
3488
|
+
typeof window < "u" && typeof window.localStorage < "u" && (Vn = !!window.localStorage.getItem("devBackend"), Wi = !!window.localStorage.getItem("__instantLogging"), zi = !!window.localStorage.getItem("__devtoolLocalDash"));
|
|
3489
|
+
function Ur(t, e) {
|
|
3493
3490
|
if (!e)
|
|
3494
3491
|
return t;
|
|
3495
3492
|
const n = {};
|
|
@@ -3497,33 +3494,33 @@ function Lr(t, e) {
|
|
|
3497
3494
|
n[r] = t[r];
|
|
3498
3495
|
}), n;
|
|
3499
3496
|
}
|
|
3500
|
-
function
|
|
3497
|
+
function du(t, e, n) {
|
|
3501
3498
|
var r, i;
|
|
3502
3499
|
const s = {
|
|
3503
3500
|
peers: {}
|
|
3504
3501
|
};
|
|
3505
3502
|
if (e && "user" in e ? e.user : !0) {
|
|
3506
|
-
const a =
|
|
3503
|
+
const a = Ur((r = t.user) !== null && r !== void 0 ? r : {}, e == null ? void 0 : e.keys);
|
|
3507
3504
|
s.user = Object.assign(Object.assign({}, a), { peerId: n });
|
|
3508
3505
|
}
|
|
3509
3506
|
for (const a of Object.keys((i = t.peers) !== null && i !== void 0 ? i : {})) {
|
|
3510
3507
|
const u = (e == null ? void 0 : e.peers) === void 0, c = Array.isArray(e == null ? void 0 : e.peers) && (e == null ? void 0 : e.peers.includes(a));
|
|
3511
3508
|
if (u || c) {
|
|
3512
|
-
const d =
|
|
3509
|
+
const d = Ur(t.peers[a], e == null ? void 0 : e.keys);
|
|
3513
3510
|
s.peers[a] = Object.assign(Object.assign({}, d), { peerId: a });
|
|
3514
3511
|
}
|
|
3515
3512
|
}
|
|
3516
3513
|
return s;
|
|
3517
3514
|
}
|
|
3518
|
-
function
|
|
3519
|
-
if (t.isLoading !== e.isLoading || t.error !== e.error || (t.user || e.user) && (!t.user || !e.user || !
|
|
3515
|
+
function fu(t, e) {
|
|
3516
|
+
if (t.isLoading !== e.isLoading || t.error !== e.error || (t.user || e.user) && (!t.user || !e.user || !vr(t.user, e.user)) || !gi(t.peers, e.peers))
|
|
3520
3517
|
return !0;
|
|
3521
3518
|
for (const r of Object.keys(t.peers))
|
|
3522
|
-
if (!
|
|
3519
|
+
if (!vr(t.peers[r], e.peers[r]))
|
|
3523
3520
|
return !0;
|
|
3524
3521
|
return !1;
|
|
3525
3522
|
}
|
|
3526
|
-
class
|
|
3523
|
+
class Lr {
|
|
3527
3524
|
constructor() {
|
|
3528
3525
|
this.promise = new Promise((e, n) => {
|
|
3529
3526
|
this._resolve = e, this._reject = n;
|
|
@@ -3536,20 +3533,20 @@ class Fr {
|
|
|
3536
3533
|
this._reject(e);
|
|
3537
3534
|
}
|
|
3538
3535
|
}
|
|
3539
|
-
function
|
|
3536
|
+
function Vi(t, e = []) {
|
|
3540
3537
|
t.forEach((n) => {
|
|
3541
3538
|
const { data: r } = n, { "datalog-result": i } = r, { "join-rows": s } = i;
|
|
3542
3539
|
for (const o of s)
|
|
3543
3540
|
for (const a of o)
|
|
3544
3541
|
e.push(a);
|
|
3545
|
-
|
|
3542
|
+
Vi(n["child-nodes"], e);
|
|
3546
3543
|
});
|
|
3547
3544
|
}
|
|
3548
|
-
function
|
|
3545
|
+
function Fr(t) {
|
|
3549
3546
|
const e = [];
|
|
3550
|
-
return
|
|
3547
|
+
return Vi(t, e), e;
|
|
3551
3548
|
}
|
|
3552
|
-
function
|
|
3549
|
+
function Nr(t) {
|
|
3553
3550
|
return Object.values(t.links).reduce((e, n) => {
|
|
3554
3551
|
var r, i, s, o;
|
|
3555
3552
|
return (r = e[s = n.forward.on]) !== null && r !== void 0 || (e[s] = {}), e[n.forward.on][n.forward.label] = {
|
|
@@ -3563,8 +3560,8 @@ function Kr(t) {
|
|
|
3563
3560
|
}, e;
|
|
3564
3561
|
}, {});
|
|
3565
3562
|
}
|
|
3566
|
-
const
|
|
3567
|
-
function
|
|
3563
|
+
const Bn = "v0.22.84-experimental.drewh-explorer-component.20110784260.1";
|
|
3564
|
+
function lu(t, e) {
|
|
3568
3565
|
return {
|
|
3569
3566
|
info: t ? (...n) => console.info(...n, e()) : () => {
|
|
3570
3567
|
},
|
|
@@ -3637,7 +3634,7 @@ class R extends Error {
|
|
|
3637
3634
|
super(r), this.name = "QueryValidationError";
|
|
3638
3635
|
}
|
|
3639
3636
|
}
|
|
3640
|
-
const
|
|
3637
|
+
const Kr = [
|
|
3641
3638
|
"where",
|
|
3642
3639
|
"order",
|
|
3643
3640
|
"limit",
|
|
@@ -3648,7 +3645,7 @@ const qr = [
|
|
|
3648
3645
|
"before",
|
|
3649
3646
|
"fields",
|
|
3650
3647
|
"aggregate"
|
|
3651
|
-
],
|
|
3648
|
+
], hu = (t) => t.valueType || "unknown", Bi = (t, e, n = !1) => {
|
|
3652
3649
|
if (n || t == null)
|
|
3653
3650
|
return !0;
|
|
3654
3651
|
switch (e) {
|
|
@@ -3663,9 +3660,9 @@ const qr = [
|
|
|
3663
3660
|
default:
|
|
3664
3661
|
return !0;
|
|
3665
3662
|
}
|
|
3666
|
-
},
|
|
3663
|
+
}, pu = (t, e, n, r, i, s, o) => {
|
|
3667
3664
|
const a = s.valueType === "json", u = (c, d, f) => {
|
|
3668
|
-
if (!
|
|
3665
|
+
if (!Bi(f, d, a))
|
|
3669
3666
|
throw new R(`Invalid value for operator '${c}' on attribute '${r}' in entity '${i}'. Expected ${d}, but received: ${typeof f}`, o);
|
|
3670
3667
|
};
|
|
3671
3668
|
switch (t) {
|
|
@@ -3696,16 +3693,16 @@ const qr = [
|
|
|
3696
3693
|
throw new R(`Unknown operator '${t}' for attribute '${r}' in entity '${i}'`, o);
|
|
3697
3694
|
}
|
|
3698
3695
|
}, Ue = (t, e, n, r, i) => {
|
|
3699
|
-
const s =
|
|
3696
|
+
const s = hu(n), o = n.valueType === "json";
|
|
3700
3697
|
if (typeof t == "object" && t !== null && !Array.isArray(t)) {
|
|
3701
3698
|
if (o)
|
|
3702
3699
|
return;
|
|
3703
3700
|
const u = t;
|
|
3704
3701
|
for (const [c, d] of Object.entries(u))
|
|
3705
|
-
|
|
3706
|
-
} else if (!
|
|
3702
|
+
pu(c, d, s, e, r, n, `${i}.${c}`);
|
|
3703
|
+
} else if (!Bi(t, s, o))
|
|
3707
3704
|
throw new R(`Invalid value for attribute '${e}' in entity '${r}'. Expected ${s}, but received: ${typeof t}`, i);
|
|
3708
|
-
},
|
|
3705
|
+
}, yu = (t, e, n, r, i) => {
|
|
3709
3706
|
const s = t.split(".");
|
|
3710
3707
|
if (s.length < 2)
|
|
3711
3708
|
throw new R(`Invalid dot notation path '${t}'. Must contain at least one dot.`, i);
|
|
@@ -3742,12 +3739,12 @@ const qr = [
|
|
|
3742
3739
|
throw new R(`Attribute '${a}' does not exist on entity '${o}' in dot notation path '${t}'. Available attributes: ${d.length > 0 ? d.join(", ") + ", id" : "id"}`, i);
|
|
3743
3740
|
}
|
|
3744
3741
|
Ue(e, t, c, n, i);
|
|
3745
|
-
},
|
|
3742
|
+
}, Gi = (t, e, n, r) => {
|
|
3746
3743
|
for (const [i, s] of Object.entries(t)) {
|
|
3747
3744
|
if (i === "or" || i === "and") {
|
|
3748
3745
|
if (Array.isArray(s))
|
|
3749
3746
|
for (const c of s)
|
|
3750
|
-
typeof c == "object" && c !== null &&
|
|
3747
|
+
typeof c == "object" && c !== null && Gi(c, e, n, `${r}.${i}[${c}]`);
|
|
3751
3748
|
continue;
|
|
3752
3749
|
}
|
|
3753
3750
|
if (i === "id") {
|
|
@@ -3755,7 +3752,7 @@ const qr = [
|
|
|
3755
3752
|
continue;
|
|
3756
3753
|
}
|
|
3757
3754
|
if (i.includes(".")) {
|
|
3758
|
-
|
|
3755
|
+
yu(i, s, e, n, `${r}.${i}`);
|
|
3759
3756
|
continue;
|
|
3760
3757
|
}
|
|
3761
3758
|
const o = n.entities[e];
|
|
@@ -3775,10 +3772,10 @@ const qr = [
|
|
|
3775
3772
|
Ue(s, i, c, e, `${r}.${i}`);
|
|
3776
3773
|
}
|
|
3777
3774
|
}
|
|
3778
|
-
},
|
|
3775
|
+
}, bu = (t, e, n, r, i = 0) => {
|
|
3779
3776
|
for (const o of Object.keys(t))
|
|
3780
|
-
if (!
|
|
3781
|
-
throw new R(`Invalid query parameter '${o}' in $ object. Valid parameters are: ${
|
|
3777
|
+
if (!Kr.includes(o))
|
|
3778
|
+
throw new R(`Invalid query parameter '${o}' in $ object. Valid parameters are: ${Kr.join(", ")}. Found: ${o}`, r);
|
|
3782
3779
|
const s = [
|
|
3783
3780
|
// 'limit', // only supported client side
|
|
3784
3781
|
"offset",
|
|
@@ -3793,9 +3790,9 @@ const qr = [
|
|
|
3793
3790
|
if (t.where && n) {
|
|
3794
3791
|
if (typeof t.where != "object" || t.where === null)
|
|
3795
3792
|
throw new R(`'where' clause must be an object in entity '${e}', but received: ${typeof t.where}`, r ? `${r}.where` : void 0);
|
|
3796
|
-
|
|
3793
|
+
Gi(t.where, e, n, r ? `${r}.where` : "where");
|
|
3797
3794
|
}
|
|
3798
|
-
},
|
|
3795
|
+
}, Qi = (t, e, n, r, i = 0) => {
|
|
3799
3796
|
var s;
|
|
3800
3797
|
if (!t || typeof t != "object")
|
|
3801
3798
|
throw new R(`Query part for entity '${e}' must be an object, but received: ${typeof t}`, r);
|
|
@@ -3808,15 +3805,15 @@ const qr = [
|
|
|
3808
3805
|
const a = t[o];
|
|
3809
3806
|
if (typeof a == "object" && a !== null) {
|
|
3810
3807
|
const u = (s = n == null ? void 0 : n.entities[e].links[o]) === null || s === void 0 ? void 0 : s.entityName;
|
|
3811
|
-
u &&
|
|
3808
|
+
u && Qi(a, u, n, `${r}.${o}`, i + 1);
|
|
3812
3809
|
}
|
|
3813
3810
|
} else {
|
|
3814
3811
|
const a = t[o];
|
|
3815
3812
|
if (typeof a != "object" || a === null)
|
|
3816
3813
|
throw new R(`Query parameter '$' must be an object in entity '${e}', but received: ${typeof a}`, `${r}.$`);
|
|
3817
|
-
|
|
3814
|
+
bu(a, e, n, `${r}.$`, i);
|
|
3818
3815
|
}
|
|
3819
|
-
},
|
|
3816
|
+
}, qr = (t, e) => {
|
|
3820
3817
|
if (typeof t != "object" || t === null)
|
|
3821
3818
|
throw new R(`Query must be an object, but received: ${typeof t}${t === null ? " (null)" : ""}`);
|
|
3822
3819
|
if (Array.isArray(t))
|
|
@@ -3832,67 +3829,67 @@ const qr = [
|
|
|
3832
3829
|
const i = Object.keys(e.entities);
|
|
3833
3830
|
throw new R(`Entity '${r}' does not exist in schema. Available entities: ${i.length > 0 ? i.join(", ") : "none"}`, r);
|
|
3834
3831
|
}
|
|
3835
|
-
|
|
3832
|
+
Qi(n[r], r, e, r, 0);
|
|
3836
3833
|
}
|
|
3837
3834
|
}
|
|
3838
|
-
},
|
|
3835
|
+
}, Wr = (t) => typeof t != "string" ? !1 : Mt(t) ? !0 : Fe(t);
|
|
3839
3836
|
class ie extends Error {
|
|
3840
3837
|
constructor(e) {
|
|
3841
3838
|
super(e), this.name = "TransactionValidationError";
|
|
3842
3839
|
}
|
|
3843
3840
|
}
|
|
3844
|
-
const
|
|
3841
|
+
const Hi = (t) => t.length > 0 ? t.join(", ") : "none", _u = (t, e) => new ie(`Entity '${t}' does not exist in schema. Available entities: ${Hi(e)}`), zr = {
|
|
3845
3842
|
string: (t) => typeof t == "string",
|
|
3846
3843
|
number: (t) => typeof t == "number" && !isNaN(t),
|
|
3847
3844
|
boolean: (t) => typeof t == "boolean",
|
|
3848
3845
|
date: (t) => t instanceof Date || typeof t == "string" || typeof t == "number",
|
|
3849
3846
|
json: () => !0
|
|
3850
|
-
},
|
|
3847
|
+
}, gu = (t, e) => {
|
|
3851
3848
|
var n, r;
|
|
3852
|
-
return t == null ? !0 : (r = (n =
|
|
3853
|
-
},
|
|
3849
|
+
return t == null ? !0 : (r = (n = zr[e.valueType]) === null || n === void 0 ? void 0 : n.call(zr, t)) !== null && r !== void 0 ? r : !1;
|
|
3850
|
+
}, Yi = (t, e) => {
|
|
3854
3851
|
const n = e.entities[t];
|
|
3855
3852
|
if (!n)
|
|
3856
|
-
throw
|
|
3853
|
+
throw _u(t, Object.keys(e.entities));
|
|
3857
3854
|
return n;
|
|
3858
|
-
},
|
|
3859
|
-
const r =
|
|
3855
|
+
}, Jt = (t, e, n) => {
|
|
3856
|
+
const r = Yi(t, n);
|
|
3860
3857
|
if (typeof e != "object" || e === null)
|
|
3861
3858
|
throw new ie(`Arguments for data operation on entity '${t}' must be an object, but received: ${typeof e}`);
|
|
3862
3859
|
for (const [i, s] of Object.entries(e)) {
|
|
3863
3860
|
if (i === "id")
|
|
3864
3861
|
continue;
|
|
3865
3862
|
const o = r.attrs[i];
|
|
3866
|
-
if (o && !
|
|
3863
|
+
if (o && !gu(s, o))
|
|
3867
3864
|
throw new ie(`Invalid value for attribute '${i}' in entity '${t}'. Expected ${o.valueType}, but received: ${typeof s}`);
|
|
3868
3865
|
}
|
|
3869
|
-
},
|
|
3870
|
-
const r =
|
|
3866
|
+
}, Vr = (t, e, n) => {
|
|
3867
|
+
const r = Yi(t, n);
|
|
3871
3868
|
if (typeof e != "object" || e === null)
|
|
3872
3869
|
throw new ie(`Arguments for link operation on entity '${t}' must be an object, but received: ${typeof e}`);
|
|
3873
3870
|
for (const [i, s] of Object.entries(e)) {
|
|
3874
3871
|
if (!r.links[i]) {
|
|
3875
3872
|
const a = Object.keys(r.links);
|
|
3876
|
-
throw new ie(`Link '${i}' does not exist on entity '${t}'. Available links: ${
|
|
3873
|
+
throw new ie(`Link '${i}' does not exist on entity '${t}'. Available links: ${Hi(a)}`);
|
|
3877
3874
|
}
|
|
3878
3875
|
if (s != null) {
|
|
3879
3876
|
if (Array.isArray(s)) {
|
|
3880
3877
|
for (const a of s)
|
|
3881
|
-
if (!
|
|
3878
|
+
if (!Wr(a))
|
|
3882
3879
|
throw new ie(`Invalid entity ID in link '${i}' for entity '${t}'. Expected a UUID or a lookup, but received: ${a}`);
|
|
3883
|
-
} else if (!
|
|
3880
|
+
} else if (!Wr(s))
|
|
3884
3881
|
throw new ie(`Invalid UUID in link '${i}' for entity '${t}'. Expected a UUID, but received: ${s}`);
|
|
3885
3882
|
}
|
|
3886
3883
|
}
|
|
3887
|
-
},
|
|
3888
|
-
create:
|
|
3889
|
-
update:
|
|
3890
|
-
merge:
|
|
3891
|
-
link:
|
|
3892
|
-
unlink:
|
|
3884
|
+
}, Tu = {
|
|
3885
|
+
create: Jt,
|
|
3886
|
+
update: Jt,
|
|
3887
|
+
merge: Jt,
|
|
3888
|
+
link: Vr,
|
|
3889
|
+
unlink: Vr,
|
|
3893
3890
|
delete: () => {
|
|
3894
3891
|
}
|
|
3895
|
-
},
|
|
3892
|
+
}, wu = (t, e) => {
|
|
3896
3893
|
if (!e)
|
|
3897
3894
|
return;
|
|
3898
3895
|
const [n, r, i, s] = t;
|
|
@@ -3900,9 +3897,9 @@ const Yi = (t) => t.length > 0 ? t.join(", ") : "none", gu = (t, e) => new ie(`E
|
|
|
3900
3897
|
throw new ie(`Invalid id for entity '${r}'. Expected a UUID, but received: ${i}`);
|
|
3901
3898
|
if (typeof r != "string")
|
|
3902
3899
|
throw new ie(`Entity name must be a string, but received: ${typeof r}`);
|
|
3903
|
-
const o =
|
|
3900
|
+
const o = Tu[n];
|
|
3904
3901
|
o && s !== void 0 && o(r, s, e);
|
|
3905
|
-
},
|
|
3902
|
+
}, mu = (t, e) => {
|
|
3906
3903
|
const n = Array.isArray(t) ? t : [t];
|
|
3907
3904
|
for (const r of n) {
|
|
3908
3905
|
if (!r || typeof r != "object")
|
|
@@ -3912,11 +3909,11 @@ const Yi = (t) => t.length > 0 ? t.join(", ") : "none", gu = (t, e) => new ie(`E
|
|
|
3912
3909
|
for (const i of r.__ops) {
|
|
3913
3910
|
if (!Array.isArray(i))
|
|
3914
3911
|
throw new ie(`Transaction operation must be an array, but received: ${typeof i}`);
|
|
3915
|
-
|
|
3912
|
+
wu(i, e);
|
|
3916
3913
|
}
|
|
3917
3914
|
}
|
|
3918
3915
|
};
|
|
3919
|
-
var
|
|
3916
|
+
var Br = function(t, e, n, r) {
|
|
3920
3917
|
function i(s) {
|
|
3921
3918
|
return s instanceof n ? s : new n(function(o) {
|
|
3922
3919
|
o(s);
|
|
@@ -3943,10 +3940,10 @@ var Gr = function(t, e, n, r) {
|
|
|
3943
3940
|
c((r = r.apply(t, e || [])).next());
|
|
3944
3941
|
});
|
|
3945
3942
|
};
|
|
3946
|
-
let
|
|
3947
|
-
class
|
|
3943
|
+
let Ji = 0;
|
|
3944
|
+
class Gr {
|
|
3948
3945
|
constructor(e) {
|
|
3949
|
-
this.type = "ws", this.id = `${this.type}_${
|
|
3946
|
+
this.type = "ws", this.id = `${this.type}_${Ji++}`, this.conn = new WebSocket(e), this.conn.onopen = (n) => {
|
|
3950
3947
|
this.onopen && this.onopen({ target: this });
|
|
3951
3948
|
}, this.conn.onmessage = (n) => {
|
|
3952
3949
|
this.onmessage && this.onmessage({
|
|
@@ -3974,9 +3971,9 @@ class Qr {
|
|
|
3974
3971
|
return this.conn.send(JSON.stringify(e));
|
|
3975
3972
|
}
|
|
3976
3973
|
}
|
|
3977
|
-
class
|
|
3974
|
+
class vu {
|
|
3978
3975
|
constructor(e, n) {
|
|
3979
|
-
this.type = "sse", this.initParams = null, this.sendQueue = [], this.closeFired = !1, this.sseInitTimeout = void 0, this.id = `${this.type}_${
|
|
3976
|
+
this.type = "sse", this.initParams = null, this.sendQueue = [], this.closeFired = !1, this.sseInitTimeout = void 0, this.id = `${this.type}_${Ji++}`, this.url = n, this.ES = e, this.conn = new e(n), this.sseInitTimeout = setTimeout(() => {
|
|
3980
3977
|
this.initParams || this.handleError();
|
|
3981
3978
|
}, 1e4), this.conn.onmessage = (r) => {
|
|
3982
3979
|
const i = JSON.parse(r.data);
|
|
@@ -4015,7 +4012,7 @@ class Su {
|
|
|
4015
4012
|
this.conn.close(), this.onclose && !this.closeFired && (this.closeFired = !0, this.onclose({ target: this }));
|
|
4016
4013
|
}
|
|
4017
4014
|
postMessages(e) {
|
|
4018
|
-
return
|
|
4015
|
+
return Br(this, void 0, void 0, function* () {
|
|
4019
4016
|
var n, r, i;
|
|
4020
4017
|
try {
|
|
4021
4018
|
(yield fetch(this.url, {
|
|
@@ -4034,7 +4031,7 @@ class Su {
|
|
|
4034
4031
|
});
|
|
4035
4032
|
}
|
|
4036
4033
|
flushQueue() {
|
|
4037
|
-
return
|
|
4034
|
+
return Br(this, void 0, void 0, function* () {
|
|
4038
4035
|
if (this.sendPromise || !this.sendQueue.length)
|
|
4039
4036
|
return;
|
|
4040
4037
|
const e = this.sendQueue;
|
|
@@ -4060,7 +4057,7 @@ class Su {
|
|
|
4060
4057
|
this.handleClose();
|
|
4061
4058
|
}
|
|
4062
4059
|
}
|
|
4063
|
-
var
|
|
4060
|
+
var Qr = function(t, e, n, r) {
|
|
4064
4061
|
function i(s) {
|
|
4065
4062
|
return s instanceof n ? s : new n(function(o) {
|
|
4066
4063
|
o(s);
|
|
@@ -4087,34 +4084,34 @@ var Hr = function(t, e, n, r) {
|
|
|
4087
4084
|
c((r = r.apply(t, e || [])).next());
|
|
4088
4085
|
});
|
|
4089
4086
|
};
|
|
4090
|
-
function
|
|
4087
|
+
function Su(t, e) {
|
|
4091
4088
|
const n = t.values;
|
|
4092
4089
|
if (n)
|
|
4093
4090
|
for (const r of n.entities || [])
|
|
4094
|
-
r.store.useDateObjects = e, r.store.attrs = n.attrs, r.store =
|
|
4091
|
+
r.store.useDateObjects = e, r.store.attrs = n.attrs, r.store = Oi(r.store);
|
|
4095
4092
|
return t;
|
|
4096
4093
|
}
|
|
4097
|
-
function
|
|
4094
|
+
function Ou(t, e) {
|
|
4098
4095
|
var n, r;
|
|
4099
4096
|
if (!((n = e.values) === null || n === void 0) && n.entities) {
|
|
4100
4097
|
const i = [];
|
|
4101
4098
|
for (const s of (r = e.values) === null || r === void 0 ? void 0 : r.entities) {
|
|
4102
|
-
const o =
|
|
4099
|
+
const o = Si(s.store);
|
|
4103
4100
|
delete o.attrs, i.push(Object.assign(Object.assign({}, s), { store: o }));
|
|
4104
4101
|
}
|
|
4105
4102
|
return Object.assign(Object.assign({}, e), { values: Object.assign(Object.assign({}, e.values), { entities: i }) });
|
|
4106
4103
|
} else
|
|
4107
4104
|
return e;
|
|
4108
4105
|
}
|
|
4109
|
-
function
|
|
4106
|
+
function Eu(t, e, n) {
|
|
4110
4107
|
var r, i;
|
|
4111
4108
|
const s = (r = e == null ? void 0 : e.state) === null || r === void 0 ? void 0 : r.txId, o = (i = n == null ? void 0 : n.state) === null || i === void 0 ? void 0 : i.txId;
|
|
4112
4109
|
return s && (!o || s > o) ? e : o && (!s || o > s) ? n : e || n;
|
|
4113
4110
|
}
|
|
4114
|
-
function
|
|
4115
|
-
return
|
|
4111
|
+
function Zt(t, e) {
|
|
4112
|
+
return Ui({ store: e, pageInfo: null, aggregate: null }, t.query).data[t.table][0];
|
|
4116
4113
|
}
|
|
4117
|
-
function
|
|
4114
|
+
function Hr(t, e, n) {
|
|
4118
4115
|
var r;
|
|
4119
4116
|
const i = (r = Te(e, t.table, "id")) === null || r === void 0 ? void 0 : r.id;
|
|
4120
4117
|
if (!i)
|
|
@@ -4122,18 +4119,18 @@ function Yr(t, e, n) {
|
|
|
4122
4119
|
const s = We(e.eav, [n, i, n]);
|
|
4123
4120
|
return s ? s[3] : -1;
|
|
4124
4121
|
}
|
|
4125
|
-
function
|
|
4122
|
+
function Yr(t, e) {
|
|
4126
4123
|
for (const { action: n, triple: r } of e)
|
|
4127
4124
|
switch (n) {
|
|
4128
4125
|
case "added":
|
|
4129
|
-
|
|
4126
|
+
ji(t, r);
|
|
4130
4127
|
break;
|
|
4131
4128
|
case "removed":
|
|
4132
|
-
|
|
4129
|
+
Ei(t, r);
|
|
4133
4130
|
break;
|
|
4134
4131
|
}
|
|
4135
4132
|
}
|
|
4136
|
-
function
|
|
4133
|
+
function Au(t, e) {
|
|
4137
4134
|
var n, r, i, s;
|
|
4138
4135
|
const o = {};
|
|
4139
4136
|
for (const { action: a, triple: u } of e) {
|
|
@@ -4161,14 +4158,14 @@ function ju(t, e) {
|
|
|
4161
4158
|
function wt(t, e) {
|
|
4162
4159
|
return { [t.table]: e.map((n) => n.entity) };
|
|
4163
4160
|
}
|
|
4164
|
-
function
|
|
4161
|
+
function ju(t, e) {
|
|
4165
4162
|
var n;
|
|
4166
4163
|
if (t.orderFieldType)
|
|
4167
4164
|
return t.orderFieldType;
|
|
4168
4165
|
const r = t.orderField === "serverCreatedAt" ? "number" : (n = Te(e([]), t.table, t.orderField)) === null || n === void 0 ? void 0 : n["checked-data-type"];
|
|
4169
4166
|
return t.orderFieldType = r, r;
|
|
4170
4167
|
}
|
|
4171
|
-
function
|
|
4168
|
+
function ku(t, e, n) {
|
|
4172
4169
|
const r = e;
|
|
4173
4170
|
if (t.orderField === "serverCreatedAt") {
|
|
4174
4171
|
n.sort(t.orderDirection === "asc" ? function(o, a) {
|
|
@@ -4189,13 +4186,13 @@ var ve;
|
|
|
4189
4186
|
(function(t) {
|
|
4190
4187
|
t.InitialSyncBatch = "InitialSyncBatch", t.InitialSyncComplete = "InitialSyncComplete", t.LoadFromStorage = "LoadFromStorage", t.SyncTransaction = "SyncTransaction", t.Error = "Error";
|
|
4191
4188
|
})(ve || (ve = {}));
|
|
4192
|
-
class
|
|
4189
|
+
class Cu {
|
|
4193
4190
|
constructor(e, n, r, i, s) {
|
|
4194
|
-
this.callbacks = {}, this.idToHash = {}, this.trySend = e, this.config = r, this.log = i, this.createStore = s, this.subs = new
|
|
4191
|
+
this.callbacks = {}, this.idToHash = {}, this.trySend = e, this.config = r, this.log = i, this.createStore = s, this.subs = new Tn({
|
|
4195
4192
|
persister: n,
|
|
4196
|
-
merge:
|
|
4197
|
-
serialize:
|
|
4198
|
-
parse: (o, a) =>
|
|
4193
|
+
merge: Eu,
|
|
4194
|
+
serialize: Ou,
|
|
4195
|
+
parse: (o, a) => Su(a, this.config.useDateObjects),
|
|
4199
4196
|
objectSize: (o) => {
|
|
4200
4197
|
var a;
|
|
4201
4198
|
return ((a = o.values) === null || a === void 0 ? void 0 : a.entities.length) || 0;
|
|
@@ -4252,7 +4249,7 @@ class Pu {
|
|
|
4252
4249
|
});
|
|
4253
4250
|
}
|
|
4254
4251
|
initSubscription(e, n, r) {
|
|
4255
|
-
return
|
|
4252
|
+
return Qr(this, void 0, void 0, function* () {
|
|
4256
4253
|
var i, s, o, a;
|
|
4257
4254
|
yield this.subs.waitForKeyToLoad(n);
|
|
4258
4255
|
const u = this.subs.currentValue[n];
|
|
@@ -4278,7 +4275,7 @@ class Pu {
|
|
|
4278
4275
|
});
|
|
4279
4276
|
}
|
|
4280
4277
|
flushPending() {
|
|
4281
|
-
return
|
|
4278
|
+
return Qr(this, void 0, void 0, function* () {
|
|
4282
4279
|
for (const e of Object.keys(this.callbacks)) {
|
|
4283
4280
|
yield this.subs.waitForKeyToLoad(e);
|
|
4284
4281
|
const n = this.subs.currentValue[e];
|
|
@@ -4323,11 +4320,11 @@ class Pu {
|
|
|
4323
4320
|
for (const d of i) {
|
|
4324
4321
|
const f = this.createStore(d);
|
|
4325
4322
|
u.attrs = f.attrs;
|
|
4326
|
-
const l =
|
|
4323
|
+
const l = Zt(a, f);
|
|
4327
4324
|
c.push({
|
|
4328
4325
|
store: f,
|
|
4329
4326
|
entity: l,
|
|
4330
|
-
serverCreatedAt:
|
|
4327
|
+
serverCreatedAt: Hr(a, f, l.id)
|
|
4331
4328
|
}), o.push(l);
|
|
4332
4329
|
}
|
|
4333
4330
|
this.subs.updateInPlace((d) => {
|
|
@@ -4397,9 +4394,9 @@ class Pu {
|
|
|
4397
4394
|
e: for (const [g, m] of Object.entries(f))
|
|
4398
4395
|
for (let E = 0; E < p.length; E++) {
|
|
4399
4396
|
const S = p[E];
|
|
4400
|
-
if (
|
|
4401
|
-
|
|
4402
|
-
const I =
|
|
4397
|
+
if (ao(S.store, g)) {
|
|
4398
|
+
Yr(S.store, m);
|
|
4399
|
+
const I = Zt(a, S.store), x = Au(S.store, m)[g];
|
|
4403
4400
|
I ? (y.push({
|
|
4404
4401
|
oldEntity: S.entity,
|
|
4405
4402
|
newEntity: I,
|
|
@@ -4411,8 +4408,8 @@ class Pu {
|
|
|
4411
4408
|
const b = [];
|
|
4412
4409
|
for (const [g, m] of Object.entries(f)) {
|
|
4413
4410
|
const E = this.createStore([]);
|
|
4414
|
-
l.attrs = E.attrs,
|
|
4415
|
-
const S =
|
|
4411
|
+
l.attrs = E.attrs, Yr(E, m);
|
|
4412
|
+
const S = Zt(a, E);
|
|
4416
4413
|
if (!S) {
|
|
4417
4414
|
this.log.error("No entity found after applying change", {
|
|
4418
4415
|
sub: a,
|
|
@@ -4424,14 +4421,14 @@ class Pu {
|
|
|
4424
4421
|
p.push({
|
|
4425
4422
|
store: E,
|
|
4426
4423
|
entity: S,
|
|
4427
|
-
serverCreatedAt:
|
|
4424
|
+
serverCreatedAt: Hr(a, E, S.id)
|
|
4428
4425
|
}), b.push(S);
|
|
4429
4426
|
}
|
|
4430
4427
|
const _ = [];
|
|
4431
4428
|
for (const g of d.sort().reverse())
|
|
4432
4429
|
_.push(p[g].entity), p.splice(g, 1);
|
|
4433
|
-
const w =
|
|
4434
|
-
|
|
4430
|
+
const w = ju(a, this.createStore);
|
|
4431
|
+
ku(a, w, p), this.notifyCbs(o, {
|
|
4435
4432
|
type: ve.SyncTransaction,
|
|
4436
4433
|
data: wt(a, (i = a.values) === null || i === void 0 ? void 0 : i.entities),
|
|
4437
4434
|
added: b,
|
|
@@ -4498,7 +4495,7 @@ var F = function(t, e, n, r) {
|
|
|
4498
4495
|
}
|
|
4499
4496
|
c((r = r.apply(t, e || [])).next());
|
|
4500
4497
|
});
|
|
4501
|
-
},
|
|
4498
|
+
}, Pu = function(t, e) {
|
|
4502
4499
|
var n = {};
|
|
4503
4500
|
for (var r in t) Object.prototype.hasOwnProperty.call(t, r) && e.indexOf(r) < 0 && (n[r] = t[r]);
|
|
4504
4501
|
if (t != null && typeof Object.getOwnPropertySymbols == "function")
|
|
@@ -4512,46 +4509,46 @@ const le = {
|
|
|
4512
4509
|
AUTHENTICATED: "authenticated",
|
|
4513
4510
|
CLOSED: "closed",
|
|
4514
4511
|
ERRORED: "errored"
|
|
4515
|
-
},
|
|
4512
|
+
}, Iu = 3e4, Mu = 3e4, Ru = 200, xu = {
|
|
4516
4513
|
apiURI: "https://api.instantdb.com",
|
|
4517
4514
|
websocketURI: "wss://api.instantdb.com/runtime/session"
|
|
4518
|
-
},
|
|
4519
|
-
function
|
|
4515
|
+
}, Xt = "_instant_oauth_redirect", Qe = "currentUser";
|
|
4516
|
+
function $u({ transportType: t, appId: e, apiURI: n, wsURI: r, EventSourceImpl: i }) {
|
|
4520
4517
|
if (!i)
|
|
4521
|
-
return new
|
|
4518
|
+
return new Gr(`${r}?app_id=${e}`);
|
|
4522
4519
|
switch (t) {
|
|
4523
4520
|
case "ws":
|
|
4524
|
-
return new
|
|
4521
|
+
return new Gr(`${r}?app_id=${e}`);
|
|
4525
4522
|
case "sse":
|
|
4526
|
-
return new
|
|
4523
|
+
return new vu(i, `${n}/runtime/sse?app_id=${e}`);
|
|
4527
4524
|
default:
|
|
4528
4525
|
throw new Error("Unknown transport type " + t);
|
|
4529
4526
|
}
|
|
4530
4527
|
}
|
|
4531
|
-
function
|
|
4528
|
+
function Du() {
|
|
4532
4529
|
return typeof window < "u" || typeof chrome < "u";
|
|
4533
4530
|
}
|
|
4534
|
-
const
|
|
4531
|
+
const Jr = {
|
|
4535
4532
|
"set-presence": !0,
|
|
4536
4533
|
"set-presence-ok": !0,
|
|
4537
4534
|
"refresh-presence": !0,
|
|
4538
4535
|
"patch-presence": !0
|
|
4539
4536
|
};
|
|
4540
|
-
function
|
|
4537
|
+
function Uu(t, e) {
|
|
4541
4538
|
var n;
|
|
4542
4539
|
const r = typeof t == "string" ? JSON.parse(t) : t;
|
|
4543
4540
|
if (!((n = r == null ? void 0 : r.result) === null || n === void 0) && n.store) {
|
|
4544
4541
|
const i = r.result.store;
|
|
4545
|
-
r.result.store =
|
|
4542
|
+
r.result.store = Oi(Object.assign(Object.assign({}, i), { useDateObjects: e }));
|
|
4546
4543
|
}
|
|
4547
4544
|
return r;
|
|
4548
4545
|
}
|
|
4549
|
-
function
|
|
4546
|
+
function Lu(t, e) {
|
|
4550
4547
|
var n;
|
|
4551
4548
|
const r = Object.assign({}, e);
|
|
4552
|
-
return !((n = e.result) === null || n === void 0) && n.store && (r.result = Object.assign(Object.assign({}, e.result), { store:
|
|
4549
|
+
return !((n = e.result) === null || n === void 0) && n.store && (r.result = Object.assign(Object.assign({}, e.result), { store: Si(e.result.store) })), r;
|
|
4553
4550
|
}
|
|
4554
|
-
function
|
|
4551
|
+
function Fu(t, e) {
|
|
4555
4552
|
switch (t) {
|
|
4556
4553
|
case "pendingMutations":
|
|
4557
4554
|
return new Map(typeof e == "string" ? JSON.parse(e) : e);
|
|
@@ -4559,7 +4556,7 @@ function Nu(t, e) {
|
|
|
4559
4556
|
return e;
|
|
4560
4557
|
}
|
|
4561
4558
|
}
|
|
4562
|
-
function
|
|
4559
|
+
function Nu(t, e) {
|
|
4563
4560
|
switch (t) {
|
|
4564
4561
|
case "pendingMutations":
|
|
4565
4562
|
return [...e.entries()];
|
|
@@ -4567,18 +4564,18 @@ function Ku(t, e) {
|
|
|
4567
4564
|
return e;
|
|
4568
4565
|
}
|
|
4569
4566
|
}
|
|
4570
|
-
function
|
|
4567
|
+
function Ku(t, e, n) {
|
|
4571
4568
|
const r = e == null ? void 0 : e.result, i = n == null ? void 0 : n.result;
|
|
4572
4569
|
return r && !i && n && (n.result = r), n || e;
|
|
4573
4570
|
}
|
|
4574
|
-
function
|
|
4571
|
+
function Zr(t) {
|
|
4575
4572
|
return [...t].sort((e, n) => {
|
|
4576
4573
|
const [r, i] = e, [s, o] = n, a = i.order || 0, u = o.order || 0;
|
|
4577
4574
|
return a == u ? r < s ? -1 : r > s ? 1 : 0 : a - u;
|
|
4578
4575
|
});
|
|
4579
4576
|
}
|
|
4580
|
-
class
|
|
4581
|
-
constructor(e, n =
|
|
4577
|
+
class qu {
|
|
4578
|
+
constructor(e, n = Ki, r = qi, i, s) {
|
|
4582
4579
|
var o, a, u;
|
|
4583
4580
|
if (this._isOnline = !0, this._isShutdown = !1, this.status = le.CONNECTING, this.queryCbs = {}, this.queryOnceDfds = {}, this.authCbs = [], this.attrsCbs = [], this.mutationErrorCbs = [], this.connectionStatusCbs = [], this.mutationDeferredStore = /* @__PURE__ */ new Map(), this._reconnectTimeoutId = null, this._reconnectTimeoutMs = 0, this._transportType = "ws", this._wsOk = null, this._localIdPromises = {}, this._errorMessage = null, this._oauthCallbackResponse = null, this._linkIndex = null, this._rooms = {}, this._roomsPendingLeave = {}, this._presence = {}, this._broadcastQueue = [], this._broadcastSubs = {}, this._currentUserCached = { isLoading: !0, error: void 0, user: void 0 }, this._beforeUnloadCbs = [], this._dataForQueryCache = {}, this._inFlightMutationEventIds = /* @__PURE__ */ new Set(), this._onMergeKv = (c, d, f) => {
|
|
4584
4581
|
var l, p;
|
|
@@ -4610,9 +4607,9 @@ class Wu {
|
|
|
4610
4607
|
}, this.notifyQueryError = (c, d) => {
|
|
4611
4608
|
(this.queryCbs[c] || []).forEach((l) => l.cb({ error: d }));
|
|
4612
4609
|
}, this.pushTx = (c) => {
|
|
4613
|
-
this.config.disableValidation ||
|
|
4610
|
+
this.config.disableValidation || mu(c, this.config.schema);
|
|
4614
4611
|
try {
|
|
4615
|
-
const d =
|
|
4612
|
+
const d = Wa({
|
|
4616
4613
|
attrs: this.optimisticAttrs(),
|
|
4617
4614
|
schema: this.config.schema,
|
|
4618
4615
|
stores: Object.values(this.querySubs.currentValue).map((f) => {
|
|
@@ -4636,7 +4633,7 @@ class Wu {
|
|
|
4636
4633
|
this._updatePendingMutations((_) => {
|
|
4637
4634
|
_.set(f, y);
|
|
4638
4635
|
});
|
|
4639
|
-
const b = new
|
|
4636
|
+
const b = new Lr();
|
|
4640
4637
|
return this.mutationDeferredStore.set(f, b), this._sendMutation(f, y), this.notifyAll(), b.promise;
|
|
4641
4638
|
}, this._transportOnOpen = (c) => {
|
|
4642
4639
|
const d = c.target;
|
|
@@ -4701,7 +4698,7 @@ class Wu {
|
|
|
4701
4698
|
return;
|
|
4702
4699
|
}
|
|
4703
4700
|
this._log.info("[socket][close]", d.id, "schedule reconnect, ms =", this._reconnectTimeoutMs), this._scheduleReconnect();
|
|
4704
|
-
}, this._EventSource = s, this.config = Object.assign(Object.assign({},
|
|
4701
|
+
}, this._EventSource = s, this.config = Object.assign(Object.assign({}, xu), e), this.queryCacheLimit = (o = this.config.queryCacheLimit) !== null && o !== void 0 ? o : 10, this._pendingTxCleanupTimeout = (a = this.config.pendingTxCleanupTimeout) !== null && a !== void 0 ? a : Mu, this._pendingMutationCleanupThreshold = (u = this.config.pendingMutationCleanupThreshold) !== null && u !== void 0 ? u : Ru, this._log = lu(e.verbose || Vn || Wi, () => this._reactorStats()), this.versions = Object.assign(Object.assign({}, i || {}), { "@instantdb/core": Bn }), this.config.schema && (this._linkIndex = Nr(this.config.schema)), !!Du()) {
|
|
4705
4702
|
if (!e.appId)
|
|
4706
4703
|
throw new Error("Instant must be initialized with an appId.");
|
|
4707
4704
|
if (!Fe(e.appId))
|
|
@@ -4716,7 +4713,7 @@ class Wu {
|
|
|
4716
4713
|
} catch (f) {
|
|
4717
4714
|
this._log.error("[error] handle broadcast channel", f);
|
|
4718
4715
|
}
|
|
4719
|
-
}))), this._initStorage(n), this._syncTable = new
|
|
4716
|
+
}))), this._initStorage(n), this._syncTable = new Cu(this._trySendAuthed.bind(this), new n(this.config.appId, "syncSubs"), {
|
|
4720
4717
|
useDateObjects: this.config.useDateObjects
|
|
4721
4718
|
}, this._log, (c) => Et(this.attrs, c, this.config.enableCardinalityInference, this._linkIndex, this.config.useDateObjects)), this._oauthCallbackResponse = this._oauthLoginInit(), this.getCurrentUser(), r.getIsOnline().then((c) => {
|
|
4722
4719
|
this._isOnline = c, this._startSocket(), r.listen((d) => {
|
|
@@ -4726,7 +4723,7 @@ class Wu {
|
|
|
4726
4723
|
}
|
|
4727
4724
|
}
|
|
4728
4725
|
updateSchema(e) {
|
|
4729
|
-
this.config = Object.assign(Object.assign({}, this.config), { schema: e, cardinalityInference: !!e }), this._linkIndex = e ?
|
|
4726
|
+
this.config = Object.assign(Object.assign({}, this.config), { schema: e, cardinalityInference: !!e }), this._linkIndex = e ? Nr(this.config.schema) : null;
|
|
4730
4727
|
}
|
|
4731
4728
|
_reactorStats() {
|
|
4732
4729
|
return {
|
|
@@ -4739,11 +4736,11 @@ class Wu {
|
|
|
4739
4736
|
this.kv.waitForKeyToLoad("pendingMutations").then(() => this.notifyOne(e));
|
|
4740
4737
|
}
|
|
4741
4738
|
_initStorage(e) {
|
|
4742
|
-
this.querySubs = new
|
|
4739
|
+
this.querySubs = new Tn({
|
|
4743
4740
|
persister: new e(this.config.appId, "querySubs"),
|
|
4744
|
-
merge:
|
|
4745
|
-
serialize:
|
|
4746
|
-
parse: (n, r) =>
|
|
4741
|
+
merge: Ku,
|
|
4742
|
+
serialize: Lu,
|
|
4743
|
+
parse: (n, r) => Uu(r, this.config.useDateObjects),
|
|
4747
4744
|
// objectSize
|
|
4748
4745
|
objectSize: (n) => {
|
|
4749
4746
|
var r, i, s, o;
|
|
@@ -4759,11 +4756,11 @@ class Wu {
|
|
|
4759
4756
|
maxSize: 1e6
|
|
4760
4757
|
// 1 million triples
|
|
4761
4758
|
}
|
|
4762
|
-
}), this.querySubs.onKeyLoaded = (n) => this._onQuerySubLoaded(n), this.kv = new
|
|
4759
|
+
}), this.querySubs.onKeyLoaded = (n) => this._onQuerySubLoaded(n), this.kv = new Tn({
|
|
4763
4760
|
persister: new e(this.config.appId, "kv"),
|
|
4764
4761
|
merge: this._onMergeKv,
|
|
4765
|
-
serialize:
|
|
4766
|
-
parse:
|
|
4762
|
+
serialize: Nu,
|
|
4763
|
+
parse: Fu,
|
|
4767
4764
|
objectSize: () => 0,
|
|
4768
4765
|
logger: this._log,
|
|
4769
4766
|
saveThrottleMs: 100,
|
|
@@ -4794,7 +4791,7 @@ class Wu {
|
|
|
4794
4791
|
if (s)
|
|
4795
4792
|
i.resolve({ status: e, eventId: n });
|
|
4796
4793
|
else if (r != null && r.type) {
|
|
4797
|
-
const { status: o } = r, a =
|
|
4794
|
+
const { status: o } = r, a = Pu(r, ["status"]);
|
|
4798
4795
|
i.reject(new Dt({
|
|
4799
4796
|
// @ts-expect-error body.type is not constant typed
|
|
4800
4797
|
body: a,
|
|
@@ -4818,7 +4815,7 @@ class Wu {
|
|
|
4818
4815
|
_handleReceive(e, n) {
|
|
4819
4816
|
var r, i, s, o, a, u;
|
|
4820
4817
|
const c = !!this.config.schema && ("cardinalityInference" in this.config ? !!this.config.cardinalityInference : !0);
|
|
4821
|
-
switch (
|
|
4818
|
+
switch (Jr[n.op] || this._log.info("[receive]", e, n.op, n), n.op) {
|
|
4822
4819
|
case "init-ok": {
|
|
4823
4820
|
this._setStatus(le.AUTHENTICATED), this._reconnectTimeoutMs = 0, this._setAttrs(n.attrs), this._flushPendingMessages(), this._sessionId = n["session-id"];
|
|
4824
4821
|
for (const l of Object.keys(this._rooms)) {
|
|
@@ -4835,7 +4832,7 @@ class Wu {
|
|
|
4835
4832
|
const { q: l, result: p } = n, y = z(l);
|
|
4836
4833
|
if (!this._hasQueryListeners() && !this.querySubs.currentValue[y])
|
|
4837
4834
|
break;
|
|
4838
|
-
const b = (o = (s = p == null ? void 0 : p[0]) === null || s === void 0 ? void 0 : s.data) === null || o === void 0 ? void 0 : o["page-info"], _ = (u = (a = p == null ? void 0 : p[0]) === null || a === void 0 ? void 0 : a.data) === null || u === void 0 ? void 0 : u.aggregate, w =
|
|
4835
|
+
const b = (o = (s = p == null ? void 0 : p[0]) === null || s === void 0 ? void 0 : s.data) === null || o === void 0 ? void 0 : o["page-info"], _ = (u = (a = p == null ? void 0 : p[0]) === null || a === void 0 ? void 0 : a.data) === null || u === void 0 ? void 0 : u.aggregate, w = Fr(p), g = Et(this.attrs, w, c, this._linkIndex, this.config.useDateObjects);
|
|
4839
4836
|
this.querySubs.updateInPlace((m) => {
|
|
4840
4837
|
if (!m[y]) {
|
|
4841
4838
|
this._log.info("Missing value in querySubs", { hash: y, q: l });
|
|
@@ -4873,9 +4870,9 @@ class Wu {
|
|
|
4873
4870
|
b !== this._pendingMutations() && this.kv.updateInPlace((g) => {
|
|
4874
4871
|
g.pendingMutations = b;
|
|
4875
4872
|
});
|
|
4876
|
-
const _ =
|
|
4873
|
+
const _ = Zr(b.entries()), w = l.map((g) => {
|
|
4877
4874
|
var m, E, S, I;
|
|
4878
|
-
const x = g["instaql-query"], B = g["instaql-result"], Ve = z(x), lt =
|
|
4875
|
+
const x = g["instaql-query"], B = g["instaql-result"], Ve = z(x), lt = Fr(B), Ft = Et(this.attrs, lt, c, this._linkIndex, this.config.useDateObjects), Nt = this._applyOptimisticUpdates(Ft, _, y), ht = (E = (m = B == null ? void 0 : B[0]) === null || m === void 0 ? void 0 : m.data) === null || E === void 0 ? void 0 : E["page-info"], ce = (I = (S = B == null ? void 0 : B[0]) === null || S === void 0 ? void 0 : S.data) === null || I === void 0 ? void 0 : I.aggregate;
|
|
4879
4876
|
return { q: x, hash: Ve, store: Nt, pageInfo: ht, aggregate: ce };
|
|
4880
4877
|
});
|
|
4881
4878
|
w.forEach(({ hash: g, q: m, store: E, pageInfo: S, aggregate: I }) => {
|
|
@@ -5038,7 +5035,7 @@ class Wu {
|
|
|
5038
5035
|
*/
|
|
5039
5036
|
subscribeQuery(e, n, r) {
|
|
5040
5037
|
var i;
|
|
5041
|
-
this.config.disableValidation ||
|
|
5038
|
+
this.config.disableValidation || qr(e, this.config.schema), r && "ruleParams" in r && (e = Object.assign({ $$ruleParams: r.ruleParams }, e));
|
|
5042
5039
|
const s = z(e), o = this.getPreviousResult(e);
|
|
5043
5040
|
return o && n(o), this.queryCbs[s] = (i = this.queryCbs[s]) !== null && i !== void 0 ? i : [], this.queryCbs[s].push({ q: e, cb: n }), this._startQuerySub(e, s), () => {
|
|
5044
5041
|
this._unsubQuery(e, s, n);
|
|
@@ -5046,14 +5043,14 @@ class Wu {
|
|
|
5046
5043
|
}
|
|
5047
5044
|
queryOnce(e, n) {
|
|
5048
5045
|
var r;
|
|
5049
|
-
this.config.disableValidation ||
|
|
5050
|
-
const i = new
|
|
5046
|
+
this.config.disableValidation || qr(e, this.config.schema), n && "ruleParams" in n && (e = Object.assign({ $$ruleParams: n.ruleParams }, e));
|
|
5047
|
+
const i = new Lr();
|
|
5051
5048
|
if (!this._isOnline)
|
|
5052
5049
|
return i.reject(new Error("We can't run `queryOnce`, because the device is offline.")), i.promise;
|
|
5053
5050
|
if (!this.querySubs)
|
|
5054
5051
|
return i.reject(new Error("We can't run `queryOnce` on the backend. Use adminAPI.query instead: https://www.instantdb.com/docs/backend#query")), i.promise;
|
|
5055
5052
|
const s = z(e), o = this._startQuerySub(e, s);
|
|
5056
|
-
return this.queryOnceDfds[s] = (r = this.queryOnceDfds[s]) !== null && r !== void 0 ? r : [], this.queryOnceDfds[s].push({ q: e, dfd: i, eventId: o }), setTimeout(() => i.reject(new Error("Query timed out")),
|
|
5053
|
+
return this.queryOnceDfds[s] = (r = this.queryOnceDfds[s]) !== null && r !== void 0 ? r : [], this.queryOnceDfds[s].push({ q: e, dfd: i, eventId: o }), setTimeout(() => i.reject(new Error("Query timed out")), Iu), i.promise;
|
|
5057
5054
|
}
|
|
5058
5055
|
_completeQueryOnce(e, n, r) {
|
|
5059
5056
|
this.queryOnceDfds[n] && (this.queryOnceDfds[n] = this.queryOnceDfds[n].filter((i) => i.dfd !== r), this._cleanupQuery(e, n));
|
|
@@ -5114,7 +5111,7 @@ class Wu {
|
|
|
5114
5111
|
a = !0;
|
|
5115
5112
|
continue;
|
|
5116
5113
|
}
|
|
5117
|
-
const b = a ?
|
|
5114
|
+
const b = a ? Ta(o, p) : p;
|
|
5118
5115
|
l.push(b);
|
|
5119
5116
|
}
|
|
5120
5117
|
return a ? l : d;
|
|
@@ -5124,7 +5121,7 @@ class Wu {
|
|
|
5124
5121
|
return a ? c : n;
|
|
5125
5122
|
}
|
|
5126
5123
|
_rewriteMutationsSorted(e, n) {
|
|
5127
|
-
return
|
|
5124
|
+
return Zr(this._rewriteMutations(e, n).entries());
|
|
5128
5125
|
}
|
|
5129
5126
|
// ---------------------------
|
|
5130
5127
|
// Transact
|
|
@@ -5158,11 +5155,11 @@ class Wu {
|
|
|
5158
5155
|
if (c && r === c.querySubVersion && s === c.pendingMutationsVersion)
|
|
5159
5156
|
return c;
|
|
5160
5157
|
const { store: d, pageInfo: f, aggregate: l, processedTxId: p } = u, y = this._rewriteMutationsSorted(d.attrs, o), b = this._applyOptimisticUpdates(d, y, p);
|
|
5161
|
-
return { data:
|
|
5158
|
+
return { data: Ui({ store: b, pageInfo: f, aggregate: l }, a), querySubVersion: r, pendingMutationsVersion: s };
|
|
5162
5159
|
}
|
|
5163
5160
|
_applyOptimisticUpdates(e, n, r) {
|
|
5164
5161
|
for (const [i, s] of n)
|
|
5165
|
-
(!s["tx-id"] || r && s["tx-id"] > r) && (e =
|
|
5162
|
+
(!s["tx-id"] || r && s["tx-id"] > r) && (e = wo(e, s["tx-steps"]));
|
|
5166
5163
|
return e;
|
|
5167
5164
|
}
|
|
5168
5165
|
/** Re-compute all subscriptions */
|
|
@@ -5250,7 +5247,7 @@ class Wu {
|
|
|
5250
5247
|
}
|
|
5251
5248
|
_trySend(e, n, r) {
|
|
5252
5249
|
if (this._transport.isOpen()) {
|
|
5253
|
-
switch (
|
|
5250
|
+
switch (Jr[n.op] || this._log.info("[send]", this._transport.id, n.op, n), n.op) {
|
|
5254
5251
|
case "transact": {
|
|
5255
5252
|
this._inFlightMutationEventIds.add(e);
|
|
5256
5253
|
break;
|
|
@@ -5271,7 +5268,7 @@ class Wu {
|
|
|
5271
5268
|
return;
|
|
5272
5269
|
}
|
|
5273
5270
|
const e = this._transport;
|
|
5274
|
-
this._transport =
|
|
5271
|
+
this._transport = $u({
|
|
5275
5272
|
transportType: this._transportType,
|
|
5276
5273
|
appId: this.config.appId,
|
|
5277
5274
|
apiURI: this.config.apiURI,
|
|
@@ -5307,9 +5304,9 @@ class Wu {
|
|
|
5307
5304
|
if (typeof URL > "u")
|
|
5308
5305
|
return;
|
|
5309
5306
|
const e = new URL(window.location.href);
|
|
5310
|
-
if (e.searchParams.get(
|
|
5307
|
+
if (e.searchParams.get(Xt)) {
|
|
5311
5308
|
const n = e.toString();
|
|
5312
|
-
e.searchParams.delete(
|
|
5309
|
+
e.searchParams.delete(Xt), e.searchParams.delete("code"), e.searchParams.delete("error");
|
|
5313
5310
|
const r = e.pathname + (e.searchParams.size ? "?" + e.searchParams : "") + e.hash;
|
|
5314
5311
|
if (history.replaceState(history.state, "", r), // @ts-ignore (waiting for ts support)
|
|
5315
5312
|
typeof navigation == "object" && // @ts-ignore (waiting for ts support)
|
|
@@ -5334,7 +5331,7 @@ class Wu {
|
|
|
5334
5331
|
if (typeof window > "u" || typeof window.location > "u" || typeof URLSearchParams > "u")
|
|
5335
5332
|
return null;
|
|
5336
5333
|
const s = new URLSearchParams(window.location.search);
|
|
5337
|
-
if (!s.get(
|
|
5334
|
+
if (!s.get(Xt))
|
|
5338
5335
|
return null;
|
|
5339
5336
|
const o = s.get("error");
|
|
5340
5337
|
if (o)
|
|
@@ -5344,7 +5341,7 @@ class Wu {
|
|
|
5344
5341
|
return null;
|
|
5345
5342
|
this._replaceUrlAfterOAuth();
|
|
5346
5343
|
try {
|
|
5347
|
-
const u = yield this._getCurrentUser(), c = (u == null ? void 0 : u.type) === "guest", { user: d } = yield
|
|
5344
|
+
const u = yield this._getCurrentUser(), c = (u == null ? void 0 : u.type) === "guest", { user: d } = yield Dr({
|
|
5348
5345
|
apiURI: this.config.apiURI,
|
|
5349
5346
|
appId: this.config.appId,
|
|
5350
5347
|
code: a,
|
|
@@ -5474,7 +5471,7 @@ class Wu {
|
|
|
5474
5471
|
}), this._reconnectTimeoutMs = 0, this._transport.close(), this._oauthCallbackResponse = null, this.notifyAuthSubs(n);
|
|
5475
5472
|
}
|
|
5476
5473
|
sendMagicCode({ email: e }) {
|
|
5477
|
-
return
|
|
5474
|
+
return Xa({
|
|
5478
5475
|
apiURI: this.config.apiURI,
|
|
5479
5476
|
appId: this.config.appId,
|
|
5480
5477
|
email: e
|
|
@@ -5483,7 +5480,7 @@ class Wu {
|
|
|
5483
5480
|
signInWithMagicCode(e) {
|
|
5484
5481
|
return F(this, arguments, void 0, function* ({ email: n, code: r }) {
|
|
5485
5482
|
var i;
|
|
5486
|
-
const s = yield this.getCurrentUser(), o = ((i = s == null ? void 0 : s.user) === null || i === void 0 ? void 0 : i.type) === "guest", a = yield
|
|
5483
|
+
const s = yield this.getCurrentUser(), o = ((i = s == null ? void 0 : s.user) === null || i === void 0 ? void 0 : i.type) === "guest", a = yield eu({
|
|
5487
5484
|
apiURI: this.config.apiURI,
|
|
5488
5485
|
appId: this.config.appId,
|
|
5489
5486
|
email: n,
|
|
@@ -5495,7 +5492,7 @@ class Wu {
|
|
|
5495
5492
|
}
|
|
5496
5493
|
signInWithCustomToken(e) {
|
|
5497
5494
|
return F(this, void 0, void 0, function* () {
|
|
5498
|
-
const n = yield
|
|
5495
|
+
const n = yield tu({
|
|
5499
5496
|
apiURI: this.config.apiURI,
|
|
5500
5497
|
appId: this.config.appId,
|
|
5501
5498
|
refreshToken: e
|
|
@@ -5505,7 +5502,7 @@ class Wu {
|
|
|
5505
5502
|
}
|
|
5506
5503
|
signInAsGuest() {
|
|
5507
5504
|
return F(this, void 0, void 0, function* () {
|
|
5508
|
-
const e = yield
|
|
5505
|
+
const e = yield nu({
|
|
5509
5506
|
apiURI: this.config.apiURI,
|
|
5510
5507
|
appId: this.config.appId
|
|
5511
5508
|
});
|
|
@@ -5521,7 +5518,7 @@ class Wu {
|
|
|
5521
5518
|
this._log.info("[auth-invalidate] skipped invalidateToken");
|
|
5522
5519
|
return;
|
|
5523
5520
|
}
|
|
5524
|
-
|
|
5521
|
+
iu({
|
|
5525
5522
|
apiURI: this.config.apiURI,
|
|
5526
5523
|
appId: this.config.appId,
|
|
5527
5524
|
refreshToken: i
|
|
@@ -5556,7 +5553,7 @@ class Wu {
|
|
|
5556
5553
|
exchangeCodeForToken(e) {
|
|
5557
5554
|
return F(this, arguments, void 0, function* ({ code: n, codeVerifier: r }) {
|
|
5558
5555
|
var i;
|
|
5559
|
-
const s = yield this.getCurrentUser(), o = ((i = s == null ? void 0 : s.user) === null || i === void 0 ? void 0 : i.type) === "guest", a = yield
|
|
5556
|
+
const s = yield this.getCurrentUser(), o = ((i = s == null ? void 0 : s.user) === null || i === void 0 ? void 0 : i.type) === "guest", a = yield Dr({
|
|
5560
5557
|
apiURI: this.config.apiURI,
|
|
5561
5558
|
appId: this.config.appId,
|
|
5562
5559
|
code: n,
|
|
@@ -5579,7 +5576,7 @@ class Wu {
|
|
|
5579
5576
|
signInWithIdToken(e) {
|
|
5580
5577
|
return F(this, arguments, void 0, function* ({ idToken: n, clientName: r, nonce: i }) {
|
|
5581
5578
|
var s;
|
|
5582
|
-
const o = yield this.getCurrentUser(), a = (s = o == null ? void 0 : o.user) === null || s === void 0 ? void 0 : s.refresh_token, u = yield
|
|
5579
|
+
const o = yield this.getCurrentUser(), a = (s = o == null ? void 0 : o.user) === null || s === void 0 ? void 0 : s.refresh_token, u = yield ru({
|
|
5583
5580
|
apiURI: this.config.apiURI,
|
|
5584
5581
|
appId: this.config.appId,
|
|
5585
5582
|
idToken: n,
|
|
@@ -5620,7 +5617,7 @@ class Wu {
|
|
|
5620
5617
|
// TODO: look into typing again
|
|
5621
5618
|
getPresence(e, n, r = {}) {
|
|
5622
5619
|
const i = this._rooms[n], s = this._presence[n];
|
|
5623
|
-
return !i || !s || !s.result ? null : Object.assign(Object.assign({},
|
|
5620
|
+
return !i || !s || !s.result ? null : Object.assign(Object.assign({}, du(s.result, r, this._sessionId)), { isLoading: !i.isConnected, error: i.error });
|
|
5624
5621
|
}
|
|
5625
5622
|
// TODO: look into typing again
|
|
5626
5623
|
publishPresence(e, n, r) {
|
|
@@ -5670,7 +5667,7 @@ class Wu {
|
|
|
5670
5667
|
}
|
|
5671
5668
|
_notifyPresenceSub(e, n) {
|
|
5672
5669
|
const r = this.getPresence("", e, n);
|
|
5673
|
-
r && (n.prev && !
|
|
5670
|
+
r && (n.prev && !fu(r, n.prev) || (n.prev = r, n.cb(r)));
|
|
5674
5671
|
}
|
|
5675
5672
|
_patchPresencePeers(e, n) {
|
|
5676
5673
|
var r, i, s;
|
|
@@ -5681,13 +5678,13 @@ class Wu {
|
|
|
5681
5678
|
for (let [d, f, l] of n)
|
|
5682
5679
|
switch (f) {
|
|
5683
5680
|
case "+":
|
|
5684
|
-
|
|
5681
|
+
Ks(c, d, l);
|
|
5685
5682
|
break;
|
|
5686
5683
|
case "r":
|
|
5687
|
-
|
|
5684
|
+
Sr(c, d, l);
|
|
5688
5685
|
break;
|
|
5689
5686
|
case "-":
|
|
5690
|
-
|
|
5687
|
+
wi(c, d);
|
|
5691
5688
|
break;
|
|
5692
5689
|
}
|
|
5693
5690
|
delete c[this._sessionId];
|
|
@@ -5699,7 +5696,7 @@ class Wu {
|
|
|
5699
5696
|
delete r[this._sessionId];
|
|
5700
5697
|
const i = Object.fromEntries(Object.entries(r).map(([s, o]) => [s, o.data]));
|
|
5701
5698
|
this._presence = Pt(this._presence, (s) => {
|
|
5702
|
-
|
|
5699
|
+
Sr(s, [e, "result", "peers"], i);
|
|
5703
5700
|
});
|
|
5704
5701
|
}
|
|
5705
5702
|
// --------
|
|
@@ -5744,14 +5741,14 @@ class Wu {
|
|
|
5744
5741
|
return F(this, void 0, void 0, function* () {
|
|
5745
5742
|
var i;
|
|
5746
5743
|
const s = yield this.getCurrentUser(), o = (i = s == null ? void 0 : s.user) === null || i === void 0 ? void 0 : i.refresh_token;
|
|
5747
|
-
return
|
|
5744
|
+
return su(Object.assign(Object.assign({}, r), { apiURI: this.config.apiURI, appId: this.config.appId, path: e, file: n, refreshToken: o }));
|
|
5748
5745
|
});
|
|
5749
5746
|
}
|
|
5750
5747
|
deleteFile(e) {
|
|
5751
5748
|
return F(this, void 0, void 0, function* () {
|
|
5752
5749
|
var n;
|
|
5753
5750
|
const r = yield this.getCurrentUser(), i = (n = r == null ? void 0 : r.user) === null || n === void 0 ? void 0 : n.refresh_token;
|
|
5754
|
-
return yield
|
|
5751
|
+
return yield ou({
|
|
5755
5752
|
apiURI: this.config.apiURI,
|
|
5756
5753
|
appId: this.config.appId,
|
|
5757
5754
|
path: e,
|
|
@@ -5764,20 +5761,20 @@ class Wu {
|
|
|
5764
5761
|
upload(e, n) {
|
|
5765
5762
|
return F(this, void 0, void 0, function* () {
|
|
5766
5763
|
var r;
|
|
5767
|
-
const i = yield this.getCurrentUser(), s = (r = i == null ? void 0 : i.user) === null || r === void 0 ? void 0 : r.refresh_token, o = e || n.name, a = yield
|
|
5764
|
+
const i = yield this.getCurrentUser(), s = (r = i == null ? void 0 : i.user) === null || r === void 0 ? void 0 : r.refresh_token, o = e || n.name, a = yield au({
|
|
5768
5765
|
apiURI: this.config.apiURI,
|
|
5769
5766
|
appId: this.config.appId,
|
|
5770
5767
|
fileName: o,
|
|
5771
5768
|
refreshToken: s
|
|
5772
5769
|
});
|
|
5773
|
-
return yield
|
|
5770
|
+
return yield uu(a, n);
|
|
5774
5771
|
});
|
|
5775
5772
|
}
|
|
5776
5773
|
getDownloadUrl(e) {
|
|
5777
5774
|
return F(this, void 0, void 0, function* () {
|
|
5778
5775
|
var n;
|
|
5779
5776
|
const r = yield this.getCurrentUser(), i = (n = r == null ? void 0 : r.user) === null || n === void 0 ? void 0 : n.refresh_token;
|
|
5780
|
-
return yield
|
|
5777
|
+
return yield cu({
|
|
5781
5778
|
apiURI: this.config.apiURI,
|
|
5782
5779
|
appId: this.config.appId,
|
|
5783
5780
|
path: e,
|
|
@@ -5786,9 +5783,9 @@ class Wu {
|
|
|
5786
5783
|
});
|
|
5787
5784
|
}
|
|
5788
5785
|
}
|
|
5789
|
-
function
|
|
5786
|
+
function Wu(t, e) {
|
|
5790
5787
|
return new Lt(
|
|
5791
|
-
|
|
5788
|
+
Zi(t, e),
|
|
5792
5789
|
// (XXX): LinksDef<any> stems from TypeScript’s inability to reconcile the
|
|
5793
5790
|
// type EntitiesWithLinks<EntitiesWithoutLinks, Links> with
|
|
5794
5791
|
// EntitiesWithoutLinks. TypeScript is strict about ensuring that types are
|
|
@@ -5798,28 +5795,28 @@ function zu(t, e) {
|
|
|
5798
5795
|
void 0
|
|
5799
5796
|
);
|
|
5800
5797
|
}
|
|
5801
|
-
function
|
|
5798
|
+
function zu(t) {
|
|
5802
5799
|
return new Ut(t, {});
|
|
5803
5800
|
}
|
|
5804
|
-
function
|
|
5801
|
+
function Vu() {
|
|
5805
5802
|
return new H("string", !0, !1);
|
|
5806
5803
|
}
|
|
5807
|
-
function
|
|
5804
|
+
function Bu() {
|
|
5808
5805
|
return new H("number", !0, !1);
|
|
5809
5806
|
}
|
|
5810
|
-
function
|
|
5807
|
+
function Gu() {
|
|
5811
5808
|
return new H("boolean", !0, !1);
|
|
5812
5809
|
}
|
|
5813
|
-
function
|
|
5810
|
+
function Qu() {
|
|
5814
5811
|
return new H("date", !0, !1);
|
|
5815
5812
|
}
|
|
5816
|
-
function
|
|
5813
|
+
function Hu() {
|
|
5817
5814
|
return new H("json", !0, !1);
|
|
5818
5815
|
}
|
|
5819
|
-
function
|
|
5816
|
+
function Yu() {
|
|
5820
5817
|
return new H("json", !0, !1);
|
|
5821
5818
|
}
|
|
5822
|
-
function
|
|
5819
|
+
function Zi(t, e) {
|
|
5823
5820
|
var n, r, i, s;
|
|
5824
5821
|
const o = { fwd: {}, rev: {} };
|
|
5825
5822
|
for (const u of Object.values(e))
|
|
@@ -5835,10 +5832,10 @@ function Xi(t, e) {
|
|
|
5835
5832
|
new Ut(c.attrs, Object.assign(Object.assign({}, o.fwd[u]), o.rev[u]))
|
|
5836
5833
|
]));
|
|
5837
5834
|
}
|
|
5838
|
-
function
|
|
5835
|
+
function Ju({ entities: t, links: e, rooms: n }) {
|
|
5839
5836
|
const r = e ?? {}, i = n ?? {};
|
|
5840
5837
|
return new Lt(
|
|
5841
|
-
|
|
5838
|
+
Zi(t, r),
|
|
5842
5839
|
// (XXX): LinksDef<any> stems from TypeScript's inability to reconcile the
|
|
5843
5840
|
// type EntitiesWithLinks<EntitiesWithoutLinks, Links> with
|
|
5844
5841
|
// EntitiesWithoutLinks. TypeScript is strict about ensuring that types are
|
|
@@ -5848,23 +5845,23 @@ function Zu({ entities: t, links: e, rooms: n }) {
|
|
|
5848
5845
|
i
|
|
5849
5846
|
);
|
|
5850
5847
|
}
|
|
5851
|
-
const
|
|
5848
|
+
const qc = {
|
|
5852
5849
|
// constructs
|
|
5853
|
-
graph:
|
|
5854
|
-
schema:
|
|
5855
|
-
entity:
|
|
5850
|
+
graph: Wu,
|
|
5851
|
+
schema: Ju,
|
|
5852
|
+
entity: zu,
|
|
5856
5853
|
// value types
|
|
5857
|
-
string:
|
|
5858
|
-
number:
|
|
5859
|
-
boolean:
|
|
5860
|
-
date:
|
|
5861
|
-
json:
|
|
5862
|
-
any:
|
|
5854
|
+
string: Vu,
|
|
5855
|
+
number: Bu,
|
|
5856
|
+
boolean: Gu,
|
|
5857
|
+
date: Qu,
|
|
5858
|
+
json: Hu,
|
|
5859
|
+
any: Yu
|
|
5863
5860
|
};
|
|
5864
5861
|
let mt;
|
|
5865
|
-
function
|
|
5862
|
+
function Zu(t, e) {
|
|
5866
5863
|
mt == null || mt.dispose();
|
|
5867
|
-
const n =
|
|
5864
|
+
const n = ic(e), r = tc(e, a), i = ec(Xu(t));
|
|
5868
5865
|
function s(d) {
|
|
5869
5866
|
var f;
|
|
5870
5867
|
d.source === i.element.contentWindow && ((f = d.data) === null || f === void 0 ? void 0 : f.type) === "close" && n.isVisible() && a();
|
|
@@ -5886,10 +5883,10 @@ function Xu(t, e) {
|
|
|
5886
5883
|
}
|
|
5887
5884
|
return c();
|
|
5888
5885
|
}
|
|
5889
|
-
function
|
|
5890
|
-
return `${
|
|
5886
|
+
function Xu(t) {
|
|
5887
|
+
return `${Vn || zi ? "http://localhost:3000" : "https://instantdb.com"}/_devtool?appId=${t}`;
|
|
5891
5888
|
}
|
|
5892
|
-
function
|
|
5889
|
+
function ec(t) {
|
|
5893
5890
|
const e = document.createElement("iframe");
|
|
5894
5891
|
return e.src = t, e.className = "instant-devtool-iframe", Object.assign(e.style, {
|
|
5895
5892
|
width: "100%",
|
|
@@ -5898,7 +5895,7 @@ function tc(t) {
|
|
|
5898
5895
|
border: "none"
|
|
5899
5896
|
}), { element: e };
|
|
5900
5897
|
}
|
|
5901
|
-
function
|
|
5898
|
+
function tc(t, e) {
|
|
5902
5899
|
const n = `
|
|
5903
5900
|
<svg width="32" height="32" viewBox="0 0 512 512" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
5904
5901
|
<rect width="512" height="512" fill="black"/>
|
|
@@ -5908,7 +5905,7 @@ function nc(t, e) {
|
|
|
5908
5905
|
return r.innerHTML = n, r.className = "instant-devtool-toggler", Object.assign(r.style, Object.assign(Object.assign({
|
|
5909
5906
|
// pos
|
|
5910
5907
|
position: "fixed"
|
|
5911
|
-
},
|
|
5908
|
+
}, nc(t.position)), {
|
|
5912
5909
|
height: "32px",
|
|
5913
5910
|
width: "32px",
|
|
5914
5911
|
// layout
|
|
@@ -5923,7 +5920,7 @@ function nc(t, e) {
|
|
|
5923
5920
|
cursor: "pointer"
|
|
5924
5921
|
})), r.addEventListener("click", e), { element: r };
|
|
5925
5922
|
}
|
|
5926
|
-
function
|
|
5923
|
+
function nc(t) {
|
|
5927
5924
|
switch (t) {
|
|
5928
5925
|
case "bottom-left":
|
|
5929
5926
|
return { bottom: "24px", left: "24px" };
|
|
@@ -5935,7 +5932,7 @@ function rc(t) {
|
|
|
5935
5932
|
return { top: "24px", left: "24px" };
|
|
5936
5933
|
}
|
|
5937
5934
|
}
|
|
5938
|
-
function
|
|
5935
|
+
function rc(t) {
|
|
5939
5936
|
switch (t) {
|
|
5940
5937
|
case "bottom-left":
|
|
5941
5938
|
return { bottom: "24px", right: "24px", left: "60px", top: "72px" };
|
|
@@ -5947,47 +5944,47 @@ function ic(t) {
|
|
|
5947
5944
|
return { top: "24px", right: "24px", left: "60px", bottom: "72px" };
|
|
5948
5945
|
}
|
|
5949
5946
|
}
|
|
5950
|
-
function
|
|
5947
|
+
function ic(t) {
|
|
5951
5948
|
const e = document.createElement("div");
|
|
5952
|
-
Object.assign(e.style, Object.assign(Object.assign({ position: "fixed" },
|
|
5949
|
+
Object.assign(e.style, Object.assign(Object.assign({ position: "fixed" }, rc(t.position)), { display: "block", borderRadius: "4px", border: "1px #ccc solid", boxShadow: "0px 0px 8px #00000044", backgroundColor: "#eee", zIndex: "999990" })), e.style.display = "none", e.className = "instant-devtool-container";
|
|
5953
5950
|
function n() {
|
|
5954
5951
|
return e.style.display !== "none";
|
|
5955
5952
|
}
|
|
5956
5953
|
return { element: e, isVisible: n };
|
|
5957
5954
|
}
|
|
5958
|
-
const
|
|
5955
|
+
const sc = {
|
|
5959
5956
|
apiURI: "https://api.instantdb.com",
|
|
5960
5957
|
websocketURI: "wss://api.instantdb.com/runtime/session"
|
|
5961
5958
|
};
|
|
5962
|
-
function
|
|
5959
|
+
function oc() {
|
|
5963
5960
|
var t;
|
|
5964
5961
|
return globalThis.__instantDbSchemaHashStore = (t = globalThis.__instantDbSchemaHashStore) !== null && t !== void 0 ? t : /* @__PURE__ */ new WeakMap(), globalThis.__instantDbSchemaHashStore;
|
|
5965
5962
|
}
|
|
5966
|
-
function
|
|
5963
|
+
function ac() {
|
|
5967
5964
|
var t;
|
|
5968
5965
|
return globalThis.__instantDbStore = (t = globalThis.__instantDbStore) !== null && t !== void 0 ? t : {}, globalThis.__instantDbStore;
|
|
5969
5966
|
}
|
|
5970
|
-
function
|
|
5967
|
+
function wn(t) {
|
|
5971
5968
|
const e = t.__adminToken;
|
|
5972
5969
|
return t.appId + "_" + (t.websocketURI || "default_ws_uri") + "_" + (t.apiURI || "default_api_uri") + "_" + (e || "client_only") + "_" + t.useDateObjects;
|
|
5973
5970
|
}
|
|
5974
|
-
const
|
|
5975
|
-
class
|
|
5971
|
+
const mn = ac(), Xr = oc();
|
|
5972
|
+
class uc {
|
|
5976
5973
|
constructor(e) {
|
|
5977
5974
|
this.db = e, this.sendMagicCode = (n) => this.db.sendMagicCode(n), this.signInWithMagicCode = (n) => this.db.signInWithMagicCode(n), this.signInWithToken = (n) => this.db.signInWithCustomToken(n), this.signInAsGuest = () => this.db.signInAsGuest(), this.createAuthorizationURL = (n) => this.db.createAuthorizationURL(n), this.signInWithIdToken = (n) => this.db.signInWithIdToken(n), this.exchangeOAuthCode = (n) => this.db.exchangeCodeForToken(n), this.issuerURI = () => this.db.issuerURI(), this.signOut = (n = { invalidateToken: !0 }) => this.db.signOut(n);
|
|
5978
5975
|
}
|
|
5979
5976
|
}
|
|
5980
|
-
class
|
|
5977
|
+
class cc {
|
|
5981
5978
|
constructor(e) {
|
|
5982
5979
|
this.db = e, this.uploadFile = (n, r, i = {}) => this.db.uploadFile(n, r, i), this.delete = (n) => this.db.deleteFile(n), this.upload = (n, r) => this.db.upload(n, r), this.put = this.upload, this.getDownloadUrl = (n) => this.db.getDownloadUrl(n);
|
|
5983
5980
|
}
|
|
5984
5981
|
}
|
|
5985
|
-
function
|
|
5982
|
+
function dc(t) {
|
|
5986
5983
|
return JSON.parse(JSON.stringify(t));
|
|
5987
5984
|
}
|
|
5988
|
-
class
|
|
5985
|
+
class fc {
|
|
5989
5986
|
constructor(e) {
|
|
5990
|
-
this.tx =
|
|
5987
|
+
this.tx = zn(), this._reactor = e, this.auth = new uc(this._reactor), this.storage = new cc(this._reactor);
|
|
5991
5988
|
}
|
|
5992
5989
|
/**
|
|
5993
5990
|
* Use this to write data! You can create, update, delete, and link objects
|
|
@@ -6128,7 +6125,7 @@ class lc {
|
|
|
6128
6125
|
};
|
|
6129
6126
|
}
|
|
6130
6127
|
shutdown() {
|
|
6131
|
-
delete
|
|
6128
|
+
delete mn[wn(this._reactor.config)], this._reactor.shutdown();
|
|
6132
6129
|
}
|
|
6133
6130
|
/**
|
|
6134
6131
|
* Use this for one-off queries.
|
|
@@ -6161,33 +6158,33 @@ class lc {
|
|
|
6161
6158
|
return this._reactor.subscribeTable(e, n);
|
|
6162
6159
|
}
|
|
6163
6160
|
}
|
|
6164
|
-
function
|
|
6161
|
+
function ei(t) {
|
|
6165
6162
|
if (!t)
|
|
6166
6163
|
return "0";
|
|
6167
|
-
const e =
|
|
6164
|
+
const e = Xr.get(t);
|
|
6168
6165
|
if (e)
|
|
6169
6166
|
return e;
|
|
6170
6167
|
const n = z(t);
|
|
6171
|
-
return
|
|
6168
|
+
return Xr.set(t, n), n;
|
|
6172
6169
|
}
|
|
6173
|
-
function
|
|
6174
|
-
return
|
|
6170
|
+
function lc(t, e) {
|
|
6171
|
+
return ei(t._reactor.config.schema) !== ei(e);
|
|
6175
6172
|
}
|
|
6176
|
-
function
|
|
6173
|
+
function hc(t, e, n, r, i) {
|
|
6177
6174
|
var s;
|
|
6178
|
-
const o = Object.assign(Object.assign({}, t), { useDateObjects: (s = t.useDateObjects) !== null && s !== void 0 ? s : !1 }), a =
|
|
6175
|
+
const o = Object.assign(Object.assign({}, t), { useDateObjects: (s = t.useDateObjects) !== null && s !== void 0 ? s : !1 }), a = mn[wn(o)];
|
|
6179
6176
|
if (a)
|
|
6180
|
-
return
|
|
6181
|
-
const u = new
|
|
6182
|
-
return
|
|
6177
|
+
return lc(a, o.schema) && a._reactor.updateSchema(o.schema), a;
|
|
6178
|
+
const u = new qu(Object.assign(Object.assign(Object.assign({}, sc), o), { cardinalityInference: !!o.schema }), e || Ki, n || qi, Object.assign(Object.assign({}, r || {}), { "@instantdb/core": Bn }), i), c = new fc(u);
|
|
6179
|
+
return mn[wn(o)] = c, pc(o.appId, o.devtool), c;
|
|
6183
6180
|
}
|
|
6184
|
-
function
|
|
6181
|
+
function pc(t, e) {
|
|
6185
6182
|
if (typeof window > "u" || typeof window.location > "u" || typeof document > "u" || typeof e == "boolean" && !e)
|
|
6186
6183
|
return;
|
|
6187
6184
|
const n = Object.assign({ position: "bottom-right", allowedHosts: ["localhost"] }, typeof e == "object" ? e : {});
|
|
6188
|
-
n.allowedHosts.includes(window.location.hostname) &&
|
|
6185
|
+
n.allowedHosts.includes(window.location.hostname) && Zu(t, n);
|
|
6189
6186
|
}
|
|
6190
|
-
var
|
|
6187
|
+
var vn = { exports: {} }, He = {};
|
|
6191
6188
|
/**
|
|
6192
6189
|
* @license React
|
|
6193
6190
|
* react-jsx-runtime.production.min.js
|
|
@@ -6197,11 +6194,11 @@ var Sn = { exports: {} }, He = {};
|
|
|
6197
6194
|
* This source code is licensed under the MIT license found in the
|
|
6198
6195
|
* LICENSE file in the root directory of this source tree.
|
|
6199
6196
|
*/
|
|
6200
|
-
var
|
|
6201
|
-
function
|
|
6202
|
-
if (
|
|
6203
|
-
|
|
6204
|
-
var t =
|
|
6197
|
+
var ti;
|
|
6198
|
+
function yc() {
|
|
6199
|
+
if (ti) return He;
|
|
6200
|
+
ti = 1;
|
|
6201
|
+
var t = ci, e = Symbol.for("react.element"), n = Symbol.for("react.fragment"), r = Object.prototype.hasOwnProperty, i = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, s = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
6205
6202
|
function o(a, u, c) {
|
|
6206
6203
|
var d, f = {}, l = null, p = null;
|
|
6207
6204
|
c !== void 0 && (l = "" + c), u.key !== void 0 && (l = "" + u.key), u.ref !== void 0 && (p = u.ref);
|
|
@@ -6211,10 +6208,10 @@ function bc() {
|
|
|
6211
6208
|
}
|
|
6212
6209
|
return He.Fragment = n, He.jsx = o, He.jsxs = o, He;
|
|
6213
6210
|
}
|
|
6214
|
-
var Ye = {},
|
|
6215
|
-
function
|
|
6216
|
-
if (
|
|
6217
|
-
|
|
6211
|
+
var Ye = {}, ni;
|
|
6212
|
+
function bc() {
|
|
6213
|
+
if (ni) return Ye;
|
|
6214
|
+
ni = 1;
|
|
6218
6215
|
var t = {};
|
|
6219
6216
|
/**
|
|
6220
6217
|
* @license React
|
|
@@ -6226,7 +6223,7 @@ function _c() {
|
|
|
6226
6223
|
* LICENSE file in the root directory of this source tree.
|
|
6227
6224
|
*/
|
|
6228
6225
|
return t.NODE_ENV !== "production" && function() {
|
|
6229
|
-
var e =
|
|
6226
|
+
var e = ci, n = Symbol.for("react.element"), r = Symbol.for("react.portal"), i = Symbol.for("react.fragment"), s = Symbol.for("react.strict_mode"), o = Symbol.for("react.profiler"), a = Symbol.for("react.provider"), u = Symbol.for("react.context"), c = Symbol.for("react.forward_ref"), d = Symbol.for("react.suspense"), f = Symbol.for("react.suspense_list"), l = Symbol.for("react.memo"), p = Symbol.for("react.lazy"), y = Symbol.for("react.offscreen"), b = Symbol.iterator, _ = "@@iterator";
|
|
6230
6227
|
function w(h) {
|
|
6231
6228
|
if (h === null || typeof h != "object")
|
|
6232
6229
|
return null;
|
|
@@ -6315,18 +6312,18 @@ function _c() {
|
|
|
6315
6312
|
}
|
|
6316
6313
|
return null;
|
|
6317
6314
|
}
|
|
6318
|
-
var we = Object.assign, Be = 0, Yn, Jn, Zn, Xn, er, tr
|
|
6319
|
-
function
|
|
6315
|
+
var we = Object.assign, Be = 0, Hn, Yn, Jn, Zn, Xn, er, tr;
|
|
6316
|
+
function nr() {
|
|
6320
6317
|
}
|
|
6321
|
-
|
|
6322
|
-
function
|
|
6318
|
+
nr.__reactDisabledLog = !0;
|
|
6319
|
+
function es() {
|
|
6323
6320
|
{
|
|
6324
6321
|
if (Be === 0) {
|
|
6325
|
-
|
|
6322
|
+
Hn = console.log, Yn = console.info, Jn = console.warn, Zn = console.error, Xn = console.group, er = console.groupCollapsed, tr = console.groupEnd;
|
|
6326
6323
|
var h = {
|
|
6327
6324
|
configurable: !0,
|
|
6328
6325
|
enumerable: !0,
|
|
6329
|
-
value:
|
|
6326
|
+
value: nr,
|
|
6330
6327
|
writable: !0
|
|
6331
6328
|
};
|
|
6332
6329
|
Object.defineProperties(console, {
|
|
@@ -6342,7 +6339,7 @@ function _c() {
|
|
|
6342
6339
|
Be++;
|
|
6343
6340
|
}
|
|
6344
6341
|
}
|
|
6345
|
-
function
|
|
6342
|
+
function ts() {
|
|
6346
6343
|
{
|
|
6347
6344
|
if (Be--, Be === 0) {
|
|
6348
6345
|
var h = {
|
|
@@ -6352,25 +6349,25 @@ function _c() {
|
|
|
6352
6349
|
};
|
|
6353
6350
|
Object.defineProperties(console, {
|
|
6354
6351
|
log: we({}, h, {
|
|
6355
|
-
value:
|
|
6352
|
+
value: Hn
|
|
6356
6353
|
}),
|
|
6357
6354
|
info: we({}, h, {
|
|
6358
|
-
value:
|
|
6355
|
+
value: Yn
|
|
6359
6356
|
}),
|
|
6360
6357
|
warn: we({}, h, {
|
|
6361
|
-
value:
|
|
6358
|
+
value: Jn
|
|
6362
6359
|
}),
|
|
6363
6360
|
error: we({}, h, {
|
|
6364
|
-
value:
|
|
6361
|
+
value: Zn
|
|
6365
6362
|
}),
|
|
6366
6363
|
group: we({}, h, {
|
|
6367
|
-
value:
|
|
6364
|
+
value: Xn
|
|
6368
6365
|
}),
|
|
6369
6366
|
groupCollapsed: we({}, h, {
|
|
6370
|
-
value:
|
|
6367
|
+
value: er
|
|
6371
6368
|
}),
|
|
6372
6369
|
groupEnd: we({}, h, {
|
|
6373
|
-
value:
|
|
6370
|
+
value: tr
|
|
6374
6371
|
})
|
|
6375
6372
|
});
|
|
6376
6373
|
}
|
|
@@ -6393,10 +6390,10 @@ function _c() {
|
|
|
6393
6390
|
}
|
|
6394
6391
|
var Wt = !1, yt;
|
|
6395
6392
|
{
|
|
6396
|
-
var
|
|
6397
|
-
yt = new
|
|
6393
|
+
var ns = typeof WeakMap == "function" ? WeakMap : Map;
|
|
6394
|
+
yt = new ns();
|
|
6398
6395
|
}
|
|
6399
|
-
function
|
|
6396
|
+
function rr(h, T) {
|
|
6400
6397
|
if (!h || Wt)
|
|
6401
6398
|
return "";
|
|
6402
6399
|
{
|
|
@@ -6409,7 +6406,7 @@ function _c() {
|
|
|
6409
6406
|
var P = Error.prepareStackTrace;
|
|
6410
6407
|
Error.prepareStackTrace = void 0;
|
|
6411
6408
|
var M;
|
|
6412
|
-
M = Kt.current, Kt.current = null,
|
|
6409
|
+
M = Kt.current, Kt.current = null, es();
|
|
6413
6410
|
try {
|
|
6414
6411
|
if (T) {
|
|
6415
6412
|
var C = function() {
|
|
@@ -6462,15 +6459,15 @@ function _c() {
|
|
|
6462
6459
|
}
|
|
6463
6460
|
}
|
|
6464
6461
|
} finally {
|
|
6465
|
-
Wt = !1, Kt.current = M,
|
|
6462
|
+
Wt = !1, Kt.current = M, ts(), Error.prepareStackTrace = P;
|
|
6466
6463
|
}
|
|
6467
6464
|
var Ie = h ? h.displayName || h.name : "", me = Ie ? pt(Ie) : "";
|
|
6468
6465
|
return typeof h == "function" && yt.set(h, me), me;
|
|
6469
6466
|
}
|
|
6470
|
-
function
|
|
6471
|
-
return
|
|
6467
|
+
function rs(h, T, v) {
|
|
6468
|
+
return rr(h, !1);
|
|
6472
6469
|
}
|
|
6473
|
-
function
|
|
6470
|
+
function is(h) {
|
|
6474
6471
|
var T = h.prototype;
|
|
6475
6472
|
return !!(T && T.isReactComponent);
|
|
6476
6473
|
}
|
|
@@ -6478,7 +6475,7 @@ function _c() {
|
|
|
6478
6475
|
if (h == null)
|
|
6479
6476
|
return "";
|
|
6480
6477
|
if (typeof h == "function")
|
|
6481
|
-
return
|
|
6478
|
+
return rr(h, is(h));
|
|
6482
6479
|
if (typeof h == "string")
|
|
6483
6480
|
return pt(h);
|
|
6484
6481
|
switch (h) {
|
|
@@ -6490,7 +6487,7 @@ function _c() {
|
|
|
6490
6487
|
if (typeof h == "object")
|
|
6491
6488
|
switch (h.$$typeof) {
|
|
6492
6489
|
case c:
|
|
6493
|
-
return
|
|
6490
|
+
return rs(h.render);
|
|
6494
6491
|
case l:
|
|
6495
6492
|
return bt(h.type, T, v);
|
|
6496
6493
|
case p: {
|
|
@@ -6503,15 +6500,15 @@ function _c() {
|
|
|
6503
6500
|
}
|
|
6504
6501
|
return "";
|
|
6505
6502
|
}
|
|
6506
|
-
var Ge = Object.prototype.hasOwnProperty,
|
|
6503
|
+
var Ge = Object.prototype.hasOwnProperty, ir = {}, sr = g.ReactDebugCurrentFrame;
|
|
6507
6504
|
function _t(h) {
|
|
6508
6505
|
if (h) {
|
|
6509
6506
|
var T = h._owner, v = bt(h.type, h._source, T ? T.type : null);
|
|
6510
|
-
|
|
6507
|
+
sr.setExtraStackFrame(v);
|
|
6511
6508
|
} else
|
|
6512
|
-
|
|
6509
|
+
sr.setExtraStackFrame(null);
|
|
6513
6510
|
}
|
|
6514
|
-
function
|
|
6511
|
+
function ss(h, T, v, O, P) {
|
|
6515
6512
|
{
|
|
6516
6513
|
var M = Function.call.bind(Ge);
|
|
6517
6514
|
for (var C in h)
|
|
@@ -6526,41 +6523,41 @@ function _c() {
|
|
|
6526
6523
|
} catch (D) {
|
|
6527
6524
|
j = D;
|
|
6528
6525
|
}
|
|
6529
|
-
j && !(j instanceof Error) && (_t(P), m("%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).", O || "React class", v, C, typeof j), _t(null)), j instanceof Error && !(j.message in
|
|
6526
|
+
j && !(j instanceof Error) && (_t(P), m("%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).", O || "React class", v, C, typeof j), _t(null)), j instanceof Error && !(j.message in ir) && (ir[j.message] = !0, _t(P), m("Failed %s type: %s", v, j.message), _t(null));
|
|
6530
6527
|
}
|
|
6531
6528
|
}
|
|
6532
6529
|
}
|
|
6533
|
-
var
|
|
6530
|
+
var os = Array.isArray;
|
|
6534
6531
|
function zt(h) {
|
|
6535
|
-
return
|
|
6532
|
+
return os(h);
|
|
6536
6533
|
}
|
|
6537
|
-
function
|
|
6534
|
+
function as(h) {
|
|
6538
6535
|
{
|
|
6539
6536
|
var T = typeof Symbol == "function" && Symbol.toStringTag, v = T && h[Symbol.toStringTag] || h.constructor.name || "Object";
|
|
6540
6537
|
return v;
|
|
6541
6538
|
}
|
|
6542
6539
|
}
|
|
6543
|
-
function
|
|
6540
|
+
function us(h) {
|
|
6544
6541
|
try {
|
|
6545
|
-
return
|
|
6542
|
+
return or(h), !1;
|
|
6546
6543
|
} catch {
|
|
6547
6544
|
return !0;
|
|
6548
6545
|
}
|
|
6549
6546
|
}
|
|
6550
|
-
function
|
|
6547
|
+
function or(h) {
|
|
6551
6548
|
return "" + h;
|
|
6552
6549
|
}
|
|
6553
|
-
function
|
|
6554
|
-
if (
|
|
6555
|
-
return m("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",
|
|
6550
|
+
function ar(h) {
|
|
6551
|
+
if (us(h))
|
|
6552
|
+
return m("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", as(h)), or(h);
|
|
6556
6553
|
}
|
|
6557
|
-
var
|
|
6554
|
+
var ur = g.ReactCurrentOwner, cs = {
|
|
6558
6555
|
key: !0,
|
|
6559
6556
|
ref: !0,
|
|
6560
6557
|
__self: !0,
|
|
6561
6558
|
__source: !0
|
|
6562
|
-
},
|
|
6563
|
-
function
|
|
6559
|
+
}, cr, dr;
|
|
6560
|
+
function ds(h) {
|
|
6564
6561
|
if (Ge.call(h, "ref")) {
|
|
6565
6562
|
var T = Object.getOwnPropertyDescriptor(h, "ref").get;
|
|
6566
6563
|
if (T && T.isReactWarning)
|
|
@@ -6568,7 +6565,7 @@ function _c() {
|
|
|
6568
6565
|
}
|
|
6569
6566
|
return h.ref !== void 0;
|
|
6570
6567
|
}
|
|
6571
|
-
function
|
|
6568
|
+
function fs(h) {
|
|
6572
6569
|
if (Ge.call(h, "key")) {
|
|
6573
6570
|
var T = Object.getOwnPropertyDescriptor(h, "key").get;
|
|
6574
6571
|
if (T && T.isReactWarning)
|
|
@@ -6576,13 +6573,13 @@ function _c() {
|
|
|
6576
6573
|
}
|
|
6577
6574
|
return h.key !== void 0;
|
|
6578
6575
|
}
|
|
6579
|
-
function
|
|
6580
|
-
typeof h.ref == "string" &&
|
|
6576
|
+
function ls(h, T) {
|
|
6577
|
+
typeof h.ref == "string" && ur.current;
|
|
6581
6578
|
}
|
|
6582
|
-
function
|
|
6579
|
+
function hs(h, T) {
|
|
6583
6580
|
{
|
|
6584
6581
|
var v = function() {
|
|
6585
|
-
|
|
6582
|
+
cr || (cr = !0, m("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", T));
|
|
6586
6583
|
};
|
|
6587
6584
|
v.isReactWarning = !0, Object.defineProperty(h, "key", {
|
|
6588
6585
|
get: v,
|
|
@@ -6590,10 +6587,10 @@ function _c() {
|
|
|
6590
6587
|
});
|
|
6591
6588
|
}
|
|
6592
6589
|
}
|
|
6593
|
-
function
|
|
6590
|
+
function ps(h, T) {
|
|
6594
6591
|
{
|
|
6595
6592
|
var v = function() {
|
|
6596
|
-
|
|
6593
|
+
dr || (dr = !0, m("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", T));
|
|
6597
6594
|
};
|
|
6598
6595
|
v.isReactWarning = !0, Object.defineProperty(h, "ref", {
|
|
6599
6596
|
get: v,
|
|
@@ -6601,7 +6598,7 @@ function _c() {
|
|
|
6601
6598
|
});
|
|
6602
6599
|
}
|
|
6603
6600
|
}
|
|
6604
|
-
var
|
|
6601
|
+
var ys = function(h, T, v, O, P, M, C) {
|
|
6605
6602
|
var j = {
|
|
6606
6603
|
// This tag allows us to uniquely identify this as a React Element
|
|
6607
6604
|
$$typeof: n,
|
|
@@ -6630,12 +6627,12 @@ function _c() {
|
|
|
6630
6627
|
value: P
|
|
6631
6628
|
}), Object.freeze && (Object.freeze(j.props), Object.freeze(j)), j;
|
|
6632
6629
|
};
|
|
6633
|
-
function
|
|
6630
|
+
function bs(h, T, v, O, P) {
|
|
6634
6631
|
{
|
|
6635
6632
|
var M, C = {}, j = null, G = null;
|
|
6636
|
-
v !== void 0 && (
|
|
6633
|
+
v !== void 0 && (ar(v), j = "" + v), fs(T) && (ar(T.key), j = "" + T.key), ds(T) && (G = T.ref, ls(T, P));
|
|
6637
6634
|
for (M in T)
|
|
6638
|
-
Ge.call(T, M) && !
|
|
6635
|
+
Ge.call(T, M) && !cs.hasOwnProperty(M) && (C[M] = T[M]);
|
|
6639
6636
|
if (h && h.defaultProps) {
|
|
6640
6637
|
var D = h.defaultProps;
|
|
6641
6638
|
for (M in D)
|
|
@@ -6643,25 +6640,25 @@ function _c() {
|
|
|
6643
6640
|
}
|
|
6644
6641
|
if (j || G) {
|
|
6645
6642
|
var L = typeof h == "function" ? h.displayName || h.name || "Unknown" : h;
|
|
6646
|
-
j &&
|
|
6643
|
+
j && hs(C, L), G && ps(C, L);
|
|
6647
6644
|
}
|
|
6648
|
-
return
|
|
6645
|
+
return ys(h, j, G, P, O, ur.current, C);
|
|
6649
6646
|
}
|
|
6650
6647
|
}
|
|
6651
|
-
var Vt = g.ReactCurrentOwner,
|
|
6648
|
+
var Vt = g.ReactCurrentOwner, fr = g.ReactDebugCurrentFrame;
|
|
6652
6649
|
function Pe(h) {
|
|
6653
6650
|
if (h) {
|
|
6654
6651
|
var T = h._owner, v = bt(h.type, h._source, T ? T.type : null);
|
|
6655
|
-
|
|
6652
|
+
fr.setExtraStackFrame(v);
|
|
6656
6653
|
} else
|
|
6657
|
-
|
|
6654
|
+
fr.setExtraStackFrame(null);
|
|
6658
6655
|
}
|
|
6659
6656
|
var Bt;
|
|
6660
6657
|
Bt = !1;
|
|
6661
6658
|
function Gt(h) {
|
|
6662
6659
|
return typeof h == "object" && h !== null && h.$$typeof === n;
|
|
6663
6660
|
}
|
|
6664
|
-
function
|
|
6661
|
+
function lr() {
|
|
6665
6662
|
{
|
|
6666
6663
|
if (Vt.current) {
|
|
6667
6664
|
var h = ce(Vt.current.type);
|
|
@@ -6673,13 +6670,13 @@ Check the render method of \`` + h + "`.";
|
|
|
6673
6670
|
return "";
|
|
6674
6671
|
}
|
|
6675
6672
|
}
|
|
6676
|
-
function
|
|
6673
|
+
function _s(h) {
|
|
6677
6674
|
return "";
|
|
6678
6675
|
}
|
|
6679
|
-
var
|
|
6680
|
-
function
|
|
6676
|
+
var hr = {};
|
|
6677
|
+
function gs(h) {
|
|
6681
6678
|
{
|
|
6682
|
-
var T =
|
|
6679
|
+
var T = lr();
|
|
6683
6680
|
if (!T) {
|
|
6684
6681
|
var v = typeof h == "string" ? h : h.displayName || h.name;
|
|
6685
6682
|
v && (T = `
|
|
@@ -6689,27 +6686,27 @@ Check the top-level render call using <` + v + ">.");
|
|
|
6689
6686
|
return T;
|
|
6690
6687
|
}
|
|
6691
6688
|
}
|
|
6692
|
-
function
|
|
6689
|
+
function pr(h, T) {
|
|
6693
6690
|
{
|
|
6694
6691
|
if (!h._store || h._store.validated || h.key != null)
|
|
6695
6692
|
return;
|
|
6696
6693
|
h._store.validated = !0;
|
|
6697
|
-
var v =
|
|
6698
|
-
if (
|
|
6694
|
+
var v = gs(T);
|
|
6695
|
+
if (hr[v])
|
|
6699
6696
|
return;
|
|
6700
|
-
|
|
6697
|
+
hr[v] = !0;
|
|
6701
6698
|
var O = "";
|
|
6702
6699
|
h && h._owner && h._owner !== Vt.current && (O = " It was passed a child from " + ce(h._owner.type) + "."), Pe(h), m('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', v, O), Pe(null);
|
|
6703
6700
|
}
|
|
6704
6701
|
}
|
|
6705
|
-
function
|
|
6702
|
+
function yr(h, T) {
|
|
6706
6703
|
{
|
|
6707
6704
|
if (typeof h != "object")
|
|
6708
6705
|
return;
|
|
6709
6706
|
if (zt(h))
|
|
6710
6707
|
for (var v = 0; v < h.length; v++) {
|
|
6711
6708
|
var O = h[v];
|
|
6712
|
-
Gt(O) &&
|
|
6709
|
+
Gt(O) && pr(O, T);
|
|
6713
6710
|
}
|
|
6714
6711
|
else if (Gt(h))
|
|
6715
6712
|
h._store && (h._store.validated = !0);
|
|
@@ -6717,11 +6714,11 @@ Check the top-level render call using <` + v + ">.");
|
|
|
6717
6714
|
var P = w(h);
|
|
6718
6715
|
if (typeof P == "function" && P !== h.entries)
|
|
6719
6716
|
for (var M = P.call(h), C; !(C = M.next()).done; )
|
|
6720
|
-
Gt(C.value) &&
|
|
6717
|
+
Gt(C.value) && pr(C.value, T);
|
|
6721
6718
|
}
|
|
6722
6719
|
}
|
|
6723
6720
|
}
|
|
6724
|
-
function
|
|
6721
|
+
function Ts(h) {
|
|
6725
6722
|
{
|
|
6726
6723
|
var T = h.type;
|
|
6727
6724
|
if (T == null || typeof T == "string")
|
|
@@ -6737,7 +6734,7 @@ Check the top-level render call using <` + v + ">.");
|
|
|
6737
6734
|
return;
|
|
6738
6735
|
if (v) {
|
|
6739
6736
|
var O = ce(T);
|
|
6740
|
-
|
|
6737
|
+
ss(v, h.props, "prop", O, h);
|
|
6741
6738
|
} else if (T.PropTypes !== void 0 && !Bt) {
|
|
6742
6739
|
Bt = !0;
|
|
6743
6740
|
var P = ce(T);
|
|
@@ -6746,7 +6743,7 @@ Check the top-level render call using <` + v + ">.");
|
|
|
6746
6743
|
typeof T.getDefaultProps == "function" && !T.getDefaultProps.isReactClassApproved && m("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
|
|
6747
6744
|
}
|
|
6748
6745
|
}
|
|
6749
|
-
function
|
|
6746
|
+
function ws(h) {
|
|
6750
6747
|
{
|
|
6751
6748
|
for (var T = Object.keys(h.props), v = 0; v < T.length; v++) {
|
|
6752
6749
|
var O = T[v];
|
|
@@ -6758,19 +6755,19 @@ Check the top-level render call using <` + v + ">.");
|
|
|
6758
6755
|
h.ref !== null && (Pe(h), m("Invalid attribute `ref` supplied to `React.Fragment`."), Pe(null));
|
|
6759
6756
|
}
|
|
6760
6757
|
}
|
|
6761
|
-
var
|
|
6762
|
-
function
|
|
6758
|
+
var br = {};
|
|
6759
|
+
function _r(h, T, v, O, P, M) {
|
|
6763
6760
|
{
|
|
6764
6761
|
var C = Ft(h);
|
|
6765
6762
|
if (!C) {
|
|
6766
6763
|
var j = "";
|
|
6767
6764
|
(h === void 0 || typeof h == "object" && h !== null && Object.keys(h).length === 0) && (j += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
|
|
6768
|
-
var G =
|
|
6769
|
-
G ? j += G : j +=
|
|
6765
|
+
var G = _s();
|
|
6766
|
+
G ? j += G : j += lr();
|
|
6770
6767
|
var D;
|
|
6771
6768
|
h === null ? D = "null" : zt(h) ? D = "array" : h !== void 0 && h.$$typeof === n ? (D = "<" + (ce(h.type) || "Unknown") + " />", j = " Did you accidentally export a JSX literal instead of a component?") : D = typeof h, m("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", D, j);
|
|
6772
6769
|
}
|
|
6773
|
-
var L =
|
|
6770
|
+
var L = bs(h, T, v, P, M);
|
|
6774
6771
|
if (L == null)
|
|
6775
6772
|
return L;
|
|
6776
6773
|
if (C) {
|
|
@@ -6779,56 +6776,56 @@ Check the top-level render call using <` + v + ">.");
|
|
|
6779
6776
|
if (O)
|
|
6780
6777
|
if (zt(re)) {
|
|
6781
6778
|
for (var Ie = 0; Ie < re.length; Ie++)
|
|
6782
|
-
|
|
6779
|
+
yr(re[Ie], h);
|
|
6783
6780
|
Object.freeze && Object.freeze(re);
|
|
6784
6781
|
} else
|
|
6785
6782
|
m("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
|
|
6786
6783
|
else
|
|
6787
|
-
|
|
6784
|
+
yr(re, h);
|
|
6788
6785
|
}
|
|
6789
6786
|
if (Ge.call(T, "key")) {
|
|
6790
|
-
var me = ce(h), Y = Object.keys(T).filter(function(
|
|
6791
|
-
return
|
|
6787
|
+
var me = ce(h), Y = Object.keys(T).filter(function(As) {
|
|
6788
|
+
return As !== "key";
|
|
6792
6789
|
}), Qt = Y.length > 0 ? "{key: someKey, " + Y.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
6793
|
-
if (!
|
|
6794
|
-
var
|
|
6790
|
+
if (!br[me + Qt]) {
|
|
6791
|
+
var Es = Y.length > 0 ? "{" + Y.join(": ..., ") + ": ...}" : "{}";
|
|
6795
6792
|
m(`A props object containing a "key" prop is being spread into JSX:
|
|
6796
6793
|
let props = %s;
|
|
6797
6794
|
<%s {...props} />
|
|
6798
6795
|
React keys must be passed directly to JSX without using spread:
|
|
6799
6796
|
let props = %s;
|
|
6800
|
-
<%s key={someKey} {...props} />`, Qt, me,
|
|
6797
|
+
<%s key={someKey} {...props} />`, Qt, me, Es, me), br[me + Qt] = !0;
|
|
6801
6798
|
}
|
|
6802
6799
|
}
|
|
6803
|
-
return h === i ?
|
|
6800
|
+
return h === i ? ws(L) : Ts(L), L;
|
|
6804
6801
|
}
|
|
6805
6802
|
}
|
|
6806
|
-
function
|
|
6807
|
-
return
|
|
6803
|
+
function ms(h, T, v) {
|
|
6804
|
+
return _r(h, T, v, !0);
|
|
6808
6805
|
}
|
|
6809
|
-
function
|
|
6810
|
-
return
|
|
6806
|
+
function vs(h, T, v) {
|
|
6807
|
+
return _r(h, T, v, !1);
|
|
6811
6808
|
}
|
|
6812
|
-
var
|
|
6813
|
-
Ye.Fragment = i, Ye.jsx =
|
|
6809
|
+
var Ss = vs, Os = ms;
|
|
6810
|
+
Ye.Fragment = i, Ye.jsx = Ss, Ye.jsxs = Os;
|
|
6814
6811
|
}(), Ye;
|
|
6815
6812
|
}
|
|
6816
|
-
var
|
|
6817
|
-
|
|
6818
|
-
var W =
|
|
6819
|
-
const
|
|
6813
|
+
var _c = {};
|
|
6814
|
+
_c.NODE_ENV === "production" ? vn.exports = yc() : vn.exports = bc();
|
|
6815
|
+
var W = vn.exports;
|
|
6816
|
+
const gc = {
|
|
6820
6817
|
isLoading: !0,
|
|
6821
6818
|
data: void 0,
|
|
6822
6819
|
pageInfo: void 0,
|
|
6823
6820
|
error: void 0
|
|
6824
6821
|
};
|
|
6825
|
-
function
|
|
6822
|
+
function ri(t) {
|
|
6826
6823
|
return Object.assign({ isLoading: !t, data: void 0, pageInfo: void 0, error: void 0 }, t || {});
|
|
6827
6824
|
}
|
|
6828
|
-
function
|
|
6825
|
+
function Tc(t, e, n) {
|
|
6829
6826
|
e && n && "ruleParams" in n && (e = Object.assign({ $$ruleParams: n.ruleParams }, e));
|
|
6830
|
-
const r = e ?
|
|
6831
|
-
(u) => (s.current =
|
|
6827
|
+
const r = e ? dc(e) : null, i = z(r), s = at(ri(t._reactor.getPreviousResult(r))), o = ge(
|
|
6828
|
+
(u) => (s.current = ri(t._reactor.getPreviousResult(r)), r ? t.subscribeQuery(r, (d) => {
|
|
6832
6829
|
s.current = Object.assign({
|
|
6833
6830
|
isLoading: !d,
|
|
6834
6831
|
// @ts-expect-error: ts thinks this will always be overwritten
|
|
@@ -6843,9 +6840,9 @@ function wc(t, e, n) {
|
|
|
6843
6840
|
// Build a new subscribe function if the query changes
|
|
6844
6841
|
[i]
|
|
6845
6842
|
);
|
|
6846
|
-
return { state:
|
|
6843
|
+
return { state: tn(o, () => s.current, () => gc), query: r };
|
|
6847
6844
|
}
|
|
6848
|
-
function
|
|
6845
|
+
function wc() {
|
|
6849
6846
|
const t = at(null);
|
|
6850
6847
|
je(() => {
|
|
6851
6848
|
n();
|
|
@@ -6858,14 +6855,14 @@ function mc() {
|
|
|
6858
6855
|
}
|
|
6859
6856
|
return { set: e, clear: n };
|
|
6860
6857
|
}
|
|
6861
|
-
const
|
|
6862
|
-
function
|
|
6858
|
+
const mc = 1e3;
|
|
6859
|
+
function vc(t, e, n) {
|
|
6863
6860
|
const r = at(n);
|
|
6864
6861
|
r.current = n, je(() => t.core._reactor.subscribeTopic(t.id, e, (s, o) => {
|
|
6865
6862
|
r.current(s, o);
|
|
6866
6863
|
}), [t.id, e]);
|
|
6867
6864
|
}
|
|
6868
|
-
function
|
|
6865
|
+
function Sc(t, e) {
|
|
6869
6866
|
return je(() => t.core._reactor.joinRoom(t.id), [t.id]), ge((r) => {
|
|
6870
6867
|
t.core._reactor.publishTopic({
|
|
6871
6868
|
roomType: t.type,
|
|
@@ -6875,9 +6872,9 @@ function Oc(t, e) {
|
|
|
6875
6872
|
});
|
|
6876
6873
|
}, [t.id, e]);
|
|
6877
6874
|
}
|
|
6878
|
-
function
|
|
6875
|
+
function Oc(t, e = {}) {
|
|
6879
6876
|
var n, r;
|
|
6880
|
-
const [i, s] =
|
|
6877
|
+
const [i, s] = di(() => {
|
|
6881
6878
|
var u;
|
|
6882
6879
|
return (u = t.core._reactor.getPresence(t.type, t.id, e)) !== null && u !== void 0 ? u : {
|
|
6883
6880
|
peers: {},
|
|
@@ -6890,15 +6887,15 @@ function Ec(t, e = {}) {
|
|
|
6890
6887
|
const o = ge((u) => {
|
|
6891
6888
|
t.core._reactor.publishPresence(t.type, t.id, u);
|
|
6892
6889
|
}, [t.type, t.id]);
|
|
6893
|
-
return
|
|
6890
|
+
return nn(() => Object.assign(Object.assign({}, i), { publishPresence: o }), [i, o]);
|
|
6894
6891
|
}
|
|
6895
|
-
function
|
|
6892
|
+
function Ec(t, e, n) {
|
|
6896
6893
|
je(() => t.core._reactor.joinRoom(t.id, e), [t.id]), je(() => t.core._reactor.publishPresence(t.type, t.id, e), [t.type, t.id, n ?? JSON.stringify(e)]);
|
|
6897
6894
|
}
|
|
6898
|
-
function
|
|
6899
|
-
const r =
|
|
6895
|
+
function Ac(t, e, n = {}) {
|
|
6896
|
+
const r = wc(), i = Se.usePresence(t, {
|
|
6900
6897
|
keys: [e]
|
|
6901
|
-
}), s =
|
|
6898
|
+
}), s = nn(() => {
|
|
6902
6899
|
var d;
|
|
6903
6900
|
const f = t._core._reactor.getPresence(t.type, t.id);
|
|
6904
6901
|
return n != null && n.writeOnly ? [] : Object.values((d = f == null ? void 0 : f.peers) !== null && d !== void 0 ? d : {}).filter((l) => l[e] === !0);
|
|
@@ -6906,7 +6903,7 @@ function jc(t, e, n = {}) {
|
|
|
6906
6903
|
var f;
|
|
6907
6904
|
t.core._reactor.publishPresence(t.type, t.id, {
|
|
6908
6905
|
[e]: d
|
|
6909
|
-
}), d && ((n == null ? void 0 : n.timeout) === null || (n == null ? void 0 : n.timeout) === 0 || r.set((f = n == null ? void 0 : n.timeout) !== null && f !== void 0 ? f :
|
|
6906
|
+
}), d && ((n == null ? void 0 : n.timeout) === null || (n == null ? void 0 : n.timeout) === 0 || r.set((f = n == null ? void 0 : n.timeout) !== null && f !== void 0 ? f : mc, () => {
|
|
6910
6907
|
t.core._reactor.publishPresence(t.type, t.id, {
|
|
6911
6908
|
[e]: null
|
|
6912
6909
|
});
|
|
@@ -6916,7 +6913,7 @@ function jc(t, e, n = {}) {
|
|
|
6916
6913
|
o(l);
|
|
6917
6914
|
}, [n.stopOnEnter, o]), u = ge(() => {
|
|
6918
6915
|
o(!1);
|
|
6919
|
-
}, [o]), c =
|
|
6916
|
+
}, [o]), c = nn(() => ({ onKeyDown: a, onBlur: u }), [a, u]);
|
|
6920
6917
|
return {
|
|
6921
6918
|
active: s,
|
|
6922
6919
|
setActive: o,
|
|
@@ -6924,20 +6921,20 @@ function jc(t, e, n = {}) {
|
|
|
6924
6921
|
};
|
|
6925
6922
|
}
|
|
6926
6923
|
const Se = {
|
|
6927
|
-
useTopicEffect:
|
|
6928
|
-
usePublishTopic:
|
|
6929
|
-
usePresence:
|
|
6930
|
-
useSyncPresence:
|
|
6931
|
-
useTypingIndicator:
|
|
6924
|
+
useTopicEffect: vc,
|
|
6925
|
+
usePublishTopic: Sc,
|
|
6926
|
+
usePresence: Oc,
|
|
6927
|
+
useSyncPresence: Ec,
|
|
6928
|
+
useTypingIndicator: Ac
|
|
6932
6929
|
};
|
|
6933
|
-
class
|
|
6930
|
+
class jc {
|
|
6934
6931
|
constructor(e, n, r) {
|
|
6935
6932
|
this.useTopicEffect = (i, s) => {
|
|
6936
6933
|
Se.useTopicEffect(this, i, s);
|
|
6937
6934
|
}, this.usePublishTopic = (i) => Se.usePublishTopic(this, i), this.usePresence = (i = {}) => Se.usePresence(this, i), this.useSyncPresence = (i, s) => Se.useSyncPresence(this, i, s), this.useTypingIndicator = (i, s = {}) => Se.useTypingIndicator(this, i, s), this.core = e, this._core = this.core, this.type = n, this.id = r;
|
|
6938
6935
|
}
|
|
6939
6936
|
}
|
|
6940
|
-
var
|
|
6937
|
+
var kc = function(t, e, n, r) {
|
|
6941
6938
|
function i(s) {
|
|
6942
6939
|
return s instanceof n ? s : new n(function(o) {
|
|
6943
6940
|
o(s);
|
|
@@ -6964,26 +6961,26 @@ var Cc = function(t, e, n, r) {
|
|
|
6964
6961
|
c((r = r.apply(t, e || [])).next());
|
|
6965
6962
|
});
|
|
6966
6963
|
};
|
|
6967
|
-
const
|
|
6964
|
+
const Cc = {
|
|
6968
6965
|
isLoading: !0,
|
|
6969
6966
|
user: void 0,
|
|
6970
6967
|
error: void 0
|
|
6971
6968
|
};
|
|
6972
|
-
class
|
|
6969
|
+
class Pc {
|
|
6973
6970
|
constructor(e, n) {
|
|
6974
|
-
this.tx =
|
|
6975
|
-
const [i, s] =
|
|
6971
|
+
this.tx = zn(), this.getLocalId = (r) => this.core.getLocalId(r), this.useLocalId = (r) => {
|
|
6972
|
+
const [i, s] = di(null);
|
|
6976
6973
|
return je(() => {
|
|
6977
|
-
|
|
6974
|
+
kc(this, void 0, void 0, function* () {
|
|
6978
6975
|
const a = yield this.getLocalId(r);
|
|
6979
6976
|
s(a);
|
|
6980
6977
|
});
|
|
6981
6978
|
}, [r]), i;
|
|
6982
|
-
}, this.rooms = Se, this.transact = (r) => this.core.transact(r), this.useQuery = (r, i) =>
|
|
6979
|
+
}, this.rooms = Se, this.transact = (r) => this.core.transact(r), this.useQuery = (r, i) => Tc(this.core, r, i).state, this.useAuth = () => {
|
|
6983
6980
|
const r = at(this.core._reactor._currentUserCached), i = ge((o) => this.core.subscribeAuth((u) => {
|
|
6984
6981
|
r.current = Object.assign({ isLoading: !1 }, u), o();
|
|
6985
6982
|
}), []);
|
|
6986
|
-
return
|
|
6983
|
+
return tn(i, () => r.current, () => Cc);
|
|
6987
6984
|
}, this.useUser = () => {
|
|
6988
6985
|
const { user: r } = this.useAuth();
|
|
6989
6986
|
if (!r)
|
|
@@ -6993,7 +6990,7 @@ class Ic {
|
|
|
6993
6990
|
const r = at(this.core._reactor.status), i = ge((o) => this.core.subscribeConnectionStatus((u) => {
|
|
6994
6991
|
u !== r.current && (r.current = u, o());
|
|
6995
6992
|
}), []);
|
|
6996
|
-
return
|
|
6993
|
+
return tn(
|
|
6997
6994
|
i,
|
|
6998
6995
|
() => r.current,
|
|
6999
6996
|
// For SSR, always return 'connecting' as the initial state
|
|
@@ -7005,7 +7002,7 @@ class Ic {
|
|
|
7005
7002
|
}, this.SignedOut = ({ children: r }) => {
|
|
7006
7003
|
const i = this.useAuth();
|
|
7007
7004
|
return i.isLoading || i.error || i.user ? null : W.jsx(W.Fragment, { children: r });
|
|
7008
|
-
}, this.core =
|
|
7005
|
+
}, this.core = hc(
|
|
7009
7006
|
e,
|
|
7010
7007
|
// @ts-expect-error because TS can't resolve subclass statics
|
|
7011
7008
|
this.constructor.Storage,
|
|
@@ -7029,7 +7026,7 @@ class Ic {
|
|
|
7029
7026
|
* const { peers } = db.rooms.usePresence(room);
|
|
7030
7027
|
*/
|
|
7031
7028
|
room(e = "_defaultRoomType", n = "_defaultRoomId") {
|
|
7032
|
-
return new
|
|
7029
|
+
return new jc(this.core, e, n);
|
|
7033
7030
|
}
|
|
7034
7031
|
/**
|
|
7035
7032
|
* One time query for the logged in state. This is useful
|
|
@@ -7045,22 +7042,22 @@ class Ic {
|
|
|
7045
7042
|
return this.core.getAuth();
|
|
7046
7043
|
}
|
|
7047
7044
|
}
|
|
7048
|
-
class
|
|
7045
|
+
class ii extends Error {
|
|
7049
7046
|
constructor(e, n) {
|
|
7050
7047
|
super(e), this.name = "ParseError", this.type = n.type, this.field = n.field, this.value = n.value, this.line = n.line;
|
|
7051
7048
|
}
|
|
7052
7049
|
}
|
|
7053
|
-
function
|
|
7050
|
+
function en(t) {
|
|
7054
7051
|
}
|
|
7055
|
-
function
|
|
7052
|
+
function Ic(t) {
|
|
7056
7053
|
if (typeof t == "function")
|
|
7057
7054
|
throw new TypeError(
|
|
7058
7055
|
"`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?"
|
|
7059
7056
|
);
|
|
7060
|
-
const { onEvent: e =
|
|
7057
|
+
const { onEvent: e = en, onError: n = en, onRetry: r = en, onComment: i } = t;
|
|
7061
7058
|
let s = "", o = !0, a, u = "", c = "";
|
|
7062
7059
|
function d(b) {
|
|
7063
|
-
const _ = o ? b.replace(/^\xEF\xBB\xBF/, "") : b, [w, g] =
|
|
7060
|
+
const _ = o ? b.replace(/^\xEF\xBB\xBF/, "") : b, [w, g] = Mc(`${s}${_}`);
|
|
7064
7061
|
for (const m of w)
|
|
7065
7062
|
f(m);
|
|
7066
7063
|
s = g, o = !1;
|
|
@@ -7096,7 +7093,7 @@ function Mc(t) {
|
|
|
7096
7093
|
break;
|
|
7097
7094
|
case "retry":
|
|
7098
7095
|
/^\d+$/.test(_) ? r(parseInt(_, 10)) : n(
|
|
7099
|
-
new
|
|
7096
|
+
new ii(`Invalid \`retry\` value: "${_}"`, {
|
|
7100
7097
|
type: "invalid-retry",
|
|
7101
7098
|
value: _,
|
|
7102
7099
|
line: w
|
|
@@ -7105,7 +7102,7 @@ function Mc(t) {
|
|
|
7105
7102
|
break;
|
|
7106
7103
|
default:
|
|
7107
7104
|
n(
|
|
7108
|
-
new
|
|
7105
|
+
new ii(
|
|
7109
7106
|
`Unknown field "${b.length > 20 ? `${b.slice(0, 20)}…` : b}"`,
|
|
7110
7107
|
{ type: "unknown-field", field: b, value: _, line: w }
|
|
7111
7108
|
)
|
|
@@ -7128,7 +7125,7 @@ function Mc(t) {
|
|
|
7128
7125
|
}
|
|
7129
7126
|
return { feed: d, reset: y };
|
|
7130
7127
|
}
|
|
7131
|
-
function
|
|
7128
|
+
function Mc(t) {
|
|
7132
7129
|
const e = [];
|
|
7133
7130
|
let n = "", r = 0;
|
|
7134
7131
|
for (; r < t.length; ) {
|
|
@@ -7146,7 +7143,7 @@ function Rc(t) {
|
|
|
7146
7143
|
}
|
|
7147
7144
|
return [e, n];
|
|
7148
7145
|
}
|
|
7149
|
-
class
|
|
7146
|
+
class si extends Event {
|
|
7150
7147
|
/**
|
|
7151
7148
|
* Constructs a new `ErrorEvent` instance. This is typically not called directly,
|
|
7152
7149
|
* but rather emitted by the `EventSource` object when an error occurs.
|
|
@@ -7171,7 +7168,7 @@ class oi extends Event {
|
|
|
7171
7168
|
* @returns A string representation of the error
|
|
7172
7169
|
*/
|
|
7173
7170
|
[Symbol.for("nodejs.util.inspect.custom")](e, n, r) {
|
|
7174
|
-
return r(
|
|
7171
|
+
return r(oi(this), n);
|
|
7175
7172
|
}
|
|
7176
7173
|
/**
|
|
7177
7174
|
* Deno "hides" the `message` and `code` properties of the `ErrorEvent` instance,
|
|
@@ -7185,17 +7182,17 @@ class oi extends Event {
|
|
|
7185
7182
|
* @returns A string representation of the error
|
|
7186
7183
|
*/
|
|
7187
7184
|
[Symbol.for("Deno.customInspect")](e, n) {
|
|
7188
|
-
return e(
|
|
7185
|
+
return e(oi(this), n);
|
|
7189
7186
|
}
|
|
7190
7187
|
}
|
|
7191
|
-
function
|
|
7188
|
+
function Rc(t) {
|
|
7192
7189
|
const e = globalThis.DOMException;
|
|
7193
7190
|
return typeof e == "function" ? new e(t, "SyntaxError") : new SyntaxError(t);
|
|
7194
7191
|
}
|
|
7195
|
-
function
|
|
7196
|
-
return t instanceof Error ? "errors" in t && Array.isArray(t.errors) ? t.errors.map(
|
|
7192
|
+
function Sn(t) {
|
|
7193
|
+
return t instanceof Error ? "errors" in t && Array.isArray(t.errors) ? t.errors.map(Sn).join(", ") : "cause" in t && t.cause instanceof Error ? `${t}: ${Sn(t.cause)}` : t.message : `${t}`;
|
|
7197
7194
|
}
|
|
7198
|
-
function
|
|
7195
|
+
function oi(t) {
|
|
7199
7196
|
return {
|
|
7200
7197
|
type: t.type,
|
|
7201
7198
|
message: t.message,
|
|
@@ -7205,13 +7202,13 @@ function ai(t) {
|
|
|
7205
7202
|
timeStamp: t.timeStamp
|
|
7206
7203
|
};
|
|
7207
7204
|
}
|
|
7208
|
-
var
|
|
7205
|
+
var Xi = (t) => {
|
|
7209
7206
|
throw TypeError(t);
|
|
7210
|
-
},
|
|
7207
|
+
}, Gn = (t, e, n) => e.has(t) || Xi("Cannot " + n), A = (t, e, n) => (Gn(t, e, "read from private field"), n ? n.call(t) : e.get(t)), N = (t, e, n) => e.has(t) ? Xi("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, n), $ = (t, e, n, r) => (Gn(t, e, "write to private field"), e.set(t, n), n), he = (t, e, n) => (Gn(t, e, "access private method"), n), J, Oe, Re, At, Rt, st, De, ot, _e, xe, Le, $e, et, se, On, En, An, ai, jn, kn, tt, Cn, Pn;
|
|
7211
7208
|
class jt extends EventTarget {
|
|
7212
7209
|
constructor(e, n) {
|
|
7213
7210
|
var r, i;
|
|
7214
|
-
super(), N(this, se), this.CONNECTING = 0, this.OPEN = 1, this.CLOSED = 2, N(this, J), N(this, Oe), N(this, Re), N(this, At), N(this, Rt), N(this, st), N(this, De), N(this, ot, null), N(this, _e), N(this, xe), N(this, Le, null), N(this, $e, null), N(this, et, null), N(this,
|
|
7211
|
+
super(), N(this, se), this.CONNECTING = 0, this.OPEN = 1, this.CLOSED = 2, N(this, J), N(this, Oe), N(this, Re), N(this, At), N(this, Rt), N(this, st), N(this, De), N(this, ot, null), N(this, _e), N(this, xe), N(this, Le, null), N(this, $e, null), N(this, et, null), N(this, En, async (s) => {
|
|
7215
7212
|
var o;
|
|
7216
7213
|
A(this, xe).reset();
|
|
7217
7214
|
const { body: a, redirected: u, status: c, headers: d } = s;
|
|
@@ -7239,11 +7236,11 @@ class jt extends EventTarget {
|
|
|
7239
7236
|
let y = !0;
|
|
7240
7237
|
do {
|
|
7241
7238
|
const { done: b, value: _ } = await p.read();
|
|
7242
|
-
_ && A(this, xe).feed(l.decode(_, { stream: !b })), b && (y = !1, A(this, xe).reset(), he(this, se,
|
|
7239
|
+
_ && A(this, xe).feed(l.decode(_, { stream: !b })), b && (y = !1, A(this, xe).reset(), he(this, se, Cn).call(this));
|
|
7243
7240
|
} while (y);
|
|
7241
|
+
}), N(this, An, (s) => {
|
|
7242
|
+
$(this, _e, void 0), !(s.name === "AbortError" || s.type === "aborted") && he(this, se, Cn).call(this, Sn(s));
|
|
7244
7243
|
}), N(this, jn, (s) => {
|
|
7245
|
-
$(this, _e, void 0), !(s.name === "AbortError" || s.type === "aborted") && he(this, se, Pn).call(this, On(s));
|
|
7246
|
-
}), N(this, kn, (s) => {
|
|
7247
7244
|
typeof s.id == "string" && $(this, ot, s.id);
|
|
7248
7245
|
const o = new MessageEvent(s.event || "message", {
|
|
7249
7246
|
data: s.data,
|
|
@@ -7251,25 +7248,25 @@ class jt extends EventTarget {
|
|
|
7251
7248
|
lastEventId: s.id || ""
|
|
7252
7249
|
});
|
|
7253
7250
|
A(this, $e) && (!s.event || s.event === "message") && A(this, $e).call(this, o), this.dispatchEvent(o);
|
|
7254
|
-
}), N(this,
|
|
7251
|
+
}), N(this, kn, (s) => {
|
|
7255
7252
|
$(this, st, s);
|
|
7256
|
-
}), N(this,
|
|
7257
|
-
$(this, De, void 0), A(this, J) === this.CONNECTING && he(this, se,
|
|
7253
|
+
}), N(this, Pn, () => {
|
|
7254
|
+
$(this, De, void 0), A(this, J) === this.CONNECTING && he(this, se, On).call(this);
|
|
7258
7255
|
});
|
|
7259
7256
|
try {
|
|
7260
7257
|
if (e instanceof URL)
|
|
7261
7258
|
$(this, Oe, e);
|
|
7262
7259
|
else if (typeof e == "string")
|
|
7263
|
-
$(this, Oe, new URL(e,
|
|
7260
|
+
$(this, Oe, new URL(e, xc()));
|
|
7264
7261
|
else
|
|
7265
7262
|
throw new Error("Invalid URL");
|
|
7266
7263
|
} catch {
|
|
7267
|
-
throw
|
|
7264
|
+
throw Rc("An invalid or illegal string was specified");
|
|
7268
7265
|
}
|
|
7269
|
-
$(this, xe,
|
|
7270
|
-
onEvent: A(this,
|
|
7271
|
-
onRetry: A(this,
|
|
7272
|
-
})), $(this, J, this.CONNECTING), $(this, st, 3e3), $(this, Rt, (r = n == null ? void 0 : n.fetch) != null ? r : globalThis.fetch), $(this, At, (i = n == null ? void 0 : n.withCredentials) != null ? i : !1), he(this, se,
|
|
7266
|
+
$(this, xe, Ic({
|
|
7267
|
+
onEvent: A(this, jn),
|
|
7268
|
+
onRetry: A(this, kn)
|
|
7269
|
+
})), $(this, J, this.CONNECTING), $(this, st, 3e3), $(this, Rt, (r = n == null ? void 0 : n.fetch) != null ? r : globalThis.fetch), $(this, At, (i = n == null ? void 0 : n.withCredentials) != null ? i : !1), he(this, se, On).call(this);
|
|
7273
7270
|
}
|
|
7274
7271
|
/**
|
|
7275
7272
|
* Returns the state of this EventSource object's connection. It can have the values described below.
|
|
@@ -7347,15 +7344,15 @@ J = /* @__PURE__ */ new WeakMap(), Oe = /* @__PURE__ */ new WeakMap(), Re = /* @
|
|
|
7347
7344
|
*
|
|
7348
7345
|
* @internal
|
|
7349
7346
|
*/
|
|
7350
|
-
|
|
7351
|
-
$(this, J, this.CONNECTING), $(this, _e, new AbortController()), A(this, Rt)(A(this, Oe), he(this, se,
|
|
7352
|
-
},
|
|
7347
|
+
On = function() {
|
|
7348
|
+
$(this, J, this.CONNECTING), $(this, _e, new AbortController()), A(this, Rt)(A(this, Oe), he(this, se, ai).call(this)).then(A(this, En)).catch(A(this, An));
|
|
7349
|
+
}, En = /* @__PURE__ */ new WeakMap(), An = /* @__PURE__ */ new WeakMap(), /**
|
|
7353
7350
|
* Get request options for the `fetch()` request
|
|
7354
7351
|
*
|
|
7355
7352
|
* @returns The request options
|
|
7356
7353
|
* @internal
|
|
7357
7354
|
*/
|
|
7358
|
-
|
|
7355
|
+
ai = function() {
|
|
7359
7356
|
var t;
|
|
7360
7357
|
const e = {
|
|
7361
7358
|
// [spec] Let `corsAttributeState` be `Anonymous`…
|
|
@@ -7367,7 +7364,7 @@ ui = function() {
|
|
|
7367
7364
|
signal: (t = A(this, _e)) == null ? void 0 : t.signal
|
|
7368
7365
|
};
|
|
7369
7366
|
return "window" in globalThis && (e.credentials = this.withCredentials ? "include" : "same-origin"), e;
|
|
7370
|
-
},
|
|
7367
|
+
}, jn = /* @__PURE__ */ new WeakMap(), kn = /* @__PURE__ */ new WeakMap(), /**
|
|
7371
7368
|
* Handles the process referred to in the EventSource specification as "failing a connection".
|
|
7372
7369
|
*
|
|
7373
7370
|
* @param error - The error causing the connection to fail
|
|
@@ -7377,7 +7374,7 @@ ui = function() {
|
|
|
7377
7374
|
tt = function(t, e) {
|
|
7378
7375
|
var n;
|
|
7379
7376
|
A(this, J) !== this.CLOSED && $(this, J, this.CLOSED);
|
|
7380
|
-
const r = new
|
|
7377
|
+
const r = new si("error", { code: e, message: t });
|
|
7381
7378
|
(n = A(this, Le)) == null || n.call(this, r), this.dispatchEvent(r);
|
|
7382
7379
|
}, /**
|
|
7383
7380
|
* Schedules a reconnection attempt against the EventSource endpoint.
|
|
@@ -7386,14 +7383,14 @@ tt = function(t, e) {
|
|
|
7386
7383
|
* @param code - The HTTP status code, if available
|
|
7387
7384
|
* @internal
|
|
7388
7385
|
*/
|
|
7389
|
-
|
|
7386
|
+
Cn = function(t, e) {
|
|
7390
7387
|
var n;
|
|
7391
7388
|
if (A(this, J) === this.CLOSED)
|
|
7392
7389
|
return;
|
|
7393
7390
|
$(this, J, this.CONNECTING);
|
|
7394
|
-
const r = new
|
|
7395
|
-
(n = A(this, Le)) == null || n.call(this, r), this.dispatchEvent(r), $(this, De, setTimeout(A(this,
|
|
7396
|
-
},
|
|
7391
|
+
const r = new si("error", { code: e, message: t });
|
|
7392
|
+
(n = A(this, Le)) == null || n.call(this, r), this.dispatchEvent(r), $(this, De, setTimeout(A(this, Pn), A(this, st)));
|
|
7393
|
+
}, Pn = /* @__PURE__ */ new WeakMap(), /**
|
|
7397
7394
|
* ReadyState representing an EventSource currently trying to connect
|
|
7398
7395
|
*
|
|
7399
7396
|
* @public
|
|
@@ -7409,25 +7406,25 @@ jt.OPEN = 1, /**
|
|
|
7409
7406
|
* @public
|
|
7410
7407
|
*/
|
|
7411
7408
|
jt.CLOSED = 2;
|
|
7412
|
-
function
|
|
7409
|
+
function xc() {
|
|
7413
7410
|
const t = "document" in globalThis ? globalThis.document : void 0;
|
|
7414
7411
|
return t && typeof t == "object" && "baseURI" in t && typeof t.baseURI == "string" ? t.baseURI : void 0;
|
|
7415
7412
|
}
|
|
7416
|
-
const
|
|
7413
|
+
const Qn = class Qn extends Pc {
|
|
7417
7414
|
};
|
|
7418
|
-
|
|
7419
|
-
let
|
|
7420
|
-
function
|
|
7415
|
+
Qn.EventSourceImpl = jt;
|
|
7416
|
+
let In = Qn;
|
|
7417
|
+
function $c(t) {
|
|
7421
7418
|
const e = {
|
|
7422
7419
|
...t,
|
|
7423
7420
|
useDateObjects: t.useDateObjects ?? !1
|
|
7424
7421
|
};
|
|
7425
|
-
return new
|
|
7426
|
-
"@instantdb/react":
|
|
7422
|
+
return new In(e, {
|
|
7423
|
+
"@instantdb/react": Bn
|
|
7427
7424
|
});
|
|
7428
7425
|
}
|
|
7429
|
-
const
|
|
7430
|
-
function
|
|
7426
|
+
const Wc = $c;
|
|
7427
|
+
function zc({
|
|
7431
7428
|
as: t = "div",
|
|
7432
7429
|
spaceId: e,
|
|
7433
7430
|
room: n,
|
|
@@ -7479,7 +7476,7 @@ function Vc({
|
|
|
7479
7476
|
[d]: void 0
|
|
7480
7477
|
});
|
|
7481
7478
|
}
|
|
7482
|
-
return
|
|
7479
|
+
return js(
|
|
7483
7480
|
t,
|
|
7484
7481
|
{
|
|
7485
7482
|
onMouseMove: y,
|
|
@@ -7498,9 +7495,9 @@ function Vc({
|
|
|
7498
7495
|
"div",
|
|
7499
7496
|
{
|
|
7500
7497
|
style: {
|
|
7501
|
-
...
|
|
7502
|
-
...
|
|
7503
|
-
zIndex: c !== void 0 ? c :
|
|
7498
|
+
...ui,
|
|
7499
|
+
...Uc,
|
|
7500
|
+
zIndex: c !== void 0 ? c : Lc
|
|
7504
7501
|
},
|
|
7505
7502
|
children: Object.entries(f.peers).map(([g, m]) => {
|
|
7506
7503
|
const E = m[d];
|
|
@@ -7508,7 +7505,7 @@ function Vc({
|
|
|
7508
7505
|
"div",
|
|
7509
7506
|
{
|
|
7510
7507
|
style: {
|
|
7511
|
-
...
|
|
7508
|
+
...ui,
|
|
7512
7509
|
transform: `translate(${E.xPercent}%, ${E.yPercent}%)`,
|
|
7513
7510
|
transformOrigin: "0 0",
|
|
7514
7511
|
transition: "transform 100ms"
|
|
@@ -7516,7 +7513,7 @@ function Vc({
|
|
|
7516
7513
|
children: a ? a({
|
|
7517
7514
|
color: E.color,
|
|
7518
7515
|
presence: l == null ? void 0 : l.peers[g]
|
|
7519
|
-
}) : /* @__PURE__ */ W.jsx(
|
|
7516
|
+
}) : /* @__PURE__ */ W.jsx(Dc, { ...E })
|
|
7520
7517
|
},
|
|
7521
7518
|
g
|
|
7522
7519
|
) : null;
|
|
@@ -7527,7 +7524,7 @@ function Vc({
|
|
|
7527
7524
|
]
|
|
7528
7525
|
);
|
|
7529
7526
|
}
|
|
7530
|
-
function
|
|
7527
|
+
function Dc({ color: t }) {
|
|
7531
7528
|
const n = t || "black";
|
|
7532
7529
|
return /* @__PURE__ */ W.jsxs(
|
|
7533
7530
|
"svg",
|
|
@@ -7574,27 +7571,27 @@ function Uc({ color: t }) {
|
|
|
7574
7571
|
}
|
|
7575
7572
|
);
|
|
7576
7573
|
}
|
|
7577
|
-
const
|
|
7574
|
+
const ui = {
|
|
7578
7575
|
position: "absolute",
|
|
7579
7576
|
top: 0,
|
|
7580
7577
|
left: 0,
|
|
7581
7578
|
bottom: 0,
|
|
7582
7579
|
right: 0
|
|
7583
|
-
},
|
|
7580
|
+
}, Uc = {
|
|
7584
7581
|
overflow: "hidden",
|
|
7585
7582
|
pointerEvents: "none",
|
|
7586
7583
|
userSelect: "none"
|
|
7587
|
-
},
|
|
7584
|
+
}, Lc = 99999;
|
|
7588
7585
|
export {
|
|
7589
|
-
|
|
7586
|
+
zc as Cursors,
|
|
7590
7587
|
Dt as InstantAPIError,
|
|
7591
|
-
|
|
7592
|
-
|
|
7588
|
+
Pc as InstantReactAbstractDatabase,
|
|
7589
|
+
In as InstantReactWebDatabase,
|
|
7593
7590
|
ve as SyncTableCallbackEventType,
|
|
7594
|
-
|
|
7591
|
+
qc as i,
|
|
7595
7592
|
K as id,
|
|
7596
|
-
|
|
7597
|
-
|
|
7598
|
-
|
|
7599
|
-
|
|
7593
|
+
$c as init,
|
|
7594
|
+
Wc as init_experimental,
|
|
7595
|
+
Nc as lookup,
|
|
7596
|
+
Kc as tx
|
|
7600
7597
|
};
|