@mhmo91/schmancy 0.2.142 → 0.2.143
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/card.cjs +1 -1
- package/dist/card.js +1 -1
- package/dist/content-drawer.cjs +1 -1
- package/dist/content-drawer.js +1 -1
- package/dist/context-array-Cpar9dLN.cjs +2 -0
- package/dist/context-array-Cpar9dLN.cjs.map +1 -0
- package/dist/{context-array-CSGdoQ1W.js → context-array-DpyA_ATT.js} +312 -215
- package/dist/context-array-DpyA_ATT.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +3 -3
- package/dist/nav-drawer.cjs +1 -1
- package/dist/nav-drawer.js +1 -1
- package/dist/{selector-hook-0691Losv.js → selector-hook-CCTCDtVe.js} +2 -2
- package/dist/{selector-hook-0691Losv.js.map → selector-hook-CCTCDtVe.js.map} +1 -1
- package/dist/{selector-hook-SzNTYQII.cjs → selector-hook-DGMX3Yt0.cjs} +2 -2
- package/dist/{selector-hook-SzNTYQII.cjs.map → selector-hook-DGMX3Yt0.cjs.map} +1 -1
- package/dist/store.cjs +1 -1
- package/dist/store.js +2 -2
- package/dist/teleport.cjs +1 -1
- package/dist/{teleport.component-Du14Yyxz.js → teleport.component-Dg62mNQm.js} +2 -2
- package/dist/{teleport.component-Du14Yyxz.js.map → teleport.component-Dg62mNQm.js.map} +1 -1
- package/dist/{teleport.component-Vicu2fPa.cjs → teleport.component-F3-R3PAX.cjs} +2 -2
- package/dist/{teleport.component-Vicu2fPa.cjs.map → teleport.component-F3-R3PAX.cjs.map} +1 -1
- package/dist/teleport.js +1 -1
- package/package.json +1 -1
- package/types/src/store/context-object.d.ts +6 -0
- package/types/src/store/store.class.d.ts +6 -0
- package/dist/context-array-BrljBA5R.cjs +0 -2
- package/dist/context-array-BrljBA5R.cjs.map +0 -1
- package/dist/context-array-CSGdoQ1W.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Subject as
|
|
2
|
-
var
|
|
1
|
+
import { Subject as pe, BehaviorSubject as Q, throttleTime as oe } from "rxjs";
|
|
2
|
+
var ce = Symbol.for("immer-nothing"), $ = Symbol.for("immer-draftable"), l = Symbol.for("immer-state"), fe = process.env.NODE_ENV !== "production" ? [function(t) {
|
|
3
3
|
return `The plugin for '${t}' has not been loaded into Immer. To enable the plugin, import and call \`enable${t}()\` when initializing your application.`;
|
|
4
4
|
}, function(t) {
|
|
5
5
|
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 '${t}'`;
|
|
@@ -12,220 +12,220 @@ var oe = Symbol.for("immer-nothing"), H = Symbol.for("immer-draftable"), u = Sym
|
|
|
12
12
|
}] : [];
|
|
13
13
|
function _(t, ...e) {
|
|
14
14
|
if (process.env.NODE_ENV !== "production") {
|
|
15
|
-
const r =
|
|
15
|
+
const r = fe[t], s = typeof r == "function" ? r.apply(null, e) : r;
|
|
16
16
|
throw new Error(`[Immer] ${s}`);
|
|
17
17
|
}
|
|
18
18
|
throw new Error(`[Immer] minified error nr: ${t}. Full error at: https://bit.ly/3cXEKWf`);
|
|
19
19
|
}
|
|
20
|
-
var
|
|
20
|
+
var E = Object.getPrototypeOf;
|
|
21
21
|
function w(t) {
|
|
22
|
-
return !!t && !!t[
|
|
22
|
+
return !!t && !!t[l];
|
|
23
23
|
}
|
|
24
24
|
function v(t) {
|
|
25
25
|
var e;
|
|
26
|
-
return !!t && (
|
|
26
|
+
return !!t && (he(t) || Array.isArray(t) || !!t[$] || !!((e = t.constructor) != null && e[$]) || A(t) || R(t));
|
|
27
27
|
}
|
|
28
|
-
var
|
|
29
|
-
function
|
|
28
|
+
var ye = Object.prototype.constructor.toString();
|
|
29
|
+
function he(t) {
|
|
30
30
|
if (!t || typeof t != "object") return !1;
|
|
31
|
-
const e =
|
|
31
|
+
const e = E(t);
|
|
32
32
|
if (e === null) return !0;
|
|
33
33
|
const r = Object.hasOwnProperty.call(e, "constructor") && e.constructor;
|
|
34
|
-
return r === Object || typeof r == "function" && Function.toString.call(r) ===
|
|
34
|
+
return r === Object || typeof r == "function" && Function.toString.call(r) === ye;
|
|
35
35
|
}
|
|
36
36
|
function P(t, e) {
|
|
37
|
-
|
|
37
|
+
T(t) === 0 ? Reflect.ownKeys(t).forEach((r) => {
|
|
38
38
|
e(r, t[r], t);
|
|
39
39
|
}) : t.forEach((r, s) => e(s, r, t));
|
|
40
40
|
}
|
|
41
|
-
function
|
|
42
|
-
const e = t[
|
|
43
|
-
return e ? e.type_ : Array.isArray(t) ? 1 :
|
|
41
|
+
function T(t) {
|
|
42
|
+
const e = t[l];
|
|
43
|
+
return e ? e.type_ : Array.isArray(t) ? 1 : A(t) ? 2 : R(t) ? 3 : 0;
|
|
44
44
|
}
|
|
45
|
-
function
|
|
46
|
-
return
|
|
45
|
+
function C(t, e) {
|
|
46
|
+
return T(t) === 2 ? t.has(e) : Object.prototype.hasOwnProperty.call(t, e);
|
|
47
47
|
}
|
|
48
|
-
function
|
|
49
|
-
const s =
|
|
48
|
+
function ue(t, e, r) {
|
|
49
|
+
const s = T(t);
|
|
50
50
|
s === 2 ? t.set(e, r) : s === 3 ? t.add(r) : t[e] = r;
|
|
51
51
|
}
|
|
52
|
-
function
|
|
52
|
+
function A(t) {
|
|
53
53
|
return t instanceof Map;
|
|
54
54
|
}
|
|
55
|
-
function
|
|
55
|
+
function R(t) {
|
|
56
56
|
return t instanceof Set;
|
|
57
57
|
}
|
|
58
58
|
function f(t) {
|
|
59
59
|
return t.copy_ || t.base_;
|
|
60
60
|
}
|
|
61
|
-
function
|
|
62
|
-
if (
|
|
63
|
-
if (
|
|
61
|
+
function J(t, e) {
|
|
62
|
+
if (A(t)) return new Map(t);
|
|
63
|
+
if (R(t)) return new Set(t);
|
|
64
64
|
if (Array.isArray(t)) return Array.prototype.slice.call(t);
|
|
65
|
-
const r =
|
|
65
|
+
const r = he(t);
|
|
66
66
|
if (e === !0 || e === "class_only" && !r) {
|
|
67
67
|
const s = Object.getOwnPropertyDescriptors(t);
|
|
68
|
-
delete s[
|
|
68
|
+
delete s[l];
|
|
69
69
|
let n = Reflect.ownKeys(s);
|
|
70
70
|
for (let a = 0; a < n.length; a++) {
|
|
71
71
|
const h = n[a], c = s[h];
|
|
72
72
|
c.writable === !1 && (c.writable = !0, c.configurable = !0), (c.get || c.set) && (s[h] = { configurable: !0, writable: !0, enumerable: c.enumerable, value: t[h] });
|
|
73
73
|
}
|
|
74
|
-
return Object.create(
|
|
74
|
+
return Object.create(E(t), s);
|
|
75
75
|
}
|
|
76
76
|
{
|
|
77
|
-
const s =
|
|
77
|
+
const s = E(t);
|
|
78
78
|
if (s !== null && r) return { ...t };
|
|
79
79
|
const n = Object.create(s);
|
|
80
80
|
return Object.assign(n, t);
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
|
-
function
|
|
84
|
-
return
|
|
83
|
+
function X(t, e = !1) {
|
|
84
|
+
return F(t) || w(t) || !v(t) || (T(t) > 1 && (t.set = t.add = t.clear = t.delete = _e), Object.freeze(t), e && Object.entries(t).forEach(([r, s]) => X(s, !0))), t;
|
|
85
85
|
}
|
|
86
|
-
function
|
|
86
|
+
function _e() {
|
|
87
87
|
_(2);
|
|
88
88
|
}
|
|
89
|
-
function
|
|
89
|
+
function F(t) {
|
|
90
90
|
return Object.isFrozen(t);
|
|
91
91
|
}
|
|
92
|
-
var
|
|
92
|
+
var j, U = {};
|
|
93
93
|
function S(t) {
|
|
94
|
-
const e =
|
|
94
|
+
const e = U[t];
|
|
95
95
|
return e || _(0, t), e;
|
|
96
96
|
}
|
|
97
|
-
function
|
|
98
|
-
return
|
|
97
|
+
function N() {
|
|
98
|
+
return j;
|
|
99
99
|
}
|
|
100
100
|
function Y(t, e) {
|
|
101
101
|
e && (S("Patches"), t.patches_ = [], t.inversePatches_ = [], t.patchListener_ = e);
|
|
102
102
|
}
|
|
103
|
-
function U(t) {
|
|
104
|
-
K(t), t.drafts_.forEach(fe), t.drafts_ = null;
|
|
105
|
-
}
|
|
106
103
|
function K(t) {
|
|
107
|
-
t
|
|
104
|
+
W(t), t.drafts_.forEach(be), t.drafts_ = null;
|
|
105
|
+
}
|
|
106
|
+
function W(t) {
|
|
107
|
+
t === j && (j = t.parent_);
|
|
108
108
|
}
|
|
109
109
|
function Z(t) {
|
|
110
|
-
return
|
|
110
|
+
return j = { drafts_: [], parent_: j, immer_: t, canAutoFreeze_: !0, unfinalizedDrafts_: 0 };
|
|
111
111
|
}
|
|
112
|
-
function
|
|
113
|
-
const e = t[
|
|
112
|
+
function be(t) {
|
|
113
|
+
const e = t[l];
|
|
114
114
|
e.type_ === 0 || e.type_ === 1 ? e.revoke_() : e.revoked_ = !0;
|
|
115
115
|
}
|
|
116
|
-
function
|
|
116
|
+
function H(t, e) {
|
|
117
117
|
e.unfinalizedDrafts_ = e.drafts_.length;
|
|
118
118
|
const r = e.drafts_[0];
|
|
119
|
-
return t !== void 0 && t !== r ? (r[
|
|
119
|
+
return t !== void 0 && t !== r ? (r[l].modified_ && (K(e), _(4)), v(t) && (t = z(e, t), e.parent_ || M(e, t)), e.patches_ && S("Patches").generateReplacementPatches_(r[l].base_, t, e.patches_, e.inversePatches_)) : t = z(e, r, []), K(e), e.patches_ && e.patchListener_(e.patches_, e.inversePatches_), t !== ce ? t : void 0;
|
|
120
120
|
}
|
|
121
|
-
function
|
|
122
|
-
if (
|
|
123
|
-
const s = e[
|
|
121
|
+
function z(t, e, r) {
|
|
122
|
+
if (F(e)) return e;
|
|
123
|
+
const s = e[l];
|
|
124
124
|
if (!s) return P(e, (n, a) => ee(t, s, e, n, a, r)), e;
|
|
125
125
|
if (s.scope_ !== t) return e;
|
|
126
|
-
if (!s.modified_) return
|
|
126
|
+
if (!s.modified_) return M(t, s.base_, !0), s.base_;
|
|
127
127
|
if (!s.finalized_) {
|
|
128
128
|
s.finalized_ = !0, s.scope_.unfinalizedDrafts_--;
|
|
129
129
|
const n = s.copy_;
|
|
130
130
|
let a = n, h = !1;
|
|
131
|
-
s.type_ === 3 && (a = new Set(n), n.clear(), h = !0), P(a, (c, i) => ee(t, s, n, c, i, r, h)),
|
|
131
|
+
s.type_ === 3 && (a = new Set(n), n.clear(), h = !0), P(a, (c, i) => ee(t, s, n, c, i, r, h)), M(t, n, !1), r && t.patches_ && S("Patches").generatePatches_(s, r, t.patches_, t.inversePatches_);
|
|
132
132
|
}
|
|
133
133
|
return s.copy_;
|
|
134
134
|
}
|
|
135
135
|
function ee(t, e, r, s, n, a, h) {
|
|
136
136
|
if (process.env.NODE_ENV !== "production" && n === r && _(5), w(n)) {
|
|
137
|
-
const c =
|
|
138
|
-
if (
|
|
137
|
+
const c = z(t, n, a && e && e.type_ !== 3 && !C(e.assigned_, s) ? a.concat(s) : void 0);
|
|
138
|
+
if (ue(r, s, c), !w(c)) return;
|
|
139
139
|
t.canAutoFreeze_ = !1;
|
|
140
140
|
} else h && r.add(n);
|
|
141
|
-
if (v(n) && !
|
|
141
|
+
if (v(n) && !F(n)) {
|
|
142
142
|
if (!t.immer_.autoFreeze_ && t.unfinalizedDrafts_ < 1) return;
|
|
143
|
-
|
|
143
|
+
z(t, n), e && e.scope_.parent_ || typeof s == "symbol" || !Object.prototype.propertyIsEnumerable.call(r, s) || M(t, n);
|
|
144
144
|
}
|
|
145
145
|
}
|
|
146
|
-
function
|
|
147
|
-
!t.parent_ && t.immer_.autoFreeze_ && t.canAutoFreeze_ &&
|
|
146
|
+
function M(t, e, r = !1) {
|
|
147
|
+
!t.parent_ && t.immer_.autoFreeze_ && t.canAutoFreeze_ && X(e, r);
|
|
148
148
|
}
|
|
149
149
|
var L = { get(t, e) {
|
|
150
|
-
if (e ===
|
|
150
|
+
if (e === l) return t;
|
|
151
151
|
const r = f(t);
|
|
152
|
-
if (!
|
|
152
|
+
if (!C(r, e)) return function(n, a, h) {
|
|
153
153
|
var i;
|
|
154
154
|
const c = te(a, h);
|
|
155
155
|
return c ? "value" in c ? c.value : (i = c.get) == null ? void 0 : i.call(n.draft_) : void 0;
|
|
156
156
|
}(t, r, e);
|
|
157
157
|
const s = r[e];
|
|
158
|
-
return t.finalized_ || !v(s) ? s : s ===
|
|
158
|
+
return t.finalized_ || !v(s) ? s : s === V(t.base_, e) ? (B(t), t.copy_[e] = I(s, t)) : s;
|
|
159
159
|
}, has: (t, e) => e in f(t), ownKeys: (t) => Reflect.ownKeys(f(t)), set(t, e, r) {
|
|
160
160
|
const s = te(f(t), e);
|
|
161
161
|
if (s != null && s.set) return s.set.call(t.draft_, r), !0;
|
|
162
162
|
if (!t.modified_) {
|
|
163
|
-
const h =
|
|
163
|
+
const h = V(f(t), e), c = h == null ? void 0 : h[l];
|
|
164
164
|
if (c && c.base_ === r) return t.copy_[e] = r, t.assigned_[e] = !1, !0;
|
|
165
|
-
if (((n = r) === (a = h) ? n !== 0 || 1 / n == 1 / a : n != n && a != a) && (r !== void 0 ||
|
|
166
|
-
|
|
165
|
+
if (((n = r) === (a = h) ? n !== 0 || 1 / n == 1 / a : n != n && a != a) && (r !== void 0 || C(t.base_, e))) return !0;
|
|
166
|
+
B(t), g(t);
|
|
167
167
|
}
|
|
168
168
|
var n, a;
|
|
169
169
|
return t.copy_[e] === r && (r !== void 0 || e in t.copy_) || Number.isNaN(r) && Number.isNaN(t.copy_[e]) || (t.copy_[e] = r, t.assigned_[e] = !0), !0;
|
|
170
|
-
}, deleteProperty: (t, e) => (
|
|
170
|
+
}, deleteProperty: (t, e) => (V(t.base_, e) !== void 0 || e in t.base_ ? (t.assigned_[e] = !1, B(t), g(t)) : delete t.assigned_[e], t.copy_ && delete t.copy_[e], !0), getOwnPropertyDescriptor(t, e) {
|
|
171
171
|
const r = f(t), s = Reflect.getOwnPropertyDescriptor(r, e);
|
|
172
172
|
return s && { writable: !0, configurable: t.type_ !== 1 || e !== "length", enumerable: s.enumerable, value: r[e] };
|
|
173
173
|
}, defineProperty() {
|
|
174
174
|
_(11);
|
|
175
|
-
}, getPrototypeOf: (t) =>
|
|
175
|
+
}, getPrototypeOf: (t) => E(t.base_), setPrototypeOf() {
|
|
176
176
|
_(12);
|
|
177
|
-
} },
|
|
178
|
-
function
|
|
179
|
-
const r = t[
|
|
177
|
+
} }, x = {};
|
|
178
|
+
function V(t, e) {
|
|
179
|
+
const r = t[l];
|
|
180
180
|
return (r ? f(r) : t)[e];
|
|
181
181
|
}
|
|
182
182
|
function te(t, e) {
|
|
183
183
|
if (!(e in t)) return;
|
|
184
|
-
let r =
|
|
184
|
+
let r = E(t);
|
|
185
185
|
for (; r; ) {
|
|
186
186
|
const s = Object.getOwnPropertyDescriptor(r, e);
|
|
187
187
|
if (s) return s;
|
|
188
|
-
r =
|
|
188
|
+
r = E(r);
|
|
189
189
|
}
|
|
190
190
|
}
|
|
191
|
-
function
|
|
192
|
-
t.modified_ || (t.modified_ = !0, t.parent_ &&
|
|
191
|
+
function g(t) {
|
|
192
|
+
t.modified_ || (t.modified_ = !0, t.parent_ && g(t.parent_));
|
|
193
193
|
}
|
|
194
|
-
function
|
|
195
|
-
t.copy_ || (t.copy_ =
|
|
194
|
+
function B(t) {
|
|
195
|
+
t.copy_ || (t.copy_ = J(t.base_, t.scope_.immer_.useStrictShallowCopy_));
|
|
196
196
|
}
|
|
197
197
|
P(L, (t, e) => {
|
|
198
|
-
|
|
198
|
+
x[t] = function() {
|
|
199
199
|
return arguments[0] = arguments[0][0], e.apply(this, arguments);
|
|
200
200
|
};
|
|
201
|
-
}),
|
|
202
|
-
return process.env.NODE_ENV !== "production" && isNaN(parseInt(e)) && _(13),
|
|
203
|
-
},
|
|
201
|
+
}), x.deleteProperty = function(t, e) {
|
|
202
|
+
return process.env.NODE_ENV !== "production" && isNaN(parseInt(e)) && _(13), x.set.call(this, t, e, void 0);
|
|
203
|
+
}, x.set = function(t, e, r) {
|
|
204
204
|
return process.env.NODE_ENV !== "production" && e !== "length" && isNaN(parseInt(e)) && _(14), L.set.call(this, t[0], e, r, t[0]);
|
|
205
205
|
};
|
|
206
|
-
function
|
|
207
|
-
const r =
|
|
208
|
-
const a = Array.isArray(s), h = { type_: a ? 1 : 0, scope_: n ? n.scope_ :
|
|
206
|
+
function I(t, e) {
|
|
207
|
+
const r = A(t) ? S("MapSet").proxyMap_(t, e) : R(t) ? S("MapSet").proxySet_(t, e) : function(s, n) {
|
|
208
|
+
const a = Array.isArray(s), h = { type_: a ? 1 : 0, scope_: n ? n.scope_ : N(), modified_: !1, finalized_: !1, assigned_: {}, parent_: n, base_: s, draft_: null, copy_: null, revoke_: null, isManual_: !1 };
|
|
209
209
|
let c = h, i = L;
|
|
210
|
-
a && (c = [h], i =
|
|
210
|
+
a && (c = [h], i = x);
|
|
211
211
|
const { revoke: o, proxy: p } = Proxy.revocable(c, i);
|
|
212
212
|
return h.draft_ = p, h.revoke_ = o, p;
|
|
213
213
|
}(t, e);
|
|
214
|
-
return (e ? e.scope_ :
|
|
214
|
+
return (e ? e.scope_ : N()).drafts_.push(r), r;
|
|
215
215
|
}
|
|
216
|
-
function
|
|
217
|
-
if (!v(t) ||
|
|
218
|
-
const e = t[
|
|
216
|
+
function le(t) {
|
|
217
|
+
if (!v(t) || F(t)) return t;
|
|
218
|
+
const e = t[l];
|
|
219
219
|
let r;
|
|
220
220
|
if (e) {
|
|
221
221
|
if (!e.modified_) return e.base_;
|
|
222
|
-
e.finalized_ = !0, r =
|
|
223
|
-
} else r =
|
|
222
|
+
e.finalized_ = !0, r = J(t, e.scope_.immer_.useStrictShallowCopy_);
|
|
223
|
+
} else r = J(t, !0);
|
|
224
224
|
return P(r, (s, n) => {
|
|
225
|
-
|
|
225
|
+
ue(r, s, le(n));
|
|
226
226
|
}), e && (e.finalized_ = !1), r;
|
|
227
227
|
}
|
|
228
|
-
var
|
|
228
|
+
var de, re, se, b = new class {
|
|
229
229
|
constructor(t) {
|
|
230
230
|
this.autoFreeze_ = !0, this.useStrictShallowCopy_ = !1, this.produce = (e, r, s) => {
|
|
231
231
|
if (typeof e == "function" && typeof r != "function") {
|
|
@@ -238,17 +238,17 @@ var g = new class {
|
|
|
238
238
|
}
|
|
239
239
|
let n;
|
|
240
240
|
if (typeof r != "function" && _(6), s !== void 0 && typeof s != "function" && _(7), v(e)) {
|
|
241
|
-
const a = Z(this), h =
|
|
241
|
+
const a = Z(this), h = I(e, void 0);
|
|
242
242
|
let c = !0;
|
|
243
243
|
try {
|
|
244
244
|
n = r(h), c = !1;
|
|
245
245
|
} finally {
|
|
246
|
-
c ?
|
|
246
|
+
c ? K(a) : W(a);
|
|
247
247
|
}
|
|
248
|
-
return Y(a, s),
|
|
248
|
+
return Y(a, s), H(n, a);
|
|
249
249
|
}
|
|
250
250
|
if (!e || typeof e != "object") {
|
|
251
|
-
if (n = r(e), n === void 0 && (n = e), n ===
|
|
251
|
+
if (n = r(e), n === void 0 && (n = e), n === ce && (n = void 0), this.autoFreeze_ && X(n, !0), s) {
|
|
252
252
|
const a = [], h = [];
|
|
253
253
|
S("Patches").generateReplacementPatches_(e, n, a, h), s(a, h);
|
|
254
254
|
}
|
|
@@ -265,16 +265,16 @@ var g = new class {
|
|
|
265
265
|
}
|
|
266
266
|
createDraft(t) {
|
|
267
267
|
v(t) || _(8), w(t) && (t = function(s) {
|
|
268
|
-
return w(s) || _(10, s),
|
|
268
|
+
return w(s) || _(10, s), le(s);
|
|
269
269
|
}(t));
|
|
270
|
-
const e = Z(this), r =
|
|
271
|
-
return r[
|
|
270
|
+
const e = Z(this), r = I(t, void 0);
|
|
271
|
+
return r[l].isManual_ = !0, W(e), r;
|
|
272
272
|
}
|
|
273
273
|
finishDraft(t, e) {
|
|
274
|
-
const r = t && t[
|
|
274
|
+
const r = t && t[l];
|
|
275
275
|
r && r.isManual_ || _(9);
|
|
276
276
|
const { scope_: s } = r;
|
|
277
|
-
return Y(s, e),
|
|
277
|
+
return Y(s, e), H(void 0, s);
|
|
278
278
|
}
|
|
279
279
|
setAutoFreeze(t) {
|
|
280
280
|
this.autoFreeze_ = t;
|
|
@@ -295,17 +295,17 @@ var g = new class {
|
|
|
295
295
|
const s = S("Patches").applyPatches_;
|
|
296
296
|
return w(t) ? s(t, e) : this.produce(t, (n) => s(n, e));
|
|
297
297
|
}
|
|
298
|
-
}(), d =
|
|
299
|
-
|
|
300
|
-
class
|
|
298
|
+
}(), d = b.produce;
|
|
299
|
+
b.produceWithPatches.bind(b), b.setAutoFreeze.bind(b), b.setUseStrictShallowCopy.bind(b), b.applyPatches.bind(b), b.createDraft.bind(b), b.finishDraft.bind(b);
|
|
300
|
+
class u extends Error {
|
|
301
301
|
constructor(e, r, s) {
|
|
302
|
-
super(e), this.name = "StoreError", this.cause = r, this.context = s, this.timestamp = /* @__PURE__ */ new Date(), Error.captureStackTrace && Error.captureStackTrace(this,
|
|
302
|
+
super(e), this.name = "StoreError", this.cause = r, this.context = s, this.timestamp = /* @__PURE__ */ new Date(), Error.captureStackTrace && Error.captureStackTrace(this, u);
|
|
303
303
|
}
|
|
304
304
|
toJSON() {
|
|
305
305
|
return { name: this.name, message: this.message, cause: this.cause, context: this.context, timestamp: this.timestamp.toISOString(), stack: this.stack };
|
|
306
306
|
}
|
|
307
307
|
}
|
|
308
|
-
class
|
|
308
|
+
class me {
|
|
309
309
|
constructor() {
|
|
310
310
|
this.data = null;
|
|
311
311
|
}
|
|
@@ -319,7 +319,7 @@ class ye {
|
|
|
319
319
|
this.data = null;
|
|
320
320
|
}
|
|
321
321
|
}
|
|
322
|
-
class
|
|
322
|
+
class ge {
|
|
323
323
|
constructor(e) {
|
|
324
324
|
this.key = e;
|
|
325
325
|
}
|
|
@@ -335,14 +335,14 @@ class _e {
|
|
|
335
335
|
try {
|
|
336
336
|
localStorage.setItem(this.key, JSON.stringify(e));
|
|
337
337
|
} catch (r) {
|
|
338
|
-
throw new
|
|
338
|
+
throw new u(`Failed to save to localStorage (${this.key})`, r);
|
|
339
339
|
}
|
|
340
340
|
}
|
|
341
341
|
async clear() {
|
|
342
342
|
localStorage.removeItem(this.key);
|
|
343
343
|
}
|
|
344
344
|
}
|
|
345
|
-
class
|
|
345
|
+
class ve {
|
|
346
346
|
constructor(e) {
|
|
347
347
|
this.key = e;
|
|
348
348
|
}
|
|
@@ -358,7 +358,7 @@ class ge {
|
|
|
358
358
|
try {
|
|
359
359
|
sessionStorage.setItem(this.key, JSON.stringify(e));
|
|
360
360
|
} catch (r) {
|
|
361
|
-
throw new
|
|
361
|
+
throw new u(`Failed to save to sessionStorage (${this.key})`, r);
|
|
362
362
|
}
|
|
363
363
|
}
|
|
364
364
|
async clear() {
|
|
@@ -405,7 +405,7 @@ const y = class y {
|
|
|
405
405
|
};
|
|
406
406
|
});
|
|
407
407
|
} catch (r) {
|
|
408
|
-
throw new
|
|
408
|
+
throw new u(`Failed to save to IndexedDB (${this.key})`, r);
|
|
409
409
|
}
|
|
410
410
|
}
|
|
411
411
|
async clear() {
|
|
@@ -420,65 +420,65 @@ const y = class y {
|
|
|
420
420
|
};
|
|
421
421
|
});
|
|
422
422
|
} catch (e) {
|
|
423
|
-
throw new
|
|
423
|
+
throw new u(`Failed to clear from IndexedDB (${this.key})`, e);
|
|
424
424
|
}
|
|
425
425
|
}
|
|
426
426
|
};
|
|
427
427
|
y.DB_NAME = "StoreDB", y.STORE_NAME = "states", y.DB_VERSION = 1;
|
|
428
|
-
let
|
|
429
|
-
function
|
|
428
|
+
let G = y;
|
|
429
|
+
function Se(t, e) {
|
|
430
430
|
switch (t) {
|
|
431
431
|
case "local":
|
|
432
|
-
return new _e(e);
|
|
433
|
-
case "session":
|
|
434
432
|
return new ge(e);
|
|
433
|
+
case "session":
|
|
434
|
+
return new ve(e);
|
|
435
435
|
case "indexeddb":
|
|
436
|
-
return new
|
|
436
|
+
return new G(e);
|
|
437
437
|
default:
|
|
438
|
-
return new
|
|
438
|
+
return new me();
|
|
439
439
|
}
|
|
440
440
|
}
|
|
441
441
|
(function() {
|
|
442
442
|
class t extends Map {
|
|
443
443
|
constructor(i, o) {
|
|
444
|
-
super(), this[
|
|
444
|
+
super(), this[l] = { type_: 2, parent_: o, scope_: o ? o.scope_ : N(), modified_: !1, finalized_: !1, copy_: void 0, assigned_: void 0, base_: i, draft_: this, isManual_: !1, revoked_: !1 };
|
|
445
445
|
}
|
|
446
446
|
get size() {
|
|
447
|
-
return f(this[
|
|
447
|
+
return f(this[l]).size;
|
|
448
448
|
}
|
|
449
449
|
has(i) {
|
|
450
|
-
return f(this[
|
|
450
|
+
return f(this[l]).has(i);
|
|
451
451
|
}
|
|
452
452
|
set(i, o) {
|
|
453
|
-
const p = this[
|
|
454
|
-
return n(p), f(p).has(i) && f(p).get(i) === o || (e(p),
|
|
453
|
+
const p = this[l];
|
|
454
|
+
return n(p), f(p).has(i) && f(p).get(i) === o || (e(p), g(p), p.assigned_.set(i, !0), p.copy_.set(i, o), p.assigned_.set(i, !0)), this;
|
|
455
455
|
}
|
|
456
456
|
delete(i) {
|
|
457
457
|
if (!this.has(i)) return !1;
|
|
458
|
-
const o = this[
|
|
459
|
-
return n(o), e(o),
|
|
458
|
+
const o = this[l];
|
|
459
|
+
return n(o), e(o), g(o), o.base_.has(i) ? o.assigned_.set(i, !1) : o.assigned_.delete(i), o.copy_.delete(i), !0;
|
|
460
460
|
}
|
|
461
461
|
clear() {
|
|
462
|
-
const i = this[
|
|
463
|
-
n(i), f(i).size && (e(i),
|
|
462
|
+
const i = this[l];
|
|
463
|
+
n(i), f(i).size && (e(i), g(i), i.assigned_ = /* @__PURE__ */ new Map(), P(i.base_, (o) => {
|
|
464
464
|
i.assigned_.set(o, !1);
|
|
465
465
|
}), i.copy_.clear());
|
|
466
466
|
}
|
|
467
467
|
forEach(i, o) {
|
|
468
|
-
f(this[
|
|
469
|
-
i.call(o, this.get(
|
|
468
|
+
f(this[l]).forEach((p, m, we) => {
|
|
469
|
+
i.call(o, this.get(m), m, this);
|
|
470
470
|
});
|
|
471
471
|
}
|
|
472
472
|
get(i) {
|
|
473
|
-
const o = this[
|
|
473
|
+
const o = this[l];
|
|
474
474
|
n(o);
|
|
475
475
|
const p = f(o).get(i);
|
|
476
476
|
if (o.finalized_ || !v(p) || p !== o.base_.get(i)) return p;
|
|
477
|
-
const
|
|
478
|
-
return e(o), o.copy_.set(i,
|
|
477
|
+
const m = I(p, o);
|
|
478
|
+
return e(o), o.copy_.set(i, m), m;
|
|
479
479
|
}
|
|
480
480
|
keys() {
|
|
481
|
-
return f(this[
|
|
481
|
+
return f(this[l]).keys();
|
|
482
482
|
}
|
|
483
483
|
values() {
|
|
484
484
|
const i = this.keys();
|
|
@@ -505,34 +505,34 @@ function be(t, e) {
|
|
|
505
505
|
}
|
|
506
506
|
class r extends Set {
|
|
507
507
|
constructor(i, o) {
|
|
508
|
-
super(), this[
|
|
508
|
+
super(), this[l] = { type_: 3, parent_: o, scope_: o ? o.scope_ : N(), modified_: !1, finalized_: !1, copy_: void 0, base_: i, draft_: this, drafts_: /* @__PURE__ */ new Map(), revoked_: !1, isManual_: !1 };
|
|
509
509
|
}
|
|
510
510
|
get size() {
|
|
511
|
-
return f(this[
|
|
511
|
+
return f(this[l]).size;
|
|
512
512
|
}
|
|
513
513
|
has(i) {
|
|
514
|
-
const o = this[
|
|
514
|
+
const o = this[l];
|
|
515
515
|
return n(o), o.copy_ ? !!o.copy_.has(i) || !(!o.drafts_.has(i) || !o.copy_.has(o.drafts_.get(i))) : o.base_.has(i);
|
|
516
516
|
}
|
|
517
517
|
add(i) {
|
|
518
|
-
const o = this[
|
|
519
|
-
return n(o), this.has(i) || (s(o),
|
|
518
|
+
const o = this[l];
|
|
519
|
+
return n(o), this.has(i) || (s(o), g(o), o.copy_.add(i)), this;
|
|
520
520
|
}
|
|
521
521
|
delete(i) {
|
|
522
522
|
if (!this.has(i)) return !1;
|
|
523
|
-
const o = this[
|
|
524
|
-
return n(o), s(o),
|
|
523
|
+
const o = this[l];
|
|
524
|
+
return n(o), s(o), g(o), o.copy_.delete(i) || !!o.drafts_.has(i) && o.copy_.delete(o.drafts_.get(i));
|
|
525
525
|
}
|
|
526
526
|
clear() {
|
|
527
|
-
const i = this[
|
|
528
|
-
n(i), f(i).size && (s(i),
|
|
527
|
+
const i = this[l];
|
|
528
|
+
n(i), f(i).size && (s(i), g(i), i.copy_.clear());
|
|
529
529
|
}
|
|
530
530
|
values() {
|
|
531
|
-
const i = this[
|
|
531
|
+
const i = this[l];
|
|
532
532
|
return n(i), s(i), i.copy_.values();
|
|
533
533
|
}
|
|
534
534
|
entries() {
|
|
535
|
-
const i = this[
|
|
535
|
+
const i = this[l];
|
|
536
536
|
return n(i), s(i), i.copy_.entries();
|
|
537
537
|
}
|
|
538
538
|
keys() {
|
|
@@ -543,14 +543,14 @@ function be(t, e) {
|
|
|
543
543
|
}
|
|
544
544
|
forEach(i, o) {
|
|
545
545
|
const p = this.values();
|
|
546
|
-
let
|
|
547
|
-
for (; !
|
|
546
|
+
let m = p.next();
|
|
547
|
+
for (; !m.done; ) i.call(o, m.value, m.value, this), m = p.next();
|
|
548
548
|
}
|
|
549
549
|
}
|
|
550
550
|
function s(c) {
|
|
551
551
|
c.copy_ || (c.copy_ = /* @__PURE__ */ new Set(), c.base_.forEach((i) => {
|
|
552
552
|
if (v(i)) {
|
|
553
|
-
const o =
|
|
553
|
+
const o = I(i, c);
|
|
554
554
|
c.drafts_.set(i, o), c.copy_.add(o);
|
|
555
555
|
} else c.copy_.add(i);
|
|
556
556
|
}));
|
|
@@ -563,11 +563,18 @@ function be(t, e) {
|
|
|
563
563
|
return new t(c, i);
|
|
564
564
|
}, proxySet_: function(c, i) {
|
|
565
565
|
return new r(c, i);
|
|
566
|
-
} },
|
|
567
|
-
})()
|
|
568
|
-
class
|
|
566
|
+
} }, U[a = "MapSet"] || (U[a] = h);
|
|
567
|
+
})(), de = $;
|
|
568
|
+
class q {
|
|
569
569
|
constructor(e, r, s) {
|
|
570
|
-
|
|
570
|
+
let n;
|
|
571
|
+
this.storageType = e, this.key = r, this[de] = !0, this._ready = !1, this._destroy$ = new pe(), this.error$ = new Q(null), n = s instanceof Map ? new Map(s) : Array.isArray(s) ? [...s] : s && typeof s == "object" ? { ...s } : s;
|
|
572
|
+
try {
|
|
573
|
+
this.defaultValue = this.isImmerDraftable(n) ? d(n, (a) => a) : n;
|
|
574
|
+
} catch {
|
|
575
|
+
this.defaultValue = n;
|
|
576
|
+
}
|
|
577
|
+
this.$ = new Q(this.defaultValue), this.storage = Se(e, r), e === "memory" ? this._ready = !0 : this.initializeFromStorage();
|
|
571
578
|
}
|
|
572
579
|
get ready() {
|
|
573
580
|
return this._ready;
|
|
@@ -578,35 +585,48 @@ class X {
|
|
|
578
585
|
get value() {
|
|
579
586
|
return this.$.getValue();
|
|
580
587
|
}
|
|
588
|
+
isImmerDraftable(e) {
|
|
589
|
+
return e !== null && typeof e == "object" && (Array.isArray(e) || e instanceof Map || e instanceof Set || Object.getPrototypeOf(e) === Object.prototype || e[$] === !0);
|
|
590
|
+
}
|
|
581
591
|
destroy() {
|
|
582
592
|
this._destroy$.next(), this._destroy$.complete(), this.$.complete(), this.error$.complete();
|
|
583
593
|
}
|
|
584
594
|
replace(e) {
|
|
585
|
-
|
|
586
|
-
|
|
595
|
+
try {
|
|
596
|
+
const r = this.isImmerDraftable(e) ? d(e, (s) => s) : e;
|
|
597
|
+
this.updateState(r);
|
|
598
|
+
} catch (r) {
|
|
599
|
+
const s = new u(`Error replacing state in ${this.key}`, r);
|
|
600
|
+
this.error$.next(s), this.updateState(e);
|
|
601
|
+
}
|
|
587
602
|
}
|
|
588
603
|
updateState(e) {
|
|
589
604
|
try {
|
|
590
|
-
|
|
591
|
-
this.$.next(r), this.storageType !== "memory" && this.persistToStorage(r).catch((s) => {
|
|
592
|
-
const n = new
|
|
605
|
+
let r;
|
|
606
|
+
r = this.isImmerDraftable(e) ? d(e, (s) => s) : e, this.$.next(r), this.storageType !== "memory" && this.persistToStorage(r).catch((s) => {
|
|
607
|
+
const n = new u(`Error saving to ${this.storageType} storage for ${this.key}`, s);
|
|
593
608
|
this.error$.next(n);
|
|
594
609
|
});
|
|
595
610
|
} catch (r) {
|
|
596
|
-
const s = new
|
|
597
|
-
this.error$.next(s);
|
|
611
|
+
const s = new u(`Error updating state in ${this.key}`, r);
|
|
612
|
+
this.error$.next(s), this.$.next(e);
|
|
598
613
|
}
|
|
599
614
|
}
|
|
600
615
|
async initializeFromStorage() {
|
|
601
616
|
try {
|
|
602
617
|
const e = await this.storage.load();
|
|
603
618
|
if (e) {
|
|
604
|
-
const r = this.processStoredValue(e)
|
|
605
|
-
|
|
619
|
+
const r = this.processStoredValue(e);
|
|
620
|
+
try {
|
|
621
|
+
const s = this.isImmerDraftable(r) ? d(r, (n) => n) : r;
|
|
622
|
+
this.updateState(s);
|
|
623
|
+
} catch {
|
|
624
|
+
this.updateState(r);
|
|
625
|
+
}
|
|
606
626
|
}
|
|
607
627
|
this._ready = !0;
|
|
608
628
|
} catch (e) {
|
|
609
|
-
const r = new
|
|
629
|
+
const r = new u(`Error loading from ${this.storageType} storage for ${this.key}`, e);
|
|
610
630
|
this.error$.next(r), this._ready = !0;
|
|
611
631
|
}
|
|
612
632
|
}
|
|
@@ -617,10 +637,10 @@ class X {
|
|
|
617
637
|
return this.storage.save(e);
|
|
618
638
|
}
|
|
619
639
|
}
|
|
620
|
-
const
|
|
640
|
+
const k = class k extends q {
|
|
621
641
|
static getInstance(e, r, s) {
|
|
622
642
|
const n = `${e}:${r}`;
|
|
623
|
-
return this.instances.has(n) || this.instances.set(n, new
|
|
643
|
+
return this.instances.has(n) || this.instances.set(n, new k(e, r, s)), this.instances.get(n);
|
|
624
644
|
}
|
|
625
645
|
set(e, r) {
|
|
626
646
|
try {
|
|
@@ -629,7 +649,7 @@ const x = class x extends X {
|
|
|
629
649
|
});
|
|
630
650
|
this.updateState(s), this.error$.next(null);
|
|
631
651
|
} catch (s) {
|
|
632
|
-
const n = new
|
|
652
|
+
const n = new u(`Error setting value for key ${e} in ${this.key}`, s);
|
|
633
653
|
this.error$.next(n);
|
|
634
654
|
}
|
|
635
655
|
}
|
|
@@ -640,7 +660,7 @@ const x = class x extends X {
|
|
|
640
660
|
});
|
|
641
661
|
this.updateState(r), this.error$.next(null);
|
|
642
662
|
} catch (r) {
|
|
643
|
-
const s = new
|
|
663
|
+
const s = new u(`Error deleting key ${e} from ${this.key}`, r);
|
|
644
664
|
this.error$.next(s);
|
|
645
665
|
}
|
|
646
666
|
}
|
|
@@ -656,7 +676,7 @@ const x = class x extends X {
|
|
|
656
676
|
});
|
|
657
677
|
this.updateState(r), this.error$.next(null);
|
|
658
678
|
} catch (r) {
|
|
659
|
-
const s = new
|
|
679
|
+
const s = new u(`Error batch updating in ${this.key}`, r);
|
|
660
680
|
this.error$.next(s);
|
|
661
681
|
}
|
|
662
682
|
}
|
|
@@ -668,7 +688,7 @@ const x = class x extends X {
|
|
|
668
688
|
});
|
|
669
689
|
this.updateState(s), this.error$.next(null);
|
|
670
690
|
} catch (s) {
|
|
671
|
-
const n = new
|
|
691
|
+
const n = new u(`Error updating item ${e} in ${this.key}`, s);
|
|
672
692
|
this.error$.next(n);
|
|
673
693
|
}
|
|
674
694
|
}
|
|
@@ -676,9 +696,9 @@ const x = class x extends X {
|
|
|
676
696
|
super(e, r, s), e !== "memory" && this.setupPersistence();
|
|
677
697
|
}
|
|
678
698
|
setupPersistence() {
|
|
679
|
-
this.$.pipe(
|
|
699
|
+
this.$.pipe(oe(100, void 0, { leading: !0, trailing: !0 })).subscribe((e) => {
|
|
680
700
|
this.storage.save(e).catch((r) => {
|
|
681
|
-
const s = new
|
|
701
|
+
const s = new u(`Error saving to ${this.storageType} storage for ${this.key}`, r);
|
|
682
702
|
this.error$.next(s);
|
|
683
703
|
});
|
|
684
704
|
});
|
|
@@ -690,56 +710,130 @@ const x = class x extends X {
|
|
|
690
710
|
} });
|
|
691
711
|
}
|
|
692
712
|
};
|
|
693
|
-
|
|
694
|
-
let
|
|
695
|
-
const
|
|
713
|
+
k.type = "collection", k.instances = /* @__PURE__ */ new Map();
|
|
714
|
+
let ne = k;
|
|
715
|
+
const O = class O extends (se = q, re = $, se) {
|
|
716
|
+
constructor() {
|
|
717
|
+
super(...arguments), this[re] = !0;
|
|
718
|
+
}
|
|
696
719
|
static getInstance(e, r, s) {
|
|
697
720
|
const n = `${e}:${r}`;
|
|
698
|
-
return this.instances.has(n) || this.instances.set(n, new
|
|
721
|
+
return this.instances.has(n) || this.instances.set(n, new O(e, r, s)), this.instances.get(n);
|
|
699
722
|
}
|
|
700
723
|
set(e, r = !0) {
|
|
701
724
|
try {
|
|
725
|
+
if (!this.isImmerDraftable(this.value)) {
|
|
726
|
+
const n = r ? { ...this.value, ...e } : e;
|
|
727
|
+
return this.updateState(n), void this.error$.next(null);
|
|
728
|
+
}
|
|
702
729
|
const s = d(this.value, (n) => {
|
|
703
|
-
if (
|
|
704
|
-
|
|
730
|
+
if (r) {
|
|
731
|
+
if (e == null) return;
|
|
732
|
+
try {
|
|
733
|
+
Object.assign(n, e);
|
|
734
|
+
} catch {
|
|
735
|
+
Object.keys(e).forEach((h) => {
|
|
736
|
+
n[h] = e[h];
|
|
737
|
+
});
|
|
738
|
+
}
|
|
739
|
+
} else try {
|
|
740
|
+
return e;
|
|
741
|
+
} catch {
|
|
742
|
+
return e;
|
|
743
|
+
}
|
|
705
744
|
});
|
|
706
745
|
this.updateState(s), this.error$.next(null);
|
|
707
746
|
} catch (s) {
|
|
708
|
-
const n = new
|
|
747
|
+
const n = new u(`Error updating store: ${this.key}`, s, { value: e, merge: r });
|
|
709
748
|
this.error$.next(n);
|
|
749
|
+
try {
|
|
750
|
+
const a = r ? { ...this.value, ...e } : e;
|
|
751
|
+
this.updateState(a);
|
|
752
|
+
} catch {
|
|
753
|
+
}
|
|
710
754
|
}
|
|
711
755
|
}
|
|
712
756
|
clear() {
|
|
713
|
-
|
|
714
|
-
|
|
757
|
+
try {
|
|
758
|
+
if (this.isImmerDraftable(this.defaultValue)) {
|
|
759
|
+
const e = d(this.defaultValue, (r) => r);
|
|
760
|
+
this.set(e, !1);
|
|
761
|
+
} else this.set(this.defaultValue, !1);
|
|
762
|
+
} catch (e) {
|
|
763
|
+
const r = new u(`Error clearing store: ${this.key}`, e);
|
|
764
|
+
this.error$.next(r), this.updateState(this.defaultValue);
|
|
765
|
+
}
|
|
715
766
|
}
|
|
716
767
|
delete(e) {
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
768
|
+
try {
|
|
769
|
+
if (!this.isImmerDraftable(this.value)) {
|
|
770
|
+
const s = { ...this.value };
|
|
771
|
+
return delete s[e], void this.updateState(s);
|
|
772
|
+
}
|
|
773
|
+
const r = d(this.value, (s) => {
|
|
774
|
+
delete s[e];
|
|
775
|
+
});
|
|
776
|
+
this.updateState(r);
|
|
777
|
+
} catch (r) {
|
|
778
|
+
const s = new u(`Error deleting key ${String(e)} from store: ${this.key}`, r);
|
|
779
|
+
this.error$.next(s);
|
|
780
|
+
try {
|
|
781
|
+
const n = { ...this.value };
|
|
782
|
+
delete n[e], this.updateState(n);
|
|
783
|
+
} catch {
|
|
784
|
+
}
|
|
785
|
+
}
|
|
721
786
|
}
|
|
722
787
|
setPath(e, r) {
|
|
723
788
|
try {
|
|
789
|
+
if (!e) return;
|
|
790
|
+
if (!this.isImmerDraftable(this.value)) {
|
|
791
|
+
const n = e.split("."), a = { ...this.value };
|
|
792
|
+
let h = a;
|
|
793
|
+
for (let c = 0; c < n.length - 1; c++) {
|
|
794
|
+
const i = n[c];
|
|
795
|
+
h[i] === void 0 ? h[i] = {} : typeof h[i] == "object" && h[i] !== null || (h[i] = {}), h = h[i];
|
|
796
|
+
}
|
|
797
|
+
return h[n[n.length - 1]] = r, void this.updateState(a);
|
|
798
|
+
}
|
|
724
799
|
const s = d(this.value, (n) => {
|
|
725
800
|
const a = e.split(".");
|
|
726
801
|
let h = n;
|
|
727
|
-
for (let
|
|
728
|
-
const
|
|
729
|
-
|
|
802
|
+
for (let i = 0; i < a.length - 1; i++) {
|
|
803
|
+
const o = a[i];
|
|
804
|
+
h[o] === void 0 ? h[o] = {} : typeof h[o] == "object" && h[o] !== null || (h[o] = {}), h = h[o];
|
|
805
|
+
}
|
|
806
|
+
const c = a[a.length - 1];
|
|
807
|
+
try {
|
|
808
|
+
h[c] = r;
|
|
809
|
+
} catch {
|
|
810
|
+
h[c] = r;
|
|
730
811
|
}
|
|
731
|
-
h[a[a.length - 1]] = r;
|
|
732
812
|
});
|
|
733
813
|
this.updateState(s), this.error$.next(null);
|
|
734
814
|
} catch (s) {
|
|
735
|
-
const n = new
|
|
815
|
+
const n = new u(`Error setting path ${e} in ${this.key}`, s);
|
|
736
816
|
this.error$.next(n);
|
|
817
|
+
try {
|
|
818
|
+
const a = e.split("."), h = { ...this.value };
|
|
819
|
+
let c = h;
|
|
820
|
+
for (let i = 0; i < a.length - 1; i++) {
|
|
821
|
+
const o = a[i];
|
|
822
|
+
c[o] === void 0 ? c[o] = {} : typeof c[o] == "object" && c[o] !== null || (c[o] = {}), c = c[o];
|
|
823
|
+
}
|
|
824
|
+
c[a[a.length - 1]] = r, this.updateState(h);
|
|
825
|
+
} catch {
|
|
826
|
+
}
|
|
737
827
|
}
|
|
738
828
|
}
|
|
739
829
|
processStoredValue(e) {
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
830
|
+
try {
|
|
831
|
+
return this.isImmerDraftable(this.defaultValue) && this.isImmerDraftable(e) ? d(this.defaultValue, (r) => {
|
|
832
|
+
Object.assign(r, e);
|
|
833
|
+
}) : { ...this.defaultValue, ...e };
|
|
834
|
+
} catch {
|
|
835
|
+
return e;
|
|
836
|
+
}
|
|
743
837
|
}
|
|
744
838
|
setupDevTools() {
|
|
745
839
|
typeof window < "u" && (window.__STORES__ = window.__STORES__ || {}, window.__STORES__[this.key] = { getState: () => this.value, set: this.set.bind(this), delete: this.delete.bind(this), clear: this.clear.bind(this), setPath: this.setPath.bind(this), subscribe: (e) => {
|
|
@@ -747,21 +841,24 @@ const k = class k extends X {
|
|
|
747
841
|
return () => r.unsubscribe();
|
|
748
842
|
} });
|
|
749
843
|
}
|
|
844
|
+
isImmerDraftable(e) {
|
|
845
|
+
return e !== null && typeof e == "object" && (super.isImmerDraftable(e) || e[$] === !0);
|
|
846
|
+
}
|
|
750
847
|
};
|
|
751
|
-
|
|
752
|
-
let
|
|
753
|
-
const
|
|
848
|
+
O.type = "object", O.instances = /* @__PURE__ */ new Map();
|
|
849
|
+
let ie = O;
|
|
850
|
+
const D = class D extends q {
|
|
754
851
|
static getInstance(e, r, s = []) {
|
|
755
852
|
const n = `${e}:${r}`;
|
|
756
|
-
return this.instances.has(n) || this.instances.set(n, new
|
|
853
|
+
return this.instances.has(n) || this.instances.set(n, new D(e, r, s)), this.instances.get(n);
|
|
757
854
|
}
|
|
758
855
|
constructor(e, r, s = []) {
|
|
759
856
|
super(e, r, s), e !== "memory" && this.setupPersistence();
|
|
760
857
|
}
|
|
761
858
|
setupPersistence() {
|
|
762
|
-
this.$.pipe(
|
|
859
|
+
this.$.pipe(oe(100, void 0, { leading: !0, trailing: !0 })).subscribe((e) => {
|
|
763
860
|
this.storage.save(e).catch((r) => {
|
|
764
|
-
const s = new
|
|
861
|
+
const s = new u(`Error saving to ${this.storageType} storage for ${this.key}`, r);
|
|
765
862
|
this.error$.next(s);
|
|
766
863
|
});
|
|
767
864
|
});
|
|
@@ -773,7 +870,7 @@ const O = class O extends X {
|
|
|
773
870
|
});
|
|
774
871
|
this.updateState(r), this.error$.next(null);
|
|
775
872
|
} catch (r) {
|
|
776
|
-
const s = new
|
|
873
|
+
const s = new u(`Error pushing items in ${this.key}`, r);
|
|
777
874
|
this.error$.next(s);
|
|
778
875
|
}
|
|
779
876
|
}
|
|
@@ -784,7 +881,7 @@ const O = class O extends X {
|
|
|
784
881
|
});
|
|
785
882
|
return this.updateState(r), this.error$.next(null), e;
|
|
786
883
|
} catch (e) {
|
|
787
|
-
const r = new
|
|
884
|
+
const r = new u(`Error popping item from ${this.key}`, e);
|
|
788
885
|
return void this.error$.next(r);
|
|
789
886
|
}
|
|
790
887
|
}
|
|
@@ -795,7 +892,7 @@ const O = class O extends X {
|
|
|
795
892
|
});
|
|
796
893
|
this.updateState(r), this.error$.next(null);
|
|
797
894
|
} catch (r) {
|
|
798
|
-
const s = new
|
|
895
|
+
const s = new u(`Error unshifting items in ${this.key}`, r);
|
|
799
896
|
this.error$.next(s);
|
|
800
897
|
}
|
|
801
898
|
}
|
|
@@ -806,7 +903,7 @@ const O = class O extends X {
|
|
|
806
903
|
});
|
|
807
904
|
return this.updateState(r), this.error$.next(null), e;
|
|
808
905
|
} catch (e) {
|
|
809
|
-
const r = new
|
|
906
|
+
const r = new u(`Error shifting item from ${this.key}`, e);
|
|
810
907
|
return void this.error$.next(r);
|
|
811
908
|
}
|
|
812
909
|
}
|
|
@@ -818,7 +915,7 @@ const O = class O extends X {
|
|
|
818
915
|
});
|
|
819
916
|
this.updateState(s), this.error$.next(null);
|
|
820
917
|
} catch (s) {
|
|
821
|
-
const n = new
|
|
918
|
+
const n = new u(`Error setting item at index ${e} in ${this.key}`, s);
|
|
822
919
|
this.error$.next(n);
|
|
823
920
|
}
|
|
824
921
|
}
|
|
@@ -832,7 +929,7 @@ const O = class O extends X {
|
|
|
832
929
|
});
|
|
833
930
|
return this.updateState(a), this.error$.next(null), n;
|
|
834
931
|
} catch (n) {
|
|
835
|
-
const a = new
|
|
932
|
+
const a = new u(`Error splicing items in ${this.key}`, n);
|
|
836
933
|
return this.error$.next(a), [];
|
|
837
934
|
}
|
|
838
935
|
}
|
|
@@ -847,7 +944,7 @@ const O = class O extends X {
|
|
|
847
944
|
}
|
|
848
945
|
return this.error$.next(null), !1;
|
|
849
946
|
} catch (s) {
|
|
850
|
-
const n = new
|
|
947
|
+
const n = new u(`Error removing item in ${this.key}`, s);
|
|
851
948
|
return this.error$.next(n), !1;
|
|
852
949
|
}
|
|
853
950
|
}
|
|
@@ -856,7 +953,7 @@ const O = class O extends X {
|
|
|
856
953
|
const r = d(e, (s) => s);
|
|
857
954
|
this.updateState(r), this.error$.next(null);
|
|
858
955
|
} catch (r) {
|
|
859
|
-
const s = new
|
|
956
|
+
const s = new u(`Error replacing array in ${this.key}`, r);
|
|
860
957
|
this.error$.next(s);
|
|
861
958
|
}
|
|
862
959
|
}
|
|
@@ -867,7 +964,7 @@ const O = class O extends X {
|
|
|
867
964
|
});
|
|
868
965
|
this.updateState(s), this.error$.next(null);
|
|
869
966
|
} catch (r) {
|
|
870
|
-
const s = new
|
|
967
|
+
const s = new u(`Error filtering array in ${this.key}`, r);
|
|
871
968
|
this.error$.next(s);
|
|
872
969
|
}
|
|
873
970
|
}
|
|
@@ -881,7 +978,7 @@ const O = class O extends X {
|
|
|
881
978
|
});
|
|
882
979
|
this.updateState(s), this.error$.next(null);
|
|
883
980
|
} catch (r) {
|
|
884
|
-
const s = new
|
|
981
|
+
const s = new u(`Error sorting array in ${this.key}`, r);
|
|
885
982
|
this.error$.next(s);
|
|
886
983
|
}
|
|
887
984
|
}
|
|
@@ -893,7 +990,7 @@ const O = class O extends X {
|
|
|
893
990
|
});
|
|
894
991
|
this.updateState(s), this.error$.next(null);
|
|
895
992
|
} catch (s) {
|
|
896
|
-
const n = new
|
|
993
|
+
const n = new u(`Error updating item at index ${e} in ${this.key}`, s);
|
|
897
994
|
this.error$.next(n);
|
|
898
995
|
}
|
|
899
996
|
}
|
|
@@ -907,17 +1004,17 @@ const O = class O extends X {
|
|
|
907
1004
|
} });
|
|
908
1005
|
}
|
|
909
1006
|
};
|
|
910
|
-
|
|
911
|
-
let
|
|
1007
|
+
D.type = "array", D.instances = /* @__PURE__ */ new Map();
|
|
1008
|
+
let ae = D;
|
|
912
1009
|
export {
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
1010
|
+
G as I,
|
|
1011
|
+
ge as L,
|
|
1012
|
+
me as M,
|
|
1013
|
+
ie as S,
|
|
1014
|
+
ve as a,
|
|
1015
|
+
u as b,
|
|
1016
|
+
Se as c,
|
|
1017
|
+
ne as d,
|
|
1018
|
+
ae as e
|
|
922
1019
|
};
|
|
923
|
-
//# sourceMappingURL=context-array-
|
|
1020
|
+
//# sourceMappingURL=context-array-DpyA_ATT.js.map
|