@vue/server-renderer 3.4.26 → 3.5.0-alpha.1

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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/server-renderer v3.4.26
2
+ * @vue/server-renderer v3.5.0-alpha.1
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -80,11 +80,10 @@ const invokeArrayFns = (fns, arg) => {
80
80
  fns[i](arg);
81
81
  }
82
82
  };
83
- const def = (obj, key, value, writable = false) => {
83
+ const def = (obj, key, value) => {
84
84
  Object.defineProperty(obj, key, {
85
85
  configurable: true,
86
86
  enumerable: false,
87
- writable,
88
87
  value
89
88
  });
90
89
  };
@@ -420,123 +419,250 @@ class EffectScope {
420
419
  }
421
420
  }
422
421
  }
423
- function recordEffectScope(effect, scope = activeEffectScope) {
424
- if (scope && scope.active) {
425
- scope.effects.push(effect);
426
- }
427
- }
428
422
  function getCurrentScope() {
429
423
  return activeEffectScope;
430
424
  }
431
425
 
432
- let activeEffect;
426
+ let activeSub;
433
427
  class ReactiveEffect {
434
- constructor(fn, trigger, scheduler, scope) {
428
+ constructor(fn) {
435
429
  this.fn = fn;
436
- this.trigger = trigger;
437
- this.scheduler = scheduler;
438
- this.active = true;
439
- this.deps = [];
440
430
  /**
441
431
  * @internal
442
432
  */
443
- this._dirtyLevel = 4;
433
+ this.deps = void 0;
444
434
  /**
445
435
  * @internal
446
436
  */
447
- this._trackId = 0;
437
+ this.depsTail = void 0;
448
438
  /**
449
439
  * @internal
450
440
  */
451
- this._runnings = 0;
441
+ this.flags = 1 | 4;
452
442
  /**
453
443
  * @internal
454
444
  */
455
- this._shouldSchedule = false;
445
+ this.nextEffect = void 0;
456
446
  /**
457
447
  * @internal
458
448
  */
459
- this._depsLength = 0;
460
- recordEffectScope(this, scope);
461
- }
462
- get dirty() {
463
- if (this._dirtyLevel === 2 || this._dirtyLevel === 3) {
464
- this._dirtyLevel = 1;
465
- pauseTracking();
466
- for (let i = 0; i < this._depsLength; i++) {
467
- const dep = this.deps[i];
468
- if (dep.computed) {
469
- triggerComputed(dep.computed);
470
- if (this._dirtyLevel >= 4) {
471
- break;
472
- }
473
- }
474
- }
475
- if (this._dirtyLevel === 1) {
476
- this._dirtyLevel = 0;
477
- }
478
- resetTracking();
449
+ this.cleanup = void 0;
450
+ this.scheduler = void 0;
451
+ if (activeEffectScope && activeEffectScope.active) {
452
+ activeEffectScope.effects.push(this);
479
453
  }
480
- return this._dirtyLevel >= 4;
481
454
  }
482
- set dirty(v) {
483
- this._dirtyLevel = v ? 4 : 0;
455
+ /**
456
+ * @internal
457
+ */
458
+ notify() {
459
+ if (this.flags & 2 && !(this.flags & 32)) {
460
+ return;
461
+ }
462
+ if (this.flags & 64) {
463
+ return this.trigger();
464
+ }
465
+ if (!(this.flags & 8)) {
466
+ this.flags |= 8;
467
+ this.nextEffect = batchedEffect;
468
+ batchedEffect = this;
469
+ }
484
470
  }
485
471
  run() {
486
- this._dirtyLevel = 0;
487
- if (!this.active) {
472
+ if (!(this.flags & 1)) {
488
473
  return this.fn();
489
474
  }
490
- let lastShouldTrack = shouldTrack;
491
- let lastEffect = activeEffect;
475
+ this.flags |= 2;
476
+ cleanupEffect(this);
477
+ prepareDeps(this);
478
+ const prevEffect = activeSub;
479
+ const prevShouldTrack = shouldTrack;
480
+ activeSub = this;
481
+ shouldTrack = true;
492
482
  try {
493
- shouldTrack = true;
494
- activeEffect = this;
495
- this._runnings++;
496
- preCleanupEffect(this);
497
483
  return this.fn();
498
484
  } finally {
499
- postCleanupEffect(this);
500
- this._runnings--;
501
- activeEffect = lastEffect;
502
- shouldTrack = lastShouldTrack;
485
+ if (activeSub !== this) {
486
+ warn$2(
487
+ "Active effect was not restored correctly - this is likely a Vue internal bug."
488
+ );
489
+ }
490
+ cleanupDeps(this);
491
+ activeSub = prevEffect;
492
+ shouldTrack = prevShouldTrack;
493
+ this.flags &= ~2;
503
494
  }
504
495
  }
505
496
  stop() {
506
- if (this.active) {
507
- preCleanupEffect(this);
508
- postCleanupEffect(this);
497
+ if (this.flags & 1) {
498
+ for (let link = this.deps; link; link = link.nextDep) {
499
+ removeSub(link);
500
+ }
501
+ this.deps = this.depsTail = void 0;
502
+ cleanupEffect(this);
509
503
  this.onStop && this.onStop();
510
- this.active = false;
504
+ this.flags &= ~1;
505
+ }
506
+ }
507
+ trigger() {
508
+ if (this.scheduler) {
509
+ this.scheduler();
510
+ } else {
511
+ this.runIfDirty();
512
+ }
513
+ }
514
+ /**
515
+ * @internal
516
+ */
517
+ runIfDirty() {
518
+ if (isDirty(this)) {
519
+ this.run();
511
520
  }
512
521
  }
522
+ get dirty() {
523
+ return isDirty(this);
524
+ }
525
+ }
526
+ let batchDepth = 0;
527
+ let batchedEffect;
528
+ function startBatch() {
529
+ batchDepth++;
513
530
  }
514
- function triggerComputed(computed) {
515
- return computed.value;
531
+ function endBatch() {
532
+ if (batchDepth > 1) {
533
+ batchDepth--;
534
+ return;
535
+ }
536
+ let error;
537
+ while (batchedEffect) {
538
+ let e = batchedEffect;
539
+ batchedEffect = void 0;
540
+ while (e) {
541
+ const next = e.nextEffect;
542
+ e.nextEffect = void 0;
543
+ e.flags &= ~8;
544
+ if (e.flags & 1) {
545
+ try {
546
+ e.trigger();
547
+ } catch (err) {
548
+ if (!error)
549
+ error = err;
550
+ }
551
+ }
552
+ e = next;
553
+ }
554
+ }
555
+ batchDepth--;
556
+ if (error)
557
+ throw error;
516
558
  }
517
- function preCleanupEffect(effect2) {
518
- effect2._trackId++;
519
- effect2._depsLength = 0;
559
+ function prepareDeps(sub) {
560
+ for (let link = sub.deps; link; link = link.nextDep) {
561
+ link.version = -1;
562
+ link.prevActiveLink = link.dep.activeLink;
563
+ link.dep.activeLink = link;
564
+ }
520
565
  }
521
- function postCleanupEffect(effect2) {
522
- if (effect2.deps.length > effect2._depsLength) {
523
- for (let i = effect2._depsLength; i < effect2.deps.length; i++) {
524
- cleanupDepEffect(effect2.deps[i], effect2);
566
+ function cleanupDeps(sub) {
567
+ let head;
568
+ let tail = sub.depsTail;
569
+ for (let link = tail; link; link = link.prevDep) {
570
+ if (link.version === -1) {
571
+ if (link === tail)
572
+ tail = link.prevDep;
573
+ removeSub(link);
574
+ removeDep(link);
575
+ } else {
576
+ head = link;
577
+ }
578
+ link.dep.activeLink = link.prevActiveLink;
579
+ link.prevActiveLink = void 0;
580
+ }
581
+ sub.deps = head;
582
+ sub.depsTail = tail;
583
+ }
584
+ function isDirty(sub) {
585
+ for (let link = sub.deps; link; link = link.nextDep) {
586
+ if (link.dep.version !== link.version || link.dep.computed && refreshComputed(link.dep.computed) === false || link.dep.version !== link.version) {
587
+ return true;
525
588
  }
526
- effect2.deps.length = effect2._depsLength;
527
589
  }
590
+ if (sub._dirty) {
591
+ return true;
592
+ }
593
+ return false;
528
594
  }
529
- function cleanupDepEffect(dep, effect2) {
530
- const trackId = dep.get(effect2);
531
- if (trackId !== void 0 && effect2._trackId !== trackId) {
532
- dep.delete(effect2);
533
- if (dep.size === 0) {
534
- dep.cleanup();
595
+ function refreshComputed(computed) {
596
+ if (computed.flags & 2) {
597
+ return false;
598
+ }
599
+ if (computed.flags & 4 && !(computed.flags & 16)) {
600
+ return;
601
+ }
602
+ computed.flags &= ~16;
603
+ if (computed.globalVersion === globalVersion) {
604
+ return;
605
+ }
606
+ computed.globalVersion = globalVersion;
607
+ const dep = computed.dep;
608
+ computed.flags |= 2;
609
+ if (dep.version > 0 && !computed.isSSR && !isDirty(computed)) {
610
+ computed.flags &= ~2;
611
+ return;
612
+ }
613
+ const prevSub = activeSub;
614
+ const prevShouldTrack = shouldTrack;
615
+ activeSub = computed;
616
+ shouldTrack = true;
617
+ try {
618
+ prepareDeps(computed);
619
+ const value = computed.fn();
620
+ if (dep.version === 0 || hasChanged(value, computed._value)) {
621
+ computed._value = value;
622
+ dep.version++;
535
623
  }
624
+ } catch (err) {
625
+ dep.version++;
626
+ throw err;
627
+ } finally {
628
+ activeSub = prevSub;
629
+ shouldTrack = prevShouldTrack;
630
+ cleanupDeps(computed);
631
+ computed.flags &= ~2;
632
+ }
633
+ }
634
+ function removeSub(link) {
635
+ const { dep, prevSub, nextSub } = link;
636
+ if (prevSub) {
637
+ prevSub.nextSub = nextSub;
638
+ link.prevSub = void 0;
639
+ }
640
+ if (nextSub) {
641
+ nextSub.prevSub = prevSub;
642
+ link.nextSub = void 0;
643
+ }
644
+ if (dep.subs === link) {
645
+ dep.subs = prevSub;
646
+ }
647
+ if (!dep.subs && dep.computed) {
648
+ dep.computed.flags &= ~4;
649
+ for (let l = dep.computed.deps; l; l = l.nextDep) {
650
+ removeSub(l);
651
+ }
652
+ }
653
+ }
654
+ function removeDep(link) {
655
+ const { prevDep, nextDep } = link;
656
+ if (prevDep) {
657
+ prevDep.nextDep = nextDep;
658
+ link.prevDep = void 0;
659
+ }
660
+ if (nextDep) {
661
+ nextDep.prevDep = prevDep;
662
+ link.nextDep = void 0;
536
663
  }
537
664
  }
538
665
  let shouldTrack = true;
539
- let pauseScheduleStack = 0;
540
666
  const trackStack = [];
541
667
  function pauseTracking() {
542
668
  trackStack.push(shouldTrack);
@@ -546,188 +672,410 @@ function resetTracking() {
546
672
  const last = trackStack.pop();
547
673
  shouldTrack = last === void 0 ? true : last;
548
674
  }
549
- function pauseScheduling() {
550
- pauseScheduleStack++;
551
- }
552
- function resetScheduling() {
553
- pauseScheduleStack--;
554
- while (!pauseScheduleStack && queueEffectSchedulers.length) {
555
- queueEffectSchedulers.shift()();
675
+ function cleanupEffect(e) {
676
+ const { cleanup } = e;
677
+ e.cleanup = void 0;
678
+ if (cleanup) {
679
+ const prevSub = activeSub;
680
+ activeSub = void 0;
681
+ try {
682
+ cleanup();
683
+ } finally {
684
+ activeSub = prevSub;
685
+ }
556
686
  }
557
687
  }
558
- function trackEffect(effect2, dep, debuggerEventExtraInfo) {
559
- var _a;
560
- if (dep.get(effect2) !== effect2._trackId) {
561
- dep.set(effect2, effect2._trackId);
562
- const oldDep = effect2.deps[effect2._depsLength];
563
- if (oldDep !== dep) {
564
- if (oldDep) {
565
- cleanupDepEffect(oldDep, effect2);
566
- }
567
- effect2.deps[effect2._depsLength++] = dep;
568
- } else {
569
- effect2._depsLength++;
570
- }
688
+
689
+ let globalVersion = 0;
690
+ class Dep {
691
+ constructor(computed) {
692
+ this.computed = computed;
693
+ this.version = 0;
694
+ /**
695
+ * Link between this dep and the current active effect
696
+ */
697
+ this.activeLink = void 0;
698
+ /**
699
+ * Doubly linked list representing the subscribing effects (tail)
700
+ */
701
+ this.subs = void 0;
571
702
  {
572
- (_a = effect2.onTrack) == null ? void 0 : _a.call(effect2, extend({ effect: effect2 }, debuggerEventExtraInfo));
703
+ this.subsHead = void 0;
573
704
  }
574
705
  }
575
- }
576
- const queueEffectSchedulers = [];
577
- function triggerEffects(dep, dirtyLevel, debuggerEventExtraInfo) {
578
- var _a;
579
- pauseScheduling();
580
- for (const effect2 of dep.keys()) {
581
- let tracking;
582
- if (effect2._dirtyLevel < dirtyLevel && (tracking != null ? tracking : tracking = dep.get(effect2) === effect2._trackId)) {
583
- effect2._shouldSchedule || (effect2._shouldSchedule = effect2._dirtyLevel === 0);
584
- effect2._dirtyLevel = dirtyLevel;
585
- }
586
- if (effect2._shouldSchedule && (tracking != null ? tracking : tracking = dep.get(effect2) === effect2._trackId)) {
587
- {
588
- (_a = effect2.onTrigger) == null ? void 0 : _a.call(effect2, extend({ effect: effect2 }, debuggerEventExtraInfo));
706
+ track(debugInfo) {
707
+ if (!activeSub || !shouldTrack) {
708
+ return;
709
+ }
710
+ let link = this.activeLink;
711
+ if (link === void 0 || link.sub !== activeSub) {
712
+ link = this.activeLink = {
713
+ dep: this,
714
+ sub: activeSub,
715
+ version: this.version,
716
+ nextDep: void 0,
717
+ prevDep: void 0,
718
+ nextSub: void 0,
719
+ prevSub: void 0,
720
+ prevActiveLink: void 0
721
+ };
722
+ if (!activeSub.deps) {
723
+ activeSub.deps = activeSub.depsTail = link;
724
+ } else {
725
+ link.prevDep = activeSub.depsTail;
726
+ activeSub.depsTail.nextDep = link;
727
+ activeSub.depsTail = link;
728
+ }
729
+ if (activeSub.flags & 4) {
730
+ addSub(link);
731
+ }
732
+ } else if (link.version === -1) {
733
+ link.version = this.version;
734
+ if (link.nextDep) {
735
+ const next = link.nextDep;
736
+ next.prevDep = link.prevDep;
737
+ if (link.prevDep) {
738
+ link.prevDep.nextDep = next;
739
+ }
740
+ link.prevDep = activeSub.depsTail;
741
+ link.nextDep = void 0;
742
+ activeSub.depsTail.nextDep = link;
743
+ activeSub.depsTail = link;
744
+ if (activeSub.deps === link) {
745
+ activeSub.deps = next;
746
+ }
589
747
  }
590
- effect2.trigger();
591
- if ((!effect2._runnings || effect2.allowRecurse) && effect2._dirtyLevel !== 2) {
592
- effect2._shouldSchedule = false;
593
- if (effect2.scheduler) {
594
- queueEffectSchedulers.push(effect2.scheduler);
748
+ }
749
+ if (activeSub.onTrack) {
750
+ activeSub.onTrack(
751
+ extend(
752
+ {
753
+ effect: activeSub
754
+ },
755
+ debugInfo
756
+ )
757
+ );
758
+ }
759
+ return link;
760
+ }
761
+ trigger(debugInfo) {
762
+ this.version++;
763
+ globalVersion++;
764
+ this.notify(debugInfo);
765
+ }
766
+ notify(debugInfo) {
767
+ startBatch();
768
+ try {
769
+ if (true) {
770
+ for (let head = this.subsHead; head; head = head.nextSub) {
771
+ if (head.sub.onTrigger && !(head.sub.flags & 8)) {
772
+ head.sub.onTrigger(
773
+ extend(
774
+ {
775
+ effect: head.sub
776
+ },
777
+ debugInfo
778
+ )
779
+ );
780
+ }
595
781
  }
596
782
  }
783
+ for (let link = this.subs; link; link = link.prevSub) {
784
+ link.sub.notify();
785
+ }
786
+ } finally {
787
+ endBatch();
597
788
  }
598
789
  }
599
- resetScheduling();
600
790
  }
601
-
602
- const createDep = (cleanup, computed) => {
603
- const dep = /* @__PURE__ */ new Map();
604
- dep.cleanup = cleanup;
605
- dep.computed = computed;
606
- return dep;
607
- };
608
-
791
+ function addSub(link) {
792
+ const computed = link.dep.computed;
793
+ if (computed && !link.dep.subs) {
794
+ computed.flags |= 4 | 16;
795
+ for (let l = computed.deps; l; l = l.nextDep) {
796
+ addSub(l);
797
+ }
798
+ }
799
+ const currentTail = link.dep.subs;
800
+ if (currentTail !== link) {
801
+ link.prevSub = currentTail;
802
+ if (currentTail)
803
+ currentTail.nextSub = link;
804
+ }
805
+ if (link.dep.subsHead === void 0) {
806
+ link.dep.subsHead = link;
807
+ }
808
+ link.dep.subs = link;
809
+ }
609
810
  const targetMap = /* @__PURE__ */ new WeakMap();
610
- const ITERATE_KEY = Symbol("iterate" );
611
- const MAP_KEY_ITERATE_KEY = Symbol("Map key iterate" );
811
+ const ITERATE_KEY = Symbol("Object iterate" );
812
+ const MAP_KEY_ITERATE_KEY = Symbol("Map keys iterate" );
813
+ const ARRAY_ITERATE_KEY = Symbol("Array iterate" );
612
814
  function track(target, type, key) {
613
- if (shouldTrack && activeEffect) {
815
+ if (shouldTrack && activeSub) {
614
816
  let depsMap = targetMap.get(target);
615
817
  if (!depsMap) {
616
818
  targetMap.set(target, depsMap = /* @__PURE__ */ new Map());
617
819
  }
618
820
  let dep = depsMap.get(key);
619
821
  if (!dep) {
620
- depsMap.set(key, dep = createDep(() => depsMap.delete(key)));
822
+ depsMap.set(key, dep = new Dep());
621
823
  }
622
- trackEffect(
623
- activeEffect,
624
- dep,
625
- {
824
+ {
825
+ dep.track({
626
826
  target,
627
827
  type,
628
828
  key
629
- }
630
- );
829
+ });
830
+ }
631
831
  }
632
832
  }
633
833
  function trigger(target, type, key, newValue, oldValue, oldTarget) {
634
834
  const depsMap = targetMap.get(target);
635
835
  if (!depsMap) {
836
+ globalVersion++;
636
837
  return;
637
838
  }
638
839
  let deps = [];
639
840
  if (type === "clear") {
640
841
  deps = [...depsMap.values()];
641
- } else if (key === "length" && isArray(target)) {
642
- const newLength = Number(newValue);
643
- depsMap.forEach((dep, key2) => {
644
- if (key2 === "length" || !isSymbol(key2) && key2 >= newLength) {
645
- deps.push(dep);
646
- }
647
- });
648
842
  } else {
649
- if (key !== void 0) {
650
- deps.push(depsMap.get(key));
651
- }
652
- switch (type) {
653
- case "add":
654
- if (!isArray(target)) {
655
- deps.push(depsMap.get(ITERATE_KEY));
656
- if (isMap(target)) {
657
- deps.push(depsMap.get(MAP_KEY_ITERATE_KEY));
658
- }
659
- } else if (isIntegerKey(key)) {
660
- deps.push(depsMap.get("length"));
843
+ const targetIsArray = isArray(target);
844
+ const isArrayIndex = targetIsArray && isIntegerKey(key);
845
+ if (targetIsArray && key === "length") {
846
+ const newLength = Number(newValue);
847
+ depsMap.forEach((dep, key2) => {
848
+ if (key2 === "length" || key2 === ARRAY_ITERATE_KEY || !isSymbol(key2) && key2 >= newLength) {
849
+ deps.push(dep);
661
850
  }
662
- break;
663
- case "delete":
664
- if (!isArray(target)) {
665
- deps.push(depsMap.get(ITERATE_KEY));
851
+ });
852
+ } else {
853
+ const push = (dep) => dep && deps.push(dep);
854
+ if (key !== void 0) {
855
+ push(depsMap.get(key));
856
+ }
857
+ if (isArrayIndex) {
858
+ push(depsMap.get(ARRAY_ITERATE_KEY));
859
+ }
860
+ switch (type) {
861
+ case "add":
862
+ if (!targetIsArray) {
863
+ push(depsMap.get(ITERATE_KEY));
864
+ if (isMap(target)) {
865
+ push(depsMap.get(MAP_KEY_ITERATE_KEY));
866
+ }
867
+ } else if (isArrayIndex) {
868
+ push(depsMap.get("length"));
869
+ }
870
+ break;
871
+ case "delete":
872
+ if (!targetIsArray) {
873
+ push(depsMap.get(ITERATE_KEY));
874
+ if (isMap(target)) {
875
+ push(depsMap.get(MAP_KEY_ITERATE_KEY));
876
+ }
877
+ }
878
+ break;
879
+ case "set":
666
880
  if (isMap(target)) {
667
- deps.push(depsMap.get(MAP_KEY_ITERATE_KEY));
881
+ push(depsMap.get(ITERATE_KEY));
668
882
  }
669
- }
670
- break;
671
- case "set":
672
- if (isMap(target)) {
673
- deps.push(depsMap.get(ITERATE_KEY));
674
- }
675
- break;
883
+ break;
884
+ }
676
885
  }
677
886
  }
678
- pauseScheduling();
887
+ startBatch();
679
888
  for (const dep of deps) {
680
- if (dep) {
681
- triggerEffects(
682
- dep,
683
- 4,
684
- {
685
- target,
686
- type,
687
- key,
688
- newValue,
689
- oldValue,
690
- oldTarget
691
- }
692
- );
889
+ {
890
+ dep.trigger({
891
+ target,
892
+ type,
893
+ key,
894
+ newValue,
895
+ oldValue,
896
+ oldTarget
897
+ });
898
+ }
899
+ }
900
+ endBatch();
901
+ }
902
+
903
+ function reactiveReadArray(array) {
904
+ const raw = toRaw(array);
905
+ if (raw === array)
906
+ return raw;
907
+ track(raw, "iterate", ARRAY_ITERATE_KEY);
908
+ return isShallow(array) ? raw : raw.map(toReactive);
909
+ }
910
+ function shallowReadArray(arr) {
911
+ track(arr = toRaw(arr), "iterate", ARRAY_ITERATE_KEY);
912
+ return arr;
913
+ }
914
+ const arrayInstrumentations = {
915
+ __proto__: null,
916
+ [Symbol.iterator]() {
917
+ return iterator(this, Symbol.iterator, toReactive);
918
+ },
919
+ concat(...args) {
920
+ return reactiveReadArray(this).concat(
921
+ ...args.map((x) => reactiveReadArray(x))
922
+ );
923
+ },
924
+ entries() {
925
+ return iterator(this, "entries", (value) => {
926
+ value[1] = toReactive(value[1]);
927
+ return value;
928
+ });
929
+ },
930
+ every(fn, thisArg) {
931
+ return apply(this, "every", fn, thisArg);
932
+ },
933
+ filter(fn, thisArg) {
934
+ const result = apply(this, "filter", fn, thisArg);
935
+ return isProxy(this) && !isShallow(this) ? result.map(toReactive) : result;
936
+ },
937
+ find(fn, thisArg) {
938
+ const result = apply(this, "find", fn, thisArg);
939
+ return isProxy(this) && !isShallow(this) ? toReactive(result) : result;
940
+ },
941
+ findIndex(fn, thisArg) {
942
+ return apply(this, "findIndex", fn, thisArg);
943
+ },
944
+ findLast(fn, thisArg) {
945
+ const result = apply(this, "findLast", fn, thisArg);
946
+ return isProxy(this) && !isShallow(this) ? toReactive(result) : result;
947
+ },
948
+ findLastIndex(fn, thisArg) {
949
+ return apply(this, "findLastIndex", fn, thisArg);
950
+ },
951
+ // flat, flatMap could benefit from ARRAY_ITERATE but are not straight-forward to implement
952
+ forEach(fn, thisArg) {
953
+ return apply(this, "forEach", fn, thisArg);
954
+ },
955
+ includes(...args) {
956
+ return searchProxy(this, "includes", args);
957
+ },
958
+ indexOf(...args) {
959
+ return searchProxy(this, "indexOf", args);
960
+ },
961
+ join(separator) {
962
+ return reactiveReadArray(this).join(separator);
963
+ },
964
+ // keys() iterator only reads `length`, no optimisation required
965
+ lastIndexOf(...args) {
966
+ return searchProxy(this, "lastIndexOf", args);
967
+ },
968
+ map(fn, thisArg) {
969
+ return apply(this, "map", fn, thisArg);
970
+ },
971
+ pop() {
972
+ return noTracking(this, "pop");
973
+ },
974
+ push(...args) {
975
+ return noTracking(this, "push", args);
976
+ },
977
+ reduce(fn, ...args) {
978
+ return reduce(this, "reduce", fn, args);
979
+ },
980
+ reduceRight(fn, ...args) {
981
+ return reduce(this, "reduceRight", fn, args);
982
+ },
983
+ shift() {
984
+ return noTracking(this, "shift");
985
+ },
986
+ // slice could use ARRAY_ITERATE but also seems to beg for range tracking
987
+ some(fn, thisArg) {
988
+ return apply(this, "some", fn, thisArg);
989
+ },
990
+ splice(...args) {
991
+ return noTracking(this, "splice", args);
992
+ },
993
+ toReversed() {
994
+ return reactiveReadArray(this).toReversed();
995
+ },
996
+ toSorted(comparer) {
997
+ return reactiveReadArray(this).toSorted(comparer);
998
+ },
999
+ toSpliced(...args) {
1000
+ return reactiveReadArray(this).toSpliced(...args);
1001
+ },
1002
+ unshift(...args) {
1003
+ return noTracking(this, "unshift", args);
1004
+ },
1005
+ values() {
1006
+ return iterator(this, "values", toReactive);
1007
+ }
1008
+ };
1009
+ function iterator(self, method, wrapValue) {
1010
+ const arr = shallowReadArray(self);
1011
+ const iter = arr[method]();
1012
+ if (arr !== self && !isShallow(self)) {
1013
+ iter._next = iter.next;
1014
+ iter.next = () => {
1015
+ const result = iter._next();
1016
+ if (result.value) {
1017
+ result.value = wrapValue(result.value);
1018
+ }
1019
+ return result;
1020
+ };
1021
+ }
1022
+ return iter;
1023
+ }
1024
+ function apply(self, method, fn, thisArg) {
1025
+ const arr = shallowReadArray(self);
1026
+ let wrappedFn = fn;
1027
+ if (arr !== self) {
1028
+ if (!isShallow(self)) {
1029
+ wrappedFn = function(item, index) {
1030
+ return fn.call(this, toReactive(item), index, self);
1031
+ };
1032
+ } else if (fn.length > 2) {
1033
+ wrappedFn = function(item, index) {
1034
+ return fn.call(this, item, index, self);
1035
+ };
1036
+ }
1037
+ }
1038
+ return arr[method](wrappedFn, thisArg);
1039
+ }
1040
+ function reduce(self, method, fn, args) {
1041
+ const arr = shallowReadArray(self);
1042
+ let wrappedFn = fn;
1043
+ if (arr !== self) {
1044
+ if (!isShallow(self)) {
1045
+ wrappedFn = function(acc, item, index) {
1046
+ return fn.call(this, acc, toReactive(item), index, self);
1047
+ };
1048
+ } else if (fn.length > 3) {
1049
+ wrappedFn = function(acc, item, index) {
1050
+ return fn.call(this, acc, item, index, self);
1051
+ };
693
1052
  }
694
1053
  }
695
- resetScheduling();
1054
+ return arr[method](wrappedFn, ...args);
1055
+ }
1056
+ function searchProxy(self, method, args) {
1057
+ const arr = toRaw(self);
1058
+ track(arr, "iterate", ARRAY_ITERATE_KEY);
1059
+ const res = arr[method](...args);
1060
+ if ((res === -1 || res === false) && isProxy(args[0])) {
1061
+ args[0] = toRaw(args[0]);
1062
+ return arr[method](...args);
1063
+ }
1064
+ return res;
1065
+ }
1066
+ function noTracking(self, method, args = []) {
1067
+ pauseTracking();
1068
+ startBatch();
1069
+ const res = toRaw(self)[method].apply(self, args);
1070
+ endBatch();
1071
+ resetTracking();
1072
+ return res;
696
1073
  }
697
1074
 
698
1075
  const isNonTrackableKeys = /* @__PURE__ */ makeMap(`__proto__,__v_isRef,__isVue`);
699
1076
  const builtInSymbols = new Set(
700
1077
  /* @__PURE__ */ Object.getOwnPropertyNames(Symbol).filter((key) => key !== "arguments" && key !== "caller").map((key) => Symbol[key]).filter(isSymbol)
701
1078
  );
702
- const arrayInstrumentations = /* @__PURE__ */ createArrayInstrumentations();
703
- function createArrayInstrumentations() {
704
- const instrumentations = {};
705
- ["includes", "indexOf", "lastIndexOf"].forEach((key) => {
706
- instrumentations[key] = function(...args) {
707
- const arr = toRaw(this);
708
- for (let i = 0, l = this.length; i < l; i++) {
709
- track(arr, "get", i + "");
710
- }
711
- const res = arr[key](...args);
712
- if (res === -1 || res === false) {
713
- return arr[key](...args.map(toRaw));
714
- } else {
715
- return res;
716
- }
717
- };
718
- });
719
- ["push", "pop", "shift", "unshift", "splice"].forEach((key) => {
720
- instrumentations[key] = function(...args) {
721
- pauseTracking();
722
- pauseScheduling();
723
- const res = toRaw(this)[key].apply(this, args);
724
- resetScheduling();
725
- resetTracking();
726
- return res;
727
- };
728
- });
729
- return instrumentations;
730
- }
731
1079
  function hasOwnProperty(key) {
732
1080
  if (!isSymbol(key))
733
1081
  key = String(key);
@@ -758,14 +1106,22 @@ class BaseReactiveHandler {
758
1106
  }
759
1107
  const targetIsArray = isArray(target);
760
1108
  if (!isReadonly2) {
761
- if (targetIsArray && hasOwn(arrayInstrumentations, key)) {
762
- return Reflect.get(arrayInstrumentations, key, receiver);
1109
+ let fn;
1110
+ if (targetIsArray && (fn = arrayInstrumentations[key])) {
1111
+ return fn;
763
1112
  }
764
1113
  if (key === "hasOwnProperty") {
765
1114
  return hasOwnProperty;
766
1115
  }
767
1116
  }
768
- const res = Reflect.get(target, key, receiver);
1117
+ const res = Reflect.get(
1118
+ target,
1119
+ key,
1120
+ // if this is a proxy wrapping a ref, return methods using the raw ref
1121
+ // as receiver so that we don't have to call `toRaw` on the ref in all
1122
+ // its class methods
1123
+ isRef(target) ? target : receiver
1124
+ );
769
1125
  if (isSymbol(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) {
770
1126
  return res;
771
1127
  }
@@ -1264,106 +1620,8 @@ function markRaw(value) {
1264
1620
  const toReactive = (value) => isObject(value) ? reactive(value) : value;
1265
1621
  const toReadonly = (value) => isObject(value) ? readonly(value) : value;
1266
1622
 
1267
- const COMPUTED_SIDE_EFFECT_WARN = `Computed is still dirty after getter evaluation, likely because a computed is mutating its own dependency in its getter. State mutations in computed getters should be avoided. Check the docs for more details: https://vuejs.org/guide/essentials/computed.html#getters-should-be-side-effect-free`;
1268
- class ComputedRefImpl {
1269
- constructor(getter, _setter, isReadonly, isSSR) {
1270
- this.getter = getter;
1271
- this._setter = _setter;
1272
- this.dep = void 0;
1273
- this.__v_isRef = true;
1274
- this["__v_isReadonly"] = false;
1275
- this.effect = new ReactiveEffect(
1276
- () => getter(this._value),
1277
- () => triggerRefValue(
1278
- this,
1279
- this.effect._dirtyLevel === 2 ? 2 : 3
1280
- )
1281
- );
1282
- this.effect.computed = this;
1283
- this.effect.active = this._cacheable = !isSSR;
1284
- this["__v_isReadonly"] = isReadonly;
1285
- }
1286
- get value() {
1287
- const self = toRaw(this);
1288
- if ((!self._cacheable || self.effect.dirty) && hasChanged(self._value, self._value = self.effect.run())) {
1289
- triggerRefValue(self, 4);
1290
- }
1291
- trackRefValue(self);
1292
- if (self.effect._dirtyLevel >= 2) {
1293
- if (this._warnRecursive) {
1294
- warn$2(COMPUTED_SIDE_EFFECT_WARN, `
1295
-
1296
- getter: `, this.getter);
1297
- }
1298
- triggerRefValue(self, 2);
1299
- }
1300
- return self._value;
1301
- }
1302
- set value(newValue) {
1303
- this._setter(newValue);
1304
- }
1305
- // #region polyfill _dirty for backward compatibility third party code for Vue <= 3.3.x
1306
- get _dirty() {
1307
- return this.effect.dirty;
1308
- }
1309
- set _dirty(v) {
1310
- this.effect.dirty = v;
1311
- }
1312
- // #endregion
1313
- }
1314
- function computed$1(getterOrOptions, debugOptions, isSSR = false) {
1315
- let getter;
1316
- let setter;
1317
- const onlyGetter = isFunction(getterOrOptions);
1318
- if (onlyGetter) {
1319
- getter = getterOrOptions;
1320
- setter = () => {
1321
- warn$2("Write operation failed: computed value is readonly");
1322
- } ;
1323
- } else {
1324
- getter = getterOrOptions.get;
1325
- setter = getterOrOptions.set;
1326
- }
1327
- const cRef = new ComputedRefImpl(getter, setter, onlyGetter || !setter, isSSR);
1328
- return cRef;
1329
- }
1330
-
1331
- function trackRefValue(ref2) {
1332
- var _a;
1333
- if (shouldTrack && activeEffect) {
1334
- ref2 = toRaw(ref2);
1335
- trackEffect(
1336
- activeEffect,
1337
- (_a = ref2.dep) != null ? _a : ref2.dep = createDep(
1338
- () => ref2.dep = void 0,
1339
- ref2 instanceof ComputedRefImpl ? ref2 : void 0
1340
- ),
1341
- {
1342
- target: ref2,
1343
- type: "get",
1344
- key: "value"
1345
- }
1346
- );
1347
- }
1348
- }
1349
- function triggerRefValue(ref2, dirtyLevel = 4, newVal) {
1350
- ref2 = toRaw(ref2);
1351
- const dep = ref2.dep;
1352
- if (dep) {
1353
- triggerEffects(
1354
- dep,
1355
- dirtyLevel,
1356
- {
1357
- target: ref2,
1358
- type: "set",
1359
- key: "value",
1360
- newValue: newVal
1361
- }
1362
- );
1363
- }
1364
- }
1365
1623
  function isRef(r) {
1366
- return !!(r && r.__v_isRef === true);
1624
+ return r ? r.__v_isRef === true : false;
1367
1625
  }
1368
1626
  function unref(ref2) {
1369
1627
  return isRef(ref2) ? ref2.value : ref2;
@@ -1384,6 +1642,86 @@ function proxyRefs(objectWithRefs) {
1384
1642
  return isReactive(objectWithRefs) ? objectWithRefs : new Proxy(objectWithRefs, shallowUnwrapHandlers);
1385
1643
  }
1386
1644
 
1645
+ class ComputedRefImpl {
1646
+ constructor(fn, setter, isSSR) {
1647
+ this.fn = fn;
1648
+ this.setter = setter;
1649
+ /**
1650
+ * @internal
1651
+ */
1652
+ this._value = void 0;
1653
+ /**
1654
+ * @internal
1655
+ */
1656
+ this.dep = new Dep(this);
1657
+ /**
1658
+ * @internal
1659
+ */
1660
+ this.__v_isRef = true;
1661
+ // A computed is also a subscriber that tracks other deps
1662
+ /**
1663
+ * @internal
1664
+ */
1665
+ this.deps = void 0;
1666
+ /**
1667
+ * @internal
1668
+ */
1669
+ this.depsTail = void 0;
1670
+ /**
1671
+ * @internal
1672
+ */
1673
+ this.flags = 16;
1674
+ /**
1675
+ * @internal
1676
+ */
1677
+ this.globalVersion = globalVersion - 1;
1678
+ // for backwards compat
1679
+ this.effect = this;
1680
+ this.__v_isReadonly = !setter;
1681
+ this.isSSR = isSSR;
1682
+ }
1683
+ /**
1684
+ * @internal
1685
+ */
1686
+ notify() {
1687
+ if (activeSub !== this) {
1688
+ this.flags |= 16;
1689
+ this.dep.notify();
1690
+ }
1691
+ }
1692
+ get value() {
1693
+ const link = this.dep.track({
1694
+ target: this,
1695
+ type: "get",
1696
+ key: "value"
1697
+ }) ;
1698
+ refreshComputed(this);
1699
+ if (link) {
1700
+ link.version = this.dep.version;
1701
+ }
1702
+ return this._value;
1703
+ }
1704
+ set value(newValue) {
1705
+ if (this.setter) {
1706
+ this.setter(newValue);
1707
+ } else {
1708
+ warn$2("Write operation failed: computed value is readonly");
1709
+ }
1710
+ }
1711
+ }
1712
+ function computed$1(getterOrOptions, debugOptions, isSSR = false) {
1713
+ let getter;
1714
+ let setter;
1715
+ if (isFunction(getterOrOptions)) {
1716
+ getter = getterOrOptions;
1717
+ } else {
1718
+ getter = getterOrOptions.get;
1719
+ setter = getterOrOptions.set;
1720
+ }
1721
+ const cRef = new ComputedRefImpl(getter, setter, isSSR);
1722
+ return cRef;
1723
+ }
1724
+
1387
1725
  const stack = [];
1388
1726
  function pushWarningContext(vnode) {
1389
1727
  stack.push(vnode);
@@ -1623,7 +1961,7 @@ function findInsertionIndex(id) {
1623
1961
  const middle = start + end >>> 1;
1624
1962
  const middleJob = queue[middle];
1625
1963
  const middleJobId = getId(middleJob);
1626
- if (middleJobId < id || middleJobId === id && middleJob.pre) {
1964
+ if (middleJobId < id || middleJobId === id && middleJob.flags & 2) {
1627
1965
  start = middle + 1;
1628
1966
  } else {
1629
1967
  end = middle;
@@ -1632,15 +1970,21 @@ function findInsertionIndex(id) {
1632
1970
  return start;
1633
1971
  }
1634
1972
  function queueJob(job) {
1635
- if (!queue.length || !queue.includes(
1636
- job,
1637
- isFlushing && job.allowRecurse ? flushIndex + 1 : flushIndex
1638
- )) {
1973
+ var _a;
1974
+ if (!(job.flags & 1)) {
1639
1975
  if (job.id == null) {
1640
1976
  queue.push(job);
1977
+ } else if (
1978
+ // fast path when the job id is larger than the tail
1979
+ !(job.flags & 2) && job.id >= (((_a = queue[queue.length - 1]) == null ? void 0 : _a.id) || 0)
1980
+ ) {
1981
+ queue.push(job);
1641
1982
  } else {
1642
1983
  queue.splice(findInsertionIndex(job.id), 0, job);
1643
1984
  }
1985
+ if (!(job.flags & 4)) {
1986
+ job.flags |= 1;
1987
+ }
1644
1988
  queueFlush();
1645
1989
  }
1646
1990
  }
@@ -1658,11 +2002,11 @@ function invalidateJob(job) {
1658
2002
  }
1659
2003
  function queuePostFlushCb(cb) {
1660
2004
  if (!isArray(cb)) {
1661
- if (!activePostFlushCbs || !activePostFlushCbs.includes(
1662
- cb,
1663
- cb.allowRecurse ? postFlushIndex + 1 : postFlushIndex
1664
- )) {
2005
+ if (!(cb.flags & 1)) {
1665
2006
  pendingPostFlushCbs.push(cb);
2007
+ if (!(cb.flags & 4)) {
2008
+ cb.flags |= 1;
2009
+ }
1666
2010
  }
1667
2011
  } else {
1668
2012
  pendingPostFlushCbs.push(...cb);
@@ -1675,7 +2019,7 @@ function flushPreFlushCbs(instance, seen, i = isFlushing ? flushIndex + 1 : 0) {
1675
2019
  }
1676
2020
  for (; i < queue.length; i++) {
1677
2021
  const cb = queue[i];
1678
- if (cb && cb.pre) {
2022
+ if (cb && cb.flags & 2) {
1679
2023
  if (instance && cb.id !== instance.uid) {
1680
2024
  continue;
1681
2025
  }
@@ -1685,6 +2029,7 @@ function flushPreFlushCbs(instance, seen, i = isFlushing ? flushIndex + 1 : 0) {
1685
2029
  queue.splice(i, 1);
1686
2030
  i--;
1687
2031
  cb();
2032
+ cb.flags &= ~1;
1688
2033
  }
1689
2034
  }
1690
2035
  }
@@ -1707,6 +2052,7 @@ function flushPostFlushCbs(seen) {
1707
2052
  continue;
1708
2053
  }
1709
2054
  activePostFlushCbs[postFlushIndex]();
2055
+ activePostFlushCbs[postFlushIndex].flags &= ~1;
1710
2056
  }
1711
2057
  activePostFlushCbs = null;
1712
2058
  postFlushIndex = 0;
@@ -1716,9 +2062,11 @@ const getId = (job) => job.id == null ? Infinity : job.id;
1716
2062
  const comparator = (a, b) => {
1717
2063
  const diff = getId(a) - getId(b);
1718
2064
  if (diff === 0) {
1719
- if (a.pre && !b.pre)
2065
+ const isAPre = a.flags & 2;
2066
+ const isBPre = b.flags & 2;
2067
+ if (isAPre && !isBPre)
1720
2068
  return -1;
1721
- if (b.pre && !a.pre)
2069
+ if (isBPre && !isAPre)
1722
2070
  return 1;
1723
2071
  }
1724
2072
  return diff;
@@ -1734,11 +2082,12 @@ function flushJobs(seen) {
1734
2082
  try {
1735
2083
  for (flushIndex = 0; flushIndex < queue.length; flushIndex++) {
1736
2084
  const job = queue[flushIndex];
1737
- if (job && job.active !== false) {
2085
+ if (job && !(job.flags & 8)) {
1738
2086
  if (check(job)) {
1739
2087
  continue;
1740
2088
  }
1741
2089
  callWithErrorHandling(job, null, 14);
2090
+ job.flags &= ~1;
1742
2091
  }
1743
2092
  }
1744
2093
  } finally {
@@ -1820,7 +2169,6 @@ function rerender(id, newRender) {
1820
2169
  }
1821
2170
  instance.renderCache = [];
1822
2171
  isHmrUpdating = true;
1823
- instance.effect.dirty = true;
1824
2172
  instance.update();
1825
2173
  isHmrUpdating = false;
1826
2174
  });
@@ -1848,7 +2196,6 @@ function reload(id, newComp) {
1848
2196
  instance.ceReload(newComp.styles);
1849
2197
  hmrDirtyComponents.delete(oldComp);
1850
2198
  } else if (instance.parent) {
1851
- instance.parent.effect.dirty = true;
1852
2199
  queueJob(instance.parent.update);
1853
2200
  } else if (instance.appContext.reload) {
1854
2201
  instance.appContext.reload();
@@ -2230,7 +2577,7 @@ function renderComponentRoot$1(instance) {
2230
2577
  true ? {
2231
2578
  get attrs() {
2232
2579
  markAttrsAccessed();
2233
- return shallowReadonly(attrs);
2580
+ return attrs;
2234
2581
  },
2235
2582
  slots,
2236
2583
  emit
@@ -2262,7 +2609,7 @@ function renderComponentRoot$1(instance) {
2262
2609
  propsOptions
2263
2610
  );
2264
2611
  }
2265
- root = cloneVNode(root, fallthroughAttrs, false, true);
2612
+ root = cloneVNode(root, fallthroughAttrs);
2266
2613
  } else if (!accessedAttrs && root.type !== Comment) {
2267
2614
  const allAttrs = Object.keys(attrs);
2268
2615
  const eventAttrs = [];
@@ -2296,7 +2643,7 @@ function renderComponentRoot$1(instance) {
2296
2643
  `Runtime directive used on component with non-element root node. The directives will not function as intended.`
2297
2644
  );
2298
2645
  }
2299
- root = cloneVNode(root, null, false, true);
2646
+ root = cloneVNode(root);
2300
2647
  root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
2301
2648
  }
2302
2649
  if (vnode.transition) {
@@ -2615,8 +2962,8 @@ function doWatch(source, cb, {
2615
2962
  }
2616
2963
  }
2617
2964
  let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
2618
- const job = () => {
2619
- if (!effect.active || !effect.dirty) {
2965
+ const job = (immediateFirstRun) => {
2966
+ if (!(effect.flags & 1) || !effect.dirty && !immediateFirstRun) {
2620
2967
  return;
2621
2968
  }
2622
2969
  if (cb) {
@@ -2637,19 +2984,22 @@ function doWatch(source, cb, {
2637
2984
  effect.run();
2638
2985
  }
2639
2986
  };
2640
- job.allowRecurse = !!cb;
2987
+ if (cb)
2988
+ job.flags |= 4;
2989
+ const effect = new ReactiveEffect(getter);
2641
2990
  let scheduler;
2642
2991
  if (flush === "sync") {
2992
+ effect.flags |= 64;
2643
2993
  scheduler = job;
2644
2994
  } else if (flush === "post") {
2645
2995
  scheduler = () => queuePostRenderEffect(job, instance && instance.suspense);
2646
2996
  } else {
2647
- job.pre = true;
2997
+ job.flags |= 2;
2648
2998
  if (instance)
2649
2999
  job.id = instance.uid;
2650
3000
  scheduler = () => queueJob(job);
2651
3001
  }
2652
- const effect = new ReactiveEffect(getter, NOOP, scheduler);
3002
+ effect.scheduler = scheduler;
2653
3003
  const scope = getCurrentScope();
2654
3004
  const unwatch = () => {
2655
3005
  effect.stop();
@@ -2663,7 +3013,7 @@ function doWatch(source, cb, {
2663
3013
  }
2664
3014
  if (cb) {
2665
3015
  if (immediate) {
2666
- job();
3016
+ job(true);
2667
3017
  } else {
2668
3018
  oldValue = effect.run();
2669
3019
  }
@@ -2704,29 +3054,34 @@ function createPathGetter(ctx, path) {
2704
3054
  return cur;
2705
3055
  };
2706
3056
  }
2707
- function traverse(value, depth = Infinity, seen) {
2708
- if (depth <= 0 || !isObject(value) || value["__v_skip"]) {
3057
+ function traverse(value, depth, currentDepth = 0, seen) {
3058
+ if (!isObject(value) || value["__v_skip"]) {
2709
3059
  return value;
2710
3060
  }
3061
+ if (depth && depth > 0) {
3062
+ if (currentDepth >= depth) {
3063
+ return value;
3064
+ }
3065
+ currentDepth++;
3066
+ }
2711
3067
  seen = seen || /* @__PURE__ */ new Set();
2712
3068
  if (seen.has(value)) {
2713
3069
  return value;
2714
3070
  }
2715
3071
  seen.add(value);
2716
- depth--;
2717
3072
  if (isRef(value)) {
2718
- traverse(value.value, depth, seen);
3073
+ traverse(value.value, depth, currentDepth, seen);
2719
3074
  } else if (isArray(value)) {
2720
3075
  for (let i = 0; i < value.length; i++) {
2721
- traverse(value[i], depth, seen);
3076
+ traverse(value[i], depth, currentDepth, seen);
2722
3077
  }
2723
3078
  } else if (isSet(value) || isMap(value)) {
2724
3079
  value.forEach((v) => {
2725
- traverse(v, depth, seen);
3080
+ traverse(v, depth, currentDepth, seen);
2726
3081
  });
2727
3082
  } else if (isPlainObject(value)) {
2728
3083
  for (const key in value) {
2729
- traverse(value[key], depth, seen);
3084
+ traverse(value[key], depth, currentDepth, seen);
2730
3085
  }
2731
3086
  }
2732
3087
  return value;
@@ -2874,7 +3229,6 @@ const publicPropertiesMap = (
2874
3229
  $emit: (i) => i.emit,
2875
3230
  $options: (i) => resolveMergedOptions(i) ,
2876
3231
  $forceUpdate: (i) => i.f || (i.f = () => {
2877
- i.effect.dirty = true;
2878
3232
  queueJob(i.update);
2879
3233
  }),
2880
3234
  $nextTick: (i) => i.n || (i.n = nextTick.bind(i.proxy)),
@@ -4067,7 +4421,9 @@ const isSimpleType = /* @__PURE__ */ makeMap(
4067
4421
  function assertType(value, type) {
4068
4422
  let valid;
4069
4423
  const expectedType = getType(type);
4070
- if (isSimpleType(expectedType)) {
4424
+ if (expectedType === "null") {
4425
+ valid = value === null;
4426
+ } else if (isSimpleType(expectedType)) {
4071
4427
  const t = typeof value;
4072
4428
  valid = t === expectedType.toLowerCase();
4073
4429
  if (!valid && t === "object") {
@@ -4077,8 +4433,6 @@ function assertType(value, type) {
4077
4433
  valid = isObject(value);
4078
4434
  } else if (expectedType === "Array") {
4079
4435
  valid = isArray(value);
4080
- } else if (expectedType === "null") {
4081
- valid = value === null;
4082
4436
  } else {
4083
4437
  valid = value instanceof type;
4084
4438
  }
@@ -4173,7 +4527,7 @@ const initSlots = (instance, children) => {
4173
4527
  const type = children._;
4174
4528
  if (type) {
4175
4529
  extend(slots, children);
4176
- def(slots, "_", type, true);
4530
+ def(slots, "_", type);
4177
4531
  } else {
4178
4532
  normalizeObjectSlots(children, slots);
4179
4533
  }
@@ -5023,7 +5377,6 @@ function baseCreateRenderer(options, createHydrationFns) {
5023
5377
  } else {
5024
5378
  instance.next = n2;
5025
5379
  invalidateJob(instance.update);
5026
- instance.effect.dirty = true;
5027
5380
  instance.update();
5028
5381
  }
5029
5382
  } else {
@@ -5206,24 +5559,18 @@ function baseCreateRenderer(options, createHydrationFns) {
5206
5559
  }
5207
5560
  }
5208
5561
  };
5209
- const effect = instance.effect = new ReactiveEffect(
5210
- componentUpdateFn,
5211
- NOOP,
5212
- () => queueJob(update),
5213
- instance.scope
5214
- // track it in component's effect scope
5215
- );
5216
- const update = instance.update = () => {
5217
- if (effect.dirty) {
5218
- effect.run();
5219
- }
5220
- };
5221
- update.id = instance.uid;
5562
+ instance.scope.on();
5563
+ const effect = instance.effect = new ReactiveEffect(componentUpdateFn);
5564
+ instance.scope.off();
5565
+ const update = instance.update = effect.run.bind(effect);
5566
+ const job = instance.job = effect.runIfDirty.bind(effect);
5567
+ job.id = instance.uid;
5568
+ effect.scheduler = () => queueJob(job);
5222
5569
  toggleRecurse(instance, true);
5223
5570
  {
5224
5571
  effect.onTrack = instance.rtc ? (e) => invokeArrayFns(instance.rtc, e) : void 0;
5225
5572
  effect.onTrigger = instance.rtg ? (e) => invokeArrayFns(instance.rtg, e) : void 0;
5226
- update.ownerInstance = instance;
5573
+ job.ownerInstance = instance;
5227
5574
  }
5228
5575
  update();
5229
5576
  };
@@ -5690,13 +6037,13 @@ function baseCreateRenderer(options, createHydrationFns) {
5690
6037
  if (instance.type.__hmrId) {
5691
6038
  unregisterHMR(instance);
5692
6039
  }
5693
- const { bum, scope, update, subTree, um } = instance;
6040
+ const { bum, scope, job, subTree, um } = instance;
5694
6041
  if (bum) {
5695
6042
  invokeArrayFns(bum);
5696
6043
  }
5697
6044
  scope.stop();
5698
- if (update) {
5699
- update.active = false;
6045
+ if (job) {
6046
+ job.flags |= 8;
5700
6047
  unmount(subTree, instance, parentSuspense, doRemove);
5701
6048
  }
5702
6049
  if (um) {
@@ -5777,8 +6124,14 @@ function baseCreateRenderer(options, createHydrationFns) {
5777
6124
  function resolveChildrenNamespace({ type, props }, currentNamespace) {
5778
6125
  return currentNamespace === "svg" && type === "foreignObject" || currentNamespace === "mathml" && type === "annotation-xml" && props && props.encoding && props.encoding.includes("html") ? void 0 : currentNamespace;
5779
6126
  }
5780
- function toggleRecurse({ effect, update }, allowed) {
5781
- effect.allowRecurse = update.allowRecurse = allowed;
6127
+ function toggleRecurse({ effect, job }, allowed) {
6128
+ if (allowed) {
6129
+ effect.flags |= 32;
6130
+ job.flags |= 4;
6131
+ } else {
6132
+ effect.flags &= ~32;
6133
+ job.flags &= ~4;
6134
+ }
5782
6135
  }
5783
6136
  function needTransition(parentSuspense, transition) {
5784
6137
  return (!parentSuspense || parentSuspense && !parentSuspense.pendingBranch) && transition && !transition.persisted;
@@ -6019,8 +6372,8 @@ function guardReactiveProps(props) {
6019
6372
  return null;
6020
6373
  return isProxy(props) || isInternalObject(props) ? extend({}, props) : props;
6021
6374
  }
6022
- function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false) {
6023
- const { props, ref, patchFlag, children, transition } = vnode;
6375
+ function cloneVNode(vnode, extraProps, mergeRef = false) {
6376
+ const { props, ref, patchFlag, children } = vnode;
6024
6377
  const mergedProps = extraProps ? mergeProps(props || {}, extraProps) : props;
6025
6378
  const cloned = {
6026
6379
  __v_isVNode: true,
@@ -6050,7 +6403,7 @@ function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false
6050
6403
  dynamicChildren: vnode.dynamicChildren,
6051
6404
  appContext: vnode.appContext,
6052
6405
  dirs: vnode.dirs,
6053
- transition,
6406
+ transition: vnode.transition,
6054
6407
  // These should technically only be non-null on mounted VNodes. However,
6055
6408
  // they *should* be copied for kept-alive vnodes. So we just always copy
6056
6409
  // them since them being non-null during a mount doesn't affect the logic as
@@ -6064,9 +6417,6 @@ function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false
6064
6417
  ctx: vnode.ctx,
6065
6418
  ce: vnode.ce
6066
6419
  };
6067
- if (transition && cloneTransition) {
6068
- cloned.transition = transition.clone(cloned);
6069
- }
6070
6420
  return cloned;
6071
6421
  }
6072
6422
  function deepCloneVNode(vnode) {
@@ -6193,6 +6543,7 @@ function createComponentInstance$1(vnode, parent, suspense) {
6193
6543
  effect: null,
6194
6544
  update: null,
6195
6545
  // will be set synchronously right after creation
6546
+ job: null,
6196
6547
  scope: new EffectScope(
6197
6548
  true
6198
6549
  /* detached */
@@ -6596,7 +6947,7 @@ const computed = (getterOrOptions, debugOptions) => {
6596
6947
  return c;
6597
6948
  };
6598
6949
 
6599
- const version = "3.4.26";
6950
+ const version = "3.5.0-alpha.1";
6600
6951
  const warn = warn$1 ;
6601
6952
  const _ssrUtils = {
6602
6953
  createComponentInstance: createComponentInstance$1,
@@ -7587,12 +7938,6 @@ function renderComponentSubTree(instance, slotScopeId) {
7587
7938
  if ((!instance.render || instance.render === NOOP) && !instance.ssrRender && !comp.ssrRender && isString(comp.template)) {
7588
7939
  comp.ssrRender = ssrCompile(comp.template);
7589
7940
  }
7590
- for (const e of instance.scope.effects) {
7591
- if (e.computed) {
7592
- e.computed._dirty = true;
7593
- e.computed._cacheable = true;
7594
- }
7595
- }
7596
7941
  const ssrRender = instance.ssrRender || comp.ssrRender;
7597
7942
  if (ssrRender) {
7598
7943
  let attrs = instance.inheritAttrs !== false ? instance.attrs : void 0;