@instantdb/react-common 0.22.47-experimental.sync-table.19154203588.1 → 0.22.47-experimental.sync-table.19184737115.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 +1079 -1029
- package/dist/standalone/index.umd.cjs +10 -10
- package/package.json +3 -3
package/dist/standalone/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
var
|
|
1
|
+
import Tr, { useRef as it, useCallback as ae, useSyncExternalStore as It, useEffect as ye, useMemo as Pt, useState as wr } from "react";
|
|
2
|
+
var Mt = { exports: {} }, Me = {};
|
|
3
3
|
/**
|
|
4
4
|
* @license React
|
|
5
5
|
* react-jsx-runtime.production.min.js
|
|
@@ -9,11 +9,11 @@ var It = { exports: {} }, Pe = {};
|
|
|
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 xn;
|
|
13
|
+
function xi() {
|
|
14
|
+
if (xn) return Me;
|
|
15
|
+
xn = 1;
|
|
16
|
+
var t = Tr, 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, c, d) {
|
|
18
18
|
var a, f = {}, h = null, p = null;
|
|
19
19
|
d !== void 0 && (h = "" + d), c.key !== void 0 && (h = "" + c.key), c.ref !== void 0 && (p = c.ref);
|
|
@@ -21,12 +21,12 @@ function Ri() {
|
|
|
21
21
|
if (u && u.defaultProps) for (a in c = u.defaultProps, c) f[a] === void 0 && (f[a] = c[a]);
|
|
22
22
|
return { $$typeof: e, type: u, key: h, ref: p, props: f, _owner: i.current };
|
|
23
23
|
}
|
|
24
|
-
return
|
|
24
|
+
return Me.Fragment = n, Me.jsx = o, Me.jsxs = o, Me;
|
|
25
25
|
}
|
|
26
|
-
var
|
|
27
|
-
function
|
|
28
|
-
if (
|
|
29
|
-
|
|
26
|
+
var Re = {}, Un;
|
|
27
|
+
function Ui() {
|
|
28
|
+
if (Un) return Re;
|
|
29
|
+
Un = 1;
|
|
30
30
|
var t = {};
|
|
31
31
|
/**
|
|
32
32
|
* @license React
|
|
@@ -38,7 +38,7 @@ function $i() {
|
|
|
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 = Tr, 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"), c = Symbol.for("react.context"), d = Symbol.for("react.forward_ref"), a = Symbol.for("react.suspense"), f = Symbol.for("react.suspense_list"), h = Symbol.for("react.memo"), p = Symbol.for("react.lazy"), y = Symbol.for("react.offscreen"), _ = Symbol.iterator, T = "@@iterator";
|
|
42
42
|
function g(l) {
|
|
43
43
|
if (l === null || typeof l != "object")
|
|
44
44
|
return null;
|
|
@@ -63,23 +63,23 @@ function $i() {
|
|
|
63
63
|
k.unshift("Warning: " + b), Function.prototype.apply.call(console[l], console, k);
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
|
-
var O = !1, P = !1, U = !1, q = !1,
|
|
67
|
-
|
|
68
|
-
function
|
|
69
|
-
return !!(typeof l == "string" || typeof l == "function" || l === i || l === o ||
|
|
66
|
+
var O = !1, P = !1, U = !1, q = !1, ke = !1, ze;
|
|
67
|
+
ze = Symbol.for("react.module.reference");
|
|
68
|
+
function lt(l) {
|
|
69
|
+
return !!(typeof l == "string" || typeof l == "function" || l === i || l === o || ke || l === s || l === a || l === f || q || l === y || O || P || U || typeof l == "object" && l !== null && (l.$$typeof === p || l.$$typeof === h || l.$$typeof === u || l.$$typeof === c || l.$$typeof === d || // This needs to include all possible module reference object
|
|
70
70
|
// types supported by any Flight configuration anywhere since
|
|
71
71
|
// we don't know which Flight build this will end up being used
|
|
72
72
|
// with.
|
|
73
|
-
l.$$typeof ===
|
|
73
|
+
l.$$typeof === ze || l.getModuleId !== void 0));
|
|
74
74
|
}
|
|
75
|
-
function
|
|
75
|
+
function ht(l, b, w) {
|
|
76
76
|
var v = l.displayName;
|
|
77
77
|
if (v)
|
|
78
78
|
return v;
|
|
79
79
|
var j = b.displayName || b.name || "";
|
|
80
80
|
return j !== "" ? w + "(" + j + ")" : w;
|
|
81
81
|
}
|
|
82
|
-
function
|
|
82
|
+
function Ke(l) {
|
|
83
83
|
return l.displayName || "Context";
|
|
84
84
|
}
|
|
85
85
|
function ne(l) {
|
|
@@ -107,12 +107,12 @@ function $i() {
|
|
|
107
107
|
switch (l.$$typeof) {
|
|
108
108
|
case c:
|
|
109
109
|
var b = l;
|
|
110
|
-
return
|
|
110
|
+
return Ke(b) + ".Consumer";
|
|
111
111
|
case u:
|
|
112
112
|
var w = l;
|
|
113
|
-
return
|
|
113
|
+
return Ke(w._context) + ".Provider";
|
|
114
114
|
case d:
|
|
115
|
-
return
|
|
115
|
+
return ht(l, l.render, "ForwardRef");
|
|
116
116
|
case h:
|
|
117
117
|
var v = l.displayName || null;
|
|
118
118
|
return v !== null ? v : ne(l.type) || "Memo";
|
|
@@ -127,18 +127,18 @@ function $i() {
|
|
|
127
127
|
}
|
|
128
128
|
return null;
|
|
129
129
|
}
|
|
130
|
-
var
|
|
131
|
-
function
|
|
130
|
+
var de = Object.assign, Ie = 0, hn, pn, yn, bn, _n, gn, Tn;
|
|
131
|
+
function wn() {
|
|
132
132
|
}
|
|
133
|
-
|
|
134
|
-
function
|
|
133
|
+
wn.__reactDisabledLog = !0;
|
|
134
|
+
function ci() {
|
|
135
135
|
{
|
|
136
|
-
if (
|
|
137
|
-
|
|
136
|
+
if (Ie === 0) {
|
|
137
|
+
hn = console.log, pn = console.info, yn = console.warn, bn = console.error, _n = console.group, gn = console.groupCollapsed, Tn = console.groupEnd;
|
|
138
138
|
var l = {
|
|
139
139
|
configurable: !0,
|
|
140
140
|
enumerable: !0,
|
|
141
|
-
value:
|
|
141
|
+
value: wn,
|
|
142
142
|
writable: !0
|
|
143
143
|
};
|
|
144
144
|
Object.defineProperties(console, {
|
|
@@ -151,77 +151,77 @@ function $i() {
|
|
|
151
151
|
groupEnd: l
|
|
152
152
|
});
|
|
153
153
|
}
|
|
154
|
-
|
|
154
|
+
Ie++;
|
|
155
155
|
}
|
|
156
156
|
}
|
|
157
|
-
function
|
|
157
|
+
function di() {
|
|
158
158
|
{
|
|
159
|
-
if (
|
|
159
|
+
if (Ie--, Ie === 0) {
|
|
160
160
|
var l = {
|
|
161
161
|
configurable: !0,
|
|
162
162
|
enumerable: !0,
|
|
163
163
|
writable: !0
|
|
164
164
|
};
|
|
165
165
|
Object.defineProperties(console, {
|
|
166
|
-
log:
|
|
167
|
-
value: fn
|
|
168
|
-
}),
|
|
169
|
-
info: ce({}, l, {
|
|
170
|
-
value: ln
|
|
171
|
-
}),
|
|
172
|
-
warn: ce({}, l, {
|
|
166
|
+
log: de({}, l, {
|
|
173
167
|
value: hn
|
|
174
168
|
}),
|
|
175
|
-
|
|
169
|
+
info: de({}, l, {
|
|
176
170
|
value: pn
|
|
177
171
|
}),
|
|
178
|
-
|
|
172
|
+
warn: de({}, l, {
|
|
179
173
|
value: yn
|
|
180
174
|
}),
|
|
181
|
-
|
|
175
|
+
error: de({}, l, {
|
|
182
176
|
value: bn
|
|
183
177
|
}),
|
|
184
|
-
|
|
178
|
+
group: de({}, l, {
|
|
185
179
|
value: _n
|
|
180
|
+
}),
|
|
181
|
+
groupCollapsed: de({}, l, {
|
|
182
|
+
value: gn
|
|
183
|
+
}),
|
|
184
|
+
groupEnd: de({}, l, {
|
|
185
|
+
value: Tn
|
|
186
186
|
})
|
|
187
187
|
});
|
|
188
188
|
}
|
|
189
|
-
|
|
189
|
+
Ie < 0 && m("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
|
|
190
190
|
}
|
|
191
191
|
}
|
|
192
|
-
var
|
|
193
|
-
function
|
|
192
|
+
var pt = S.ReactCurrentDispatcher, yt;
|
|
193
|
+
function Be(l, b, w) {
|
|
194
194
|
{
|
|
195
|
-
if (
|
|
195
|
+
if (yt === void 0)
|
|
196
196
|
try {
|
|
197
197
|
throw Error();
|
|
198
198
|
} catch (j) {
|
|
199
199
|
var v = j.stack.trim().match(/\n( *(at )?)/);
|
|
200
|
-
|
|
200
|
+
yt = v && v[1] || "";
|
|
201
201
|
}
|
|
202
202
|
return `
|
|
203
|
-
` +
|
|
203
|
+
` + yt + l;
|
|
204
204
|
}
|
|
205
205
|
}
|
|
206
|
-
var
|
|
206
|
+
var bt = !1, Qe;
|
|
207
207
|
{
|
|
208
|
-
var
|
|
209
|
-
|
|
208
|
+
var fi = typeof WeakMap == "function" ? WeakMap : Map;
|
|
209
|
+
Qe = new fi();
|
|
210
210
|
}
|
|
211
|
-
function
|
|
212
|
-
if (!l ||
|
|
211
|
+
function Sn(l, b) {
|
|
212
|
+
if (!l || bt)
|
|
213
213
|
return "";
|
|
214
214
|
{
|
|
215
|
-
var w =
|
|
215
|
+
var w = Qe.get(l);
|
|
216
216
|
if (w !== void 0)
|
|
217
217
|
return w;
|
|
218
218
|
}
|
|
219
219
|
var v;
|
|
220
|
-
|
|
220
|
+
bt = !0;
|
|
221
221
|
var j = Error.prepareStackTrace;
|
|
222
222
|
Error.prepareStackTrace = void 0;
|
|
223
223
|
var k;
|
|
224
|
-
k =
|
|
224
|
+
k = pt.current, pt.current = null, ci();
|
|
225
225
|
try {
|
|
226
226
|
if (b) {
|
|
227
227
|
var C = function() {
|
|
@@ -267,65 +267,65 @@ function $i() {
|
|
|
267
267
|
if (R--, D--, D < 0 || E[R] !== W[D]) {
|
|
268
268
|
var J = `
|
|
269
269
|
` + E[R].replace(" at new ", " at ");
|
|
270
|
-
return l.displayName && J.includes("<anonymous>") && (J = J.replace("<anonymous>", l.displayName)), typeof l == "function" &&
|
|
270
|
+
return l.displayName && J.includes("<anonymous>") && (J = J.replace("<anonymous>", l.displayName)), typeof l == "function" && Qe.set(l, J), J;
|
|
271
271
|
}
|
|
272
272
|
while (R >= 1 && D >= 0);
|
|
273
273
|
break;
|
|
274
274
|
}
|
|
275
275
|
}
|
|
276
276
|
} finally {
|
|
277
|
-
|
|
277
|
+
bt = !1, pt.current = k, di(), Error.prepareStackTrace = j;
|
|
278
278
|
}
|
|
279
|
-
var
|
|
280
|
-
return typeof l == "function" &&
|
|
279
|
+
var Te = l ? l.displayName || l.name : "", fe = Te ? Be(Te) : "";
|
|
280
|
+
return typeof l == "function" && Qe.set(l, fe), fe;
|
|
281
281
|
}
|
|
282
|
-
function
|
|
283
|
-
return
|
|
282
|
+
function li(l, b, w) {
|
|
283
|
+
return Sn(l, !1);
|
|
284
284
|
}
|
|
285
|
-
function
|
|
285
|
+
function hi(l) {
|
|
286
286
|
var b = l.prototype;
|
|
287
287
|
return !!(b && b.isReactComponent);
|
|
288
288
|
}
|
|
289
|
-
function
|
|
289
|
+
function Ge(l, b, w) {
|
|
290
290
|
if (l == null)
|
|
291
291
|
return "";
|
|
292
292
|
if (typeof l == "function")
|
|
293
|
-
return
|
|
293
|
+
return Sn(l, hi(l));
|
|
294
294
|
if (typeof l == "string")
|
|
295
|
-
return
|
|
295
|
+
return Be(l);
|
|
296
296
|
switch (l) {
|
|
297
297
|
case a:
|
|
298
|
-
return
|
|
298
|
+
return Be("Suspense");
|
|
299
299
|
case f:
|
|
300
|
-
return
|
|
300
|
+
return Be("SuspenseList");
|
|
301
301
|
}
|
|
302
302
|
if (typeof l == "object")
|
|
303
303
|
switch (l.$$typeof) {
|
|
304
304
|
case d:
|
|
305
|
-
return
|
|
305
|
+
return li(l.render);
|
|
306
306
|
case h:
|
|
307
|
-
return
|
|
307
|
+
return Ge(l.type, b, w);
|
|
308
308
|
case p: {
|
|
309
309
|
var v = l, j = v._payload, k = v._init;
|
|
310
310
|
try {
|
|
311
|
-
return
|
|
311
|
+
return Ge(k(j), b, w);
|
|
312
312
|
} catch {
|
|
313
313
|
}
|
|
314
314
|
}
|
|
315
315
|
}
|
|
316
316
|
return "";
|
|
317
317
|
}
|
|
318
|
-
var
|
|
319
|
-
function
|
|
318
|
+
var Pe = Object.prototype.hasOwnProperty, mn = {}, vn = S.ReactDebugCurrentFrame;
|
|
319
|
+
function He(l) {
|
|
320
320
|
if (l) {
|
|
321
|
-
var b = l._owner, w =
|
|
322
|
-
|
|
321
|
+
var b = l._owner, w = Ge(l.type, l._source, b ? b.type : null);
|
|
322
|
+
vn.setExtraStackFrame(w);
|
|
323
323
|
} else
|
|
324
|
-
|
|
324
|
+
vn.setExtraStackFrame(null);
|
|
325
325
|
}
|
|
326
|
-
function
|
|
326
|
+
function pi(l, b, w, v, j) {
|
|
327
327
|
{
|
|
328
|
-
var k = Function.call.bind(
|
|
328
|
+
var k = Function.call.bind(Pe);
|
|
329
329
|
for (var C in l)
|
|
330
330
|
if (k(l, C)) {
|
|
331
331
|
var E = void 0;
|
|
@@ -338,63 +338,63 @@ function $i() {
|
|
|
338
338
|
} catch (R) {
|
|
339
339
|
E = R;
|
|
340
340
|
}
|
|
341
|
-
E && !(E instanceof Error) && (
|
|
341
|
+
E && !(E instanceof Error) && (He(j), m("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", v || "React class", w, C, typeof E), He(null)), E instanceof Error && !(E.message in mn) && (mn[E.message] = !0, He(j), m("Failed %s type: %s", w, E.message), He(null));
|
|
342
342
|
}
|
|
343
343
|
}
|
|
344
344
|
}
|
|
345
|
-
var
|
|
346
|
-
function
|
|
347
|
-
return
|
|
345
|
+
var yi = Array.isArray;
|
|
346
|
+
function _t(l) {
|
|
347
|
+
return yi(l);
|
|
348
348
|
}
|
|
349
|
-
function
|
|
349
|
+
function bi(l) {
|
|
350
350
|
{
|
|
351
351
|
var b = typeof Symbol == "function" && Symbol.toStringTag, w = b && l[Symbol.toStringTag] || l.constructor.name || "Object";
|
|
352
352
|
return w;
|
|
353
353
|
}
|
|
354
354
|
}
|
|
355
|
-
function
|
|
355
|
+
function _i(l) {
|
|
356
356
|
try {
|
|
357
|
-
return
|
|
357
|
+
return On(l), !1;
|
|
358
358
|
} catch {
|
|
359
359
|
return !0;
|
|
360
360
|
}
|
|
361
361
|
}
|
|
362
|
-
function
|
|
362
|
+
function On(l) {
|
|
363
363
|
return "" + l;
|
|
364
364
|
}
|
|
365
|
-
function
|
|
366
|
-
if (
|
|
367
|
-
return m("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",
|
|
365
|
+
function En(l) {
|
|
366
|
+
if (_i(l))
|
|
367
|
+
return m("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", bi(l)), On(l);
|
|
368
368
|
}
|
|
369
|
-
var
|
|
369
|
+
var An = S.ReactCurrentOwner, gi = {
|
|
370
370
|
key: !0,
|
|
371
371
|
ref: !0,
|
|
372
372
|
__self: !0,
|
|
373
373
|
__source: !0
|
|
374
|
-
},
|
|
375
|
-
function
|
|
376
|
-
if (
|
|
374
|
+
}, Cn, jn;
|
|
375
|
+
function Ti(l) {
|
|
376
|
+
if (Pe.call(l, "ref")) {
|
|
377
377
|
var b = Object.getOwnPropertyDescriptor(l, "ref").get;
|
|
378
378
|
if (b && b.isReactWarning)
|
|
379
379
|
return !1;
|
|
380
380
|
}
|
|
381
381
|
return l.ref !== void 0;
|
|
382
382
|
}
|
|
383
|
-
function
|
|
384
|
-
if (
|
|
383
|
+
function wi(l) {
|
|
384
|
+
if (Pe.call(l, "key")) {
|
|
385
385
|
var b = Object.getOwnPropertyDescriptor(l, "key").get;
|
|
386
386
|
if (b && b.isReactWarning)
|
|
387
387
|
return !1;
|
|
388
388
|
}
|
|
389
389
|
return l.key !== void 0;
|
|
390
390
|
}
|
|
391
|
-
function
|
|
392
|
-
typeof l.ref == "string" &&
|
|
391
|
+
function Si(l, b) {
|
|
392
|
+
typeof l.ref == "string" && An.current;
|
|
393
393
|
}
|
|
394
|
-
function
|
|
394
|
+
function mi(l, b) {
|
|
395
395
|
{
|
|
396
396
|
var w = function() {
|
|
397
|
-
|
|
397
|
+
Cn || (Cn = !0, m("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", b));
|
|
398
398
|
};
|
|
399
399
|
w.isReactWarning = !0, Object.defineProperty(l, "key", {
|
|
400
400
|
get: w,
|
|
@@ -402,10 +402,10 @@ function $i() {
|
|
|
402
402
|
});
|
|
403
403
|
}
|
|
404
404
|
}
|
|
405
|
-
function
|
|
405
|
+
function vi(l, b) {
|
|
406
406
|
{
|
|
407
407
|
var w = function() {
|
|
408
|
-
|
|
408
|
+
jn || (jn = !0, m("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", b));
|
|
409
409
|
};
|
|
410
410
|
w.isReactWarning = !0, Object.defineProperty(l, "ref", {
|
|
411
411
|
get: w,
|
|
@@ -413,7 +413,7 @@ function $i() {
|
|
|
413
413
|
});
|
|
414
414
|
}
|
|
415
415
|
}
|
|
416
|
-
var
|
|
416
|
+
var Oi = function(l, b, w, v, j, k, C) {
|
|
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 $i() {
|
|
|
442
442
|
value: j
|
|
443
443
|
}), Object.freeze && (Object.freeze(E.props), Object.freeze(E)), E;
|
|
444
444
|
};
|
|
445
|
-
function
|
|
445
|
+
function Ei(l, b, w, v, j) {
|
|
446
446
|
{
|
|
447
447
|
var k, C = {}, E = null, W = null;
|
|
448
|
-
w !== void 0 && (
|
|
448
|
+
w !== void 0 && (En(w), E = "" + w), wi(b) && (En(b.key), E = "" + b.key), Ti(b) && (W = b.ref, Si(b, j));
|
|
449
449
|
for (k in b)
|
|
450
|
-
|
|
450
|
+
Pe.call(b, k) && !gi.hasOwnProperty(k) && (C[k] = b[k]);
|
|
451
451
|
if (l && l.defaultProps) {
|
|
452
452
|
var R = l.defaultProps;
|
|
453
453
|
for (k in R)
|
|
@@ -455,28 +455,28 @@ function $i() {
|
|
|
455
455
|
}
|
|
456
456
|
if (E || W) {
|
|
457
457
|
var D = typeof l == "function" ? l.displayName || l.name || "Unknown" : l;
|
|
458
|
-
E &&
|
|
458
|
+
E && mi(C, D), W && vi(C, D);
|
|
459
459
|
}
|
|
460
|
-
return
|
|
460
|
+
return Oi(l, E, W, j, v, An.current, C);
|
|
461
461
|
}
|
|
462
462
|
}
|
|
463
|
-
var
|
|
464
|
-
function
|
|
463
|
+
var gt = S.ReactCurrentOwner, kn = S.ReactDebugCurrentFrame;
|
|
464
|
+
function ge(l) {
|
|
465
465
|
if (l) {
|
|
466
|
-
var b = l._owner, w =
|
|
467
|
-
|
|
466
|
+
var b = l._owner, w = Ge(l.type, l._source, b ? b.type : null);
|
|
467
|
+
kn.setExtraStackFrame(w);
|
|
468
468
|
} else
|
|
469
|
-
|
|
469
|
+
kn.setExtraStackFrame(null);
|
|
470
470
|
}
|
|
471
|
-
var
|
|
472
|
-
|
|
473
|
-
function
|
|
471
|
+
var Tt;
|
|
472
|
+
Tt = !1;
|
|
473
|
+
function wt(l) {
|
|
474
474
|
return typeof l == "object" && l !== null && l.$$typeof === n;
|
|
475
475
|
}
|
|
476
|
-
function
|
|
476
|
+
function In() {
|
|
477
477
|
{
|
|
478
|
-
if (
|
|
479
|
-
var l = ne(
|
|
478
|
+
if (gt.current) {
|
|
479
|
+
var l = ne(gt.current.type);
|
|
480
480
|
if (l)
|
|
481
481
|
return `
|
|
482
482
|
|
|
@@ -485,13 +485,13 @@ Check the render method of \`` + l + "`.";
|
|
|
485
485
|
return "";
|
|
486
486
|
}
|
|
487
487
|
}
|
|
488
|
-
function
|
|
488
|
+
function Ai(l) {
|
|
489
489
|
return "";
|
|
490
490
|
}
|
|
491
|
-
var
|
|
492
|
-
function
|
|
491
|
+
var Pn = {};
|
|
492
|
+
function Ci(l) {
|
|
493
493
|
{
|
|
494
|
-
var b =
|
|
494
|
+
var b = In();
|
|
495
495
|
if (!b) {
|
|
496
496
|
var w = typeof l == "string" ? l : l.displayName || l.name;
|
|
497
497
|
w && (b = `
|
|
@@ -501,39 +501,39 @@ Check the top-level render call using <` + w + ">.");
|
|
|
501
501
|
return b;
|
|
502
502
|
}
|
|
503
503
|
}
|
|
504
|
-
function
|
|
504
|
+
function Mn(l, b) {
|
|
505
505
|
{
|
|
506
506
|
if (!l._store || l._store.validated || l.key != null)
|
|
507
507
|
return;
|
|
508
508
|
l._store.validated = !0;
|
|
509
|
-
var w =
|
|
510
|
-
if (
|
|
509
|
+
var w = Ci(b);
|
|
510
|
+
if (Pn[w])
|
|
511
511
|
return;
|
|
512
|
-
|
|
512
|
+
Pn[w] = !0;
|
|
513
513
|
var v = "";
|
|
514
|
-
l && l._owner && l._owner !==
|
|
514
|
+
l && l._owner && l._owner !== gt.current && (v = " It was passed a child from " + ne(l._owner.type) + "."), ge(l), m('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', w, v), ge(null);
|
|
515
515
|
}
|
|
516
516
|
}
|
|
517
|
-
function
|
|
517
|
+
function Rn(l, b) {
|
|
518
518
|
{
|
|
519
519
|
if (typeof l != "object")
|
|
520
520
|
return;
|
|
521
|
-
if (
|
|
521
|
+
if (_t(l))
|
|
522
522
|
for (var w = 0; w < l.length; w++) {
|
|
523
523
|
var v = l[w];
|
|
524
|
-
|
|
524
|
+
wt(v) && Mn(v, b);
|
|
525
525
|
}
|
|
526
|
-
else if (
|
|
526
|
+
else if (wt(l))
|
|
527
527
|
l._store && (l._store.validated = !0);
|
|
528
528
|
else if (l) {
|
|
529
529
|
var j = g(l);
|
|
530
530
|
if (typeof j == "function" && j !== l.entries)
|
|
531
531
|
for (var k = j.call(l), C; !(C = k.next()).done; )
|
|
532
|
-
|
|
532
|
+
wt(C.value) && Mn(C.value, b);
|
|
533
533
|
}
|
|
534
534
|
}
|
|
535
535
|
}
|
|
536
|
-
function
|
|
536
|
+
function ji(l) {
|
|
537
537
|
{
|
|
538
538
|
var b = l.type;
|
|
539
539
|
if (b == null || typeof b == "string")
|
|
@@ -549,85 +549,85 @@ Check the top-level render call using <` + w + ">.");
|
|
|
549
549
|
return;
|
|
550
550
|
if (w) {
|
|
551
551
|
var v = ne(b);
|
|
552
|
-
|
|
553
|
-
} else if (b.PropTypes !== void 0 && !
|
|
554
|
-
|
|
552
|
+
pi(w, l.props, "prop", v, l);
|
|
553
|
+
} else if (b.PropTypes !== void 0 && !Tt) {
|
|
554
|
+
Tt = !0;
|
|
555
555
|
var j = ne(b);
|
|
556
556
|
m("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", j || "Unknown");
|
|
557
557
|
}
|
|
558
558
|
typeof b.getDefaultProps == "function" && !b.getDefaultProps.isReactClassApproved && m("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
|
|
559
559
|
}
|
|
560
560
|
}
|
|
561
|
-
function
|
|
561
|
+
function ki(l) {
|
|
562
562
|
{
|
|
563
563
|
for (var b = Object.keys(l.props), w = 0; w < b.length; w++) {
|
|
564
564
|
var v = b[w];
|
|
565
565
|
if (v !== "children" && v !== "key") {
|
|
566
|
-
|
|
566
|
+
ge(l), m("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", v), ge(null);
|
|
567
567
|
break;
|
|
568
568
|
}
|
|
569
569
|
}
|
|
570
|
-
l.ref !== null && (
|
|
570
|
+
l.ref !== null && (ge(l), m("Invalid attribute `ref` supplied to `React.Fragment`."), ge(null));
|
|
571
571
|
}
|
|
572
572
|
}
|
|
573
|
-
var
|
|
574
|
-
function
|
|
573
|
+
var $n = {};
|
|
574
|
+
function Dn(l, b, w, v, j, k) {
|
|
575
575
|
{
|
|
576
|
-
var C =
|
|
576
|
+
var C = lt(l);
|
|
577
577
|
if (!C) {
|
|
578
578
|
var E = "";
|
|
579
579
|
(l === void 0 || typeof l == "object" && l !== null && Object.keys(l).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 W =
|
|
581
|
-
W ? E += W : E +=
|
|
580
|
+
var W = Ai();
|
|
581
|
+
W ? E += W : E += In();
|
|
582
582
|
var R;
|
|
583
|
-
l === null ? R = "null" :
|
|
583
|
+
l === null ? R = "null" : _t(l) ? R = "array" : l !== void 0 && l.$$typeof === n ? (R = "<" + (ne(l.type) || "Unknown") + " />", E = " Did you accidentally export a JSX literal instead of a component?") : R = typeof l, m("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", R, E);
|
|
584
584
|
}
|
|
585
|
-
var D =
|
|
585
|
+
var D = Ei(l, b, w, j, k);
|
|
586
586
|
if (D == null)
|
|
587
587
|
return D;
|
|
588
588
|
if (C) {
|
|
589
589
|
var J = b.children;
|
|
590
590
|
if (J !== void 0)
|
|
591
591
|
if (v)
|
|
592
|
-
if (
|
|
593
|
-
for (var
|
|
594
|
-
|
|
592
|
+
if (_t(J)) {
|
|
593
|
+
for (var Te = 0; Te < J.length; Te++)
|
|
594
|
+
Rn(J[Te], l);
|
|
595
595
|
Object.freeze && Object.freeze(J);
|
|
596
596
|
} else
|
|
597
597
|
m("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
|
|
598
598
|
else
|
|
599
|
-
|
|
599
|
+
Rn(J, l);
|
|
600
600
|
}
|
|
601
|
-
if (
|
|
602
|
-
var
|
|
603
|
-
return
|
|
604
|
-
}),
|
|
605
|
-
if (
|
|
606
|
-
var
|
|
601
|
+
if (Pe.call(b, "key")) {
|
|
602
|
+
var fe = ne(l), K = Object.keys(b).filter(function(Di) {
|
|
603
|
+
return Di !== "key";
|
|
604
|
+
}), St = K.length > 0 ? "{key: someKey, " + K.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
605
|
+
if (!$n[fe + St]) {
|
|
606
|
+
var $i = K.length > 0 ? "{" + K.join(": ..., ") + ": ...}" : "{}";
|
|
607
607
|
m(`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} />`,
|
|
612
|
+
<%s key={someKey} {...props} />`, St, fe, $i, fe), $n[fe + St] = !0;
|
|
613
613
|
}
|
|
614
614
|
}
|
|
615
|
-
return l === i ?
|
|
615
|
+
return l === i ? ki(D) : ji(D), D;
|
|
616
616
|
}
|
|
617
617
|
}
|
|
618
|
-
function
|
|
619
|
-
return
|
|
618
|
+
function Ii(l, b, w) {
|
|
619
|
+
return Dn(l, b, w, !0);
|
|
620
620
|
}
|
|
621
|
-
function
|
|
622
|
-
return
|
|
621
|
+
function Pi(l, b, w) {
|
|
622
|
+
return Dn(l, b, w, !1);
|
|
623
623
|
}
|
|
624
|
-
var
|
|
625
|
-
|
|
626
|
-
}(),
|
|
624
|
+
var Mi = Pi, Ri = Ii;
|
|
625
|
+
Re.Fragment = i, Re.jsx = Mi, Re.jsxs = Ri;
|
|
626
|
+
}(), Re;
|
|
627
627
|
}
|
|
628
|
-
var
|
|
629
|
-
|
|
630
|
-
var
|
|
628
|
+
var Li = {};
|
|
629
|
+
Li.NODE_ENV === "production" ? Mt.exports = xi() : Mt.exports = Ui();
|
|
630
|
+
var Ye = Mt.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 $ = {
|
|
|
670
670
|
Remove: "remove",
|
|
671
671
|
Replace: "replace",
|
|
672
672
|
Add: "add"
|
|
673
|
-
},
|
|
673
|
+
}, Sr = Symbol.for("__MUTATIVE_PROXY_DRAFT__"), Fi = Symbol("__MUTATIVE_RAW_RETURN_SYMBOL__"), et = Symbol.iterator, Y = {
|
|
674
674
|
mutable: "mutable",
|
|
675
675
|
immutable: "immutable"
|
|
676
|
-
},
|
|
677
|
-
function
|
|
676
|
+
}, Zt = {};
|
|
677
|
+
function Le(t, e) {
|
|
678
678
|
return t instanceof Map ? t.has(e) : Object.prototype.hasOwnProperty.call(t, e);
|
|
679
679
|
}
|
|
680
|
-
function
|
|
680
|
+
function Ln(t, e) {
|
|
681
681
|
if (e in t) {
|
|
682
682
|
let n = Reflect.getPrototypeOf(t);
|
|
683
683
|
for (; n; ) {
|
|
@@ -688,23 +688,23 @@ function xn(t, e) {
|
|
|
688
688
|
}
|
|
689
689
|
}
|
|
690
690
|
}
|
|
691
|
-
function
|
|
691
|
+
function Xt(t) {
|
|
692
692
|
return Object.getPrototypeOf(t) === Set.prototype;
|
|
693
693
|
}
|
|
694
|
-
function
|
|
694
|
+
function en(t) {
|
|
695
695
|
return Object.getPrototypeOf(t) === Map.prototype;
|
|
696
696
|
}
|
|
697
697
|
function H(t) {
|
|
698
698
|
var e;
|
|
699
699
|
return (e = t.copy) !== null && e !== void 0 ? e : t.original;
|
|
700
700
|
}
|
|
701
|
-
function
|
|
701
|
+
function be(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[Sr];
|
|
706
706
|
}
|
|
707
|
-
function
|
|
707
|
+
function tn(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,62 +715,62 @@ 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 mr(t, e = []) {
|
|
719
719
|
if (Object.hasOwnProperty.call(t, "key")) {
|
|
720
720
|
const n = t.parent.copy, r = A(ue(n, t.key));
|
|
721
721
|
if (r !== null && (r == null ? void 0 : r.original) !== t.original)
|
|
722
722
|
return null;
|
|
723
723
|
const i = t.parent.type === 3, s = i ? Array.from(t.parent.setMap.keys()).indexOf(t.key) : t.key;
|
|
724
|
-
if (!(i && n.size > s ||
|
|
724
|
+
if (!(i && n.size > s || Le(n, s)))
|
|
725
725
|
return null;
|
|
726
726
|
e.push(s);
|
|
727
727
|
}
|
|
728
728
|
if (t.parent)
|
|
729
|
-
return
|
|
729
|
+
return mr(t.parent, e);
|
|
730
730
|
e.reverse();
|
|
731
731
|
try {
|
|
732
|
-
|
|
732
|
+
Ni(t.copy, e);
|
|
733
733
|
} catch {
|
|
734
734
|
return null;
|
|
735
735
|
}
|
|
736
736
|
return e;
|
|
737
737
|
}
|
|
738
|
-
function
|
|
738
|
+
function _e(t) {
|
|
739
739
|
return Array.isArray(t) ? 1 : t instanceof Map ? 2 : t instanceof Set ? 3 : 0;
|
|
740
740
|
}
|
|
741
741
|
function ue(t, e) {
|
|
742
|
-
return
|
|
742
|
+
return _e(t) === 2 ? t.get(e) : t[e];
|
|
743
743
|
}
|
|
744
|
-
function
|
|
745
|
-
|
|
744
|
+
function Ve(t, e, n) {
|
|
745
|
+
_e(t) === 2 ? t.set(e, n) : t[e] = n;
|
|
746
746
|
}
|
|
747
|
-
function
|
|
747
|
+
function mt(t, e) {
|
|
748
748
|
const n = A(t);
|
|
749
749
|
return (n ? H(n) : t)[e];
|
|
750
750
|
}
|
|
751
751
|
function oe(t, e) {
|
|
752
752
|
return t === e ? t !== 0 || 1 / t === 1 / e : t !== t && e !== e;
|
|
753
753
|
}
|
|
754
|
-
function
|
|
754
|
+
function Rt(t) {
|
|
755
755
|
if (t)
|
|
756
756
|
for (; t.finalities.revoke.length > 0; )
|
|
757
757
|
t.finalities.revoke.pop()();
|
|
758
758
|
}
|
|
759
|
-
function
|
|
759
|
+
function he(t, e) {
|
|
760
760
|
return e ? t : [""].concat(t).map((n) => {
|
|
761
761
|
const r = `${n}`;
|
|
762
762
|
return r.indexOf("/") === -1 && r.indexOf("~") === -1 ? r : r.replace(/~/g, "~0").replace(/\//g, "~1");
|
|
763
763
|
}).join("/");
|
|
764
764
|
}
|
|
765
|
-
function
|
|
765
|
+
function Ni(t, e) {
|
|
766
766
|
for (let n = 0; n < e.length - 1; n += 1) {
|
|
767
767
|
const r = e[n];
|
|
768
|
-
if (t = ue(
|
|
768
|
+
if (t = ue(_e(t) === 3 ? Array.from(t) : t, r), typeof t != "object")
|
|
769
769
|
throw new Error(`Cannot resolve patch at '${e.join("/")}'.`);
|
|
770
770
|
}
|
|
771
771
|
return t;
|
|
772
772
|
}
|
|
773
|
-
function
|
|
773
|
+
function Vi(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 Li(t) {
|
|
|
786
786
|
}), Reflect.defineProperty(e, n, r);
|
|
787
787
|
}), e;
|
|
788
788
|
}
|
|
789
|
-
const
|
|
790
|
-
function
|
|
789
|
+
const qi = Object.prototype.propertyIsEnumerable;
|
|
790
|
+
function vr(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 (!Xt(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 (!en(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 Vi(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,33 +817,33 @@ function wr(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
|
+
qi.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 z(t) {
|
|
826
|
-
t.copy || (t.copy =
|
|
826
|
+
t.copy || (t.copy = vr(t.original, t.options));
|
|
827
827
|
}
|
|
828
|
-
function
|
|
828
|
+
function De(t) {
|
|
829
829
|
if (!ee(t))
|
|
830
|
-
return
|
|
830
|
+
return tn(t);
|
|
831
831
|
if (Array.isArray(t))
|
|
832
|
-
return t.map(
|
|
832
|
+
return t.map(De);
|
|
833
833
|
if (t instanceof Map) {
|
|
834
834
|
const n = Array.from(t.entries()).map(([r, i]) => [
|
|
835
835
|
r,
|
|
836
|
-
|
|
836
|
+
De(i)
|
|
837
837
|
]);
|
|
838
|
-
if (!
|
|
838
|
+
if (!en(t)) {
|
|
839
839
|
const r = Object.getPrototypeOf(t).constructor;
|
|
840
840
|
return new r(n);
|
|
841
841
|
}
|
|
842
842
|
return new Map(n);
|
|
843
843
|
}
|
|
844
844
|
if (t instanceof Set) {
|
|
845
|
-
const n = Array.from(t).map(
|
|
846
|
-
if (!
|
|
845
|
+
const n = Array.from(t).map(De);
|
|
846
|
+
if (!Xt(t)) {
|
|
847
847
|
const r = Object.getPrototypeOf(t).constructor;
|
|
848
848
|
return new r(n);
|
|
849
849
|
}
|
|
@@ -851,20 +851,20 @@ function $e(t) {
|
|
|
851
851
|
}
|
|
852
852
|
const e = Object.create(Object.getPrototypeOf(t));
|
|
853
853
|
for (const n in t)
|
|
854
|
-
e[n] =
|
|
854
|
+
e[n] = De(t[n]);
|
|
855
855
|
return e;
|
|
856
856
|
}
|
|
857
|
-
function
|
|
858
|
-
return
|
|
857
|
+
function tt(t) {
|
|
858
|
+
return be(t) ? De(t) : t;
|
|
859
859
|
}
|
|
860
860
|
function re(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 && re(t.parent));
|
|
863
863
|
}
|
|
864
|
-
function
|
|
864
|
+
function Fn() {
|
|
865
865
|
throw new Error("Cannot modify frozen object");
|
|
866
866
|
}
|
|
867
|
-
function
|
|
867
|
+
function we(t, e, n, r, i) {
|
|
868
868
|
{
|
|
869
869
|
n = n ?? /* @__PURE__ */ new WeakMap(), r = r ?? [], i = i ?? [];
|
|
870
870
|
const o = n.has(t) ? n.get(t) : t;
|
|
@@ -881,37 +881,37 @@ function Te(t, e, n, r, i) {
|
|
|
881
881
|
} else
|
|
882
882
|
r.push(o);
|
|
883
883
|
}
|
|
884
|
-
if (Object.isFrozen(t) ||
|
|
884
|
+
if (Object.isFrozen(t) || be(t)) {
|
|
885
885
|
r.pop(), i.pop();
|
|
886
886
|
return;
|
|
887
887
|
}
|
|
888
|
-
switch (
|
|
888
|
+
switch (_e(t)) {
|
|
889
889
|
case 2:
|
|
890
890
|
for (const [u, c] of t)
|
|
891
|
-
|
|
892
|
-
t.set = t.clear = t.delete =
|
|
891
|
+
we(u, u, n, r, i), we(c, u, n, r, i);
|
|
892
|
+
t.set = t.clear = t.delete = Fn;
|
|
893
893
|
break;
|
|
894
894
|
case 3:
|
|
895
895
|
for (const u of t)
|
|
896
|
-
|
|
897
|
-
t.add = t.clear = t.delete =
|
|
896
|
+
we(u, u, n, r, i);
|
|
897
|
+
t.add = t.clear = t.delete = Fn;
|
|
898
898
|
break;
|
|
899
899
|
case 1:
|
|
900
900
|
Object.freeze(t);
|
|
901
901
|
let o = 0;
|
|
902
902
|
for (const u of t)
|
|
903
|
-
|
|
903
|
+
we(u, o, n, r, i), o += 1;
|
|
904
904
|
break;
|
|
905
905
|
default:
|
|
906
906
|
Object.freeze(t), Object.keys(t).forEach((u) => {
|
|
907
907
|
const c = t[u];
|
|
908
|
-
|
|
908
|
+
we(c, u, n, r, i);
|
|
909
909
|
});
|
|
910
910
|
}
|
|
911
911
|
r.pop(), i.pop();
|
|
912
912
|
}
|
|
913
|
-
function
|
|
914
|
-
const n =
|
|
913
|
+
function nn(t, e) {
|
|
914
|
+
const n = _e(t);
|
|
915
915
|
if (n === 0)
|
|
916
916
|
Reflect.ownKeys(t).forEach((r) => {
|
|
917
917
|
e(r, t[r], t);
|
|
@@ -923,19 +923,19 @@ function en(t, e) {
|
|
|
923
923
|
} else
|
|
924
924
|
t.forEach((r, i) => e(i, r, t));
|
|
925
925
|
}
|
|
926
|
-
function
|
|
927
|
-
if (
|
|
926
|
+
function Or(t, e, n) {
|
|
927
|
+
if (be(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), nn(t, (s, o) => {
|
|
931
931
|
var u;
|
|
932
|
-
if (
|
|
932
|
+
if (be(o)) {
|
|
933
933
|
const c = A(o);
|
|
934
934
|
z(c);
|
|
935
935
|
const d = !((u = c.assignedMap) === null || u === void 0) && u.size || c.operated ? c.copy : c.original;
|
|
936
|
-
|
|
936
|
+
Ve(r ? i : t, s, d);
|
|
937
937
|
} else
|
|
938
|
-
|
|
938
|
+
Or(o, e, n);
|
|
939
939
|
}), i) {
|
|
940
940
|
const s = t, o = Array.from(s);
|
|
941
941
|
s.clear(), o.forEach((u) => {
|
|
@@ -943,69 +943,69 @@ function Sr(t, e, n) {
|
|
|
943
943
|
});
|
|
944
944
|
}
|
|
945
945
|
}
|
|
946
|
-
function
|
|
946
|
+
function Wi(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 && Or(ue(n, e), t.finalities.handledSet, t.options);
|
|
949
949
|
}
|
|
950
|
-
function
|
|
950
|
+
function $t(t) {
|
|
951
951
|
t.type === 3 && t.copy && (t.copy.clear(), t.setMap.forEach((e) => {
|
|
952
|
-
t.copy.add(
|
|
952
|
+
t.copy.add(tn(e));
|
|
953
953
|
}));
|
|
954
954
|
}
|
|
955
|
-
function
|
|
955
|
+
function Dt(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 = mr(t);
|
|
959
959
|
s && e(t, s, n, r);
|
|
960
960
|
}
|
|
961
961
|
t.finalized = !0;
|
|
962
962
|
}
|
|
963
963
|
}
|
|
964
|
-
function
|
|
964
|
+
function rn(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 c = t.type === 3 ? t.setMap : t.copy;
|
|
969
969
|
if (oe(ue(c, e), n)) {
|
|
970
970
|
let d = i.original;
|
|
971
|
-
i.copy && (d = i.copy),
|
|
971
|
+
i.copy && (d = i.copy), $t(t), Dt(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)), Ve(c, 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
|
-
oe(ue(s, e), n) &&
|
|
975
|
+
oe(ue(s, e), n) && Wi(t, e);
|
|
976
976
|
});
|
|
977
977
|
}
|
|
978
|
-
function
|
|
978
|
+
function zi(t, e, n, r, i) {
|
|
979
979
|
let { original: s, assignedMap: o, options: u } = t, c = t.copy;
|
|
980
980
|
c.length < s.length && ([s, c] = [c, s], [n, r] = [r, n]);
|
|
981
981
|
for (let d = 0; d < s.length; d += 1)
|
|
982
982
|
if (o.get(d.toString()) && c[d] !== s[d]) {
|
|
983
|
-
const a = e.concat([d]), f =
|
|
983
|
+
const a = e.concat([d]), f = he(a, i);
|
|
984
984
|
n.push({
|
|
985
985
|
op: $.Replace,
|
|
986
986
|
path: f,
|
|
987
987
|
// If it is a draft, it needs to be deep cloned, and it may also be non-draft.
|
|
988
|
-
value:
|
|
988
|
+
value: tt(c[d])
|
|
989
989
|
}), r.push({
|
|
990
990
|
op: $.Replace,
|
|
991
991
|
path: f,
|
|
992
992
|
// If it is a draft, it needs to be deep cloned, and it may also be non-draft.
|
|
993
|
-
value:
|
|
993
|
+
value: tt(s[d])
|
|
994
994
|
});
|
|
995
995
|
}
|
|
996
996
|
for (let d = s.length; d < c.length; d += 1) {
|
|
997
|
-
const a = e.concat([d]), f =
|
|
997
|
+
const a = e.concat([d]), f = he(a, i);
|
|
998
998
|
n.push({
|
|
999
999
|
op: $.Add,
|
|
1000
1000
|
path: f,
|
|
1001
1001
|
// If it is a draft, it needs to be deep cloned, and it may also be non-draft.
|
|
1002
|
-
value:
|
|
1002
|
+
value: tt(c[d])
|
|
1003
1003
|
});
|
|
1004
1004
|
}
|
|
1005
1005
|
if (s.length < c.length) {
|
|
1006
1006
|
const { arrayLengthAssignment: d = !0 } = u.enablePatches;
|
|
1007
1007
|
if (d) {
|
|
1008
|
-
const a = e.concat(["length"]), f =
|
|
1008
|
+
const a = e.concat(["length"]), f = he(a, i);
|
|
1009
1009
|
r.push({
|
|
1010
1010
|
op: $.Replace,
|
|
1011
1011
|
path: f,
|
|
@@ -1013,7 +1013,7 @@ function Vi(t, e, n, r, i) {
|
|
|
1013
1013
|
});
|
|
1014
1014
|
} else
|
|
1015
1015
|
for (let a = c.length; s.length < a; a -= 1) {
|
|
1016
|
-
const f = e.concat([a - 1]), h =
|
|
1016
|
+
const f = e.concat([a - 1]), h = he(f, i);
|
|
1017
1017
|
r.push({
|
|
1018
1018
|
op: $.Remove,
|
|
1019
1019
|
path: h
|
|
@@ -1021,20 +1021,20 @@ function Vi(t, e, n, r, i) {
|
|
|
1021
1021
|
}
|
|
1022
1022
|
}
|
|
1023
1023
|
}
|
|
1024
|
-
function
|
|
1024
|
+
function Ki({ original: t, copy: e, assignedMap: n }, r, i, s, o) {
|
|
1025
1025
|
n.forEach((u, c) => {
|
|
1026
|
-
const d = ue(t, c), a =
|
|
1026
|
+
const d = ue(t, c), a = tt(ue(e, c)), f = u ? Le(t, c) ? $.Replace : $.Add : $.Remove;
|
|
1027
1027
|
if (oe(d, a) && f === $.Replace)
|
|
1028
1028
|
return;
|
|
1029
|
-
const h = r.concat(c), p =
|
|
1029
|
+
const h = r.concat(c), p = he(h, o);
|
|
1030
1030
|
i.push(f === $.Remove ? { op: f, path: p } : { op: f, path: p, value: a }), s.push(f === $.Add ? { op: $.Remove, path: p } : f === $.Remove ? { op: $.Add, path: p, value: d } : { op: $.Replace, path: p, value: d });
|
|
1031
1031
|
});
|
|
1032
1032
|
}
|
|
1033
|
-
function
|
|
1033
|
+
function Bi({ original: t, copy: e }, n, r, i, s) {
|
|
1034
1034
|
let o = 0;
|
|
1035
1035
|
t.forEach((u) => {
|
|
1036
1036
|
if (!e.has(u)) {
|
|
1037
|
-
const c = n.concat([o]), d =
|
|
1037
|
+
const c = n.concat([o]), d = he(c, s);
|
|
1038
1038
|
r.push({
|
|
1039
1039
|
op: $.Remove,
|
|
1040
1040
|
path: d,
|
|
@@ -1048,7 +1048,7 @@ function Wi({ original: t, copy: e }, n, r, i, s) {
|
|
|
1048
1048
|
o += 1;
|
|
1049
1049
|
}), o = 0, e.forEach((u) => {
|
|
1050
1050
|
if (!t.has(u)) {
|
|
1051
|
-
const c = n.concat([o]), d =
|
|
1051
|
+
const c = n.concat([o]), d = he(c, s);
|
|
1052
1052
|
r.push({
|
|
1053
1053
|
op: $.Add,
|
|
1054
1054
|
path: d,
|
|
@@ -1062,22 +1062,22 @@ function Wi({ original: t, copy: e }, n, r, i, s) {
|
|
|
1062
1062
|
o += 1;
|
|
1063
1063
|
});
|
|
1064
1064
|
}
|
|
1065
|
-
function
|
|
1065
|
+
function Ne(t, e, n, r) {
|
|
1066
1066
|
const { pathAsArray: i = !0 } = t.options.enablePatches;
|
|
1067
1067
|
switch (t.type) {
|
|
1068
1068
|
case 0:
|
|
1069
1069
|
case 2:
|
|
1070
|
-
return
|
|
1070
|
+
return Ki(t, e, n, r, i);
|
|
1071
1071
|
case 1:
|
|
1072
|
-
return
|
|
1072
|
+
return zi(t, e, n, r, i);
|
|
1073
1073
|
case 3:
|
|
1074
|
-
return
|
|
1074
|
+
return Bi(t, e, n, r, i);
|
|
1075
1075
|
}
|
|
1076
1076
|
}
|
|
1077
|
-
const
|
|
1077
|
+
const st = (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
|
+
}, xt = {
|
|
1081
1081
|
get size() {
|
|
1082
1082
|
return H(A(this)).size;
|
|
1083
1083
|
},
|
|
@@ -1086,7 +1086,7 @@ const it = (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) || !oe(r.get(t), e)) && (z(n), re(n), n.assignedMap.set(t, !0), n.copy.set(t, e),
|
|
1089
|
+
return (!r.has(t) || !oe(r.get(t), e)) && (z(n), re(n), n.assignedMap.set(t, !0), n.copy.set(t, e), rn(n, t, e, Ne)), this;
|
|
1090
1090
|
},
|
|
1091
1091
|
delete(t) {
|
|
1092
1092
|
if (!this.has(t))
|
|
@@ -1112,9 +1112,9 @@ const it = (t, e, n = !1) => {
|
|
|
1112
1112
|
get(t) {
|
|
1113
1113
|
var e, n;
|
|
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
|
-
if (r.options.strict &&
|
|
1115
|
+
if (r.options.strict && st(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 = Zt.createDraft({
|
|
1118
1118
|
original: i,
|
|
1119
1119
|
parentDraft: r,
|
|
1120
1120
|
key: t,
|
|
@@ -1129,7 +1129,7 @@ const it = (t, e, n = !1) => {
|
|
|
1129
1129
|
values() {
|
|
1130
1130
|
const t = this.keys();
|
|
1131
1131
|
return {
|
|
1132
|
-
[
|
|
1132
|
+
[et]: () => this.values(),
|
|
1133
1133
|
next: () => {
|
|
1134
1134
|
const e = t.next();
|
|
1135
1135
|
return e.done ? e : {
|
|
@@ -1142,7 +1142,7 @@ const it = (t, e, n = !1) => {
|
|
|
1142
1142
|
entries() {
|
|
1143
1143
|
const t = this.keys();
|
|
1144
1144
|
return {
|
|
1145
|
-
[
|
|
1145
|
+
[et]: () => this.entries(),
|
|
1146
1146
|
next: () => {
|
|
1147
1147
|
const e = t.next();
|
|
1148
1148
|
if (e.done)
|
|
@@ -1155,10 +1155,10 @@ const it = (t, e, n = !1) => {
|
|
|
1155
1155
|
}
|
|
1156
1156
|
};
|
|
1157
1157
|
},
|
|
1158
|
-
[
|
|
1158
|
+
[et]() {
|
|
1159
1159
|
return this.entries();
|
|
1160
1160
|
}
|
|
1161
|
-
},
|
|
1161
|
+
}, Qi = Reflect.ownKeys(xt), Nn = (t, e, { isValuesIterator: n }) => () => {
|
|
1162
1162
|
var r, i;
|
|
1163
1163
|
const s = e.next();
|
|
1164
1164
|
if (s.done)
|
|
@@ -1166,8 +1166,8 @@ const it = (t, e, n = !1) => {
|
|
|
1166
1166
|
const o = s.value;
|
|
1167
1167
|
let u = t.setMap.get(o);
|
|
1168
1168
|
const c = A(u), d = ((i = (r = t.options).mark) === null || i === void 0 ? void 0 : i.call(r, u, Y)) === Y.mutable;
|
|
1169
|
-
if (t.options.strict &&
|
|
1170
|
-
const a =
|
|
1169
|
+
if (t.options.strict && st(o, t.options, d), !d && !c && ee(o, t.options) && !t.finalized && t.original.has(o)) {
|
|
1170
|
+
const a = Zt.createDraft({
|
|
1171
1171
|
original: o,
|
|
1172
1172
|
parentDraft: t,
|
|
1173
1173
|
key: o,
|
|
@@ -1180,7 +1180,7 @@ const it = (t, e, n = !1) => {
|
|
|
1180
1180
|
done: !1,
|
|
1181
1181
|
value: n ? u : [u, u]
|
|
1182
1182
|
};
|
|
1183
|
-
},
|
|
1183
|
+
}, ot = {
|
|
1184
1184
|
get size() {
|
|
1185
1185
|
return A(this).setMap.size;
|
|
1186
1186
|
},
|
|
@@ -1194,7 +1194,7 @@ const it = (t, e, n = !1) => {
|
|
|
1194
1194
|
},
|
|
1195
1195
|
add(t) {
|
|
1196
1196
|
const e = A(this);
|
|
1197
|
-
return this.has(t) || (z(e), re(e), e.assignedMap.set(t, !0), e.setMap.set(t, t),
|
|
1197
|
+
return this.has(t) || (z(e), re(e), e.assignedMap.set(t, !0), e.setMap.set(t, t), rn(e, t, t, Ne)), this;
|
|
1198
1198
|
},
|
|
1199
1199
|
delete(t) {
|
|
1200
1200
|
if (!this.has(t))
|
|
@@ -1219,7 +1219,7 @@ const it = (t, e, n = !1) => {
|
|
|
1219
1219
|
const e = t.setMap.keys();
|
|
1220
1220
|
return {
|
|
1221
1221
|
[Symbol.iterator]: () => this.values(),
|
|
1222
|
-
next:
|
|
1222
|
+
next: Nn(t, e, { isValuesIterator: !0 })
|
|
1223
1223
|
};
|
|
1224
1224
|
},
|
|
1225
1225
|
entries() {
|
|
@@ -1228,7 +1228,7 @@ const it = (t, e, n = !1) => {
|
|
|
1228
1228
|
const e = t.setMap.keys();
|
|
1229
1229
|
return {
|
|
1230
1230
|
[Symbol.iterator]: () => this.entries(),
|
|
1231
|
-
next:
|
|
1231
|
+
next: Nn(t, e, {
|
|
1232
1232
|
isValuesIterator: !1
|
|
1233
1233
|
})
|
|
1234
1234
|
};
|
|
@@ -1236,7 +1236,7 @@ const it = (t, e, n = !1) => {
|
|
|
1236
1236
|
keys() {
|
|
1237
1237
|
return this.values();
|
|
1238
1238
|
},
|
|
1239
|
-
[
|
|
1239
|
+
[et]() {
|
|
1240
1240
|
return this.values();
|
|
1241
1241
|
},
|
|
1242
1242
|
forEach(t, e) {
|
|
@@ -1246,7 +1246,7 @@ const it = (t, e, n = !1) => {
|
|
|
1246
1246
|
t.call(e, r.value, r.value, this), r = n.next();
|
|
1247
1247
|
}
|
|
1248
1248
|
};
|
|
1249
|
-
Set.prototype.difference && Object.assign(
|
|
1249
|
+
Set.prototype.difference && Object.assign(ot, {
|
|
1250
1250
|
intersection(t) {
|
|
1251
1251
|
return Set.prototype.intersection.call(new Set(this.values()), t);
|
|
1252
1252
|
},
|
|
@@ -1269,47 +1269,47 @@ Set.prototype.difference && Object.assign(st, {
|
|
|
1269
1269
|
return Set.prototype.isDisjointFrom.call(new Set(this.values()), t);
|
|
1270
1270
|
}
|
|
1271
1271
|
});
|
|
1272
|
-
const
|
|
1272
|
+
const Gi = Reflect.ownKeys(ot), Er = /* @__PURE__ */ new WeakSet(), Ar = {
|
|
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 && Er.has(s))
|
|
1277
1277
|
return s;
|
|
1278
|
-
if (e ===
|
|
1278
|
+
if (e === Sr)
|
|
1279
1279
|
return t;
|
|
1280
1280
|
let o;
|
|
1281
1281
|
if (t.options.mark) {
|
|
1282
1282
|
const d = e === "size" && (t.original instanceof Map || t.original instanceof Set) ? Reflect.get(t.original, e) : Reflect.get(t.original, e, n);
|
|
1283
1283
|
if (o = t.options.mark(d, Y), o === Y.mutable)
|
|
1284
|
-
return t.options.strict &&
|
|
1284
|
+
return t.options.strict && st(d, t.options, !0), d;
|
|
1285
1285
|
}
|
|
1286
1286
|
const u = H(t);
|
|
1287
|
-
if (u instanceof Map &&
|
|
1287
|
+
if (u instanceof Map && Qi.includes(e)) {
|
|
1288
1288
|
if (e === "size")
|
|
1289
|
-
return Object.getOwnPropertyDescriptor(
|
|
1290
|
-
const d =
|
|
1289
|
+
return Object.getOwnPropertyDescriptor(xt, "size").get.call(t.proxy);
|
|
1290
|
+
const d = xt[e];
|
|
1291
1291
|
if (d)
|
|
1292
1292
|
return d.bind(t.proxy);
|
|
1293
1293
|
}
|
|
1294
|
-
if (u instanceof Set &&
|
|
1294
|
+
if (u instanceof Set && Gi.includes(e)) {
|
|
1295
1295
|
if (e === "size")
|
|
1296
|
-
return Object.getOwnPropertyDescriptor(
|
|
1297
|
-
const d =
|
|
1296
|
+
return Object.getOwnPropertyDescriptor(ot, "size").get.call(t.proxy);
|
|
1297
|
+
const d = ot[e];
|
|
1298
1298
|
if (d)
|
|
1299
1299
|
return d.bind(t.proxy);
|
|
1300
1300
|
}
|
|
1301
|
-
if (!
|
|
1302
|
-
const d =
|
|
1301
|
+
if (!Le(u, e)) {
|
|
1302
|
+
const d = Ln(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)
|
|
1306
1306
|
) : void 0;
|
|
1307
1307
|
}
|
|
1308
1308
|
const c = u[e];
|
|
1309
|
-
if (t.options.strict &&
|
|
1309
|
+
if (t.options.strict && st(c, t.options), t.finalized || !ee(c, t.options))
|
|
1310
1310
|
return c;
|
|
1311
|
-
if (c ===
|
|
1312
|
-
if (z(t), t.copy[e] =
|
|
1311
|
+
if (c === mt(t.original, e)) {
|
|
1312
|
+
if (z(t), t.copy[e] = sn({
|
|
1313
1313
|
original: t.original[e],
|
|
1314
1314
|
parentDraft: t,
|
|
1315
1315
|
key: t.type === 1 ? Number(e) : e,
|
|
@@ -1330,11 +1330,11 @@ const Ki = Reflect.ownKeys(st), mr = /* @__PURE__ */ new WeakSet(), vr = {
|
|
|
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 = Ln(H(t), e);
|
|
1334
1334
|
if (s != null && s.set)
|
|
1335
1335
|
return s.set.call(t.proxy, n), !0;
|
|
1336
|
-
const o =
|
|
1337
|
-
return u && oe(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) : (oe(n, o) && (n !== void 0 ||
|
|
1336
|
+
const o = mt(H(t), e), u = A(o);
|
|
1337
|
+
return u && oe(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) : (oe(n, o) && (n !== void 0 || Le(t.original, e)) || (z(t), re(t), Le(t.original, e) && oe(n, t.original[e]) ? t.assignedMap.delete(e) : t.assignedMap.set(e, !0), t.copy[e] = n, rn(t, e, n, Ne)), !0);
|
|
1338
1338
|
},
|
|
1339
1339
|
has(t, e) {
|
|
1340
1340
|
return e in H(t);
|
|
@@ -1362,11 +1362,11 @@ const Ki = Reflect.ownKeys(st), mr = /* @__PURE__ */ new WeakSet(), vr = {
|
|
|
1362
1362
|
},
|
|
1363
1363
|
deleteProperty(t, e) {
|
|
1364
1364
|
var n;
|
|
1365
|
-
return t.type === 1 ?
|
|
1365
|
+
return t.type === 1 ? Ar.set.call(this, t, e, void 0, t.proxy) : (mt(t.original, e) !== void 0 || e in t.original ? (z(t), re(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
|
|
1369
|
-
const { original: e, parentDraft: n, key: r, finalities: i, options: s } = t, o =
|
|
1368
|
+
function sn(t) {
|
|
1369
|
+
const { original: e, parentDraft: n, key: r, finalities: i, options: s } = t, o = _e(e), u = {
|
|
1370
1370
|
type: o,
|
|
1371
1371
|
finalized: !1,
|
|
1372
1372
|
parent: n,
|
|
@@ -1379,8 +1379,8 @@ function nn(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: c, revoke: d } = Proxy.revocable(o === 1 ? Object.assign([], u) : u,
|
|
1383
|
-
if (i.revoke.push(d),
|
|
1382
|
+
const { proxy: c, revoke: d } = Proxy.revocable(o === 1 ? Object.assign([], u) : u, Ar);
|
|
1383
|
+
if (i.revoke.push(d), Er.add(c), u.proxy = c, n) {
|
|
1384
1384
|
const a = n;
|
|
1385
1385
|
a.finalities.draft.push((f, h) => {
|
|
1386
1386
|
var p, y;
|
|
@@ -1389,7 +1389,7 @@ function nn(t) {
|
|
|
1389
1389
|
const g = ue(T, r), S = A(g);
|
|
1390
1390
|
if (S) {
|
|
1391
1391
|
let m = S.original;
|
|
1392
|
-
S.operated && (m =
|
|
1392
|
+
S.operated && (m = tn(g)), $t(S), Dt(S, Ne, f, h), a.options.enableAutoFreeze && (a.options.updatedValues = (p = a.options.updatedValues) !== null && p !== void 0 ? p : /* @__PURE__ */ new WeakMap(), a.options.updatedValues.set(m, S.original)), Ve(T, r, m);
|
|
1393
1393
|
}
|
|
1394
1394
|
(y = _.callbacks) === null || y === void 0 || y.forEach((m) => {
|
|
1395
1395
|
m(f, h);
|
|
@@ -1398,26 +1398,26 @@ function nn(t) {
|
|
|
1398
1398
|
} else {
|
|
1399
1399
|
const a = A(c);
|
|
1400
1400
|
a.finalities.draft.push((f, h) => {
|
|
1401
|
-
|
|
1401
|
+
$t(a), Dt(a, Ne, f, h);
|
|
1402
1402
|
});
|
|
1403
1403
|
}
|
|
1404
1404
|
return c;
|
|
1405
1405
|
}
|
|
1406
|
-
|
|
1407
|
-
function
|
|
1406
|
+
Zt.createDraft = sn;
|
|
1407
|
+
function Hi(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, c = !!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 = c ? e[0] : o ? o.operated ? o.copy : o.original : t;
|
|
1414
|
-
return o &&
|
|
1414
|
+
return o && Rt(o), i && we(d, d, o == null ? void 0 : o.options.updatedValues), [
|
|
1415
1415
|
d,
|
|
1416
1416
|
n && c ? [{ op: $.Replace, path: [], value: e[0] }] : n,
|
|
1417
1417
|
r && c ? [{ op: $.Replace, path: [], value: u }] : r
|
|
1418
1418
|
];
|
|
1419
1419
|
}
|
|
1420
|
-
function
|
|
1420
|
+
function Yi(t, e) {
|
|
1421
1421
|
var n;
|
|
1422
1422
|
const r = {
|
|
1423
1423
|
draft: [],
|
|
@@ -1426,7 +1426,7 @@ function Qi(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 : sn({
|
|
1430
1430
|
original: t,
|
|
1431
1431
|
parentDraft: null,
|
|
1432
1432
|
finalities: r,
|
|
@@ -1435,14 +1435,14 @@ function Qi(t, e) {
|
|
|
1435
1435
|
return [
|
|
1436
1436
|
u,
|
|
1437
1437
|
(c = []) => {
|
|
1438
|
-
const [d, a, f] =
|
|
1438
|
+
const [d, a, f] = Hi(u, c, i, s, e.enableAutoFreeze);
|
|
1439
1439
|
return e.enablePatches ? [d, a, f] : d;
|
|
1440
1440
|
}
|
|
1441
1441
|
];
|
|
1442
1442
|
}
|
|
1443
|
-
function
|
|
1443
|
+
function Ut(t) {
|
|
1444
1444
|
const { rootDraft: e, value: n, useRawReturn: r = !1, isRoot: i = !0 } = t;
|
|
1445
|
-
|
|
1445
|
+
nn(n, (s, o, u) => {
|
|
1446
1446
|
const c = A(o);
|
|
1447
1447
|
if (c && e && c.finalities === e.finalities) {
|
|
1448
1448
|
t.isContainDraft = !0;
|
|
@@ -1451,21 +1451,21 @@ function Dt(t) {
|
|
|
1451
1451
|
const a = Array.from(u);
|
|
1452
1452
|
u.clear(), a.forEach((f) => u.add(s === f ? d : f));
|
|
1453
1453
|
} else
|
|
1454
|
-
|
|
1455
|
-
} else typeof o == "object" && o !== null && (t.value = o, t.isRoot = !1,
|
|
1454
|
+
Ve(u, s, d);
|
|
1455
|
+
} else typeof o == "object" && o !== null && (t.value = o, t.isRoot = !1, Ut(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 Cr(t) {
|
|
1459
1459
|
var e;
|
|
1460
1460
|
const n = A(t);
|
|
1461
1461
|
if (!ee(t, n == null ? void 0 : n.options))
|
|
1462
1462
|
return t;
|
|
1463
|
-
const r =
|
|
1463
|
+
const r = _e(t);
|
|
1464
1464
|
if (n && !n.operated)
|
|
1465
1465
|
return n.original;
|
|
1466
1466
|
let i;
|
|
1467
1467
|
function s() {
|
|
1468
|
-
i = r === 2 ?
|
|
1468
|
+
i = r === 2 ? en(t) ? new Map(t) : new (Object.getPrototypeOf(t)).constructor(t) : r === 3 ? Array.from(n.setMap.values()) : vr(t, n == null ? void 0 : n.options);
|
|
1469
1469
|
}
|
|
1470
1470
|
if (n) {
|
|
1471
1471
|
n.finalized = !0;
|
|
@@ -1476,23 +1476,23 @@ function Or(t) {
|
|
|
1476
1476
|
}
|
|
1477
1477
|
} else
|
|
1478
1478
|
i = t;
|
|
1479
|
-
if (
|
|
1479
|
+
if (nn(i, (o, u) => {
|
|
1480
1480
|
if (n && oe(ue(n.original, o), u))
|
|
1481
1481
|
return;
|
|
1482
|
-
const c =
|
|
1483
|
-
c !== u && (i === t && s(),
|
|
1482
|
+
const c = Cr(u);
|
|
1483
|
+
c !== u && (i === t && s(), Ve(i, o, c));
|
|
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 Xt(o) ? new Set(i) : new (Object.getPrototypeOf(o)).constructor(i);
|
|
1487
1487
|
}
|
|
1488
1488
|
return i;
|
|
1489
1489
|
}
|
|
1490
|
-
function
|
|
1491
|
-
if (!
|
|
1490
|
+
function Vn(t) {
|
|
1491
|
+
if (!be(t))
|
|
1492
1492
|
throw new Error(`current() is only used for Draft, parameter: ${t}`);
|
|
1493
|
-
return
|
|
1493
|
+
return Cr(t);
|
|
1494
1494
|
}
|
|
1495
|
-
const
|
|
1495
|
+
const Ji = (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(O, ...P) {
|
|
@@ -1503,7 +1503,7 @@ const Gi = (t) => function e(n, r, i) {
|
|
|
1503
1503
|
if (typeof r != "function" && (a = r), a !== void 0 && Object.prototype.toString.call(a) !== "[object Object]")
|
|
1504
1504
|
throw new Error(`Invalid options: ${a}, 'options' should be an object.`);
|
|
1505
1505
|
a = Object.assign(Object.assign({}, t), a);
|
|
1506
|
-
const f =
|
|
1506
|
+
const f = be(c) ? Vn(c) : c, h = Array.isArray(a.mark) ? (O, P) => {
|
|
1507
1507
|
for (const U of a.mark) {
|
|
1508
1508
|
if (typeof U != "function")
|
|
1509
1509
|
throw new Error(`Invalid mark: ${U}, 'mark' should be a function.`);
|
|
@@ -1519,7 +1519,7 @@ const Gi = (t) => function e(n, r, i) {
|
|
|
1519
1519
|
};
|
|
1520
1520
|
if (!ee(f, T) && 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 [g, S] =
|
|
1522
|
+
const [g, S] = Yi(f, T);
|
|
1523
1523
|
if (typeof r != "function") {
|
|
1524
1524
|
if (!ee(f, T))
|
|
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 Gi = (t) => function e(n, r, i) {
|
|
|
1529
1529
|
try {
|
|
1530
1530
|
m = d(g);
|
|
1531
1531
|
} catch (O) {
|
|
1532
|
-
throw
|
|
1532
|
+
throw Rt(A(g)), O;
|
|
1533
1533
|
}
|
|
1534
1534
|
const M = (O) => {
|
|
1535
1535
|
const P = A(g);
|
|
1536
|
-
if (!
|
|
1536
|
+
if (!be(O)) {
|
|
1537
1537
|
if (O !== void 0 && !oe(O, g) && (P != null && P.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 = O == null ? void 0 : O[
|
|
1539
|
+
const q = O == null ? void 0 : O[Fi];
|
|
1540
1540
|
if (q) {
|
|
1541
|
-
const
|
|
1542
|
-
return T.strict && typeof O == "object" && O !== null &&
|
|
1541
|
+
const ke = q[0];
|
|
1542
|
+
return T.strict && typeof O == "object" && O !== null && Ut({
|
|
1543
1543
|
rootDraft: P,
|
|
1544
1544
|
value: O,
|
|
1545
1545
|
useRawReturn: !0
|
|
1546
|
-
}), S([
|
|
1546
|
+
}), S([ke]);
|
|
1547
1547
|
}
|
|
1548
1548
|
if (O !== void 0)
|
|
1549
|
-
return typeof O == "object" && O !== null &&
|
|
1549
|
+
return typeof O == "object" && O !== null && Ut({ rootDraft: P, value: O }), S([O]);
|
|
1550
1550
|
}
|
|
1551
1551
|
if (O === g || O === void 0)
|
|
1552
1552
|
return S([]);
|
|
@@ -1554,35 +1554,35 @@ const Gi = (t) => function e(n, r, i) {
|
|
|
1554
1554
|
if (T === U.options) {
|
|
1555
1555
|
if (U.operated)
|
|
1556
1556
|
throw new Error("Cannot return a modified child draft.");
|
|
1557
|
-
return S([
|
|
1557
|
+
return S([Vn(O)]);
|
|
1558
1558
|
}
|
|
1559
1559
|
return S([O]);
|
|
1560
1560
|
};
|
|
1561
1561
|
return m instanceof Promise ? m.then(M, (O) => {
|
|
1562
|
-
throw
|
|
1562
|
+
throw Rt(A(g)), O;
|
|
1563
1563
|
}) : M(m);
|
|
1564
|
-
},
|
|
1564
|
+
}, Lt = Ji();
|
|
1565
1565
|
Object.prototype.constructor.toString();
|
|
1566
|
-
function
|
|
1566
|
+
function jr(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 qn(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
|
-
function
|
|
1574
|
-
return typeof t != "object" || typeof e != "object" || t === null || e === null ? t === e :
|
|
1573
|
+
function nt(t, e) {
|
|
1574
|
+
return typeof t != "object" || typeof e != "object" || t === null || e === null ? t === e : jr(t, e) ? Object.keys(t).every((n) => nt(t[n], e[n])) : !1;
|
|
1575
1575
|
}
|
|
1576
|
-
function
|
|
1577
|
-
if (!
|
|
1576
|
+
function on(t) {
|
|
1577
|
+
if (!xe(t))
|
|
1578
1578
|
return t;
|
|
1579
1579
|
const e = {};
|
|
1580
1580
|
for (const [n, r] of Object.entries(t))
|
|
1581
1581
|
r !== void 0 && (e[n] = r);
|
|
1582
1582
|
return e;
|
|
1583
1583
|
}
|
|
1584
|
-
function
|
|
1585
|
-
if (!
|
|
1584
|
+
function kr(t, e) {
|
|
1585
|
+
if (!xe(t) || !xe(e))
|
|
1586
1586
|
return e;
|
|
1587
1587
|
const n = Object.assign({}, t);
|
|
1588
1588
|
for (const r of Object.keys(e)) {
|
|
@@ -1592,15 +1592,15 @@ function Ar(t, e) {
|
|
|
1592
1592
|
delete n[r];
|
|
1593
1593
|
continue;
|
|
1594
1594
|
}
|
|
1595
|
-
const i =
|
|
1596
|
-
n[r] = i ?
|
|
1595
|
+
const i = xe(t[r]) && xe(e[r]);
|
|
1596
|
+
n[r] = i ? kr(t[r], e[r]) : e[r];
|
|
1597
1597
|
}
|
|
1598
1598
|
return n;
|
|
1599
1599
|
}
|
|
1600
|
-
function
|
|
1600
|
+
function xe(t) {
|
|
1601
1601
|
return typeof t == "object" && t !== null && !Array.isArray(t);
|
|
1602
1602
|
}
|
|
1603
|
-
function
|
|
1603
|
+
function Zi(t, e, n) {
|
|
1604
1604
|
if (!t || e.length === 0)
|
|
1605
1605
|
return;
|
|
1606
1606
|
let r = t || {};
|
|
@@ -1611,7 +1611,7 @@ function Hi(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 Wn(t, e, n) {
|
|
1615
1615
|
if (!t || e.length === 0)
|
|
1616
1616
|
return;
|
|
1617
1617
|
let r = t || {};
|
|
@@ -1621,7 +1621,7 @@ function Vn(t, e, n) {
|
|
|
1621
1621
|
}
|
|
1622
1622
|
r[e[e.length - 1]] = n;
|
|
1623
1623
|
}
|
|
1624
|
-
function
|
|
1624
|
+
function Ir(t, e) {
|
|
1625
1625
|
if (!t || e.length === 0)
|
|
1626
1626
|
return;
|
|
1627
1627
|
const [n, ...r] = e;
|
|
@@ -1630,13 +1630,13 @@ function Cr(t, e) {
|
|
|
1630
1630
|
Array.isArray(t) ? t.splice(n, 1) : delete t[n];
|
|
1631
1631
|
return;
|
|
1632
1632
|
}
|
|
1633
|
-
|
|
1633
|
+
Ir(t[n], r), Xi(t[n]) && delete t[n];
|
|
1634
1634
|
}
|
|
1635
1635
|
}
|
|
1636
|
-
function
|
|
1636
|
+
function Xi(t) {
|
|
1637
1637
|
return t && Object.keys(t).length === 0;
|
|
1638
1638
|
}
|
|
1639
|
-
const
|
|
1639
|
+
const zn = /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$/, es = {
|
|
1640
1640
|
ZULU: 0,
|
|
1641
1641
|
YEKT: 18e3,
|
|
1642
1642
|
YEKST: 21600,
|
|
@@ -1832,39 +1832,39 @@ const qn = /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 ts(t) {
|
|
1836
1836
|
return new Date(t);
|
|
1837
1837
|
}
|
|
1838
|
-
function
|
|
1838
|
+
function ns(t) {
|
|
1839
1839
|
return /* @__PURE__ */ new Date(t + "Z");
|
|
1840
1840
|
}
|
|
1841
|
-
const
|
|
1842
|
-
function
|
|
1843
|
-
const e = t.match(
|
|
1841
|
+
const rs = /^(\d+)[\./-](\d+)[\./-](\d+)$/;
|
|
1842
|
+
function is(t) {
|
|
1843
|
+
const e = t.match(rs);
|
|
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 ss(t) {
|
|
1850
1850
|
const [e, n] = t.split(" ");
|
|
1851
1851
|
return /* @__PURE__ */ new Date(e + "T" + n + "Z");
|
|
1852
1852
|
}
|
|
1853
|
-
function
|
|
1853
|
+
function os(t) {
|
|
1854
1854
|
const [e, n] = t.split(" ");
|
|
1855
1855
|
return /* @__PURE__ */ new Date(e + "T" + n + "Z");
|
|
1856
1856
|
}
|
|
1857
|
-
function
|
|
1857
|
+
function us(t) {
|
|
1858
1858
|
return new Date(t);
|
|
1859
1859
|
}
|
|
1860
|
-
function
|
|
1860
|
+
function as(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 cs(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 os(t) {
|
|
|
1872
1872
|
}
|
|
1873
1873
|
return null;
|
|
1874
1874
|
}
|
|
1875
|
-
function
|
|
1875
|
+
function ds(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, c, d, a] = o;
|
|
1880
1880
|
return u = Number(u), c = Number(c), d = Number(d), a === "PM" && u !== 12 ? u += 12 : a === "AM" && u === 12 && (u = 0), new Date(Date.UTC(s, r - 1, i, u, c, d));
|
|
1881
1881
|
}
|
|
1882
|
-
function
|
|
1882
|
+
function fs(t) {
|
|
1883
1883
|
switch (t) {
|
|
1884
1884
|
case "epoch":
|
|
1885
1885
|
return /* @__PURE__ */ new Date(0);
|
|
@@ -1891,27 +1891,27 @@ function as(t) {
|
|
|
1891
1891
|
return null;
|
|
1892
1892
|
}
|
|
1893
1893
|
}
|
|
1894
|
-
function
|
|
1895
|
-
const e = t.match(
|
|
1894
|
+
function ls(t) {
|
|
1895
|
+
const e = t.match(zn);
|
|
1896
1896
|
if (!e)
|
|
1897
1897
|
return null;
|
|
1898
|
-
const [n] = e, r =
|
|
1898
|
+
const [n] = e, r = es[n], i = new Date(t.replace(zn, "Z"));
|
|
1899
1899
|
return new Date(i.getTime() - r * 1e3);
|
|
1900
1900
|
}
|
|
1901
|
-
const
|
|
1902
|
-
ts,
|
|
1903
|
-
rs,
|
|
1904
|
-
ss,
|
|
1905
|
-
us,
|
|
1901
|
+
const hs = [
|
|
1906
1902
|
is,
|
|
1907
|
-
Xi,
|
|
1908
1903
|
os,
|
|
1909
|
-
ns,
|
|
1910
|
-
Zi,
|
|
1911
1904
|
as,
|
|
1912
|
-
|
|
1905
|
+
ds,
|
|
1906
|
+
us,
|
|
1907
|
+
ns,
|
|
1908
|
+
cs,
|
|
1909
|
+
ss,
|
|
1910
|
+
ts,
|
|
1911
|
+
fs,
|
|
1912
|
+
ls
|
|
1913
1913
|
];
|
|
1914
|
-
function
|
|
1914
|
+
function ps(t, e) {
|
|
1915
1915
|
try {
|
|
1916
1916
|
const n = t(e);
|
|
1917
1917
|
return n instanceof Date && !isNaN(n.getTime()) ? n : null;
|
|
@@ -1919,30 +1919,30 @@ function fs(t, e) {
|
|
|
1919
1919
|
return null;
|
|
1920
1920
|
}
|
|
1921
1921
|
}
|
|
1922
|
-
function
|
|
1923
|
-
for (const e of
|
|
1924
|
-
const n =
|
|
1922
|
+
function Ft(t) {
|
|
1923
|
+
for (const e of hs) {
|
|
1924
|
+
const n = ps(e, t);
|
|
1925
1925
|
if (n)
|
|
1926
1926
|
return n;
|
|
1927
1927
|
}
|
|
1928
1928
|
return null;
|
|
1929
1929
|
}
|
|
1930
|
-
function
|
|
1930
|
+
function ys(t) {
|
|
1931
1931
|
try {
|
|
1932
1932
|
const e = JSON.parse(t);
|
|
1933
|
-
return typeof e == "string" ?
|
|
1933
|
+
return typeof e == "string" ? Ft(e) : null;
|
|
1934
1934
|
} catch {
|
|
1935
1935
|
return null;
|
|
1936
1936
|
}
|
|
1937
1937
|
}
|
|
1938
|
-
function
|
|
1938
|
+
function ct(t) {
|
|
1939
1939
|
if (t !== void 0) {
|
|
1940
1940
|
if (t === null)
|
|
1941
1941
|
return null;
|
|
1942
1942
|
if (t instanceof Date)
|
|
1943
1943
|
return t;
|
|
1944
1944
|
if (typeof t == "string") {
|
|
1945
|
-
const e =
|
|
1945
|
+
const e = Ft(t) || ys(t) || Ft(t.trim());
|
|
1946
1946
|
if (!e)
|
|
1947
1947
|
throw new Error(`Unable to parse \`${t}\` as a date.`);
|
|
1948
1948
|
return e;
|
|
@@ -1951,19 +1951,19 @@ function at(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 bs(t) {
|
|
1955
1955
|
return t.cardinality === "one";
|
|
1956
1956
|
}
|
|
1957
|
-
function
|
|
1957
|
+
function un(t) {
|
|
1958
1958
|
return t["value-type"] === "ref";
|
|
1959
1959
|
}
|
|
1960
|
-
function
|
|
1960
|
+
function an(t) {
|
|
1961
1961
|
return t["value-type"] === "blob";
|
|
1962
1962
|
}
|
|
1963
1963
|
function Ae(t, e) {
|
|
1964
1964
|
return t[e];
|
|
1965
1965
|
}
|
|
1966
|
-
function
|
|
1966
|
+
function Ce(t, e) {
|
|
1967
1967
|
return e.reduce((n, r) => n && n.get(r), t);
|
|
1968
1968
|
}
|
|
1969
1969
|
function X(t, e) {
|
|
@@ -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 Pr(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, c, d, a] = o;
|
|
@@ -1996,22 +1996,22 @@ function jr(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 =
|
|
1999
|
+
f["checked-data-type"] === "date" && n && (d = ct(d), o[2] = d), un(f) && B(s, [d, c, u], o), B(r, [u, c, d], o), B(i, [c, u, d], o);
|
|
2000
2000
|
}
|
|
2001
2001
|
return { eav: r, aev: i, vae: s };
|
|
2002
2002
|
}
|
|
2003
|
-
function
|
|
2003
|
+
function Mr(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, c, d] = o, a = s["reverse-identity"];
|
|
2007
|
-
if (B(r, [c, d], s),
|
|
2007
|
+
if (B(r, [c, d], s), an(s) && B(e, [c, d], s), s["primary?"] && B(n, [c], s), a) {
|
|
2008
2008
|
const [f, h, p] = a;
|
|
2009
2009
|
B(i, [h, p], s);
|
|
2010
2010
|
}
|
|
2011
2011
|
}
|
|
2012
2012
|
return { blobAttrs: e, primaryKeys: n, forwardIdents: r, revIdents: i };
|
|
2013
2013
|
}
|
|
2014
|
-
function
|
|
2014
|
+
function Rr(t) {
|
|
2015
2015
|
return {
|
|
2016
2016
|
__type: t.__type,
|
|
2017
2017
|
attrs: t.attrs,
|
|
@@ -2021,20 +2021,20 @@ function Ir(t) {
|
|
|
2021
2021
|
useDateObjects: t.useDateObjects
|
|
2022
2022
|
};
|
|
2023
2023
|
}
|
|
2024
|
-
function
|
|
2025
|
-
return
|
|
2024
|
+
function $r(t) {
|
|
2025
|
+
return rt(t.attrs, t.triples, t.cardinalityInference, t.linkIndex, t.useDateObjects);
|
|
2026
2026
|
}
|
|
2027
|
-
function
|
|
2028
|
-
return
|
|
2027
|
+
function _s(t, e) {
|
|
2028
|
+
return Ce(t.eav, [e]) !== void 0;
|
|
2029
2029
|
}
|
|
2030
|
-
function
|
|
2031
|
-
t.attrIndexes =
|
|
2030
|
+
function cn(t) {
|
|
2031
|
+
t.attrIndexes = Mr(t.attrs);
|
|
2032
2032
|
}
|
|
2033
|
-
function
|
|
2034
|
-
const s =
|
|
2035
|
-
return s.useDateObjects = i, s.attrs = t, s.attrIndexes =
|
|
2033
|
+
function rt(t, e, n, r, i) {
|
|
2034
|
+
const s = Pr(t, e, i);
|
|
2035
|
+
return s.useDateObjects = i, s.attrs = t, s.attrIndexes = Mr(t), s.cardinalityInference = n, s.linkIndex = r, s.__type = "store", s;
|
|
2036
2036
|
}
|
|
2037
|
-
function
|
|
2037
|
+
function qe(t, e) {
|
|
2038
2038
|
var n, r;
|
|
2039
2039
|
let i;
|
|
2040
2040
|
if (Array.isArray(e[0])) {
|
|
@@ -2061,60 +2061,60 @@ function Ve(t, e) {
|
|
|
2061
2061
|
return [i, ...u];
|
|
2062
2062
|
}
|
|
2063
2063
|
}
|
|
2064
|
-
function
|
|
2065
|
-
const n =
|
|
2064
|
+
function Dr(t, e) {
|
|
2065
|
+
const n = qe(t, e);
|
|
2066
2066
|
if (!n)
|
|
2067
2067
|
return;
|
|
2068
2068
|
const [r, i, s] = n, o = Ae(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]), un(o) && X(t.vae, [s, i, r]));
|
|
2070
2070
|
}
|
|
2071
|
-
let
|
|
2072
|
-
function
|
|
2071
|
+
let gs = 0;
|
|
2072
|
+
function xr(t, e, n) {
|
|
2073
2073
|
const [r, i, s] = n;
|
|
2074
2074
|
let o;
|
|
2075
|
-
const u =
|
|
2076
|
-
return u && (o = u[3]), o || Date.now() * 10 +
|
|
2075
|
+
const u = Ce(t.ea, [r, i, s]);
|
|
2076
|
+
return u && (o = u[3]), o || Date.now() * 10 + gs++;
|
|
2077
2077
|
}
|
|
2078
|
-
function
|
|
2078
|
+
function Ur(t, e) {
|
|
2079
2079
|
var n;
|
|
2080
|
-
const r =
|
|
2080
|
+
const r = qe(t, e);
|
|
2081
2081
|
if (!r)
|
|
2082
2082
|
return;
|
|
2083
2083
|
let [i, s, o] = r;
|
|
2084
2084
|
const u = Ae(t.attrs, s);
|
|
2085
2085
|
if (!u)
|
|
2086
2086
|
return;
|
|
2087
|
-
u["checked-data-type"] === "date" && t.useDateObjects && (o =
|
|
2088
|
-
const c =
|
|
2089
|
-
|
|
2087
|
+
u["checked-data-type"] === "date" && t.useDateObjects && (o = ct(o));
|
|
2088
|
+
const c = Ce(t.eav, [i, s, o]), d = (n = c == null ? void 0 : c[3]) !== null && n !== void 0 ? n : xr(t, u, r), a = [i, s, o, d];
|
|
2089
|
+
bs(u) ? (B(t.eav, [i, s], /* @__PURE__ */ new Map([[o, a]])), B(t.aev, [s, i], /* @__PURE__ */ new Map([[o, a]]))) : (B(t.eav, [i, s, o], a), B(t.aev, [s, i, o], a)), un(u) && B(t.vae, [o, s, i], a);
|
|
2090
2090
|
}
|
|
2091
|
-
function
|
|
2091
|
+
function Ts(t, e) {
|
|
2092
2092
|
var n;
|
|
2093
|
-
const r =
|
|
2093
|
+
const r = qe(t, e);
|
|
2094
2094
|
if (!r)
|
|
2095
2095
|
return;
|
|
2096
2096
|
const [i, s, o] = r, u = Ae(t.attrs, s);
|
|
2097
2097
|
if (!u)
|
|
2098
2098
|
return;
|
|
2099
|
-
if (!
|
|
2099
|
+
if (!an(u))
|
|
2100
2100
|
throw new Error("merge operation is not supported for links");
|
|
2101
|
-
const c =
|
|
2101
|
+
const c = Ce(t.eav, [i, s]);
|
|
2102
2102
|
if (!c)
|
|
2103
2103
|
return;
|
|
2104
2104
|
const d = (n = c.values().next()) === null || n === void 0 ? void 0 : n.value;
|
|
2105
2105
|
if (!d)
|
|
2106
2106
|
return;
|
|
2107
|
-
const a = d[2], f =
|
|
2107
|
+
const a = d[2], f = kr(a, o), h = [
|
|
2108
2108
|
i,
|
|
2109
2109
|
s,
|
|
2110
2110
|
f,
|
|
2111
|
-
|
|
2111
|
+
xr(t, u, d)
|
|
2112
2112
|
];
|
|
2113
2113
|
B(t.eav, [i, s], /* @__PURE__ */ new Map([[f, h]]));
|
|
2114
2114
|
}
|
|
2115
|
-
function
|
|
2115
|
+
function Nt(t, e) {
|
|
2116
2116
|
var n, r;
|
|
2117
|
-
const [i, s] = e, o =
|
|
2117
|
+
const [i, s] = e, o = qe(t, [i]);
|
|
2118
2118
|
if (!o)
|
|
2119
2119
|
return;
|
|
2120
2120
|
const [u] = o, c = t.eav.get(u);
|
|
@@ -2123,7 +2123,7 @@ function Lt(t, e) {
|
|
|
2123
2123
|
const f = t.attrs[a];
|
|
2124
2124
|
f && f["on-delete-reverse"] === "cascade" && Q(c.get(a), 1).forEach(([h, p, y]) => {
|
|
2125
2125
|
var _;
|
|
2126
|
-
return
|
|
2126
|
+
return Nt(t, [y, (_ = f["reverse-identity"]) === null || _ === void 0 ? void 0 : _[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 Lt(t, e) {
|
|
|
2136
2136
|
d && d.forEach((a) => {
|
|
2137
2137
|
var f, h, p;
|
|
2138
2138
|
const [y, _, T] = a, g = t.attrs[_];
|
|
2139
|
-
(!s || !g || ((f = g["reverse-identity"]) === null || f === void 0 ? void 0 : f[1]) === s) && (X(t.eav, [y, _, T]), X(t.aev, [_, y, T]), X(t.vae, [T, _, y])), g && g["on-delete"] === "cascade" && ((h = g["reverse-identity"]) === null || h === void 0 ? void 0 : h[1]) === s &&
|
|
2139
|
+
(!s || !g || ((f = g["reverse-identity"]) === null || f === void 0 ? void 0 : f[1]) === s) && (X(t.eav, [y, _, T]), X(t.aev, [_, y, T]), X(t.vae, [T, _, y])), g && g["on-delete"] === "cascade" && ((h = g["reverse-identity"]) === null || h === void 0 ? void 0 : h[1]) === s && Nt(t, [y, (p = g["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 Lr(t, e) {
|
|
2143
|
+
const n = Pr(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 ws(t, [e]) {
|
|
2149
|
+
t.attrs[e.id] = e, cn(t);
|
|
2150
2150
|
}
|
|
2151
|
-
function
|
|
2151
|
+
function Fr(t) {
|
|
2152
2152
|
return Q(t.eav, 3);
|
|
2153
2153
|
}
|
|
2154
|
-
function
|
|
2154
|
+
function Ss(t, [e]) {
|
|
2155
2155
|
if (!t.attrs[e])
|
|
2156
2156
|
return;
|
|
2157
|
-
const n =
|
|
2158
|
-
delete t.attrs[e],
|
|
2157
|
+
const n = Fr(t).filter(([r, i]) => i !== e);
|
|
2158
|
+
delete t.attrs[e], cn(t), Lr(t, n);
|
|
2159
2159
|
}
|
|
2160
|
-
function
|
|
2160
|
+
function ms(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), cn(t), Lr(t, Fr(t)));
|
|
2163
2163
|
}
|
|
2164
|
-
function
|
|
2164
|
+
function vs(t, e) {
|
|
2165
2165
|
const [n, ...r] = e;
|
|
2166
2166
|
switch (n) {
|
|
2167
2167
|
case "add-triple":
|
|
2168
|
-
|
|
2168
|
+
Ur(t, r);
|
|
2169
2169
|
break;
|
|
2170
2170
|
case "deep-merge-triple":
|
|
2171
|
-
|
|
2171
|
+
Ts(t, r);
|
|
2172
2172
|
break;
|
|
2173
2173
|
case "retract-triple":
|
|
2174
|
-
|
|
2174
|
+
Dr(t, r);
|
|
2175
2175
|
break;
|
|
2176
2176
|
case "delete-entity":
|
|
2177
|
-
|
|
2177
|
+
Nt(t, r);
|
|
2178
2178
|
break;
|
|
2179
2179
|
case "add-attr":
|
|
2180
|
-
|
|
2180
|
+
ws(t, r);
|
|
2181
2181
|
break;
|
|
2182
2182
|
case "delete-attr":
|
|
2183
|
-
|
|
2183
|
+
Ss(t, r);
|
|
2184
2184
|
break;
|
|
2185
2185
|
case "update-attr":
|
|
2186
|
-
|
|
2186
|
+
ms(t, r);
|
|
2187
2187
|
break;
|
|
2188
2188
|
case "restore-attr":
|
|
2189
2189
|
break;
|
|
@@ -2205,7 +2205,7 @@ function Q(t, e, n = []) {
|
|
|
2205
2205
|
Q(r, e - 1, n);
|
|
2206
2206
|
return n;
|
|
2207
2207
|
}
|
|
2208
|
-
function
|
|
2208
|
+
function Je(t, e, n) {
|
|
2209
2209
|
var r, i;
|
|
2210
2210
|
const s = [];
|
|
2211
2211
|
if (n != null && n.hasOwnProperty("$not")) {
|
|
@@ -2238,13 +2238,13 @@ function Ye(t, e, n) {
|
|
|
2238
2238
|
}
|
|
2239
2239
|
return s;
|
|
2240
2240
|
}
|
|
2241
|
-
function
|
|
2241
|
+
function Os(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 Es(t, [e, n, r]) {
|
|
2246
2246
|
var i, s;
|
|
2247
|
-
switch (
|
|
2247
|
+
switch (Os(e, n, r)) {
|
|
2248
2248
|
case "e": {
|
|
2249
2249
|
const u = t.eav.get(e);
|
|
2250
2250
|
return Q(u, 2);
|
|
@@ -2255,7 +2255,7 @@ function ms(t, [e, n, r]) {
|
|
|
2255
2255
|
}
|
|
2256
2256
|
case "eav": {
|
|
2257
2257
|
const u = (s = t.eav.get(e)) === null || s === void 0 ? void 0 : s.get(n);
|
|
2258
|
-
return u ?
|
|
2258
|
+
return u ? Je(t, u, r) : [];
|
|
2259
2259
|
}
|
|
2260
2260
|
case "ev": {
|
|
2261
2261
|
const u = t.eav.get(e);
|
|
@@ -2263,7 +2263,7 @@ function ms(t, [e, n, r]) {
|
|
|
2263
2263
|
return [];
|
|
2264
2264
|
const c = [];
|
|
2265
2265
|
for (const d of u.values())
|
|
2266
|
-
c.push(...
|
|
2266
|
+
c.push(...Je(t, d, r));
|
|
2267
2267
|
return c;
|
|
2268
2268
|
}
|
|
2269
2269
|
case "a": {
|
|
@@ -2276,21 +2276,21 @@ function ms(t, [e, n, r]) {
|
|
|
2276
2276
|
return [];
|
|
2277
2277
|
const c = [];
|
|
2278
2278
|
for (const d of u.values())
|
|
2279
|
-
c.push(...
|
|
2279
|
+
c.push(...Je(t, d, r));
|
|
2280
2280
|
return c;
|
|
2281
2281
|
}
|
|
2282
2282
|
case "v": {
|
|
2283
2283
|
const u = [];
|
|
2284
2284
|
for (const c of t.eav.values())
|
|
2285
2285
|
for (const d of c.values())
|
|
2286
|
-
u.push(...
|
|
2286
|
+
u.push(...Je(t, d, r));
|
|
2287
2287
|
return u;
|
|
2288
2288
|
}
|
|
2289
2289
|
default:
|
|
2290
2290
|
return Q(t.eav, 3);
|
|
2291
2291
|
}
|
|
2292
2292
|
}
|
|
2293
|
-
function
|
|
2293
|
+
function As(t, e, n) {
|
|
2294
2294
|
var r;
|
|
2295
2295
|
const i = {};
|
|
2296
2296
|
for (const [s, o] of e.entries()) {
|
|
@@ -2300,31 +2300,31 @@ function vs(t, e, n) {
|
|
|
2300
2300
|
}
|
|
2301
2301
|
return i;
|
|
2302
2302
|
}
|
|
2303
|
-
function
|
|
2303
|
+
function ce(t, e, n) {
|
|
2304
2304
|
var r;
|
|
2305
2305
|
return (r = t.attrIndexes.forwardIdents.get(e)) === null || r === void 0 ? void 0 : r.get(n);
|
|
2306
2306
|
}
|
|
2307
|
-
function
|
|
2307
|
+
function Nr(t, e, n) {
|
|
2308
2308
|
var r;
|
|
2309
2309
|
return (r = t.attrIndexes.revIdents.get(e)) === null || r === void 0 ? void 0 : r.get(n);
|
|
2310
2310
|
}
|
|
2311
|
-
function
|
|
2311
|
+
function Cs(t, e) {
|
|
2312
2312
|
return t.attrIndexes.blobAttrs.get(e);
|
|
2313
2313
|
}
|
|
2314
|
-
function
|
|
2314
|
+
function Vr(t, e) {
|
|
2315
2315
|
var n;
|
|
2316
2316
|
const r = t.attrIndexes.primaryKeys.get(e);
|
|
2317
2317
|
return r || ((n = t.attrIndexes.forwardIdents.get(e)) === null || n === void 0 ? void 0 : n.get("id"));
|
|
2318
2318
|
}
|
|
2319
|
-
function
|
|
2320
|
-
const n =
|
|
2319
|
+
function js(t, e) {
|
|
2320
|
+
const n = qe(t, e);
|
|
2321
2321
|
if (!n)
|
|
2322
2322
|
return;
|
|
2323
2323
|
const [r, i, s] = n;
|
|
2324
2324
|
if (Ae(t.attrs, i))
|
|
2325
|
-
return
|
|
2325
|
+
return Ce(t.eav, [r, i]);
|
|
2326
2326
|
}
|
|
2327
|
-
function
|
|
2327
|
+
function ks(t, e) {
|
|
2328
2328
|
const n = e.filter(([r, i, s, o, u]) => {
|
|
2329
2329
|
if (r !== "add-triple" && r !== "deep-merge-triple")
|
|
2330
2330
|
return !0;
|
|
@@ -2334,39 +2334,39 @@ function As(t, e) {
|
|
|
2334
2334
|
let d = !1;
|
|
2335
2335
|
const a = Ae(t.attrs, s);
|
|
2336
2336
|
if (a) {
|
|
2337
|
-
const f =
|
|
2338
|
-
d = !!
|
|
2337
|
+
const f = Vr(t, a["forward-identity"][1]);
|
|
2338
|
+
d = !!js(t, [i, f.id, i]);
|
|
2339
2339
|
}
|
|
2340
2340
|
return !(c === "create" && d || c === "update" && !d);
|
|
2341
2341
|
});
|
|
2342
|
-
return
|
|
2342
|
+
return Lt(t, (r) => {
|
|
2343
2343
|
n.forEach((i) => {
|
|
2344
|
-
|
|
2344
|
+
vs(r, i);
|
|
2345
2345
|
});
|
|
2346
2346
|
});
|
|
2347
2347
|
}
|
|
2348
|
-
function
|
|
2348
|
+
function Is(t) {
|
|
2349
2349
|
return typeof t == "string" && t.startsWith("?");
|
|
2350
2350
|
}
|
|
2351
|
-
function
|
|
2351
|
+
function Ps(t, e, n) {
|
|
2352
2352
|
if (n.hasOwnProperty(t)) {
|
|
2353
2353
|
const r = n[t];
|
|
2354
|
-
return
|
|
2354
|
+
return qr(r, e, n);
|
|
2355
2355
|
}
|
|
2356
2356
|
return Object.assign(Object.assign({}, n), { [t]: e });
|
|
2357
2357
|
}
|
|
2358
|
-
function
|
|
2358
|
+
function Kn(t, e, n) {
|
|
2359
2359
|
return t === e ? n : null;
|
|
2360
2360
|
}
|
|
2361
|
-
function
|
|
2361
|
+
function Ms(t) {
|
|
2362
2362
|
switch (typeof t) {
|
|
2363
2363
|
case "string":
|
|
2364
|
-
return t.startsWith("?") ?
|
|
2364
|
+
return t.startsWith("?") ? Ps : Kn;
|
|
2365
2365
|
default:
|
|
2366
|
-
return
|
|
2366
|
+
return Kn;
|
|
2367
2367
|
}
|
|
2368
2368
|
}
|
|
2369
|
-
const
|
|
2369
|
+
const Rs = [
|
|
2370
2370
|
"in",
|
|
2371
2371
|
"$in",
|
|
2372
2372
|
"$not",
|
|
@@ -2374,77 +2374,77 @@ const Is = [
|
|
|
2374
2374
|
"$comparator"
|
|
2375
2375
|
// covers all of $gt, $lt, etc.
|
|
2376
2376
|
];
|
|
2377
|
-
function
|
|
2378
|
-
for (const e of
|
|
2377
|
+
function $s(t) {
|
|
2378
|
+
for (const e of Rs)
|
|
2379
2379
|
if (t.hasOwnProperty(e))
|
|
2380
2380
|
return !0;
|
|
2381
2381
|
return !1;
|
|
2382
2382
|
}
|
|
2383
|
-
function
|
|
2384
|
-
return n ? typeof t == "object" ?
|
|
2383
|
+
function qr(t, e, n) {
|
|
2384
|
+
return n ? typeof t == "object" ? $s(t) ? n : null : Ms(t)(t, e, n) : null;
|
|
2385
2385
|
}
|
|
2386
|
-
function
|
|
2386
|
+
function Ds(t, e, n) {
|
|
2387
2387
|
return t.reduce((r, i, s) => {
|
|
2388
2388
|
const o = e[s];
|
|
2389
|
-
return
|
|
2389
|
+
return qr(i, o, r);
|
|
2390
2390
|
}, n);
|
|
2391
2391
|
}
|
|
2392
|
-
function
|
|
2393
|
-
return
|
|
2392
|
+
function xs(t, e, n) {
|
|
2393
|
+
return Fs(t, e, n).map((r) => Ds(e, r, n)).filter((r) => r);
|
|
2394
2394
|
}
|
|
2395
|
-
function
|
|
2396
|
-
return e.or ? e.or.patterns.flatMap((r) =>
|
|
2395
|
+
function Us(t, e, n) {
|
|
2396
|
+
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) => xs(t, e, r));
|
|
2397
2397
|
}
|
|
2398
|
-
function
|
|
2399
|
-
return e.reduce((r, i) =>
|
|
2398
|
+
function Vt(t, e, n = [{}]) {
|
|
2399
|
+
return e.reduce((r, i) => Us(t, i, r), n);
|
|
2400
2400
|
}
|
|
2401
|
-
function
|
|
2402
|
-
return Array.isArray(e) ? e.map((n) =>
|
|
2401
|
+
function dn(t, e) {
|
|
2402
|
+
return Array.isArray(e) ? e.map((n) => dn(t, n)) : Is(e) ? t[e] : e;
|
|
2403
2403
|
}
|
|
2404
|
-
function
|
|
2405
|
-
return
|
|
2404
|
+
function Ls(t, { find: e, where: n }) {
|
|
2405
|
+
return Vt(t, n).map((i) => dn(i, e));
|
|
2406
2406
|
}
|
|
2407
|
-
function
|
|
2408
|
-
return
|
|
2407
|
+
function Fs(t, e, n) {
|
|
2408
|
+
return Es(t, dn(n, e));
|
|
2409
2409
|
}
|
|
2410
|
-
const
|
|
2410
|
+
const Ns = /^(?:[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
2411
|
function ve(t) {
|
|
2412
|
-
return typeof t == "string" &&
|
|
2412
|
+
return typeof t == "string" && Ns.test(t);
|
|
2413
2413
|
}
|
|
2414
2414
|
const F = [];
|
|
2415
2415
|
for (let t = 0; t < 256; ++t)
|
|
2416
2416
|
F.push((t + 256).toString(16).slice(1));
|
|
2417
|
-
function
|
|
2417
|
+
function Vs(t, e = 0) {
|
|
2418
2418
|
return (F[t[e + 0]] + F[t[e + 1]] + F[t[e + 2]] + F[t[e + 3]] + "-" + F[t[e + 4]] + F[t[e + 5]] + "-" + F[t[e + 6]] + F[t[e + 7]] + "-" + F[t[e + 8]] + F[t[e + 9]] + "-" + F[t[e + 10]] + F[t[e + 11]] + F[t[e + 12]] + F[t[e + 13]] + F[t[e + 14]] + F[t[e + 15]]).toLowerCase();
|
|
2419
2419
|
}
|
|
2420
|
-
let
|
|
2421
|
-
const
|
|
2422
|
-
function
|
|
2423
|
-
if (!
|
|
2420
|
+
let vt;
|
|
2421
|
+
const qs = new Uint8Array(16);
|
|
2422
|
+
function Ws() {
|
|
2423
|
+
if (!vt) {
|
|
2424
2424
|
if (typeof crypto > "u" || !crypto.getRandomValues)
|
|
2425
2425
|
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
2426
|
-
|
|
2426
|
+
vt = crypto.getRandomValues.bind(crypto);
|
|
2427
2427
|
}
|
|
2428
|
-
return
|
|
2428
|
+
return vt(qs);
|
|
2429
2429
|
}
|
|
2430
|
-
const
|
|
2431
|
-
function
|
|
2430
|
+
const zs = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), Bn = { randomUUID: zs };
|
|
2431
|
+
function Ks(t, e, n) {
|
|
2432
2432
|
var i;
|
|
2433
|
-
if (
|
|
2434
|
-
return
|
|
2433
|
+
if (Bn.randomUUID && !t)
|
|
2434
|
+
return Bn.randomUUID();
|
|
2435
2435
|
t = t || {};
|
|
2436
|
-
const r = t.random ?? ((i = t.rng) == null ? void 0 : i.call(t)) ??
|
|
2436
|
+
const r = t.random ?? ((i = t.rng) == null ? void 0 : i.call(t)) ?? Ws();
|
|
2437
2437
|
if (r.length < 16)
|
|
2438
2438
|
throw new Error("Random bytes length must be >= 16");
|
|
2439
|
-
return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128,
|
|
2439
|
+
return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128, Vs(r);
|
|
2440
2440
|
}
|
|
2441
|
-
function
|
|
2441
|
+
function Qn(t) {
|
|
2442
2442
|
const e = t.replace(/-/g, ""), n = [];
|
|
2443
2443
|
for (let r = 0; r < e.length; r += 2)
|
|
2444
2444
|
n.push(parseInt(e.substring(r, r + 2), 16));
|
|
2445
2445
|
return n;
|
|
2446
2446
|
}
|
|
2447
|
-
function
|
|
2447
|
+
function Bs(t, e) {
|
|
2448
2448
|
for (let n = 0; n < t.length; n++) {
|
|
2449
2449
|
if (t[n] < e[n])
|
|
2450
2450
|
return -1;
|
|
@@ -2453,17 +2453,17 @@ function Ws(t, e) {
|
|
|
2453
2453
|
}
|
|
2454
2454
|
return 0;
|
|
2455
2455
|
}
|
|
2456
|
-
function
|
|
2457
|
-
return
|
|
2456
|
+
function Qs(t, e) {
|
|
2457
|
+
return Bs(Qn(t), Qn(e));
|
|
2458
2458
|
}
|
|
2459
2459
|
function L() {
|
|
2460
|
-
return
|
|
2460
|
+
return Ks();
|
|
2461
2461
|
}
|
|
2462
|
-
function
|
|
2462
|
+
function Gs(t, e) {
|
|
2463
2463
|
return t.localeCompare(e);
|
|
2464
2464
|
}
|
|
2465
|
-
function
|
|
2466
|
-
let t =
|
|
2465
|
+
function Hs() {
|
|
2466
|
+
let t = Gs;
|
|
2467
2467
|
if (typeof Intl == "object" && Intl.hasOwnProperty("Collator"))
|
|
2468
2468
|
try {
|
|
2469
2469
|
t = Intl.Collator("en-US").compare;
|
|
@@ -2471,12 +2471,12 @@ function Bs() {
|
|
|
2471
2471
|
}
|
|
2472
2472
|
return t;
|
|
2473
2473
|
}
|
|
2474
|
-
const
|
|
2475
|
-
let
|
|
2476
|
-
function
|
|
2477
|
-
return
|
|
2474
|
+
const Ys = Hs();
|
|
2475
|
+
let Js = 0;
|
|
2476
|
+
function Fe(t) {
|
|
2477
|
+
return dt(`_${t}`, Js++);
|
|
2478
2478
|
}
|
|
2479
|
-
function
|
|
2479
|
+
function dt(t, e) {
|
|
2480
2480
|
return `?${t}-${e}`;
|
|
2481
2481
|
}
|
|
2482
2482
|
class Oe extends Error {
|
|
@@ -2484,28 +2484,28 @@ class Oe extends Error {
|
|
|
2484
2484
|
super(e), this.name = "AttrNotFoundError";
|
|
2485
2485
|
}
|
|
2486
2486
|
}
|
|
2487
|
-
function
|
|
2488
|
-
const n =
|
|
2487
|
+
function Zs(t, e) {
|
|
2488
|
+
const n = Vr(t, e);
|
|
2489
2489
|
if (!n)
|
|
2490
2490
|
throw new Oe(`Could not find id attr for ${e}`);
|
|
2491
2491
|
return n;
|
|
2492
2492
|
}
|
|
2493
|
-
function
|
|
2494
|
-
return [
|
|
2493
|
+
function Gn(t, e, n, r) {
|
|
2494
|
+
return [Xs(t, e, n, r)];
|
|
2495
2495
|
}
|
|
2496
|
-
function
|
|
2496
|
+
function Xs(t, e, n, r) {
|
|
2497
2497
|
return [
|
|
2498
2498
|
t(n, r),
|
|
2499
|
-
|
|
2499
|
+
Zs(e, n).id,
|
|
2500
2500
|
t(n, r),
|
|
2501
2501
|
t("time", r)
|
|
2502
2502
|
];
|
|
2503
2503
|
}
|
|
2504
|
-
function
|
|
2504
|
+
function eo(t, e, n) {
|
|
2505
2505
|
return t.map((r) => r === e ? n : r);
|
|
2506
2506
|
}
|
|
2507
|
-
function
|
|
2508
|
-
const s =
|
|
2507
|
+
function Wr(t, e, n, r, i) {
|
|
2508
|
+
const s = ce(e, n, i), o = Nr(e, n, i), u = s || o;
|
|
2509
2509
|
if (!u)
|
|
2510
2510
|
throw new Oe(`Could not find attr for ${[n, i]}`);
|
|
2511
2511
|
if (u["value-type"] !== "ref")
|
|
@@ -2514,16 +2514,16 @@ function Nr(t, e, n, r, i) {
|
|
|
2514
2514
|
t(d, r),
|
|
2515
2515
|
u.id,
|
|
2516
2516
|
t(f, h),
|
|
2517
|
-
|
|
2517
|
+
Fe("time")
|
|
2518
2518
|
] : [
|
|
2519
2519
|
t(d, h),
|
|
2520
2520
|
u.id,
|
|
2521
2521
|
t(f, r),
|
|
2522
|
-
|
|
2522
|
+
Fe("time")
|
|
2523
2523
|
];
|
|
2524
2524
|
return [s ? f : d, h, p, u, !!s];
|
|
2525
2525
|
}
|
|
2526
|
-
function
|
|
2526
|
+
function Hn(t, e) {
|
|
2527
2527
|
if (typeof e != "string")
|
|
2528
2528
|
return function(o) {
|
|
2529
2529
|
return !1;
|
|
@@ -2533,7 +2533,7 @@ function Qn(t, e) {
|
|
|
2533
2533
|
return typeof o != "string" ? !1 : i.test(o);
|
|
2534
2534
|
};
|
|
2535
2535
|
}
|
|
2536
|
-
function
|
|
2536
|
+
function to(t, e) {
|
|
2537
2537
|
if (typeof e != "object" || e.hasOwnProperty("$in") || e.hasOwnProperty("in"))
|
|
2538
2538
|
return e;
|
|
2539
2539
|
const n = t["checked-data-type"] === "date";
|
|
@@ -2574,7 +2574,7 @@ function Zs(t, e) {
|
|
|
2574
2574
|
}
|
|
2575
2575
|
};
|
|
2576
2576
|
if (e.hasOwnProperty("$like")) {
|
|
2577
|
-
const r =
|
|
2577
|
+
const r = Hn(!0, e.$like);
|
|
2578
2578
|
return {
|
|
2579
2579
|
$comparator: !0,
|
|
2580
2580
|
$op: function(s) {
|
|
@@ -2583,7 +2583,7 @@ function Zs(t, e) {
|
|
|
2583
2583
|
};
|
|
2584
2584
|
}
|
|
2585
2585
|
if (e.hasOwnProperty("$ilike")) {
|
|
2586
|
-
const r =
|
|
2586
|
+
const r = Hn(!1, e.$ilike);
|
|
2587
2587
|
return {
|
|
2588
2588
|
$comparator: !0,
|
|
2589
2589
|
$op: function(s) {
|
|
@@ -2593,81 +2593,81 @@ function Zs(t, e) {
|
|
|
2593
2593
|
}
|
|
2594
2594
|
return e;
|
|
2595
2595
|
}
|
|
2596
|
-
function
|
|
2597
|
-
const o =
|
|
2596
|
+
function no(t, e, n, r, i, s) {
|
|
2597
|
+
const o = ce(e, n, i), u = Nr(e, n, i), c = o || u;
|
|
2598
2598
|
if (!c)
|
|
2599
2599
|
throw new Oe(`No attr for etype = ${n} label = ${i}`);
|
|
2600
2600
|
if (s != null && s.hasOwnProperty("$isNull")) {
|
|
2601
|
-
const d =
|
|
2601
|
+
const d = ce(e, n, "id");
|
|
2602
2602
|
if (!d)
|
|
2603
2603
|
throw new Oe(`No attr for etype = ${n} label = id`);
|
|
2604
2604
|
return [
|
|
2605
2605
|
t(n, r),
|
|
2606
2606
|
d.id,
|
|
2607
2607
|
{ $isNull: { attrId: c.id, isNull: s.$isNull, reverse: !o } },
|
|
2608
|
-
|
|
2608
|
+
Fe("time")
|
|
2609
2609
|
];
|
|
2610
2610
|
}
|
|
2611
2611
|
return o ? [
|
|
2612
2612
|
t(n, r),
|
|
2613
2613
|
c.id,
|
|
2614
|
-
|
|
2615
|
-
|
|
2616
|
-
] : [s, c.id, t(n, r),
|
|
2614
|
+
to(c, s),
|
|
2615
|
+
Fe("time")
|
|
2616
|
+
] : [s, c.id, t(n, r), Fe("time")];
|
|
2617
2617
|
}
|
|
2618
|
-
function
|
|
2618
|
+
function ro(t, e, n, r, i) {
|
|
2619
2619
|
const [s, o, u] = i.reduce((c, d) => {
|
|
2620
|
-
const [a, f, h] = c, [p, y, _] =
|
|
2620
|
+
const [a, f, h] = c, [p, y, _] = Wr(t, e, a, f, d);
|
|
2621
2621
|
return [p, y, [...h, _]];
|
|
2622
2622
|
}, [n, r, []]);
|
|
2623
2623
|
return [s, o, u];
|
|
2624
2624
|
}
|
|
2625
|
-
function
|
|
2626
|
-
const o = i.slice(0, i.length - 1), u = i[i.length - 1], [c, d, a] =
|
|
2625
|
+
function qt(t, e, n, r, i, s) {
|
|
2626
|
+
const o = i.slice(0, i.length - 1), u = i[i.length - 1], [c, d, a] = ro(t, e, n, r, o), f = no(t, e, c, d, u, s);
|
|
2627
2627
|
return a.concat([f]);
|
|
2628
2628
|
}
|
|
2629
|
-
function
|
|
2629
|
+
function io(t, e) {
|
|
2630
2630
|
return e ? [e].concat(t) : t;
|
|
2631
2631
|
}
|
|
2632
|
-
function
|
|
2632
|
+
function so([t, e]) {
|
|
2633
2633
|
return t === "or" && Array.isArray(e);
|
|
2634
2634
|
}
|
|
2635
|
-
function
|
|
2635
|
+
function oo([t, e]) {
|
|
2636
2636
|
return t === "and" && Array.isArray(e);
|
|
2637
2637
|
}
|
|
2638
|
-
function
|
|
2638
|
+
function uo(t, e, n) {
|
|
2639
2639
|
return (r, i) => {
|
|
2640
2640
|
const s = t(r, i);
|
|
2641
2641
|
return e == s ? s : `${s}-${n}`;
|
|
2642
2642
|
};
|
|
2643
2643
|
}
|
|
2644
|
-
function
|
|
2644
|
+
function Yn(t, e, n, r, i, s) {
|
|
2645
2645
|
const o = t(r, i), u = s.map((c, d) => {
|
|
2646
|
-
const a =
|
|
2647
|
-
return
|
|
2646
|
+
const a = uo(t, o, d);
|
|
2647
|
+
return zr(a, n, r, i, c);
|
|
2648
2648
|
});
|
|
2649
2649
|
return { [e]: { patterns: u, joinSym: o } };
|
|
2650
2650
|
}
|
|
2651
|
-
function
|
|
2651
|
+
function ao(t) {
|
|
2652
2652
|
const e = [];
|
|
2653
2653
|
for (let n = 1; n <= t.length; n++)
|
|
2654
2654
|
e.push(t.slice(0, n));
|
|
2655
2655
|
return e;
|
|
2656
2656
|
}
|
|
2657
|
-
function
|
|
2658
|
-
return
|
|
2657
|
+
function Jn(t, e, n, r, i) {
|
|
2658
|
+
return ao(i).map((s) => qt(t, e, n, r, s, { $isNull: !0 }));
|
|
2659
2659
|
}
|
|
2660
|
-
function
|
|
2660
|
+
function zr(t, e, n, r, i) {
|
|
2661
2661
|
return Object.entries(i).flatMap(([s, o]) => {
|
|
2662
|
-
if (
|
|
2663
|
-
return
|
|
2664
|
-
if (
|
|
2665
|
-
return
|
|
2662
|
+
if (so([s, o]))
|
|
2663
|
+
return Yn(t, "or", e, n, r, o);
|
|
2664
|
+
if (oo([s, o]))
|
|
2665
|
+
return Yn(t, "and", e, n, r, o);
|
|
2666
2666
|
if (s === "$entityIdStartsWith")
|
|
2667
2667
|
return [];
|
|
2668
2668
|
const u = s.split(".");
|
|
2669
2669
|
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 c =
|
|
2670
|
+
const c = qt(t, e, n, r, u, o), d = Jn(t, e, n, r, u);
|
|
2671
2671
|
return [
|
|
2672
2672
|
{
|
|
2673
2673
|
or: {
|
|
@@ -2680,32 +2680,32 @@ function Vr(t, e, n, r, i) {
|
|
|
2680
2680
|
return o != null && o.hasOwnProperty("$isNull") && o.$isNull === !0 && u.length > 1 ? [
|
|
2681
2681
|
{
|
|
2682
2682
|
or: {
|
|
2683
|
-
patterns:
|
|
2683
|
+
patterns: Jn(t, e, n, r, u),
|
|
2684
2684
|
joinSym: t(n, r)
|
|
2685
2685
|
}
|
|
2686
2686
|
}
|
|
2687
|
-
] :
|
|
2687
|
+
] : qt(t, e, n, r, u, o);
|
|
2688
2688
|
});
|
|
2689
2689
|
}
|
|
2690
|
-
function
|
|
2691
|
-
const i =
|
|
2692
|
-
return r ?
|
|
2690
|
+
function co(t, e, n, r) {
|
|
2691
|
+
const i = dt;
|
|
2692
|
+
return r ? zr(i, t, e, n, r).concat(Gn(i, t, e, n)) : Gn(i, t, e, n);
|
|
2693
2693
|
}
|
|
2694
|
-
function
|
|
2694
|
+
function fo(t, e, n) {
|
|
2695
2695
|
return [t(e, n), t("time", n)];
|
|
2696
2696
|
}
|
|
2697
|
-
function
|
|
2698
|
-
const [o, u, c, d, a] =
|
|
2697
|
+
function lo(t, e, n, r, i, s) {
|
|
2698
|
+
const [o, u, c, d, a] = Wr(t, e, n, r, i), f = eo(c, t(n, r), s);
|
|
2699
2699
|
return [o, u, f, d, a];
|
|
2700
2700
|
}
|
|
2701
|
-
function
|
|
2701
|
+
function ho(t, e, { etype: n, level: r, form: i }, s) {
|
|
2702
2702
|
const o = Object.keys(i).filter((u) => u !== "$");
|
|
2703
2703
|
return o.length ? Object.entries(s).map(function([c, d]) {
|
|
2704
2704
|
return o.map(function(h) {
|
|
2705
2705
|
var p, y, _;
|
|
2706
2706
|
const T = !!(e.cardinalityInference && (!((_ = (y = (p = e.linkIndex) === null || p === void 0 ? void 0 : p[n]) === null || y === void 0 ? void 0 : y[h]) === null || _ === void 0) && _.isSingular));
|
|
2707
2707
|
try {
|
|
2708
|
-
const [g, S, m] =
|
|
2708
|
+
const [g, S, m] = lo(t, e, n, r, h, c), M = Br(e, {
|
|
2709
2709
|
etype: g,
|
|
2710
2710
|
level: S,
|
|
2711
2711
|
form: i[h],
|
|
@@ -2722,96 +2722,99 @@ function co(t, e, { etype: n, level: r, form: i }, s) {
|
|
|
2722
2722
|
}, d);
|
|
2723
2723
|
}) : Object.values(s);
|
|
2724
2724
|
}
|
|
2725
|
-
function
|
|
2726
|
-
return n === "string" ?
|
|
2725
|
+
function po(t, e, n) {
|
|
2726
|
+
return n === "string" ? Ys(t, e) : t > e ? 1 : -1;
|
|
2727
|
+
}
|
|
2728
|
+
function Ue(t, e, n, r, i) {
|
|
2729
|
+
return e === r || e == null && r == null ? Qs(t, n) : r == null ? 1 : e == null ? -1 : po(e, r, i);
|
|
2727
2730
|
}
|
|
2728
|
-
function
|
|
2729
|
-
return
|
|
2731
|
+
function ut([t, e], [n, r], i) {
|
|
2732
|
+
return Ue(t, e, n, r, i);
|
|
2730
2733
|
}
|
|
2731
|
-
function
|
|
2734
|
+
function Wt(t) {
|
|
2732
2735
|
return t == null ? t : new Date(t).getTime();
|
|
2733
2736
|
}
|
|
2734
|
-
function
|
|
2737
|
+
function yo(t, e, n, r) {
|
|
2735
2738
|
var i;
|
|
2736
2739
|
const [s, o, u, c] = t, d = n === "desc" ? 1 : -1;
|
|
2737
2740
|
if (((i = e["forward-identity"]) === null || i === void 0 ? void 0 : i[2]) === "id")
|
|
2738
|
-
return
|
|
2739
|
-
const [a, f] = r, h = e["checked-data-type"], p = h === "date" ?
|
|
2740
|
-
return
|
|
2741
|
+
return ut(r, [s, c], null) === d;
|
|
2742
|
+
const [a, f] = r, h = e["checked-data-type"], p = h === "date" ? Wt(f) : f, y = h === "date" ? Wt(u) : u;
|
|
2743
|
+
return ut([a, p], [s, y], h) === d;
|
|
2741
2744
|
}
|
|
2742
|
-
function
|
|
2745
|
+
function bo(t, e) {
|
|
2743
2746
|
const n = e[1];
|
|
2744
2747
|
return t.attrs[n];
|
|
2745
2748
|
}
|
|
2746
|
-
function
|
|
2749
|
+
function _o(t, e, n) {
|
|
2747
2750
|
const r = Object.keys(n)[0];
|
|
2748
|
-
return
|
|
2751
|
+
return ce(t, e, r);
|
|
2749
2752
|
}
|
|
2750
|
-
function
|
|
2753
|
+
function go(t, e, n, r) {
|
|
2751
2754
|
if (n)
|
|
2752
|
-
return
|
|
2755
|
+
return bo(t, n);
|
|
2753
2756
|
if (r)
|
|
2754
|
-
return
|
|
2757
|
+
return _o(t, e, r);
|
|
2755
2758
|
}
|
|
2756
|
-
function
|
|
2759
|
+
function To(t, e, n) {
|
|
2757
2760
|
var r, i;
|
|
2758
2761
|
if (!Array.isArray(n.fields))
|
|
2759
|
-
return
|
|
2762
|
+
return Cs(t, e);
|
|
2760
2763
|
const s = /* @__PURE__ */ new Map();
|
|
2761
2764
|
for (const o of n.fields) {
|
|
2762
|
-
const u =
|
|
2763
|
-
c &&
|
|
2765
|
+
const u = ce(t, e, o), c = (r = u == null ? void 0 : u["forward-identity"]) === null || r === void 0 ? void 0 : r[2];
|
|
2766
|
+
c && an(u) && s.set(c, u);
|
|
2764
2767
|
}
|
|
2765
2768
|
if (!s.has("id")) {
|
|
2766
|
-
const o =
|
|
2769
|
+
const o = ce(t, e, "id"), u = (i = o == null ? void 0 : o["forward-identity"]) === null || i === void 0 ? void 0 : i[2];
|
|
2767
2770
|
u && s.set(u, o);
|
|
2768
2771
|
}
|
|
2769
2772
|
return s;
|
|
2770
2773
|
}
|
|
2771
|
-
function
|
|
2774
|
+
function wo(t, { etype: e, pageInfo: n, dq: r, form: i }) {
|
|
2772
2775
|
var s, o;
|
|
2773
|
-
const u = (s = i == null ? void 0 : i.$) === null || s === void 0 ? void 0 : s.order, c =
|
|
2774
|
-
let a =
|
|
2775
|
-
const f = n == null ? void 0 : n["start-cursor"], h =
|
|
2776
|
+
const u = (s = i == null ? void 0 : i.$) === null || s === void 0 ? void 0 : s.order, c = Kr(i), d = So(i);
|
|
2777
|
+
let a = Ls(t, r);
|
|
2778
|
+
const f = n == null ? void 0 : n["start-cursor"], h = go(t, e, f, u);
|
|
2776
2779
|
if (h && ((o = h == null ? void 0 : h["forward-identity"]) === null || o === void 0 ? void 0 : o[2]) !== "id") {
|
|
2777
2780
|
const _ = h["checked-data-type"] === "date", T = h.id;
|
|
2778
2781
|
a = a.map(([g]) => {
|
|
2779
2782
|
var S, m, M, O, P;
|
|
2780
2783
|
let U = (P = (O = (M = (m = (S = t.eav.get(g)) === null || S === void 0 ? void 0 : S.get(T)) === null || m === void 0 ? void 0 : m.values()) === null || M === void 0 ? void 0 : M.next()) === null || O === void 0 ? void 0 : O.value) === null || P === void 0 ? void 0 : P[2];
|
|
2781
|
-
return _ && (U =
|
|
2784
|
+
return _ && (U = Wt(U)), [g, U];
|
|
2782
2785
|
});
|
|
2783
2786
|
}
|
|
2784
2787
|
a.sort(d === "asc" ? function(T, g) {
|
|
2785
|
-
return
|
|
2788
|
+
return ut(T, g, h == null ? void 0 : h["checked-data-type"]);
|
|
2786
2789
|
} : function(T, g) {
|
|
2787
|
-
return
|
|
2790
|
+
return ut(g, T, h == null ? void 0 : h["checked-data-type"]);
|
|
2788
2791
|
});
|
|
2789
2792
|
let p = {};
|
|
2790
|
-
const y =
|
|
2793
|
+
const y = To(t, e, r);
|
|
2791
2794
|
for (const _ of a) {
|
|
2792
2795
|
const [T] = _;
|
|
2793
|
-
if (p[T] || !c && f && h &&
|
|
2796
|
+
if (p[T] || !c && f && h && yo(f, h, d, _))
|
|
2794
2797
|
continue;
|
|
2795
|
-
const g =
|
|
2798
|
+
const g = As(t, y, T);
|
|
2796
2799
|
g && (p[T] = g);
|
|
2797
2800
|
}
|
|
2798
2801
|
return p;
|
|
2799
2802
|
}
|
|
2800
|
-
function
|
|
2803
|
+
function So(t) {
|
|
2801
2804
|
var e;
|
|
2802
2805
|
const n = (e = t.$) === null || e === void 0 ? void 0 : e.order;
|
|
2803
2806
|
return n && n[Object.keys(n)[0]] || "asc";
|
|
2804
2807
|
}
|
|
2805
|
-
function
|
|
2808
|
+
function Kr(t) {
|
|
2806
2809
|
var e, n, r;
|
|
2807
2810
|
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;
|
|
2808
2811
|
return !i && !s && !o;
|
|
2809
2812
|
}
|
|
2810
|
-
function
|
|
2813
|
+
function mo(t, { etype: e, level: n, form: r, join: i, pageInfo: s }) {
|
|
2811
2814
|
var o, u, c, d, a;
|
|
2812
|
-
if (!
|
|
2815
|
+
if (!Kr(r) && (!s || !s["start-cursor"]))
|
|
2813
2816
|
return [];
|
|
2814
|
-
const f =
|
|
2817
|
+
const f = io(co(t, e, n, (o = r.$) === null || o === void 0 ? void 0 : o.where), i), h = fo(dt, e, n), p = (u = r.$) === null || u === void 0 ? void 0 : u.fields, y = wo(t, {
|
|
2815
2818
|
etype: e,
|
|
2816
2819
|
pageInfo: s,
|
|
2817
2820
|
form: r,
|
|
@@ -2824,20 +2827,20 @@ function To(t, { etype: e, level: n, form: r, join: i, pageInfo: s }) {
|
|
|
2824
2827
|
}
|
|
2825
2828
|
return y;
|
|
2826
2829
|
}
|
|
2827
|
-
function
|
|
2830
|
+
function vo(t, e) {
|
|
2828
2831
|
try {
|
|
2829
|
-
return
|
|
2832
|
+
return mo(t, e);
|
|
2830
2833
|
} catch (n) {
|
|
2831
2834
|
if (n instanceof Oe)
|
|
2832
2835
|
return {};
|
|
2833
2836
|
throw n;
|
|
2834
2837
|
}
|
|
2835
2838
|
}
|
|
2836
|
-
function
|
|
2837
|
-
const n =
|
|
2838
|
-
return
|
|
2839
|
+
function Br(t, e) {
|
|
2840
|
+
const n = vo(t, e);
|
|
2841
|
+
return ho(dt, t, e, n);
|
|
2839
2842
|
}
|
|
2840
|
-
function
|
|
2843
|
+
function Oo(t) {
|
|
2841
2844
|
const e = {};
|
|
2842
2845
|
for (const [n, r] of Object.entries(t))
|
|
2843
2846
|
e[n] = {
|
|
@@ -2848,18 +2851,18 @@ function So(t) {
|
|
|
2848
2851
|
};
|
|
2849
2852
|
return e;
|
|
2850
2853
|
}
|
|
2851
|
-
function
|
|
2854
|
+
function Qr({ store: t, pageInfo: e, aggregate: n }, r) {
|
|
2852
2855
|
const s = { data: Object.keys(r).reduce(function(u, c) {
|
|
2853
|
-
return n != null && n[c] || c === "$$ruleParams" || (u[c] =
|
|
2856
|
+
return n != null && n[c] || c === "$$ruleParams" || (u[c] = Br(t, {
|
|
2854
2857
|
etype: c,
|
|
2855
2858
|
form: r[c],
|
|
2856
2859
|
level: 0,
|
|
2857
2860
|
pageInfo: e == null ? void 0 : e[c]
|
|
2858
2861
|
})), u;
|
|
2859
2862
|
}, {}) };
|
|
2860
|
-
return e && (s.pageInfo =
|
|
2863
|
+
return e && (s.pageInfo = Oo(e)), n && (s.aggregate = n), s;
|
|
2861
2864
|
}
|
|
2862
|
-
function
|
|
2865
|
+
function Eo() {
|
|
2863
2866
|
const e = {
|
|
2864
2867
|
__etype: 1,
|
|
2865
2868
|
__ops: 1,
|
|
@@ -2873,8 +2876,8 @@ function mo() {
|
|
|
2873
2876
|
};
|
|
2874
2877
|
return new Set(Object.keys(e));
|
|
2875
2878
|
}
|
|
2876
|
-
const
|
|
2877
|
-
function
|
|
2879
|
+
const Ao = Eo();
|
|
2880
|
+
function zt(t, e, n) {
|
|
2878
2881
|
const r = {
|
|
2879
2882
|
__etype: t,
|
|
2880
2883
|
__ops: n
|
|
@@ -2885,22 +2888,22 @@ function qt(t, e, n) {
|
|
|
2885
2888
|
return n;
|
|
2886
2889
|
if (s === "__etype")
|
|
2887
2890
|
return t;
|
|
2888
|
-
if (
|
|
2889
|
-
return (o, u) =>
|
|
2891
|
+
if (Ao.has(s))
|
|
2892
|
+
return (o, u) => zt(t, e, [
|
|
2890
2893
|
...n,
|
|
2891
2894
|
u ? [s, t, e, o, u] : [s, t, e, o]
|
|
2892
2895
|
]);
|
|
2893
2896
|
}
|
|
2894
2897
|
});
|
|
2895
2898
|
}
|
|
2896
|
-
function
|
|
2899
|
+
function at(t) {
|
|
2897
2900
|
return t.startsWith("lookup__");
|
|
2898
2901
|
}
|
|
2899
|
-
function
|
|
2902
|
+
function Gr(t) {
|
|
2900
2903
|
const [e, n, ...r] = t.split("__");
|
|
2901
2904
|
return [n, JSON.parse(r.join("__"))];
|
|
2902
2905
|
}
|
|
2903
|
-
function
|
|
2906
|
+
function Co(t) {
|
|
2904
2907
|
return new Proxy({
|
|
2905
2908
|
__etype: t
|
|
2906
2909
|
}, {
|
|
@@ -2908,22 +2911,22 @@ function Oo(t) {
|
|
|
2908
2911
|
if (n === "__etype")
|
|
2909
2912
|
return t;
|
|
2910
2913
|
const r = n;
|
|
2911
|
-
return
|
|
2914
|
+
return at(r) ? zt(t, Gr(r), []) : zt(t, r, []);
|
|
2912
2915
|
}
|
|
2913
2916
|
});
|
|
2914
2917
|
}
|
|
2915
|
-
function
|
|
2918
|
+
function fn() {
|
|
2916
2919
|
return new Proxy({}, {
|
|
2917
2920
|
get(t, e) {
|
|
2918
|
-
return
|
|
2921
|
+
return Co(e);
|
|
2919
2922
|
}
|
|
2920
2923
|
});
|
|
2921
2924
|
}
|
|
2922
|
-
|
|
2923
|
-
function
|
|
2925
|
+
fn();
|
|
2926
|
+
function jo(t) {
|
|
2924
2927
|
return t.__ops;
|
|
2925
2928
|
}
|
|
2926
|
-
function
|
|
2929
|
+
function ko(t, e) {
|
|
2927
2930
|
const { attrIdMap: n, refSwapAttrIds: r } = t, i = [];
|
|
2928
2931
|
for (const o of e) {
|
|
2929
2932
|
const u = n[o];
|
|
@@ -2948,7 +2951,7 @@ function V(t, e, n) {
|
|
|
2948
2951
|
return s === e && o === n;
|
|
2949
2952
|
});
|
|
2950
2953
|
}
|
|
2951
|
-
function
|
|
2954
|
+
function pe(t, e, n) {
|
|
2952
2955
|
return Object.values(t).find((r) => {
|
|
2953
2956
|
const i = r["reverse-identity"];
|
|
2954
2957
|
if (!i)
|
|
@@ -2957,7 +2960,7 @@ function he(t, e, n) {
|
|
|
2957
2960
|
return o === e && u === n;
|
|
2958
2961
|
});
|
|
2959
2962
|
}
|
|
2960
|
-
function
|
|
2963
|
+
function Io(t) {
|
|
2961
2964
|
if (Array.isArray(t))
|
|
2962
2965
|
return t;
|
|
2963
2966
|
const e = Object.entries(t);
|
|
@@ -2965,38 +2968,38 @@ function Co(t) {
|
|
|
2965
2968
|
throw new Error("lookup must be an object with a single unique attr and value.");
|
|
2966
2969
|
return e[0];
|
|
2967
2970
|
}
|
|
2968
|
-
function
|
|
2971
|
+
function Kt(t, e, n) {
|
|
2969
2972
|
return n.indexOf(".") !== -1 && // attr names can have `.` in them, so use the attr we find with a `.`
|
|
2970
2973
|
// before assuming it's a ref lookup.
|
|
2971
2974
|
!V(t, e, n);
|
|
2972
2975
|
}
|
|
2973
|
-
function
|
|
2976
|
+
function Bt(t) {
|
|
2974
2977
|
const [e, n, ...r] = t.split(".");
|
|
2975
2978
|
if (r.length > 0 || n !== "id")
|
|
2976
2979
|
throw new Error(`${t} is not a valid lookup attribute.`);
|
|
2977
2980
|
return e;
|
|
2978
2981
|
}
|
|
2979
|
-
function
|
|
2980
|
-
if (!
|
|
2982
|
+
function Po(t, e, n) {
|
|
2983
|
+
if (!Kt(t, e, n))
|
|
2981
2984
|
return V(t, e, n);
|
|
2982
|
-
const r =
|
|
2985
|
+
const r = Bt(n), i = V(t, e, r) || pe(t, e, r);
|
|
2983
2986
|
if (i && i["value-type"] !== "ref")
|
|
2984
2987
|
throw new Error(`${n} does not reference a valid link attribute.`);
|
|
2985
2988
|
return i;
|
|
2986
2989
|
}
|
|
2987
|
-
function
|
|
2988
|
-
return typeof t == "string" && !
|
|
2990
|
+
function Qt(t) {
|
|
2991
|
+
return typeof t == "string" && !at(t) ? null : typeof t == "string" && at(t) ? Gr(t) : Io(t);
|
|
2989
2992
|
}
|
|
2990
2993
|
function G(t, e, n) {
|
|
2991
|
-
const r =
|
|
2994
|
+
const r = Qt(n);
|
|
2992
2995
|
if (r === null)
|
|
2993
2996
|
return n;
|
|
2994
|
-
const [i, s] = r, o =
|
|
2997
|
+
const [i, s] = r, o = Po(t, e, i);
|
|
2995
2998
|
if (!o || !o["unique?"])
|
|
2996
2999
|
throw new Error(`${i} is not a unique attribute.`);
|
|
2997
3000
|
return [o.id, s];
|
|
2998
3001
|
}
|
|
2999
|
-
function
|
|
3002
|
+
function Hr(t, e, n, r) {
|
|
3000
3003
|
const i = G(t, e, n);
|
|
3001
3004
|
return Array.isArray(i) ? [[
|
|
3002
3005
|
"add-triple",
|
|
@@ -3005,9 +3008,9 @@ function Br(t, e, n, r) {
|
|
|
3005
3008
|
i
|
|
3006
3009
|
]].concat(r) : r;
|
|
3007
3010
|
}
|
|
3008
|
-
function
|
|
3011
|
+
function Mo({ attrs: t }, [e, n, r]) {
|
|
3009
3012
|
const i = Object.entries(r).flatMap(([s, o]) => {
|
|
3010
|
-
const u = Array.isArray(o) ? o : [o], c = V(t, e, s), d =
|
|
3013
|
+
const u = Array.isArray(o) ? o : [o], c = V(t, e, s), d = pe(t, e, s);
|
|
3011
3014
|
return u.map((a) => c ? [
|
|
3012
3015
|
"add-triple",
|
|
3013
3016
|
G(t, e, n),
|
|
@@ -3020,11 +3023,11 @@ function ko({ attrs: t }, [e, n, r]) {
|
|
|
3020
3023
|
G(t, e, n)
|
|
3021
3024
|
]);
|
|
3022
3025
|
});
|
|
3023
|
-
return
|
|
3026
|
+
return Hr(t, e, n, i);
|
|
3024
3027
|
}
|
|
3025
|
-
function
|
|
3028
|
+
function Ro({ attrs: t }, [e, n, r]) {
|
|
3026
3029
|
const i = Object.entries(r).flatMap(([s, o]) => {
|
|
3027
|
-
const u = Array.isArray(o) ? o : [o], c = V(t, e, s), d =
|
|
3030
|
+
const u = Array.isArray(o) ? o : [o], c = V(t, e, s), d = pe(t, e, s);
|
|
3028
3031
|
return u.map((a) => c ? [
|
|
3029
3032
|
"retract-triple",
|
|
3030
3033
|
G(t, e, n),
|
|
@@ -3037,9 +3040,9 @@ function Io({ attrs: t }, [e, n, r]) {
|
|
|
3037
3040
|
G(t, e, n)
|
|
3038
3041
|
]);
|
|
3039
3042
|
});
|
|
3040
|
-
return
|
|
3043
|
+
return Hr(t, e, n, i);
|
|
3041
3044
|
}
|
|
3042
|
-
function
|
|
3045
|
+
function $o(t, e, n) {
|
|
3043
3046
|
if (Array.isArray(n)) {
|
|
3044
3047
|
const [r, i] = n;
|
|
3045
3048
|
for (const s of t || []) {
|
|
@@ -3061,21 +3064,21 @@ function Po(t, e, n) {
|
|
|
3061
3064
|
}
|
|
3062
3065
|
return !1;
|
|
3063
3066
|
}
|
|
3064
|
-
function
|
|
3065
|
-
return (s == null ? void 0 : s.upsert) === !1 ? { mode: "update" } : (s == null ? void 0 : s.upsert) === !0 ? null :
|
|
3067
|
+
function Yr({ stores: t, attrs: e }, [n, r, i, s]) {
|
|
3068
|
+
return (s == null ? void 0 : s.upsert) === !1 ? { mode: "update" } : (s == null ? void 0 : s.upsert) === !0 ? null : $o(t, n, r) ? { mode: "update" } : null;
|
|
3066
3069
|
}
|
|
3067
|
-
function
|
|
3068
|
-
const { stores: n, attrs: r } = t, [i, s, o, u] = e, c =
|
|
3070
|
+
function Do(t, e) {
|
|
3071
|
+
const { stores: n, attrs: r } = t, [i, s, o, u] = e, c = on(o), d = G(r, i, s);
|
|
3069
3072
|
return [["id", d]].concat(Object.entries(c)).map(([f, h]) => {
|
|
3070
3073
|
const p = V(r, i, f);
|
|
3071
|
-
return p["checked-data-type"] === "date" && t.useDateObjects && (h =
|
|
3074
|
+
return p["checked-data-type"] === "date" && t.useDateObjects && (h = ct(h)), ["add-triple", d, p.id, h, { mode: "create" }];
|
|
3072
3075
|
});
|
|
3073
3076
|
}
|
|
3074
|
-
function
|
|
3075
|
-
const { stores: n, attrs: r } = t, [i, s, o, u] = e, c =
|
|
3077
|
+
function xo(t, e) {
|
|
3078
|
+
const { stores: n, attrs: r } = t, [i, s, o, u] = e, c = on(o), d = G(r, i, s), a = Yr(t, [i, d, o, u]);
|
|
3076
3079
|
return [["id", d]].concat(Object.entries(c)).map(([h, p]) => {
|
|
3077
3080
|
const y = V(r, i, h);
|
|
3078
|
-
return y["checked-data-type"] === "date" && t.useDateObjects && (p =
|
|
3081
|
+
return y["checked-data-type"] === "date" && t.useDateObjects && (p = ct(p)), [
|
|
3079
3082
|
"add-triple",
|
|
3080
3083
|
d,
|
|
3081
3084
|
y.id,
|
|
@@ -3084,11 +3087,11 @@ function Ro(t, e) {
|
|
|
3084
3087
|
];
|
|
3085
3088
|
});
|
|
3086
3089
|
}
|
|
3087
|
-
function
|
|
3090
|
+
function Uo({ attrs: t }, [e, n]) {
|
|
3088
3091
|
return [["delete-entity", G(t, e, n), e]];
|
|
3089
3092
|
}
|
|
3090
|
-
function
|
|
3091
|
-
const { stores: n, attrs: r } = t, [i, s, o, u] = e, c =
|
|
3093
|
+
function Lo(t, e) {
|
|
3094
|
+
const { stores: n, attrs: r } = t, [i, s, o, u] = e, c = on(o), d = G(r, i, s), a = Yr(t, [i, d, o, u]), f = Object.entries(c).map(([p, y]) => {
|
|
3092
3095
|
const _ = V(r, i, p);
|
|
3093
3096
|
return [
|
|
3094
3097
|
"deep-merge-triple",
|
|
@@ -3106,38 +3109,38 @@ function Do(t, e) {
|
|
|
3106
3109
|
...a ? [a] : []
|
|
3107
3110
|
]].concat(f);
|
|
3108
3111
|
}
|
|
3109
|
-
function
|
|
3112
|
+
function Fo({ attrs: t }, [e, n, r]) {
|
|
3110
3113
|
return [["rule-params", G(t, e, n), e, r]];
|
|
3111
3114
|
}
|
|
3112
|
-
function
|
|
3115
|
+
function No(t) {
|
|
3113
3116
|
const [e, n, r, i, s] = t;
|
|
3114
3117
|
if (!i)
|
|
3115
3118
|
return t;
|
|
3116
3119
|
const o = Object.assign({}, i);
|
|
3117
3120
|
return delete o.id, [e, n, r, o, ...s ? [s] : []];
|
|
3118
3121
|
}
|
|
3119
|
-
function
|
|
3120
|
-
const [n, ...r] =
|
|
3122
|
+
function Vo(t, e) {
|
|
3123
|
+
const [n, ...r] = No(e);
|
|
3121
3124
|
switch (n) {
|
|
3122
3125
|
case "merge":
|
|
3123
|
-
return
|
|
3126
|
+
return Lo(t, r);
|
|
3124
3127
|
case "create":
|
|
3125
|
-
return
|
|
3128
|
+
return Do(t, r);
|
|
3126
3129
|
case "update":
|
|
3127
|
-
return
|
|
3130
|
+
return xo(t, r);
|
|
3128
3131
|
case "link":
|
|
3129
|
-
return
|
|
3132
|
+
return Mo(t, r);
|
|
3130
3133
|
case "unlink":
|
|
3131
|
-
return
|
|
3134
|
+
return Ro(t, r);
|
|
3132
3135
|
case "delete":
|
|
3133
|
-
return
|
|
3136
|
+
return Uo(t, r);
|
|
3134
3137
|
case "ruleParams":
|
|
3135
|
-
return
|
|
3138
|
+
return Fo(t, r);
|
|
3136
3139
|
default:
|
|
3137
3140
|
throw new Error(`unsupported action ${n}`);
|
|
3138
3141
|
}
|
|
3139
3142
|
}
|
|
3140
|
-
function
|
|
3143
|
+
function qo(t) {
|
|
3141
3144
|
switch (t) {
|
|
3142
3145
|
case "string":
|
|
3143
3146
|
case "date":
|
|
@@ -3148,29 +3151,29 @@ function Fo(t) {
|
|
|
3148
3151
|
return;
|
|
3149
3152
|
}
|
|
3150
3153
|
}
|
|
3151
|
-
function
|
|
3154
|
+
function Wo(t, e, n) {
|
|
3152
3155
|
var r, i;
|
|
3153
3156
|
const s = (i = (r = t.entities[e]) === null || r === void 0 ? void 0 : r.attrs) === null || i === void 0 ? void 0 : i[n];
|
|
3154
3157
|
if (n === "id")
|
|
3155
3158
|
return null;
|
|
3156
3159
|
if (!s)
|
|
3157
3160
|
throw new Error(`${e}.${n} does not exist in your schema`);
|
|
3158
|
-
const { unique: o, indexed: u } = s == null ? void 0 : s.config, c =
|
|
3161
|
+
const { unique: o, indexed: u } = s == null ? void 0 : s.config, c = qo(s == null ? void 0 : s.valueType);
|
|
3159
3162
|
return {
|
|
3160
3163
|
"index?": u,
|
|
3161
3164
|
"unique?": o,
|
|
3162
3165
|
"checked-data-type": c
|
|
3163
3166
|
};
|
|
3164
3167
|
}
|
|
3165
|
-
function
|
|
3166
|
-
const i = t ?
|
|
3168
|
+
function Ze(t, e, n, r) {
|
|
3169
|
+
const i = t ? Wo(t, e, n) : null, s = L(), u = [L(), e, n];
|
|
3167
3170
|
return Object.assign(Object.assign({ id: s, "forward-identity": u, "value-type": "blob", cardinality: "one", "unique?": !1, "index?": !1, isUnsynced: !0 }, i || {}), r || {});
|
|
3168
3171
|
}
|
|
3169
|
-
function
|
|
3172
|
+
function zo(t, e, n) {
|
|
3170
3173
|
return Object.values(t.links).find((i) => i.forward.on === e && i.forward.label === n || i.reverse.on === e && i.reverse.label === n);
|
|
3171
3174
|
}
|
|
3172
|
-
function
|
|
3173
|
-
const r =
|
|
3175
|
+
function Ko(t, e, n) {
|
|
3176
|
+
const r = zo(t, e, n);
|
|
3174
3177
|
if (!r)
|
|
3175
3178
|
throw new Error(`Couldn't find the link ${e}.${n} in your schema`);
|
|
3176
3179
|
const { forward: i, reverse: s } = r;
|
|
@@ -3183,11 +3186,11 @@ function qo(t, e, n) {
|
|
|
3183
3186
|
"on-delete-reverse": s.onDelete
|
|
3184
3187
|
};
|
|
3185
3188
|
}
|
|
3186
|
-
function
|
|
3187
|
-
const i = t ?
|
|
3189
|
+
function Zn(t, e, n, r) {
|
|
3190
|
+
const i = t ? Ko(t, e, n) : null, s = L(), o = [L(), e, n], u = [L(), n, e];
|
|
3188
3191
|
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 || {});
|
|
3189
3192
|
}
|
|
3190
|
-
const
|
|
3193
|
+
const Bo = /* @__PURE__ */ new Set(["create", "update", "merge", "link", "unlink"]), Qo = /* @__PURE__ */ new Set(["link", "unlink"]), Go = /* @__PURE__ */ new Set(["create", "update", "merge"]), Ho = /* @__PURE__ */ new Set([
|
|
3191
3194
|
"link",
|
|
3192
3195
|
"unlink",
|
|
3193
3196
|
"create",
|
|
@@ -3195,17 +3198,17 @@ const Wo = /* @__PURE__ */ new Set(["create", "update", "merge", "link", "unlink
|
|
|
3195
3198
|
"merge",
|
|
3196
3199
|
"delete",
|
|
3197
3200
|
"ruleParams"
|
|
3198
|
-
]),
|
|
3199
|
-
function
|
|
3201
|
+
]), Gt = { "unique?": !0, "index?": !0 }, Yo = Object.assign(Object.assign({}, Gt), { cardinality: "one" });
|
|
3202
|
+
function Jo(t) {
|
|
3200
3203
|
const e = [], [n, r, i, s] = t;
|
|
3201
|
-
if (!
|
|
3204
|
+
if (!Ho.has(n))
|
|
3202
3205
|
return e;
|
|
3203
|
-
const o =
|
|
3206
|
+
const o = Qt(i);
|
|
3204
3207
|
if (o && e.push({ etype: r, lookupPair: o }), n === "link")
|
|
3205
3208
|
for (const [u, c] of Object.entries(s)) {
|
|
3206
3209
|
const d = Array.isArray(c) ? c : [c];
|
|
3207
3210
|
for (const a of d) {
|
|
3208
|
-
const f =
|
|
3211
|
+
const f = Qt(a);
|
|
3209
3212
|
f && e.push({
|
|
3210
3213
|
etype: r,
|
|
3211
3214
|
lookupPair: f,
|
|
@@ -3215,7 +3218,7 @@ function Go(t) {
|
|
|
3215
3218
|
}
|
|
3216
3219
|
return e;
|
|
3217
3220
|
}
|
|
3218
|
-
function
|
|
3221
|
+
function Zo({ attrs: t, schema: e }, n) {
|
|
3219
3222
|
var r, i;
|
|
3220
3223
|
const [s, o, u] = [/* @__PURE__ */ new Set(), Object.assign({}, t), []];
|
|
3221
3224
|
function c(f) {
|
|
@@ -3225,51 +3228,51 @@ function Ho({ attrs: t, schema: e }, n) {
|
|
|
3225
3228
|
f != null && f.isUnsynced && !s.has(f.id) && (u.push(["add-attr", f]), s.add(f.id));
|
|
3226
3229
|
}
|
|
3227
3230
|
function a(f, h) {
|
|
3228
|
-
const p = V(o, f, h), y =
|
|
3229
|
-
d(p), d(y), !p && !y && c(
|
|
3231
|
+
const p = V(o, f, h), y = pe(o, f, h);
|
|
3232
|
+
d(p), d(y), !p && !y && c(Zn(e, f, h, Yo));
|
|
3230
3233
|
}
|
|
3231
3234
|
for (const f of n)
|
|
3232
|
-
for (const { etype: h, lookupPair: p, linkLabel: y } of
|
|
3235
|
+
for (const { etype: h, lookupPair: p, linkLabel: y } of Jo(f)) {
|
|
3233
3236
|
const _ = p[0];
|
|
3234
3237
|
if (y) {
|
|
3235
3238
|
a(h, y);
|
|
3236
|
-
const T = V(o, h, y), g =
|
|
3239
|
+
const T = V(o, h, y), g = pe(o, h, y);
|
|
3237
3240
|
d(T), d(g);
|
|
3238
3241
|
const S = ((r = T == null ? void 0 : T["reverse-identity"]) === null || r === void 0 ? void 0 : r[1]) || ((i = g == null ? void 0 : g["forward-identity"]) === null || i === void 0 ? void 0 : i[1]) || y;
|
|
3239
|
-
if (
|
|
3240
|
-
a(S,
|
|
3242
|
+
if (Kt(o, S, _))
|
|
3243
|
+
a(S, Bt(_));
|
|
3241
3244
|
else {
|
|
3242
3245
|
const m = V(o, S, _);
|
|
3243
|
-
m || c(
|
|
3246
|
+
m || c(Ze(e, S, _, Gt)), d(m);
|
|
3244
3247
|
}
|
|
3245
|
-
} else if (
|
|
3246
|
-
a(h,
|
|
3248
|
+
} else if (Kt(o, h, _))
|
|
3249
|
+
a(h, Bt(_));
|
|
3247
3250
|
else {
|
|
3248
3251
|
const T = V(o, h, _);
|
|
3249
|
-
T || c(
|
|
3252
|
+
T || c(Ze(e, h, _, Gt)), d(T);
|
|
3250
3253
|
}
|
|
3251
3254
|
}
|
|
3252
3255
|
for (const f of n) {
|
|
3253
3256
|
const [h, p, y, _] = f;
|
|
3254
|
-
if (
|
|
3257
|
+
if (Bo.has(h)) {
|
|
3255
3258
|
const T = V(o, p, "id");
|
|
3256
|
-
d(T), T || c(
|
|
3259
|
+
d(T), T || c(Ze(e, p, "id", { "unique?": !0 }));
|
|
3257
3260
|
for (const g of Object.keys(_)) {
|
|
3258
3261
|
const S = V(o, p, g);
|
|
3259
|
-
if (d(S),
|
|
3260
|
-
const m =
|
|
3261
|
-
!S && !m && c(
|
|
3262
|
+
if (d(S), Go.has(h) && (S || c(Ze(e, p, g, g === "id" ? { "unique?": !0 } : null))), Qo.has(h)) {
|
|
3263
|
+
const m = pe(o, p, g);
|
|
3264
|
+
!S && !m && c(Zn(e, p, g)), d(m);
|
|
3262
3265
|
}
|
|
3263
3266
|
}
|
|
3264
3267
|
}
|
|
3265
3268
|
}
|
|
3266
3269
|
return [o, u];
|
|
3267
3270
|
}
|
|
3268
|
-
function
|
|
3269
|
-
const r = (Array.isArray(e) ? e : [e]).flatMap((c) =>
|
|
3271
|
+
function Xo(t, e) {
|
|
3272
|
+
const r = (Array.isArray(e) ? e : [e]).flatMap((c) => jo(c)), [i, s] = Zo(t, r), o = Object.assign(Object.assign({}, t), { attrs: i }), u = r.flatMap((c) => Vo(o, c));
|
|
3270
3273
|
return [...s, ...u];
|
|
3271
3274
|
}
|
|
3272
|
-
var
|
|
3275
|
+
var Xn = function(t, e, n, r) {
|
|
3273
3276
|
function i(s) {
|
|
3274
3277
|
return s instanceof n ? s : new n(function(o) {
|
|
3275
3278
|
o(s);
|
|
@@ -3296,7 +3299,7 @@ var Jn = function(t, e, n, r) {
|
|
|
3296
3299
|
d((r = r.apply(t, e || [])).next());
|
|
3297
3300
|
});
|
|
3298
3301
|
};
|
|
3299
|
-
class
|
|
3302
|
+
class Jr {
|
|
3300
3303
|
constructor(e) {
|
|
3301
3304
|
this.dbName = e, this._storeName = "kv", this._dbPromise = this._init();
|
|
3302
3305
|
}
|
|
@@ -3314,7 +3317,7 @@ class Gr {
|
|
|
3314
3317
|
});
|
|
3315
3318
|
}
|
|
3316
3319
|
getItem(e) {
|
|
3317
|
-
return
|
|
3320
|
+
return Xn(this, void 0, void 0, function* () {
|
|
3318
3321
|
const n = yield this._dbPromise;
|
|
3319
3322
|
return new Promise((r, i) => {
|
|
3320
3323
|
const u = n.transaction([this._storeName], "readonly").objectStore(this._storeName).get(e);
|
|
@@ -3327,7 +3330,7 @@ class Gr {
|
|
|
3327
3330
|
});
|
|
3328
3331
|
}
|
|
3329
3332
|
setItem(e, n) {
|
|
3330
|
-
return
|
|
3333
|
+
return Xn(this, void 0, void 0, function* () {
|
|
3331
3334
|
const r = yield this._dbPromise;
|
|
3332
3335
|
return new Promise((i, s) => {
|
|
3333
3336
|
const c = r.transaction([this._storeName], "readwrite").objectStore(this._storeName).put(n, e);
|
|
@@ -3340,7 +3343,7 @@ class Gr {
|
|
|
3340
3343
|
});
|
|
3341
3344
|
}
|
|
3342
3345
|
}
|
|
3343
|
-
var
|
|
3346
|
+
var eu = function(t, e, n, r) {
|
|
3344
3347
|
function i(s) {
|
|
3345
3348
|
return s instanceof n ? s : new n(function(o) {
|
|
3346
3349
|
o(s);
|
|
@@ -3367,9 +3370,9 @@ var Jo = function(t, e, n, r) {
|
|
|
3367
3370
|
d((r = r.apply(t, e || [])).next());
|
|
3368
3371
|
});
|
|
3369
3372
|
};
|
|
3370
|
-
class
|
|
3373
|
+
class Zr {
|
|
3371
3374
|
static getIsOnline() {
|
|
3372
|
-
return
|
|
3375
|
+
return eu(this, void 0, void 0, function* () {
|
|
3373
3376
|
return navigator.onLine;
|
|
3374
3377
|
});
|
|
3375
3378
|
}
|
|
@@ -3394,7 +3397,7 @@ class Ee extends Error {
|
|
|
3394
3397
|
return "InstantError";
|
|
3395
3398
|
}
|
|
3396
3399
|
}
|
|
3397
|
-
var
|
|
3400
|
+
var tu = function(t, e, n, r) {
|
|
3398
3401
|
function i(s) {
|
|
3399
3402
|
return s instanceof n ? s : new n(function(o) {
|
|
3400
3403
|
o(s);
|
|
@@ -3421,25 +3424,25 @@ var Zo = function(t, e, n, r) {
|
|
|
3421
3424
|
d((r = r.apply(t, e || [])).next());
|
|
3422
3425
|
});
|
|
3423
3426
|
};
|
|
3424
|
-
class
|
|
3427
|
+
class ft extends Ee {
|
|
3425
3428
|
constructor(e) {
|
|
3426
3429
|
var n;
|
|
3427
3430
|
const r = ((n = e.body) === null || n === void 0 ? void 0 : n.message) || `API Error (${e.status})`;
|
|
3428
3431
|
super(r, e.body.hint);
|
|
3429
3432
|
const i = new.target.prototype;
|
|
3430
|
-
Object.setPrototypeOf && Object.setPrototypeOf(this, i), Error.captureStackTrace && Error.captureStackTrace(this,
|
|
3433
|
+
Object.setPrototypeOf && Object.setPrototypeOf(this, i), Error.captureStackTrace && Error.captureStackTrace(this, ft), this.name = "InstantAPIError", this.status = e.status, this.body = e.body;
|
|
3431
3434
|
}
|
|
3432
3435
|
get [Symbol.toStringTag]() {
|
|
3433
3436
|
return "InstantAPIError";
|
|
3434
3437
|
}
|
|
3435
3438
|
}
|
|
3436
3439
|
function te(t, e) {
|
|
3437
|
-
return
|
|
3440
|
+
return tu(this, void 0, void 0, function* () {
|
|
3438
3441
|
const n = yield fetch(t, e), r = yield n.json();
|
|
3439
|
-
return n.status === 200 ? Promise.resolve(r) : Promise.reject(new
|
|
3442
|
+
return n.status === 200 ? Promise.resolve(r) : Promise.reject(new ft({ status: n.status, body: r }));
|
|
3440
3443
|
});
|
|
3441
3444
|
}
|
|
3442
|
-
var
|
|
3445
|
+
var je = function(t, e, n, r) {
|
|
3443
3446
|
function i(s) {
|
|
3444
3447
|
return s instanceof n ? s : new n(function(o) {
|
|
3445
3448
|
o(s);
|
|
@@ -3466,15 +3469,15 @@ var Ce = function(t, e, n, r) {
|
|
|
3466
3469
|
d((r = r.apply(t, e || [])).next());
|
|
3467
3470
|
});
|
|
3468
3471
|
};
|
|
3469
|
-
function
|
|
3472
|
+
function nu({ apiURI: t, appId: e, email: n }) {
|
|
3470
3473
|
return te(`${t}/runtime/auth/send_magic_code`, {
|
|
3471
3474
|
method: "POST",
|
|
3472
3475
|
headers: { "content-type": "application/json" },
|
|
3473
3476
|
body: JSON.stringify({ "app-id": e, email: n })
|
|
3474
3477
|
});
|
|
3475
3478
|
}
|
|
3476
|
-
function
|
|
3477
|
-
return
|
|
3479
|
+
function ru(t) {
|
|
3480
|
+
return je(this, arguments, void 0, function* ({ apiURI: e, appId: n, email: r, code: i, refreshToken: s }) {
|
|
3478
3481
|
return yield te(`${e}/runtime/auth/verify_magic_code`, {
|
|
3479
3482
|
method: "POST",
|
|
3480
3483
|
headers: { "content-type": "application/json" },
|
|
@@ -3486,8 +3489,8 @@ function eu(t) {
|
|
|
3486
3489
|
});
|
|
3487
3490
|
});
|
|
3488
3491
|
}
|
|
3489
|
-
function
|
|
3490
|
-
return
|
|
3492
|
+
function iu(t) {
|
|
3493
|
+
return je(this, arguments, void 0, function* ({ apiURI: e, appId: n, refreshToken: r }) {
|
|
3491
3494
|
return yield te(`${e}/runtime/auth/verify_refresh_token`, {
|
|
3492
3495
|
method: "POST",
|
|
3493
3496
|
headers: { "content-type": "application/json" },
|
|
@@ -3498,8 +3501,8 @@ function tu(t) {
|
|
|
3498
3501
|
});
|
|
3499
3502
|
});
|
|
3500
3503
|
}
|
|
3501
|
-
function
|
|
3502
|
-
return
|
|
3504
|
+
function su(t) {
|
|
3505
|
+
return je(this, arguments, void 0, function* ({ apiURI: e, appId: n }) {
|
|
3503
3506
|
return yield te(`${e}/runtime/auth/sign_in_guest`, {
|
|
3504
3507
|
method: "POST",
|
|
3505
3508
|
headers: { "content-type": "application/json" },
|
|
@@ -3509,8 +3512,8 @@ function nu(t) {
|
|
|
3509
3512
|
});
|
|
3510
3513
|
});
|
|
3511
3514
|
}
|
|
3512
|
-
function
|
|
3513
|
-
return
|
|
3515
|
+
function er(t) {
|
|
3516
|
+
return je(this, arguments, void 0, function* ({ apiURI: e, appId: n, code: r, codeVerifier: i, refreshToken: s }) {
|
|
3514
3517
|
return yield te(`${e}/runtime/oauth/token`, {
|
|
3515
3518
|
method: "POST",
|
|
3516
3519
|
headers: { "content-type": "application/json" },
|
|
@@ -3523,8 +3526,8 @@ function Zn(t) {
|
|
|
3523
3526
|
});
|
|
3524
3527
|
});
|
|
3525
3528
|
}
|
|
3526
|
-
function
|
|
3527
|
-
return
|
|
3529
|
+
function ou(t) {
|
|
3530
|
+
return je(this, arguments, void 0, function* ({ apiURI: e, appId: n, nonce: r, idToken: i, clientName: s, refreshToken: o }) {
|
|
3528
3531
|
return yield te(`${e}/runtime/oauth/id_token`, {
|
|
3529
3532
|
method: "POST",
|
|
3530
3533
|
headers: { "content-type": "application/json" },
|
|
@@ -3538,8 +3541,8 @@ function ru(t) {
|
|
|
3538
3541
|
});
|
|
3539
3542
|
});
|
|
3540
3543
|
}
|
|
3541
|
-
function
|
|
3542
|
-
return
|
|
3544
|
+
function uu(t) {
|
|
3545
|
+
return je(this, arguments, void 0, function* ({ apiURI: e, appId: n, refreshToken: r }) {
|
|
3543
3546
|
return yield te(`${e}/runtime/signout`, {
|
|
3544
3547
|
method: "POST",
|
|
3545
3548
|
headers: {
|
|
@@ -3552,7 +3555,7 @@ function iu(t) {
|
|
|
3552
3555
|
});
|
|
3553
3556
|
});
|
|
3554
3557
|
}
|
|
3555
|
-
var
|
|
3558
|
+
var We = function(t, e, n, r) {
|
|
3556
3559
|
function i(s) {
|
|
3557
3560
|
return s instanceof n ? s : new n(function(o) {
|
|
3558
3561
|
o(s);
|
|
@@ -3579,8 +3582,8 @@ var qe = function(t, e, n, r) {
|
|
|
3579
3582
|
d((r = r.apply(t, e || [])).next());
|
|
3580
3583
|
});
|
|
3581
3584
|
};
|
|
3582
|
-
function
|
|
3583
|
-
return
|
|
3585
|
+
function au(t) {
|
|
3586
|
+
return We(this, arguments, void 0, function* ({ apiURI: e, appId: n, path: r, file: i, refreshToken: s, contentType: o, contentDisposition: u }) {
|
|
3584
3587
|
const c = {
|
|
3585
3588
|
app_id: n,
|
|
3586
3589
|
path: r,
|
|
@@ -3594,8 +3597,8 @@ function su(t) {
|
|
|
3594
3597
|
});
|
|
3595
3598
|
});
|
|
3596
3599
|
}
|
|
3597
|
-
function
|
|
3598
|
-
return
|
|
3600
|
+
function cu(t) {
|
|
3601
|
+
return We(this, arguments, void 0, function* ({ apiURI: e, appId: n, path: r, refreshToken: i }) {
|
|
3599
3602
|
const { data: s } = yield te(`${e}/storage/files?app_id=${n}&filename=${encodeURIComponent(r)}`, {
|
|
3600
3603
|
method: "DELETE",
|
|
3601
3604
|
headers: {
|
|
@@ -3606,8 +3609,8 @@ function ou(t) {
|
|
|
3606
3609
|
return s;
|
|
3607
3610
|
});
|
|
3608
3611
|
}
|
|
3609
|
-
function
|
|
3610
|
-
return
|
|
3612
|
+
function du(t) {
|
|
3613
|
+
return We(this, arguments, void 0, function* ({ apiURI: e, appId: n, fileName: r, refreshToken: i, metadata: s = {} }) {
|
|
3611
3614
|
const { data: o } = yield te(`${e}/storage/signed-upload-url`, {
|
|
3612
3615
|
method: "POST",
|
|
3613
3616
|
headers: {
|
|
@@ -3622,8 +3625,8 @@ function uu(t) {
|
|
|
3622
3625
|
return o;
|
|
3623
3626
|
});
|
|
3624
3627
|
}
|
|
3625
|
-
function
|
|
3626
|
-
return
|
|
3628
|
+
function fu(t, e) {
|
|
3629
|
+
return We(this, void 0, void 0, function* () {
|
|
3627
3630
|
return (yield fetch(t, {
|
|
3628
3631
|
method: "PUT",
|
|
3629
3632
|
body: e,
|
|
@@ -3633,8 +3636,8 @@ function au(t, e) {
|
|
|
3633
3636
|
})).ok;
|
|
3634
3637
|
});
|
|
3635
3638
|
}
|
|
3636
|
-
function
|
|
3637
|
-
return
|
|
3639
|
+
function lu(t) {
|
|
3640
|
+
return We(this, arguments, void 0, function* ({ apiURI: e, appId: n, path: r, refreshToken: i }) {
|
|
3638
3641
|
const { data: s } = yield te(`${e}/storage/signed-download-url?app_id=${n}&filename=${encodeURIComponent(r)}`, {
|
|
3639
3642
|
method: "GET",
|
|
3640
3643
|
headers: {
|
|
@@ -3645,9 +3648,9 @@ function cu(t) {
|
|
|
3645
3648
|
return s;
|
|
3646
3649
|
});
|
|
3647
3650
|
}
|
|
3648
|
-
let
|
|
3649
|
-
typeof window < "u" && typeof window.localStorage < "u" && (
|
|
3650
|
-
function
|
|
3651
|
+
let ln = !1, Xr = !1, ei = !1;
|
|
3652
|
+
typeof window < "u" && typeof window.localStorage < "u" && (ln = !!window.localStorage.getItem("devBackend"), Xr = !!window.localStorage.getItem("__instantLogging"), ei = !!window.localStorage.getItem("__devtoolLocalDash"));
|
|
3653
|
+
function tr(t, e) {
|
|
3651
3654
|
if (!e)
|
|
3652
3655
|
return t;
|
|
3653
3656
|
const n = {};
|
|
@@ -3655,33 +3658,33 @@ function Xn(t, e) {
|
|
|
3655
3658
|
n[r] = t[r];
|
|
3656
3659
|
}), n;
|
|
3657
3660
|
}
|
|
3658
|
-
function
|
|
3661
|
+
function hu(t, e, n) {
|
|
3659
3662
|
var r, i;
|
|
3660
3663
|
const s = {
|
|
3661
3664
|
peers: {}
|
|
3662
3665
|
};
|
|
3663
3666
|
if (e && "user" in e ? e.user : !0) {
|
|
3664
|
-
const u =
|
|
3667
|
+
const u = tr((r = t.user) !== null && r !== void 0 ? r : {}, e == null ? void 0 : e.keys);
|
|
3665
3668
|
s.user = Object.assign(Object.assign({}, u), { peerId: n });
|
|
3666
3669
|
}
|
|
3667
3670
|
for (const u of Object.keys((i = t.peers) !== null && i !== void 0 ? i : {})) {
|
|
3668
3671
|
const c = (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));
|
|
3669
3672
|
if (c || d) {
|
|
3670
|
-
const a =
|
|
3673
|
+
const a = tr(t.peers[u], e == null ? void 0 : e.keys);
|
|
3671
3674
|
s.peers[u] = Object.assign(Object.assign({}, a), { peerId: u });
|
|
3672
3675
|
}
|
|
3673
3676
|
}
|
|
3674
3677
|
return s;
|
|
3675
3678
|
}
|
|
3676
|
-
function
|
|
3677
|
-
if (t.isLoading !== e.isLoading || t.error !== e.error || (t.user || e.user) && (!t.user || !e.user || !
|
|
3679
|
+
function pu(t, e) {
|
|
3680
|
+
if (t.isLoading !== e.isLoading || t.error !== e.error || (t.user || e.user) && (!t.user || !e.user || !qn(t.user, e.user)) || !jr(t.peers, e.peers))
|
|
3678
3681
|
return !0;
|
|
3679
3682
|
for (const r of Object.keys(t.peers))
|
|
3680
|
-
if (!
|
|
3683
|
+
if (!qn(t.peers[r], e.peers[r]))
|
|
3681
3684
|
return !0;
|
|
3682
3685
|
return !1;
|
|
3683
3686
|
}
|
|
3684
|
-
class
|
|
3687
|
+
class nr {
|
|
3685
3688
|
constructor() {
|
|
3686
3689
|
this.promise = new Promise((e, n) => {
|
|
3687
3690
|
this._resolve = e, this._reject = n;
|
|
@@ -3694,7 +3697,7 @@ class er {
|
|
|
3694
3697
|
this._reject(e);
|
|
3695
3698
|
}
|
|
3696
3699
|
}
|
|
3697
|
-
var
|
|
3700
|
+
var $e = function(t, e, n, r) {
|
|
3698
3701
|
function i(s) {
|
|
3699
3702
|
return s instanceof n ? s : new n(function(o) {
|
|
3700
3703
|
o(s);
|
|
@@ -3721,15 +3724,15 @@ var Re = function(t, e, n, r) {
|
|
|
3721
3724
|
d((r = r.apply(t, e || [])).next());
|
|
3722
3725
|
});
|
|
3723
3726
|
};
|
|
3724
|
-
function
|
|
3727
|
+
function yu(t, e) {
|
|
3725
3728
|
typeof requestIdleCallback > "u" ? t() : requestIdleCallback(t, { timeout: e });
|
|
3726
3729
|
}
|
|
3727
|
-
class
|
|
3730
|
+
class Ht {
|
|
3728
3731
|
constructor(e, n, r, i, s = (d) => d, o = (d) => d, u = 100, c = 1e3) {
|
|
3729
3732
|
this._subs = [], this._nextSave = null, this._persister = e, this._key = n, this._onMerge = i, this._loadedCbs = [], this._isLoading = !0, this.currentValue = r, this.serialize = s, this.parse = o, this._saveThrottleMs = u, this._pendingSaveCbs = [], this._version = 0, this._idleCallbackMaxWaitMs = c, this._load();
|
|
3730
3733
|
}
|
|
3731
3734
|
_getFromStorage() {
|
|
3732
|
-
return
|
|
3735
|
+
return $e(this, void 0, void 0, function* () {
|
|
3733
3736
|
try {
|
|
3734
3737
|
return this.parse(yield this._persister.getItem(this._key));
|
|
3735
3738
|
} catch (e) {
|
|
@@ -3738,7 +3741,7 @@ class Qt {
|
|
|
3738
3741
|
});
|
|
3739
3742
|
}
|
|
3740
3743
|
_load() {
|
|
3741
|
-
return
|
|
3744
|
+
return $e(this, void 0, void 0, function* () {
|
|
3742
3745
|
const e = yield this._getFromStorage();
|
|
3743
3746
|
this._isLoading = !1;
|
|
3744
3747
|
const n = this._onMerge(e, this.currentValue);
|
|
@@ -3748,7 +3751,7 @@ class Qt {
|
|
|
3748
3751
|
});
|
|
3749
3752
|
}
|
|
3750
3753
|
waitForLoaded() {
|
|
3751
|
-
return
|
|
3754
|
+
return $e(this, void 0, void 0, function* () {
|
|
3752
3755
|
if (!this._isLoading)
|
|
3753
3756
|
return;
|
|
3754
3757
|
yield new Promise((n) => {
|
|
@@ -3763,7 +3766,7 @@ class Qt {
|
|
|
3763
3766
|
return this._version;
|
|
3764
3767
|
}
|
|
3765
3768
|
waitForSync() {
|
|
3766
|
-
return
|
|
3769
|
+
return $e(this, void 0, void 0, function* () {
|
|
3767
3770
|
if (!this._nextSave)
|
|
3768
3771
|
return;
|
|
3769
3772
|
yield new Promise((n) => {
|
|
@@ -3778,7 +3781,7 @@ class Qt {
|
|
|
3778
3781
|
this._pendingSaveCbs.length = 0;
|
|
3779
3782
|
}
|
|
3780
3783
|
flush() {
|
|
3781
|
-
return
|
|
3784
|
+
return $e(this, void 0, void 0, function* () {
|
|
3782
3785
|
this._nextSave && (clearTimeout(this._nextSave), this._writeToStorage());
|
|
3783
3786
|
});
|
|
3784
3787
|
}
|
|
@@ -3788,7 +3791,7 @@ class Qt {
|
|
|
3788
3791
|
return;
|
|
3789
3792
|
}
|
|
3790
3793
|
this._nextSave = setTimeout(() => {
|
|
3791
|
-
|
|
3794
|
+
yu(() => {
|
|
3792
3795
|
this._nextSave = null, this._writeToStorage();
|
|
3793
3796
|
}, this._idleCallbackMaxWaitMs);
|
|
3794
3797
|
}, this._saveThrottleMs);
|
|
@@ -3805,20 +3808,20 @@ class Qt {
|
|
|
3805
3808
|
};
|
|
3806
3809
|
}
|
|
3807
3810
|
}
|
|
3808
|
-
function
|
|
3811
|
+
function ti(t, e = []) {
|
|
3809
3812
|
t.forEach((n) => {
|
|
3810
3813
|
const { data: r } = n, { "datalog-result": i } = r, { "join-rows": s } = i;
|
|
3811
3814
|
for (const o of s)
|
|
3812
3815
|
for (const u of o)
|
|
3813
3816
|
e.push(u);
|
|
3814
|
-
|
|
3817
|
+
ti(n["child-nodes"], e);
|
|
3815
3818
|
});
|
|
3816
3819
|
}
|
|
3817
|
-
function
|
|
3820
|
+
function rr(t) {
|
|
3818
3821
|
const e = [];
|
|
3819
|
-
return
|
|
3822
|
+
return ti(t, e), e;
|
|
3820
3823
|
}
|
|
3821
|
-
function
|
|
3824
|
+
function ir(t) {
|
|
3822
3825
|
return Object.values(t.links).reduce((e, n) => {
|
|
3823
3826
|
var r, i, s, o;
|
|
3824
3827
|
return (r = e[s = n.forward.on]) !== null && r !== void 0 || (e[s] = {}), e[n.forward.on][n.forward.label] = {
|
|
@@ -3832,8 +3835,8 @@ function nr(t) {
|
|
|
3832
3835
|
}, e;
|
|
3833
3836
|
}, {});
|
|
3834
3837
|
}
|
|
3835
|
-
const
|
|
3836
|
-
function
|
|
3838
|
+
const ni = "v0.22.47-experimental.sync-table.19184737115.1";
|
|
3839
|
+
function bu(t, e) {
|
|
3837
3840
|
return {
|
|
3838
3841
|
info: t ? (...n) => console.info(...n, e()) : () => {
|
|
3839
3842
|
},
|
|
@@ -3871,7 +3874,7 @@ class I extends Error {
|
|
|
3871
3874
|
super(r), this.name = "QueryValidationError";
|
|
3872
3875
|
}
|
|
3873
3876
|
}
|
|
3874
|
-
const
|
|
3877
|
+
const sr = [
|
|
3875
3878
|
"where",
|
|
3876
3879
|
"order",
|
|
3877
3880
|
"limit",
|
|
@@ -3882,7 +3885,7 @@ const rr = [
|
|
|
3882
3885
|
"before",
|
|
3883
3886
|
"fields",
|
|
3884
3887
|
"aggregate"
|
|
3885
|
-
],
|
|
3888
|
+
], _u = (t) => t.valueType || "unknown", ri = (t, e, n = !1) => {
|
|
3886
3889
|
if (n || t == null)
|
|
3887
3890
|
return !0;
|
|
3888
3891
|
switch (e) {
|
|
@@ -3897,9 +3900,9 @@ const rr = [
|
|
|
3897
3900
|
default:
|
|
3898
3901
|
return !0;
|
|
3899
3902
|
}
|
|
3900
|
-
},
|
|
3903
|
+
}, gu = (t, e, n, r, i, s, o) => {
|
|
3901
3904
|
const u = s.valueType === "json", c = (d, a, f) => {
|
|
3902
|
-
if (!
|
|
3905
|
+
if (!ri(f, a, u))
|
|
3903
3906
|
throw new I(`Invalid value for operator '${d}' on attribute '${r}' in entity '${i}'. Expected ${a}, but received: ${typeof f}`, o);
|
|
3904
3907
|
};
|
|
3905
3908
|
switch (t) {
|
|
@@ -3929,17 +3932,17 @@ const rr = [
|
|
|
3929
3932
|
default:
|
|
3930
3933
|
throw new I(`Unknown operator '${t}' for attribute '${r}' in entity '${i}'`, o);
|
|
3931
3934
|
}
|
|
3932
|
-
},
|
|
3933
|
-
const s =
|
|
3935
|
+
}, me = (t, e, n, r, i) => {
|
|
3936
|
+
const s = _u(n), o = n.valueType === "json";
|
|
3934
3937
|
if (typeof t == "object" && t !== null && !Array.isArray(t)) {
|
|
3935
3938
|
if (o)
|
|
3936
3939
|
return;
|
|
3937
3940
|
const c = t;
|
|
3938
3941
|
for (const [d, a] of Object.entries(c))
|
|
3939
|
-
|
|
3940
|
-
} else if (!
|
|
3942
|
+
gu(d, a, s, e, r, n, `${i}.${d}`);
|
|
3943
|
+
} else if (!ri(t, s, o))
|
|
3941
3944
|
throw new I(`Invalid value for attribute '${e}' in entity '${r}'. Expected ${s}, but received: ${typeof t}`, i);
|
|
3942
|
-
},
|
|
3945
|
+
}, Tu = (t, e, n, r, i) => {
|
|
3943
3946
|
const s = t.split(".");
|
|
3944
3947
|
if (s.length < 2)
|
|
3945
3948
|
throw new I(`Invalid dot notation path '${t}'. Must contain at least one dot.`, i);
|
|
@@ -3961,35 +3964,35 @@ const rr = [
|
|
|
3961
3964
|
if (u === "id") {
|
|
3962
3965
|
if (typeof e == "string" && !ve(e))
|
|
3963
3966
|
throw new I(`Invalid value for id field in entity '${o}'. Expected a UUID, but received: ${e}`, i);
|
|
3964
|
-
|
|
3967
|
+
me(e, t, new se("string", !1, !0), n, i);
|
|
3965
3968
|
return;
|
|
3966
3969
|
}
|
|
3967
3970
|
const d = c.attrs[u];
|
|
3968
3971
|
if (Object.keys(c.links).includes(u)) {
|
|
3969
3972
|
if (typeof e == "string" && !ve(e))
|
|
3970
3973
|
throw new I(`Invalid value for link '${u}' in entity '${o}'. Expected a UUID, but received: ${e}`, i);
|
|
3971
|
-
|
|
3974
|
+
me(e, t, new se("string", !1, !0), n, i);
|
|
3972
3975
|
return;
|
|
3973
3976
|
}
|
|
3974
3977
|
if (!d) {
|
|
3975
3978
|
const a = Object.keys(c.attrs);
|
|
3976
3979
|
throw new I(`Attribute '${u}' does not exist on entity '${o}' in dot notation path '${t}'. Available attributes: ${a.length > 0 ? a.join(", ") + ", id" : "id"}`, i);
|
|
3977
3980
|
}
|
|
3978
|
-
|
|
3979
|
-
},
|
|
3981
|
+
me(e, t, d, n, i);
|
|
3982
|
+
}, ii = (t, e, n, r) => {
|
|
3980
3983
|
for (const [i, s] of Object.entries(t)) {
|
|
3981
3984
|
if (i === "or" || i === "and") {
|
|
3982
3985
|
if (Array.isArray(s))
|
|
3983
3986
|
for (const d of s)
|
|
3984
|
-
typeof d == "object" && d !== null &&
|
|
3987
|
+
typeof d == "object" && d !== null && ii(d, e, n, `${r}.${i}[${d}]`);
|
|
3985
3988
|
continue;
|
|
3986
3989
|
}
|
|
3987
3990
|
if (i === "id") {
|
|
3988
|
-
|
|
3991
|
+
me(s, "id", new se("string", !1, !0), e, `${r}.id`);
|
|
3989
3992
|
continue;
|
|
3990
3993
|
}
|
|
3991
3994
|
if (i.includes(".")) {
|
|
3992
|
-
|
|
3995
|
+
Tu(i, s, e, n, `${r}.${i}`);
|
|
3993
3996
|
continue;
|
|
3994
3997
|
}
|
|
3995
3998
|
const o = n.entities[e];
|
|
@@ -4001,18 +4004,18 @@ const rr = [
|
|
|
4001
4004
|
throw new I(`Attribute or link '${i}' does not exist on entity '${e}'. Available attributes: ${d.length > 0 ? d.join(", ") : "none"}. Available links: ${a.length > 0 ? a.join(", ") : "none"}`, `${r}.${i}`);
|
|
4002
4005
|
}
|
|
4003
4006
|
if (u)
|
|
4004
|
-
|
|
4007
|
+
me(s, i, u, e, `${r}.${i}`);
|
|
4005
4008
|
else if (c) {
|
|
4006
4009
|
if (typeof s == "string" && !ve(s))
|
|
4007
4010
|
throw new I(`Invalid value for link '${i}' in entity '${e}'. Expected a UUID, but received: ${s}`, `${r}.${i}`);
|
|
4008
4011
|
const d = new se("string", !1, !0);
|
|
4009
|
-
|
|
4012
|
+
me(s, i, d, e, `${r}.${i}`);
|
|
4010
4013
|
}
|
|
4011
4014
|
}
|
|
4012
|
-
},
|
|
4015
|
+
}, wu = (t, e, n, r, i = 0) => {
|
|
4013
4016
|
for (const o of Object.keys(t))
|
|
4014
|
-
if (!
|
|
4015
|
-
throw new I(`Invalid query parameter '${o}' in $ object. Valid parameters are: ${
|
|
4017
|
+
if (!sr.includes(o))
|
|
4018
|
+
throw new I(`Invalid query parameter '${o}' in $ object. Valid parameters are: ${sr.join(", ")}. Found: ${o}`, r);
|
|
4016
4019
|
const s = [
|
|
4017
4020
|
// 'limit', // only supported client side
|
|
4018
4021
|
"offset",
|
|
@@ -4027,9 +4030,9 @@ const rr = [
|
|
|
4027
4030
|
if (t.where && n) {
|
|
4028
4031
|
if (typeof t.where != "object" || t.where === null)
|
|
4029
4032
|
throw new I(`'where' clause must be an object in entity '${e}', but received: ${typeof t.where}`, r ? `${r}.where` : void 0);
|
|
4030
|
-
|
|
4033
|
+
ii(t.where, e, n, r ? `${r}.where` : "where");
|
|
4031
4034
|
}
|
|
4032
|
-
},
|
|
4035
|
+
}, si = (t, e, n, r, i = 0) => {
|
|
4033
4036
|
var s;
|
|
4034
4037
|
if (!t || typeof t != "object")
|
|
4035
4038
|
throw new I(`Query part for entity '${e}' must be an object, but received: ${typeof t}`, r);
|
|
@@ -4042,15 +4045,15 @@ const rr = [
|
|
|
4042
4045
|
const u = t[o];
|
|
4043
4046
|
if (typeof u == "object" && u !== null) {
|
|
4044
4047
|
const c = (s = n == null ? void 0 : n.entities[e].links[o]) === null || s === void 0 ? void 0 : s.entityName;
|
|
4045
|
-
c &&
|
|
4048
|
+
c && si(u, c, n, `${r}.${o}`, i + 1);
|
|
4046
4049
|
}
|
|
4047
4050
|
} else {
|
|
4048
4051
|
const u = t[o];
|
|
4049
4052
|
if (typeof u != "object" || u === null)
|
|
4050
4053
|
throw new I(`Query parameter '$' must be an object in entity '${e}', but received: ${typeof u}`, `${r}.$`);
|
|
4051
|
-
|
|
4054
|
+
wu(u, e, n, `${r}.$`, i);
|
|
4052
4055
|
}
|
|
4053
|
-
},
|
|
4056
|
+
}, or = (t, e) => {
|
|
4054
4057
|
if (typeof t != "object" || t === null)
|
|
4055
4058
|
throw new I(`Query must be an object, but received: ${typeof t}${t === null ? " (null)" : ""}`);
|
|
4056
4059
|
if (Array.isArray(t))
|
|
@@ -4066,67 +4069,67 @@ const rr = [
|
|
|
4066
4069
|
const i = Object.keys(e.entities);
|
|
4067
4070
|
throw new I(`Entity '${r}' does not exist in schema. Available entities: ${i.length > 0 ? i.join(", ") : "none"}`, r);
|
|
4068
4071
|
}
|
|
4069
|
-
|
|
4072
|
+
si(n[r], r, e, r, 0);
|
|
4070
4073
|
}
|
|
4071
4074
|
}
|
|
4072
|
-
},
|
|
4075
|
+
}, ur = (t) => typeof t != "string" ? !1 : at(t) ? !0 : ve(t);
|
|
4073
4076
|
class Z extends Error {
|
|
4074
4077
|
constructor(e) {
|
|
4075
4078
|
super(e), this.name = "TransactionValidationError";
|
|
4076
4079
|
}
|
|
4077
4080
|
}
|
|
4078
|
-
const
|
|
4081
|
+
const oi = (t) => t.length > 0 ? t.join(", ") : "none", Su = (t, e) => new Z(`Entity '${t}' does not exist in schema. Available entities: ${oi(e)}`), ar = {
|
|
4079
4082
|
string: (t) => typeof t == "string",
|
|
4080
4083
|
number: (t) => typeof t == "number" && !isNaN(t),
|
|
4081
4084
|
boolean: (t) => typeof t == "boolean",
|
|
4082
4085
|
date: (t) => t instanceof Date || typeof t == "string" || typeof t == "number",
|
|
4083
4086
|
json: () => !0
|
|
4084
|
-
},
|
|
4087
|
+
}, mu = (t, e) => {
|
|
4085
4088
|
var n, r;
|
|
4086
|
-
return t == null ? !0 : (r = (n =
|
|
4087
|
-
},
|
|
4089
|
+
return t == null ? !0 : (r = (n = ar[e.valueType]) === null || n === void 0 ? void 0 : n.call(ar, t)) !== null && r !== void 0 ? r : !1;
|
|
4090
|
+
}, ui = (t, e) => {
|
|
4088
4091
|
const n = e.entities[t];
|
|
4089
4092
|
if (!n)
|
|
4090
|
-
throw
|
|
4093
|
+
throw Su(t, Object.keys(e.entities));
|
|
4091
4094
|
return n;
|
|
4092
|
-
},
|
|
4093
|
-
const r =
|
|
4095
|
+
}, Ot = (t, e, n) => {
|
|
4096
|
+
const r = ui(t, n);
|
|
4094
4097
|
if (typeof e != "object" || e === null)
|
|
4095
4098
|
throw new Z(`Arguments for data operation on entity '${t}' must be an object, but received: ${typeof e}`);
|
|
4096
4099
|
for (const [i, s] of Object.entries(e)) {
|
|
4097
4100
|
if (i === "id")
|
|
4098
4101
|
continue;
|
|
4099
4102
|
const o = r.attrs[i];
|
|
4100
|
-
if (o && !
|
|
4103
|
+
if (o && !mu(s, o))
|
|
4101
4104
|
throw new Z(`Invalid value for attribute '${i}' in entity '${t}'. Expected ${o.valueType}, but received: ${typeof s}`);
|
|
4102
4105
|
}
|
|
4103
|
-
},
|
|
4104
|
-
const r =
|
|
4106
|
+
}, cr = (t, e, n) => {
|
|
4107
|
+
const r = ui(t, n);
|
|
4105
4108
|
if (typeof e != "object" || e === null)
|
|
4106
4109
|
throw new Z(`Arguments for link operation on entity '${t}' must be an object, but received: ${typeof e}`);
|
|
4107
4110
|
for (const [i, s] of Object.entries(e)) {
|
|
4108
4111
|
if (!r.links[i]) {
|
|
4109
4112
|
const u = Object.keys(r.links);
|
|
4110
|
-
throw new Z(`Link '${i}' does not exist on entity '${t}'. Available links: ${
|
|
4113
|
+
throw new Z(`Link '${i}' does not exist on entity '${t}'. Available links: ${oi(u)}`);
|
|
4111
4114
|
}
|
|
4112
4115
|
if (s != null) {
|
|
4113
4116
|
if (Array.isArray(s)) {
|
|
4114
4117
|
for (const u of s)
|
|
4115
|
-
if (!
|
|
4118
|
+
if (!ur(u))
|
|
4116
4119
|
throw new Z(`Invalid entity ID in link '${i}' for entity '${t}'. Expected a UUID or a lookup, but received: ${u}`);
|
|
4117
|
-
} else if (!
|
|
4120
|
+
} else if (!ur(s))
|
|
4118
4121
|
throw new Z(`Invalid UUID in link '${i}' for entity '${t}'. Expected a UUID, but received: ${s}`);
|
|
4119
4122
|
}
|
|
4120
4123
|
}
|
|
4121
|
-
},
|
|
4122
|
-
create:
|
|
4123
|
-
update:
|
|
4124
|
-
merge:
|
|
4125
|
-
link:
|
|
4126
|
-
unlink:
|
|
4124
|
+
}, vu = {
|
|
4125
|
+
create: Ot,
|
|
4126
|
+
update: Ot,
|
|
4127
|
+
merge: Ot,
|
|
4128
|
+
link: cr,
|
|
4129
|
+
unlink: cr,
|
|
4127
4130
|
delete: () => {
|
|
4128
4131
|
}
|
|
4129
|
-
},
|
|
4132
|
+
}, Ou = (t, e) => {
|
|
4130
4133
|
if (!e)
|
|
4131
4134
|
return;
|
|
4132
4135
|
const [n, r, i, s] = t;
|
|
@@ -4134,9 +4137,9 @@ const ri = (t) => t.length > 0 ? t.join(", ") : "none", gu = (t, e) => new Z(`En
|
|
|
4134
4137
|
throw new Z(`Invalid id for entity '${r}'. Expected a UUID, but received: ${i}`);
|
|
4135
4138
|
if (typeof r != "string")
|
|
4136
4139
|
throw new Z(`Entity name must be a string, but received: ${typeof r}`);
|
|
4137
|
-
const o =
|
|
4140
|
+
const o = vu[n];
|
|
4138
4141
|
o && s !== void 0 && o(r, s, e);
|
|
4139
|
-
},
|
|
4142
|
+
}, Eu = (t, e) => {
|
|
4140
4143
|
const n = Array.isArray(t) ? t : [t];
|
|
4141
4144
|
for (const r of n) {
|
|
4142
4145
|
if (!r || typeof r != "object")
|
|
@@ -4146,11 +4149,11 @@ const ri = (t) => t.length > 0 ? t.join(", ") : "none", gu = (t, e) => new Z(`En
|
|
|
4146
4149
|
for (const i of r.__ops) {
|
|
4147
4150
|
if (!Array.isArray(i))
|
|
4148
4151
|
throw new Z(`Transaction operation must be an array, but received: ${typeof i}`);
|
|
4149
|
-
|
|
4152
|
+
Ou(i, e);
|
|
4150
4153
|
}
|
|
4151
4154
|
}
|
|
4152
4155
|
};
|
|
4153
|
-
var
|
|
4156
|
+
var dr = function(t, e, n, r) {
|
|
4154
4157
|
function i(s) {
|
|
4155
4158
|
return s instanceof n ? s : new n(function(o) {
|
|
4156
4159
|
o(s);
|
|
@@ -4177,10 +4180,10 @@ var ar = function(t, e, n, r) {
|
|
|
4177
4180
|
d((r = r.apply(t, e || [])).next());
|
|
4178
4181
|
});
|
|
4179
4182
|
};
|
|
4180
|
-
let
|
|
4181
|
-
class
|
|
4183
|
+
let ai = 0;
|
|
4184
|
+
class fr {
|
|
4182
4185
|
constructor(e) {
|
|
4183
|
-
this.type = "ws", this.id = `${this.type}_${
|
|
4186
|
+
this.type = "ws", this.id = `${this.type}_${ai++}`, this.conn = new WebSocket(e), this.conn.onopen = (n) => {
|
|
4184
4187
|
this.onopen && this.onopen({ target: this });
|
|
4185
4188
|
}, this.conn.onmessage = (n) => {
|
|
4186
4189
|
this.onmessage && this.onmessage({
|
|
@@ -4206,9 +4209,9 @@ class cr {
|
|
|
4206
4209
|
return this.conn.send(JSON.stringify(e));
|
|
4207
4210
|
}
|
|
4208
4211
|
}
|
|
4209
|
-
class
|
|
4212
|
+
class Au {
|
|
4210
4213
|
constructor(e, n) {
|
|
4211
|
-
this.type = "sse", this.initParams = null, this.sendQueue = [], this.closeFired = !1, this.sseInitTimeout = null, this.id = `${this.type}_${
|
|
4214
|
+
this.type = "sse", this.initParams = null, this.sendQueue = [], this.closeFired = !1, this.sseInitTimeout = null, this.id = `${this.type}_${ai++}`, this.url = n, this.ES = e, this.conn = new e(n), this.sseInitTimeout = setTimeout(() => {
|
|
4212
4215
|
this.initParams || this.handleError();
|
|
4213
4216
|
}, 1e4), this.conn.onmessage = (r) => {
|
|
4214
4217
|
const i = JSON.parse(r.data);
|
|
@@ -4240,7 +4243,7 @@ class vu {
|
|
|
4240
4243
|
this.conn.close(), this.onclose && !this.closeFired && (this.closeFired = !0, this.onclose({ target: this }));
|
|
4241
4244
|
}
|
|
4242
4245
|
postMessages(e) {
|
|
4243
|
-
return
|
|
4246
|
+
return dr(this, void 0, void 0, function* () {
|
|
4244
4247
|
try {
|
|
4245
4248
|
(yield fetch(this.url, {
|
|
4246
4249
|
method: "POST",
|
|
@@ -4258,7 +4261,7 @@ class vu {
|
|
|
4258
4261
|
});
|
|
4259
4262
|
}
|
|
4260
4263
|
flushQueue() {
|
|
4261
|
-
return
|
|
4264
|
+
return dr(this, void 0, void 0, function* () {
|
|
4262
4265
|
if (this.sendPromise || !this.sendQueue.length)
|
|
4263
4266
|
return;
|
|
4264
4267
|
const e = this.sendQueue;
|
|
@@ -4284,7 +4287,7 @@ class vu {
|
|
|
4284
4287
|
this.handleClose();
|
|
4285
4288
|
}
|
|
4286
4289
|
}
|
|
4287
|
-
var
|
|
4290
|
+
var lr = function(t, e, n, r) {
|
|
4288
4291
|
function i(s) {
|
|
4289
4292
|
return s instanceof n ? s : new n(function(o) {
|
|
4290
4293
|
o(s);
|
|
@@ -4311,29 +4314,29 @@ var dr = function(t, e, n, r) {
|
|
|
4311
4314
|
d((r = r.apply(t, e || [])).next());
|
|
4312
4315
|
});
|
|
4313
4316
|
};
|
|
4314
|
-
function
|
|
4317
|
+
function Cu(t, e) {
|
|
4315
4318
|
for (const n in t) {
|
|
4316
4319
|
const r = t[n];
|
|
4317
4320
|
for (const i of r.entities || [])
|
|
4318
|
-
i.store =
|
|
4321
|
+
i.store.useDateObjects = e, i.store = $r(i.store);
|
|
4319
4322
|
}
|
|
4320
4323
|
return t;
|
|
4321
4324
|
}
|
|
4322
|
-
function
|
|
4325
|
+
function ju(t) {
|
|
4323
4326
|
const e = {};
|
|
4324
4327
|
for (const n in t) {
|
|
4325
4328
|
const r = t[n];
|
|
4326
4329
|
if (r.entities) {
|
|
4327
4330
|
const i = [];
|
|
4328
4331
|
for (const s of r.entities)
|
|
4329
|
-
i.push({ store:
|
|
4332
|
+
i.push(Object.assign(Object.assign({}, s), { store: Rr(s.store) }));
|
|
4330
4333
|
e[n] = Object.assign(Object.assign({}, r), { entities: i });
|
|
4331
4334
|
} else
|
|
4332
4335
|
e[n] = r;
|
|
4333
4336
|
}
|
|
4334
4337
|
return e;
|
|
4335
4338
|
}
|
|
4336
|
-
function
|
|
4339
|
+
function ku(t, e) {
|
|
4337
4340
|
const n = {};
|
|
4338
4341
|
for (const [r, i] of Object.entries(e))
|
|
4339
4342
|
n[r] = i;
|
|
@@ -4342,22 +4345,29 @@ function Au(t, e) {
|
|
|
4342
4345
|
n[r] = i;
|
|
4343
4346
|
return n;
|
|
4344
4347
|
}
|
|
4345
|
-
function
|
|
4346
|
-
|
|
4347
|
-
|
|
4348
|
+
function Et(t, e) {
|
|
4349
|
+
return Qr({ store: e, pageInfo: null, aggregate: null }, t.query).data[t.table][0];
|
|
4350
|
+
}
|
|
4351
|
+
function hr(t, e, n) {
|
|
4352
|
+
var r;
|
|
4353
|
+
const i = (r = ce(e, t.table, "id")) === null || r === void 0 ? void 0 : r.id;
|
|
4354
|
+
if (!i)
|
|
4355
|
+
return -1;
|
|
4356
|
+
const s = Ce(e.eav, [n, i, n]);
|
|
4357
|
+
return s ? s[3] : -1;
|
|
4348
4358
|
}
|
|
4349
|
-
function
|
|
4359
|
+
function pr(t, e) {
|
|
4350
4360
|
for (const { action: n, triple: r } of e)
|
|
4351
4361
|
switch (n) {
|
|
4352
4362
|
case "added":
|
|
4353
|
-
|
|
4363
|
+
Ur(t, r);
|
|
4354
4364
|
break;
|
|
4355
4365
|
case "removed":
|
|
4356
|
-
|
|
4366
|
+
Dr(t, r);
|
|
4357
4367
|
break;
|
|
4358
4368
|
}
|
|
4359
4369
|
}
|
|
4360
|
-
function
|
|
4370
|
+
function Iu(t, e) {
|
|
4361
4371
|
var n, r, i, s;
|
|
4362
4372
|
const o = {};
|
|
4363
4373
|
for (const { action: u, triple: c } of e) {
|
|
@@ -4378,13 +4388,33 @@ function Cu(t, e) {
|
|
|
4378
4388
|
}
|
|
4379
4389
|
return o;
|
|
4380
4390
|
}
|
|
4381
|
-
|
|
4391
|
+
function At(t, e) {
|
|
4392
|
+
return { [t.table]: e.map((n) => n.entity) };
|
|
4393
|
+
}
|
|
4394
|
+
function Pu(t, e) {
|
|
4395
|
+
const n = t.orderFieldType;
|
|
4396
|
+
if (t.orderField === "serverCreatedAt") {
|
|
4397
|
+
e.sort(t.orderDirection === "asc" ? function(s, o) {
|
|
4398
|
+
return Ue(s.entity.id, s.serverCreatedAt, o.entity.id, o.serverCreatedAt, n);
|
|
4399
|
+
} : function(s, o) {
|
|
4400
|
+
return Ue(o.entity.id, o.serverCreatedAt, s.entity.id, s.serverCreatedAt, n);
|
|
4401
|
+
});
|
|
4402
|
+
return;
|
|
4403
|
+
}
|
|
4404
|
+
const r = t.orderField;
|
|
4405
|
+
e.sort(t.orderDirection === "asc" ? function(s, o) {
|
|
4406
|
+
return Ue(s.entity.id, s.entity[r], o.entity.id, o.entity[r], n);
|
|
4407
|
+
} : function(s, o) {
|
|
4408
|
+
return Ue(o.entity.id, o.entity[r], s.entity.id, s.entity[r], n);
|
|
4409
|
+
});
|
|
4410
|
+
}
|
|
4411
|
+
var Se;
|
|
4382
4412
|
(function(t) {
|
|
4383
4413
|
t.InitialSyncBatch = "InitialSyncBatch", t.InitialSyncComplete = "InitialSyncComplete", t.LoadFromStorage = "LoadFromStorage", t.SyncTransaction = "SyncTransaction", t.Error = "Error";
|
|
4384
|
-
})(
|
|
4385
|
-
class
|
|
4414
|
+
})(Se || (Se = {}));
|
|
4415
|
+
class Mu {
|
|
4386
4416
|
constructor(e, n, r, i, s) {
|
|
4387
|
-
this.callbacks = {}, this.idToHash = {}, this.trySend = e, this.config = r, this.log = i, this.createStore = s, this.subs = new
|
|
4417
|
+
this.callbacks = {}, this.idToHash = {}, this.trySend = e, this.config = r, this.log = i, this.createStore = s, this.subs = new Ht(n, "subs", {}, ku, ju, (o) => Cu(o, this.config.useDateObjects));
|
|
4388
4418
|
}
|
|
4389
4419
|
beforeUnload() {
|
|
4390
4420
|
this.subs.flush();
|
|
@@ -4392,7 +4422,7 @@ class ju {
|
|
|
4392
4422
|
subscribe(e, n) {
|
|
4393
4423
|
const r = N(e);
|
|
4394
4424
|
return this.callbacks[r] = this.callbacks[r] || [], this.callbacks[r].push(n), this.initSubscription(e, r, n), (i) => {
|
|
4395
|
-
this.unsubscribe(r, n, i);
|
|
4425
|
+
this.unsubscribe(r, n, i == null ? void 0 : i.keepSubscription);
|
|
4396
4426
|
};
|
|
4397
4427
|
}
|
|
4398
4428
|
unsubscribe(e, n, r) {
|
|
@@ -4426,25 +4456,30 @@ class ju {
|
|
|
4426
4456
|
});
|
|
4427
4457
|
}
|
|
4428
4458
|
initSubscription(e, n, r) {
|
|
4429
|
-
return
|
|
4459
|
+
return lr(this, void 0, void 0, function* () {
|
|
4460
|
+
var i, s, o;
|
|
4430
4461
|
yield this.subs.waitForLoaded();
|
|
4431
|
-
const
|
|
4432
|
-
if (
|
|
4433
|
-
this.sendResync(
|
|
4434
|
-
type:
|
|
4435
|
-
|
|
4436
|
-
|
|
4437
|
-
});
|
|
4462
|
+
const u = this.subs.currentValue[n];
|
|
4463
|
+
if (u && u.state && u.state.txId) {
|
|
4464
|
+
this.sendResync(u, u.state), u.entities && r && (Object.keys(e)[0], r({
|
|
4465
|
+
type: Se.LoadFromStorage,
|
|
4466
|
+
data: At(u, u.entities)
|
|
4467
|
+
}));
|
|
4438
4468
|
return;
|
|
4439
4469
|
}
|
|
4440
|
-
|
|
4470
|
+
const c = Object.keys(e)[0], d = ((s = (i = e[c]) === null || i === void 0 ? void 0 : i.$) === null || s === void 0 ? void 0 : s.order) || { serverCreatedAt: "asc" }, [a, f] = Object.entries(d)[0], h = a === "serverCreatedAt" ? "number" : (o = ce(this.createStore([]), c, a)) === null || o === void 0 ? void 0 : o["checked-data-type"];
|
|
4471
|
+
this.subs.set((p) => (p[n] = {
|
|
4441
4472
|
query: e,
|
|
4442
|
-
hash: n
|
|
4443
|
-
|
|
4473
|
+
hash: n,
|
|
4474
|
+
table: c,
|
|
4475
|
+
orderDirection: f,
|
|
4476
|
+
orderField: a,
|
|
4477
|
+
orderFieldType: h
|
|
4478
|
+
}, p)), this.sendStart(e);
|
|
4444
4479
|
});
|
|
4445
4480
|
}
|
|
4446
4481
|
flushPending() {
|
|
4447
|
-
return
|
|
4482
|
+
return lr(this, void 0, void 0, function* () {
|
|
4448
4483
|
yield this.subs.waitForLoaded();
|
|
4449
4484
|
for (const e of Object.keys(this.callbacks)) {
|
|
4450
4485
|
const n = this.subs.currentValue[e];
|
|
@@ -4480,16 +4515,20 @@ class ju {
|
|
|
4480
4515
|
const f = (d = a.entities) !== null && d !== void 0 ? d : [];
|
|
4481
4516
|
a.entities = f;
|
|
4482
4517
|
for (const h of r) {
|
|
4483
|
-
const p = this.createStore(h), y =
|
|
4484
|
-
f.push({
|
|
4518
|
+
const p = this.createStore(h), y = Et(a, p);
|
|
4519
|
+
f.push({
|
|
4520
|
+
store: p,
|
|
4521
|
+
entity: y,
|
|
4522
|
+
serverCreatedAt: hr(a, p, y.id)
|
|
4523
|
+
}), s.push(y);
|
|
4485
4524
|
}
|
|
4486
4525
|
return c;
|
|
4487
4526
|
})[i];
|
|
4488
|
-
u.entities && this.notifyCbs(i, {
|
|
4489
|
-
type:
|
|
4490
|
-
data: u.entities
|
|
4527
|
+
u.entities && (Object.keys(u.query)[0], this.notifyCbs(i, {
|
|
4528
|
+
type: Se.InitialSyncBatch,
|
|
4529
|
+
data: At(u, u.entities),
|
|
4491
4530
|
batch: s
|
|
4492
|
-
});
|
|
4531
|
+
}));
|
|
4493
4532
|
}
|
|
4494
4533
|
onSyncInitFinish(e) {
|
|
4495
4534
|
const n = e["subscription-id"], r = this.idToHash[n];
|
|
@@ -4533,9 +4572,9 @@ class ju {
|
|
|
4533
4572
|
const h = [];
|
|
4534
4573
|
e: for (const [_, T] of Object.entries(a))
|
|
4535
4574
|
for (const [g, S] of Object.entries(f))
|
|
4536
|
-
if (
|
|
4537
|
-
|
|
4538
|
-
const m =
|
|
4575
|
+
if (_s(S.store, _)) {
|
|
4576
|
+
pr(S.store, T);
|
|
4577
|
+
const m = Et(o, S.store), M = Iu(S.store, T)[_];
|
|
4539
4578
|
for (const [O, { oldValue: P, newValue: U }] of Object.entries(M || {}))
|
|
4540
4579
|
P === U && delete M[O];
|
|
4541
4580
|
m ? (h.push({
|
|
@@ -4548,8 +4587,8 @@ class ju {
|
|
|
4548
4587
|
const p = [];
|
|
4549
4588
|
for (const [_, T] of Object.entries(a)) {
|
|
4550
4589
|
const g = this.createStore([]);
|
|
4551
|
-
|
|
4552
|
-
const S =
|
|
4590
|
+
pr(g, T);
|
|
4591
|
+
const S = Et(o, g);
|
|
4553
4592
|
if (!S) {
|
|
4554
4593
|
this.log.error("No entity found after applying change", {
|
|
4555
4594
|
sub: o,
|
|
@@ -4558,14 +4597,18 @@ class ju {
|
|
|
4558
4597
|
});
|
|
4559
4598
|
continue;
|
|
4560
4599
|
}
|
|
4561
|
-
f.push({
|
|
4600
|
+
f.push({
|
|
4601
|
+
store: g,
|
|
4602
|
+
entity: S,
|
|
4603
|
+
serverCreatedAt: hr(o, g, S.id)
|
|
4604
|
+
}), p.push(S);
|
|
4562
4605
|
}
|
|
4563
4606
|
const y = [];
|
|
4564
4607
|
for (const _ of d.sort().reverse())
|
|
4565
4608
|
y.push(f[_].entity), f.splice(_, 1);
|
|
4566
|
-
this.notifyCbs(r, {
|
|
4567
|
-
type:
|
|
4568
|
-
data:
|
|
4609
|
+
Pu(o, f), this.notifyCbs(r, {
|
|
4610
|
+
type: Se.SyncTransaction,
|
|
4611
|
+
data: At(o, o.entities),
|
|
4569
4612
|
added: p,
|
|
4570
4613
|
removed: y,
|
|
4571
4614
|
updated: h
|
|
@@ -4589,8 +4632,12 @@ class ju {
|
|
|
4589
4632
|
status: e.status,
|
|
4590
4633
|
type: e.type,
|
|
4591
4634
|
hint: e.hint
|
|
4592
|
-
};
|
|
4593
|
-
this.notifyCbs(n, {
|
|
4635
|
+
}, i = Object.keys(e["original-event"].q)[0];
|
|
4636
|
+
this.notifyCbs(n, {
|
|
4637
|
+
type: Se.Error,
|
|
4638
|
+
data: { [i]: [] },
|
|
4639
|
+
error: r
|
|
4640
|
+
});
|
|
4594
4641
|
}
|
|
4595
4642
|
onResyncError(e) {
|
|
4596
4643
|
const n = e["original-event"]["subscription-id"], r = this.clearSubscriptionData(n);
|
|
@@ -4623,7 +4670,7 @@ var x = function(t, e, n, r) {
|
|
|
4623
4670
|
}
|
|
4624
4671
|
d((r = r.apply(t, e || [])).next());
|
|
4625
4672
|
});
|
|
4626
|
-
},
|
|
4673
|
+
}, Ru = function(t, e) {
|
|
4627
4674
|
var n = {};
|
|
4628
4675
|
for (var r in t) Object.prototype.hasOwnProperty.call(t, r) && e.indexOf(r) < 0 && (n[r] = t[r]);
|
|
4629
4676
|
if (t != null && typeof Object.getOwnPropertySymbols == "function")
|
|
@@ -4637,60 +4684,60 @@ const ie = {
|
|
|
4637
4684
|
AUTHENTICATED: "authenticated",
|
|
4638
4685
|
CLOSED: "closed",
|
|
4639
4686
|
ERRORED: "errored"
|
|
4640
|
-
},
|
|
4687
|
+
}, $u = 3e4, Du = 3e4, xu = 200, Uu = {
|
|
4641
4688
|
apiURI: "https://api.instantdb.com",
|
|
4642
4689
|
websocketURI: "wss://api.instantdb.com/runtime/session"
|
|
4643
|
-
},
|
|
4644
|
-
function
|
|
4690
|
+
}, Ct = "_instant_oauth_redirect", jt = "currentUser";
|
|
4691
|
+
function Lu({ transportType: t, appId: e, apiURI: n, wsURI: r, EventSourceImpl: i }) {
|
|
4645
4692
|
if (!i)
|
|
4646
|
-
return new
|
|
4693
|
+
return new fr(`${r}?app_id=${e}`);
|
|
4647
4694
|
switch (t) {
|
|
4648
4695
|
case "ws":
|
|
4649
|
-
return new
|
|
4696
|
+
return new fr(`${r}?app_id=${e}`);
|
|
4650
4697
|
case "sse":
|
|
4651
|
-
return new
|
|
4698
|
+
return new Au(i, `${n}/runtime/sse?app_id=${e}`);
|
|
4652
4699
|
default:
|
|
4653
4700
|
throw new Error("Unknown transport type " + t);
|
|
4654
4701
|
}
|
|
4655
4702
|
}
|
|
4656
|
-
function
|
|
4703
|
+
function Fu() {
|
|
4657
4704
|
return typeof window < "u" || typeof chrome < "u";
|
|
4658
4705
|
}
|
|
4659
|
-
const
|
|
4706
|
+
const yr = {
|
|
4660
4707
|
"set-presence": !0,
|
|
4661
4708
|
"set-presence-ok": !0,
|
|
4662
4709
|
"refresh-presence": !0,
|
|
4663
4710
|
"patch-presence": !0
|
|
4664
4711
|
};
|
|
4665
|
-
function
|
|
4712
|
+
function Nu(t, e) {
|
|
4666
4713
|
var n;
|
|
4667
4714
|
const r = typeof t == "string" ? JSON.parse(t) : t;
|
|
4668
4715
|
for (const i in r) {
|
|
4669
4716
|
const s = r[i];
|
|
4670
4717
|
if (!((n = s == null ? void 0 : s.result) === null || n === void 0) && n.store) {
|
|
4671
4718
|
const o = s.result.store;
|
|
4672
|
-
s.result.store =
|
|
4719
|
+
s.result.store = $r(Object.assign(Object.assign({}, o), { useDateObjects: e }));
|
|
4673
4720
|
}
|
|
4674
4721
|
}
|
|
4675
4722
|
return r;
|
|
4676
4723
|
}
|
|
4677
|
-
function
|
|
4724
|
+
function Vu(t) {
|
|
4678
4725
|
var e;
|
|
4679
4726
|
const n = {};
|
|
4680
4727
|
for (const r in t) {
|
|
4681
4728
|
const i = t[r], s = Object.assign({}, i);
|
|
4682
|
-
!((e = i.result) === null || e === void 0) && e.store && (s.result = Object.assign(Object.assign({}, i.result), { store:
|
|
4729
|
+
!((e = i.result) === null || e === void 0) && e.store && (s.result = Object.assign(Object.assign({}, i.result), { store: Rr(i.result.store) })), n[r] = s;
|
|
4683
4730
|
}
|
|
4684
4731
|
return n;
|
|
4685
4732
|
}
|
|
4686
|
-
function
|
|
4733
|
+
function br(t) {
|
|
4687
4734
|
return [...t].sort((e, n) => {
|
|
4688
4735
|
const [r, i] = e, [s, o] = n, u = i.order || 0, c = o.order || 0;
|
|
4689
4736
|
return u == c ? r < s ? -1 : r > s ? 1 : 0 : u - c;
|
|
4690
4737
|
});
|
|
4691
4738
|
}
|
|
4692
|
-
class
|
|
4693
|
-
constructor(e, n =
|
|
4739
|
+
class qu {
|
|
4740
|
+
constructor(e, n = Jr, r = Zr, i, s) {
|
|
4694
4741
|
var o, u, c;
|
|
4695
4742
|
if (this._isOnline = !0, this._isShutdown = !1, this.status = ie.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._onMergeQuerySubs = (d, a) => {
|
|
4696
4743
|
const f = d || {}, h = Object.assign({}, a);
|
|
@@ -4716,7 +4763,7 @@ class Lu {
|
|
|
4716
4763
|
}, this.notifyOne = (d) => {
|
|
4717
4764
|
var a, f;
|
|
4718
4765
|
const h = (a = this.queryCbs[d]) !== null && a !== void 0 ? a : [], p = (f = this._dataForQueryCache[d]) === null || f === void 0 ? void 0 : f.data, y = this.dataForQuery(d);
|
|
4719
|
-
y && (
|
|
4766
|
+
y && (nt(y, p) || h.forEach((_) => _.cb(y)));
|
|
4720
4767
|
}, this.notifyOneQueryOnce = (d) => {
|
|
4721
4768
|
var a;
|
|
4722
4769
|
const f = (a = this.queryOnceDfds[d]) !== null && a !== void 0 ? a : [], h = this.dataForQuery(d);
|
|
@@ -4726,9 +4773,9 @@ class Lu {
|
|
|
4726
4773
|
}, this.notifyQueryError = (d, a) => {
|
|
4727
4774
|
(this.queryCbs[d] || []).forEach((h) => h.cb({ error: a }));
|
|
4728
4775
|
}, this.pushTx = (d) => {
|
|
4729
|
-
this.config.disableValidation ||
|
|
4776
|
+
this.config.disableValidation || Eu(d, this.config.schema);
|
|
4730
4777
|
try {
|
|
4731
|
-
const a =
|
|
4778
|
+
const a = Xo({
|
|
4732
4779
|
attrs: this.optimisticAttrs(),
|
|
4733
4780
|
schema: this.config.schema,
|
|
4734
4781
|
stores: Object.values(this.querySubs.currentValue).map((f) => {
|
|
@@ -4750,7 +4797,7 @@ class Lu {
|
|
|
4750
4797
|
order: p
|
|
4751
4798
|
};
|
|
4752
4799
|
this.pendingMutations.set((T) => (T.set(f, y), T));
|
|
4753
|
-
const _ = new
|
|
4800
|
+
const _ = new nr();
|
|
4754
4801
|
return this.mutationDeferredStore.set(f, _), this._sendMutation(f, y), this.notifyAll(), _.promise;
|
|
4755
4802
|
}, this._transportOnOpen = (d) => {
|
|
4756
4803
|
const a = d.target;
|
|
@@ -4811,7 +4858,7 @@ class Lu {
|
|
|
4811
4858
|
return;
|
|
4812
4859
|
}
|
|
4813
4860
|
this._log.info("[socket][close]", a.id, "schedule reconnect, ms =", this._reconnectTimeoutMs), this._scheduleReconnect();
|
|
4814
|
-
}, this._EventSource = s, this.config = Object.assign(Object.assign({},
|
|
4861
|
+
}, this._EventSource = s, this.config = Object.assign(Object.assign({}, Uu), e), this.queryCacheLimit = (o = this.config.queryCacheLimit) !== null && o !== void 0 ? o : 10, this._pendingTxCleanupTimeout = (u = this.config.pendingTxCleanupTimeout) !== null && u !== void 0 ? u : Du, this._pendingMutationCleanupThreshold = (c = this.config.pendingMutationCleanupThreshold) !== null && c !== void 0 ? c : xu, this._log = bu(e.verbose || ln || Xr, () => this._reactorStats()), this.versions = Object.assign(Object.assign({}, i || {}), { "@instantdb/core": ni }), this.config.schema && (this._linkIndex = ir(this.config.schema)), !!Fu()) {
|
|
4815
4862
|
if (!e.appId)
|
|
4816
4863
|
throw new Error("Instant must be initialized with an appId.");
|
|
4817
4864
|
if (!ve(e.appId))
|
|
@@ -4826,9 +4873,9 @@ class Lu {
|
|
|
4826
4873
|
} catch (f) {
|
|
4827
4874
|
this._log.error("[error] handle broadcast channel", f);
|
|
4828
4875
|
}
|
|
4829
|
-
}))), this._initStorage(n), this._syncTable = new
|
|
4876
|
+
}))), this._initStorage(n), this._syncTable = new Mu(this._trySendAuthed.bind(this), this._persister, {
|
|
4830
4877
|
useDateObjects: this.config.useDateObjects
|
|
4831
|
-
}, this._log, (d) =>
|
|
4878
|
+
}, this._log, (d) => rt(this.attrs, d, this.config.enableCardinalityInference, this._linkIndex, this.config.useDateObjects)), this._oauthCallbackResponse = this._oauthLoginInit(), this.getCurrentUser(), r.getIsOnline().then((d) => {
|
|
4832
4879
|
this._isOnline = d, this._startSocket(), r.listen((a) => {
|
|
4833
4880
|
a !== this._isOnline && (this._log.info("[network] online =", a), this._isOnline = a, this._isOnline ? this._startSocket() : (this._log.info("Changing status from", this.status, "to", ie.CLOSED), this._setStatus(ie.CLOSED)));
|
|
4834
4881
|
});
|
|
@@ -4836,7 +4883,7 @@ class Lu {
|
|
|
4836
4883
|
}
|
|
4837
4884
|
}
|
|
4838
4885
|
updateSchema(e) {
|
|
4839
|
-
this.config = Object.assign(Object.assign({}, this.config), { schema: e, cardinalityInference: !!e }), this._linkIndex = e ?
|
|
4886
|
+
this.config = Object.assign(Object.assign({}, this.config), { schema: e, cardinalityInference: !!e }), this._linkIndex = e ? ir(this.config.schema) : null;
|
|
4840
4887
|
}
|
|
4841
4888
|
_reactorStats() {
|
|
4842
4889
|
return {
|
|
@@ -4846,7 +4893,7 @@ class Lu {
|
|
|
4846
4893
|
};
|
|
4847
4894
|
}
|
|
4848
4895
|
_initStorage(e) {
|
|
4849
|
-
this._persister = new e(`instant_${this.config.appId}_5`), this.querySubs = new
|
|
4896
|
+
this._persister = new e(`instant_${this.config.appId}_5`), this.querySubs = new Ht(this._persister, "querySubs", {}, this._onMergeQuerySubs, Vu, (n) => Nu(n, this.config.useDateObjects)), this.pendingMutations = new Ht(
|
|
4850
4897
|
this._persister,
|
|
4851
4898
|
"pendingMutations",
|
|
4852
4899
|
/* @__PURE__ */ new Map(),
|
|
@@ -4878,8 +4925,8 @@ class Lu {
|
|
|
4878
4925
|
if (s)
|
|
4879
4926
|
i.resolve({ status: e, eventId: n });
|
|
4880
4927
|
else if (r.type) {
|
|
4881
|
-
const { status: o } = r, u =
|
|
4882
|
-
i.reject(new
|
|
4928
|
+
const { status: o } = r, u = Ru(r, ["status"]);
|
|
4929
|
+
i.reject(new ft({
|
|
4883
4930
|
// @ts-expect-error body.type is not constant typed
|
|
4884
4931
|
body: u,
|
|
4885
4932
|
status: o
|
|
@@ -4902,7 +4949,7 @@ class Lu {
|
|
|
4902
4949
|
_handleReceive(e, n) {
|
|
4903
4950
|
var r, i, s, o, u, c;
|
|
4904
4951
|
const d = !!this.config.schema && ("cardinalityInference" in this.config ? !!this.config.cardinalityInference : !0);
|
|
4905
|
-
switch (
|
|
4952
|
+
switch (yr[n.op] || this._log.info("[receive]", e, n.op, n), n.op) {
|
|
4906
4953
|
case "init-ok": {
|
|
4907
4954
|
this._setStatus(ie.AUTHENTICATED), this._reconnectTimeoutMs = 0, this._setAttrs(n.attrs), this._flushPendingMessages(), this._sessionId = n["session-id"];
|
|
4908
4955
|
for (const h of Object.keys(this._rooms)) {
|
|
@@ -4916,7 +4963,7 @@ class Lu {
|
|
|
4916
4963
|
break;
|
|
4917
4964
|
}
|
|
4918
4965
|
case "add-query-ok": {
|
|
4919
|
-
const { q: h, result: p } = n, y = N(h), _ = (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"], T = (c = (u = p == null ? void 0 : p[0]) === null || u === void 0 ? void 0 : u.data) === null || c === void 0 ? void 0 : c.aggregate, g =
|
|
4966
|
+
const { q: h, result: p } = n, y = N(h), _ = (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"], T = (c = (u = p == null ? void 0 : p[0]) === null || u === void 0 ? void 0 : u.data) === null || c === void 0 ? void 0 : c.aggregate, g = rr(p), S = rt(this.attrs, g, d, this._linkIndex, this.config.useDateObjects);
|
|
4920
4967
|
this.querySubs.set((m) => (m[y].result = {
|
|
4921
4968
|
store: S,
|
|
4922
4969
|
pageInfo: _,
|
|
@@ -4946,10 +4993,10 @@ class Lu {
|
|
|
4946
4993
|
p && this._setAttrs(p), this._cleanupPendingMutationsTimeout();
|
|
4947
4994
|
const _ = this._rewriteMutations(this.attrs, this.pendingMutations.currentValue, y);
|
|
4948
4995
|
_ !== this.pendingMutations.currentValue && this.pendingMutations.set(() => _);
|
|
4949
|
-
const T =
|
|
4996
|
+
const T = br(_.entries()), g = h.map((S) => {
|
|
4950
4997
|
var m, M, O, P;
|
|
4951
|
-
const U = S["instaql-query"], q = S["instaql-result"],
|
|
4952
|
-
return { hash:
|
|
4998
|
+
const U = S["instaql-query"], q = S["instaql-result"], ke = N(U), ze = rr(q), lt = rt(this.attrs, ze, d, this._linkIndex, this.config.useDateObjects), ht = this._applyOptimisticUpdates(lt, T, y), Ke = (M = (m = q == null ? void 0 : q[0]) === null || m === void 0 ? void 0 : m.data) === null || M === void 0 ? void 0 : M["page-info"], ne = (P = (O = q == null ? void 0 : q[0]) === null || O === void 0 ? void 0 : O.data) === null || P === void 0 ? void 0 : P.aggregate;
|
|
4999
|
+
return { hash: ke, store: ht, pageInfo: Ke, aggregate: ne };
|
|
4953
5000
|
});
|
|
4954
5001
|
g.forEach(({ hash: S, store: m, pageInfo: M, aggregate: O }) => {
|
|
4955
5002
|
this.querySubs.set((P) => (P[S].result = { store: m, pageInfo: M, aggregate: O, processedTxId: y }, P));
|
|
@@ -5090,7 +5137,7 @@ class Lu {
|
|
|
5090
5137
|
*/
|
|
5091
5138
|
subscribeQuery(e, n, r) {
|
|
5092
5139
|
var i;
|
|
5093
|
-
this.config.disableValidation ||
|
|
5140
|
+
this.config.disableValidation || or(e, this.config.schema), r && "ruleParams" in r && (e = Object.assign({ $$ruleParams: r.ruleParams }, e));
|
|
5094
5141
|
const s = N(e), o = this.getPreviousResult(e);
|
|
5095
5142
|
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), () => {
|
|
5096
5143
|
this._unsubQuery(e, s, n);
|
|
@@ -5098,14 +5145,14 @@ class Lu {
|
|
|
5098
5145
|
}
|
|
5099
5146
|
queryOnce(e, n) {
|
|
5100
5147
|
var r;
|
|
5101
|
-
this.config.disableValidation ||
|
|
5102
|
-
const i = new
|
|
5148
|
+
this.config.disableValidation || or(e, this.config.schema), n && "ruleParams" in n && (e = Object.assign({ $$ruleParams: n.ruleParams }, e));
|
|
5149
|
+
const i = new nr();
|
|
5103
5150
|
if (!this._isOnline)
|
|
5104
5151
|
return i.reject(new Error("We can't run `queryOnce`, because the device is offline.")), i.promise;
|
|
5105
5152
|
if (!this.querySubs)
|
|
5106
5153
|
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;
|
|
5107
5154
|
const s = N(e), o = this._startQuerySub(e, s);
|
|
5108
|
-
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")),
|
|
5155
|
+
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")), $u), i.promise;
|
|
5109
5156
|
}
|
|
5110
5157
|
_completeQueryOnce(e, n, r) {
|
|
5111
5158
|
this.queryOnceDfds[n] && (this.queryOnceDfds[n] = this.queryOnceDfds[n].filter((i) => i.dfd !== r), this._cleanupQuery(e, n));
|
|
@@ -5136,7 +5183,7 @@ class Lu {
|
|
|
5136
5183
|
return V(e, h, p);
|
|
5137
5184
|
}, s = (a) => {
|
|
5138
5185
|
const [f, h, p] = a["forward-identity"];
|
|
5139
|
-
return
|
|
5186
|
+
return pe(e, h, p);
|
|
5140
5187
|
}, o = { attrIdMap: {}, refSwapAttrIds: /* @__PURE__ */ new Set() };
|
|
5141
5188
|
let u = !1;
|
|
5142
5189
|
const c = (a, f) => {
|
|
@@ -5161,7 +5208,7 @@ class Lu {
|
|
|
5161
5208
|
u = !0;
|
|
5162
5209
|
continue;
|
|
5163
5210
|
}
|
|
5164
|
-
const _ = u ?
|
|
5211
|
+
const _ = u ? ko(o, p) : p;
|
|
5165
5212
|
h.push(_);
|
|
5166
5213
|
}
|
|
5167
5214
|
return u ? h : a;
|
|
@@ -5171,7 +5218,7 @@ class Lu {
|
|
|
5171
5218
|
return u ? d : n;
|
|
5172
5219
|
}
|
|
5173
5220
|
_rewriteMutationsSorted(e, n) {
|
|
5174
|
-
return
|
|
5221
|
+
return br(this._rewriteMutations(e, n).entries());
|
|
5175
5222
|
}
|
|
5176
5223
|
// ---------------------------
|
|
5177
5224
|
// Transact
|
|
@@ -5206,7 +5253,7 @@ class Lu {
|
|
|
5206
5253
|
const d = this._dataForQueryCache[e];
|
|
5207
5254
|
if (d && r === d.querySubVersion && s === d.pendingMutationsVersion)
|
|
5208
5255
|
return d.data;
|
|
5209
|
-
const { store: a, pageInfo: f, aggregate: h, processedTxId: p } = c, y = this._rewriteMutationsSorted(a.attrs, o), _ = this._applyOptimisticUpdates(a, y, p), T =
|
|
5256
|
+
const { store: a, pageInfo: f, aggregate: h, processedTxId: p } = c, y = this._rewriteMutationsSorted(a.attrs, o), _ = this._applyOptimisticUpdates(a, y, p), T = Qr({ store: _, pageInfo: f, aggregate: h }, u);
|
|
5210
5257
|
return this._dataForQueryCache[e] = {
|
|
5211
5258
|
querySubVersion: r,
|
|
5212
5259
|
pendingMutationsVersion: s,
|
|
@@ -5215,7 +5262,7 @@ class Lu {
|
|
|
5215
5262
|
}
|
|
5216
5263
|
_applyOptimisticUpdates(e, n, r) {
|
|
5217
5264
|
for (const [i, s] of n)
|
|
5218
|
-
(!s["tx-id"] || r && s["tx-id"] > r) && (e =
|
|
5265
|
+
(!s["tx-id"] || r && s["tx-id"] > r) && (e = ks(e, s["tx-steps"]));
|
|
5219
5266
|
return e;
|
|
5220
5267
|
}
|
|
5221
5268
|
/** Re-compute all subscriptions */
|
|
@@ -5305,7 +5352,7 @@ class Lu {
|
|
|
5305
5352
|
}
|
|
5306
5353
|
_trySend(e, n, r) {
|
|
5307
5354
|
if (this._transport.isOpen()) {
|
|
5308
|
-
switch (
|
|
5355
|
+
switch (yr[n.op] || this._log.info("[send]", this._transport.id, n.op, n), n.op) {
|
|
5309
5356
|
case "transact": {
|
|
5310
5357
|
this._inFlightMutationEventIds.add(e);
|
|
5311
5358
|
break;
|
|
@@ -5326,7 +5373,7 @@ class Lu {
|
|
|
5326
5373
|
return;
|
|
5327
5374
|
}
|
|
5328
5375
|
const e = this._transport;
|
|
5329
|
-
this._transport =
|
|
5376
|
+
this._transport = Lu({
|
|
5330
5377
|
transportType: this._transportType,
|
|
5331
5378
|
appId: this.config.appId,
|
|
5332
5379
|
apiURI: this.config.apiURI,
|
|
@@ -5361,9 +5408,9 @@ class Lu {
|
|
|
5361
5408
|
if (typeof URL > "u")
|
|
5362
5409
|
return;
|
|
5363
5410
|
const e = new URL(window.location.href);
|
|
5364
|
-
if (e.searchParams.get(
|
|
5411
|
+
if (e.searchParams.get(Ct)) {
|
|
5365
5412
|
const n = e.toString();
|
|
5366
|
-
e.searchParams.delete(
|
|
5413
|
+
e.searchParams.delete(Ct), e.searchParams.delete("code"), e.searchParams.delete("error");
|
|
5367
5414
|
const r = e.pathname + (e.searchParams.size ? "?" + e.searchParams : "") + e.hash;
|
|
5368
5415
|
if (history.replaceState(history.state, "", r), // @ts-ignore (waiting for ts support)
|
|
5369
5416
|
typeof navigation == "object" && // @ts-ignore (waiting for ts support)
|
|
@@ -5388,7 +5435,7 @@ class Lu {
|
|
|
5388
5435
|
if (typeof window > "u" || typeof window.location > "u" || typeof URLSearchParams > "u")
|
|
5389
5436
|
return null;
|
|
5390
5437
|
const s = new URLSearchParams(window.location.search);
|
|
5391
|
-
if (!s.get(
|
|
5438
|
+
if (!s.get(Ct))
|
|
5392
5439
|
return null;
|
|
5393
5440
|
const o = s.get("error");
|
|
5394
5441
|
if (o)
|
|
@@ -5398,7 +5445,7 @@ class Lu {
|
|
|
5398
5445
|
return null;
|
|
5399
5446
|
this._replaceUrlAfterOAuth();
|
|
5400
5447
|
try {
|
|
5401
|
-
const c = yield this._getCurrentUser(), d = (c == null ? void 0 : c.type) === "guest", { user: a } = yield
|
|
5448
|
+
const c = yield this._getCurrentUser(), d = (c == null ? void 0 : c.type) === "guest", { user: a } = yield er({
|
|
5402
5449
|
apiURI: this.config.apiURI,
|
|
5403
5450
|
appId: this.config.appId,
|
|
5404
5451
|
code: u,
|
|
@@ -5426,7 +5473,7 @@ class Lu {
|
|
|
5426
5473
|
n.isLoading || e(this._currentUserCached);
|
|
5427
5474
|
let r = !1;
|
|
5428
5475
|
return this.getCurrentUser().then((i) => {
|
|
5429
|
-
r ||
|
|
5476
|
+
r || nt(i, n) || e(i);
|
|
5430
5477
|
}), () => {
|
|
5431
5478
|
r = !0, this.authCbs = this.authCbs.filter((i) => i !== e);
|
|
5432
5479
|
};
|
|
@@ -5466,7 +5513,7 @@ class Lu {
|
|
|
5466
5513
|
}
|
|
5467
5514
|
setCurrentUser(e) {
|
|
5468
5515
|
return x(this, void 0, void 0, function* () {
|
|
5469
|
-
yield this._persister.setItem(
|
|
5516
|
+
yield this._persister.setItem(jt, e);
|
|
5470
5517
|
});
|
|
5471
5518
|
}
|
|
5472
5519
|
getCurrentUserCached() {
|
|
@@ -5474,7 +5521,7 @@ class Lu {
|
|
|
5474
5521
|
}
|
|
5475
5522
|
_getCurrentUser() {
|
|
5476
5523
|
return x(this, void 0, void 0, function* () {
|
|
5477
|
-
const e = yield this._persister.getItem(
|
|
5524
|
+
const e = yield this._persister.getItem(jt);
|
|
5478
5525
|
return typeof e == "string" ? JSON.parse(e) : e;
|
|
5479
5526
|
});
|
|
5480
5527
|
}
|
|
@@ -5491,7 +5538,7 @@ class Lu {
|
|
|
5491
5538
|
}
|
|
5492
5539
|
_hasCurrentUser() {
|
|
5493
5540
|
return x(this, void 0, void 0, function* () {
|
|
5494
|
-
const e = yield this._persister.getItem(
|
|
5541
|
+
const e = yield this._persister.getItem(jt);
|
|
5495
5542
|
return JSON.parse(e) != null;
|
|
5496
5543
|
});
|
|
5497
5544
|
}
|
|
@@ -5499,7 +5546,7 @@ class Lu {
|
|
|
5499
5546
|
return x(this, void 0, void 0, function* () {
|
|
5500
5547
|
var n;
|
|
5501
5548
|
const { user: r } = yield this.getCurrentUser();
|
|
5502
|
-
if (!
|
|
5549
|
+
if (!nt(r, e)) {
|
|
5503
5550
|
yield this.setCurrentUser(e), this.updateUser(e);
|
|
5504
5551
|
try {
|
|
5505
5552
|
(n = this._broadcastChannel) === null || n === void 0 || n.postMessage({ type: "auth" });
|
|
@@ -5516,7 +5563,7 @@ class Lu {
|
|
|
5516
5563
|
}), r)), this._reconnectTimeoutMs = 0, this._transport.close(), this._oauthCallbackResponse = null, this.notifyAuthSubs(n);
|
|
5517
5564
|
}
|
|
5518
5565
|
sendMagicCode({ email: e }) {
|
|
5519
|
-
return
|
|
5566
|
+
return nu({
|
|
5520
5567
|
apiURI: this.config.apiURI,
|
|
5521
5568
|
appId: this.config.appId,
|
|
5522
5569
|
email: e
|
|
@@ -5525,7 +5572,7 @@ class Lu {
|
|
|
5525
5572
|
signInWithMagicCode(e) {
|
|
5526
5573
|
return x(this, arguments, void 0, function* ({ email: n, code: r }) {
|
|
5527
5574
|
var i;
|
|
5528
|
-
const s = yield this.getCurrentUser(), o = ((i = s == null ? void 0 : s.user) === null || i === void 0 ? void 0 : i.type) === "guest", u = yield
|
|
5575
|
+
const s = yield this.getCurrentUser(), o = ((i = s == null ? void 0 : s.user) === null || i === void 0 ? void 0 : i.type) === "guest", u = yield ru({
|
|
5529
5576
|
apiURI: this.config.apiURI,
|
|
5530
5577
|
appId: this.config.appId,
|
|
5531
5578
|
email: n,
|
|
@@ -5537,7 +5584,7 @@ class Lu {
|
|
|
5537
5584
|
}
|
|
5538
5585
|
signInWithCustomToken(e) {
|
|
5539
5586
|
return x(this, void 0, void 0, function* () {
|
|
5540
|
-
const n = yield
|
|
5587
|
+
const n = yield iu({
|
|
5541
5588
|
apiURI: this.config.apiURI,
|
|
5542
5589
|
appId: this.config.appId,
|
|
5543
5590
|
refreshToken: e
|
|
@@ -5547,7 +5594,7 @@ class Lu {
|
|
|
5547
5594
|
}
|
|
5548
5595
|
signInAsGuest() {
|
|
5549
5596
|
return x(this, void 0, void 0, function* () {
|
|
5550
|
-
const e = yield
|
|
5597
|
+
const e = yield su({
|
|
5551
5598
|
apiURI: this.config.apiURI,
|
|
5552
5599
|
appId: this.config.appId
|
|
5553
5600
|
});
|
|
@@ -5563,7 +5610,7 @@ class Lu {
|
|
|
5563
5610
|
this._log.info("[auth-invalidate] skipped invalidateToken");
|
|
5564
5611
|
return;
|
|
5565
5612
|
}
|
|
5566
|
-
|
|
5613
|
+
uu({
|
|
5567
5614
|
apiURI: this.config.apiURI,
|
|
5568
5615
|
appId: this.config.appId,
|
|
5569
5616
|
refreshToken: i
|
|
@@ -5598,7 +5645,7 @@ class Lu {
|
|
|
5598
5645
|
exchangeCodeForToken(e) {
|
|
5599
5646
|
return x(this, arguments, void 0, function* ({ code: n, codeVerifier: r }) {
|
|
5600
5647
|
var i;
|
|
5601
|
-
const s = yield this.getCurrentUser(), o = ((i = s == null ? void 0 : s.user) === null || i === void 0 ? void 0 : i.type) === "guest", u = yield
|
|
5648
|
+
const s = yield this.getCurrentUser(), o = ((i = s == null ? void 0 : s.user) === null || i === void 0 ? void 0 : i.type) === "guest", u = yield er({
|
|
5602
5649
|
apiURI: this.config.apiURI,
|
|
5603
5650
|
appId: this.config.appId,
|
|
5604
5651
|
code: n,
|
|
@@ -5621,7 +5668,7 @@ class Lu {
|
|
|
5621
5668
|
signInWithIdToken(e) {
|
|
5622
5669
|
return x(this, arguments, void 0, function* ({ idToken: n, clientName: r, nonce: i }) {
|
|
5623
5670
|
var s;
|
|
5624
|
-
const o = yield this.getCurrentUser(), u = (s = o == null ? void 0 : o.user) === null || s === void 0 ? void 0 : s.refresh_token, c = yield
|
|
5671
|
+
const o = yield this.getCurrentUser(), u = (s = o == null ? void 0 : o.user) === null || s === void 0 ? void 0 : s.refresh_token, c = yield ou({
|
|
5625
5672
|
apiURI: this.config.apiURI,
|
|
5626
5673
|
appId: this.config.appId,
|
|
5627
5674
|
idToken: n,
|
|
@@ -5662,7 +5709,7 @@ class Lu {
|
|
|
5662
5709
|
// TODO: look into typing again
|
|
5663
5710
|
getPresence(e, n, r = {}) {
|
|
5664
5711
|
const i = this._rooms[n], s = this._presence[n];
|
|
5665
|
-
return !i || !s || !s.result ? null : Object.assign(Object.assign({},
|
|
5712
|
+
return !i || !s || !s.result ? null : Object.assign(Object.assign({}, hu(s.result, r, this._sessionId)), { isLoading: !i.isConnected, error: i.error });
|
|
5666
5713
|
}
|
|
5667
5714
|
// TODO: look into typing again
|
|
5668
5715
|
publishPresence(e, n, r) {
|
|
@@ -5712,24 +5759,24 @@ class Lu {
|
|
|
5712
5759
|
}
|
|
5713
5760
|
_notifyPresenceSub(e, n) {
|
|
5714
5761
|
const r = this.getPresence("", e, n);
|
|
5715
|
-
r && (n.prev && !
|
|
5762
|
+
r && (n.prev && !pu(r, n.prev) || (n.prev = r, n.cb(r)));
|
|
5716
5763
|
}
|
|
5717
5764
|
_patchPresencePeers(e, n) {
|
|
5718
5765
|
var r, i, s;
|
|
5719
5766
|
const o = ((i = (r = this._presence[e]) === null || r === void 0 ? void 0 : r.result) === null || i === void 0 ? void 0 : i.peers) || {};
|
|
5720
5767
|
let u = Object.fromEntries(Object.entries(o).map(([d, a]) => [d, { data: a }]));
|
|
5721
5768
|
(s = this._presence[e]) === null || s === void 0 || s.result;
|
|
5722
|
-
const c =
|
|
5769
|
+
const c = Lt(u, (d) => {
|
|
5723
5770
|
for (let [a, f, h] of n)
|
|
5724
5771
|
switch (f) {
|
|
5725
5772
|
case "+":
|
|
5726
|
-
|
|
5773
|
+
Zi(d, a, h);
|
|
5727
5774
|
break;
|
|
5728
5775
|
case "r":
|
|
5729
|
-
|
|
5776
|
+
Wn(d, a, h);
|
|
5730
5777
|
break;
|
|
5731
5778
|
case "-":
|
|
5732
|
-
|
|
5779
|
+
Ir(d, a);
|
|
5733
5780
|
break;
|
|
5734
5781
|
}
|
|
5735
5782
|
delete d[this._sessionId];
|
|
@@ -5740,8 +5787,8 @@ class Lu {
|
|
|
5740
5787
|
const r = Object.assign({}, n);
|
|
5741
5788
|
delete r[this._sessionId];
|
|
5742
5789
|
const i = Object.fromEntries(Object.entries(r).map(([s, o]) => [s, o.data]));
|
|
5743
|
-
this._presence =
|
|
5744
|
-
|
|
5790
|
+
this._presence = Lt(this._presence, (s) => {
|
|
5791
|
+
Wn(s, [e, "result", "peers"], i);
|
|
5745
5792
|
});
|
|
5746
5793
|
}
|
|
5747
5794
|
// --------
|
|
@@ -5786,14 +5833,14 @@ class Lu {
|
|
|
5786
5833
|
return x(this, void 0, void 0, function* () {
|
|
5787
5834
|
var i;
|
|
5788
5835
|
const s = yield this.getCurrentUser(), o = (i = s == null ? void 0 : s.user) === null || i === void 0 ? void 0 : i.refresh_token;
|
|
5789
|
-
return
|
|
5836
|
+
return au(Object.assign(Object.assign({}, r), { apiURI: this.config.apiURI, appId: this.config.appId, path: e, file: n, refreshToken: o }));
|
|
5790
5837
|
});
|
|
5791
5838
|
}
|
|
5792
5839
|
deleteFile(e) {
|
|
5793
5840
|
return x(this, void 0, void 0, function* () {
|
|
5794
5841
|
var n;
|
|
5795
5842
|
const r = yield this.getCurrentUser(), i = (n = r == null ? void 0 : r.user) === null || n === void 0 ? void 0 : n.refresh_token;
|
|
5796
|
-
return yield
|
|
5843
|
+
return yield cu({
|
|
5797
5844
|
apiURI: this.config.apiURI,
|
|
5798
5845
|
appId: this.config.appId,
|
|
5799
5846
|
path: e,
|
|
@@ -5806,20 +5853,20 @@ class Lu {
|
|
|
5806
5853
|
upload(e, n) {
|
|
5807
5854
|
return x(this, void 0, void 0, function* () {
|
|
5808
5855
|
var r;
|
|
5809
|
-
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
|
|
5856
|
+
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 du({
|
|
5810
5857
|
apiURI: this.config.apiURI,
|
|
5811
5858
|
appId: this.config.appId,
|
|
5812
5859
|
fileName: o,
|
|
5813
5860
|
refreshToken: s
|
|
5814
5861
|
});
|
|
5815
|
-
return yield
|
|
5862
|
+
return yield fu(u, n);
|
|
5816
5863
|
});
|
|
5817
5864
|
}
|
|
5818
5865
|
getDownloadUrl(e) {
|
|
5819
5866
|
return x(this, void 0, void 0, function* () {
|
|
5820
5867
|
var n;
|
|
5821
5868
|
const r = yield this.getCurrentUser(), i = (n = r == null ? void 0 : r.user) === null || n === void 0 ? void 0 : n.refresh_token;
|
|
5822
|
-
return yield
|
|
5869
|
+
return yield lu({
|
|
5823
5870
|
apiURI: this.config.apiURI,
|
|
5824
5871
|
appId: this.config.appId,
|
|
5825
5872
|
path: e,
|
|
@@ -5828,10 +5875,10 @@ class Lu {
|
|
|
5828
5875
|
});
|
|
5829
5876
|
}
|
|
5830
5877
|
}
|
|
5831
|
-
let
|
|
5832
|
-
function
|
|
5833
|
-
|
|
5834
|
-
const n =
|
|
5878
|
+
let Xe;
|
|
5879
|
+
function Wu(t, e) {
|
|
5880
|
+
Xe == null || Xe.dispose();
|
|
5881
|
+
const n = Hu(e), r = Bu(e, u), i = Ku(zu(t));
|
|
5835
5882
|
function s(a) {
|
|
5836
5883
|
var f;
|
|
5837
5884
|
a.source === i.element.contentWindow && ((f = a.data) === null || f === void 0 ? void 0 : f.type) === "close" && n.isVisible() && u();
|
|
@@ -5847,16 +5894,16 @@ function Fu(t, e) {
|
|
|
5847
5894
|
n.element.remove(), r.element.remove(), removeEventListener("keydown", o), removeEventListener("message", s);
|
|
5848
5895
|
}
|
|
5849
5896
|
function d() {
|
|
5850
|
-
document.body.appendChild(n.element), document.body.appendChild(r.element), addEventListener("keydown", o), addEventListener("message", s),
|
|
5897
|
+
document.body.appendChild(n.element), document.body.appendChild(r.element), addEventListener("keydown", o), addEventListener("message", s), Xe = {
|
|
5851
5898
|
dispose: c
|
|
5852
5899
|
};
|
|
5853
5900
|
}
|
|
5854
5901
|
return d();
|
|
5855
5902
|
}
|
|
5856
|
-
function
|
|
5857
|
-
return `${
|
|
5903
|
+
function zu(t) {
|
|
5904
|
+
return `${ln || ei ? "http://localhost:3000" : "https://instantdb.com"}/_devtool?appId=${t}`;
|
|
5858
5905
|
}
|
|
5859
|
-
function
|
|
5906
|
+
function Ku(t) {
|
|
5860
5907
|
const e = document.createElement("iframe");
|
|
5861
5908
|
return e.src = t, e.className = "instant-devtool-iframe", Object.assign(e.style, {
|
|
5862
5909
|
width: "100%",
|
|
@@ -5865,7 +5912,7 @@ function Vu(t) {
|
|
|
5865
5912
|
border: "none"
|
|
5866
5913
|
}), { element: e };
|
|
5867
5914
|
}
|
|
5868
|
-
function
|
|
5915
|
+
function Bu(t, e) {
|
|
5869
5916
|
const n = `
|
|
5870
5917
|
<svg width="32" height="32" viewBox="0 0 512 512" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
5871
5918
|
<rect width="512" height="512" fill="black"/>
|
|
@@ -5875,7 +5922,7 @@ function qu(t, e) {
|
|
|
5875
5922
|
return r.innerHTML = n, r.className = "instant-devtool-toggler", Object.assign(r.style, Object.assign(Object.assign({
|
|
5876
5923
|
// pos
|
|
5877
5924
|
position: "fixed"
|
|
5878
|
-
},
|
|
5925
|
+
}, Qu(t.position)), {
|
|
5879
5926
|
height: "32px",
|
|
5880
5927
|
width: "32px",
|
|
5881
5928
|
// layout
|
|
@@ -5890,7 +5937,7 @@ function qu(t, e) {
|
|
|
5890
5937
|
cursor: "pointer"
|
|
5891
5938
|
})), r.addEventListener("click", e), { element: r };
|
|
5892
5939
|
}
|
|
5893
|
-
function
|
|
5940
|
+
function Qu(t) {
|
|
5894
5941
|
switch (t) {
|
|
5895
5942
|
case "bottom-left":
|
|
5896
5943
|
return { bottom: "24px", left: "24px" };
|
|
@@ -5902,7 +5949,7 @@ function Wu(t) {
|
|
|
5902
5949
|
return { top: "24px", left: "24px" };
|
|
5903
5950
|
}
|
|
5904
5951
|
}
|
|
5905
|
-
function
|
|
5952
|
+
function Gu(t) {
|
|
5906
5953
|
switch (t) {
|
|
5907
5954
|
case "bottom-left":
|
|
5908
5955
|
return { bottom: "24px", right: "24px", left: "60px", top: "72px" };
|
|
@@ -5914,47 +5961,47 @@ function zu(t) {
|
|
|
5914
5961
|
return { top: "24px", right: "24px", left: "60px", bottom: "72px" };
|
|
5915
5962
|
}
|
|
5916
5963
|
}
|
|
5917
|
-
function
|
|
5964
|
+
function Hu(t) {
|
|
5918
5965
|
const e = document.createElement("div");
|
|
5919
|
-
Object.assign(e.style, Object.assign(Object.assign({ position: "fixed" },
|
|
5966
|
+
Object.assign(e.style, Object.assign(Object.assign({ position: "fixed" }, Gu(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";
|
|
5920
5967
|
function n() {
|
|
5921
5968
|
return e.style.display !== "none";
|
|
5922
5969
|
}
|
|
5923
5970
|
return { element: e, isVisible: n };
|
|
5924
5971
|
}
|
|
5925
|
-
const
|
|
5972
|
+
const Yu = {
|
|
5926
5973
|
apiURI: "https://api.instantdb.com",
|
|
5927
5974
|
websocketURI: "wss://api.instantdb.com/runtime/session"
|
|
5928
5975
|
};
|
|
5929
|
-
function
|
|
5976
|
+
function Ju() {
|
|
5930
5977
|
var t;
|
|
5931
5978
|
return globalThis.__instantDbSchemaHashStore = (t = globalThis.__instantDbSchemaHashStore) !== null && t !== void 0 ? t : /* @__PURE__ */ new WeakMap(), globalThis.__instantDbSchemaHashStore;
|
|
5932
5979
|
}
|
|
5933
|
-
function
|
|
5980
|
+
function Zu() {
|
|
5934
5981
|
var t;
|
|
5935
5982
|
return globalThis.__instantDbStore = (t = globalThis.__instantDbStore) !== null && t !== void 0 ? t : {}, globalThis.__instantDbStore;
|
|
5936
5983
|
}
|
|
5937
|
-
function
|
|
5984
|
+
function Yt(t) {
|
|
5938
5985
|
const e = t.__adminToken;
|
|
5939
5986
|
return t.appId + "_" + (t.websocketURI || "default_ws_uri") + "_" + (t.apiURI || "default_api_uri") + "_" + (e || "client_only") + "_" + t.useDateObjects;
|
|
5940
5987
|
}
|
|
5941
|
-
const
|
|
5942
|
-
class
|
|
5988
|
+
const Jt = Zu(), kt = Ju();
|
|
5989
|
+
class Xu {
|
|
5943
5990
|
constructor(e) {
|
|
5944
5991
|
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);
|
|
5945
5992
|
}
|
|
5946
5993
|
}
|
|
5947
|
-
class
|
|
5994
|
+
class ea {
|
|
5948
5995
|
constructor(e) {
|
|
5949
5996
|
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);
|
|
5950
5997
|
}
|
|
5951
5998
|
}
|
|
5952
|
-
function
|
|
5999
|
+
function ta(t) {
|
|
5953
6000
|
return JSON.parse(JSON.stringify(t));
|
|
5954
6001
|
}
|
|
5955
|
-
class
|
|
6002
|
+
class na {
|
|
5956
6003
|
constructor(e) {
|
|
5957
|
-
this.tx =
|
|
6004
|
+
this.tx = fn(), this._reactor = e, this.auth = new Xu(this._reactor), this.storage = new ea(this._reactor);
|
|
5958
6005
|
}
|
|
5959
6006
|
/**
|
|
5960
6007
|
* Use this to write data! You can create, update, delete, and link objects
|
|
@@ -6095,7 +6142,7 @@ class Zu {
|
|
|
6095
6142
|
};
|
|
6096
6143
|
}
|
|
6097
6144
|
shutdown() {
|
|
6098
|
-
delete
|
|
6145
|
+
delete Jt[Yt(this._reactor.config)], this._reactor.shutdown();
|
|
6099
6146
|
}
|
|
6100
6147
|
/**
|
|
6101
6148
|
* Use this for one-off queries.
|
|
@@ -6113,38 +6160,41 @@ class Zu {
|
|
|
6113
6160
|
queryOnce(e, n) {
|
|
6114
6161
|
return this._reactor.queryOnce(e, n);
|
|
6115
6162
|
}
|
|
6163
|
+
_syncTableExperimental(e, n) {
|
|
6164
|
+
return this._reactor.subscribeTable(e, n);
|
|
6165
|
+
}
|
|
6116
6166
|
}
|
|
6117
|
-
function
|
|
6167
|
+
function _r(t) {
|
|
6118
6168
|
if (!t)
|
|
6119
6169
|
return "0";
|
|
6120
|
-
if (
|
|
6121
|
-
return
|
|
6170
|
+
if (kt.get(t))
|
|
6171
|
+
return kt.get(t);
|
|
6122
6172
|
const e = N(t);
|
|
6123
|
-
return
|
|
6173
|
+
return kt.set(t, e), e;
|
|
6124
6174
|
}
|
|
6125
|
-
function
|
|
6126
|
-
return
|
|
6175
|
+
function ra(t, e) {
|
|
6176
|
+
return _r(t._reactor.config.schema) !== _r(e);
|
|
6127
6177
|
}
|
|
6128
|
-
function
|
|
6129
|
-
const s =
|
|
6178
|
+
function ia(t, e, n, r, i) {
|
|
6179
|
+
const s = Jt[Yt(t)];
|
|
6130
6180
|
if (s)
|
|
6131
|
-
return
|
|
6132
|
-
const o = new
|
|
6133
|
-
return
|
|
6181
|
+
return ra(s, t.schema) && s._reactor.updateSchema(t.schema), s;
|
|
6182
|
+
const o = new qu(Object.assign(Object.assign(Object.assign({}, Yu), t), { cardinalityInference: !!t.schema }), e || Jr, n || Zr, Object.assign(Object.assign({}, r || {}), { "@instantdb/core": ni }), i), u = new na(o);
|
|
6183
|
+
return Jt[Yt(t)] = u, sa(t.appId, t.devtool), u;
|
|
6134
6184
|
}
|
|
6135
|
-
function
|
|
6185
|
+
function sa(t, e) {
|
|
6136
6186
|
if (typeof window > "u" || typeof window.location > "u" || typeof document > "u" || typeof e == "boolean" && !e)
|
|
6137
6187
|
return;
|
|
6138
6188
|
const n = Object.assign({ position: "bottom-right", allowedHosts: ["localhost"] }, typeof e == "object" ? e : {});
|
|
6139
|
-
n.allowedHosts.includes(window.location.hostname) &&
|
|
6189
|
+
n.allowedHosts.includes(window.location.hostname) && Wu(t, n);
|
|
6140
6190
|
}
|
|
6141
|
-
const
|
|
6191
|
+
const oa = {
|
|
6142
6192
|
isLoading: !0,
|
|
6143
6193
|
data: void 0,
|
|
6144
6194
|
pageInfo: void 0,
|
|
6145
6195
|
error: void 0
|
|
6146
6196
|
};
|
|
6147
|
-
function
|
|
6197
|
+
function gr(t) {
|
|
6148
6198
|
return {
|
|
6149
6199
|
isLoading: !t,
|
|
6150
6200
|
data: void 0,
|
|
@@ -6153,12 +6203,12 @@ function yr(t) {
|
|
|
6153
6203
|
...t || {}
|
|
6154
6204
|
};
|
|
6155
6205
|
}
|
|
6156
|
-
function
|
|
6206
|
+
function ua(t, e, n) {
|
|
6157
6207
|
e && n && "ruleParams" in n && (e = { $$ruleParams: n.ruleParams, ...e });
|
|
6158
|
-
const r = e ?
|
|
6159
|
-
|
|
6208
|
+
const r = e ? ta(e) : null, i = N(r), s = it(
|
|
6209
|
+
gr(t._reactor.getPreviousResult(r))
|
|
6160
6210
|
), o = ae(
|
|
6161
|
-
(c) => (s.current =
|
|
6211
|
+
(c) => (s.current = gr(
|
|
6162
6212
|
t._reactor.getPreviousResult(r)
|
|
6163
6213
|
), r ? t.subscribeQuery(r, (a) => {
|
|
6164
6214
|
s.current = {
|
|
@@ -6173,15 +6223,15 @@ function ra(t, e, n) {
|
|
|
6173
6223
|
// Build a new subscribe function if the query changes
|
|
6174
6224
|
[i]
|
|
6175
6225
|
);
|
|
6176
|
-
return { state:
|
|
6226
|
+
return { state: It(
|
|
6177
6227
|
o,
|
|
6178
6228
|
() => s.current,
|
|
6179
|
-
() =>
|
|
6229
|
+
() => oa
|
|
6180
6230
|
), query: r };
|
|
6181
6231
|
}
|
|
6182
|
-
function
|
|
6183
|
-
const t =
|
|
6184
|
-
|
|
6232
|
+
function aa() {
|
|
6233
|
+
const t = it(null);
|
|
6234
|
+
ye(() => {
|
|
6185
6235
|
n();
|
|
6186
6236
|
}, []);
|
|
6187
6237
|
function e(r, i) {
|
|
@@ -6192,9 +6242,9 @@ function ia() {
|
|
|
6192
6242
|
}
|
|
6193
6243
|
return { set: e, clear: n };
|
|
6194
6244
|
}
|
|
6195
|
-
const
|
|
6196
|
-
function
|
|
6197
|
-
|
|
6245
|
+
const ca = 1e3;
|
|
6246
|
+
function da(t, e, n) {
|
|
6247
|
+
ye(() => t.core._reactor.subscribeTopic(
|
|
6198
6248
|
t.id,
|
|
6199
6249
|
e,
|
|
6200
6250
|
(i, s) => {
|
|
@@ -6202,8 +6252,8 @@ function oa(t, e, n) {
|
|
|
6202
6252
|
}
|
|
6203
6253
|
), [t.id, e]);
|
|
6204
6254
|
}
|
|
6205
|
-
function
|
|
6206
|
-
return
|
|
6255
|
+
function fa(t, e) {
|
|
6256
|
+
return ye(() => t.core._reactor.joinRoom(t.id), [t.id]), ae(
|
|
6207
6257
|
(r) => {
|
|
6208
6258
|
t.core._reactor.publishTopic({
|
|
6209
6259
|
roomType: t.type,
|
|
@@ -6215,13 +6265,13 @@ function ua(t, e) {
|
|
|
6215
6265
|
[t.id, e]
|
|
6216
6266
|
);
|
|
6217
6267
|
}
|
|
6218
|
-
function
|
|
6268
|
+
function la(t, e = {}) {
|
|
6219
6269
|
var o, u;
|
|
6220
|
-
const [n, r] =
|
|
6270
|
+
const [n, r] = wr(() => t.core._reactor.getPresence(t.type, t.id, e) ?? {
|
|
6221
6271
|
peers: {},
|
|
6222
6272
|
isLoading: !0
|
|
6223
6273
|
});
|
|
6224
|
-
|
|
6274
|
+
ye(() => t.core._reactor.subscribePresence(
|
|
6225
6275
|
t.type,
|
|
6226
6276
|
t.id,
|
|
6227
6277
|
e,
|
|
@@ -6235,18 +6285,18 @@ function aa(t, e = {}) {
|
|
|
6235
6285
|
},
|
|
6236
6286
|
[t.type, t.id]
|
|
6237
6287
|
);
|
|
6238
|
-
return
|
|
6288
|
+
return Pt(() => ({
|
|
6239
6289
|
...n,
|
|
6240
6290
|
publishPresence: i
|
|
6241
6291
|
}), [n, i]);
|
|
6242
6292
|
}
|
|
6243
|
-
function
|
|
6244
|
-
|
|
6293
|
+
function ha(t, e, n) {
|
|
6294
|
+
ye(() => t.core._reactor.joinRoom(t.id, e), [t.id]), ye(() => t.core._reactor.publishPresence(t.type, t.id, e), [t.type, t.id, n ?? JSON.stringify(e)]);
|
|
6245
6295
|
}
|
|
6246
|
-
function
|
|
6247
|
-
const r =
|
|
6296
|
+
function pa(t, e, n = {}) {
|
|
6297
|
+
const r = aa(), i = le.usePresence(t, {
|
|
6248
6298
|
keys: [e]
|
|
6249
|
-
}), s =
|
|
6299
|
+
}), s = Pt(() => {
|
|
6250
6300
|
const a = t._core._reactor.getPresence(
|
|
6251
6301
|
t.type,
|
|
6252
6302
|
t.id
|
|
@@ -6258,7 +6308,7 @@ function da(t, e, n = {}) {
|
|
|
6258
6308
|
(a) => {
|
|
6259
6309
|
t.core._reactor.publishPresence(t.type, t.id, {
|
|
6260
6310
|
[e]: a
|
|
6261
|
-
}), a && ((n == null ? void 0 : n.timeout) === null || (n == null ? void 0 : n.timeout) === 0 || r.set((n == null ? void 0 : n.timeout) ??
|
|
6311
|
+
}), a && ((n == null ? void 0 : n.timeout) === null || (n == null ? void 0 : n.timeout) === 0 || r.set((n == null ? void 0 : n.timeout) ?? ca, () => {
|
|
6262
6312
|
t.core._reactor.publishPresence(t.type, t.id, {
|
|
6263
6313
|
[e]: null
|
|
6264
6314
|
});
|
|
@@ -6273,56 +6323,56 @@ function da(t, e, n = {}) {
|
|
|
6273
6323
|
[n.stopOnEnter, o]
|
|
6274
6324
|
), c = ae(() => {
|
|
6275
6325
|
o(!1);
|
|
6276
|
-
}, [o]), d =
|
|
6326
|
+
}, [o]), d = Pt(() => ({ onKeyDown: u, onBlur: c }), [u, c]);
|
|
6277
6327
|
return {
|
|
6278
6328
|
active: s,
|
|
6279
6329
|
setActive: o,
|
|
6280
6330
|
inputProps: d
|
|
6281
6331
|
};
|
|
6282
6332
|
}
|
|
6283
|
-
const
|
|
6284
|
-
useTopicEffect:
|
|
6285
|
-
usePublishTopic:
|
|
6286
|
-
usePresence:
|
|
6287
|
-
useSyncPresence:
|
|
6288
|
-
useTypingIndicator:
|
|
6333
|
+
const le = {
|
|
6334
|
+
useTopicEffect: da,
|
|
6335
|
+
usePublishTopic: fa,
|
|
6336
|
+
usePresence: la,
|
|
6337
|
+
useSyncPresence: ha,
|
|
6338
|
+
useTypingIndicator: pa
|
|
6289
6339
|
};
|
|
6290
|
-
class
|
|
6340
|
+
class ya {
|
|
6291
6341
|
constructor(e, n, r) {
|
|
6292
6342
|
this.useTopicEffect = (i, s) => {
|
|
6293
|
-
|
|
6294
|
-
}, this.usePublishTopic = (i) =>
|
|
6343
|
+
le.useTopicEffect(this, i, s);
|
|
6344
|
+
}, this.usePublishTopic = (i) => le.usePublishTopic(this, i), this.usePresence = (i = {}) => le.usePresence(this, i), this.useSyncPresence = (i, s) => le.useSyncPresence(this, i, s), this.useTypingIndicator = (i, s = {}) => le.useTypingIndicator(this, i, s), this.core = e, this._core = this.core, this.type = n, this.id = r;
|
|
6295
6345
|
}
|
|
6296
6346
|
}
|
|
6297
|
-
const
|
|
6347
|
+
const ba = {
|
|
6298
6348
|
isLoading: !0,
|
|
6299
6349
|
user: void 0,
|
|
6300
6350
|
error: void 0
|
|
6301
6351
|
};
|
|
6302
|
-
class
|
|
6352
|
+
class ga {
|
|
6303
6353
|
constructor(e, n) {
|
|
6304
|
-
this.tx =
|
|
6305
|
-
const [i, s] =
|
|
6306
|
-
return
|
|
6354
|
+
this.tx = fn(), this.getLocalId = (r) => this.core.getLocalId(r), this.useLocalId = (r) => {
|
|
6355
|
+
const [i, s] = wr(null);
|
|
6356
|
+
return ye(() => {
|
|
6307
6357
|
(async () => {
|
|
6308
6358
|
const u = await this.getLocalId(r);
|
|
6309
6359
|
s(u);
|
|
6310
6360
|
})();
|
|
6311
6361
|
}, [r]), i;
|
|
6312
|
-
}, this.rooms =
|
|
6362
|
+
}, this.rooms = le, this.transact = (r) => this.core.transact(r), this.useQuery = (r, i) => ua(
|
|
6313
6363
|
this.core,
|
|
6314
6364
|
r,
|
|
6315
6365
|
i
|
|
6316
6366
|
).state, this.useAuth = () => {
|
|
6317
|
-
const r =
|
|
6367
|
+
const r = it(
|
|
6318
6368
|
this.core._reactor._currentUserCached
|
|
6319
6369
|
), i = ae((o) => this.core.subscribeAuth((c) => {
|
|
6320
6370
|
r.current = { isLoading: !1, ...c }, o();
|
|
6321
6371
|
}), []);
|
|
6322
|
-
return
|
|
6372
|
+
return It(
|
|
6323
6373
|
i,
|
|
6324
6374
|
() => r.current,
|
|
6325
|
-
() =>
|
|
6375
|
+
() => ba
|
|
6326
6376
|
);
|
|
6327
6377
|
}, this.useUser = () => {
|
|
6328
6378
|
const { user: r } = this.useAuth();
|
|
@@ -6332,12 +6382,12 @@ class pa {
|
|
|
6332
6382
|
);
|
|
6333
6383
|
return r;
|
|
6334
6384
|
}, this.useConnectionStatus = () => {
|
|
6335
|
-
const r =
|
|
6385
|
+
const r = it(
|
|
6336
6386
|
this.core._reactor.status
|
|
6337
6387
|
), i = ae((o) => this.core.subscribeConnectionStatus((c) => {
|
|
6338
6388
|
c !== r.current && (r.current = c, o());
|
|
6339
6389
|
}), []);
|
|
6340
|
-
return
|
|
6390
|
+
return It(
|
|
6341
6391
|
i,
|
|
6342
6392
|
() => r.current,
|
|
6343
6393
|
// For SSR, always return 'connecting' as the initial state
|
|
@@ -6345,11 +6395,11 @@ class pa {
|
|
|
6345
6395
|
);
|
|
6346
6396
|
}, this.queryOnce = (r, i) => this.core.queryOnce(r, i), this.SignedIn = ({ children: r }) => {
|
|
6347
6397
|
const i = this.useAuth();
|
|
6348
|
-
return i.isLoading || i.error || !i.user ? null : /* @__PURE__ */
|
|
6398
|
+
return i.isLoading || i.error || !i.user ? null : /* @__PURE__ */ Ye.jsx(Ye.Fragment, { children: r });
|
|
6349
6399
|
}, this.SignedOut = ({ children: r }) => {
|
|
6350
6400
|
const i = this.useAuth();
|
|
6351
|
-
return i.isLoading || i.error || i.user ? null : /* @__PURE__ */
|
|
6352
|
-
}, this.core =
|
|
6401
|
+
return i.isLoading || i.error || i.user ? null : /* @__PURE__ */ Ye.jsx(Ye.Fragment, { children: r });
|
|
6402
|
+
}, this.core = ia(
|
|
6353
6403
|
e,
|
|
6354
6404
|
// @ts-expect-error because TS can't resolve subclass statics
|
|
6355
6405
|
this.constructor.Storage,
|
|
@@ -6373,7 +6423,7 @@ class pa {
|
|
|
6373
6423
|
* const { peers } = db.rooms.usePresence(room);
|
|
6374
6424
|
*/
|
|
6375
6425
|
room(e = "_defaultRoomType", n = "_defaultRoomId") {
|
|
6376
|
-
return new
|
|
6426
|
+
return new ya(this.core, e, n);
|
|
6377
6427
|
}
|
|
6378
6428
|
/**
|
|
6379
6429
|
* One time query for the logged in state. This is useful
|
|
@@ -6390,5 +6440,5 @@ class pa {
|
|
|
6390
6440
|
}
|
|
6391
6441
|
}
|
|
6392
6442
|
export {
|
|
6393
|
-
|
|
6443
|
+
ga as InstantReactAbstractDatabase
|
|
6394
6444
|
};
|