@cabloy/vue-runtime-core 3.4.30 → 3.4.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @cabloy/vue-runtime-core v3.4.27
2
+ * @cabloy/vue-runtime-core v3.4.29
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -231,7 +231,8 @@ function flushPostFlushCbs(seen) {
231
231
  }
232
232
  activePostFlushCbs = deduped;
233
233
  for (postFlushIndex = 0; postFlushIndex < activePostFlushCbs.length; postFlushIndex++) {
234
- activePostFlushCbs[postFlushIndex]();
234
+ const cb = activePostFlushCbs[postFlushIndex];
235
+ if (cb.active !== false) cb();
235
236
  }
236
237
  activePostFlushCbs = null;
237
238
  postFlushIndex = 0;
@@ -241,10 +242,8 @@ const getId = (job) => job.id == null ? Infinity : job.id;
241
242
  const comparator = (a, b) => {
242
243
  const diff = getId(a) - getId(b);
243
244
  if (diff === 0) {
244
- if (a.pre && !b.pre)
245
- return -1;
246
- if (b.pre && !a.pre)
247
- return 1;
245
+ if (a.pre && !b.pre) return -1;
246
+ if (b.pre && !a.pre) return 1;
248
247
  }
249
248
  return diff;
250
249
  };
@@ -273,8 +272,7 @@ function flushJobs(seen) {
273
272
  }
274
273
 
275
274
  function emit(instance, event, ...rawArgs) {
276
- if (instance.isUnmounted)
277
- return;
275
+ if (instance.isUnmounted) return;
278
276
  const props = instance.vnode.props || shared.EMPTY_OBJ;
279
277
  let args = rawArgs;
280
278
  const isModelListener = event.startsWith("update:");
@@ -386,8 +384,7 @@ function popScopeId() {
386
384
  }
387
385
  const withScopeId = (_id) => withCtx;
388
386
  function withCtx(fn, ctx = currentRenderingInstance, isNonScopedSlot) {
389
- if (!ctx)
390
- return fn;
387
+ if (!ctx) return fn;
391
388
  if (fn._n) {
392
389
  return fn;
393
390
  }
@@ -1077,7 +1074,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
1077
1074
  next() {
1078
1075
  return suspense.activeBranch && next(suspense.activeBranch);
1079
1076
  },
1080
- registerDep(instance, setupRenderEffect) {
1077
+ registerDep(instance, setupRenderEffect, optimized2) {
1081
1078
  const isInPendingSuspense = !!suspense.pendingBranch;
1082
1079
  if (isInPendingSuspense) {
1083
1080
  suspense.deps++;
@@ -1108,7 +1105,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
1108
1105
  hydratedEl ? null : next(instance.subTree),
1109
1106
  suspense,
1110
1107
  namespace,
1111
- optimized
1108
+ optimized2
1112
1109
  );
1113
1110
  if (placeholder) {
1114
1111
  remove(placeholder);
@@ -1232,244 +1229,55 @@ function isVNodeSuspensible(vnode) {
1232
1229
  return suspensible != null && suspensible !== false;
1233
1230
  }
1234
1231
 
1235
- const ssrContextKey = Symbol.for("v-scx");
1236
- const useSSRContext = () => {
1237
- {
1238
- const ctx = inject(ssrContextKey);
1239
- return ctx;
1240
- }
1241
- };
1242
-
1243
- function watchEffect(effect, options) {
1244
- return doWatch(effect, null, options);
1245
- }
1246
- function watchPostEffect(effect, options) {
1247
- return doWatch(
1248
- effect,
1249
- null,
1250
- { flush: "post" }
1251
- );
1252
- }
1253
- function watchSyncEffect(effect, options) {
1254
- return doWatch(
1255
- effect,
1256
- null,
1257
- { flush: "sync" }
1258
- );
1259
- }
1260
- const INITIAL_WATCHER_VALUE = {};
1261
- function watch(source, cb, options) {
1262
- return doWatch(source, cb, options);
1263
- }
1264
- function doWatch(source, cb, {
1265
- immediate,
1266
- deep,
1267
- flush,
1268
- once,
1269
- onTrack,
1270
- onTrigger
1271
- } = shared.EMPTY_OBJ) {
1272
- if (cb && once) {
1273
- const _cb = cb;
1274
- cb = (...args) => {
1275
- _cb(...args);
1276
- unwatch();
1277
- };
1278
- }
1279
- const instance = currentInstance;
1280
- const reactiveGetter = (source2) => deep === true ? source2 : (
1281
- // for deep: false, only traverse root-level properties
1282
- traverse(source2, deep === false ? 1 : void 0)
1283
- );
1284
- let getter;
1285
- let forceTrigger = false;
1286
- let isMultiSource = false;
1287
- if (reactivity.isRef(source)) {
1288
- getter = () => source.value;
1289
- forceTrigger = reactivity.isShallow(source);
1290
- } else if (reactivity.isReactive(source)) {
1291
- getter = () => reactiveGetter(source);
1292
- forceTrigger = true;
1293
- } else if (shared.isArray(source)) {
1294
- isMultiSource = true;
1295
- forceTrigger = source.some((s) => reactivity.isReactive(s) || reactivity.isShallow(s));
1296
- getter = () => source.map((s) => {
1297
- if (reactivity.isRef(s)) {
1298
- return s.value;
1299
- } else if (reactivity.isReactive(s)) {
1300
- return reactiveGetter(s);
1301
- } else if (shared.isFunction(s)) {
1302
- return callWithErrorHandling(s, instance, 2);
1303
- } else ;
1232
+ function injectHook(type, hook, target = currentInstance, prepend = false) {
1233
+ if (target) {
1234
+ const hooks = target[type] || (target[type] = []);
1235
+ const wrappedHook = hook.__weh || (hook.__weh = (...args) => {
1236
+ reactivity.pauseTracking();
1237
+ const reset = setCurrentInstance(target);
1238
+ const res = callWithAsyncErrorHandling(hook, target, type, args);
1239
+ reset();
1240
+ reactivity.resetTracking();
1241
+ return res;
1304
1242
  });
1305
- } else if (shared.isFunction(source)) {
1306
- if (cb) {
1307
- getter = () => callWithErrorHandling(source, instance, 2);
1308
- } else {
1309
- getter = () => {
1310
- if (cleanup) {
1311
- cleanup();
1312
- }
1313
- return callWithAsyncErrorHandling(
1314
- source,
1315
- instance,
1316
- 3,
1317
- [onCleanup]
1318
- );
1319
- };
1320
- }
1321
- } else {
1322
- getter = shared.NOOP;
1323
- }
1324
- if (cb && deep) {
1325
- const baseGetter = getter;
1326
- getter = () => traverse(baseGetter());
1327
- }
1328
- let cleanup;
1329
- let onCleanup = (fn) => {
1330
- cleanup = effect.onStop = () => {
1331
- callWithErrorHandling(fn, instance, 4);
1332
- cleanup = effect.onStop = void 0;
1333
- };
1334
- };
1335
- let ssrCleanup;
1336
- if (isInSSRComponentSetup) {
1337
- onCleanup = shared.NOOP;
1338
- if (!cb) {
1339
- getter();
1340
- } else if (immediate) {
1341
- callWithAsyncErrorHandling(cb, instance, 3, [
1342
- getter(),
1343
- isMultiSource ? [] : void 0,
1344
- onCleanup
1345
- ]);
1346
- }
1347
- if (flush === "sync") {
1348
- const ctx = useSSRContext();
1349
- ssrCleanup = ctx.__watcherHandles || (ctx.__watcherHandles = []);
1350
- } else {
1351
- return shared.NOOP;
1352
- }
1353
- }
1354
- let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
1355
- const job = () => {
1356
- if (!effect.active || !effect.dirty) {
1357
- return;
1358
- }
1359
- if (cb) {
1360
- const newValue = effect.run();
1361
- if (deep || forceTrigger || (isMultiSource ? newValue.some((v, i) => shared.hasChanged(v, oldValue[i])) : shared.hasChanged(newValue, oldValue)) || false) {
1362
- if (cleanup) {
1363
- cleanup();
1364
- }
1365
- callWithAsyncErrorHandling(cb, instance, 3, [
1366
- newValue,
1367
- // pass undefined as the old value when it's changed for the first time
1368
- oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
1369
- onCleanup
1370
- ]);
1371
- oldValue = newValue;
1372
- }
1373
- } else {
1374
- effect.run();
1375
- }
1376
- };
1377
- job.allowRecurse = !!cb;
1378
- let scheduler;
1379
- if (flush === "sync") {
1380
- scheduler = job;
1381
- } else if (flush === "post") {
1382
- scheduler = () => queuePostRenderEffect(job, instance && instance.suspense);
1383
- } else {
1384
- job.pre = true;
1385
- if (instance)
1386
- job.id = instance.uid;
1387
- scheduler = () => queueJob(job);
1388
- }
1389
- const effect = new reactivity.ReactiveEffect(getter, shared.NOOP, scheduler);
1390
- const scope = reactivity.getCurrentScope();
1391
- const unwatch = () => {
1392
- effect.stop();
1393
- if (scope) {
1394
- shared.remove(scope.effects, effect);
1395
- }
1396
- };
1397
- if (cb) {
1398
- if (immediate) {
1399
- job();
1243
+ if (prepend) {
1244
+ hooks.unshift(wrappedHook);
1400
1245
  } else {
1401
- oldValue = effect.run();
1246
+ hooks.push(wrappedHook);
1402
1247
  }
1403
- } else if (flush === "post") {
1404
- queuePostRenderEffect(
1405
- effect.run.bind(effect),
1406
- instance && instance.suspense
1407
- );
1408
- } else {
1409
- effect.run();
1410
- }
1411
- if (ssrCleanup)
1412
- ssrCleanup.push(unwatch);
1413
- return unwatch;
1414
- }
1415
- function instanceWatch(source, value, options) {
1416
- const publicThis = this.proxy;
1417
- const getter = shared.isString(source) ? source.includes(".") ? createPathGetter(publicThis, source) : () => publicThis[source] : source.bind(publicThis, publicThis);
1418
- let cb;
1419
- if (shared.isFunction(value)) {
1420
- cb = value;
1421
- } else {
1422
- cb = value.handler;
1423
- options = value;
1248
+ return wrappedHook;
1424
1249
  }
1425
- const reset = setCurrentInstance(this);
1426
- const res = doWatch(getter, cb.bind(publicThis), options);
1427
- reset();
1428
- return res;
1429
- }
1430
- function createPathGetter(ctx, path) {
1431
- const segments = path.split(".");
1432
- return () => {
1433
- let cur = ctx;
1434
- for (let i = 0; i < segments.length && cur; i++) {
1435
- cur = cur[segments[i]];
1436
- }
1437
- return cur;
1438
- };
1439
1250
  }
1440
- function traverse(value, depth = Infinity, seen) {
1441
- if (depth <= 0 || !shared.isObject(value) || value["__v_skip"]) {
1442
- return value;
1443
- }
1444
- seen = seen || /* @__PURE__ */ new Set();
1445
- if (seen.has(value)) {
1446
- return value;
1251
+ const createHook = (lifecycle) => (hook, target = currentInstance) => {
1252
+ if (!isInSSRComponentSetup || lifecycle === "sp") {
1253
+ injectHook(lifecycle, (...args) => hook(...args), target);
1447
1254
  }
1448
- seen.add(value);
1449
- depth--;
1450
- if (reactivity.isRef(value)) {
1451
- traverse(value.value, depth, seen);
1452
- } else if (shared.isArray(value)) {
1453
- for (let i = 0; i < value.length; i++) {
1454
- traverse(value[i], depth, seen);
1455
- }
1456
- } else if (shared.isSet(value) || shared.isMap(value)) {
1457
- value.forEach((v) => {
1458
- traverse(v, depth, seen);
1459
- });
1460
- } else if (shared.isPlainObject(value)) {
1461
- for (const key in value) {
1462
- traverse(value[key], depth, seen);
1463
- }
1255
+ if (lifecycle === "m" && (target == null ? void 0 : target.isMounted)) {
1256
+ hook();
1464
1257
  }
1465
- return value;
1258
+ };
1259
+ const onBeforeMount = createHook("bm");
1260
+ const onMounted = createHook("m");
1261
+ const onBeforeUpdate = createHook("bu");
1262
+ const onUpdated = createHook("u");
1263
+ const onBeforeUnmount = createHook("bum");
1264
+ const onUnmounted = createHook("um");
1265
+ const onServerPrefetch = createHook("sp");
1266
+ const onRenderTriggered = createHook(
1267
+ "rtg"
1268
+ );
1269
+ const onRenderTracked = createHook(
1270
+ "rtc"
1271
+ );
1272
+ function onErrorCaptured(hook, target = currentInstance) {
1273
+ injectHook("ec", hook, target);
1466
1274
  }
1467
1275
 
1468
1276
  function withDirectives(vnode, directives) {
1469
1277
  if (currentRenderingInstance === null) {
1470
1278
  return vnode;
1471
1279
  }
1472
- const instance = getExposeProxy(currentRenderingInstance) || currentRenderingInstance.proxy;
1280
+ const instance = getComponentPublicInstance(currentRenderingInstance);
1473
1281
  const bindings = vnode.dirs || (vnode.dirs = []);
1474
1282
  for (let i = 0; i < directives.length; i++) {
1475
1283
  let [dir, value, arg, modifiers = shared.EMPTY_OBJ] = directives[i];
@@ -1517,369 +1325,107 @@ function invokeDirectiveHook(vnode, prevVNode, instance, name) {
1517
1325
  }
1518
1326
  }
1519
1327
 
1520
- const leaveCbKey = Symbol("_leaveCb");
1521
- const enterCbKey = Symbol("_enterCb");
1522
- function useTransitionState() {
1523
- const state = {
1524
- isMounted: false,
1525
- isLeaving: false,
1526
- isUnmounting: false,
1527
- leavingVNodes: /* @__PURE__ */ new Map()
1528
- };
1529
- onMounted(() => {
1530
- state.isMounted = true;
1531
- });
1532
- onBeforeUnmount(() => {
1533
- state.isUnmounting = true;
1534
- });
1535
- return state;
1536
- }
1537
- const TransitionHookValidator = [Function, Array];
1538
- const BaseTransitionPropsValidators = {
1539
- mode: String,
1540
- appear: Boolean,
1541
- persisted: Boolean,
1542
- // enter
1543
- onBeforeEnter: TransitionHookValidator,
1544
- onEnter: TransitionHookValidator,
1545
- onAfterEnter: TransitionHookValidator,
1546
- onEnterCancelled: TransitionHookValidator,
1547
- // leave
1548
- onBeforeLeave: TransitionHookValidator,
1549
- onLeave: TransitionHookValidator,
1550
- onAfterLeave: TransitionHookValidator,
1551
- onLeaveCancelled: TransitionHookValidator,
1552
- // appear
1553
- onBeforeAppear: TransitionHookValidator,
1554
- onAppear: TransitionHookValidator,
1555
- onAfterAppear: TransitionHookValidator,
1556
- onAppearCancelled: TransitionHookValidator
1557
- };
1558
- const BaseTransitionImpl = {
1559
- name: `BaseTransition`,
1560
- props: BaseTransitionPropsValidators,
1561
- setup(props, { slots }) {
1562
- const instance = getCurrentInstance();
1563
- const state = useTransitionState();
1564
- return () => {
1565
- const children = slots.default && getTransitionRawChildren(slots.default(), true);
1566
- if (!children || !children.length) {
1567
- return;
1568
- }
1569
- let child = children[0];
1570
- if (children.length > 1) {
1571
- for (const c of children) {
1572
- if (c.type !== Comment) {
1573
- child = c;
1574
- break;
1575
- }
1576
- }
1577
- }
1578
- const rawProps = reactivity.toRaw(props);
1579
- const { mode } = rawProps;
1580
- if (state.isLeaving) {
1581
- return emptyPlaceholder(child);
1582
- }
1583
- const innerChild = getKeepAliveChild(child);
1584
- if (!innerChild) {
1585
- return emptyPlaceholder(child);
1586
- }
1587
- const enterHooks = resolveTransitionHooks(
1588
- innerChild,
1589
- rawProps,
1590
- state,
1591
- instance
1328
+ function renderList(source, renderItem, cache, index) {
1329
+ let ret;
1330
+ const cached = cache && cache[index];
1331
+ if (shared.isArray(source) || shared.isString(source)) {
1332
+ ret = new Array(source.length);
1333
+ for (let i = 0, l = source.length; i < l; i++) {
1334
+ ret[i] = renderItem(source[i], i, void 0, cached && cached[i]);
1335
+ }
1336
+ } else if (typeof source === "number") {
1337
+ ret = new Array(source);
1338
+ for (let i = 0; i < source; i++) {
1339
+ ret[i] = renderItem(i + 1, i, void 0, cached && cached[i]);
1340
+ }
1341
+ } else if (shared.isObject(source)) {
1342
+ if (source[Symbol.iterator]) {
1343
+ ret = Array.from(
1344
+ source,
1345
+ (item, i) => renderItem(item, i, void 0, cached && cached[i])
1592
1346
  );
1593
- setTransitionHooks(innerChild, enterHooks);
1594
- const oldChild = instance.subTree;
1595
- const oldInnerChild = oldChild && getKeepAliveChild(oldChild);
1596
- if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(innerChild, oldInnerChild)) {
1597
- const leavingHooks = resolveTransitionHooks(
1598
- oldInnerChild,
1599
- rawProps,
1600
- state,
1601
- instance
1602
- );
1603
- setTransitionHooks(oldInnerChild, leavingHooks);
1604
- if (mode === "out-in" && innerChild.type !== Comment) {
1605
- state.isLeaving = true;
1606
- leavingHooks.afterLeave = () => {
1607
- state.isLeaving = false;
1608
- if (instance.update.active !== false) {
1609
- instance.effect.dirty = true;
1610
- instance.update();
1611
- }
1612
- };
1613
- return emptyPlaceholder(child);
1614
- } else if (mode === "in-out" && innerChild.type !== Comment) {
1615
- leavingHooks.delayLeave = (el, earlyRemove, delayedLeave) => {
1616
- const leavingVNodesCache = getLeavingNodesForType(
1617
- state,
1618
- oldInnerChild
1619
- );
1620
- leavingVNodesCache[String(oldInnerChild.key)] = oldInnerChild;
1621
- el[leaveCbKey] = () => {
1622
- earlyRemove();
1623
- el[leaveCbKey] = void 0;
1624
- delete enterHooks.delayedLeave;
1625
- };
1626
- enterHooks.delayedLeave = delayedLeave;
1627
- };
1628
- }
1347
+ } else {
1348
+ const keys = Object.keys(source);
1349
+ ret = new Array(keys.length);
1350
+ for (let i = 0, l = keys.length; i < l; i++) {
1351
+ const key = keys[i];
1352
+ ret[i] = renderItem(source[key], key, i, cached && cached[i]);
1629
1353
  }
1630
- return child;
1631
- };
1354
+ }
1355
+ } else {
1356
+ ret = [];
1632
1357
  }
1633
- };
1634
- const BaseTransition = BaseTransitionImpl;
1635
- function getLeavingNodesForType(state, vnode) {
1636
- const { leavingVNodes } = state;
1637
- let leavingVNodesCache = leavingVNodes.get(vnode.type);
1638
- if (!leavingVNodesCache) {
1639
- leavingVNodesCache = /* @__PURE__ */ Object.create(null);
1640
- leavingVNodes.set(vnode.type, leavingVNodesCache);
1358
+ if (cache) {
1359
+ cache[index] = ret;
1641
1360
  }
1642
- return leavingVNodesCache;
1361
+ return ret;
1643
1362
  }
1644
- function resolveTransitionHooks(vnode, props, state, instance) {
1645
- const {
1646
- appear,
1647
- mode,
1648
- persisted = false,
1649
- onBeforeEnter,
1650
- onEnter,
1651
- onAfterEnter,
1652
- onEnterCancelled,
1653
- onBeforeLeave,
1654
- onLeave,
1655
- onAfterLeave,
1656
- onLeaveCancelled,
1657
- onBeforeAppear,
1658
- onAppear,
1659
- onAfterAppear,
1660
- onAppearCancelled
1661
- } = props;
1662
- const key = String(vnode.key);
1663
- const leavingVNodesCache = getLeavingNodesForType(state, vnode);
1664
- const callHook = (hook, args) => {
1665
- hook && callWithAsyncErrorHandling(
1666
- hook,
1667
- instance,
1668
- 9,
1669
- args
1670
- );
1671
- };
1672
- const callAsyncHook = (hook, args) => {
1673
- const done = args[1];
1674
- callHook(hook, args);
1675
- if (shared.isArray(hook)) {
1676
- if (hook.every((hook2) => hook2.length <= 1))
1677
- done();
1678
- } else if (hook.length <= 1) {
1679
- done();
1363
+
1364
+ function createSlots(slots, dynamicSlots) {
1365
+ for (let i = 0; i < dynamicSlots.length; i++) {
1366
+ const slot = dynamicSlots[i];
1367
+ if (shared.isArray(slot)) {
1368
+ for (let j = 0; j < slot.length; j++) {
1369
+ slots[slot[j].name] = slot[j].fn;
1370
+ }
1371
+ } else if (slot) {
1372
+ slots[slot.name] = slot.key ? (...args) => {
1373
+ const res = slot.fn(...args);
1374
+ if (res) res.key = slot.key;
1375
+ return res;
1376
+ } : slot.fn;
1680
1377
  }
1378
+ }
1379
+ return slots;
1380
+ }
1381
+
1382
+ /*! #__NO_SIDE_EFFECTS__ */
1383
+ // @__NO_SIDE_EFFECTS__
1384
+ function defineComponent(options, extraOptions) {
1385
+ return shared.isFunction(options) ? (
1386
+ // #8326: extend call and options.name access are considered side-effects
1387
+ // by Rollup, so we have to wrap it in a pure-annotated IIFE.
1388
+ /* @__PURE__ */ (() => shared.extend({ name: options.name }, extraOptions, { setup: options }))()
1389
+ ) : options;
1390
+ }
1391
+
1392
+ const isAsyncWrapper = (i) => !!i.type.__asyncLoader;
1393
+ /*! #__NO_SIDE_EFFECTS__ */
1394
+ // @__NO_SIDE_EFFECTS__
1395
+ function defineAsyncComponent(source) {
1396
+ if (shared.isFunction(source)) {
1397
+ source = { loader: source };
1398
+ }
1399
+ const {
1400
+ loader,
1401
+ loadingComponent,
1402
+ errorComponent,
1403
+ delay = 200,
1404
+ timeout,
1405
+ // undefined = never times out
1406
+ suspensible = true,
1407
+ onError: userOnError
1408
+ } = source;
1409
+ let pendingRequest = null;
1410
+ let resolvedComp;
1411
+ let retries = 0;
1412
+ const retry = () => {
1413
+ retries++;
1414
+ pendingRequest = null;
1415
+ return load();
1681
1416
  };
1682
- const hooks = {
1683
- mode,
1684
- persisted,
1685
- beforeEnter(el) {
1686
- let hook = onBeforeEnter;
1687
- if (!state.isMounted) {
1688
- if (appear) {
1689
- hook = onBeforeAppear || onBeforeEnter;
1690
- } else {
1691
- return;
1692
- }
1693
- }
1694
- if (el[leaveCbKey]) {
1695
- el[leaveCbKey](
1696
- true
1697
- /* cancelled */
1698
- );
1699
- }
1700
- const leavingVNode = leavingVNodesCache[key];
1701
- if (leavingVNode && isSameVNodeType(vnode, leavingVNode) && leavingVNode.el[leaveCbKey]) {
1702
- leavingVNode.el[leaveCbKey]();
1703
- }
1704
- callHook(hook, [el]);
1705
- },
1706
- enter(el) {
1707
- let hook = onEnter;
1708
- let afterHook = onAfterEnter;
1709
- let cancelHook = onEnterCancelled;
1710
- if (!state.isMounted) {
1711
- if (appear) {
1712
- hook = onAppear || onEnter;
1713
- afterHook = onAfterAppear || onAfterEnter;
1714
- cancelHook = onAppearCancelled || onEnterCancelled;
1715
- } else {
1716
- return;
1717
- }
1718
- }
1719
- let called = false;
1720
- const done = el[enterCbKey] = (cancelled) => {
1721
- if (called)
1722
- return;
1723
- called = true;
1724
- if (cancelled) {
1725
- callHook(cancelHook, [el]);
1726
- } else {
1727
- callHook(afterHook, [el]);
1728
- }
1729
- if (hooks.delayedLeave) {
1730
- hooks.delayedLeave();
1731
- }
1732
- el[enterCbKey] = void 0;
1733
- };
1734
- if (hook) {
1735
- callAsyncHook(hook, [el, done]);
1736
- } else {
1737
- done();
1738
- }
1739
- },
1740
- leave(el, remove) {
1741
- const key2 = String(vnode.key);
1742
- if (el[enterCbKey]) {
1743
- el[enterCbKey](
1744
- true
1745
- /* cancelled */
1746
- );
1747
- }
1748
- if (state.isUnmounting) {
1749
- return remove();
1750
- }
1751
- callHook(onBeforeLeave, [el]);
1752
- let called = false;
1753
- const done = el[leaveCbKey] = (cancelled) => {
1754
- if (called)
1755
- return;
1756
- called = true;
1757
- remove();
1758
- if (cancelled) {
1759
- callHook(onLeaveCancelled, [el]);
1760
- } else {
1761
- callHook(onAfterLeave, [el]);
1762
- }
1763
- el[leaveCbKey] = void 0;
1764
- if (leavingVNodesCache[key2] === vnode) {
1765
- delete leavingVNodesCache[key2];
1766
- }
1767
- };
1768
- leavingVNodesCache[key2] = vnode;
1769
- if (onLeave) {
1770
- callAsyncHook(onLeave, [el, done]);
1771
- } else {
1772
- done();
1773
- }
1774
- },
1775
- clone(vnode2) {
1776
- return resolveTransitionHooks(vnode2, props, state, instance);
1777
- }
1778
- };
1779
- return hooks;
1780
- }
1781
- function emptyPlaceholder(vnode) {
1782
- if (isKeepAlive(vnode)) {
1783
- vnode = cloneVNode(vnode);
1784
- vnode.children = null;
1785
- return vnode;
1786
- }
1787
- }
1788
- function getKeepAliveChild(vnode) {
1789
- if (!isKeepAlive(vnode)) {
1790
- return vnode;
1791
- }
1792
- const { shapeFlag, children } = vnode;
1793
- if (children) {
1794
- if (shapeFlag & 16) {
1795
- return children[0];
1796
- }
1797
- if (shapeFlag & 32 && shared.isFunction(children.default)) {
1798
- return children.default();
1799
- }
1800
- }
1801
- }
1802
- function setTransitionHooks(vnode, hooks) {
1803
- if (vnode.shapeFlag & 6 && vnode.component) {
1804
- setTransitionHooks(vnode.component.subTree, hooks);
1805
- } else if (vnode.shapeFlag & 128) {
1806
- vnode.ssContent.transition = hooks.clone(vnode.ssContent);
1807
- vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
1808
- } else {
1809
- vnode.transition = hooks;
1810
- }
1811
- }
1812
- function getTransitionRawChildren(children, keepComment = false, parentKey) {
1813
- let ret = [];
1814
- let keyedFragmentCount = 0;
1815
- for (let i = 0; i < children.length; i++) {
1816
- let child = children[i];
1817
- const key = parentKey == null ? child.key : String(parentKey) + String(child.key != null ? child.key : i);
1818
- if (child.type === Fragment) {
1819
- if (child.patchFlag & 128)
1820
- keyedFragmentCount++;
1821
- ret = ret.concat(
1822
- getTransitionRawChildren(child.children, keepComment, key)
1823
- );
1824
- } else if (keepComment || child.type !== Comment) {
1825
- ret.push(key != null ? cloneVNode(child, { key }) : child);
1826
- }
1827
- }
1828
- if (keyedFragmentCount > 1) {
1829
- for (let i = 0; i < ret.length; i++) {
1830
- ret[i].patchFlag = -2;
1831
- }
1832
- }
1833
- return ret;
1834
- }
1835
-
1836
- /*! #__NO_SIDE_EFFECTS__ */
1837
- // @__NO_SIDE_EFFECTS__
1838
- function defineComponent(options, extraOptions) {
1839
- return shared.isFunction(options) ? (
1840
- // #8326: extend call and options.name access are considered side-effects
1841
- // by Rollup, so we have to wrap it in a pure-annotated IIFE.
1842
- /* @__PURE__ */ (() => shared.extend({ name: options.name }, extraOptions, { setup: options }))()
1843
- ) : options;
1844
- }
1845
-
1846
- const isAsyncWrapper = (i) => !!i.type.__asyncLoader;
1847
- /*! #__NO_SIDE_EFFECTS__ */
1848
- // @__NO_SIDE_EFFECTS__
1849
- function defineAsyncComponent(source) {
1850
- if (shared.isFunction(source)) {
1851
- source = { loader: source };
1852
- }
1853
- const {
1854
- loader,
1855
- loadingComponent,
1856
- errorComponent,
1857
- delay = 200,
1858
- timeout,
1859
- // undefined = never times out
1860
- suspensible = true,
1861
- onError: userOnError
1862
- } = source;
1863
- let pendingRequest = null;
1864
- let resolvedComp;
1865
- let retries = 0;
1866
- const retry = () => {
1867
- retries++;
1868
- pendingRequest = null;
1869
- return load();
1870
- };
1871
- const load = () => {
1872
- let thisRequest;
1873
- return pendingRequest || (thisRequest = pendingRequest = loader().catch((err) => {
1874
- err = err instanceof Error ? err : new Error(String(err));
1875
- if (userOnError) {
1876
- return new Promise((resolve, reject) => {
1877
- const userRetry = () => resolve(retry());
1878
- const userFail = () => reject(err);
1879
- userOnError(err, userRetry, userFail, retries + 1);
1880
- });
1881
- } else {
1882
- throw err;
1417
+ const load = () => {
1418
+ let thisRequest;
1419
+ return pendingRequest || (thisRequest = pendingRequest = loader().catch((err) => {
1420
+ err = err instanceof Error ? err : new Error(String(err));
1421
+ if (userOnError) {
1422
+ return new Promise((resolve, reject) => {
1423
+ const userRetry = () => resolve(retry());
1424
+ const userFail = () => reject(err);
1425
+ userOnError(err, userRetry, userFail, retries + 1);
1426
+ });
1427
+ } else {
1428
+ throw err;
1883
1429
  }
1884
1430
  }).then((comp) => {
1885
1431
  if (thisRequest !== pendingRequest && pendingRequest) {
@@ -1974,404 +1520,56 @@ function createInnerComp(comp, parent) {
1974
1520
  return vnode;
1975
1521
  }
1976
1522
 
1977
- const isKeepAlive = (vnode) => vnode.type.__isKeepAlive;
1978
- const KeepAliveImpl = {
1979
- name: `KeepAlive`,
1980
- // Marker for special handling inside the renderer. We are not using a ===
1981
- // check directly on KeepAlive in the renderer, because importing it directly
1982
- // would prevent it from being tree-shaken.
1983
- __isKeepAlive: true,
1984
- props: {
1985
- include: [String, RegExp, Array],
1986
- exclude: [String, RegExp, Array],
1987
- max: [String, Number]
1988
- },
1989
- setup(props, { slots }) {
1990
- const instance = getCurrentInstance();
1991
- const sharedContext = instance.ctx;
1992
- if (!sharedContext.renderer) {
1993
- return () => {
1994
- const children = slots.default && slots.default();
1995
- return children && children.length === 1 ? children[0] : children;
1996
- };
1997
- }
1998
- const cache = /* @__PURE__ */ new Map();
1999
- const keys = /* @__PURE__ */ new Set();
2000
- let current = null;
2001
- const parentSuspense = instance.suspense;
2002
- const {
2003
- renderer: {
2004
- p: patch,
2005
- m: move,
2006
- um: _unmount,
2007
- o: { createElement }
2008
- }
2009
- } = sharedContext;
2010
- const storageContainer = createElement("div");
2011
- sharedContext.activate = (vnode, container, anchor, namespace, optimized) => {
2012
- const instance2 = vnode.component;
2013
- move(vnode, container, anchor, 0, parentSuspense);
2014
- patch(
2015
- instance2.vnode,
2016
- vnode,
2017
- container,
2018
- anchor,
2019
- instance2,
2020
- parentSuspense,
2021
- namespace,
2022
- vnode.slotScopeIds,
2023
- optimized
2024
- );
2025
- queuePostRenderEffect(() => {
2026
- instance2.isDeactivated = false;
2027
- if (instance2.a) {
2028
- shared.invokeArrayFns(instance2.a);
2029
- }
2030
- const vnodeHook = vnode.props && vnode.props.onVnodeMounted;
2031
- if (vnodeHook) {
2032
- invokeVNodeHook(vnodeHook, instance2.parent, vnode);
2033
- }
2034
- }, parentSuspense);
2035
- };
2036
- sharedContext.deactivate = (vnode) => {
2037
- const instance2 = vnode.component;
2038
- move(vnode, storageContainer, null, 1, parentSuspense);
2039
- queuePostRenderEffect(() => {
2040
- if (instance2.da) {
2041
- shared.invokeArrayFns(instance2.da);
2042
- }
2043
- const vnodeHook = vnode.props && vnode.props.onVnodeUnmounted;
2044
- if (vnodeHook) {
2045
- invokeVNodeHook(vnodeHook, instance2.parent, vnode);
2046
- }
2047
- instance2.isDeactivated = true;
2048
- }, parentSuspense);
2049
- };
2050
- function unmount(vnode) {
2051
- resetShapeFlag(vnode);
2052
- _unmount(vnode, instance, parentSuspense, true);
2053
- }
2054
- function pruneCache(filter) {
2055
- cache.forEach((vnode, key) => {
2056
- const name = getComponentName(vnode.type);
2057
- if (name && (!filter || !filter(name))) {
2058
- pruneCacheEntry(key);
2059
- }
2060
- });
2061
- }
2062
- function pruneCacheEntry(key) {
2063
- const cached = cache.get(key);
2064
- if (!current || !isSameVNodeType(cached, current)) {
2065
- unmount(cached);
2066
- } else if (current) {
2067
- resetShapeFlag(current);
2068
- }
2069
- cache.delete(key);
2070
- keys.delete(key);
2071
- }
2072
- watch(
2073
- () => [props.include, props.exclude],
2074
- ([include, exclude]) => {
2075
- include && pruneCache((name) => matches(include, name));
2076
- exclude && pruneCache((name) => !matches(exclude, name));
2077
- },
2078
- // prune post-render after `current` has been updated
2079
- { flush: "post", deep: true }
2080
- );
2081
- let pendingCacheKey = null;
2082
- const cacheSubtree = () => {
2083
- if (pendingCacheKey != null) {
2084
- if (isSuspense(instance.subTree.type)) {
2085
- queuePostRenderEffect(() => {
2086
- cache.set(pendingCacheKey, getInnerChild(instance.subTree));
2087
- }, instance.subTree.suspense);
2088
- } else {
2089
- cache.set(pendingCacheKey, getInnerChild(instance.subTree));
2090
- }
2091
- }
2092
- };
2093
- onMounted(cacheSubtree);
2094
- onUpdated(cacheSubtree);
2095
- onBeforeUnmount(() => {
2096
- cache.forEach((cached) => {
2097
- const { subTree, suspense } = instance;
2098
- const vnode = getInnerChild(subTree);
2099
- if (cached.type === vnode.type && cached.key === vnode.key) {
2100
- resetShapeFlag(vnode);
2101
- const da = vnode.component.da;
2102
- da && queuePostRenderEffect(da, suspense);
2103
- return;
2104
- }
2105
- unmount(cached);
2106
- });
2107
- });
2108
- return () => {
2109
- pendingCacheKey = null;
2110
- if (!slots.default) {
2111
- return null;
2112
- }
2113
- const children = slots.default();
2114
- const rawVNode = children[0];
2115
- if (children.length > 1) {
2116
- current = null;
2117
- return children;
2118
- } else if (!isVNode(rawVNode) || !(rawVNode.shapeFlag & 4) && !(rawVNode.shapeFlag & 128)) {
2119
- current = null;
2120
- return rawVNode;
2121
- }
2122
- let vnode = getInnerChild(rawVNode);
2123
- const comp = vnode.type;
2124
- const name = getComponentName(
2125
- isAsyncWrapper(vnode) ? vnode.type.__asyncResolved || {} : comp
2126
- );
2127
- const { include, exclude, max } = props;
2128
- if (include && (!name || !matches(include, name)) || exclude && name && matches(exclude, name)) {
2129
- current = vnode;
2130
- return rawVNode;
2131
- }
2132
- const key = vnode.key == null ? comp : vnode.key;
2133
- const cachedVNode = cache.get(key);
2134
- if (vnode.el) {
2135
- vnode = cloneVNode(vnode);
2136
- if (rawVNode.shapeFlag & 128) {
2137
- rawVNode.ssContent = vnode;
2138
- }
2139
- }
2140
- pendingCacheKey = key;
2141
- if (cachedVNode) {
2142
- vnode.el = cachedVNode.el;
2143
- vnode.component = cachedVNode.component;
2144
- if (vnode.transition) {
2145
- setTransitionHooks(vnode, vnode.transition);
2146
- }
2147
- vnode.shapeFlag |= 512;
2148
- keys.delete(key);
2149
- keys.add(key);
2150
- } else {
2151
- keys.add(key);
2152
- if (max && keys.size > parseInt(max, 10)) {
2153
- pruneCacheEntry(keys.values().next().value);
2154
- }
2155
- }
2156
- vnode.shapeFlag |= 256;
2157
- current = vnode;
2158
- return isSuspense(rawVNode.type) ? rawVNode : vnode;
2159
- };
2160
- }
2161
- };
2162
- const KeepAlive = KeepAliveImpl;
2163
- function matches(pattern, name) {
2164
- if (shared.isArray(pattern)) {
2165
- return pattern.some((p) => matches(p, name));
2166
- } else if (shared.isString(pattern)) {
2167
- return pattern.split(",").includes(name);
2168
- } else if (shared.isRegExp(pattern)) {
2169
- return pattern.test(name);
1523
+ function renderSlot(slots, name, props = {}, fallback, noSlotted) {
1524
+ if (currentRenderingInstance.isCE || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.isCE) {
1525
+ if (name !== "default") props.name = name;
1526
+ return createVNode("slot", props, fallback && fallback());
2170
1527
  }
2171
- return false;
2172
- }
2173
- function onActivated(hook, target) {
2174
- registerKeepAliveHook(hook, "a", target);
2175
- }
2176
- function onDeactivated(hook, target) {
2177
- registerKeepAliveHook(hook, "da", target);
2178
- }
2179
- function registerKeepAliveHook(hook, type, target = currentInstance) {
2180
- const wrappedHook = hook.__wdc || (hook.__wdc = () => {
2181
- let current = target;
2182
- while (current) {
2183
- if (current.isDeactivated) {
2184
- return;
2185
- }
2186
- current = current.parent;
2187
- }
2188
- return hook();
2189
- });
2190
- injectHook(type, wrappedHook, target);
2191
- if (target) {
2192
- let current = target.parent;
2193
- while (current && current.parent) {
2194
- if (isKeepAlive(current.parent.vnode)) {
2195
- injectToKeepAliveRoot(wrappedHook, type, target, current);
2196
- }
2197
- current = current.parent;
2198
- }
1528
+ let slot = slots[name];
1529
+ if (slot && slot._c) {
1530
+ slot._d = false;
2199
1531
  }
2200
- }
2201
- function injectToKeepAliveRoot(hook, type, target, keepAliveRoot) {
2202
- const injected = injectHook(
2203
- type,
2204
- hook,
2205
- keepAliveRoot,
2206
- true
2207
- /* prepend */
1532
+ openBlock();
1533
+ const validSlotContent = slot && ensureValidVNode(slot(props));
1534
+ const rendered = createBlock(
1535
+ Fragment,
1536
+ {
1537
+ key: props.key || // slot content array of a dynamic conditional slot may have a branch
1538
+ // key attached in the `createSlots` helper, respect that
1539
+ validSlotContent && validSlotContent.key || `_${name}`
1540
+ },
1541
+ validSlotContent || (fallback ? fallback() : []),
1542
+ validSlotContent && slots._ === 1 ? 64 : -2
2208
1543
  );
2209
- onUnmounted(() => {
2210
- shared.remove(keepAliveRoot[type], injected);
2211
- }, target);
2212
- }
2213
- function resetShapeFlag(vnode) {
2214
- vnode.shapeFlag &= ~256;
2215
- vnode.shapeFlag &= ~512;
1544
+ if (!noSlotted && rendered.scopeId) {
1545
+ rendered.slotScopeIds = [rendered.scopeId + "-s"];
1546
+ }
1547
+ if (slot && slot._c) {
1548
+ slot._d = true;
1549
+ }
1550
+ return rendered;
2216
1551
  }
2217
- function getInnerChild(vnode) {
2218
- return vnode.shapeFlag & 128 ? vnode.ssContent : vnode;
1552
+ function ensureValidVNode(vnodes) {
1553
+ return vnodes.some((child) => {
1554
+ if (!isVNode(child)) return true;
1555
+ if (child.type === Comment) return false;
1556
+ if (child.type === Fragment && !ensureValidVNode(child.children))
1557
+ return false;
1558
+ return true;
1559
+ }) ? vnodes : null;
2219
1560
  }
2220
1561
 
2221
- function injectHook(type, hook, target = currentInstance, prepend = false) {
2222
- if (target) {
2223
- const hooks = target[type] || (target[type] = []);
2224
- const wrappedHook = hook.__weh || (hook.__weh = (...args) => {
2225
- if (target.isUnmounted) {
2226
- return;
2227
- }
2228
- reactivity.pauseTracking();
2229
- const reset = setCurrentInstance(target);
2230
- const res = callWithAsyncErrorHandling(hook, target, type, args);
2231
- reset();
2232
- reactivity.resetTracking();
2233
- return res;
2234
- });
2235
- if (prepend) {
2236
- hooks.unshift(wrappedHook);
2237
- } else {
2238
- hooks.push(wrappedHook);
2239
- }
2240
- return wrappedHook;
2241
- }
2242
- }
2243
- const createHook = (lifecycle) => (hook, target = currentInstance) => {
2244
- if (!isInSSRComponentSetup || lifecycle === "sp") {
2245
- injectHook(lifecycle, (...args) => hook(...args), target);
1562
+ function toHandlers(obj, preserveCaseIfNecessary) {
1563
+ const ret = {};
1564
+ for (const key in obj) {
1565
+ ret[preserveCaseIfNecessary && /[A-Z]/.test(key) ? `on:${key}` : shared.toHandlerKey(key)] = obj[key];
2246
1566
  }
2247
- };
2248
- const onBeforeMount = createHook("bm");
2249
- const onMounted = createHook("m");
2250
- const onBeforeUpdate = createHook("bu");
2251
- const onUpdated = createHook("u");
2252
- const onBeforeUnmount = createHook("bum");
2253
- const onUnmounted = createHook("um");
2254
- const onServerPrefetch = createHook("sp");
2255
- const onRenderTriggered = createHook(
2256
- "rtg"
2257
- );
2258
- const onRenderTracked = createHook(
2259
- "rtc"
2260
- );
2261
- function onErrorCaptured(hook, target = currentInstance) {
2262
- injectHook("ec", hook, target);
2263
- }
2264
-
2265
- function renderList(source, renderItem, cache, index) {
2266
- let ret;
2267
- const cached = cache && cache[index];
2268
- if (shared.isArray(source) || shared.isString(source)) {
2269
- ret = new Array(source.length);
2270
- for (let i = 0, l = source.length; i < l; i++) {
2271
- ret[i] = renderItem(source[i], i, void 0, cached && cached[i]);
2272
- }
2273
- } else if (typeof source === "number") {
2274
- ret = new Array(source);
2275
- for (let i = 0; i < source; i++) {
2276
- ret[i] = renderItem(i + 1, i, void 0, cached && cached[i]);
2277
- }
2278
- } else if (shared.isObject(source)) {
2279
- if (source[Symbol.iterator]) {
2280
- ret = Array.from(
2281
- source,
2282
- (item, i) => renderItem(item, i, void 0, cached && cached[i])
2283
- );
2284
- } else {
2285
- const keys = Object.keys(source);
2286
- ret = new Array(keys.length);
2287
- for (let i = 0, l = keys.length; i < l; i++) {
2288
- const key = keys[i];
2289
- ret[i] = renderItem(source[key], key, i, cached && cached[i]);
2290
- }
2291
- }
2292
- } else {
2293
- ret = [];
2294
- }
2295
- if (cache) {
2296
- cache[index] = ret;
2297
- }
2298
- return ret;
2299
- }
2300
-
2301
- function createSlots(slots, dynamicSlots) {
2302
- for (let i = 0; i < dynamicSlots.length; i++) {
2303
- const slot = dynamicSlots[i];
2304
- if (shared.isArray(slot)) {
2305
- for (let j = 0; j < slot.length; j++) {
2306
- slots[slot[j].name] = slot[j].fn;
2307
- }
2308
- } else if (slot) {
2309
- slots[slot.name] = slot.key ? (...args) => {
2310
- const res = slot.fn(...args);
2311
- if (res)
2312
- res.key = slot.key;
2313
- return res;
2314
- } : slot.fn;
2315
- }
2316
- }
2317
- return slots;
2318
- }
2319
-
2320
- function renderSlot(slots, name, props = {}, fallback, noSlotted) {
2321
- if (currentRenderingInstance.isCE || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.isCE) {
2322
- if (name !== "default")
2323
- props.name = name;
2324
- return createVNode("slot", props, fallback && fallback());
2325
- }
2326
- let slot = slots[name];
2327
- if (slot && slot._c) {
2328
- slot._d = false;
2329
- }
2330
- openBlock();
2331
- const validSlotContent = slot && ensureValidVNode(slot(props));
2332
- const rendered = createBlock(
2333
- Fragment,
2334
- {
2335
- key: props.key || // slot content array of a dynamic conditional slot may have a branch
2336
- // key attached in the `createSlots` helper, respect that
2337
- validSlotContent && validSlotContent.key || `_${name}`
2338
- },
2339
- validSlotContent || (fallback ? fallback() : []),
2340
- validSlotContent && slots._ === 1 ? 64 : -2
2341
- );
2342
- if (!noSlotted && rendered.scopeId) {
2343
- rendered.slotScopeIds = [rendered.scopeId + "-s"];
2344
- }
2345
- if (slot && slot._c) {
2346
- slot._d = true;
2347
- }
2348
- return rendered;
2349
- }
2350
- function ensureValidVNode(vnodes) {
2351
- return vnodes.some((child) => {
2352
- if (!isVNode(child))
2353
- return true;
2354
- if (child.type === Comment)
2355
- return false;
2356
- if (child.type === Fragment && !ensureValidVNode(child.children))
2357
- return false;
2358
- return true;
2359
- }) ? vnodes : null;
2360
- }
2361
-
2362
- function toHandlers(obj, preserveCaseIfNecessary) {
2363
- const ret = {};
2364
- for (const key in obj) {
2365
- ret[preserveCaseIfNecessary && /[A-Z]/.test(key) ? `on:${key}` : shared.toHandlerKey(key)] = obj[key];
2366
- }
2367
- return ret;
1567
+ return ret;
2368
1568
  }
2369
1569
 
2370
1570
  const getPublicInstance = (i) => {
2371
- if (!i)
2372
- return null;
2373
- if (isStatefulComponent(i))
2374
- return getExposeProxy(i) || i.proxy;
1571
+ if (!i) return null;
1572
+ if (isStatefulComponent(i)) return getComponentPublicInstance(i);
2375
1573
  return getPublicInstance(i.parent);
2376
1574
  };
2377
1575
  const publicPropertiesMap = (
@@ -2551,8 +1749,7 @@ function normalizePropsOrEmits(props) {
2551
1749
  function mergeDefaults(raw, defaults) {
2552
1750
  const props = normalizePropsOrEmits(raw);
2553
1751
  for (const key in defaults) {
2554
- if (key.startsWith("__skip"))
2555
- continue;
1752
+ if (key.startsWith("__skip")) continue;
2556
1753
  let opt = props[key];
2557
1754
  if (opt) {
2558
1755
  if (shared.isArray(opt) || shared.isFunction(opt)) {
@@ -2570,10 +1767,8 @@ function mergeDefaults(raw, defaults) {
2570
1767
  return props;
2571
1768
  }
2572
1769
  function mergeModels(a, b) {
2573
- if (!a || !b)
2574
- return a || b;
2575
- if (shared.isArray(a) && shared.isArray(b))
2576
- return a.concat(b);
1770
+ if (!a || !b) return a || b;
1771
+ if (shared.isArray(a) && shared.isArray(b)) return a.concat(b);
2577
1772
  return shared.extend({}, normalizePropsOrEmits(a), normalizePropsOrEmits(b));
2578
1773
  }
2579
1774
  function createPropsRestProxy(props, excludedKeys) {
@@ -2733,10 +1928,8 @@ function applyOptions(instance) {
2733
1928
  if (inheritAttrs != null) {
2734
1929
  instance.inheritAttrs = inheritAttrs;
2735
1930
  }
2736
- if (components)
2737
- instance.components = components;
2738
- if (directives)
2739
- instance.directives = directives;
1931
+ if (components) instance.components = components;
1932
+ if (directives) instance.directives = directives;
2740
1933
  }
2741
1934
  function resolveInjections(injectOptions, ctx, checkDuplicateProperties = shared.NOOP) {
2742
1935
  if (shared.isArray(injectOptions)) {
@@ -2924,10 +2117,8 @@ function mergeEmitsOrPropsOptions(to, from) {
2924
2117
  }
2925
2118
  }
2926
2119
  function mergeWatchOptions(to, from) {
2927
- if (!to)
2928
- return from;
2929
- if (!from)
2930
- return to;
2120
+ if (!to) return from;
2121
+ if (!from) return to;
2931
2122
  const merged = shared.extend(/* @__PURE__ */ Object.create(null), to);
2932
2123
  for (const key in from) {
2933
2124
  merged[key] = mergeAsArray(to[key], from[key]);
@@ -3030,7 +2221,7 @@ function createAppAPI(render, hydrate) {
3030
2221
  isMounted = true;
3031
2222
  app._container = rootContainer;
3032
2223
  rootContainer.__vue_app__ = app;
3033
- return getExposeProxy(vnode.component) || vnode.component.proxy;
2224
+ return getComponentPublicInstance(vnode.component);
3034
2225
  }
3035
2226
  },
3036
2227
  unmount() {
@@ -3286,8 +2477,7 @@ function normalizePropsOptions(comp, appContext, asMixin = false) {
3286
2477
  hasExtends = true;
3287
2478
  const [props, keys] = normalizePropsOptions(raw2, appContext, true);
3288
2479
  shared.extend(normalized, props);
3289
- if (keys)
3290
- needCastKeys.push(...keys);
2480
+ if (keys) needCastKeys.push(...keys);
3291
2481
  };
3292
2482
  if (!asMixin && appContext.mixins.length) {
3293
2483
  appContext.mixins.forEach(extendProps);
@@ -3382,8 +2572,7 @@ const normalizeSlot = (key, rawSlot, ctx) => {
3382
2572
  const normalizeObjectSlots = (rawSlots, slots, instance) => {
3383
2573
  const ctx = rawSlots._ctx;
3384
2574
  for (const key in rawSlots) {
3385
- if (isInternalKey(key))
3386
- continue;
2575
+ if (isInternalKey(key)) continue;
3387
2576
  const value = rawSlots[key];
3388
2577
  if (shared.isFunction(value)) {
3389
2578
  slots[key] = normalizeSlot(key, value, ctx);
@@ -3460,7 +2649,7 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
3460
2649
  if (isAsyncWrapper(vnode) && !isUnmount) {
3461
2650
  return;
3462
2651
  }
3463
- const refValue = vnode.shapeFlag & 4 ? getExposeProxy(vnode.component) || vnode.component.proxy : vnode.el;
2652
+ const refValue = vnode.shapeFlag & 4 ? getComponentPublicInstance(vnode.component) : vnode.el;
3464
2653
  const value = isUnmount ? null : refValue;
3465
2654
  const { i: owner, r: ref } = rawRef;
3466
2655
  const oldRef = oldRawRef && oldRawRef.r;
@@ -3496,8 +2685,7 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
3496
2685
  }
3497
2686
  } else {
3498
2687
  ref.value = [refValue];
3499
- if (rawRef.k)
3500
- refs[rawRef.k] = ref.value;
2688
+ if (rawRef.k) refs[rawRef.k] = ref.value;
3501
2689
  }
3502
2690
  } else if (!existing.includes(refValue)) {
3503
2691
  existing.push(refValue);
@@ -3510,8 +2698,7 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
3510
2698
  }
3511
2699
  } else if (_isRef) {
3512
2700
  ref.value = value;
3513
- if (rawRef.k)
3514
- refs[rawRef.k] = value;
2701
+ if (rawRef.k) refs[rawRef.k] = value;
3515
2702
  } else ;
3516
2703
  };
3517
2704
  if (value) {
@@ -3524,14 +2711,19 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
3524
2711
  }
3525
2712
  }
3526
2713
 
3527
- let hasMismatch = false;
2714
+ let hasLoggedMismatchError = false;
2715
+ const logMismatchError = () => {
2716
+ if (hasLoggedMismatchError) {
2717
+ return;
2718
+ }
2719
+ console.error("Hydration completed but contains mismatches.");
2720
+ hasLoggedMismatchError = true;
2721
+ };
3528
2722
  const isSVGContainer = (container) => container.namespaceURI.includes("svg") && container.tagName !== "foreignObject";
3529
2723
  const isMathMLContainer = (container) => container.namespaceURI.includes("MathML");
3530
2724
  const getContainerType = (container) => {
3531
- if (isSVGContainer(container))
3532
- return "svg";
3533
- if (isMathMLContainer(container))
3534
- return "mathml";
2725
+ if (isSVGContainer(container)) return "svg";
2726
+ if (isMathMLContainer(container)) return "mathml";
3535
2727
  return void 0;
3536
2728
  };
3537
2729
  const isComment = (node) => node.nodeType === 8 /* COMMENT */;
@@ -3556,13 +2748,9 @@ function createHydrationFunctions(rendererInternals) {
3556
2748
  container._vnode = vnode;
3557
2749
  return;
3558
2750
  }
3559
- hasMismatch = false;
3560
2751
  hydrateNode(container.firstChild, vnode, null, null, null);
3561
2752
  flushPostFlushCbs();
3562
2753
  container._vnode = vnode;
3563
- if (hasMismatch && true) {
3564
- console.error(`Hydration completed but contains mismatches.`);
3565
- }
3566
2754
  };
3567
2755
  const hydrateNode = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized = false) => {
3568
2756
  optimized = optimized || !!vnode.dynamicChildren;
@@ -3594,7 +2782,7 @@ function createHydrationFunctions(rendererInternals) {
3594
2782
  }
3595
2783
  } else {
3596
2784
  if (node.data !== vnode.children) {
3597
- hasMismatch = true;
2785
+ logMismatchError();
3598
2786
  node.data = vnode.children;
3599
2787
  }
3600
2788
  nextNode = nextSibling(node);
@@ -3757,14 +2945,14 @@ function createHydrationFunctions(rendererInternals) {
3757
2945
  optimized
3758
2946
  );
3759
2947
  while (next) {
3760
- hasMismatch = true;
2948
+ logMismatchError();
3761
2949
  const cur = next;
3762
2950
  next = next.nextSibling;
3763
2951
  remove(cur);
3764
2952
  }
3765
2953
  } else if (shapeFlag & 8) {
3766
2954
  if (el.textContent !== vnode.children) {
3767
- hasMismatch = true;
2955
+ logMismatchError();
3768
2956
  el.textContent = vnode.children;
3769
2957
  }
3770
2958
  }
@@ -3831,7 +3019,7 @@ function createHydrationFunctions(rendererInternals) {
3831
3019
  } else if (vnode.type === Text && !vnode.children) {
3832
3020
  insert(vnode.el = createText(""), container);
3833
3021
  } else {
3834
- hasMismatch = true;
3022
+ logMismatchError();
3835
3023
  patch(
3836
3024
  null,
3837
3025
  vnode,
@@ -3864,13 +3052,13 @@ function createHydrationFunctions(rendererInternals) {
3864
3052
  if (next && isComment(next) && next.data === "]") {
3865
3053
  return nextSibling(vnode.anchor = next);
3866
3054
  } else {
3867
- hasMismatch = true;
3055
+ logMismatchError();
3868
3056
  insert(vnode.anchor = createComment(`]`), container, next);
3869
3057
  return next;
3870
3058
  }
3871
3059
  };
3872
3060
  const handleMismatch = (node, vnode, parentComponent, parentSuspense, slotScopeIds, isFragment) => {
3873
- hasMismatch = true;
3061
+ logMismatchError();
3874
3062
  vnode.el = null;
3875
3063
  if (isFragment) {
3876
3064
  const end = locateClosingAnchor(node);
@@ -3903,8 +3091,7 @@ function createHydrationFunctions(rendererInternals) {
3903
3091
  while (node) {
3904
3092
  node = nextSibling(node);
3905
3093
  if (node && isComment(node)) {
3906
- if (node.data === open)
3907
- match++;
3094
+ if (node.data === open) match++;
3908
3095
  if (node.data === close) {
3909
3096
  if (match === 0) {
3910
3097
  return nextSibling(node);
@@ -4397,8 +3584,7 @@ function baseCreateRenderer(options, createHydrationFns) {
4397
3584
  }
4398
3585
  }
4399
3586
  for (const key in newProps) {
4400
- if (shared.isReservedProp(key))
4401
- continue;
3587
+ if (shared.isReservedProp(key)) continue;
4402
3588
  const next = newProps[key];
4403
3589
  const prev = oldProps[key];
4404
3590
  if (next !== prev && key !== "value") {
@@ -4525,7 +3711,7 @@ function baseCreateRenderer(options, createHydrationFns) {
4525
3711
  setupComponent(instance);
4526
3712
  }
4527
3713
  if (instance.asyncDep) {
4528
- parentSuspense && parentSuspense.registerDep(instance, setupRenderEffect);
3714
+ parentSuspense && parentSuspense.registerDep(instance, setupRenderEffect, optimized);
4529
3715
  if (!initialVNode.el) {
4530
3716
  const placeholder = instance.subTree = createVNode(Comment);
4531
3717
  processCommentNode(null, placeholder, container, anchor);
@@ -4747,571 +3933,1389 @@ function baseCreateRenderer(options, createHydrationFns) {
4747
3933
  return;
4748
3934
  }
4749
3935
  }
4750
- if (shapeFlag & 8) {
4751
- if (prevShapeFlag & 16) {
4752
- unmountChildren(c1, parentComponent, parentSuspense);
4753
- }
4754
- if (c2 !== c1) {
4755
- hostSetElementText(container, c2);
4756
- }
4757
- } else {
4758
- if (prevShapeFlag & 16) {
4759
- if (shapeFlag & 16) {
4760
- patchKeyedChildren(
4761
- c1,
4762
- c2,
4763
- container,
4764
- anchor,
4765
- parentComponent,
4766
- parentSuspense,
4767
- namespace,
4768
- slotScopeIds,
4769
- optimized
4770
- );
4771
- } else {
4772
- unmountChildren(c1, parentComponent, parentSuspense, true);
4773
- }
4774
- } else {
4775
- if (prevShapeFlag & 8) {
4776
- hostSetElementText(container, "");
4777
- }
4778
- if (shapeFlag & 16) {
4779
- mountChildren(
4780
- c2,
4781
- container,
4782
- anchor,
4783
- parentComponent,
4784
- parentSuspense,
4785
- namespace,
4786
- slotScopeIds,
4787
- optimized
4788
- );
4789
- }
3936
+ if (shapeFlag & 8) {
3937
+ if (prevShapeFlag & 16) {
3938
+ unmountChildren(c1, parentComponent, parentSuspense);
3939
+ }
3940
+ if (c2 !== c1) {
3941
+ hostSetElementText(container, c2);
3942
+ }
3943
+ } else {
3944
+ if (prevShapeFlag & 16) {
3945
+ if (shapeFlag & 16) {
3946
+ patchKeyedChildren(
3947
+ c1,
3948
+ c2,
3949
+ container,
3950
+ anchor,
3951
+ parentComponent,
3952
+ parentSuspense,
3953
+ namespace,
3954
+ slotScopeIds,
3955
+ optimized
3956
+ );
3957
+ } else {
3958
+ unmountChildren(c1, parentComponent, parentSuspense, true);
3959
+ }
3960
+ } else {
3961
+ if (prevShapeFlag & 8) {
3962
+ hostSetElementText(container, "");
3963
+ }
3964
+ if (shapeFlag & 16) {
3965
+ mountChildren(
3966
+ c2,
3967
+ container,
3968
+ anchor,
3969
+ parentComponent,
3970
+ parentSuspense,
3971
+ namespace,
3972
+ slotScopeIds,
3973
+ optimized
3974
+ );
3975
+ }
3976
+ }
3977
+ }
3978
+ };
3979
+ const patchUnkeyedChildren = (c1, c2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
3980
+ c1 = c1 || shared.EMPTY_ARR;
3981
+ c2 = c2 || shared.EMPTY_ARR;
3982
+ const oldLength = c1.length;
3983
+ const newLength = c2.length;
3984
+ const commonLength = Math.min(oldLength, newLength);
3985
+ let i;
3986
+ for (i = 0; i < commonLength; i++) {
3987
+ const nextChild = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
3988
+ patch(
3989
+ c1[i],
3990
+ nextChild,
3991
+ container,
3992
+ null,
3993
+ parentComponent,
3994
+ parentSuspense,
3995
+ namespace,
3996
+ slotScopeIds,
3997
+ optimized
3998
+ );
3999
+ }
4000
+ if (oldLength > newLength) {
4001
+ unmountChildren(
4002
+ c1,
4003
+ parentComponent,
4004
+ parentSuspense,
4005
+ true,
4006
+ false,
4007
+ commonLength
4008
+ );
4009
+ } else {
4010
+ mountChildren(
4011
+ c2,
4012
+ container,
4013
+ anchor,
4014
+ parentComponent,
4015
+ parentSuspense,
4016
+ namespace,
4017
+ slotScopeIds,
4018
+ optimized,
4019
+ commonLength
4020
+ );
4021
+ }
4022
+ };
4023
+ const patchKeyedChildren = (c1, c2, container, parentAnchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
4024
+ let i = 0;
4025
+ const l2 = c2.length;
4026
+ let e1 = c1.length - 1;
4027
+ let e2 = l2 - 1;
4028
+ while (i <= e1 && i <= e2) {
4029
+ const n1 = c1[i];
4030
+ const n2 = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
4031
+ if (isSameVNodeType(n1, n2)) {
4032
+ patch(
4033
+ n1,
4034
+ n2,
4035
+ container,
4036
+ null,
4037
+ parentComponent,
4038
+ parentSuspense,
4039
+ namespace,
4040
+ slotScopeIds,
4041
+ optimized
4042
+ );
4043
+ } else {
4044
+ break;
4045
+ }
4046
+ i++;
4047
+ }
4048
+ while (i <= e1 && i <= e2) {
4049
+ const n1 = c1[e1];
4050
+ const n2 = c2[e2] = optimized ? cloneIfMounted(c2[e2]) : normalizeVNode(c2[e2]);
4051
+ if (isSameVNodeType(n1, n2)) {
4052
+ patch(
4053
+ n1,
4054
+ n2,
4055
+ container,
4056
+ null,
4057
+ parentComponent,
4058
+ parentSuspense,
4059
+ namespace,
4060
+ slotScopeIds,
4061
+ optimized
4062
+ );
4063
+ } else {
4064
+ break;
4065
+ }
4066
+ e1--;
4067
+ e2--;
4068
+ }
4069
+ if (i > e1) {
4070
+ if (i <= e2) {
4071
+ const nextPos = e2 + 1;
4072
+ const anchor = nextPos < l2 ? c2[nextPos].el : parentAnchor;
4073
+ while (i <= e2) {
4074
+ patch(
4075
+ null,
4076
+ c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]),
4077
+ container,
4078
+ anchor,
4079
+ parentComponent,
4080
+ parentSuspense,
4081
+ namespace,
4082
+ slotScopeIds,
4083
+ optimized
4084
+ );
4085
+ i++;
4086
+ }
4087
+ }
4088
+ } else if (i > e2) {
4089
+ while (i <= e1) {
4090
+ unmount(c1[i], parentComponent, parentSuspense, true);
4091
+ i++;
4092
+ }
4093
+ } else {
4094
+ const s1 = i;
4095
+ const s2 = i;
4096
+ const keyToNewIndexMap = /* @__PURE__ */ new Map();
4097
+ for (i = s2; i <= e2; i++) {
4098
+ const nextChild = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
4099
+ if (nextChild.key != null) {
4100
+ keyToNewIndexMap.set(nextChild.key, i);
4101
+ }
4102
+ }
4103
+ let j;
4104
+ let patched = 0;
4105
+ const toBePatched = e2 - s2 + 1;
4106
+ let moved = false;
4107
+ let maxNewIndexSoFar = 0;
4108
+ const newIndexToOldIndexMap = new Array(toBePatched);
4109
+ for (i = 0; i < toBePatched; i++) newIndexToOldIndexMap[i] = 0;
4110
+ for (i = s1; i <= e1; i++) {
4111
+ const prevChild = c1[i];
4112
+ if (patched >= toBePatched) {
4113
+ unmount(prevChild, parentComponent, parentSuspense, true);
4114
+ continue;
4115
+ }
4116
+ let newIndex;
4117
+ if (prevChild.key != null) {
4118
+ newIndex = keyToNewIndexMap.get(prevChild.key);
4119
+ } else {
4120
+ for (j = s2; j <= e2; j++) {
4121
+ if (newIndexToOldIndexMap[j - s2] === 0 && isSameVNodeType(prevChild, c2[j])) {
4122
+ newIndex = j;
4123
+ break;
4124
+ }
4125
+ }
4126
+ }
4127
+ if (newIndex === void 0) {
4128
+ unmount(prevChild, parentComponent, parentSuspense, true);
4129
+ } else {
4130
+ newIndexToOldIndexMap[newIndex - s2] = i + 1;
4131
+ if (newIndex >= maxNewIndexSoFar) {
4132
+ maxNewIndexSoFar = newIndex;
4133
+ } else {
4134
+ moved = true;
4135
+ }
4136
+ patch(
4137
+ prevChild,
4138
+ c2[newIndex],
4139
+ container,
4140
+ null,
4141
+ parentComponent,
4142
+ parentSuspense,
4143
+ namespace,
4144
+ slotScopeIds,
4145
+ optimized
4146
+ );
4147
+ patched++;
4148
+ }
4149
+ }
4150
+ const increasingNewIndexSequence = moved ? getSequence(newIndexToOldIndexMap) : shared.EMPTY_ARR;
4151
+ j = increasingNewIndexSequence.length - 1;
4152
+ for (i = toBePatched - 1; i >= 0; i--) {
4153
+ const nextIndex = s2 + i;
4154
+ const nextChild = c2[nextIndex];
4155
+ const anchor = nextIndex + 1 < l2 ? c2[nextIndex + 1].el : parentAnchor;
4156
+ if (newIndexToOldIndexMap[i] === 0) {
4157
+ patch(
4158
+ null,
4159
+ nextChild,
4160
+ container,
4161
+ anchor,
4162
+ parentComponent,
4163
+ parentSuspense,
4164
+ namespace,
4165
+ slotScopeIds,
4166
+ optimized
4167
+ );
4168
+ } else if (moved) {
4169
+ if (j < 0 || i !== increasingNewIndexSequence[j]) {
4170
+ move(nextChild, container, anchor, 2);
4171
+ } else {
4172
+ j--;
4173
+ }
4174
+ }
4175
+ }
4176
+ }
4177
+ };
4178
+ const move = (vnode, container, anchor, moveType, parentSuspense = null) => {
4179
+ const { el, type, transition, children, shapeFlag } = vnode;
4180
+ if (shapeFlag & 6) {
4181
+ move(vnode.component.subTree, container, anchor, moveType);
4182
+ return;
4183
+ }
4184
+ if (shapeFlag & 128) {
4185
+ vnode.suspense.move(container, anchor, moveType);
4186
+ return;
4187
+ }
4188
+ if (shapeFlag & 64) {
4189
+ type.move(vnode, container, anchor, internals);
4190
+ return;
4191
+ }
4192
+ if (type === Fragment) {
4193
+ hostInsert(el, container, anchor);
4194
+ for (let i = 0; i < children.length; i++) {
4195
+ move(children[i], container, anchor, moveType);
4196
+ }
4197
+ hostInsert(vnode.anchor, container, anchor);
4198
+ return;
4199
+ }
4200
+ if (type === Static) {
4201
+ moveStaticNode(vnode, container, anchor);
4202
+ return;
4203
+ }
4204
+ const needTransition2 = moveType !== 2 && shapeFlag & 1 && transition;
4205
+ if (needTransition2) {
4206
+ if (moveType === 0) {
4207
+ transition.beforeEnter(el);
4208
+ hostInsert(el, container, anchor);
4209
+ queuePostRenderEffect(() => transition.enter(el), parentSuspense);
4210
+ } else {
4211
+ const { leave, delayLeave, afterLeave } = transition;
4212
+ const remove2 = () => hostInsert(el, container, anchor);
4213
+ const performLeave = () => {
4214
+ leave(el, () => {
4215
+ remove2();
4216
+ afterLeave && afterLeave();
4217
+ });
4218
+ };
4219
+ if (delayLeave) {
4220
+ delayLeave(el, remove2, performLeave);
4221
+ } else {
4222
+ performLeave();
4223
+ }
4224
+ }
4225
+ } else {
4226
+ hostInsert(el, container, anchor);
4227
+ }
4228
+ };
4229
+ const unmount = (vnode, parentComponent, parentSuspense, doRemove = false, optimized = false) => {
4230
+ const {
4231
+ type,
4232
+ props,
4233
+ ref,
4234
+ children,
4235
+ dynamicChildren,
4236
+ shapeFlag,
4237
+ patchFlag,
4238
+ dirs,
4239
+ memoIndex
4240
+ } = vnode;
4241
+ if (ref != null) {
4242
+ setRef(ref, null, parentSuspense, vnode, true);
4243
+ }
4244
+ if (memoIndex != null) {
4245
+ parentComponent.renderCache[memoIndex] = void 0;
4246
+ }
4247
+ if (shapeFlag & 256) {
4248
+ parentComponent.ctx.deactivate(vnode);
4249
+ return;
4250
+ }
4251
+ const shouldInvokeDirs = shapeFlag & 1 && dirs;
4252
+ const shouldInvokeVnodeHook = !isAsyncWrapper(vnode);
4253
+ let vnodeHook;
4254
+ if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeBeforeUnmount)) {
4255
+ invokeVNodeHook(vnodeHook, parentComponent, vnode);
4256
+ }
4257
+ if (shapeFlag & 6) {
4258
+ unmountComponent(vnode.component, parentSuspense, doRemove);
4259
+ } else {
4260
+ if (shapeFlag & 128) {
4261
+ vnode.suspense.unmount(parentSuspense, doRemove);
4262
+ return;
4263
+ }
4264
+ if (shouldInvokeDirs) {
4265
+ invokeDirectiveHook(vnode, null, parentComponent, "beforeUnmount");
4266
+ }
4267
+ if (shapeFlag & 64) {
4268
+ vnode.type.remove(
4269
+ vnode,
4270
+ parentComponent,
4271
+ parentSuspense,
4272
+ optimized,
4273
+ internals,
4274
+ doRemove
4275
+ );
4276
+ } else if (dynamicChildren && // #1153: fast path should not be taken for non-stable (v-for) fragments
4277
+ (type !== Fragment || patchFlag > 0 && patchFlag & 64)) {
4278
+ unmountChildren(
4279
+ dynamicChildren,
4280
+ parentComponent,
4281
+ parentSuspense,
4282
+ false,
4283
+ true
4284
+ );
4285
+ } else if (type === Fragment && patchFlag & (128 | 256) || !optimized && shapeFlag & 16) {
4286
+ unmountChildren(children, parentComponent, parentSuspense);
4287
+ }
4288
+ if (doRemove) {
4289
+ remove(vnode);
4290
+ }
4291
+ }
4292
+ if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeUnmounted) || shouldInvokeDirs) {
4293
+ queuePostRenderEffect(() => {
4294
+ vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
4295
+ shouldInvokeDirs && invokeDirectiveHook(vnode, null, parentComponent, "unmounted");
4296
+ }, parentSuspense);
4297
+ }
4298
+ };
4299
+ const remove = (vnode) => {
4300
+ const { type, el, anchor, transition } = vnode;
4301
+ if (type === Fragment) {
4302
+ {
4303
+ removeFragment(el, anchor);
4304
+ }
4305
+ return;
4306
+ }
4307
+ if (type === Static) {
4308
+ removeStaticNode(vnode);
4309
+ return;
4310
+ }
4311
+ const performRemove = () => {
4312
+ hostRemove(el);
4313
+ if (transition && !transition.persisted && transition.afterLeave) {
4314
+ transition.afterLeave();
4315
+ }
4316
+ };
4317
+ if (vnode.shapeFlag & 1 && transition && !transition.persisted) {
4318
+ const { leave, delayLeave } = transition;
4319
+ const performLeave = () => leave(el, performRemove);
4320
+ if (delayLeave) {
4321
+ delayLeave(vnode.el, performRemove, performLeave);
4322
+ } else {
4323
+ performLeave();
4324
+ }
4325
+ } else {
4326
+ performRemove();
4327
+ }
4328
+ };
4329
+ const removeFragment = (cur, end) => {
4330
+ let next;
4331
+ while (cur !== end) {
4332
+ next = hostNextSibling(cur);
4333
+ hostRemove(cur);
4334
+ cur = next;
4335
+ }
4336
+ hostRemove(end);
4337
+ };
4338
+ const unmountComponent = (instance, parentSuspense, doRemove) => {
4339
+ const { bum, scope, update, subTree, um, m, a } = instance;
4340
+ invalidateMount(m);
4341
+ invalidateMount(a);
4342
+ if (bum) {
4343
+ shared.invokeArrayFns(bum);
4344
+ }
4345
+ scope.stop();
4346
+ if (update) {
4347
+ update.active = false;
4348
+ unmount(subTree, instance, parentSuspense, doRemove);
4349
+ }
4350
+ if (um) {
4351
+ queuePostRenderEffect(um, parentSuspense);
4352
+ }
4353
+ queuePostRenderEffect(() => {
4354
+ instance.isUnmounted = true;
4355
+ }, parentSuspense);
4356
+ if (parentSuspense && parentSuspense.pendingBranch && !parentSuspense.isUnmounted && instance.asyncDep && !instance.asyncResolved && instance.suspenseId === parentSuspense.pendingId) {
4357
+ parentSuspense.deps--;
4358
+ if (parentSuspense.deps === 0) {
4359
+ parentSuspense.resolve();
4360
+ }
4361
+ }
4362
+ };
4363
+ const unmountChildren = (children, parentComponent, parentSuspense, doRemove = false, optimized = false, start = 0) => {
4364
+ for (let i = start; i < children.length; i++) {
4365
+ unmount(children[i], parentComponent, parentSuspense, doRemove, optimized);
4366
+ }
4367
+ };
4368
+ const getNextHostNode = (vnode) => {
4369
+ if (vnode.shapeFlag & 6) {
4370
+ return getNextHostNode(vnode.component.subTree);
4371
+ }
4372
+ if (vnode.shapeFlag & 128) {
4373
+ return vnode.suspense.next();
4374
+ }
4375
+ return hostNextSibling(vnode.anchor || vnode.el);
4376
+ };
4377
+ let isFlushing = false;
4378
+ const render = (vnode, container, namespace) => {
4379
+ if (vnode == null) {
4380
+ if (container._vnode) {
4381
+ unmount(container._vnode, null, null, true);
4382
+ }
4383
+ } else {
4384
+ patch(
4385
+ container._vnode || null,
4386
+ vnode,
4387
+ container,
4388
+ null,
4389
+ null,
4390
+ null,
4391
+ namespace
4392
+ );
4393
+ }
4394
+ if (!isFlushing) {
4395
+ isFlushing = true;
4396
+ flushPreFlushCbs();
4397
+ flushPostFlushCbs();
4398
+ isFlushing = false;
4399
+ }
4400
+ container._vnode = vnode;
4401
+ };
4402
+ const internals = {
4403
+ p: patch,
4404
+ um: unmount,
4405
+ m: move,
4406
+ r: remove,
4407
+ mt: mountComponent,
4408
+ mc: mountChildren,
4409
+ pc: patchChildren,
4410
+ pbc: patchBlockChildren,
4411
+ n: getNextHostNode,
4412
+ o: options
4413
+ };
4414
+ let hydrate;
4415
+ let hydrateNode;
4416
+ if (createHydrationFns) {
4417
+ [hydrate, hydrateNode] = createHydrationFns(
4418
+ internals
4419
+ );
4420
+ }
4421
+ return {
4422
+ render,
4423
+ hydrate,
4424
+ createApp: createAppAPI(render, hydrate)
4425
+ };
4426
+ }
4427
+ function resolveChildrenNamespace({ type, props }, currentNamespace) {
4428
+ return currentNamespace === "svg" && type === "foreignObject" || currentNamespace === "mathml" && type === "annotation-xml" && props && props.encoding && props.encoding.includes("html") ? void 0 : currentNamespace;
4429
+ }
4430
+ function toggleRecurse({ effect, update }, allowed) {
4431
+ effect.allowRecurse = update.allowRecurse = allowed;
4432
+ }
4433
+ function needTransition(parentSuspense, transition) {
4434
+ return (!parentSuspense || parentSuspense && !parentSuspense.pendingBranch) && transition && !transition.persisted;
4435
+ }
4436
+ function traverseStaticChildren(n1, n2, shallow = false) {
4437
+ const ch1 = n1.children;
4438
+ const ch2 = n2.children;
4439
+ if (shared.isArray(ch1) && shared.isArray(ch2)) {
4440
+ for (let i = 0; i < ch1.length; i++) {
4441
+ const c1 = ch1[i];
4442
+ let c2 = ch2[i];
4443
+ if (c2.shapeFlag & 1 && !c2.dynamicChildren) {
4444
+ if (c2.patchFlag <= 0 || c2.patchFlag === 32) {
4445
+ c2 = ch2[i] = cloneIfMounted(ch2[i]);
4446
+ c2.el = c1.el;
4447
+ }
4448
+ if (!shallow && c2.patchFlag !== -2)
4449
+ traverseStaticChildren(c1, c2);
4450
+ }
4451
+ if (c2.type === Text) {
4452
+ c2.el = c1.el;
4453
+ }
4454
+ }
4455
+ }
4456
+ }
4457
+ function getSequence(arr) {
4458
+ const p = arr.slice();
4459
+ const result = [0];
4460
+ let i, j, u, v, c;
4461
+ const len = arr.length;
4462
+ for (i = 0; i < len; i++) {
4463
+ const arrI = arr[i];
4464
+ if (arrI !== 0) {
4465
+ j = result[result.length - 1];
4466
+ if (arr[j] < arrI) {
4467
+ p[i] = j;
4468
+ result.push(i);
4469
+ continue;
4470
+ }
4471
+ u = 0;
4472
+ v = result.length - 1;
4473
+ while (u < v) {
4474
+ c = u + v >> 1;
4475
+ if (arr[result[c]] < arrI) {
4476
+ u = c + 1;
4477
+ } else {
4478
+ v = c;
4479
+ }
4480
+ }
4481
+ if (arrI < arr[result[u]]) {
4482
+ if (u > 0) {
4483
+ p[i] = result[u - 1];
4484
+ }
4485
+ result[u] = i;
4486
+ }
4487
+ }
4488
+ }
4489
+ u = result.length;
4490
+ v = result[u - 1];
4491
+ while (u-- > 0) {
4492
+ result[u] = v;
4493
+ v = p[v];
4494
+ }
4495
+ return result;
4496
+ }
4497
+ function locateNonHydratedAsyncRoot(instance) {
4498
+ const subComponent = instance.subTree.component;
4499
+ if (subComponent) {
4500
+ if (subComponent.asyncDep && !subComponent.asyncResolved) {
4501
+ return subComponent;
4502
+ } else {
4503
+ return locateNonHydratedAsyncRoot(subComponent);
4504
+ }
4505
+ }
4506
+ }
4507
+ function invalidateMount(hooks) {
4508
+ if (hooks) {
4509
+ for (let i = 0; i < hooks.length; i++) hooks[i].active = false;
4510
+ }
4511
+ }
4512
+
4513
+ const ssrContextKey = Symbol.for("v-scx");
4514
+ const useSSRContext = () => {
4515
+ {
4516
+ const ctx = inject(ssrContextKey);
4517
+ return ctx;
4518
+ }
4519
+ };
4520
+
4521
+ function watchEffect(effect, options) {
4522
+ return doWatch(effect, null, options);
4523
+ }
4524
+ function watchPostEffect(effect, options) {
4525
+ return doWatch(
4526
+ effect,
4527
+ null,
4528
+ { flush: "post" }
4529
+ );
4530
+ }
4531
+ function watchSyncEffect(effect, options) {
4532
+ return doWatch(
4533
+ effect,
4534
+ null,
4535
+ { flush: "sync" }
4536
+ );
4537
+ }
4538
+ const INITIAL_WATCHER_VALUE = {};
4539
+ function watch(source, cb, options) {
4540
+ return doWatch(source, cb, options);
4541
+ }
4542
+ function doWatch(source, cb, {
4543
+ immediate,
4544
+ deep,
4545
+ flush,
4546
+ once,
4547
+ onTrack,
4548
+ onTrigger
4549
+ } = shared.EMPTY_OBJ) {
4550
+ if (cb && once) {
4551
+ const _cb = cb;
4552
+ cb = (...args) => {
4553
+ _cb(...args);
4554
+ unwatch();
4555
+ };
4556
+ }
4557
+ const instance = currentInstance;
4558
+ const reactiveGetter = (source2) => deep === true ? source2 : (
4559
+ // for deep: false, only traverse root-level properties
4560
+ traverse(source2, deep === false ? 1 : void 0)
4561
+ );
4562
+ let getter;
4563
+ let forceTrigger = false;
4564
+ let isMultiSource = false;
4565
+ if (reactivity.isRef(source)) {
4566
+ getter = () => source.value;
4567
+ forceTrigger = reactivity.isShallow(source);
4568
+ } else if (reactivity.isReactive(source)) {
4569
+ getter = () => reactiveGetter(source);
4570
+ forceTrigger = true;
4571
+ } else if (shared.isArray(source)) {
4572
+ isMultiSource = true;
4573
+ forceTrigger = source.some((s) => reactivity.isReactive(s) || reactivity.isShallow(s));
4574
+ getter = () => source.map((s) => {
4575
+ if (reactivity.isRef(s)) {
4576
+ return s.value;
4577
+ } else if (reactivity.isReactive(s)) {
4578
+ return reactiveGetter(s);
4579
+ } else if (shared.isFunction(s)) {
4580
+ return callWithErrorHandling(s, instance, 2);
4581
+ } else ;
4582
+ });
4583
+ } else if (shared.isFunction(source)) {
4584
+ if (cb) {
4585
+ getter = () => callWithErrorHandling(source, instance, 2);
4586
+ } else {
4587
+ getter = () => {
4588
+ if (cleanup) {
4589
+ cleanup();
4590
+ }
4591
+ return callWithAsyncErrorHandling(
4592
+ source,
4593
+ instance,
4594
+ 3,
4595
+ [onCleanup]
4596
+ );
4597
+ };
4598
+ }
4599
+ } else {
4600
+ getter = shared.NOOP;
4601
+ }
4602
+ if (cb && deep) {
4603
+ const baseGetter = getter;
4604
+ getter = () => traverse(baseGetter());
4605
+ }
4606
+ let cleanup;
4607
+ let onCleanup = (fn) => {
4608
+ cleanup = effect.onStop = () => {
4609
+ callWithErrorHandling(fn, instance, 4);
4610
+ cleanup = effect.onStop = void 0;
4611
+ };
4612
+ };
4613
+ let ssrCleanup;
4614
+ if (isInSSRComponentSetup) {
4615
+ onCleanup = shared.NOOP;
4616
+ if (!cb) {
4617
+ getter();
4618
+ } else if (immediate) {
4619
+ callWithAsyncErrorHandling(cb, instance, 3, [
4620
+ getter(),
4621
+ isMultiSource ? [] : void 0,
4622
+ onCleanup
4623
+ ]);
4624
+ }
4625
+ if (flush === "sync") {
4626
+ const ctx = useSSRContext();
4627
+ ssrCleanup = ctx.__watcherHandles || (ctx.__watcherHandles = []);
4628
+ } else {
4629
+ return shared.NOOP;
4630
+ }
4631
+ }
4632
+ let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
4633
+ const job = () => {
4634
+ if (!effect.active || !effect.dirty) {
4635
+ return;
4636
+ }
4637
+ if (cb) {
4638
+ const newValue = effect.run();
4639
+ if (deep || forceTrigger || (isMultiSource ? newValue.some((v, i) => shared.hasChanged(v, oldValue[i])) : shared.hasChanged(newValue, oldValue)) || false) {
4640
+ if (cleanup) {
4641
+ cleanup();
4642
+ }
4643
+ callWithAsyncErrorHandling(cb, instance, 3, [
4644
+ newValue,
4645
+ // pass undefined as the old value when it's changed for the first time
4646
+ oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
4647
+ onCleanup
4648
+ ]);
4649
+ oldValue = newValue;
4650
+ }
4651
+ } else {
4652
+ effect.run();
4653
+ }
4654
+ };
4655
+ job.allowRecurse = !!cb;
4656
+ let scheduler;
4657
+ if (flush === "sync") {
4658
+ scheduler = job;
4659
+ } else if (flush === "post") {
4660
+ scheduler = () => queuePostRenderEffect(job, instance && instance.suspense);
4661
+ } else {
4662
+ job.pre = true;
4663
+ if (instance) job.id = instance.uid;
4664
+ scheduler = () => queueJob(job);
4665
+ }
4666
+ const effect = new reactivity.ReactiveEffect(getter, shared.NOOP, scheduler);
4667
+ const scope = reactivity.getCurrentScope();
4668
+ const unwatch = () => {
4669
+ effect.stop();
4670
+ if (scope) {
4671
+ shared.remove(scope.effects, effect);
4672
+ }
4673
+ };
4674
+ if (cb) {
4675
+ if (immediate) {
4676
+ job();
4677
+ } else {
4678
+ oldValue = effect.run();
4679
+ }
4680
+ } else if (flush === "post") {
4681
+ queuePostRenderEffect(
4682
+ effect.run.bind(effect),
4683
+ instance && instance.suspense
4684
+ );
4685
+ } else {
4686
+ effect.run();
4687
+ }
4688
+ if (ssrCleanup) ssrCleanup.push(unwatch);
4689
+ return unwatch;
4690
+ }
4691
+ function instanceWatch(source, value, options) {
4692
+ const publicThis = this.proxy;
4693
+ const getter = shared.isString(source) ? source.includes(".") ? createPathGetter(publicThis, source) : () => publicThis[source] : source.bind(publicThis, publicThis);
4694
+ let cb;
4695
+ if (shared.isFunction(value)) {
4696
+ cb = value;
4697
+ } else {
4698
+ cb = value.handler;
4699
+ options = value;
4700
+ }
4701
+ const reset = setCurrentInstance(this);
4702
+ const res = doWatch(getter, cb.bind(publicThis), options);
4703
+ reset();
4704
+ return res;
4705
+ }
4706
+ function createPathGetter(ctx, path) {
4707
+ const segments = path.split(".");
4708
+ return () => {
4709
+ let cur = ctx;
4710
+ for (let i = 0; i < segments.length && cur; i++) {
4711
+ cur = cur[segments[i]];
4712
+ }
4713
+ return cur;
4714
+ };
4715
+ }
4716
+ function traverse(value, depth = Infinity, seen) {
4717
+ if (depth <= 0 || !shared.isObject(value) || value["__v_skip"]) {
4718
+ return value;
4719
+ }
4720
+ seen = seen || /* @__PURE__ */ new Set();
4721
+ if (seen.has(value)) {
4722
+ return value;
4723
+ }
4724
+ seen.add(value);
4725
+ depth--;
4726
+ if (reactivity.isRef(value)) {
4727
+ traverse(value.value, depth, seen);
4728
+ } else if (shared.isArray(value)) {
4729
+ for (let i = 0; i < value.length; i++) {
4730
+ traverse(value[i], depth, seen);
4731
+ }
4732
+ } else if (shared.isSet(value) || shared.isMap(value)) {
4733
+ value.forEach((v) => {
4734
+ traverse(v, depth, seen);
4735
+ });
4736
+ } else if (shared.isPlainObject(value)) {
4737
+ for (const key in value) {
4738
+ traverse(value[key], depth, seen);
4739
+ }
4740
+ for (const key of Object.getOwnPropertySymbols(value)) {
4741
+ if (Object.prototype.propertyIsEnumerable.call(value, key)) {
4742
+ traverse(value[key], depth, seen);
4790
4743
  }
4791
4744
  }
4792
- };
4793
- const patchUnkeyedChildren = (c1, c2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
4794
- c1 = c1 || shared.EMPTY_ARR;
4795
- c2 = c2 || shared.EMPTY_ARR;
4796
- const oldLength = c1.length;
4797
- const newLength = c2.length;
4798
- const commonLength = Math.min(oldLength, newLength);
4799
- let i;
4800
- for (i = 0; i < commonLength; i++) {
4801
- const nextChild = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
4802
- patch(
4803
- c1[i],
4804
- nextChild,
4805
- container,
4806
- null,
4807
- parentComponent,
4808
- parentSuspense,
4809
- namespace,
4810
- slotScopeIds,
4811
- optimized
4812
- );
4745
+ }
4746
+ return value;
4747
+ }
4748
+
4749
+ const isKeepAlive = (vnode) => vnode.type.__isKeepAlive;
4750
+ const KeepAliveImpl = {
4751
+ name: `KeepAlive`,
4752
+ // Marker for special handling inside the renderer. We are not using a ===
4753
+ // check directly on KeepAlive in the renderer, because importing it directly
4754
+ // would prevent it from being tree-shaken.
4755
+ __isKeepAlive: true,
4756
+ props: {
4757
+ include: [String, RegExp, Array],
4758
+ exclude: [String, RegExp, Array],
4759
+ max: [String, Number]
4760
+ },
4761
+ setup(props, { slots }) {
4762
+ const instance = getCurrentInstance();
4763
+ const sharedContext = instance.ctx;
4764
+ if (!sharedContext.renderer) {
4765
+ return () => {
4766
+ const children = slots.default && slots.default();
4767
+ return children && children.length === 1 ? children[0] : children;
4768
+ };
4813
4769
  }
4814
- if (oldLength > newLength) {
4815
- unmountChildren(
4816
- c1,
4817
- parentComponent,
4818
- parentSuspense,
4819
- true,
4820
- false,
4821
- commonLength
4822
- );
4823
- } else {
4824
- mountChildren(
4825
- c2,
4770
+ const cache = /* @__PURE__ */ new Map();
4771
+ const keys = /* @__PURE__ */ new Set();
4772
+ let current = null;
4773
+ const parentSuspense = instance.suspense;
4774
+ const {
4775
+ renderer: {
4776
+ p: patch,
4777
+ m: move,
4778
+ um: _unmount,
4779
+ o: { createElement }
4780
+ }
4781
+ } = sharedContext;
4782
+ const storageContainer = createElement("div");
4783
+ sharedContext.activate = (vnode, container, anchor, namespace, optimized) => {
4784
+ const instance2 = vnode.component;
4785
+ move(vnode, container, anchor, 0, parentSuspense);
4786
+ patch(
4787
+ instance2.vnode,
4788
+ vnode,
4826
4789
  container,
4827
4790
  anchor,
4828
- parentComponent,
4791
+ instance2,
4829
4792
  parentSuspense,
4830
4793
  namespace,
4831
- slotScopeIds,
4832
- optimized,
4833
- commonLength
4794
+ vnode.slotScopeIds,
4795
+ optimized
4834
4796
  );
4835
- }
4836
- };
4837
- const patchKeyedChildren = (c1, c2, container, parentAnchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
4838
- let i = 0;
4839
- const l2 = c2.length;
4840
- let e1 = c1.length - 1;
4841
- let e2 = l2 - 1;
4842
- while (i <= e1 && i <= e2) {
4843
- const n1 = c1[i];
4844
- const n2 = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
4845
- if (isSameVNodeType(n1, n2)) {
4846
- patch(
4847
- n1,
4848
- n2,
4849
- container,
4850
- null,
4851
- parentComponent,
4852
- parentSuspense,
4853
- namespace,
4854
- slotScopeIds,
4855
- optimized
4856
- );
4857
- } else {
4858
- break;
4859
- }
4860
- i++;
4861
- }
4862
- while (i <= e1 && i <= e2) {
4863
- const n1 = c1[e1];
4864
- const n2 = c2[e2] = optimized ? cloneIfMounted(c2[e2]) : normalizeVNode(c2[e2]);
4865
- if (isSameVNodeType(n1, n2)) {
4866
- patch(
4867
- n1,
4868
- n2,
4869
- container,
4870
- null,
4871
- parentComponent,
4872
- parentSuspense,
4873
- namespace,
4874
- slotScopeIds,
4875
- optimized
4876
- );
4877
- } else {
4878
- break;
4879
- }
4880
- e1--;
4881
- e2--;
4882
- }
4883
- if (i > e1) {
4884
- if (i <= e2) {
4885
- const nextPos = e2 + 1;
4886
- const anchor = nextPos < l2 ? c2[nextPos].el : parentAnchor;
4887
- while (i <= e2) {
4888
- patch(
4889
- null,
4890
- c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]),
4891
- container,
4892
- anchor,
4893
- parentComponent,
4894
- parentSuspense,
4895
- namespace,
4896
- slotScopeIds,
4897
- optimized
4898
- );
4899
- i++;
4900
- }
4901
- }
4902
- } else if (i > e2) {
4903
- while (i <= e1) {
4904
- unmount(c1[i], parentComponent, parentSuspense, true);
4905
- i++;
4906
- }
4907
- } else {
4908
- const s1 = i;
4909
- const s2 = i;
4910
- const keyToNewIndexMap = /* @__PURE__ */ new Map();
4911
- for (i = s2; i <= e2; i++) {
4912
- const nextChild = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
4913
- if (nextChild.key != null) {
4914
- keyToNewIndexMap.set(nextChild.key, i);
4915
- }
4916
- }
4917
- let j;
4918
- let patched = 0;
4919
- const toBePatched = e2 - s2 + 1;
4920
- let moved = false;
4921
- let maxNewIndexSoFar = 0;
4922
- const newIndexToOldIndexMap = new Array(toBePatched);
4923
- for (i = 0; i < toBePatched; i++)
4924
- newIndexToOldIndexMap[i] = 0;
4925
- for (i = s1; i <= e1; i++) {
4926
- const prevChild = c1[i];
4927
- if (patched >= toBePatched) {
4928
- unmount(prevChild, parentComponent, parentSuspense, true);
4929
- continue;
4797
+ queuePostRenderEffect(() => {
4798
+ instance2.isDeactivated = false;
4799
+ if (instance2.a) {
4800
+ shared.invokeArrayFns(instance2.a);
4930
4801
  }
4931
- let newIndex;
4932
- if (prevChild.key != null) {
4933
- newIndex = keyToNewIndexMap.get(prevChild.key);
4934
- } else {
4935
- for (j = s2; j <= e2; j++) {
4936
- if (newIndexToOldIndexMap[j - s2] === 0 && isSameVNodeType(prevChild, c2[j])) {
4937
- newIndex = j;
4938
- break;
4939
- }
4940
- }
4802
+ const vnodeHook = vnode.props && vnode.props.onVnodeMounted;
4803
+ if (vnodeHook) {
4804
+ invokeVNodeHook(vnodeHook, instance2.parent, vnode);
4941
4805
  }
4942
- if (newIndex === void 0) {
4943
- unmount(prevChild, parentComponent, parentSuspense, true);
4944
- } else {
4945
- newIndexToOldIndexMap[newIndex - s2] = i + 1;
4946
- if (newIndex >= maxNewIndexSoFar) {
4947
- maxNewIndexSoFar = newIndex;
4948
- } else {
4949
- moved = true;
4950
- }
4951
- patch(
4952
- prevChild,
4953
- c2[newIndex],
4954
- container,
4955
- null,
4956
- parentComponent,
4957
- parentSuspense,
4958
- namespace,
4959
- slotScopeIds,
4960
- optimized
4961
- );
4962
- patched++;
4806
+ }, parentSuspense);
4807
+ };
4808
+ sharedContext.deactivate = (vnode) => {
4809
+ const instance2 = vnode.component;
4810
+ invalidateMount(instance2.m);
4811
+ invalidateMount(instance2.a);
4812
+ move(vnode, storageContainer, null, 1, parentSuspense);
4813
+ queuePostRenderEffect(() => {
4814
+ if (instance2.da) {
4815
+ shared.invokeArrayFns(instance2.da);
4963
4816
  }
4964
- }
4965
- const increasingNewIndexSequence = moved ? getSequence(newIndexToOldIndexMap) : shared.EMPTY_ARR;
4966
- j = increasingNewIndexSequence.length - 1;
4967
- for (i = toBePatched - 1; i >= 0; i--) {
4968
- const nextIndex = s2 + i;
4969
- const nextChild = c2[nextIndex];
4970
- const anchor = nextIndex + 1 < l2 ? c2[nextIndex + 1].el : parentAnchor;
4971
- if (newIndexToOldIndexMap[i] === 0) {
4972
- patch(
4973
- null,
4974
- nextChild,
4975
- container,
4976
- anchor,
4977
- parentComponent,
4978
- parentSuspense,
4979
- namespace,
4980
- slotScopeIds,
4981
- optimized
4982
- );
4983
- } else if (moved) {
4984
- if (j < 0 || i !== increasingNewIndexSequence[j]) {
4985
- move(nextChild, container, anchor, 2);
4986
- } else {
4987
- j--;
4988
- }
4817
+ const vnodeHook = vnode.props && vnode.props.onVnodeUnmounted;
4818
+ if (vnodeHook) {
4819
+ invokeVNodeHook(vnodeHook, instance2.parent, vnode);
4989
4820
  }
4990
- }
4991
- }
4992
- };
4993
- const move = (vnode, container, anchor, moveType, parentSuspense = null) => {
4994
- const { el, type, transition, children, shapeFlag } = vnode;
4995
- if (shapeFlag & 6) {
4996
- move(vnode.component.subTree, container, anchor, moveType);
4997
- return;
4998
- }
4999
- if (shapeFlag & 128) {
5000
- vnode.suspense.move(container, anchor, moveType);
5001
- return;
4821
+ instance2.isDeactivated = true;
4822
+ }, parentSuspense);
4823
+ };
4824
+ function unmount(vnode) {
4825
+ resetShapeFlag(vnode);
4826
+ _unmount(vnode, instance, parentSuspense, true);
5002
4827
  }
5003
- if (shapeFlag & 64) {
5004
- type.move(vnode, container, anchor, internals);
5005
- return;
4828
+ function pruneCache(filter) {
4829
+ cache.forEach((vnode, key) => {
4830
+ const name = getComponentName(vnode.type);
4831
+ if (name && (!filter || !filter(name))) {
4832
+ pruneCacheEntry(key);
4833
+ }
4834
+ });
5006
4835
  }
5007
- if (type === Fragment) {
5008
- hostInsert(el, container, anchor);
5009
- for (let i = 0; i < children.length; i++) {
5010
- move(children[i], container, anchor, moveType);
4836
+ function pruneCacheEntry(key) {
4837
+ const cached = cache.get(key);
4838
+ if (!current || !isSameVNodeType(cached, current)) {
4839
+ unmount(cached);
4840
+ } else if (current) {
4841
+ resetShapeFlag(current);
5011
4842
  }
5012
- hostInsert(vnode.anchor, container, anchor);
5013
- return;
5014
- }
5015
- if (type === Static) {
5016
- moveStaticNode(vnode, container, anchor);
5017
- return;
4843
+ cache.delete(key);
4844
+ keys.delete(key);
5018
4845
  }
5019
- const needTransition2 = moveType !== 2 && shapeFlag & 1 && transition;
5020
- if (needTransition2) {
5021
- if (moveType === 0) {
5022
- transition.beforeEnter(el);
5023
- hostInsert(el, container, anchor);
5024
- queuePostRenderEffect(() => transition.enter(el), parentSuspense);
5025
- } else {
5026
- const { leave, delayLeave, afterLeave } = transition;
5027
- const remove2 = () => hostInsert(el, container, anchor);
5028
- const performLeave = () => {
5029
- leave(el, () => {
5030
- remove2();
5031
- afterLeave && afterLeave();
5032
- });
5033
- };
5034
- if (delayLeave) {
5035
- delayLeave(el, remove2, performLeave);
4846
+ watch(
4847
+ () => [props.include, props.exclude],
4848
+ ([include, exclude]) => {
4849
+ include && pruneCache((name) => matches(include, name));
4850
+ exclude && pruneCache((name) => !matches(exclude, name));
4851
+ },
4852
+ // prune post-render after `current` has been updated
4853
+ { flush: "post", deep: true }
4854
+ );
4855
+ let pendingCacheKey = null;
4856
+ const cacheSubtree = () => {
4857
+ if (pendingCacheKey != null) {
4858
+ if (isSuspense(instance.subTree.type)) {
4859
+ queuePostRenderEffect(() => {
4860
+ cache.set(pendingCacheKey, getInnerChild(instance.subTree));
4861
+ }, instance.subTree.suspense);
5036
4862
  } else {
5037
- performLeave();
4863
+ cache.set(pendingCacheKey, getInnerChild(instance.subTree));
5038
4864
  }
5039
4865
  }
5040
- } else {
5041
- hostInsert(el, container, anchor);
5042
- }
5043
- };
5044
- const unmount = (vnode, parentComponent, parentSuspense, doRemove = false, optimized = false) => {
5045
- const {
5046
- type,
5047
- props,
5048
- ref,
5049
- children,
5050
- dynamicChildren,
5051
- shapeFlag,
5052
- patchFlag,
5053
- dirs
5054
- } = vnode;
5055
- if (ref != null) {
5056
- setRef(ref, null, parentSuspense, vnode, true);
5057
- }
5058
- if (shapeFlag & 256) {
5059
- parentComponent.ctx.deactivate(vnode);
5060
- return;
5061
- }
5062
- const shouldInvokeDirs = shapeFlag & 1 && dirs;
5063
- const shouldInvokeVnodeHook = !isAsyncWrapper(vnode);
5064
- let vnodeHook;
5065
- if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeBeforeUnmount)) {
5066
- invokeVNodeHook(vnodeHook, parentComponent, vnode);
5067
- }
5068
- if (shapeFlag & 6) {
5069
- unmountComponent(vnode.component, parentSuspense, doRemove);
5070
- } else {
5071
- if (shapeFlag & 128) {
5072
- vnode.suspense.unmount(parentSuspense, doRemove);
5073
- return;
4866
+ };
4867
+ onMounted(cacheSubtree);
4868
+ onUpdated(cacheSubtree);
4869
+ onBeforeUnmount(() => {
4870
+ cache.forEach((cached) => {
4871
+ const { subTree, suspense } = instance;
4872
+ const vnode = getInnerChild(subTree);
4873
+ if (cached.type === vnode.type && cached.key === vnode.key) {
4874
+ resetShapeFlag(vnode);
4875
+ const da = vnode.component.da;
4876
+ da && queuePostRenderEffect(da, suspense);
4877
+ return;
4878
+ }
4879
+ unmount(cached);
4880
+ });
4881
+ });
4882
+ return () => {
4883
+ pendingCacheKey = null;
4884
+ if (!slots.default) {
4885
+ return null;
5074
4886
  }
5075
- if (shouldInvokeDirs) {
5076
- invokeDirectiveHook(vnode, null, parentComponent, "beforeUnmount");
4887
+ const children = slots.default();
4888
+ const rawVNode = children[0];
4889
+ if (children.length > 1) {
4890
+ current = null;
4891
+ return children;
4892
+ } else if (!isVNode(rawVNode) || !(rawVNode.shapeFlag & 4) && !(rawVNode.shapeFlag & 128)) {
4893
+ current = null;
4894
+ return rawVNode;
5077
4895
  }
5078
- if (shapeFlag & 64) {
5079
- vnode.type.remove(
5080
- vnode,
5081
- parentComponent,
5082
- parentSuspense,
5083
- optimized,
5084
- internals,
5085
- doRemove
5086
- );
5087
- } else if (dynamicChildren && // #1153: fast path should not be taken for non-stable (v-for) fragments
5088
- (type !== Fragment || patchFlag > 0 && patchFlag & 64)) {
5089
- unmountChildren(
5090
- dynamicChildren,
5091
- parentComponent,
5092
- parentSuspense,
5093
- false,
5094
- true
5095
- );
5096
- } else if (type === Fragment && patchFlag & (128 | 256) || !optimized && shapeFlag & 16) {
5097
- unmountChildren(children, parentComponent, parentSuspense);
4896
+ let vnode = getInnerChild(rawVNode);
4897
+ const comp = vnode.type;
4898
+ const name = getComponentName(
4899
+ isAsyncWrapper(vnode) ? vnode.type.__asyncResolved || {} : comp
4900
+ );
4901
+ const { include, exclude, max } = props;
4902
+ if (include && (!name || !matches(include, name)) || exclude && name && matches(exclude, name)) {
4903
+ current = vnode;
4904
+ return rawVNode;
5098
4905
  }
5099
- if (doRemove) {
5100
- remove(vnode);
4906
+ const key = vnode.key == null ? comp : vnode.key;
4907
+ const cachedVNode = cache.get(key);
4908
+ if (vnode.el) {
4909
+ vnode = cloneVNode(vnode);
4910
+ if (rawVNode.shapeFlag & 128) {
4911
+ rawVNode.ssContent = vnode;
4912
+ }
4913
+ }
4914
+ pendingCacheKey = key;
4915
+ if (cachedVNode) {
4916
+ vnode.el = cachedVNode.el;
4917
+ vnode.component = cachedVNode.component;
4918
+ if (vnode.transition) {
4919
+ setTransitionHooks(vnode, vnode.transition);
4920
+ }
4921
+ vnode.shapeFlag |= 512;
4922
+ keys.delete(key);
4923
+ keys.add(key);
4924
+ } else {
4925
+ keys.add(key);
4926
+ if (max && keys.size > parseInt(max, 10)) {
4927
+ pruneCacheEntry(keys.values().next().value);
4928
+ }
4929
+ }
4930
+ vnode.shapeFlag |= 256;
4931
+ current = vnode;
4932
+ return isSuspense(rawVNode.type) ? rawVNode : vnode;
4933
+ };
4934
+ }
4935
+ };
4936
+ const KeepAlive = KeepAliveImpl;
4937
+ function matches(pattern, name) {
4938
+ if (shared.isArray(pattern)) {
4939
+ return pattern.some((p) => matches(p, name));
4940
+ } else if (shared.isString(pattern)) {
4941
+ return pattern.split(",").includes(name);
4942
+ } else if (shared.isRegExp(pattern)) {
4943
+ return pattern.test(name);
4944
+ }
4945
+ return false;
4946
+ }
4947
+ function onActivated(hook, target) {
4948
+ registerKeepAliveHook(hook, "a", target);
4949
+ }
4950
+ function onDeactivated(hook, target) {
4951
+ registerKeepAliveHook(hook, "da", target);
4952
+ }
4953
+ function registerKeepAliveHook(hook, type, target = currentInstance) {
4954
+ const wrappedHook = hook.__wdc || (hook.__wdc = () => {
4955
+ let current = target;
4956
+ while (current) {
4957
+ if (current.isDeactivated) {
4958
+ return;
5101
4959
  }
4960
+ current = current.parent;
5102
4961
  }
5103
- if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeUnmounted) || shouldInvokeDirs) {
5104
- queuePostRenderEffect(() => {
5105
- vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
5106
- shouldInvokeDirs && invokeDirectiveHook(vnode, null, parentComponent, "unmounted");
5107
- }, parentSuspense);
4962
+ return hook();
4963
+ });
4964
+ injectHook(type, wrappedHook, target);
4965
+ if (target) {
4966
+ let current = target.parent;
4967
+ while (current && current.parent) {
4968
+ if (isKeepAlive(current.parent.vnode)) {
4969
+ injectToKeepAliveRoot(wrappedHook, type, target, current);
4970
+ }
4971
+ current = current.parent;
5108
4972
  }
4973
+ }
4974
+ }
4975
+ function injectToKeepAliveRoot(hook, type, target, keepAliveRoot) {
4976
+ const injected = injectHook(
4977
+ type,
4978
+ hook,
4979
+ keepAliveRoot,
4980
+ true
4981
+ /* prepend */
4982
+ );
4983
+ onUnmounted(() => {
4984
+ shared.remove(keepAliveRoot[type], injected);
4985
+ }, target);
4986
+ }
4987
+ function resetShapeFlag(vnode) {
4988
+ vnode.shapeFlag &= ~256;
4989
+ vnode.shapeFlag &= ~512;
4990
+ }
4991
+ function getInnerChild(vnode) {
4992
+ return vnode.shapeFlag & 128 ? vnode.ssContent : vnode;
4993
+ }
4994
+
4995
+ const leaveCbKey = Symbol("_leaveCb");
4996
+ const enterCbKey = Symbol("_enterCb");
4997
+ function useTransitionState() {
4998
+ const state = {
4999
+ isMounted: false,
5000
+ isLeaving: false,
5001
+ isUnmounting: false,
5002
+ leavingVNodes: /* @__PURE__ */ new Map()
5109
5003
  };
5110
- const remove = (vnode) => {
5111
- const { type, el, anchor, transition } = vnode;
5112
- if (type === Fragment) {
5113
- {
5114
- removeFragment(el, anchor);
5004
+ onMounted(() => {
5005
+ state.isMounted = true;
5006
+ });
5007
+ onBeforeUnmount(() => {
5008
+ state.isUnmounting = true;
5009
+ });
5010
+ return state;
5011
+ }
5012
+ const TransitionHookValidator = [Function, Array];
5013
+ const BaseTransitionPropsValidators = {
5014
+ mode: String,
5015
+ appear: Boolean,
5016
+ persisted: Boolean,
5017
+ // enter
5018
+ onBeforeEnter: TransitionHookValidator,
5019
+ onEnter: TransitionHookValidator,
5020
+ onAfterEnter: TransitionHookValidator,
5021
+ onEnterCancelled: TransitionHookValidator,
5022
+ // leave
5023
+ onBeforeLeave: TransitionHookValidator,
5024
+ onLeave: TransitionHookValidator,
5025
+ onAfterLeave: TransitionHookValidator,
5026
+ onLeaveCancelled: TransitionHookValidator,
5027
+ // appear
5028
+ onBeforeAppear: TransitionHookValidator,
5029
+ onAppear: TransitionHookValidator,
5030
+ onAfterAppear: TransitionHookValidator,
5031
+ onAppearCancelled: TransitionHookValidator
5032
+ };
5033
+ const recursiveGetSubtree = (instance) => {
5034
+ const subTree = instance.subTree;
5035
+ return subTree.component ? recursiveGetSubtree(subTree.component) : subTree;
5036
+ };
5037
+ const BaseTransitionImpl = {
5038
+ name: `BaseTransition`,
5039
+ props: BaseTransitionPropsValidators,
5040
+ setup(props, { slots }) {
5041
+ const instance = getCurrentInstance();
5042
+ const state = useTransitionState();
5043
+ return () => {
5044
+ const children = slots.default && getTransitionRawChildren(slots.default(), true);
5045
+ if (!children || !children.length) {
5046
+ return;
5115
5047
  }
5116
- return;
5117
- }
5118
- if (type === Static) {
5119
- removeStaticNode(vnode);
5120
- return;
5121
- }
5122
- const performRemove = () => {
5123
- hostRemove(el);
5124
- if (transition && !transition.persisted && transition.afterLeave) {
5125
- transition.afterLeave();
5048
+ let child = children[0];
5049
+ if (children.length > 1) {
5050
+ for (const c of children) {
5051
+ if (c.type !== Comment) {
5052
+ child = c;
5053
+ break;
5054
+ }
5055
+ }
5126
5056
  }
5127
- };
5128
- if (vnode.shapeFlag & 1 && transition && !transition.persisted) {
5129
- const { leave, delayLeave } = transition;
5130
- const performLeave = () => leave(el, performRemove);
5131
- if (delayLeave) {
5132
- delayLeave(vnode.el, performRemove, performLeave);
5133
- } else {
5134
- performLeave();
5057
+ const rawProps = reactivity.toRaw(props);
5058
+ const { mode } = rawProps;
5059
+ if (state.isLeaving) {
5060
+ return emptyPlaceholder(child);
5135
5061
  }
5136
- } else {
5137
- performRemove();
5138
- }
5139
- };
5140
- const removeFragment = (cur, end) => {
5141
- let next;
5142
- while (cur !== end) {
5143
- next = hostNextSibling(cur);
5144
- hostRemove(cur);
5145
- cur = next;
5146
- }
5147
- hostRemove(end);
5148
- };
5149
- const unmountComponent = (instance, parentSuspense, doRemove) => {
5150
- const { bum, scope, update, subTree, um } = instance;
5151
- if (bum) {
5152
- shared.invokeArrayFns(bum);
5153
- }
5154
- scope.stop();
5155
- if (update) {
5156
- update.active = false;
5157
- unmount(subTree, instance, parentSuspense, doRemove);
5158
- }
5159
- if (um) {
5160
- queuePostRenderEffect(um, parentSuspense);
5161
- }
5162
- queuePostRenderEffect(() => {
5163
- instance.isUnmounted = true;
5164
- }, parentSuspense);
5165
- if (parentSuspense && parentSuspense.pendingBranch && !parentSuspense.isUnmounted && instance.asyncDep && !instance.asyncResolved && instance.suspenseId === parentSuspense.pendingId) {
5166
- parentSuspense.deps--;
5167
- if (parentSuspense.deps === 0) {
5168
- parentSuspense.resolve();
5062
+ const innerChild = getKeepAliveChild(child);
5063
+ if (!innerChild) {
5064
+ return emptyPlaceholder(child);
5169
5065
  }
5170
- }
5171
- };
5172
- const unmountChildren = (children, parentComponent, parentSuspense, doRemove = false, optimized = false, start = 0) => {
5173
- for (let i = start; i < children.length; i++) {
5174
- unmount(children[i], parentComponent, parentSuspense, doRemove, optimized);
5175
- }
5176
- };
5177
- const getNextHostNode = (vnode) => {
5178
- if (vnode.shapeFlag & 6) {
5179
- return getNextHostNode(vnode.component.subTree);
5180
- }
5181
- if (vnode.shapeFlag & 128) {
5182
- return vnode.suspense.next();
5183
- }
5184
- return hostNextSibling(vnode.anchor || vnode.el);
5066
+ let enterHooks = resolveTransitionHooks(
5067
+ innerChild,
5068
+ rawProps,
5069
+ state,
5070
+ instance,
5071
+ // #11061, ensure enterHooks is fresh after clone
5072
+ (hooks) => enterHooks = hooks
5073
+ );
5074
+ setTransitionHooks(innerChild, enterHooks);
5075
+ const oldChild = instance.subTree;
5076
+ const oldInnerChild = oldChild && getKeepAliveChild(oldChild);
5077
+ if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(innerChild, oldInnerChild) && recursiveGetSubtree(instance).type !== Comment) {
5078
+ const leavingHooks = resolveTransitionHooks(
5079
+ oldInnerChild,
5080
+ rawProps,
5081
+ state,
5082
+ instance
5083
+ );
5084
+ setTransitionHooks(oldInnerChild, leavingHooks);
5085
+ if (mode === "out-in" && innerChild.type !== Comment) {
5086
+ state.isLeaving = true;
5087
+ leavingHooks.afterLeave = () => {
5088
+ state.isLeaving = false;
5089
+ if (instance.update.active !== false) {
5090
+ instance.effect.dirty = true;
5091
+ instance.update();
5092
+ }
5093
+ };
5094
+ return emptyPlaceholder(child);
5095
+ } else if (mode === "in-out" && innerChild.type !== Comment) {
5096
+ leavingHooks.delayLeave = (el, earlyRemove, delayedLeave) => {
5097
+ const leavingVNodesCache = getLeavingNodesForType(
5098
+ state,
5099
+ oldInnerChild
5100
+ );
5101
+ leavingVNodesCache[String(oldInnerChild.key)] = oldInnerChild;
5102
+ el[leaveCbKey] = () => {
5103
+ earlyRemove();
5104
+ el[leaveCbKey] = void 0;
5105
+ delete enterHooks.delayedLeave;
5106
+ };
5107
+ enterHooks.delayedLeave = delayedLeave;
5108
+ };
5109
+ }
5110
+ }
5111
+ return child;
5112
+ };
5113
+ }
5114
+ };
5115
+ const BaseTransition = BaseTransitionImpl;
5116
+ function getLeavingNodesForType(state, vnode) {
5117
+ const { leavingVNodes } = state;
5118
+ let leavingVNodesCache = leavingVNodes.get(vnode.type);
5119
+ if (!leavingVNodesCache) {
5120
+ leavingVNodesCache = /* @__PURE__ */ Object.create(null);
5121
+ leavingVNodes.set(vnode.type, leavingVNodesCache);
5122
+ }
5123
+ return leavingVNodesCache;
5124
+ }
5125
+ function resolveTransitionHooks(vnode, props, state, instance, postClone) {
5126
+ const {
5127
+ appear,
5128
+ mode,
5129
+ persisted = false,
5130
+ onBeforeEnter,
5131
+ onEnter,
5132
+ onAfterEnter,
5133
+ onEnterCancelled,
5134
+ onBeforeLeave,
5135
+ onLeave,
5136
+ onAfterLeave,
5137
+ onLeaveCancelled,
5138
+ onBeforeAppear,
5139
+ onAppear,
5140
+ onAfterAppear,
5141
+ onAppearCancelled
5142
+ } = props;
5143
+ const key = String(vnode.key);
5144
+ const leavingVNodesCache = getLeavingNodesForType(state, vnode);
5145
+ const callHook = (hook, args) => {
5146
+ hook && callWithAsyncErrorHandling(
5147
+ hook,
5148
+ instance,
5149
+ 9,
5150
+ args
5151
+ );
5185
5152
  };
5186
- let isFlushing = false;
5187
- const render = (vnode, container, namespace) => {
5188
- if (vnode == null) {
5189
- if (container._vnode) {
5190
- unmount(container._vnode, null, null, true);
5191
- }
5192
- } else {
5193
- patch(
5194
- container._vnode || null,
5195
- vnode,
5196
- container,
5197
- null,
5198
- null,
5199
- null,
5200
- namespace
5201
- );
5202
- }
5203
- if (!isFlushing) {
5204
- isFlushing = true;
5205
- flushPreFlushCbs();
5206
- flushPostFlushCbs();
5207
- isFlushing = false;
5153
+ const callAsyncHook = (hook, args) => {
5154
+ const done = args[1];
5155
+ callHook(hook, args);
5156
+ if (shared.isArray(hook)) {
5157
+ if (hook.every((hook2) => hook2.length <= 1)) done();
5158
+ } else if (hook.length <= 1) {
5159
+ done();
5208
5160
  }
5209
- container._vnode = vnode;
5210
5161
  };
5211
- const internals = {
5212
- p: patch,
5213
- um: unmount,
5214
- m: move,
5215
- r: remove,
5216
- mt: mountComponent,
5217
- mc: mountChildren,
5218
- pc: patchChildren,
5219
- pbc: patchBlockChildren,
5220
- n: getNextHostNode,
5221
- o: options
5222
- };
5223
- let hydrate;
5224
- let hydrateNode;
5225
- if (createHydrationFns) {
5226
- [hydrate, hydrateNode] = createHydrationFns(
5227
- internals
5228
- );
5229
- }
5230
- return {
5231
- render,
5232
- hydrate,
5233
- createApp: createAppAPI(render, hydrate)
5234
- };
5235
- }
5236
- function resolveChildrenNamespace({ type, props }, currentNamespace) {
5237
- return currentNamespace === "svg" && type === "foreignObject" || currentNamespace === "mathml" && type === "annotation-xml" && props && props.encoding && props.encoding.includes("html") ? void 0 : currentNamespace;
5238
- }
5239
- function toggleRecurse({ effect, update }, allowed) {
5240
- effect.allowRecurse = update.allowRecurse = allowed;
5241
- }
5242
- function needTransition(parentSuspense, transition) {
5243
- return (!parentSuspense || parentSuspense && !parentSuspense.pendingBranch) && transition && !transition.persisted;
5244
- }
5245
- function traverseStaticChildren(n1, n2, shallow = false) {
5246
- const ch1 = n1.children;
5247
- const ch2 = n2.children;
5248
- if (shared.isArray(ch1) && shared.isArray(ch2)) {
5249
- for (let i = 0; i < ch1.length; i++) {
5250
- const c1 = ch1[i];
5251
- let c2 = ch2[i];
5252
- if (c2.shapeFlag & 1 && !c2.dynamicChildren) {
5253
- if (c2.patchFlag <= 0 || c2.patchFlag === 32) {
5254
- c2 = ch2[i] = cloneIfMounted(ch2[i]);
5255
- c2.el = c1.el;
5162
+ const hooks = {
5163
+ mode,
5164
+ persisted,
5165
+ beforeEnter(el) {
5166
+ let hook = onBeforeEnter;
5167
+ if (!state.isMounted) {
5168
+ if (appear) {
5169
+ hook = onBeforeAppear || onBeforeEnter;
5170
+ } else {
5171
+ return;
5256
5172
  }
5257
- if (!shallow)
5258
- traverseStaticChildren(c1, c2);
5259
5173
  }
5260
- if (c2.type === Text) {
5261
- c2.el = c1.el;
5174
+ if (el[leaveCbKey]) {
5175
+ el[leaveCbKey](
5176
+ true
5177
+ /* cancelled */
5178
+ );
5262
5179
  }
5263
- }
5264
- }
5265
- }
5266
- function getSequence(arr) {
5267
- const p = arr.slice();
5268
- const result = [0];
5269
- let i, j, u, v, c;
5270
- const len = arr.length;
5271
- for (i = 0; i < len; i++) {
5272
- const arrI = arr[i];
5273
- if (arrI !== 0) {
5274
- j = result[result.length - 1];
5275
- if (arr[j] < arrI) {
5276
- p[i] = j;
5277
- result.push(i);
5278
- continue;
5180
+ const leavingVNode = leavingVNodesCache[key];
5181
+ if (leavingVNode && isSameVNodeType(vnode, leavingVNode) && leavingVNode.el[leaveCbKey]) {
5182
+ leavingVNode.el[leaveCbKey]();
5279
5183
  }
5280
- u = 0;
5281
- v = result.length - 1;
5282
- while (u < v) {
5283
- c = u + v >> 1;
5284
- if (arr[result[c]] < arrI) {
5285
- u = c + 1;
5184
+ callHook(hook, [el]);
5185
+ },
5186
+ enter(el) {
5187
+ let hook = onEnter;
5188
+ let afterHook = onAfterEnter;
5189
+ let cancelHook = onEnterCancelled;
5190
+ if (!state.isMounted) {
5191
+ if (appear) {
5192
+ hook = onAppear || onEnter;
5193
+ afterHook = onAfterAppear || onAfterEnter;
5194
+ cancelHook = onAppearCancelled || onEnterCancelled;
5286
5195
  } else {
5287
- v = c;
5196
+ return;
5288
5197
  }
5289
5198
  }
5290
- if (arrI < arr[result[u]]) {
5291
- if (u > 0) {
5292
- p[i] = result[u - 1];
5199
+ let called = false;
5200
+ const done = el[enterCbKey] = (cancelled) => {
5201
+ if (called) return;
5202
+ called = true;
5203
+ if (cancelled) {
5204
+ callHook(cancelHook, [el]);
5205
+ } else {
5206
+ callHook(afterHook, [el]);
5293
5207
  }
5294
- result[u] = i;
5208
+ if (hooks.delayedLeave) {
5209
+ hooks.delayedLeave();
5210
+ }
5211
+ el[enterCbKey] = void 0;
5212
+ };
5213
+ if (hook) {
5214
+ callAsyncHook(hook, [el, done]);
5215
+ } else {
5216
+ done();
5217
+ }
5218
+ },
5219
+ leave(el, remove) {
5220
+ const key2 = String(vnode.key);
5221
+ if (el[enterCbKey]) {
5222
+ el[enterCbKey](
5223
+ true
5224
+ /* cancelled */
5225
+ );
5226
+ }
5227
+ if (state.isUnmounting) {
5228
+ return remove();
5229
+ }
5230
+ callHook(onBeforeLeave, [el]);
5231
+ let called = false;
5232
+ const done = el[leaveCbKey] = (cancelled) => {
5233
+ if (called) return;
5234
+ called = true;
5235
+ remove();
5236
+ if (cancelled) {
5237
+ callHook(onLeaveCancelled, [el]);
5238
+ } else {
5239
+ callHook(onAfterLeave, [el]);
5240
+ }
5241
+ el[leaveCbKey] = void 0;
5242
+ if (leavingVNodesCache[key2] === vnode) {
5243
+ delete leavingVNodesCache[key2];
5244
+ }
5245
+ };
5246
+ leavingVNodesCache[key2] = vnode;
5247
+ if (onLeave) {
5248
+ callAsyncHook(onLeave, [el, done]);
5249
+ } else {
5250
+ done();
5295
5251
  }
5252
+ },
5253
+ clone(vnode2) {
5254
+ const hooks2 = resolveTransitionHooks(
5255
+ vnode2,
5256
+ props,
5257
+ state,
5258
+ instance,
5259
+ postClone
5260
+ );
5261
+ if (postClone) postClone(hooks2);
5262
+ return hooks2;
5263
+ }
5264
+ };
5265
+ return hooks;
5266
+ }
5267
+ function emptyPlaceholder(vnode) {
5268
+ if (isKeepAlive(vnode)) {
5269
+ vnode = cloneVNode(vnode);
5270
+ vnode.children = null;
5271
+ return vnode;
5272
+ }
5273
+ }
5274
+ function getKeepAliveChild(vnode) {
5275
+ if (!isKeepAlive(vnode)) {
5276
+ return vnode;
5277
+ }
5278
+ const { shapeFlag, children } = vnode;
5279
+ if (children) {
5280
+ if (shapeFlag & 16) {
5281
+ return children[0];
5282
+ }
5283
+ if (shapeFlag & 32 && shared.isFunction(children.default)) {
5284
+ return children.default();
5296
5285
  }
5297
5286
  }
5298
- u = result.length;
5299
- v = result[u - 1];
5300
- while (u-- > 0) {
5301
- result[u] = v;
5302
- v = p[v];
5287
+ }
5288
+ function setTransitionHooks(vnode, hooks) {
5289
+ if (vnode.shapeFlag & 6 && vnode.component) {
5290
+ setTransitionHooks(vnode.component.subTree, hooks);
5291
+ } else if (vnode.shapeFlag & 128) {
5292
+ vnode.ssContent.transition = hooks.clone(vnode.ssContent);
5293
+ vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
5294
+ } else {
5295
+ vnode.transition = hooks;
5303
5296
  }
5304
- return result;
5305
5297
  }
5306
- function locateNonHydratedAsyncRoot(instance) {
5307
- const subComponent = instance.subTree.component;
5308
- if (subComponent) {
5309
- if (subComponent.asyncDep && !subComponent.asyncResolved) {
5310
- return subComponent;
5311
- } else {
5312
- return locateNonHydratedAsyncRoot(subComponent);
5298
+ function getTransitionRawChildren(children, keepComment = false, parentKey) {
5299
+ let ret = [];
5300
+ let keyedFragmentCount = 0;
5301
+ for (let i = 0; i < children.length; i++) {
5302
+ let child = children[i];
5303
+ const key = parentKey == null ? child.key : String(parentKey) + String(child.key != null ? child.key : i);
5304
+ if (child.type === Fragment) {
5305
+ if (child.patchFlag & 128) keyedFragmentCount++;
5306
+ ret = ret.concat(
5307
+ getTransitionRawChildren(child.children, keepComment, key)
5308
+ );
5309
+ } else if (keepComment || child.type !== Comment) {
5310
+ ret.push(key != null ? cloneVNode(child, { key }) : child);
5311
+ }
5312
+ }
5313
+ if (keyedFragmentCount > 1) {
5314
+ for (let i = 0; i < ret.length; i++) {
5315
+ ret[i].patchFlag = -2;
5313
5316
  }
5314
5317
  }
5318
+ return ret;
5315
5319
  }
5316
5320
 
5317
5321
  const isTeleport = (type) => type.__isTeleport;
@@ -5557,8 +5561,7 @@ function updateCssVars(vnode) {
5557
5561
  if (ctx && ctx.ut) {
5558
5562
  let node = vnode.children[0].el;
5559
5563
  while (node && node !== vnode.targetAnchor) {
5560
- if (node.nodeType === 1)
5561
- node.setAttribute("data-v-owner", ctx.uid);
5564
+ if (node.nodeType === 1) node.setAttribute("data-v-owner", ctx.uid);
5562
5565
  node = node.nextSibling;
5563
5566
  }
5564
5567
  ctx.ut();
@@ -5706,7 +5709,7 @@ function _createVNode(type, props = null, children = null, patchFlag = 0, dynami
5706
5709
  currentBlock.push(cloned);
5707
5710
  }
5708
5711
  }
5709
- cloned.patchFlag |= -2;
5712
+ cloned.patchFlag = -2;
5710
5713
  return cloned;
5711
5714
  }
5712
5715
  if (isClassComponent(type)) {
@@ -5738,8 +5741,7 @@ function _createVNode(type, props = null, children = null, patchFlag = 0, dynami
5738
5741
  );
5739
5742
  }
5740
5743
  function guardReactiveProps(props) {
5741
- if (!props)
5742
- return null;
5744
+ if (!props) return null;
5743
5745
  return reactivity.isProxy(props) || isInternalObject(props) ? shared.extend({}, props) : props;
5744
5746
  }
5745
5747
  function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false) {
@@ -5788,7 +5790,10 @@ function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false
5788
5790
  ce: vnode.ce
5789
5791
  };
5790
5792
  if (transition && cloneTransition) {
5791
- cloned.transition = transition.clone(cloned);
5793
+ setTransitionHooks(
5794
+ cloned,
5795
+ transition.clone(cloned)
5796
+ );
5792
5797
  }
5793
5798
  return cloned;
5794
5799
  }
@@ -5997,14 +6002,11 @@ let setInSSRSetupState;
5997
6002
  const g = shared.getGlobalThis();
5998
6003
  const registerGlobalSetter = (key, setter) => {
5999
6004
  let setters;
6000
- if (!(setters = g[key]))
6001
- setters = g[key] = [];
6005
+ if (!(setters = g[key])) setters = g[key] = [];
6002
6006
  setters.push(setter);
6003
6007
  return (v) => {
6004
- if (setters.length > 1)
6005
- setters.forEach((set) => set(v));
6006
- else
6007
- setters[0](v);
6008
+ if (setters.length > 1) setters.forEach((set) => set(v));
6009
+ else setters[0](v);
6008
6010
  };
6009
6011
  };
6010
6012
  internalSetCurrentInstance = registerGlobalSetter(
@@ -6160,7 +6162,7 @@ function createSetupContext(instance) {
6160
6162
  };
6161
6163
  }
6162
6164
  }
6163
- function getExposeProxy(instance) {
6165
+ function getComponentPublicInstance(instance) {
6164
6166
  if (instance.exposed) {
6165
6167
  return instance.exposeProxy || (instance.exposeProxy = new Proxy(reactivity.proxyRefs(reactivity.markRaw(instance.exposed)), {
6166
6168
  get(target, key) {
@@ -6174,6 +6176,8 @@ function getExposeProxy(instance) {
6174
6176
  return key in target || key in publicPropertiesMap;
6175
6177
  }
6176
6178
  }));
6179
+ } else {
6180
+ return instance.proxy;
6177
6181
  }
6178
6182
  }
6179
6183
  function getComponentName(Component, includeInferred = true) {
@@ -6267,6 +6271,7 @@ function withMemo(memo, render, cache, index) {
6267
6271
  }
6268
6272
  const ret = render();
6269
6273
  ret.memo = memo.slice();
6274
+ ret.memoIndex = index;
6270
6275
  return cache[index] = ret;
6271
6276
  }
6272
6277
  function isMemoSame(cached, memo) {
@@ -6285,7 +6290,7 @@ function isMemoSame(cached, memo) {
6285
6290
  return true;
6286
6291
  }
6287
6292
 
6288
- const version = "3.4.27";
6293
+ const version = "3.4.29";
6289
6294
  const warn$1 = shared.NOOP;
6290
6295
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
6291
6296
  const devtools = void 0;
@@ -6296,7 +6301,8 @@ const _ssrUtils = {
6296
6301
  renderComponentRoot,
6297
6302
  setCurrentRenderingInstance,
6298
6303
  isVNode: isVNode,
6299
- normalizeVNode
6304
+ normalizeVNode,
6305
+ getComponentPublicInstance
6300
6306
  };
6301
6307
  const ssrUtils = _ssrUtils ;
6302
6308
  const resolveFilter = null;