atomaric 0.0.82 → 0.0.87

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