use-abcd 1.6.4 → 1.6.7
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 +484 -481
- package/dist/index.js.map +1 -1
- package/dist/useCrud.d.ts +1 -1
- package/dist/useItem.d.ts +3 -1
- package/dist/useNode.d.ts +3 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { useMemo as le, useSyncExternalStore as v, useCallback as
|
|
2
|
-
import { b as oe, c as
|
|
3
|
-
import { H as
|
|
4
|
-
import { c as
|
|
5
|
-
const
|
|
1
|
+
import { useMemo as le, useSyncExternalStore as v, useCallback as S } from "react";
|
|
2
|
+
import { b as oe, c as Y, d as gt, e as fe, f as Ge, h as he, j as Xe, S as Ne, i as K, k as Ze, l as wt, n as ke, o as vt, p as W, q as Ct, r as Mt, s as xt, t as Ot, u as Pt, v as et, w as Rt, x as tt, y as Et, z as It, A as Nt, B as de, C as zt, D as At, E as Ft, F as jt, a as z, m as U, g as ze } from "./chunks/utils-C2wXstxP.js";
|
|
3
|
+
import { H as Hs, G as Bs } from "./chunks/utils-C2wXstxP.js";
|
|
4
|
+
import { c as Ks } from "./chunks/client-lHRDCo64.js";
|
|
5
|
+
const y = {
|
|
6
6
|
Remove: "remove",
|
|
7
7
|
Replace: "replace",
|
|
8
8
|
Add: "add"
|
|
9
|
-
},
|
|
9
|
+
}, nt = Symbol.for("__MUTATIVE_PROXY_DRAFT__"), Dt = Symbol("__MUTATIVE_RAW_RETURN_SYMBOL__"), ee = Symbol.iterator, O = {
|
|
10
10
|
mutable: "mutable",
|
|
11
11
|
immutable: "immutable"
|
|
12
|
-
},
|
|
13
|
-
function
|
|
12
|
+
}, Me = {};
|
|
13
|
+
function J(e, t) {
|
|
14
14
|
return e instanceof Map ? e.has(t) : Object.prototype.hasOwnProperty.call(e, t);
|
|
15
15
|
}
|
|
16
16
|
function Ae(e, t) {
|
|
@@ -24,48 +24,48 @@ function Ae(e, t) {
|
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
|
-
function
|
|
27
|
+
function xe(e) {
|
|
28
28
|
return Object.getPrototypeOf(e) === Set.prototype;
|
|
29
29
|
}
|
|
30
|
-
function
|
|
30
|
+
function Oe(e) {
|
|
31
31
|
return Object.getPrototypeOf(e) === Map.prototype;
|
|
32
32
|
}
|
|
33
33
|
function x(e) {
|
|
34
34
|
var t;
|
|
35
35
|
return (t = e.copy) !== null && t !== void 0 ? t : e.original;
|
|
36
36
|
}
|
|
37
|
-
function
|
|
38
|
-
return !!
|
|
37
|
+
function D(e) {
|
|
38
|
+
return !!d(e);
|
|
39
39
|
}
|
|
40
|
-
function
|
|
41
|
-
return typeof e != "object" ? null : e?.[
|
|
40
|
+
function d(e) {
|
|
41
|
+
return typeof e != "object" ? null : e?.[nt];
|
|
42
42
|
}
|
|
43
|
-
function
|
|
43
|
+
function Pe(e) {
|
|
44
44
|
var t;
|
|
45
|
-
const n =
|
|
45
|
+
const n = d(e);
|
|
46
46
|
return n ? (t = n.copy) !== null && t !== void 0 ? t : n.original : e;
|
|
47
47
|
}
|
|
48
|
-
function
|
|
48
|
+
function E(e, t) {
|
|
49
49
|
if (!e || typeof e != "object")
|
|
50
50
|
return !1;
|
|
51
51
|
let n;
|
|
52
52
|
return Object.getPrototypeOf(e) === Object.prototype || Array.isArray(e) || e instanceof Map || e instanceof Set || !!t?.mark && ((n = t.mark(e, O)) === O.immutable || typeof n == "function");
|
|
53
53
|
}
|
|
54
|
-
function
|
|
54
|
+
function st(e, t = []) {
|
|
55
55
|
if (Object.hasOwnProperty.call(e, "key")) {
|
|
56
|
-
const n = e.parent.copy, s =
|
|
56
|
+
const n = e.parent.copy, s = d(F(n, e.key));
|
|
57
57
|
if (s !== null && s?.original !== e.original)
|
|
58
58
|
return null;
|
|
59
59
|
const i = e.parent.type === 3, r = i ? Array.from(e.parent.setMap.keys()).indexOf(e.key) : e.key;
|
|
60
|
-
if (!(i && n.size > r ||
|
|
60
|
+
if (!(i && n.size > r || J(n, r)))
|
|
61
61
|
return null;
|
|
62
62
|
t.push(r);
|
|
63
63
|
}
|
|
64
64
|
if (e.parent)
|
|
65
|
-
return
|
|
65
|
+
return st(e.parent, t);
|
|
66
66
|
t.reverse();
|
|
67
67
|
try {
|
|
68
|
-
|
|
68
|
+
Tt(e.copy, t);
|
|
69
69
|
} catch {
|
|
70
70
|
return null;
|
|
71
71
|
}
|
|
@@ -77,28 +77,28 @@ function $(e) {
|
|
|
77
77
|
function F(e, t) {
|
|
78
78
|
return $(e) === 2 ? e.get(t) : e[t];
|
|
79
79
|
}
|
|
80
|
-
function
|
|
80
|
+
function X(e, t, n) {
|
|
81
81
|
$(e) === 2 ? e.set(t, n) : e[t] = n;
|
|
82
82
|
}
|
|
83
83
|
function pe(e, t) {
|
|
84
|
-
const n =
|
|
84
|
+
const n = d(e);
|
|
85
85
|
return (n ? x(n) : e)[t];
|
|
86
86
|
}
|
|
87
87
|
function A(e, t) {
|
|
88
88
|
return e === t ? e !== 0 || 1 / e === 1 / t : e !== e && t !== t;
|
|
89
89
|
}
|
|
90
|
-
function
|
|
90
|
+
function be(e) {
|
|
91
91
|
if (e)
|
|
92
92
|
for (; e.finalities.revoke.length > 0; )
|
|
93
93
|
e.finalities.revoke.pop()();
|
|
94
94
|
}
|
|
95
|
-
function
|
|
95
|
+
function T(e, t) {
|
|
96
96
|
return t ? e : [""].concat(e).map((n) => {
|
|
97
97
|
const s = `${n}`;
|
|
98
98
|
return s.indexOf("/") === -1 && s.indexOf("~") === -1 ? s : s.replace(/~/g, "~0").replace(/\//g, "~1");
|
|
99
99
|
}).join("/");
|
|
100
100
|
}
|
|
101
|
-
function
|
|
101
|
+
function Tt(e, t) {
|
|
102
102
|
for (let n = 0; n < t.length - 1; n += 1) {
|
|
103
103
|
const s = t[n];
|
|
104
104
|
if (e = F($(e) === 3 ? Array.from(e) : e, s), typeof e != "object")
|
|
@@ -106,7 +106,7 @@ function jt(e, t) {
|
|
|
106
106
|
}
|
|
107
107
|
return e;
|
|
108
108
|
}
|
|
109
|
-
function
|
|
109
|
+
function qt(e) {
|
|
110
110
|
const t = Object.create(Object.getPrototypeOf(e));
|
|
111
111
|
return Reflect.ownKeys(e).forEach((n) => {
|
|
112
112
|
let s = Reflect.getOwnPropertyDescriptor(e, n);
|
|
@@ -122,26 +122,26 @@ function Dt(e) {
|
|
|
122
122
|
}), Reflect.defineProperty(t, n, s);
|
|
123
123
|
}), t;
|
|
124
124
|
}
|
|
125
|
-
const
|
|
126
|
-
function
|
|
125
|
+
const $t = Object.prototype.propertyIsEnumerable;
|
|
126
|
+
function it(e, t) {
|
|
127
127
|
let n;
|
|
128
128
|
if (Array.isArray(e))
|
|
129
129
|
return Array.prototype.concat.call(e);
|
|
130
130
|
if (e instanceof Set) {
|
|
131
|
-
if (!
|
|
131
|
+
if (!xe(e)) {
|
|
132
132
|
const s = Object.getPrototypeOf(e).constructor;
|
|
133
133
|
return new s(e.values());
|
|
134
134
|
}
|
|
135
135
|
return Set.prototype.difference ? Set.prototype.difference.call(e, /* @__PURE__ */ new Set()) : new Set(e.values());
|
|
136
136
|
} else if (e instanceof Map) {
|
|
137
|
-
if (!
|
|
137
|
+
if (!Oe(e)) {
|
|
138
138
|
const s = Object.getPrototypeOf(e).constructor;
|
|
139
139
|
return new s(e);
|
|
140
140
|
}
|
|
141
141
|
return new Map(e);
|
|
142
142
|
} else if (t?.mark && (n = t.mark(e, O), n !== void 0) && n !== O.mutable) {
|
|
143
143
|
if (n === O.immutable)
|
|
144
|
-
return
|
|
144
|
+
return qt(e);
|
|
145
145
|
if (typeof n == "function") {
|
|
146
146
|
if (t.enablePatches || t.enableAutoFreeze)
|
|
147
147
|
throw new Error("You can't use mark and patches or auto freeze together.");
|
|
@@ -153,33 +153,33 @@ function nt(e, t) {
|
|
|
153
153
|
return Object.keys(e).forEach((i) => {
|
|
154
154
|
s[i] = e[i];
|
|
155
155
|
}), Object.getOwnPropertySymbols(e).forEach((i) => {
|
|
156
|
-
|
|
156
|
+
$t.call(e, i) && (s[i] = e[i]);
|
|
157
157
|
}), s;
|
|
158
158
|
} else
|
|
159
159
|
throw new Error("Please check mark() to ensure that it is a stable marker draftable function.");
|
|
160
160
|
}
|
|
161
161
|
function w(e) {
|
|
162
|
-
e.copy || (e.copy =
|
|
162
|
+
e.copy || (e.copy = it(e.original, e.options));
|
|
163
163
|
}
|
|
164
|
-
function
|
|
165
|
-
if (!
|
|
166
|
-
return
|
|
164
|
+
function L(e) {
|
|
165
|
+
if (!E(e))
|
|
166
|
+
return Pe(e);
|
|
167
167
|
if (Array.isArray(e))
|
|
168
|
-
return e.map(
|
|
168
|
+
return e.map(L);
|
|
169
169
|
if (e instanceof Map) {
|
|
170
170
|
const n = Array.from(e.entries()).map(([s, i]) => [
|
|
171
171
|
s,
|
|
172
|
-
|
|
172
|
+
L(i)
|
|
173
173
|
]);
|
|
174
|
-
if (!
|
|
174
|
+
if (!Oe(e)) {
|
|
175
175
|
const s = Object.getPrototypeOf(e).constructor;
|
|
176
176
|
return new s(n);
|
|
177
177
|
}
|
|
178
178
|
return new Map(n);
|
|
179
179
|
}
|
|
180
180
|
if (e instanceof Set) {
|
|
181
|
-
const n = Array.from(e).map(
|
|
182
|
-
if (!
|
|
181
|
+
const n = Array.from(e).map(L);
|
|
182
|
+
if (!xe(e)) {
|
|
183
183
|
const s = Object.getPrototypeOf(e).constructor;
|
|
184
184
|
return new s(n);
|
|
185
185
|
}
|
|
@@ -187,20 +187,20 @@ function J(e) {
|
|
|
187
187
|
}
|
|
188
188
|
const t = Object.create(Object.getPrototypeOf(e));
|
|
189
189
|
for (const n in e)
|
|
190
|
-
t[n] =
|
|
190
|
+
t[n] = L(e[n]);
|
|
191
191
|
return t;
|
|
192
192
|
}
|
|
193
193
|
function te(e) {
|
|
194
|
-
return
|
|
194
|
+
return D(e) ? L(e) : e;
|
|
195
195
|
}
|
|
196
|
-
function
|
|
196
|
+
function I(e) {
|
|
197
197
|
var t;
|
|
198
|
-
e.assignedMap = (t = e.assignedMap) !== null && t !== void 0 ? t : /* @__PURE__ */ new Map(), e.operated || (e.operated = !0, e.parent &&
|
|
198
|
+
e.assignedMap = (t = e.assignedMap) !== null && t !== void 0 ? t : /* @__PURE__ */ new Map(), e.operated || (e.operated = !0, e.parent && I(e.parent));
|
|
199
199
|
}
|
|
200
200
|
function Fe() {
|
|
201
201
|
throw new Error("Cannot modify frozen object");
|
|
202
202
|
}
|
|
203
|
-
function
|
|
203
|
+
function B(e, t, n, s, i) {
|
|
204
204
|
{
|
|
205
205
|
n = n ?? /* @__PURE__ */ new WeakMap(), s = s ?? [], i = i ?? [];
|
|
206
206
|
const o = n.has(e) ? n.get(e) : e;
|
|
@@ -217,36 +217,36 @@ function U(e, t, n, s, i) {
|
|
|
217
217
|
} else
|
|
218
218
|
s.push(o);
|
|
219
219
|
}
|
|
220
|
-
if (Object.isFrozen(e) ||
|
|
220
|
+
if (Object.isFrozen(e) || D(e)) {
|
|
221
221
|
s.pop(), i.pop();
|
|
222
222
|
return;
|
|
223
223
|
}
|
|
224
224
|
switch ($(e)) {
|
|
225
225
|
case 2:
|
|
226
226
|
for (const [c, a] of e)
|
|
227
|
-
|
|
227
|
+
B(c, c, n, s, i), B(a, c, n, s, i);
|
|
228
228
|
e.set = e.clear = e.delete = Fe;
|
|
229
229
|
break;
|
|
230
230
|
case 3:
|
|
231
231
|
for (const c of e)
|
|
232
|
-
|
|
232
|
+
B(c, c, n, s, i);
|
|
233
233
|
e.add = e.clear = e.delete = Fe;
|
|
234
234
|
break;
|
|
235
235
|
case 1:
|
|
236
236
|
Object.freeze(e);
|
|
237
237
|
let o = 0;
|
|
238
238
|
for (const c of e)
|
|
239
|
-
|
|
239
|
+
B(c, o, n, s, i), o += 1;
|
|
240
240
|
break;
|
|
241
241
|
default:
|
|
242
242
|
Object.freeze(e), Object.keys(e).forEach((c) => {
|
|
243
243
|
const a = e[c];
|
|
244
|
-
|
|
244
|
+
B(a, c, n, s, i);
|
|
245
245
|
});
|
|
246
246
|
}
|
|
247
247
|
s.pop(), i.pop();
|
|
248
248
|
}
|
|
249
|
-
function
|
|
249
|
+
function Re(e, t) {
|
|
250
250
|
const n = $(e);
|
|
251
251
|
if (n === 0)
|
|
252
252
|
Reflect.ownKeys(e).forEach((s) => {
|
|
@@ -259,19 +259,19 @@ function Ee(e, t) {
|
|
|
259
259
|
} else
|
|
260
260
|
e.forEach((s, i) => t(i, s, e));
|
|
261
261
|
}
|
|
262
|
-
function
|
|
263
|
-
if (
|
|
262
|
+
function rt(e, t, n) {
|
|
263
|
+
if (D(e) || !E(e, n) || t.has(e) || Object.isFrozen(e))
|
|
264
264
|
return;
|
|
265
265
|
const s = e instanceof Set, i = s ? /* @__PURE__ */ new Map() : void 0;
|
|
266
|
-
if (t.add(e),
|
|
266
|
+
if (t.add(e), Re(e, (r, o) => {
|
|
267
267
|
var c;
|
|
268
|
-
if (
|
|
269
|
-
const a =
|
|
268
|
+
if (D(o)) {
|
|
269
|
+
const a = d(o);
|
|
270
270
|
w(a);
|
|
271
271
|
const u = !((c = a.assignedMap) === null || c === void 0) && c.size || a.operated ? a.copy : a.original;
|
|
272
|
-
|
|
272
|
+
X(s ? i : e, r, u);
|
|
273
273
|
} else
|
|
274
|
-
|
|
274
|
+
rt(o, t, n);
|
|
275
275
|
}), i) {
|
|
276
276
|
const r = e, o = Array.from(r);
|
|
277
277
|
r.clear(), o.forEach((c) => {
|
|
@@ -279,60 +279,60 @@ function st(e, t, n) {
|
|
|
279
279
|
});
|
|
280
280
|
}
|
|
281
281
|
}
|
|
282
|
-
function
|
|
282
|
+
function Qt(e, t) {
|
|
283
283
|
const n = e.type === 3 ? e.setMap : e.copy;
|
|
284
|
-
e.finalities.revoke.length > 1 && e.assignedMap.get(t) && n &&
|
|
284
|
+
e.finalities.revoke.length > 1 && e.assignedMap.get(t) && n && rt(F(n, t), e.finalities.handledSet, e.options);
|
|
285
285
|
}
|
|
286
|
-
function
|
|
286
|
+
function me(e) {
|
|
287
287
|
e.type === 3 && e.copy && (e.copy.clear(), e.setMap.forEach((t) => {
|
|
288
|
-
e.copy.add(
|
|
288
|
+
e.copy.add(Pe(t));
|
|
289
289
|
}));
|
|
290
290
|
}
|
|
291
|
-
function
|
|
291
|
+
function Se(e, t, n, s) {
|
|
292
292
|
if (e.operated && e.assignedMap && e.assignedMap.size > 0 && !e.finalized) {
|
|
293
293
|
if (n && s) {
|
|
294
|
-
const r =
|
|
294
|
+
const r = st(e);
|
|
295
295
|
r && t(e, r, n, s);
|
|
296
296
|
}
|
|
297
297
|
e.finalized = !0;
|
|
298
298
|
}
|
|
299
299
|
}
|
|
300
|
-
function
|
|
301
|
-
const i =
|
|
300
|
+
function Ee(e, t, n, s) {
|
|
301
|
+
const i = d(n);
|
|
302
302
|
i && (i.callbacks || (i.callbacks = []), i.callbacks.push((r, o) => {
|
|
303
303
|
var c;
|
|
304
304
|
const a = e.type === 3 ? e.setMap : e.copy;
|
|
305
305
|
if (A(F(a, t), n)) {
|
|
306
306
|
let u = i.original;
|
|
307
|
-
i.copy && (u = i.copy),
|
|
307
|
+
i.copy && (u = i.copy), me(e), Se(e, s, r, o), e.options.enableAutoFreeze && (e.options.updatedValues = (c = e.options.updatedValues) !== null && c !== void 0 ? c : /* @__PURE__ */ new WeakMap(), e.options.updatedValues.set(u, i.original)), X(a, t, u);
|
|
308
308
|
}
|
|
309
|
-
}), e.options.enableAutoFreeze && i.finalities !== e.finalities && (e.options.enableAutoFreeze = !1)),
|
|
309
|
+
}), e.options.enableAutoFreeze && i.finalities !== e.finalities && (e.options.enableAutoFreeze = !1)), E(n, e.options) && e.finalities.draft.push(() => {
|
|
310
310
|
const r = e.type === 3 ? e.setMap : e.copy;
|
|
311
|
-
A(F(r, t), n) &&
|
|
311
|
+
A(F(r, t), n) && Qt(e, t);
|
|
312
312
|
});
|
|
313
313
|
}
|
|
314
|
-
function
|
|
314
|
+
function Ht(e, t, n, s, i) {
|
|
315
315
|
let { original: r, assignedMap: o, options: c } = e, a = e.copy;
|
|
316
316
|
a.length < r.length && ([r, a] = [a, r], [n, s] = [s, n]);
|
|
317
317
|
for (let u = 0; u < r.length; u += 1)
|
|
318
318
|
if (o.get(u.toString()) && a[u] !== r[u]) {
|
|
319
|
-
const l = t.concat([u]), f =
|
|
319
|
+
const l = t.concat([u]), f = T(l, i);
|
|
320
320
|
n.push({
|
|
321
|
-
op:
|
|
321
|
+
op: y.Replace,
|
|
322
322
|
path: f,
|
|
323
323
|
// If it is a draft, it needs to be deep cloned, and it may also be non-draft.
|
|
324
324
|
value: te(a[u])
|
|
325
325
|
}), s.push({
|
|
326
|
-
op:
|
|
326
|
+
op: y.Replace,
|
|
327
327
|
path: f,
|
|
328
328
|
// If it is a draft, it needs to be deep cloned, and it may also be non-draft.
|
|
329
329
|
value: te(r[u])
|
|
330
330
|
});
|
|
331
331
|
}
|
|
332
332
|
for (let u = r.length; u < a.length; u += 1) {
|
|
333
|
-
const l = t.concat([u]), f =
|
|
333
|
+
const l = t.concat([u]), f = T(l, i);
|
|
334
334
|
n.push({
|
|
335
|
-
op:
|
|
335
|
+
op: y.Add,
|
|
336
336
|
path: f,
|
|
337
337
|
// If it is a draft, it needs to be deep cloned, and it may also be non-draft.
|
|
338
338
|
value: te(a[u])
|
|
@@ -341,42 +341,42 @@ function Qt(e, t, n, s, i) {
|
|
|
341
341
|
if (r.length < a.length) {
|
|
342
342
|
const { arrayLengthAssignment: u = !0 } = c.enablePatches;
|
|
343
343
|
if (u) {
|
|
344
|
-
const l = t.concat(["length"]), f =
|
|
344
|
+
const l = t.concat(["length"]), f = T(l, i);
|
|
345
345
|
s.push({
|
|
346
|
-
op:
|
|
346
|
+
op: y.Replace,
|
|
347
347
|
path: f,
|
|
348
348
|
value: r.length
|
|
349
349
|
});
|
|
350
350
|
} else
|
|
351
351
|
for (let l = a.length; r.length < l; l -= 1) {
|
|
352
|
-
const f = t.concat([l - 1]),
|
|
352
|
+
const f = t.concat([l - 1]), _ = T(f, i);
|
|
353
353
|
s.push({
|
|
354
|
-
op:
|
|
355
|
-
path:
|
|
354
|
+
op: y.Remove,
|
|
355
|
+
path: _
|
|
356
356
|
});
|
|
357
357
|
}
|
|
358
358
|
}
|
|
359
359
|
}
|
|
360
|
-
function
|
|
360
|
+
function Bt({ original: e, copy: t, assignedMap: n }, s, i, r, o) {
|
|
361
361
|
n.forEach((c, a) => {
|
|
362
|
-
const u = F(e, a), l = te(F(t, a)), f = c ?
|
|
363
|
-
if (A(u, l) && f ===
|
|
362
|
+
const u = F(e, a), l = te(F(t, a)), f = c ? J(e, a) ? y.Replace : y.Add : y.Remove;
|
|
363
|
+
if (A(u, l) && f === y.Replace)
|
|
364
364
|
return;
|
|
365
|
-
const
|
|
366
|
-
i.push(f ===
|
|
365
|
+
const _ = s.concat(a), p = T(_, o);
|
|
366
|
+
i.push(f === y.Remove ? { op: f, path: p } : { op: f, path: p, value: l }), r.push(f === y.Add ? { op: y.Remove, path: p } : f === y.Remove ? { op: y.Add, path: p, value: u } : { op: y.Replace, path: p, value: u });
|
|
367
367
|
});
|
|
368
368
|
}
|
|
369
|
-
function
|
|
369
|
+
function Ut({ original: e, copy: t }, n, s, i, r) {
|
|
370
370
|
let o = 0;
|
|
371
371
|
e.forEach((c) => {
|
|
372
372
|
if (!t.has(c)) {
|
|
373
|
-
const a = n.concat([o]), u =
|
|
373
|
+
const a = n.concat([o]), u = T(a, r);
|
|
374
374
|
s.push({
|
|
375
|
-
op:
|
|
375
|
+
op: y.Remove,
|
|
376
376
|
path: u,
|
|
377
377
|
value: c
|
|
378
378
|
}), i.unshift({
|
|
379
|
-
op:
|
|
379
|
+
op: y.Add,
|
|
380
380
|
path: u,
|
|
381
381
|
value: c
|
|
382
382
|
});
|
|
@@ -384,13 +384,13 @@ function Ht({ original: e, copy: t }, n, s, i, r) {
|
|
|
384
384
|
o += 1;
|
|
385
385
|
}), o = 0, t.forEach((c) => {
|
|
386
386
|
if (!e.has(c)) {
|
|
387
|
-
const a = n.concat([o]), u =
|
|
387
|
+
const a = n.concat([o]), u = T(a, r);
|
|
388
388
|
s.push({
|
|
389
|
-
op:
|
|
389
|
+
op: y.Add,
|
|
390
390
|
path: u,
|
|
391
391
|
value: c
|
|
392
392
|
}), i.unshift({
|
|
393
|
-
op:
|
|
393
|
+
op: y.Remove,
|
|
394
394
|
path: u,
|
|
395
395
|
value: c
|
|
396
396
|
});
|
|
@@ -398,59 +398,59 @@ function Ht({ original: e, copy: t }, n, s, i, r) {
|
|
|
398
398
|
o += 1;
|
|
399
399
|
});
|
|
400
400
|
}
|
|
401
|
-
function
|
|
401
|
+
function G(e, t, n, s) {
|
|
402
402
|
const { pathAsArray: i = !0 } = e.options.enablePatches;
|
|
403
403
|
switch (e.type) {
|
|
404
404
|
case 0:
|
|
405
405
|
case 2:
|
|
406
|
-
return
|
|
406
|
+
return Bt(e, t, n, s, i);
|
|
407
407
|
case 1:
|
|
408
|
-
return Qt(e, t, n, s, i);
|
|
409
|
-
case 3:
|
|
410
408
|
return Ht(e, t, n, s, i);
|
|
409
|
+
case 3:
|
|
410
|
+
return Ut(e, t, n, s, i);
|
|
411
411
|
}
|
|
412
412
|
}
|
|
413
413
|
const ce = (e, t, n = !1) => {
|
|
414
|
-
if (typeof e == "object" && e !== null && (!
|
|
414
|
+
if (typeof e == "object" && e !== null && (!E(e, t) || n))
|
|
415
415
|
throw new Error("Strict mode: Mutable data cannot be accessed directly, please use 'unsafe(callback)' wrap.");
|
|
416
|
-
},
|
|
416
|
+
}, ge = {
|
|
417
417
|
get size() {
|
|
418
|
-
return x(
|
|
418
|
+
return x(d(this)).size;
|
|
419
419
|
},
|
|
420
420
|
has(e) {
|
|
421
|
-
return x(
|
|
421
|
+
return x(d(this)).has(e);
|
|
422
422
|
},
|
|
423
423
|
set(e, t) {
|
|
424
|
-
const n =
|
|
425
|
-
return (!s.has(e) || !A(s.get(e), t)) && (w(n),
|
|
424
|
+
const n = d(this), s = x(n);
|
|
425
|
+
return (!s.has(e) || !A(s.get(e), t)) && (w(n), I(n), n.assignedMap.set(e, !0), n.copy.set(e, t), Ee(n, e, t, G)), this;
|
|
426
426
|
},
|
|
427
427
|
delete(e) {
|
|
428
428
|
if (!this.has(e))
|
|
429
429
|
return !1;
|
|
430
|
-
const t =
|
|
431
|
-
return w(t),
|
|
430
|
+
const t = d(this);
|
|
431
|
+
return w(t), I(t), t.original.has(e) ? t.assignedMap.set(e, !1) : t.assignedMap.delete(e), t.copy.delete(e), !0;
|
|
432
432
|
},
|
|
433
433
|
clear() {
|
|
434
|
-
const e =
|
|
434
|
+
const e = d(this);
|
|
435
435
|
if (this.size) {
|
|
436
|
-
w(e),
|
|
436
|
+
w(e), I(e), e.assignedMap = /* @__PURE__ */ new Map();
|
|
437
437
|
for (const [t] of e.original)
|
|
438
438
|
e.assignedMap.set(t, !1);
|
|
439
439
|
e.copy.clear();
|
|
440
440
|
}
|
|
441
441
|
},
|
|
442
442
|
forEach(e, t) {
|
|
443
|
-
const n =
|
|
443
|
+
const n = d(this);
|
|
444
444
|
x(n).forEach((s, i) => {
|
|
445
445
|
e.call(t, this.get(i), i, this);
|
|
446
446
|
});
|
|
447
447
|
},
|
|
448
448
|
get(e) {
|
|
449
449
|
var t, n;
|
|
450
|
-
const s =
|
|
451
|
-
if (s.options.strict && ce(i, s.options, r), r || s.finalized || !
|
|
450
|
+
const s = d(this), i = x(s).get(e), r = ((n = (t = s.options).mark) === null || n === void 0 ? void 0 : n.call(t, i, O)) === O.mutable;
|
|
451
|
+
if (s.options.strict && ce(i, s.options, r), r || s.finalized || !E(i, s.options) || i !== s.original.get(e))
|
|
452
452
|
return i;
|
|
453
|
-
const o =
|
|
453
|
+
const o = Me.createDraft({
|
|
454
454
|
original: i,
|
|
455
455
|
parentDraft: s,
|
|
456
456
|
key: e,
|
|
@@ -460,7 +460,7 @@ const ce = (e, t, n = !1) => {
|
|
|
460
460
|
return w(s), s.copy.set(e, o), o;
|
|
461
461
|
},
|
|
462
462
|
keys() {
|
|
463
|
-
return x(
|
|
463
|
+
return x(d(this)).keys();
|
|
464
464
|
},
|
|
465
465
|
values() {
|
|
466
466
|
const e = this.keys();
|
|
@@ -494,16 +494,16 @@ const ce = (e, t, n = !1) => {
|
|
|
494
494
|
[ee]() {
|
|
495
495
|
return this.entries();
|
|
496
496
|
}
|
|
497
|
-
},
|
|
497
|
+
}, Kt = Reflect.ownKeys(ge), je = (e, t, { isValuesIterator: n }) => () => {
|
|
498
498
|
var s, i;
|
|
499
499
|
const r = t.next();
|
|
500
500
|
if (r.done)
|
|
501
501
|
return r;
|
|
502
502
|
const o = r.value;
|
|
503
503
|
let c = e.setMap.get(o);
|
|
504
|
-
const a =
|
|
505
|
-
if (e.options.strict && ce(o, e.options, u), !u && !a &&
|
|
506
|
-
const l =
|
|
504
|
+
const a = d(c), u = ((i = (s = e.options).mark) === null || i === void 0 ? void 0 : i.call(s, c, O)) === O.mutable;
|
|
505
|
+
if (e.options.strict && ce(o, e.options, u), !u && !a && E(o, e.options) && !e.finalized && e.original.has(o)) {
|
|
506
|
+
const l = Me.createDraft({
|
|
507
507
|
original: o,
|
|
508
508
|
parentDraft: e,
|
|
509
509
|
key: o,
|
|
@@ -518,39 +518,39 @@ const ce = (e, t, n = !1) => {
|
|
|
518
518
|
};
|
|
519
519
|
}, ae = {
|
|
520
520
|
get size() {
|
|
521
|
-
return
|
|
521
|
+
return d(this).setMap.size;
|
|
522
522
|
},
|
|
523
523
|
has(e) {
|
|
524
|
-
const t =
|
|
524
|
+
const t = d(this);
|
|
525
525
|
if (t.setMap.has(e))
|
|
526
526
|
return !0;
|
|
527
527
|
w(t);
|
|
528
|
-
const n =
|
|
528
|
+
const n = d(e);
|
|
529
529
|
return !!(n && t.setMap.has(n.original));
|
|
530
530
|
},
|
|
531
531
|
add(e) {
|
|
532
|
-
const t =
|
|
533
|
-
return this.has(e) || (w(t),
|
|
532
|
+
const t = d(this);
|
|
533
|
+
return this.has(e) || (w(t), I(t), t.assignedMap.set(e, !0), t.setMap.set(e, e), Ee(t, e, e, G)), this;
|
|
534
534
|
},
|
|
535
535
|
delete(e) {
|
|
536
536
|
if (!this.has(e))
|
|
537
537
|
return !1;
|
|
538
|
-
const t =
|
|
539
|
-
w(t),
|
|
540
|
-
const n =
|
|
538
|
+
const t = d(this);
|
|
539
|
+
w(t), I(t);
|
|
540
|
+
const n = d(e);
|
|
541
541
|
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));
|
|
542
542
|
},
|
|
543
543
|
clear() {
|
|
544
544
|
if (!this.size)
|
|
545
545
|
return;
|
|
546
|
-
const e =
|
|
547
|
-
w(e),
|
|
546
|
+
const e = d(this);
|
|
547
|
+
w(e), I(e);
|
|
548
548
|
for (const t of e.original)
|
|
549
549
|
e.assignedMap.set(t, !1);
|
|
550
550
|
e.setMap.clear();
|
|
551
551
|
},
|
|
552
552
|
values() {
|
|
553
|
-
const e =
|
|
553
|
+
const e = d(this);
|
|
554
554
|
w(e);
|
|
555
555
|
const t = e.setMap.keys();
|
|
556
556
|
return {
|
|
@@ -559,7 +559,7 @@ const ce = (e, t, n = !1) => {
|
|
|
559
559
|
};
|
|
560
560
|
},
|
|
561
561
|
entries() {
|
|
562
|
-
const e =
|
|
562
|
+
const e = d(this);
|
|
563
563
|
w(e);
|
|
564
564
|
const t = e.setMap.keys();
|
|
565
565
|
return {
|
|
@@ -605,13 +605,13 @@ Set.prototype.difference && Object.assign(ae, {
|
|
|
605
605
|
return Set.prototype.isDisjointFrom.call(new Set(this.values()), e);
|
|
606
606
|
}
|
|
607
607
|
});
|
|
608
|
-
const
|
|
608
|
+
const Wt = Reflect.ownKeys(ae), ot = {
|
|
609
609
|
get(e, t, n) {
|
|
610
610
|
var s, i;
|
|
611
611
|
const r = (s = e.copy) === null || s === void 0 ? void 0 : s[t];
|
|
612
612
|
if (r && e.finalities.draftsCache.has(r))
|
|
613
613
|
return r;
|
|
614
|
-
if (t ===
|
|
614
|
+
if (t === nt)
|
|
615
615
|
return e;
|
|
616
616
|
let o;
|
|
617
617
|
if (e.options.mark) {
|
|
@@ -620,11 +620,11 @@ const Ut = Reflect.ownKeys(ae), it = {
|
|
|
620
620
|
return e.options.strict && ce(u, e.options, !0), u;
|
|
621
621
|
}
|
|
622
622
|
const c = x(e);
|
|
623
|
-
if (c instanceof Map &&
|
|
624
|
-
return t === "size" ? Object.getOwnPropertyDescriptor(
|
|
625
|
-
if (c instanceof Set &&
|
|
623
|
+
if (c instanceof Map && Kt.includes(t))
|
|
624
|
+
return t === "size" ? Object.getOwnPropertyDescriptor(ge, "size").get.call(e.proxy) : ge[t].bind(e.proxy);
|
|
625
|
+
if (c instanceof Set && Wt.includes(t))
|
|
626
626
|
return t === "size" ? Object.getOwnPropertyDescriptor(ae, "size").get.call(e.proxy) : ae[t].bind(e.proxy);
|
|
627
|
-
if (!
|
|
627
|
+
if (!J(c, t)) {
|
|
628
628
|
const u = Ae(c, t);
|
|
629
629
|
return u ? "value" in u ? u.value : (
|
|
630
630
|
// !case: support for getter
|
|
@@ -632,22 +632,22 @@ const Ut = Reflect.ownKeys(ae), it = {
|
|
|
632
632
|
) : void 0;
|
|
633
633
|
}
|
|
634
634
|
const a = c[t];
|
|
635
|
-
if (e.options.strict && ce(a, e.options), e.finalized || !
|
|
635
|
+
if (e.options.strict && ce(a, e.options), e.finalized || !E(a, e.options))
|
|
636
636
|
return a;
|
|
637
637
|
if (a === pe(e.original, t)) {
|
|
638
|
-
if (w(e), e.copy[t] =
|
|
638
|
+
if (w(e), e.copy[t] = Ie({
|
|
639
639
|
original: e.original[t],
|
|
640
640
|
parentDraft: e,
|
|
641
641
|
key: e.type === 1 ? Number(t) : t,
|
|
642
642
|
finalities: e.finalities,
|
|
643
643
|
options: e.options
|
|
644
644
|
}), typeof o == "function") {
|
|
645
|
-
const u =
|
|
646
|
-
return w(u),
|
|
645
|
+
const u = d(e.copy[t]);
|
|
646
|
+
return w(u), I(u), u.copy;
|
|
647
647
|
}
|
|
648
648
|
return e.copy[t];
|
|
649
649
|
}
|
|
650
|
-
return
|
|
650
|
+
return D(a) && e.finalities.draftsCache.add(a), a;
|
|
651
651
|
},
|
|
652
652
|
set(e, t, n) {
|
|
653
653
|
var s;
|
|
@@ -659,8 +659,8 @@ const Ut = Reflect.ownKeys(ae), it = {
|
|
|
659
659
|
const r = Ae(x(e), t);
|
|
660
660
|
if (r?.set)
|
|
661
661
|
return r.set.call(e.proxy, n), !0;
|
|
662
|
-
const o = pe(x(e), t), c =
|
|
663
|
-
return c && A(c.original, n) ? (e.copy[t] = n, e.assignedMap = (s = e.assignedMap) !== null && s !== void 0 ? s : /* @__PURE__ */ new Map(), e.assignedMap.set(t, !1), !0) : (A(n, o) && (n !== void 0 ||
|
|
662
|
+
const o = pe(x(e), t), c = d(o);
|
|
663
|
+
return c && A(c.original, n) ? (e.copy[t] = n, e.assignedMap = (s = e.assignedMap) !== null && s !== void 0 ? s : /* @__PURE__ */ new Map(), e.assignedMap.set(t, !1), !0) : (A(n, o) && (n !== void 0 || J(e.original, t)) || (w(e), I(e), J(e.original, t) && A(n, e.original[t]) ? e.assignedMap.delete(t) : e.assignedMap.set(t, !0), e.copy[t] = n, Ee(e, t, n, G)), !0);
|
|
664
664
|
},
|
|
665
665
|
has(e, t) {
|
|
666
666
|
return t in x(e);
|
|
@@ -688,10 +688,10 @@ const Ut = Reflect.ownKeys(ae), it = {
|
|
|
688
688
|
},
|
|
689
689
|
deleteProperty(e, t) {
|
|
690
690
|
var n;
|
|
691
|
-
return e.type === 1 ?
|
|
691
|
+
return e.type === 1 ? ot.set.call(this, e, t, void 0, e.proxy) : (pe(e.original, t) !== void 0 || t in e.original ? (w(e), I(e), e.assignedMap.set(t, !1)) : (e.assignedMap = (n = e.assignedMap) !== null && n !== void 0 ? n : /* @__PURE__ */ new Map(), e.assignedMap.delete(t)), e.copy && delete e.copy[t], !0);
|
|
692
692
|
}
|
|
693
693
|
};
|
|
694
|
-
function
|
|
694
|
+
function Ie(e) {
|
|
695
695
|
const { original: t, parentDraft: n, key: s, finalities: i, options: r } = e, o = $(t), c = {
|
|
696
696
|
type: o,
|
|
697
697
|
finalized: !1,
|
|
@@ -705,45 +705,45 @@ function Ne(e) {
|
|
|
705
705
|
setMap: o === 3 ? new Map(t.entries()) : void 0
|
|
706
706
|
};
|
|
707
707
|
(s || "key" in e) && (c.key = s);
|
|
708
|
-
const { proxy: a, revoke: u } = Proxy.revocable(o === 1 ? Object.assign([], c) : c,
|
|
708
|
+
const { proxy: a, revoke: u } = Proxy.revocable(o === 1 ? Object.assign([], c) : c, ot);
|
|
709
709
|
if (i.revoke.push(u), c.proxy = a, n) {
|
|
710
710
|
const l = n;
|
|
711
|
-
l.finalities.draft.push((f,
|
|
712
|
-
var p,
|
|
713
|
-
const
|
|
711
|
+
l.finalities.draft.push((f, _) => {
|
|
712
|
+
var p, N;
|
|
713
|
+
const Q = d(a);
|
|
714
714
|
let C = l.type === 3 ? l.setMap : l.copy;
|
|
715
|
-
const
|
|
716
|
-
if (
|
|
717
|
-
let
|
|
718
|
-
|
|
715
|
+
const b = F(C, s), m = d(b);
|
|
716
|
+
if (m) {
|
|
717
|
+
let P = m.original;
|
|
718
|
+
m.operated && (P = Pe(b)), me(m), Se(m, G, f, _), l.options.enableAutoFreeze && (l.options.updatedValues = (p = l.options.updatedValues) !== null && p !== void 0 ? p : /* @__PURE__ */ new WeakMap(), l.options.updatedValues.set(P, m.original)), X(C, s, P);
|
|
719
719
|
}
|
|
720
|
-
(
|
|
721
|
-
|
|
720
|
+
(N = Q.callbacks) === null || N === void 0 || N.forEach((P) => {
|
|
721
|
+
P(f, _);
|
|
722
722
|
});
|
|
723
723
|
});
|
|
724
724
|
} else {
|
|
725
|
-
const l =
|
|
726
|
-
l.finalities.draft.push((f,
|
|
727
|
-
|
|
725
|
+
const l = d(a);
|
|
726
|
+
l.finalities.draft.push((f, _) => {
|
|
727
|
+
me(l), Se(l, G, f, _);
|
|
728
728
|
});
|
|
729
729
|
}
|
|
730
730
|
return a;
|
|
731
731
|
}
|
|
732
|
-
|
|
733
|
-
function
|
|
732
|
+
Me.createDraft = Ie;
|
|
733
|
+
function Vt(e, t, n, s, i) {
|
|
734
734
|
var r;
|
|
735
|
-
const o =
|
|
735
|
+
const o = d(e), c = (r = o?.original) !== null && r !== void 0 ? r : e, a = !!t.length;
|
|
736
736
|
if (o?.operated)
|
|
737
737
|
for (; o.finalities.draft.length > 0; )
|
|
738
738
|
o.finalities.draft.pop()(n, s);
|
|
739
739
|
const u = a ? t[0] : o ? o.operated ? o.copy : o.original : e;
|
|
740
|
-
return o &&
|
|
740
|
+
return o && be(o), i && B(u, u, o?.options.updatedValues), [
|
|
741
741
|
u,
|
|
742
|
-
n && a ? [{ op:
|
|
743
|
-
s && a ? [{ op:
|
|
742
|
+
n && a ? [{ op: y.Replace, path: [], value: t[0] }] : n,
|
|
743
|
+
s && a ? [{ op: y.Replace, path: [], value: c }] : s
|
|
744
744
|
];
|
|
745
745
|
}
|
|
746
|
-
function
|
|
746
|
+
function Lt(e, t) {
|
|
747
747
|
var n;
|
|
748
748
|
const s = {
|
|
749
749
|
draft: [],
|
|
@@ -753,7 +753,7 @@ function Wt(e, t) {
|
|
|
753
753
|
};
|
|
754
754
|
let i, r;
|
|
755
755
|
t.enablePatches && (i = [], r = []);
|
|
756
|
-
const c = ((n = t.mark) === null || n === void 0 ? void 0 : n.call(t, e, O)) === O.mutable || !
|
|
756
|
+
const c = ((n = t.mark) === null || n === void 0 ? void 0 : n.call(t, e, O)) === O.mutable || !E(e, t) ? e : Ie({
|
|
757
757
|
original: e,
|
|
758
758
|
parentDraft: null,
|
|
759
759
|
finalities: s,
|
|
@@ -762,15 +762,15 @@ function Wt(e, t) {
|
|
|
762
762
|
return [
|
|
763
763
|
c,
|
|
764
764
|
(a = []) => {
|
|
765
|
-
const [u, l, f] =
|
|
765
|
+
const [u, l, f] = Vt(c, a, i, r, t.enableAutoFreeze);
|
|
766
766
|
return t.enablePatches ? [u, l, f] : u;
|
|
767
767
|
}
|
|
768
768
|
];
|
|
769
769
|
}
|
|
770
|
-
function
|
|
770
|
+
function we(e) {
|
|
771
771
|
const { rootDraft: t, value: n, useRawReturn: s = !1, isRoot: i = !0 } = e;
|
|
772
|
-
|
|
773
|
-
const a =
|
|
772
|
+
Re(n, (r, o, c) => {
|
|
773
|
+
const a = d(o);
|
|
774
774
|
if (a && t && a.finalities === t.finalities) {
|
|
775
775
|
e.isContainDraft = !0;
|
|
776
776
|
const u = a.original;
|
|
@@ -778,21 +778,21 @@ function ve(e) {
|
|
|
778
778
|
const l = Array.from(c);
|
|
779
779
|
c.clear(), l.forEach((f) => c.add(r === f ? u : f));
|
|
780
780
|
} else
|
|
781
|
-
|
|
782
|
-
} else typeof o == "object" && o !== null && (e.value = o, e.isRoot = !1,
|
|
781
|
+
X(c, r, u);
|
|
782
|
+
} else typeof o == "object" && o !== null && (e.value = o, e.isRoot = !1, we(e));
|
|
783
783
|
}), i && (e.isContainDraft || console.warn("The return value does not contain any draft, please use 'rawReturn()' to wrap the return value to improve performance."), s && console.warn("The return value contains drafts, please don't use 'rawReturn()' to wrap the return value."));
|
|
784
784
|
}
|
|
785
|
-
function
|
|
785
|
+
function ct(e) {
|
|
786
786
|
var t;
|
|
787
|
-
const n =
|
|
788
|
-
if (!
|
|
787
|
+
const n = d(e);
|
|
788
|
+
if (!E(e, n?.options))
|
|
789
789
|
return e;
|
|
790
790
|
const s = $(e);
|
|
791
791
|
if (n && !n.operated)
|
|
792
792
|
return n.original;
|
|
793
793
|
let i;
|
|
794
794
|
function r() {
|
|
795
|
-
i = s === 2 ?
|
|
795
|
+
i = s === 2 ? Oe(e) ? new Map(e) : new (Object.getPrototypeOf(e)).constructor(e) : s === 3 ? Array.from(n.setMap.values()) : it(e, n?.options);
|
|
796
796
|
}
|
|
797
797
|
if (n) {
|
|
798
798
|
n.finalized = !0;
|
|
@@ -803,134 +803,134 @@ function rt(e) {
|
|
|
803
803
|
}
|
|
804
804
|
} else
|
|
805
805
|
i = e;
|
|
806
|
-
if (
|
|
806
|
+
if (Re(i, (o, c) => {
|
|
807
807
|
if (n && A(F(n.original, o), c))
|
|
808
808
|
return;
|
|
809
|
-
const a =
|
|
810
|
-
a !== c && (i === e && r(),
|
|
809
|
+
const a = ct(c);
|
|
810
|
+
a !== c && (i === e && r(), X(i, o, a));
|
|
811
811
|
}), s === 3) {
|
|
812
812
|
const o = (t = n?.original) !== null && t !== void 0 ? t : i;
|
|
813
|
-
return
|
|
813
|
+
return xe(o) ? new Set(i) : new (Object.getPrototypeOf(o)).constructor(i);
|
|
814
814
|
}
|
|
815
815
|
return i;
|
|
816
816
|
}
|
|
817
817
|
function De(e) {
|
|
818
|
-
if (!
|
|
818
|
+
if (!D(e))
|
|
819
819
|
throw new Error(`current() is only used for Draft, parameter: ${e}`);
|
|
820
|
-
return
|
|
820
|
+
return ct(e);
|
|
821
821
|
}
|
|
822
|
-
const
|
|
822
|
+
const Jt = (e) => function t(n, s, i) {
|
|
823
823
|
var r, o, c;
|
|
824
824
|
if (typeof n == "function" && typeof s != "function")
|
|
825
|
-
return function(
|
|
826
|
-
return t(
|
|
825
|
+
return function(h, ...g) {
|
|
826
|
+
return t(h, (j) => n.call(this, j, ...g), s);
|
|
827
827
|
};
|
|
828
828
|
const a = n, u = s;
|
|
829
829
|
let l = i;
|
|
830
830
|
if (typeof s != "function" && (l = s), l !== void 0 && Object.prototype.toString.call(l) !== "[object Object]")
|
|
831
831
|
throw new Error(`Invalid options: ${l}, 'options' should be an object.`);
|
|
832
832
|
l = Object.assign(Object.assign({}, e), l);
|
|
833
|
-
const f =
|
|
834
|
-
for (const
|
|
835
|
-
if (typeof
|
|
836
|
-
throw new Error(`Invalid mark: ${
|
|
837
|
-
const
|
|
838
|
-
if (
|
|
839
|
-
return
|
|
833
|
+
const f = D(a) ? De(a) : a, _ = Array.isArray(l.mark) ? ((h, g) => {
|
|
834
|
+
for (const j of l.mark) {
|
|
835
|
+
if (typeof j != "function")
|
|
836
|
+
throw new Error(`Invalid mark: ${j}, 'mark' should be a function.`);
|
|
837
|
+
const V = j(h, g);
|
|
838
|
+
if (V)
|
|
839
|
+
return V;
|
|
840
840
|
}
|
|
841
|
-
}) : l.mark, p = (r = l.enablePatches) !== null && r !== void 0 ? r : !1,
|
|
841
|
+
}) : l.mark, p = (r = l.enablePatches) !== null && r !== void 0 ? r : !1, N = (o = l.strict) !== null && o !== void 0 ? o : !1, C = {
|
|
842
842
|
enableAutoFreeze: (c = l.enableAutoFreeze) !== null && c !== void 0 ? c : !1,
|
|
843
|
-
mark:
|
|
844
|
-
strict:
|
|
843
|
+
mark: _,
|
|
844
|
+
strict: N,
|
|
845
845
|
enablePatches: p
|
|
846
846
|
};
|
|
847
|
-
if (!
|
|
847
|
+
if (!E(f, C) && typeof f == "object" && f !== null)
|
|
848
848
|
throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");
|
|
849
|
-
const [
|
|
849
|
+
const [b, m] = Lt(f, C);
|
|
850
850
|
if (typeof s != "function") {
|
|
851
|
-
if (!
|
|
851
|
+
if (!E(f, C))
|
|
852
852
|
throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");
|
|
853
|
-
return [
|
|
853
|
+
return [b, m];
|
|
854
854
|
}
|
|
855
|
-
let
|
|
855
|
+
let P;
|
|
856
856
|
try {
|
|
857
|
-
|
|
858
|
-
} catch (
|
|
859
|
-
throw
|
|
860
|
-
}
|
|
861
|
-
const
|
|
862
|
-
const
|
|
863
|
-
if (!
|
|
864
|
-
if (
|
|
857
|
+
P = u(b);
|
|
858
|
+
} catch (h) {
|
|
859
|
+
throw be(d(b)), h;
|
|
860
|
+
}
|
|
861
|
+
const Z = (h) => {
|
|
862
|
+
const g = d(b);
|
|
863
|
+
if (!D(h)) {
|
|
864
|
+
if (h !== void 0 && !A(h, b) && g?.operated)
|
|
865
865
|
throw new Error("Either the value is returned as a new non-draft value, or only the draft is modified without returning any value.");
|
|
866
|
-
const
|
|
867
|
-
if (
|
|
868
|
-
const
|
|
869
|
-
return C.strict && typeof
|
|
870
|
-
rootDraft:
|
|
871
|
-
value:
|
|
866
|
+
const V = h?.[Dt];
|
|
867
|
+
if (V) {
|
|
868
|
+
const St = V[0];
|
|
869
|
+
return C.strict && typeof h == "object" && h !== null && we({
|
|
870
|
+
rootDraft: g,
|
|
871
|
+
value: h,
|
|
872
872
|
useRawReturn: !0
|
|
873
|
-
}),
|
|
873
|
+
}), m([St]);
|
|
874
874
|
}
|
|
875
|
-
if (
|
|
876
|
-
return typeof
|
|
875
|
+
if (h !== void 0)
|
|
876
|
+
return typeof h == "object" && h !== null && we({ rootDraft: g, value: h }), m([h]);
|
|
877
877
|
}
|
|
878
|
-
if (
|
|
879
|
-
return
|
|
880
|
-
const
|
|
881
|
-
if (C ===
|
|
882
|
-
if (
|
|
878
|
+
if (h === b || h === void 0)
|
|
879
|
+
return m([]);
|
|
880
|
+
const j = d(h);
|
|
881
|
+
if (C === j.options) {
|
|
882
|
+
if (j.operated)
|
|
883
883
|
throw new Error("Cannot return a modified child draft.");
|
|
884
|
-
return
|
|
884
|
+
return m([De(h)]);
|
|
885
885
|
}
|
|
886
|
-
return
|
|
886
|
+
return m([h]);
|
|
887
887
|
};
|
|
888
|
-
return
|
|
889
|
-
throw
|
|
890
|
-
}) :
|
|
891
|
-
},
|
|
888
|
+
return P instanceof Promise ? P.then(Z, (h) => {
|
|
889
|
+
throw be(d(b)), h;
|
|
890
|
+
}) : Z(P);
|
|
891
|
+
}, R = Jt();
|
|
892
892
|
Object.prototype.constructor.toString();
|
|
893
|
-
var
|
|
894
|
-
function
|
|
895
|
-
for (var t = e.length; t-- &&
|
|
893
|
+
var Yt = /\s/;
|
|
894
|
+
function Gt(e) {
|
|
895
|
+
for (var t = e.length; t-- && Yt.test(e.charAt(t)); )
|
|
896
896
|
;
|
|
897
897
|
return t;
|
|
898
898
|
}
|
|
899
|
-
var
|
|
900
|
-
function
|
|
901
|
-
return e && e.slice(0,
|
|
899
|
+
var Xt = /^\s+/;
|
|
900
|
+
function Zt(e) {
|
|
901
|
+
return e && e.slice(0, Gt(e) + 1).replace(Xt, "");
|
|
902
902
|
}
|
|
903
|
-
var Te = NaN,
|
|
903
|
+
var Te = NaN, kt = /^[-+]0x[0-9a-f]+$/i, en = /^0b[01]+$/i, tn = /^0o[0-7]+$/i, nn = parseInt;
|
|
904
904
|
function ne(e) {
|
|
905
905
|
if (typeof e == "number")
|
|
906
906
|
return e;
|
|
907
907
|
if (oe(e))
|
|
908
908
|
return Te;
|
|
909
|
-
if (
|
|
909
|
+
if (Y(e)) {
|
|
910
910
|
var t = typeof e.valueOf == "function" ? e.valueOf() : e;
|
|
911
|
-
e =
|
|
911
|
+
e = Y(t) ? t + "" : t;
|
|
912
912
|
}
|
|
913
913
|
if (typeof e != "string")
|
|
914
914
|
return e === 0 ? e : +e;
|
|
915
|
-
e =
|
|
916
|
-
var n =
|
|
917
|
-
return n ||
|
|
915
|
+
e = Zt(e);
|
|
916
|
+
var n = en.test(e);
|
|
917
|
+
return n || tn.test(e) ? nn(e.slice(2), n ? 2 : 8) : kt.test(e) ? Te : +e;
|
|
918
918
|
}
|
|
919
|
-
var qe = 1 / 0,
|
|
920
|
-
function
|
|
919
|
+
var qe = 1 / 0, sn = 17976931348623157e292;
|
|
920
|
+
function rn(e) {
|
|
921
921
|
if (!e)
|
|
922
922
|
return e === 0 ? e : 0;
|
|
923
923
|
if (e = ne(e), e === qe || e === -qe) {
|
|
924
924
|
var t = e < 0 ? -1 : 1;
|
|
925
|
-
return t *
|
|
925
|
+
return t * sn;
|
|
926
926
|
}
|
|
927
927
|
return e === e ? e : 0;
|
|
928
928
|
}
|
|
929
|
-
function
|
|
930
|
-
var t =
|
|
929
|
+
function at(e) {
|
|
930
|
+
var t = rn(e), n = t % 1;
|
|
931
931
|
return t === t ? n ? t - n : t : 0;
|
|
932
932
|
}
|
|
933
|
-
function
|
|
933
|
+
function on(e, t, n) {
|
|
934
934
|
switch (n.length) {
|
|
935
935
|
case 0:
|
|
936
936
|
return e.call(t);
|
|
@@ -943,50 +943,50 @@ function sn(e, t, n) {
|
|
|
943
943
|
}
|
|
944
944
|
return e.apply(t, n);
|
|
945
945
|
}
|
|
946
|
-
var
|
|
947
|
-
function
|
|
946
|
+
var cn = 800, an = 16, un = Date.now;
|
|
947
|
+
function ln(e) {
|
|
948
948
|
var t = 0, n = 0;
|
|
949
949
|
return function() {
|
|
950
|
-
var s =
|
|
950
|
+
var s = un(), i = an - (s - n);
|
|
951
951
|
if (n = s, i > 0) {
|
|
952
|
-
if (++t >=
|
|
952
|
+
if (++t >= cn)
|
|
953
953
|
return arguments[0];
|
|
954
954
|
} else
|
|
955
955
|
t = 0;
|
|
956
956
|
return e.apply(void 0, arguments);
|
|
957
957
|
};
|
|
958
958
|
}
|
|
959
|
-
function
|
|
959
|
+
function fn(e) {
|
|
960
960
|
return function() {
|
|
961
961
|
return e;
|
|
962
962
|
};
|
|
963
963
|
}
|
|
964
964
|
var ue = (function() {
|
|
965
965
|
try {
|
|
966
|
-
var e =
|
|
966
|
+
var e = gt(Object, "defineProperty");
|
|
967
967
|
return e({}, "", {}), e;
|
|
968
968
|
} catch {
|
|
969
969
|
}
|
|
970
|
-
})(),
|
|
970
|
+
})(), hn = ue ? function(e, t) {
|
|
971
971
|
return ue(e, "toString", {
|
|
972
972
|
configurable: !0,
|
|
973
973
|
enumerable: !1,
|
|
974
|
-
value:
|
|
974
|
+
value: fn(t),
|
|
975
975
|
writable: !0
|
|
976
976
|
});
|
|
977
|
-
} : fe,
|
|
978
|
-
function
|
|
977
|
+
} : fe, dn = ln(hn);
|
|
978
|
+
function pn(e, t) {
|
|
979
979
|
for (var n = -1, s = e == null ? 0 : e.length; ++n < s && t(e[n], n, e) !== !1; )
|
|
980
980
|
;
|
|
981
981
|
return e;
|
|
982
982
|
}
|
|
983
|
-
function
|
|
983
|
+
function _n(e, t, n, s) {
|
|
984
984
|
for (var i = e.length, r = n + -1; ++r < i; )
|
|
985
985
|
if (t(e[r], r, e))
|
|
986
986
|
return r;
|
|
987
987
|
return -1;
|
|
988
988
|
}
|
|
989
|
-
function
|
|
989
|
+
function yn(e, t, n) {
|
|
990
990
|
t == "__proto__" && ue ? ue(e, t, {
|
|
991
991
|
configurable: !0,
|
|
992
992
|
enumerable: !0,
|
|
@@ -994,83 +994,83 @@ function pn(e, t, n) {
|
|
|
994
994
|
writable: !0
|
|
995
995
|
}) : e[t] = n;
|
|
996
996
|
}
|
|
997
|
-
var
|
|
998
|
-
function
|
|
997
|
+
var bn = Object.prototype, mn = bn.hasOwnProperty;
|
|
998
|
+
function Sn(e, t, n) {
|
|
999
999
|
var s = e[t];
|
|
1000
|
-
(!(
|
|
1000
|
+
(!(mn.call(e, t) && Ge(s, n)) || n === void 0 && !(t in e)) && yn(e, t, n);
|
|
1001
1001
|
}
|
|
1002
|
-
var
|
|
1003
|
-
function
|
|
1004
|
-
return t =
|
|
1005
|
-
for (var s = arguments, i = -1, r =
|
|
1002
|
+
var $e = Math.max;
|
|
1003
|
+
function gn(e, t, n) {
|
|
1004
|
+
return t = $e(t === void 0 ? e.length - 1 : t, 0), function() {
|
|
1005
|
+
for (var s = arguments, i = -1, r = $e(s.length - t, 0), o = Array(r); ++i < r; )
|
|
1006
1006
|
o[i] = s[t + i];
|
|
1007
1007
|
i = -1;
|
|
1008
1008
|
for (var c = Array(t + 1); ++i < t; )
|
|
1009
1009
|
c[i] = s[i];
|
|
1010
|
-
return c[t] = n(o),
|
|
1010
|
+
return c[t] = n(o), on(e, this, c);
|
|
1011
1011
|
};
|
|
1012
1012
|
}
|
|
1013
|
-
function
|
|
1014
|
-
return
|
|
1013
|
+
function wn(e, t) {
|
|
1014
|
+
return dn(gn(e, t, fe), e + "");
|
|
1015
1015
|
}
|
|
1016
|
-
function
|
|
1017
|
-
if (!
|
|
1016
|
+
function Qe(e, t, n) {
|
|
1017
|
+
if (!Y(n))
|
|
1018
1018
|
return !1;
|
|
1019
1019
|
var s = typeof t;
|
|
1020
|
-
return (s == "number" ? he(n) &&
|
|
1020
|
+
return (s == "number" ? he(n) && Xe(t, n.length) : s == "string" && t in n) ? Ge(n[t], e) : !1;
|
|
1021
1021
|
}
|
|
1022
|
-
var He =
|
|
1023
|
-
function
|
|
1024
|
-
return
|
|
1022
|
+
var He = Ne ? Ne.isConcatSpreadable : void 0;
|
|
1023
|
+
function vn(e) {
|
|
1024
|
+
return K(e) || Ze(e) || !!(He && e && e[He]);
|
|
1025
1025
|
}
|
|
1026
|
-
function
|
|
1026
|
+
function Cn(e, t, n, s, i) {
|
|
1027
1027
|
var r = -1, o = e.length;
|
|
1028
|
-
for (n || (n =
|
|
1028
|
+
for (n || (n = vn), i || (i = []); ++r < o; ) {
|
|
1029
1029
|
var c = e[r];
|
|
1030
|
-
n(c) ?
|
|
1030
|
+
n(c) ? wt(i, c) : i[i.length] = c;
|
|
1031
1031
|
}
|
|
1032
1032
|
return i;
|
|
1033
1033
|
}
|
|
1034
|
-
function
|
|
1034
|
+
function Mn(e, t, n) {
|
|
1035
1035
|
var s = -1, i = e.length;
|
|
1036
1036
|
t < 0 && (t = -t > i ? 0 : i + t), n = n > i ? i : n, n < 0 && (n += i), i = t > n ? 0 : n - t >>> 0, t >>>= 0;
|
|
1037
1037
|
for (var r = Array(i); ++s < i; )
|
|
1038
1038
|
r[s] = e[s + t];
|
|
1039
1039
|
return r;
|
|
1040
1040
|
}
|
|
1041
|
-
var
|
|
1042
|
-
function
|
|
1043
|
-
return
|
|
1041
|
+
var xn = "\\ud800-\\udfff", On = "\\u0300-\\u036f", Pn = "\\ufe20-\\ufe2f", Rn = "\\u20d0-\\u20ff", En = On + Pn + Rn, In = "\\ufe0e\\ufe0f", Nn = "\\u200d", zn = RegExp("[" + Nn + xn + En + In + "]");
|
|
1042
|
+
function An(e) {
|
|
1043
|
+
return zn.test(e);
|
|
1044
1044
|
}
|
|
1045
|
-
function
|
|
1045
|
+
function Fn(e, t, n) {
|
|
1046
1046
|
return e === e && (n !== void 0 && (e = e <= n ? e : n), t !== void 0 && (e = e >= t ? e : t)), e;
|
|
1047
1047
|
}
|
|
1048
|
-
function
|
|
1049
|
-
return n === void 0 && (n = t, t = void 0), n !== void 0 && (n = ne(n), n = n === n ? n : 0), t !== void 0 && (t = ne(t), t = t === t ? t : 0),
|
|
1048
|
+
function jn(e, t, n) {
|
|
1049
|
+
return n === void 0 && (n = t, t = void 0), n !== void 0 && (n = ne(n), n = n === n ? n : 0), t !== void 0 && (t = ne(t), t = t === t ? t : 0), Fn(ne(e), t, n);
|
|
1050
1050
|
}
|
|
1051
|
-
function
|
|
1051
|
+
function Dn(e) {
|
|
1052
1052
|
return typeof e == "function" ? e : fe;
|
|
1053
1053
|
}
|
|
1054
1054
|
function k(e, t) {
|
|
1055
|
-
var n =
|
|
1056
|
-
return n(e,
|
|
1055
|
+
var n = K(e) ? pn : ke;
|
|
1056
|
+
return n(e, Dn(t));
|
|
1057
1057
|
}
|
|
1058
|
-
function
|
|
1058
|
+
function Tn(e, t) {
|
|
1059
1059
|
var n = [];
|
|
1060
|
-
return
|
|
1060
|
+
return ke(e, function(s, i, r) {
|
|
1061
1061
|
t(s, i, r) && n.push(s);
|
|
1062
1062
|
}), n;
|
|
1063
1063
|
}
|
|
1064
1064
|
function se(e, t) {
|
|
1065
|
-
var n =
|
|
1066
|
-
return n(e,
|
|
1065
|
+
var n = K(e) ? vt : Tn;
|
|
1066
|
+
return n(e, W(t));
|
|
1067
1067
|
}
|
|
1068
|
-
function
|
|
1068
|
+
function qn(e) {
|
|
1069
1069
|
return function(t, n, s) {
|
|
1070
1070
|
var i = Object(t);
|
|
1071
1071
|
if (!he(t)) {
|
|
1072
|
-
var r =
|
|
1073
|
-
t =
|
|
1072
|
+
var r = W(n);
|
|
1073
|
+
t = Ct(t), n = function(c) {
|
|
1074
1074
|
return r(i[c], c, i);
|
|
1075
1075
|
};
|
|
1076
1076
|
}
|
|
@@ -1078,52 +1078,52 @@ function Dn(e) {
|
|
|
1078
1078
|
return o > -1 ? i[r ? t[o] : o] : void 0;
|
|
1079
1079
|
};
|
|
1080
1080
|
}
|
|
1081
|
-
var
|
|
1081
|
+
var $n = Math.max;
|
|
1082
1082
|
function ie(e, t, n) {
|
|
1083
1083
|
var s = e == null ? 0 : e.length;
|
|
1084
1084
|
if (!s)
|
|
1085
1085
|
return -1;
|
|
1086
|
-
var i = n == null ? 0 :
|
|
1087
|
-
return i < 0 && (i =
|
|
1086
|
+
var i = n == null ? 0 : at(n);
|
|
1087
|
+
return i < 0 && (i = $n(s + i, 0)), _n(e, W(t), i);
|
|
1088
1088
|
}
|
|
1089
|
-
var Be =
|
|
1090
|
-
function
|
|
1089
|
+
var Be = qn(ie);
|
|
1090
|
+
function Qn(e) {
|
|
1091
1091
|
return e && e.length ? e[0] : void 0;
|
|
1092
1092
|
}
|
|
1093
|
-
function
|
|
1093
|
+
function Hn(e, t) {
|
|
1094
1094
|
return e > t;
|
|
1095
1095
|
}
|
|
1096
|
-
var
|
|
1097
|
-
function
|
|
1098
|
-
return typeof e == "string" || !
|
|
1096
|
+
var Bn = "[object String]";
|
|
1097
|
+
function ut(e) {
|
|
1098
|
+
return typeof e == "string" || !K(e) && Mt(e) && xt(e) == Bn;
|
|
1099
1099
|
}
|
|
1100
|
-
var
|
|
1101
|
-
function
|
|
1100
|
+
var Un = "[object Map]", Kn = "[object Set]", Wn = Object.prototype, Vn = Wn.hasOwnProperty;
|
|
1101
|
+
function Ln(e) {
|
|
1102
1102
|
if (e == null)
|
|
1103
1103
|
return !0;
|
|
1104
|
-
if (he(e) && (
|
|
1104
|
+
if (he(e) && (K(e) || typeof e == "string" || typeof e.splice == "function" || Ot(e) || Pt(e) || Ze(e)))
|
|
1105
1105
|
return !e.length;
|
|
1106
|
-
var t =
|
|
1107
|
-
if (t ==
|
|
1106
|
+
var t = et(e);
|
|
1107
|
+
if (t == Un || t == Kn)
|
|
1108
1108
|
return !e.size;
|
|
1109
|
-
if (
|
|
1110
|
-
return !
|
|
1109
|
+
if (Rt(e))
|
|
1110
|
+
return !tt(e).length;
|
|
1111
1111
|
for (var n in e)
|
|
1112
|
-
if (
|
|
1112
|
+
if (Vn.call(e, n))
|
|
1113
1113
|
return !1;
|
|
1114
1114
|
return !0;
|
|
1115
1115
|
}
|
|
1116
|
-
function
|
|
1117
|
-
return
|
|
1116
|
+
function lt(e, t) {
|
|
1117
|
+
return Et(e, t);
|
|
1118
1118
|
}
|
|
1119
|
-
var
|
|
1119
|
+
var Jn = Array.prototype, Yn = Jn.join;
|
|
1120
1120
|
function _e(e, t) {
|
|
1121
|
-
return e == null ? "" :
|
|
1121
|
+
return e == null ? "" : Yn.call(e, t);
|
|
1122
1122
|
}
|
|
1123
|
-
function
|
|
1123
|
+
function Gn(e, t) {
|
|
1124
1124
|
return e < t;
|
|
1125
1125
|
}
|
|
1126
|
-
function
|
|
1126
|
+
function ft(e, t, n) {
|
|
1127
1127
|
for (var s = -1, i = e.length; ++s < i; ) {
|
|
1128
1128
|
var r = e[s], o = t(r);
|
|
1129
1129
|
if (o != null && (c === void 0 ? o === o && !oe(o) : n(o, c)))
|
|
@@ -1132,34 +1132,34 @@ function ut(e, t, n) {
|
|
|
1132
1132
|
return a;
|
|
1133
1133
|
}
|
|
1134
1134
|
function Ue(e, t) {
|
|
1135
|
-
return e && e.length ?
|
|
1135
|
+
return e && e.length ? ft(e, W(t), Hn) : void 0;
|
|
1136
1136
|
}
|
|
1137
|
-
function
|
|
1138
|
-
return e && e.length ?
|
|
1137
|
+
function Xn(e, t) {
|
|
1138
|
+
return e && e.length ? ft(e, W(t), Gn) : void 0;
|
|
1139
1139
|
}
|
|
1140
|
-
function
|
|
1141
|
-
if (!
|
|
1140
|
+
function Zn(e, t, n, s) {
|
|
1141
|
+
if (!Y(e))
|
|
1142
1142
|
return e;
|
|
1143
|
-
t =
|
|
1143
|
+
t = It(t, e);
|
|
1144
1144
|
for (var i = -1, r = t.length, o = r - 1, c = e; c != null && ++i < r; ) {
|
|
1145
|
-
var a =
|
|
1145
|
+
var a = Nt(t[i]), u = n;
|
|
1146
1146
|
if (a === "__proto__" || a === "constructor" || a === "prototype")
|
|
1147
1147
|
return e;
|
|
1148
1148
|
if (i != o) {
|
|
1149
1149
|
var l = c[a];
|
|
1150
|
-
u = void 0, u === void 0 && (u =
|
|
1150
|
+
u = void 0, u === void 0 && (u = Y(l) ? l : Xe(t[i + 1]) ? [] : {});
|
|
1151
1151
|
}
|
|
1152
|
-
|
|
1152
|
+
Sn(c, a, u), c = c[a];
|
|
1153
1153
|
}
|
|
1154
1154
|
return e;
|
|
1155
1155
|
}
|
|
1156
|
-
function
|
|
1156
|
+
function kn(e, t) {
|
|
1157
1157
|
var n = e.length;
|
|
1158
1158
|
for (e.sort(t); n--; )
|
|
1159
1159
|
e[n] = e[n].value;
|
|
1160
1160
|
return e;
|
|
1161
1161
|
}
|
|
1162
|
-
function
|
|
1162
|
+
function es(e, t) {
|
|
1163
1163
|
if (e !== t) {
|
|
1164
1164
|
var n = e !== void 0, s = e === null, i = e === e, r = oe(e), o = t !== void 0, c = t === null, a = t === t, u = oe(t);
|
|
1165
1165
|
if (!c && !u && !r && e > t || r && o && a && !c && !u || s && o && a || !n && a || !i)
|
|
@@ -1169,9 +1169,9 @@ function Zn(e, t) {
|
|
|
1169
1169
|
}
|
|
1170
1170
|
return 0;
|
|
1171
1171
|
}
|
|
1172
|
-
function
|
|
1172
|
+
function ts(e, t, n) {
|
|
1173
1173
|
for (var s = -1, i = e.criteria, r = t.criteria, o = i.length, c = n.length; ++s < o; ) {
|
|
1174
|
-
var a =
|
|
1174
|
+
var a = es(i[s], r[s]);
|
|
1175
1175
|
if (a) {
|
|
1176
1176
|
if (s >= c)
|
|
1177
1177
|
return a;
|
|
@@ -1181,56 +1181,56 @@ function kn(e, t, n) {
|
|
|
1181
1181
|
}
|
|
1182
1182
|
return e.index - t.index;
|
|
1183
1183
|
}
|
|
1184
|
-
function
|
|
1184
|
+
function ns(e, t, n) {
|
|
1185
1185
|
t.length ? t = de(t, function(r) {
|
|
1186
|
-
return
|
|
1187
|
-
return
|
|
1186
|
+
return K(r) ? function(o) {
|
|
1187
|
+
return zt(o, r.length === 1 ? r[0] : r);
|
|
1188
1188
|
} : r;
|
|
1189
1189
|
}) : t = [fe];
|
|
1190
1190
|
var s = -1;
|
|
1191
|
-
t = de(t,
|
|
1192
|
-
var i =
|
|
1191
|
+
t = de(t, At(W));
|
|
1192
|
+
var i = Ft(e, function(r, o, c) {
|
|
1193
1193
|
var a = de(t, function(u) {
|
|
1194
1194
|
return u(r);
|
|
1195
1195
|
});
|
|
1196
1196
|
return { criteria: a, index: ++s, value: r };
|
|
1197
1197
|
});
|
|
1198
|
-
return
|
|
1199
|
-
return
|
|
1198
|
+
return kn(i, function(r, o) {
|
|
1199
|
+
return ts(r, o, n);
|
|
1200
1200
|
});
|
|
1201
1201
|
}
|
|
1202
|
-
var
|
|
1203
|
-
function
|
|
1202
|
+
var ss = jt("length"), ht = "\\ud800-\\udfff", is = "\\u0300-\\u036f", rs = "\\ufe20-\\ufe2f", os = "\\u20d0-\\u20ff", cs = is + rs + os, as = "\\ufe0e\\ufe0f", us = "[" + ht + "]", ve = "[" + cs + "]", Ce = "\\ud83c[\\udffb-\\udfff]", ls = "(?:" + ve + "|" + Ce + ")", dt = "[^" + ht + "]", pt = "(?:\\ud83c[\\udde6-\\uddff]){2}", _t = "[\\ud800-\\udbff][\\udc00-\\udfff]", fs = "\\u200d", yt = ls + "?", bt = "[" + as + "]?", hs = "(?:" + fs + "(?:" + [dt, pt, _t].join("|") + ")" + bt + yt + ")*", ds = bt + yt + hs, ps = "(?:" + [dt + ve + "?", ve, pt, _t, us].join("|") + ")", Ke = RegExp(Ce + "(?=" + Ce + ")|" + ps + ds, "g");
|
|
1203
|
+
function _s(e) {
|
|
1204
1204
|
for (var t = Ke.lastIndex = 0; Ke.test(e); )
|
|
1205
1205
|
++t;
|
|
1206
1206
|
return t;
|
|
1207
1207
|
}
|
|
1208
|
-
function
|
|
1209
|
-
return
|
|
1208
|
+
function ys(e) {
|
|
1209
|
+
return An(e) ? _s(e) : ss(e);
|
|
1210
1210
|
}
|
|
1211
|
-
function
|
|
1212
|
-
return e == null ? e :
|
|
1211
|
+
function bs(e, t, n) {
|
|
1212
|
+
return e == null ? e : Zn(e, t, n);
|
|
1213
1213
|
}
|
|
1214
|
-
var
|
|
1215
|
-
function
|
|
1214
|
+
var ms = "[object Map]", Ss = "[object Set]";
|
|
1215
|
+
function q(e) {
|
|
1216
1216
|
if (e == null)
|
|
1217
1217
|
return 0;
|
|
1218
1218
|
if (he(e))
|
|
1219
|
-
return
|
|
1220
|
-
var t =
|
|
1221
|
-
return t ==
|
|
1219
|
+
return ut(e) ? ys(e) : e.length;
|
|
1220
|
+
var t = et(e);
|
|
1221
|
+
return t == ms || t == Ss ? e.size : tt(e).length;
|
|
1222
1222
|
}
|
|
1223
|
-
var re =
|
|
1223
|
+
var re = wn(function(e, t) {
|
|
1224
1224
|
if (e == null)
|
|
1225
1225
|
return [];
|
|
1226
1226
|
var n = t.length;
|
|
1227
|
-
return n > 1 &&
|
|
1227
|
+
return n > 1 && Qe(e, t[0], t[1]) ? t = [] : n > 2 && Qe(t[0], t[1], t[2]) && (t = [t[0]]), ns(e, Cn(t), []);
|
|
1228
1228
|
});
|
|
1229
|
-
function
|
|
1230
|
-
return e && e.length ? (t = t === void 0 ? 1 :
|
|
1229
|
+
function gs(e, t, n) {
|
|
1230
|
+
return e && e.length ? (t = t === void 0 ? 1 : at(t), Mn(e, 0, t < 0 ? 0 : t)) : [];
|
|
1231
1231
|
}
|
|
1232
|
-
const
|
|
1233
|
-
class
|
|
1232
|
+
const ws = (e, t) => e ? e.type === "create" && t.type === "delete" ? null : e.type === "create" && t.type === "update" ? { ...e, data: t.data } : (e.type === "update" && t.type === "update" || e.type === "update" && t.type === "delete", t) : t;
|
|
1233
|
+
class vs {
|
|
1234
1234
|
_config;
|
|
1235
1235
|
_state;
|
|
1236
1236
|
_subscribers = /* @__PURE__ */ new Set();
|
|
@@ -1247,7 +1247,7 @@ class gs {
|
|
|
1247
1247
|
}
|
|
1248
1248
|
enqueue(t) {
|
|
1249
1249
|
this._updateState((n) => {
|
|
1250
|
-
const s = n.queue.get(t.id), i =
|
|
1250
|
+
const s = n.queue.get(t.id), i = ws(s, t);
|
|
1251
1251
|
i ? n.queue.set(t.id, i) : n.queue.delete(t.id), n.errors.delete(t.id);
|
|
1252
1252
|
}), this._scheduleFlush();
|
|
1253
1253
|
}
|
|
@@ -1297,7 +1297,7 @@ class gs {
|
|
|
1297
1297
|
return this._subscribers.add(t), () => this._subscribers.delete(t);
|
|
1298
1298
|
}
|
|
1299
1299
|
_updateState(t) {
|
|
1300
|
-
this._state =
|
|
1300
|
+
this._state = R(this._state, t), this._subscribers.forEach((n) => n());
|
|
1301
1301
|
}
|
|
1302
1302
|
_scheduleFlush() {
|
|
1303
1303
|
this._state.isPaused || this._state.isSyncing || (this._clearTimer(), this._debounceTimer = setTimeout(() => this._flush(), this._config.debounce));
|
|
@@ -1307,8 +1307,8 @@ class gs {
|
|
|
1307
1307
|
}
|
|
1308
1308
|
async _flush() {
|
|
1309
1309
|
const { isPaused: t, isSyncing: n, queue: s } = this._state;
|
|
1310
|
-
if (t || n ||
|
|
1311
|
-
const i = z(this._config, "batchSize", 1 / 0), r = [...s.entries()], o =
|
|
1310
|
+
if (t || n || Ln(s)) return;
|
|
1311
|
+
const i = z(this._config, "batchSize", 1 / 0), r = [...s.entries()], o = gs(r, i), c = r.slice(q(o));
|
|
1312
1312
|
this._updateState((l) => {
|
|
1313
1313
|
l.inFlight = new Map(o), l.queue = new Map(c), l.isSyncing = !0;
|
|
1314
1314
|
});
|
|
@@ -1320,7 +1320,7 @@ class gs {
|
|
|
1320
1320
|
} catch (l) {
|
|
1321
1321
|
this._handleError(l);
|
|
1322
1322
|
}
|
|
1323
|
-
this._abortController = null,
|
|
1323
|
+
this._abortController = null, q(this._state.queue) > 0 && !this._state.isPaused && this._scheduleFlush();
|
|
1324
1324
|
}
|
|
1325
1325
|
_processResponse(t) {
|
|
1326
1326
|
const n = this._state.inFlight, s = new Map((t.syncResults ?? []).map((i) => [i.id, i]));
|
|
@@ -1339,11 +1339,11 @@ class gs {
|
|
|
1339
1339
|
}
|
|
1340
1340
|
}
|
|
1341
1341
|
i.inFlight = /* @__PURE__ */ new Map(), i.isSyncing = !1;
|
|
1342
|
-
}), this._config.onServerItems &&
|
|
1342
|
+
}), this._config.onServerItems && q(t.items) > 0) {
|
|
1343
1343
|
const i = new Set((t.syncResults ?? []).map((o) => o.id)), r = (t.items ?? []).filter(
|
|
1344
1344
|
(o) => !i.has(o.id)
|
|
1345
1345
|
);
|
|
1346
|
-
|
|
1346
|
+
q(r) > 0 && this._config.onServerItems(r);
|
|
1347
1347
|
}
|
|
1348
1348
|
}
|
|
1349
1349
|
_handleError(t) {
|
|
@@ -1364,7 +1364,7 @@ class gs {
|
|
|
1364
1364
|
});
|
|
1365
1365
|
}
|
|
1366
1366
|
}
|
|
1367
|
-
class
|
|
1367
|
+
class Cs {
|
|
1368
1368
|
_cache = /* @__PURE__ */ new Map();
|
|
1369
1369
|
_capacity;
|
|
1370
1370
|
_ttl;
|
|
@@ -1397,7 +1397,7 @@ class ws {
|
|
|
1397
1397
|
return this._cache.size;
|
|
1398
1398
|
}
|
|
1399
1399
|
}
|
|
1400
|
-
class
|
|
1400
|
+
class Ms {
|
|
1401
1401
|
_config;
|
|
1402
1402
|
_cache;
|
|
1403
1403
|
_state = { status: "idle", items: [] };
|
|
@@ -1405,11 +1405,11 @@ class vs {
|
|
|
1405
1405
|
_abortController = null;
|
|
1406
1406
|
_currentContext = null;
|
|
1407
1407
|
constructor(t) {
|
|
1408
|
-
this._config = { retries: 0, ...t }, this._cache = new
|
|
1408
|
+
this._config = { retries: 0, ...t }, this._cache = new Cs(t.cacheCapacity, t.cacheTtl);
|
|
1409
1409
|
}
|
|
1410
1410
|
_getCacheKey = (t) => JSON.stringify([this._config.id, t]);
|
|
1411
1411
|
_setState(t) {
|
|
1412
|
-
this._state =
|
|
1412
|
+
this._state = R(this._state, (n) => {
|
|
1413
1413
|
Object.assign(n, t);
|
|
1414
1414
|
}), this._subscribers.forEach((n) => n());
|
|
1415
1415
|
}
|
|
@@ -1501,7 +1501,7 @@ class We {
|
|
|
1501
1501
|
}
|
|
1502
1502
|
getStatus() {
|
|
1503
1503
|
const t = this._collection.getItemStatus(this._id);
|
|
1504
|
-
return
|
|
1504
|
+
return lt(this._cachedStatus, t) || (this._cachedStatus = t), this._cachedStatus;
|
|
1505
1505
|
}
|
|
1506
1506
|
exists() {
|
|
1507
1507
|
return this._collection.getState().items.has(this._id);
|
|
@@ -1510,12 +1510,12 @@ class We {
|
|
|
1510
1510
|
return this._collection;
|
|
1511
1511
|
}
|
|
1512
1512
|
}
|
|
1513
|
-
const
|
|
1514
|
-
function
|
|
1513
|
+
const xs = ".";
|
|
1514
|
+
function H(e, t) {
|
|
1515
1515
|
const n = e.lastIndexOf(t);
|
|
1516
1516
|
return n === -1 ? null : e.slice(0, n);
|
|
1517
1517
|
}
|
|
1518
|
-
function
|
|
1518
|
+
function Os(e, t, n) {
|
|
1519
1519
|
return e.startsWith(t + n) ? !e.slice(t.length + 1).includes(n) : !1;
|
|
1520
1520
|
}
|
|
1521
1521
|
function ye(e, t, n) {
|
|
@@ -1532,7 +1532,7 @@ class Le {
|
|
|
1532
1532
|
this._collection = t, this._id = n;
|
|
1533
1533
|
}
|
|
1534
1534
|
get _separator() {
|
|
1535
|
-
return this._collection.config.nodeSeparator ??
|
|
1535
|
+
return this._collection.config.nodeSeparator ?? xs;
|
|
1536
1536
|
}
|
|
1537
1537
|
get id() {
|
|
1538
1538
|
return this._id;
|
|
@@ -1551,7 +1551,7 @@ class Le {
|
|
|
1551
1551
|
}
|
|
1552
1552
|
getStatus() {
|
|
1553
1553
|
const t = this._collection.getItemStatus(this._id);
|
|
1554
|
-
return
|
|
1554
|
+
return lt(this._cachedStatus, t) || (this._cachedStatus = t), this._cachedStatus;
|
|
1555
1555
|
}
|
|
1556
1556
|
_touch(t) {
|
|
1557
1557
|
this._collection.items.has(t) && this._collection.update(t, (n) => {
|
|
@@ -1559,24 +1559,24 @@ class Le {
|
|
|
1559
1559
|
});
|
|
1560
1560
|
}
|
|
1561
1561
|
getParent() {
|
|
1562
|
-
const t =
|
|
1562
|
+
const t = H(this._id, this._separator);
|
|
1563
1563
|
return t ? this._collection.getNode(t) : null;
|
|
1564
1564
|
}
|
|
1565
1565
|
getChildren() {
|
|
1566
|
-
const t = [...this._collection.items.entries()], n =
|
|
1567
|
-
se(t, ([i]) =>
|
|
1566
|
+
const t = [...this._collection.items.entries()], n = U(
|
|
1567
|
+
se(t, ([i]) => Os(i, this._id, this._separator)),
|
|
1568
1568
|
([i, r]) => ({ id: i, position: r.position })
|
|
1569
1569
|
), s = re(n, "position");
|
|
1570
|
-
return
|
|
1570
|
+
return U(s, (i) => this._collection.getNode(i.id));
|
|
1571
1571
|
}
|
|
1572
1572
|
_generateChildId() {
|
|
1573
|
-
const { getNodeId: t } = this._collection.config, n = t ? t() :
|
|
1573
|
+
const { getNodeId: t } = this._collection.config, n = t ? t() : ze();
|
|
1574
1574
|
return _e([this._id, n], this._separator);
|
|
1575
1575
|
}
|
|
1576
1576
|
moveUp() {
|
|
1577
1577
|
const t = this.data;
|
|
1578
1578
|
if (!t) return;
|
|
1579
|
-
const n =
|
|
1579
|
+
const n = H(this._id, this._separator);
|
|
1580
1580
|
if (!n) return;
|
|
1581
1581
|
const i = this._collection.getNode(n).getChildren(), r = ie(i, (u) => u.id === this._id);
|
|
1582
1582
|
if (r <= 0) return;
|
|
@@ -1594,10 +1594,10 @@ class Le {
|
|
|
1594
1594
|
moveDown() {
|
|
1595
1595
|
const t = this.data;
|
|
1596
1596
|
if (!t) return;
|
|
1597
|
-
const n =
|
|
1597
|
+
const n = H(this._id, this._separator);
|
|
1598
1598
|
if (!n) return;
|
|
1599
1599
|
const i = this._collection.getNode(n).getChildren(), r = ie(i, (u) => u.id === this._id);
|
|
1600
|
-
if (r === -1 || r >=
|
|
1600
|
+
if (r === -1 || r >= q(i) - 1) return;
|
|
1601
1601
|
const o = i[r + 1], c = o.data;
|
|
1602
1602
|
if (!c) return;
|
|
1603
1603
|
const a = t.position;
|
|
@@ -1611,17 +1611,17 @@ class Le {
|
|
|
1611
1611
|
}
|
|
1612
1612
|
setPosition(t) {
|
|
1613
1613
|
if (!this.data) return;
|
|
1614
|
-
const s =
|
|
1614
|
+
const s = H(this._id, this._separator);
|
|
1615
1615
|
if (!s) return;
|
|
1616
1616
|
const r = this._collection.getNode(s).getChildren(), o = ie(r, (l) => l.id === this._id);
|
|
1617
1617
|
if (o === -1) return;
|
|
1618
|
-
const c =
|
|
1618
|
+
const c = jn(t, 0, q(r) - 1);
|
|
1619
1619
|
if (c === o) return;
|
|
1620
1620
|
const a = [...r], [u] = a.splice(o, 1);
|
|
1621
1621
|
a.splice(c, 0, u), this._collection.batch(() => {
|
|
1622
1622
|
k(a, (l, f) => {
|
|
1623
|
-
const
|
|
1624
|
-
|
|
1623
|
+
const _ = l.data;
|
|
1624
|
+
_ && _.position !== f && this._collection.update(l.id, (p) => {
|
|
1625
1625
|
p.position = f;
|
|
1626
1626
|
});
|
|
1627
1627
|
}), this._touch(s);
|
|
@@ -1634,7 +1634,7 @@ class Le {
|
|
|
1634
1634
|
}), c;
|
|
1635
1635
|
}
|
|
1636
1636
|
prepend(t, n = "object") {
|
|
1637
|
-
const s = this.getChildren(), i =
|
|
1637
|
+
const s = this.getChildren(), i = Xn(s, (u) => z(u, "data.position", 0)), o = (i ? z(i, "data.position", 0) : 1) - 1, c = this._generateChildId(), a = { id: c, position: o, value: t, type: n };
|
|
1638
1638
|
return this._collection.batch(() => {
|
|
1639
1639
|
this._collection.create(a), this._touch(this._id);
|
|
1640
1640
|
}), c;
|
|
@@ -1649,7 +1649,7 @@ class Le {
|
|
|
1649
1649
|
move(t, n) {
|
|
1650
1650
|
const s = this.data;
|
|
1651
1651
|
if (!s) return;
|
|
1652
|
-
const i =
|
|
1652
|
+
const i = H(this._id, this._separator);
|
|
1653
1653
|
if (!i) return;
|
|
1654
1654
|
if (!n) {
|
|
1655
1655
|
const o = s.position;
|
|
@@ -1683,7 +1683,7 @@ class Le {
|
|
|
1683
1683
|
clone() {
|
|
1684
1684
|
const t = this.data;
|
|
1685
1685
|
if (!t) return /* @__PURE__ */ new Map();
|
|
1686
|
-
const { getNodeId: n } = this._collection.config, s = n ? n() :
|
|
1686
|
+
const { getNodeId: n } = this._collection.config, s = n ? n() : ze(), i = /* @__PURE__ */ new Map();
|
|
1687
1687
|
i.set(s, {
|
|
1688
1688
|
id: s,
|
|
1689
1689
|
position: t.position,
|
|
@@ -1712,7 +1712,7 @@ class Le {
|
|
|
1712
1712
|
if (t.size === 0) return;
|
|
1713
1713
|
const s = [...t.keys()];
|
|
1714
1714
|
let i = Be(s, (c) => !c.includes(this._separator));
|
|
1715
|
-
if (i || (i =
|
|
1715
|
+
if (i || (i = Qn(re(s, (c) => c.length))), !i) return;
|
|
1716
1716
|
const r = this._generateChildId();
|
|
1717
1717
|
let o;
|
|
1718
1718
|
if (n !== void 0)
|
|
@@ -1744,7 +1744,7 @@ class Le {
|
|
|
1744
1744
|
});
|
|
1745
1745
|
}
|
|
1746
1746
|
remove() {
|
|
1747
|
-
const t =
|
|
1747
|
+
const t = H(this._id, this._separator), n = [...this._collection.items.keys()], s = U(
|
|
1748
1748
|
se(n, (r) => ye(r, this._id, this._separator)),
|
|
1749
1749
|
(r) => r
|
|
1750
1750
|
), i = [this._id, ...s];
|
|
@@ -1757,7 +1757,7 @@ class Le {
|
|
|
1757
1757
|
this._collection.selectNode(this._id);
|
|
1758
1758
|
}
|
|
1759
1759
|
}
|
|
1760
|
-
function
|
|
1760
|
+
function mt(e) {
|
|
1761
1761
|
const t = /* @__PURE__ */ new Map();
|
|
1762
1762
|
if (e.serverItems)
|
|
1763
1763
|
for (const n of e.serverItems)
|
|
@@ -1815,7 +1815,7 @@ class M {
|
|
|
1815
1815
|
items: a.items ?? [],
|
|
1816
1816
|
serverState: a.serverState
|
|
1817
1817
|
})) : async () => ({ items: [] }), s = t.handler ? (o, c, a) => t.handler({ changes: o }, a) : async (o) => ({
|
|
1818
|
-
syncResults:
|
|
1818
|
+
syncResults: U(o, (c) => ({
|
|
1819
1819
|
status: "success",
|
|
1820
1820
|
id: c.id,
|
|
1821
1821
|
type: c.type,
|
|
@@ -1823,12 +1823,12 @@ class M {
|
|
|
1823
1823
|
})),
|
|
1824
1824
|
serverSyncedAt: ""
|
|
1825
1825
|
});
|
|
1826
|
-
this._syncQueue = new
|
|
1826
|
+
this._syncQueue = new vs({
|
|
1827
1827
|
debounce: t.syncDebounce ?? 300,
|
|
1828
1828
|
maxRetries: t.syncRetries ?? 3,
|
|
1829
1829
|
getContext: () => this._state.context,
|
|
1830
1830
|
onSync: s
|
|
1831
|
-
}), this._fetchHandler = new
|
|
1831
|
+
}), this._fetchHandler = new Ms({
|
|
1832
1832
|
id: t.id,
|
|
1833
1833
|
cacheCapacity: t.cacheCapacity ?? 10,
|
|
1834
1834
|
cacheTtl: t.cacheTtl ?? 6e4,
|
|
@@ -1896,8 +1896,8 @@ class M {
|
|
|
1896
1896
|
}
|
|
1897
1897
|
create(t) {
|
|
1898
1898
|
const { id: n } = t;
|
|
1899
|
-
if (
|
|
1900
|
-
return this._state =
|
|
1899
|
+
if (ut(n) && q(n) > 0)
|
|
1900
|
+
return this._state = R(this._state, (s) => {
|
|
1901
1901
|
s.items.set(n, t);
|
|
1902
1902
|
}), this._fetchHandler.invalidateCache(), this._notifySubscribers(), this._syncQueue.enqueue({ id: n, type: "create", data: t }), n;
|
|
1903
1903
|
throw new Error("`id` property should exist and should be non-empty");
|
|
@@ -1905,14 +1905,14 @@ class M {
|
|
|
1905
1905
|
update(t, n) {
|
|
1906
1906
|
const s = this._state.items.get(t);
|
|
1907
1907
|
if (!s) return;
|
|
1908
|
-
const i =
|
|
1909
|
-
this._state =
|
|
1910
|
-
|
|
1908
|
+
const i = R(s, n);
|
|
1909
|
+
this._state = R(this._state, (r) => {
|
|
1910
|
+
bs(i, "id", t), r.items.set(t, i);
|
|
1911
1911
|
}), this._fetchHandler.invalidateCache(), this._notifySubscribers(), this._syncQueue.enqueue({ id: t, type: "update", data: i });
|
|
1912
1912
|
}
|
|
1913
1913
|
remove(t) {
|
|
1914
1914
|
const n = this._state.items.get(t);
|
|
1915
|
-
n && (this._state =
|
|
1915
|
+
n && (this._state = R(this._state, (s) => {
|
|
1916
1916
|
s.items.delete(t);
|
|
1917
1917
|
}), this._fetchHandler.invalidateCache(), this._notifySubscribers(), this._syncQueue.enqueue({ id: t, type: "delete", data: n }));
|
|
1918
1918
|
}
|
|
@@ -1954,8 +1954,8 @@ class M {
|
|
|
1954
1954
|
return this._selectedNodeId ? this.getNode(this._selectedNodeId) : null;
|
|
1955
1955
|
}
|
|
1956
1956
|
setContext(t) {
|
|
1957
|
-
const n = this._state.context, s =
|
|
1958
|
-
n !== s && (this._state =
|
|
1957
|
+
const n = this._state.context, s = R(n, t);
|
|
1958
|
+
n !== s && (this._state = R(this._state, (i) => {
|
|
1959
1959
|
i.context = s;
|
|
1960
1960
|
}), this._fetchHandler.fetch(s), this._notifySubscribers());
|
|
1961
1961
|
}
|
|
@@ -1977,7 +1977,7 @@ class M {
|
|
|
1977
1977
|
async _initialFetch() {
|
|
1978
1978
|
if (!this._hasInitialized) {
|
|
1979
1979
|
if (this._hasInitialized = !0, this.config.serverItems) {
|
|
1980
|
-
this._state =
|
|
1980
|
+
this._state = R(this._state, (t) => {
|
|
1981
1981
|
for (const n of this.config.serverItems)
|
|
1982
1982
|
t.items.set(n.id, n);
|
|
1983
1983
|
}), this._notifySubscribers();
|
|
@@ -1991,7 +1991,7 @@ class M {
|
|
|
1991
1991
|
}
|
|
1992
1992
|
_onFetchChange() {
|
|
1993
1993
|
const t = this._fetchHandler.getState();
|
|
1994
|
-
this._state =
|
|
1994
|
+
this._state = R(this._state, (n) => {
|
|
1995
1995
|
n.fetchStatus = t.status, n.fetchError = t.error, n.serverState = t.serverState, n.loading = t.status === "fetching", n.syncState = this._computeSyncState(t.status, n.syncQueue.isSyncing);
|
|
1996
1996
|
const s = /* @__PURE__ */ new Map();
|
|
1997
1997
|
for (const i of t.items)
|
|
@@ -2000,7 +2000,7 @@ class M {
|
|
|
2000
2000
|
}), this._notifySubscribers();
|
|
2001
2001
|
}
|
|
2002
2002
|
_updateSyncState(t) {
|
|
2003
|
-
this._state =
|
|
2003
|
+
this._state = R(this._state, (n) => {
|
|
2004
2004
|
n.syncQueue = t, n.syncing = t.isSyncing, n.syncState = this._computeSyncState(n.fetchStatus, t.isSyncing);
|
|
2005
2005
|
}), this._notifySubscribers();
|
|
2006
2006
|
}
|
|
@@ -2013,8 +2013,8 @@ class M {
|
|
|
2013
2013
|
t();
|
|
2014
2014
|
}
|
|
2015
2015
|
}
|
|
2016
|
-
function
|
|
2017
|
-
const t = M.get(e), n = le(() =>
|
|
2016
|
+
function As(e) {
|
|
2017
|
+
const t = M.get(e), n = le(() => mt(e), [e.id]), s = v(
|
|
2018
2018
|
(i) => t.subscribe(i),
|
|
2019
2019
|
() => t.getState(),
|
|
2020
2020
|
() => n
|
|
@@ -2031,7 +2031,7 @@ function Es(e) {
|
|
|
2031
2031
|
fetchError: s.fetchError,
|
|
2032
2032
|
serverState: s.serverState,
|
|
2033
2033
|
// Item operations
|
|
2034
|
-
create: (i) => t.create(
|
|
2034
|
+
create: (i) => t.create(i),
|
|
2035
2035
|
update: (i, r) => t.update(i, r),
|
|
2036
2036
|
remove: (i) => t.remove(i),
|
|
2037
2037
|
getItem: (i) => t.getItem(i),
|
|
@@ -2045,8 +2045,8 @@ function Es(e) {
|
|
|
2045
2045
|
retrySync: (i) => t.retrySync(i)
|
|
2046
2046
|
};
|
|
2047
2047
|
}
|
|
2048
|
-
function
|
|
2049
|
-
const t = e, n = M.get(t), s = le(() =>
|
|
2048
|
+
function Fs(e) {
|
|
2049
|
+
const t = e, n = M.get(t), s = le(() => mt(t), [e.id]), i = v(
|
|
2050
2050
|
(u) => n.subscribe(u),
|
|
2051
2051
|
() => n.getState(),
|
|
2052
2052
|
() => s
|
|
@@ -2062,14 +2062,14 @@ function Is(e) {
|
|
|
2062
2062
|
(u) => n.subscribe(u),
|
|
2063
2063
|
() => n.selectedNode,
|
|
2064
2064
|
() => null
|
|
2065
|
-
), a =
|
|
2066
|
-
const u = e.nodeSeparator ?? ".", l = (
|
|
2067
|
-
const p = i.items.get(
|
|
2065
|
+
), a = S(() => {
|
|
2066
|
+
const u = e.nodeSeparator ?? ".", l = (_, p) => _.startsWith(p + u) ? !_.slice(p.length + 1).includes(u) : !1, f = (_) => {
|
|
2067
|
+
const p = i.items.get(_);
|
|
2068
2068
|
if (!p) return null;
|
|
2069
|
-
const
|
|
2070
|
-
se([...i.items.entries()], ([
|
|
2071
|
-
([
|
|
2072
|
-
),
|
|
2069
|
+
const N = U(
|
|
2070
|
+
se([...i.items.entries()], ([b]) => l(b, _)),
|
|
2071
|
+
([b, m]) => ({ id: b, position: m.position })
|
|
2072
|
+
), Q = re(N, "position"), C = U(Q, (b) => f(b.id)).filter(Boolean);
|
|
2073
2073
|
return {
|
|
2074
2074
|
id: p.id,
|
|
2075
2075
|
type: p.type,
|
|
@@ -2111,69 +2111,72 @@ function Is(e) {
|
|
|
2111
2111
|
toJson: a
|
|
2112
2112
|
};
|
|
2113
2113
|
}
|
|
2114
|
-
function
|
|
2115
|
-
const t = v(
|
|
2116
|
-
(
|
|
2114
|
+
function js(e, t) {
|
|
2115
|
+
const n = t?.trackStatus ?? !0, s = v(
|
|
2116
|
+
(a) => e.collection.subscribe(a),
|
|
2117
2117
|
() => e.data,
|
|
2118
2118
|
() => e.data
|
|
2119
|
-
),
|
|
2120
|
-
(
|
|
2121
|
-
() => e.getStatus(),
|
|
2122
|
-
() => e.getStatus()
|
|
2123
|
-
),
|
|
2124
|
-
(
|
|
2119
|
+
), i = v(
|
|
2120
|
+
n ? (a) => e.collection.subscribe(a) : Ps,
|
|
2121
|
+
n ? () => e.getStatus() : Je,
|
|
2122
|
+
n ? () => e.getStatus() : Je
|
|
2123
|
+
), r = v(
|
|
2124
|
+
(a) => e.collection.subscribe(a),
|
|
2125
2125
|
() => e.exists(),
|
|
2126
2126
|
() => e.exists()
|
|
2127
|
-
),
|
|
2128
|
-
return { data:
|
|
2129
|
-
}
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2127
|
+
), o = S((a) => e.update(a), [e]), c = S(() => e.remove(), [e]);
|
|
2128
|
+
return { data: s, status: i, update: o, remove: c, exists: r };
|
|
2129
|
+
}
|
|
2130
|
+
const Ps = () => () => {
|
|
2131
|
+
}, Je = () => null;
|
|
2132
|
+
function Rs(e, t) {
|
|
2133
|
+
const n = t?.trackStatus ?? !0, s = S((h) => e.collection.subscribe(h), [e]), i = v(
|
|
2134
|
+
s,
|
|
2133
2135
|
() => e.data,
|
|
2134
2136
|
() => e.data
|
|
2135
|
-
),
|
|
2136
|
-
|
|
2137
|
-
() => e.getStatus(),
|
|
2138
|
-
() => e.getStatus()
|
|
2139
|
-
),
|
|
2140
|
-
|
|
2137
|
+
), r = v(
|
|
2138
|
+
n ? s : Es,
|
|
2139
|
+
n ? () => e.getStatus() : Ye,
|
|
2140
|
+
n ? () => e.getStatus() : Ye
|
|
2141
|
+
), o = v(
|
|
2142
|
+
s,
|
|
2141
2143
|
() => e.exists(),
|
|
2142
2144
|
() => e.exists()
|
|
2143
|
-
),
|
|
2144
|
-
|
|
2145
|
+
), c = v(
|
|
2146
|
+
s,
|
|
2145
2147
|
() => e.collection.selectedNodeId === e.id,
|
|
2146
2148
|
() => e.collection.selectedNodeId === e.id
|
|
2147
|
-
),
|
|
2148
|
-
(
|
|
2149
|
+
), a = le(() => e.getChildren(), [i, e]), u = S(() => e.getParent(), [e]), l = S((h, g) => e.append(h, g), [e]), f = S((h, g) => e.prepend(h, g), [e]), _ = S(
|
|
2150
|
+
(h, g) => e.move(h, g),
|
|
2149
2151
|
[e]
|
|
2150
|
-
),
|
|
2151
|
-
(
|
|
2152
|
+
), p = S(() => e.moveUp(), [e]), N = S(() => e.moveDown(), [e]), Q = S((h) => e.setPosition(h), [e]), C = S(() => e.clone(), [e]), b = S(
|
|
2153
|
+
(h) => e.updateProp(h),
|
|
2152
2154
|
[e]
|
|
2153
|
-
),
|
|
2155
|
+
), m = S(() => e.remove(), [e]), P = S(() => e.select(), [e]), Z = S(() => e.collection.deselectNode(), [e]);
|
|
2154
2156
|
return {
|
|
2155
2157
|
isPresent: !0,
|
|
2156
|
-
data:
|
|
2157
|
-
status:
|
|
2158
|
-
exists:
|
|
2159
|
-
isSelected:
|
|
2158
|
+
data: i,
|
|
2159
|
+
status: r,
|
|
2160
|
+
exists: o,
|
|
2161
|
+
isSelected: c,
|
|
2160
2162
|
depth: e.depth,
|
|
2161
|
-
getParent:
|
|
2162
|
-
children:
|
|
2163
|
-
append:
|
|
2164
|
-
prepend:
|
|
2165
|
-
move:
|
|
2166
|
-
moveUp:
|
|
2167
|
-
moveDown:
|
|
2168
|
-
setPosition:
|
|
2169
|
-
clone:
|
|
2170
|
-
updateProp:
|
|
2171
|
-
remove:
|
|
2172
|
-
select:
|
|
2173
|
-
deselect:
|
|
2163
|
+
getParent: u,
|
|
2164
|
+
children: a,
|
|
2165
|
+
append: l,
|
|
2166
|
+
prepend: f,
|
|
2167
|
+
move: _,
|
|
2168
|
+
moveUp: p,
|
|
2169
|
+
moveDown: N,
|
|
2170
|
+
setPosition: Q,
|
|
2171
|
+
clone: C,
|
|
2172
|
+
updateProp: b,
|
|
2173
|
+
remove: m,
|
|
2174
|
+
select: P,
|
|
2175
|
+
deselect: Z
|
|
2174
2176
|
};
|
|
2175
2177
|
}
|
|
2176
|
-
const
|
|
2178
|
+
const Es = () => () => {
|
|
2179
|
+
}, Ye = () => null, Is = {
|
|
2177
2180
|
isPresent: !1,
|
|
2178
2181
|
data: void 0,
|
|
2179
2182
|
status: null,
|
|
@@ -2202,7 +2205,7 @@ const Os = {
|
|
|
2202
2205
|
deselect: () => {
|
|
2203
2206
|
}
|
|
2204
2207
|
};
|
|
2205
|
-
function
|
|
2208
|
+
function Ds(e) {
|
|
2206
2209
|
const t = M.getById(e);
|
|
2207
2210
|
if (!t)
|
|
2208
2211
|
throw new Error(
|
|
@@ -2212,10 +2215,10 @@ function zs(e) {
|
|
|
2212
2215
|
(r) => t.subscribe(r),
|
|
2213
2216
|
() => t.selectedNode,
|
|
2214
2217
|
() => t.selectedNode
|
|
2215
|
-
), s = le(() => t.getNode("__dummy__"), [t]), i =
|
|
2216
|
-
return n ? i :
|
|
2218
|
+
), s = le(() => t.getNode("__dummy__"), [t]), i = Rs(n ?? s);
|
|
2219
|
+
return n ? i : Is;
|
|
2217
2220
|
}
|
|
2218
|
-
function
|
|
2221
|
+
function Ts(e) {
|
|
2219
2222
|
const t = M.getById(e);
|
|
2220
2223
|
if (!t)
|
|
2221
2224
|
throw new Error(
|
|
@@ -2236,7 +2239,7 @@ function As(e) {
|
|
|
2236
2239
|
isSyncing: n.syncQueue.isSyncing
|
|
2237
2240
|
};
|
|
2238
2241
|
}
|
|
2239
|
-
function
|
|
2242
|
+
function qs(e, t) {
|
|
2240
2243
|
const n = M.getById(e);
|
|
2241
2244
|
if (!n)
|
|
2242
2245
|
throw new Error(
|
|
@@ -2249,23 +2252,23 @@ function Fs(e, t) {
|
|
|
2249
2252
|
).serverState ?? t;
|
|
2250
2253
|
}
|
|
2251
2254
|
export {
|
|
2252
|
-
|
|
2255
|
+
Cs as Cache,
|
|
2253
2256
|
M as Collection,
|
|
2254
|
-
|
|
2257
|
+
Ms as FetchHandler,
|
|
2255
2258
|
We as Item,
|
|
2256
2259
|
Le as Node,
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2260
|
+
vs as SyncQueue,
|
|
2261
|
+
mt as buildServerSnapshot,
|
|
2262
|
+
Hs as compareTimeIds,
|
|
2263
|
+
Ks as createSyncClient,
|
|
2264
|
+
ze as getIdFromTime,
|
|
2265
|
+
Bs as getTimeFromId,
|
|
2266
|
+
As as useCrud,
|
|
2267
|
+
Fs as useCrudTree,
|
|
2268
|
+
js as useItem,
|
|
2269
|
+
Rs as useNode,
|
|
2270
|
+
Ds as useSelectedNode,
|
|
2271
|
+
qs as useServerState,
|
|
2272
|
+
Ts as useSyncState
|
|
2270
2273
|
};
|
|
2271
2274
|
//# sourceMappingURL=index.js.map
|