@vue/runtime-dom 3.2.36 → 3.2.39

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.
@@ -638,7 +638,7 @@ function trigger(target, type, key, newValue, oldValue, oldTarget) {
638
638
  return;
639
639
  }
640
640
  let deps = [];
641
- if (type === "clear" /* CLEAR */) {
641
+ if (type === "clear" /* TriggerOpTypes.CLEAR */) {
642
642
  // collection being cleared
643
643
  // trigger all effects for target
644
644
  deps = [...depsMap.values()];
@@ -657,7 +657,7 @@ function trigger(target, type, key, newValue, oldValue, oldTarget) {
657
657
  }
658
658
  // also run for iteration key on ADD | DELETE | Map.SET
659
659
  switch (type) {
660
- case "add" /* ADD */:
660
+ case "add" /* TriggerOpTypes.ADD */:
661
661
  if (!isArray(target)) {
662
662
  deps.push(depsMap.get(ITERATE_KEY));
663
663
  if (isMap(target)) {
@@ -669,7 +669,7 @@ function trigger(target, type, key, newValue, oldValue, oldTarget) {
669
669
  deps.push(depsMap.get('length'));
670
670
  }
671
671
  break;
672
- case "delete" /* DELETE */:
672
+ case "delete" /* TriggerOpTypes.DELETE */:
673
673
  if (!isArray(target)) {
674
674
  deps.push(depsMap.get(ITERATE_KEY));
675
675
  if (isMap(target)) {
@@ -677,7 +677,7 @@ function trigger(target, type, key, newValue, oldValue, oldTarget) {
677
677
  }
678
678
  }
679
679
  break;
680
- case "set" /* SET */:
680
+ case "set" /* TriggerOpTypes.SET */:
681
681
  if (isMap(target)) {
682
682
  deps.push(depsMap.get(ITERATE_KEY));
683
683
  }
@@ -754,7 +754,7 @@ function createArrayInstrumentations() {
754
754
  instrumentations[key] = function (...args) {
755
755
  const arr = toRaw(this);
756
756
  for (let i = 0, l = this.length; i < l; i++) {
757
- track(arr, "get" /* GET */, i + '');
757
+ track(arr, "get" /* TrackOpTypes.GET */, i + '');
758
758
  }
759
759
  // we run the method using the original args first (which may be reactive)
760
760
  const res = arr[key](...args);
@@ -779,16 +779,16 @@ function createArrayInstrumentations() {
779
779
  }
780
780
  function createGetter(isReadonly = false, shallow = false) {
781
781
  return function get(target, key, receiver) {
782
- if (key === "__v_isReactive" /* IS_REACTIVE */) {
782
+ if (key === "__v_isReactive" /* ReactiveFlags.IS_REACTIVE */) {
783
783
  return !isReadonly;
784
784
  }
785
- else if (key === "__v_isReadonly" /* IS_READONLY */) {
785
+ else if (key === "__v_isReadonly" /* ReactiveFlags.IS_READONLY */) {
786
786
  return isReadonly;
787
787
  }
788
- else if (key === "__v_isShallow" /* IS_SHALLOW */) {
788
+ else if (key === "__v_isShallow" /* ReactiveFlags.IS_SHALLOW */) {
789
789
  return shallow;
790
790
  }
791
- else if (key === "__v_raw" /* RAW */ &&
791
+ else if (key === "__v_raw" /* ReactiveFlags.RAW */ &&
792
792
  receiver ===
793
793
  (isReadonly
794
794
  ? shallow
@@ -808,7 +808,7 @@ function createGetter(isReadonly = false, shallow = false) {
808
808
  return res;
809
809
  }
810
810
  if (!isReadonly) {
811
- track(target, "get" /* GET */, key);
811
+ track(target, "get" /* TrackOpTypes.GET */, key);
812
812
  }
813
813
  if (shallow) {
814
814
  return res;
@@ -834,10 +834,10 @@ function createSetter(shallow = false) {
834
834
  if (isReadonly(oldValue) && isRef(oldValue) && !isRef(value)) {
835
835
  return false;
836
836
  }
837
- if (!shallow && !isReadonly(value)) {
838
- if (!isShallow(value)) {
839
- value = toRaw(value);
837
+ if (!shallow) {
838
+ if (!isShallow(value) && !isReadonly(value)) {
840
839
  oldValue = toRaw(oldValue);
840
+ value = toRaw(value);
841
841
  }
842
842
  if (!isArray(target) && isRef(oldValue) && !isRef(value)) {
843
843
  oldValue.value = value;
@@ -851,10 +851,10 @@ function createSetter(shallow = false) {
851
851
  // don't trigger if target is something up in the prototype chain of original
852
852
  if (target === toRaw(receiver)) {
853
853
  if (!hadKey) {
854
- trigger(target, "add" /* ADD */, key, value);
854
+ trigger(target, "add" /* TriggerOpTypes.ADD */, key, value);
855
855
  }
856
856
  else if (hasChanged(value, oldValue)) {
857
- trigger(target, "set" /* SET */, key, value, oldValue);
857
+ trigger(target, "set" /* TriggerOpTypes.SET */, key, value, oldValue);
858
858
  }
859
859
  }
860
860
  return result;
@@ -865,19 +865,19 @@ function deleteProperty(target, key) {
865
865
  const oldValue = target[key];
866
866
  const result = Reflect.deleteProperty(target, key);
867
867
  if (result && hadKey) {
868
- trigger(target, "delete" /* DELETE */, key, undefined, oldValue);
868
+ trigger(target, "delete" /* TriggerOpTypes.DELETE */, key, undefined, oldValue);
869
869
  }
870
870
  return result;
871
871
  }
872
872
  function has(target, key) {
873
873
  const result = Reflect.has(target, key);
874
874
  if (!isSymbol(key) || !builtInSymbols.has(key)) {
875
- track(target, "has" /* HAS */, key);
875
+ track(target, "has" /* TrackOpTypes.HAS */, key);
876
876
  }
877
877
  return result;
878
878
  }
879
879
  function ownKeys(target) {
880
- track(target, "iterate" /* ITERATE */, isArray(target) ? 'length' : ITERATE_KEY);
880
+ track(target, "iterate" /* TrackOpTypes.ITERATE */, isArray(target) ? 'length' : ITERATE_KEY);
881
881
  return Reflect.ownKeys(target);
882
882
  }
883
883
  const mutableHandlers = {
@@ -918,14 +918,14 @@ const getProto = (v) => Reflect.getPrototypeOf(v);
918
918
  function get$1(target, key, isReadonly = false, isShallow = false) {
919
919
  // #1772: readonly(reactive(Map)) should return readonly + reactive version
920
920
  // of the value
921
- target = target["__v_raw" /* RAW */];
921
+ target = target["__v_raw" /* ReactiveFlags.RAW */];
922
922
  const rawTarget = toRaw(target);
923
923
  const rawKey = toRaw(key);
924
924
  if (!isReadonly) {
925
925
  if (key !== rawKey) {
926
- track(rawTarget, "get" /* GET */, key);
926
+ track(rawTarget, "get" /* TrackOpTypes.GET */, key);
927
927
  }
928
- track(rawTarget, "get" /* GET */, rawKey);
928
+ track(rawTarget, "get" /* TrackOpTypes.GET */, rawKey);
929
929
  }
930
930
  const { has } = getProto(rawTarget);
931
931
  const wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive;
@@ -942,22 +942,22 @@ function get$1(target, key, isReadonly = false, isShallow = false) {
942
942
  }
943
943
  }
944
944
  function has$1(key, isReadonly = false) {
945
- const target = this["__v_raw" /* RAW */];
945
+ const target = this["__v_raw" /* ReactiveFlags.RAW */];
946
946
  const rawTarget = toRaw(target);
947
947
  const rawKey = toRaw(key);
948
948
  if (!isReadonly) {
949
949
  if (key !== rawKey) {
950
- track(rawTarget, "has" /* HAS */, key);
950
+ track(rawTarget, "has" /* TrackOpTypes.HAS */, key);
951
951
  }
952
- track(rawTarget, "has" /* HAS */, rawKey);
952
+ track(rawTarget, "has" /* TrackOpTypes.HAS */, rawKey);
953
953
  }
954
954
  return key === rawKey
955
955
  ? target.has(key)
956
956
  : target.has(key) || target.has(rawKey);
957
957
  }
958
958
  function size(target, isReadonly = false) {
959
- target = target["__v_raw" /* RAW */];
960
- !isReadonly && track(toRaw(target), "iterate" /* ITERATE */, ITERATE_KEY);
959
+ target = target["__v_raw" /* ReactiveFlags.RAW */];
960
+ !isReadonly && track(toRaw(target), "iterate" /* TrackOpTypes.ITERATE */, ITERATE_KEY);
961
961
  return Reflect.get(target, 'size', target);
962
962
  }
963
963
  function add(value) {
@@ -967,7 +967,7 @@ function add(value) {
967
967
  const hadKey = proto.has.call(target, value);
968
968
  if (!hadKey) {
969
969
  target.add(value);
970
- trigger(target, "add" /* ADD */, value, value);
970
+ trigger(target, "add" /* TriggerOpTypes.ADD */, value, value);
971
971
  }
972
972
  return this;
973
973
  }
@@ -986,10 +986,10 @@ function set$1(key, value) {
986
986
  const oldValue = get.call(target, key);
987
987
  target.set(key, value);
988
988
  if (!hadKey) {
989
- trigger(target, "add" /* ADD */, key, value);
989
+ trigger(target, "add" /* TriggerOpTypes.ADD */, key, value);
990
990
  }
991
991
  else if (hasChanged(value, oldValue)) {
992
- trigger(target, "set" /* SET */, key, value, oldValue);
992
+ trigger(target, "set" /* TriggerOpTypes.SET */, key, value, oldValue);
993
993
  }
994
994
  return this;
995
995
  }
@@ -1008,7 +1008,7 @@ function deleteEntry(key) {
1008
1008
  // forward the operation before queueing reactions
1009
1009
  const result = target.delete(key);
1010
1010
  if (hadKey) {
1011
- trigger(target, "delete" /* DELETE */, key, undefined, oldValue);
1011
+ trigger(target, "delete" /* TriggerOpTypes.DELETE */, key, undefined, oldValue);
1012
1012
  }
1013
1013
  return result;
1014
1014
  }
@@ -1022,17 +1022,17 @@ function clear() {
1022
1022
  // forward the operation before queueing reactions
1023
1023
  const result = target.clear();
1024
1024
  if (hadItems) {
1025
- trigger(target, "clear" /* CLEAR */, undefined, undefined, oldTarget);
1025
+ trigger(target, "clear" /* TriggerOpTypes.CLEAR */, undefined, undefined, oldTarget);
1026
1026
  }
1027
1027
  return result;
1028
1028
  }
1029
1029
  function createForEach(isReadonly, isShallow) {
1030
1030
  return function forEach(callback, thisArg) {
1031
1031
  const observed = this;
1032
- const target = observed["__v_raw" /* RAW */];
1032
+ const target = observed["__v_raw" /* ReactiveFlags.RAW */];
1033
1033
  const rawTarget = toRaw(target);
1034
1034
  const wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive;
1035
- !isReadonly && track(rawTarget, "iterate" /* ITERATE */, ITERATE_KEY);
1035
+ !isReadonly && track(rawTarget, "iterate" /* TrackOpTypes.ITERATE */, ITERATE_KEY);
1036
1036
  return target.forEach((value, key) => {
1037
1037
  // important: make sure the callback is
1038
1038
  // 1. invoked with the reactive map as `this` and 3rd arg
@@ -1043,7 +1043,7 @@ function createForEach(isReadonly, isShallow) {
1043
1043
  }
1044
1044
  function createIterableMethod(method, isReadonly, isShallow) {
1045
1045
  return function (...args) {
1046
- const target = this["__v_raw" /* RAW */];
1046
+ const target = this["__v_raw" /* ReactiveFlags.RAW */];
1047
1047
  const rawTarget = toRaw(target);
1048
1048
  const targetIsMap = isMap(rawTarget);
1049
1049
  const isPair = method === 'entries' || (method === Symbol.iterator && targetIsMap);
@@ -1051,7 +1051,7 @@ function createIterableMethod(method, isReadonly, isShallow) {
1051
1051
  const innerIterator = target[method](...args);
1052
1052
  const wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive;
1053
1053
  !isReadonly &&
1054
- track(rawTarget, "iterate" /* ITERATE */, isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY);
1054
+ track(rawTarget, "iterate" /* TrackOpTypes.ITERATE */, isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY);
1055
1055
  // return a wrapped iterator which returns observed versions of the
1056
1056
  // values emitted from the real iterator
1057
1057
  return {
@@ -1078,7 +1078,7 @@ function createReadonlyMethod(type) {
1078
1078
  const key = args[0] ? `on key "${args[0]}" ` : ``;
1079
1079
  console.warn(`${capitalize(type)} operation ${key}failed: target is readonly.`, toRaw(this));
1080
1080
  }
1081
- return type === "delete" /* DELETE */ ? false : this;
1081
+ return type === "delete" /* TriggerOpTypes.DELETE */ ? false : this;
1082
1082
  };
1083
1083
  }
1084
1084
  function createInstrumentations() {
@@ -1120,10 +1120,10 @@ function createInstrumentations() {
1120
1120
  has(key) {
1121
1121
  return has$1.call(this, key, true);
1122
1122
  },
1123
- add: createReadonlyMethod("add" /* ADD */),
1124
- set: createReadonlyMethod("set" /* SET */),
1125
- delete: createReadonlyMethod("delete" /* DELETE */),
1126
- clear: createReadonlyMethod("clear" /* CLEAR */),
1123
+ add: createReadonlyMethod("add" /* TriggerOpTypes.ADD */),
1124
+ set: createReadonlyMethod("set" /* TriggerOpTypes.SET */),
1125
+ delete: createReadonlyMethod("delete" /* TriggerOpTypes.DELETE */),
1126
+ clear: createReadonlyMethod("clear" /* TriggerOpTypes.CLEAR */),
1127
1127
  forEach: createForEach(true, false)
1128
1128
  };
1129
1129
  const shallowReadonlyInstrumentations = {
@@ -1136,10 +1136,10 @@ function createInstrumentations() {
1136
1136
  has(key) {
1137
1137
  return has$1.call(this, key, true);
1138
1138
  },
1139
- add: createReadonlyMethod("add" /* ADD */),
1140
- set: createReadonlyMethod("set" /* SET */),
1141
- delete: createReadonlyMethod("delete" /* DELETE */),
1142
- clear: createReadonlyMethod("clear" /* CLEAR */),
1139
+ add: createReadonlyMethod("add" /* TriggerOpTypes.ADD */),
1140
+ set: createReadonlyMethod("set" /* TriggerOpTypes.SET */),
1141
+ delete: createReadonlyMethod("delete" /* TriggerOpTypes.DELETE */),
1142
+ clear: createReadonlyMethod("clear" /* TriggerOpTypes.CLEAR */),
1143
1143
  forEach: createForEach(true, true)
1144
1144
  };
1145
1145
  const iteratorMethods = ['keys', 'values', 'entries', Symbol.iterator];
@@ -1166,13 +1166,13 @@ function createInstrumentationGetter(isReadonly, shallow) {
1166
1166
  ? readonlyInstrumentations
1167
1167
  : mutableInstrumentations;
1168
1168
  return (target, key, receiver) => {
1169
- if (key === "__v_isReactive" /* IS_REACTIVE */) {
1169
+ if (key === "__v_isReactive" /* ReactiveFlags.IS_REACTIVE */) {
1170
1170
  return !isReadonly;
1171
1171
  }
1172
- else if (key === "__v_isReadonly" /* IS_READONLY */) {
1172
+ else if (key === "__v_isReadonly" /* ReactiveFlags.IS_READONLY */) {
1173
1173
  return isReadonly;
1174
1174
  }
1175
- else if (key === "__v_raw" /* RAW */) {
1175
+ else if (key === "__v_raw" /* ReactiveFlags.RAW */) {
1176
1176
  return target;
1177
1177
  }
1178
1178
  return Reflect.get(hasOwn(instrumentations, key) && key in target
@@ -1212,19 +1212,19 @@ function targetTypeMap(rawType) {
1212
1212
  switch (rawType) {
1213
1213
  case 'Object':
1214
1214
  case 'Array':
1215
- return 1 /* COMMON */;
1215
+ return 1 /* TargetType.COMMON */;
1216
1216
  case 'Map':
1217
1217
  case 'Set':
1218
1218
  case 'WeakMap':
1219
1219
  case 'WeakSet':
1220
- return 2 /* COLLECTION */;
1220
+ return 2 /* TargetType.COLLECTION */;
1221
1221
  default:
1222
- return 0 /* INVALID */;
1222
+ return 0 /* TargetType.INVALID */;
1223
1223
  }
1224
1224
  }
1225
1225
  function getTargetType(value) {
1226
- return value["__v_skip" /* SKIP */] || !Object.isExtensible(value)
1227
- ? 0 /* INVALID */
1226
+ return value["__v_skip" /* ReactiveFlags.SKIP */] || !Object.isExtensible(value)
1227
+ ? 0 /* TargetType.INVALID */
1228
1228
  : targetTypeMap(toRawType(value));
1229
1229
  }
1230
1230
  function reactive(target) {
@@ -1267,8 +1267,8 @@ function createReactiveObject(target, isReadonly, baseHandlers, collectionHandle
1267
1267
  }
1268
1268
  // target is already a Proxy, return it.
1269
1269
  // exception: calling readonly() on a reactive object
1270
- if (target["__v_raw" /* RAW */] &&
1271
- !(isReadonly && target["__v_isReactive" /* IS_REACTIVE */])) {
1270
+ if (target["__v_raw" /* ReactiveFlags.RAW */] &&
1271
+ !(isReadonly && target["__v_isReactive" /* ReactiveFlags.IS_REACTIVE */])) {
1272
1272
  return target;
1273
1273
  }
1274
1274
  // target already has corresponding Proxy
@@ -1278,34 +1278,34 @@ function createReactiveObject(target, isReadonly, baseHandlers, collectionHandle
1278
1278
  }
1279
1279
  // only specific value types can be observed.
1280
1280
  const targetType = getTargetType(target);
1281
- if (targetType === 0 /* INVALID */) {
1281
+ if (targetType === 0 /* TargetType.INVALID */) {
1282
1282
  return target;
1283
1283
  }
1284
- const proxy = new Proxy(target, targetType === 2 /* COLLECTION */ ? collectionHandlers : baseHandlers);
1284
+ const proxy = new Proxy(target, targetType === 2 /* TargetType.COLLECTION */ ? collectionHandlers : baseHandlers);
1285
1285
  proxyMap.set(target, proxy);
1286
1286
  return proxy;
1287
1287
  }
1288
1288
  function isReactive(value) {
1289
1289
  if (isReadonly(value)) {
1290
- return isReactive(value["__v_raw" /* RAW */]);
1290
+ return isReactive(value["__v_raw" /* ReactiveFlags.RAW */]);
1291
1291
  }
1292
- return !!(value && value["__v_isReactive" /* IS_REACTIVE */]);
1292
+ return !!(value && value["__v_isReactive" /* ReactiveFlags.IS_REACTIVE */]);
1293
1293
  }
1294
1294
  function isReadonly(value) {
1295
- return !!(value && value["__v_isReadonly" /* IS_READONLY */]);
1295
+ return !!(value && value["__v_isReadonly" /* ReactiveFlags.IS_READONLY */]);
1296
1296
  }
1297
1297
  function isShallow(value) {
1298
- return !!(value && value["__v_isShallow" /* IS_SHALLOW */]);
1298
+ return !!(value && value["__v_isShallow" /* ReactiveFlags.IS_SHALLOW */]);
1299
1299
  }
1300
1300
  function isProxy(value) {
1301
1301
  return isReactive(value) || isReadonly(value);
1302
1302
  }
1303
1303
  function toRaw(observed) {
1304
- const raw = observed && observed["__v_raw" /* RAW */];
1304
+ const raw = observed && observed["__v_raw" /* ReactiveFlags.RAW */];
1305
1305
  return raw ? toRaw(raw) : observed;
1306
1306
  }
1307
1307
  function markRaw(value) {
1308
- def(value, "__v_skip" /* SKIP */, true);
1308
+ def(value, "__v_skip" /* ReactiveFlags.SKIP */, true);
1309
1309
  return value;
1310
1310
  }
1311
1311
  const toReactive = (value) => isObject(value) ? reactive(value) : value;
@@ -1317,7 +1317,7 @@ function trackRefValue(ref) {
1317
1317
  {
1318
1318
  trackEffects(ref.dep || (ref.dep = createDep()), {
1319
1319
  target: ref,
1320
- type: "get" /* GET */,
1320
+ type: "get" /* TrackOpTypes.GET */,
1321
1321
  key: 'value'
1322
1322
  });
1323
1323
  }
@@ -1329,7 +1329,7 @@ function triggerRefValue(ref, newVal) {
1329
1329
  {
1330
1330
  triggerEffects(ref.dep, {
1331
1331
  target: ref,
1332
- type: "set" /* SET */,
1332
+ type: "set" /* TriggerOpTypes.SET */,
1333
1333
  key: 'value',
1334
1334
  newValue: newVal
1335
1335
  });
@@ -1364,10 +1364,11 @@ class RefImpl {
1364
1364
  return this._value;
1365
1365
  }
1366
1366
  set value(newVal) {
1367
- newVal = this.__v_isShallow ? newVal : toRaw(newVal);
1367
+ const useDirectValue = this.__v_isShallow || isShallow(newVal) || isReadonly(newVal);
1368
+ newVal = useDirectValue ? newVal : toRaw(newVal);
1368
1369
  if (hasChanged(newVal, this._rawValue)) {
1369
1370
  this._rawValue = newVal;
1370
- this._value = this.__v_isShallow ? newVal : toReactive(newVal);
1371
+ this._value = useDirectValue ? newVal : toReactive(newVal);
1371
1372
  triggerRefValue(this, newVal);
1372
1373
  }
1373
1374
  }
@@ -1446,11 +1447,13 @@ function toRef(object, key, defaultValue) {
1446
1447
  : new ObjectRefImpl(object, key, defaultValue);
1447
1448
  }
1448
1449
 
1450
+ var _a;
1449
1451
  class ComputedRefImpl {
1450
1452
  constructor(getter, _setter, isReadonly, isSSR) {
1451
1453
  this._setter = _setter;
1452
1454
  this.dep = undefined;
1453
1455
  this.__v_isRef = true;
1456
+ this[_a] = false;
1454
1457
  this._dirty = true;
1455
1458
  this.effect = new ReactiveEffect(getter, () => {
1456
1459
  if (!this._dirty) {
@@ -1460,7 +1463,7 @@ class ComputedRefImpl {
1460
1463
  });
1461
1464
  this.effect.computed = this;
1462
1465
  this.effect.active = this._cacheable = !isSSR;
1463
- this["__v_isReadonly" /* IS_READONLY */] = isReadonly;
1466
+ this["__v_isReadonly" /* ReactiveFlags.IS_READONLY */] = isReadonly;
1464
1467
  }
1465
1468
  get value() {
1466
1469
  // the computed ref may get wrapped by other proxies e.g. readonly() #3376
@@ -1476,6 +1479,7 @@ class ComputedRefImpl {
1476
1479
  this._setter(newValue);
1477
1480
  }
1478
1481
  }
1482
+ _a = "__v_isReadonly" /* ReactiveFlags.IS_READONLY */;
1479
1483
  function computed(getterOrOptions, debugOptions, isSSR = false) {
1480
1484
  let getter;
1481
1485
  let setter;
@@ -1514,7 +1518,7 @@ function warn$1(msg, ...args) {
1514
1518
  const appWarnHandler = instance && instance.appContext.config.warnHandler;
1515
1519
  const trace = getComponentTrace();
1516
1520
  if (appWarnHandler) {
1517
- callWithErrorHandling(appWarnHandler, instance, 11 /* APP_WARN_HANDLER */, [
1521
+ callWithErrorHandling(appWarnHandler, instance, 11 /* ErrorCodes.APP_WARN_HANDLER */, [
1518
1522
  msg + args.join(''),
1519
1523
  instance && instance.proxy,
1520
1524
  trace
@@ -1614,35 +1618,35 @@ function formatProp(key, value, raw) {
1614
1618
  }
1615
1619
 
1616
1620
  const ErrorTypeStrings = {
1617
- ["sp" /* SERVER_PREFETCH */]: 'serverPrefetch hook',
1618
- ["bc" /* BEFORE_CREATE */]: 'beforeCreate hook',
1619
- ["c" /* CREATED */]: 'created hook',
1620
- ["bm" /* BEFORE_MOUNT */]: 'beforeMount hook',
1621
- ["m" /* MOUNTED */]: 'mounted hook',
1622
- ["bu" /* BEFORE_UPDATE */]: 'beforeUpdate hook',
1623
- ["u" /* UPDATED */]: 'updated',
1624
- ["bum" /* BEFORE_UNMOUNT */]: 'beforeUnmount hook',
1625
- ["um" /* UNMOUNTED */]: 'unmounted hook',
1626
- ["a" /* ACTIVATED */]: 'activated hook',
1627
- ["da" /* DEACTIVATED */]: 'deactivated hook',
1628
- ["ec" /* ERROR_CAPTURED */]: 'errorCaptured hook',
1629
- ["rtc" /* RENDER_TRACKED */]: 'renderTracked hook',
1630
- ["rtg" /* RENDER_TRIGGERED */]: 'renderTriggered hook',
1631
- [0 /* SETUP_FUNCTION */]: 'setup function',
1632
- [1 /* RENDER_FUNCTION */]: 'render function',
1633
- [2 /* WATCH_GETTER */]: 'watcher getter',
1634
- [3 /* WATCH_CALLBACK */]: 'watcher callback',
1635
- [4 /* WATCH_CLEANUP */]: 'watcher cleanup function',
1636
- [5 /* NATIVE_EVENT_HANDLER */]: 'native event handler',
1637
- [6 /* COMPONENT_EVENT_HANDLER */]: 'component event handler',
1638
- [7 /* VNODE_HOOK */]: 'vnode hook',
1639
- [8 /* DIRECTIVE_HOOK */]: 'directive hook',
1640
- [9 /* TRANSITION_HOOK */]: 'transition hook',
1641
- [10 /* APP_ERROR_HANDLER */]: 'app errorHandler',
1642
- [11 /* APP_WARN_HANDLER */]: 'app warnHandler',
1643
- [12 /* FUNCTION_REF */]: 'ref function',
1644
- [13 /* ASYNC_COMPONENT_LOADER */]: 'async component loader',
1645
- [14 /* SCHEDULER */]: 'scheduler flush. This is likely a Vue internals bug. ' +
1621
+ ["sp" /* LifecycleHooks.SERVER_PREFETCH */]: 'serverPrefetch hook',
1622
+ ["bc" /* LifecycleHooks.BEFORE_CREATE */]: 'beforeCreate hook',
1623
+ ["c" /* LifecycleHooks.CREATED */]: 'created hook',
1624
+ ["bm" /* LifecycleHooks.BEFORE_MOUNT */]: 'beforeMount hook',
1625
+ ["m" /* LifecycleHooks.MOUNTED */]: 'mounted hook',
1626
+ ["bu" /* LifecycleHooks.BEFORE_UPDATE */]: 'beforeUpdate hook',
1627
+ ["u" /* LifecycleHooks.UPDATED */]: 'updated',
1628
+ ["bum" /* LifecycleHooks.BEFORE_UNMOUNT */]: 'beforeUnmount hook',
1629
+ ["um" /* LifecycleHooks.UNMOUNTED */]: 'unmounted hook',
1630
+ ["a" /* LifecycleHooks.ACTIVATED */]: 'activated hook',
1631
+ ["da" /* LifecycleHooks.DEACTIVATED */]: 'deactivated hook',
1632
+ ["ec" /* LifecycleHooks.ERROR_CAPTURED */]: 'errorCaptured hook',
1633
+ ["rtc" /* LifecycleHooks.RENDER_TRACKED */]: 'renderTracked hook',
1634
+ ["rtg" /* LifecycleHooks.RENDER_TRIGGERED */]: 'renderTriggered hook',
1635
+ [0 /* ErrorCodes.SETUP_FUNCTION */]: 'setup function',
1636
+ [1 /* ErrorCodes.RENDER_FUNCTION */]: 'render function',
1637
+ [2 /* ErrorCodes.WATCH_GETTER */]: 'watcher getter',
1638
+ [3 /* ErrorCodes.WATCH_CALLBACK */]: 'watcher callback',
1639
+ [4 /* ErrorCodes.WATCH_CLEANUP */]: 'watcher cleanup function',
1640
+ [5 /* ErrorCodes.NATIVE_EVENT_HANDLER */]: 'native event handler',
1641
+ [6 /* ErrorCodes.COMPONENT_EVENT_HANDLER */]: 'component event handler',
1642
+ [7 /* ErrorCodes.VNODE_HOOK */]: 'vnode hook',
1643
+ [8 /* ErrorCodes.DIRECTIVE_HOOK */]: 'directive hook',
1644
+ [9 /* ErrorCodes.TRANSITION_HOOK */]: 'transition hook',
1645
+ [10 /* ErrorCodes.APP_ERROR_HANDLER */]: 'app errorHandler',
1646
+ [11 /* ErrorCodes.APP_WARN_HANDLER */]: 'app warnHandler',
1647
+ [12 /* ErrorCodes.FUNCTION_REF */]: 'ref function',
1648
+ [13 /* ErrorCodes.ASYNC_COMPONENT_LOADER */]: 'async component loader',
1649
+ [14 /* ErrorCodes.SCHEDULER */]: 'scheduler flush. This is likely a Vue internals bug. ' +
1646
1650
  'Please open an issue at https://new-issue.vuejs.org/?repo=vuejs/core'
1647
1651
  };
1648
1652
  function callWithErrorHandling(fn, instance, type, args) {
@@ -1693,7 +1697,7 @@ function handleError(err, instance, type, throwInDev = true) {
1693
1697
  // app-level handling
1694
1698
  const appErrorHandler = instance.appContext.config.errorHandler;
1695
1699
  if (appErrorHandler) {
1696
- callWithErrorHandling(appErrorHandler, null, 10 /* APP_ERROR_HANDLER */, [err, exposedInstance, errorInfo]);
1700
+ callWithErrorHandling(appErrorHandler, null, 10 /* ErrorCodes.APP_ERROR_HANDLER */, [err, exposedInstance, errorInfo]);
1697
1701
  return;
1698
1702
  }
1699
1703
  }
@@ -1723,15 +1727,11 @@ let isFlushing = false;
1723
1727
  let isFlushPending = false;
1724
1728
  const queue = [];
1725
1729
  let flushIndex = 0;
1726
- const pendingPreFlushCbs = [];
1727
- let activePreFlushCbs = null;
1728
- let preFlushIndex = 0;
1729
1730
  const pendingPostFlushCbs = [];
1730
1731
  let activePostFlushCbs = null;
1731
1732
  let postFlushIndex = 0;
1732
1733
  const resolvedPromise = /*#__PURE__*/ Promise.resolve();
1733
1734
  let currentFlushPromise = null;
1734
- let currentPreFlushParentJob = null;
1735
1735
  const RECURSION_LIMIT = 100;
1736
1736
  function nextTick(fn) {
1737
1737
  const p = currentFlushPromise || resolvedPromise;
@@ -1759,9 +1759,8 @@ function queueJob(job) {
1759
1759
  // if the job is a watch() callback, the search will start with a +1 index to
1760
1760
  // allow it recursively trigger itself - it is the user's responsibility to
1761
1761
  // ensure it doesn't end up in an infinite loop.
1762
- if ((!queue.length ||
1763
- !queue.includes(job, isFlushing && job.allowRecurse ? flushIndex + 1 : flushIndex)) &&
1764
- job !== currentPreFlushParentJob) {
1762
+ if (!queue.length ||
1763
+ !queue.includes(job, isFlushing && job.allowRecurse ? flushIndex + 1 : flushIndex)) {
1765
1764
  if (job.id == null) {
1766
1765
  queue.push(job);
1767
1766
  }
@@ -1783,51 +1782,40 @@ function invalidateJob(job) {
1783
1782
  queue.splice(i, 1);
1784
1783
  }
1785
1784
  }
1786
- function queueCb(cb, activeQueue, pendingQueue, index) {
1785
+ function queuePostFlushCb(cb) {
1787
1786
  if (!isArray(cb)) {
1788
- if (!activeQueue ||
1789
- !activeQueue.includes(cb, cb.allowRecurse ? index + 1 : index)) {
1790
- pendingQueue.push(cb);
1787
+ if (!activePostFlushCbs ||
1788
+ !activePostFlushCbs.includes(cb, cb.allowRecurse ? postFlushIndex + 1 : postFlushIndex)) {
1789
+ pendingPostFlushCbs.push(cb);
1791
1790
  }
1792
1791
  }
1793
1792
  else {
1794
1793
  // if cb is an array, it is a component lifecycle hook which can only be
1795
1794
  // triggered by a job, which is already deduped in the main queue, so
1796
1795
  // we can skip duplicate check here to improve perf
1797
- pendingQueue.push(...cb);
1796
+ pendingPostFlushCbs.push(...cb);
1798
1797
  }
1799
1798
  queueFlush();
1800
1799
  }
1801
- function queuePreFlushCb(cb) {
1802
- queueCb(cb, activePreFlushCbs, pendingPreFlushCbs, preFlushIndex);
1803
- }
1804
- function queuePostFlushCb(cb) {
1805
- queueCb(cb, activePostFlushCbs, pendingPostFlushCbs, postFlushIndex);
1806
- }
1807
- function flushPreFlushCbs(seen, parentJob = null) {
1808
- if (pendingPreFlushCbs.length) {
1809
- currentPreFlushParentJob = parentJob;
1810
- activePreFlushCbs = [...new Set(pendingPreFlushCbs)];
1811
- pendingPreFlushCbs.length = 0;
1812
- {
1813
- seen = seen || new Map();
1814
- }
1815
- for (preFlushIndex = 0; preFlushIndex < activePreFlushCbs.length; preFlushIndex++) {
1816
- if (checkRecursiveUpdates(seen, activePreFlushCbs[preFlushIndex])) {
1800
+ function flushPreFlushCbs(seen,
1801
+ // if currently flushing, skip the current job itself
1802
+ i = isFlushing ? flushIndex + 1 : 0) {
1803
+ {
1804
+ seen = seen || new Map();
1805
+ }
1806
+ for (; i < queue.length; i++) {
1807
+ const cb = queue[i];
1808
+ if (cb && cb.pre) {
1809
+ if (checkRecursiveUpdates(seen, cb)) {
1817
1810
  continue;
1818
1811
  }
1819
- activePreFlushCbs[preFlushIndex]();
1812
+ queue.splice(i, 1);
1813
+ i--;
1814
+ cb();
1820
1815
  }
1821
- activePreFlushCbs = null;
1822
- preFlushIndex = 0;
1823
- currentPreFlushParentJob = null;
1824
- // recursively flush until it drains
1825
- flushPreFlushCbs(seen, parentJob);
1826
1816
  }
1827
1817
  }
1828
1818
  function flushPostFlushCbs(seen) {
1829
- // flush any pre cbs queued during the flush (e.g. pre watchers)
1830
- flushPreFlushCbs();
1831
1819
  if (pendingPostFlushCbs.length) {
1832
1820
  const deduped = [...new Set(pendingPostFlushCbs)];
1833
1821
  pendingPostFlushCbs.length = 0;
@@ -1852,13 +1840,22 @@ function flushPostFlushCbs(seen) {
1852
1840
  }
1853
1841
  }
1854
1842
  const getId = (job) => job.id == null ? Infinity : job.id;
1843
+ const comparator = (a, b) => {
1844
+ const diff = getId(a) - getId(b);
1845
+ if (diff === 0) {
1846
+ if (a.pre && !b.pre)
1847
+ return -1;
1848
+ if (b.pre && !a.pre)
1849
+ return 1;
1850
+ }
1851
+ return diff;
1852
+ };
1855
1853
  function flushJobs(seen) {
1856
1854
  isFlushPending = false;
1857
1855
  isFlushing = true;
1858
1856
  {
1859
1857
  seen = seen || new Map();
1860
1858
  }
1861
- flushPreFlushCbs(seen);
1862
1859
  // Sort queue before flush.
1863
1860
  // This ensures that:
1864
1861
  // 1. Components are updated from parent to child. (because parent is always
@@ -1866,7 +1863,7 @@ function flushJobs(seen) {
1866
1863
  // priority number)
1867
1864
  // 2. If a component is unmounted during a parent component's update,
1868
1865
  // its update can be skipped.
1869
- queue.sort((a, b) => getId(a) - getId(b));
1866
+ queue.sort(comparator);
1870
1867
  // conditional usage of checkRecursiveUpdate must be determined out of
1871
1868
  // try ... catch block since Rollup by default de-optimizes treeshaking
1872
1869
  // inside try-catch. This can leave all warning code unshaked. Although
@@ -1882,7 +1879,7 @@ function flushJobs(seen) {
1882
1879
  continue;
1883
1880
  }
1884
1881
  // console.log(`running:`, job.id)
1885
- callWithErrorHandling(job, null, 14 /* SCHEDULER */);
1882
+ callWithErrorHandling(job, null, 14 /* ErrorCodes.SCHEDULER */);
1886
1883
  }
1887
1884
  }
1888
1885
  }
@@ -1894,9 +1891,7 @@ function flushJobs(seen) {
1894
1891
  currentFlushPromise = null;
1895
1892
  // some postFlushCb queued jobs!
1896
1893
  // keep flushing until it drains.
1897
- if (queue.length ||
1898
- pendingPreFlushCbs.length ||
1899
- pendingPostFlushCbs.length) {
1894
+ if (queue.length || pendingPostFlushCbs.length) {
1900
1895
  flushJobs(seen);
1901
1896
  }
1902
1897
  }
@@ -2114,7 +2109,7 @@ function setDevtoolsHook(hook, target) {
2114
2109
  }
2115
2110
  }
2116
2111
  function devtoolsInitApp(app, version) {
2117
- emit("app:init" /* APP_INIT */, app, version, {
2112
+ emit("app:init" /* DevtoolsHooks.APP_INIT */, app, version, {
2118
2113
  Fragment,
2119
2114
  Text,
2120
2115
  Comment,
@@ -2122,27 +2117,27 @@ function devtoolsInitApp(app, version) {
2122
2117
  });
2123
2118
  }
2124
2119
  function devtoolsUnmountApp(app) {
2125
- emit("app:unmount" /* APP_UNMOUNT */, app);
2120
+ emit("app:unmount" /* DevtoolsHooks.APP_UNMOUNT */, app);
2126
2121
  }
2127
- const devtoolsComponentAdded = /*#__PURE__*/ createDevtoolsComponentHook("component:added" /* COMPONENT_ADDED */);
2122
+ const devtoolsComponentAdded = /*#__PURE__*/ createDevtoolsComponentHook("component:added" /* DevtoolsHooks.COMPONENT_ADDED */);
2128
2123
  const devtoolsComponentUpdated =
2129
- /*#__PURE__*/ createDevtoolsComponentHook("component:updated" /* COMPONENT_UPDATED */);
2124
+ /*#__PURE__*/ createDevtoolsComponentHook("component:updated" /* DevtoolsHooks.COMPONENT_UPDATED */);
2130
2125
  const devtoolsComponentRemoved =
2131
- /*#__PURE__*/ createDevtoolsComponentHook("component:removed" /* COMPONENT_REMOVED */);
2126
+ /*#__PURE__*/ createDevtoolsComponentHook("component:removed" /* DevtoolsHooks.COMPONENT_REMOVED */);
2132
2127
  function createDevtoolsComponentHook(hook) {
2133
2128
  return (component) => {
2134
2129
  emit(hook, component.appContext.app, component.uid, component.parent ? component.parent.uid : undefined, component);
2135
2130
  };
2136
2131
  }
2137
- const devtoolsPerfStart = /*#__PURE__*/ createDevtoolsPerformanceHook("perf:start" /* PERFORMANCE_START */);
2138
- const devtoolsPerfEnd = /*#__PURE__*/ createDevtoolsPerformanceHook("perf:end" /* PERFORMANCE_END */);
2132
+ const devtoolsPerfStart = /*#__PURE__*/ createDevtoolsPerformanceHook("perf:start" /* DevtoolsHooks.PERFORMANCE_START */);
2133
+ const devtoolsPerfEnd = /*#__PURE__*/ createDevtoolsPerformanceHook("perf:end" /* DevtoolsHooks.PERFORMANCE_END */);
2139
2134
  function createDevtoolsPerformanceHook(hook) {
2140
2135
  return (component, type, time) => {
2141
2136
  emit(hook, component.appContext.app, component.uid, component, type, time);
2142
2137
  };
2143
2138
  }
2144
2139
  function devtoolsComponentEmit(component, event, params) {
2145
- emit("component:emit" /* COMPONENT_EMIT */, component.appContext.app, component, event, params);
2140
+ emit("component:emit" /* DevtoolsHooks.COMPONENT_EMIT */, component.appContext.app, component, event, params);
2146
2141
  }
2147
2142
 
2148
2143
  function emit$1(instance, event, ...rawArgs) {
@@ -2207,7 +2202,7 @@ function emit$1(instance, event, ...rawArgs) {
2207
2202
  handler = props[(handlerName = toHandlerKey(hyphenate(event)))];
2208
2203
  }
2209
2204
  if (handler) {
2210
- callWithAsyncErrorHandling(handler, instance, 6 /* COMPONENT_EVENT_HANDLER */, args);
2205
+ callWithAsyncErrorHandling(handler, instance, 6 /* ErrorCodes.COMPONENT_EVENT_HANDLER */, args);
2211
2206
  }
2212
2207
  const onceHandler = props[handlerName + `Once`];
2213
2208
  if (onceHandler) {
@@ -2218,7 +2213,7 @@ function emit$1(instance, event, ...rawArgs) {
2218
2213
  return;
2219
2214
  }
2220
2215
  instance.emitted[handlerName] = true;
2221
- callWithAsyncErrorHandling(onceHandler, instance, 6 /* COMPONENT_EVENT_HANDLER */, args);
2216
+ callWithAsyncErrorHandling(onceHandler, instance, 6 /* ErrorCodes.COMPONENT_EVENT_HANDLER */, args);
2222
2217
  }
2223
2218
  }
2224
2219
  function normalizeEmitsOptions(comp, appContext, asMixin = false) {
@@ -2250,7 +2245,9 @@ function normalizeEmitsOptions(comp, appContext, asMixin = false) {
2250
2245
  }
2251
2246
  }
2252
2247
  if (!raw && !hasExtends) {
2253
- cache.set(comp, null);
2248
+ if (isObject(comp)) {
2249
+ cache.set(comp, null);
2250
+ }
2254
2251
  return null;
2255
2252
  }
2256
2253
  if (isArray(raw)) {
@@ -2259,7 +2256,9 @@ function normalizeEmitsOptions(comp, appContext, asMixin = false) {
2259
2256
  else {
2260
2257
  extend(normalized, raw);
2261
2258
  }
2262
- cache.set(comp, normalized);
2259
+ if (isObject(comp)) {
2260
+ cache.set(comp, normalized);
2261
+ }
2263
2262
  return normalized;
2264
2263
  }
2265
2264
  // Check if an incoming prop key is a declared emit event listener.
@@ -2378,7 +2377,7 @@ function renderComponentRoot(instance) {
2378
2377
  accessedAttrs = false;
2379
2378
  }
2380
2379
  try {
2381
- if (vnode.shapeFlag & 4 /* STATEFUL_COMPONENT */) {
2380
+ if (vnode.shapeFlag & 4 /* ShapeFlags.STATEFUL_COMPONENT */) {
2382
2381
  // withProxy is a proxy with a different `has` trap only for
2383
2382
  // runtime-compiled render functions using `with` block.
2384
2383
  const proxyToUse = withProxy || proxy;
@@ -2411,7 +2410,7 @@ function renderComponentRoot(instance) {
2411
2410
  }
2412
2411
  catch (err) {
2413
2412
  blockStack.length = 0;
2414
- handleError(err, instance, 1 /* RENDER_FUNCTION */);
2413
+ handleError(err, instance, 1 /* ErrorCodes.RENDER_FUNCTION */);
2415
2414
  result = createVNode(Comment);
2416
2415
  }
2417
2416
  // attr merging
@@ -2420,14 +2419,14 @@ function renderComponentRoot(instance) {
2420
2419
  let root = result;
2421
2420
  let setRoot = undefined;
2422
2421
  if (result.patchFlag > 0 &&
2423
- result.patchFlag & 2048 /* DEV_ROOT_FRAGMENT */) {
2422
+ result.patchFlag & 2048 /* PatchFlags.DEV_ROOT_FRAGMENT */) {
2424
2423
  [root, setRoot] = getChildRoot(result);
2425
2424
  }
2426
2425
  if (fallthroughAttrs && inheritAttrs !== false) {
2427
2426
  const keys = Object.keys(fallthroughAttrs);
2428
2427
  const { shapeFlag } = root;
2429
2428
  if (keys.length) {
2430
- if (shapeFlag & (1 /* ELEMENT */ | 6 /* COMPONENT */)) {
2429
+ if (shapeFlag & (1 /* ShapeFlags.ELEMENT */ | 6 /* ShapeFlags.COMPONENT */)) {
2431
2430
  if (propsOptions && keys.some(isModelListener)) {
2432
2431
  // If a v-model listener (onUpdate:xxx) has a corresponding declared
2433
2432
  // prop, it indicates this component expects to handle v-model and
@@ -2568,7 +2567,7 @@ const filterModelListeners = (attrs, props) => {
2568
2567
  return res;
2569
2568
  };
2570
2569
  const isElementRoot = (vnode) => {
2571
- return (vnode.shapeFlag & (6 /* COMPONENT */ | 1 /* ELEMENT */) ||
2570
+ return (vnode.shapeFlag & (6 /* ShapeFlags.COMPONENT */ | 1 /* ShapeFlags.ELEMENT */) ||
2572
2571
  vnode.type === Comment // potential v-if branch switch
2573
2572
  );
2574
2573
  };
@@ -2587,19 +2586,19 @@ function shouldUpdateComponent(prevVNode, nextVNode, optimized) {
2587
2586
  return true;
2588
2587
  }
2589
2588
  if (optimized && patchFlag >= 0) {
2590
- if (patchFlag & 1024 /* DYNAMIC_SLOTS */) {
2589
+ if (patchFlag & 1024 /* PatchFlags.DYNAMIC_SLOTS */) {
2591
2590
  // slot content that references values that might have changed,
2592
2591
  // e.g. in a v-for
2593
2592
  return true;
2594
2593
  }
2595
- if (patchFlag & 16 /* FULL_PROPS */) {
2594
+ if (patchFlag & 16 /* PatchFlags.FULL_PROPS */) {
2596
2595
  if (!prevProps) {
2597
2596
  return !!nextProps;
2598
2597
  }
2599
2598
  // presence of this flag indicates props are always non-null
2600
2599
  return hasPropsChanged(prevProps, nextProps, emits);
2601
2600
  }
2602
- else if (patchFlag & 8 /* PROPS */) {
2601
+ else if (patchFlag & 8 /* PatchFlags.PROPS */) {
2603
2602
  const dynamicProps = nextVNode.dynamicProps;
2604
2603
  for (let i = 0; i < dynamicProps.length; i++) {
2605
2604
  const key = dynamicProps[i];
@@ -2857,7 +2856,7 @@ function createSuspenseBoundary(vnode, parent, parentComponent, container, hidde
2857
2856
  if (delayEnter) {
2858
2857
  activeBranch.transition.afterLeave = () => {
2859
2858
  if (pendingId === suspense.pendingId) {
2860
- move(pendingBranch, container, anchor, 0 /* ENTER */);
2859
+ move(pendingBranch, container, anchor, 0 /* MoveType.ENTER */);
2861
2860
  }
2862
2861
  };
2863
2862
  }
@@ -2872,7 +2871,7 @@ function createSuspenseBoundary(vnode, parent, parentComponent, container, hidde
2872
2871
  }
2873
2872
  if (!delayEnter) {
2874
2873
  // move content from off-dom container to actual container
2875
- move(pendingBranch, container, anchor, 0 /* ENTER */);
2874
+ move(pendingBranch, container, anchor, 0 /* MoveType.ENTER */);
2876
2875
  }
2877
2876
  }
2878
2877
  setActiveBranch(suspense, pendingBranch);
@@ -2946,7 +2945,7 @@ function createSuspenseBoundary(vnode, parent, parentComponent, container, hidde
2946
2945
  const hydratedEl = instance.vnode.el;
2947
2946
  instance
2948
2947
  .asyncDep.catch(err => {
2949
- handleError(err, instance, 0 /* SETUP_FUNCTION */);
2948
+ handleError(err, instance, 0 /* ErrorCodes.SETUP_FUNCTION */);
2950
2949
  })
2951
2950
  .then(asyncSetupResult => {
2952
2951
  // retry when the setup() promise resolves.
@@ -3020,7 +3019,7 @@ function hydrateSuspense(node, vnode, parentComponent, parentSuspense, isSVG, sl
3020
3019
  }
3021
3020
  function normalizeSuspenseChildren(vnode) {
3022
3021
  const { shapeFlag, children } = vnode;
3023
- const isSlotChildren = shapeFlag & 32 /* SLOTS_CHILDREN */;
3022
+ const isSlotChildren = shapeFlag & 32 /* ShapeFlags.SLOTS_CHILDREN */;
3024
3023
  vnode.ssContent = normalizeSuspenseSlot(isSlotChildren ? children.default : children);
3025
3024
  vnode.ssFallback = isSlotChildren
3026
3025
  ? normalizeSuspenseSlot(children.fallback)
@@ -3191,7 +3190,7 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
3191
3190
  return traverse(s);
3192
3191
  }
3193
3192
  else if (isFunction(s)) {
3194
- return callWithErrorHandling(s, instance, 2 /* WATCH_GETTER */);
3193
+ return callWithErrorHandling(s, instance, 2 /* ErrorCodes.WATCH_GETTER */);
3195
3194
  }
3196
3195
  else {
3197
3196
  warnInvalidSource(s);
@@ -3201,7 +3200,7 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
3201
3200
  else if (isFunction(source)) {
3202
3201
  if (cb) {
3203
3202
  // getter with cb
3204
- getter = () => callWithErrorHandling(source, instance, 2 /* WATCH_GETTER */);
3203
+ getter = () => callWithErrorHandling(source, instance, 2 /* ErrorCodes.WATCH_GETTER */);
3205
3204
  }
3206
3205
  else {
3207
3206
  // no cb -> simple effect
@@ -3212,7 +3211,7 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
3212
3211
  if (cleanup) {
3213
3212
  cleanup();
3214
3213
  }
3215
- return callWithAsyncErrorHandling(source, instance, 3 /* WATCH_CALLBACK */, [onCleanup]);
3214
+ return callWithAsyncErrorHandling(source, instance, 3 /* ErrorCodes.WATCH_CALLBACK */, [onCleanup]);
3216
3215
  };
3217
3216
  }
3218
3217
  }
@@ -3227,7 +3226,7 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
3227
3226
  let cleanup;
3228
3227
  let onCleanup = (fn) => {
3229
3228
  cleanup = effect.onStop = () => {
3230
- callWithErrorHandling(fn, instance, 4 /* WATCH_CLEANUP */);
3229
+ callWithErrorHandling(fn, instance, 4 /* ErrorCodes.WATCH_CLEANUP */);
3231
3230
  };
3232
3231
  };
3233
3232
  let oldValue = isMultiSource ? [] : INITIAL_WATCHER_VALUE;
@@ -3248,7 +3247,7 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
3248
3247
  if (cleanup) {
3249
3248
  cleanup();
3250
3249
  }
3251
- callWithAsyncErrorHandling(cb, instance, 3 /* WATCH_CALLBACK */, [
3250
+ callWithAsyncErrorHandling(cb, instance, 3 /* ErrorCodes.WATCH_CALLBACK */, [
3252
3251
  newValue,
3253
3252
  // pass undefined as the old value when it's changed for the first time
3254
3253
  oldValue === INITIAL_WATCHER_VALUE ? undefined : oldValue,
@@ -3274,7 +3273,10 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
3274
3273
  }
3275
3274
  else {
3276
3275
  // default: 'pre'
3277
- scheduler = () => queuePreFlushCb(job);
3276
+ job.pre = true;
3277
+ if (instance)
3278
+ job.id = instance.uid;
3279
+ scheduler = () => queueJob(job);
3278
3280
  }
3279
3281
  const effect = new ReactiveEffect(getter, scheduler);
3280
3282
  {
@@ -3341,7 +3343,7 @@ function createPathGetter(ctx, path) {
3341
3343
  };
3342
3344
  }
3343
3345
  function traverse(value, seen) {
3344
- if (!isObject(value) || value["__v_skip" /* SKIP */]) {
3346
+ if (!isObject(value) || value["__v_skip" /* ReactiveFlags.SKIP */]) {
3345
3347
  return value;
3346
3348
  }
3347
3349
  seen = seen || new Set();
@@ -3525,7 +3527,7 @@ function resolveTransitionHooks(vnode, props, state, instance) {
3525
3527
  const leavingVNodesCache = getLeavingNodesForType(state, vnode);
3526
3528
  const callHook = (hook, args) => {
3527
3529
  hook &&
3528
- callWithAsyncErrorHandling(hook, instance, 9 /* TRANSITION_HOOK */, args);
3530
+ callWithAsyncErrorHandling(hook, instance, 9 /* ErrorCodes.TRANSITION_HOOK */, args);
3529
3531
  };
3530
3532
  const callAsyncHook = (hook, args) => {
3531
3533
  const done = args[1];
@@ -3661,10 +3663,10 @@ function getKeepAliveChild(vnode) {
3661
3663
  : vnode;
3662
3664
  }
3663
3665
  function setTransitionHooks(vnode, hooks) {
3664
- if (vnode.shapeFlag & 6 /* COMPONENT */ && vnode.component) {
3666
+ if (vnode.shapeFlag & 6 /* ShapeFlags.COMPONENT */ && vnode.component) {
3665
3667
  setTransitionHooks(vnode.component.subTree, hooks);
3666
3668
  }
3667
- else if (vnode.shapeFlag & 128 /* SUSPENSE */) {
3669
+ else if (vnode.shapeFlag & 128 /* ShapeFlags.SUSPENSE */) {
3668
3670
  vnode.ssContent.transition = hooks.clone(vnode.ssContent);
3669
3671
  vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
3670
3672
  }
@@ -3683,7 +3685,7 @@ function getTransitionRawChildren(children, keepComment = false, parentKey) {
3683
3685
  : String(parentKey) + String(child.key != null ? child.key : i);
3684
3686
  // handle fragment children case, e.g. v-for
3685
3687
  if (child.type === Fragment) {
3686
- if (child.patchFlag & 128 /* KEYED_FRAGMENT */)
3688
+ if (child.patchFlag & 128 /* PatchFlags.KEYED_FRAGMENT */)
3687
3689
  keyedFragmentCount++;
3688
3690
  ret = ret.concat(getTransitionRawChildren(child.children, keepComment, key));
3689
3691
  }
@@ -3698,7 +3700,7 @@ function getTransitionRawChildren(children, keepComment = false, parentKey) {
3698
3700
  // these children to force full diffs to ensure correct behavior.
3699
3701
  if (keyedFragmentCount > 1) {
3700
3702
  for (let i = 0; i < ret.length; i++) {
3701
- ret[i].patchFlag = -2 /* BAIL */;
3703
+ ret[i].patchFlag = -2 /* PatchFlags.BAIL */;
3702
3704
  }
3703
3705
  }
3704
3706
  return ret;
@@ -3776,7 +3778,7 @@ function defineAsyncComponent(source) {
3776
3778
  }
3777
3779
  const onError = (err) => {
3778
3780
  pendingRequest = null;
3779
- handleError(err, instance, 13 /* ASYNC_COMPONENT_LOADER */, !errorComponent /* do not throw in dev if user provided error component */);
3781
+ handleError(err, instance, 13 /* ErrorCodes.ASYNC_COMPONENT_LOADER */, !errorComponent /* do not throw in dev if user provided error component */);
3780
3782
  };
3781
3783
  // suspense-controlled or SSR.
3782
3784
  if ((suspensible && instance.suspense) ||
@@ -3878,7 +3880,7 @@ const KeepAliveImpl = {
3878
3880
  const storageContainer = createElement('div');
3879
3881
  sharedContext.activate = (vnode, container, anchor, isSVG, optimized) => {
3880
3882
  const instance = vnode.component;
3881
- move(vnode, container, anchor, 0 /* ENTER */, parentSuspense);
3883
+ move(vnode, container, anchor, 0 /* MoveType.ENTER */, parentSuspense);
3882
3884
  // in case props have changed
3883
3885
  patch(instance.vnode, vnode, container, anchor, instance, parentSuspense, isSVG, vnode.slotScopeIds, optimized);
3884
3886
  queuePostRenderEffect(() => {
@@ -3898,7 +3900,7 @@ const KeepAliveImpl = {
3898
3900
  };
3899
3901
  sharedContext.deactivate = (vnode) => {
3900
3902
  const instance = vnode.component;
3901
- move(vnode, storageContainer, null, 1 /* LEAVE */, parentSuspense);
3903
+ move(vnode, storageContainer, null, 1 /* MoveType.LEAVE */, parentSuspense);
3902
3904
  queuePostRenderEffect(() => {
3903
3905
  if (instance.da) {
3904
3906
  invokeArrayFns(instance.da);
@@ -3987,8 +3989,8 @@ const KeepAliveImpl = {
3987
3989
  return children;
3988
3990
  }
3989
3991
  else if (!isVNode(rawVNode) ||
3990
- (!(rawVNode.shapeFlag & 4 /* STATEFUL_COMPONENT */) &&
3991
- !(rawVNode.shapeFlag & 128 /* SUSPENSE */))) {
3992
+ (!(rawVNode.shapeFlag & 4 /* ShapeFlags.STATEFUL_COMPONENT */) &&
3993
+ !(rawVNode.shapeFlag & 128 /* ShapeFlags.SUSPENSE */))) {
3992
3994
  current = null;
3993
3995
  return rawVNode;
3994
3996
  }
@@ -4010,7 +4012,7 @@ const KeepAliveImpl = {
4010
4012
  // clone vnode if it's reused because we are going to mutate it
4011
4013
  if (vnode.el) {
4012
4014
  vnode = cloneVNode(vnode);
4013
- if (rawVNode.shapeFlag & 128 /* SUSPENSE */) {
4015
+ if (rawVNode.shapeFlag & 128 /* ShapeFlags.SUSPENSE */) {
4014
4016
  rawVNode.ssContent = vnode;
4015
4017
  }
4016
4018
  }
@@ -4029,7 +4031,7 @@ const KeepAliveImpl = {
4029
4031
  setTransitionHooks(vnode, vnode.transition);
4030
4032
  }
4031
4033
  // avoid vnode being mounted as fresh
4032
- vnode.shapeFlag |= 512 /* COMPONENT_KEPT_ALIVE */;
4034
+ vnode.shapeFlag |= 512 /* ShapeFlags.COMPONENT_KEPT_ALIVE */;
4033
4035
  // make this key the freshest
4034
4036
  keys.delete(key);
4035
4037
  keys.add(key);
@@ -4042,7 +4044,7 @@ const KeepAliveImpl = {
4042
4044
  }
4043
4045
  }
4044
4046
  // avoid vnode being unmounted
4045
- vnode.shapeFlag |= 256 /* COMPONENT_SHOULD_KEEP_ALIVE */;
4047
+ vnode.shapeFlag |= 256 /* ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE */;
4046
4048
  current = vnode;
4047
4049
  return isSuspense(rawVNode.type) ? rawVNode : vnode;
4048
4050
  };
@@ -4065,10 +4067,10 @@ function matches(pattern, name) {
4065
4067
  return false;
4066
4068
  }
4067
4069
  function onActivated(hook, target) {
4068
- registerKeepAliveHook(hook, "a" /* ACTIVATED */, target);
4070
+ registerKeepAliveHook(hook, "a" /* LifecycleHooks.ACTIVATED */, target);
4069
4071
  }
4070
4072
  function onDeactivated(hook, target) {
4071
- registerKeepAliveHook(hook, "da" /* DEACTIVATED */, target);
4073
+ registerKeepAliveHook(hook, "da" /* LifecycleHooks.DEACTIVATED */, target);
4072
4074
  }
4073
4075
  function registerKeepAliveHook(hook, type, target = currentInstance) {
4074
4076
  // cache the deactivate branch check wrapper for injected hooks so the same
@@ -4112,16 +4114,16 @@ function injectToKeepAliveRoot(hook, type, target, keepAliveRoot) {
4112
4114
  }
4113
4115
  function resetShapeFlag(vnode) {
4114
4116
  let shapeFlag = vnode.shapeFlag;
4115
- if (shapeFlag & 256 /* COMPONENT_SHOULD_KEEP_ALIVE */) {
4116
- shapeFlag -= 256 /* COMPONENT_SHOULD_KEEP_ALIVE */;
4117
+ if (shapeFlag & 256 /* ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE */) {
4118
+ shapeFlag -= 256 /* ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE */;
4117
4119
  }
4118
- if (shapeFlag & 512 /* COMPONENT_KEPT_ALIVE */) {
4119
- shapeFlag -= 512 /* COMPONENT_KEPT_ALIVE */;
4120
+ if (shapeFlag & 512 /* ShapeFlags.COMPONENT_KEPT_ALIVE */) {
4121
+ shapeFlag -= 512 /* ShapeFlags.COMPONENT_KEPT_ALIVE */;
4120
4122
  }
4121
4123
  vnode.shapeFlag = shapeFlag;
4122
4124
  }
4123
4125
  function getInnerChild(vnode) {
4124
- return vnode.shapeFlag & 128 /* SUSPENSE */ ? vnode.ssContent : vnode;
4126
+ return vnode.shapeFlag & 128 /* ShapeFlags.SUSPENSE */ ? vnode.ssContent : vnode;
4125
4127
  }
4126
4128
 
4127
4129
  function injectHook(type, hook, target = currentInstance, prepend = false) {
@@ -4167,19 +4169,19 @@ function injectHook(type, hook, target = currentInstance, prepend = false) {
4167
4169
  }
4168
4170
  const createHook = (lifecycle) => (hook, target = currentInstance) =>
4169
4171
  // post-create lifecycle registrations are noops during SSR (except for serverPrefetch)
4170
- (!isInSSRComponentSetup || lifecycle === "sp" /* SERVER_PREFETCH */) &&
4172
+ (!isInSSRComponentSetup || lifecycle === "sp" /* LifecycleHooks.SERVER_PREFETCH */) &&
4171
4173
  injectHook(lifecycle, hook, target);
4172
- const onBeforeMount = createHook("bm" /* BEFORE_MOUNT */);
4173
- const onMounted = createHook("m" /* MOUNTED */);
4174
- const onBeforeUpdate = createHook("bu" /* BEFORE_UPDATE */);
4175
- const onUpdated = createHook("u" /* UPDATED */);
4176
- const onBeforeUnmount = createHook("bum" /* BEFORE_UNMOUNT */);
4177
- const onUnmounted = createHook("um" /* UNMOUNTED */);
4178
- const onServerPrefetch = createHook("sp" /* SERVER_PREFETCH */);
4179
- const onRenderTriggered = createHook("rtg" /* RENDER_TRIGGERED */);
4180
- const onRenderTracked = createHook("rtc" /* RENDER_TRACKED */);
4174
+ const onBeforeMount = createHook("bm" /* LifecycleHooks.BEFORE_MOUNT */);
4175
+ const onMounted = createHook("m" /* LifecycleHooks.MOUNTED */);
4176
+ const onBeforeUpdate = createHook("bu" /* LifecycleHooks.BEFORE_UPDATE */);
4177
+ const onUpdated = createHook("u" /* LifecycleHooks.UPDATED */);
4178
+ const onBeforeUnmount = createHook("bum" /* LifecycleHooks.BEFORE_UNMOUNT */);
4179
+ const onUnmounted = createHook("um" /* LifecycleHooks.UNMOUNTED */);
4180
+ const onServerPrefetch = createHook("sp" /* LifecycleHooks.SERVER_PREFETCH */);
4181
+ const onRenderTriggered = createHook("rtg" /* LifecycleHooks.RENDER_TRIGGERED */);
4182
+ const onRenderTracked = createHook("rtc" /* LifecycleHooks.RENDER_TRACKED */);
4181
4183
  function onErrorCaptured(hook, target = currentInstance) {
4182
- injectHook("ec" /* ERROR_CAPTURED */, hook, target);
4184
+ injectHook("ec" /* LifecycleHooks.ERROR_CAPTURED */, hook, target);
4183
4185
  }
4184
4186
 
4185
4187
  /**
@@ -4246,7 +4248,7 @@ function invokeDirectiveHook(vnode, prevVNode, instance, name) {
4246
4248
  // disable tracking inside all lifecycle hooks
4247
4249
  // since they can potentially be called inside effects.
4248
4250
  pauseTracking();
4249
- callWithAsyncErrorHandling(hook, instance, 8 /* DIRECTIVE_HOOK */, [
4251
+ callWithAsyncErrorHandling(hook, instance, 8 /* ErrorCodes.DIRECTIVE_HOOK */, [
4250
4252
  vnode.el,
4251
4253
  binding,
4252
4254
  vnode,
@@ -4291,7 +4293,7 @@ function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false
4291
4293
  const Component = instance.type;
4292
4294
  // explicit self name has highest priority
4293
4295
  if (type === COMPONENTS) {
4294
- const selfName = getComponentName(Component);
4296
+ const selfName = getComponentName(Component, false /* do not include inferred name to avoid breaking existing code */);
4295
4297
  if (selfName &&
4296
4298
  (selfName === name ||
4297
4299
  selfName === camelize(name) ||
@@ -4388,7 +4390,13 @@ function createSlots(slots, dynamicSlots) {
4388
4390
  }
4389
4391
  else if (slot) {
4390
4392
  // conditional single slot generated by <template v-if="..." #foo>
4391
- slots[slot.name] = slot.fn;
4393
+ slots[slot.name] = slot.key
4394
+ ? (...args) => {
4395
+ const res = slot.fn(...args);
4396
+ res.key = slot.key;
4397
+ return res;
4398
+ }
4399
+ : slot.fn;
4392
4400
  }
4393
4401
  }
4394
4402
  return slots;
@@ -4424,9 +4432,15 @@ fallback, noSlotted) {
4424
4432
  }
4425
4433
  openBlock();
4426
4434
  const validSlotContent = slot && ensureValidVNode(slot(props));
4427
- const rendered = createBlock(Fragment, { key: props.key || `_${name}` }, validSlotContent || (fallback ? fallback() : []), validSlotContent && slots._ === 1 /* STABLE */
4428
- ? 64 /* STABLE_FRAGMENT */
4429
- : -2 /* BAIL */);
4435
+ const rendered = createBlock(Fragment, {
4436
+ key: props.key ||
4437
+ // slot content array of a dynamic conditional slot may have a branch
4438
+ // key attached in the `createSlots` helper, respect that
4439
+ (validSlotContent && validSlotContent.key) ||
4440
+ `_${name}`
4441
+ }, validSlotContent || (fallback ? fallback() : []), validSlotContent && slots._ === 1 /* SlotFlags.STABLE */
4442
+ ? 64 /* PatchFlags.STABLE_FRAGMENT */
4443
+ : -2 /* PatchFlags.BAIL */);
4430
4444
  if (!noSlotted && rendered.scopeId) {
4431
4445
  rendered.slotScopeIds = [rendered.scopeId + '-s'];
4432
4446
  }
@@ -4454,14 +4468,16 @@ function ensureValidVNode(vnodes) {
4454
4468
  * For prefixing keys in v-on="obj" with "on"
4455
4469
  * @private
4456
4470
  */
4457
- function toHandlers(obj) {
4471
+ function toHandlers(obj, preserveCaseIfNecessary) {
4458
4472
  const ret = {};
4459
4473
  if (!isObject(obj)) {
4460
4474
  warn$1(`v-on with no argument expects an object value.`);
4461
4475
  return ret;
4462
4476
  }
4463
4477
  for (const key in obj) {
4464
- ret[toHandlerKey(key)] = obj[key];
4478
+ ret[preserveCaseIfNecessary && /[A-Z]/.test(key)
4479
+ ? `on:${key}`
4480
+ : toHandlerKey(key)] = obj[key];
4465
4481
  }
4466
4482
  return ret;
4467
4483
  }
@@ -4525,23 +4541,23 @@ const PublicInstanceProxyHandlers = {
4525
4541
  const n = accessCache[key];
4526
4542
  if (n !== undefined) {
4527
4543
  switch (n) {
4528
- case 1 /* SETUP */:
4544
+ case 1 /* AccessTypes.SETUP */:
4529
4545
  return setupState[key];
4530
- case 2 /* DATA */:
4546
+ case 2 /* AccessTypes.DATA */:
4531
4547
  return data[key];
4532
- case 4 /* CONTEXT */:
4548
+ case 4 /* AccessTypes.CONTEXT */:
4533
4549
  return ctx[key];
4534
- case 3 /* PROPS */:
4550
+ case 3 /* AccessTypes.PROPS */:
4535
4551
  return props[key];
4536
4552
  // default: just fallthrough
4537
4553
  }
4538
4554
  }
4539
4555
  else if (setupState !== EMPTY_OBJ && hasOwn(setupState, key)) {
4540
- accessCache[key] = 1 /* SETUP */;
4556
+ accessCache[key] = 1 /* AccessTypes.SETUP */;
4541
4557
  return setupState[key];
4542
4558
  }
4543
4559
  else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
4544
- accessCache[key] = 2 /* DATA */;
4560
+ accessCache[key] = 2 /* AccessTypes.DATA */;
4545
4561
  return data[key];
4546
4562
  }
4547
4563
  else if (
@@ -4549,15 +4565,15 @@ const PublicInstanceProxyHandlers = {
4549
4565
  // props
4550
4566
  (normalizedProps = instance.propsOptions[0]) &&
4551
4567
  hasOwn(normalizedProps, key)) {
4552
- accessCache[key] = 3 /* PROPS */;
4568
+ accessCache[key] = 3 /* AccessTypes.PROPS */;
4553
4569
  return props[key];
4554
4570
  }
4555
4571
  else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
4556
- accessCache[key] = 4 /* CONTEXT */;
4572
+ accessCache[key] = 4 /* AccessTypes.CONTEXT */;
4557
4573
  return ctx[key];
4558
4574
  }
4559
4575
  else if (shouldCacheAccess) {
4560
- accessCache[key] = 0 /* OTHER */;
4576
+ accessCache[key] = 0 /* AccessTypes.OTHER */;
4561
4577
  }
4562
4578
  }
4563
4579
  const publicGetter = publicPropertiesMap[key];
@@ -4565,7 +4581,7 @@ const PublicInstanceProxyHandlers = {
4565
4581
  // public $xxx properties
4566
4582
  if (publicGetter) {
4567
4583
  if (key === '$attrs') {
4568
- track(instance, "get" /* GET */, key);
4584
+ track(instance, "get" /* TrackOpTypes.GET */, key);
4569
4585
  markAttrsAccessed();
4570
4586
  }
4571
4587
  return publicGetter(instance);
@@ -4578,7 +4594,7 @@ const PublicInstanceProxyHandlers = {
4578
4594
  }
4579
4595
  else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
4580
4596
  // user may set custom properties to `this` that start with `$`
4581
- accessCache[key] = 4 /* CONTEXT */;
4597
+ accessCache[key] = 4 /* AccessTypes.CONTEXT */;
4582
4598
  return ctx[key];
4583
4599
  }
4584
4600
  else if (
@@ -4761,7 +4777,7 @@ function applyOptions(instance) {
4761
4777
  // call beforeCreate first before accessing other options since
4762
4778
  // the hook may mutate resolved options (#2791)
4763
4779
  if (options.beforeCreate) {
4764
- callHook(options.beforeCreate, instance, "bc" /* BEFORE_CREATE */);
4780
+ callHook(options.beforeCreate, instance, "bc" /* LifecycleHooks.BEFORE_CREATE */);
4765
4781
  }
4766
4782
  const {
4767
4783
  // state
@@ -4777,7 +4793,7 @@ function applyOptions(instance) {
4777
4793
  const [propsOptions] = instance.propsOptions;
4778
4794
  if (propsOptions) {
4779
4795
  for (const key in propsOptions) {
4780
- checkDuplicateProperties("Props" /* PROPS */, key);
4796
+ checkDuplicateProperties("Props" /* OptionTypes.PROPS */, key);
4781
4797
  }
4782
4798
  }
4783
4799
  }
@@ -4807,7 +4823,7 @@ function applyOptions(instance) {
4807
4823
  });
4808
4824
  }
4809
4825
  {
4810
- checkDuplicateProperties("Methods" /* METHODS */, key);
4826
+ checkDuplicateProperties("Methods" /* OptionTypes.METHODS */, key);
4811
4827
  }
4812
4828
  }
4813
4829
  else {
@@ -4834,7 +4850,7 @@ function applyOptions(instance) {
4834
4850
  instance.data = reactive(data);
4835
4851
  {
4836
4852
  for (const key in data) {
4837
- checkDuplicateProperties("Data" /* DATA */, key);
4853
+ checkDuplicateProperties("Data" /* OptionTypes.DATA */, key);
4838
4854
  // expose data on ctx during dev
4839
4855
  if (!isReservedPrefix(key[0])) {
4840
4856
  Object.defineProperty(ctx, key, {
@@ -4878,7 +4894,7 @@ function applyOptions(instance) {
4878
4894
  set: v => (c.value = v)
4879
4895
  });
4880
4896
  {
4881
- checkDuplicateProperties("Computed" /* COMPUTED */, key);
4897
+ checkDuplicateProperties("Computed" /* OptionTypes.COMPUTED */, key);
4882
4898
  }
4883
4899
  }
4884
4900
  }
@@ -4896,7 +4912,7 @@ function applyOptions(instance) {
4896
4912
  });
4897
4913
  }
4898
4914
  if (created) {
4899
- callHook(created, instance, "c" /* CREATED */);
4915
+ callHook(created, instance, "c" /* LifecycleHooks.CREATED */);
4900
4916
  }
4901
4917
  function registerLifecycleHook(register, hook) {
4902
4918
  if (isArray(hook)) {
@@ -4989,7 +5005,7 @@ function resolveInjections(injectOptions, ctx, checkDuplicateProperties = NOOP,
4989
5005
  ctx[key] = injected;
4990
5006
  }
4991
5007
  {
4992
- checkDuplicateProperties("Inject" /* INJECT */, key);
5008
+ checkDuplicateProperties("Inject" /* OptionTypes.INJECT */, key);
4993
5009
  }
4994
5010
  }
4995
5011
  }
@@ -5060,7 +5076,9 @@ function resolveMergedOptions(instance) {
5060
5076
  }
5061
5077
  mergeOptions(resolved, base, optionMergeStrategies);
5062
5078
  }
5063
- cache.set(base, resolved);
5079
+ if (isObject(base)) {
5080
+ cache.set(base, resolved);
5081
+ }
5064
5082
  return resolved;
5065
5083
  }
5066
5084
  function mergeOptions(to, from, strats, asMixin = false) {
@@ -5189,6 +5207,13 @@ isSSR = false) {
5189
5207
  }
5190
5208
  instance.attrs = attrs;
5191
5209
  }
5210
+ function isInHmrContext(instance) {
5211
+ while (instance) {
5212
+ if (instance.type.__hmrId)
5213
+ return true;
5214
+ instance = instance.parent;
5215
+ }
5216
+ }
5192
5217
  function updateProps(instance, rawProps, rawPrevProps, optimized) {
5193
5218
  const { props, attrs, vnode: { patchFlag } } = instance;
5194
5219
  const rawCurrentProps = toRaw(props);
@@ -5198,11 +5223,10 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) {
5198
5223
  // always force full diff in dev
5199
5224
  // - #1942 if hmr is enabled with sfc component
5200
5225
  // - vite#872 non-sfc component used by sfc component
5201
- !((instance.type.__hmrId ||
5202
- (instance.parent && instance.parent.type.__hmrId))) &&
5226
+ !(isInHmrContext(instance)) &&
5203
5227
  (optimized || patchFlag > 0) &&
5204
- !(patchFlag & 16 /* FULL_PROPS */)) {
5205
- if (patchFlag & 8 /* PROPS */) {
5228
+ !(patchFlag & 16 /* PatchFlags.FULL_PROPS */)) {
5229
+ if (patchFlag & 8 /* PatchFlags.PROPS */) {
5206
5230
  // Compiler-generated props & no keys change, just set the updated
5207
5231
  // the props.
5208
5232
  const propsToUpdate = instance.vnode.dynamicProps;
@@ -5281,7 +5305,7 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) {
5281
5305
  }
5282
5306
  // trigger updates for $attrs in case it's used in component slots
5283
5307
  if (hasAttrsChanged) {
5284
- trigger(instance, "set" /* SET */, '$attrs');
5308
+ trigger(instance, "set" /* TriggerOpTypes.SET */, '$attrs');
5285
5309
  }
5286
5310
  {
5287
5311
  validateProps(rawProps || {}, props, instance);
@@ -5350,11 +5374,11 @@ function resolvePropValue(options, props, key, value, instance, isAbsent) {
5350
5374
  }
5351
5375
  }
5352
5376
  // boolean casting
5353
- if (opt[0 /* shouldCast */]) {
5377
+ if (opt[0 /* BooleanFlags.shouldCast */]) {
5354
5378
  if (isAbsent && !hasDefault) {
5355
5379
  value = false;
5356
5380
  }
5357
- else if (opt[1 /* shouldCastTrue */] &&
5381
+ else if (opt[1 /* BooleanFlags.shouldCastTrue */] &&
5358
5382
  (value === '' || value === hyphenate(key))) {
5359
5383
  value = true;
5360
5384
  }
@@ -5392,7 +5416,9 @@ function normalizePropsOptions(comp, appContext, asMixin = false) {
5392
5416
  }
5393
5417
  }
5394
5418
  if (!raw && !hasExtends) {
5395
- cache.set(comp, EMPTY_ARR);
5419
+ if (isObject(comp)) {
5420
+ cache.set(comp, EMPTY_ARR);
5421
+ }
5396
5422
  return EMPTY_ARR;
5397
5423
  }
5398
5424
  if (isArray(raw)) {
@@ -5419,8 +5445,8 @@ function normalizePropsOptions(comp, appContext, asMixin = false) {
5419
5445
  if (prop) {
5420
5446
  const booleanIndex = getTypeIndex(Boolean, prop.type);
5421
5447
  const stringIndex = getTypeIndex(String, prop.type);
5422
- prop[0 /* shouldCast */] = booleanIndex > -1;
5423
- prop[1 /* shouldCastTrue */] =
5448
+ prop[0 /* BooleanFlags.shouldCast */] = booleanIndex > -1;
5449
+ prop[1 /* BooleanFlags.shouldCastTrue */] =
5424
5450
  stringIndex < 0 || booleanIndex < stringIndex;
5425
5451
  // if the prop needs boolean casting or default value
5426
5452
  if (booleanIndex > -1 || hasOwn(prop, 'default')) {
@@ -5431,7 +5457,9 @@ function normalizePropsOptions(comp, appContext, asMixin = false) {
5431
5457
  }
5432
5458
  }
5433
5459
  const res = [normalized, needCastKeys];
5434
- cache.set(comp, res);
5460
+ if (isObject(comp)) {
5461
+ cache.set(comp, res);
5462
+ }
5435
5463
  return res;
5436
5464
  }
5437
5465
  function validatePropName(key) {
@@ -5641,7 +5669,7 @@ const normalizeVNodeSlots = (instance, children) => {
5641
5669
  instance.slots.default = () => normalized;
5642
5670
  };
5643
5671
  const initSlots = (instance, children) => {
5644
- if (instance.vnode.shapeFlag & 32 /* SLOTS_CHILDREN */) {
5672
+ if (instance.vnode.shapeFlag & 32 /* ShapeFlags.SLOTS_CHILDREN */) {
5645
5673
  const type = children._;
5646
5674
  if (type) {
5647
5675
  // users can get the shallow readonly version of the slots object through `this.$slots`,
@@ -5666,7 +5694,7 @@ const updateSlots = (instance, children, optimized) => {
5666
5694
  const { vnode, slots } = instance;
5667
5695
  let needDeletionCheck = true;
5668
5696
  let deletionComparisonTarget = EMPTY_OBJ;
5669
- if (vnode.shapeFlag & 32 /* SLOTS_CHILDREN */) {
5697
+ if (vnode.shapeFlag & 32 /* ShapeFlags.SLOTS_CHILDREN */) {
5670
5698
  const type = children._;
5671
5699
  if (type) {
5672
5700
  // compiled slots.
@@ -5675,7 +5703,7 @@ const updateSlots = (instance, children, optimized) => {
5675
5703
  // force update slots and mark instance for hmr as well
5676
5704
  extend(slots, children);
5677
5705
  }
5678
- else if (optimized && type === 1 /* STABLE */) {
5706
+ else if (optimized && type === 1 /* SlotFlags.STABLE */) {
5679
5707
  // compiled AND stable.
5680
5708
  // no need to update, and skip stale slots removal.
5681
5709
  needDeletionCheck = false;
@@ -5688,7 +5716,7 @@ const updateSlots = (instance, children, optimized) => {
5688
5716
  // when rendering the optimized slots by manually written render function,
5689
5717
  // we need to delete the `slots._` flag if necessary to make subsequent updates reliable,
5690
5718
  // i.e. let the `renderSlot` create the bailed Fragment
5691
- if (!optimized && type === 1 /* STABLE */) {
5719
+ if (!optimized && type === 1 /* SlotFlags.STABLE */) {
5692
5720
  delete slots._;
5693
5721
  }
5694
5722
  }
@@ -5899,7 +5927,7 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
5899
5927
  // because the template ref is forwarded to inner component
5900
5928
  return;
5901
5929
  }
5902
- const refValue = vnode.shapeFlag & 4 /* STATEFUL_COMPONENT */
5930
+ const refValue = vnode.shapeFlag & 4 /* ShapeFlags.STATEFUL_COMPONENT */
5903
5931
  ? getExposeProxy(vnode.component) || vnode.component.proxy
5904
5932
  : vnode.el;
5905
5933
  const value = isUnmount ? null : refValue;
@@ -5925,7 +5953,7 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
5925
5953
  }
5926
5954
  }
5927
5955
  if (isFunction(ref)) {
5928
- callWithErrorHandling(ref, owner, 12 /* FUNCTION_REF */, [value, refs]);
5956
+ callWithErrorHandling(ref, owner, 12 /* ErrorCodes.FUNCTION_REF */, [value, refs]);
5929
5957
  }
5930
5958
  else {
5931
5959
  const _isString = isString(ref);
@@ -5962,7 +5990,7 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
5962
5990
  setupState[ref] = value;
5963
5991
  }
5964
5992
  }
5965
- else if (isRef(ref)) {
5993
+ else if (_isRef) {
5966
5994
  ref.value = value;
5967
5995
  if (rawRef.k)
5968
5996
  refs[rawRef.k] = value;
@@ -5987,7 +6015,7 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
5987
6015
 
5988
6016
  let hasMismatch = false;
5989
6017
  const isSVGContainer = (container) => /svg/.test(container.namespaceURI) && container.tagName !== 'foreignObject';
5990
- const isComment = (node) => node.nodeType === 8 /* COMMENT */;
6018
+ const isComment = (node) => node.nodeType === 8 /* DOMNodeTypes.COMMENT */;
5991
6019
  // Note: hydration is DOM-specific
5992
6020
  // But we have to place it in core due to tight coupling with core - splitting
5993
6021
  // it out creates a ton of unnecessary complexity.
@@ -6001,11 +6029,13 @@ function createHydrationFunctions(rendererInternals) {
6001
6029
  `Performing full mount instead.`);
6002
6030
  patch(null, vnode, container);
6003
6031
  flushPostFlushCbs();
6032
+ container._vnode = vnode;
6004
6033
  return;
6005
6034
  }
6006
6035
  hasMismatch = false;
6007
6036
  hydrateNode(container.firstChild, vnode, null, null, null);
6008
6037
  flushPostFlushCbs();
6038
+ container._vnode = vnode;
6009
6039
  if (hasMismatch && !false) {
6010
6040
  // this error should show up in production
6011
6041
  console.error(`Hydration completed but contains mismatches.`);
@@ -6017,14 +6047,14 @@ function createHydrationFunctions(rendererInternals) {
6017
6047
  const { type, ref, shapeFlag, patchFlag } = vnode;
6018
6048
  const domType = node.nodeType;
6019
6049
  vnode.el = node;
6020
- if (patchFlag === -2 /* BAIL */) {
6050
+ if (patchFlag === -2 /* PatchFlags.BAIL */) {
6021
6051
  optimized = false;
6022
6052
  vnode.dynamicChildren = null;
6023
6053
  }
6024
6054
  let nextNode = null;
6025
6055
  switch (type) {
6026
6056
  case Text:
6027
- if (domType !== 3 /* TEXT */) {
6057
+ if (domType !== 3 /* DOMNodeTypes.TEXT */) {
6028
6058
  // #5728 empty text node inside a slot can cause hydration failure
6029
6059
  // because the server rendered HTML won't contain a text node
6030
6060
  if (vnode.children === '') {
@@ -6047,7 +6077,7 @@ function createHydrationFunctions(rendererInternals) {
6047
6077
  }
6048
6078
  break;
6049
6079
  case Comment:
6050
- if (domType !== 8 /* COMMENT */ || isFragmentStart) {
6080
+ if (domType !== 8 /* DOMNodeTypes.COMMENT */ || isFragmentStart) {
6051
6081
  nextNode = onMismatch();
6052
6082
  }
6053
6083
  else {
@@ -6055,7 +6085,7 @@ function createHydrationFunctions(rendererInternals) {
6055
6085
  }
6056
6086
  break;
6057
6087
  case Static:
6058
- if (domType !== 1 /* ELEMENT */) {
6088
+ if (domType !== 1 /* DOMNodeTypes.ELEMENT */ && domType !== 3 /* DOMNodeTypes.TEXT */) {
6059
6089
  nextNode = onMismatch();
6060
6090
  }
6061
6091
  else {
@@ -6066,7 +6096,10 @@ function createHydrationFunctions(rendererInternals) {
6066
6096
  const needToAdoptContent = !vnode.children.length;
6067
6097
  for (let i = 0; i < vnode.staticCount; i++) {
6068
6098
  if (needToAdoptContent)
6069
- vnode.children += nextNode.outerHTML;
6099
+ vnode.children +=
6100
+ nextNode.nodeType === 1 /* DOMNodeTypes.ELEMENT */
6101
+ ? nextNode.outerHTML
6102
+ : nextNode.data;
6070
6103
  if (i === vnode.staticCount - 1) {
6071
6104
  vnode.anchor = nextNode;
6072
6105
  }
@@ -6084,8 +6117,8 @@ function createHydrationFunctions(rendererInternals) {
6084
6117
  }
6085
6118
  break;
6086
6119
  default:
6087
- if (shapeFlag & 1 /* ELEMENT */) {
6088
- if (domType !== 1 /* ELEMENT */ ||
6120
+ if (shapeFlag & 1 /* ShapeFlags.ELEMENT */) {
6121
+ if (domType !== 1 /* DOMNodeTypes.ELEMENT */ ||
6089
6122
  vnode.type.toLowerCase() !==
6090
6123
  node.tagName.toLowerCase()) {
6091
6124
  nextNode = onMismatch();
@@ -6094,7 +6127,7 @@ function createHydrationFunctions(rendererInternals) {
6094
6127
  nextNode = hydrateElement(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized);
6095
6128
  }
6096
6129
  }
6097
- else if (shapeFlag & 6 /* COMPONENT */) {
6130
+ else if (shapeFlag & 6 /* ShapeFlags.COMPONENT */) {
6098
6131
  // when setting up the render effect, if the initial vnode already
6099
6132
  // has .el set, the component will perform hydration instead of mount
6100
6133
  // on its sub-tree.
@@ -6133,15 +6166,15 @@ function createHydrationFunctions(rendererInternals) {
6133
6166
  vnode.component.subTree = subTree;
6134
6167
  }
6135
6168
  }
6136
- else if (shapeFlag & 64 /* TELEPORT */) {
6137
- if (domType !== 8 /* COMMENT */) {
6169
+ else if (shapeFlag & 64 /* ShapeFlags.TELEPORT */) {
6170
+ if (domType !== 8 /* DOMNodeTypes.COMMENT */) {
6138
6171
  nextNode = onMismatch();
6139
6172
  }
6140
6173
  else {
6141
6174
  nextNode = vnode.type.hydrate(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized, rendererInternals, hydrateChildren);
6142
6175
  }
6143
6176
  }
6144
- else if (shapeFlag & 128 /* SUSPENSE */) {
6177
+ else if (shapeFlag & 128 /* ShapeFlags.SUSPENSE */) {
6145
6178
  nextNode = vnode.type.hydrate(node, vnode, parentComponent, parentSuspense, isSVGContainer(parentNode(node)), slotScopeIds, optimized, rendererInternals, hydrateNode);
6146
6179
  }
6147
6180
  else {
@@ -6169,7 +6202,7 @@ function createHydrationFunctions(rendererInternals) {
6169
6202
  if (props) {
6170
6203
  if (forcePatchValue ||
6171
6204
  !optimized ||
6172
- patchFlag & (16 /* FULL_PROPS */ | 32 /* HYDRATE_EVENTS */)) {
6205
+ patchFlag & (16 /* PatchFlags.FULL_PROPS */ | 32 /* PatchFlags.HYDRATE_EVENTS */)) {
6173
6206
  for (const key in props) {
6174
6207
  if ((forcePatchValue && key.endsWith('value')) ||
6175
6208
  (isOn(key) && !isReservedProp(key))) {
@@ -6198,7 +6231,7 @@ function createHydrationFunctions(rendererInternals) {
6198
6231
  }, parentSuspense);
6199
6232
  }
6200
6233
  // children
6201
- if (shapeFlag & 16 /* ARRAY_CHILDREN */ &&
6234
+ if (shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */ &&
6202
6235
  // skip if element has innerHTML / textContent
6203
6236
  !(props && (props.innerHTML || props.textContent))) {
6204
6237
  let next = hydrateChildren(el.firstChild, vnode, el, parentComponent, parentSuspense, slotScopeIds, optimized);
@@ -6216,7 +6249,7 @@ function createHydrationFunctions(rendererInternals) {
6216
6249
  remove(cur);
6217
6250
  }
6218
6251
  }
6219
- else if (shapeFlag & 8 /* TEXT_CHILDREN */) {
6252
+ else if (shapeFlag & 8 /* ShapeFlags.TEXT_CHILDREN */) {
6220
6253
  if (el.textContent !== vnode.children) {
6221
6254
  hasMismatch = true;
6222
6255
  warn$1(`Hydration text content mismatch in <${vnode.type}>:\n` +
@@ -6279,7 +6312,7 @@ function createHydrationFunctions(rendererInternals) {
6279
6312
  };
6280
6313
  const handleMismatch = (node, vnode, parentComponent, parentSuspense, slotScopeIds, isFragment) => {
6281
6314
  hasMismatch = true;
6282
- warn$1(`Hydration node mismatch:\n- Client vnode:`, vnode.type, `\n- Server rendered DOM:`, node, node.nodeType === 3 /* TEXT */
6315
+ warn$1(`Hydration node mismatch:\n- Client vnode:`, vnode.type, `\n- Server rendered DOM:`, node, node.nodeType === 3 /* DOMNodeTypes.TEXT */
6283
6316
  ? `(text)`
6284
6317
  : isComment(node) && node.data === '['
6285
6318
  ? `(start of fragment)`
@@ -6410,7 +6443,7 @@ function baseCreateRenderer(options, createHydrationFns) {
6410
6443
  unmount(n1, parentComponent, parentSuspense, true);
6411
6444
  n1 = null;
6412
6445
  }
6413
- if (n2.patchFlag === -2 /* BAIL */) {
6446
+ if (n2.patchFlag === -2 /* PatchFlags.BAIL */) {
6414
6447
  optimized = false;
6415
6448
  n2.dynamicChildren = null;
6416
6449
  }
@@ -6434,16 +6467,16 @@ function baseCreateRenderer(options, createHydrationFns) {
6434
6467
  processFragment(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
6435
6468
  break;
6436
6469
  default:
6437
- if (shapeFlag & 1 /* ELEMENT */) {
6470
+ if (shapeFlag & 1 /* ShapeFlags.ELEMENT */) {
6438
6471
  processElement(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
6439
6472
  }
6440
- else if (shapeFlag & 6 /* COMPONENT */) {
6473
+ else if (shapeFlag & 6 /* ShapeFlags.COMPONENT */) {
6441
6474
  processComponent(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
6442
6475
  }
6443
- else if (shapeFlag & 64 /* TELEPORT */) {
6476
+ else if (shapeFlag & 64 /* ShapeFlags.TELEPORT */) {
6444
6477
  type.process(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, internals);
6445
6478
  }
6446
- else if (shapeFlag & 128 /* SUSPENSE */) {
6479
+ else if (shapeFlag & 128 /* ShapeFlags.SUSPENSE */) {
6447
6480
  type.process(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, internals);
6448
6481
  }
6449
6482
  else {
@@ -6529,10 +6562,10 @@ function baseCreateRenderer(options, createHydrationFns) {
6529
6562
  el = vnode.el = hostCreateElement(vnode.type, isSVG, props && props.is, props);
6530
6563
  // mount children first, since some props may rely on child content
6531
6564
  // being already rendered, e.g. `<select value>`
6532
- if (shapeFlag & 8 /* TEXT_CHILDREN */) {
6565
+ if (shapeFlag & 8 /* ShapeFlags.TEXT_CHILDREN */) {
6533
6566
  hostSetElementText(el, vnode.children);
6534
6567
  }
6535
- else if (shapeFlag & 16 /* ARRAY_CHILDREN */) {
6568
+ else if (shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
6536
6569
  mountChildren(vnode.children, el, null, parentComponent, parentSuspense, isSVG && type !== 'foreignObject', slotScopeIds, optimized);
6537
6570
  }
6538
6571
  if (dirs) {
@@ -6608,7 +6641,7 @@ function baseCreateRenderer(options, createHydrationFns) {
6608
6641
  if (parentComponent) {
6609
6642
  let subTree = parentComponent.subTree;
6610
6643
  if (subTree.patchFlag > 0 &&
6611
- subTree.patchFlag & 2048 /* DEV_ROOT_FRAGMENT */) {
6644
+ subTree.patchFlag & 2048 /* PatchFlags.DEV_ROOT_FRAGMENT */) {
6612
6645
  subTree =
6613
6646
  filterSingleRoot(subTree.children) || subTree;
6614
6647
  }
@@ -6631,7 +6664,7 @@ function baseCreateRenderer(options, createHydrationFns) {
6631
6664
  let { patchFlag, dynamicChildren, dirs } = n2;
6632
6665
  // #1426 take the old vnode's patch flag into account since user may clone a
6633
6666
  // compiler-generated vnode, which de-opts to FULL_PROPS
6634
- patchFlag |= n1.patchFlag & 16 /* FULL_PROPS */;
6667
+ patchFlag |= n1.patchFlag & 16 /* PatchFlags.FULL_PROPS */;
6635
6668
  const oldProps = n1.props || EMPTY_OBJ;
6636
6669
  const newProps = n2.props || EMPTY_OBJ;
6637
6670
  let vnodeHook;
@@ -6666,21 +6699,21 @@ function baseCreateRenderer(options, createHydrationFns) {
6666
6699
  // generated by the compiler and can take the fast path.
6667
6700
  // in this path old node and new node are guaranteed to have the same shape
6668
6701
  // (i.e. at the exact same position in the source template)
6669
- if (patchFlag & 16 /* FULL_PROPS */) {
6702
+ if (patchFlag & 16 /* PatchFlags.FULL_PROPS */) {
6670
6703
  // element props contain dynamic keys, full diff needed
6671
6704
  patchProps(el, n2, oldProps, newProps, parentComponent, parentSuspense, isSVG);
6672
6705
  }
6673
6706
  else {
6674
6707
  // class
6675
6708
  // this flag is matched when the element has dynamic class bindings.
6676
- if (patchFlag & 2 /* CLASS */) {
6709
+ if (patchFlag & 2 /* PatchFlags.CLASS */) {
6677
6710
  if (oldProps.class !== newProps.class) {
6678
6711
  hostPatchProp(el, 'class', null, newProps.class, isSVG);
6679
6712
  }
6680
6713
  }
6681
6714
  // style
6682
6715
  // this flag is matched when the element has dynamic style bindings
6683
- if (patchFlag & 4 /* STYLE */) {
6716
+ if (patchFlag & 4 /* PatchFlags.STYLE */) {
6684
6717
  hostPatchProp(el, 'style', oldProps.style, newProps.style, isSVG);
6685
6718
  }
6686
6719
  // props
@@ -6689,7 +6722,7 @@ function baseCreateRenderer(options, createHydrationFns) {
6689
6722
  // faster iteration.
6690
6723
  // Note dynamic keys like :[foo]="bar" will cause this optimization to
6691
6724
  // bail out and go through a full diff because we need to unset the old key
6692
- if (patchFlag & 8 /* PROPS */) {
6725
+ if (patchFlag & 8 /* PatchFlags.PROPS */) {
6693
6726
  // if the flag is present then dynamicProps must be non-null
6694
6727
  const propsToUpdate = n2.dynamicProps;
6695
6728
  for (let i = 0; i < propsToUpdate.length; i++) {
@@ -6705,7 +6738,7 @@ function baseCreateRenderer(options, createHydrationFns) {
6705
6738
  }
6706
6739
  // text
6707
6740
  // This flag is matched when the element has only dynamic text children.
6708
- if (patchFlag & 1 /* TEXT */) {
6741
+ if (patchFlag & 1 /* PatchFlags.TEXT */) {
6709
6742
  if (n1.children !== n2.children) {
6710
6743
  hostSetElementText(el, n2.children);
6711
6744
  }
@@ -6739,7 +6772,7 @@ function baseCreateRenderer(options, createHydrationFns) {
6739
6772
  // which also requires the correct parent container
6740
6773
  !isSameVNodeType(oldVNode, newVNode) ||
6741
6774
  // - In the case of a component, it could contain anything.
6742
- oldVNode.shapeFlag & (6 /* COMPONENT */ | 64 /* TELEPORT */))
6775
+ oldVNode.shapeFlag & (6 /* ShapeFlags.COMPONENT */ | 64 /* ShapeFlags.TELEPORT */))
6743
6776
  ? hostParentNode(oldVNode.el)
6744
6777
  : // In other cases, the parent container is not actually used so we
6745
6778
  // just pass the block element here to avoid a DOM parentNode call.
@@ -6777,7 +6810,7 @@ function baseCreateRenderer(options, createHydrationFns) {
6777
6810
  const fragmentEndAnchor = (n2.anchor = n1 ? n1.anchor : hostCreateText(''));
6778
6811
  let { patchFlag, dynamicChildren, slotScopeIds: fragmentSlotScopeIds } = n2;
6779
6812
  if (// #5523 dev root fragment may inherit directives
6780
- (isHmrUpdating || patchFlag & 2048 /* DEV_ROOT_FRAGMENT */)) {
6813
+ (isHmrUpdating || patchFlag & 2048 /* PatchFlags.DEV_ROOT_FRAGMENT */)) {
6781
6814
  // HMR updated / Dev root fragment (w/ comments), force full diff
6782
6815
  patchFlag = 0;
6783
6816
  optimized = false;
@@ -6799,7 +6832,7 @@ function baseCreateRenderer(options, createHydrationFns) {
6799
6832
  }
6800
6833
  else {
6801
6834
  if (patchFlag > 0 &&
6802
- patchFlag & 64 /* STABLE_FRAGMENT */ &&
6835
+ patchFlag & 64 /* PatchFlags.STABLE_FRAGMENT */ &&
6803
6836
  dynamicChildren &&
6804
6837
  // #2715 the previous fragment could've been a BAILed one as a result
6805
6838
  // of renderSlot() with no valid children
@@ -6832,7 +6865,7 @@ function baseCreateRenderer(options, createHydrationFns) {
6832
6865
  const processComponent = (n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
6833
6866
  n2.slotScopeIds = slotScopeIds;
6834
6867
  if (n1 == null) {
6835
- if (n2.shapeFlag & 512 /* COMPONENT_KEPT_ALIVE */) {
6868
+ if (n2.shapeFlag & 512 /* ShapeFlags.COMPONENT_KEPT_ALIVE */) {
6836
6869
  parentComponent.ctx.activate(n2, container, anchor, isSVG, optimized);
6837
6870
  }
6838
6871
  else {
@@ -6994,10 +7027,10 @@ function baseCreateRenderer(options, createHydrationFns) {
6994
7027
  // activated hook for keep-alive roots.
6995
7028
  // #1742 activated hook must be accessed after first render
6996
7029
  // since the hook may be injected by a child keep-alive
6997
- if (initialVNode.shapeFlag & 256 /* COMPONENT_SHOULD_KEEP_ALIVE */ ||
7030
+ if (initialVNode.shapeFlag & 256 /* ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE */ ||
6998
7031
  (parent &&
6999
7032
  isAsyncWrapper(parent.vnode) &&
7000
- parent.vnode.shapeFlag & 256 /* COMPONENT_SHOULD_KEEP_ALIVE */)) {
7033
+ parent.vnode.shapeFlag & 256 /* ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE */)) {
7001
7034
  instance.a && queuePostRenderEffect(instance.a, parentSuspense);
7002
7035
  }
7003
7036
  instance.isMounted = true;
@@ -7108,7 +7141,7 @@ function baseCreateRenderer(options, createHydrationFns) {
7108
7141
  pauseTracking();
7109
7142
  // props update may have triggered pre-flush watchers.
7110
7143
  // flush them before the render update.
7111
- flushPreFlushCbs(undefined, instance.update);
7144
+ flushPreFlushCbs();
7112
7145
  resetTracking();
7113
7146
  };
7114
7147
  const patchChildren = (n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized = false) => {
@@ -7118,22 +7151,22 @@ function baseCreateRenderer(options, createHydrationFns) {
7118
7151
  const { patchFlag, shapeFlag } = n2;
7119
7152
  // fast path
7120
7153
  if (patchFlag > 0) {
7121
- if (patchFlag & 128 /* KEYED_FRAGMENT */) {
7154
+ if (patchFlag & 128 /* PatchFlags.KEYED_FRAGMENT */) {
7122
7155
  // this could be either fully-keyed or mixed (some keyed some not)
7123
7156
  // presence of patchFlag means children are guaranteed to be arrays
7124
7157
  patchKeyedChildren(c1, c2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
7125
7158
  return;
7126
7159
  }
7127
- else if (patchFlag & 256 /* UNKEYED_FRAGMENT */) {
7160
+ else if (patchFlag & 256 /* PatchFlags.UNKEYED_FRAGMENT */) {
7128
7161
  // unkeyed
7129
7162
  patchUnkeyedChildren(c1, c2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
7130
7163
  return;
7131
7164
  }
7132
7165
  }
7133
7166
  // children has 3 possibilities: text, array or no children.
7134
- if (shapeFlag & 8 /* TEXT_CHILDREN */) {
7167
+ if (shapeFlag & 8 /* ShapeFlags.TEXT_CHILDREN */) {
7135
7168
  // text children fast path
7136
- if (prevShapeFlag & 16 /* ARRAY_CHILDREN */) {
7169
+ if (prevShapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
7137
7170
  unmountChildren(c1, parentComponent, parentSuspense);
7138
7171
  }
7139
7172
  if (c2 !== c1) {
@@ -7141,9 +7174,9 @@ function baseCreateRenderer(options, createHydrationFns) {
7141
7174
  }
7142
7175
  }
7143
7176
  else {
7144
- if (prevShapeFlag & 16 /* ARRAY_CHILDREN */) {
7177
+ if (prevShapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
7145
7178
  // prev children was array
7146
- if (shapeFlag & 16 /* ARRAY_CHILDREN */) {
7179
+ if (shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
7147
7180
  // two arrays, cannot assume anything, do full diff
7148
7181
  patchKeyedChildren(c1, c2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
7149
7182
  }
@@ -7155,11 +7188,11 @@ function baseCreateRenderer(options, createHydrationFns) {
7155
7188
  else {
7156
7189
  // prev children was text OR null
7157
7190
  // new children is array OR null
7158
- if (prevShapeFlag & 8 /* TEXT_CHILDREN */) {
7191
+ if (prevShapeFlag & 8 /* ShapeFlags.TEXT_CHILDREN */) {
7159
7192
  hostSetElementText(container, '');
7160
7193
  }
7161
7194
  // mount new if array
7162
- if (shapeFlag & 16 /* ARRAY_CHILDREN */) {
7195
+ if (shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
7163
7196
  mountChildren(c2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
7164
7197
  }
7165
7198
  }
@@ -7350,7 +7383,7 @@ function baseCreateRenderer(options, createHydrationFns) {
7350
7383
  // There is no stable subsequence (e.g. a reverse)
7351
7384
  // OR current node is not among the stable sequence
7352
7385
  if (j < 0 || i !== increasingNewIndexSequence[j]) {
7353
- move(nextChild, container, anchor, 2 /* REORDER */);
7386
+ move(nextChild, container, anchor, 2 /* MoveType.REORDER */);
7354
7387
  }
7355
7388
  else {
7356
7389
  j--;
@@ -7361,15 +7394,15 @@ function baseCreateRenderer(options, createHydrationFns) {
7361
7394
  };
7362
7395
  const move = (vnode, container, anchor, moveType, parentSuspense = null) => {
7363
7396
  const { el, type, transition, children, shapeFlag } = vnode;
7364
- if (shapeFlag & 6 /* COMPONENT */) {
7397
+ if (shapeFlag & 6 /* ShapeFlags.COMPONENT */) {
7365
7398
  move(vnode.component.subTree, container, anchor, moveType);
7366
7399
  return;
7367
7400
  }
7368
- if (shapeFlag & 128 /* SUSPENSE */) {
7401
+ if (shapeFlag & 128 /* ShapeFlags.SUSPENSE */) {
7369
7402
  vnode.suspense.move(container, anchor, moveType);
7370
7403
  return;
7371
7404
  }
7372
- if (shapeFlag & 64 /* TELEPORT */) {
7405
+ if (shapeFlag & 64 /* ShapeFlags.TELEPORT */) {
7373
7406
  type.move(vnode, container, anchor, internals);
7374
7407
  return;
7375
7408
  }
@@ -7386,11 +7419,11 @@ function baseCreateRenderer(options, createHydrationFns) {
7386
7419
  return;
7387
7420
  }
7388
7421
  // single nodes
7389
- const needTransition = moveType !== 2 /* REORDER */ &&
7390
- shapeFlag & 1 /* ELEMENT */ &&
7422
+ const needTransition = moveType !== 2 /* MoveType.REORDER */ &&
7423
+ shapeFlag & 1 /* ShapeFlags.ELEMENT */ &&
7391
7424
  transition;
7392
7425
  if (needTransition) {
7393
- if (moveType === 0 /* ENTER */) {
7426
+ if (moveType === 0 /* MoveType.ENTER */) {
7394
7427
  transition.beforeEnter(el);
7395
7428
  hostInsert(el, container, anchor);
7396
7429
  queuePostRenderEffect(() => transition.enter(el), parentSuspense);
@@ -7422,42 +7455,42 @@ function baseCreateRenderer(options, createHydrationFns) {
7422
7455
  if (ref != null) {
7423
7456
  setRef(ref, null, parentSuspense, vnode, true);
7424
7457
  }
7425
- if (shapeFlag & 256 /* COMPONENT_SHOULD_KEEP_ALIVE */) {
7458
+ if (shapeFlag & 256 /* ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE */) {
7426
7459
  parentComponent.ctx.deactivate(vnode);
7427
7460
  return;
7428
7461
  }
7429
- const shouldInvokeDirs = shapeFlag & 1 /* ELEMENT */ && dirs;
7462
+ const shouldInvokeDirs = shapeFlag & 1 /* ShapeFlags.ELEMENT */ && dirs;
7430
7463
  const shouldInvokeVnodeHook = !isAsyncWrapper(vnode);
7431
7464
  let vnodeHook;
7432
7465
  if (shouldInvokeVnodeHook &&
7433
7466
  (vnodeHook = props && props.onVnodeBeforeUnmount)) {
7434
7467
  invokeVNodeHook(vnodeHook, parentComponent, vnode);
7435
7468
  }
7436
- if (shapeFlag & 6 /* COMPONENT */) {
7469
+ if (shapeFlag & 6 /* ShapeFlags.COMPONENT */) {
7437
7470
  unmountComponent(vnode.component, parentSuspense, doRemove);
7438
7471
  }
7439
7472
  else {
7440
- if (shapeFlag & 128 /* SUSPENSE */) {
7473
+ if (shapeFlag & 128 /* ShapeFlags.SUSPENSE */) {
7441
7474
  vnode.suspense.unmount(parentSuspense, doRemove);
7442
7475
  return;
7443
7476
  }
7444
7477
  if (shouldInvokeDirs) {
7445
7478
  invokeDirectiveHook(vnode, null, parentComponent, 'beforeUnmount');
7446
7479
  }
7447
- if (shapeFlag & 64 /* TELEPORT */) {
7480
+ if (shapeFlag & 64 /* ShapeFlags.TELEPORT */) {
7448
7481
  vnode.type.remove(vnode, parentComponent, parentSuspense, optimized, internals, doRemove);
7449
7482
  }
7450
7483
  else if (dynamicChildren &&
7451
7484
  // #1153: fast path should not be taken for non-stable (v-for) fragments
7452
7485
  (type !== Fragment ||
7453
- (patchFlag > 0 && patchFlag & 64 /* STABLE_FRAGMENT */))) {
7486
+ (patchFlag > 0 && patchFlag & 64 /* PatchFlags.STABLE_FRAGMENT */))) {
7454
7487
  // fast path for block nodes: only need to unmount dynamic children.
7455
7488
  unmountChildren(dynamicChildren, parentComponent, parentSuspense, false, true);
7456
7489
  }
7457
7490
  else if ((type === Fragment &&
7458
7491
  patchFlag &
7459
- (128 /* KEYED_FRAGMENT */ | 256 /* UNKEYED_FRAGMENT */)) ||
7460
- (!optimized && shapeFlag & 16 /* ARRAY_CHILDREN */)) {
7492
+ (128 /* PatchFlags.KEYED_FRAGMENT */ | 256 /* PatchFlags.UNKEYED_FRAGMENT */)) ||
7493
+ (!optimized && shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */)) {
7461
7494
  unmountChildren(children, parentComponent, parentSuspense);
7462
7495
  }
7463
7496
  if (doRemove) {
@@ -7478,7 +7511,7 @@ function baseCreateRenderer(options, createHydrationFns) {
7478
7511
  const { type, el, anchor, transition } = vnode;
7479
7512
  if (type === Fragment) {
7480
7513
  if (vnode.patchFlag > 0 &&
7481
- vnode.patchFlag & 2048 /* DEV_ROOT_FRAGMENT */ &&
7514
+ vnode.patchFlag & 2048 /* PatchFlags.DEV_ROOT_FRAGMENT */ &&
7482
7515
  transition &&
7483
7516
  !transition.persisted) {
7484
7517
  vnode.children.forEach(child => {
@@ -7505,7 +7538,7 @@ function baseCreateRenderer(options, createHydrationFns) {
7505
7538
  transition.afterLeave();
7506
7539
  }
7507
7540
  };
7508
- if (vnode.shapeFlag & 1 /* ELEMENT */ &&
7541
+ if (vnode.shapeFlag & 1 /* ShapeFlags.ELEMENT */ &&
7509
7542
  transition &&
7510
7543
  !transition.persisted) {
7511
7544
  const { leave, delayLeave } = transition;
@@ -7581,10 +7614,10 @@ function baseCreateRenderer(options, createHydrationFns) {
7581
7614
  }
7582
7615
  };
7583
7616
  const getNextHostNode = vnode => {
7584
- if (vnode.shapeFlag & 6 /* COMPONENT */) {
7617
+ if (vnode.shapeFlag & 6 /* ShapeFlags.COMPONENT */) {
7585
7618
  return getNextHostNode(vnode.component.subTree);
7586
7619
  }
7587
- if (vnode.shapeFlag & 128 /* SUSPENSE */) {
7620
+ if (vnode.shapeFlag & 128 /* ShapeFlags.SUSPENSE */) {
7588
7621
  return vnode.suspense.next();
7589
7622
  }
7590
7623
  return hostNextSibling((vnode.anchor || vnode.el));
@@ -7598,6 +7631,7 @@ function baseCreateRenderer(options, createHydrationFns) {
7598
7631
  else {
7599
7632
  patch(container._vnode || null, vnode, container, null, null, null, isSVG);
7600
7633
  }
7634
+ flushPreFlushCbs();
7601
7635
  flushPostFlushCbs();
7602
7636
  container._vnode = vnode;
7603
7637
  };
@@ -7647,8 +7681,8 @@ function traverseStaticChildren(n1, n2, shallow = false) {
7647
7681
  // guaranteed to be vnodes
7648
7682
  const c1 = ch1[i];
7649
7683
  let c2 = ch2[i];
7650
- if (c2.shapeFlag & 1 /* ELEMENT */ && !c2.dynamicChildren) {
7651
- if (c2.patchFlag <= 0 || c2.patchFlag === 32 /* HYDRATE_EVENTS */) {
7684
+ if (c2.shapeFlag & 1 /* ShapeFlags.ELEMENT */ && !c2.dynamicChildren) {
7685
+ if (c2.patchFlag <= 0 || c2.patchFlag === 32 /* PatchFlags.HYDRATE_EVENTS */) {
7652
7686
  c2 = ch2[i] = cloneIfMounted(ch2[i]);
7653
7687
  c2.el = c1.el;
7654
7688
  }
@@ -7768,7 +7802,7 @@ const TeleportImpl = {
7768
7802
  const mount = (container, anchor) => {
7769
7803
  // Teleport *always* has Array children. This is enforced in both the
7770
7804
  // compiler and vnode children normalization.
7771
- if (shapeFlag & 16 /* ARRAY_CHILDREN */) {
7805
+ if (shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
7772
7806
  mountChildren(children, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
7773
7807
  }
7774
7808
  };
@@ -7804,7 +7838,7 @@ const TeleportImpl = {
7804
7838
  if (!wasDisabled) {
7805
7839
  // enabled -> disabled
7806
7840
  // move into main container
7807
- moveTeleport(n2, container, mainAnchor, internals, 1 /* TOGGLE */);
7841
+ moveTeleport(n2, container, mainAnchor, internals, 1 /* TeleportMoveTypes.TOGGLE */);
7808
7842
  }
7809
7843
  }
7810
7844
  else {
@@ -7812,7 +7846,7 @@ const TeleportImpl = {
7812
7846
  if ((n2.props && n2.props.to) !== (n1.props && n1.props.to)) {
7813
7847
  const nextTarget = (n2.target = resolveTarget(n2.props, querySelector));
7814
7848
  if (nextTarget) {
7815
- moveTeleport(n2, nextTarget, null, internals, 0 /* TARGET_CHANGE */);
7849
+ moveTeleport(n2, nextTarget, null, internals, 0 /* TeleportMoveTypes.TARGET_CHANGE */);
7816
7850
  }
7817
7851
  else {
7818
7852
  warn$1('Invalid Teleport target on update:', target, `(${typeof target})`);
@@ -7821,7 +7855,7 @@ const TeleportImpl = {
7821
7855
  else if (wasDisabled) {
7822
7856
  // disabled -> enabled
7823
7857
  // move into teleport target
7824
- moveTeleport(n2, target, targetAnchor, internals, 1 /* TOGGLE */);
7858
+ moveTeleport(n2, target, targetAnchor, internals, 1 /* TeleportMoveTypes.TOGGLE */);
7825
7859
  }
7826
7860
  }
7827
7861
  }
@@ -7834,7 +7868,7 @@ const TeleportImpl = {
7834
7868
  // an unmounted teleport should always remove its children if not disabled
7835
7869
  if (doRemove || !isTeleportDisabled(props)) {
7836
7870
  hostRemove(anchor);
7837
- if (shapeFlag & 16 /* ARRAY_CHILDREN */) {
7871
+ if (shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
7838
7872
  for (let i = 0; i < children.length; i++) {
7839
7873
  const child = children[i];
7840
7874
  unmount(child, parentComponent, parentSuspense, true, !!child.dynamicChildren);
@@ -7845,13 +7879,13 @@ const TeleportImpl = {
7845
7879
  move: moveTeleport,
7846
7880
  hydrate: hydrateTeleport
7847
7881
  };
7848
- function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }, moveType = 2 /* REORDER */) {
7882
+ function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }, moveType = 2 /* TeleportMoveTypes.REORDER */) {
7849
7883
  // move target anchor if this is a target change.
7850
- if (moveType === 0 /* TARGET_CHANGE */) {
7884
+ if (moveType === 0 /* TeleportMoveTypes.TARGET_CHANGE */) {
7851
7885
  insert(vnode.targetAnchor, container, parentAnchor);
7852
7886
  }
7853
7887
  const { el, anchor, shapeFlag, children, props } = vnode;
7854
- const isReorder = moveType === 2 /* REORDER */;
7888
+ const isReorder = moveType === 2 /* TeleportMoveTypes.REORDER */;
7855
7889
  // move main view anchor if this is a re-order.
7856
7890
  if (isReorder) {
7857
7891
  insert(el, container, parentAnchor);
@@ -7861,9 +7895,9 @@ function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }
7861
7895
  // is not a reorder, or the teleport is disabled
7862
7896
  if (!isReorder || isTeleportDisabled(props)) {
7863
7897
  // Teleport has either Array children or no children.
7864
- if (shapeFlag & 16 /* ARRAY_CHILDREN */) {
7898
+ if (shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
7865
7899
  for (let i = 0; i < children.length; i++) {
7866
- move(children[i], container, parentAnchor, 2 /* REORDER */);
7900
+ move(children[i], container, parentAnchor, 2 /* MoveType.REORDER */);
7867
7901
  }
7868
7902
  }
7869
7903
  }
@@ -7878,7 +7912,7 @@ function hydrateTeleport(node, vnode, parentComponent, parentSuspense, slotScope
7878
7912
  // if multiple teleports rendered to the same target element, we need to
7879
7913
  // pick up from where the last teleport finished instead of the first node
7880
7914
  const targetNode = target._lpa || target.firstChild;
7881
- if (vnode.shapeFlag & 16 /* ARRAY_CHILDREN */) {
7915
+ if (vnode.shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
7882
7916
  if (isTeleportDisabled(vnode.props)) {
7883
7917
  vnode.anchor = hydrateChildren(nextSibling(node), vnode, parentNode(node), parentComponent, parentSuspense, slotScopeIds, optimized);
7884
7918
  vnode.targetAnchor = targetNode;
@@ -8000,7 +8034,7 @@ function isVNode(value) {
8000
8034
  return value ? value.__v_isVNode === true : false;
8001
8035
  }
8002
8036
  function isSameVNodeType(n1, n2) {
8003
- if (n2.shapeFlag & 6 /* COMPONENT */ &&
8037
+ if (n2.shapeFlag & 6 /* ShapeFlags.COMPONENT */ &&
8004
8038
  hmrDirtyComponents.has(n2.type)) {
8005
8039
  // HMR only: if the component has been hot-updated, force a reload.
8006
8040
  return false;
@@ -8031,7 +8065,7 @@ const normalizeRef = ({ ref, ref_key, ref_for }) => {
8031
8065
  : ref
8032
8066
  : null);
8033
8067
  };
8034
- function createBaseVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, shapeFlag = type === Fragment ? 0 : 1 /* ELEMENT */, isBlockNode = false, needFullChildrenNormalization = false) {
8068
+ function createBaseVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, shapeFlag = type === Fragment ? 0 : 1 /* ShapeFlags.ELEMENT */, isBlockNode = false, needFullChildrenNormalization = false) {
8035
8069
  const vnode = {
8036
8070
  __v_isVNode: true,
8037
8071
  __v_skip: true,
@@ -8062,7 +8096,7 @@ function createBaseVNode(type, props = null, children = null, patchFlag = 0, dyn
8062
8096
  if (needFullChildrenNormalization) {
8063
8097
  normalizeChildren(vnode, children);
8064
8098
  // normalize suspense children
8065
- if (shapeFlag & 128 /* SUSPENSE */) {
8099
+ if (shapeFlag & 128 /* ShapeFlags.SUSPENSE */) {
8066
8100
  type.normalize(vnode);
8067
8101
  }
8068
8102
  }
@@ -8070,8 +8104,8 @@ function createBaseVNode(type, props = null, children = null, patchFlag = 0, dyn
8070
8104
  // compiled element vnode - if children is passed, only possible types are
8071
8105
  // string or Array.
8072
8106
  vnode.shapeFlag |= isString(children)
8073
- ? 8 /* TEXT_CHILDREN */
8074
- : 16 /* ARRAY_CHILDREN */;
8107
+ ? 8 /* ShapeFlags.TEXT_CHILDREN */
8108
+ : 16 /* ShapeFlags.ARRAY_CHILDREN */;
8075
8109
  }
8076
8110
  // validate key
8077
8111
  if (vnode.key !== vnode.key) {
@@ -8087,10 +8121,10 @@ function createBaseVNode(type, props = null, children = null, patchFlag = 0, dyn
8087
8121
  // component nodes also should always be patched, because even if the
8088
8122
  // component doesn't need to update, it needs to persist the instance on to
8089
8123
  // the next vnode so that it can be properly unmounted later.
8090
- (vnode.patchFlag > 0 || shapeFlag & 6 /* COMPONENT */) &&
8124
+ (vnode.patchFlag > 0 || shapeFlag & 6 /* ShapeFlags.COMPONENT */) &&
8091
8125
  // the EVENTS flag is only for hydration and if it is the only flag, the
8092
8126
  // vnode should not be considered dynamic due to handler caching.
8093
- vnode.patchFlag !== 32 /* HYDRATE_EVENTS */) {
8127
+ vnode.patchFlag !== 32 /* PatchFlags.HYDRATE_EVENTS */) {
8094
8128
  currentBlock.push(vnode);
8095
8129
  }
8096
8130
  return vnode;
@@ -8112,14 +8146,14 @@ function _createVNode(type, props = null, children = null, patchFlag = 0, dynami
8112
8146
  normalizeChildren(cloned, children);
8113
8147
  }
8114
8148
  if (isBlockTreeEnabled > 0 && !isBlockNode && currentBlock) {
8115
- if (cloned.shapeFlag & 6 /* COMPONENT */) {
8149
+ if (cloned.shapeFlag & 6 /* ShapeFlags.COMPONENT */) {
8116
8150
  currentBlock[currentBlock.indexOf(type)] = cloned;
8117
8151
  }
8118
8152
  else {
8119
8153
  currentBlock.push(cloned);
8120
8154
  }
8121
8155
  }
8122
- cloned.patchFlag |= -2 /* BAIL */;
8156
+ cloned.patchFlag |= -2 /* PatchFlags.BAIL */;
8123
8157
  return cloned;
8124
8158
  }
8125
8159
  // class component normalization.
@@ -8145,17 +8179,17 @@ function _createVNode(type, props = null, children = null, patchFlag = 0, dynami
8145
8179
  }
8146
8180
  // encode the vnode type information into a bitmap
8147
8181
  const shapeFlag = isString(type)
8148
- ? 1 /* ELEMENT */
8182
+ ? 1 /* ShapeFlags.ELEMENT */
8149
8183
  : isSuspense(type)
8150
- ? 128 /* SUSPENSE */
8184
+ ? 128 /* ShapeFlags.SUSPENSE */
8151
8185
  : isTeleport(type)
8152
- ? 64 /* TELEPORT */
8186
+ ? 64 /* ShapeFlags.TELEPORT */
8153
8187
  : isObject(type)
8154
- ? 4 /* STATEFUL_COMPONENT */
8188
+ ? 4 /* ShapeFlags.STATEFUL_COMPONENT */
8155
8189
  : isFunction(type)
8156
- ? 2 /* FUNCTIONAL_COMPONENT */
8190
+ ? 2 /* ShapeFlags.FUNCTIONAL_COMPONENT */
8157
8191
  : 0;
8158
- if (shapeFlag & 4 /* STATEFUL_COMPONENT */ && isProxy(type)) {
8192
+ if (shapeFlag & 4 /* ShapeFlags.STATEFUL_COMPONENT */ && isProxy(type)) {
8159
8193
  type = toRaw(type);
8160
8194
  warn$1(`Vue received a Component which was made a reactive object. This can ` +
8161
8195
  `lead to unnecessary performance overhead, and should be avoided by ` +
@@ -8194,7 +8228,7 @@ function cloneVNode(vnode, extraProps, mergeRef = false) {
8194
8228
  : ref,
8195
8229
  scopeId: vnode.scopeId,
8196
8230
  slotScopeIds: vnode.slotScopeIds,
8197
- children: patchFlag === -1 /* HOISTED */ && isArray(children)
8231
+ children: patchFlag === -1 /* PatchFlags.HOISTED */ && isArray(children)
8198
8232
  ? children.map(deepCloneVNode)
8199
8233
  : children,
8200
8234
  target: vnode.target,
@@ -8207,8 +8241,8 @@ function cloneVNode(vnode, extraProps, mergeRef = false) {
8207
8241
  // fast paths only.
8208
8242
  patchFlag: extraProps && vnode.type !== Fragment
8209
8243
  ? patchFlag === -1 // hoisted node
8210
- ? 16 /* FULL_PROPS */
8211
- : patchFlag | 16 /* FULL_PROPS */
8244
+ ? 16 /* PatchFlags.FULL_PROPS */
8245
+ : patchFlag | 16 /* PatchFlags.FULL_PROPS */
8212
8246
  : patchFlag,
8213
8247
  dynamicProps: vnode.dynamicProps,
8214
8248
  dynamicChildren: vnode.dynamicChildren,
@@ -8298,10 +8332,10 @@ function normalizeChildren(vnode, children) {
8298
8332
  children = null;
8299
8333
  }
8300
8334
  else if (isArray(children)) {
8301
- type = 16 /* ARRAY_CHILDREN */;
8335
+ type = 16 /* ShapeFlags.ARRAY_CHILDREN */;
8302
8336
  }
8303
8337
  else if (typeof children === 'object') {
8304
- if (shapeFlag & (1 /* ELEMENT */ | 64 /* TELEPORT */)) {
8338
+ if (shapeFlag & (1 /* ShapeFlags.ELEMENT */ | 64 /* ShapeFlags.TELEPORT */)) {
8305
8339
  // Normalize slot to plain children for plain element and Teleport
8306
8340
  const slot = children.default;
8307
8341
  if (slot) {
@@ -8313,37 +8347,37 @@ function normalizeChildren(vnode, children) {
8313
8347
  return;
8314
8348
  }
8315
8349
  else {
8316
- type = 32 /* SLOTS_CHILDREN */;
8350
+ type = 32 /* ShapeFlags.SLOTS_CHILDREN */;
8317
8351
  const slotFlag = children._;
8318
8352
  if (!slotFlag && !(InternalObjectKey in children)) {
8319
8353
  children._ctx = currentRenderingInstance;
8320
8354
  }
8321
- else if (slotFlag === 3 /* FORWARDED */ && currentRenderingInstance) {
8355
+ else if (slotFlag === 3 /* SlotFlags.FORWARDED */ && currentRenderingInstance) {
8322
8356
  // a child component receives forwarded slots from the parent.
8323
8357
  // its slot type is determined by its parent's slot type.
8324
- if (currentRenderingInstance.slots._ === 1 /* STABLE */) {
8325
- children._ = 1 /* STABLE */;
8358
+ if (currentRenderingInstance.slots._ === 1 /* SlotFlags.STABLE */) {
8359
+ children._ = 1 /* SlotFlags.STABLE */;
8326
8360
  }
8327
8361
  else {
8328
- children._ = 2 /* DYNAMIC */;
8329
- vnode.patchFlag |= 1024 /* DYNAMIC_SLOTS */;
8362
+ children._ = 2 /* SlotFlags.DYNAMIC */;
8363
+ vnode.patchFlag |= 1024 /* PatchFlags.DYNAMIC_SLOTS */;
8330
8364
  }
8331
8365
  }
8332
8366
  }
8333
8367
  }
8334
8368
  else if (isFunction(children)) {
8335
8369
  children = { default: children, _ctx: currentRenderingInstance };
8336
- type = 32 /* SLOTS_CHILDREN */;
8370
+ type = 32 /* ShapeFlags.SLOTS_CHILDREN */;
8337
8371
  }
8338
8372
  else {
8339
8373
  children = String(children);
8340
8374
  // force teleport children to array so it can be moved around
8341
- if (shapeFlag & 64 /* TELEPORT */) {
8342
- type = 16 /* ARRAY_CHILDREN */;
8375
+ if (shapeFlag & 64 /* ShapeFlags.TELEPORT */) {
8376
+ type = 16 /* ShapeFlags.ARRAY_CHILDREN */;
8343
8377
  children = [createTextVNode(children)];
8344
8378
  }
8345
8379
  else {
8346
- type = 8 /* TEXT_CHILDREN */;
8380
+ type = 8 /* ShapeFlags.TEXT_CHILDREN */;
8347
8381
  }
8348
8382
  }
8349
8383
  vnode.children = children;
@@ -8381,7 +8415,7 @@ function mergeProps(...args) {
8381
8415
  return ret;
8382
8416
  }
8383
8417
  function invokeVNodeHook(hook, instance, vnode, prevVNode = null) {
8384
- callWithAsyncErrorHandling(hook, instance, 7 /* VNODE_HOOK */, [
8418
+ callWithAsyncErrorHandling(hook, instance, 7 /* ErrorCodes.VNODE_HOOK */, [
8385
8419
  vnode,
8386
8420
  prevVNode
8387
8421
  ]);
@@ -8489,7 +8523,7 @@ function validateComponentName(name, config) {
8489
8523
  }
8490
8524
  }
8491
8525
  function isStatefulComponent(instance) {
8492
- return instance.vnode.shapeFlag & 4 /* STATEFUL_COMPONENT */;
8526
+ return instance.vnode.shapeFlag & 4 /* ShapeFlags.STATEFUL_COMPONENT */;
8493
8527
  }
8494
8528
  let isInSSRComponentSetup = false;
8495
8529
  function setupComponent(instance, isSSR = false) {
@@ -8544,7 +8578,7 @@ function setupStatefulComponent(instance, isSSR) {
8544
8578
  setup.length > 1 ? createSetupContext(instance) : null);
8545
8579
  setCurrentInstance(instance);
8546
8580
  pauseTracking();
8547
- const setupResult = callWithErrorHandling(setup, instance, 0 /* SETUP_FUNCTION */, [shallowReadonly(instance.props) , setupContext]);
8581
+ const setupResult = callWithErrorHandling(setup, instance, 0 /* ErrorCodes.SETUP_FUNCTION */, [shallowReadonly(instance.props) , setupContext]);
8548
8582
  resetTracking();
8549
8583
  unsetCurrentInstance();
8550
8584
  if (isPromise(setupResult)) {
@@ -8556,7 +8590,7 @@ function setupStatefulComponent(instance, isSSR) {
8556
8590
  handleSetupResult(instance, resolvedResult, isSSR);
8557
8591
  })
8558
8592
  .catch(e => {
8559
- handleError(e, instance, 0 /* SETUP_FUNCTION */);
8593
+ handleError(e, instance, 0 /* ErrorCodes.SETUP_FUNCTION */);
8560
8594
  });
8561
8595
  }
8562
8596
  else {
@@ -8631,7 +8665,8 @@ function finishComponentSetup(instance, isSSR, skipOptions) {
8631
8665
  // only do on-the-fly compile if not in SSR - SSR on-the-fly compilation
8632
8666
  // is done by server-renderer
8633
8667
  if (!isSSR && compile && !Component.render) {
8634
- const template = Component.template;
8668
+ const template = Component.template ||
8669
+ resolveMergedOptions(instance).template;
8635
8670
  if (template) {
8636
8671
  {
8637
8672
  startMeasure(instance, `compile`);
@@ -8683,7 +8718,7 @@ function createAttrsProxy(instance) {
8683
8718
  return new Proxy(instance.attrs, {
8684
8719
  get(target, key) {
8685
8720
  markAttrsAccessed();
8686
- track(instance, "get" /* GET */, '$attrs');
8721
+ track(instance, "get" /* TrackOpTypes.GET */, '$attrs');
8687
8722
  return target[key];
8688
8723
  },
8689
8724
  set() {
@@ -8739,10 +8774,10 @@ function getExposeProxy(instance) {
8739
8774
  }
8740
8775
  const classifyRE = /(?:^|[-_])(\w)/g;
8741
8776
  const classify = (str) => str.replace(classifyRE, c => c.toUpperCase()).replace(/[-_]/g, '');
8742
- function getComponentName(Component) {
8777
+ function getComponentName(Component, includeInferred = true) {
8743
8778
  return isFunction(Component)
8744
8779
  ? Component.displayName || Component.name
8745
- : Component.name;
8780
+ : Component.name || (includeInferred && Component.__name);
8746
8781
  }
8747
8782
  /* istanbul ignore next */
8748
8783
  function formatComponentName(instance, Component, isRoot = false) {
@@ -9186,9 +9221,9 @@ function isMemoSame(cached, memo) {
9186
9221
  }
9187
9222
 
9188
9223
  // Core API ------------------------------------------------------------------
9189
- const version = "3.2.36";
9224
+ const version = "3.2.39";
9190
9225
  /**
9191
- * SSR utils for \@vue/server-renderer. Only exposed in cjs builds.
9226
+ * SSR utils for \@vue/server-renderer. Only exposed in ssr-possible builds.
9192
9227
  * @internal
9193
9228
  */
9194
9229
  const ssrUtils = (null);
@@ -9553,7 +9588,8 @@ function parseName(name) {
9553
9588
  options[m[0].toLowerCase()] = true;
9554
9589
  }
9555
9590
  }
9556
- return [hyphenate(name.slice(2)), options];
9591
+ const event = name[2] === ':' ? name.slice(3) : hyphenate(name.slice(2));
9592
+ return [event, options];
9557
9593
  }
9558
9594
  function createInvoker(initialValue, instance) {
9559
9595
  const invoker = (e) => {
@@ -9565,7 +9601,7 @@ function createInvoker(initialValue, instance) {
9565
9601
  // AFTER it was attached.
9566
9602
  const timeStamp = e.timeStamp || _getNow();
9567
9603
  if (skipTimestampCheck || timeStamp >= invoker.attached - 1) {
9568
- callWithAsyncErrorHandling(patchStopImmediatePropagation(e, invoker.value), instance, 5 /* NATIVE_EVENT_HANDLER */, [e]);
9604
+ callWithAsyncErrorHandling(patchStopImmediatePropagation(e, invoker.value), instance, 5 /* ErrorCodes.NATIVE_EVENT_HANDLER */, [e]);
9569
9605
  }
9570
9606
  };
9571
9607
  invoker.value = initialValue;
@@ -9920,7 +9956,7 @@ function useCssVars(getter) {
9920
9956
  });
9921
9957
  }
9922
9958
  function setVarsOnVNode(vnode, vars) {
9923
- if (vnode.shapeFlag & 128 /* SUSPENSE */) {
9959
+ if (vnode.shapeFlag & 128 /* ShapeFlags.SUSPENSE */) {
9924
9960
  const suspense = vnode.suspense;
9925
9961
  vnode = suspense.activeBranch;
9926
9962
  if (suspense.pendingBranch && !suspense.isHydrating) {
@@ -9933,7 +9969,7 @@ function setVarsOnVNode(vnode, vars) {
9933
9969
  while (vnode.component) {
9934
9970
  vnode = vnode.component.subTree;
9935
9971
  }
9936
- if (vnode.shapeFlag & 1 /* ELEMENT */ && vnode.el) {
9972
+ if (vnode.shapeFlag & 1 /* ShapeFlags.ELEMENT */ && vnode.el) {
9937
9973
  setVarsOnNode(vnode.el, vars);
9938
9974
  }
9939
9975
  else if (vnode.type === Fragment) {