@vue/compat 3.4.26 → 3.5.0-alpha.2

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/compat v3.4.26
2
+ * @vue/compat v3.5.0-alpha.2
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -450,156 +450,280 @@ class EffectScope {
450
450
  function effectScope(detached) {
451
451
  return new EffectScope(detached);
452
452
  }
453
- function recordEffectScope(effect, scope = activeEffectScope) {
454
- if (scope && scope.active) {
455
- scope.effects.push(effect);
456
- }
457
- }
458
453
  function getCurrentScope() {
459
454
  return activeEffectScope;
460
455
  }
461
- function onScopeDispose(fn) {
456
+ function onScopeDispose(fn, failSilently = false) {
462
457
  if (activeEffectScope) {
463
458
  activeEffectScope.cleanups.push(fn);
464
- } else if (!!(process.env.NODE_ENV !== "production")) {
459
+ } else if (!!(process.env.NODE_ENV !== "production") && !failSilently) {
465
460
  warn$2(
466
461
  `onScopeDispose() is called when there is no active effect scope to be associated with.`
467
462
  );
468
463
  }
469
464
  }
470
465
 
471
- let activeEffect;
466
+ let activeSub;
472
467
  class ReactiveEffect {
473
- constructor(fn, trigger, scheduler, scope) {
468
+ constructor(fn) {
474
469
  this.fn = fn;
475
- this.trigger = trigger;
476
- this.scheduler = scheduler;
477
- this.active = true;
478
- this.deps = [];
479
470
  /**
480
471
  * @internal
481
472
  */
482
- this._dirtyLevel = 4;
473
+ this.deps = void 0;
483
474
  /**
484
475
  * @internal
485
476
  */
486
- this._trackId = 0;
477
+ this.depsTail = void 0;
487
478
  /**
488
479
  * @internal
489
480
  */
490
- this._runnings = 0;
481
+ this.flags = 1 | 4;
491
482
  /**
492
483
  * @internal
493
484
  */
494
- this._shouldSchedule = false;
485
+ this.nextEffect = void 0;
495
486
  /**
496
487
  * @internal
497
488
  */
498
- this._depsLength = 0;
499
- recordEffectScope(this, scope);
500
- }
501
- get dirty() {
502
- if (this._dirtyLevel === 2 || this._dirtyLevel === 3) {
503
- this._dirtyLevel = 1;
504
- pauseTracking();
505
- for (let i = 0; i < this._depsLength; i++) {
506
- const dep = this.deps[i];
507
- if (dep.computed) {
508
- triggerComputed(dep.computed);
509
- if (this._dirtyLevel >= 4) {
510
- break;
511
- }
512
- }
513
- }
514
- if (this._dirtyLevel === 1) {
515
- this._dirtyLevel = 0;
516
- }
517
- resetTracking();
489
+ this.cleanup = void 0;
490
+ this.scheduler = void 0;
491
+ if (activeEffectScope && activeEffectScope.active) {
492
+ activeEffectScope.effects.push(this);
518
493
  }
519
- return this._dirtyLevel >= 4;
520
494
  }
521
- set dirty(v) {
522
- this._dirtyLevel = v ? 4 : 0;
495
+ /**
496
+ * @internal
497
+ */
498
+ notify() {
499
+ if (this.flags & 2 && !(this.flags & 32)) {
500
+ return;
501
+ }
502
+ if (this.flags & 64) {
503
+ return this.trigger();
504
+ }
505
+ if (!(this.flags & 8)) {
506
+ this.flags |= 8;
507
+ this.nextEffect = batchedEffect;
508
+ batchedEffect = this;
509
+ }
523
510
  }
524
511
  run() {
525
- this._dirtyLevel = 0;
526
- if (!this.active) {
512
+ if (!(this.flags & 1)) {
527
513
  return this.fn();
528
514
  }
529
- let lastShouldTrack = shouldTrack;
530
- let lastEffect = activeEffect;
515
+ this.flags |= 2;
516
+ cleanupEffect(this);
517
+ prepareDeps(this);
518
+ const prevEffect = activeSub;
519
+ const prevShouldTrack = shouldTrack;
520
+ activeSub = this;
521
+ shouldTrack = true;
531
522
  try {
532
- shouldTrack = true;
533
- activeEffect = this;
534
- this._runnings++;
535
- preCleanupEffect(this);
536
523
  return this.fn();
537
524
  } finally {
538
- postCleanupEffect(this);
539
- this._runnings--;
540
- activeEffect = lastEffect;
541
- shouldTrack = lastShouldTrack;
525
+ if (!!(process.env.NODE_ENV !== "production") && activeSub !== this) {
526
+ warn$2(
527
+ "Active effect was not restored correctly - this is likely a Vue internal bug."
528
+ );
529
+ }
530
+ cleanupDeps(this);
531
+ activeSub = prevEffect;
532
+ shouldTrack = prevShouldTrack;
533
+ this.flags &= ~2;
542
534
  }
543
535
  }
544
536
  stop() {
545
- if (this.active) {
546
- preCleanupEffect(this);
547
- postCleanupEffect(this);
537
+ if (this.flags & 1) {
538
+ for (let link = this.deps; link; link = link.nextDep) {
539
+ removeSub(link);
540
+ }
541
+ this.deps = this.depsTail = void 0;
542
+ cleanupEffect(this);
548
543
  this.onStop && this.onStop();
549
- this.active = false;
544
+ this.flags &= ~1;
545
+ }
546
+ }
547
+ trigger() {
548
+ if (this.scheduler) {
549
+ this.scheduler();
550
+ } else {
551
+ this.runIfDirty();
550
552
  }
551
553
  }
554
+ /**
555
+ * @internal
556
+ */
557
+ runIfDirty() {
558
+ if (isDirty(this)) {
559
+ this.run();
560
+ }
561
+ }
562
+ get dirty() {
563
+ return isDirty(this);
564
+ }
552
565
  }
553
- function triggerComputed(computed) {
554
- return computed.value;
566
+ let batchDepth = 0;
567
+ let batchedEffect;
568
+ function startBatch() {
569
+ batchDepth++;
555
570
  }
556
- function preCleanupEffect(effect2) {
557
- effect2._trackId++;
558
- effect2._depsLength = 0;
571
+ function endBatch() {
572
+ if (batchDepth > 1) {
573
+ batchDepth--;
574
+ return;
575
+ }
576
+ let error;
577
+ while (batchedEffect) {
578
+ let e = batchedEffect;
579
+ batchedEffect = void 0;
580
+ while (e) {
581
+ const next = e.nextEffect;
582
+ e.nextEffect = void 0;
583
+ e.flags &= ~8;
584
+ if (e.flags & 1) {
585
+ try {
586
+ e.trigger();
587
+ } catch (err) {
588
+ if (!error)
589
+ error = err;
590
+ }
591
+ }
592
+ e = next;
593
+ }
594
+ }
595
+ batchDepth--;
596
+ if (error)
597
+ throw error;
598
+ }
599
+ function prepareDeps(sub) {
600
+ for (let link = sub.deps; link; link = link.nextDep) {
601
+ link.version = -1;
602
+ link.prevActiveLink = link.dep.activeLink;
603
+ link.dep.activeLink = link;
604
+ }
559
605
  }
560
- function postCleanupEffect(effect2) {
561
- if (effect2.deps.length > effect2._depsLength) {
562
- for (let i = effect2._depsLength; i < effect2.deps.length; i++) {
563
- cleanupDepEffect(effect2.deps[i], effect2);
606
+ function cleanupDeps(sub) {
607
+ let head;
608
+ let tail = sub.depsTail;
609
+ for (let link = tail; link; link = link.prevDep) {
610
+ if (link.version === -1) {
611
+ if (link === tail)
612
+ tail = link.prevDep;
613
+ removeSub(link);
614
+ removeDep(link);
615
+ } else {
616
+ head = link;
564
617
  }
565
- effect2.deps.length = effect2._depsLength;
618
+ link.dep.activeLink = link.prevActiveLink;
619
+ link.prevActiveLink = void 0;
566
620
  }
621
+ sub.deps = head;
622
+ sub.depsTail = tail;
567
623
  }
568
- function cleanupDepEffect(dep, effect2) {
569
- const trackId = dep.get(effect2);
570
- if (trackId !== void 0 && effect2._trackId !== trackId) {
571
- dep.delete(effect2);
572
- if (dep.size === 0) {
573
- dep.cleanup();
624
+ function isDirty(sub) {
625
+ for (let link = sub.deps; link; link = link.nextDep) {
626
+ if (link.dep.version !== link.version || link.dep.computed && refreshComputed(link.dep.computed) === false || link.dep.version !== link.version) {
627
+ return true;
574
628
  }
575
629
  }
630
+ if (sub._dirty) {
631
+ return true;
632
+ }
633
+ return false;
634
+ }
635
+ function refreshComputed(computed) {
636
+ if (computed.flags & 2) {
637
+ return false;
638
+ }
639
+ if (computed.flags & 4 && !(computed.flags & 16)) {
640
+ return;
641
+ }
642
+ computed.flags &= ~16;
643
+ if (computed.globalVersion === globalVersion) {
644
+ return;
645
+ }
646
+ computed.globalVersion = globalVersion;
647
+ const dep = computed.dep;
648
+ computed.flags |= 2;
649
+ if (dep.version > 0 && !computed.isSSR && !isDirty(computed)) {
650
+ computed.flags &= ~2;
651
+ return;
652
+ }
653
+ const prevSub = activeSub;
654
+ const prevShouldTrack = shouldTrack;
655
+ activeSub = computed;
656
+ shouldTrack = true;
657
+ try {
658
+ prepareDeps(computed);
659
+ const value = computed.fn();
660
+ if (dep.version === 0 || hasChanged(value, computed._value)) {
661
+ computed._value = value;
662
+ dep.version++;
663
+ }
664
+ } catch (err) {
665
+ dep.version++;
666
+ throw err;
667
+ } finally {
668
+ activeSub = prevSub;
669
+ shouldTrack = prevShouldTrack;
670
+ cleanupDeps(computed);
671
+ computed.flags &= ~2;
672
+ }
673
+ }
674
+ function removeSub(link) {
675
+ const { dep, prevSub, nextSub } = link;
676
+ if (prevSub) {
677
+ prevSub.nextSub = nextSub;
678
+ link.prevSub = void 0;
679
+ }
680
+ if (nextSub) {
681
+ nextSub.prevSub = prevSub;
682
+ link.nextSub = void 0;
683
+ }
684
+ if (dep.subs === link) {
685
+ dep.subs = prevSub;
686
+ }
687
+ if (!dep.subs && dep.computed) {
688
+ dep.computed.flags &= ~4;
689
+ for (let l = dep.computed.deps; l; l = l.nextDep) {
690
+ removeSub(l);
691
+ }
692
+ }
693
+ }
694
+ function removeDep(link) {
695
+ const { prevDep, nextDep } = link;
696
+ if (prevDep) {
697
+ prevDep.nextDep = nextDep;
698
+ link.prevDep = void 0;
699
+ }
700
+ if (nextDep) {
701
+ nextDep.prevDep = prevDep;
702
+ link.nextDep = void 0;
703
+ }
576
704
  }
577
705
  function effect(fn, options) {
578
706
  if (fn.effect instanceof ReactiveEffect) {
579
707
  fn = fn.effect.fn;
580
708
  }
581
- const _effect = new ReactiveEffect(fn, NOOP, () => {
582
- if (_effect.dirty) {
583
- _effect.run();
584
- }
585
- });
709
+ const e = new ReactiveEffect(fn);
586
710
  if (options) {
587
- extend(_effect, options);
588
- if (options.scope)
589
- recordEffectScope(_effect, options.scope);
711
+ extend(e, options);
590
712
  }
591
- if (!options || !options.lazy) {
592
- _effect.run();
713
+ try {
714
+ e.run();
715
+ } catch (err) {
716
+ e.stop();
717
+ throw err;
593
718
  }
594
- const runner = _effect.run.bind(_effect);
595
- runner.effect = _effect;
719
+ const runner = e.run.bind(e);
720
+ runner.effect = e;
596
721
  return runner;
597
722
  }
598
723
  function stop(runner) {
599
724
  runner.effect.stop();
600
725
  }
601
726
  let shouldTrack = true;
602
- let pauseScheduleStack = 0;
603
727
  const trackStack = [];
604
728
  function pauseTracking() {
605
729
  trackStack.push(shouldTrack);
@@ -609,192 +733,418 @@ function resetTracking() {
609
733
  const last = trackStack.pop();
610
734
  shouldTrack = last === void 0 ? true : last;
611
735
  }
612
- function pauseScheduling() {
613
- pauseScheduleStack++;
614
- }
615
- function resetScheduling() {
616
- pauseScheduleStack--;
617
- while (!pauseScheduleStack && queueEffectSchedulers.length) {
618
- queueEffectSchedulers.shift()();
736
+ function cleanupEffect(e) {
737
+ const { cleanup } = e;
738
+ e.cleanup = void 0;
739
+ if (cleanup) {
740
+ const prevSub = activeSub;
741
+ activeSub = void 0;
742
+ try {
743
+ cleanup();
744
+ } finally {
745
+ activeSub = prevSub;
746
+ }
619
747
  }
620
748
  }
621
- function trackEffect(effect2, dep, debuggerEventExtraInfo) {
622
- var _a;
623
- if (dep.get(effect2) !== effect2._trackId) {
624
- dep.set(effect2, effect2._trackId);
625
- const oldDep = effect2.deps[effect2._depsLength];
626
- if (oldDep !== dep) {
627
- if (oldDep) {
628
- cleanupDepEffect(oldDep, effect2);
629
- }
630
- effect2.deps[effect2._depsLength++] = dep;
631
- } else {
632
- effect2._depsLength++;
633
- }
749
+
750
+ let globalVersion = 0;
751
+ class Dep {
752
+ constructor(computed) {
753
+ this.computed = computed;
754
+ this.version = 0;
755
+ /**
756
+ * Link between this dep and the current active effect
757
+ */
758
+ this.activeLink = void 0;
759
+ /**
760
+ * Doubly linked list representing the subscribing effects (tail)
761
+ */
762
+ this.subs = void 0;
634
763
  if (!!(process.env.NODE_ENV !== "production")) {
635
- (_a = effect2.onTrack) == null ? void 0 : _a.call(effect2, extend({ effect: effect2 }, debuggerEventExtraInfo));
764
+ this.subsHead = void 0;
636
765
  }
637
766
  }
638
- }
639
- const queueEffectSchedulers = [];
640
- function triggerEffects(dep, dirtyLevel, debuggerEventExtraInfo) {
641
- var _a;
642
- pauseScheduling();
643
- for (const effect2 of dep.keys()) {
644
- let tracking;
645
- if (effect2._dirtyLevel < dirtyLevel && (tracking != null ? tracking : tracking = dep.get(effect2) === effect2._trackId)) {
646
- effect2._shouldSchedule || (effect2._shouldSchedule = effect2._dirtyLevel === 0);
647
- effect2._dirtyLevel = dirtyLevel;
648
- }
649
- if (effect2._shouldSchedule && (tracking != null ? tracking : tracking = dep.get(effect2) === effect2._trackId)) {
650
- if (!!(process.env.NODE_ENV !== "production")) {
651
- (_a = effect2.onTrigger) == null ? void 0 : _a.call(effect2, extend({ effect: effect2 }, debuggerEventExtraInfo));
767
+ track(debugInfo) {
768
+ if (!activeSub || !shouldTrack) {
769
+ return;
770
+ }
771
+ let link = this.activeLink;
772
+ if (link === void 0 || link.sub !== activeSub) {
773
+ link = this.activeLink = {
774
+ dep: this,
775
+ sub: activeSub,
776
+ version: this.version,
777
+ nextDep: void 0,
778
+ prevDep: void 0,
779
+ nextSub: void 0,
780
+ prevSub: void 0,
781
+ prevActiveLink: void 0
782
+ };
783
+ if (!activeSub.deps) {
784
+ activeSub.deps = activeSub.depsTail = link;
785
+ } else {
786
+ link.prevDep = activeSub.depsTail;
787
+ activeSub.depsTail.nextDep = link;
788
+ activeSub.depsTail = link;
789
+ }
790
+ if (activeSub.flags & 4) {
791
+ addSub(link);
652
792
  }
653
- effect2.trigger();
654
- if ((!effect2._runnings || effect2.allowRecurse) && effect2._dirtyLevel !== 2) {
655
- effect2._shouldSchedule = false;
656
- if (effect2.scheduler) {
657
- queueEffectSchedulers.push(effect2.scheduler);
793
+ } else if (link.version === -1) {
794
+ link.version = this.version;
795
+ if (link.nextDep) {
796
+ const next = link.nextDep;
797
+ next.prevDep = link.prevDep;
798
+ if (link.prevDep) {
799
+ link.prevDep.nextDep = next;
800
+ }
801
+ link.prevDep = activeSub.depsTail;
802
+ link.nextDep = void 0;
803
+ activeSub.depsTail.nextDep = link;
804
+ activeSub.depsTail = link;
805
+ if (activeSub.deps === link) {
806
+ activeSub.deps = next;
807
+ }
808
+ }
809
+ }
810
+ if (!!(process.env.NODE_ENV !== "production") && activeSub.onTrack) {
811
+ activeSub.onTrack(
812
+ extend(
813
+ {
814
+ effect: activeSub
815
+ },
816
+ debugInfo
817
+ )
818
+ );
819
+ }
820
+ return link;
821
+ }
822
+ trigger(debugInfo) {
823
+ this.version++;
824
+ globalVersion++;
825
+ this.notify(debugInfo);
826
+ }
827
+ notify(debugInfo) {
828
+ startBatch();
829
+ try {
830
+ if (!!(process.env.NODE_ENV !== "production")) {
831
+ for (let head = this.subsHead; head; head = head.nextSub) {
832
+ if (!!(process.env.NODE_ENV !== "production") && head.sub.onTrigger && !(head.sub.flags & 8)) {
833
+ head.sub.onTrigger(
834
+ extend(
835
+ {
836
+ effect: head.sub
837
+ },
838
+ debugInfo
839
+ )
840
+ );
841
+ }
658
842
  }
659
843
  }
844
+ for (let link = this.subs; link; link = link.prevSub) {
845
+ link.sub.notify();
846
+ }
847
+ } finally {
848
+ endBatch();
660
849
  }
661
850
  }
662
- resetScheduling();
663
851
  }
664
-
665
- const createDep = (cleanup, computed) => {
666
- const dep = /* @__PURE__ */ new Map();
667
- dep.cleanup = cleanup;
668
- dep.computed = computed;
669
- return dep;
670
- };
671
-
852
+ function addSub(link) {
853
+ const computed = link.dep.computed;
854
+ if (computed && !link.dep.subs) {
855
+ computed.flags |= 4 | 16;
856
+ for (let l = computed.deps; l; l = l.nextDep) {
857
+ addSub(l);
858
+ }
859
+ }
860
+ const currentTail = link.dep.subs;
861
+ if (currentTail !== link) {
862
+ link.prevSub = currentTail;
863
+ if (currentTail)
864
+ currentTail.nextSub = link;
865
+ }
866
+ if (!!(process.env.NODE_ENV !== "production") && link.dep.subsHead === void 0) {
867
+ link.dep.subsHead = link;
868
+ }
869
+ link.dep.subs = link;
870
+ }
672
871
  const targetMap = /* @__PURE__ */ new WeakMap();
673
- const ITERATE_KEY = Symbol(!!(process.env.NODE_ENV !== "production") ? "iterate" : "");
674
- const MAP_KEY_ITERATE_KEY = Symbol(!!(process.env.NODE_ENV !== "production") ? "Map key iterate" : "");
872
+ const ITERATE_KEY = Symbol(!!(process.env.NODE_ENV !== "production") ? "Object iterate" : "");
873
+ const MAP_KEY_ITERATE_KEY = Symbol(!!(process.env.NODE_ENV !== "production") ? "Map keys iterate" : "");
874
+ const ARRAY_ITERATE_KEY = Symbol(!!(process.env.NODE_ENV !== "production") ? "Array iterate" : "");
675
875
  function track(target, type, key) {
676
- if (shouldTrack && activeEffect) {
876
+ if (shouldTrack && activeSub) {
677
877
  let depsMap = targetMap.get(target);
678
878
  if (!depsMap) {
679
879
  targetMap.set(target, depsMap = /* @__PURE__ */ new Map());
680
880
  }
681
881
  let dep = depsMap.get(key);
682
882
  if (!dep) {
683
- depsMap.set(key, dep = createDep(() => depsMap.delete(key)));
883
+ depsMap.set(key, dep = new Dep());
684
884
  }
685
- trackEffect(
686
- activeEffect,
687
- dep,
688
- !!(process.env.NODE_ENV !== "production") ? {
885
+ if (!!(process.env.NODE_ENV !== "production")) {
886
+ dep.track({
689
887
  target,
690
888
  type,
691
889
  key
692
- } : void 0
693
- );
890
+ });
891
+ } else {
892
+ dep.track();
893
+ }
694
894
  }
695
895
  }
696
896
  function trigger(target, type, key, newValue, oldValue, oldTarget) {
697
897
  const depsMap = targetMap.get(target);
698
898
  if (!depsMap) {
899
+ globalVersion++;
699
900
  return;
700
901
  }
701
902
  let deps = [];
702
903
  if (type === "clear") {
703
904
  deps = [...depsMap.values()];
704
- } else if (key === "length" && isArray(target)) {
705
- const newLength = Number(newValue);
706
- depsMap.forEach((dep, key2) => {
707
- if (key2 === "length" || !isSymbol(key2) && key2 >= newLength) {
708
- deps.push(dep);
709
- }
710
- });
711
905
  } else {
712
- if (key !== void 0) {
713
- deps.push(depsMap.get(key));
714
- }
715
- switch (type) {
716
- case "add":
717
- if (!isArray(target)) {
718
- deps.push(depsMap.get(ITERATE_KEY));
719
- if (isMap(target)) {
720
- deps.push(depsMap.get(MAP_KEY_ITERATE_KEY));
721
- }
722
- } else if (isIntegerKey(key)) {
723
- deps.push(depsMap.get("length"));
906
+ const targetIsArray = isArray(target);
907
+ const isArrayIndex = targetIsArray && isIntegerKey(key);
908
+ if (targetIsArray && key === "length") {
909
+ const newLength = Number(newValue);
910
+ depsMap.forEach((dep, key2) => {
911
+ if (key2 === "length" || key2 === ARRAY_ITERATE_KEY || !isSymbol(key2) && key2 >= newLength) {
912
+ deps.push(dep);
724
913
  }
725
- break;
726
- case "delete":
727
- if (!isArray(target)) {
728
- deps.push(depsMap.get(ITERATE_KEY));
914
+ });
915
+ } else {
916
+ const push = (dep) => dep && deps.push(dep);
917
+ if (key !== void 0) {
918
+ push(depsMap.get(key));
919
+ }
920
+ if (isArrayIndex) {
921
+ push(depsMap.get(ARRAY_ITERATE_KEY));
922
+ }
923
+ switch (type) {
924
+ case "add":
925
+ if (!targetIsArray) {
926
+ push(depsMap.get(ITERATE_KEY));
927
+ if (isMap(target)) {
928
+ push(depsMap.get(MAP_KEY_ITERATE_KEY));
929
+ }
930
+ } else if (isArrayIndex) {
931
+ push(depsMap.get("length"));
932
+ }
933
+ break;
934
+ case "delete":
935
+ if (!targetIsArray) {
936
+ push(depsMap.get(ITERATE_KEY));
937
+ if (isMap(target)) {
938
+ push(depsMap.get(MAP_KEY_ITERATE_KEY));
939
+ }
940
+ }
941
+ break;
942
+ case "set":
729
943
  if (isMap(target)) {
730
- deps.push(depsMap.get(MAP_KEY_ITERATE_KEY));
944
+ push(depsMap.get(ITERATE_KEY));
731
945
  }
732
- }
733
- break;
734
- case "set":
735
- if (isMap(target)) {
736
- deps.push(depsMap.get(ITERATE_KEY));
737
- }
738
- break;
946
+ break;
947
+ }
739
948
  }
740
949
  }
741
- pauseScheduling();
950
+ startBatch();
742
951
  for (const dep of deps) {
743
- if (dep) {
744
- triggerEffects(
745
- dep,
746
- 4,
747
- !!(process.env.NODE_ENV !== "production") ? {
748
- target,
749
- type,
750
- key,
751
- newValue,
752
- oldValue,
753
- oldTarget
754
- } : void 0
755
- );
952
+ if (!!(process.env.NODE_ENV !== "production")) {
953
+ dep.trigger({
954
+ target,
955
+ type,
956
+ key,
957
+ newValue,
958
+ oldValue,
959
+ oldTarget
960
+ });
961
+ } else {
962
+ dep.trigger();
756
963
  }
757
964
  }
758
- resetScheduling();
965
+ endBatch();
759
966
  }
760
967
  function getDepFromReactive(object, key) {
761
- const depsMap = targetMap.get(object);
762
- return depsMap && depsMap.get(key);
968
+ var _a;
969
+ return (_a = targetMap.get(object)) == null ? void 0 : _a.get(key);
970
+ }
971
+
972
+ function reactiveReadArray(array) {
973
+ const raw = toRaw(array);
974
+ if (raw === array)
975
+ return raw;
976
+ track(raw, "iterate", ARRAY_ITERATE_KEY);
977
+ return isShallow(array) ? raw : raw.map(toReactive);
978
+ }
979
+ function shallowReadArray(arr) {
980
+ track(arr = toRaw(arr), "iterate", ARRAY_ITERATE_KEY);
981
+ return arr;
982
+ }
983
+ const arrayInstrumentations = {
984
+ __proto__: null,
985
+ [Symbol.iterator]() {
986
+ return iterator(this, Symbol.iterator, toReactive);
987
+ },
988
+ concat(...args) {
989
+ return reactiveReadArray(this).concat(
990
+ ...args.map((x) => reactiveReadArray(x))
991
+ );
992
+ },
993
+ entries() {
994
+ return iterator(this, "entries", (value) => {
995
+ value[1] = toReactive(value[1]);
996
+ return value;
997
+ });
998
+ },
999
+ every(fn, thisArg) {
1000
+ return apply(this, "every", fn, thisArg);
1001
+ },
1002
+ filter(fn, thisArg) {
1003
+ const result = apply(this, "filter", fn, thisArg);
1004
+ return isProxy(this) && !isShallow(this) ? result.map(toReactive) : result;
1005
+ },
1006
+ find(fn, thisArg) {
1007
+ const result = apply(this, "find", fn, thisArg);
1008
+ return isProxy(this) && !isShallow(this) ? toReactive(result) : result;
1009
+ },
1010
+ findIndex(fn, thisArg) {
1011
+ return apply(this, "findIndex", fn, thisArg);
1012
+ },
1013
+ findLast(fn, thisArg) {
1014
+ const result = apply(this, "findLast", fn, thisArg);
1015
+ return isProxy(this) && !isShallow(this) ? toReactive(result) : result;
1016
+ },
1017
+ findLastIndex(fn, thisArg) {
1018
+ return apply(this, "findLastIndex", fn, thisArg);
1019
+ },
1020
+ // flat, flatMap could benefit from ARRAY_ITERATE but are not straight-forward to implement
1021
+ forEach(fn, thisArg) {
1022
+ return apply(this, "forEach", fn, thisArg);
1023
+ },
1024
+ includes(...args) {
1025
+ return searchProxy(this, "includes", args);
1026
+ },
1027
+ indexOf(...args) {
1028
+ return searchProxy(this, "indexOf", args);
1029
+ },
1030
+ join(separator) {
1031
+ return reactiveReadArray(this).join(separator);
1032
+ },
1033
+ // keys() iterator only reads `length`, no optimisation required
1034
+ lastIndexOf(...args) {
1035
+ return searchProxy(this, "lastIndexOf", args);
1036
+ },
1037
+ map(fn, thisArg) {
1038
+ return apply(this, "map", fn, thisArg);
1039
+ },
1040
+ pop() {
1041
+ return noTracking(this, "pop");
1042
+ },
1043
+ push(...args) {
1044
+ return noTracking(this, "push", args);
1045
+ },
1046
+ reduce(fn, ...args) {
1047
+ return reduce(this, "reduce", fn, args);
1048
+ },
1049
+ reduceRight(fn, ...args) {
1050
+ return reduce(this, "reduceRight", fn, args);
1051
+ },
1052
+ shift() {
1053
+ return noTracking(this, "shift");
1054
+ },
1055
+ // slice could use ARRAY_ITERATE but also seems to beg for range tracking
1056
+ some(fn, thisArg) {
1057
+ return apply(this, "some", fn, thisArg);
1058
+ },
1059
+ splice(...args) {
1060
+ return noTracking(this, "splice", args);
1061
+ },
1062
+ toReversed() {
1063
+ return reactiveReadArray(this).toReversed();
1064
+ },
1065
+ toSorted(comparer) {
1066
+ return reactiveReadArray(this).toSorted(comparer);
1067
+ },
1068
+ toSpliced(...args) {
1069
+ return reactiveReadArray(this).toSpliced(...args);
1070
+ },
1071
+ unshift(...args) {
1072
+ return noTracking(this, "unshift", args);
1073
+ },
1074
+ values() {
1075
+ return iterator(this, "values", toReactive);
1076
+ }
1077
+ };
1078
+ function iterator(self, method, wrapValue) {
1079
+ const arr = shallowReadArray(self);
1080
+ const iter = arr[method]();
1081
+ if (arr !== self && !isShallow(self)) {
1082
+ iter._next = iter.next;
1083
+ iter.next = () => {
1084
+ const result = iter._next();
1085
+ if (result.value) {
1086
+ result.value = wrapValue(result.value);
1087
+ }
1088
+ return result;
1089
+ };
1090
+ }
1091
+ return iter;
1092
+ }
1093
+ function apply(self, method, fn, thisArg) {
1094
+ const arr = shallowReadArray(self);
1095
+ let wrappedFn = fn;
1096
+ if (arr !== self) {
1097
+ if (!isShallow(self)) {
1098
+ wrappedFn = function(item, index) {
1099
+ return fn.call(this, toReactive(item), index, self);
1100
+ };
1101
+ } else if (fn.length > 2) {
1102
+ wrappedFn = function(item, index) {
1103
+ return fn.call(this, item, index, self);
1104
+ };
1105
+ }
1106
+ }
1107
+ return arr[method](wrappedFn, thisArg);
1108
+ }
1109
+ function reduce(self, method, fn, args) {
1110
+ const arr = shallowReadArray(self);
1111
+ let wrappedFn = fn;
1112
+ if (arr !== self) {
1113
+ if (!isShallow(self)) {
1114
+ wrappedFn = function(acc, item, index) {
1115
+ return fn.call(this, acc, toReactive(item), index, self);
1116
+ };
1117
+ } else if (fn.length > 3) {
1118
+ wrappedFn = function(acc, item, index) {
1119
+ return fn.call(this, acc, item, index, self);
1120
+ };
1121
+ }
1122
+ }
1123
+ return arr[method](wrappedFn, ...args);
1124
+ }
1125
+ function searchProxy(self, method, args) {
1126
+ const arr = toRaw(self);
1127
+ track(arr, "iterate", ARRAY_ITERATE_KEY);
1128
+ const res = arr[method](...args);
1129
+ if ((res === -1 || res === false) && isProxy(args[0])) {
1130
+ args[0] = toRaw(args[0]);
1131
+ return arr[method](...args);
1132
+ }
1133
+ return res;
1134
+ }
1135
+ function noTracking(self, method, args = []) {
1136
+ pauseTracking();
1137
+ startBatch();
1138
+ const res = toRaw(self)[method].apply(self, args);
1139
+ endBatch();
1140
+ resetTracking();
1141
+ return res;
763
1142
  }
764
1143
 
765
1144
  const isNonTrackableKeys = /* @__PURE__ */ makeMap(`__proto__,__v_isRef,__isVue`);
766
1145
  const builtInSymbols = new Set(
767
1146
  /* @__PURE__ */ Object.getOwnPropertyNames(Symbol).filter((key) => key !== "arguments" && key !== "caller").map((key) => Symbol[key]).filter(isSymbol)
768
1147
  );
769
- const arrayInstrumentations = /* @__PURE__ */ createArrayInstrumentations();
770
- function createArrayInstrumentations() {
771
- const instrumentations = {};
772
- ["includes", "indexOf", "lastIndexOf"].forEach((key) => {
773
- instrumentations[key] = function(...args) {
774
- const arr = toRaw(this);
775
- for (let i = 0, l = this.length; i < l; i++) {
776
- track(arr, "get", i + "");
777
- }
778
- const res = arr[key](...args);
779
- if (res === -1 || res === false) {
780
- return arr[key](...args.map(toRaw));
781
- } else {
782
- return res;
783
- }
784
- };
785
- });
786
- ["push", "pop", "shift", "unshift", "splice"].forEach((key) => {
787
- instrumentations[key] = function(...args) {
788
- pauseTracking();
789
- pauseScheduling();
790
- const res = toRaw(this)[key].apply(this, args);
791
- resetScheduling();
792
- resetTracking();
793
- return res;
794
- };
795
- });
796
- return instrumentations;
797
- }
798
1148
  function hasOwnProperty(key) {
799
1149
  if (!isSymbol(key))
800
1150
  key = String(key);
@@ -825,14 +1175,22 @@ class BaseReactiveHandler {
825
1175
  }
826
1176
  const targetIsArray = isArray(target);
827
1177
  if (!isReadonly2) {
828
- if (targetIsArray && hasOwn(arrayInstrumentations, key)) {
829
- return Reflect.get(arrayInstrumentations, key, receiver);
1178
+ let fn;
1179
+ if (targetIsArray && (fn = arrayInstrumentations[key])) {
1180
+ return fn;
830
1181
  }
831
1182
  if (key === "hasOwnProperty") {
832
1183
  return hasOwnProperty;
833
1184
  }
834
1185
  }
835
- const res = Reflect.get(target, key, receiver);
1186
+ const res = Reflect.get(
1187
+ target,
1188
+ key,
1189
+ // if this is a proxy wrapping a ref, return methods using the raw ref
1190
+ // as receiver so that we don't have to call `toRaw` on the ref in all
1191
+ // its class methods
1192
+ isRef(target) ? target : receiver
1193
+ );
836
1194
  if (isSymbol(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) {
837
1195
  return res;
838
1196
  }
@@ -1331,110 +1689,8 @@ function markRaw(value) {
1331
1689
  const toReactive = (value) => isObject(value) ? reactive(value) : value;
1332
1690
  const toReadonly = (value) => isObject(value) ? readonly(value) : value;
1333
1691
 
1334
- 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`;
1335
- class ComputedRefImpl {
1336
- constructor(getter, _setter, isReadonly, isSSR) {
1337
- this.getter = getter;
1338
- this._setter = _setter;
1339
- this.dep = void 0;
1340
- this.__v_isRef = true;
1341
- this["__v_isReadonly"] = false;
1342
- this.effect = new ReactiveEffect(
1343
- () => getter(this._value),
1344
- () => triggerRefValue(
1345
- this,
1346
- this.effect._dirtyLevel === 2 ? 2 : 3
1347
- )
1348
- );
1349
- this.effect.computed = this;
1350
- this.effect.active = this._cacheable = !isSSR;
1351
- this["__v_isReadonly"] = isReadonly;
1352
- }
1353
- get value() {
1354
- const self = toRaw(this);
1355
- if ((!self._cacheable || self.effect.dirty) && hasChanged(self._value, self._value = self.effect.run())) {
1356
- triggerRefValue(self, 4);
1357
- }
1358
- trackRefValue(self);
1359
- if (self.effect._dirtyLevel >= 2) {
1360
- if (!!(process.env.NODE_ENV !== "production") && this._warnRecursive) {
1361
- warn$2(COMPUTED_SIDE_EFFECT_WARN, `
1362
-
1363
- getter: `, this.getter);
1364
- }
1365
- triggerRefValue(self, 2);
1366
- }
1367
- return self._value;
1368
- }
1369
- set value(newValue) {
1370
- this._setter(newValue);
1371
- }
1372
- // #region polyfill _dirty for backward compatibility third party code for Vue <= 3.3.x
1373
- get _dirty() {
1374
- return this.effect.dirty;
1375
- }
1376
- set _dirty(v) {
1377
- this.effect.dirty = v;
1378
- }
1379
- // #endregion
1380
- }
1381
- function computed$1(getterOrOptions, debugOptions, isSSR = false) {
1382
- let getter;
1383
- let setter;
1384
- const onlyGetter = isFunction(getterOrOptions);
1385
- if (onlyGetter) {
1386
- getter = getterOrOptions;
1387
- setter = !!(process.env.NODE_ENV !== "production") ? () => {
1388
- warn$2("Write operation failed: computed value is readonly");
1389
- } : NOOP;
1390
- } else {
1391
- getter = getterOrOptions.get;
1392
- setter = getterOrOptions.set;
1393
- }
1394
- const cRef = new ComputedRefImpl(getter, setter, onlyGetter || !setter, isSSR);
1395
- if (!!(process.env.NODE_ENV !== "production") && debugOptions && !isSSR) {
1396
- cRef.effect.onTrack = debugOptions.onTrack;
1397
- cRef.effect.onTrigger = debugOptions.onTrigger;
1398
- }
1399
- return cRef;
1400
- }
1401
-
1402
- function trackRefValue(ref2) {
1403
- var _a;
1404
- if (shouldTrack && activeEffect) {
1405
- ref2 = toRaw(ref2);
1406
- trackEffect(
1407
- activeEffect,
1408
- (_a = ref2.dep) != null ? _a : ref2.dep = createDep(
1409
- () => ref2.dep = void 0,
1410
- ref2 instanceof ComputedRefImpl ? ref2 : void 0
1411
- ),
1412
- !!(process.env.NODE_ENV !== "production") ? {
1413
- target: ref2,
1414
- type: "get",
1415
- key: "value"
1416
- } : void 0
1417
- );
1418
- }
1419
- }
1420
- function triggerRefValue(ref2, dirtyLevel = 4, newVal) {
1421
- ref2 = toRaw(ref2);
1422
- const dep = ref2.dep;
1423
- if (dep) {
1424
- triggerEffects(
1425
- dep,
1426
- dirtyLevel,
1427
- !!(process.env.NODE_ENV !== "production") ? {
1428
- target: ref2,
1429
- type: "set",
1430
- key: "value",
1431
- newValue: newVal
1432
- } : void 0
1433
- );
1434
- }
1435
- }
1436
1692
  function isRef(r) {
1437
- return !!(r && r.__v_isRef === true);
1693
+ return r ? r.__v_isRef === true : false;
1438
1694
  }
1439
1695
  function ref(value) {
1440
1696
  return createRef(value, false);
@@ -1451,27 +1707,55 @@ function createRef(rawValue, shallow) {
1451
1707
  class RefImpl {
1452
1708
  constructor(value, __v_isShallow) {
1453
1709
  this.__v_isShallow = __v_isShallow;
1454
- this.dep = void 0;
1710
+ this.dep = new Dep();
1455
1711
  this.__v_isRef = true;
1456
1712
  this._rawValue = __v_isShallow ? value : toRaw(value);
1457
1713
  this._value = __v_isShallow ? value : toReactive(value);
1458
1714
  }
1459
1715
  get value() {
1460
- trackRefValue(this);
1716
+ if (!!(process.env.NODE_ENV !== "production")) {
1717
+ this.dep.track({
1718
+ target: this,
1719
+ type: "get",
1720
+ key: "value"
1721
+ });
1722
+ } else {
1723
+ this.dep.track();
1724
+ }
1461
1725
  return this._value;
1462
1726
  }
1463
- set value(newVal) {
1464
- const useDirectValue = this.__v_isShallow || isShallow(newVal) || isReadonly(newVal);
1465
- newVal = useDirectValue ? newVal : toRaw(newVal);
1466
- if (hasChanged(newVal, this._rawValue)) {
1467
- this._rawValue = newVal;
1468
- this._value = useDirectValue ? newVal : toReactive(newVal);
1469
- triggerRefValue(this, 4, newVal);
1727
+ set value(newValue) {
1728
+ const oldValue = this._rawValue;
1729
+ const useDirectValue = this.__v_isShallow || isShallow(newValue) || isReadonly(newValue);
1730
+ newValue = useDirectValue ? newValue : toRaw(newValue);
1731
+ if (hasChanged(newValue, oldValue)) {
1732
+ this._rawValue = newValue;
1733
+ this._value = useDirectValue ? newValue : toReactive(newValue);
1734
+ if (!!(process.env.NODE_ENV !== "production")) {
1735
+ this.dep.trigger({
1736
+ target: this,
1737
+ type: "set",
1738
+ key: "value",
1739
+ newValue,
1740
+ oldValue
1741
+ });
1742
+ } else {
1743
+ this.dep.trigger();
1744
+ }
1470
1745
  }
1471
1746
  }
1472
1747
  }
1473
1748
  function triggerRef(ref2) {
1474
- triggerRefValue(ref2, 4, !!(process.env.NODE_ENV !== "production") ? ref2.value : void 0);
1749
+ if (!!(process.env.NODE_ENV !== "production")) {
1750
+ ref2.dep.trigger({
1751
+ target: ref2,
1752
+ type: "set",
1753
+ key: "value",
1754
+ newValue: ref2._value
1755
+ });
1756
+ } else {
1757
+ ref2.dep.trigger();
1758
+ }
1475
1759
  }
1476
1760
  function unref(ref2) {
1477
1761
  return isRef(ref2) ? ref2.value : ref2;
@@ -1496,12 +1780,9 @@ function proxyRefs(objectWithRefs) {
1496
1780
  }
1497
1781
  class CustomRefImpl {
1498
1782
  constructor(factory) {
1499
- this.dep = void 0;
1500
1783
  this.__v_isRef = true;
1501
- const { get, set } = factory(
1502
- () => trackRefValue(this),
1503
- () => triggerRefValue(this)
1504
- );
1784
+ const dep = this.dep = new Dep();
1785
+ const { get, set } = factory(dep.track.bind(dep), dep.trigger.bind(dep));
1505
1786
  this._get = get;
1506
1787
  this._set = set;
1507
1788
  }
@@ -1569,6 +1850,90 @@ function propertyToRef(source, key, defaultValue) {
1569
1850
  return isRef(val) ? val : new ObjectRefImpl(source, key, defaultValue);
1570
1851
  }
1571
1852
 
1853
+ class ComputedRefImpl {
1854
+ constructor(fn, setter, isSSR) {
1855
+ this.fn = fn;
1856
+ this.setter = setter;
1857
+ /**
1858
+ * @internal
1859
+ */
1860
+ this._value = void 0;
1861
+ /**
1862
+ * @internal
1863
+ */
1864
+ this.dep = new Dep(this);
1865
+ /**
1866
+ * @internal
1867
+ */
1868
+ this.__v_isRef = true;
1869
+ // A computed is also a subscriber that tracks other deps
1870
+ /**
1871
+ * @internal
1872
+ */
1873
+ this.deps = void 0;
1874
+ /**
1875
+ * @internal
1876
+ */
1877
+ this.depsTail = void 0;
1878
+ /**
1879
+ * @internal
1880
+ */
1881
+ this.flags = 16;
1882
+ /**
1883
+ * @internal
1884
+ */
1885
+ this.globalVersion = globalVersion - 1;
1886
+ // for backwards compat
1887
+ this.effect = this;
1888
+ this.__v_isReadonly = !setter;
1889
+ this.isSSR = isSSR;
1890
+ }
1891
+ /**
1892
+ * @internal
1893
+ */
1894
+ notify() {
1895
+ if (activeSub !== this) {
1896
+ this.flags |= 16;
1897
+ this.dep.notify();
1898
+ } else if (!!(process.env.NODE_ENV !== "production")) ;
1899
+ }
1900
+ get value() {
1901
+ const link = !!(process.env.NODE_ENV !== "production") ? this.dep.track({
1902
+ target: this,
1903
+ type: "get",
1904
+ key: "value"
1905
+ }) : this.dep.track();
1906
+ refreshComputed(this);
1907
+ if (link) {
1908
+ link.version = this.dep.version;
1909
+ }
1910
+ return this._value;
1911
+ }
1912
+ set value(newValue) {
1913
+ if (this.setter) {
1914
+ this.setter(newValue);
1915
+ } else if (!!(process.env.NODE_ENV !== "production")) {
1916
+ warn$2("Write operation failed: computed value is readonly");
1917
+ }
1918
+ }
1919
+ }
1920
+ function computed$1(getterOrOptions, debugOptions, isSSR = false) {
1921
+ let getter;
1922
+ let setter;
1923
+ if (isFunction(getterOrOptions)) {
1924
+ getter = getterOrOptions;
1925
+ } else {
1926
+ getter = getterOrOptions.get;
1927
+ setter = getterOrOptions.set;
1928
+ }
1929
+ const cRef = new ComputedRefImpl(getter, setter, isSSR);
1930
+ if (!!(process.env.NODE_ENV !== "production") && debugOptions && !isSSR) {
1931
+ cRef.onTrack = debugOptions.onTrack;
1932
+ cRef.onTrigger = debugOptions.onTrigger;
1933
+ }
1934
+ return cRef;
1935
+ }
1936
+
1572
1937
  const TrackOpTypes = {
1573
1938
  "GET": "get",
1574
1939
  "HAS": "has",
@@ -1730,7 +2095,9 @@ const ErrorCodes = {
1730
2095
  "ASYNC_COMPONENT_LOADER": 13,
1731
2096
  "13": "ASYNC_COMPONENT_LOADER",
1732
2097
  "SCHEDULER": 14,
1733
- "14": "SCHEDULER"
2098
+ "14": "SCHEDULER",
2099
+ "APP_UNMOUNT_CLEANUP": 15,
2100
+ "15": "APP_UNMOUNT_CLEANUP"
1734
2101
  };
1735
2102
  const ErrorTypeStrings$1 = {
1736
2103
  ["sp"]: "serverPrefetch hook",
@@ -1761,7 +2128,8 @@ const ErrorTypeStrings$1 = {
1761
2128
  [11]: "app warnHandler",
1762
2129
  [12]: "ref function",
1763
2130
  [13]: "async component loader",
1764
- [14]: "scheduler flush. This is likely a Vue internals bug. Please open an issue at https://github.com/vuejs/core ."
2131
+ [14]: "scheduler flush. This is likely a Vue internals bug. Please open an issue at https://github.com/vuejs/core .",
2132
+ [15]: "app unmount cleanup function"
1765
2133
  };
1766
2134
  function callWithErrorHandling(fn, instance, type, args) {
1767
2135
  try {
@@ -1865,7 +2233,7 @@ function findInsertionIndex(id) {
1865
2233
  const middle = start + end >>> 1;
1866
2234
  const middleJob = queue[middle];
1867
2235
  const middleJobId = getId(middleJob);
1868
- if (middleJobId < id || middleJobId === id && middleJob.pre) {
2236
+ if (middleJobId < id || middleJobId === id && middleJob.flags & 2) {
1869
2237
  start = middle + 1;
1870
2238
  } else {
1871
2239
  end = middle;
@@ -1874,15 +2242,21 @@ function findInsertionIndex(id) {
1874
2242
  return start;
1875
2243
  }
1876
2244
  function queueJob(job) {
1877
- if (!queue.length || !queue.includes(
1878
- job,
1879
- isFlushing && job.allowRecurse ? flushIndex + 1 : flushIndex
1880
- )) {
2245
+ var _a;
2246
+ if (!(job.flags & 1)) {
1881
2247
  if (job.id == null) {
1882
2248
  queue.push(job);
2249
+ } else if (
2250
+ // fast path when the job id is larger than the tail
2251
+ !(job.flags & 2) && job.id >= (((_a = queue[queue.length - 1]) == null ? void 0 : _a.id) || 0)
2252
+ ) {
2253
+ queue.push(job);
1883
2254
  } else {
1884
2255
  queue.splice(findInsertionIndex(job.id), 0, job);
1885
2256
  }
2257
+ if (!(job.flags & 4)) {
2258
+ job.flags |= 1;
2259
+ }
1886
2260
  queueFlush();
1887
2261
  }
1888
2262
  }
@@ -1900,11 +2274,11 @@ function invalidateJob(job) {
1900
2274
  }
1901
2275
  function queuePostFlushCb(cb) {
1902
2276
  if (!isArray(cb)) {
1903
- if (!activePostFlushCbs || !activePostFlushCbs.includes(
1904
- cb,
1905
- cb.allowRecurse ? postFlushIndex + 1 : postFlushIndex
1906
- )) {
2277
+ if (!(cb.flags & 1)) {
1907
2278
  pendingPostFlushCbs.push(cb);
2279
+ if (!(cb.flags & 4)) {
2280
+ cb.flags |= 1;
2281
+ }
1908
2282
  }
1909
2283
  } else {
1910
2284
  pendingPostFlushCbs.push(...cb);
@@ -1917,7 +2291,7 @@ function flushPreFlushCbs(instance, seen, i = isFlushing ? flushIndex + 1 : 0) {
1917
2291
  }
1918
2292
  for (; i < queue.length; i++) {
1919
2293
  const cb = queue[i];
1920
- if (cb && cb.pre) {
2294
+ if (cb && cb.flags & 2) {
1921
2295
  if (instance && cb.id !== instance.uid) {
1922
2296
  continue;
1923
2297
  }
@@ -1927,6 +2301,7 @@ function flushPreFlushCbs(instance, seen, i = isFlushing ? flushIndex + 1 : 0) {
1927
2301
  queue.splice(i, 1);
1928
2302
  i--;
1929
2303
  cb();
2304
+ cb.flags &= ~1;
1930
2305
  }
1931
2306
  }
1932
2307
  }
@@ -1949,6 +2324,7 @@ function flushPostFlushCbs(seen) {
1949
2324
  continue;
1950
2325
  }
1951
2326
  activePostFlushCbs[postFlushIndex]();
2327
+ activePostFlushCbs[postFlushIndex].flags &= ~1;
1952
2328
  }
1953
2329
  activePostFlushCbs = null;
1954
2330
  postFlushIndex = 0;
@@ -1958,9 +2334,11 @@ const getId = (job) => job.id == null ? Infinity : job.id;
1958
2334
  const comparator = (a, b) => {
1959
2335
  const diff = getId(a) - getId(b);
1960
2336
  if (diff === 0) {
1961
- if (a.pre && !b.pre)
2337
+ const isAPre = a.flags & 2;
2338
+ const isBPre = b.flags & 2;
2339
+ if (isAPre && !isBPre)
1962
2340
  return -1;
1963
- if (b.pre && !a.pre)
2341
+ if (isBPre && !isAPre)
1964
2342
  return 1;
1965
2343
  }
1966
2344
  return diff;
@@ -1976,11 +2354,12 @@ function flushJobs(seen) {
1976
2354
  try {
1977
2355
  for (flushIndex = 0; flushIndex < queue.length; flushIndex++) {
1978
2356
  const job = queue[flushIndex];
1979
- if (job && job.active !== false) {
2357
+ if (job && !(job.flags & 8)) {
1980
2358
  if (!!(process.env.NODE_ENV !== "production") && check(job)) {
1981
2359
  continue;
1982
2360
  }
1983
2361
  callWithErrorHandling(job, null, 14);
2362
+ job.flags &= ~1;
1984
2363
  }
1985
2364
  }
1986
2365
  } finally {
@@ -2062,7 +2441,6 @@ function rerender(id, newRender) {
2062
2441
  }
2063
2442
  instance.renderCache = [];
2064
2443
  isHmrUpdating = true;
2065
- instance.effect.dirty = true;
2066
2444
  instance.update();
2067
2445
  isHmrUpdating = false;
2068
2446
  });
@@ -2090,7 +2468,6 @@ function reload(id, newComp) {
2090
2468
  instance.ceReload(newComp.styles);
2091
2469
  hmrDirtyComponents.delete(oldComp);
2092
2470
  } else if (instance.parent) {
2093
- instance.parent.effect.dirty = true;
2094
2471
  queueJob(instance.parent.update);
2095
2472
  } else if (instance.appContext.reload) {
2096
2473
  instance.appContext.reload();
@@ -4087,8 +4464,8 @@ function doWatch(source, cb, {
4087
4464
  }
4088
4465
  }
4089
4466
  let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
4090
- const job = () => {
4091
- if (!effect.active || !effect.dirty) {
4467
+ const job = (immediateFirstRun) => {
4468
+ if (!(effect.flags & 1) || !effect.dirty && !immediateFirstRun) {
4092
4469
  return;
4093
4470
  }
4094
4471
  if (cb) {
@@ -4109,19 +4486,22 @@ function doWatch(source, cb, {
4109
4486
  effect.run();
4110
4487
  }
4111
4488
  };
4112
- job.allowRecurse = !!cb;
4489
+ if (cb)
4490
+ job.flags |= 4;
4491
+ const effect = new ReactiveEffect(getter);
4113
4492
  let scheduler;
4114
4493
  if (flush === "sync") {
4494
+ effect.flags |= 64;
4115
4495
  scheduler = job;
4116
4496
  } else if (flush === "post") {
4117
4497
  scheduler = () => queuePostRenderEffect(job, instance && instance.suspense);
4118
4498
  } else {
4119
- job.pre = true;
4499
+ job.flags |= 2;
4120
4500
  if (instance)
4121
4501
  job.id = instance.uid;
4122
4502
  scheduler = () => queueJob(job);
4123
4503
  }
4124
- const effect = new ReactiveEffect(getter, NOOP, scheduler);
4504
+ effect.scheduler = scheduler;
4125
4505
  const scope = getCurrentScope();
4126
4506
  const unwatch = () => {
4127
4507
  effect.stop();
@@ -4135,7 +4515,7 @@ function doWatch(source, cb, {
4135
4515
  }
4136
4516
  if (cb) {
4137
4517
  if (immediate) {
4138
- job();
4518
+ job(true);
4139
4519
  } else {
4140
4520
  oldValue = effect.run();
4141
4521
  }
@@ -4314,24 +4694,7 @@ const BaseTransitionImpl = {
4314
4694
  if (!children || !children.length) {
4315
4695
  return;
4316
4696
  }
4317
- let child = children[0];
4318
- if (children.length > 1) {
4319
- let hasFound = false;
4320
- for (const c of children) {
4321
- if (c.type !== Comment) {
4322
- if (!!(process.env.NODE_ENV !== "production") && hasFound) {
4323
- warn$1(
4324
- "<transition> can only be used on a single element or component. Use <transition-group> for lists."
4325
- );
4326
- break;
4327
- }
4328
- child = c;
4329
- hasFound = true;
4330
- if (!!!(process.env.NODE_ENV !== "production"))
4331
- break;
4332
- }
4333
- }
4334
- }
4697
+ const child = findNonCommentChild(children);
4335
4698
  const rawProps = toRaw(props);
4336
4699
  const { mode } = rawProps;
4337
4700
  if (!!(process.env.NODE_ENV !== "production") && mode && mode !== "in-out" && mode !== "out-in" && mode !== "default") {
@@ -4340,7 +4703,7 @@ const BaseTransitionImpl = {
4340
4703
  if (state.isLeaving) {
4341
4704
  return emptyPlaceholder(child);
4342
4705
  }
4343
- const innerChild = getKeepAliveChild(child);
4706
+ const innerChild = getInnerChild$1(child);
4344
4707
  if (!innerChild) {
4345
4708
  return emptyPlaceholder(child);
4346
4709
  }
@@ -4352,7 +4715,7 @@ const BaseTransitionImpl = {
4352
4715
  );
4353
4716
  setTransitionHooks(innerChild, enterHooks);
4354
4717
  const oldChild = instance.subTree;
4355
- const oldInnerChild = oldChild && getKeepAliveChild(oldChild);
4718
+ const oldInnerChild = oldChild && getInnerChild$1(oldChild);
4356
4719
  if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(innerChild, oldInnerChild)) {
4357
4720
  const leavingHooks = resolveTransitionHooks(
4358
4721
  oldInnerChild,
@@ -4365,8 +4728,7 @@ const BaseTransitionImpl = {
4365
4728
  state.isLeaving = true;
4366
4729
  leavingHooks.afterLeave = () => {
4367
4730
  state.isLeaving = false;
4368
- if (instance.update.active !== false) {
4369
- instance.effect.dirty = true;
4731
+ if (!(instance.job.flags & 8)) {
4370
4732
  instance.update();
4371
4733
  }
4372
4734
  };
@@ -4394,6 +4756,27 @@ const BaseTransitionImpl = {
4394
4756
  {
4395
4757
  BaseTransitionImpl.__isBuiltIn = true;
4396
4758
  }
4759
+ function findNonCommentChild(children) {
4760
+ let child = children[0];
4761
+ if (children.length > 1) {
4762
+ let hasFound = false;
4763
+ for (const c of children) {
4764
+ if (c.type !== Comment) {
4765
+ if (!!(process.env.NODE_ENV !== "production") && hasFound) {
4766
+ warn$1(
4767
+ "<transition> can only be used on a single element or component. Use <transition-group> for lists."
4768
+ );
4769
+ break;
4770
+ }
4771
+ child = c;
4772
+ hasFound = true;
4773
+ if (!!!(process.env.NODE_ENV !== "production"))
4774
+ break;
4775
+ }
4776
+ }
4777
+ }
4778
+ return child;
4779
+ }
4397
4780
  const BaseTransition = BaseTransitionImpl;
4398
4781
  function getLeavingNodesForType(state, vnode) {
4399
4782
  const { leavingVNodes } = state;
@@ -4548,8 +4931,11 @@ function emptyPlaceholder(vnode) {
4548
4931
  return vnode;
4549
4932
  }
4550
4933
  }
4551
- function getKeepAliveChild(vnode) {
4934
+ function getInnerChild$1(vnode) {
4552
4935
  if (!isKeepAlive(vnode)) {
4936
+ if (isTeleport(vnode.type) && vnode.children) {
4937
+ return findNonCommentChild(vnode.children);
4938
+ }
4553
4939
  return vnode;
4554
4940
  }
4555
4941
  if (!!(process.env.NODE_ENV !== "production") && vnode.component) {
@@ -4718,7 +5104,6 @@ function defineAsyncComponent(source) {
4718
5104
  load().then(() => {
4719
5105
  loaded.value = true;
4720
5106
  if (instance.parent && isKeepAlive(instance.parent.vnode)) {
4721
- instance.parent.effect.dirty = true;
4722
5107
  queueJob(instance.parent.update);
4723
5108
  }
4724
5109
  }).catch((err) => {
@@ -5336,10 +5721,20 @@ function convertLegacyFunctionalComponent(comp) {
5336
5721
  function renderList(source, renderItem, cache, index) {
5337
5722
  let ret;
5338
5723
  const cached = cache && cache[index];
5339
- if (isArray(source) || isString(source)) {
5724
+ const sourceIsArray = isArray(source);
5725
+ const sourceIsReactiveArray = sourceIsArray && isReactive(source);
5726
+ if (sourceIsArray || isString(source)) {
5727
+ if (sourceIsReactiveArray) {
5728
+ source = shallowReadArray(source);
5729
+ }
5340
5730
  ret = new Array(source.length);
5341
5731
  for (let i = 0, l = source.length; i < l; i++) {
5342
- ret[i] = renderItem(source[i], i, void 0, cached && cached[i]);
5732
+ ret[i] = renderItem(
5733
+ sourceIsReactiveArray ? toReactive(source[i]) : source[i],
5734
+ i,
5735
+ void 0,
5736
+ cached && cached[i]
5737
+ );
5343
5738
  }
5344
5739
  } else if (typeof source === "number") {
5345
5740
  if (!!(process.env.NODE_ENV !== "production") && !Number.isInteger(source)) {
@@ -5710,7 +6105,6 @@ const publicPropertiesMap = (
5710
6105
  $emit: (i) => i.emit,
5711
6106
  $options: (i) => __VUE_OPTIONS_API__ ? resolveMergedOptions(i) : i.type,
5712
6107
  $forceUpdate: (i) => i.f || (i.f = () => {
5713
- i.effect.dirty = true;
5714
6108
  queueJob(i.update);
5715
6109
  }),
5716
6110
  $nextTick: (i) => i.n || (i.n = nextTick.bind(i.proxy)),
@@ -6583,7 +6977,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
6583
6977
  return vm;
6584
6978
  }
6585
6979
  }
6586
- Vue.version = `2.6.14-compat:${"3.4.26"}`;
6980
+ Vue.version = `2.6.14-compat:${"3.5.0-alpha.2"}`;
6587
6981
  Vue.config = singletonApp.config;
6588
6982
  Vue.use = (plugin, ...options) => {
6589
6983
  if (plugin && isFunction(plugin.install)) {
@@ -6989,6 +7383,7 @@ function createAppAPI(render, hydrate) {
6989
7383
  }
6990
7384
  const context = createAppContext();
6991
7385
  const installedPlugins = /* @__PURE__ */ new WeakSet();
7386
+ const pluginCleanupFns = [];
6992
7387
  let isMounted = false;
6993
7388
  const app = context.app = {
6994
7389
  _uid: uid$1++,
@@ -7108,8 +7503,21 @@ If you want to remount the same app, move your app creation logic into a factory
7108
7503
  );
7109
7504
  }
7110
7505
  },
7506
+ onUnmount(cleanupFn) {
7507
+ if (!!(process.env.NODE_ENV !== "production") && typeof cleanupFn !== "function") {
7508
+ warn$1(
7509
+ `Expected function as first argument to app.onUnmount(), but got ${typeof cleanupFn}`
7510
+ );
7511
+ }
7512
+ pluginCleanupFns.push(cleanupFn);
7513
+ },
7111
7514
  unmount() {
7112
7515
  if (isMounted) {
7516
+ callWithAsyncErrorHandling(
7517
+ pluginCleanupFns,
7518
+ app._instance,
7519
+ 15
7520
+ );
7113
7521
  render(null, app._container);
7114
7522
  if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__) {
7115
7523
  app._instance = null;
@@ -7604,7 +8012,9 @@ const isSimpleType = /* @__PURE__ */ makeMap(
7604
8012
  function assertType(value, type) {
7605
8013
  let valid;
7606
8014
  const expectedType = getType(type);
7607
- if (isSimpleType(expectedType)) {
8015
+ if (expectedType === "null") {
8016
+ valid = value === null;
8017
+ } else if (isSimpleType(expectedType)) {
7608
8018
  const t = typeof value;
7609
8019
  valid = t === expectedType.toLowerCase();
7610
8020
  if (!valid && t === "object") {
@@ -7614,8 +8024,6 @@ function assertType(value, type) {
7614
8024
  valid = isObject(value);
7615
8025
  } else if (expectedType === "Array") {
7616
8026
  valid = isArray(value);
7617
- } else if (expectedType === "null") {
7618
- valid = value === null;
7619
8027
  } else {
7620
8028
  valid = value instanceof type;
7621
8029
  }
@@ -9188,7 +9596,6 @@ function baseCreateRenderer(options, createHydrationFns) {
9188
9596
  } else {
9189
9597
  instance.next = n2;
9190
9598
  invalidateJob(instance.update);
9191
- instance.effect.dirty = true;
9192
9599
  instance.update();
9193
9600
  }
9194
9601
  } else {
@@ -9395,24 +9802,18 @@ function baseCreateRenderer(options, createHydrationFns) {
9395
9802
  }
9396
9803
  }
9397
9804
  };
9398
- const effect = instance.effect = new ReactiveEffect(
9399
- componentUpdateFn,
9400
- NOOP,
9401
- () => queueJob(update),
9402
- instance.scope
9403
- // track it in component's effect scope
9404
- );
9405
- const update = instance.update = () => {
9406
- if (effect.dirty) {
9407
- effect.run();
9408
- }
9409
- };
9410
- update.id = instance.uid;
9805
+ instance.scope.on();
9806
+ const effect = instance.effect = new ReactiveEffect(componentUpdateFn);
9807
+ instance.scope.off();
9808
+ const update = instance.update = effect.run.bind(effect);
9809
+ const job = instance.job = effect.runIfDirty.bind(effect);
9810
+ job.id = instance.uid;
9811
+ effect.scheduler = () => queueJob(job);
9411
9812
  toggleRecurse(instance, true);
9412
9813
  if (!!(process.env.NODE_ENV !== "production")) {
9413
9814
  effect.onTrack = instance.rtc ? (e) => invokeArrayFns(instance.rtc, e) : void 0;
9414
9815
  effect.onTrigger = instance.rtg ? (e) => invokeArrayFns(instance.rtg, e) : void 0;
9415
- update.ownerInstance = instance;
9816
+ job.ownerInstance = instance;
9416
9817
  }
9417
9818
  update();
9418
9819
  };
@@ -9879,7 +10280,7 @@ function baseCreateRenderer(options, createHydrationFns) {
9879
10280
  if (!!(process.env.NODE_ENV !== "production") && instance.type.__hmrId) {
9880
10281
  unregisterHMR(instance);
9881
10282
  }
9882
- const { bum, scope, update, subTree, um } = instance;
10283
+ const { bum, scope, job, subTree, um } = instance;
9883
10284
  if (bum) {
9884
10285
  invokeArrayFns(bum);
9885
10286
  }
@@ -9887,8 +10288,8 @@ function baseCreateRenderer(options, createHydrationFns) {
9887
10288
  instance.emit("hook:beforeDestroy");
9888
10289
  }
9889
10290
  scope.stop();
9890
- if (update) {
9891
- update.active = false;
10291
+ if (job) {
10292
+ job.flags |= 8;
9892
10293
  unmount(subTree, instance, parentSuspense, doRemove);
9893
10294
  }
9894
10295
  if (um) {
@@ -9980,8 +10381,14 @@ function baseCreateRenderer(options, createHydrationFns) {
9980
10381
  function resolveChildrenNamespace({ type, props }, currentNamespace) {
9981
10382
  return currentNamespace === "svg" && type === "foreignObject" || currentNamespace === "mathml" && type === "annotation-xml" && props && props.encoding && props.encoding.includes("html") ? void 0 : currentNamespace;
9982
10383
  }
9983
- function toggleRecurse({ effect, update }, allowed) {
9984
- effect.allowRecurse = update.allowRecurse = allowed;
10384
+ function toggleRecurse({ effect, job }, allowed) {
10385
+ if (allowed) {
10386
+ effect.flags |= 32;
10387
+ job.flags |= 4;
10388
+ } else {
10389
+ effect.flags &= ~32;
10390
+ job.flags &= ~4;
10391
+ }
9985
10392
  }
9986
10393
  function needTransition(parentSuspense, transition) {
9987
10394
  return (!parentSuspense || parentSuspense && !parentSuspense.pendingBranch) && transition && !transition.persisted;
@@ -10782,6 +11189,7 @@ function createComponentInstance(vnode, parent, suspense) {
10782
11189
  effect: null,
10783
11190
  update: null,
10784
11191
  // will be set synchronously right after creation
11192
+ job: null,
10785
11193
  scope: new EffectScope(
10786
11194
  true
10787
11195
  /* detached */
@@ -11318,7 +11726,8 @@ function initCustomFormatter() {
11318
11726
  {},
11319
11727
  ["span", vueStyle, genRefFlag(obj)],
11320
11728
  "<",
11321
- formatValue(obj.value),
11729
+ // avoid debugger accessing value affecting behavior
11730
+ formatValue("_value" in obj ? obj._value : obj),
11322
11731
  `>`
11323
11732
  ];
11324
11733
  } else if (isReactive(obj)) {
@@ -11498,7 +11907,7 @@ function isMemoSame(cached, memo) {
11498
11907
  return true;
11499
11908
  }
11500
11909
 
11501
- const version = "3.4.26";
11910
+ const version = "3.5.0-alpha.2";
11502
11911
  const warn = !!(process.env.NODE_ENV !== "production") ? warn$1 : NOOP;
11503
11912
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
11504
11913
  const devtools = !!(process.env.NODE_ENV !== "production") || true ? devtools$1 : void 0;
@@ -13114,7 +13523,9 @@ const withKeys = (fn, modifiers) => {
13114
13523
  return;
13115
13524
  }
13116
13525
  const eventKey = hyphenate(event.key);
13117
- if (modifiers.some((k) => k === eventKey || keyNames[k] === eventKey)) {
13526
+ if (modifiers.some(
13527
+ (k) => k === eventKey || keyNames[k] === eventKey
13528
+ )) {
13118
13529
  return fn(event);
13119
13530
  }
13120
13531
  {
@@ -19095,9 +19506,183 @@ const ignoreSideEffectTags = (node, context) => {
19095
19506
  }
19096
19507
  };
19097
19508
 
19509
+ function isValidHTMLNesting(parent, child) {
19510
+ if (parent in onlyValidChildren) {
19511
+ return onlyValidChildren[parent].has(child);
19512
+ }
19513
+ if (child in onlyValidParents) {
19514
+ return onlyValidParents[child].has(parent);
19515
+ }
19516
+ if (parent in knownInvalidChildren) {
19517
+ if (knownInvalidChildren[parent].has(child))
19518
+ return false;
19519
+ }
19520
+ if (child in knownInvalidParents) {
19521
+ if (knownInvalidParents[child].has(parent))
19522
+ return false;
19523
+ }
19524
+ return true;
19525
+ }
19526
+ const headings = /* @__PURE__ */ new Set(["h1", "h2", "h3", "h4", "h5", "h6"]);
19527
+ const emptySet = /* @__PURE__ */ new Set([]);
19528
+ const onlyValidChildren = {
19529
+ head: /* @__PURE__ */ new Set([
19530
+ "base",
19531
+ "basefront",
19532
+ "bgsound",
19533
+ "link",
19534
+ "meta",
19535
+ "title",
19536
+ "noscript",
19537
+ "noframes",
19538
+ "style",
19539
+ "script",
19540
+ "template"
19541
+ ]),
19542
+ optgroup: /* @__PURE__ */ new Set(["option"]),
19543
+ select: /* @__PURE__ */ new Set(["optgroup", "option", "hr"]),
19544
+ // table
19545
+ table: /* @__PURE__ */ new Set(["caption", "colgroup", "tbody", "tfoot", "thead"]),
19546
+ tr: /* @__PURE__ */ new Set(["td", "th"]),
19547
+ colgroup: /* @__PURE__ */ new Set(["col"]),
19548
+ tbody: /* @__PURE__ */ new Set(["tr"]),
19549
+ thead: /* @__PURE__ */ new Set(["tr"]),
19550
+ tfoot: /* @__PURE__ */ new Set(["tr"]),
19551
+ // these elements can not have any children elements
19552
+ script: emptySet,
19553
+ iframe: emptySet,
19554
+ option: emptySet,
19555
+ textarea: emptySet,
19556
+ style: emptySet,
19557
+ title: emptySet
19558
+ };
19559
+ const onlyValidParents = {
19560
+ // sections
19561
+ html: emptySet,
19562
+ body: /* @__PURE__ */ new Set(["html"]),
19563
+ head: /* @__PURE__ */ new Set(["html"]),
19564
+ // table
19565
+ td: /* @__PURE__ */ new Set(["tr"]),
19566
+ colgroup: /* @__PURE__ */ new Set(["table"]),
19567
+ caption: /* @__PURE__ */ new Set(["table"]),
19568
+ tbody: /* @__PURE__ */ new Set(["table"]),
19569
+ tfoot: /* @__PURE__ */ new Set(["table"]),
19570
+ col: /* @__PURE__ */ new Set(["colgroup"]),
19571
+ th: /* @__PURE__ */ new Set(["tr"]),
19572
+ thead: /* @__PURE__ */ new Set(["table"]),
19573
+ tr: /* @__PURE__ */ new Set(["tbody", "thead", "tfoot"]),
19574
+ // data list
19575
+ dd: /* @__PURE__ */ new Set(["dl", "div"]),
19576
+ dt: /* @__PURE__ */ new Set(["dl", "div"]),
19577
+ // other
19578
+ figcaption: /* @__PURE__ */ new Set(["figure"]),
19579
+ // li: new Set(["ul", "ol"]),
19580
+ summary: /* @__PURE__ */ new Set(["details"]),
19581
+ area: /* @__PURE__ */ new Set(["map"])
19582
+ };
19583
+ const knownInvalidChildren = {
19584
+ p: /* @__PURE__ */ new Set([
19585
+ "address",
19586
+ "article",
19587
+ "aside",
19588
+ "blockquote",
19589
+ "center",
19590
+ "details",
19591
+ "dialog",
19592
+ "dir",
19593
+ "div",
19594
+ "dl",
19595
+ "fieldset",
19596
+ "figure",
19597
+ "footer",
19598
+ "form",
19599
+ "h1",
19600
+ "h2",
19601
+ "h3",
19602
+ "h4",
19603
+ "h5",
19604
+ "h6",
19605
+ "header",
19606
+ "hgroup",
19607
+ "hr",
19608
+ "li",
19609
+ "main",
19610
+ "nav",
19611
+ "menu",
19612
+ "ol",
19613
+ "p",
19614
+ "pre",
19615
+ "section",
19616
+ "table",
19617
+ "ul"
19618
+ ]),
19619
+ svg: /* @__PURE__ */ new Set([
19620
+ "b",
19621
+ "blockquote",
19622
+ "br",
19623
+ "code",
19624
+ "dd",
19625
+ "div",
19626
+ "dl",
19627
+ "dt",
19628
+ "em",
19629
+ "embed",
19630
+ "h1",
19631
+ "h2",
19632
+ "h3",
19633
+ "h4",
19634
+ "h5",
19635
+ "h6",
19636
+ "hr",
19637
+ "i",
19638
+ "img",
19639
+ "li",
19640
+ "menu",
19641
+ "meta",
19642
+ "ol",
19643
+ "p",
19644
+ "pre",
19645
+ "ruby",
19646
+ "s",
19647
+ "small",
19648
+ "span",
19649
+ "strong",
19650
+ "sub",
19651
+ "sup",
19652
+ "table",
19653
+ "u",
19654
+ "ul",
19655
+ "var"
19656
+ ])
19657
+ };
19658
+ const knownInvalidParents = {
19659
+ a: /* @__PURE__ */ new Set(["a"]),
19660
+ button: /* @__PURE__ */ new Set(["button"]),
19661
+ dd: /* @__PURE__ */ new Set(["dd", "dt"]),
19662
+ dt: /* @__PURE__ */ new Set(["dd", "dt"]),
19663
+ form: /* @__PURE__ */ new Set(["form"]),
19664
+ li: /* @__PURE__ */ new Set(["li"]),
19665
+ h1: headings,
19666
+ h2: headings,
19667
+ h3: headings,
19668
+ h4: headings,
19669
+ h5: headings,
19670
+ h6: headings
19671
+ };
19672
+
19673
+ const validateHtmlNesting = (node, context) => {
19674
+ if (node.type === 1 && node.tagType === 0 && context.parent && context.parent.type === 1 && context.parent.tagType === 0 && !isValidHTMLNesting(context.parent.tag, node.tag)) {
19675
+ const error = new SyntaxError(
19676
+ `<${node.tag}> cannot be child of <${context.parent.tag}>, according to HTML specifications. This can cause hydration errors or potentially disrupt future functionality.`
19677
+ );
19678
+ error.loc = node.loc;
19679
+ context.onWarn(error);
19680
+ }
19681
+ };
19682
+
19098
19683
  const DOMNodeTransforms = [
19099
19684
  transformStyle,
19100
- ...!!(process.env.NODE_ENV !== "production") ? [transformTransition] : []
19685
+ ...!!(process.env.NODE_ENV !== "production") ? [transformTransition, validateHtmlNesting] : []
19101
19686
  ];
19102
19687
  const DOMDirectiveTransforms = {
19103
19688
  cloak: noopDirectiveTransform,