use-abcd 1.6.2 → 1.6.4
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/collection.d.ts +1 -0
- package/dist/fetch-handler.d.ts +8 -3
- package/dist/index.d.ts +1 -0
- package/dist/index.js +261 -228
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +2 -1
- package/dist/useCrud.d.ts +1 -0
- package/dist/useCrudTree.d.ts +1 -0
- package/dist/useServerState.d.ts +11 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { useMemo as le, useSyncExternalStore as v, useCallback as
|
|
2
|
-
import { b as oe, c as G, d as
|
|
3
|
-
import { H as
|
|
4
|
-
import { c as
|
|
1
|
+
import { useMemo as le, useSyncExternalStore as v, useCallback as g } from "react";
|
|
2
|
+
import { b as oe, c as G, d as mt, e as fe, f as Je, h as he, j as Ye, S as ze, i as W, k as Ge, l as St, n as Xe, o as gt, p as V, q as wt, r as vt, s as Ct, t as Mt, u as xt, v as Ze, w as Ot, x as ke, y as Pt, z as Rt, A as Et, B as de, C as It, D as Nt, E as zt, F as At, a as z, m as K, g as be } from "./chunks/utils-C2wXstxP.js";
|
|
3
|
+
import { H as Ts, G as qs } from "./chunks/utils-C2wXstxP.js";
|
|
4
|
+
import { c as $s } from "./chunks/client-lHRDCo64.js";
|
|
5
5
|
const b = {
|
|
6
6
|
Remove: "remove",
|
|
7
7
|
Replace: "replace",
|
|
8
8
|
Add: "add"
|
|
9
|
-
}, et = Symbol.for("__MUTATIVE_PROXY_DRAFT__"),
|
|
9
|
+
}, et = Symbol.for("__MUTATIVE_PROXY_DRAFT__"), Ft = Symbol("__MUTATIVE_RAW_RETURN_SYMBOL__"), ee = Symbol.iterator, O = {
|
|
10
10
|
mutable: "mutable",
|
|
11
11
|
immutable: "immutable"
|
|
12
12
|
}, xe = {};
|
|
@@ -30,7 +30,7 @@ function Oe(e) {
|
|
|
30
30
|
function Pe(e) {
|
|
31
31
|
return Object.getPrototypeOf(e) === Map.prototype;
|
|
32
32
|
}
|
|
33
|
-
function
|
|
33
|
+
function x(e) {
|
|
34
34
|
var t;
|
|
35
35
|
return (t = e.copy) !== null && t !== void 0 ? t : e.original;
|
|
36
36
|
}
|
|
@@ -49,7 +49,7 @@ function R(e, t) {
|
|
|
49
49
|
if (!e || typeof e != "object")
|
|
50
50
|
return !1;
|
|
51
51
|
let n;
|
|
52
|
-
return Object.getPrototypeOf(e) === Object.prototype || Array.isArray(e) || e instanceof Map || e instanceof Set || !!t?.mark && ((n = t.mark(e,
|
|
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
54
|
function tt(e, t = []) {
|
|
55
55
|
if (Object.hasOwnProperty.call(e, "key")) {
|
|
@@ -65,24 +65,24 @@ function tt(e, t = []) {
|
|
|
65
65
|
return tt(e.parent, t);
|
|
66
66
|
t.reverse();
|
|
67
67
|
try {
|
|
68
|
-
|
|
68
|
+
jt(e.copy, t);
|
|
69
69
|
} catch {
|
|
70
70
|
return null;
|
|
71
71
|
}
|
|
72
72
|
return t;
|
|
73
73
|
}
|
|
74
|
-
function
|
|
74
|
+
function $(e) {
|
|
75
75
|
return Array.isArray(e) ? 1 : e instanceof Map ? 2 : e instanceof Set ? 3 : 0;
|
|
76
76
|
}
|
|
77
77
|
function F(e, t) {
|
|
78
|
-
return
|
|
78
|
+
return $(e) === 2 ? e.get(t) : e[t];
|
|
79
79
|
}
|
|
80
80
|
function Z(e, t, n) {
|
|
81
|
-
|
|
81
|
+
$(e) === 2 ? e.set(t, n) : e[t] = n;
|
|
82
82
|
}
|
|
83
83
|
function pe(e, t) {
|
|
84
84
|
const n = h(e);
|
|
85
|
-
return (n ?
|
|
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;
|
|
@@ -98,15 +98,15 @@ function q(e, t) {
|
|
|
98
98
|
return s.indexOf("/") === -1 && s.indexOf("~") === -1 ? s : s.replace(/~/g, "~0").replace(/\//g, "~1");
|
|
99
99
|
}).join("/");
|
|
100
100
|
}
|
|
101
|
-
function
|
|
101
|
+
function jt(e, t) {
|
|
102
102
|
for (let n = 0; n < t.length - 1; n += 1) {
|
|
103
103
|
const s = t[n];
|
|
104
|
-
if (e = F(
|
|
104
|
+
if (e = F($(e) === 3 ? Array.from(e) : e, s), typeof e != "object")
|
|
105
105
|
throw new Error(`Cannot resolve patch at '${t.join("/")}'.`);
|
|
106
106
|
}
|
|
107
107
|
return e;
|
|
108
108
|
}
|
|
109
|
-
function
|
|
109
|
+
function Dt(e) {
|
|
110
110
|
const t = Object.create(Object.getPrototypeOf(e));
|
|
111
111
|
return Reflect.ownKeys(e).forEach((n) => {
|
|
112
112
|
let s = Reflect.getOwnPropertyDescriptor(e, n);
|
|
@@ -122,7 +122,7 @@ function jt(e) {
|
|
|
122
122
|
}), Reflect.defineProperty(t, n, s);
|
|
123
123
|
}), t;
|
|
124
124
|
}
|
|
125
|
-
const
|
|
125
|
+
const Tt = Object.prototype.propertyIsEnumerable;
|
|
126
126
|
function nt(e, t) {
|
|
127
127
|
let n;
|
|
128
128
|
if (Array.isArray(e))
|
|
@@ -139,9 +139,9 @@ function nt(e, t) {
|
|
|
139
139
|
return new s(e);
|
|
140
140
|
}
|
|
141
141
|
return new Map(e);
|
|
142
|
-
} else if (t?.mark && (n = t.mark(e,
|
|
143
|
-
if (n ===
|
|
144
|
-
return
|
|
142
|
+
} else if (t?.mark && (n = t.mark(e, O), n !== void 0) && n !== O.mutable) {
|
|
143
|
+
if (n === O.immutable)
|
|
144
|
+
return Dt(e);
|
|
145
145
|
if (typeof n == "function") {
|
|
146
146
|
if (t.enablePatches || t.enableAutoFreeze)
|
|
147
147
|
throw new Error("You can't use mark and patches or auto freeze together.");
|
|
@@ -153,7 +153,7 @@ function nt(e, t) {
|
|
|
153
153
|
return Object.keys(e).forEach((i) => {
|
|
154
154
|
s[i] = e[i];
|
|
155
155
|
}), Object.getOwnPropertySymbols(e).forEach((i) => {
|
|
156
|
-
|
|
156
|
+
Tt.call(e, i) && (s[i] = e[i]);
|
|
157
157
|
}), s;
|
|
158
158
|
} else
|
|
159
159
|
throw new Error("Please check mark() to ensure that it is a stable marker draftable function.");
|
|
@@ -200,7 +200,7 @@ function E(e) {
|
|
|
200
200
|
function Fe() {
|
|
201
201
|
throw new Error("Cannot modify frozen object");
|
|
202
202
|
}
|
|
203
|
-
function
|
|
203
|
+
function U(e, t, n, s, i) {
|
|
204
204
|
{
|
|
205
205
|
n = n ?? /* @__PURE__ */ new WeakMap(), s = s ?? [], i = i ?? [];
|
|
206
206
|
const o = n.has(e) ? n.get(e) : e;
|
|
@@ -221,33 +221,33 @@ function B(e, t, n, s, i) {
|
|
|
221
221
|
s.pop(), i.pop();
|
|
222
222
|
return;
|
|
223
223
|
}
|
|
224
|
-
switch (
|
|
224
|
+
switch ($(e)) {
|
|
225
225
|
case 2:
|
|
226
226
|
for (const [c, a] of e)
|
|
227
|
-
|
|
227
|
+
U(c, c, n, s, i), U(a, c, n, s, i);
|
|
228
228
|
e.set = e.clear = e.delete = Fe;
|
|
229
229
|
break;
|
|
230
230
|
case 3:
|
|
231
231
|
for (const c of e)
|
|
232
|
-
|
|
232
|
+
U(c, c, n, s, i);
|
|
233
233
|
e.add = e.clear = e.delete = Fe;
|
|
234
234
|
break;
|
|
235
235
|
case 1:
|
|
236
236
|
Object.freeze(e);
|
|
237
237
|
let o = 0;
|
|
238
238
|
for (const c of e)
|
|
239
|
-
|
|
239
|
+
U(c, o, n, s, i), o += 1;
|
|
240
240
|
break;
|
|
241
241
|
default:
|
|
242
242
|
Object.freeze(e), Object.keys(e).forEach((c) => {
|
|
243
243
|
const a = e[c];
|
|
244
|
-
|
|
244
|
+
U(a, c, n, s, i);
|
|
245
245
|
});
|
|
246
246
|
}
|
|
247
247
|
s.pop(), i.pop();
|
|
248
248
|
}
|
|
249
249
|
function Ee(e, t) {
|
|
250
|
-
const n =
|
|
250
|
+
const n = $(e);
|
|
251
251
|
if (n === 0)
|
|
252
252
|
Reflect.ownKeys(e).forEach((s) => {
|
|
253
253
|
t(s, e[s], e);
|
|
@@ -279,16 +279,16 @@ 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
284
|
e.finalities.revoke.length > 1 && e.assignedMap.get(t) && n && st(F(n, t), e.finalities.handledSet, e.options);
|
|
285
285
|
}
|
|
286
|
-
function
|
|
286
|
+
function Se(e) {
|
|
287
287
|
e.type === 3 && e.copy && (e.copy.clear(), e.setMap.forEach((t) => {
|
|
288
288
|
e.copy.add(Re(t));
|
|
289
289
|
}));
|
|
290
290
|
}
|
|
291
|
-
function
|
|
291
|
+
function ge(e, t, n, s) {
|
|
292
292
|
if (e.operated && e.assignedMap && e.assignedMap.size > 0 && !e.finalized) {
|
|
293
293
|
if (n && s) {
|
|
294
294
|
const r = tt(e);
|
|
@@ -304,14 +304,14 @@ function Ie(e, t, n, s) {
|
|
|
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), Se(e), ge(e, s, r, o), e.options.enableAutoFreeze && (e.options.updatedValues = (c = e.options.updatedValues) !== null && c !== void 0 ? c : /* @__PURE__ */ new WeakMap(), e.options.updatedValues.set(u, i.original)), Z(a, t, u);
|
|
308
308
|
}
|
|
309
309
|
}), e.options.enableAutoFreeze && i.finalities !== e.finalities && (e.options.enableAutoFreeze = !1)), R(n, e.options) && e.finalities.draft.push(() => {
|
|
310
310
|
const r = e.type === 3 ? e.setMap : e.copy;
|
|
311
|
-
A(F(r, t), n) &&
|
|
311
|
+
A(F(r, t), n) && qt(e, t);
|
|
312
312
|
});
|
|
313
313
|
}
|
|
314
|
-
function
|
|
314
|
+
function Qt(e, t, n, s, i) {
|
|
315
315
|
let { original: r, assignedMap: o, options: c } = e, a = e.copy;
|
|
316
316
|
a.length < r.length && ([r, a] = [a, r], [n, s] = [s, n]);
|
|
317
317
|
for (let u = 0; u < r.length; u += 1)
|
|
@@ -357,7 +357,7 @@ function qt(e, t, n, s, i) {
|
|
|
357
357
|
}
|
|
358
358
|
}
|
|
359
359
|
}
|
|
360
|
-
function
|
|
360
|
+
function $t({ original: e, copy: t, assignedMap: n }, s, i, r, o) {
|
|
361
361
|
n.forEach((c, a) => {
|
|
362
362
|
const u = F(e, a), l = te(F(t, a)), f = c ? Y(e, a) ? b.Replace : b.Add : b.Remove;
|
|
363
363
|
if (A(u, l) && f === b.Replace)
|
|
@@ -366,7 +366,7 @@ function Qt({ original: e, copy: t, assignedMap: n }, s, i, r, o) {
|
|
|
366
366
|
i.push(f === b.Remove ? { op: f, path: p } : { op: f, path: p, value: l }), r.push(f === b.Add ? { op: b.Remove, path: p } : f === b.Remove ? { op: b.Add, path: p, value: u } : { op: b.Replace, path: p, value: u });
|
|
367
367
|
});
|
|
368
368
|
}
|
|
369
|
-
function
|
|
369
|
+
function Ht({ original: e, copy: t }, n, s, i, r) {
|
|
370
370
|
let o = 0;
|
|
371
371
|
e.forEach((c) => {
|
|
372
372
|
if (!t.has(c)) {
|
|
@@ -403,11 +403,11 @@ function X(e, t, n, s) {
|
|
|
403
403
|
switch (e.type) {
|
|
404
404
|
case 0:
|
|
405
405
|
case 2:
|
|
406
|
-
return
|
|
406
|
+
return $t(e, t, n, s, i);
|
|
407
407
|
case 1:
|
|
408
|
-
return
|
|
408
|
+
return Qt(e, t, n, s, i);
|
|
409
409
|
case 3:
|
|
410
|
-
return
|
|
410
|
+
return Ht(e, t, n, s, i);
|
|
411
411
|
}
|
|
412
412
|
}
|
|
413
413
|
const ce = (e, t, n = !1) => {
|
|
@@ -415,13 +415,13 @@ const ce = (e, t, n = !1) => {
|
|
|
415
415
|
throw new Error("Strict mode: Mutable data cannot be accessed directly, please use 'unsafe(callback)' wrap.");
|
|
416
416
|
}, we = {
|
|
417
417
|
get size() {
|
|
418
|
-
return
|
|
418
|
+
return x(h(this)).size;
|
|
419
419
|
},
|
|
420
420
|
has(e) {
|
|
421
|
-
return
|
|
421
|
+
return x(h(this)).has(e);
|
|
422
422
|
},
|
|
423
423
|
set(e, t) {
|
|
424
|
-
const n = h(this), s =
|
|
424
|
+
const n = h(this), s = x(n);
|
|
425
425
|
return (!s.has(e) || !A(s.get(e), t)) && (w(n), E(n), n.assignedMap.set(e, !0), n.copy.set(e, t), Ie(n, e, t, X)), this;
|
|
426
426
|
},
|
|
427
427
|
delete(e) {
|
|
@@ -441,13 +441,13 @@ const ce = (e, t, n = !1) => {
|
|
|
441
441
|
},
|
|
442
442
|
forEach(e, t) {
|
|
443
443
|
const n = h(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 = h(this), i =
|
|
450
|
+
const s = h(this), i = x(s).get(e), r = ((n = (t = s.options).mark) === null || n === void 0 ? void 0 : n.call(t, i, O)) === O.mutable;
|
|
451
451
|
if (s.options.strict && ce(i, s.options, r), r || s.finalized || !R(i, s.options) || i !== s.original.get(e))
|
|
452
452
|
return i;
|
|
453
453
|
const o = xe.createDraft({
|
|
@@ -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
|
|
463
|
+
return x(h(this)).keys();
|
|
464
464
|
},
|
|
465
465
|
values() {
|
|
466
466
|
const e = this.keys();
|
|
@@ -494,14 +494,14 @@ const ce = (e, t, n = !1) => {
|
|
|
494
494
|
[ee]() {
|
|
495
495
|
return this.entries();
|
|
496
496
|
}
|
|
497
|
-
},
|
|
497
|
+
}, Bt = Reflect.ownKeys(we), 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 = h(c), u = ((i = (s = e.options).mark) === null || i === void 0 ? void 0 : i.call(s, c,
|
|
504
|
+
const a = h(c), u = ((i = (s = e.options).mark) === null || i === void 0 ? void 0 : i.call(s, c, O)) === O.mutable;
|
|
505
505
|
if (e.options.strict && ce(o, e.options, u), !u && !a && R(o, e.options) && !e.finalized && e.original.has(o)) {
|
|
506
506
|
const l = xe.createDraft({
|
|
507
507
|
original: o,
|
|
@@ -605,7 +605,7 @@ Set.prototype.difference && Object.assign(ae, {
|
|
|
605
605
|
return Set.prototype.isDisjointFrom.call(new Set(this.values()), e);
|
|
606
606
|
}
|
|
607
607
|
});
|
|
608
|
-
const
|
|
608
|
+
const Ut = Reflect.ownKeys(ae), it = {
|
|
609
609
|
get(e, t, n) {
|
|
610
610
|
var s, i;
|
|
611
611
|
const r = (s = e.copy) === null || s === void 0 ? void 0 : s[t];
|
|
@@ -616,13 +616,13 @@ const Bt = Reflect.ownKeys(ae), it = {
|
|
|
616
616
|
let o;
|
|
617
617
|
if (e.options.mark) {
|
|
618
618
|
const u = t === "size" && (e.original instanceof Map || e.original instanceof Set) ? Reflect.get(e.original, t) : Reflect.get(e.original, t, n);
|
|
619
|
-
if (o = e.options.mark(u,
|
|
619
|
+
if (o = e.options.mark(u, O), o === O.mutable)
|
|
620
620
|
return e.options.strict && ce(u, e.options, !0), u;
|
|
621
621
|
}
|
|
622
|
-
const c =
|
|
623
|
-
if (c instanceof Map &&
|
|
622
|
+
const c = x(e);
|
|
623
|
+
if (c instanceof Map && Bt.includes(t))
|
|
624
624
|
return t === "size" ? Object.getOwnPropertyDescriptor(we, "size").get.call(e.proxy) : we[t].bind(e.proxy);
|
|
625
|
-
if (c instanceof Set &&
|
|
625
|
+
if (c instanceof Set && Ut.includes(t))
|
|
626
626
|
return t === "size" ? Object.getOwnPropertyDescriptor(ae, "size").get.call(e.proxy) : ae[t].bind(e.proxy);
|
|
627
627
|
if (!Y(c, t)) {
|
|
628
628
|
const u = Ae(c, t);
|
|
@@ -656,20 +656,20 @@ const Bt = Reflect.ownKeys(ae), it = {
|
|
|
656
656
|
let i;
|
|
657
657
|
if (e.type === 1 && t !== "length" && !(Number.isInteger(i = Number(t)) && i >= 0 && (t === 0 || i === 0 || String(i) === String(t))))
|
|
658
658
|
throw new Error("Only supports setting array indices and the 'length' property.");
|
|
659
|
-
const r = Ae(
|
|
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(
|
|
662
|
+
const o = pe(x(e), t), c = h(o);
|
|
663
663
|
return c && A(c.original, n) ? (e.copy[t] = n, e.assignedMap = (s = e.assignedMap) !== null && s !== void 0 ? s : /* @__PURE__ */ new Map(), e.assignedMap.set(t, !1), !0) : (A(n, o) && (n !== void 0 || Y(e.original, t)) || (w(e), E(e), Y(e.original, t) && A(n, e.original[t]) ? e.assignedMap.delete(t) : e.assignedMap.set(t, !0), e.copy[t] = n, Ie(e, t, n, X)), !0);
|
|
664
664
|
},
|
|
665
665
|
has(e, t) {
|
|
666
|
-
return t in
|
|
666
|
+
return t in x(e);
|
|
667
667
|
},
|
|
668
668
|
ownKeys(e) {
|
|
669
|
-
return Reflect.ownKeys(
|
|
669
|
+
return Reflect.ownKeys(x(e));
|
|
670
670
|
},
|
|
671
671
|
getOwnPropertyDescriptor(e, t) {
|
|
672
|
-
const n =
|
|
672
|
+
const n = x(e), s = Reflect.getOwnPropertyDescriptor(n, t);
|
|
673
673
|
return s && {
|
|
674
674
|
writable: !0,
|
|
675
675
|
configurable: e.type !== 1 || t !== "length",
|
|
@@ -692,7 +692,7 @@ const Bt = Reflect.ownKeys(ae), it = {
|
|
|
692
692
|
}
|
|
693
693
|
};
|
|
694
694
|
function Ne(e) {
|
|
695
|
-
const { original: t, parentDraft: n, key: s, finalities: i, options: r } = e, o =
|
|
695
|
+
const { original: t, parentDraft: n, key: s, finalities: i, options: r } = e, o = $(t), c = {
|
|
696
696
|
type: o,
|
|
697
697
|
finalized: !1,
|
|
698
698
|
parent: n,
|
|
@@ -710,40 +710,40 @@ function Ne(e) {
|
|
|
710
710
|
const l = n;
|
|
711
711
|
l.finalities.draft.push((f, y) => {
|
|
712
712
|
var p, I;
|
|
713
|
-
const
|
|
714
|
-
let
|
|
715
|
-
const m = F(
|
|
716
|
-
if (
|
|
717
|
-
let _ =
|
|
718
|
-
|
|
713
|
+
const H = h(a);
|
|
714
|
+
let C = l.type === 3 ? l.setMap : l.copy;
|
|
715
|
+
const m = F(C, s), S = h(m);
|
|
716
|
+
if (S) {
|
|
717
|
+
let _ = S.original;
|
|
718
|
+
S.operated && (_ = Re(m)), Se(S), ge(S, X, f, y), l.options.enableAutoFreeze && (l.options.updatedValues = (p = l.options.updatedValues) !== null && p !== void 0 ? p : /* @__PURE__ */ new WeakMap(), l.options.updatedValues.set(_, S.original)), Z(C, s, _);
|
|
719
719
|
}
|
|
720
|
-
(I =
|
|
720
|
+
(I = H.callbacks) === null || I === void 0 || I.forEach((_) => {
|
|
721
721
|
_(f, y);
|
|
722
722
|
});
|
|
723
723
|
});
|
|
724
724
|
} else {
|
|
725
725
|
const l = h(a);
|
|
726
726
|
l.finalities.draft.push((f, y) => {
|
|
727
|
-
|
|
727
|
+
Se(l), ge(l, X, f, y);
|
|
728
728
|
});
|
|
729
729
|
}
|
|
730
730
|
return a;
|
|
731
731
|
}
|
|
732
732
|
xe.createDraft = Ne;
|
|
733
|
-
function
|
|
733
|
+
function Kt(e, t, n, s, i) {
|
|
734
734
|
var r;
|
|
735
735
|
const o = h(e), c = (r = o?.original) !== null && r !== void 0 ? r : e, a = !!t.length;
|
|
736
736
|
if (o?.operated)
|
|
737
737
|
for (; o.finalities.draft.length > 0; )
|
|
738
738
|
o.finalities.draft.pop()(n, s);
|
|
739
739
|
const u = a ? t[0] : o ? o.operated ? o.copy : o.original : e;
|
|
740
|
-
return o && me(o), i &&
|
|
740
|
+
return o && me(o), i && U(u, u, o?.options.updatedValues), [
|
|
741
741
|
u,
|
|
742
742
|
n && a ? [{ op: b.Replace, path: [], value: t[0] }] : n,
|
|
743
743
|
s && a ? [{ op: b.Replace, path: [], value: c }] : s
|
|
744
744
|
];
|
|
745
745
|
}
|
|
746
|
-
function
|
|
746
|
+
function Wt(e, t) {
|
|
747
747
|
var n;
|
|
748
748
|
const s = {
|
|
749
749
|
draft: [],
|
|
@@ -753,7 +753,7 @@ function Kt(e, t) {
|
|
|
753
753
|
};
|
|
754
754
|
let i, r;
|
|
755
755
|
t.enablePatches && (i = [], r = []);
|
|
756
|
-
const c = ((n = t.mark) === null || n === void 0 ? void 0 : n.call(t, e,
|
|
756
|
+
const c = ((n = t.mark) === null || n === void 0 ? void 0 : n.call(t, e, O)) === O.mutable || !R(e, t) ? e : Ne({
|
|
757
757
|
original: e,
|
|
758
758
|
parentDraft: null,
|
|
759
759
|
finalities: s,
|
|
@@ -762,7 +762,7 @@ function Kt(e, t) {
|
|
|
762
762
|
return [
|
|
763
763
|
c,
|
|
764
764
|
(a = []) => {
|
|
765
|
-
const [u, l, f] =
|
|
765
|
+
const [u, l, f] = Kt(c, a, i, r, t.enableAutoFreeze);
|
|
766
766
|
return t.enablePatches ? [u, l, f] : u;
|
|
767
767
|
}
|
|
768
768
|
];
|
|
@@ -787,7 +787,7 @@ function rt(e) {
|
|
|
787
787
|
const n = h(e);
|
|
788
788
|
if (!R(e, n?.options))
|
|
789
789
|
return e;
|
|
790
|
-
const s =
|
|
790
|
+
const s = $(e);
|
|
791
791
|
if (n && !n.operated)
|
|
792
792
|
return n.original;
|
|
793
793
|
let i;
|
|
@@ -819,7 +819,7 @@ function De(e) {
|
|
|
819
819
|
throw new Error(`current() is only used for Draft, parameter: ${e}`);
|
|
820
820
|
return rt(e);
|
|
821
821
|
}
|
|
822
|
-
const
|
|
822
|
+
const Vt = (e) => function t(n, s, i) {
|
|
823
823
|
var r, o, c;
|
|
824
824
|
if (typeof n == "function" && typeof s != "function")
|
|
825
825
|
return function(d, ...N) {
|
|
@@ -838,19 +838,19 @@ const Wt = (e) => function t(n, s, i) {
|
|
|
838
838
|
if (L)
|
|
839
839
|
return L;
|
|
840
840
|
}
|
|
841
|
-
}) : l.mark, p = (r = l.enablePatches) !== null && r !== void 0 ? r : !1, I = (o = l.strict) !== null && o !== void 0 ? o : !1,
|
|
841
|
+
}) : l.mark, p = (r = l.enablePatches) !== null && r !== void 0 ? r : !1, I = (o = l.strict) !== null && o !== void 0 ? o : !1, C = {
|
|
842
842
|
enableAutoFreeze: (c = l.enableAutoFreeze) !== null && c !== void 0 ? c : !1,
|
|
843
843
|
mark: y,
|
|
844
844
|
strict: I,
|
|
845
845
|
enablePatches: p
|
|
846
846
|
};
|
|
847
|
-
if (!R(f,
|
|
847
|
+
if (!R(f, C) && typeof f == "object" && f !== null)
|
|
848
848
|
throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");
|
|
849
|
-
const [m,
|
|
849
|
+
const [m, S] = Wt(f, C);
|
|
850
850
|
if (typeof s != "function") {
|
|
851
|
-
if (!R(f,
|
|
851
|
+
if (!R(f, C))
|
|
852
852
|
throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");
|
|
853
|
-
return [m,
|
|
853
|
+
return [m, S];
|
|
854
854
|
}
|
|
855
855
|
let _;
|
|
856
856
|
try {
|
|
@@ -863,44 +863,44 @@ const Wt = (e) => function t(n, s, i) {
|
|
|
863
863
|
if (!T(d)) {
|
|
864
864
|
if (d !== void 0 && !A(d, m) && N?.operated)
|
|
865
865
|
throw new Error("Either the value is returned as a new non-draft value, or only the draft is modified without returning any value.");
|
|
866
|
-
const L = d?.[
|
|
866
|
+
const L = d?.[Ft];
|
|
867
867
|
if (L) {
|
|
868
|
-
const
|
|
869
|
-
return
|
|
868
|
+
const bt = L[0];
|
|
869
|
+
return C.strict && typeof d == "object" && d !== null && ve({
|
|
870
870
|
rootDraft: N,
|
|
871
871
|
value: d,
|
|
872
872
|
useRawReturn: !0
|
|
873
|
-
}),
|
|
873
|
+
}), S([bt]);
|
|
874
874
|
}
|
|
875
875
|
if (d !== void 0)
|
|
876
|
-
return typeof d == "object" && d !== null && ve({ rootDraft: N, value: d }),
|
|
876
|
+
return typeof d == "object" && d !== null && ve({ rootDraft: N, value: d }), S([d]);
|
|
877
877
|
}
|
|
878
878
|
if (d === m || d === void 0)
|
|
879
|
-
return
|
|
879
|
+
return S([]);
|
|
880
880
|
const D = h(d);
|
|
881
|
-
if (
|
|
881
|
+
if (C === D.options) {
|
|
882
882
|
if (D.operated)
|
|
883
883
|
throw new Error("Cannot return a modified child draft.");
|
|
884
|
-
return
|
|
884
|
+
return S([De(d)]);
|
|
885
885
|
}
|
|
886
|
-
return
|
|
886
|
+
return S([d]);
|
|
887
887
|
};
|
|
888
888
|
return _ instanceof Promise ? _.then(j, (d) => {
|
|
889
889
|
throw me(h(m)), d;
|
|
890
890
|
}) : j(_);
|
|
891
|
-
}, P =
|
|
891
|
+
}, P = Vt();
|
|
892
892
|
Object.prototype.constructor.toString();
|
|
893
|
-
var
|
|
894
|
-
function
|
|
895
|
-
for (var t = e.length; t-- &&
|
|
893
|
+
var Lt = /\s/;
|
|
894
|
+
function Jt(e) {
|
|
895
|
+
for (var t = e.length; t-- && Lt.test(e.charAt(t)); )
|
|
896
896
|
;
|
|
897
897
|
return t;
|
|
898
898
|
}
|
|
899
|
-
var
|
|
900
|
-
function
|
|
901
|
-
return e && e.slice(0,
|
|
899
|
+
var Yt = /^\s+/;
|
|
900
|
+
function Gt(e) {
|
|
901
|
+
return e && e.slice(0, Jt(e) + 1).replace(Yt, "");
|
|
902
902
|
}
|
|
903
|
-
var Te = NaN,
|
|
903
|
+
var Te = NaN, Xt = /^[-+]0x[0-9a-f]+$/i, Zt = /^0b[01]+$/i, kt = /^0o[0-7]+$/i, en = parseInt;
|
|
904
904
|
function ne(e) {
|
|
905
905
|
if (typeof e == "number")
|
|
906
906
|
return e;
|
|
@@ -912,25 +912,25 @@ function ne(e) {
|
|
|
912
912
|
}
|
|
913
913
|
if (typeof e != "string")
|
|
914
914
|
return e === 0 ? e : +e;
|
|
915
|
-
e =
|
|
916
|
-
var n =
|
|
917
|
-
return n ||
|
|
915
|
+
e = Gt(e);
|
|
916
|
+
var n = Zt.test(e);
|
|
917
|
+
return n || kt.test(e) ? en(e.slice(2), n ? 2 : 8) : Xt.test(e) ? Te : +e;
|
|
918
918
|
}
|
|
919
|
-
var qe = 1 / 0,
|
|
920
|
-
function
|
|
919
|
+
var qe = 1 / 0, tn = 17976931348623157e292;
|
|
920
|
+
function nn(e) {
|
|
921
921
|
if (!e)
|
|
922
922
|
return e === 0 ? e : 0;
|
|
923
923
|
if (e = ne(e), e === qe || e === -qe) {
|
|
924
924
|
var t = e < 0 ? -1 : 1;
|
|
925
|
-
return t *
|
|
925
|
+
return t * tn;
|
|
926
926
|
}
|
|
927
927
|
return e === e ? e : 0;
|
|
928
928
|
}
|
|
929
929
|
function ot(e) {
|
|
930
|
-
var t =
|
|
930
|
+
var t = nn(e), n = t % 1;
|
|
931
931
|
return t === t ? n ? t - n : t : 0;
|
|
932
932
|
}
|
|
933
|
-
function
|
|
933
|
+
function sn(e, t, n) {
|
|
934
934
|
switch (n.length) {
|
|
935
935
|
case 0:
|
|
936
936
|
return e.call(t);
|
|
@@ -943,50 +943,50 @@ function nn(e, t, n) {
|
|
|
943
943
|
}
|
|
944
944
|
return e.apply(t, n);
|
|
945
945
|
}
|
|
946
|
-
var
|
|
947
|
-
function
|
|
946
|
+
var rn = 800, on = 16, cn = Date.now;
|
|
947
|
+
function an(e) {
|
|
948
948
|
var t = 0, n = 0;
|
|
949
949
|
return function() {
|
|
950
|
-
var s =
|
|
950
|
+
var s = cn(), i = on - (s - n);
|
|
951
951
|
if (n = s, i > 0) {
|
|
952
|
-
if (++t >=
|
|
952
|
+
if (++t >= rn)
|
|
953
953
|
return arguments[0];
|
|
954
954
|
} else
|
|
955
955
|
t = 0;
|
|
956
956
|
return e.apply(void 0, arguments);
|
|
957
957
|
};
|
|
958
958
|
}
|
|
959
|
-
function
|
|
959
|
+
function un(e) {
|
|
960
960
|
return function() {
|
|
961
961
|
return e;
|
|
962
962
|
};
|
|
963
963
|
}
|
|
964
964
|
var ue = (function() {
|
|
965
965
|
try {
|
|
966
|
-
var e =
|
|
966
|
+
var e = mt(Object, "defineProperty");
|
|
967
967
|
return e({}, "", {}), e;
|
|
968
968
|
} catch {
|
|
969
969
|
}
|
|
970
|
-
})(),
|
|
970
|
+
})(), ln = ue ? function(e, t) {
|
|
971
971
|
return ue(e, "toString", {
|
|
972
972
|
configurable: !0,
|
|
973
973
|
enumerable: !1,
|
|
974
|
-
value:
|
|
974
|
+
value: un(t),
|
|
975
975
|
writable: !0
|
|
976
976
|
});
|
|
977
|
-
} : fe,
|
|
978
|
-
function
|
|
977
|
+
} : fe, fn = an(ln);
|
|
978
|
+
function hn(e, t) {
|
|
979
979
|
for (var n = -1, s = e == null ? 0 : e.length; ++n < s && t(e[n], n, e) !== !1; )
|
|
980
980
|
;
|
|
981
981
|
return e;
|
|
982
982
|
}
|
|
983
|
-
function
|
|
983
|
+
function dn(e, t, n, s) {
|
|
984
984
|
for (var i = e.length, r = n + -1; ++r < i; )
|
|
985
985
|
if (t(e[r], r, e))
|
|
986
986
|
return r;
|
|
987
987
|
return -1;
|
|
988
988
|
}
|
|
989
|
-
function
|
|
989
|
+
function pn(e, t, n) {
|
|
990
990
|
t == "__proto__" && ue ? ue(e, t, {
|
|
991
991
|
configurable: !0,
|
|
992
992
|
enumerable: !0,
|
|
@@ -994,24 +994,24 @@ function dn(e, t, n) {
|
|
|
994
994
|
writable: !0
|
|
995
995
|
}) : e[t] = n;
|
|
996
996
|
}
|
|
997
|
-
var
|
|
998
|
-
function
|
|
997
|
+
var _n = Object.prototype, yn = _n.hasOwnProperty;
|
|
998
|
+
function bn(e, t, n) {
|
|
999
999
|
var s = e[t];
|
|
1000
|
-
(!(
|
|
1000
|
+
(!(yn.call(e, t) && Je(s, n)) || n === void 0 && !(t in e)) && pn(e, t, n);
|
|
1001
1001
|
}
|
|
1002
1002
|
var Qe = Math.max;
|
|
1003
|
-
function
|
|
1003
|
+
function mn(e, t, n) {
|
|
1004
1004
|
return t = Qe(t === void 0 ? e.length - 1 : t, 0), function() {
|
|
1005
1005
|
for (var s = arguments, i = -1, r = Qe(s.length - t, 0), o = Array(r); ++i < r; )
|
|
1006
1006
|
o[i] = s[t + i];
|
|
1007
1007
|
i = -1;
|
|
1008
1008
|
for (var c = Array(t + 1); ++i < t; )
|
|
1009
1009
|
c[i] = s[i];
|
|
1010
|
-
return c[t] = n(o),
|
|
1010
|
+
return c[t] = n(o), sn(e, this, c);
|
|
1011
1011
|
};
|
|
1012
1012
|
}
|
|
1013
|
-
function
|
|
1014
|
-
return
|
|
1013
|
+
function Sn(e, t) {
|
|
1014
|
+
return fn(mn(e, t, fe), e + "");
|
|
1015
1015
|
}
|
|
1016
1016
|
function $e(e, t, n) {
|
|
1017
1017
|
if (!G(n))
|
|
@@ -1023,54 +1023,54 @@ var He = ze ? ze.isConcatSpreadable : void 0;
|
|
|
1023
1023
|
function gn(e) {
|
|
1024
1024
|
return W(e) || Ge(e) || !!(He && e && e[He]);
|
|
1025
1025
|
}
|
|
1026
|
-
function
|
|
1026
|
+
function wn(e, t, n, s, i) {
|
|
1027
1027
|
var r = -1, o = e.length;
|
|
1028
1028
|
for (n || (n = gn), i || (i = []); ++r < o; ) {
|
|
1029
1029
|
var c = e[r];
|
|
1030
|
-
n(c) ?
|
|
1030
|
+
n(c) ? St(i, c) : i[i.length] = c;
|
|
1031
1031
|
}
|
|
1032
1032
|
return i;
|
|
1033
1033
|
}
|
|
1034
|
-
function
|
|
1034
|
+
function vn(e, t, n) {
|
|
1035
1035
|
var s = -1, i = e.length;
|
|
1036
1036
|
t < 0 && (t = -t > i ? 0 : i + t), n = n > i ? i : n, n < 0 && (n += i), i = t > n ? 0 : n - t >>> 0, t >>>= 0;
|
|
1037
1037
|
for (var r = Array(i); ++s < i; )
|
|
1038
1038
|
r[s] = e[s + t];
|
|
1039
1039
|
return r;
|
|
1040
1040
|
}
|
|
1041
|
-
var
|
|
1042
|
-
function
|
|
1043
|
-
return
|
|
1041
|
+
var Cn = "\\ud800-\\udfff", Mn = "\\u0300-\\u036f", xn = "\\ufe20-\\ufe2f", On = "\\u20d0-\\u20ff", Pn = Mn + xn + On, Rn = "\\ufe0e\\ufe0f", En = "\\u200d", In = RegExp("[" + En + Cn + Pn + Rn + "]");
|
|
1042
|
+
function Nn(e) {
|
|
1043
|
+
return In.test(e);
|
|
1044
1044
|
}
|
|
1045
|
-
function
|
|
1045
|
+
function zn(e, t, n) {
|
|
1046
1046
|
return e === e && (n !== void 0 && (e = e <= n ? e : n), t !== void 0 && (e = e >= t ? e : t)), e;
|
|
1047
1047
|
}
|
|
1048
|
-
function
|
|
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 An(e, t, n) {
|
|
1049
|
+
return n === void 0 && (n = t, t = void 0), n !== void 0 && (n = ne(n), n = n === n ? n : 0), t !== void 0 && (t = ne(t), t = t === t ? t : 0), zn(ne(e), t, n);
|
|
1050
1050
|
}
|
|
1051
|
-
function
|
|
1051
|
+
function Fn(e) {
|
|
1052
1052
|
return typeof e == "function" ? e : fe;
|
|
1053
1053
|
}
|
|
1054
1054
|
function k(e, t) {
|
|
1055
|
-
var n = W(e) ?
|
|
1056
|
-
return n(e,
|
|
1055
|
+
var n = W(e) ? hn : Xe;
|
|
1056
|
+
return n(e, Fn(t));
|
|
1057
1057
|
}
|
|
1058
|
-
function
|
|
1058
|
+
function jn(e, t) {
|
|
1059
1059
|
var n = [];
|
|
1060
1060
|
return Xe(e, function(s, i, r) {
|
|
1061
1061
|
t(s, i, r) && n.push(s);
|
|
1062
1062
|
}), n;
|
|
1063
1063
|
}
|
|
1064
1064
|
function se(e, t) {
|
|
1065
|
-
var n = W(e) ? gt :
|
|
1065
|
+
var n = W(e) ? gt : jn;
|
|
1066
1066
|
return n(e, V(t));
|
|
1067
1067
|
}
|
|
1068
|
-
function
|
|
1068
|
+
function Dn(e) {
|
|
1069
1069
|
return function(t, n, s) {
|
|
1070
1070
|
var i = Object(t);
|
|
1071
1071
|
if (!he(t)) {
|
|
1072
1072
|
var r = V(n);
|
|
1073
|
-
t =
|
|
1073
|
+
t = wt(t), n = function(c) {
|
|
1074
1074
|
return r(i[c], c, i);
|
|
1075
1075
|
};
|
|
1076
1076
|
}
|
|
@@ -1078,43 +1078,43 @@ function jn(e) {
|
|
|
1078
1078
|
return o > -1 ? i[r ? t[o] : o] : void 0;
|
|
1079
1079
|
};
|
|
1080
1080
|
}
|
|
1081
|
-
var
|
|
1081
|
+
var Tn = Math.max;
|
|
1082
1082
|
function ie(e, t, n) {
|
|
1083
1083
|
var s = e == null ? 0 : e.length;
|
|
1084
1084
|
if (!s)
|
|
1085
1085
|
return -1;
|
|
1086
1086
|
var i = n == null ? 0 : ot(n);
|
|
1087
|
-
return i < 0 && (i =
|
|
1087
|
+
return i < 0 && (i = Tn(s + i, 0)), dn(e, V(t), i);
|
|
1088
1088
|
}
|
|
1089
|
-
var Be =
|
|
1090
|
-
function
|
|
1089
|
+
var Be = Dn(ie);
|
|
1090
|
+
function qn(e) {
|
|
1091
1091
|
return e && e.length ? e[0] : void 0;
|
|
1092
1092
|
}
|
|
1093
|
-
function
|
|
1093
|
+
function Qn(e, t) {
|
|
1094
1094
|
return e > t;
|
|
1095
1095
|
}
|
|
1096
|
-
var
|
|
1097
|
-
function
|
|
1098
|
-
return typeof e == "string" || !W(e) &&
|
|
1096
|
+
var $n = "[object String]";
|
|
1097
|
+
function ct(e) {
|
|
1098
|
+
return typeof e == "string" || !W(e) && vt(e) && Ct(e) == $n;
|
|
1099
1099
|
}
|
|
1100
1100
|
var Hn = "[object Map]", Bn = "[object Set]", Un = Object.prototype, Kn = Un.hasOwnProperty;
|
|
1101
1101
|
function Wn(e) {
|
|
1102
1102
|
if (e == null)
|
|
1103
1103
|
return !0;
|
|
1104
|
-
if (he(e) && (W(e) || typeof e == "string" || typeof e.splice == "function" || Mt(e) ||
|
|
1104
|
+
if (he(e) && (W(e) || typeof e == "string" || typeof e.splice == "function" || Mt(e) || xt(e) || Ge(e)))
|
|
1105
1105
|
return !e.length;
|
|
1106
1106
|
var t = Ze(e);
|
|
1107
1107
|
if (t == Hn || t == Bn)
|
|
1108
1108
|
return !e.size;
|
|
1109
|
-
if (
|
|
1109
|
+
if (Ot(e))
|
|
1110
1110
|
return !ke(e).length;
|
|
1111
1111
|
for (var n in e)
|
|
1112
1112
|
if (Kn.call(e, n))
|
|
1113
1113
|
return !1;
|
|
1114
1114
|
return !0;
|
|
1115
1115
|
}
|
|
1116
|
-
function
|
|
1117
|
-
return
|
|
1116
|
+
function at(e, t) {
|
|
1117
|
+
return Pt(e, t);
|
|
1118
1118
|
}
|
|
1119
1119
|
var Vn = Array.prototype, Ln = Vn.join;
|
|
1120
1120
|
function _e(e, t) {
|
|
@@ -1123,7 +1123,7 @@ function _e(e, t) {
|
|
|
1123
1123
|
function Jn(e, t) {
|
|
1124
1124
|
return e < t;
|
|
1125
1125
|
}
|
|
1126
|
-
function
|
|
1126
|
+
function ut(e, t, n) {
|
|
1127
1127
|
for (var s = -1, i = e.length; ++s < i; ) {
|
|
1128
1128
|
var r = e[s], o = t(r);
|
|
1129
1129
|
if (o != null && (c === void 0 ? o === o && !oe(o) : n(o, c)))
|
|
@@ -1132,24 +1132,24 @@ function at(e, t, n) {
|
|
|
1132
1132
|
return a;
|
|
1133
1133
|
}
|
|
1134
1134
|
function Ue(e, t) {
|
|
1135
|
-
return e && e.length ?
|
|
1135
|
+
return e && e.length ? ut(e, V(t), Qn) : void 0;
|
|
1136
1136
|
}
|
|
1137
1137
|
function Yn(e, t) {
|
|
1138
|
-
return e && e.length ?
|
|
1138
|
+
return e && e.length ? ut(e, V(t), Jn) : void 0;
|
|
1139
1139
|
}
|
|
1140
1140
|
function Gn(e, t, n, s) {
|
|
1141
1141
|
if (!G(e))
|
|
1142
1142
|
return e;
|
|
1143
|
-
t =
|
|
1143
|
+
t = Rt(t, e);
|
|
1144
1144
|
for (var i = -1, r = t.length, o = r - 1, c = e; c != null && ++i < r; ) {
|
|
1145
|
-
var a =
|
|
1145
|
+
var a = Et(t[i]), u = n;
|
|
1146
1146
|
if (a === "__proto__" || a === "constructor" || a === "prototype")
|
|
1147
1147
|
return e;
|
|
1148
1148
|
if (i != o) {
|
|
1149
1149
|
var l = c[a];
|
|
1150
1150
|
u = void 0, u === void 0 && (u = G(l) ? l : Ye(t[i + 1]) ? [] : {});
|
|
1151
1151
|
}
|
|
1152
|
-
|
|
1152
|
+
bn(c, a, u), c = c[a];
|
|
1153
1153
|
}
|
|
1154
1154
|
return e;
|
|
1155
1155
|
}
|
|
@@ -1184,12 +1184,12 @@ function kn(e, t, n) {
|
|
|
1184
1184
|
function es(e, t, n) {
|
|
1185
1185
|
t.length ? t = de(t, function(r) {
|
|
1186
1186
|
return W(r) ? function(o) {
|
|
1187
|
-
return
|
|
1187
|
+
return It(o, r.length === 1 ? r[0] : r);
|
|
1188
1188
|
} : r;
|
|
1189
1189
|
}) : t = [fe];
|
|
1190
1190
|
var s = -1;
|
|
1191
|
-
t = de(t,
|
|
1192
|
-
var i =
|
|
1191
|
+
t = de(t, Nt(V));
|
|
1192
|
+
var i = zt(e, function(r, o, c) {
|
|
1193
1193
|
var a = de(t, function(u) {
|
|
1194
1194
|
return u(r);
|
|
1195
1195
|
});
|
|
@@ -1199,38 +1199,38 @@ function es(e, t, n) {
|
|
|
1199
1199
|
return kn(r, o, n);
|
|
1200
1200
|
});
|
|
1201
1201
|
}
|
|
1202
|
-
var ts =
|
|
1202
|
+
var ts = At("length"), lt = "\\ud800-\\udfff", ns = "\\u0300-\\u036f", ss = "\\ufe20-\\ufe2f", is = "\\u20d0-\\u20ff", rs = ns + ss + is, os = "\\ufe0e\\ufe0f", cs = "[" + lt + "]", Ce = "[" + rs + "]", Me = "\\ud83c[\\udffb-\\udfff]", as = "(?:" + Ce + "|" + Me + ")", ft = "[^" + lt + "]", ht = "(?:\\ud83c[\\udde6-\\uddff]){2}", dt = "[\\ud800-\\udbff][\\udc00-\\udfff]", us = "\\u200d", pt = as + "?", _t = "[" + os + "]?", ls = "(?:" + us + "(?:" + [ft, ht, dt].join("|") + ")" + _t + pt + ")*", fs = _t + pt + ls, hs = "(?:" + [ft + Ce + "?", Ce, ht, dt, cs].join("|") + ")", Ke = RegExp(Me + "(?=" + Me + ")|" + hs + fs, "g");
|
|
1203
1203
|
function ds(e) {
|
|
1204
1204
|
for (var t = Ke.lastIndex = 0; Ke.test(e); )
|
|
1205
1205
|
++t;
|
|
1206
1206
|
return t;
|
|
1207
1207
|
}
|
|
1208
1208
|
function ps(e) {
|
|
1209
|
-
return
|
|
1209
|
+
return Nn(e) ? ds(e) : ts(e);
|
|
1210
1210
|
}
|
|
1211
1211
|
function _s(e, t, n) {
|
|
1212
1212
|
return e == null ? e : Gn(e, t, n);
|
|
1213
1213
|
}
|
|
1214
1214
|
var ys = "[object Map]", bs = "[object Set]";
|
|
1215
|
-
function
|
|
1215
|
+
function Q(e) {
|
|
1216
1216
|
if (e == null)
|
|
1217
1217
|
return 0;
|
|
1218
1218
|
if (he(e))
|
|
1219
|
-
return
|
|
1219
|
+
return ct(e) ? ps(e) : e.length;
|
|
1220
1220
|
var t = Ze(e);
|
|
1221
1221
|
return t == ys || t == bs ? e.size : ke(e).length;
|
|
1222
1222
|
}
|
|
1223
|
-
var re =
|
|
1223
|
+
var re = Sn(function(e, t) {
|
|
1224
1224
|
if (e == null)
|
|
1225
1225
|
return [];
|
|
1226
1226
|
var n = t.length;
|
|
1227
|
-
return n > 1 && $e(e, t[0], t[1]) ? t = [] : n > 2 && $e(t[0], t[1], t[2]) && (t = [t[0]]), es(e,
|
|
1227
|
+
return n > 1 && $e(e, t[0], t[1]) ? t = [] : n > 2 && $e(t[0], t[1], t[2]) && (t = [t[0]]), es(e, wn(t), []);
|
|
1228
1228
|
});
|
|
1229
1229
|
function ms(e, t, n) {
|
|
1230
|
-
return e && e.length ? (t = t === void 0 ? 1 : ot(t),
|
|
1230
|
+
return e && e.length ? (t = t === void 0 ? 1 : ot(t), vn(e, 0, t < 0 ? 0 : t)) : [];
|
|
1231
1231
|
}
|
|
1232
|
-
const
|
|
1233
|
-
class
|
|
1232
|
+
const Ss = (e, t) => e ? e.type === "create" && t.type === "delete" ? null : e.type === "create" && t.type === "update" ? { ...e, data: t.data } : (e.type === "update" && t.type === "update" || e.type === "update" && t.type === "delete", t) : t;
|
|
1233
|
+
class gs {
|
|
1234
1234
|
_config;
|
|
1235
1235
|
_state;
|
|
1236
1236
|
_subscribers = /* @__PURE__ */ new Set();
|
|
@@ -1247,7 +1247,7 @@ class Ss {
|
|
|
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 = Ss(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
|
}
|
|
@@ -1308,7 +1308,7 @@ class Ss {
|
|
|
1308
1308
|
async _flush() {
|
|
1309
1309
|
const { isPaused: t, isSyncing: n, queue: s } = this._state;
|
|
1310
1310
|
if (t || n || Wn(s)) return;
|
|
1311
|
-
const i = z(this._config, "batchSize", 1 / 0), r = [...s.entries()], o = ms(r, i), c = r.slice(
|
|
1311
|
+
const i = z(this._config, "batchSize", 1 / 0), r = [...s.entries()], o = ms(r, i), c = r.slice(Q(o));
|
|
1312
1312
|
this._updateState((l) => {
|
|
1313
1313
|
l.inFlight = new Map(o), l.queue = new Map(c), l.isSyncing = !0;
|
|
1314
1314
|
});
|
|
@@ -1320,7 +1320,7 @@ class Ss {
|
|
|
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 Ss {
|
|
|
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) {
|
|
@@ -1429,15 +1429,28 @@ class vs {
|
|
|
1429
1429
|
async fetch(t) {
|
|
1430
1430
|
const n = this._getCacheKey(t), s = this._cache.get(n);
|
|
1431
1431
|
if (s !== null)
|
|
1432
|
-
return this._currentContext = t, this._setState({
|
|
1432
|
+
return this._currentContext = t, this._setState({
|
|
1433
|
+
status: "idle",
|
|
1434
|
+
items: s.items,
|
|
1435
|
+
serverState: s.serverState,
|
|
1436
|
+
error: void 0,
|
|
1437
|
+
retryCount: void 0
|
|
1438
|
+
}), s;
|
|
1433
1439
|
this._abortController?.abort("New fetch request started");
|
|
1434
1440
|
const i = new AbortController();
|
|
1435
1441
|
this._abortController = i, this._currentContext = t, this._setState({ status: "fetching", error: void 0, retryCount: void 0 });
|
|
1436
1442
|
try {
|
|
1437
1443
|
const r = await this._fetchWithRetry(t, i.signal);
|
|
1438
|
-
return this._cache.set(n, r), this._abortController = null, this._setState({
|
|
1444
|
+
return this._cache.set(n, r), this._abortController = null, this._setState({
|
|
1445
|
+
status: "idle",
|
|
1446
|
+
items: r.items,
|
|
1447
|
+
serverState: r.serverState,
|
|
1448
|
+
error: void 0,
|
|
1449
|
+
retryCount: void 0
|
|
1450
|
+
}), r;
|
|
1439
1451
|
} catch (r) {
|
|
1440
|
-
if (i.signal.aborted)
|
|
1452
|
+
if (i.signal.aborted)
|
|
1453
|
+
return { items: this._state.items, serverState: this._state.serverState };
|
|
1441
1454
|
throw this._abortController = null, this._setState({
|
|
1442
1455
|
status: "error",
|
|
1443
1456
|
error: r instanceof Error ? r.message : String(r)
|
|
@@ -1488,7 +1501,7 @@ class We {
|
|
|
1488
1501
|
}
|
|
1489
1502
|
getStatus() {
|
|
1490
1503
|
const t = this._collection.getItemStatus(this._id);
|
|
1491
|
-
return
|
|
1504
|
+
return at(this._cachedStatus, t) || (this._cachedStatus = t), this._cachedStatus;
|
|
1492
1505
|
}
|
|
1493
1506
|
exists() {
|
|
1494
1507
|
return this._collection.getState().items.has(this._id);
|
|
@@ -1497,12 +1510,12 @@ class We {
|
|
|
1497
1510
|
return this._collection;
|
|
1498
1511
|
}
|
|
1499
1512
|
}
|
|
1500
|
-
const
|
|
1501
|
-
function
|
|
1513
|
+
const Cs = ".";
|
|
1514
|
+
function B(e, t) {
|
|
1502
1515
|
const n = e.lastIndexOf(t);
|
|
1503
1516
|
return n === -1 ? null : e.slice(0, n);
|
|
1504
1517
|
}
|
|
1505
|
-
function
|
|
1518
|
+
function Ms(e, t, n) {
|
|
1506
1519
|
return e.startsWith(t + n) ? !e.slice(t.length + 1).includes(n) : !1;
|
|
1507
1520
|
}
|
|
1508
1521
|
function ye(e, t, n) {
|
|
@@ -1519,7 +1532,7 @@ class Le {
|
|
|
1519
1532
|
this._collection = t, this._id = n;
|
|
1520
1533
|
}
|
|
1521
1534
|
get _separator() {
|
|
1522
|
-
return this._collection.config.nodeSeparator ??
|
|
1535
|
+
return this._collection.config.nodeSeparator ?? Cs;
|
|
1523
1536
|
}
|
|
1524
1537
|
get id() {
|
|
1525
1538
|
return this._id;
|
|
@@ -1538,7 +1551,7 @@ class Le {
|
|
|
1538
1551
|
}
|
|
1539
1552
|
getStatus() {
|
|
1540
1553
|
const t = this._collection.getItemStatus(this._id);
|
|
1541
|
-
return
|
|
1554
|
+
return at(this._cachedStatus, t) || (this._cachedStatus = t), this._cachedStatus;
|
|
1542
1555
|
}
|
|
1543
1556
|
_touch(t) {
|
|
1544
1557
|
this._collection.items.has(t) && this._collection.update(t, (n) => {
|
|
@@ -1546,12 +1559,12 @@ class Le {
|
|
|
1546
1559
|
});
|
|
1547
1560
|
}
|
|
1548
1561
|
getParent() {
|
|
1549
|
-
const t =
|
|
1562
|
+
const t = B(this._id, this._separator);
|
|
1550
1563
|
return t ? this._collection.getNode(t) : null;
|
|
1551
1564
|
}
|
|
1552
1565
|
getChildren() {
|
|
1553
1566
|
const t = [...this._collection.items.entries()], n = K(
|
|
1554
|
-
se(t, ([i]) =>
|
|
1567
|
+
se(t, ([i]) => Ms(i, this._id, this._separator)),
|
|
1555
1568
|
([i, r]) => ({ id: i, position: r.position })
|
|
1556
1569
|
), s = re(n, "position");
|
|
1557
1570
|
return K(s, (i) => this._collection.getNode(i.id));
|
|
@@ -1563,7 +1576,7 @@ class Le {
|
|
|
1563
1576
|
moveUp() {
|
|
1564
1577
|
const t = this.data;
|
|
1565
1578
|
if (!t) return;
|
|
1566
|
-
const n =
|
|
1579
|
+
const n = B(this._id, this._separator);
|
|
1567
1580
|
if (!n) return;
|
|
1568
1581
|
const i = this._collection.getNode(n).getChildren(), r = ie(i, (u) => u.id === this._id);
|
|
1569
1582
|
if (r <= 0) return;
|
|
@@ -1581,10 +1594,10 @@ class Le {
|
|
|
1581
1594
|
moveDown() {
|
|
1582
1595
|
const t = this.data;
|
|
1583
1596
|
if (!t) return;
|
|
1584
|
-
const n =
|
|
1597
|
+
const n = B(this._id, this._separator);
|
|
1585
1598
|
if (!n) return;
|
|
1586
1599
|
const i = this._collection.getNode(n).getChildren(), r = ie(i, (u) => u.id === this._id);
|
|
1587
|
-
if (r === -1 || r >=
|
|
1600
|
+
if (r === -1 || r >= Q(i) - 1) return;
|
|
1588
1601
|
const o = i[r + 1], c = o.data;
|
|
1589
1602
|
if (!c) return;
|
|
1590
1603
|
const a = t.position;
|
|
@@ -1598,11 +1611,11 @@ class Le {
|
|
|
1598
1611
|
}
|
|
1599
1612
|
setPosition(t) {
|
|
1600
1613
|
if (!this.data) return;
|
|
1601
|
-
const s =
|
|
1614
|
+
const s = B(this._id, this._separator);
|
|
1602
1615
|
if (!s) return;
|
|
1603
1616
|
const r = this._collection.getNode(s).getChildren(), o = ie(r, (l) => l.id === this._id);
|
|
1604
1617
|
if (o === -1) return;
|
|
1605
|
-
const c =
|
|
1618
|
+
const c = An(t, 0, Q(r) - 1);
|
|
1606
1619
|
if (c === o) return;
|
|
1607
1620
|
const a = [...r], [u] = a.splice(o, 1);
|
|
1608
1621
|
a.splice(c, 0, u), this._collection.batch(() => {
|
|
@@ -1636,7 +1649,7 @@ class Le {
|
|
|
1636
1649
|
move(t, n) {
|
|
1637
1650
|
const s = this.data;
|
|
1638
1651
|
if (!s) return;
|
|
1639
|
-
const i =
|
|
1652
|
+
const i = B(this._id, this._separator);
|
|
1640
1653
|
if (!i) return;
|
|
1641
1654
|
if (!n) {
|
|
1642
1655
|
const o = s.position;
|
|
@@ -1699,7 +1712,7 @@ class Le {
|
|
|
1699
1712
|
if (t.size === 0) return;
|
|
1700
1713
|
const s = [...t.keys()];
|
|
1701
1714
|
let i = Be(s, (c) => !c.includes(this._separator));
|
|
1702
|
-
if (i || (i =
|
|
1715
|
+
if (i || (i = qn(re(s, (c) => c.length))), !i) return;
|
|
1703
1716
|
const r = this._generateChildId();
|
|
1704
1717
|
let o;
|
|
1705
1718
|
if (n !== void 0)
|
|
@@ -1731,7 +1744,7 @@ class Le {
|
|
|
1731
1744
|
});
|
|
1732
1745
|
}
|
|
1733
1746
|
remove() {
|
|
1734
|
-
const t =
|
|
1747
|
+
const t = B(this._id, this._separator), n = [...this._collection.items.keys()], s = K(
|
|
1735
1748
|
se(n, (r) => ye(r, this._id, this._separator)),
|
|
1736
1749
|
(r) => r
|
|
1737
1750
|
), i = [this._id, ...s];
|
|
@@ -1744,7 +1757,7 @@ class Le {
|
|
|
1744
1757
|
this._collection.selectNode(this._id);
|
|
1745
1758
|
}
|
|
1746
1759
|
}
|
|
1747
|
-
function
|
|
1760
|
+
function yt(e) {
|
|
1748
1761
|
const t = /* @__PURE__ */ new Map();
|
|
1749
1762
|
if (e.serverItems)
|
|
1750
1763
|
for (const n of e.serverItems)
|
|
@@ -1766,23 +1779,23 @@ function _t(e) {
|
|
|
1766
1779
|
fetchError: void 0
|
|
1767
1780
|
};
|
|
1768
1781
|
}
|
|
1769
|
-
class
|
|
1782
|
+
class M {
|
|
1770
1783
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1771
1784
|
static _cache = /* @__PURE__ */ new Map();
|
|
1772
1785
|
static get(t) {
|
|
1773
|
-
const n =
|
|
1786
|
+
const n = M._cache.get(t.id);
|
|
1774
1787
|
if (n) return n;
|
|
1775
|
-
const s = new
|
|
1776
|
-
return
|
|
1788
|
+
const s = new M(t);
|
|
1789
|
+
return M._cache.set(t.id, s), s;
|
|
1777
1790
|
}
|
|
1778
1791
|
static clear(t) {
|
|
1779
|
-
|
|
1792
|
+
M._cache.get(t)?.destroy();
|
|
1780
1793
|
}
|
|
1781
1794
|
static clearAll() {
|
|
1782
|
-
|
|
1795
|
+
M._cache.forEach((t) => t.destroy());
|
|
1783
1796
|
}
|
|
1784
1797
|
static getById(t) {
|
|
1785
|
-
return
|
|
1798
|
+
return M._cache.get(t);
|
|
1786
1799
|
}
|
|
1787
1800
|
id;
|
|
1788
1801
|
config;
|
|
@@ -1798,7 +1811,10 @@ class O {
|
|
|
1798
1811
|
_batchMode = !1;
|
|
1799
1812
|
constructor(t) {
|
|
1800
1813
|
this.id = t.id, this.config = t;
|
|
1801
|
-
const n = t.handler ? (o, c) => t.handler({ query: o }, c).then((a) =>
|
|
1814
|
+
const n = t.handler ? (o, c) => t.handler({ query: o }, c).then((a) => ({
|
|
1815
|
+
items: a.items ?? [],
|
|
1816
|
+
serverState: a.serverState
|
|
1817
|
+
})) : async () => ({ items: [] }), s = t.handler ? (o, c, a) => t.handler({ changes: o }, a) : async (o) => ({
|
|
1802
1818
|
syncResults: K(o, (c) => ({
|
|
1803
1819
|
status: "success",
|
|
1804
1820
|
id: c.id,
|
|
@@ -1807,7 +1823,7 @@ class O {
|
|
|
1807
1823
|
})),
|
|
1808
1824
|
serverSyncedAt: ""
|
|
1809
1825
|
});
|
|
1810
|
-
this._syncQueue = new
|
|
1826
|
+
this._syncQueue = new gs({
|
|
1811
1827
|
debounce: t.syncDebounce ?? 300,
|
|
1812
1828
|
maxRetries: t.syncRetries ?? 3,
|
|
1813
1829
|
getContext: () => this._state.context,
|
|
@@ -1880,9 +1896,11 @@ class O {
|
|
|
1880
1896
|
}
|
|
1881
1897
|
create(t) {
|
|
1882
1898
|
const { id: n } = t;
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1899
|
+
if (ct(n) && Q(n) > 0)
|
|
1900
|
+
return this._state = P(this._state, (s) => {
|
|
1901
|
+
s.items.set(n, t);
|
|
1902
|
+
}), this._fetchHandler.invalidateCache(), this._notifySubscribers(), this._syncQueue.enqueue({ id: n, type: "create", data: t }), n;
|
|
1903
|
+
throw new Error("`id` property should exist and should be non-empty");
|
|
1886
1904
|
}
|
|
1887
1905
|
update(t, n) {
|
|
1888
1906
|
const s = this._state.items.get(t);
|
|
@@ -1954,7 +1972,7 @@ class O {
|
|
|
1954
1972
|
t ? this._syncQueue.retry(t) : this._syncQueue.retryAll();
|
|
1955
1973
|
}
|
|
1956
1974
|
destroy() {
|
|
1957
|
-
this._syncQueue.destroy(), this._fetchHandler.destroy(), this._subscribers.clear(),
|
|
1975
|
+
this._syncQueue.destroy(), this._fetchHandler.destroy(), this._subscribers.clear(), M._cache.delete(this.id);
|
|
1958
1976
|
}
|
|
1959
1977
|
async _initialFetch() {
|
|
1960
1978
|
if (!this._hasInitialized) {
|
|
@@ -1974,7 +1992,7 @@ class O {
|
|
|
1974
1992
|
_onFetchChange() {
|
|
1975
1993
|
const t = this._fetchHandler.getState();
|
|
1976
1994
|
this._state = P(this._state, (n) => {
|
|
1977
|
-
n.fetchStatus = t.status, n.fetchError = t.error, n.loading = t.status === "fetching", n.syncState = this._computeSyncState(t.status, n.syncQueue.isSyncing);
|
|
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);
|
|
1978
1996
|
const s = /* @__PURE__ */ new Map();
|
|
1979
1997
|
for (const i of t.items)
|
|
1980
1998
|
s.set(i.id, i);
|
|
@@ -1996,7 +2014,7 @@ class O {
|
|
|
1996
2014
|
}
|
|
1997
2015
|
}
|
|
1998
2016
|
function Es(e) {
|
|
1999
|
-
const t =
|
|
2017
|
+
const t = M.get(e), n = le(() => yt(e), [e.id]), s = v(
|
|
2000
2018
|
(i) => t.subscribe(i),
|
|
2001
2019
|
() => t.getState(),
|
|
2002
2020
|
() => n
|
|
@@ -2011,6 +2029,7 @@ function Es(e) {
|
|
|
2011
2029
|
syncing: s.syncing,
|
|
2012
2030
|
fetchStatus: s.fetchStatus,
|
|
2013
2031
|
fetchError: s.fetchError,
|
|
2032
|
+
serverState: s.serverState,
|
|
2014
2033
|
// Item operations
|
|
2015
2034
|
create: (i) => t.create({ ...i, id: be() }),
|
|
2016
2035
|
update: (i, r) => t.update(i, r),
|
|
@@ -2027,7 +2046,7 @@ function Es(e) {
|
|
|
2027
2046
|
};
|
|
2028
2047
|
}
|
|
2029
2048
|
function Is(e) {
|
|
2030
|
-
const t = e, n =
|
|
2049
|
+
const t = e, n = M.get(t), s = le(() => yt(t), [e.id]), i = v(
|
|
2031
2050
|
(u) => n.subscribe(u),
|
|
2032
2051
|
() => n.getState(),
|
|
2033
2052
|
() => s
|
|
@@ -2043,19 +2062,19 @@ function Is(e) {
|
|
|
2043
2062
|
(u) => n.subscribe(u),
|
|
2044
2063
|
() => n.selectedNode,
|
|
2045
2064
|
() => null
|
|
2046
|
-
), a =
|
|
2065
|
+
), a = g(() => {
|
|
2047
2066
|
const u = e.nodeSeparator ?? ".", l = (y, p) => y.startsWith(p + u) ? !y.slice(p.length + 1).includes(u) : !1, f = (y) => {
|
|
2048
2067
|
const p = i.items.get(y);
|
|
2049
2068
|
if (!p) return null;
|
|
2050
2069
|
const I = K(
|
|
2051
2070
|
se([...i.items.entries()], ([m]) => l(m, y)),
|
|
2052
|
-
([m,
|
|
2053
|
-
),
|
|
2071
|
+
([m, S]) => ({ id: m, position: S.position })
|
|
2072
|
+
), H = re(I, "position"), C = K(H, (m) => f(m.id)).filter(Boolean);
|
|
2054
2073
|
return {
|
|
2055
2074
|
id: p.id,
|
|
2056
2075
|
type: p.type,
|
|
2057
2076
|
value: p.value,
|
|
2058
|
-
...
|
|
2077
|
+
...C.length > 0 ? { children: C } : {}
|
|
2059
2078
|
};
|
|
2060
2079
|
};
|
|
2061
2080
|
return f(e.rootId);
|
|
@@ -2072,6 +2091,7 @@ function Is(e) {
|
|
|
2072
2091
|
syncing: i.syncing,
|
|
2073
2092
|
fetchStatus: i.fetchStatus,
|
|
2074
2093
|
fetchError: i.fetchError,
|
|
2094
|
+
serverState: i.serverState,
|
|
2075
2095
|
// Node operations
|
|
2076
2096
|
getNode: (u) => n.getNode(u),
|
|
2077
2097
|
getNodeStatus: (u) => n.getItemStatus(u),
|
|
@@ -2104,11 +2124,11 @@ function Ns(e) {
|
|
|
2104
2124
|
(o) => e.collection.subscribe(o),
|
|
2105
2125
|
() => e.exists(),
|
|
2106
2126
|
() => e.exists()
|
|
2107
|
-
), i =
|
|
2127
|
+
), i = g((o) => e.update(o), [e]), r = g(() => e.remove(), [e]);
|
|
2108
2128
|
return { data: t, status: n, update: i, remove: r, exists: s };
|
|
2109
2129
|
}
|
|
2110
2130
|
function xs(e) {
|
|
2111
|
-
const t =
|
|
2131
|
+
const t = g((_) => e.collection.subscribe(_), [e]), n = v(
|
|
2112
2132
|
t,
|
|
2113
2133
|
() => e.data,
|
|
2114
2134
|
() => e.data
|
|
@@ -2124,13 +2144,13 @@ function xs(e) {
|
|
|
2124
2144
|
t,
|
|
2125
2145
|
() => e.collection.selectedNodeId === e.id,
|
|
2126
2146
|
() => e.collection.selectedNodeId === e.id
|
|
2127
|
-
), o = le(() => e.getChildren(), [n, e]), c =
|
|
2147
|
+
), o = le(() => e.getChildren(), [n, e]), c = g(() => e.getParent(), [e]), a = g((_, j) => e.append(_, j), [e]), u = g((_, j) => e.prepend(_, j), [e]), l = g(
|
|
2128
2148
|
(_, j) => e.move(_, j),
|
|
2129
2149
|
[e]
|
|
2130
|
-
), f =
|
|
2150
|
+
), f = g(() => e.moveUp(), [e]), y = g(() => e.moveDown(), [e]), p = g((_) => e.setPosition(_), [e]), I = g(() => e.clone(), [e]), H = g(
|
|
2131
2151
|
(_) => e.updateProp(_),
|
|
2132
2152
|
[e]
|
|
2133
|
-
),
|
|
2153
|
+
), C = g(() => e.remove(), [e]), m = g(() => e.select(), [e]), S = g(() => e.collection.deselectNode(), [e]);
|
|
2134
2154
|
return {
|
|
2135
2155
|
isPresent: !0,
|
|
2136
2156
|
data: n,
|
|
@@ -2147,10 +2167,10 @@ function xs(e) {
|
|
|
2147
2167
|
moveDown: y,
|
|
2148
2168
|
setPosition: p,
|
|
2149
2169
|
clone: I,
|
|
2150
|
-
updateProp:
|
|
2151
|
-
remove:
|
|
2170
|
+
updateProp: H,
|
|
2171
|
+
remove: C,
|
|
2152
2172
|
select: m,
|
|
2153
|
-
deselect:
|
|
2173
|
+
deselect: S
|
|
2154
2174
|
};
|
|
2155
2175
|
}
|
|
2156
2176
|
const Os = {
|
|
@@ -2183,7 +2203,7 @@ const Os = {
|
|
|
2183
2203
|
}
|
|
2184
2204
|
};
|
|
2185
2205
|
function zs(e) {
|
|
2186
|
-
const t =
|
|
2206
|
+
const t = M.getById(e);
|
|
2187
2207
|
if (!t)
|
|
2188
2208
|
throw new Error(
|
|
2189
2209
|
`Collection with id "${e}" not found. Make sure useCrud is called first.`
|
|
@@ -2196,7 +2216,7 @@ function zs(e) {
|
|
|
2196
2216
|
return n ? i : Os;
|
|
2197
2217
|
}
|
|
2198
2218
|
function As(e) {
|
|
2199
|
-
const t =
|
|
2219
|
+
const t = M.getById(e);
|
|
2200
2220
|
if (!t)
|
|
2201
2221
|
throw new Error(
|
|
2202
2222
|
`Collection with id "${e}" not found. Make sure useCrud is called first.`
|
|
@@ -2216,23 +2236,36 @@ function As(e) {
|
|
|
2216
2236
|
isSyncing: n.syncQueue.isSyncing
|
|
2217
2237
|
};
|
|
2218
2238
|
}
|
|
2239
|
+
function Fs(e, t) {
|
|
2240
|
+
const n = M.getById(e);
|
|
2241
|
+
if (!n)
|
|
2242
|
+
throw new Error(
|
|
2243
|
+
`Collection with id "${e}" not found. Make sure useCrud is called first.`
|
|
2244
|
+
);
|
|
2245
|
+
return v(
|
|
2246
|
+
(i) => n.subscribe(i),
|
|
2247
|
+
() => n.getState(),
|
|
2248
|
+
() => n.getState()
|
|
2249
|
+
).serverState ?? t;
|
|
2250
|
+
}
|
|
2219
2251
|
export {
|
|
2220
2252
|
ws as Cache,
|
|
2221
|
-
|
|
2253
|
+
M as Collection,
|
|
2222
2254
|
vs as FetchHandler,
|
|
2223
2255
|
We as Item,
|
|
2224
2256
|
Le as Node,
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2257
|
+
gs as SyncQueue,
|
|
2258
|
+
yt as buildServerSnapshot,
|
|
2259
|
+
Ts as compareTimeIds,
|
|
2260
|
+
$s as createSyncClient,
|
|
2229
2261
|
be as getIdFromTime,
|
|
2230
|
-
|
|
2262
|
+
qs as getTimeFromId,
|
|
2231
2263
|
Es as useCrud,
|
|
2232
2264
|
Is as useCrudTree,
|
|
2233
2265
|
Ns as useItem,
|
|
2234
2266
|
xs as useNode,
|
|
2235
2267
|
zs as useSelectedNode,
|
|
2268
|
+
Fs as useServerState,
|
|
2236
2269
|
As as useSyncState
|
|
2237
2270
|
};
|
|
2238
2271
|
//# sourceMappingURL=index.js.map
|