use-abcd 0.0.2 → 0.1.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/dist/useCrud.d.ts +17 -9
- package/dist/useCrud.js +389 -340
- package/package.json +5 -2
package/dist/useCrud.js
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { useRef as Mt, useMemo as le, useCallback as
|
|
2
|
-
var Et = typeof global == "object" && global && global.Object === Object && global,
|
|
3
|
-
function
|
|
4
|
-
var t =
|
|
1
|
+
import { useRef as Mt, useMemo as le, useCallback as P, useSyncExternalStore as ar, useEffect as cr } from "react";
|
|
2
|
+
var Et = typeof global == "object" && global && global.Object === Object && global, fr = typeof self == "object" && self && self.Object === Object && self, F = Et || fr || Function("return this")(), B = F.Symbol, Tt = Object.prototype, ur = Tt.hasOwnProperty, lr = Tt.toString, ee = B ? B.toStringTag : void 0;
|
|
3
|
+
function pr(e) {
|
|
4
|
+
var t = ur.call(e, ee), r = e[ee];
|
|
5
5
|
try {
|
|
6
6
|
e[ee] = void 0;
|
|
7
7
|
var n = !0;
|
|
8
8
|
} catch {
|
|
9
9
|
}
|
|
10
|
-
var i =
|
|
10
|
+
var i = lr.call(e);
|
|
11
11
|
return n && (t ? e[ee] = r : delete e[ee]), i;
|
|
12
12
|
}
|
|
13
|
-
var
|
|
14
|
-
function
|
|
15
|
-
return
|
|
13
|
+
var dr = Object.prototype, hr = dr.toString;
|
|
14
|
+
function yr(e) {
|
|
15
|
+
return hr.call(e);
|
|
16
16
|
}
|
|
17
|
-
var
|
|
17
|
+
var br = "[object Null]", mr = "[object Undefined]", Qe = B ? B.toStringTag : void 0;
|
|
18
18
|
function X(e) {
|
|
19
|
-
return e == null ? e === void 0 ?
|
|
19
|
+
return e == null ? e === void 0 ? mr : br : Qe && Qe in Object(e) ? pr(e) : yr(e);
|
|
20
20
|
}
|
|
21
21
|
function W(e) {
|
|
22
22
|
return e != null && typeof e == "object";
|
|
@@ -45,17 +45,17 @@ function ie(e) {
|
|
|
45
45
|
var t = typeof e;
|
|
46
46
|
return e != null && (t == "object" || t == "function");
|
|
47
47
|
}
|
|
48
|
-
function
|
|
48
|
+
function Ct(e) {
|
|
49
49
|
return e;
|
|
50
50
|
}
|
|
51
51
|
var vr = "[object AsyncFunction]", wr = "[object Function]", _r = "[object GeneratorFunction]", Or = "[object Proxy]";
|
|
52
|
-
function
|
|
52
|
+
function xt(e) {
|
|
53
53
|
if (!ie(e))
|
|
54
54
|
return !1;
|
|
55
55
|
var t = X(e);
|
|
56
56
|
return t == wr || t == _r || t == vr || t == Or;
|
|
57
57
|
}
|
|
58
|
-
var _e =
|
|
58
|
+
var _e = F["__core-js_shared__"], tt = (function() {
|
|
59
59
|
var e = /[^.]+$/.exec(_e && _e.keys && _e.keys.IE_PROTO || "");
|
|
60
60
|
return e ? "Symbol(src)_1." + e : "";
|
|
61
61
|
})();
|
|
@@ -82,7 +82,7 @@ var Er = /[\\^$.*+?()[\]{}|]/g, Tr = /^\[object .+?Constructor\]$/, Pr = Functio
|
|
|
82
82
|
function jr(e) {
|
|
83
83
|
if (!ie(e) || Sr(e))
|
|
84
84
|
return !1;
|
|
85
|
-
var t =
|
|
85
|
+
var t = xt(e) ? $r : Tr;
|
|
86
86
|
return t.test(Y(e));
|
|
87
87
|
}
|
|
88
88
|
function Ir(e, t) {
|
|
@@ -92,7 +92,7 @@ function J(e, t) {
|
|
|
92
92
|
var r = Ir(e, t);
|
|
93
93
|
return jr(r) ? r : void 0;
|
|
94
94
|
}
|
|
95
|
-
var Me = J(
|
|
95
|
+
var Me = J(F, "WeakMap"), rt = (function() {
|
|
96
96
|
try {
|
|
97
97
|
var e = J(Object, "defineProperty");
|
|
98
98
|
return e({}, "", {}), e;
|
|
@@ -123,8 +123,8 @@ var Kr = 9007199254740991;
|
|
|
123
123
|
function Ue(e) {
|
|
124
124
|
return typeof e == "number" && e > -1 && e % 1 == 0 && e <= Kr;
|
|
125
125
|
}
|
|
126
|
-
function
|
|
127
|
-
return e != null && Ue(e.length) && !
|
|
126
|
+
function me(e) {
|
|
127
|
+
return e != null && Ue(e.length) && !xt(e);
|
|
128
128
|
}
|
|
129
129
|
var Br = Object.prototype;
|
|
130
130
|
function Gr(e) {
|
|
@@ -140,7 +140,7 @@ var Wr = "[object Arguments]";
|
|
|
140
140
|
function nt(e) {
|
|
141
141
|
return W(e) && X(e) == Wr;
|
|
142
142
|
}
|
|
143
|
-
var
|
|
143
|
+
var $t = Object.prototype, Vr = $t.hasOwnProperty, qr = $t.propertyIsEnumerable, jt = nt(/* @__PURE__ */ (function() {
|
|
144
144
|
return arguments;
|
|
145
145
|
})()) ? nt : function(e) {
|
|
146
146
|
return W(e) && Vr.call(e, "callee") && !qr.call(e, "callee");
|
|
@@ -148,26 +148,26 @@ var xt = Object.prototype, Vr = xt.hasOwnProperty, qr = xt.propertyIsEnumerable,
|
|
|
148
148
|
function Xr() {
|
|
149
149
|
return !1;
|
|
150
150
|
}
|
|
151
|
-
var
|
|
152
|
-
|
|
153
|
-
|
|
151
|
+
var It = typeof exports == "object" && exports && !exports.nodeType && exports, it = It && typeof module == "object" && module && !module.nodeType && module, Yr = it && it.exports === It, st = Yr ? F.Buffer : void 0, Jr = st ? st.isBuffer : void 0, Ee = Jr || Xr, Zr = "[object Arguments]", Qr = "[object Array]", kr = "[object Boolean]", en = "[object Date]", tn = "[object Error]", rn = "[object Function]", nn = "[object Map]", sn = "[object Number]", on = "[object Object]", an = "[object RegExp]", cn = "[object Set]", fn = "[object String]", un = "[object WeakMap]", ln = "[object ArrayBuffer]", pn = "[object DataView]", dn = "[object Float32Array]", hn = "[object Float64Array]", yn = "[object Int8Array]", bn = "[object Int16Array]", mn = "[object Int32Array]", gn = "[object Uint8Array]", vn = "[object Uint8ClampedArray]", wn = "[object Uint16Array]", _n = "[object Uint32Array]", g = {};
|
|
152
|
+
g[dn] = g[hn] = g[yn] = g[bn] = g[mn] = g[gn] = g[vn] = g[wn] = g[_n] = !0;
|
|
153
|
+
g[Zr] = g[Qr] = g[ln] = g[kr] = g[pn] = g[en] = g[tn] = g[rn] = g[nn] = g[sn] = g[on] = g[an] = g[cn] = g[fn] = g[un] = !1;
|
|
154
154
|
function On(e) {
|
|
155
|
-
return W(e) && Ue(e.length) && !!
|
|
155
|
+
return W(e) && Ue(e.length) && !!g[X(e)];
|
|
156
156
|
}
|
|
157
157
|
function Sn(e) {
|
|
158
158
|
return function(t) {
|
|
159
159
|
return e(t);
|
|
160
160
|
};
|
|
161
161
|
}
|
|
162
|
-
var
|
|
162
|
+
var zt = typeof exports == "object" && exports && !exports.nodeType && exports, re = zt && typeof module == "object" && module && !module.nodeType && module, An = re && re.exports === zt, Oe = An && Et.process, ot = (function() {
|
|
163
163
|
try {
|
|
164
164
|
var e = re && re.require && re.require("util").types;
|
|
165
165
|
return e || Oe && Oe.binding && Oe.binding("util");
|
|
166
166
|
} catch {
|
|
167
167
|
}
|
|
168
|
-
})(), at = ot && ot.isTypedArray,
|
|
168
|
+
})(), at = ot && ot.isTypedArray, Dt = at ? Sn(at) : On, Mn = Object.prototype, En = Mn.hasOwnProperty;
|
|
169
169
|
function Tn(e, t) {
|
|
170
|
-
var r = T(e), n = !r &&
|
|
170
|
+
var r = T(e), n = !r && jt(e), i = !r && !n && Ee(e), s = !r && !n && !i && Dt(e), o = r || n || i || s, c = o ? Hr(e.length, String) : [], a = c.length;
|
|
171
171
|
for (var f in e)
|
|
172
172
|
En.call(e, f) && !(o && // Safari 9 has enumerable `arguments.length` in strict mode.
|
|
173
173
|
(f == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
|
|
@@ -182,7 +182,7 @@ function Pn(e, t) {
|
|
|
182
182
|
};
|
|
183
183
|
}
|
|
184
184
|
var Rn = Pn(Object.keys, Object), Cn = Object.prototype, xn = Cn.hasOwnProperty;
|
|
185
|
-
function
|
|
185
|
+
function Ft(e) {
|
|
186
186
|
if (!Gr(e))
|
|
187
187
|
return Rn(e);
|
|
188
188
|
var t = [];
|
|
@@ -191,7 +191,7 @@ function Dt(e) {
|
|
|
191
191
|
return t;
|
|
192
192
|
}
|
|
193
193
|
function Ke(e) {
|
|
194
|
-
return
|
|
194
|
+
return me(e) ? Tn(e) : Ft(e);
|
|
195
195
|
}
|
|
196
196
|
var $n = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, jn = /^\w*$/;
|
|
197
197
|
function Be(e, t) {
|
|
@@ -242,7 +242,7 @@ V.prototype.set = Hn;
|
|
|
242
242
|
function Wn() {
|
|
243
243
|
this.__data__ = [], this.size = 0;
|
|
244
244
|
}
|
|
245
|
-
function
|
|
245
|
+
function ge(e, t) {
|
|
246
246
|
for (var r = e.length; r--; )
|
|
247
247
|
if (Ne(e[r][0], t))
|
|
248
248
|
return r;
|
|
@@ -250,40 +250,40 @@ function me(e, t) {
|
|
|
250
250
|
}
|
|
251
251
|
var Vn = Array.prototype, qn = Vn.splice;
|
|
252
252
|
function Xn(e) {
|
|
253
|
-
var t = this.__data__, r =
|
|
253
|
+
var t = this.__data__, r = ge(t, e);
|
|
254
254
|
if (r < 0)
|
|
255
255
|
return !1;
|
|
256
256
|
var n = t.length - 1;
|
|
257
257
|
return r == n ? t.pop() : qn.call(t, r, 1), --this.size, !0;
|
|
258
258
|
}
|
|
259
259
|
function Yn(e) {
|
|
260
|
-
var t = this.__data__, r =
|
|
260
|
+
var t = this.__data__, r = ge(t, e);
|
|
261
261
|
return r < 0 ? void 0 : t[r][1];
|
|
262
262
|
}
|
|
263
263
|
function Jn(e) {
|
|
264
|
-
return
|
|
264
|
+
return ge(this.__data__, e) > -1;
|
|
265
265
|
}
|
|
266
266
|
function Zn(e, t) {
|
|
267
|
-
var r = this.__data__, n =
|
|
267
|
+
var r = this.__data__, n = ge(r, e);
|
|
268
268
|
return n < 0 ? (++this.size, r.push([e, t])) : r[n][1] = t, this;
|
|
269
269
|
}
|
|
270
|
-
function
|
|
270
|
+
function L(e) {
|
|
271
271
|
var t = -1, r = e == null ? 0 : e.length;
|
|
272
272
|
for (this.clear(); ++t < r; ) {
|
|
273
273
|
var n = e[t];
|
|
274
274
|
this.set(n[0], n[1]);
|
|
275
275
|
}
|
|
276
276
|
}
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
var oe = J(
|
|
277
|
+
L.prototype.clear = Wn;
|
|
278
|
+
L.prototype.delete = Xn;
|
|
279
|
+
L.prototype.get = Yn;
|
|
280
|
+
L.prototype.has = Jn;
|
|
281
|
+
L.prototype.set = Zn;
|
|
282
|
+
var oe = J(F, "Map");
|
|
283
283
|
function Qn() {
|
|
284
284
|
this.size = 0, this.__data__ = {
|
|
285
285
|
hash: new V(),
|
|
286
|
-
map: new (oe ||
|
|
286
|
+
map: new (oe || L)(),
|
|
287
287
|
string: new V()
|
|
288
288
|
};
|
|
289
289
|
}
|
|
@@ -309,18 +309,18 @@ function ni(e, t) {
|
|
|
309
309
|
var r = ve(this, e), n = r.size;
|
|
310
310
|
return r.set(e, t), this.size += r.size == n ? 0 : 1, this;
|
|
311
311
|
}
|
|
312
|
-
function
|
|
312
|
+
function N(e) {
|
|
313
313
|
var t = -1, r = e == null ? 0 : e.length;
|
|
314
314
|
for (this.clear(); ++t < r; ) {
|
|
315
315
|
var n = e[t];
|
|
316
316
|
this.set(n[0], n[1]);
|
|
317
317
|
}
|
|
318
318
|
}
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
319
|
+
N.prototype.clear = Qn;
|
|
320
|
+
N.prototype.delete = ei;
|
|
321
|
+
N.prototype.get = ti;
|
|
322
|
+
N.prototype.has = ri;
|
|
323
|
+
N.prototype.set = ni;
|
|
324
324
|
var ii = "Expected a function";
|
|
325
325
|
function Ge(e, t) {
|
|
326
326
|
if (typeof e != "function" || t != null && typeof t != "function")
|
|
@@ -332,9 +332,9 @@ function Ge(e, t) {
|
|
|
332
332
|
var o = e.apply(this, n);
|
|
333
333
|
return r.cache = s.set(i, o) || s, o;
|
|
334
334
|
};
|
|
335
|
-
return r.cache = new (Ge.Cache ||
|
|
335
|
+
return r.cache = new (Ge.Cache || N)(), r;
|
|
336
336
|
}
|
|
337
|
-
Ge.Cache =
|
|
337
|
+
Ge.Cache = N;
|
|
338
338
|
var si = 500;
|
|
339
339
|
function oi(e) {
|
|
340
340
|
var t = Ge(e, function(n) {
|
|
@@ -360,14 +360,14 @@ function ce(e) {
|
|
|
360
360
|
var t = e + "";
|
|
361
361
|
return t == "0" && 1 / e == -1 / 0 ? "-0" : t;
|
|
362
362
|
}
|
|
363
|
-
function
|
|
363
|
+
function Lt(e, t) {
|
|
364
364
|
t = He(t, e);
|
|
365
365
|
for (var r = 0, n = t.length; e != null && r < n; )
|
|
366
366
|
e = e[ce(t[r++])];
|
|
367
367
|
return r && r == n ? e : void 0;
|
|
368
368
|
}
|
|
369
369
|
function li(e, t, r) {
|
|
370
|
-
var n = e == null ? void 0 :
|
|
370
|
+
var n = e == null ? void 0 : Lt(e, t);
|
|
371
371
|
return n === void 0 ? r : n;
|
|
372
372
|
}
|
|
373
373
|
function pi(e, t) {
|
|
@@ -375,12 +375,12 @@ function pi(e, t) {
|
|
|
375
375
|
e[i + r] = t[r];
|
|
376
376
|
return e;
|
|
377
377
|
}
|
|
378
|
-
var di = "\\ud800-\\udfff", hi = "\\u0300-\\u036f", yi = "\\ufe20-\\ufe2f", bi = "\\u20d0-\\u20ff",
|
|
378
|
+
var di = "\\ud800-\\udfff", hi = "\\u0300-\\u036f", yi = "\\ufe20-\\ufe2f", bi = "\\u20d0-\\u20ff", mi = hi + yi + bi, gi = "\\ufe0e\\ufe0f", vi = "\\u200d", wi = RegExp("[" + vi + di + mi + gi + "]");
|
|
379
379
|
function _i(e) {
|
|
380
380
|
return wi.test(e);
|
|
381
381
|
}
|
|
382
382
|
function Oi() {
|
|
383
|
-
this.__data__ = new
|
|
383
|
+
this.__data__ = new L(), this.size = 0;
|
|
384
384
|
}
|
|
385
385
|
function Si(e) {
|
|
386
386
|
var t = this.__data__, r = t.delete(e);
|
|
@@ -395,23 +395,23 @@ function Mi(e) {
|
|
|
395
395
|
var Ei = 200;
|
|
396
396
|
function Ti(e, t) {
|
|
397
397
|
var r = this.__data__;
|
|
398
|
-
if (r instanceof
|
|
398
|
+
if (r instanceof L) {
|
|
399
399
|
var n = r.__data__;
|
|
400
400
|
if (!oe || n.length < Ei - 1)
|
|
401
401
|
return n.push([e, t]), this.size = ++r.size, this;
|
|
402
|
-
r = this.__data__ = new
|
|
402
|
+
r = this.__data__ = new N(n);
|
|
403
403
|
}
|
|
404
404
|
return r.set(e, t), this.size = r.size, this;
|
|
405
405
|
}
|
|
406
|
-
function
|
|
407
|
-
var t = this.__data__ = new
|
|
406
|
+
function I(e) {
|
|
407
|
+
var t = this.__data__ = new L(e);
|
|
408
408
|
this.size = t.size;
|
|
409
409
|
}
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
410
|
+
I.prototype.clear = Oi;
|
|
411
|
+
I.prototype.delete = Si;
|
|
412
|
+
I.prototype.get = Ai;
|
|
413
|
+
I.prototype.has = Mi;
|
|
414
|
+
I.prototype.set = Ti;
|
|
415
415
|
function Pi(e, t) {
|
|
416
416
|
for (var r = -1, n = e == null ? 0 : e.length, i = 0, s = []; ++r < n; ) {
|
|
417
417
|
var o = e[r];
|
|
@@ -434,8 +434,8 @@ function ji(e, t, r) {
|
|
|
434
434
|
function ft(e) {
|
|
435
435
|
return ji(e, Ke, $i);
|
|
436
436
|
}
|
|
437
|
-
var Te = J(
|
|
438
|
-
(Te &&
|
|
437
|
+
var Te = J(F, "DataView"), Pe = J(F, "Promise"), Re = J(F, "Set"), ut = "[object Map]", Ii = "[object Object]", lt = "[object Promise]", pt = "[object Set]", dt = "[object WeakMap]", ht = "[object DataView]", zi = Y(Te), Di = Y(oe), Fi = Y(Pe), Li = Y(Re), Ni = Y(Me), j = X;
|
|
438
|
+
(Te && j(new Te(new ArrayBuffer(1))) != ht || oe && j(new oe()) != ut || Pe && j(Pe.resolve()) != lt || Re && j(new Re()) != pt || Me && j(new Me()) != dt) && (j = function(e) {
|
|
439
439
|
var t = X(e), r = t == Ii ? e.constructor : void 0, n = r ? Y(r) : "";
|
|
440
440
|
if (n)
|
|
441
441
|
switch (n) {
|
|
@@ -452,7 +452,7 @@ var Te = J(D, "DataView"), Pe = J(D, "Promise"), Re = J(D, "Set"), ut = "[object
|
|
|
452
452
|
}
|
|
453
453
|
return t;
|
|
454
454
|
});
|
|
455
|
-
var yt =
|
|
455
|
+
var yt = F.Uint8Array, Ui = "__lodash_hash_undefined__";
|
|
456
456
|
function Ki(e) {
|
|
457
457
|
return this.__data__.set(e, Ui), this;
|
|
458
458
|
}
|
|
@@ -461,12 +461,12 @@ function Bi(e) {
|
|
|
461
461
|
}
|
|
462
462
|
function he(e) {
|
|
463
463
|
var t = -1, r = e == null ? 0 : e.length;
|
|
464
|
-
for (this.__data__ = new
|
|
464
|
+
for (this.__data__ = new N(); ++t < r; )
|
|
465
465
|
this.add(e[t]);
|
|
466
466
|
}
|
|
467
467
|
he.prototype.add = he.prototype.push = Ki;
|
|
468
468
|
he.prototype.has = Bi;
|
|
469
|
-
function
|
|
469
|
+
function Nt(e, t) {
|
|
470
470
|
for (var r = -1, n = e == null ? 0 : e.length; ++r < n; )
|
|
471
471
|
if (t(e[r], r, e))
|
|
472
472
|
return !0;
|
|
@@ -476,38 +476,38 @@ function Gi(e, t) {
|
|
|
476
476
|
return e.has(t);
|
|
477
477
|
}
|
|
478
478
|
var Hi = 1, Wi = 2;
|
|
479
|
-
function
|
|
479
|
+
function Ut(e, t, r, n, i, s) {
|
|
480
480
|
var o = r & Hi, c = e.length, a = t.length;
|
|
481
481
|
if (c != a && !(o && a > c))
|
|
482
482
|
return !1;
|
|
483
483
|
var f = s.get(e), u = s.get(t);
|
|
484
484
|
if (f && u)
|
|
485
485
|
return f == t && u == e;
|
|
486
|
-
var l = -1,
|
|
486
|
+
var l = -1, y = !0, m = r & Wi ? new he() : void 0;
|
|
487
487
|
for (s.set(e, t), s.set(t, e); ++l < c; ) {
|
|
488
|
-
var
|
|
488
|
+
var p = e[l], h = t[l];
|
|
489
489
|
if (n)
|
|
490
|
-
var
|
|
491
|
-
if (
|
|
492
|
-
if (
|
|
490
|
+
var w = o ? n(h, p, l, t, e, s) : n(p, h, l, e, t, s);
|
|
491
|
+
if (w !== void 0) {
|
|
492
|
+
if (w)
|
|
493
493
|
continue;
|
|
494
|
-
|
|
494
|
+
y = !1;
|
|
495
495
|
break;
|
|
496
496
|
}
|
|
497
|
-
if (
|
|
498
|
-
if (!
|
|
499
|
-
if (!Gi(
|
|
500
|
-
return
|
|
497
|
+
if (m) {
|
|
498
|
+
if (!Nt(t, function(v, _) {
|
|
499
|
+
if (!Gi(m, _) && (p === v || i(p, v, r, n, s)))
|
|
500
|
+
return m.push(_);
|
|
501
501
|
})) {
|
|
502
|
-
|
|
502
|
+
y = !1;
|
|
503
503
|
break;
|
|
504
504
|
}
|
|
505
|
-
} else if (!(
|
|
506
|
-
|
|
505
|
+
} else if (!(p === h || i(p, h, r, n, s))) {
|
|
506
|
+
y = !1;
|
|
507
507
|
break;
|
|
508
508
|
}
|
|
509
509
|
}
|
|
510
|
-
return s.delete(e), s.delete(t),
|
|
510
|
+
return s.delete(e), s.delete(t), y;
|
|
511
511
|
}
|
|
512
512
|
function Vi(e) {
|
|
513
513
|
var t = -1, r = Array(e.size);
|
|
@@ -549,7 +549,7 @@ function as(e, t, r, n, i, s, o) {
|
|
|
549
549
|
if (f)
|
|
550
550
|
return f == t;
|
|
551
551
|
n |= Yi, o.set(e, t);
|
|
552
|
-
var u =
|
|
552
|
+
var u = Ut(c(e), c(t), n, i, s, o);
|
|
553
553
|
return o.delete(e), u;
|
|
554
554
|
case is:
|
|
555
555
|
if (Se)
|
|
@@ -563,58 +563,58 @@ function ls(e, t, r, n, i, s) {
|
|
|
563
563
|
if (a != u && !o)
|
|
564
564
|
return !1;
|
|
565
565
|
for (var l = a; l--; ) {
|
|
566
|
-
var
|
|
567
|
-
if (!(o ?
|
|
566
|
+
var y = c[l];
|
|
567
|
+
if (!(o ? y in t : us.call(t, y)))
|
|
568
568
|
return !1;
|
|
569
569
|
}
|
|
570
|
-
var
|
|
571
|
-
if (
|
|
572
|
-
return
|
|
573
|
-
var
|
|
570
|
+
var m = s.get(e), p = s.get(t);
|
|
571
|
+
if (m && p)
|
|
572
|
+
return m == t && p == e;
|
|
573
|
+
var h = !0;
|
|
574
574
|
s.set(e, t), s.set(t, e);
|
|
575
|
-
for (var
|
|
576
|
-
|
|
577
|
-
var
|
|
575
|
+
for (var w = o; ++l < a; ) {
|
|
576
|
+
y = c[l];
|
|
577
|
+
var v = e[y], _ = t[y];
|
|
578
578
|
if (n)
|
|
579
|
-
var A = o ? n(
|
|
580
|
-
if (!(A === void 0 ?
|
|
581
|
-
|
|
579
|
+
var A = o ? n(_, v, y, t, e, s) : n(v, _, y, e, t, s);
|
|
580
|
+
if (!(A === void 0 ? v === _ || i(v, _, r, n, s) : A)) {
|
|
581
|
+
h = !1;
|
|
582
582
|
break;
|
|
583
583
|
}
|
|
584
|
-
|
|
584
|
+
w || (w = y == "constructor");
|
|
585
585
|
}
|
|
586
|
-
if (
|
|
587
|
-
var G = e.constructor,
|
|
588
|
-
G !=
|
|
586
|
+
if (h && !w) {
|
|
587
|
+
var G = e.constructor, b = t.constructor;
|
|
588
|
+
G != b && "constructor" in e && "constructor" in t && !(typeof G == "function" && G instanceof G && typeof b == "function" && b instanceof b) && (h = !1);
|
|
589
589
|
}
|
|
590
|
-
return s.delete(e), s.delete(t),
|
|
590
|
+
return s.delete(e), s.delete(t), h;
|
|
591
591
|
}
|
|
592
|
-
var ps = 1,
|
|
592
|
+
var ps = 1, mt = "[object Arguments]", gt = "[object Array]", ue = "[object Object]", ds = Object.prototype, vt = ds.hasOwnProperty;
|
|
593
593
|
function hs(e, t, r, n, i, s) {
|
|
594
|
-
var o = T(e), c = T(t), a = o ?
|
|
595
|
-
a = a ==
|
|
596
|
-
var u = a == ue, l = f == ue,
|
|
597
|
-
if (
|
|
594
|
+
var o = T(e), c = T(t), a = o ? gt : j(e), f = c ? gt : j(t);
|
|
595
|
+
a = a == mt ? ue : a, f = f == mt ? ue : f;
|
|
596
|
+
var u = a == ue, l = f == ue, y = a == f;
|
|
597
|
+
if (y && Ee(e)) {
|
|
598
598
|
if (!Ee(t))
|
|
599
599
|
return !1;
|
|
600
600
|
o = !0, u = !1;
|
|
601
601
|
}
|
|
602
|
-
if (
|
|
603
|
-
return s || (s = new
|
|
602
|
+
if (y && !u)
|
|
603
|
+
return s || (s = new I()), o || Dt(e) ? Ut(e, t, r, n, i, s) : as(e, t, a, r, n, i, s);
|
|
604
604
|
if (!(r & ps)) {
|
|
605
|
-
var
|
|
606
|
-
if (
|
|
607
|
-
var
|
|
608
|
-
return s || (s = new
|
|
605
|
+
var m = u && vt.call(e, "__wrapped__"), p = l && vt.call(t, "__wrapped__");
|
|
606
|
+
if (m || p) {
|
|
607
|
+
var h = m ? e.value() : e, w = p ? t.value() : t;
|
|
608
|
+
return s || (s = new I()), i(h, w, r, n, s);
|
|
609
609
|
}
|
|
610
610
|
}
|
|
611
|
-
return
|
|
611
|
+
return y ? (s || (s = new I()), ls(e, t, r, n, i, s)) : !1;
|
|
612
612
|
}
|
|
613
613
|
function we(e, t, r, n, i) {
|
|
614
614
|
return e === t ? !0 : e == null || t == null || !W(e) && !W(t) ? e !== e && t !== t : hs(e, t, r, n, we, i);
|
|
615
615
|
}
|
|
616
616
|
var ys = 1, bs = 2;
|
|
617
|
-
function
|
|
617
|
+
function ms(e, t, r, n) {
|
|
618
618
|
var i = r.length, s = i;
|
|
619
619
|
if (e == null)
|
|
620
620
|
return !s;
|
|
@@ -630,32 +630,32 @@ function gs(e, t, r, n) {
|
|
|
630
630
|
if (a === void 0 && !(c in e))
|
|
631
631
|
return !1;
|
|
632
632
|
} else {
|
|
633
|
-
var u = new
|
|
633
|
+
var u = new I(), l;
|
|
634
634
|
if (!(l === void 0 ? we(f, a, ys | bs, n, u) : l))
|
|
635
635
|
return !1;
|
|
636
636
|
}
|
|
637
637
|
}
|
|
638
638
|
return !0;
|
|
639
639
|
}
|
|
640
|
-
function
|
|
640
|
+
function Kt(e) {
|
|
641
641
|
return e === e && !ie(e);
|
|
642
642
|
}
|
|
643
|
-
function
|
|
643
|
+
function gs(e) {
|
|
644
644
|
for (var t = Ke(e), r = t.length; r--; ) {
|
|
645
645
|
var n = t[r], i = e[n];
|
|
646
|
-
t[r] = [n, i,
|
|
646
|
+
t[r] = [n, i, Kt(i)];
|
|
647
647
|
}
|
|
648
648
|
return t;
|
|
649
649
|
}
|
|
650
|
-
function
|
|
650
|
+
function Bt(e, t) {
|
|
651
651
|
return function(r) {
|
|
652
652
|
return r == null ? !1 : r[e] === t && (t !== void 0 || e in Object(r));
|
|
653
653
|
};
|
|
654
654
|
}
|
|
655
655
|
function vs(e) {
|
|
656
|
-
var t =
|
|
657
|
-
return t.length == 1 && t[0][2] ?
|
|
658
|
-
return r === e ||
|
|
656
|
+
var t = gs(e);
|
|
657
|
+
return t.length == 1 && t[0][2] ? Bt(t[0][0], t[0][1]) : function(r) {
|
|
658
|
+
return r === e || ms(r, e, t);
|
|
659
659
|
};
|
|
660
660
|
}
|
|
661
661
|
function ws(e, t) {
|
|
@@ -669,33 +669,33 @@ function _s(e, t, r) {
|
|
|
669
669
|
break;
|
|
670
670
|
e = e[o];
|
|
671
671
|
}
|
|
672
|
-
return s || ++n != i ? s : (i = e == null ? 0 : e.length, !!i && Ue(i) && Le(o, i) && (T(e) ||
|
|
672
|
+
return s || ++n != i ? s : (i = e == null ? 0 : e.length, !!i && Ue(i) && Le(o, i) && (T(e) || jt(e)));
|
|
673
673
|
}
|
|
674
674
|
function Os(e, t) {
|
|
675
675
|
return e != null && _s(e, t, ws);
|
|
676
676
|
}
|
|
677
677
|
var Ss = 1, As = 2;
|
|
678
678
|
function Ms(e, t) {
|
|
679
|
-
return Be(e) &&
|
|
679
|
+
return Be(e) && Kt(t) ? Bt(ce(e), t) : function(r) {
|
|
680
680
|
var n = li(r, e);
|
|
681
681
|
return n === void 0 && n === t ? Os(r, e) : we(t, n, Ss | As);
|
|
682
682
|
};
|
|
683
683
|
}
|
|
684
|
-
function
|
|
684
|
+
function Gt(e) {
|
|
685
685
|
return function(t) {
|
|
686
686
|
return t?.[e];
|
|
687
687
|
};
|
|
688
688
|
}
|
|
689
689
|
function Es(e) {
|
|
690
690
|
return function(t) {
|
|
691
|
-
return
|
|
691
|
+
return Lt(t, e);
|
|
692
692
|
};
|
|
693
693
|
}
|
|
694
694
|
function Ts(e) {
|
|
695
|
-
return Be(e) ?
|
|
695
|
+
return Be(e) ? Gt(ce(e)) : Es(e);
|
|
696
696
|
}
|
|
697
|
-
function
|
|
698
|
-
return typeof e == "function" ? e : e == null ?
|
|
697
|
+
function Ht(e) {
|
|
698
|
+
return typeof e == "function" ? e : e == null ? Ct : typeof e == "object" ? T(e) ? Ms(e[0], e[1]) : vs(e) : Ts(e);
|
|
699
699
|
}
|
|
700
700
|
function Ps(e) {
|
|
701
701
|
return function(t, r, n) {
|
|
@@ -715,23 +715,23 @@ function xs(e, t) {
|
|
|
715
715
|
return function(r, n) {
|
|
716
716
|
if (r == null)
|
|
717
717
|
return r;
|
|
718
|
-
if (!
|
|
718
|
+
if (!me(r))
|
|
719
719
|
return e(r, n);
|
|
720
720
|
for (var i = r.length, s = -1, o = Object(r); ++s < i && n(o[s], s, o) !== !1; )
|
|
721
721
|
;
|
|
722
722
|
return r;
|
|
723
723
|
};
|
|
724
724
|
}
|
|
725
|
-
var
|
|
725
|
+
var Wt = xs(Cs);
|
|
726
726
|
function $s(e, t) {
|
|
727
|
-
var r = -1, n =
|
|
728
|
-
return
|
|
727
|
+
var r = -1, n = me(e) ? Array(e.length) : [];
|
|
728
|
+
return Wt(e, function(i, s, o) {
|
|
729
729
|
n[++r] = t(i, s, o);
|
|
730
730
|
}), n;
|
|
731
731
|
}
|
|
732
732
|
function js(e, t) {
|
|
733
733
|
var r = T(e) ? Pt : $s;
|
|
734
|
-
return r(e,
|
|
734
|
+
return r(e, Ht(t));
|
|
735
735
|
}
|
|
736
736
|
var Is = "[object String]";
|
|
737
737
|
function zs(e) {
|
|
@@ -756,7 +756,7 @@ function Fs(e, t, r, n) {
|
|
|
756
756
|
}
|
|
757
757
|
return e;
|
|
758
758
|
}
|
|
759
|
-
var Ls =
|
|
759
|
+
var Ls = Gt("length"), Vt = "\\ud800-\\udfff", Ns = "\\u0300-\\u036f", Us = "\\ufe20-\\ufe2f", Ks = "\\u20d0-\\u20ff", Bs = Ns + Us + Ks, Gs = "\\ufe0e\\ufe0f", Hs = "[" + Vt + "]", Ce = "[" + Bs + "]", xe = "\\ud83c[\\udffb-\\udfff]", Ws = "(?:" + Ce + "|" + xe + ")", qt = "[^" + Vt + "]", Xt = "(?:\\ud83c[\\udde6-\\uddff]){2}", Yt = "[\\ud800-\\udbff][\\udc00-\\udfff]", Vs = "\\u200d", Jt = Ws + "?", Zt = "[" + Gs + "]?", qs = "(?:" + Vs + "(?:" + [qt, Xt, Yt].join("|") + ")" + Zt + Jt + ")*", Xs = Zt + Jt + qs, Ys = "(?:" + [qt + Ce + "?", Ce, Xt, Yt, Hs].join("|") + ")", wt = RegExp(xe + "(?=" + xe + ")|" + Ys + Xs, "g");
|
|
760
760
|
function Js(e) {
|
|
761
761
|
for (var t = wt.lastIndex = 0; wt.test(e); )
|
|
762
762
|
++t;
|
|
@@ -772,26 +772,26 @@ var ks = "[object Map]", eo = "[object Set]";
|
|
|
772
772
|
function to(e) {
|
|
773
773
|
if (e == null)
|
|
774
774
|
return 0;
|
|
775
|
-
if (
|
|
775
|
+
if (me(e))
|
|
776
776
|
return zs(e) ? Zs(e) : e.length;
|
|
777
|
-
var t =
|
|
778
|
-
return t == ks || t == eo ? e.size :
|
|
777
|
+
var t = j(e);
|
|
778
|
+
return t == ks || t == eo ? e.size : Ft(e).length;
|
|
779
779
|
}
|
|
780
780
|
function ro(e, t) {
|
|
781
781
|
var r;
|
|
782
|
-
return
|
|
782
|
+
return Wt(e, function(n, i, s) {
|
|
783
783
|
return r = t(n, i, s), !r;
|
|
784
784
|
}), !!r;
|
|
785
785
|
}
|
|
786
786
|
function no(e, t, r) {
|
|
787
|
-
var n = T(e) ?
|
|
788
|
-
return n(e,
|
|
787
|
+
var n = T(e) ? Nt : ro;
|
|
788
|
+
return n(e, Ht(t));
|
|
789
789
|
}
|
|
790
|
-
const
|
|
790
|
+
const O = {
|
|
791
791
|
Remove: "remove",
|
|
792
792
|
Replace: "replace",
|
|
793
793
|
Add: "add"
|
|
794
|
-
},
|
|
794
|
+
}, Qt = Symbol.for("__MUTATIVE_PROXY_DRAFT__"), io = Symbol("__MUTATIVE_RAW_RETURN_SYMBOL__"), pe = Symbol.iterator, E = {
|
|
795
795
|
mutable: "mutable",
|
|
796
796
|
immutable: "immutable"
|
|
797
797
|
}, We = {};
|
|
@@ -823,22 +823,22 @@ function q(e) {
|
|
|
823
823
|
return !!d(e);
|
|
824
824
|
}
|
|
825
825
|
function d(e) {
|
|
826
|
-
return typeof e != "object" ? null : e?.[
|
|
826
|
+
return typeof e != "object" ? null : e?.[Qt];
|
|
827
827
|
}
|
|
828
828
|
function Xe(e) {
|
|
829
829
|
var t;
|
|
830
830
|
const r = d(e);
|
|
831
831
|
return r ? (t = r.copy) !== null && t !== void 0 ? t : r.original : e;
|
|
832
832
|
}
|
|
833
|
-
function
|
|
833
|
+
function C(e, t) {
|
|
834
834
|
if (!e || typeof e != "object")
|
|
835
835
|
return !1;
|
|
836
836
|
let r;
|
|
837
837
|
return Object.getPrototypeOf(e) === Object.prototype || Array.isArray(e) || e instanceof Map || e instanceof Set || !!t?.mark && ((r = t.mark(e, E)) === E.immutable || typeof r == "function");
|
|
838
838
|
}
|
|
839
|
-
function
|
|
839
|
+
function kt(e, t = []) {
|
|
840
840
|
if (Object.hasOwnProperty.call(e, "key")) {
|
|
841
|
-
const r = e.parent.copy, n = d(
|
|
841
|
+
const r = e.parent.copy, n = d(D(r, e.key));
|
|
842
842
|
if (n !== null && n?.original !== e.original)
|
|
843
843
|
return null;
|
|
844
844
|
const i = e.parent.type === 3, s = i ? Array.from(e.parent.setMap.keys()).indexOf(e.key) : e.key;
|
|
@@ -847,7 +847,7 @@ function Qt(e, t = []) {
|
|
|
847
847
|
t.push(s);
|
|
848
848
|
}
|
|
849
849
|
if (e.parent)
|
|
850
|
-
return
|
|
850
|
+
return kt(e.parent, t);
|
|
851
851
|
t.reverse();
|
|
852
852
|
try {
|
|
853
853
|
so(e.copy, t);
|
|
@@ -859,7 +859,7 @@ function Qt(e, t = []) {
|
|
|
859
859
|
function Z(e) {
|
|
860
860
|
return Array.isArray(e) ? 1 : e instanceof Map ? 2 : e instanceof Set ? 3 : 0;
|
|
861
861
|
}
|
|
862
|
-
function
|
|
862
|
+
function D(e, t) {
|
|
863
863
|
return Z(e) === 2 ? e.get(t) : e[t];
|
|
864
864
|
}
|
|
865
865
|
function fe(e, t, r) {
|
|
@@ -869,7 +869,7 @@ function Ae(e, t) {
|
|
|
869
869
|
const r = d(e);
|
|
870
870
|
return (r ? M(r) : e)[t];
|
|
871
871
|
}
|
|
872
|
-
function
|
|
872
|
+
function z(e, t) {
|
|
873
873
|
return e === t ? e !== 0 || 1 / e === 1 / t : e !== e && t !== t;
|
|
874
874
|
}
|
|
875
875
|
function $e(e) {
|
|
@@ -886,7 +886,7 @@ function H(e, t) {
|
|
|
886
886
|
function so(e, t) {
|
|
887
887
|
for (let r = 0; r < t.length - 1; r += 1) {
|
|
888
888
|
const n = t[r];
|
|
889
|
-
if (e =
|
|
889
|
+
if (e = D(Z(e) === 3 ? Array.from(e) : e, n), typeof e != "object")
|
|
890
890
|
throw new Error(`Cannot resolve patch at '${t.join("/")}'.`);
|
|
891
891
|
}
|
|
892
892
|
return e;
|
|
@@ -908,7 +908,7 @@ function oo(e) {
|
|
|
908
908
|
}), t;
|
|
909
909
|
}
|
|
910
910
|
const ao = Object.prototype.propertyIsEnumerable;
|
|
911
|
-
function
|
|
911
|
+
function er(e, t) {
|
|
912
912
|
let r;
|
|
913
913
|
if (Array.isArray(e))
|
|
914
914
|
return Array.prototype.concat.call(e);
|
|
@@ -943,11 +943,11 @@ function kt(e, t) {
|
|
|
943
943
|
} else
|
|
944
944
|
throw new Error("Please check mark() to ensure that it is a stable marker draftable function.");
|
|
945
945
|
}
|
|
946
|
-
function
|
|
947
|
-
e.copy || (e.copy =
|
|
946
|
+
function S(e) {
|
|
947
|
+
e.copy || (e.copy = er(e.original, e.options));
|
|
948
948
|
}
|
|
949
949
|
function te(e) {
|
|
950
|
-
if (!
|
|
950
|
+
if (!C(e))
|
|
951
951
|
return Xe(e);
|
|
952
952
|
if (Array.isArray(e))
|
|
953
953
|
return e.map(te);
|
|
@@ -978,9 +978,9 @@ function te(e) {
|
|
|
978
978
|
function de(e) {
|
|
979
979
|
return q(e) ? te(e) : e;
|
|
980
980
|
}
|
|
981
|
-
function
|
|
981
|
+
function x(e) {
|
|
982
982
|
var t;
|
|
983
|
-
e.assignedMap = (t = e.assignedMap) !== null && t !== void 0 ? t : /* @__PURE__ */ new Map(), e.operated || (e.operated = !0, e.parent &&
|
|
983
|
+
e.assignedMap = (t = e.assignedMap) !== null && t !== void 0 ? t : /* @__PURE__ */ new Map(), e.operated || (e.operated = !0, e.parent && x(e.parent));
|
|
984
984
|
}
|
|
985
985
|
function Ot() {
|
|
986
986
|
throw new Error("Cannot modify frozen object");
|
|
@@ -1044,19 +1044,19 @@ function Ye(e, t) {
|
|
|
1044
1044
|
} else
|
|
1045
1045
|
e.forEach((n, i) => t(i, n, e));
|
|
1046
1046
|
}
|
|
1047
|
-
function
|
|
1048
|
-
if (q(e) || !
|
|
1047
|
+
function tr(e, t, r) {
|
|
1048
|
+
if (q(e) || !C(e, r) || t.has(e) || Object.isFrozen(e))
|
|
1049
1049
|
return;
|
|
1050
1050
|
const n = e instanceof Set, i = n ? /* @__PURE__ */ new Map() : void 0;
|
|
1051
1051
|
if (t.add(e), Ye(e, (s, o) => {
|
|
1052
1052
|
var c;
|
|
1053
1053
|
if (q(o)) {
|
|
1054
1054
|
const a = d(o);
|
|
1055
|
-
|
|
1055
|
+
S(a);
|
|
1056
1056
|
const f = !((c = a.assignedMap) === null || c === void 0) && c.size || a.operated ? a.copy : a.original;
|
|
1057
1057
|
fe(n ? i : e, s, f);
|
|
1058
1058
|
} else
|
|
1059
|
-
|
|
1059
|
+
tr(o, t, r);
|
|
1060
1060
|
}), i) {
|
|
1061
1061
|
const s = e, o = Array.from(s);
|
|
1062
1062
|
s.clear(), o.forEach((c) => {
|
|
@@ -1066,7 +1066,7 @@ function er(e, t, r) {
|
|
|
1066
1066
|
}
|
|
1067
1067
|
function co(e, t) {
|
|
1068
1068
|
const r = e.type === 3 ? e.setMap : e.copy;
|
|
1069
|
-
e.finalities.revoke.length > 1 && e.assignedMap.get(t) && r &&
|
|
1069
|
+
e.finalities.revoke.length > 1 && e.assignedMap.get(t) && r && tr(D(r, t), e.finalities.handledSet, e.options);
|
|
1070
1070
|
}
|
|
1071
1071
|
function je(e) {
|
|
1072
1072
|
e.type === 3 && e.copy && (e.copy.clear(), e.setMap.forEach((t) => {
|
|
@@ -1076,7 +1076,7 @@ function je(e) {
|
|
|
1076
1076
|
function Ie(e, t, r, n) {
|
|
1077
1077
|
if (e.operated && e.assignedMap && e.assignedMap.size > 0 && !e.finalized) {
|
|
1078
1078
|
if (r && n) {
|
|
1079
|
-
const s =
|
|
1079
|
+
const s = kt(e);
|
|
1080
1080
|
s && t(e, s, r, n);
|
|
1081
1081
|
}
|
|
1082
1082
|
e.finalized = !0;
|
|
@@ -1087,13 +1087,13 @@ function Je(e, t, r, n) {
|
|
|
1087
1087
|
i && (i.callbacks || (i.callbacks = []), i.callbacks.push((s, o) => {
|
|
1088
1088
|
var c;
|
|
1089
1089
|
const a = e.type === 3 ? e.setMap : e.copy;
|
|
1090
|
-
if (
|
|
1090
|
+
if (z(D(a, t), r)) {
|
|
1091
1091
|
let f = i.original;
|
|
1092
1092
|
i.copy && (f = i.copy), je(e), Ie(e, n, s, o), e.options.enableAutoFreeze && (e.options.updatedValues = (c = e.options.updatedValues) !== null && c !== void 0 ? c : /* @__PURE__ */ new WeakMap(), e.options.updatedValues.set(f, i.original)), fe(a, t, f);
|
|
1093
1093
|
}
|
|
1094
|
-
}), e.options.enableAutoFreeze && i.finalities !== e.finalities && (e.options.enableAutoFreeze = !1)),
|
|
1094
|
+
}), e.options.enableAutoFreeze && i.finalities !== e.finalities && (e.options.enableAutoFreeze = !1)), C(r, e.options) && e.finalities.draft.push(() => {
|
|
1095
1095
|
const s = e.type === 3 ? e.setMap : e.copy;
|
|
1096
|
-
|
|
1096
|
+
z(D(s, t), r) && co(e, t);
|
|
1097
1097
|
});
|
|
1098
1098
|
}
|
|
1099
1099
|
function fo(e, t, r, n, i) {
|
|
@@ -1103,12 +1103,12 @@ function fo(e, t, r, n, i) {
|
|
|
1103
1103
|
if (o.get(f.toString()) && a[f] !== s[f]) {
|
|
1104
1104
|
const u = t.concat([f]), l = H(u, i);
|
|
1105
1105
|
r.push({
|
|
1106
|
-
op:
|
|
1106
|
+
op: O.Replace,
|
|
1107
1107
|
path: l,
|
|
1108
1108
|
// If it is a draft, it needs to be deep cloned, and it may also be non-draft.
|
|
1109
1109
|
value: de(a[f])
|
|
1110
1110
|
}), n.push({
|
|
1111
|
-
op:
|
|
1111
|
+
op: O.Replace,
|
|
1112
1112
|
path: l,
|
|
1113
1113
|
// If it is a draft, it needs to be deep cloned, and it may also be non-draft.
|
|
1114
1114
|
value: de(s[f])
|
|
@@ -1117,7 +1117,7 @@ function fo(e, t, r, n, i) {
|
|
|
1117
1117
|
for (let f = s.length; f < a.length; f += 1) {
|
|
1118
1118
|
const u = t.concat([f]), l = H(u, i);
|
|
1119
1119
|
r.push({
|
|
1120
|
-
op:
|
|
1120
|
+
op: O.Add,
|
|
1121
1121
|
path: l,
|
|
1122
1122
|
// If it is a draft, it needs to be deep cloned, and it may also be non-draft.
|
|
1123
1123
|
value: de(a[f])
|
|
@@ -1128,27 +1128,27 @@ function fo(e, t, r, n, i) {
|
|
|
1128
1128
|
if (f) {
|
|
1129
1129
|
const u = t.concat(["length"]), l = H(u, i);
|
|
1130
1130
|
n.push({
|
|
1131
|
-
op:
|
|
1131
|
+
op: O.Replace,
|
|
1132
1132
|
path: l,
|
|
1133
1133
|
value: s.length
|
|
1134
1134
|
});
|
|
1135
1135
|
} else
|
|
1136
1136
|
for (let u = a.length; s.length < u; u -= 1) {
|
|
1137
|
-
const l = t.concat([u - 1]),
|
|
1137
|
+
const l = t.concat([u - 1]), y = H(l, i);
|
|
1138
1138
|
n.push({
|
|
1139
|
-
op:
|
|
1140
|
-
path:
|
|
1139
|
+
op: O.Remove,
|
|
1140
|
+
path: y
|
|
1141
1141
|
});
|
|
1142
1142
|
}
|
|
1143
1143
|
}
|
|
1144
1144
|
}
|
|
1145
1145
|
function uo({ original: e, copy: t, assignedMap: r }, n, i, s, o) {
|
|
1146
1146
|
r.forEach((c, a) => {
|
|
1147
|
-
const f =
|
|
1148
|
-
if (
|
|
1147
|
+
const f = D(e, a), u = de(D(t, a)), l = c ? ne(e, a) ? O.Replace : O.Add : O.Remove;
|
|
1148
|
+
if (z(f, u) && l === O.Replace)
|
|
1149
1149
|
return;
|
|
1150
|
-
const
|
|
1151
|
-
i.push(l ===
|
|
1150
|
+
const y = n.concat(a), m = H(y, o);
|
|
1151
|
+
i.push(l === O.Remove ? { op: l, path: m } : { op: l, path: m, value: u }), s.push(l === O.Add ? { op: O.Remove, path: m } : l === O.Remove ? { op: O.Add, path: m, value: f } : { op: O.Replace, path: m, value: f });
|
|
1152
1152
|
});
|
|
1153
1153
|
}
|
|
1154
1154
|
function lo({ original: e, copy: t }, r, n, i, s) {
|
|
@@ -1157,11 +1157,11 @@ function lo({ original: e, copy: t }, r, n, i, s) {
|
|
|
1157
1157
|
if (!t.has(c)) {
|
|
1158
1158
|
const a = r.concat([o]), f = H(a, s);
|
|
1159
1159
|
n.push({
|
|
1160
|
-
op:
|
|
1160
|
+
op: O.Remove,
|
|
1161
1161
|
path: f,
|
|
1162
1162
|
value: c
|
|
1163
1163
|
}), i.unshift({
|
|
1164
|
-
op:
|
|
1164
|
+
op: O.Add,
|
|
1165
1165
|
path: f,
|
|
1166
1166
|
value: c
|
|
1167
1167
|
});
|
|
@@ -1171,11 +1171,11 @@ function lo({ original: e, copy: t }, r, n, i, s) {
|
|
|
1171
1171
|
if (!e.has(c)) {
|
|
1172
1172
|
const a = r.concat([o]), f = H(a, s);
|
|
1173
1173
|
n.push({
|
|
1174
|
-
op:
|
|
1174
|
+
op: O.Add,
|
|
1175
1175
|
path: f,
|
|
1176
1176
|
value: c
|
|
1177
1177
|
}), i.unshift({
|
|
1178
|
-
op:
|
|
1178
|
+
op: O.Remove,
|
|
1179
1179
|
path: f,
|
|
1180
1180
|
value: c
|
|
1181
1181
|
});
|
|
@@ -1196,7 +1196,7 @@ function ae(e, t, r, n) {
|
|
|
1196
1196
|
}
|
|
1197
1197
|
}
|
|
1198
1198
|
const ye = (e, t, r = !1) => {
|
|
1199
|
-
if (typeof e == "object" && e !== null && (!
|
|
1199
|
+
if (typeof e == "object" && e !== null && (!C(e, t) || r))
|
|
1200
1200
|
throw new Error("Strict mode: Mutable data cannot be accessed directly, please use 'unsafe(callback)' wrap.");
|
|
1201
1201
|
}, ze = {
|
|
1202
1202
|
get size() {
|
|
@@ -1207,18 +1207,18 @@ const ye = (e, t, r = !1) => {
|
|
|
1207
1207
|
},
|
|
1208
1208
|
set(e, t) {
|
|
1209
1209
|
const r = d(this), n = M(r);
|
|
1210
|
-
return (!n.has(e) || !
|
|
1210
|
+
return (!n.has(e) || !z(n.get(e), t)) && (S(r), x(r), r.assignedMap.set(e, !0), r.copy.set(e, t), Je(r, e, t, ae)), this;
|
|
1211
1211
|
},
|
|
1212
1212
|
delete(e) {
|
|
1213
1213
|
if (!this.has(e))
|
|
1214
1214
|
return !1;
|
|
1215
1215
|
const t = d(this);
|
|
1216
|
-
return
|
|
1216
|
+
return S(t), x(t), t.original.has(e) ? t.assignedMap.set(e, !1) : t.assignedMap.delete(e), t.copy.delete(e), !0;
|
|
1217
1217
|
},
|
|
1218
1218
|
clear() {
|
|
1219
1219
|
const e = d(this);
|
|
1220
1220
|
if (this.size) {
|
|
1221
|
-
|
|
1221
|
+
S(e), x(e), e.assignedMap = /* @__PURE__ */ new Map();
|
|
1222
1222
|
for (const [t] of e.original)
|
|
1223
1223
|
e.assignedMap.set(t, !1);
|
|
1224
1224
|
e.copy.clear();
|
|
@@ -1233,7 +1233,7 @@ const ye = (e, t, r = !1) => {
|
|
|
1233
1233
|
get(e) {
|
|
1234
1234
|
var t, r;
|
|
1235
1235
|
const n = d(this), i = M(n).get(e), s = ((r = (t = n.options).mark) === null || r === void 0 ? void 0 : r.call(t, i, E)) === E.mutable;
|
|
1236
|
-
if (n.options.strict && ye(i, n.options, s), s || n.finalized || !
|
|
1236
|
+
if (n.options.strict && ye(i, n.options, s), s || n.finalized || !C(i, n.options) || i !== n.original.get(e))
|
|
1237
1237
|
return i;
|
|
1238
1238
|
const o = We.createDraft({
|
|
1239
1239
|
original: i,
|
|
@@ -1242,7 +1242,7 @@ const ye = (e, t, r = !1) => {
|
|
|
1242
1242
|
finalities: n.finalities,
|
|
1243
1243
|
options: n.options
|
|
1244
1244
|
});
|
|
1245
|
-
return
|
|
1245
|
+
return S(n), n.copy.set(e, o), o;
|
|
1246
1246
|
},
|
|
1247
1247
|
keys() {
|
|
1248
1248
|
return M(d(this)).keys();
|
|
@@ -1287,7 +1287,7 @@ const ye = (e, t, r = !1) => {
|
|
|
1287
1287
|
const o = s.value;
|
|
1288
1288
|
let c = e.setMap.get(o);
|
|
1289
1289
|
const a = d(c), f = ((i = (n = e.options).mark) === null || i === void 0 ? void 0 : i.call(n, c, E)) === E.mutable;
|
|
1290
|
-
if (e.options.strict && ye(o, e.options, f), !f && !a &&
|
|
1290
|
+
if (e.options.strict && ye(o, e.options, f), !f && !a && C(o, e.options) && !e.finalized && e.original.has(o)) {
|
|
1291
1291
|
const u = We.createDraft({
|
|
1292
1292
|
original: o,
|
|
1293
1293
|
parentDraft: e,
|
|
@@ -1309,19 +1309,19 @@ const ye = (e, t, r = !1) => {
|
|
|
1309
1309
|
const t = d(this);
|
|
1310
1310
|
if (t.setMap.has(e))
|
|
1311
1311
|
return !0;
|
|
1312
|
-
|
|
1312
|
+
S(t);
|
|
1313
1313
|
const r = d(e);
|
|
1314
1314
|
return !!(r && t.setMap.has(r.original));
|
|
1315
1315
|
},
|
|
1316
1316
|
add(e) {
|
|
1317
1317
|
const t = d(this);
|
|
1318
|
-
return this.has(e) || (
|
|
1318
|
+
return this.has(e) || (S(t), x(t), t.assignedMap.set(e, !0), t.setMap.set(e, e), Je(t, e, e, ae)), this;
|
|
1319
1319
|
},
|
|
1320
1320
|
delete(e) {
|
|
1321
1321
|
if (!this.has(e))
|
|
1322
1322
|
return !1;
|
|
1323
1323
|
const t = d(this);
|
|
1324
|
-
|
|
1324
|
+
S(t), x(t);
|
|
1325
1325
|
const r = d(e);
|
|
1326
1326
|
return r && t.setMap.has(r.original) ? (t.assignedMap.set(r.original, !1), t.setMap.delete(r.original)) : (!r && t.setMap.has(e) ? t.assignedMap.set(e, !1) : t.assignedMap.delete(e), t.setMap.delete(e));
|
|
1327
1327
|
},
|
|
@@ -1329,14 +1329,14 @@ const ye = (e, t, r = !1) => {
|
|
|
1329
1329
|
if (!this.size)
|
|
1330
1330
|
return;
|
|
1331
1331
|
const e = d(this);
|
|
1332
|
-
|
|
1332
|
+
S(e), x(e);
|
|
1333
1333
|
for (const t of e.original)
|
|
1334
1334
|
e.assignedMap.set(t, !1);
|
|
1335
1335
|
e.setMap.clear();
|
|
1336
1336
|
},
|
|
1337
1337
|
values() {
|
|
1338
1338
|
const e = d(this);
|
|
1339
|
-
|
|
1339
|
+
S(e);
|
|
1340
1340
|
const t = e.setMap.keys();
|
|
1341
1341
|
return {
|
|
1342
1342
|
[Symbol.iterator]: () => this.values(),
|
|
@@ -1345,7 +1345,7 @@ const ye = (e, t, r = !1) => {
|
|
|
1345
1345
|
},
|
|
1346
1346
|
entries() {
|
|
1347
1347
|
const e = d(this);
|
|
1348
|
-
|
|
1348
|
+
S(e);
|
|
1349
1349
|
const t = e.setMap.keys();
|
|
1350
1350
|
return {
|
|
1351
1351
|
[Symbol.iterator]: () => this.entries(),
|
|
@@ -1390,13 +1390,13 @@ Set.prototype.difference && Object.assign(be, {
|
|
|
1390
1390
|
return Set.prototype.isDisjointFrom.call(new Set(this.values()), e);
|
|
1391
1391
|
}
|
|
1392
1392
|
});
|
|
1393
|
-
const ho = Reflect.ownKeys(be),
|
|
1393
|
+
const ho = Reflect.ownKeys(be), rr = /* @__PURE__ */ new WeakSet(), nr = {
|
|
1394
1394
|
get(e, t, r) {
|
|
1395
1395
|
var n, i;
|
|
1396
1396
|
const s = (n = e.copy) === null || n === void 0 ? void 0 : n[t];
|
|
1397
|
-
if (s &&
|
|
1397
|
+
if (s && rr.has(s))
|
|
1398
1398
|
return s;
|
|
1399
|
-
if (t ===
|
|
1399
|
+
if (t === Qt)
|
|
1400
1400
|
return e;
|
|
1401
1401
|
let o;
|
|
1402
1402
|
if (e.options.mark) {
|
|
@@ -1427,10 +1427,10 @@ const ho = Reflect.ownKeys(be), tr = /* @__PURE__ */ new WeakSet(), rr = {
|
|
|
1427
1427
|
) : void 0;
|
|
1428
1428
|
}
|
|
1429
1429
|
const a = c[t];
|
|
1430
|
-
if (e.options.strict && ye(a, e.options), e.finalized || !
|
|
1430
|
+
if (e.options.strict && ye(a, e.options), e.finalized || !C(a, e.options))
|
|
1431
1431
|
return a;
|
|
1432
1432
|
if (a === Ae(e.original, t)) {
|
|
1433
|
-
if (
|
|
1433
|
+
if (S(e), e.copy[t] = Ze({
|
|
1434
1434
|
original: e.original[t],
|
|
1435
1435
|
parentDraft: e,
|
|
1436
1436
|
key: e.type === 1 ? Number(t) : t,
|
|
@@ -1438,7 +1438,7 @@ const ho = Reflect.ownKeys(be), tr = /* @__PURE__ */ new WeakSet(), rr = {
|
|
|
1438
1438
|
options: e.options
|
|
1439
1439
|
}), typeof o == "function") {
|
|
1440
1440
|
const f = d(e.copy[t]);
|
|
1441
|
-
return
|
|
1441
|
+
return S(f), x(f), f.copy;
|
|
1442
1442
|
}
|
|
1443
1443
|
return e.copy[t];
|
|
1444
1444
|
}
|
|
@@ -1455,7 +1455,7 @@ const ho = Reflect.ownKeys(be), tr = /* @__PURE__ */ new WeakSet(), rr = {
|
|
|
1455
1455
|
if (s?.set)
|
|
1456
1456
|
return s.set.call(e.proxy, r), !0;
|
|
1457
1457
|
const o = Ae(M(e), t), c = d(o);
|
|
1458
|
-
return c &&
|
|
1458
|
+
return c && z(c.original, r) ? (e.copy[t] = r, e.assignedMap = (n = e.assignedMap) !== null && n !== void 0 ? n : /* @__PURE__ */ new Map(), e.assignedMap.set(t, !1), !0) : (z(r, o) && (r !== void 0 || ne(e.original, t)) || (S(e), x(e), ne(e.original, t) && z(r, e.original[t]) ? e.assignedMap.delete(t) : e.assignedMap.set(t, !0), e.copy[t] = r, Je(e, t, r, ae)), !0);
|
|
1459
1459
|
},
|
|
1460
1460
|
has(e, t) {
|
|
1461
1461
|
return t in M(e);
|
|
@@ -1483,7 +1483,7 @@ const ho = Reflect.ownKeys(be), tr = /* @__PURE__ */ new WeakSet(), rr = {
|
|
|
1483
1483
|
},
|
|
1484
1484
|
deleteProperty(e, t) {
|
|
1485
1485
|
var r;
|
|
1486
|
-
return e.type === 1 ?
|
|
1486
|
+
return e.type === 1 ? nr.set.call(this, e, t, void 0, e.proxy) : (Ae(e.original, t) !== void 0 || t in e.original ? (S(e), x(e), e.assignedMap.set(t, !1)) : (e.assignedMap = (r = e.assignedMap) !== null && r !== void 0 ? r : /* @__PURE__ */ new Map(), e.assignedMap.delete(t)), e.copy && delete e.copy[t], !0);
|
|
1487
1487
|
}
|
|
1488
1488
|
};
|
|
1489
1489
|
function Ze(e) {
|
|
@@ -1500,26 +1500,26 @@ function Ze(e) {
|
|
|
1500
1500
|
setMap: o === 3 ? new Map(t.entries()) : void 0
|
|
1501
1501
|
};
|
|
1502
1502
|
(n || "key" in e) && (c.key = n);
|
|
1503
|
-
const { proxy: a, revoke: f } = Proxy.revocable(o === 1 ? Object.assign([], c) : c,
|
|
1504
|
-
if (i.revoke.push(f),
|
|
1503
|
+
const { proxy: a, revoke: f } = Proxy.revocable(o === 1 ? Object.assign([], c) : c, nr);
|
|
1504
|
+
if (i.revoke.push(f), rr.add(a), c.proxy = a, r) {
|
|
1505
1505
|
const u = r;
|
|
1506
|
-
u.finalities.draft.push((l,
|
|
1507
|
-
var
|
|
1508
|
-
const
|
|
1509
|
-
let
|
|
1510
|
-
const
|
|
1511
|
-
if (
|
|
1512
|
-
let A =
|
|
1513
|
-
|
|
1506
|
+
u.finalities.draft.push((l, y) => {
|
|
1507
|
+
var m, p;
|
|
1508
|
+
const h = d(a);
|
|
1509
|
+
let w = u.type === 3 ? u.setMap : u.copy;
|
|
1510
|
+
const v = D(w, n), _ = d(v);
|
|
1511
|
+
if (_) {
|
|
1512
|
+
let A = _.original;
|
|
1513
|
+
_.operated && (A = Xe(v)), je(_), Ie(_, ae, l, y), u.options.enableAutoFreeze && (u.options.updatedValues = (m = u.options.updatedValues) !== null && m !== void 0 ? m : /* @__PURE__ */ new WeakMap(), u.options.updatedValues.set(A, _.original)), fe(w, n, A);
|
|
1514
1514
|
}
|
|
1515
|
-
(
|
|
1516
|
-
A(l,
|
|
1515
|
+
(p = h.callbacks) === null || p === void 0 || p.forEach((A) => {
|
|
1516
|
+
A(l, y);
|
|
1517
1517
|
});
|
|
1518
1518
|
});
|
|
1519
1519
|
} else {
|
|
1520
1520
|
const u = d(a);
|
|
1521
|
-
u.finalities.draft.push((l,
|
|
1522
|
-
je(u), Ie(u, ae, l,
|
|
1521
|
+
u.finalities.draft.push((l, y) => {
|
|
1522
|
+
je(u), Ie(u, ae, l, y);
|
|
1523
1523
|
});
|
|
1524
1524
|
}
|
|
1525
1525
|
return a;
|
|
@@ -1534,8 +1534,8 @@ function yo(e, t, r, n, i) {
|
|
|
1534
1534
|
const f = a ? t[0] : o ? o.operated ? o.copy : o.original : e;
|
|
1535
1535
|
return o && $e(o), i && Q(f, f, o?.options.updatedValues), [
|
|
1536
1536
|
f,
|
|
1537
|
-
r && a ? [{ op:
|
|
1538
|
-
n && a ? [{ op:
|
|
1537
|
+
r && a ? [{ op: O.Replace, path: [], value: t[0] }] : r,
|
|
1538
|
+
n && a ? [{ op: O.Replace, path: [], value: c }] : n
|
|
1539
1539
|
];
|
|
1540
1540
|
}
|
|
1541
1541
|
function bo(e, t) {
|
|
@@ -1547,7 +1547,7 @@ function bo(e, t) {
|
|
|
1547
1547
|
};
|
|
1548
1548
|
let i, s;
|
|
1549
1549
|
t.enablePatches && (i = [], s = []);
|
|
1550
|
-
const c = ((r = t.mark) === null || r === void 0 ? void 0 : r.call(t, e, E)) === E.mutable || !
|
|
1550
|
+
const c = ((r = t.mark) === null || r === void 0 ? void 0 : r.call(t, e, E)) === E.mutable || !C(e, t) ? e : Ze({
|
|
1551
1551
|
original: e,
|
|
1552
1552
|
parentDraft: null,
|
|
1553
1553
|
finalities: n,
|
|
@@ -1576,17 +1576,17 @@ function De(e) {
|
|
|
1576
1576
|
} else typeof o == "object" && o !== null && (e.value = o, e.isRoot = !1, De(e));
|
|
1577
1577
|
}), i && (e.isContainDraft || console.warn("The return value does not contain any draft, please use 'rawReturn()' to wrap the return value to improve performance."), n && console.warn("The return value contains drafts, please don't use 'rawReturn()' to wrap the return value."));
|
|
1578
1578
|
}
|
|
1579
|
-
function
|
|
1579
|
+
function ir(e) {
|
|
1580
1580
|
var t;
|
|
1581
1581
|
const r = d(e);
|
|
1582
|
-
if (!
|
|
1582
|
+
if (!C(e, r?.options))
|
|
1583
1583
|
return e;
|
|
1584
1584
|
const n = Z(e);
|
|
1585
1585
|
if (r && !r.operated)
|
|
1586
1586
|
return r.original;
|
|
1587
1587
|
let i;
|
|
1588
1588
|
function s() {
|
|
1589
|
-
i = n === 2 ? qe(e) ? new Map(e) : new (Object.getPrototypeOf(e)).constructor(e) : n === 3 ? Array.from(r.setMap.values()) :
|
|
1589
|
+
i = n === 2 ? qe(e) ? new Map(e) : new (Object.getPrototypeOf(e)).constructor(e) : n === 3 ? Array.from(r.setMap.values()) : er(e, r?.options);
|
|
1590
1590
|
}
|
|
1591
1591
|
if (r) {
|
|
1592
1592
|
r.finalized = !0;
|
|
@@ -1598,9 +1598,9 @@ function nr(e) {
|
|
|
1598
1598
|
} else
|
|
1599
1599
|
i = e;
|
|
1600
1600
|
if (Ye(i, (o, c) => {
|
|
1601
|
-
if (r &&
|
|
1601
|
+
if (r && z(D(r.original, o), c))
|
|
1602
1602
|
return;
|
|
1603
|
-
const a =
|
|
1603
|
+
const a = ir(c);
|
|
1604
1604
|
a !== c && (i === e && s(), fe(i, o, a));
|
|
1605
1605
|
}), n === 3) {
|
|
1606
1606
|
const o = (t = r?.original) !== null && t !== void 0 ? t : i;
|
|
@@ -1611,84 +1611,84 @@ function nr(e) {
|
|
|
1611
1611
|
function At(e) {
|
|
1612
1612
|
if (!q(e))
|
|
1613
1613
|
throw new Error(`current() is only used for Draft, parameter: ${e}`);
|
|
1614
|
-
return
|
|
1614
|
+
return ir(e);
|
|
1615
1615
|
}
|
|
1616
|
-
const
|
|
1616
|
+
const mo = (e) => function t(r, n, i) {
|
|
1617
1617
|
var s, o, c;
|
|
1618
1618
|
if (typeof r == "function" && typeof n != "function")
|
|
1619
|
-
return function(
|
|
1620
|
-
return t(
|
|
1619
|
+
return function(b, ...$) {
|
|
1620
|
+
return t(b, (U) => r.call(this, U, ...$), n);
|
|
1621
1621
|
};
|
|
1622
1622
|
const a = r, f = n;
|
|
1623
1623
|
let u = i;
|
|
1624
1624
|
if (typeof n != "function" && (u = n), u !== void 0 && Object.prototype.toString.call(u) !== "[object Object]")
|
|
1625
1625
|
throw new Error(`Invalid options: ${u}, 'options' should be an object.`);
|
|
1626
1626
|
u = Object.assign(Object.assign({}, e), u);
|
|
1627
|
-
const l = q(a) ? At(a) : a,
|
|
1628
|
-
for (const
|
|
1629
|
-
if (typeof
|
|
1630
|
-
throw new Error(`Invalid mark: ${
|
|
1631
|
-
const k =
|
|
1627
|
+
const l = q(a) ? At(a) : a, y = Array.isArray(u.mark) ? ((b, $) => {
|
|
1628
|
+
for (const U of u.mark) {
|
|
1629
|
+
if (typeof U != "function")
|
|
1630
|
+
throw new Error(`Invalid mark: ${U}, 'mark' should be a function.`);
|
|
1631
|
+
const k = U(b, $);
|
|
1632
1632
|
if (k)
|
|
1633
1633
|
return k;
|
|
1634
1634
|
}
|
|
1635
|
-
}) : u.mark,
|
|
1635
|
+
}) : u.mark, m = (s = u.enablePatches) !== null && s !== void 0 ? s : !1, p = (o = u.strict) !== null && o !== void 0 ? o : !1, w = {
|
|
1636
1636
|
enableAutoFreeze: (c = u.enableAutoFreeze) !== null && c !== void 0 ? c : !1,
|
|
1637
|
-
mark:
|
|
1638
|
-
strict:
|
|
1639
|
-
enablePatches:
|
|
1637
|
+
mark: y,
|
|
1638
|
+
strict: p,
|
|
1639
|
+
enablePatches: m
|
|
1640
1640
|
};
|
|
1641
|
-
if (!
|
|
1641
|
+
if (!C(l, w) && typeof l == "object" && l !== null)
|
|
1642
1642
|
throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");
|
|
1643
|
-
const [
|
|
1643
|
+
const [v, _] = bo(l, w);
|
|
1644
1644
|
if (typeof n != "function") {
|
|
1645
|
-
if (!
|
|
1645
|
+
if (!C(l, w))
|
|
1646
1646
|
throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");
|
|
1647
|
-
return [
|
|
1647
|
+
return [v, _];
|
|
1648
1648
|
}
|
|
1649
1649
|
let A;
|
|
1650
1650
|
try {
|
|
1651
|
-
A = f(
|
|
1652
|
-
} catch (
|
|
1653
|
-
throw $e(d(
|
|
1651
|
+
A = f(v);
|
|
1652
|
+
} catch (b) {
|
|
1653
|
+
throw $e(d(v)), b;
|
|
1654
1654
|
}
|
|
1655
|
-
const G = (
|
|
1656
|
-
const
|
|
1657
|
-
if (!q(
|
|
1658
|
-
if (
|
|
1655
|
+
const G = (b) => {
|
|
1656
|
+
const $ = d(v);
|
|
1657
|
+
if (!q(b)) {
|
|
1658
|
+
if (b !== void 0 && !z(b, v) && $?.operated)
|
|
1659
1659
|
throw new Error("Either the value is returned as a new non-draft value, or only the draft is modified without returning any value.");
|
|
1660
|
-
const k =
|
|
1660
|
+
const k = b?.[io];
|
|
1661
1661
|
if (k) {
|
|
1662
|
-
const
|
|
1663
|
-
return
|
|
1664
|
-
rootDraft:
|
|
1665
|
-
value:
|
|
1662
|
+
const or = k[0];
|
|
1663
|
+
return w.strict && typeof b == "object" && b !== null && De({
|
|
1664
|
+
rootDraft: $,
|
|
1665
|
+
value: b,
|
|
1666
1666
|
useRawReturn: !0
|
|
1667
|
-
}),
|
|
1667
|
+
}), _([or]);
|
|
1668
1668
|
}
|
|
1669
|
-
if (
|
|
1670
|
-
return typeof
|
|
1669
|
+
if (b !== void 0)
|
|
1670
|
+
return typeof b == "object" && b !== null && De({ rootDraft: $, value: b }), _([b]);
|
|
1671
1671
|
}
|
|
1672
|
-
if (
|
|
1673
|
-
return
|
|
1674
|
-
const
|
|
1675
|
-
if (
|
|
1676
|
-
if (
|
|
1672
|
+
if (b === v || b === void 0)
|
|
1673
|
+
return _([]);
|
|
1674
|
+
const U = d(b);
|
|
1675
|
+
if (w === U.options) {
|
|
1676
|
+
if (U.operated)
|
|
1677
1677
|
throw new Error("Cannot return a modified child draft.");
|
|
1678
|
-
return
|
|
1678
|
+
return _([At(b)]);
|
|
1679
1679
|
}
|
|
1680
|
-
return
|
|
1680
|
+
return _([b]);
|
|
1681
1681
|
};
|
|
1682
|
-
return A instanceof Promise ? A.then(G, (
|
|
1683
|
-
throw $e(d(
|
|
1682
|
+
return A instanceof Promise ? A.then(G, (b) => {
|
|
1683
|
+
throw $e(d(v)), b;
|
|
1684
1684
|
}) : G(A);
|
|
1685
|
-
},
|
|
1685
|
+
}, R = mo();
|
|
1686
1686
|
Object.prototype.constructor.toString();
|
|
1687
|
-
const
|
|
1687
|
+
const go = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
|
|
1688
1688
|
let vo = (e = 21) => {
|
|
1689
1689
|
let t = "", r = crypto.getRandomValues(new Uint8Array(e |= 0));
|
|
1690
1690
|
for (; e--; )
|
|
1691
|
-
t +=
|
|
1691
|
+
t += go[r[e] & 63];
|
|
1692
1692
|
return t;
|
|
1693
1693
|
};
|
|
1694
1694
|
class wo {
|
|
@@ -1774,22 +1774,22 @@ class K {
|
|
|
1774
1774
|
optimistic: !1,
|
|
1775
1775
|
errors: []
|
|
1776
1776
|
});
|
|
1777
|
-
}), this.state =
|
|
1777
|
+
}), this.state = R(this.state, (n) => {
|
|
1778
1778
|
n.items = r;
|
|
1779
1779
|
}), this.notify();
|
|
1780
1780
|
};
|
|
1781
1781
|
setMetadata = (t) => {
|
|
1782
|
-
this.state =
|
|
1782
|
+
this.state = R(this.state, (r) => {
|
|
1783
1783
|
r.fetchState.metadata = t;
|
|
1784
1784
|
}), this.notify();
|
|
1785
1785
|
};
|
|
1786
1786
|
remove = (t) => {
|
|
1787
|
-
this.state =
|
|
1787
|
+
this.state = R(this.state, (r) => {
|
|
1788
1788
|
r.items.delete(t);
|
|
1789
1789
|
}), this.notify();
|
|
1790
1790
|
};
|
|
1791
1791
|
updateItem = (t) => {
|
|
1792
|
-
this.state =
|
|
1792
|
+
this.state = R(this.state, (r) => {
|
|
1793
1793
|
const n = r.items.get(t.id);
|
|
1794
1794
|
n && (Qs(n, "data", t), this.notify());
|
|
1795
1795
|
});
|
|
@@ -1798,12 +1798,12 @@ class K {
|
|
|
1798
1798
|
this.fetchCache.remove(this.getCacheKey(t));
|
|
1799
1799
|
};
|
|
1800
1800
|
startFetch = () => {
|
|
1801
|
-
this.fetchController.abort(), this.state =
|
|
1801
|
+
this.fetchController.abort(), this.state = R(this.state, (t) => {
|
|
1802
1802
|
t.fetchState.isLoading = !0;
|
|
1803
1803
|
}), this.fetchController = new AbortController(), this.notify();
|
|
1804
1804
|
};
|
|
1805
1805
|
endFetch = (t = []) => {
|
|
1806
|
-
this.state =
|
|
1806
|
+
this.state = R(this.state, (r) => {
|
|
1807
1807
|
r.fetchState.isLoading = !1, r.fetchState.errors = t;
|
|
1808
1808
|
}), this.notify();
|
|
1809
1809
|
};
|
|
@@ -1832,34 +1832,34 @@ class K {
|
|
|
1832
1832
|
};
|
|
1833
1833
|
executeRemove = async (t, r, n) => {
|
|
1834
1834
|
const i = this.startTransition({
|
|
1835
|
-
id: t.id,
|
|
1836
|
-
input: t,
|
|
1835
|
+
id: t.data.id,
|
|
1836
|
+
input: t.data,
|
|
1837
1837
|
state: "delete"
|
|
1838
1838
|
});
|
|
1839
1839
|
if (n)
|
|
1840
1840
|
try {
|
|
1841
|
-
await n(t, { signal: i.signal, context: r }), this.remove(t.id), this.startTransition({ id: t.id, state: "idle" });
|
|
1841
|
+
await n(t.data, { signal: i.signal, context: r }), this.remove(t.data.id), this.startTransition({ id: t.data.id, state: "idle" });
|
|
1842
1842
|
} catch (s) {
|
|
1843
1843
|
if (s.name === "AbortError")
|
|
1844
|
-
throw this.controllers.delete(t.id), this.state =
|
|
1845
|
-
const c = o.items.get(t.id);
|
|
1846
|
-
c && (c.state = "idle", c.
|
|
1844
|
+
throw this.controllers.delete(t.data.id), this.state = R(this.state, (o) => {
|
|
1845
|
+
const c = o.items.get(t.data.id);
|
|
1846
|
+
c && (c.state = "idle", c.action = void 0, c.errors = []);
|
|
1847
1847
|
}), this.notify(), s;
|
|
1848
1848
|
this.startTransition({
|
|
1849
|
-
id: t.id,
|
|
1850
|
-
input: t,
|
|
1849
|
+
id: t.data.id,
|
|
1850
|
+
input: t.data,
|
|
1851
1851
|
state: "delete",
|
|
1852
1852
|
errors: [s.message]
|
|
1853
1853
|
});
|
|
1854
1854
|
}
|
|
1855
1855
|
else
|
|
1856
|
-
this.remove(t.id), this.startTransition({ id: t.id, state: "idle" });
|
|
1856
|
+
this.remove(t.data.id), this.startTransition({ id: t.data.id, state: "idle" });
|
|
1857
1857
|
this.fetchCache.remove(this.getCacheKey(r));
|
|
1858
1858
|
};
|
|
1859
1859
|
executeUpdate = async (t, r, n, i, s = !1) => {
|
|
1860
|
-
const o = t.id;
|
|
1860
|
+
const o = t.data.id;
|
|
1861
1861
|
if (this.state.items.has(o)) {
|
|
1862
|
-
const c = this.state.items.get(o), a =
|
|
1862
|
+
const c = this.state.items.get(o), a = R(c.data, n), f = this.startTransition({
|
|
1863
1863
|
id: o,
|
|
1864
1864
|
input: a,
|
|
1865
1865
|
state: "update",
|
|
@@ -1881,20 +1881,20 @@ class K {
|
|
|
1881
1881
|
});
|
|
1882
1882
|
}
|
|
1883
1883
|
else
|
|
1884
|
-
this.updateItem(a), this.startTransition({ id: o, state: "idle" });
|
|
1884
|
+
this.updateItem(a), this.startTransition({ id: o, state: i ? "idle" : "changed" });
|
|
1885
1885
|
this.fetchCache.remove(this.getCacheKey(r));
|
|
1886
1886
|
}
|
|
1887
1887
|
};
|
|
1888
1888
|
executeCreate = async (t, r, n) => {
|
|
1889
1889
|
const i = `create_${vo(8)}`, s = { ...r, id: i }, o = (a) => {
|
|
1890
|
-
this.state =
|
|
1890
|
+
this.state = R(this.state, (f) => {
|
|
1891
1891
|
const u = {
|
|
1892
1892
|
data: { ...r, id: a || i },
|
|
1893
1893
|
errors: [],
|
|
1894
1894
|
optimistic: !0,
|
|
1895
1895
|
// always true for create
|
|
1896
1896
|
state: "create",
|
|
1897
|
-
|
|
1897
|
+
action: ["create", s]
|
|
1898
1898
|
};
|
|
1899
1899
|
f.items.set(a || i, u);
|
|
1900
1900
|
}), this.notify();
|
|
@@ -1920,7 +1920,7 @@ class K {
|
|
|
1920
1920
|
...u,
|
|
1921
1921
|
data: { ...u.data, id: a }
|
|
1922
1922
|
})) : f.set(l, u);
|
|
1923
|
-
}), this.state =
|
|
1923
|
+
}), this.state = R(this.state, (u) => {
|
|
1924
1924
|
u.items = f;
|
|
1925
1925
|
}), this.startTransition({ id: a, state: "idle" });
|
|
1926
1926
|
} else
|
|
@@ -1949,9 +1949,9 @@ class K {
|
|
|
1949
1949
|
errors: s = []
|
|
1950
1950
|
}) => {
|
|
1951
1951
|
const o = new AbortController();
|
|
1952
|
-
return this.state.items.has(t) && (this.controllers.get(t)?.abort(), this.controllers.set(t, o), this.state =
|
|
1952
|
+
return this.state.items.has(t) && (this.controllers.get(t)?.abort(), this.controllers.set(t, o), this.state = R(this.state, (c) => {
|
|
1953
1953
|
const a = c.items.get(t);
|
|
1954
|
-
a.state = n, a.optimistic = i, a.errors = n === "idle" ? [] : s, a.
|
|
1954
|
+
a.state = n, a.optimistic = i, a.errors = n === "idle" ? [] : s, a.action = n == "idle" ? void 0 : [n, r];
|
|
1955
1955
|
}), this.notify()), o;
|
|
1956
1956
|
};
|
|
1957
1957
|
cancelFetch = () => {
|
|
@@ -1975,39 +1975,79 @@ class K {
|
|
|
1975
1975
|
return K.instances.has(r) || K.instances.set(r, new K(r, { initialData: s, caching: n, debounce: i })), K.instances.get(r);
|
|
1976
1976
|
}
|
|
1977
1977
|
}
|
|
1978
|
-
const
|
|
1978
|
+
const sr = (e) => {
|
|
1979
1979
|
const t = Mt(e);
|
|
1980
1980
|
return le(() => (Ds(e, t.current) || (t.current = e), t.current), [e]);
|
|
1981
1981
|
};
|
|
1982
1982
|
function _o(e) {
|
|
1983
|
-
const t = Mt(e), r =
|
|
1984
|
-
const
|
|
1985
|
-
return
|
|
1986
|
-
}, [e.id]), i =
|
|
1983
|
+
const t = Mt(e), r = sr(e.context), n = P(() => {
|
|
1984
|
+
const p = K.instances.get(e.id);
|
|
1985
|
+
return p || console.error("Store not found, are you sure you used useCrud with config id = ", e.id), p;
|
|
1986
|
+
}, [e.id]), i = P(() => {
|
|
1987
1987
|
n()?.executeFetch(r, t.current.fetch);
|
|
1988
|
-
}, [r, n]), s =
|
|
1989
|
-
const
|
|
1990
|
-
|
|
1991
|
-
}, [r, n]), o =
|
|
1992
|
-
(
|
|
1993
|
-
n().executeCreate(r,
|
|
1988
|
+
}, [r, n]), s = P(() => {
|
|
1989
|
+
const p = n();
|
|
1990
|
+
p.clearFetchCache(r), p.executeFetch(r, t.current.fetch);
|
|
1991
|
+
}, [r, n]), o = P(
|
|
1992
|
+
(p) => {
|
|
1993
|
+
n().executeCreate(r, p, t.current.create);
|
|
1994
|
+
},
|
|
1995
|
+
[r, n]
|
|
1996
|
+
), c = P(
|
|
1997
|
+
(p, h) => {
|
|
1998
|
+
n().executeUpdate(p, r, h, void 0, !0);
|
|
1999
|
+
},
|
|
2000
|
+
[r, n]
|
|
2001
|
+
), a = P(
|
|
2002
|
+
(p) => {
|
|
2003
|
+
const h = n();
|
|
2004
|
+
h.getSnapshot().items.get(p.data.id) && t.current.update ? h.executeUpdate(p, r, Ct, t.current.update) : h.customLog("save", "Non existent item or update function does not exist in config");
|
|
1994
2005
|
},
|
|
1995
2006
|
[r, n]
|
|
1996
|
-
),
|
|
1997
|
-
(
|
|
1998
|
-
n().executeUpdate(
|
|
2007
|
+
), f = P(
|
|
2008
|
+
(p, h, w = !1) => {
|
|
2009
|
+
n().executeUpdate(p, r, h, t.current.update, w);
|
|
1999
2010
|
},
|
|
2000
2011
|
[r, n]
|
|
2001
|
-
),
|
|
2002
|
-
(
|
|
2003
|
-
n().executeRemove(
|
|
2012
|
+
), u = P(
|
|
2013
|
+
(p) => {
|
|
2014
|
+
n().executeRemove(p, r, t.current.remove);
|
|
2004
2015
|
},
|
|
2005
2016
|
[r, n]
|
|
2006
|
-
),
|
|
2017
|
+
), l = P(
|
|
2018
|
+
(p) => {
|
|
2019
|
+
const h = n();
|
|
2020
|
+
if (p.action) {
|
|
2021
|
+
const [w, v] = p.action;
|
|
2022
|
+
switch (w) {
|
|
2023
|
+
case "create":
|
|
2024
|
+
h.executeCreate(r, v, t.current.create);
|
|
2025
|
+
break;
|
|
2026
|
+
case "delete":
|
|
2027
|
+
h.executeRemove(
|
|
2028
|
+
{ data: v, state: "idle", errors: [], optimistic: !1 },
|
|
2029
|
+
r,
|
|
2030
|
+
t.current.remove
|
|
2031
|
+
);
|
|
2032
|
+
break;
|
|
2033
|
+
case "update":
|
|
2034
|
+
h.executeUpdate(
|
|
2035
|
+
{ data: v, state: "idle", optimistic: !1, errors: [] },
|
|
2036
|
+
r,
|
|
2037
|
+
() => v,
|
|
2038
|
+
t.current.update
|
|
2039
|
+
);
|
|
2040
|
+
break;
|
|
2041
|
+
}
|
|
2042
|
+
h.executeRemove(p, r, t.current.remove);
|
|
2043
|
+
}
|
|
2044
|
+
},
|
|
2045
|
+
[r, n]
|
|
2046
|
+
), y = P(() => {
|
|
2007
2047
|
n().cancelFetch();
|
|
2008
|
-
}, [n]),
|
|
2009
|
-
(
|
|
2010
|
-
n().cancelOperation(
|
|
2048
|
+
}, [n]), m = P(
|
|
2049
|
+
(p) => {
|
|
2050
|
+
n().cancelOperation(p);
|
|
2011
2051
|
},
|
|
2012
2052
|
[n]
|
|
2013
2053
|
);
|
|
@@ -2015,10 +2055,13 @@ function _o(e) {
|
|
|
2015
2055
|
fetch: i,
|
|
2016
2056
|
refetch: s,
|
|
2017
2057
|
create: o,
|
|
2018
|
-
update:
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2058
|
+
update: f,
|
|
2059
|
+
change: c,
|
|
2060
|
+
save: a,
|
|
2061
|
+
retry: l,
|
|
2062
|
+
remove: u,
|
|
2063
|
+
cancelFetch: y,
|
|
2064
|
+
cancelOperation: m
|
|
2022
2065
|
};
|
|
2023
2066
|
}
|
|
2024
2067
|
function So(e) {
|
|
@@ -2029,46 +2072,52 @@ function So(e) {
|
|
|
2029
2072
|
caching: e.caching,
|
|
2030
2073
|
debounce: e.debounce
|
|
2031
2074
|
}),
|
|
2032
|
-
[e]
|
|
2033
|
-
), { fetch: r, create: n, update: i,
|
|
2034
|
-
|
|
2075
|
+
[e.id, e.caching, e.debounce]
|
|
2076
|
+
), { fetch: r, create: n, update: i, change: s, save: o, retry: c, remove: a, cancelOperation: f, cancelFetch: u } = _o(e), l = ar(t.subscribe, t.getSnapshot, e.getServerSnapshot), y = sr(e.context);
|
|
2077
|
+
cr(() => {
|
|
2035
2078
|
r();
|
|
2036
|
-
}, [e.id,
|
|
2037
|
-
const
|
|
2038
|
-
...
|
|
2039
|
-
id:
|
|
2040
|
-
})), [
|
|
2079
|
+
}, [e.id, y]);
|
|
2080
|
+
const m = le(() => js([...l.items.values()], (h) => ({
|
|
2081
|
+
...h,
|
|
2082
|
+
id: h.data.id
|
|
2083
|
+
})), [l.items]), p = le(
|
|
2041
2084
|
() => ({
|
|
2042
|
-
itemsById:
|
|
2043
|
-
items:
|
|
2044
|
-
metadata:
|
|
2045
|
-
isLoading:
|
|
2046
|
-
hasError: to(
|
|
2047
|
-
errors:
|
|
2085
|
+
itemsById: l.items,
|
|
2086
|
+
items: m,
|
|
2087
|
+
metadata: l.fetchState.metadata,
|
|
2088
|
+
isLoading: l.fetchState.isLoading,
|
|
2089
|
+
hasError: to(l.fetchState.errors) > 0 || no(m, (h) => h.errors.length > 0),
|
|
2090
|
+
errors: l.fetchState.errors,
|
|
2048
2091
|
create: n,
|
|
2049
2092
|
update: i,
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2093
|
+
change: s,
|
|
2094
|
+
retry: c,
|
|
2095
|
+
save: o,
|
|
2096
|
+
remove: a,
|
|
2097
|
+
cancelFetch: u,
|
|
2098
|
+
cancelOperation: f
|
|
2053
2099
|
}),
|
|
2054
2100
|
[
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2101
|
+
l.items,
|
|
2102
|
+
l.fetchState.metadata,
|
|
2103
|
+
l.fetchState.isLoading,
|
|
2104
|
+
l.fetchState.errors,
|
|
2105
|
+
m,
|
|
2060
2106
|
n,
|
|
2061
2107
|
i,
|
|
2062
|
-
s,
|
|
2063
2108
|
c,
|
|
2064
|
-
|
|
2109
|
+
s,
|
|
2110
|
+
o,
|
|
2111
|
+
a,
|
|
2112
|
+
u,
|
|
2113
|
+
f
|
|
2065
2114
|
]
|
|
2066
2115
|
);
|
|
2067
|
-
return t.customLog("snapshot",
|
|
2116
|
+
return t.customLog("snapshot", p), p;
|
|
2068
2117
|
}
|
|
2069
2118
|
export {
|
|
2070
2119
|
wo as FetchCache,
|
|
2071
2120
|
So as useCrud,
|
|
2072
2121
|
_o as useCrudOperations,
|
|
2073
|
-
|
|
2122
|
+
sr as useMemoDeepEquals
|
|
2074
2123
|
};
|