@biglogic/rgs 3.9.13 → 3.9.20
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/README.md +26 -17
- package/core/hooks.d.ts +6 -2
- package/extension/rgs.vsix +0 -0
- package/index.cjs +509 -441
- package/index.d.ts +1 -1
- package/index.js +402 -332
- package/markdown/api.md +175 -0
- package/markdown/getting-started.md +32 -1
- package/markdown/security-architecture.md +6 -0
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -1,15 +1,10 @@
|
|
|
1
|
-
import { useMemo as e, useSyncExternalStore as t,
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
get: (e, t) => ("undefined" != typeof require ? require : e)[t]
|
|
5
|
-
}) : e)(function(e) {
|
|
6
|
-
if ("undefined" != typeof require) return require.apply(this, arguments);
|
|
7
|
-
throw Error('Dynamic require of "' + e + '" is not supported');
|
|
8
|
-
}), y = (e, t) => function() {
|
|
1
|
+
import { useMemo as e, useSyncExternalStore as t, useRef as n, useCallback as r, useDebugValue as s, useState as o, useEffect as a } from "react";
|
|
2
|
+
|
|
3
|
+
var i, c, l, u, f = Object.defineProperty, d = Object.getOwnPropertyNames, y = (e, t) => function() {
|
|
9
4
|
return e && (t = (0, e[d(e)[0]])(e = 0)), t;
|
|
10
5
|
}, p = y({
|
|
11
6
|
"core/utils.ts"() {
|
|
12
|
-
|
|
7
|
+
i = e => {
|
|
13
8
|
if (null === e || "object" != typeof e) return e;
|
|
14
9
|
if ("function" == typeof structuredClone) try {
|
|
15
10
|
return structuredClone(e);
|
|
@@ -35,20 +30,40 @@ var a, i, c, l, u = Object.defineProperty, d = Object.getOwnPropertyNames, f = (
|
|
|
35
30
|
return r;
|
|
36
31
|
};
|
|
37
32
|
return n(e);
|
|
38
|
-
},
|
|
33
|
+
}, c = (e, t) => {
|
|
39
34
|
if (e === t) return !0;
|
|
40
35
|
if (null === e || null === t) return e === t;
|
|
36
|
+
if (typeof e != typeof t) return !1;
|
|
37
|
+
if (e instanceof Date && t instanceof Date) return e.getTime() === t.getTime();
|
|
38
|
+
if (e instanceof RegExp && t instanceof RegExp) return e.source === t.source && e.flags === t.flags;
|
|
39
|
+
if (e instanceof Map && t instanceof Map) {
|
|
40
|
+
if (e.size !== t.size) return !1;
|
|
41
|
+
for (const [n, r] of e) if (!t.has(n) || !c(r, t.get(n))) return !1;
|
|
42
|
+
return !0;
|
|
43
|
+
}
|
|
44
|
+
if (e instanceof Set && t instanceof Set) {
|
|
45
|
+
if (e.size !== t.size) return !1;
|
|
46
|
+
for (const n of e) if (![ ...t ].some(e => c(n, e))) return !1;
|
|
47
|
+
return !0;
|
|
48
|
+
}
|
|
49
|
+
if (e instanceof ArrayBuffer && t instanceof ArrayBuffer) return e.byteLength === t.byteLength;
|
|
50
|
+
if (ArrayBuffer.isView(e) && ArrayBuffer.isView(t)) {
|
|
51
|
+
const n = e, r = t;
|
|
52
|
+
if (n.length !== r.length) return !1;
|
|
53
|
+
for (let e = 0; e < n.length; e++) if (n[e] !== r[e]) return !1;
|
|
54
|
+
return !0;
|
|
55
|
+
}
|
|
41
56
|
if ("object" != typeof e || "object" != typeof t) return e === t;
|
|
42
57
|
if (Array.isArray(e) && Array.isArray(t)) {
|
|
43
58
|
if (e.length !== t.length) return !1;
|
|
44
|
-
for (let n = 0; n < e.length; n++) if (!
|
|
59
|
+
for (let n = 0; n < e.length; n++) if (!c(e[n], t[n])) return !1;
|
|
45
60
|
return !0;
|
|
46
61
|
}
|
|
47
62
|
const n = Object.keys(e), r = Object.keys(t);
|
|
48
63
|
if (n.length !== r.length) return !1;
|
|
49
64
|
for (let r = 0; r < n.length; r++) {
|
|
50
65
|
const s = n[r];
|
|
51
|
-
if (!(s in t) || !
|
|
66
|
+
if (!(s in t) || !c(e[s], t[s])) return !1;
|
|
52
67
|
}
|
|
53
68
|
return !0;
|
|
54
69
|
};
|
|
@@ -56,18 +71,18 @@ var a, i, c, l, u = Object.defineProperty, d = Object.getOwnPropertyNames, f = (
|
|
|
56
71
|
}), h = {};
|
|
57
72
|
|
|
58
73
|
((e, t) => {
|
|
59
|
-
for (var n in t)
|
|
74
|
+
for (var n in t) f(e, n, {
|
|
60
75
|
get: t[n],
|
|
61
76
|
enumerable: !0
|
|
62
77
|
});
|
|
63
78
|
})(h, {
|
|
64
|
-
SyncEngine: () =>
|
|
65
|
-
createSyncEngine: () =>
|
|
79
|
+
SyncEngine: () => l,
|
|
80
|
+
createSyncEngine: () => u
|
|
66
81
|
});
|
|
67
82
|
|
|
68
83
|
var g = y({
|
|
69
84
|
"core/sync.ts"() {
|
|
70
|
-
p(),
|
|
85
|
+
p(), l = class {
|
|
71
86
|
store;
|
|
72
87
|
config;
|
|
73
88
|
pendingQueue=new Map;
|
|
@@ -124,7 +139,7 @@ var g = y({
|
|
|
124
139
|
const n = this.store._getVersion(e) || 1;
|
|
125
140
|
this.pendingQueue.set(e, {
|
|
126
141
|
key: e,
|
|
127
|
-
value:
|
|
142
|
+
value: i(t),
|
|
128
143
|
timestamp: Date.now(),
|
|
129
144
|
version: n
|
|
130
145
|
}), this._notifyStateChange(), this.syncTimer && clearTimeout(this.syncTimer), this.syncTimer = setTimeout(() => {
|
|
@@ -291,7 +306,7 @@ var g = y({
|
|
|
291
306
|
this.syncTimer && clearTimeout(this.syncTimer), this.pendingQueue.clear(), this.onlineStatusListeners.clear(),
|
|
292
307
|
this.syncStateListeners.clear();
|
|
293
308
|
}
|
|
294
|
-
},
|
|
309
|
+
}, u = (e, t) => new l(e, t);
|
|
295
310
|
}
|
|
296
311
|
}), m = Symbol.for("immer-nothing"), _ = Symbol.for("immer-draftable"), S = Symbol.for("immer-state"), w = [ function(e) {
|
|
297
312
|
return `The plugin for '${e}' has not been loaded into Immer. To enable the plugin, import and call \`enable${e}()\` when initializing your application.`;
|
|
@@ -307,54 +322,54 @@ var g = y({
|
|
|
307
322
|
|
|
308
323
|
function b(e, ...t) {
|
|
309
324
|
{
|
|
310
|
-
const n = w[e], r =
|
|
325
|
+
const n = w[e], r = K(n) ? n.apply(null, t) : n;
|
|
311
326
|
throw new Error(`[Immer] ${r}`);
|
|
312
327
|
}
|
|
313
328
|
}
|
|
314
329
|
|
|
315
|
-
var v = Object, E = v.getPrototypeOf, k = "constructor", O = "prototype", C = "configurable", D = "enumerable",
|
|
330
|
+
var v = Object, E = v.getPrototypeOf, k = "constructor", O = "prototype", C = "configurable", D = "enumerable", A = "writable", M = "value", j = e => !!e && !!e[S];
|
|
316
331
|
|
|
317
332
|
function R(e) {
|
|
318
|
-
return !!e && (I(e) || U(e) || !!e[_] || !!e[k]?.[_] || L(e) ||
|
|
333
|
+
return !!e && (I(e) || U(e) || !!e[_] || !!e[k]?.[_] || L(e) || B(e));
|
|
319
334
|
}
|
|
320
335
|
|
|
321
336
|
var P = v[O][k].toString(), T = new WeakMap;
|
|
322
337
|
|
|
323
338
|
function I(e) {
|
|
324
|
-
if (!e || !
|
|
339
|
+
if (!e || !F(e)) return !1;
|
|
325
340
|
const t = E(e);
|
|
326
341
|
if (null === t || t === v[O]) return !0;
|
|
327
342
|
const n = v.hasOwnProperty.call(t, k) && t[k];
|
|
328
343
|
if (n === Object) return !0;
|
|
329
|
-
if (!
|
|
344
|
+
if (!K(n)) return !1;
|
|
330
345
|
let r = T.get(n);
|
|
331
346
|
return void 0 === r && (r = Function.toString.call(n), T.set(n, r)), r === P;
|
|
332
347
|
}
|
|
333
348
|
|
|
334
349
|
function z(e, t, n = !0) {
|
|
335
|
-
if (0 ===
|
|
350
|
+
if (0 === V(e)) {
|
|
336
351
|
(n ? Reflect.ownKeys(e) : v.keys(e)).forEach(n => {
|
|
337
352
|
t(n, e[n], e);
|
|
338
353
|
});
|
|
339
354
|
} else e.forEach((n, r) => t(r, n, e));
|
|
340
355
|
}
|
|
341
356
|
|
|
342
|
-
function
|
|
357
|
+
function V(e) {
|
|
343
358
|
const t = e[S];
|
|
344
|
-
return t ? t.type_ : U(e) ? 1 : L(e) ? 2 :
|
|
359
|
+
return t ? t.type_ : U(e) ? 1 : L(e) ? 2 : B(e) ? 3 : 0;
|
|
345
360
|
}
|
|
346
361
|
|
|
347
|
-
var $ = (e, t, n =
|
|
362
|
+
var $ = (e, t, n = V(e)) => 2 === n ? e.has(t) : v[O].hasOwnProperty.call(e, t), x = (e, t, n = V(e)) => 2 === n ? e.get(t) : e[t], N = (e, t, n, r = V(e)) => {
|
|
348
363
|
2 === r ? e.set(t, n) : 3 === r ? e.add(n) : e[t] = n;
|
|
349
364
|
};
|
|
350
365
|
|
|
351
|
-
var U = Array.isArray, L = e => e instanceof Map,
|
|
366
|
+
var U = Array.isArray, L = e => e instanceof Map, B = e => e instanceof Set, F = e => "object" == typeof e, K = e => "function" == typeof e, J = e => "boolean" == typeof e;
|
|
352
367
|
|
|
353
|
-
var W = e => e.copy_ || e.base_,
|
|
368
|
+
var W = e => e.copy_ || e.base_, H = e => e.modified_ ? e.copy_ : e.base_;
|
|
354
369
|
|
|
355
|
-
function
|
|
370
|
+
function Q(e, t) {
|
|
356
371
|
if (L(e)) return new Map(e);
|
|
357
|
-
if (
|
|
372
|
+
if (B(e)) return new Set(e);
|
|
358
373
|
if (U(e)) return Array[O].slice.call(e);
|
|
359
374
|
const n = I(e);
|
|
360
375
|
if (!0 === t || "class_only" === t && !n) {
|
|
@@ -363,11 +378,11 @@ function q(e, t) {
|
|
|
363
378
|
let n = Reflect.ownKeys(t);
|
|
364
379
|
for (let r = 0; r < n.length; r++) {
|
|
365
380
|
const s = n[r], o = t[s];
|
|
366
|
-
!1 === o[
|
|
381
|
+
!1 === o[A] && (o[A] = !0, o[C] = !0), (o.get || o.set) && (t[s] = {
|
|
367
382
|
[C]: !0,
|
|
368
|
-
[
|
|
383
|
+
[A]: !0,
|
|
369
384
|
[D]: o[D],
|
|
370
|
-
[
|
|
385
|
+
[M]: e[s]
|
|
371
386
|
});
|
|
372
387
|
}
|
|
373
388
|
return v.create(E(e), t);
|
|
@@ -382,25 +397,25 @@ function q(e, t) {
|
|
|
382
397
|
}
|
|
383
398
|
}
|
|
384
399
|
|
|
385
|
-
function
|
|
386
|
-
return X(e) || j(e) || !R(e) || (
|
|
387
|
-
set:
|
|
388
|
-
add:
|
|
389
|
-
clear:
|
|
390
|
-
delete:
|
|
400
|
+
function G(e, t = !1) {
|
|
401
|
+
return X(e) || j(e) || !R(e) || (V(e) > 1 && v.defineProperties(e, {
|
|
402
|
+
set: q,
|
|
403
|
+
add: q,
|
|
404
|
+
clear: q,
|
|
405
|
+
delete: q
|
|
391
406
|
}), v.freeze(e), t && z(e, (e, t) => {
|
|
392
|
-
|
|
407
|
+
G(t, !0);
|
|
393
408
|
}, !1)), e;
|
|
394
409
|
}
|
|
395
410
|
|
|
396
|
-
var
|
|
397
|
-
[
|
|
411
|
+
var q = {
|
|
412
|
+
[M]: function() {
|
|
398
413
|
b(2);
|
|
399
414
|
}
|
|
400
415
|
};
|
|
401
416
|
|
|
402
417
|
function X(e) {
|
|
403
|
-
return null === e || !
|
|
418
|
+
return null === e || !F(e) || v.isFrozen(e);
|
|
404
419
|
}
|
|
405
420
|
|
|
406
421
|
var Z = "MapSet", Y = "Patches", ee = "ArrayMethods", te = {};
|
|
@@ -441,21 +456,21 @@ function ue(e) {
|
|
|
441
456
|
0 === t.type_ || 1 === t.type_ ? t.revoke_() : t.revoked_ = !0;
|
|
442
457
|
}
|
|
443
458
|
|
|
444
|
-
function
|
|
459
|
+
function fe(e, t) {
|
|
445
460
|
t.unfinalizedDrafts_ = t.drafts_.length;
|
|
446
461
|
const n = t.drafts_[0];
|
|
447
462
|
if (void 0 !== e && e !== n) {
|
|
448
|
-
n[S].modified_ && (ie(t), b(4)), R(e) && (e =
|
|
463
|
+
n[S].modified_ && (ie(t), b(4)), R(e) && (e = de(t, e));
|
|
449
464
|
const {patchPlugin_: r} = t;
|
|
450
465
|
r && r.generateReplacementPatches_(n[S].base_, e, t);
|
|
451
|
-
} else e =
|
|
466
|
+
} else e = de(t, n);
|
|
452
467
|
return function(e, t, n = !1) {
|
|
453
|
-
!e.parent_ && e.immer_.autoFreeze_ && e.canAutoFreeze_ &&
|
|
468
|
+
!e.parent_ && e.immer_.autoFreeze_ && e.canAutoFreeze_ && G(t, n);
|
|
454
469
|
}(t, e, !0), ie(t), t.patches_ && t.patchListener_(t.patches_, t.inversePatches_),
|
|
455
470
|
e !== m ? e : void 0;
|
|
456
471
|
}
|
|
457
472
|
|
|
458
|
-
function
|
|
473
|
+
function de(e, t) {
|
|
459
474
|
if (X(t)) return t;
|
|
460
475
|
const n = t[S];
|
|
461
476
|
if (!n) {
|
|
@@ -482,7 +497,7 @@ var pe = (e, t) => e.scope_ === t, he = [];
|
|
|
482
497
|
function ge(e, t, n, r) {
|
|
483
498
|
const s = W(e), o = e.type_;
|
|
484
499
|
if (void 0 !== r) {
|
|
485
|
-
if (
|
|
500
|
+
if (x(s, r, o) === t) return void N(s, r, n, o);
|
|
486
501
|
}
|
|
487
502
|
if (!e.draftLocations_) {
|
|
488
503
|
const t = e.draftLocations_ = new Map;
|
|
@@ -514,7 +529,7 @@ function _e(e, t, n) {
|
|
|
514
529
|
if (j(s)) {
|
|
515
530
|
const t = s[S];
|
|
516
531
|
if (pe(t, n)) {
|
|
517
|
-
const n =
|
|
532
|
+
const n = H(t);
|
|
518
533
|
N(e, r, n, e.type_), ye(t);
|
|
519
534
|
}
|
|
520
535
|
} else R(s) && _e(s, t, n);
|
|
@@ -530,7 +545,7 @@ var Se = {
|
|
|
530
545
|
const s = W(e);
|
|
531
546
|
if (!$(s, t, e.type_)) return function(e, t, n) {
|
|
532
547
|
const r = ve(t, n);
|
|
533
|
-
return r ?
|
|
548
|
+
return r ? M in r ? r[M] : r.get?.call(e.draft_) : void 0;
|
|
534
549
|
}(e, s, t);
|
|
535
550
|
const o = s[t];
|
|
536
551
|
if (e.finalized_ || !R(o)) return o;
|
|
@@ -564,12 +579,12 @@ var Se = {
|
|
|
564
579
|
const s = n[S];
|
|
565
580
|
pe(s, r) && s.callbacks_.push(function() {
|
|
566
581
|
ke(e);
|
|
567
|
-
const r =
|
|
582
|
+
const r = H(s);
|
|
568
583
|
ge(e, n, r, t);
|
|
569
584
|
});
|
|
570
585
|
} else R(n) && e.callbacks_.push(function() {
|
|
571
586
|
const s = W(e);
|
|
572
|
-
3 === e.type_ ? s.has(n) && _e(n, r.handledSet_, r) :
|
|
587
|
+
3 === e.type_ ? s.has(n) && _e(n, r.handledSet_, r) : x(s, t, e.type_) === n && r.drafts_.length > 1 && !0 === (e.assigned_.get(t) ?? !1) && e.copy_ && _e(x(e.copy_, t, e.type_), r.handledSet_, r);
|
|
573
588
|
});
|
|
574
589
|
}(e, t, n)), !0;
|
|
575
590
|
},
|
|
@@ -578,10 +593,10 @@ var Se = {
|
|
|
578
593
|
getOwnPropertyDescriptor(e, t) {
|
|
579
594
|
const n = W(e), r = Reflect.getOwnPropertyDescriptor(n, t);
|
|
580
595
|
return r ? {
|
|
581
|
-
[
|
|
596
|
+
[A]: !0,
|
|
582
597
|
[C]: 1 !== e.type_ || "length" !== t,
|
|
583
598
|
[D]: r[D],
|
|
584
|
-
[
|
|
599
|
+
[M]: n[t]
|
|
585
600
|
} : r;
|
|
586
601
|
},
|
|
587
602
|
defineProperty() {
|
|
@@ -621,7 +636,7 @@ function Ee(e) {
|
|
|
621
636
|
}
|
|
622
637
|
|
|
623
638
|
function ke(e) {
|
|
624
|
-
e.copy_ || (e.assigned_ = new Map, e.copy_ =
|
|
639
|
+
e.copy_ || (e.assigned_ = new Map, e.copy_ = Q(e.base_, e.scope_.immer_.useStrictShallowCopy_));
|
|
625
640
|
}
|
|
626
641
|
|
|
627
642
|
we.deleteProperty = function(e, t) {
|
|
@@ -631,7 +646,7 @@ we.deleteProperty = function(e, t) {
|
|
|
631
646
|
};
|
|
632
647
|
|
|
633
648
|
function Oe(e, t, n, r) {
|
|
634
|
-
const [s, o] = L(t) ? ne(Z).proxyMap_(t, n) :
|
|
649
|
+
const [s, o] = L(t) ? ne(Z).proxyMap_(t, n) : B(t) ? ne(Z).proxySet_(t, n) : function(e, t) {
|
|
635
650
|
const n = U(e), r = {
|
|
636
651
|
type_: n ? 1 : 0,
|
|
637
652
|
scope_: t ? t.scope_ : oe(),
|
|
@@ -657,7 +672,7 @@ function Oe(e, t, n, r) {
|
|
|
657
672
|
const s = t;
|
|
658
673
|
if (!s || !pe(s, r)) return;
|
|
659
674
|
r.mapSetPlugin_?.fixSetContents(s);
|
|
660
|
-
const o =
|
|
675
|
+
const o = H(s);
|
|
661
676
|
ge(e, s.draft_ ?? s, o, n), me(s, r);
|
|
662
677
|
});
|
|
663
678
|
}(n, o, r) : o.callbacks_.push(function(e) {
|
|
@@ -673,8 +688,8 @@ function Ce(e) {
|
|
|
673
688
|
let n, r = !0;
|
|
674
689
|
if (t) {
|
|
675
690
|
if (!t.modified_) return t.base_;
|
|
676
|
-
t.finalized_ = !0, n =
|
|
677
|
-
} else n =
|
|
691
|
+
t.finalized_ = !0, n = Q(e, t.scope_.immer_.useStrictShallowCopy_), r = t.scope_.immer_.shouldUseStrictIteration();
|
|
692
|
+
} else n = Q(e, !0);
|
|
678
693
|
return z(n, (e, t) => {
|
|
679
694
|
N(n, e, Ce(t));
|
|
680
695
|
}, r), t && (t.finalized_ = !1), n;
|
|
@@ -684,7 +699,7 @@ var De = (new class {
|
|
|
684
699
|
constructor(e) {
|
|
685
700
|
this.autoFreeze_ = !0, this.useStrictShallowCopy_ = !1, this.useStrictIteration_ = !1,
|
|
686
701
|
this.produce = (e, t, n) => {
|
|
687
|
-
if (
|
|
702
|
+
if (K(e) && !K(t)) {
|
|
688
703
|
const n = t;
|
|
689
704
|
t = e;
|
|
690
705
|
const r = this;
|
|
@@ -693,7 +708,7 @@ var De = (new class {
|
|
|
693
708
|
};
|
|
694
709
|
}
|
|
695
710
|
let r;
|
|
696
|
-
if (
|
|
711
|
+
if (K(t) || b(6), void 0 === n || K(n) || b(7), R(e)) {
|
|
697
712
|
const s = le(this), o = Oe(s, e, void 0);
|
|
698
713
|
let a = !0;
|
|
699
714
|
try {
|
|
@@ -701,10 +716,10 @@ var De = (new class {
|
|
|
701
716
|
} finally {
|
|
702
717
|
a ? ie(s) : ce(s);
|
|
703
718
|
}
|
|
704
|
-
return ae(s, n),
|
|
719
|
+
return ae(s, n), fe(r, s);
|
|
705
720
|
}
|
|
706
|
-
if (!e || !
|
|
707
|
-
if (r = t(e), void 0 === r && (r = e), r === m && (r = void 0), this.autoFreeze_ &&
|
|
721
|
+
if (!e || !F(e)) {
|
|
722
|
+
if (r = t(e), void 0 === r && (r = e), r === m && (r = void 0), this.autoFreeze_ && G(r, !0),
|
|
708
723
|
n) {
|
|
709
724
|
const t = [], s = [];
|
|
710
725
|
ne(Y).generateReplacementPatches_(e, r, {
|
|
@@ -716,13 +731,13 @@ var De = (new class {
|
|
|
716
731
|
}
|
|
717
732
|
b(1, e);
|
|
718
733
|
}, this.produceWithPatches = (e, t) => {
|
|
719
|
-
if (
|
|
734
|
+
if (K(e)) return (t, ...n) => this.produceWithPatches(t, t => e(t, ...n));
|
|
720
735
|
let n, r;
|
|
721
736
|
return [ this.produce(e, t, (e, t) => {
|
|
722
737
|
n = e, r = t;
|
|
723
738
|
}), n, r ];
|
|
724
|
-
},
|
|
725
|
-
|
|
739
|
+
}, J(e?.autoFreeze) && this.setAutoFreeze(e.autoFreeze), J(e?.useStrictShallowCopy) && this.setUseStrictShallowCopy(e.useStrictShallowCopy),
|
|
740
|
+
J(e?.useStrictIteration) && this.setUseStrictIteration(e.useStrictIteration);
|
|
726
741
|
}
|
|
727
742
|
createDraft(e) {
|
|
728
743
|
R(e) || b(8), j(e) && (e = function(e) {
|
|
@@ -736,7 +751,7 @@ var De = (new class {
|
|
|
736
751
|
const n = e && e[S];
|
|
737
752
|
n && n.isManual_ || b(9);
|
|
738
753
|
const {scope_: r} = n;
|
|
739
|
-
return ae(r, t),
|
|
754
|
+
return ae(r, t), fe(void 0, r);
|
|
740
755
|
}
|
|
741
756
|
setAutoFreeze(e) {
|
|
742
757
|
this.autoFreeze_ = e;
|
|
@@ -763,7 +778,7 @@ var De = (new class {
|
|
|
763
778
|
const r = ne(Y).applyPatches_;
|
|
764
779
|
return j(e) ? r(e, t) : this.produce(e, e => r(e, t));
|
|
765
780
|
}
|
|
766
|
-
}).produce,
|
|
781
|
+
}).produce, Ae = (e, t) => {
|
|
767
782
|
const n = Date.now();
|
|
768
783
|
if (/\(\.*\+\?\)\+/.test(e) || /\(\.*\?\)\*/.test(e)) return !1;
|
|
769
784
|
if (e.length > 500) return !1;
|
|
@@ -774,7 +789,7 @@ var De = (new class {
|
|
|
774
789
|
} catch {
|
|
775
790
|
return !1;
|
|
776
791
|
}
|
|
777
|
-
},
|
|
792
|
+
}, Me = () => {
|
|
778
793
|
if ("undefined" != typeof crypto && "function" == typeof crypto.randomUUID) try {
|
|
779
794
|
return crypto.randomUUID();
|
|
780
795
|
} catch {}
|
|
@@ -818,7 +833,7 @@ var De = (new class {
|
|
|
818
833
|
}, !0, [ "encrypt", "decrypt" ]),
|
|
819
834
|
iv: r
|
|
820
835
|
};
|
|
821
|
-
},
|
|
836
|
+
}, Ve = async (e, t) => {
|
|
822
837
|
const n = (new TextEncoder).encode(JSON.stringify(e)), r = await crypto.subtle.encrypt({
|
|
823
838
|
name: "AES-GCM",
|
|
824
839
|
iv: t.iv
|
|
@@ -830,20 +845,20 @@ var De = (new class {
|
|
|
830
845
|
iv: r
|
|
831
846
|
}, t.key, s);
|
|
832
847
|
return JSON.parse((new TextDecoder).decode(o));
|
|
833
|
-
},
|
|
834
|
-
|
|
848
|
+
}, xe = null, Ne = e => {
|
|
849
|
+
xe = e;
|
|
835
850
|
}, Ue = e => {
|
|
836
|
-
|
|
851
|
+
xe && xe(e);
|
|
837
852
|
}, Le = (e, t, n) => {
|
|
838
853
|
e.set(t instanceof RegExp ? t.source : t, n);
|
|
839
|
-
},
|
|
854
|
+
}, Be = (e, t, n, r) => {
|
|
840
855
|
if (0 === e.size) return !0;
|
|
841
856
|
for (const [s, o] of e) {
|
|
842
857
|
let e;
|
|
843
|
-
if (e = "function" == typeof s ? s(t, r) :
|
|
858
|
+
if (e = "function" == typeof s ? s(t, r) : Ae(s, t), e) return o.includes(n) || o.includes("admin");
|
|
844
859
|
}
|
|
845
860
|
return !1;
|
|
846
|
-
},
|
|
861
|
+
}, Fe = e => {
|
|
847
862
|
if ("string" == typeof e) {
|
|
848
863
|
let t = e.replace(/&#[xX]?[0-9a-fA-F]+;?/g, e => {
|
|
849
864
|
const t = e.match(/&#x([0-9a-fA-F]+);?/i);
|
|
@@ -859,15 +874,15 @@ var De = (new class {
|
|
|
859
874
|
if (e && "object" == typeof e && !Array.isArray(e)) {
|
|
860
875
|
if (Object.getPrototypeOf(e) === Object.prototype) {
|
|
861
876
|
const t = {};
|
|
862
|
-
for (const [n, r] of Object.entries(e)) t[n] =
|
|
877
|
+
for (const [n, r] of Object.entries(e)) t[n] = Fe(r);
|
|
863
878
|
return t;
|
|
864
879
|
}
|
|
865
880
|
return e;
|
|
866
881
|
}
|
|
867
|
-
return Array.isArray(e) ? e.map(e =>
|
|
868
|
-
},
|
|
882
|
+
return Array.isArray(e) ? e.map(e => Fe(e)) : e;
|
|
883
|
+
}, Ke = e => /^([a-zA-Z0-9_.-][a-zA-Z0-9_.-]*)$/.test(e) && e.length <= 256 && e.length > 0, Je = (e, t, n, r) => {
|
|
869
884
|
const s = {
|
|
870
|
-
id:
|
|
885
|
+
id: Me(),
|
|
871
886
|
purpose: n,
|
|
872
887
|
granted: r,
|
|
873
888
|
timestamp: Date.now()
|
|
@@ -883,19 +898,42 @@ var De = (new class {
|
|
|
883
898
|
|
|
884
899
|
p();
|
|
885
900
|
|
|
886
|
-
var We = e => `${e}_
|
|
901
|
+
var We = e => `${e}_`, He = e => {
|
|
902
|
+
if ("undefined" != typeof btoa) return btoa(e);
|
|
903
|
+
const t = globalThis;
|
|
904
|
+
if ("function" == typeof t.Buffer) {
|
|
905
|
+
return t.Buffer.from(e, "binary").toString("base64");
|
|
906
|
+
}
|
|
907
|
+
throw new Error("Base64 encoding not available in this environment");
|
|
908
|
+
}, Qe = e => {
|
|
909
|
+
if ("undefined" != typeof atob) return atob(e);
|
|
910
|
+
const t = globalThis;
|
|
911
|
+
if ("function" == typeof t.Buffer) {
|
|
912
|
+
return t.Buffer.from(e, "base64").toString("binary");
|
|
913
|
+
}
|
|
914
|
+
throw new Error("Base64 decoding not available in this environment");
|
|
915
|
+
};
|
|
887
916
|
|
|
888
917
|
p();
|
|
889
918
|
|
|
890
|
-
var
|
|
919
|
+
var Ge = () => {
|
|
891
920
|
try {
|
|
892
|
-
|
|
921
|
+
if ("production" === (() => {
|
|
922
|
+
try {
|
|
923
|
+
const e = globalThis;
|
|
924
|
+
if ("object" == typeof e.process && null !== e.process) {
|
|
925
|
+
const t = e.process;
|
|
926
|
+
if ("object" == typeof t.env && null !== t.env) return t.env;
|
|
927
|
+
}
|
|
928
|
+
} catch {}
|
|
929
|
+
return {};
|
|
930
|
+
})().NODE_ENV) return !0;
|
|
893
931
|
const e = "undefined" != typeof globalThis ? globalThis : "undefined" != typeof window ? window : {};
|
|
894
932
|
return void 0 !== e.__DEV__ && !1 === e.__DEV__;
|
|
895
933
|
} catch {
|
|
896
934
|
return !1;
|
|
897
935
|
}
|
|
898
|
-
}, qe = () => "undefined" != typeof window ? window.localStorage : null,
|
|
936
|
+
}, qe = () => !Ge(), Xe = () => "undefined" != typeof window ? window.localStorage : null, Ze = () => {
|
|
899
937
|
const e = new Map;
|
|
900
938
|
return {
|
|
901
939
|
getItem: t => e.get(t) || null,
|
|
@@ -906,13 +944,13 @@ var Qe = () => {
|
|
|
906
944
|
return e.size;
|
|
907
945
|
}
|
|
908
946
|
};
|
|
909
|
-
},
|
|
910
|
-
const t = new Map, n = new Map, r = new Map, s = new Set, o = new Map,
|
|
947
|
+
}, Ye = e => {
|
|
948
|
+
const t = new Map, n = new Map, r = new Map, s = new Set, o = new Map, a = new Set, l = new Map, u = new Map, f = new Map, d = new Map, y = new Map, p = new Map, m = new Map, _ = new Map, S = e?.namespace || "gstate", w = e?.silent ?? !1, b = e?.debounceTime ?? 150, v = e?.version ?? 0, E = e?.storage || Xe(), k = e?.onError, O = e?.maxObjectSize ?? 0, C = e?.maxTotalSize ?? 0, D = e?.encryptionKey ?? null, A = e?.validateInput ?? !0, M = e?.auditEnabled ?? !0, j = e?.userId, R = e?.immer ?? !0, P = e?.persistByDefault ?? e?.persistence ?? e?.persist ?? !1;
|
|
911
949
|
e?.accessRules && e.accessRules.forEach(e => Le(m, e.pattern, e.permissions));
|
|
912
|
-
let T, I = !1, z = !1,
|
|
950
|
+
let T, I = !1, z = !1, V = !1, $ = 0, x = null, N = null;
|
|
913
951
|
const U = new Promise(e => {
|
|
914
952
|
T = e;
|
|
915
|
-
}), L = () => `${S}_`,
|
|
953
|
+
}), L = () => `${S}_`, B = () => ({
|
|
916
954
|
store: t,
|
|
917
955
|
versions: n,
|
|
918
956
|
sizes: r,
|
|
@@ -926,11 +964,11 @@ var Qe = () => {
|
|
|
926
964
|
silent: w,
|
|
927
965
|
debounceTime: b,
|
|
928
966
|
currentVersion: v
|
|
929
|
-
}),
|
|
930
|
-
plugins:
|
|
967
|
+
}), F = () => ({
|
|
968
|
+
plugins: d,
|
|
931
969
|
onError: k,
|
|
932
970
|
silent: w
|
|
933
|
-
}),
|
|
971
|
+
}), K = e => {
|
|
934
972
|
if (null == e) return 0;
|
|
935
973
|
const t = typeof e;
|
|
936
974
|
if ("boolean" === t) return 4;
|
|
@@ -949,7 +987,7 @@ var Qe = () => {
|
|
|
949
987
|
}
|
|
950
988
|
}
|
|
951
989
|
return n;
|
|
952
|
-
},
|
|
990
|
+
}, J = (e, t) => {
|
|
953
991
|
((e, t, n) => {
|
|
954
992
|
if (0 !== e.plugins.size) for (const r of e.plugins.values()) {
|
|
955
993
|
const s = r.hooks?.[t];
|
|
@@ -963,9 +1001,9 @@ var Qe = () => {
|
|
|
963
1001
|
}) : e.silent;
|
|
964
1002
|
}
|
|
965
1003
|
}
|
|
966
|
-
})(
|
|
1004
|
+
})(F(), e, t);
|
|
967
1005
|
}, W = (e, t, n, r) => {
|
|
968
|
-
|
|
1006
|
+
M && null !== xe && Ue && Ue({
|
|
969
1007
|
timestamp: Date.now(),
|
|
970
1008
|
action: e,
|
|
971
1009
|
key: t,
|
|
@@ -973,24 +1011,24 @@ var Qe = () => {
|
|
|
973
1011
|
success: n,
|
|
974
1012
|
error: r
|
|
975
1013
|
});
|
|
976
|
-
},
|
|
1014
|
+
}, H = e => {
|
|
977
1015
|
const t = u.get(e);
|
|
978
1016
|
if (!t) return;
|
|
979
1017
|
const r = new Set, s = t.selector(e => (r.add(e), u.has(e) ? u.get(e).lastValue : Z.get(e)));
|
|
980
1018
|
t.deps.forEach(t => {
|
|
981
1019
|
if (!r.has(t)) {
|
|
982
|
-
const n =
|
|
983
|
-
n && (n.delete(e), 0 === n.size &&
|
|
1020
|
+
const n = f.get(t);
|
|
1021
|
+
n && (n.delete(e), 0 === n.size && f.delete(t));
|
|
984
1022
|
}
|
|
985
1023
|
}), r.forEach(n => {
|
|
986
|
-
t.deps.has(n) || (
|
|
987
|
-
}), t.deps = r,
|
|
988
|
-
n.set(e, (n.get(e) || 0) + 1),
|
|
989
|
-
},
|
|
1024
|
+
t.deps.has(n) || (f.has(n) || f.set(n, new Set), f.get(n).add(e));
|
|
1025
|
+
}), t.deps = r, c(t.lastValue, s) || (t.lastValue = R && null !== s && "object" == typeof s ? G(i(s), !0) : s,
|
|
1026
|
+
n.set(e, (n.get(e) || 0) + 1), Q(e));
|
|
1027
|
+
}, Q = e => {
|
|
990
1028
|
if (e) {
|
|
991
|
-
if (
|
|
992
|
-
const t =
|
|
993
|
-
for (const e of t)
|
|
1029
|
+
if (f.has(e)) {
|
|
1030
|
+
const t = f.get(e);
|
|
1031
|
+
for (const e of t) H(e);
|
|
994
1032
|
}
|
|
995
1033
|
const t = l.get(e);
|
|
996
1034
|
if (t) {
|
|
@@ -1024,7 +1062,7 @@ var Qe = () => {
|
|
|
1024
1062
|
operation: "listener"
|
|
1025
1063
|
});
|
|
1026
1064
|
}
|
|
1027
|
-
},
|
|
1065
|
+
}, q = async () => {
|
|
1028
1066
|
(async e => {
|
|
1029
1067
|
if (!e.storage) return;
|
|
1030
1068
|
const {store: t, config: n, diskQueue: r, storage: s, encryptionKey: o, audit: a, onError: i, silent: c, currentVersion: l} = e, u = We(n.namespace || "gstate");
|
|
@@ -1035,7 +1073,7 @@ var Qe = () => {
|
|
|
1035
1073
|
e[n] = t;
|
|
1036
1074
|
});
|
|
1037
1075
|
const o = n?.encoded;
|
|
1038
|
-
r = o ?
|
|
1076
|
+
r = o ? He(JSON.stringify(e)) : JSON.stringify(e), s.setItem(u.replace("_", ""), JSON.stringify({
|
|
1039
1077
|
v: 1,
|
|
1040
1078
|
t: Date.now(),
|
|
1041
1079
|
e: null,
|
|
@@ -1050,16 +1088,16 @@ var Qe = () => {
|
|
|
1050
1088
|
key: "FULL_STATE"
|
|
1051
1089
|
});
|
|
1052
1090
|
}
|
|
1053
|
-
const
|
|
1091
|
+
const f = Array.from(r.entries());
|
|
1054
1092
|
r.clear();
|
|
1055
|
-
for (const [t, n] of
|
|
1093
|
+
for (const [t, n] of f) try {
|
|
1056
1094
|
if (!t || !/^[a-zA-Z0-9_.-]+$/.test(t) || t.length > 256) continue;
|
|
1057
1095
|
let r = n.value;
|
|
1058
1096
|
const i = n.options.encoded || n.options.encrypted || n.options.secure;
|
|
1059
1097
|
if (n.options.encrypted) {
|
|
1060
1098
|
if (!o) throw new Error(`Encryption key missing for "${t}"`);
|
|
1061
|
-
r = await
|
|
1062
|
-
} else i ? r =
|
|
1099
|
+
r = await Ve(n.value, o);
|
|
1100
|
+
} else i ? r = He(JSON.stringify(n.value)) : "object" == typeof n.value && null !== n.value && (r = JSON.stringify(n.value));
|
|
1063
1101
|
s.setItem(`${u}${t}`, JSON.stringify({
|
|
1064
1102
|
v: e.versions.get(t) || 1,
|
|
1065
1103
|
t: Date.now(),
|
|
@@ -1076,30 +1114,30 @@ var Qe = () => {
|
|
|
1076
1114
|
key: t
|
|
1077
1115
|
});
|
|
1078
1116
|
}
|
|
1079
|
-
})(
|
|
1117
|
+
})(B());
|
|
1080
1118
|
}, X = {}, Z = {
|
|
1081
1119
|
_setSilently: (e, s) => {
|
|
1082
|
-
const o = r.get(e) || 0,
|
|
1083
|
-
$ = $ - o + c, r.set(e, c), t.set(e,
|
|
1120
|
+
const o = r.get(e) || 0, a = R && null !== s && "object" == typeof s ? G(i(s), !0) : s, c = (O > 0 || C > 0) && !Ge() ? K(a) : 0;
|
|
1121
|
+
$ = $ - o + c, r.set(e, c), t.set(e, a), n.set(e, (n.get(e) || 0) + 1), N = null;
|
|
1084
1122
|
},
|
|
1085
1123
|
_registerMethod: (e, t, n) => {
|
|
1086
1124
|
const r = e => "__proto__" === e || "constructor" === e || "prototype" === e;
|
|
1087
1125
|
r(e) || r(t) || (X[e] || (X[e] = {}), X[e][t] = n);
|
|
1088
1126
|
},
|
|
1089
|
-
set: (s, o,
|
|
1127
|
+
set: (s, o, a = {}) => {
|
|
1090
1128
|
const l = t.get(s), u = R && "function" == typeof o ? De(l, o) : o;
|
|
1091
|
-
if (
|
|
1092
|
-
if (!
|
|
1093
|
-
const
|
|
1094
|
-
|
|
1129
|
+
if (A && !Ke(s)) return !1;
|
|
1130
|
+
if (!Be(m, s, "write", j)) return W("set", s, !1, "RBAC Denied"), !1;
|
|
1131
|
+
const f = A ? Fe(u) : u, d = r.get(s) || 0;
|
|
1132
|
+
J("onBeforeSet", {
|
|
1095
1133
|
key: s,
|
|
1096
|
-
value:
|
|
1134
|
+
value: f,
|
|
1097
1135
|
store: Z,
|
|
1098
1136
|
version: n.get(s) || 0
|
|
1099
1137
|
});
|
|
1100
|
-
const p = R && null !==
|
|
1101
|
-
if (!
|
|
1102
|
-
const o = (O > 0 || C > 0) && !
|
|
1138
|
+
const p = R && null !== f && "object" == typeof f ? G(i(f), !0) : f;
|
|
1139
|
+
if (!c(l, p)) {
|
|
1140
|
+
const o = (O > 0 || C > 0) && !Ge() ? K(p) : 0;
|
|
1103
1141
|
if (O > 0 && o > O) {
|
|
1104
1142
|
const e = new Error(`Object size (${o} bytes) exceeds maxObjectSize (${O} bytes)`);
|
|
1105
1143
|
return k && k(e, {
|
|
@@ -1108,7 +1146,7 @@ var Qe = () => {
|
|
|
1108
1146
|
}), !1;
|
|
1109
1147
|
}
|
|
1110
1148
|
if (C > 0) {
|
|
1111
|
-
const e = $ -
|
|
1149
|
+
const e = $ - d + o;
|
|
1112
1150
|
if (e > C) {
|
|
1113
1151
|
const t = new Error(`Total store size (${e} bytes) exceeds limit (${C} bytes)`);
|
|
1114
1152
|
return k && k(t, {
|
|
@@ -1116,28 +1154,28 @@ var Qe = () => {
|
|
|
1116
1154
|
}), !1;
|
|
1117
1155
|
}
|
|
1118
1156
|
}
|
|
1119
|
-
$ = $ -
|
|
1120
|
-
const
|
|
1121
|
-
return
|
|
1157
|
+
$ = $ - d + o, r.set(s, o), t.set(s, p), n.set(s, (n.get(s) || 0) + 1), N = null;
|
|
1158
|
+
const i = a.persist ?? P;
|
|
1159
|
+
return i && (y.set(s, {
|
|
1122
1160
|
value: p,
|
|
1123
1161
|
options: {
|
|
1124
|
-
...
|
|
1125
|
-
persist:
|
|
1126
|
-
encoded:
|
|
1162
|
+
...a,
|
|
1163
|
+
persist: i,
|
|
1164
|
+
encoded: a.encoded || e?.encoded
|
|
1127
1165
|
}
|
|
1128
|
-
}),
|
|
1166
|
+
}), x && clearTimeout(x), x = setTimeout(q, b)), J("onSet", {
|
|
1129
1167
|
key: s,
|
|
1130
1168
|
value: p,
|
|
1131
1169
|
store: Z,
|
|
1132
1170
|
version: n.get(s)
|
|
1133
|
-
}), W("set", s, !0),
|
|
1171
|
+
}), W("set", s, !0), Q(s), !0;
|
|
1134
1172
|
}
|
|
1135
1173
|
return !1;
|
|
1136
1174
|
},
|
|
1137
1175
|
get: e => {
|
|
1138
|
-
if (!
|
|
1176
|
+
if (!Be(m, e, "read", j)) return W("get", e, !1, "RBAC Denied"), null;
|
|
1139
1177
|
const n = t.get(e);
|
|
1140
|
-
return
|
|
1178
|
+
return J("onGet", {
|
|
1141
1179
|
store: Z,
|
|
1142
1180
|
key: e,
|
|
1143
1181
|
value: n
|
|
@@ -1149,7 +1187,7 @@ var Qe = () => {
|
|
|
1149
1187
|
selector: t,
|
|
1150
1188
|
lastValue: null,
|
|
1151
1189
|
deps: new Set
|
|
1152
|
-
}),
|
|
1190
|
+
}), H(e)), u.get(e).lastValue;
|
|
1153
1191
|
} catch (t) {
|
|
1154
1192
|
const n = t instanceof Error ? t : new Error(String(t));
|
|
1155
1193
|
return k && k(n, {
|
|
@@ -1166,14 +1204,14 @@ var Qe = () => {
|
|
|
1166
1204
|
};
|
|
1167
1205
|
},
|
|
1168
1206
|
remove: e => {
|
|
1169
|
-
if (!
|
|
1207
|
+
if (!Be(m, e, "delete", j)) return W("delete", e, !1, "RBAC Denied"), !1;
|
|
1170
1208
|
const s = t.get(e), o = t.delete(e);
|
|
1171
|
-
return o && ($ -= r.get(e) || 0, r.delete(e),
|
|
1209
|
+
return o && ($ -= r.get(e) || 0, r.delete(e), J("onRemove", {
|
|
1172
1210
|
store: Z,
|
|
1173
1211
|
key: e,
|
|
1174
1212
|
value: s
|
|
1175
1213
|
}), N = null), n.set(e, (n.get(e) || 0) + 1), E && E.removeItem(`${L()}${e}`), W("delete", e, !0),
|
|
1176
|
-
|
|
1214
|
+
Q(e), o;
|
|
1177
1215
|
},
|
|
1178
1216
|
delete: e => Z.remove(e),
|
|
1179
1217
|
deleteAll: () => {
|
|
@@ -1189,28 +1227,28 @@ var Qe = () => {
|
|
|
1189
1227
|
},
|
|
1190
1228
|
list: () => Object.fromEntries(t.entries()),
|
|
1191
1229
|
use: e => {
|
|
1192
|
-
|
|
1230
|
+
a.add(e);
|
|
1193
1231
|
},
|
|
1194
1232
|
transaction: e => {
|
|
1195
|
-
I = !0,
|
|
1233
|
+
I = !0, J("onTransaction", {
|
|
1196
1234
|
store: Z,
|
|
1197
1235
|
key: "START"
|
|
1198
1236
|
});
|
|
1199
1237
|
try {
|
|
1200
1238
|
e();
|
|
1201
1239
|
} finally {
|
|
1202
|
-
I = !1,
|
|
1240
|
+
I = !1, J("onTransaction", {
|
|
1203
1241
|
store: Z,
|
|
1204
1242
|
key: "END"
|
|
1205
|
-
}), z && (z = !1,
|
|
1243
|
+
}), z && (z = !1, Q());
|
|
1206
1244
|
}
|
|
1207
1245
|
},
|
|
1208
1246
|
destroy: () => {
|
|
1209
|
-
|
|
1210
|
-
|
|
1247
|
+
x && (clearTimeout(x), x = null), y.clear(), "undefined" != typeof window && window.removeEventListener("beforeunload", Y),
|
|
1248
|
+
J("onDestroy", {
|
|
1211
1249
|
store: Z
|
|
1212
|
-
}), s.clear(), o.clear(), l.clear(), u.clear(),
|
|
1213
|
-
r.clear(), $ = 0, m.clear(), _.clear(), n.clear(), p.clear(),
|
|
1250
|
+
}), s.clear(), o.clear(), l.clear(), u.clear(), f.clear(), d.clear(), t.clear(),
|
|
1251
|
+
r.clear(), $ = 0, m.clear(), _.clear(), n.clear(), p.clear(), a.clear();
|
|
1214
1252
|
},
|
|
1215
1253
|
_addPlugin: e => {
|
|
1216
1254
|
((e, t, n) => {
|
|
@@ -1225,10 +1263,10 @@ var Qe = () => {
|
|
|
1225
1263
|
key: t.name
|
|
1226
1264
|
}) : e.silent;
|
|
1227
1265
|
}
|
|
1228
|
-
})(
|
|
1266
|
+
})(F(), e, Z);
|
|
1229
1267
|
},
|
|
1230
1268
|
_removePlugin: e => {
|
|
1231
|
-
|
|
1269
|
+
d.delete(e);
|
|
1232
1270
|
},
|
|
1233
1271
|
_subscribe: (e, t) => {
|
|
1234
1272
|
if (t) {
|
|
@@ -1242,8 +1280,8 @@ var Qe = () => {
|
|
|
1242
1280
|
},
|
|
1243
1281
|
_getVersion: e => n.get(e) ?? 0,
|
|
1244
1282
|
addAccessRule: (e, t) => Le(m, e, t),
|
|
1245
|
-
hasPermission: (e, t, n) =>
|
|
1246
|
-
recordConsent: (e, t, n) =>
|
|
1283
|
+
hasPermission: (e, t, n) => Be(m, e, t, n),
|
|
1284
|
+
recordConsent: (e, t, n) => Je(_, e, t, n),
|
|
1247
1285
|
hasConsent: (e, t) => ((e, t, n) => {
|
|
1248
1286
|
const r = e.get(t);
|
|
1249
1287
|
if (!r) return !1;
|
|
@@ -1254,7 +1292,7 @@ var Qe = () => {
|
|
|
1254
1292
|
return !1;
|
|
1255
1293
|
})(_, e, t),
|
|
1256
1294
|
getConsents: e => ((e, t) => e.get(t) || [])(_, e),
|
|
1257
|
-
revokeConsent: (e, t) => ((e, t, n) =>
|
|
1295
|
+
revokeConsent: (e, t) => ((e, t, n) => Je(e, t, n, !1))(_, e, t),
|
|
1258
1296
|
exportUserData: e => ((e, t) => ({
|
|
1259
1297
|
userId: t,
|
|
1260
1298
|
exportedAt: Date.now(),
|
|
@@ -1272,7 +1310,7 @@ var Qe = () => {
|
|
|
1272
1310
|
return X;
|
|
1273
1311
|
},
|
|
1274
1312
|
get isReady() {
|
|
1275
|
-
return
|
|
1313
|
+
return V;
|
|
1276
1314
|
},
|
|
1277
1315
|
get namespace() {
|
|
1278
1316
|
return S;
|
|
@@ -1287,11 +1325,11 @@ var Qe = () => {
|
|
|
1287
1325
|
t && Z._registerMethod("security", e, t);
|
|
1288
1326
|
});
|
|
1289
1327
|
const Y = () => {
|
|
1290
|
-
y.size > 0 &&
|
|
1328
|
+
y.size > 0 && q();
|
|
1291
1329
|
};
|
|
1292
1330
|
if ("undefined" != typeof window && window.addEventListener("beforeunload", Y),
|
|
1293
1331
|
E ? (async (e, t, n) => {
|
|
1294
|
-
const {storage: r, config: s, encryptionKey: o, audit:
|
|
1332
|
+
const {storage: r, config: s, encryptionKey: o, audit: a, onError: c, silent: l, currentVersion: u, store: f, sizes: d, versions: y} = e, p = We(s.namespace || "gstate"), h = s.immer ?? !0;
|
|
1295
1333
|
if (r) try {
|
|
1296
1334
|
const l = {};
|
|
1297
1335
|
let g = 0;
|
|
@@ -1300,20 +1338,20 @@ var Qe = () => {
|
|
|
1300
1338
|
if (!t || !t.startsWith(p)) continue;
|
|
1301
1339
|
const n = r.getItem(t);
|
|
1302
1340
|
if (n) try {
|
|
1303
|
-
const s = JSON.parse(n),
|
|
1341
|
+
const s = JSON.parse(n), i = t.substring(p.length);
|
|
1304
1342
|
if (g = Math.max(g, void 0 !== s._sys_v ? s._sys_v : s.v || 0), s.e && Date.now() > s.e) {
|
|
1305
1343
|
r.removeItem(t), e--;
|
|
1306
1344
|
continue;
|
|
1307
1345
|
}
|
|
1308
1346
|
let c = s.d;
|
|
1309
1347
|
if (s._enc && o) c = await $e(c, o); else if ("string" == typeof c) if (s._b64) try {
|
|
1310
|
-
c = JSON.parse(
|
|
1348
|
+
c = JSON.parse(Qe(c));
|
|
1311
1349
|
} catch (e) {} else if (c.startsWith("{") || c.startsWith("[")) try {
|
|
1312
1350
|
c = JSON.parse(c);
|
|
1313
1351
|
} catch (e) {}
|
|
1314
|
-
l[
|
|
1352
|
+
l[i] = c, a("hydrate", i, !0);
|
|
1315
1353
|
} catch (e) {
|
|
1316
|
-
|
|
1354
|
+
a("hydrate", t, !1, String(e));
|
|
1317
1355
|
const n = e instanceof Error ? e : new Error(String(e));
|
|
1318
1356
|
c && c(n, {
|
|
1319
1357
|
operation: "hydration",
|
|
@@ -1323,8 +1361,8 @@ var Qe = () => {
|
|
|
1323
1361
|
}
|
|
1324
1362
|
const m = g < u && s.migrate ? s.migrate(l, g) : l;
|
|
1325
1363
|
Object.entries(m).forEach(([n, r]) => {
|
|
1326
|
-
const s = h && null !== r && "object" == typeof r ?
|
|
1327
|
-
e.totalSize = e.totalSize -
|
|
1364
|
+
const s = h && null !== r && "object" == typeof r ? G(i(r), !0) : r, o = t(s), a = d.get(n) || 0;
|
|
1365
|
+
e.totalSize = e.totalSize - a + o, d.set(n, o), f.set(n, s), y.set(n, 1);
|
|
1328
1366
|
}), n();
|
|
1329
1367
|
} catch (e) {
|
|
1330
1368
|
const t = e instanceof Error ? e : new Error(String(e));
|
|
@@ -1332,9 +1370,9 @@ var Qe = () => {
|
|
|
1332
1370
|
operation: "hydration"
|
|
1333
1371
|
});
|
|
1334
1372
|
}
|
|
1335
|
-
})(
|
|
1336
|
-
|
|
1337
|
-
}).then(() => {}) : (
|
|
1373
|
+
})(B(), e => (O > 0 || C > 0) && !Ge() ? K(e) : 0, () => {
|
|
1374
|
+
V = !0, N = null, T(), Q();
|
|
1375
|
+
}).then(() => {}) : (V = !0, T()), e?.sync) {
|
|
1338
1376
|
const t = e.sync, n = async () => {
|
|
1339
1377
|
const {SyncEngine: e} = await Promise.resolve().then(() => (g(), h));
|
|
1340
1378
|
return new e(Z, t);
|
|
@@ -1359,18 +1397,44 @@ var Qe = () => {
|
|
|
1359
1397
|
|
|
1360
1398
|
g();
|
|
1361
1399
|
|
|
1362
|
-
var
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1400
|
+
var et = new Map, tt = "__default__";
|
|
1401
|
+
|
|
1402
|
+
"undefined" != typeof module && module.hot && module.hot.dispose(() => {
|
|
1403
|
+
et.forEach(e => {
|
|
1404
|
+
try {
|
|
1405
|
+
e.destroy();
|
|
1406
|
+
} catch {}
|
|
1407
|
+
}), et.clear();
|
|
1408
|
+
});
|
|
1409
|
+
|
|
1410
|
+
var nt = e => {
|
|
1411
|
+
const t = e?.namespace || tt, n = et.get(t);
|
|
1412
|
+
if (n) return !e?.silent && qe(), n;
|
|
1413
|
+
const r = Ye(e);
|
|
1414
|
+
return et.set(t, r), r;
|
|
1415
|
+
}, rt = e => {
|
|
1416
|
+
const t = e || tt, n = et.get(t);
|
|
1417
|
+
n && (n.destroy(), et.delete(t));
|
|
1418
|
+
}, st = () => {
|
|
1419
|
+
et.forEach(e => {
|
|
1420
|
+
try {
|
|
1421
|
+
e.destroy();
|
|
1422
|
+
} catch {}
|
|
1423
|
+
}), et.clear();
|
|
1424
|
+
}, ot = () => et.get(tt) || null, at = e => et.get(e) || null, it = (e, t) => {
|
|
1425
|
+
et.set(e, t);
|
|
1426
|
+
}, ct = e => {
|
|
1427
|
+
et.delete(e);
|
|
1428
|
+
}, lt = n => {
|
|
1429
|
+
const r = n || ot(), s = e(() => e => r ? r._subscribe(e) : () => {}, [ r ]);
|
|
1369
1430
|
return t(s, () => !!r && r.isReady, () => !0);
|
|
1370
|
-
}
|
|
1431
|
+
};
|
|
1371
1432
|
|
|
1372
|
-
function
|
|
1373
|
-
const
|
|
1433
|
+
function ut(o, a) {
|
|
1434
|
+
const i = e(() => a || (() => {
|
|
1435
|
+
const e = ot();
|
|
1436
|
+
return !e && Ge(), e;
|
|
1437
|
+
})(), [ a ]), c = e(() => {
|
|
1374
1438
|
const e = () => {}, t = () => !1, n = () => null;
|
|
1375
1439
|
return {
|
|
1376
1440
|
set: t,
|
|
@@ -1403,61 +1467,70 @@ function nt(s, o) {
|
|
|
1403
1467
|
},
|
|
1404
1468
|
get userId() {}
|
|
1405
1469
|
};
|
|
1406
|
-
}, []),
|
|
1407
|
-
|
|
1408
|
-
|
|
1470
|
+
}, []), l = i || c, u = !i, f = "function" == typeof o, d = f ? null : o, y = f ? o : null, p = n(!1);
|
|
1471
|
+
!u || f || Ge() || p.current || (p.current = !0);
|
|
1472
|
+
const h = r(e => f ? l._subscribe(e) : l._subscribe(e, d), [ l, f, d ]), g = r(() => f ? y(l.getSnapshot()) : l.get(d) ?? void 0, [ l, f, d, y ]), m = r(() => {
|
|
1473
|
+
if (f) try {
|
|
1474
|
+
const e = new Proxy({}, {
|
|
1475
|
+
get: () => {},
|
|
1476
|
+
has: () => !1
|
|
1477
|
+
});
|
|
1478
|
+
return y(e);
|
|
1409
1479
|
} catch {
|
|
1410
1480
|
return;
|
|
1411
1481
|
}
|
|
1412
|
-
}, [
|
|
1413
|
-
return
|
|
1414
|
-
|
|
1482
|
+
}, [ y, f ]), _ = t(h, g, m), S = r((e, t) => f ? (Ge(), !1) : !!i && l.set(d, e, t), [ l, f, d, i ]);
|
|
1483
|
+
return s(_, e => f ? `Selector: ${JSON.stringify(e)}` : `${d}: ${JSON.stringify(e)}`),
|
|
1484
|
+
f ? _ : [ _, S ];
|
|
1415
1485
|
}
|
|
1416
1486
|
|
|
1417
|
-
var
|
|
1487
|
+
var ft = new Map, dt = (e, t) => {
|
|
1418
1488
|
const n = e.namespace;
|
|
1419
|
-
if (
|
|
1420
|
-
const r = new
|
|
1421
|
-
return
|
|
1422
|
-
},
|
|
1423
|
-
const t =
|
|
1424
|
-
t && (t.destroy(),
|
|
1489
|
+
if (ft.has(n)) return ft.get(n);
|
|
1490
|
+
const r = new l(e, t);
|
|
1491
|
+
return ft.set(n, r), r;
|
|
1492
|
+
}, yt = e => {
|
|
1493
|
+
const t = ft.get(e);
|
|
1494
|
+
t && (t.destroy(), ft.delete(e));
|
|
1425
1495
|
};
|
|
1426
1496
|
|
|
1427
|
-
function
|
|
1428
|
-
const
|
|
1497
|
+
function pt(e, t) {
|
|
1498
|
+
const n = t || ot(), s = n?.namespace || "default";
|
|
1499
|
+
let i = ft.get(s);
|
|
1500
|
+
!i && n && qe();
|
|
1501
|
+
const c = ut(e, n), l = c[0], u = c[1], [f, d] = o(() => i?.getState() || {
|
|
1429
1502
|
isOnline: !0,
|
|
1430
1503
|
isSyncing: !1,
|
|
1431
1504
|
lastSyncTimestamp: null,
|
|
1432
1505
|
pendingChanges: 0,
|
|
1433
1506
|
conflicts: 0
|
|
1434
1507
|
});
|
|
1435
|
-
|
|
1508
|
+
a(() => {
|
|
1436
1509
|
if (!i) return;
|
|
1437
|
-
return i.onStateChange(
|
|
1510
|
+
return i.onStateChange(d);
|
|
1438
1511
|
}, [ i ]);
|
|
1439
|
-
return [ l,
|
|
1440
|
-
const s = u(t,
|
|
1512
|
+
return [ l, r((t, r) => {
|
|
1513
|
+
const s = u(t, r);
|
|
1441
1514
|
if (s && i) {
|
|
1442
|
-
const t =
|
|
1515
|
+
const t = n?.get(e);
|
|
1443
1516
|
i.queueChange(e, t);
|
|
1444
1517
|
}
|
|
1445
1518
|
return s;
|
|
1446
|
-
}, [ u, i, e,
|
|
1519
|
+
}, [ u, i, e, n ]), f ];
|
|
1447
1520
|
}
|
|
1448
1521
|
|
|
1449
|
-
var
|
|
1450
|
-
const [e, t] =
|
|
1522
|
+
var ht = () => {
|
|
1523
|
+
const [e, t] = o({
|
|
1451
1524
|
isOnline: !0,
|
|
1452
1525
|
isSyncing: !1,
|
|
1453
1526
|
lastSyncTimestamp: null,
|
|
1454
1527
|
pendingChanges: 0,
|
|
1455
1528
|
conflicts: 0
|
|
1456
1529
|
});
|
|
1457
|
-
return
|
|
1530
|
+
return a(() => {
|
|
1458
1531
|
const e = () => {
|
|
1459
1532
|
let e = !0, n = !1, r = 0, s = 0;
|
|
1460
|
-
|
|
1533
|
+
ft.forEach(t => {
|
|
1461
1534
|
const o = t.getState();
|
|
1462
1535
|
e = e && o.isOnline, n = n || o.isSyncing, r += o.pendingChanges, s += o.conflicts;
|
|
1463
1536
|
}), t({
|
|
@@ -1469,25 +1542,25 @@ var it = () => {
|
|
|
1469
1542
|
});
|
|
1470
1543
|
};
|
|
1471
1544
|
e();
|
|
1472
|
-
const n = Array.from(
|
|
1545
|
+
const n = Array.from(ft.values()).map(t => t.onStateChange(e));
|
|
1473
1546
|
return () => n.forEach(e => e());
|
|
1474
1547
|
}, []), e;
|
|
1475
|
-
},
|
|
1476
|
-
const t = e ||
|
|
1548
|
+
}, gt = async e => {
|
|
1549
|
+
const t = e || ot()?.namespace;
|
|
1477
1550
|
if (!t) return;
|
|
1478
|
-
const n =
|
|
1551
|
+
const n = ft.get(t);
|
|
1479
1552
|
n && await n.flush();
|
|
1480
1553
|
};
|
|
1481
1554
|
|
|
1482
|
-
function
|
|
1483
|
-
const
|
|
1555
|
+
function mt(n) {
|
|
1556
|
+
const s = e(() => n || ot(), [ n ]), a = r(e => s ? s._subscribe(e) : () => {}, [ s ]), i = r(() => !0, []), c = r(() => !0, []);
|
|
1484
1557
|
t(a, i, c);
|
|
1485
|
-
const [, l] =
|
|
1486
|
-
return [ !0,
|
|
1558
|
+
const [, l] = o(0);
|
|
1559
|
+
return [ !0, r(() => l(e => e + 1), []) ];
|
|
1487
1560
|
}
|
|
1488
1561
|
|
|
1489
|
-
var
|
|
1490
|
-
const n = t?.key || "async_data", r = t?.store ||
|
|
1562
|
+
var _t = (e, t) => {
|
|
1563
|
+
const n = t?.key || "async_data", r = t?.store || Ye({
|
|
1491
1564
|
namespace: `async_${n}`,
|
|
1492
1565
|
silent: !0
|
|
1493
1566
|
});
|
|
@@ -1540,24 +1613,26 @@ var ut, dt, ft, yt, pt, ht, gt = (e, t) => {
|
|
|
1540
1613
|
}
|
|
1541
1614
|
}
|
|
1542
1615
|
});
|
|
1543
|
-
},
|
|
1616
|
+
}, St = () => "undefined" == typeof window || void 0 === window.document, wt = () => !St(), bt = e => {
|
|
1544
1617
|
const t = e?.ssrSafe ?? !0, n = e?.deferHydration ?? !1;
|
|
1545
1618
|
let r = e?.storage;
|
|
1546
|
-
!r && t &&
|
|
1547
|
-
const s =
|
|
1619
|
+
!r && t && St() && (r = Ze());
|
|
1620
|
+
const s = Ye({
|
|
1548
1621
|
...e,
|
|
1549
1622
|
storage: r || void 0,
|
|
1550
1623
|
persistByDefault: !n && (e?.persistByDefault ?? !1)
|
|
1551
1624
|
});
|
|
1552
1625
|
let o = !1, a = null;
|
|
1553
|
-
e?.initialState &&
|
|
1626
|
+
e?.initialState && St() && (Object.entries(e.initialState).forEach(([e, t]) => {
|
|
1554
1627
|
s._setSilently(e, t);
|
|
1555
1628
|
}), a = JSON.stringify(e.initialState));
|
|
1556
1629
|
return Object.assign(s, {
|
|
1557
1630
|
hydrate: async () => {
|
|
1558
|
-
if (!o && !
|
|
1631
|
+
if (!o && !St()) {
|
|
1559
1632
|
if (t && !s.namespace.startsWith("async_")) {
|
|
1560
|
-
const t = s.getSnapshot()
|
|
1633
|
+
const t = s.getSnapshot();
|
|
1634
|
+
s.destroy();
|
|
1635
|
+
const n = Ye({
|
|
1561
1636
|
...e,
|
|
1562
1637
|
namespace: s.namespace,
|
|
1563
1638
|
storage: void 0,
|
|
@@ -1565,78 +1640,73 @@ var ut, dt, ft, yt, pt, ht, gt = (e, t) => {
|
|
|
1565
1640
|
});
|
|
1566
1641
|
Object.entries(t).forEach(([e, t]) => {
|
|
1567
1642
|
n._setSilently(e, t);
|
|
1568
|
-
}),
|
|
1569
|
-
}
|
|
1570
|
-
await s.whenReady();
|
|
1643
|
+
}), Object.assign(s, n);
|
|
1644
|
+
}
|
|
1645
|
+
o = !0, await s.whenReady();
|
|
1571
1646
|
}
|
|
1572
1647
|
},
|
|
1573
|
-
getSerializedState: () =>
|
|
1648
|
+
getSerializedState: () => St() ? JSON.stringify(s.getSnapshot()) : a,
|
|
1574
1649
|
isHydrated: () => o || s.isReady
|
|
1575
1650
|
});
|
|
1576
|
-
},
|
|
1577
|
-
|
|
1578
|
-
},
|
|
1579
|
-
if (!
|
|
1651
|
+
}, vt = async e => {
|
|
1652
|
+
St() || await e.whenReady();
|
|
1653
|
+
}, Et = e => JSON.stringify(e.getSnapshot()), kt = (e, t) => {
|
|
1654
|
+
if (!St()) try {
|
|
1580
1655
|
const n = JSON.parse(t);
|
|
1581
1656
|
Object.entries(n).forEach(([t, n]) => {
|
|
1582
1657
|
e._setSilently(t, n);
|
|
1583
1658
|
});
|
|
1584
1659
|
} catch (e) {}
|
|
1585
|
-
},
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
useEffect: ft,
|
|
1590
|
-
useSyncExternalStore: yt,
|
|
1591
|
-
useMemo: pt,
|
|
1592
|
-
useCallback: ht
|
|
1593
|
-
}), kt = () => {
|
|
1594
|
-
const {useSyncExternalStore: e} = Et();
|
|
1595
|
-
return e(e => () => {}, () => _t(), () => !0);
|
|
1596
|
-
}, Ot = () => {
|
|
1597
|
-
const {useState: e, useEffect: t} = Et(), [n, r] = e(() => mt()), [s, o] = e(() => mt());
|
|
1598
|
-
return t(() => {
|
|
1599
|
-
if (mt()) return;
|
|
1600
|
-
r(!0);
|
|
1601
|
-
const e = setTimeout(() => {
|
|
1602
|
-
o(!0), r(!1);
|
|
1603
|
-
}, 0);
|
|
1604
|
-
return () => clearTimeout(e);
|
|
1605
|
-
}, []), {
|
|
1606
|
-
isHydrated: s,
|
|
1607
|
-
isHydrating: n
|
|
1660
|
+
}, Ot = () => t(e => () => {}, () => wt(), () => !0), Ct = () => {
|
|
1661
|
+
if (St()) return {
|
|
1662
|
+
isHydrated: !0,
|
|
1663
|
+
isHydrating: !1
|
|
1608
1664
|
};
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1665
|
+
const [e, t] = o(!1);
|
|
1666
|
+
return a(() => {
|
|
1667
|
+
if (e) return;
|
|
1668
|
+
const n = requestAnimationFrame(() => {
|
|
1669
|
+
t(!0);
|
|
1670
|
+
});
|
|
1671
|
+
return () => cancelAnimationFrame(n);
|
|
1672
|
+
}, [ e ]), {
|
|
1673
|
+
isHydrated: e,
|
|
1674
|
+
isHydrating: !e
|
|
1675
|
+
};
|
|
1676
|
+
}, Dt = t => {
|
|
1677
|
+
const [n, r] = o(() => !!St() || (t.isHydrated?.() ?? t.isReady));
|
|
1678
|
+
return a(() => {
|
|
1679
|
+
if (St()) return;
|
|
1680
|
+
if (n) return;
|
|
1681
|
+
return (async () => {
|
|
1682
|
+
if (t.isHydrated?.() ?? t.isReady) return void r(!0);
|
|
1683
|
+
const e = t._subscribe(() => {
|
|
1684
|
+
(t.isHydrated?.() ?? t.isReady) && (r(!0), e());
|
|
1685
|
+
});
|
|
1686
|
+
try {
|
|
1687
|
+
await t.whenReady(), r(!0), e();
|
|
1688
|
+
} catch {}
|
|
1689
|
+
})(), () => {};
|
|
1690
|
+
}, [ t, n ]), e(() => {
|
|
1691
|
+
if (n) return t;
|
|
1692
|
+
const e = () => {}, r = () => !1, s = () => null;
|
|
1623
1693
|
return {
|
|
1624
|
-
set:
|
|
1625
|
-
get:
|
|
1626
|
-
remove:
|
|
1627
|
-
delete:
|
|
1628
|
-
deleteAll:
|
|
1694
|
+
set: r,
|
|
1695
|
+
get: s,
|
|
1696
|
+
remove: r,
|
|
1697
|
+
delete: r,
|
|
1698
|
+
deleteAll: r,
|
|
1629
1699
|
list: () => ({}),
|
|
1630
|
-
compute:
|
|
1700
|
+
compute: s,
|
|
1631
1701
|
watch: () => () => {},
|
|
1632
|
-
use:
|
|
1633
|
-
transaction:
|
|
1634
|
-
destroy:
|
|
1702
|
+
use: e,
|
|
1703
|
+
transaction: e,
|
|
1704
|
+
destroy: e,
|
|
1635
1705
|
_subscribe: () => () => {},
|
|
1636
|
-
_setSilently:
|
|
1637
|
-
_registerMethod:
|
|
1638
|
-
_addPlugin:
|
|
1639
|
-
_removePlugin:
|
|
1706
|
+
_setSilently: e,
|
|
1707
|
+
_registerMethod: e,
|
|
1708
|
+
_addPlugin: e,
|
|
1709
|
+
_removePlugin: e,
|
|
1640
1710
|
_getVersion: () => 0,
|
|
1641
1711
|
get isReady() {
|
|
1642
1712
|
return !1;
|
|
@@ -1647,31 +1717,31 @@ pt = ut.useMemo, ht = ut.useCallback), {
|
|
|
1647
1717
|
},
|
|
1648
1718
|
getSnapshot: () => ({}),
|
|
1649
1719
|
get namespace() {
|
|
1650
|
-
return
|
|
1720
|
+
return t.namespace;
|
|
1651
1721
|
},
|
|
1652
1722
|
get userId() {
|
|
1653
|
-
return
|
|
1723
|
+
return t.userId;
|
|
1654
1724
|
}
|
|
1655
1725
|
};
|
|
1656
|
-
}, [
|
|
1657
|
-
},
|
|
1658
|
-
const
|
|
1659
|
-
return Object.assign(
|
|
1660
|
-
useHydrated:
|
|
1661
|
-
useHydrationStatus:
|
|
1726
|
+
}, [ t, n ]);
|
|
1727
|
+
}, At = e => {
|
|
1728
|
+
const n = bt(e);
|
|
1729
|
+
return Object.assign(n, {
|
|
1730
|
+
useHydrated: Ot,
|
|
1731
|
+
useHydrationStatus: Ct,
|
|
1662
1732
|
useDeferredStore: e => {
|
|
1663
|
-
const
|
|
1733
|
+
const s = Dt(n);
|
|
1664
1734
|
return (e => {
|
|
1665
|
-
const
|
|
1666
|
-
return t(
|
|
1735
|
+
const n = r(t => s._subscribe(t, e), [ s, e ]), o = r(() => s.get(e), [ s, e ]);
|
|
1736
|
+
return t(n, o, () => {});
|
|
1667
1737
|
})(e);
|
|
1668
1738
|
}
|
|
1669
1739
|
});
|
|
1670
|
-
}, Mt = e => e.getSnapshot(),
|
|
1671
|
-
|
|
1740
|
+
}, Mt = e => e.getSnapshot(), jt = (e, t) => {
|
|
1741
|
+
St() || Object.entries(t).forEach(([t, n]) => {
|
|
1672
1742
|
e._setSilently(t, n);
|
|
1673
1743
|
});
|
|
1674
|
-
},
|
|
1744
|
+
}, Rt = (e, t) => {
|
|
1675
1745
|
const n = t?.extraArgument, r = async t => {
|
|
1676
1746
|
if ("function" == typeof t) return t(r, () => e.getSnapshot(), n);
|
|
1677
1747
|
if (t.type) {
|
|
@@ -1690,10 +1760,10 @@ pt = ut.useMemo, ht = ut.useCallback), {
|
|
|
1690
1760
|
return Object.assign(e, {
|
|
1691
1761
|
dispatch: r
|
|
1692
1762
|
});
|
|
1693
|
-
},
|
|
1694
|
-
const n =
|
|
1763
|
+
}, Pt = (e, t) => {
|
|
1764
|
+
const n = Rt(e);
|
|
1695
1765
|
return Object.assign(n.dispatch, t);
|
|
1696
|
-
},
|
|
1766
|
+
}, Tt = (e, t) => async (n, r) => {
|
|
1697
1767
|
const s = r()[e];
|
|
1698
1768
|
n({
|
|
1699
1769
|
type: `SET_${e.toUpperCase()}`,
|
|
@@ -1723,31 +1793,31 @@ pt = ut.useMemo, ht = ut.useCallback), {
|
|
|
1723
1793
|
}
|
|
1724
1794
|
}), t;
|
|
1725
1795
|
}
|
|
1726
|
-
},
|
|
1727
|
-
|
|
1796
|
+
}, It = (e, t) => {
|
|
1797
|
+
Rt(e);
|
|
1728
1798
|
const n = {};
|
|
1729
|
-
for (const [e, r] of Object.entries(t)) n[e] =
|
|
1799
|
+
for (const [e, r] of Object.entries(t)) n[e] = Tt(e, r);
|
|
1730
1800
|
return n;
|
|
1731
|
-
},
|
|
1801
|
+
}, zt = (e, ...t) => ({
|
|
1732
1802
|
type: "call",
|
|
1733
1803
|
fn: e,
|
|
1734
1804
|
args: t
|
|
1735
|
-
}),
|
|
1805
|
+
}), Vt = e => ({
|
|
1736
1806
|
type: "put",
|
|
1737
1807
|
action: e
|
|
1738
|
-
}),
|
|
1808
|
+
}), $t = e => ({
|
|
1739
1809
|
type: "select",
|
|
1740
1810
|
selector: e
|
|
1741
|
-
}),
|
|
1811
|
+
}), xt = e => ({
|
|
1742
1812
|
type: "take",
|
|
1743
1813
|
pattern: e
|
|
1744
|
-
}),
|
|
1814
|
+
}), Nt = e => ({
|
|
1745
1815
|
type: "all",
|
|
1746
1816
|
effects: e
|
|
1747
|
-
}),
|
|
1817
|
+
}), Ut = e => ({
|
|
1748
1818
|
type: "race",
|
|
1749
1819
|
effects: e
|
|
1750
|
-
}),
|
|
1820
|
+
}), Lt = e => async (t, n) => {
|
|
1751
1821
|
const r = async e => {
|
|
1752
1822
|
switch (e.type) {
|
|
1753
1823
|
case "call":
|
|
@@ -1776,7 +1846,7 @@ pt = ut.useMemo, ht = ut.useCallback), {
|
|
|
1776
1846
|
let t = e.next();
|
|
1777
1847
|
for (;!t.done; ) await r(t.value), t = e.next();
|
|
1778
1848
|
} catch (e) {}
|
|
1779
|
-
},
|
|
1849
|
+
}, Bt = (e, t) => (Rt(e).dispatch(t), () => {});
|
|
1780
1850
|
|
|
1781
1851
|
g();
|
|
1782
1852
|
|
|
@@ -1831,7 +1901,7 @@ var Ft = () => ({
|
|
|
1831
1901
|
}
|
|
1832
1902
|
}
|
|
1833
1903
|
}
|
|
1834
|
-
}),
|
|
1904
|
+
}), Wt = e => {
|
|
1835
1905
|
const t = globalThis.__REDUX_DEVTOOLS_EXTENSION__;
|
|
1836
1906
|
if (!t?.connect) return {
|
|
1837
1907
|
name: "gstate-devtools-noop",
|
|
@@ -1854,7 +1924,7 @@ var Ft = () => ({
|
|
|
1854
1924
|
}
|
|
1855
1925
|
}
|
|
1856
1926
|
};
|
|
1857
|
-
},
|
|
1927
|
+
}, Ht = () => {
|
|
1858
1928
|
const e = new Map;
|
|
1859
1929
|
return {
|
|
1860
1930
|
name: "gstate-snapshot",
|
|
@@ -1883,7 +1953,7 @@ var Ft = () => ({
|
|
|
1883
1953
|
s && s(n);
|
|
1884
1954
|
}
|
|
1885
1955
|
}
|
|
1886
|
-
}),
|
|
1956
|
+
}), Gt = e => ({
|
|
1887
1957
|
name: "gstate-analytics",
|
|
1888
1958
|
hooks: {
|
|
1889
1959
|
onSet: ({key: t, value: n}) => {
|
|
@@ -1901,7 +1971,7 @@ var Ft = () => ({
|
|
|
1901
1971
|
}));
|
|
1902
1972
|
}
|
|
1903
1973
|
}
|
|
1904
|
-
}),
|
|
1974
|
+
}), qt = e => {
|
|
1905
1975
|
const t = new BroadcastChannel(e?.channelName || "gstate_sync");
|
|
1906
1976
|
let n = !1;
|
|
1907
1977
|
return {
|
|
@@ -1931,12 +2001,12 @@ var Ft = () => ({
|
|
|
1931
2001
|
}
|
|
1932
2002
|
}
|
|
1933
2003
|
};
|
|
1934
|
-
},
|
|
1935
|
-
if (
|
|
2004
|
+
}, Xt = () => {
|
|
2005
|
+
if (Ge()) return {
|
|
1936
2006
|
name: "gstate-debug-noop",
|
|
1937
2007
|
hooks: {}
|
|
1938
2008
|
};
|
|
1939
|
-
|
|
2009
|
+
Ge();
|
|
1940
2010
|
return {
|
|
1941
2011
|
name: "gstate-debug",
|
|
1942
2012
|
hooks: {
|
|
@@ -1969,7 +2039,7 @@ var Ft = () => ({
|
|
|
1969
2039
|
}
|
|
1970
2040
|
}
|
|
1971
2041
|
};
|
|
1972
|
-
},
|
|
2042
|
+
}, Zt = (e = {}) => {
|
|
1973
2043
|
const t = e.dbName || "rgs-db", n = e.storeName || "states", r = e.version || 1;
|
|
1974
2044
|
let s = null;
|
|
1975
2045
|
const o = () => new Promise((e, o) => {
|
|
@@ -2037,7 +2107,7 @@ var Ft = () => ({
|
|
|
2037
2107
|
}
|
|
2038
2108
|
}
|
|
2039
2109
|
};
|
|
2040
|
-
},
|
|
2110
|
+
}, Yt = e => {
|
|
2041
2111
|
const {adapter: t, autoSyncInterval: n} = e, r = new Map, s = {
|
|
2042
2112
|
lastSyncTimestamp: null,
|
|
2043
2113
|
totalKeysSynced: 0,
|
|
@@ -2091,7 +2161,7 @@ var Ft = () => ({
|
|
|
2091
2161
|
}
|
|
2092
2162
|
}
|
|
2093
2163
|
};
|
|
2094
|
-
},
|
|
2164
|
+
}, en = (e, t) => ({
|
|
2095
2165
|
name: "MongoDB-Atlas",
|
|
2096
2166
|
save: async n => (await fetch(`${e}/action/updateOne`, {
|
|
2097
2167
|
method: "POST",
|
|
@@ -2115,17 +2185,17 @@ var Ft = () => ({
|
|
|
2115
2185
|
upsert: !0
|
|
2116
2186
|
})
|
|
2117
2187
|
})).ok
|
|
2118
|
-
}),
|
|
2188
|
+
}), tn = (e, t) => ({
|
|
2119
2189
|
name: "Firebase-Firestore",
|
|
2120
2190
|
save: async e => {
|
|
2121
2191
|
try {
|
|
2122
|
-
|
|
2192
|
+
Ge();
|
|
2123
2193
|
return (() => {})("[Mock] Firestore Syncing:", e), !0;
|
|
2124
2194
|
} catch (e) {
|
|
2125
2195
|
return !1;
|
|
2126
2196
|
}
|
|
2127
2197
|
}
|
|
2128
|
-
}),
|
|
2198
|
+
}), nn = (e, t) => ({
|
|
2129
2199
|
name: "SQL-REST-API",
|
|
2130
2200
|
save: async n => {
|
|
2131
2201
|
const r = t();
|
|
@@ -2140,7 +2210,7 @@ var Ft = () => ({
|
|
|
2140
2210
|
credentials: "same-origin"
|
|
2141
2211
|
})).ok;
|
|
2142
2212
|
}
|
|
2143
|
-
}),
|
|
2213
|
+
}), rn = e => ({
|
|
2144
2214
|
name: "gstate-logger",
|
|
2145
2215
|
hooks: {
|
|
2146
2216
|
onSet: ({key: e, value: t, version: n}) => {
|
|
@@ -2149,28 +2219,28 @@ var Ft = () => ({
|
|
|
2149
2219
|
onRemove: ({key: e}) => {},
|
|
2150
2220
|
onTransaction: ({key: e}) => {}
|
|
2151
2221
|
}
|
|
2152
|
-
}),
|
|
2153
|
-
const n =
|
|
2222
|
+
}), sn = (e, t) => {
|
|
2223
|
+
const n = "string" == typeof t ? {
|
|
2154
2224
|
namespace: t
|
|
2155
|
-
} : t);
|
|
2156
|
-
e && Object.entries(e).forEach(([e, t]) => {
|
|
2157
|
-
null ===
|
|
2225
|
+
} : t, r = n?.namespace || "gstate", s = Ye(n);
|
|
2226
|
+
it(r, s), e && Object.entries(e).forEach(([e, t]) => {
|
|
2227
|
+
null === s.get(e) && s._setSilently(e, t);
|
|
2158
2228
|
});
|
|
2159
|
-
const
|
|
2160
|
-
return "undefined"
|
|
2161
|
-
window.rgs =
|
|
2162
|
-
},
|
|
2163
|
-
const r =
|
|
2229
|
+
const o = e => ut(e, s);
|
|
2230
|
+
return "undefined" != typeof window && qe() && (window.gstate = o, window.gState = s,
|
|
2231
|
+
window.rgs = s), Object.assign(o, s);
|
|
2232
|
+
}, on = (e, t) => ot()?.addAccessRule(e, t), an = (e, t, n) => ot()?.hasPermission(e, t, n) ?? !0, cn = (e, t, n) => {
|
|
2233
|
+
const r = ot();
|
|
2164
2234
|
if (!r) throw new Error("[gstate] recordConsent failed: No store found. call initState() first.");
|
|
2165
2235
|
return r.recordConsent(e, t, n);
|
|
2166
|
-
},
|
|
2167
|
-
const t =
|
|
2236
|
+
}, ln = (e, t) => ot()?.hasConsent(e, t) ?? !1, un = e => ot()?.getConsents(e) ?? [], fn = (e, t) => ot()?.revokeConsent(e, t), dn = e => {
|
|
2237
|
+
const t = ot();
|
|
2168
2238
|
if (!t) throw new Error("[gstate] exportUserData failed: No store found.");
|
|
2169
2239
|
return t.exportUserData(e);
|
|
2170
|
-
},
|
|
2171
|
-
const t =
|
|
2240
|
+
}, yn = e => {
|
|
2241
|
+
const t = ot();
|
|
2172
2242
|
if (!t) throw new Error("[gstate] deleteUserData failed: No store found.");
|
|
2173
2243
|
return t.deleteUserData(e);
|
|
2174
|
-
},
|
|
2244
|
+
}, pn = () => {}, hn = () => {};
|
|
2175
2245
|
|
|
2176
|
-
export {
|
|
2246
|
+
export { l as SyncEngine, on as addAccessRule, Nt as all, Gt as analyticsPlugin, zt as call, pn as clearAccessRules, hn as clearAllConsents, Yt as cloudSyncPlugin, Pt as createActions, Tt as createAsyncAction, It as createAsyncActions, _t as createAsyncStore, tn as createFirestoreAdapter, en as createMongoAdapter, At as createNextStore, bt as createSSRStore, Lt as createSaga, nn as createSqlRestAdapter, Ye as createStore, u as createSyncEngine, Rt as createThunkStore, Xt as debugPlugin, Et as dehydrateStore, yn as deleteUserData, Re as deriveKeyFromPassword, st as destroyAllStores, rt as destroyState, yt as destroySync, Wt as devToolsPlugin, Ie as exportKey, dn as exportUserData, Te as generateEncryptionKey, Pe as generateSalt, un as getConsents, Mt as getSSRInitialState, ot as getStore, at as getStoreByNamespace, sn as gstate, Qt as guardPlugin, ln as hasConsent, an as hasPermission, vt as hydrateOnClient, Ft as immerPlugin, ze as importKey, Zt as indexedDBPlugin, nt as initState, dt as initSync, jt as initializeFromSSR, wt as isClientSide, je as isCryptoAvailable, St as isServerSide, Ue as logAudit, rn as loggerPlugin, Vt as put, Ut as race, cn as recordConsent, it as registerStore, kt as rehydrateStore, fn as revokeConsent, Bt as runSaga, Fe as sanitizeValue, Jt as schemaPlugin, $t as select, Ne as setAuditLogger, Ht as snapshotPlugin, qt as syncPlugin, xt as take, gt as triggerSync, Kt as undoRedoPlugin, ct as unregisterStore, Dt as useDeferredStore, ut as useGState, Ot as useHydrated, Ct as useHydrationStatus, lt as useIsStoreReady, ut as useSimpleState, ut as useStore, mt as useStoreSubscribe, ht as useSyncStatus, pt as useSyncedState, Ke as validateKey };
|