@biglogic/rgs 3.9.7 → 3.9.9
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/SKILL.md +148 -0
- package/core/hooks.d.ts +1 -0
- package/core/ssr.d.ts +73 -0
- package/core/thunk.d.ts +75 -0
- package/docs/SKILL.md +148 -0
- package/docs/markdown/api.md +32 -0
- package/docs/markdown/getting-started.md +32 -38
- package/index.cjs +596 -333
- package/index.d.ts +6 -2
- package/index.js +612 -350
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import { useMemo as e, useSyncExternalStore as t, useCallback as n, useDebugValue as r, useState as s, useEffect as o } from "react";
|
|
2
2
|
|
|
3
|
-
var a, i, c, l, u = Object.defineProperty, d = Object.getOwnPropertyNames, f = (e
|
|
3
|
+
var a, i, c, l, u = Object.defineProperty, d = Object.getOwnPropertyNames, f = (e => "undefined" != typeof require ? require : "undefined" != typeof Proxy ? new Proxy(e, {
|
|
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() {
|
|
4
9
|
return e && (t = (0, e[d(e)[0]])(e = 0)), t;
|
|
5
|
-
},
|
|
10
|
+
}, p = y({
|
|
6
11
|
"core/utils.ts"() {
|
|
7
12
|
a = e => {
|
|
8
13
|
if (null === e || "object" != typeof e) return e;
|
|
@@ -48,21 +53,21 @@ var a, i, c, l, u = Object.defineProperty, d = Object.getOwnPropertyNames, f = (
|
|
|
48
53
|
return !0;
|
|
49
54
|
};
|
|
50
55
|
}
|
|
51
|
-
}),
|
|
56
|
+
}), h = {};
|
|
52
57
|
|
|
53
58
|
((e, t) => {
|
|
54
59
|
for (var n in t) u(e, n, {
|
|
55
60
|
get: t[n],
|
|
56
61
|
enumerable: !0
|
|
57
62
|
});
|
|
58
|
-
})(
|
|
63
|
+
})(h, {
|
|
59
64
|
SyncEngine: () => c,
|
|
60
65
|
createSyncEngine: () => l
|
|
61
66
|
});
|
|
62
67
|
|
|
63
|
-
var
|
|
68
|
+
var g = y({
|
|
64
69
|
"core/sync.ts"() {
|
|
65
|
-
|
|
70
|
+
p(), c = class {
|
|
66
71
|
store;
|
|
67
72
|
config;
|
|
68
73
|
pendingQueue=new Map;
|
|
@@ -288,7 +293,7 @@ var h = f({
|
|
|
288
293
|
}
|
|
289
294
|
}, l = (e, t) => new c(e, t);
|
|
290
295
|
}
|
|
291
|
-
}),
|
|
296
|
+
}), m = Symbol.for("immer-nothing"), _ = Symbol.for("immer-draftable"), S = Symbol.for("immer-state"), w = [ function(e) {
|
|
292
297
|
return `The plugin for '${e}' has not been loaded into Immer. To enable the plugin, import and call \`enable${e}()\` when initializing your application.`;
|
|
293
298
|
}, function(e) {
|
|
294
299
|
return `produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${e}'`;
|
|
@@ -300,232 +305,232 @@ var h = f({
|
|
|
300
305
|
return `'original' expects a draft, got: ${e}`;
|
|
301
306
|
} ];
|
|
302
307
|
|
|
303
|
-
function
|
|
308
|
+
function b(e, ...t) {
|
|
304
309
|
{
|
|
305
|
-
const n =
|
|
310
|
+
const n = w[e], r = J(n) ? n.apply(null, t) : n;
|
|
306
311
|
throw new Error(`[Immer] ${r}`);
|
|
307
312
|
}
|
|
308
313
|
}
|
|
309
314
|
|
|
310
|
-
var
|
|
315
|
+
var v = Object, E = v.getPrototypeOf, k = "constructor", O = "prototype", C = "configurable", D = "enumerable", M = "writable", A = "value", j = e => !!e && !!e[S];
|
|
311
316
|
|
|
312
317
|
function R(e) {
|
|
313
|
-
return !!e && (
|
|
318
|
+
return !!e && (I(e) || U(e) || !!e[_] || !!e[k]?.[_] || L(e) || F(e));
|
|
314
319
|
}
|
|
315
320
|
|
|
316
|
-
var
|
|
321
|
+
var P = v[O][k].toString(), T = new WeakMap;
|
|
317
322
|
|
|
318
|
-
function
|
|
319
|
-
if (!e || !
|
|
320
|
-
const t =
|
|
321
|
-
if (null === t || t ===
|
|
322
|
-
const n =
|
|
323
|
+
function I(e) {
|
|
324
|
+
if (!e || !K(e)) return !1;
|
|
325
|
+
const t = E(e);
|
|
326
|
+
if (null === t || t === v[O]) return !0;
|
|
327
|
+
const n = v.hasOwnProperty.call(t, k) && t[k];
|
|
323
328
|
if (n === Object) return !0;
|
|
324
|
-
if (!
|
|
325
|
-
let r =
|
|
326
|
-
return void 0 === r && (r = Function.toString.call(n),
|
|
329
|
+
if (!J(n)) return !1;
|
|
330
|
+
let r = T.get(n);
|
|
331
|
+
return void 0 === r && (r = Function.toString.call(n), T.set(n, r)), r === P;
|
|
327
332
|
}
|
|
328
333
|
|
|
329
|
-
function
|
|
330
|
-
if (0 ===
|
|
331
|
-
(n ? Reflect.ownKeys(e) :
|
|
334
|
+
function z(e, t, n = !0) {
|
|
335
|
+
if (0 === x(e)) {
|
|
336
|
+
(n ? Reflect.ownKeys(e) : v.keys(e)).forEach(n => {
|
|
332
337
|
t(n, e[n], e);
|
|
333
338
|
});
|
|
334
339
|
} else e.forEach((n, r) => t(r, n, e));
|
|
335
340
|
}
|
|
336
341
|
|
|
337
|
-
function
|
|
338
|
-
const t = e[
|
|
339
|
-
return t ? t.type_ :
|
|
342
|
+
function x(e) {
|
|
343
|
+
const t = e[S];
|
|
344
|
+
return t ? t.type_ : U(e) ? 1 : L(e) ? 2 : F(e) ? 3 : 0;
|
|
340
345
|
}
|
|
341
346
|
|
|
342
|
-
var
|
|
347
|
+
var $ = (e, t, n = x(e)) => 2 === n ? e.has(t) : v[O].hasOwnProperty.call(e, t), V = (e, t, n = x(e)) => 2 === n ? e.get(t) : e[t], N = (e, t, n, r = x(e)) => {
|
|
343
348
|
2 === r ? e.set(t, n) : 3 === r ? e.add(n) : e[t] = n;
|
|
344
349
|
};
|
|
345
350
|
|
|
346
|
-
var
|
|
351
|
+
var U = Array.isArray, L = e => e instanceof Map, F = e => e instanceof Set, K = e => "object" == typeof e, J = e => "function" == typeof e, B = e => "boolean" == typeof e;
|
|
347
352
|
|
|
348
|
-
var
|
|
353
|
+
var W = e => e.copy_ || e.base_, Q = e => e.modified_ ? e.copy_ : e.base_;
|
|
349
354
|
|
|
350
|
-
function
|
|
351
|
-
if (
|
|
352
|
-
if (
|
|
353
|
-
if (
|
|
354
|
-
const n =
|
|
355
|
+
function q(e, t) {
|
|
356
|
+
if (L(e)) return new Map(e);
|
|
357
|
+
if (F(e)) return new Set(e);
|
|
358
|
+
if (U(e)) return Array[O].slice.call(e);
|
|
359
|
+
const n = I(e);
|
|
355
360
|
if (!0 === t || "class_only" === t && !n) {
|
|
356
|
-
const t =
|
|
357
|
-
delete t[
|
|
361
|
+
const t = v.getOwnPropertyDescriptors(e);
|
|
362
|
+
delete t[S];
|
|
358
363
|
let n = Reflect.ownKeys(t);
|
|
359
364
|
for (let r = 0; r < n.length; r++) {
|
|
360
365
|
const s = n[r], o = t[s];
|
|
361
|
-
!1 === o[
|
|
362
|
-
[
|
|
363
|
-
[
|
|
364
|
-
[
|
|
365
|
-
[
|
|
366
|
+
!1 === o[M] && (o[M] = !0, o[C] = !0), (o.get || o.set) && (t[s] = {
|
|
367
|
+
[C]: !0,
|
|
368
|
+
[M]: !0,
|
|
369
|
+
[D]: o[D],
|
|
370
|
+
[A]: e[s]
|
|
366
371
|
});
|
|
367
372
|
}
|
|
368
|
-
return
|
|
373
|
+
return v.create(E(e), t);
|
|
369
374
|
}
|
|
370
375
|
{
|
|
371
|
-
const t =
|
|
376
|
+
const t = E(e);
|
|
372
377
|
if (null !== t && n) return {
|
|
373
378
|
...e
|
|
374
379
|
};
|
|
375
|
-
const r =
|
|
376
|
-
return
|
|
380
|
+
const r = v.create(t);
|
|
381
|
+
return v.assign(r, e);
|
|
377
382
|
}
|
|
378
383
|
}
|
|
379
384
|
|
|
380
|
-
function
|
|
381
|
-
return X(e) ||
|
|
382
|
-
set:
|
|
383
|
-
add:
|
|
384
|
-
clear:
|
|
385
|
-
delete:
|
|
386
|
-
}),
|
|
387
|
-
|
|
385
|
+
function H(e, t = !1) {
|
|
386
|
+
return X(e) || j(e) || !R(e) || (x(e) > 1 && v.defineProperties(e, {
|
|
387
|
+
set: G,
|
|
388
|
+
add: G,
|
|
389
|
+
clear: G,
|
|
390
|
+
delete: G
|
|
391
|
+
}), v.freeze(e), t && z(e, (e, t) => {
|
|
392
|
+
H(t, !0);
|
|
388
393
|
}, !1)), e;
|
|
389
394
|
}
|
|
390
395
|
|
|
391
|
-
var
|
|
392
|
-
[
|
|
393
|
-
|
|
396
|
+
var G = {
|
|
397
|
+
[A]: function() {
|
|
398
|
+
b(2);
|
|
394
399
|
}
|
|
395
400
|
};
|
|
396
401
|
|
|
397
402
|
function X(e) {
|
|
398
|
-
return null === e || !
|
|
403
|
+
return null === e || !K(e) || v.isFrozen(e);
|
|
399
404
|
}
|
|
400
405
|
|
|
401
|
-
var Z = "MapSet",
|
|
406
|
+
var Z = "MapSet", Y = "Patches", ee = "ArrayMethods", te = {};
|
|
402
407
|
|
|
403
|
-
function
|
|
404
|
-
const t =
|
|
405
|
-
return t ||
|
|
408
|
+
function ne(e) {
|
|
409
|
+
const t = te[e];
|
|
410
|
+
return t || b(0, e), t;
|
|
406
411
|
}
|
|
407
412
|
|
|
408
|
-
var
|
|
413
|
+
var re, se = e => !!te[e], oe = () => re;
|
|
409
414
|
|
|
410
|
-
function
|
|
411
|
-
t && (e.patchPlugin_ =
|
|
415
|
+
function ae(e, t) {
|
|
416
|
+
t && (e.patchPlugin_ = ne(Y), e.patches_ = [], e.inversePatches_ = [], e.patchListener_ = t);
|
|
412
417
|
}
|
|
413
418
|
|
|
414
|
-
function
|
|
415
|
-
|
|
419
|
+
function ie(e) {
|
|
420
|
+
ce(e), e.drafts_.forEach(ue), e.drafts_ = null;
|
|
416
421
|
}
|
|
417
422
|
|
|
418
|
-
function
|
|
419
|
-
e ===
|
|
423
|
+
function ce(e) {
|
|
424
|
+
e === re && (re = e.parent_);
|
|
420
425
|
}
|
|
421
426
|
|
|
422
|
-
var
|
|
427
|
+
var le = e => re = {
|
|
423
428
|
drafts_: [],
|
|
424
|
-
parent_:
|
|
429
|
+
parent_: re,
|
|
425
430
|
immer_: e,
|
|
426
431
|
canAutoFreeze_: !0,
|
|
427
432
|
unfinalizedDrafts_: 0,
|
|
428
433
|
handledSet_: new Set,
|
|
429
434
|
processedForPatches_: new Set,
|
|
430
|
-
mapSetPlugin_:
|
|
431
|
-
arrayMethodsPlugin_:
|
|
435
|
+
mapSetPlugin_: se(Z) ? ne(Z) : void 0,
|
|
436
|
+
arrayMethodsPlugin_: se(ee) ? ne(ee) : void 0
|
|
432
437
|
};
|
|
433
438
|
|
|
434
|
-
function
|
|
435
|
-
const t = e[
|
|
439
|
+
function ue(e) {
|
|
440
|
+
const t = e[S];
|
|
436
441
|
0 === t.type_ || 1 === t.type_ ? t.revoke_() : t.revoked_ = !0;
|
|
437
442
|
}
|
|
438
443
|
|
|
439
|
-
function
|
|
444
|
+
function de(e, t) {
|
|
440
445
|
t.unfinalizedDrafts_ = t.drafts_.length;
|
|
441
446
|
const n = t.drafts_[0];
|
|
442
447
|
if (void 0 !== e && e !== n) {
|
|
443
|
-
n[
|
|
448
|
+
n[S].modified_ && (ie(t), b(4)), R(e) && (e = fe(t, e));
|
|
444
449
|
const {patchPlugin_: r} = t;
|
|
445
|
-
r && r.generateReplacementPatches_(n[
|
|
446
|
-
} else e =
|
|
450
|
+
r && r.generateReplacementPatches_(n[S].base_, e, t);
|
|
451
|
+
} else e = fe(t, n);
|
|
447
452
|
return function(e, t, n = !1) {
|
|
448
|
-
!e.parent_ && e.immer_.autoFreeze_ && e.canAutoFreeze_ &&
|
|
449
|
-
}(t, e, !0),
|
|
450
|
-
e !==
|
|
453
|
+
!e.parent_ && e.immer_.autoFreeze_ && e.canAutoFreeze_ && H(t, n);
|
|
454
|
+
}(t, e, !0), ie(t), t.patches_ && t.patchListener_(t.patches_, t.inversePatches_),
|
|
455
|
+
e !== m ? e : void 0;
|
|
451
456
|
}
|
|
452
457
|
|
|
453
|
-
function
|
|
458
|
+
function fe(e, t) {
|
|
454
459
|
if (X(t)) return t;
|
|
455
|
-
const n = t[
|
|
460
|
+
const n = t[S];
|
|
456
461
|
if (!n) {
|
|
457
|
-
return
|
|
462
|
+
return _e(t, e.handledSet_, e);
|
|
458
463
|
}
|
|
459
|
-
if (!
|
|
464
|
+
if (!pe(n, e)) return t;
|
|
460
465
|
if (!n.modified_) return n.base_;
|
|
461
466
|
if (!n.finalized_) {
|
|
462
467
|
const {callbacks_: t} = n;
|
|
463
468
|
if (t) for (;t.length > 0; ) {
|
|
464
469
|
t.pop()(e);
|
|
465
470
|
}
|
|
466
|
-
|
|
471
|
+
me(n, e);
|
|
467
472
|
}
|
|
468
473
|
return n.copy_;
|
|
469
474
|
}
|
|
470
475
|
|
|
471
|
-
function
|
|
476
|
+
function ye(e) {
|
|
472
477
|
e.finalized_ = !0, e.scope_.unfinalizedDrafts_--;
|
|
473
478
|
}
|
|
474
479
|
|
|
475
|
-
var
|
|
480
|
+
var pe = (e, t) => e.scope_ === t, he = [];
|
|
476
481
|
|
|
477
|
-
function
|
|
478
|
-
const s =
|
|
482
|
+
function ge(e, t, n, r) {
|
|
483
|
+
const s = W(e), o = e.type_;
|
|
479
484
|
if (void 0 !== r) {
|
|
480
|
-
if (
|
|
485
|
+
if (V(s, r, o) === t) return void N(s, r, n, o);
|
|
481
486
|
}
|
|
482
487
|
if (!e.draftLocations_) {
|
|
483
488
|
const t = e.draftLocations_ = new Map;
|
|
484
|
-
|
|
485
|
-
if (
|
|
489
|
+
z(s, (e, n) => {
|
|
490
|
+
if (j(n)) {
|
|
486
491
|
const r = t.get(n) || [];
|
|
487
492
|
r.push(e), t.set(n, r);
|
|
488
493
|
}
|
|
489
494
|
});
|
|
490
495
|
}
|
|
491
|
-
const a = e.draftLocations_.get(t) ??
|
|
492
|
-
for (const e of a)
|
|
496
|
+
const a = e.draftLocations_.get(t) ?? he;
|
|
497
|
+
for (const e of a) N(s, e, n, o);
|
|
493
498
|
}
|
|
494
499
|
|
|
495
|
-
function
|
|
500
|
+
function me(e, t) {
|
|
496
501
|
if (e.modified_ && !e.finalized_ && (3 === e.type_ || 1 === e.type_ && e.allIndicesReassigned_ || (e.assigned_?.size ?? 0) > 0)) {
|
|
497
502
|
const {patchPlugin_: n} = t;
|
|
498
503
|
if (n) {
|
|
499
504
|
const r = n.getPath(e);
|
|
500
505
|
r && n.generatePatches_(e, r, t);
|
|
501
506
|
}
|
|
502
|
-
|
|
507
|
+
ye(e);
|
|
503
508
|
}
|
|
504
509
|
}
|
|
505
510
|
|
|
506
|
-
function
|
|
507
|
-
return !n.immer_.autoFreeze_ && n.unfinalizedDrafts_ < 1 ||
|
|
508
|
-
|
|
509
|
-
if (
|
|
510
|
-
const t = s[
|
|
511
|
-
if (
|
|
512
|
-
const n =
|
|
513
|
-
|
|
511
|
+
function _e(e, t, n) {
|
|
512
|
+
return !n.immer_.autoFreeze_ && n.unfinalizedDrafts_ < 1 || j(e) || t.has(e) || !R(e) || X(e) || (t.add(e),
|
|
513
|
+
z(e, (r, s) => {
|
|
514
|
+
if (j(s)) {
|
|
515
|
+
const t = s[S];
|
|
516
|
+
if (pe(t, n)) {
|
|
517
|
+
const n = Q(t);
|
|
518
|
+
N(e, r, n, e.type_), ye(t);
|
|
514
519
|
}
|
|
515
|
-
} else R(s) &&
|
|
520
|
+
} else R(s) && _e(s, t, n);
|
|
516
521
|
})), e;
|
|
517
522
|
}
|
|
518
523
|
|
|
519
|
-
var
|
|
524
|
+
var Se = {
|
|
520
525
|
get(e, t) {
|
|
521
|
-
if (t ===
|
|
526
|
+
if (t === S) return e;
|
|
522
527
|
let n = e.scope_.arrayMethodsPlugin_;
|
|
523
528
|
const r = 1 === e.type_ && "string" == typeof t;
|
|
524
529
|
if (r && n?.isArrayOperationMethod(t)) return n.createMethodInterceptor(e, t);
|
|
525
|
-
const s =
|
|
526
|
-
if (
|
|
527
|
-
const r =
|
|
528
|
-
return r ?
|
|
530
|
+
const s = W(e);
|
|
531
|
+
if (!$(s, t, e.type_)) return function(e, t, n) {
|
|
532
|
+
const r = ve(t, n);
|
|
533
|
+
return r ? A in r ? r[A] : r.get?.call(e.draft_) : void 0;
|
|
529
534
|
}(e, s, t);
|
|
530
535
|
const o = s[t];
|
|
531
536
|
if (e.finalized_ || !R(o)) return o;
|
|
@@ -533,103 +538,103 @@ var _e = {
|
|
|
533
538
|
const t = +e;
|
|
534
539
|
return Number.isInteger(t) && String(t) === e;
|
|
535
540
|
}(t)) return o;
|
|
536
|
-
if (o ===
|
|
541
|
+
if (o === be(e.base_, t)) {
|
|
537
542
|
ke(e);
|
|
538
|
-
const n = 1 === e.type_ ? +t : t, r =
|
|
543
|
+
const n = 1 === e.type_ ? +t : t, r = Oe(e.scope_, o, e, n);
|
|
539
544
|
return e.copy_[n] = r;
|
|
540
545
|
}
|
|
541
546
|
return o;
|
|
542
547
|
},
|
|
543
|
-
has: (e, t) => t in
|
|
544
|
-
ownKeys: e => Reflect.ownKeys(
|
|
548
|
+
has: (e, t) => t in W(e),
|
|
549
|
+
ownKeys: e => Reflect.ownKeys(W(e)),
|
|
545
550
|
set(e, t, n) {
|
|
546
|
-
const r =
|
|
551
|
+
const r = ve(W(e), t);
|
|
547
552
|
if (r?.set) return r.set.call(e.draft_, n), !0;
|
|
548
553
|
if (!e.modified_) {
|
|
549
|
-
const r =
|
|
554
|
+
const r = be(W(e), t), a = r?.[S];
|
|
550
555
|
if (a && a.base_ === n) return e.copy_[t] = n, e.assigned_.set(t, !1), !0;
|
|
551
|
-
if (((s = n) === (o = r) ? 0 !== s || 1 / s == 1 / o : s != s && o != o) && (void 0 !== n ||
|
|
552
|
-
ke(e),
|
|
556
|
+
if (((s = n) === (o = r) ? 0 !== s || 1 / s == 1 / o : s != s && o != o) && (void 0 !== n || $(e.base_, t, e.type_))) return !0;
|
|
557
|
+
ke(e), Ee(e);
|
|
553
558
|
}
|
|
554
559
|
var s, o;
|
|
555
560
|
return e.copy_[t] === n && (void 0 !== n || t in e.copy_) || Number.isNaN(n) && Number.isNaN(e.copy_[t]) || (e.copy_[t] = n,
|
|
556
561
|
e.assigned_.set(t, !0), function(e, t, n) {
|
|
557
562
|
const {scope_: r} = e;
|
|
558
|
-
if (
|
|
559
|
-
const s = n[
|
|
560
|
-
|
|
563
|
+
if (j(n)) {
|
|
564
|
+
const s = n[S];
|
|
565
|
+
pe(s, r) && s.callbacks_.push(function() {
|
|
561
566
|
ke(e);
|
|
562
|
-
const r =
|
|
563
|
-
|
|
567
|
+
const r = Q(s);
|
|
568
|
+
ge(e, n, r, t);
|
|
564
569
|
});
|
|
565
570
|
} else R(n) && e.callbacks_.push(function() {
|
|
566
|
-
const s =
|
|
567
|
-
3 === e.type_ ? s.has(n) &&
|
|
571
|
+
const s = W(e);
|
|
572
|
+
3 === e.type_ ? s.has(n) && _e(n, r.handledSet_, r) : V(s, t, e.type_) === n && r.drafts_.length > 1 && !0 === (e.assigned_.get(t) ?? !1) && e.copy_ && _e(V(e.copy_, t, e.type_), r.handledSet_, r);
|
|
568
573
|
});
|
|
569
574
|
}(e, t, n)), !0;
|
|
570
575
|
},
|
|
571
|
-
deleteProperty: (e, t) => (ke(e), void 0 !==
|
|
572
|
-
|
|
576
|
+
deleteProperty: (e, t) => (ke(e), void 0 !== be(e.base_, t) || t in e.base_ ? (e.assigned_.set(t, !1),
|
|
577
|
+
Ee(e)) : e.assigned_.delete(t), e.copy_ && delete e.copy_[t], !0),
|
|
573
578
|
getOwnPropertyDescriptor(e, t) {
|
|
574
|
-
const n =
|
|
579
|
+
const n = W(e), r = Reflect.getOwnPropertyDescriptor(n, t);
|
|
575
580
|
return r ? {
|
|
576
|
-
[
|
|
577
|
-
[
|
|
578
|
-
[
|
|
579
|
-
[
|
|
581
|
+
[M]: !0,
|
|
582
|
+
[C]: 1 !== e.type_ || "length" !== t,
|
|
583
|
+
[D]: r[D],
|
|
584
|
+
[A]: n[t]
|
|
580
585
|
} : r;
|
|
581
586
|
},
|
|
582
587
|
defineProperty() {
|
|
583
|
-
|
|
588
|
+
b(11);
|
|
584
589
|
},
|
|
585
|
-
getPrototypeOf: e =>
|
|
590
|
+
getPrototypeOf: e => E(e.base_),
|
|
586
591
|
setPrototypeOf() {
|
|
587
|
-
|
|
592
|
+
b(12);
|
|
588
593
|
}
|
|
589
|
-
},
|
|
594
|
+
}, we = {};
|
|
590
595
|
|
|
591
|
-
for (let e in
|
|
592
|
-
let t =
|
|
593
|
-
|
|
596
|
+
for (let e in Se) {
|
|
597
|
+
let t = Se[e];
|
|
598
|
+
we[e] = function() {
|
|
594
599
|
const e = arguments;
|
|
595
600
|
return e[0] = e[0][0], t.apply(this, e);
|
|
596
601
|
};
|
|
597
602
|
}
|
|
598
603
|
|
|
599
|
-
function
|
|
600
|
-
const n = e[
|
|
601
|
-
return (n ?
|
|
604
|
+
function be(e, t) {
|
|
605
|
+
const n = e[S];
|
|
606
|
+
return (n ? W(n) : e)[t];
|
|
602
607
|
}
|
|
603
608
|
|
|
604
|
-
function
|
|
609
|
+
function ve(e, t) {
|
|
605
610
|
if (!(t in e)) return;
|
|
606
|
-
let n =
|
|
611
|
+
let n = E(e);
|
|
607
612
|
for (;n; ) {
|
|
608
613
|
const e = Object.getOwnPropertyDescriptor(n, t);
|
|
609
614
|
if (e) return e;
|
|
610
|
-
n =
|
|
615
|
+
n = E(n);
|
|
611
616
|
}
|
|
612
617
|
}
|
|
613
618
|
|
|
614
|
-
function
|
|
615
|
-
e.modified_ || (e.modified_ = !0, e.parent_ &&
|
|
619
|
+
function Ee(e) {
|
|
620
|
+
e.modified_ || (e.modified_ = !0, e.parent_ && Ee(e.parent_));
|
|
616
621
|
}
|
|
617
622
|
|
|
618
623
|
function ke(e) {
|
|
619
|
-
e.copy_ || (e.assigned_ = new Map, e.copy_ =
|
|
624
|
+
e.copy_ || (e.assigned_ = new Map, e.copy_ = q(e.base_, e.scope_.immer_.useStrictShallowCopy_));
|
|
620
625
|
}
|
|
621
626
|
|
|
622
|
-
|
|
623
|
-
return isNaN(parseInt(t)) &&
|
|
624
|
-
},
|
|
625
|
-
return "length" !== t && isNaN(parseInt(t)) &&
|
|
627
|
+
we.deleteProperty = function(e, t) {
|
|
628
|
+
return isNaN(parseInt(t)) && b(13), we.set.call(this, e, t, void 0);
|
|
629
|
+
}, we.set = function(e, t, n) {
|
|
630
|
+
return "length" !== t && isNaN(parseInt(t)) && b(14), Se.set.call(this, e[0], t, n, e[0]);
|
|
626
631
|
};
|
|
627
632
|
|
|
628
|
-
function
|
|
629
|
-
const [s, o] =
|
|
630
|
-
const n =
|
|
633
|
+
function Oe(e, t, n, r) {
|
|
634
|
+
const [s, o] = L(t) ? ne(Z).proxyMap_(t, n) : F(t) ? ne(Z).proxySet_(t, n) : function(e, t) {
|
|
635
|
+
const n = U(e), r = {
|
|
631
636
|
type_: n ? 1 : 0,
|
|
632
|
-
scope_: t ? t.scope_ :
|
|
637
|
+
scope_: t ? t.scope_ : oe(),
|
|
633
638
|
modified_: !1,
|
|
634
639
|
finalized_: !1,
|
|
635
640
|
assigned_: void 0,
|
|
@@ -641,19 +646,19 @@ function Ee(e, t, n, r) {
|
|
|
641
646
|
isManual_: !1,
|
|
642
647
|
callbacks_: void 0
|
|
643
648
|
};
|
|
644
|
-
let s = r, o =
|
|
645
|
-
n && (s = [ r ], o =
|
|
649
|
+
let s = r, o = Se;
|
|
650
|
+
n && (s = [ r ], o = we);
|
|
646
651
|
const {revoke: a, proxy: i} = Proxy.revocable(s, o);
|
|
647
652
|
return r.draft_ = i, r.revoke_ = a, [ i, r ];
|
|
648
653
|
}(t, n);
|
|
649
|
-
return (n?.scope_ ??
|
|
654
|
+
return (n?.scope_ ?? oe()).drafts_.push(s), o.callbacks_ = n?.callbacks_ ?? [],
|
|
650
655
|
o.key_ = r, n && void 0 !== r ? function(e, t, n) {
|
|
651
656
|
e.callbacks_.push(function(r) {
|
|
652
657
|
const s = t;
|
|
653
|
-
if (!s || !
|
|
658
|
+
if (!s || !pe(s, r)) return;
|
|
654
659
|
r.mapSetPlugin_?.fixSetContents(s);
|
|
655
|
-
const o =
|
|
656
|
-
|
|
660
|
+
const o = Q(s);
|
|
661
|
+
ge(e, s.draft_ ?? s, o, n), me(s, r);
|
|
657
662
|
});
|
|
658
663
|
}(n, o, r) : o.callbacks_.push(function(e) {
|
|
659
664
|
e.mapSetPlugin_?.fixSetContents(o);
|
|
@@ -662,24 +667,24 @@ function Ee(e, t, n, r) {
|
|
|
662
667
|
}), s;
|
|
663
668
|
}
|
|
664
669
|
|
|
665
|
-
function
|
|
670
|
+
function Ce(e) {
|
|
666
671
|
if (!R(e) || X(e)) return e;
|
|
667
|
-
const t = e[
|
|
672
|
+
const t = e[S];
|
|
668
673
|
let n, r = !0;
|
|
669
674
|
if (t) {
|
|
670
675
|
if (!t.modified_) return t.base_;
|
|
671
|
-
t.finalized_ = !0, n =
|
|
672
|
-
} else n =
|
|
673
|
-
return
|
|
674
|
-
|
|
676
|
+
t.finalized_ = !0, n = q(e, t.scope_.immer_.useStrictShallowCopy_), r = t.scope_.immer_.shouldUseStrictIteration();
|
|
677
|
+
} else n = q(e, !0);
|
|
678
|
+
return z(n, (e, t) => {
|
|
679
|
+
N(n, e, Ce(t));
|
|
675
680
|
}, r), t && (t.finalized_ = !1), n;
|
|
676
681
|
}
|
|
677
682
|
|
|
678
|
-
var
|
|
683
|
+
var De = (new class {
|
|
679
684
|
constructor(e) {
|
|
680
685
|
this.autoFreeze_ = !0, this.useStrictShallowCopy_ = !1, this.useStrictIteration_ = !1,
|
|
681
686
|
this.produce = (e, t, n) => {
|
|
682
|
-
if (
|
|
687
|
+
if (J(e) && !J(t)) {
|
|
683
688
|
const n = t;
|
|
684
689
|
t = e;
|
|
685
690
|
const r = this;
|
|
@@ -688,50 +693,50 @@ var Ce = (new class {
|
|
|
688
693
|
};
|
|
689
694
|
}
|
|
690
695
|
let r;
|
|
691
|
-
if (
|
|
692
|
-
const s =
|
|
696
|
+
if (J(t) || b(6), void 0 === n || J(n) || b(7), R(e)) {
|
|
697
|
+
const s = le(this), o = Oe(s, e, void 0);
|
|
693
698
|
let a = !0;
|
|
694
699
|
try {
|
|
695
700
|
r = t(o), a = !1;
|
|
696
701
|
} finally {
|
|
697
|
-
a ?
|
|
702
|
+
a ? ie(s) : ce(s);
|
|
698
703
|
}
|
|
699
|
-
return
|
|
704
|
+
return ae(s, n), de(r, s);
|
|
700
705
|
}
|
|
701
|
-
if (!e || !
|
|
702
|
-
if (r = t(e), void 0 === r && (r = e), r ===
|
|
706
|
+
if (!e || !K(e)) {
|
|
707
|
+
if (r = t(e), void 0 === r && (r = e), r === m && (r = void 0), this.autoFreeze_ && H(r, !0),
|
|
703
708
|
n) {
|
|
704
709
|
const t = [], s = [];
|
|
705
|
-
|
|
710
|
+
ne(Y).generateReplacementPatches_(e, r, {
|
|
706
711
|
patches_: t,
|
|
707
712
|
inversePatches_: s
|
|
708
713
|
}), n(t, s);
|
|
709
714
|
}
|
|
710
715
|
return r;
|
|
711
716
|
}
|
|
712
|
-
|
|
717
|
+
b(1, e);
|
|
713
718
|
}, this.produceWithPatches = (e, t) => {
|
|
714
|
-
if (
|
|
719
|
+
if (J(e)) return (t, ...n) => this.produceWithPatches(t, t => e(t, ...n));
|
|
715
720
|
let n, r;
|
|
716
721
|
return [ this.produce(e, t, (e, t) => {
|
|
717
722
|
n = e, r = t;
|
|
718
723
|
}), n, r ];
|
|
719
|
-
},
|
|
720
|
-
|
|
724
|
+
}, B(e?.autoFreeze) && this.setAutoFreeze(e.autoFreeze), B(e?.useStrictShallowCopy) && this.setUseStrictShallowCopy(e.useStrictShallowCopy),
|
|
725
|
+
B(e?.useStrictIteration) && this.setUseStrictIteration(e.useStrictIteration);
|
|
721
726
|
}
|
|
722
727
|
createDraft(e) {
|
|
723
|
-
R(e) ||
|
|
724
|
-
|
|
725
|
-
return
|
|
728
|
+
R(e) || b(8), j(e) && (e = function(e) {
|
|
729
|
+
j(e) || b(10, e);
|
|
730
|
+
return Ce(e);
|
|
726
731
|
}(e));
|
|
727
|
-
const t =
|
|
728
|
-
return n[
|
|
732
|
+
const t = le(this), n = Oe(t, e, void 0);
|
|
733
|
+
return n[S].isManual_ = !0, ce(t), n;
|
|
729
734
|
}
|
|
730
735
|
finishDraft(e, t) {
|
|
731
|
-
const n = e && e[
|
|
732
|
-
n && n.isManual_ ||
|
|
736
|
+
const n = e && e[S];
|
|
737
|
+
n && n.isManual_ || b(9);
|
|
733
738
|
const {scope_: r} = n;
|
|
734
|
-
return
|
|
739
|
+
return ae(r, t), de(void 0, r);
|
|
735
740
|
}
|
|
736
741
|
setAutoFreeze(e) {
|
|
737
742
|
this.autoFreeze_ = e;
|
|
@@ -755,10 +760,10 @@ var Ce = (new class {
|
|
|
755
760
|
}
|
|
756
761
|
}
|
|
757
762
|
n > -1 && (t = t.slice(n + 1));
|
|
758
|
-
const r =
|
|
759
|
-
return
|
|
763
|
+
const r = ne(Y).applyPatches_;
|
|
764
|
+
return j(e) ? r(e, t) : this.produce(e, e => r(e, t));
|
|
760
765
|
}
|
|
761
|
-
}).produce,
|
|
766
|
+
}).produce, Me = (e, t) => {
|
|
762
767
|
const n = Date.now();
|
|
763
768
|
if (/\(\.*\+\?\)\+/.test(e) || /\(\.*\?\)\*/.test(e)) return !1;
|
|
764
769
|
if (e.length > 500) return !1;
|
|
@@ -769,13 +774,13 @@ var Ce = (new class {
|
|
|
769
774
|
} catch {
|
|
770
775
|
return !1;
|
|
771
776
|
}
|
|
772
|
-
},
|
|
777
|
+
}, Ae = () => {
|
|
773
778
|
if ("undefined" != typeof crypto && "function" == typeof crypto.randomUUID) try {
|
|
774
779
|
return crypto.randomUUID();
|
|
775
780
|
} catch {}
|
|
776
781
|
throw new Error("Cryptographically secure random UUID generation is required but crypto.randomUUID is unavailable. Please use a browser or environment with Web Crypto API support.");
|
|
777
|
-
},
|
|
778
|
-
if (!
|
|
782
|
+
}, je = "undefined" != typeof crypto && void 0 !== crypto.subtle && "function" == typeof crypto.subtle.generateKey, Re = async (e, t, n = 6e5) => {
|
|
783
|
+
if (!je) throw new Error("Web Crypto API not available");
|
|
779
784
|
const r = await crypto.subtle.importKey("raw", (new TextEncoder).encode(e), "PBKDF2", !1, [ "deriveKey" ]);
|
|
780
785
|
return {
|
|
781
786
|
key: await crypto.subtle.deriveKey({
|
|
@@ -789,8 +794,8 @@ var Ce = (new class {
|
|
|
789
794
|
}, !0, [ "encrypt", "decrypt" ]),
|
|
790
795
|
iv: crypto.getRandomValues(new Uint8Array(12))
|
|
791
796
|
};
|
|
792
|
-
},
|
|
793
|
-
if (!
|
|
797
|
+
}, Pe = (e = 32) => crypto.getRandomValues(new Uint8Array(e)), Te = async () => {
|
|
798
|
+
if (!je) throw new Error("Web Crypto API not available");
|
|
794
799
|
return {
|
|
795
800
|
key: await crypto.subtle.generateKey({
|
|
796
801
|
name: "AES-GCM",
|
|
@@ -798,13 +803,13 @@ var Ce = (new class {
|
|
|
798
803
|
}, !0, [ "encrypt", "decrypt" ]),
|
|
799
804
|
iv: crypto.getRandomValues(new Uint8Array(12))
|
|
800
805
|
};
|
|
801
|
-
},
|
|
806
|
+
}, Ie = async e => {
|
|
802
807
|
const t = await crypto.subtle.exportKey("raw", e.key);
|
|
803
808
|
return {
|
|
804
809
|
key: btoa(String.fromCharCode(...new Uint8Array(t))),
|
|
805
810
|
iv: btoa(String.fromCharCode(...e.iv))
|
|
806
811
|
};
|
|
807
|
-
},
|
|
812
|
+
}, ze = async (e, t) => {
|
|
808
813
|
const n = Uint8Array.from(atob(e), e => e.charCodeAt(0)), r = Uint8Array.from(atob(t), e => e.charCodeAt(0));
|
|
809
814
|
return {
|
|
810
815
|
key: await crypto.subtle.importKey("raw", n, {
|
|
@@ -813,32 +818,32 @@ var Ce = (new class {
|
|
|
813
818
|
}, !0, [ "encrypt", "decrypt" ]),
|
|
814
819
|
iv: r
|
|
815
820
|
};
|
|
816
|
-
},
|
|
821
|
+
}, xe = async (e, t) => {
|
|
817
822
|
const n = (new TextEncoder).encode(JSON.stringify(e)), r = await crypto.subtle.encrypt({
|
|
818
823
|
name: "AES-GCM",
|
|
819
824
|
iv: t.iv
|
|
820
825
|
}, t.key, n), s = new Uint8Array(t.iv.length + r.byteLength);
|
|
821
826
|
return s.set(t.iv), s.set(new Uint8Array(r), t.iv.length), btoa(String.fromCharCode(...s));
|
|
822
|
-
},
|
|
827
|
+
}, $e = async (e, t) => {
|
|
823
828
|
const n = Uint8Array.from(atob(e), e => e.charCodeAt(0)), r = n.slice(0, 12), s = n.slice(12), o = await crypto.subtle.decrypt({
|
|
824
829
|
name: "AES-GCM",
|
|
825
830
|
iv: r
|
|
826
831
|
}, t.key, s);
|
|
827
832
|
return JSON.parse((new TextDecoder).decode(o));
|
|
828
|
-
},
|
|
829
|
-
|
|
830
|
-
},
|
|
831
|
-
|
|
832
|
-
},
|
|
833
|
+
}, Ve = null, Ne = e => {
|
|
834
|
+
Ve = e;
|
|
835
|
+
}, Ue = e => {
|
|
836
|
+
Ve && Ve(e);
|
|
837
|
+
}, Le = (e, t, n) => {
|
|
833
838
|
e.set(t instanceof RegExp ? t.source : t, n);
|
|
834
|
-
},
|
|
839
|
+
}, Fe = (e, t, n, r) => {
|
|
835
840
|
if (0 === e.size) return !0;
|
|
836
841
|
for (const [s, o] of e) {
|
|
837
842
|
let e;
|
|
838
|
-
if (e = "function" == typeof s ? s(t, r) :
|
|
843
|
+
if (e = "function" == typeof s ? s(t, r) : Me(s, t), e) return o.includes(n) || o.includes("admin");
|
|
839
844
|
}
|
|
840
845
|
return !1;
|
|
841
|
-
},
|
|
846
|
+
}, Ke = e => {
|
|
842
847
|
if ("string" == typeof e) {
|
|
843
848
|
let t = e.replace(/&#[xX]?[0-9a-fA-F]+;?/g, e => {
|
|
844
849
|
const t = e.match(/&#x([0-9a-fA-F]+);?/i);
|
|
@@ -854,20 +859,20 @@ var Ce = (new class {
|
|
|
854
859
|
if (e && "object" == typeof e && !Array.isArray(e)) {
|
|
855
860
|
if (Object.getPrototypeOf(e) === Object.prototype) {
|
|
856
861
|
const t = {};
|
|
857
|
-
for (const [n, r] of Object.entries(e)) t[n] =
|
|
862
|
+
for (const [n, r] of Object.entries(e)) t[n] = Ke(r);
|
|
858
863
|
return t;
|
|
859
864
|
}
|
|
860
865
|
return e;
|
|
861
866
|
}
|
|
862
|
-
return Array.isArray(e) ? e.map(e =>
|
|
863
|
-
},
|
|
867
|
+
return Array.isArray(e) ? e.map(e => Ke(e)) : e;
|
|
868
|
+
}, Je = e => /^([a-zA-Z0-9_.-][a-zA-Z0-9_.-]*)$/.test(e) && e.length <= 256 && e.length > 0, Be = (e, t, n, r) => {
|
|
864
869
|
const s = {
|
|
865
|
-
id:
|
|
870
|
+
id: Ae(),
|
|
866
871
|
purpose: n,
|
|
867
872
|
granted: r,
|
|
868
873
|
timestamp: Date.now()
|
|
869
874
|
}, o = e.get(t) || [];
|
|
870
|
-
return o.push(s), e.set(t, o),
|
|
875
|
+
return o.push(s), e.set(t, o), Ue({
|
|
871
876
|
timestamp: Date.now(),
|
|
872
877
|
action: "set",
|
|
873
878
|
key: `consent:${n}`,
|
|
@@ -876,13 +881,13 @@ var Ce = (new class {
|
|
|
876
881
|
}), s;
|
|
877
882
|
};
|
|
878
883
|
|
|
879
|
-
|
|
884
|
+
p();
|
|
880
885
|
|
|
881
|
-
var
|
|
886
|
+
var We = e => `${e}_`;
|
|
882
887
|
|
|
883
|
-
|
|
888
|
+
p();
|
|
884
889
|
|
|
885
|
-
var
|
|
890
|
+
var Qe = () => {
|
|
886
891
|
try {
|
|
887
892
|
0;
|
|
888
893
|
const e = "undefined" != typeof globalThis ? globalThis : "undefined" != typeof window ? window : {};
|
|
@@ -890,10 +895,21 @@ var We = () => {
|
|
|
890
895
|
} catch {
|
|
891
896
|
return !1;
|
|
892
897
|
}
|
|
893
|
-
},
|
|
894
|
-
const
|
|
895
|
-
|
|
896
|
-
|
|
898
|
+
}, qe = () => "undefined" != typeof window ? window.localStorage : null, He = () => {
|
|
899
|
+
const e = new Map;
|
|
900
|
+
return {
|
|
901
|
+
getItem: t => e.get(t) || null,
|
|
902
|
+
setItem: (t, n) => e.set(t, n),
|
|
903
|
+
removeItem: t => e.delete(t),
|
|
904
|
+
key: t => Array.from(e.keys())[t] || null,
|
|
905
|
+
get length() {
|
|
906
|
+
return e.size;
|
|
907
|
+
}
|
|
908
|
+
};
|
|
909
|
+
}, Ge = e => {
|
|
910
|
+
const t = new Map, n = new Map, r = new Map, s = new Set, o = new Map, c = new Set, l = new Map, u = new Map, d = new Map, f = 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 || qe(), k = e?.onError, O = e?.maxObjectSize ?? 0, C = e?.maxTotalSize ?? 0, D = e?.encryptionKey ?? null, M = e?.validateInput ?? !0, A = e?.auditEnabled ?? !0, j = e?.userId, R = e?.immer ?? !0, P = e?.persistByDefault ?? e?.persistence ?? e?.persist ?? !1;
|
|
911
|
+
e?.accessRules && e.accessRules.forEach(e => Le(m, e.pattern, e.permissions));
|
|
912
|
+
let T, I = !1, z = !1, x = !1, $ = 0, V = null, N = null;
|
|
897
913
|
const U = new Promise(e => {
|
|
898
914
|
T = e;
|
|
899
915
|
}), L = () => `${S}_`, F = () => ({
|
|
@@ -901,18 +917,18 @@ var We = () => {
|
|
|
901
917
|
versions: n,
|
|
902
918
|
sizes: r,
|
|
903
919
|
totalSize: $,
|
|
904
|
-
storage:
|
|
920
|
+
storage: E,
|
|
905
921
|
config: e || {},
|
|
906
922
|
diskQueue: y,
|
|
907
923
|
encryptionKey: D,
|
|
908
924
|
audit: W,
|
|
909
|
-
onError:
|
|
925
|
+
onError: k,
|
|
910
926
|
silent: w,
|
|
911
927
|
debounceTime: b,
|
|
912
928
|
currentVersion: v
|
|
913
929
|
}), K = () => ({
|
|
914
930
|
plugins: f,
|
|
915
|
-
onError:
|
|
931
|
+
onError: k,
|
|
916
932
|
silent: w
|
|
917
933
|
}), J = e => {
|
|
918
934
|
if (null == e) return 0;
|
|
@@ -949,18 +965,18 @@ var We = () => {
|
|
|
949
965
|
}
|
|
950
966
|
})(K(), e, t);
|
|
951
967
|
}, W = (e, t, n, r) => {
|
|
952
|
-
A && null !==
|
|
968
|
+
A && null !== Ve && Ue && Ue({
|
|
953
969
|
timestamp: Date.now(),
|
|
954
970
|
action: e,
|
|
955
971
|
key: t,
|
|
956
|
-
userId:
|
|
972
|
+
userId: j,
|
|
957
973
|
success: n,
|
|
958
974
|
error: r
|
|
959
975
|
});
|
|
960
976
|
}, Q = e => {
|
|
961
977
|
const t = u.get(e);
|
|
962
978
|
if (!t) return;
|
|
963
|
-
const r = new Set, s = t.selector(e => (r.add(e), u.has(e) ? u.get(e).lastValue :
|
|
979
|
+
const r = new Set, s = t.selector(e => (r.add(e), u.has(e) ? u.get(e).lastValue : Z.get(e)));
|
|
964
980
|
t.deps.forEach(t => {
|
|
965
981
|
if (!r.has(t)) {
|
|
966
982
|
const n = d.get(t);
|
|
@@ -968,7 +984,7 @@ var We = () => {
|
|
|
968
984
|
}
|
|
969
985
|
}), r.forEach(n => {
|
|
970
986
|
t.deps.has(n) || (d.has(n) || d.set(n, new Set), d.get(n).add(e));
|
|
971
|
-
}), t.deps = r, i(t.lastValue, s) || (t.lastValue =
|
|
987
|
+
}), t.deps = r, i(t.lastValue, s) || (t.lastValue = R && null !== s && "object" == typeof s ? H(a(s), !0) : s,
|
|
972
988
|
n.set(e, (n.get(e) || 0) + 1), q(e));
|
|
973
989
|
}, q = e => {
|
|
974
990
|
if (e) {
|
|
@@ -978,12 +994,12 @@ var We = () => {
|
|
|
978
994
|
}
|
|
979
995
|
const t = l.get(e);
|
|
980
996
|
if (t) {
|
|
981
|
-
const n =
|
|
997
|
+
const n = Z.get(e);
|
|
982
998
|
for (const r of t) try {
|
|
983
999
|
r(n);
|
|
984
1000
|
} catch (t) {
|
|
985
1001
|
const n = t instanceof Error ? t : new Error(String(t));
|
|
986
|
-
|
|
1002
|
+
k && k(n, {
|
|
987
1003
|
operation: "watcher",
|
|
988
1004
|
key: e
|
|
989
1005
|
});
|
|
@@ -994,7 +1010,7 @@ var We = () => {
|
|
|
994
1010
|
t();
|
|
995
1011
|
} catch (t) {
|
|
996
1012
|
const n = t instanceof Error ? t : new Error(String(t));
|
|
997
|
-
|
|
1013
|
+
k && k(n, {
|
|
998
1014
|
operation: "keyListener",
|
|
999
1015
|
key: e
|
|
1000
1016
|
});
|
|
@@ -1004,14 +1020,14 @@ var We = () => {
|
|
|
1004
1020
|
e();
|
|
1005
1021
|
} catch (e) {
|
|
1006
1022
|
const t = e instanceof Error ? e : new Error(String(e));
|
|
1007
|
-
|
|
1023
|
+
k && k(t, {
|
|
1008
1024
|
operation: "listener"
|
|
1009
1025
|
});
|
|
1010
1026
|
}
|
|
1011
|
-
},
|
|
1027
|
+
}, G = async () => {
|
|
1012
1028
|
(async e => {
|
|
1013
1029
|
if (!e.storage) return;
|
|
1014
|
-
const {store: t, config: n, diskQueue: r, storage: s, encryptionKey: o, audit: a, onError: i, silent: c, currentVersion: l} = e, u =
|
|
1030
|
+
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");
|
|
1015
1031
|
try {
|
|
1016
1032
|
const e = {};
|
|
1017
1033
|
let r;
|
|
@@ -1042,7 +1058,7 @@ var We = () => {
|
|
|
1042
1058
|
const i = n.options.encoded || n.options.encrypted || n.options.secure;
|
|
1043
1059
|
if (n.options.encrypted) {
|
|
1044
1060
|
if (!o) throw new Error(`Encryption key missing for "${t}"`);
|
|
1045
|
-
r = await
|
|
1061
|
+
r = await xe(n.value, o);
|
|
1046
1062
|
} else i ? r = btoa(JSON.stringify(n.value)) : "object" == typeof n.value && null !== n.value && (r = JSON.stringify(n.value));
|
|
1047
1063
|
s.setItem(`${u}${t}`, JSON.stringify({
|
|
1048
1064
|
v: e.versions.get(t) || 1,
|
|
@@ -1061,32 +1077,32 @@ var We = () => {
|
|
|
1061
1077
|
});
|
|
1062
1078
|
}
|
|
1063
1079
|
})(F());
|
|
1064
|
-
},
|
|
1080
|
+
}, X = {}, Z = {
|
|
1065
1081
|
_setSilently: (e, s) => {
|
|
1066
|
-
const o = r.get(e) || 0, i =
|
|
1082
|
+
const o = r.get(e) || 0, i = R && null !== s && "object" == typeof s ? H(a(s), !0) : s, c = (O > 0 || C > 0) && !Qe() ? J(i) : 0;
|
|
1067
1083
|
$ = $ - o + c, r.set(e, c), t.set(e, i), n.set(e, (n.get(e) || 0) + 1), N = null;
|
|
1068
1084
|
},
|
|
1069
1085
|
_registerMethod: (e, t, n) => {
|
|
1070
1086
|
const r = e => "__proto__" === e || "constructor" === e || "prototype" === e;
|
|
1071
|
-
r(e) || r(t) || (
|
|
1087
|
+
r(e) || r(t) || (X[e] || (X[e] = {}), X[e][t] = n);
|
|
1072
1088
|
},
|
|
1073
1089
|
set: (s, o, c = {}) => {
|
|
1074
|
-
const l = t.get(s), u =
|
|
1075
|
-
if (M && !
|
|
1076
|
-
if (!
|
|
1077
|
-
const d = M ?
|
|
1090
|
+
const l = t.get(s), u = R && "function" == typeof o ? De(l, o) : o;
|
|
1091
|
+
if (M && !Je(s)) return !1;
|
|
1092
|
+
if (!Fe(m, s, "write", j)) return W("set", s, !1, "RBAC Denied"), !1;
|
|
1093
|
+
const d = M ? Ke(u) : u, f = r.get(s) || 0;
|
|
1078
1094
|
B("onBeforeSet", {
|
|
1079
1095
|
key: s,
|
|
1080
1096
|
value: d,
|
|
1081
|
-
store:
|
|
1097
|
+
store: Z,
|
|
1082
1098
|
version: n.get(s) || 0
|
|
1083
1099
|
});
|
|
1084
|
-
const p =
|
|
1100
|
+
const p = R && null !== d && "object" == typeof d ? H(a(d), !0) : d;
|
|
1085
1101
|
if (!i(l, p)) {
|
|
1086
|
-
const o = (O > 0 || C > 0) && !
|
|
1102
|
+
const o = (O > 0 || C > 0) && !Qe() ? J(p) : 0;
|
|
1087
1103
|
if (O > 0 && o > O) {
|
|
1088
1104
|
const e = new Error(`Object size (${o} bytes) exceeds maxObjectSize (${O} bytes)`);
|
|
1089
|
-
return
|
|
1105
|
+
return k && k(e, {
|
|
1090
1106
|
operation: "set",
|
|
1091
1107
|
key: s
|
|
1092
1108
|
}), !1;
|
|
@@ -1095,7 +1111,7 @@ var We = () => {
|
|
|
1095
1111
|
const e = $ - f + o;
|
|
1096
1112
|
if (e > C) {
|
|
1097
1113
|
const t = new Error(`Total store size (${e} bytes) exceeds limit (${C} bytes)`);
|
|
1098
|
-
return
|
|
1114
|
+
return k && k(t, {
|
|
1099
1115
|
operation: "set"
|
|
1100
1116
|
}), !1;
|
|
1101
1117
|
}
|
|
@@ -1109,20 +1125,20 @@ var We = () => {
|
|
|
1109
1125
|
persist: a,
|
|
1110
1126
|
encoded: c.encoded || e?.encoded
|
|
1111
1127
|
}
|
|
1112
|
-
}),
|
|
1128
|
+
}), V && clearTimeout(V), V = setTimeout(G, b)), B("onSet", {
|
|
1113
1129
|
key: s,
|
|
1114
1130
|
value: p,
|
|
1115
|
-
store:
|
|
1131
|
+
store: Z,
|
|
1116
1132
|
version: n.get(s)
|
|
1117
1133
|
}), W("set", s, !0), q(s), !0;
|
|
1118
1134
|
}
|
|
1119
1135
|
return !1;
|
|
1120
1136
|
},
|
|
1121
1137
|
get: e => {
|
|
1122
|
-
if (!
|
|
1138
|
+
if (!Fe(m, e, "read", j)) return W("get", e, !1, "RBAC Denied"), null;
|
|
1123
1139
|
const n = t.get(e);
|
|
1124
1140
|
return B("onGet", {
|
|
1125
|
-
store:
|
|
1141
|
+
store: Z,
|
|
1126
1142
|
key: e,
|
|
1127
1143
|
value: n
|
|
1128
1144
|
}), W("get", e, !0), n;
|
|
@@ -1136,7 +1152,7 @@ var We = () => {
|
|
|
1136
1152
|
}), Q(e)), u.get(e).lastValue;
|
|
1137
1153
|
} catch (t) {
|
|
1138
1154
|
const n = t instanceof Error ? t : new Error(String(t));
|
|
1139
|
-
return
|
|
1155
|
+
return k && k(n, {
|
|
1140
1156
|
operation: "compute",
|
|
1141
1157
|
key: e
|
|
1142
1158
|
}), null;
|
|
@@ -1150,24 +1166,24 @@ var We = () => {
|
|
|
1150
1166
|
};
|
|
1151
1167
|
},
|
|
1152
1168
|
remove: e => {
|
|
1153
|
-
if (!
|
|
1169
|
+
if (!Fe(m, e, "delete", j)) return W("delete", e, !1, "RBAC Denied"), !1;
|
|
1154
1170
|
const s = t.get(e), o = t.delete(e);
|
|
1155
1171
|
return o && ($ -= r.get(e) || 0, r.delete(e), B("onRemove", {
|
|
1156
|
-
store:
|
|
1172
|
+
store: Z,
|
|
1157
1173
|
key: e,
|
|
1158
1174
|
value: s
|
|
1159
|
-
}), N = null), n.set(e, (n.get(e) || 0) + 1),
|
|
1175
|
+
}), N = null), n.set(e, (n.get(e) || 0) + 1), E && E.removeItem(`${L()}${e}`), W("delete", e, !0),
|
|
1160
1176
|
q(e), o;
|
|
1161
1177
|
},
|
|
1162
|
-
delete: e =>
|
|
1178
|
+
delete: e => Z.remove(e),
|
|
1163
1179
|
deleteAll: () => {
|
|
1164
|
-
if (Array.from(t.keys()).forEach(e =>
|
|
1165
|
-
const e = L(), t = [], n =
|
|
1180
|
+
if (Array.from(t.keys()).forEach(e => Z.remove(e)), E) {
|
|
1181
|
+
const e = L(), t = [], n = E.length || 0;
|
|
1166
1182
|
for (let r = 0; r < n; r++) {
|
|
1167
|
-
const n =
|
|
1183
|
+
const n = E.key(r);
|
|
1168
1184
|
n && n.startsWith(e) && t.push(n);
|
|
1169
1185
|
}
|
|
1170
|
-
for (const e of t)
|
|
1186
|
+
for (const e of t) E.removeItem(e);
|
|
1171
1187
|
}
|
|
1172
1188
|
return $ = 0, r.clear(), N = null, !0;
|
|
1173
1189
|
},
|
|
@@ -1177,24 +1193,24 @@ var We = () => {
|
|
|
1177
1193
|
},
|
|
1178
1194
|
transaction: e => {
|
|
1179
1195
|
I = !0, B("onTransaction", {
|
|
1180
|
-
store:
|
|
1196
|
+
store: Z,
|
|
1181
1197
|
key: "START"
|
|
1182
1198
|
});
|
|
1183
1199
|
try {
|
|
1184
1200
|
e();
|
|
1185
1201
|
} finally {
|
|
1186
1202
|
I = !1, B("onTransaction", {
|
|
1187
|
-
store:
|
|
1203
|
+
store: Z,
|
|
1188
1204
|
key: "END"
|
|
1189
1205
|
}), z && (z = !1, q());
|
|
1190
1206
|
}
|
|
1191
1207
|
},
|
|
1192
1208
|
destroy: () => {
|
|
1193
|
-
|
|
1209
|
+
V && (clearTimeout(V), V = null), y.clear(), "undefined" != typeof window && window.removeEventListener("beforeunload", Y),
|
|
1194
1210
|
B("onDestroy", {
|
|
1195
|
-
store:
|
|
1211
|
+
store: Z
|
|
1196
1212
|
}), s.clear(), o.clear(), l.clear(), u.clear(), d.clear(), f.clear(), t.clear(),
|
|
1197
|
-
r.clear(), $ = 0, m.clear(), _.clear(), n.clear(),
|
|
1213
|
+
r.clear(), $ = 0, m.clear(), _.clear(), n.clear(), p.clear(), c.clear();
|
|
1198
1214
|
},
|
|
1199
1215
|
_addPlugin: e => {
|
|
1200
1216
|
((e, t, n) => {
|
|
@@ -1209,7 +1225,7 @@ var We = () => {
|
|
|
1209
1225
|
key: t.name
|
|
1210
1226
|
}) : e.silent;
|
|
1211
1227
|
}
|
|
1212
|
-
})(K(), e,
|
|
1228
|
+
})(K(), e, Z);
|
|
1213
1229
|
},
|
|
1214
1230
|
_removePlugin: e => {
|
|
1215
1231
|
f.delete(e);
|
|
@@ -1225,9 +1241,9 @@ var We = () => {
|
|
|
1225
1241
|
return s.add(e), () => s.delete(e);
|
|
1226
1242
|
},
|
|
1227
1243
|
_getVersion: e => n.get(e) ?? 0,
|
|
1228
|
-
addAccessRule: (e, t) =>
|
|
1229
|
-
hasPermission: (e, t, n) =>
|
|
1230
|
-
recordConsent: (e, t, n) =>
|
|
1244
|
+
addAccessRule: (e, t) => Le(m, e, t),
|
|
1245
|
+
hasPermission: (e, t, n) => Fe(m, e, t, n),
|
|
1246
|
+
recordConsent: (e, t, n) => Be(_, e, t, n),
|
|
1231
1247
|
hasConsent: (e, t) => ((e, t, n) => {
|
|
1232
1248
|
const r = e.get(t);
|
|
1233
1249
|
if (!r) return !1;
|
|
@@ -1238,7 +1254,7 @@ var We = () => {
|
|
|
1238
1254
|
return !1;
|
|
1239
1255
|
})(_, e, t),
|
|
1240
1256
|
getConsents: e => ((e, t) => e.get(t) || [])(_, e),
|
|
1241
|
-
revokeConsent: (e, t) => ((e, t, n) =>
|
|
1257
|
+
revokeConsent: (e, t) => ((e, t, n) => Be(e, t, n, !1))(_, e, t),
|
|
1242
1258
|
exportUserData: e => ((e, t) => ({
|
|
1243
1259
|
userId: t,
|
|
1244
1260
|
exportedAt: Date.now(),
|
|
@@ -1253,29 +1269,29 @@ var We = () => {
|
|
|
1253
1269
|
})(_, e),
|
|
1254
1270
|
getSnapshot: () => (N || (N = Object.fromEntries(t.entries())), N),
|
|
1255
1271
|
get plugins() {
|
|
1256
|
-
return
|
|
1272
|
+
return X;
|
|
1257
1273
|
},
|
|
1258
1274
|
get isReady() {
|
|
1259
|
-
return
|
|
1275
|
+
return x;
|
|
1260
1276
|
},
|
|
1261
1277
|
get namespace() {
|
|
1262
1278
|
return S;
|
|
1263
1279
|
},
|
|
1264
1280
|
get userId() {
|
|
1265
|
-
return
|
|
1281
|
+
return j;
|
|
1266
1282
|
},
|
|
1267
1283
|
whenReady: () => U
|
|
1268
1284
|
};
|
|
1269
1285
|
[ "addAccessRule", "recordConsent", "hasConsent", "getConsents", "revokeConsent", "exportUserData", "deleteUserData" ].forEach(e => {
|
|
1270
|
-
const t =
|
|
1271
|
-
t &&
|
|
1286
|
+
const t = Z[e];
|
|
1287
|
+
t && Z._registerMethod("security", e, t);
|
|
1272
1288
|
});
|
|
1273
1289
|
const Y = () => {
|
|
1274
|
-
y.size > 0 &&
|
|
1290
|
+
y.size > 0 && G();
|
|
1275
1291
|
};
|
|
1276
1292
|
if ("undefined" != typeof window && window.addEventListener("beforeunload", Y),
|
|
1277
|
-
|
|
1278
|
-
const {storage: r, config: s, encryptionKey: o, audit: i, onError: c, silent: l, currentVersion: u, store: d, sizes: f, versions: y} = e, p =
|
|
1293
|
+
E ? (async (e, t, n) => {
|
|
1294
|
+
const {storage: r, config: s, encryptionKey: o, audit: i, onError: c, silent: l, currentVersion: u, store: d, sizes: f, versions: y} = e, p = We(s.namespace || "gstate"), h = s.immer ?? !0;
|
|
1279
1295
|
if (r) try {
|
|
1280
1296
|
const l = {};
|
|
1281
1297
|
let g = 0;
|
|
@@ -1290,7 +1306,7 @@ var We = () => {
|
|
|
1290
1306
|
continue;
|
|
1291
1307
|
}
|
|
1292
1308
|
let c = s.d;
|
|
1293
|
-
if (s._enc && o) c = await
|
|
1309
|
+
if (s._enc && o) c = await $e(c, o); else if ("string" == typeof c) if (s._b64) try {
|
|
1294
1310
|
c = JSON.parse(atob(c));
|
|
1295
1311
|
} catch (e) {} else if (c.startsWith("{") || c.startsWith("[")) try {
|
|
1296
1312
|
c = JSON.parse(c);
|
|
@@ -1307,7 +1323,7 @@ var We = () => {
|
|
|
1307
1323
|
}
|
|
1308
1324
|
const m = g < u && s.migrate ? s.migrate(l, g) : l;
|
|
1309
1325
|
Object.entries(m).forEach(([n, r]) => {
|
|
1310
|
-
const s = h && null !== r && "object" == typeof r ?
|
|
1326
|
+
const s = h && null !== r && "object" == typeof r ? H(a(r), !0) : r, o = t(s), i = f.get(n) || 0;
|
|
1311
1327
|
e.totalSize = e.totalSize - i + o, f.set(n, o), d.set(n, s), y.set(n, 1);
|
|
1312
1328
|
}), n();
|
|
1313
1329
|
} catch (e) {
|
|
@@ -1316,45 +1332,45 @@ var We = () => {
|
|
|
1316
1332
|
operation: "hydration"
|
|
1317
1333
|
});
|
|
1318
1334
|
}
|
|
1319
|
-
})(F(), e => (O > 0 || C > 0) && !
|
|
1320
|
-
|
|
1321
|
-
}).then(() => {}) : (
|
|
1335
|
+
})(F(), e => (O > 0 || C > 0) && !Qe() ? J(e) : 0, () => {
|
|
1336
|
+
x = !0, N = null, T(), q();
|
|
1337
|
+
}).then(() => {}) : (x = !0, T()), e?.sync) {
|
|
1322
1338
|
const t = e.sync, n = async () => {
|
|
1323
|
-
const {SyncEngine: e} = await Promise.resolve().then(() => (
|
|
1324
|
-
return new e(
|
|
1339
|
+
const {SyncEngine: e} = await Promise.resolve().then(() => (g(), h));
|
|
1340
|
+
return new e(Z, t);
|
|
1325
1341
|
};
|
|
1326
1342
|
let r = null;
|
|
1327
|
-
|
|
1343
|
+
Z._registerMethod("sync", "flush", async () => {
|
|
1328
1344
|
r || (r = n());
|
|
1329
1345
|
return (await r).flush();
|
|
1330
|
-
}),
|
|
1346
|
+
}), Z._registerMethod("sync", "getState", async () => {
|
|
1331
1347
|
r || (r = n());
|
|
1332
1348
|
return (await r).getState();
|
|
1333
|
-
}),
|
|
1349
|
+
}), Z._registerMethod("sync", "onStateChange", async e => {
|
|
1334
1350
|
r || (r = n());
|
|
1335
1351
|
return (await r).onStateChange(e);
|
|
1336
|
-
}),
|
|
1352
|
+
}), Z._registerMethod("sync", "forceSync", async () => {
|
|
1337
1353
|
r || (r = n());
|
|
1338
1354
|
return (await r).sync();
|
|
1339
1355
|
});
|
|
1340
1356
|
}
|
|
1341
|
-
return
|
|
1357
|
+
return Z;
|
|
1342
1358
|
};
|
|
1343
1359
|
|
|
1344
|
-
|
|
1360
|
+
g();
|
|
1345
1361
|
|
|
1346
|
-
var
|
|
1362
|
+
var Xe = null, Ze = e => {
|
|
1347
1363
|
const t = Ge(e);
|
|
1348
|
-
return
|
|
1349
|
-
},
|
|
1350
|
-
|
|
1351
|
-
},
|
|
1352
|
-
const r = n ||
|
|
1364
|
+
return Xe = t, t;
|
|
1365
|
+
}, Ye = () => {
|
|
1366
|
+
Xe && (Xe.destroy(), Xe = null);
|
|
1367
|
+
}, et = n => {
|
|
1368
|
+
const r = n || Xe, s = e(() => e => r ? r._subscribe(e) : () => {}, [ r ]);
|
|
1353
1369
|
return t(s, () => !!r && r.isReady, () => !0);
|
|
1354
|
-
},
|
|
1370
|
+
}, tt = () => Xe;
|
|
1355
1371
|
|
|
1356
|
-
function
|
|
1357
|
-
const a = e(() => o ||
|
|
1372
|
+
function nt(s, o) {
|
|
1373
|
+
const a = e(() => o || Xe, [ o ]), i = e(() => {
|
|
1358
1374
|
const e = () => {}, t = () => !1, n = () => null;
|
|
1359
1375
|
return {
|
|
1360
1376
|
set: t,
|
|
@@ -1393,23 +1409,23 @@ function et(s, o) {
|
|
|
1393
1409
|
} catch {
|
|
1394
1410
|
return;
|
|
1395
1411
|
}
|
|
1396
|
-
}, [ d, l ]), h = t(f, y, p), g = n((e, t) => l ? (
|
|
1412
|
+
}, [ d, l ]), h = t(f, y, p), g = n((e, t) => l ? (Qe(), !1) : c.set(u, e, t), [ c, l, u ]);
|
|
1397
1413
|
return r(h, e => l ? `Selector: ${JSON.stringify(e)}` : `${u}: ${JSON.stringify(e)}`),
|
|
1398
1414
|
l ? h : [ h, g ];
|
|
1399
1415
|
}
|
|
1400
1416
|
|
|
1401
|
-
var
|
|
1417
|
+
var rt = new Map, st = (e, t) => {
|
|
1402
1418
|
const n = e.namespace;
|
|
1403
|
-
if (
|
|
1419
|
+
if (rt.has(n)) return rt.get(n);
|
|
1404
1420
|
const r = new c(e, t);
|
|
1405
|
-
return
|
|
1406
|
-
},
|
|
1407
|
-
const t =
|
|
1408
|
-
t && (t.destroy(),
|
|
1421
|
+
return rt.set(n, r), r;
|
|
1422
|
+
}, ot = e => {
|
|
1423
|
+
const t = rt.get(e);
|
|
1424
|
+
t && (t.destroy(), rt.delete(e));
|
|
1409
1425
|
};
|
|
1410
1426
|
|
|
1411
|
-
function
|
|
1412
|
-
const r = t ||
|
|
1427
|
+
function at(e, t) {
|
|
1428
|
+
const r = t || Xe, a = r?.namespace || "default", i = rt.get(a), c = nt(e, r), l = c[0], u = c[1], [d, f] = s(() => i?.getState() || {
|
|
1413
1429
|
isOnline: !0,
|
|
1414
1430
|
isSyncing: !1,
|
|
1415
1431
|
lastSyncTimestamp: null,
|
|
@@ -1430,7 +1446,7 @@ function st(e, t) {
|
|
|
1430
1446
|
}, [ u, i, e, r ]), d ];
|
|
1431
1447
|
}
|
|
1432
1448
|
|
|
1433
|
-
var
|
|
1449
|
+
var it = () => {
|
|
1434
1450
|
const [e, t] = s({
|
|
1435
1451
|
isOnline: !0,
|
|
1436
1452
|
isSyncing: !1,
|
|
@@ -1441,7 +1457,7 @@ var ot = () => {
|
|
|
1441
1457
|
return o(() => {
|
|
1442
1458
|
const e = () => {
|
|
1443
1459
|
let e = !0, n = !1, r = 0, s = 0;
|
|
1444
|
-
|
|
1460
|
+
rt.forEach(t => {
|
|
1445
1461
|
const o = t.getState();
|
|
1446
1462
|
e = e && o.isOnline, n = n || o.isSyncing, r += o.pendingChanges, s += o.conflicts;
|
|
1447
1463
|
}), t({
|
|
@@ -1453,15 +1469,24 @@ var ot = () => {
|
|
|
1453
1469
|
});
|
|
1454
1470
|
};
|
|
1455
1471
|
e();
|
|
1456
|
-
const n = Array.from(
|
|
1472
|
+
const n = Array.from(rt.values()).map(t => t.onStateChange(e));
|
|
1457
1473
|
return () => n.forEach(e => e());
|
|
1458
1474
|
}, []), e;
|
|
1459
|
-
},
|
|
1460
|
-
const t = e ||
|
|
1475
|
+
}, ct = async e => {
|
|
1476
|
+
const t = e || Xe?.namespace;
|
|
1461
1477
|
if (!t) return;
|
|
1462
|
-
const n =
|
|
1478
|
+
const n = rt.get(t);
|
|
1463
1479
|
n && await n.flush();
|
|
1464
|
-
}
|
|
1480
|
+
};
|
|
1481
|
+
|
|
1482
|
+
function lt(r) {
|
|
1483
|
+
const o = e(() => r || Xe, [ r ]), a = n(e => o ? o._subscribe(e) : () => {}, [ o ]), i = n(() => !0, []), c = n(() => !0, []);
|
|
1484
|
+
t(a, i, c);
|
|
1485
|
+
const [, l] = s(0);
|
|
1486
|
+
return [ !0, n(() => l(e => e + 1), []) ];
|
|
1487
|
+
}
|
|
1488
|
+
|
|
1489
|
+
var ut, dt, ft, yt, pt, ht, gt = (e, t) => {
|
|
1465
1490
|
const n = t?.key || "async_data", r = t?.store || Ge({
|
|
1466
1491
|
namespace: `async_${n}`,
|
|
1467
1492
|
silent: !0
|
|
@@ -1515,18 +1540,254 @@ var ot = () => {
|
|
|
1515
1540
|
}
|
|
1516
1541
|
}
|
|
1517
1542
|
});
|
|
1518
|
-
}
|
|
1543
|
+
}, mt = () => "undefined" == typeof window || void 0 === window.document, _t = () => !mt(), St = e => {
|
|
1544
|
+
const t = e?.ssrSafe ?? !0, n = e?.deferHydration ?? !1;
|
|
1545
|
+
let r = e?.storage;
|
|
1546
|
+
!r && t && mt() && (r = He());
|
|
1547
|
+
const s = Ge({
|
|
1548
|
+
...e,
|
|
1549
|
+
storage: r || void 0,
|
|
1550
|
+
persistByDefault: !n && (e?.persistByDefault ?? !1)
|
|
1551
|
+
});
|
|
1552
|
+
let o = !1, a = null;
|
|
1553
|
+
e?.initialState && mt() && (Object.entries(e.initialState).forEach(([e, t]) => {
|
|
1554
|
+
s._setSilently(e, t);
|
|
1555
|
+
}), a = JSON.stringify(e.initialState));
|
|
1556
|
+
return Object.assign(s, {
|
|
1557
|
+
hydrate: async () => {
|
|
1558
|
+
if (!o && !mt()) {
|
|
1559
|
+
if (t && !s.namespace.startsWith("async_")) {
|
|
1560
|
+
const t = s.getSnapshot(), n = Ge({
|
|
1561
|
+
...e,
|
|
1562
|
+
namespace: s.namespace,
|
|
1563
|
+
storage: void 0,
|
|
1564
|
+
persistByDefault: e?.persistByDefault ?? !1
|
|
1565
|
+
});
|
|
1566
|
+
Object.entries(t).forEach(([e, t]) => {
|
|
1567
|
+
n._setSilently(e, t);
|
|
1568
|
+
}), o = !0;
|
|
1569
|
+
} else o = !0;
|
|
1570
|
+
await s.whenReady();
|
|
1571
|
+
}
|
|
1572
|
+
},
|
|
1573
|
+
getSerializedState: () => mt() ? JSON.stringify(s.getSnapshot()) : a,
|
|
1574
|
+
isHydrated: () => o || s.isReady
|
|
1575
|
+
});
|
|
1576
|
+
}, wt = async e => {
|
|
1577
|
+
mt() || await e.whenReady();
|
|
1578
|
+
}, bt = e => JSON.stringify(e.getSnapshot()), vt = (e, t) => {
|
|
1579
|
+
if (!mt()) try {
|
|
1580
|
+
const n = JSON.parse(t);
|
|
1581
|
+
Object.entries(n).forEach(([t, n]) => {
|
|
1582
|
+
e._setSilently(t, n);
|
|
1583
|
+
});
|
|
1584
|
+
} catch (e) {}
|
|
1585
|
+
}, Et = () => (ut || (ut = f("react"), dt = ut.useState, ft = ut.useEffect, yt = ut.useSyncExternalStore,
|
|
1586
|
+
pt = ut.useMemo, ht = ut.useCallback), {
|
|
1587
|
+
React: ut,
|
|
1588
|
+
useState: dt,
|
|
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
|
|
1608
|
+
};
|
|
1609
|
+
}, Ct = e => {
|
|
1610
|
+
const {useState: t, useEffect: n, useMemo: r} = Et(), [s, o] = t(() => !!mt() || (e.isHydrated?.() ?? e.isReady));
|
|
1611
|
+
return n(() => {
|
|
1612
|
+
if (mt()) return;
|
|
1613
|
+
const t = () => {
|
|
1614
|
+
const t = e.isHydrated?.() ?? e.isReady;
|
|
1615
|
+
o(t);
|
|
1616
|
+
}, n = setInterval(t, 50), r = e._subscribe(t);
|
|
1617
|
+
return t(), () => {
|
|
1618
|
+
clearInterval(n), r();
|
|
1619
|
+
};
|
|
1620
|
+
}, [ e ]), r(() => {
|
|
1621
|
+
if (s) return e;
|
|
1622
|
+
const t = () => {}, n = () => !1, r = () => null;
|
|
1623
|
+
return {
|
|
1624
|
+
set: n,
|
|
1625
|
+
get: r,
|
|
1626
|
+
remove: n,
|
|
1627
|
+
delete: n,
|
|
1628
|
+
deleteAll: n,
|
|
1629
|
+
list: () => ({}),
|
|
1630
|
+
compute: r,
|
|
1631
|
+
watch: () => () => {},
|
|
1632
|
+
use: t,
|
|
1633
|
+
transaction: t,
|
|
1634
|
+
destroy: t,
|
|
1635
|
+
_subscribe: () => () => {},
|
|
1636
|
+
_setSilently: t,
|
|
1637
|
+
_registerMethod: t,
|
|
1638
|
+
_addPlugin: t,
|
|
1639
|
+
_removePlugin: t,
|
|
1640
|
+
_getVersion: () => 0,
|
|
1641
|
+
get isReady() {
|
|
1642
|
+
return !1;
|
|
1643
|
+
},
|
|
1644
|
+
whenReady: () => Promise.resolve(),
|
|
1645
|
+
get plugins() {
|
|
1646
|
+
return {};
|
|
1647
|
+
},
|
|
1648
|
+
getSnapshot: () => ({}),
|
|
1649
|
+
get namespace() {
|
|
1650
|
+
return e.namespace;
|
|
1651
|
+
},
|
|
1652
|
+
get userId() {
|
|
1653
|
+
return e.userId;
|
|
1654
|
+
}
|
|
1655
|
+
};
|
|
1656
|
+
}, [ e, s ]);
|
|
1657
|
+
}, Dt = e => {
|
|
1658
|
+
const t = St(e);
|
|
1659
|
+
return Object.assign(t, {
|
|
1660
|
+
useHydrated: kt,
|
|
1661
|
+
useHydrationStatus: Ot,
|
|
1662
|
+
useDeferredStore: e => {
|
|
1663
|
+
const n = Ct(t), {useCallback: r} = Et();
|
|
1664
|
+
return (e => {
|
|
1665
|
+
const {useSyncExternalStore: t} = Et();
|
|
1666
|
+
return t(r(t => n._subscribe(t, e), [ n, e ]), r(() => n.get(e), [ n, e ]), () => {});
|
|
1667
|
+
})(e);
|
|
1668
|
+
}
|
|
1669
|
+
});
|
|
1670
|
+
}, Mt = e => e.getSnapshot(), At = (e, t) => {
|
|
1671
|
+
mt() || Object.entries(t).forEach(([t, n]) => {
|
|
1672
|
+
e._setSilently(t, n);
|
|
1673
|
+
});
|
|
1674
|
+
}, jt = (e, t) => {
|
|
1675
|
+
const n = t?.extraArgument, r = async t => {
|
|
1676
|
+
if ("function" == typeof t) return t(r, () => e.getSnapshot(), n);
|
|
1677
|
+
if (t.type) {
|
|
1678
|
+
const {type: n, payload: r} = t, s = n.match(/^SET_(.+)$/i);
|
|
1679
|
+
if (s && s[1]) {
|
|
1680
|
+
const t = s[1].toLowerCase();
|
|
1681
|
+
e.set(t, r);
|
|
1682
|
+
}
|
|
1683
|
+
const o = n.match(/^REMOVE_(.+)$/i);
|
|
1684
|
+
if (o && o[1]) {
|
|
1685
|
+
const t = o[1].toLowerCase();
|
|
1686
|
+
e.remove(t);
|
|
1687
|
+
}
|
|
1688
|
+
}
|
|
1689
|
+
};
|
|
1690
|
+
return Object.assign(e, {
|
|
1691
|
+
dispatch: r
|
|
1692
|
+
});
|
|
1693
|
+
}, Rt = (e, t) => {
|
|
1694
|
+
const n = jt(e);
|
|
1695
|
+
return Object.assign(n.dispatch, t);
|
|
1696
|
+
}, Pt = (e, t) => async (n, r) => {
|
|
1697
|
+
const s = r()[e];
|
|
1698
|
+
n({
|
|
1699
|
+
type: `SET_${e.toUpperCase()}`,
|
|
1700
|
+
payload: {
|
|
1701
|
+
...s,
|
|
1702
|
+
loading: !0,
|
|
1703
|
+
error: null
|
|
1704
|
+
}
|
|
1705
|
+
});
|
|
1706
|
+
try {
|
|
1707
|
+
const r = await t();
|
|
1708
|
+
return n({
|
|
1709
|
+
type: `SET_${e.toUpperCase()}`,
|
|
1710
|
+
payload: {
|
|
1711
|
+
data: r,
|
|
1712
|
+
loading: !1,
|
|
1713
|
+
error: null
|
|
1714
|
+
}
|
|
1715
|
+
}), r;
|
|
1716
|
+
} catch (t) {
|
|
1717
|
+
throw n({
|
|
1718
|
+
type: `SET_${e.toUpperCase()}`,
|
|
1719
|
+
payload: {
|
|
1720
|
+
data: s?.data ?? null,
|
|
1721
|
+
loading: !1,
|
|
1722
|
+
error: t instanceof Error ? t : new Error(String(t))
|
|
1723
|
+
}
|
|
1724
|
+
}), t;
|
|
1725
|
+
}
|
|
1726
|
+
}, Tt = (e, t) => {
|
|
1727
|
+
jt(e);
|
|
1728
|
+
const n = {};
|
|
1729
|
+
for (const [e, r] of Object.entries(t)) n[e] = Pt(e, r);
|
|
1730
|
+
return n;
|
|
1731
|
+
}, It = (e, ...t) => ({
|
|
1732
|
+
type: "call",
|
|
1733
|
+
fn: e,
|
|
1734
|
+
args: t
|
|
1735
|
+
}), zt = e => ({
|
|
1736
|
+
type: "put",
|
|
1737
|
+
action: e
|
|
1738
|
+
}), xt = e => ({
|
|
1739
|
+
type: "select",
|
|
1740
|
+
selector: e
|
|
1741
|
+
}), $t = e => ({
|
|
1742
|
+
type: "take",
|
|
1743
|
+
pattern: e
|
|
1744
|
+
}), Vt = e => ({
|
|
1745
|
+
type: "all",
|
|
1746
|
+
effects: e
|
|
1747
|
+
}), Nt = e => ({
|
|
1748
|
+
type: "race",
|
|
1749
|
+
effects: e
|
|
1750
|
+
}), Ut = e => async (t, n) => {
|
|
1751
|
+
const r = async e => {
|
|
1752
|
+
switch (e.type) {
|
|
1753
|
+
case "call":
|
|
1754
|
+
return e.fn();
|
|
1755
|
+
|
|
1756
|
+
case "put":
|
|
1757
|
+
return t(e.action);
|
|
1758
|
+
|
|
1759
|
+
case "select":
|
|
1760
|
+
return e.selector(n());
|
|
1761
|
+
|
|
1762
|
+
case "all":
|
|
1763
|
+
return Promise.all(e.effects.map(r));
|
|
1764
|
+
|
|
1765
|
+
case "race":
|
|
1766
|
+
{
|
|
1767
|
+
const t = Object.fromEntries(Object.entries(e.effects).map(([e, t]) => [ e, r(t) ]));
|
|
1768
|
+
return Promise.race(Object.values(t));
|
|
1769
|
+
}
|
|
1770
|
+
|
|
1771
|
+
default:
|
|
1772
|
+
return;
|
|
1773
|
+
}
|
|
1774
|
+
};
|
|
1775
|
+
try {
|
|
1776
|
+
let t = e.next();
|
|
1777
|
+
for (;!t.done; ) await r(t.value), t = e.next();
|
|
1778
|
+
} catch (e) {}
|
|
1779
|
+
}, Lt = (e, t) => (jt(e).dispatch(t), () => {});
|
|
1519
1780
|
|
|
1520
|
-
|
|
1781
|
+
g();
|
|
1521
1782
|
|
|
1522
|
-
var
|
|
1783
|
+
var Ft = () => ({
|
|
1523
1784
|
name: "gstate-immer",
|
|
1524
1785
|
hooks: {
|
|
1525
1786
|
onInstall: ({store: e}) => {
|
|
1526
1787
|
e._registerMethod("immer", "setWithProduce", (t, n) => e.set(t, n));
|
|
1527
1788
|
}
|
|
1528
1789
|
}
|
|
1529
|
-
}),
|
|
1790
|
+
}), Kt = e => {
|
|
1530
1791
|
let t = [], n = -1, r = !1;
|
|
1531
1792
|
const s = e?.limit || 50;
|
|
1532
1793
|
return {
|
|
@@ -1558,7 +1819,7 @@ var ct = () => ({
|
|
|
1558
1819
|
}
|
|
1559
1820
|
}
|
|
1560
1821
|
};
|
|
1561
|
-
},
|
|
1822
|
+
}, Jt = e => ({
|
|
1562
1823
|
name: "gstate-schema",
|
|
1563
1824
|
hooks: {
|
|
1564
1825
|
onSet: ({key: t, value: n}) => {
|
|
@@ -1570,7 +1831,7 @@ var ct = () => ({
|
|
|
1570
1831
|
}
|
|
1571
1832
|
}
|
|
1572
1833
|
}
|
|
1573
|
-
}),
|
|
1834
|
+
}), Bt = e => {
|
|
1574
1835
|
const t = globalThis.__REDUX_DEVTOOLS_EXTENSION__;
|
|
1575
1836
|
if (!t?.connect) return {
|
|
1576
1837
|
name: "gstate-devtools-noop",
|
|
@@ -1593,7 +1854,7 @@ var ct = () => ({
|
|
|
1593
1854
|
}
|
|
1594
1855
|
}
|
|
1595
1856
|
};
|
|
1596
|
-
},
|
|
1857
|
+
}, Wt = () => {
|
|
1597
1858
|
const e = new Map;
|
|
1598
1859
|
return {
|
|
1599
1860
|
name: "gstate-snapshot",
|
|
@@ -1613,7 +1874,7 @@ var ct = () => ({
|
|
|
1613
1874
|
}
|
|
1614
1875
|
}
|
|
1615
1876
|
};
|
|
1616
|
-
},
|
|
1877
|
+
}, Qt = e => ({
|
|
1617
1878
|
name: "gstate-guard",
|
|
1618
1879
|
hooks: {
|
|
1619
1880
|
onBeforeSet: ({key: t, value: n, store: r}) => {
|
|
@@ -1622,7 +1883,7 @@ var ct = () => ({
|
|
|
1622
1883
|
s && s(n);
|
|
1623
1884
|
}
|
|
1624
1885
|
}
|
|
1625
|
-
}),
|
|
1886
|
+
}), qt = e => ({
|
|
1626
1887
|
name: "gstate-analytics",
|
|
1627
1888
|
hooks: {
|
|
1628
1889
|
onSet: ({key: t, value: n}) => {
|
|
@@ -1640,7 +1901,7 @@ var ct = () => ({
|
|
|
1640
1901
|
}));
|
|
1641
1902
|
}
|
|
1642
1903
|
}
|
|
1643
|
-
}),
|
|
1904
|
+
}), Ht = e => {
|
|
1644
1905
|
const t = new BroadcastChannel(e?.channelName || "gstate_sync");
|
|
1645
1906
|
let n = !1;
|
|
1646
1907
|
return {
|
|
@@ -1670,12 +1931,12 @@ var ct = () => ({
|
|
|
1670
1931
|
}
|
|
1671
1932
|
}
|
|
1672
1933
|
};
|
|
1673
|
-
},
|
|
1674
|
-
if (
|
|
1934
|
+
}, Gt = () => {
|
|
1935
|
+
if (Qe()) return {
|
|
1675
1936
|
name: "gstate-debug-noop",
|
|
1676
1937
|
hooks: {}
|
|
1677
1938
|
};
|
|
1678
|
-
|
|
1939
|
+
Qe();
|
|
1679
1940
|
return {
|
|
1680
1941
|
name: "gstate-debug",
|
|
1681
1942
|
hooks: {
|
|
@@ -1708,7 +1969,7 @@ var ct = () => ({
|
|
|
1708
1969
|
}
|
|
1709
1970
|
}
|
|
1710
1971
|
};
|
|
1711
|
-
},
|
|
1972
|
+
}, Xt = (e = {}) => {
|
|
1712
1973
|
const t = e.dbName || "rgs-db", n = e.storeName || "states", r = e.version || 1;
|
|
1713
1974
|
let s = null;
|
|
1714
1975
|
const o = () => new Promise((e, o) => {
|
|
@@ -1776,7 +2037,7 @@ var ct = () => ({
|
|
|
1776
2037
|
}
|
|
1777
2038
|
}
|
|
1778
2039
|
};
|
|
1779
|
-
},
|
|
2040
|
+
}, Zt = e => {
|
|
1780
2041
|
const {adapter: t, autoSyncInterval: n} = e, r = new Map, s = {
|
|
1781
2042
|
lastSyncTimestamp: null,
|
|
1782
2043
|
totalKeysSynced: 0,
|
|
@@ -1830,7 +2091,7 @@ var ct = () => ({
|
|
|
1830
2091
|
}
|
|
1831
2092
|
}
|
|
1832
2093
|
};
|
|
1833
|
-
},
|
|
2094
|
+
}, Yt = (e, t) => ({
|
|
1834
2095
|
name: "MongoDB-Atlas",
|
|
1835
2096
|
save: async n => (await fetch(`${e}/action/updateOne`, {
|
|
1836
2097
|
method: "POST",
|
|
@@ -1854,17 +2115,17 @@ var ct = () => ({
|
|
|
1854
2115
|
upsert: !0
|
|
1855
2116
|
})
|
|
1856
2117
|
})).ok
|
|
1857
|
-
}),
|
|
2118
|
+
}), en = (e, t) => ({
|
|
1858
2119
|
name: "Firebase-Firestore",
|
|
1859
2120
|
save: async e => {
|
|
1860
2121
|
try {
|
|
1861
|
-
|
|
2122
|
+
Qe();
|
|
1862
2123
|
return (() => {})("[Mock] Firestore Syncing:", e), !0;
|
|
1863
2124
|
} catch (e) {
|
|
1864
2125
|
return !1;
|
|
1865
2126
|
}
|
|
1866
2127
|
}
|
|
1867
|
-
}),
|
|
2128
|
+
}), tn = (e, t) => ({
|
|
1868
2129
|
name: "SQL-REST-API",
|
|
1869
2130
|
save: async n => {
|
|
1870
2131
|
const r = t();
|
|
@@ -1879,7 +2140,7 @@ var ct = () => ({
|
|
|
1879
2140
|
credentials: "same-origin"
|
|
1880
2141
|
})).ok;
|
|
1881
2142
|
}
|
|
1882
|
-
}),
|
|
2143
|
+
}), nn = e => ({
|
|
1883
2144
|
name: "gstate-logger",
|
|
1884
2145
|
hooks: {
|
|
1885
2146
|
onSet: ({key: e, value: t, version: n}) => {
|
|
@@ -1888,27 +2149,28 @@ var ct = () => ({
|
|
|
1888
2149
|
onRemove: ({key: e}) => {},
|
|
1889
2150
|
onTransaction: ({key: e}) => {}
|
|
1890
2151
|
}
|
|
1891
|
-
}),
|
|
2152
|
+
}), rn = (e, t) => {
|
|
1892
2153
|
const n = Ge("string" == typeof t ? {
|
|
1893
2154
|
namespace: t
|
|
1894
2155
|
} : t);
|
|
1895
2156
|
e && Object.entries(e).forEach(([e, t]) => {
|
|
1896
2157
|
null === n.get(e) && n._setSilently(e, t);
|
|
1897
2158
|
});
|
|
1898
|
-
|
|
1899
|
-
window.
|
|
1900
|
-
|
|
1901
|
-
|
|
2159
|
+
const r = e => nt(e, n);
|
|
2160
|
+
return "undefined" == typeof window || Qe() || (window.gstate = r, window.gState = n,
|
|
2161
|
+
window.rgs = n), Object.assign(r, n);
|
|
2162
|
+
}, sn = (e, t) => tt()?.addAccessRule(e, t), on = (e, t, n) => tt()?.hasPermission(e, t, n) ?? !0, an = (e, t, n) => {
|
|
2163
|
+
const r = tt();
|
|
1902
2164
|
if (!r) throw new Error("[gstate] recordConsent failed: No store found. call initState() first.");
|
|
1903
2165
|
return r.recordConsent(e, t, n);
|
|
1904
|
-
},
|
|
1905
|
-
const t =
|
|
2166
|
+
}, cn = (e, t) => tt()?.hasConsent(e, t) ?? !1, ln = e => tt()?.getConsents(e) ?? [], un = (e, t) => tt()?.revokeConsent(e, t), dn = e => {
|
|
2167
|
+
const t = tt();
|
|
1906
2168
|
if (!t) throw new Error("[gstate] exportUserData failed: No store found.");
|
|
1907
2169
|
return t.exportUserData(e);
|
|
1908
|
-
},
|
|
1909
|
-
const t =
|
|
2170
|
+
}, fn = e => {
|
|
2171
|
+
const t = tt();
|
|
1910
2172
|
if (!t) throw new Error("[gstate] deleteUserData failed: No store found.");
|
|
1911
2173
|
return t.deleteUserData(e);
|
|
1912
|
-
},
|
|
2174
|
+
}, yn = () => {}, pn = () => {};
|
|
1913
2175
|
|
|
1914
|
-
export { c as SyncEngine,
|
|
2176
|
+
export { c as SyncEngine, sn as addAccessRule, Vt as all, qt as analyticsPlugin, It as call, yn as clearAccessRules, pn as clearAllConsents, Zt as cloudSyncPlugin, Rt as createActions, Pt as createAsyncAction, Tt as createAsyncActions, gt as createAsyncStore, en as createFirestoreAdapter, Yt as createMongoAdapter, Dt as createNextStore, St as createSSRStore, Ut as createSaga, tn as createSqlRestAdapter, Ge as createStore, l as createSyncEngine, jt as createThunkStore, Gt as debugPlugin, bt as dehydrateStore, fn as deleteUserData, Re as deriveKeyFromPassword, Ye as destroyState, ot as destroySync, Bt as devToolsPlugin, Ie as exportKey, dn as exportUserData, Te as generateEncryptionKey, Pe as generateSalt, ln as getConsents, Mt as getSSRInitialState, tt as getStore, rn as gstate, Qt as guardPlugin, cn as hasConsent, on as hasPermission, wt as hydrateOnClient, Ft as immerPlugin, ze as importKey, Xt as indexedDBPlugin, Ze as initState, st as initSync, At as initializeFromSSR, _t as isClientSide, je as isCryptoAvailable, mt as isServerSide, Ue as logAudit, nn as loggerPlugin, zt as put, Nt as race, an as recordConsent, vt as rehydrateStore, un as revokeConsent, Lt as runSaga, Ke as sanitizeValue, Jt as schemaPlugin, xt as select, Ne as setAuditLogger, Wt as snapshotPlugin, Ht as syncPlugin, $t as take, ct as triggerSync, Kt as undoRedoPlugin, Ct as useDeferredStore, nt as useGState, kt as useHydrated, Ot as useHydrationStatus, et as useIsStoreReady, nt as useSimpleState, nt as useStore, lt as useStoreSubscribe, it as useSyncStatus, at as useSyncedState, Je as validateKey };
|