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