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