@vue/runtime-core 3.4.30 → 3.4.32

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,11 +1,11 @@
1
1
  /**
2
- * @vue/runtime-core v3.4.30
2
+ * @vue/runtime-core v3.4.32
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
6
- import { pauseTracking, resetTracking, isRef, toRaw, shallowReadonly, ref, track, reactive, shallowReactive, trigger, ReactiveEffect, isShallow, isReactive, getCurrentScope, isProxy, proxyRefs, markRaw, EffectScope, computed as computed$1, customRef, isReadonly } from '@vue/reactivity';
6
+ import { pauseTracking, resetTracking, isRef, toRaw, ref, shallowReadonly, track, reactive, shallowReactive, trigger, isReactive, ReactiveEffect, isShallow, getCurrentScope, customRef, isProxy, proxyRefs, markRaw, EffectScope, computed as computed$1, isReadonly } from '@vue/reactivity';
7
7
  export { EffectScope, ReactiveEffect, TrackOpTypes, TriggerOpTypes, customRef, effect, effectScope, getCurrentScope, isProxy, isReactive, isReadonly, isRef, isShallow, markRaw, onScopeDispose, proxyRefs, reactive, readonly, ref, shallowReactive, shallowReadonly, shallowRef, stop, toRaw, toRef, toRefs, toValue, triggerRef, unref } from '@vue/reactivity';
8
- import { isString, isFunction, isPromise, isArray, NOOP, getGlobalThis, extend, EMPTY_OBJ, toHandlerKey, looseToNumber, hyphenate, camelize, isObject, isOn, hasOwn, isModelListener, capitalize, toNumber, isBuiltInDirective, isGloballyAllowed, NO, isReservedProp, EMPTY_ARR, toRawType, makeMap, def, remove, normalizeClass, stringifyStyle, normalizeStyle, isKnownSvgAttr, isBooleanAttr, isKnownHtmlAttr, includeBooleanAttr, isRenderableAttrValue, invokeArrayFns, hasChanged, isSet, isMap, isPlainObject, isRegExp } from '@vue/shared';
8
+ import { isString, isFunction, isPromise, isArray, NOOP, getGlobalThis, extend, isBuiltInDirective, EMPTY_OBJ, isObject, remove, isRegExp, invokeArrayFns, toHandlerKey, capitalize, camelize, hasOwn, isGloballyAllowed, NO, hyphenate, isReservedProp, EMPTY_ARR, toRawType, makeMap, def, isOn, normalizeClass, stringifyStyle, normalizeStyle, isKnownSvgAttr, isBooleanAttr, isKnownHtmlAttr, includeBooleanAttr, isRenderableAttrValue, hasChanged, isSet, isMap, isPlainObject, looseToNumber, isModelListener, toNumber } from '@vue/shared';
9
9
  export { camelize, capitalize, normalizeClass, normalizeProps, normalizeStyle, toDisplayString, toHandlerKey } from '@vue/shared';
10
10
 
11
11
  const stack = [];
@@ -15,7 +15,10 @@ function pushWarningContext(vnode) {
15
15
  function popWarningContext() {
16
16
  stack.pop();
17
17
  }
18
+ let isWarning = false;
18
19
  function warn$1(msg, ...args) {
20
+ if (isWarning) return;
21
+ isWarning = true;
19
22
  pauseTracking();
20
23
  const instance = stack.length ? stack[stack.length - 1].component : null;
21
24
  const appWarnHandler = instance && instance.appContext.config.warnHandler;
@@ -48,6 +51,7 @@ function warn$1(msg, ...args) {
48
51
  console.warn(...warnArgs);
49
52
  }
50
53
  resetTracking();
54
+ isWarning = false;
51
55
  }
52
56
  function getComponentTrace() {
53
57
  let currentVNode = stack[stack.length - 1];
@@ -157,7 +161,9 @@ const ErrorCodes = {
157
161
  "ASYNC_COMPONENT_LOADER": 13,
158
162
  "13": "ASYNC_COMPONENT_LOADER",
159
163
  "SCHEDULER": 14,
160
- "14": "SCHEDULER"
164
+ "14": "SCHEDULER",
165
+ "COMPONENT_UPDATE": 15,
166
+ "15": "COMPONENT_UPDATE"
161
167
  };
162
168
  const ErrorTypeStrings$1 = {
163
169
  ["sp"]: "serverPrefetch hook",
@@ -188,7 +194,8 @@ const ErrorTypeStrings$1 = {
188
194
  [11]: "app warnHandler",
189
195
  [12]: "ref function",
190
196
  [13]: "async component loader",
191
- [14]: "scheduler flush. This is likely a Vue internals bug. Please open an issue at https://github.com/vuejs/core ."
197
+ [14]: "scheduler flush",
198
+ [15]: "component update"
192
199
  };
193
200
  function callWithErrorHandling(fn, instance, type, args) {
194
201
  try {
@@ -406,7 +413,11 @@ function flushJobs(seen) {
406
413
  if (!!(process.env.NODE_ENV !== "production") && check(job)) {
407
414
  continue;
408
415
  }
409
- callWithErrorHandling(job, null, 14);
416
+ callWithErrorHandling(
417
+ job,
418
+ job.i,
419
+ job.i ? 15 : 14
420
+ );
410
421
  }
411
422
  }
412
423
  } finally {
@@ -426,7 +437,7 @@ function checkRecursiveUpdates(seen, fn) {
426
437
  } else {
427
438
  const count = seen.get(fn);
428
439
  if (count > RECURSION_LIMIT) {
429
- const instance = fn.ownerInstance;
440
+ const instance = fn.i;
430
441
  const componentName = instance && getComponentName(instance.type);
431
442
  handleError(
432
443
  `Maximum recursive updates exceeded${componentName ? ` in component <${componentName}>` : ``}. This means you have a reactive effect that is mutating its own dependencies and thus recursively triggering itself. Possible sources include component template, render function, updated hook or watcher source function.`,
@@ -441,7 +452,7 @@ function checkRecursiveUpdates(seen, fn) {
441
452
  }
442
453
 
443
454
  let isHmrUpdating = false;
444
- const hmrDirtyComponents = /* @__PURE__ */ new Set();
455
+ const hmrDirtyComponents = /* @__PURE__ */ new Map();
445
456
  if (!!(process.env.NODE_ENV !== "production")) {
446
457
  getGlobalThis().__VUE_HMR_RUNTIME__ = {
447
458
  createRecord: tryWrap(createRecord),
@@ -499,26 +510,29 @@ function reload(id, newComp) {
499
510
  newComp = normalizeClassComponent(newComp);
500
511
  updateComponentDef(record.initialDef, newComp);
501
512
  const instances = [...record.instances];
502
- for (const instance of instances) {
513
+ for (let i = 0; i < instances.length; i++) {
514
+ const instance = instances[i];
503
515
  const oldComp = normalizeClassComponent(instance.type);
504
- if (!hmrDirtyComponents.has(oldComp)) {
516
+ let dirtyInstances = hmrDirtyComponents.get(oldComp);
517
+ if (!dirtyInstances) {
505
518
  if (oldComp !== record.initialDef) {
506
519
  updateComponentDef(oldComp, newComp);
507
520
  }
508
- hmrDirtyComponents.add(oldComp);
521
+ hmrDirtyComponents.set(oldComp, dirtyInstances = /* @__PURE__ */ new Set());
509
522
  }
523
+ dirtyInstances.add(instance);
510
524
  instance.appContext.propsCache.delete(instance.type);
511
525
  instance.appContext.emitsCache.delete(instance.type);
512
526
  instance.appContext.optionsCache.delete(instance.type);
513
527
  if (instance.ceReload) {
514
- hmrDirtyComponents.add(oldComp);
528
+ dirtyInstances.add(instance);
515
529
  instance.ceReload(newComp.styles);
516
- hmrDirtyComponents.delete(oldComp);
530
+ dirtyInstances.delete(instance);
517
531
  } else if (instance.parent) {
518
532
  instance.parent.effect.dirty = true;
519
533
  queueJob(() => {
520
534
  instance.parent.update();
521
- hmrDirtyComponents.delete(oldComp);
535
+ dirtyInstances.delete(instance);
522
536
  });
523
537
  } else if (instance.appContext.reload) {
524
538
  instance.appContext.reload();
@@ -531,11 +545,7 @@ function reload(id, newComp) {
531
545
  }
532
546
  }
533
547
  queuePostFlushCb(() => {
534
- for (const instance of instances) {
535
- hmrDirtyComponents.delete(
536
- normalizeClassComponent(instance.type)
537
- );
538
- }
548
+ hmrDirtyComponents.clear();
539
549
  });
540
550
  }
541
551
  function updateComponentDef(oldComp, newComp) {
@@ -659,144 +669,6 @@ function devtoolsComponentEmit(component, event, params) {
659
669
  );
660
670
  }
661
671
 
662
- function emit(instance, event, ...rawArgs) {
663
- if (instance.isUnmounted) return;
664
- const props = instance.vnode.props || EMPTY_OBJ;
665
- if (!!(process.env.NODE_ENV !== "production")) {
666
- const {
667
- emitsOptions,
668
- propsOptions: [propsOptions]
669
- } = instance;
670
- if (emitsOptions) {
671
- if (!(event in emitsOptions) && true) {
672
- if (!propsOptions || !(toHandlerKey(event) in propsOptions)) {
673
- warn$1(
674
- `Component emitted event "${event}" but it is neither declared in the emits option nor as an "${toHandlerKey(event)}" prop.`
675
- );
676
- }
677
- } else {
678
- const validator = emitsOptions[event];
679
- if (isFunction(validator)) {
680
- const isValid = validator(...rawArgs);
681
- if (!isValid) {
682
- warn$1(
683
- `Invalid event arguments: event validation failed for event "${event}".`
684
- );
685
- }
686
- }
687
- }
688
- }
689
- }
690
- let args = rawArgs;
691
- const isModelListener = event.startsWith("update:");
692
- const modelArg = isModelListener && event.slice(7);
693
- if (modelArg && modelArg in props) {
694
- const modifiersKey = `${modelArg === "modelValue" ? "model" : modelArg}Modifiers`;
695
- const { number, trim } = props[modifiersKey] || EMPTY_OBJ;
696
- if (trim) {
697
- args = rawArgs.map((a) => isString(a) ? a.trim() : a);
698
- }
699
- if (number) {
700
- args = rawArgs.map(looseToNumber);
701
- }
702
- }
703
- if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__) {
704
- devtoolsComponentEmit(instance, event, args);
705
- }
706
- if (!!(process.env.NODE_ENV !== "production")) {
707
- const lowerCaseEvent = event.toLowerCase();
708
- if (lowerCaseEvent !== event && props[toHandlerKey(lowerCaseEvent)]) {
709
- warn$1(
710
- `Event "${lowerCaseEvent}" is emitted in component ${formatComponentName(
711
- instance,
712
- instance.type
713
- )} but the handler is registered for "${event}". Note that HTML attributes are case-insensitive and you cannot use v-on to listen to camelCase events when using in-DOM templates. You should probably use "${hyphenate(
714
- event
715
- )}" instead of "${event}".`
716
- );
717
- }
718
- }
719
- let handlerName;
720
- let handler = props[handlerName = toHandlerKey(event)] || // also try camelCase event handler (#2249)
721
- props[handlerName = toHandlerKey(camelize(event))];
722
- if (!handler && isModelListener) {
723
- handler = props[handlerName = toHandlerKey(hyphenate(event))];
724
- }
725
- if (handler) {
726
- callWithAsyncErrorHandling(
727
- handler,
728
- instance,
729
- 6,
730
- args
731
- );
732
- }
733
- const onceHandler = props[handlerName + `Once`];
734
- if (onceHandler) {
735
- if (!instance.emitted) {
736
- instance.emitted = {};
737
- } else if (instance.emitted[handlerName]) {
738
- return;
739
- }
740
- instance.emitted[handlerName] = true;
741
- callWithAsyncErrorHandling(
742
- onceHandler,
743
- instance,
744
- 6,
745
- args
746
- );
747
- }
748
- }
749
- function normalizeEmitsOptions(comp, appContext, asMixin = false) {
750
- const cache = appContext.emitsCache;
751
- const cached = cache.get(comp);
752
- if (cached !== void 0) {
753
- return cached;
754
- }
755
- const raw = comp.emits;
756
- let normalized = {};
757
- let hasExtends = false;
758
- if (__VUE_OPTIONS_API__ && !isFunction(comp)) {
759
- const extendEmits = (raw2) => {
760
- const normalizedFromExtend = normalizeEmitsOptions(raw2, appContext, true);
761
- if (normalizedFromExtend) {
762
- hasExtends = true;
763
- extend(normalized, normalizedFromExtend);
764
- }
765
- };
766
- if (!asMixin && appContext.mixins.length) {
767
- appContext.mixins.forEach(extendEmits);
768
- }
769
- if (comp.extends) {
770
- extendEmits(comp.extends);
771
- }
772
- if (comp.mixins) {
773
- comp.mixins.forEach(extendEmits);
774
- }
775
- }
776
- if (!raw && !hasExtends) {
777
- if (isObject(comp)) {
778
- cache.set(comp, null);
779
- }
780
- return null;
781
- }
782
- if (isArray(raw)) {
783
- raw.forEach((key) => normalized[key] = null);
784
- } else {
785
- extend(normalized, raw);
786
- }
787
- if (isObject(comp)) {
788
- cache.set(comp, normalized);
789
- }
790
- return normalized;
791
- }
792
- function isEmitListener(options, key) {
793
- if (!options || !isOn(key)) {
794
- return false;
795
- }
796
- key = key.slice(2).replace(/Once$/, "");
797
- return hasOwn(options, key[0].toLowerCase() + key.slice(1)) || hasOwn(options, hyphenate(key)) || hasOwn(options, key);
798
- }
799
-
800
672
  let currentRenderingInstance = null;
801
673
  let currentScopeId = null;
802
674
  function setCurrentRenderingInstance(instance) {
@@ -842,941 +714,809 @@ function withCtx(fn, ctx = currentRenderingInstance, isNonScopedSlot) {
842
714
  return renderFnWithContext;
843
715
  }
844
716
 
845
- let accessedAttrs = false;
846
- function markAttrsAccessed() {
847
- accessedAttrs = true;
717
+ function validateDirectiveName(name) {
718
+ if (isBuiltInDirective(name)) {
719
+ warn$1("Do not use built-in directive ids as custom directive id: " + name);
720
+ }
848
721
  }
849
- function renderComponentRoot(instance) {
850
- const {
851
- type: Component,
852
- vnode,
853
- proxy,
854
- withProxy,
855
- propsOptions: [propsOptions],
856
- slots,
857
- attrs,
858
- emit,
859
- render,
860
- renderCache,
861
- props,
862
- data,
863
- setupState,
864
- ctx,
865
- inheritAttrs
866
- } = instance;
867
- const prev = setCurrentRenderingInstance(instance);
868
- let result;
869
- let fallthroughAttrs;
870
- if (!!(process.env.NODE_ENV !== "production")) {
871
- accessedAttrs = false;
722
+ function withDirectives(vnode, directives) {
723
+ if (currentRenderingInstance === null) {
724
+ !!(process.env.NODE_ENV !== "production") && warn$1(`withDirectives can only be used inside render functions.`);
725
+ return vnode;
872
726
  }
873
- try {
874
- if (vnode.shapeFlag & 4) {
875
- const proxyToUse = withProxy || proxy;
876
- const thisProxy = !!(process.env.NODE_ENV !== "production") && setupState.__isScriptSetup ? new Proxy(proxyToUse, {
877
- get(target, key, receiver) {
878
- warn$1(
879
- `Property '${String(
880
- key
881
- )}' was accessed via 'this'. Avoid using 'this' in templates.`
882
- );
883
- return Reflect.get(target, key, receiver);
884
- }
885
- }) : proxyToUse;
886
- result = normalizeVNode(
887
- render.call(
888
- thisProxy,
889
- proxyToUse,
890
- renderCache,
891
- !!(process.env.NODE_ENV !== "production") ? shallowReadonly(props) : props,
892
- setupState,
893
- data,
894
- ctx
895
- )
896
- );
897
- fallthroughAttrs = attrs;
898
- } else {
899
- const render2 = Component;
900
- if (!!(process.env.NODE_ENV !== "production") && attrs === props) {
901
- markAttrsAccessed();
727
+ const instance = getComponentPublicInstance(currentRenderingInstance);
728
+ const bindings = vnode.dirs || (vnode.dirs = []);
729
+ for (let i = 0; i < directives.length; i++) {
730
+ let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i];
731
+ if (dir) {
732
+ if (isFunction(dir)) {
733
+ dir = {
734
+ mounted: dir,
735
+ updated: dir
736
+ };
902
737
  }
903
- result = normalizeVNode(
904
- render2.length > 1 ? render2(
905
- !!(process.env.NODE_ENV !== "production") ? shallowReadonly(props) : props,
906
- !!(process.env.NODE_ENV !== "production") ? {
907
- get attrs() {
908
- markAttrsAccessed();
909
- return shallowReadonly(attrs);
910
- },
911
- slots,
912
- emit
913
- } : { attrs, slots, emit }
914
- ) : render2(
915
- !!(process.env.NODE_ENV !== "production") ? shallowReadonly(props) : props,
916
- null
917
- )
918
- );
919
- fallthroughAttrs = Component.props ? attrs : getFunctionalFallthrough(attrs);
738
+ if (dir.deep) {
739
+ traverse(value);
740
+ }
741
+ bindings.push({
742
+ dir,
743
+ instance,
744
+ value,
745
+ oldValue: void 0,
746
+ arg,
747
+ modifiers
748
+ });
920
749
  }
921
- } catch (err) {
922
- blockStack.length = 0;
923
- handleError(err, instance, 1);
924
- result = createVNode(Comment);
925
750
  }
926
- let root = result;
927
- let setRoot = void 0;
928
- if (!!(process.env.NODE_ENV !== "production") && result.patchFlag > 0 && result.patchFlag & 2048) {
929
- [root, setRoot] = getChildRoot(result);
930
- }
931
- if (fallthroughAttrs && inheritAttrs !== false) {
932
- const keys = Object.keys(fallthroughAttrs);
933
- const { shapeFlag } = root;
934
- if (keys.length) {
935
- if (shapeFlag & (1 | 6)) {
936
- if (propsOptions && keys.some(isModelListener)) {
937
- fallthroughAttrs = filterModelListeners(
938
- fallthroughAttrs,
939
- propsOptions
940
- );
941
- }
942
- root = cloneVNode(root, fallthroughAttrs, false, true);
943
- } else if (!!(process.env.NODE_ENV !== "production") && !accessedAttrs && root.type !== Comment) {
944
- const allAttrs = Object.keys(attrs);
945
- const eventAttrs = [];
946
- const extraAttrs = [];
947
- for (let i = 0, l = allAttrs.length; i < l; i++) {
948
- const key = allAttrs[i];
949
- if (isOn(key)) {
950
- if (!isModelListener(key)) {
951
- eventAttrs.push(key[2].toLowerCase() + key.slice(3));
952
- }
953
- } else {
954
- extraAttrs.push(key);
955
- }
956
- }
957
- if (extraAttrs.length) {
958
- warn$1(
959
- `Extraneous non-props attributes (${extraAttrs.join(", ")}) were passed to component but could not be automatically inherited because component renders fragment or text root nodes.`
960
- );
961
- }
962
- if (eventAttrs.length) {
963
- warn$1(
964
- `Extraneous non-emits event listeners (${eventAttrs.join(", ")}) were passed to component but could not be automatically inherited because component renders fragment or text root nodes. If the listener is intended to be a component custom event listener only, declare it using the "emits" option.`
965
- );
966
- }
967
- }
968
- }
969
- }
970
- if (vnode.dirs) {
971
- if (!!(process.env.NODE_ENV !== "production") && !isElementRoot(root)) {
972
- warn$1(
973
- `Runtime directive used on component with non-element root node. The directives will not function as intended.`
974
- );
751
+ return vnode;
752
+ }
753
+ function invokeDirectiveHook(vnode, prevVNode, instance, name) {
754
+ const bindings = vnode.dirs;
755
+ const oldBindings = prevVNode && prevVNode.dirs;
756
+ for (let i = 0; i < bindings.length; i++) {
757
+ const binding = bindings[i];
758
+ if (oldBindings) {
759
+ binding.oldValue = oldBindings[i].value;
975
760
  }
976
- root = cloneVNode(root, null, false, true);
977
- root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
978
- }
979
- if (vnode.transition) {
980
- if (!!(process.env.NODE_ENV !== "production") && !isElementRoot(root)) {
981
- warn$1(
982
- `Component inside <Transition> renders non-element root node that cannot be animated.`
983
- );
761
+ let hook = binding.dir[name];
762
+ if (hook) {
763
+ pauseTracking();
764
+ callWithAsyncErrorHandling(hook, instance, 8, [
765
+ vnode.el,
766
+ binding,
767
+ vnode,
768
+ prevVNode
769
+ ]);
770
+ resetTracking();
984
771
  }
985
- root.transition = vnode.transition;
986
- }
987
- if (!!(process.env.NODE_ENV !== "production") && setRoot) {
988
- setRoot(root);
989
- } else {
990
- result = root;
991
772
  }
992
- setCurrentRenderingInstance(prev);
993
- return result;
994
773
  }
995
- const getChildRoot = (vnode) => {
996
- const rawChildren = vnode.children;
997
- const dynamicChildren = vnode.dynamicChildren;
998
- const childRoot = filterSingleRoot(rawChildren, false);
999
- if (!childRoot) {
1000
- return [vnode, void 0];
1001
- } else if (!!(process.env.NODE_ENV !== "production") && childRoot.patchFlag > 0 && childRoot.patchFlag & 2048) {
1002
- return getChildRoot(childRoot);
1003
- }
1004
- const index = rawChildren.indexOf(childRoot);
1005
- const dynamicIndex = dynamicChildren ? dynamicChildren.indexOf(childRoot) : -1;
1006
- const setRoot = (updatedRoot) => {
1007
- rawChildren[index] = updatedRoot;
1008
- if (dynamicChildren) {
1009
- if (dynamicIndex > -1) {
1010
- dynamicChildren[dynamicIndex] = updatedRoot;
1011
- } else if (updatedRoot.patchFlag > 0) {
1012
- vnode.dynamicChildren = [...dynamicChildren, updatedRoot];
1013
- }
1014
- }
774
+
775
+ const leaveCbKey = Symbol("_leaveCb");
776
+ const enterCbKey = Symbol("_enterCb");
777
+ function useTransitionState() {
778
+ const state = {
779
+ isMounted: false,
780
+ isLeaving: false,
781
+ isUnmounting: false,
782
+ leavingVNodes: /* @__PURE__ */ new Map()
1015
783
  };
1016
- return [normalizeVNode(childRoot), setRoot];
1017
- };
1018
- function filterSingleRoot(children, recurse = true) {
1019
- let singleRoot;
1020
- for (let i = 0; i < children.length; i++) {
1021
- const child = children[i];
1022
- if (isVNode(child)) {
1023
- if (child.type !== Comment || child.children === "v-if") {
1024
- if (singleRoot) {
1025
- return;
1026
- } else {
1027
- singleRoot = child;
1028
- if (!!(process.env.NODE_ENV !== "production") && recurse && singleRoot.patchFlag > 0 && singleRoot.patchFlag & 2048) {
1029
- return filterSingleRoot(singleRoot.children);
1030
- }
1031
- }
1032
- }
1033
- } else {
1034
- return;
1035
- }
1036
- }
1037
- return singleRoot;
784
+ onMounted(() => {
785
+ state.isMounted = true;
786
+ });
787
+ onBeforeUnmount(() => {
788
+ state.isUnmounting = true;
789
+ });
790
+ return state;
1038
791
  }
1039
- const getFunctionalFallthrough = (attrs) => {
1040
- let res;
1041
- for (const key in attrs) {
1042
- if (key === "class" || key === "style" || isOn(key)) {
1043
- (res || (res = {}))[key] = attrs[key];
1044
- }
1045
- }
1046
- return res;
1047
- };
1048
- const filterModelListeners = (attrs, props) => {
1049
- const res = {};
1050
- for (const key in attrs) {
1051
- if (!isModelListener(key) || !(key.slice(9) in props)) {
1052
- res[key] = attrs[key];
1053
- }
1054
- }
1055
- return res;
792
+ const TransitionHookValidator = [Function, Array];
793
+ const BaseTransitionPropsValidators = {
794
+ mode: String,
795
+ appear: Boolean,
796
+ persisted: Boolean,
797
+ // enter
798
+ onBeforeEnter: TransitionHookValidator,
799
+ onEnter: TransitionHookValidator,
800
+ onAfterEnter: TransitionHookValidator,
801
+ onEnterCancelled: TransitionHookValidator,
802
+ // leave
803
+ onBeforeLeave: TransitionHookValidator,
804
+ onLeave: TransitionHookValidator,
805
+ onAfterLeave: TransitionHookValidator,
806
+ onLeaveCancelled: TransitionHookValidator,
807
+ // appear
808
+ onBeforeAppear: TransitionHookValidator,
809
+ onAppear: TransitionHookValidator,
810
+ onAfterAppear: TransitionHookValidator,
811
+ onAppearCancelled: TransitionHookValidator
1056
812
  };
1057
- const isElementRoot = (vnode) => {
1058
- return vnode.shapeFlag & (6 | 1) || vnode.type === Comment;
813
+ const recursiveGetSubtree = (instance) => {
814
+ const subTree = instance.subTree;
815
+ return subTree.component ? recursiveGetSubtree(subTree.component) : subTree;
1059
816
  };
1060
- function shouldUpdateComponent(prevVNode, nextVNode, optimized) {
1061
- const { props: prevProps, children: prevChildren, component } = prevVNode;
1062
- const { props: nextProps, children: nextChildren, patchFlag } = nextVNode;
1063
- const emits = component.emitsOptions;
1064
- if (!!(process.env.NODE_ENV !== "production") && (prevChildren || nextChildren) && isHmrUpdating) {
1065
- return true;
1066
- }
1067
- if (nextVNode.dirs || nextVNode.transition) {
1068
- return true;
1069
- }
1070
- if (optimized && patchFlag >= 0) {
1071
- if (patchFlag & 1024) {
1072
- return true;
1073
- }
1074
- if (patchFlag & 16) {
1075
- if (!prevProps) {
1076
- return !!nextProps;
817
+ const BaseTransitionImpl = {
818
+ name: `BaseTransition`,
819
+ props: BaseTransitionPropsValidators,
820
+ setup(props, { slots }) {
821
+ const instance = getCurrentInstance();
822
+ const state = useTransitionState();
823
+ return () => {
824
+ const children = slots.default && getTransitionRawChildren(slots.default(), true);
825
+ if (!children || !children.length) {
826
+ return;
1077
827
  }
1078
- return hasPropsChanged(prevProps, nextProps, emits);
1079
- } else if (patchFlag & 8) {
1080
- const dynamicProps = nextVNode.dynamicProps;
1081
- for (let i = 0; i < dynamicProps.length; i++) {
1082
- const key = dynamicProps[i];
1083
- if (nextProps[key] !== prevProps[key] && !isEmitListener(emits, key)) {
1084
- return true;
828
+ let child = children[0];
829
+ if (children.length > 1) {
830
+ let hasFound = false;
831
+ for (const c of children) {
832
+ if (c.type !== Comment) {
833
+ if (!!(process.env.NODE_ENV !== "production") && hasFound) {
834
+ warn$1(
835
+ "<transition> can only be used on a single element or component. Use <transition-group> for lists."
836
+ );
837
+ break;
838
+ }
839
+ child = c;
840
+ hasFound = true;
841
+ if (!!!(process.env.NODE_ENV !== "production")) break;
842
+ }
1085
843
  }
1086
844
  }
1087
- }
1088
- } else {
1089
- if (prevChildren || nextChildren) {
1090
- if (!nextChildren || !nextChildren.$stable) {
1091
- return true;
845
+ const rawProps = toRaw(props);
846
+ const { mode } = rawProps;
847
+ if (!!(process.env.NODE_ENV !== "production") && mode && mode !== "in-out" && mode !== "out-in" && mode !== "default") {
848
+ warn$1(`invalid <transition> mode: ${mode}`);
1092
849
  }
1093
- }
1094
- if (prevProps === nextProps) {
1095
- return false;
1096
- }
1097
- if (!prevProps) {
1098
- return !!nextProps;
1099
- }
1100
- if (!nextProps) {
1101
- return true;
1102
- }
1103
- return hasPropsChanged(prevProps, nextProps, emits);
1104
- }
1105
- return false;
1106
- }
1107
- function hasPropsChanged(prevProps, nextProps, emitsOptions) {
1108
- const nextKeys = Object.keys(nextProps);
1109
- if (nextKeys.length !== Object.keys(prevProps).length) {
1110
- return true;
1111
- }
1112
- for (let i = 0; i < nextKeys.length; i++) {
1113
- const key = nextKeys[i];
1114
- if (nextProps[key] !== prevProps[key] && !isEmitListener(emitsOptions, key)) {
1115
- return true;
1116
- }
1117
- }
1118
- return false;
1119
- }
1120
- function updateHOCHostEl({ vnode, parent }, el) {
1121
- while (parent) {
1122
- const root = parent.subTree;
1123
- if (root.suspense && root.suspense.activeBranch === vnode) {
1124
- root.el = vnode.el;
1125
- }
1126
- if (root === vnode) {
1127
- (vnode = parent.vnode).el = el;
1128
- parent = parent.parent;
1129
- } else {
1130
- break;
1131
- }
1132
- }
1133
- }
1134
-
1135
- const COMPONENTS = "components";
1136
- const DIRECTIVES = "directives";
1137
- function resolveComponent(name, maybeSelfReference) {
1138
- return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;
1139
- }
1140
- const NULL_DYNAMIC_COMPONENT = Symbol.for("v-ndc");
1141
- function resolveDynamicComponent(component) {
1142
- if (isString(component)) {
1143
- return resolveAsset(COMPONENTS, component, false) || component;
1144
- } else {
1145
- return component || NULL_DYNAMIC_COMPONENT;
1146
- }
1147
- }
1148
- function resolveDirective(name) {
1149
- return resolveAsset(DIRECTIVES, name);
1150
- }
1151
- function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false) {
1152
- const instance = currentRenderingInstance || currentInstance;
1153
- if (instance) {
1154
- const Component = instance.type;
1155
- if (type === COMPONENTS) {
1156
- const selfName = getComponentName(
1157
- Component,
1158
- false
1159
- );
1160
- if (selfName && (selfName === name || selfName === camelize(name) || selfName === capitalize(camelize(name)))) {
1161
- return Component;
850
+ if (state.isLeaving) {
851
+ return emptyPlaceholder(child);
1162
852
  }
1163
- }
1164
- const res = (
1165
- // local registration
1166
- // check instance[type] first which is resolved for options API
1167
- resolve(instance[type] || Component[type], name) || // global registration
1168
- resolve(instance.appContext[type], name)
1169
- );
1170
- if (!res && maybeSelfReference) {
1171
- return Component;
1172
- }
1173
- if (!!(process.env.NODE_ENV !== "production") && warnMissing && !res) {
1174
- const extra = type === COMPONENTS ? `
1175
- If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.` : ``;
1176
- warn$1(`Failed to resolve ${type.slice(0, -1)}: ${name}${extra}`);
1177
- }
1178
- return res;
1179
- } else if (!!(process.env.NODE_ENV !== "production")) {
1180
- warn$1(
1181
- `resolve${capitalize(type.slice(0, -1))} can only be used in render() or setup().`
1182
- );
1183
- }
1184
- }
1185
- function resolve(registry, name) {
1186
- return registry && (registry[name] || registry[camelize(name)] || registry[capitalize(camelize(name))]);
1187
- }
1188
-
1189
- const isSuspense = (type) => type.__isSuspense;
1190
- let suspenseId = 0;
1191
- const SuspenseImpl = {
1192
- name: "Suspense",
1193
- // In order to make Suspense tree-shakable, we need to avoid importing it
1194
- // directly in the renderer. The renderer checks for the __isSuspense flag
1195
- // on a vnode's type and calls the `process` method, passing in renderer
1196
- // internals.
1197
- __isSuspense: true,
1198
- process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals) {
1199
- if (n1 == null) {
1200
- mountSuspense(
1201
- n2,
1202
- container,
1203
- anchor,
1204
- parentComponent,
1205
- parentSuspense,
1206
- namespace,
1207
- slotScopeIds,
1208
- optimized,
1209
- rendererInternals
1210
- );
1211
- } else {
1212
- if (parentSuspense && parentSuspense.deps > 0 && !n1.suspense.isInFallback) {
1213
- n2.suspense = n1.suspense;
1214
- n2.suspense.vnode = n2;
1215
- n2.el = n1.el;
1216
- return;
853
+ const innerChild = getKeepAliveChild(child);
854
+ if (!innerChild) {
855
+ return emptyPlaceholder(child);
1217
856
  }
1218
- patchSuspense(
1219
- n1,
1220
- n2,
1221
- container,
1222
- anchor,
1223
- parentComponent,
1224
- namespace,
1225
- slotScopeIds,
1226
- optimized,
1227
- rendererInternals
857
+ let enterHooks = resolveTransitionHooks(
858
+ innerChild,
859
+ rawProps,
860
+ state,
861
+ instance,
862
+ // #11061, ensure enterHooks is fresh after clone
863
+ (hooks) => enterHooks = hooks
1228
864
  );
1229
- }
1230
- },
1231
- hydrate: hydrateSuspense,
1232
- normalize: normalizeSuspenseChildren
865
+ setTransitionHooks(innerChild, enterHooks);
866
+ const oldChild = instance.subTree;
867
+ const oldInnerChild = oldChild && getKeepAliveChild(oldChild);
868
+ if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(innerChild, oldInnerChild) && recursiveGetSubtree(instance).type !== Comment) {
869
+ const leavingHooks = resolveTransitionHooks(
870
+ oldInnerChild,
871
+ rawProps,
872
+ state,
873
+ instance
874
+ );
875
+ setTransitionHooks(oldInnerChild, leavingHooks);
876
+ if (mode === "out-in" && innerChild.type !== Comment) {
877
+ state.isLeaving = true;
878
+ leavingHooks.afterLeave = () => {
879
+ state.isLeaving = false;
880
+ if (instance.update.active !== false) {
881
+ instance.effect.dirty = true;
882
+ instance.update();
883
+ }
884
+ };
885
+ return emptyPlaceholder(child);
886
+ } else if (mode === "in-out" && innerChild.type !== Comment) {
887
+ leavingHooks.delayLeave = (el, earlyRemove, delayedLeave) => {
888
+ const leavingVNodesCache = getLeavingNodesForType(
889
+ state,
890
+ oldInnerChild
891
+ );
892
+ leavingVNodesCache[String(oldInnerChild.key)] = oldInnerChild;
893
+ el[leaveCbKey] = () => {
894
+ earlyRemove();
895
+ el[leaveCbKey] = void 0;
896
+ delete enterHooks.delayedLeave;
897
+ };
898
+ enterHooks.delayedLeave = delayedLeave;
899
+ };
900
+ }
901
+ }
902
+ return child;
903
+ };
904
+ }
1233
905
  };
1234
- const Suspense = SuspenseImpl ;
1235
- function triggerEvent(vnode, name) {
1236
- const eventListener = vnode.props && vnode.props[name];
1237
- if (isFunction(eventListener)) {
1238
- eventListener();
906
+ const BaseTransition = BaseTransitionImpl;
907
+ function getLeavingNodesForType(state, vnode) {
908
+ const { leavingVNodes } = state;
909
+ let leavingVNodesCache = leavingVNodes.get(vnode.type);
910
+ if (!leavingVNodesCache) {
911
+ leavingVNodesCache = /* @__PURE__ */ Object.create(null);
912
+ leavingVNodes.set(vnode.type, leavingVNodesCache);
1239
913
  }
914
+ return leavingVNodesCache;
1240
915
  }
1241
- function mountSuspense(vnode, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals) {
916
+ function resolveTransitionHooks(vnode, props, state, instance, postClone) {
1242
917
  const {
1243
- p: patch,
1244
- o: { createElement }
1245
- } = rendererInternals;
1246
- const hiddenContainer = createElement("div");
1247
- const suspense = vnode.suspense = createSuspenseBoundary(
1248
- vnode,
1249
- parentSuspense,
1250
- parentComponent,
1251
- container,
1252
- hiddenContainer,
1253
- anchor,
1254
- namespace,
1255
- slotScopeIds,
1256
- optimized,
1257
- rendererInternals
1258
- );
1259
- patch(
1260
- null,
1261
- suspense.pendingBranch = vnode.ssContent,
1262
- hiddenContainer,
1263
- null,
1264
- parentComponent,
1265
- suspense,
1266
- namespace,
1267
- slotScopeIds
1268
- );
1269
- if (suspense.deps > 0) {
1270
- triggerEvent(vnode, "onPending");
1271
- triggerEvent(vnode, "onFallback");
1272
- patch(
1273
- null,
1274
- vnode.ssFallback,
1275
- container,
1276
- anchor,
1277
- parentComponent,
1278
- null,
1279
- // fallback tree will not have suspense context
1280
- namespace,
1281
- slotScopeIds
918
+ appear,
919
+ mode,
920
+ persisted = false,
921
+ onBeforeEnter,
922
+ onEnter,
923
+ onAfterEnter,
924
+ onEnterCancelled,
925
+ onBeforeLeave,
926
+ onLeave,
927
+ onAfterLeave,
928
+ onLeaveCancelled,
929
+ onBeforeAppear,
930
+ onAppear,
931
+ onAfterAppear,
932
+ onAppearCancelled
933
+ } = props;
934
+ const key = String(vnode.key);
935
+ const leavingVNodesCache = getLeavingNodesForType(state, vnode);
936
+ const callHook = (hook, args) => {
937
+ hook && callWithAsyncErrorHandling(
938
+ hook,
939
+ instance,
940
+ 9,
941
+ args
1282
942
  );
1283
- setActiveBranch(suspense, vnode.ssFallback);
1284
- } else {
1285
- suspense.resolve(false, true);
1286
- }
1287
- }
1288
- function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, slotScopeIds, optimized, { p: patch, um: unmount, o: { createElement } }) {
1289
- const suspense = n2.suspense = n1.suspense;
1290
- suspense.vnode = n2;
1291
- n2.el = n1.el;
1292
- const newBranch = n2.ssContent;
1293
- const newFallback = n2.ssFallback;
1294
- const { activeBranch, pendingBranch, isInFallback, isHydrating } = suspense;
1295
- if (pendingBranch) {
1296
- suspense.pendingBranch = newBranch;
1297
- if (isSameVNodeType(newBranch, pendingBranch)) {
1298
- patch(
1299
- pendingBranch,
1300
- newBranch,
1301
- suspense.hiddenContainer,
1302
- null,
1303
- parentComponent,
1304
- suspense,
1305
- namespace,
1306
- slotScopeIds,
1307
- optimized
1308
- );
1309
- if (suspense.deps <= 0) {
1310
- suspense.resolve();
1311
- } else if (isInFallback) {
1312
- if (!isHydrating) {
1313
- patch(
1314
- activeBranch,
1315
- newFallback,
1316
- container,
1317
- anchor,
1318
- parentComponent,
1319
- null,
1320
- // fallback tree will not have suspense context
1321
- namespace,
1322
- slotScopeIds,
1323
- optimized
1324
- );
1325
- setActiveBranch(suspense, newFallback);
943
+ };
944
+ const callAsyncHook = (hook, args) => {
945
+ const done = args[1];
946
+ callHook(hook, args);
947
+ if (isArray(hook)) {
948
+ if (hook.every((hook2) => hook2.length <= 1)) done();
949
+ } else if (hook.length <= 1) {
950
+ done();
951
+ }
952
+ };
953
+ const hooks = {
954
+ mode,
955
+ persisted,
956
+ beforeEnter(el) {
957
+ let hook = onBeforeEnter;
958
+ if (!state.isMounted) {
959
+ if (appear) {
960
+ hook = onBeforeAppear || onBeforeEnter;
961
+ } else {
962
+ return;
1326
963
  }
1327
964
  }
1328
- } else {
1329
- suspense.pendingId = suspenseId++;
1330
- if (isHydrating) {
1331
- suspense.isHydrating = false;
1332
- suspense.activeBranch = pendingBranch;
1333
- } else {
1334
- unmount(pendingBranch, parentComponent, suspense);
1335
- }
1336
- suspense.deps = 0;
1337
- suspense.effects.length = 0;
1338
- suspense.hiddenContainer = createElement("div");
1339
- if (isInFallback) {
1340
- patch(
1341
- null,
1342
- newBranch,
1343
- suspense.hiddenContainer,
1344
- null,
1345
- parentComponent,
1346
- suspense,
1347
- namespace,
1348
- slotScopeIds,
1349
- optimized
965
+ if (el[leaveCbKey]) {
966
+ el[leaveCbKey](
967
+ true
968
+ /* cancelled */
1350
969
  );
1351
- if (suspense.deps <= 0) {
1352
- suspense.resolve();
970
+ }
971
+ const leavingVNode = leavingVNodesCache[key];
972
+ if (leavingVNode && isSameVNodeType(vnode, leavingVNode) && leavingVNode.el[leaveCbKey]) {
973
+ leavingVNode.el[leaveCbKey]();
974
+ }
975
+ callHook(hook, [el]);
976
+ },
977
+ enter(el) {
978
+ let hook = onEnter;
979
+ let afterHook = onAfterEnter;
980
+ let cancelHook = onEnterCancelled;
981
+ if (!state.isMounted) {
982
+ if (appear) {
983
+ hook = onAppear || onEnter;
984
+ afterHook = onAfterAppear || onAfterEnter;
985
+ cancelHook = onAppearCancelled || onEnterCancelled;
1353
986
  } else {
1354
- patch(
1355
- activeBranch,
1356
- newFallback,
1357
- container,
1358
- anchor,
1359
- parentComponent,
1360
- null,
1361
- // fallback tree will not have suspense context
1362
- namespace,
1363
- slotScopeIds,
1364
- optimized
1365
- );
1366
- setActiveBranch(suspense, newFallback);
987
+ return;
1367
988
  }
1368
- } else if (activeBranch && isSameVNodeType(newBranch, activeBranch)) {
1369
- patch(
1370
- activeBranch,
1371
- newBranch,
1372
- container,
1373
- anchor,
1374
- parentComponent,
1375
- suspense,
1376
- namespace,
1377
- slotScopeIds,
1378
- optimized
1379
- );
1380
- suspense.resolve(true);
989
+ }
990
+ let called = false;
991
+ const done = el[enterCbKey] = (cancelled) => {
992
+ if (called) return;
993
+ called = true;
994
+ if (cancelled) {
995
+ callHook(cancelHook, [el]);
996
+ } else {
997
+ callHook(afterHook, [el]);
998
+ }
999
+ if (hooks.delayedLeave) {
1000
+ hooks.delayedLeave();
1001
+ }
1002
+ el[enterCbKey] = void 0;
1003
+ };
1004
+ if (hook) {
1005
+ callAsyncHook(hook, [el, done]);
1381
1006
  } else {
1382
- patch(
1383
- null,
1384
- newBranch,
1385
- suspense.hiddenContainer,
1386
- null,
1387
- parentComponent,
1388
- suspense,
1389
- namespace,
1390
- slotScopeIds,
1391
- optimized
1007
+ done();
1008
+ }
1009
+ },
1010
+ leave(el, remove) {
1011
+ const key2 = String(vnode.key);
1012
+ if (el[enterCbKey]) {
1013
+ el[enterCbKey](
1014
+ true
1015
+ /* cancelled */
1392
1016
  );
1393
- if (suspense.deps <= 0) {
1394
- suspense.resolve();
1017
+ }
1018
+ if (state.isUnmounting) {
1019
+ return remove();
1020
+ }
1021
+ callHook(onBeforeLeave, [el]);
1022
+ let called = false;
1023
+ const done = el[leaveCbKey] = (cancelled) => {
1024
+ if (called) return;
1025
+ called = true;
1026
+ remove();
1027
+ if (cancelled) {
1028
+ callHook(onLeaveCancelled, [el]);
1029
+ } else {
1030
+ callHook(onAfterLeave, [el]);
1395
1031
  }
1032
+ el[leaveCbKey] = void 0;
1033
+ if (leavingVNodesCache[key2] === vnode) {
1034
+ delete leavingVNodesCache[key2];
1035
+ }
1036
+ };
1037
+ leavingVNodesCache[key2] = vnode;
1038
+ if (onLeave) {
1039
+ callAsyncHook(onLeave, [el, done]);
1040
+ } else {
1041
+ done();
1396
1042
  }
1043
+ },
1044
+ clone(vnode2) {
1045
+ const hooks2 = resolveTransitionHooks(
1046
+ vnode2,
1047
+ props,
1048
+ state,
1049
+ instance,
1050
+ postClone
1051
+ );
1052
+ if (postClone) postClone(hooks2);
1053
+ return hooks2;
1397
1054
  }
1055
+ };
1056
+ return hooks;
1057
+ }
1058
+ function emptyPlaceholder(vnode) {
1059
+ if (isKeepAlive(vnode)) {
1060
+ vnode = cloneVNode(vnode);
1061
+ vnode.children = null;
1062
+ return vnode;
1063
+ }
1064
+ }
1065
+ function getKeepAliveChild(vnode) {
1066
+ if (!isKeepAlive(vnode)) {
1067
+ return vnode;
1068
+ }
1069
+ if (!!(process.env.NODE_ENV !== "production") && vnode.component) {
1070
+ return vnode.component.subTree;
1071
+ }
1072
+ const { shapeFlag, children } = vnode;
1073
+ if (children) {
1074
+ if (shapeFlag & 16) {
1075
+ return children[0];
1076
+ }
1077
+ if (shapeFlag & 32 && isFunction(children.default)) {
1078
+ return children.default();
1079
+ }
1080
+ }
1081
+ }
1082
+ function setTransitionHooks(vnode, hooks) {
1083
+ if (vnode.shapeFlag & 6 && vnode.component) {
1084
+ setTransitionHooks(vnode.component.subTree, hooks);
1085
+ } else if (vnode.shapeFlag & 128) {
1086
+ vnode.ssContent.transition = hooks.clone(vnode.ssContent);
1087
+ vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
1398
1088
  } else {
1399
- if (activeBranch && isSameVNodeType(newBranch, activeBranch)) {
1400
- patch(
1401
- activeBranch,
1402
- newBranch,
1403
- container,
1404
- anchor,
1405
- parentComponent,
1406
- suspense,
1407
- namespace,
1408
- slotScopeIds,
1409
- optimized
1089
+ vnode.transition = hooks;
1090
+ }
1091
+ }
1092
+ function getTransitionRawChildren(children, keepComment = false, parentKey) {
1093
+ let ret = [];
1094
+ let keyedFragmentCount = 0;
1095
+ for (let i = 0; i < children.length; i++) {
1096
+ let child = children[i];
1097
+ const key = parentKey == null ? child.key : String(parentKey) + String(child.key != null ? child.key : i);
1098
+ if (child.type === Fragment) {
1099
+ if (child.patchFlag & 128) keyedFragmentCount++;
1100
+ ret = ret.concat(
1101
+ getTransitionRawChildren(child.children, keepComment, key)
1410
1102
  );
1411
- setActiveBranch(suspense, newBranch);
1412
- } else {
1413
- triggerEvent(n2, "onPending");
1414
- suspense.pendingBranch = newBranch;
1415
- if (newBranch.shapeFlag & 512) {
1416
- suspense.pendingId = newBranch.component.suspenseId;
1103
+ } else if (keepComment || child.type !== Comment) {
1104
+ ret.push(key != null ? cloneVNode(child, { key }) : child);
1105
+ }
1106
+ }
1107
+ if (keyedFragmentCount > 1) {
1108
+ for (let i = 0; i < ret.length; i++) {
1109
+ ret[i].patchFlag = -2;
1110
+ }
1111
+ }
1112
+ return ret;
1113
+ }
1114
+
1115
+ /*! #__NO_SIDE_EFFECTS__ */
1116
+ // @__NO_SIDE_EFFECTS__
1117
+ function defineComponent(options, extraOptions) {
1118
+ return isFunction(options) ? (
1119
+ // #8326: extend call and options.name access are considered side-effects
1120
+ // by Rollup, so we have to wrap it in a pure-annotated IIFE.
1121
+ /* @__PURE__ */ (() => extend({ name: options.name }, extraOptions, { setup: options }))()
1122
+ ) : options;
1123
+ }
1124
+
1125
+ const isAsyncWrapper = (i) => !!i.type.__asyncLoader;
1126
+ /*! #__NO_SIDE_EFFECTS__ */
1127
+ // @__NO_SIDE_EFFECTS__
1128
+ function defineAsyncComponent(source) {
1129
+ if (isFunction(source)) {
1130
+ source = { loader: source };
1131
+ }
1132
+ const {
1133
+ loader,
1134
+ loadingComponent,
1135
+ errorComponent,
1136
+ delay = 200,
1137
+ timeout,
1138
+ // undefined = never times out
1139
+ suspensible = true,
1140
+ onError: userOnError
1141
+ } = source;
1142
+ let pendingRequest = null;
1143
+ let resolvedComp;
1144
+ let retries = 0;
1145
+ const retry = () => {
1146
+ retries++;
1147
+ pendingRequest = null;
1148
+ return load();
1149
+ };
1150
+ const load = () => {
1151
+ let thisRequest;
1152
+ return pendingRequest || (thisRequest = pendingRequest = loader().catch((err) => {
1153
+ err = err instanceof Error ? err : new Error(String(err));
1154
+ if (userOnError) {
1155
+ return new Promise((resolve, reject) => {
1156
+ const userRetry = () => resolve(retry());
1157
+ const userFail = () => reject(err);
1158
+ userOnError(err, userRetry, userFail, retries + 1);
1159
+ });
1417
1160
  } else {
1418
- suspense.pendingId = suspenseId++;
1161
+ throw err;
1162
+ }
1163
+ }).then((comp) => {
1164
+ if (thisRequest !== pendingRequest && pendingRequest) {
1165
+ return pendingRequest;
1166
+ }
1167
+ if (!!(process.env.NODE_ENV !== "production") && !comp) {
1168
+ warn$1(
1169
+ `Async component loader resolved to undefined. If you are using retry(), make sure to return its return value.`
1170
+ );
1171
+ }
1172
+ if (comp && (comp.__esModule || comp[Symbol.toStringTag] === "Module")) {
1173
+ comp = comp.default;
1174
+ }
1175
+ if (!!(process.env.NODE_ENV !== "production") && comp && !isObject(comp) && !isFunction(comp)) {
1176
+ throw new Error(`Invalid async component load result: ${comp}`);
1177
+ }
1178
+ resolvedComp = comp;
1179
+ return comp;
1180
+ }));
1181
+ };
1182
+ return defineComponent({
1183
+ name: "AsyncComponentWrapper",
1184
+ __asyncLoader: load,
1185
+ get __asyncResolved() {
1186
+ return resolvedComp;
1187
+ },
1188
+ setup() {
1189
+ const instance = currentInstance;
1190
+ if (resolvedComp) {
1191
+ return () => createInnerComp(resolvedComp, instance);
1192
+ }
1193
+ const onError = (err) => {
1194
+ pendingRequest = null;
1195
+ handleError(
1196
+ err,
1197
+ instance,
1198
+ 13,
1199
+ !errorComponent
1200
+ );
1201
+ };
1202
+ if (suspensible && instance.suspense || isInSSRComponentSetup) {
1203
+ return load().then((comp) => {
1204
+ return () => createInnerComp(comp, instance);
1205
+ }).catch((err) => {
1206
+ onError(err);
1207
+ return () => errorComponent ? createVNode(errorComponent, {
1208
+ error: err
1209
+ }) : null;
1210
+ });
1211
+ }
1212
+ const loaded = ref(false);
1213
+ const error = ref();
1214
+ const delayed = ref(!!delay);
1215
+ if (delay) {
1216
+ setTimeout(() => {
1217
+ delayed.value = false;
1218
+ }, delay);
1219
+ }
1220
+ if (timeout != null) {
1221
+ setTimeout(() => {
1222
+ if (!loaded.value && !error.value) {
1223
+ const err = new Error(
1224
+ `Async component timed out after ${timeout}ms.`
1225
+ );
1226
+ onError(err);
1227
+ error.value = err;
1228
+ }
1229
+ }, timeout);
1230
+ }
1231
+ load().then(() => {
1232
+ loaded.value = true;
1233
+ if (instance.parent && isKeepAlive(instance.parent.vnode)) {
1234
+ instance.parent.effect.dirty = true;
1235
+ queueJob(instance.parent.update);
1236
+ }
1237
+ }).catch((err) => {
1238
+ onError(err);
1239
+ error.value = err;
1240
+ });
1241
+ return () => {
1242
+ if (loaded.value && resolvedComp) {
1243
+ return createInnerComp(resolvedComp, instance);
1244
+ } else if (error.value && errorComponent) {
1245
+ return createVNode(errorComponent, {
1246
+ error: error.value
1247
+ });
1248
+ } else if (loadingComponent && !delayed.value) {
1249
+ return createVNode(loadingComponent);
1250
+ }
1251
+ };
1252
+ }
1253
+ });
1254
+ }
1255
+ function createInnerComp(comp, parent) {
1256
+ const { ref: ref2, props, children, ce } = parent.vnode;
1257
+ const vnode = createVNode(comp, props, children);
1258
+ vnode.ref = ref2;
1259
+ vnode.ce = ce;
1260
+ delete parent.vnode.ce;
1261
+ return vnode;
1262
+ }
1263
+
1264
+ const isKeepAlive = (vnode) => vnode.type.__isKeepAlive;
1265
+ const KeepAliveImpl = {
1266
+ name: `KeepAlive`,
1267
+ // Marker for special handling inside the renderer. We are not using a ===
1268
+ // check directly on KeepAlive in the renderer, because importing it directly
1269
+ // would prevent it from being tree-shaken.
1270
+ __isKeepAlive: true,
1271
+ props: {
1272
+ include: [String, RegExp, Array],
1273
+ exclude: [String, RegExp, Array],
1274
+ max: [String, Number]
1275
+ },
1276
+ setup(props, { slots }) {
1277
+ const instance = getCurrentInstance();
1278
+ const sharedContext = instance.ctx;
1279
+ if (!sharedContext.renderer) {
1280
+ return () => {
1281
+ const children = slots.default && slots.default();
1282
+ return children && children.length === 1 ? children[0] : children;
1283
+ };
1284
+ }
1285
+ const cache = /* @__PURE__ */ new Map();
1286
+ const keys = /* @__PURE__ */ new Set();
1287
+ let current = null;
1288
+ if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__) {
1289
+ instance.__v_cache = cache;
1290
+ }
1291
+ const parentSuspense = instance.suspense;
1292
+ const {
1293
+ renderer: {
1294
+ p: patch,
1295
+ m: move,
1296
+ um: _unmount,
1297
+ o: { createElement }
1419
1298
  }
1299
+ } = sharedContext;
1300
+ const storageContainer = createElement("div");
1301
+ sharedContext.activate = (vnode, container, anchor, namespace, optimized) => {
1302
+ const instance2 = vnode.component;
1303
+ move(vnode, container, anchor, 0, parentSuspense);
1420
1304
  patch(
1421
- null,
1422
- newBranch,
1423
- suspense.hiddenContainer,
1424
- null,
1425
- parentComponent,
1426
- suspense,
1305
+ instance2.vnode,
1306
+ vnode,
1307
+ container,
1308
+ anchor,
1309
+ instance2,
1310
+ parentSuspense,
1427
1311
  namespace,
1428
- slotScopeIds,
1312
+ vnode.slotScopeIds,
1429
1313
  optimized
1430
1314
  );
1431
- if (suspense.deps <= 0) {
1432
- suspense.resolve();
1433
- } else {
1434
- const { timeout, pendingId } = suspense;
1435
- if (timeout > 0) {
1436
- setTimeout(() => {
1437
- if (suspense.pendingId === pendingId) {
1438
- suspense.fallback(newFallback);
1439
- }
1440
- }, timeout);
1441
- } else if (timeout === 0) {
1442
- suspense.fallback(newFallback);
1443
- }
1444
- }
1445
- }
1446
- }
1447
- }
1448
- let hasWarned = false;
1449
- function createSuspenseBoundary(vnode, parentSuspense, parentComponent, container, hiddenContainer, anchor, namespace, slotScopeIds, optimized, rendererInternals, isHydrating = false) {
1450
- if (!!(process.env.NODE_ENV !== "production") && true && !hasWarned) {
1451
- hasWarned = true;
1452
- console[console.info ? "info" : "log"](
1453
- `<Suspense> is an experimental feature and its API will likely change.`
1454
- );
1455
- }
1456
- const {
1457
- p: patch,
1458
- m: move,
1459
- um: unmount,
1460
- n: next,
1461
- o: { parentNode, remove }
1462
- } = rendererInternals;
1463
- let parentSuspenseId;
1464
- const isSuspensible = isVNodeSuspensible(vnode);
1465
- if (isSuspensible) {
1466
- if (parentSuspense && parentSuspense.pendingBranch) {
1467
- parentSuspenseId = parentSuspense.pendingId;
1468
- parentSuspense.deps++;
1469
- }
1470
- }
1471
- const timeout = vnode.props ? toNumber(vnode.props.timeout) : void 0;
1472
- if (!!(process.env.NODE_ENV !== "production")) {
1473
- assertNumber(timeout, `Suspense timeout`);
1474
- }
1475
- const initialAnchor = anchor;
1476
- const suspense = {
1477
- vnode,
1478
- parent: parentSuspense,
1479
- parentComponent,
1480
- namespace,
1481
- container,
1482
- hiddenContainer,
1483
- deps: 0,
1484
- pendingId: suspenseId++,
1485
- timeout: typeof timeout === "number" ? timeout : -1,
1486
- activeBranch: null,
1487
- pendingBranch: null,
1488
- isInFallback: !isHydrating,
1489
- isHydrating,
1490
- isUnmounted: false,
1491
- effects: [],
1492
- resolve(resume = false, sync = false) {
1493
- if (!!(process.env.NODE_ENV !== "production")) {
1494
- if (!resume && !suspense.pendingBranch) {
1495
- throw new Error(
1496
- `suspense.resolve() is called without a pending branch.`
1497
- );
1498
- }
1499
- if (suspense.isUnmounted) {
1500
- throw new Error(
1501
- `suspense.resolve() is called on an already unmounted suspense boundary.`
1502
- );
1503
- }
1504
- }
1505
- const {
1506
- vnode: vnode2,
1507
- activeBranch,
1508
- pendingBranch,
1509
- pendingId,
1510
- effects,
1511
- parentComponent: parentComponent2,
1512
- container: container2
1513
- } = suspense;
1514
- let delayEnter = false;
1515
- if (suspense.isHydrating) {
1516
- suspense.isHydrating = false;
1517
- } else if (!resume) {
1518
- delayEnter = activeBranch && pendingBranch.transition && pendingBranch.transition.mode === "out-in";
1519
- if (delayEnter) {
1520
- activeBranch.transition.afterLeave = () => {
1521
- if (pendingId === suspense.pendingId) {
1522
- move(
1523
- pendingBranch,
1524
- container2,
1525
- anchor === initialAnchor ? next(activeBranch) : anchor,
1526
- 0
1527
- );
1528
- queuePostFlushCb(effects);
1529
- }
1530
- };
1531
- }
1532
- if (activeBranch) {
1533
- if (parentNode(activeBranch.el) !== suspense.hiddenContainer) {
1534
- anchor = next(activeBranch);
1535
- }
1536
- unmount(activeBranch, parentComponent2, suspense, true);
1315
+ queuePostRenderEffect(() => {
1316
+ instance2.isDeactivated = false;
1317
+ if (instance2.a) {
1318
+ invokeArrayFns(instance2.a);
1537
1319
  }
1538
- if (!delayEnter) {
1539
- move(pendingBranch, container2, anchor, 0);
1320
+ const vnodeHook = vnode.props && vnode.props.onVnodeMounted;
1321
+ if (vnodeHook) {
1322
+ invokeVNodeHook(vnodeHook, instance2.parent, vnode);
1540
1323
  }
1324
+ }, parentSuspense);
1325
+ if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__) {
1326
+ devtoolsComponentAdded(instance2);
1541
1327
  }
1542
- setActiveBranch(suspense, pendingBranch);
1543
- suspense.pendingBranch = null;
1544
- suspense.isInFallback = false;
1545
- let parent = suspense.parent;
1546
- let hasUnresolvedAncestor = false;
1547
- while (parent) {
1548
- if (parent.pendingBranch) {
1549
- parent.effects.push(...effects);
1550
- hasUnresolvedAncestor = true;
1551
- break;
1328
+ };
1329
+ sharedContext.deactivate = (vnode) => {
1330
+ const instance2 = vnode.component;
1331
+ invalidateMount(instance2.m);
1332
+ invalidateMount(instance2.a);
1333
+ move(vnode, storageContainer, null, 1, parentSuspense);
1334
+ queuePostRenderEffect(() => {
1335
+ if (instance2.da) {
1336
+ invokeArrayFns(instance2.da);
1552
1337
  }
1553
- parent = parent.parent;
1554
- }
1555
- if (!hasUnresolvedAncestor && !delayEnter) {
1556
- queuePostFlushCb(effects);
1557
- }
1558
- suspense.effects = [];
1559
- if (isSuspensible) {
1560
- if (parentSuspense && parentSuspense.pendingBranch && parentSuspenseId === parentSuspense.pendingId) {
1561
- parentSuspense.deps--;
1562
- if (parentSuspense.deps === 0 && !sync) {
1563
- parentSuspense.resolve();
1564
- }
1338
+ const vnodeHook = vnode.props && vnode.props.onVnodeUnmounted;
1339
+ if (vnodeHook) {
1340
+ invokeVNodeHook(vnodeHook, instance2.parent, vnode);
1565
1341
  }
1342
+ instance2.isDeactivated = true;
1343
+ }, parentSuspense);
1344
+ if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__) {
1345
+ devtoolsComponentAdded(instance2);
1566
1346
  }
1567
- triggerEvent(vnode2, "onResolve");
1568
- },
1569
- fallback(fallbackVNode) {
1570
- if (!suspense.pendingBranch) {
1571
- return;
1572
- }
1573
- const { vnode: vnode2, activeBranch, parentComponent: parentComponent2, container: container2, namespace: namespace2 } = suspense;
1574
- triggerEvent(vnode2, "onFallback");
1575
- const anchor2 = next(activeBranch);
1576
- const mountFallback = () => {
1577
- if (!suspense.isInFallback) {
1578
- return;
1347
+ };
1348
+ function unmount(vnode) {
1349
+ resetShapeFlag(vnode);
1350
+ _unmount(vnode, instance, parentSuspense, true);
1351
+ }
1352
+ function pruneCache(filter) {
1353
+ cache.forEach((vnode, key) => {
1354
+ const name = getComponentName(vnode.type);
1355
+ if (name && (!filter || !filter(name))) {
1356
+ pruneCacheEntry(key);
1579
1357
  }
1580
- patch(
1581
- null,
1582
- fallbackVNode,
1583
- container2,
1584
- anchor2,
1585
- parentComponent2,
1586
- null,
1587
- // fallback tree will not have suspense context
1588
- namespace2,
1589
- slotScopeIds,
1590
- optimized
1591
- );
1592
- setActiveBranch(suspense, fallbackVNode);
1593
- };
1594
- const delayEnter = fallbackVNode.transition && fallbackVNode.transition.mode === "out-in";
1595
- if (delayEnter) {
1596
- activeBranch.transition.afterLeave = mountFallback;
1597
- }
1598
- suspense.isInFallback = true;
1599
- unmount(
1600
- activeBranch,
1601
- parentComponent2,
1602
- null,
1603
- // no suspense so unmount hooks fire now
1604
- true
1605
- // shouldRemove
1606
- );
1607
- if (!delayEnter) {
1608
- mountFallback();
1358
+ });
1359
+ }
1360
+ function pruneCacheEntry(key) {
1361
+ const cached = cache.get(key);
1362
+ if (!current || !isSameVNodeType(cached, current)) {
1363
+ unmount(cached);
1364
+ } else if (current) {
1365
+ resetShapeFlag(current);
1609
1366
  }
1610
- },
1611
- move(container2, anchor2, type) {
1612
- suspense.activeBranch && move(suspense.activeBranch, container2, anchor2, type);
1613
- suspense.container = container2;
1614
- },
1615
- next() {
1616
- return suspense.activeBranch && next(suspense.activeBranch);
1617
- },
1618
- registerDep(instance, setupRenderEffect, optimized2) {
1619
- const isInPendingSuspense = !!suspense.pendingBranch;
1620
- if (isInPendingSuspense) {
1621
- suspense.deps++;
1367
+ cache.delete(key);
1368
+ keys.delete(key);
1369
+ }
1370
+ watch(
1371
+ () => [props.include, props.exclude],
1372
+ ([include, exclude]) => {
1373
+ include && pruneCache((name) => matches(include, name));
1374
+ exclude && pruneCache((name) => !matches(exclude, name));
1375
+ },
1376
+ // prune post-render after `current` has been updated
1377
+ { flush: "post", deep: true }
1378
+ );
1379
+ let pendingCacheKey = null;
1380
+ const cacheSubtree = () => {
1381
+ if (pendingCacheKey != null) {
1382
+ if (isSuspense(instance.subTree.type)) {
1383
+ queuePostRenderEffect(() => {
1384
+ cache.set(pendingCacheKey, getInnerChild(instance.subTree));
1385
+ }, instance.subTree.suspense);
1386
+ } else {
1387
+ cache.set(pendingCacheKey, getInnerChild(instance.subTree));
1388
+ }
1622
1389
  }
1623
- const hydratedEl = instance.vnode.el;
1624
- instance.asyncDep.catch((err) => {
1625
- handleError(err, instance, 0);
1626
- }).then((asyncSetupResult) => {
1627
- if (instance.isUnmounted || suspense.isUnmounted || suspense.pendingId !== instance.suspenseId) {
1390
+ };
1391
+ onMounted(cacheSubtree);
1392
+ onUpdated(cacheSubtree);
1393
+ onBeforeUnmount(() => {
1394
+ cache.forEach((cached) => {
1395
+ const { subTree, suspense } = instance;
1396
+ const vnode = getInnerChild(subTree);
1397
+ if (cached.type === vnode.type && cached.key === vnode.key) {
1398
+ resetShapeFlag(vnode);
1399
+ const da = vnode.component.da;
1400
+ da && queuePostRenderEffect(da, suspense);
1628
1401
  return;
1629
1402
  }
1630
- instance.asyncResolved = true;
1631
- const { vnode: vnode2 } = instance;
1403
+ unmount(cached);
1404
+ });
1405
+ });
1406
+ return () => {
1407
+ pendingCacheKey = null;
1408
+ if (!slots.default) {
1409
+ return null;
1410
+ }
1411
+ const children = slots.default();
1412
+ const rawVNode = children[0];
1413
+ if (children.length > 1) {
1632
1414
  if (!!(process.env.NODE_ENV !== "production")) {
1633
- pushWarningContext(vnode2);
1634
- }
1635
- handleSetupResult(instance, asyncSetupResult, false);
1636
- if (hydratedEl) {
1637
- vnode2.el = hydratedEl;
1415
+ warn$1(`KeepAlive should contain exactly one component child.`);
1638
1416
  }
1639
- const placeholder = !hydratedEl && instance.subTree.el;
1640
- setupRenderEffect(
1641
- instance,
1642
- vnode2,
1643
- // component may have been moved before resolve.
1644
- // if this is not a hydration, instance.subTree will be the comment
1645
- // placeholder.
1646
- parentNode(hydratedEl || instance.subTree.el),
1647
- // anchor will not be used if this is hydration, so only need to
1648
- // consider the comment placeholder case.
1649
- hydratedEl ? null : next(instance.subTree),
1650
- suspense,
1651
- namespace,
1652
- optimized2
1653
- );
1654
- if (placeholder) {
1655
- remove(placeholder);
1417
+ current = null;
1418
+ return children;
1419
+ } else if (!isVNode(rawVNode) || !(rawVNode.shapeFlag & 4) && !(rawVNode.shapeFlag & 128)) {
1420
+ current = null;
1421
+ return rawVNode;
1422
+ }
1423
+ let vnode = getInnerChild(rawVNode);
1424
+ const comp = vnode.type;
1425
+ const name = getComponentName(
1426
+ isAsyncWrapper(vnode) ? vnode.type.__asyncResolved || {} : comp
1427
+ );
1428
+ const { include, exclude, max } = props;
1429
+ if (include && (!name || !matches(include, name)) || exclude && name && matches(exclude, name)) {
1430
+ current = vnode;
1431
+ return rawVNode;
1432
+ }
1433
+ const key = vnode.key == null ? comp : vnode.key;
1434
+ const cachedVNode = cache.get(key);
1435
+ if (vnode.el) {
1436
+ vnode = cloneVNode(vnode);
1437
+ if (rawVNode.shapeFlag & 128) {
1438
+ rawVNode.ssContent = vnode;
1656
1439
  }
1657
- updateHOCHostEl(instance, vnode2.el);
1658
- if (!!(process.env.NODE_ENV !== "production")) {
1659
- popWarningContext();
1440
+ }
1441
+ pendingCacheKey = key;
1442
+ if (cachedVNode) {
1443
+ vnode.el = cachedVNode.el;
1444
+ vnode.component = cachedVNode.component;
1445
+ if (vnode.transition) {
1446
+ setTransitionHooks(vnode, vnode.transition);
1660
1447
  }
1661
- if (isInPendingSuspense && --suspense.deps === 0) {
1662
- suspense.resolve();
1448
+ vnode.shapeFlag |= 512;
1449
+ keys.delete(key);
1450
+ keys.add(key);
1451
+ } else {
1452
+ keys.add(key);
1453
+ if (max && keys.size > parseInt(max, 10)) {
1454
+ pruneCacheEntry(keys.values().next().value);
1663
1455
  }
1664
- });
1665
- },
1666
- unmount(parentSuspense2, doRemove) {
1667
- suspense.isUnmounted = true;
1668
- if (suspense.activeBranch) {
1669
- unmount(
1670
- suspense.activeBranch,
1671
- parentComponent,
1672
- parentSuspense2,
1673
- doRemove
1674
- );
1675
- }
1676
- if (suspense.pendingBranch) {
1677
- unmount(
1678
- suspense.pendingBranch,
1679
- parentComponent,
1680
- parentSuspense2,
1681
- doRemove
1682
- );
1683
1456
  }
1684
- }
1685
- };
1686
- return suspense;
1687
- }
1688
- function hydrateSuspense(node, vnode, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals, hydrateNode) {
1689
- const suspense = vnode.suspense = createSuspenseBoundary(
1690
- vnode,
1691
- parentSuspense,
1692
- parentComponent,
1693
- node.parentNode,
1694
- // eslint-disable-next-line no-restricted-globals
1695
- document.createElement("div"),
1696
- null,
1697
- namespace,
1698
- slotScopeIds,
1699
- optimized,
1700
- rendererInternals,
1701
- true
1702
- );
1703
- const result = hydrateNode(
1704
- node,
1705
- suspense.pendingBranch = vnode.ssContent,
1706
- parentComponent,
1707
- suspense,
1708
- slotScopeIds,
1709
- optimized
1710
- );
1711
- if (suspense.deps === 0) {
1712
- suspense.resolve(false, true);
1457
+ vnode.shapeFlag |= 256;
1458
+ current = vnode;
1459
+ return isSuspense(rawVNode.type) ? rawVNode : vnode;
1460
+ };
1713
1461
  }
1714
- return result;
1462
+ };
1463
+ const KeepAlive = KeepAliveImpl;
1464
+ function matches(pattern, name) {
1465
+ if (isArray(pattern)) {
1466
+ return pattern.some((p) => matches(p, name));
1467
+ } else if (isString(pattern)) {
1468
+ return pattern.split(",").includes(name);
1469
+ } else if (isRegExp(pattern)) {
1470
+ return pattern.test(name);
1471
+ }
1472
+ return false;
1715
1473
  }
1716
- function normalizeSuspenseChildren(vnode) {
1717
- const { shapeFlag, children } = vnode;
1718
- const isSlotChildren = shapeFlag & 32;
1719
- vnode.ssContent = normalizeSuspenseSlot(
1720
- isSlotChildren ? children.default : children
1721
- );
1722
- vnode.ssFallback = isSlotChildren ? normalizeSuspenseSlot(children.fallback) : createVNode(Comment);
1474
+ function onActivated(hook, target) {
1475
+ registerKeepAliveHook(hook, "a", target);
1723
1476
  }
1724
- function normalizeSuspenseSlot(s) {
1725
- let block;
1726
- if (isFunction(s)) {
1727
- const trackBlock = isBlockTreeEnabled && s._c;
1728
- if (trackBlock) {
1729
- s._d = false;
1730
- openBlock();
1731
- }
1732
- s = s();
1733
- if (trackBlock) {
1734
- s._d = true;
1735
- block = currentBlock;
1736
- closeBlock();
1737
- }
1738
- }
1739
- if (isArray(s)) {
1740
- const singleChild = filterSingleRoot(s);
1741
- if (!!(process.env.NODE_ENV !== "production") && !singleChild && s.filter((child) => child !== NULL_DYNAMIC_COMPONENT).length > 0) {
1742
- warn$1(`<Suspense> slots expect a single root node.`);
1743
- }
1744
- s = singleChild;
1745
- }
1746
- s = normalizeVNode(s);
1747
- if (block && !s.dynamicChildren) {
1748
- s.dynamicChildren = block.filter((c) => c !== s);
1749
- }
1750
- return s;
1477
+ function onDeactivated(hook, target) {
1478
+ registerKeepAliveHook(hook, "da", target);
1751
1479
  }
1752
- function queueEffectWithSuspense(fn, suspense) {
1753
- if (suspense && suspense.pendingBranch) {
1754
- if (isArray(fn)) {
1755
- suspense.effects.push(...fn);
1756
- } else {
1757
- suspense.effects.push(fn);
1480
+ function registerKeepAliveHook(hook, type, target = currentInstance) {
1481
+ const wrappedHook = hook.__wdc || (hook.__wdc = () => {
1482
+ let current = target;
1483
+ while (current) {
1484
+ if (current.isDeactivated) {
1485
+ return;
1486
+ }
1487
+ current = current.parent;
1488
+ }
1489
+ return hook();
1490
+ });
1491
+ injectHook(type, wrappedHook, target);
1492
+ if (target) {
1493
+ let current = target.parent;
1494
+ while (current && current.parent) {
1495
+ if (isKeepAlive(current.parent.vnode)) {
1496
+ injectToKeepAliveRoot(wrappedHook, type, target, current);
1497
+ }
1498
+ current = current.parent;
1758
1499
  }
1759
- } else {
1760
- queuePostFlushCb(fn);
1761
1500
  }
1762
1501
  }
1763
- function setActiveBranch(suspense, branch) {
1764
- suspense.activeBranch = branch;
1765
- const { vnode, parentComponent } = suspense;
1766
- let el = branch.el;
1767
- while (!el && branch.component) {
1768
- branch = branch.component.subTree;
1769
- el = branch.el;
1770
- }
1771
- vnode.el = el;
1772
- if (parentComponent && parentComponent.subTree === vnode) {
1773
- parentComponent.vnode.el = el;
1774
- updateHOCHostEl(parentComponent, el);
1775
- }
1502
+ function injectToKeepAliveRoot(hook, type, target, keepAliveRoot) {
1503
+ const injected = injectHook(
1504
+ type,
1505
+ hook,
1506
+ keepAliveRoot,
1507
+ true
1508
+ /* prepend */
1509
+ );
1510
+ onUnmounted(() => {
1511
+ remove(keepAliveRoot[type], injected);
1512
+ }, target);
1776
1513
  }
1777
- function isVNodeSuspensible(vnode) {
1778
- const suspensible = vnode.props && vnode.props.suspensible;
1779
- return suspensible != null && suspensible !== false;
1514
+ function resetShapeFlag(vnode) {
1515
+ vnode.shapeFlag &= ~256;
1516
+ vnode.shapeFlag &= ~512;
1517
+ }
1518
+ function getInnerChild(vnode) {
1519
+ return vnode.shapeFlag & 128 ? vnode.ssContent : vnode;
1780
1520
  }
1781
1521
 
1782
1522
  function injectHook(type, hook, target = currentInstance, prepend = false) {
@@ -1825,63 +1565,59 @@ function onErrorCaptured(hook, target = currentInstance) {
1825
1565
  injectHook("ec", hook, target);
1826
1566
  }
1827
1567
 
1828
- function validateDirectiveName(name) {
1829
- if (isBuiltInDirective(name)) {
1830
- warn$1("Do not use built-in directive ids as custom directive id: " + name);
1831
- }
1568
+ const COMPONENTS = "components";
1569
+ const DIRECTIVES = "directives";
1570
+ function resolveComponent(name, maybeSelfReference) {
1571
+ return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;
1832
1572
  }
1833
- function withDirectives(vnode, directives) {
1834
- if (currentRenderingInstance === null) {
1835
- !!(process.env.NODE_ENV !== "production") && warn$1(`withDirectives can only be used inside render functions.`);
1836
- return vnode;
1573
+ const NULL_DYNAMIC_COMPONENT = Symbol.for("v-ndc");
1574
+ function resolveDynamicComponent(component) {
1575
+ if (isString(component)) {
1576
+ return resolveAsset(COMPONENTS, component, false) || component;
1577
+ } else {
1578
+ return component || NULL_DYNAMIC_COMPONENT;
1837
1579
  }
1838
- const instance = getComponentPublicInstance(currentRenderingInstance);
1839
- const bindings = vnode.dirs || (vnode.dirs = []);
1840
- for (let i = 0; i < directives.length; i++) {
1841
- let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i];
1842
- if (dir) {
1843
- if (isFunction(dir)) {
1844
- dir = {
1845
- mounted: dir,
1846
- updated: dir
1847
- };
1848
- }
1849
- if (dir.deep) {
1850
- traverse(value);
1580
+ }
1581
+ function resolveDirective(name) {
1582
+ return resolveAsset(DIRECTIVES, name);
1583
+ }
1584
+ function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false) {
1585
+ const instance = currentRenderingInstance || currentInstance;
1586
+ if (instance) {
1587
+ const Component = instance.type;
1588
+ if (type === COMPONENTS) {
1589
+ const selfName = getComponentName(
1590
+ Component,
1591
+ false
1592
+ );
1593
+ if (selfName && (selfName === name || selfName === camelize(name) || selfName === capitalize(camelize(name)))) {
1594
+ return Component;
1851
1595
  }
1852
- bindings.push({
1853
- dir,
1854
- instance,
1855
- value,
1856
- oldValue: void 0,
1857
- arg,
1858
- modifiers
1859
- });
1860
1596
  }
1861
- }
1862
- return vnode;
1863
- }
1864
- function invokeDirectiveHook(vnode, prevVNode, instance, name) {
1865
- const bindings = vnode.dirs;
1866
- const oldBindings = prevVNode && prevVNode.dirs;
1867
- for (let i = 0; i < bindings.length; i++) {
1868
- const binding = bindings[i];
1869
- if (oldBindings) {
1870
- binding.oldValue = oldBindings[i].value;
1597
+ const res = (
1598
+ // local registration
1599
+ // check instance[type] first which is resolved for options API
1600
+ resolve(instance[type] || Component[type], name) || // global registration
1601
+ resolve(instance.appContext[type], name)
1602
+ );
1603
+ if (!res && maybeSelfReference) {
1604
+ return Component;
1871
1605
  }
1872
- let hook = binding.dir[name];
1873
- if (hook) {
1874
- pauseTracking();
1875
- callWithAsyncErrorHandling(hook, instance, 8, [
1876
- vnode.el,
1877
- binding,
1878
- vnode,
1879
- prevVNode
1880
- ]);
1881
- resetTracking();
1606
+ if (!!(process.env.NODE_ENV !== "production") && warnMissing && !res) {
1607
+ const extra = type === COMPONENTS ? `
1608
+ If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.` : ``;
1609
+ warn$1(`Failed to resolve ${type.slice(0, -1)}: ${name}${extra}`);
1882
1610
  }
1611
+ return res;
1612
+ } else if (!!(process.env.NODE_ENV !== "production")) {
1613
+ warn$1(
1614
+ `resolve${capitalize(type.slice(0, -1))} can only be used in render() or setup().`
1615
+ );
1883
1616
  }
1884
1617
  }
1618
+ function resolve(registry, name) {
1619
+ return registry && (registry[name] || registry[camelize(name)] || registry[capitalize(camelize(name))]);
1620
+ }
1885
1621
 
1886
1622
  function renderList(source, renderItem, cache, index) {
1887
1623
  let ret;
@@ -1940,155 +1676,6 @@ function createSlots(slots, dynamicSlots) {
1940
1676
  return slots;
1941
1677
  }
1942
1678
 
1943
- /*! #__NO_SIDE_EFFECTS__ */
1944
- // @__NO_SIDE_EFFECTS__
1945
- function defineComponent(options, extraOptions) {
1946
- return isFunction(options) ? (
1947
- // #8326: extend call and options.name access are considered side-effects
1948
- // by Rollup, so we have to wrap it in a pure-annotated IIFE.
1949
- /* @__PURE__ */ (() => extend({ name: options.name }, extraOptions, { setup: options }))()
1950
- ) : options;
1951
- }
1952
-
1953
- const isAsyncWrapper = (i) => !!i.type.__asyncLoader;
1954
- /*! #__NO_SIDE_EFFECTS__ */
1955
- // @__NO_SIDE_EFFECTS__
1956
- function defineAsyncComponent(source) {
1957
- if (isFunction(source)) {
1958
- source = { loader: source };
1959
- }
1960
- const {
1961
- loader,
1962
- loadingComponent,
1963
- errorComponent,
1964
- delay = 200,
1965
- timeout,
1966
- // undefined = never times out
1967
- suspensible = true,
1968
- onError: userOnError
1969
- } = source;
1970
- let pendingRequest = null;
1971
- let resolvedComp;
1972
- let retries = 0;
1973
- const retry = () => {
1974
- retries++;
1975
- pendingRequest = null;
1976
- return load();
1977
- };
1978
- const load = () => {
1979
- let thisRequest;
1980
- return pendingRequest || (thisRequest = pendingRequest = loader().catch((err) => {
1981
- err = err instanceof Error ? err : new Error(String(err));
1982
- if (userOnError) {
1983
- return new Promise((resolve, reject) => {
1984
- const userRetry = () => resolve(retry());
1985
- const userFail = () => reject(err);
1986
- userOnError(err, userRetry, userFail, retries + 1);
1987
- });
1988
- } else {
1989
- throw err;
1990
- }
1991
- }).then((comp) => {
1992
- if (thisRequest !== pendingRequest && pendingRequest) {
1993
- return pendingRequest;
1994
- }
1995
- if (!!(process.env.NODE_ENV !== "production") && !comp) {
1996
- warn$1(
1997
- `Async component loader resolved to undefined. If you are using retry(), make sure to return its return value.`
1998
- );
1999
- }
2000
- if (comp && (comp.__esModule || comp[Symbol.toStringTag] === "Module")) {
2001
- comp = comp.default;
2002
- }
2003
- if (!!(process.env.NODE_ENV !== "production") && comp && !isObject(comp) && !isFunction(comp)) {
2004
- throw new Error(`Invalid async component load result: ${comp}`);
2005
- }
2006
- resolvedComp = comp;
2007
- return comp;
2008
- }));
2009
- };
2010
- return defineComponent({
2011
- name: "AsyncComponentWrapper",
2012
- __asyncLoader: load,
2013
- get __asyncResolved() {
2014
- return resolvedComp;
2015
- },
2016
- setup() {
2017
- const instance = currentInstance;
2018
- if (resolvedComp) {
2019
- return () => createInnerComp(resolvedComp, instance);
2020
- }
2021
- const onError = (err) => {
2022
- pendingRequest = null;
2023
- handleError(
2024
- err,
2025
- instance,
2026
- 13,
2027
- !errorComponent
2028
- );
2029
- };
2030
- if (suspensible && instance.suspense || isInSSRComponentSetup) {
2031
- return load().then((comp) => {
2032
- return () => createInnerComp(comp, instance);
2033
- }).catch((err) => {
2034
- onError(err);
2035
- return () => errorComponent ? createVNode(errorComponent, {
2036
- error: err
2037
- }) : null;
2038
- });
2039
- }
2040
- const loaded = ref(false);
2041
- const error = ref();
2042
- const delayed = ref(!!delay);
2043
- if (delay) {
2044
- setTimeout(() => {
2045
- delayed.value = false;
2046
- }, delay);
2047
- }
2048
- if (timeout != null) {
2049
- setTimeout(() => {
2050
- if (!loaded.value && !error.value) {
2051
- const err = new Error(
2052
- `Async component timed out after ${timeout}ms.`
2053
- );
2054
- onError(err);
2055
- error.value = err;
2056
- }
2057
- }, timeout);
2058
- }
2059
- load().then(() => {
2060
- loaded.value = true;
2061
- if (instance.parent && isKeepAlive(instance.parent.vnode)) {
2062
- instance.parent.effect.dirty = true;
2063
- queueJob(instance.parent.update);
2064
- }
2065
- }).catch((err) => {
2066
- onError(err);
2067
- error.value = err;
2068
- });
2069
- return () => {
2070
- if (loaded.value && resolvedComp) {
2071
- return createInnerComp(resolvedComp, instance);
2072
- } else if (error.value && errorComponent) {
2073
- return createVNode(errorComponent, {
2074
- error: error.value
2075
- });
2076
- } else if (loadingComponent && !delayed.value) {
2077
- return createVNode(loadingComponent);
2078
- }
2079
- };
2080
- }
2081
- });
2082
- }
2083
- function createInnerComp(comp, parent) {
2084
- const { ref: ref2, props, children, ce } = parent.vnode;
2085
- const vnode = createVNode(comp, props, children);
2086
- vnode.ref = ref2;
2087
- vnode.ce = ce;
2088
- delete parent.vnode.ce;
2089
- return vnode;
2090
- }
2091
-
2092
1679
  function renderSlot(slots, name, props = {}, fallback, noSlotted) {
2093
1680
  if (currentRenderingInstance.isCE || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.isCE) {
2094
1681
  if (name !== "default") props.name = name;
@@ -2109,9 +1696,10 @@ function renderSlot(slots, name, props = {}, fallback, noSlotted) {
2109
1696
  const rendered = createBlock(
2110
1697
  Fragment,
2111
1698
  {
2112
- key: props.key || // slot content array of a dynamic conditional slot may have a branch
1699
+ key: (props.key || // slot content array of a dynamic conditional slot may have a branch
2113
1700
  // key attached in the `createSlots` helper, respect that
2114
- validSlotContent && validSlotContent.key || `_${name}`
1701
+ validSlotContent && validSlotContent.key || `_${name}`) + // #7256 force differentiate fallback content from actual content
1702
+ (!validSlotContent && fallback ? "_fb" : "")
2115
1703
  },
2116
1704
  validSlotContent || (fallback ? fallback() : []),
2117
1705
  validSlotContent && slots._ === 1 ? 64 : -2
@@ -3345,8 +2933,9 @@ function resolvePropValue(options, props, key, value, instance, isAbsent) {
3345
2933
  }
3346
2934
  return value;
3347
2935
  }
2936
+ const mixinPropsCache = /* @__PURE__ */ new WeakMap();
3348
2937
  function normalizePropsOptions(comp, appContext, asMixin = false) {
3349
- const cache = appContext.propsCache;
2938
+ const cache = __VUE_OPTIONS_API__ && asMixin ? mixinPropsCache : appContext.propsCache;
3350
2939
  const cached = cache.get(comp);
3351
2940
  if (cached) {
3352
2941
  return cached;
@@ -3593,13 +3182,22 @@ const normalizeVNodeSlots = (instance, children) => {
3593
3182
  const normalized = normalizeSlotValue(children);
3594
3183
  instance.slots.default = () => normalized;
3595
3184
  };
3596
- const initSlots = (instance, children) => {
3185
+ const assignSlots = (slots, children, optimized) => {
3186
+ for (const key in children) {
3187
+ if (optimized || key !== "_") {
3188
+ slots[key] = children[key];
3189
+ }
3190
+ }
3191
+ };
3192
+ const initSlots = (instance, children, optimized) => {
3597
3193
  const slots = instance.slots = createInternalObject();
3598
3194
  if (instance.vnode.shapeFlag & 32) {
3599
3195
  const type = children._;
3600
3196
  if (type) {
3601
- extend(slots, children);
3602
- def(slots, "_", type, true);
3197
+ assignSlots(slots, children, optimized);
3198
+ if (optimized) {
3199
+ def(slots, "_", type, true);
3200
+ }
3603
3201
  } else {
3604
3202
  normalizeObjectSlots(children, slots);
3605
3203
  }
@@ -3615,15 +3213,12 @@ const updateSlots = (instance, children, optimized) => {
3615
3213
  const type = children._;
3616
3214
  if (type) {
3617
3215
  if (!!(process.env.NODE_ENV !== "production") && isHmrUpdating) {
3618
- extend(slots, children);
3216
+ assignSlots(slots, children, optimized);
3619
3217
  trigger(instance, "set", "$slots");
3620
3218
  } else if (optimized && type === 1) {
3621
3219
  needDeletionCheck = false;
3622
3220
  } else {
3623
- extend(slots, children);
3624
- if (!optimized && type === 1) {
3625
- delete slots._;
3626
- }
3221
+ assignSlots(slots, children, optimized);
3627
3222
  }
3628
3223
  } else {
3629
3224
  needDeletionCheck = !children.$stable;
@@ -3712,22 +3307,309 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
3712
3307
  if (hasOwn(setupState, ref)) {
3713
3308
  setupState[ref] = value;
3714
3309
  }
3715
- } else if (_isRef) {
3716
- ref.value = value;
3717
- if (rawRef.k) refs[rawRef.k] = value;
3718
- } else if (!!(process.env.NODE_ENV !== "production")) {
3719
- warn$1("Invalid template ref type:", ref, `(${typeof ref})`);
3310
+ } else if (_isRef) {
3311
+ ref.value = value;
3312
+ if (rawRef.k) refs[rawRef.k] = value;
3313
+ } else if (!!(process.env.NODE_ENV !== "production")) {
3314
+ warn$1("Invalid template ref type:", ref, `(${typeof ref})`);
3315
+ }
3316
+ };
3317
+ if (value) {
3318
+ doSet.id = -1;
3319
+ queuePostRenderEffect(doSet, parentSuspense);
3320
+ } else {
3321
+ doSet();
3322
+ }
3323
+ } else if (!!(process.env.NODE_ENV !== "production")) {
3324
+ warn$1("Invalid template ref type:", ref, `(${typeof ref})`);
3325
+ }
3326
+ }
3327
+ }
3328
+
3329
+ const TeleportEndKey = Symbol("_vte");
3330
+ const isTeleport = (type) => type.__isTeleport;
3331
+ const isTeleportDisabled = (props) => props && (props.disabled || props.disabled === "");
3332
+ const isTargetSVG = (target) => typeof SVGElement !== "undefined" && target instanceof SVGElement;
3333
+ const isTargetMathML = (target) => typeof MathMLElement === "function" && target instanceof MathMLElement;
3334
+ const resolveTarget = (props, select) => {
3335
+ const targetSelector = props && props.to;
3336
+ if (isString(targetSelector)) {
3337
+ if (!select) {
3338
+ !!(process.env.NODE_ENV !== "production") && warn$1(
3339
+ `Current renderer does not support string target for Teleports. (missing querySelector renderer option)`
3340
+ );
3341
+ return null;
3342
+ } else {
3343
+ const target = select(targetSelector);
3344
+ if (!!(process.env.NODE_ENV !== "production") && !target && !isTeleportDisabled(props)) {
3345
+ warn$1(
3346
+ `Failed to locate Teleport target with selector "${targetSelector}". Note the target element must exist before the component is mounted - i.e. the target cannot be rendered by the component itself, and ideally should be outside of the entire Vue component tree.`
3347
+ );
3348
+ }
3349
+ return target;
3350
+ }
3351
+ } else {
3352
+ if (!!(process.env.NODE_ENV !== "production") && !targetSelector && !isTeleportDisabled(props)) {
3353
+ warn$1(`Invalid Teleport target: ${targetSelector}`);
3354
+ }
3355
+ return targetSelector;
3356
+ }
3357
+ };
3358
+ const TeleportImpl = {
3359
+ name: "Teleport",
3360
+ __isTeleport: true,
3361
+ process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, internals) {
3362
+ const {
3363
+ mc: mountChildren,
3364
+ pc: patchChildren,
3365
+ pbc: patchBlockChildren,
3366
+ o: { insert, querySelector, createText, createComment }
3367
+ } = internals;
3368
+ const disabled = isTeleportDisabled(n2.props);
3369
+ let { shapeFlag, children, dynamicChildren } = n2;
3370
+ if (!!(process.env.NODE_ENV !== "production") && isHmrUpdating) {
3371
+ optimized = false;
3372
+ dynamicChildren = null;
3373
+ }
3374
+ if (n1 == null) {
3375
+ const placeholder = n2.el = !!(process.env.NODE_ENV !== "production") ? createComment("teleport start") : createText("");
3376
+ const mainAnchor = n2.anchor = !!(process.env.NODE_ENV !== "production") ? createComment("teleport end") : createText("");
3377
+ const target = n2.target = resolveTarget(n2.props, querySelector);
3378
+ const targetStart = n2.targetStart = createText("");
3379
+ const targetAnchor = n2.targetAnchor = createText("");
3380
+ insert(placeholder, container, anchor);
3381
+ insert(mainAnchor, container, anchor);
3382
+ targetStart[TeleportEndKey] = targetAnchor;
3383
+ if (target) {
3384
+ insert(targetStart, target);
3385
+ insert(targetAnchor, target);
3386
+ if (namespace === "svg" || isTargetSVG(target)) {
3387
+ namespace = "svg";
3388
+ } else if (namespace === "mathml" || isTargetMathML(target)) {
3389
+ namespace = "mathml";
3390
+ }
3391
+ } else if (!!(process.env.NODE_ENV !== "production") && !disabled) {
3392
+ warn$1("Invalid Teleport target on mount:", target, `(${typeof target})`);
3393
+ }
3394
+ const mount = (container2, anchor2) => {
3395
+ if (shapeFlag & 16) {
3396
+ mountChildren(
3397
+ children,
3398
+ container2,
3399
+ anchor2,
3400
+ parentComponent,
3401
+ parentSuspense,
3402
+ namespace,
3403
+ slotScopeIds,
3404
+ optimized
3405
+ );
3406
+ }
3407
+ };
3408
+ if (disabled) {
3409
+ mount(container, mainAnchor);
3410
+ } else if (target) {
3411
+ mount(target, targetAnchor);
3412
+ }
3413
+ } else {
3414
+ n2.el = n1.el;
3415
+ n2.targetStart = n1.targetStart;
3416
+ const mainAnchor = n2.anchor = n1.anchor;
3417
+ const target = n2.target = n1.target;
3418
+ const targetAnchor = n2.targetAnchor = n1.targetAnchor;
3419
+ const wasDisabled = isTeleportDisabled(n1.props);
3420
+ const currentContainer = wasDisabled ? container : target;
3421
+ const currentAnchor = wasDisabled ? mainAnchor : targetAnchor;
3422
+ if (namespace === "svg" || isTargetSVG(target)) {
3423
+ namespace = "svg";
3424
+ } else if (namespace === "mathml" || isTargetMathML(target)) {
3425
+ namespace = "mathml";
3426
+ }
3427
+ if (dynamicChildren) {
3428
+ patchBlockChildren(
3429
+ n1.dynamicChildren,
3430
+ dynamicChildren,
3431
+ currentContainer,
3432
+ parentComponent,
3433
+ parentSuspense,
3434
+ namespace,
3435
+ slotScopeIds
3436
+ );
3437
+ traverseStaticChildren(n1, n2, true);
3438
+ } else if (!optimized) {
3439
+ patchChildren(
3440
+ n1,
3441
+ n2,
3442
+ currentContainer,
3443
+ currentAnchor,
3444
+ parentComponent,
3445
+ parentSuspense,
3446
+ namespace,
3447
+ slotScopeIds,
3448
+ false
3449
+ );
3450
+ }
3451
+ if (disabled) {
3452
+ if (!wasDisabled) {
3453
+ moveTeleport(
3454
+ n2,
3455
+ container,
3456
+ mainAnchor,
3457
+ internals,
3458
+ 1
3459
+ );
3460
+ } else {
3461
+ if (n2.props && n1.props && n2.props.to !== n1.props.to) {
3462
+ n2.props.to = n1.props.to;
3463
+ }
3464
+ }
3465
+ } else {
3466
+ if ((n2.props && n2.props.to) !== (n1.props && n1.props.to)) {
3467
+ const nextTarget = n2.target = resolveTarget(
3468
+ n2.props,
3469
+ querySelector
3470
+ );
3471
+ if (nextTarget) {
3472
+ moveTeleport(
3473
+ n2,
3474
+ nextTarget,
3475
+ null,
3476
+ internals,
3477
+ 0
3478
+ );
3479
+ } else if (!!(process.env.NODE_ENV !== "production")) {
3480
+ warn$1(
3481
+ "Invalid Teleport target on update:",
3482
+ target,
3483
+ `(${typeof target})`
3484
+ );
3485
+ }
3486
+ } else if (wasDisabled) {
3487
+ moveTeleport(
3488
+ n2,
3489
+ target,
3490
+ targetAnchor,
3491
+ internals,
3492
+ 1
3493
+ );
3494
+ }
3495
+ }
3496
+ }
3497
+ updateCssVars(n2);
3498
+ },
3499
+ remove(vnode, parentComponent, parentSuspense, { um: unmount, o: { remove: hostRemove } }, doRemove) {
3500
+ const {
3501
+ shapeFlag,
3502
+ children,
3503
+ anchor,
3504
+ targetStart,
3505
+ targetAnchor,
3506
+ target,
3507
+ props
3508
+ } = vnode;
3509
+ if (target) {
3510
+ hostRemove(targetStart);
3511
+ hostRemove(targetAnchor);
3512
+ }
3513
+ doRemove && hostRemove(anchor);
3514
+ if (shapeFlag & 16) {
3515
+ const shouldRemove = doRemove || !isTeleportDisabled(props);
3516
+ for (let i = 0; i < children.length; i++) {
3517
+ const child = children[i];
3518
+ unmount(
3519
+ child,
3520
+ parentComponent,
3521
+ parentSuspense,
3522
+ shouldRemove,
3523
+ !!child.dynamicChildren
3524
+ );
3525
+ }
3526
+ }
3527
+ },
3528
+ move: moveTeleport,
3529
+ hydrate: hydrateTeleport
3530
+ };
3531
+ function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }, moveType = 2) {
3532
+ if (moveType === 0) {
3533
+ insert(vnode.targetAnchor, container, parentAnchor);
3534
+ }
3535
+ const { el, anchor, shapeFlag, children, props } = vnode;
3536
+ const isReorder = moveType === 2;
3537
+ if (isReorder) {
3538
+ insert(el, container, parentAnchor);
3539
+ }
3540
+ if (!isReorder || isTeleportDisabled(props)) {
3541
+ if (shapeFlag & 16) {
3542
+ for (let i = 0; i < children.length; i++) {
3543
+ move(
3544
+ children[i],
3545
+ container,
3546
+ parentAnchor,
3547
+ 2
3548
+ );
3549
+ }
3550
+ }
3551
+ }
3552
+ if (isReorder) {
3553
+ insert(anchor, container, parentAnchor);
3554
+ }
3555
+ }
3556
+ function hydrateTeleport(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized, {
3557
+ o: { nextSibling, parentNode, querySelector }
3558
+ }, hydrateChildren) {
3559
+ const target = vnode.target = resolveTarget(
3560
+ vnode.props,
3561
+ querySelector
3562
+ );
3563
+ if (target) {
3564
+ const targetNode = target._lpa || target.firstChild;
3565
+ if (vnode.shapeFlag & 16) {
3566
+ if (isTeleportDisabled(vnode.props)) {
3567
+ vnode.anchor = hydrateChildren(
3568
+ nextSibling(node),
3569
+ vnode,
3570
+ parentNode(node),
3571
+ parentComponent,
3572
+ parentSuspense,
3573
+ slotScopeIds,
3574
+ optimized
3575
+ );
3576
+ vnode.targetAnchor = targetNode;
3577
+ } else {
3578
+ vnode.anchor = nextSibling(node);
3579
+ let targetAnchor = targetNode;
3580
+ while (targetAnchor) {
3581
+ targetAnchor = nextSibling(targetAnchor);
3582
+ if (targetAnchor && targetAnchor.nodeType === 8 && targetAnchor.data === "teleport anchor") {
3583
+ vnode.targetAnchor = targetAnchor;
3584
+ target._lpa = vnode.targetAnchor && nextSibling(vnode.targetAnchor);
3585
+ break;
3586
+ }
3720
3587
  }
3721
- };
3722
- if (value) {
3723
- doSet.id = -1;
3724
- queuePostRenderEffect(doSet, parentSuspense);
3725
- } else {
3726
- doSet();
3588
+ hydrateChildren(
3589
+ targetNode,
3590
+ vnode,
3591
+ target,
3592
+ parentComponent,
3593
+ parentSuspense,
3594
+ slotScopeIds,
3595
+ optimized
3596
+ );
3727
3597
  }
3728
- } else if (!!(process.env.NODE_ENV !== "production")) {
3729
- warn$1("Invalid template ref type:", ref, `(${typeof ref})`);
3730
3598
  }
3599
+ updateCssVars(vnode);
3600
+ }
3601
+ return vnode.anchor && nextSibling(vnode.anchor);
3602
+ }
3603
+ const Teleport = TeleportImpl;
3604
+ function updateCssVars(vnode) {
3605
+ const ctx = vnode.ctx;
3606
+ if (ctx && ctx.ut) {
3607
+ let node = vnode.children[0].el;
3608
+ while (node && node !== vnode.targetAnchor) {
3609
+ if (node.nodeType === 1) node.setAttribute("data-v-owner", ctx.uid);
3610
+ node = node.nextSibling;
3611
+ }
3612
+ ctx.ut();
3731
3613
  }
3732
3614
  }
3733
3615
 
@@ -4021,15 +3903,7 @@ Server rendered element contains more child nodes than client vdom.`
4021
3903
  }
4022
3904
  if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || // force hydrate v-bind with .prop modifiers
4023
3905
  key[0] === ".") {
4024
- patchProp(
4025
- el,
4026
- key,
4027
- null,
4028
- props[key],
4029
- void 0,
4030
- void 0,
4031
- parentComponent
4032
- );
3906
+ patchProp(el, key, null, props[key], void 0, parentComponent);
4033
3907
  }
4034
3908
  }
4035
3909
  } else if (props.onClick) {
@@ -4039,9 +3913,10 @@ Server rendered element contains more child nodes than client vdom.`
4039
3913
  null,
4040
3914
  props.onClick,
4041
3915
  void 0,
4042
- void 0,
4043
3916
  parentComponent
4044
3917
  );
3918
+ } else if (patchFlag & 4 && isReactive(props.style)) {
3919
+ for (const key in props.style) props.style[key];
4045
3920
  }
4046
3921
  }
4047
3922
  let vnodeHooks;
@@ -4068,7 +3943,21 @@ Server rendered element contains more child nodes than client vdom.`
4068
3943
  let hasWarned = false;
4069
3944
  for (let i = 0; i < l; i++) {
4070
3945
  const vnode = optimized ? children[i] : children[i] = normalizeVNode(children[i]);
3946
+ const isText = vnode.type === Text;
4071
3947
  if (node) {
3948
+ if (isText && !optimized) {
3949
+ let next = children[i + 1];
3950
+ if (next && (next = normalizeVNode(next)).type === Text) {
3951
+ insert(
3952
+ createText(
3953
+ node.data.slice(vnode.children.length)
3954
+ ),
3955
+ container,
3956
+ nextSibling(node)
3957
+ );
3958
+ node.data = vnode.children;
3959
+ }
3960
+ }
4072
3961
  node = hydrateNode(
4073
3962
  node,
4074
3963
  vnode,
@@ -4077,7 +3966,7 @@ Server rendered element contains more child nodes than client vdom.`
4077
3966
  slotScopeIds,
4078
3967
  optimized
4079
3968
  );
4080
- } else if (vnode.type === Text && !vnode.children) {
3969
+ } else if (isText && !vnode.children) {
4081
3970
  insert(vnode.el = createText(""), container);
4082
3971
  } else {
4083
3972
  if ((!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) && !hasWarned) {
@@ -4638,17 +4527,7 @@ function baseCreateRenderer(options, createHydrationFns) {
4638
4527
  if (props) {
4639
4528
  for (const key in props) {
4640
4529
  if (key !== "value" && !isReservedProp(key)) {
4641
- hostPatchProp(
4642
- el,
4643
- key,
4644
- null,
4645
- props[key],
4646
- namespace,
4647
- vnode.children,
4648
- parentComponent,
4649
- parentSuspense,
4650
- unmountChildren
4651
- );
4530
+ hostPatchProp(el, key, null, props[key], namespace, parentComponent);
4652
4531
  }
4653
4532
  }
4654
4533
  if ("value" in props) {
@@ -4743,6 +4622,9 @@ function baseCreateRenderer(options, createHydrationFns) {
4743
4622
  optimized = false;
4744
4623
  dynamicChildren = null;
4745
4624
  }
4625
+ if (oldProps.innerHTML && newProps.innerHTML == null || oldProps.textContent && newProps.textContent == null) {
4626
+ hostSetElementText(el, "");
4627
+ }
4746
4628
  if (dynamicChildren) {
4747
4629
  patchBlockChildren(
4748
4630
  n1.dynamicChildren,
@@ -4771,15 +4653,7 @@ function baseCreateRenderer(options, createHydrationFns) {
4771
4653
  }
4772
4654
  if (patchFlag > 0) {
4773
4655
  if (patchFlag & 16) {
4774
- patchProps(
4775
- el,
4776
- n2,
4777
- oldProps,
4778
- newProps,
4779
- parentComponent,
4780
- parentSuspense,
4781
- namespace
4782
- );
4656
+ patchProps(el, oldProps, newProps, parentComponent, namespace);
4783
4657
  } else {
4784
4658
  if (patchFlag & 2) {
4785
4659
  if (oldProps.class !== newProps.class) {
@@ -4796,17 +4670,7 @@ function baseCreateRenderer(options, createHydrationFns) {
4796
4670
  const prev = oldProps[key];
4797
4671
  const next = newProps[key];
4798
4672
  if (next !== prev || key === "value") {
4799
- hostPatchProp(
4800
- el,
4801
- key,
4802
- prev,
4803
- next,
4804
- namespace,
4805
- n1.children,
4806
- parentComponent,
4807
- parentSuspense,
4808
- unmountChildren
4809
- );
4673
+ hostPatchProp(el, key, prev, next, namespace, parentComponent);
4810
4674
  }
4811
4675
  }
4812
4676
  }
@@ -4817,15 +4681,7 @@ function baseCreateRenderer(options, createHydrationFns) {
4817
4681
  }
4818
4682
  }
4819
4683
  } else if (!optimized && dynamicChildren == null) {
4820
- patchProps(
4821
- el,
4822
- n2,
4823
- oldProps,
4824
- newProps,
4825
- parentComponent,
4826
- parentSuspense,
4827
- namespace
4828
- );
4684
+ patchProps(el, oldProps, newProps, parentComponent, namespace);
4829
4685
  }
4830
4686
  if ((vnodeHook = newProps.onVnodeUpdated) || dirs) {
4831
4687
  queuePostRenderEffect(() => {
@@ -4865,7 +4721,7 @@ function baseCreateRenderer(options, createHydrationFns) {
4865
4721
  );
4866
4722
  }
4867
4723
  };
4868
- const patchProps = (el, vnode, oldProps, newProps, parentComponent, parentSuspense, namespace) => {
4724
+ const patchProps = (el, oldProps, newProps, parentComponent, namespace) => {
4869
4725
  if (oldProps !== newProps) {
4870
4726
  if (oldProps !== EMPTY_OBJ) {
4871
4727
  for (const key in oldProps) {
@@ -4876,10 +4732,7 @@ function baseCreateRenderer(options, createHydrationFns) {
4876
4732
  oldProps[key],
4877
4733
  null,
4878
4734
  namespace,
4879
- vnode.children,
4880
- parentComponent,
4881
- parentSuspense,
4882
- unmountChildren
4735
+ parentComponent
4883
4736
  );
4884
4737
  }
4885
4738
  }
@@ -4889,17 +4742,7 @@ function baseCreateRenderer(options, createHydrationFns) {
4889
4742
  const next = newProps[key];
4890
4743
  const prev = oldProps[key];
4891
4744
  if (next !== prev && key !== "value") {
4892
- hostPatchProp(
4893
- el,
4894
- key,
4895
- prev,
4896
- next,
4897
- namespace,
4898
- vnode.children,
4899
- parentComponent,
4900
- parentSuspense,
4901
- unmountChildren
4902
- );
4745
+ hostPatchProp(el, key, prev, next, namespace, parentComponent);
4903
4746
  }
4904
4747
  }
4905
4748
  if ("value" in newProps) {
@@ -5027,7 +4870,7 @@ function baseCreateRenderer(options, createHydrationFns) {
5027
4870
  if (!!(process.env.NODE_ENV !== "production")) {
5028
4871
  startMeasure(instance, `init`);
5029
4872
  }
5030
- setupComponent(instance);
4873
+ setupComponent(instance, false, optimized);
5031
4874
  if (!!(process.env.NODE_ENV !== "production")) {
5032
4875
  endMeasure(instance, `init`);
5033
4876
  }
@@ -5264,12 +5107,12 @@ function baseCreateRenderer(options, createHydrationFns) {
5264
5107
  effect.run();
5265
5108
  }
5266
5109
  };
5110
+ update.i = instance;
5267
5111
  update.id = instance.uid;
5268
5112
  toggleRecurse(instance, true);
5269
5113
  if (!!(process.env.NODE_ENV !== "production")) {
5270
5114
  effect.onTrack = instance.rtc ? (e) => invokeArrayFns(instance.rtc, e) : void 0;
5271
5115
  effect.onTrigger = instance.rtg ? (e) => invokeArrayFns(instance.rtg, e) : void 0;
5272
- update.ownerInstance = instance;
5273
5116
  }
5274
5117
  update();
5275
5118
  };
@@ -5628,7 +5471,7 @@ function baseCreateRenderer(options, createHydrationFns) {
5628
5471
  shapeFlag,
5629
5472
  patchFlag,
5630
5473
  dirs,
5631
- memoIndex
5474
+ cacheIndex
5632
5475
  } = vnode;
5633
5476
  if (patchFlag === -2) {
5634
5477
  optimized = false;
@@ -5636,8 +5479,8 @@ function baseCreateRenderer(options, createHydrationFns) {
5636
5479
  if (ref != null) {
5637
5480
  setRef(ref, null, parentSuspense, vnode, true);
5638
5481
  }
5639
- if (memoIndex != null) {
5640
- parentComponent.renderCache[memoIndex] = void 0;
5482
+ if (cacheIndex != null) {
5483
+ parentComponent.renderCache[cacheIndex] = void 0;
5641
5484
  }
5642
5485
  if (shapeFlag & 256) {
5643
5486
  parentComponent.ctx.deactivate(vnode);
@@ -5667,7 +5510,12 @@ function baseCreateRenderer(options, createHydrationFns) {
5667
5510
  internals,
5668
5511
  doRemove
5669
5512
  );
5670
- } else if (dynamicChildren && // #1153: fast path should not be taken for non-stable (v-for) fragments
5513
+ } else if (dynamicChildren && // #5154
5514
+ // when v-once is used inside a block, setBlockTracking(-1) marks the
5515
+ // parent block with hasOnce: true
5516
+ // so that it doesn't take the fast path during unmount - otherwise
5517
+ // components nested in v-once are never unmounted.
5518
+ !dynamicChildren.hasOnce && // #1153: fast path should not be taken for non-stable (v-for) fragments
5671
5519
  (type !== Fragment || patchFlag > 0 && patchFlag & 64)) {
5672
5520
  unmountChildren(
5673
5521
  dynamicChildren,
@@ -5780,7 +5628,9 @@ function baseCreateRenderer(options, createHydrationFns) {
5780
5628
  if (vnode.shapeFlag & 128) {
5781
5629
  return vnode.suspense.next();
5782
5630
  }
5783
- return hostNextSibling(vnode.anchor || vnode.el);
5631
+ const el = hostNextSibling(vnode.anchor || vnode.el);
5632
+ const teleportEnd = el && el[TeleportEndKey];
5633
+ return teleportEnd ? hostNextSibling(teleportEnd) : el;
5784
5634
  };
5785
5635
  let isFlushing = false;
5786
5636
  const render = (vnode, container, namespace) => {
@@ -6125,954 +5975,1169 @@ function doWatch(source, cb, {
6125
5975
  }
6126
5976
  };
6127
5977
  if (!!(process.env.NODE_ENV !== "production")) {
6128
- effect.onTrack = onTrack;
6129
- effect.onTrigger = onTrigger;
5978
+ effect.onTrack = onTrack;
5979
+ effect.onTrigger = onTrigger;
5980
+ }
5981
+ if (cb) {
5982
+ if (immediate) {
5983
+ job();
5984
+ } else {
5985
+ oldValue = effect.run();
5986
+ }
5987
+ } else if (flush === "post") {
5988
+ queuePostRenderEffect(
5989
+ effect.run.bind(effect),
5990
+ instance && instance.suspense
5991
+ );
5992
+ } else {
5993
+ effect.run();
5994
+ }
5995
+ if (ssrCleanup) ssrCleanup.push(unwatch);
5996
+ return unwatch;
5997
+ }
5998
+ function instanceWatch(source, value, options) {
5999
+ const publicThis = this.proxy;
6000
+ const getter = isString(source) ? source.includes(".") ? createPathGetter(publicThis, source) : () => publicThis[source] : source.bind(publicThis, publicThis);
6001
+ let cb;
6002
+ if (isFunction(value)) {
6003
+ cb = value;
6004
+ } else {
6005
+ cb = value.handler;
6006
+ options = value;
6007
+ }
6008
+ const reset = setCurrentInstance(this);
6009
+ const res = doWatch(getter, cb.bind(publicThis), options);
6010
+ reset();
6011
+ return res;
6012
+ }
6013
+ function createPathGetter(ctx, path) {
6014
+ const segments = path.split(".");
6015
+ return () => {
6016
+ let cur = ctx;
6017
+ for (let i = 0; i < segments.length && cur; i++) {
6018
+ cur = cur[segments[i]];
6019
+ }
6020
+ return cur;
6021
+ };
6022
+ }
6023
+ function traverse(value, depth = Infinity, seen) {
6024
+ if (depth <= 0 || !isObject(value) || value["__v_skip"]) {
6025
+ return value;
6026
+ }
6027
+ seen = seen || /* @__PURE__ */ new Set();
6028
+ if (seen.has(value)) {
6029
+ return value;
6030
+ }
6031
+ seen.add(value);
6032
+ depth--;
6033
+ if (isRef(value)) {
6034
+ traverse(value.value, depth, seen);
6035
+ } else if (isArray(value)) {
6036
+ for (let i = 0; i < value.length; i++) {
6037
+ traverse(value[i], depth, seen);
6038
+ }
6039
+ } else if (isSet(value) || isMap(value)) {
6040
+ value.forEach((v) => {
6041
+ traverse(v, depth, seen);
6042
+ });
6043
+ } else if (isPlainObject(value)) {
6044
+ for (const key in value) {
6045
+ traverse(value[key], depth, seen);
6046
+ }
6047
+ for (const key of Object.getOwnPropertySymbols(value)) {
6048
+ if (Object.prototype.propertyIsEnumerable.call(value, key)) {
6049
+ traverse(value[key], depth, seen);
6050
+ }
6051
+ }
6052
+ }
6053
+ return value;
6054
+ }
6055
+
6056
+ function useModel(props, name, options = EMPTY_OBJ) {
6057
+ const i = getCurrentInstance();
6058
+ if (!!(process.env.NODE_ENV !== "production") && !i) {
6059
+ warn$1(`useModel() called without active instance.`);
6060
+ return ref();
6061
+ }
6062
+ if (!!(process.env.NODE_ENV !== "production") && !i.propsOptions[0][name]) {
6063
+ warn$1(`useModel() called with prop "${name}" which is not declared.`);
6064
+ return ref();
6065
+ }
6066
+ const camelizedName = camelize(name);
6067
+ const hyphenatedName = hyphenate(name);
6068
+ const modifiers = getModelModifiers(props, name);
6069
+ const res = customRef((track, trigger) => {
6070
+ let localValue;
6071
+ let prevSetValue;
6072
+ let prevEmittedValue;
6073
+ watchSyncEffect(() => {
6074
+ const propValue = props[name];
6075
+ if (hasChanged(localValue, propValue)) {
6076
+ localValue = propValue;
6077
+ trigger();
6078
+ }
6079
+ });
6080
+ return {
6081
+ get() {
6082
+ track();
6083
+ return options.get ? options.get(localValue) : localValue;
6084
+ },
6085
+ set(value) {
6086
+ if (!hasChanged(value, localValue)) {
6087
+ return;
6088
+ }
6089
+ const rawProps = i.vnode.props;
6090
+ if (!(rawProps && // check if parent has passed v-model
6091
+ (name in rawProps || camelizedName in rawProps || hyphenatedName in rawProps) && (`onUpdate:${name}` in rawProps || `onUpdate:${camelizedName}` in rawProps || `onUpdate:${hyphenatedName}` in rawProps))) {
6092
+ localValue = value;
6093
+ trigger();
6094
+ }
6095
+ const emittedValue = options.set ? options.set(value) : value;
6096
+ i.emit(`update:${name}`, emittedValue);
6097
+ if (value !== emittedValue && value !== prevSetValue && emittedValue === prevEmittedValue) {
6098
+ trigger();
6099
+ }
6100
+ prevSetValue = value;
6101
+ prevEmittedValue = emittedValue;
6102
+ }
6103
+ };
6104
+ });
6105
+ res[Symbol.iterator] = () => {
6106
+ let i2 = 0;
6107
+ return {
6108
+ next() {
6109
+ if (i2 < 2) {
6110
+ return { value: i2++ ? modifiers || EMPTY_OBJ : res, done: false };
6111
+ } else {
6112
+ return { done: true };
6113
+ }
6114
+ }
6115
+ };
6116
+ };
6117
+ return res;
6118
+ }
6119
+ const getModelModifiers = (props, modelName) => {
6120
+ return modelName === "modelValue" || modelName === "model-value" ? props.modelModifiers : props[`${modelName}Modifiers`] || props[`${camelize(modelName)}Modifiers`] || props[`${hyphenate(modelName)}Modifiers`];
6121
+ };
6122
+
6123
+ function emit(instance, event, ...rawArgs) {
6124
+ if (instance.isUnmounted) return;
6125
+ const props = instance.vnode.props || EMPTY_OBJ;
6126
+ if (!!(process.env.NODE_ENV !== "production")) {
6127
+ const {
6128
+ emitsOptions,
6129
+ propsOptions: [propsOptions]
6130
+ } = instance;
6131
+ if (emitsOptions) {
6132
+ if (!(event in emitsOptions) && true) {
6133
+ if (!propsOptions || !(toHandlerKey(event) in propsOptions)) {
6134
+ warn$1(
6135
+ `Component emitted event "${event}" but it is neither declared in the emits option nor as an "${toHandlerKey(event)}" prop.`
6136
+ );
6137
+ }
6138
+ } else {
6139
+ const validator = emitsOptions[event];
6140
+ if (isFunction(validator)) {
6141
+ const isValid = validator(...rawArgs);
6142
+ if (!isValid) {
6143
+ warn$1(
6144
+ `Invalid event arguments: event validation failed for event "${event}".`
6145
+ );
6146
+ }
6147
+ }
6148
+ }
6149
+ }
6150
+ }
6151
+ let args = rawArgs;
6152
+ const isModelListener = event.startsWith("update:");
6153
+ const modifiers = isModelListener && getModelModifiers(props, event.slice(7));
6154
+ if (modifiers) {
6155
+ if (modifiers.trim) {
6156
+ args = rawArgs.map((a) => isString(a) ? a.trim() : a);
6157
+ }
6158
+ if (modifiers.number) {
6159
+ args = rawArgs.map(looseToNumber);
6160
+ }
6161
+ }
6162
+ if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__) {
6163
+ devtoolsComponentEmit(instance, event, args);
6164
+ }
6165
+ if (!!(process.env.NODE_ENV !== "production")) {
6166
+ const lowerCaseEvent = event.toLowerCase();
6167
+ if (lowerCaseEvent !== event && props[toHandlerKey(lowerCaseEvent)]) {
6168
+ warn$1(
6169
+ `Event "${lowerCaseEvent}" is emitted in component ${formatComponentName(
6170
+ instance,
6171
+ instance.type
6172
+ )} but the handler is registered for "${event}". Note that HTML attributes are case-insensitive and you cannot use v-on to listen to camelCase events when using in-DOM templates. You should probably use "${hyphenate(
6173
+ event
6174
+ )}" instead of "${event}".`
6175
+ );
6176
+ }
6130
6177
  }
6131
- if (cb) {
6132
- if (immediate) {
6133
- job();
6134
- } else {
6135
- oldValue = effect.run();
6178
+ let handlerName;
6179
+ let handler = props[handlerName = toHandlerKey(event)] || // also try camelCase event handler (#2249)
6180
+ props[handlerName = toHandlerKey(camelize(event))];
6181
+ if (!handler && isModelListener) {
6182
+ handler = props[handlerName = toHandlerKey(hyphenate(event))];
6183
+ }
6184
+ if (handler) {
6185
+ callWithAsyncErrorHandling(
6186
+ handler,
6187
+ instance,
6188
+ 6,
6189
+ args
6190
+ );
6191
+ }
6192
+ const onceHandler = props[handlerName + `Once`];
6193
+ if (onceHandler) {
6194
+ if (!instance.emitted) {
6195
+ instance.emitted = {};
6196
+ } else if (instance.emitted[handlerName]) {
6197
+ return;
6136
6198
  }
6137
- } else if (flush === "post") {
6138
- queuePostRenderEffect(
6139
- effect.run.bind(effect),
6140
- instance && instance.suspense
6199
+ instance.emitted[handlerName] = true;
6200
+ callWithAsyncErrorHandling(
6201
+ onceHandler,
6202
+ instance,
6203
+ 6,
6204
+ args
6141
6205
  );
6142
- } else {
6143
- effect.run();
6144
6206
  }
6145
- if (ssrCleanup) ssrCleanup.push(unwatch);
6146
- return unwatch;
6147
6207
  }
6148
- function instanceWatch(source, value, options) {
6149
- const publicThis = this.proxy;
6150
- const getter = isString(source) ? source.includes(".") ? createPathGetter(publicThis, source) : () => publicThis[source] : source.bind(publicThis, publicThis);
6151
- let cb;
6152
- if (isFunction(value)) {
6153
- cb = value;
6154
- } else {
6155
- cb = value.handler;
6156
- options = value;
6208
+ function normalizeEmitsOptions(comp, appContext, asMixin = false) {
6209
+ const cache = appContext.emitsCache;
6210
+ const cached = cache.get(comp);
6211
+ if (cached !== void 0) {
6212
+ return cached;
6157
6213
  }
6158
- const reset = setCurrentInstance(this);
6159
- const res = doWatch(getter, cb.bind(publicThis), options);
6160
- reset();
6161
- return res;
6162
- }
6163
- function createPathGetter(ctx, path) {
6164
- const segments = path.split(".");
6165
- return () => {
6166
- let cur = ctx;
6167
- for (let i = 0; i < segments.length && cur; i++) {
6168
- cur = cur[segments[i]];
6214
+ const raw = comp.emits;
6215
+ let normalized = {};
6216
+ let hasExtends = false;
6217
+ if (__VUE_OPTIONS_API__ && !isFunction(comp)) {
6218
+ const extendEmits = (raw2) => {
6219
+ const normalizedFromExtend = normalizeEmitsOptions(raw2, appContext, true);
6220
+ if (normalizedFromExtend) {
6221
+ hasExtends = true;
6222
+ extend(normalized, normalizedFromExtend);
6223
+ }
6224
+ };
6225
+ if (!asMixin && appContext.mixins.length) {
6226
+ appContext.mixins.forEach(extendEmits);
6169
6227
  }
6170
- return cur;
6171
- };
6172
- }
6173
- function traverse(value, depth = Infinity, seen) {
6174
- if (depth <= 0 || !isObject(value) || value["__v_skip"]) {
6175
- return value;
6176
- }
6177
- seen = seen || /* @__PURE__ */ new Set();
6178
- if (seen.has(value)) {
6179
- return value;
6180
- }
6181
- seen.add(value);
6182
- depth--;
6183
- if (isRef(value)) {
6184
- traverse(value.value, depth, seen);
6185
- } else if (isArray(value)) {
6186
- for (let i = 0; i < value.length; i++) {
6187
- traverse(value[i], depth, seen);
6228
+ if (comp.extends) {
6229
+ extendEmits(comp.extends);
6188
6230
  }
6189
- } else if (isSet(value) || isMap(value)) {
6190
- value.forEach((v) => {
6191
- traverse(v, depth, seen);
6192
- });
6193
- } else if (isPlainObject(value)) {
6194
- for (const key in value) {
6195
- traverse(value[key], depth, seen);
6231
+ if (comp.mixins) {
6232
+ comp.mixins.forEach(extendEmits);
6196
6233
  }
6197
- for (const key of Object.getOwnPropertySymbols(value)) {
6198
- if (Object.prototype.propertyIsEnumerable.call(value, key)) {
6199
- traverse(value[key], depth, seen);
6200
- }
6234
+ }
6235
+ if (!raw && !hasExtends) {
6236
+ if (isObject(comp)) {
6237
+ cache.set(comp, null);
6201
6238
  }
6239
+ return null;
6202
6240
  }
6203
- return value;
6241
+ if (isArray(raw)) {
6242
+ raw.forEach((key) => normalized[key] = null);
6243
+ } else {
6244
+ extend(normalized, raw);
6245
+ }
6246
+ if (isObject(comp)) {
6247
+ cache.set(comp, normalized);
6248
+ }
6249
+ return normalized;
6250
+ }
6251
+ function isEmitListener(options, key) {
6252
+ if (!options || !isOn(key)) {
6253
+ return false;
6254
+ }
6255
+ key = key.slice(2).replace(/Once$/, "");
6256
+ return hasOwn(options, key[0].toLowerCase() + key.slice(1)) || hasOwn(options, hyphenate(key)) || hasOwn(options, key);
6204
6257
  }
6205
6258
 
6206
- const isKeepAlive = (vnode) => vnode.type.__isKeepAlive;
6207
- const KeepAliveImpl = {
6208
- name: `KeepAlive`,
6209
- // Marker for special handling inside the renderer. We are not using a ===
6210
- // check directly on KeepAlive in the renderer, because importing it directly
6211
- // would prevent it from being tree-shaken.
6212
- __isKeepAlive: true,
6213
- props: {
6214
- include: [String, RegExp, Array],
6215
- exclude: [String, RegExp, Array],
6216
- max: [String, Number]
6217
- },
6218
- setup(props, { slots }) {
6219
- const instance = getCurrentInstance();
6220
- const sharedContext = instance.ctx;
6221
- if (!sharedContext.renderer) {
6222
- return () => {
6223
- const children = slots.default && slots.default();
6224
- return children && children.length === 1 ? children[0] : children;
6225
- };
6226
- }
6227
- const cache = /* @__PURE__ */ new Map();
6228
- const keys = /* @__PURE__ */ new Set();
6229
- let current = null;
6230
- if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__) {
6231
- instance.__v_cache = cache;
6232
- }
6233
- const parentSuspense = instance.suspense;
6234
- const {
6235
- renderer: {
6236
- p: patch,
6237
- m: move,
6238
- um: _unmount,
6239
- o: { createElement }
6259
+ let accessedAttrs = false;
6260
+ function markAttrsAccessed() {
6261
+ accessedAttrs = true;
6262
+ }
6263
+ function renderComponentRoot(instance) {
6264
+ const {
6265
+ type: Component,
6266
+ vnode,
6267
+ proxy,
6268
+ withProxy,
6269
+ propsOptions: [propsOptions],
6270
+ slots,
6271
+ attrs,
6272
+ emit,
6273
+ render,
6274
+ renderCache,
6275
+ props,
6276
+ data,
6277
+ setupState,
6278
+ ctx,
6279
+ inheritAttrs
6280
+ } = instance;
6281
+ const prev = setCurrentRenderingInstance(instance);
6282
+ let result;
6283
+ let fallthroughAttrs;
6284
+ if (!!(process.env.NODE_ENV !== "production")) {
6285
+ accessedAttrs = false;
6286
+ }
6287
+ try {
6288
+ if (vnode.shapeFlag & 4) {
6289
+ const proxyToUse = withProxy || proxy;
6290
+ const thisProxy = !!(process.env.NODE_ENV !== "production") && setupState.__isScriptSetup ? new Proxy(proxyToUse, {
6291
+ get(target, key, receiver) {
6292
+ warn$1(
6293
+ `Property '${String(
6294
+ key
6295
+ )}' was accessed via 'this'. Avoid using 'this' in templates.`
6296
+ );
6297
+ return Reflect.get(target, key, receiver);
6298
+ }
6299
+ }) : proxyToUse;
6300
+ result = normalizeVNode(
6301
+ render.call(
6302
+ thisProxy,
6303
+ proxyToUse,
6304
+ renderCache,
6305
+ !!(process.env.NODE_ENV !== "production") ? shallowReadonly(props) : props,
6306
+ setupState,
6307
+ data,
6308
+ ctx
6309
+ )
6310
+ );
6311
+ fallthroughAttrs = attrs;
6312
+ } else {
6313
+ const render2 = Component;
6314
+ if (!!(process.env.NODE_ENV !== "production") && attrs === props) {
6315
+ markAttrsAccessed();
6240
6316
  }
6241
- } = sharedContext;
6242
- const storageContainer = createElement("div");
6243
- sharedContext.activate = (vnode, container, anchor, namespace, optimized) => {
6244
- const instance2 = vnode.component;
6245
- move(vnode, container, anchor, 0, parentSuspense);
6246
- patch(
6247
- instance2.vnode,
6248
- vnode,
6249
- container,
6250
- anchor,
6251
- instance2,
6252
- parentSuspense,
6253
- namespace,
6254
- vnode.slotScopeIds,
6255
- optimized
6317
+ result = normalizeVNode(
6318
+ render2.length > 1 ? render2(
6319
+ !!(process.env.NODE_ENV !== "production") ? shallowReadonly(props) : props,
6320
+ !!(process.env.NODE_ENV !== "production") ? {
6321
+ get attrs() {
6322
+ markAttrsAccessed();
6323
+ return shallowReadonly(attrs);
6324
+ },
6325
+ slots,
6326
+ emit
6327
+ } : { attrs, slots, emit }
6328
+ ) : render2(
6329
+ !!(process.env.NODE_ENV !== "production") ? shallowReadonly(props) : props,
6330
+ null
6331
+ )
6256
6332
  );
6257
- queuePostRenderEffect(() => {
6258
- instance2.isDeactivated = false;
6259
- if (instance2.a) {
6260
- invokeArrayFns(instance2.a);
6333
+ fallthroughAttrs = Component.props ? attrs : getFunctionalFallthrough(attrs);
6334
+ }
6335
+ } catch (err) {
6336
+ blockStack.length = 0;
6337
+ handleError(err, instance, 1);
6338
+ result = createVNode(Comment);
6339
+ }
6340
+ let root = result;
6341
+ let setRoot = void 0;
6342
+ if (!!(process.env.NODE_ENV !== "production") && result.patchFlag > 0 && result.patchFlag & 2048) {
6343
+ [root, setRoot] = getChildRoot(result);
6344
+ }
6345
+ if (fallthroughAttrs && inheritAttrs !== false) {
6346
+ const keys = Object.keys(fallthroughAttrs);
6347
+ const { shapeFlag } = root;
6348
+ if (keys.length) {
6349
+ if (shapeFlag & (1 | 6)) {
6350
+ if (propsOptions && keys.some(isModelListener)) {
6351
+ fallthroughAttrs = filterModelListeners(
6352
+ fallthroughAttrs,
6353
+ propsOptions
6354
+ );
6261
6355
  }
6262
- const vnodeHook = vnode.props && vnode.props.onVnodeMounted;
6263
- if (vnodeHook) {
6264
- invokeVNodeHook(vnodeHook, instance2.parent, vnode);
6356
+ root = cloneVNode(root, fallthroughAttrs, false, true);
6357
+ } else if (!!(process.env.NODE_ENV !== "production") && !accessedAttrs && root.type !== Comment) {
6358
+ const allAttrs = Object.keys(attrs);
6359
+ const eventAttrs = [];
6360
+ const extraAttrs = [];
6361
+ for (let i = 0, l = allAttrs.length; i < l; i++) {
6362
+ const key = allAttrs[i];
6363
+ if (isOn(key)) {
6364
+ if (!isModelListener(key)) {
6365
+ eventAttrs.push(key[2].toLowerCase() + key.slice(3));
6366
+ }
6367
+ } else {
6368
+ extraAttrs.push(key);
6369
+ }
6265
6370
  }
6266
- }, parentSuspense);
6267
- if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__) {
6268
- devtoolsComponentAdded(instance2);
6269
- }
6270
- };
6271
- sharedContext.deactivate = (vnode) => {
6272
- const instance2 = vnode.component;
6273
- invalidateMount(instance2.m);
6274
- invalidateMount(instance2.a);
6275
- move(vnode, storageContainer, null, 1, parentSuspense);
6276
- queuePostRenderEffect(() => {
6277
- if (instance2.da) {
6278
- invokeArrayFns(instance2.da);
6371
+ if (extraAttrs.length) {
6372
+ warn$1(
6373
+ `Extraneous non-props attributes (${extraAttrs.join(", ")}) were passed to component but could not be automatically inherited because component renders fragment or text root nodes.`
6374
+ );
6279
6375
  }
6280
- const vnodeHook = vnode.props && vnode.props.onVnodeUnmounted;
6281
- if (vnodeHook) {
6282
- invokeVNodeHook(vnodeHook, instance2.parent, vnode);
6376
+ if (eventAttrs.length) {
6377
+ warn$1(
6378
+ `Extraneous non-emits event listeners (${eventAttrs.join(", ")}) were passed to component but could not be automatically inherited because component renders fragment or text root nodes. If the listener is intended to be a component custom event listener only, declare it using the "emits" option.`
6379
+ );
6283
6380
  }
6284
- instance2.isDeactivated = true;
6285
- }, parentSuspense);
6286
- if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__) {
6287
- devtoolsComponentAdded(instance2);
6288
6381
  }
6289
- };
6290
- function unmount(vnode) {
6291
- resetShapeFlag(vnode);
6292
- _unmount(vnode, instance, parentSuspense, true);
6293
6382
  }
6294
- function pruneCache(filter) {
6295
- cache.forEach((vnode, key) => {
6296
- const name = getComponentName(vnode.type);
6297
- if (name && (!filter || !filter(name))) {
6298
- pruneCacheEntry(key);
6299
- }
6300
- });
6383
+ }
6384
+ if (vnode.dirs) {
6385
+ if (!!(process.env.NODE_ENV !== "production") && !isElementRoot(root)) {
6386
+ warn$1(
6387
+ `Runtime directive used on component with non-element root node. The directives will not function as intended.`
6388
+ );
6301
6389
  }
6302
- function pruneCacheEntry(key) {
6303
- const cached = cache.get(key);
6304
- if (!current || !isSameVNodeType(cached, current)) {
6305
- unmount(cached);
6306
- } else if (current) {
6307
- resetShapeFlag(current);
6308
- }
6309
- cache.delete(key);
6310
- keys.delete(key);
6390
+ root = cloneVNode(root, null, false, true);
6391
+ root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
6392
+ }
6393
+ if (vnode.transition) {
6394
+ if (!!(process.env.NODE_ENV !== "production") && !isElementRoot(root)) {
6395
+ warn$1(
6396
+ `Component inside <Transition> renders non-element root node that cannot be animated.`
6397
+ );
6311
6398
  }
6312
- watch(
6313
- () => [props.include, props.exclude],
6314
- ([include, exclude]) => {
6315
- include && pruneCache((name) => matches(include, name));
6316
- exclude && pruneCache((name) => !matches(exclude, name));
6317
- },
6318
- // prune post-render after `current` has been updated
6319
- { flush: "post", deep: true }
6320
- );
6321
- let pendingCacheKey = null;
6322
- const cacheSubtree = () => {
6323
- if (pendingCacheKey != null) {
6324
- if (isSuspense(instance.subTree.type)) {
6325
- queuePostRenderEffect(() => {
6326
- cache.set(pendingCacheKey, getInnerChild(instance.subTree));
6327
- }, instance.subTree.suspense);
6328
- } else {
6329
- cache.set(pendingCacheKey, getInnerChild(instance.subTree));
6330
- }
6399
+ root.transition = vnode.transition;
6400
+ }
6401
+ if (!!(process.env.NODE_ENV !== "production") && setRoot) {
6402
+ setRoot(root);
6403
+ } else {
6404
+ result = root;
6405
+ }
6406
+ setCurrentRenderingInstance(prev);
6407
+ return result;
6408
+ }
6409
+ const getChildRoot = (vnode) => {
6410
+ const rawChildren = vnode.children;
6411
+ const dynamicChildren = vnode.dynamicChildren;
6412
+ const childRoot = filterSingleRoot(rawChildren, false);
6413
+ if (!childRoot) {
6414
+ return [vnode, void 0];
6415
+ } else if (!!(process.env.NODE_ENV !== "production") && childRoot.patchFlag > 0 && childRoot.patchFlag & 2048) {
6416
+ return getChildRoot(childRoot);
6417
+ }
6418
+ const index = rawChildren.indexOf(childRoot);
6419
+ const dynamicIndex = dynamicChildren ? dynamicChildren.indexOf(childRoot) : -1;
6420
+ const setRoot = (updatedRoot) => {
6421
+ rawChildren[index] = updatedRoot;
6422
+ if (dynamicChildren) {
6423
+ if (dynamicIndex > -1) {
6424
+ dynamicChildren[dynamicIndex] = updatedRoot;
6425
+ } else if (updatedRoot.patchFlag > 0) {
6426
+ vnode.dynamicChildren = [...dynamicChildren, updatedRoot];
6331
6427
  }
6332
- };
6333
- onMounted(cacheSubtree);
6334
- onUpdated(cacheSubtree);
6335
- onBeforeUnmount(() => {
6336
- cache.forEach((cached) => {
6337
- const { subTree, suspense } = instance;
6338
- const vnode = getInnerChild(subTree);
6339
- if (cached.type === vnode.type && cached.key === vnode.key) {
6340
- resetShapeFlag(vnode);
6341
- const da = vnode.component.da;
6342
- da && queuePostRenderEffect(da, suspense);
6428
+ }
6429
+ };
6430
+ return [normalizeVNode(childRoot), setRoot];
6431
+ };
6432
+ function filterSingleRoot(children, recurse = true) {
6433
+ let singleRoot;
6434
+ for (let i = 0; i < children.length; i++) {
6435
+ const child = children[i];
6436
+ if (isVNode(child)) {
6437
+ if (child.type !== Comment || child.children === "v-if") {
6438
+ if (singleRoot) {
6343
6439
  return;
6440
+ } else {
6441
+ singleRoot = child;
6442
+ if (!!(process.env.NODE_ENV !== "production") && recurse && singleRoot.patchFlag > 0 && singleRoot.patchFlag & 2048) {
6443
+ return filterSingleRoot(singleRoot.children);
6444
+ }
6344
6445
  }
6345
- unmount(cached);
6346
- });
6347
- });
6348
- return () => {
6349
- pendingCacheKey = null;
6350
- if (!slots.default) {
6351
- return null;
6352
- }
6353
- const children = slots.default();
6354
- const rawVNode = children[0];
6355
- if (children.length > 1) {
6356
- if (!!(process.env.NODE_ENV !== "production")) {
6357
- warn$1(`KeepAlive should contain exactly one component child.`);
6358
- }
6359
- current = null;
6360
- return children;
6361
- } else if (!isVNode(rawVNode) || !(rawVNode.shapeFlag & 4) && !(rawVNode.shapeFlag & 128)) {
6362
- current = null;
6363
- return rawVNode;
6364
6446
  }
6365
- let vnode = getInnerChild(rawVNode);
6366
- const comp = vnode.type;
6367
- const name = getComponentName(
6368
- isAsyncWrapper(vnode) ? vnode.type.__asyncResolved || {} : comp
6369
- );
6370
- const { include, exclude, max } = props;
6371
- if (include && (!name || !matches(include, name)) || exclude && name && matches(exclude, name)) {
6372
- current = vnode;
6373
- return rawVNode;
6447
+ } else {
6448
+ return;
6449
+ }
6450
+ }
6451
+ return singleRoot;
6452
+ }
6453
+ const getFunctionalFallthrough = (attrs) => {
6454
+ let res;
6455
+ for (const key in attrs) {
6456
+ if (key === "class" || key === "style" || isOn(key)) {
6457
+ (res || (res = {}))[key] = attrs[key];
6458
+ }
6459
+ }
6460
+ return res;
6461
+ };
6462
+ const filterModelListeners = (attrs, props) => {
6463
+ const res = {};
6464
+ for (const key in attrs) {
6465
+ if (!isModelListener(key) || !(key.slice(9) in props)) {
6466
+ res[key] = attrs[key];
6467
+ }
6468
+ }
6469
+ return res;
6470
+ };
6471
+ const isElementRoot = (vnode) => {
6472
+ return vnode.shapeFlag & (6 | 1) || vnode.type === Comment;
6473
+ };
6474
+ function shouldUpdateComponent(prevVNode, nextVNode, optimized) {
6475
+ const { props: prevProps, children: prevChildren, component } = prevVNode;
6476
+ const { props: nextProps, children: nextChildren, patchFlag } = nextVNode;
6477
+ const emits = component.emitsOptions;
6478
+ if (!!(process.env.NODE_ENV !== "production") && (prevChildren || nextChildren) && isHmrUpdating) {
6479
+ return true;
6480
+ }
6481
+ if (nextVNode.dirs || nextVNode.transition) {
6482
+ return true;
6483
+ }
6484
+ if (optimized && patchFlag >= 0) {
6485
+ if (patchFlag & 1024) {
6486
+ return true;
6487
+ }
6488
+ if (patchFlag & 16) {
6489
+ if (!prevProps) {
6490
+ return !!nextProps;
6374
6491
  }
6375
- const key = vnode.key == null ? comp : vnode.key;
6376
- const cachedVNode = cache.get(key);
6377
- if (vnode.el) {
6378
- vnode = cloneVNode(vnode);
6379
- if (rawVNode.shapeFlag & 128) {
6380
- rawVNode.ssContent = vnode;
6492
+ return hasPropsChanged(prevProps, nextProps, emits);
6493
+ } else if (patchFlag & 8) {
6494
+ const dynamicProps = nextVNode.dynamicProps;
6495
+ for (let i = 0; i < dynamicProps.length; i++) {
6496
+ const key = dynamicProps[i];
6497
+ if (nextProps[key] !== prevProps[key] && !isEmitListener(emits, key)) {
6498
+ return true;
6381
6499
  }
6382
6500
  }
6383
- pendingCacheKey = key;
6384
- if (cachedVNode) {
6385
- vnode.el = cachedVNode.el;
6386
- vnode.component = cachedVNode.component;
6387
- if (vnode.transition) {
6388
- setTransitionHooks(vnode, vnode.transition);
6389
- }
6390
- vnode.shapeFlag |= 512;
6391
- keys.delete(key);
6392
- keys.add(key);
6393
- } else {
6394
- keys.add(key);
6395
- if (max && keys.size > parseInt(max, 10)) {
6396
- pruneCacheEntry(keys.values().next().value);
6397
- }
6501
+ }
6502
+ } else {
6503
+ if (prevChildren || nextChildren) {
6504
+ if (!nextChildren || !nextChildren.$stable) {
6505
+ return true;
6398
6506
  }
6399
- vnode.shapeFlag |= 256;
6400
- current = vnode;
6401
- return isSuspense(rawVNode.type) ? rawVNode : vnode;
6402
- };
6403
- }
6404
- };
6405
- const KeepAlive = KeepAliveImpl;
6406
- function matches(pattern, name) {
6407
- if (isArray(pattern)) {
6408
- return pattern.some((p) => matches(p, name));
6409
- } else if (isString(pattern)) {
6410
- return pattern.split(",").includes(name);
6411
- } else if (isRegExp(pattern)) {
6412
- return pattern.test(name);
6507
+ }
6508
+ if (prevProps === nextProps) {
6509
+ return false;
6510
+ }
6511
+ if (!prevProps) {
6512
+ return !!nextProps;
6513
+ }
6514
+ if (!nextProps) {
6515
+ return true;
6516
+ }
6517
+ return hasPropsChanged(prevProps, nextProps, emits);
6413
6518
  }
6414
6519
  return false;
6415
6520
  }
6416
- function onActivated(hook, target) {
6417
- registerKeepAliveHook(hook, "a", target);
6418
- }
6419
- function onDeactivated(hook, target) {
6420
- registerKeepAliveHook(hook, "da", target);
6521
+ function hasPropsChanged(prevProps, nextProps, emitsOptions) {
6522
+ const nextKeys = Object.keys(nextProps);
6523
+ if (nextKeys.length !== Object.keys(prevProps).length) {
6524
+ return true;
6525
+ }
6526
+ for (let i = 0; i < nextKeys.length; i++) {
6527
+ const key = nextKeys[i];
6528
+ if (nextProps[key] !== prevProps[key] && !isEmitListener(emitsOptions, key)) {
6529
+ return true;
6530
+ }
6531
+ }
6532
+ return false;
6421
6533
  }
6422
- function registerKeepAliveHook(hook, type, target = currentInstance) {
6423
- const wrappedHook = hook.__wdc || (hook.__wdc = () => {
6424
- let current = target;
6425
- while (current) {
6426
- if (current.isDeactivated) {
6427
- return;
6428
- }
6429
- current = current.parent;
6534
+ function updateHOCHostEl({ vnode, parent }, el) {
6535
+ while (parent) {
6536
+ const root = parent.subTree;
6537
+ if (root.suspense && root.suspense.activeBranch === vnode) {
6538
+ root.el = vnode.el;
6430
6539
  }
6431
- return hook();
6432
- });
6433
- injectHook(type, wrappedHook, target);
6434
- if (target) {
6435
- let current = target.parent;
6436
- while (current && current.parent) {
6437
- if (isKeepAlive(current.parent.vnode)) {
6438
- injectToKeepAliveRoot(wrappedHook, type, target, current);
6439
- }
6440
- current = current.parent;
6540
+ if (root === vnode) {
6541
+ (vnode = parent.vnode).el = el;
6542
+ parent = parent.parent;
6543
+ } else {
6544
+ break;
6441
6545
  }
6442
6546
  }
6443
6547
  }
6444
- function injectToKeepAliveRoot(hook, type, target, keepAliveRoot) {
6445
- const injected = injectHook(
6446
- type,
6447
- hook,
6448
- keepAliveRoot,
6449
- true
6450
- /* prepend */
6451
- );
6452
- onUnmounted(() => {
6453
- remove(keepAliveRoot[type], injected);
6454
- }, target);
6455
- }
6456
- function resetShapeFlag(vnode) {
6457
- vnode.shapeFlag &= ~256;
6458
- vnode.shapeFlag &= ~512;
6459
- }
6460
- function getInnerChild(vnode) {
6461
- return vnode.shapeFlag & 128 ? vnode.ssContent : vnode;
6462
- }
6463
6548
 
6464
- const leaveCbKey = Symbol("_leaveCb");
6465
- const enterCbKey = Symbol("_enterCb");
6466
- function useTransitionState() {
6467
- const state = {
6468
- isMounted: false,
6469
- isLeaving: false,
6470
- isUnmounting: false,
6471
- leavingVNodes: /* @__PURE__ */ new Map()
6472
- };
6473
- onMounted(() => {
6474
- state.isMounted = true;
6475
- });
6476
- onBeforeUnmount(() => {
6477
- state.isUnmounting = true;
6478
- });
6479
- return state;
6480
- }
6481
- const TransitionHookValidator = [Function, Array];
6482
- const BaseTransitionPropsValidators = {
6483
- mode: String,
6484
- appear: Boolean,
6485
- persisted: Boolean,
6486
- // enter
6487
- onBeforeEnter: TransitionHookValidator,
6488
- onEnter: TransitionHookValidator,
6489
- onAfterEnter: TransitionHookValidator,
6490
- onEnterCancelled: TransitionHookValidator,
6491
- // leave
6492
- onBeforeLeave: TransitionHookValidator,
6493
- onLeave: TransitionHookValidator,
6494
- onAfterLeave: TransitionHookValidator,
6495
- onLeaveCancelled: TransitionHookValidator,
6496
- // appear
6497
- onBeforeAppear: TransitionHookValidator,
6498
- onAppear: TransitionHookValidator,
6499
- onAfterAppear: TransitionHookValidator,
6500
- onAppearCancelled: TransitionHookValidator
6501
- };
6502
- const recursiveGetSubtree = (instance) => {
6503
- const subTree = instance.subTree;
6504
- return subTree.component ? recursiveGetSubtree(subTree.component) : subTree;
6505
- };
6506
- const BaseTransitionImpl = {
6507
- name: `BaseTransition`,
6508
- props: BaseTransitionPropsValidators,
6509
- setup(props, { slots }) {
6510
- const instance = getCurrentInstance();
6511
- const state = useTransitionState();
6512
- return () => {
6513
- const children = slots.default && getTransitionRawChildren(slots.default(), true);
6514
- if (!children || !children.length) {
6515
- return;
6516
- }
6517
- let child = children[0];
6518
- if (children.length > 1) {
6519
- let hasFound = false;
6520
- for (const c of children) {
6521
- if (c.type !== Comment) {
6522
- if (!!(process.env.NODE_ENV !== "production") && hasFound) {
6523
- warn$1(
6524
- "<transition> can only be used on a single element or component. Use <transition-group> for lists."
6525
- );
6526
- break;
6527
- }
6528
- child = c;
6529
- hasFound = true;
6530
- if (!!!(process.env.NODE_ENV !== "production")) break;
6531
- }
6532
- }
6533
- }
6534
- const rawProps = toRaw(props);
6535
- const { mode } = rawProps;
6536
- if (!!(process.env.NODE_ENV !== "production") && mode && mode !== "in-out" && mode !== "out-in" && mode !== "default") {
6537
- warn$1(`invalid <transition> mode: ${mode}`);
6538
- }
6539
- if (state.isLeaving) {
6540
- return emptyPlaceholder(child);
6541
- }
6542
- const innerChild = getKeepAliveChild(child);
6543
- if (!innerChild) {
6544
- return emptyPlaceholder(child);
6545
- }
6546
- let enterHooks = resolveTransitionHooks(
6547
- innerChild,
6548
- rawProps,
6549
- state,
6550
- instance,
6551
- // #11061, ensure enterHooks is fresh after clone
6552
- (hooks) => enterHooks = hooks
6553
- );
6554
- setTransitionHooks(innerChild, enterHooks);
6555
- const oldChild = instance.subTree;
6556
- const oldInnerChild = oldChild && getKeepAliveChild(oldChild);
6557
- if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(innerChild, oldInnerChild) && recursiveGetSubtree(instance).type !== Comment) {
6558
- const leavingHooks = resolveTransitionHooks(
6559
- oldInnerChild,
6560
- rawProps,
6561
- state,
6562
- instance
6563
- );
6564
- setTransitionHooks(oldInnerChild, leavingHooks);
6565
- if (mode === "out-in" && innerChild.type !== Comment) {
6566
- state.isLeaving = true;
6567
- leavingHooks.afterLeave = () => {
6568
- state.isLeaving = false;
6569
- if (instance.update.active !== false) {
6570
- instance.effect.dirty = true;
6571
- instance.update();
6572
- }
6573
- };
6574
- return emptyPlaceholder(child);
6575
- } else if (mode === "in-out" && innerChild.type !== Comment) {
6576
- leavingHooks.delayLeave = (el, earlyRemove, delayedLeave) => {
6577
- const leavingVNodesCache = getLeavingNodesForType(
6578
- state,
6579
- oldInnerChild
6580
- );
6581
- leavingVNodesCache[String(oldInnerChild.key)] = oldInnerChild;
6582
- el[leaveCbKey] = () => {
6583
- earlyRemove();
6584
- el[leaveCbKey] = void 0;
6585
- delete enterHooks.delayedLeave;
6586
- };
6587
- enterHooks.delayedLeave = delayedLeave;
6588
- };
6589
- }
6549
+ const isSuspense = (type) => type.__isSuspense;
6550
+ let suspenseId = 0;
6551
+ const SuspenseImpl = {
6552
+ name: "Suspense",
6553
+ // In order to make Suspense tree-shakable, we need to avoid importing it
6554
+ // directly in the renderer. The renderer checks for the __isSuspense flag
6555
+ // on a vnode's type and calls the `process` method, passing in renderer
6556
+ // internals.
6557
+ __isSuspense: true,
6558
+ process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals) {
6559
+ if (n1 == null) {
6560
+ mountSuspense(
6561
+ n2,
6562
+ container,
6563
+ anchor,
6564
+ parentComponent,
6565
+ parentSuspense,
6566
+ namespace,
6567
+ slotScopeIds,
6568
+ optimized,
6569
+ rendererInternals
6570
+ );
6571
+ } else {
6572
+ if (parentSuspense && parentSuspense.deps > 0 && !n1.suspense.isInFallback) {
6573
+ n2.suspense = n1.suspense;
6574
+ n2.suspense.vnode = n2;
6575
+ n2.el = n1.el;
6576
+ return;
6590
6577
  }
6591
- return child;
6592
- };
6593
- }
6578
+ patchSuspense(
6579
+ n1,
6580
+ n2,
6581
+ container,
6582
+ anchor,
6583
+ parentComponent,
6584
+ namespace,
6585
+ slotScopeIds,
6586
+ optimized,
6587
+ rendererInternals
6588
+ );
6589
+ }
6590
+ },
6591
+ hydrate: hydrateSuspense,
6592
+ normalize: normalizeSuspenseChildren
6594
6593
  };
6595
- const BaseTransition = BaseTransitionImpl;
6596
- function getLeavingNodesForType(state, vnode) {
6597
- const { leavingVNodes } = state;
6598
- let leavingVNodesCache = leavingVNodes.get(vnode.type);
6599
- if (!leavingVNodesCache) {
6600
- leavingVNodesCache = /* @__PURE__ */ Object.create(null);
6601
- leavingVNodes.set(vnode.type, leavingVNodesCache);
6594
+ const Suspense = SuspenseImpl ;
6595
+ function triggerEvent(vnode, name) {
6596
+ const eventListener = vnode.props && vnode.props[name];
6597
+ if (isFunction(eventListener)) {
6598
+ eventListener();
6602
6599
  }
6603
- return leavingVNodesCache;
6604
6600
  }
6605
- function resolveTransitionHooks(vnode, props, state, instance, postClone) {
6601
+ function mountSuspense(vnode, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals) {
6606
6602
  const {
6607
- appear,
6608
- mode,
6609
- persisted = false,
6610
- onBeforeEnter,
6611
- onEnter,
6612
- onAfterEnter,
6613
- onEnterCancelled,
6614
- onBeforeLeave,
6615
- onLeave,
6616
- onAfterLeave,
6617
- onLeaveCancelled,
6618
- onBeforeAppear,
6619
- onAppear,
6620
- onAfterAppear,
6621
- onAppearCancelled
6622
- } = props;
6623
- const key = String(vnode.key);
6624
- const leavingVNodesCache = getLeavingNodesForType(state, vnode);
6625
- const callHook = (hook, args) => {
6626
- hook && callWithAsyncErrorHandling(
6627
- hook,
6628
- instance,
6629
- 9,
6630
- args
6603
+ p: patch,
6604
+ o: { createElement }
6605
+ } = rendererInternals;
6606
+ const hiddenContainer = createElement("div");
6607
+ const suspense = vnode.suspense = createSuspenseBoundary(
6608
+ vnode,
6609
+ parentSuspense,
6610
+ parentComponent,
6611
+ container,
6612
+ hiddenContainer,
6613
+ anchor,
6614
+ namespace,
6615
+ slotScopeIds,
6616
+ optimized,
6617
+ rendererInternals
6618
+ );
6619
+ patch(
6620
+ null,
6621
+ suspense.pendingBranch = vnode.ssContent,
6622
+ hiddenContainer,
6623
+ null,
6624
+ parentComponent,
6625
+ suspense,
6626
+ namespace,
6627
+ slotScopeIds
6628
+ );
6629
+ if (suspense.deps > 0) {
6630
+ triggerEvent(vnode, "onPending");
6631
+ triggerEvent(vnode, "onFallback");
6632
+ patch(
6633
+ null,
6634
+ vnode.ssFallback,
6635
+ container,
6636
+ anchor,
6637
+ parentComponent,
6638
+ null,
6639
+ // fallback tree will not have suspense context
6640
+ namespace,
6641
+ slotScopeIds
6631
6642
  );
6632
- };
6633
- const callAsyncHook = (hook, args) => {
6634
- const done = args[1];
6635
- callHook(hook, args);
6636
- if (isArray(hook)) {
6637
- if (hook.every((hook2) => hook2.length <= 1)) done();
6638
- } else if (hook.length <= 1) {
6639
- done();
6640
- }
6641
- };
6642
- const hooks = {
6643
- mode,
6644
- persisted,
6645
- beforeEnter(el) {
6646
- let hook = onBeforeEnter;
6647
- if (!state.isMounted) {
6648
- if (appear) {
6649
- hook = onBeforeAppear || onBeforeEnter;
6650
- } else {
6651
- return;
6643
+ setActiveBranch(suspense, vnode.ssFallback);
6644
+ } else {
6645
+ suspense.resolve(false, true);
6646
+ }
6647
+ }
6648
+ function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, slotScopeIds, optimized, { p: patch, um: unmount, o: { createElement } }) {
6649
+ const suspense = n2.suspense = n1.suspense;
6650
+ suspense.vnode = n2;
6651
+ n2.el = n1.el;
6652
+ const newBranch = n2.ssContent;
6653
+ const newFallback = n2.ssFallback;
6654
+ const { activeBranch, pendingBranch, isInFallback, isHydrating } = suspense;
6655
+ if (pendingBranch) {
6656
+ suspense.pendingBranch = newBranch;
6657
+ if (isSameVNodeType(newBranch, pendingBranch)) {
6658
+ patch(
6659
+ pendingBranch,
6660
+ newBranch,
6661
+ suspense.hiddenContainer,
6662
+ null,
6663
+ parentComponent,
6664
+ suspense,
6665
+ namespace,
6666
+ slotScopeIds,
6667
+ optimized
6668
+ );
6669
+ if (suspense.deps <= 0) {
6670
+ suspense.resolve();
6671
+ } else if (isInFallback) {
6672
+ if (!isHydrating) {
6673
+ patch(
6674
+ activeBranch,
6675
+ newFallback,
6676
+ container,
6677
+ anchor,
6678
+ parentComponent,
6679
+ null,
6680
+ // fallback tree will not have suspense context
6681
+ namespace,
6682
+ slotScopeIds,
6683
+ optimized
6684
+ );
6685
+ setActiveBranch(suspense, newFallback);
6652
6686
  }
6653
6687
  }
6654
- if (el[leaveCbKey]) {
6655
- el[leaveCbKey](
6656
- true
6657
- /* cancelled */
6658
- );
6659
- }
6660
- const leavingVNode = leavingVNodesCache[key];
6661
- if (leavingVNode && isSameVNodeType(vnode, leavingVNode) && leavingVNode.el[leaveCbKey]) {
6662
- leavingVNode.el[leaveCbKey]();
6663
- }
6664
- callHook(hook, [el]);
6665
- },
6666
- enter(el) {
6667
- let hook = onEnter;
6668
- let afterHook = onAfterEnter;
6669
- let cancelHook = onEnterCancelled;
6670
- if (!state.isMounted) {
6671
- if (appear) {
6672
- hook = onAppear || onEnter;
6673
- afterHook = onAfterAppear || onAfterEnter;
6674
- cancelHook = onAppearCancelled || onEnterCancelled;
6675
- } else {
6676
- return;
6677
- }
6688
+ } else {
6689
+ suspense.pendingId = suspenseId++;
6690
+ if (isHydrating) {
6691
+ suspense.isHydrating = false;
6692
+ suspense.activeBranch = pendingBranch;
6693
+ } else {
6694
+ unmount(pendingBranch, parentComponent, suspense);
6678
6695
  }
6679
- let called = false;
6680
- const done = el[enterCbKey] = (cancelled) => {
6681
- if (called) return;
6682
- called = true;
6683
- if (cancelled) {
6684
- callHook(cancelHook, [el]);
6696
+ suspense.deps = 0;
6697
+ suspense.effects.length = 0;
6698
+ suspense.hiddenContainer = createElement("div");
6699
+ if (isInFallback) {
6700
+ patch(
6701
+ null,
6702
+ newBranch,
6703
+ suspense.hiddenContainer,
6704
+ null,
6705
+ parentComponent,
6706
+ suspense,
6707
+ namespace,
6708
+ slotScopeIds,
6709
+ optimized
6710
+ );
6711
+ if (suspense.deps <= 0) {
6712
+ suspense.resolve();
6685
6713
  } else {
6686
- callHook(afterHook, [el]);
6687
- }
6688
- if (hooks.delayedLeave) {
6689
- hooks.delayedLeave();
6714
+ patch(
6715
+ activeBranch,
6716
+ newFallback,
6717
+ container,
6718
+ anchor,
6719
+ parentComponent,
6720
+ null,
6721
+ // fallback tree will not have suspense context
6722
+ namespace,
6723
+ slotScopeIds,
6724
+ optimized
6725
+ );
6726
+ setActiveBranch(suspense, newFallback);
6690
6727
  }
6691
- el[enterCbKey] = void 0;
6692
- };
6693
- if (hook) {
6694
- callAsyncHook(hook, [el, done]);
6728
+ } else if (activeBranch && isSameVNodeType(newBranch, activeBranch)) {
6729
+ patch(
6730
+ activeBranch,
6731
+ newBranch,
6732
+ container,
6733
+ anchor,
6734
+ parentComponent,
6735
+ suspense,
6736
+ namespace,
6737
+ slotScopeIds,
6738
+ optimized
6739
+ );
6740
+ suspense.resolve(true);
6695
6741
  } else {
6696
- done();
6697
- }
6698
- },
6699
- leave(el, remove) {
6700
- const key2 = String(vnode.key);
6701
- if (el[enterCbKey]) {
6702
- el[enterCbKey](
6703
- true
6704
- /* cancelled */
6742
+ patch(
6743
+ null,
6744
+ newBranch,
6745
+ suspense.hiddenContainer,
6746
+ null,
6747
+ parentComponent,
6748
+ suspense,
6749
+ namespace,
6750
+ slotScopeIds,
6751
+ optimized
6705
6752
  );
6706
- }
6707
- if (state.isUnmounting) {
6708
- return remove();
6709
- }
6710
- callHook(onBeforeLeave, [el]);
6711
- let called = false;
6712
- const done = el[leaveCbKey] = (cancelled) => {
6713
- if (called) return;
6714
- called = true;
6715
- remove();
6716
- if (cancelled) {
6717
- callHook(onLeaveCancelled, [el]);
6718
- } else {
6719
- callHook(onAfterLeave, [el]);
6720
- }
6721
- el[leaveCbKey] = void 0;
6722
- if (leavingVNodesCache[key2] === vnode) {
6723
- delete leavingVNodesCache[key2];
6753
+ if (suspense.deps <= 0) {
6754
+ suspense.resolve();
6724
6755
  }
6725
- };
6726
- leavingVNodesCache[key2] = vnode;
6727
- if (onLeave) {
6728
- callAsyncHook(onLeave, [el, done]);
6756
+ }
6757
+ }
6758
+ } else {
6759
+ if (activeBranch && isSameVNodeType(newBranch, activeBranch)) {
6760
+ patch(
6761
+ activeBranch,
6762
+ newBranch,
6763
+ container,
6764
+ anchor,
6765
+ parentComponent,
6766
+ suspense,
6767
+ namespace,
6768
+ slotScopeIds,
6769
+ optimized
6770
+ );
6771
+ setActiveBranch(suspense, newBranch);
6772
+ } else {
6773
+ triggerEvent(n2, "onPending");
6774
+ suspense.pendingBranch = newBranch;
6775
+ if (newBranch.shapeFlag & 512) {
6776
+ suspense.pendingId = newBranch.component.suspenseId;
6729
6777
  } else {
6730
- done();
6778
+ suspense.pendingId = suspenseId++;
6731
6779
  }
6732
- },
6733
- clone(vnode2) {
6734
- const hooks2 = resolveTransitionHooks(
6735
- vnode2,
6736
- props,
6737
- state,
6738
- instance,
6739
- postClone
6780
+ patch(
6781
+ null,
6782
+ newBranch,
6783
+ suspense.hiddenContainer,
6784
+ null,
6785
+ parentComponent,
6786
+ suspense,
6787
+ namespace,
6788
+ slotScopeIds,
6789
+ optimized
6740
6790
  );
6741
- if (postClone) postClone(hooks2);
6742
- return hooks2;
6743
- }
6744
- };
6745
- return hooks;
6746
- }
6747
- function emptyPlaceholder(vnode) {
6748
- if (isKeepAlive(vnode)) {
6749
- vnode = cloneVNode(vnode);
6750
- vnode.children = null;
6751
- return vnode;
6752
- }
6753
- }
6754
- function getKeepAliveChild(vnode) {
6755
- if (!isKeepAlive(vnode)) {
6756
- return vnode;
6757
- }
6758
- if (!!(process.env.NODE_ENV !== "production") && vnode.component) {
6759
- return vnode.component.subTree;
6760
- }
6761
- const { shapeFlag, children } = vnode;
6762
- if (children) {
6763
- if (shapeFlag & 16) {
6764
- return children[0];
6765
- }
6766
- if (shapeFlag & 32 && isFunction(children.default)) {
6767
- return children.default();
6791
+ if (suspense.deps <= 0) {
6792
+ suspense.resolve();
6793
+ } else {
6794
+ const { timeout, pendingId } = suspense;
6795
+ if (timeout > 0) {
6796
+ setTimeout(() => {
6797
+ if (suspense.pendingId === pendingId) {
6798
+ suspense.fallback(newFallback);
6799
+ }
6800
+ }, timeout);
6801
+ } else if (timeout === 0) {
6802
+ suspense.fallback(newFallback);
6803
+ }
6804
+ }
6768
6805
  }
6769
6806
  }
6770
6807
  }
6771
- function setTransitionHooks(vnode, hooks) {
6772
- if (vnode.shapeFlag & 6 && vnode.component) {
6773
- setTransitionHooks(vnode.component.subTree, hooks);
6774
- } else if (vnode.shapeFlag & 128) {
6775
- vnode.ssContent.transition = hooks.clone(vnode.ssContent);
6776
- vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
6777
- } else {
6778
- vnode.transition = hooks;
6808
+ let hasWarned = false;
6809
+ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, container, hiddenContainer, anchor, namespace, slotScopeIds, optimized, rendererInternals, isHydrating = false) {
6810
+ if (!!(process.env.NODE_ENV !== "production") && true && !hasWarned) {
6811
+ hasWarned = true;
6812
+ console[console.info ? "info" : "log"](
6813
+ `<Suspense> is an experimental feature and its API will likely change.`
6814
+ );
6779
6815
  }
6780
- }
6781
- function getTransitionRawChildren(children, keepComment = false, parentKey) {
6782
- let ret = [];
6783
- let keyedFragmentCount = 0;
6784
- for (let i = 0; i < children.length; i++) {
6785
- let child = children[i];
6786
- const key = parentKey == null ? child.key : String(parentKey) + String(child.key != null ? child.key : i);
6787
- if (child.type === Fragment) {
6788
- if (child.patchFlag & 128) keyedFragmentCount++;
6789
- ret = ret.concat(
6790
- getTransitionRawChildren(child.children, keepComment, key)
6791
- );
6792
- } else if (keepComment || child.type !== Comment) {
6793
- ret.push(key != null ? cloneVNode(child, { key }) : child);
6816
+ const {
6817
+ p: patch,
6818
+ m: move,
6819
+ um: unmount,
6820
+ n: next,
6821
+ o: { parentNode, remove }
6822
+ } = rendererInternals;
6823
+ let parentSuspenseId;
6824
+ const isSuspensible = isVNodeSuspensible(vnode);
6825
+ if (isSuspensible) {
6826
+ if (parentSuspense && parentSuspense.pendingBranch) {
6827
+ parentSuspenseId = parentSuspense.pendingId;
6828
+ parentSuspense.deps++;
6794
6829
  }
6795
6830
  }
6796
- if (keyedFragmentCount > 1) {
6797
- for (let i = 0; i < ret.length; i++) {
6798
- ret[i].patchFlag = -2;
6799
- }
6831
+ const timeout = vnode.props ? toNumber(vnode.props.timeout) : void 0;
6832
+ if (!!(process.env.NODE_ENV !== "production")) {
6833
+ assertNumber(timeout, `Suspense timeout`);
6800
6834
  }
6801
- return ret;
6802
- }
6803
-
6804
- const isTeleport = (type) => type.__isTeleport;
6805
- const isTeleportDisabled = (props) => props && (props.disabled || props.disabled === "");
6806
- const isTargetSVG = (target) => typeof SVGElement !== "undefined" && target instanceof SVGElement;
6807
- const isTargetMathML = (target) => typeof MathMLElement === "function" && target instanceof MathMLElement;
6808
- const resolveTarget = (props, select) => {
6809
- const targetSelector = props && props.to;
6810
- if (isString(targetSelector)) {
6811
- if (!select) {
6812
- !!(process.env.NODE_ENV !== "production") && warn$1(
6813
- `Current renderer does not support string target for Teleports. (missing querySelector renderer option)`
6814
- );
6815
- return null;
6816
- } else {
6817
- const target = select(targetSelector);
6818
- if (!!(process.env.NODE_ENV !== "production") && !target && !isTeleportDisabled(props)) {
6819
- warn$1(
6820
- `Failed to locate Teleport target with selector "${targetSelector}". Note the target element must exist before the component is mounted - i.e. the target cannot be rendered by the component itself, and ideally should be outside of the entire Vue component tree.`
6821
- );
6835
+ const initialAnchor = anchor;
6836
+ const suspense = {
6837
+ vnode,
6838
+ parent: parentSuspense,
6839
+ parentComponent,
6840
+ namespace,
6841
+ container,
6842
+ hiddenContainer,
6843
+ deps: 0,
6844
+ pendingId: suspenseId++,
6845
+ timeout: typeof timeout === "number" ? timeout : -1,
6846
+ activeBranch: null,
6847
+ pendingBranch: null,
6848
+ isInFallback: !isHydrating,
6849
+ isHydrating,
6850
+ isUnmounted: false,
6851
+ effects: [],
6852
+ resolve(resume = false, sync = false) {
6853
+ if (!!(process.env.NODE_ENV !== "production")) {
6854
+ if (!resume && !suspense.pendingBranch) {
6855
+ throw new Error(
6856
+ `suspense.resolve() is called without a pending branch.`
6857
+ );
6858
+ }
6859
+ if (suspense.isUnmounted) {
6860
+ throw new Error(
6861
+ `suspense.resolve() is called on an already unmounted suspense boundary.`
6862
+ );
6863
+ }
6864
+ }
6865
+ const {
6866
+ vnode: vnode2,
6867
+ activeBranch,
6868
+ pendingBranch,
6869
+ pendingId,
6870
+ effects,
6871
+ parentComponent: parentComponent2,
6872
+ container: container2
6873
+ } = suspense;
6874
+ let delayEnter = false;
6875
+ if (suspense.isHydrating) {
6876
+ suspense.isHydrating = false;
6877
+ } else if (!resume) {
6878
+ delayEnter = activeBranch && pendingBranch.transition && pendingBranch.transition.mode === "out-in";
6879
+ if (delayEnter) {
6880
+ activeBranch.transition.afterLeave = () => {
6881
+ if (pendingId === suspense.pendingId) {
6882
+ move(
6883
+ pendingBranch,
6884
+ container2,
6885
+ anchor === initialAnchor ? next(activeBranch) : anchor,
6886
+ 0
6887
+ );
6888
+ queuePostFlushCb(effects);
6889
+ }
6890
+ };
6891
+ }
6892
+ if (activeBranch) {
6893
+ if (parentNode(activeBranch.el) !== suspense.hiddenContainer) {
6894
+ anchor = next(activeBranch);
6895
+ }
6896
+ unmount(activeBranch, parentComponent2, suspense, true);
6897
+ }
6898
+ if (!delayEnter) {
6899
+ move(pendingBranch, container2, anchor, 0);
6900
+ }
6822
6901
  }
6823
- return target;
6824
- }
6825
- } else {
6826
- if (!!(process.env.NODE_ENV !== "production") && !targetSelector && !isTeleportDisabled(props)) {
6827
- warn$1(`Invalid Teleport target: ${targetSelector}`);
6828
- }
6829
- return targetSelector;
6830
- }
6831
- };
6832
- const TeleportImpl = {
6833
- name: "Teleport",
6834
- __isTeleport: true,
6835
- process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, internals) {
6836
- const {
6837
- mc: mountChildren,
6838
- pc: patchChildren,
6839
- pbc: patchBlockChildren,
6840
- o: { insert, querySelector, createText, createComment }
6841
- } = internals;
6842
- const disabled = isTeleportDisabled(n2.props);
6843
- let { shapeFlag, children, dynamicChildren } = n2;
6844
- if (!!(process.env.NODE_ENV !== "production") && isHmrUpdating) {
6845
- optimized = false;
6846
- dynamicChildren = null;
6847
- }
6848
- if (n1 == null) {
6849
- const placeholder = n2.el = !!(process.env.NODE_ENV !== "production") ? createComment("teleport start") : createText("");
6850
- const mainAnchor = n2.anchor = !!(process.env.NODE_ENV !== "production") ? createComment("teleport end") : createText("");
6851
- insert(placeholder, container, anchor);
6852
- insert(mainAnchor, container, anchor);
6853
- const target = n2.target = resolveTarget(n2.props, querySelector);
6854
- const targetAnchor = n2.targetAnchor = createText("");
6855
- if (target) {
6856
- insert(targetAnchor, target);
6857
- if (namespace === "svg" || isTargetSVG(target)) {
6858
- namespace = "svg";
6859
- } else if (namespace === "mathml" || isTargetMathML(target)) {
6860
- namespace = "mathml";
6902
+ setActiveBranch(suspense, pendingBranch);
6903
+ suspense.pendingBranch = null;
6904
+ suspense.isInFallback = false;
6905
+ let parent = suspense.parent;
6906
+ let hasUnresolvedAncestor = false;
6907
+ while (parent) {
6908
+ if (parent.pendingBranch) {
6909
+ parent.effects.push(...effects);
6910
+ hasUnresolvedAncestor = true;
6911
+ break;
6861
6912
  }
6862
- } else if (!!(process.env.NODE_ENV !== "production") && !disabled) {
6863
- warn$1("Invalid Teleport target on mount:", target, `(${typeof target})`);
6913
+ parent = parent.parent;
6864
6914
  }
6865
- const mount = (container2, anchor2) => {
6866
- if (shapeFlag & 16) {
6867
- mountChildren(
6868
- children,
6869
- container2,
6870
- anchor2,
6871
- parentComponent,
6872
- parentSuspense,
6873
- namespace,
6874
- slotScopeIds,
6875
- optimized
6876
- );
6915
+ if (!hasUnresolvedAncestor && !delayEnter) {
6916
+ queuePostFlushCb(effects);
6917
+ }
6918
+ suspense.effects = [];
6919
+ if (isSuspensible) {
6920
+ if (parentSuspense && parentSuspense.pendingBranch && parentSuspenseId === parentSuspense.pendingId) {
6921
+ parentSuspense.deps--;
6922
+ if (parentSuspense.deps === 0 && !sync) {
6923
+ parentSuspense.resolve();
6924
+ }
6877
6925
  }
6878
- };
6879
- if (disabled) {
6880
- mount(container, mainAnchor);
6881
- } else if (target) {
6882
- mount(target, targetAnchor);
6883
6926
  }
6884
- } else {
6885
- n2.el = n1.el;
6886
- const mainAnchor = n2.anchor = n1.anchor;
6887
- const target = n2.target = n1.target;
6888
- const targetAnchor = n2.targetAnchor = n1.targetAnchor;
6889
- const wasDisabled = isTeleportDisabled(n1.props);
6890
- const currentContainer = wasDisabled ? container : target;
6891
- const currentAnchor = wasDisabled ? mainAnchor : targetAnchor;
6892
- if (namespace === "svg" || isTargetSVG(target)) {
6893
- namespace = "svg";
6894
- } else if (namespace === "mathml" || isTargetMathML(target)) {
6895
- namespace = "mathml";
6927
+ triggerEvent(vnode2, "onResolve");
6928
+ },
6929
+ fallback(fallbackVNode) {
6930
+ if (!suspense.pendingBranch) {
6931
+ return;
6896
6932
  }
6897
- if (dynamicChildren) {
6898
- patchBlockChildren(
6899
- n1.dynamicChildren,
6900
- dynamicChildren,
6901
- currentContainer,
6902
- parentComponent,
6903
- parentSuspense,
6904
- namespace,
6905
- slotScopeIds
6906
- );
6907
- traverseStaticChildren(n1, n2, true);
6908
- } else if (!optimized) {
6909
- patchChildren(
6910
- n1,
6911
- n2,
6912
- currentContainer,
6913
- currentAnchor,
6914
- parentComponent,
6915
- parentSuspense,
6916
- namespace,
6933
+ const { vnode: vnode2, activeBranch, parentComponent: parentComponent2, container: container2, namespace: namespace2 } = suspense;
6934
+ triggerEvent(vnode2, "onFallback");
6935
+ const anchor2 = next(activeBranch);
6936
+ const mountFallback = () => {
6937
+ if (!suspense.isInFallback) {
6938
+ return;
6939
+ }
6940
+ patch(
6941
+ null,
6942
+ fallbackVNode,
6943
+ container2,
6944
+ anchor2,
6945
+ parentComponent2,
6946
+ null,
6947
+ // fallback tree will not have suspense context
6948
+ namespace2,
6917
6949
  slotScopeIds,
6918
- false
6950
+ optimized
6919
6951
  );
6952
+ setActiveBranch(suspense, fallbackVNode);
6953
+ };
6954
+ const delayEnter = fallbackVNode.transition && fallbackVNode.transition.mode === "out-in";
6955
+ if (delayEnter) {
6956
+ activeBranch.transition.afterLeave = mountFallback;
6920
6957
  }
6921
- if (disabled) {
6922
- if (!wasDisabled) {
6923
- moveTeleport(
6924
- n2,
6925
- container,
6926
- mainAnchor,
6927
- internals,
6928
- 1
6929
- );
6930
- } else {
6931
- if (n2.props && n1.props && n2.props.to !== n1.props.to) {
6932
- n2.props.to = n1.props.to;
6933
- }
6958
+ suspense.isInFallback = true;
6959
+ unmount(
6960
+ activeBranch,
6961
+ parentComponent2,
6962
+ null,
6963
+ // no suspense so unmount hooks fire now
6964
+ true
6965
+ // shouldRemove
6966
+ );
6967
+ if (!delayEnter) {
6968
+ mountFallback();
6969
+ }
6970
+ },
6971
+ move(container2, anchor2, type) {
6972
+ suspense.activeBranch && move(suspense.activeBranch, container2, anchor2, type);
6973
+ suspense.container = container2;
6974
+ },
6975
+ next() {
6976
+ return suspense.activeBranch && next(suspense.activeBranch);
6977
+ },
6978
+ registerDep(instance, setupRenderEffect, optimized2) {
6979
+ const isInPendingSuspense = !!suspense.pendingBranch;
6980
+ if (isInPendingSuspense) {
6981
+ suspense.deps++;
6982
+ }
6983
+ const hydratedEl = instance.vnode.el;
6984
+ instance.asyncDep.catch((err) => {
6985
+ handleError(err, instance, 0);
6986
+ }).then((asyncSetupResult) => {
6987
+ if (instance.isUnmounted || suspense.isUnmounted || suspense.pendingId !== instance.suspenseId) {
6988
+ return;
6934
6989
  }
6935
- } else {
6936
- if ((n2.props && n2.props.to) !== (n1.props && n1.props.to)) {
6937
- const nextTarget = n2.target = resolveTarget(
6938
- n2.props,
6939
- querySelector
6940
- );
6941
- if (nextTarget) {
6942
- moveTeleport(
6943
- n2,
6944
- nextTarget,
6945
- null,
6946
- internals,
6947
- 0
6948
- );
6949
- } else if (!!(process.env.NODE_ENV !== "production")) {
6950
- warn$1(
6951
- "Invalid Teleport target on update:",
6952
- target,
6953
- `(${typeof target})`
6954
- );
6955
- }
6956
- } else if (wasDisabled) {
6957
- moveTeleport(
6958
- n2,
6959
- target,
6960
- targetAnchor,
6961
- internals,
6962
- 1
6963
- );
6990
+ instance.asyncResolved = true;
6991
+ const { vnode: vnode2 } = instance;
6992
+ if (!!(process.env.NODE_ENV !== "production")) {
6993
+ pushWarningContext(vnode2);
6994
+ }
6995
+ handleSetupResult(instance, asyncSetupResult, false);
6996
+ if (hydratedEl) {
6997
+ vnode2.el = hydratedEl;
6998
+ }
6999
+ const placeholder = !hydratedEl && instance.subTree.el;
7000
+ setupRenderEffect(
7001
+ instance,
7002
+ vnode2,
7003
+ // component may have been moved before resolve.
7004
+ // if this is not a hydration, instance.subTree will be the comment
7005
+ // placeholder.
7006
+ parentNode(hydratedEl || instance.subTree.el),
7007
+ // anchor will not be used if this is hydration, so only need to
7008
+ // consider the comment placeholder case.
7009
+ hydratedEl ? null : next(instance.subTree),
7010
+ suspense,
7011
+ namespace,
7012
+ optimized2
7013
+ );
7014
+ if (placeholder) {
7015
+ remove(placeholder);
7016
+ }
7017
+ updateHOCHostEl(instance, vnode2.el);
7018
+ if (!!(process.env.NODE_ENV !== "production")) {
7019
+ popWarningContext();
7020
+ }
7021
+ if (isInPendingSuspense && --suspense.deps === 0) {
7022
+ suspense.resolve();
6964
7023
  }
7024
+ });
7025
+ },
7026
+ unmount(parentSuspense2, doRemove) {
7027
+ suspense.isUnmounted = true;
7028
+ if (suspense.activeBranch) {
7029
+ unmount(
7030
+ suspense.activeBranch,
7031
+ parentComponent,
7032
+ parentSuspense2,
7033
+ doRemove
7034
+ );
6965
7035
  }
6966
- }
6967
- updateCssVars(n2);
6968
- },
6969
- remove(vnode, parentComponent, parentSuspense, { um: unmount, o: { remove: hostRemove } }, doRemove) {
6970
- const { shapeFlag, children, anchor, targetAnchor, target, props } = vnode;
6971
- if (target) {
6972
- hostRemove(targetAnchor);
6973
- }
6974
- doRemove && hostRemove(anchor);
6975
- if (shapeFlag & 16) {
6976
- const shouldRemove = doRemove || !isTeleportDisabled(props);
6977
- for (let i = 0; i < children.length; i++) {
6978
- const child = children[i];
7036
+ if (suspense.pendingBranch) {
6979
7037
  unmount(
6980
- child,
7038
+ suspense.pendingBranch,
6981
7039
  parentComponent,
6982
- parentSuspense,
6983
- shouldRemove,
6984
- !!child.dynamicChildren
7040
+ parentSuspense2,
7041
+ doRemove
6985
7042
  );
6986
7043
  }
6987
7044
  }
6988
- },
6989
- move: moveTeleport,
6990
- hydrate: hydrateTeleport
6991
- };
6992
- function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }, moveType = 2) {
6993
- if (moveType === 0) {
6994
- insert(vnode.targetAnchor, container, parentAnchor);
7045
+ };
7046
+ return suspense;
7047
+ }
7048
+ function hydrateSuspense(node, vnode, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals, hydrateNode) {
7049
+ const suspense = vnode.suspense = createSuspenseBoundary(
7050
+ vnode,
7051
+ parentSuspense,
7052
+ parentComponent,
7053
+ node.parentNode,
7054
+ // eslint-disable-next-line no-restricted-globals
7055
+ document.createElement("div"),
7056
+ null,
7057
+ namespace,
7058
+ slotScopeIds,
7059
+ optimized,
7060
+ rendererInternals,
7061
+ true
7062
+ );
7063
+ const result = hydrateNode(
7064
+ node,
7065
+ suspense.pendingBranch = vnode.ssContent,
7066
+ parentComponent,
7067
+ suspense,
7068
+ slotScopeIds,
7069
+ optimized
7070
+ );
7071
+ if (suspense.deps === 0) {
7072
+ suspense.resolve(false, true);
6995
7073
  }
6996
- const { el, anchor, shapeFlag, children, props } = vnode;
6997
- const isReorder = moveType === 2;
6998
- if (isReorder) {
6999
- insert(el, container, parentAnchor);
7074
+ return result;
7075
+ }
7076
+ function normalizeSuspenseChildren(vnode) {
7077
+ const { shapeFlag, children } = vnode;
7078
+ const isSlotChildren = shapeFlag & 32;
7079
+ vnode.ssContent = normalizeSuspenseSlot(
7080
+ isSlotChildren ? children.default : children
7081
+ );
7082
+ vnode.ssFallback = isSlotChildren ? normalizeSuspenseSlot(children.fallback) : createVNode(Comment);
7083
+ }
7084
+ function normalizeSuspenseSlot(s) {
7085
+ let block;
7086
+ if (isFunction(s)) {
7087
+ const trackBlock = isBlockTreeEnabled && s._c;
7088
+ if (trackBlock) {
7089
+ s._d = false;
7090
+ openBlock();
7091
+ }
7092
+ s = s();
7093
+ if (trackBlock) {
7094
+ s._d = true;
7095
+ block = currentBlock;
7096
+ closeBlock();
7097
+ }
7000
7098
  }
7001
- if (!isReorder || isTeleportDisabled(props)) {
7002
- if (shapeFlag & 16) {
7003
- for (let i = 0; i < children.length; i++) {
7004
- move(
7005
- children[i],
7006
- container,
7007
- parentAnchor,
7008
- 2
7009
- );
7010
- }
7099
+ if (isArray(s)) {
7100
+ const singleChild = filterSingleRoot(s);
7101
+ if (!!(process.env.NODE_ENV !== "production") && !singleChild && s.filter((child) => child !== NULL_DYNAMIC_COMPONENT).length > 0) {
7102
+ warn$1(`<Suspense> slots expect a single root node.`);
7011
7103
  }
7104
+ s = singleChild;
7012
7105
  }
7013
- if (isReorder) {
7014
- insert(anchor, container, parentAnchor);
7106
+ s = normalizeVNode(s);
7107
+ if (block && !s.dynamicChildren) {
7108
+ s.dynamicChildren = block.filter((c) => c !== s);
7015
7109
  }
7110
+ return s;
7016
7111
  }
7017
- function hydrateTeleport(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized, {
7018
- o: { nextSibling, parentNode, querySelector }
7019
- }, hydrateChildren) {
7020
- const target = vnode.target = resolveTarget(
7021
- vnode.props,
7022
- querySelector
7023
- );
7024
- if (target) {
7025
- const targetNode = target._lpa || target.firstChild;
7026
- if (vnode.shapeFlag & 16) {
7027
- if (isTeleportDisabled(vnode.props)) {
7028
- vnode.anchor = hydrateChildren(
7029
- nextSibling(node),
7030
- vnode,
7031
- parentNode(node),
7032
- parentComponent,
7033
- parentSuspense,
7034
- slotScopeIds,
7035
- optimized
7036
- );
7037
- vnode.targetAnchor = targetNode;
7038
- } else {
7039
- vnode.anchor = nextSibling(node);
7040
- let targetAnchor = targetNode;
7041
- while (targetAnchor) {
7042
- targetAnchor = nextSibling(targetAnchor);
7043
- if (targetAnchor && targetAnchor.nodeType === 8 && targetAnchor.data === "teleport anchor") {
7044
- vnode.targetAnchor = targetAnchor;
7045
- target._lpa = vnode.targetAnchor && nextSibling(vnode.targetAnchor);
7046
- break;
7047
- }
7048
- }
7049
- hydrateChildren(
7050
- targetNode,
7051
- vnode,
7052
- target,
7053
- parentComponent,
7054
- parentSuspense,
7055
- slotScopeIds,
7056
- optimized
7057
- );
7058
- }
7112
+ function queueEffectWithSuspense(fn, suspense) {
7113
+ if (suspense && suspense.pendingBranch) {
7114
+ if (isArray(fn)) {
7115
+ suspense.effects.push(...fn);
7116
+ } else {
7117
+ suspense.effects.push(fn);
7059
7118
  }
7060
- updateCssVars(vnode);
7119
+ } else {
7120
+ queuePostFlushCb(fn);
7061
7121
  }
7062
- return vnode.anchor && nextSibling(vnode.anchor);
7063
7122
  }
7064
- const Teleport = TeleportImpl;
7065
- function updateCssVars(vnode) {
7066
- const ctx = vnode.ctx;
7067
- if (ctx && ctx.ut) {
7068
- let node = vnode.children[0].el;
7069
- while (node && node !== vnode.targetAnchor) {
7070
- if (node.nodeType === 1) node.setAttribute("data-v-owner", ctx.uid);
7071
- node = node.nextSibling;
7072
- }
7073
- ctx.ut();
7123
+ function setActiveBranch(suspense, branch) {
7124
+ suspense.activeBranch = branch;
7125
+ const { vnode, parentComponent } = suspense;
7126
+ let el = branch.el;
7127
+ while (!el && branch.component) {
7128
+ branch = branch.component.subTree;
7129
+ el = branch.el;
7130
+ }
7131
+ vnode.el = el;
7132
+ if (parentComponent && parentComponent.subTree === vnode) {
7133
+ parentComponent.vnode.el = el;
7134
+ updateHOCHostEl(parentComponent, el);
7074
7135
  }
7075
7136
  }
7137
+ function isVNodeSuspensible(vnode) {
7138
+ const suspensible = vnode.props && vnode.props.suspensible;
7139
+ return suspensible != null && suspensible !== false;
7140
+ }
7076
7141
 
7077
7142
  const Fragment = Symbol.for("v-fgt");
7078
7143
  const Text = Symbol.for("v-txt");
@@ -7090,6 +7155,9 @@ function closeBlock() {
7090
7155
  let isBlockTreeEnabled = 1;
7091
7156
  function setBlockTracking(value) {
7092
7157
  isBlockTreeEnabled += value;
7158
+ if (value < 0 && currentBlock) {
7159
+ currentBlock.hasOnce = true;
7160
+ }
7093
7161
  }
7094
7162
  function setupBlock(vnode) {
7095
7163
  vnode.dynamicChildren = isBlockTreeEnabled > 0 ? currentBlock || EMPTY_ARR : null;
@@ -7128,10 +7196,13 @@ function isVNode(value) {
7128
7196
  return value ? value.__v_isVNode === true : false;
7129
7197
  }
7130
7198
  function isSameVNodeType(n1, n2) {
7131
- if (!!(process.env.NODE_ENV !== "production") && n2.shapeFlag & 6 && hmrDirtyComponents.has(n2.type)) {
7132
- n1.shapeFlag &= ~256;
7133
- n2.shapeFlag &= ~512;
7134
- return false;
7199
+ if (!!(process.env.NODE_ENV !== "production") && n2.shapeFlag & 6 && n1.component) {
7200
+ const dirtyInstances = hmrDirtyComponents.get(n2.type);
7201
+ if (dirtyInstances && dirtyInstances.has(n1.component)) {
7202
+ n1.shapeFlag &= ~256;
7203
+ n2.shapeFlag &= ~512;
7204
+ return false;
7205
+ }
7135
7206
  }
7136
7207
  return n1.type === n2.type && n1.key === n2.key;
7137
7208
  }
@@ -7175,6 +7246,7 @@ function createBaseVNode(type, props = null, children = null, patchFlag = 0, dyn
7175
7246
  el: null,
7176
7247
  anchor: null,
7177
7248
  target: null,
7249
+ targetStart: null,
7178
7250
  targetAnchor: null,
7179
7251
  staticCount: 0,
7180
7252
  shapeFlag,
@@ -7296,6 +7368,7 @@ function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false
7296
7368
  slotScopeIds: vnode.slotScopeIds,
7297
7369
  children: !!(process.env.NODE_ENV !== "production") && patchFlag === -1 && isArray(children) ? children.map(deepCloneVNode) : children,
7298
7370
  target: vnode.target,
7371
+ targetStart: vnode.targetStart,
7299
7372
  targetAnchor: vnode.targetAnchor,
7300
7373
  staticCount: vnode.staticCount,
7301
7374
  shapeFlag: vnode.shapeFlag,
@@ -7585,12 +7658,12 @@ function isStatefulComponent(instance) {
7585
7658
  return instance.vnode.shapeFlag & 4;
7586
7659
  }
7587
7660
  let isInSSRComponentSetup = false;
7588
- function setupComponent(instance, isSSR = false) {
7661
+ function setupComponent(instance, isSSR = false, optimized = false) {
7589
7662
  isSSR && setInSSRSetupState(isSSR);
7590
7663
  const { props, children } = instance.vnode;
7591
7664
  const isStateful = isStatefulComponent(instance);
7592
7665
  initProps(instance, props, isStateful, isSSR);
7593
- initSlots(instance, children);
7666
+ initSlots(instance, children, optimized);
7594
7667
  const setupResult = isStateful ? setupStatefulComponent(instance, isSSR) : void 0;
7595
7668
  isSSR && setInSSRSetupState(false);
7596
7669
  return setupResult;
@@ -7890,59 +7963,6 @@ const computed = (getterOrOptions, debugOptions) => {
7890
7963
  return c;
7891
7964
  };
7892
7965
 
7893
- function useModel(props, name, options = EMPTY_OBJ) {
7894
- const i = getCurrentInstance();
7895
- if (!!(process.env.NODE_ENV !== "production") && !i) {
7896
- warn$1(`useModel() called without active instance.`);
7897
- return ref();
7898
- }
7899
- if (!!(process.env.NODE_ENV !== "production") && !i.propsOptions[0][name]) {
7900
- warn$1(`useModel() called with prop "${name}" which is not declared.`);
7901
- return ref();
7902
- }
7903
- const camelizedName = camelize(name);
7904
- const hyphenatedName = hyphenate(name);
7905
- const res = customRef((track, trigger) => {
7906
- let localValue;
7907
- watchSyncEffect(() => {
7908
- const propValue = props[name];
7909
- if (hasChanged(localValue, propValue)) {
7910
- localValue = propValue;
7911
- trigger();
7912
- }
7913
- });
7914
- return {
7915
- get() {
7916
- track();
7917
- return options.get ? options.get(localValue) : localValue;
7918
- },
7919
- set(value) {
7920
- const rawProps = i.vnode.props;
7921
- if (!(rawProps && // check if parent has passed v-model
7922
- (name in rawProps || camelizedName in rawProps || hyphenatedName in rawProps) && (`onUpdate:${name}` in rawProps || `onUpdate:${camelizedName}` in rawProps || `onUpdate:${hyphenatedName}` in rawProps)) && hasChanged(value, localValue)) {
7923
- localValue = value;
7924
- trigger();
7925
- }
7926
- i.emit(`update:${name}`, options.set ? options.set(value) : value);
7927
- }
7928
- };
7929
- });
7930
- const modifierKey = name === "modelValue" ? "modelModifiers" : `${name}Modifiers`;
7931
- res[Symbol.iterator] = () => {
7932
- let i2 = 0;
7933
- return {
7934
- next() {
7935
- if (i2 < 2) {
7936
- return { value: i2++ ? props[modifierKey] || {} : res, done: false };
7937
- } else {
7938
- return { done: true };
7939
- }
7940
- }
7941
- };
7942
- };
7943
- return res;
7944
- }
7945
-
7946
7966
  function h(type, propsOrChildren, children) {
7947
7967
  const l = arguments.length;
7948
7968
  if (l === 2) {
@@ -7973,6 +7993,7 @@ function initCustomFormatter() {
7973
7993
  const stringStyle = { style: "color:#f5222d" };
7974
7994
  const keywordStyle = { style: "color:#eb2f96" };
7975
7995
  const formatter = {
7996
+ __vue_custom_formatter: true,
7976
7997
  header(obj) {
7977
7998
  if (!isObject(obj)) {
7978
7999
  return null;
@@ -8147,7 +8168,7 @@ function withMemo(memo, render, cache, index) {
8147
8168
  }
8148
8169
  const ret = render();
8149
8170
  ret.memo = memo.slice();
8150
- ret.memoIndex = index;
8171
+ ret.cacheIndex = index;
8151
8172
  return cache[index] = ret;
8152
8173
  }
8153
8174
  function isMemoSame(cached, memo) {
@@ -8166,7 +8187,7 @@ function isMemoSame(cached, memo) {
8166
8187
  return true;
8167
8188
  }
8168
8189
 
8169
- const version = "3.4.30";
8190
+ const version = "3.4.32";
8170
8191
  const warn = !!(process.env.NODE_ENV !== "production") ? warn$1 : NOOP;
8171
8192
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
8172
8193
  const devtools = !!(process.env.NODE_ENV !== "production") || true ? devtools$1 : void 0;