@vue/reactivity 3.6.0-alpha.4 → 3.6.0-alpha.5
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/reactivity.cjs.js +61 -15
- package/dist/reactivity.cjs.prod.js +61 -15
- package/dist/reactivity.esm-browser.js +61 -15
- package/dist/reactivity.esm-browser.prod.js +2 -2
- package/dist/reactivity.esm-bundler.js +61 -15
- package/dist/reactivity.global.js +61 -15
- package/dist/reactivity.global.prod.js +2 -2
- package/package.json +2 -2
package/dist/reactivity.cjs.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/reactivity v3.6.0-alpha.
|
|
2
|
+
* @vue/reactivity v3.6.0-alpha.5
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -465,10 +465,16 @@ function shallowReadArray(arr) {
|
|
|
465
465
|
track(arr = toRaw(arr), "iterate", ARRAY_ITERATE_KEY);
|
|
466
466
|
return arr;
|
|
467
467
|
}
|
|
468
|
+
function toWrapped(target, item) {
|
|
469
|
+
if (isReadonly(target)) {
|
|
470
|
+
return isReactive(target) ? toReadonly(toReactive(item)) : toReadonly(item);
|
|
471
|
+
}
|
|
472
|
+
return toReactive(item);
|
|
473
|
+
}
|
|
468
474
|
const arrayInstrumentations = {
|
|
469
475
|
__proto__: null,
|
|
470
476
|
[Symbol.iterator]() {
|
|
471
|
-
return iterator(this, Symbol.iterator,
|
|
477
|
+
return iterator(this, Symbol.iterator, (item) => toWrapped(this, item));
|
|
472
478
|
},
|
|
473
479
|
concat(...args) {
|
|
474
480
|
return reactiveReadArray(this).concat(
|
|
@@ -477,7 +483,7 @@ const arrayInstrumentations = {
|
|
|
477
483
|
},
|
|
478
484
|
entries() {
|
|
479
485
|
return iterator(this, "entries", (value) => {
|
|
480
|
-
value[1] =
|
|
486
|
+
value[1] = toWrapped(this, value[1]);
|
|
481
487
|
return value;
|
|
482
488
|
});
|
|
483
489
|
},
|
|
@@ -485,16 +491,37 @@ const arrayInstrumentations = {
|
|
|
485
491
|
return apply(this, "every", fn, thisArg, void 0, arguments);
|
|
486
492
|
},
|
|
487
493
|
filter(fn, thisArg) {
|
|
488
|
-
return apply(
|
|
494
|
+
return apply(
|
|
495
|
+
this,
|
|
496
|
+
"filter",
|
|
497
|
+
fn,
|
|
498
|
+
thisArg,
|
|
499
|
+
(v) => v.map((item) => toWrapped(this, item)),
|
|
500
|
+
arguments
|
|
501
|
+
);
|
|
489
502
|
},
|
|
490
503
|
find(fn, thisArg) {
|
|
491
|
-
return apply(
|
|
504
|
+
return apply(
|
|
505
|
+
this,
|
|
506
|
+
"find",
|
|
507
|
+
fn,
|
|
508
|
+
thisArg,
|
|
509
|
+
(item) => toWrapped(this, item),
|
|
510
|
+
arguments
|
|
511
|
+
);
|
|
492
512
|
},
|
|
493
513
|
findIndex(fn, thisArg) {
|
|
494
514
|
return apply(this, "findIndex", fn, thisArg, void 0, arguments);
|
|
495
515
|
},
|
|
496
516
|
findLast(fn, thisArg) {
|
|
497
|
-
return apply(
|
|
517
|
+
return apply(
|
|
518
|
+
this,
|
|
519
|
+
"findLast",
|
|
520
|
+
fn,
|
|
521
|
+
thisArg,
|
|
522
|
+
(item) => toWrapped(this, item),
|
|
523
|
+
arguments
|
|
524
|
+
);
|
|
498
525
|
},
|
|
499
526
|
findLastIndex(fn, thisArg) {
|
|
500
527
|
return apply(this, "findLastIndex", fn, thisArg, void 0, arguments);
|
|
@@ -554,7 +581,7 @@ const arrayInstrumentations = {
|
|
|
554
581
|
return noTracking(this, "unshift", args);
|
|
555
582
|
},
|
|
556
583
|
values() {
|
|
557
|
-
return iterator(this, "values",
|
|
584
|
+
return iterator(this, "values", (item) => toWrapped(this, item));
|
|
558
585
|
}
|
|
559
586
|
};
|
|
560
587
|
function iterator(self, method, wrapValue) {
|
|
@@ -585,7 +612,7 @@ function apply(self, method, fn, thisArg, wrappedRetFn, args) {
|
|
|
585
612
|
if (arr !== self) {
|
|
586
613
|
if (needsWrap) {
|
|
587
614
|
wrappedFn = function(item, index) {
|
|
588
|
-
return fn.call(this,
|
|
615
|
+
return fn.call(this, toWrapped(self, item), index, self);
|
|
589
616
|
};
|
|
590
617
|
} else if (fn.length > 2) {
|
|
591
618
|
wrappedFn = function(item, index) {
|
|
@@ -602,7 +629,7 @@ function reduce(self, method, fn, args) {
|
|
|
602
629
|
if (arr !== self) {
|
|
603
630
|
if (!isShallow(self)) {
|
|
604
631
|
wrappedFn = function(acc, item, index) {
|
|
605
|
-
return fn.call(this, acc,
|
|
632
|
+
return fn.call(this, acc, toWrapped(self, item), index, self);
|
|
606
633
|
};
|
|
607
634
|
} else if (fn.length > 3) {
|
|
608
635
|
wrappedFn = function(acc, item, index) {
|
|
@@ -710,13 +737,14 @@ class MutableReactiveHandler extends BaseReactiveHandler {
|
|
|
710
737
|
}
|
|
711
738
|
set(target, key, value, receiver) {
|
|
712
739
|
let oldValue = target[key];
|
|
740
|
+
const isArrayWithIntegerKey = shared.isArray(target) && shared.isIntegerKey(key);
|
|
713
741
|
if (!this._isShallow) {
|
|
714
742
|
const isOldValueReadonly = isReadonly(oldValue);
|
|
715
743
|
if (!isShallow(value) && !isReadonly(value)) {
|
|
716
744
|
oldValue = toRaw(oldValue);
|
|
717
745
|
value = toRaw(value);
|
|
718
746
|
}
|
|
719
|
-
if (!
|
|
747
|
+
if (!isArrayWithIntegerKey && isRef(oldValue) && !isRef(value)) {
|
|
720
748
|
if (isOldValueReadonly) {
|
|
721
749
|
{
|
|
722
750
|
warn(
|
|
@@ -731,7 +759,7 @@ class MutableReactiveHandler extends BaseReactiveHandler {
|
|
|
731
759
|
}
|
|
732
760
|
}
|
|
733
761
|
}
|
|
734
|
-
const hadKey =
|
|
762
|
+
const hadKey = isArrayWithIntegerKey ? Number(key) < target.length : shared.hasOwn(target, key);
|
|
735
763
|
const result = Reflect.set(
|
|
736
764
|
target,
|
|
737
765
|
key,
|
|
@@ -1305,16 +1333,35 @@ class ObjectRefImpl {
|
|
|
1305
1333
|
this._defaultValue = _defaultValue;
|
|
1306
1334
|
this["__v_isRef"] = true;
|
|
1307
1335
|
this._value = void 0;
|
|
1336
|
+
this._raw = toRaw(_object);
|
|
1337
|
+
let shallow = true;
|
|
1338
|
+
let obj = _object;
|
|
1339
|
+
if (!shared.isArray(_object) || !shared.isIntegerKey(String(_key))) {
|
|
1340
|
+
do {
|
|
1341
|
+
shallow = !isProxy(obj) || isShallow(obj);
|
|
1342
|
+
} while (shallow && (obj = obj["__v_raw"]));
|
|
1343
|
+
}
|
|
1344
|
+
this._shallow = shallow;
|
|
1308
1345
|
}
|
|
1309
1346
|
get value() {
|
|
1310
|
-
|
|
1347
|
+
let val = this._object[this._key];
|
|
1348
|
+
if (this._shallow) {
|
|
1349
|
+
val = unref(val);
|
|
1350
|
+
}
|
|
1311
1351
|
return this._value = val === void 0 ? this._defaultValue : val;
|
|
1312
1352
|
}
|
|
1313
1353
|
set value(newVal) {
|
|
1354
|
+
if (this._shallow && isRef(this._raw[this._key])) {
|
|
1355
|
+
const nestedRef = this._object[this._key];
|
|
1356
|
+
if (isRef(nestedRef)) {
|
|
1357
|
+
nestedRef.value = newVal;
|
|
1358
|
+
return;
|
|
1359
|
+
}
|
|
1360
|
+
}
|
|
1314
1361
|
this._object[this._key] = newVal;
|
|
1315
1362
|
}
|
|
1316
1363
|
get dep() {
|
|
1317
|
-
return getDepFromReactive(
|
|
1364
|
+
return getDepFromReactive(this._raw, this._key);
|
|
1318
1365
|
}
|
|
1319
1366
|
}
|
|
1320
1367
|
class GetterRefImpl {
|
|
@@ -1340,8 +1387,7 @@ function toRef(source, key, defaultValue) {
|
|
|
1340
1387
|
}
|
|
1341
1388
|
}
|
|
1342
1389
|
function propertyToRef(source, key, defaultValue) {
|
|
1343
|
-
|
|
1344
|
-
return isRef(val) ? val : new ObjectRefImpl(source, key, defaultValue);
|
|
1390
|
+
return new ObjectRefImpl(source, key, defaultValue);
|
|
1345
1391
|
}
|
|
1346
1392
|
|
|
1347
1393
|
const EffectFlags = {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/reactivity v3.6.0-alpha.
|
|
2
|
+
* @vue/reactivity v3.6.0-alpha.5
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -384,10 +384,16 @@ function shallowReadArray(arr) {
|
|
|
384
384
|
track(arr = toRaw(arr), "iterate", ARRAY_ITERATE_KEY);
|
|
385
385
|
return arr;
|
|
386
386
|
}
|
|
387
|
+
function toWrapped(target, item) {
|
|
388
|
+
if (isReadonly(target)) {
|
|
389
|
+
return isReactive(target) ? toReadonly(toReactive(item)) : toReadonly(item);
|
|
390
|
+
}
|
|
391
|
+
return toReactive(item);
|
|
392
|
+
}
|
|
387
393
|
const arrayInstrumentations = {
|
|
388
394
|
__proto__: null,
|
|
389
395
|
[Symbol.iterator]() {
|
|
390
|
-
return iterator(this, Symbol.iterator,
|
|
396
|
+
return iterator(this, Symbol.iterator, (item) => toWrapped(this, item));
|
|
391
397
|
},
|
|
392
398
|
concat(...args) {
|
|
393
399
|
return reactiveReadArray(this).concat(
|
|
@@ -396,7 +402,7 @@ const arrayInstrumentations = {
|
|
|
396
402
|
},
|
|
397
403
|
entries() {
|
|
398
404
|
return iterator(this, "entries", (value) => {
|
|
399
|
-
value[1] =
|
|
405
|
+
value[1] = toWrapped(this, value[1]);
|
|
400
406
|
return value;
|
|
401
407
|
});
|
|
402
408
|
},
|
|
@@ -404,16 +410,37 @@ const arrayInstrumentations = {
|
|
|
404
410
|
return apply(this, "every", fn, thisArg, void 0, arguments);
|
|
405
411
|
},
|
|
406
412
|
filter(fn, thisArg) {
|
|
407
|
-
return apply(
|
|
413
|
+
return apply(
|
|
414
|
+
this,
|
|
415
|
+
"filter",
|
|
416
|
+
fn,
|
|
417
|
+
thisArg,
|
|
418
|
+
(v) => v.map((item) => toWrapped(this, item)),
|
|
419
|
+
arguments
|
|
420
|
+
);
|
|
408
421
|
},
|
|
409
422
|
find(fn, thisArg) {
|
|
410
|
-
return apply(
|
|
423
|
+
return apply(
|
|
424
|
+
this,
|
|
425
|
+
"find",
|
|
426
|
+
fn,
|
|
427
|
+
thisArg,
|
|
428
|
+
(item) => toWrapped(this, item),
|
|
429
|
+
arguments
|
|
430
|
+
);
|
|
411
431
|
},
|
|
412
432
|
findIndex(fn, thisArg) {
|
|
413
433
|
return apply(this, "findIndex", fn, thisArg, void 0, arguments);
|
|
414
434
|
},
|
|
415
435
|
findLast(fn, thisArg) {
|
|
416
|
-
return apply(
|
|
436
|
+
return apply(
|
|
437
|
+
this,
|
|
438
|
+
"findLast",
|
|
439
|
+
fn,
|
|
440
|
+
thisArg,
|
|
441
|
+
(item) => toWrapped(this, item),
|
|
442
|
+
arguments
|
|
443
|
+
);
|
|
417
444
|
},
|
|
418
445
|
findLastIndex(fn, thisArg) {
|
|
419
446
|
return apply(this, "findLastIndex", fn, thisArg, void 0, arguments);
|
|
@@ -473,7 +500,7 @@ const arrayInstrumentations = {
|
|
|
473
500
|
return noTracking(this, "unshift", args);
|
|
474
501
|
},
|
|
475
502
|
values() {
|
|
476
|
-
return iterator(this, "values",
|
|
503
|
+
return iterator(this, "values", (item) => toWrapped(this, item));
|
|
477
504
|
}
|
|
478
505
|
};
|
|
479
506
|
function iterator(self, method, wrapValue) {
|
|
@@ -504,7 +531,7 @@ function apply(self, method, fn, thisArg, wrappedRetFn, args) {
|
|
|
504
531
|
if (arr !== self) {
|
|
505
532
|
if (needsWrap) {
|
|
506
533
|
wrappedFn = function(item, index) {
|
|
507
|
-
return fn.call(this,
|
|
534
|
+
return fn.call(this, toWrapped(self, item), index, self);
|
|
508
535
|
};
|
|
509
536
|
} else if (fn.length > 2) {
|
|
510
537
|
wrappedFn = function(item, index) {
|
|
@@ -521,7 +548,7 @@ function reduce(self, method, fn, args) {
|
|
|
521
548
|
if (arr !== self) {
|
|
522
549
|
if (!isShallow(self)) {
|
|
523
550
|
wrappedFn = function(acc, item, index) {
|
|
524
|
-
return fn.call(this, acc,
|
|
551
|
+
return fn.call(this, acc, toWrapped(self, item), index, self);
|
|
525
552
|
};
|
|
526
553
|
} else if (fn.length > 3) {
|
|
527
554
|
wrappedFn = function(acc, item, index) {
|
|
@@ -629,13 +656,14 @@ class MutableReactiveHandler extends BaseReactiveHandler {
|
|
|
629
656
|
}
|
|
630
657
|
set(target, key, value, receiver) {
|
|
631
658
|
let oldValue = target[key];
|
|
659
|
+
const isArrayWithIntegerKey = shared.isArray(target) && shared.isIntegerKey(key);
|
|
632
660
|
if (!this._isShallow) {
|
|
633
661
|
const isOldValueReadonly = isReadonly(oldValue);
|
|
634
662
|
if (!isShallow(value) && !isReadonly(value)) {
|
|
635
663
|
oldValue = toRaw(oldValue);
|
|
636
664
|
value = toRaw(value);
|
|
637
665
|
}
|
|
638
|
-
if (!
|
|
666
|
+
if (!isArrayWithIntegerKey && isRef(oldValue) && !isRef(value)) {
|
|
639
667
|
if (isOldValueReadonly) {
|
|
640
668
|
return true;
|
|
641
669
|
} else {
|
|
@@ -644,7 +672,7 @@ class MutableReactiveHandler extends BaseReactiveHandler {
|
|
|
644
672
|
}
|
|
645
673
|
}
|
|
646
674
|
}
|
|
647
|
-
const hadKey =
|
|
675
|
+
const hadKey = isArrayWithIntegerKey ? Number(key) < target.length : shared.hasOwn(target, key);
|
|
648
676
|
const result = Reflect.set(
|
|
649
677
|
target,
|
|
650
678
|
key,
|
|
@@ -1157,16 +1185,35 @@ class ObjectRefImpl {
|
|
|
1157
1185
|
this._defaultValue = _defaultValue;
|
|
1158
1186
|
this["__v_isRef"] = true;
|
|
1159
1187
|
this._value = void 0;
|
|
1188
|
+
this._raw = toRaw(_object);
|
|
1189
|
+
let shallow = true;
|
|
1190
|
+
let obj = _object;
|
|
1191
|
+
if (!shared.isArray(_object) || !shared.isIntegerKey(String(_key))) {
|
|
1192
|
+
do {
|
|
1193
|
+
shallow = !isProxy(obj) || isShallow(obj);
|
|
1194
|
+
} while (shallow && (obj = obj["__v_raw"]));
|
|
1195
|
+
}
|
|
1196
|
+
this._shallow = shallow;
|
|
1160
1197
|
}
|
|
1161
1198
|
get value() {
|
|
1162
|
-
|
|
1199
|
+
let val = this._object[this._key];
|
|
1200
|
+
if (this._shallow) {
|
|
1201
|
+
val = unref(val);
|
|
1202
|
+
}
|
|
1163
1203
|
return this._value = val === void 0 ? this._defaultValue : val;
|
|
1164
1204
|
}
|
|
1165
1205
|
set value(newVal) {
|
|
1206
|
+
if (this._shallow && isRef(this._raw[this._key])) {
|
|
1207
|
+
const nestedRef = this._object[this._key];
|
|
1208
|
+
if (isRef(nestedRef)) {
|
|
1209
|
+
nestedRef.value = newVal;
|
|
1210
|
+
return;
|
|
1211
|
+
}
|
|
1212
|
+
}
|
|
1166
1213
|
this._object[this._key] = newVal;
|
|
1167
1214
|
}
|
|
1168
1215
|
get dep() {
|
|
1169
|
-
return getDepFromReactive(
|
|
1216
|
+
return getDepFromReactive(this._raw, this._key);
|
|
1170
1217
|
}
|
|
1171
1218
|
}
|
|
1172
1219
|
class GetterRefImpl {
|
|
@@ -1192,8 +1239,7 @@ function toRef(source, key, defaultValue) {
|
|
|
1192
1239
|
}
|
|
1193
1240
|
}
|
|
1194
1241
|
function propertyToRef(source, key, defaultValue) {
|
|
1195
|
-
|
|
1196
|
-
return isRef(val) ? val : new ObjectRefImpl(source, key, defaultValue);
|
|
1242
|
+
return new ObjectRefImpl(source, key, defaultValue);
|
|
1197
1243
|
}
|
|
1198
1244
|
|
|
1199
1245
|
const EffectFlags = {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/reactivity v3.6.0-alpha.
|
|
2
|
+
* @vue/reactivity v3.6.0-alpha.5
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -506,10 +506,16 @@ function shallowReadArray(arr) {
|
|
|
506
506
|
track(arr = toRaw(arr), "iterate", ARRAY_ITERATE_KEY);
|
|
507
507
|
return arr;
|
|
508
508
|
}
|
|
509
|
+
function toWrapped(target, item) {
|
|
510
|
+
if (isReadonly(target)) {
|
|
511
|
+
return isReactive(target) ? toReadonly(toReactive(item)) : toReadonly(item);
|
|
512
|
+
}
|
|
513
|
+
return toReactive(item);
|
|
514
|
+
}
|
|
509
515
|
const arrayInstrumentations = {
|
|
510
516
|
__proto__: null,
|
|
511
517
|
[Symbol.iterator]() {
|
|
512
|
-
return iterator(this, Symbol.iterator,
|
|
518
|
+
return iterator(this, Symbol.iterator, (item) => toWrapped(this, item));
|
|
513
519
|
},
|
|
514
520
|
concat(...args) {
|
|
515
521
|
return reactiveReadArray(this).concat(
|
|
@@ -518,7 +524,7 @@ const arrayInstrumentations = {
|
|
|
518
524
|
},
|
|
519
525
|
entries() {
|
|
520
526
|
return iterator(this, "entries", (value) => {
|
|
521
|
-
value[1] =
|
|
527
|
+
value[1] = toWrapped(this, value[1]);
|
|
522
528
|
return value;
|
|
523
529
|
});
|
|
524
530
|
},
|
|
@@ -526,16 +532,37 @@ const arrayInstrumentations = {
|
|
|
526
532
|
return apply(this, "every", fn, thisArg, void 0, arguments);
|
|
527
533
|
},
|
|
528
534
|
filter(fn, thisArg) {
|
|
529
|
-
return apply(
|
|
535
|
+
return apply(
|
|
536
|
+
this,
|
|
537
|
+
"filter",
|
|
538
|
+
fn,
|
|
539
|
+
thisArg,
|
|
540
|
+
(v) => v.map((item) => toWrapped(this, item)),
|
|
541
|
+
arguments
|
|
542
|
+
);
|
|
530
543
|
},
|
|
531
544
|
find(fn, thisArg) {
|
|
532
|
-
return apply(
|
|
545
|
+
return apply(
|
|
546
|
+
this,
|
|
547
|
+
"find",
|
|
548
|
+
fn,
|
|
549
|
+
thisArg,
|
|
550
|
+
(item) => toWrapped(this, item),
|
|
551
|
+
arguments
|
|
552
|
+
);
|
|
533
553
|
},
|
|
534
554
|
findIndex(fn, thisArg) {
|
|
535
555
|
return apply(this, "findIndex", fn, thisArg, void 0, arguments);
|
|
536
556
|
},
|
|
537
557
|
findLast(fn, thisArg) {
|
|
538
|
-
return apply(
|
|
558
|
+
return apply(
|
|
559
|
+
this,
|
|
560
|
+
"findLast",
|
|
561
|
+
fn,
|
|
562
|
+
thisArg,
|
|
563
|
+
(item) => toWrapped(this, item),
|
|
564
|
+
arguments
|
|
565
|
+
);
|
|
539
566
|
},
|
|
540
567
|
findLastIndex(fn, thisArg) {
|
|
541
568
|
return apply(this, "findLastIndex", fn, thisArg, void 0, arguments);
|
|
@@ -595,7 +622,7 @@ const arrayInstrumentations = {
|
|
|
595
622
|
return noTracking(this, "unshift", args);
|
|
596
623
|
},
|
|
597
624
|
values() {
|
|
598
|
-
return iterator(this, "values",
|
|
625
|
+
return iterator(this, "values", (item) => toWrapped(this, item));
|
|
599
626
|
}
|
|
600
627
|
};
|
|
601
628
|
function iterator(self, method, wrapValue) {
|
|
@@ -626,7 +653,7 @@ function apply(self, method, fn, thisArg, wrappedRetFn, args) {
|
|
|
626
653
|
if (arr !== self) {
|
|
627
654
|
if (needsWrap) {
|
|
628
655
|
wrappedFn = function(item, index) {
|
|
629
|
-
return fn.call(this,
|
|
656
|
+
return fn.call(this, toWrapped(self, item), index, self);
|
|
630
657
|
};
|
|
631
658
|
} else if (fn.length > 2) {
|
|
632
659
|
wrappedFn = function(item, index) {
|
|
@@ -643,7 +670,7 @@ function reduce(self, method, fn, args) {
|
|
|
643
670
|
if (arr !== self) {
|
|
644
671
|
if (!isShallow(self)) {
|
|
645
672
|
wrappedFn = function(acc, item, index) {
|
|
646
|
-
return fn.call(this, acc,
|
|
673
|
+
return fn.call(this, acc, toWrapped(self, item), index, self);
|
|
647
674
|
};
|
|
648
675
|
} else if (fn.length > 3) {
|
|
649
676
|
wrappedFn = function(acc, item, index) {
|
|
@@ -751,13 +778,14 @@ class MutableReactiveHandler extends BaseReactiveHandler {
|
|
|
751
778
|
}
|
|
752
779
|
set(target, key, value, receiver) {
|
|
753
780
|
let oldValue = target[key];
|
|
781
|
+
const isArrayWithIntegerKey = isArray(target) && isIntegerKey(key);
|
|
754
782
|
if (!this._isShallow) {
|
|
755
783
|
const isOldValueReadonly = isReadonly(oldValue);
|
|
756
784
|
if (!isShallow(value) && !isReadonly(value)) {
|
|
757
785
|
oldValue = toRaw(oldValue);
|
|
758
786
|
value = toRaw(value);
|
|
759
787
|
}
|
|
760
|
-
if (!
|
|
788
|
+
if (!isArrayWithIntegerKey && isRef(oldValue) && !isRef(value)) {
|
|
761
789
|
if (isOldValueReadonly) {
|
|
762
790
|
{
|
|
763
791
|
warn(
|
|
@@ -772,7 +800,7 @@ class MutableReactiveHandler extends BaseReactiveHandler {
|
|
|
772
800
|
}
|
|
773
801
|
}
|
|
774
802
|
}
|
|
775
|
-
const hadKey =
|
|
803
|
+
const hadKey = isArrayWithIntegerKey ? Number(key) < target.length : hasOwn(target, key);
|
|
776
804
|
const result = Reflect.set(
|
|
777
805
|
target,
|
|
778
806
|
key,
|
|
@@ -1346,16 +1374,35 @@ class ObjectRefImpl {
|
|
|
1346
1374
|
this._defaultValue = _defaultValue;
|
|
1347
1375
|
this["__v_isRef"] = true;
|
|
1348
1376
|
this._value = void 0;
|
|
1377
|
+
this._raw = toRaw(_object);
|
|
1378
|
+
let shallow = true;
|
|
1379
|
+
let obj = _object;
|
|
1380
|
+
if (!isArray(_object) || !isIntegerKey(String(_key))) {
|
|
1381
|
+
do {
|
|
1382
|
+
shallow = !isProxy(obj) || isShallow(obj);
|
|
1383
|
+
} while (shallow && (obj = obj["__v_raw"]));
|
|
1384
|
+
}
|
|
1385
|
+
this._shallow = shallow;
|
|
1349
1386
|
}
|
|
1350
1387
|
get value() {
|
|
1351
|
-
|
|
1388
|
+
let val = this._object[this._key];
|
|
1389
|
+
if (this._shallow) {
|
|
1390
|
+
val = unref(val);
|
|
1391
|
+
}
|
|
1352
1392
|
return this._value = val === void 0 ? this._defaultValue : val;
|
|
1353
1393
|
}
|
|
1354
1394
|
set value(newVal) {
|
|
1395
|
+
if (this._shallow && isRef(this._raw[this._key])) {
|
|
1396
|
+
const nestedRef = this._object[this._key];
|
|
1397
|
+
if (isRef(nestedRef)) {
|
|
1398
|
+
nestedRef.value = newVal;
|
|
1399
|
+
return;
|
|
1400
|
+
}
|
|
1401
|
+
}
|
|
1355
1402
|
this._object[this._key] = newVal;
|
|
1356
1403
|
}
|
|
1357
1404
|
get dep() {
|
|
1358
|
-
return getDepFromReactive(
|
|
1405
|
+
return getDepFromReactive(this._raw, this._key);
|
|
1359
1406
|
}
|
|
1360
1407
|
}
|
|
1361
1408
|
class GetterRefImpl {
|
|
@@ -1381,8 +1428,7 @@ function toRef(source, key, defaultValue) {
|
|
|
1381
1428
|
}
|
|
1382
1429
|
}
|
|
1383
1430
|
function propertyToRef(source, key, defaultValue) {
|
|
1384
|
-
|
|
1385
|
-
return isRef(val) ? val : new ObjectRefImpl(source, key, defaultValue);
|
|
1431
|
+
return new ObjectRefImpl(source, key, defaultValue);
|
|
1386
1432
|
}
|
|
1387
1433
|
|
|
1388
1434
|
const EffectFlags = {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/reactivity v3.6.0-alpha.
|
|
2
|
+
* @vue/reactivity v3.6.0-alpha.5
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
|
-
**/let e,t,i;let s={},r=()=>{},n=Object.assign,l=Object.prototype.hasOwnProperty,u=Array.isArray,o=e=>"symbol"==typeof e,a=e=>null!==e&&"object"==typeof e,f=Object.prototype.toString,c=e=>"string"==typeof e&&"NaN"!==e&&"-"!==e[0]&&""+parseInt(e,10)===e;var h,d=((h=d||{})[h.None=0]="None",h[h.Mutable=1]="Mutable",h[h.Watching=2]="Watching",h[h.RecursedCheck=4]="RecursedCheck",h[h.Recursed=8]="Recursed",h[h.Dirty=16]="Dirty",h[h.Pending=32]="Pending",h);let p=[],v=0,_=0,g=0,b=0;function y(e){try{return t}finally{t=e}}function R(){--v||!b||O()}function w(e,t){let i=t.depsTail;if(void 0!==i&&i.dep===e)return;let s=void 0!==i?i.nextDep:t.deps;if(void 0!==s&&s.dep===e){s.version=_,t.depsTail=s;return}let r=e.subsTail;if(void 0!==r&&r.version===_&&r.sub===t)return;let n=t.depsTail=e.subsTail={version:_,dep:e,sub:t,prevDep:i,nextDep:s,prevSub:r,nextSub:void 0};void 0!==s&&(s.prevDep=n),void 0!==i?i.nextDep=n:t.deps=n,void 0!==r?r.nextSub=n:e.subs=n}function S(e,t=e.sub){let i=e.dep,s=e.prevDep,r=e.nextDep,n=e.nextSub,l=e.prevSub;if(void 0!==r?r.prevDep=s:t.depsTail=s,void 0!==s?s.nextDep=r:t.deps=r,void 0!==n?n.prevSub=l:i.subsTail=l,void 0!==l)l.nextSub=n;else if(void 0===(i.subs=n)){let e=i.deps;if(void 0!==e){do e=S(e,i);while(void 0!==e);i.flags|=16}}return r}function T(e){let t,i=e.nextSub;e:for(;;){let s=e.sub,r=s.flags;if(3&r&&(60&r?12&r?4&r?!(48&r)&&function(e,t){let i=t.depsTail;for(;void 0!==i;){if(i===e)return!0;i=i.prevDep}return!1}(e,s)?(s.flags=8|r|32,r&=1):r=0:s.flags=-9&r|32:r=0:s.flags=32|r,2&r&&(p[b++]=s),1&r)){let r=s.subs;if(void 0!==r){e=r,void 0!==r.nextSub&&(t={value:i,prev:t},i=e.nextSub);continue}}if(void 0!==(e=i)){i=e.nextSub;continue}for(;void 0!==t;)if(e=t.value,t=t.prev,void 0!==e){i=e.nextSub;continue e}break}}function E(e){return++_,e.depsTail=void 0,e.flags=-57&e.flags|4,y(e)}function x(e,i){t=i;let s=e.depsTail,r=void 0!==s?s.nextDep:e.deps;for(;void 0!==r;)r=S(r,e);e.flags&=-5}function O(){for(;g<b;){let e=p[g];p[g++]=void 0,e.notify()}g=0,b=0}function m(e,t){let i,s=0;e:for(;;){let r=e.dep,n=r.flags,l=!1;if(16&t.flags)l=!0;else if((17&n)==17){if(r.update()){let e=r.subs;void 0!==e.nextSub&&A(e),l=!0}}else if((33&n)==33){(void 0!==e.nextSub||void 0!==e.prevSub)&&(i={value:e,prev:i}),e=r.deps,t=r,++s;continue}if(!l&&void 0!==e.nextDep){e=e.nextDep;continue}for(;s;){--s;let r=t.subs,n=void 0!==r.nextSub;if(n?(e=i.value,i=i.prev):e=r,l){if(t.update()){n&&A(r),t=e.sub;continue}}else t.flags&=-33;if(t=e.sub,void 0!==e.nextDep){e=e.nextDep;continue e}l=!1}return l}}function A(e){do{let t=e.sub,i=e.nextSub,s=t.flags;(48&s)==32&&(t.flags=16|s),e=i}while(void 0!==e)}class D{constructor(e,t){this.map=e,this.key=t,this._subs=void 0,this.subsTail=void 0,this.flags=d.None}get subs(){return this._subs}set subs(e){this._subs=e,void 0===e&&this.map.delete(this.key)}}let j=new WeakMap,P=Symbol(""),k=Symbol(""),C=Symbol("");function L(e,i,s){if(void 0!==t){let i=j.get(e);i||j.set(e,i=new Map);let r=i.get(s);r||i.set(s,r=new D(i,s)),w(r,t)}}function W(e,t,i,s,r,n){let l=j.get(e);if(!l)return;let a=e=>{void 0!==e&&void 0!==e.subs&&(T(e.subs),A(e.subs))};if(++v,"clear"===t)l.forEach(a);else{let r=u(e),n=r&&c(i);if(r&&"length"===i){let e=Number(s);l.forEach((t,i)=>{("length"===i||i===C||!o(i)&&i>=e)&&a(t)})}else switch((void 0!==i||l.has(void 0))&&a(l.get(i)),n&&a(l.get(C)),t){case"add":if(r)n&&a(l.get("length"));else{let t;a(l.get(P));"[object Map]"===(t=e,f.call(t))&&a(l.get(k))}break;case"delete":if(!r){let t;a(l.get(P));"[object Map]"===(t=e,f.call(t))&&a(l.get(k))}break;case"set":let h;"[object Map]"===(h=e,f.call(h))&&a(l.get(P))}}R()}function M(e){let t=ew(e);return t===e?t:(L(t,"iterate",C),ey(e)?t:t.map(eT))}function I(e){return L(e=ew(e),"iterate",C),e}let V={__proto__:null,[Symbol.iterator](){return N(this,Symbol.iterator,eT)},concat(...e){return M(this).concat(...e.map(e=>u(e)?M(e):e))},entries(){return N(this,"entries",e=>(e[1]=eT(e[1]),e))},every(e,t){return H(this,"every",e,t,void 0,arguments)},filter(e,t){return H(this,"filter",e,t,e=>e.map(eT),arguments)},find(e,t){return H(this,"find",e,t,eT,arguments)},findIndex(e,t){return H(this,"findIndex",e,t,void 0,arguments)},findLast(e,t){return H(this,"findLast",e,t,eT,arguments)},findLastIndex(e,t){return H(this,"findLastIndex",e,t,void 0,arguments)},forEach(e,t){return H(this,"forEach",e,t,void 0,arguments)},includes(...e){return Y(this,"includes",e)},indexOf(...e){return Y(this,"indexOf",e)},join(e){return M(this).join(e)},lastIndexOf(...e){return Y(this,"lastIndexOf",e)},map(e,t){return H(this,"map",e,t,void 0,arguments)},pop(){return z(this,"pop")},push(...e){return z(this,"push",e)},reduce(e,...t){return U(this,"reduce",e,t)},reduceRight(e,...t){return U(this,"reduceRight",e,t)},shift(){return z(this,"shift")},some(e,t){return H(this,"some",e,t,void 0,arguments)},splice(...e){return z(this,"splice",e)},toReversed(){return M(this).toReversed()},toSorted(e){return M(this).toSorted(e)},toSpliced(...e){return M(this).toSpliced(...e)},unshift(...e){return z(this,"unshift",e)},values(){return N(this,"values",eT)}};function N(e,t,i){let s=I(e),r=s[t]();return s===e||ey(e)||(r._next=r.next,r.next=()=>{let e=r._next();return e.done||(e.value=i(e.value)),e}),r}let K=Array.prototype;function H(e,t,i,s,r,n){let l=I(e),u=l!==e&&!ey(e),o=l[t];if(o!==K[t]){let t=o.apply(e,n);return u?eT(t):t}let a=i;l!==e&&(u?a=function(t,s){return i.call(this,eT(t),s,e)}:i.length>2&&(a=function(t,s){return i.call(this,t,s,e)}));let f=o.call(l,a,s);return u&&r?r(f):f}function U(e,t,i,s){let r=I(e),n=i;return r!==e&&(ey(e)?i.length>3&&(n=function(t,s,r){return i.call(this,t,s,r,e)}):n=function(t,s,r){return i.call(this,t,eT(s),r,e)}),r[t](n,...s)}function Y(e,t,i){let s=ew(e);L(s,"iterate",C);let r=s[t](...i);return(-1===r||!1===r)&&eR(i[0])?(i[0]=ew(i[0]),s[t](...i)):r}function z(e,t,i=[]){++v;let s=y(),r=ew(e)[t].apply(e,i);return y(s),R(),r}let F=function(e){let t=Object.create(null);for(let i of e.split(","))t[i]=1;return e=>e in t}("__proto__,__v_isRef,__isVue"),G=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>"arguments"!==e&&"caller"!==e).map(e=>Symbol[e]).filter(o));function B(e){o(e)||(e=String(e));let t=ew(this);return L(t,"has",e),t.hasOwnProperty(e)}class q{constructor(e=!1,t=!1){this._isReadonly=e,this._isShallow=t}get(e,t,i){if("__v_skip"===t)return e.__v_skip;let s=this._isReadonly,r=this._isShallow;if("__v_isReactive"===t)return!s;if("__v_isReadonly"===t)return s;if("__v_isShallow"===t)return r;if("__v_raw"===t)return i===(s?r?ec:ef:r?ea:eo).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(i)?e:void 0;let n=u(e);if(!s){let e;if(n&&(e=V[t]))return e;if("hasOwnProperty"===t)return B}let l=ex(e),f=Reflect.get(e,t,l?e:i);if(l&&"value"!==t||(o(t)?G.has(t):F(t))||(s||L(e,"get",t),r))return f;if(ex(f)){let e=n&&c(t)?f:f.value;return s&&a(e)?ep(e):e}return a(f)?s?ep(f):eh(f):f}}class J extends q{constructor(e=!1){super(!1,e)}set(e,t,i,s){let r=e[t];if(!this._isShallow){let t=eb(r);if(ey(i)||eb(i)||(r=ew(r),i=ew(i)),!u(e)&&ex(r)&&!ex(i))if(t)return!0;else return r.value=i,!0}let n=u(e)&&c(t)?Number(t)<e.length:l.call(e,t),o=Reflect.set(e,t,i,ex(e)?e:s);return e===ew(s)&&(n?Object.is(i,r)||W(e,"set",t,i):W(e,"add",t,i)),o}deleteProperty(e,t){let i=l.call(e,t);e[t];let s=Reflect.deleteProperty(e,t);return s&&i&&W(e,"delete",t,void 0),s}has(e,t){let i=Reflect.has(e,t);return o(t)&&G.has(t)||L(e,"has",t),i}ownKeys(e){return L(e,"iterate",u(e)?"length":P),Reflect.ownKeys(e)}}class Q extends q{constructor(e=!1){super(!0,e)}set(e,t){return!0}deleteProperty(e,t){return!0}}let X=new J,Z=new Q,$=new J(!0),ee=new Q(!0),et=e=>e;function ei(e){return function(){return"delete"!==e&&("clear"===e?void 0:this)}}function es(e,t){let i,s=(n(i={get(i){let s=this.__v_raw,r=ew(s),n=ew(i);e||(Object.is(i,n)||L(r,"get",i),L(r,"get",n));let{has:l}=Reflect.getPrototypeOf(r),u=t?et:e?eE:eT;return l.call(r,i)?u(s.get(i)):l.call(r,n)?u(s.get(n)):void(s!==r&&s.get(i))},get size(){let t=this.__v_raw;return e||L(ew(t),"iterate",P),t.size},has(t){let i=this.__v_raw,s=ew(i),r=ew(t);return e||(Object.is(t,r)||L(s,"has",t),L(s,"has",r)),t===r?i.has(t):i.has(t)||i.has(r)},forEach(i,s){let r=this,n=r.__v_raw,l=ew(n),u=t?et:e?eE:eT;return e||L(l,"iterate",P),n.forEach((e,t)=>i.call(s,u(e),u(t),r))}},e?{add:ei("add"),set:ei("set"),delete:ei("delete"),clear:ei("clear")}:{add(e){t||ey(e)||eb(e)||(e=ew(e));let i=ew(this);return Reflect.getPrototypeOf(i).has.call(i,e)||(i.add(e),W(i,"add",e,e)),this},set(e,i){t||ey(i)||eb(i)||(i=ew(i));let s=ew(this),{has:r,get:n}=Reflect.getPrototypeOf(s),l=r.call(s,e);l||(e=ew(e),l=r.call(s,e));let u=n.call(s,e);return(s.set(e,i),l)?Object.is(i,u)||W(s,"set",e,i):W(s,"add",e,i),this},delete(e){let t=ew(this),{has:i,get:s}=Reflect.getPrototypeOf(t),r=i.call(t,e);r||(e=ew(e),r=i.call(t,e)),s&&s.call(t,e);let n=t.delete(e);return r&&W(t,"delete",e,void 0),n},clear(){let e=ew(this),t=0!==e.size,i=e.clear();return t&&W(e,"clear",void 0,void 0),i}}),["keys","values","entries",Symbol.iterator].forEach(s=>{i[s]=function(...i){let r,n=this.__v_raw,l=ew(n),u="[object Map]"===(r=l,f.call(r)),o="entries"===s||s===Symbol.iterator&&u,a=n[s](...i),c=t?et:e?eE:eT;return e||L(l,"iterate","keys"===s&&u?k:P),{next(){let{value:e,done:t}=a.next();return t?{value:e,done:t}:{value:o?[c(e[0]),c(e[1])]:c(e),done:t}},[Symbol.iterator](){return this}}}}),i);return(t,i,r)=>"__v_isReactive"===i?!e:"__v_isReadonly"===i?e:"__v_raw"===i?t:Reflect.get(l.call(s,i)&&i in t?s:t,i,r)}let er={get:es(!1,!1)},en={get:es(!1,!0)},el={get:es(!0,!1)},eu={get:es(!0,!0)},eo=new WeakMap,ea=new WeakMap,ef=new WeakMap,ec=new WeakMap;function eh(e){return eb(e)?e:e_(e,!1,X,er,eo)}function ed(e){return e_(e,!1,$,en,ea)}function ep(e){return e_(e,!0,Z,el,ef)}function ev(e){return e_(e,!0,ee,eu,ec)}function e_(e,t,i,s,r){var n;let l;if(!a(e)||e.__v_raw&&!(t&&e.__v_isReactive))return e;let u=(n=e).__v_skip||!Object.isExtensible(n)?0:function(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}((l=n,f.call(l)).slice(8,-1));if(0===u)return e;let o=r.get(e);if(o)return o;let c=new Proxy(e,2===u?s:i);return r.set(e,c),c}function eg(e){return eb(e)?eg(e.__v_raw):!!(e&&e.__v_isReactive)}function eb(e){return!!(e&&e.__v_isReadonly)}function ey(e){return!!(e&&e.__v_isShallow)}function eR(e){return!!e&&!!e.__v_raw}function ew(e){let t=e&&e.__v_raw;return t?ew(t):e}function eS(e){return!l.call(e,"__v_skip")&&Object.isExtensible(e)&&((e,t,i,s=!1)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:s,value:i})})(e,"__v_skip",!0),e}let eT=e=>a(e)?eh(e):e,eE=e=>a(e)?ep(e):e;function ex(e){return!!e&&!0===e.__v_isRef}function eO(e){return eA(e,eT)}function em(e){return eA(e)}function eA(e,t){return ex(e)?e:new eD(e,t)}class eD{constructor(e,t){this.subs=void 0,this.subsTail=void 0,this.flags=d.Mutable,this.__v_isRef=!0,this.__v_isShallow=!1,this._oldValue=this._rawValue=t?ew(e):e,this._value=t?t(e):e,this._wrap=t,this.__v_isShallow=!t}get dep(){return this}get value(){if(eP(this),this.flags&d.Dirty&&this.update()){let e=this.subs;void 0!==e&&A(e)}return this._value}set value(e){let t=this._rawValue,i=this.__v_isShallow||ey(e)||eb(e);if(!Object.is(e=i?e:ew(e),t)){this.flags|=d.Dirty,this._rawValue=e,this._value=!i&&this._wrap?this._wrap(e):e;let t=this.subs;void 0!==t&&(T(t),v||O())}}update(){return this.flags&=~d.Dirty,!Object.is(this._oldValue,this._oldValue=this._rawValue)}}function ej(e){let t=e.dep;void 0!==t&&void 0!==t.subs&&(T(t.subs),A(t.subs),v||O())}function eP(e){void 0!==t&&w(e,t)}function ek(e){return ex(e)?e.value:e}function eC(e){return"function"==typeof e?e():ek(e)}let eL={get:(e,t,i)=>"__v_raw"===t?e:ek(Reflect.get(e,t,i)),set:(e,t,i,s)=>{let r=e[t];return ex(r)&&!ex(i)?(r.value=i,!0):Reflect.set(e,t,i,s)}};function eW(e){return eg(e)?e:new Proxy(e,eL)}class eM{constructor(e){this.subs=void 0,this.subsTail=void 0,this.flags=d.None,this.__v_isRef=!0,this._value=void 0;let{get:t,set:i}=e(()=>eP(this),()=>ej(this));this._get=t,this._set=i}get dep(){return this}get value(){return this._value=this._get()}set value(e){this._set(e)}}function eI(e){return new eM(e)}function eV(e){let t=u(e)?Array(e.length):{};for(let i in e)t[i]=eU(e,i);return t}class eN{constructor(e,t,i){this._object=e,this._key=t,this._defaultValue=i,this.__v_isRef=!0,this._value=void 0}get value(){let e=this._object[this._key];return this._value=void 0===e?this._defaultValue:e}set value(e){this._object[this._key]=e}get dep(){var e,t;let i;return e=ew(this._object),t=this._key,(i=j.get(e))&&i.get(t)}}class eK{constructor(e){this._getter=e,this.__v_isRef=!0,this.__v_isReadonly=!0,this._value=void 0}get value(){return this._value=this._getter()}}function eH(e,t,i){return ex(e)?e:"function"==typeof e?new eK(e):a(e)&&arguments.length>1?eU(e,t,i):eO(e)}function eU(e,t,i){let s=e[t];return ex(s)?s:new eN(e,t,i)}let eY={ALLOW_RECURSE:128,128:"ALLOW_RECURSE",PAUSED:256,256:"PAUSED",STOP:1024,1024:"STOP"};class ez{constructor(t){this.deps=void 0,this.depsTail=void 0,this.subs=void 0,this.subsTail=void 0,this.flags=d.Watching|d.Dirty,this.cleanups=[],this.cleanupsLength=0,void 0!==t&&(this.fn=t),e&&w(this,e)}fn(){}get active(){return!(1024&this.flags)}pause(){this.flags|=256}resume(){(this.flags&=-257)&(d.Dirty|d.Pending)&&this.notify()}notify(){!(256&this.flags)&&this.dirty&&this.run()}run(){if(!this.active)return this.fn();eX(this);let e=E(this);try{return this.fn()}finally{x(this,e);let t=this.flags;(t&(128|d.Recursed))==(128|d.Recursed)&&(this.flags=t&~d.Recursed,this.notify())}}stop(){if(!this.active)return;this.flags=1024;let e=this.deps;for(;void 0!==e;)e=S(e,this);let t=this.subs;void 0!==t&&S(t),eX(this)}get dirty(){let e=this.flags;if(e&d.Dirty)return!0;if(e&d.Pending)if(m(this.deps,this))return this.flags=e|d.Dirty,!0;else this.flags=e&~d.Pending;return!1}}function eF(e,t){e.effect instanceof ez&&(e=e.effect.fn);let i=new ez(e);if(t){let{onStop:e,scheduler:s}=t;if(e){t.onStop=void 0;let s=i.stop.bind(i);i.stop=()=>{s(),e()}}s&&(t.scheduler=void 0,i.notify=()=>{256&i.flags||s()}),n(i,t)}try{i.run()}catch(e){throw i.stop(),e}let s=i.run.bind(i);return s.effect=i,s}function eG(e){e.effect.stop()}let eB=[];function eq(){eB.push(t),y()}function eJ(){if(void 0===t){eB.push(void 0);for(let e=eB.length-1;e>=0;e--)if(void 0!==eB[e]){y(eB[e]);break}}else eB.push(t)}function eQ(){eB.length?y(eB.pop()):y()}function eX(e){let t=e.cleanupsLength;if(t){for(let i=0;i<t;i++)e.cleanups[i]();e.cleanupsLength=0}}function eZ(e,i=!1){t instanceof ez&&(t.cleanups[t.cleanupsLength++]=()=>(function(e){let t=y();try{e()}finally{y(t)}})(e))}class e${constructor(t=!1){this.deps=void 0,this.depsTail=void 0,this.subs=void 0,this.subsTail=void 0,this.flags=0,this.cleanups=[],this.cleanupsLength=0,!t&&e&&w(this,e)}get active(){return!(1024&this.flags)}pause(){if(!(256&this.flags)){this.flags|=256;for(let e=this.deps;void 0!==e;e=e.nextDep){let t=e.dep;"pause"in t&&t.pause()}}}resume(){let e=this.flags;if(256&e){this.flags=-257&e;for(let e=this.deps;void 0!==e;e=e.nextDep){let t=e.dep;"resume"in t&&t.resume()}}}run(t){let i=e;try{return e=this,t()}finally{e=i}}stop(){if(!this.active)return;this.flags=1024;let e=this.deps;for(;void 0!==e;){let t=e.dep;"stop"in t?(e=e.nextDep,t.stop()):e=S(e,this)}let t=this.subs;void 0!==t&&S(t),eX(this)}}function e0(e){return new e$(e)}function e1(){return e}function e2(t){try{return e}finally{e=t}}function e3(t,i=!1){void 0!==e&&(e.cleanups[e.cleanupsLength++]=t)}class e4{constructor(e,t){this.fn=e,this.setter=t,this._value=void 0,this.subs=void 0,this.subsTail=void 0,this.deps=void 0,this.depsTail=void 0,this.flags=d.Mutable|d.Dirty,this.__v_isRef=!0,this.__v_isReadonly=!t}get effect(){return this}get dep(){return this}get _dirty(){let e=this.flags;if(e&d.Dirty)return!0;if(e&d.Pending)if(m(this.deps,this))return this.flags=e|d.Dirty,!0;else this.flags=e&~d.Pending;return!1}set _dirty(e){e?this.flags|=d.Dirty:this.flags&=~(d.Dirty|d.Pending)}get value(){let i=this.flags;if(i&d.Dirty||i&d.Pending&&m(this.deps,this)){if(this.update()){let e=this.subs;void 0!==e&&A(e)}}else i&d.Pending&&(this.flags=i&~d.Pending);return void 0!==t?w(this,t):void 0!==e&&w(this,e),this._value}set value(e){this.setter&&this.setter(e)}update(){let e=E(this);try{let e=this._value,t=this.fn(e);if(!Object.is(e,t))return this._value=t,!0;return!1}finally{x(this,e)}}}function e6(e,t,i=!1){let s,r;return"function"==typeof e?s=e:(s=e.get,r=e.set),new e4(s,r)}let e5={GET:"get",HAS:"has",ITERATE:"iterate"},e8={SET:"set",ADD:"add",DELETE:"delete",CLEAR:"clear"},e7={SKIP:"__v_skip",IS_REACTIVE:"__v_isReactive",IS_READONLY:"__v_isReadonly",IS_SHALLOW:"__v_isShallow",RAW:"__v_raw",IS_REF:"__v_isRef"},e9={WATCH_GETTER:2,2:"WATCH_GETTER",WATCH_CALLBACK:3,3:"WATCH_CALLBACK",WATCH_CLEANUP:4,4:"WATCH_CLEANUP"},te={};function tt(){return i}function ti(e,t=!1,s=i){if(s){let{call:t}=s.options;t?s.cleanups[s.cleanupsLength++]=()=>t(e,4):s.cleanups[s.cleanupsLength++]=e}}class ts extends ez{constructor(e,t,n=s){let l,{deep:o,once:a,call:f}=n,c=!1,h=!1;if(ex(e)?(l=()=>e.value,c=ey(e)):eg(e)?(l=()=>tr(e,o),c=!0):u(e)?(h=!0,c=e.some(e=>eg(e)||ey(e)),l=()=>e.map(e=>ex(e)?e.value:eg(e)?tr(e,o):"function"==typeof e?f?f(e,2):e():void 0)):l="function"==typeof e?t?f?()=>f(e,2):e:()=>{if(this.cleanupsLength){let e=y();try{eX(this)}finally{y(e)}}let t=i;i=this;try{return f?f(e,3,[this.boundCleanup]):e(this.boundCleanup)}finally{i=t}}:r,t&&o){let e=l,t=!0===o?1/0:o;l=()=>tl(e(),t)}if(super(l),this.cb=t,this.options=n,this.boundCleanup=e=>ti(e,!1,this),this.forceTrigger=c,this.isMultiSource=h,a&&t){let e=t;t=(...t)=>{e(...t),this.stop()}}this.cb=t,this.oldValue=h?Array(e.length).fill(te):te}run(e=!1){let t=this.oldValue,s=this.oldValue=super.run();if(!this.cb)return;let{immediate:r,deep:n,call:l}=this.options;if((!e||r)&&(n||this.forceTrigger||(this.isMultiSource?s.some((e,i)=>!Object.is(e,t[i])):!Object.is(s,t)))){eX(this);let e=i;i=this;try{let e=[s,t===te?void 0:this.isMultiSource&&t[0]===te?[]:t,this.boundCleanup];l?l(this.cb,3,e):this.cb(...e)}finally{i=e}}}}function tr(e,t){return t?e:ey(e)||!1===t||0===t?tl(e,1):tl(e)}function tn(e,t,i=s){let r=new ts(e,t,i);r.run(!0);let n=r.stop.bind(r);return n.pause=r.pause.bind(r),n.resume=r.resume.bind(r),n.stop=n,n}function tl(e,t=1/0,i){if(t<=0||!a(e)||e.__v_skip||((i=i||new Map).get(e)||0)>=t)return e;if(i.set(e,t),t--,ex(e))tl(e.value,t,i);else if(u(e))for(let s=0;s<e.length;s++)tl(e[s],t,i);else{let s,r;if("[object Set]"===(s=e,f.call(s))||"[object Map]"===(r=e,f.call(r)))e.forEach(e=>{tl(e,t,i)});else{let s;if("[object Object]"===(s=e,f.call(s))){for(let s in e)tl(e[s],t,i);for(let s of Object.getOwnPropertySymbols(e))Object.prototype.propertyIsEnumerable.call(e,s)&&tl(e[s],t,i)}}}return e}export{C as ARRAY_ITERATE_KEY,eY as EffectFlags,e$ as EffectScope,P as ITERATE_KEY,k as MAP_KEY_ITERATE_KEY,ez as ReactiveEffect,e7 as ReactiveFlags,e5 as TrackOpTypes,e8 as TriggerOpTypes,e9 as WatchErrorCodes,ts as WatcherEffect,e6 as computed,eI as customRef,eF as effect,e0 as effectScope,eJ as enableTracking,e1 as getCurrentScope,tt as getCurrentWatcher,eR as isProxy,eg as isReactive,eb as isReadonly,ex as isRef,ey as isShallow,eS as markRaw,eZ as onEffectCleanup,e3 as onScopeDispose,ti as onWatcherCleanup,eq as pauseTracking,eW as proxyRefs,eh as reactive,M as reactiveReadArray,ep as readonly,eO as ref,eQ as resetTracking,y as setActiveSub,e2 as setCurrentScope,ed as shallowReactive,I as shallowReadArray,ev as shallowReadonly,em as shallowRef,eG as stop,ew as toRaw,eT as toReactive,eE as toReadonly,eH as toRef,eV as toRefs,eC as toValue,L as track,tl as traverse,W as trigger,ej as triggerRef,ek as unref,tn as watch};
|
|
5
|
+
**/let e,t,i;let s={},r=()=>{},n=Object.assign,l=Object.prototype.hasOwnProperty,u=Array.isArray,o=e=>"symbol"==typeof e,a=e=>null!==e&&"object"==typeof e,f=Object.prototype.toString,h=e=>"string"==typeof e&&"NaN"!==e&&"-"!==e[0]&&""+parseInt(e,10)===e;var c,d=((c=d||{})[c.None=0]="None",c[c.Mutable=1]="Mutable",c[c.Watching=2]="Watching",c[c.RecursedCheck=4]="RecursedCheck",c[c.Recursed=8]="Recursed",c[c.Dirty=16]="Dirty",c[c.Pending=32]="Pending",c);let v=[],_=0,p=0,g=0,b=0;function y(e){try{return t}finally{t=e}}function w(){--_||!b||O()}function R(e,t){let i=t.depsTail;if(void 0!==i&&i.dep===e)return;let s=void 0!==i?i.nextDep:t.deps;if(void 0!==s&&s.dep===e){s.version=p,t.depsTail=s;return}let r=e.subsTail;if(void 0!==r&&r.version===p&&r.sub===t)return;let n=t.depsTail=e.subsTail={version:p,dep:e,sub:t,prevDep:i,nextDep:s,prevSub:r,nextSub:void 0};void 0!==s&&(s.prevDep=n),void 0!==i?i.nextDep=n:t.deps=n,void 0!==r?r.nextSub=n:e.subs=n}function S(e,t=e.sub){let i=e.dep,s=e.prevDep,r=e.nextDep,n=e.nextSub,l=e.prevSub;if(void 0!==r?r.prevDep=s:t.depsTail=s,void 0!==s?s.nextDep=r:t.deps=r,void 0!==n?n.prevSub=l:i.subsTail=l,void 0!==l)l.nextSub=n;else if(void 0===(i.subs=n)){let e=i.deps;if(void 0!==e){do e=S(e,i);while(void 0!==e);i.flags|=16}}return r}function T(e){let t,i=e.nextSub;e:for(;;){let s=e.sub,r=s.flags;if(3&r&&(60&r?12&r?4&r?!(48&r)&&function(e,t){let i=t.depsTail;for(;void 0!==i;){if(i===e)return!0;i=i.prevDep}return!1}(e,s)?(s.flags=8|r|32,r&=1):r=0:s.flags=-9&r|32:r=0:s.flags=32|r,2&r&&(v[b++]=s),1&r)){let r=s.subs;if(void 0!==r){e=r,void 0!==r.nextSub&&(t={value:i,prev:t},i=e.nextSub);continue}}if(void 0!==(e=i)){i=e.nextSub;continue}for(;void 0!==t;)if(e=t.value,t=t.prev,void 0!==e){i=e.nextSub;continue e}break}}function E(e){return++p,e.depsTail=void 0,e.flags=-57&e.flags|4,y(e)}function x(e,i){t=i;let s=e.depsTail,r=void 0!==s?s.nextDep:e.deps;for(;void 0!==r;)r=S(r,e);e.flags&=-5}function O(){for(;g<b;){let e=v[g];v[g++]=void 0,e.notify()}g=0,b=0}function m(e,t){let i,s=0;e:for(;;){let r=e.dep,n=r.flags,l=!1;if(16&t.flags)l=!0;else if((17&n)==17){if(r.update()){let e=r.subs;void 0!==e.nextSub&&A(e),l=!0}}else if((33&n)==33){(void 0!==e.nextSub||void 0!==e.prevSub)&&(i={value:e,prev:i}),e=r.deps,t=r,++s;continue}if(!l&&void 0!==e.nextDep){e=e.nextDep;continue}for(;s;){--s;let r=t.subs,n=void 0!==r.nextSub;if(n?(e=i.value,i=i.prev):e=r,l){if(t.update()){n&&A(r),t=e.sub;continue}}else t.flags&=-33;if(t=e.sub,void 0!==e.nextDep){e=e.nextDep;continue e}l=!1}return l}}function A(e){do{let t=e.sub,i=e.nextSub,s=t.flags;(48&s)==32&&(t.flags=16|s),e=i}while(void 0!==e)}class D{constructor(e,t){this.map=e,this.key=t,this._subs=void 0,this.subsTail=void 0,this.flags=d.None}get subs(){return this._subs}set subs(e){this._subs=e,void 0===e&&this.map.delete(this.key)}}let j=new WeakMap,P=Symbol(""),k=Symbol(""),C=Symbol("");function L(e,i,s){if(void 0!==t){let i=j.get(e);i||j.set(e,i=new Map);let r=i.get(s);r||i.set(s,r=new D(i,s)),R(r,t)}}function W(e,t,i,s,r,n){let l=j.get(e);if(!l)return;let a=e=>{void 0!==e&&void 0!==e.subs&&(T(e.subs),A(e.subs))};if(++_,"clear"===t)l.forEach(a);else{let r=u(e),n=r&&h(i);if(r&&"length"===i){let e=Number(s);l.forEach((t,i)=>{("length"===i||i===C||!o(i)&&i>=e)&&a(t)})}else switch((void 0!==i||l.has(void 0))&&a(l.get(i)),n&&a(l.get(C)),t){case"add":if(r)n&&a(l.get("length"));else{let t;a(l.get(P));"[object Map]"===(t=e,f.call(t))&&a(l.get(k))}break;case"delete":if(!r){let t;a(l.get(P));"[object Map]"===(t=e,f.call(t))&&a(l.get(k))}break;case"set":let c;"[object Map]"===(c=e,f.call(c))&&a(l.get(P))}}w()}function M(e){let t=eS(e);return t===e?t:(L(t,"iterate",C),ew(e)?t:t.map(eE))}function I(e){return L(e=eS(e),"iterate",C),e}function V(e,t){return ey(e)?eb(e)?ex(eE(t)):ex(t):eE(t)}let N={__proto__:null,[Symbol.iterator](){return K(this,Symbol.iterator,e=>V(this,e))},concat(...e){return M(this).concat(...e.map(e=>u(e)?M(e):e))},entries(){return K(this,"entries",e=>(e[1]=V(this,e[1]),e))},every(e,t){return U(this,"every",e,t,void 0,arguments)},filter(e,t){return U(this,"filter",e,t,e=>e.map(e=>V(this,e)),arguments)},find(e,t){return U(this,"find",e,t,e=>V(this,e),arguments)},findIndex(e,t){return U(this,"findIndex",e,t,void 0,arguments)},findLast(e,t){return U(this,"findLast",e,t,e=>V(this,e),arguments)},findLastIndex(e,t){return U(this,"findLastIndex",e,t,void 0,arguments)},forEach(e,t){return U(this,"forEach",e,t,void 0,arguments)},includes(...e){return z(this,"includes",e)},indexOf(...e){return z(this,"indexOf",e)},join(e){return M(this).join(e)},lastIndexOf(...e){return z(this,"lastIndexOf",e)},map(e,t){return U(this,"map",e,t,void 0,arguments)},pop(){return F(this,"pop")},push(...e){return F(this,"push",e)},reduce(e,...t){return Y(this,"reduce",e,t)},reduceRight(e,...t){return Y(this,"reduceRight",e,t)},shift(){return F(this,"shift")},some(e,t){return U(this,"some",e,t,void 0,arguments)},splice(...e){return F(this,"splice",e)},toReversed(){return M(this).toReversed()},toSorted(e){return M(this).toSorted(e)},toSpliced(...e){return M(this).toSpliced(...e)},unshift(...e){return F(this,"unshift",e)},values(){return K(this,"values",e=>V(this,e))}};function K(e,t,i){let s=I(e),r=s[t]();return s===e||ew(e)||(r._next=r.next,r.next=()=>{let e=r._next();return e.done||(e.value=i(e.value)),e}),r}let H=Array.prototype;function U(e,t,i,s,r,n){let l=I(e),u=l!==e&&!ew(e),o=l[t];if(o!==H[t]){let t=o.apply(e,n);return u?eE(t):t}let a=i;l!==e&&(u?a=function(t,s){return i.call(this,V(e,t),s,e)}:i.length>2&&(a=function(t,s){return i.call(this,t,s,e)}));let f=o.call(l,a,s);return u&&r?r(f):f}function Y(e,t,i,s){let r=I(e),n=i;return r!==e&&(ew(e)?i.length>3&&(n=function(t,s,r){return i.call(this,t,s,r,e)}):n=function(t,s,r){return i.call(this,t,V(e,s),r,e)}),r[t](n,...s)}function z(e,t,i){let s=eS(e);L(s,"iterate",C);let r=s[t](...i);return(-1===r||!1===r)&&eR(i[0])?(i[0]=eS(i[0]),s[t](...i)):r}function F(e,t,i=[]){++_;let s=y(),r=eS(e)[t].apply(e,i);return y(s),w(),r}let G=function(e){let t=Object.create(null);for(let i of e.split(","))t[i]=1;return e=>e in t}("__proto__,__v_isRef,__isVue"),B=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>"arguments"!==e&&"caller"!==e).map(e=>Symbol[e]).filter(o));function q(e){o(e)||(e=String(e));let t=eS(this);return L(t,"has",e),t.hasOwnProperty(e)}class J{constructor(e=!1,t=!1){this._isReadonly=e,this._isShallow=t}get(e,t,i){if("__v_skip"===t)return e.__v_skip;let s=this._isReadonly,r=this._isShallow;if("__v_isReactive"===t)return!s;if("__v_isReadonly"===t)return s;if("__v_isShallow"===t)return r;if("__v_raw"===t)return i===(s?r?ec:eh:r?ef:ea).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(i)?e:void 0;let n=u(e);if(!s){let e;if(n&&(e=N[t]))return e;if("hasOwnProperty"===t)return q}let l=eO(e),f=Reflect.get(e,t,l?e:i);if(l&&"value"!==t||(o(t)?B.has(t):G(t))||(s||L(e,"get",t),r))return f;if(eO(f)){let e=n&&h(t)?f:f.value;return s&&a(e)?e_(e):e}return a(f)?s?e_(f):ed(f):f}}class Q extends J{constructor(e=!1){super(!1,e)}set(e,t,i,s){let r=e[t],n=u(e)&&h(t);if(!this._isShallow){let e=ey(r);if(ew(i)||ey(i)||(r=eS(r),i=eS(i)),!n&&eO(r)&&!eO(i))if(e)return!0;else return r.value=i,!0}let o=n?Number(t)<e.length:l.call(e,t),a=Reflect.set(e,t,i,eO(e)?e:s);return e===eS(s)&&(o?Object.is(i,r)||W(e,"set",t,i):W(e,"add",t,i)),a}deleteProperty(e,t){let i=l.call(e,t);e[t];let s=Reflect.deleteProperty(e,t);return s&&i&&W(e,"delete",t,void 0),s}has(e,t){let i=Reflect.has(e,t);return o(t)&&B.has(t)||L(e,"has",t),i}ownKeys(e){return L(e,"iterate",u(e)?"length":P),Reflect.ownKeys(e)}}class X extends J{constructor(e=!1){super(!0,e)}set(e,t){return!0}deleteProperty(e,t){return!0}}let Z=new Q,$=new X,ee=new Q(!0),et=new X(!0),ei=e=>e;function es(e){return function(){return"delete"!==e&&("clear"===e?void 0:this)}}function er(e,t){let i,s=(n(i={get(i){let s=this.__v_raw,r=eS(s),n=eS(i);e||(Object.is(i,n)||L(r,"get",i),L(r,"get",n));let{has:l}=Reflect.getPrototypeOf(r),u=t?ei:e?ex:eE;return l.call(r,i)?u(s.get(i)):l.call(r,n)?u(s.get(n)):void(s!==r&&s.get(i))},get size(){let t=this.__v_raw;return e||L(eS(t),"iterate",P),t.size},has(t){let i=this.__v_raw,s=eS(i),r=eS(t);return e||(Object.is(t,r)||L(s,"has",t),L(s,"has",r)),t===r?i.has(t):i.has(t)||i.has(r)},forEach(i,s){let r=this,n=r.__v_raw,l=eS(n),u=t?ei:e?ex:eE;return e||L(l,"iterate",P),n.forEach((e,t)=>i.call(s,u(e),u(t),r))}},e?{add:es("add"),set:es("set"),delete:es("delete"),clear:es("clear")}:{add(e){t||ew(e)||ey(e)||(e=eS(e));let i=eS(this);return Reflect.getPrototypeOf(i).has.call(i,e)||(i.add(e),W(i,"add",e,e)),this},set(e,i){t||ew(i)||ey(i)||(i=eS(i));let s=eS(this),{has:r,get:n}=Reflect.getPrototypeOf(s),l=r.call(s,e);l||(e=eS(e),l=r.call(s,e));let u=n.call(s,e);return(s.set(e,i),l)?Object.is(i,u)||W(s,"set",e,i):W(s,"add",e,i),this},delete(e){let t=eS(this),{has:i,get:s}=Reflect.getPrototypeOf(t),r=i.call(t,e);r||(e=eS(e),r=i.call(t,e)),s&&s.call(t,e);let n=t.delete(e);return r&&W(t,"delete",e,void 0),n},clear(){let e=eS(this),t=0!==e.size,i=e.clear();return t&&W(e,"clear",void 0,void 0),i}}),["keys","values","entries",Symbol.iterator].forEach(s=>{i[s]=function(...i){let r,n=this.__v_raw,l=eS(n),u="[object Map]"===(r=l,f.call(r)),o="entries"===s||s===Symbol.iterator&&u,a=n[s](...i),h=t?ei:e?ex:eE;return e||L(l,"iterate","keys"===s&&u?k:P),{next(){let{value:e,done:t}=a.next();return t?{value:e,done:t}:{value:o?[h(e[0]),h(e[1])]:h(e),done:t}},[Symbol.iterator](){return this}}}}),i);return(t,i,r)=>"__v_isReactive"===i?!e:"__v_isReadonly"===i?e:"__v_raw"===i?t:Reflect.get(l.call(s,i)&&i in t?s:t,i,r)}let en={get:er(!1,!1)},el={get:er(!1,!0)},eu={get:er(!0,!1)},eo={get:er(!0,!0)},ea=new WeakMap,ef=new WeakMap,eh=new WeakMap,ec=new WeakMap;function ed(e){return ey(e)?e:eg(e,!1,Z,en,ea)}function ev(e){return eg(e,!1,ee,el,ef)}function e_(e){return eg(e,!0,$,eu,eh)}function ep(e){return eg(e,!0,et,eo,ec)}function eg(e,t,i,s,r){var n;let l;if(!a(e)||e.__v_raw&&!(t&&e.__v_isReactive))return e;let u=(n=e).__v_skip||!Object.isExtensible(n)?0:function(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}((l=n,f.call(l)).slice(8,-1));if(0===u)return e;let o=r.get(e);if(o)return o;let h=new Proxy(e,2===u?s:i);return r.set(e,h),h}function eb(e){return ey(e)?eb(e.__v_raw):!!(e&&e.__v_isReactive)}function ey(e){return!!(e&&e.__v_isReadonly)}function ew(e){return!!(e&&e.__v_isShallow)}function eR(e){return!!e&&!!e.__v_raw}function eS(e){let t=e&&e.__v_raw;return t?eS(t):e}function eT(e){return!l.call(e,"__v_skip")&&Object.isExtensible(e)&&((e,t,i,s=!1)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:s,value:i})})(e,"__v_skip",!0),e}let eE=e=>a(e)?ed(e):e,ex=e=>a(e)?e_(e):e;function eO(e){return!!e&&!0===e.__v_isRef}function em(e){return eD(e,eE)}function eA(e){return eD(e)}function eD(e,t){return eO(e)?e:new ej(e,t)}class ej{constructor(e,t){this.subs=void 0,this.subsTail=void 0,this.flags=d.Mutable,this.__v_isRef=!0,this.__v_isShallow=!1,this._oldValue=this._rawValue=t?eS(e):e,this._value=t?t(e):e,this._wrap=t,this.__v_isShallow=!t}get dep(){return this}get value(){if(ek(this),this.flags&d.Dirty&&this.update()){let e=this.subs;void 0!==e&&A(e)}return this._value}set value(e){let t=this._rawValue,i=this.__v_isShallow||ew(e)||ey(e);if(!Object.is(e=i?e:eS(e),t)){this.flags|=d.Dirty,this._rawValue=e,this._value=!i&&this._wrap?this._wrap(e):e;let t=this.subs;void 0!==t&&(T(t),_||O())}}update(){return this.flags&=~d.Dirty,!Object.is(this._oldValue,this._oldValue=this._rawValue)}}function eP(e){let t=e.dep;void 0!==t&&void 0!==t.subs&&(T(t.subs),A(t.subs),_||O())}function ek(e){void 0!==t&&R(e,t)}function eC(e){return eO(e)?e.value:e}function eL(e){return"function"==typeof e?e():eC(e)}let eW={get:(e,t,i)=>"__v_raw"===t?e:eC(Reflect.get(e,t,i)),set:(e,t,i,s)=>{let r=e[t];return eO(r)&&!eO(i)?(r.value=i,!0):Reflect.set(e,t,i,s)}};function eM(e){return eb(e)?e:new Proxy(e,eW)}class eI{constructor(e){this.subs=void 0,this.subsTail=void 0,this.flags=d.None,this.__v_isRef=!0,this._value=void 0;let{get:t,set:i}=e(()=>ek(this),()=>eP(this));this._get=t,this._set=i}get dep(){return this}get value(){return this._value=this._get()}set value(e){this._set(e)}}function eV(e){return new eI(e)}function eN(e){let t=u(e)?Array(e.length):{};for(let i in e)t[i]=new eK(e,i,void 0);return t}class eK{constructor(e,t,i){this._object=e,this._key=t,this._defaultValue=i,this.__v_isRef=!0,this._value=void 0,this._raw=eS(e);let s=!0,r=e;if(!u(e)||!h(String(t)))do s=!eR(r)||ew(r);while(s&&(r=r.__v_raw));this._shallow=s}get value(){let e=this._object[this._key];return this._shallow&&(e=eC(e)),this._value=void 0===e?this._defaultValue:e}set value(e){if(this._shallow&&eO(this._raw[this._key])){let t=this._object[this._key];if(eO(t)){t.value=e;return}}this._object[this._key]=e}get dep(){var e,t;let i;return e=this._raw,t=this._key,(i=j.get(e))&&i.get(t)}}class eH{constructor(e){this._getter=e,this.__v_isRef=!0,this.__v_isReadonly=!0,this._value=void 0}get value(){return this._value=this._getter()}}function eU(e,t,i){if(eO(e))return e;if("function"==typeof e)return new eH(e);if(!a(e)||!(arguments.length>1))return em(e);return new eK(e,t,i)}let eY={ALLOW_RECURSE:128,128:"ALLOW_RECURSE",PAUSED:256,256:"PAUSED",STOP:1024,1024:"STOP"};class ez{constructor(t){this.deps=void 0,this.depsTail=void 0,this.subs=void 0,this.subsTail=void 0,this.flags=d.Watching|d.Dirty,this.cleanups=[],this.cleanupsLength=0,void 0!==t&&(this.fn=t),e&&R(this,e)}fn(){}get active(){return!(1024&this.flags)}pause(){this.flags|=256}resume(){(this.flags&=-257)&(d.Dirty|d.Pending)&&this.notify()}notify(){!(256&this.flags)&&this.dirty&&this.run()}run(){if(!this.active)return this.fn();eX(this);let e=E(this);try{return this.fn()}finally{x(this,e);let t=this.flags;(t&(128|d.Recursed))==(128|d.Recursed)&&(this.flags=t&~d.Recursed,this.notify())}}stop(){if(!this.active)return;this.flags=1024;let e=this.deps;for(;void 0!==e;)e=S(e,this);let t=this.subs;void 0!==t&&S(t),eX(this)}get dirty(){let e=this.flags;if(e&d.Dirty)return!0;if(e&d.Pending)if(m(this.deps,this))return this.flags=e|d.Dirty,!0;else this.flags=e&~d.Pending;return!1}}function eF(e,t){e.effect instanceof ez&&(e=e.effect.fn);let i=new ez(e);if(t){let{onStop:e,scheduler:s}=t;if(e){t.onStop=void 0;let s=i.stop.bind(i);i.stop=()=>{s(),e()}}s&&(t.scheduler=void 0,i.notify=()=>{256&i.flags||s()}),n(i,t)}try{i.run()}catch(e){throw i.stop(),e}let s=i.run.bind(i);return s.effect=i,s}function eG(e){e.effect.stop()}let eB=[];function eq(){eB.push(t),y()}function eJ(){if(void 0===t){eB.push(void 0);for(let e=eB.length-1;e>=0;e--)if(void 0!==eB[e]){y(eB[e]);break}}else eB.push(t)}function eQ(){eB.length?y(eB.pop()):y()}function eX(e){let t=e.cleanupsLength;if(t){for(let i=0;i<t;i++)e.cleanups[i]();e.cleanupsLength=0}}function eZ(e,i=!1){t instanceof ez&&(t.cleanups[t.cleanupsLength++]=()=>(function(e){let t=y();try{e()}finally{y(t)}})(e))}class e${constructor(t=!1){this.deps=void 0,this.depsTail=void 0,this.subs=void 0,this.subsTail=void 0,this.flags=0,this.cleanups=[],this.cleanupsLength=0,!t&&e&&R(this,e)}get active(){return!(1024&this.flags)}pause(){if(!(256&this.flags)){this.flags|=256;for(let e=this.deps;void 0!==e;e=e.nextDep){let t=e.dep;"pause"in t&&t.pause()}}}resume(){let e=this.flags;if(256&e){this.flags=-257&e;for(let e=this.deps;void 0!==e;e=e.nextDep){let t=e.dep;"resume"in t&&t.resume()}}}run(t){let i=e;try{return e=this,t()}finally{e=i}}stop(){if(!this.active)return;this.flags=1024;let e=this.deps;for(;void 0!==e;){let t=e.dep;"stop"in t?(e=e.nextDep,t.stop()):e=S(e,this)}let t=this.subs;void 0!==t&&S(t),eX(this)}}function e0(e){return new e$(e)}function e1(){return e}function e2(t){try{return e}finally{e=t}}function e3(t,i=!1){void 0!==e&&(e.cleanups[e.cleanupsLength++]=t)}class e4{constructor(e,t){this.fn=e,this.setter=t,this._value=void 0,this.subs=void 0,this.subsTail=void 0,this.deps=void 0,this.depsTail=void 0,this.flags=d.Mutable|d.Dirty,this.__v_isRef=!0,this.__v_isReadonly=!t}get effect(){return this}get dep(){return this}get _dirty(){let e=this.flags;if(e&d.Dirty)return!0;if(e&d.Pending)if(m(this.deps,this))return this.flags=e|d.Dirty,!0;else this.flags=e&~d.Pending;return!1}set _dirty(e){e?this.flags|=d.Dirty:this.flags&=~(d.Dirty|d.Pending)}get value(){let i=this.flags;if(i&d.Dirty||i&d.Pending&&m(this.deps,this)){if(this.update()){let e=this.subs;void 0!==e&&A(e)}}else i&d.Pending&&(this.flags=i&~d.Pending);return void 0!==t?R(this,t):void 0!==e&&R(this,e),this._value}set value(e){this.setter&&this.setter(e)}update(){let e=E(this);try{let e=this._value,t=this.fn(e);if(!Object.is(e,t))return this._value=t,!0;return!1}finally{x(this,e)}}}function e6(e,t,i=!1){let s,r;return"function"==typeof e?s=e:(s=e.get,r=e.set),new e4(s,r)}let e5={GET:"get",HAS:"has",ITERATE:"iterate"},e8={SET:"set",ADD:"add",DELETE:"delete",CLEAR:"clear"},e7={SKIP:"__v_skip",IS_REACTIVE:"__v_isReactive",IS_READONLY:"__v_isReadonly",IS_SHALLOW:"__v_isShallow",RAW:"__v_raw",IS_REF:"__v_isRef"},e9={WATCH_GETTER:2,2:"WATCH_GETTER",WATCH_CALLBACK:3,3:"WATCH_CALLBACK",WATCH_CLEANUP:4,4:"WATCH_CLEANUP"},te={};function tt(){return i}function ti(e,t=!1,s=i){if(s){let{call:t}=s.options;t?s.cleanups[s.cleanupsLength++]=()=>t(e,4):s.cleanups[s.cleanupsLength++]=e}}class ts extends ez{constructor(e,t,n=s){let l,{deep:o,once:a,call:f}=n,h=!1,c=!1;if(eO(e)?(l=()=>e.value,h=ew(e)):eb(e)?(l=()=>tr(e,o),h=!0):u(e)?(c=!0,h=e.some(e=>eb(e)||ew(e)),l=()=>e.map(e=>eO(e)?e.value:eb(e)?tr(e,o):"function"==typeof e?f?f(e,2):e():void 0)):l="function"==typeof e?t?f?()=>f(e,2):e:()=>{if(this.cleanupsLength){let e=y();try{eX(this)}finally{y(e)}}let t=i;i=this;try{return f?f(e,3,[this.boundCleanup]):e(this.boundCleanup)}finally{i=t}}:r,t&&o){let e=l,t=!0===o?1/0:o;l=()=>tl(e(),t)}if(super(l),this.cb=t,this.options=n,this.boundCleanup=e=>ti(e,!1,this),this.forceTrigger=h,this.isMultiSource=c,a&&t){let e=t;t=(...t)=>{e(...t),this.stop()}}this.cb=t,this.oldValue=c?Array(e.length).fill(te):te}run(e=!1){let t=this.oldValue,s=this.oldValue=super.run();if(!this.cb)return;let{immediate:r,deep:n,call:l}=this.options;if((!e||r)&&(n||this.forceTrigger||(this.isMultiSource?s.some((e,i)=>!Object.is(e,t[i])):!Object.is(s,t)))){eX(this);let e=i;i=this;try{let e=[s,t===te?void 0:this.isMultiSource&&t[0]===te?[]:t,this.boundCleanup];l?l(this.cb,3,e):this.cb(...e)}finally{i=e}}}}function tr(e,t){return t?e:ew(e)||!1===t||0===t?tl(e,1):tl(e)}function tn(e,t,i=s){let r=new ts(e,t,i);r.run(!0);let n=r.stop.bind(r);return n.pause=r.pause.bind(r),n.resume=r.resume.bind(r),n.stop=n,n}function tl(e,t=1/0,i){if(t<=0||!a(e)||e.__v_skip||((i=i||new Map).get(e)||0)>=t)return e;if(i.set(e,t),t--,eO(e))tl(e.value,t,i);else if(u(e))for(let s=0;s<e.length;s++)tl(e[s],t,i);else{let s,r;if("[object Set]"===(s=e,f.call(s))||"[object Map]"===(r=e,f.call(r)))e.forEach(e=>{tl(e,t,i)});else{let s;if("[object Object]"===(s=e,f.call(s))){for(let s in e)tl(e[s],t,i);for(let s of Object.getOwnPropertySymbols(e))Object.prototype.propertyIsEnumerable.call(e,s)&&tl(e[s],t,i)}}}return e}export{C as ARRAY_ITERATE_KEY,eY as EffectFlags,e$ as EffectScope,P as ITERATE_KEY,k as MAP_KEY_ITERATE_KEY,ez as ReactiveEffect,e7 as ReactiveFlags,e5 as TrackOpTypes,e8 as TriggerOpTypes,e9 as WatchErrorCodes,ts as WatcherEffect,e6 as computed,eV as customRef,eF as effect,e0 as effectScope,eJ as enableTracking,e1 as getCurrentScope,tt as getCurrentWatcher,eR as isProxy,eb as isReactive,ey as isReadonly,eO as isRef,ew as isShallow,eT as markRaw,eZ as onEffectCleanup,e3 as onScopeDispose,ti as onWatcherCleanup,eq as pauseTracking,eM as proxyRefs,ed as reactive,M as reactiveReadArray,e_ as readonly,em as ref,eQ as resetTracking,y as setActiveSub,e2 as setCurrentScope,ev as shallowReactive,I as shallowReadArray,ep as shallowReadonly,eA as shallowRef,eG as stop,eS as toRaw,eE as toReactive,ex as toReadonly,eU as toRef,eN as toRefs,eL as toValue,L as track,tl as traverse,W as trigger,eP as triggerRef,eC as unref,tn as watch};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/reactivity v3.6.0-alpha.
|
|
2
|
+
* @vue/reactivity v3.6.0-alpha.5
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -476,10 +476,16 @@ function shallowReadArray(arr) {
|
|
|
476
476
|
track(arr = toRaw(arr), "iterate", ARRAY_ITERATE_KEY);
|
|
477
477
|
return arr;
|
|
478
478
|
}
|
|
479
|
+
function toWrapped(target, item) {
|
|
480
|
+
if (isReadonly(target)) {
|
|
481
|
+
return isReactive(target) ? toReadonly(toReactive(item)) : toReadonly(item);
|
|
482
|
+
}
|
|
483
|
+
return toReactive(item);
|
|
484
|
+
}
|
|
479
485
|
const arrayInstrumentations = {
|
|
480
486
|
__proto__: null,
|
|
481
487
|
[Symbol.iterator]() {
|
|
482
|
-
return iterator(this, Symbol.iterator,
|
|
488
|
+
return iterator(this, Symbol.iterator, (item) => toWrapped(this, item));
|
|
483
489
|
},
|
|
484
490
|
concat(...args) {
|
|
485
491
|
return reactiveReadArray(this).concat(
|
|
@@ -488,7 +494,7 @@ const arrayInstrumentations = {
|
|
|
488
494
|
},
|
|
489
495
|
entries() {
|
|
490
496
|
return iterator(this, "entries", (value) => {
|
|
491
|
-
value[1] =
|
|
497
|
+
value[1] = toWrapped(this, value[1]);
|
|
492
498
|
return value;
|
|
493
499
|
});
|
|
494
500
|
},
|
|
@@ -496,16 +502,37 @@ const arrayInstrumentations = {
|
|
|
496
502
|
return apply(this, "every", fn, thisArg, void 0, arguments);
|
|
497
503
|
},
|
|
498
504
|
filter(fn, thisArg) {
|
|
499
|
-
return apply(
|
|
505
|
+
return apply(
|
|
506
|
+
this,
|
|
507
|
+
"filter",
|
|
508
|
+
fn,
|
|
509
|
+
thisArg,
|
|
510
|
+
(v) => v.map((item) => toWrapped(this, item)),
|
|
511
|
+
arguments
|
|
512
|
+
);
|
|
500
513
|
},
|
|
501
514
|
find(fn, thisArg) {
|
|
502
|
-
return apply(
|
|
515
|
+
return apply(
|
|
516
|
+
this,
|
|
517
|
+
"find",
|
|
518
|
+
fn,
|
|
519
|
+
thisArg,
|
|
520
|
+
(item) => toWrapped(this, item),
|
|
521
|
+
arguments
|
|
522
|
+
);
|
|
503
523
|
},
|
|
504
524
|
findIndex(fn, thisArg) {
|
|
505
525
|
return apply(this, "findIndex", fn, thisArg, void 0, arguments);
|
|
506
526
|
},
|
|
507
527
|
findLast(fn, thisArg) {
|
|
508
|
-
return apply(
|
|
528
|
+
return apply(
|
|
529
|
+
this,
|
|
530
|
+
"findLast",
|
|
531
|
+
fn,
|
|
532
|
+
thisArg,
|
|
533
|
+
(item) => toWrapped(this, item),
|
|
534
|
+
arguments
|
|
535
|
+
);
|
|
509
536
|
},
|
|
510
537
|
findLastIndex(fn, thisArg) {
|
|
511
538
|
return apply(this, "findLastIndex", fn, thisArg, void 0, arguments);
|
|
@@ -565,7 +592,7 @@ const arrayInstrumentations = {
|
|
|
565
592
|
return noTracking(this, "unshift", args);
|
|
566
593
|
},
|
|
567
594
|
values() {
|
|
568
|
-
return iterator(this, "values",
|
|
595
|
+
return iterator(this, "values", (item) => toWrapped(this, item));
|
|
569
596
|
}
|
|
570
597
|
};
|
|
571
598
|
function iterator(self, method, wrapValue) {
|
|
@@ -596,7 +623,7 @@ function apply(self, method, fn, thisArg, wrappedRetFn, args) {
|
|
|
596
623
|
if (arr !== self) {
|
|
597
624
|
if (needsWrap) {
|
|
598
625
|
wrappedFn = function(item, index) {
|
|
599
|
-
return fn.call(this,
|
|
626
|
+
return fn.call(this, toWrapped(self, item), index, self);
|
|
600
627
|
};
|
|
601
628
|
} else if (fn.length > 2) {
|
|
602
629
|
wrappedFn = function(item, index) {
|
|
@@ -613,7 +640,7 @@ function reduce(self, method, fn, args) {
|
|
|
613
640
|
if (arr !== self) {
|
|
614
641
|
if (!isShallow(self)) {
|
|
615
642
|
wrappedFn = function(acc, item, index) {
|
|
616
|
-
return fn.call(this, acc,
|
|
643
|
+
return fn.call(this, acc, toWrapped(self, item), index, self);
|
|
617
644
|
};
|
|
618
645
|
} else if (fn.length > 3) {
|
|
619
646
|
wrappedFn = function(acc, item, index) {
|
|
@@ -721,13 +748,14 @@ class MutableReactiveHandler extends BaseReactiveHandler {
|
|
|
721
748
|
}
|
|
722
749
|
set(target, key, value, receiver) {
|
|
723
750
|
let oldValue = target[key];
|
|
751
|
+
const isArrayWithIntegerKey = isArray(target) && isIntegerKey(key);
|
|
724
752
|
if (!this._isShallow) {
|
|
725
753
|
const isOldValueReadonly = isReadonly(oldValue);
|
|
726
754
|
if (!isShallow(value) && !isReadonly(value)) {
|
|
727
755
|
oldValue = toRaw(oldValue);
|
|
728
756
|
value = toRaw(value);
|
|
729
757
|
}
|
|
730
|
-
if (!
|
|
758
|
+
if (!isArrayWithIntegerKey && isRef(oldValue) && !isRef(value)) {
|
|
731
759
|
if (isOldValueReadonly) {
|
|
732
760
|
if (!!(process.env.NODE_ENV !== "production")) {
|
|
733
761
|
warn(
|
|
@@ -742,7 +770,7 @@ class MutableReactiveHandler extends BaseReactiveHandler {
|
|
|
742
770
|
}
|
|
743
771
|
}
|
|
744
772
|
}
|
|
745
|
-
const hadKey =
|
|
773
|
+
const hadKey = isArrayWithIntegerKey ? Number(key) < target.length : hasOwn(target, key);
|
|
746
774
|
const result = Reflect.set(
|
|
747
775
|
target,
|
|
748
776
|
key,
|
|
@@ -1316,16 +1344,35 @@ class ObjectRefImpl {
|
|
|
1316
1344
|
this._defaultValue = _defaultValue;
|
|
1317
1345
|
this["__v_isRef"] = true;
|
|
1318
1346
|
this._value = void 0;
|
|
1347
|
+
this._raw = toRaw(_object);
|
|
1348
|
+
let shallow = true;
|
|
1349
|
+
let obj = _object;
|
|
1350
|
+
if (!isArray(_object) || !isIntegerKey(String(_key))) {
|
|
1351
|
+
do {
|
|
1352
|
+
shallow = !isProxy(obj) || isShallow(obj);
|
|
1353
|
+
} while (shallow && (obj = obj["__v_raw"]));
|
|
1354
|
+
}
|
|
1355
|
+
this._shallow = shallow;
|
|
1319
1356
|
}
|
|
1320
1357
|
get value() {
|
|
1321
|
-
|
|
1358
|
+
let val = this._object[this._key];
|
|
1359
|
+
if (this._shallow) {
|
|
1360
|
+
val = unref(val);
|
|
1361
|
+
}
|
|
1322
1362
|
return this._value = val === void 0 ? this._defaultValue : val;
|
|
1323
1363
|
}
|
|
1324
1364
|
set value(newVal) {
|
|
1365
|
+
if (this._shallow && isRef(this._raw[this._key])) {
|
|
1366
|
+
const nestedRef = this._object[this._key];
|
|
1367
|
+
if (isRef(nestedRef)) {
|
|
1368
|
+
nestedRef.value = newVal;
|
|
1369
|
+
return;
|
|
1370
|
+
}
|
|
1371
|
+
}
|
|
1325
1372
|
this._object[this._key] = newVal;
|
|
1326
1373
|
}
|
|
1327
1374
|
get dep() {
|
|
1328
|
-
return getDepFromReactive(
|
|
1375
|
+
return getDepFromReactive(this._raw, this._key);
|
|
1329
1376
|
}
|
|
1330
1377
|
}
|
|
1331
1378
|
class GetterRefImpl {
|
|
@@ -1351,8 +1398,7 @@ function toRef(source, key, defaultValue) {
|
|
|
1351
1398
|
}
|
|
1352
1399
|
}
|
|
1353
1400
|
function propertyToRef(source, key, defaultValue) {
|
|
1354
|
-
|
|
1355
|
-
return isRef(val) ? val : new ObjectRefImpl(source, key, defaultValue);
|
|
1401
|
+
return new ObjectRefImpl(source, key, defaultValue);
|
|
1356
1402
|
}
|
|
1357
1403
|
|
|
1358
1404
|
const EffectFlags = {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/reactivity v3.6.0-alpha.
|
|
2
|
+
* @vue/reactivity v3.6.0-alpha.5
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -509,10 +509,16 @@ var VueReactivity = (function (exports) {
|
|
|
509
509
|
track(arr = toRaw(arr), "iterate", ARRAY_ITERATE_KEY);
|
|
510
510
|
return arr;
|
|
511
511
|
}
|
|
512
|
+
function toWrapped(target, item) {
|
|
513
|
+
if (isReadonly(target)) {
|
|
514
|
+
return isReactive(target) ? toReadonly(toReactive(item)) : toReadonly(item);
|
|
515
|
+
}
|
|
516
|
+
return toReactive(item);
|
|
517
|
+
}
|
|
512
518
|
const arrayInstrumentations = {
|
|
513
519
|
__proto__: null,
|
|
514
520
|
[Symbol.iterator]() {
|
|
515
|
-
return iterator(this, Symbol.iterator,
|
|
521
|
+
return iterator(this, Symbol.iterator, (item) => toWrapped(this, item));
|
|
516
522
|
},
|
|
517
523
|
concat(...args) {
|
|
518
524
|
return reactiveReadArray(this).concat(
|
|
@@ -521,7 +527,7 @@ var VueReactivity = (function (exports) {
|
|
|
521
527
|
},
|
|
522
528
|
entries() {
|
|
523
529
|
return iterator(this, "entries", (value) => {
|
|
524
|
-
value[1] =
|
|
530
|
+
value[1] = toWrapped(this, value[1]);
|
|
525
531
|
return value;
|
|
526
532
|
});
|
|
527
533
|
},
|
|
@@ -529,16 +535,37 @@ var VueReactivity = (function (exports) {
|
|
|
529
535
|
return apply(this, "every", fn, thisArg, void 0, arguments);
|
|
530
536
|
},
|
|
531
537
|
filter(fn, thisArg) {
|
|
532
|
-
return apply(
|
|
538
|
+
return apply(
|
|
539
|
+
this,
|
|
540
|
+
"filter",
|
|
541
|
+
fn,
|
|
542
|
+
thisArg,
|
|
543
|
+
(v) => v.map((item) => toWrapped(this, item)),
|
|
544
|
+
arguments
|
|
545
|
+
);
|
|
533
546
|
},
|
|
534
547
|
find(fn, thisArg) {
|
|
535
|
-
return apply(
|
|
548
|
+
return apply(
|
|
549
|
+
this,
|
|
550
|
+
"find",
|
|
551
|
+
fn,
|
|
552
|
+
thisArg,
|
|
553
|
+
(item) => toWrapped(this, item),
|
|
554
|
+
arguments
|
|
555
|
+
);
|
|
536
556
|
},
|
|
537
557
|
findIndex(fn, thisArg) {
|
|
538
558
|
return apply(this, "findIndex", fn, thisArg, void 0, arguments);
|
|
539
559
|
},
|
|
540
560
|
findLast(fn, thisArg) {
|
|
541
|
-
return apply(
|
|
561
|
+
return apply(
|
|
562
|
+
this,
|
|
563
|
+
"findLast",
|
|
564
|
+
fn,
|
|
565
|
+
thisArg,
|
|
566
|
+
(item) => toWrapped(this, item),
|
|
567
|
+
arguments
|
|
568
|
+
);
|
|
542
569
|
},
|
|
543
570
|
findLastIndex(fn, thisArg) {
|
|
544
571
|
return apply(this, "findLastIndex", fn, thisArg, void 0, arguments);
|
|
@@ -598,7 +625,7 @@ var VueReactivity = (function (exports) {
|
|
|
598
625
|
return noTracking(this, "unshift", args);
|
|
599
626
|
},
|
|
600
627
|
values() {
|
|
601
|
-
return iterator(this, "values",
|
|
628
|
+
return iterator(this, "values", (item) => toWrapped(this, item));
|
|
602
629
|
}
|
|
603
630
|
};
|
|
604
631
|
function iterator(self, method, wrapValue) {
|
|
@@ -629,7 +656,7 @@ var VueReactivity = (function (exports) {
|
|
|
629
656
|
if (arr !== self) {
|
|
630
657
|
if (needsWrap) {
|
|
631
658
|
wrappedFn = function(item, index) {
|
|
632
|
-
return fn.call(this,
|
|
659
|
+
return fn.call(this, toWrapped(self, item), index, self);
|
|
633
660
|
};
|
|
634
661
|
} else if (fn.length > 2) {
|
|
635
662
|
wrappedFn = function(item, index) {
|
|
@@ -646,7 +673,7 @@ var VueReactivity = (function (exports) {
|
|
|
646
673
|
if (arr !== self) {
|
|
647
674
|
if (!isShallow(self)) {
|
|
648
675
|
wrappedFn = function(acc, item, index) {
|
|
649
|
-
return fn.call(this, acc,
|
|
676
|
+
return fn.call(this, acc, toWrapped(self, item), index, self);
|
|
650
677
|
};
|
|
651
678
|
} else if (fn.length > 3) {
|
|
652
679
|
wrappedFn = function(acc, item, index) {
|
|
@@ -754,13 +781,14 @@ var VueReactivity = (function (exports) {
|
|
|
754
781
|
}
|
|
755
782
|
set(target, key, value, receiver) {
|
|
756
783
|
let oldValue = target[key];
|
|
784
|
+
const isArrayWithIntegerKey = isArray(target) && isIntegerKey(key);
|
|
757
785
|
if (!this._isShallow) {
|
|
758
786
|
const isOldValueReadonly = isReadonly(oldValue);
|
|
759
787
|
if (!isShallow(value) && !isReadonly(value)) {
|
|
760
788
|
oldValue = toRaw(oldValue);
|
|
761
789
|
value = toRaw(value);
|
|
762
790
|
}
|
|
763
|
-
if (!
|
|
791
|
+
if (!isArrayWithIntegerKey && isRef(oldValue) && !isRef(value)) {
|
|
764
792
|
if (isOldValueReadonly) {
|
|
765
793
|
{
|
|
766
794
|
warn(
|
|
@@ -775,7 +803,7 @@ var VueReactivity = (function (exports) {
|
|
|
775
803
|
}
|
|
776
804
|
}
|
|
777
805
|
}
|
|
778
|
-
const hadKey =
|
|
806
|
+
const hadKey = isArrayWithIntegerKey ? Number(key) < target.length : hasOwn(target, key);
|
|
779
807
|
const result = Reflect.set(
|
|
780
808
|
target,
|
|
781
809
|
key,
|
|
@@ -1349,16 +1377,35 @@ var VueReactivity = (function (exports) {
|
|
|
1349
1377
|
this._defaultValue = _defaultValue;
|
|
1350
1378
|
this["__v_isRef"] = true;
|
|
1351
1379
|
this._value = void 0;
|
|
1380
|
+
this._raw = toRaw(_object);
|
|
1381
|
+
let shallow = true;
|
|
1382
|
+
let obj = _object;
|
|
1383
|
+
if (!isArray(_object) || !isIntegerKey(String(_key))) {
|
|
1384
|
+
do {
|
|
1385
|
+
shallow = !isProxy(obj) || isShallow(obj);
|
|
1386
|
+
} while (shallow && (obj = obj["__v_raw"]));
|
|
1387
|
+
}
|
|
1388
|
+
this._shallow = shallow;
|
|
1352
1389
|
}
|
|
1353
1390
|
get value() {
|
|
1354
|
-
|
|
1391
|
+
let val = this._object[this._key];
|
|
1392
|
+
if (this._shallow) {
|
|
1393
|
+
val = unref(val);
|
|
1394
|
+
}
|
|
1355
1395
|
return this._value = val === void 0 ? this._defaultValue : val;
|
|
1356
1396
|
}
|
|
1357
1397
|
set value(newVal) {
|
|
1398
|
+
if (this._shallow && isRef(this._raw[this._key])) {
|
|
1399
|
+
const nestedRef = this._object[this._key];
|
|
1400
|
+
if (isRef(nestedRef)) {
|
|
1401
|
+
nestedRef.value = newVal;
|
|
1402
|
+
return;
|
|
1403
|
+
}
|
|
1404
|
+
}
|
|
1358
1405
|
this._object[this._key] = newVal;
|
|
1359
1406
|
}
|
|
1360
1407
|
get dep() {
|
|
1361
|
-
return getDepFromReactive(
|
|
1408
|
+
return getDepFromReactive(this._raw, this._key);
|
|
1362
1409
|
}
|
|
1363
1410
|
}
|
|
1364
1411
|
class GetterRefImpl {
|
|
@@ -1384,8 +1431,7 @@ var VueReactivity = (function (exports) {
|
|
|
1384
1431
|
}
|
|
1385
1432
|
}
|
|
1386
1433
|
function propertyToRef(source, key, defaultValue) {
|
|
1387
|
-
|
|
1388
|
-
return isRef(val) ? val : new ObjectRefImpl(source, key, defaultValue);
|
|
1434
|
+
return new ObjectRefImpl(source, key, defaultValue);
|
|
1389
1435
|
}
|
|
1390
1436
|
|
|
1391
1437
|
const EffectFlags = {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/reactivity v3.6.0-alpha.
|
|
2
|
+
* @vue/reactivity v3.6.0-alpha.5
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
|
-
**/var VueReactivity=function(e){"use strict";let t,i,s,r={},n=()=>{},l=Object.assign,u=Object.prototype.hasOwnProperty,o=Array.isArray,a=e=>"symbol"==typeof e,f=e=>null!==e&&"object"==typeof e,c=Object.prototype.toString,h=e=>"string"==typeof e&&"NaN"!==e&&"-"!==e[0]&&""+parseInt(e,10)===e;var d,v=((d=v||{})[d.None=0]="None",d[d.Mutable=1]="Mutable",d[d.Watching=2]="Watching",d[d.RecursedCheck=4]="RecursedCheck",d[d.Recursed=8]="Recursed",d[d.Dirty=16]="Dirty",d[d.Pending=32]="Pending",d);let p=[],_=0,g=0,b=0,y=0;function R(e){try{return i}finally{i=e}}function w(){--_||!y||m()}function S(e,t){let i=t.depsTail;if(void 0!==i&&i.dep===e)return;let s=void 0!==i?i.nextDep:t.deps;if(void 0!==s&&s.dep===e){s.version=g,t.depsTail=s;return}let r=e.subsTail;if(void 0!==r&&r.version===g&&r.sub===t)return;let n=t.depsTail=e.subsTail={version:g,dep:e,sub:t,prevDep:i,nextDep:s,prevSub:r,nextSub:void 0};void 0!==s&&(s.prevDep=n),void 0!==i?i.nextDep=n:t.deps=n,void 0!==r?r.nextSub=n:e.subs=n}function T(e,t=e.sub){let i=e.dep,s=e.prevDep,r=e.nextDep,n=e.nextSub,l=e.prevSub;if(void 0!==r?r.prevDep=s:t.depsTail=s,void 0!==s?s.nextDep=r:t.deps=r,void 0!==n?n.prevSub=l:i.subsTail=l,void 0!==l)l.nextSub=n;else if(void 0===(i.subs=n)){let e=i.deps;if(void 0!==e){do e=T(e,i);while(void 0!==e);i.flags|=16}}return r}function E(e){let t,i=e.nextSub;e:for(;;){let s=e.sub,r=s.flags;if(3&r&&(60&r?12&r?4&r?!(48&r)&&function(e,t){let i=t.depsTail;for(;void 0!==i;){if(i===e)return!0;i=i.prevDep}return!1}(e,s)?(s.flags=8|r|32,r&=1):r=0:s.flags=-9&r|32:r=0:s.flags=32|r,2&r&&(p[y++]=s),1&r)){let r=s.subs;if(void 0!==r){e=r,void 0!==r.nextSub&&(t={value:i,prev:t},i=e.nextSub);continue}}if(void 0!==(e=i)){i=e.nextSub;continue}for(;void 0!==t;)if(e=t.value,t=t.prev,void 0!==e){i=e.nextSub;continue e}break}}function x(e){return++g,e.depsTail=void 0,e.flags=-57&e.flags|4,R(e)}function O(e,t){i=t;let s=e.depsTail,r=void 0!==s?s.nextDep:e.deps;for(;void 0!==r;)r=T(r,e);e.flags&=-5}function m(){for(;b<y;){let e=p[b];p[b++]=void 0,e.notify()}b=0,y=0}function A(e,t){let i,s=0;e:for(;;){let r=e.dep,n=r.flags,l=!1;if(16&t.flags)l=!0;else if((17&n)==17){if(r.update()){let e=r.subs;void 0!==e.nextSub&&D(e),l=!0}}else if((33&n)==33){(void 0!==e.nextSub||void 0!==e.prevSub)&&(i={value:e,prev:i}),e=r.deps,t=r,++s;continue}if(!l&&void 0!==e.nextDep){e=e.nextDep;continue}for(;s;){--s;let r=t.subs,n=void 0!==r.nextSub;if(n?(e=i.value,i=i.prev):e=r,l){if(t.update()){n&&D(r),t=e.sub;continue}}else t.flags&=-33;if(t=e.sub,void 0!==e.nextDep){e=e.nextDep;continue e}l=!1}return l}}function D(e){do{let t=e.sub,i=e.nextSub,s=t.flags;(48&s)==32&&(t.flags=16|s),e=i}while(void 0!==e)}class j{constructor(e,t){this.map=e,this.key=t,this._subs=void 0,this.subsTail=void 0,this.flags=v.None}get subs(){return this._subs}set subs(e){this._subs=e,void 0===e&&this.map.delete(this.key)}}let P=new WeakMap,k=Symbol(""),C=Symbol(""),L=Symbol("");function W(e,t,s){if(void 0!==i){let t=P.get(e);t||P.set(e,t=new Map);let r=t.get(s);r||t.set(s,r=new j(t,s)),S(r,i)}}function M(e,t,i,s,r,n){let l=P.get(e);if(!l)return;let u=e=>{void 0!==e&&void 0!==e.subs&&(E(e.subs),D(e.subs))};if(++_,"clear"===t)l.forEach(u);else{let r=o(e),n=r&&h(i);if(r&&"length"===i){let e=Number(s);l.forEach((t,i)=>{("length"===i||i===L||!a(i)&&i>=e)&&u(t)})}else switch((void 0!==i||l.has(void 0))&&u(l.get(i)),n&&u(l.get(L)),t){case"add":if(r)n&&u(l.get("length"));else{let t;u(l.get(k));"[object Map]"===(t=e,c.call(t))&&u(l.get(C))}break;case"delete":if(!r){let t;u(l.get(k));"[object Map]"===(t=e,c.call(t))&&u(l.get(C))}break;case"set":let f;"[object Map]"===(f=e,c.call(f))&&u(l.get(k))}}w()}function I(e){let t=eR(e);return t===e?t:(W(t,"iterate",L),eb(e)?t:t.map(ew))}function V(e){return W(e=eR(e),"iterate",L),e}let N={__proto__:null,[Symbol.iterator](){return K(this,Symbol.iterator,ew)},concat(...e){return I(this).concat(...e.map(e=>o(e)?I(e):e))},entries(){return K(this,"entries",e=>(e[1]=ew(e[1]),e))},every(e,t){return U(this,"every",e,t,void 0,arguments)},filter(e,t){return U(this,"filter",e,t,e=>e.map(ew),arguments)},find(e,t){return U(this,"find",e,t,ew,arguments)},findIndex(e,t){return U(this,"findIndex",e,t,void 0,arguments)},findLast(e,t){return U(this,"findLast",e,t,ew,arguments)},findLastIndex(e,t){return U(this,"findLastIndex",e,t,void 0,arguments)},forEach(e,t){return U(this,"forEach",e,t,void 0,arguments)},includes(...e){return z(this,"includes",e)},indexOf(...e){return z(this,"indexOf",e)},join(e){return I(this).join(e)},lastIndexOf(...e){return z(this,"lastIndexOf",e)},map(e,t){return U(this,"map",e,t,void 0,arguments)},pop(){return F(this,"pop")},push(...e){return F(this,"push",e)},reduce(e,...t){return Y(this,"reduce",e,t)},reduceRight(e,...t){return Y(this,"reduceRight",e,t)},shift(){return F(this,"shift")},some(e,t){return U(this,"some",e,t,void 0,arguments)},splice(...e){return F(this,"splice",e)},toReversed(){return I(this).toReversed()},toSorted(e){return I(this).toSorted(e)},toSpliced(...e){return I(this).toSpliced(...e)},unshift(...e){return F(this,"unshift",e)},values(){return K(this,"values",ew)}};function K(e,t,i){let s=V(e),r=s[t]();return s===e||eb(e)||(r._next=r.next,r.next=()=>{let e=r._next();return e.done||(e.value=i(e.value)),e}),r}let H=Array.prototype;function U(e,t,i,s,r,n){let l=V(e),u=l!==e&&!eb(e),o=l[t];if(o!==H[t]){let t=o.apply(e,n);return u?ew(t):t}let a=i;l!==e&&(u?a=function(t,s){return i.call(this,ew(t),s,e)}:i.length>2&&(a=function(t,s){return i.call(this,t,s,e)}));let f=o.call(l,a,s);return u&&r?r(f):f}function Y(e,t,i,s){let r=V(e),n=i;return r!==e&&(eb(e)?i.length>3&&(n=function(t,s,r){return i.call(this,t,s,r,e)}):n=function(t,s,r){return i.call(this,t,ew(s),r,e)}),r[t](n,...s)}function z(e,t,i){let s=eR(e);W(s,"iterate",L);let r=s[t](...i);return(-1===r||!1===r)&&ey(i[0])?(i[0]=eR(i[0]),s[t](...i)):r}function F(e,t,i=[]){++_;let s=R(),r=eR(e)[t].apply(e,i);return R(s),w(),r}let G=function(e){let t=Object.create(null);for(let i of e.split(","))t[i]=1;return e=>e in t}("__proto__,__v_isRef,__isVue"),B=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>"arguments"!==e&&"caller"!==e).map(e=>Symbol[e]).filter(a));function q(e){a(e)||(e=String(e));let t=eR(this);return W(t,"has",e),t.hasOwnProperty(e)}class J{constructor(e=!1,t=!1){this._isReadonly=e,this._isShallow=t}get(e,t,i){if("__v_skip"===t)return e.__v_skip;let s=this._isReadonly,r=this._isShallow;if("__v_isReactive"===t)return!s;if("__v_isReadonly"===t)return s;if("__v_isShallow"===t)return r;if("__v_raw"===t)return i===(s?r?eh:ec:r?ef:ea).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(i)?e:void 0;let n=o(e);if(!s){let e;if(n&&(e=N[t]))return e;if("hasOwnProperty"===t)return q}let l=eT(e),u=Reflect.get(e,t,l?e:i);if(l&&"value"!==t||(a(t)?B.has(t):G(t))||(s||W(e,"get",t),r))return u;if(eT(u)){let e=n&&h(t)?u:u.value;return s&&f(e)?ev(e):e}return f(u)?s?ev(u):ed(u):u}}class Q extends J{constructor(e=!1){super(!1,e)}set(e,t,i,s){let r=e[t];if(!this._isShallow){let t=eg(r);if(eb(i)||eg(i)||(r=eR(r),i=eR(i)),!o(e)&&eT(r)&&!eT(i))if(t)return!0;else return r.value=i,!0}let n=o(e)&&h(t)?Number(t)<e.length:u.call(e,t),l=Reflect.set(e,t,i,eT(e)?e:s);return e===eR(s)&&(n?Object.is(i,r)||M(e,"set",t,i):M(e,"add",t,i)),l}deleteProperty(e,t){let i=u.call(e,t);e[t];let s=Reflect.deleteProperty(e,t);return s&&i&&M(e,"delete",t,void 0),s}has(e,t){let i=Reflect.has(e,t);return a(t)&&B.has(t)||W(e,"has",t),i}ownKeys(e){return W(e,"iterate",o(e)?"length":k),Reflect.ownKeys(e)}}class X extends J{constructor(e=!1){super(!0,e)}set(e,t){return!0}deleteProperty(e,t){return!0}}let Z=new Q,$=new X,ee=new Q(!0),et=new X(!0),ei=e=>e;function es(e){return function(){return"delete"!==e&&("clear"===e?void 0:this)}}function er(e,t){let i,s=(l(i={get(i){let s=this.__v_raw,r=eR(s),n=eR(i);e||(Object.is(i,n)||W(r,"get",i),W(r,"get",n));let{has:l}=Reflect.getPrototypeOf(r),u=t?ei:e?eS:ew;return l.call(r,i)?u(s.get(i)):l.call(r,n)?u(s.get(n)):void(s!==r&&s.get(i))},get size(){let t=this.__v_raw;return e||W(eR(t),"iterate",k),t.size},has(t){let i=this.__v_raw,s=eR(i),r=eR(t);return e||(Object.is(t,r)||W(s,"has",t),W(s,"has",r)),t===r?i.has(t):i.has(t)||i.has(r)},forEach(i,s){let r=this,n=r.__v_raw,l=eR(n),u=t?ei:e?eS:ew;return e||W(l,"iterate",k),n.forEach((e,t)=>i.call(s,u(e),u(t),r))}},e?{add:es("add"),set:es("set"),delete:es("delete"),clear:es("clear")}:{add(e){t||eb(e)||eg(e)||(e=eR(e));let i=eR(this);return Reflect.getPrototypeOf(i).has.call(i,e)||(i.add(e),M(i,"add",e,e)),this},set(e,i){t||eb(i)||eg(i)||(i=eR(i));let s=eR(this),{has:r,get:n}=Reflect.getPrototypeOf(s),l=r.call(s,e);l||(e=eR(e),l=r.call(s,e));let u=n.call(s,e);return(s.set(e,i),l)?Object.is(i,u)||M(s,"set",e,i):M(s,"add",e,i),this},delete(e){let t=eR(this),{has:i,get:s}=Reflect.getPrototypeOf(t),r=i.call(t,e);r||(e=eR(e),r=i.call(t,e)),s&&s.call(t,e);let n=t.delete(e);return r&&M(t,"delete",e,void 0),n},clear(){let e=eR(this),t=0!==e.size,i=e.clear();return t&&M(e,"clear",void 0,void 0),i}}),["keys","values","entries",Symbol.iterator].forEach(s=>{i[s]=function(...i){let r,n=this.__v_raw,l=eR(n),u="[object Map]"===(r=l,c.call(r)),o="entries"===s||s===Symbol.iterator&&u,a=n[s](...i),f=t?ei:e?eS:ew;return e||W(l,"iterate","keys"===s&&u?C:k),{next(){let{value:e,done:t}=a.next();return t?{value:e,done:t}:{value:o?[f(e[0]),f(e[1])]:f(e),done:t}},[Symbol.iterator](){return this}}}}),i);return(t,i,r)=>"__v_isReactive"===i?!e:"__v_isReadonly"===i?e:"__v_raw"===i?t:Reflect.get(u.call(s,i)&&i in t?s:t,i,r)}let en={get:er(!1,!1)},el={get:er(!1,!0)},eu={get:er(!0,!1)},eo={get:er(!0,!0)},ea=new WeakMap,ef=new WeakMap,ec=new WeakMap,eh=new WeakMap;function ed(e){return eg(e)?e:ep(e,!1,Z,en,ea)}function ev(e){return ep(e,!0,$,eu,ec)}function ep(e,t,i,s,r){var n;let l;if(!f(e)||e.__v_raw&&!(t&&e.__v_isReactive))return e;let u=(n=e).__v_skip||!Object.isExtensible(n)?0:function(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}((l=n,c.call(l)).slice(8,-1));if(0===u)return e;let o=r.get(e);if(o)return o;let a=new Proxy(e,2===u?s:i);return r.set(e,a),a}function e_(e){return eg(e)?e_(e.__v_raw):!!(e&&e.__v_isReactive)}function eg(e){return!!(e&&e.__v_isReadonly)}function eb(e){return!!(e&&e.__v_isShallow)}function ey(e){return!!e&&!!e.__v_raw}function eR(e){let t=e&&e.__v_raw;return t?eR(t):e}let ew=e=>f(e)?ed(e):e,eS=e=>f(e)?ev(e):e;function eT(e){return!!e&&!0===e.__v_isRef}function eE(e){return ex(e,ew)}function ex(e,t){return eT(e)?e:new eO(e,t)}class eO{constructor(e,t){this.subs=void 0,this.subsTail=void 0,this.flags=v.Mutable,this.__v_isRef=!0,this.__v_isShallow=!1,this._oldValue=this._rawValue=t?eR(e):e,this._value=t?t(e):e,this._wrap=t,this.__v_isShallow=!t}get dep(){return this}get value(){if(eA(this),this.flags&v.Dirty&&this.update()){let e=this.subs;void 0!==e&&D(e)}return this._value}set value(e){let t=this._rawValue,i=this.__v_isShallow||eb(e)||eg(e);if(!Object.is(e=i?e:eR(e),t)){this.flags|=v.Dirty,this._rawValue=e,this._value=!i&&this._wrap?this._wrap(e):e;let t=this.subs;void 0!==t&&(E(t),_||m())}}update(){return this.flags&=~v.Dirty,!Object.is(this._oldValue,this._oldValue=this._rawValue)}}function em(e){let t=e.dep;void 0!==t&&void 0!==t.subs&&(E(t.subs),D(t.subs),_||m())}function eA(e){void 0!==i&&S(e,i)}function eD(e){return eT(e)?e.value:e}let ej={get:(e,t,i)=>"__v_raw"===t?e:eD(Reflect.get(e,t,i)),set:(e,t,i,s)=>{let r=e[t];return eT(r)&&!eT(i)?(r.value=i,!0):Reflect.set(e,t,i,s)}};class eP{constructor(e){this.subs=void 0,this.subsTail=void 0,this.flags=v.None,this.__v_isRef=!0,this._value=void 0;const{get:t,set:i}=e(()=>eA(this),()=>em(this));this._get=t,this._set=i}get dep(){return this}get value(){return this._value=this._get()}set value(e){this._set(e)}}class ek{constructor(e,t,i){this._object=e,this._key=t,this._defaultValue=i,this.__v_isRef=!0,this._value=void 0}get value(){let e=this._object[this._key];return this._value=void 0===e?this._defaultValue:e}set value(e){this._object[this._key]=e}get dep(){var e,t;let i;return e=eR(this._object),t=this._key,(i=P.get(e))&&i.get(t)}}class eC{constructor(e){this._getter=e,this.__v_isRef=!0,this.__v_isReadonly=!0,this._value=void 0}get value(){return this._value=this._getter()}}function eL(e,t,i){let s=e[t];return eT(s)?s:new ek(e,t,i)}class eW{constructor(e){this.deps=void 0,this.depsTail=void 0,this.subs=void 0,this.subsTail=void 0,this.flags=v.Watching|v.Dirty,this.cleanups=[],this.cleanupsLength=0,void 0!==e&&(this.fn=e),t&&S(this,t)}fn(){}get active(){return!(1024&this.flags)}pause(){this.flags|=256}resume(){(this.flags&=-257)&(v.Dirty|v.Pending)&&this.notify()}notify(){!(256&this.flags)&&this.dirty&&this.run()}run(){if(!this.active)return this.fn();eI(this);let e=x(this);try{return this.fn()}finally{O(this,e);let t=this.flags;(t&(128|v.Recursed))==(128|v.Recursed)&&(this.flags=t&~v.Recursed,this.notify())}}stop(){if(!this.active)return;this.flags=1024;let e=this.deps;for(;void 0!==e;)e=T(e,this);let t=this.subs;void 0!==t&&T(t),eI(this)}get dirty(){let e=this.flags;if(e&v.Dirty)return!0;if(e&v.Pending)if(A(this.deps,this))return this.flags=e|v.Dirty,!0;else this.flags=e&~v.Pending;return!1}}let eM=[];function eI(e){let t=e.cleanupsLength;if(t){for(let i=0;i<t;i++)e.cleanups[i]();e.cleanupsLength=0}}class eV{constructor(e=!1){this.deps=void 0,this.depsTail=void 0,this.subs=void 0,this.subsTail=void 0,this.flags=0,this.cleanups=[],this.cleanupsLength=0,!e&&t&&S(this,t)}get active(){return!(1024&this.flags)}pause(){if(!(256&this.flags)){this.flags|=256;for(let e=this.deps;void 0!==e;e=e.nextDep){let t=e.dep;"pause"in t&&t.pause()}}}resume(){let e=this.flags;if(256&e){this.flags=-257&e;for(let e=this.deps;void 0!==e;e=e.nextDep){let t=e.dep;"resume"in t&&t.resume()}}}run(e){let i=t;try{return t=this,e()}finally{t=i}}stop(){if(!this.active)return;this.flags=1024;let e=this.deps;for(;void 0!==e;){let t=e.dep;"stop"in t?(e=e.nextDep,t.stop()):e=T(e,this)}let t=this.subs;void 0!==t&&T(t),eI(this)}}class eN{constructor(e,t){this.fn=e,this.setter=t,this._value=void 0,this.subs=void 0,this.subsTail=void 0,this.deps=void 0,this.depsTail=void 0,this.flags=v.Mutable|v.Dirty,this.__v_isRef=!0,this.__v_isReadonly=!t}get effect(){return this}get dep(){return this}get _dirty(){let e=this.flags;if(e&v.Dirty)return!0;if(e&v.Pending)if(A(this.deps,this))return this.flags=e|v.Dirty,!0;else this.flags=e&~v.Pending;return!1}set _dirty(e){e?this.flags|=v.Dirty:this.flags&=~(v.Dirty|v.Pending)}get value(){let e=this.flags;if(e&v.Dirty||e&v.Pending&&A(this.deps,this)){if(this.update()){let e=this.subs;void 0!==e&&D(e)}}else e&v.Pending&&(this.flags=e&~v.Pending);return void 0!==i?S(this,i):void 0!==t&&S(this,t),this._value}set value(e){this.setter&&this.setter(e)}update(){let e=x(this);try{let e=this._value,t=this.fn(e);if(!Object.is(e,t))return this._value=t,!0;return!1}finally{O(this,e)}}}let eK={};function eH(e,t=!1,i=s){if(i){let{call:t}=i.options;t?i.cleanups[i.cleanupsLength++]=()=>t(e,4):i.cleanups[i.cleanupsLength++]=e}}class eU extends eW{constructor(e,t,i=r){let l;const{deep:u,once:a,call:f}=i;let c=!1,h=!1;if(eT(e)?(l=()=>e.value,c=eb(e)):e_(e)?(l=()=>eY(e,u),c=!0):o(e)?(h=!0,c=e.some(e=>e_(e)||eb(e)),l=()=>e.map(e=>eT(e)?e.value:e_(e)?eY(e,u):"function"==typeof e?f?f(e,2):e():void 0)):l="function"==typeof e?t?f?()=>f(e,2):e:()=>{if(this.cleanupsLength){let e=R();try{eI(this)}finally{R(e)}}let t=s;s=this;try{return f?f(e,3,[this.boundCleanup]):e(this.boundCleanup)}finally{s=t}}:n,t&&u){const e=l,t=!0===u?1/0:u;l=()=>ez(e(),t)}if(super(l),this.cb=t,this.options=i,this.boundCleanup=e=>eH(e,!1,this),this.forceTrigger=c,this.isMultiSource=h,a&&t){const e=t;t=(...t)=>{e(...t),this.stop()}}this.cb=t,this.oldValue=h?Array(e.length).fill(eK):eK}run(e=!1){let t=this.oldValue,i=this.oldValue=super.run();if(!this.cb)return;let{immediate:r,deep:n,call:l}=this.options;if((!e||r)&&(n||this.forceTrigger||(this.isMultiSource?i.some((e,i)=>!Object.is(e,t[i])):!Object.is(i,t)))){eI(this);let e=s;s=this;try{let e=[i,t===eK?void 0:this.isMultiSource&&t[0]===eK?[]:t,this.boundCleanup];l?l(this.cb,3,e):this.cb(...e)}finally{s=e}}}}function eY(e,t){return t?e:eb(e)||!1===t||0===t?ez(e,1):ez(e)}function ez(e,t=1/0,i){if(t<=0||!f(e)||e.__v_skip||((i=i||new Map).get(e)||0)>=t)return e;if(i.set(e,t),t--,eT(e))ez(e.value,t,i);else if(o(e))for(let s=0;s<e.length;s++)ez(e[s],t,i);else{let s,r;if("[object Set]"===(s=e,c.call(s))||"[object Map]"===(r=e,c.call(r)))e.forEach(e=>{ez(e,t,i)});else{let s;if("[object Object]"===(s=e,c.call(s))){for(let s in e)ez(e[s],t,i);for(let s of Object.getOwnPropertySymbols(e))Object.prototype.propertyIsEnumerable.call(e,s)&&ez(e[s],t,i)}}}return e}return e.ARRAY_ITERATE_KEY=L,e.EffectFlags={ALLOW_RECURSE:128,128:"ALLOW_RECURSE",PAUSED:256,256:"PAUSED",STOP:1024,1024:"STOP"},e.EffectScope=eV,e.ITERATE_KEY=k,e.MAP_KEY_ITERATE_KEY=C,e.ReactiveEffect=eW,e.ReactiveFlags={SKIP:"__v_skip",IS_REACTIVE:"__v_isReactive",IS_READONLY:"__v_isReadonly",IS_SHALLOW:"__v_isShallow",RAW:"__v_raw",IS_REF:"__v_isRef"},e.TrackOpTypes={GET:"get",HAS:"has",ITERATE:"iterate"},e.TriggerOpTypes={SET:"set",ADD:"add",DELETE:"delete",CLEAR:"clear"},e.WatchErrorCodes={WATCH_GETTER:2,2:"WATCH_GETTER",WATCH_CALLBACK:3,3:"WATCH_CALLBACK",WATCH_CLEANUP:4,4:"WATCH_CLEANUP"},e.WatcherEffect=eU,e.computed=function(e,t,i=!1){let s,r;return"function"==typeof e?s=e:(s=e.get,r=e.set),new eN(s,r)},e.customRef=function(e){return new eP(e)},e.effect=function(e,t){e.effect instanceof eW&&(e=e.effect.fn);let i=new eW(e);if(t){let{onStop:e,scheduler:s}=t;if(e){t.onStop=void 0;let s=i.stop.bind(i);i.stop=()=>{s(),e()}}s&&(t.scheduler=void 0,i.notify=()=>{256&i.flags||s()}),l(i,t)}try{i.run()}catch(e){throw i.stop(),e}let s=i.run.bind(i);return s.effect=i,s},e.effectScope=function(e){return new eV(e)},e.enableTracking=function(){if(void 0===i){eM.push(void 0);for(let e=eM.length-1;e>=0;e--)if(void 0!==eM[e]){R(eM[e]);break}}else eM.push(i)},e.getCurrentScope=function(){return t},e.getCurrentWatcher=function(){return s},e.isProxy=ey,e.isReactive=e_,e.isReadonly=eg,e.isRef=eT,e.isShallow=eb,e.markRaw=function(e){return!u.call(e,"__v_skip")&&Object.isExtensible(e)&&((e,t,i,s=!1)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:s,value:i})})(e,"__v_skip",!0),e},e.onEffectCleanup=function(e,t=!1){i instanceof eW&&(i.cleanups[i.cleanupsLength++]=()=>(function(e){let t=R();try{e()}finally{R(t)}})(e))},e.onScopeDispose=function(e,i=!1){void 0!==t&&(t.cleanups[t.cleanupsLength++]=e)},e.onWatcherCleanup=eH,e.pauseTracking=function(){eM.push(i),R()},e.proxyRefs=function(e){return e_(e)?e:new Proxy(e,ej)},e.reactive=ed,e.reactiveReadArray=I,e.readonly=ev,e.ref=eE,e.resetTracking=function(){eM.length?R(eM.pop()):R()},e.setActiveSub=R,e.setCurrentScope=function(e){try{return t}finally{t=e}},e.shallowReactive=function(e){return ep(e,!1,ee,el,ef)},e.shallowReadArray=V,e.shallowReadonly=function(e){return ep(e,!0,et,eo,eh)},e.shallowRef=function(e){return ex(e)},e.stop=function(e){e.effect.stop()},e.toRaw=eR,e.toReactive=ew,e.toReadonly=eS,e.toRef=function(e,t,i){return eT(e)?e:"function"==typeof e?new eC(e):f(e)&&arguments.length>1?eL(e,t,i):eE(e)},e.toRefs=function(e){let t=o(e)?Array(e.length):{};for(let i in e)t[i]=eL(e,i);return t},e.toValue=function(e){return"function"==typeof e?e():eD(e)},e.track=W,e.traverse=ez,e.trigger=M,e.triggerRef=em,e.unref=eD,e.watch=function(e,t,i=r){let s=new eU(e,t,i);s.run(!0);let n=s.stop.bind(s);return n.pause=s.pause.bind(s),n.resume=s.resume.bind(s),n.stop=n,n},e}({});
|
|
5
|
+
**/var VueReactivity=function(t){"use strict";let e,i,s,r={},n=()=>{},l=Object.assign,u=Object.prototype.hasOwnProperty,o=Array.isArray,a=t=>"symbol"==typeof t,f=t=>null!==t&&"object"==typeof t,h=Object.prototype.toString,c=t=>"string"==typeof t&&"NaN"!==t&&"-"!==t[0]&&""+parseInt(t,10)===t;var d,v=((d=v||{})[d.None=0]="None",d[d.Mutable=1]="Mutable",d[d.Watching=2]="Watching",d[d.RecursedCheck=4]="RecursedCheck",d[d.Recursed=8]="Recursed",d[d.Dirty=16]="Dirty",d[d.Pending=32]="Pending",d);let _=[],p=0,g=0,b=0,y=0;function w(t){try{return i}finally{i=t}}function R(){--p||!y||m()}function S(t,e){let i=e.depsTail;if(void 0!==i&&i.dep===t)return;let s=void 0!==i?i.nextDep:e.deps;if(void 0!==s&&s.dep===t){s.version=g,e.depsTail=s;return}let r=t.subsTail;if(void 0!==r&&r.version===g&&r.sub===e)return;let n=e.depsTail=t.subsTail={version:g,dep:t,sub:e,prevDep:i,nextDep:s,prevSub:r,nextSub:void 0};void 0!==s&&(s.prevDep=n),void 0!==i?i.nextDep=n:e.deps=n,void 0!==r?r.nextSub=n:t.subs=n}function T(t,e=t.sub){let i=t.dep,s=t.prevDep,r=t.nextDep,n=t.nextSub,l=t.prevSub;if(void 0!==r?r.prevDep=s:e.depsTail=s,void 0!==s?s.nextDep=r:e.deps=r,void 0!==n?n.prevSub=l:i.subsTail=l,void 0!==l)l.nextSub=n;else if(void 0===(i.subs=n)){let t=i.deps;if(void 0!==t){do t=T(t,i);while(void 0!==t);i.flags|=16}}return r}function E(t){let e,i=t.nextSub;t:for(;;){let s=t.sub,r=s.flags;if(3&r&&(60&r?12&r?4&r?!(48&r)&&function(t,e){let i=e.depsTail;for(;void 0!==i;){if(i===t)return!0;i=i.prevDep}return!1}(t,s)?(s.flags=8|r|32,r&=1):r=0:s.flags=-9&r|32:r=0:s.flags=32|r,2&r&&(_[y++]=s),1&r)){let r=s.subs;if(void 0!==r){t=r,void 0!==r.nextSub&&(e={value:i,prev:e},i=t.nextSub);continue}}if(void 0!==(t=i)){i=t.nextSub;continue}for(;void 0!==e;)if(t=e.value,e=e.prev,void 0!==t){i=t.nextSub;continue t}break}}function x(t){return++g,t.depsTail=void 0,t.flags=-57&t.flags|4,w(t)}function O(t,e){i=e;let s=t.depsTail,r=void 0!==s?s.nextDep:t.deps;for(;void 0!==r;)r=T(r,t);t.flags&=-5}function m(){for(;b<y;){let t=_[b];_[b++]=void 0,t.notify()}b=0,y=0}function A(t,e){let i,s=0;t:for(;;){let r=t.dep,n=r.flags,l=!1;if(16&e.flags)l=!0;else if((17&n)==17){if(r.update()){let t=r.subs;void 0!==t.nextSub&&D(t),l=!0}}else if((33&n)==33){(void 0!==t.nextSub||void 0!==t.prevSub)&&(i={value:t,prev:i}),t=r.deps,e=r,++s;continue}if(!l&&void 0!==t.nextDep){t=t.nextDep;continue}for(;s;){--s;let r=e.subs,n=void 0!==r.nextSub;if(n?(t=i.value,i=i.prev):t=r,l){if(e.update()){n&&D(r),e=t.sub;continue}}else e.flags&=-33;if(e=t.sub,void 0!==t.nextDep){t=t.nextDep;continue t}l=!1}return l}}function D(t){do{let e=t.sub,i=t.nextSub,s=e.flags;(48&s)==32&&(e.flags=16|s),t=i}while(void 0!==t)}class j{constructor(t,e){this.map=t,this.key=e,this._subs=void 0,this.subsTail=void 0,this.flags=v.None}get subs(){return this._subs}set subs(t){this._subs=t,void 0===t&&this.map.delete(this.key)}}let P=new WeakMap,k=Symbol(""),C=Symbol(""),L=Symbol("");function W(t,e,s){if(void 0!==i){let e=P.get(t);e||P.set(t,e=new Map);let r=e.get(s);r||e.set(s,r=new j(e,s)),S(r,i)}}function M(t,e,i,s,r,n){let l=P.get(t);if(!l)return;let u=t=>{void 0!==t&&void 0!==t.subs&&(E(t.subs),D(t.subs))};if(++p,"clear"===e)l.forEach(u);else{let r=o(t),n=r&&c(i);if(r&&"length"===i){let t=Number(s);l.forEach((e,i)=>{("length"===i||i===L||!a(i)&&i>=t)&&u(e)})}else switch((void 0!==i||l.has(void 0))&&u(l.get(i)),n&&u(l.get(L)),e){case"add":if(r)n&&u(l.get("length"));else{let e;u(l.get(k));"[object Map]"===(e=t,h.call(e))&&u(l.get(C))}break;case"delete":if(!r){let e;u(l.get(k));"[object Map]"===(e=t,h.call(e))&&u(l.get(C))}break;case"set":let f;"[object Map]"===(f=t,h.call(f))&&u(l.get(k))}}R()}function I(t){let e=tR(t);return e===t?e:(W(e,"iterate",L),ty(t)?e:e.map(tS))}function V(t){return W(t=tR(t),"iterate",L),t}function N(t,e){return tb(t)?tg(t)?tT(tS(e)):tT(e):tS(e)}let K={__proto__:null,[Symbol.iterator](){return H(this,Symbol.iterator,t=>N(this,t))},concat(...t){return I(this).concat(...t.map(t=>o(t)?I(t):t))},entries(){return H(this,"entries",t=>(t[1]=N(this,t[1]),t))},every(t,e){return Y(this,"every",t,e,void 0,arguments)},filter(t,e){return Y(this,"filter",t,e,t=>t.map(t=>N(this,t)),arguments)},find(t,e){return Y(this,"find",t,e,t=>N(this,t),arguments)},findIndex(t,e){return Y(this,"findIndex",t,e,void 0,arguments)},findLast(t,e){return Y(this,"findLast",t,e,t=>N(this,t),arguments)},findLastIndex(t,e){return Y(this,"findLastIndex",t,e,void 0,arguments)},forEach(t,e){return Y(this,"forEach",t,e,void 0,arguments)},includes(...t){return F(this,"includes",t)},indexOf(...t){return F(this,"indexOf",t)},join(t){return I(this).join(t)},lastIndexOf(...t){return F(this,"lastIndexOf",t)},map(t,e){return Y(this,"map",t,e,void 0,arguments)},pop(){return G(this,"pop")},push(...t){return G(this,"push",t)},reduce(t,...e){return z(this,"reduce",t,e)},reduceRight(t,...e){return z(this,"reduceRight",t,e)},shift(){return G(this,"shift")},some(t,e){return Y(this,"some",t,e,void 0,arguments)},splice(...t){return G(this,"splice",t)},toReversed(){return I(this).toReversed()},toSorted(t){return I(this).toSorted(t)},toSpliced(...t){return I(this).toSpliced(...t)},unshift(...t){return G(this,"unshift",t)},values(){return H(this,"values",t=>N(this,t))}};function H(t,e,i){let s=V(t),r=s[e]();return s===t||ty(t)||(r._next=r.next,r.next=()=>{let t=r._next();return t.done||(t.value=i(t.value)),t}),r}let U=Array.prototype;function Y(t,e,i,s,r,n){let l=V(t),u=l!==t&&!ty(t),o=l[e];if(o!==U[e]){let e=o.apply(t,n);return u?tS(e):e}let a=i;l!==t&&(u?a=function(e,s){return i.call(this,N(t,e),s,t)}:i.length>2&&(a=function(e,s){return i.call(this,e,s,t)}));let f=o.call(l,a,s);return u&&r?r(f):f}function z(t,e,i,s){let r=V(t),n=i;return r!==t&&(ty(t)?i.length>3&&(n=function(e,s,r){return i.call(this,e,s,r,t)}):n=function(e,s,r){return i.call(this,e,N(t,s),r,t)}),r[e](n,...s)}function F(t,e,i){let s=tR(t);W(s,"iterate",L);let r=s[e](...i);return(-1===r||!1===r)&&tw(i[0])?(i[0]=tR(i[0]),s[e](...i)):r}function G(t,e,i=[]){++p;let s=w(),r=tR(t)[e].apply(t,i);return w(s),R(),r}let B=function(t){let e=Object.create(null);for(let i of t.split(","))e[i]=1;return t=>t in e}("__proto__,__v_isRef,__isVue"),q=new Set(Object.getOwnPropertyNames(Symbol).filter(t=>"arguments"!==t&&"caller"!==t).map(t=>Symbol[t]).filter(a));function J(t){a(t)||(t=String(t));let e=tR(this);return W(e,"has",t),e.hasOwnProperty(t)}class Q{constructor(t=!1,e=!1){this._isReadonly=t,this._isShallow=e}get(t,e,i){if("__v_skip"===e)return t.__v_skip;let s=this._isReadonly,r=this._isShallow;if("__v_isReactive"===e)return!s;if("__v_isReadonly"===e)return s;if("__v_isShallow"===e)return r;if("__v_raw"===e)return i===(s?r?td:tc:r?th:tf).get(t)||Object.getPrototypeOf(t)===Object.getPrototypeOf(i)?t:void 0;let n=o(t);if(!s){let t;if(n&&(t=K[e]))return t;if("hasOwnProperty"===e)return J}let l=tE(t),u=Reflect.get(t,e,l?t:i);if(l&&"value"!==e||(a(e)?q.has(e):B(e))||(s||W(t,"get",e),r))return u;if(tE(u)){let t=n&&c(e)?u:u.value;return s&&f(t)?t_(t):t}return f(u)?s?t_(u):tv(u):u}}class X extends Q{constructor(t=!1){super(!1,t)}set(t,e,i,s){let r=t[e],n=o(t)&&c(e);if(!this._isShallow){let t=tb(r);if(ty(i)||tb(i)||(r=tR(r),i=tR(i)),!n&&tE(r)&&!tE(i))if(t)return!0;else return r.value=i,!0}let l=n?Number(e)<t.length:u.call(t,e),a=Reflect.set(t,e,i,tE(t)?t:s);return t===tR(s)&&(l?Object.is(i,r)||M(t,"set",e,i):M(t,"add",e,i)),a}deleteProperty(t,e){let i=u.call(t,e);t[e];let s=Reflect.deleteProperty(t,e);return s&&i&&M(t,"delete",e,void 0),s}has(t,e){let i=Reflect.has(t,e);return a(e)&&q.has(e)||W(t,"has",e),i}ownKeys(t){return W(t,"iterate",o(t)?"length":k),Reflect.ownKeys(t)}}class Z extends Q{constructor(t=!1){super(!0,t)}set(t,e){return!0}deleteProperty(t,e){return!0}}let $=new X,tt=new Z,te=new X(!0),ti=new Z(!0),ts=t=>t;function tr(t){return function(){return"delete"!==t&&("clear"===t?void 0:this)}}function tn(t,e){let i,s=(l(i={get(i){let s=this.__v_raw,r=tR(s),n=tR(i);t||(Object.is(i,n)||W(r,"get",i),W(r,"get",n));let{has:l}=Reflect.getPrototypeOf(r),u=e?ts:t?tT:tS;return l.call(r,i)?u(s.get(i)):l.call(r,n)?u(s.get(n)):void(s!==r&&s.get(i))},get size(){let e=this.__v_raw;return t||W(tR(e),"iterate",k),e.size},has(e){let i=this.__v_raw,s=tR(i),r=tR(e);return t||(Object.is(e,r)||W(s,"has",e),W(s,"has",r)),e===r?i.has(e):i.has(e)||i.has(r)},forEach(i,s){let r=this,n=r.__v_raw,l=tR(n),u=e?ts:t?tT:tS;return t||W(l,"iterate",k),n.forEach((t,e)=>i.call(s,u(t),u(e),r))}},t?{add:tr("add"),set:tr("set"),delete:tr("delete"),clear:tr("clear")}:{add(t){e||ty(t)||tb(t)||(t=tR(t));let i=tR(this);return Reflect.getPrototypeOf(i).has.call(i,t)||(i.add(t),M(i,"add",t,t)),this},set(t,i){e||ty(i)||tb(i)||(i=tR(i));let s=tR(this),{has:r,get:n}=Reflect.getPrototypeOf(s),l=r.call(s,t);l||(t=tR(t),l=r.call(s,t));let u=n.call(s,t);return(s.set(t,i),l)?Object.is(i,u)||M(s,"set",t,i):M(s,"add",t,i),this},delete(t){let e=tR(this),{has:i,get:s}=Reflect.getPrototypeOf(e),r=i.call(e,t);r||(t=tR(t),r=i.call(e,t)),s&&s.call(e,t);let n=e.delete(t);return r&&M(e,"delete",t,void 0),n},clear(){let t=tR(this),e=0!==t.size,i=t.clear();return e&&M(t,"clear",void 0,void 0),i}}),["keys","values","entries",Symbol.iterator].forEach(s=>{i[s]=function(...i){let r,n=this.__v_raw,l=tR(n),u="[object Map]"===(r=l,h.call(r)),o="entries"===s||s===Symbol.iterator&&u,a=n[s](...i),f=e?ts:t?tT:tS;return t||W(l,"iterate","keys"===s&&u?C:k),{next(){let{value:t,done:e}=a.next();return e?{value:t,done:e}:{value:o?[f(t[0]),f(t[1])]:f(t),done:e}},[Symbol.iterator](){return this}}}}),i);return(e,i,r)=>"__v_isReactive"===i?!t:"__v_isReadonly"===i?t:"__v_raw"===i?e:Reflect.get(u.call(s,i)&&i in e?s:e,i,r)}let tl={get:tn(!1,!1)},tu={get:tn(!1,!0)},to={get:tn(!0,!1)},ta={get:tn(!0,!0)},tf=new WeakMap,th=new WeakMap,tc=new WeakMap,td=new WeakMap;function tv(t){return tb(t)?t:tp(t,!1,$,tl,tf)}function t_(t){return tp(t,!0,tt,to,tc)}function tp(t,e,i,s,r){var n;let l;if(!f(t)||t.__v_raw&&!(e&&t.__v_isReactive))return t;let u=(n=t).__v_skip||!Object.isExtensible(n)?0:function(t){switch(t){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}((l=n,h.call(l)).slice(8,-1));if(0===u)return t;let o=r.get(t);if(o)return o;let a=new Proxy(t,2===u?s:i);return r.set(t,a),a}function tg(t){return tb(t)?tg(t.__v_raw):!!(t&&t.__v_isReactive)}function tb(t){return!!(t&&t.__v_isReadonly)}function ty(t){return!!(t&&t.__v_isShallow)}function tw(t){return!!t&&!!t.__v_raw}function tR(t){let e=t&&t.__v_raw;return e?tR(e):t}let tS=t=>f(t)?tv(t):t,tT=t=>f(t)?t_(t):t;function tE(t){return!!t&&!0===t.__v_isRef}function tx(t){return tO(t,tS)}function tO(t,e){return tE(t)?t:new tm(t,e)}class tm{constructor(t,e){this.subs=void 0,this.subsTail=void 0,this.flags=v.Mutable,this.__v_isRef=!0,this.__v_isShallow=!1,this._oldValue=this._rawValue=e?tR(t):t,this._value=e?e(t):t,this._wrap=e,this.__v_isShallow=!e}get dep(){return this}get value(){if(tD(this),this.flags&v.Dirty&&this.update()){let t=this.subs;void 0!==t&&D(t)}return this._value}set value(t){let e=this._rawValue,i=this.__v_isShallow||ty(t)||tb(t);if(!Object.is(t=i?t:tR(t),e)){this.flags|=v.Dirty,this._rawValue=t,this._value=!i&&this._wrap?this._wrap(t):t;let e=this.subs;void 0!==e&&(E(e),p||m())}}update(){return this.flags&=~v.Dirty,!Object.is(this._oldValue,this._oldValue=this._rawValue)}}function tA(t){let e=t.dep;void 0!==e&&void 0!==e.subs&&(E(e.subs),D(e.subs),p||m())}function tD(t){void 0!==i&&S(t,i)}function tj(t){return tE(t)?t.value:t}let tP={get:(t,e,i)=>"__v_raw"===e?t:tj(Reflect.get(t,e,i)),set:(t,e,i,s)=>{let r=t[e];return tE(r)&&!tE(i)?(r.value=i,!0):Reflect.set(t,e,i,s)}};class tk{constructor(t){this.subs=void 0,this.subsTail=void 0,this.flags=v.None,this.__v_isRef=!0,this._value=void 0;const{get:e,set:i}=t(()=>tD(this),()=>tA(this));this._get=e,this._set=i}get dep(){return this}get value(){return this._value=this._get()}set value(t){this._set(t)}}class tC{constructor(t,e,i){this._object=t,this._key=e,this._defaultValue=i,this.__v_isRef=!0,this._value=void 0,this._raw=tR(t);let s=!0,r=t;if(!o(t)||!c(String(e)))do s=!tw(r)||ty(r);while(s&&(r=r.__v_raw));this._shallow=s}get value(){let t=this._object[this._key];return this._shallow&&(t=tj(t)),this._value=void 0===t?this._defaultValue:t}set value(t){if(this._shallow&&tE(this._raw[this._key])){let e=this._object[this._key];if(tE(e)){e.value=t;return}}this._object[this._key]=t}get dep(){var t,e;let i;return t=this._raw,e=this._key,(i=P.get(t))&&i.get(e)}}class tL{constructor(t){this._getter=t,this.__v_isRef=!0,this.__v_isReadonly=!0,this._value=void 0}get value(){return this._value=this._getter()}}class tW{constructor(t){this.deps=void 0,this.depsTail=void 0,this.subs=void 0,this.subsTail=void 0,this.flags=v.Watching|v.Dirty,this.cleanups=[],this.cleanupsLength=0,void 0!==t&&(this.fn=t),e&&S(this,e)}fn(){}get active(){return!(1024&this.flags)}pause(){this.flags|=256}resume(){(this.flags&=-257)&(v.Dirty|v.Pending)&&this.notify()}notify(){!(256&this.flags)&&this.dirty&&this.run()}run(){if(!this.active)return this.fn();tI(this);let t=x(this);try{return this.fn()}finally{O(this,t);let e=this.flags;(e&(128|v.Recursed))==(128|v.Recursed)&&(this.flags=e&~v.Recursed,this.notify())}}stop(){if(!this.active)return;this.flags=1024;let t=this.deps;for(;void 0!==t;)t=T(t,this);let e=this.subs;void 0!==e&&T(e),tI(this)}get dirty(){let t=this.flags;if(t&v.Dirty)return!0;if(t&v.Pending)if(A(this.deps,this))return this.flags=t|v.Dirty,!0;else this.flags=t&~v.Pending;return!1}}let tM=[];function tI(t){let e=t.cleanupsLength;if(e){for(let i=0;i<e;i++)t.cleanups[i]();t.cleanupsLength=0}}class tV{constructor(t=!1){this.deps=void 0,this.depsTail=void 0,this.subs=void 0,this.subsTail=void 0,this.flags=0,this.cleanups=[],this.cleanupsLength=0,!t&&e&&S(this,e)}get active(){return!(1024&this.flags)}pause(){if(!(256&this.flags)){this.flags|=256;for(let t=this.deps;void 0!==t;t=t.nextDep){let e=t.dep;"pause"in e&&e.pause()}}}resume(){let t=this.flags;if(256&t){this.flags=-257&t;for(let t=this.deps;void 0!==t;t=t.nextDep){let e=t.dep;"resume"in e&&e.resume()}}}run(t){let i=e;try{return e=this,t()}finally{e=i}}stop(){if(!this.active)return;this.flags=1024;let t=this.deps;for(;void 0!==t;){let e=t.dep;"stop"in e?(t=t.nextDep,e.stop()):t=T(t,this)}let e=this.subs;void 0!==e&&T(e),tI(this)}}class tN{constructor(t,e){this.fn=t,this.setter=e,this._value=void 0,this.subs=void 0,this.subsTail=void 0,this.deps=void 0,this.depsTail=void 0,this.flags=v.Mutable|v.Dirty,this.__v_isRef=!0,this.__v_isReadonly=!e}get effect(){return this}get dep(){return this}get _dirty(){let t=this.flags;if(t&v.Dirty)return!0;if(t&v.Pending)if(A(this.deps,this))return this.flags=t|v.Dirty,!0;else this.flags=t&~v.Pending;return!1}set _dirty(t){t?this.flags|=v.Dirty:this.flags&=~(v.Dirty|v.Pending)}get value(){let t=this.flags;if(t&v.Dirty||t&v.Pending&&A(this.deps,this)){if(this.update()){let t=this.subs;void 0!==t&&D(t)}}else t&v.Pending&&(this.flags=t&~v.Pending);return void 0!==i?S(this,i):void 0!==e&&S(this,e),this._value}set value(t){this.setter&&this.setter(t)}update(){let t=x(this);try{let t=this._value,e=this.fn(t);if(!Object.is(t,e))return this._value=e,!0;return!1}finally{O(this,t)}}}let tK={};function tH(t,e=!1,i=s){if(i){let{call:e}=i.options;e?i.cleanups[i.cleanupsLength++]=()=>e(t,4):i.cleanups[i.cleanupsLength++]=t}}class tU extends tW{constructor(t,e,i=r){let l;const{deep:u,once:a,call:f}=i;let h=!1,c=!1;if(tE(t)?(l=()=>t.value,h=ty(t)):tg(t)?(l=()=>tY(t,u),h=!0):o(t)?(c=!0,h=t.some(t=>tg(t)||ty(t)),l=()=>t.map(t=>tE(t)?t.value:tg(t)?tY(t,u):"function"==typeof t?f?f(t,2):t():void 0)):l="function"==typeof t?e?f?()=>f(t,2):t:()=>{if(this.cleanupsLength){let t=w();try{tI(this)}finally{w(t)}}let e=s;s=this;try{return f?f(t,3,[this.boundCleanup]):t(this.boundCleanup)}finally{s=e}}:n,e&&u){const t=l,e=!0===u?1/0:u;l=()=>tz(t(),e)}if(super(l),this.cb=e,this.options=i,this.boundCleanup=t=>tH(t,!1,this),this.forceTrigger=h,this.isMultiSource=c,a&&e){const t=e;e=(...e)=>{t(...e),this.stop()}}this.cb=e,this.oldValue=c?Array(t.length).fill(tK):tK}run(t=!1){let e=this.oldValue,i=this.oldValue=super.run();if(!this.cb)return;let{immediate:r,deep:n,call:l}=this.options;if((!t||r)&&(n||this.forceTrigger||(this.isMultiSource?i.some((t,i)=>!Object.is(t,e[i])):!Object.is(i,e)))){tI(this);let t=s;s=this;try{let t=[i,e===tK?void 0:this.isMultiSource&&e[0]===tK?[]:e,this.boundCleanup];l?l(this.cb,3,t):this.cb(...t)}finally{s=t}}}}function tY(t,e){return e?t:ty(t)||!1===e||0===e?tz(t,1):tz(t)}function tz(t,e=1/0,i){if(e<=0||!f(t)||t.__v_skip||((i=i||new Map).get(t)||0)>=e)return t;if(i.set(t,e),e--,tE(t))tz(t.value,e,i);else if(o(t))for(let s=0;s<t.length;s++)tz(t[s],e,i);else{let s,r;if("[object Set]"===(s=t,h.call(s))||"[object Map]"===(r=t,h.call(r)))t.forEach(t=>{tz(t,e,i)});else{let s;if("[object Object]"===(s=t,h.call(s))){for(let s in t)tz(t[s],e,i);for(let s of Object.getOwnPropertySymbols(t))Object.prototype.propertyIsEnumerable.call(t,s)&&tz(t[s],e,i)}}}return t}return t.ARRAY_ITERATE_KEY=L,t.EffectFlags={ALLOW_RECURSE:128,128:"ALLOW_RECURSE",PAUSED:256,256:"PAUSED",STOP:1024,1024:"STOP"},t.EffectScope=tV,t.ITERATE_KEY=k,t.MAP_KEY_ITERATE_KEY=C,t.ReactiveEffect=tW,t.ReactiveFlags={SKIP:"__v_skip",IS_REACTIVE:"__v_isReactive",IS_READONLY:"__v_isReadonly",IS_SHALLOW:"__v_isShallow",RAW:"__v_raw",IS_REF:"__v_isRef"},t.TrackOpTypes={GET:"get",HAS:"has",ITERATE:"iterate"},t.TriggerOpTypes={SET:"set",ADD:"add",DELETE:"delete",CLEAR:"clear"},t.WatchErrorCodes={WATCH_GETTER:2,2:"WATCH_GETTER",WATCH_CALLBACK:3,3:"WATCH_CALLBACK",WATCH_CLEANUP:4,4:"WATCH_CLEANUP"},t.WatcherEffect=tU,t.computed=function(t,e,i=!1){let s,r;return"function"==typeof t?s=t:(s=t.get,r=t.set),new tN(s,r)},t.customRef=function(t){return new tk(t)},t.effect=function(t,e){t.effect instanceof tW&&(t=t.effect.fn);let i=new tW(t);if(e){let{onStop:t,scheduler:s}=e;if(t){e.onStop=void 0;let s=i.stop.bind(i);i.stop=()=>{s(),t()}}s&&(e.scheduler=void 0,i.notify=()=>{256&i.flags||s()}),l(i,e)}try{i.run()}catch(t){throw i.stop(),t}let s=i.run.bind(i);return s.effect=i,s},t.effectScope=function(t){return new tV(t)},t.enableTracking=function(){if(void 0===i){tM.push(void 0);for(let t=tM.length-1;t>=0;t--)if(void 0!==tM[t]){w(tM[t]);break}}else tM.push(i)},t.getCurrentScope=function(){return e},t.getCurrentWatcher=function(){return s},t.isProxy=tw,t.isReactive=tg,t.isReadonly=tb,t.isRef=tE,t.isShallow=ty,t.markRaw=function(t){return!u.call(t,"__v_skip")&&Object.isExtensible(t)&&((t,e,i,s=!1)=>{Object.defineProperty(t,e,{configurable:!0,enumerable:!1,writable:s,value:i})})(t,"__v_skip",!0),t},t.onEffectCleanup=function(t,e=!1){i instanceof tW&&(i.cleanups[i.cleanupsLength++]=()=>(function(t){let e=w();try{t()}finally{w(e)}})(t))},t.onScopeDispose=function(t,i=!1){void 0!==e&&(e.cleanups[e.cleanupsLength++]=t)},t.onWatcherCleanup=tH,t.pauseTracking=function(){tM.push(i),w()},t.proxyRefs=function(t){return tg(t)?t:new Proxy(t,tP)},t.reactive=tv,t.reactiveReadArray=I,t.readonly=t_,t.ref=tx,t.resetTracking=function(){tM.length?w(tM.pop()):w()},t.setActiveSub=w,t.setCurrentScope=function(t){try{return e}finally{e=t}},t.shallowReactive=function(t){return tp(t,!1,te,tu,th)},t.shallowReadArray=V,t.shallowReadonly=function(t){return tp(t,!0,ti,ta,td)},t.shallowRef=function(t){return tO(t)},t.stop=function(t){t.effect.stop()},t.toRaw=tR,t.toReactive=tS,t.toReadonly=tT,t.toRef=function(t,e,i){if(tE(t))return t;if("function"==typeof t)return new tL(t);if(!f(t)||!(arguments.length>1))return tx(t);return new tC(t,e,i)},t.toRefs=function(t){let e=o(t)?Array(t.length):{};for(let i in t)e[i]=new tC(t,i,void 0);return e},t.toValue=function(t){return"function"==typeof t?t():tj(t)},t.track=W,t.traverse=tz,t.trigger=M,t.triggerRef=tA,t.unref=tj,t.watch=function(t,e,i=r){let s=new tU(t,e,i);s.run(!0);let n=s.stop.bind(s);return n.pause=s.pause.bind(s),n.resume=s.resume.bind(s),n.stop=n,n},t}({});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vue/reactivity",
|
|
3
|
-
"version": "3.6.0-alpha.
|
|
3
|
+
"version": "3.6.0-alpha.5",
|
|
4
4
|
"description": "@vue/reactivity",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "dist/reactivity.esm-bundler.js",
|
|
@@ -50,6 +50,6 @@
|
|
|
50
50
|
},
|
|
51
51
|
"homepage": "https://github.com/vuejs/core/tree/main/packages/reactivity#readme",
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@vue/shared": "3.6.0-alpha.
|
|
53
|
+
"@vue/shared": "3.6.0-alpha.5"
|
|
54
54
|
}
|
|
55
55
|
}
|