@vue/compat 3.4.30 → 3.4.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/compat v3.4.30
2
+ * @vue/compat v3.4.32
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -306,11 +306,14 @@ function looseIndexOf(arr, val) {
306
306
  return arr.findIndex((item) => looseEqual(item, val));
307
307
  }
308
308
 
309
+ const isRef$1 = (val) => {
310
+ return !!(val && val.__v_isRef === true);
311
+ };
309
312
  const toDisplayString = (val) => {
310
- return isString(val) ? val : val == null ? "" : isArray(val) || isObject(val) && (val.toString === objectToString || !isFunction(val.toString)) ? JSON.stringify(val, replacer, 2) : String(val);
313
+ return isString(val) ? val : val == null ? "" : isArray(val) || isObject(val) && (val.toString === objectToString || !isFunction(val.toString)) ? isRef$1(val) ? toDisplayString(val.value) : JSON.stringify(val, replacer, 2) : String(val);
311
314
  };
312
315
  const replacer = (_key, val) => {
313
- if (val && val.__v_isRef) {
316
+ if (isRef$1(val)) {
314
317
  return replacer(_key, val.value);
315
318
  } else if (isMap(val)) {
316
319
  return {
@@ -447,7 +450,7 @@ class ReactiveEffect {
447
450
  /**
448
451
  * @internal
449
452
  */
450
- this._dirtyLevel = 5;
453
+ this._dirtyLevel = 4;
451
454
  /**
452
455
  * @internal
453
456
  */
@@ -467,20 +470,14 @@ class ReactiveEffect {
467
470
  recordEffectScope(this, scope);
468
471
  }
469
472
  get dirty() {
470
- if (this._dirtyLevel === 2)
471
- return false;
472
- if (this._dirtyLevel === 3 || this._dirtyLevel === 4) {
473
+ if (this._dirtyLevel === 2 || this._dirtyLevel === 3) {
473
474
  this._dirtyLevel = 1;
474
475
  pauseTracking();
475
476
  for (let i = 0; i < this._depsLength; i++) {
476
477
  const dep = this.deps[i];
477
478
  if (dep.computed) {
478
- if (dep.computed.effect._dirtyLevel === 2) {
479
- resetTracking();
480
- return true;
481
- }
482
479
  triggerComputed(dep.computed);
483
- if (this._dirtyLevel >= 5) {
480
+ if (this._dirtyLevel >= 4) {
484
481
  break;
485
482
  }
486
483
  }
@@ -490,10 +487,10 @@ class ReactiveEffect {
490
487
  }
491
488
  resetTracking();
492
489
  }
493
- return this._dirtyLevel >= 5;
490
+ return this._dirtyLevel >= 4;
494
491
  }
495
492
  set dirty(v) {
496
- this._dirtyLevel = v ? 5 : 0;
493
+ this._dirtyLevel = v ? 4 : 0;
497
494
  }
498
495
  run() {
499
496
  this._dirtyLevel = 0;
@@ -610,22 +607,13 @@ function triggerEffects(dep, dirtyLevel, debuggerEventExtraInfo) {
610
607
  pauseScheduling();
611
608
  for (const effect2 of dep.keys()) {
612
609
  let tracking;
613
- if (!dep.computed && effect2.computed) {
614
- if (effect2._runnings > 0 && (tracking != null ? tracking : tracking = dep.get(effect2) === effect2._trackId)) {
615
- effect2._dirtyLevel = 2;
616
- continue;
617
- }
618
- }
619
610
  if (effect2._dirtyLevel < dirtyLevel && (tracking != null ? tracking : tracking = dep.get(effect2) === effect2._trackId)) {
620
611
  effect2._shouldSchedule || (effect2._shouldSchedule = effect2._dirtyLevel === 0);
621
- if (effect2.computed && effect2._dirtyLevel === 2) {
622
- effect2._shouldSchedule = true;
623
- }
624
612
  effect2._dirtyLevel = dirtyLevel;
625
613
  }
626
614
  if (effect2._shouldSchedule && (tracking != null ? tracking : tracking = dep.get(effect2) === effect2._trackId)) {
627
615
  effect2.trigger();
628
- if ((!effect2._runnings || effect2.allowRecurse) && effect2._dirtyLevel !== 3) {
616
+ if ((!effect2._runnings || effect2.allowRecurse) && effect2._dirtyLevel !== 2) {
629
617
  effect2._shouldSchedule = false;
630
618
  if (effect2.scheduler) {
631
619
  queueEffectSchedulers.push(effect2.scheduler);
@@ -711,7 +699,7 @@ function trigger(target, type, key, newValue, oldValue, oldTarget) {
711
699
  if (dep) {
712
700
  triggerEffects(
713
701
  dep,
714
- 5);
702
+ 4);
715
703
  }
716
704
  }
717
705
  resetScheduling();
@@ -886,18 +874,18 @@ const shallowReadonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler(true
886
874
 
887
875
  const toShallow = (value) => value;
888
876
  const getProto = (v) => Reflect.getPrototypeOf(v);
889
- function get(target, key, isReadonly = false, isShallow = false) {
877
+ function get(target, key, isReadonly2 = false, isShallow2 = false) {
890
878
  target = target["__v_raw"];
891
879
  const rawTarget = toRaw(target);
892
880
  const rawKey = toRaw(key);
893
- if (!isReadonly) {
881
+ if (!isReadonly2) {
894
882
  if (hasChanged(key, rawKey)) {
895
883
  track(rawTarget, "get", key);
896
884
  }
897
885
  track(rawTarget, "get", rawKey);
898
886
  }
899
887
  const { has: has2 } = getProto(rawTarget);
900
- const wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive;
888
+ const wrap = isShallow2 ? toShallow : isReadonly2 ? toReadonly : toReactive;
901
889
  if (has2.call(rawTarget, key)) {
902
890
  return wrap(target.get(key));
903
891
  } else if (has2.call(rawTarget, rawKey)) {
@@ -906,11 +894,11 @@ function get(target, key, isReadonly = false, isShallow = false) {
906
894
  target.get(key);
907
895
  }
908
896
  }
909
- function has(key, isReadonly = false) {
897
+ function has(key, isReadonly2 = false) {
910
898
  const target = this["__v_raw"];
911
899
  const rawTarget = toRaw(target);
912
900
  const rawKey = toRaw(key);
913
- if (!isReadonly) {
901
+ if (!isReadonly2) {
914
902
  if (hasChanged(key, rawKey)) {
915
903
  track(rawTarget, "has", key);
916
904
  }
@@ -918,13 +906,15 @@ function has(key, isReadonly = false) {
918
906
  }
919
907
  return key === rawKey ? target.has(key) : target.has(key) || target.has(rawKey);
920
908
  }
921
- function size(target, isReadonly = false) {
909
+ function size(target, isReadonly2 = false) {
922
910
  target = target["__v_raw"];
923
- !isReadonly && track(toRaw(target), "iterate", ITERATE_KEY);
911
+ !isReadonly2 && track(toRaw(target), "iterate", ITERATE_KEY);
924
912
  return Reflect.get(target, "size", target);
925
913
  }
926
- function add(value) {
927
- value = toRaw(value);
914
+ function add(value, _isShallow = false) {
915
+ if (!_isShallow && !isShallow(value) && !isReadonly(value)) {
916
+ value = toRaw(value);
917
+ }
928
918
  const target = toRaw(this);
929
919
  const proto = getProto(target);
930
920
  const hadKey = proto.has.call(target, value);
@@ -934,8 +924,10 @@ function add(value) {
934
924
  }
935
925
  return this;
936
926
  }
937
- function set(key, value) {
938
- value = toRaw(value);
927
+ function set(key, value, _isShallow = false) {
928
+ if (!_isShallow && !isShallow(value) && !isReadonly(value)) {
929
+ value = toRaw(value);
930
+ }
939
931
  const target = toRaw(this);
940
932
  const { has: has2, get: get2 } = getProto(target);
941
933
  let hadKey = has2.call(target, key);
@@ -976,19 +968,19 @@ function clear() {
976
968
  }
977
969
  return result;
978
970
  }
979
- function createForEach(isReadonly, isShallow) {
971
+ function createForEach(isReadonly2, isShallow2) {
980
972
  return function forEach(callback, thisArg) {
981
973
  const observed = this;
982
974
  const target = observed["__v_raw"];
983
975
  const rawTarget = toRaw(target);
984
- const wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive;
985
- !isReadonly && track(rawTarget, "iterate", ITERATE_KEY);
976
+ const wrap = isShallow2 ? toShallow : isReadonly2 ? toReadonly : toReactive;
977
+ !isReadonly2 && track(rawTarget, "iterate", ITERATE_KEY);
986
978
  return target.forEach((value, key) => {
987
979
  return callback.call(thisArg, wrap(value), wrap(key), observed);
988
980
  });
989
981
  };
990
982
  }
991
- function createIterableMethod(method, isReadonly, isShallow) {
983
+ function createIterableMethod(method, isReadonly2, isShallow2) {
992
984
  return function(...args) {
993
985
  const target = this["__v_raw"];
994
986
  const rawTarget = toRaw(target);
@@ -996,8 +988,8 @@ function createIterableMethod(method, isReadonly, isShallow) {
996
988
  const isPair = method === "entries" || method === Symbol.iterator && targetIsMap;
997
989
  const isKeyOnly = method === "keys" && targetIsMap;
998
990
  const innerIterator = target[method](...args);
999
- const wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive;
1000
- !isReadonly && track(
991
+ const wrap = isShallow2 ? toShallow : isReadonly2 ? toReadonly : toReactive;
992
+ !isReadonly2 && track(
1001
993
  rawTarget,
1002
994
  "iterate",
1003
995
  isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY
@@ -1046,8 +1038,12 @@ function createInstrumentations() {
1046
1038
  return size(this);
1047
1039
  },
1048
1040
  has,
1049
- add,
1050
- set,
1041
+ add(value) {
1042
+ return add.call(this, value, true);
1043
+ },
1044
+ set(key, value) {
1045
+ return set.call(this, key, value, true);
1046
+ },
1051
1047
  delete: deleteEntry,
1052
1048
  clear,
1053
1049
  forEach: createForEach(false, true)
@@ -1113,13 +1109,13 @@ const [
1113
1109
  shallowInstrumentations,
1114
1110
  shallowReadonlyInstrumentations
1115
1111
  ] = /* @__PURE__ */ createInstrumentations();
1116
- function createInstrumentationGetter(isReadonly, shallow) {
1117
- const instrumentations = shallow ? isReadonly ? shallowReadonlyInstrumentations : shallowInstrumentations : isReadonly ? readonlyInstrumentations : mutableInstrumentations;
1112
+ function createInstrumentationGetter(isReadonly2, shallow) {
1113
+ const instrumentations = shallow ? isReadonly2 ? shallowReadonlyInstrumentations : shallowInstrumentations : isReadonly2 ? readonlyInstrumentations : mutableInstrumentations;
1118
1114
  return (target, key, receiver) => {
1119
1115
  if (key === "__v_isReactive") {
1120
- return !isReadonly;
1116
+ return !isReadonly2;
1121
1117
  } else if (key === "__v_isReadonly") {
1122
- return isReadonly;
1118
+ return isReadonly2;
1123
1119
  } else if (key === "__v_raw") {
1124
1120
  return target;
1125
1121
  }
@@ -1264,7 +1260,7 @@ class ComputedRefImpl {
1264
1260
  () => getter(this._value),
1265
1261
  () => triggerRefValue(
1266
1262
  this,
1267
- this.effect._dirtyLevel === 3 ? 3 : 4
1263
+ this.effect._dirtyLevel === 2 ? 2 : 3
1268
1264
  )
1269
1265
  );
1270
1266
  this.effect.computed = this;
@@ -1273,15 +1269,12 @@ class ComputedRefImpl {
1273
1269
  }
1274
1270
  get value() {
1275
1271
  const self = toRaw(this);
1276
- const lastDirtyLevel = self.effect._dirtyLevel;
1277
1272
  if ((!self._cacheable || self.effect.dirty) && hasChanged(self._value, self._value = self.effect.run())) {
1278
- if (lastDirtyLevel !== 3) {
1279
- triggerRefValue(self, 5);
1280
- }
1273
+ triggerRefValue(self, 4);
1281
1274
  }
1282
1275
  trackRefValue(self);
1283
1276
  if (self.effect._dirtyLevel >= 2) {
1284
- triggerRefValue(self, 3);
1277
+ triggerRefValue(self, 2);
1285
1278
  }
1286
1279
  return self._value;
1287
1280
  }
@@ -1324,7 +1317,7 @@ function trackRefValue(ref2) {
1324
1317
  ));
1325
1318
  }
1326
1319
  }
1327
- function triggerRefValue(ref2, dirtyLevel = 5, newVal, oldVal) {
1320
+ function triggerRefValue(ref2, dirtyLevel = 4, newVal, oldVal) {
1328
1321
  ref2 = toRaw(ref2);
1329
1322
  const dep = ref2.dep;
1330
1323
  if (dep) {
@@ -1367,12 +1360,12 @@ class RefImpl {
1367
1360
  this._rawValue;
1368
1361
  this._rawValue = newVal;
1369
1362
  this._value = useDirectValue ? newVal : toReactive(newVal);
1370
- triggerRefValue(this, 5);
1363
+ triggerRefValue(this, 4);
1371
1364
  }
1372
1365
  }
1373
1366
  }
1374
1367
  function triggerRef(ref2) {
1375
- triggerRefValue(ref2, 5);
1368
+ triggerRefValue(ref2, 4);
1376
1369
  }
1377
1370
  function unref(ref2) {
1378
1371
  return isRef(ref2) ? ref2.value : ref2;
@@ -1513,7 +1506,9 @@ const ErrorCodes = {
1513
1506
  "ASYNC_COMPONENT_LOADER": 13,
1514
1507
  "13": "ASYNC_COMPONENT_LOADER",
1515
1508
  "SCHEDULER": 14,
1516
- "14": "SCHEDULER"
1509
+ "14": "SCHEDULER",
1510
+ "COMPONENT_UPDATE": 15,
1511
+ "15": "COMPONENT_UPDATE"
1517
1512
  };
1518
1513
  const ErrorTypeStrings$1 = {
1519
1514
  ["sp"]: "serverPrefetch hook",
@@ -1544,7 +1539,8 @@ const ErrorTypeStrings$1 = {
1544
1539
  [11]: "app warnHandler",
1545
1540
  [12]: "ref function",
1546
1541
  [13]: "async component loader",
1547
- [14]: "scheduler flush. This is likely a Vue internals bug. Please open an issue at https://github.com/vuejs/core ."
1542
+ [14]: "scheduler flush",
1543
+ [15]: "component update"
1548
1544
  };
1549
1545
  function callWithErrorHandling(fn, instance, type, args) {
1550
1546
  try {
@@ -1725,7 +1721,11 @@ function flushJobs(seen) {
1725
1721
  const job = queue[flushIndex];
1726
1722
  if (job && job.active !== false) {
1727
1723
  if (false) ;
1728
- callWithErrorHandling(job, null, 14);
1724
+ callWithErrorHandling(
1725
+ job,
1726
+ job.i,
1727
+ job.i ? 15 : 14
1728
+ );
1729
1729
  }
1730
1730
  }
1731
1731
  } finally {
@@ -1951,110 +1951,6 @@ function compatModelEmit(instance, event, args) {
1951
1951
  }
1952
1952
  }
1953
1953
 
1954
- function emit(instance, event, ...rawArgs) {
1955
- if (instance.isUnmounted) return;
1956
- const props = instance.vnode.props || EMPTY_OBJ;
1957
- let args = rawArgs;
1958
- const isModelListener = event.startsWith("update:");
1959
- const modelArg = isModelListener && event.slice(7);
1960
- if (modelArg && modelArg in props) {
1961
- const modifiersKey = `${modelArg === "modelValue" ? "model" : modelArg}Modifiers`;
1962
- const { number, trim } = props[modifiersKey] || EMPTY_OBJ;
1963
- if (trim) {
1964
- args = rawArgs.map((a) => isString(a) ? a.trim() : a);
1965
- }
1966
- if (number) {
1967
- args = rawArgs.map(looseToNumber);
1968
- }
1969
- }
1970
- let handlerName;
1971
- let handler = props[handlerName = toHandlerKey(event)] || // also try camelCase event handler (#2249)
1972
- props[handlerName = toHandlerKey(camelize(event))];
1973
- if (!handler && isModelListener) {
1974
- handler = props[handlerName = toHandlerKey(hyphenate(event))];
1975
- }
1976
- if (handler) {
1977
- callWithAsyncErrorHandling(
1978
- handler,
1979
- instance,
1980
- 6,
1981
- args
1982
- );
1983
- }
1984
- const onceHandler = props[handlerName + `Once`];
1985
- if (onceHandler) {
1986
- if (!instance.emitted) {
1987
- instance.emitted = {};
1988
- } else if (instance.emitted[handlerName]) {
1989
- return;
1990
- }
1991
- instance.emitted[handlerName] = true;
1992
- callWithAsyncErrorHandling(
1993
- onceHandler,
1994
- instance,
1995
- 6,
1996
- args
1997
- );
1998
- }
1999
- {
2000
- compatModelEmit(instance, event, args);
2001
- return emit$1(instance, event, args);
2002
- }
2003
- }
2004
- function normalizeEmitsOptions(comp, appContext, asMixin = false) {
2005
- const cache = appContext.emitsCache;
2006
- const cached = cache.get(comp);
2007
- if (cached !== void 0) {
2008
- return cached;
2009
- }
2010
- const raw = comp.emits;
2011
- let normalized = {};
2012
- let hasExtends = false;
2013
- if (!isFunction(comp)) {
2014
- const extendEmits = (raw2) => {
2015
- const normalizedFromExtend = normalizeEmitsOptions(raw2, appContext, true);
2016
- if (normalizedFromExtend) {
2017
- hasExtends = true;
2018
- extend(normalized, normalizedFromExtend);
2019
- }
2020
- };
2021
- if (!asMixin && appContext.mixins.length) {
2022
- appContext.mixins.forEach(extendEmits);
2023
- }
2024
- if (comp.extends) {
2025
- extendEmits(comp.extends);
2026
- }
2027
- if (comp.mixins) {
2028
- comp.mixins.forEach(extendEmits);
2029
- }
2030
- }
2031
- if (!raw && !hasExtends) {
2032
- if (isObject(comp)) {
2033
- cache.set(comp, null);
2034
- }
2035
- return null;
2036
- }
2037
- if (isArray(raw)) {
2038
- raw.forEach((key) => normalized[key] = null);
2039
- } else {
2040
- extend(normalized, raw);
2041
- }
2042
- if (isObject(comp)) {
2043
- cache.set(comp, normalized);
2044
- }
2045
- return normalized;
2046
- }
2047
- function isEmitListener(options, key) {
2048
- if (!options || !isOn(key)) {
2049
- return false;
2050
- }
2051
- if (key.startsWith(compatModelEventPrefix)) {
2052
- return true;
2053
- }
2054
- key = key.slice(2).replace(/Once$/, "");
2055
- return hasOwn(options, key[0].toLowerCase() + key.slice(1)) || hasOwn(options, hyphenate(key)) || hasOwn(options, key);
2056
- }
2057
-
2058
1954
  let currentRenderingInstance = null;
2059
1955
  let currentScopeId = null;
2060
1956
  function setCurrentRenderingInstance(instance) {
@@ -2103,975 +1999,858 @@ function withCtx(fn, ctx = currentRenderingInstance, isNonScopedSlot) {
2103
1999
  return renderFnWithContext;
2104
2000
  }
2105
2001
 
2106
- function markAttrsAccessed() {
2107
- }
2108
- function renderComponentRoot(instance) {
2109
- const {
2110
- type: Component,
2111
- vnode,
2112
- proxy,
2113
- withProxy,
2114
- propsOptions: [propsOptions],
2115
- slots,
2116
- attrs,
2117
- emit,
2118
- render,
2119
- renderCache,
2120
- props,
2121
- data,
2122
- setupState,
2123
- ctx,
2124
- inheritAttrs
2125
- } = instance;
2126
- const prev = setCurrentRenderingInstance(instance);
2127
- let result;
2128
- let fallthroughAttrs;
2129
- try {
2130
- if (vnode.shapeFlag & 4) {
2131
- const proxyToUse = withProxy || proxy;
2132
- const thisProxy = false ? new Proxy(proxyToUse, {
2133
- get(target, key, receiver) {
2134
- warn(
2135
- `Property '${String(
2136
- key
2137
- )}' was accessed via 'this'. Avoid using 'this' in templates.`
2002
+ const legacyDirectiveHookMap = {
2003
+ beforeMount: "bind",
2004
+ mounted: "inserted",
2005
+ updated: ["update", "componentUpdated"],
2006
+ unmounted: "unbind"
2007
+ };
2008
+ function mapCompatDirectiveHook(name, dir, instance) {
2009
+ const mappedName = legacyDirectiveHookMap[name];
2010
+ if (mappedName) {
2011
+ if (isArray(mappedName)) {
2012
+ const hook = [];
2013
+ mappedName.forEach((mapped) => {
2014
+ const mappedHook = dir[mapped];
2015
+ if (mappedHook) {
2016
+ softAssertCompatEnabled(
2017
+ "CUSTOM_DIR",
2018
+ instance,
2019
+ mapped,
2020
+ name
2138
2021
  );
2139
- return Reflect.get(target, key, receiver);
2022
+ hook.push(mappedHook);
2140
2023
  }
2141
- }) : proxyToUse;
2142
- result = normalizeVNode(
2143
- render.call(
2144
- thisProxy,
2145
- proxyToUse,
2146
- renderCache,
2147
- false ? shallowReadonly(props) : props,
2148
- setupState,
2149
- data,
2150
- ctx
2151
- )
2152
- );
2153
- fallthroughAttrs = attrs;
2024
+ });
2025
+ return hook.length ? hook : void 0;
2154
2026
  } else {
2155
- const render2 = Component;
2156
- if (false) ;
2157
- result = normalizeVNode(
2158
- render2.length > 1 ? render2(
2159
- false ? shallowReadonly(props) : props,
2160
- false ? {
2161
- get attrs() {
2162
- markAttrsAccessed();
2163
- return shallowReadonly(attrs);
2164
- },
2165
- slots,
2166
- emit
2167
- } : { attrs, slots, emit }
2168
- ) : render2(
2169
- false ? shallowReadonly(props) : props,
2170
- null
2171
- )
2172
- );
2173
- fallthroughAttrs = Component.props ? attrs : getFunctionalFallthrough(attrs);
2027
+ if (dir[mappedName]) {
2028
+ softAssertCompatEnabled(
2029
+ "CUSTOM_DIR",
2030
+ instance,
2031
+ mappedName,
2032
+ name
2033
+ );
2034
+ }
2035
+ return dir[mappedName];
2174
2036
  }
2175
- } catch (err) {
2176
- blockStack.length = 0;
2177
- handleError(err, instance, 1);
2178
- result = createVNode(Comment);
2179
2037
  }
2180
- let root = result;
2181
- if (fallthroughAttrs && inheritAttrs !== false) {
2182
- const keys = Object.keys(fallthroughAttrs);
2183
- const { shapeFlag } = root;
2184
- if (keys.length) {
2185
- if (shapeFlag & (1 | 6)) {
2186
- if (propsOptions && keys.some(isModelListener)) {
2187
- fallthroughAttrs = filterModelListeners(
2188
- fallthroughAttrs,
2189
- propsOptions
2190
- );
2191
- }
2192
- root = cloneVNode(root, fallthroughAttrs, false, true);
2038
+ }
2039
+
2040
+ function withDirectives(vnode, directives) {
2041
+ if (currentRenderingInstance === null) {
2042
+ return vnode;
2043
+ }
2044
+ const instance = getComponentPublicInstance(currentRenderingInstance);
2045
+ const bindings = vnode.dirs || (vnode.dirs = []);
2046
+ for (let i = 0; i < directives.length; i++) {
2047
+ let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i];
2048
+ if (dir) {
2049
+ if (isFunction(dir)) {
2050
+ dir = {
2051
+ mounted: dir,
2052
+ updated: dir
2053
+ };
2054
+ }
2055
+ if (dir.deep) {
2056
+ traverse(value);
2193
2057
  }
2058
+ bindings.push({
2059
+ dir,
2060
+ instance,
2061
+ value,
2062
+ oldValue: void 0,
2063
+ arg,
2064
+ modifiers
2065
+ });
2194
2066
  }
2195
2067
  }
2196
- if (isCompatEnabled$1("INSTANCE_ATTRS_CLASS_STYLE", instance) && vnode.shapeFlag & 4 && root.shapeFlag & (1 | 6)) {
2197
- const { class: cls, style } = vnode.props || {};
2198
- if (cls || style) {
2199
- root = cloneVNode(
2200
- root,
2201
- {
2202
- class: cls,
2203
- style
2204
- },
2205
- false,
2206
- true
2207
- );
2208
- }
2209
- }
2210
- if (vnode.dirs) {
2211
- root = cloneVNode(root, null, false, true);
2212
- root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
2213
- }
2214
- if (vnode.transition) {
2215
- root.transition = vnode.transition;
2216
- }
2217
- {
2218
- result = root;
2219
- }
2220
- setCurrentRenderingInstance(prev);
2221
- return result;
2068
+ return vnode;
2222
2069
  }
2223
- function filterSingleRoot(children, recurse = true) {
2224
- let singleRoot;
2225
- for (let i = 0; i < children.length; i++) {
2226
- const child = children[i];
2227
- if (isVNode(child)) {
2228
- if (child.type !== Comment || child.children === "v-if") {
2229
- if (singleRoot) {
2230
- return;
2231
- } else {
2232
- singleRoot = child;
2233
- }
2234
- }
2235
- } else {
2236
- return;
2070
+ function invokeDirectiveHook(vnode, prevVNode, instance, name) {
2071
+ const bindings = vnode.dirs;
2072
+ const oldBindings = prevVNode && prevVNode.dirs;
2073
+ for (let i = 0; i < bindings.length; i++) {
2074
+ const binding = bindings[i];
2075
+ if (oldBindings) {
2076
+ binding.oldValue = oldBindings[i].value;
2237
2077
  }
2238
- }
2239
- return singleRoot;
2240
- }
2241
- const getFunctionalFallthrough = (attrs) => {
2242
- let res;
2243
- for (const key in attrs) {
2244
- if (key === "class" || key === "style" || isOn(key)) {
2245
- (res || (res = {}))[key] = attrs[key];
2078
+ let hook = binding.dir[name];
2079
+ if (!hook) {
2080
+ hook = mapCompatDirectiveHook(name, binding.dir, instance);
2246
2081
  }
2247
- }
2248
- return res;
2249
- };
2250
- const filterModelListeners = (attrs, props) => {
2251
- const res = {};
2252
- for (const key in attrs) {
2253
- if (!isModelListener(key) || !(key.slice(9) in props)) {
2254
- res[key] = attrs[key];
2082
+ if (hook) {
2083
+ pauseTracking();
2084
+ callWithAsyncErrorHandling(hook, instance, 8, [
2085
+ vnode.el,
2086
+ binding,
2087
+ vnode,
2088
+ prevVNode
2089
+ ]);
2090
+ resetTracking();
2255
2091
  }
2256
2092
  }
2257
- return res;
2093
+ }
2094
+
2095
+ const leaveCbKey = Symbol("_leaveCb");
2096
+ const enterCbKey$1 = Symbol("_enterCb");
2097
+ function useTransitionState() {
2098
+ const state = {
2099
+ isMounted: false,
2100
+ isLeaving: false,
2101
+ isUnmounting: false,
2102
+ leavingVNodes: /* @__PURE__ */ new Map()
2103
+ };
2104
+ onMounted(() => {
2105
+ state.isMounted = true;
2106
+ });
2107
+ onBeforeUnmount(() => {
2108
+ state.isUnmounting = true;
2109
+ });
2110
+ return state;
2111
+ }
2112
+ const TransitionHookValidator = [Function, Array];
2113
+ const BaseTransitionPropsValidators = {
2114
+ mode: String,
2115
+ appear: Boolean,
2116
+ persisted: Boolean,
2117
+ // enter
2118
+ onBeforeEnter: TransitionHookValidator,
2119
+ onEnter: TransitionHookValidator,
2120
+ onAfterEnter: TransitionHookValidator,
2121
+ onEnterCancelled: TransitionHookValidator,
2122
+ // leave
2123
+ onBeforeLeave: TransitionHookValidator,
2124
+ onLeave: TransitionHookValidator,
2125
+ onAfterLeave: TransitionHookValidator,
2126
+ onLeaveCancelled: TransitionHookValidator,
2127
+ // appear
2128
+ onBeforeAppear: TransitionHookValidator,
2129
+ onAppear: TransitionHookValidator,
2130
+ onAfterAppear: TransitionHookValidator,
2131
+ onAppearCancelled: TransitionHookValidator
2258
2132
  };
2259
- function shouldUpdateComponent(prevVNode, nextVNode, optimized) {
2260
- const { props: prevProps, children: prevChildren, component } = prevVNode;
2261
- const { props: nextProps, children: nextChildren, patchFlag } = nextVNode;
2262
- const emits = component.emitsOptions;
2263
- if (nextVNode.dirs || nextVNode.transition) {
2264
- return true;
2265
- }
2266
- if (optimized && patchFlag >= 0) {
2267
- if (patchFlag & 1024) {
2268
- return true;
2269
- }
2270
- if (patchFlag & 16) {
2271
- if (!prevProps) {
2272
- return !!nextProps;
2133
+ const recursiveGetSubtree = (instance) => {
2134
+ const subTree = instance.subTree;
2135
+ return subTree.component ? recursiveGetSubtree(subTree.component) : subTree;
2136
+ };
2137
+ const BaseTransitionImpl = {
2138
+ name: `BaseTransition`,
2139
+ props: BaseTransitionPropsValidators,
2140
+ setup(props, { slots }) {
2141
+ const instance = getCurrentInstance();
2142
+ const state = useTransitionState();
2143
+ return () => {
2144
+ const children = slots.default && getTransitionRawChildren(slots.default(), true);
2145
+ if (!children || !children.length) {
2146
+ return;
2273
2147
  }
2274
- return hasPropsChanged(prevProps, nextProps, emits);
2275
- } else if (patchFlag & 8) {
2276
- const dynamicProps = nextVNode.dynamicProps;
2277
- for (let i = 0; i < dynamicProps.length; i++) {
2278
- const key = dynamicProps[i];
2279
- if (nextProps[key] !== prevProps[key] && !isEmitListener(emits, key)) {
2280
- return true;
2148
+ let child = children[0];
2149
+ if (children.length > 1) {
2150
+ for (const c of children) {
2151
+ if (c.type !== Comment) {
2152
+ child = c;
2153
+ break;
2154
+ }
2281
2155
  }
2282
2156
  }
2283
- }
2284
- } else {
2285
- if (prevChildren || nextChildren) {
2286
- if (!nextChildren || !nextChildren.$stable) {
2287
- return true;
2157
+ const rawProps = toRaw(props);
2158
+ const { mode } = rawProps;
2159
+ if (state.isLeaving) {
2160
+ return emptyPlaceholder(child);
2288
2161
  }
2289
- }
2290
- if (prevProps === nextProps) {
2291
- return false;
2292
- }
2293
- if (!prevProps) {
2294
- return !!nextProps;
2295
- }
2296
- if (!nextProps) {
2297
- return true;
2298
- }
2299
- return hasPropsChanged(prevProps, nextProps, emits);
2162
+ const innerChild = getKeepAliveChild(child);
2163
+ if (!innerChild) {
2164
+ return emptyPlaceholder(child);
2165
+ }
2166
+ let enterHooks = resolveTransitionHooks(
2167
+ innerChild,
2168
+ rawProps,
2169
+ state,
2170
+ instance,
2171
+ // #11061, ensure enterHooks is fresh after clone
2172
+ (hooks) => enterHooks = hooks
2173
+ );
2174
+ setTransitionHooks(innerChild, enterHooks);
2175
+ const oldChild = instance.subTree;
2176
+ const oldInnerChild = oldChild && getKeepAliveChild(oldChild);
2177
+ if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(innerChild, oldInnerChild) && recursiveGetSubtree(instance).type !== Comment) {
2178
+ const leavingHooks = resolveTransitionHooks(
2179
+ oldInnerChild,
2180
+ rawProps,
2181
+ state,
2182
+ instance
2183
+ );
2184
+ setTransitionHooks(oldInnerChild, leavingHooks);
2185
+ if (mode === "out-in" && innerChild.type !== Comment) {
2186
+ state.isLeaving = true;
2187
+ leavingHooks.afterLeave = () => {
2188
+ state.isLeaving = false;
2189
+ if (instance.update.active !== false) {
2190
+ instance.effect.dirty = true;
2191
+ instance.update();
2192
+ }
2193
+ };
2194
+ return emptyPlaceholder(child);
2195
+ } else if (mode === "in-out" && innerChild.type !== Comment) {
2196
+ leavingHooks.delayLeave = (el, earlyRemove, delayedLeave) => {
2197
+ const leavingVNodesCache = getLeavingNodesForType(
2198
+ state,
2199
+ oldInnerChild
2200
+ );
2201
+ leavingVNodesCache[String(oldInnerChild.key)] = oldInnerChild;
2202
+ el[leaveCbKey] = () => {
2203
+ earlyRemove();
2204
+ el[leaveCbKey] = void 0;
2205
+ delete enterHooks.delayedLeave;
2206
+ };
2207
+ enterHooks.delayedLeave = delayedLeave;
2208
+ };
2209
+ }
2210
+ }
2211
+ return child;
2212
+ };
2300
2213
  }
2301
- return false;
2214
+ };
2215
+ {
2216
+ BaseTransitionImpl.__isBuiltIn = true;
2302
2217
  }
2303
- function hasPropsChanged(prevProps, nextProps, emitsOptions) {
2304
- const nextKeys = Object.keys(nextProps);
2305
- if (nextKeys.length !== Object.keys(prevProps).length) {
2306
- return true;
2307
- }
2308
- for (let i = 0; i < nextKeys.length; i++) {
2309
- const key = nextKeys[i];
2310
- if (nextProps[key] !== prevProps[key] && !isEmitListener(emitsOptions, key)) {
2311
- return true;
2312
- }
2218
+ const BaseTransition = BaseTransitionImpl;
2219
+ function getLeavingNodesForType(state, vnode) {
2220
+ const { leavingVNodes } = state;
2221
+ let leavingVNodesCache = leavingVNodes.get(vnode.type);
2222
+ if (!leavingVNodesCache) {
2223
+ leavingVNodesCache = /* @__PURE__ */ Object.create(null);
2224
+ leavingVNodes.set(vnode.type, leavingVNodesCache);
2313
2225
  }
2314
- return false;
2226
+ return leavingVNodesCache;
2315
2227
  }
2316
- function updateHOCHostEl({ vnode, parent }, el) {
2317
- while (parent) {
2318
- const root = parent.subTree;
2319
- if (root.suspense && root.suspense.activeBranch === vnode) {
2320
- root.el = vnode.el;
2228
+ function resolveTransitionHooks(vnode, props, state, instance, postClone) {
2229
+ const {
2230
+ appear,
2231
+ mode,
2232
+ persisted = false,
2233
+ onBeforeEnter,
2234
+ onEnter,
2235
+ onAfterEnter,
2236
+ onEnterCancelled,
2237
+ onBeforeLeave,
2238
+ onLeave,
2239
+ onAfterLeave,
2240
+ onLeaveCancelled,
2241
+ onBeforeAppear,
2242
+ onAppear,
2243
+ onAfterAppear,
2244
+ onAppearCancelled
2245
+ } = props;
2246
+ const key = String(vnode.key);
2247
+ const leavingVNodesCache = getLeavingNodesForType(state, vnode);
2248
+ const callHook = (hook, args) => {
2249
+ hook && callWithAsyncErrorHandling(
2250
+ hook,
2251
+ instance,
2252
+ 9,
2253
+ args
2254
+ );
2255
+ };
2256
+ const callAsyncHook = (hook, args) => {
2257
+ const done = args[1];
2258
+ callHook(hook, args);
2259
+ if (isArray(hook)) {
2260
+ if (hook.every((hook2) => hook2.length <= 1)) done();
2261
+ } else if (hook.length <= 1) {
2262
+ done();
2321
2263
  }
2322
- if (root === vnode) {
2323
- (vnode = parent.vnode).el = el;
2324
- parent = parent.parent;
2325
- } else {
2326
- break;
2264
+ };
2265
+ const hooks = {
2266
+ mode,
2267
+ persisted,
2268
+ beforeEnter(el) {
2269
+ let hook = onBeforeEnter;
2270
+ if (!state.isMounted) {
2271
+ if (appear) {
2272
+ hook = onBeforeAppear || onBeforeEnter;
2273
+ } else {
2274
+ return;
2275
+ }
2276
+ }
2277
+ if (el[leaveCbKey]) {
2278
+ el[leaveCbKey](
2279
+ true
2280
+ /* cancelled */
2281
+ );
2282
+ }
2283
+ const leavingVNode = leavingVNodesCache[key];
2284
+ if (leavingVNode && isSameVNodeType(vnode, leavingVNode) && leavingVNode.el[leaveCbKey]) {
2285
+ leavingVNode.el[leaveCbKey]();
2286
+ }
2287
+ callHook(hook, [el]);
2288
+ },
2289
+ enter(el) {
2290
+ let hook = onEnter;
2291
+ let afterHook = onAfterEnter;
2292
+ let cancelHook = onEnterCancelled;
2293
+ if (!state.isMounted) {
2294
+ if (appear) {
2295
+ hook = onAppear || onEnter;
2296
+ afterHook = onAfterAppear || onAfterEnter;
2297
+ cancelHook = onAppearCancelled || onEnterCancelled;
2298
+ } else {
2299
+ return;
2300
+ }
2301
+ }
2302
+ let called = false;
2303
+ const done = el[enterCbKey$1] = (cancelled) => {
2304
+ if (called) return;
2305
+ called = true;
2306
+ if (cancelled) {
2307
+ callHook(cancelHook, [el]);
2308
+ } else {
2309
+ callHook(afterHook, [el]);
2310
+ }
2311
+ if (hooks.delayedLeave) {
2312
+ hooks.delayedLeave();
2313
+ }
2314
+ el[enterCbKey$1] = void 0;
2315
+ };
2316
+ if (hook) {
2317
+ callAsyncHook(hook, [el, done]);
2318
+ } else {
2319
+ done();
2320
+ }
2321
+ },
2322
+ leave(el, remove) {
2323
+ const key2 = String(vnode.key);
2324
+ if (el[enterCbKey$1]) {
2325
+ el[enterCbKey$1](
2326
+ true
2327
+ /* cancelled */
2328
+ );
2329
+ }
2330
+ if (state.isUnmounting) {
2331
+ return remove();
2332
+ }
2333
+ callHook(onBeforeLeave, [el]);
2334
+ let called = false;
2335
+ const done = el[leaveCbKey] = (cancelled) => {
2336
+ if (called) return;
2337
+ called = true;
2338
+ remove();
2339
+ if (cancelled) {
2340
+ callHook(onLeaveCancelled, [el]);
2341
+ } else {
2342
+ callHook(onAfterLeave, [el]);
2343
+ }
2344
+ el[leaveCbKey] = void 0;
2345
+ if (leavingVNodesCache[key2] === vnode) {
2346
+ delete leavingVNodesCache[key2];
2347
+ }
2348
+ };
2349
+ leavingVNodesCache[key2] = vnode;
2350
+ if (onLeave) {
2351
+ callAsyncHook(onLeave, [el, done]);
2352
+ } else {
2353
+ done();
2354
+ }
2355
+ },
2356
+ clone(vnode2) {
2357
+ const hooks2 = resolveTransitionHooks(
2358
+ vnode2,
2359
+ props,
2360
+ state,
2361
+ instance,
2362
+ postClone
2363
+ );
2364
+ if (postClone) postClone(hooks2);
2365
+ return hooks2;
2327
2366
  }
2367
+ };
2368
+ return hooks;
2369
+ }
2370
+ function emptyPlaceholder(vnode) {
2371
+ if (isKeepAlive(vnode)) {
2372
+ vnode = cloneVNode(vnode);
2373
+ vnode.children = null;
2374
+ return vnode;
2328
2375
  }
2329
2376
  }
2330
-
2331
- const COMPONENTS = "components";
2332
- const DIRECTIVES = "directives";
2333
- const FILTERS = "filters";
2334
- function resolveComponent(name, maybeSelfReference) {
2335
- return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;
2377
+ function getKeepAliveChild(vnode) {
2378
+ if (!isKeepAlive(vnode)) {
2379
+ return vnode;
2380
+ }
2381
+ const { shapeFlag, children } = vnode;
2382
+ if (children) {
2383
+ if (shapeFlag & 16) {
2384
+ return children[0];
2385
+ }
2386
+ if (shapeFlag & 32 && isFunction(children.default)) {
2387
+ return children.default();
2388
+ }
2389
+ }
2336
2390
  }
2337
- const NULL_DYNAMIC_COMPONENT = Symbol.for("v-ndc");
2338
- function resolveDynamicComponent(component) {
2339
- if (isString(component)) {
2340
- return resolveAsset(COMPONENTS, component, false) || component;
2391
+ function setTransitionHooks(vnode, hooks) {
2392
+ if (vnode.shapeFlag & 6 && vnode.component) {
2393
+ setTransitionHooks(vnode.component.subTree, hooks);
2394
+ } else if (vnode.shapeFlag & 128) {
2395
+ vnode.ssContent.transition = hooks.clone(vnode.ssContent);
2396
+ vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
2341
2397
  } else {
2342
- return component || NULL_DYNAMIC_COMPONENT;
2398
+ vnode.transition = hooks;
2343
2399
  }
2344
2400
  }
2345
- function resolveDirective(name) {
2346
- return resolveAsset(DIRECTIVES, name);
2347
- }
2348
- function resolveFilter$1(name) {
2349
- return resolveAsset(FILTERS, name);
2350
- }
2351
- function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false) {
2352
- const instance = currentRenderingInstance || currentInstance;
2353
- if (instance) {
2354
- const Component = instance.type;
2355
- if (type === COMPONENTS) {
2356
- const selfName = getComponentName(
2357
- Component,
2358
- false
2401
+ function getTransitionRawChildren(children, keepComment = false, parentKey) {
2402
+ let ret = [];
2403
+ let keyedFragmentCount = 0;
2404
+ for (let i = 0; i < children.length; i++) {
2405
+ let child = children[i];
2406
+ const key = parentKey == null ? child.key : String(parentKey) + String(child.key != null ? child.key : i);
2407
+ if (child.type === Fragment) {
2408
+ if (child.patchFlag & 128) keyedFragmentCount++;
2409
+ ret = ret.concat(
2410
+ getTransitionRawChildren(child.children, keepComment, key)
2359
2411
  );
2360
- if (selfName && (selfName === name || selfName === camelize(name) || selfName === capitalize(camelize(name)))) {
2361
- return Component;
2362
- }
2412
+ } else if (keepComment || child.type !== Comment) {
2413
+ ret.push(key != null ? cloneVNode(child, { key }) : child);
2363
2414
  }
2364
- const res = (
2365
- // local registration
2366
- // check instance[type] first which is resolved for options API
2367
- resolve(instance[type] || Component[type], name) || // global registration
2368
- resolve(instance.appContext[type], name)
2369
- );
2370
- if (!res && maybeSelfReference) {
2371
- return Component;
2415
+ }
2416
+ if (keyedFragmentCount > 1) {
2417
+ for (let i = 0; i < ret.length; i++) {
2418
+ ret[i].patchFlag = -2;
2372
2419
  }
2373
- return res;
2374
2420
  }
2421
+ return ret;
2375
2422
  }
2376
- function resolve(registry, name) {
2377
- return registry && (registry[name] || registry[camelize(name)] || registry[capitalize(camelize(name))]);
2423
+
2424
+ /*! #__NO_SIDE_EFFECTS__ */
2425
+ // @__NO_SIDE_EFFECTS__
2426
+ function defineComponent(options, extraOptions) {
2427
+ return isFunction(options) ? (
2428
+ // #8326: extend call and options.name access are considered side-effects
2429
+ // by Rollup, so we have to wrap it in a pure-annotated IIFE.
2430
+ /* @__PURE__ */ (() => extend({ name: options.name }, extraOptions, { setup: options }))()
2431
+ ) : options;
2378
2432
  }
2379
2433
 
2380
- const isSuspense = (type) => type.__isSuspense;
2381
- let suspenseId = 0;
2382
- const SuspenseImpl = {
2383
- name: "Suspense",
2384
- // In order to make Suspense tree-shakable, we need to avoid importing it
2385
- // directly in the renderer. The renderer checks for the __isSuspense flag
2386
- // on a vnode's type and calls the `process` method, passing in renderer
2387
- // internals.
2388
- __isSuspense: true,
2389
- process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals) {
2390
- if (n1 == null) {
2391
- mountSuspense(
2392
- n2,
2393
- container,
2394
- anchor,
2395
- parentComponent,
2396
- parentSuspense,
2397
- namespace,
2398
- slotScopeIds,
2399
- optimized,
2400
- rendererInternals
2401
- );
2402
- } else {
2403
- if (parentSuspense && parentSuspense.deps > 0 && !n1.suspense.isInFallback) {
2404
- n2.suspense = n1.suspense;
2405
- n2.suspense.vnode = n2;
2406
- n2.el = n1.el;
2407
- return;
2408
- }
2409
- patchSuspense(
2410
- n1,
2411
- n2,
2412
- container,
2413
- anchor,
2414
- parentComponent,
2415
- namespace,
2416
- slotScopeIds,
2417
- optimized,
2418
- rendererInternals
2419
- );
2420
- }
2421
- },
2422
- hydrate: hydrateSuspense,
2423
- normalize: normalizeSuspenseChildren
2424
- };
2425
- const Suspense = SuspenseImpl ;
2426
- function triggerEvent(vnode, name) {
2427
- const eventListener = vnode.props && vnode.props[name];
2428
- if (isFunction(eventListener)) {
2429
- eventListener();
2434
+ const isAsyncWrapper = (i) => !!i.type.__asyncLoader;
2435
+ /*! #__NO_SIDE_EFFECTS__ */
2436
+ // @__NO_SIDE_EFFECTS__
2437
+ function defineAsyncComponent(source) {
2438
+ if (isFunction(source)) {
2439
+ source = { loader: source };
2430
2440
  }
2431
- }
2432
- function mountSuspense(vnode, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals) {
2433
2441
  const {
2434
- p: patch,
2435
- o: { createElement }
2436
- } = rendererInternals;
2437
- const hiddenContainer = createElement("div");
2438
- const suspense = vnode.suspense = createSuspenseBoundary(
2439
- vnode,
2440
- parentSuspense,
2441
- parentComponent,
2442
- container,
2443
- hiddenContainer,
2444
- anchor,
2445
- namespace,
2446
- slotScopeIds,
2447
- optimized,
2448
- rendererInternals
2449
- );
2450
- patch(
2451
- null,
2452
- suspense.pendingBranch = vnode.ssContent,
2453
- hiddenContainer,
2454
- null,
2455
- parentComponent,
2456
- suspense,
2457
- namespace,
2458
- slotScopeIds
2459
- );
2460
- if (suspense.deps > 0) {
2461
- triggerEvent(vnode, "onPending");
2462
- triggerEvent(vnode, "onFallback");
2463
- patch(
2464
- null,
2465
- vnode.ssFallback,
2466
- container,
2467
- anchor,
2468
- parentComponent,
2469
- null,
2470
- // fallback tree will not have suspense context
2471
- namespace,
2472
- slotScopeIds
2473
- );
2474
- setActiveBranch(suspense, vnode.ssFallback);
2475
- } else {
2476
- suspense.resolve(false, true);
2477
- }
2478
- }
2479
- function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, slotScopeIds, optimized, { p: patch, um: unmount, o: { createElement } }) {
2480
- const suspense = n2.suspense = n1.suspense;
2481
- suspense.vnode = n2;
2482
- n2.el = n1.el;
2483
- const newBranch = n2.ssContent;
2484
- const newFallback = n2.ssFallback;
2485
- const { activeBranch, pendingBranch, isInFallback, isHydrating } = suspense;
2486
- if (pendingBranch) {
2487
- suspense.pendingBranch = newBranch;
2488
- if (isSameVNodeType(newBranch, pendingBranch)) {
2489
- patch(
2490
- pendingBranch,
2491
- newBranch,
2492
- suspense.hiddenContainer,
2493
- null,
2494
- parentComponent,
2495
- suspense,
2496
- namespace,
2497
- slotScopeIds,
2498
- optimized
2499
- );
2500
- if (suspense.deps <= 0) {
2501
- suspense.resolve();
2502
- } else if (isInFallback) {
2503
- if (!isHydrating) {
2504
- patch(
2505
- activeBranch,
2506
- newFallback,
2507
- container,
2508
- anchor,
2509
- parentComponent,
2510
- null,
2511
- // fallback tree will not have suspense context
2512
- namespace,
2513
- slotScopeIds,
2514
- optimized
2515
- );
2516
- setActiveBranch(suspense, newFallback);
2517
- }
2518
- }
2519
- } else {
2520
- suspense.pendingId = suspenseId++;
2521
- if (isHydrating) {
2522
- suspense.isHydrating = false;
2523
- suspense.activeBranch = pendingBranch;
2524
- } else {
2525
- unmount(pendingBranch, parentComponent, suspense);
2526
- }
2527
- suspense.deps = 0;
2528
- suspense.effects.length = 0;
2529
- suspense.hiddenContainer = createElement("div");
2530
- if (isInFallback) {
2531
- patch(
2532
- null,
2533
- newBranch,
2534
- suspense.hiddenContainer,
2535
- null,
2536
- parentComponent,
2537
- suspense,
2538
- namespace,
2539
- slotScopeIds,
2540
- optimized
2541
- );
2542
- if (suspense.deps <= 0) {
2543
- suspense.resolve();
2544
- } else {
2545
- patch(
2546
- activeBranch,
2547
- newFallback,
2548
- container,
2549
- anchor,
2550
- parentComponent,
2551
- null,
2552
- // fallback tree will not have suspense context
2553
- namespace,
2554
- slotScopeIds,
2555
- optimized
2556
- );
2557
- setActiveBranch(suspense, newFallback);
2558
- }
2559
- } else if (activeBranch && isSameVNodeType(newBranch, activeBranch)) {
2560
- patch(
2561
- activeBranch,
2562
- newBranch,
2563
- container,
2564
- anchor,
2565
- parentComponent,
2566
- suspense,
2567
- namespace,
2568
- slotScopeIds,
2569
- optimized
2570
- );
2571
- suspense.resolve(true);
2572
- } else {
2573
- patch(
2574
- null,
2575
- newBranch,
2576
- suspense.hiddenContainer,
2577
- null,
2578
- parentComponent,
2579
- suspense,
2580
- namespace,
2581
- slotScopeIds,
2582
- optimized
2583
- );
2584
- if (suspense.deps <= 0) {
2585
- suspense.resolve();
2586
- }
2587
- }
2588
- }
2589
- } else {
2590
- if (activeBranch && isSameVNodeType(newBranch, activeBranch)) {
2591
- patch(
2592
- activeBranch,
2593
- newBranch,
2594
- container,
2595
- anchor,
2596
- parentComponent,
2597
- suspense,
2598
- namespace,
2599
- slotScopeIds,
2600
- optimized
2601
- );
2602
- setActiveBranch(suspense, newBranch);
2603
- } else {
2604
- triggerEvent(n2, "onPending");
2605
- suspense.pendingBranch = newBranch;
2606
- if (newBranch.shapeFlag & 512) {
2607
- suspense.pendingId = newBranch.component.suspenseId;
2608
- } else {
2609
- suspense.pendingId = suspenseId++;
2610
- }
2611
- patch(
2612
- null,
2613
- newBranch,
2614
- suspense.hiddenContainer,
2615
- null,
2616
- parentComponent,
2617
- suspense,
2618
- namespace,
2619
- slotScopeIds,
2620
- optimized
2621
- );
2622
- if (suspense.deps <= 0) {
2623
- suspense.resolve();
2442
+ loader,
2443
+ loadingComponent,
2444
+ errorComponent,
2445
+ delay = 200,
2446
+ timeout,
2447
+ // undefined = never times out
2448
+ suspensible = true,
2449
+ onError: userOnError
2450
+ } = source;
2451
+ let pendingRequest = null;
2452
+ let resolvedComp;
2453
+ let retries = 0;
2454
+ const retry = () => {
2455
+ retries++;
2456
+ pendingRequest = null;
2457
+ return load();
2458
+ };
2459
+ const load = () => {
2460
+ let thisRequest;
2461
+ return pendingRequest || (thisRequest = pendingRequest = loader().catch((err) => {
2462
+ err = err instanceof Error ? err : new Error(String(err));
2463
+ if (userOnError) {
2464
+ return new Promise((resolve, reject) => {
2465
+ const userRetry = () => resolve(retry());
2466
+ const userFail = () => reject(err);
2467
+ userOnError(err, userRetry, userFail, retries + 1);
2468
+ });
2624
2469
  } else {
2625
- const { timeout, pendingId } = suspense;
2626
- if (timeout > 0) {
2627
- setTimeout(() => {
2628
- if (suspense.pendingId === pendingId) {
2629
- suspense.fallback(newFallback);
2630
- }
2631
- }, timeout);
2632
- } else if (timeout === 0) {
2633
- suspense.fallback(newFallback);
2634
- }
2635
- }
2636
- }
2637
- }
2638
- }
2639
- function createSuspenseBoundary(vnode, parentSuspense, parentComponent, container, hiddenContainer, anchor, namespace, slotScopeIds, optimized, rendererInternals, isHydrating = false) {
2640
- const {
2641
- p: patch,
2642
- m: move,
2643
- um: unmount,
2644
- n: next,
2645
- o: { parentNode, remove }
2646
- } = rendererInternals;
2647
- let parentSuspenseId;
2648
- const isSuspensible = isVNodeSuspensible(vnode);
2649
- if (isSuspensible) {
2650
- if (parentSuspense && parentSuspense.pendingBranch) {
2651
- parentSuspenseId = parentSuspense.pendingId;
2652
- parentSuspense.deps++;
2653
- }
2654
- }
2655
- const timeout = vnode.props ? toNumber(vnode.props.timeout) : void 0;
2656
- const initialAnchor = anchor;
2657
- const suspense = {
2658
- vnode,
2659
- parent: parentSuspense,
2660
- parentComponent,
2661
- namespace,
2662
- container,
2663
- hiddenContainer,
2664
- deps: 0,
2665
- pendingId: suspenseId++,
2666
- timeout: typeof timeout === "number" ? timeout : -1,
2667
- activeBranch: null,
2668
- pendingBranch: null,
2669
- isInFallback: !isHydrating,
2670
- isHydrating,
2671
- isUnmounted: false,
2672
- effects: [],
2673
- resolve(resume = false, sync = false) {
2674
- const {
2675
- vnode: vnode2,
2676
- activeBranch,
2677
- pendingBranch,
2678
- pendingId,
2679
- effects,
2680
- parentComponent: parentComponent2,
2681
- container: container2
2682
- } = suspense;
2683
- let delayEnter = false;
2684
- if (suspense.isHydrating) {
2685
- suspense.isHydrating = false;
2686
- } else if (!resume) {
2687
- delayEnter = activeBranch && pendingBranch.transition && pendingBranch.transition.mode === "out-in";
2688
- if (delayEnter) {
2689
- activeBranch.transition.afterLeave = () => {
2690
- if (pendingId === suspense.pendingId) {
2691
- move(
2692
- pendingBranch,
2693
- container2,
2694
- anchor === initialAnchor ? next(activeBranch) : anchor,
2695
- 0
2696
- );
2697
- queuePostFlushCb(effects);
2698
- }
2699
- };
2700
- }
2701
- if (activeBranch) {
2702
- if (parentNode(activeBranch.el) !== suspense.hiddenContainer) {
2703
- anchor = next(activeBranch);
2704
- }
2705
- unmount(activeBranch, parentComponent2, suspense, true);
2706
- }
2707
- if (!delayEnter) {
2708
- move(pendingBranch, container2, anchor, 0);
2709
- }
2710
- }
2711
- setActiveBranch(suspense, pendingBranch);
2712
- suspense.pendingBranch = null;
2713
- suspense.isInFallback = false;
2714
- let parent = suspense.parent;
2715
- let hasUnresolvedAncestor = false;
2716
- while (parent) {
2717
- if (parent.pendingBranch) {
2718
- parent.effects.push(...effects);
2719
- hasUnresolvedAncestor = true;
2720
- break;
2721
- }
2722
- parent = parent.parent;
2723
- }
2724
- if (!hasUnresolvedAncestor && !delayEnter) {
2725
- queuePostFlushCb(effects);
2726
- }
2727
- suspense.effects = [];
2728
- if (isSuspensible) {
2729
- if (parentSuspense && parentSuspense.pendingBranch && parentSuspenseId === parentSuspense.pendingId) {
2730
- parentSuspense.deps--;
2731
- if (parentSuspense.deps === 0 && !sync) {
2732
- parentSuspense.resolve();
2733
- }
2734
- }
2735
- }
2736
- triggerEvent(vnode2, "onResolve");
2737
- },
2738
- fallback(fallbackVNode) {
2739
- if (!suspense.pendingBranch) {
2740
- return;
2741
- }
2742
- const { vnode: vnode2, activeBranch, parentComponent: parentComponent2, container: container2, namespace: namespace2 } = suspense;
2743
- triggerEvent(vnode2, "onFallback");
2744
- const anchor2 = next(activeBranch);
2745
- const mountFallback = () => {
2746
- if (!suspense.isInFallback) {
2747
- return;
2748
- }
2749
- patch(
2750
- null,
2751
- fallbackVNode,
2752
- container2,
2753
- anchor2,
2754
- parentComponent2,
2755
- null,
2756
- // fallback tree will not have suspense context
2757
- namespace2,
2758
- slotScopeIds,
2759
- optimized
2760
- );
2761
- setActiveBranch(suspense, fallbackVNode);
2762
- };
2763
- const delayEnter = fallbackVNode.transition && fallbackVNode.transition.mode === "out-in";
2764
- if (delayEnter) {
2765
- activeBranch.transition.afterLeave = mountFallback;
2766
- }
2767
- suspense.isInFallback = true;
2768
- unmount(
2769
- activeBranch,
2770
- parentComponent2,
2771
- null,
2772
- // no suspense so unmount hooks fire now
2773
- true
2774
- // shouldRemove
2775
- );
2776
- if (!delayEnter) {
2777
- mountFallback();
2470
+ throw err;
2778
2471
  }
2779
- },
2780
- move(container2, anchor2, type) {
2781
- suspense.activeBranch && move(suspense.activeBranch, container2, anchor2, type);
2782
- suspense.container = container2;
2783
- },
2784
- next() {
2785
- return suspense.activeBranch && next(suspense.activeBranch);
2786
- },
2787
- registerDep(instance, setupRenderEffect, optimized2) {
2788
- const isInPendingSuspense = !!suspense.pendingBranch;
2789
- if (isInPendingSuspense) {
2790
- suspense.deps++;
2472
+ }).then((comp) => {
2473
+ if (thisRequest !== pendingRequest && pendingRequest) {
2474
+ return pendingRequest;
2791
2475
  }
2792
- const hydratedEl = instance.vnode.el;
2793
- instance.asyncDep.catch((err) => {
2794
- handleError(err, instance, 0);
2795
- }).then((asyncSetupResult) => {
2796
- if (instance.isUnmounted || suspense.isUnmounted || suspense.pendingId !== instance.suspenseId) {
2797
- return;
2798
- }
2799
- instance.asyncResolved = true;
2800
- const { vnode: vnode2 } = instance;
2801
- handleSetupResult(instance, asyncSetupResult, false);
2802
- if (hydratedEl) {
2803
- vnode2.el = hydratedEl;
2804
- }
2805
- const placeholder = !hydratedEl && instance.subTree.el;
2806
- setupRenderEffect(
2807
- instance,
2808
- vnode2,
2809
- // component may have been moved before resolve.
2810
- // if this is not a hydration, instance.subTree will be the comment
2811
- // placeholder.
2812
- parentNode(hydratedEl || instance.subTree.el),
2813
- // anchor will not be used if this is hydration, so only need to
2814
- // consider the comment placeholder case.
2815
- hydratedEl ? null : next(instance.subTree),
2816
- suspense,
2817
- namespace,
2818
- optimized2
2819
- );
2820
- if (placeholder) {
2821
- remove(placeholder);
2822
- }
2823
- updateHOCHostEl(instance, vnode2.el);
2824
- if (isInPendingSuspense && --suspense.deps === 0) {
2825
- suspense.resolve();
2826
- }
2827
- });
2476
+ if (comp && (comp.__esModule || comp[Symbol.toStringTag] === "Module")) {
2477
+ comp = comp.default;
2478
+ }
2479
+ resolvedComp = comp;
2480
+ return comp;
2481
+ }));
2482
+ };
2483
+ return defineComponent({
2484
+ name: "AsyncComponentWrapper",
2485
+ __asyncLoader: load,
2486
+ get __asyncResolved() {
2487
+ return resolvedComp;
2828
2488
  },
2829
- unmount(parentSuspense2, doRemove) {
2830
- suspense.isUnmounted = true;
2831
- if (suspense.activeBranch) {
2832
- unmount(
2833
- suspense.activeBranch,
2834
- parentComponent,
2835
- parentSuspense2,
2836
- doRemove
2837
- );
2489
+ setup() {
2490
+ const instance = currentInstance;
2491
+ if (resolvedComp) {
2492
+ return () => createInnerComp(resolvedComp, instance);
2838
2493
  }
2839
- if (suspense.pendingBranch) {
2840
- unmount(
2841
- suspense.pendingBranch,
2842
- parentComponent,
2843
- parentSuspense2,
2844
- doRemove
2494
+ const onError = (err) => {
2495
+ pendingRequest = null;
2496
+ handleError(
2497
+ err,
2498
+ instance,
2499
+ 13,
2500
+ !errorComponent
2845
2501
  );
2502
+ };
2503
+ if (suspensible && instance.suspense || isInSSRComponentSetup) {
2504
+ return load().then((comp) => {
2505
+ return () => createInnerComp(comp, instance);
2506
+ }).catch((err) => {
2507
+ onError(err);
2508
+ return () => errorComponent ? createVNode(errorComponent, {
2509
+ error: err
2510
+ }) : null;
2511
+ });
2846
2512
  }
2513
+ const loaded = ref(false);
2514
+ const error = ref();
2515
+ const delayed = ref(!!delay);
2516
+ if (delay) {
2517
+ setTimeout(() => {
2518
+ delayed.value = false;
2519
+ }, delay);
2520
+ }
2521
+ if (timeout != null) {
2522
+ setTimeout(() => {
2523
+ if (!loaded.value && !error.value) {
2524
+ const err = new Error(
2525
+ `Async component timed out after ${timeout}ms.`
2526
+ );
2527
+ onError(err);
2528
+ error.value = err;
2529
+ }
2530
+ }, timeout);
2531
+ }
2532
+ load().then(() => {
2533
+ loaded.value = true;
2534
+ if (instance.parent && isKeepAlive(instance.parent.vnode)) {
2535
+ instance.parent.effect.dirty = true;
2536
+ queueJob(instance.parent.update);
2537
+ }
2538
+ }).catch((err) => {
2539
+ onError(err);
2540
+ error.value = err;
2541
+ });
2542
+ return () => {
2543
+ if (loaded.value && resolvedComp) {
2544
+ return createInnerComp(resolvedComp, instance);
2545
+ } else if (error.value && errorComponent) {
2546
+ return createVNode(errorComponent, {
2547
+ error: error.value
2548
+ });
2549
+ } else if (loadingComponent && !delayed.value) {
2550
+ return createVNode(loadingComponent);
2551
+ }
2552
+ };
2847
2553
  }
2848
- };
2849
- return suspense;
2850
- }
2851
- function hydrateSuspense(node, vnode, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals, hydrateNode) {
2852
- const suspense = vnode.suspense = createSuspenseBoundary(
2853
- vnode,
2854
- parentSuspense,
2855
- parentComponent,
2856
- node.parentNode,
2857
- // eslint-disable-next-line no-restricted-globals
2858
- document.createElement("div"),
2859
- null,
2860
- namespace,
2861
- slotScopeIds,
2862
- optimized,
2863
- rendererInternals,
2864
- true
2865
- );
2866
- const result = hydrateNode(
2867
- node,
2868
- suspense.pendingBranch = vnode.ssContent,
2869
- parentComponent,
2870
- suspense,
2871
- slotScopeIds,
2872
- optimized
2873
- );
2874
- if (suspense.deps === 0) {
2875
- suspense.resolve(false, true);
2876
- }
2877
- return result;
2878
- }
2879
- function normalizeSuspenseChildren(vnode) {
2880
- const { shapeFlag, children } = vnode;
2881
- const isSlotChildren = shapeFlag & 32;
2882
- vnode.ssContent = normalizeSuspenseSlot(
2883
- isSlotChildren ? children.default : children
2884
- );
2885
- vnode.ssFallback = isSlotChildren ? normalizeSuspenseSlot(children.fallback) : createVNode(Comment);
2886
- }
2887
- function normalizeSuspenseSlot(s) {
2888
- let block;
2889
- if (isFunction(s)) {
2890
- const trackBlock = isBlockTreeEnabled && s._c;
2891
- if (trackBlock) {
2892
- s._d = false;
2893
- openBlock();
2894
- }
2895
- s = s();
2896
- if (trackBlock) {
2897
- s._d = true;
2898
- block = currentBlock;
2899
- closeBlock();
2900
- }
2901
- }
2902
- if (isArray(s)) {
2903
- const singleChild = filterSingleRoot(s);
2904
- s = singleChild;
2905
- }
2906
- s = normalizeVNode(s);
2907
- if (block && !s.dynamicChildren) {
2908
- s.dynamicChildren = block.filter((c) => c !== s);
2909
- }
2910
- return s;
2911
- }
2912
- function queueEffectWithSuspense(fn, suspense) {
2913
- if (suspense && suspense.pendingBranch) {
2914
- if (isArray(fn)) {
2915
- suspense.effects.push(...fn);
2916
- } else {
2917
- suspense.effects.push(fn);
2918
- }
2919
- } else {
2920
- queuePostFlushCb(fn);
2921
- }
2922
- }
2923
- function setActiveBranch(suspense, branch) {
2924
- suspense.activeBranch = branch;
2925
- const { vnode, parentComponent } = suspense;
2926
- let el = branch.el;
2927
- while (!el && branch.component) {
2928
- branch = branch.component.subTree;
2929
- el = branch.el;
2930
- }
2931
- vnode.el = el;
2932
- if (parentComponent && parentComponent.subTree === vnode) {
2933
- parentComponent.vnode.el = el;
2934
- updateHOCHostEl(parentComponent, el);
2935
- }
2554
+ });
2936
2555
  }
2937
- function isVNodeSuspensible(vnode) {
2938
- const suspensible = vnode.props && vnode.props.suspensible;
2939
- return suspensible != null && suspensible !== false;
2556
+ function createInnerComp(comp, parent) {
2557
+ const { ref: ref2, props, children, ce } = parent.vnode;
2558
+ const vnode = createVNode(comp, props, children);
2559
+ vnode.ref = ref2;
2560
+ vnode.ce = ce;
2561
+ delete parent.vnode.ce;
2562
+ return vnode;
2940
2563
  }
2941
2564
 
2942
- function injectHook(type, hook, target = currentInstance, prepend = false) {
2943
- if (target) {
2944
- const hooks = target[type] || (target[type] = []);
2945
- const wrappedHook = hook.__weh || (hook.__weh = (...args) => {
2946
- pauseTracking();
2947
- const reset = setCurrentInstance(target);
2948
- const res = callWithAsyncErrorHandling(hook, target, type, args);
2949
- reset();
2950
- resetTracking();
2951
- return res;
2952
- });
2953
- if (prepend) {
2954
- hooks.unshift(wrappedHook);
2955
- } else {
2956
- hooks.push(wrappedHook);
2565
+ const isKeepAlive = (vnode) => vnode.type.__isKeepAlive;
2566
+ const KeepAliveImpl = {
2567
+ name: `KeepAlive`,
2568
+ // Marker for special handling inside the renderer. We are not using a ===
2569
+ // check directly on KeepAlive in the renderer, because importing it directly
2570
+ // would prevent it from being tree-shaken.
2571
+ __isKeepAlive: true,
2572
+ props: {
2573
+ include: [String, RegExp, Array],
2574
+ exclude: [String, RegExp, Array],
2575
+ max: [String, Number]
2576
+ },
2577
+ setup(props, { slots }) {
2578
+ const instance = getCurrentInstance();
2579
+ const sharedContext = instance.ctx;
2580
+ if (!sharedContext.renderer) {
2581
+ return () => {
2582
+ const children = slots.default && slots.default();
2583
+ return children && children.length === 1 ? children[0] : children;
2584
+ };
2585
+ }
2586
+ const cache = /* @__PURE__ */ new Map();
2587
+ const keys = /* @__PURE__ */ new Set();
2588
+ let current = null;
2589
+ const parentSuspense = instance.suspense;
2590
+ const {
2591
+ renderer: {
2592
+ p: patch,
2593
+ m: move,
2594
+ um: _unmount,
2595
+ o: { createElement }
2596
+ }
2597
+ } = sharedContext;
2598
+ const storageContainer = createElement("div");
2599
+ sharedContext.activate = (vnode, container, anchor, namespace, optimized) => {
2600
+ const instance2 = vnode.component;
2601
+ move(vnode, container, anchor, 0, parentSuspense);
2602
+ patch(
2603
+ instance2.vnode,
2604
+ vnode,
2605
+ container,
2606
+ anchor,
2607
+ instance2,
2608
+ parentSuspense,
2609
+ namespace,
2610
+ vnode.slotScopeIds,
2611
+ optimized
2612
+ );
2613
+ queuePostRenderEffect(() => {
2614
+ instance2.isDeactivated = false;
2615
+ if (instance2.a) {
2616
+ invokeArrayFns(instance2.a);
2617
+ }
2618
+ const vnodeHook = vnode.props && vnode.props.onVnodeMounted;
2619
+ if (vnodeHook) {
2620
+ invokeVNodeHook(vnodeHook, instance2.parent, vnode);
2621
+ }
2622
+ }, parentSuspense);
2623
+ };
2624
+ sharedContext.deactivate = (vnode) => {
2625
+ const instance2 = vnode.component;
2626
+ invalidateMount(instance2.m);
2627
+ invalidateMount(instance2.a);
2628
+ move(vnode, storageContainer, null, 1, parentSuspense);
2629
+ queuePostRenderEffect(() => {
2630
+ if (instance2.da) {
2631
+ invokeArrayFns(instance2.da);
2632
+ }
2633
+ const vnodeHook = vnode.props && vnode.props.onVnodeUnmounted;
2634
+ if (vnodeHook) {
2635
+ invokeVNodeHook(vnodeHook, instance2.parent, vnode);
2636
+ }
2637
+ instance2.isDeactivated = true;
2638
+ }, parentSuspense);
2639
+ };
2640
+ function unmount(vnode) {
2641
+ resetShapeFlag(vnode);
2642
+ _unmount(vnode, instance, parentSuspense, true);
2957
2643
  }
2958
- return wrappedHook;
2959
- }
2960
- }
2961
- const createHook = (lifecycle) => (hook, target = currentInstance) => {
2962
- if (!isInSSRComponentSetup || lifecycle === "sp") {
2963
- injectHook(lifecycle, (...args) => hook(...args), target);
2964
- }
2965
- };
2966
- const onBeforeMount = createHook("bm");
2967
- const onMounted = createHook("m");
2968
- const onBeforeUpdate = createHook("bu");
2969
- const onUpdated = createHook("u");
2970
- const onBeforeUnmount = createHook("bum");
2971
- const onUnmounted = createHook("um");
2972
- const onServerPrefetch = createHook("sp");
2973
- const onRenderTriggered = createHook(
2974
- "rtg"
2975
- );
2976
- const onRenderTracked = createHook(
2977
- "rtc"
2978
- );
2979
- function onErrorCaptured(hook, target = currentInstance) {
2980
- injectHook("ec", hook, target);
2981
- }
2982
-
2983
- const legacyDirectiveHookMap = {
2984
- beforeMount: "bind",
2985
- mounted: "inserted",
2986
- updated: ["update", "componentUpdated"],
2987
- unmounted: "unbind"
2988
- };
2989
- function mapCompatDirectiveHook(name, dir, instance) {
2990
- const mappedName = legacyDirectiveHookMap[name];
2991
- if (mappedName) {
2992
- if (isArray(mappedName)) {
2993
- const hook = [];
2994
- mappedName.forEach((mapped) => {
2995
- const mappedHook = dir[mapped];
2996
- if (mappedHook) {
2997
- softAssertCompatEnabled(
2998
- "CUSTOM_DIR",
2999
- instance,
3000
- mapped,
3001
- name
3002
- );
3003
- hook.push(mappedHook);
2644
+ function pruneCache(filter) {
2645
+ cache.forEach((vnode, key) => {
2646
+ const name = getComponentName(vnode.type);
2647
+ if (name && (!filter || !filter(name))) {
2648
+ pruneCacheEntry(key);
3004
2649
  }
3005
2650
  });
3006
- return hook.length ? hook : void 0;
3007
- } else {
3008
- if (dir[mappedName]) {
3009
- softAssertCompatEnabled(
3010
- "CUSTOM_DIR",
3011
- instance,
3012
- mappedName,
3013
- name
3014
- );
2651
+ }
2652
+ function pruneCacheEntry(key) {
2653
+ const cached = cache.get(key);
2654
+ if (!current || !isSameVNodeType(cached, current)) {
2655
+ unmount(cached);
2656
+ } else if (current) {
2657
+ resetShapeFlag(current);
3015
2658
  }
3016
- return dir[mappedName];
2659
+ cache.delete(key);
2660
+ keys.delete(key);
3017
2661
  }
2662
+ watch(
2663
+ () => [props.include, props.exclude],
2664
+ ([include, exclude]) => {
2665
+ include && pruneCache((name) => matches(include, name));
2666
+ exclude && pruneCache((name) => !matches(exclude, name));
2667
+ },
2668
+ // prune post-render after `current` has been updated
2669
+ { flush: "post", deep: true }
2670
+ );
2671
+ let pendingCacheKey = null;
2672
+ const cacheSubtree = () => {
2673
+ if (pendingCacheKey != null) {
2674
+ if (isSuspense(instance.subTree.type)) {
2675
+ queuePostRenderEffect(() => {
2676
+ cache.set(pendingCacheKey, getInnerChild(instance.subTree));
2677
+ }, instance.subTree.suspense);
2678
+ } else {
2679
+ cache.set(pendingCacheKey, getInnerChild(instance.subTree));
2680
+ }
2681
+ }
2682
+ };
2683
+ onMounted(cacheSubtree);
2684
+ onUpdated(cacheSubtree);
2685
+ onBeforeUnmount(() => {
2686
+ cache.forEach((cached) => {
2687
+ const { subTree, suspense } = instance;
2688
+ const vnode = getInnerChild(subTree);
2689
+ if (cached.type === vnode.type && cached.key === vnode.key) {
2690
+ resetShapeFlag(vnode);
2691
+ const da = vnode.component.da;
2692
+ da && queuePostRenderEffect(da, suspense);
2693
+ return;
2694
+ }
2695
+ unmount(cached);
2696
+ });
2697
+ });
2698
+ return () => {
2699
+ pendingCacheKey = null;
2700
+ if (!slots.default) {
2701
+ return null;
2702
+ }
2703
+ const children = slots.default();
2704
+ const rawVNode = children[0];
2705
+ if (children.length > 1) {
2706
+ current = null;
2707
+ return children;
2708
+ } else if (!isVNode(rawVNode) || !(rawVNode.shapeFlag & 4) && !(rawVNode.shapeFlag & 128)) {
2709
+ current = null;
2710
+ return rawVNode;
2711
+ }
2712
+ let vnode = getInnerChild(rawVNode);
2713
+ const comp = vnode.type;
2714
+ const name = getComponentName(
2715
+ isAsyncWrapper(vnode) ? vnode.type.__asyncResolved || {} : comp
2716
+ );
2717
+ const { include, exclude, max } = props;
2718
+ if (include && (!name || !matches(include, name)) || exclude && name && matches(exclude, name)) {
2719
+ current = vnode;
2720
+ return rawVNode;
2721
+ }
2722
+ const key = vnode.key == null ? comp : vnode.key;
2723
+ const cachedVNode = cache.get(key);
2724
+ if (vnode.el) {
2725
+ vnode = cloneVNode(vnode);
2726
+ if (rawVNode.shapeFlag & 128) {
2727
+ rawVNode.ssContent = vnode;
2728
+ }
2729
+ }
2730
+ pendingCacheKey = key;
2731
+ if (cachedVNode) {
2732
+ vnode.el = cachedVNode.el;
2733
+ vnode.component = cachedVNode.component;
2734
+ if (vnode.transition) {
2735
+ setTransitionHooks(vnode, vnode.transition);
2736
+ }
2737
+ vnode.shapeFlag |= 512;
2738
+ keys.delete(key);
2739
+ keys.add(key);
2740
+ } else {
2741
+ keys.add(key);
2742
+ if (max && keys.size > parseInt(max, 10)) {
2743
+ pruneCacheEntry(keys.values().next().value);
2744
+ }
2745
+ }
2746
+ vnode.shapeFlag |= 256;
2747
+ current = vnode;
2748
+ return isSuspense(rawVNode.type) ? rawVNode : vnode;
2749
+ };
3018
2750
  }
2751
+ };
2752
+ {
2753
+ KeepAliveImpl.__isBuildIn = true;
3019
2754
  }
3020
-
3021
- function withDirectives(vnode, directives) {
3022
- if (currentRenderingInstance === null) {
3023
- return vnode;
2755
+ const KeepAlive = KeepAliveImpl;
2756
+ function matches(pattern, name) {
2757
+ if (isArray(pattern)) {
2758
+ return pattern.some((p) => matches(p, name));
2759
+ } else if (isString(pattern)) {
2760
+ return pattern.split(",").includes(name);
2761
+ } else if (isRegExp(pattern)) {
2762
+ return pattern.test(name);
3024
2763
  }
3025
- const instance = getComponentPublicInstance(currentRenderingInstance);
3026
- const bindings = vnode.dirs || (vnode.dirs = []);
3027
- for (let i = 0; i < directives.length; i++) {
3028
- let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i];
3029
- if (dir) {
3030
- if (isFunction(dir)) {
3031
- dir = {
3032
- mounted: dir,
3033
- updated: dir
3034
- };
2764
+ return false;
2765
+ }
2766
+ function onActivated(hook, target) {
2767
+ registerKeepAliveHook(hook, "a", target);
2768
+ }
2769
+ function onDeactivated(hook, target) {
2770
+ registerKeepAliveHook(hook, "da", target);
2771
+ }
2772
+ function registerKeepAliveHook(hook, type, target = currentInstance) {
2773
+ const wrappedHook = hook.__wdc || (hook.__wdc = () => {
2774
+ let current = target;
2775
+ while (current) {
2776
+ if (current.isDeactivated) {
2777
+ return;
3035
2778
  }
3036
- if (dir.deep) {
3037
- traverse(value);
2779
+ current = current.parent;
2780
+ }
2781
+ return hook();
2782
+ });
2783
+ injectHook(type, wrappedHook, target);
2784
+ if (target) {
2785
+ let current = target.parent;
2786
+ while (current && current.parent) {
2787
+ if (isKeepAlive(current.parent.vnode)) {
2788
+ injectToKeepAliveRoot(wrappedHook, type, target, current);
3038
2789
  }
3039
- bindings.push({
3040
- dir,
3041
- instance,
3042
- value,
3043
- oldValue: void 0,
3044
- arg,
3045
- modifiers
3046
- });
2790
+ current = current.parent;
3047
2791
  }
3048
2792
  }
3049
- return vnode;
3050
2793
  }
3051
- function invokeDirectiveHook(vnode, prevVNode, instance, name) {
3052
- const bindings = vnode.dirs;
3053
- const oldBindings = prevVNode && prevVNode.dirs;
3054
- for (let i = 0; i < bindings.length; i++) {
3055
- const binding = bindings[i];
3056
- if (oldBindings) {
3057
- binding.oldValue = oldBindings[i].value;
3058
- }
3059
- let hook = binding.dir[name];
3060
- if (!hook) {
3061
- hook = mapCompatDirectiveHook(name, binding.dir, instance);
3062
- }
3063
- if (hook) {
2794
+ function injectToKeepAliveRoot(hook, type, target, keepAliveRoot) {
2795
+ const injected = injectHook(
2796
+ type,
2797
+ hook,
2798
+ keepAliveRoot,
2799
+ true
2800
+ /* prepend */
2801
+ );
2802
+ onUnmounted(() => {
2803
+ remove(keepAliveRoot[type], injected);
2804
+ }, target);
2805
+ }
2806
+ function resetShapeFlag(vnode) {
2807
+ vnode.shapeFlag &= ~256;
2808
+ vnode.shapeFlag &= ~512;
2809
+ }
2810
+ function getInnerChild(vnode) {
2811
+ return vnode.shapeFlag & 128 ? vnode.ssContent : vnode;
2812
+ }
2813
+
2814
+ function injectHook(type, hook, target = currentInstance, prepend = false) {
2815
+ if (target) {
2816
+ const hooks = target[type] || (target[type] = []);
2817
+ const wrappedHook = hook.__weh || (hook.__weh = (...args) => {
3064
2818
  pauseTracking();
3065
- callWithAsyncErrorHandling(hook, instance, 8, [
3066
- vnode.el,
3067
- binding,
3068
- vnode,
3069
- prevVNode
3070
- ]);
2819
+ const reset = setCurrentInstance(target);
2820
+ const res = callWithAsyncErrorHandling(hook, target, type, args);
2821
+ reset();
3071
2822
  resetTracking();
2823
+ return res;
2824
+ });
2825
+ if (prepend) {
2826
+ hooks.unshift(wrappedHook);
2827
+ } else {
2828
+ hooks.push(wrappedHook);
3072
2829
  }
2830
+ return wrappedHook;
3073
2831
  }
3074
2832
  }
2833
+ const createHook = (lifecycle) => (hook, target = currentInstance) => {
2834
+ if (!isInSSRComponentSetup || lifecycle === "sp") {
2835
+ injectHook(lifecycle, (...args) => hook(...args), target);
2836
+ }
2837
+ };
2838
+ const onBeforeMount = createHook("bm");
2839
+ const onMounted = createHook("m");
2840
+ const onBeforeUpdate = createHook("bu");
2841
+ const onUpdated = createHook("u");
2842
+ const onBeforeUnmount = createHook("bum");
2843
+ const onUnmounted = createHook("um");
2844
+ const onServerPrefetch = createHook("sp");
2845
+ const onRenderTriggered = createHook(
2846
+ "rtg"
2847
+ );
2848
+ const onRenderTracked = createHook(
2849
+ "rtc"
2850
+ );
2851
+ function onErrorCaptured(hook, target = currentInstance) {
2852
+ injectHook("ec", hook, target);
2853
+ }
3075
2854
 
3076
2855
  function getCompatChildren(instance) {
3077
2856
  assertCompatEnabled("INSTANCE_CHILDREN", instance);
@@ -3108,6 +2887,55 @@ function getCompatListeners(instance) {
3108
2887
  return listeners;
3109
2888
  }
3110
2889
 
2890
+ const COMPONENTS = "components";
2891
+ const DIRECTIVES = "directives";
2892
+ const FILTERS = "filters";
2893
+ function resolveComponent(name, maybeSelfReference) {
2894
+ return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;
2895
+ }
2896
+ const NULL_DYNAMIC_COMPONENT = Symbol.for("v-ndc");
2897
+ function resolveDynamicComponent(component) {
2898
+ if (isString(component)) {
2899
+ return resolveAsset(COMPONENTS, component, false) || component;
2900
+ } else {
2901
+ return component || NULL_DYNAMIC_COMPONENT;
2902
+ }
2903
+ }
2904
+ function resolveDirective(name) {
2905
+ return resolveAsset(DIRECTIVES, name);
2906
+ }
2907
+ function resolveFilter$1(name) {
2908
+ return resolveAsset(FILTERS, name);
2909
+ }
2910
+ function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false) {
2911
+ const instance = currentRenderingInstance || currentInstance;
2912
+ if (instance) {
2913
+ const Component = instance.type;
2914
+ if (type === COMPONENTS) {
2915
+ const selfName = getComponentName(
2916
+ Component,
2917
+ false
2918
+ );
2919
+ if (selfName && (selfName === name || selfName === camelize(name) || selfName === capitalize(camelize(name)))) {
2920
+ return Component;
2921
+ }
2922
+ }
2923
+ const res = (
2924
+ // local registration
2925
+ // check instance[type] first which is resolved for options API
2926
+ resolve(instance[type] || Component[type], name) || // global registration
2927
+ resolve(instance.appContext[type], name)
2928
+ );
2929
+ if (!res && maybeSelfReference) {
2930
+ return Component;
2931
+ }
2932
+ return res;
2933
+ }
2934
+ }
2935
+ function resolve(registry, name) {
2936
+ return registry && (registry[name] || registry[camelize(name)] || registry[capitalize(camelize(name))]);
2937
+ }
2938
+
3111
2939
  function convertLegacyRenderFn(instance) {
3112
2940
  const Component = instance.type;
3113
2941
  const render = Component.render;
@@ -3410,147 +3238,6 @@ function createSlots(slots, dynamicSlots) {
3410
3238
  return slots;
3411
3239
  }
3412
3240
 
3413
- /*! #__NO_SIDE_EFFECTS__ */
3414
- // @__NO_SIDE_EFFECTS__
3415
- function defineComponent(options, extraOptions) {
3416
- return isFunction(options) ? (
3417
- // #8326: extend call and options.name access are considered side-effects
3418
- // by Rollup, so we have to wrap it in a pure-annotated IIFE.
3419
- /* @__PURE__ */ (() => extend({ name: options.name }, extraOptions, { setup: options }))()
3420
- ) : options;
3421
- }
3422
-
3423
- const isAsyncWrapper = (i) => !!i.type.__asyncLoader;
3424
- /*! #__NO_SIDE_EFFECTS__ */
3425
- // @__NO_SIDE_EFFECTS__
3426
- function defineAsyncComponent(source) {
3427
- if (isFunction(source)) {
3428
- source = { loader: source };
3429
- }
3430
- const {
3431
- loader,
3432
- loadingComponent,
3433
- errorComponent,
3434
- delay = 200,
3435
- timeout,
3436
- // undefined = never times out
3437
- suspensible = true,
3438
- onError: userOnError
3439
- } = source;
3440
- let pendingRequest = null;
3441
- let resolvedComp;
3442
- let retries = 0;
3443
- const retry = () => {
3444
- retries++;
3445
- pendingRequest = null;
3446
- return load();
3447
- };
3448
- const load = () => {
3449
- let thisRequest;
3450
- return pendingRequest || (thisRequest = pendingRequest = loader().catch((err) => {
3451
- err = err instanceof Error ? err : new Error(String(err));
3452
- if (userOnError) {
3453
- return new Promise((resolve, reject) => {
3454
- const userRetry = () => resolve(retry());
3455
- const userFail = () => reject(err);
3456
- userOnError(err, userRetry, userFail, retries + 1);
3457
- });
3458
- } else {
3459
- throw err;
3460
- }
3461
- }).then((comp) => {
3462
- if (thisRequest !== pendingRequest && pendingRequest) {
3463
- return pendingRequest;
3464
- }
3465
- if (comp && (comp.__esModule || comp[Symbol.toStringTag] === "Module")) {
3466
- comp = comp.default;
3467
- }
3468
- resolvedComp = comp;
3469
- return comp;
3470
- }));
3471
- };
3472
- return defineComponent({
3473
- name: "AsyncComponentWrapper",
3474
- __asyncLoader: load,
3475
- get __asyncResolved() {
3476
- return resolvedComp;
3477
- },
3478
- setup() {
3479
- const instance = currentInstance;
3480
- if (resolvedComp) {
3481
- return () => createInnerComp(resolvedComp, instance);
3482
- }
3483
- const onError = (err) => {
3484
- pendingRequest = null;
3485
- handleError(
3486
- err,
3487
- instance,
3488
- 13,
3489
- !errorComponent
3490
- );
3491
- };
3492
- if (suspensible && instance.suspense || isInSSRComponentSetup) {
3493
- return load().then((comp) => {
3494
- return () => createInnerComp(comp, instance);
3495
- }).catch((err) => {
3496
- onError(err);
3497
- return () => errorComponent ? createVNode(errorComponent, {
3498
- error: err
3499
- }) : null;
3500
- });
3501
- }
3502
- const loaded = ref(false);
3503
- const error = ref();
3504
- const delayed = ref(!!delay);
3505
- if (delay) {
3506
- setTimeout(() => {
3507
- delayed.value = false;
3508
- }, delay);
3509
- }
3510
- if (timeout != null) {
3511
- setTimeout(() => {
3512
- if (!loaded.value && !error.value) {
3513
- const err = new Error(
3514
- `Async component timed out after ${timeout}ms.`
3515
- );
3516
- onError(err);
3517
- error.value = err;
3518
- }
3519
- }, timeout);
3520
- }
3521
- load().then(() => {
3522
- loaded.value = true;
3523
- if (instance.parent && isKeepAlive(instance.parent.vnode)) {
3524
- instance.parent.effect.dirty = true;
3525
- queueJob(instance.parent.update);
3526
- }
3527
- }).catch((err) => {
3528
- onError(err);
3529
- error.value = err;
3530
- });
3531
- return () => {
3532
- if (loaded.value && resolvedComp) {
3533
- return createInnerComp(resolvedComp, instance);
3534
- } else if (error.value && errorComponent) {
3535
- return createVNode(errorComponent, {
3536
- error: error.value
3537
- });
3538
- } else if (loadingComponent && !delayed.value) {
3539
- return createVNode(loadingComponent);
3540
- }
3541
- };
3542
- }
3543
- });
3544
- }
3545
- function createInnerComp(comp, parent) {
3546
- const { ref: ref2, props, children, ce } = parent.vnode;
3547
- const vnode = createVNode(comp, props, children);
3548
- vnode.ref = ref2;
3549
- vnode.ce = ce;
3550
- delete parent.vnode.ce;
3551
- return vnode;
3552
- }
3553
-
3554
3241
  function renderSlot(slots, name, props = {}, fallback, noSlotted) {
3555
3242
  if (currentRenderingInstance.isCE || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.isCE) {
3556
3243
  if (name !== "default") props.name = name;
@@ -3565,9 +3252,10 @@ function renderSlot(slots, name, props = {}, fallback, noSlotted) {
3565
3252
  const rendered = createBlock(
3566
3253
  Fragment,
3567
3254
  {
3568
- key: props.key || // slot content array of a dynamic conditional slot may have a branch
3255
+ key: (props.key || // slot content array of a dynamic conditional slot may have a branch
3569
3256
  // key attached in the `createSlots` helper, respect that
3570
- validSlotContent && validSlotContent.key || `_${name}`
3257
+ validSlotContent && validSlotContent.key || `_${name}`) + // #7256 force differentiate fallback content from actual content
3258
+ (!validSlotContent && fallback ? "_fb" : "")
3571
3259
  },
3572
3260
  validSlotContent || (fallback ? fallback() : []),
3573
3261
  validSlotContent && slots._ === 1 ? 64 : -2
@@ -4463,7 +4151,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
4463
4151
  return vm;
4464
4152
  }
4465
4153
  }
4466
- Vue.version = `2.6.14-compat:${"3.4.30"}`;
4154
+ Vue.version = `2.6.14-compat:${"3.4.32"}`;
4467
4155
  Vue.config = singletonApp.config;
4468
4156
  Vue.use = (plugin, ...options) => {
4469
4157
  if (plugin && isFunction(plugin.install)) {
@@ -5202,8 +4890,9 @@ function resolvePropValue(options, props, key, value, instance, isAbsent) {
5202
4890
  }
5203
4891
  return value;
5204
4892
  }
4893
+ const mixinPropsCache = /* @__PURE__ */ new WeakMap();
5205
4894
  function normalizePropsOptions(comp, appContext, asMixin = false) {
5206
- const cache = appContext.propsCache;
4895
+ const cache = asMixin ? mixinPropsCache : appContext.propsCache;
5207
4896
  const cached = cache.get(comp);
5208
4897
  if (cached) {
5209
4898
  return cached;
@@ -5329,13 +5018,22 @@ const normalizeVNodeSlots = (instance, children) => {
5329
5018
  const normalized = normalizeSlotValue(children);
5330
5019
  instance.slots.default = () => normalized;
5331
5020
  };
5332
- const initSlots = (instance, children) => {
5021
+ const assignSlots = (slots, children, optimized) => {
5022
+ for (const key in children) {
5023
+ if (optimized || key !== "_") {
5024
+ slots[key] = children[key];
5025
+ }
5026
+ }
5027
+ };
5028
+ const initSlots = (instance, children, optimized) => {
5333
5029
  const slots = instance.slots = createInternalObject();
5334
5030
  if (instance.vnode.shapeFlag & 32) {
5335
5031
  const type = children._;
5336
5032
  if (type) {
5337
- extend(slots, children);
5338
- def(slots, "_", type, true);
5033
+ assignSlots(slots, children, optimized);
5034
+ if (optimized) {
5035
+ def(slots, "_", type, true);
5036
+ }
5339
5037
  } else {
5340
5038
  normalizeObjectSlots(children, slots);
5341
5039
  }
@@ -5353,10 +5051,7 @@ const updateSlots = (instance, children, optimized) => {
5353
5051
  if (optimized && type === 1) {
5354
5052
  needDeletionCheck = false;
5355
5053
  } else {
5356
- extend(slots, children);
5357
- if (!optimized && type === 1) {
5358
- delete slots._;
5359
- }
5054
+ assignSlots(slots, children, optimized);
5360
5055
  }
5361
5056
  } else {
5362
5057
  needDeletionCheck = !children.$stable;
@@ -5404,53 +5099,317 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
5404
5099
  if (hasOwn(setupState, oldRef)) {
5405
5100
  setupState[oldRef] = null;
5406
5101
  }
5407
- } else if (isRef(oldRef)) {
5408
- oldRef.value = null;
5102
+ } else if (isRef(oldRef)) {
5103
+ oldRef.value = null;
5104
+ }
5105
+ }
5106
+ if (isFunction(ref)) {
5107
+ callWithErrorHandling(ref, owner, 12, [value, refs]);
5108
+ } else {
5109
+ const _isString = isString(ref);
5110
+ const _isRef = isRef(ref);
5111
+ if (_isString || _isRef) {
5112
+ const doSet = () => {
5113
+ if (rawRef.f) {
5114
+ const existing = _isString ? hasOwn(setupState, ref) ? setupState[ref] : refs[ref] : ref.value;
5115
+ if (isUnmount) {
5116
+ isArray(existing) && remove(existing, refValue);
5117
+ } else {
5118
+ if (!isArray(existing)) {
5119
+ if (_isString) {
5120
+ refs[ref] = [refValue];
5121
+ if (hasOwn(setupState, ref)) {
5122
+ setupState[ref] = refs[ref];
5123
+ }
5124
+ } else {
5125
+ ref.value = [refValue];
5126
+ if (rawRef.k) refs[rawRef.k] = ref.value;
5127
+ }
5128
+ } else if (!existing.includes(refValue)) {
5129
+ existing.push(refValue);
5130
+ }
5131
+ }
5132
+ } else if (_isString) {
5133
+ refs[ref] = value;
5134
+ if (hasOwn(setupState, ref)) {
5135
+ setupState[ref] = value;
5136
+ }
5137
+ } else if (_isRef) {
5138
+ ref.value = value;
5139
+ if (rawRef.k) refs[rawRef.k] = value;
5140
+ } else ;
5141
+ };
5142
+ if (value) {
5143
+ doSet.id = -1;
5144
+ queuePostRenderEffect(doSet, parentSuspense);
5145
+ } else {
5146
+ doSet();
5147
+ }
5148
+ }
5149
+ }
5150
+ }
5151
+
5152
+ const TeleportEndKey = Symbol("_vte");
5153
+ const isTeleport = (type) => type.__isTeleport;
5154
+ const isTeleportDisabled = (props) => props && (props.disabled || props.disabled === "");
5155
+ const isTargetSVG = (target) => typeof SVGElement !== "undefined" && target instanceof SVGElement;
5156
+ const isTargetMathML = (target) => typeof MathMLElement === "function" && target instanceof MathMLElement;
5157
+ const resolveTarget = (props, select) => {
5158
+ const targetSelector = props && props.to;
5159
+ if (isString(targetSelector)) {
5160
+ if (!select) {
5161
+ return null;
5162
+ } else {
5163
+ const target = select(targetSelector);
5164
+ return target;
5165
+ }
5166
+ } else {
5167
+ return targetSelector;
5168
+ }
5169
+ };
5170
+ const TeleportImpl = {
5171
+ name: "Teleport",
5172
+ __isTeleport: true,
5173
+ process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, internals) {
5174
+ const {
5175
+ mc: mountChildren,
5176
+ pc: patchChildren,
5177
+ pbc: patchBlockChildren,
5178
+ o: { insert, querySelector, createText, createComment }
5179
+ } = internals;
5180
+ const disabled = isTeleportDisabled(n2.props);
5181
+ let { shapeFlag, children, dynamicChildren } = n2;
5182
+ if (n1 == null) {
5183
+ const placeholder = n2.el = createText("");
5184
+ const mainAnchor = n2.anchor = createText("");
5185
+ const target = n2.target = resolveTarget(n2.props, querySelector);
5186
+ const targetStart = n2.targetStart = createText("");
5187
+ const targetAnchor = n2.targetAnchor = createText("");
5188
+ insert(placeholder, container, anchor);
5189
+ insert(mainAnchor, container, anchor);
5190
+ targetStart[TeleportEndKey] = targetAnchor;
5191
+ if (target) {
5192
+ insert(targetStart, target);
5193
+ insert(targetAnchor, target);
5194
+ if (namespace === "svg" || isTargetSVG(target)) {
5195
+ namespace = "svg";
5196
+ } else if (namespace === "mathml" || isTargetMathML(target)) {
5197
+ namespace = "mathml";
5198
+ }
5199
+ }
5200
+ const mount = (container2, anchor2) => {
5201
+ if (shapeFlag & 16) {
5202
+ mountChildren(
5203
+ children,
5204
+ container2,
5205
+ anchor2,
5206
+ parentComponent,
5207
+ parentSuspense,
5208
+ namespace,
5209
+ slotScopeIds,
5210
+ optimized
5211
+ );
5212
+ }
5213
+ };
5214
+ if (disabled) {
5215
+ mount(container, mainAnchor);
5216
+ } else if (target) {
5217
+ mount(target, targetAnchor);
5218
+ }
5219
+ } else {
5220
+ n2.el = n1.el;
5221
+ n2.targetStart = n1.targetStart;
5222
+ const mainAnchor = n2.anchor = n1.anchor;
5223
+ const target = n2.target = n1.target;
5224
+ const targetAnchor = n2.targetAnchor = n1.targetAnchor;
5225
+ const wasDisabled = isTeleportDisabled(n1.props);
5226
+ const currentContainer = wasDisabled ? container : target;
5227
+ const currentAnchor = wasDisabled ? mainAnchor : targetAnchor;
5228
+ if (namespace === "svg" || isTargetSVG(target)) {
5229
+ namespace = "svg";
5230
+ } else if (namespace === "mathml" || isTargetMathML(target)) {
5231
+ namespace = "mathml";
5232
+ }
5233
+ if (dynamicChildren) {
5234
+ patchBlockChildren(
5235
+ n1.dynamicChildren,
5236
+ dynamicChildren,
5237
+ currentContainer,
5238
+ parentComponent,
5239
+ parentSuspense,
5240
+ namespace,
5241
+ slotScopeIds
5242
+ );
5243
+ traverseStaticChildren(n1, n2, true);
5244
+ } else if (!optimized) {
5245
+ patchChildren(
5246
+ n1,
5247
+ n2,
5248
+ currentContainer,
5249
+ currentAnchor,
5250
+ parentComponent,
5251
+ parentSuspense,
5252
+ namespace,
5253
+ slotScopeIds,
5254
+ false
5255
+ );
5256
+ }
5257
+ if (disabled) {
5258
+ if (!wasDisabled) {
5259
+ moveTeleport(
5260
+ n2,
5261
+ container,
5262
+ mainAnchor,
5263
+ internals,
5264
+ 1
5265
+ );
5266
+ } else {
5267
+ if (n2.props && n1.props && n2.props.to !== n1.props.to) {
5268
+ n2.props.to = n1.props.to;
5269
+ }
5270
+ }
5271
+ } else {
5272
+ if ((n2.props && n2.props.to) !== (n1.props && n1.props.to)) {
5273
+ const nextTarget = n2.target = resolveTarget(
5274
+ n2.props,
5275
+ querySelector
5276
+ );
5277
+ if (nextTarget) {
5278
+ moveTeleport(
5279
+ n2,
5280
+ nextTarget,
5281
+ null,
5282
+ internals,
5283
+ 0
5284
+ );
5285
+ }
5286
+ } else if (wasDisabled) {
5287
+ moveTeleport(
5288
+ n2,
5289
+ target,
5290
+ targetAnchor,
5291
+ internals,
5292
+ 1
5293
+ );
5294
+ }
5295
+ }
5296
+ }
5297
+ updateCssVars(n2);
5298
+ },
5299
+ remove(vnode, parentComponent, parentSuspense, { um: unmount, o: { remove: hostRemove } }, doRemove) {
5300
+ const {
5301
+ shapeFlag,
5302
+ children,
5303
+ anchor,
5304
+ targetStart,
5305
+ targetAnchor,
5306
+ target,
5307
+ props
5308
+ } = vnode;
5309
+ if (target) {
5310
+ hostRemove(targetStart);
5311
+ hostRemove(targetAnchor);
5312
+ }
5313
+ doRemove && hostRemove(anchor);
5314
+ if (shapeFlag & 16) {
5315
+ const shouldRemove = doRemove || !isTeleportDisabled(props);
5316
+ for (let i = 0; i < children.length; i++) {
5317
+ const child = children[i];
5318
+ unmount(
5319
+ child,
5320
+ parentComponent,
5321
+ parentSuspense,
5322
+ shouldRemove,
5323
+ !!child.dynamicChildren
5324
+ );
5325
+ }
5326
+ }
5327
+ },
5328
+ move: moveTeleport,
5329
+ hydrate: hydrateTeleport
5330
+ };
5331
+ function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }, moveType = 2) {
5332
+ if (moveType === 0) {
5333
+ insert(vnode.targetAnchor, container, parentAnchor);
5334
+ }
5335
+ const { el, anchor, shapeFlag, children, props } = vnode;
5336
+ const isReorder = moveType === 2;
5337
+ if (isReorder) {
5338
+ insert(el, container, parentAnchor);
5339
+ }
5340
+ if (!isReorder || isTeleportDisabled(props)) {
5341
+ if (shapeFlag & 16) {
5342
+ for (let i = 0; i < children.length; i++) {
5343
+ move(
5344
+ children[i],
5345
+ container,
5346
+ parentAnchor,
5347
+ 2
5348
+ );
5349
+ }
5350
+ }
5351
+ }
5352
+ if (isReorder) {
5353
+ insert(anchor, container, parentAnchor);
5354
+ }
5355
+ }
5356
+ function hydrateTeleport(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized, {
5357
+ o: { nextSibling, parentNode, querySelector }
5358
+ }, hydrateChildren) {
5359
+ const target = vnode.target = resolveTarget(
5360
+ vnode.props,
5361
+ querySelector
5362
+ );
5363
+ if (target) {
5364
+ const targetNode = target._lpa || target.firstChild;
5365
+ if (vnode.shapeFlag & 16) {
5366
+ if (isTeleportDisabled(vnode.props)) {
5367
+ vnode.anchor = hydrateChildren(
5368
+ nextSibling(node),
5369
+ vnode,
5370
+ parentNode(node),
5371
+ parentComponent,
5372
+ parentSuspense,
5373
+ slotScopeIds,
5374
+ optimized
5375
+ );
5376
+ vnode.targetAnchor = targetNode;
5377
+ } else {
5378
+ vnode.anchor = nextSibling(node);
5379
+ let targetAnchor = targetNode;
5380
+ while (targetAnchor) {
5381
+ targetAnchor = nextSibling(targetAnchor);
5382
+ if (targetAnchor && targetAnchor.nodeType === 8 && targetAnchor.data === "teleport anchor") {
5383
+ vnode.targetAnchor = targetAnchor;
5384
+ target._lpa = vnode.targetAnchor && nextSibling(vnode.targetAnchor);
5385
+ break;
5386
+ }
5387
+ }
5388
+ hydrateChildren(
5389
+ targetNode,
5390
+ vnode,
5391
+ target,
5392
+ parentComponent,
5393
+ parentSuspense,
5394
+ slotScopeIds,
5395
+ optimized
5396
+ );
5397
+ }
5409
5398
  }
5399
+ updateCssVars(vnode);
5410
5400
  }
5411
- if (isFunction(ref)) {
5412
- callWithErrorHandling(ref, owner, 12, [value, refs]);
5413
- } else {
5414
- const _isString = isString(ref);
5415
- const _isRef = isRef(ref);
5416
- if (_isString || _isRef) {
5417
- const doSet = () => {
5418
- if (rawRef.f) {
5419
- const existing = _isString ? hasOwn(setupState, ref) ? setupState[ref] : refs[ref] : ref.value;
5420
- if (isUnmount) {
5421
- isArray(existing) && remove(existing, refValue);
5422
- } else {
5423
- if (!isArray(existing)) {
5424
- if (_isString) {
5425
- refs[ref] = [refValue];
5426
- if (hasOwn(setupState, ref)) {
5427
- setupState[ref] = refs[ref];
5428
- }
5429
- } else {
5430
- ref.value = [refValue];
5431
- if (rawRef.k) refs[rawRef.k] = ref.value;
5432
- }
5433
- } else if (!existing.includes(refValue)) {
5434
- existing.push(refValue);
5435
- }
5436
- }
5437
- } else if (_isString) {
5438
- refs[ref] = value;
5439
- if (hasOwn(setupState, ref)) {
5440
- setupState[ref] = value;
5441
- }
5442
- } else if (_isRef) {
5443
- ref.value = value;
5444
- if (rawRef.k) refs[rawRef.k] = value;
5445
- } else ;
5446
- };
5447
- if (value) {
5448
- doSet.id = -1;
5449
- queuePostRenderEffect(doSet, parentSuspense);
5450
- } else {
5451
- doSet();
5452
- }
5401
+ return vnode.anchor && nextSibling(vnode.anchor);
5402
+ }
5403
+ const Teleport = TeleportImpl;
5404
+ function updateCssVars(vnode) {
5405
+ const ctx = vnode.ctx;
5406
+ if (ctx && ctx.ut) {
5407
+ let node = vnode.children[0].el;
5408
+ while (node && node !== vnode.targetAnchor) {
5409
+ if (node.nodeType === 1) node.setAttribute("data-v-owner", ctx.uid);
5410
+ node = node.nextSibling;
5453
5411
  }
5412
+ ctx.ut();
5454
5413
  }
5455
5414
  }
5456
5415
 
@@ -5704,15 +5663,7 @@ function createHydrationFunctions(rendererInternals) {
5704
5663
  for (const key in props) {
5705
5664
  if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || // force hydrate v-bind with .prop modifiers
5706
5665
  key[0] === ".") {
5707
- patchProp(
5708
- el,
5709
- key,
5710
- null,
5711
- props[key],
5712
- void 0,
5713
- void 0,
5714
- parentComponent
5715
- );
5666
+ patchProp(el, key, null, props[key], void 0, parentComponent);
5716
5667
  }
5717
5668
  }
5718
5669
  } else if (props.onClick) {
@@ -5722,9 +5673,10 @@ function createHydrationFunctions(rendererInternals) {
5722
5673
  null,
5723
5674
  props.onClick,
5724
5675
  void 0,
5725
- void 0,
5726
5676
  parentComponent
5727
5677
  );
5678
+ } else if (patchFlag & 4 && isReactive(props.style)) {
5679
+ for (const key in props.style) props.style[key];
5728
5680
  }
5729
5681
  }
5730
5682
  let vnodeHooks;
@@ -5750,7 +5702,21 @@ function createHydrationFunctions(rendererInternals) {
5750
5702
  const l = children.length;
5751
5703
  for (let i = 0; i < l; i++) {
5752
5704
  const vnode = optimized ? children[i] : children[i] = normalizeVNode(children[i]);
5705
+ const isText = vnode.type === Text;
5753
5706
  if (node) {
5707
+ if (isText && !optimized) {
5708
+ let next = children[i + 1];
5709
+ if (next && (next = normalizeVNode(next)).type === Text) {
5710
+ insert(
5711
+ createText(
5712
+ node.data.slice(vnode.children.length)
5713
+ ),
5714
+ container,
5715
+ nextSibling(node)
5716
+ );
5717
+ node.data = vnode.children;
5718
+ }
5719
+ }
5754
5720
  node = hydrateNode(
5755
5721
  node,
5756
5722
  vnode,
@@ -5759,7 +5725,7 @@ function createHydrationFunctions(rendererInternals) {
5759
5725
  slotScopeIds,
5760
5726
  optimized
5761
5727
  );
5762
- } else if (vnode.type === Text && !vnode.children) {
5728
+ } else if (isText && !vnode.children) {
5763
5729
  insert(vnode.el = createText(""), container);
5764
5730
  } else {
5765
5731
  logMismatchError();
@@ -6098,17 +6064,7 @@ function baseCreateRenderer(options, createHydrationFns) {
6098
6064
  if (props) {
6099
6065
  for (const key in props) {
6100
6066
  if (key !== "value" && !isReservedProp(key)) {
6101
- hostPatchProp(
6102
- el,
6103
- key,
6104
- null,
6105
- props[key],
6106
- namespace,
6107
- vnode.children,
6108
- parentComponent,
6109
- parentSuspense,
6110
- unmountChildren
6111
- );
6067
+ hostPatchProp(el, key, null, props[key], namespace, parentComponent);
6112
6068
  }
6113
6069
  }
6114
6070
  if ("value" in props) {
@@ -6188,6 +6144,9 @@ function baseCreateRenderer(options, createHydrationFns) {
6188
6144
  invokeDirectiveHook(n2, n1, parentComponent, "beforeUpdate");
6189
6145
  }
6190
6146
  parentComponent && toggleRecurse(parentComponent, true);
6147
+ if (oldProps.innerHTML && newProps.innerHTML == null || oldProps.textContent && newProps.textContent == null) {
6148
+ hostSetElementText(el, "");
6149
+ }
6191
6150
  if (dynamicChildren) {
6192
6151
  patchBlockChildren(
6193
6152
  n1.dynamicChildren,
@@ -6213,15 +6172,7 @@ function baseCreateRenderer(options, createHydrationFns) {
6213
6172
  }
6214
6173
  if (patchFlag > 0) {
6215
6174
  if (patchFlag & 16) {
6216
- patchProps(
6217
- el,
6218
- n2,
6219
- oldProps,
6220
- newProps,
6221
- parentComponent,
6222
- parentSuspense,
6223
- namespace
6224
- );
6175
+ patchProps(el, oldProps, newProps, parentComponent, namespace);
6225
6176
  } else {
6226
6177
  if (patchFlag & 2) {
6227
6178
  if (oldProps.class !== newProps.class) {
@@ -6238,17 +6189,7 @@ function baseCreateRenderer(options, createHydrationFns) {
6238
6189
  const prev = oldProps[key];
6239
6190
  const next = newProps[key];
6240
6191
  if (next !== prev || key === "value") {
6241
- hostPatchProp(
6242
- el,
6243
- key,
6244
- prev,
6245
- next,
6246
- namespace,
6247
- n1.children,
6248
- parentComponent,
6249
- parentSuspense,
6250
- unmountChildren
6251
- );
6192
+ hostPatchProp(el, key, prev, next, namespace, parentComponent);
6252
6193
  }
6253
6194
  }
6254
6195
  }
@@ -6259,15 +6200,7 @@ function baseCreateRenderer(options, createHydrationFns) {
6259
6200
  }
6260
6201
  }
6261
6202
  } else if (!optimized && dynamicChildren == null) {
6262
- patchProps(
6263
- el,
6264
- n2,
6265
- oldProps,
6266
- newProps,
6267
- parentComponent,
6268
- parentSuspense,
6269
- namespace
6270
- );
6203
+ patchProps(el, oldProps, newProps, parentComponent, namespace);
6271
6204
  }
6272
6205
  if ((vnodeHook = newProps.onVnodeUpdated) || dirs) {
6273
6206
  queuePostRenderEffect(() => {
@@ -6307,7 +6240,7 @@ function baseCreateRenderer(options, createHydrationFns) {
6307
6240
  );
6308
6241
  }
6309
6242
  };
6310
- const patchProps = (el, vnode, oldProps, newProps, parentComponent, parentSuspense, namespace) => {
6243
+ const patchProps = (el, oldProps, newProps, parentComponent, namespace) => {
6311
6244
  if (oldProps !== newProps) {
6312
6245
  if (oldProps !== EMPTY_OBJ) {
6313
6246
  for (const key in oldProps) {
@@ -6318,10 +6251,7 @@ function baseCreateRenderer(options, createHydrationFns) {
6318
6251
  oldProps[key],
6319
6252
  null,
6320
6253
  namespace,
6321
- vnode.children,
6322
- parentComponent,
6323
- parentSuspense,
6324
- unmountChildren
6254
+ parentComponent
6325
6255
  );
6326
6256
  }
6327
6257
  }
@@ -6331,17 +6261,7 @@ function baseCreateRenderer(options, createHydrationFns) {
6331
6261
  const next = newProps[key];
6332
6262
  const prev = oldProps[key];
6333
6263
  if (next !== prev && key !== "value") {
6334
- hostPatchProp(
6335
- el,
6336
- key,
6337
- prev,
6338
- next,
6339
- namespace,
6340
- vnode.children,
6341
- parentComponent,
6342
- parentSuspense,
6343
- unmountChildren
6344
- );
6264
+ hostPatchProp(el, key, prev, next, namespace, parentComponent);
6345
6265
  }
6346
6266
  }
6347
6267
  if ("value" in newProps) {
@@ -6452,7 +6372,7 @@ function baseCreateRenderer(options, createHydrationFns) {
6452
6372
  instance.ctx.renderer = internals;
6453
6373
  }
6454
6374
  if (!compatMountInstance) {
6455
- setupComponent(instance);
6375
+ setupComponent(instance, false, optimized);
6456
6376
  }
6457
6377
  if (instance.asyncDep) {
6458
6378
  parentSuspense && parentSuspense.registerDep(instance, setupRenderEffect, optimized);
@@ -6652,6 +6572,7 @@ function baseCreateRenderer(options, createHydrationFns) {
6652
6572
  effect.run();
6653
6573
  }
6654
6574
  };
6575
+ update.i = instance;
6655
6576
  update.id = instance.uid;
6656
6577
  toggleRecurse(instance, true);
6657
6578
  update();
@@ -7004,7 +6925,7 @@ function baseCreateRenderer(options, createHydrationFns) {
7004
6925
  shapeFlag,
7005
6926
  patchFlag,
7006
6927
  dirs,
7007
- memoIndex
6928
+ cacheIndex
7008
6929
  } = vnode;
7009
6930
  if (patchFlag === -2) {
7010
6931
  optimized = false;
@@ -7012,8 +6933,8 @@ function baseCreateRenderer(options, createHydrationFns) {
7012
6933
  if (ref != null) {
7013
6934
  setRef(ref, null, parentSuspense, vnode, true);
7014
6935
  }
7015
- if (memoIndex != null) {
7016
- parentComponent.renderCache[memoIndex] = void 0;
6936
+ if (cacheIndex != null) {
6937
+ parentComponent.renderCache[cacheIndex] = void 0;
7017
6938
  }
7018
6939
  if (shapeFlag & 256) {
7019
6940
  parentComponent.ctx.deactivate(vnode);
@@ -7043,7 +6964,12 @@ function baseCreateRenderer(options, createHydrationFns) {
7043
6964
  internals,
7044
6965
  doRemove
7045
6966
  );
7046
- } else if (dynamicChildren && // #1153: fast path should not be taken for non-stable (v-for) fragments
6967
+ } else if (dynamicChildren && // #5154
6968
+ // when v-once is used inside a block, setBlockTracking(-1) marks the
6969
+ // parent block with hasOnce: true
6970
+ // so that it doesn't take the fast path during unmount - otherwise
6971
+ // components nested in v-once are never unmounted.
6972
+ !dynamicChildren.hasOnce && // #1153: fast path should not be taken for non-stable (v-for) fragments
7047
6973
  (type !== Fragment || patchFlag > 0 && patchFlag & 64)) {
7048
6974
  unmountChildren(
7049
6975
  dynamicChildren,
@@ -7151,7 +7077,9 @@ function baseCreateRenderer(options, createHydrationFns) {
7151
7077
  if (vnode.shapeFlag & 128) {
7152
7078
  return vnode.suspense.next();
7153
7079
  }
7154
- return hostNextSibling(vnode.anchor || vnode.el);
7080
+ const el = hostNextSibling(vnode.anchor || vnode.el);
7081
+ const teleportEnd = el && el[TeleportEndKey];
7082
+ return teleportEnd ? hostNextSibling(teleportEnd) : el;
7155
7083
  };
7156
7084
  let isFlushing = false;
7157
7085
  const render = (vnode, container, namespace) => {
@@ -7535,833 +7463,953 @@ function traverse(value, depth = Infinity, seen) {
7535
7463
  return value;
7536
7464
  }
7537
7465
 
7538
- const isKeepAlive = (vnode) => vnode.type.__isKeepAlive;
7539
- const KeepAliveImpl = {
7540
- name: `KeepAlive`,
7541
- // Marker for special handling inside the renderer. We are not using a ===
7542
- // check directly on KeepAlive in the renderer, because importing it directly
7543
- // would prevent it from being tree-shaken.
7544
- __isKeepAlive: true,
7545
- props: {
7546
- include: [String, RegExp, Array],
7547
- exclude: [String, RegExp, Array],
7548
- max: [String, Number]
7549
- },
7550
- setup(props, { slots }) {
7551
- const instance = getCurrentInstance();
7552
- const sharedContext = instance.ctx;
7553
- if (!sharedContext.renderer) {
7554
- return () => {
7555
- const children = slots.default && slots.default();
7556
- return children && children.length === 1 ? children[0] : children;
7557
- };
7558
- }
7559
- const cache = /* @__PURE__ */ new Map();
7560
- const keys = /* @__PURE__ */ new Set();
7561
- let current = null;
7562
- const parentSuspense = instance.suspense;
7563
- const {
7564
- renderer: {
7565
- p: patch,
7566
- m: move,
7567
- um: _unmount,
7568
- o: { createElement }
7569
- }
7570
- } = sharedContext;
7571
- const storageContainer = createElement("div");
7572
- sharedContext.activate = (vnode, container, anchor, namespace, optimized) => {
7573
- const instance2 = vnode.component;
7574
- move(vnode, container, anchor, 0, parentSuspense);
7575
- patch(
7576
- instance2.vnode,
7577
- vnode,
7578
- container,
7579
- anchor,
7580
- instance2,
7581
- parentSuspense,
7582
- namespace,
7583
- vnode.slotScopeIds,
7584
- optimized
7585
- );
7586
- queuePostRenderEffect(() => {
7587
- instance2.isDeactivated = false;
7588
- if (instance2.a) {
7589
- invokeArrayFns(instance2.a);
7590
- }
7591
- const vnodeHook = vnode.props && vnode.props.onVnodeMounted;
7592
- if (vnodeHook) {
7593
- invokeVNodeHook(vnodeHook, instance2.parent, vnode);
7594
- }
7595
- }, parentSuspense);
7596
- };
7597
- sharedContext.deactivate = (vnode) => {
7598
- const instance2 = vnode.component;
7599
- invalidateMount(instance2.m);
7600
- invalidateMount(instance2.a);
7601
- move(vnode, storageContainer, null, 1, parentSuspense);
7602
- queuePostRenderEffect(() => {
7603
- if (instance2.da) {
7604
- invokeArrayFns(instance2.da);
7605
- }
7606
- const vnodeHook = vnode.props && vnode.props.onVnodeUnmounted;
7607
- if (vnodeHook) {
7608
- invokeVNodeHook(vnodeHook, instance2.parent, vnode);
7609
- }
7610
- instance2.isDeactivated = true;
7611
- }, parentSuspense);
7612
- };
7613
- function unmount(vnode) {
7614
- resetShapeFlag(vnode);
7615
- _unmount(vnode, instance, parentSuspense, true);
7616
- }
7617
- function pruneCache(filter) {
7618
- cache.forEach((vnode, key) => {
7619
- const name = getComponentName(vnode.type);
7620
- if (name && (!filter || !filter(name))) {
7621
- pruneCacheEntry(key);
7622
- }
7623
- });
7624
- }
7625
- function pruneCacheEntry(key) {
7626
- const cached = cache.get(key);
7627
- if (!current || !isSameVNodeType(cached, current)) {
7628
- unmount(cached);
7629
- } else if (current) {
7630
- resetShapeFlag(current);
7466
+ function useModel(props, name, options = EMPTY_OBJ) {
7467
+ const i = getCurrentInstance();
7468
+ const camelizedName = camelize(name);
7469
+ const hyphenatedName = hyphenate(name);
7470
+ const modifiers = getModelModifiers(props, name);
7471
+ const res = customRef((track, trigger) => {
7472
+ let localValue;
7473
+ let prevSetValue;
7474
+ let prevEmittedValue;
7475
+ watchSyncEffect(() => {
7476
+ const propValue = props[name];
7477
+ if (hasChanged(localValue, propValue)) {
7478
+ localValue = propValue;
7479
+ trigger();
7631
7480
  }
7632
- cache.delete(key);
7633
- keys.delete(key);
7634
- }
7635
- watch(
7636
- () => [props.include, props.exclude],
7637
- ([include, exclude]) => {
7638
- include && pruneCache((name) => matches(include, name));
7639
- exclude && pruneCache((name) => !matches(exclude, name));
7481
+ });
7482
+ return {
7483
+ get() {
7484
+ track();
7485
+ return options.get ? options.get(localValue) : localValue;
7640
7486
  },
7641
- // prune post-render after `current` has been updated
7642
- { flush: "post", deep: true }
7643
- );
7644
- let pendingCacheKey = null;
7645
- const cacheSubtree = () => {
7646
- if (pendingCacheKey != null) {
7647
- if (isSuspense(instance.subTree.type)) {
7648
- queuePostRenderEffect(() => {
7649
- cache.set(pendingCacheKey, getInnerChild(instance.subTree));
7650
- }, instance.subTree.suspense);
7651
- } else {
7652
- cache.set(pendingCacheKey, getInnerChild(instance.subTree));
7487
+ set(value) {
7488
+ if (!hasChanged(value, localValue)) {
7489
+ return;
7490
+ }
7491
+ const rawProps = i.vnode.props;
7492
+ if (!(rawProps && // check if parent has passed v-model
7493
+ (name in rawProps || camelizedName in rawProps || hyphenatedName in rawProps) && (`onUpdate:${name}` in rawProps || `onUpdate:${camelizedName}` in rawProps || `onUpdate:${hyphenatedName}` in rawProps))) {
7494
+ localValue = value;
7495
+ trigger();
7496
+ }
7497
+ const emittedValue = options.set ? options.set(value) : value;
7498
+ i.emit(`update:${name}`, emittedValue);
7499
+ if (value !== emittedValue && value !== prevSetValue && emittedValue === prevEmittedValue) {
7500
+ trigger();
7653
7501
  }
7502
+ prevSetValue = value;
7503
+ prevEmittedValue = emittedValue;
7654
7504
  }
7655
7505
  };
7656
- onMounted(cacheSubtree);
7657
- onUpdated(cacheSubtree);
7658
- onBeforeUnmount(() => {
7659
- cache.forEach((cached) => {
7660
- const { subTree, suspense } = instance;
7661
- const vnode = getInnerChild(subTree);
7662
- if (cached.type === vnode.type && cached.key === vnode.key) {
7663
- resetShapeFlag(vnode);
7664
- const da = vnode.component.da;
7665
- da && queuePostRenderEffect(da, suspense);
7666
- return;
7506
+ });
7507
+ res[Symbol.iterator] = () => {
7508
+ let i2 = 0;
7509
+ return {
7510
+ next() {
7511
+ if (i2 < 2) {
7512
+ return { value: i2++ ? modifiers || EMPTY_OBJ : res, done: false };
7513
+ } else {
7514
+ return { done: true };
7667
7515
  }
7668
- unmount(cached);
7669
- });
7670
- });
7671
- return () => {
7672
- pendingCacheKey = null;
7673
- if (!slots.default) {
7674
- return null;
7675
- }
7676
- const children = slots.default();
7677
- const rawVNode = children[0];
7678
- if (children.length > 1) {
7679
- current = null;
7680
- return children;
7681
- } else if (!isVNode(rawVNode) || !(rawVNode.shapeFlag & 4) && !(rawVNode.shapeFlag & 128)) {
7682
- current = null;
7683
- return rawVNode;
7684
- }
7685
- let vnode = getInnerChild(rawVNode);
7686
- const comp = vnode.type;
7687
- const name = getComponentName(
7688
- isAsyncWrapper(vnode) ? vnode.type.__asyncResolved || {} : comp
7689
- );
7690
- const { include, exclude, max } = props;
7691
- if (include && (!name || !matches(include, name)) || exclude && name && matches(exclude, name)) {
7692
- current = vnode;
7693
- return rawVNode;
7694
7516
  }
7695
- const key = vnode.key == null ? comp : vnode.key;
7696
- const cachedVNode = cache.get(key);
7697
- if (vnode.el) {
7698
- vnode = cloneVNode(vnode);
7699
- if (rawVNode.shapeFlag & 128) {
7700
- rawVNode.ssContent = vnode;
7701
- }
7517
+ };
7518
+ };
7519
+ return res;
7520
+ }
7521
+ const getModelModifiers = (props, modelName) => {
7522
+ return modelName === "modelValue" || modelName === "model-value" ? props.modelModifiers : props[`${modelName}Modifiers`] || props[`${camelize(modelName)}Modifiers`] || props[`${hyphenate(modelName)}Modifiers`];
7523
+ };
7524
+
7525
+ function emit(instance, event, ...rawArgs) {
7526
+ if (instance.isUnmounted) return;
7527
+ const props = instance.vnode.props || EMPTY_OBJ;
7528
+ let args = rawArgs;
7529
+ const isModelListener = event.startsWith("update:");
7530
+ const modifiers = isModelListener && getModelModifiers(props, event.slice(7));
7531
+ if (modifiers) {
7532
+ if (modifiers.trim) {
7533
+ args = rawArgs.map((a) => isString(a) ? a.trim() : a);
7534
+ }
7535
+ if (modifiers.number) {
7536
+ args = rawArgs.map(looseToNumber);
7537
+ }
7538
+ }
7539
+ let handlerName;
7540
+ let handler = props[handlerName = toHandlerKey(event)] || // also try camelCase event handler (#2249)
7541
+ props[handlerName = toHandlerKey(camelize(event))];
7542
+ if (!handler && isModelListener) {
7543
+ handler = props[handlerName = toHandlerKey(hyphenate(event))];
7544
+ }
7545
+ if (handler) {
7546
+ callWithAsyncErrorHandling(
7547
+ handler,
7548
+ instance,
7549
+ 6,
7550
+ args
7551
+ );
7552
+ }
7553
+ const onceHandler = props[handlerName + `Once`];
7554
+ if (onceHandler) {
7555
+ if (!instance.emitted) {
7556
+ instance.emitted = {};
7557
+ } else if (instance.emitted[handlerName]) {
7558
+ return;
7559
+ }
7560
+ instance.emitted[handlerName] = true;
7561
+ callWithAsyncErrorHandling(
7562
+ onceHandler,
7563
+ instance,
7564
+ 6,
7565
+ args
7566
+ );
7567
+ }
7568
+ {
7569
+ compatModelEmit(instance, event, args);
7570
+ return emit$1(instance, event, args);
7571
+ }
7572
+ }
7573
+ function normalizeEmitsOptions(comp, appContext, asMixin = false) {
7574
+ const cache = appContext.emitsCache;
7575
+ const cached = cache.get(comp);
7576
+ if (cached !== void 0) {
7577
+ return cached;
7578
+ }
7579
+ const raw = comp.emits;
7580
+ let normalized = {};
7581
+ let hasExtends = false;
7582
+ if (!isFunction(comp)) {
7583
+ const extendEmits = (raw2) => {
7584
+ const normalizedFromExtend = normalizeEmitsOptions(raw2, appContext, true);
7585
+ if (normalizedFromExtend) {
7586
+ hasExtends = true;
7587
+ extend(normalized, normalizedFromExtend);
7702
7588
  }
7703
- pendingCacheKey = key;
7704
- if (cachedVNode) {
7705
- vnode.el = cachedVNode.el;
7706
- vnode.component = cachedVNode.component;
7707
- if (vnode.transition) {
7708
- setTransitionHooks(vnode, vnode.transition);
7589
+ };
7590
+ if (!asMixin && appContext.mixins.length) {
7591
+ appContext.mixins.forEach(extendEmits);
7592
+ }
7593
+ if (comp.extends) {
7594
+ extendEmits(comp.extends);
7595
+ }
7596
+ if (comp.mixins) {
7597
+ comp.mixins.forEach(extendEmits);
7598
+ }
7599
+ }
7600
+ if (!raw && !hasExtends) {
7601
+ if (isObject(comp)) {
7602
+ cache.set(comp, null);
7603
+ }
7604
+ return null;
7605
+ }
7606
+ if (isArray(raw)) {
7607
+ raw.forEach((key) => normalized[key] = null);
7608
+ } else {
7609
+ extend(normalized, raw);
7610
+ }
7611
+ if (isObject(comp)) {
7612
+ cache.set(comp, normalized);
7613
+ }
7614
+ return normalized;
7615
+ }
7616
+ function isEmitListener(options, key) {
7617
+ if (!options || !isOn(key)) {
7618
+ return false;
7619
+ }
7620
+ if (key.startsWith(compatModelEventPrefix)) {
7621
+ return true;
7622
+ }
7623
+ key = key.slice(2).replace(/Once$/, "");
7624
+ return hasOwn(options, key[0].toLowerCase() + key.slice(1)) || hasOwn(options, hyphenate(key)) || hasOwn(options, key);
7625
+ }
7626
+
7627
+ function markAttrsAccessed() {
7628
+ }
7629
+ function renderComponentRoot(instance) {
7630
+ const {
7631
+ type: Component,
7632
+ vnode,
7633
+ proxy,
7634
+ withProxy,
7635
+ propsOptions: [propsOptions],
7636
+ slots,
7637
+ attrs,
7638
+ emit,
7639
+ render,
7640
+ renderCache,
7641
+ props,
7642
+ data,
7643
+ setupState,
7644
+ ctx,
7645
+ inheritAttrs
7646
+ } = instance;
7647
+ const prev = setCurrentRenderingInstance(instance);
7648
+ let result;
7649
+ let fallthroughAttrs;
7650
+ try {
7651
+ if (vnode.shapeFlag & 4) {
7652
+ const proxyToUse = withProxy || proxy;
7653
+ const thisProxy = false ? new Proxy(proxyToUse, {
7654
+ get(target, key, receiver) {
7655
+ warn(
7656
+ `Property '${String(
7657
+ key
7658
+ )}' was accessed via 'this'. Avoid using 'this' in templates.`
7659
+ );
7660
+ return Reflect.get(target, key, receiver);
7709
7661
  }
7710
- vnode.shapeFlag |= 512;
7711
- keys.delete(key);
7712
- keys.add(key);
7713
- } else {
7714
- keys.add(key);
7715
- if (max && keys.size > parseInt(max, 10)) {
7716
- pruneCacheEntry(keys.values().next().value);
7662
+ }) : proxyToUse;
7663
+ result = normalizeVNode(
7664
+ render.call(
7665
+ thisProxy,
7666
+ proxyToUse,
7667
+ renderCache,
7668
+ false ? shallowReadonly(props) : props,
7669
+ setupState,
7670
+ data,
7671
+ ctx
7672
+ )
7673
+ );
7674
+ fallthroughAttrs = attrs;
7675
+ } else {
7676
+ const render2 = Component;
7677
+ if (false) ;
7678
+ result = normalizeVNode(
7679
+ render2.length > 1 ? render2(
7680
+ false ? shallowReadonly(props) : props,
7681
+ false ? {
7682
+ get attrs() {
7683
+ markAttrsAccessed();
7684
+ return shallowReadonly(attrs);
7685
+ },
7686
+ slots,
7687
+ emit
7688
+ } : { attrs, slots, emit }
7689
+ ) : render2(
7690
+ false ? shallowReadonly(props) : props,
7691
+ null
7692
+ )
7693
+ );
7694
+ fallthroughAttrs = Component.props ? attrs : getFunctionalFallthrough(attrs);
7695
+ }
7696
+ } catch (err) {
7697
+ blockStack.length = 0;
7698
+ handleError(err, instance, 1);
7699
+ result = createVNode(Comment);
7700
+ }
7701
+ let root = result;
7702
+ if (fallthroughAttrs && inheritAttrs !== false) {
7703
+ const keys = Object.keys(fallthroughAttrs);
7704
+ const { shapeFlag } = root;
7705
+ if (keys.length) {
7706
+ if (shapeFlag & (1 | 6)) {
7707
+ if (propsOptions && keys.some(isModelListener)) {
7708
+ fallthroughAttrs = filterModelListeners(
7709
+ fallthroughAttrs,
7710
+ propsOptions
7711
+ );
7717
7712
  }
7713
+ root = cloneVNode(root, fallthroughAttrs, false, true);
7718
7714
  }
7719
- vnode.shapeFlag |= 256;
7720
- current = vnode;
7721
- return isSuspense(rawVNode.type) ? rawVNode : vnode;
7722
- };
7715
+ }
7723
7716
  }
7724
- };
7725
- {
7726
- KeepAliveImpl.__isBuildIn = true;
7727
- }
7728
- const KeepAlive = KeepAliveImpl;
7729
- function matches(pattern, name) {
7730
- if (isArray(pattern)) {
7731
- return pattern.some((p) => matches(p, name));
7732
- } else if (isString(pattern)) {
7733
- return pattern.split(",").includes(name);
7734
- } else if (isRegExp(pattern)) {
7735
- return pattern.test(name);
7717
+ if (isCompatEnabled$1("INSTANCE_ATTRS_CLASS_STYLE", instance) && vnode.shapeFlag & 4 && root.shapeFlag & (1 | 6)) {
7718
+ const { class: cls, style } = vnode.props || {};
7719
+ if (cls || style) {
7720
+ root = cloneVNode(
7721
+ root,
7722
+ {
7723
+ class: cls,
7724
+ style
7725
+ },
7726
+ false,
7727
+ true
7728
+ );
7729
+ }
7736
7730
  }
7737
- return false;
7738
- }
7739
- function onActivated(hook, target) {
7740
- registerKeepAliveHook(hook, "a", target);
7731
+ if (vnode.dirs) {
7732
+ root = cloneVNode(root, null, false, true);
7733
+ root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
7734
+ }
7735
+ if (vnode.transition) {
7736
+ root.transition = vnode.transition;
7737
+ }
7738
+ {
7739
+ result = root;
7740
+ }
7741
+ setCurrentRenderingInstance(prev);
7742
+ return result;
7741
7743
  }
7742
- function onDeactivated(hook, target) {
7743
- registerKeepAliveHook(hook, "da", target);
7744
+ function filterSingleRoot(children, recurse = true) {
7745
+ let singleRoot;
7746
+ for (let i = 0; i < children.length; i++) {
7747
+ const child = children[i];
7748
+ if (isVNode(child)) {
7749
+ if (child.type !== Comment || child.children === "v-if") {
7750
+ if (singleRoot) {
7751
+ return;
7752
+ } else {
7753
+ singleRoot = child;
7754
+ }
7755
+ }
7756
+ } else {
7757
+ return;
7758
+ }
7759
+ }
7760
+ return singleRoot;
7744
7761
  }
7745
- function registerKeepAliveHook(hook, type, target = currentInstance) {
7746
- const wrappedHook = hook.__wdc || (hook.__wdc = () => {
7747
- let current = target;
7748
- while (current) {
7749
- if (current.isDeactivated) {
7750
- return;
7762
+ const getFunctionalFallthrough = (attrs) => {
7763
+ let res;
7764
+ for (const key in attrs) {
7765
+ if (key === "class" || key === "style" || isOn(key)) {
7766
+ (res || (res = {}))[key] = attrs[key];
7767
+ }
7768
+ }
7769
+ return res;
7770
+ };
7771
+ const filterModelListeners = (attrs, props) => {
7772
+ const res = {};
7773
+ for (const key in attrs) {
7774
+ if (!isModelListener(key) || !(key.slice(9) in props)) {
7775
+ res[key] = attrs[key];
7776
+ }
7777
+ }
7778
+ return res;
7779
+ };
7780
+ function shouldUpdateComponent(prevVNode, nextVNode, optimized) {
7781
+ const { props: prevProps, children: prevChildren, component } = prevVNode;
7782
+ const { props: nextProps, children: nextChildren, patchFlag } = nextVNode;
7783
+ const emits = component.emitsOptions;
7784
+ if (nextVNode.dirs || nextVNode.transition) {
7785
+ return true;
7786
+ }
7787
+ if (optimized && patchFlag >= 0) {
7788
+ if (patchFlag & 1024) {
7789
+ return true;
7790
+ }
7791
+ if (patchFlag & 16) {
7792
+ if (!prevProps) {
7793
+ return !!nextProps;
7794
+ }
7795
+ return hasPropsChanged(prevProps, nextProps, emits);
7796
+ } else if (patchFlag & 8) {
7797
+ const dynamicProps = nextVNode.dynamicProps;
7798
+ for (let i = 0; i < dynamicProps.length; i++) {
7799
+ const key = dynamicProps[i];
7800
+ if (nextProps[key] !== prevProps[key] && !isEmitListener(emits, key)) {
7801
+ return true;
7802
+ }
7751
7803
  }
7752
- current = current.parent;
7753
7804
  }
7754
- return hook();
7755
- });
7756
- injectHook(type, wrappedHook, target);
7757
- if (target) {
7758
- let current = target.parent;
7759
- while (current && current.parent) {
7760
- if (isKeepAlive(current.parent.vnode)) {
7761
- injectToKeepAliveRoot(wrappedHook, type, target, current);
7805
+ } else {
7806
+ if (prevChildren || nextChildren) {
7807
+ if (!nextChildren || !nextChildren.$stable) {
7808
+ return true;
7762
7809
  }
7763
- current = current.parent;
7764
7810
  }
7811
+ if (prevProps === nextProps) {
7812
+ return false;
7813
+ }
7814
+ if (!prevProps) {
7815
+ return !!nextProps;
7816
+ }
7817
+ if (!nextProps) {
7818
+ return true;
7819
+ }
7820
+ return hasPropsChanged(prevProps, nextProps, emits);
7765
7821
  }
7822
+ return false;
7766
7823
  }
7767
- function injectToKeepAliveRoot(hook, type, target, keepAliveRoot) {
7768
- const injected = injectHook(
7769
- type,
7770
- hook,
7771
- keepAliveRoot,
7772
- true
7773
- /* prepend */
7774
- );
7775
- onUnmounted(() => {
7776
- remove(keepAliveRoot[type], injected);
7777
- }, target);
7778
- }
7779
- function resetShapeFlag(vnode) {
7780
- vnode.shapeFlag &= ~256;
7781
- vnode.shapeFlag &= ~512;
7824
+ function hasPropsChanged(prevProps, nextProps, emitsOptions) {
7825
+ const nextKeys = Object.keys(nextProps);
7826
+ if (nextKeys.length !== Object.keys(prevProps).length) {
7827
+ return true;
7828
+ }
7829
+ for (let i = 0; i < nextKeys.length; i++) {
7830
+ const key = nextKeys[i];
7831
+ if (nextProps[key] !== prevProps[key] && !isEmitListener(emitsOptions, key)) {
7832
+ return true;
7833
+ }
7834
+ }
7835
+ return false;
7782
7836
  }
7783
- function getInnerChild(vnode) {
7784
- return vnode.shapeFlag & 128 ? vnode.ssContent : vnode;
7837
+ function updateHOCHostEl({ vnode, parent }, el) {
7838
+ while (parent) {
7839
+ const root = parent.subTree;
7840
+ if (root.suspense && root.suspense.activeBranch === vnode) {
7841
+ root.el = vnode.el;
7842
+ }
7843
+ if (root === vnode) {
7844
+ (vnode = parent.vnode).el = el;
7845
+ parent = parent.parent;
7846
+ } else {
7847
+ break;
7848
+ }
7849
+ }
7785
7850
  }
7786
7851
 
7787
- const leaveCbKey = Symbol("_leaveCb");
7788
- const enterCbKey$1 = Symbol("_enterCb");
7789
- function useTransitionState() {
7790
- const state = {
7791
- isMounted: false,
7792
- isLeaving: false,
7793
- isUnmounting: false,
7794
- leavingVNodes: /* @__PURE__ */ new Map()
7795
- };
7796
- onMounted(() => {
7797
- state.isMounted = true;
7798
- });
7799
- onBeforeUnmount(() => {
7800
- state.isUnmounting = true;
7801
- });
7802
- return state;
7803
- }
7804
- const TransitionHookValidator = [Function, Array];
7805
- const BaseTransitionPropsValidators = {
7806
- mode: String,
7807
- appear: Boolean,
7808
- persisted: Boolean,
7809
- // enter
7810
- onBeforeEnter: TransitionHookValidator,
7811
- onEnter: TransitionHookValidator,
7812
- onAfterEnter: TransitionHookValidator,
7813
- onEnterCancelled: TransitionHookValidator,
7814
- // leave
7815
- onBeforeLeave: TransitionHookValidator,
7816
- onLeave: TransitionHookValidator,
7817
- onAfterLeave: TransitionHookValidator,
7818
- onLeaveCancelled: TransitionHookValidator,
7819
- // appear
7820
- onBeforeAppear: TransitionHookValidator,
7821
- onAppear: TransitionHookValidator,
7822
- onAfterAppear: TransitionHookValidator,
7823
- onAppearCancelled: TransitionHookValidator
7824
- };
7825
- const recursiveGetSubtree = (instance) => {
7826
- const subTree = instance.subTree;
7827
- return subTree.component ? recursiveGetSubtree(subTree.component) : subTree;
7828
- };
7829
- const BaseTransitionImpl = {
7830
- name: `BaseTransition`,
7831
- props: BaseTransitionPropsValidators,
7832
- setup(props, { slots }) {
7833
- const instance = getCurrentInstance();
7834
- const state = useTransitionState();
7835
- return () => {
7836
- const children = slots.default && getTransitionRawChildren(slots.default(), true);
7837
- if (!children || !children.length) {
7852
+ const isSuspense = (type) => type.__isSuspense;
7853
+ let suspenseId = 0;
7854
+ const SuspenseImpl = {
7855
+ name: "Suspense",
7856
+ // In order to make Suspense tree-shakable, we need to avoid importing it
7857
+ // directly in the renderer. The renderer checks for the __isSuspense flag
7858
+ // on a vnode's type and calls the `process` method, passing in renderer
7859
+ // internals.
7860
+ __isSuspense: true,
7861
+ process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals) {
7862
+ if (n1 == null) {
7863
+ mountSuspense(
7864
+ n2,
7865
+ container,
7866
+ anchor,
7867
+ parentComponent,
7868
+ parentSuspense,
7869
+ namespace,
7870
+ slotScopeIds,
7871
+ optimized,
7872
+ rendererInternals
7873
+ );
7874
+ } else {
7875
+ if (parentSuspense && parentSuspense.deps > 0 && !n1.suspense.isInFallback) {
7876
+ n2.suspense = n1.suspense;
7877
+ n2.suspense.vnode = n2;
7878
+ n2.el = n1.el;
7838
7879
  return;
7839
7880
  }
7840
- let child = children[0];
7841
- if (children.length > 1) {
7842
- for (const c of children) {
7843
- if (c.type !== Comment) {
7844
- child = c;
7845
- break;
7846
- }
7847
- }
7848
- }
7849
- const rawProps = toRaw(props);
7850
- const { mode } = rawProps;
7851
- if (state.isLeaving) {
7852
- return emptyPlaceholder(child);
7853
- }
7854
- const innerChild = getKeepAliveChild(child);
7855
- if (!innerChild) {
7856
- return emptyPlaceholder(child);
7857
- }
7858
- let enterHooks = resolveTransitionHooks(
7859
- innerChild,
7860
- rawProps,
7861
- state,
7862
- instance,
7863
- // #11061, ensure enterHooks is fresh after clone
7864
- (hooks) => enterHooks = hooks
7881
+ patchSuspense(
7882
+ n1,
7883
+ n2,
7884
+ container,
7885
+ anchor,
7886
+ parentComponent,
7887
+ namespace,
7888
+ slotScopeIds,
7889
+ optimized,
7890
+ rendererInternals
7865
7891
  );
7866
- setTransitionHooks(innerChild, enterHooks);
7867
- const oldChild = instance.subTree;
7868
- const oldInnerChild = oldChild && getKeepAliveChild(oldChild);
7869
- if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(innerChild, oldInnerChild) && recursiveGetSubtree(instance).type !== Comment) {
7870
- const leavingHooks = resolveTransitionHooks(
7871
- oldInnerChild,
7872
- rawProps,
7873
- state,
7874
- instance
7875
- );
7876
- setTransitionHooks(oldInnerChild, leavingHooks);
7877
- if (mode === "out-in" && innerChild.type !== Comment) {
7878
- state.isLeaving = true;
7879
- leavingHooks.afterLeave = () => {
7880
- state.isLeaving = false;
7881
- if (instance.update.active !== false) {
7882
- instance.effect.dirty = true;
7883
- instance.update();
7884
- }
7885
- };
7886
- return emptyPlaceholder(child);
7887
- } else if (mode === "in-out" && innerChild.type !== Comment) {
7888
- leavingHooks.delayLeave = (el, earlyRemove, delayedLeave) => {
7889
- const leavingVNodesCache = getLeavingNodesForType(
7890
- state,
7891
- oldInnerChild
7892
- );
7893
- leavingVNodesCache[String(oldInnerChild.key)] = oldInnerChild;
7894
- el[leaveCbKey] = () => {
7895
- earlyRemove();
7896
- el[leaveCbKey] = void 0;
7897
- delete enterHooks.delayedLeave;
7898
- };
7899
- enterHooks.delayedLeave = delayedLeave;
7900
- };
7901
- }
7902
- }
7903
- return child;
7904
- };
7905
- }
7892
+ }
7893
+ },
7894
+ hydrate: hydrateSuspense,
7895
+ normalize: normalizeSuspenseChildren
7906
7896
  };
7907
- {
7908
- BaseTransitionImpl.__isBuiltIn = true;
7909
- }
7910
- const BaseTransition = BaseTransitionImpl;
7911
- function getLeavingNodesForType(state, vnode) {
7912
- const { leavingVNodes } = state;
7913
- let leavingVNodesCache = leavingVNodes.get(vnode.type);
7914
- if (!leavingVNodesCache) {
7915
- leavingVNodesCache = /* @__PURE__ */ Object.create(null);
7916
- leavingVNodes.set(vnode.type, leavingVNodesCache);
7897
+ const Suspense = SuspenseImpl ;
7898
+ function triggerEvent(vnode, name) {
7899
+ const eventListener = vnode.props && vnode.props[name];
7900
+ if (isFunction(eventListener)) {
7901
+ eventListener();
7917
7902
  }
7918
- return leavingVNodesCache;
7919
7903
  }
7920
- function resolveTransitionHooks(vnode, props, state, instance, postClone) {
7904
+ function mountSuspense(vnode, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals) {
7921
7905
  const {
7922
- appear,
7923
- mode,
7924
- persisted = false,
7925
- onBeforeEnter,
7926
- onEnter,
7927
- onAfterEnter,
7928
- onEnterCancelled,
7929
- onBeforeLeave,
7930
- onLeave,
7931
- onAfterLeave,
7932
- onLeaveCancelled,
7933
- onBeforeAppear,
7934
- onAppear,
7935
- onAfterAppear,
7936
- onAppearCancelled
7937
- } = props;
7938
- const key = String(vnode.key);
7939
- const leavingVNodesCache = getLeavingNodesForType(state, vnode);
7940
- const callHook = (hook, args) => {
7941
- hook && callWithAsyncErrorHandling(
7942
- hook,
7943
- instance,
7944
- 9,
7945
- args
7906
+ p: patch,
7907
+ o: { createElement }
7908
+ } = rendererInternals;
7909
+ const hiddenContainer = createElement("div");
7910
+ const suspense = vnode.suspense = createSuspenseBoundary(
7911
+ vnode,
7912
+ parentSuspense,
7913
+ parentComponent,
7914
+ container,
7915
+ hiddenContainer,
7916
+ anchor,
7917
+ namespace,
7918
+ slotScopeIds,
7919
+ optimized,
7920
+ rendererInternals
7921
+ );
7922
+ patch(
7923
+ null,
7924
+ suspense.pendingBranch = vnode.ssContent,
7925
+ hiddenContainer,
7926
+ null,
7927
+ parentComponent,
7928
+ suspense,
7929
+ namespace,
7930
+ slotScopeIds
7931
+ );
7932
+ if (suspense.deps > 0) {
7933
+ triggerEvent(vnode, "onPending");
7934
+ triggerEvent(vnode, "onFallback");
7935
+ patch(
7936
+ null,
7937
+ vnode.ssFallback,
7938
+ container,
7939
+ anchor,
7940
+ parentComponent,
7941
+ null,
7942
+ // fallback tree will not have suspense context
7943
+ namespace,
7944
+ slotScopeIds
7946
7945
  );
7947
- };
7948
- const callAsyncHook = (hook, args) => {
7949
- const done = args[1];
7950
- callHook(hook, args);
7951
- if (isArray(hook)) {
7952
- if (hook.every((hook2) => hook2.length <= 1)) done();
7953
- } else if (hook.length <= 1) {
7954
- done();
7955
- }
7956
- };
7957
- const hooks = {
7958
- mode,
7959
- persisted,
7960
- beforeEnter(el) {
7961
- let hook = onBeforeEnter;
7962
- if (!state.isMounted) {
7963
- if (appear) {
7964
- hook = onBeforeAppear || onBeforeEnter;
7965
- } else {
7966
- return;
7967
- }
7968
- }
7969
- if (el[leaveCbKey]) {
7970
- el[leaveCbKey](
7971
- true
7972
- /* cancelled */
7973
- );
7974
- }
7975
- const leavingVNode = leavingVNodesCache[key];
7976
- if (leavingVNode && isSameVNodeType(vnode, leavingVNode) && leavingVNode.el[leaveCbKey]) {
7977
- leavingVNode.el[leaveCbKey]();
7978
- }
7979
- callHook(hook, [el]);
7980
- },
7981
- enter(el) {
7982
- let hook = onEnter;
7983
- let afterHook = onAfterEnter;
7984
- let cancelHook = onEnterCancelled;
7985
- if (!state.isMounted) {
7986
- if (appear) {
7987
- hook = onAppear || onEnter;
7988
- afterHook = onAfterAppear || onAfterEnter;
7989
- cancelHook = onAppearCancelled || onEnterCancelled;
7990
- } else {
7991
- return;
7992
- }
7993
- }
7994
- let called = false;
7995
- const done = el[enterCbKey$1] = (cancelled) => {
7996
- if (called) return;
7997
- called = true;
7998
- if (cancelled) {
7999
- callHook(cancelHook, [el]);
8000
- } else {
8001
- callHook(afterHook, [el]);
8002
- }
8003
- if (hooks.delayedLeave) {
8004
- hooks.delayedLeave();
7946
+ setActiveBranch(suspense, vnode.ssFallback);
7947
+ } else {
7948
+ suspense.resolve(false, true);
7949
+ }
7950
+ }
7951
+ function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, slotScopeIds, optimized, { p: patch, um: unmount, o: { createElement } }) {
7952
+ const suspense = n2.suspense = n1.suspense;
7953
+ suspense.vnode = n2;
7954
+ n2.el = n1.el;
7955
+ const newBranch = n2.ssContent;
7956
+ const newFallback = n2.ssFallback;
7957
+ const { activeBranch, pendingBranch, isInFallback, isHydrating } = suspense;
7958
+ if (pendingBranch) {
7959
+ suspense.pendingBranch = newBranch;
7960
+ if (isSameVNodeType(newBranch, pendingBranch)) {
7961
+ patch(
7962
+ pendingBranch,
7963
+ newBranch,
7964
+ suspense.hiddenContainer,
7965
+ null,
7966
+ parentComponent,
7967
+ suspense,
7968
+ namespace,
7969
+ slotScopeIds,
7970
+ optimized
7971
+ );
7972
+ if (suspense.deps <= 0) {
7973
+ suspense.resolve();
7974
+ } else if (isInFallback) {
7975
+ if (!isHydrating) {
7976
+ patch(
7977
+ activeBranch,
7978
+ newFallback,
7979
+ container,
7980
+ anchor,
7981
+ parentComponent,
7982
+ null,
7983
+ // fallback tree will not have suspense context
7984
+ namespace,
7985
+ slotScopeIds,
7986
+ optimized
7987
+ );
7988
+ setActiveBranch(suspense, newFallback);
8005
7989
  }
8006
- el[enterCbKey$1] = void 0;
8007
- };
8008
- if (hook) {
8009
- callAsyncHook(hook, [el, done]);
7990
+ }
7991
+ } else {
7992
+ suspense.pendingId = suspenseId++;
7993
+ if (isHydrating) {
7994
+ suspense.isHydrating = false;
7995
+ suspense.activeBranch = pendingBranch;
8010
7996
  } else {
8011
- done();
7997
+ unmount(pendingBranch, parentComponent, suspense);
8012
7998
  }
8013
- },
8014
- leave(el, remove) {
8015
- const key2 = String(vnode.key);
8016
- if (el[enterCbKey$1]) {
8017
- el[enterCbKey$1](
8018
- true
8019
- /* cancelled */
7999
+ suspense.deps = 0;
8000
+ suspense.effects.length = 0;
8001
+ suspense.hiddenContainer = createElement("div");
8002
+ if (isInFallback) {
8003
+ patch(
8004
+ null,
8005
+ newBranch,
8006
+ suspense.hiddenContainer,
8007
+ null,
8008
+ parentComponent,
8009
+ suspense,
8010
+ namespace,
8011
+ slotScopeIds,
8012
+ optimized
8020
8013
  );
8021
- }
8022
- if (state.isUnmounting) {
8023
- return remove();
8024
- }
8025
- callHook(onBeforeLeave, [el]);
8026
- let called = false;
8027
- const done = el[leaveCbKey] = (cancelled) => {
8028
- if (called) return;
8029
- called = true;
8030
- remove();
8031
- if (cancelled) {
8032
- callHook(onLeaveCancelled, [el]);
8014
+ if (suspense.deps <= 0) {
8015
+ suspense.resolve();
8033
8016
  } else {
8034
- callHook(onAfterLeave, [el]);
8035
- }
8036
- el[leaveCbKey] = void 0;
8037
- if (leavingVNodesCache[key2] === vnode) {
8038
- delete leavingVNodesCache[key2];
8017
+ patch(
8018
+ activeBranch,
8019
+ newFallback,
8020
+ container,
8021
+ anchor,
8022
+ parentComponent,
8023
+ null,
8024
+ // fallback tree will not have suspense context
8025
+ namespace,
8026
+ slotScopeIds,
8027
+ optimized
8028
+ );
8029
+ setActiveBranch(suspense, newFallback);
8039
8030
  }
8040
- };
8041
- leavingVNodesCache[key2] = vnode;
8042
- if (onLeave) {
8043
- callAsyncHook(onLeave, [el, done]);
8031
+ } else if (activeBranch && isSameVNodeType(newBranch, activeBranch)) {
8032
+ patch(
8033
+ activeBranch,
8034
+ newBranch,
8035
+ container,
8036
+ anchor,
8037
+ parentComponent,
8038
+ suspense,
8039
+ namespace,
8040
+ slotScopeIds,
8041
+ optimized
8042
+ );
8043
+ suspense.resolve(true);
8044
8044
  } else {
8045
- done();
8045
+ patch(
8046
+ null,
8047
+ newBranch,
8048
+ suspense.hiddenContainer,
8049
+ null,
8050
+ parentComponent,
8051
+ suspense,
8052
+ namespace,
8053
+ slotScopeIds,
8054
+ optimized
8055
+ );
8056
+ if (suspense.deps <= 0) {
8057
+ suspense.resolve();
8058
+ }
8046
8059
  }
8047
- },
8048
- clone(vnode2) {
8049
- const hooks2 = resolveTransitionHooks(
8050
- vnode2,
8051
- props,
8052
- state,
8053
- instance,
8054
- postClone
8055
- );
8056
- if (postClone) postClone(hooks2);
8057
- return hooks2;
8058
- }
8059
- };
8060
- return hooks;
8061
- }
8062
- function emptyPlaceholder(vnode) {
8063
- if (isKeepAlive(vnode)) {
8064
- vnode = cloneVNode(vnode);
8065
- vnode.children = null;
8066
- return vnode;
8067
- }
8068
- }
8069
- function getKeepAliveChild(vnode) {
8070
- if (!isKeepAlive(vnode)) {
8071
- return vnode;
8072
- }
8073
- const { shapeFlag, children } = vnode;
8074
- if (children) {
8075
- if (shapeFlag & 16) {
8076
- return children[0];
8077
- }
8078
- if (shapeFlag & 32 && isFunction(children.default)) {
8079
- return children.default();
8080
8060
  }
8081
- }
8082
- }
8083
- function setTransitionHooks(vnode, hooks) {
8084
- if (vnode.shapeFlag & 6 && vnode.component) {
8085
- setTransitionHooks(vnode.component.subTree, hooks);
8086
- } else if (vnode.shapeFlag & 128) {
8087
- vnode.ssContent.transition = hooks.clone(vnode.ssContent);
8088
- vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
8089
8061
  } else {
8090
- vnode.transition = hooks;
8091
- }
8092
- }
8093
- function getTransitionRawChildren(children, keepComment = false, parentKey) {
8094
- let ret = [];
8095
- let keyedFragmentCount = 0;
8096
- for (let i = 0; i < children.length; i++) {
8097
- let child = children[i];
8098
- const key = parentKey == null ? child.key : String(parentKey) + String(child.key != null ? child.key : i);
8099
- if (child.type === Fragment) {
8100
- if (child.patchFlag & 128) keyedFragmentCount++;
8101
- ret = ret.concat(
8102
- getTransitionRawChildren(child.children, keepComment, key)
8062
+ if (activeBranch && isSameVNodeType(newBranch, activeBranch)) {
8063
+ patch(
8064
+ activeBranch,
8065
+ newBranch,
8066
+ container,
8067
+ anchor,
8068
+ parentComponent,
8069
+ suspense,
8070
+ namespace,
8071
+ slotScopeIds,
8072
+ optimized
8103
8073
  );
8104
- } else if (keepComment || child.type !== Comment) {
8105
- ret.push(key != null ? cloneVNode(child, { key }) : child);
8106
- }
8107
- }
8108
- if (keyedFragmentCount > 1) {
8109
- for (let i = 0; i < ret.length; i++) {
8110
- ret[i].patchFlag = -2;
8111
- }
8112
- }
8113
- return ret;
8114
- }
8115
-
8116
- const isTeleport = (type) => type.__isTeleport;
8117
- const isTeleportDisabled = (props) => props && (props.disabled || props.disabled === "");
8118
- const isTargetSVG = (target) => typeof SVGElement !== "undefined" && target instanceof SVGElement;
8119
- const isTargetMathML = (target) => typeof MathMLElement === "function" && target instanceof MathMLElement;
8120
- const resolveTarget = (props, select) => {
8121
- const targetSelector = props && props.to;
8122
- if (isString(targetSelector)) {
8123
- if (!select) {
8124
- return null;
8074
+ setActiveBranch(suspense, newBranch);
8125
8075
  } else {
8126
- const target = select(targetSelector);
8127
- return target;
8076
+ triggerEvent(n2, "onPending");
8077
+ suspense.pendingBranch = newBranch;
8078
+ if (newBranch.shapeFlag & 512) {
8079
+ suspense.pendingId = newBranch.component.suspenseId;
8080
+ } else {
8081
+ suspense.pendingId = suspenseId++;
8082
+ }
8083
+ patch(
8084
+ null,
8085
+ newBranch,
8086
+ suspense.hiddenContainer,
8087
+ null,
8088
+ parentComponent,
8089
+ suspense,
8090
+ namespace,
8091
+ slotScopeIds,
8092
+ optimized
8093
+ );
8094
+ if (suspense.deps <= 0) {
8095
+ suspense.resolve();
8096
+ } else {
8097
+ const { timeout, pendingId } = suspense;
8098
+ if (timeout > 0) {
8099
+ setTimeout(() => {
8100
+ if (suspense.pendingId === pendingId) {
8101
+ suspense.fallback(newFallback);
8102
+ }
8103
+ }, timeout);
8104
+ } else if (timeout === 0) {
8105
+ suspense.fallback(newFallback);
8106
+ }
8107
+ }
8128
8108
  }
8129
- } else {
8130
- return targetSelector;
8131
8109
  }
8132
- };
8133
- const TeleportImpl = {
8134
- name: "Teleport",
8135
- __isTeleport: true,
8136
- process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, internals) {
8137
- const {
8138
- mc: mountChildren,
8139
- pc: patchChildren,
8140
- pbc: patchBlockChildren,
8141
- o: { insert, querySelector, createText, createComment }
8142
- } = internals;
8143
- const disabled = isTeleportDisabled(n2.props);
8144
- let { shapeFlag, children, dynamicChildren } = n2;
8145
- if (n1 == null) {
8146
- const placeholder = n2.el = createText("");
8147
- const mainAnchor = n2.anchor = createText("");
8148
- insert(placeholder, container, anchor);
8149
- insert(mainAnchor, container, anchor);
8150
- const target = n2.target = resolveTarget(n2.props, querySelector);
8151
- const targetAnchor = n2.targetAnchor = createText("");
8152
- if (target) {
8153
- insert(targetAnchor, target);
8154
- if (namespace === "svg" || isTargetSVG(target)) {
8155
- namespace = "svg";
8156
- } else if (namespace === "mathml" || isTargetMathML(target)) {
8157
- namespace = "mathml";
8110
+ }
8111
+ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, container, hiddenContainer, anchor, namespace, slotScopeIds, optimized, rendererInternals, isHydrating = false) {
8112
+ const {
8113
+ p: patch,
8114
+ m: move,
8115
+ um: unmount,
8116
+ n: next,
8117
+ o: { parentNode, remove }
8118
+ } = rendererInternals;
8119
+ let parentSuspenseId;
8120
+ const isSuspensible = isVNodeSuspensible(vnode);
8121
+ if (isSuspensible) {
8122
+ if (parentSuspense && parentSuspense.pendingBranch) {
8123
+ parentSuspenseId = parentSuspense.pendingId;
8124
+ parentSuspense.deps++;
8125
+ }
8126
+ }
8127
+ const timeout = vnode.props ? toNumber(vnode.props.timeout) : void 0;
8128
+ const initialAnchor = anchor;
8129
+ const suspense = {
8130
+ vnode,
8131
+ parent: parentSuspense,
8132
+ parentComponent,
8133
+ namespace,
8134
+ container,
8135
+ hiddenContainer,
8136
+ deps: 0,
8137
+ pendingId: suspenseId++,
8138
+ timeout: typeof timeout === "number" ? timeout : -1,
8139
+ activeBranch: null,
8140
+ pendingBranch: null,
8141
+ isInFallback: !isHydrating,
8142
+ isHydrating,
8143
+ isUnmounted: false,
8144
+ effects: [],
8145
+ resolve(resume = false, sync = false) {
8146
+ const {
8147
+ vnode: vnode2,
8148
+ activeBranch,
8149
+ pendingBranch,
8150
+ pendingId,
8151
+ effects,
8152
+ parentComponent: parentComponent2,
8153
+ container: container2
8154
+ } = suspense;
8155
+ let delayEnter = false;
8156
+ if (suspense.isHydrating) {
8157
+ suspense.isHydrating = false;
8158
+ } else if (!resume) {
8159
+ delayEnter = activeBranch && pendingBranch.transition && pendingBranch.transition.mode === "out-in";
8160
+ if (delayEnter) {
8161
+ activeBranch.transition.afterLeave = () => {
8162
+ if (pendingId === suspense.pendingId) {
8163
+ move(
8164
+ pendingBranch,
8165
+ container2,
8166
+ anchor === initialAnchor ? next(activeBranch) : anchor,
8167
+ 0
8168
+ );
8169
+ queuePostFlushCb(effects);
8170
+ }
8171
+ };
8172
+ }
8173
+ if (activeBranch) {
8174
+ if (parentNode(activeBranch.el) !== suspense.hiddenContainer) {
8175
+ anchor = next(activeBranch);
8176
+ }
8177
+ unmount(activeBranch, parentComponent2, suspense, true);
8178
+ }
8179
+ if (!delayEnter) {
8180
+ move(pendingBranch, container2, anchor, 0);
8158
8181
  }
8159
8182
  }
8160
- const mount = (container2, anchor2) => {
8161
- if (shapeFlag & 16) {
8162
- mountChildren(
8163
- children,
8164
- container2,
8165
- anchor2,
8166
- parentComponent,
8167
- parentSuspense,
8168
- namespace,
8169
- slotScopeIds,
8170
- optimized
8171
- );
8183
+ setActiveBranch(suspense, pendingBranch);
8184
+ suspense.pendingBranch = null;
8185
+ suspense.isInFallback = false;
8186
+ let parent = suspense.parent;
8187
+ let hasUnresolvedAncestor = false;
8188
+ while (parent) {
8189
+ if (parent.pendingBranch) {
8190
+ parent.effects.push(...effects);
8191
+ hasUnresolvedAncestor = true;
8192
+ break;
8172
8193
  }
8173
- };
8174
- if (disabled) {
8175
- mount(container, mainAnchor);
8176
- } else if (target) {
8177
- mount(target, targetAnchor);
8194
+ parent = parent.parent;
8178
8195
  }
8179
- } else {
8180
- n2.el = n1.el;
8181
- const mainAnchor = n2.anchor = n1.anchor;
8182
- const target = n2.target = n1.target;
8183
- const targetAnchor = n2.targetAnchor = n1.targetAnchor;
8184
- const wasDisabled = isTeleportDisabled(n1.props);
8185
- const currentContainer = wasDisabled ? container : target;
8186
- const currentAnchor = wasDisabled ? mainAnchor : targetAnchor;
8187
- if (namespace === "svg" || isTargetSVG(target)) {
8188
- namespace = "svg";
8189
- } else if (namespace === "mathml" || isTargetMathML(target)) {
8190
- namespace = "mathml";
8196
+ if (!hasUnresolvedAncestor && !delayEnter) {
8197
+ queuePostFlushCb(effects);
8191
8198
  }
8192
- if (dynamicChildren) {
8193
- patchBlockChildren(
8194
- n1.dynamicChildren,
8195
- dynamicChildren,
8196
- currentContainer,
8197
- parentComponent,
8198
- parentSuspense,
8199
- namespace,
8200
- slotScopeIds
8201
- );
8202
- traverseStaticChildren(n1, n2, true);
8203
- } else if (!optimized) {
8204
- patchChildren(
8205
- n1,
8206
- n2,
8207
- currentContainer,
8208
- currentAnchor,
8209
- parentComponent,
8210
- parentSuspense,
8211
- namespace,
8199
+ suspense.effects = [];
8200
+ if (isSuspensible) {
8201
+ if (parentSuspense && parentSuspense.pendingBranch && parentSuspenseId === parentSuspense.pendingId) {
8202
+ parentSuspense.deps--;
8203
+ if (parentSuspense.deps === 0 && !sync) {
8204
+ parentSuspense.resolve();
8205
+ }
8206
+ }
8207
+ }
8208
+ triggerEvent(vnode2, "onResolve");
8209
+ },
8210
+ fallback(fallbackVNode) {
8211
+ if (!suspense.pendingBranch) {
8212
+ return;
8213
+ }
8214
+ const { vnode: vnode2, activeBranch, parentComponent: parentComponent2, container: container2, namespace: namespace2 } = suspense;
8215
+ triggerEvent(vnode2, "onFallback");
8216
+ const anchor2 = next(activeBranch);
8217
+ const mountFallback = () => {
8218
+ if (!suspense.isInFallback) {
8219
+ return;
8220
+ }
8221
+ patch(
8222
+ null,
8223
+ fallbackVNode,
8224
+ container2,
8225
+ anchor2,
8226
+ parentComponent2,
8227
+ null,
8228
+ // fallback tree will not have suspense context
8229
+ namespace2,
8212
8230
  slotScopeIds,
8213
- false
8231
+ optimized
8214
8232
  );
8233
+ setActiveBranch(suspense, fallbackVNode);
8234
+ };
8235
+ const delayEnter = fallbackVNode.transition && fallbackVNode.transition.mode === "out-in";
8236
+ if (delayEnter) {
8237
+ activeBranch.transition.afterLeave = mountFallback;
8215
8238
  }
8216
- if (disabled) {
8217
- if (!wasDisabled) {
8218
- moveTeleport(
8219
- n2,
8220
- container,
8221
- mainAnchor,
8222
- internals,
8223
- 1
8224
- );
8225
- } else {
8226
- if (n2.props && n1.props && n2.props.to !== n1.props.to) {
8227
- n2.props.to = n1.props.to;
8228
- }
8239
+ suspense.isInFallback = true;
8240
+ unmount(
8241
+ activeBranch,
8242
+ parentComponent2,
8243
+ null,
8244
+ // no suspense so unmount hooks fire now
8245
+ true
8246
+ // shouldRemove
8247
+ );
8248
+ if (!delayEnter) {
8249
+ mountFallback();
8250
+ }
8251
+ },
8252
+ move(container2, anchor2, type) {
8253
+ suspense.activeBranch && move(suspense.activeBranch, container2, anchor2, type);
8254
+ suspense.container = container2;
8255
+ },
8256
+ next() {
8257
+ return suspense.activeBranch && next(suspense.activeBranch);
8258
+ },
8259
+ registerDep(instance, setupRenderEffect, optimized2) {
8260
+ const isInPendingSuspense = !!suspense.pendingBranch;
8261
+ if (isInPendingSuspense) {
8262
+ suspense.deps++;
8263
+ }
8264
+ const hydratedEl = instance.vnode.el;
8265
+ instance.asyncDep.catch((err) => {
8266
+ handleError(err, instance, 0);
8267
+ }).then((asyncSetupResult) => {
8268
+ if (instance.isUnmounted || suspense.isUnmounted || suspense.pendingId !== instance.suspenseId) {
8269
+ return;
8229
8270
  }
8230
- } else {
8231
- if ((n2.props && n2.props.to) !== (n1.props && n1.props.to)) {
8232
- const nextTarget = n2.target = resolveTarget(
8233
- n2.props,
8234
- querySelector
8235
- );
8236
- if (nextTarget) {
8237
- moveTeleport(
8238
- n2,
8239
- nextTarget,
8240
- null,
8241
- internals,
8242
- 0
8243
- );
8244
- }
8245
- } else if (wasDisabled) {
8246
- moveTeleport(
8247
- n2,
8248
- target,
8249
- targetAnchor,
8250
- internals,
8251
- 1
8252
- );
8271
+ instance.asyncResolved = true;
8272
+ const { vnode: vnode2 } = instance;
8273
+ handleSetupResult(instance, asyncSetupResult, false);
8274
+ if (hydratedEl) {
8275
+ vnode2.el = hydratedEl;
8276
+ }
8277
+ const placeholder = !hydratedEl && instance.subTree.el;
8278
+ setupRenderEffect(
8279
+ instance,
8280
+ vnode2,
8281
+ // component may have been moved before resolve.
8282
+ // if this is not a hydration, instance.subTree will be the comment
8283
+ // placeholder.
8284
+ parentNode(hydratedEl || instance.subTree.el),
8285
+ // anchor will not be used if this is hydration, so only need to
8286
+ // consider the comment placeholder case.
8287
+ hydratedEl ? null : next(instance.subTree),
8288
+ suspense,
8289
+ namespace,
8290
+ optimized2
8291
+ );
8292
+ if (placeholder) {
8293
+ remove(placeholder);
8253
8294
  }
8254
- }
8255
- }
8256
- updateCssVars(n2);
8257
- },
8258
- remove(vnode, parentComponent, parentSuspense, { um: unmount, o: { remove: hostRemove } }, doRemove) {
8259
- const { shapeFlag, children, anchor, targetAnchor, target, props } = vnode;
8260
- if (target) {
8261
- hostRemove(targetAnchor);
8262
- }
8263
- doRemove && hostRemove(anchor);
8264
- if (shapeFlag & 16) {
8265
- const shouldRemove = doRemove || !isTeleportDisabled(props);
8266
- for (let i = 0; i < children.length; i++) {
8267
- const child = children[i];
8295
+ updateHOCHostEl(instance, vnode2.el);
8296
+ if (isInPendingSuspense && --suspense.deps === 0) {
8297
+ suspense.resolve();
8298
+ }
8299
+ });
8300
+ },
8301
+ unmount(parentSuspense2, doRemove) {
8302
+ suspense.isUnmounted = true;
8303
+ if (suspense.activeBranch) {
8268
8304
  unmount(
8269
- child,
8305
+ suspense.activeBranch,
8270
8306
  parentComponent,
8271
- parentSuspense,
8272
- shouldRemove,
8273
- !!child.dynamicChildren
8307
+ parentSuspense2,
8308
+ doRemove
8274
8309
  );
8275
8310
  }
8276
- }
8277
- },
8278
- move: moveTeleport,
8279
- hydrate: hydrateTeleport
8280
- };
8281
- function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }, moveType = 2) {
8282
- if (moveType === 0) {
8283
- insert(vnode.targetAnchor, container, parentAnchor);
8284
- }
8285
- const { el, anchor, shapeFlag, children, props } = vnode;
8286
- const isReorder = moveType === 2;
8287
- if (isReorder) {
8288
- insert(el, container, parentAnchor);
8289
- }
8290
- if (!isReorder || isTeleportDisabled(props)) {
8291
- if (shapeFlag & 16) {
8292
- for (let i = 0; i < children.length; i++) {
8293
- move(
8294
- children[i],
8295
- container,
8296
- parentAnchor,
8297
- 2
8311
+ if (suspense.pendingBranch) {
8312
+ unmount(
8313
+ suspense.pendingBranch,
8314
+ parentComponent,
8315
+ parentSuspense2,
8316
+ doRemove
8298
8317
  );
8299
8318
  }
8300
8319
  }
8320
+ };
8321
+ return suspense;
8322
+ }
8323
+ function hydrateSuspense(node, vnode, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals, hydrateNode) {
8324
+ const suspense = vnode.suspense = createSuspenseBoundary(
8325
+ vnode,
8326
+ parentSuspense,
8327
+ parentComponent,
8328
+ node.parentNode,
8329
+ // eslint-disable-next-line no-restricted-globals
8330
+ document.createElement("div"),
8331
+ null,
8332
+ namespace,
8333
+ slotScopeIds,
8334
+ optimized,
8335
+ rendererInternals,
8336
+ true
8337
+ );
8338
+ const result = hydrateNode(
8339
+ node,
8340
+ suspense.pendingBranch = vnode.ssContent,
8341
+ parentComponent,
8342
+ suspense,
8343
+ slotScopeIds,
8344
+ optimized
8345
+ );
8346
+ if (suspense.deps === 0) {
8347
+ suspense.resolve(false, true);
8301
8348
  }
8302
- if (isReorder) {
8303
- insert(anchor, container, parentAnchor);
8304
- }
8349
+ return result;
8305
8350
  }
8306
- function hydrateTeleport(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized, {
8307
- o: { nextSibling, parentNode, querySelector }
8308
- }, hydrateChildren) {
8309
- const target = vnode.target = resolveTarget(
8310
- vnode.props,
8311
- querySelector
8351
+ function normalizeSuspenseChildren(vnode) {
8352
+ const { shapeFlag, children } = vnode;
8353
+ const isSlotChildren = shapeFlag & 32;
8354
+ vnode.ssContent = normalizeSuspenseSlot(
8355
+ isSlotChildren ? children.default : children
8312
8356
  );
8313
- if (target) {
8314
- const targetNode = target._lpa || target.firstChild;
8315
- if (vnode.shapeFlag & 16) {
8316
- if (isTeleportDisabled(vnode.props)) {
8317
- vnode.anchor = hydrateChildren(
8318
- nextSibling(node),
8319
- vnode,
8320
- parentNode(node),
8321
- parentComponent,
8322
- parentSuspense,
8323
- slotScopeIds,
8324
- optimized
8325
- );
8326
- vnode.targetAnchor = targetNode;
8327
- } else {
8328
- vnode.anchor = nextSibling(node);
8329
- let targetAnchor = targetNode;
8330
- while (targetAnchor) {
8331
- targetAnchor = nextSibling(targetAnchor);
8332
- if (targetAnchor && targetAnchor.nodeType === 8 && targetAnchor.data === "teleport anchor") {
8333
- vnode.targetAnchor = targetAnchor;
8334
- target._lpa = vnode.targetAnchor && nextSibling(vnode.targetAnchor);
8335
- break;
8336
- }
8337
- }
8338
- hydrateChildren(
8339
- targetNode,
8340
- vnode,
8341
- target,
8342
- parentComponent,
8343
- parentSuspense,
8344
- slotScopeIds,
8345
- optimized
8346
- );
8347
- }
8357
+ vnode.ssFallback = isSlotChildren ? normalizeSuspenseSlot(children.fallback) : createVNode(Comment);
8358
+ }
8359
+ function normalizeSuspenseSlot(s) {
8360
+ let block;
8361
+ if (isFunction(s)) {
8362
+ const trackBlock = isBlockTreeEnabled && s._c;
8363
+ if (trackBlock) {
8364
+ s._d = false;
8365
+ openBlock();
8366
+ }
8367
+ s = s();
8368
+ if (trackBlock) {
8369
+ s._d = true;
8370
+ block = currentBlock;
8371
+ closeBlock();
8348
8372
  }
8349
- updateCssVars(vnode);
8350
8373
  }
8351
- return vnode.anchor && nextSibling(vnode.anchor);
8374
+ if (isArray(s)) {
8375
+ const singleChild = filterSingleRoot(s);
8376
+ s = singleChild;
8377
+ }
8378
+ s = normalizeVNode(s);
8379
+ if (block && !s.dynamicChildren) {
8380
+ s.dynamicChildren = block.filter((c) => c !== s);
8381
+ }
8382
+ return s;
8352
8383
  }
8353
- const Teleport = TeleportImpl;
8354
- function updateCssVars(vnode) {
8355
- const ctx = vnode.ctx;
8356
- if (ctx && ctx.ut) {
8357
- let node = vnode.children[0].el;
8358
- while (node && node !== vnode.targetAnchor) {
8359
- if (node.nodeType === 1) node.setAttribute("data-v-owner", ctx.uid);
8360
- node = node.nextSibling;
8384
+ function queueEffectWithSuspense(fn, suspense) {
8385
+ if (suspense && suspense.pendingBranch) {
8386
+ if (isArray(fn)) {
8387
+ suspense.effects.push(...fn);
8388
+ } else {
8389
+ suspense.effects.push(fn);
8361
8390
  }
8362
- ctx.ut();
8391
+ } else {
8392
+ queuePostFlushCb(fn);
8393
+ }
8394
+ }
8395
+ function setActiveBranch(suspense, branch) {
8396
+ suspense.activeBranch = branch;
8397
+ const { vnode, parentComponent } = suspense;
8398
+ let el = branch.el;
8399
+ while (!el && branch.component) {
8400
+ branch = branch.component.subTree;
8401
+ el = branch.el;
8402
+ }
8403
+ vnode.el = el;
8404
+ if (parentComponent && parentComponent.subTree === vnode) {
8405
+ parentComponent.vnode.el = el;
8406
+ updateHOCHostEl(parentComponent, el);
8363
8407
  }
8364
8408
  }
8409
+ function isVNodeSuspensible(vnode) {
8410
+ const suspensible = vnode.props && vnode.props.suspensible;
8411
+ return suspensible != null && suspensible !== false;
8412
+ }
8365
8413
 
8366
8414
  const normalizedAsyncComponentMap = /* @__PURE__ */ new WeakMap();
8367
8415
  function convertLegacyAsyncComponent(comp) {
@@ -8436,6 +8484,9 @@ function closeBlock() {
8436
8484
  let isBlockTreeEnabled = 1;
8437
8485
  function setBlockTracking(value) {
8438
8486
  isBlockTreeEnabled += value;
8487
+ if (value < 0 && currentBlock) {
8488
+ currentBlock.hasOnce = true;
8489
+ }
8439
8490
  }
8440
8491
  function setupBlock(vnode) {
8441
8492
  vnode.dynamicChildren = isBlockTreeEnabled > 0 ? currentBlock || EMPTY_ARR : null;
@@ -8509,6 +8560,7 @@ function createBaseVNode(type, props = null, children = null, patchFlag = 0, dyn
8509
8560
  el: null,
8510
8561
  anchor: null,
8511
8562
  target: null,
8563
+ targetStart: null,
8512
8564
  targetAnchor: null,
8513
8565
  staticCount: 0,
8514
8566
  shapeFlag,
@@ -8622,6 +8674,7 @@ function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false
8622
8674
  slotScopeIds: vnode.slotScopeIds,
8623
8675
  children: children,
8624
8676
  target: vnode.target,
8677
+ targetStart: vnode.targetStart,
8625
8678
  targetAnchor: vnode.targetAnchor,
8626
8679
  staticCount: vnode.staticCount,
8627
8680
  shapeFlag: vnode.shapeFlag,
@@ -8897,12 +8950,12 @@ function isStatefulComponent(instance) {
8897
8950
  return instance.vnode.shapeFlag & 4;
8898
8951
  }
8899
8952
  let isInSSRComponentSetup = false;
8900
- function setupComponent(instance, isSSR = false) {
8953
+ function setupComponent(instance, isSSR = false, optimized = false) {
8901
8954
  isSSR && setInSSRSetupState(isSSR);
8902
8955
  const { props, children } = instance.vnode;
8903
8956
  const isStateful = isStatefulComponent(instance);
8904
8957
  initProps(instance, props, isStateful, isSSR);
8905
- initSlots(instance, children);
8958
+ initSlots(instance, children, optimized);
8906
8959
  const setupResult = isStateful ? setupStatefulComponent(instance, isSSR) : void 0;
8907
8960
  isSSR && setInSSRSetupState(false);
8908
8961
  return setupResult;
@@ -9063,51 +9116,6 @@ const computed = (getterOrOptions, debugOptions) => {
9063
9116
  return c;
9064
9117
  };
9065
9118
 
9066
- function useModel(props, name, options = EMPTY_OBJ) {
9067
- const i = getCurrentInstance();
9068
- const camelizedName = camelize(name);
9069
- const hyphenatedName = hyphenate(name);
9070
- const res = customRef((track, trigger) => {
9071
- let localValue;
9072
- watchSyncEffect(() => {
9073
- const propValue = props[name];
9074
- if (hasChanged(localValue, propValue)) {
9075
- localValue = propValue;
9076
- trigger();
9077
- }
9078
- });
9079
- return {
9080
- get() {
9081
- track();
9082
- return options.get ? options.get(localValue) : localValue;
9083
- },
9084
- set(value) {
9085
- const rawProps = i.vnode.props;
9086
- if (!(rawProps && // check if parent has passed v-model
9087
- (name in rawProps || camelizedName in rawProps || hyphenatedName in rawProps) && (`onUpdate:${name}` in rawProps || `onUpdate:${camelizedName}` in rawProps || `onUpdate:${hyphenatedName}` in rawProps)) && hasChanged(value, localValue)) {
9088
- localValue = value;
9089
- trigger();
9090
- }
9091
- i.emit(`update:${name}`, options.set ? options.set(value) : value);
9092
- }
9093
- };
9094
- });
9095
- const modifierKey = name === "modelValue" ? "modelModifiers" : `${name}Modifiers`;
9096
- res[Symbol.iterator] = () => {
9097
- let i2 = 0;
9098
- return {
9099
- next() {
9100
- if (i2 < 2) {
9101
- return { value: i2++ ? props[modifierKey] || {} : res, done: false };
9102
- } else {
9103
- return { done: true };
9104
- }
9105
- }
9106
- };
9107
- };
9108
- return res;
9109
- }
9110
-
9111
9119
  function h(type, propsOrChildren, children) {
9112
9120
  const l = arguments.length;
9113
9121
  if (l === 2) {
@@ -9142,7 +9150,7 @@ function withMemo(memo, render, cache, index) {
9142
9150
  }
9143
9151
  const ret = render();
9144
9152
  ret.memo = memo.slice();
9145
- ret.memoIndex = index;
9153
+ ret.cacheIndex = index;
9146
9154
  return cache[index] = ret;
9147
9155
  }
9148
9156
  function isMemoSame(cached, memo) {
@@ -9161,7 +9169,7 @@ function isMemoSame(cached, memo) {
9161
9169
  return true;
9162
9170
  }
9163
9171
 
9164
- const version = "3.4.30";
9172
+ const version = "3.4.32";
9165
9173
  const warn$1 = NOOP;
9166
9174
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
9167
9175
  const devtools = void 0;
@@ -9763,12 +9771,10 @@ function compatCoerceAttr(el, key, value, instance = null) {
9763
9771
  return false;
9764
9772
  }
9765
9773
 
9766
- function patchDOMProp(el, key, value, prevChildren, parentComponent, parentSuspense, unmountChildren) {
9774
+ function patchDOMProp(el, key, value, parentComponent) {
9767
9775
  if (key === "innerHTML" || key === "textContent") {
9768
- if (prevChildren) {
9769
- unmountChildren(prevChildren, parentComponent, parentSuspense);
9770
- }
9771
- el[key] = value == null ? "" : value;
9776
+ if (value === null) return;
9777
+ el[key] = value;
9772
9778
  return;
9773
9779
  }
9774
9780
  const tag = el.tagName;
@@ -9894,7 +9900,7 @@ function patchStopImmediatePropagation(e, value) {
9894
9900
 
9895
9901
  const isNativeOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // lowercase letter
9896
9902
  key.charCodeAt(2) > 96 && key.charCodeAt(2) < 123;
9897
- const patchProp = (el, key, prevValue, nextValue, namespace, prevChildren, parentComponent, parentSuspense, unmountChildren) => {
9903
+ const patchProp = (el, key, prevValue, nextValue, namespace, parentComponent) => {
9898
9904
  const isSVG = namespace === "svg";
9899
9905
  if (key === "class") {
9900
9906
  patchClass(el, nextValue, isSVG);
@@ -9905,15 +9911,7 @@ const patchProp = (el, key, prevValue, nextValue, namespace, prevChildren, paren
9905
9911
  patchEvent(el, key, prevValue, nextValue, parentComponent);
9906
9912
  }
9907
9913
  } else if (key[0] === "." ? (key = key.slice(1), true) : key[0] === "^" ? (key = key.slice(1), false) : shouldSetAsProp(el, key, nextValue, isSVG)) {
9908
- patchDOMProp(
9909
- el,
9910
- key,
9911
- nextValue,
9912
- prevChildren,
9913
- parentComponent,
9914
- parentSuspense,
9915
- unmountChildren
9916
- );
9914
+ patchDOMProp(el, key, nextValue, parentComponent);
9917
9915
  if (!el.tagName.includes("-") && (key === "value" || key === "checked" || key === "selected")) {
9918
9916
  patchAttr(el, key, nextValue, isSVG, parentComponent, key !== "value");
9919
9917
  }
@@ -11125,12 +11123,12 @@ function createConditionalExpression(test, consequent, alternate, newline = true
11125
11123
  loc: locStub
11126
11124
  };
11127
11125
  }
11128
- function createCacheExpression(index, value, isVNode = false) {
11126
+ function createCacheExpression(index, value, isVOnce = false) {
11129
11127
  return {
11130
11128
  type: 20,
11131
11129
  index,
11132
11130
  value,
11133
- isVNode,
11131
+ isVOnce,
11134
11132
  loc: locStub
11135
11133
  };
11136
11134
  }
@@ -13383,7 +13381,7 @@ function walk(node, context, doNotHoistNode = false) {
13383
13381
  const constantType = doNotHoistNode ? 0 : getConstantType(child, context);
13384
13382
  if (constantType > 0) {
13385
13383
  if (constantType >= 2) {
13386
- child.codegenNode.patchFlag = -1 + (``);
13384
+ child.codegenNode.patchFlag = -1;
13387
13385
  child.codegenNode = context.hoist(child.codegenNode);
13388
13386
  hoistedCount++;
13389
13387
  continue;
@@ -13391,8 +13389,8 @@ function walk(node, context, doNotHoistNode = false) {
13391
13389
  } else {
13392
13390
  const codegenNode = child.codegenNode;
13393
13391
  if (codegenNode.type === 13) {
13394
- const flag = getPatchFlag(codegenNode);
13395
- if ((!flag || flag === 512 || flag === 1) && getGeneratedPropsConstantType(child, context) >= 2) {
13392
+ const flag = codegenNode.patchFlag;
13393
+ if ((flag === void 0 || flag === 512 || flag === 1) && getGeneratedPropsConstantType(child, context) >= 2) {
13396
13394
  const props = getNodeProps(child);
13397
13395
  if (props) {
13398
13396
  codegenNode.props = context.hoist(props);
@@ -13456,8 +13454,7 @@ function getConstantType(node, context) {
13456
13454
  if (codegenNode.isBlock && node.tag !== "svg" && node.tag !== "foreignObject" && node.tag !== "math") {
13457
13455
  return 0;
13458
13456
  }
13459
- const flag = getPatchFlag(codegenNode);
13460
- if (!flag) {
13457
+ if (codegenNode.patchFlag === void 0) {
13461
13458
  let returnType2 = 3;
13462
13459
  const generatedPropsType = getGeneratedPropsConstantType(node, context);
13463
13460
  if (generatedPropsType === 0) {
@@ -13599,10 +13596,6 @@ function getNodeProps(node) {
13599
13596
  return codegenNode.props;
13600
13597
  }
13601
13598
  }
13602
- function getPatchFlag(node) {
13603
- const flag = node.patchFlag;
13604
- return flag ? parseInt(flag, 10) : void 0;
13605
- }
13606
13599
 
13607
13600
  function createTransformContext(root, {
13608
13601
  filename = "",
@@ -13809,7 +13802,7 @@ function createRootCodegen(root, context) {
13809
13802
  helper(FRAGMENT),
13810
13803
  void 0,
13811
13804
  root.children,
13812
- patchFlag + (``),
13805
+ patchFlag,
13813
13806
  void 0,
13814
13807
  void 0,
13815
13808
  true,
@@ -14441,6 +14434,12 @@ function genVNodeCall(node, context) {
14441
14434
  disableTracking,
14442
14435
  isComponent
14443
14436
  } = node;
14437
+ let patchFlagString;
14438
+ if (patchFlag) {
14439
+ {
14440
+ patchFlagString = String(patchFlag);
14441
+ }
14442
+ }
14444
14443
  if (directives) {
14445
14444
  push(helper(WITH_DIRECTIVES) + `(`);
14446
14445
  }
@@ -14453,7 +14452,7 @@ function genVNodeCall(node, context) {
14453
14452
  const callHelper = isBlock ? getVNodeBlockHelper(context.inSSR, isComponent) : getVNodeHelper(context.inSSR, isComponent);
14454
14453
  push(helper(callHelper) + `(`, -2 /* None */, node);
14455
14454
  genNodeList(
14456
- genNullableArgs([tag, props, children, patchFlag, dynamicProps]),
14455
+ genNullableArgs([tag, props, children, patchFlagString, dynamicProps]),
14457
14456
  context
14458
14457
  );
14459
14458
  push(`)`);
@@ -14587,15 +14586,16 @@ function genConditionalExpression(node, context) {
14587
14586
  function genCacheExpression(node, context) {
14588
14587
  const { push, helper, indent, deindent, newline } = context;
14589
14588
  push(`_cache[${node.index}] || (`);
14590
- if (node.isVNode) {
14589
+ if (node.isVOnce) {
14591
14590
  indent();
14592
14591
  push(`${helper(SET_BLOCK_TRACKING)}(-1),`);
14593
14592
  newline();
14593
+ push(`(`);
14594
14594
  }
14595
14595
  push(`_cache[${node.index}] = `);
14596
14596
  genNode(node.value, context);
14597
- if (node.isVNode) {
14598
- push(`,`);
14597
+ if (node.isVOnce) {
14598
+ push(`).cacheIndex = ${node.index},`);
14599
14599
  newline();
14600
14600
  push(`${helper(SET_BLOCK_TRACKING)}(1),`);
14601
14601
  newline();
@@ -14821,7 +14821,7 @@ function processExpression(node, context, asParams = false, asRawStatements = fa
14821
14821
  node2.name = rewriteIdentifier(node2.name, parent, node2);
14822
14822
  ids.push(node2);
14823
14823
  } else {
14824
- if (!(needPrefix && isLocal) && parent.type !== "CallExpression" && parent.type !== "NewExpression" && parent.type !== "MemberExpression") {
14824
+ if (!(needPrefix && isLocal) && (!parent || parent.type !== "CallExpression" && parent.type !== "NewExpression" && parent.type !== "MemberExpression")) {
14825
14825
  node2.isConstant = true;
14826
14826
  }
14827
14827
  ids.push(node2);
@@ -15049,7 +15049,7 @@ function createChildrenCodegenNode(branch, keyIndex, context) {
15049
15049
  helper(FRAGMENT),
15050
15050
  createObjectExpression([keyProperty]),
15051
15051
  children,
15052
- patchFlag + (``),
15052
+ patchFlag,
15053
15053
  void 0,
15054
15054
  void 0,
15055
15055
  true,
@@ -15223,7 +15223,7 @@ const transformFor = createStructuralDirectiveTransform(
15223
15223
  helper(FRAGMENT),
15224
15224
  void 0,
15225
15225
  renderExp,
15226
- fragmentFlag + (``),
15226
+ fragmentFlag,
15227
15227
  void 0,
15228
15228
  void 0,
15229
15229
  true,
@@ -15263,7 +15263,7 @@ const transformFor = createStructuralDirectiveTransform(
15263
15263
  helper(FRAGMENT),
15264
15264
  keyProperty ? createObjectExpression([keyProperty]) : void 0,
15265
15265
  node.children,
15266
- 64 + (``),
15266
+ 64,
15267
15267
  void 0,
15268
15268
  void 0,
15269
15269
  true,
@@ -15712,7 +15712,6 @@ const transformElement = (node, context) => {
15712
15712
  const isDynamicComponent = isObject(vnodeTag) && vnodeTag.callee === RESOLVE_DYNAMIC_COMPONENT;
15713
15713
  let vnodeProps;
15714
15714
  let vnodeChildren;
15715
- let vnodePatchFlag;
15716
15715
  let patchFlag = 0;
15717
15716
  let vnodeDynamicProps;
15718
15717
  let dynamicPropNames;
@@ -15774,20 +15773,15 @@ const transformElement = (node, context) => {
15774
15773
  vnodeChildren = node.children;
15775
15774
  }
15776
15775
  }
15777
- if (patchFlag !== 0) {
15778
- {
15779
- vnodePatchFlag = String(patchFlag);
15780
- }
15781
- if (dynamicPropNames && dynamicPropNames.length) {
15782
- vnodeDynamicProps = stringifyDynamicPropNames(dynamicPropNames);
15783
- }
15776
+ if (dynamicPropNames && dynamicPropNames.length) {
15777
+ vnodeDynamicProps = stringifyDynamicPropNames(dynamicPropNames);
15784
15778
  }
15785
15779
  node.codegenNode = createVNodeCall(
15786
15780
  context,
15787
15781
  vnodeTag,
15788
15782
  vnodeProps,
15789
15783
  vnodeChildren,
15790
- vnodePatchFlag,
15784
+ patchFlag === 0 ? void 0 : patchFlag,
15791
15785
  vnodeDynamicProps,
15792
15786
  vnodeDirectives,
15793
15787
  !!shouldUseBlock,