use-abcd 1.4.0 → 1.4.2

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,18 +1,18 @@
1
- import { useSyncExternalStore as ue, useEffect as Xt, useCallback as Xe } from "react";
2
- import { c as io } from "./chunks/types-Dy4rYb2N.js";
3
- import { c as ao, b as co, a as uo, f as fo, d as lo, s as ho } from "./chunks/client-DReyDQ23.js";
4
- const g = {
1
+ import { useSyncExternalStore as j, useCallback as T, useRef as Nn, useMemo as Dn } from "react";
2
+ import { c as Ga } from "./chunks/types-Dy4rYb2N.js";
3
+ import { c as Wa, b as Va, a as Ja, f as Ya, d as Xa, s as Za } from "./chunks/client-DReyDQ23.js";
4
+ const v = {
5
5
  Remove: "remove",
6
6
  Replace: "replace",
7
7
  Add: "add"
8
- }, Ot = Symbol.for("__MUTATIVE_PROXY_DRAFT__"), Yt = Symbol("__MUTATIVE_RAW_RETURN_SYMBOL__"), fe = Symbol.iterator, M = {
8
+ }, en = Symbol.for("__MUTATIVE_PROXY_DRAFT__"), Hn = Symbol("__MUTATIVE_RAW_RETURN_SYMBOL__"), ve = Symbol.iterator, E = {
9
9
  mutable: "mutable",
10
10
  immutable: "immutable"
11
- }, De = {};
12
- function te(e, t) {
11
+ }, tt = {};
12
+ function he(e, t) {
13
13
  return e instanceof Map ? e.has(t) : Object.prototype.hasOwnProperty.call(e, t);
14
14
  }
15
- function Ye(e, t) {
15
+ function yt(e, t) {
16
16
  if (t in e) {
17
17
  let n = Reflect.getPrototypeOf(e);
18
18
  for (; n; ) {
@@ -23,89 +23,89 @@ function Ye(e, t) {
23
23
  }
24
24
  }
25
25
  }
26
- function He(e) {
26
+ function nt(e) {
27
27
  return Object.getPrototypeOf(e) === Set.prototype;
28
28
  }
29
- function Ne(e) {
29
+ function rt(e) {
30
30
  return Object.getPrototypeOf(e) === Map.prototype;
31
31
  }
32
- function A(e) {
32
+ function x(e) {
33
33
  var t;
34
34
  return (t = e.copy) !== null && t !== void 0 ? t : e.original;
35
35
  }
36
- function Q(e) {
37
- return !!h(e);
36
+ function K(e) {
37
+ return !!d(e);
38
38
  }
39
- function h(e) {
40
- return typeof e != "object" ? null : e?.[Ot];
39
+ function d(e) {
40
+ return typeof e != "object" ? null : e?.[en];
41
41
  }
42
- function Le(e) {
42
+ function it(e) {
43
43
  var t;
44
- const n = h(e);
44
+ const n = d(e);
45
45
  return n ? (t = n.copy) !== null && t !== void 0 ? t : n.original : e;
46
46
  }
47
- function T(e, t) {
47
+ function $(e, t) {
48
48
  if (!e || typeof e != "object")
49
49
  return !1;
50
50
  let n;
51
- return Object.getPrototypeOf(e) === Object.prototype || Array.isArray(e) || e instanceof Map || e instanceof Set || !!t?.mark && ((n = t.mark(e, M)) === M.immutable || typeof n == "function");
51
+ return Object.getPrototypeOf(e) === Object.prototype || Array.isArray(e) || e instanceof Map || e instanceof Set || !!t?.mark && ((n = t.mark(e, E)) === E.immutable || typeof n == "function");
52
52
  }
53
- function Ct(e, t = []) {
53
+ function tn(e, t = []) {
54
54
  if (Object.hasOwnProperty.call(e, "key")) {
55
- const n = e.parent.copy, r = h(F(n, e.key));
55
+ const n = e.parent.copy, r = d(q(n, e.key));
56
56
  if (r !== null && r?.original !== e.original)
57
57
  return null;
58
- const s = e.parent.type === 3, i = s ? Array.from(e.parent.setMap.keys()).indexOf(e.key) : e.key;
59
- if (!(s && n.size > i || te(n, i)))
58
+ const i = e.parent.type === 3, s = i ? Array.from(e.parent.setMap.keys()).indexOf(e.key) : e.key;
59
+ if (!(i && n.size > s || he(n, s)))
60
60
  return null;
61
- t.push(i);
61
+ t.push(s);
62
62
  }
63
63
  if (e.parent)
64
- return Ct(e.parent, t);
64
+ return tn(e.parent, t);
65
65
  t.reverse();
66
66
  try {
67
- Vt(e.copy, t);
67
+ Ln(e.copy, t);
68
68
  } catch {
69
69
  return null;
70
70
  }
71
71
  return t;
72
72
  }
73
- function K(e) {
73
+ function ee(e) {
74
74
  return Array.isArray(e) ? 1 : e instanceof Map ? 2 : e instanceof Set ? 3 : 0;
75
75
  }
76
- function F(e, t) {
77
- return K(e) === 2 ? e.get(t) : e[t];
76
+ function q(e, t) {
77
+ return ee(e) === 2 ? e.get(t) : e[t];
78
78
  }
79
- function ae(e, t, n) {
80
- K(e) === 2 ? e.set(t, n) : e[t] = n;
79
+ function be(e, t, n) {
80
+ ee(e) === 2 ? e.set(t, n) : e[t] = n;
81
81
  }
82
- function Oe(e, t) {
83
- const n = h(e);
84
- return (n ? A(n) : e)[t];
82
+ function Ne(e, t) {
83
+ const n = d(e);
84
+ return (n ? x(n) : e)[t];
85
85
  }
86
- function j(e, t) {
86
+ function H(e, t) {
87
87
  return e === t ? e !== 0 || 1 / e === 1 / t : e !== e && t !== t;
88
88
  }
89
- function Ee(e) {
89
+ function Be(e) {
90
90
  if (e)
91
91
  for (; e.finalities.revoke.length > 0; )
92
92
  e.finalities.revoke.pop()();
93
93
  }
94
- function U(e, t) {
94
+ function J(e, t) {
95
95
  return t ? e : [""].concat(e).map((n) => {
96
96
  const r = `${n}`;
97
97
  return r.indexOf("/") === -1 && r.indexOf("~") === -1 ? r : r.replace(/~/g, "~0").replace(/\//g, "~1");
98
98
  }).join("/");
99
99
  }
100
- function Vt(e, t) {
100
+ function Ln(e, t) {
101
101
  for (let n = 0; n < t.length - 1; n += 1) {
102
102
  const r = t[n];
103
- if (e = F(K(e) === 3 ? Array.from(e) : e, r), typeof e != "object")
103
+ if (e = q(ee(e) === 3 ? Array.from(e) : e, r), typeof e != "object")
104
104
  throw new Error(`Cannot resolve patch at '${t.join("/")}'.`);
105
105
  }
106
106
  return e;
107
107
  }
108
- function Zt(e) {
108
+ function qn(e) {
109
109
  const t = Object.create(Object.getPrototypeOf(e));
110
110
  return Reflect.ownKeys(e).forEach((n) => {
111
111
  let r = Reflect.getOwnPropertyDescriptor(e, n);
@@ -121,26 +121,26 @@ function Zt(e) {
121
121
  }), Reflect.defineProperty(t, n, r);
122
122
  }), t;
123
123
  }
124
- const Jt = Object.prototype.propertyIsEnumerable;
125
- function At(e, t) {
124
+ const Qn = Object.prototype.propertyIsEnumerable;
125
+ function nn(e, t) {
126
126
  let n;
127
127
  if (Array.isArray(e))
128
128
  return Array.prototype.concat.call(e);
129
129
  if (e instanceof Set) {
130
- if (!He(e)) {
130
+ if (!nt(e)) {
131
131
  const r = Object.getPrototypeOf(e).constructor;
132
132
  return new r(e.values());
133
133
  }
134
134
  return Set.prototype.difference ? Set.prototype.difference.call(e, /* @__PURE__ */ new Set()) : new Set(e.values());
135
135
  } else if (e instanceof Map) {
136
- if (!Ne(e)) {
136
+ if (!rt(e)) {
137
137
  const r = Object.getPrototypeOf(e).constructor;
138
138
  return new r(e);
139
139
  }
140
140
  return new Map(e);
141
- } else if (t?.mark && (n = t.mark(e, M), n !== void 0) && n !== M.mutable) {
142
- if (n === M.immutable)
143
- return Zt(e);
141
+ } else if (t?.mark && (n = t.mark(e, E), n !== void 0) && n !== E.mutable) {
142
+ if (n === E.immutable)
143
+ return qn(e);
144
144
  if (typeof n == "function") {
145
145
  if (t.enablePatches || t.enableAutoFreeze)
146
146
  throw new Error("You can't use mark and patches or auto freeze together.");
@@ -149,36 +149,36 @@ function At(e, t) {
149
149
  throw new Error(`Unsupported mark result: ${n}`);
150
150
  } else if (typeof e == "object" && Object.getPrototypeOf(e) === Object.prototype) {
151
151
  const r = {};
152
- return Object.keys(e).forEach((s) => {
153
- r[s] = e[s];
154
- }), Object.getOwnPropertySymbols(e).forEach((s) => {
155
- Jt.call(e, s) && (r[s] = e[s]);
152
+ return Object.keys(e).forEach((i) => {
153
+ r[i] = e[i];
154
+ }), Object.getOwnPropertySymbols(e).forEach((i) => {
155
+ Qn.call(e, i) && (r[i] = e[i]);
156
156
  }), r;
157
157
  } else
158
158
  throw new Error("Please check mark() to ensure that it is a stable marker draftable function.");
159
159
  }
160
- function S(e) {
161
- e.copy || (e.copy = At(e.original, e.options));
160
+ function A(e) {
161
+ e.copy || (e.copy = nn(e.original, e.options));
162
162
  }
163
- function ee(e) {
164
- if (!T(e))
165
- return Le(e);
163
+ function le(e) {
164
+ if (!$(e))
165
+ return it(e);
166
166
  if (Array.isArray(e))
167
- return e.map(ee);
167
+ return e.map(le);
168
168
  if (e instanceof Map) {
169
- const n = Array.from(e.entries()).map(([r, s]) => [
169
+ const n = Array.from(e.entries()).map(([r, i]) => [
170
170
  r,
171
- ee(s)
171
+ le(i)
172
172
  ]);
173
- if (!Ne(e)) {
173
+ if (!rt(e)) {
174
174
  const r = Object.getPrototypeOf(e).constructor;
175
175
  return new r(n);
176
176
  }
177
177
  return new Map(n);
178
178
  }
179
179
  if (e instanceof Set) {
180
- const n = Array.from(e).map(ee);
181
- if (!He(e)) {
180
+ const n = Array.from(e).map(le);
181
+ if (!nt(e)) {
182
182
  const r = Object.getPrototypeOf(e).constructor;
183
183
  return new r(n);
184
184
  }
@@ -186,196 +186,196 @@ function ee(e) {
186
186
  }
187
187
  const t = Object.create(Object.getPrototypeOf(e));
188
188
  for (const n in e)
189
- t[n] = ee(e[n]);
189
+ t[n] = le(e[n]);
190
190
  return t;
191
191
  }
192
- function le(e) {
193
- return Q(e) ? ee(e) : e;
192
+ function we(e) {
193
+ return K(e) ? le(e) : e;
194
194
  }
195
- function x(e) {
195
+ function z(e) {
196
196
  var t;
197
- e.assignedMap = (t = e.assignedMap) !== null && t !== void 0 ? t : /* @__PURE__ */ new Map(), e.operated || (e.operated = !0, e.parent && x(e.parent));
197
+ e.assignedMap = (t = e.assignedMap) !== null && t !== void 0 ? t : /* @__PURE__ */ new Map(), e.operated || (e.operated = !0, e.parent && z(e.parent));
198
198
  }
199
- function Ve() {
199
+ function gt() {
200
200
  throw new Error("Cannot modify frozen object");
201
201
  }
202
- function X(e, t, n, r, s) {
202
+ function se(e, t, n, r, i) {
203
203
  {
204
- n = n ?? /* @__PURE__ */ new WeakMap(), r = r ?? [], s = s ?? [];
204
+ n = n ?? /* @__PURE__ */ new WeakMap(), r = r ?? [], i = i ?? [];
205
205
  const o = n.has(e) ? n.get(e) : e;
206
206
  if (r.length > 0) {
207
207
  const a = r.indexOf(o);
208
208
  if (o && typeof o == "object" && a !== -1)
209
- throw r[0] === o ? new Error("Forbids circular reference") : new Error(`Forbids circular reference: ~/${s.slice(0, a).map((c, u) => {
209
+ throw r[0] === o ? new Error("Forbids circular reference") : new Error(`Forbids circular reference: ~/${i.slice(0, a).map((c, u) => {
210
210
  if (typeof c == "symbol")
211
211
  return `[${c.toString()}]`;
212
- const f = r[u];
213
- return typeof c == "object" && (f instanceof Map || f instanceof Set) ? Array.from(f.keys()).indexOf(c) : c;
212
+ const l = r[u];
213
+ return typeof c == "object" && (l instanceof Map || l instanceof Set) ? Array.from(l.keys()).indexOf(c) : c;
214
214
  }).join("/")}`);
215
- r.push(o), s.push(t);
215
+ r.push(o), i.push(t);
216
216
  } else
217
217
  r.push(o);
218
218
  }
219
- if (Object.isFrozen(e) || Q(e)) {
220
- r.pop(), s.pop();
219
+ if (Object.isFrozen(e) || K(e)) {
220
+ r.pop(), i.pop();
221
221
  return;
222
222
  }
223
- switch (K(e)) {
223
+ switch (ee(e)) {
224
224
  case 2:
225
225
  for (const [a, c] of e)
226
- X(a, a, n, r, s), X(c, a, n, r, s);
227
- e.set = e.clear = e.delete = Ve;
226
+ se(a, a, n, r, i), se(c, a, n, r, i);
227
+ e.set = e.clear = e.delete = gt;
228
228
  break;
229
229
  case 3:
230
230
  for (const a of e)
231
- X(a, a, n, r, s);
232
- e.add = e.clear = e.delete = Ve;
231
+ se(a, a, n, r, i);
232
+ e.add = e.clear = e.delete = gt;
233
233
  break;
234
234
  case 1:
235
235
  Object.freeze(e);
236
236
  let o = 0;
237
237
  for (const a of e)
238
- X(a, o, n, r, s), o += 1;
238
+ se(a, o, n, r, i), o += 1;
239
239
  break;
240
240
  default:
241
241
  Object.freeze(e), Object.keys(e).forEach((a) => {
242
242
  const c = e[a];
243
- X(c, a, n, r, s);
243
+ se(c, a, n, r, i);
244
244
  });
245
245
  }
246
- r.pop(), s.pop();
246
+ r.pop(), i.pop();
247
247
  }
248
- function qe(e, t) {
249
- const n = K(e);
248
+ function st(e, t) {
249
+ const n = ee(e);
250
250
  if (n === 0)
251
251
  Reflect.ownKeys(e).forEach((r) => {
252
252
  t(r, e[r], e);
253
253
  });
254
254
  else if (n === 1) {
255
255
  let r = 0;
256
- for (const s of e)
257
- t(r, s, e), r += 1;
256
+ for (const i of e)
257
+ t(r, i, e), r += 1;
258
258
  } else
259
- e.forEach((r, s) => t(s, r, e));
259
+ e.forEach((r, i) => t(i, r, e));
260
260
  }
261
- function Mt(e, t, n) {
262
- if (Q(e) || !T(e, n) || t.has(e) || Object.isFrozen(e))
261
+ function rn(e, t, n) {
262
+ if (K(e) || !$(e, n) || t.has(e) || Object.isFrozen(e))
263
263
  return;
264
- const r = e instanceof Set, s = r ? /* @__PURE__ */ new Map() : void 0;
265
- if (t.add(e), qe(e, (i, o) => {
264
+ const r = e instanceof Set, i = r ? /* @__PURE__ */ new Map() : void 0;
265
+ if (t.add(e), st(e, (s, o) => {
266
266
  var a;
267
- if (Q(o)) {
268
- const c = h(o);
269
- S(c);
267
+ if (K(o)) {
268
+ const c = d(o);
269
+ A(c);
270
270
  const u = !((a = c.assignedMap) === null || a === void 0) && a.size || c.operated ? c.copy : c.original;
271
- ae(r ? s : e, i, u);
271
+ be(r ? i : e, s, u);
272
272
  } else
273
- Mt(o, t, n);
274
- }), s) {
275
- const i = e, o = Array.from(i);
276
- i.clear(), o.forEach((a) => {
277
- i.add(s.has(a) ? s.get(a) : a);
273
+ rn(o, t, n);
274
+ }), i) {
275
+ const s = e, o = Array.from(s);
276
+ s.clear(), o.forEach((a) => {
277
+ s.add(i.has(a) ? i.get(a) : a);
278
278
  });
279
279
  }
280
280
  }
281
- function kt(e, t) {
281
+ function Bn(e, t) {
282
282
  const n = e.type === 3 ? e.setMap : e.copy;
283
- e.finalities.revoke.length > 1 && e.assignedMap.get(t) && n && Mt(F(n, t), e.finalities.handledSet, e.options);
283
+ e.finalities.revoke.length > 1 && e.assignedMap.get(t) && n && rn(q(n, t), e.finalities.handledSet, e.options);
284
284
  }
285
- function Pe(e) {
285
+ function Ue(e) {
286
286
  e.type === 3 && e.copy && (e.copy.clear(), e.setMap.forEach((t) => {
287
- e.copy.add(Le(t));
287
+ e.copy.add(it(t));
288
288
  }));
289
289
  }
290
- function Te(e, t, n, r) {
290
+ function Ge(e, t, n, r) {
291
291
  if (e.operated && e.assignedMap && e.assignedMap.size > 0 && !e.finalized) {
292
292
  if (n && r) {
293
- const i = Ct(e);
294
- i && t(e, i, n, r);
293
+ const s = tn(e);
294
+ s && t(e, s, n, r);
295
295
  }
296
296
  e.finalized = !0;
297
297
  }
298
298
  }
299
- function Qe(e, t, n, r) {
300
- const s = h(n);
301
- s && (s.callbacks || (s.callbacks = []), s.callbacks.push((i, o) => {
299
+ function ot(e, t, n, r) {
300
+ const i = d(n);
301
+ i && (i.callbacks || (i.callbacks = []), i.callbacks.push((s, o) => {
302
302
  var a;
303
303
  const c = e.type === 3 ? e.setMap : e.copy;
304
- if (j(F(c, t), n)) {
305
- let u = s.original;
306
- s.copy && (u = s.copy), Pe(e), Te(e, r, i, o), e.options.enableAutoFreeze && (e.options.updatedValues = (a = e.options.updatedValues) !== null && a !== void 0 ? a : /* @__PURE__ */ new WeakMap(), e.options.updatedValues.set(u, s.original)), ae(c, t, u);
304
+ if (H(q(c, t), n)) {
305
+ let u = i.original;
306
+ i.copy && (u = i.copy), Ue(e), Ge(e, r, s, o), e.options.enableAutoFreeze && (e.options.updatedValues = (a = e.options.updatedValues) !== null && a !== void 0 ? a : /* @__PURE__ */ new WeakMap(), e.options.updatedValues.set(u, i.original)), be(c, t, u);
307
307
  }
308
- }), e.options.enableAutoFreeze && s.finalities !== e.finalities && (e.options.enableAutoFreeze = !1)), T(n, e.options) && e.finalities.draft.push(() => {
309
- const i = e.type === 3 ? e.setMap : e.copy;
310
- j(F(i, t), n) && kt(e, t);
308
+ }), e.options.enableAutoFreeze && i.finalities !== e.finalities && (e.options.enableAutoFreeze = !1)), $(n, e.options) && e.finalities.draft.push(() => {
309
+ const s = e.type === 3 ? e.setMap : e.copy;
310
+ H(q(s, t), n) && Bn(e, t);
311
311
  });
312
312
  }
313
- function en(e, t, n, r, s) {
314
- let { original: i, assignedMap: o, options: a } = e, c = e.copy;
315
- c.length < i.length && ([i, c] = [c, i], [n, r] = [r, n]);
316
- for (let u = 0; u < i.length; u += 1)
317
- if (o.get(u.toString()) && c[u] !== i[u]) {
318
- const f = t.concat([u]), l = U(f, s);
313
+ function Un(e, t, n, r, i) {
314
+ let { original: s, assignedMap: o, options: a } = e, c = e.copy;
315
+ c.length < s.length && ([s, c] = [c, s], [n, r] = [r, n]);
316
+ for (let u = 0; u < s.length; u += 1)
317
+ if (o.get(u.toString()) && c[u] !== s[u]) {
318
+ const l = t.concat([u]), f = J(l, i);
319
319
  n.push({
320
- op: g.Replace,
321
- path: l,
320
+ op: v.Replace,
321
+ path: f,
322
322
  // If it is a draft, it needs to be deep cloned, and it may also be non-draft.
323
- value: le(c[u])
323
+ value: we(c[u])
324
324
  }), r.push({
325
- op: g.Replace,
326
- path: l,
325
+ op: v.Replace,
326
+ path: f,
327
327
  // If it is a draft, it needs to be deep cloned, and it may also be non-draft.
328
- value: le(i[u])
328
+ value: we(s[u])
329
329
  });
330
330
  }
331
- for (let u = i.length; u < c.length; u += 1) {
332
- const f = t.concat([u]), l = U(f, s);
331
+ for (let u = s.length; u < c.length; u += 1) {
332
+ const l = t.concat([u]), f = J(l, i);
333
333
  n.push({
334
- op: g.Add,
335
- path: l,
334
+ op: v.Add,
335
+ path: f,
336
336
  // If it is a draft, it needs to be deep cloned, and it may also be non-draft.
337
- value: le(c[u])
337
+ value: we(c[u])
338
338
  });
339
339
  }
340
- if (i.length < c.length) {
340
+ if (s.length < c.length) {
341
341
  const { arrayLengthAssignment: u = !0 } = a.enablePatches;
342
342
  if (u) {
343
- const f = t.concat(["length"]), l = U(f, s);
343
+ const l = t.concat(["length"]), f = J(l, i);
344
344
  r.push({
345
- op: g.Replace,
346
- path: l,
347
- value: i.length
345
+ op: v.Replace,
346
+ path: f,
347
+ value: s.length
348
348
  });
349
349
  } else
350
- for (let f = c.length; i.length < f; f -= 1) {
351
- const l = t.concat([f - 1]), d = U(l, s);
350
+ for (let l = c.length; s.length < l; l -= 1) {
351
+ const f = t.concat([l - 1]), h = J(f, i);
352
352
  r.push({
353
- op: g.Remove,
354
- path: d
353
+ op: v.Remove,
354
+ path: h
355
355
  });
356
356
  }
357
357
  }
358
358
  }
359
- function tn({ original: e, copy: t, assignedMap: n }, r, s, i, o) {
359
+ function Gn({ original: e, copy: t, assignedMap: n }, r, i, s, o) {
360
360
  n.forEach((a, c) => {
361
- const u = F(e, c), f = le(F(t, c)), l = a ? te(e, c) ? g.Replace : g.Add : g.Remove;
362
- if (j(u, f) && l === g.Replace)
361
+ const u = q(e, c), l = we(q(t, c)), f = a ? he(e, c) ? v.Replace : v.Add : v.Remove;
362
+ if (H(u, l) && f === v.Replace)
363
363
  return;
364
- const d = r.concat(c), y = U(d, o);
365
- s.push(l === g.Remove ? { op: l, path: y } : { op: l, path: y, value: f }), i.push(l === g.Add ? { op: g.Remove, path: y } : l === g.Remove ? { op: g.Add, path: y, value: u } : { op: g.Replace, path: y, value: u });
364
+ const h = r.concat(c), p = J(h, o);
365
+ i.push(f === v.Remove ? { op: f, path: p } : { op: f, path: p, value: l }), s.push(f === v.Add ? { op: v.Remove, path: p } : f === v.Remove ? { op: v.Add, path: p, value: u } : { op: v.Replace, path: p, value: u });
366
366
  });
367
367
  }
368
- function nn({ original: e, copy: t }, n, r, s, i) {
368
+ function Kn({ original: e, copy: t }, n, r, i, s) {
369
369
  let o = 0;
370
370
  e.forEach((a) => {
371
371
  if (!t.has(a)) {
372
- const c = n.concat([o]), u = U(c, i);
372
+ const c = n.concat([o]), u = J(c, s);
373
373
  r.push({
374
- op: g.Remove,
374
+ op: v.Remove,
375
375
  path: u,
376
376
  value: a
377
- }), s.unshift({
378
- op: g.Add,
377
+ }), i.unshift({
378
+ op: v.Add,
379
379
  path: u,
380
380
  value: a
381
381
  });
@@ -383,13 +383,13 @@ function nn({ original: e, copy: t }, n, r, s, i) {
383
383
  o += 1;
384
384
  }), o = 0, t.forEach((a) => {
385
385
  if (!e.has(a)) {
386
- const c = n.concat([o]), u = U(c, i);
386
+ const c = n.concat([o]), u = J(c, s);
387
387
  r.push({
388
- op: g.Add,
388
+ op: v.Add,
389
389
  path: u,
390
390
  value: a
391
- }), s.unshift({
392
- op: g.Remove,
391
+ }), i.unshift({
392
+ op: v.Remove,
393
393
  path: u,
394
394
  value: a
395
395
  });
@@ -397,74 +397,74 @@ function nn({ original: e, copy: t }, n, r, s, i) {
397
397
  o += 1;
398
398
  });
399
399
  }
400
- function re(e, t, n, r) {
401
- const { pathAsArray: s = !0 } = e.options.enablePatches;
400
+ function _e(e, t, n, r) {
401
+ const { pathAsArray: i = !0 } = e.options.enablePatches;
402
402
  switch (e.type) {
403
403
  case 0:
404
404
  case 2:
405
- return tn(e, t, n, r, s);
405
+ return Gn(e, t, n, r, i);
406
406
  case 1:
407
- return en(e, t, n, r, s);
407
+ return Un(e, t, n, r, i);
408
408
  case 3:
409
- return nn(e, t, n, r, s);
409
+ return Kn(e, t, n, r, i);
410
410
  }
411
411
  }
412
- const he = (e, t, n = !1) => {
413
- if (typeof e == "object" && e !== null && (!T(e, t) || n))
412
+ const Ae = (e, t, n = !1) => {
413
+ if (typeof e == "object" && e !== null && (!$(e, t) || n))
414
414
  throw new Error("Strict mode: Mutable data cannot be accessed directly, please use 'unsafe(callback)' wrap.");
415
- }, xe = {
415
+ }, Ke = {
416
416
  get size() {
417
- return A(h(this)).size;
417
+ return x(d(this)).size;
418
418
  },
419
419
  has(e) {
420
- return A(h(this)).has(e);
420
+ return x(d(this)).has(e);
421
421
  },
422
422
  set(e, t) {
423
- const n = h(this), r = A(n);
424
- return (!r.has(e) || !j(r.get(e), t)) && (S(n), x(n), n.assignedMap.set(e, !0), n.copy.set(e, t), Qe(n, e, t, re)), this;
423
+ const n = d(this), r = x(n);
424
+ return (!r.has(e) || !H(r.get(e), t)) && (A(n), z(n), n.assignedMap.set(e, !0), n.copy.set(e, t), ot(n, e, t, _e)), this;
425
425
  },
426
426
  delete(e) {
427
427
  if (!this.has(e))
428
428
  return !1;
429
- const t = h(this);
430
- return S(t), x(t), t.original.has(e) ? t.assignedMap.set(e, !1) : t.assignedMap.delete(e), t.copy.delete(e), !0;
429
+ const t = d(this);
430
+ return A(t), z(t), t.original.has(e) ? t.assignedMap.set(e, !1) : t.assignedMap.delete(e), t.copy.delete(e), !0;
431
431
  },
432
432
  clear() {
433
- const e = h(this);
433
+ const e = d(this);
434
434
  if (this.size) {
435
- S(e), x(e), e.assignedMap = /* @__PURE__ */ new Map();
435
+ A(e), z(e), e.assignedMap = /* @__PURE__ */ new Map();
436
436
  for (const [t] of e.original)
437
437
  e.assignedMap.set(t, !1);
438
438
  e.copy.clear();
439
439
  }
440
440
  },
441
441
  forEach(e, t) {
442
- const n = h(this);
443
- A(n).forEach((r, s) => {
444
- e.call(t, this.get(s), s, this);
442
+ const n = d(this);
443
+ x(n).forEach((r, i) => {
444
+ e.call(t, this.get(i), i, this);
445
445
  });
446
446
  },
447
447
  get(e) {
448
448
  var t, n;
449
- const r = h(this), s = A(r).get(e), i = ((n = (t = r.options).mark) === null || n === void 0 ? void 0 : n.call(t, s, M)) === M.mutable;
450
- if (r.options.strict && he(s, r.options, i), i || r.finalized || !T(s, r.options) || s !== r.original.get(e))
451
- return s;
452
- const o = De.createDraft({
453
- original: s,
449
+ const r = d(this), i = x(r).get(e), s = ((n = (t = r.options).mark) === null || n === void 0 ? void 0 : n.call(t, i, E)) === E.mutable;
450
+ if (r.options.strict && Ae(i, r.options, s), s || r.finalized || !$(i, r.options) || i !== r.original.get(e))
451
+ return i;
452
+ const o = tt.createDraft({
453
+ original: i,
454
454
  parentDraft: r,
455
455
  key: e,
456
456
  finalities: r.finalities,
457
457
  options: r.options
458
458
  });
459
- return S(r), r.copy.set(e, o), o;
459
+ return A(r), r.copy.set(e, o), o;
460
460
  },
461
461
  keys() {
462
- return A(h(this)).keys();
462
+ return x(d(this)).keys();
463
463
  },
464
464
  values() {
465
465
  const e = this.keys();
466
466
  return {
467
- [fe]: () => this.values(),
467
+ [ve]: () => this.values(),
468
468
  next: () => {
469
469
  const t = e.next();
470
470
  return t.done ? t : {
@@ -477,7 +477,7 @@ const he = (e, t, n = !1) => {
477
477
  entries() {
478
478
  const e = this.keys();
479
479
  return {
480
- [fe]: () => this.entries(),
480
+ [ve]: () => this.entries(),
481
481
  next: () => {
482
482
  const t = e.next();
483
483
  if (t.done)
@@ -490,80 +490,80 @@ const he = (e, t, n = !1) => {
490
490
  }
491
491
  };
492
492
  },
493
- [fe]() {
493
+ [ve]() {
494
494
  return this.entries();
495
495
  }
496
- }, rn = Reflect.ownKeys(xe), Ze = (e, t, { isValuesIterator: n }) => () => {
497
- var r, s;
498
- const i = t.next();
499
- if (i.done)
500
- return i;
501
- const o = i.value;
496
+ }, Wn = Reflect.ownKeys(Ke), bt = (e, t, { isValuesIterator: n }) => () => {
497
+ var r, i;
498
+ const s = t.next();
499
+ if (s.done)
500
+ return s;
501
+ const o = s.value;
502
502
  let a = e.setMap.get(o);
503
- const c = h(a), u = ((s = (r = e.options).mark) === null || s === void 0 ? void 0 : s.call(r, a, M)) === M.mutable;
504
- if (e.options.strict && he(o, e.options, u), !u && !c && T(o, e.options) && !e.finalized && e.original.has(o)) {
505
- const f = De.createDraft({
503
+ const c = d(a), u = ((i = (r = e.options).mark) === null || i === void 0 ? void 0 : i.call(r, a, E)) === E.mutable;
504
+ if (e.options.strict && Ae(o, e.options, u), !u && !c && $(o, e.options) && !e.finalized && e.original.has(o)) {
505
+ const l = tt.createDraft({
506
506
  original: o,
507
507
  parentDraft: e,
508
508
  key: o,
509
509
  finalities: e.finalities,
510
510
  options: e.options
511
511
  });
512
- e.setMap.set(o, f), a = f;
512
+ e.setMap.set(o, l), a = l;
513
513
  } else c && (a = c.proxy);
514
514
  return {
515
515
  done: !1,
516
516
  value: n ? a : [a, a]
517
517
  };
518
- }, pe = {
518
+ }, Pe = {
519
519
  get size() {
520
- return h(this).setMap.size;
520
+ return d(this).setMap.size;
521
521
  },
522
522
  has(e) {
523
- const t = h(this);
523
+ const t = d(this);
524
524
  if (t.setMap.has(e))
525
525
  return !0;
526
- S(t);
527
- const n = h(e);
526
+ A(t);
527
+ const n = d(e);
528
528
  return !!(n && t.setMap.has(n.original));
529
529
  },
530
530
  add(e) {
531
- const t = h(this);
532
- return this.has(e) || (S(t), x(t), t.assignedMap.set(e, !0), t.setMap.set(e, e), Qe(t, e, e, re)), this;
531
+ const t = d(this);
532
+ return this.has(e) || (A(t), z(t), t.assignedMap.set(e, !0), t.setMap.set(e, e), ot(t, e, e, _e)), this;
533
533
  },
534
534
  delete(e) {
535
535
  if (!this.has(e))
536
536
  return !1;
537
- const t = h(this);
538
- S(t), x(t);
539
- const n = h(e);
537
+ const t = d(this);
538
+ A(t), z(t);
539
+ const n = d(e);
540
540
  return n && t.setMap.has(n.original) ? (t.assignedMap.set(n.original, !1), t.setMap.delete(n.original)) : (!n && t.setMap.has(e) ? t.assignedMap.set(e, !1) : t.assignedMap.delete(e), t.setMap.delete(e));
541
541
  },
542
542
  clear() {
543
543
  if (!this.size)
544
544
  return;
545
- const e = h(this);
546
- S(e), x(e);
545
+ const e = d(this);
546
+ A(e), z(e);
547
547
  for (const t of e.original)
548
548
  e.assignedMap.set(t, !1);
549
549
  e.setMap.clear();
550
550
  },
551
551
  values() {
552
- const e = h(this);
553
- S(e);
552
+ const e = d(this);
553
+ A(e);
554
554
  const t = e.setMap.keys();
555
555
  return {
556
556
  [Symbol.iterator]: () => this.values(),
557
- next: Ze(e, t, { isValuesIterator: !0 })
557
+ next: bt(e, t, { isValuesIterator: !0 })
558
558
  };
559
559
  },
560
560
  entries() {
561
- const e = h(this);
562
- S(e);
561
+ const e = d(this);
562
+ A(e);
563
563
  const t = e.setMap.keys();
564
564
  return {
565
565
  [Symbol.iterator]: () => this.entries(),
566
- next: Ze(e, t, {
566
+ next: bt(e, t, {
567
567
  isValuesIterator: !1
568
568
  })
569
569
  };
@@ -571,7 +571,7 @@ const he = (e, t, n = !1) => {
571
571
  keys() {
572
572
  return this.values();
573
573
  },
574
- [fe]() {
574
+ [ve]() {
575
575
  return this.values();
576
576
  },
577
577
  forEach(e, t) {
@@ -581,7 +581,7 @@ const he = (e, t, n = !1) => {
581
581
  e.call(t, r.value, r.value, this), r = n.next();
582
582
  }
583
583
  };
584
- Set.prototype.difference && Object.assign(pe, {
584
+ Set.prototype.difference && Object.assign(Pe, {
585
585
  intersection(e) {
586
586
  return Set.prototype.intersection.call(new Set(this.values()), e);
587
587
  },
@@ -604,71 +604,71 @@ Set.prototype.difference && Object.assign(pe, {
604
604
  return Set.prototype.isDisjointFrom.call(new Set(this.values()), e);
605
605
  }
606
606
  });
607
- const sn = Reflect.ownKeys(pe), Et = {
607
+ const Vn = Reflect.ownKeys(Pe), sn = {
608
608
  get(e, t, n) {
609
- var r, s;
610
- const i = (r = e.copy) === null || r === void 0 ? void 0 : r[t];
611
- if (i && e.finalities.draftsCache.has(i))
612
- return i;
613
- if (t === Ot)
609
+ var r, i;
610
+ const s = (r = e.copy) === null || r === void 0 ? void 0 : r[t];
611
+ if (s && e.finalities.draftsCache.has(s))
612
+ return s;
613
+ if (t === en)
614
614
  return e;
615
615
  let o;
616
616
  if (e.options.mark) {
617
617
  const u = t === "size" && (e.original instanceof Map || e.original instanceof Set) ? Reflect.get(e.original, t) : Reflect.get(e.original, t, n);
618
- if (o = e.options.mark(u, M), o === M.mutable)
619
- return e.options.strict && he(u, e.options, !0), u;
618
+ if (o = e.options.mark(u, E), o === E.mutable)
619
+ return e.options.strict && Ae(u, e.options, !0), u;
620
620
  }
621
- const a = A(e);
622
- if (a instanceof Map && rn.includes(t))
623
- return t === "size" ? Object.getOwnPropertyDescriptor(xe, "size").get.call(e.proxy) : xe[t].bind(e.proxy);
624
- if (a instanceof Set && sn.includes(t))
625
- return t === "size" ? Object.getOwnPropertyDescriptor(pe, "size").get.call(e.proxy) : pe[t].bind(e.proxy);
626
- if (!te(a, t)) {
627
- const u = Ye(a, t);
621
+ const a = x(e);
622
+ if (a instanceof Map && Wn.includes(t))
623
+ return t === "size" ? Object.getOwnPropertyDescriptor(Ke, "size").get.call(e.proxy) : Ke[t].bind(e.proxy);
624
+ if (a instanceof Set && Vn.includes(t))
625
+ return t === "size" ? Object.getOwnPropertyDescriptor(Pe, "size").get.call(e.proxy) : Pe[t].bind(e.proxy);
626
+ if (!he(a, t)) {
627
+ const u = yt(a, t);
628
628
  return u ? "value" in u ? u.value : (
629
629
  // !case: support for getter
630
- (s = u.get) === null || s === void 0 ? void 0 : s.call(e.proxy)
630
+ (i = u.get) === null || i === void 0 ? void 0 : i.call(e.proxy)
631
631
  ) : void 0;
632
632
  }
633
633
  const c = a[t];
634
- if (e.options.strict && he(c, e.options), e.finalized || !T(c, e.options))
634
+ if (e.options.strict && Ae(c, e.options), e.finalized || !$(c, e.options))
635
635
  return c;
636
- if (c === Oe(e.original, t)) {
637
- if (S(e), e.copy[t] = Ge({
636
+ if (c === Ne(e.original, t)) {
637
+ if (A(e), e.copy[t] = at({
638
638
  original: e.original[t],
639
639
  parentDraft: e,
640
640
  key: e.type === 1 ? Number(t) : t,
641
641
  finalities: e.finalities,
642
642
  options: e.options
643
643
  }), typeof o == "function") {
644
- const u = h(e.copy[t]);
645
- return S(u), x(u), u.copy;
644
+ const u = d(e.copy[t]);
645
+ return A(u), z(u), u.copy;
646
646
  }
647
647
  return e.copy[t];
648
648
  }
649
- return Q(c) && e.finalities.draftsCache.add(c), c;
649
+ return K(c) && e.finalities.draftsCache.add(c), c;
650
650
  },
651
651
  set(e, t, n) {
652
652
  var r;
653
653
  if (e.type === 3 || e.type === 2)
654
654
  throw new Error("Map/Set draft does not support any property assignment.");
655
- let s;
656
- if (e.type === 1 && t !== "length" && !(Number.isInteger(s = Number(t)) && s >= 0 && (t === 0 || s === 0 || String(s) === String(t))))
655
+ let i;
656
+ if (e.type === 1 && t !== "length" && !(Number.isInteger(i = Number(t)) && i >= 0 && (t === 0 || i === 0 || String(i) === String(t))))
657
657
  throw new Error("Only supports setting array indices and the 'length' property.");
658
- const i = Ye(A(e), t);
659
- if (i?.set)
660
- return i.set.call(e.proxy, n), !0;
661
- const o = Oe(A(e), t), a = h(o);
662
- return a && j(a.original, n) ? (e.copy[t] = n, e.assignedMap = (r = e.assignedMap) !== null && r !== void 0 ? r : /* @__PURE__ */ new Map(), e.assignedMap.set(t, !1), !0) : (j(n, o) && (n !== void 0 || te(e.original, t)) || (S(e), x(e), te(e.original, t) && j(n, e.original[t]) ? e.assignedMap.delete(t) : e.assignedMap.set(t, !0), e.copy[t] = n, Qe(e, t, n, re)), !0);
658
+ const s = yt(x(e), t);
659
+ if (s?.set)
660
+ return s.set.call(e.proxy, n), !0;
661
+ const o = Ne(x(e), t), a = d(o);
662
+ return a && H(a.original, n) ? (e.copy[t] = n, e.assignedMap = (r = e.assignedMap) !== null && r !== void 0 ? r : /* @__PURE__ */ new Map(), e.assignedMap.set(t, !1), !0) : (H(n, o) && (n !== void 0 || he(e.original, t)) || (A(e), z(e), he(e.original, t) && H(n, e.original[t]) ? e.assignedMap.delete(t) : e.assignedMap.set(t, !0), e.copy[t] = n, ot(e, t, n, _e)), !0);
663
663
  },
664
664
  has(e, t) {
665
- return t in A(e);
665
+ return t in x(e);
666
666
  },
667
667
  ownKeys(e) {
668
- return Reflect.ownKeys(A(e));
668
+ return Reflect.ownKeys(x(e));
669
669
  },
670
670
  getOwnPropertyDescriptor(e, t) {
671
- const n = A(e), r = Reflect.getOwnPropertyDescriptor(n, t);
671
+ const n = x(e), r = Reflect.getOwnPropertyDescriptor(n, t);
672
672
  return r && {
673
673
  writable: !0,
674
674
  configurable: e.type !== 1 || t !== "length",
@@ -687,62 +687,62 @@ const sn = Reflect.ownKeys(pe), Et = {
687
687
  },
688
688
  deleteProperty(e, t) {
689
689
  var n;
690
- return e.type === 1 ? Et.set.call(this, e, t, void 0, e.proxy) : (Oe(e.original, t) !== void 0 || t in e.original ? (S(e), x(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);
690
+ return e.type === 1 ? sn.set.call(this, e, t, void 0, e.proxy) : (Ne(e.original, t) !== void 0 || t in e.original ? (A(e), z(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);
691
691
  }
692
692
  };
693
- function Ge(e) {
694
- const { original: t, parentDraft: n, key: r, finalities: s, options: i } = e, o = K(t), a = {
693
+ function at(e) {
694
+ const { original: t, parentDraft: n, key: r, finalities: i, options: s } = e, o = ee(t), a = {
695
695
  type: o,
696
696
  finalized: !1,
697
697
  parent: n,
698
698
  original: t,
699
699
  copy: null,
700
700
  proxy: null,
701
- finalities: s,
702
- options: i,
701
+ finalities: i,
702
+ options: s,
703
703
  // Mapping of draft Set items to their corresponding draft values.
704
704
  setMap: o === 3 ? new Map(t.entries()) : void 0
705
705
  };
706
706
  (r || "key" in e) && (a.key = r);
707
- const { proxy: c, revoke: u } = Proxy.revocable(o === 1 ? Object.assign([], a) : a, Et);
708
- if (s.revoke.push(u), a.proxy = c, n) {
709
- const f = n;
710
- f.finalities.draft.push((l, d) => {
711
- var y, m;
712
- const O = h(c);
713
- let v = f.type === 3 ? f.setMap : f.copy;
714
- const w = F(v, r), b = h(w);
715
- if (b) {
716
- let C = b.original;
717
- b.operated && (C = Le(w)), Pe(b), Te(b, re, l, d), f.options.enableAutoFreeze && (f.options.updatedValues = (y = f.options.updatedValues) !== null && y !== void 0 ? y : /* @__PURE__ */ new WeakMap(), f.options.updatedValues.set(C, b.original)), ae(v, r, C);
707
+ const { proxy: c, revoke: u } = Proxy.revocable(o === 1 ? Object.assign([], a) : a, sn);
708
+ if (i.revoke.push(u), a.proxy = c, n) {
709
+ const l = n;
710
+ l.finalities.draft.push((f, h) => {
711
+ var p, g;
712
+ const b = d(c);
713
+ let w = l.type === 3 ? l.setMap : l.copy;
714
+ const C = q(w, r), S = d(C);
715
+ if (S) {
716
+ let P = S.original;
717
+ S.operated && (P = it(C)), Ue(S), Ge(S, _e, f, h), l.options.enableAutoFreeze && (l.options.updatedValues = (p = l.options.updatedValues) !== null && p !== void 0 ? p : /* @__PURE__ */ new WeakMap(), l.options.updatedValues.set(P, S.original)), be(w, r, P);
718
718
  }
719
- (m = O.callbacks) === null || m === void 0 || m.forEach((C) => {
720
- C(l, d);
719
+ (g = b.callbacks) === null || g === void 0 || g.forEach((P) => {
720
+ P(f, h);
721
721
  });
722
722
  });
723
723
  } else {
724
- const f = h(c);
725
- f.finalities.draft.push((l, d) => {
726
- Pe(f), Te(f, re, l, d);
724
+ const l = d(c);
725
+ l.finalities.draft.push((f, h) => {
726
+ Ue(l), Ge(l, _e, f, h);
727
727
  });
728
728
  }
729
729
  return c;
730
730
  }
731
- De.createDraft = Ge;
732
- function on(e, t, n, r, s) {
733
- var i;
734
- const o = h(e), a = (i = o?.original) !== null && i !== void 0 ? i : e, c = !!t.length;
731
+ tt.createDraft = at;
732
+ function Jn(e, t, n, r, i) {
733
+ var s;
734
+ const o = d(e), a = (s = o?.original) !== null && s !== void 0 ? s : e, c = !!t.length;
735
735
  if (o?.operated)
736
736
  for (; o.finalities.draft.length > 0; )
737
737
  o.finalities.draft.pop()(n, r);
738
738
  const u = c ? t[0] : o ? o.operated ? o.copy : o.original : e;
739
- return o && Ee(o), s && X(u, u, o?.options.updatedValues), [
739
+ return o && Be(o), i && se(u, u, o?.options.updatedValues), [
740
740
  u,
741
- n && c ? [{ op: g.Replace, path: [], value: t[0] }] : n,
742
- r && c ? [{ op: g.Replace, path: [], value: a }] : r
741
+ n && c ? [{ op: v.Replace, path: [], value: t[0] }] : n,
742
+ r && c ? [{ op: v.Replace, path: [], value: a }] : r
743
743
  ];
744
744
  }
745
- function an(e, t) {
745
+ function Yn(e, t) {
746
746
  var n;
747
747
  const r = {
748
748
  draft: [],
@@ -750,9 +750,9 @@ function an(e, t) {
750
750
  handledSet: /* @__PURE__ */ new WeakSet(),
751
751
  draftsCache: /* @__PURE__ */ new WeakSet()
752
752
  };
753
- let s, i;
754
- t.enablePatches && (s = [], i = []);
755
- const a = ((n = t.mark) === null || n === void 0 ? void 0 : n.call(t, e, M)) === M.mutable || !T(e, t) ? e : Ge({
753
+ let i, s;
754
+ t.enablePatches && (i = [], s = []);
755
+ const a = ((n = t.mark) === null || n === void 0 ? void 0 : n.call(t, e, E)) === E.mutable || !$(e, t) ? e : at({
756
756
  original: e,
757
757
  parentDraft: null,
758
758
  finalities: r,
@@ -761,242 +761,242 @@ function an(e, t) {
761
761
  return [
762
762
  a,
763
763
  (c = []) => {
764
- const [u, f, l] = on(a, c, s, i, t.enableAutoFreeze);
765
- return t.enablePatches ? [u, f, l] : u;
764
+ const [u, l, f] = Jn(a, c, i, s, t.enableAutoFreeze);
765
+ return t.enablePatches ? [u, l, f] : u;
766
766
  }
767
767
  ];
768
768
  }
769
- function Ie(e) {
770
- const { rootDraft: t, value: n, useRawReturn: r = !1, isRoot: s = !0 } = e;
771
- qe(n, (i, o, a) => {
772
- const c = h(o);
769
+ function We(e) {
770
+ const { rootDraft: t, value: n, useRawReturn: r = !1, isRoot: i = !0 } = e;
771
+ st(n, (s, o, a) => {
772
+ const c = d(o);
773
773
  if (c && t && c.finalities === t.finalities) {
774
774
  e.isContainDraft = !0;
775
775
  const u = c.original;
776
776
  if (a instanceof Set) {
777
- const f = Array.from(a);
778
- a.clear(), f.forEach((l) => a.add(i === l ? u : l));
777
+ const l = Array.from(a);
778
+ a.clear(), l.forEach((f) => a.add(s === f ? u : f));
779
779
  } else
780
- ae(a, i, u);
781
- } else typeof o == "object" && o !== null && (e.value = o, e.isRoot = !1, Ie(e));
782
- }), s && (e.isContainDraft || console.warn("The return value does not contain any draft, please use 'rawReturn()' to wrap the return value to improve performance."), r && console.warn("The return value contains drafts, please don't use 'rawReturn()' to wrap the return value."));
780
+ be(a, s, u);
781
+ } else typeof o == "object" && o !== null && (e.value = o, e.isRoot = !1, We(e));
782
+ }), i && (e.isContainDraft || console.warn("The return value does not contain any draft, please use 'rawReturn()' to wrap the return value to improve performance."), r && console.warn("The return value contains drafts, please don't use 'rawReturn()' to wrap the return value."));
783
783
  }
784
- function Pt(e) {
784
+ function on(e) {
785
785
  var t;
786
- const n = h(e);
787
- if (!T(e, n?.options))
786
+ const n = d(e);
787
+ if (!$(e, n?.options))
788
788
  return e;
789
- const r = K(e);
789
+ const r = ee(e);
790
790
  if (n && !n.operated)
791
791
  return n.original;
792
- let s;
793
- function i() {
794
- s = r === 2 ? Ne(e) ? new Map(e) : new (Object.getPrototypeOf(e)).constructor(e) : r === 3 ? Array.from(n.setMap.values()) : At(e, n?.options);
792
+ let i;
793
+ function s() {
794
+ i = r === 2 ? rt(e) ? new Map(e) : new (Object.getPrototypeOf(e)).constructor(e) : r === 3 ? Array.from(n.setMap.values()) : nn(e, n?.options);
795
795
  }
796
796
  if (n) {
797
797
  n.finalized = !0;
798
798
  try {
799
- i();
799
+ s();
800
800
  } finally {
801
801
  n.finalized = !1;
802
802
  }
803
803
  } else
804
- s = e;
805
- if (qe(s, (o, a) => {
806
- if (n && j(F(n.original, o), a))
804
+ i = e;
805
+ if (st(i, (o, a) => {
806
+ if (n && H(q(n.original, o), a))
807
807
  return;
808
- const c = Pt(a);
809
- c !== a && (s === e && i(), ae(s, o, c));
808
+ const c = on(a);
809
+ c !== a && (i === e && s(), be(i, o, c));
810
810
  }), r === 3) {
811
- const o = (t = n?.original) !== null && t !== void 0 ? t : s;
812
- return He(o) ? new Set(s) : new (Object.getPrototypeOf(o)).constructor(s);
811
+ const o = (t = n?.original) !== null && t !== void 0 ? t : i;
812
+ return nt(o) ? new Set(i) : new (Object.getPrototypeOf(o)).constructor(i);
813
813
  }
814
- return s;
814
+ return i;
815
815
  }
816
- function Je(e) {
817
- if (!Q(e))
816
+ function mt(e) {
817
+ if (!K(e))
818
818
  throw new Error(`current() is only used for Draft, parameter: ${e}`);
819
- return Pt(e);
819
+ return on(e);
820
820
  }
821
- const cn = (e) => function t(n, r, s) {
822
- var i, o, a;
821
+ const Xn = (e) => function t(n, r, i) {
822
+ var s, o, a;
823
823
  if (typeof n == "function" && typeof r != "function")
824
- return function(p, ...R) {
825
- return t(p, (N) => n.call(this, N, ...R), r);
824
+ return function(_, ...D) {
825
+ return t(_, (G) => n.call(this, G, ...D), r);
826
826
  };
827
827
  const c = n, u = r;
828
- let f = s;
829
- if (typeof r != "function" && (f = r), f !== void 0 && Object.prototype.toString.call(f) !== "[object Object]")
830
- throw new Error(`Invalid options: ${f}, 'options' should be an object.`);
831
- f = Object.assign(Object.assign({}, e), f);
832
- const l = Q(c) ? Je(c) : c, d = Array.isArray(f.mark) ? ((p, R) => {
833
- for (const N of f.mark) {
834
- if (typeof N != "function")
835
- throw new Error(`Invalid mark: ${N}, 'mark' should be a function.`);
836
- const J = N(p, R);
837
- if (J)
838
- return J;
828
+ let l = i;
829
+ if (typeof r != "function" && (l = r), l !== void 0 && Object.prototype.toString.call(l) !== "[object Object]")
830
+ throw new Error(`Invalid options: ${l}, 'options' should be an object.`);
831
+ l = Object.assign(Object.assign({}, e), l);
832
+ const f = K(c) ? mt(c) : c, h = Array.isArray(l.mark) ? ((_, D) => {
833
+ for (const G of l.mark) {
834
+ if (typeof G != "function")
835
+ throw new Error(`Invalid mark: ${G}, 'mark' should be a function.`);
836
+ const ce = G(_, D);
837
+ if (ce)
838
+ return ce;
839
839
  }
840
- }) : f.mark, y = (i = f.enablePatches) !== null && i !== void 0 ? i : !1, m = (o = f.strict) !== null && o !== void 0 ? o : !1, v = {
841
- enableAutoFreeze: (a = f.enableAutoFreeze) !== null && a !== void 0 ? a : !1,
842
- mark: d,
843
- strict: m,
844
- enablePatches: y
840
+ }) : l.mark, p = (s = l.enablePatches) !== null && s !== void 0 ? s : !1, g = (o = l.strict) !== null && o !== void 0 ? o : !1, w = {
841
+ enableAutoFreeze: (a = l.enableAutoFreeze) !== null && a !== void 0 ? a : !1,
842
+ mark: h,
843
+ strict: g,
844
+ enablePatches: p
845
845
  };
846
- if (!T(l, v) && typeof l == "object" && l !== null)
846
+ if (!$(f, w) && typeof f == "object" && f !== null)
847
847
  throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");
848
- const [w, b] = an(l, v);
848
+ const [C, S] = Yn(f, w);
849
849
  if (typeof r != "function") {
850
- if (!T(l, v))
850
+ if (!$(f, w))
851
851
  throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");
852
- return [w, b];
852
+ return [C, S];
853
853
  }
854
- let C;
854
+ let P;
855
855
  try {
856
- C = u(w);
857
- } catch (p) {
858
- throw Ee(h(w)), p;
859
- }
860
- const G = (p) => {
861
- const R = h(w);
862
- if (!Q(p)) {
863
- if (p !== void 0 && !j(p, w) && R?.operated)
856
+ P = u(C);
857
+ } catch (_) {
858
+ throw Be(d(C)), _;
859
+ }
860
+ const V = (_) => {
861
+ const D = d(C);
862
+ if (!K(_)) {
863
+ if (_ !== void 0 && !H(_, C) && D?.operated)
864
864
  throw new Error("Either the value is returned as a new non-draft value, or only the draft is modified without returning any value.");
865
- const J = p?.[Yt];
866
- if (J) {
867
- const Wt = J[0];
868
- return v.strict && typeof p == "object" && p !== null && Ie({
869
- rootDraft: R,
870
- value: p,
865
+ const ce = _?.[Hn];
866
+ if (ce) {
867
+ const zn = ce[0];
868
+ return w.strict && typeof _ == "object" && _ !== null && We({
869
+ rootDraft: D,
870
+ value: _,
871
871
  useRawReturn: !0
872
- }), b([Wt]);
872
+ }), S([zn]);
873
873
  }
874
- if (p !== void 0)
875
- return typeof p == "object" && p !== null && Ie({ rootDraft: R, value: p }), b([p]);
874
+ if (_ !== void 0)
875
+ return typeof _ == "object" && _ !== null && We({ rootDraft: D, value: _ }), S([_]);
876
876
  }
877
- if (p === w || p === void 0)
878
- return b([]);
879
- const N = h(p);
880
- if (v === N.options) {
881
- if (N.operated)
877
+ if (_ === C || _ === void 0)
878
+ return S([]);
879
+ const G = d(_);
880
+ if (w === G.options) {
881
+ if (G.operated)
882
882
  throw new Error("Cannot return a modified child draft.");
883
- return b([Je(p)]);
883
+ return S([mt(_)]);
884
884
  }
885
- return b([p]);
885
+ return S([_]);
886
886
  };
887
- return C instanceof Promise ? C.then(G, (p) => {
888
- throw Ee(h(w)), p;
889
- }) : G(C);
890
- }, P = cn();
887
+ return P instanceof Promise ? P.then(V, (_) => {
888
+ throw Be(d(C)), _;
889
+ }) : V(P);
890
+ }, I = Xn();
891
891
  Object.prototype.constructor.toString();
892
- var Tt = typeof global == "object" && global && global.Object === Object && global, un = typeof self == "object" && self && self.Object === Object && self, z = Tt || un || Function("return this")(), I = z.Symbol, xt = Object.prototype, fn = xt.hasOwnProperty, ln = xt.toString, k = I ? I.toStringTag : void 0;
893
- function hn(e) {
894
- var t = fn.call(e, k), n = e[k];
892
+ var an = typeof global == "object" && global && global.Object === Object && global, Zn = typeof self == "object" && self && self.Object === Object && self, Q = an || Zn || Function("return this")(), N = Q.Symbol, cn = Object.prototype, kn = cn.hasOwnProperty, er = cn.toString, ue = N ? N.toStringTag : void 0;
893
+ function tr(e) {
894
+ var t = kn.call(e, ue), n = e[ue];
895
895
  try {
896
- e[k] = void 0;
896
+ e[ue] = void 0;
897
897
  var r = !0;
898
898
  } catch {
899
899
  }
900
- var s = ln.call(e);
901
- return r && (t ? e[k] = n : delete e[k]), s;
900
+ var i = er.call(e);
901
+ return r && (t ? e[ue] = n : delete e[ue]), i;
902
902
  }
903
- var pn = Object.prototype, dn = pn.toString;
904
- function _n(e) {
905
- return dn.call(e);
903
+ var nr = Object.prototype, rr = nr.toString;
904
+ function ir(e) {
905
+ return rr.call(e);
906
906
  }
907
- var yn = "[object Null]", bn = "[object Undefined]", ke = I ? I.toStringTag : void 0;
908
- function V(e) {
909
- return e == null ? e === void 0 ? bn : yn : ke && ke in Object(e) ? hn(e) : _n(e);
907
+ var sr = "[object Null]", or = "[object Undefined]", St = N ? N.toStringTag : void 0;
908
+ function te(e) {
909
+ return e == null ? e === void 0 ? or : sr : St && St in Object(e) ? tr(e) : ir(e);
910
910
  }
911
- function Y(e) {
911
+ function X(e) {
912
912
  return e != null && typeof e == "object";
913
913
  }
914
- var gn = "[object Symbol]";
915
- function _e(e) {
916
- return typeof e == "symbol" || Y(e) && V(e) == gn;
914
+ var ar = "[object Symbol]";
915
+ function Z(e) {
916
+ return typeof e == "symbol" || X(e) && te(e) == ar;
917
917
  }
918
- function It(e, t) {
919
- for (var n = -1, r = e == null ? 0 : e.length, s = Array(r); ++n < r; )
920
- s[n] = t(e[n], n, e);
921
- return s;
918
+ function de(e, t) {
919
+ for (var n = -1, r = e == null ? 0 : e.length, i = Array(r); ++n < r; )
920
+ i[n] = t(e[n], n, e);
921
+ return i;
922
922
  }
923
- var E = Array.isArray, et = I ? I.prototype : void 0, tt = et ? et.toString : void 0;
924
- function Rt(e) {
923
+ var M = Array.isArray, vt = N ? N.prototype : void 0, wt = vt ? vt.toString : void 0;
924
+ function un(e) {
925
925
  if (typeof e == "string")
926
926
  return e;
927
- if (E(e))
928
- return It(e, Rt) + "";
929
- if (_e(e))
930
- return tt ? tt.call(e) : "";
927
+ if (M(e))
928
+ return de(e, un) + "";
929
+ if (Z(e))
930
+ return wt ? wt.call(e) : "";
931
931
  var t = e + "";
932
932
  return t == "0" && 1 / e == -1 / 0 ? "-0" : t;
933
933
  }
934
- var mn = /\s/;
935
- function wn(e) {
936
- for (var t = e.length; t-- && mn.test(e.charAt(t)); )
934
+ var cr = /\s/;
935
+ function ur(e) {
936
+ for (var t = e.length; t-- && cr.test(e.charAt(t)); )
937
937
  ;
938
938
  return t;
939
939
  }
940
- var vn = /^\s+/;
941
- function Sn(e) {
942
- return e && e.slice(0, wn(e) + 1).replace(vn, "");
940
+ var lr = /^\s+/;
941
+ function fr(e) {
942
+ return e && e.slice(0, ur(e) + 1).replace(lr, "");
943
943
  }
944
- function se(e) {
944
+ function ae(e) {
945
945
  var t = typeof e;
946
946
  return e != null && (t == "object" || t == "function");
947
947
  }
948
- var nt = NaN, On = /^[-+]0x[0-9a-f]+$/i, Cn = /^0b[01]+$/i, An = /^0o[0-7]+$/i, Mn = parseInt;
949
- function En(e) {
948
+ var Ot = NaN, hr = /^[-+]0x[0-9a-f]+$/i, dr = /^0b[01]+$/i, pr = /^0o[0-7]+$/i, _r = parseInt;
949
+ function yr(e) {
950
950
  if (typeof e == "number")
951
951
  return e;
952
- if (_e(e))
953
- return nt;
954
- if (se(e)) {
952
+ if (Z(e))
953
+ return Ot;
954
+ if (ae(e)) {
955
955
  var t = typeof e.valueOf == "function" ? e.valueOf() : e;
956
- e = se(t) ? t + "" : t;
956
+ e = ae(t) ? t + "" : t;
957
957
  }
958
958
  if (typeof e != "string")
959
959
  return e === 0 ? e : +e;
960
- e = Sn(e);
961
- var n = Cn.test(e);
962
- return n || An.test(e) ? Mn(e.slice(2), n ? 2 : 8) : On.test(e) ? nt : +e;
960
+ e = fr(e);
961
+ var n = dr.test(e);
962
+ return n || pr.test(e) ? _r(e.slice(2), n ? 2 : 8) : hr.test(e) ? Ot : +e;
963
963
  }
964
- var rt = 1 / 0, Pn = 17976931348623157e292;
965
- function Tn(e) {
964
+ var Ct = 1 / 0, gr = 17976931348623157e292;
965
+ function br(e) {
966
966
  if (!e)
967
967
  return e === 0 ? e : 0;
968
- if (e = En(e), e === rt || e === -rt) {
968
+ if (e = yr(e), e === Ct || e === -Ct) {
969
969
  var t = e < 0 ? -1 : 1;
970
- return t * Pn;
970
+ return t * gr;
971
971
  }
972
972
  return e === e ? e : 0;
973
973
  }
974
- function xn(e) {
975
- var t = Tn(e), n = t % 1;
974
+ function ln(e) {
975
+ var t = br(e), n = t % 1;
976
976
  return t === t ? n ? t - n : t : 0;
977
977
  }
978
- function In(e) {
978
+ function me(e) {
979
979
  return e;
980
980
  }
981
- var Rn = "[object AsyncFunction]", jn = "[object Function]", $n = "[object GeneratorFunction]", Fn = "[object Proxy]";
982
- function jt(e) {
983
- if (!se(e))
981
+ var mr = "[object AsyncFunction]", Sr = "[object Function]", vr = "[object GeneratorFunction]", wr = "[object Proxy]";
982
+ function fn(e) {
983
+ if (!ae(e))
984
984
  return !1;
985
- var t = V(e);
986
- return t == jn || t == $n || t == Rn || t == Fn;
985
+ var t = te(e);
986
+ return t == Sr || t == vr || t == mr || t == wr;
987
987
  }
988
- var Ce = z["__core-js_shared__"], st = (function() {
989
- var e = /[^.]+$/.exec(Ce && Ce.keys && Ce.keys.IE_PROTO || "");
988
+ var De = Q["__core-js_shared__"], Mt = (function() {
989
+ var e = /[^.]+$/.exec(De && De.keys && De.keys.IE_PROTO || "");
990
990
  return e ? "Symbol(src)_1." + e : "";
991
991
  })();
992
- function zn(e) {
993
- return !!st && st in e;
992
+ function Or(e) {
993
+ return !!Mt && Mt in e;
994
994
  }
995
- var Dn = Function.prototype, Hn = Dn.toString;
996
- function W(e) {
995
+ var Cr = Function.prototype, Mr = Cr.toString;
996
+ function ne(e) {
997
997
  if (e != null) {
998
998
  try {
999
- return Hn.call(e);
999
+ return Mr.call(e);
1000
1000
  } catch {
1001
1001
  }
1002
1002
  try {
@@ -1006,393 +1006,474 @@ function W(e) {
1006
1006
  }
1007
1007
  return "";
1008
1008
  }
1009
- var Nn = /[\\^$.*+?()[\]{}|]/g, Ln = /^\[object .+?Constructor\]$/, qn = Function.prototype, Qn = Object.prototype, Gn = qn.toString, Un = Qn.hasOwnProperty, Bn = RegExp(
1010
- "^" + Gn.call(Un).replace(Nn, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
1009
+ var Ar = /[\\^$.*+?()[\]{}|]/g, Pr = /^\[object .+?Constructor\]$/, xr = Function.prototype, Er = Object.prototype, Tr = xr.toString, Rr = Er.hasOwnProperty, Ir = RegExp(
1010
+ "^" + Tr.call(Rr).replace(Ar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
1011
1011
  );
1012
- function Kn(e) {
1013
- if (!se(e) || zn(e))
1012
+ function jr(e) {
1013
+ if (!ae(e) || Or(e))
1014
1014
  return !1;
1015
- var t = jt(e) ? Bn : Ln;
1016
- return t.test(W(e));
1015
+ var t = fn(e) ? Ir : Pr;
1016
+ return t.test(ne(e));
1017
1017
  }
1018
- function Wn(e, t) {
1018
+ function $r(e, t) {
1019
1019
  return e?.[t];
1020
1020
  }
1021
- function Z(e, t) {
1022
- var n = Wn(e, t);
1023
- return Kn(n) ? n : void 0;
1021
+ function re(e, t) {
1022
+ var n = $r(e, t);
1023
+ return jr(n) ? n : void 0;
1024
1024
  }
1025
- var Re = Z(z, "WeakMap");
1026
- function Xn(e, t, n, r) {
1027
- for (var s = e.length, i = n + -1; ++i < s; )
1028
- if (t(e[i], i, e))
1029
- return i;
1025
+ var Ve = re(Q, "WeakMap");
1026
+ function Fr(e, t, n) {
1027
+ switch (n.length) {
1028
+ case 0:
1029
+ return e.call(t);
1030
+ case 1:
1031
+ return e.call(t, n[0]);
1032
+ case 2:
1033
+ return e.call(t, n[0], n[1]);
1034
+ case 3:
1035
+ return e.call(t, n[0], n[1], n[2]);
1036
+ }
1037
+ return e.apply(t, n);
1038
+ }
1039
+ var zr = 800, Nr = 16, Dr = Date.now;
1040
+ function Hr(e) {
1041
+ var t = 0, n = 0;
1042
+ return function() {
1043
+ var r = Dr(), i = Nr - (r - n);
1044
+ if (n = r, i > 0) {
1045
+ if (++t >= zr)
1046
+ return arguments[0];
1047
+ } else
1048
+ t = 0;
1049
+ return e.apply(void 0, arguments);
1050
+ };
1051
+ }
1052
+ function Lr(e) {
1053
+ return function() {
1054
+ return e;
1055
+ };
1056
+ }
1057
+ var At = (function() {
1058
+ try {
1059
+ var e = re(Object, "defineProperty");
1060
+ return e({}, "", {}), e;
1061
+ } catch {
1062
+ }
1063
+ })(), qr = At ? function(e, t) {
1064
+ return At(e, "toString", {
1065
+ configurable: !0,
1066
+ enumerable: !1,
1067
+ value: Lr(t),
1068
+ writable: !0
1069
+ });
1070
+ } : me, Qr = Hr(qr);
1071
+ function Br(e, t) {
1072
+ for (var n = -1, r = e == null ? 0 : e.length; ++n < r && t(e[n], n, e) !== !1; )
1073
+ ;
1074
+ return e;
1075
+ }
1076
+ function Ur(e, t, n, r) {
1077
+ for (var i = e.length, s = n + -1; ++s < i; )
1078
+ if (t(e[s], s, e))
1079
+ return s;
1030
1080
  return -1;
1031
1081
  }
1032
- var Yn = 9007199254740991, Vn = /^(?:0|[1-9]\d*)$/;
1033
- function $t(e, t) {
1082
+ var Gr = 9007199254740991, Kr = /^(?:0|[1-9]\d*)$/;
1083
+ function ct(e, t) {
1034
1084
  var n = typeof e;
1035
- return t = t ?? Yn, !!t && (n == "number" || n != "symbol" && Vn.test(e)) && e > -1 && e % 1 == 0 && e < t;
1085
+ return t = t ?? Gr, !!t && (n == "number" || n != "symbol" && Kr.test(e)) && e > -1 && e % 1 == 0 && e < t;
1036
1086
  }
1037
- function Ft(e, t) {
1087
+ function ut(e, t) {
1038
1088
  return e === t || e !== e && t !== t;
1039
1089
  }
1040
- var Zn = 9007199254740991;
1041
- function Ue(e) {
1042
- return typeof e == "number" && e > -1 && e % 1 == 0 && e <= Zn;
1090
+ var Pt = Math.max;
1091
+ function Wr(e, t, n) {
1092
+ return t = Pt(t === void 0 ? e.length - 1 : t, 0), function() {
1093
+ for (var r = arguments, i = -1, s = Pt(r.length - t, 0), o = Array(s); ++i < s; )
1094
+ o[i] = r[t + i];
1095
+ i = -1;
1096
+ for (var a = Array(t + 1); ++i < t; )
1097
+ a[i] = r[i];
1098
+ return a[t] = n(o), Fr(e, this, a);
1099
+ };
1100
+ }
1101
+ function Vr(e, t) {
1102
+ return Qr(Wr(e, t, me), e + "");
1103
+ }
1104
+ var Jr = 9007199254740991;
1105
+ function lt(e) {
1106
+ return typeof e == "number" && e > -1 && e % 1 == 0 && e <= Jr;
1107
+ }
1108
+ function ie(e) {
1109
+ return e != null && lt(e.length) && !fn(e);
1043
1110
  }
1044
- function ye(e) {
1045
- return e != null && Ue(e.length) && !jt(e);
1111
+ function xt(e, t, n) {
1112
+ if (!ae(n))
1113
+ return !1;
1114
+ var r = typeof t;
1115
+ return (r == "number" ? ie(n) && ct(t, n.length) : r == "string" && t in n) ? ut(n[t], e) : !1;
1046
1116
  }
1047
- var Jn = Object.prototype;
1048
- function kn(e) {
1049
- var t = e && e.constructor, n = typeof t == "function" && t.prototype || Jn;
1117
+ var Yr = Object.prototype;
1118
+ function hn(e) {
1119
+ var t = e && e.constructor, n = typeof t == "function" && t.prototype || Yr;
1050
1120
  return e === n;
1051
1121
  }
1052
- function er(e, t) {
1122
+ function Xr(e, t) {
1053
1123
  for (var n = -1, r = Array(e); ++n < e; )
1054
1124
  r[n] = t(n);
1055
1125
  return r;
1056
1126
  }
1057
- var tr = "[object Arguments]";
1058
- function it(e) {
1059
- return Y(e) && V(e) == tr;
1127
+ var Zr = "[object Arguments]";
1128
+ function Et(e) {
1129
+ return X(e) && te(e) == Zr;
1060
1130
  }
1061
- var zt = Object.prototype, nr = zt.hasOwnProperty, rr = zt.propertyIsEnumerable, Be = it(/* @__PURE__ */ (function() {
1131
+ var dn = Object.prototype, kr = dn.hasOwnProperty, ei = dn.propertyIsEnumerable, Te = Et(/* @__PURE__ */ (function() {
1062
1132
  return arguments;
1063
- })()) ? it : function(e) {
1064
- return Y(e) && nr.call(e, "callee") && !rr.call(e, "callee");
1133
+ })()) ? Et : function(e) {
1134
+ return X(e) && kr.call(e, "callee") && !ei.call(e, "callee");
1065
1135
  };
1066
- function sr() {
1136
+ function ti() {
1067
1137
  return !1;
1068
1138
  }
1069
- var Dt = typeof exports == "object" && exports && !exports.nodeType && exports, ot = Dt && typeof module == "object" && module && !module.nodeType && module, ir = ot && ot.exports === Dt, at = ir ? z.Buffer : void 0, or = at ? at.isBuffer : void 0, je = or || sr, ar = "[object Arguments]", cr = "[object Array]", ur = "[object Boolean]", fr = "[object Date]", lr = "[object Error]", hr = "[object Function]", pr = "[object Map]", dr = "[object Number]", _r = "[object Object]", yr = "[object RegExp]", br = "[object Set]", gr = "[object String]", mr = "[object WeakMap]", wr = "[object ArrayBuffer]", vr = "[object DataView]", Sr = "[object Float32Array]", Or = "[object Float64Array]", Cr = "[object Int8Array]", Ar = "[object Int16Array]", Mr = "[object Int32Array]", Er = "[object Uint8Array]", Pr = "[object Uint8ClampedArray]", Tr = "[object Uint16Array]", xr = "[object Uint32Array]", _ = {};
1070
- _[Sr] = _[Or] = _[Cr] = _[Ar] = _[Mr] = _[Er] = _[Pr] = _[Tr] = _[xr] = !0;
1071
- _[ar] = _[cr] = _[wr] = _[ur] = _[vr] = _[fr] = _[lr] = _[hr] = _[pr] = _[dr] = _[_r] = _[yr] = _[br] = _[gr] = _[mr] = !1;
1072
- function Ir(e) {
1073
- return Y(e) && Ue(e.length) && !!_[V(e)];
1139
+ var pn = typeof exports == "object" && exports && !exports.nodeType && exports, Tt = pn && typeof module == "object" && module && !module.nodeType && module, ni = Tt && Tt.exports === pn, Rt = ni ? Q.Buffer : void 0, ri = Rt ? Rt.isBuffer : void 0, xe = ri || ti, ii = "[object Arguments]", si = "[object Array]", oi = "[object Boolean]", ai = "[object Date]", ci = "[object Error]", ui = "[object Function]", li = "[object Map]", fi = "[object Number]", hi = "[object Object]", di = "[object RegExp]", pi = "[object Set]", _i = "[object String]", yi = "[object WeakMap]", gi = "[object ArrayBuffer]", bi = "[object DataView]", mi = "[object Float32Array]", Si = "[object Float64Array]", vi = "[object Int8Array]", wi = "[object Int16Array]", Oi = "[object Int32Array]", Ci = "[object Uint8Array]", Mi = "[object Uint8ClampedArray]", Ai = "[object Uint16Array]", Pi = "[object Uint32Array]", y = {};
1140
+ y[mi] = y[Si] = y[vi] = y[wi] = y[Oi] = y[Ci] = y[Mi] = y[Ai] = y[Pi] = !0;
1141
+ y[ii] = y[si] = y[gi] = y[oi] = y[bi] = y[ai] = y[ci] = y[ui] = y[li] = y[fi] = y[hi] = y[di] = y[pi] = y[_i] = y[yi] = !1;
1142
+ function xi(e) {
1143
+ return X(e) && lt(e.length) && !!y[te(e)];
1074
1144
  }
1075
- function Rr(e) {
1145
+ function _n(e) {
1076
1146
  return function(t) {
1077
1147
  return e(t);
1078
1148
  };
1079
1149
  }
1080
- var Ht = typeof exports == "object" && exports && !exports.nodeType && exports, ne = Ht && typeof module == "object" && module && !module.nodeType && module, jr = ne && ne.exports === Ht, Ae = jr && Tt.process, ct = (function() {
1150
+ var yn = typeof exports == "object" && exports && !exports.nodeType && exports, pe = yn && typeof module == "object" && module && !module.nodeType && module, Ei = pe && pe.exports === yn, He = Ei && an.process, It = (function() {
1081
1151
  try {
1082
- var e = ne && ne.require && ne.require("util").types;
1083
- return e || Ae && Ae.binding && Ae.binding("util");
1152
+ var e = pe && pe.require && pe.require("util").types;
1153
+ return e || He && He.binding && He.binding("util");
1084
1154
  } catch {
1085
1155
  }
1086
- })(), ut = ct && ct.isTypedArray, Nt = ut ? Rr(ut) : Ir, $r = Object.prototype, Fr = $r.hasOwnProperty;
1087
- function zr(e, t) {
1088
- var n = E(e), r = !n && Be(e), s = !n && !r && je(e), i = !n && !r && !s && Nt(e), o = n || r || s || i, a = o ? er(e.length, String) : [], c = a.length;
1156
+ })(), jt = It && It.isTypedArray, ft = jt ? _n(jt) : xi, Ti = Object.prototype, Ri = Ti.hasOwnProperty;
1157
+ function Ii(e, t) {
1158
+ var n = M(e), r = !n && Te(e), i = !n && !r && xe(e), s = !n && !r && !i && ft(e), o = n || r || i || s, a = o ? Xr(e.length, String) : [], c = a.length;
1089
1159
  for (var u in e)
1090
- Fr.call(e, u) && !(o && // Safari 9 has enumerable `arguments.length` in strict mode.
1160
+ Ri.call(e, u) && !(o && // Safari 9 has enumerable `arguments.length` in strict mode.
1091
1161
  (u == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
1092
- s && (u == "offset" || u == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
1093
- i && (u == "buffer" || u == "byteLength" || u == "byteOffset") || // Skip index properties.
1094
- $t(u, c))) && a.push(u);
1162
+ i && (u == "offset" || u == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
1163
+ s && (u == "buffer" || u == "byteLength" || u == "byteOffset") || // Skip index properties.
1164
+ ct(u, c))) && a.push(u);
1095
1165
  return a;
1096
1166
  }
1097
- function Dr(e, t) {
1167
+ function ji(e, t) {
1098
1168
  return function(n) {
1099
1169
  return e(t(n));
1100
1170
  };
1101
1171
  }
1102
- var Hr = Dr(Object.keys, Object), Nr = Object.prototype, Lr = Nr.hasOwnProperty;
1103
- function qr(e) {
1104
- if (!kn(e))
1105
- return Hr(e);
1172
+ var $i = ji(Object.keys, Object), Fi = Object.prototype, zi = Fi.hasOwnProperty;
1173
+ function ht(e) {
1174
+ if (!hn(e))
1175
+ return $i(e);
1106
1176
  var t = [];
1107
1177
  for (var n in Object(e))
1108
- Lr.call(e, n) && n != "constructor" && t.push(n);
1178
+ zi.call(e, n) && n != "constructor" && t.push(n);
1109
1179
  return t;
1110
1180
  }
1111
- function be(e) {
1112
- return ye(e) ? zr(e) : qr(e);
1181
+ function Re(e) {
1182
+ return ie(e) ? Ii(e) : ht(e);
1113
1183
  }
1114
- var Qr = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, Gr = /^\w*$/;
1115
- function Ke(e, t) {
1116
- if (E(e))
1184
+ var Ni = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, Di = /^\w*$/;
1185
+ function dt(e, t) {
1186
+ if (M(e))
1117
1187
  return !1;
1118
1188
  var n = typeof e;
1119
- return n == "number" || n == "symbol" || n == "boolean" || e == null || _e(e) ? !0 : Gr.test(e) || !Qr.test(e) || t != null && e in Object(t);
1189
+ return n == "number" || n == "symbol" || n == "boolean" || e == null || Z(e) ? !0 : Di.test(e) || !Ni.test(e) || t != null && e in Object(t);
1120
1190
  }
1121
- var ie = Z(Object, "create");
1122
- function Ur() {
1123
- this.__data__ = ie ? ie(null) : {}, this.size = 0;
1191
+ var ye = re(Object, "create");
1192
+ function Hi() {
1193
+ this.__data__ = ye ? ye(null) : {}, this.size = 0;
1124
1194
  }
1125
- function Br(e) {
1195
+ function Li(e) {
1126
1196
  var t = this.has(e) && delete this.__data__[e];
1127
1197
  return this.size -= t ? 1 : 0, t;
1128
1198
  }
1129
- var Kr = "__lodash_hash_undefined__", Wr = Object.prototype, Xr = Wr.hasOwnProperty;
1130
- function Yr(e) {
1199
+ var qi = "__lodash_hash_undefined__", Qi = Object.prototype, Bi = Qi.hasOwnProperty;
1200
+ function Ui(e) {
1131
1201
  var t = this.__data__;
1132
- if (ie) {
1202
+ if (ye) {
1133
1203
  var n = t[e];
1134
- return n === Kr ? void 0 : n;
1204
+ return n === qi ? void 0 : n;
1135
1205
  }
1136
- return Xr.call(t, e) ? t[e] : void 0;
1206
+ return Bi.call(t, e) ? t[e] : void 0;
1137
1207
  }
1138
- var Vr = Object.prototype, Zr = Vr.hasOwnProperty;
1139
- function Jr(e) {
1208
+ var Gi = Object.prototype, Ki = Gi.hasOwnProperty;
1209
+ function Wi(e) {
1140
1210
  var t = this.__data__;
1141
- return ie ? t[e] !== void 0 : Zr.call(t, e);
1211
+ return ye ? t[e] !== void 0 : Ki.call(t, e);
1142
1212
  }
1143
- var kr = "__lodash_hash_undefined__";
1144
- function es(e, t) {
1213
+ var Vi = "__lodash_hash_undefined__";
1214
+ function Ji(e, t) {
1145
1215
  var n = this.__data__;
1146
- return this.size += this.has(e) ? 0 : 1, n[e] = ie && t === void 0 ? kr : t, this;
1216
+ return this.size += this.has(e) ? 0 : 1, n[e] = ye && t === void 0 ? Vi : t, this;
1147
1217
  }
1148
- function B(e) {
1218
+ function k(e) {
1149
1219
  var t = -1, n = e == null ? 0 : e.length;
1150
1220
  for (this.clear(); ++t < n; ) {
1151
1221
  var r = e[t];
1152
1222
  this.set(r[0], r[1]);
1153
1223
  }
1154
1224
  }
1155
- B.prototype.clear = Ur;
1156
- B.prototype.delete = Br;
1157
- B.prototype.get = Yr;
1158
- B.prototype.has = Jr;
1159
- B.prototype.set = es;
1160
- function ts() {
1225
+ k.prototype.clear = Hi;
1226
+ k.prototype.delete = Li;
1227
+ k.prototype.get = Ui;
1228
+ k.prototype.has = Wi;
1229
+ k.prototype.set = Ji;
1230
+ function Yi() {
1161
1231
  this.__data__ = [], this.size = 0;
1162
1232
  }
1163
- function ge(e, t) {
1233
+ function Ie(e, t) {
1164
1234
  for (var n = e.length; n--; )
1165
- if (Ft(e[n][0], t))
1235
+ if (ut(e[n][0], t))
1166
1236
  return n;
1167
1237
  return -1;
1168
1238
  }
1169
- var ns = Array.prototype, rs = ns.splice;
1170
- function ss(e) {
1171
- var t = this.__data__, n = ge(t, e);
1239
+ var Xi = Array.prototype, Zi = Xi.splice;
1240
+ function ki(e) {
1241
+ var t = this.__data__, n = Ie(t, e);
1172
1242
  if (n < 0)
1173
1243
  return !1;
1174
1244
  var r = t.length - 1;
1175
- return n == r ? t.pop() : rs.call(t, n, 1), --this.size, !0;
1245
+ return n == r ? t.pop() : Zi.call(t, n, 1), --this.size, !0;
1176
1246
  }
1177
- function is(e) {
1178
- var t = this.__data__, n = ge(t, e);
1247
+ function es(e) {
1248
+ var t = this.__data__, n = Ie(t, e);
1179
1249
  return n < 0 ? void 0 : t[n][1];
1180
1250
  }
1181
- function os(e) {
1182
- return ge(this.__data__, e) > -1;
1251
+ function ts(e) {
1252
+ return Ie(this.__data__, e) > -1;
1183
1253
  }
1184
- function as(e, t) {
1185
- var n = this.__data__, r = ge(n, e);
1254
+ function ns(e, t) {
1255
+ var n = this.__data__, r = Ie(n, e);
1186
1256
  return r < 0 ? (++this.size, n.push([e, t])) : n[r][1] = t, this;
1187
1257
  }
1188
- function D(e) {
1258
+ function B(e) {
1189
1259
  var t = -1, n = e == null ? 0 : e.length;
1190
1260
  for (this.clear(); ++t < n; ) {
1191
1261
  var r = e[t];
1192
1262
  this.set(r[0], r[1]);
1193
1263
  }
1194
1264
  }
1195
- D.prototype.clear = ts;
1196
- D.prototype.delete = ss;
1197
- D.prototype.get = is;
1198
- D.prototype.has = os;
1199
- D.prototype.set = as;
1200
- var oe = Z(z, "Map");
1201
- function cs() {
1265
+ B.prototype.clear = Yi;
1266
+ B.prototype.delete = ki;
1267
+ B.prototype.get = es;
1268
+ B.prototype.has = ts;
1269
+ B.prototype.set = ns;
1270
+ var ge = re(Q, "Map");
1271
+ function rs() {
1202
1272
  this.size = 0, this.__data__ = {
1203
- hash: new B(),
1204
- map: new (oe || D)(),
1205
- string: new B()
1273
+ hash: new k(),
1274
+ map: new (ge || B)(),
1275
+ string: new k()
1206
1276
  };
1207
1277
  }
1208
- function us(e) {
1278
+ function is(e) {
1209
1279
  var t = typeof e;
1210
1280
  return t == "string" || t == "number" || t == "symbol" || t == "boolean" ? e !== "__proto__" : e === null;
1211
1281
  }
1212
- function me(e, t) {
1282
+ function je(e, t) {
1213
1283
  var n = e.__data__;
1214
- return us(t) ? n[typeof t == "string" ? "string" : "hash"] : n.map;
1284
+ return is(t) ? n[typeof t == "string" ? "string" : "hash"] : n.map;
1215
1285
  }
1216
- function fs(e) {
1217
- var t = me(this, e).delete(e);
1286
+ function ss(e) {
1287
+ var t = je(this, e).delete(e);
1218
1288
  return this.size -= t ? 1 : 0, t;
1219
1289
  }
1220
- function ls(e) {
1221
- return me(this, e).get(e);
1290
+ function os(e) {
1291
+ return je(this, e).get(e);
1222
1292
  }
1223
- function hs(e) {
1224
- return me(this, e).has(e);
1293
+ function as(e) {
1294
+ return je(this, e).has(e);
1225
1295
  }
1226
- function ps(e, t) {
1227
- var n = me(this, e), r = n.size;
1296
+ function cs(e, t) {
1297
+ var n = je(this, e), r = n.size;
1228
1298
  return n.set(e, t), this.size += n.size == r ? 0 : 1, this;
1229
1299
  }
1230
- function H(e) {
1300
+ function U(e) {
1231
1301
  var t = -1, n = e == null ? 0 : e.length;
1232
1302
  for (this.clear(); ++t < n; ) {
1233
1303
  var r = e[t];
1234
1304
  this.set(r[0], r[1]);
1235
1305
  }
1236
1306
  }
1237
- H.prototype.clear = cs;
1238
- H.prototype.delete = fs;
1239
- H.prototype.get = ls;
1240
- H.prototype.has = hs;
1241
- H.prototype.set = ps;
1242
- var ds = "Expected a function";
1243
- function We(e, t) {
1307
+ U.prototype.clear = rs;
1308
+ U.prototype.delete = ss;
1309
+ U.prototype.get = os;
1310
+ U.prototype.has = as;
1311
+ U.prototype.set = cs;
1312
+ var us = "Expected a function";
1313
+ function pt(e, t) {
1244
1314
  if (typeof e != "function" || t != null && typeof t != "function")
1245
- throw new TypeError(ds);
1315
+ throw new TypeError(us);
1246
1316
  var n = function() {
1247
- var r = arguments, s = t ? t.apply(this, r) : r[0], i = n.cache;
1248
- if (i.has(s))
1249
- return i.get(s);
1317
+ var r = arguments, i = t ? t.apply(this, r) : r[0], s = n.cache;
1318
+ if (s.has(i))
1319
+ return s.get(i);
1250
1320
  var o = e.apply(this, r);
1251
- return n.cache = i.set(s, o) || i, o;
1321
+ return n.cache = s.set(i, o) || s, o;
1252
1322
  };
1253
- return n.cache = new (We.Cache || H)(), n;
1323
+ return n.cache = new (pt.Cache || U)(), n;
1254
1324
  }
1255
- We.Cache = H;
1256
- var _s = 500;
1257
- function ys(e) {
1258
- var t = We(e, function(r) {
1259
- return n.size === _s && n.clear(), r;
1325
+ pt.Cache = U;
1326
+ var ls = 500;
1327
+ function fs(e) {
1328
+ var t = pt(e, function(r) {
1329
+ return n.size === ls && n.clear(), r;
1260
1330
  }), n = t.cache;
1261
1331
  return t;
1262
1332
  }
1263
- var bs = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g, gs = /\\(\\)?/g, ms = ys(function(e) {
1333
+ var hs = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g, ds = /\\(\\)?/g, ps = fs(function(e) {
1264
1334
  var t = [];
1265
- return e.charCodeAt(0) === 46 && t.push(""), e.replace(bs, function(n, r, s, i) {
1266
- t.push(s ? i.replace(gs, "$1") : r || n);
1335
+ return e.charCodeAt(0) === 46 && t.push(""), e.replace(hs, function(n, r, i, s) {
1336
+ t.push(i ? s.replace(ds, "$1") : r || n);
1267
1337
  }), t;
1268
1338
  });
1269
- function ws(e) {
1270
- return e == null ? "" : Rt(e);
1339
+ function gn(e) {
1340
+ return e == null ? "" : un(e);
1271
1341
  }
1272
- function Lt(e, t) {
1273
- return E(e) ? e : Ke(e, t) ? [e] : ms(ws(e));
1342
+ function bn(e, t) {
1343
+ return M(e) ? e : dt(e, t) ? [e] : ps(gn(e));
1274
1344
  }
1275
- function we(e) {
1276
- if (typeof e == "string" || _e(e))
1345
+ function $e(e) {
1346
+ if (typeof e == "string" || Z(e))
1277
1347
  return e;
1278
1348
  var t = e + "";
1279
1349
  return t == "0" && 1 / e == -1 / 0 ? "-0" : t;
1280
1350
  }
1281
- function qt(e, t) {
1282
- t = Lt(t, e);
1351
+ function _t(e, t) {
1352
+ t = bn(t, e);
1283
1353
  for (var n = 0, r = t.length; e != null && n < r; )
1284
- e = e[we(t[n++])];
1354
+ e = e[$e(t[n++])];
1285
1355
  return n && n == r ? e : void 0;
1286
1356
  }
1287
- function vs(e, t, n) {
1288
- var r = e == null ? void 0 : qt(e, t);
1357
+ function m(e, t, n) {
1358
+ var r = e == null ? void 0 : _t(e, t);
1289
1359
  return r === void 0 ? n : r;
1290
1360
  }
1291
- function Qt(e, t) {
1292
- for (var n = -1, r = t.length, s = e.length; ++n < r; )
1293
- e[s + n] = t[n];
1361
+ function mn(e, t) {
1362
+ for (var n = -1, r = t.length, i = e.length; ++n < r; )
1363
+ e[i + n] = t[n];
1294
1364
  return e;
1295
1365
  }
1296
- var ft = I ? I.isConcatSpreadable : void 0;
1297
- function Ss(e) {
1298
- return E(e) || Be(e) || !!(ft && e && e[ft]);
1366
+ var $t = N ? N.isConcatSpreadable : void 0;
1367
+ function _s(e) {
1368
+ return M(e) || Te(e) || !!($t && e && e[$t]);
1299
1369
  }
1300
- function Os(e, t, n, r, s) {
1301
- var i = -1, o = e.length;
1302
- for (n || (n = Ss), s || (s = []); ++i < o; ) {
1303
- var a = e[i];
1304
- n(a) ? Qt(s, a) : s[s.length] = a;
1370
+ function Sn(e, t, n, r, i) {
1371
+ var s = -1, o = e.length;
1372
+ for (n || (n = _s), i || (i = []); ++s < o; ) {
1373
+ var a = e[s];
1374
+ n(a) ? mn(i, a) : i[i.length] = a;
1305
1375
  }
1376
+ return i;
1377
+ }
1378
+ function vn(e, t, n) {
1379
+ var r = -1, i = e.length;
1380
+ 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;
1381
+ for (var s = Array(i); ++r < i; )
1382
+ s[r] = e[r + t];
1306
1383
  return s;
1307
1384
  }
1308
- function Cs() {
1309
- this.__data__ = new D(), this.size = 0;
1385
+ var ys = "\\ud800-\\udfff", gs = "\\u0300-\\u036f", bs = "\\ufe20-\\ufe2f", ms = "\\u20d0-\\u20ff", Ss = gs + bs + ms, vs = "\\ufe0e\\ufe0f", ws = "\\u200d", Os = RegExp("[" + ws + ys + Ss + vs + "]");
1386
+ function Cs(e) {
1387
+ return Os.test(e);
1388
+ }
1389
+ function Ms() {
1390
+ this.__data__ = new B(), this.size = 0;
1310
1391
  }
1311
1392
  function As(e) {
1312
1393
  var t = this.__data__, n = t.delete(e);
1313
1394
  return this.size = t.size, n;
1314
1395
  }
1315
- function Ms(e) {
1396
+ function Ps(e) {
1316
1397
  return this.__data__.get(e);
1317
1398
  }
1318
- function Es(e) {
1399
+ function xs(e) {
1319
1400
  return this.__data__.has(e);
1320
1401
  }
1321
- var Ps = 200;
1402
+ var Es = 200;
1322
1403
  function Ts(e, t) {
1323
1404
  var n = this.__data__;
1324
- if (n instanceof D) {
1405
+ if (n instanceof B) {
1325
1406
  var r = n.__data__;
1326
- if (!oe || r.length < Ps - 1)
1407
+ if (!ge || r.length < Es - 1)
1327
1408
  return r.push([e, t]), this.size = ++n.size, this;
1328
- n = this.__data__ = new H(r);
1409
+ n = this.__data__ = new U(r);
1329
1410
  }
1330
1411
  return n.set(e, t), this.size = n.size, this;
1331
1412
  }
1332
- function $(e) {
1333
- var t = this.__data__ = new D(e);
1413
+ function L(e) {
1414
+ var t = this.__data__ = new B(e);
1334
1415
  this.size = t.size;
1335
1416
  }
1336
- $.prototype.clear = Cs;
1337
- $.prototype.delete = As;
1338
- $.prototype.get = Ms;
1339
- $.prototype.has = Es;
1340
- $.prototype.set = Ts;
1341
- function xs(e, t) {
1342
- for (var n = -1, r = e == null ? 0 : e.length, s = 0, i = []; ++n < r; ) {
1417
+ L.prototype.clear = Ms;
1418
+ L.prototype.delete = As;
1419
+ L.prototype.get = Ps;
1420
+ L.prototype.has = xs;
1421
+ L.prototype.set = Ts;
1422
+ function wn(e, t) {
1423
+ for (var n = -1, r = e == null ? 0 : e.length, i = 0, s = []; ++n < r; ) {
1343
1424
  var o = e[n];
1344
- t(o, n, e) && (i[s++] = o);
1425
+ t(o, n, e) && (s[i++] = o);
1345
1426
  }
1346
- return i;
1427
+ return s;
1347
1428
  }
1348
- function Is() {
1429
+ function Rs() {
1349
1430
  return [];
1350
1431
  }
1351
- var Rs = Object.prototype, js = Rs.propertyIsEnumerable, lt = Object.getOwnPropertySymbols, $s = lt ? function(e) {
1352
- return e == null ? [] : (e = Object(e), xs(lt(e), function(t) {
1432
+ var Is = Object.prototype, js = Is.propertyIsEnumerable, Ft = Object.getOwnPropertySymbols, $s = Ft ? function(e) {
1433
+ return e == null ? [] : (e = Object(e), wn(Ft(e), function(t) {
1353
1434
  return js.call(e, t);
1354
1435
  }));
1355
- } : Is;
1436
+ } : Rs;
1356
1437
  function Fs(e, t, n) {
1357
1438
  var r = t(e);
1358
- return E(e) ? r : Qt(r, n(e));
1439
+ return M(e) ? r : mn(r, n(e));
1359
1440
  }
1360
- function ht(e) {
1361
- return Fs(e, be, $s);
1441
+ function zt(e) {
1442
+ return Fs(e, Re, $s);
1362
1443
  }
1363
- var $e = Z(z, "DataView"), Fe = Z(z, "Promise"), ze = Z(z, "Set"), pt = "[object Map]", zs = "[object Object]", dt = "[object Promise]", _t = "[object Set]", yt = "[object WeakMap]", bt = "[object DataView]", Ds = W($e), Hs = W(oe), Ns = W(Fe), Ls = W(ze), qs = W(Re), L = V;
1364
- ($e && L(new $e(new ArrayBuffer(1))) != bt || oe && L(new oe()) != pt || Fe && L(Fe.resolve()) != dt || ze && L(new ze()) != _t || Re && L(new Re()) != yt) && (L = function(e) {
1365
- var t = V(e), n = t == zs ? e.constructor : void 0, r = n ? W(n) : "";
1444
+ var Je = re(Q, "DataView"), Ye = re(Q, "Promise"), Xe = re(Q, "Set"), Nt = "[object Map]", zs = "[object Object]", Dt = "[object Promise]", Ht = "[object Set]", Lt = "[object WeakMap]", qt = "[object DataView]", Ns = ne(Je), Ds = ne(ge), Hs = ne(Ye), Ls = ne(Xe), qs = ne(Ve), F = te;
1445
+ (Je && F(new Je(new ArrayBuffer(1))) != qt || ge && F(new ge()) != Nt || Ye && F(Ye.resolve()) != Dt || Xe && F(new Xe()) != Ht || Ve && F(new Ve()) != Lt) && (F = function(e) {
1446
+ var t = te(e), n = t == zs ? e.constructor : void 0, r = n ? ne(n) : "";
1366
1447
  if (r)
1367
1448
  switch (r) {
1449
+ case Ns:
1450
+ return qt;
1368
1451
  case Ds:
1369
- return bt;
1452
+ return Nt;
1370
1453
  case Hs:
1371
- return pt;
1372
- case Ns:
1373
- return dt;
1454
+ return Dt;
1374
1455
  case Ls:
1375
- return _t;
1456
+ return Ht;
1376
1457
  case qs:
1377
- return yt;
1458
+ return Lt;
1378
1459
  }
1379
1460
  return t;
1380
1461
  });
1381
- var gt = z.Uint8Array, Qs = "__lodash_hash_undefined__";
1382
- function Gs(e) {
1462
+ var Qt = Q.Uint8Array, Qs = "__lodash_hash_undefined__";
1463
+ function Bs(e) {
1383
1464
  return this.__data__.set(e, Qs), this;
1384
1465
  }
1385
1466
  function Us(e) {
1386
1467
  return this.__data__.has(e);
1387
1468
  }
1388
- function de(e) {
1469
+ function Ee(e) {
1389
1470
  var t = -1, n = e == null ? 0 : e.length;
1390
- for (this.__data__ = new H(); ++t < n; )
1471
+ for (this.__data__ = new U(); ++t < n; )
1391
1472
  this.add(e[t]);
1392
1473
  }
1393
- de.prototype.add = de.prototype.push = Gs;
1394
- de.prototype.has = Us;
1395
- function Bs(e, t) {
1474
+ Ee.prototype.add = Ee.prototype.push = Bs;
1475
+ Ee.prototype.has = Us;
1476
+ function Gs(e, t) {
1396
1477
  for (var n = -1, r = e == null ? 0 : e.length; ++n < r; )
1397
1478
  if (t(e[n], n, e))
1398
1479
  return !0;
@@ -1401,325 +1482,471 @@ function Bs(e, t) {
1401
1482
  function Ks(e, t) {
1402
1483
  return e.has(t);
1403
1484
  }
1404
- var Ws = 1, Xs = 2;
1405
- function Gt(e, t, n, r, s, i) {
1485
+ var Ws = 1, Vs = 2;
1486
+ function On(e, t, n, r, i, s) {
1406
1487
  var o = n & Ws, a = e.length, c = t.length;
1407
1488
  if (a != c && !(o && c > a))
1408
1489
  return !1;
1409
- var u = i.get(e), f = i.get(t);
1410
- if (u && f)
1411
- return u == t && f == e;
1412
- var l = -1, d = !0, y = n & Xs ? new de() : void 0;
1413
- for (i.set(e, t), i.set(t, e); ++l < a; ) {
1414
- var m = e[l], O = t[l];
1490
+ var u = s.get(e), l = s.get(t);
1491
+ if (u && l)
1492
+ return u == t && l == e;
1493
+ var f = -1, h = !0, p = n & Vs ? new Ee() : void 0;
1494
+ for (s.set(e, t), s.set(t, e); ++f < a; ) {
1495
+ var g = e[f], b = t[f];
1415
1496
  if (r)
1416
- var v = o ? r(O, m, l, t, e, i) : r(m, O, l, e, t, i);
1417
- if (v !== void 0) {
1418
- if (v)
1497
+ var w = o ? r(b, g, f, t, e, s) : r(g, b, f, e, t, s);
1498
+ if (w !== void 0) {
1499
+ if (w)
1419
1500
  continue;
1420
- d = !1;
1501
+ h = !1;
1421
1502
  break;
1422
1503
  }
1423
- if (y) {
1424
- if (!Bs(t, function(w, b) {
1425
- if (!Ks(y, b) && (m === w || s(m, w, n, r, i)))
1426
- return y.push(b);
1504
+ if (p) {
1505
+ if (!Gs(t, function(C, S) {
1506
+ if (!Ks(p, S) && (g === C || i(g, C, n, r, s)))
1507
+ return p.push(S);
1427
1508
  })) {
1428
- d = !1;
1509
+ h = !1;
1429
1510
  break;
1430
1511
  }
1431
- } else if (!(m === O || s(m, O, n, r, i))) {
1432
- d = !1;
1512
+ } else if (!(g === b || i(g, b, n, r, s))) {
1513
+ h = !1;
1433
1514
  break;
1434
1515
  }
1435
1516
  }
1436
- return i.delete(e), i.delete(t), d;
1517
+ return s.delete(e), s.delete(t), h;
1437
1518
  }
1438
- function Ys(e) {
1519
+ function Js(e) {
1439
1520
  var t = -1, n = Array(e.size);
1440
- return e.forEach(function(r, s) {
1441
- n[++t] = [s, r];
1521
+ return e.forEach(function(r, i) {
1522
+ n[++t] = [i, r];
1442
1523
  }), n;
1443
1524
  }
1444
- function Vs(e) {
1525
+ function Ys(e) {
1445
1526
  var t = -1, n = Array(e.size);
1446
1527
  return e.forEach(function(r) {
1447
1528
  n[++t] = r;
1448
1529
  }), n;
1449
1530
  }
1450
- var Zs = 1, Js = 2, ks = "[object Boolean]", ei = "[object Date]", ti = "[object Error]", ni = "[object Map]", ri = "[object Number]", si = "[object RegExp]", ii = "[object Set]", oi = "[object String]", ai = "[object Symbol]", ci = "[object ArrayBuffer]", ui = "[object DataView]", mt = I ? I.prototype : void 0, Me = mt ? mt.valueOf : void 0;
1451
- function fi(e, t, n, r, s, i, o) {
1531
+ var Xs = 1, Zs = 2, ks = "[object Boolean]", eo = "[object Date]", to = "[object Error]", no = "[object Map]", ro = "[object Number]", io = "[object RegExp]", so = "[object Set]", oo = "[object String]", ao = "[object Symbol]", co = "[object ArrayBuffer]", uo = "[object DataView]", Bt = N ? N.prototype : void 0, Le = Bt ? Bt.valueOf : void 0;
1532
+ function lo(e, t, n, r, i, s, o) {
1452
1533
  switch (n) {
1453
- case ui:
1534
+ case uo:
1454
1535
  if (e.byteLength != t.byteLength || e.byteOffset != t.byteOffset)
1455
1536
  return !1;
1456
1537
  e = e.buffer, t = t.buffer;
1457
- case ci:
1458
- return !(e.byteLength != t.byteLength || !i(new gt(e), new gt(t)));
1538
+ case co:
1539
+ return !(e.byteLength != t.byteLength || !s(new Qt(e), new Qt(t)));
1459
1540
  case ks:
1460
- case ei:
1461
- case ri:
1462
- return Ft(+e, +t);
1463
- case ti:
1541
+ case eo:
1542
+ case ro:
1543
+ return ut(+e, +t);
1544
+ case to:
1464
1545
  return e.name == t.name && e.message == t.message;
1465
- case si:
1466
- case oi:
1546
+ case io:
1547
+ case oo:
1467
1548
  return e == t + "";
1468
- case ni:
1469
- var a = Ys;
1470
- case ii:
1471
- var c = r & Zs;
1472
- if (a || (a = Vs), e.size != t.size && !c)
1549
+ case no:
1550
+ var a = Js;
1551
+ case so:
1552
+ var c = r & Xs;
1553
+ if (a || (a = Ys), e.size != t.size && !c)
1473
1554
  return !1;
1474
1555
  var u = o.get(e);
1475
1556
  if (u)
1476
1557
  return u == t;
1477
- r |= Js, o.set(e, t);
1478
- var f = Gt(a(e), a(t), r, s, i, o);
1479
- return o.delete(e), f;
1480
- case ai:
1481
- if (Me)
1482
- return Me.call(e) == Me.call(t);
1558
+ r |= Zs, o.set(e, t);
1559
+ var l = On(a(e), a(t), r, i, s, o);
1560
+ return o.delete(e), l;
1561
+ case ao:
1562
+ if (Le)
1563
+ return Le.call(e) == Le.call(t);
1483
1564
  }
1484
1565
  return !1;
1485
1566
  }
1486
- var li = 1, hi = Object.prototype, pi = hi.hasOwnProperty;
1487
- function di(e, t, n, r, s, i) {
1488
- var o = n & li, a = ht(e), c = a.length, u = ht(t), f = u.length;
1489
- if (c != f && !o)
1567
+ var fo = 1, ho = Object.prototype, po = ho.hasOwnProperty;
1568
+ function _o(e, t, n, r, i, s) {
1569
+ var o = n & fo, a = zt(e), c = a.length, u = zt(t), l = u.length;
1570
+ if (c != l && !o)
1490
1571
  return !1;
1491
- for (var l = c; l--; ) {
1492
- var d = a[l];
1493
- if (!(o ? d in t : pi.call(t, d)))
1572
+ for (var f = c; f--; ) {
1573
+ var h = a[f];
1574
+ if (!(o ? h in t : po.call(t, h)))
1494
1575
  return !1;
1495
1576
  }
1496
- var y = i.get(e), m = i.get(t);
1497
- if (y && m)
1498
- return y == t && m == e;
1499
- var O = !0;
1500
- i.set(e, t), i.set(t, e);
1501
- for (var v = o; ++l < c; ) {
1502
- d = a[l];
1503
- var w = e[d], b = t[d];
1577
+ var p = s.get(e), g = s.get(t);
1578
+ if (p && g)
1579
+ return p == t && g == e;
1580
+ var b = !0;
1581
+ s.set(e, t), s.set(t, e);
1582
+ for (var w = o; ++f < c; ) {
1583
+ h = a[f];
1584
+ var C = e[h], S = t[h];
1504
1585
  if (r)
1505
- var C = o ? r(b, w, d, t, e, i) : r(w, b, d, e, t, i);
1506
- if (!(C === void 0 ? w === b || s(w, b, n, r, i) : C)) {
1507
- O = !1;
1586
+ var P = o ? r(S, C, h, t, e, s) : r(C, S, h, e, t, s);
1587
+ if (!(P === void 0 ? C === S || i(C, S, n, r, s) : P)) {
1588
+ b = !1;
1508
1589
  break;
1509
1590
  }
1510
- v || (v = d == "constructor");
1591
+ w || (w = h == "constructor");
1511
1592
  }
1512
- if (O && !v) {
1513
- var G = e.constructor, p = t.constructor;
1514
- G != p && "constructor" in e && "constructor" in t && !(typeof G == "function" && G instanceof G && typeof p == "function" && p instanceof p) && (O = !1);
1593
+ if (b && !w) {
1594
+ var V = e.constructor, _ = t.constructor;
1595
+ V != _ && "constructor" in e && "constructor" in t && !(typeof V == "function" && V instanceof V && typeof _ == "function" && _ instanceof _) && (b = !1);
1515
1596
  }
1516
- return i.delete(e), i.delete(t), O;
1597
+ return s.delete(e), s.delete(t), b;
1517
1598
  }
1518
- var _i = 1, wt = "[object Arguments]", vt = "[object Array]", ce = "[object Object]", yi = Object.prototype, St = yi.hasOwnProperty;
1519
- function bi(e, t, n, r, s, i) {
1520
- var o = E(e), a = E(t), c = o ? vt : L(e), u = a ? vt : L(t);
1521
- c = c == wt ? ce : c, u = u == wt ? ce : u;
1522
- var f = c == ce, l = u == ce, d = c == u;
1523
- if (d && je(e)) {
1524
- if (!je(t))
1599
+ var yo = 1, Ut = "[object Arguments]", Gt = "[object Array]", Se = "[object Object]", go = Object.prototype, Kt = go.hasOwnProperty;
1600
+ function bo(e, t, n, r, i, s) {
1601
+ var o = M(e), a = M(t), c = o ? Gt : F(e), u = a ? Gt : F(t);
1602
+ c = c == Ut ? Se : c, u = u == Ut ? Se : u;
1603
+ var l = c == Se, f = u == Se, h = c == u;
1604
+ if (h && xe(e)) {
1605
+ if (!xe(t))
1525
1606
  return !1;
1526
- o = !0, f = !1;
1527
- }
1528
- if (d && !f)
1529
- return i || (i = new $()), o || Nt(e) ? Gt(e, t, n, r, s, i) : fi(e, t, c, n, r, s, i);
1530
- if (!(n & _i)) {
1531
- var y = f && St.call(e, "__wrapped__"), m = l && St.call(t, "__wrapped__");
1532
- if (y || m) {
1533
- var O = y ? e.value() : e, v = m ? t.value() : t;
1534
- return i || (i = new $()), s(O, v, n, r, i);
1607
+ o = !0, l = !1;
1608
+ }
1609
+ if (h && !l)
1610
+ return s || (s = new L()), o || ft(e) ? On(e, t, n, r, i, s) : lo(e, t, c, n, r, i, s);
1611
+ if (!(n & yo)) {
1612
+ var p = l && Kt.call(e, "__wrapped__"), g = f && Kt.call(t, "__wrapped__");
1613
+ if (p || g) {
1614
+ var b = p ? e.value() : e, w = g ? t.value() : t;
1615
+ return s || (s = new L()), i(b, w, n, r, s);
1535
1616
  }
1536
1617
  }
1537
- return d ? (i || (i = new $()), di(e, t, n, r, s, i)) : !1;
1618
+ return h ? (s || (s = new L()), _o(e, t, n, r, i, s)) : !1;
1538
1619
  }
1539
- function ve(e, t, n, r, s) {
1540
- return e === t ? !0 : e == null || t == null || !Y(e) && !Y(t) ? e !== e && t !== t : bi(e, t, n, r, ve, s);
1620
+ function Fe(e, t, n, r, i) {
1621
+ return e === t ? !0 : e == null || t == null || !X(e) && !X(t) ? e !== e && t !== t : bo(e, t, n, r, Fe, i);
1541
1622
  }
1542
- var gi = 1, mi = 2;
1543
- function wi(e, t, n, r) {
1544
- var s = n.length, i = s;
1623
+ var mo = 1, So = 2;
1624
+ function vo(e, t, n, r) {
1625
+ var i = n.length, s = i;
1545
1626
  if (e == null)
1546
- return !i;
1547
- for (e = Object(e); s--; ) {
1548
- var o = n[s];
1627
+ return !s;
1628
+ for (e = Object(e); i--; ) {
1629
+ var o = n[i];
1549
1630
  if (o[2] ? o[1] !== e[o[0]] : !(o[0] in e))
1550
1631
  return !1;
1551
1632
  }
1552
- for (; ++s < i; ) {
1553
- o = n[s];
1633
+ for (; ++i < s; ) {
1634
+ o = n[i];
1554
1635
  var a = o[0], c = e[a], u = o[1];
1555
1636
  if (o[2]) {
1556
1637
  if (c === void 0 && !(a in e))
1557
1638
  return !1;
1558
1639
  } else {
1559
- var f = new $(), l;
1560
- if (!(l === void 0 ? ve(u, c, gi | mi, r, f) : l))
1640
+ var l = new L(), f;
1641
+ if (!(f === void 0 ? Fe(u, c, mo | So, r, l) : f))
1561
1642
  return !1;
1562
1643
  }
1563
1644
  }
1564
1645
  return !0;
1565
1646
  }
1566
- function Ut(e) {
1567
- return e === e && !se(e);
1647
+ function Cn(e) {
1648
+ return e === e && !ae(e);
1568
1649
  }
1569
- function vi(e) {
1570
- for (var t = be(e), n = t.length; n--; ) {
1571
- var r = t[n], s = e[r];
1572
- t[n] = [r, s, Ut(s)];
1650
+ function wo(e) {
1651
+ for (var t = Re(e), n = t.length; n--; ) {
1652
+ var r = t[n], i = e[r];
1653
+ t[n] = [r, i, Cn(i)];
1573
1654
  }
1574
1655
  return t;
1575
1656
  }
1576
- function Bt(e, t) {
1657
+ function Mn(e, t) {
1577
1658
  return function(n) {
1578
1659
  return n == null ? !1 : n[e] === t && (t !== void 0 || e in Object(n));
1579
1660
  };
1580
1661
  }
1581
- function Si(e) {
1582
- var t = vi(e);
1583
- return t.length == 1 && t[0][2] ? Bt(t[0][0], t[0][1]) : function(n) {
1584
- return n === e || wi(n, e, t);
1662
+ function Oo(e) {
1663
+ var t = wo(e);
1664
+ return t.length == 1 && t[0][2] ? Mn(t[0][0], t[0][1]) : function(n) {
1665
+ return n === e || vo(n, e, t);
1585
1666
  };
1586
1667
  }
1587
- function Oi(e, t) {
1668
+ function Co(e, t) {
1588
1669
  return e != null && t in Object(e);
1589
1670
  }
1590
- function Ci(e, t, n) {
1591
- t = Lt(t, e);
1592
- for (var r = -1, s = t.length, i = !1; ++r < s; ) {
1593
- var o = we(t[r]);
1594
- if (!(i = e != null && n(e, o)))
1671
+ function Mo(e, t, n) {
1672
+ t = bn(t, e);
1673
+ for (var r = -1, i = t.length, s = !1; ++r < i; ) {
1674
+ var o = $e(t[r]);
1675
+ if (!(s = e != null && n(e, o)))
1595
1676
  break;
1596
1677
  e = e[o];
1597
1678
  }
1598
- return i || ++r != s ? i : (s = e == null ? 0 : e.length, !!s && Ue(s) && $t(o, s) && (E(e) || Be(e)));
1679
+ return s || ++r != i ? s : (i = e == null ? 0 : e.length, !!i && lt(i) && ct(o, i) && (M(e) || Te(e)));
1599
1680
  }
1600
- function Ai(e, t) {
1601
- return e != null && Ci(e, t, Oi);
1681
+ function Ao(e, t) {
1682
+ return e != null && Mo(e, t, Co);
1602
1683
  }
1603
- var Mi = 1, Ei = 2;
1604
- function Pi(e, t) {
1605
- return Ke(e) && Ut(t) ? Bt(we(e), t) : function(n) {
1606
- var r = vs(n, e);
1607
- return r === void 0 && r === t ? Ai(n, e) : ve(t, r, Mi | Ei);
1684
+ var Po = 1, xo = 2;
1685
+ function Eo(e, t) {
1686
+ return dt(e) && Cn(t) ? Mn($e(e), t) : function(n) {
1687
+ var r = m(n, e);
1688
+ return r === void 0 && r === t ? Ao(n, e) : Fe(t, r, Po | xo);
1608
1689
  };
1609
1690
  }
1610
- function Ti(e) {
1691
+ function An(e) {
1611
1692
  return function(t) {
1612
1693
  return t?.[e];
1613
1694
  };
1614
1695
  }
1615
- function xi(e) {
1696
+ function To(e) {
1616
1697
  return function(t) {
1617
- return qt(t, e);
1698
+ return _t(t, e);
1618
1699
  };
1619
1700
  }
1620
- function Ii(e) {
1621
- return Ke(e) ? Ti(we(e)) : xi(e);
1701
+ function Ro(e) {
1702
+ return dt(e) ? An($e(e)) : To(e);
1622
1703
  }
1623
- function Se(e) {
1624
- return typeof e == "function" ? e : e == null ? In : typeof e == "object" ? E(e) ? Pi(e[0], e[1]) : Si(e) : Ii(e);
1704
+ function W(e) {
1705
+ return typeof e == "function" ? e : e == null ? me : typeof e == "object" ? M(e) ? Eo(e[0], e[1]) : Oo(e) : Ro(e);
1625
1706
  }
1626
- function Ri(e) {
1707
+ function Io(e) {
1627
1708
  return function(t, n, r) {
1628
- for (var s = -1, i = Object(t), o = r(t), a = o.length; a--; ) {
1629
- var c = o[++s];
1630
- if (n(i[c], c, i) === !1)
1709
+ for (var i = -1, s = Object(t), o = r(t), a = o.length; a--; ) {
1710
+ var c = o[++i];
1711
+ if (n(s[c], c, s) === !1)
1631
1712
  break;
1632
1713
  }
1633
1714
  return t;
1634
1715
  };
1635
1716
  }
1636
- var ji = Ri();
1637
- function $i(e, t) {
1638
- return e && ji(e, t, be);
1717
+ var jo = Io();
1718
+ function $o(e, t) {
1719
+ return e && jo(e, t, Re);
1639
1720
  }
1640
- function Fi(e, t) {
1721
+ function Fo(e, t) {
1641
1722
  return function(n, r) {
1642
1723
  if (n == null)
1643
1724
  return n;
1644
- if (!ye(n))
1725
+ if (!ie(n))
1645
1726
  return e(n, r);
1646
- for (var s = n.length, i = -1, o = Object(n); ++i < s && r(o[i], i, o) !== !1; )
1727
+ for (var i = n.length, s = -1, o = Object(n); ++s < i && r(o[s], s, o) !== !1; )
1647
1728
  ;
1648
1729
  return n;
1649
1730
  };
1650
1731
  }
1651
- var Kt = Fi($i);
1652
- function zi(e) {
1732
+ var ze = Fo($o);
1733
+ function fe(e) {
1653
1734
  var t = e == null ? 0 : e.length;
1654
1735
  return t ? e[t - 1] : void 0;
1655
1736
  }
1656
- function Di(e, t) {
1737
+ function zo(e) {
1738
+ return typeof e == "function" ? e : me;
1739
+ }
1740
+ function Oe(e, t) {
1741
+ var n = M(e) ? Br : ze;
1742
+ return n(e, zo(t));
1743
+ }
1744
+ function No(e, t) {
1657
1745
  for (var n = -1, r = e == null ? 0 : e.length; ++n < r; )
1658
1746
  if (!t(e[n], n, e))
1659
1747
  return !1;
1660
1748
  return !0;
1661
1749
  }
1662
- function Hi(e, t) {
1750
+ function Do(e, t) {
1663
1751
  var n = !0;
1664
- return Kt(e, function(r, s, i) {
1665
- return n = !!t(r, s, i), n;
1752
+ return ze(e, function(r, i, s) {
1753
+ return n = !!t(r, i, s), n;
1666
1754
  }), n;
1667
1755
  }
1668
- function Ni(e, t, n) {
1669
- var r = E(e) ? Di : Hi;
1670
- return r(e, Se(t));
1756
+ function Ho(e, t, n) {
1757
+ var r = M(e) ? No : Do;
1758
+ return r(e, W(t));
1671
1759
  }
1672
- function Li(e) {
1760
+ function Lo(e, t) {
1761
+ var n = [];
1762
+ return ze(e, function(r, i, s) {
1763
+ t(r, i, s) && n.push(r);
1764
+ }), n;
1765
+ }
1766
+ function Ce(e, t) {
1767
+ var n = M(e) ? wn : Lo;
1768
+ return n(e, W(t));
1769
+ }
1770
+ function qo(e) {
1673
1771
  return function(t, n, r) {
1674
- var s = Object(t);
1675
- if (!ye(t)) {
1676
- var i = Se(n);
1677
- t = be(t), n = function(a) {
1678
- return i(s[a], a, s);
1772
+ var i = Object(t);
1773
+ if (!ie(t)) {
1774
+ var s = W(n);
1775
+ t = Re(t), n = function(a) {
1776
+ return s(i[a], a, i);
1679
1777
  };
1680
1778
  }
1681
1779
  var o = e(t, n, r);
1682
- return o > -1 ? s[i ? t[o] : o] : void 0;
1780
+ return o > -1 ? i[s ? t[o] : o] : void 0;
1683
1781
  };
1684
1782
  }
1685
- var qi = Math.max;
1686
- function Qi(e, t, n) {
1783
+ var Qo = Math.max;
1784
+ function Bo(e, t, n) {
1687
1785
  var r = e == null ? 0 : e.length;
1688
1786
  if (!r)
1689
1787
  return -1;
1690
- var s = n == null ? 0 : xn(n);
1691
- return s < 0 && (s = qi(r + s, 0)), Xn(e, Se(t), s);
1692
- }
1693
- var Gi = Li(Qi);
1694
- function Ui(e, t) {
1695
- var n = -1, r = ye(e) ? Array(e.length) : [];
1696
- return Kt(e, function(s, i, o) {
1697
- r[++n] = t(s, i, o);
1788
+ var i = n == null ? 0 : ln(n);
1789
+ return i < 0 && (i = Qo(r + i, 0)), Ur(e, W(t), i);
1790
+ }
1791
+ var Ze = qo(Bo);
1792
+ function Uo(e) {
1793
+ return e && e.length ? e[0] : void 0;
1794
+ }
1795
+ function Pn(e, t) {
1796
+ var n = -1, r = ie(e) ? Array(e.length) : [];
1797
+ return ze(e, function(i, s, o) {
1798
+ r[++n] = t(i, s, o);
1698
1799
  }), r;
1699
1800
  }
1700
- function Bi(e, t) {
1701
- var n = E(e) ? It : Ui;
1702
- return n(e, Se(t));
1801
+ function Y(e, t) {
1802
+ var n = M(e) ? de : Pn;
1803
+ return n(e, W(t));
1703
1804
  }
1704
- function Ki(e, t) {
1705
- return Os(Bi(e, t));
1805
+ function Go(e, t) {
1806
+ return Sn(Y(e, t));
1706
1807
  }
1707
- function Wi(e) {
1808
+ function Ko(e) {
1708
1809
  for (var t = -1, n = e == null ? 0 : e.length, r = {}; ++t < n; ) {
1709
- var s = e[t];
1710
- r[s[0]] = s[1];
1810
+ var i = e[t];
1811
+ r[i[0]] = i[1];
1711
1812
  }
1712
1813
  return r;
1713
1814
  }
1714
- function Xi(e, t) {
1715
- return ve(e, t);
1815
+ function Wo(e, t) {
1816
+ return e > t;
1716
1817
  }
1717
- const Yi = (e, t) => {
1718
- if (!e.length) return [t];
1719
- const n = zi(e);
1720
- return n.type === "create" && t.type === "delete" ? null : n.type === "create" && t.type === "update" ? [{ ...n, data: t.data }] : n.type === "update" && t.type === "update" ? [...e.slice(0, -1), t] : n.type === "update" && t.type === "delete" ? [...e, t] : [t];
1818
+ var Vo = "[object String]";
1819
+ function Jo(e) {
1820
+ return typeof e == "string" || !M(e) && X(e) && te(e) == Vo;
1821
+ }
1822
+ function Yo(e) {
1823
+ var t = e == null ? 0 : e.length;
1824
+ return t ? vn(e, 0, -1) : [];
1825
+ }
1826
+ var Xo = "[object Map]", Zo = "[object Set]", ko = Object.prototype, ea = ko.hasOwnProperty;
1827
+ function xn(e) {
1828
+ if (e == null)
1829
+ return !0;
1830
+ if (ie(e) && (M(e) || typeof e == "string" || typeof e.splice == "function" || xe(e) || ft(e) || Te(e)))
1831
+ return !e.length;
1832
+ var t = F(e);
1833
+ if (t == Xo || t == Zo)
1834
+ return !e.size;
1835
+ if (hn(e))
1836
+ return !ht(e).length;
1837
+ for (var n in e)
1838
+ if (ea.call(e, n))
1839
+ return !1;
1840
+ return !0;
1841
+ }
1842
+ function O(e, t) {
1843
+ return Fe(e, t);
1844
+ }
1845
+ var ta = Array.prototype, na = ta.join;
1846
+ function qe(e, t) {
1847
+ return e == null ? "" : na.call(e, t);
1848
+ }
1849
+ function ra(e, t) {
1850
+ return e < t;
1851
+ }
1852
+ function En(e, t, n) {
1853
+ for (var r = -1, i = e.length; ++r < i; ) {
1854
+ var s = e[r], o = t(s);
1855
+ if (o != null && (a === void 0 ? o === o && !Z(o) : n(o, a)))
1856
+ var a = o, c = s;
1857
+ }
1858
+ return c;
1859
+ }
1860
+ function Wt(e, t) {
1861
+ return e && e.length ? En(e, W(t), Wo) : void 0;
1862
+ }
1863
+ function ia(e, t) {
1864
+ return e && e.length ? En(e, W(t), ra) : void 0;
1865
+ }
1866
+ function sa(e, t) {
1867
+ var n = e.length;
1868
+ for (e.sort(t); n--; )
1869
+ e[n] = e[n].value;
1870
+ return e;
1871
+ }
1872
+ function oa(e, t) {
1873
+ if (e !== t) {
1874
+ var n = e !== void 0, r = e === null, i = e === e, s = Z(e), o = t !== void 0, a = t === null, c = t === t, u = Z(t);
1875
+ if (!a && !u && !s && e > t || s && o && c && !a && !u || r && o && c || !n && c || !i)
1876
+ return 1;
1877
+ if (!r && !s && !u && e < t || u && n && i && !r && !s || a && n && i || !o && i || !c)
1878
+ return -1;
1879
+ }
1880
+ return 0;
1881
+ }
1882
+ function aa(e, t, n) {
1883
+ for (var r = -1, i = e.criteria, s = t.criteria, o = i.length, a = n.length; ++r < o; ) {
1884
+ var c = oa(i[r], s[r]);
1885
+ if (c) {
1886
+ if (r >= a)
1887
+ return c;
1888
+ var u = n[r];
1889
+ return c * (u == "desc" ? -1 : 1);
1890
+ }
1891
+ }
1892
+ return e.index - t.index;
1893
+ }
1894
+ function ca(e, t, n) {
1895
+ t.length ? t = de(t, function(s) {
1896
+ return M(s) ? function(o) {
1897
+ return _t(o, s.length === 1 ? s[0] : s);
1898
+ } : s;
1899
+ }) : t = [me];
1900
+ var r = -1;
1901
+ t = de(t, _n(W));
1902
+ var i = Pn(e, function(s, o, a) {
1903
+ var c = de(t, function(u) {
1904
+ return u(s);
1905
+ });
1906
+ return { criteria: c, index: ++r, value: s };
1907
+ });
1908
+ return sa(i, function(s, o) {
1909
+ return aa(s, o, n);
1910
+ });
1911
+ }
1912
+ var ua = An("length"), Tn = "\\ud800-\\udfff", la = "\\u0300-\\u036f", fa = "\\ufe20-\\ufe2f", ha = "\\u20d0-\\u20ff", da = la + fa + ha, pa = "\\ufe0e\\ufe0f", _a = "[" + Tn + "]", ke = "[" + da + "]", et = "\\ud83c[\\udffb-\\udfff]", ya = "(?:" + ke + "|" + et + ")", Rn = "[^" + Tn + "]", In = "(?:\\ud83c[\\udde6-\\uddff]){2}", jn = "[\\ud800-\\udbff][\\udc00-\\udfff]", ga = "\\u200d", $n = ya + "?", Fn = "[" + pa + "]?", ba = "(?:" + ga + "(?:" + [Rn, In, jn].join("|") + ")" + Fn + $n + ")*", ma = Fn + $n + ba, Sa = "(?:" + [Rn + ke + "?", ke, In, jn, _a].join("|") + ")", Vt = RegExp(et + "(?=" + et + ")|" + Sa + ma, "g");
1913
+ function va(e) {
1914
+ for (var t = Vt.lastIndex = 0; Vt.test(e); )
1915
+ ++t;
1916
+ return t;
1917
+ }
1918
+ function wa(e) {
1919
+ return Cs(e) ? va(e) : ua(e);
1920
+ }
1921
+ var Oa = "[object Map]", Ca = "[object Set]";
1922
+ function oe(e) {
1923
+ if (e == null)
1924
+ return 0;
1925
+ if (ie(e))
1926
+ return Jo(e) ? wa(e) : e.length;
1927
+ var t = F(e);
1928
+ return t == Oa || t == Ca ? e.size : ht(e).length;
1929
+ }
1930
+ var Me = Vr(function(e, t) {
1931
+ if (e == null)
1932
+ return [];
1933
+ var n = t.length;
1934
+ return n > 1 && xt(e, t[0], t[1]) ? t = [] : n > 2 && xt(t[0], t[1], t[2]) && (t = [t[0]]), ca(e, Sn(t), []);
1935
+ });
1936
+ function Ma(e, t, n) {
1937
+ return e && e.length ? (t = t === void 0 ? 1 : ln(t), vn(e, 0, t < 0 ? 0 : t)) : [];
1938
+ }
1939
+ var Aa = 0;
1940
+ function Jt(e) {
1941
+ var t = ++Aa;
1942
+ return gn(e) + t;
1943
+ }
1944
+ const Pa = (e, t) => {
1945
+ if (xn(e)) return [t];
1946
+ const n = fe(e);
1947
+ return O(n.type, "create") && O(t.type, "delete") ? null : O(n.type, "create") && O(t.type, "update") ? [{ ...n, data: t.data }] : O(n.type, "update") && O(t.type, "update") ? [...Yo(e), t] : O(n.type, "update") && O(t.type, "delete") ? [...e, t] : [t];
1721
1948
  };
1722
- class Vi {
1949
+ class xa {
1723
1950
  _config;
1724
1951
  _state;
1725
1952
  _subscribers = /* @__PURE__ */ new Set();
@@ -1736,8 +1963,8 @@ class Vi {
1736
1963
  }
1737
1964
  enqueue(t) {
1738
1965
  this._updateState((n) => {
1739
- const r = [...n.queue.get(t.id) ?? []], s = Yi(r, t);
1740
- s ? n.queue.set(t.id, s) : n.queue.delete(t.id), n.errors.delete(t.id);
1966
+ const r = [...n.queue.get(t.id) ?? []], i = Pa(r, t);
1967
+ i ? n.queue.set(t.id, i) : n.queue.delete(t.id), n.errors.delete(t.id);
1741
1968
  }), this._scheduleFlush();
1742
1969
  }
1743
1970
  pause() {
@@ -1753,8 +1980,8 @@ class Vi {
1753
1980
  retryAll() {
1754
1981
  const t = this._state.errors;
1755
1982
  t.size !== 0 && (this._updateState((n) => {
1756
- for (const [r, s] of t)
1757
- n.queue.has(r) || n.queue.set(r, s.operations);
1983
+ for (const [r, i] of t)
1984
+ n.queue.has(r) || n.queue.set(r, i.operations);
1758
1985
  n.errors.clear();
1759
1986
  }), this._scheduleFlush());
1760
1987
  }
@@ -1786,7 +2013,7 @@ class Vi {
1786
2013
  return this._subscribers.add(t), () => this._subscribers.delete(t);
1787
2014
  }
1788
2015
  _updateState(t) {
1789
- this._state = P(this._state, t), this._subscribers.forEach((n) => n());
2016
+ this._state = I(this._state, t), this._subscribers.forEach((n) => n());
1790
2017
  }
1791
2018
  _scheduleFlush() {
1792
2019
  this._state.isPaused || this._state.isSyncing || (this._clearTimer(), this._debounceTimer = setTimeout(() => this._flush(), this._config.debounce));
@@ -1794,64 +2021,97 @@ class Vi {
1794
2021
  _clearTimer() {
1795
2022
  this._debounceTimer && (clearTimeout(this._debounceTimer), this._debounceTimer = null);
1796
2023
  }
2024
+ /**
2025
+ * Flush pending changes to the server.
2026
+ *
2027
+ * Flow:
2028
+ * 1. Move queued items to inFlight (atomic swap prevents duplicate sends)
2029
+ * 2. Flatten all changes and optionally batch by batchSize
2030
+ * 3. Send to server via onSync callback
2031
+ * 4. Process results (handle success, retries, ID remapping)
2032
+ * 5. Schedule next flush if more items queued
2033
+ */
1797
2034
  async _flush() {
1798
2035
  const { isPaused: t, isSyncing: n, queue: r } = this._state;
1799
- if (t || n || r.size === 0) return;
1800
- this._updateState((i) => {
1801
- i.inFlight = new Map(r), i.queue = /* @__PURE__ */ new Map(), i.isSyncing = !0;
2036
+ if (t || n || O(oe(r), 0)) return;
2037
+ const i = m(this._config, "batchSize", 1 / 0), s = [...r.entries()], o = Ma(s, i), a = s.slice(oe(o));
2038
+ this._updateState((u) => {
2039
+ u.inFlight = new Map(o), u.queue = new Map(a), u.isSyncing = !0;
1802
2040
  });
1803
- const s = Ki([...this._state.inFlight.values()]);
2041
+ const c = Go([...this._state.inFlight.values()]);
1804
2042
  this._abortController = new AbortController();
1805
2043
  try {
1806
- const i = await this._config.onSync(s, this._abortController.signal);
1807
- this._processResults(Wi(i.map((o) => [o.id, o])));
1808
- } catch (i) {
1809
- this._handleError(i);
2044
+ const u = await this._config.onSync(c, this._abortController.signal);
2045
+ this._processResults(Ko(Y(u, (l) => [l.id, l])));
2046
+ } catch (u) {
2047
+ this._handleError(u);
1810
2048
  }
1811
- this._abortController = null, this._state.queue.size > 0 && !this._state.isPaused && this._scheduleFlush();
1812
- }
2049
+ this._abortController = null, oe(this._state.queue) > 0 && !this._state.isPaused && this._scheduleFlush();
2050
+ }
2051
+ /**
2052
+ * Process sync results and update state accordingly.
2053
+ *
2054
+ * For each item in flight:
2055
+ * - If ALL operations succeeded: clear errors, collect ID remappings
2056
+ * - If ANY operation failed: increment retry counter, re-queue if under maxRetries
2057
+ *
2058
+ * ID Remapping: When server assigns new IDs to created items (e.g., temp ID -> DB ID),
2059
+ * we collect these mappings and notify via onIdRemap callback so the collection
2060
+ * can update its local state.
2061
+ */
1813
2062
  _processResults(t) {
1814
2063
  const n = this._state.inFlight, r = [];
1815
- this._updateState((s) => {
1816
- for (const [i, o] of n)
1817
- if (Ni(o, (c) => t[c.id]?.status === "success")) {
1818
- s.errors.delete(i);
1819
- for (const c of o) {
1820
- const u = t[c.id];
1821
- c.type === "create" && u?.newId && u.newId !== c.id && r.push({ tempId: c.id, newId: u.newId });
1822
- }
1823
- } else {
1824
- const c = (s.errors.get(i)?.retries ?? 0) + 1;
1825
- c < this._config.maxRetries && !s.queue.has(i) && s.queue.set(i, o);
1826
- const u = Gi(o, (f) => t[f.id]?.status !== "success");
1827
- s.errors.set(i, {
1828
- error: t[u?.id ?? ""]?.error ?? "Unknown error",
2064
+ this._updateState((i) => {
2065
+ for (const [s, o] of n)
2066
+ if (Ho(
2067
+ o,
2068
+ (c) => O(m(t, [c.id, "status"]), "success")
2069
+ ))
2070
+ i.errors.delete(s), Oe(o, (c) => {
2071
+ const u = m(t, c.id);
2072
+ O(c.type, "create") && m(u, "newId") && !O(m(u, "newId"), c.id) && r.push({ tempId: c.id, newId: u.newId });
2073
+ });
2074
+ else {
2075
+ const c = m(i.errors.get(s), "retries", 0) + 1;
2076
+ c < this._config.maxRetries && !i.queue.has(s) && i.queue.set(s, o);
2077
+ const u = Ze(o, (l) => !O(m(t, [l.id, "status"]), "success"));
2078
+ i.errors.set(s, {
2079
+ error: m(t, [m(u, "id", ""), "error"], "Unknown error"),
1829
2080
  retries: c,
1830
2081
  operations: o
1831
2082
  });
1832
2083
  }
1833
- s.inFlight = /* @__PURE__ */ new Map(), s.isSyncing = !1;
1834
- }), r.length > 0 && this._config.onIdRemap && this._config.onIdRemap(r);
1835
- }
2084
+ i.inFlight = /* @__PURE__ */ new Map(), i.isSyncing = !1;
2085
+ }), !xn(r) && this._config.onIdRemap && this._config.onIdRemap(r);
2086
+ }
2087
+ /**
2088
+ * Handle network or unexpected errors during sync.
2089
+ *
2090
+ * Two scenarios:
2091
+ * 1. Aborted (e.g., SyncQueue destroyed): Re-queue all items without incrementing retries
2092
+ * 2. Actual error: Increment retries, re-queue if under limit, record error
2093
+ *
2094
+ * This ensures no data loss - failed operations are preserved for retry.
2095
+ */
1836
2096
  _handleError(t) {
1837
- const n = this._state.inFlight, r = this._abortController?.signal.aborted, s = t instanceof Error ? t.message : String(t);
1838
- this._updateState((i) => {
2097
+ const n = this._state.inFlight, r = m(this._abortController, "signal.aborted", !1), i = t instanceof Error ? t.message : String(t);
2098
+ this._updateState((s) => {
1839
2099
  for (const [o, a] of n)
1840
2100
  if (r)
1841
- i.queue.has(o) || i.queue.set(o, a);
2101
+ s.queue.has(o) || s.queue.set(o, a);
1842
2102
  else {
1843
- const c = (i.errors.get(o)?.retries ?? 0) + 1;
1844
- c < this._config.maxRetries && !i.queue.has(o) && i.queue.set(o, a), i.errors.set(o, {
1845
- error: s,
2103
+ const c = m(s.errors.get(o), "retries", 0) + 1;
2104
+ c < this._config.maxRetries && !s.queue.has(o) && s.queue.set(o, a), s.errors.set(o, {
2105
+ error: i,
1846
2106
  retries: c,
1847
2107
  operations: a
1848
2108
  });
1849
2109
  }
1850
- i.inFlight = /* @__PURE__ */ new Map(), i.isSyncing = !1;
2110
+ s.inFlight = /* @__PURE__ */ new Map(), s.isSyncing = !1;
1851
2111
  });
1852
2112
  }
1853
2113
  }
1854
- class Zi {
2114
+ class Ea {
1855
2115
  _cache = /* @__PURE__ */ new Map();
1856
2116
  _capacity;
1857
2117
  _ttl;
@@ -1884,7 +2144,7 @@ class Zi {
1884
2144
  return this._cache.size;
1885
2145
  }
1886
2146
  }
1887
- class Ji {
2147
+ class Ta {
1888
2148
  _config;
1889
2149
  _cache;
1890
2150
  _state = { status: "idle", items: [] };
@@ -1892,43 +2152,43 @@ class Ji {
1892
2152
  _abortController = null;
1893
2153
  _currentContext = null;
1894
2154
  constructor(t) {
1895
- this._config = { retries: 0, ...t }, this._cache = new Zi(t.cacheCapacity, t.cacheTtl);
2155
+ this._config = { retries: 0, ...t }, this._cache = new Ea(t.cacheCapacity, t.cacheTtl);
1896
2156
  }
1897
2157
  _getCacheKey = (t) => JSON.stringify([this._config.id, t]);
1898
2158
  _setState(t) {
1899
- this._state = P(this._state, (n) => {
2159
+ this._state = I(this._state, (n) => {
1900
2160
  Object.assign(n, t);
1901
2161
  }), this._subscribers.forEach((n) => n());
1902
2162
  }
1903
2163
  async _fetchWithRetry(t, n) {
1904
2164
  const r = this._config.retries;
1905
- let s;
1906
- for (let i = 0; i <= r; i++) {
2165
+ let i;
2166
+ for (let s = 0; s <= r; s++) {
1907
2167
  if (n.aborted) throw new DOMException("Aborted", "AbortError");
1908
2168
  try {
1909
- return i > 0 && this._setState({ retryCount: i }), await this._config.onFetch(t, n);
2169
+ return s > 0 && this._setState({ retryCount: s }), await this._config.onFetch(t, n);
1910
2170
  } catch (o) {
1911
- if (s = o, n.aborted || i === r) throw o;
2171
+ if (i = o, n.aborted || s === r) throw o;
1912
2172
  }
1913
2173
  }
1914
- throw s;
2174
+ throw i;
1915
2175
  }
1916
2176
  async fetch(t) {
1917
2177
  const n = this._getCacheKey(t), r = this._cache.get(n);
1918
2178
  if (r !== null)
1919
2179
  return this._currentContext = t, this._setState({ status: "idle", items: r, error: void 0, retryCount: void 0 }), r;
1920
2180
  this._abortController?.abort("New fetch request started");
1921
- const s = new AbortController();
1922
- this._abortController = s, this._currentContext = t, this._setState({ status: "fetching", error: void 0, retryCount: void 0 });
2181
+ const i = new AbortController();
2182
+ this._abortController = i, this._currentContext = t, this._setState({ status: "fetching", error: void 0, retryCount: void 0 });
1923
2183
  try {
1924
- const i = await this._fetchWithRetry(t, s.signal);
1925
- return this._cache.set(n, i), this._abortController = null, this._setState({ status: "idle", items: i, error: void 0, retryCount: void 0 }), i;
1926
- } catch (i) {
1927
- if (s.signal.aborted) return this._state.items;
2184
+ const s = await this._fetchWithRetry(t, i.signal);
2185
+ return this._cache.set(n, s), this._abortController = null, this._setState({ status: "idle", items: s, error: void 0, retryCount: void 0 }), s;
2186
+ } catch (s) {
2187
+ if (i.signal.aborted) return this._state.items;
1928
2188
  throw this._abortController = null, this._setState({
1929
2189
  status: "error",
1930
- error: i instanceof Error ? i.message : String(i)
1931
- }), i;
2190
+ error: s instanceof Error ? s.message : String(s)
2191
+ }), s;
1932
2192
  }
1933
2193
  }
1934
2194
  async refresh(t) {
@@ -1954,24 +2214,13 @@ class Ji {
1954
2214
  };
1955
2215
  }
1956
2216
  }
1957
- class ki {
2217
+ class Yt {
1958
2218
  _collection;
1959
2219
  _id;
1960
2220
  _cachedStatus = null;
1961
- _refCount = 0;
1962
2221
  constructor(t, n) {
1963
2222
  this._collection = t, this._id = n;
1964
2223
  }
1965
- // Reference counting for lifecycle management
1966
- _retain() {
1967
- this._refCount++;
1968
- }
1969
- _release() {
1970
- this._refCount--, this._refCount <= 0 && this._collection._releaseItem(this._id);
1971
- }
1972
- get refCount() {
1973
- return this._refCount;
1974
- }
1975
2224
  get id() {
1976
2225
  return this._id;
1977
2226
  }
@@ -1986,7 +2235,7 @@ class ki {
1986
2235
  }
1987
2236
  getStatus() {
1988
2237
  const t = this._collection.getItemStatus(this._id);
1989
- return Xi(this._cachedStatus, t) || (this._cachedStatus = t), this._cachedStatus;
2238
+ return O(this._cachedStatus, t) || (this._cachedStatus = t), this._cachedStatus;
1990
2239
  }
1991
2240
  exists() {
1992
2241
  return this._collection.getState().items.has(this._id);
@@ -2001,50 +2250,245 @@ class ki {
2001
2250
  this._id = t;
2002
2251
  }
2003
2252
  }
2004
- class q {
2253
+ const Ra = ".";
2254
+ function Xt(e, t) {
2255
+ const n = e.lastIndexOf(t);
2256
+ return n === -1 ? null : e.slice(0, n);
2257
+ }
2258
+ function Ia(e, t, n) {
2259
+ return e.startsWith(t + n) ? !e.slice(t.length + 1).includes(n) : !1;
2260
+ }
2261
+ function Qe(e, t, n) {
2262
+ return e.startsWith(t + n);
2263
+ }
2264
+ function Zt(e, t) {
2265
+ return e.split(t).length - 1;
2266
+ }
2267
+ class kt {
2268
+ _id;
2269
+ _collection;
2270
+ _cachedStatus = null;
2271
+ constructor(t, n) {
2272
+ this._collection = t, this._id = n;
2273
+ }
2274
+ get _separator() {
2275
+ return this._collection.config.nodeSeparator ?? Ra;
2276
+ }
2277
+ get id() {
2278
+ return this._id;
2279
+ }
2280
+ get data() {
2281
+ return this._collection.getState().items.get(this._id);
2282
+ }
2283
+ get collection() {
2284
+ return this._collection;
2285
+ }
2286
+ get depth() {
2287
+ return Zt(this._id, this._separator);
2288
+ }
2289
+ exists() {
2290
+ return this._collection.getState().items.has(this._id);
2291
+ }
2292
+ getStatus() {
2293
+ const t = this._collection.getItemStatus(this._id);
2294
+ return O(this._cachedStatus, t) || (this._cachedStatus = t), this._cachedStatus;
2295
+ }
2296
+ getParent() {
2297
+ const t = Xt(this._id, this._separator);
2298
+ return t ? this._collection.getNode(t) : null;
2299
+ }
2300
+ getChildren() {
2301
+ const t = [...this._collection.items.entries()], n = Y(
2302
+ Ce(t, ([i]) => Ia(i, this._id, this._separator)),
2303
+ ([i, s]) => ({ id: i, position: s.position })
2304
+ ), r = Me(n, "position");
2305
+ return Y(r, (i) => this._collection.getNode(i.id));
2306
+ }
2307
+ _generateChildId() {
2308
+ const { getNodeId: t } = this._collection.config, n = t ? t() : Jt();
2309
+ return qe([this._id, n], this._separator);
2310
+ }
2311
+ append(t, n = "object") {
2312
+ const r = this.getChildren(), i = Wt(r, (u) => m(u, "data.position", 0)), o = (i ? m(i, "data.position", 0) : -1) + 1, a = this._generateChildId(), c = { id: a, position: o, value: t, type: n };
2313
+ return this._collection.create(c), a;
2314
+ }
2315
+ prepend(t, n = "object") {
2316
+ const r = this.getChildren(), i = ia(r, (u) => m(u, "data.position", 0)), o = (i ? m(i, "data.position", 0) : 1) - 1, a = this._generateChildId(), c = { id: a, position: o, value: t, type: n };
2317
+ return this._collection.create(c), a;
2318
+ }
2319
+ /**
2320
+ * Move node to a new position within the same parent (reordering)
2321
+ * or to a different parent (reparenting).
2322
+ *
2323
+ * @param targetPosition - The target position among siblings
2324
+ * @param targetParent - Optional target parent node. If not provided, moves within current parent.
2325
+ */
2326
+ move(t, n) {
2327
+ const r = this.data;
2328
+ if (!r) return;
2329
+ const i = Xt(this._id, this._separator);
2330
+ if (!i) return;
2331
+ if (!n) {
2332
+ const o = r.position;
2333
+ if (o === t) return;
2334
+ const c = this._collection.getNode(i).getChildren(), u = Ze(c, (l) => m(l, "data.position") === t);
2335
+ this._collection.batch(() => {
2336
+ u && this._collection.update(u.id, (l) => {
2337
+ l.position = o;
2338
+ }), this._collection.update(this._id, (l) => {
2339
+ l.position = t;
2340
+ });
2341
+ });
2342
+ return;
2343
+ }
2344
+ if (n.id === i) {
2345
+ this.move(t);
2346
+ return;
2347
+ }
2348
+ if (n.id === this._id || Qe(n.id, this._id, this._separator))
2349
+ return;
2350
+ const s = this.clone();
2351
+ this._collection.batch(() => {
2352
+ n._mergeClonedSubset(s, t), this.remove();
2353
+ });
2354
+ }
2355
+ /**
2356
+ * Clone this node and all its descendants into a Map with remapped IDs.
2357
+ * The root of the clone has a temporary ID that will be remapped when merged.
2358
+ * @returns Map of cloned nodes keyed by their relative path from clone root
2359
+ */
2360
+ clone() {
2361
+ const t = this.data;
2362
+ if (!t) return /* @__PURE__ */ new Map();
2363
+ const { getNodeId: n } = this._collection.config, r = n ? n() : Jt(), i = /* @__PURE__ */ new Map();
2364
+ i.set(r, {
2365
+ id: r,
2366
+ position: t.position,
2367
+ value: t.value,
2368
+ type: t.type
2369
+ });
2370
+ const s = Ce(
2371
+ [...this._collection.items.entries()],
2372
+ ([o]) => Qe(o, this._id, this._separator)
2373
+ );
2374
+ return Oe(s, ([o, a]) => {
2375
+ const c = o.slice(this._id.length + 1), u = qe([r, c], this._separator), l = a;
2376
+ i.set(u, {
2377
+ id: u,
2378
+ position: l.position,
2379
+ value: l.value,
2380
+ type: l.type
2381
+ });
2382
+ }), i;
2383
+ }
2384
+ /**
2385
+ * Internal method to merge a cloned subset under this node.
2386
+ * The cloned nodes will have their IDs prefixed with this node's ID.
2387
+ */
2388
+ _mergeClonedSubset(t, n) {
2389
+ if (t.size === 0) return;
2390
+ const r = [...t.keys()];
2391
+ let i = Ze(r, (a) => !a.includes(this._separator));
2392
+ if (i || (i = Uo(Me(r, (a) => a.length))), !i) return;
2393
+ const s = this._generateChildId();
2394
+ let o;
2395
+ if (n !== void 0)
2396
+ o = n;
2397
+ else {
2398
+ const a = this.getChildren(), c = Wt(a, (l) => m(l, "data.position", 0));
2399
+ o = (c ? m(c, "data.position", 0) : -1) + 1;
2400
+ }
2401
+ return Oe([...t.entries()], ([a, c]) => {
2402
+ let u;
2403
+ if (a === i)
2404
+ u = s;
2405
+ else {
2406
+ const f = a.slice(i.length);
2407
+ u = qe([s, f.slice(this._separator.length)], this._separator);
2408
+ }
2409
+ const l = {
2410
+ id: u,
2411
+ position: a === i ? o : c.position,
2412
+ value: c.value,
2413
+ type: c.type
2414
+ };
2415
+ this._collection.create(l);
2416
+ }), s;
2417
+ }
2418
+ updateProp(t) {
2419
+ this._collection.update(this._id, (n) => {
2420
+ t(n.value);
2421
+ });
2422
+ }
2423
+ remove() {
2424
+ const t = [...this._collection.items.keys()], n = Y(
2425
+ Ce(t, (i) => Qe(i, this._id, this._separator)),
2426
+ (i) => i
2427
+ ), r = [this._id, ...n];
2428
+ this._collection.batch(() => {
2429
+ const i = Me(r, (s) => -Zt(s, this._separator));
2430
+ Oe(i, (s) => this._collection.remove(s));
2431
+ });
2432
+ }
2433
+ select() {
2434
+ this._collection.selectNode(this._id);
2435
+ }
2436
+ _updateId(t) {
2437
+ this._id = t;
2438
+ }
2439
+ }
2440
+ class R {
2005
2441
  // Global cache of collection instances by id
2442
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
2006
2443
  static _cache = /* @__PURE__ */ new Map();
2007
2444
  // Get or create a collection instance
2008
2445
  static get(t) {
2009
- const n = q._cache.get(t.id);
2446
+ const n = R._cache.get(t.id);
2010
2447
  if (n)
2011
2448
  return n;
2012
- const r = new q(t);
2013
- return q._cache.set(t.id, r), r;
2449
+ const r = new R(t);
2450
+ return R._cache.set(t.id, r), r;
2014
2451
  }
2015
2452
  // Clear a specific collection from cache
2016
2453
  static clear(t) {
2017
- q._cache.delete(t);
2454
+ R._cache.delete(t);
2018
2455
  }
2019
2456
  // Clear all collections from cache
2020
2457
  static clearAll() {
2021
- q._cache.clear();
2458
+ R._cache.clear();
2459
+ }
2460
+ // Get existing collection by ID (returns undefined if not found)
2461
+ static getById(t) {
2462
+ return R._cache.get(t);
2022
2463
  }
2023
2464
  id;
2024
2465
  config;
2025
2466
  _state;
2026
2467
  _syncQueue;
2027
2468
  _fetchHandler;
2028
- _itemCache = /* @__PURE__ */ new Map();
2469
+ _itemCache = /* @__PURE__ */ new WeakMap();
2470
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
2471
+ _nodeCache = /* @__PURE__ */ new WeakMap();
2472
+ _selectedNodeId = null;
2029
2473
  _subscribers = /* @__PURE__ */ new Set();
2030
2474
  _hasInitialized = !1;
2031
2475
  _batchMode = !1;
2032
2476
  constructor(t) {
2033
2477
  this.id = t.id, this.config = t;
2034
- const n = async (i) => i.map((o) => ({ id: o.id, status: "success" }));
2035
- this._syncQueue = new Vi({
2478
+ const n = async (s) => s.map((o) => ({ id: o.id, status: "success" }));
2479
+ this._syncQueue = new xa({
2036
2480
  debounce: t.syncDebounce ?? 300,
2037
2481
  maxRetries: t.syncRetries ?? 3,
2038
2482
  onSync: t.onSync ?? n,
2039
- onIdRemap: (i) => this._handleIdRemap(i)
2040
- }), this._fetchHandler = new Ji({
2483
+ onIdRemap: (s) => this._handleIdRemap(s)
2484
+ }), this._fetchHandler = new Ta({
2041
2485
  id: t.id,
2042
2486
  cacheCapacity: t.cacheCapacity ?? 10,
2043
2487
  cacheTtl: t.cacheTtl ?? 6e4,
2044
2488
  retries: t.fetchRetries ?? 0,
2045
2489
  onFetch: t.onFetch
2046
2490
  });
2047
- const r = this._syncQueue.getState(), s = this._fetchHandler.getState();
2491
+ const r = this._syncQueue.getState(), i = this._fetchHandler.getState();
2048
2492
  this._state = {
2049
2493
  context: t.initialContext,
2050
2494
  items: /* @__PURE__ */ new Map(),
@@ -2052,8 +2496,8 @@ class q {
2052
2496
  loading: !1,
2053
2497
  syncing: !1,
2054
2498
  syncQueue: r,
2055
- fetchStatus: s.status,
2056
- fetchError: s.error
2499
+ fetchStatus: i.status,
2500
+ fetchError: i.error
2057
2501
  }, this._syncQueue.subscribe(() => {
2058
2502
  this._onSyncQueueChange();
2059
2503
  }), this._fetchHandler.subscribe(() => {
@@ -2088,35 +2532,35 @@ class q {
2088
2532
  }
2089
2533
  // Get item status from sync queue state
2090
2534
  getItemStatus(t) {
2091
- const { queue: n, inFlight: r, errors: s } = this._state.syncQueue, i = r.get(t);
2092
- if (i && i.length > 0)
2535
+ const { queue: n, inFlight: r, errors: i } = this._state.syncQueue, s = r.get(t), o = fe(s);
2536
+ if (o)
2093
2537
  return {
2094
- type: i[i.length - 1].type,
2538
+ type: o.type,
2095
2539
  status: "syncing",
2096
- retries: s.get(t)?.retries ?? 0
2540
+ retries: m(i.get(t), "retries", 0)
2097
2541
  };
2098
- const o = n.get(t);
2099
- if (o && o.length > 0) {
2100
- const c = o[o.length - 1], u = s.get(t);
2542
+ const a = n.get(t), c = fe(a);
2543
+ if (c) {
2544
+ const l = i.get(t);
2101
2545
  return {
2102
2546
  type: c.type,
2103
- status: u ? "error" : "pending",
2104
- retries: u?.retries ?? 0,
2105
- error: u?.error
2547
+ status: l ? "error" : "pending",
2548
+ retries: m(l, "retries", 0),
2549
+ error: m(l, "error")
2106
2550
  };
2107
2551
  }
2108
- const a = s.get(t);
2109
- return a ? {
2552
+ const u = i.get(t);
2553
+ return u ? {
2110
2554
  type: "update",
2111
2555
  status: "error",
2112
- retries: a.retries,
2113
- error: a.error
2556
+ retries: u.retries,
2557
+ error: u.error
2114
2558
  } : null;
2115
2559
  }
2116
2560
  // Create a new item (local-first)
2117
2561
  create(t) {
2118
2562
  const n = this.config.getId(t);
2119
- this._state = P(this._state, (r) => {
2563
+ this._state = I(this._state, (r) => {
2120
2564
  r.items.set(n, t);
2121
2565
  }), this._fetchHandler.invalidateCache(), this._notifySubscribers(), this._syncQueue.enqueue({ id: n, type: "create", data: t });
2122
2566
  }
@@ -2124,32 +2568,64 @@ class q {
2124
2568
  update(t, n) {
2125
2569
  const r = this._state.items.get(t);
2126
2570
  if (!r) return;
2127
- const s = P(r, n);
2128
- this._state = P(this._state, (i) => {
2129
- i.items.set(t, s);
2130
- }), this._fetchHandler.invalidateCache(), this._notifySubscribers(), this._syncQueue.enqueue({ id: t, type: "update", data: s });
2571
+ const i = I(r, n);
2572
+ this._state = I(this._state, (s) => {
2573
+ s.items.set(t, i);
2574
+ }), this._fetchHandler.invalidateCache(), this._notifySubscribers(), this._syncQueue.enqueue({ id: t, type: "update", data: i });
2131
2575
  }
2132
2576
  // Remove an item (local-first)
2133
2577
  remove(t) {
2134
2578
  const n = this._state.items.get(t);
2135
- n && (this._state = P(this._state, (r) => {
2579
+ n && (this._state = I(this._state, (r) => {
2136
2580
  r.items.delete(t);
2137
- }), this._itemCache.delete(t), this._fetchHandler.invalidateCache(), this._notifySubscribers(), this._syncQueue.enqueue({ id: t, type: "delete", data: n }));
2581
+ }), this._fetchHandler.invalidateCache(), this._notifySubscribers(), this._syncQueue.enqueue({ id: t, type: "delete", data: n }));
2138
2582
  }
2139
- // Get Item reference (cached) - automatically retains the item
2583
+ // Get Item reference (cached by data object)
2140
2584
  getItem(t) {
2141
- let n = this._itemCache.get(t);
2142
- return n || (n = new ki(this, t), this._itemCache.set(t, n)), n._retain(), n;
2585
+ const n = this._state.items.get(t);
2586
+ if (!n)
2587
+ return new Yt(this, t);
2588
+ const r = n;
2589
+ let i = this._itemCache.get(r);
2590
+ return i || (i = new Yt(this, t), this._itemCache.set(r, i)), i;
2591
+ }
2592
+ // Get Node reference (cached by data object) - for tree collections
2593
+ getNode(t) {
2594
+ const n = this._state.items.get(t);
2595
+ if (!n)
2596
+ return new kt(this, t);
2597
+ const r = n;
2598
+ let i = this._nodeCache.get(r);
2599
+ return i || (i = new kt(this, t), this._nodeCache.set(r, i)), i;
2600
+ }
2601
+ // Execute multiple operations with single notification at the end
2602
+ batch(t) {
2603
+ this._batchMode = !0;
2604
+ try {
2605
+ t();
2606
+ } finally {
2607
+ this._batchMode = !1, this._notifySubscribers();
2608
+ }
2609
+ }
2610
+ // Selection methods for tree nodes
2611
+ selectNode(t) {
2612
+ this._selectedNodeId !== t && (this._selectedNodeId = t, this._notifySubscribers());
2613
+ }
2614
+ deselectNode() {
2615
+ this._selectedNodeId !== null && (this._selectedNodeId = null, this._notifySubscribers());
2143
2616
  }
2144
- // Release item from cache when ref count reaches zero
2145
- _releaseItem(t) {
2146
- this._itemCache.delete(t);
2617
+ get selectedNodeId() {
2618
+ return this._selectedNodeId;
2619
+ }
2620
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
2621
+ get selectedNode() {
2622
+ return this._selectedNodeId ? this.getNode(this._selectedNodeId) : null;
2147
2623
  }
2148
2624
  // Update context and refetch
2149
2625
  setContext(t) {
2150
- const n = this._state.context, r = P(n, t);
2151
- n !== r && (this._state = P(this._state, (s) => {
2152
- s.context = r;
2626
+ const n = this._state.context, r = I(n, t);
2627
+ n !== r && (this._state = I(this._state, (i) => {
2628
+ i.context = r;
2153
2629
  }), this._fetchHandler.fetch(r), this._notifySubscribers());
2154
2630
  }
2155
2631
  // Force refresh (bypass cache)
@@ -2168,7 +2644,7 @@ class q {
2168
2644
  }
2169
2645
  // Cleanup everything and remove from global cache
2170
2646
  destroy() {
2171
- this._syncQueue.destroy(), this._fetchHandler.destroy(), this._itemCache.clear(), this._subscribers.clear(), q._cache.delete(this.id);
2647
+ this._syncQueue.destroy(), this._fetchHandler.destroy(), this._subscribers.clear(), R._cache.delete(this.id);
2172
2648
  }
2173
2649
  // Private methods
2174
2650
  async _initialFetch() {
@@ -2180,26 +2656,26 @@ class q {
2180
2656
  }
2181
2657
  _onFetchChange() {
2182
2658
  const t = this._fetchHandler.getState();
2183
- this._state = P(this._state, (n) => {
2659
+ this._state = I(this._state, (n) => {
2184
2660
  n.fetchStatus = t.status, n.fetchError = t.error, n.loading = t.status === "fetching", n.syncState = this._computeSyncState(t.status, n.syncQueue.isSyncing);
2185
- const { queue: r, inFlight: s } = this._state.syncQueue, i = /* @__PURE__ */ new Map();
2661
+ const { queue: r, inFlight: i } = this._state.syncQueue, s = /* @__PURE__ */ new Map();
2186
2662
  for (const o of t.items) {
2187
2663
  const a = this.config.getId(o);
2188
- i.set(a, o);
2664
+ s.set(a, o);
2189
2665
  }
2190
2666
  for (const [o, a] of r) {
2191
- const c = a[a.length - 1];
2192
- (c.type === "create" || c.type === "update") && i.set(o, c.data);
2667
+ const c = fe(a);
2668
+ c && (c.type === "create" || c.type === "update") && s.set(o, c.data);
2193
2669
  }
2194
- for (const [o, a] of s) {
2195
- const c = a[a.length - 1];
2196
- (c.type === "create" || c.type === "update") && i.set(o, c.data);
2670
+ for (const [o, a] of i) {
2671
+ const c = fe(a);
2672
+ c && (c.type === "create" || c.type === "update") && s.set(o, c.data);
2197
2673
  }
2198
- n.items = i;
2674
+ n.items = s;
2199
2675
  }), this._notifySubscribers();
2200
2676
  }
2201
2677
  _updateSyncState(t) {
2202
- this._state = P(this._state, (n) => {
2678
+ this._state = I(this._state, (n) => {
2203
2679
  n.syncQueue = t, n.syncing = t.isSyncing, n.syncState = this._computeSyncState(n.fetchStatus, t.isSyncing);
2204
2680
  }), this._notifySubscribers();
2205
2681
  }
@@ -2214,24 +2690,27 @@ class q {
2214
2690
  _handleIdRemap(t) {
2215
2691
  if (t.length === 0) return;
2216
2692
  const { setId: n } = this.config;
2217
- this._state = P(this._state, (r) => {
2218
- for (const { tempId: s, newId: i } of t) {
2219
- const o = r.items.get(s);
2693
+ this._state = I(this._state, (r) => {
2694
+ for (const { tempId: i, newId: s } of t) {
2695
+ const o = r.items.get(i);
2220
2696
  if (o) {
2221
2697
  let a;
2222
- n ? a = n(o, i) : (o.id = i, a = o), r.items.delete(s), r.items.set(i, a);
2698
+ n ? a = n(o, s) : (o.id = s, a = o), r.items.delete(i), r.items.set(s, a);
2223
2699
  }
2224
2700
  }
2225
2701
  });
2226
- for (const { tempId: r, newId: s } of t) {
2227
- const i = this._itemCache.get(r);
2228
- i && (i._updateId(s), this._itemCache.delete(r), this._itemCache.set(s, i));
2702
+ for (const { newId: r } of t) {
2703
+ const i = this._state.items.get(r);
2704
+ if (i) {
2705
+ const s = i, o = this._itemCache.get(s);
2706
+ o && o._updateId(r);
2707
+ }
2229
2708
  }
2230
2709
  this._notifySubscribers();
2231
2710
  }
2232
2711
  }
2233
- function to(e) {
2234
- const t = q.get(e), n = ue(
2712
+ function Da(e) {
2713
+ const t = R.get(e), n = j(
2235
2714
  (r) => t.subscribe(r),
2236
2715
  () => t.getState(),
2237
2716
  () => t.getState()
@@ -2248,7 +2727,7 @@ function to(e) {
2248
2727
  fetchError: n.fetchError,
2249
2728
  // Item operations
2250
2729
  create: (r) => t.create(r),
2251
- update: (r, s) => t.update(r, s),
2730
+ update: (r, i) => t.update(r, i),
2252
2731
  remove: (r) => t.remove(r),
2253
2732
  getItem: (r) => t.getItem(r),
2254
2733
  getItemStatus: (r) => t.getItemStatus(r),
@@ -2261,39 +2740,216 @@ function to(e) {
2261
2740
  retrySync: (r) => t.retrySync(r)
2262
2741
  };
2263
2742
  }
2264
- function no(e) {
2265
- Xt(() => () => {
2266
- queueMicrotask(() => e._release());
2267
- }, [e]);
2268
- const t = ue(
2743
+ function Ha(e) {
2744
+ const t = R.get(e), n = j(
2745
+ (a) => t.subscribe(a),
2746
+ () => t.getState(),
2747
+ () => t.getState()
2748
+ ), r = j(
2749
+ (a) => t.subscribe(a),
2750
+ () => t.items.get(e.rootId) ? t.getNode(e.rootId) : null,
2751
+ () => t.items.get(e.rootId) ? t.getNode(e.rootId) : null
2752
+ ), i = j(
2753
+ (a) => t.subscribe(a),
2754
+ () => t.selectedNodeId,
2755
+ () => t.selectedNodeId
2756
+ ), s = j(
2757
+ (a) => t.subscribe(a),
2758
+ () => t.selectedNode,
2759
+ () => t.selectedNode
2760
+ ), o = T(() => {
2761
+ const a = e.nodeSeparator ?? ".", c = (l, f) => l.startsWith(f + a) ? !l.slice(f.length + 1).includes(a) : !1, u = (l) => {
2762
+ const f = n.items.get(l);
2763
+ if (!f) return null;
2764
+ const h = Y(
2765
+ Ce([...n.items.entries()], ([b]) => c(b, l)),
2766
+ ([b, w]) => ({ id: b, position: w.position })
2767
+ ), p = Me(h, "position"), g = Y(p, (b) => u(b.id)).filter(Boolean);
2768
+ return {
2769
+ id: f.id,
2770
+ type: f.type,
2771
+ value: f.value,
2772
+ ...g.length > 0 ? { children: g } : {}
2773
+ };
2774
+ };
2775
+ return u(e.rootId);
2776
+ }, [n.items, e.rootId, e.nodeSeparator]);
2777
+ return {
2778
+ // Root node for tree operations
2779
+ rootNode: r,
2780
+ // State (all from single immutable state object)
2781
+ items: n.items,
2782
+ context: n.context,
2783
+ syncState: n.syncState,
2784
+ syncQueue: n.syncQueue,
2785
+ loading: n.loading,
2786
+ syncing: n.syncing,
2787
+ fetchStatus: n.fetchStatus,
2788
+ fetchError: n.fetchError,
2789
+ // Node operations
2790
+ getNode: (a) => t.getNode(a),
2791
+ getNodeStatus: (a) => t.getItemStatus(a),
2792
+ // Context & refresh
2793
+ setContext: (a) => t.setContext(a),
2794
+ refresh: () => t.refresh(),
2795
+ // Sync controls
2796
+ pauseSync: () => t.pauseSync(),
2797
+ resumeSync: () => t.resumeSync(),
2798
+ retrySync: (a) => t.retrySync(a),
2799
+ // Selection
2800
+ selectNode: (a) => t.selectNode(a),
2801
+ deselectNode: () => t.deselectNode(),
2802
+ selectedNodeId: i,
2803
+ selectedNode: s,
2804
+ // Serialization
2805
+ toJson: o
2806
+ };
2807
+ }
2808
+ function La(e) {
2809
+ const t = j(
2269
2810
  (o) => e.collection.subscribe(o),
2270
2811
  () => e.data,
2271
2812
  () => e.data
2272
- ), n = ue(
2813
+ ), n = j(
2273
2814
  (o) => e.collection.subscribe(o),
2274
2815
  () => e.getStatus(),
2275
2816
  () => e.getStatus()
2276
- ), r = ue(
2817
+ ), r = j(
2277
2818
  (o) => e.collection.subscribe(o),
2278
2819
  () => e.exists(),
2279
2820
  () => e.exists()
2280
- ), s = Xe((o) => e.update(o), [e]), i = Xe(() => e.remove(), [e]);
2281
- return { data: t, status: n, update: s, remove: i, exists: r };
2821
+ ), i = T((o) => e.update(o), [e]), s = T(() => e.remove(), [e]);
2822
+ return { data: t, status: n, update: i, remove: s, exists: r };
2823
+ }
2824
+ function ja(e, t) {
2825
+ if (!O(oe(e), oe(t))) return !0;
2826
+ for (let n = 0; n < oe(e); n++)
2827
+ if (!O(e[n].id, t[n].id)) return !0;
2828
+ return !1;
2829
+ }
2830
+ const $a = {
2831
+ data: void 0,
2832
+ status: null,
2833
+ exists: !1,
2834
+ isSelected: !1,
2835
+ children: []
2836
+ };
2837
+ function Fa(e) {
2838
+ const t = Nn(null), n = j(
2839
+ (h) => e.collection.subscribe(h),
2840
+ () => {
2841
+ const h = e.getChildren(), p = t.current, g = p && !ja(p.children, h) ? p.children : h, b = {
2842
+ data: e.data,
2843
+ status: e.getStatus(),
2844
+ exists: e.exists(),
2845
+ isSelected: O(e.collection.selectedNodeId, e.id),
2846
+ children: g
2847
+ };
2848
+ return O(p, b) || (t.current = b), t.current;
2849
+ },
2850
+ () => t.current ?? $a
2851
+ ), r = T(() => e.getParent(), [e]), i = T((h, p) => e.append(h, p), [e]), s = T((h, p) => e.prepend(h, p), [e]), o = T(
2852
+ (h, p) => e.move(h, p),
2853
+ [e]
2854
+ ), a = T(() => e.clone(), [e]), c = T(
2855
+ (h) => e.updateProp(h),
2856
+ [e]
2857
+ ), u = T(() => e.remove(), [e]), l = T(() => e.select(), [e]), f = T(() => e.collection.deselectNode(), [e]);
2858
+ return {
2859
+ isPresent: !0,
2860
+ data: n.data,
2861
+ status: n.status,
2862
+ exists: n.exists,
2863
+ isSelected: n.isSelected,
2864
+ depth: e.depth,
2865
+ getParent: r,
2866
+ children: n.children,
2867
+ append: i,
2868
+ prepend: s,
2869
+ move: o,
2870
+ clone: a,
2871
+ updateProp: c,
2872
+ remove: u,
2873
+ select: l,
2874
+ deselect: f
2875
+ };
2876
+ }
2877
+ const za = {
2878
+ isPresent: !1,
2879
+ data: void 0,
2880
+ status: null,
2881
+ exists: !1,
2882
+ isSelected: !1,
2883
+ depth: 0,
2884
+ getParent: () => null,
2885
+ children: [],
2886
+ append: () => "",
2887
+ prepend: () => "",
2888
+ move: () => {
2889
+ },
2890
+ clone: () => /* @__PURE__ */ new Map(),
2891
+ updateProp: () => {
2892
+ },
2893
+ remove: () => {
2894
+ },
2895
+ select: () => {
2896
+ },
2897
+ deselect: () => {
2898
+ }
2899
+ };
2900
+ function qa(e) {
2901
+ const t = R.getById(e);
2902
+ if (!t)
2903
+ throw new Error(
2904
+ `Collection with id "${e}" not found. Make sure useCrud is called first.`
2905
+ );
2906
+ const n = j(
2907
+ (s) => t.subscribe(s),
2908
+ () => t.selectedNode,
2909
+ () => t.selectedNode
2910
+ ), r = Dn(() => t.getNode("__dummy__"), [t]), i = Fa(n ?? r);
2911
+ return n ? i : za;
2912
+ }
2913
+ function Qa(e) {
2914
+ const t = R.getById(e);
2915
+ if (!t)
2916
+ throw new Error(
2917
+ `Collection with id "${e}" not found. Make sure useCrud is called first.`
2918
+ );
2919
+ const n = j(
2920
+ (r) => t.subscribe(r),
2921
+ () => t.getState(),
2922
+ () => t.getState()
2923
+ );
2924
+ return {
2925
+ syncState: n.syncState,
2926
+ syncing: n.syncing,
2927
+ queue: n.syncQueue.queue,
2928
+ inFlight: n.syncQueue.inFlight,
2929
+ errors: n.syncQueue.errors,
2930
+ isPaused: n.syncQueue.isPaused,
2931
+ isSyncing: n.syncQueue.isSyncing
2932
+ };
2282
2933
  }
2283
2934
  export {
2284
- Zi as Cache,
2285
- q as Collection,
2286
- Ji as FetchHandler,
2287
- ki as Item,
2288
- Vi as SyncQueue,
2289
- io as categorizeResults,
2290
- ao as createSyncClient,
2291
- co as createSyncClientFromEndpoint,
2292
- uo as createSyncClientWithStats,
2293
- fo as fetchToSyncResult,
2294
- lo as syncError,
2295
- ho as syncSuccess,
2296
- to as useCrud,
2297
- no as useItem
2935
+ Ea as Cache,
2936
+ R as Collection,
2937
+ Ta as FetchHandler,
2938
+ Yt as Item,
2939
+ kt as Node,
2940
+ xa as SyncQueue,
2941
+ Ga as categorizeResults,
2942
+ Wa as createSyncClient,
2943
+ Va as createSyncClientFromEndpoint,
2944
+ Ja as createSyncClientWithStats,
2945
+ Ya as fetchToSyncResult,
2946
+ Xa as syncError,
2947
+ Za as syncSuccess,
2948
+ Da as useCrud,
2949
+ Ha as useCrudTree,
2950
+ La as useItem,
2951
+ Fa as useNode,
2952
+ qa as useSelectedNode,
2953
+ Qa as useSyncState
2298
2954
  };
2299
2955
  //# sourceMappingURL=index.js.map