@instantdb/react-common 0.22.65 → 0.22.66-experimental.drewh-entity-caching.19584095731.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/standalone/index.js +801 -798
- package/dist/standalone/index.umd.cjs +9 -9
- package/package.json +3 -3
package/dist/standalone/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
var
|
|
1
|
+
import Or, { useRef as ze, useCallback as de, useSyncExternalStore as $t, useEffect as ge, useMemo as xt, useState as Er } from "react";
|
|
2
|
+
var Dt = { exports: {} }, $e = {};
|
|
3
3
|
/**
|
|
4
4
|
* @license React
|
|
5
5
|
* react-jsx-runtime.production.min.js
|
|
@@ -9,11 +9,11 @@ var xt = { exports: {} }, $e = {};
|
|
|
9
9
|
* This source code is licensed under the MIT license found in the
|
|
10
10
|
* LICENSE file in the root directory of this source tree.
|
|
11
11
|
*/
|
|
12
|
-
var
|
|
13
|
-
function
|
|
14
|
-
if (
|
|
15
|
-
|
|
16
|
-
var t =
|
|
12
|
+
var Fn;
|
|
13
|
+
function Ki() {
|
|
14
|
+
if (Fn) return $e;
|
|
15
|
+
Fn = 1;
|
|
16
|
+
var t = Or, e = Symbol.for("react.element"), n = Symbol.for("react.fragment"), r = Object.prototype.hasOwnProperty, i = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, s = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
17
17
|
function o(u, a, d) {
|
|
18
18
|
var c, f = {}, l = null, p = null;
|
|
19
19
|
d !== void 0 && (l = "" + d), a.key !== void 0 && (l = "" + a.key), a.ref !== void 0 && (p = a.ref);
|
|
@@ -23,10 +23,10 @@ function Ni() {
|
|
|
23
23
|
}
|
|
24
24
|
return $e.Fragment = n, $e.jsx = o, $e.jsxs = o, $e;
|
|
25
25
|
}
|
|
26
|
-
var xe = {},
|
|
27
|
-
function
|
|
28
|
-
if (
|
|
29
|
-
|
|
26
|
+
var xe = {}, Nn;
|
|
27
|
+
function qi() {
|
|
28
|
+
if (Nn) return xe;
|
|
29
|
+
Nn = 1;
|
|
30
30
|
var t = {};
|
|
31
31
|
/**
|
|
32
32
|
* @license React
|
|
@@ -38,7 +38,7 @@ function Ki() {
|
|
|
38
38
|
* LICENSE file in the root directory of this source tree.
|
|
39
39
|
*/
|
|
40
40
|
return t.NODE_ENV !== "production" && function() {
|
|
41
|
-
var e =
|
|
41
|
+
var e = Or, 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
42
|
function m(h) {
|
|
43
43
|
if (h === null || typeof h != "object")
|
|
44
44
|
return null;
|
|
@@ -127,18 +127,18 @@ function Ki() {
|
|
|
127
127
|
}
|
|
128
128
|
return null;
|
|
129
129
|
}
|
|
130
|
-
var le = Object.assign, Me = 0,
|
|
131
|
-
function
|
|
130
|
+
var le = Object.assign, Me = 0, bn, _n, gn, Tn, mn, wn, vn;
|
|
131
|
+
function Sn() {
|
|
132
132
|
}
|
|
133
|
-
|
|
134
|
-
function
|
|
133
|
+
Sn.__reactDisabledLog = !0;
|
|
134
|
+
function pi() {
|
|
135
135
|
{
|
|
136
136
|
if (Me === 0) {
|
|
137
|
-
|
|
137
|
+
bn = console.log, _n = console.info, gn = console.warn, Tn = console.error, mn = console.group, wn = console.groupCollapsed, vn = console.groupEnd;
|
|
138
138
|
var h = {
|
|
139
139
|
configurable: !0,
|
|
140
140
|
enumerable: !0,
|
|
141
|
-
value:
|
|
141
|
+
value: Sn,
|
|
142
142
|
writable: !0
|
|
143
143
|
};
|
|
144
144
|
Object.defineProperties(console, {
|
|
@@ -154,7 +154,7 @@ function Ki() {
|
|
|
154
154
|
Me++;
|
|
155
155
|
}
|
|
156
156
|
}
|
|
157
|
-
function
|
|
157
|
+
function yi() {
|
|
158
158
|
{
|
|
159
159
|
if (Me--, Me === 0) {
|
|
160
160
|
var h = {
|
|
@@ -164,25 +164,25 @@ function Ki() {
|
|
|
164
164
|
};
|
|
165
165
|
Object.defineProperties(console, {
|
|
166
166
|
log: le({}, h, {
|
|
167
|
-
value:
|
|
167
|
+
value: bn
|
|
168
168
|
}),
|
|
169
169
|
info: le({}, h, {
|
|
170
|
-
value:
|
|
170
|
+
value: _n
|
|
171
171
|
}),
|
|
172
172
|
warn: le({}, h, {
|
|
173
|
-
value:
|
|
173
|
+
value: gn
|
|
174
174
|
}),
|
|
175
175
|
error: le({}, h, {
|
|
176
|
-
value:
|
|
176
|
+
value: Tn
|
|
177
177
|
}),
|
|
178
178
|
group: le({}, h, {
|
|
179
|
-
value:
|
|
179
|
+
value: mn
|
|
180
180
|
}),
|
|
181
181
|
groupCollapsed: le({}, h, {
|
|
182
|
-
value:
|
|
182
|
+
value: wn
|
|
183
183
|
}),
|
|
184
184
|
groupEnd: le({}, h, {
|
|
185
|
-
value:
|
|
185
|
+
value: vn
|
|
186
186
|
})
|
|
187
187
|
});
|
|
188
188
|
}
|
|
@@ -205,10 +205,10 @@ function Ki() {
|
|
|
205
205
|
}
|
|
206
206
|
var wt = !1, Je;
|
|
207
207
|
{
|
|
208
|
-
var
|
|
209
|
-
Je = new
|
|
208
|
+
var bi = typeof WeakMap == "function" ? WeakMap : Map;
|
|
209
|
+
Je = new bi();
|
|
210
210
|
}
|
|
211
|
-
function
|
|
211
|
+
function On(h, _) {
|
|
212
212
|
if (!h || wt)
|
|
213
213
|
return "";
|
|
214
214
|
{
|
|
@@ -221,7 +221,7 @@ function Ki() {
|
|
|
221
221
|
var C = Error.prepareStackTrace;
|
|
222
222
|
Error.prepareStackTrace = void 0;
|
|
223
223
|
var P;
|
|
224
|
-
P = Tt.current, Tt.current = null,
|
|
224
|
+
P = Tt.current, Tt.current = null, pi();
|
|
225
225
|
try {
|
|
226
226
|
if (_) {
|
|
227
227
|
var k = function() {
|
|
@@ -274,15 +274,15 @@ function Ki() {
|
|
|
274
274
|
}
|
|
275
275
|
}
|
|
276
276
|
} finally {
|
|
277
|
-
wt = !1, Tt.current = P,
|
|
277
|
+
wt = !1, Tt.current = P, yi(), Error.prepareStackTrace = C;
|
|
278
278
|
}
|
|
279
279
|
var ve = h ? h.displayName || h.name : "", he = ve ? Ye(ve) : "";
|
|
280
280
|
return typeof h == "function" && Je.set(h, he), he;
|
|
281
281
|
}
|
|
282
|
-
function
|
|
283
|
-
return
|
|
282
|
+
function _i(h, _, w) {
|
|
283
|
+
return On(h, !1);
|
|
284
284
|
}
|
|
285
|
-
function
|
|
285
|
+
function gi(h) {
|
|
286
286
|
var _ = h.prototype;
|
|
287
287
|
return !!(_ && _.isReactComponent);
|
|
288
288
|
}
|
|
@@ -290,7 +290,7 @@ function Ki() {
|
|
|
290
290
|
if (h == null)
|
|
291
291
|
return "";
|
|
292
292
|
if (typeof h == "function")
|
|
293
|
-
return
|
|
293
|
+
return On(h, gi(h));
|
|
294
294
|
if (typeof h == "string")
|
|
295
295
|
return Ye(h);
|
|
296
296
|
switch (h) {
|
|
@@ -302,7 +302,7 @@ function Ki() {
|
|
|
302
302
|
if (typeof h == "object")
|
|
303
303
|
switch (h.$$typeof) {
|
|
304
304
|
case d:
|
|
305
|
-
return
|
|
305
|
+
return _i(h.render);
|
|
306
306
|
case l:
|
|
307
307
|
return Ze(h.type, _, w);
|
|
308
308
|
case p: {
|
|
@@ -315,15 +315,15 @@ function Ki() {
|
|
|
315
315
|
}
|
|
316
316
|
return "";
|
|
317
317
|
}
|
|
318
|
-
var Re = Object.prototype.hasOwnProperty,
|
|
318
|
+
var Re = Object.prototype.hasOwnProperty, En = {}, An = T.ReactDebugCurrentFrame;
|
|
319
319
|
function Xe(h) {
|
|
320
320
|
if (h) {
|
|
321
321
|
var _ = h._owner, w = Ze(h.type, h._source, _ ? _.type : null);
|
|
322
|
-
|
|
322
|
+
An.setExtraStackFrame(w);
|
|
323
323
|
} else
|
|
324
|
-
|
|
324
|
+
An.setExtraStackFrame(null);
|
|
325
325
|
}
|
|
326
|
-
function
|
|
326
|
+
function Ti(h, _, w, O, C) {
|
|
327
327
|
{
|
|
328
328
|
var P = Function.call.bind(Re);
|
|
329
329
|
for (var k in h)
|
|
@@ -338,41 +338,41 @@ function Ki() {
|
|
|
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).", O || "React class", w, k, typeof E), Xe(null)), E instanceof Error && !(E.message in
|
|
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 En) && (En[E.message] = !0, Xe(C), v("Failed %s type: %s", w, E.message), Xe(null));
|
|
342
342
|
}
|
|
343
343
|
}
|
|
344
344
|
}
|
|
345
|
-
var
|
|
345
|
+
var mi = Array.isArray;
|
|
346
346
|
function vt(h) {
|
|
347
|
-
return
|
|
347
|
+
return mi(h);
|
|
348
348
|
}
|
|
349
|
-
function
|
|
349
|
+
function wi(h) {
|
|
350
350
|
{
|
|
351
351
|
var _ = typeof Symbol == "function" && Symbol.toStringTag, w = _ && h[Symbol.toStringTag] || h.constructor.name || "Object";
|
|
352
352
|
return w;
|
|
353
353
|
}
|
|
354
354
|
}
|
|
355
|
-
function
|
|
355
|
+
function vi(h) {
|
|
356
356
|
try {
|
|
357
|
-
return
|
|
357
|
+
return kn(h), !1;
|
|
358
358
|
} catch {
|
|
359
359
|
return !0;
|
|
360
360
|
}
|
|
361
361
|
}
|
|
362
|
-
function
|
|
362
|
+
function kn(h) {
|
|
363
363
|
return "" + h;
|
|
364
364
|
}
|
|
365
|
-
function
|
|
366
|
-
if (
|
|
367
|
-
return v("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",
|
|
365
|
+
function jn(h) {
|
|
366
|
+
if (vi(h))
|
|
367
|
+
return v("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", wi(h)), kn(h);
|
|
368
368
|
}
|
|
369
|
-
var
|
|
369
|
+
var Cn = T.ReactCurrentOwner, Si = {
|
|
370
370
|
key: !0,
|
|
371
371
|
ref: !0,
|
|
372
372
|
__self: !0,
|
|
373
373
|
__source: !0
|
|
374
|
-
},
|
|
375
|
-
function
|
|
374
|
+
}, Pn, In;
|
|
375
|
+
function Oi(h) {
|
|
376
376
|
if (Re.call(h, "ref")) {
|
|
377
377
|
var _ = Object.getOwnPropertyDescriptor(h, "ref").get;
|
|
378
378
|
if (_ && _.isReactWarning)
|
|
@@ -380,7 +380,7 @@ function Ki() {
|
|
|
380
380
|
}
|
|
381
381
|
return h.ref !== void 0;
|
|
382
382
|
}
|
|
383
|
-
function
|
|
383
|
+
function Ei(h) {
|
|
384
384
|
if (Re.call(h, "key")) {
|
|
385
385
|
var _ = Object.getOwnPropertyDescriptor(h, "key").get;
|
|
386
386
|
if (_ && _.isReactWarning)
|
|
@@ -388,13 +388,13 @@ function Ki() {
|
|
|
388
388
|
}
|
|
389
389
|
return h.key !== void 0;
|
|
390
390
|
}
|
|
391
|
-
function Ei(h, _) {
|
|
392
|
-
typeof h.ref == "string" && jn.current;
|
|
393
|
-
}
|
|
394
391
|
function Ai(h, _) {
|
|
392
|
+
typeof h.ref == "string" && Cn.current;
|
|
393
|
+
}
|
|
394
|
+
function ki(h, _) {
|
|
395
395
|
{
|
|
396
396
|
var w = function() {
|
|
397
|
-
|
|
397
|
+
Pn || (Pn = !0, v("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", _));
|
|
398
398
|
};
|
|
399
399
|
w.isReactWarning = !0, Object.defineProperty(h, "key", {
|
|
400
400
|
get: w,
|
|
@@ -402,10 +402,10 @@ function Ki() {
|
|
|
402
402
|
});
|
|
403
403
|
}
|
|
404
404
|
}
|
|
405
|
-
function
|
|
405
|
+
function ji(h, _) {
|
|
406
406
|
{
|
|
407
407
|
var w = function() {
|
|
408
|
-
|
|
408
|
+
In || (In = !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)", _));
|
|
409
409
|
};
|
|
410
410
|
w.isReactWarning = !0, Object.defineProperty(h, "ref", {
|
|
411
411
|
get: w,
|
|
@@ -413,7 +413,7 @@ function Ki() {
|
|
|
413
413
|
});
|
|
414
414
|
}
|
|
415
415
|
}
|
|
416
|
-
var
|
|
416
|
+
var Ci = 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,
|
|
@@ -442,12 +442,12 @@ function Ki() {
|
|
|
442
442
|
value: C
|
|
443
443
|
}), Object.freeze && (Object.freeze(E.props), Object.freeze(E)), E;
|
|
444
444
|
};
|
|
445
|
-
function
|
|
445
|
+
function Pi(h, _, w, O, C) {
|
|
446
446
|
{
|
|
447
447
|
var P, k = {}, E = null, z = null;
|
|
448
|
-
w !== void 0 && (
|
|
448
|
+
w !== void 0 && (jn(w), E = "" + w), Ei(_) && (jn(_.key), E = "" + _.key), Oi(_) && (z = _.ref, Ai(_, C));
|
|
449
449
|
for (P in _)
|
|
450
|
-
Re.call(_, P) && !
|
|
450
|
+
Re.call(_, P) && !Si.hasOwnProperty(P) && (k[P] = _[P]);
|
|
451
451
|
if (h && h.defaultProps) {
|
|
452
452
|
var $ = h.defaultProps;
|
|
453
453
|
for (P in $)
|
|
@@ -455,25 +455,25 @@ function Ki() {
|
|
|
455
455
|
}
|
|
456
456
|
if (E || z) {
|
|
457
457
|
var D = typeof h == "function" ? h.displayName || h.name || "Unknown" : h;
|
|
458
|
-
E &&
|
|
458
|
+
E && ki(k, D), z && ji(k, D);
|
|
459
459
|
}
|
|
460
|
-
return
|
|
460
|
+
return Ci(h, E, z, C, O, Cn.current, k);
|
|
461
461
|
}
|
|
462
462
|
}
|
|
463
|
-
var St = T.ReactCurrentOwner,
|
|
463
|
+
var St = T.ReactCurrentOwner, Mn = T.ReactDebugCurrentFrame;
|
|
464
464
|
function we(h) {
|
|
465
465
|
if (h) {
|
|
466
466
|
var _ = h._owner, w = Ze(h.type, h._source, _ ? _.type : null);
|
|
467
|
-
|
|
467
|
+
Mn.setExtraStackFrame(w);
|
|
468
468
|
} else
|
|
469
|
-
|
|
469
|
+
Mn.setExtraStackFrame(null);
|
|
470
470
|
}
|
|
471
471
|
var Ot;
|
|
472
472
|
Ot = !1;
|
|
473
473
|
function Et(h) {
|
|
474
474
|
return typeof h == "object" && h !== null && h.$$typeof === n;
|
|
475
475
|
}
|
|
476
|
-
function
|
|
476
|
+
function Rn() {
|
|
477
477
|
{
|
|
478
478
|
if (St.current) {
|
|
479
479
|
var h = ne(St.current.type);
|
|
@@ -485,13 +485,13 @@ Check the render method of \`` + h + "`.";
|
|
|
485
485
|
return "";
|
|
486
486
|
}
|
|
487
487
|
}
|
|
488
|
-
function
|
|
488
|
+
function Ii(h) {
|
|
489
489
|
return "";
|
|
490
490
|
}
|
|
491
|
-
var
|
|
492
|
-
function
|
|
491
|
+
var $n = {};
|
|
492
|
+
function Mi(h) {
|
|
493
493
|
{
|
|
494
|
-
var _ =
|
|
494
|
+
var _ = Rn();
|
|
495
495
|
if (!_) {
|
|
496
496
|
var w = typeof h == "string" ? h : h.displayName || h.name;
|
|
497
497
|
w && (_ = `
|
|
@@ -501,27 +501,27 @@ Check the top-level render call using <` + w + ">.");
|
|
|
501
501
|
return _;
|
|
502
502
|
}
|
|
503
503
|
}
|
|
504
|
-
function
|
|
504
|
+
function xn(h, _) {
|
|
505
505
|
{
|
|
506
506
|
if (!h._store || h._store.validated || h.key != null)
|
|
507
507
|
return;
|
|
508
508
|
h._store.validated = !0;
|
|
509
|
-
var w =
|
|
510
|
-
if (
|
|
509
|
+
var w = Mi(_);
|
|
510
|
+
if ($n[w])
|
|
511
511
|
return;
|
|
512
|
-
|
|
512
|
+
$n[w] = !0;
|
|
513
513
|
var O = "";
|
|
514
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
|
-
function
|
|
517
|
+
function Dn(h, _) {
|
|
518
518
|
{
|
|
519
519
|
if (typeof h != "object")
|
|
520
520
|
return;
|
|
521
521
|
if (vt(h))
|
|
522
522
|
for (var w = 0; w < h.length; w++) {
|
|
523
523
|
var O = h[w];
|
|
524
|
-
Et(O) &&
|
|
524
|
+
Et(O) && xn(O, _);
|
|
525
525
|
}
|
|
526
526
|
else if (Et(h))
|
|
527
527
|
h._store && (h._store.validated = !0);
|
|
@@ -529,11 +529,11 @@ Check the top-level render call using <` + w + ">.");
|
|
|
529
529
|
var C = m(h);
|
|
530
530
|
if (typeof C == "function" && C !== h.entries)
|
|
531
531
|
for (var P = C.call(h), k; !(k = P.next()).done; )
|
|
532
|
-
Et(k.value) &&
|
|
532
|
+
Et(k.value) && xn(k.value, _);
|
|
533
533
|
}
|
|
534
534
|
}
|
|
535
535
|
}
|
|
536
|
-
function
|
|
536
|
+
function Ri(h) {
|
|
537
537
|
{
|
|
538
538
|
var _ = h.type;
|
|
539
539
|
if (_ == null || typeof _ == "string")
|
|
@@ -549,7 +549,7 @@ Check the top-level render call using <` + w + ">.");
|
|
|
549
549
|
return;
|
|
550
550
|
if (w) {
|
|
551
551
|
var O = ne(_);
|
|
552
|
-
|
|
552
|
+
Ti(w, h.props, "prop", O, h);
|
|
553
553
|
} else if (_.PropTypes !== void 0 && !Ot) {
|
|
554
554
|
Ot = !0;
|
|
555
555
|
var C = ne(_);
|
|
@@ -558,7 +558,7 @@ Check the top-level render call using <` + w + ">.");
|
|
|
558
558
|
typeof _.getDefaultProps == "function" && !_.getDefaultProps.isReactClassApproved && v("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
|
|
559
559
|
}
|
|
560
560
|
}
|
|
561
|
-
function
|
|
561
|
+
function $i(h) {
|
|
562
562
|
{
|
|
563
563
|
for (var _ = Object.keys(h.props), w = 0; w < _.length; w++) {
|
|
564
564
|
var O = _[w];
|
|
@@ -570,19 +570,19 @@ Check the top-level render call using <` + w + ">.");
|
|
|
570
570
|
h.ref !== null && (we(h), v("Invalid attribute `ref` supplied to `React.Fragment`."), we(null));
|
|
571
571
|
}
|
|
572
572
|
}
|
|
573
|
-
var
|
|
574
|
-
function
|
|
573
|
+
var Un = {};
|
|
574
|
+
function Ln(h, _, w, O, C, P) {
|
|
575
575
|
{
|
|
576
576
|
var k = _t(h);
|
|
577
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
|
-
var z =
|
|
581
|
-
z ? E += z : E +=
|
|
580
|
+
var z = Ii();
|
|
581
|
+
z ? E += z : E += Rn();
|
|
582
582
|
var $;
|
|
583
583
|
h === null ? $ = "null" : vt(h) ? $ = "array" : h !== void 0 && h.$$typeof === n ? ($ = "<" + (ne(h.type) || "Unknown") + " />", E = " Did you accidentally export a JSX literal instead of a component?") : $ = typeof h, v("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", $, E);
|
|
584
584
|
}
|
|
585
|
-
var D =
|
|
585
|
+
var D = Pi(h, _, w, C, P);
|
|
586
586
|
if (D == null)
|
|
587
587
|
return D;
|
|
588
588
|
if (k) {
|
|
@@ -591,43 +591,43 @@ Check the top-level render call using <` + w + ">.");
|
|
|
591
591
|
if (O)
|
|
592
592
|
if (vt(J)) {
|
|
593
593
|
for (var ve = 0; ve < J.length; ve++)
|
|
594
|
-
|
|
594
|
+
Dn(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.");
|
|
598
598
|
else
|
|
599
|
-
|
|
599
|
+
Dn(J, h);
|
|
600
600
|
}
|
|
601
601
|
if (Re.call(_, "key")) {
|
|
602
|
-
var he = ne(h), W = Object.keys(_).filter(function(
|
|
603
|
-
return
|
|
602
|
+
var he = ne(h), W = Object.keys(_).filter(function(Ni) {
|
|
603
|
+
return Ni !== "key";
|
|
604
604
|
}), At = W.length > 0 ? "{key: someKey, " + W.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
605
|
-
if (!
|
|
606
|
-
var
|
|
605
|
+
if (!Un[he + At]) {
|
|
606
|
+
var Fi = 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, he,
|
|
612
|
+
<%s key={someKey} {...props} />`, At, he, Fi, he), Un[he + At] = !0;
|
|
613
613
|
}
|
|
614
614
|
}
|
|
615
|
-
return h === i ?
|
|
615
|
+
return h === i ? $i(D) : Ri(D), D;
|
|
616
616
|
}
|
|
617
617
|
}
|
|
618
|
-
function $i(h, _, w) {
|
|
619
|
-
return Un(h, _, w, !0);
|
|
620
|
-
}
|
|
621
618
|
function xi(h, _, w) {
|
|
622
|
-
return
|
|
619
|
+
return Ln(h, _, w, !0);
|
|
620
|
+
}
|
|
621
|
+
function Di(h, _, w) {
|
|
622
|
+
return Ln(h, _, w, !1);
|
|
623
623
|
}
|
|
624
|
-
var
|
|
625
|
-
xe.Fragment = i, xe.jsx =
|
|
624
|
+
var Ui = Di, Li = xi;
|
|
625
|
+
xe.Fragment = i, xe.jsx = Ui, xe.jsxs = Li;
|
|
626
626
|
}(), xe;
|
|
627
627
|
}
|
|
628
|
-
var
|
|
629
|
-
|
|
630
|
-
var et =
|
|
628
|
+
var zi = {};
|
|
629
|
+
zi.NODE_ENV === "production" ? Dt.exports = Ki() : Dt.exports = qi();
|
|
630
|
+
var et = Dt.exports;
|
|
631
631
|
function N(t) {
|
|
632
632
|
if (typeof t == "number")
|
|
633
633
|
return (Math.abs(t * 2654435761) >>> 0).toString(16);
|
|
@@ -670,14 +670,14 @@ const x = {
|
|
|
670
670
|
Remove: "remove",
|
|
671
671
|
Replace: "replace",
|
|
672
672
|
Add: "add"
|
|
673
|
-
},
|
|
673
|
+
}, Ar = Symbol.for("__MUTATIVE_PROXY_DRAFT__"), Vi = Symbol("__MUTATIVE_RAW_RETURN_SYMBOL__"), st = Symbol.iterator, Y = {
|
|
674
674
|
mutable: "mutable",
|
|
675
675
|
immutable: "immutable"
|
|
676
|
-
},
|
|
676
|
+
}, tn = {};
|
|
677
677
|
function Ne(t, e) {
|
|
678
678
|
return t instanceof Map ? t.has(e) : Object.prototype.hasOwnProperty.call(t, e);
|
|
679
679
|
}
|
|
680
|
-
function
|
|
680
|
+
function Kn(t, e) {
|
|
681
681
|
if (e in t) {
|
|
682
682
|
let n = Reflect.getPrototypeOf(t);
|
|
683
683
|
for (; n; ) {
|
|
@@ -688,10 +688,10 @@ function Nn(t, e) {
|
|
|
688
688
|
}
|
|
689
689
|
}
|
|
690
690
|
}
|
|
691
|
-
function
|
|
691
|
+
function nn(t) {
|
|
692
692
|
return Object.getPrototypeOf(t) === Set.prototype;
|
|
693
693
|
}
|
|
694
|
-
function
|
|
694
|
+
function rn(t) {
|
|
695
695
|
return Object.getPrototypeOf(t) === Map.prototype;
|
|
696
696
|
}
|
|
697
697
|
function H(t) {
|
|
@@ -702,9 +702,9 @@ function Te(t) {
|
|
|
702
702
|
return !!A(t);
|
|
703
703
|
}
|
|
704
704
|
function A(t) {
|
|
705
|
-
return typeof t != "object" ? null : t == null ? void 0 : t[
|
|
705
|
+
return typeof t != "object" ? null : t == null ? void 0 : t[Ar];
|
|
706
706
|
}
|
|
707
|
-
function
|
|
707
|
+
function sn(t) {
|
|
708
708
|
var e;
|
|
709
709
|
const n = A(t);
|
|
710
710
|
return n ? (e = n.copy) !== null && e !== void 0 ? e : n.original : t;
|
|
@@ -715,7 +715,7 @@ function ee(t, e) {
|
|
|
715
715
|
let n;
|
|
716
716
|
return Object.getPrototypeOf(t) === Object.prototype || Array.isArray(t) || t instanceof Map || t instanceof Set || !!(e != null && e.mark) && ((n = e.mark(t, Y)) === Y.immutable || typeof n == "function");
|
|
717
717
|
}
|
|
718
|
-
function
|
|
718
|
+
function kr(t, e = []) {
|
|
719
719
|
if (Object.hasOwnProperty.call(t, "key")) {
|
|
720
720
|
const n = t.parent.copy, r = A(ce(n, t.key));
|
|
721
721
|
if (r !== null && (r == null ? void 0 : r.original) !== t.original)
|
|
@@ -726,10 +726,10 @@ function Ar(t, e = []) {
|
|
|
726
726
|
e.push(s);
|
|
727
727
|
}
|
|
728
728
|
if (t.parent)
|
|
729
|
-
return
|
|
729
|
+
return kr(t.parent, e);
|
|
730
730
|
e.reverse();
|
|
731
731
|
try {
|
|
732
|
-
|
|
732
|
+
Wi(t.copy, e);
|
|
733
733
|
} catch {
|
|
734
734
|
return null;
|
|
735
735
|
}
|
|
@@ -751,7 +751,7 @@ function kt(t, e) {
|
|
|
751
751
|
function ae(t, e) {
|
|
752
752
|
return t === e ? t !== 0 || 1 / t === 1 / e : t !== t && e !== e;
|
|
753
753
|
}
|
|
754
|
-
function
|
|
754
|
+
function Ut(t) {
|
|
755
755
|
if (t)
|
|
756
756
|
for (; t.finalities.revoke.length > 0; )
|
|
757
757
|
t.finalities.revoke.pop()();
|
|
@@ -762,7 +762,7 @@ function be(t, e) {
|
|
|
762
762
|
return r.indexOf("/") === -1 && r.indexOf("~") === -1 ? r : r.replace(/~/g, "~0").replace(/\//g, "~1");
|
|
763
763
|
}).join("/");
|
|
764
764
|
}
|
|
765
|
-
function
|
|
765
|
+
function Wi(t, e) {
|
|
766
766
|
for (let n = 0; n < e.length - 1; n += 1) {
|
|
767
767
|
const r = e[n];
|
|
768
768
|
if (t = ce(me(t) === 3 ? Array.from(t) : t, r), typeof t != "object")
|
|
@@ -770,7 +770,7 @@ function Vi(t, e) {
|
|
|
770
770
|
}
|
|
771
771
|
return t;
|
|
772
772
|
}
|
|
773
|
-
function
|
|
773
|
+
function Bi(t) {
|
|
774
774
|
const e = Object.create(Object.getPrototypeOf(t));
|
|
775
775
|
return Reflect.ownKeys(t).forEach((n) => {
|
|
776
776
|
let r = Reflect.getOwnPropertyDescriptor(t, n);
|
|
@@ -786,26 +786,26 @@ function Wi(t) {
|
|
|
786
786
|
}), Reflect.defineProperty(e, n, r);
|
|
787
787
|
}), e;
|
|
788
788
|
}
|
|
789
|
-
const
|
|
790
|
-
function
|
|
789
|
+
const Gi = Object.prototype.propertyIsEnumerable;
|
|
790
|
+
function jr(t, e) {
|
|
791
791
|
let n;
|
|
792
792
|
if (Array.isArray(t))
|
|
793
793
|
return Array.prototype.concat.call(t);
|
|
794
794
|
if (t instanceof Set) {
|
|
795
|
-
if (!
|
|
795
|
+
if (!nn(t)) {
|
|
796
796
|
const r = Object.getPrototypeOf(t).constructor;
|
|
797
797
|
return new r(t.values());
|
|
798
798
|
}
|
|
799
799
|
return Set.prototype.difference ? Set.prototype.difference.call(t, /* @__PURE__ */ new Set()) : new Set(t.values());
|
|
800
800
|
} else if (t instanceof Map) {
|
|
801
|
-
if (!
|
|
801
|
+
if (!rn(t)) {
|
|
802
802
|
const r = Object.getPrototypeOf(t).constructor;
|
|
803
803
|
return new r(t);
|
|
804
804
|
}
|
|
805
805
|
return new Map(t);
|
|
806
806
|
} else if (e != null && e.mark && (n = e.mark(t, Y), n !== void 0) && n !== Y.mutable) {
|
|
807
807
|
if (n === Y.immutable)
|
|
808
|
-
return
|
|
808
|
+
return Bi(t);
|
|
809
809
|
if (typeof n == "function") {
|
|
810
810
|
if (e.enablePatches || e.enableAutoFreeze)
|
|
811
811
|
throw new Error("You can't use mark and patches or auto freeze together.");
|
|
@@ -817,17 +817,17 @@ function kr(t, e) {
|
|
|
817
817
|
return Object.keys(t).forEach((i) => {
|
|
818
818
|
r[i] = t[i];
|
|
819
819
|
}), Object.getOwnPropertySymbols(t).forEach((i) => {
|
|
820
|
-
|
|
820
|
+
Gi.call(t, i) && (r[i] = t[i]);
|
|
821
821
|
}), r;
|
|
822
822
|
} else
|
|
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 = jr(t.original, t.options));
|
|
827
827
|
}
|
|
828
828
|
function Ue(t) {
|
|
829
829
|
if (!ee(t))
|
|
830
|
-
return
|
|
830
|
+
return sn(t);
|
|
831
831
|
if (Array.isArray(t))
|
|
832
832
|
return t.map(Ue);
|
|
833
833
|
if (t instanceof Map) {
|
|
@@ -835,7 +835,7 @@ function Ue(t) {
|
|
|
835
835
|
r,
|
|
836
836
|
Ue(i)
|
|
837
837
|
]);
|
|
838
|
-
if (!
|
|
838
|
+
if (!rn(t)) {
|
|
839
839
|
const r = Object.getPrototypeOf(t).constructor;
|
|
840
840
|
return new r(n);
|
|
841
841
|
}
|
|
@@ -843,7 +843,7 @@ function Ue(t) {
|
|
|
843
843
|
}
|
|
844
844
|
if (t instanceof Set) {
|
|
845
845
|
const n = Array.from(t).map(Ue);
|
|
846
|
-
if (!
|
|
846
|
+
if (!nn(t)) {
|
|
847
847
|
const r = Object.getPrototypeOf(t).constructor;
|
|
848
848
|
return new r(n);
|
|
849
849
|
}
|
|
@@ -861,7 +861,7 @@ function ie(t) {
|
|
|
861
861
|
var e;
|
|
862
862
|
t.assignedMap = (e = t.assignedMap) !== null && e !== void 0 ? e : /* @__PURE__ */ new Map(), t.operated || (t.operated = !0, t.parent && ie(t.parent));
|
|
863
863
|
}
|
|
864
|
-
function
|
|
864
|
+
function qn() {
|
|
865
865
|
throw new Error("Cannot modify frozen object");
|
|
866
866
|
}
|
|
867
867
|
function Se(t, e, n, r, i) {
|
|
@@ -889,12 +889,12 @@ function Se(t, e, n, r, i) {
|
|
|
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
|
-
t.set = t.clear = t.delete =
|
|
892
|
+
t.set = t.clear = t.delete = qn;
|
|
893
893
|
break;
|
|
894
894
|
case 3:
|
|
895
895
|
for (const u of t)
|
|
896
896
|
Se(u, u, n, r, i);
|
|
897
|
-
t.add = t.clear = t.delete =
|
|
897
|
+
t.add = t.clear = t.delete = qn;
|
|
898
898
|
break;
|
|
899
899
|
case 1:
|
|
900
900
|
Object.freeze(t);
|
|
@@ -910,7 +910,7 @@ function Se(t, e, n, r, i) {
|
|
|
910
910
|
}
|
|
911
911
|
r.pop(), i.pop();
|
|
912
912
|
}
|
|
913
|
-
function
|
|
913
|
+
function on(t, e) {
|
|
914
914
|
const n = me(t);
|
|
915
915
|
if (n === 0)
|
|
916
916
|
Reflect.ownKeys(t).forEach((r) => {
|
|
@@ -923,11 +923,11 @@ function sn(t, e) {
|
|
|
923
923
|
} else
|
|
924
924
|
t.forEach((r, i) => e(i, r, t));
|
|
925
925
|
}
|
|
926
|
-
function
|
|
926
|
+
function Cr(t, e, n) {
|
|
927
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
|
-
if (e.add(t),
|
|
930
|
+
if (e.add(t), on(t, (s, o) => {
|
|
931
931
|
var u;
|
|
932
932
|
if (Te(o)) {
|
|
933
933
|
const a = A(o);
|
|
@@ -935,7 +935,7 @@ function jr(t, e, n) {
|
|
|
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
|
+
Cr(o, e, n);
|
|
939
939
|
}), i) {
|
|
940
940
|
const s = t, o = Array.from(s);
|
|
941
941
|
s.clear(), o.forEach((u) => {
|
|
@@ -943,39 +943,39 @@ function jr(t, e, n) {
|
|
|
943
943
|
});
|
|
944
944
|
}
|
|
945
945
|
}
|
|
946
|
-
function
|
|
946
|
+
function Qi(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 && Cr(ce(n, e), t.finalities.handledSet, t.options);
|
|
949
949
|
}
|
|
950
|
-
function
|
|
950
|
+
function Lt(t) {
|
|
951
951
|
t.type === 3 && t.copy && (t.copy.clear(), t.setMap.forEach((e) => {
|
|
952
|
-
t.copy.add(
|
|
952
|
+
t.copy.add(sn(e));
|
|
953
953
|
}));
|
|
954
954
|
}
|
|
955
|
-
function
|
|
955
|
+
function Ft(t, e, n, r) {
|
|
956
956
|
if (t.operated && t.assignedMap && t.assignedMap.size > 0 && !t.finalized) {
|
|
957
957
|
if (n && r) {
|
|
958
|
-
const s =
|
|
958
|
+
const s = kr(t);
|
|
959
959
|
s && e(t, s, n, r);
|
|
960
960
|
}
|
|
961
961
|
t.finalized = !0;
|
|
962
962
|
}
|
|
963
963
|
}
|
|
964
|
-
function
|
|
964
|
+
function un(t, e, n, r) {
|
|
965
965
|
const i = A(n);
|
|
966
966
|
i && (i.callbacks || (i.callbacks = []), i.callbacks.push((s, o) => {
|
|
967
967
|
var u;
|
|
968
968
|
const a = t.type === 3 ? t.setMap : t.copy;
|
|
969
969
|
if (ae(ce(a, e), n)) {
|
|
970
970
|
let d = i.original;
|
|
971
|
-
i.copy && (d = i.copy),
|
|
971
|
+
i.copy && (d = i.copy), Lt(t), Ft(t, r, s, o), t.options.enableAutoFreeze && (t.options.updatedValues = (u = t.options.updatedValues) !== null && u !== void 0 ? u : /* @__PURE__ */ new WeakMap(), t.options.updatedValues.set(d, i.original)), We(a, e, d);
|
|
972
972
|
}
|
|
973
973
|
}), t.options.enableAutoFreeze && i.finalities !== t.finalities && (t.options.enableAutoFreeze = !1)), ee(n, t.options) && t.finalities.draft.push(() => {
|
|
974
974
|
const s = t.type === 3 ? t.setMap : t.copy;
|
|
975
|
-
ae(ce(s, e), n) &&
|
|
975
|
+
ae(ce(s, e), n) && Qi(t, e);
|
|
976
976
|
});
|
|
977
977
|
}
|
|
978
|
-
function
|
|
978
|
+
function Hi(t, e, n, r, i) {
|
|
979
979
|
let { original: s, assignedMap: o, options: u } = t, a = t.copy;
|
|
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)
|
|
@@ -1021,7 +1021,7 @@ function Qi(t, e, n, r, i) {
|
|
|
1021
1021
|
}
|
|
1022
1022
|
}
|
|
1023
1023
|
}
|
|
1024
|
-
function
|
|
1024
|
+
function Yi({ original: t, copy: e, assignedMap: n }, r, i, s, o) {
|
|
1025
1025
|
n.forEach((u, a) => {
|
|
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)
|
|
@@ -1030,7 +1030,7 @@ function Hi({ original: t, copy: e, assignedMap: n }, r, i, s, 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
|
}
|
|
1033
|
-
function
|
|
1033
|
+
function Ji({ original: t, copy: e }, n, r, i, s) {
|
|
1034
1034
|
let o = 0;
|
|
1035
1035
|
t.forEach((u) => {
|
|
1036
1036
|
if (!e.has(u)) {
|
|
@@ -1067,17 +1067,17 @@ function Ve(t, e, n, r) {
|
|
|
1067
1067
|
switch (t.type) {
|
|
1068
1068
|
case 0:
|
|
1069
1069
|
case 2:
|
|
1070
|
-
return
|
|
1070
|
+
return Yi(t, e, n, r, i);
|
|
1071
1071
|
case 1:
|
|
1072
|
-
return
|
|
1072
|
+
return Hi(t, e, n, r, i);
|
|
1073
1073
|
case 3:
|
|
1074
|
-
return
|
|
1074
|
+
return Ji(t, e, n, r, i);
|
|
1075
1075
|
}
|
|
1076
1076
|
}
|
|
1077
1077
|
const ct = (t, e, n = !1) => {
|
|
1078
1078
|
if (typeof t == "object" && t !== null && (!ee(t, e) || n))
|
|
1079
1079
|
throw new Error("Strict mode: Mutable data cannot be accessed directly, please use 'unsafe(callback)' wrap.");
|
|
1080
|
-
},
|
|
1080
|
+
}, Nt = {
|
|
1081
1081
|
get size() {
|
|
1082
1082
|
return H(A(this)).size;
|
|
1083
1083
|
},
|
|
@@ -1086,7 +1086,7 @@ const ct = (t, e, n = !1) => {
|
|
|
1086
1086
|
},
|
|
1087
1087
|
set(t, e) {
|
|
1088
1088
|
const n = A(this), r = H(n);
|
|
1089
|
-
return (!r.has(t) || !ae(r.get(t), e)) && (V(n), ie(n), n.assignedMap.set(t, !0), n.copy.set(t, e),
|
|
1089
|
+
return (!r.has(t) || !ae(r.get(t), e)) && (V(n), ie(n), n.assignedMap.set(t, !0), n.copy.set(t, e), un(n, t, e, Ve)), this;
|
|
1090
1090
|
},
|
|
1091
1091
|
delete(t) {
|
|
1092
1092
|
if (!this.has(t))
|
|
@@ -1114,7 +1114,7 @@ const ct = (t, e, n = !1) => {
|
|
|
1114
1114
|
const r = A(this), i = H(r).get(t), s = ((n = (e = r.options).mark) === null || n === void 0 ? void 0 : n.call(e, i, Y)) === Y.mutable;
|
|
1115
1115
|
if (r.options.strict && ct(i, r.options, s), s || r.finalized || !ee(i, r.options) || i !== r.original.get(t))
|
|
1116
1116
|
return i;
|
|
1117
|
-
const o =
|
|
1117
|
+
const o = tn.createDraft({
|
|
1118
1118
|
original: i,
|
|
1119
1119
|
parentDraft: r,
|
|
1120
1120
|
key: t,
|
|
@@ -1158,7 +1158,7 @@ const ct = (t, e, n = !1) => {
|
|
|
1158
1158
|
[st]() {
|
|
1159
1159
|
return this.entries();
|
|
1160
1160
|
}
|
|
1161
|
-
},
|
|
1161
|
+
}, Zi = Reflect.ownKeys(Nt), zn = (t, e, { isValuesIterator: n }) => () => {
|
|
1162
1162
|
var r, i;
|
|
1163
1163
|
const s = e.next();
|
|
1164
1164
|
if (s.done)
|
|
@@ -1167,7 +1167,7 @@ const ct = (t, e, n = !1) => {
|
|
|
1167
1167
|
let u = t.setMap.get(o);
|
|
1168
1168
|
const a = A(u), d = ((i = (r = t.options).mark) === null || i === void 0 ? void 0 : i.call(r, u, Y)) === Y.mutable;
|
|
1169
1169
|
if (t.options.strict && ct(o, t.options, d), !d && !a && ee(o, t.options) && !t.finalized && t.original.has(o)) {
|
|
1170
|
-
const c =
|
|
1170
|
+
const c = tn.createDraft({
|
|
1171
1171
|
original: o,
|
|
1172
1172
|
parentDraft: t,
|
|
1173
1173
|
key: o,
|
|
@@ -1194,7 +1194,7 @@ const ct = (t, e, n = !1) => {
|
|
|
1194
1194
|
},
|
|
1195
1195
|
add(t) {
|
|
1196
1196
|
const e = A(this);
|
|
1197
|
-
return this.has(t) || (V(e), ie(e), e.assignedMap.set(t, !0), e.setMap.set(t, t),
|
|
1197
|
+
return this.has(t) || (V(e), ie(e), e.assignedMap.set(t, !0), e.setMap.set(t, t), un(e, t, t, Ve)), this;
|
|
1198
1198
|
},
|
|
1199
1199
|
delete(t) {
|
|
1200
1200
|
if (!this.has(t))
|
|
@@ -1219,7 +1219,7 @@ const ct = (t, e, n = !1) => {
|
|
|
1219
1219
|
const e = t.setMap.keys();
|
|
1220
1220
|
return {
|
|
1221
1221
|
[Symbol.iterator]: () => this.values(),
|
|
1222
|
-
next:
|
|
1222
|
+
next: zn(t, e, { isValuesIterator: !0 })
|
|
1223
1223
|
};
|
|
1224
1224
|
},
|
|
1225
1225
|
entries() {
|
|
@@ -1228,7 +1228,7 @@ const ct = (t, e, n = !1) => {
|
|
|
1228
1228
|
const e = t.setMap.keys();
|
|
1229
1229
|
return {
|
|
1230
1230
|
[Symbol.iterator]: () => this.entries(),
|
|
1231
|
-
next:
|
|
1231
|
+
next: zn(t, e, {
|
|
1232
1232
|
isValuesIterator: !1
|
|
1233
1233
|
})
|
|
1234
1234
|
};
|
|
@@ -1269,13 +1269,13 @@ Set.prototype.difference && Object.assign(dt, {
|
|
|
1269
1269
|
return Set.prototype.isDisjointFrom.call(new Set(this.values()), t);
|
|
1270
1270
|
}
|
|
1271
1271
|
});
|
|
1272
|
-
const
|
|
1272
|
+
const Xi = Reflect.ownKeys(dt), Pr = /* @__PURE__ */ new WeakSet(), Ir = {
|
|
1273
1273
|
get(t, e, n) {
|
|
1274
1274
|
var r, i;
|
|
1275
1275
|
const s = (r = t.copy) === null || r === void 0 ? void 0 : r[e];
|
|
1276
|
-
if (s &&
|
|
1276
|
+
if (s && Pr.has(s))
|
|
1277
1277
|
return s;
|
|
1278
|
-
if (e ===
|
|
1278
|
+
if (e === Ar)
|
|
1279
1279
|
return t;
|
|
1280
1280
|
let o;
|
|
1281
1281
|
if (t.options.mark) {
|
|
@@ -1284,14 +1284,14 @@ const Zi = Reflect.ownKeys(dt), Cr = /* @__PURE__ */ new WeakSet(), Pr = {
|
|
|
1284
1284
|
return t.options.strict && ct(d, t.options, !0), d;
|
|
1285
1285
|
}
|
|
1286
1286
|
const u = H(t);
|
|
1287
|
-
if (u instanceof Map &&
|
|
1287
|
+
if (u instanceof Map && Zi.includes(e)) {
|
|
1288
1288
|
if (e === "size")
|
|
1289
|
-
return Object.getOwnPropertyDescriptor(
|
|
1290
|
-
const d =
|
|
1289
|
+
return Object.getOwnPropertyDescriptor(Nt, "size").get.call(t.proxy);
|
|
1290
|
+
const d = Nt[e];
|
|
1291
1291
|
if (d)
|
|
1292
1292
|
return d.bind(t.proxy);
|
|
1293
1293
|
}
|
|
1294
|
-
if (u instanceof Set &&
|
|
1294
|
+
if (u instanceof Set && Xi.includes(e)) {
|
|
1295
1295
|
if (e === "size")
|
|
1296
1296
|
return Object.getOwnPropertyDescriptor(dt, "size").get.call(t.proxy);
|
|
1297
1297
|
const d = dt[e];
|
|
@@ -1299,7 +1299,7 @@ const Zi = Reflect.ownKeys(dt), Cr = /* @__PURE__ */ new WeakSet(), Pr = {
|
|
|
1299
1299
|
return d.bind(t.proxy);
|
|
1300
1300
|
}
|
|
1301
1301
|
if (!Ne(u, e)) {
|
|
1302
|
-
const d =
|
|
1302
|
+
const d = Kn(u, e);
|
|
1303
1303
|
return d ? "value" in d ? d.value : (
|
|
1304
1304
|
// !case: support for getter
|
|
1305
1305
|
(i = d.get) === null || i === void 0 ? void 0 : i.call(t.proxy)
|
|
@@ -1309,7 +1309,7 @@ const Zi = Reflect.ownKeys(dt), Cr = /* @__PURE__ */ new WeakSet(), Pr = {
|
|
|
1309
1309
|
if (t.options.strict && ct(a, t.options), t.finalized || !ee(a, t.options))
|
|
1310
1310
|
return a;
|
|
1311
1311
|
if (a === kt(t.original, e)) {
|
|
1312
|
-
if (V(t), t.copy[e] =
|
|
1312
|
+
if (V(t), t.copy[e] = an({
|
|
1313
1313
|
original: t.original[e],
|
|
1314
1314
|
parentDraft: t,
|
|
1315
1315
|
key: t.type === 1 ? Number(e) : e,
|
|
@@ -1330,11 +1330,11 @@ const Zi = Reflect.ownKeys(dt), Cr = /* @__PURE__ */ new WeakSet(), Pr = {
|
|
|
1330
1330
|
let i;
|
|
1331
1331
|
if (t.type === 1 && e !== "length" && !(Number.isInteger(i = Number(e)) && i >= 0 && (e === 0 || i === 0 || String(i) === String(e))))
|
|
1332
1332
|
throw new Error("Only supports setting array indices and the 'length' property.");
|
|
1333
|
-
const s =
|
|
1333
|
+
const s = Kn(H(t), e);
|
|
1334
1334
|
if (s != null && s.set)
|
|
1335
1335
|
return s.set.call(t.proxy, n), !0;
|
|
1336
1336
|
const o = kt(H(t), e), u = A(o);
|
|
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,
|
|
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, un(t, e, n, Ve)), !0);
|
|
1338
1338
|
},
|
|
1339
1339
|
has(t, e) {
|
|
1340
1340
|
return e in H(t);
|
|
@@ -1362,10 +1362,10 @@ 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 ?
|
|
1365
|
+
return t.type === 1 ? Ir.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
|
-
function
|
|
1368
|
+
function an(t) {
|
|
1369
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,
|
|
@@ -1379,8 +1379,8 @@ function un(t) {
|
|
|
1379
1379
|
setMap: o === 3 ? new Map(e.entries()) : void 0
|
|
1380
1380
|
};
|
|
1381
1381
|
(r || "key" in t) && (u.key = r);
|
|
1382
|
-
const { proxy: a, revoke: d } = Proxy.revocable(o === 1 ? Object.assign([], u) : u,
|
|
1383
|
-
if (i.revoke.push(d),
|
|
1382
|
+
const { proxy: a, revoke: d } = Proxy.revocable(o === 1 ? Object.assign([], u) : u, Ir);
|
|
1383
|
+
if (i.revoke.push(d), Pr.add(a), u.proxy = a, n) {
|
|
1384
1384
|
const c = n;
|
|
1385
1385
|
c.finalities.draft.push((f, l) => {
|
|
1386
1386
|
var p, y;
|
|
@@ -1389,7 +1389,7 @@ function un(t) {
|
|
|
1389
1389
|
const m = ce(g, r), T = A(m);
|
|
1390
1390
|
if (T) {
|
|
1391
1391
|
let v = T.original;
|
|
1392
|
-
T.operated && (v =
|
|
1392
|
+
T.operated && (v = sn(m)), Lt(T), Ft(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);
|
|
@@ -1398,26 +1398,26 @@ function un(t) {
|
|
|
1398
1398
|
} else {
|
|
1399
1399
|
const c = A(a);
|
|
1400
1400
|
c.finalities.draft.push((f, l) => {
|
|
1401
|
-
|
|
1401
|
+
Lt(c), Ft(c, Ve, f, l);
|
|
1402
1402
|
});
|
|
1403
1403
|
}
|
|
1404
1404
|
return a;
|
|
1405
1405
|
}
|
|
1406
|
-
|
|
1407
|
-
function
|
|
1406
|
+
tn.createDraft = an;
|
|
1407
|
+
function es(t, e, n, r, i) {
|
|
1408
1408
|
var s;
|
|
1409
1409
|
const o = A(t), u = (s = o == null ? void 0 : o.original) !== null && s !== void 0 ? s : t, a = !!e.length;
|
|
1410
1410
|
if (o != null && o.operated)
|
|
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 &&
|
|
1414
|
+
return o && Ut(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
|
|
1418
1418
|
];
|
|
1419
1419
|
}
|
|
1420
|
-
function
|
|
1420
|
+
function ts(t, e) {
|
|
1421
1421
|
var n;
|
|
1422
1422
|
const r = {
|
|
1423
1423
|
draft: [],
|
|
@@ -1426,7 +1426,7 @@ function es(t, e) {
|
|
|
1426
1426
|
};
|
|
1427
1427
|
let i, s;
|
|
1428
1428
|
e.enablePatches && (i = [], s = []);
|
|
1429
|
-
const u = ((n = e.mark) === null || n === void 0 ? void 0 : n.call(e, t, Y)) === Y.mutable || !ee(t, e) ? t :
|
|
1429
|
+
const u = ((n = e.mark) === null || n === void 0 ? void 0 : n.call(e, t, Y)) === Y.mutable || !ee(t, e) ? t : an({
|
|
1430
1430
|
original: t,
|
|
1431
1431
|
parentDraft: null,
|
|
1432
1432
|
finalities: r,
|
|
@@ -1435,14 +1435,14 @@ function es(t, e) {
|
|
|
1435
1435
|
return [
|
|
1436
1436
|
u,
|
|
1437
1437
|
(a = []) => {
|
|
1438
|
-
const [d, c, f] =
|
|
1438
|
+
const [d, c, f] = es(u, a, i, s, e.enableAutoFreeze);
|
|
1439
1439
|
return e.enablePatches ? [d, c, f] : d;
|
|
1440
1440
|
}
|
|
1441
1441
|
];
|
|
1442
1442
|
}
|
|
1443
|
-
function
|
|
1443
|
+
function Kt(t) {
|
|
1444
1444
|
const { rootDraft: e, value: n, useRawReturn: r = !1, isRoot: i = !0 } = t;
|
|
1445
|
-
|
|
1445
|
+
on(n, (s, o, u) => {
|
|
1446
1446
|
const a = A(o);
|
|
1447
1447
|
if (a && e && a.finalities === e.finalities) {
|
|
1448
1448
|
t.isContainDraft = !0;
|
|
@@ -1452,10 +1452,10 @@ function Nt(t) {
|
|
|
1452
1452
|
u.clear(), c.forEach((f) => u.add(s === f ? d : f));
|
|
1453
1453
|
} else
|
|
1454
1454
|
We(u, s, d);
|
|
1455
|
-
} else typeof o == "object" && o !== null && (t.value = o, t.isRoot = !1,
|
|
1455
|
+
} else typeof o == "object" && o !== null && (t.value = o, t.isRoot = !1, Kt(t));
|
|
1456
1456
|
}), i && (t.isContainDraft || console.warn("The return value does not contain any draft, please use 'rawReturn()' to wrap the return value to improve performance."), r && console.warn("The return value contains drafts, please don't use 'rawReturn()' to wrap the return value."));
|
|
1457
1457
|
}
|
|
1458
|
-
function
|
|
1458
|
+
function Mr(t) {
|
|
1459
1459
|
var e;
|
|
1460
1460
|
const n = A(t);
|
|
1461
1461
|
if (!ee(t, n == null ? void 0 : n.options))
|
|
@@ -1465,7 +1465,7 @@ function Ir(t) {
|
|
|
1465
1465
|
return n.original;
|
|
1466
1466
|
let i;
|
|
1467
1467
|
function s() {
|
|
1468
|
-
i = r === 2 ?
|
|
1468
|
+
i = r === 2 ? rn(t) ? new Map(t) : new (Object.getPrototypeOf(t)).constructor(t) : r === 3 ? Array.from(n.setMap.values()) : jr(t, n == null ? void 0 : n.options);
|
|
1469
1469
|
}
|
|
1470
1470
|
if (n) {
|
|
1471
1471
|
n.finalized = !0;
|
|
@@ -1476,23 +1476,23 @@ function Ir(t) {
|
|
|
1476
1476
|
}
|
|
1477
1477
|
} else
|
|
1478
1478
|
i = t;
|
|
1479
|
-
if (
|
|
1479
|
+
if (on(i, (o, u) => {
|
|
1480
1480
|
if (n && ae(ce(n.original, o), u))
|
|
1481
1481
|
return;
|
|
1482
|
-
const a =
|
|
1482
|
+
const a = Mr(u);
|
|
1483
1483
|
a !== u && (i === t && s(), We(i, o, a));
|
|
1484
1484
|
}), r === 3) {
|
|
1485
1485
|
const o = (e = n == null ? void 0 : n.original) !== null && e !== void 0 ? e : i;
|
|
1486
|
-
return
|
|
1486
|
+
return nn(o) ? new Set(i) : new (Object.getPrototypeOf(o)).constructor(i);
|
|
1487
1487
|
}
|
|
1488
1488
|
return i;
|
|
1489
1489
|
}
|
|
1490
|
-
function
|
|
1490
|
+
function Vn(t) {
|
|
1491
1491
|
if (!Te(t))
|
|
1492
1492
|
throw new Error(`current() is only used for Draft, parameter: ${t}`);
|
|
1493
|
-
return
|
|
1493
|
+
return Mr(t);
|
|
1494
1494
|
}
|
|
1495
|
-
const
|
|
1495
|
+
const ns = (t) => function e(n, r, i) {
|
|
1496
1496
|
var s, o, u;
|
|
1497
1497
|
if (typeof n == "function" && typeof r != "function")
|
|
1498
1498
|
return function(S, ...I) {
|
|
@@ -1503,7 +1503,7 @@ const ts = (t) => function e(n, r, 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 = Te(a) ?
|
|
1506
|
+
const f = Te(a) ? Vn(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.`);
|
|
@@ -1519,7 +1519,7 @@ 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 [m, T] =
|
|
1522
|
+
const [m, T] = ts(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.");
|
|
@@ -1529,24 +1529,24 @@ const ts = (t) => function e(n, r, i) {
|
|
|
1529
1529
|
try {
|
|
1530
1530
|
v = d(m);
|
|
1531
1531
|
} catch (S) {
|
|
1532
|
-
throw
|
|
1532
|
+
throw Ut(A(m)), S;
|
|
1533
1533
|
}
|
|
1534
1534
|
const j = (S) => {
|
|
1535
1535
|
const I = A(m);
|
|
1536
1536
|
if (!Te(S)) {
|
|
1537
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 q = S == null ? void 0 : S[
|
|
1539
|
+
const q = S == null ? void 0 : S[Vi];
|
|
1540
1540
|
if (q) {
|
|
1541
1541
|
const Ie = q[0];
|
|
1542
|
-
return g.strict && typeof S == "object" && S !== null &&
|
|
1542
|
+
return g.strict && typeof S == "object" && S !== null && Kt({
|
|
1543
1543
|
rootDraft: I,
|
|
1544
1544
|
value: S,
|
|
1545
1545
|
useRawReturn: !0
|
|
1546
1546
|
}), T([Ie]);
|
|
1547
1547
|
}
|
|
1548
1548
|
if (S !== void 0)
|
|
1549
|
-
return typeof S == "object" && S !== null &&
|
|
1549
|
+
return typeof S == "object" && S !== null && Kt({ rootDraft: I, value: S }), T([S]);
|
|
1550
1550
|
}
|
|
1551
1551
|
if (S === m || S === void 0)
|
|
1552
1552
|
return T([]);
|
|
@@ -1554,26 +1554,26 @@ const ts = (t) => function e(n, r, i) {
|
|
|
1554
1554
|
if (g === R.options) {
|
|
1555
1555
|
if (R.operated)
|
|
1556
1556
|
throw new Error("Cannot return a modified child draft.");
|
|
1557
|
-
return T([
|
|
1557
|
+
return T([Vn(S)]);
|
|
1558
1558
|
}
|
|
1559
1559
|
return T([S]);
|
|
1560
1560
|
};
|
|
1561
1561
|
return v instanceof Promise ? v.then(j, (S) => {
|
|
1562
|
-
throw
|
|
1562
|
+
throw Ut(A(m)), S;
|
|
1563
1563
|
}) : j(v);
|
|
1564
|
-
}, ft =
|
|
1564
|
+
}, ft = ns();
|
|
1565
1565
|
Object.prototype.constructor.toString();
|
|
1566
|
-
function
|
|
1566
|
+
function Rr(t, e) {
|
|
1567
1567
|
const n = Object.keys(t), r = Object.keys(e);
|
|
1568
1568
|
return n.length === r.length && Object.keys(t).every((i) => e.hasOwnProperty(i));
|
|
1569
1569
|
}
|
|
1570
|
-
function
|
|
1570
|
+
function Wn(t, e) {
|
|
1571
1571
|
return Object.keys(t).length === Object.keys(e).length && Object.keys(t).every((n) => e.hasOwnProperty(n) && t[n] === e[n]);
|
|
1572
1572
|
}
|
|
1573
1573
|
function ut(t, e) {
|
|
1574
|
-
return typeof t != "object" || typeof e != "object" || t === null || e === null ? t === e :
|
|
1574
|
+
return typeof t != "object" || typeof e != "object" || t === null || e === null ? t === e : Rr(t, e) ? Object.keys(t).every((n) => ut(t[n], e[n])) : !1;
|
|
1575
1575
|
}
|
|
1576
|
-
function
|
|
1576
|
+
function cn(t) {
|
|
1577
1577
|
if (!Le(t))
|
|
1578
1578
|
return t;
|
|
1579
1579
|
const e = {};
|
|
@@ -1581,7 +1581,7 @@ function an(t) {
|
|
|
1581
1581
|
r !== void 0 && (e[n] = r);
|
|
1582
1582
|
return e;
|
|
1583
1583
|
}
|
|
1584
|
-
function
|
|
1584
|
+
function $r(t, e) {
|
|
1585
1585
|
if (!Le(t) || !Le(e))
|
|
1586
1586
|
return e;
|
|
1587
1587
|
const n = Object.assign({}, t);
|
|
@@ -1593,14 +1593,14 @@ function Rr(t, e) {
|
|
|
1593
1593
|
continue;
|
|
1594
1594
|
}
|
|
1595
1595
|
const i = Le(t[r]) && Le(e[r]);
|
|
1596
|
-
n[r] = i ?
|
|
1596
|
+
n[r] = i ? $r(t[r], e[r]) : e[r];
|
|
1597
1597
|
}
|
|
1598
1598
|
return n;
|
|
1599
1599
|
}
|
|
1600
1600
|
function Le(t) {
|
|
1601
1601
|
return typeof t == "object" && t !== null && !Array.isArray(t);
|
|
1602
1602
|
}
|
|
1603
|
-
function
|
|
1603
|
+
function rs(t, e, n) {
|
|
1604
1604
|
if (!t || e.length === 0)
|
|
1605
1605
|
return;
|
|
1606
1606
|
let r = t || {};
|
|
@@ -1611,7 +1611,7 @@ function ns(t, e, n) {
|
|
|
1611
1611
|
const i = e[e.length - 1];
|
|
1612
1612
|
Array.isArray(r) && typeof i == "number" ? r.splice(i, 0, n) : r[i] = n;
|
|
1613
1613
|
}
|
|
1614
|
-
function
|
|
1614
|
+
function Bn(t, e, n) {
|
|
1615
1615
|
if (!t || e.length === 0)
|
|
1616
1616
|
return;
|
|
1617
1617
|
let r = t || {};
|
|
@@ -1621,7 +1621,7 @@ function Wn(t, e, n) {
|
|
|
1621
1621
|
}
|
|
1622
1622
|
r[e[e.length - 1]] = n;
|
|
1623
1623
|
}
|
|
1624
|
-
function
|
|
1624
|
+
function xr(t, e) {
|
|
1625
1625
|
if (!t || e.length === 0)
|
|
1626
1626
|
return;
|
|
1627
1627
|
const [n, ...r] = e;
|
|
@@ -1630,13 +1630,13 @@ function $r(t, e) {
|
|
|
1630
1630
|
Array.isArray(t) ? t.splice(n, 1) : delete t[n];
|
|
1631
1631
|
return;
|
|
1632
1632
|
}
|
|
1633
|
-
|
|
1633
|
+
xr(t[n], r), is(t[n]) && delete t[n];
|
|
1634
1634
|
}
|
|
1635
1635
|
}
|
|
1636
|
-
function
|
|
1636
|
+
function is(t) {
|
|
1637
1637
|
return t && Object.keys(t).length === 0;
|
|
1638
1638
|
}
|
|
1639
|
-
const
|
|
1639
|
+
const Gn = /ZULU|YEKT|YEKST|YAPT|YAKT|YAKST|XJT|WGT|WGST|WFT|WETDST|WET|WDT|WAT|WAST|WAKT|WADT|VUT|VOLT|VLAT|VLAST|VET|UZT|UZST|UYT|UYST|UTC|UT|ULAT|ULAST|UCT|TVT|TRUT|TOT|TMT|TKT|TJT|TFT|TAHT|SGT|SCT|SAST|SADT|RET|PYT|PYST|PWT|PST|PONT|PMST|PMDT|PKT|PKST|PHT|PGT|PETT|PETST|PET|PDT|OMST|OMSST|NZT|NZST|NZDT|NUT|NST|NPT|NOVT|NOVST|NFT|NDT|MYT|MVT|MUT|MUST|MST|MSK|MSD|MPT|MMT|MHT|MEZ|METDST|MET|MESZ|MEST|MDT|MAWT|MART|MAGT|MAGST|LKT|LINT|LIGT|LHST|LHDT|KST|KRAT|KRAST|KOST|KGT|KGST|KDT|JST|JAYT|IST|IRT|IRKT|IRKST|IOT|IDT|ICT|HST|HKT|GYT|GMT|GILT|GFT|GET|GEST|GAMT|GALT|FNT|FNST|FKT|FKST|FJT|FJST|FET|EST|EGT|EGST|EETDST|EET|EEST|EDT|EAT|EAST|EASST|DDUT|DAVT|CXT|CST|COT|CLT|CLST|CKT|CHUT|CHAST|CHADT|CETDST|CET|CEST|CDT|CCT|CAST|CADT|BTT|BST|BRT|BRST|BRA|BOT|BORT|BNT|BDT|BDST|AZT|AZST|AZOT|AZOST|AWST|AWSST|AST|ART|ARST|ANAT|ANAST|AMT|AMST|ALMT|ALMST|AKST|AKDT|AFT|AEST|AESST|AEDT|ADT|ACWST|ACT|ACST|ACSST|ACDT$/, ss = {
|
|
1640
1640
|
ZULU: 0,
|
|
1641
1641
|
YEKT: 18e3,
|
|
1642
1642
|
YEKST: 21600,
|
|
@@ -1832,39 +1832,39 @@ const Bn = /ZULU|YEKT|YEKST|YAPT|YAKT|YAKST|XJT|WGT|WGST|WFT|WETDST|WET|WDT|WAT|
|
|
|
1832
1832
|
ACSST: 37800,
|
|
1833
1833
|
ACDT: 37800
|
|
1834
1834
|
};
|
|
1835
|
-
function
|
|
1835
|
+
function os(t) {
|
|
1836
1836
|
return new Date(t);
|
|
1837
1837
|
}
|
|
1838
|
-
function
|
|
1838
|
+
function us(t) {
|
|
1839
1839
|
return /* @__PURE__ */ new Date(t + "Z");
|
|
1840
1840
|
}
|
|
1841
|
-
const
|
|
1842
|
-
function
|
|
1843
|
-
const e = t.match(
|
|
1841
|
+
const as = /^(\d+)[\./-](\d+)[\./-](\d+)$/;
|
|
1842
|
+
function cs(t) {
|
|
1843
|
+
const e = t.match(as);
|
|
1844
1844
|
if (!e)
|
|
1845
1845
|
return null;
|
|
1846
1846
|
const [n, r, i, s] = e;
|
|
1847
1847
|
return r <= 0 || i <= 0 || s <= 0 ? null : r > 999 ? new Date(Date.UTC(r, i - 1, s, 0, 0, 0, 0)) : new Date(Date.UTC(s, r - 1, i, 0, 0, 0, 0));
|
|
1848
1848
|
}
|
|
1849
|
-
function
|
|
1849
|
+
function ds(t) {
|
|
1850
1850
|
const [e, n] = t.split(" ");
|
|
1851
1851
|
return /* @__PURE__ */ new Date(e + "T" + n + "Z");
|
|
1852
1852
|
}
|
|
1853
|
-
function
|
|
1853
|
+
function fs(t) {
|
|
1854
1854
|
const [e, n] = t.split(" ");
|
|
1855
1855
|
return /* @__PURE__ */ new Date(e + "T" + n + "Z");
|
|
1856
1856
|
}
|
|
1857
|
-
function
|
|
1857
|
+
function ls(t) {
|
|
1858
1858
|
return new Date(t);
|
|
1859
1859
|
}
|
|
1860
|
-
function
|
|
1860
|
+
function hs(t) {
|
|
1861
1861
|
const e = /^(\w{3}) (\w{3}) (\d{2}) (\d{4})$/;
|
|
1862
1862
|
if (!t.match(e))
|
|
1863
1863
|
throw new Error(`Unable to parse \`${t}\` as a date.`);
|
|
1864
1864
|
const r = /* @__PURE__ */ new Date(t + " UTC");
|
|
1865
1865
|
return new Date(Date.UTC(r.getUTCFullYear(), r.getUTCMonth(), r.getUTCDate(), 0, 0, 0, 0));
|
|
1866
1866
|
}
|
|
1867
|
-
function
|
|
1867
|
+
function ps(t) {
|
|
1868
1868
|
const e = /^(.+T.+)([+-])(\d{2})$/, n = t.match(e);
|
|
1869
1869
|
if (n) {
|
|
1870
1870
|
const [, r, i, s] = n, o = `${r}${i}${s}:00`;
|
|
@@ -1872,14 +1872,14 @@ function hs(t) {
|
|
|
1872
1872
|
}
|
|
1873
1873
|
return null;
|
|
1874
1874
|
}
|
|
1875
|
-
function
|
|
1875
|
+
function ys(t) {
|
|
1876
1876
|
const [e, n] = t.split(", "), [r, i, s] = e.split("/").map(Number), o = n.match(/(\d{1,2}):(\d{2}):(\d{2}) (AM|PM)/);
|
|
1877
1877
|
if (!o)
|
|
1878
1878
|
throw new Error(`Unable to parse time from: ${t}`);
|
|
1879
1879
|
let [, u, a, d, c] = o;
|
|
1880
1880
|
return u = Number(u), a = Number(a), d = Number(d), c === "PM" && u !== 12 ? u += 12 : c === "AM" && u === 12 && (u = 0), new Date(Date.UTC(s, r - 1, i, u, a, d));
|
|
1881
1881
|
}
|
|
1882
|
-
function
|
|
1882
|
+
function bs(t) {
|
|
1883
1883
|
switch (t) {
|
|
1884
1884
|
case "epoch":
|
|
1885
1885
|
return /* @__PURE__ */ new Date(0);
|
|
@@ -1891,27 +1891,27 @@ function ys(t) {
|
|
|
1891
1891
|
return null;
|
|
1892
1892
|
}
|
|
1893
1893
|
}
|
|
1894
|
-
function
|
|
1895
|
-
const e = t.match(
|
|
1894
|
+
function _s(t) {
|
|
1895
|
+
const e = t.match(Gn);
|
|
1896
1896
|
if (!e)
|
|
1897
1897
|
return null;
|
|
1898
|
-
const [n] = e, r =
|
|
1898
|
+
const [n] = e, r = ss[n], i = new Date(t.replace(Gn, "Z"));
|
|
1899
1899
|
return new Date(i.getTime() - r * 1e3);
|
|
1900
1900
|
}
|
|
1901
|
-
const
|
|
1902
|
-
|
|
1903
|
-
ds,
|
|
1904
|
-
ls,
|
|
1905
|
-
ps,
|
|
1901
|
+
const gs = [
|
|
1902
|
+
cs,
|
|
1906
1903
|
fs,
|
|
1907
|
-
os,
|
|
1908
1904
|
hs,
|
|
1909
|
-
cs,
|
|
1910
|
-
ss,
|
|
1911
1905
|
ys,
|
|
1912
|
-
|
|
1906
|
+
ls,
|
|
1907
|
+
us,
|
|
1908
|
+
ps,
|
|
1909
|
+
ds,
|
|
1910
|
+
os,
|
|
1911
|
+
bs,
|
|
1912
|
+
_s
|
|
1913
1913
|
];
|
|
1914
|
-
function
|
|
1914
|
+
function Ts(t, e) {
|
|
1915
1915
|
try {
|
|
1916
1916
|
const n = t(e);
|
|
1917
1917
|
return n instanceof Date && !isNaN(n.getTime()) ? n : null;
|
|
@@ -1919,18 +1919,18 @@ function gs(t, e) {
|
|
|
1919
1919
|
return null;
|
|
1920
1920
|
}
|
|
1921
1921
|
}
|
|
1922
|
-
function
|
|
1923
|
-
for (const e of
|
|
1924
|
-
const n =
|
|
1922
|
+
function qt(t) {
|
|
1923
|
+
for (const e of gs) {
|
|
1924
|
+
const n = Ts(e, t);
|
|
1925
1925
|
if (n)
|
|
1926
1926
|
return n;
|
|
1927
1927
|
}
|
|
1928
1928
|
return null;
|
|
1929
1929
|
}
|
|
1930
|
-
function
|
|
1930
|
+
function ms(t) {
|
|
1931
1931
|
try {
|
|
1932
1932
|
const e = JSON.parse(t);
|
|
1933
|
-
return typeof e == "string" ?
|
|
1933
|
+
return typeof e == "string" ? qt(e) : null;
|
|
1934
1934
|
} catch {
|
|
1935
1935
|
return null;
|
|
1936
1936
|
}
|
|
@@ -1942,7 +1942,7 @@ function pt(t) {
|
|
|
1942
1942
|
if (t instanceof Date)
|
|
1943
1943
|
return t;
|
|
1944
1944
|
if (typeof t == "string") {
|
|
1945
|
-
const e =
|
|
1945
|
+
const e = qt(t) || ms(t) || qt(t.trim());
|
|
1946
1946
|
if (!e)
|
|
1947
1947
|
throw new Error(`Unable to parse \`${t}\` as a date.`);
|
|
1948
1948
|
return e;
|
|
@@ -1951,13 +1951,13 @@ function pt(t) {
|
|
|
1951
1951
|
throw new Error(`Invalid date value \`${t}\`. Expected a date, number, or string, got type ${typeof t}.`);
|
|
1952
1952
|
}
|
|
1953
1953
|
}
|
|
1954
|
-
function
|
|
1954
|
+
function ws(t) {
|
|
1955
1955
|
return t.cardinality === "one";
|
|
1956
1956
|
}
|
|
1957
|
-
function
|
|
1957
|
+
function dn(t) {
|
|
1958
1958
|
return t["value-type"] === "ref";
|
|
1959
1959
|
}
|
|
1960
|
-
function
|
|
1960
|
+
function fn(t) {
|
|
1961
1961
|
return t["value-type"] === "blob";
|
|
1962
1962
|
}
|
|
1963
1963
|
function je(t, e) {
|
|
@@ -1987,7 +1987,7 @@ function B(t, e, n) {
|
|
|
1987
1987
|
let s = t.get(r);
|
|
1988
1988
|
s || (s = /* @__PURE__ */ new Map(), t.set(r, s)), B(s, i, n);
|
|
1989
1989
|
}
|
|
1990
|
-
function
|
|
1990
|
+
function Dr(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;
|
|
@@ -1996,22 +1996,22 @@ function xr(t, e, n) {
|
|
|
1996
1996
|
console.warn("no such attr", u, t);
|
|
1997
1997
|
continue;
|
|
1998
1998
|
}
|
|
1999
|
-
f["checked-data-type"] === "date" && n && (d = pt(d), o[2] = d),
|
|
1999
|
+
f["checked-data-type"] === "date" && n && (d = pt(d), o[2] = d), dn(f) && B(s, [d, a, u], o), B(r, [u, a, d], o), B(i, [a, u, d], o);
|
|
2000
2000
|
}
|
|
2001
2001
|
return { eav: r, aev: i, vae: s };
|
|
2002
2002
|
}
|
|
2003
|
-
function
|
|
2003
|
+
function Ur(t) {
|
|
2004
2004
|
const e = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map();
|
|
2005
2005
|
for (const s of Object.values(t)) {
|
|
2006
2006
|
const o = s["forward-identity"], [u, a, d] = o, c = s["reverse-identity"];
|
|
2007
|
-
if (B(r, [a, d], s),
|
|
2007
|
+
if (B(r, [a, d], s), fn(s) && B(e, [a, d], s), s["primary?"] && B(n, [a], s), c) {
|
|
2008
2008
|
const [f, l, p] = c;
|
|
2009
2009
|
B(i, [l, p], s);
|
|
2010
2010
|
}
|
|
2011
2011
|
}
|
|
2012
2012
|
return { blobAttrs: e, primaryKeys: n, forwardIdents: r, revIdents: i };
|
|
2013
2013
|
}
|
|
2014
|
-
function
|
|
2014
|
+
function Lr(t) {
|
|
2015
2015
|
return {
|
|
2016
2016
|
__type: t.__type,
|
|
2017
2017
|
attrs: t.attrs,
|
|
@@ -2021,18 +2021,18 @@ function Ur(t) {
|
|
|
2021
2021
|
useDateObjects: t.useDateObjects
|
|
2022
2022
|
};
|
|
2023
2023
|
}
|
|
2024
|
-
function
|
|
2024
|
+
function Fr(t) {
|
|
2025
2025
|
return at(t.attrs, t.triples, t.cardinalityInference, t.linkIndex, t.useDateObjects);
|
|
2026
2026
|
}
|
|
2027
|
-
function
|
|
2027
|
+
function vs(t, e) {
|
|
2028
2028
|
return Ce(t.eav, [e]) !== void 0;
|
|
2029
2029
|
}
|
|
2030
|
-
function
|
|
2031
|
-
t.attrIndexes =
|
|
2030
|
+
function ln(t) {
|
|
2031
|
+
t.attrIndexes = Ur(t.attrs);
|
|
2032
2032
|
}
|
|
2033
2033
|
function at(t, e, n, r, i) {
|
|
2034
|
-
const s =
|
|
2035
|
-
return s.useDateObjects = i, s.attrs = t, s.attrIndexes =
|
|
2034
|
+
const s = Dr(t, e, i);
|
|
2035
|
+
return s.useDateObjects = i, s.attrs = t, s.attrIndexes = Ur(t), s.cardinalityInference = n, s.linkIndex = r, s.__type = "store", s;
|
|
2036
2036
|
}
|
|
2037
2037
|
function Be(t, e) {
|
|
2038
2038
|
var n, r;
|
|
@@ -2061,21 +2061,21 @@ function Be(t, e) {
|
|
|
2061
2061
|
return [i, ...u];
|
|
2062
2062
|
}
|
|
2063
2063
|
}
|
|
2064
|
-
function
|
|
2064
|
+
function Nr(t, e) {
|
|
2065
2065
|
const n = Be(t, e);
|
|
2066
2066
|
if (!n)
|
|
2067
2067
|
return;
|
|
2068
2068
|
const [r, i, s] = n, o = je(t.attrs, i);
|
|
2069
|
-
o && (X(t.eav, [r, i, s]), X(t.aev, [i, r, s]),
|
|
2069
|
+
o && (X(t.eav, [r, i, s]), X(t.aev, [i, r, s]), dn(o) && X(t.vae, [s, i, r]));
|
|
2070
2070
|
}
|
|
2071
|
-
let
|
|
2072
|
-
function
|
|
2071
|
+
let Ss = 0;
|
|
2072
|
+
function Kr(t, e, n) {
|
|
2073
2073
|
const [r, i, s] = n;
|
|
2074
2074
|
let o;
|
|
2075
2075
|
const u = Ce(t.ea, [r, i, s]);
|
|
2076
|
-
return u && (o = u[3]), o || Date.now() * 10 +
|
|
2076
|
+
return u && (o = u[3]), o || Date.now() * 10 + Ss++;
|
|
2077
2077
|
}
|
|
2078
|
-
function
|
|
2078
|
+
function qr(t, e) {
|
|
2079
2079
|
var n;
|
|
2080
2080
|
const r = Be(t, e);
|
|
2081
2081
|
if (!r)
|
|
@@ -2085,10 +2085,10 @@ function Kr(t, e) {
|
|
|
2085
2085
|
if (!u)
|
|
2086
2086
|
return;
|
|
2087
2087
|
u["checked-data-type"] === "date" && t.useDateObjects && (o = pt(o));
|
|
2088
|
-
const a = Ce(t.eav, [i, s, o]), d = (n = a == null ? void 0 : a[3]) !== null && n !== void 0 ? n :
|
|
2089
|
-
|
|
2088
|
+
const a = Ce(t.eav, [i, s, o]), d = (n = a == null ? void 0 : a[3]) !== null && n !== void 0 ? n : Kr(t, u, r), c = [i, s, o, d];
|
|
2089
|
+
ws(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)), dn(u) && B(t.vae, [o, s, i], c);
|
|
2090
2090
|
}
|
|
2091
|
-
function
|
|
2091
|
+
function Os(t, e) {
|
|
2092
2092
|
var n;
|
|
2093
2093
|
const r = Be(t, e);
|
|
2094
2094
|
if (!r)
|
|
@@ -2096,7 +2096,7 @@ function Ss(t, e) {
|
|
|
2096
2096
|
const [i, s, o] = r, u = je(t.attrs, s);
|
|
2097
2097
|
if (!u)
|
|
2098
2098
|
return;
|
|
2099
|
-
if (!
|
|
2099
|
+
if (!fn(u))
|
|
2100
2100
|
throw new Error("merge operation is not supported for links");
|
|
2101
2101
|
const a = Ce(t.eav, [i, s]);
|
|
2102
2102
|
if (!a)
|
|
@@ -2104,15 +2104,15 @@ function Ss(t, e) {
|
|
|
2104
2104
|
const d = (n = a.values().next()) === null || n === void 0 ? void 0 : n.value;
|
|
2105
2105
|
if (!d)
|
|
2106
2106
|
return;
|
|
2107
|
-
const c = d[2], f =
|
|
2107
|
+
const c = d[2], f = $r(c, o), l = [
|
|
2108
2108
|
i,
|
|
2109
2109
|
s,
|
|
2110
2110
|
f,
|
|
2111
|
-
|
|
2111
|
+
Kr(t, u, d)
|
|
2112
2112
|
];
|
|
2113
2113
|
B(t.eav, [i, s], /* @__PURE__ */ new Map([[f, l]]));
|
|
2114
2114
|
}
|
|
2115
|
-
function
|
|
2115
|
+
function zt(t, e) {
|
|
2116
2116
|
var n, r;
|
|
2117
2117
|
const [i, s] = e, o = Be(t, [i]);
|
|
2118
2118
|
if (!o)
|
|
@@ -2123,7 +2123,7 @@ function qt(t, e) {
|
|
|
2123
2123
|
const f = t.attrs[c];
|
|
2124
2124
|
f && f["on-delete-reverse"] === "cascade" && G(a.get(c), 1).forEach(([l, p, y]) => {
|
|
2125
2125
|
var b;
|
|
2126
|
-
return
|
|
2126
|
+
return zt(t, [y, (b = f["reverse-identity"]) === null || b === void 0 ? void 0 : b[1]]);
|
|
2127
2127
|
}), // Fall back to deleting everything if we've rehydrated tx-steps from
|
|
2128
2128
|
// the store that didn't set `etype` in deleteEntity
|
|
2129
2129
|
(!s || // If we don't know about the attr, let's just get rid of it
|
|
@@ -2136,54 +2136,54 @@ function qt(t, e) {
|
|
|
2136
2136
|
d && d.forEach((c) => {
|
|
2137
2137
|
var f, l, p;
|
|
2138
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 &&
|
|
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 && zt(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
|
-
function
|
|
2143
|
-
const n =
|
|
2142
|
+
function zr(t, e) {
|
|
2143
|
+
const n = Dr(t.attrs, e, t.useDateObjects);
|
|
2144
2144
|
Object.keys(n).forEach((r) => {
|
|
2145
2145
|
t[r] = n[r];
|
|
2146
2146
|
});
|
|
2147
2147
|
}
|
|
2148
|
-
function
|
|
2149
|
-
t.attrs[e.id] = e,
|
|
2148
|
+
function Es(t, [e]) {
|
|
2149
|
+
t.attrs[e.id] = e, ln(t);
|
|
2150
2150
|
}
|
|
2151
|
-
function
|
|
2151
|
+
function Vr(t) {
|
|
2152
2152
|
return G(t.eav, 3);
|
|
2153
2153
|
}
|
|
2154
|
-
function
|
|
2154
|
+
function As(t, [e]) {
|
|
2155
2155
|
if (!t.attrs[e])
|
|
2156
2156
|
return;
|
|
2157
|
-
const n =
|
|
2158
|
-
delete t.attrs[e],
|
|
2157
|
+
const n = Vr(t).filter(([r, i]) => i !== e);
|
|
2158
|
+
delete t.attrs[e], ln(t), zr(t, n);
|
|
2159
2159
|
}
|
|
2160
|
-
function
|
|
2160
|
+
function ks(t, [e]) {
|
|
2161
2161
|
const n = t.attrs[e.id];
|
|
2162
|
-
n && (t.attrs[e.id] = Object.assign(Object.assign({}, n), e),
|
|
2162
|
+
n && (t.attrs[e.id] = Object.assign(Object.assign({}, n), e), ln(t), zr(t, Vr(t)));
|
|
2163
2163
|
}
|
|
2164
|
-
function
|
|
2164
|
+
function js(t, e) {
|
|
2165
2165
|
const [n, ...r] = e;
|
|
2166
2166
|
switch (n) {
|
|
2167
2167
|
case "add-triple":
|
|
2168
|
-
|
|
2168
|
+
qr(t, r);
|
|
2169
2169
|
break;
|
|
2170
2170
|
case "deep-merge-triple":
|
|
2171
|
-
|
|
2171
|
+
Os(t, r);
|
|
2172
2172
|
break;
|
|
2173
2173
|
case "retract-triple":
|
|
2174
|
-
|
|
2174
|
+
Nr(t, r);
|
|
2175
2175
|
break;
|
|
2176
2176
|
case "delete-entity":
|
|
2177
|
-
|
|
2177
|
+
zt(t, r);
|
|
2178
2178
|
break;
|
|
2179
2179
|
case "add-attr":
|
|
2180
|
-
|
|
2180
|
+
Es(t, r);
|
|
2181
2181
|
break;
|
|
2182
2182
|
case "delete-attr":
|
|
2183
|
-
|
|
2183
|
+
As(t, r);
|
|
2184
2184
|
break;
|
|
2185
2185
|
case "update-attr":
|
|
2186
|
-
|
|
2186
|
+
ks(t, r);
|
|
2187
2187
|
break;
|
|
2188
2188
|
case "restore-attr":
|
|
2189
2189
|
break;
|
|
@@ -2238,13 +2238,13 @@ function tt(t, e, n) {
|
|
|
2238
2238
|
}
|
|
2239
2239
|
return s;
|
|
2240
2240
|
}
|
|
2241
|
-
function
|
|
2241
|
+
function Cs(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
|
-
function
|
|
2245
|
+
function Ps(t, [e, n, r]) {
|
|
2246
2246
|
var i, s;
|
|
2247
|
-
switch (
|
|
2247
|
+
switch (Cs(e, n, r)) {
|
|
2248
2248
|
case "e": {
|
|
2249
2249
|
const u = t.eav.get(e);
|
|
2250
2250
|
return G(u, 2);
|
|
@@ -2290,33 +2290,36 @@ function Cs(t, [e, n, r]) {
|
|
|
2290
2290
|
return G(t.eav, 3);
|
|
2291
2291
|
}
|
|
2292
2292
|
}
|
|
2293
|
-
|
|
2293
|
+
const jt = {};
|
|
2294
|
+
function Is(t, e, n) {
|
|
2294
2295
|
var r;
|
|
2296
|
+
if (jt[n])
|
|
2297
|
+
return jt[n];
|
|
2295
2298
|
const i = {};
|
|
2296
2299
|
for (const [s, o] of e.entries()) {
|
|
2297
2300
|
const u = (r = t.eav.get(n)) === null || r === void 0 ? void 0 : r.get(o.id), a = G(u, 1);
|
|
2298
2301
|
for (const d of a)
|
|
2299
2302
|
i[s] = d[2];
|
|
2300
2303
|
}
|
|
2301
|
-
return i;
|
|
2304
|
+
return jt[n] = i, i;
|
|
2302
2305
|
}
|
|
2303
2306
|
function fe(t, e, n) {
|
|
2304
2307
|
var r;
|
|
2305
2308
|
return (r = t.attrIndexes.forwardIdents.get(e)) === null || r === void 0 ? void 0 : r.get(n);
|
|
2306
2309
|
}
|
|
2307
|
-
function
|
|
2310
|
+
function Wr(t, e, n) {
|
|
2308
2311
|
var r;
|
|
2309
2312
|
return (r = t.attrIndexes.revIdents.get(e)) === null || r === void 0 ? void 0 : r.get(n);
|
|
2310
2313
|
}
|
|
2311
|
-
function
|
|
2314
|
+
function Ms(t, e) {
|
|
2312
2315
|
return t.attrIndexes.blobAttrs.get(e);
|
|
2313
2316
|
}
|
|
2314
|
-
function
|
|
2317
|
+
function Br(t, e) {
|
|
2315
2318
|
var n;
|
|
2316
2319
|
const r = t.attrIndexes.primaryKeys.get(e);
|
|
2317
2320
|
return r || ((n = t.attrIndexes.forwardIdents.get(e)) === null || n === void 0 ? void 0 : n.get("id"));
|
|
2318
2321
|
}
|
|
2319
|
-
function
|
|
2322
|
+
function Rs(t, e) {
|
|
2320
2323
|
const n = Be(t, e);
|
|
2321
2324
|
if (!n)
|
|
2322
2325
|
return;
|
|
@@ -2324,7 +2327,7 @@ function Ms(t, e) {
|
|
|
2324
2327
|
if (je(t.attrs, i))
|
|
2325
2328
|
return Ce(t.eav, [r, i]);
|
|
2326
2329
|
}
|
|
2327
|
-
function
|
|
2330
|
+
function $s(t, e) {
|
|
2328
2331
|
const n = e.filter(([r, i, s, o, u]) => {
|
|
2329
2332
|
if (r !== "add-triple" && r !== "deep-merge-triple")
|
|
2330
2333
|
return !0;
|
|
@@ -2334,39 +2337,39 @@ function Rs(t, e) {
|
|
|
2334
2337
|
let d = !1;
|
|
2335
2338
|
const c = je(t.attrs, s);
|
|
2336
2339
|
if (c) {
|
|
2337
|
-
const f =
|
|
2338
|
-
d = !!
|
|
2340
|
+
const f = Br(t, c["forward-identity"][1]);
|
|
2341
|
+
d = !!Rs(t, [i, f.id, i]);
|
|
2339
2342
|
}
|
|
2340
2343
|
return !(a === "create" && d || a === "update" && !d);
|
|
2341
2344
|
});
|
|
2342
2345
|
return ft(t, (r) => {
|
|
2343
2346
|
n.forEach((i) => {
|
|
2344
|
-
|
|
2347
|
+
js(r, i);
|
|
2345
2348
|
});
|
|
2346
2349
|
});
|
|
2347
2350
|
}
|
|
2348
|
-
function
|
|
2351
|
+
function xs(t) {
|
|
2349
2352
|
return typeof t == "string" && t.startsWith("?");
|
|
2350
2353
|
}
|
|
2351
|
-
function
|
|
2354
|
+
function Ds(t, e, n) {
|
|
2352
2355
|
if (n.hasOwnProperty(t)) {
|
|
2353
2356
|
const r = n[t];
|
|
2354
|
-
return
|
|
2357
|
+
return Gr(r, e, n);
|
|
2355
2358
|
}
|
|
2356
2359
|
return Object.assign(Object.assign({}, n), { [t]: e });
|
|
2357
2360
|
}
|
|
2358
|
-
function
|
|
2361
|
+
function Qn(t, e, n) {
|
|
2359
2362
|
return t === e ? n : null;
|
|
2360
2363
|
}
|
|
2361
|
-
function
|
|
2364
|
+
function Us(t) {
|
|
2362
2365
|
switch (typeof t) {
|
|
2363
2366
|
case "string":
|
|
2364
|
-
return t.startsWith("?") ?
|
|
2367
|
+
return t.startsWith("?") ? Ds : Qn;
|
|
2365
2368
|
default:
|
|
2366
|
-
return
|
|
2369
|
+
return Qn;
|
|
2367
2370
|
}
|
|
2368
2371
|
}
|
|
2369
|
-
const
|
|
2372
|
+
const Ls = [
|
|
2370
2373
|
"in",
|
|
2371
2374
|
"$in",
|
|
2372
2375
|
"$not",
|
|
@@ -2374,77 +2377,77 @@ const Us = [
|
|
|
2374
2377
|
"$comparator"
|
|
2375
2378
|
// covers all of $gt, $lt, etc.
|
|
2376
2379
|
];
|
|
2377
|
-
function
|
|
2378
|
-
for (const e of
|
|
2380
|
+
function Fs(t) {
|
|
2381
|
+
for (const e of Ls)
|
|
2379
2382
|
if (t.hasOwnProperty(e))
|
|
2380
2383
|
return !0;
|
|
2381
2384
|
return !1;
|
|
2382
2385
|
}
|
|
2383
|
-
function
|
|
2384
|
-
return n ? typeof t == "object" ?
|
|
2386
|
+
function Gr(t, e, n) {
|
|
2387
|
+
return n ? typeof t == "object" ? Fs(t) ? n : null : Us(t)(t, e, n) : null;
|
|
2385
2388
|
}
|
|
2386
|
-
function
|
|
2389
|
+
function Ns(t, e, n) {
|
|
2387
2390
|
return t.reduce((r, i, s) => {
|
|
2388
2391
|
const o = e[s];
|
|
2389
|
-
return
|
|
2392
|
+
return Gr(i, o, r);
|
|
2390
2393
|
}, n);
|
|
2391
2394
|
}
|
|
2392
|
-
function Ns(t, e, n) {
|
|
2393
|
-
return zs(t, e, n).map((r) => Fs(e, r, n)).filter((r) => r);
|
|
2394
|
-
}
|
|
2395
2395
|
function Ks(t, e, n) {
|
|
2396
|
-
return
|
|
2396
|
+
return Vs(t, e, n).map((r) => Ns(e, r, n)).filter((r) => r);
|
|
2397
2397
|
}
|
|
2398
|
-
function
|
|
2399
|
-
return e.reduce((r, i) =>
|
|
2398
|
+
function qs(t, e, n) {
|
|
2399
|
+
return e.or ? e.or.patterns.flatMap((r) => Vt(t, r, n)) : e.and ? e.and.patterns.reduce((r, i) => Vt(t, i, r), n) : n.flatMap((r) => Ks(t, e, r));
|
|
2400
2400
|
}
|
|
2401
|
-
function
|
|
2402
|
-
return
|
|
2401
|
+
function Vt(t, e, n = [{}]) {
|
|
2402
|
+
return e.reduce((r, i) => qs(t, i, r), n);
|
|
2403
2403
|
}
|
|
2404
|
-
function
|
|
2405
|
-
return
|
|
2404
|
+
function hn(t, e) {
|
|
2405
|
+
return Array.isArray(e) ? e.map((n) => hn(t, n)) : xs(e) ? t[e] : e;
|
|
2406
2406
|
}
|
|
2407
|
-
function zs(t, e, n) {
|
|
2408
|
-
return
|
|
2407
|
+
function zs(t, { find: e, where: n }) {
|
|
2408
|
+
return Vt(t, n).map((i) => hn(i, e));
|
|
2409
2409
|
}
|
|
2410
|
-
|
|
2410
|
+
function Vs(t, e, n) {
|
|
2411
|
+
return Ps(t, hn(n, e));
|
|
2412
|
+
}
|
|
2413
|
+
const Ws = /^(?:[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
2414
|
function Ee(t) {
|
|
2412
|
-
return typeof t == "string" &&
|
|
2415
|
+
return typeof t == "string" && Ws.test(t);
|
|
2413
2416
|
}
|
|
2414
2417
|
const F = [];
|
|
2415
2418
|
for (let t = 0; t < 256; ++t)
|
|
2416
2419
|
F.push((t + 256).toString(16).slice(1));
|
|
2417
|
-
function
|
|
2420
|
+
function Bs(t, e = 0) {
|
|
2418
2421
|
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
2422
|
}
|
|
2420
|
-
let
|
|
2421
|
-
const
|
|
2422
|
-
function
|
|
2423
|
-
if (!
|
|
2423
|
+
let Ct;
|
|
2424
|
+
const Gs = new Uint8Array(16);
|
|
2425
|
+
function Qs() {
|
|
2426
|
+
if (!Ct) {
|
|
2424
2427
|
if (typeof crypto > "u" || !crypto.getRandomValues)
|
|
2425
2428
|
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
2426
|
-
|
|
2429
|
+
Ct = crypto.getRandomValues.bind(crypto);
|
|
2427
2430
|
}
|
|
2428
|
-
return
|
|
2431
|
+
return Ct(Gs);
|
|
2429
2432
|
}
|
|
2430
|
-
const
|
|
2431
|
-
function
|
|
2433
|
+
const Hs = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), Hn = { randomUUID: Hs };
|
|
2434
|
+
function Ys(t, e, n) {
|
|
2432
2435
|
var i;
|
|
2433
|
-
if (
|
|
2434
|
-
return
|
|
2436
|
+
if (Hn.randomUUID && !t)
|
|
2437
|
+
return Hn.randomUUID();
|
|
2435
2438
|
t = t || {};
|
|
2436
|
-
const r = t.random ?? ((i = t.rng) == null ? void 0 : i.call(t)) ??
|
|
2439
|
+
const r = t.random ?? ((i = t.rng) == null ? void 0 : i.call(t)) ?? Qs();
|
|
2437
2440
|
if (r.length < 16)
|
|
2438
2441
|
throw new Error("Random bytes length must be >= 16");
|
|
2439
|
-
return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128,
|
|
2442
|
+
return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128, Bs(r);
|
|
2440
2443
|
}
|
|
2441
|
-
function
|
|
2444
|
+
function Yn(t) {
|
|
2442
2445
|
const e = t.replace(/-/g, ""), n = [];
|
|
2443
2446
|
for (let r = 0; r < e.length; r += 2)
|
|
2444
2447
|
n.push(parseInt(e.substring(r, r + 2), 16));
|
|
2445
2448
|
return n;
|
|
2446
2449
|
}
|
|
2447
|
-
function
|
|
2450
|
+
function Js(t, e) {
|
|
2448
2451
|
for (let n = 0; n < t.length; n++) {
|
|
2449
2452
|
if (t[n] < e[n])
|
|
2450
2453
|
return -1;
|
|
@@ -2453,17 +2456,17 @@ function Ys(t, e) {
|
|
|
2453
2456
|
}
|
|
2454
2457
|
return 0;
|
|
2455
2458
|
}
|
|
2456
|
-
function
|
|
2457
|
-
return
|
|
2459
|
+
function Zs(t, e) {
|
|
2460
|
+
return Js(Yn(t), Yn(e));
|
|
2458
2461
|
}
|
|
2459
2462
|
function L() {
|
|
2460
|
-
return
|
|
2463
|
+
return Ys();
|
|
2461
2464
|
}
|
|
2462
|
-
function
|
|
2465
|
+
function Xs(t, e) {
|
|
2463
2466
|
return t.localeCompare(e);
|
|
2464
2467
|
}
|
|
2465
|
-
function
|
|
2466
|
-
let t =
|
|
2468
|
+
function eo() {
|
|
2469
|
+
let t = Xs;
|
|
2467
2470
|
if (typeof Intl == "object" && Intl.hasOwnProperty("Collator"))
|
|
2468
2471
|
try {
|
|
2469
2472
|
t = Intl.Collator("en-US").compare;
|
|
@@ -2471,10 +2474,10 @@ function Xs() {
|
|
|
2471
2474
|
}
|
|
2472
2475
|
return t;
|
|
2473
2476
|
}
|
|
2474
|
-
const
|
|
2475
|
-
let
|
|
2477
|
+
const to = eo();
|
|
2478
|
+
let no = 0;
|
|
2476
2479
|
function Ke(t) {
|
|
2477
|
-
return yt(`_${t}`,
|
|
2480
|
+
return yt(`_${t}`, no++);
|
|
2478
2481
|
}
|
|
2479
2482
|
function yt(t, e) {
|
|
2480
2483
|
return `?${t}-${e}`;
|
|
@@ -2484,28 +2487,28 @@ class Ae extends Error {
|
|
|
2484
2487
|
super(e), this.name = "AttrNotFoundError";
|
|
2485
2488
|
}
|
|
2486
2489
|
}
|
|
2487
|
-
function
|
|
2488
|
-
const n =
|
|
2490
|
+
function ro(t, e) {
|
|
2491
|
+
const n = Br(t, e);
|
|
2489
2492
|
if (!n)
|
|
2490
2493
|
throw new Ae(`Could not find id attr for ${e}`);
|
|
2491
2494
|
return n;
|
|
2492
2495
|
}
|
|
2493
|
-
function
|
|
2494
|
-
return [
|
|
2496
|
+
function Jn(t, e, n, r) {
|
|
2497
|
+
return [io(t, e, n, r)];
|
|
2495
2498
|
}
|
|
2496
|
-
function
|
|
2499
|
+
function io(t, e, n, r) {
|
|
2497
2500
|
return [
|
|
2498
2501
|
t(n, r),
|
|
2499
|
-
|
|
2502
|
+
ro(e, n).id,
|
|
2500
2503
|
t(n, r),
|
|
2501
2504
|
t("time", r)
|
|
2502
2505
|
];
|
|
2503
2506
|
}
|
|
2504
|
-
function
|
|
2507
|
+
function so(t, e, n) {
|
|
2505
2508
|
return t.map((r) => r === e ? n : r);
|
|
2506
2509
|
}
|
|
2507
|
-
function
|
|
2508
|
-
const s = fe(e, n, i), o =
|
|
2510
|
+
function Qr(t, e, n, r, i) {
|
|
2511
|
+
const s = fe(e, n, i), o = Wr(e, n, i), u = s || o;
|
|
2509
2512
|
if (!u)
|
|
2510
2513
|
throw new Ae(`Could not find attr for ${[n, i]}`);
|
|
2511
2514
|
if (u["value-type"] !== "ref")
|
|
@@ -2523,7 +2526,7 @@ function Gr(t, e, n, r, i) {
|
|
|
2523
2526
|
];
|
|
2524
2527
|
return [s ? f : d, l, p, u, !!s];
|
|
2525
2528
|
}
|
|
2526
|
-
function
|
|
2529
|
+
function Zn(t, e) {
|
|
2527
2530
|
if (typeof e != "string")
|
|
2528
2531
|
return function(o) {
|
|
2529
2532
|
return !1;
|
|
@@ -2533,7 +2536,7 @@ function Jn(t, e) {
|
|
|
2533
2536
|
return typeof o != "string" ? !1 : i.test(o);
|
|
2534
2537
|
};
|
|
2535
2538
|
}
|
|
2536
|
-
function
|
|
2539
|
+
function oo(t, e) {
|
|
2537
2540
|
if (typeof e != "object" || e.hasOwnProperty("$in") || e.hasOwnProperty("in"))
|
|
2538
2541
|
return e;
|
|
2539
2542
|
const n = t["checked-data-type"] === "date";
|
|
@@ -2574,7 +2577,7 @@ function so(t, e) {
|
|
|
2574
2577
|
}
|
|
2575
2578
|
};
|
|
2576
2579
|
if (e.hasOwnProperty("$like")) {
|
|
2577
|
-
const r =
|
|
2580
|
+
const r = Zn(!0, e.$like);
|
|
2578
2581
|
return {
|
|
2579
2582
|
$comparator: !0,
|
|
2580
2583
|
$op: function(s) {
|
|
@@ -2583,7 +2586,7 @@ function so(t, e) {
|
|
|
2583
2586
|
};
|
|
2584
2587
|
}
|
|
2585
2588
|
if (e.hasOwnProperty("$ilike")) {
|
|
2586
|
-
const r =
|
|
2589
|
+
const r = Zn(!1, e.$ilike);
|
|
2587
2590
|
return {
|
|
2588
2591
|
$comparator: !0,
|
|
2589
2592
|
$op: function(s) {
|
|
@@ -2593,8 +2596,8 @@ function so(t, e) {
|
|
|
2593
2596
|
}
|
|
2594
2597
|
return e;
|
|
2595
2598
|
}
|
|
2596
|
-
function
|
|
2597
|
-
const o = fe(e, n, i), u =
|
|
2599
|
+
function uo(t, e, n, r, i, s) {
|
|
2600
|
+
const o = fe(e, n, i), u = Wr(e, n, i), a = o || u;
|
|
2598
2601
|
if (!a)
|
|
2599
2602
|
throw new Ae(`No attr for etype = ${n} label = ${i}`);
|
|
2600
2603
|
if (s != null && s.hasOwnProperty("$isNull")) {
|
|
@@ -2611,63 +2614,63 @@ function oo(t, e, n, r, i, s) {
|
|
|
2611
2614
|
return o ? [
|
|
2612
2615
|
t(n, r),
|
|
2613
2616
|
a.id,
|
|
2614
|
-
|
|
2617
|
+
oo(a, s),
|
|
2615
2618
|
Ke("time")
|
|
2616
2619
|
] : [s, a.id, t(n, r), Ke("time")];
|
|
2617
2620
|
}
|
|
2618
|
-
function
|
|
2621
|
+
function ao(t, e, n, r, i) {
|
|
2619
2622
|
const [s, o, u] = i.reduce((a, d) => {
|
|
2620
|
-
const [c, f, l] = a, [p, y, b] =
|
|
2623
|
+
const [c, f, l] = a, [p, y, b] = Qr(t, e, c, f, d);
|
|
2621
2624
|
return [p, y, [...l, b]];
|
|
2622
2625
|
}, [n, r, []]);
|
|
2623
2626
|
return [s, o, u];
|
|
2624
2627
|
}
|
|
2625
|
-
function
|
|
2626
|
-
const o = i.slice(0, i.length - 1), u = i[i.length - 1], [a, d, c] =
|
|
2628
|
+
function Wt(t, e, n, r, i, s) {
|
|
2629
|
+
const o = i.slice(0, i.length - 1), u = i[i.length - 1], [a, d, c] = ao(t, e, n, r, o), f = uo(t, e, a, d, u, s);
|
|
2627
2630
|
return c.concat([f]);
|
|
2628
2631
|
}
|
|
2629
|
-
function
|
|
2632
|
+
function co(t, e) {
|
|
2630
2633
|
return e ? [e].concat(t) : t;
|
|
2631
2634
|
}
|
|
2632
|
-
function
|
|
2635
|
+
function fo([t, e]) {
|
|
2633
2636
|
return t === "or" && Array.isArray(e);
|
|
2634
2637
|
}
|
|
2635
|
-
function
|
|
2638
|
+
function lo([t, e]) {
|
|
2636
2639
|
return t === "and" && Array.isArray(e);
|
|
2637
2640
|
}
|
|
2638
|
-
function
|
|
2641
|
+
function ho(t, e, n) {
|
|
2639
2642
|
return (r, i) => {
|
|
2640
2643
|
const s = t(r, i);
|
|
2641
2644
|
return e == s ? s : `${s}-${n}`;
|
|
2642
2645
|
};
|
|
2643
2646
|
}
|
|
2644
|
-
function
|
|
2647
|
+
function Xn(t, e, n, r, i, s) {
|
|
2645
2648
|
const o = t(r, i), u = s.map((a, d) => {
|
|
2646
|
-
const c =
|
|
2647
|
-
return
|
|
2649
|
+
const c = ho(t, o, d);
|
|
2650
|
+
return Hr(c, n, r, i, a);
|
|
2648
2651
|
});
|
|
2649
2652
|
return { [e]: { patterns: u, joinSym: o } };
|
|
2650
2653
|
}
|
|
2651
|
-
function
|
|
2654
|
+
function po(t) {
|
|
2652
2655
|
const e = [];
|
|
2653
2656
|
for (let n = 1; n <= t.length; n++)
|
|
2654
2657
|
e.push(t.slice(0, n));
|
|
2655
2658
|
return e;
|
|
2656
2659
|
}
|
|
2657
|
-
function
|
|
2658
|
-
return
|
|
2660
|
+
function er(t, e, n, r, i) {
|
|
2661
|
+
return po(i).map((s) => Wt(t, e, n, r, s, { $isNull: !0 }));
|
|
2659
2662
|
}
|
|
2660
|
-
function
|
|
2663
|
+
function Hr(t, e, n, r, i) {
|
|
2661
2664
|
return Object.entries(i).flatMap(([s, o]) => {
|
|
2662
|
-
if (co([s, o]))
|
|
2663
|
-
return Zn(t, "or", e, n, r, o);
|
|
2664
2665
|
if (fo([s, o]))
|
|
2665
|
-
return
|
|
2666
|
+
return Xn(t, "or", e, n, r, o);
|
|
2667
|
+
if (lo([s, o]))
|
|
2668
|
+
return Xn(t, "and", e, n, r, o);
|
|
2666
2669
|
if (s === "$entityIdStartsWith")
|
|
2667
2670
|
return [];
|
|
2668
2671
|
const u = s.split(".");
|
|
2669
2672
|
if (o != null && o.hasOwnProperty("$ne") && (o = Object.assign(Object.assign({}, o), { $not: o.$ne }), delete o.$ne), o != null && o.hasOwnProperty("$not")) {
|
|
2670
|
-
const a =
|
|
2673
|
+
const a = Wt(t, e, n, r, u, o), d = er(t, e, n, r, u);
|
|
2671
2674
|
return [
|
|
2672
2675
|
{
|
|
2673
2676
|
or: {
|
|
@@ -2680,32 +2683,32 @@ function Qr(t, e, n, r, i) {
|
|
|
2680
2683
|
return o != null && o.hasOwnProperty("$isNull") && o.$isNull === !0 && u.length > 1 ? [
|
|
2681
2684
|
{
|
|
2682
2685
|
or: {
|
|
2683
|
-
patterns:
|
|
2686
|
+
patterns: er(t, e, n, r, u),
|
|
2684
2687
|
joinSym: t(n, r)
|
|
2685
2688
|
}
|
|
2686
2689
|
}
|
|
2687
|
-
] :
|
|
2690
|
+
] : Wt(t, e, n, r, u, o);
|
|
2688
2691
|
});
|
|
2689
2692
|
}
|
|
2690
|
-
function
|
|
2693
|
+
function yo(t, e, n, r) {
|
|
2691
2694
|
const i = yt;
|
|
2692
|
-
return r ?
|
|
2695
|
+
return r ? Hr(i, t, e, n, r).concat(Jn(i, t, e, n)) : Jn(i, t, e, n);
|
|
2693
2696
|
}
|
|
2694
|
-
function
|
|
2697
|
+
function bo(t, e, n) {
|
|
2695
2698
|
return [t(e, n), t("time", n)];
|
|
2696
2699
|
}
|
|
2697
|
-
function
|
|
2698
|
-
const [o, u, a, d, c] =
|
|
2700
|
+
function _o(t, e, n, r, i, s) {
|
|
2701
|
+
const [o, u, a, d, c] = Qr(t, e, n, r, i), f = so(a, t(n, r), s);
|
|
2699
2702
|
return [o, u, f, d, c];
|
|
2700
2703
|
}
|
|
2701
|
-
function
|
|
2704
|
+
function go(t, e, { etype: n, level: r, form: i }, s) {
|
|
2702
2705
|
const o = Object.keys(i).filter((u) => u !== "$");
|
|
2703
2706
|
return o.length ? Object.entries(s).map(function([a, d]) {
|
|
2704
2707
|
return o.map(function(l) {
|
|
2705
2708
|
var p, y, b;
|
|
2706
2709
|
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
2710
|
try {
|
|
2708
|
-
const [m, T, v] =
|
|
2711
|
+
const [m, T, v] = _o(t, e, n, r, l, a), j = Jr(e, {
|
|
2709
2712
|
etype: m,
|
|
2710
2713
|
level: T,
|
|
2711
2714
|
form: i[l],
|
|
@@ -2722,48 +2725,48 @@ function _o(t, e, { etype: n, level: r, form: i }, s) {
|
|
|
2722
2725
|
}, d);
|
|
2723
2726
|
}) : Object.values(s);
|
|
2724
2727
|
}
|
|
2725
|
-
function
|
|
2726
|
-
return n === "string" ?
|
|
2728
|
+
function To(t, e, n) {
|
|
2729
|
+
return n === "string" ? to(t, e) : t > e ? 1 : -1;
|
|
2727
2730
|
}
|
|
2728
2731
|
function Fe(t, e, n, r, i) {
|
|
2729
|
-
return e === r || e == null && r == null ?
|
|
2732
|
+
return e === r || e == null && r == null ? Zs(t, n) : r == null ? 1 : e == null ? -1 : To(e, r, i);
|
|
2730
2733
|
}
|
|
2731
2734
|
function lt([t, e], [n, r], i) {
|
|
2732
2735
|
return Fe(t, e, n, r, i);
|
|
2733
2736
|
}
|
|
2734
|
-
function
|
|
2737
|
+
function Bt(t) {
|
|
2735
2738
|
return t == null ? t : new Date(t).getTime();
|
|
2736
2739
|
}
|
|
2737
|
-
function
|
|
2740
|
+
function mo(t, e, n, r) {
|
|
2738
2741
|
var i;
|
|
2739
2742
|
const [s, o, u, a] = t, d = n === "desc" ? 1 : -1;
|
|
2740
2743
|
if (((i = e["forward-identity"]) === null || i === void 0 ? void 0 : i[2]) === "id")
|
|
2741
2744
|
return lt(r, [s, a], null) === d;
|
|
2742
|
-
const [c, f] = r, l = e["checked-data-type"], p = l === "date" ?
|
|
2745
|
+
const [c, f] = r, l = e["checked-data-type"], p = l === "date" ? Bt(f) : f, y = l === "date" ? Bt(u) : u;
|
|
2743
2746
|
return lt([c, p], [s, y], l) === d;
|
|
2744
2747
|
}
|
|
2745
|
-
function
|
|
2748
|
+
function wo(t, e) {
|
|
2746
2749
|
const n = e[1];
|
|
2747
2750
|
return t.attrs[n];
|
|
2748
2751
|
}
|
|
2749
|
-
function
|
|
2752
|
+
function vo(t, e, n) {
|
|
2750
2753
|
const r = Object.keys(n)[0];
|
|
2751
2754
|
return fe(t, e, r);
|
|
2752
2755
|
}
|
|
2753
|
-
function
|
|
2756
|
+
function So(t, e, n, r) {
|
|
2754
2757
|
if (n)
|
|
2755
|
-
return
|
|
2758
|
+
return wo(t, n);
|
|
2756
2759
|
if (r)
|
|
2757
|
-
return
|
|
2760
|
+
return vo(t, e, r);
|
|
2758
2761
|
}
|
|
2759
|
-
function
|
|
2762
|
+
function Oo(t, e, n) {
|
|
2760
2763
|
var r, i;
|
|
2761
2764
|
if (!Array.isArray(n.fields))
|
|
2762
|
-
return
|
|
2765
|
+
return Ms(t, e);
|
|
2763
2766
|
const s = /* @__PURE__ */ new Map();
|
|
2764
2767
|
for (const o of n.fields) {
|
|
2765
2768
|
const u = fe(t, e, o), a = (r = u == null ? void 0 : u["forward-identity"]) === null || r === void 0 ? void 0 : r[2];
|
|
2766
|
-
a &&
|
|
2769
|
+
a && fn(u) && s.set(a, u);
|
|
2767
2770
|
}
|
|
2768
2771
|
if (!s.has("id")) {
|
|
2769
2772
|
const o = fe(t, e, "id"), u = (i = o == null ? void 0 : o["forward-identity"]) === null || i === void 0 ? void 0 : i[2];
|
|
@@ -2771,17 +2774,17 @@ function So(t, e, n) {
|
|
|
2771
2774
|
}
|
|
2772
2775
|
return s;
|
|
2773
2776
|
}
|
|
2774
|
-
function
|
|
2777
|
+
function Eo(t, { etype: e, pageInfo: n, dq: r, form: i }) {
|
|
2775
2778
|
var s, o;
|
|
2776
|
-
const u = (s = i == null ? void 0 : i.$) === null || s === void 0 ? void 0 : s.order, a =
|
|
2777
|
-
let c =
|
|
2778
|
-
const f = n == null ? void 0 : n["start-cursor"], l =
|
|
2779
|
+
const u = (s = i == null ? void 0 : i.$) === null || s === void 0 ? void 0 : s.order, a = Yr(i), d = Ao(i);
|
|
2780
|
+
let c = zs(t, r);
|
|
2781
|
+
const f = n == null ? void 0 : n["start-cursor"], l = So(t, e, f, u);
|
|
2779
2782
|
if (l && ((o = l == null ? void 0 : l["forward-identity"]) === null || o === void 0 ? void 0 : o[2]) !== "id") {
|
|
2780
2783
|
const b = l["checked-data-type"] === "date", g = l.id;
|
|
2781
2784
|
c = c.map(([m]) => {
|
|
2782
2785
|
var T, v, j, S, I;
|
|
2783
2786
|
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 =
|
|
2787
|
+
return b && (R = Bt(R)), [m, R];
|
|
2785
2788
|
});
|
|
2786
2789
|
}
|
|
2787
2790
|
c.sort(d === "asc" ? function(g, m) {
|
|
@@ -2790,31 +2793,31 @@ function Oo(t, { etype: e, pageInfo: n, dq: r, form: i }) {
|
|
|
2790
2793
|
return lt(m, g, l == null ? void 0 : l["checked-data-type"]);
|
|
2791
2794
|
});
|
|
2792
2795
|
let p = {};
|
|
2793
|
-
const y =
|
|
2796
|
+
const y = Oo(t, e, r);
|
|
2794
2797
|
for (const b of c) {
|
|
2795
2798
|
const [g] = b;
|
|
2796
|
-
if (p[g] || !a && f && l &&
|
|
2799
|
+
if (p[g] || !a && f && l && mo(f, l, d, b))
|
|
2797
2800
|
continue;
|
|
2798
|
-
const m =
|
|
2801
|
+
const m = Is(t, y, g);
|
|
2799
2802
|
m && (p[g] = m);
|
|
2800
2803
|
}
|
|
2801
2804
|
return p;
|
|
2802
2805
|
}
|
|
2803
|
-
function
|
|
2806
|
+
function Ao(t) {
|
|
2804
2807
|
var e;
|
|
2805
2808
|
const n = (e = t.$) === null || e === void 0 ? void 0 : e.order;
|
|
2806
2809
|
return n && n[Object.keys(n)[0]] || "asc";
|
|
2807
2810
|
}
|
|
2808
|
-
function
|
|
2811
|
+
function Yr(t) {
|
|
2809
2812
|
var e, n, r;
|
|
2810
2813
|
const i = (e = t.$) === null || e === void 0 ? void 0 : e.offset, s = (n = t.$) === null || n === void 0 ? void 0 : n.before, o = (r = t.$) === null || r === void 0 ? void 0 : r.after;
|
|
2811
2814
|
return !i && !s && !o;
|
|
2812
2815
|
}
|
|
2813
|
-
function
|
|
2816
|
+
function ko(t, { etype: e, level: n, form: r, join: i, pageInfo: s }) {
|
|
2814
2817
|
var o, u, a, d, c;
|
|
2815
|
-
if (!
|
|
2818
|
+
if (!Yr(r) && (!s || !s["start-cursor"]))
|
|
2816
2819
|
return [];
|
|
2817
|
-
const f =
|
|
2820
|
+
const f = co(yo(t, e, n, (o = r.$) === null || o === void 0 ? void 0 : o.where), i), l = bo(yt, e, n), p = (u = r.$) === null || u === void 0 ? void 0 : u.fields, y = Eo(t, {
|
|
2818
2821
|
etype: e,
|
|
2819
2822
|
pageInfo: s,
|
|
2820
2823
|
form: r,
|
|
@@ -2827,20 +2830,20 @@ function Ao(t, { etype: e, level: n, form: r, join: i, pageInfo: s }) {
|
|
|
2827
2830
|
}
|
|
2828
2831
|
return y;
|
|
2829
2832
|
}
|
|
2830
|
-
function
|
|
2833
|
+
function jo(t, e) {
|
|
2831
2834
|
try {
|
|
2832
|
-
return
|
|
2835
|
+
return ko(t, e);
|
|
2833
2836
|
} catch (n) {
|
|
2834
2837
|
if (n instanceof Ae)
|
|
2835
2838
|
return {};
|
|
2836
2839
|
throw n;
|
|
2837
2840
|
}
|
|
2838
2841
|
}
|
|
2839
|
-
function
|
|
2840
|
-
const n =
|
|
2841
|
-
return
|
|
2842
|
+
function Jr(t, e) {
|
|
2843
|
+
const n = jo(t, e);
|
|
2844
|
+
return go(yt, t, e, n);
|
|
2842
2845
|
}
|
|
2843
|
-
function
|
|
2846
|
+
function Co(t) {
|
|
2844
2847
|
const e = {};
|
|
2845
2848
|
for (const [n, r] of Object.entries(t))
|
|
2846
2849
|
e[n] = {
|
|
@@ -2851,18 +2854,18 @@ function jo(t) {
|
|
|
2851
2854
|
};
|
|
2852
2855
|
return e;
|
|
2853
2856
|
}
|
|
2854
|
-
function
|
|
2857
|
+
function Zr({ store: t, pageInfo: e, aggregate: n }, r) {
|
|
2855
2858
|
const s = { data: Object.keys(r).reduce(function(u, a) {
|
|
2856
|
-
return n != null && n[a] || a === "$$ruleParams" || (u[a] =
|
|
2859
|
+
return n != null && n[a] || a === "$$ruleParams" || (u[a] = Jr(t, {
|
|
2857
2860
|
etype: a,
|
|
2858
2861
|
form: r[a],
|
|
2859
2862
|
level: 0,
|
|
2860
2863
|
pageInfo: e == null ? void 0 : e[a]
|
|
2861
2864
|
})), u;
|
|
2862
2865
|
}, {}) };
|
|
2863
|
-
return e && (s.pageInfo =
|
|
2866
|
+
return e && (s.pageInfo = Co(e)), n && (s.aggregate = n), s;
|
|
2864
2867
|
}
|
|
2865
|
-
function
|
|
2868
|
+
function Po() {
|
|
2866
2869
|
const e = {
|
|
2867
2870
|
__etype: 1,
|
|
2868
2871
|
__ops: 1,
|
|
@@ -2876,8 +2879,8 @@ function Co() {
|
|
|
2876
2879
|
};
|
|
2877
2880
|
return new Set(Object.keys(e));
|
|
2878
2881
|
}
|
|
2879
|
-
const
|
|
2880
|
-
function
|
|
2882
|
+
const Io = Po();
|
|
2883
|
+
function Gt(t, e, n) {
|
|
2881
2884
|
const r = {
|
|
2882
2885
|
__etype: t,
|
|
2883
2886
|
__ops: n
|
|
@@ -2888,8 +2891,8 @@ function Bt(t, e, n) {
|
|
|
2888
2891
|
return n;
|
|
2889
2892
|
if (s === "__etype")
|
|
2890
2893
|
return t;
|
|
2891
|
-
if (
|
|
2892
|
-
return (o, u) =>
|
|
2894
|
+
if (Io.has(s))
|
|
2895
|
+
return (o, u) => Gt(t, e, [
|
|
2893
2896
|
...n,
|
|
2894
2897
|
u ? [s, t, e, o, u] : [s, t, e, o]
|
|
2895
2898
|
]);
|
|
@@ -2899,11 +2902,11 @@ function Bt(t, e, n) {
|
|
|
2899
2902
|
function ht(t) {
|
|
2900
2903
|
return t.startsWith("lookup__");
|
|
2901
2904
|
}
|
|
2902
|
-
function
|
|
2905
|
+
function Xr(t) {
|
|
2903
2906
|
const [e, n, ...r] = t.split("__");
|
|
2904
2907
|
return [n, JSON.parse(r.join("__"))];
|
|
2905
2908
|
}
|
|
2906
|
-
function
|
|
2909
|
+
function Mo(t) {
|
|
2907
2910
|
return new Proxy({
|
|
2908
2911
|
__etype: t
|
|
2909
2912
|
}, {
|
|
@@ -2911,22 +2914,22 @@ function Io(t) {
|
|
|
2911
2914
|
if (n === "__etype")
|
|
2912
2915
|
return t;
|
|
2913
2916
|
const r = n;
|
|
2914
|
-
return ht(r) ?
|
|
2917
|
+
return ht(r) ? Gt(t, Xr(r), []) : Gt(t, r, []);
|
|
2915
2918
|
}
|
|
2916
2919
|
});
|
|
2917
2920
|
}
|
|
2918
|
-
function
|
|
2921
|
+
function pn() {
|
|
2919
2922
|
return new Proxy({}, {
|
|
2920
2923
|
get(t, e) {
|
|
2921
|
-
return
|
|
2924
|
+
return Mo(e);
|
|
2922
2925
|
}
|
|
2923
2926
|
});
|
|
2924
2927
|
}
|
|
2925
|
-
|
|
2926
|
-
function
|
|
2928
|
+
pn();
|
|
2929
|
+
function Ro(t) {
|
|
2927
2930
|
return t.__ops;
|
|
2928
2931
|
}
|
|
2929
|
-
function
|
|
2932
|
+
function $o(t, e) {
|
|
2930
2933
|
const { attrIdMap: n, refSwapAttrIds: r } = t, i = [];
|
|
2931
2934
|
for (const o of e) {
|
|
2932
2935
|
const u = n[o];
|
|
@@ -2960,7 +2963,7 @@ function _e(t, e, n) {
|
|
|
2960
2963
|
return o === e && u === n;
|
|
2961
2964
|
});
|
|
2962
2965
|
}
|
|
2963
|
-
function
|
|
2966
|
+
function xo(t) {
|
|
2964
2967
|
if (Array.isArray(t))
|
|
2965
2968
|
return t;
|
|
2966
2969
|
const e = Object.entries(t);
|
|
@@ -2968,38 +2971,38 @@ function $o(t) {
|
|
|
2968
2971
|
throw new Error("lookup must be an object with a single unique attr and value.");
|
|
2969
2972
|
return e[0];
|
|
2970
2973
|
}
|
|
2971
|
-
function
|
|
2974
|
+
function Qt(t, e, n) {
|
|
2972
2975
|
return n.indexOf(".") !== -1 && // attr names can have `.` in them, so use the attr we find with a `.`
|
|
2973
2976
|
// before assuming it's a ref lookup.
|
|
2974
2977
|
!K(t, e, n);
|
|
2975
2978
|
}
|
|
2976
|
-
function
|
|
2979
|
+
function Ht(t) {
|
|
2977
2980
|
const [e, n, ...r] = t.split(".");
|
|
2978
2981
|
if (r.length > 0 || n !== "id")
|
|
2979
2982
|
throw new Error(`${t} is not a valid lookup attribute.`);
|
|
2980
2983
|
return e;
|
|
2981
2984
|
}
|
|
2982
|
-
function
|
|
2983
|
-
if (!
|
|
2985
|
+
function Do(t, e, n) {
|
|
2986
|
+
if (!Qt(t, e, n))
|
|
2984
2987
|
return K(t, e, n);
|
|
2985
|
-
const r =
|
|
2988
|
+
const r = Ht(n), i = K(t, e, r) || _e(t, e, r);
|
|
2986
2989
|
if (i && i["value-type"] !== "ref")
|
|
2987
2990
|
throw new Error(`${n} does not reference a valid link attribute.`);
|
|
2988
2991
|
return i;
|
|
2989
2992
|
}
|
|
2990
|
-
function
|
|
2991
|
-
return typeof t == "string" && !ht(t) ? null : typeof t == "string" && ht(t) ?
|
|
2993
|
+
function Yt(t) {
|
|
2994
|
+
return typeof t == "string" && !ht(t) ? null : typeof t == "string" && ht(t) ? Xr(t) : xo(t);
|
|
2992
2995
|
}
|
|
2993
2996
|
function Q(t, e, n) {
|
|
2994
|
-
const r =
|
|
2997
|
+
const r = Yt(n);
|
|
2995
2998
|
if (r === null)
|
|
2996
2999
|
return n;
|
|
2997
|
-
const [i, s] = r, o =
|
|
3000
|
+
const [i, s] = r, o = Do(t, e, i);
|
|
2998
3001
|
if (!o || !o["unique?"])
|
|
2999
3002
|
throw new Error(`${i} is not a unique attribute.`);
|
|
3000
3003
|
return [o.id, s];
|
|
3001
3004
|
}
|
|
3002
|
-
function
|
|
3005
|
+
function ei(t, e, n, r) {
|
|
3003
3006
|
const i = Q(t, e, n);
|
|
3004
3007
|
return Array.isArray(i) ? [[
|
|
3005
3008
|
"add-triple",
|
|
@@ -3008,7 +3011,7 @@ function Xr(t, e, n, r) {
|
|
|
3008
3011
|
i
|
|
3009
3012
|
]].concat(r) : r;
|
|
3010
3013
|
}
|
|
3011
|
-
function
|
|
3014
|
+
function Uo({ attrs: t }, [e, n, r]) {
|
|
3012
3015
|
const i = Object.entries(r).flatMap(([s, o]) => {
|
|
3013
3016
|
const u = Array.isArray(o) ? o : [o], a = K(t, e, s), d = _e(t, e, s);
|
|
3014
3017
|
return u.map((c) => a ? [
|
|
@@ -3023,9 +3026,9 @@ function Do({ attrs: t }, [e, n, r]) {
|
|
|
3023
3026
|
Q(t, e, n)
|
|
3024
3027
|
]);
|
|
3025
3028
|
});
|
|
3026
|
-
return
|
|
3029
|
+
return ei(t, e, n, i);
|
|
3027
3030
|
}
|
|
3028
|
-
function
|
|
3031
|
+
function Lo({ attrs: t }, [e, n, r]) {
|
|
3029
3032
|
const i = Object.entries(r).flatMap(([s, o]) => {
|
|
3030
3033
|
const u = Array.isArray(o) ? o : [o], a = K(t, e, s), d = _e(t, e, s);
|
|
3031
3034
|
return u.map((c) => a ? [
|
|
@@ -3040,9 +3043,9 @@ function Uo({ attrs: t }, [e, n, r]) {
|
|
|
3040
3043
|
Q(t, e, n)
|
|
3041
3044
|
]);
|
|
3042
3045
|
});
|
|
3043
|
-
return
|
|
3046
|
+
return ei(t, e, n, i);
|
|
3044
3047
|
}
|
|
3045
|
-
function
|
|
3048
|
+
function Fo(t, e, n) {
|
|
3046
3049
|
if (Array.isArray(n)) {
|
|
3047
3050
|
const [r, i] = n;
|
|
3048
3051
|
for (const s of t || []) {
|
|
@@ -3064,18 +3067,18 @@ function Lo(t, e, n) {
|
|
|
3064
3067
|
}
|
|
3065
3068
|
return !1;
|
|
3066
3069
|
}
|
|
3067
|
-
function
|
|
3068
|
-
return (s == null ? void 0 : s.upsert) === !1 ? { mode: "update" } : (s == null ? void 0 : s.upsert) === !0 ? null :
|
|
3070
|
+
function ti({ stores: t, attrs: e }, [n, r, i, s]) {
|
|
3071
|
+
return (s == null ? void 0 : s.upsert) === !1 ? { mode: "update" } : (s == null ? void 0 : s.upsert) === !0 ? null : Fo(t, n, r) ? { mode: "update" } : null;
|
|
3069
3072
|
}
|
|
3070
|
-
function
|
|
3071
|
-
const { stores: n, attrs: r } = t, [i, s, o, u] = e, a =
|
|
3073
|
+
function No(t, e) {
|
|
3074
|
+
const { stores: n, attrs: r } = t, [i, s, o, u] = e, a = cn(o), d = Q(r, i, s);
|
|
3072
3075
|
return [["id", d]].concat(Object.entries(a)).map(([f, l]) => {
|
|
3073
3076
|
const p = K(r, i, f);
|
|
3074
3077
|
return p["checked-data-type"] === "date" && t.useDateObjects && (l = pt(l)), ["add-triple", d, p.id, l, { mode: "create" }];
|
|
3075
3078
|
});
|
|
3076
3079
|
}
|
|
3077
|
-
function
|
|
3078
|
-
const { stores: n, attrs: r } = t, [i, s, o, u] = e, a =
|
|
3080
|
+
function Ko(t, e) {
|
|
3081
|
+
const { stores: n, attrs: r } = t, [i, s, o, u] = e, a = cn(o), d = Q(r, i, s), c = ti(t, [i, d, o, u]);
|
|
3079
3082
|
return [["id", d]].concat(Object.entries(a)).map(([l, p]) => {
|
|
3080
3083
|
const y = K(r, i, l);
|
|
3081
3084
|
return y["checked-data-type"] === "date" && t.useDateObjects && (p = pt(p)), [
|
|
@@ -3087,11 +3090,11 @@ function No(t, e) {
|
|
|
3087
3090
|
];
|
|
3088
3091
|
});
|
|
3089
3092
|
}
|
|
3090
|
-
function
|
|
3093
|
+
function qo({ attrs: t }, [e, n]) {
|
|
3091
3094
|
return [["delete-entity", Q(t, e, n), e]];
|
|
3092
3095
|
}
|
|
3093
|
-
function
|
|
3094
|
-
const { stores: n, attrs: r } = t, [i, s, o, u] = e, a =
|
|
3096
|
+
function zo(t, e) {
|
|
3097
|
+
const { stores: n, attrs: r } = t, [i, s, o, u] = e, a = cn(o), d = Q(r, i, s), c = ti(t, [i, d, o, u]), f = Object.entries(a).map(([p, y]) => {
|
|
3095
3098
|
const b = K(r, i, p);
|
|
3096
3099
|
return [
|
|
3097
3100
|
"deep-merge-triple",
|
|
@@ -3109,38 +3112,38 @@ function qo(t, e) {
|
|
|
3109
3112
|
...c ? [c] : []
|
|
3110
3113
|
]].concat(f);
|
|
3111
3114
|
}
|
|
3112
|
-
function
|
|
3115
|
+
function Vo({ attrs: t }, [e, n, r]) {
|
|
3113
3116
|
return [["rule-params", Q(t, e, n), e, r]];
|
|
3114
3117
|
}
|
|
3115
|
-
function
|
|
3118
|
+
function Wo(t) {
|
|
3116
3119
|
const [e, n, r, i, s] = t;
|
|
3117
3120
|
if (!i)
|
|
3118
3121
|
return t;
|
|
3119
3122
|
const o = Object.assign({}, i);
|
|
3120
3123
|
return delete o.id, [e, n, r, o, ...s ? [s] : []];
|
|
3121
3124
|
}
|
|
3122
|
-
function
|
|
3123
|
-
const [n, ...r] =
|
|
3125
|
+
function Bo(t, e) {
|
|
3126
|
+
const [n, ...r] = Wo(e);
|
|
3124
3127
|
switch (n) {
|
|
3125
3128
|
case "merge":
|
|
3126
|
-
return
|
|
3129
|
+
return zo(t, r);
|
|
3127
3130
|
case "create":
|
|
3128
|
-
return Fo(t, r);
|
|
3129
|
-
case "update":
|
|
3130
3131
|
return No(t, r);
|
|
3132
|
+
case "update":
|
|
3133
|
+
return Ko(t, r);
|
|
3131
3134
|
case "link":
|
|
3132
|
-
return Do(t, r);
|
|
3133
|
-
case "unlink":
|
|
3134
3135
|
return Uo(t, r);
|
|
3136
|
+
case "unlink":
|
|
3137
|
+
return Lo(t, r);
|
|
3135
3138
|
case "delete":
|
|
3136
|
-
return
|
|
3139
|
+
return qo(t, r);
|
|
3137
3140
|
case "ruleParams":
|
|
3138
|
-
return
|
|
3141
|
+
return Vo(t, r);
|
|
3139
3142
|
default:
|
|
3140
3143
|
throw new Error(`unsupported action ${n}`);
|
|
3141
3144
|
}
|
|
3142
3145
|
}
|
|
3143
|
-
function
|
|
3146
|
+
function Go(t) {
|
|
3144
3147
|
switch (t) {
|
|
3145
3148
|
case "string":
|
|
3146
3149
|
case "date":
|
|
@@ -3151,14 +3154,14 @@ function Bo(t) {
|
|
|
3151
3154
|
return;
|
|
3152
3155
|
}
|
|
3153
3156
|
}
|
|
3154
|
-
function
|
|
3157
|
+
function Qo(t, e, n) {
|
|
3155
3158
|
var r, i;
|
|
3156
3159
|
const s = (i = (r = t.entities[e]) === null || r === void 0 ? void 0 : r.attrs) === null || i === void 0 ? void 0 : i[n];
|
|
3157
3160
|
if (n === "id")
|
|
3158
3161
|
return null;
|
|
3159
3162
|
if (!s)
|
|
3160
3163
|
throw new Error(`${e}.${n} does not exist in your schema`);
|
|
3161
|
-
const { unique: o, indexed: u } = s == null ? void 0 : s.config, a =
|
|
3164
|
+
const { unique: o, indexed: u } = s == null ? void 0 : s.config, a = Go(s == null ? void 0 : s.valueType);
|
|
3162
3165
|
return {
|
|
3163
3166
|
"index?": u,
|
|
3164
3167
|
"unique?": o,
|
|
@@ -3166,14 +3169,14 @@ function Go(t, e, n) {
|
|
|
3166
3169
|
};
|
|
3167
3170
|
}
|
|
3168
3171
|
function nt(t, e, n, r) {
|
|
3169
|
-
const i = t ?
|
|
3172
|
+
const i = t ? Qo(t, e, n) : null, s = L(), u = [L(), e, n];
|
|
3170
3173
|
return Object.assign(Object.assign({ id: s, "forward-identity": u, "value-type": "blob", cardinality: "one", "unique?": !1, "index?": !1, isUnsynced: !0 }, i || {}), r || {});
|
|
3171
3174
|
}
|
|
3172
|
-
function
|
|
3175
|
+
function Ho(t, e, n) {
|
|
3173
3176
|
return Object.values(t.links).find((i) => i.forward.on === e && i.forward.label === n || i.reverse.on === e && i.reverse.label === n);
|
|
3174
3177
|
}
|
|
3175
|
-
function
|
|
3176
|
-
const r =
|
|
3178
|
+
function Yo(t, e, n) {
|
|
3179
|
+
const r = Ho(t, e, n);
|
|
3177
3180
|
if (!r)
|
|
3178
3181
|
throw new Error(`Couldn't find the link ${e}.${n} in your schema`);
|
|
3179
3182
|
const { forward: i, reverse: s } = r;
|
|
@@ -3186,11 +3189,11 @@ function Ho(t, e, n) {
|
|
|
3186
3189
|
"on-delete-reverse": s.onDelete
|
|
3187
3190
|
};
|
|
3188
3191
|
}
|
|
3189
|
-
function
|
|
3190
|
-
const i = t ?
|
|
3192
|
+
function tr(t, e, n, r) {
|
|
3193
|
+
const i = t ? Yo(t, e, n) : null, s = L(), o = [L(), e, n], u = [L(), n, e];
|
|
3191
3194
|
return Object.assign(Object.assign({ id: s, "forward-identity": o, "reverse-identity": u, "value-type": "ref", cardinality: "many", "unique?": !1, "index?": !1, isUnsynced: !0 }, i || {}), r || {});
|
|
3192
3195
|
}
|
|
3193
|
-
const
|
|
3196
|
+
const Jo = /* @__PURE__ */ new Set(["create", "update", "merge", "link", "unlink"]), Zo = /* @__PURE__ */ new Set(["link", "unlink"]), Xo = /* @__PURE__ */ new Set(["create", "update", "merge"]), eu = /* @__PURE__ */ new Set([
|
|
3194
3197
|
"link",
|
|
3195
3198
|
"unlink",
|
|
3196
3199
|
"create",
|
|
@@ -3198,17 +3201,17 @@ const Yo = /* @__PURE__ */ new Set(["create", "update", "merge", "link", "unlink
|
|
|
3198
3201
|
"merge",
|
|
3199
3202
|
"delete",
|
|
3200
3203
|
"ruleParams"
|
|
3201
|
-
]),
|
|
3202
|
-
function
|
|
3204
|
+
]), Jt = { "unique?": !0, "index?": !0 }, tu = Object.assign(Object.assign({}, Jt), { cardinality: "one" });
|
|
3205
|
+
function nu(t) {
|
|
3203
3206
|
const e = [], [n, r, i, s] = t;
|
|
3204
|
-
if (!
|
|
3207
|
+
if (!eu.has(n))
|
|
3205
3208
|
return e;
|
|
3206
|
-
const o =
|
|
3209
|
+
const o = Yt(i);
|
|
3207
3210
|
if (o && e.push({ etype: r, lookupPair: o }), n === "link")
|
|
3208
3211
|
for (const [u, a] of Object.entries(s)) {
|
|
3209
3212
|
const d = Array.isArray(a) ? a : [a];
|
|
3210
3213
|
for (const c of d) {
|
|
3211
|
-
const f =
|
|
3214
|
+
const f = Yt(c);
|
|
3212
3215
|
f && e.push({
|
|
3213
3216
|
etype: r,
|
|
3214
3217
|
lookupPair: f,
|
|
@@ -3218,7 +3221,7 @@ function tu(t) {
|
|
|
3218
3221
|
}
|
|
3219
3222
|
return e;
|
|
3220
3223
|
}
|
|
3221
|
-
function
|
|
3224
|
+
function ru({ attrs: t, schema: e }, n) {
|
|
3222
3225
|
var r, i;
|
|
3223
3226
|
const [s, o, u] = [/* @__PURE__ */ new Set(), Object.assign({}, t), []];
|
|
3224
3227
|
function a(f) {
|
|
@@ -3229,47 +3232,47 @@ function nu({ attrs: t, schema: e }, n) {
|
|
|
3229
3232
|
}
|
|
3230
3233
|
function c(f, l) {
|
|
3231
3234
|
const p = K(o, f, l), y = _e(o, f, l);
|
|
3232
|
-
d(p), d(y), !p && !y && a(
|
|
3235
|
+
d(p), d(y), !p && !y && a(tr(e, f, l, tu));
|
|
3233
3236
|
}
|
|
3234
3237
|
for (const f of n)
|
|
3235
|
-
for (const { etype: l, lookupPair: p, linkLabel: y } of
|
|
3238
|
+
for (const { etype: l, lookupPair: p, linkLabel: y } of nu(f)) {
|
|
3236
3239
|
const b = p[0];
|
|
3237
3240
|
if (y) {
|
|
3238
3241
|
c(l, y);
|
|
3239
3242
|
const g = K(o, l, y), m = _e(o, l, y);
|
|
3240
3243
|
d(g), d(m);
|
|
3241
3244
|
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 (
|
|
3243
|
-
c(T,
|
|
3245
|
+
if (Qt(o, T, b))
|
|
3246
|
+
c(T, Ht(b));
|
|
3244
3247
|
else {
|
|
3245
3248
|
const v = K(o, T, b);
|
|
3246
|
-
v || a(nt(e, T, b,
|
|
3249
|
+
v || a(nt(e, T, b, Jt)), d(v);
|
|
3247
3250
|
}
|
|
3248
|
-
} else if (
|
|
3249
|
-
c(l,
|
|
3251
|
+
} else if (Qt(o, l, b))
|
|
3252
|
+
c(l, Ht(b));
|
|
3250
3253
|
else {
|
|
3251
3254
|
const g = K(o, l, b);
|
|
3252
|
-
g || a(nt(e, l, b,
|
|
3255
|
+
g || a(nt(e, l, b, Jt)), d(g);
|
|
3253
3256
|
}
|
|
3254
3257
|
}
|
|
3255
3258
|
for (const f of n) {
|
|
3256
3259
|
const [l, p, y, b] = f;
|
|
3257
|
-
if (
|
|
3260
|
+
if (Jo.has(l)) {
|
|
3258
3261
|
const g = K(o, p, "id");
|
|
3259
3262
|
d(g), g || a(nt(e, p, "id", { "unique?": !0 }));
|
|
3260
3263
|
for (const m of Object.keys(b)) {
|
|
3261
3264
|
const T = K(o, p, m);
|
|
3262
|
-
if (d(T),
|
|
3265
|
+
if (d(T), Xo.has(l) && (T || a(nt(e, p, m, m === "id" ? { "unique?": !0 } : null))), Zo.has(l)) {
|
|
3263
3266
|
const v = _e(o, p, m);
|
|
3264
|
-
!T && !v && a(
|
|
3267
|
+
!T && !v && a(tr(e, p, m)), d(v);
|
|
3265
3268
|
}
|
|
3266
3269
|
}
|
|
3267
3270
|
}
|
|
3268
3271
|
}
|
|
3269
3272
|
return [o, u];
|
|
3270
3273
|
}
|
|
3271
|
-
function
|
|
3272
|
-
const r = (Array.isArray(e) ? e : [e]).flatMap((a) =>
|
|
3274
|
+
function iu(t, e) {
|
|
3275
|
+
const r = (Array.isArray(e) ? e : [e]).flatMap((a) => Ro(a)), [i, s] = ru(t, r), o = Object.assign(Object.assign({}, t), { attrs: i }), u = r.flatMap((a) => Bo(o, a));
|
|
3273
3276
|
return [...s, ...u];
|
|
3274
3277
|
}
|
|
3275
3278
|
var re = function(t, e, n, r) {
|
|
@@ -3299,15 +3302,15 @@ var re = function(t, e, n, r) {
|
|
|
3299
3302
|
d((r = r.apply(t, e || [])).next());
|
|
3300
3303
|
});
|
|
3301
3304
|
};
|
|
3302
|
-
function
|
|
3305
|
+
function nr(t, e) {
|
|
3303
3306
|
typeof requestIdleCallback > "u" ? t() : requestIdleCallback(t, { timeout: e });
|
|
3304
3307
|
}
|
|
3305
3308
|
const qe = "__meta";
|
|
3306
|
-
class
|
|
3309
|
+
class su {
|
|
3307
3310
|
constructor(e, n) {
|
|
3308
3311
|
}
|
|
3309
3312
|
}
|
|
3310
|
-
class
|
|
3313
|
+
class Zt {
|
|
3311
3314
|
constructor(e) {
|
|
3312
3315
|
var n, r;
|
|
3313
3316
|
this._subs = [], this._nextSave = null, this._nextGc = null, this._pendingSaveKeys = /* @__PURE__ */ new Set(), this._loadedKeys = /* @__PURE__ */ new Set(), this._version = 0, this._meta = {
|
|
@@ -3501,7 +3504,7 @@ class Jt {
|
|
|
3501
3504
|
gc() {
|
|
3502
3505
|
this._nextGc || (this._nextGc = setTimeout(
|
|
3503
3506
|
() => {
|
|
3504
|
-
|
|
3507
|
+
nr(() => {
|
|
3505
3508
|
this._nextGc = null, this._gc();
|
|
3506
3509
|
}, 30 * 1e3);
|
|
3507
3510
|
},
|
|
@@ -3516,7 +3519,7 @@ class Jt {
|
|
|
3516
3519
|
return;
|
|
3517
3520
|
}
|
|
3518
3521
|
this._nextSave = setTimeout(() => {
|
|
3519
|
-
|
|
3522
|
+
nr(() => {
|
|
3520
3523
|
this._nextSave = null, this._writeToStorage(e).then(n).catch(r);
|
|
3521
3524
|
}, this._idleCallbackMaxWaitMs);
|
|
3522
3525
|
}, this._saveThrottleMs);
|
|
@@ -3578,13 +3581,13 @@ var oe = function(t, e, n, r) {
|
|
|
3578
3581
|
d((r = r.apply(t, e || [])).next());
|
|
3579
3582
|
});
|
|
3580
3583
|
};
|
|
3581
|
-
const
|
|
3582
|
-
function
|
|
3584
|
+
const ou = 6, uu = ["kv", "querySubs", "syncSubs"];
|
|
3585
|
+
function au(t) {
|
|
3583
3586
|
return function(n) {
|
|
3584
3587
|
console.error("Error in IndexedDB event", { source: t, event: n });
|
|
3585
3588
|
};
|
|
3586
3589
|
}
|
|
3587
|
-
function
|
|
3590
|
+
function cu(t) {
|
|
3588
3591
|
return oe(this, void 0, void 0, function* () {
|
|
3589
3592
|
return new Promise((e) => {
|
|
3590
3593
|
const n = indexedDB.open(t);
|
|
@@ -3600,7 +3603,7 @@ function au(t) {
|
|
|
3600
3603
|
});
|
|
3601
3604
|
});
|
|
3602
3605
|
}
|
|
3603
|
-
function
|
|
3606
|
+
function du(t, e, n) {
|
|
3604
3607
|
return oe(this, void 0, void 0, function* () {
|
|
3605
3608
|
const r = (
|
|
3606
3609
|
// Backwards compatibility for older versions where we JSON.stringified before storing
|
|
@@ -3636,7 +3639,7 @@ function cu(t, e, n) {
|
|
|
3636
3639
|
});
|
|
3637
3640
|
});
|
|
3638
3641
|
}
|
|
3639
|
-
function
|
|
3642
|
+
function rr(t, e, n) {
|
|
3640
3643
|
return oe(this, void 0, void 0, function* () {
|
|
3641
3644
|
const r = n.put(e, t);
|
|
3642
3645
|
return new Promise((i, s) => {
|
|
@@ -3644,9 +3647,9 @@ function nr(t, e, n) {
|
|
|
3644
3647
|
});
|
|
3645
3648
|
});
|
|
3646
3649
|
}
|
|
3647
|
-
function
|
|
3650
|
+
function fu(t, e) {
|
|
3648
3651
|
return oe(this, void 0, void 0, function* () {
|
|
3649
|
-
const n = yield
|
|
3652
|
+
const n = yield cu(`instant_${t}_5`);
|
|
3650
3653
|
if (!n)
|
|
3651
3654
|
return;
|
|
3652
3655
|
const r = yield new Promise((c, f) => {
|
|
@@ -3669,12 +3672,12 @@ function du(t, e) {
|
|
|
3669
3672
|
for (const [c, f] of r)
|
|
3670
3673
|
switch (c) {
|
|
3671
3674
|
case "querySubs": {
|
|
3672
|
-
const l =
|
|
3675
|
+
const l = du(c, f, o);
|
|
3673
3676
|
u.push(l);
|
|
3674
3677
|
break;
|
|
3675
3678
|
}
|
|
3676
3679
|
default: {
|
|
3677
|
-
const l =
|
|
3680
|
+
const l = rr(c, f, s);
|
|
3678
3681
|
u.push(l);
|
|
3679
3682
|
const p = {
|
|
3680
3683
|
createdAt: Date.now(),
|
|
@@ -3685,16 +3688,16 @@ function du(t, e) {
|
|
|
3685
3688
|
break;
|
|
3686
3689
|
}
|
|
3687
3690
|
}
|
|
3688
|
-
const d =
|
|
3691
|
+
const d = rr(qe, a, s);
|
|
3689
3692
|
u.push(d), yield Promise.all(u), yield new Promise((c, f) => {
|
|
3690
3693
|
i.oncomplete = (l) => c(l), i.onerror = (l) => f(l), i.onabort = (l) => f(l);
|
|
3691
3694
|
});
|
|
3692
3695
|
});
|
|
3693
3696
|
}
|
|
3694
|
-
const
|
|
3695
|
-
class
|
|
3697
|
+
const ir = /* @__PURE__ */ new Map();
|
|
3698
|
+
class ni extends su {
|
|
3696
3699
|
constructor(e, n) {
|
|
3697
|
-
super(e, n), this.dbName = `instant_${e}_${
|
|
3700
|
+
super(e, n), this.dbName = `instant_${e}_${ou}`, this._storeName = n, this._appId = e, this._dbPromise = this._init();
|
|
3698
3701
|
}
|
|
3699
3702
|
_init() {
|
|
3700
3703
|
return new Promise((e, n) => {
|
|
@@ -3705,12 +3708,12 @@ class ti extends iu {
|
|
|
3705
3708
|
}, i.onsuccess = (s) => {
|
|
3706
3709
|
const u = s.target.result;
|
|
3707
3710
|
if (r) {
|
|
3708
|
-
const a =
|
|
3709
|
-
|
|
3711
|
+
const a = fu(this._appId, u).catch((d) => {
|
|
3712
|
+
au("Error upgrading store from version 5 to 6.")(d);
|
|
3710
3713
|
});
|
|
3711
|
-
|
|
3714
|
+
ir.set(this.dbName, a), a.then(() => e(u)).catch(() => e(u));
|
|
3712
3715
|
} else {
|
|
3713
|
-
const a =
|
|
3716
|
+
const a = ir.get(this.dbName);
|
|
3714
3717
|
a ? a.then(() => e(u)).catch(() => e(u)) : e(u);
|
|
3715
3718
|
}
|
|
3716
3719
|
}, i.onupgradeneeded = (s) => {
|
|
@@ -3720,7 +3723,7 @@ class ti extends iu {
|
|
|
3720
3723
|
}
|
|
3721
3724
|
_upgradeStore(e) {
|
|
3722
3725
|
const r = e.target.result;
|
|
3723
|
-
for (const i of
|
|
3726
|
+
for (const i of uu)
|
|
3724
3727
|
r.objectStoreNames.contains(i) || r.createObjectStore(i);
|
|
3725
3728
|
}
|
|
3726
3729
|
getItem(e) {
|
|
@@ -3795,7 +3798,7 @@ class ti extends iu {
|
|
|
3795
3798
|
});
|
|
3796
3799
|
}
|
|
3797
3800
|
}
|
|
3798
|
-
var
|
|
3801
|
+
var lu = function(t, e, n, r) {
|
|
3799
3802
|
function i(s) {
|
|
3800
3803
|
return s instanceof n ? s : new n(function(o) {
|
|
3801
3804
|
o(s);
|
|
@@ -3822,9 +3825,9 @@ var fu = function(t, e, n, r) {
|
|
|
3822
3825
|
d((r = r.apply(t, e || [])).next());
|
|
3823
3826
|
});
|
|
3824
3827
|
};
|
|
3825
|
-
class
|
|
3828
|
+
class ri {
|
|
3826
3829
|
static getIsOnline() {
|
|
3827
|
-
return
|
|
3830
|
+
return lu(this, void 0, void 0, function* () {
|
|
3828
3831
|
return navigator.onLine;
|
|
3829
3832
|
});
|
|
3830
3833
|
}
|
|
@@ -3849,7 +3852,7 @@ class ke extends Error {
|
|
|
3849
3852
|
return "InstantError";
|
|
3850
3853
|
}
|
|
3851
3854
|
}
|
|
3852
|
-
var
|
|
3855
|
+
var hu = function(t, e, n, r) {
|
|
3853
3856
|
function i(s) {
|
|
3854
3857
|
return s instanceof n ? s : new n(function(o) {
|
|
3855
3858
|
o(s);
|
|
@@ -3889,7 +3892,7 @@ class bt extends ke {
|
|
|
3889
3892
|
}
|
|
3890
3893
|
}
|
|
3891
3894
|
function te(t, e) {
|
|
3892
|
-
return
|
|
3895
|
+
return hu(this, void 0, void 0, function* () {
|
|
3893
3896
|
const n = yield fetch(t, e), r = yield n.json();
|
|
3894
3897
|
return n.status === 200 ? Promise.resolve(r) : Promise.reject(new bt({ status: n.status, body: r }));
|
|
3895
3898
|
});
|
|
@@ -3921,14 +3924,14 @@ var Pe = function(t, e, n, r) {
|
|
|
3921
3924
|
d((r = r.apply(t, e || [])).next());
|
|
3922
3925
|
});
|
|
3923
3926
|
};
|
|
3924
|
-
function
|
|
3927
|
+
function pu({ apiURI: t, appId: e, email: n }) {
|
|
3925
3928
|
return te(`${t}/runtime/auth/send_magic_code`, {
|
|
3926
3929
|
method: "POST",
|
|
3927
3930
|
headers: { "content-type": "application/json" },
|
|
3928
3931
|
body: JSON.stringify({ "app-id": e, email: n })
|
|
3929
3932
|
});
|
|
3930
3933
|
}
|
|
3931
|
-
function
|
|
3934
|
+
function yu(t) {
|
|
3932
3935
|
return Pe(this, arguments, void 0, function* ({ apiURI: e, appId: n, email: r, code: i, refreshToken: s }) {
|
|
3933
3936
|
return yield te(`${e}/runtime/auth/verify_magic_code`, {
|
|
3934
3937
|
method: "POST",
|
|
@@ -3941,7 +3944,7 @@ function pu(t) {
|
|
|
3941
3944
|
});
|
|
3942
3945
|
});
|
|
3943
3946
|
}
|
|
3944
|
-
function
|
|
3947
|
+
function bu(t) {
|
|
3945
3948
|
return Pe(this, arguments, void 0, function* ({ apiURI: e, appId: n, refreshToken: r }) {
|
|
3946
3949
|
return yield te(`${e}/runtime/auth/verify_refresh_token`, {
|
|
3947
3950
|
method: "POST",
|
|
@@ -3953,7 +3956,7 @@ function yu(t) {
|
|
|
3953
3956
|
});
|
|
3954
3957
|
});
|
|
3955
3958
|
}
|
|
3956
|
-
function
|
|
3959
|
+
function _u(t) {
|
|
3957
3960
|
return Pe(this, arguments, void 0, function* ({ apiURI: e, appId: n }) {
|
|
3958
3961
|
return yield te(`${e}/runtime/auth/sign_in_guest`, {
|
|
3959
3962
|
method: "POST",
|
|
@@ -3964,7 +3967,7 @@ function bu(t) {
|
|
|
3964
3967
|
});
|
|
3965
3968
|
});
|
|
3966
3969
|
}
|
|
3967
|
-
function
|
|
3970
|
+
function sr(t) {
|
|
3968
3971
|
return Pe(this, arguments, void 0, function* ({ apiURI: e, appId: n, code: r, codeVerifier: i, refreshToken: s }) {
|
|
3969
3972
|
return yield te(`${e}/runtime/oauth/token`, {
|
|
3970
3973
|
method: "POST",
|
|
@@ -3978,7 +3981,7 @@ function ir(t) {
|
|
|
3978
3981
|
});
|
|
3979
3982
|
});
|
|
3980
3983
|
}
|
|
3981
|
-
function
|
|
3984
|
+
function gu(t) {
|
|
3982
3985
|
return Pe(this, arguments, void 0, function* ({ apiURI: e, appId: n, nonce: r, idToken: i, clientName: s, refreshToken: o }) {
|
|
3983
3986
|
return yield te(`${e}/runtime/oauth/id_token`, {
|
|
3984
3987
|
method: "POST",
|
|
@@ -3993,7 +3996,7 @@ function _u(t) {
|
|
|
3993
3996
|
});
|
|
3994
3997
|
});
|
|
3995
3998
|
}
|
|
3996
|
-
function
|
|
3999
|
+
function Tu(t) {
|
|
3997
4000
|
return Pe(this, arguments, void 0, function* ({ apiURI: e, appId: n, refreshToken: r }) {
|
|
3998
4001
|
return yield te(`${e}/runtime/signout`, {
|
|
3999
4002
|
method: "POST",
|
|
@@ -4034,7 +4037,7 @@ var Ge = function(t, e, n, r) {
|
|
|
4034
4037
|
d((r = r.apply(t, e || [])).next());
|
|
4035
4038
|
});
|
|
4036
4039
|
};
|
|
4037
|
-
function
|
|
4040
|
+
function mu(t) {
|
|
4038
4041
|
return Ge(this, arguments, void 0, function* ({ apiURI: e, appId: n, path: r, file: i, refreshToken: s, contentType: o, contentDisposition: u }) {
|
|
4039
4042
|
const a = {
|
|
4040
4043
|
app_id: n,
|
|
@@ -4049,7 +4052,7 @@ function Tu(t) {
|
|
|
4049
4052
|
});
|
|
4050
4053
|
});
|
|
4051
4054
|
}
|
|
4052
|
-
function
|
|
4055
|
+
function wu(t) {
|
|
4053
4056
|
return Ge(this, arguments, void 0, function* ({ apiURI: e, appId: n, path: r, refreshToken: i }) {
|
|
4054
4057
|
const { data: s } = yield te(`${e}/storage/files?app_id=${n}&filename=${encodeURIComponent(r)}`, {
|
|
4055
4058
|
method: "DELETE",
|
|
@@ -4061,7 +4064,7 @@ function mu(t) {
|
|
|
4061
4064
|
return s;
|
|
4062
4065
|
});
|
|
4063
4066
|
}
|
|
4064
|
-
function
|
|
4067
|
+
function vu(t) {
|
|
4065
4068
|
return Ge(this, arguments, void 0, function* ({ apiURI: e, appId: n, fileName: r, refreshToken: i, metadata: s = {} }) {
|
|
4066
4069
|
const { data: o } = yield te(`${e}/storage/signed-upload-url`, {
|
|
4067
4070
|
method: "POST",
|
|
@@ -4077,7 +4080,7 @@ function wu(t) {
|
|
|
4077
4080
|
return o;
|
|
4078
4081
|
});
|
|
4079
4082
|
}
|
|
4080
|
-
function
|
|
4083
|
+
function Su(t, e) {
|
|
4081
4084
|
return Ge(this, void 0, void 0, function* () {
|
|
4082
4085
|
return (yield fetch(t, {
|
|
4083
4086
|
method: "PUT",
|
|
@@ -4088,7 +4091,7 @@ function vu(t, e) {
|
|
|
4088
4091
|
})).ok;
|
|
4089
4092
|
});
|
|
4090
4093
|
}
|
|
4091
|
-
function
|
|
4094
|
+
function Ou(t) {
|
|
4092
4095
|
return Ge(this, arguments, void 0, function* ({ apiURI: e, appId: n, path: r, refreshToken: i }) {
|
|
4093
4096
|
const { data: s } = yield te(`${e}/storage/signed-download-url?app_id=${n}&filename=${encodeURIComponent(r)}`, {
|
|
4094
4097
|
method: "GET",
|
|
@@ -4100,9 +4103,9 @@ function Su(t) {
|
|
|
4100
4103
|
return s;
|
|
4101
4104
|
});
|
|
4102
4105
|
}
|
|
4103
|
-
let
|
|
4104
|
-
typeof window < "u" && typeof window.localStorage < "u" && (
|
|
4105
|
-
function
|
|
4106
|
+
let yn = !1, ii = !1, si = !1;
|
|
4107
|
+
typeof window < "u" && typeof window.localStorage < "u" && (yn = !!window.localStorage.getItem("devBackend"), ii = !!window.localStorage.getItem("__instantLogging"), si = !!window.localStorage.getItem("__devtoolLocalDash"));
|
|
4108
|
+
function or(t, e) {
|
|
4106
4109
|
if (!e)
|
|
4107
4110
|
return t;
|
|
4108
4111
|
const n = {};
|
|
@@ -4110,33 +4113,33 @@ function sr(t, e) {
|
|
|
4110
4113
|
n[r] = t[r];
|
|
4111
4114
|
}), n;
|
|
4112
4115
|
}
|
|
4113
|
-
function
|
|
4116
|
+
function Eu(t, e, n) {
|
|
4114
4117
|
var r, i;
|
|
4115
4118
|
const s = {
|
|
4116
4119
|
peers: {}
|
|
4117
4120
|
};
|
|
4118
4121
|
if (e && "user" in e ? e.user : !0) {
|
|
4119
|
-
const u =
|
|
4122
|
+
const u = or((r = t.user) !== null && r !== void 0 ? r : {}, e == null ? void 0 : e.keys);
|
|
4120
4123
|
s.user = Object.assign(Object.assign({}, u), { peerId: n });
|
|
4121
4124
|
}
|
|
4122
4125
|
for (const u of Object.keys((i = t.peers) !== null && i !== void 0 ? i : {})) {
|
|
4123
4126
|
const a = (e == null ? void 0 : e.peers) === void 0, d = Array.isArray(e == null ? void 0 : e.peers) && (e == null ? void 0 : e.peers.includes(u));
|
|
4124
4127
|
if (a || d) {
|
|
4125
|
-
const c =
|
|
4128
|
+
const c = or(t.peers[u], e == null ? void 0 : e.keys);
|
|
4126
4129
|
s.peers[u] = Object.assign(Object.assign({}, c), { peerId: u });
|
|
4127
4130
|
}
|
|
4128
4131
|
}
|
|
4129
4132
|
return s;
|
|
4130
4133
|
}
|
|
4131
|
-
function
|
|
4132
|
-
if (t.isLoading !== e.isLoading || t.error !== e.error || (t.user || e.user) && (!t.user || !e.user || !
|
|
4134
|
+
function Au(t, e) {
|
|
4135
|
+
if (t.isLoading !== e.isLoading || t.error !== e.error || (t.user || e.user) && (!t.user || !e.user || !Wn(t.user, e.user)) || !Rr(t.peers, e.peers))
|
|
4133
4136
|
return !0;
|
|
4134
4137
|
for (const r of Object.keys(t.peers))
|
|
4135
|
-
if (!
|
|
4138
|
+
if (!Wn(t.peers[r], e.peers[r]))
|
|
4136
4139
|
return !0;
|
|
4137
4140
|
return !1;
|
|
4138
4141
|
}
|
|
4139
|
-
class
|
|
4142
|
+
class ur {
|
|
4140
4143
|
constructor() {
|
|
4141
4144
|
this.promise = new Promise((e, n) => {
|
|
4142
4145
|
this._resolve = e, this._reject = n;
|
|
@@ -4149,20 +4152,20 @@ class or {
|
|
|
4149
4152
|
this._reject(e);
|
|
4150
4153
|
}
|
|
4151
4154
|
}
|
|
4152
|
-
function
|
|
4155
|
+
function oi(t, e = []) {
|
|
4153
4156
|
t.forEach((n) => {
|
|
4154
4157
|
const { data: r } = n, { "datalog-result": i } = r, { "join-rows": s } = i;
|
|
4155
4158
|
for (const o of s)
|
|
4156
4159
|
for (const u of o)
|
|
4157
4160
|
e.push(u);
|
|
4158
|
-
|
|
4161
|
+
oi(n["child-nodes"], e);
|
|
4159
4162
|
});
|
|
4160
4163
|
}
|
|
4161
|
-
function
|
|
4164
|
+
function ar(t) {
|
|
4162
4165
|
const e = [];
|
|
4163
|
-
return
|
|
4166
|
+
return oi(t, e), e;
|
|
4164
4167
|
}
|
|
4165
|
-
function
|
|
4168
|
+
function cr(t) {
|
|
4166
4169
|
return Object.values(t.links).reduce((e, n) => {
|
|
4167
4170
|
var r, i, s, o;
|
|
4168
4171
|
return (r = e[s = n.forward.on]) !== null && r !== void 0 || (e[s] = {}), e[n.forward.on][n.forward.label] = {
|
|
@@ -4176,8 +4179,8 @@ function ar(t) {
|
|
|
4176
4179
|
}, e;
|
|
4177
4180
|
}, {});
|
|
4178
4181
|
}
|
|
4179
|
-
const
|
|
4180
|
-
function
|
|
4182
|
+
const ui = "v0.22.66-experimental.drewh-entity-caching.19584095731.1";
|
|
4183
|
+
function ku(t, e) {
|
|
4181
4184
|
return {
|
|
4182
4185
|
info: t ? (...n) => console.info(...n, e()) : () => {
|
|
4183
4186
|
},
|
|
@@ -4215,7 +4218,7 @@ class M extends Error {
|
|
|
4215
4218
|
super(r), this.name = "QueryValidationError";
|
|
4216
4219
|
}
|
|
4217
4220
|
}
|
|
4218
|
-
const
|
|
4221
|
+
const dr = [
|
|
4219
4222
|
"where",
|
|
4220
4223
|
"order",
|
|
4221
4224
|
"limit",
|
|
@@ -4226,7 +4229,7 @@ const cr = [
|
|
|
4226
4229
|
"before",
|
|
4227
4230
|
"fields",
|
|
4228
4231
|
"aggregate"
|
|
4229
|
-
],
|
|
4232
|
+
], ju = (t) => t.valueType || "unknown", ai = (t, e, n = !1) => {
|
|
4230
4233
|
if (n || t == null)
|
|
4231
4234
|
return !0;
|
|
4232
4235
|
switch (e) {
|
|
@@ -4241,9 +4244,9 @@ const cr = [
|
|
|
4241
4244
|
default:
|
|
4242
4245
|
return !0;
|
|
4243
4246
|
}
|
|
4244
|
-
},
|
|
4247
|
+
}, Cu = (t, e, n, r, i, s, o) => {
|
|
4245
4248
|
const u = s.valueType === "json", a = (d, c, f) => {
|
|
4246
|
-
if (!
|
|
4249
|
+
if (!ai(f, c, u))
|
|
4247
4250
|
throw new M(`Invalid value for operator '${d}' on attribute '${r}' in entity '${i}'. Expected ${c}, but received: ${typeof f}`, o);
|
|
4248
4251
|
};
|
|
4249
4252
|
switch (t) {
|
|
@@ -4274,16 +4277,16 @@ const cr = [
|
|
|
4274
4277
|
throw new M(`Unknown operator '${t}' for attribute '${r}' in entity '${i}'`, o);
|
|
4275
4278
|
}
|
|
4276
4279
|
}, Oe = (t, e, n, r, i) => {
|
|
4277
|
-
const s =
|
|
4280
|
+
const s = ju(n), o = n.valueType === "json";
|
|
4278
4281
|
if (typeof t == "object" && t !== null && !Array.isArray(t)) {
|
|
4279
4282
|
if (o)
|
|
4280
4283
|
return;
|
|
4281
4284
|
const a = t;
|
|
4282
4285
|
for (const [d, c] of Object.entries(a))
|
|
4283
|
-
|
|
4284
|
-
} else if (!
|
|
4286
|
+
Cu(d, c, s, e, r, n, `${i}.${d}`);
|
|
4287
|
+
} else if (!ai(t, s, o))
|
|
4285
4288
|
throw new M(`Invalid value for attribute '${e}' in entity '${r}'. Expected ${s}, but received: ${typeof t}`, i);
|
|
4286
|
-
},
|
|
4289
|
+
}, Pu = (t, e, n, r, i) => {
|
|
4287
4290
|
const s = t.split(".");
|
|
4288
4291
|
if (s.length < 2)
|
|
4289
4292
|
throw new M(`Invalid dot notation path '${t}'. Must contain at least one dot.`, i);
|
|
@@ -4320,12 +4323,12 @@ const cr = [
|
|
|
4320
4323
|
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);
|
|
4321
4324
|
}
|
|
4322
4325
|
Oe(e, t, d, n, i);
|
|
4323
|
-
},
|
|
4326
|
+
}, ci = (t, e, n, r) => {
|
|
4324
4327
|
for (const [i, s] of Object.entries(t)) {
|
|
4325
4328
|
if (i === "or" || i === "and") {
|
|
4326
4329
|
if (Array.isArray(s))
|
|
4327
4330
|
for (const d of s)
|
|
4328
|
-
typeof d == "object" && d !== null &&
|
|
4331
|
+
typeof d == "object" && d !== null && ci(d, e, n, `${r}.${i}[${d}]`);
|
|
4329
4332
|
continue;
|
|
4330
4333
|
}
|
|
4331
4334
|
if (i === "id") {
|
|
@@ -4333,7 +4336,7 @@ const cr = [
|
|
|
4333
4336
|
continue;
|
|
4334
4337
|
}
|
|
4335
4338
|
if (i.includes(".")) {
|
|
4336
|
-
|
|
4339
|
+
Pu(i, s, e, n, `${r}.${i}`);
|
|
4337
4340
|
continue;
|
|
4338
4341
|
}
|
|
4339
4342
|
const o = n.entities[e];
|
|
@@ -4353,10 +4356,10 @@ const cr = [
|
|
|
4353
4356
|
Oe(s, i, d, e, `${r}.${i}`);
|
|
4354
4357
|
}
|
|
4355
4358
|
}
|
|
4356
|
-
},
|
|
4359
|
+
}, Iu = (t, e, n, r, i = 0) => {
|
|
4357
4360
|
for (const o of Object.keys(t))
|
|
4358
|
-
if (!
|
|
4359
|
-
throw new M(`Invalid query parameter '${o}' in $ object. Valid parameters are: ${
|
|
4361
|
+
if (!dr.includes(o))
|
|
4362
|
+
throw new M(`Invalid query parameter '${o}' in $ object. Valid parameters are: ${dr.join(", ")}. Found: ${o}`, r);
|
|
4360
4363
|
const s = [
|
|
4361
4364
|
// 'limit', // only supported client side
|
|
4362
4365
|
"offset",
|
|
@@ -4371,9 +4374,9 @@ const cr = [
|
|
|
4371
4374
|
if (t.where && n) {
|
|
4372
4375
|
if (typeof t.where != "object" || t.where === null)
|
|
4373
4376
|
throw new M(`'where' clause must be an object in entity '${e}', but received: ${typeof t.where}`, r ? `${r}.where` : void 0);
|
|
4374
|
-
|
|
4377
|
+
ci(t.where, e, n, r ? `${r}.where` : "where");
|
|
4375
4378
|
}
|
|
4376
|
-
},
|
|
4379
|
+
}, di = (t, e, n, r, i = 0) => {
|
|
4377
4380
|
var s;
|
|
4378
4381
|
if (!t || typeof t != "object")
|
|
4379
4382
|
throw new M(`Query part for entity '${e}' must be an object, but received: ${typeof t}`, r);
|
|
@@ -4386,15 +4389,15 @@ const cr = [
|
|
|
4386
4389
|
const u = t[o];
|
|
4387
4390
|
if (typeof u == "object" && u !== null) {
|
|
4388
4391
|
const a = (s = n == null ? void 0 : n.entities[e].links[o]) === null || s === void 0 ? void 0 : s.entityName;
|
|
4389
|
-
a &&
|
|
4392
|
+
a && di(u, a, n, `${r}.${o}`, i + 1);
|
|
4390
4393
|
}
|
|
4391
4394
|
} else {
|
|
4392
4395
|
const u = t[o];
|
|
4393
4396
|
if (typeof u != "object" || u === null)
|
|
4394
4397
|
throw new M(`Query parameter '$' must be an object in entity '${e}', but received: ${typeof u}`, `${r}.$`);
|
|
4395
|
-
|
|
4398
|
+
Iu(u, e, n, `${r}.$`, i);
|
|
4396
4399
|
}
|
|
4397
|
-
},
|
|
4400
|
+
}, fr = (t, e) => {
|
|
4398
4401
|
if (typeof t != "object" || t === null)
|
|
4399
4402
|
throw new M(`Query must be an object, but received: ${typeof t}${t === null ? " (null)" : ""}`);
|
|
4400
4403
|
if (Array.isArray(t))
|
|
@@ -4410,67 +4413,67 @@ const cr = [
|
|
|
4410
4413
|
const i = Object.keys(e.entities);
|
|
4411
4414
|
throw new M(`Entity '${r}' does not exist in schema. Available entities: ${i.length > 0 ? i.join(", ") : "none"}`, r);
|
|
4412
4415
|
}
|
|
4413
|
-
|
|
4416
|
+
di(n[r], r, e, r, 0);
|
|
4414
4417
|
}
|
|
4415
4418
|
}
|
|
4416
|
-
},
|
|
4419
|
+
}, lr = (t) => typeof t != "string" ? !1 : ht(t) ? !0 : Ee(t);
|
|
4417
4420
|
class Z extends Error {
|
|
4418
4421
|
constructor(e) {
|
|
4419
4422
|
super(e), this.name = "TransactionValidationError";
|
|
4420
4423
|
}
|
|
4421
4424
|
}
|
|
4422
|
-
const
|
|
4425
|
+
const fi = (t) => t.length > 0 ? t.join(", ") : "none", Mu = (t, e) => new Z(`Entity '${t}' does not exist in schema. Available entities: ${fi(e)}`), hr = {
|
|
4423
4426
|
string: (t) => typeof t == "string",
|
|
4424
4427
|
number: (t) => typeof t == "number" && !isNaN(t),
|
|
4425
4428
|
boolean: (t) => typeof t == "boolean",
|
|
4426
4429
|
date: (t) => t instanceof Date || typeof t == "string" || typeof t == "number",
|
|
4427
4430
|
json: () => !0
|
|
4428
|
-
},
|
|
4431
|
+
}, Ru = (t, e) => {
|
|
4429
4432
|
var n, r;
|
|
4430
|
-
return t == null ? !0 : (r = (n =
|
|
4431
|
-
},
|
|
4433
|
+
return t == null ? !0 : (r = (n = hr[e.valueType]) === null || n === void 0 ? void 0 : n.call(hr, t)) !== null && r !== void 0 ? r : !1;
|
|
4434
|
+
}, li = (t, e) => {
|
|
4432
4435
|
const n = e.entities[t];
|
|
4433
4436
|
if (!n)
|
|
4434
|
-
throw
|
|
4437
|
+
throw Mu(t, Object.keys(e.entities));
|
|
4435
4438
|
return n;
|
|
4436
|
-
},
|
|
4437
|
-
const r =
|
|
4439
|
+
}, Pt = (t, e, n) => {
|
|
4440
|
+
const r = li(t, n);
|
|
4438
4441
|
if (typeof e != "object" || e === null)
|
|
4439
4442
|
throw new Z(`Arguments for data operation on entity '${t}' must be an object, but received: ${typeof e}`);
|
|
4440
4443
|
for (const [i, s] of Object.entries(e)) {
|
|
4441
4444
|
if (i === "id")
|
|
4442
4445
|
continue;
|
|
4443
4446
|
const o = r.attrs[i];
|
|
4444
|
-
if (o && !
|
|
4447
|
+
if (o && !Ru(s, o))
|
|
4445
4448
|
throw new Z(`Invalid value for attribute '${i}' in entity '${t}'. Expected ${o.valueType}, but received: ${typeof s}`);
|
|
4446
4449
|
}
|
|
4447
|
-
},
|
|
4448
|
-
const r =
|
|
4450
|
+
}, pr = (t, e, n) => {
|
|
4451
|
+
const r = li(t, n);
|
|
4449
4452
|
if (typeof e != "object" || e === null)
|
|
4450
4453
|
throw new Z(`Arguments for link operation on entity '${t}' must be an object, but received: ${typeof e}`);
|
|
4451
4454
|
for (const [i, s] of Object.entries(e)) {
|
|
4452
4455
|
if (!r.links[i]) {
|
|
4453
4456
|
const u = Object.keys(r.links);
|
|
4454
|
-
throw new Z(`Link '${i}' does not exist on entity '${t}'. Available links: ${
|
|
4457
|
+
throw new Z(`Link '${i}' does not exist on entity '${t}'. Available links: ${fi(u)}`);
|
|
4455
4458
|
}
|
|
4456
4459
|
if (s != null) {
|
|
4457
4460
|
if (Array.isArray(s)) {
|
|
4458
4461
|
for (const u of s)
|
|
4459
|
-
if (!
|
|
4462
|
+
if (!lr(u))
|
|
4460
4463
|
throw new Z(`Invalid entity ID in link '${i}' for entity '${t}'. Expected a UUID or a lookup, but received: ${u}`);
|
|
4461
|
-
} else if (!
|
|
4464
|
+
} else if (!lr(s))
|
|
4462
4465
|
throw new Z(`Invalid UUID in link '${i}' for entity '${t}'. Expected a UUID, but received: ${s}`);
|
|
4463
4466
|
}
|
|
4464
4467
|
}
|
|
4465
|
-
},
|
|
4466
|
-
create:
|
|
4467
|
-
update:
|
|
4468
|
-
merge:
|
|
4469
|
-
link:
|
|
4470
|
-
unlink:
|
|
4468
|
+
}, $u = {
|
|
4469
|
+
create: Pt,
|
|
4470
|
+
update: Pt,
|
|
4471
|
+
merge: Pt,
|
|
4472
|
+
link: pr,
|
|
4473
|
+
unlink: pr,
|
|
4471
4474
|
delete: () => {
|
|
4472
4475
|
}
|
|
4473
|
-
},
|
|
4476
|
+
}, xu = (t, e) => {
|
|
4474
4477
|
if (!e)
|
|
4475
4478
|
return;
|
|
4476
4479
|
const [n, r, i, s] = t;
|
|
@@ -4478,9 +4481,9 @@ const di = (t) => t.length > 0 ? t.join(", ") : "none", Iu = (t, e) => new Z(`En
|
|
|
4478
4481
|
throw new Z(`Invalid id for entity '${r}'. Expected a UUID, but received: ${i}`);
|
|
4479
4482
|
if (typeof r != "string")
|
|
4480
4483
|
throw new Z(`Entity name must be a string, but received: ${typeof r}`);
|
|
4481
|
-
const o =
|
|
4484
|
+
const o = $u[n];
|
|
4482
4485
|
o && s !== void 0 && o(r, s, e);
|
|
4483
|
-
},
|
|
4486
|
+
}, Du = (t, e) => {
|
|
4484
4487
|
const n = Array.isArray(t) ? t : [t];
|
|
4485
4488
|
for (const r of n) {
|
|
4486
4489
|
if (!r || typeof r != "object")
|
|
@@ -4490,11 +4493,11 @@ const di = (t) => t.length > 0 ? t.join(", ") : "none", Iu = (t, e) => new Z(`En
|
|
|
4490
4493
|
for (const i of r.__ops) {
|
|
4491
4494
|
if (!Array.isArray(i))
|
|
4492
4495
|
throw new Z(`Transaction operation must be an array, but received: ${typeof i}`);
|
|
4493
|
-
|
|
4496
|
+
xu(i, e);
|
|
4494
4497
|
}
|
|
4495
4498
|
}
|
|
4496
4499
|
};
|
|
4497
|
-
var
|
|
4500
|
+
var yr = function(t, e, n, r) {
|
|
4498
4501
|
function i(s) {
|
|
4499
4502
|
return s instanceof n ? s : new n(function(o) {
|
|
4500
4503
|
o(s);
|
|
@@ -4521,10 +4524,10 @@ var pr = function(t, e, n, r) {
|
|
|
4521
4524
|
d((r = r.apply(t, e || [])).next());
|
|
4522
4525
|
});
|
|
4523
4526
|
};
|
|
4524
|
-
let
|
|
4525
|
-
class
|
|
4527
|
+
let hi = 0;
|
|
4528
|
+
class br {
|
|
4526
4529
|
constructor(e) {
|
|
4527
|
-
this.type = "ws", this.id = `${this.type}_${
|
|
4530
|
+
this.type = "ws", this.id = `${this.type}_${hi++}`, this.conn = new WebSocket(e), this.conn.onopen = (n) => {
|
|
4528
4531
|
this.onopen && this.onopen({ target: this });
|
|
4529
4532
|
}, this.conn.onmessage = (n) => {
|
|
4530
4533
|
this.onmessage && this.onmessage({
|
|
@@ -4552,9 +4555,9 @@ class yr {
|
|
|
4552
4555
|
return this.conn.send(JSON.stringify(e));
|
|
4553
4556
|
}
|
|
4554
4557
|
}
|
|
4555
|
-
class
|
|
4558
|
+
class Uu {
|
|
4556
4559
|
constructor(e, n) {
|
|
4557
|
-
this.type = "sse", this.initParams = null, this.sendQueue = [], this.closeFired = !1, this.sseInitTimeout = null, this.id = `${this.type}_${
|
|
4560
|
+
this.type = "sse", this.initParams = null, this.sendQueue = [], this.closeFired = !1, this.sseInitTimeout = null, this.id = `${this.type}_${hi++}`, this.url = n, this.ES = e, this.conn = new e(n), this.sseInitTimeout = setTimeout(() => {
|
|
4558
4561
|
this.initParams || this.handleError();
|
|
4559
4562
|
}, 1e4), this.conn.onmessage = (r) => {
|
|
4560
4563
|
const i = JSON.parse(r.data);
|
|
@@ -4586,7 +4589,7 @@ class Du {
|
|
|
4586
4589
|
this.conn.close(), this.onclose && !this.closeFired && (this.closeFired = !0, this.onclose({ target: this }));
|
|
4587
4590
|
}
|
|
4588
4591
|
postMessages(e) {
|
|
4589
|
-
return
|
|
4592
|
+
return yr(this, void 0, void 0, function* () {
|
|
4590
4593
|
try {
|
|
4591
4594
|
(yield fetch(this.url, {
|
|
4592
4595
|
method: "POST",
|
|
@@ -4604,7 +4607,7 @@ class Du {
|
|
|
4604
4607
|
});
|
|
4605
4608
|
}
|
|
4606
4609
|
flushQueue() {
|
|
4607
|
-
return
|
|
4610
|
+
return yr(this, void 0, void 0, function* () {
|
|
4608
4611
|
if (this.sendPromise || !this.sendQueue.length)
|
|
4609
4612
|
return;
|
|
4610
4613
|
const e = this.sendQueue;
|
|
@@ -4630,7 +4633,7 @@ class Du {
|
|
|
4630
4633
|
this.handleClose();
|
|
4631
4634
|
}
|
|
4632
4635
|
}
|
|
4633
|
-
var
|
|
4636
|
+
var _r = function(t, e, n, r) {
|
|
4634
4637
|
function i(s) {
|
|
4635
4638
|
return s instanceof n ? s : new n(function(o) {
|
|
4636
4639
|
o(s);
|
|
@@ -4657,34 +4660,34 @@ var br = function(t, e, n, r) {
|
|
|
4657
4660
|
d((r = r.apply(t, e || [])).next());
|
|
4658
4661
|
});
|
|
4659
4662
|
};
|
|
4660
|
-
function
|
|
4663
|
+
function Lu(t, e) {
|
|
4661
4664
|
const n = t.values;
|
|
4662
4665
|
if (n)
|
|
4663
4666
|
for (const r of n.entities || [])
|
|
4664
|
-
r.store.useDateObjects = e, r.store.attrs = n.attrs, r.store =
|
|
4667
|
+
r.store.useDateObjects = e, r.store.attrs = n.attrs, r.store = Fr(r.store);
|
|
4665
4668
|
return t;
|
|
4666
4669
|
}
|
|
4667
|
-
function
|
|
4670
|
+
function Fu(t, e) {
|
|
4668
4671
|
var n, r;
|
|
4669
4672
|
if (!((n = e.values) === null || n === void 0) && n.entities) {
|
|
4670
4673
|
const i = [];
|
|
4671
4674
|
for (const s of (r = e.values) === null || r === void 0 ? void 0 : r.entities) {
|
|
4672
|
-
const o =
|
|
4675
|
+
const o = Lr(s.store);
|
|
4673
4676
|
delete o.attrs, i.push(Object.assign(Object.assign({}, s), { store: o }));
|
|
4674
4677
|
}
|
|
4675
4678
|
return Object.assign(Object.assign({}, e), { values: Object.assign(Object.assign({}, e.values), { entities: i }) });
|
|
4676
4679
|
} else
|
|
4677
4680
|
return e;
|
|
4678
4681
|
}
|
|
4679
|
-
function
|
|
4682
|
+
function Nu(t, e, n) {
|
|
4680
4683
|
var r, i;
|
|
4681
4684
|
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
4685
|
return s && (!o || s > o) ? e : o && (!s || o > s) ? n : e || n;
|
|
4683
4686
|
}
|
|
4684
|
-
function
|
|
4685
|
-
return
|
|
4687
|
+
function It(t, e) {
|
|
4688
|
+
return Zr({ store: e, pageInfo: null, aggregate: null }, t.query).data[t.table][0];
|
|
4686
4689
|
}
|
|
4687
|
-
function
|
|
4690
|
+
function gr(t, e, n) {
|
|
4688
4691
|
var r;
|
|
4689
4692
|
const i = (r = fe(e, t.table, "id")) === null || r === void 0 ? void 0 : r.id;
|
|
4690
4693
|
if (!i)
|
|
@@ -4692,18 +4695,18 @@ function _r(t, e, n) {
|
|
|
4692
4695
|
const s = Ce(e.eav, [n, i, n]);
|
|
4693
4696
|
return s ? s[3] : -1;
|
|
4694
4697
|
}
|
|
4695
|
-
function
|
|
4698
|
+
function Tr(t, e) {
|
|
4696
4699
|
for (const { action: n, triple: r } of e)
|
|
4697
4700
|
switch (n) {
|
|
4698
4701
|
case "added":
|
|
4699
|
-
|
|
4702
|
+
qr(t, r);
|
|
4700
4703
|
break;
|
|
4701
4704
|
case "removed":
|
|
4702
|
-
|
|
4705
|
+
Nr(t, r);
|
|
4703
4706
|
break;
|
|
4704
4707
|
}
|
|
4705
4708
|
}
|
|
4706
|
-
function
|
|
4709
|
+
function Ku(t, e) {
|
|
4707
4710
|
var n, r, i, s;
|
|
4708
4711
|
const o = {};
|
|
4709
4712
|
for (const { action: u, triple: a } of e) {
|
|
@@ -4731,14 +4734,14 @@ function Nu(t, e) {
|
|
|
4731
4734
|
function rt(t, e) {
|
|
4732
4735
|
return { [t.table]: e.map((n) => n.entity) };
|
|
4733
4736
|
}
|
|
4734
|
-
function
|
|
4737
|
+
function qu(t, e) {
|
|
4735
4738
|
var n;
|
|
4736
4739
|
if (t.orderFieldType)
|
|
4737
4740
|
return t.orderFieldType;
|
|
4738
4741
|
const r = t.orderField === "serverCreatedAt" ? "number" : (n = fe(e([]), t.table, t.orderField)) === null || n === void 0 ? void 0 : n["checked-data-type"];
|
|
4739
4742
|
return t.orderFieldType = r, r;
|
|
4740
4743
|
}
|
|
4741
|
-
function
|
|
4744
|
+
function zu(t, e, n) {
|
|
4742
4745
|
const r = e;
|
|
4743
4746
|
if (t.orderField === "serverCreatedAt") {
|
|
4744
4747
|
n.sort(t.orderDirection === "asc" ? function(o, u) {
|
|
@@ -4759,13 +4762,13 @@ var pe;
|
|
|
4759
4762
|
(function(t) {
|
|
4760
4763
|
t.InitialSyncBatch = "InitialSyncBatch", t.InitialSyncComplete = "InitialSyncComplete", t.LoadFromStorage = "LoadFromStorage", t.SyncTransaction = "SyncTransaction", t.Error = "Error";
|
|
4761
4764
|
})(pe || (pe = {}));
|
|
4762
|
-
class
|
|
4765
|
+
class Vu {
|
|
4763
4766
|
constructor(e, n, r, i, s) {
|
|
4764
|
-
this.callbacks = {}, this.idToHash = {}, this.trySend = e, this.config = r, this.log = i, this.createStore = s, this.subs = new
|
|
4767
|
+
this.callbacks = {}, this.idToHash = {}, this.trySend = e, this.config = r, this.log = i, this.createStore = s, this.subs = new Zt({
|
|
4765
4768
|
persister: n,
|
|
4766
|
-
merge:
|
|
4767
|
-
serialize:
|
|
4768
|
-
parse: (o, u) =>
|
|
4769
|
+
merge: Nu,
|
|
4770
|
+
serialize: Fu,
|
|
4771
|
+
parse: (o, u) => Lu(u, this.config.useDateObjects),
|
|
4769
4772
|
objectSize: (o) => {
|
|
4770
4773
|
var u;
|
|
4771
4774
|
return ((u = o.values) === null || u === void 0 ? void 0 : u.entities.length) || 0;
|
|
@@ -4822,7 +4825,7 @@ class zu {
|
|
|
4822
4825
|
});
|
|
4823
4826
|
}
|
|
4824
4827
|
initSubscription(e, n, r) {
|
|
4825
|
-
return
|
|
4828
|
+
return _r(this, void 0, void 0, function* () {
|
|
4826
4829
|
var i, s, o, u;
|
|
4827
4830
|
yield this.subs.waitForKeyToLoad(n);
|
|
4828
4831
|
const a = this.subs.currentValue[n];
|
|
@@ -4848,7 +4851,7 @@ class zu {
|
|
|
4848
4851
|
});
|
|
4849
4852
|
}
|
|
4850
4853
|
flushPending() {
|
|
4851
|
-
return
|
|
4854
|
+
return _r(this, void 0, void 0, function* () {
|
|
4852
4855
|
for (const e of Object.keys(this.callbacks)) {
|
|
4853
4856
|
yield this.subs.waitForKeyToLoad(e);
|
|
4854
4857
|
const n = this.subs.currentValue[e];
|
|
@@ -4893,11 +4896,11 @@ class zu {
|
|
|
4893
4896
|
for (const c of i) {
|
|
4894
4897
|
const f = this.createStore(c);
|
|
4895
4898
|
a.attrs = f.attrs;
|
|
4896
|
-
const l =
|
|
4899
|
+
const l = It(u, f);
|
|
4897
4900
|
d.push({
|
|
4898
4901
|
store: f,
|
|
4899
4902
|
entity: l,
|
|
4900
|
-
serverCreatedAt:
|
|
4903
|
+
serverCreatedAt: gr(u, f, l.id)
|
|
4901
4904
|
}), o.push(l);
|
|
4902
4905
|
}
|
|
4903
4906
|
this.subs.updateInPlace((c) => {
|
|
@@ -4967,9 +4970,9 @@ class zu {
|
|
|
4967
4970
|
e: for (const [T, v] of Object.entries(f))
|
|
4968
4971
|
for (let j = 0; j < p.length; j++) {
|
|
4969
4972
|
const S = p[j];
|
|
4970
|
-
if (
|
|
4971
|
-
|
|
4972
|
-
const I =
|
|
4973
|
+
if (vs(S.store, T)) {
|
|
4974
|
+
Tr(S.store, v);
|
|
4975
|
+
const I = It(u, S.store), R = Ku(S.store, v)[T];
|
|
4973
4976
|
I ? (y.push({
|
|
4974
4977
|
oldEntity: S.entity,
|
|
4975
4978
|
newEntity: I,
|
|
@@ -4981,8 +4984,8 @@ class zu {
|
|
|
4981
4984
|
const b = [];
|
|
4982
4985
|
for (const [T, v] of Object.entries(f)) {
|
|
4983
4986
|
const j = this.createStore([]);
|
|
4984
|
-
l.attrs = j.attrs,
|
|
4985
|
-
const S =
|
|
4987
|
+
l.attrs = j.attrs, Tr(j, v);
|
|
4988
|
+
const S = It(u, j);
|
|
4986
4989
|
if (!S) {
|
|
4987
4990
|
this.log.error("No entity found after applying change", {
|
|
4988
4991
|
sub: u,
|
|
@@ -4994,14 +4997,14 @@ class zu {
|
|
|
4994
4997
|
p.push({
|
|
4995
4998
|
store: j,
|
|
4996
4999
|
entity: S,
|
|
4997
|
-
serverCreatedAt:
|
|
5000
|
+
serverCreatedAt: gr(u, j, S.id)
|
|
4998
5001
|
}), b.push(S);
|
|
4999
5002
|
}
|
|
5000
5003
|
const g = [];
|
|
5001
5004
|
for (const T of c.sort().reverse())
|
|
5002
5005
|
g.push(p[T].entity), p.splice(T, 1);
|
|
5003
|
-
const m =
|
|
5004
|
-
|
|
5006
|
+
const m = qu(u, this.createStore);
|
|
5007
|
+
zu(u, m, p), this.notifyCbs(o, {
|
|
5005
5008
|
type: pe.SyncTransaction,
|
|
5006
5009
|
data: rt(u, (i = u.values) === null || i === void 0 ? void 0 : i.entities),
|
|
5007
5010
|
added: b,
|
|
@@ -5068,7 +5071,7 @@ var U = function(t, e, n, r) {
|
|
|
5068
5071
|
}
|
|
5069
5072
|
d((r = r.apply(t, e || [])).next());
|
|
5070
5073
|
});
|
|
5071
|
-
},
|
|
5074
|
+
}, Wu = function(t, e) {
|
|
5072
5075
|
var n = {};
|
|
5073
5076
|
for (var r in t) Object.prototype.hasOwnProperty.call(t, r) && e.indexOf(r) < 0 && (n[r] = t[r]);
|
|
5074
5077
|
if (t != null && typeof Object.getOwnPropertySymbols == "function")
|
|
@@ -5082,46 +5085,46 @@ const se = {
|
|
|
5082
5085
|
AUTHENTICATED: "authenticated",
|
|
5083
5086
|
CLOSED: "closed",
|
|
5084
5087
|
ERRORED: "errored"
|
|
5085
|
-
},
|
|
5088
|
+
}, Bu = 3e4, Gu = 3e4, Qu = 200, Hu = {
|
|
5086
5089
|
apiURI: "https://api.instantdb.com",
|
|
5087
5090
|
websocketURI: "wss://api.instantdb.com/runtime/session"
|
|
5088
|
-
},
|
|
5089
|
-
function
|
|
5091
|
+
}, Mt = "_instant_oauth_redirect", De = "currentUser";
|
|
5092
|
+
function Yu({ transportType: t, appId: e, apiURI: n, wsURI: r, EventSourceImpl: i }) {
|
|
5090
5093
|
if (!i)
|
|
5091
|
-
return new
|
|
5094
|
+
return new br(`${r}?app_id=${e}`);
|
|
5092
5095
|
switch (t) {
|
|
5093
5096
|
case "ws":
|
|
5094
|
-
return new
|
|
5097
|
+
return new br(`${r}?app_id=${e}`);
|
|
5095
5098
|
case "sse":
|
|
5096
|
-
return new
|
|
5099
|
+
return new Uu(i, `${n}/runtime/sse?app_id=${e}`);
|
|
5097
5100
|
default:
|
|
5098
5101
|
throw new Error("Unknown transport type " + t);
|
|
5099
5102
|
}
|
|
5100
5103
|
}
|
|
5101
|
-
function
|
|
5104
|
+
function Ju() {
|
|
5102
5105
|
return typeof window < "u" || typeof chrome < "u";
|
|
5103
5106
|
}
|
|
5104
|
-
const
|
|
5107
|
+
const mr = {
|
|
5105
5108
|
"set-presence": !0,
|
|
5106
5109
|
"set-presence-ok": !0,
|
|
5107
5110
|
"refresh-presence": !0,
|
|
5108
5111
|
"patch-presence": !0
|
|
5109
5112
|
};
|
|
5110
|
-
function
|
|
5113
|
+
function Zu(t, e) {
|
|
5111
5114
|
var n;
|
|
5112
5115
|
const r = typeof t == "string" ? JSON.parse(t) : t;
|
|
5113
5116
|
if (!((n = r == null ? void 0 : r.result) === null || n === void 0) && n.store) {
|
|
5114
5117
|
const i = r.result.store;
|
|
5115
|
-
r.result.store =
|
|
5118
|
+
r.result.store = Fr(Object.assign(Object.assign({}, i), { useDateObjects: e }));
|
|
5116
5119
|
}
|
|
5117
5120
|
return r;
|
|
5118
5121
|
}
|
|
5119
|
-
function
|
|
5122
|
+
function Xu(t, e) {
|
|
5120
5123
|
var n;
|
|
5121
5124
|
const r = Object.assign({}, e);
|
|
5122
|
-
return !((n = e.result) === null || n === void 0) && n.store && (r.result = Object.assign(Object.assign({}, e.result), { store:
|
|
5125
|
+
return !((n = e.result) === null || n === void 0) && n.store && (r.result = Object.assign(Object.assign({}, e.result), { store: Lr(e.result.store) })), r;
|
|
5123
5126
|
}
|
|
5124
|
-
function
|
|
5127
|
+
function ea(t, e) {
|
|
5125
5128
|
switch (t) {
|
|
5126
5129
|
case "pendingMutations":
|
|
5127
5130
|
return new Map(typeof e == "string" ? JSON.parse(e) : e);
|
|
@@ -5129,7 +5132,7 @@ function Xu(t, e) {
|
|
|
5129
5132
|
return e;
|
|
5130
5133
|
}
|
|
5131
5134
|
}
|
|
5132
|
-
function
|
|
5135
|
+
function ta(t, e) {
|
|
5133
5136
|
switch (t) {
|
|
5134
5137
|
case "pendingMutations":
|
|
5135
5138
|
return [...e.entries()];
|
|
@@ -5137,18 +5140,18 @@ function ea(t, e) {
|
|
|
5137
5140
|
return e;
|
|
5138
5141
|
}
|
|
5139
5142
|
}
|
|
5140
|
-
function
|
|
5143
|
+
function na(t, e, n) {
|
|
5141
5144
|
const r = e == null ? void 0 : e.result, i = n == null ? void 0 : n.result;
|
|
5142
5145
|
return r && !i && n && (n.result = r), n || e;
|
|
5143
5146
|
}
|
|
5144
|
-
function
|
|
5147
|
+
function wr(t) {
|
|
5145
5148
|
return [...t].sort((e, n) => {
|
|
5146
5149
|
const [r, i] = e, [s, o] = n, u = i.order || 0, a = o.order || 0;
|
|
5147
5150
|
return u == a ? r < s ? -1 : r > s ? 1 : 0 : u - a;
|
|
5148
5151
|
});
|
|
5149
5152
|
}
|
|
5150
|
-
class
|
|
5151
|
-
constructor(e, n =
|
|
5153
|
+
class ra {
|
|
5154
|
+
constructor(e, n = ni, r = ri, i, s) {
|
|
5152
5155
|
var o, u, a;
|
|
5153
5156
|
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) => {
|
|
5154
5157
|
var l, p;
|
|
@@ -5179,9 +5182,9 @@ class na {
|
|
|
5179
5182
|
}, this.notifyQueryError = (d, c) => {
|
|
5180
5183
|
(this.queryCbs[d] || []).forEach((l) => l.cb({ error: c }));
|
|
5181
5184
|
}, this.pushTx = (d) => {
|
|
5182
|
-
this.config.disableValidation ||
|
|
5185
|
+
this.config.disableValidation || Du(d, this.config.schema);
|
|
5183
5186
|
try {
|
|
5184
|
-
const c =
|
|
5187
|
+
const c = iu({
|
|
5185
5188
|
attrs: this.optimisticAttrs(),
|
|
5186
5189
|
schema: this.config.schema,
|
|
5187
5190
|
stores: Object.values(this.querySubs.currentValue).map((f) => {
|
|
@@ -5205,7 +5208,7 @@ class na {
|
|
|
5205
5208
|
this._updatePendingMutations((g) => {
|
|
5206
5209
|
g.set(f, y);
|
|
5207
5210
|
});
|
|
5208
|
-
const b = new
|
|
5211
|
+
const b = new ur();
|
|
5209
5212
|
return this.mutationDeferredStore.set(f, b), this._sendMutation(f, y), this.notifyAll(), b.promise;
|
|
5210
5213
|
}, this._transportOnOpen = (d) => {
|
|
5211
5214
|
const c = d.target;
|
|
@@ -5266,7 +5269,7 @@ class na {
|
|
|
5266
5269
|
return;
|
|
5267
5270
|
}
|
|
5268
5271
|
this._log.info("[socket][close]", c.id, "schedule reconnect, ms =", this._reconnectTimeoutMs), this._scheduleReconnect();
|
|
5269
|
-
}, this._EventSource = s, this.config = Object.assign(Object.assign({},
|
|
5272
|
+
}, this._EventSource = s, this.config = Object.assign(Object.assign({}, Hu), e), this.queryCacheLimit = (o = this.config.queryCacheLimit) !== null && o !== void 0 ? o : 10, this._pendingTxCleanupTimeout = (u = this.config.pendingTxCleanupTimeout) !== null && u !== void 0 ? u : Gu, this._pendingMutationCleanupThreshold = (a = this.config.pendingMutationCleanupThreshold) !== null && a !== void 0 ? a : Qu, this._log = ku(e.verbose || yn || ii, () => this._reactorStats()), this.versions = Object.assign(Object.assign({}, i || {}), { "@instantdb/core": ui }), this.config.schema && (this._linkIndex = cr(this.config.schema)), !!Ju()) {
|
|
5270
5273
|
if (!e.appId)
|
|
5271
5274
|
throw new Error("Instant must be initialized with an appId.");
|
|
5272
5275
|
if (!Ee(e.appId))
|
|
@@ -5281,7 +5284,7 @@ class na {
|
|
|
5281
5284
|
} catch (f) {
|
|
5282
5285
|
this._log.error("[error] handle broadcast channel", f);
|
|
5283
5286
|
}
|
|
5284
|
-
}))), this._initStorage(n), this._syncTable = new
|
|
5287
|
+
}))), this._initStorage(n), this._syncTable = new Vu(this._trySendAuthed.bind(this), new n(this.config.appId, "syncSubs"), {
|
|
5285
5288
|
useDateObjects: this.config.useDateObjects
|
|
5286
5289
|
}, 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) => {
|
|
5287
5290
|
this._isOnline = d, this._startSocket(), r.listen((c) => {
|
|
@@ -5291,7 +5294,7 @@ class na {
|
|
|
5291
5294
|
}
|
|
5292
5295
|
}
|
|
5293
5296
|
updateSchema(e) {
|
|
5294
|
-
this.config = Object.assign(Object.assign({}, this.config), { schema: e, cardinalityInference: !!e }), this._linkIndex = e ?
|
|
5297
|
+
this.config = Object.assign(Object.assign({}, this.config), { schema: e, cardinalityInference: !!e }), this._linkIndex = e ? cr(this.config.schema) : null;
|
|
5295
5298
|
}
|
|
5296
5299
|
_reactorStats() {
|
|
5297
5300
|
return {
|
|
@@ -5304,11 +5307,11 @@ class na {
|
|
|
5304
5307
|
this.kv.waitForKeyToLoad("pendingMutations").then(() => this.notifyOne(e));
|
|
5305
5308
|
}
|
|
5306
5309
|
_initStorage(e) {
|
|
5307
|
-
this.querySubs = new
|
|
5310
|
+
this.querySubs = new Zt({
|
|
5308
5311
|
persister: new e(this.config.appId, "querySubs"),
|
|
5309
|
-
merge:
|
|
5310
|
-
serialize:
|
|
5311
|
-
parse: (n, r) =>
|
|
5312
|
+
merge: na,
|
|
5313
|
+
serialize: Xu,
|
|
5314
|
+
parse: (n, r) => Zu(r, this.config.useDateObjects),
|
|
5312
5315
|
// objectSize
|
|
5313
5316
|
objectSize: (n) => {
|
|
5314
5317
|
var r, i, s, o;
|
|
@@ -5324,11 +5327,11 @@ class na {
|
|
|
5324
5327
|
maxSize: 1e6
|
|
5325
5328
|
// 1 million triples
|
|
5326
5329
|
}
|
|
5327
|
-
}), this.querySubs.onKeyLoaded = (n) => this._onQuerySubLoaded(n), this.kv = new
|
|
5330
|
+
}), this.querySubs.onKeyLoaded = (n) => this._onQuerySubLoaded(n), this.kv = new Zt({
|
|
5328
5331
|
persister: new e(this.config.appId, "kv"),
|
|
5329
5332
|
merge: this._onMergeKv,
|
|
5330
|
-
serialize:
|
|
5331
|
-
parse:
|
|
5333
|
+
serialize: ta,
|
|
5334
|
+
parse: ea,
|
|
5332
5335
|
objectSize: () => 0,
|
|
5333
5336
|
logger: this._log,
|
|
5334
5337
|
saveThrottleMs: 100,
|
|
@@ -5359,7 +5362,7 @@ class na {
|
|
|
5359
5362
|
if (s)
|
|
5360
5363
|
i.resolve({ status: e, eventId: n });
|
|
5361
5364
|
else if (r != null && r.type) {
|
|
5362
|
-
const { status: o } = r, u =
|
|
5365
|
+
const { status: o } = r, u = Wu(r, ["status"]);
|
|
5363
5366
|
i.reject(new bt({
|
|
5364
5367
|
// @ts-expect-error body.type is not constant typed
|
|
5365
5368
|
body: u,
|
|
@@ -5383,7 +5386,7 @@ class na {
|
|
|
5383
5386
|
_handleReceive(e, n) {
|
|
5384
5387
|
var r, i, s, o, u, a;
|
|
5385
5388
|
const d = !!this.config.schema && ("cardinalityInference" in this.config ? !!this.config.cardinalityInference : !0);
|
|
5386
|
-
switch (
|
|
5389
|
+
switch (mr[n.op] || this._log.info("[receive]", e, n.op, n), n.op) {
|
|
5387
5390
|
case "init-ok": {
|
|
5388
5391
|
this._setStatus(se.AUTHENTICATED), this._reconnectTimeoutMs = 0, this._setAttrs(n.attrs), this._flushPendingMessages(), this._sessionId = n["session-id"];
|
|
5389
5392
|
for (const l of Object.keys(this._rooms)) {
|
|
@@ -5400,7 +5403,7 @@ class na {
|
|
|
5400
5403
|
const { q: l, result: p } = n, y = N(l);
|
|
5401
5404
|
if (!this._hasQueryListeners() && !this.querySubs.currentValue[y])
|
|
5402
5405
|
break;
|
|
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 =
|
|
5406
|
+
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 = ar(p), T = at(this.attrs, m, d, this._linkIndex, this.config.useDateObjects);
|
|
5404
5407
|
this.querySubs.updateInPlace((v) => {
|
|
5405
5408
|
if (!v[y]) {
|
|
5406
5409
|
this._log.info("Missing value in querySubs", { hash: y, q: l });
|
|
@@ -5438,9 +5441,9 @@ class na {
|
|
|
5438
5441
|
b !== this._pendingMutations() && this.kv.updateInPlace((T) => {
|
|
5439
5442
|
T.pendingMutations = b;
|
|
5440
5443
|
});
|
|
5441
|
-
const g =
|
|
5444
|
+
const g = wr(b.entries()), m = l.map((T) => {
|
|
5442
5445
|
var v, j, S, I;
|
|
5443
|
-
const R = T["instaql-query"], q = T["instaql-result"], Ie = N(R), Qe =
|
|
5446
|
+
const R = T["instaql-query"], q = T["instaql-result"], Ie = N(R), Qe = ar(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
5447
|
return { q: R, hash: Ie, store: gt, pageInfo: He, aggregate: ne };
|
|
5445
5448
|
});
|
|
5446
5449
|
m.forEach(({ hash: T, q: v, store: j, pageInfo: S, aggregate: I }) => {
|
|
@@ -5603,7 +5606,7 @@ class na {
|
|
|
5603
5606
|
*/
|
|
5604
5607
|
subscribeQuery(e, n, r) {
|
|
5605
5608
|
var i;
|
|
5606
|
-
this.config.disableValidation ||
|
|
5609
|
+
this.config.disableValidation || fr(e, this.config.schema), r && "ruleParams" in r && (e = Object.assign({ $$ruleParams: r.ruleParams }, e));
|
|
5607
5610
|
const s = N(e), o = this.getPreviousResult(e);
|
|
5608
5611
|
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), () => {
|
|
5609
5612
|
this._unsubQuery(e, s, n);
|
|
@@ -5611,14 +5614,14 @@ class na {
|
|
|
5611
5614
|
}
|
|
5612
5615
|
queryOnce(e, n) {
|
|
5613
5616
|
var r;
|
|
5614
|
-
this.config.disableValidation ||
|
|
5615
|
-
const i = new
|
|
5617
|
+
this.config.disableValidation || fr(e, this.config.schema), n && "ruleParams" in n && (e = Object.assign({ $$ruleParams: n.ruleParams }, e));
|
|
5618
|
+
const i = new ur();
|
|
5616
5619
|
if (!this._isOnline)
|
|
5617
5620
|
return i.reject(new Error("We can't run `queryOnce`, because the device is offline.")), i.promise;
|
|
5618
5621
|
if (!this.querySubs)
|
|
5619
5622
|
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;
|
|
5620
5623
|
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")),
|
|
5624
|
+
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")), Bu), i.promise;
|
|
5622
5625
|
}
|
|
5623
5626
|
_completeQueryOnce(e, n, r) {
|
|
5624
5627
|
this.queryOnceDfds[n] && (this.queryOnceDfds[n] = this.queryOnceDfds[n].filter((i) => i.dfd !== r), this._cleanupQuery(e, n));
|
|
@@ -5679,7 +5682,7 @@ class na {
|
|
|
5679
5682
|
u = !0;
|
|
5680
5683
|
continue;
|
|
5681
5684
|
}
|
|
5682
|
-
const b = u ?
|
|
5685
|
+
const b = u ? $o(o, p) : p;
|
|
5683
5686
|
l.push(b);
|
|
5684
5687
|
}
|
|
5685
5688
|
return u ? l : c;
|
|
@@ -5689,7 +5692,7 @@ class na {
|
|
|
5689
5692
|
return u ? d : n;
|
|
5690
5693
|
}
|
|
5691
5694
|
_rewriteMutationsSorted(e, n) {
|
|
5692
|
-
return
|
|
5695
|
+
return wr(this._rewriteMutations(e, n).entries());
|
|
5693
5696
|
}
|
|
5694
5697
|
// ---------------------------
|
|
5695
5698
|
// Transact
|
|
@@ -5722,7 +5725,7 @@ class na {
|
|
|
5722
5725
|
const d = this._dataForQueryCache[e];
|
|
5723
5726
|
if (d && r === d.querySubVersion && s === d.pendingMutationsVersion)
|
|
5724
5727
|
return d.data;
|
|
5725
|
-
const { store: c, pageInfo: f, aggregate: l, processedTxId: p } = a, y = this._rewriteMutationsSorted(c.attrs, o), b = this._applyOptimisticUpdates(c, y, p), g =
|
|
5728
|
+
const { store: c, pageInfo: f, aggregate: l, processedTxId: p } = a, y = this._rewriteMutationsSorted(c.attrs, o), b = this._applyOptimisticUpdates(c, y, p), g = Zr({ store: b, pageInfo: f, aggregate: l }, u);
|
|
5726
5729
|
return this._dataForQueryCache[e] = {
|
|
5727
5730
|
querySubVersion: r,
|
|
5728
5731
|
pendingMutationsVersion: s,
|
|
@@ -5731,7 +5734,7 @@ class na {
|
|
|
5731
5734
|
}
|
|
5732
5735
|
_applyOptimisticUpdates(e, n, r) {
|
|
5733
5736
|
for (const [i, s] of n)
|
|
5734
|
-
(!s["tx-id"] || r && s["tx-id"] > r) && (e =
|
|
5737
|
+
(!s["tx-id"] || r && s["tx-id"] > r) && (e = $s(e, s["tx-steps"]));
|
|
5735
5738
|
return e;
|
|
5736
5739
|
}
|
|
5737
5740
|
/** Re-compute all subscriptions */
|
|
@@ -5819,7 +5822,7 @@ class na {
|
|
|
5819
5822
|
}
|
|
5820
5823
|
_trySend(e, n, r) {
|
|
5821
5824
|
if (this._transport.isOpen()) {
|
|
5822
|
-
switch (
|
|
5825
|
+
switch (mr[n.op] || this._log.info("[send]", this._transport.id, n.op, n), n.op) {
|
|
5823
5826
|
case "transact": {
|
|
5824
5827
|
this._inFlightMutationEventIds.add(e);
|
|
5825
5828
|
break;
|
|
@@ -5840,7 +5843,7 @@ class na {
|
|
|
5840
5843
|
return;
|
|
5841
5844
|
}
|
|
5842
5845
|
const e = this._transport;
|
|
5843
|
-
this._transport =
|
|
5846
|
+
this._transport = Yu({
|
|
5844
5847
|
transportType: this._transportType,
|
|
5845
5848
|
appId: this.config.appId,
|
|
5846
5849
|
apiURI: this.config.apiURI,
|
|
@@ -5876,9 +5879,9 @@ class na {
|
|
|
5876
5879
|
if (typeof URL > "u")
|
|
5877
5880
|
return;
|
|
5878
5881
|
const e = new URL(window.location.href);
|
|
5879
|
-
if (e.searchParams.get(
|
|
5882
|
+
if (e.searchParams.get(Mt)) {
|
|
5880
5883
|
const n = e.toString();
|
|
5881
|
-
e.searchParams.delete(
|
|
5884
|
+
e.searchParams.delete(Mt), e.searchParams.delete("code"), e.searchParams.delete("error");
|
|
5882
5885
|
const r = e.pathname + (e.searchParams.size ? "?" + e.searchParams : "") + e.hash;
|
|
5883
5886
|
if (history.replaceState(history.state, "", r), // @ts-ignore (waiting for ts support)
|
|
5884
5887
|
typeof navigation == "object" && // @ts-ignore (waiting for ts support)
|
|
@@ -5903,7 +5906,7 @@ class na {
|
|
|
5903
5906
|
if (typeof window > "u" || typeof window.location > "u" || typeof URLSearchParams > "u")
|
|
5904
5907
|
return null;
|
|
5905
5908
|
const s = new URLSearchParams(window.location.search);
|
|
5906
|
-
if (!s.get(
|
|
5909
|
+
if (!s.get(Mt))
|
|
5907
5910
|
return null;
|
|
5908
5911
|
const o = s.get("error");
|
|
5909
5912
|
if (o)
|
|
@@ -5913,7 +5916,7 @@ class na {
|
|
|
5913
5916
|
return null;
|
|
5914
5917
|
this._replaceUrlAfterOAuth();
|
|
5915
5918
|
try {
|
|
5916
|
-
const a = yield this._getCurrentUser(), d = (a == null ? void 0 : a.type) === "guest", { user: c } = yield
|
|
5919
|
+
const a = yield this._getCurrentUser(), d = (a == null ? void 0 : a.type) === "guest", { user: c } = yield sr({
|
|
5917
5920
|
apiURI: this.config.apiURI,
|
|
5918
5921
|
appId: this.config.appId,
|
|
5919
5922
|
code: u,
|
|
@@ -6043,7 +6046,7 @@ class na {
|
|
|
6043
6046
|
}), this._reconnectTimeoutMs = 0, this._transport.close(), this._oauthCallbackResponse = null, this.notifyAuthSubs(n);
|
|
6044
6047
|
}
|
|
6045
6048
|
sendMagicCode({ email: e }) {
|
|
6046
|
-
return
|
|
6049
|
+
return pu({
|
|
6047
6050
|
apiURI: this.config.apiURI,
|
|
6048
6051
|
appId: this.config.appId,
|
|
6049
6052
|
email: e
|
|
@@ -6052,7 +6055,7 @@ class na {
|
|
|
6052
6055
|
signInWithMagicCode(e) {
|
|
6053
6056
|
return U(this, arguments, void 0, function* ({ email: n, code: r }) {
|
|
6054
6057
|
var i;
|
|
6055
|
-
const s = yield this.getCurrentUser(), o = ((i = s == null ? void 0 : s.user) === null || i === void 0 ? void 0 : i.type) === "guest", u = yield
|
|
6058
|
+
const s = yield this.getCurrentUser(), o = ((i = s == null ? void 0 : s.user) === null || i === void 0 ? void 0 : i.type) === "guest", u = yield yu({
|
|
6056
6059
|
apiURI: this.config.apiURI,
|
|
6057
6060
|
appId: this.config.appId,
|
|
6058
6061
|
email: n,
|
|
@@ -6064,7 +6067,7 @@ class na {
|
|
|
6064
6067
|
}
|
|
6065
6068
|
signInWithCustomToken(e) {
|
|
6066
6069
|
return U(this, void 0, void 0, function* () {
|
|
6067
|
-
const n = yield
|
|
6070
|
+
const n = yield bu({
|
|
6068
6071
|
apiURI: this.config.apiURI,
|
|
6069
6072
|
appId: this.config.appId,
|
|
6070
6073
|
refreshToken: e
|
|
@@ -6074,7 +6077,7 @@ class na {
|
|
|
6074
6077
|
}
|
|
6075
6078
|
signInAsGuest() {
|
|
6076
6079
|
return U(this, void 0, void 0, function* () {
|
|
6077
|
-
const e = yield
|
|
6080
|
+
const e = yield _u({
|
|
6078
6081
|
apiURI: this.config.apiURI,
|
|
6079
6082
|
appId: this.config.appId
|
|
6080
6083
|
});
|
|
@@ -6090,7 +6093,7 @@ class na {
|
|
|
6090
6093
|
this._log.info("[auth-invalidate] skipped invalidateToken");
|
|
6091
6094
|
return;
|
|
6092
6095
|
}
|
|
6093
|
-
|
|
6096
|
+
Tu({
|
|
6094
6097
|
apiURI: this.config.apiURI,
|
|
6095
6098
|
appId: this.config.appId,
|
|
6096
6099
|
refreshToken: i
|
|
@@ -6125,7 +6128,7 @@ class na {
|
|
|
6125
6128
|
exchangeCodeForToken(e) {
|
|
6126
6129
|
return U(this, arguments, void 0, function* ({ code: n, codeVerifier: r }) {
|
|
6127
6130
|
var i;
|
|
6128
|
-
const s = yield this.getCurrentUser(), o = ((i = s == null ? void 0 : s.user) === null || i === void 0 ? void 0 : i.type) === "guest", u = yield
|
|
6131
|
+
const s = yield this.getCurrentUser(), o = ((i = s == null ? void 0 : s.user) === null || i === void 0 ? void 0 : i.type) === "guest", u = yield sr({
|
|
6129
6132
|
apiURI: this.config.apiURI,
|
|
6130
6133
|
appId: this.config.appId,
|
|
6131
6134
|
code: n,
|
|
@@ -6148,7 +6151,7 @@ class na {
|
|
|
6148
6151
|
signInWithIdToken(e) {
|
|
6149
6152
|
return U(this, arguments, void 0, function* ({ idToken: n, clientName: r, nonce: i }) {
|
|
6150
6153
|
var s;
|
|
6151
|
-
const o = yield this.getCurrentUser(), u = (s = o == null ? void 0 : o.user) === null || s === void 0 ? void 0 : s.refresh_token, a = yield
|
|
6154
|
+
const o = yield this.getCurrentUser(), u = (s = o == null ? void 0 : o.user) === null || s === void 0 ? void 0 : s.refresh_token, a = yield gu({
|
|
6152
6155
|
apiURI: this.config.apiURI,
|
|
6153
6156
|
appId: this.config.appId,
|
|
6154
6157
|
idToken: n,
|
|
@@ -6189,7 +6192,7 @@ class na {
|
|
|
6189
6192
|
// TODO: look into typing again
|
|
6190
6193
|
getPresence(e, n, r = {}) {
|
|
6191
6194
|
const i = this._rooms[n], s = this._presence[n];
|
|
6192
|
-
return !i || !s || !s.result ? null : Object.assign(Object.assign({},
|
|
6195
|
+
return !i || !s || !s.result ? null : Object.assign(Object.assign({}, Eu(s.result, r, this._sessionId)), { isLoading: !i.isConnected, error: i.error });
|
|
6193
6196
|
}
|
|
6194
6197
|
// TODO: look into typing again
|
|
6195
6198
|
publishPresence(e, n, r) {
|
|
@@ -6239,7 +6242,7 @@ class na {
|
|
|
6239
6242
|
}
|
|
6240
6243
|
_notifyPresenceSub(e, n) {
|
|
6241
6244
|
const r = this.getPresence("", e, n);
|
|
6242
|
-
r && (n.prev && !
|
|
6245
|
+
r && (n.prev && !Au(r, n.prev) || (n.prev = r, n.cb(r)));
|
|
6243
6246
|
}
|
|
6244
6247
|
_patchPresencePeers(e, n) {
|
|
6245
6248
|
var r, i, s;
|
|
@@ -6250,13 +6253,13 @@ class na {
|
|
|
6250
6253
|
for (let [c, f, l] of n)
|
|
6251
6254
|
switch (f) {
|
|
6252
6255
|
case "+":
|
|
6253
|
-
|
|
6256
|
+
rs(d, c, l);
|
|
6254
6257
|
break;
|
|
6255
6258
|
case "r":
|
|
6256
|
-
|
|
6259
|
+
Bn(d, c, l);
|
|
6257
6260
|
break;
|
|
6258
6261
|
case "-":
|
|
6259
|
-
|
|
6262
|
+
xr(d, c);
|
|
6260
6263
|
break;
|
|
6261
6264
|
}
|
|
6262
6265
|
delete d[this._sessionId];
|
|
@@ -6268,7 +6271,7 @@ class na {
|
|
|
6268
6271
|
delete r[this._sessionId];
|
|
6269
6272
|
const i = Object.fromEntries(Object.entries(r).map(([s, o]) => [s, o.data]));
|
|
6270
6273
|
this._presence = ft(this._presence, (s) => {
|
|
6271
|
-
|
|
6274
|
+
Bn(s, [e, "result", "peers"], i);
|
|
6272
6275
|
});
|
|
6273
6276
|
}
|
|
6274
6277
|
// --------
|
|
@@ -6313,14 +6316,14 @@ class na {
|
|
|
6313
6316
|
return U(this, void 0, void 0, function* () {
|
|
6314
6317
|
var i;
|
|
6315
6318
|
const s = yield this.getCurrentUser(), o = (i = s == null ? void 0 : s.user) === null || i === void 0 ? void 0 : i.refresh_token;
|
|
6316
|
-
return
|
|
6319
|
+
return mu(Object.assign(Object.assign({}, r), { apiURI: this.config.apiURI, appId: this.config.appId, path: e, file: n, refreshToken: o }));
|
|
6317
6320
|
});
|
|
6318
6321
|
}
|
|
6319
6322
|
deleteFile(e) {
|
|
6320
6323
|
return U(this, void 0, void 0, function* () {
|
|
6321
6324
|
var n;
|
|
6322
6325
|
const r = yield this.getCurrentUser(), i = (n = r == null ? void 0 : r.user) === null || n === void 0 ? void 0 : n.refresh_token;
|
|
6323
|
-
return yield
|
|
6326
|
+
return yield wu({
|
|
6324
6327
|
apiURI: this.config.apiURI,
|
|
6325
6328
|
appId: this.config.appId,
|
|
6326
6329
|
path: e,
|
|
@@ -6333,20 +6336,20 @@ class na {
|
|
|
6333
6336
|
upload(e, n) {
|
|
6334
6337
|
return U(this, void 0, void 0, function* () {
|
|
6335
6338
|
var r;
|
|
6336
|
-
const i = yield this.getCurrentUser(), s = (r = i == null ? void 0 : i.user) === null || r === void 0 ? void 0 : r.refresh_token, o = e || n.name, u = yield
|
|
6339
|
+
const i = yield this.getCurrentUser(), s = (r = i == null ? void 0 : i.user) === null || r === void 0 ? void 0 : r.refresh_token, o = e || n.name, u = yield vu({
|
|
6337
6340
|
apiURI: this.config.apiURI,
|
|
6338
6341
|
appId: this.config.appId,
|
|
6339
6342
|
fileName: o,
|
|
6340
6343
|
refreshToken: s
|
|
6341
6344
|
});
|
|
6342
|
-
return yield
|
|
6345
|
+
return yield Su(u, n);
|
|
6343
6346
|
});
|
|
6344
6347
|
}
|
|
6345
6348
|
getDownloadUrl(e) {
|
|
6346
6349
|
return U(this, void 0, void 0, function* () {
|
|
6347
6350
|
var n;
|
|
6348
6351
|
const r = yield this.getCurrentUser(), i = (n = r == null ? void 0 : r.user) === null || n === void 0 ? void 0 : n.refresh_token;
|
|
6349
|
-
return yield
|
|
6352
|
+
return yield Ou({
|
|
6350
6353
|
apiURI: this.config.apiURI,
|
|
6351
6354
|
appId: this.config.appId,
|
|
6352
6355
|
path: e,
|
|
@@ -6356,9 +6359,9 @@ class na {
|
|
|
6356
6359
|
}
|
|
6357
6360
|
}
|
|
6358
6361
|
let it;
|
|
6359
|
-
function
|
|
6362
|
+
function ia(t, e) {
|
|
6360
6363
|
it == null || it.dispose();
|
|
6361
|
-
const n =
|
|
6364
|
+
const n = da(e), r = ua(e, u), i = oa(sa(t));
|
|
6362
6365
|
function s(c) {
|
|
6363
6366
|
var f;
|
|
6364
6367
|
c.source === i.element.contentWindow && ((f = c.data) === null || f === void 0 ? void 0 : f.type) === "close" && n.isVisible() && u();
|
|
@@ -6380,10 +6383,10 @@ function ra(t, e) {
|
|
|
6380
6383
|
}
|
|
6381
6384
|
return d();
|
|
6382
6385
|
}
|
|
6383
|
-
function ia(t) {
|
|
6384
|
-
return `${pn || ii ? "http://localhost:3000" : "https://instantdb.com"}/_devtool?appId=${t}`;
|
|
6385
|
-
}
|
|
6386
6386
|
function sa(t) {
|
|
6387
|
+
return `${yn || si ? "http://localhost:3000" : "https://instantdb.com"}/_devtool?appId=${t}`;
|
|
6388
|
+
}
|
|
6389
|
+
function oa(t) {
|
|
6387
6390
|
const e = document.createElement("iframe");
|
|
6388
6391
|
return e.src = t, e.className = "instant-devtool-iframe", Object.assign(e.style, {
|
|
6389
6392
|
width: "100%",
|
|
@@ -6392,7 +6395,7 @@ function sa(t) {
|
|
|
6392
6395
|
border: "none"
|
|
6393
6396
|
}), { element: e };
|
|
6394
6397
|
}
|
|
6395
|
-
function
|
|
6398
|
+
function ua(t, e) {
|
|
6396
6399
|
const n = `
|
|
6397
6400
|
<svg width="32" height="32" viewBox="0 0 512 512" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
6398
6401
|
<rect width="512" height="512" fill="black"/>
|
|
@@ -6402,7 +6405,7 @@ function oa(t, e) {
|
|
|
6402
6405
|
return r.innerHTML = n, r.className = "instant-devtool-toggler", Object.assign(r.style, Object.assign(Object.assign({
|
|
6403
6406
|
// pos
|
|
6404
6407
|
position: "fixed"
|
|
6405
|
-
},
|
|
6408
|
+
}, aa(t.position)), {
|
|
6406
6409
|
height: "32px",
|
|
6407
6410
|
width: "32px",
|
|
6408
6411
|
// layout
|
|
@@ -6417,7 +6420,7 @@ function oa(t, e) {
|
|
|
6417
6420
|
cursor: "pointer"
|
|
6418
6421
|
})), r.addEventListener("click", e), { element: r };
|
|
6419
6422
|
}
|
|
6420
|
-
function
|
|
6423
|
+
function aa(t) {
|
|
6421
6424
|
switch (t) {
|
|
6422
6425
|
case "bottom-left":
|
|
6423
6426
|
return { bottom: "24px", left: "24px" };
|
|
@@ -6429,7 +6432,7 @@ function ua(t) {
|
|
|
6429
6432
|
return { top: "24px", left: "24px" };
|
|
6430
6433
|
}
|
|
6431
6434
|
}
|
|
6432
|
-
function
|
|
6435
|
+
function ca(t) {
|
|
6433
6436
|
switch (t) {
|
|
6434
6437
|
case "bottom-left":
|
|
6435
6438
|
return { bottom: "24px", right: "24px", left: "60px", top: "72px" };
|
|
@@ -6441,47 +6444,47 @@ function aa(t) {
|
|
|
6441
6444
|
return { top: "24px", right: "24px", left: "60px", bottom: "72px" };
|
|
6442
6445
|
}
|
|
6443
6446
|
}
|
|
6444
|
-
function
|
|
6447
|
+
function da(t) {
|
|
6445
6448
|
const e = document.createElement("div");
|
|
6446
|
-
Object.assign(e.style, Object.assign(Object.assign({ position: "fixed" },
|
|
6449
|
+
Object.assign(e.style, Object.assign(Object.assign({ position: "fixed" }, ca(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";
|
|
6447
6450
|
function n() {
|
|
6448
6451
|
return e.style.display !== "none";
|
|
6449
6452
|
}
|
|
6450
6453
|
return { element: e, isVisible: n };
|
|
6451
6454
|
}
|
|
6452
|
-
const
|
|
6455
|
+
const fa = {
|
|
6453
6456
|
apiURI: "https://api.instantdb.com",
|
|
6454
6457
|
websocketURI: "wss://api.instantdb.com/runtime/session"
|
|
6455
6458
|
};
|
|
6456
|
-
function
|
|
6459
|
+
function la() {
|
|
6457
6460
|
var t;
|
|
6458
6461
|
return globalThis.__instantDbSchemaHashStore = (t = globalThis.__instantDbSchemaHashStore) !== null && t !== void 0 ? t : /* @__PURE__ */ new WeakMap(), globalThis.__instantDbSchemaHashStore;
|
|
6459
6462
|
}
|
|
6460
|
-
function
|
|
6463
|
+
function ha() {
|
|
6461
6464
|
var t;
|
|
6462
6465
|
return globalThis.__instantDbStore = (t = globalThis.__instantDbStore) !== null && t !== void 0 ? t : {}, globalThis.__instantDbStore;
|
|
6463
6466
|
}
|
|
6464
|
-
function
|
|
6467
|
+
function Xt(t) {
|
|
6465
6468
|
const e = t.__adminToken;
|
|
6466
6469
|
return t.appId + "_" + (t.websocketURI || "default_ws_uri") + "_" + (t.apiURI || "default_api_uri") + "_" + (e || "client_only") + "_" + t.useDateObjects;
|
|
6467
6470
|
}
|
|
6468
|
-
const
|
|
6469
|
-
class
|
|
6471
|
+
const en = ha(), Rt = la();
|
|
6472
|
+
class pa {
|
|
6470
6473
|
constructor(e) {
|
|
6471
6474
|
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);
|
|
6472
6475
|
}
|
|
6473
6476
|
}
|
|
6474
|
-
class
|
|
6477
|
+
class ya {
|
|
6475
6478
|
constructor(e) {
|
|
6476
6479
|
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);
|
|
6477
6480
|
}
|
|
6478
6481
|
}
|
|
6479
|
-
function
|
|
6482
|
+
function ba(t) {
|
|
6480
6483
|
return JSON.parse(JSON.stringify(t));
|
|
6481
6484
|
}
|
|
6482
|
-
class
|
|
6485
|
+
class _a {
|
|
6483
6486
|
constructor(e) {
|
|
6484
|
-
this.tx =
|
|
6487
|
+
this.tx = pn(), this._reactor = e, this.auth = new pa(this._reactor), this.storage = new ya(this._reactor);
|
|
6485
6488
|
}
|
|
6486
6489
|
/**
|
|
6487
6490
|
* Use this to write data! You can create, update, delete, and link objects
|
|
@@ -6622,7 +6625,7 @@ class ba {
|
|
|
6622
6625
|
};
|
|
6623
6626
|
}
|
|
6624
6627
|
shutdown() {
|
|
6625
|
-
delete Xt
|
|
6628
|
+
delete en[Xt(this._reactor.config)], this._reactor.shutdown();
|
|
6626
6629
|
}
|
|
6627
6630
|
/**
|
|
6628
6631
|
* Use this for one-off queries.
|
|
@@ -6655,37 +6658,37 @@ class ba {
|
|
|
6655
6658
|
return this._reactor.subscribeTable(e, n);
|
|
6656
6659
|
}
|
|
6657
6660
|
}
|
|
6658
|
-
function
|
|
6661
|
+
function vr(t) {
|
|
6659
6662
|
if (!t)
|
|
6660
6663
|
return "0";
|
|
6661
|
-
if (
|
|
6662
|
-
return
|
|
6664
|
+
if (Rt.get(t))
|
|
6665
|
+
return Rt.get(t);
|
|
6663
6666
|
const e = N(t);
|
|
6664
|
-
return
|
|
6667
|
+
return Rt.set(t, e), e;
|
|
6665
6668
|
}
|
|
6666
|
-
function
|
|
6667
|
-
return
|
|
6669
|
+
function ga(t, e) {
|
|
6670
|
+
return vr(t._reactor.config.schema) !== vr(e);
|
|
6668
6671
|
}
|
|
6669
|
-
function
|
|
6670
|
-
const s = Xt
|
|
6672
|
+
function Ta(t, e, n, r, i) {
|
|
6673
|
+
const s = en[Xt(t)];
|
|
6671
6674
|
if (s)
|
|
6672
|
-
return
|
|
6673
|
-
const o = new
|
|
6674
|
-
return Xt
|
|
6675
|
+
return ga(s, t.schema) && s._reactor.updateSchema(t.schema), s;
|
|
6676
|
+
const o = new ra(Object.assign(Object.assign(Object.assign({}, fa), t), { cardinalityInference: !!t.schema }), e || ni, n || ri, Object.assign(Object.assign({}, r || {}), { "@instantdb/core": ui }), i), u = new _a(o);
|
|
6677
|
+
return en[Xt(t)] = u, ma(t.appId, t.devtool), u;
|
|
6675
6678
|
}
|
|
6676
|
-
function
|
|
6679
|
+
function ma(t, e) {
|
|
6677
6680
|
if (typeof window > "u" || typeof window.location > "u" || typeof document > "u" || typeof e == "boolean" && !e)
|
|
6678
6681
|
return;
|
|
6679
6682
|
const n = Object.assign({ position: "bottom-right", allowedHosts: ["localhost"] }, typeof e == "object" ? e : {});
|
|
6680
|
-
n.allowedHosts.includes(window.location.hostname) &&
|
|
6683
|
+
n.allowedHosts.includes(window.location.hostname) && ia(t, n);
|
|
6681
6684
|
}
|
|
6682
|
-
const
|
|
6685
|
+
const wa = {
|
|
6683
6686
|
isLoading: !0,
|
|
6684
6687
|
data: void 0,
|
|
6685
6688
|
pageInfo: void 0,
|
|
6686
6689
|
error: void 0
|
|
6687
6690
|
};
|
|
6688
|
-
function
|
|
6691
|
+
function Sr(t) {
|
|
6689
6692
|
return {
|
|
6690
6693
|
isLoading: !t,
|
|
6691
6694
|
data: void 0,
|
|
@@ -6694,12 +6697,12 @@ function vr(t) {
|
|
|
6694
6697
|
...t || {}
|
|
6695
6698
|
};
|
|
6696
6699
|
}
|
|
6697
|
-
function
|
|
6700
|
+
function va(t, e, n) {
|
|
6698
6701
|
e && n && "ruleParams" in n && (e = { $$ruleParams: n.ruleParams, ...e });
|
|
6699
|
-
const r = e ?
|
|
6700
|
-
|
|
6702
|
+
const r = e ? ba(e) : null, i = N(r), s = ze(
|
|
6703
|
+
Sr(t._reactor.getPreviousResult(r))
|
|
6701
6704
|
), o = de(
|
|
6702
|
-
(a) => (s.current =
|
|
6705
|
+
(a) => (s.current = Sr(
|
|
6703
6706
|
t._reactor.getPreviousResult(r)
|
|
6704
6707
|
), r ? t.subscribeQuery(r, (c) => {
|
|
6705
6708
|
s.current = {
|
|
@@ -6714,13 +6717,13 @@ function wa(t, e, n) {
|
|
|
6714
6717
|
// Build a new subscribe function if the query changes
|
|
6715
6718
|
[i]
|
|
6716
6719
|
);
|
|
6717
|
-
return { state:
|
|
6720
|
+
return { state: $t(
|
|
6718
6721
|
o,
|
|
6719
6722
|
() => s.current,
|
|
6720
|
-
() =>
|
|
6723
|
+
() => wa
|
|
6721
6724
|
), query: r };
|
|
6722
6725
|
}
|
|
6723
|
-
function
|
|
6726
|
+
function Sa() {
|
|
6724
6727
|
const t = ze(null);
|
|
6725
6728
|
ge(() => {
|
|
6726
6729
|
n();
|
|
@@ -6733,8 +6736,8 @@ function va() {
|
|
|
6733
6736
|
}
|
|
6734
6737
|
return { set: e, clear: n };
|
|
6735
6738
|
}
|
|
6736
|
-
const
|
|
6737
|
-
function
|
|
6739
|
+
const Oa = 1e3;
|
|
6740
|
+
function Ea(t, e, n) {
|
|
6738
6741
|
const r = ze(n);
|
|
6739
6742
|
r.current = n, ge(() => t.core._reactor.subscribeTopic(
|
|
6740
6743
|
t.id,
|
|
@@ -6744,7 +6747,7 @@ function Oa(t, e, n) {
|
|
|
6744
6747
|
}
|
|
6745
6748
|
), [t.id, e]);
|
|
6746
6749
|
}
|
|
6747
|
-
function
|
|
6750
|
+
function Aa(t, e) {
|
|
6748
6751
|
return ge(() => t.core._reactor.joinRoom(t.id), [t.id]), de(
|
|
6749
6752
|
(r) => {
|
|
6750
6753
|
t.core._reactor.publishTopic({
|
|
@@ -6757,9 +6760,9 @@ function Ea(t, e) {
|
|
|
6757
6760
|
[t.id, e]
|
|
6758
6761
|
);
|
|
6759
6762
|
}
|
|
6760
|
-
function
|
|
6763
|
+
function ka(t, e = {}) {
|
|
6761
6764
|
var o, u;
|
|
6762
|
-
const [n, r] =
|
|
6765
|
+
const [n, r] = Er(() => t.core._reactor.getPresence(t.type, t.id, e) ?? {
|
|
6763
6766
|
peers: {},
|
|
6764
6767
|
isLoading: !0
|
|
6765
6768
|
});
|
|
@@ -6777,18 +6780,18 @@ function Aa(t, e = {}) {
|
|
|
6777
6780
|
},
|
|
6778
6781
|
[t.type, t.id]
|
|
6779
6782
|
);
|
|
6780
|
-
return
|
|
6783
|
+
return xt(() => ({
|
|
6781
6784
|
...n,
|
|
6782
6785
|
publishPresence: i
|
|
6783
6786
|
}), [n, i]);
|
|
6784
6787
|
}
|
|
6785
|
-
function
|
|
6788
|
+
function ja(t, e, n) {
|
|
6786
6789
|
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)]);
|
|
6787
6790
|
}
|
|
6788
|
-
function
|
|
6789
|
-
const r =
|
|
6791
|
+
function Ca(t, e, n = {}) {
|
|
6792
|
+
const r = Sa(), i = ye.usePresence(t, {
|
|
6790
6793
|
keys: [e]
|
|
6791
|
-
}), s =
|
|
6794
|
+
}), s = xt(() => {
|
|
6792
6795
|
const c = t._core._reactor.getPresence(
|
|
6793
6796
|
t.type,
|
|
6794
6797
|
t.id
|
|
@@ -6800,7 +6803,7 @@ function ja(t, e, n = {}) {
|
|
|
6800
6803
|
(c) => {
|
|
6801
6804
|
t.core._reactor.publishPresence(t.type, t.id, {
|
|
6802
6805
|
[e]: c
|
|
6803
|
-
}), c && ((n == null ? void 0 : n.timeout) === null || (n == null ? void 0 : n.timeout) === 0 || r.set((n == null ? void 0 : n.timeout) ??
|
|
6806
|
+
}), c && ((n == null ? void 0 : n.timeout) === null || (n == null ? void 0 : n.timeout) === 0 || r.set((n == null ? void 0 : n.timeout) ?? Oa, () => {
|
|
6804
6807
|
t.core._reactor.publishPresence(t.type, t.id, {
|
|
6805
6808
|
[e]: null
|
|
6806
6809
|
});
|
|
@@ -6815,7 +6818,7 @@ function ja(t, e, n = {}) {
|
|
|
6815
6818
|
[n.stopOnEnter, o]
|
|
6816
6819
|
), a = de(() => {
|
|
6817
6820
|
o(!1);
|
|
6818
|
-
}, [o]), d =
|
|
6821
|
+
}, [o]), d = xt(() => ({ onKeyDown: u, onBlur: a }), [u, a]);
|
|
6819
6822
|
return {
|
|
6820
6823
|
active: s,
|
|
6821
6824
|
setActive: o,
|
|
@@ -6823,35 +6826,35 @@ function ja(t, e, n = {}) {
|
|
|
6823
6826
|
};
|
|
6824
6827
|
}
|
|
6825
6828
|
const ye = {
|
|
6826
|
-
useTopicEffect:
|
|
6827
|
-
usePublishTopic:
|
|
6828
|
-
usePresence:
|
|
6829
|
-
useSyncPresence:
|
|
6830
|
-
useTypingIndicator:
|
|
6829
|
+
useTopicEffect: Ea,
|
|
6830
|
+
usePublishTopic: Aa,
|
|
6831
|
+
usePresence: ka,
|
|
6832
|
+
useSyncPresence: ja,
|
|
6833
|
+
useTypingIndicator: Ca
|
|
6831
6834
|
};
|
|
6832
|
-
class
|
|
6835
|
+
class Pa {
|
|
6833
6836
|
constructor(e, n, r) {
|
|
6834
6837
|
this.useTopicEffect = (i, s) => {
|
|
6835
6838
|
ye.useTopicEffect(this, i, s);
|
|
6836
6839
|
}, 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;
|
|
6837
6840
|
}
|
|
6838
6841
|
}
|
|
6839
|
-
const
|
|
6842
|
+
const Ia = {
|
|
6840
6843
|
isLoading: !0,
|
|
6841
6844
|
user: void 0,
|
|
6842
6845
|
error: void 0
|
|
6843
6846
|
};
|
|
6844
|
-
class
|
|
6847
|
+
class Ra {
|
|
6845
6848
|
constructor(e, n) {
|
|
6846
|
-
this.tx =
|
|
6847
|
-
const [i, s] =
|
|
6849
|
+
this.tx = pn(), this.getLocalId = (r) => this.core.getLocalId(r), this.useLocalId = (r) => {
|
|
6850
|
+
const [i, s] = Er(null);
|
|
6848
6851
|
return ge(() => {
|
|
6849
6852
|
(async () => {
|
|
6850
6853
|
const u = await this.getLocalId(r);
|
|
6851
6854
|
s(u);
|
|
6852
6855
|
})();
|
|
6853
6856
|
}, [r]), i;
|
|
6854
|
-
}, this.rooms = ye, this.transact = (r) => this.core.transact(r), this.useQuery = (r, i) =>
|
|
6857
|
+
}, this.rooms = ye, this.transact = (r) => this.core.transact(r), this.useQuery = (r, i) => va(
|
|
6855
6858
|
this.core,
|
|
6856
6859
|
r,
|
|
6857
6860
|
i
|
|
@@ -6861,10 +6864,10 @@ class Ma {
|
|
|
6861
6864
|
), i = de((o) => this.core.subscribeAuth((a) => {
|
|
6862
6865
|
r.current = { isLoading: !1, ...a }, o();
|
|
6863
6866
|
}), []);
|
|
6864
|
-
return
|
|
6867
|
+
return $t(
|
|
6865
6868
|
i,
|
|
6866
6869
|
() => r.current,
|
|
6867
|
-
() =>
|
|
6870
|
+
() => Ia
|
|
6868
6871
|
);
|
|
6869
6872
|
}, this.useUser = () => {
|
|
6870
6873
|
const { user: r } = this.useAuth();
|
|
@@ -6879,7 +6882,7 @@ class Ma {
|
|
|
6879
6882
|
), i = de((o) => this.core.subscribeConnectionStatus((a) => {
|
|
6880
6883
|
a !== r.current && (r.current = a, o());
|
|
6881
6884
|
}), []);
|
|
6882
|
-
return
|
|
6885
|
+
return $t(
|
|
6883
6886
|
i,
|
|
6884
6887
|
() => r.current,
|
|
6885
6888
|
// For SSR, always return 'connecting' as the initial state
|
|
@@ -6891,7 +6894,7 @@ class Ma {
|
|
|
6891
6894
|
}, this.SignedOut = ({ children: r }) => {
|
|
6892
6895
|
const i = this.useAuth();
|
|
6893
6896
|
return i.isLoading || i.error || i.user ? null : /* @__PURE__ */ et.jsx(et.Fragment, { children: r });
|
|
6894
|
-
}, this.core =
|
|
6897
|
+
}, this.core = Ta(
|
|
6895
6898
|
e,
|
|
6896
6899
|
// @ts-expect-error because TS can't resolve subclass statics
|
|
6897
6900
|
this.constructor.Storage,
|
|
@@ -6915,7 +6918,7 @@ class Ma {
|
|
|
6915
6918
|
* const { peers } = db.rooms.usePresence(room);
|
|
6916
6919
|
*/
|
|
6917
6920
|
room(e = "_defaultRoomType", n = "_defaultRoomId") {
|
|
6918
|
-
return new
|
|
6921
|
+
return new Pa(this.core, e, n);
|
|
6919
6922
|
}
|
|
6920
6923
|
/**
|
|
6921
6924
|
* One time query for the logged in state. This is useful
|
|
@@ -6932,5 +6935,5 @@ class Ma {
|
|
|
6932
6935
|
}
|
|
6933
6936
|
}
|
|
6934
6937
|
export {
|
|
6935
|
-
|
|
6938
|
+
Ra as InstantReactAbstractDatabase
|
|
6936
6939
|
};
|