atomaric 0.0.77 → 0.0.79
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/build/atomaric.js +809 -286
- package/build/atomaric.umd.cjs +1 -1
- package/package.json +2 -1
- package/types/do.classes.model/{Array.ts → IArray.ts} +1 -1
- package/types/index.d.ts +6 -6
- /package/types/do.classes.model/{Boolean.ts → IBoolean.ts} +0 -0
- /package/types/do.classes.model/{Map.ts → IMap.ts} +0 -0
- /package/types/do.classes.model/{Number.ts → INumber.ts} +0 -0
- /package/types/do.classes.model/{Object.ts → IObject.ts} +0 -0
- /package/types/do.classes.model/{Set.ts → ISet.ts} +0 -0
package/build/atomaric.js
CHANGED
|
@@ -1,391 +1,914 @@
|
|
|
1
|
-
let
|
|
1
|
+
let Je = () => {
|
|
2
2
|
throw "call configureAtomaric() before all!";
|
|
3
3
|
};
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
},
|
|
7
|
-
class
|
|
8
|
-
constructor(
|
|
9
|
-
if (
|
|
4
|
+
const T = {}, Ot = (e) => {
|
|
5
|
+
T.useSyncExternalStore = Je = e.useSyncExternalStore, T.keyPathSeparator = e.keyPathSeparator, T.securifyKeyLevel = e.securifyKeyLevel, T.securifyValueLevel = e.securifyValueLevel;
|
|
6
|
+
}, ft = (e) => Je(e.subscribe, e.get), lt = (e) => e.set, jt = (e) => e.setDeferred, Bt = (e) => e.get, Wt = (e) => e.do, qt = (e) => [ft(e), lt(e)], Gt = (e, t) => new Rt(e, t);
|
|
7
|
+
class F {
|
|
8
|
+
constructor(t) {
|
|
9
|
+
if (t)
|
|
10
10
|
return new Proxy(this, {
|
|
11
|
-
get: (
|
|
11
|
+
get: (r, n) => n in this ? r[n] : t[n]
|
|
12
12
|
});
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
15
|
+
var Ye = Symbol.for("immer-nothing"), Ve = Symbol.for("immer-draftable"), m = Symbol.for("immer-state"), dt = process.env.NODE_ENV !== "production" ? [
|
|
16
|
+
// All error codes, starting by 0:
|
|
17
|
+
function(e) {
|
|
18
|
+
return `The plugin for '${e}' has not been loaded into Immer. To enable the plugin, import and call \`enable${e}()\` when initializing your application.`;
|
|
19
|
+
},
|
|
20
|
+
function(e) {
|
|
21
|
+
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}'`;
|
|
22
|
+
},
|
|
23
|
+
"This object has been frozen and should not be mutated",
|
|
24
|
+
function(e) {
|
|
25
|
+
return "Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? " + e;
|
|
26
|
+
},
|
|
27
|
+
"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.",
|
|
28
|
+
"Immer forbids circular references",
|
|
29
|
+
"The first or second argument to `produce` must be a function",
|
|
30
|
+
"The third argument to `produce` must be a function or undefined",
|
|
31
|
+
"First argument to `createDraft` must be a plain object, an array, or an immerable object",
|
|
32
|
+
"First argument to `finishDraft` must be a draft returned by `createDraft`",
|
|
33
|
+
function(e) {
|
|
34
|
+
return `'current' expects a draft, got: ${e}`;
|
|
35
|
+
},
|
|
36
|
+
"Object.defineProperty() cannot be used on an Immer draft",
|
|
37
|
+
"Object.setPrototypeOf() cannot be used on an Immer draft",
|
|
38
|
+
"Immer only supports deleting array indices",
|
|
39
|
+
"Immer only supports setting array indices and the 'length' property",
|
|
40
|
+
function(e) {
|
|
41
|
+
return `'original' expects a draft, got: ${e}`;
|
|
42
|
+
}
|
|
43
|
+
// Note: if more errors are added, the errorOffset in Patches.ts should be increased
|
|
44
|
+
// See Patches.ts for additional errors
|
|
45
|
+
] : [];
|
|
46
|
+
function g(e, ...t) {
|
|
47
|
+
if (process.env.NODE_ENV !== "production") {
|
|
48
|
+
const r = dt[e], n = v(r) ? r.apply(null, t) : r;
|
|
49
|
+
throw new Error(`[Immer] ${n}`);
|
|
50
|
+
}
|
|
51
|
+
throw new Error(
|
|
52
|
+
`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
var w = Object, U = w.getPrototypeOf, X = "constructor", ie = "prototype", Se = "configurable", Z = "enumerable", J = "writable", B = "value", M = (e) => !!e && !!e[m];
|
|
56
|
+
function C(e) {
|
|
57
|
+
var t;
|
|
58
|
+
return e ? Qe(e) || ce(e) || !!e[Ve] || !!((t = e[X]) != null && t[Ve]) || ae(e) || ue(e) : !1;
|
|
59
|
+
}
|
|
60
|
+
var ht = w[ie][X].toString(), Ue = /* @__PURE__ */ new WeakMap();
|
|
61
|
+
function Qe(e) {
|
|
62
|
+
if (!e || !Ee(e))
|
|
63
|
+
return !1;
|
|
64
|
+
const t = U(e);
|
|
65
|
+
if (t === null || t === w[ie])
|
|
66
|
+
return !0;
|
|
67
|
+
const r = w.hasOwnProperty.call(t, X) && t[X];
|
|
68
|
+
if (r === Object)
|
|
69
|
+
return !0;
|
|
70
|
+
if (!v(r))
|
|
71
|
+
return !1;
|
|
72
|
+
let n = Ue.get(r);
|
|
73
|
+
return n === void 0 && (n = Function.toString.call(r), Ue.set(r, n)), n === ht;
|
|
74
|
+
}
|
|
75
|
+
function oe(e, t, r = !0) {
|
|
76
|
+
G(e) === 0 ? (r ? Reflect.ownKeys(e) : w.keys(e)).forEach((s) => {
|
|
77
|
+
t(s, e[s], e);
|
|
78
|
+
}) : e.forEach((n, s) => t(s, n, e));
|
|
79
|
+
}
|
|
80
|
+
function G(e) {
|
|
81
|
+
const t = e[m];
|
|
82
|
+
return t ? t.type_ : ce(e) ? 1 : ae(e) ? 2 : ue(e) ? 3 : 0;
|
|
83
|
+
}
|
|
84
|
+
var Oe = (e, t, r = G(e)) => r === 2 ? e.has(t) : w[ie].hasOwnProperty.call(e, t), Pe = (e, t, r = G(e)) => (
|
|
85
|
+
// @ts-ignore
|
|
86
|
+
r === 2 ? e.get(t) : e[t]
|
|
87
|
+
), ee = (e, t, r, n = G(e)) => {
|
|
88
|
+
n === 2 ? e.set(t, r) : n === 3 ? e.add(r) : e[t] = r;
|
|
89
|
+
};
|
|
90
|
+
function _t(e, t) {
|
|
91
|
+
return e === t ? e !== 0 || 1 / e === 1 / t : e !== e && t !== t;
|
|
92
|
+
}
|
|
93
|
+
var ce = Array.isArray, ae = (e) => e instanceof Map, ue = (e) => e instanceof Set, Ee = (e) => typeof e == "object", v = (e) => typeof e == "function", ge = (e) => typeof e == "boolean";
|
|
94
|
+
function yt(e) {
|
|
95
|
+
const t = +e;
|
|
96
|
+
return Number.isInteger(t) && String(t) === e;
|
|
97
|
+
}
|
|
98
|
+
var I = (e) => e.copy_ || e.base_, Fe = (e) => e.modified_ ? e.copy_ : e.base_;
|
|
99
|
+
function Ae(e, t) {
|
|
100
|
+
if (ae(e))
|
|
101
|
+
return new Map(e);
|
|
102
|
+
if (ue(e))
|
|
103
|
+
return new Set(e);
|
|
104
|
+
if (ce(e))
|
|
105
|
+
return Array[ie].slice.call(e);
|
|
106
|
+
const r = Qe(e);
|
|
107
|
+
if (t === !0 || t === "class_only" && !r) {
|
|
108
|
+
const n = w.getOwnPropertyDescriptors(e);
|
|
109
|
+
delete n[m];
|
|
110
|
+
let s = Reflect.ownKeys(n);
|
|
111
|
+
for (let i = 0; i < s.length; i++) {
|
|
112
|
+
const c = s[i], u = n[c];
|
|
113
|
+
u[J] === !1 && (u[J] = !0, u[Se] = !0), (u.get || u.set) && (n[c] = {
|
|
114
|
+
[Se]: !0,
|
|
115
|
+
[J]: !0,
|
|
116
|
+
// could live with !!desc.set as well here...
|
|
117
|
+
[Z]: u[Z],
|
|
118
|
+
[B]: e[c]
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
return w.create(U(e), n);
|
|
122
|
+
} else {
|
|
123
|
+
const n = U(e);
|
|
124
|
+
if (n !== null && r)
|
|
125
|
+
return { ...e };
|
|
126
|
+
const s = w.create(n);
|
|
127
|
+
return w.assign(s, e);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
function Ne(e, t = !1) {
|
|
131
|
+
return fe(e) || M(e) || !C(e) || (G(e) > 1 && w.defineProperties(e, {
|
|
132
|
+
set: K,
|
|
133
|
+
add: K,
|
|
134
|
+
clear: K,
|
|
135
|
+
delete: K
|
|
136
|
+
}), w.freeze(e), t && oe(
|
|
137
|
+
e,
|
|
138
|
+
(r, n) => {
|
|
139
|
+
Ne(n, !0);
|
|
24
140
|
},
|
|
25
|
-
|
|
141
|
+
!1
|
|
142
|
+
)), e;
|
|
143
|
+
}
|
|
144
|
+
function pt() {
|
|
145
|
+
g(2);
|
|
146
|
+
}
|
|
147
|
+
var K = {
|
|
148
|
+
[B]: pt
|
|
149
|
+
};
|
|
150
|
+
function fe(e) {
|
|
151
|
+
return e === null || !Ee(e) ? !0 : w.isFrozen(e);
|
|
152
|
+
}
|
|
153
|
+
var te = "MapSet", be = "Patches", je = "ArrayMethods", Xe = {};
|
|
154
|
+
function E(e) {
|
|
155
|
+
const t = Xe[e];
|
|
156
|
+
return t || g(0, e), t;
|
|
157
|
+
}
|
|
158
|
+
var Be = (e) => !!Xe[e], W, Ze = () => W, mt = (e, t) => ({
|
|
159
|
+
drafts_: [],
|
|
160
|
+
parent_: e,
|
|
161
|
+
immer_: t,
|
|
162
|
+
// Whenever the modified draft contains a draft from another scope, we
|
|
163
|
+
// need to prevent auto-freezing so the unowned draft can be finalized.
|
|
164
|
+
canAutoFreeze_: !0,
|
|
165
|
+
unfinalizedDrafts_: 0,
|
|
166
|
+
handledSet_: /* @__PURE__ */ new Set(),
|
|
167
|
+
processedForPatches_: /* @__PURE__ */ new Set(),
|
|
168
|
+
mapSetPlugin_: Be(te) ? E(te) : void 0,
|
|
169
|
+
arrayMethodsPlugin_: Be(je) ? E(je) : void 0
|
|
170
|
+
});
|
|
171
|
+
function We(e, t) {
|
|
172
|
+
t && (e.patchPlugin_ = E(be), e.patches_ = [], e.inversePatches_ = [], e.patchListener_ = t);
|
|
173
|
+
}
|
|
174
|
+
function De(e) {
|
|
175
|
+
Ie(e), e.drafts_.forEach(gt), e.drafts_ = null;
|
|
176
|
+
}
|
|
177
|
+
function Ie(e) {
|
|
178
|
+
e === W && (W = e.parent_);
|
|
179
|
+
}
|
|
180
|
+
var qe = (e) => W = mt(W, e);
|
|
181
|
+
function gt(e) {
|
|
182
|
+
const t = e[m];
|
|
183
|
+
t.type_ === 0 || t.type_ === 1 ? t.revoke_() : t.revoked_ = !0;
|
|
184
|
+
}
|
|
185
|
+
function Ge(e, t) {
|
|
186
|
+
t.unfinalizedDrafts_ = t.drafts_.length;
|
|
187
|
+
const r = t.drafts_[0];
|
|
188
|
+
if (e !== void 0 && e !== r) {
|
|
189
|
+
r[m].modified_ && (De(t), g(4)), C(e) && (e = He(t, e));
|
|
190
|
+
const { patchPlugin_: s } = t;
|
|
191
|
+
s && s.generateReplacementPatches_(
|
|
192
|
+
r[m].base_,
|
|
193
|
+
e,
|
|
194
|
+
t
|
|
195
|
+
);
|
|
196
|
+
} else
|
|
197
|
+
e = He(t, r);
|
|
198
|
+
return wt(t, e, !0), De(t), t.patches_ && t.patchListener_(t.patches_, t.inversePatches_), e !== Ye ? e : void 0;
|
|
199
|
+
}
|
|
200
|
+
function He(e, t) {
|
|
201
|
+
if (fe(t))
|
|
202
|
+
return t;
|
|
203
|
+
const r = t[m];
|
|
204
|
+
if (!r)
|
|
205
|
+
return re(t, e.handledSet_, e);
|
|
206
|
+
if (!le(r, e))
|
|
207
|
+
return t;
|
|
208
|
+
if (!r.modified_)
|
|
209
|
+
return r.base_;
|
|
210
|
+
if (!r.finalized_) {
|
|
211
|
+
const { callbacks_: n } = r;
|
|
212
|
+
if (n)
|
|
213
|
+
for (; n.length > 0; )
|
|
214
|
+
n.pop()(e);
|
|
215
|
+
rt(r, e);
|
|
216
|
+
}
|
|
217
|
+
return r.copy_;
|
|
218
|
+
}
|
|
219
|
+
function wt(e, t, r = !1) {
|
|
220
|
+
!e.parent_ && e.immer_.autoFreeze_ && e.canAutoFreeze_ && Ne(t, r);
|
|
221
|
+
}
|
|
222
|
+
function et(e) {
|
|
223
|
+
e.finalized_ = !0, e.scope_.unfinalizedDrafts_--;
|
|
224
|
+
}
|
|
225
|
+
var le = (e, t) => e.scope_ === t, St = [];
|
|
226
|
+
function tt(e, t, r, n) {
|
|
227
|
+
const s = I(e), i = e.type_;
|
|
228
|
+
if (n !== void 0 && Pe(s, n, i) === t) {
|
|
229
|
+
ee(s, n, r, i);
|
|
230
|
+
return;
|
|
231
|
+
}
|
|
232
|
+
if (!e.draftLocations_) {
|
|
233
|
+
const u = e.draftLocations_ = /* @__PURE__ */ new Map();
|
|
234
|
+
oe(s, (y, d) => {
|
|
235
|
+
if (M(d)) {
|
|
236
|
+
const h = u.get(d) || [];
|
|
237
|
+
h.push(y), u.set(d, h);
|
|
238
|
+
}
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
const c = e.draftLocations_.get(t) ?? St;
|
|
242
|
+
for (const u of c)
|
|
243
|
+
ee(s, u, r, i);
|
|
244
|
+
}
|
|
245
|
+
function Pt(e, t, r) {
|
|
246
|
+
e.callbacks_.push(function(s) {
|
|
247
|
+
var u;
|
|
248
|
+
const i = t;
|
|
249
|
+
if (!i || !le(i, s))
|
|
250
|
+
return;
|
|
251
|
+
(u = s.mapSetPlugin_) == null || u.fixSetContents(i);
|
|
252
|
+
const c = Fe(i);
|
|
253
|
+
tt(e, i.draft_ ?? i, c, r), rt(i, s);
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
function rt(e, t) {
|
|
257
|
+
var n;
|
|
258
|
+
if (e.modified_ && !e.finalized_ && (e.type_ === 3 || e.type_ === 1 && e.allIndicesReassigned_ || (((n = e.assigned_) == null ? void 0 : n.size) ?? 0) > 0)) {
|
|
259
|
+
const { patchPlugin_: s } = t;
|
|
260
|
+
if (s) {
|
|
261
|
+
const i = s.getPath(e);
|
|
262
|
+
i && s.generatePatches_(e, i, t);
|
|
263
|
+
}
|
|
264
|
+
et(e);
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
function At(e, t, r) {
|
|
268
|
+
const { scope_: n } = e;
|
|
269
|
+
if (M(r)) {
|
|
270
|
+
const s = r[m];
|
|
271
|
+
le(s, n) && s.callbacks_.push(function() {
|
|
272
|
+
Y(e);
|
|
273
|
+
const c = Fe(s);
|
|
274
|
+
tt(e, r, c, t);
|
|
275
|
+
});
|
|
276
|
+
} else C(r) && e.callbacks_.push(function() {
|
|
277
|
+
const i = I(e);
|
|
278
|
+
e.type_ === 3 ? i.has(r) && re(r, n.handledSet_, n) : Pe(i, t, e.type_) === r && n.drafts_.length > 1 && (e.assigned_.get(t) ?? !1) === !0 && e.copy_ && re(
|
|
279
|
+
Pe(e.copy_, t, e.type_),
|
|
280
|
+
n.handledSet_,
|
|
281
|
+
n
|
|
282
|
+
);
|
|
26
283
|
});
|
|
27
|
-
|
|
284
|
+
}
|
|
285
|
+
function re(e, t, r) {
|
|
286
|
+
return !r.immer_.autoFreeze_ && r.unfinalizedDrafts_ < 1 || M(e) || t.has(e) || !C(e) || fe(e) || (t.add(e), oe(e, (n, s) => {
|
|
287
|
+
if (M(s)) {
|
|
288
|
+
const i = s[m];
|
|
289
|
+
if (le(i, r)) {
|
|
290
|
+
const c = Fe(i);
|
|
291
|
+
ee(e, n, c, e.type_), et(i);
|
|
292
|
+
}
|
|
293
|
+
} else C(s) && re(s, t, r);
|
|
294
|
+
})), e;
|
|
295
|
+
}
|
|
296
|
+
function bt(e, t) {
|
|
297
|
+
const r = ce(e), n = {
|
|
298
|
+
type_: r ? 1 : 0,
|
|
299
|
+
// Track which produce call this is associated with.
|
|
300
|
+
scope_: t ? t.scope_ : Ze(),
|
|
301
|
+
// True for both shallow and deep changes.
|
|
302
|
+
modified_: !1,
|
|
303
|
+
// Used during finalization.
|
|
304
|
+
finalized_: !1,
|
|
305
|
+
// Track which properties have been assigned (true) or deleted (false).
|
|
306
|
+
// actually instantiated in `prepareCopy()`
|
|
307
|
+
assigned_: void 0,
|
|
308
|
+
// The parent draft state.
|
|
309
|
+
parent_: t,
|
|
310
|
+
// The base state.
|
|
311
|
+
base_: e,
|
|
312
|
+
// The base proxy.
|
|
313
|
+
draft_: null,
|
|
314
|
+
// set below
|
|
315
|
+
// The base copy with any updated values.
|
|
316
|
+
copy_: null,
|
|
317
|
+
// Called by the `produce` function.
|
|
318
|
+
revoke_: null,
|
|
319
|
+
isManual_: !1,
|
|
320
|
+
// `callbacks` actually gets assigned in `createProxy`
|
|
321
|
+
callbacks_: void 0
|
|
322
|
+
};
|
|
323
|
+
let s = n, i = ne;
|
|
324
|
+
r && (s = [n], i = q);
|
|
325
|
+
const { revoke: c, proxy: u } = Proxy.revocable(s, i);
|
|
326
|
+
return n.draft_ = u, n.revoke_ = c, [u, n];
|
|
327
|
+
}
|
|
328
|
+
var ne = {
|
|
329
|
+
get(e, t) {
|
|
330
|
+
if (t === m)
|
|
331
|
+
return e;
|
|
332
|
+
let r = e.scope_.arrayMethodsPlugin_;
|
|
333
|
+
const n = e.type_ === 1 && typeof t == "string";
|
|
334
|
+
if (n && r != null && r.isArrayOperationMethod(t))
|
|
335
|
+
return r.createMethodInterceptor(e, t);
|
|
336
|
+
const s = I(e);
|
|
337
|
+
if (!Oe(s, t, e.type_))
|
|
338
|
+
return Dt(e, s, t);
|
|
339
|
+
const i = s[t];
|
|
340
|
+
if (e.finalized_ || !C(i) || n && e.operationMethod && (r != null && r.isMutatingArrayMethod(
|
|
341
|
+
e.operationMethod
|
|
342
|
+
)) && yt(t))
|
|
343
|
+
return i;
|
|
344
|
+
if (i === we(e.base_, t)) {
|
|
345
|
+
Y(e);
|
|
346
|
+
const c = e.type_ === 1 ? +t : t, u = Me(e.scope_, i, e, c);
|
|
347
|
+
return e.copy_[c] = u;
|
|
348
|
+
}
|
|
349
|
+
return i;
|
|
350
|
+
},
|
|
351
|
+
has(e, t) {
|
|
352
|
+
return t in I(e);
|
|
353
|
+
},
|
|
354
|
+
ownKeys(e) {
|
|
355
|
+
return Reflect.ownKeys(I(e));
|
|
356
|
+
},
|
|
357
|
+
set(e, t, r) {
|
|
358
|
+
const n = nt(I(e), t);
|
|
359
|
+
if (n != null && n.set)
|
|
360
|
+
return n.set.call(e.draft_, r), !0;
|
|
361
|
+
if (!e.modified_) {
|
|
362
|
+
const s = we(I(e), t), i = s == null ? void 0 : s[m];
|
|
363
|
+
if (i && i.base_ === r)
|
|
364
|
+
return e.copy_[t] = r, e.assigned_.set(t, !1), !0;
|
|
365
|
+
if (_t(r, s) && (r !== void 0 || Oe(e.base_, t, e.type_)))
|
|
366
|
+
return !0;
|
|
367
|
+
Y(e), Ce(e);
|
|
368
|
+
}
|
|
369
|
+
return e.copy_[t] === r && // special case: handle new props with value 'undefined'
|
|
370
|
+
(r !== void 0 || t in e.copy_) || // special case: NaN
|
|
371
|
+
Number.isNaN(r) && Number.isNaN(e.copy_[t]) || (e.copy_[t] = r, e.assigned_.set(t, !0), At(e, t, r)), !0;
|
|
372
|
+
},
|
|
373
|
+
deleteProperty(e, t) {
|
|
374
|
+
return Y(e), we(e.base_, t) !== void 0 || t in e.base_ ? (e.assigned_.set(t, !1), Ce(e)) : e.assigned_.delete(t), e.copy_ && delete e.copy_[t], !0;
|
|
375
|
+
},
|
|
376
|
+
// Note: We never coerce `desc.value` into an Immer draft, because we can't make
|
|
377
|
+
// the same guarantee in ES5 mode.
|
|
378
|
+
getOwnPropertyDescriptor(e, t) {
|
|
379
|
+
const r = I(e), n = Reflect.getOwnPropertyDescriptor(r, t);
|
|
380
|
+
return n && {
|
|
381
|
+
[J]: !0,
|
|
382
|
+
[Se]: e.type_ !== 1 || t !== "length",
|
|
383
|
+
[Z]: n[Z],
|
|
384
|
+
[B]: r[t]
|
|
385
|
+
};
|
|
386
|
+
},
|
|
387
|
+
defineProperty() {
|
|
388
|
+
g(11);
|
|
389
|
+
},
|
|
390
|
+
getPrototypeOf(e) {
|
|
391
|
+
return U(e.base_);
|
|
392
|
+
},
|
|
393
|
+
setPrototypeOf() {
|
|
394
|
+
g(12);
|
|
395
|
+
}
|
|
396
|
+
}, q = {};
|
|
397
|
+
for (let e in ne) {
|
|
398
|
+
let t = ne[e];
|
|
399
|
+
q[e] = function() {
|
|
400
|
+
const r = arguments;
|
|
401
|
+
return r[0] = r[0][0], t.apply(this, r);
|
|
402
|
+
};
|
|
403
|
+
}
|
|
404
|
+
q.deleteProperty = function(e, t) {
|
|
405
|
+
return process.env.NODE_ENV !== "production" && isNaN(parseInt(t)) && g(13), q.set.call(this, e, t, void 0);
|
|
28
406
|
};
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
407
|
+
q.set = function(e, t, r) {
|
|
408
|
+
return process.env.NODE_ENV !== "production" && t !== "length" && isNaN(parseInt(t)) && g(14), ne.set.call(this, e[0], t, r, e[0]);
|
|
409
|
+
};
|
|
410
|
+
function we(e, t) {
|
|
411
|
+
const r = e[m];
|
|
412
|
+
return (r ? I(r) : e)[t];
|
|
413
|
+
}
|
|
414
|
+
function Dt(e, t, r) {
|
|
415
|
+
var s;
|
|
416
|
+
const n = nt(t, r);
|
|
417
|
+
return n ? B in n ? n[B] : (
|
|
418
|
+
// This is a very special case, if the prop is a getter defined by the
|
|
419
|
+
// prototype, we should invoke it with the draft as context!
|
|
420
|
+
(s = n.get) == null ? void 0 : s.call(e.draft_)
|
|
421
|
+
) : void 0;
|
|
422
|
+
}
|
|
423
|
+
function nt(e, t) {
|
|
424
|
+
if (!(t in e))
|
|
425
|
+
return;
|
|
426
|
+
let r = U(e);
|
|
427
|
+
for (; r; ) {
|
|
428
|
+
const n = Object.getOwnPropertyDescriptor(r, t);
|
|
429
|
+
if (n)
|
|
430
|
+
return n;
|
|
431
|
+
r = U(r);
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
function Ce(e) {
|
|
435
|
+
e.modified_ || (e.modified_ = !0, e.parent_ && Ce(e.parent_));
|
|
436
|
+
}
|
|
437
|
+
function Y(e) {
|
|
438
|
+
e.copy_ || (e.assigned_ = /* @__PURE__ */ new Map(), e.copy_ = Ae(
|
|
439
|
+
e.base_,
|
|
440
|
+
e.scope_.immer_.useStrictShallowCopy_
|
|
441
|
+
));
|
|
442
|
+
}
|
|
443
|
+
var It = class {
|
|
444
|
+
constructor(e) {
|
|
445
|
+
this.autoFreeze_ = !0, this.useStrictShallowCopy_ = !1, this.useStrictIteration_ = !1, this.produce = (t, r, n) => {
|
|
446
|
+
if (v(t) && !v(r)) {
|
|
447
|
+
const i = r;
|
|
448
|
+
r = t;
|
|
449
|
+
const c = this;
|
|
450
|
+
return function(y = i, ...d) {
|
|
451
|
+
return c.produce(y, (h) => r.call(this, h, ...d));
|
|
452
|
+
};
|
|
453
|
+
}
|
|
454
|
+
v(r) || g(6), n !== void 0 && !v(n) && g(7);
|
|
455
|
+
let s;
|
|
456
|
+
if (C(t)) {
|
|
457
|
+
const i = qe(this), c = Me(i, t, void 0);
|
|
458
|
+
let u = !0;
|
|
459
|
+
try {
|
|
460
|
+
s = r(c), u = !1;
|
|
461
|
+
} finally {
|
|
462
|
+
u ? De(i) : Ie(i);
|
|
44
463
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
464
|
+
return We(i, n), Ge(s, i);
|
|
465
|
+
} else if (!t || !Ee(t)) {
|
|
466
|
+
if (s = r(t), s === void 0 && (s = t), s === Ye && (s = void 0), this.autoFreeze_ && Ne(s, !0), n) {
|
|
467
|
+
const i = [], c = [];
|
|
468
|
+
E(be).generateReplacementPatches_(t, s, {
|
|
469
|
+
patches_: i,
|
|
470
|
+
inversePatches_: c
|
|
471
|
+
}), n(i, c);
|
|
472
|
+
}
|
|
473
|
+
return s;
|
|
474
|
+
} else
|
|
475
|
+
g(1, t);
|
|
476
|
+
}, this.produceWithPatches = (t, r) => {
|
|
477
|
+
if (v(t))
|
|
478
|
+
return (c, ...u) => this.produceWithPatches(c, (y) => t(y, ...u));
|
|
479
|
+
let n, s;
|
|
480
|
+
return [this.produce(t, r, (c, u) => {
|
|
481
|
+
n = c, s = u;
|
|
482
|
+
}), n, s];
|
|
483
|
+
}, ge(e == null ? void 0 : e.autoFreeze) && this.setAutoFreeze(e.autoFreeze), ge(e == null ? void 0 : e.useStrictShallowCopy) && this.setUseStrictShallowCopy(e.useStrictShallowCopy), ge(e == null ? void 0 : e.useStrictIteration) && this.setUseStrictIteration(e.useStrictIteration);
|
|
484
|
+
}
|
|
485
|
+
createDraft(e) {
|
|
486
|
+
C(e) || g(8), M(e) && (e = Ct(e));
|
|
487
|
+
const t = qe(this), r = Me(t, e, void 0);
|
|
488
|
+
return r[m].isManual_ = !0, Ie(t), r;
|
|
489
|
+
}
|
|
490
|
+
finishDraft(e, t) {
|
|
491
|
+
const r = e && e[m];
|
|
492
|
+
(!r || !r.isManual_) && g(9);
|
|
493
|
+
const { scope_: n } = r;
|
|
494
|
+
return We(n, t), Ge(void 0, n);
|
|
495
|
+
}
|
|
496
|
+
/**
|
|
497
|
+
* Pass true to automatically freeze all copies created by Immer.
|
|
498
|
+
*
|
|
499
|
+
* By default, auto-freezing is enabled.
|
|
500
|
+
*/
|
|
501
|
+
setAutoFreeze(e) {
|
|
502
|
+
this.autoFreeze_ = e;
|
|
503
|
+
}
|
|
504
|
+
/**
|
|
505
|
+
* Pass true to enable strict shallow copy.
|
|
506
|
+
*
|
|
507
|
+
* By default, immer does not copy the object descriptors such as getter, setter and non-enumrable properties.
|
|
508
|
+
*/
|
|
509
|
+
setUseStrictShallowCopy(e) {
|
|
510
|
+
this.useStrictShallowCopy_ = e;
|
|
511
|
+
}
|
|
512
|
+
/**
|
|
513
|
+
* Pass false to use faster iteration that skips non-enumerable properties
|
|
514
|
+
* but still handles symbols for compatibility.
|
|
515
|
+
*
|
|
516
|
+
* By default, strict iteration is enabled (includes all own properties).
|
|
517
|
+
*/
|
|
518
|
+
setUseStrictIteration(e) {
|
|
519
|
+
this.useStrictIteration_ = e;
|
|
48
520
|
}
|
|
521
|
+
shouldUseStrictIteration() {
|
|
522
|
+
return this.useStrictIteration_;
|
|
523
|
+
}
|
|
524
|
+
applyPatches(e, t) {
|
|
525
|
+
let r;
|
|
526
|
+
for (r = t.length - 1; r >= 0; r--) {
|
|
527
|
+
const s = t[r];
|
|
528
|
+
if (s.path.length === 0 && s.op === "replace") {
|
|
529
|
+
e = s.value;
|
|
530
|
+
break;
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
r > -1 && (t = t.slice(r + 1));
|
|
534
|
+
const n = E(be).applyPatches_;
|
|
535
|
+
return M(e) ? n(e, t) : this.produce(
|
|
536
|
+
e,
|
|
537
|
+
(s) => n(s, t)
|
|
538
|
+
);
|
|
539
|
+
}
|
|
540
|
+
};
|
|
541
|
+
function Me(e, t, r, n) {
|
|
542
|
+
const [s, i] = ae(t) ? E(te).proxyMap_(t, r) : ue(t) ? E(te).proxySet_(t, r) : bt(t, r);
|
|
543
|
+
return ((r == null ? void 0 : r.scope_) ?? Ze()).drafts_.push(s), i.callbacks_ = (r == null ? void 0 : r.callbacks_) ?? [], i.key_ = n, r && n !== void 0 ? Pt(r, i, n) : i.callbacks_.push(function(y) {
|
|
544
|
+
var h;
|
|
545
|
+
(h = y.mapSetPlugin_) == null || h.fixSetContents(i);
|
|
546
|
+
const { patchPlugin_: d } = y;
|
|
547
|
+
i.modified_ && d && d.generatePatches_(i, [], y);
|
|
548
|
+
}), s;
|
|
49
549
|
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
550
|
+
function Ct(e) {
|
|
551
|
+
return M(e) || g(10, e), st(e);
|
|
552
|
+
}
|
|
553
|
+
function st(e) {
|
|
554
|
+
if (!C(e) || fe(e))
|
|
555
|
+
return e;
|
|
556
|
+
const t = e[m];
|
|
557
|
+
let r, n = !0;
|
|
558
|
+
if (t) {
|
|
559
|
+
if (!t.modified_)
|
|
560
|
+
return t.base_;
|
|
561
|
+
t.finalized_ = !0, r = Ae(e, t.scope_.immer_.useStrictShallowCopy_), n = t.scope_.immer_.shouldUseStrictIteration();
|
|
562
|
+
} else
|
|
563
|
+
r = Ae(e, !0);
|
|
564
|
+
return oe(
|
|
565
|
+
r,
|
|
566
|
+
(s, i) => {
|
|
567
|
+
ee(r, s, st(i));
|
|
568
|
+
},
|
|
569
|
+
n
|
|
570
|
+
), t && (t.finalized_ = !1), r;
|
|
571
|
+
}
|
|
572
|
+
var Mt = new It(), it = Mt.produce;
|
|
573
|
+
class zt extends F {
|
|
574
|
+
constructor(t, r) {
|
|
575
|
+
super(r), this.a = t, this.push = (...n) => {
|
|
576
|
+
n.length !== 0 && this.a.set(this.a.get().concat(n));
|
|
577
|
+
}, this.unshift = (...n) => {
|
|
578
|
+
n.length !== 0 && this.a.set(n.concat(this.a.get()));
|
|
579
|
+
}, this.update = (n) => {
|
|
580
|
+
const s = this.a.get(), i = it(s, (c) => void n(c));
|
|
581
|
+
i !== s && this.a.set(i);
|
|
582
|
+
}, this.filter = (n) => {
|
|
583
|
+
const s = this.a.get().filter(n ?? xt);
|
|
584
|
+
s.length !== this.a.get().length && this.a.set(s);
|
|
585
|
+
}, this.add = (n) => {
|
|
586
|
+
this.a.get().includes(n) || this.a.set(this.a.get().concat([n]));
|
|
587
|
+
}, this.removeFirst = (n) => {
|
|
588
|
+
const s = this.a.get().indexOf(n);
|
|
589
|
+
if (s < 0) return;
|
|
590
|
+
const i = this.a.get().slice(0);
|
|
591
|
+
i.splice(s, 1), this.a.set(i);
|
|
592
|
+
}, this.toggle = (n, s) => {
|
|
593
|
+
const i = this.a.get().slice(), c = i.indexOf(n);
|
|
594
|
+
c < 0 ? s ? i.unshift(n) : i.push(n) : i.splice(c, 1), this.a.set(i);
|
|
72
595
|
};
|
|
73
596
|
}
|
|
74
597
|
}
|
|
75
|
-
const
|
|
76
|
-
class
|
|
77
|
-
constructor(
|
|
78
|
-
super(
|
|
598
|
+
const xt = (e) => e;
|
|
599
|
+
class vt extends F {
|
|
600
|
+
constructor(t, r) {
|
|
601
|
+
super(r), this.a = t, this.toggle = () => {
|
|
79
602
|
this.a.set(!this.a.get());
|
|
80
603
|
};
|
|
81
604
|
}
|
|
82
605
|
}
|
|
83
|
-
class
|
|
84
|
-
constructor(
|
|
85
|
-
super(
|
|
86
|
-
if (this.a.get().get(
|
|
87
|
-
const
|
|
88
|
-
|
|
89
|
-
}, this.setIfNo = (
|
|
90
|
-
if (this.a.get().has(
|
|
91
|
-
const
|
|
92
|
-
|
|
93
|
-
}, this.delete = (
|
|
94
|
-
if (!this.a.get().has(
|
|
95
|
-
const
|
|
96
|
-
|
|
97
|
-
}, this.toggle = (
|
|
98
|
-
const
|
|
99
|
-
|
|
606
|
+
class Tt extends F {
|
|
607
|
+
constructor(t, r) {
|
|
608
|
+
super(r), this.a = t, this.setValue = (n, s) => {
|
|
609
|
+
if (this.a.get().get(n) === s) return;
|
|
610
|
+
const i = new Map(this.a.get());
|
|
611
|
+
i.set(n, s), this.a.set(i);
|
|
612
|
+
}, this.setIfNo = (n, s) => {
|
|
613
|
+
if (this.a.get().has(n)) return;
|
|
614
|
+
const i = new Map(this.a.get());
|
|
615
|
+
i.set(n, s), this.a.set(i);
|
|
616
|
+
}, this.delete = (n) => {
|
|
617
|
+
if (!this.a.get().has(n)) return;
|
|
618
|
+
const s = new Map(this.a.get());
|
|
619
|
+
s.delete(n), this.a.set(s);
|
|
620
|
+
}, this.toggle = (n, s) => {
|
|
621
|
+
const i = new Map(this.a.get());
|
|
622
|
+
i.has(n) ? i.delete(n) : i.set(n, s), this.a.set(i);
|
|
100
623
|
}, this.clear = () => {
|
|
101
624
|
this.a.set(/* @__PURE__ */ new Map());
|
|
102
|
-
}, this.a =
|
|
625
|
+
}, this.a = t;
|
|
103
626
|
}
|
|
104
627
|
}
|
|
105
|
-
class
|
|
106
|
-
constructor(
|
|
107
|
-
super(
|
|
108
|
-
this.a.set(+this.a.get() + (
|
|
628
|
+
class Et extends F {
|
|
629
|
+
constructor(t, r) {
|
|
630
|
+
super(r), this.a = t, this.increment = (n) => {
|
|
631
|
+
this.a.set(+this.a.get() + (n ?? 1));
|
|
109
632
|
};
|
|
110
633
|
}
|
|
111
634
|
}
|
|
112
|
-
class
|
|
113
|
-
constructor(
|
|
114
|
-
super(
|
|
115
|
-
...
|
|
116
|
-
...typeof
|
|
117
|
-
})), this.update = (
|
|
118
|
-
const
|
|
119
|
-
|
|
120
|
-
}, this.setDeepPartial = (s,
|
|
121
|
-
if (!
|
|
122
|
-
if (
|
|
123
|
-
let
|
|
124
|
-
const
|
|
125
|
-
|
|
126
|
-
const
|
|
127
|
-
let
|
|
128
|
-
for (const
|
|
129
|
-
|
|
130
|
-
const
|
|
131
|
-
if (
|
|
132
|
-
if (
|
|
133
|
-
const
|
|
134
|
-
this.a.get()[
|
|
635
|
+
class Ft extends F {
|
|
636
|
+
constructor(t, r) {
|
|
637
|
+
super(r), this.a = t, this.setPartial = (n) => this.a.set((s) => ({
|
|
638
|
+
...s,
|
|
639
|
+
...typeof n == "function" ? n(this.a.get()) : n
|
|
640
|
+
})), this.update = (n) => {
|
|
641
|
+
const s = this.a.get(), i = it(s, (c) => void n(c));
|
|
642
|
+
i !== s && this.a.set(i);
|
|
643
|
+
}, this.setDeepPartial = (n, s, i, c = T.keyPathSeparator || ".") => {
|
|
644
|
+
if (!c) return;
|
|
645
|
+
if (n.includes(c)) {
|
|
646
|
+
let d = n.split(c);
|
|
647
|
+
const h = d[d.length - 1];
|
|
648
|
+
d = d.slice(0, -1);
|
|
649
|
+
const O = { ...this.a.get() };
|
|
650
|
+
let _ = O, p = i;
|
|
651
|
+
for (const S of d) {
|
|
652
|
+
p = p == null ? void 0 : p[Array.isArray(p) ? "0" : S];
|
|
653
|
+
const z = _[Ke(_, S)] ?? (Array.isArray(p) ? [] : {});
|
|
654
|
+
if (z == null || typeof z != "object") {
|
|
655
|
+
if (i == null) throw "Incorrect path for setDeepPartial";
|
|
656
|
+
const A = typeof s == "function" ? s(void 0) : s;
|
|
657
|
+
this.a.get()[n] !== A && this.setPartial({ [n]: A });
|
|
135
658
|
return;
|
|
136
659
|
}
|
|
137
|
-
|
|
660
|
+
_ = _[Ke(_, S)] = Array.isArray(z) ? [...z] : { ...z };
|
|
138
661
|
}
|
|
139
|
-
const
|
|
140
|
-
|
|
662
|
+
const H = _[h];
|
|
663
|
+
_[h] = typeof s == "function" ? s(_[h]) : s, H !== _[h] && this.a.set(O);
|
|
141
664
|
return;
|
|
142
665
|
}
|
|
143
|
-
const
|
|
144
|
-
|
|
666
|
+
const u = this.a.get()[n], y = typeof s == "function" ? s(u) : s;
|
|
667
|
+
y !== u && this.setPartial({ [n]: y });
|
|
145
668
|
};
|
|
146
669
|
}
|
|
147
670
|
}
|
|
148
|
-
const
|
|
149
|
-
class
|
|
150
|
-
constructor(
|
|
151
|
-
super(
|
|
152
|
-
this.a.get().has(
|
|
153
|
-
}, this.delete = (
|
|
154
|
-
if (!this.a.get().has(
|
|
155
|
-
const
|
|
156
|
-
|
|
157
|
-
}, this.toggle = (
|
|
158
|
-
const
|
|
159
|
-
|
|
671
|
+
const Ke = (e, t) => Array.isArray(e) ? `${+t}` : t;
|
|
672
|
+
class Nt extends F {
|
|
673
|
+
constructor(t, r) {
|
|
674
|
+
super(r), this.a = t, this.add = (n) => {
|
|
675
|
+
this.a.get().has(n) || this.a.set(new Set(this.a.get()).add(n));
|
|
676
|
+
}, this.delete = (n) => {
|
|
677
|
+
if (!this.a.get().has(n)) return;
|
|
678
|
+
const s = new Set(this.a.get());
|
|
679
|
+
s.delete(n), this.a.set(s);
|
|
680
|
+
}, this.toggle = (n) => {
|
|
681
|
+
const s = new Set(this.a.get());
|
|
682
|
+
s.has(n) ? s.delete(n) : s.add(n), this.a.set(s);
|
|
160
683
|
}, this.clear = () => {
|
|
161
684
|
this.a.set(/* @__PURE__ */ new Set());
|
|
162
|
-
}, this.a =
|
|
685
|
+
}, this.a = t;
|
|
163
686
|
}
|
|
164
687
|
}
|
|
165
|
-
const
|
|
166
|
-
const
|
|
167
|
-
(
|
|
168
|
-
() =>
|
|
169
|
-
|
|
170
|
-
(
|
|
171
|
-
) : null,
|
|
172
|
-
return
|
|
688
|
+
const $t = (e, t, r) => {
|
|
689
|
+
const n = typeof r == "object" && r != null && "do" in r ? r.do(
|
|
690
|
+
(i, c) => t.set(i, c),
|
|
691
|
+
() => t.get(),
|
|
692
|
+
t,
|
|
693
|
+
(i, c, u) => t.setDeferred(i, c, u)
|
|
694
|
+
) : null, s = {};
|
|
695
|
+
return n && Object.keys(n).forEach((i) => Object.defineProperty(s, i, { get: () => n[i] })), typeof e == "number" ? new Et(t, n) : typeof e == "boolean" ? new vt(t, n) : Array.isArray(e) ? new zt(t, n) : e instanceof Set ? new Nt(t, n) : e instanceof Map ? new Tt(t, n) : e instanceof Object ? new Ft(t, n) : new F(n);
|
|
173
696
|
};
|
|
174
|
-
class
|
|
175
|
-
constructor(
|
|
176
|
-
|
|
177
|
-
const
|
|
178
|
-
let
|
|
179
|
-
},
|
|
180
|
-
const
|
|
181
|
-
return
|
|
697
|
+
class Rt {
|
|
698
|
+
constructor(t, r) {
|
|
699
|
+
t = typeof t == "function" ? t() : t;
|
|
700
|
+
const n = (o) => d = o, s = () => d, i = /* @__PURE__ */ new Set(), c = (o) => o(_());
|
|
701
|
+
let u = !0, y = !1, d = t, h, O = () => {
|
|
702
|
+
}, _ = () => s(), p = null, H = () => {
|
|
703
|
+
const o = $t(t, S, r);
|
|
704
|
+
return H = () => o, o;
|
|
182
705
|
};
|
|
183
|
-
const
|
|
184
|
-
get: (
|
|
185
|
-
set:
|
|
186
|
-
}),
|
|
187
|
-
|
|
706
|
+
const S = new Proxy(this, {
|
|
707
|
+
get: (o, l) => l === "do" ? H() : o[l],
|
|
708
|
+
set: kt
|
|
709
|
+
}), z = () => {
|
|
710
|
+
u = !0, y !== !0 && O(_()), y = !1;
|
|
188
711
|
try {
|
|
189
|
-
|
|
712
|
+
ze.postMessage({ key: f, value: s() });
|
|
190
713
|
} catch {
|
|
191
714
|
}
|
|
192
|
-
},
|
|
193
|
-
const
|
|
194
|
-
|
|
715
|
+
}, A = (o, l) => {
|
|
716
|
+
const b = typeof o == "function" ? o(_()) : o;
|
|
717
|
+
b !== _() && (n(b), y = l, u && (u = !1, i.forEach(c), queueMicrotask(z)));
|
|
195
718
|
};
|
|
196
|
-
this.set = (
|
|
197
|
-
|
|
719
|
+
this.set = (o, l) => A(o, l), this.get = () => _(), this.initialValue = t, this.isInitialValue = () => t === s(), this.subscribe = (o) => (i.add(o), () => {
|
|
720
|
+
i.delete(o);
|
|
198
721
|
}), this.reset = () => {
|
|
199
|
-
|
|
722
|
+
A(t, !0);
|
|
200
723
|
};
|
|
201
|
-
const
|
|
202
|
-
|
|
724
|
+
const ut = (o, l) => {
|
|
725
|
+
A(o, l), h = void 0;
|
|
203
726
|
};
|
|
204
|
-
if (this.setDeferred = (
|
|
205
|
-
|
|
206
|
-
},
|
|
207
|
-
let
|
|
208
|
-
if (
|
|
209
|
-
throw console.error(
|
|
210
|
-
} :
|
|
211
|
-
if (
|
|
212
|
-
const
|
|
213
|
-
return
|
|
727
|
+
if (this.setDeferred = (o, l = 500, b, D = !0) => {
|
|
728
|
+
D && h === void 0 && A(o, b), clearTimeout(h), h = setTimeout(ut, l, o, b);
|
|
729
|
+
}, r == null) return S;
|
|
730
|
+
let P = null, j = null, he = !0, _e = !0, ye = !1, x = 0, N = 0, $e = -1, $ = t instanceof Set ? (o) => new Set(o) : t instanceof Map ? (o) => new Map(o) : (o) => o, R = t instanceof Set ? (o) => {
|
|
731
|
+
if (o instanceof Set) return Array.from(o);
|
|
732
|
+
throw console.error(o), "The value is not Set instance";
|
|
733
|
+
} : t instanceof Map ? (o) => {
|
|
734
|
+
if (o instanceof Map) {
|
|
735
|
+
const l = [];
|
|
736
|
+
return o.forEach((b, D) => l.push([D, b])), l;
|
|
214
737
|
}
|
|
215
|
-
throw console.error(
|
|
216
|
-
} : (
|
|
217
|
-
if (typeof
|
|
218
|
-
|
|
219
|
-
else if ("storeKey" in
|
|
220
|
-
|
|
221
|
-
else return
|
|
222
|
-
const
|
|
223
|
-
if (
|
|
224
|
-
const
|
|
225
|
-
|
|
738
|
+
throw console.error(o), "The value is not Set instance";
|
|
739
|
+
} : (o) => o;
|
|
740
|
+
if (typeof r == "string")
|
|
741
|
+
P = r;
|
|
742
|
+
else if ("storeKey" in r)
|
|
743
|
+
he = r.warnOnDuplicateStoreKey ?? he, _e = r.listenStorageChanges ?? _e, P = r.storeKey, $ = r.unzipValue ?? $, R = r.zipValue ?? R, ye = r.unchangable ?? ye, x = r.securifyKeyLevel ?? T.securifyKeyLevel ?? x, N = r.securifyValueLevel ?? T.securifyValueLevel ?? N, j = r.exp ?? j;
|
|
744
|
+
else return S;
|
|
745
|
+
const pe = x ? k(P, x) : P, f = `${N ? xe : L}${pe}`;
|
|
746
|
+
if (x) {
|
|
747
|
+
const o = `${L}${P}`;
|
|
748
|
+
o in a && (a[f] = a[o], delete a[o]);
|
|
226
749
|
} else {
|
|
227
|
-
const
|
|
228
|
-
|
|
750
|
+
const o = `${L}${k(P, x)}`;
|
|
751
|
+
o in a && (a[f] = a[o], delete a[o]);
|
|
229
752
|
}
|
|
230
|
-
const
|
|
231
|
-
if (
|
|
232
|
-
const
|
|
233
|
-
if (
|
|
753
|
+
const me = j === null || !(j(S, f in a) instanceof Date) ? (o) => k([R(o)], 0) : (o) => (p ?? (p = {}), p.exp = j(S, f in a).getTime(), p.exp - Date.now() < 24 * 60 * 60 * 1e3 && (clearTimeout($e), clearTimeout(ot[f]), $e = setTimeout(() => this.reset(), p.exp - Date.now())), p.exp = Math.trunc(p.exp / 1e3), k([R(o), p], 0));
|
|
754
|
+
if (N) {
|
|
755
|
+
const o = `${L}${pe}`, l = R, b = $;
|
|
756
|
+
if (R = (D) => {
|
|
234
757
|
try {
|
|
235
|
-
return
|
|
758
|
+
return k([l(D)], N);
|
|
236
759
|
} catch {
|
|
237
|
-
return delete
|
|
760
|
+
return delete a[f], "";
|
|
238
761
|
}
|
|
239
|
-
},
|
|
240
|
-
const
|
|
762
|
+
}, o in a) {
|
|
763
|
+
const D = `${L}${k(P, x)}`;
|
|
241
764
|
try {
|
|
242
|
-
|
|
765
|
+
a[D] = me($(Q(a[o], 0)[0])), delete a[o];
|
|
243
766
|
} catch {
|
|
244
767
|
}
|
|
245
768
|
}
|
|
246
|
-
|
|
769
|
+
$ = (D) => {
|
|
247
770
|
try {
|
|
248
|
-
return
|
|
771
|
+
return b(Q(D, N)[0]);
|
|
249
772
|
} catch {
|
|
250
|
-
return delete
|
|
773
|
+
return delete a[f], "";
|
|
251
774
|
}
|
|
252
775
|
};
|
|
253
|
-
} else delete
|
|
254
|
-
const
|
|
255
|
-
const
|
|
256
|
-
return
|
|
776
|
+
} else delete a[`${xe}${pe}`];
|
|
777
|
+
const Re = (o) => {
|
|
778
|
+
const l = Q(o, 0);
|
|
779
|
+
return p = l[1], $(l[0]);
|
|
257
780
|
};
|
|
258
|
-
let
|
|
259
|
-
if (
|
|
260
|
-
if (
|
|
261
|
-
|
|
781
|
+
let ke = !0;
|
|
782
|
+
if (ve[f] = S, a[`atom/${P}`] && (a[f] || (a[f] = `[${a[`atom/${P}`]}]`), delete a[`atom/${P}`]), _ = () => {
|
|
783
|
+
if (_ = s, ke) {
|
|
784
|
+
ke = !1;
|
|
262
785
|
try {
|
|
263
|
-
|
|
786
|
+
n(f in a ? Re(a[f]) : t);
|
|
264
787
|
} catch {
|
|
265
|
-
console.warn("Invalid json value",
|
|
788
|
+
console.warn("Invalid json value", a[f]);
|
|
266
789
|
}
|
|
267
790
|
}
|
|
268
|
-
return
|
|
269
|
-
},
|
|
270
|
-
if (
|
|
791
|
+
return s();
|
|
792
|
+
}, O = (o) => {
|
|
793
|
+
if (o === t) {
|
|
271
794
|
this.reset();
|
|
272
795
|
return;
|
|
273
796
|
}
|
|
274
|
-
|
|
797
|
+
a[f] = me(o);
|
|
275
798
|
}, this.reset = () => {
|
|
276
|
-
delete
|
|
277
|
-
},
|
|
278
|
-
if (
|
|
279
|
-
let
|
|
280
|
-
|
|
281
|
-
clearTimeout(
|
|
799
|
+
delete a[f], A(t, !0);
|
|
800
|
+
}, he && V[f] !== void 0 && console.warn("Duplicate Atom key", P), _e)
|
|
801
|
+
if (ye) {
|
|
802
|
+
let o = !1, l;
|
|
803
|
+
de[f] = this, V[f] = () => {
|
|
804
|
+
clearTimeout(l), l = setTimeout(() => o = !1, 10), !o && (o = !0, a[f] = me(s()));
|
|
282
805
|
};
|
|
283
806
|
} else
|
|
284
|
-
|
|
285
|
-
if (
|
|
807
|
+
V[f] = (o) => {
|
|
808
|
+
if (o.newValue === null) {
|
|
286
809
|
this.reset();
|
|
287
810
|
return;
|
|
288
811
|
}
|
|
289
812
|
try {
|
|
290
|
-
|
|
813
|
+
A(Re(o.newValue));
|
|
291
814
|
} catch {
|
|
292
|
-
console.warn("Invalid json value",
|
|
815
|
+
console.warn("Invalid json value", o.newValue);
|
|
293
816
|
}
|
|
294
817
|
};
|
|
295
|
-
return
|
|
818
|
+
return S;
|
|
296
819
|
}
|
|
297
820
|
}
|
|
298
|
-
let
|
|
821
|
+
let ze;
|
|
299
822
|
try {
|
|
300
|
-
|
|
301
|
-
var
|
|
302
|
-
(
|
|
823
|
+
ze = new BroadcastChannel("updateHere"), ze.addEventListener("message", (e) => {
|
|
824
|
+
var t;
|
|
825
|
+
(t = de[e.data.key]) == null || t.set(e.data.value, !0);
|
|
303
826
|
});
|
|
304
827
|
} catch {
|
|
305
828
|
}
|
|
306
|
-
const
|
|
307
|
-
throw `${
|
|
829
|
+
const a = localStorage, V = {}, de = {}, kt = (e, t) => {
|
|
830
|
+
throw `${t} is readonly property`;
|
|
308
831
|
};
|
|
309
|
-
window.addEventListener("storage", (
|
|
310
|
-
var
|
|
311
|
-
|
|
832
|
+
window.addEventListener("storage", (e) => {
|
|
833
|
+
var t;
|
|
834
|
+
e.key === null || e.newValue === e.oldValue || (t = V[e.key]) == null || t.call(V, e);
|
|
312
835
|
});
|
|
313
|
-
const
|
|
314
|
-
|
|
315
|
-
|
|
836
|
+
const Lt = a.setItem.bind(a), Vt = a.removeItem.bind(a);
|
|
837
|
+
a.setItem = (e, t) => {
|
|
838
|
+
de[e] === void 0 && Lt.call(a, e, t);
|
|
316
839
|
};
|
|
317
|
-
|
|
318
|
-
|
|
840
|
+
a.removeItem = (e) => {
|
|
841
|
+
de[e] === void 0 && Vt.call(a, e);
|
|
319
842
|
};
|
|
320
|
-
const
|
|
321
|
-
for (let
|
|
322
|
-
if (
|
|
323
|
-
const
|
|
324
|
-
|
|
325
|
-
}
|
|
326
|
-
const
|
|
327
|
-
const
|
|
328
|
-
(
|
|
329
|
-
(
|
|
330
|
-
(
|
|
331
|
-
const
|
|
332
|
-
return `${
|
|
843
|
+
const Ut = /"exp":\s*(\d+)/, L = "atom\\", xe = "atom`s\\", ve = {}, ot = {}, ct = /[a-z]/gi, se = 5, Te = {};
|
|
844
|
+
for (let e = 54; e < 80; e++) {
|
|
845
|
+
if (e === 68 || e === 72 || e === 55) continue;
|
|
846
|
+
const t = String.fromCharCode(e + 43).toUpperCase(), r = String.fromCharCode(e + 43).toLowerCase();
|
|
847
|
+
Te[t] = r, Te[r] = t;
|
|
848
|
+
}
|
|
849
|
+
const at = (e) => Te[e] ?? e, k = /* @__PURE__ */ (() => {
|
|
850
|
+
const e = [
|
|
851
|
+
(t) => JSON.stringify(t),
|
|
852
|
+
(t) => btoa(encodeURI(e[0](t))),
|
|
853
|
+
(t) => {
|
|
854
|
+
const r = e[1](t);
|
|
855
|
+
return `${r.slice(0, se)}${r.slice(se).replace(ct, at)}`;
|
|
333
856
|
},
|
|
334
|
-
(
|
|
857
|
+
(t) => btoa(e[2](t))
|
|
335
858
|
];
|
|
336
|
-
return (
|
|
859
|
+
return (t, r) => {
|
|
337
860
|
try {
|
|
338
|
-
return
|
|
339
|
-
} catch (
|
|
340
|
-
if (
|
|
341
|
-
return
|
|
861
|
+
return e[r](t);
|
|
862
|
+
} catch (n) {
|
|
863
|
+
if (r === 0) throw n;
|
|
864
|
+
return e[0](t);
|
|
342
865
|
}
|
|
343
866
|
};
|
|
344
|
-
})(),
|
|
345
|
-
const
|
|
346
|
-
(
|
|
347
|
-
(
|
|
348
|
-
(
|
|
349
|
-
`${
|
|
867
|
+
})(), Q = /* @__PURE__ */ (() => {
|
|
868
|
+
const e = [
|
|
869
|
+
(t) => JSON.parse(t),
|
|
870
|
+
(t) => e[0](decodeURI(atob(t))),
|
|
871
|
+
(t) => e[1](
|
|
872
|
+
`${t.slice(0, se)}${t.slice(se).replace(ct, at)}`
|
|
350
873
|
),
|
|
351
|
-
(
|
|
874
|
+
(t) => e[2](atob(t))
|
|
352
875
|
];
|
|
353
|
-
return (
|
|
876
|
+
return (t, r) => {
|
|
354
877
|
try {
|
|
355
|
-
return
|
|
356
|
-
} catch (
|
|
357
|
-
if (
|
|
358
|
-
return
|
|
878
|
+
return e[r](t);
|
|
879
|
+
} catch (n) {
|
|
880
|
+
if (r === 0) throw n;
|
|
881
|
+
return e[0](t);
|
|
359
882
|
}
|
|
360
883
|
};
|
|
361
884
|
})();
|
|
362
885
|
setTimeout(() => {
|
|
363
|
-
Object.keys(
|
|
364
|
-
var
|
|
365
|
-
if (typeof
|
|
366
|
-
const
|
|
367
|
-
if (!
|
|
368
|
-
const
|
|
369
|
-
!Array.isArray(
|
|
370
|
-
|
|
371
|
-
}, +
|
|
886
|
+
Object.keys(a).forEach((e) => {
|
|
887
|
+
var n;
|
|
888
|
+
if (typeof a[e] != "string" || !e.startsWith(L) && !e.startsWith(xe)) return;
|
|
889
|
+
const t = (n = a[e].match(Ut)) == null ? void 0 : n[1];
|
|
890
|
+
if (!t || +t * 1e3 - Date.now() > 24 * 60 * 60 * 1e3) return;
|
|
891
|
+
const r = Q(a[e], 0);
|
|
892
|
+
!Array.isArray(r) || r[1] == null || !("exp" in r[1]) || r[1].exp !== t || (ot[e] = setTimeout(() => {
|
|
893
|
+
ve[e] ? ve[e].reset() : delete a[e];
|
|
894
|
+
}, +t * 1e3 - Date.now()));
|
|
372
895
|
});
|
|
373
896
|
}, 1e3);
|
|
374
897
|
export {
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
898
|
+
Rt as Atom,
|
|
899
|
+
zt as AtomArrayDoActions,
|
|
900
|
+
vt as AtomBooleanDoActions,
|
|
901
|
+
Tt as AtomMapDoActions,
|
|
902
|
+
Et as AtomNumberDoActions,
|
|
903
|
+
Ft as AtomObjectDoActions,
|
|
904
|
+
Nt as AtomSetDoActions,
|
|
905
|
+
Gt as atom,
|
|
906
|
+
Ot as configureAtomaric,
|
|
907
|
+
T as configuredOptions,
|
|
908
|
+
qt as useAtom,
|
|
909
|
+
Wt as useAtomDo,
|
|
910
|
+
Bt as useAtomGet,
|
|
911
|
+
lt as useAtomSet,
|
|
912
|
+
jt as useAtomSetDeferred,
|
|
913
|
+
ft as useAtomValue
|
|
391
914
|
};
|