@vue/runtime-core 3.2.35 → 3.2.38

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.
@@ -14,7 +14,7 @@ function warn(msg, ...args) {
14
14
  const appWarnHandler = instance && instance.appContext.config.warnHandler;
15
15
  const trace = getComponentTrace();
16
16
  if (appWarnHandler) {
17
- callWithErrorHandling(appWarnHandler, instance, 11 /* APP_WARN_HANDLER */, [
17
+ callWithErrorHandling(appWarnHandler, instance, 11 /* ErrorCodes.APP_WARN_HANDLER */, [
18
18
  msg + args.join(''),
19
19
  instance && instance.proxy,
20
20
  trace
@@ -161,7 +161,7 @@ function handleError(err, instance, type, throwInDev = true) {
161
161
  // app-level handling
162
162
  const appErrorHandler = instance.appContext.config.errorHandler;
163
163
  if (appErrorHandler) {
164
- callWithErrorHandling(appErrorHandler, null, 10 /* APP_ERROR_HANDLER */, [err, exposedInstance, errorInfo]);
164
+ callWithErrorHandling(appErrorHandler, null, 10 /* ErrorCodes.APP_ERROR_HANDLER */, [err, exposedInstance, errorInfo]);
165
165
  return;
166
166
  }
167
167
  }
@@ -178,15 +178,11 @@ let isFlushing = false;
178
178
  let isFlushPending = false;
179
179
  const queue = [];
180
180
  let flushIndex = 0;
181
- const pendingPreFlushCbs = [];
182
- let activePreFlushCbs = null;
183
- let preFlushIndex = 0;
184
181
  const pendingPostFlushCbs = [];
185
182
  let activePostFlushCbs = null;
186
183
  let postFlushIndex = 0;
187
184
  const resolvedPromise = /*#__PURE__*/ Promise.resolve();
188
185
  let currentFlushPromise = null;
189
- let currentPreFlushParentJob = null;
190
186
  function nextTick(fn) {
191
187
  const p = currentFlushPromise || resolvedPromise;
192
188
  return fn ? p.then(this ? fn.bind(this) : fn) : p;
@@ -213,9 +209,8 @@ function queueJob(job) {
213
209
  // if the job is a watch() callback, the search will start with a +1 index to
214
210
  // allow it recursively trigger itself - it is the user's responsibility to
215
211
  // ensure it doesn't end up in an infinite loop.
216
- if ((!queue.length ||
217
- !queue.includes(job, isFlushing && job.allowRecurse ? flushIndex + 1 : flushIndex)) &&
218
- job !== currentPreFlushParentJob) {
212
+ if (!queue.length ||
213
+ !queue.includes(job, isFlushing && job.allowRecurse ? flushIndex + 1 : flushIndex)) {
219
214
  if (job.id == null) {
220
215
  queue.push(job);
221
216
  }
@@ -237,45 +232,32 @@ function invalidateJob(job) {
237
232
  queue.splice(i, 1);
238
233
  }
239
234
  }
240
- function queueCb(cb, activeQueue, pendingQueue, index) {
235
+ function queuePostFlushCb(cb) {
241
236
  if (!shared.isArray(cb)) {
242
- if (!activeQueue ||
243
- !activeQueue.includes(cb, cb.allowRecurse ? index + 1 : index)) {
244
- pendingQueue.push(cb);
237
+ if (!activePostFlushCbs ||
238
+ !activePostFlushCbs.includes(cb, cb.allowRecurse ? postFlushIndex + 1 : postFlushIndex)) {
239
+ pendingPostFlushCbs.push(cb);
245
240
  }
246
241
  }
247
242
  else {
248
243
  // if cb is an array, it is a component lifecycle hook which can only be
249
244
  // triggered by a job, which is already deduped in the main queue, so
250
245
  // we can skip duplicate check here to improve perf
251
- pendingQueue.push(...cb);
246
+ pendingPostFlushCbs.push(...cb);
252
247
  }
253
248
  queueFlush();
254
249
  }
255
- function queuePreFlushCb(cb) {
256
- queueCb(cb, activePreFlushCbs, pendingPreFlushCbs, preFlushIndex);
257
- }
258
- function queuePostFlushCb(cb) {
259
- queueCb(cb, activePostFlushCbs, pendingPostFlushCbs, postFlushIndex);
260
- }
261
- function flushPreFlushCbs(seen, parentJob = null) {
262
- if (pendingPreFlushCbs.length) {
263
- currentPreFlushParentJob = parentJob;
264
- activePreFlushCbs = [...new Set(pendingPreFlushCbs)];
265
- pendingPreFlushCbs.length = 0;
266
- for (preFlushIndex = 0; preFlushIndex < activePreFlushCbs.length; preFlushIndex++) {
267
- activePreFlushCbs[preFlushIndex]();
250
+ function flushPreFlushCbs(seen, i = flushIndex) {
251
+ for (; i < queue.length; i++) {
252
+ const cb = queue[i];
253
+ if (cb && cb.pre) {
254
+ queue.splice(i, 1);
255
+ i--;
256
+ cb();
268
257
  }
269
- activePreFlushCbs = null;
270
- preFlushIndex = 0;
271
- currentPreFlushParentJob = null;
272
- // recursively flush until it drains
273
- flushPreFlushCbs(seen, parentJob);
274
258
  }
275
259
  }
276
260
  function flushPostFlushCbs(seen) {
277
- // flush any pre cbs queued during the flush (e.g. pre watchers)
278
- flushPreFlushCbs();
279
261
  if (pendingPostFlushCbs.length) {
280
262
  const deduped = [...new Set(pendingPostFlushCbs)];
281
263
  pendingPostFlushCbs.length = 0;
@@ -294,10 +276,19 @@ function flushPostFlushCbs(seen) {
294
276
  }
295
277
  }
296
278
  const getId = (job) => job.id == null ? Infinity : job.id;
279
+ const comparator = (a, b) => {
280
+ const diff = getId(a) - getId(b);
281
+ if (diff === 0) {
282
+ if (a.pre && !b.pre)
283
+ return -1;
284
+ if (b.pre && !a.pre)
285
+ return 1;
286
+ }
287
+ return diff;
288
+ };
297
289
  function flushJobs(seen) {
298
290
  isFlushPending = false;
299
291
  isFlushing = true;
300
- flushPreFlushCbs(seen);
301
292
  // Sort queue before flush.
302
293
  // This ensures that:
303
294
  // 1. Components are updated from parent to child. (because parent is always
@@ -305,7 +296,7 @@ function flushJobs(seen) {
305
296
  // priority number)
306
297
  // 2. If a component is unmounted during a parent component's update,
307
298
  // its update can be skipped.
308
- queue.sort((a, b) => getId(a) - getId(b));
299
+ queue.sort(comparator);
309
300
  // conditional usage of checkRecursiveUpdate must be determined out of
310
301
  // try ... catch block since Rollup by default de-optimizes treeshaking
311
302
  // inside try-catch. This can leave all warning code unshaked. Although
@@ -318,7 +309,7 @@ function flushJobs(seen) {
318
309
  if (job && job.active !== false) {
319
310
  if (false && check(job)) ;
320
311
  // console.log(`running:`, job.id)
321
- callWithErrorHandling(job, null, 14 /* SCHEDULER */);
312
+ callWithErrorHandling(job, null, 14 /* ErrorCodes.SCHEDULER */);
322
313
  }
323
314
  }
324
315
  }
@@ -330,10 +321,8 @@ function flushJobs(seen) {
330
321
  currentFlushPromise = null;
331
322
  // some postFlushCb queued jobs!
332
323
  // keep flushing until it drains.
333
- if (queue.length ||
334
- pendingPreFlushCbs.length ||
335
- pendingPostFlushCbs.length) {
336
- flushJobs(seen);
324
+ if (queue.length || pendingPostFlushCbs.length) {
325
+ flushJobs();
337
326
  }
338
327
  }
339
328
  }
@@ -403,7 +392,7 @@ function emit(instance, event, ...rawArgs) {
403
392
  handler = props[(handlerName = shared.toHandlerKey(shared.hyphenate(event)))];
404
393
  }
405
394
  if (handler) {
406
- callWithAsyncErrorHandling(handler, instance, 6 /* COMPONENT_EVENT_HANDLER */, args);
395
+ callWithAsyncErrorHandling(handler, instance, 6 /* ErrorCodes.COMPONENT_EVENT_HANDLER */, args);
407
396
  }
408
397
  const onceHandler = props[handlerName + `Once`];
409
398
  if (onceHandler) {
@@ -414,7 +403,7 @@ function emit(instance, event, ...rawArgs) {
414
403
  return;
415
404
  }
416
405
  instance.emitted[handlerName] = true;
417
- callWithAsyncErrorHandling(onceHandler, instance, 6 /* COMPONENT_EVENT_HANDLER */, args);
406
+ callWithAsyncErrorHandling(onceHandler, instance, 6 /* ErrorCodes.COMPONENT_EVENT_HANDLER */, args);
418
407
  }
419
408
  }
420
409
  function normalizeEmitsOptions(comp, appContext, asMixin = false) {
@@ -446,7 +435,9 @@ function normalizeEmitsOptions(comp, appContext, asMixin = false) {
446
435
  }
447
436
  }
448
437
  if (!raw && !hasExtends) {
449
- cache.set(comp, null);
438
+ if (shared.isObject(comp)) {
439
+ cache.set(comp, null);
440
+ }
450
441
  return null;
451
442
  }
452
443
  if (shared.isArray(raw)) {
@@ -455,7 +446,9 @@ function normalizeEmitsOptions(comp, appContext, asMixin = false) {
455
446
  else {
456
447
  shared.extend(normalized, raw);
457
448
  }
458
- cache.set(comp, normalized);
449
+ if (shared.isObject(comp)) {
450
+ cache.set(comp, normalized);
451
+ }
459
452
  return normalized;
460
453
  }
461
454
  // Check if an incoming prop key is a declared emit event listener.
@@ -561,7 +554,7 @@ function renderComponentRoot(instance) {
561
554
  let fallthroughAttrs;
562
555
  const prev = setCurrentRenderingInstance(instance);
563
556
  try {
564
- if (vnode.shapeFlag & 4 /* STATEFUL_COMPONENT */) {
557
+ if (vnode.shapeFlag & 4 /* ShapeFlags.STATEFUL_COMPONENT */) {
565
558
  // withProxy is a proxy with a different `has` trap only for
566
559
  // runtime-compiled render functions using `with` block.
567
560
  const proxyToUse = withProxy || proxy;
@@ -592,7 +585,7 @@ function renderComponentRoot(instance) {
592
585
  }
593
586
  catch (err) {
594
587
  blockStack.length = 0;
595
- handleError(err, instance, 1 /* RENDER_FUNCTION */);
588
+ handleError(err, instance, 1 /* ErrorCodes.RENDER_FUNCTION */);
596
589
  result = createVNode(Comment);
597
590
  }
598
591
  // attr merging
@@ -603,7 +596,7 @@ function renderComponentRoot(instance) {
603
596
  const keys = Object.keys(fallthroughAttrs);
604
597
  const { shapeFlag } = root;
605
598
  if (keys.length) {
606
- if (shapeFlag & (1 /* ELEMENT */ | 6 /* COMPONENT */)) {
599
+ if (shapeFlag & (1 /* ShapeFlags.ELEMENT */ | 6 /* ShapeFlags.COMPONENT */)) {
607
600
  if (propsOptions && keys.some(shared.isModelListener)) {
608
601
  // If a v-model listener (onUpdate:xxx) has a corresponding declared
609
602
  // prop, it indicates this component expects to handle v-model and
@@ -680,19 +673,19 @@ function shouldUpdateComponent(prevVNode, nextVNode, optimized) {
680
673
  return true;
681
674
  }
682
675
  if (optimized && patchFlag >= 0) {
683
- if (patchFlag & 1024 /* DYNAMIC_SLOTS */) {
676
+ if (patchFlag & 1024 /* PatchFlags.DYNAMIC_SLOTS */) {
684
677
  // slot content that references values that might have changed,
685
678
  // e.g. in a v-for
686
679
  return true;
687
680
  }
688
- if (patchFlag & 16 /* FULL_PROPS */) {
681
+ if (patchFlag & 16 /* PatchFlags.FULL_PROPS */) {
689
682
  if (!prevProps) {
690
683
  return !!nextProps;
691
684
  }
692
685
  // presence of this flag indicates props are always non-null
693
686
  return hasPropsChanged(prevProps, nextProps, emits);
694
687
  }
695
- else if (patchFlag & 8 /* PROPS */) {
688
+ else if (patchFlag & 8 /* PatchFlags.PROPS */) {
696
689
  const dynamicProps = nextVNode.dynamicProps;
697
690
  for (let i = 0; i < dynamicProps.length; i++) {
698
691
  const key = dynamicProps[i];
@@ -935,7 +928,7 @@ function createSuspenseBoundary(vnode, parent, parentComponent, container, hidde
935
928
  if (delayEnter) {
936
929
  activeBranch.transition.afterLeave = () => {
937
930
  if (pendingId === suspense.pendingId) {
938
- move(pendingBranch, container, anchor, 0 /* ENTER */);
931
+ move(pendingBranch, container, anchor, 0 /* MoveType.ENTER */);
939
932
  }
940
933
  };
941
934
  }
@@ -950,7 +943,7 @@ function createSuspenseBoundary(vnode, parent, parentComponent, container, hidde
950
943
  }
951
944
  if (!delayEnter) {
952
945
  // move content from off-dom container to actual container
953
- move(pendingBranch, container, anchor, 0 /* ENTER */);
946
+ move(pendingBranch, container, anchor, 0 /* MoveType.ENTER */);
954
947
  }
955
948
  }
956
949
  setActiveBranch(suspense, pendingBranch);
@@ -1024,7 +1017,7 @@ function createSuspenseBoundary(vnode, parent, parentComponent, container, hidde
1024
1017
  const hydratedEl = instance.vnode.el;
1025
1018
  instance
1026
1019
  .asyncDep.catch(err => {
1027
- handleError(err, instance, 0 /* SETUP_FUNCTION */);
1020
+ handleError(err, instance, 0 /* ErrorCodes.SETUP_FUNCTION */);
1028
1021
  })
1029
1022
  .then(asyncSetupResult => {
1030
1023
  // retry when the setup() promise resolves.
@@ -1092,7 +1085,7 @@ function hydrateSuspense(node, vnode, parentComponent, parentSuspense, isSVG, sl
1092
1085
  }
1093
1086
  function normalizeSuspenseChildren(vnode) {
1094
1087
  const { shapeFlag, children } = vnode;
1095
- const isSlotChildren = shapeFlag & 32 /* SLOTS_CHILDREN */;
1088
+ const isSlotChildren = shapeFlag & 32 /* ShapeFlags.SLOTS_CHILDREN */;
1096
1089
  vnode.ssContent = normalizeSuspenseSlot(isSlotChildren ? children.default : children);
1097
1090
  vnode.ssFallback = isSlotChildren
1098
1091
  ? normalizeSuspenseSlot(children.fallback)
@@ -1232,7 +1225,7 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = sh
1232
1225
  return traverse(s);
1233
1226
  }
1234
1227
  else if (shared.isFunction(s)) {
1235
- return callWithErrorHandling(s, instance, 2 /* WATCH_GETTER */);
1228
+ return callWithErrorHandling(s, instance, 2 /* ErrorCodes.WATCH_GETTER */);
1236
1229
  }
1237
1230
  else ;
1238
1231
  });
@@ -1240,7 +1233,7 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = sh
1240
1233
  else if (shared.isFunction(source)) {
1241
1234
  if (cb) {
1242
1235
  // getter with cb
1243
- getter = () => callWithErrorHandling(source, instance, 2 /* WATCH_GETTER */);
1236
+ getter = () => callWithErrorHandling(source, instance, 2 /* ErrorCodes.WATCH_GETTER */);
1244
1237
  }
1245
1238
  else {
1246
1239
  // no cb -> simple effect
@@ -1251,7 +1244,7 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = sh
1251
1244
  if (cleanup) {
1252
1245
  cleanup();
1253
1246
  }
1254
- return callWithAsyncErrorHandling(source, instance, 3 /* WATCH_CALLBACK */, [onCleanup]);
1247
+ return callWithAsyncErrorHandling(source, instance, 3 /* ErrorCodes.WATCH_CALLBACK */, [onCleanup]);
1255
1248
  };
1256
1249
  }
1257
1250
  }
@@ -1265,7 +1258,7 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = sh
1265
1258
  let cleanup;
1266
1259
  let onCleanup = (fn) => {
1267
1260
  cleanup = effect.onStop = () => {
1268
- callWithErrorHandling(fn, instance, 4 /* WATCH_CLEANUP */);
1261
+ callWithErrorHandling(fn, instance, 4 /* ErrorCodes.WATCH_CLEANUP */);
1269
1262
  };
1270
1263
  };
1271
1264
  // in SSR there is no need to setup an actual effect, and it should be noop
@@ -1277,7 +1270,7 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = sh
1277
1270
  getter();
1278
1271
  }
1279
1272
  else if (immediate) {
1280
- callWithAsyncErrorHandling(cb, instance, 3 /* WATCH_CALLBACK */, [
1273
+ callWithAsyncErrorHandling(cb, instance, 3 /* ErrorCodes.WATCH_CALLBACK */, [
1281
1274
  getter(),
1282
1275
  isMultiSource ? [] : undefined,
1283
1276
  onCleanup
@@ -1303,7 +1296,7 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = sh
1303
1296
  if (cleanup) {
1304
1297
  cleanup();
1305
1298
  }
1306
- callWithAsyncErrorHandling(cb, instance, 3 /* WATCH_CALLBACK */, [
1299
+ callWithAsyncErrorHandling(cb, instance, 3 /* ErrorCodes.WATCH_CALLBACK */, [
1307
1300
  newValue,
1308
1301
  // pass undefined as the old value when it's changed for the first time
1309
1302
  oldValue === INITIAL_WATCHER_VALUE ? undefined : oldValue,
@@ -1329,7 +1322,10 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = sh
1329
1322
  }
1330
1323
  else {
1331
1324
  // default: 'pre'
1332
- scheduler = () => queuePreFlushCb(job);
1325
+ job.pre = true;
1326
+ if (instance)
1327
+ job.id = instance.uid;
1328
+ scheduler = () => queueJob(job);
1333
1329
  }
1334
1330
  const effect = new reactivity.ReactiveEffect(getter, scheduler);
1335
1331
  // initial run
@@ -1392,7 +1388,7 @@ function createPathGetter(ctx, path) {
1392
1388
  };
1393
1389
  }
1394
1390
  function traverse(value, seen) {
1395
- if (!shared.isObject(value) || value["__v_skip" /* SKIP */]) {
1391
+ if (!shared.isObject(value) || value["__v_skip" /* ReactiveFlags.SKIP */]) {
1396
1392
  return value;
1397
1393
  }
1398
1394
  seen = seen || new Set();
@@ -1562,7 +1558,7 @@ function resolveTransitionHooks(vnode, props, state, instance) {
1562
1558
  const leavingVNodesCache = getLeavingNodesForType(state, vnode);
1563
1559
  const callHook = (hook, args) => {
1564
1560
  hook &&
1565
- callWithAsyncErrorHandling(hook, instance, 9 /* TRANSITION_HOOK */, args);
1561
+ callWithAsyncErrorHandling(hook, instance, 9 /* ErrorCodes.TRANSITION_HOOK */, args);
1566
1562
  };
1567
1563
  const callAsyncHook = (hook, args) => {
1568
1564
  const done = args[1];
@@ -1698,10 +1694,10 @@ function getKeepAliveChild(vnode) {
1698
1694
  : vnode;
1699
1695
  }
1700
1696
  function setTransitionHooks(vnode, hooks) {
1701
- if (vnode.shapeFlag & 6 /* COMPONENT */ && vnode.component) {
1697
+ if (vnode.shapeFlag & 6 /* ShapeFlags.COMPONENT */ && vnode.component) {
1702
1698
  setTransitionHooks(vnode.component.subTree, hooks);
1703
1699
  }
1704
- else if (vnode.shapeFlag & 128 /* SUSPENSE */) {
1700
+ else if (vnode.shapeFlag & 128 /* ShapeFlags.SUSPENSE */) {
1705
1701
  vnode.ssContent.transition = hooks.clone(vnode.ssContent);
1706
1702
  vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
1707
1703
  }
@@ -1720,7 +1716,7 @@ function getTransitionRawChildren(children, keepComment = false, parentKey) {
1720
1716
  : String(parentKey) + String(child.key != null ? child.key : i);
1721
1717
  // handle fragment children case, e.g. v-for
1722
1718
  if (child.type === Fragment) {
1723
- if (child.patchFlag & 128 /* KEYED_FRAGMENT */)
1719
+ if (child.patchFlag & 128 /* PatchFlags.KEYED_FRAGMENT */)
1724
1720
  keyedFragmentCount++;
1725
1721
  ret = ret.concat(getTransitionRawChildren(child.children, keepComment, key));
1726
1722
  }
@@ -1735,7 +1731,7 @@ function getTransitionRawChildren(children, keepComment = false, parentKey) {
1735
1731
  // these children to force full diffs to ensure correct behavior.
1736
1732
  if (keyedFragmentCount > 1) {
1737
1733
  for (let i = 0; i < ret.length; i++) {
1738
- ret[i].patchFlag = -2 /* BAIL */;
1734
+ ret[i].patchFlag = -2 /* PatchFlags.BAIL */;
1739
1735
  }
1740
1736
  }
1741
1737
  return ret;
@@ -1806,7 +1802,7 @@ function defineAsyncComponent(source) {
1806
1802
  }
1807
1803
  const onError = (err) => {
1808
1804
  pendingRequest = null;
1809
- handleError(err, instance, 13 /* ASYNC_COMPONENT_LOADER */, !errorComponent /* do not throw in dev if user provided error component */);
1805
+ handleError(err, instance, 13 /* ErrorCodes.ASYNC_COMPONENT_LOADER */, !errorComponent /* do not throw in dev if user provided error component */);
1810
1806
  };
1811
1807
  // suspense-controlled or SSR.
1812
1808
  if ((suspensible && instance.suspense) ||
@@ -1913,7 +1909,7 @@ const KeepAliveImpl = {
1913
1909
  const storageContainer = createElement('div');
1914
1910
  sharedContext.activate = (vnode, container, anchor, isSVG, optimized) => {
1915
1911
  const instance = vnode.component;
1916
- move(vnode, container, anchor, 0 /* ENTER */, parentSuspense);
1912
+ move(vnode, container, anchor, 0 /* MoveType.ENTER */, parentSuspense);
1917
1913
  // in case props have changed
1918
1914
  patch(instance.vnode, vnode, container, anchor, instance, parentSuspense, isSVG, vnode.slotScopeIds, optimized);
1919
1915
  queuePostRenderEffect(() => {
@@ -1929,7 +1925,7 @@ const KeepAliveImpl = {
1929
1925
  };
1930
1926
  sharedContext.deactivate = (vnode) => {
1931
1927
  const instance = vnode.component;
1932
- move(vnode, storageContainer, null, 1 /* LEAVE */, parentSuspense);
1928
+ move(vnode, storageContainer, null, 1 /* MoveType.LEAVE */, parentSuspense);
1933
1929
  queuePostRenderEffect(() => {
1934
1930
  if (instance.da) {
1935
1931
  shared.invokeArrayFns(instance.da);
@@ -2011,8 +2007,8 @@ const KeepAliveImpl = {
2011
2007
  return children;
2012
2008
  }
2013
2009
  else if (!isVNode(rawVNode) ||
2014
- (!(rawVNode.shapeFlag & 4 /* STATEFUL_COMPONENT */) &&
2015
- !(rawVNode.shapeFlag & 128 /* SUSPENSE */))) {
2010
+ (!(rawVNode.shapeFlag & 4 /* ShapeFlags.STATEFUL_COMPONENT */) &&
2011
+ !(rawVNode.shapeFlag & 128 /* ShapeFlags.SUSPENSE */))) {
2016
2012
  current = null;
2017
2013
  return rawVNode;
2018
2014
  }
@@ -2034,7 +2030,7 @@ const KeepAliveImpl = {
2034
2030
  // clone vnode if it's reused because we are going to mutate it
2035
2031
  if (vnode.el) {
2036
2032
  vnode = cloneVNode(vnode);
2037
- if (rawVNode.shapeFlag & 128 /* SUSPENSE */) {
2033
+ if (rawVNode.shapeFlag & 128 /* ShapeFlags.SUSPENSE */) {
2038
2034
  rawVNode.ssContent = vnode;
2039
2035
  }
2040
2036
  }
@@ -2053,7 +2049,7 @@ const KeepAliveImpl = {
2053
2049
  setTransitionHooks(vnode, vnode.transition);
2054
2050
  }
2055
2051
  // avoid vnode being mounted as fresh
2056
- vnode.shapeFlag |= 512 /* COMPONENT_KEPT_ALIVE */;
2052
+ vnode.shapeFlag |= 512 /* ShapeFlags.COMPONENT_KEPT_ALIVE */;
2057
2053
  // make this key the freshest
2058
2054
  keys.delete(key);
2059
2055
  keys.add(key);
@@ -2066,7 +2062,7 @@ const KeepAliveImpl = {
2066
2062
  }
2067
2063
  }
2068
2064
  // avoid vnode being unmounted
2069
- vnode.shapeFlag |= 256 /* COMPONENT_SHOULD_KEEP_ALIVE */;
2065
+ vnode.shapeFlag |= 256 /* ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE */;
2070
2066
  current = vnode;
2071
2067
  return isSuspense(rawVNode.type) ? rawVNode : vnode;
2072
2068
  };
@@ -2089,10 +2085,10 @@ function matches(pattern, name) {
2089
2085
  return false;
2090
2086
  }
2091
2087
  function onActivated(hook, target) {
2092
- registerKeepAliveHook(hook, "a" /* ACTIVATED */, target);
2088
+ registerKeepAliveHook(hook, "a" /* LifecycleHooks.ACTIVATED */, target);
2093
2089
  }
2094
2090
  function onDeactivated(hook, target) {
2095
- registerKeepAliveHook(hook, "da" /* DEACTIVATED */, target);
2091
+ registerKeepAliveHook(hook, "da" /* LifecycleHooks.DEACTIVATED */, target);
2096
2092
  }
2097
2093
  function registerKeepAliveHook(hook, type, target = currentInstance) {
2098
2094
  // cache the deactivate branch check wrapper for injected hooks so the same
@@ -2136,16 +2132,16 @@ function injectToKeepAliveRoot(hook, type, target, keepAliveRoot) {
2136
2132
  }
2137
2133
  function resetShapeFlag(vnode) {
2138
2134
  let shapeFlag = vnode.shapeFlag;
2139
- if (shapeFlag & 256 /* COMPONENT_SHOULD_KEEP_ALIVE */) {
2140
- shapeFlag -= 256 /* COMPONENT_SHOULD_KEEP_ALIVE */;
2135
+ if (shapeFlag & 256 /* ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE */) {
2136
+ shapeFlag -= 256 /* ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE */;
2141
2137
  }
2142
- if (shapeFlag & 512 /* COMPONENT_KEPT_ALIVE */) {
2143
- shapeFlag -= 512 /* COMPONENT_KEPT_ALIVE */;
2138
+ if (shapeFlag & 512 /* ShapeFlags.COMPONENT_KEPT_ALIVE */) {
2139
+ shapeFlag -= 512 /* ShapeFlags.COMPONENT_KEPT_ALIVE */;
2144
2140
  }
2145
2141
  vnode.shapeFlag = shapeFlag;
2146
2142
  }
2147
2143
  function getInnerChild(vnode) {
2148
- return vnode.shapeFlag & 128 /* SUSPENSE */ ? vnode.ssContent : vnode;
2144
+ return vnode.shapeFlag & 128 /* ShapeFlags.SUSPENSE */ ? vnode.ssContent : vnode;
2149
2145
  }
2150
2146
 
2151
2147
  function injectHook(type, hook, target = currentInstance, prepend = false) {
@@ -2182,19 +2178,19 @@ function injectHook(type, hook, target = currentInstance, prepend = false) {
2182
2178
  }
2183
2179
  const createHook = (lifecycle) => (hook, target = currentInstance) =>
2184
2180
  // post-create lifecycle registrations are noops during SSR (except for serverPrefetch)
2185
- (!isInSSRComponentSetup || lifecycle === "sp" /* SERVER_PREFETCH */) &&
2181
+ (!isInSSRComponentSetup || lifecycle === "sp" /* LifecycleHooks.SERVER_PREFETCH */) &&
2186
2182
  injectHook(lifecycle, hook, target);
2187
- const onBeforeMount = createHook("bm" /* BEFORE_MOUNT */);
2188
- const onMounted = createHook("m" /* MOUNTED */);
2189
- const onBeforeUpdate = createHook("bu" /* BEFORE_UPDATE */);
2190
- const onUpdated = createHook("u" /* UPDATED */);
2191
- const onBeforeUnmount = createHook("bum" /* BEFORE_UNMOUNT */);
2192
- const onUnmounted = createHook("um" /* UNMOUNTED */);
2193
- const onServerPrefetch = createHook("sp" /* SERVER_PREFETCH */);
2194
- const onRenderTriggered = createHook("rtg" /* RENDER_TRIGGERED */);
2195
- const onRenderTracked = createHook("rtc" /* RENDER_TRACKED */);
2183
+ const onBeforeMount = createHook("bm" /* LifecycleHooks.BEFORE_MOUNT */);
2184
+ const onMounted = createHook("m" /* LifecycleHooks.MOUNTED */);
2185
+ const onBeforeUpdate = createHook("bu" /* LifecycleHooks.BEFORE_UPDATE */);
2186
+ const onUpdated = createHook("u" /* LifecycleHooks.UPDATED */);
2187
+ const onBeforeUnmount = createHook("bum" /* LifecycleHooks.BEFORE_UNMOUNT */);
2188
+ const onUnmounted = createHook("um" /* LifecycleHooks.UNMOUNTED */);
2189
+ const onServerPrefetch = createHook("sp" /* LifecycleHooks.SERVER_PREFETCH */);
2190
+ const onRenderTriggered = createHook("rtg" /* LifecycleHooks.RENDER_TRIGGERED */);
2191
+ const onRenderTracked = createHook("rtc" /* LifecycleHooks.RENDER_TRACKED */);
2196
2192
  function onErrorCaptured(hook, target = currentInstance) {
2197
- injectHook("ec" /* ERROR_CAPTURED */, hook, target);
2193
+ injectHook("ec" /* LifecycleHooks.ERROR_CAPTURED */, hook, target);
2198
2194
  }
2199
2195
 
2200
2196
  /**
@@ -2255,7 +2251,7 @@ function invokeDirectiveHook(vnode, prevVNode, instance, name) {
2255
2251
  // disable tracking inside all lifecycle hooks
2256
2252
  // since they can potentially be called inside effects.
2257
2253
  reactivity.pauseTracking();
2258
- callWithAsyncErrorHandling(hook, instance, 8 /* DIRECTIVE_HOOK */, [
2254
+ callWithAsyncErrorHandling(hook, instance, 8 /* ErrorCodes.DIRECTIVE_HOOK */, [
2259
2255
  vnode.el,
2260
2256
  binding,
2261
2257
  vnode,
@@ -2300,7 +2296,7 @@ function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false
2300
2296
  const Component = instance.type;
2301
2297
  // explicit self name has highest priority
2302
2298
  if (type === COMPONENTS) {
2303
- const selfName = getComponentName(Component);
2299
+ const selfName = getComponentName(Component, false /* do not include inferred name to avoid breaking existing code */);
2304
2300
  if (selfName &&
2305
2301
  (selfName === name ||
2306
2302
  selfName === shared.camelize(name) ||
@@ -2383,7 +2379,13 @@ function createSlots(slots, dynamicSlots) {
2383
2379
  }
2384
2380
  else if (slot) {
2385
2381
  // conditional single slot generated by <template v-if="..." #foo>
2386
- slots[slot.name] = slot.fn;
2382
+ slots[slot.name] = slot.key
2383
+ ? (...args) => {
2384
+ const res = slot.fn(...args);
2385
+ res.key = slot.key;
2386
+ return res;
2387
+ }
2388
+ : slot.fn;
2387
2389
  }
2388
2390
  }
2389
2391
  return slots;
@@ -2413,9 +2415,15 @@ fallback, noSlotted) {
2413
2415
  }
2414
2416
  openBlock();
2415
2417
  const validSlotContent = slot && ensureValidVNode(slot(props));
2416
- const rendered = createBlock(Fragment, { key: props.key || `_${name}` }, validSlotContent || (fallback ? fallback() : []), validSlotContent && slots._ === 1 /* STABLE */
2417
- ? 64 /* STABLE_FRAGMENT */
2418
- : -2 /* BAIL */);
2418
+ const rendered = createBlock(Fragment, {
2419
+ key: props.key ||
2420
+ // slot content array of a dynamic conditional slot may have a branch
2421
+ // key attached in the `createSlots` helper, respect that
2422
+ (validSlotContent && validSlotContent.key) ||
2423
+ `_${name}`
2424
+ }, validSlotContent || (fallback ? fallback() : []), validSlotContent && slots._ === 1 /* SlotFlags.STABLE */
2425
+ ? 64 /* PatchFlags.STABLE_FRAGMENT */
2426
+ : -2 /* PatchFlags.BAIL */);
2419
2427
  if (!noSlotted && rendered.scopeId) {
2420
2428
  rendered.slotScopeIds = [rendered.scopeId + '-s'];
2421
2429
  }
@@ -2443,10 +2451,12 @@ function ensureValidVNode(vnodes) {
2443
2451
  * For prefixing keys in v-on="obj" with "on"
2444
2452
  * @private
2445
2453
  */
2446
- function toHandlers(obj) {
2454
+ function toHandlers(obj, preserveCaseIfNecessary) {
2447
2455
  const ret = {};
2448
2456
  for (const key in obj) {
2449
- ret[shared.toHandlerKey(key)] = obj[key];
2457
+ ret[preserveCaseIfNecessary && /[A-Z]/.test(key)
2458
+ ? `on:${key}`
2459
+ : shared.toHandlerKey(key)] = obj[key];
2450
2460
  }
2451
2461
  return ret;
2452
2462
  }
@@ -2496,23 +2506,23 @@ const PublicInstanceProxyHandlers = {
2496
2506
  const n = accessCache[key];
2497
2507
  if (n !== undefined) {
2498
2508
  switch (n) {
2499
- case 1 /* SETUP */:
2509
+ case 1 /* AccessTypes.SETUP */:
2500
2510
  return setupState[key];
2501
- case 2 /* DATA */:
2511
+ case 2 /* AccessTypes.DATA */:
2502
2512
  return data[key];
2503
- case 4 /* CONTEXT */:
2513
+ case 4 /* AccessTypes.CONTEXT */:
2504
2514
  return ctx[key];
2505
- case 3 /* PROPS */:
2515
+ case 3 /* AccessTypes.PROPS */:
2506
2516
  return props[key];
2507
2517
  // default: just fallthrough
2508
2518
  }
2509
2519
  }
2510
2520
  else if (setupState !== shared.EMPTY_OBJ && shared.hasOwn(setupState, key)) {
2511
- accessCache[key] = 1 /* SETUP */;
2521
+ accessCache[key] = 1 /* AccessTypes.SETUP */;
2512
2522
  return setupState[key];
2513
2523
  }
2514
2524
  else if (data !== shared.EMPTY_OBJ && shared.hasOwn(data, key)) {
2515
- accessCache[key] = 2 /* DATA */;
2525
+ accessCache[key] = 2 /* AccessTypes.DATA */;
2516
2526
  return data[key];
2517
2527
  }
2518
2528
  else if (
@@ -2520,15 +2530,15 @@ const PublicInstanceProxyHandlers = {
2520
2530
  // props
2521
2531
  (normalizedProps = instance.propsOptions[0]) &&
2522
2532
  shared.hasOwn(normalizedProps, key)) {
2523
- accessCache[key] = 3 /* PROPS */;
2533
+ accessCache[key] = 3 /* AccessTypes.PROPS */;
2524
2534
  return props[key];
2525
2535
  }
2526
2536
  else if (ctx !== shared.EMPTY_OBJ && shared.hasOwn(ctx, key)) {
2527
- accessCache[key] = 4 /* CONTEXT */;
2537
+ accessCache[key] = 4 /* AccessTypes.CONTEXT */;
2528
2538
  return ctx[key];
2529
2539
  }
2530
2540
  else if (shouldCacheAccess) {
2531
- accessCache[key] = 0 /* OTHER */;
2541
+ accessCache[key] = 0 /* AccessTypes.OTHER */;
2532
2542
  }
2533
2543
  }
2534
2544
  const publicGetter = publicPropertiesMap[key];
@@ -2536,7 +2546,7 @@ const PublicInstanceProxyHandlers = {
2536
2546
  // public $xxx properties
2537
2547
  if (publicGetter) {
2538
2548
  if (key === '$attrs') {
2539
- reactivity.track(instance, "get" /* GET */, key);
2549
+ reactivity.track(instance, "get" /* TrackOpTypes.GET */, key);
2540
2550
  }
2541
2551
  return publicGetter(instance);
2542
2552
  }
@@ -2548,7 +2558,7 @@ const PublicInstanceProxyHandlers = {
2548
2558
  }
2549
2559
  else if (ctx !== shared.EMPTY_OBJ && shared.hasOwn(ctx, key)) {
2550
2560
  // user may set custom properties to `this` that start with `$`
2551
- accessCache[key] = 4 /* CONTEXT */;
2561
+ accessCache[key] = 4 /* AccessTypes.CONTEXT */;
2552
2562
  return ctx[key];
2553
2563
  }
2554
2564
  else if (
@@ -2629,7 +2639,7 @@ function applyOptions(instance) {
2629
2639
  // call beforeCreate first before accessing other options since
2630
2640
  // the hook may mutate resolved options (#2791)
2631
2641
  if (options.beforeCreate) {
2632
- callHook(options.beforeCreate, instance, "bc" /* BEFORE_CREATE */);
2642
+ callHook(options.beforeCreate, instance, "bc" /* LifecycleHooks.BEFORE_CREATE */);
2633
2643
  }
2634
2644
  const {
2635
2645
  // state
@@ -2710,7 +2720,7 @@ function applyOptions(instance) {
2710
2720
  });
2711
2721
  }
2712
2722
  if (created) {
2713
- callHook(created, instance, "c" /* CREATED */);
2723
+ callHook(created, instance, "c" /* LifecycleHooks.CREATED */);
2714
2724
  }
2715
2725
  function registerLifecycleHook(register, hook) {
2716
2726
  if (shared.isArray(hook)) {
@@ -2856,7 +2866,9 @@ function resolveMergedOptions(instance) {
2856
2866
  }
2857
2867
  mergeOptions(resolved, base, optionMergeStrategies);
2858
2868
  }
2859
- cache.set(base, resolved);
2869
+ if (shared.isObject(base)) {
2870
+ cache.set(base, resolved);
2871
+ }
2860
2872
  return resolved;
2861
2873
  }
2862
2874
  function mergeOptions(to, from, strats, asMixin = false) {
@@ -2988,8 +3000,8 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) {
2988
3000
  // - #1942 if hmr is enabled with sfc component
2989
3001
  // - vite#872 non-sfc component used by sfc component
2990
3002
  (optimized || patchFlag > 0) &&
2991
- !(patchFlag & 16 /* FULL_PROPS */)) {
2992
- if (patchFlag & 8 /* PROPS */) {
3003
+ !(patchFlag & 16 /* PatchFlags.FULL_PROPS */)) {
3004
+ if (patchFlag & 8 /* PatchFlags.PROPS */) {
2993
3005
  // Compiler-generated props & no keys change, just set the updated
2994
3006
  // the props.
2995
3007
  const propsToUpdate = instance.vnode.dynamicProps;
@@ -3068,7 +3080,7 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) {
3068
3080
  }
3069
3081
  // trigger updates for $attrs in case it's used in component slots
3070
3082
  if (hasAttrsChanged) {
3071
- reactivity.trigger(instance, "set" /* SET */, '$attrs');
3083
+ reactivity.trigger(instance, "set" /* TriggerOpTypes.SET */, '$attrs');
3072
3084
  }
3073
3085
  }
3074
3086
  function setFullProps(instance, rawProps, props, attrs) {
@@ -3134,11 +3146,11 @@ function resolvePropValue(options, props, key, value, instance, isAbsent) {
3134
3146
  }
3135
3147
  }
3136
3148
  // boolean casting
3137
- if (opt[0 /* shouldCast */]) {
3149
+ if (opt[0 /* BooleanFlags.shouldCast */]) {
3138
3150
  if (isAbsent && !hasDefault) {
3139
3151
  value = false;
3140
3152
  }
3141
- else if (opt[1 /* shouldCastTrue */] &&
3153
+ else if (opt[1 /* BooleanFlags.shouldCastTrue */] &&
3142
3154
  (value === '' || value === shared.hyphenate(key))) {
3143
3155
  value = true;
3144
3156
  }
@@ -3176,7 +3188,9 @@ function normalizePropsOptions(comp, appContext, asMixin = false) {
3176
3188
  }
3177
3189
  }
3178
3190
  if (!raw && !hasExtends) {
3179
- cache.set(comp, shared.EMPTY_ARR);
3191
+ if (shared.isObject(comp)) {
3192
+ cache.set(comp, shared.EMPTY_ARR);
3193
+ }
3180
3194
  return shared.EMPTY_ARR;
3181
3195
  }
3182
3196
  if (shared.isArray(raw)) {
@@ -3197,8 +3211,8 @@ function normalizePropsOptions(comp, appContext, asMixin = false) {
3197
3211
  if (prop) {
3198
3212
  const booleanIndex = getTypeIndex(Boolean, prop.type);
3199
3213
  const stringIndex = getTypeIndex(String, prop.type);
3200
- prop[0 /* shouldCast */] = booleanIndex > -1;
3201
- prop[1 /* shouldCastTrue */] =
3214
+ prop[0 /* BooleanFlags.shouldCast */] = booleanIndex > -1;
3215
+ prop[1 /* BooleanFlags.shouldCastTrue */] =
3202
3216
  stringIndex < 0 || booleanIndex < stringIndex;
3203
3217
  // if the prop needs boolean casting or default value
3204
3218
  if (booleanIndex > -1 || shared.hasOwn(prop, 'default')) {
@@ -3209,7 +3223,9 @@ function normalizePropsOptions(comp, appContext, asMixin = false) {
3209
3223
  }
3210
3224
  }
3211
3225
  const res = [normalized, needCastKeys];
3212
- cache.set(comp, res);
3226
+ if (shared.isObject(comp)) {
3227
+ cache.set(comp, res);
3228
+ }
3213
3229
  return res;
3214
3230
  }
3215
3231
  function validatePropName(key) {
@@ -3272,7 +3288,7 @@ const normalizeVNodeSlots = (instance, children) => {
3272
3288
  instance.slots.default = () => normalized;
3273
3289
  };
3274
3290
  const initSlots = (instance, children) => {
3275
- if (instance.vnode.shapeFlag & 32 /* SLOTS_CHILDREN */) {
3291
+ if (instance.vnode.shapeFlag & 32 /* ShapeFlags.SLOTS_CHILDREN */) {
3276
3292
  const type = children._;
3277
3293
  if (type) {
3278
3294
  // users can get the shallow readonly version of the slots object through `this.$slots`,
@@ -3297,11 +3313,11 @@ const updateSlots = (instance, children, optimized) => {
3297
3313
  const { vnode, slots } = instance;
3298
3314
  let needDeletionCheck = true;
3299
3315
  let deletionComparisonTarget = shared.EMPTY_OBJ;
3300
- if (vnode.shapeFlag & 32 /* SLOTS_CHILDREN */) {
3316
+ if (vnode.shapeFlag & 32 /* ShapeFlags.SLOTS_CHILDREN */) {
3301
3317
  const type = children._;
3302
3318
  if (type) {
3303
3319
  // compiled slots.
3304
- if (optimized && type === 1 /* STABLE */) {
3320
+ if (optimized && type === 1 /* SlotFlags.STABLE */) {
3305
3321
  // compiled AND stable.
3306
3322
  // no need to update, and skip stale slots removal.
3307
3323
  needDeletionCheck = false;
@@ -3314,7 +3330,7 @@ const updateSlots = (instance, children, optimized) => {
3314
3330
  // when rendering the optimized slots by manually written render function,
3315
3331
  // we need to delete the `slots._` flag if necessary to make subsequent updates reliable,
3316
3332
  // i.e. let the `renderSlot` create the bailed Fragment
3317
- if (!optimized && type === 1 /* STABLE */) {
3333
+ if (!optimized && type === 1 /* SlotFlags.STABLE */) {
3318
3334
  delete slots._;
3319
3335
  }
3320
3336
  }
@@ -3467,7 +3483,7 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
3467
3483
  // because the template ref is forwarded to inner component
3468
3484
  return;
3469
3485
  }
3470
- const refValue = vnode.shapeFlag & 4 /* STATEFUL_COMPONENT */
3486
+ const refValue = vnode.shapeFlag & 4 /* ShapeFlags.STATEFUL_COMPONENT */
3471
3487
  ? getExposeProxy(vnode.component) || vnode.component.proxy
3472
3488
  : vnode.el;
3473
3489
  const value = isUnmount ? null : refValue;
@@ -3488,7 +3504,7 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
3488
3504
  }
3489
3505
  }
3490
3506
  if (shared.isFunction(ref)) {
3491
- callWithErrorHandling(ref, owner, 12 /* FUNCTION_REF */, [value, refs]);
3507
+ callWithErrorHandling(ref, owner, 12 /* ErrorCodes.FUNCTION_REF */, [value, refs]);
3492
3508
  }
3493
3509
  else {
3494
3510
  const _isString = shared.isString(ref);
@@ -3525,7 +3541,7 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
3525
3541
  setupState[ref] = value;
3526
3542
  }
3527
3543
  }
3528
- else if (reactivity.isRef(ref)) {
3544
+ else if (_isRef) {
3529
3545
  ref.value = value;
3530
3546
  if (rawRef.k)
3531
3547
  refs[rawRef.k] = value;
@@ -3545,7 +3561,7 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
3545
3561
 
3546
3562
  let hasMismatch = false;
3547
3563
  const isSVGContainer = (container) => /svg/.test(container.namespaceURI) && container.tagName !== 'foreignObject';
3548
- const isComment = (node) => node.nodeType === 8 /* COMMENT */;
3564
+ const isComment = (node) => node.nodeType === 8 /* DOMNodeTypes.COMMENT */;
3549
3565
  // Note: hydration is DOM-specific
3550
3566
  // But we have to place it in core due to tight coupling with core - splitting
3551
3567
  // it out creates a ton of unnecessary complexity.
@@ -3557,11 +3573,13 @@ function createHydrationFunctions(rendererInternals) {
3557
3573
  if (!container.hasChildNodes()) {
3558
3574
  patch(null, vnode, container);
3559
3575
  flushPostFlushCbs();
3576
+ container._vnode = vnode;
3560
3577
  return;
3561
3578
  }
3562
3579
  hasMismatch = false;
3563
3580
  hydrateNode(container.firstChild, vnode, null, null, null);
3564
3581
  flushPostFlushCbs();
3582
+ container._vnode = vnode;
3565
3583
  if (hasMismatch && !false) {
3566
3584
  // this error should show up in production
3567
3585
  console.error(`Hydration completed but contains mismatches.`);
@@ -3573,14 +3591,14 @@ function createHydrationFunctions(rendererInternals) {
3573
3591
  const { type, ref, shapeFlag, patchFlag } = vnode;
3574
3592
  const domType = node.nodeType;
3575
3593
  vnode.el = node;
3576
- if (patchFlag === -2 /* BAIL */) {
3594
+ if (patchFlag === -2 /* PatchFlags.BAIL */) {
3577
3595
  optimized = false;
3578
3596
  vnode.dynamicChildren = null;
3579
3597
  }
3580
3598
  let nextNode = null;
3581
3599
  switch (type) {
3582
3600
  case Text:
3583
- if (domType !== 3 /* TEXT */) {
3601
+ if (domType !== 3 /* DOMNodeTypes.TEXT */) {
3584
3602
  // #5728 empty text node inside a slot can cause hydration failure
3585
3603
  // because the server rendered HTML won't contain a text node
3586
3604
  if (vnode.children === '') {
@@ -3600,7 +3618,7 @@ function createHydrationFunctions(rendererInternals) {
3600
3618
  }
3601
3619
  break;
3602
3620
  case Comment:
3603
- if (domType !== 8 /* COMMENT */ || isFragmentStart) {
3621
+ if (domType !== 8 /* DOMNodeTypes.COMMENT */ || isFragmentStart) {
3604
3622
  nextNode = onMismatch();
3605
3623
  }
3606
3624
  else {
@@ -3608,7 +3626,7 @@ function createHydrationFunctions(rendererInternals) {
3608
3626
  }
3609
3627
  break;
3610
3628
  case Static:
3611
- if (domType !== 1 /* ELEMENT */) {
3629
+ if (domType !== 1 /* DOMNodeTypes.ELEMENT */ && domType !== 3 /* DOMNodeTypes.TEXT */) {
3612
3630
  nextNode = onMismatch();
3613
3631
  }
3614
3632
  else {
@@ -3619,7 +3637,10 @@ function createHydrationFunctions(rendererInternals) {
3619
3637
  const needToAdoptContent = !vnode.children.length;
3620
3638
  for (let i = 0; i < vnode.staticCount; i++) {
3621
3639
  if (needToAdoptContent)
3622
- vnode.children += nextNode.outerHTML;
3640
+ vnode.children +=
3641
+ nextNode.nodeType === 1 /* DOMNodeTypes.ELEMENT */
3642
+ ? nextNode.outerHTML
3643
+ : nextNode.data;
3623
3644
  if (i === vnode.staticCount - 1) {
3624
3645
  vnode.anchor = nextNode;
3625
3646
  }
@@ -3637,8 +3658,8 @@ function createHydrationFunctions(rendererInternals) {
3637
3658
  }
3638
3659
  break;
3639
3660
  default:
3640
- if (shapeFlag & 1 /* ELEMENT */) {
3641
- if (domType !== 1 /* ELEMENT */ ||
3661
+ if (shapeFlag & 1 /* ShapeFlags.ELEMENT */) {
3662
+ if (domType !== 1 /* DOMNodeTypes.ELEMENT */ ||
3642
3663
  vnode.type.toLowerCase() !==
3643
3664
  node.tagName.toLowerCase()) {
3644
3665
  nextNode = onMismatch();
@@ -3647,7 +3668,7 @@ function createHydrationFunctions(rendererInternals) {
3647
3668
  nextNode = hydrateElement(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized);
3648
3669
  }
3649
3670
  }
3650
- else if (shapeFlag & 6 /* COMPONENT */) {
3671
+ else if (shapeFlag & 6 /* ShapeFlags.COMPONENT */) {
3651
3672
  // when setting up the render effect, if the initial vnode already
3652
3673
  // has .el set, the component will perform hydration instead of mount
3653
3674
  // on its sub-tree.
@@ -3686,15 +3707,15 @@ function createHydrationFunctions(rendererInternals) {
3686
3707
  vnode.component.subTree = subTree;
3687
3708
  }
3688
3709
  }
3689
- else if (shapeFlag & 64 /* TELEPORT */) {
3690
- if (domType !== 8 /* COMMENT */) {
3710
+ else if (shapeFlag & 64 /* ShapeFlags.TELEPORT */) {
3711
+ if (domType !== 8 /* DOMNodeTypes.COMMENT */) {
3691
3712
  nextNode = onMismatch();
3692
3713
  }
3693
3714
  else {
3694
3715
  nextNode = vnode.type.hydrate(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized, rendererInternals, hydrateChildren);
3695
3716
  }
3696
3717
  }
3697
- else if (shapeFlag & 128 /* SUSPENSE */) {
3718
+ else if (shapeFlag & 128 /* ShapeFlags.SUSPENSE */) {
3698
3719
  nextNode = vnode.type.hydrate(node, vnode, parentComponent, parentSuspense, isSVGContainer(parentNode(node)), slotScopeIds, optimized, rendererInternals, hydrateNode);
3699
3720
  }
3700
3721
  else ;
@@ -3712,7 +3733,7 @@ function createHydrationFunctions(rendererInternals) {
3712
3733
  const forcePatchValue = (type === 'input' && dirs) || type === 'option';
3713
3734
  // skip props & children if this is hoisted static nodes
3714
3735
  // #5405 in dev, always hydrate children for HMR
3715
- if (forcePatchValue || patchFlag !== -1 /* HOISTED */) {
3736
+ if (forcePatchValue || patchFlag !== -1 /* PatchFlags.HOISTED */) {
3716
3737
  if (dirs) {
3717
3738
  invokeDirectiveHook(vnode, null, parentComponent, 'created');
3718
3739
  }
@@ -3720,7 +3741,7 @@ function createHydrationFunctions(rendererInternals) {
3720
3741
  if (props) {
3721
3742
  if (forcePatchValue ||
3722
3743
  !optimized ||
3723
- patchFlag & (16 /* FULL_PROPS */ | 32 /* HYDRATE_EVENTS */)) {
3744
+ patchFlag & (16 /* PatchFlags.FULL_PROPS */ | 32 /* PatchFlags.HYDRATE_EVENTS */)) {
3724
3745
  for (const key in props) {
3725
3746
  if ((forcePatchValue && key.endsWith('value')) ||
3726
3747
  (shared.isOn(key) && !shared.isReservedProp(key))) {
@@ -3749,7 +3770,7 @@ function createHydrationFunctions(rendererInternals) {
3749
3770
  }, parentSuspense);
3750
3771
  }
3751
3772
  // children
3752
- if (shapeFlag & 16 /* ARRAY_CHILDREN */ &&
3773
+ if (shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */ &&
3753
3774
  // skip if element has innerHTML / textContent
3754
3775
  !(props && (props.innerHTML || props.textContent))) {
3755
3776
  let next = hydrateChildren(el.firstChild, vnode, el, parentComponent, parentSuspense, slotScopeIds, optimized);
@@ -3761,7 +3782,7 @@ function createHydrationFunctions(rendererInternals) {
3761
3782
  remove(cur);
3762
3783
  }
3763
3784
  }
3764
- else if (shapeFlag & 8 /* TEXT_CHILDREN */) {
3785
+ else if (shapeFlag & 8 /* ShapeFlags.TEXT_CHILDREN */) {
3765
3786
  if (el.textContent !== vnode.children) {
3766
3787
  hasMismatch = true;
3767
3788
  el.textContent = vnode.children;
@@ -3900,7 +3921,7 @@ function baseCreateRenderer(options, createHydrationFns) {
3900
3921
  unmount(n1, parentComponent, parentSuspense, true);
3901
3922
  n1 = null;
3902
3923
  }
3903
- if (n2.patchFlag === -2 /* BAIL */) {
3924
+ if (n2.patchFlag === -2 /* PatchFlags.BAIL */) {
3904
3925
  optimized = false;
3905
3926
  n2.dynamicChildren = null;
3906
3927
  }
@@ -3921,16 +3942,16 @@ function baseCreateRenderer(options, createHydrationFns) {
3921
3942
  processFragment(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
3922
3943
  break;
3923
3944
  default:
3924
- if (shapeFlag & 1 /* ELEMENT */) {
3945
+ if (shapeFlag & 1 /* ShapeFlags.ELEMENT */) {
3925
3946
  processElement(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
3926
3947
  }
3927
- else if (shapeFlag & 6 /* COMPONENT */) {
3948
+ else if (shapeFlag & 6 /* ShapeFlags.COMPONENT */) {
3928
3949
  processComponent(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
3929
3950
  }
3930
- else if (shapeFlag & 64 /* TELEPORT */) {
3951
+ else if (shapeFlag & 64 /* ShapeFlags.TELEPORT */) {
3931
3952
  type.process(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, internals);
3932
3953
  }
3933
- else if (shapeFlag & 128 /* SUSPENSE */) {
3954
+ else if (shapeFlag & 128 /* ShapeFlags.SUSPENSE */) {
3934
3955
  type.process(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, internals);
3935
3956
  }
3936
3957
  else ;
@@ -3996,7 +4017,7 @@ function baseCreateRenderer(options, createHydrationFns) {
3996
4017
  const { type, props, shapeFlag, transition, patchFlag, dirs } = vnode;
3997
4018
  if (vnode.el &&
3998
4019
  hostCloneNode !== undefined &&
3999
- patchFlag === -1 /* HOISTED */) {
4020
+ patchFlag === -1 /* PatchFlags.HOISTED */) {
4000
4021
  // If a vnode has non-null el, it means it's being reused.
4001
4022
  // Only static vnodes can be reused, so its mounted DOM nodes should be
4002
4023
  // exactly the same, and we can simply do a clone here.
@@ -4007,10 +4028,10 @@ function baseCreateRenderer(options, createHydrationFns) {
4007
4028
  el = vnode.el = hostCreateElement(vnode.type, isSVG, props && props.is, props);
4008
4029
  // mount children first, since some props may rely on child content
4009
4030
  // being already rendered, e.g. `<select value>`
4010
- if (shapeFlag & 8 /* TEXT_CHILDREN */) {
4031
+ if (shapeFlag & 8 /* ShapeFlags.TEXT_CHILDREN */) {
4011
4032
  hostSetElementText(el, vnode.children);
4012
4033
  }
4013
- else if (shapeFlag & 16 /* ARRAY_CHILDREN */) {
4034
+ else if (shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
4014
4035
  mountChildren(vnode.children, el, null, parentComponent, parentSuspense, isSVG && type !== 'foreignObject', slotScopeIds, optimized);
4015
4036
  }
4016
4037
  if (dirs) {
@@ -4094,7 +4115,7 @@ function baseCreateRenderer(options, createHydrationFns) {
4094
4115
  let { patchFlag, dynamicChildren, dirs } = n2;
4095
4116
  // #1426 take the old vnode's patch flag into account since user may clone a
4096
4117
  // compiler-generated vnode, which de-opts to FULL_PROPS
4097
- patchFlag |= n1.patchFlag & 16 /* FULL_PROPS */;
4118
+ patchFlag |= n1.patchFlag & 16 /* PatchFlags.FULL_PROPS */;
4098
4119
  const oldProps = n1.props || shared.EMPTY_OBJ;
4099
4120
  const newProps = n2.props || shared.EMPTY_OBJ;
4100
4121
  let vnodeHook;
@@ -4120,21 +4141,21 @@ function baseCreateRenderer(options, createHydrationFns) {
4120
4141
  // generated by the compiler and can take the fast path.
4121
4142
  // in this path old node and new node are guaranteed to have the same shape
4122
4143
  // (i.e. at the exact same position in the source template)
4123
- if (patchFlag & 16 /* FULL_PROPS */) {
4144
+ if (patchFlag & 16 /* PatchFlags.FULL_PROPS */) {
4124
4145
  // element props contain dynamic keys, full diff needed
4125
4146
  patchProps(el, n2, oldProps, newProps, parentComponent, parentSuspense, isSVG);
4126
4147
  }
4127
4148
  else {
4128
4149
  // class
4129
4150
  // this flag is matched when the element has dynamic class bindings.
4130
- if (patchFlag & 2 /* CLASS */) {
4151
+ if (patchFlag & 2 /* PatchFlags.CLASS */) {
4131
4152
  if (oldProps.class !== newProps.class) {
4132
4153
  hostPatchProp(el, 'class', null, newProps.class, isSVG);
4133
4154
  }
4134
4155
  }
4135
4156
  // style
4136
4157
  // this flag is matched when the element has dynamic style bindings
4137
- if (patchFlag & 4 /* STYLE */) {
4158
+ if (patchFlag & 4 /* PatchFlags.STYLE */) {
4138
4159
  hostPatchProp(el, 'style', oldProps.style, newProps.style, isSVG);
4139
4160
  }
4140
4161
  // props
@@ -4143,7 +4164,7 @@ function baseCreateRenderer(options, createHydrationFns) {
4143
4164
  // faster iteration.
4144
4165
  // Note dynamic keys like :[foo]="bar" will cause this optimization to
4145
4166
  // bail out and go through a full diff because we need to unset the old key
4146
- if (patchFlag & 8 /* PROPS */) {
4167
+ if (patchFlag & 8 /* PatchFlags.PROPS */) {
4147
4168
  // if the flag is present then dynamicProps must be non-null
4148
4169
  const propsToUpdate = n2.dynamicProps;
4149
4170
  for (let i = 0; i < propsToUpdate.length; i++) {
@@ -4159,7 +4180,7 @@ function baseCreateRenderer(options, createHydrationFns) {
4159
4180
  }
4160
4181
  // text
4161
4182
  // This flag is matched when the element has only dynamic text children.
4162
- if (patchFlag & 1 /* TEXT */) {
4183
+ if (patchFlag & 1 /* PatchFlags.TEXT */) {
4163
4184
  if (n1.children !== n2.children) {
4164
4185
  hostSetElementText(el, n2.children);
4165
4186
  }
@@ -4193,7 +4214,7 @@ function baseCreateRenderer(options, createHydrationFns) {
4193
4214
  // which also requires the correct parent container
4194
4215
  !isSameVNodeType(oldVNode, newVNode) ||
4195
4216
  // - In the case of a component, it could contain anything.
4196
- oldVNode.shapeFlag & (6 /* COMPONENT */ | 64 /* TELEPORT */))
4217
+ oldVNode.shapeFlag & (6 /* ShapeFlags.COMPONENT */ | 64 /* ShapeFlags.TELEPORT */))
4197
4218
  ? hostParentNode(oldVNode.el)
4198
4219
  : // In other cases, the parent container is not actually used so we
4199
4220
  // just pass the block element here to avoid a DOM parentNode call.
@@ -4246,7 +4267,7 @@ function baseCreateRenderer(options, createHydrationFns) {
4246
4267
  }
4247
4268
  else {
4248
4269
  if (patchFlag > 0 &&
4249
- patchFlag & 64 /* STABLE_FRAGMENT */ &&
4270
+ patchFlag & 64 /* PatchFlags.STABLE_FRAGMENT */ &&
4250
4271
  dynamicChildren &&
4251
4272
  // #2715 the previous fragment could've been a BAILed one as a result
4252
4273
  // of renderSlot() with no valid children
@@ -4276,7 +4297,7 @@ function baseCreateRenderer(options, createHydrationFns) {
4276
4297
  const processComponent = (n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
4277
4298
  n2.slotScopeIds = slotScopeIds;
4278
4299
  if (n1 == null) {
4279
- if (n2.shapeFlag & 512 /* COMPONENT_KEPT_ALIVE */) {
4300
+ if (n2.shapeFlag & 512 /* ShapeFlags.COMPONENT_KEPT_ALIVE */) {
4280
4301
  parentComponent.ctx.activate(n2, container, anchor, isSVG, optimized);
4281
4302
  }
4282
4303
  else {
@@ -4389,10 +4410,10 @@ function baseCreateRenderer(options, createHydrationFns) {
4389
4410
  // activated hook for keep-alive roots.
4390
4411
  // #1742 activated hook must be accessed after first render
4391
4412
  // since the hook may be injected by a child keep-alive
4392
- if (initialVNode.shapeFlag & 256 /* COMPONENT_SHOULD_KEEP_ALIVE */ ||
4413
+ if (initialVNode.shapeFlag & 256 /* ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE */ ||
4393
4414
  (parent &&
4394
4415
  isAsyncWrapper(parent.vnode) &&
4395
- parent.vnode.shapeFlag & 256 /* COMPONENT_SHOULD_KEEP_ALIVE */)) {
4416
+ parent.vnode.shapeFlag & 256 /* ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE */)) {
4396
4417
  instance.a && queuePostRenderEffect(instance.a, parentSuspense);
4397
4418
  }
4398
4419
  instance.isMounted = true;
@@ -4469,7 +4490,7 @@ function baseCreateRenderer(options, createHydrationFns) {
4469
4490
  reactivity.pauseTracking();
4470
4491
  // props update may have triggered pre-flush watchers.
4471
4492
  // flush them before the render update.
4472
- flushPreFlushCbs(undefined, instance.update);
4493
+ flushPreFlushCbs();
4473
4494
  reactivity.resetTracking();
4474
4495
  };
4475
4496
  const patchChildren = (n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized = false) => {
@@ -4479,22 +4500,22 @@ function baseCreateRenderer(options, createHydrationFns) {
4479
4500
  const { patchFlag, shapeFlag } = n2;
4480
4501
  // fast path
4481
4502
  if (patchFlag > 0) {
4482
- if (patchFlag & 128 /* KEYED_FRAGMENT */) {
4503
+ if (patchFlag & 128 /* PatchFlags.KEYED_FRAGMENT */) {
4483
4504
  // this could be either fully-keyed or mixed (some keyed some not)
4484
4505
  // presence of patchFlag means children are guaranteed to be arrays
4485
4506
  patchKeyedChildren(c1, c2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
4486
4507
  return;
4487
4508
  }
4488
- else if (patchFlag & 256 /* UNKEYED_FRAGMENT */) {
4509
+ else if (patchFlag & 256 /* PatchFlags.UNKEYED_FRAGMENT */) {
4489
4510
  // unkeyed
4490
4511
  patchUnkeyedChildren(c1, c2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
4491
4512
  return;
4492
4513
  }
4493
4514
  }
4494
4515
  // children has 3 possibilities: text, array or no children.
4495
- if (shapeFlag & 8 /* TEXT_CHILDREN */) {
4516
+ if (shapeFlag & 8 /* ShapeFlags.TEXT_CHILDREN */) {
4496
4517
  // text children fast path
4497
- if (prevShapeFlag & 16 /* ARRAY_CHILDREN */) {
4518
+ if (prevShapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
4498
4519
  unmountChildren(c1, parentComponent, parentSuspense);
4499
4520
  }
4500
4521
  if (c2 !== c1) {
@@ -4502,9 +4523,9 @@ function baseCreateRenderer(options, createHydrationFns) {
4502
4523
  }
4503
4524
  }
4504
4525
  else {
4505
- if (prevShapeFlag & 16 /* ARRAY_CHILDREN */) {
4526
+ if (prevShapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
4506
4527
  // prev children was array
4507
- if (shapeFlag & 16 /* ARRAY_CHILDREN */) {
4528
+ if (shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
4508
4529
  // two arrays, cannot assume anything, do full diff
4509
4530
  patchKeyedChildren(c1, c2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
4510
4531
  }
@@ -4516,11 +4537,11 @@ function baseCreateRenderer(options, createHydrationFns) {
4516
4537
  else {
4517
4538
  // prev children was text OR null
4518
4539
  // new children is array OR null
4519
- if (prevShapeFlag & 8 /* TEXT_CHILDREN */) {
4540
+ if (prevShapeFlag & 8 /* ShapeFlags.TEXT_CHILDREN */) {
4520
4541
  hostSetElementText(container, '');
4521
4542
  }
4522
4543
  // mount new if array
4523
- if (shapeFlag & 16 /* ARRAY_CHILDREN */) {
4544
+ if (shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
4524
4545
  mountChildren(c2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
4525
4546
  }
4526
4547
  }
@@ -4708,7 +4729,7 @@ function baseCreateRenderer(options, createHydrationFns) {
4708
4729
  // There is no stable subsequence (e.g. a reverse)
4709
4730
  // OR current node is not among the stable sequence
4710
4731
  if (j < 0 || i !== increasingNewIndexSequence[j]) {
4711
- move(nextChild, container, anchor, 2 /* REORDER */);
4732
+ move(nextChild, container, anchor, 2 /* MoveType.REORDER */);
4712
4733
  }
4713
4734
  else {
4714
4735
  j--;
@@ -4719,15 +4740,15 @@ function baseCreateRenderer(options, createHydrationFns) {
4719
4740
  };
4720
4741
  const move = (vnode, container, anchor, moveType, parentSuspense = null) => {
4721
4742
  const { el, type, transition, children, shapeFlag } = vnode;
4722
- if (shapeFlag & 6 /* COMPONENT */) {
4743
+ if (shapeFlag & 6 /* ShapeFlags.COMPONENT */) {
4723
4744
  move(vnode.component.subTree, container, anchor, moveType);
4724
4745
  return;
4725
4746
  }
4726
- if (shapeFlag & 128 /* SUSPENSE */) {
4747
+ if (shapeFlag & 128 /* ShapeFlags.SUSPENSE */) {
4727
4748
  vnode.suspense.move(container, anchor, moveType);
4728
4749
  return;
4729
4750
  }
4730
- if (shapeFlag & 64 /* TELEPORT */) {
4751
+ if (shapeFlag & 64 /* ShapeFlags.TELEPORT */) {
4731
4752
  type.move(vnode, container, anchor, internals);
4732
4753
  return;
4733
4754
  }
@@ -4744,11 +4765,11 @@ function baseCreateRenderer(options, createHydrationFns) {
4744
4765
  return;
4745
4766
  }
4746
4767
  // single nodes
4747
- const needTransition = moveType !== 2 /* REORDER */ &&
4748
- shapeFlag & 1 /* ELEMENT */ &&
4768
+ const needTransition = moveType !== 2 /* MoveType.REORDER */ &&
4769
+ shapeFlag & 1 /* ShapeFlags.ELEMENT */ &&
4749
4770
  transition;
4750
4771
  if (needTransition) {
4751
- if (moveType === 0 /* ENTER */) {
4772
+ if (moveType === 0 /* MoveType.ENTER */) {
4752
4773
  transition.beforeEnter(el);
4753
4774
  hostInsert(el, container, anchor);
4754
4775
  queuePostRenderEffect(() => transition.enter(el), parentSuspense);
@@ -4780,42 +4801,42 @@ function baseCreateRenderer(options, createHydrationFns) {
4780
4801
  if (ref != null) {
4781
4802
  setRef(ref, null, parentSuspense, vnode, true);
4782
4803
  }
4783
- if (shapeFlag & 256 /* COMPONENT_SHOULD_KEEP_ALIVE */) {
4804
+ if (shapeFlag & 256 /* ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE */) {
4784
4805
  parentComponent.ctx.deactivate(vnode);
4785
4806
  return;
4786
4807
  }
4787
- const shouldInvokeDirs = shapeFlag & 1 /* ELEMENT */ && dirs;
4808
+ const shouldInvokeDirs = shapeFlag & 1 /* ShapeFlags.ELEMENT */ && dirs;
4788
4809
  const shouldInvokeVnodeHook = !isAsyncWrapper(vnode);
4789
4810
  let vnodeHook;
4790
4811
  if (shouldInvokeVnodeHook &&
4791
4812
  (vnodeHook = props && props.onVnodeBeforeUnmount)) {
4792
4813
  invokeVNodeHook(vnodeHook, parentComponent, vnode);
4793
4814
  }
4794
- if (shapeFlag & 6 /* COMPONENT */) {
4815
+ if (shapeFlag & 6 /* ShapeFlags.COMPONENT */) {
4795
4816
  unmountComponent(vnode.component, parentSuspense, doRemove);
4796
4817
  }
4797
4818
  else {
4798
- if (shapeFlag & 128 /* SUSPENSE */) {
4819
+ if (shapeFlag & 128 /* ShapeFlags.SUSPENSE */) {
4799
4820
  vnode.suspense.unmount(parentSuspense, doRemove);
4800
4821
  return;
4801
4822
  }
4802
4823
  if (shouldInvokeDirs) {
4803
4824
  invokeDirectiveHook(vnode, null, parentComponent, 'beforeUnmount');
4804
4825
  }
4805
- if (shapeFlag & 64 /* TELEPORT */) {
4826
+ if (shapeFlag & 64 /* ShapeFlags.TELEPORT */) {
4806
4827
  vnode.type.remove(vnode, parentComponent, parentSuspense, optimized, internals, doRemove);
4807
4828
  }
4808
4829
  else if (dynamicChildren &&
4809
4830
  // #1153: fast path should not be taken for non-stable (v-for) fragments
4810
4831
  (type !== Fragment ||
4811
- (patchFlag > 0 && patchFlag & 64 /* STABLE_FRAGMENT */))) {
4832
+ (patchFlag > 0 && patchFlag & 64 /* PatchFlags.STABLE_FRAGMENT */))) {
4812
4833
  // fast path for block nodes: only need to unmount dynamic children.
4813
4834
  unmountChildren(dynamicChildren, parentComponent, parentSuspense, false, true);
4814
4835
  }
4815
4836
  else if ((type === Fragment &&
4816
4837
  patchFlag &
4817
- (128 /* KEYED_FRAGMENT */ | 256 /* UNKEYED_FRAGMENT */)) ||
4818
- (!optimized && shapeFlag & 16 /* ARRAY_CHILDREN */)) {
4838
+ (128 /* PatchFlags.KEYED_FRAGMENT */ | 256 /* PatchFlags.UNKEYED_FRAGMENT */)) ||
4839
+ (!optimized && shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */)) {
4819
4840
  unmountChildren(children, parentComponent, parentSuspense);
4820
4841
  }
4821
4842
  if (doRemove) {
@@ -4850,7 +4871,7 @@ function baseCreateRenderer(options, createHydrationFns) {
4850
4871
  transition.afterLeave();
4851
4872
  }
4852
4873
  };
4853
- if (vnode.shapeFlag & 1 /* ELEMENT */ &&
4874
+ if (vnode.shapeFlag & 1 /* ShapeFlags.ELEMENT */ &&
4854
4875
  transition &&
4855
4876
  !transition.persisted) {
4856
4877
  const { leave, delayLeave } = transition;
@@ -4920,10 +4941,10 @@ function baseCreateRenderer(options, createHydrationFns) {
4920
4941
  }
4921
4942
  };
4922
4943
  const getNextHostNode = vnode => {
4923
- if (vnode.shapeFlag & 6 /* COMPONENT */) {
4944
+ if (vnode.shapeFlag & 6 /* ShapeFlags.COMPONENT */) {
4924
4945
  return getNextHostNode(vnode.component.subTree);
4925
4946
  }
4926
- if (vnode.shapeFlag & 128 /* SUSPENSE */) {
4947
+ if (vnode.shapeFlag & 128 /* ShapeFlags.SUSPENSE */) {
4927
4948
  return vnode.suspense.next();
4928
4949
  }
4929
4950
  return hostNextSibling((vnode.anchor || vnode.el));
@@ -4937,6 +4958,7 @@ function baseCreateRenderer(options, createHydrationFns) {
4937
4958
  else {
4938
4959
  patch(container._vnode || null, vnode, container, null, null, null, isSVG);
4939
4960
  }
4961
+ flushPreFlushCbs();
4940
4962
  flushPostFlushCbs();
4941
4963
  container._vnode = vnode;
4942
4964
  };
@@ -4986,8 +5008,8 @@ function traverseStaticChildren(n1, n2, shallow = false) {
4986
5008
  // guaranteed to be vnodes
4987
5009
  const c1 = ch1[i];
4988
5010
  let c2 = ch2[i];
4989
- if (c2.shapeFlag & 1 /* ELEMENT */ && !c2.dynamicChildren) {
4990
- if (c2.patchFlag <= 0 || c2.patchFlag === 32 /* HYDRATE_EVENTS */) {
5011
+ if (c2.shapeFlag & 1 /* ShapeFlags.ELEMENT */ && !c2.dynamicChildren) {
5012
+ if (c2.patchFlag <= 0 || c2.patchFlag === 32 /* PatchFlags.HYDRATE_EVENTS */) {
4991
5013
  c2 = ch2[i] = cloneIfMounted(ch2[i]);
4992
5014
  c2.el = c1.el;
4993
5015
  }
@@ -5080,7 +5102,7 @@ const TeleportImpl = {
5080
5102
  const mount = (container, anchor) => {
5081
5103
  // Teleport *always* has Array children. This is enforced in both the
5082
5104
  // compiler and vnode children normalization.
5083
- if (shapeFlag & 16 /* ARRAY_CHILDREN */) {
5105
+ if (shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
5084
5106
  mountChildren(children, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
5085
5107
  }
5086
5108
  };
@@ -5116,7 +5138,7 @@ const TeleportImpl = {
5116
5138
  if (!wasDisabled) {
5117
5139
  // enabled -> disabled
5118
5140
  // move into main container
5119
- moveTeleport(n2, container, mainAnchor, internals, 1 /* TOGGLE */);
5141
+ moveTeleport(n2, container, mainAnchor, internals, 1 /* TeleportMoveTypes.TOGGLE */);
5120
5142
  }
5121
5143
  }
5122
5144
  else {
@@ -5124,13 +5146,13 @@ const TeleportImpl = {
5124
5146
  if ((n2.props && n2.props.to) !== (n1.props && n1.props.to)) {
5125
5147
  const nextTarget = (n2.target = resolveTarget(n2.props, querySelector));
5126
5148
  if (nextTarget) {
5127
- moveTeleport(n2, nextTarget, null, internals, 0 /* TARGET_CHANGE */);
5149
+ moveTeleport(n2, nextTarget, null, internals, 0 /* TeleportMoveTypes.TARGET_CHANGE */);
5128
5150
  }
5129
5151
  }
5130
5152
  else if (wasDisabled) {
5131
5153
  // disabled -> enabled
5132
5154
  // move into teleport target
5133
- moveTeleport(n2, target, targetAnchor, internals, 1 /* TOGGLE */);
5155
+ moveTeleport(n2, target, targetAnchor, internals, 1 /* TeleportMoveTypes.TOGGLE */);
5134
5156
  }
5135
5157
  }
5136
5158
  }
@@ -5143,7 +5165,7 @@ const TeleportImpl = {
5143
5165
  // an unmounted teleport should always remove its children if not disabled
5144
5166
  if (doRemove || !isTeleportDisabled(props)) {
5145
5167
  hostRemove(anchor);
5146
- if (shapeFlag & 16 /* ARRAY_CHILDREN */) {
5168
+ if (shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
5147
5169
  for (let i = 0; i < children.length; i++) {
5148
5170
  const child = children[i];
5149
5171
  unmount(child, parentComponent, parentSuspense, true, !!child.dynamicChildren);
@@ -5154,13 +5176,13 @@ const TeleportImpl = {
5154
5176
  move: moveTeleport,
5155
5177
  hydrate: hydrateTeleport
5156
5178
  };
5157
- function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }, moveType = 2 /* REORDER */) {
5179
+ function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }, moveType = 2 /* TeleportMoveTypes.REORDER */) {
5158
5180
  // move target anchor if this is a target change.
5159
- if (moveType === 0 /* TARGET_CHANGE */) {
5181
+ if (moveType === 0 /* TeleportMoveTypes.TARGET_CHANGE */) {
5160
5182
  insert(vnode.targetAnchor, container, parentAnchor);
5161
5183
  }
5162
5184
  const { el, anchor, shapeFlag, children, props } = vnode;
5163
- const isReorder = moveType === 2 /* REORDER */;
5185
+ const isReorder = moveType === 2 /* TeleportMoveTypes.REORDER */;
5164
5186
  // move main view anchor if this is a re-order.
5165
5187
  if (isReorder) {
5166
5188
  insert(el, container, parentAnchor);
@@ -5170,9 +5192,9 @@ function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }
5170
5192
  // is not a reorder, or the teleport is disabled
5171
5193
  if (!isReorder || isTeleportDisabled(props)) {
5172
5194
  // Teleport has either Array children or no children.
5173
- if (shapeFlag & 16 /* ARRAY_CHILDREN */) {
5195
+ if (shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
5174
5196
  for (let i = 0; i < children.length; i++) {
5175
- move(children[i], container, parentAnchor, 2 /* REORDER */);
5197
+ move(children[i], container, parentAnchor, 2 /* MoveType.REORDER */);
5176
5198
  }
5177
5199
  }
5178
5200
  }
@@ -5187,7 +5209,7 @@ function hydrateTeleport(node, vnode, parentComponent, parentSuspense, slotScope
5187
5209
  // if multiple teleports rendered to the same target element, we need to
5188
5210
  // pick up from where the last teleport finished instead of the first node
5189
5211
  const targetNode = target._lpa || target.firstChild;
5190
- if (vnode.shapeFlag & 16 /* ARRAY_CHILDREN */) {
5212
+ if (vnode.shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
5191
5213
  if (isTeleportDisabled(vnode.props)) {
5192
5214
  vnode.anchor = hydrateChildren(nextSibling(node), vnode, parentNode(node), parentComponent, parentSuspense, slotScopeIds, optimized);
5193
5215
  vnode.targetAnchor = targetNode;
@@ -5328,7 +5350,7 @@ const normalizeRef = ({ ref, ref_key, ref_for }) => {
5328
5350
  : ref
5329
5351
  : null);
5330
5352
  };
5331
- function createBaseVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, shapeFlag = type === Fragment ? 0 : 1 /* ELEMENT */, isBlockNode = false, needFullChildrenNormalization = false) {
5353
+ function createBaseVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, shapeFlag = type === Fragment ? 0 : 1 /* ShapeFlags.ELEMENT */, isBlockNode = false, needFullChildrenNormalization = false) {
5332
5354
  const vnode = {
5333
5355
  __v_isVNode: true,
5334
5356
  __v_skip: true,
@@ -5359,7 +5381,7 @@ function createBaseVNode(type, props = null, children = null, patchFlag = 0, dyn
5359
5381
  if (needFullChildrenNormalization) {
5360
5382
  normalizeChildren(vnode, children);
5361
5383
  // normalize suspense children
5362
- if (shapeFlag & 128 /* SUSPENSE */) {
5384
+ if (shapeFlag & 128 /* ShapeFlags.SUSPENSE */) {
5363
5385
  type.normalize(vnode);
5364
5386
  }
5365
5387
  }
@@ -5367,8 +5389,8 @@ function createBaseVNode(type, props = null, children = null, patchFlag = 0, dyn
5367
5389
  // compiled element vnode - if children is passed, only possible types are
5368
5390
  // string or Array.
5369
5391
  vnode.shapeFlag |= shared.isString(children)
5370
- ? 8 /* TEXT_CHILDREN */
5371
- : 16 /* ARRAY_CHILDREN */;
5392
+ ? 8 /* ShapeFlags.TEXT_CHILDREN */
5393
+ : 16 /* ShapeFlags.ARRAY_CHILDREN */;
5372
5394
  }
5373
5395
  // track vnode for block tree
5374
5396
  if (isBlockTreeEnabled > 0 &&
@@ -5380,10 +5402,10 @@ function createBaseVNode(type, props = null, children = null, patchFlag = 0, dyn
5380
5402
  // component nodes also should always be patched, because even if the
5381
5403
  // component doesn't need to update, it needs to persist the instance on to
5382
5404
  // the next vnode so that it can be properly unmounted later.
5383
- (vnode.patchFlag > 0 || shapeFlag & 6 /* COMPONENT */) &&
5405
+ (vnode.patchFlag > 0 || shapeFlag & 6 /* ShapeFlags.COMPONENT */) &&
5384
5406
  // the EVENTS flag is only for hydration and if it is the only flag, the
5385
5407
  // vnode should not be considered dynamic due to handler caching.
5386
- vnode.patchFlag !== 32 /* HYDRATE_EVENTS */) {
5408
+ vnode.patchFlag !== 32 /* PatchFlags.HYDRATE_EVENTS */) {
5387
5409
  currentBlock.push(vnode);
5388
5410
  }
5389
5411
  return vnode;
@@ -5402,14 +5424,14 @@ function _createVNode(type, props = null, children = null, patchFlag = 0, dynami
5402
5424
  normalizeChildren(cloned, children);
5403
5425
  }
5404
5426
  if (isBlockTreeEnabled > 0 && !isBlockNode && currentBlock) {
5405
- if (cloned.shapeFlag & 6 /* COMPONENT */) {
5427
+ if (cloned.shapeFlag & 6 /* ShapeFlags.COMPONENT */) {
5406
5428
  currentBlock[currentBlock.indexOf(type)] = cloned;
5407
5429
  }
5408
5430
  else {
5409
5431
  currentBlock.push(cloned);
5410
5432
  }
5411
5433
  }
5412
- cloned.patchFlag |= -2 /* BAIL */;
5434
+ cloned.patchFlag |= -2 /* PatchFlags.BAIL */;
5413
5435
  return cloned;
5414
5436
  }
5415
5437
  // class component normalization.
@@ -5435,15 +5457,15 @@ function _createVNode(type, props = null, children = null, patchFlag = 0, dynami
5435
5457
  }
5436
5458
  // encode the vnode type information into a bitmap
5437
5459
  const shapeFlag = shared.isString(type)
5438
- ? 1 /* ELEMENT */
5460
+ ? 1 /* ShapeFlags.ELEMENT */
5439
5461
  : isSuspense(type)
5440
- ? 128 /* SUSPENSE */
5462
+ ? 128 /* ShapeFlags.SUSPENSE */
5441
5463
  : isTeleport(type)
5442
- ? 64 /* TELEPORT */
5464
+ ? 64 /* ShapeFlags.TELEPORT */
5443
5465
  : shared.isObject(type)
5444
- ? 4 /* STATEFUL_COMPONENT */
5466
+ ? 4 /* ShapeFlags.STATEFUL_COMPONENT */
5445
5467
  : shared.isFunction(type)
5446
- ? 2 /* FUNCTIONAL_COMPONENT */
5468
+ ? 2 /* ShapeFlags.FUNCTIONAL_COMPONENT */
5447
5469
  : 0;
5448
5470
  return createBaseVNode(type, props, children, patchFlag, dynamicProps, shapeFlag, isBlockNode, true);
5449
5471
  }
@@ -5488,8 +5510,8 @@ function cloneVNode(vnode, extraProps, mergeRef = false) {
5488
5510
  // fast paths only.
5489
5511
  patchFlag: extraProps && vnode.type !== Fragment
5490
5512
  ? patchFlag === -1 // hoisted node
5491
- ? 16 /* FULL_PROPS */
5492
- : patchFlag | 16 /* FULL_PROPS */
5513
+ ? 16 /* PatchFlags.FULL_PROPS */
5514
+ : patchFlag | 16 /* PatchFlags.FULL_PROPS */
5493
5515
  : patchFlag,
5494
5516
  dynamicProps: vnode.dynamicProps,
5495
5517
  dynamicChildren: vnode.dynamicChildren,
@@ -5568,10 +5590,10 @@ function normalizeChildren(vnode, children) {
5568
5590
  children = null;
5569
5591
  }
5570
5592
  else if (shared.isArray(children)) {
5571
- type = 16 /* ARRAY_CHILDREN */;
5593
+ type = 16 /* ShapeFlags.ARRAY_CHILDREN */;
5572
5594
  }
5573
5595
  else if (typeof children === 'object') {
5574
- if (shapeFlag & (1 /* ELEMENT */ | 64 /* TELEPORT */)) {
5596
+ if (shapeFlag & (1 /* ShapeFlags.ELEMENT */ | 64 /* ShapeFlags.TELEPORT */)) {
5575
5597
  // Normalize slot to plain children for plain element and Teleport
5576
5598
  const slot = children.default;
5577
5599
  if (slot) {
@@ -5583,37 +5605,37 @@ function normalizeChildren(vnode, children) {
5583
5605
  return;
5584
5606
  }
5585
5607
  else {
5586
- type = 32 /* SLOTS_CHILDREN */;
5608
+ type = 32 /* ShapeFlags.SLOTS_CHILDREN */;
5587
5609
  const slotFlag = children._;
5588
5610
  if (!slotFlag && !(InternalObjectKey in children)) {
5589
5611
  children._ctx = currentRenderingInstance;
5590
5612
  }
5591
- else if (slotFlag === 3 /* FORWARDED */ && currentRenderingInstance) {
5613
+ else if (slotFlag === 3 /* SlotFlags.FORWARDED */ && currentRenderingInstance) {
5592
5614
  // a child component receives forwarded slots from the parent.
5593
5615
  // its slot type is determined by its parent's slot type.
5594
- if (currentRenderingInstance.slots._ === 1 /* STABLE */) {
5595
- children._ = 1 /* STABLE */;
5616
+ if (currentRenderingInstance.slots._ === 1 /* SlotFlags.STABLE */) {
5617
+ children._ = 1 /* SlotFlags.STABLE */;
5596
5618
  }
5597
5619
  else {
5598
- children._ = 2 /* DYNAMIC */;
5599
- vnode.patchFlag |= 1024 /* DYNAMIC_SLOTS */;
5620
+ children._ = 2 /* SlotFlags.DYNAMIC */;
5621
+ vnode.patchFlag |= 1024 /* PatchFlags.DYNAMIC_SLOTS */;
5600
5622
  }
5601
5623
  }
5602
5624
  }
5603
5625
  }
5604
5626
  else if (shared.isFunction(children)) {
5605
5627
  children = { default: children, _ctx: currentRenderingInstance };
5606
- type = 32 /* SLOTS_CHILDREN */;
5628
+ type = 32 /* ShapeFlags.SLOTS_CHILDREN */;
5607
5629
  }
5608
5630
  else {
5609
5631
  children = String(children);
5610
5632
  // force teleport children to array so it can be moved around
5611
- if (shapeFlag & 64 /* TELEPORT */) {
5612
- type = 16 /* ARRAY_CHILDREN */;
5633
+ if (shapeFlag & 64 /* ShapeFlags.TELEPORT */) {
5634
+ type = 16 /* ShapeFlags.ARRAY_CHILDREN */;
5613
5635
  children = [createTextVNode(children)];
5614
5636
  }
5615
5637
  else {
5616
- type = 8 /* TEXT_CHILDREN */;
5638
+ type = 8 /* ShapeFlags.TEXT_CHILDREN */;
5617
5639
  }
5618
5640
  }
5619
5641
  vnode.children = children;
@@ -5651,7 +5673,7 @@ function mergeProps(...args) {
5651
5673
  return ret;
5652
5674
  }
5653
5675
  function invokeVNodeHook(hook, instance, vnode, prevVNode = null) {
5654
- callWithAsyncErrorHandling(hook, instance, 7 /* VNODE_HOOK */, [
5676
+ callWithAsyncErrorHandling(hook, instance, 7 /* ErrorCodes.VNODE_HOOK */, [
5655
5677
  vnode,
5656
5678
  prevVNode
5657
5679
  ]);
@@ -5752,7 +5774,7 @@ const unsetCurrentInstance = () => {
5752
5774
  currentInstance = null;
5753
5775
  };
5754
5776
  function isStatefulComponent(instance) {
5755
- return instance.vnode.shapeFlag & 4 /* STATEFUL_COMPONENT */;
5777
+ return instance.vnode.shapeFlag & 4 /* ShapeFlags.STATEFUL_COMPONENT */;
5756
5778
  }
5757
5779
  let isInSSRComponentSetup = false;
5758
5780
  function setupComponent(instance, isSSR = false) {
@@ -5781,7 +5803,7 @@ function setupStatefulComponent(instance, isSSR) {
5781
5803
  setup.length > 1 ? createSetupContext(instance) : null);
5782
5804
  setCurrentInstance(instance);
5783
5805
  reactivity.pauseTracking();
5784
- const setupResult = callWithErrorHandling(setup, instance, 0 /* SETUP_FUNCTION */, [instance.props, setupContext]);
5806
+ const setupResult = callWithErrorHandling(setup, instance, 0 /* ErrorCodes.SETUP_FUNCTION */, [instance.props, setupContext]);
5785
5807
  reactivity.resetTracking();
5786
5808
  unsetCurrentInstance();
5787
5809
  if (shared.isPromise(setupResult)) {
@@ -5793,7 +5815,7 @@ function setupStatefulComponent(instance, isSSR) {
5793
5815
  handleSetupResult(instance, resolvedResult, isSSR);
5794
5816
  })
5795
5817
  .catch(e => {
5796
- handleError(e, instance, 0 /* SETUP_FUNCTION */);
5818
+ handleError(e, instance, 0 /* ErrorCodes.SETUP_FUNCTION */);
5797
5819
  });
5798
5820
  }
5799
5821
  else {
@@ -5883,7 +5905,7 @@ function finishComponentSetup(instance, isSSR, skipOptions) {
5883
5905
  function createAttrsProxy(instance) {
5884
5906
  return new Proxy(instance.attrs, {
5885
5907
  get(target, key) {
5886
- reactivity.track(instance, "get" /* GET */, '$attrs');
5908
+ reactivity.track(instance, "get" /* TrackOpTypes.GET */, '$attrs');
5887
5909
  return target[key];
5888
5910
  }
5889
5911
  });
@@ -5921,10 +5943,10 @@ function getExposeProxy(instance) {
5921
5943
  }
5922
5944
  const classifyRE = /(?:^|[-_])(\w)/g;
5923
5945
  const classify = (str) => str.replace(classifyRE, c => c.toUpperCase()).replace(/[-_]/g, '');
5924
- function getComponentName(Component) {
5946
+ function getComponentName(Component, includeInferred = true) {
5925
5947
  return shared.isFunction(Component)
5926
5948
  ? Component.displayName || Component.name
5927
- : Component.name;
5949
+ : Component.name || (includeInferred && Component.__name);
5928
5950
  }
5929
5951
  /* istanbul ignore next */
5930
5952
  function formatComponentName(instance, Component, isRoot = false) {
@@ -6161,7 +6183,7 @@ function isMemoSame(cached, memo) {
6161
6183
  }
6162
6184
 
6163
6185
  // Core API ------------------------------------------------------------------
6164
- const version = "3.2.35";
6186
+ const version = "3.2.38";
6165
6187
  const _ssrUtils = {
6166
6188
  createComponentInstance,
6167
6189
  setupComponent,
@@ -6171,7 +6193,7 @@ const _ssrUtils = {
6171
6193
  normalizeVNode
6172
6194
  };
6173
6195
  /**
6174
- * SSR utils for \@vue/server-renderer. Only exposed in cjs builds.
6196
+ * SSR utils for \@vue/server-renderer. Only exposed in ssr-possible builds.
6175
6197
  * @internal
6176
6198
  */
6177
6199
  const ssrUtils = (_ssrUtils );