@instantdb/react-common 0.22.61 → 0.22.62
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 +488 -472
- package/dist/standalone/index.umd.cjs +11 -11
- package/package.json +3 -3
package/dist/standalone/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import Sr, { useRef as ze, useCallback as de, useSyncExternalStore as Rt, useEffect as
|
|
1
|
+
import Sr, { useRef as ze, useCallback as de, useSyncExternalStore as Rt, useEffect as ge, useMemo as $t, useState as Or } from "react";
|
|
2
2
|
var xt = { exports: {} }, $e = {};
|
|
3
3
|
/**
|
|
4
4
|
* @license React
|
|
@@ -39,43 +39,43 @@ function Ki() {
|
|
|
39
39
|
*/
|
|
40
40
|
return t.NODE_ENV !== "production" && function() {
|
|
41
41
|
var e = Sr, 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"), u = Symbol.for("react.provider"), a = Symbol.for("react.context"), d = Symbol.for("react.forward_ref"), c = Symbol.for("react.suspense"), f = Symbol.for("react.suspense_list"), l = Symbol.for("react.memo"), p = Symbol.for("react.lazy"), y = Symbol.for("react.offscreen"), b = Symbol.iterator, g = "@@iterator";
|
|
42
|
-
function
|
|
42
|
+
function m(h) {
|
|
43
43
|
if (h === null || typeof h != "object")
|
|
44
44
|
return null;
|
|
45
45
|
var _ = b && h[b] || h[g];
|
|
46
46
|
return typeof _ == "function" ? _ : null;
|
|
47
47
|
}
|
|
48
|
-
var
|
|
48
|
+
var T = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
49
49
|
function v(h) {
|
|
50
50
|
{
|
|
51
|
-
for (var _ = arguments.length, w = new Array(_ > 1 ? _ - 1 : 0),
|
|
52
|
-
w[
|
|
53
|
-
|
|
51
|
+
for (var _ = arguments.length, w = new Array(_ > 1 ? _ - 1 : 0), O = 1; O < _; O++)
|
|
52
|
+
w[O - 1] = arguments[O];
|
|
53
|
+
j("error", h, w);
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
|
-
function
|
|
56
|
+
function j(h, _, w) {
|
|
57
57
|
{
|
|
58
|
-
var
|
|
58
|
+
var O = T.ReactDebugCurrentFrame, C = O.getStackAddendum();
|
|
59
59
|
C !== "" && (_ += "%s", w = w.concat([C]));
|
|
60
|
-
var P = w.map(function(
|
|
61
|
-
return String(
|
|
60
|
+
var P = w.map(function(k) {
|
|
61
|
+
return String(k);
|
|
62
62
|
});
|
|
63
63
|
P.unshift("Warning: " + _), Function.prototype.apply.call(console[h], console, P);
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
|
-
var
|
|
66
|
+
var S = !1, I = !1, R = !1, q = !1, Ie = !1, Qe;
|
|
67
67
|
Qe = Symbol.for("react.module.reference");
|
|
68
68
|
function _t(h) {
|
|
69
|
-
return !!(typeof h == "string" || typeof h == "function" || h === i || h === o ||
|
|
69
|
+
return !!(typeof h == "string" || typeof h == "function" || h === i || h === o || Ie || h === s || h === c || h === f || q || h === y || S || I || R || typeof h == "object" && h !== null && (h.$$typeof === p || h.$$typeof === l || h.$$typeof === u || h.$$typeof === a || h.$$typeof === d || // This needs to include all possible module reference object
|
|
70
70
|
// types supported by any Flight configuration anywhere since
|
|
71
71
|
// we don't know which Flight build this will end up being used
|
|
72
72
|
// with.
|
|
73
73
|
h.$$typeof === Qe || h.getModuleId !== void 0));
|
|
74
74
|
}
|
|
75
75
|
function gt(h, _, w) {
|
|
76
|
-
var
|
|
77
|
-
if (
|
|
78
|
-
return
|
|
76
|
+
var O = h.displayName;
|
|
77
|
+
if (O)
|
|
78
|
+
return O;
|
|
79
79
|
var C = _.displayName || _.name || "";
|
|
80
80
|
return C !== "" ? w + "(" + C + ")" : w;
|
|
81
81
|
}
|
|
@@ -114,12 +114,12 @@ function Ki() {
|
|
|
114
114
|
case d:
|
|
115
115
|
return gt(h, h.render, "ForwardRef");
|
|
116
116
|
case l:
|
|
117
|
-
var
|
|
118
|
-
return
|
|
117
|
+
var O = h.displayName || null;
|
|
118
|
+
return O !== null ? O : ne(h.type) || "Memo";
|
|
119
119
|
case p: {
|
|
120
|
-
var C = h, P = C._payload,
|
|
120
|
+
var C = h, P = C._payload, k = C._init;
|
|
121
121
|
try {
|
|
122
|
-
return ne(
|
|
122
|
+
return ne(k(P));
|
|
123
123
|
} catch {
|
|
124
124
|
return null;
|
|
125
125
|
}
|
|
@@ -127,7 +127,7 @@ function Ki() {
|
|
|
127
127
|
}
|
|
128
128
|
return null;
|
|
129
129
|
}
|
|
130
|
-
var
|
|
130
|
+
var le = Object.assign, Me = 0, yn, bn, _n, gn, Tn, mn, wn;
|
|
131
131
|
function vn() {
|
|
132
132
|
}
|
|
133
133
|
vn.__reactDisabledLog = !0;
|
|
@@ -163,25 +163,25 @@ function Ki() {
|
|
|
163
163
|
writable: !0
|
|
164
164
|
};
|
|
165
165
|
Object.defineProperties(console, {
|
|
166
|
-
log:
|
|
166
|
+
log: le({}, h, {
|
|
167
167
|
value: yn
|
|
168
168
|
}),
|
|
169
|
-
info:
|
|
169
|
+
info: le({}, h, {
|
|
170
170
|
value: bn
|
|
171
171
|
}),
|
|
172
|
-
warn:
|
|
172
|
+
warn: le({}, h, {
|
|
173
173
|
value: _n
|
|
174
174
|
}),
|
|
175
|
-
error:
|
|
175
|
+
error: le({}, h, {
|
|
176
176
|
value: gn
|
|
177
177
|
}),
|
|
178
|
-
group:
|
|
178
|
+
group: le({}, h, {
|
|
179
179
|
value: Tn
|
|
180
180
|
}),
|
|
181
|
-
groupCollapsed:
|
|
181
|
+
groupCollapsed: le({}, h, {
|
|
182
182
|
value: mn
|
|
183
183
|
}),
|
|
184
|
-
groupEnd:
|
|
184
|
+
groupEnd: le({}, h, {
|
|
185
185
|
value: wn
|
|
186
186
|
})
|
|
187
187
|
});
|
|
@@ -189,15 +189,15 @@ function Ki() {
|
|
|
189
189
|
Me < 0 && v("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
|
|
190
190
|
}
|
|
191
191
|
}
|
|
192
|
-
var Tt =
|
|
192
|
+
var Tt = T.ReactCurrentDispatcher, mt;
|
|
193
193
|
function Ye(h, _, w) {
|
|
194
194
|
{
|
|
195
195
|
if (mt === void 0)
|
|
196
196
|
try {
|
|
197
197
|
throw Error();
|
|
198
198
|
} catch (C) {
|
|
199
|
-
var
|
|
200
|
-
mt =
|
|
199
|
+
var O = C.stack.trim().match(/\n( *(at )?)/);
|
|
200
|
+
mt = O && O[1] || "";
|
|
201
201
|
}
|
|
202
202
|
return `
|
|
203
203
|
` + mt + h;
|
|
@@ -216,7 +216,7 @@ function Ki() {
|
|
|
216
216
|
if (w !== void 0)
|
|
217
217
|
return w;
|
|
218
218
|
}
|
|
219
|
-
var
|
|
219
|
+
var O;
|
|
220
220
|
wt = !0;
|
|
221
221
|
var C = Error.prepareStackTrace;
|
|
222
222
|
Error.prepareStackTrace = void 0;
|
|
@@ -224,40 +224,40 @@ function Ki() {
|
|
|
224
224
|
P = Tt.current, Tt.current = null, hi();
|
|
225
225
|
try {
|
|
226
226
|
if (_) {
|
|
227
|
-
var
|
|
227
|
+
var k = function() {
|
|
228
228
|
throw Error();
|
|
229
229
|
};
|
|
230
|
-
if (Object.defineProperty(
|
|
230
|
+
if (Object.defineProperty(k.prototype, "props", {
|
|
231
231
|
set: function() {
|
|
232
232
|
throw Error();
|
|
233
233
|
}
|
|
234
234
|
}), typeof Reflect == "object" && Reflect.construct) {
|
|
235
235
|
try {
|
|
236
|
-
Reflect.construct(
|
|
236
|
+
Reflect.construct(k, []);
|
|
237
237
|
} catch (W) {
|
|
238
|
-
|
|
238
|
+
O = W;
|
|
239
239
|
}
|
|
240
|
-
Reflect.construct(h, [],
|
|
240
|
+
Reflect.construct(h, [], k);
|
|
241
241
|
} else {
|
|
242
242
|
try {
|
|
243
|
-
|
|
243
|
+
k.call();
|
|
244
244
|
} catch (W) {
|
|
245
|
-
|
|
245
|
+
O = W;
|
|
246
246
|
}
|
|
247
|
-
h.call(
|
|
247
|
+
h.call(k.prototype);
|
|
248
248
|
}
|
|
249
249
|
} else {
|
|
250
250
|
try {
|
|
251
251
|
throw Error();
|
|
252
252
|
} catch (W) {
|
|
253
|
-
|
|
253
|
+
O = W;
|
|
254
254
|
}
|
|
255
255
|
h();
|
|
256
256
|
}
|
|
257
257
|
} catch (W) {
|
|
258
|
-
if (W &&
|
|
258
|
+
if (W && O && typeof W.stack == "string") {
|
|
259
259
|
for (var E = W.stack.split(`
|
|
260
|
-
`), z =
|
|
260
|
+
`), z = O.stack.split(`
|
|
261
261
|
`), $ = E.length - 1, D = z.length - 1; $ >= 1 && D >= 0 && E[$] !== z[D]; )
|
|
262
262
|
D--;
|
|
263
263
|
for (; $ >= 1 && D >= 0; $--, D--)
|
|
@@ -276,8 +276,8 @@ function Ki() {
|
|
|
276
276
|
} finally {
|
|
277
277
|
wt = !1, Tt.current = P, pi(), Error.prepareStackTrace = C;
|
|
278
278
|
}
|
|
279
|
-
var
|
|
280
|
-
return typeof h == "function" && Je.set(h,
|
|
279
|
+
var ve = h ? h.displayName || h.name : "", he = ve ? Ye(ve) : "";
|
|
280
|
+
return typeof h == "function" && Je.set(h, he), he;
|
|
281
281
|
}
|
|
282
282
|
function bi(h, _, w) {
|
|
283
283
|
return Sn(h, !1);
|
|
@@ -306,7 +306,7 @@ function Ki() {
|
|
|
306
306
|
case l:
|
|
307
307
|
return Ze(h.type, _, w);
|
|
308
308
|
case p: {
|
|
309
|
-
var
|
|
309
|
+
var O = h, C = O._payload, P = O._init;
|
|
310
310
|
try {
|
|
311
311
|
return Ze(P(C), _, w);
|
|
312
312
|
} catch {
|
|
@@ -315,7 +315,7 @@ function Ki() {
|
|
|
315
315
|
}
|
|
316
316
|
return "";
|
|
317
317
|
}
|
|
318
|
-
var Re = Object.prototype.hasOwnProperty, On = {}, En =
|
|
318
|
+
var Re = Object.prototype.hasOwnProperty, On = {}, En = T.ReactDebugCurrentFrame;
|
|
319
319
|
function Xe(h) {
|
|
320
320
|
if (h) {
|
|
321
321
|
var _ = h._owner, w = Ze(h.type, h._source, _ ? _.type : null);
|
|
@@ -323,22 +323,22 @@ function Ki() {
|
|
|
323
323
|
} else
|
|
324
324
|
En.setExtraStackFrame(null);
|
|
325
325
|
}
|
|
326
|
-
function gi(h, _, w,
|
|
326
|
+
function gi(h, _, w, O, C) {
|
|
327
327
|
{
|
|
328
328
|
var P = Function.call.bind(Re);
|
|
329
|
-
for (var
|
|
330
|
-
if (P(h,
|
|
329
|
+
for (var k in h)
|
|
330
|
+
if (P(h, k)) {
|
|
331
331
|
var E = void 0;
|
|
332
332
|
try {
|
|
333
|
-
if (typeof h[
|
|
334
|
-
var z = Error((
|
|
333
|
+
if (typeof h[k] != "function") {
|
|
334
|
+
var z = Error((O || "React class") + ": " + w + " type `" + k + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof h[k] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
|
|
335
335
|
throw z.name = "Invariant Violation", z;
|
|
336
336
|
}
|
|
337
|
-
E = h[
|
|
337
|
+
E = h[k](_, k, O, w, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
|
|
338
338
|
} catch ($) {
|
|
339
339
|
E = $;
|
|
340
340
|
}
|
|
341
|
-
E && !(E instanceof Error) && (Xe(C), v("%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).",
|
|
341
|
+
E && !(E instanceof Error) && (Xe(C), v("%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", w, k, typeof E), Xe(null)), E instanceof Error && !(E.message in On) && (On[E.message] = !0, Xe(C), v("Failed %s type: %s", w, E.message), Xe(null));
|
|
342
342
|
}
|
|
343
343
|
}
|
|
344
344
|
}
|
|
@@ -362,11 +362,11 @@ function Ki() {
|
|
|
362
362
|
function An(h) {
|
|
363
363
|
return "" + h;
|
|
364
364
|
}
|
|
365
|
-
function
|
|
365
|
+
function kn(h) {
|
|
366
366
|
if (wi(h))
|
|
367
367
|
return v("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", mi(h)), An(h);
|
|
368
368
|
}
|
|
369
|
-
var
|
|
369
|
+
var jn = T.ReactCurrentOwner, vi = {
|
|
370
370
|
key: !0,
|
|
371
371
|
ref: !0,
|
|
372
372
|
__self: !0,
|
|
@@ -389,7 +389,7 @@ function Ki() {
|
|
|
389
389
|
return h.key !== void 0;
|
|
390
390
|
}
|
|
391
391
|
function Ei(h, _) {
|
|
392
|
-
typeof h.ref == "string" &&
|
|
392
|
+
typeof h.ref == "string" && jn.current;
|
|
393
393
|
}
|
|
394
394
|
function Ai(h, _) {
|
|
395
395
|
{
|
|
@@ -402,7 +402,7 @@ function Ki() {
|
|
|
402
402
|
});
|
|
403
403
|
}
|
|
404
404
|
}
|
|
405
|
-
function
|
|
405
|
+
function ki(h, _) {
|
|
406
406
|
{
|
|
407
407
|
var w = function() {
|
|
408
408
|
Pn || (Pn = !0, v("%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)", _));
|
|
@@ -413,7 +413,7 @@ function Ki() {
|
|
|
413
413
|
});
|
|
414
414
|
}
|
|
415
415
|
}
|
|
416
|
-
var
|
|
416
|
+
var ji = function(h, _, w, O, C, P, k) {
|
|
417
417
|
var E = {
|
|
418
418
|
// This tag allows us to uniquely identify this as a React Element
|
|
419
419
|
$$typeof: n,
|
|
@@ -421,7 +421,7 @@ function Ki() {
|
|
|
421
421
|
type: h,
|
|
422
422
|
key: _,
|
|
423
423
|
ref: w,
|
|
424
|
-
props:
|
|
424
|
+
props: k,
|
|
425
425
|
// Record the component responsible for creating this element.
|
|
426
426
|
_owner: P
|
|
427
427
|
};
|
|
@@ -434,7 +434,7 @@ function Ki() {
|
|
|
434
434
|
configurable: !1,
|
|
435
435
|
enumerable: !1,
|
|
436
436
|
writable: !1,
|
|
437
|
-
value:
|
|
437
|
+
value: O
|
|
438
438
|
}), Object.defineProperty(E, "_source", {
|
|
439
439
|
configurable: !1,
|
|
440
440
|
enumerable: !1,
|
|
@@ -442,26 +442,26 @@ function Ki() {
|
|
|
442
442
|
value: C
|
|
443
443
|
}), Object.freeze && (Object.freeze(E.props), Object.freeze(E)), E;
|
|
444
444
|
};
|
|
445
|
-
function Ci(h, _, w,
|
|
445
|
+
function Ci(h, _, w, O, C) {
|
|
446
446
|
{
|
|
447
|
-
var P,
|
|
448
|
-
w !== void 0 && (
|
|
447
|
+
var P, k = {}, E = null, z = null;
|
|
448
|
+
w !== void 0 && (kn(w), E = "" + w), Oi(_) && (kn(_.key), E = "" + _.key), Si(_) && (z = _.ref, Ei(_, C));
|
|
449
449
|
for (P in _)
|
|
450
|
-
Re.call(_, P) && !vi.hasOwnProperty(P) && (
|
|
450
|
+
Re.call(_, P) && !vi.hasOwnProperty(P) && (k[P] = _[P]);
|
|
451
451
|
if (h && h.defaultProps) {
|
|
452
452
|
var $ = h.defaultProps;
|
|
453
453
|
for (P in $)
|
|
454
|
-
|
|
454
|
+
k[P] === void 0 && (k[P] = $[P]);
|
|
455
455
|
}
|
|
456
456
|
if (E || z) {
|
|
457
457
|
var D = typeof h == "function" ? h.displayName || h.name || "Unknown" : h;
|
|
458
|
-
E && Ai(
|
|
458
|
+
E && Ai(k, D), z && ki(k, D);
|
|
459
459
|
}
|
|
460
|
-
return
|
|
460
|
+
return ji(h, E, z, C, O, jn.current, k);
|
|
461
461
|
}
|
|
462
462
|
}
|
|
463
|
-
var St =
|
|
464
|
-
function
|
|
463
|
+
var St = T.ReactCurrentOwner, In = T.ReactDebugCurrentFrame;
|
|
464
|
+
function we(h) {
|
|
465
465
|
if (h) {
|
|
466
466
|
var _ = h._owner, w = Ze(h.type, h._source, _ ? _.type : null);
|
|
467
467
|
In.setExtraStackFrame(w);
|
|
@@ -510,8 +510,8 @@ Check the top-level render call using <` + w + ">.");
|
|
|
510
510
|
if (Rn[w])
|
|
511
511
|
return;
|
|
512
512
|
Rn[w] = !0;
|
|
513
|
-
var
|
|
514
|
-
h && h._owner && h._owner !== St.current && (
|
|
513
|
+
var O = "";
|
|
514
|
+
h && h._owner && h._owner !== St.current && (O = " It was passed a child from " + ne(h._owner.type) + "."), we(h), v('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', w, O), we(null);
|
|
515
515
|
}
|
|
516
516
|
}
|
|
517
517
|
function xn(h, _) {
|
|
@@ -520,16 +520,16 @@ Check the top-level render call using <` + w + ">.");
|
|
|
520
520
|
return;
|
|
521
521
|
if (vt(h))
|
|
522
522
|
for (var w = 0; w < h.length; w++) {
|
|
523
|
-
var
|
|
524
|
-
Et(
|
|
523
|
+
var O = h[w];
|
|
524
|
+
Et(O) && $n(O, _);
|
|
525
525
|
}
|
|
526
526
|
else if (Et(h))
|
|
527
527
|
h._store && (h._store.validated = !0);
|
|
528
528
|
else if (h) {
|
|
529
|
-
var C =
|
|
529
|
+
var C = m(h);
|
|
530
530
|
if (typeof C == "function" && C !== h.entries)
|
|
531
|
-
for (var P = C.call(h),
|
|
532
|
-
Et(
|
|
531
|
+
for (var P = C.call(h), k; !(k = P.next()).done; )
|
|
532
|
+
Et(k.value) && $n(k.value, _);
|
|
533
533
|
}
|
|
534
534
|
}
|
|
535
535
|
}
|
|
@@ -548,8 +548,8 @@ Check the top-level render call using <` + w + ">.");
|
|
|
548
548
|
else
|
|
549
549
|
return;
|
|
550
550
|
if (w) {
|
|
551
|
-
var
|
|
552
|
-
gi(w, h.props, "prop",
|
|
551
|
+
var O = ne(_);
|
|
552
|
+
gi(w, h.props, "prop", O, h);
|
|
553
553
|
} else if (_.PropTypes !== void 0 && !Ot) {
|
|
554
554
|
Ot = !0;
|
|
555
555
|
var C = ne(_);
|
|
@@ -561,20 +561,20 @@ Check the top-level render call using <` + w + ">.");
|
|
|
561
561
|
function Ri(h) {
|
|
562
562
|
{
|
|
563
563
|
for (var _ = Object.keys(h.props), w = 0; w < _.length; w++) {
|
|
564
|
-
var
|
|
565
|
-
if (
|
|
566
|
-
|
|
564
|
+
var O = _[w];
|
|
565
|
+
if (O !== "children" && O !== "key") {
|
|
566
|
+
we(h), v("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", O), we(null);
|
|
567
567
|
break;
|
|
568
568
|
}
|
|
569
569
|
}
|
|
570
|
-
h.ref !== null && (
|
|
570
|
+
h.ref !== null && (we(h), v("Invalid attribute `ref` supplied to `React.Fragment`."), we(null));
|
|
571
571
|
}
|
|
572
572
|
}
|
|
573
573
|
var Dn = {};
|
|
574
|
-
function Un(h, _, w,
|
|
574
|
+
function Un(h, _, w, O, C, P) {
|
|
575
575
|
{
|
|
576
|
-
var
|
|
577
|
-
if (!
|
|
576
|
+
var k = _t(h);
|
|
577
|
+
if (!k) {
|
|
578
578
|
var E = "";
|
|
579
579
|
(h === void 0 || typeof h == "object" && h !== null && Object.keys(h).length === 0) && (E += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
|
|
580
580
|
var z = Pi();
|
|
@@ -585,13 +585,13 @@ Check the top-level render call using <` + w + ">.");
|
|
|
585
585
|
var D = Ci(h, _, w, C, P);
|
|
586
586
|
if (D == null)
|
|
587
587
|
return D;
|
|
588
|
-
if (
|
|
588
|
+
if (k) {
|
|
589
589
|
var J = _.children;
|
|
590
590
|
if (J !== void 0)
|
|
591
|
-
if (
|
|
591
|
+
if (O)
|
|
592
592
|
if (vt(J)) {
|
|
593
|
-
for (var
|
|
594
|
-
xn(J[
|
|
593
|
+
for (var ve = 0; ve < J.length; ve++)
|
|
594
|
+
xn(J[ve], h);
|
|
595
595
|
Object.freeze && Object.freeze(J);
|
|
596
596
|
} else
|
|
597
597
|
v("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
|
|
@@ -599,17 +599,17 @@ Check the top-level render call using <` + w + ">.");
|
|
|
599
599
|
xn(J, h);
|
|
600
600
|
}
|
|
601
601
|
if (Re.call(_, "key")) {
|
|
602
|
-
var
|
|
602
|
+
var he = ne(h), W = Object.keys(_).filter(function(Fi) {
|
|
603
603
|
return Fi !== "key";
|
|
604
604
|
}), At = W.length > 0 ? "{key: someKey, " + W.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
605
|
-
if (!Dn[
|
|
605
|
+
if (!Dn[he + At]) {
|
|
606
606
|
var Li = W.length > 0 ? "{" + W.join(": ..., ") + ": ...}" : "{}";
|
|
607
607
|
v(`A props object containing a "key" prop is being spread into JSX:
|
|
608
608
|
let props = %s;
|
|
609
609
|
<%s {...props} />
|
|
610
610
|
React keys must be passed directly to JSX without using spread:
|
|
611
611
|
let props = %s;
|
|
612
|
-
<%s key={someKey} {...props} />`, At,
|
|
612
|
+
<%s key={someKey} {...props} />`, At, he, Li, he), Dn[he + At] = !0;
|
|
613
613
|
}
|
|
614
614
|
}
|
|
615
615
|
return h === i ? Ri(D) : Mi(D), D;
|
|
@@ -628,7 +628,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
628
628
|
var qi = {};
|
|
629
629
|
qi.NODE_ENV === "production" ? xt.exports = Ni() : xt.exports = Ki();
|
|
630
630
|
var et = xt.exports;
|
|
631
|
-
function
|
|
631
|
+
function N(t) {
|
|
632
632
|
if (typeof t == "number")
|
|
633
633
|
return (Math.abs(t * 2654435761) >>> 0).toString(16);
|
|
634
634
|
if (typeof t == "boolean")
|
|
@@ -647,7 +647,7 @@ function K(t) {
|
|
|
647
647
|
let e = 2166136261;
|
|
648
648
|
for (let n = 0; n < t.length; n++) {
|
|
649
649
|
e ^= (n + 1) * 2654435761;
|
|
650
|
-
const r =
|
|
650
|
+
const r = N(t[n]);
|
|
651
651
|
for (let i = 0; i < r.length; i++)
|
|
652
652
|
e ^= r.charCodeAt(i), e *= 16777619, e = e >>> 0;
|
|
653
653
|
}
|
|
@@ -657,14 +657,14 @@ function K(t) {
|
|
|
657
657
|
let e = 2166136261;
|
|
658
658
|
const n = Object.keys(t).sort();
|
|
659
659
|
for (let r = 0; r < n.length; r++) {
|
|
660
|
-
const i = n[r], s =
|
|
660
|
+
const i = n[r], s = N(i);
|
|
661
661
|
e ^= parseInt(s, 16), e *= 16777619, e = e >>> 0;
|
|
662
|
-
const o =
|
|
662
|
+
const o = N(t[i]);
|
|
663
663
|
e ^= parseInt(o, 16), e *= 16777619, e = e >>> 0;
|
|
664
664
|
}
|
|
665
665
|
return e.toString(16);
|
|
666
666
|
}
|
|
667
|
-
return
|
|
667
|
+
return N(String(t));
|
|
668
668
|
}
|
|
669
669
|
const x = {
|
|
670
670
|
Remove: "remove",
|
|
@@ -698,7 +698,7 @@ function H(t) {
|
|
|
698
698
|
var e;
|
|
699
699
|
return (e = t.copy) !== null && e !== void 0 ? e : t.original;
|
|
700
700
|
}
|
|
701
|
-
function
|
|
701
|
+
function Te(t) {
|
|
702
702
|
return !!A(t);
|
|
703
703
|
}
|
|
704
704
|
function A(t) {
|
|
@@ -735,16 +735,16 @@ function Ar(t, e = []) {
|
|
|
735
735
|
}
|
|
736
736
|
return e;
|
|
737
737
|
}
|
|
738
|
-
function
|
|
738
|
+
function me(t) {
|
|
739
739
|
return Array.isArray(t) ? 1 : t instanceof Map ? 2 : t instanceof Set ? 3 : 0;
|
|
740
740
|
}
|
|
741
741
|
function ce(t, e) {
|
|
742
|
-
return
|
|
742
|
+
return me(t) === 2 ? t.get(e) : t[e];
|
|
743
743
|
}
|
|
744
744
|
function We(t, e, n) {
|
|
745
|
-
|
|
745
|
+
me(t) === 2 ? t.set(e, n) : t[e] = n;
|
|
746
746
|
}
|
|
747
|
-
function
|
|
747
|
+
function kt(t, e) {
|
|
748
748
|
const n = A(t);
|
|
749
749
|
return (n ? H(n) : t)[e];
|
|
750
750
|
}
|
|
@@ -756,7 +756,7 @@ function Dt(t) {
|
|
|
756
756
|
for (; t.finalities.revoke.length > 0; )
|
|
757
757
|
t.finalities.revoke.pop()();
|
|
758
758
|
}
|
|
759
|
-
function
|
|
759
|
+
function be(t, e) {
|
|
760
760
|
return e ? t : [""].concat(t).map((n) => {
|
|
761
761
|
const r = `${n}`;
|
|
762
762
|
return r.indexOf("/") === -1 && r.indexOf("~") === -1 ? r : r.replace(/~/g, "~0").replace(/\//g, "~1");
|
|
@@ -765,7 +765,7 @@ function _e(t, e) {
|
|
|
765
765
|
function Vi(t, e) {
|
|
766
766
|
for (let n = 0; n < e.length - 1; n += 1) {
|
|
767
767
|
const r = e[n];
|
|
768
|
-
if (t = ce(
|
|
768
|
+
if (t = ce(me(t) === 3 ? Array.from(t) : t, r), typeof t != "object")
|
|
769
769
|
throw new Error(`Cannot resolve patch at '${e.join("/")}'.`);
|
|
770
770
|
}
|
|
771
771
|
return t;
|
|
@@ -787,7 +787,7 @@ function Wi(t) {
|
|
|
787
787
|
}), e;
|
|
788
788
|
}
|
|
789
789
|
const Bi = Object.prototype.propertyIsEnumerable;
|
|
790
|
-
function
|
|
790
|
+
function kr(t, e) {
|
|
791
791
|
let n;
|
|
792
792
|
if (Array.isArray(t))
|
|
793
793
|
return Array.prototype.concat.call(t);
|
|
@@ -823,7 +823,7 @@ function jr(t, e) {
|
|
|
823
823
|
throw new Error("Please check mark() to ensure that it is a stable marker draftable function.");
|
|
824
824
|
}
|
|
825
825
|
function V(t) {
|
|
826
|
-
t.copy || (t.copy =
|
|
826
|
+
t.copy || (t.copy = kr(t.original, t.options));
|
|
827
827
|
}
|
|
828
828
|
function Ue(t) {
|
|
829
829
|
if (!ee(t))
|
|
@@ -855,7 +855,7 @@ function Ue(t) {
|
|
|
855
855
|
return e;
|
|
856
856
|
}
|
|
857
857
|
function ot(t) {
|
|
858
|
-
return
|
|
858
|
+
return Te(t) ? Ue(t) : t;
|
|
859
859
|
}
|
|
860
860
|
function ie(t) {
|
|
861
861
|
var e;
|
|
@@ -864,7 +864,7 @@ function ie(t) {
|
|
|
864
864
|
function Kn() {
|
|
865
865
|
throw new Error("Cannot modify frozen object");
|
|
866
866
|
}
|
|
867
|
-
function
|
|
867
|
+
function Se(t, e, n, r, i) {
|
|
868
868
|
{
|
|
869
869
|
n = n ?? /* @__PURE__ */ new WeakMap(), r = r ?? [], i = i ?? [];
|
|
870
870
|
const o = n.has(t) ? n.get(t) : t;
|
|
@@ -881,37 +881,37 @@ function Oe(t, e, n, r, i) {
|
|
|
881
881
|
} else
|
|
882
882
|
r.push(o);
|
|
883
883
|
}
|
|
884
|
-
if (Object.isFrozen(t) ||
|
|
884
|
+
if (Object.isFrozen(t) || Te(t)) {
|
|
885
885
|
r.pop(), i.pop();
|
|
886
886
|
return;
|
|
887
887
|
}
|
|
888
|
-
switch (
|
|
888
|
+
switch (me(t)) {
|
|
889
889
|
case 2:
|
|
890
890
|
for (const [u, a] of t)
|
|
891
|
-
|
|
891
|
+
Se(u, u, n, r, i), Se(a, u, n, r, i);
|
|
892
892
|
t.set = t.clear = t.delete = Kn;
|
|
893
893
|
break;
|
|
894
894
|
case 3:
|
|
895
895
|
for (const u of t)
|
|
896
|
-
|
|
896
|
+
Se(u, u, n, r, i);
|
|
897
897
|
t.add = t.clear = t.delete = Kn;
|
|
898
898
|
break;
|
|
899
899
|
case 1:
|
|
900
900
|
Object.freeze(t);
|
|
901
901
|
let o = 0;
|
|
902
902
|
for (const u of t)
|
|
903
|
-
|
|
903
|
+
Se(u, o, n, r, i), o += 1;
|
|
904
904
|
break;
|
|
905
905
|
default:
|
|
906
906
|
Object.freeze(t), Object.keys(t).forEach((u) => {
|
|
907
907
|
const a = t[u];
|
|
908
|
-
|
|
908
|
+
Se(a, u, n, r, i);
|
|
909
909
|
});
|
|
910
910
|
}
|
|
911
911
|
r.pop(), i.pop();
|
|
912
912
|
}
|
|
913
913
|
function sn(t, e) {
|
|
914
|
-
const n =
|
|
914
|
+
const n = me(t);
|
|
915
915
|
if (n === 0)
|
|
916
916
|
Reflect.ownKeys(t).forEach((r) => {
|
|
917
917
|
e(r, t[r], t);
|
|
@@ -923,19 +923,19 @@ function sn(t, e) {
|
|
|
923
923
|
} else
|
|
924
924
|
t.forEach((r, i) => e(i, r, t));
|
|
925
925
|
}
|
|
926
|
-
function
|
|
927
|
-
if (
|
|
926
|
+
function jr(t, e, n) {
|
|
927
|
+
if (Te(t) || !ee(t, n) || e.has(t) || Object.isFrozen(t))
|
|
928
928
|
return;
|
|
929
929
|
const r = t instanceof Set, i = r ? /* @__PURE__ */ new Map() : void 0;
|
|
930
930
|
if (e.add(t), sn(t, (s, o) => {
|
|
931
931
|
var u;
|
|
932
|
-
if (
|
|
932
|
+
if (Te(o)) {
|
|
933
933
|
const a = A(o);
|
|
934
934
|
V(a);
|
|
935
935
|
const d = !((u = a.assignedMap) === null || u === void 0) && u.size || a.operated ? a.copy : a.original;
|
|
936
936
|
We(r ? i : t, s, d);
|
|
937
937
|
} else
|
|
938
|
-
|
|
938
|
+
jr(o, e, n);
|
|
939
939
|
}), i) {
|
|
940
940
|
const s = t, o = Array.from(s);
|
|
941
941
|
s.clear(), o.forEach((u) => {
|
|
@@ -945,7 +945,7 @@ function kr(t, e, n) {
|
|
|
945
945
|
}
|
|
946
946
|
function Gi(t, e) {
|
|
947
947
|
const n = t.type === 3 ? t.setMap : t.copy;
|
|
948
|
-
t.finalities.revoke.length > 1 && t.assignedMap.get(e) && n &&
|
|
948
|
+
t.finalities.revoke.length > 1 && t.assignedMap.get(e) && n && jr(ce(n, e), t.finalities.handledSet, t.options);
|
|
949
949
|
}
|
|
950
950
|
function Ut(t) {
|
|
951
951
|
t.type === 3 && t.copy && (t.copy.clear(), t.setMap.forEach((e) => {
|
|
@@ -980,7 +980,7 @@ function Qi(t, e, n, r, i) {
|
|
|
980
980
|
a.length < s.length && ([s, a] = [a, s], [n, r] = [r, n]);
|
|
981
981
|
for (let d = 0; d < s.length; d += 1)
|
|
982
982
|
if (o.get(d.toString()) && a[d] !== s[d]) {
|
|
983
|
-
const c = e.concat([d]), f =
|
|
983
|
+
const c = e.concat([d]), f = be(c, i);
|
|
984
984
|
n.push({
|
|
985
985
|
op: x.Replace,
|
|
986
986
|
path: f,
|
|
@@ -994,7 +994,7 @@ function Qi(t, e, n, r, i) {
|
|
|
994
994
|
});
|
|
995
995
|
}
|
|
996
996
|
for (let d = s.length; d < a.length; d += 1) {
|
|
997
|
-
const c = e.concat([d]), f =
|
|
997
|
+
const c = e.concat([d]), f = be(c, i);
|
|
998
998
|
n.push({
|
|
999
999
|
op: x.Add,
|
|
1000
1000
|
path: f,
|
|
@@ -1005,7 +1005,7 @@ function Qi(t, e, n, r, i) {
|
|
|
1005
1005
|
if (s.length < a.length) {
|
|
1006
1006
|
const { arrayLengthAssignment: d = !0 } = u.enablePatches;
|
|
1007
1007
|
if (d) {
|
|
1008
|
-
const c = e.concat(["length"]), f =
|
|
1008
|
+
const c = e.concat(["length"]), f = be(c, i);
|
|
1009
1009
|
r.push({
|
|
1010
1010
|
op: x.Replace,
|
|
1011
1011
|
path: f,
|
|
@@ -1013,7 +1013,7 @@ function Qi(t, e, n, r, i) {
|
|
|
1013
1013
|
});
|
|
1014
1014
|
} else
|
|
1015
1015
|
for (let c = a.length; s.length < c; c -= 1) {
|
|
1016
|
-
const f = e.concat([c - 1]), l =
|
|
1016
|
+
const f = e.concat([c - 1]), l = be(f, i);
|
|
1017
1017
|
r.push({
|
|
1018
1018
|
op: x.Remove,
|
|
1019
1019
|
path: l
|
|
@@ -1026,7 +1026,7 @@ function Hi({ original: t, copy: e, assignedMap: n }, r, i, s, o) {
|
|
|
1026
1026
|
const d = ce(t, a), c = ot(ce(e, a)), f = u ? Ne(t, a) ? x.Replace : x.Add : x.Remove;
|
|
1027
1027
|
if (ae(d, c) && f === x.Replace)
|
|
1028
1028
|
return;
|
|
1029
|
-
const l = r.concat(a), p =
|
|
1029
|
+
const l = r.concat(a), p = be(l, o);
|
|
1030
1030
|
i.push(f === x.Remove ? { op: f, path: p } : { op: f, path: p, value: c }), s.push(f === x.Add ? { op: x.Remove, path: p } : f === x.Remove ? { op: x.Add, path: p, value: d } : { op: x.Replace, path: p, value: d });
|
|
1031
1031
|
});
|
|
1032
1032
|
}
|
|
@@ -1034,7 +1034,7 @@ function Yi({ original: t, copy: e }, n, r, i, s) {
|
|
|
1034
1034
|
let o = 0;
|
|
1035
1035
|
t.forEach((u) => {
|
|
1036
1036
|
if (!e.has(u)) {
|
|
1037
|
-
const a = n.concat([o]), d =
|
|
1037
|
+
const a = n.concat([o]), d = be(a, s);
|
|
1038
1038
|
r.push({
|
|
1039
1039
|
op: x.Remove,
|
|
1040
1040
|
path: d,
|
|
@@ -1048,7 +1048,7 @@ function Yi({ original: t, copy: e }, n, r, i, s) {
|
|
|
1048
1048
|
o += 1;
|
|
1049
1049
|
}), o = 0, e.forEach((u) => {
|
|
1050
1050
|
if (!t.has(u)) {
|
|
1051
|
-
const a = n.concat([o]), d =
|
|
1051
|
+
const a = n.concat([o]), d = be(a, s);
|
|
1052
1052
|
r.push({
|
|
1053
1053
|
op: x.Add,
|
|
1054
1054
|
path: d,
|
|
@@ -1308,7 +1308,7 @@ const Zi = Reflect.ownKeys(dt), Cr = /* @__PURE__ */ new WeakSet(), Pr = {
|
|
|
1308
1308
|
const a = u[e];
|
|
1309
1309
|
if (t.options.strict && ct(a, t.options), t.finalized || !ee(a, t.options))
|
|
1310
1310
|
return a;
|
|
1311
|
-
if (a ===
|
|
1311
|
+
if (a === kt(t.original, e)) {
|
|
1312
1312
|
if (V(t), t.copy[e] = un({
|
|
1313
1313
|
original: t.original[e],
|
|
1314
1314
|
parentDraft: t,
|
|
@@ -1333,7 +1333,7 @@ const Zi = Reflect.ownKeys(dt), Cr = /* @__PURE__ */ new WeakSet(), Pr = {
|
|
|
1333
1333
|
const s = Nn(H(t), e);
|
|
1334
1334
|
if (s != null && s.set)
|
|
1335
1335
|
return s.set.call(t.proxy, n), !0;
|
|
1336
|
-
const o =
|
|
1336
|
+
const o = kt(H(t), e), u = A(o);
|
|
1337
1337
|
return u && ae(u.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) : (ae(n, o) && (n !== void 0 || Ne(t.original, e)) || (V(t), ie(t), Ne(t.original, e) && ae(n, t.original[e]) ? t.assignedMap.delete(e) : t.assignedMap.set(e, !0), t.copy[e] = n, on(t, e, n, Ve)), !0);
|
|
1338
1338
|
},
|
|
1339
1339
|
has(t, e) {
|
|
@@ -1362,11 +1362,11 @@ const Zi = Reflect.ownKeys(dt), Cr = /* @__PURE__ */ new WeakSet(), Pr = {
|
|
|
1362
1362
|
},
|
|
1363
1363
|
deleteProperty(t, e) {
|
|
1364
1364
|
var n;
|
|
1365
|
-
return t.type === 1 ? Pr.set.call(this, t, e, void 0, t.proxy) : (
|
|
1365
|
+
return t.type === 1 ? Pr.set.call(this, t, e, void 0, t.proxy) : (kt(t.original, e) !== void 0 || e in t.original ? (V(t), ie(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);
|
|
1366
1366
|
}
|
|
1367
1367
|
};
|
|
1368
1368
|
function un(t) {
|
|
1369
|
-
const { original: e, parentDraft: n, key: r, finalities: i, options: s } = t, o =
|
|
1369
|
+
const { original: e, parentDraft: n, key: r, finalities: i, options: s } = t, o = me(e), u = {
|
|
1370
1370
|
type: o,
|
|
1371
1371
|
finalized: !1,
|
|
1372
1372
|
parent: n,
|
|
@@ -1386,10 +1386,10 @@ function un(t) {
|
|
|
1386
1386
|
var p, y;
|
|
1387
1387
|
const b = A(a);
|
|
1388
1388
|
let g = c.type === 3 ? c.setMap : c.copy;
|
|
1389
|
-
const
|
|
1390
|
-
if (
|
|
1391
|
-
let v =
|
|
1392
|
-
|
|
1389
|
+
const m = ce(g, r), T = A(m);
|
|
1390
|
+
if (T) {
|
|
1391
|
+
let v = T.original;
|
|
1392
|
+
T.operated && (v = rn(m)), Ut(T), Lt(T, Ve, f, l), c.options.enableAutoFreeze && (c.options.updatedValues = (p = c.options.updatedValues) !== null && p !== void 0 ? p : /* @__PURE__ */ new WeakMap(), c.options.updatedValues.set(v, T.original)), We(g, r, v);
|
|
1393
1393
|
}
|
|
1394
1394
|
(y = b.callbacks) === null || y === void 0 || y.forEach((v) => {
|
|
1395
1395
|
v(f, l);
|
|
@@ -1411,7 +1411,7 @@ function Xi(t, e, n, r, i) {
|
|
|
1411
1411
|
for (; o.finalities.draft.length > 0; )
|
|
1412
1412
|
o.finalities.draft.pop()(n, r);
|
|
1413
1413
|
const d = a ? e[0] : o ? o.operated ? o.copy : o.original : t;
|
|
1414
|
-
return o && Dt(o), i &&
|
|
1414
|
+
return o && Dt(o), i && Se(d, d, o == null ? void 0 : o.options.updatedValues), [
|
|
1415
1415
|
d,
|
|
1416
1416
|
n && a ? [{ op: x.Replace, path: [], value: e[0] }] : n,
|
|
1417
1417
|
r && a ? [{ op: x.Replace, path: [], value: u }] : r
|
|
@@ -1460,12 +1460,12 @@ function Ir(t) {
|
|
|
1460
1460
|
const n = A(t);
|
|
1461
1461
|
if (!ee(t, n == null ? void 0 : n.options))
|
|
1462
1462
|
return t;
|
|
1463
|
-
const r =
|
|
1463
|
+
const r = me(t);
|
|
1464
1464
|
if (n && !n.operated)
|
|
1465
1465
|
return n.original;
|
|
1466
1466
|
let i;
|
|
1467
1467
|
function s() {
|
|
1468
|
-
i = r === 2 ? nn(t) ? new Map(t) : new (Object.getPrototypeOf(t)).constructor(t) : r === 3 ? Array.from(n.setMap.values()) :
|
|
1468
|
+
i = r === 2 ? nn(t) ? new Map(t) : new (Object.getPrototypeOf(t)).constructor(t) : r === 3 ? Array.from(n.setMap.values()) : kr(t, n == null ? void 0 : n.options);
|
|
1469
1469
|
}
|
|
1470
1470
|
if (n) {
|
|
1471
1471
|
n.finalized = !0;
|
|
@@ -1488,28 +1488,28 @@ function Ir(t) {
|
|
|
1488
1488
|
return i;
|
|
1489
1489
|
}
|
|
1490
1490
|
function zn(t) {
|
|
1491
|
-
if (!
|
|
1491
|
+
if (!Te(t))
|
|
1492
1492
|
throw new Error(`current() is only used for Draft, parameter: ${t}`);
|
|
1493
1493
|
return Ir(t);
|
|
1494
1494
|
}
|
|
1495
1495
|
const ts = (t) => function e(n, r, i) {
|
|
1496
1496
|
var s, o, u;
|
|
1497
1497
|
if (typeof n == "function" && typeof r != "function")
|
|
1498
|
-
return function(
|
|
1499
|
-
return e(
|
|
1498
|
+
return function(S, ...I) {
|
|
1499
|
+
return e(S, (R) => n.call(this, R, ...I), r);
|
|
1500
1500
|
};
|
|
1501
1501
|
const a = n, d = r;
|
|
1502
1502
|
let c = i;
|
|
1503
1503
|
if (typeof r != "function" && (c = r), c !== void 0 && Object.prototype.toString.call(c) !== "[object Object]")
|
|
1504
1504
|
throw new Error(`Invalid options: ${c}, 'options' should be an object.`);
|
|
1505
1505
|
c = Object.assign(Object.assign({}, t), c);
|
|
1506
|
-
const f =
|
|
1506
|
+
const f = Te(a) ? zn(a) : a, l = Array.isArray(c.mark) ? (S, I) => {
|
|
1507
1507
|
for (const R of c.mark) {
|
|
1508
1508
|
if (typeof R != "function")
|
|
1509
1509
|
throw new Error(`Invalid mark: ${R}, 'mark' should be a function.`);
|
|
1510
|
-
const
|
|
1511
|
-
if (
|
|
1512
|
-
return
|
|
1510
|
+
const q = R(S, I);
|
|
1511
|
+
if (q)
|
|
1512
|
+
return q;
|
|
1513
1513
|
}
|
|
1514
1514
|
} : c.mark, p = (s = c.enablePatches) !== null && s !== void 0 ? s : !1, y = (o = c.strict) !== null && o !== void 0 ? o : !1, g = {
|
|
1515
1515
|
enableAutoFreeze: (u = c.enableAutoFreeze) !== null && u !== void 0 ? u : !1,
|
|
@@ -1519,48 +1519,48 @@ const ts = (t) => function e(n, r, i) {
|
|
|
1519
1519
|
};
|
|
1520
1520
|
if (!ee(f, g) && typeof f == "object" && f !== null)
|
|
1521
1521
|
throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");
|
|
1522
|
-
const [
|
|
1522
|
+
const [m, T] = es(f, g);
|
|
1523
1523
|
if (typeof r != "function") {
|
|
1524
1524
|
if (!ee(f, g))
|
|
1525
1525
|
throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");
|
|
1526
|
-
return [
|
|
1526
|
+
return [m, T];
|
|
1527
1527
|
}
|
|
1528
1528
|
let v;
|
|
1529
1529
|
try {
|
|
1530
|
-
v = d(
|
|
1531
|
-
} catch (
|
|
1532
|
-
throw Dt(A(
|
|
1533
|
-
}
|
|
1534
|
-
const
|
|
1535
|
-
const I = A(
|
|
1536
|
-
if (!
|
|
1537
|
-
if (
|
|
1530
|
+
v = d(m);
|
|
1531
|
+
} catch (S) {
|
|
1532
|
+
throw Dt(A(m)), S;
|
|
1533
|
+
}
|
|
1534
|
+
const j = (S) => {
|
|
1535
|
+
const I = A(m);
|
|
1536
|
+
if (!Te(S)) {
|
|
1537
|
+
if (S !== void 0 && !ae(S, m) && (I != null && I.operated))
|
|
1538
1538
|
throw new Error("Either the value is returned as a new non-draft value, or only the draft is modified without returning any value.");
|
|
1539
|
-
const
|
|
1540
|
-
if (
|
|
1541
|
-
const
|
|
1542
|
-
return g.strict && typeof
|
|
1539
|
+
const q = S == null ? void 0 : S[zi];
|
|
1540
|
+
if (q) {
|
|
1541
|
+
const Ie = q[0];
|
|
1542
|
+
return g.strict && typeof S == "object" && S !== null && Nt({
|
|
1543
1543
|
rootDraft: I,
|
|
1544
|
-
value:
|
|
1544
|
+
value: S,
|
|
1545
1545
|
useRawReturn: !0
|
|
1546
|
-
}),
|
|
1546
|
+
}), T([Ie]);
|
|
1547
1547
|
}
|
|
1548
|
-
if (
|
|
1549
|
-
return typeof
|
|
1548
|
+
if (S !== void 0)
|
|
1549
|
+
return typeof S == "object" && S !== null && Nt({ rootDraft: I, value: S }), T([S]);
|
|
1550
1550
|
}
|
|
1551
|
-
if (
|
|
1552
|
-
return
|
|
1553
|
-
const R = A(
|
|
1551
|
+
if (S === m || S === void 0)
|
|
1552
|
+
return T([]);
|
|
1553
|
+
const R = A(S);
|
|
1554
1554
|
if (g === R.options) {
|
|
1555
1555
|
if (R.operated)
|
|
1556
1556
|
throw new Error("Cannot return a modified child draft.");
|
|
1557
|
-
return
|
|
1557
|
+
return T([zn(S)]);
|
|
1558
1558
|
}
|
|
1559
|
-
return
|
|
1559
|
+
return T([S]);
|
|
1560
1560
|
};
|
|
1561
|
-
return v instanceof Promise ? v.then(
|
|
1562
|
-
throw Dt(A(
|
|
1563
|
-
}) :
|
|
1561
|
+
return v instanceof Promise ? v.then(j, (S) => {
|
|
1562
|
+
throw Dt(A(m)), S;
|
|
1563
|
+
}) : j(v);
|
|
1564
1564
|
}, ft = ts();
|
|
1565
1565
|
Object.prototype.constructor.toString();
|
|
1566
1566
|
function Mr(t, e) {
|
|
@@ -1960,10 +1960,10 @@ function cn(t) {
|
|
|
1960
1960
|
function dn(t) {
|
|
1961
1961
|
return t["value-type"] === "blob";
|
|
1962
1962
|
}
|
|
1963
|
-
function
|
|
1963
|
+
function je(t, e) {
|
|
1964
1964
|
return t[e];
|
|
1965
1965
|
}
|
|
1966
|
-
function
|
|
1966
|
+
function Ce(t, e) {
|
|
1967
1967
|
return e.reduce((n, r) => n && n.get(r), t);
|
|
1968
1968
|
}
|
|
1969
1969
|
function X(t, e) {
|
|
@@ -1991,7 +1991,7 @@ function xr(t, e, n) {
|
|
|
1991
1991
|
const r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map();
|
|
1992
1992
|
for (const o of e) {
|
|
1993
1993
|
let [u, a, d, c] = o;
|
|
1994
|
-
const f =
|
|
1994
|
+
const f = je(t, a);
|
|
1995
1995
|
if (!f) {
|
|
1996
1996
|
console.warn("no such attr", u, t);
|
|
1997
1997
|
continue;
|
|
@@ -2025,7 +2025,7 @@ function Lr(t) {
|
|
|
2025
2025
|
return at(t.attrs, t.triples, t.cardinalityInference, t.linkIndex, t.useDateObjects);
|
|
2026
2026
|
}
|
|
2027
2027
|
function ws(t, e) {
|
|
2028
|
-
return
|
|
2028
|
+
return Ce(t.eav, [e]) !== void 0;
|
|
2029
2029
|
}
|
|
2030
2030
|
function fn(t) {
|
|
2031
2031
|
t.attrIndexes = Dr(t.attrs);
|
|
@@ -2065,14 +2065,14 @@ function Fr(t, e) {
|
|
|
2065
2065
|
const n = Be(t, e);
|
|
2066
2066
|
if (!n)
|
|
2067
2067
|
return;
|
|
2068
|
-
const [r, i, s] = n, o =
|
|
2068
|
+
const [r, i, s] = n, o = je(t.attrs, i);
|
|
2069
2069
|
o && (X(t.eav, [r, i, s]), X(t.aev, [i, r, s]), cn(o) && X(t.vae, [s, i, r]));
|
|
2070
2070
|
}
|
|
2071
2071
|
let vs = 0;
|
|
2072
2072
|
function Nr(t, e, n) {
|
|
2073
2073
|
const [r, i, s] = n;
|
|
2074
2074
|
let o;
|
|
2075
|
-
const u =
|
|
2075
|
+
const u = Ce(t.ea, [r, i, s]);
|
|
2076
2076
|
return u && (o = u[3]), o || Date.now() * 10 + vs++;
|
|
2077
2077
|
}
|
|
2078
2078
|
function Kr(t, e) {
|
|
@@ -2081,11 +2081,11 @@ function Kr(t, e) {
|
|
|
2081
2081
|
if (!r)
|
|
2082
2082
|
return;
|
|
2083
2083
|
let [i, s, o] = r;
|
|
2084
|
-
const u =
|
|
2084
|
+
const u = je(t.attrs, s);
|
|
2085
2085
|
if (!u)
|
|
2086
2086
|
return;
|
|
2087
2087
|
u["checked-data-type"] === "date" && t.useDateObjects && (o = pt(o));
|
|
2088
|
-
const a =
|
|
2088
|
+
const a = Ce(t.eav, [i, s, o]), d = (n = a == null ? void 0 : a[3]) !== null && n !== void 0 ? n : Nr(t, u, r), c = [i, s, o, d];
|
|
2089
2089
|
ms(u) ? (B(t.eav, [i, s], /* @__PURE__ */ new Map([[o, c]])), B(t.aev, [s, i], /* @__PURE__ */ new Map([[o, c]]))) : (B(t.eav, [i, s, o], c), B(t.aev, [s, i, o], c)), cn(u) && B(t.vae, [o, s, i], c);
|
|
2090
2090
|
}
|
|
2091
2091
|
function Ss(t, e) {
|
|
@@ -2093,12 +2093,12 @@ function Ss(t, e) {
|
|
|
2093
2093
|
const r = Be(t, e);
|
|
2094
2094
|
if (!r)
|
|
2095
2095
|
return;
|
|
2096
|
-
const [i, s, o] = r, u =
|
|
2096
|
+
const [i, s, o] = r, u = je(t.attrs, s);
|
|
2097
2097
|
if (!u)
|
|
2098
2098
|
return;
|
|
2099
2099
|
if (!dn(u))
|
|
2100
2100
|
throw new Error("merge operation is not supported for links");
|
|
2101
|
-
const a =
|
|
2101
|
+
const a = Ce(t.eav, [i, s]);
|
|
2102
2102
|
if (!a)
|
|
2103
2103
|
return;
|
|
2104
2104
|
const d = (n = a.values().next()) === null || n === void 0 ? void 0 : n.value;
|
|
@@ -2135,8 +2135,8 @@ function qt(t, e) {
|
|
|
2135
2135
|
const d = t.vae.get(u) && G(t.vae.get(u), 2);
|
|
2136
2136
|
d && d.forEach((c) => {
|
|
2137
2137
|
var f, l, p;
|
|
2138
|
-
const [y, b, g] = c,
|
|
2139
|
-
(!s || !
|
|
2138
|
+
const [y, b, g] = c, m = t.attrs[b];
|
|
2139
|
+
(!s || !m || ((f = m["reverse-identity"]) === null || f === void 0 ? void 0 : f[1]) === s) && (X(t.eav, [y, b, g]), X(t.aev, [b, y, g]), X(t.vae, [g, b, y])), m && m["on-delete"] === "cascade" && ((l = m["reverse-identity"]) === null || l === void 0 ? void 0 : l[1]) === s && qt(t, [y, (p = m["forward-identity"]) === null || p === void 0 ? void 0 : p[1]]);
|
|
2140
2140
|
}), ((r = t.vae.get(u)) === null || r === void 0 ? void 0 : r.size) === 0 && X(t.vae, [u]);
|
|
2141
2141
|
}
|
|
2142
2142
|
function qr(t, e) {
|
|
@@ -2161,7 +2161,7 @@ function As(t, [e]) {
|
|
|
2161
2161
|
const n = t.attrs[e.id];
|
|
2162
2162
|
n && (t.attrs[e.id] = Object.assign(Object.assign({}, n), e), fn(t), qr(t, zr(t)));
|
|
2163
2163
|
}
|
|
2164
|
-
function
|
|
2164
|
+
function ks(t, e) {
|
|
2165
2165
|
const [n, ...r] = e;
|
|
2166
2166
|
switch (n) {
|
|
2167
2167
|
case "add-triple":
|
|
@@ -2238,13 +2238,13 @@ function tt(t, e, n) {
|
|
|
2238
2238
|
}
|
|
2239
2239
|
return s;
|
|
2240
2240
|
}
|
|
2241
|
-
function
|
|
2241
|
+
function js(t, e, n) {
|
|
2242
2242
|
let r = "";
|
|
2243
2243
|
return t !== void 0 && (r += "e"), e !== void 0 && (r += "a"), n !== void 0 && (r += "v"), r;
|
|
2244
2244
|
}
|
|
2245
2245
|
function Cs(t, [e, n, r]) {
|
|
2246
2246
|
var i, s;
|
|
2247
|
-
switch (
|
|
2247
|
+
switch (js(e, n, r)) {
|
|
2248
2248
|
case "e": {
|
|
2249
2249
|
const u = t.eav.get(e);
|
|
2250
2250
|
return G(u, 2);
|
|
@@ -2321,8 +2321,8 @@ function Ms(t, e) {
|
|
|
2321
2321
|
if (!n)
|
|
2322
2322
|
return;
|
|
2323
2323
|
const [r, i, s] = n;
|
|
2324
|
-
if (
|
|
2325
|
-
return
|
|
2324
|
+
if (je(t.attrs, i))
|
|
2325
|
+
return Ce(t.eav, [r, i]);
|
|
2326
2326
|
}
|
|
2327
2327
|
function Rs(t, e) {
|
|
2328
2328
|
const n = e.filter(([r, i, s, o, u]) => {
|
|
@@ -2332,7 +2332,7 @@ function Rs(t, e) {
|
|
|
2332
2332
|
if (a !== "create" && a !== "update")
|
|
2333
2333
|
return !0;
|
|
2334
2334
|
let d = !1;
|
|
2335
|
-
const c =
|
|
2335
|
+
const c = je(t.attrs, s);
|
|
2336
2336
|
if (c) {
|
|
2337
2337
|
const f = Wr(t, c["forward-identity"][1]);
|
|
2338
2338
|
d = !!Ms(t, [i, f.id, i]);
|
|
@@ -2341,7 +2341,7 @@ function Rs(t, e) {
|
|
|
2341
2341
|
});
|
|
2342
2342
|
return ft(t, (r) => {
|
|
2343
2343
|
n.forEach((i) => {
|
|
2344
|
-
|
|
2344
|
+
ks(r, i);
|
|
2345
2345
|
});
|
|
2346
2346
|
});
|
|
2347
2347
|
}
|
|
@@ -2408,24 +2408,24 @@ function zs(t, e, n) {
|
|
|
2408
2408
|
return Cs(t, ln(n, e));
|
|
2409
2409
|
}
|
|
2410
2410
|
const Vs = /^(?:[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;
|
|
2411
|
-
function
|
|
2411
|
+
function Ee(t) {
|
|
2412
2412
|
return typeof t == "string" && Vs.test(t);
|
|
2413
2413
|
}
|
|
2414
|
-
const
|
|
2414
|
+
const F = [];
|
|
2415
2415
|
for (let t = 0; t < 256; ++t)
|
|
2416
|
-
|
|
2416
|
+
F.push((t + 256).toString(16).slice(1));
|
|
2417
2417
|
function Ws(t, e = 0) {
|
|
2418
|
-
return (
|
|
2418
|
+
return (F[t[e + 0]] + F[t[e + 1]] + F[t[e + 2]] + F[t[e + 3]] + "-" + F[t[e + 4]] + F[t[e + 5]] + "-" + F[t[e + 6]] + F[t[e + 7]] + "-" + F[t[e + 8]] + F[t[e + 9]] + "-" + F[t[e + 10]] + F[t[e + 11]] + F[t[e + 12]] + F[t[e + 13]] + F[t[e + 14]] + F[t[e + 15]]).toLowerCase();
|
|
2419
2419
|
}
|
|
2420
|
-
let
|
|
2420
|
+
let jt;
|
|
2421
2421
|
const Bs = new Uint8Array(16);
|
|
2422
2422
|
function Gs() {
|
|
2423
|
-
if (!
|
|
2423
|
+
if (!jt) {
|
|
2424
2424
|
if (typeof crypto > "u" || !crypto.getRandomValues)
|
|
2425
2425
|
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
2426
|
-
|
|
2426
|
+
jt = crypto.getRandomValues.bind(crypto);
|
|
2427
2427
|
}
|
|
2428
|
-
return
|
|
2428
|
+
return jt(Bs);
|
|
2429
2429
|
}
|
|
2430
2430
|
const Qs = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), Qn = { randomUUID: Qs };
|
|
2431
2431
|
function Hs(t, e, n) {
|
|
@@ -2479,7 +2479,7 @@ function Ke(t) {
|
|
|
2479
2479
|
function yt(t, e) {
|
|
2480
2480
|
return `?${t}-${e}`;
|
|
2481
2481
|
}
|
|
2482
|
-
class
|
|
2482
|
+
class Ae extends Error {
|
|
2483
2483
|
constructor(e) {
|
|
2484
2484
|
super(e), this.name = "AttrNotFoundError";
|
|
2485
2485
|
}
|
|
@@ -2487,7 +2487,7 @@ class je extends Error {
|
|
|
2487
2487
|
function no(t, e) {
|
|
2488
2488
|
const n = Wr(t, e);
|
|
2489
2489
|
if (!n)
|
|
2490
|
-
throw new
|
|
2490
|
+
throw new Ae(`Could not find id attr for ${e}`);
|
|
2491
2491
|
return n;
|
|
2492
2492
|
}
|
|
2493
2493
|
function Yn(t, e, n, r) {
|
|
@@ -2507,7 +2507,7 @@ function io(t, e, n) {
|
|
|
2507
2507
|
function Gr(t, e, n, r, i) {
|
|
2508
2508
|
const s = fe(e, n, i), o = Vr(e, n, i), u = s || o;
|
|
2509
2509
|
if (!u)
|
|
2510
|
-
throw new
|
|
2510
|
+
throw new Ae(`Could not find attr for ${[n, i]}`);
|
|
2511
2511
|
if (u["value-type"] !== "ref")
|
|
2512
2512
|
throw new Error(`Attr ${u.id} is not a ref`);
|
|
2513
2513
|
const [a, d] = u["forward-identity"], [c, f] = u["reverse-identity"], l = r + 1, p = s ? [
|
|
@@ -2596,11 +2596,11 @@ function so(t, e) {
|
|
|
2596
2596
|
function oo(t, e, n, r, i, s) {
|
|
2597
2597
|
const o = fe(e, n, i), u = Vr(e, n, i), a = o || u;
|
|
2598
2598
|
if (!a)
|
|
2599
|
-
throw new
|
|
2599
|
+
throw new Ae(`No attr for etype = ${n} label = ${i}`);
|
|
2600
2600
|
if (s != null && s.hasOwnProperty("$isNull")) {
|
|
2601
2601
|
const d = fe(e, n, "id");
|
|
2602
2602
|
if (!d)
|
|
2603
|
-
throw new
|
|
2603
|
+
throw new Ae(`No attr for etype = ${n} label = id`);
|
|
2604
2604
|
return [
|
|
2605
2605
|
t(n, r),
|
|
2606
2606
|
d.id,
|
|
@@ -2705,17 +2705,17 @@ function _o(t, e, { etype: n, level: r, form: i }, s) {
|
|
|
2705
2705
|
var p, y, b;
|
|
2706
2706
|
const g = !!(e.cardinalityInference && (!((b = (y = (p = e.linkIndex) === null || p === void 0 ? void 0 : p[n]) === null || y === void 0 ? void 0 : y[l]) === null || b === void 0) && b.isSingular));
|
|
2707
2707
|
try {
|
|
2708
|
-
const [
|
|
2709
|
-
etype:
|
|
2710
|
-
level:
|
|
2708
|
+
const [m, T, v] = bo(t, e, n, r, l, a), j = Yr(e, {
|
|
2709
|
+
etype: m,
|
|
2710
|
+
level: T,
|
|
2711
2711
|
form: i[l],
|
|
2712
2712
|
join: v
|
|
2713
|
-
}),
|
|
2714
|
-
return { [l]:
|
|
2715
|
-
} catch (
|
|
2716
|
-
if (
|
|
2713
|
+
}), S = g ? j[0] : j;
|
|
2714
|
+
return { [l]: S };
|
|
2715
|
+
} catch (m) {
|
|
2716
|
+
if (m instanceof Ae)
|
|
2717
2717
|
return { [l]: g ? void 0 : [] };
|
|
2718
|
-
throw
|
|
2718
|
+
throw m;
|
|
2719
2719
|
}
|
|
2720
2720
|
}).reduce(function(l, p) {
|
|
2721
2721
|
return Object.assign(Object.assign({}, l), p);
|
|
@@ -2778,16 +2778,16 @@ function Oo(t, { etype: e, pageInfo: n, dq: r, form: i }) {
|
|
|
2778
2778
|
const f = n == null ? void 0 : n["start-cursor"], l = vo(t, e, f, u);
|
|
2779
2779
|
if (l && ((o = l == null ? void 0 : l["forward-identity"]) === null || o === void 0 ? void 0 : o[2]) !== "id") {
|
|
2780
2780
|
const b = l["checked-data-type"] === "date", g = l.id;
|
|
2781
|
-
c = c.map(([
|
|
2782
|
-
var
|
|
2783
|
-
let R = (I = (
|
|
2784
|
-
return b && (R = Wt(R)), [
|
|
2781
|
+
c = c.map(([m]) => {
|
|
2782
|
+
var T, v, j, S, I;
|
|
2783
|
+
let R = (I = (S = (j = (v = (T = t.eav.get(m)) === null || T === void 0 ? void 0 : T.get(g)) === null || v === void 0 ? void 0 : v.values()) === null || j === void 0 ? void 0 : j.next()) === null || S === void 0 ? void 0 : S.value) === null || I === void 0 ? void 0 : I[2];
|
|
2784
|
+
return b && (R = Wt(R)), [m, R];
|
|
2785
2785
|
});
|
|
2786
2786
|
}
|
|
2787
|
-
c.sort(d === "asc" ? function(g,
|
|
2788
|
-
return lt(g,
|
|
2789
|
-
} : function(g,
|
|
2790
|
-
return lt(
|
|
2787
|
+
c.sort(d === "asc" ? function(g, m) {
|
|
2788
|
+
return lt(g, m, l == null ? void 0 : l["checked-data-type"]);
|
|
2789
|
+
} : function(g, m) {
|
|
2790
|
+
return lt(m, g, l == null ? void 0 : l["checked-data-type"]);
|
|
2791
2791
|
});
|
|
2792
2792
|
let p = {};
|
|
2793
2793
|
const y = So(t, e, r);
|
|
@@ -2795,8 +2795,8 @@ function Oo(t, { etype: e, pageInfo: n, dq: r, form: i }) {
|
|
|
2795
2795
|
const [g] = b;
|
|
2796
2796
|
if (p[g] || !a && f && l && To(f, l, d, b))
|
|
2797
2797
|
continue;
|
|
2798
|
-
const
|
|
2799
|
-
|
|
2798
|
+
const m = Ps(t, y, g);
|
|
2799
|
+
m && (p[g] = m);
|
|
2800
2800
|
}
|
|
2801
2801
|
return p;
|
|
2802
2802
|
}
|
|
@@ -2827,20 +2827,20 @@ function Ao(t, { etype: e, level: n, form: r, join: i, pageInfo: s }) {
|
|
|
2827
2827
|
}
|
|
2828
2828
|
return y;
|
|
2829
2829
|
}
|
|
2830
|
-
function
|
|
2830
|
+
function ko(t, e) {
|
|
2831
2831
|
try {
|
|
2832
2832
|
return Ao(t, e);
|
|
2833
2833
|
} catch (n) {
|
|
2834
|
-
if (n instanceof
|
|
2834
|
+
if (n instanceof Ae)
|
|
2835
2835
|
return {};
|
|
2836
2836
|
throw n;
|
|
2837
2837
|
}
|
|
2838
2838
|
}
|
|
2839
2839
|
function Yr(t, e) {
|
|
2840
|
-
const n =
|
|
2840
|
+
const n = ko(t, e);
|
|
2841
2841
|
return _o(yt, t, e, n);
|
|
2842
2842
|
}
|
|
2843
|
-
function
|
|
2843
|
+
function jo(t) {
|
|
2844
2844
|
const e = {};
|
|
2845
2845
|
for (const [n, r] of Object.entries(t))
|
|
2846
2846
|
e[n] = {
|
|
@@ -2860,7 +2860,7 @@ function Jr({ store: t, pageInfo: e, aggregate: n }, r) {
|
|
|
2860
2860
|
pageInfo: e == null ? void 0 : e[a]
|
|
2861
2861
|
})), u;
|
|
2862
2862
|
}, {}) };
|
|
2863
|
-
return e && (s.pageInfo =
|
|
2863
|
+
return e && (s.pageInfo = jo(e)), n && (s.aggregate = n), s;
|
|
2864
2864
|
}
|
|
2865
2865
|
function Co() {
|
|
2866
2866
|
const e = {
|
|
@@ -2945,13 +2945,13 @@ function Ro(t, e) {
|
|
|
2945
2945
|
}
|
|
2946
2946
|
return i;
|
|
2947
2947
|
}
|
|
2948
|
-
function
|
|
2948
|
+
function K(t, e, n) {
|
|
2949
2949
|
return Object.values(t).find((r) => {
|
|
2950
2950
|
const [i, s, o] = r["forward-identity"];
|
|
2951
2951
|
return s === e && o === n;
|
|
2952
2952
|
});
|
|
2953
2953
|
}
|
|
2954
|
-
function
|
|
2954
|
+
function _e(t, e, n) {
|
|
2955
2955
|
return Object.values(t).find((r) => {
|
|
2956
2956
|
const i = r["reverse-identity"];
|
|
2957
2957
|
if (!i)
|
|
@@ -2971,7 +2971,7 @@ function $o(t) {
|
|
|
2971
2971
|
function Gt(t, e, n) {
|
|
2972
2972
|
return n.indexOf(".") !== -1 && // attr names can have `.` in them, so use the attr we find with a `.`
|
|
2973
2973
|
// before assuming it's a ref lookup.
|
|
2974
|
-
!
|
|
2974
|
+
!K(t, e, n);
|
|
2975
2975
|
}
|
|
2976
2976
|
function Qt(t) {
|
|
2977
2977
|
const [e, n, ...r] = t.split(".");
|
|
@@ -2981,8 +2981,8 @@ function Qt(t) {
|
|
|
2981
2981
|
}
|
|
2982
2982
|
function xo(t, e, n) {
|
|
2983
2983
|
if (!Gt(t, e, n))
|
|
2984
|
-
return
|
|
2985
|
-
const r = Qt(n), i =
|
|
2984
|
+
return K(t, e, n);
|
|
2985
|
+
const r = Qt(n), i = K(t, e, r) || _e(t, e, r);
|
|
2986
2986
|
if (i && i["value-type"] !== "ref")
|
|
2987
2987
|
throw new Error(`${n} does not reference a valid link attribute.`);
|
|
2988
2988
|
return i;
|
|
@@ -3004,13 +3004,13 @@ function Xr(t, e, n, r) {
|
|
|
3004
3004
|
return Array.isArray(i) ? [[
|
|
3005
3005
|
"add-triple",
|
|
3006
3006
|
i,
|
|
3007
|
-
|
|
3007
|
+
K(t, e, "id").id,
|
|
3008
3008
|
i
|
|
3009
3009
|
]].concat(r) : r;
|
|
3010
3010
|
}
|
|
3011
3011
|
function Do({ attrs: t }, [e, n, r]) {
|
|
3012
3012
|
const i = Object.entries(r).flatMap(([s, o]) => {
|
|
3013
|
-
const u = Array.isArray(o) ? o : [o], a =
|
|
3013
|
+
const u = Array.isArray(o) ? o : [o], a = K(t, e, s), d = _e(t, e, s);
|
|
3014
3014
|
return u.map((c) => a ? [
|
|
3015
3015
|
"add-triple",
|
|
3016
3016
|
Q(t, e, n),
|
|
@@ -3027,7 +3027,7 @@ function Do({ attrs: t }, [e, n, r]) {
|
|
|
3027
3027
|
}
|
|
3028
3028
|
function Uo({ attrs: t }, [e, n, r]) {
|
|
3029
3029
|
const i = Object.entries(r).flatMap(([s, o]) => {
|
|
3030
|
-
const u = Array.isArray(o) ? o : [o], a =
|
|
3030
|
+
const u = Array.isArray(o) ? o : [o], a = K(t, e, s), d = _e(t, e, s);
|
|
3031
3031
|
return u.map((c) => a ? [
|
|
3032
3032
|
"retract-triple",
|
|
3033
3033
|
Q(t, e, n),
|
|
@@ -3070,14 +3070,14 @@ function ei({ stores: t, attrs: e }, [n, r, i, s]) {
|
|
|
3070
3070
|
function Fo(t, e) {
|
|
3071
3071
|
const { stores: n, attrs: r } = t, [i, s, o, u] = e, a = an(o), d = Q(r, i, s);
|
|
3072
3072
|
return [["id", d]].concat(Object.entries(a)).map(([f, l]) => {
|
|
3073
|
-
const p =
|
|
3073
|
+
const p = K(r, i, f);
|
|
3074
3074
|
return p["checked-data-type"] === "date" && t.useDateObjects && (l = pt(l)), ["add-triple", d, p.id, l, { mode: "create" }];
|
|
3075
3075
|
});
|
|
3076
3076
|
}
|
|
3077
3077
|
function No(t, e) {
|
|
3078
3078
|
const { stores: n, attrs: r } = t, [i, s, o, u] = e, a = an(o), d = Q(r, i, s), c = ei(t, [i, d, o, u]);
|
|
3079
3079
|
return [["id", d]].concat(Object.entries(a)).map(([l, p]) => {
|
|
3080
|
-
const y =
|
|
3080
|
+
const y = K(r, i, l);
|
|
3081
3081
|
return y["checked-data-type"] === "date" && t.useDateObjects && (p = pt(p)), [
|
|
3082
3082
|
"add-triple",
|
|
3083
3083
|
d,
|
|
@@ -3092,7 +3092,7 @@ function Ko({ attrs: t }, [e, n]) {
|
|
|
3092
3092
|
}
|
|
3093
3093
|
function qo(t, e) {
|
|
3094
3094
|
const { stores: n, attrs: r } = t, [i, s, o, u] = e, a = an(o), d = Q(r, i, s), c = ei(t, [i, d, o, u]), f = Object.entries(a).map(([p, y]) => {
|
|
3095
|
-
const b =
|
|
3095
|
+
const b = K(r, i, p);
|
|
3096
3096
|
return [
|
|
3097
3097
|
"deep-merge-triple",
|
|
3098
3098
|
d,
|
|
@@ -3104,7 +3104,7 @@ function qo(t, e) {
|
|
|
3104
3104
|
return [[
|
|
3105
3105
|
"add-triple",
|
|
3106
3106
|
d,
|
|
3107
|
-
|
|
3107
|
+
K(r, i, "id").id,
|
|
3108
3108
|
d,
|
|
3109
3109
|
...c ? [c] : []
|
|
3110
3110
|
]].concat(f);
|
|
@@ -3228,7 +3228,7 @@ function nu({ attrs: t, schema: e }, n) {
|
|
|
3228
3228
|
f != null && f.isUnsynced && !s.has(f.id) && (u.push(["add-attr", f]), s.add(f.id));
|
|
3229
3229
|
}
|
|
3230
3230
|
function c(f, l) {
|
|
3231
|
-
const p =
|
|
3231
|
+
const p = K(o, f, l), y = _e(o, f, l);
|
|
3232
3232
|
d(p), d(y), !p && !y && a(er(e, f, l, eu));
|
|
3233
3233
|
}
|
|
3234
3234
|
for (const f of n)
|
|
@@ -3236,32 +3236,32 @@ function nu({ attrs: t, schema: e }, n) {
|
|
|
3236
3236
|
const b = p[0];
|
|
3237
3237
|
if (y) {
|
|
3238
3238
|
c(l, y);
|
|
3239
|
-
const g =
|
|
3240
|
-
d(g), d(
|
|
3241
|
-
const
|
|
3242
|
-
if (Gt(o,
|
|
3243
|
-
c(
|
|
3239
|
+
const g = K(o, l, y), m = _e(o, l, y);
|
|
3240
|
+
d(g), d(m);
|
|
3241
|
+
const T = ((r = g == null ? void 0 : g["reverse-identity"]) === null || r === void 0 ? void 0 : r[1]) || ((i = m == null ? void 0 : m["forward-identity"]) === null || i === void 0 ? void 0 : i[1]) || y;
|
|
3242
|
+
if (Gt(o, T, b))
|
|
3243
|
+
c(T, Qt(b));
|
|
3244
3244
|
else {
|
|
3245
|
-
const v =
|
|
3246
|
-
v || a(nt(e,
|
|
3245
|
+
const v = K(o, T, b);
|
|
3246
|
+
v || a(nt(e, T, b, Yt)), d(v);
|
|
3247
3247
|
}
|
|
3248
3248
|
} else if (Gt(o, l, b))
|
|
3249
3249
|
c(l, Qt(b));
|
|
3250
3250
|
else {
|
|
3251
|
-
const g =
|
|
3251
|
+
const g = K(o, l, b);
|
|
3252
3252
|
g || a(nt(e, l, b, Yt)), d(g);
|
|
3253
3253
|
}
|
|
3254
3254
|
}
|
|
3255
3255
|
for (const f of n) {
|
|
3256
3256
|
const [l, p, y, b] = f;
|
|
3257
3257
|
if (Yo.has(l)) {
|
|
3258
|
-
const g =
|
|
3258
|
+
const g = K(o, p, "id");
|
|
3259
3259
|
d(g), g || a(nt(e, p, "id", { "unique?": !0 }));
|
|
3260
|
-
for (const
|
|
3261
|
-
const
|
|
3262
|
-
if (d(
|
|
3263
|
-
const v =
|
|
3264
|
-
!
|
|
3260
|
+
for (const m of Object.keys(b)) {
|
|
3261
|
+
const T = K(o, p, m);
|
|
3262
|
+
if (d(T), Zo.has(l) && (T || a(nt(e, p, m, m === "id" ? { "unique?": !0 } : null))), Jo.has(l)) {
|
|
3263
|
+
const v = _e(o, p, m);
|
|
3264
|
+
!T && !v && a(er(e, p, m)), d(v);
|
|
3265
3265
|
}
|
|
3266
3266
|
}
|
|
3267
3267
|
}
|
|
@@ -3346,7 +3346,10 @@ class Jt {
|
|
|
3346
3346
|
}
|
|
3347
3347
|
_preloadEntries(e) {
|
|
3348
3348
|
return re(this, void 0, void 0, function* () {
|
|
3349
|
-
const n = yield this.waitForMetaToLoad()
|
|
3349
|
+
const n = yield this.waitForMetaToLoad();
|
|
3350
|
+
if (!n)
|
|
3351
|
+
return;
|
|
3352
|
+
const r = Object.entries(n.objects);
|
|
3350
3353
|
r.sort(([i, s], [o, u]) => u.updatedAt - s.updatedAt);
|
|
3351
3354
|
for (const [i] of r.slice(0, e))
|
|
3352
3355
|
this._loadKey(i);
|
|
@@ -3591,7 +3594,8 @@ function au(t) {
|
|
|
3591
3594
|
const s = r.target.result;
|
|
3592
3595
|
e(s);
|
|
3593
3596
|
}, n.onupgradeneeded = (r) => {
|
|
3594
|
-
|
|
3597
|
+
var i;
|
|
3598
|
+
(i = r.target.transaction) === null || i === void 0 || i.abort(), e(null);
|
|
3595
3599
|
};
|
|
3596
3600
|
});
|
|
3597
3601
|
});
|
|
@@ -3611,15 +3615,15 @@ function cu(t, e, n) {
|
|
|
3611
3615
|
for (const [y, b] of Object.entries(r)) {
|
|
3612
3616
|
const g = typeof b == "string" ? JSON.parse(b) : b;
|
|
3613
3617
|
if (g.lastAccessed) {
|
|
3614
|
-
const
|
|
3618
|
+
const T = {
|
|
3615
3619
|
createdAt: g.lastAccessed,
|
|
3616
3620
|
updatedAt: g.lastAccessed,
|
|
3617
3621
|
size: (c = (d = (a = (u = g.result) === null || u === void 0 ? void 0 : u.store) === null || a === void 0 ? void 0 : a.triples) === null || d === void 0 ? void 0 : d.length) !== null && c !== void 0 ? c : 0
|
|
3618
3622
|
};
|
|
3619
|
-
f[y] =
|
|
3623
|
+
f[y] = T;
|
|
3620
3624
|
}
|
|
3621
|
-
const
|
|
3622
|
-
i.add(
|
|
3625
|
+
const m = n.put(g, y);
|
|
3626
|
+
i.add(m);
|
|
3623
3627
|
}
|
|
3624
3628
|
const l = { objects: f }, p = n.put(l, qe);
|
|
3625
3629
|
i.add(p);
|
|
@@ -3654,8 +3658,8 @@ function du(t, e) {
|
|
|
3654
3658
|
y.onsuccess = () => {
|
|
3655
3659
|
const g = y.result;
|
|
3656
3660
|
if (g) {
|
|
3657
|
-
const
|
|
3658
|
-
b.push([
|
|
3661
|
+
const m = g.key, T = g.value;
|
|
3662
|
+
b.push([m, T]), g.continue();
|
|
3659
3663
|
} else
|
|
3660
3664
|
c(b);
|
|
3661
3665
|
}, y.onerror = (g) => {
|
|
@@ -3890,7 +3894,7 @@ function te(t, e) {
|
|
|
3890
3894
|
return n.status === 200 ? Promise.resolve(r) : Promise.reject(new bt({ status: n.status, body: r }));
|
|
3891
3895
|
});
|
|
3892
3896
|
}
|
|
3893
|
-
var
|
|
3897
|
+
var Pe = function(t, e, n, r) {
|
|
3894
3898
|
function i(s) {
|
|
3895
3899
|
return s instanceof n ? s : new n(function(o) {
|
|
3896
3900
|
o(s);
|
|
@@ -3925,7 +3929,7 @@ function hu({ apiURI: t, appId: e, email: n }) {
|
|
|
3925
3929
|
});
|
|
3926
3930
|
}
|
|
3927
3931
|
function pu(t) {
|
|
3928
|
-
return
|
|
3932
|
+
return Pe(this, arguments, void 0, function* ({ apiURI: e, appId: n, email: r, code: i, refreshToken: s }) {
|
|
3929
3933
|
return yield te(`${e}/runtime/auth/verify_magic_code`, {
|
|
3930
3934
|
method: "POST",
|
|
3931
3935
|
headers: { "content-type": "application/json" },
|
|
@@ -3938,7 +3942,7 @@ function pu(t) {
|
|
|
3938
3942
|
});
|
|
3939
3943
|
}
|
|
3940
3944
|
function yu(t) {
|
|
3941
|
-
return
|
|
3945
|
+
return Pe(this, arguments, void 0, function* ({ apiURI: e, appId: n, refreshToken: r }) {
|
|
3942
3946
|
return yield te(`${e}/runtime/auth/verify_refresh_token`, {
|
|
3943
3947
|
method: "POST",
|
|
3944
3948
|
headers: { "content-type": "application/json" },
|
|
@@ -3950,7 +3954,7 @@ function yu(t) {
|
|
|
3950
3954
|
});
|
|
3951
3955
|
}
|
|
3952
3956
|
function bu(t) {
|
|
3953
|
-
return
|
|
3957
|
+
return Pe(this, arguments, void 0, function* ({ apiURI: e, appId: n }) {
|
|
3954
3958
|
return yield te(`${e}/runtime/auth/sign_in_guest`, {
|
|
3955
3959
|
method: "POST",
|
|
3956
3960
|
headers: { "content-type": "application/json" },
|
|
@@ -3961,7 +3965,7 @@ function bu(t) {
|
|
|
3961
3965
|
});
|
|
3962
3966
|
}
|
|
3963
3967
|
function ir(t) {
|
|
3964
|
-
return
|
|
3968
|
+
return Pe(this, arguments, void 0, function* ({ apiURI: e, appId: n, code: r, codeVerifier: i, refreshToken: s }) {
|
|
3965
3969
|
return yield te(`${e}/runtime/oauth/token`, {
|
|
3966
3970
|
method: "POST",
|
|
3967
3971
|
headers: { "content-type": "application/json" },
|
|
@@ -3975,7 +3979,7 @@ function ir(t) {
|
|
|
3975
3979
|
});
|
|
3976
3980
|
}
|
|
3977
3981
|
function _u(t) {
|
|
3978
|
-
return
|
|
3982
|
+
return Pe(this, arguments, void 0, function* ({ apiURI: e, appId: n, nonce: r, idToken: i, clientName: s, refreshToken: o }) {
|
|
3979
3983
|
return yield te(`${e}/runtime/oauth/id_token`, {
|
|
3980
3984
|
method: "POST",
|
|
3981
3985
|
headers: { "content-type": "application/json" },
|
|
@@ -3990,7 +3994,7 @@ function _u(t) {
|
|
|
3990
3994
|
});
|
|
3991
3995
|
}
|
|
3992
3996
|
function gu(t) {
|
|
3993
|
-
return
|
|
3997
|
+
return Pe(this, arguments, void 0, function* ({ apiURI: e, appId: n, refreshToken: r }) {
|
|
3994
3998
|
return yield te(`${e}/runtime/signout`, {
|
|
3995
3999
|
method: "POST",
|
|
3996
4000
|
headers: {
|
|
@@ -4172,7 +4176,7 @@ function ar(t) {
|
|
|
4172
4176
|
}, e;
|
|
4173
4177
|
}, {});
|
|
4174
4178
|
}
|
|
4175
|
-
const oi = "v0.22.
|
|
4179
|
+
const oi = "v0.22.62";
|
|
4176
4180
|
function Au(t, e) {
|
|
4177
4181
|
return {
|
|
4178
4182
|
info: t ? (...n) => console.info(...n, e()) : () => {
|
|
@@ -4222,7 +4226,7 @@ const cr = [
|
|
|
4222
4226
|
"before",
|
|
4223
4227
|
"fields",
|
|
4224
4228
|
"aggregate"
|
|
4225
|
-
],
|
|
4229
|
+
], ku = (t) => t.valueType || "unknown", ui = (t, e, n = !1) => {
|
|
4226
4230
|
if (n || t == null)
|
|
4227
4231
|
return !0;
|
|
4228
4232
|
switch (e) {
|
|
@@ -4237,7 +4241,7 @@ const cr = [
|
|
|
4237
4241
|
default:
|
|
4238
4242
|
return !0;
|
|
4239
4243
|
}
|
|
4240
|
-
},
|
|
4244
|
+
}, ju = (t, e, n, r, i, s, o) => {
|
|
4241
4245
|
const u = s.valueType === "json", a = (d, c, f) => {
|
|
4242
4246
|
if (!ui(f, c, u))
|
|
4243
4247
|
throw new M(`Invalid value for operator '${d}' on attribute '${r}' in entity '${i}'. Expected ${c}, but received: ${typeof f}`, o);
|
|
@@ -4269,14 +4273,14 @@ const cr = [
|
|
|
4269
4273
|
default:
|
|
4270
4274
|
throw new M(`Unknown operator '${t}' for attribute '${r}' in entity '${i}'`, o);
|
|
4271
4275
|
}
|
|
4272
|
-
},
|
|
4273
|
-
const s =
|
|
4276
|
+
}, Oe = (t, e, n, r, i) => {
|
|
4277
|
+
const s = ku(n), o = n.valueType === "json";
|
|
4274
4278
|
if (typeof t == "object" && t !== null && !Array.isArray(t)) {
|
|
4275
4279
|
if (o)
|
|
4276
4280
|
return;
|
|
4277
4281
|
const a = t;
|
|
4278
4282
|
for (const [d, c] of Object.entries(a))
|
|
4279
|
-
|
|
4283
|
+
ju(d, c, s, e, r, n, `${i}.${d}`);
|
|
4280
4284
|
} else if (!ui(t, s, o))
|
|
4281
4285
|
throw new M(`Invalid value for attribute '${e}' in entity '${r}'. Expected ${s}, but received: ${typeof t}`, i);
|
|
4282
4286
|
}, Cu = (t, e, n, r, i) => {
|
|
@@ -4299,23 +4303,23 @@ const cr = [
|
|
|
4299
4303
|
if (!a)
|
|
4300
4304
|
throw new M(`Target entity '${o}' does not exist in schema for dot notation path '${t}'.`, i);
|
|
4301
4305
|
if (u === "id") {
|
|
4302
|
-
if (typeof e == "string" && !
|
|
4306
|
+
if (typeof e == "string" && !Ee(e))
|
|
4303
4307
|
throw new M(`Invalid value for id field in entity '${o}'. Expected a UUID, but received: ${e}`, i);
|
|
4304
|
-
|
|
4308
|
+
Oe(e, t, new ue("string", !1, !0), n, i);
|
|
4305
4309
|
return;
|
|
4306
4310
|
}
|
|
4307
4311
|
const d = a.attrs[u];
|
|
4308
4312
|
if (Object.keys(a.links).includes(u)) {
|
|
4309
|
-
if (typeof e == "string" && !
|
|
4313
|
+
if (typeof e == "string" && !Ee(e))
|
|
4310
4314
|
throw new M(`Invalid value for link '${u}' in entity '${o}'. Expected a UUID, but received: ${e}`, i);
|
|
4311
|
-
|
|
4315
|
+
Oe(e, t, new ue("string", !1, !0), n, i);
|
|
4312
4316
|
return;
|
|
4313
4317
|
}
|
|
4314
4318
|
if (!d) {
|
|
4315
4319
|
const c = Object.keys(a.attrs);
|
|
4316
4320
|
throw new M(`Attribute '${u}' does not exist on entity '${o}' in dot notation path '${t}'. Available attributes: ${c.length > 0 ? c.join(", ") + ", id" : "id"}`, i);
|
|
4317
4321
|
}
|
|
4318
|
-
|
|
4322
|
+
Oe(e, t, d, n, i);
|
|
4319
4323
|
}, ai = (t, e, n, r) => {
|
|
4320
4324
|
for (const [i, s] of Object.entries(t)) {
|
|
4321
4325
|
if (i === "or" || i === "and") {
|
|
@@ -4325,7 +4329,7 @@ const cr = [
|
|
|
4325
4329
|
continue;
|
|
4326
4330
|
}
|
|
4327
4331
|
if (i === "id") {
|
|
4328
|
-
|
|
4332
|
+
Oe(s, "id", new ue("string", !1, !0), e, `${r}.id`);
|
|
4329
4333
|
continue;
|
|
4330
4334
|
}
|
|
4331
4335
|
if (i.includes(".")) {
|
|
@@ -4341,12 +4345,12 @@ const cr = [
|
|
|
4341
4345
|
throw new M(`Attribute or link '${i}' does not exist on entity '${e}'. Available attributes: ${d.length > 0 ? d.join(", ") : "none"}. Available links: ${c.length > 0 ? c.join(", ") : "none"}`, `${r}.${i}`);
|
|
4342
4346
|
}
|
|
4343
4347
|
if (u)
|
|
4344
|
-
|
|
4348
|
+
Oe(s, i, u, e, `${r}.${i}`);
|
|
4345
4349
|
else if (a) {
|
|
4346
|
-
if (typeof s == "string" && !
|
|
4350
|
+
if (typeof s == "string" && !Ee(s))
|
|
4347
4351
|
throw new M(`Invalid value for link '${i}' in entity '${e}'. Expected a UUID, but received: ${s}`, `${r}.${i}`);
|
|
4348
4352
|
const d = new ue("string", !1, !0);
|
|
4349
|
-
|
|
4353
|
+
Oe(s, i, d, e, `${r}.${i}`);
|
|
4350
4354
|
}
|
|
4351
4355
|
}
|
|
4352
4356
|
}, Pu = (t, e, n, r, i = 0) => {
|
|
@@ -4409,7 +4413,7 @@ const cr = [
|
|
|
4409
4413
|
ci(n[r], r, e, r, 0);
|
|
4410
4414
|
}
|
|
4411
4415
|
}
|
|
4412
|
-
}, fr = (t) => typeof t != "string" ? !1 : ht(t) ? !0 :
|
|
4416
|
+
}, fr = (t) => typeof t != "string" ? !1 : ht(t) ? !0 : Ee(t);
|
|
4413
4417
|
class Z extends Error {
|
|
4414
4418
|
constructor(e) {
|
|
4415
4419
|
super(e), this.name = "TransactionValidationError";
|
|
@@ -4470,7 +4474,7 @@ const di = (t) => t.length > 0 ? t.join(", ") : "none", Iu = (t, e) => new Z(`En
|
|
|
4470
4474
|
if (!e)
|
|
4471
4475
|
return;
|
|
4472
4476
|
const [n, r, i, s] = t;
|
|
4473
|
-
if (!Array.isArray(i) && !
|
|
4477
|
+
if (!Array.isArray(i) && !Ee(i))
|
|
4474
4478
|
throw new Z(`Invalid id for entity '${r}'. Expected a UUID, but received: ${i}`);
|
|
4475
4479
|
if (typeof r != "string")
|
|
4476
4480
|
throw new Z(`Entity name must be a string, but received: ${typeof r}`);
|
|
@@ -4673,8 +4677,9 @@ function Lu(t, e) {
|
|
|
4673
4677
|
return e;
|
|
4674
4678
|
}
|
|
4675
4679
|
function Fu(t, e, n) {
|
|
4676
|
-
|
|
4677
|
-
|
|
4680
|
+
var r, i;
|
|
4681
|
+
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;
|
|
4682
|
+
return s && (!o || s > o) ? e : o && (!s || o > s) ? n : e || n;
|
|
4678
4683
|
}
|
|
4679
4684
|
function Pt(t, e) {
|
|
4680
4685
|
return Jr({ store: e, pageInfo: null, aggregate: null }, t.query).data[t.table][0];
|
|
@@ -4684,7 +4689,7 @@ function _r(t, e, n) {
|
|
|
4684
4689
|
const i = (r = fe(e, t.table, "id")) === null || r === void 0 ? void 0 : r.id;
|
|
4685
4690
|
if (!i)
|
|
4686
4691
|
return -1;
|
|
4687
|
-
const s =
|
|
4692
|
+
const s = Ce(e.eav, [n, i, n]);
|
|
4688
4693
|
return s ? s[3] : -1;
|
|
4689
4694
|
}
|
|
4690
4695
|
function gr(t, e) {
|
|
@@ -4717,33 +4722,44 @@ function Nu(t, e) {
|
|
|
4717
4722
|
break;
|
|
4718
4723
|
}
|
|
4719
4724
|
}
|
|
4725
|
+
for (const u of Object.keys(o)) {
|
|
4726
|
+
const { oldValue: a, newValue: d } = o[u];
|
|
4727
|
+
a === d && delete o[u];
|
|
4728
|
+
}
|
|
4720
4729
|
return o;
|
|
4721
4730
|
}
|
|
4722
4731
|
function rt(t, e) {
|
|
4723
4732
|
return { [t.table]: e.map((n) => n.entity) };
|
|
4724
4733
|
}
|
|
4725
4734
|
function Ku(t, e) {
|
|
4726
|
-
|
|
4735
|
+
var n;
|
|
4736
|
+
if (t.orderFieldType)
|
|
4737
|
+
return t.orderFieldType;
|
|
4738
|
+
const r = t.orderField === "serverCreatedAt" ? "number" : (n = fe(e([]), t.table, t.orderField)) === null || n === void 0 ? void 0 : n["checked-data-type"];
|
|
4739
|
+
return t.orderFieldType = r, r;
|
|
4740
|
+
}
|
|
4741
|
+
function qu(t, e, n) {
|
|
4742
|
+
const r = e;
|
|
4727
4743
|
if (t.orderField === "serverCreatedAt") {
|
|
4728
|
-
|
|
4729
|
-
return Fe(
|
|
4730
|
-
} : function(
|
|
4731
|
-
return Fe(
|
|
4744
|
+
n.sort(t.orderDirection === "asc" ? function(o, u) {
|
|
4745
|
+
return Fe(o.entity.id, o.serverCreatedAt, u.entity.id, u.serverCreatedAt, r);
|
|
4746
|
+
} : function(o, u) {
|
|
4747
|
+
return Fe(u.entity.id, u.serverCreatedAt, o.entity.id, o.serverCreatedAt, r);
|
|
4732
4748
|
});
|
|
4733
4749
|
return;
|
|
4734
4750
|
}
|
|
4735
|
-
const
|
|
4736
|
-
|
|
4737
|
-
return Fe(
|
|
4738
|
-
} : function(
|
|
4739
|
-
return Fe(
|
|
4751
|
+
const i = t.orderField;
|
|
4752
|
+
n.sort(t.orderDirection === "asc" ? function(o, u) {
|
|
4753
|
+
return Fe(o.entity.id, o.entity[i], u.entity.id, u.entity[i], r);
|
|
4754
|
+
} : function(o, u) {
|
|
4755
|
+
return Fe(u.entity.id, u.entity[i], o.entity.id, o.entity[i], r);
|
|
4740
4756
|
});
|
|
4741
4757
|
}
|
|
4742
|
-
var
|
|
4758
|
+
var pe;
|
|
4743
4759
|
(function(t) {
|
|
4744
4760
|
t.InitialSyncBatch = "InitialSyncBatch", t.InitialSyncComplete = "InitialSyncComplete", t.LoadFromStorage = "LoadFromStorage", t.SyncTransaction = "SyncTransaction", t.Error = "Error";
|
|
4745
|
-
})(
|
|
4746
|
-
class
|
|
4761
|
+
})(pe || (pe = {}));
|
|
4762
|
+
class zu {
|
|
4747
4763
|
constructor(e, n, r, i, s) {
|
|
4748
4764
|
this.callbacks = {}, this.idToHash = {}, this.trySend = e, this.config = r, this.log = i, this.createStore = s, this.subs = new Jt({
|
|
4749
4765
|
persister: n,
|
|
@@ -4769,7 +4785,7 @@ class qu {
|
|
|
4769
4785
|
this.subs.flush();
|
|
4770
4786
|
}
|
|
4771
4787
|
subscribe(e, n) {
|
|
4772
|
-
const r =
|
|
4788
|
+
const r = N(e);
|
|
4773
4789
|
return this.callbacks[r] = this.callbacks[r] || [], this.callbacks[r].push(n), this.initSubscription(e, r, n), (i) => {
|
|
4774
4790
|
this.unsubscribe(r, n, i == null ? void 0 : i.keepSubscription);
|
|
4775
4791
|
};
|
|
@@ -4779,7 +4795,7 @@ class qu {
|
|
|
4779
4795
|
if (this.callbacks[e] = i, !i.length) {
|
|
4780
4796
|
delete this.callbacks[e];
|
|
4781
4797
|
const s = this.subs.currentValue[e];
|
|
4782
|
-
s != null && s.state && this.clearSubscriptionData(s.state.subscriptionId, r), r || this.subs.updateInPlace((o) => {
|
|
4798
|
+
s != null && s.state && this.clearSubscriptionData(s.state.subscriptionId, !!r), r || this.subs.updateInPlace((o) => {
|
|
4783
4799
|
delete o[e];
|
|
4784
4800
|
});
|
|
4785
4801
|
}
|
|
@@ -4790,11 +4806,11 @@ class qu {
|
|
|
4790
4806
|
q: e
|
|
4791
4807
|
});
|
|
4792
4808
|
}
|
|
4793
|
-
sendResync(e, n) {
|
|
4809
|
+
sendResync(e, n, r) {
|
|
4794
4810
|
this.idToHash[n.subscriptionId] = e.hash, this.trySend(n.subscriptionId, {
|
|
4795
4811
|
op: "resync-table",
|
|
4796
4812
|
"subscription-id": n.subscriptionId,
|
|
4797
|
-
"tx-id":
|
|
4813
|
+
"tx-id": r,
|
|
4798
4814
|
token: n.token
|
|
4799
4815
|
});
|
|
4800
4816
|
}
|
|
@@ -4807,25 +4823,24 @@ class qu {
|
|
|
4807
4823
|
}
|
|
4808
4824
|
initSubscription(e, n, r) {
|
|
4809
4825
|
return br(this, void 0, void 0, function* () {
|
|
4810
|
-
var i, s, o, u
|
|
4826
|
+
var i, s, o, u;
|
|
4811
4827
|
yield this.subs.waitForKeyToLoad(n);
|
|
4812
|
-
const
|
|
4813
|
-
if (
|
|
4814
|
-
this.sendResync(
|
|
4815
|
-
type:
|
|
4816
|
-
data: rt(
|
|
4817
|
-
})
|
|
4828
|
+
const a = this.subs.currentValue[n];
|
|
4829
|
+
if (a && a.state && a.state.txId) {
|
|
4830
|
+
this.sendResync(a, a.state, a.state.txId), !((i = a.values) === null || i === void 0) && i.entities && r && r({
|
|
4831
|
+
type: pe.LoadFromStorage,
|
|
4832
|
+
data: rt(a, (s = a.values) === null || s === void 0 ? void 0 : s.entities)
|
|
4833
|
+
});
|
|
4818
4834
|
return;
|
|
4819
4835
|
}
|
|
4820
|
-
const
|
|
4821
|
-
this.subs.updateInPlace((
|
|
4822
|
-
|
|
4836
|
+
const d = Object.keys(e)[0], c = ((u = (o = e[d]) === null || o === void 0 ? void 0 : o.$) === null || u === void 0 ? void 0 : u.order) || { serverCreatedAt: "asc" }, [f, l] = Object.entries(c)[0];
|
|
4837
|
+
this.subs.updateInPlace((p) => {
|
|
4838
|
+
p[n] = {
|
|
4823
4839
|
query: e,
|
|
4824
4840
|
hash: n,
|
|
4825
|
-
table:
|
|
4826
|
-
orderDirection:
|
|
4827
|
-
orderField:
|
|
4828
|
-
orderFieldType: y,
|
|
4841
|
+
table: d,
|
|
4842
|
+
orderDirection: l,
|
|
4843
|
+
orderField: f,
|
|
4829
4844
|
createdAt: Date.now(),
|
|
4830
4845
|
updatedAt: Date.now()
|
|
4831
4846
|
};
|
|
@@ -4842,7 +4857,7 @@ class qu {
|
|
|
4842
4857
|
});
|
|
4843
4858
|
}
|
|
4844
4859
|
onStartSyncOk(e) {
|
|
4845
|
-
const n = e["subscription-id"], r = e.q, i =
|
|
4860
|
+
const n = e["subscription-id"], r = e.q, i = N(r);
|
|
4846
4861
|
this.idToHash[n] = i, this.subs.updateInPlace((s) => {
|
|
4847
4862
|
const o = s[i];
|
|
4848
4863
|
if (!o)
|
|
@@ -4888,7 +4903,7 @@ class qu {
|
|
|
4888
4903
|
this.subs.updateInPlace((c) => {
|
|
4889
4904
|
c[s] = u, c[s].updatedAt = Date.now();
|
|
4890
4905
|
}), u.values && this.notifyCbs(s, {
|
|
4891
|
-
type:
|
|
4906
|
+
type: pe.InitialSyncBatch,
|
|
4892
4907
|
data: rt(u, u.values.entities),
|
|
4893
4908
|
batch: o
|
|
4894
4909
|
});
|
|
@@ -4913,7 +4928,7 @@ class qu {
|
|
|
4913
4928
|
});
|
|
4914
4929
|
const s = this.subs.currentValue[i];
|
|
4915
4930
|
s && this.notifyCbs(i, {
|
|
4916
|
-
type:
|
|
4931
|
+
type: pe.InitialSyncComplete,
|
|
4917
4932
|
data: rt(s, ((n = s.values) === null || n === void 0 ? void 0 : n.entities) || [])
|
|
4918
4933
|
});
|
|
4919
4934
|
}
|
|
@@ -4935,13 +4950,13 @@ class qu {
|
|
|
4935
4950
|
return;
|
|
4936
4951
|
}
|
|
4937
4952
|
for (const d of e.txes) {
|
|
4938
|
-
if (a.txId >= d["tx-id"])
|
|
4953
|
+
if (a.txId && a.txId >= d["tx-id"])
|
|
4939
4954
|
continue;
|
|
4940
4955
|
a.txId = d["tx-id"];
|
|
4941
4956
|
const c = [], f = {};
|
|
4942
4957
|
for (const T of d.changes) {
|
|
4943
|
-
const
|
|
4944
|
-
f[T.triple[0]] =
|
|
4958
|
+
const v = (n = f[T.triple[0]]) !== null && n !== void 0 ? n : [];
|
|
4959
|
+
f[T.triple[0]] = v, v.push(T);
|
|
4945
4960
|
}
|
|
4946
4961
|
const l = (r = u.values) !== null && r !== void 0 ? r : {
|
|
4947
4962
|
entities: [],
|
|
@@ -4949,44 +4964,45 @@ class qu {
|
|
|
4949
4964
|
}, p = l.entities;
|
|
4950
4965
|
u.values = l;
|
|
4951
4966
|
const y = [];
|
|
4952
|
-
e: for (const [T,
|
|
4953
|
-
for (
|
|
4954
|
-
|
|
4955
|
-
|
|
4956
|
-
|
|
4957
|
-
|
|
4958
|
-
|
|
4959
|
-
|
|
4960
|
-
|
|
4961
|
-
|
|
4962
|
-
|
|
4963
|
-
}), k.entity = O) : c.push(v), delete f[T];
|
|
4967
|
+
e: for (const [T, v] of Object.entries(f))
|
|
4968
|
+
for (let j = 0; j < p.length; j++) {
|
|
4969
|
+
const S = p[j];
|
|
4970
|
+
if (ws(S.store, T)) {
|
|
4971
|
+
gr(S.store, v);
|
|
4972
|
+
const I = Pt(u, S.store), R = Nu(S.store, v)[T];
|
|
4973
|
+
I ? (y.push({
|
|
4974
|
+
oldEntity: S.entity,
|
|
4975
|
+
newEntity: I,
|
|
4976
|
+
changedFields: R || {}
|
|
4977
|
+
}), S.entity = I) : c.push(j), delete f[T];
|
|
4964
4978
|
continue e;
|
|
4965
4979
|
}
|
|
4980
|
+
}
|
|
4966
4981
|
const b = [];
|
|
4967
|
-
for (const [T,
|
|
4968
|
-
const
|
|
4969
|
-
l.attrs =
|
|
4970
|
-
const
|
|
4971
|
-
if (!
|
|
4982
|
+
for (const [T, v] of Object.entries(f)) {
|
|
4983
|
+
const j = this.createStore([]);
|
|
4984
|
+
l.attrs = j.attrs, gr(j, v);
|
|
4985
|
+
const S = Pt(u, j);
|
|
4986
|
+
if (!S) {
|
|
4972
4987
|
this.log.error("No entity found after applying change", {
|
|
4973
4988
|
sub: u,
|
|
4974
|
-
changes:
|
|
4975
|
-
store:
|
|
4989
|
+
changes: v,
|
|
4990
|
+
store: j
|
|
4976
4991
|
});
|
|
4977
4992
|
continue;
|
|
4978
4993
|
}
|
|
4979
4994
|
p.push({
|
|
4980
|
-
store:
|
|
4981
|
-
entity:
|
|
4982
|
-
serverCreatedAt: _r(u,
|
|
4983
|
-
}), b.push(
|
|
4995
|
+
store: j,
|
|
4996
|
+
entity: S,
|
|
4997
|
+
serverCreatedAt: _r(u, j, S.id)
|
|
4998
|
+
}), b.push(S);
|
|
4984
4999
|
}
|
|
4985
5000
|
const g = [];
|
|
4986
5001
|
for (const T of c.sort().reverse())
|
|
4987
5002
|
g.push(p[T].entity), p.splice(T, 1);
|
|
4988
|
-
Ku(u,
|
|
4989
|
-
|
|
5003
|
+
const m = Ku(u, this.createStore);
|
|
5004
|
+
qu(u, m, p), this.notifyCbs(o, {
|
|
5005
|
+
type: pe.SyncTransaction,
|
|
4990
5006
|
data: rt(u, (i = u.values) === null || i === void 0 ? void 0 : i.entities),
|
|
4991
5007
|
added: b,
|
|
4992
5008
|
removed: g,
|
|
@@ -5009,14 +5025,14 @@ class qu {
|
|
|
5009
5025
|
}
|
|
5010
5026
|
}
|
|
5011
5027
|
onStartSyncError(e) {
|
|
5012
|
-
const n =
|
|
5028
|
+
const n = N(e["original-event"].q), r = {
|
|
5013
5029
|
message: e.message || "Uh-oh, something went wrong. Ping Joe & Stopa.",
|
|
5014
5030
|
status: e.status,
|
|
5015
5031
|
type: e.type,
|
|
5016
5032
|
hint: e.hint
|
|
5017
5033
|
}, i = Object.keys(e["original-event"].q)[0];
|
|
5018
5034
|
this.notifyCbs(n, {
|
|
5019
|
-
type:
|
|
5035
|
+
type: pe.Error,
|
|
5020
5036
|
data: { [i]: [] },
|
|
5021
5037
|
error: r
|
|
5022
5038
|
});
|
|
@@ -5052,7 +5068,7 @@ var U = function(t, e, n, r) {
|
|
|
5052
5068
|
}
|
|
5053
5069
|
d((r = r.apply(t, e || [])).next());
|
|
5054
5070
|
});
|
|
5055
|
-
},
|
|
5071
|
+
}, Vu = function(t, e) {
|
|
5056
5072
|
var n = {};
|
|
5057
5073
|
for (var r in t) Object.prototype.hasOwnProperty.call(t, r) && e.indexOf(r) < 0 && (n[r] = t[r]);
|
|
5058
5074
|
if (t != null && typeof Object.getOwnPropertySymbols == "function")
|
|
@@ -5066,11 +5082,11 @@ const se = {
|
|
|
5066
5082
|
AUTHENTICATED: "authenticated",
|
|
5067
5083
|
CLOSED: "closed",
|
|
5068
5084
|
ERRORED: "errored"
|
|
5069
|
-
},
|
|
5085
|
+
}, Wu = 3e4, Bu = 3e4, Gu = 200, Qu = {
|
|
5070
5086
|
apiURI: "https://api.instantdb.com",
|
|
5071
5087
|
websocketURI: "wss://api.instantdb.com/runtime/session"
|
|
5072
5088
|
}, It = "_instant_oauth_redirect", De = "currentUser";
|
|
5073
|
-
function
|
|
5089
|
+
function Hu({ transportType: t, appId: e, apiURI: n, wsURI: r, EventSourceImpl: i }) {
|
|
5074
5090
|
if (!i)
|
|
5075
5091
|
return new yr(`${r}?app_id=${e}`);
|
|
5076
5092
|
switch (t) {
|
|
@@ -5082,7 +5098,7 @@ function Qu({ transportType: t, appId: e, apiURI: n, wsURI: r, EventSourceImpl:
|
|
|
5082
5098
|
throw new Error("Unknown transport type " + t);
|
|
5083
5099
|
}
|
|
5084
5100
|
}
|
|
5085
|
-
function
|
|
5101
|
+
function Yu() {
|
|
5086
5102
|
return typeof window < "u" || typeof chrome < "u";
|
|
5087
5103
|
}
|
|
5088
5104
|
const Tr = {
|
|
@@ -5091,7 +5107,7 @@ const Tr = {
|
|
|
5091
5107
|
"refresh-presence": !0,
|
|
5092
5108
|
"patch-presence": !0
|
|
5093
5109
|
};
|
|
5094
|
-
function
|
|
5110
|
+
function Ju(t, e) {
|
|
5095
5111
|
var n;
|
|
5096
5112
|
const r = typeof t == "string" ? JSON.parse(t) : t;
|
|
5097
5113
|
if (!((n = r == null ? void 0 : r.result) === null || n === void 0) && n.store) {
|
|
@@ -5100,12 +5116,12 @@ function Yu(t, e) {
|
|
|
5100
5116
|
}
|
|
5101
5117
|
return r;
|
|
5102
5118
|
}
|
|
5103
|
-
function
|
|
5119
|
+
function Zu(t, e) {
|
|
5104
5120
|
var n;
|
|
5105
5121
|
const r = Object.assign({}, e);
|
|
5106
5122
|
return !((n = e.result) === null || n === void 0) && n.store && (r.result = Object.assign(Object.assign({}, e.result), { store: Ur(e.result.store) })), r;
|
|
5107
5123
|
}
|
|
5108
|
-
function
|
|
5124
|
+
function Xu(t, e) {
|
|
5109
5125
|
switch (t) {
|
|
5110
5126
|
case "pendingMutations":
|
|
5111
5127
|
return new Map(typeof e == "string" ? JSON.parse(e) : e);
|
|
@@ -5113,7 +5129,7 @@ function Zu(t, e) {
|
|
|
5113
5129
|
return e;
|
|
5114
5130
|
}
|
|
5115
5131
|
}
|
|
5116
|
-
function
|
|
5132
|
+
function ea(t, e) {
|
|
5117
5133
|
switch (t) {
|
|
5118
5134
|
case "pendingMutations":
|
|
5119
5135
|
return [...e.entries()];
|
|
@@ -5121,7 +5137,7 @@ function Xu(t, e) {
|
|
|
5121
5137
|
return e;
|
|
5122
5138
|
}
|
|
5123
5139
|
}
|
|
5124
|
-
function
|
|
5140
|
+
function ta(t, e, n) {
|
|
5125
5141
|
const r = e == null ? void 0 : e.result, i = n == null ? void 0 : n.result;
|
|
5126
5142
|
return r && !i && n && (n.result = r), n || e;
|
|
5127
5143
|
}
|
|
@@ -5131,7 +5147,7 @@ function mr(t) {
|
|
|
5131
5147
|
return u == a ? r < s ? -1 : r > s ? 1 : 0 : u - a;
|
|
5132
5148
|
});
|
|
5133
5149
|
}
|
|
5134
|
-
class
|
|
5150
|
+
class na {
|
|
5135
5151
|
constructor(e, n = ti, r = ni, i, s) {
|
|
5136
5152
|
var o, u, a;
|
|
5137
5153
|
if (this._isOnline = !0, this._isShutdown = !1, this.status = se.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 = (d, c, f) => {
|
|
@@ -5139,16 +5155,16 @@ class ta {
|
|
|
5139
5155
|
switch (d) {
|
|
5140
5156
|
case "pendingMutations": {
|
|
5141
5157
|
const y = (l = c == null ? void 0 : c.entries()) !== null && l !== void 0 ? l : [], b = (p = f == null ? void 0 : f.entries()) !== null && p !== void 0 ? p : [], g = new Map([...y, ...b]);
|
|
5142
|
-
return (c ? this._rewriteMutationsSorted(this.attrs, c) : []).forEach(([
|
|
5143
|
-
var
|
|
5144
|
-
!(!((
|
|
5158
|
+
return (c ? this._rewriteMutationsSorted(this.attrs, c) : []).forEach(([T, v]) => {
|
|
5159
|
+
var j;
|
|
5160
|
+
!(!((j = f == null ? void 0 : f.pendingMutations) === null || j === void 0) && j.has(T)) && !v["tx-id"] && this._sendMutation(T, v);
|
|
5145
5161
|
}), g;
|
|
5146
5162
|
}
|
|
5147
5163
|
default:
|
|
5148
5164
|
return f || c;
|
|
5149
5165
|
}
|
|
5150
5166
|
}, this.getPreviousResult = (d) => {
|
|
5151
|
-
const c =
|
|
5167
|
+
const c = N(d);
|
|
5152
5168
|
return this.dataForQuery(c);
|
|
5153
5169
|
}, this.notifyOne = (d) => {
|
|
5154
5170
|
var c, f;
|
|
@@ -5250,10 +5266,10 @@ class ta {
|
|
|
5250
5266
|
return;
|
|
5251
5267
|
}
|
|
5252
5268
|
this._log.info("[socket][close]", c.id, "schedule reconnect, ms =", this._reconnectTimeoutMs), this._scheduleReconnect();
|
|
5253
|
-
}, this._EventSource = s, this.config = Object.assign(Object.assign({},
|
|
5269
|
+
}, this._EventSource = s, this.config = Object.assign(Object.assign({}, Qu), e), this.queryCacheLimit = (o = this.config.queryCacheLimit) !== null && o !== void 0 ? o : 10, this._pendingTxCleanupTimeout = (u = this.config.pendingTxCleanupTimeout) !== null && u !== void 0 ? u : Bu, this._pendingMutationCleanupThreshold = (a = this.config.pendingMutationCleanupThreshold) !== null && a !== void 0 ? a : Gu, this._log = Au(e.verbose || pn || ri, () => this._reactorStats()), this.versions = Object.assign(Object.assign({}, i || {}), { "@instantdb/core": oi }), this.config.schema && (this._linkIndex = ar(this.config.schema)), !!Yu()) {
|
|
5254
5270
|
if (!e.appId)
|
|
5255
5271
|
throw new Error("Instant must be initialized with an appId.");
|
|
5256
|
-
if (!
|
|
5272
|
+
if (!Ee(e.appId))
|
|
5257
5273
|
throw new Error(`Instant must be initialized with a valid appId. \`${e.appId}\` is not a valid uuid.`);
|
|
5258
5274
|
typeof BroadcastChannel == "function" && (this._broadcastChannel = new BroadcastChannel("@instantdb"), this._broadcastChannel.addEventListener("message", (d) => U(this, void 0, void 0, function* () {
|
|
5259
5275
|
var c;
|
|
@@ -5265,7 +5281,7 @@ class ta {
|
|
|
5265
5281
|
} catch (f) {
|
|
5266
5282
|
this._log.error("[error] handle broadcast channel", f);
|
|
5267
5283
|
}
|
|
5268
|
-
}))), this._initStorage(n), this._syncTable = new
|
|
5284
|
+
}))), this._initStorage(n), this._syncTable = new zu(this._trySendAuthed.bind(this), new n(this.config.appId, "syncSubs"), {
|
|
5269
5285
|
useDateObjects: this.config.useDateObjects
|
|
5270
5286
|
}, this._log, (d) => at(this.attrs, d, this.config.enableCardinalityInference, this._linkIndex, this.config.useDateObjects)), this._oauthCallbackResponse = this._oauthLoginInit(), this.getCurrentUser(), r.getIsOnline().then((d) => {
|
|
5271
5287
|
this._isOnline = d, this._startSocket(), r.listen((c) => {
|
|
@@ -5290,9 +5306,9 @@ class ta {
|
|
|
5290
5306
|
_initStorage(e) {
|
|
5291
5307
|
this.querySubs = new Jt({
|
|
5292
5308
|
persister: new e(this.config.appId, "querySubs"),
|
|
5293
|
-
merge:
|
|
5294
|
-
serialize:
|
|
5295
|
-
parse: (n, r) =>
|
|
5309
|
+
merge: ta,
|
|
5310
|
+
serialize: Zu,
|
|
5311
|
+
parse: (n, r) => Ju(r, this.config.useDateObjects),
|
|
5296
5312
|
// objectSize
|
|
5297
5313
|
objectSize: (n) => {
|
|
5298
5314
|
var r, i, s, o;
|
|
@@ -5311,8 +5327,8 @@ class ta {
|
|
|
5311
5327
|
}), this.querySubs.onKeyLoaded = (n) => this._onQuerySubLoaded(n), this.kv = new Jt({
|
|
5312
5328
|
persister: new e(this.config.appId, "kv"),
|
|
5313
5329
|
merge: this._onMergeKv,
|
|
5314
|
-
serialize:
|
|
5315
|
-
parse:
|
|
5330
|
+
serialize: ea,
|
|
5331
|
+
parse: Xu,
|
|
5316
5332
|
objectSize: () => 0,
|
|
5317
5333
|
logger: this._log,
|
|
5318
5334
|
saveThrottleMs: 100,
|
|
@@ -5342,15 +5358,15 @@ class ta {
|
|
|
5342
5358
|
if (!i && !s && console.error("Mutation failed", Object.assign({ status: e, eventId: n }, r)), !!i)
|
|
5343
5359
|
if (s)
|
|
5344
5360
|
i.resolve({ status: e, eventId: n });
|
|
5345
|
-
else if (r.type) {
|
|
5346
|
-
const { status: o } = r, u =
|
|
5361
|
+
else if (r != null && r.type) {
|
|
5362
|
+
const { status: o } = r, u = Vu(r, ["status"]);
|
|
5347
5363
|
i.reject(new bt({
|
|
5348
5364
|
// @ts-expect-error body.type is not constant typed
|
|
5349
5365
|
body: u,
|
|
5350
|
-
status: o
|
|
5366
|
+
status: o ?? 0
|
|
5351
5367
|
}));
|
|
5352
5368
|
} else
|
|
5353
|
-
i.reject(new ke(r.message, r.hint));
|
|
5369
|
+
i.reject(new ke((r == null ? void 0 : r.message) || "Unknown error", r == null ? void 0 : r.hint));
|
|
5354
5370
|
}
|
|
5355
5371
|
_setStatus(e, n) {
|
|
5356
5372
|
this.status = e, this._errorMessage = n, this.notifyConnectionStatusSubs(e);
|
|
@@ -5377,21 +5393,21 @@ class ta {
|
|
|
5377
5393
|
break;
|
|
5378
5394
|
}
|
|
5379
5395
|
case "add-query-exists": {
|
|
5380
|
-
this.notifyOneQueryOnce(
|
|
5396
|
+
this.notifyOneQueryOnce(N(n.q));
|
|
5381
5397
|
break;
|
|
5382
5398
|
}
|
|
5383
5399
|
case "add-query-ok": {
|
|
5384
|
-
const { q: l, result: p } = n, y =
|
|
5400
|
+
const { q: l, result: p } = n, y = N(l);
|
|
5385
5401
|
if (!this._hasQueryListeners() && !this.querySubs.currentValue[y])
|
|
5386
5402
|
break;
|
|
5387
|
-
const b = (o = (s = p == null ? void 0 : p[0]) === null || s === void 0 ? void 0 : s.data) === null || o === void 0 ? void 0 : o["page-info"], g = (a = (u = p == null ? void 0 : p[0]) === null || u === void 0 ? void 0 : u.data) === null || a === void 0 ? void 0 : a.aggregate,
|
|
5403
|
+
const b = (o = (s = p == null ? void 0 : p[0]) === null || s === void 0 ? void 0 : s.data) === null || o === void 0 ? void 0 : o["page-info"], g = (a = (u = p == null ? void 0 : p[0]) === null || u === void 0 ? void 0 : u.data) === null || a === void 0 ? void 0 : a.aggregate, m = ur(p), T = at(this.attrs, m, d, this._linkIndex, this.config.useDateObjects);
|
|
5388
5404
|
this.querySubs.updateInPlace((v) => {
|
|
5389
5405
|
if (!v[y]) {
|
|
5390
5406
|
this._log.info("Missing value in querySubs", { hash: y, q: l });
|
|
5391
5407
|
return;
|
|
5392
5408
|
}
|
|
5393
5409
|
v[y].result = {
|
|
5394
|
-
store:
|
|
5410
|
+
store: T,
|
|
5395
5411
|
pageInfo: b,
|
|
5396
5412
|
aggregate: g,
|
|
5397
5413
|
processedTxId: n["processed-tx-id"]
|
|
@@ -5419,24 +5435,24 @@ class ta {
|
|
|
5419
5435
|
const { computations: l, attrs: p } = n, y = n["processed-tx-id"];
|
|
5420
5436
|
p && this._setAttrs(p), this._cleanupPendingMutationsTimeout();
|
|
5421
5437
|
const b = this._rewriteMutations(this.attrs, this._pendingMutations(), y);
|
|
5422
|
-
b !== this._pendingMutations() && this.kv.updateInPlace((
|
|
5423
|
-
|
|
5438
|
+
b !== this._pendingMutations() && this.kv.updateInPlace((T) => {
|
|
5439
|
+
T.pendingMutations = b;
|
|
5424
5440
|
});
|
|
5425
|
-
const g = mr(b.entries()),
|
|
5426
|
-
var v,
|
|
5427
|
-
const R =
|
|
5428
|
-
return { q: R, hash:
|
|
5441
|
+
const g = mr(b.entries()), m = l.map((T) => {
|
|
5442
|
+
var v, j, S, I;
|
|
5443
|
+
const R = T["instaql-query"], q = T["instaql-result"], Ie = N(R), Qe = ur(q), _t = at(this.attrs, Qe, d, this._linkIndex, this.config.useDateObjects), gt = this._applyOptimisticUpdates(_t, g, y), He = (j = (v = q == null ? void 0 : q[0]) === null || v === void 0 ? void 0 : v.data) === null || j === void 0 ? void 0 : j["page-info"], ne = (I = (S = q == null ? void 0 : q[0]) === null || S === void 0 ? void 0 : S.data) === null || I === void 0 ? void 0 : I.aggregate;
|
|
5444
|
+
return { q: R, hash: Ie, store: gt, pageInfo: He, aggregate: ne };
|
|
5429
5445
|
});
|
|
5430
|
-
|
|
5446
|
+
m.forEach(({ hash: T, q: v, store: j, pageInfo: S, aggregate: I }) => {
|
|
5431
5447
|
this.querySubs.updateInPlace((R) => {
|
|
5432
|
-
if (!R[
|
|
5433
|
-
this._log.error("Missing value in querySubs", { hash:
|
|
5448
|
+
if (!R[T]) {
|
|
5449
|
+
this._log.error("Missing value in querySubs", { hash: T, q: v });
|
|
5434
5450
|
return;
|
|
5435
5451
|
}
|
|
5436
|
-
R[
|
|
5452
|
+
R[T].result = { store: j, pageInfo: S, aggregate: I, processedTxId: y };
|
|
5437
5453
|
});
|
|
5438
|
-
}), this._cleanupPendingMutationsQueries(),
|
|
5439
|
-
this.notifyOne(
|
|
5454
|
+
}), this._cleanupPendingMutationsQueries(), m.forEach(({ hash: T }) => {
|
|
5455
|
+
this.notifyOne(T);
|
|
5440
5456
|
});
|
|
5441
5457
|
break;
|
|
5442
5458
|
}
|
|
@@ -5446,10 +5462,10 @@ class ta {
|
|
|
5446
5462
|
const b = this._rewriteMutations(this.attrs, this._pendingMutations()).get(l);
|
|
5447
5463
|
if (!b)
|
|
5448
5464
|
break;
|
|
5449
|
-
this._updatePendingMutations((
|
|
5450
|
-
|
|
5465
|
+
this._updatePendingMutations((m) => {
|
|
5466
|
+
m.set(l, Object.assign(Object.assign({}, m.get(l)), { "tx-id": p, confirmed: Date.now() }));
|
|
5451
5467
|
});
|
|
5452
|
-
const g = b["tx-steps"].filter(([
|
|
5468
|
+
const g = b["tx-steps"].filter(([m, ...T]) => m === "add-attr").map(([m, T]) => T).concat(Object.values(this.attrs));
|
|
5453
5469
|
this._setAttrs(g), this._finishTransaction("synced", l), this._cleanupPendingMutationsTimeout();
|
|
5454
5470
|
break;
|
|
5455
5471
|
}
|
|
@@ -5508,7 +5524,7 @@ class ta {
|
|
|
5508
5524
|
/**
|
|
5509
5525
|
* @param {'timeout' | 'error'} status
|
|
5510
5526
|
* @param {string} eventId
|
|
5511
|
-
* @param {{message
|
|
5527
|
+
* @param {{message?: string, type?: string, status?: number, hint?: unknown}} errorMsg
|
|
5512
5528
|
*/
|
|
5513
5529
|
_handleMutationError(e, n, r) {
|
|
5514
5530
|
const i = this._pendingMutations().get(n);
|
|
@@ -5534,8 +5550,8 @@ class ta {
|
|
|
5534
5550
|
return;
|
|
5535
5551
|
}
|
|
5536
5552
|
if (!((n = e["original-event"]) === null || n === void 0) && n.hasOwnProperty("q") && ((r = e["original-event"]) === null || r === void 0 ? void 0 : r.op) === "add-query") {
|
|
5537
|
-
const y = (i = e["original-event"]) === null || i === void 0 ? void 0 : i.q, b =
|
|
5538
|
-
this.notifyQueryError(
|
|
5553
|
+
const y = (i = e["original-event"]) === null || i === void 0 ? void 0 : i.q, b = N(y);
|
|
5554
|
+
this.notifyQueryError(N(y), f), this.notifyQueryOnceError(y, b, d, f);
|
|
5539
5555
|
return;
|
|
5540
5556
|
}
|
|
5541
5557
|
if (((s = e["original-event"]) === null || s === void 0 ? void 0 : s.op) === "init") {
|
|
@@ -5588,7 +5604,7 @@ class ta {
|
|
|
5588
5604
|
subscribeQuery(e, n, r) {
|
|
5589
5605
|
var i;
|
|
5590
5606
|
this.config.disableValidation || dr(e, this.config.schema), r && "ruleParams" in r && (e = Object.assign({ $$ruleParams: r.ruleParams }, e));
|
|
5591
|
-
const s =
|
|
5607
|
+
const s = N(e), o = this.getPreviousResult(e);
|
|
5592
5608
|
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), () => {
|
|
5593
5609
|
this._unsubQuery(e, s, n);
|
|
5594
5610
|
};
|
|
@@ -5601,8 +5617,8 @@ class ta {
|
|
|
5601
5617
|
return i.reject(new Error("We can't run `queryOnce`, because the device is offline.")), i.promise;
|
|
5602
5618
|
if (!this.querySubs)
|
|
5603
5619
|
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;
|
|
5604
|
-
const s =
|
|
5605
|
-
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")),
|
|
5620
|
+
const s = N(e), o = this._startQuerySub(e, s);
|
|
5621
|
+
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")), Wu), i.promise;
|
|
5606
5622
|
}
|
|
5607
5623
|
_completeQueryOnce(e, n, r) {
|
|
5608
5624
|
this.queryOnceDfds[n] && (this.queryOnceDfds[n] = this.queryOnceDfds[n].filter((i) => i.dfd !== r), this._cleanupQuery(e, n));
|
|
@@ -5635,10 +5651,10 @@ class ta {
|
|
|
5635
5651
|
return /* @__PURE__ */ new Map();
|
|
5636
5652
|
const i = (c) => {
|
|
5637
5653
|
const [f, l, p] = c["forward-identity"];
|
|
5638
|
-
return
|
|
5654
|
+
return K(e, l, p);
|
|
5639
5655
|
}, s = (c) => {
|
|
5640
5656
|
const [f, l, p] = c["forward-identity"];
|
|
5641
|
-
return
|
|
5657
|
+
return _e(e, l, p);
|
|
5642
5658
|
}, o = { attrIdMap: {}, refSwapAttrIds: /* @__PURE__ */ new Set() };
|
|
5643
5659
|
let u = !1;
|
|
5644
5660
|
const a = (c, f) => {
|
|
@@ -5646,15 +5662,15 @@ class ta {
|
|
|
5646
5662
|
for (const p of c) {
|
|
5647
5663
|
const [y] = p;
|
|
5648
5664
|
if (y === "add-attr") {
|
|
5649
|
-
const [g,
|
|
5650
|
-
if (
|
|
5651
|
-
o.attrIdMap[
|
|
5665
|
+
const [g, m] = p, T = i(m);
|
|
5666
|
+
if (T && m.id !== T.id) {
|
|
5667
|
+
o.attrIdMap[m.id] = T.id, u = !0;
|
|
5652
5668
|
continue;
|
|
5653
5669
|
}
|
|
5654
|
-
if (
|
|
5655
|
-
const v = s(
|
|
5670
|
+
if (m["value-type"] === "ref") {
|
|
5671
|
+
const v = s(m);
|
|
5656
5672
|
if (v) {
|
|
5657
|
-
o.attrIdMap[
|
|
5673
|
+
o.attrIdMap[m.id] = v.id, o.refSwapAttrIds.add(m.id), u = !0;
|
|
5658
5674
|
continue;
|
|
5659
5675
|
}
|
|
5660
5676
|
}
|
|
@@ -5824,7 +5840,7 @@ class ta {
|
|
|
5824
5840
|
return;
|
|
5825
5841
|
}
|
|
5826
5842
|
const e = this._transport;
|
|
5827
|
-
this._transport =
|
|
5843
|
+
this._transport = Hu({
|
|
5828
5844
|
transportType: this._transportType,
|
|
5829
5845
|
appId: this.config.appId,
|
|
5830
5846
|
apiURI: this.config.apiURI,
|
|
@@ -6340,9 +6356,9 @@ class ta {
|
|
|
6340
6356
|
}
|
|
6341
6357
|
}
|
|
6342
6358
|
let it;
|
|
6343
|
-
function
|
|
6359
|
+
function ra(t, e) {
|
|
6344
6360
|
it == null || it.dispose();
|
|
6345
|
-
const n =
|
|
6361
|
+
const n = ca(e), r = oa(e, u), i = sa(ia(t));
|
|
6346
6362
|
function s(c) {
|
|
6347
6363
|
var f;
|
|
6348
6364
|
c.source === i.element.contentWindow && ((f = c.data) === null || f === void 0 ? void 0 : f.type) === "close" && n.isVisible() && u();
|
|
@@ -6364,10 +6380,10 @@ function na(t, e) {
|
|
|
6364
6380
|
}
|
|
6365
6381
|
return d();
|
|
6366
6382
|
}
|
|
6367
|
-
function
|
|
6383
|
+
function ia(t) {
|
|
6368
6384
|
return `${pn || ii ? "http://localhost:3000" : "https://instantdb.com"}/_devtool?appId=${t}`;
|
|
6369
6385
|
}
|
|
6370
|
-
function
|
|
6386
|
+
function sa(t) {
|
|
6371
6387
|
const e = document.createElement("iframe");
|
|
6372
6388
|
return e.src = t, e.className = "instant-devtool-iframe", Object.assign(e.style, {
|
|
6373
6389
|
width: "100%",
|
|
@@ -6376,7 +6392,7 @@ function ia(t) {
|
|
|
6376
6392
|
border: "none"
|
|
6377
6393
|
}), { element: e };
|
|
6378
6394
|
}
|
|
6379
|
-
function
|
|
6395
|
+
function oa(t, e) {
|
|
6380
6396
|
const n = `
|
|
6381
6397
|
<svg width="32" height="32" viewBox="0 0 512 512" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
6382
6398
|
<rect width="512" height="512" fill="black"/>
|
|
@@ -6386,7 +6402,7 @@ function sa(t, e) {
|
|
|
6386
6402
|
return r.innerHTML = n, r.className = "instant-devtool-toggler", Object.assign(r.style, Object.assign(Object.assign({
|
|
6387
6403
|
// pos
|
|
6388
6404
|
position: "fixed"
|
|
6389
|
-
},
|
|
6405
|
+
}, ua(t.position)), {
|
|
6390
6406
|
height: "32px",
|
|
6391
6407
|
width: "32px",
|
|
6392
6408
|
// layout
|
|
@@ -6401,7 +6417,7 @@ function sa(t, e) {
|
|
|
6401
6417
|
cursor: "pointer"
|
|
6402
6418
|
})), r.addEventListener("click", e), { element: r };
|
|
6403
6419
|
}
|
|
6404
|
-
function
|
|
6420
|
+
function ua(t) {
|
|
6405
6421
|
switch (t) {
|
|
6406
6422
|
case "bottom-left":
|
|
6407
6423
|
return { bottom: "24px", left: "24px" };
|
|
@@ -6413,7 +6429,7 @@ function oa(t) {
|
|
|
6413
6429
|
return { top: "24px", left: "24px" };
|
|
6414
6430
|
}
|
|
6415
6431
|
}
|
|
6416
|
-
function
|
|
6432
|
+
function aa(t) {
|
|
6417
6433
|
switch (t) {
|
|
6418
6434
|
case "bottom-left":
|
|
6419
6435
|
return { bottom: "24px", right: "24px", left: "60px", top: "72px" };
|
|
@@ -6425,23 +6441,23 @@ function ua(t) {
|
|
|
6425
6441
|
return { top: "24px", right: "24px", left: "60px", bottom: "72px" };
|
|
6426
6442
|
}
|
|
6427
6443
|
}
|
|
6428
|
-
function
|
|
6444
|
+
function ca(t) {
|
|
6429
6445
|
const e = document.createElement("div");
|
|
6430
|
-
Object.assign(e.style, Object.assign(Object.assign({ position: "fixed" },
|
|
6446
|
+
Object.assign(e.style, Object.assign(Object.assign({ position: "fixed" }, aa(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";
|
|
6431
6447
|
function n() {
|
|
6432
6448
|
return e.style.display !== "none";
|
|
6433
6449
|
}
|
|
6434
6450
|
return { element: e, isVisible: n };
|
|
6435
6451
|
}
|
|
6436
|
-
const
|
|
6452
|
+
const da = {
|
|
6437
6453
|
apiURI: "https://api.instantdb.com",
|
|
6438
6454
|
websocketURI: "wss://api.instantdb.com/runtime/session"
|
|
6439
6455
|
};
|
|
6440
|
-
function
|
|
6456
|
+
function fa() {
|
|
6441
6457
|
var t;
|
|
6442
6458
|
return globalThis.__instantDbSchemaHashStore = (t = globalThis.__instantDbSchemaHashStore) !== null && t !== void 0 ? t : /* @__PURE__ */ new WeakMap(), globalThis.__instantDbSchemaHashStore;
|
|
6443
6459
|
}
|
|
6444
|
-
function
|
|
6460
|
+
function la() {
|
|
6445
6461
|
var t;
|
|
6446
6462
|
return globalThis.__instantDbStore = (t = globalThis.__instantDbStore) !== null && t !== void 0 ? t : {}, globalThis.__instantDbStore;
|
|
6447
6463
|
}
|
|
@@ -6449,23 +6465,23 @@ function Zt(t) {
|
|
|
6449
6465
|
const e = t.__adminToken;
|
|
6450
6466
|
return t.appId + "_" + (t.websocketURI || "default_ws_uri") + "_" + (t.apiURI || "default_api_uri") + "_" + (e || "client_only") + "_" + t.useDateObjects;
|
|
6451
6467
|
}
|
|
6452
|
-
const Xt =
|
|
6453
|
-
class
|
|
6468
|
+
const Xt = la(), Mt = fa();
|
|
6469
|
+
class ha {
|
|
6454
6470
|
constructor(e) {
|
|
6455
6471
|
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);
|
|
6456
6472
|
}
|
|
6457
6473
|
}
|
|
6458
|
-
class
|
|
6474
|
+
class pa {
|
|
6459
6475
|
constructor(e) {
|
|
6460
6476
|
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);
|
|
6461
6477
|
}
|
|
6462
6478
|
}
|
|
6463
|
-
function
|
|
6479
|
+
function ya(t) {
|
|
6464
6480
|
return JSON.parse(JSON.stringify(t));
|
|
6465
6481
|
}
|
|
6466
|
-
class
|
|
6482
|
+
class ba {
|
|
6467
6483
|
constructor(e) {
|
|
6468
|
-
this.tx = hn(), this._reactor = e, this.auth = new
|
|
6484
|
+
this.tx = hn(), this._reactor = e, this.auth = new ha(this._reactor), this.storage = new pa(this._reactor);
|
|
6469
6485
|
}
|
|
6470
6486
|
/**
|
|
6471
6487
|
* Use this to write data! You can create, update, delete, and link objects
|
|
@@ -6644,26 +6660,26 @@ function wr(t) {
|
|
|
6644
6660
|
return "0";
|
|
6645
6661
|
if (Mt.get(t))
|
|
6646
6662
|
return Mt.get(t);
|
|
6647
|
-
const e =
|
|
6663
|
+
const e = N(t);
|
|
6648
6664
|
return Mt.set(t, e), e;
|
|
6649
6665
|
}
|
|
6650
|
-
function
|
|
6666
|
+
function _a(t, e) {
|
|
6651
6667
|
return wr(t._reactor.config.schema) !== wr(e);
|
|
6652
6668
|
}
|
|
6653
|
-
function
|
|
6669
|
+
function ga(t, e, n, r, i) {
|
|
6654
6670
|
const s = Xt[Zt(t)];
|
|
6655
6671
|
if (s)
|
|
6656
|
-
return
|
|
6657
|
-
const o = new
|
|
6658
|
-
return Xt[Zt(t)] = u,
|
|
6672
|
+
return _a(s, t.schema) && s._reactor.updateSchema(t.schema), s;
|
|
6673
|
+
const o = new na(Object.assign(Object.assign(Object.assign({}, da), t), { cardinalityInference: !!t.schema }), e || ti, n || ni, Object.assign(Object.assign({}, r || {}), { "@instantdb/core": oi }), i), u = new ba(o);
|
|
6674
|
+
return Xt[Zt(t)] = u, Ta(t.appId, t.devtool), u;
|
|
6659
6675
|
}
|
|
6660
|
-
function
|
|
6676
|
+
function Ta(t, e) {
|
|
6661
6677
|
if (typeof window > "u" || typeof window.location > "u" || typeof document > "u" || typeof e == "boolean" && !e)
|
|
6662
6678
|
return;
|
|
6663
6679
|
const n = Object.assign({ position: "bottom-right", allowedHosts: ["localhost"] }, typeof e == "object" ? e : {});
|
|
6664
|
-
n.allowedHosts.includes(window.location.hostname) &&
|
|
6680
|
+
n.allowedHosts.includes(window.location.hostname) && ra(t, n);
|
|
6665
6681
|
}
|
|
6666
|
-
const
|
|
6682
|
+
const ma = {
|
|
6667
6683
|
isLoading: !0,
|
|
6668
6684
|
data: void 0,
|
|
6669
6685
|
pageInfo: void 0,
|
|
@@ -6678,9 +6694,9 @@ function vr(t) {
|
|
|
6678
6694
|
...t || {}
|
|
6679
6695
|
};
|
|
6680
6696
|
}
|
|
6681
|
-
function
|
|
6697
|
+
function wa(t, e, n) {
|
|
6682
6698
|
e && n && "ruleParams" in n && (e = { $$ruleParams: n.ruleParams, ...e });
|
|
6683
|
-
const r = e ?
|
|
6699
|
+
const r = e ? ya(e) : null, i = N(r), s = ze(
|
|
6684
6700
|
vr(t._reactor.getPreviousResult(r))
|
|
6685
6701
|
), o = de(
|
|
6686
6702
|
(a) => (s.current = vr(
|
|
@@ -6701,12 +6717,12 @@ function ma(t, e, n) {
|
|
|
6701
6717
|
return { state: Rt(
|
|
6702
6718
|
o,
|
|
6703
6719
|
() => s.current,
|
|
6704
|
-
() =>
|
|
6720
|
+
() => ma
|
|
6705
6721
|
), query: r };
|
|
6706
6722
|
}
|
|
6707
|
-
function
|
|
6723
|
+
function va() {
|
|
6708
6724
|
const t = ze(null);
|
|
6709
|
-
|
|
6725
|
+
ge(() => {
|
|
6710
6726
|
n();
|
|
6711
6727
|
}, []);
|
|
6712
6728
|
function e(r, i) {
|
|
@@ -6717,10 +6733,10 @@ function wa() {
|
|
|
6717
6733
|
}
|
|
6718
6734
|
return { set: e, clear: n };
|
|
6719
6735
|
}
|
|
6720
|
-
const
|
|
6721
|
-
function
|
|
6736
|
+
const Sa = 1e3;
|
|
6737
|
+
function Oa(t, e, n) {
|
|
6722
6738
|
const r = ze(n);
|
|
6723
|
-
r.current = n,
|
|
6739
|
+
r.current = n, ge(() => t.core._reactor.subscribeTopic(
|
|
6724
6740
|
t.id,
|
|
6725
6741
|
e,
|
|
6726
6742
|
(s, o) => {
|
|
@@ -6728,8 +6744,8 @@ function Sa(t, e, n) {
|
|
|
6728
6744
|
}
|
|
6729
6745
|
), [t.id, e]);
|
|
6730
6746
|
}
|
|
6731
|
-
function
|
|
6732
|
-
return
|
|
6747
|
+
function Ea(t, e) {
|
|
6748
|
+
return ge(() => t.core._reactor.joinRoom(t.id), [t.id]), de(
|
|
6733
6749
|
(r) => {
|
|
6734
6750
|
t.core._reactor.publishTopic({
|
|
6735
6751
|
roomType: t.type,
|
|
@@ -6741,13 +6757,13 @@ function Oa(t, e) {
|
|
|
6741
6757
|
[t.id, e]
|
|
6742
6758
|
);
|
|
6743
6759
|
}
|
|
6744
|
-
function
|
|
6760
|
+
function Aa(t, e = {}) {
|
|
6745
6761
|
var o, u;
|
|
6746
6762
|
const [n, r] = Or(() => t.core._reactor.getPresence(t.type, t.id, e) ?? {
|
|
6747
6763
|
peers: {},
|
|
6748
6764
|
isLoading: !0
|
|
6749
6765
|
});
|
|
6750
|
-
|
|
6766
|
+
ge(() => t.core._reactor.subscribePresence(
|
|
6751
6767
|
t.type,
|
|
6752
6768
|
t.id,
|
|
6753
6769
|
e,
|
|
@@ -6766,11 +6782,11 @@ function Ea(t, e = {}) {
|
|
|
6766
6782
|
publishPresence: i
|
|
6767
6783
|
}), [n, i]);
|
|
6768
6784
|
}
|
|
6769
|
-
function
|
|
6770
|
-
|
|
6785
|
+
function ka(t, e, n) {
|
|
6786
|
+
ge(() => t.core._reactor.joinRoom(t.id, e), [t.id]), ge(() => t.core._reactor.publishPresence(t.type, t.id, e), [t.type, t.id, n ?? JSON.stringify(e)]);
|
|
6771
6787
|
}
|
|
6772
6788
|
function ja(t, e, n = {}) {
|
|
6773
|
-
const r =
|
|
6789
|
+
const r = va(), i = ye.usePresence(t, {
|
|
6774
6790
|
keys: [e]
|
|
6775
6791
|
}), s = $t(() => {
|
|
6776
6792
|
const c = t._core._reactor.getPresence(
|
|
@@ -6784,7 +6800,7 @@ function ja(t, e, n = {}) {
|
|
|
6784
6800
|
(c) => {
|
|
6785
6801
|
t.core._reactor.publishPresence(t.type, t.id, {
|
|
6786
6802
|
[e]: c
|
|
6787
|
-
}), c && ((n == null ? void 0 : n.timeout) === null || (n == null ? void 0 : n.timeout) === 0 || r.set((n == null ? void 0 : n.timeout) ??
|
|
6803
|
+
}), c && ((n == null ? void 0 : n.timeout) === null || (n == null ? void 0 : n.timeout) === 0 || r.set((n == null ? void 0 : n.timeout) ?? Sa, () => {
|
|
6788
6804
|
t.core._reactor.publishPresence(t.type, t.id, {
|
|
6789
6805
|
[e]: null
|
|
6790
6806
|
});
|
|
@@ -6806,36 +6822,36 @@ function ja(t, e, n = {}) {
|
|
|
6806
6822
|
inputProps: d
|
|
6807
6823
|
};
|
|
6808
6824
|
}
|
|
6809
|
-
const
|
|
6810
|
-
useTopicEffect:
|
|
6811
|
-
usePublishTopic:
|
|
6812
|
-
usePresence:
|
|
6813
|
-
useSyncPresence:
|
|
6825
|
+
const ye = {
|
|
6826
|
+
useTopicEffect: Oa,
|
|
6827
|
+
usePublishTopic: Ea,
|
|
6828
|
+
usePresence: Aa,
|
|
6829
|
+
useSyncPresence: ka,
|
|
6814
6830
|
useTypingIndicator: ja
|
|
6815
6831
|
};
|
|
6816
|
-
class
|
|
6832
|
+
class Ca {
|
|
6817
6833
|
constructor(e, n, r) {
|
|
6818
6834
|
this.useTopicEffect = (i, s) => {
|
|
6819
|
-
|
|
6820
|
-
}, this.usePublishTopic = (i) =>
|
|
6835
|
+
ye.useTopicEffect(this, i, s);
|
|
6836
|
+
}, this.usePublishTopic = (i) => ye.usePublishTopic(this, i), this.usePresence = (i = {}) => ye.usePresence(this, i), this.useSyncPresence = (i, s) => ye.useSyncPresence(this, i, s), this.useTypingIndicator = (i, s = {}) => ye.useTypingIndicator(this, i, s), this.core = e, this._core = this.core, this.type = n, this.id = r;
|
|
6821
6837
|
}
|
|
6822
6838
|
}
|
|
6823
|
-
const
|
|
6839
|
+
const Pa = {
|
|
6824
6840
|
isLoading: !0,
|
|
6825
6841
|
user: void 0,
|
|
6826
6842
|
error: void 0
|
|
6827
6843
|
};
|
|
6828
|
-
class
|
|
6844
|
+
class Ma {
|
|
6829
6845
|
constructor(e, n) {
|
|
6830
6846
|
this.tx = hn(), this.getLocalId = (r) => this.core.getLocalId(r), this.useLocalId = (r) => {
|
|
6831
6847
|
const [i, s] = Or(null);
|
|
6832
|
-
return
|
|
6848
|
+
return ge(() => {
|
|
6833
6849
|
(async () => {
|
|
6834
6850
|
const u = await this.getLocalId(r);
|
|
6835
6851
|
s(u);
|
|
6836
6852
|
})();
|
|
6837
6853
|
}, [r]), i;
|
|
6838
|
-
}, this.rooms =
|
|
6854
|
+
}, this.rooms = ye, this.transact = (r) => this.core.transact(r), this.useQuery = (r, i) => wa(
|
|
6839
6855
|
this.core,
|
|
6840
6856
|
r,
|
|
6841
6857
|
i
|
|
@@ -6848,7 +6864,7 @@ class Ia {
|
|
|
6848
6864
|
return Rt(
|
|
6849
6865
|
i,
|
|
6850
6866
|
() => r.current,
|
|
6851
|
-
() =>
|
|
6867
|
+
() => Pa
|
|
6852
6868
|
);
|
|
6853
6869
|
}, this.useUser = () => {
|
|
6854
6870
|
const { user: r } = this.useAuth();
|
|
@@ -6875,7 +6891,7 @@ class Ia {
|
|
|
6875
6891
|
}, this.SignedOut = ({ children: r }) => {
|
|
6876
6892
|
const i = this.useAuth();
|
|
6877
6893
|
return i.isLoading || i.error || i.user ? null : /* @__PURE__ */ et.jsx(et.Fragment, { children: r });
|
|
6878
|
-
}, this.core =
|
|
6894
|
+
}, this.core = ga(
|
|
6879
6895
|
e,
|
|
6880
6896
|
// @ts-expect-error because TS can't resolve subclass statics
|
|
6881
6897
|
this.constructor.Storage,
|
|
@@ -6899,7 +6915,7 @@ class Ia {
|
|
|
6899
6915
|
* const { peers } = db.rooms.usePresence(room);
|
|
6900
6916
|
*/
|
|
6901
6917
|
room(e = "_defaultRoomType", n = "_defaultRoomId") {
|
|
6902
|
-
return new
|
|
6918
|
+
return new Ca(this.core, e, n);
|
|
6903
6919
|
}
|
|
6904
6920
|
/**
|
|
6905
6921
|
* One time query for the logged in state. This is useful
|
|
@@ -6916,5 +6932,5 @@ class Ia {
|
|
|
6916
6932
|
}
|
|
6917
6933
|
}
|
|
6918
6934
|
export {
|
|
6919
|
-
|
|
6935
|
+
Ma as InstantReactAbstractDatabase
|
|
6920
6936
|
};
|