use-abcd 1.6.3 → 1.6.6

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/index.js CHANGED
@@ -1,15 +1,15 @@
1
1
  import { useMemo as le, useSyncExternalStore as v, useCallback as g } from "react";
2
- import { b as oe, c as G, d as bt, e as fe, f as Je, h as he, j as Ye, S as ze, i as W, k as Ge, l as mt, n as Xe, o as St, p as V, q as gt, r as wt, s as vt, t as Ct, u as Mt, v as Ze, w as xt, x as ke, y as Ot, z as Pt, A as Rt, B as de, C as Et, D as It, E as Nt, F as zt, a as z, m as K, g as be } from "./chunks/utils-C2wXstxP.js";
2
+ import { b as oe, c as G, d as mt, e as fe, f as Je, h as he, j as Ye, S as Ne, i as W, k as Ge, l as St, n as Xe, o as gt, p as V, q as wt, r as vt, s as Ct, t as Mt, u as xt, v as Ze, w as Ot, x as ke, y as Pt, z as Rt, A as Et, B as de, C as It, D as Nt, E as zt, F as At, a as z, m as K, g as ze } from "./chunks/utils-C2wXstxP.js";
3
3
  import { H as Ts, G as qs } from "./chunks/utils-C2wXstxP.js";
4
4
  import { c as $s } from "./chunks/client-lHRDCo64.js";
5
5
  const b = {
6
6
  Remove: "remove",
7
7
  Replace: "replace",
8
8
  Add: "add"
9
- }, et = Symbol.for("__MUTATIVE_PROXY_DRAFT__"), At = Symbol("__MUTATIVE_RAW_RETURN_SYMBOL__"), ee = Symbol.iterator, O = {
9
+ }, et = Symbol.for("__MUTATIVE_PROXY_DRAFT__"), Ft = Symbol("__MUTATIVE_RAW_RETURN_SYMBOL__"), ee = Symbol.iterator, O = {
10
10
  mutable: "mutable",
11
11
  immutable: "immutable"
12
- }, xe = {};
12
+ }, Me = {};
13
13
  function Y(e, t) {
14
14
  return e instanceof Map ? e.has(t) : Object.prototype.hasOwnProperty.call(e, t);
15
15
  }
@@ -24,10 +24,10 @@ function Ae(e, t) {
24
24
  }
25
25
  }
26
26
  }
27
- function Oe(e) {
27
+ function xe(e) {
28
28
  return Object.getPrototypeOf(e) === Set.prototype;
29
29
  }
30
- function Pe(e) {
30
+ function Oe(e) {
31
31
  return Object.getPrototypeOf(e) === Map.prototype;
32
32
  }
33
33
  function x(e) {
@@ -40,7 +40,7 @@ function T(e) {
40
40
  function h(e) {
41
41
  return typeof e != "object" ? null : e?.[et];
42
42
  }
43
- function Re(e) {
43
+ function Pe(e) {
44
44
  var t;
45
45
  const n = h(e);
46
46
  return n ? (t = n.copy) !== null && t !== void 0 ? t : n.original : e;
@@ -65,20 +65,20 @@ function tt(e, t = []) {
65
65
  return tt(e.parent, t);
66
66
  t.reverse();
67
67
  try {
68
- Ft(e.copy, t);
68
+ jt(e.copy, t);
69
69
  } catch {
70
70
  return null;
71
71
  }
72
72
  return t;
73
73
  }
74
- function Q(e) {
74
+ function $(e) {
75
75
  return Array.isArray(e) ? 1 : e instanceof Map ? 2 : e instanceof Set ? 3 : 0;
76
76
  }
77
77
  function F(e, t) {
78
- return Q(e) === 2 ? e.get(t) : e[t];
78
+ return $(e) === 2 ? e.get(t) : e[t];
79
79
  }
80
80
  function Z(e, t, n) {
81
- Q(e) === 2 ? e.set(t, n) : e[t] = n;
81
+ $(e) === 2 ? e.set(t, n) : e[t] = n;
82
82
  }
83
83
  function pe(e, t) {
84
84
  const n = h(e);
@@ -87,7 +87,7 @@ function pe(e, t) {
87
87
  function A(e, t) {
88
88
  return e === t ? e !== 0 || 1 / e === 1 / t : e !== e && t !== t;
89
89
  }
90
- function me(e) {
90
+ function be(e) {
91
91
  if (e)
92
92
  for (; e.finalities.revoke.length > 0; )
93
93
  e.finalities.revoke.pop()();
@@ -98,15 +98,15 @@ function q(e, t) {
98
98
  return s.indexOf("/") === -1 && s.indexOf("~") === -1 ? s : s.replace(/~/g, "~0").replace(/\//g, "~1");
99
99
  }).join("/");
100
100
  }
101
- function Ft(e, t) {
101
+ function jt(e, t) {
102
102
  for (let n = 0; n < t.length - 1; n += 1) {
103
103
  const s = t[n];
104
- if (e = F(Q(e) === 3 ? Array.from(e) : e, s), typeof e != "object")
104
+ if (e = F($(e) === 3 ? Array.from(e) : e, s), typeof e != "object")
105
105
  throw new Error(`Cannot resolve patch at '${t.join("/")}'.`);
106
106
  }
107
107
  return e;
108
108
  }
109
- function jt(e) {
109
+ function Dt(e) {
110
110
  const t = Object.create(Object.getPrototypeOf(e));
111
111
  return Reflect.ownKeys(e).forEach((n) => {
112
112
  let s = Reflect.getOwnPropertyDescriptor(e, n);
@@ -122,26 +122,26 @@ function jt(e) {
122
122
  }), Reflect.defineProperty(t, n, s);
123
123
  }), t;
124
124
  }
125
- const Dt = Object.prototype.propertyIsEnumerable;
125
+ const Tt = Object.prototype.propertyIsEnumerable;
126
126
  function nt(e, t) {
127
127
  let n;
128
128
  if (Array.isArray(e))
129
129
  return Array.prototype.concat.call(e);
130
130
  if (e instanceof Set) {
131
- if (!Oe(e)) {
131
+ if (!xe(e)) {
132
132
  const s = Object.getPrototypeOf(e).constructor;
133
133
  return new s(e.values());
134
134
  }
135
135
  return Set.prototype.difference ? Set.prototype.difference.call(e, /* @__PURE__ */ new Set()) : new Set(e.values());
136
136
  } else if (e instanceof Map) {
137
- if (!Pe(e)) {
137
+ if (!Oe(e)) {
138
138
  const s = Object.getPrototypeOf(e).constructor;
139
139
  return new s(e);
140
140
  }
141
141
  return new Map(e);
142
142
  } else if (t?.mark && (n = t.mark(e, O), n !== void 0) && n !== O.mutable) {
143
143
  if (n === O.immutable)
144
- return jt(e);
144
+ return Dt(e);
145
145
  if (typeof n == "function") {
146
146
  if (t.enablePatches || t.enableAutoFreeze)
147
147
  throw new Error("You can't use mark and patches or auto freeze together.");
@@ -153,7 +153,7 @@ function nt(e, t) {
153
153
  return Object.keys(e).forEach((i) => {
154
154
  s[i] = e[i];
155
155
  }), Object.getOwnPropertySymbols(e).forEach((i) => {
156
- Dt.call(e, i) && (s[i] = e[i]);
156
+ Tt.call(e, i) && (s[i] = e[i]);
157
157
  }), s;
158
158
  } else
159
159
  throw new Error("Please check mark() to ensure that it is a stable marker draftable function.");
@@ -163,7 +163,7 @@ function w(e) {
163
163
  }
164
164
  function J(e) {
165
165
  if (!R(e))
166
- return Re(e);
166
+ return Pe(e);
167
167
  if (Array.isArray(e))
168
168
  return e.map(J);
169
169
  if (e instanceof Map) {
@@ -171,7 +171,7 @@ function J(e) {
171
171
  s,
172
172
  J(i)
173
173
  ]);
174
- if (!Pe(e)) {
174
+ if (!Oe(e)) {
175
175
  const s = Object.getPrototypeOf(e).constructor;
176
176
  return new s(n);
177
177
  }
@@ -179,7 +179,7 @@ function J(e) {
179
179
  }
180
180
  if (e instanceof Set) {
181
181
  const n = Array.from(e).map(J);
182
- if (!Oe(e)) {
182
+ if (!xe(e)) {
183
183
  const s = Object.getPrototypeOf(e).constructor;
184
184
  return new s(n);
185
185
  }
@@ -200,7 +200,7 @@ function E(e) {
200
200
  function Fe() {
201
201
  throw new Error("Cannot modify frozen object");
202
202
  }
203
- function B(e, t, n, s, i) {
203
+ function U(e, t, n, s, i) {
204
204
  {
205
205
  n = n ?? /* @__PURE__ */ new WeakMap(), s = s ?? [], i = i ?? [];
206
206
  const o = n.has(e) ? n.get(e) : e;
@@ -221,33 +221,33 @@ function B(e, t, n, s, i) {
221
221
  s.pop(), i.pop();
222
222
  return;
223
223
  }
224
- switch (Q(e)) {
224
+ switch ($(e)) {
225
225
  case 2:
226
226
  for (const [c, a] of e)
227
- B(c, c, n, s, i), B(a, c, n, s, i);
227
+ U(c, c, n, s, i), U(a, c, n, s, i);
228
228
  e.set = e.clear = e.delete = Fe;
229
229
  break;
230
230
  case 3:
231
231
  for (const c of e)
232
- B(c, c, n, s, i);
232
+ U(c, c, n, s, i);
233
233
  e.add = e.clear = e.delete = Fe;
234
234
  break;
235
235
  case 1:
236
236
  Object.freeze(e);
237
237
  let o = 0;
238
238
  for (const c of e)
239
- B(c, o, n, s, i), o += 1;
239
+ U(c, o, n, s, i), o += 1;
240
240
  break;
241
241
  default:
242
242
  Object.freeze(e), Object.keys(e).forEach((c) => {
243
243
  const a = e[c];
244
- B(a, c, n, s, i);
244
+ U(a, c, n, s, i);
245
245
  });
246
246
  }
247
247
  s.pop(), i.pop();
248
248
  }
249
- function Ee(e, t) {
250
- const n = Q(e);
249
+ function Re(e, t) {
250
+ const n = $(e);
251
251
  if (n === 0)
252
252
  Reflect.ownKeys(e).forEach((s) => {
253
253
  t(s, e[s], e);
@@ -263,7 +263,7 @@ function st(e, t, n) {
263
263
  if (T(e) || !R(e, n) || t.has(e) || Object.isFrozen(e))
264
264
  return;
265
265
  const s = e instanceof Set, i = s ? /* @__PURE__ */ new Map() : void 0;
266
- if (t.add(e), Ee(e, (r, o) => {
266
+ if (t.add(e), Re(e, (r, o) => {
267
267
  var c;
268
268
  if (T(o)) {
269
269
  const a = h(o);
@@ -279,16 +279,16 @@ function st(e, t, n) {
279
279
  });
280
280
  }
281
281
  }
282
- function Tt(e, t) {
282
+ function qt(e, t) {
283
283
  const n = e.type === 3 ? e.setMap : e.copy;
284
284
  e.finalities.revoke.length > 1 && e.assignedMap.get(t) && n && st(F(n, t), e.finalities.handledSet, e.options);
285
285
  }
286
- function Se(e) {
286
+ function me(e) {
287
287
  e.type === 3 && e.copy && (e.copy.clear(), e.setMap.forEach((t) => {
288
- e.copy.add(Re(t));
288
+ e.copy.add(Pe(t));
289
289
  }));
290
290
  }
291
- function ge(e, t, n, s) {
291
+ function Se(e, t, n, s) {
292
292
  if (e.operated && e.assignedMap && e.assignedMap.size > 0 && !e.finalized) {
293
293
  if (n && s) {
294
294
  const r = tt(e);
@@ -297,21 +297,21 @@ function ge(e, t, n, s) {
297
297
  e.finalized = !0;
298
298
  }
299
299
  }
300
- function Ie(e, t, n, s) {
300
+ function Ee(e, t, n, s) {
301
301
  const i = h(n);
302
302
  i && (i.callbacks || (i.callbacks = []), i.callbacks.push((r, o) => {
303
303
  var c;
304
304
  const a = e.type === 3 ? e.setMap : e.copy;
305
305
  if (A(F(a, t), n)) {
306
306
  let u = i.original;
307
- i.copy && (u = i.copy), Se(e), ge(e, s, r, o), e.options.enableAutoFreeze && (e.options.updatedValues = (c = e.options.updatedValues) !== null && c !== void 0 ? c : /* @__PURE__ */ new WeakMap(), e.options.updatedValues.set(u, i.original)), Z(a, t, u);
307
+ i.copy && (u = i.copy), me(e), Se(e, s, r, o), e.options.enableAutoFreeze && (e.options.updatedValues = (c = e.options.updatedValues) !== null && c !== void 0 ? c : /* @__PURE__ */ new WeakMap(), e.options.updatedValues.set(u, i.original)), Z(a, t, u);
308
308
  }
309
309
  }), e.options.enableAutoFreeze && i.finalities !== e.finalities && (e.options.enableAutoFreeze = !1)), R(n, e.options) && e.finalities.draft.push(() => {
310
310
  const r = e.type === 3 ? e.setMap : e.copy;
311
- A(F(r, t), n) && Tt(e, t);
311
+ A(F(r, t), n) && qt(e, t);
312
312
  });
313
313
  }
314
- function qt(e, t, n, s, i) {
314
+ function Qt(e, t, n, s, i) {
315
315
  let { original: r, assignedMap: o, options: c } = e, a = e.copy;
316
316
  a.length < r.length && ([r, a] = [a, r], [n, s] = [s, n]);
317
317
  for (let u = 0; u < r.length; u += 1)
@@ -357,7 +357,7 @@ function qt(e, t, n, s, i) {
357
357
  }
358
358
  }
359
359
  }
360
- function Qt({ original: e, copy: t, assignedMap: n }, s, i, r, o) {
360
+ function $t({ original: e, copy: t, assignedMap: n }, s, i, r, o) {
361
361
  n.forEach((c, a) => {
362
362
  const u = F(e, a), l = te(F(t, a)), f = c ? Y(e, a) ? b.Replace : b.Add : b.Remove;
363
363
  if (A(u, l) && f === b.Replace)
@@ -366,7 +366,7 @@ function Qt({ original: e, copy: t, assignedMap: n }, s, i, r, o) {
366
366
  i.push(f === b.Remove ? { op: f, path: p } : { op: f, path: p, value: l }), r.push(f === b.Add ? { op: b.Remove, path: p } : f === b.Remove ? { op: b.Add, path: p, value: u } : { op: b.Replace, path: p, value: u });
367
367
  });
368
368
  }
369
- function $t({ original: e, copy: t }, n, s, i, r) {
369
+ function Ht({ original: e, copy: t }, n, s, i, r) {
370
370
  let o = 0;
371
371
  e.forEach((c) => {
372
372
  if (!t.has(c)) {
@@ -403,17 +403,17 @@ function X(e, t, n, s) {
403
403
  switch (e.type) {
404
404
  case 0:
405
405
  case 2:
406
- return Qt(e, t, n, s, i);
406
+ return $t(e, t, n, s, i);
407
407
  case 1:
408
- return qt(e, t, n, s, i);
408
+ return Qt(e, t, n, s, i);
409
409
  case 3:
410
- return $t(e, t, n, s, i);
410
+ return Ht(e, t, n, s, i);
411
411
  }
412
412
  }
413
413
  const ce = (e, t, n = !1) => {
414
414
  if (typeof e == "object" && e !== null && (!R(e, t) || n))
415
415
  throw new Error("Strict mode: Mutable data cannot be accessed directly, please use 'unsafe(callback)' wrap.");
416
- }, we = {
416
+ }, ge = {
417
417
  get size() {
418
418
  return x(h(this)).size;
419
419
  },
@@ -422,7 +422,7 @@ const ce = (e, t, n = !1) => {
422
422
  },
423
423
  set(e, t) {
424
424
  const n = h(this), s = x(n);
425
- return (!s.has(e) || !A(s.get(e), t)) && (w(n), E(n), n.assignedMap.set(e, !0), n.copy.set(e, t), Ie(n, e, t, X)), this;
425
+ return (!s.has(e) || !A(s.get(e), t)) && (w(n), E(n), n.assignedMap.set(e, !0), n.copy.set(e, t), Ee(n, e, t, X)), this;
426
426
  },
427
427
  delete(e) {
428
428
  if (!this.has(e))
@@ -450,7 +450,7 @@ const ce = (e, t, n = !1) => {
450
450
  const s = h(this), i = x(s).get(e), r = ((n = (t = s.options).mark) === null || n === void 0 ? void 0 : n.call(t, i, O)) === O.mutable;
451
451
  if (s.options.strict && ce(i, s.options, r), r || s.finalized || !R(i, s.options) || i !== s.original.get(e))
452
452
  return i;
453
- const o = xe.createDraft({
453
+ const o = Me.createDraft({
454
454
  original: i,
455
455
  parentDraft: s,
456
456
  key: e,
@@ -494,7 +494,7 @@ const ce = (e, t, n = !1) => {
494
494
  [ee]() {
495
495
  return this.entries();
496
496
  }
497
- }, Ht = Reflect.ownKeys(we), je = (e, t, { isValuesIterator: n }) => () => {
497
+ }, Bt = Reflect.ownKeys(ge), je = (e, t, { isValuesIterator: n }) => () => {
498
498
  var s, i;
499
499
  const r = t.next();
500
500
  if (r.done)
@@ -503,7 +503,7 @@ const ce = (e, t, n = !1) => {
503
503
  let c = e.setMap.get(o);
504
504
  const a = h(c), u = ((i = (s = e.options).mark) === null || i === void 0 ? void 0 : i.call(s, c, O)) === O.mutable;
505
505
  if (e.options.strict && ce(o, e.options, u), !u && !a && R(o, e.options) && !e.finalized && e.original.has(o)) {
506
- const l = xe.createDraft({
506
+ const l = Me.createDraft({
507
507
  original: o,
508
508
  parentDraft: e,
509
509
  key: o,
@@ -530,7 +530,7 @@ const ce = (e, t, n = !1) => {
530
530
  },
531
531
  add(e) {
532
532
  const t = h(this);
533
- return this.has(e) || (w(t), E(t), t.assignedMap.set(e, !0), t.setMap.set(e, e), Ie(t, e, e, X)), this;
533
+ return this.has(e) || (w(t), E(t), t.assignedMap.set(e, !0), t.setMap.set(e, e), Ee(t, e, e, X)), this;
534
534
  },
535
535
  delete(e) {
536
536
  if (!this.has(e))
@@ -605,7 +605,7 @@ Set.prototype.difference && Object.assign(ae, {
605
605
  return Set.prototype.isDisjointFrom.call(new Set(this.values()), e);
606
606
  }
607
607
  });
608
- const Bt = Reflect.ownKeys(ae), it = {
608
+ const Ut = Reflect.ownKeys(ae), it = {
609
609
  get(e, t, n) {
610
610
  var s, i;
611
611
  const r = (s = e.copy) === null || s === void 0 ? void 0 : s[t];
@@ -620,9 +620,9 @@ const Bt = Reflect.ownKeys(ae), it = {
620
620
  return e.options.strict && ce(u, e.options, !0), u;
621
621
  }
622
622
  const c = x(e);
623
- if (c instanceof Map && Ht.includes(t))
624
- return t === "size" ? Object.getOwnPropertyDescriptor(we, "size").get.call(e.proxy) : we[t].bind(e.proxy);
625
- if (c instanceof Set && Bt.includes(t))
623
+ if (c instanceof Map && Bt.includes(t))
624
+ return t === "size" ? Object.getOwnPropertyDescriptor(ge, "size").get.call(e.proxy) : ge[t].bind(e.proxy);
625
+ if (c instanceof Set && Ut.includes(t))
626
626
  return t === "size" ? Object.getOwnPropertyDescriptor(ae, "size").get.call(e.proxy) : ae[t].bind(e.proxy);
627
627
  if (!Y(c, t)) {
628
628
  const u = Ae(c, t);
@@ -635,7 +635,7 @@ const Bt = Reflect.ownKeys(ae), it = {
635
635
  if (e.options.strict && ce(a, e.options), e.finalized || !R(a, e.options))
636
636
  return a;
637
637
  if (a === pe(e.original, t)) {
638
- if (w(e), e.copy[t] = Ne({
638
+ if (w(e), e.copy[t] = Ie({
639
639
  original: e.original[t],
640
640
  parentDraft: e,
641
641
  key: e.type === 1 ? Number(t) : t,
@@ -660,7 +660,7 @@ const Bt = Reflect.ownKeys(ae), it = {
660
660
  if (r?.set)
661
661
  return r.set.call(e.proxy, n), !0;
662
662
  const o = pe(x(e), t), c = h(o);
663
- return c && A(c.original, n) ? (e.copy[t] = n, e.assignedMap = (s = e.assignedMap) !== null && s !== void 0 ? s : /* @__PURE__ */ new Map(), e.assignedMap.set(t, !1), !0) : (A(n, o) && (n !== void 0 || Y(e.original, t)) || (w(e), E(e), Y(e.original, t) && A(n, e.original[t]) ? e.assignedMap.delete(t) : e.assignedMap.set(t, !0), e.copy[t] = n, Ie(e, t, n, X)), !0);
663
+ return c && A(c.original, n) ? (e.copy[t] = n, e.assignedMap = (s = e.assignedMap) !== null && s !== void 0 ? s : /* @__PURE__ */ new Map(), e.assignedMap.set(t, !1), !0) : (A(n, o) && (n !== void 0 || Y(e.original, t)) || (w(e), E(e), Y(e.original, t) && A(n, e.original[t]) ? e.assignedMap.delete(t) : e.assignedMap.set(t, !0), e.copy[t] = n, Ee(e, t, n, X)), !0);
664
664
  },
665
665
  has(e, t) {
666
666
  return t in x(e);
@@ -691,8 +691,8 @@ const Bt = Reflect.ownKeys(ae), it = {
691
691
  return e.type === 1 ? it.set.call(this, e, t, void 0, e.proxy) : (pe(e.original, t) !== void 0 || t in e.original ? (w(e), E(e), e.assignedMap.set(t, !1)) : (e.assignedMap = (n = e.assignedMap) !== null && n !== void 0 ? n : /* @__PURE__ */ new Map(), e.assignedMap.delete(t)), e.copy && delete e.copy[t], !0);
692
692
  }
693
693
  };
694
- function Ne(e) {
695
- const { original: t, parentDraft: n, key: s, finalities: i, options: r } = e, o = Q(t), c = {
694
+ function Ie(e) {
695
+ const { original: t, parentDraft: n, key: s, finalities: i, options: r } = e, o = $(t), c = {
696
696
  type: o,
697
697
  finalized: !1,
698
698
  parent: n,
@@ -710,40 +710,40 @@ function Ne(e) {
710
710
  const l = n;
711
711
  l.finalities.draft.push((f, y) => {
712
712
  var p, I;
713
- const $ = h(a);
713
+ const H = h(a);
714
714
  let C = l.type === 3 ? l.setMap : l.copy;
715
715
  const m = F(C, s), S = h(m);
716
716
  if (S) {
717
717
  let _ = S.original;
718
- S.operated && (_ = Re(m)), Se(S), ge(S, X, f, y), l.options.enableAutoFreeze && (l.options.updatedValues = (p = l.options.updatedValues) !== null && p !== void 0 ? p : /* @__PURE__ */ new WeakMap(), l.options.updatedValues.set(_, S.original)), Z(C, s, _);
718
+ S.operated && (_ = Pe(m)), me(S), Se(S, X, f, y), l.options.enableAutoFreeze && (l.options.updatedValues = (p = l.options.updatedValues) !== null && p !== void 0 ? p : /* @__PURE__ */ new WeakMap(), l.options.updatedValues.set(_, S.original)), Z(C, s, _);
719
719
  }
720
- (I = $.callbacks) === null || I === void 0 || I.forEach((_) => {
720
+ (I = H.callbacks) === null || I === void 0 || I.forEach((_) => {
721
721
  _(f, y);
722
722
  });
723
723
  });
724
724
  } else {
725
725
  const l = h(a);
726
726
  l.finalities.draft.push((f, y) => {
727
- Se(l), ge(l, X, f, y);
727
+ me(l), Se(l, X, f, y);
728
728
  });
729
729
  }
730
730
  return a;
731
731
  }
732
- xe.createDraft = Ne;
733
- function Ut(e, t, n, s, i) {
732
+ Me.createDraft = Ie;
733
+ function Kt(e, t, n, s, i) {
734
734
  var r;
735
735
  const o = h(e), c = (r = o?.original) !== null && r !== void 0 ? r : e, a = !!t.length;
736
736
  if (o?.operated)
737
737
  for (; o.finalities.draft.length > 0; )
738
738
  o.finalities.draft.pop()(n, s);
739
739
  const u = a ? t[0] : o ? o.operated ? o.copy : o.original : e;
740
- return o && me(o), i && B(u, u, o?.options.updatedValues), [
740
+ return o && be(o), i && U(u, u, o?.options.updatedValues), [
741
741
  u,
742
742
  n && a ? [{ op: b.Replace, path: [], value: t[0] }] : n,
743
743
  s && a ? [{ op: b.Replace, path: [], value: c }] : s
744
744
  ];
745
745
  }
746
- function Kt(e, t) {
746
+ function Wt(e, t) {
747
747
  var n;
748
748
  const s = {
749
749
  draft: [],
@@ -753,7 +753,7 @@ function Kt(e, t) {
753
753
  };
754
754
  let i, r;
755
755
  t.enablePatches && (i = [], r = []);
756
- const c = ((n = t.mark) === null || n === void 0 ? void 0 : n.call(t, e, O)) === O.mutable || !R(e, t) ? e : Ne({
756
+ const c = ((n = t.mark) === null || n === void 0 ? void 0 : n.call(t, e, O)) === O.mutable || !R(e, t) ? e : Ie({
757
757
  original: e,
758
758
  parentDraft: null,
759
759
  finalities: s,
@@ -762,14 +762,14 @@ function Kt(e, t) {
762
762
  return [
763
763
  c,
764
764
  (a = []) => {
765
- const [u, l, f] = Ut(c, a, i, r, t.enableAutoFreeze);
765
+ const [u, l, f] = Kt(c, a, i, r, t.enableAutoFreeze);
766
766
  return t.enablePatches ? [u, l, f] : u;
767
767
  }
768
768
  ];
769
769
  }
770
- function ve(e) {
770
+ function we(e) {
771
771
  const { rootDraft: t, value: n, useRawReturn: s = !1, isRoot: i = !0 } = e;
772
- Ee(n, (r, o, c) => {
772
+ Re(n, (r, o, c) => {
773
773
  const a = h(o);
774
774
  if (a && t && a.finalities === t.finalities) {
775
775
  e.isContainDraft = !0;
@@ -779,7 +779,7 @@ function ve(e) {
779
779
  c.clear(), l.forEach((f) => c.add(r === f ? u : f));
780
780
  } else
781
781
  Z(c, r, u);
782
- } else typeof o == "object" && o !== null && (e.value = o, e.isRoot = !1, ve(e));
782
+ } else typeof o == "object" && o !== null && (e.value = o, e.isRoot = !1, we(e));
783
783
  }), i && (e.isContainDraft || console.warn("The return value does not contain any draft, please use 'rawReturn()' to wrap the return value to improve performance."), s && console.warn("The return value contains drafts, please don't use 'rawReturn()' to wrap the return value."));
784
784
  }
785
785
  function rt(e) {
@@ -787,12 +787,12 @@ function rt(e) {
787
787
  const n = h(e);
788
788
  if (!R(e, n?.options))
789
789
  return e;
790
- const s = Q(e);
790
+ const s = $(e);
791
791
  if (n && !n.operated)
792
792
  return n.original;
793
793
  let i;
794
794
  function r() {
795
- i = s === 2 ? Pe(e) ? new Map(e) : new (Object.getPrototypeOf(e)).constructor(e) : s === 3 ? Array.from(n.setMap.values()) : nt(e, n?.options);
795
+ i = s === 2 ? Oe(e) ? new Map(e) : new (Object.getPrototypeOf(e)).constructor(e) : s === 3 ? Array.from(n.setMap.values()) : nt(e, n?.options);
796
796
  }
797
797
  if (n) {
798
798
  n.finalized = !0;
@@ -803,14 +803,14 @@ function rt(e) {
803
803
  }
804
804
  } else
805
805
  i = e;
806
- if (Ee(i, (o, c) => {
806
+ if (Re(i, (o, c) => {
807
807
  if (n && A(F(n.original, o), c))
808
808
  return;
809
809
  const a = rt(c);
810
810
  a !== c && (i === e && r(), Z(i, o, a));
811
811
  }), s === 3) {
812
812
  const o = (t = n?.original) !== null && t !== void 0 ? t : i;
813
- return Oe(o) ? new Set(i) : new (Object.getPrototypeOf(o)).constructor(i);
813
+ return xe(o) ? new Set(i) : new (Object.getPrototypeOf(o)).constructor(i);
814
814
  }
815
815
  return i;
816
816
  }
@@ -819,7 +819,7 @@ function De(e) {
819
819
  throw new Error(`current() is only used for Draft, parameter: ${e}`);
820
820
  return rt(e);
821
821
  }
822
- const Wt = (e) => function t(n, s, i) {
822
+ const Vt = (e) => function t(n, s, i) {
823
823
  var r, o, c;
824
824
  if (typeof n == "function" && typeof s != "function")
825
825
  return function(d, ...N) {
@@ -846,7 +846,7 @@ const Wt = (e) => function t(n, s, i) {
846
846
  };
847
847
  if (!R(f, C) && typeof f == "object" && f !== null)
848
848
  throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");
849
- const [m, S] = Kt(f, C);
849
+ const [m, S] = Wt(f, C);
850
850
  if (typeof s != "function") {
851
851
  if (!R(f, C))
852
852
  throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");
@@ -856,24 +856,24 @@ const Wt = (e) => function t(n, s, i) {
856
856
  try {
857
857
  _ = u(m);
858
858
  } catch (d) {
859
- throw me(h(m)), d;
859
+ throw be(h(m)), d;
860
860
  }
861
861
  const j = (d) => {
862
862
  const N = h(m);
863
863
  if (!T(d)) {
864
864
  if (d !== void 0 && !A(d, m) && N?.operated)
865
865
  throw new Error("Either the value is returned as a new non-draft value, or only the draft is modified without returning any value.");
866
- const L = d?.[At];
866
+ const L = d?.[Ft];
867
867
  if (L) {
868
- const yt = L[0];
869
- return C.strict && typeof d == "object" && d !== null && ve({
868
+ const bt = L[0];
869
+ return C.strict && typeof d == "object" && d !== null && we({
870
870
  rootDraft: N,
871
871
  value: d,
872
872
  useRawReturn: !0
873
- }), S([yt]);
873
+ }), S([bt]);
874
874
  }
875
875
  if (d !== void 0)
876
- return typeof d == "object" && d !== null && ve({ rootDraft: N, value: d }), S([d]);
876
+ return typeof d == "object" && d !== null && we({ rootDraft: N, value: d }), S([d]);
877
877
  }
878
878
  if (d === m || d === void 0)
879
879
  return S([]);
@@ -886,21 +886,21 @@ const Wt = (e) => function t(n, s, i) {
886
886
  return S([d]);
887
887
  };
888
888
  return _ instanceof Promise ? _.then(j, (d) => {
889
- throw me(h(m)), d;
889
+ throw be(h(m)), d;
890
890
  }) : j(_);
891
- }, P = Wt();
891
+ }, P = Vt();
892
892
  Object.prototype.constructor.toString();
893
- var Vt = /\s/;
894
- function Lt(e) {
895
- for (var t = e.length; t-- && Vt.test(e.charAt(t)); )
893
+ var Lt = /\s/;
894
+ function Jt(e) {
895
+ for (var t = e.length; t-- && Lt.test(e.charAt(t)); )
896
896
  ;
897
897
  return t;
898
898
  }
899
- var Jt = /^\s+/;
900
- function Yt(e) {
901
- return e && e.slice(0, Lt(e) + 1).replace(Jt, "");
899
+ var Yt = /^\s+/;
900
+ function Gt(e) {
901
+ return e && e.slice(0, Jt(e) + 1).replace(Yt, "");
902
902
  }
903
- var Te = NaN, Gt = /^[-+]0x[0-9a-f]+$/i, Xt = /^0b[01]+$/i, Zt = /^0o[0-7]+$/i, kt = parseInt;
903
+ var Te = NaN, Xt = /^[-+]0x[0-9a-f]+$/i, Zt = /^0b[01]+$/i, kt = /^0o[0-7]+$/i, en = parseInt;
904
904
  function ne(e) {
905
905
  if (typeof e == "number")
906
906
  return e;
@@ -912,25 +912,25 @@ function ne(e) {
912
912
  }
913
913
  if (typeof e != "string")
914
914
  return e === 0 ? e : +e;
915
- e = Yt(e);
916
- var n = Xt.test(e);
917
- return n || Zt.test(e) ? kt(e.slice(2), n ? 2 : 8) : Gt.test(e) ? Te : +e;
915
+ e = Gt(e);
916
+ var n = Zt.test(e);
917
+ return n || kt.test(e) ? en(e.slice(2), n ? 2 : 8) : Xt.test(e) ? Te : +e;
918
918
  }
919
- var qe = 1 / 0, en = 17976931348623157e292;
920
- function tn(e) {
919
+ var qe = 1 / 0, tn = 17976931348623157e292;
920
+ function nn(e) {
921
921
  if (!e)
922
922
  return e === 0 ? e : 0;
923
923
  if (e = ne(e), e === qe || e === -qe) {
924
924
  var t = e < 0 ? -1 : 1;
925
- return t * en;
925
+ return t * tn;
926
926
  }
927
927
  return e === e ? e : 0;
928
928
  }
929
929
  function ot(e) {
930
- var t = tn(e), n = t % 1;
930
+ var t = nn(e), n = t % 1;
931
931
  return t === t ? n ? t - n : t : 0;
932
932
  }
933
- function nn(e, t, n) {
933
+ function sn(e, t, n) {
934
934
  switch (n.length) {
935
935
  case 0:
936
936
  return e.call(t);
@@ -943,50 +943,50 @@ function nn(e, t, n) {
943
943
  }
944
944
  return e.apply(t, n);
945
945
  }
946
- var sn = 800, rn = 16, on = Date.now;
947
- function cn(e) {
946
+ var rn = 800, on = 16, cn = Date.now;
947
+ function an(e) {
948
948
  var t = 0, n = 0;
949
949
  return function() {
950
- var s = on(), i = rn - (s - n);
950
+ var s = cn(), i = on - (s - n);
951
951
  if (n = s, i > 0) {
952
- if (++t >= sn)
952
+ if (++t >= rn)
953
953
  return arguments[0];
954
954
  } else
955
955
  t = 0;
956
956
  return e.apply(void 0, arguments);
957
957
  };
958
958
  }
959
- function an(e) {
959
+ function un(e) {
960
960
  return function() {
961
961
  return e;
962
962
  };
963
963
  }
964
964
  var ue = (function() {
965
965
  try {
966
- var e = bt(Object, "defineProperty");
966
+ var e = mt(Object, "defineProperty");
967
967
  return e({}, "", {}), e;
968
968
  } catch {
969
969
  }
970
- })(), un = ue ? function(e, t) {
970
+ })(), ln = ue ? function(e, t) {
971
971
  return ue(e, "toString", {
972
972
  configurable: !0,
973
973
  enumerable: !1,
974
- value: an(t),
974
+ value: un(t),
975
975
  writable: !0
976
976
  });
977
- } : fe, ln = cn(un);
978
- function fn(e, t) {
977
+ } : fe, fn = an(ln);
978
+ function hn(e, t) {
979
979
  for (var n = -1, s = e == null ? 0 : e.length; ++n < s && t(e[n], n, e) !== !1; )
980
980
  ;
981
981
  return e;
982
982
  }
983
- function hn(e, t, n, s) {
983
+ function dn(e, t, n, s) {
984
984
  for (var i = e.length, r = n + -1; ++r < i; )
985
985
  if (t(e[r], r, e))
986
986
  return r;
987
987
  return -1;
988
988
  }
989
- function dn(e, t, n) {
989
+ function pn(e, t, n) {
990
990
  t == "__proto__" && ue ? ue(e, t, {
991
991
  configurable: !0,
992
992
  enumerable: !0,
@@ -994,24 +994,24 @@ function dn(e, t, n) {
994
994
  writable: !0
995
995
  }) : e[t] = n;
996
996
  }
997
- var pn = Object.prototype, _n = pn.hasOwnProperty;
998
- function yn(e, t, n) {
997
+ var _n = Object.prototype, yn = _n.hasOwnProperty;
998
+ function bn(e, t, n) {
999
999
  var s = e[t];
1000
- (!(_n.call(e, t) && Je(s, n)) || n === void 0 && !(t in e)) && dn(e, t, n);
1000
+ (!(yn.call(e, t) && Je(s, n)) || n === void 0 && !(t in e)) && pn(e, t, n);
1001
1001
  }
1002
1002
  var Qe = Math.max;
1003
- function bn(e, t, n) {
1003
+ function mn(e, t, n) {
1004
1004
  return t = Qe(t === void 0 ? e.length - 1 : t, 0), function() {
1005
1005
  for (var s = arguments, i = -1, r = Qe(s.length - t, 0), o = Array(r); ++i < r; )
1006
1006
  o[i] = s[t + i];
1007
1007
  i = -1;
1008
1008
  for (var c = Array(t + 1); ++i < t; )
1009
1009
  c[i] = s[i];
1010
- return c[t] = n(o), nn(e, this, c);
1010
+ return c[t] = n(o), sn(e, this, c);
1011
1011
  };
1012
1012
  }
1013
- function mn(e, t) {
1014
- return ln(bn(e, t, fe), e + "");
1013
+ function Sn(e, t) {
1014
+ return fn(mn(e, t, fe), e + "");
1015
1015
  }
1016
1016
  function $e(e, t, n) {
1017
1017
  if (!G(n))
@@ -1019,58 +1019,58 @@ function $e(e, t, n) {
1019
1019
  var s = typeof t;
1020
1020
  return (s == "number" ? he(n) && Ye(t, n.length) : s == "string" && t in n) ? Je(n[t], e) : !1;
1021
1021
  }
1022
- var He = ze ? ze.isConcatSpreadable : void 0;
1023
- function Sn(e) {
1022
+ var He = Ne ? Ne.isConcatSpreadable : void 0;
1023
+ function gn(e) {
1024
1024
  return W(e) || Ge(e) || !!(He && e && e[He]);
1025
1025
  }
1026
- function gn(e, t, n, s, i) {
1026
+ function wn(e, t, n, s, i) {
1027
1027
  var r = -1, o = e.length;
1028
- for (n || (n = Sn), i || (i = []); ++r < o; ) {
1028
+ for (n || (n = gn), i || (i = []); ++r < o; ) {
1029
1029
  var c = e[r];
1030
- n(c) ? mt(i, c) : i[i.length] = c;
1030
+ n(c) ? St(i, c) : i[i.length] = c;
1031
1031
  }
1032
1032
  return i;
1033
1033
  }
1034
- function wn(e, t, n) {
1034
+ function vn(e, t, n) {
1035
1035
  var s = -1, i = e.length;
1036
1036
  t < 0 && (t = -t > i ? 0 : i + t), n = n > i ? i : n, n < 0 && (n += i), i = t > n ? 0 : n - t >>> 0, t >>>= 0;
1037
1037
  for (var r = Array(i); ++s < i; )
1038
1038
  r[s] = e[s + t];
1039
1039
  return r;
1040
1040
  }
1041
- var vn = "\\ud800-\\udfff", Cn = "\\u0300-\\u036f", Mn = "\\ufe20-\\ufe2f", xn = "\\u20d0-\\u20ff", On = Cn + Mn + xn, Pn = "\\ufe0e\\ufe0f", Rn = "\\u200d", En = RegExp("[" + Rn + vn + On + Pn + "]");
1042
- function In(e) {
1043
- return En.test(e);
1041
+ var Cn = "\\ud800-\\udfff", Mn = "\\u0300-\\u036f", xn = "\\ufe20-\\ufe2f", On = "\\u20d0-\\u20ff", Pn = Mn + xn + On, Rn = "\\ufe0e\\ufe0f", En = "\\u200d", In = RegExp("[" + En + Cn + Pn + Rn + "]");
1042
+ function Nn(e) {
1043
+ return In.test(e);
1044
1044
  }
1045
- function Nn(e, t, n) {
1045
+ function zn(e, t, n) {
1046
1046
  return e === e && (n !== void 0 && (e = e <= n ? e : n), t !== void 0 && (e = e >= t ? e : t)), e;
1047
1047
  }
1048
- function zn(e, t, n) {
1049
- return n === void 0 && (n = t, t = void 0), n !== void 0 && (n = ne(n), n = n === n ? n : 0), t !== void 0 && (t = ne(t), t = t === t ? t : 0), Nn(ne(e), t, n);
1048
+ function An(e, t, n) {
1049
+ return n === void 0 && (n = t, t = void 0), n !== void 0 && (n = ne(n), n = n === n ? n : 0), t !== void 0 && (t = ne(t), t = t === t ? t : 0), zn(ne(e), t, n);
1050
1050
  }
1051
- function An(e) {
1051
+ function Fn(e) {
1052
1052
  return typeof e == "function" ? e : fe;
1053
1053
  }
1054
1054
  function k(e, t) {
1055
- var n = W(e) ? fn : Xe;
1056
- return n(e, An(t));
1055
+ var n = W(e) ? hn : Xe;
1056
+ return n(e, Fn(t));
1057
1057
  }
1058
- function Fn(e, t) {
1058
+ function jn(e, t) {
1059
1059
  var n = [];
1060
1060
  return Xe(e, function(s, i, r) {
1061
1061
  t(s, i, r) && n.push(s);
1062
1062
  }), n;
1063
1063
  }
1064
1064
  function se(e, t) {
1065
- var n = W(e) ? St : Fn;
1065
+ var n = W(e) ? gt : jn;
1066
1066
  return n(e, V(t));
1067
1067
  }
1068
- function jn(e) {
1068
+ function Dn(e) {
1069
1069
  return function(t, n, s) {
1070
1070
  var i = Object(t);
1071
1071
  if (!he(t)) {
1072
1072
  var r = V(n);
1073
- t = gt(t), n = function(c) {
1073
+ t = wt(t), n = function(c) {
1074
1074
  return r(i[c], c, i);
1075
1075
  };
1076
1076
  }
@@ -1078,43 +1078,43 @@ function jn(e) {
1078
1078
  return o > -1 ? i[r ? t[o] : o] : void 0;
1079
1079
  };
1080
1080
  }
1081
- var Dn = Math.max;
1081
+ var Tn = Math.max;
1082
1082
  function ie(e, t, n) {
1083
1083
  var s = e == null ? 0 : e.length;
1084
1084
  if (!s)
1085
1085
  return -1;
1086
1086
  var i = n == null ? 0 : ot(n);
1087
- return i < 0 && (i = Dn(s + i, 0)), hn(e, V(t), i);
1087
+ return i < 0 && (i = Tn(s + i, 0)), dn(e, V(t), i);
1088
1088
  }
1089
- var Be = jn(ie);
1090
- function Tn(e) {
1089
+ var Be = Dn(ie);
1090
+ function qn(e) {
1091
1091
  return e && e.length ? e[0] : void 0;
1092
1092
  }
1093
- function qn(e, t) {
1093
+ function Qn(e, t) {
1094
1094
  return e > t;
1095
1095
  }
1096
- var Qn = "[object String]";
1097
- function $n(e) {
1098
- return typeof e == "string" || !W(e) && wt(e) && vt(e) == Qn;
1096
+ var $n = "[object String]";
1097
+ function ct(e) {
1098
+ return typeof e == "string" || !W(e) && vt(e) && Ct(e) == $n;
1099
1099
  }
1100
1100
  var Hn = "[object Map]", Bn = "[object Set]", Un = Object.prototype, Kn = Un.hasOwnProperty;
1101
1101
  function Wn(e) {
1102
1102
  if (e == null)
1103
1103
  return !0;
1104
- if (he(e) && (W(e) || typeof e == "string" || typeof e.splice == "function" || Ct(e) || Mt(e) || Ge(e)))
1104
+ if (he(e) && (W(e) || typeof e == "string" || typeof e.splice == "function" || Mt(e) || xt(e) || Ge(e)))
1105
1105
  return !e.length;
1106
1106
  var t = Ze(e);
1107
1107
  if (t == Hn || t == Bn)
1108
1108
  return !e.size;
1109
- if (xt(e))
1109
+ if (Ot(e))
1110
1110
  return !ke(e).length;
1111
1111
  for (var n in e)
1112
1112
  if (Kn.call(e, n))
1113
1113
  return !1;
1114
1114
  return !0;
1115
1115
  }
1116
- function ct(e, t) {
1117
- return Ot(e, t);
1116
+ function at(e, t) {
1117
+ return Pt(e, t);
1118
1118
  }
1119
1119
  var Vn = Array.prototype, Ln = Vn.join;
1120
1120
  function _e(e, t) {
@@ -1123,7 +1123,7 @@ function _e(e, t) {
1123
1123
  function Jn(e, t) {
1124
1124
  return e < t;
1125
1125
  }
1126
- function at(e, t, n) {
1126
+ function ut(e, t, n) {
1127
1127
  for (var s = -1, i = e.length; ++s < i; ) {
1128
1128
  var r = e[s], o = t(r);
1129
1129
  if (o != null && (c === void 0 ? o === o && !oe(o) : n(o, c)))
@@ -1132,24 +1132,24 @@ function at(e, t, n) {
1132
1132
  return a;
1133
1133
  }
1134
1134
  function Ue(e, t) {
1135
- return e && e.length ? at(e, V(t), qn) : void 0;
1135
+ return e && e.length ? ut(e, V(t), Qn) : void 0;
1136
1136
  }
1137
1137
  function Yn(e, t) {
1138
- return e && e.length ? at(e, V(t), Jn) : void 0;
1138
+ return e && e.length ? ut(e, V(t), Jn) : void 0;
1139
1139
  }
1140
1140
  function Gn(e, t, n, s) {
1141
1141
  if (!G(e))
1142
1142
  return e;
1143
- t = Pt(t, e);
1143
+ t = Rt(t, e);
1144
1144
  for (var i = -1, r = t.length, o = r - 1, c = e; c != null && ++i < r; ) {
1145
- var a = Rt(t[i]), u = n;
1145
+ var a = Et(t[i]), u = n;
1146
1146
  if (a === "__proto__" || a === "constructor" || a === "prototype")
1147
1147
  return e;
1148
1148
  if (i != o) {
1149
1149
  var l = c[a];
1150
1150
  u = void 0, u === void 0 && (u = G(l) ? l : Ye(t[i + 1]) ? [] : {});
1151
1151
  }
1152
- yn(c, a, u), c = c[a];
1152
+ bn(c, a, u), c = c[a];
1153
1153
  }
1154
1154
  return e;
1155
1155
  }
@@ -1184,12 +1184,12 @@ function kn(e, t, n) {
1184
1184
  function es(e, t, n) {
1185
1185
  t.length ? t = de(t, function(r) {
1186
1186
  return W(r) ? function(o) {
1187
- return Et(o, r.length === 1 ? r[0] : r);
1187
+ return It(o, r.length === 1 ? r[0] : r);
1188
1188
  } : r;
1189
1189
  }) : t = [fe];
1190
1190
  var s = -1;
1191
- t = de(t, It(V));
1192
- var i = Nt(e, function(r, o, c) {
1191
+ t = de(t, Nt(V));
1192
+ var i = zt(e, function(r, o, c) {
1193
1193
  var a = de(t, function(u) {
1194
1194
  return u(r);
1195
1195
  });
@@ -1199,35 +1199,35 @@ function es(e, t, n) {
1199
1199
  return kn(r, o, n);
1200
1200
  });
1201
1201
  }
1202
- var ts = zt("length"), ut = "\\ud800-\\udfff", ns = "\\u0300-\\u036f", ss = "\\ufe20-\\ufe2f", is = "\\u20d0-\\u20ff", rs = ns + ss + is, os = "\\ufe0e\\ufe0f", cs = "[" + ut + "]", Ce = "[" + rs + "]", Me = "\\ud83c[\\udffb-\\udfff]", as = "(?:" + Ce + "|" + Me + ")", lt = "[^" + ut + "]", ft = "(?:\\ud83c[\\udde6-\\uddff]){2}", ht = "[\\ud800-\\udbff][\\udc00-\\udfff]", us = "\\u200d", dt = as + "?", pt = "[" + os + "]?", ls = "(?:" + us + "(?:" + [lt, ft, ht].join("|") + ")" + pt + dt + ")*", fs = pt + dt + ls, hs = "(?:" + [lt + Ce + "?", Ce, ft, ht, cs].join("|") + ")", Ke = RegExp(Me + "(?=" + Me + ")|" + hs + fs, "g");
1202
+ var ts = At("length"), lt = "\\ud800-\\udfff", ns = "\\u0300-\\u036f", ss = "\\ufe20-\\ufe2f", is = "\\u20d0-\\u20ff", rs = ns + ss + is, os = "\\ufe0e\\ufe0f", cs = "[" + lt + "]", ve = "[" + rs + "]", Ce = "\\ud83c[\\udffb-\\udfff]", as = "(?:" + ve + "|" + Ce + ")", ft = "[^" + lt + "]", ht = "(?:\\ud83c[\\udde6-\\uddff]){2}", dt = "[\\ud800-\\udbff][\\udc00-\\udfff]", us = "\\u200d", pt = as + "?", _t = "[" + os + "]?", ls = "(?:" + us + "(?:" + [ft, ht, dt].join("|") + ")" + _t + pt + ")*", fs = _t + pt + ls, hs = "(?:" + [ft + ve + "?", ve, ht, dt, cs].join("|") + ")", Ke = RegExp(Ce + "(?=" + Ce + ")|" + hs + fs, "g");
1203
1203
  function ds(e) {
1204
1204
  for (var t = Ke.lastIndex = 0; Ke.test(e); )
1205
1205
  ++t;
1206
1206
  return t;
1207
1207
  }
1208
1208
  function ps(e) {
1209
- return In(e) ? ds(e) : ts(e);
1209
+ return Nn(e) ? ds(e) : ts(e);
1210
1210
  }
1211
1211
  function _s(e, t, n) {
1212
1212
  return e == null ? e : Gn(e, t, n);
1213
1213
  }
1214
1214
  var ys = "[object Map]", bs = "[object Set]";
1215
- function U(e) {
1215
+ function Q(e) {
1216
1216
  if (e == null)
1217
1217
  return 0;
1218
1218
  if (he(e))
1219
- return $n(e) ? ps(e) : e.length;
1219
+ return ct(e) ? ps(e) : e.length;
1220
1220
  var t = Ze(e);
1221
1221
  return t == ys || t == bs ? e.size : ke(e).length;
1222
1222
  }
1223
- var re = mn(function(e, t) {
1223
+ var re = Sn(function(e, t) {
1224
1224
  if (e == null)
1225
1225
  return [];
1226
1226
  var n = t.length;
1227
- return n > 1 && $e(e, t[0], t[1]) ? t = [] : n > 2 && $e(t[0], t[1], t[2]) && (t = [t[0]]), es(e, gn(t), []);
1227
+ return n > 1 && $e(e, t[0], t[1]) ? t = [] : n > 2 && $e(t[0], t[1], t[2]) && (t = [t[0]]), es(e, wn(t), []);
1228
1228
  });
1229
1229
  function ms(e, t, n) {
1230
- return e && e.length ? (t = t === void 0 ? 1 : ot(t), wn(e, 0, t < 0 ? 0 : t)) : [];
1230
+ return e && e.length ? (t = t === void 0 ? 1 : ot(t), vn(e, 0, t < 0 ? 0 : t)) : [];
1231
1231
  }
1232
1232
  const Ss = (e, t) => e ? e.type === "create" && t.type === "delete" ? null : e.type === "create" && t.type === "update" ? { ...e, data: t.data } : (e.type === "update" && t.type === "update" || e.type === "update" && t.type === "delete", t) : t;
1233
1233
  class gs {
@@ -1308,7 +1308,7 @@ class gs {
1308
1308
  async _flush() {
1309
1309
  const { isPaused: t, isSyncing: n, queue: s } = this._state;
1310
1310
  if (t || n || Wn(s)) return;
1311
- const i = z(this._config, "batchSize", 1 / 0), r = [...s.entries()], o = ms(r, i), c = r.slice(U(o));
1311
+ const i = z(this._config, "batchSize", 1 / 0), r = [...s.entries()], o = ms(r, i), c = r.slice(Q(o));
1312
1312
  this._updateState((l) => {
1313
1313
  l.inFlight = new Map(o), l.queue = new Map(c), l.isSyncing = !0;
1314
1314
  });
@@ -1320,7 +1320,7 @@ class gs {
1320
1320
  } catch (l) {
1321
1321
  this._handleError(l);
1322
1322
  }
1323
- this._abortController = null, U(this._state.queue) > 0 && !this._state.isPaused && this._scheduleFlush();
1323
+ this._abortController = null, Q(this._state.queue) > 0 && !this._state.isPaused && this._scheduleFlush();
1324
1324
  }
1325
1325
  _processResponse(t) {
1326
1326
  const n = this._state.inFlight, s = new Map((t.syncResults ?? []).map((i) => [i.id, i]));
@@ -1339,11 +1339,11 @@ class gs {
1339
1339
  }
1340
1340
  }
1341
1341
  i.inFlight = /* @__PURE__ */ new Map(), i.isSyncing = !1;
1342
- }), this._config.onServerItems && U(t.items) > 0) {
1342
+ }), this._config.onServerItems && Q(t.items) > 0) {
1343
1343
  const i = new Set((t.syncResults ?? []).map((o) => o.id)), r = (t.items ?? []).filter(
1344
1344
  (o) => !i.has(o.id)
1345
1345
  );
1346
- U(r) > 0 && this._config.onServerItems(r);
1346
+ Q(r) > 0 && this._config.onServerItems(r);
1347
1347
  }
1348
1348
  }
1349
1349
  _handleError(t) {
@@ -1501,7 +1501,7 @@ class We {
1501
1501
  }
1502
1502
  getStatus() {
1503
1503
  const t = this._collection.getItemStatus(this._id);
1504
- return ct(this._cachedStatus, t) || (this._cachedStatus = t), this._cachedStatus;
1504
+ return at(this._cachedStatus, t) || (this._cachedStatus = t), this._cachedStatus;
1505
1505
  }
1506
1506
  exists() {
1507
1507
  return this._collection.getState().items.has(this._id);
@@ -1511,7 +1511,7 @@ class We {
1511
1511
  }
1512
1512
  }
1513
1513
  const Cs = ".";
1514
- function H(e, t) {
1514
+ function B(e, t) {
1515
1515
  const n = e.lastIndexOf(t);
1516
1516
  return n === -1 ? null : e.slice(0, n);
1517
1517
  }
@@ -1551,7 +1551,7 @@ class Le {
1551
1551
  }
1552
1552
  getStatus() {
1553
1553
  const t = this._collection.getItemStatus(this._id);
1554
- return ct(this._cachedStatus, t) || (this._cachedStatus = t), this._cachedStatus;
1554
+ return at(this._cachedStatus, t) || (this._cachedStatus = t), this._cachedStatus;
1555
1555
  }
1556
1556
  _touch(t) {
1557
1557
  this._collection.items.has(t) && this._collection.update(t, (n) => {
@@ -1559,7 +1559,7 @@ class Le {
1559
1559
  });
1560
1560
  }
1561
1561
  getParent() {
1562
- const t = H(this._id, this._separator);
1562
+ const t = B(this._id, this._separator);
1563
1563
  return t ? this._collection.getNode(t) : null;
1564
1564
  }
1565
1565
  getChildren() {
@@ -1570,13 +1570,13 @@ class Le {
1570
1570
  return K(s, (i) => this._collection.getNode(i.id));
1571
1571
  }
1572
1572
  _generateChildId() {
1573
- const { getNodeId: t } = this._collection.config, n = t ? t() : be();
1573
+ const { getNodeId: t } = this._collection.config, n = t ? t() : ze();
1574
1574
  return _e([this._id, n], this._separator);
1575
1575
  }
1576
1576
  moveUp() {
1577
1577
  const t = this.data;
1578
1578
  if (!t) return;
1579
- const n = H(this._id, this._separator);
1579
+ const n = B(this._id, this._separator);
1580
1580
  if (!n) return;
1581
1581
  const i = this._collection.getNode(n).getChildren(), r = ie(i, (u) => u.id === this._id);
1582
1582
  if (r <= 0) return;
@@ -1594,10 +1594,10 @@ class Le {
1594
1594
  moveDown() {
1595
1595
  const t = this.data;
1596
1596
  if (!t) return;
1597
- const n = H(this._id, this._separator);
1597
+ const n = B(this._id, this._separator);
1598
1598
  if (!n) return;
1599
1599
  const i = this._collection.getNode(n).getChildren(), r = ie(i, (u) => u.id === this._id);
1600
- if (r === -1 || r >= U(i) - 1) return;
1600
+ if (r === -1 || r >= Q(i) - 1) return;
1601
1601
  const o = i[r + 1], c = o.data;
1602
1602
  if (!c) return;
1603
1603
  const a = t.position;
@@ -1611,11 +1611,11 @@ class Le {
1611
1611
  }
1612
1612
  setPosition(t) {
1613
1613
  if (!this.data) return;
1614
- const s = H(this._id, this._separator);
1614
+ const s = B(this._id, this._separator);
1615
1615
  if (!s) return;
1616
1616
  const r = this._collection.getNode(s).getChildren(), o = ie(r, (l) => l.id === this._id);
1617
1617
  if (o === -1) return;
1618
- const c = zn(t, 0, U(r) - 1);
1618
+ const c = An(t, 0, Q(r) - 1);
1619
1619
  if (c === o) return;
1620
1620
  const a = [...r], [u] = a.splice(o, 1);
1621
1621
  a.splice(c, 0, u), this._collection.batch(() => {
@@ -1649,7 +1649,7 @@ class Le {
1649
1649
  move(t, n) {
1650
1650
  const s = this.data;
1651
1651
  if (!s) return;
1652
- const i = H(this._id, this._separator);
1652
+ const i = B(this._id, this._separator);
1653
1653
  if (!i) return;
1654
1654
  if (!n) {
1655
1655
  const o = s.position;
@@ -1683,7 +1683,7 @@ class Le {
1683
1683
  clone() {
1684
1684
  const t = this.data;
1685
1685
  if (!t) return /* @__PURE__ */ new Map();
1686
- const { getNodeId: n } = this._collection.config, s = n ? n() : be(), i = /* @__PURE__ */ new Map();
1686
+ const { getNodeId: n } = this._collection.config, s = n ? n() : ze(), i = /* @__PURE__ */ new Map();
1687
1687
  i.set(s, {
1688
1688
  id: s,
1689
1689
  position: t.position,
@@ -1712,7 +1712,7 @@ class Le {
1712
1712
  if (t.size === 0) return;
1713
1713
  const s = [...t.keys()];
1714
1714
  let i = Be(s, (c) => !c.includes(this._separator));
1715
- if (i || (i = Tn(re(s, (c) => c.length))), !i) return;
1715
+ if (i || (i = qn(re(s, (c) => c.length))), !i) return;
1716
1716
  const r = this._generateChildId();
1717
1717
  let o;
1718
1718
  if (n !== void 0)
@@ -1744,7 +1744,7 @@ class Le {
1744
1744
  });
1745
1745
  }
1746
1746
  remove() {
1747
- const t = H(this._id, this._separator), n = [...this._collection.items.keys()], s = K(
1747
+ const t = B(this._id, this._separator), n = [...this._collection.items.keys()], s = K(
1748
1748
  se(n, (r) => ye(r, this._id, this._separator)),
1749
1749
  (r) => r
1750
1750
  ), i = [this._id, ...s];
@@ -1757,7 +1757,7 @@ class Le {
1757
1757
  this._collection.selectNode(this._id);
1758
1758
  }
1759
1759
  }
1760
- function _t(e) {
1760
+ function yt(e) {
1761
1761
  const t = /* @__PURE__ */ new Map();
1762
1762
  if (e.serverItems)
1763
1763
  for (const n of e.serverItems)
@@ -1896,9 +1896,11 @@ class M {
1896
1896
  }
1897
1897
  create(t) {
1898
1898
  const { id: n } = t;
1899
- return this._state = P(this._state, (s) => {
1900
- s.items.set(n, t);
1901
- }), this._fetchHandler.invalidateCache(), this._notifySubscribers(), this._syncQueue.enqueue({ id: n, type: "create", data: t }), n;
1899
+ if (ct(n) && Q(n) > 0)
1900
+ return this._state = P(this._state, (s) => {
1901
+ s.items.set(n, t);
1902
+ }), this._fetchHandler.invalidateCache(), this._notifySubscribers(), this._syncQueue.enqueue({ id: n, type: "create", data: t }), n;
1903
+ throw new Error("`id` property should exist and should be non-empty");
1902
1904
  }
1903
1905
  update(t, n) {
1904
1906
  const s = this._state.items.get(t);
@@ -2012,7 +2014,7 @@ class M {
2012
2014
  }
2013
2015
  }
2014
2016
  function Es(e) {
2015
- const t = M.get(e), n = le(() => _t(e), [e.id]), s = v(
2017
+ const t = M.get(e), n = le(() => yt(e), [e.id]), s = v(
2016
2018
  (i) => t.subscribe(i),
2017
2019
  () => t.getState(),
2018
2020
  () => n
@@ -2029,7 +2031,7 @@ function Es(e) {
2029
2031
  fetchError: s.fetchError,
2030
2032
  serverState: s.serverState,
2031
2033
  // Item operations
2032
- create: (i) => t.create({ ...i, id: be() }),
2034
+ create: (i) => t.create(i),
2033
2035
  update: (i, r) => t.update(i, r),
2034
2036
  remove: (i) => t.remove(i),
2035
2037
  getItem: (i) => t.getItem(i),
@@ -2044,7 +2046,7 @@ function Es(e) {
2044
2046
  };
2045
2047
  }
2046
2048
  function Is(e) {
2047
- const t = e, n = M.get(t), s = le(() => _t(t), [e.id]), i = v(
2049
+ const t = e, n = M.get(t), s = le(() => yt(t), [e.id]), i = v(
2048
2050
  (u) => n.subscribe(u),
2049
2051
  () => n.getState(),
2050
2052
  () => s
@@ -2067,7 +2069,7 @@ function Is(e) {
2067
2069
  const I = K(
2068
2070
  se([...i.items.entries()], ([m]) => l(m, y)),
2069
2071
  ([m, S]) => ({ id: m, position: S.position })
2070
- ), $ = re(I, "position"), C = K($, (m) => f(m.id)).filter(Boolean);
2072
+ ), H = re(I, "position"), C = K(H, (m) => f(m.id)).filter(Boolean);
2071
2073
  return {
2072
2074
  id: p.id,
2073
2075
  type: p.type,
@@ -2145,7 +2147,7 @@ function xs(e) {
2145
2147
  ), o = le(() => e.getChildren(), [n, e]), c = g(() => e.getParent(), [e]), a = g((_, j) => e.append(_, j), [e]), u = g((_, j) => e.prepend(_, j), [e]), l = g(
2146
2148
  (_, j) => e.move(_, j),
2147
2149
  [e]
2148
- ), f = g(() => e.moveUp(), [e]), y = g(() => e.moveDown(), [e]), p = g((_) => e.setPosition(_), [e]), I = g(() => e.clone(), [e]), $ = g(
2150
+ ), f = g(() => e.moveUp(), [e]), y = g(() => e.moveDown(), [e]), p = g((_) => e.setPosition(_), [e]), I = g(() => e.clone(), [e]), H = g(
2149
2151
  (_) => e.updateProp(_),
2150
2152
  [e]
2151
2153
  ), C = g(() => e.remove(), [e]), m = g(() => e.select(), [e]), S = g(() => e.collection.deselectNode(), [e]);
@@ -2165,7 +2167,7 @@ function xs(e) {
2165
2167
  moveDown: y,
2166
2168
  setPosition: p,
2167
2169
  clone: I,
2168
- updateProp: $,
2170
+ updateProp: H,
2169
2171
  remove: C,
2170
2172
  select: m,
2171
2173
  deselect: S
@@ -2253,10 +2255,10 @@ export {
2253
2255
  We as Item,
2254
2256
  Le as Node,
2255
2257
  gs as SyncQueue,
2256
- _t as buildServerSnapshot,
2258
+ yt as buildServerSnapshot,
2257
2259
  Ts as compareTimeIds,
2258
2260
  $s as createSyncClient,
2259
- be as getIdFromTime,
2261
+ ze as getIdFromTime,
2260
2262
  qs as getTimeFromId,
2261
2263
  Es as useCrud,
2262
2264
  Is as useCrudTree,