@cabloy/vue-runtime-core 3.5.31 → 3.5.33

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.
@@ -1042,1273 +1042,1272 @@ function getTransitionRawChildren(children, keepComment = false, parentKey) {
1042
1042
  return ret;
1043
1043
  }
1044
1044
 
1045
- /*! #__NO_SIDE_EFFECTS__ */
1046
- // @__NO_SIDE_EFFECTS__
1047
- function defineComponent(options, extraOptions) {
1048
- return shared.isFunction(options) ? (
1049
- // #8236: extend call and options.name access are considered side-effects
1050
- // by Rollup, so we have to wrap it in a pure-annotated IIFE.
1051
- /* @__PURE__ */ (() => shared.extend({ name: options.name }, extraOptions, { setup: options }))()
1052
- ) : options;
1053
- }
1054
-
1055
- function useId() {
1056
- const i = getCurrentInstance();
1057
- if (i) {
1058
- return (i.appContext.config.idPrefix || "v") + "-" + i.ids[0] + i.ids[1]++;
1059
- }
1060
- return "";
1061
- }
1062
- function markAsyncBoundary(instance) {
1063
- instance.ids = [instance.ids[0] + instance.ids[2]++ + "-", 0, 0];
1064
- }
1065
-
1066
- function useTemplateRef(key) {
1067
- const i = getCurrentInstance();
1068
- const r = reactivity.shallowRef(null);
1069
- if (i) {
1070
- const refs = i.refs === shared.EMPTY_OBJ ? i.refs = {} : i.refs;
1071
- {
1072
- Object.defineProperty(refs, key, {
1073
- enumerable: true,
1074
- get: () => r.value,
1075
- set: (val) => r.value = val
1076
- });
1077
- }
1078
- }
1079
- const ret = r;
1080
- return ret;
1081
- }
1082
-
1083
- function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
1084
- if (shared.isArray(rawRef)) {
1085
- rawRef.forEach(
1086
- (r, i) => setRef(
1087
- r,
1088
- oldRawRef && (shared.isArray(oldRawRef) ? oldRawRef[i] : oldRawRef),
1089
- parentSuspense,
1090
- vnode,
1091
- isUnmount
1092
- )
1093
- );
1094
- return;
1095
- }
1096
- if (isAsyncWrapper(vnode) && !isUnmount) {
1097
- if (vnode.shapeFlag & 512 && vnode.type.__asyncResolved && vnode.component.subTree.component) {
1098
- setRef(rawRef, oldRawRef, parentSuspense, vnode.component.subTree);
1099
- }
1100
- return;
1101
- }
1102
- const refValue = vnode.shapeFlag & 4 ? getComponentPublicInstance(vnode.component) : vnode.el;
1103
- const value = isUnmount ? null : refValue;
1104
- const { i: owner, r: ref } = rawRef;
1105
- const oldRef = oldRawRef && oldRawRef.r;
1106
- const refs = owner.refs === shared.EMPTY_OBJ ? owner.refs = {} : owner.refs;
1107
- const setupState = owner.setupState;
1108
- const rawSetupState = reactivity.toRaw(setupState);
1109
- const canSetSetupRef = setupState === shared.EMPTY_OBJ ? () => false : (key) => {
1110
- return shared.hasOwn(rawSetupState, key);
1111
- };
1112
- if (oldRef != null && oldRef !== ref) {
1113
- if (shared.isString(oldRef)) {
1114
- refs[oldRef] = null;
1115
- if (canSetSetupRef(oldRef)) {
1116
- setupState[oldRef] = null;
1117
- }
1118
- } else if (reactivity.isRef(oldRef)) {
1119
- oldRef.value = null;
1120
- }
1121
- }
1122
- if (shared.isFunction(ref)) {
1123
- callWithErrorHandling(ref, owner, 12, [value, refs]);
1124
- } else {
1125
- const _isString = shared.isString(ref);
1126
- const _isRef = reactivity.isRef(ref);
1127
- if (_isString || _isRef) {
1128
- const doSet = () => {
1129
- if (rawRef.f) {
1130
- const existing = _isString ? canSetSetupRef(ref) ? setupState[ref] : refs[ref] : ref.value;
1131
- if (isUnmount) {
1132
- shared.isArray(existing) && shared.remove(existing, refValue);
1133
- } else {
1134
- if (!shared.isArray(existing)) {
1135
- if (_isString) {
1136
- refs[ref] = [refValue];
1137
- if (canSetSetupRef(ref)) {
1138
- setupState[ref] = refs[ref];
1139
- }
1140
- } else {
1141
- ref.value = [refValue];
1142
- if (rawRef.k) refs[rawRef.k] = ref.value;
1143
- }
1144
- } else if (!existing.includes(refValue)) {
1145
- existing.push(refValue);
1146
- }
1147
- }
1148
- } else if (_isString) {
1149
- refs[ref] = value;
1150
- if (canSetSetupRef(ref)) {
1151
- setupState[ref] = value;
1152
- }
1153
- } else if (_isRef) {
1154
- ref.value = value;
1155
- if (rawRef.k) refs[rawRef.k] = value;
1156
- } else ;
1045
+ const isKeepAlive = (vnode) => vnode.type.__isKeepAlive;
1046
+ const KeepAliveImpl = {
1047
+ name: `KeepAlive`,
1048
+ // Marker for special handling inside the renderer. We are not using a ===
1049
+ // check directly on KeepAlive in the renderer, because importing it directly
1050
+ // would prevent it from being tree-shaken.
1051
+ __isKeepAlive: true,
1052
+ props: {
1053
+ include: [String, RegExp, Array],
1054
+ exclude: [String, RegExp, Array],
1055
+ max: [String, Number]
1056
+ },
1057
+ setup(props, { slots }) {
1058
+ const instance = getCurrentInstance();
1059
+ const sharedContext = instance.ctx;
1060
+ if (!sharedContext.renderer) {
1061
+ return () => {
1062
+ const children = slots.default && slots.default();
1063
+ return children && children.length === 1 ? children[0] : children;
1157
1064
  };
1158
- if (value) {
1159
- doSet.id = -1;
1160
- queuePostRenderEffect(doSet, parentSuspense);
1161
- } else {
1162
- doSet();
1163
- }
1164
1065
  }
1165
- }
1166
- }
1167
-
1168
- let hasLoggedMismatchError = false;
1169
- const logMismatchError = () => {
1170
- if (hasLoggedMismatchError) {
1171
- return;
1172
- }
1173
- console.error("Hydration completed but contains mismatches.");
1174
- hasLoggedMismatchError = true;
1175
- };
1176
- const isSVGContainer = (container) => container.namespaceURI.includes("svg") && container.tagName !== "foreignObject";
1177
- const isMathMLContainer = (container) => container.namespaceURI.includes("MathML");
1178
- const getContainerType = (container) => {
1179
- if (container.nodeType !== 1) return void 0;
1180
- if (isSVGContainer(container)) return "svg";
1181
- if (isMathMLContainer(container)) return "mathml";
1182
- return void 0;
1183
- };
1184
- const isComment = (node) => node.nodeType === 8;
1185
- function createHydrationFunctions(rendererInternals) {
1186
- const {
1187
- mt: mountComponent,
1188
- p: patch,
1189
- o: {
1190
- patchProp,
1191
- createText,
1192
- nextSibling,
1193
- parentNode,
1194
- remove,
1195
- insert,
1196
- createComment
1197
- }
1198
- } = rendererInternals;
1199
- const hydrate = (vnode, container) => {
1200
- if (!container.hasChildNodes()) {
1201
- patch(null, vnode, container);
1202
- flushPostFlushCbs();
1203
- container._vnode = vnode;
1204
- return;
1205
- }
1206
- hydrateNode(container.firstChild, vnode, null, null, null);
1207
- flushPostFlushCbs();
1208
- container._vnode = vnode;
1209
- };
1210
- const hydrateNode = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized = false) => {
1211
- optimized = optimized || !!vnode.dynamicChildren;
1212
- const isFragmentStart = isComment(node) && node.data === "[";
1213
- const onMismatch = () => handleMismatch(
1214
- node,
1215
- vnode,
1216
- parentComponent,
1217
- parentSuspense,
1218
- slotScopeIds,
1219
- isFragmentStart
1220
- );
1221
- const { type, ref, shapeFlag, patchFlag } = vnode;
1222
- let domType = node.nodeType;
1223
- vnode.el = node;
1224
- if (patchFlag === -2) {
1225
- optimized = false;
1226
- vnode.dynamicChildren = null;
1227
- }
1228
- let nextNode = null;
1229
- switch (type) {
1230
- case Text:
1231
- if (domType !== 3) {
1232
- if (vnode.children === "") {
1233
- insert(vnode.el = createText(""), parentNode(node), node);
1234
- nextNode = node;
1235
- } else {
1236
- nextNode = onMismatch();
1237
- }
1238
- } else {
1239
- if (node.data !== vnode.children) {
1240
- node.data = vnode.children;
1241
- }
1242
- nextNode = nextSibling(node);
1243
- }
1244
- break;
1245
- case Comment:
1246
- if (isTemplateNode(node)) {
1247
- nextNode = nextSibling(node);
1248
- replaceNode(
1249
- vnode.el = node.content.firstChild,
1250
- node,
1251
- parentComponent
1252
- );
1253
- } else if (domType !== 8 || isFragmentStart) {
1254
- nextNode = onMismatch();
1255
- } else {
1256
- nextNode = nextSibling(node);
1066
+ const cache = /* @__PURE__ */ new Map();
1067
+ const keys = /* @__PURE__ */ new Set();
1068
+ let current = null;
1069
+ const parentSuspense = instance.suspense;
1070
+ const {
1071
+ renderer: {
1072
+ p: patch,
1073
+ m: move,
1074
+ um: _unmount,
1075
+ o: { createElement }
1076
+ }
1077
+ } = sharedContext;
1078
+ const storageContainer = createElement("div");
1079
+ sharedContext.activate = (vnode, container, anchor, namespace, optimized) => {
1080
+ const instance2 = vnode.component;
1081
+ move(vnode, container, anchor, 0, parentSuspense);
1082
+ patch(
1083
+ instance2.vnode,
1084
+ vnode,
1085
+ container,
1086
+ anchor,
1087
+ instance2,
1088
+ parentSuspense,
1089
+ namespace,
1090
+ vnode.slotScopeIds,
1091
+ optimized
1092
+ );
1093
+ queuePostRenderEffect(() => {
1094
+ instance2.isDeactivated = false;
1095
+ if (instance2.a) {
1096
+ shared.invokeArrayFns(instance2.a);
1257
1097
  }
1258
- break;
1259
- case Static:
1260
- if (isFragmentStart) {
1261
- node = nextSibling(node);
1262
- domType = node.nodeType;
1098
+ const vnodeHook = vnode.props && vnode.props.onVnodeMounted;
1099
+ if (vnodeHook) {
1100
+ invokeVNodeHook(vnodeHook, instance2.parent, vnode);
1263
1101
  }
1264
- if (domType === 1 || domType === 3) {
1265
- nextNode = node;
1266
- const needToAdoptContent = !vnode.children.length;
1267
- for (let i = 0; i < vnode.staticCount; i++) {
1268
- if (needToAdoptContent)
1269
- vnode.children += nextNode.nodeType === 1 ? nextNode.outerHTML : nextNode.data;
1270
- if (i === vnode.staticCount - 1) {
1271
- vnode.anchor = nextNode;
1272
- }
1273
- nextNode = nextSibling(nextNode);
1274
- }
1275
- return isFragmentStart ? nextSibling(nextNode) : nextNode;
1276
- } else {
1277
- onMismatch();
1102
+ }, parentSuspense);
1103
+ };
1104
+ sharedContext.deactivate = (vnode) => {
1105
+ const instance2 = vnode.component;
1106
+ invalidateMount(instance2.m);
1107
+ invalidateMount(instance2.a);
1108
+ move(vnode, storageContainer, null, 1, parentSuspense);
1109
+ queuePostRenderEffect(() => {
1110
+ if (instance2.da) {
1111
+ shared.invokeArrayFns(instance2.da);
1278
1112
  }
1279
- break;
1280
- case Fragment:
1281
- if (!isFragmentStart) {
1282
- nextNode = onMismatch();
1283
- } else {
1284
- nextNode = hydrateFragment(
1285
- node,
1286
- vnode,
1287
- parentComponent,
1288
- parentSuspense,
1289
- slotScopeIds,
1290
- optimized
1291
- );
1113
+ const vnodeHook = vnode.props && vnode.props.onVnodeUnmounted;
1114
+ if (vnodeHook) {
1115
+ invokeVNodeHook(vnodeHook, instance2.parent, vnode);
1292
1116
  }
1293
- break;
1294
- default:
1295
- if (shapeFlag & 1) {
1296
- if ((domType !== 1 || vnode.type.toLowerCase() !== node.tagName.toLowerCase()) && !isTemplateNode(node)) {
1297
- nextNode = onMismatch();
1298
- } else {
1299
- nextNode = hydrateElement(
1300
- node,
1301
- vnode,
1302
- parentComponent,
1303
- parentSuspense,
1304
- slotScopeIds,
1305
- optimized
1306
- );
1307
- }
1308
- } else if (shapeFlag & 6) {
1309
- vnode.slotScopeIds = slotScopeIds;
1310
- const container = parentNode(node);
1311
- if (isFragmentStart) {
1312
- nextNode = locateClosingAnchor(node);
1313
- } else if (isComment(node) && node.data === "teleport start") {
1314
- nextNode = locateClosingAnchor(node, node.data, "teleport end");
1315
- } else {
1316
- nextNode = nextSibling(node);
1317
- }
1318
- mountComponent(
1319
- vnode,
1320
- container,
1321
- null,
1322
- parentComponent,
1323
- parentSuspense,
1324
- getContainerType(container),
1325
- optimized
1326
- );
1327
- if (isAsyncWrapper(vnode) && !vnode.type.__asyncResolved) {
1328
- let subTree;
1329
- if (isFragmentStart) {
1330
- subTree = createVNode(Fragment);
1331
- subTree.anchor = nextNode ? nextNode.previousSibling : container.lastChild;
1332
- } else {
1333
- subTree = node.nodeType === 3 ? createTextVNode("") : createVNode("div");
1334
- }
1335
- subTree.el = node;
1336
- vnode.component.subTree = subTree;
1337
- }
1338
- } else if (shapeFlag & 64) {
1339
- if (domType !== 8) {
1340
- nextNode = onMismatch();
1341
- } else {
1342
- nextNode = vnode.type.hydrate(
1343
- node,
1344
- vnode,
1345
- parentComponent,
1346
- parentSuspense,
1347
- slotScopeIds,
1348
- optimized,
1349
- rendererInternals,
1350
- hydrateChildren
1351
- );
1352
- }
1353
- } else if (shapeFlag & 128) {
1354
- nextNode = vnode.type.hydrate(
1355
- node,
1356
- vnode,
1357
- parentComponent,
1358
- parentSuspense,
1359
- getContainerType(parentNode(node)),
1360
- slotScopeIds,
1361
- optimized,
1362
- rendererInternals,
1363
- hydrateNode
1364
- );
1365
- } else ;
1366
- }
1367
- if (ref != null) {
1368
- setRef(ref, null, parentSuspense, vnode);
1117
+ instance2.isDeactivated = true;
1118
+ }, parentSuspense);
1119
+ };
1120
+ function unmount(vnode) {
1121
+ resetShapeFlag(vnode);
1122
+ _unmount(vnode, instance, parentSuspense, true);
1369
1123
  }
1370
- return nextNode;
1371
- };
1372
- function _getValidZova(instance) {
1373
- while (instance) {
1374
- if (instance.zova) return instance.zova;
1375
- instance = instance.parent;
1124
+ function pruneCache(filter) {
1125
+ cache.forEach((vnode, key) => {
1126
+ const name = vnode.key;
1127
+ if (name && !filter(name)) {
1128
+ pruneCacheEntry(key);
1129
+ }
1130
+ });
1376
1131
  }
1377
- }
1378
- const hydrateElement = (el, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
1379
- optimized = optimized || !!vnode.dynamicChildren;
1380
- const { type, props, patchFlag, shapeFlag, dirs, transition } = vnode;
1381
- const forcePatch = type === "input" || type === "option";
1382
- if (forcePatch || patchFlag !== -1) {
1383
- if (dirs) {
1384
- invokeDirectiveHook(vnode, null, parentComponent, "created");
1132
+ function pruneCacheEntry(key) {
1133
+ const cached = cache.get(key);
1134
+ if (cached && (!current || !isSameVNodeType(cached, current))) {
1135
+ unmount(cached);
1136
+ } else if (current) {
1137
+ resetShapeFlag(current);
1385
1138
  }
1386
- let needCallTransitionHooks = false;
1387
- if (isTemplateNode(el)) {
1388
- needCallTransitionHooks = needTransition(
1389
- null,
1390
- // no need check parentSuspense in hydration
1391
- transition
1392
- ) && parentComponent && parentComponent.vnode.props && parentComponent.vnode.props.appear;
1393
- const content = el.content.firstChild;
1394
- if (needCallTransitionHooks) {
1395
- transition.beforeEnter(content);
1139
+ cache.delete(key);
1140
+ keys.delete(key);
1141
+ }
1142
+ watch(
1143
+ () => [props.include, props.exclude],
1144
+ ([include, exclude]) => {
1145
+ include && pruneCache((name) => matches(include, name));
1146
+ exclude && pruneCache((name) => !matches(exclude, name));
1147
+ },
1148
+ // prune post-render after `current` has been updated
1149
+ { flush: "post", deep: true }
1150
+ );
1151
+ let pendingCacheKey = null;
1152
+ const cacheSubtree = () => {
1153
+ if (pendingCacheKey != null) {
1154
+ if (isSuspense(instance.subTree.type)) {
1155
+ queuePostRenderEffect(() => {
1156
+ cache.set(pendingCacheKey, getInnerChild(instance.subTree));
1157
+ }, instance.subTree.suspense);
1158
+ } else {
1159
+ cache.set(pendingCacheKey, getInnerChild(instance.subTree));
1396
1160
  }
1397
- replaceNode(content, el, parentComponent);
1398
- vnode.el = el = content;
1399
1161
  }
1400
- if (shapeFlag & 16 && // skip if element has innerHTML / textContent
1401
- !(props && (props.innerHTML || props.textContent))) {
1402
- let next = hydrateChildren(
1403
- el.firstChild,
1404
- vnode,
1405
- el,
1406
- parentComponent,
1407
- parentSuspense,
1408
- slotScopeIds,
1409
- optimized
1410
- );
1411
- while (next) {
1412
- if (!isMismatchAllowed(el, 1 /* CHILDREN */)) {
1413
- logMismatchError();
1414
- }
1415
- const cur = next;
1416
- next = next.nextSibling;
1417
- remove(cur);
1418
- }
1419
- } else if (shapeFlag & 8) {
1420
- let clientText = vnode.children;
1421
- if (clientText[0] === "\n" && (el.tagName === "PRE" || el.tagName === "TEXTAREA")) {
1422
- clientText = clientText.slice(1);
1423
- }
1424
- if (el.textContent !== clientText) {
1425
- if (!isMismatchAllowed(el, 0 /* TEXT */)) {
1426
- logMismatchError();
1427
- }
1428
- el.textContent = vnode.children;
1162
+ };
1163
+ onMounted(cacheSubtree);
1164
+ onUpdated(cacheSubtree);
1165
+ onBeforeUnmount(() => {
1166
+ cache.forEach((cached) => {
1167
+ const { subTree, suspense } = instance;
1168
+ const vnode = getInnerChild(subTree);
1169
+ if (cached.type === vnode.type && cached.key === vnode.key) {
1170
+ resetShapeFlag(vnode);
1171
+ const da = vnode.component.da;
1172
+ da && queuePostRenderEffect(da, suspense);
1173
+ return;
1429
1174
  }
1175
+ unmount(cached);
1176
+ });
1177
+ });
1178
+ return () => {
1179
+ pendingCacheKey = null;
1180
+ if (!slots.default) {
1181
+ return current = null;
1430
1182
  }
1431
- if (props) {
1432
- if (forcePatch || !optimized || patchFlag & (16 | 32)) {
1433
- const isCustomElement = el.tagName.includes("-");
1434
- for (const key in props) {
1435
- let clientValue = props[key];
1436
- const zova = _getValidZova(parentComponent);
1437
- if (zova) {
1438
- const res = zova.meta.$ssr._hydratePropHasMismatch(
1439
- el,
1440
- key,
1441
- clientValue,
1442
- vnode,
1443
- parentComponent
1444
- );
1445
- if (res.ignore) ; else {
1446
- clientValue = res.clientValue;
1447
- }
1448
- }
1449
- if (forcePatch && (key.endsWith("value") || key === "indeterminate") || shared.isOn(key) && !shared.isReservedProp(key) || // force hydrate v-bind with .prop modifiers
1450
- key[0] === "." || isCustomElement) {
1451
- patchProp(el, key, null, props[key], void 0, parentComponent);
1452
- }
1453
- }
1454
- } else if (props.onClick) {
1455
- patchProp(
1456
- el,
1457
- "onClick",
1458
- null,
1459
- props.onClick,
1460
- void 0,
1461
- parentComponent
1462
- );
1463
- } else if (patchFlag & 4 && reactivity.isReactive(props.style)) {
1464
- for (const key in props.style) props.style[key];
1465
- }
1183
+ const children = slots.default();
1184
+ const rawVNode = children[0];
1185
+ if (children.length > 1) {
1186
+ current = null;
1187
+ return children;
1188
+ } else if (!isVNode(rawVNode) || !(rawVNode.shapeFlag & 4) && !(rawVNode.shapeFlag & 128)) {
1189
+ current = null;
1190
+ return rawVNode;
1466
1191
  }
1467
- let vnodeHooks;
1468
- if (vnodeHooks = props && props.onVnodeBeforeMount) {
1469
- invokeVNodeHook(vnodeHooks, parentComponent, vnode);
1192
+ let vnode = getInnerChild(rawVNode);
1193
+ if (vnode.type === Comment) {
1194
+ current = null;
1195
+ return vnode;
1470
1196
  }
1471
- if (dirs) {
1472
- invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
1197
+ const comp = vnode.type;
1198
+ const name = vnode.key;
1199
+ const { include, exclude, max } = props;
1200
+ if (include && (!name || !matches(include, name)) || exclude && name && matches(exclude, name)) {
1201
+ vnode.shapeFlag &= ~256;
1202
+ current = vnode;
1203
+ current.component.zovaHostProviders = current.zovaHostProviders;
1204
+ return rawVNode;
1473
1205
  }
1474
- if ((vnodeHooks = props && props.onVnodeMounted) || dirs || needCallTransitionHooks) {
1475
- queueEffectWithSuspense(() => {
1476
- vnodeHooks && invokeVNodeHook(vnodeHooks, parentComponent, vnode);
1477
- needCallTransitionHooks && transition.enter(el);
1478
- dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
1479
- }, parentSuspense);
1206
+ const key = vnode.key == null ? comp : vnode.key;
1207
+ const cachedVNode = cache.get(key);
1208
+ if (vnode.el) {
1209
+ vnode = cloneVNode(vnode);
1210
+ if (rawVNode.shapeFlag & 128) {
1211
+ rawVNode.ssContent = vnode;
1212
+ }
1480
1213
  }
1481
- }
1482
- return el.nextSibling;
1483
- };
1484
- const hydrateChildren = (node, parentVNode, container, parentComponent, parentSuspense, slotScopeIds, optimized) => {
1485
- optimized = optimized || !!parentVNode.dynamicChildren;
1486
- const children = parentVNode.children;
1487
- const l = children.length;
1488
- for (let i = 0; i < l; i++) {
1489
- const vnode = optimized ? children[i] : children[i] = normalizeVNode(children[i]);
1490
- const isText = vnode.type === Text;
1491
- if (node) {
1492
- if (isText && !optimized) {
1493
- if (i + 1 < l && normalizeVNode(children[i + 1]).type === Text) {
1494
- insert(
1495
- createText(
1496
- node.data.slice(vnode.children.length)
1497
- ),
1498
- container,
1499
- nextSibling(node)
1500
- );
1501
- node.data = vnode.children;
1502
- }
1214
+ pendingCacheKey = key;
1215
+ if (cachedVNode) {
1216
+ vnode.el = cachedVNode.el;
1217
+ vnode.component = cachedVNode.component;
1218
+ if (vnode.transition) {
1219
+ setTransitionHooks(vnode, vnode.transition);
1503
1220
  }
1504
- node = hydrateNode(
1505
- node,
1506
- vnode,
1507
- parentComponent,
1508
- parentSuspense,
1509
- slotScopeIds,
1510
- optimized
1511
- );
1512
- } else if (isText && !vnode.children) {
1513
- insert(vnode.el = createText(""), container);
1221
+ vnode.shapeFlag |= 512;
1222
+ keys.delete(key);
1223
+ keys.add(key);
1514
1224
  } else {
1515
- if (!isMismatchAllowed(container, 1 /* CHILDREN */)) {
1516
- logMismatchError();
1225
+ keys.add(key);
1226
+ if (max && keys.size > parseInt(max, 10)) {
1227
+ pruneCacheEntry(keys.values().next().value);
1517
1228
  }
1518
- patch(
1519
- null,
1520
- vnode,
1521
- container,
1522
- null,
1523
- parentComponent,
1524
- parentSuspense,
1525
- getContainerType(container),
1526
- slotScopeIds
1527
- );
1528
1229
  }
1230
+ vnode.shapeFlag |= 256;
1231
+ current = vnode;
1232
+ current.component.zovaHostProviders = current.zovaHostProviders;
1233
+ return isSuspense(rawVNode.type) ? rawVNode : vnode;
1234
+ };
1235
+ }
1236
+ };
1237
+ const KeepAlive = KeepAliveImpl;
1238
+ function matches(pattern, name) {
1239
+ if (shared.isArray(pattern)) {
1240
+ return pattern.some((p) => matches(p, name));
1241
+ } else if (shared.isString(pattern)) {
1242
+ return pattern.split(",").includes(name);
1243
+ } else if (shared.isRegExp(pattern)) {
1244
+ pattern.lastIndex = 0;
1245
+ return pattern.test(name);
1246
+ }
1247
+ return false;
1248
+ }
1249
+ function onActivated(hook, target) {
1250
+ registerKeepAliveHook(hook, "a", target);
1251
+ }
1252
+ function onDeactivated(hook, target) {
1253
+ registerKeepAliveHook(hook, "da", target);
1254
+ }
1255
+ function registerKeepAliveHook(hook, type, target = currentInstance) {
1256
+ const wrappedHook = hook.__wdc || (hook.__wdc = () => {
1257
+ let current = target;
1258
+ while (current) {
1259
+ if (current.isDeactivated) {
1260
+ return;
1261
+ }
1262
+ current = current.parent;
1529
1263
  }
1530
- return node;
1531
- };
1532
- const hydrateFragment = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
1533
- const { slotScopeIds: fragmentSlotScopeIds } = vnode;
1534
- if (fragmentSlotScopeIds) {
1535
- slotScopeIds = slotScopeIds ? slotScopeIds.concat(fragmentSlotScopeIds) : fragmentSlotScopeIds;
1264
+ return hook();
1265
+ });
1266
+ injectHook(type, wrappedHook, target);
1267
+ if (target) {
1268
+ let current = target.parent;
1269
+ while (current && current.parent) {
1270
+ if (isKeepAlive(current.parent.vnode)) {
1271
+ injectToKeepAliveRoot(wrappedHook, type, target, current);
1272
+ }
1273
+ current = current.parent;
1536
1274
  }
1537
- const container = parentNode(node);
1538
- const next = hydrateChildren(
1539
- nextSibling(node),
1540
- vnode,
1541
- container,
1542
- parentComponent,
1543
- parentSuspense,
1544
- slotScopeIds,
1545
- optimized
1546
- );
1547
- if (next && isComment(next) && next.data === "]") {
1548
- return nextSibling(vnode.anchor = next);
1275
+ }
1276
+ }
1277
+ function injectToKeepAliveRoot(hook, type, target, keepAliveRoot) {
1278
+ const injected = injectHook(
1279
+ type,
1280
+ hook,
1281
+ keepAliveRoot,
1282
+ true
1283
+ /* prepend */
1284
+ );
1285
+ onUnmounted(() => {
1286
+ shared.remove(keepAliveRoot[type], injected);
1287
+ }, target);
1288
+ }
1289
+ function resetShapeFlag(vnode) {
1290
+ vnode.shapeFlag &= ~256;
1291
+ vnode.shapeFlag &= ~512;
1292
+ }
1293
+ function getInnerChild(vnode) {
1294
+ return vnode.shapeFlag & 128 ? vnode.ssContent : vnode;
1295
+ }
1296
+
1297
+ function injectHook(type, hook, target = currentInstance, prepend = false) {
1298
+ if (target) {
1299
+ const hooks = target[type] || (target[type] = []);
1300
+ const wrappedHook = hook.__weh || (hook.__weh = (...args) => {
1301
+ reactivity.pauseTracking();
1302
+ const reset = setCurrentInstance(target);
1303
+ const res = callWithAsyncErrorHandling(hook, target, type, args);
1304
+ reset();
1305
+ reactivity.resetTracking();
1306
+ return res;
1307
+ });
1308
+ if (prepend) {
1309
+ hooks.unshift(wrappedHook);
1549
1310
  } else {
1550
- logMismatchError();
1551
- insert(vnode.anchor = createComment(`]`), container, next);
1552
- return next;
1553
- }
1554
- };
1555
- const handleMismatch = (node, vnode, parentComponent, parentSuspense, slotScopeIds, isFragment) => {
1556
- if (!isMismatchAllowed(node.parentElement, 1 /* CHILDREN */)) {
1557
- logMismatchError();
1558
- }
1559
- vnode.el = null;
1560
- if (isFragment) {
1561
- const end = locateClosingAnchor(node);
1562
- while (true) {
1563
- const next2 = nextSibling(node);
1564
- if (next2 && next2 !== end) {
1565
- remove(next2);
1566
- } else {
1567
- break;
1568
- }
1569
- }
1311
+ hooks.push(wrappedHook);
1570
1312
  }
1571
- const next = nextSibling(node);
1572
- const container = parentNode(node);
1573
- remove(node);
1574
- patch(
1575
- null,
1576
- vnode,
1577
- container,
1578
- next,
1579
- parentComponent,
1580
- parentSuspense,
1581
- getContainerType(container),
1582
- slotScopeIds
1313
+ return wrappedHook;
1314
+ }
1315
+ }
1316
+ const createHook = (lifecycle) => (hook, target = currentInstance) => {
1317
+ if (!isInSSRComponentSetup || lifecycle === "sp") {
1318
+ injectHook(lifecycle, (...args) => hook(...args), target);
1319
+ }
1320
+ if (lifecycle === "m" && target && target.isMounted) {
1321
+ hook();
1322
+ }
1323
+ };
1324
+ const onBeforeMount = createHook("bm");
1325
+ const onMounted = createHook("m");
1326
+ const onBeforeUpdate = createHook(
1327
+ "bu"
1328
+ );
1329
+ const onUpdated = createHook("u");
1330
+ const onBeforeUnmount = createHook(
1331
+ "bum"
1332
+ );
1333
+ const onUnmounted = createHook("um");
1334
+ const onServerPrefetch = createHook(
1335
+ "sp"
1336
+ );
1337
+ const onRenderTriggered = createHook("rtg");
1338
+ const onRenderTracked = createHook("rtc");
1339
+ function onErrorCaptured(hook, target = currentInstance) {
1340
+ injectHook("ec", hook, target);
1341
+ }
1342
+
1343
+ const COMPONENTS = "components";
1344
+ const DIRECTIVES = "directives";
1345
+ function resolveComponent(name, maybeSelfReference) {
1346
+ return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;
1347
+ }
1348
+ const NULL_DYNAMIC_COMPONENT = Symbol.for("v-ndc");
1349
+ function resolveDynamicComponent(component) {
1350
+ if (shared.isString(component)) {
1351
+ return resolveAsset(COMPONENTS, component, false) || component;
1352
+ } else {
1353
+ return component || NULL_DYNAMIC_COMPONENT;
1354
+ }
1355
+ }
1356
+ function resolveDirective(name) {
1357
+ return resolveAsset(DIRECTIVES, name);
1358
+ }
1359
+ function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false) {
1360
+ const instance = currentRenderingInstance || currentInstance;
1361
+ if (instance) {
1362
+ const Component = instance.type;
1363
+ if (type === COMPONENTS) {
1364
+ const selfName = getComponentName(
1365
+ Component,
1366
+ false
1367
+ );
1368
+ if (selfName && (selfName === name || selfName === shared.camelize(name) || selfName === shared.capitalize(shared.camelize(name)))) {
1369
+ return Component;
1370
+ }
1371
+ }
1372
+ const res = (
1373
+ // local registration
1374
+ // check instance[type] first which is resolved for options API
1375
+ resolve(instance[type] || Component[type], name) || // global registration
1376
+ resolve(instance.appContext[type], name)
1583
1377
  );
1584
- if (parentComponent) {
1585
- parentComponent.vnode.el = vnode.el;
1586
- updateHOCHostEl(parentComponent, vnode.el);
1378
+ if (!res && maybeSelfReference) {
1379
+ return Component;
1587
1380
  }
1588
- return next;
1589
- };
1590
- const locateClosingAnchor = (node, open = "[", close = "]") => {
1591
- let match = 0;
1592
- while (node) {
1593
- node = nextSibling(node);
1594
- if (node && isComment(node)) {
1595
- if (node.data === open) match++;
1596
- if (node.data === close) {
1597
- if (match === 0) {
1598
- return nextSibling(node);
1599
- } else {
1600
- match--;
1601
- }
1602
- }
1603
- }
1381
+ return res;
1382
+ }
1383
+ }
1384
+ function resolve(registry, name) {
1385
+ return registry && (registry[name] || registry[shared.camelize(name)] || registry[shared.capitalize(shared.camelize(name))]);
1386
+ }
1387
+
1388
+ function renderList(source, renderItem, cache, index) {
1389
+ let ret;
1390
+ const cached = cache && cache[index];
1391
+ const sourceIsArray = shared.isArray(source);
1392
+ if (sourceIsArray || shared.isString(source)) {
1393
+ const sourceIsReactiveArray = sourceIsArray && reactivity.isReactive(source);
1394
+ let needsWrap = false;
1395
+ if (sourceIsReactiveArray) {
1396
+ needsWrap = !reactivity.isShallow(source);
1397
+ source = reactivity.shallowReadArray(source);
1604
1398
  }
1605
- return node;
1606
- };
1607
- const replaceNode = (newNode, oldNode, parentComponent) => {
1608
- const parentNode2 = oldNode.parentNode;
1609
- if (parentNode2) {
1610
- parentNode2.replaceChild(newNode, oldNode);
1399
+ ret = new Array(source.length);
1400
+ for (let i = 0, l = source.length; i < l; i++) {
1401
+ ret[i] = renderItem(
1402
+ needsWrap ? reactivity.toReactive(source[i]) : source[i],
1403
+ i,
1404
+ void 0,
1405
+ cached && cached[i]
1406
+ );
1611
1407
  }
1612
- let parent = parentComponent;
1613
- while (parent) {
1614
- if (parent.vnode.el === oldNode) {
1615
- parent.vnode.el = parent.subTree.el = newNode;
1616
- }
1617
- parent = parent.parent;
1408
+ } else if (typeof source === "number") {
1409
+ ret = new Array(source);
1410
+ for (let i = 0; i < source; i++) {
1411
+ ret[i] = renderItem(i + 1, i, void 0, cached && cached[i]);
1618
1412
  }
1619
- };
1620
- const isTemplateNode = (node) => {
1621
- return node.nodeType === 1 && node.tagName === "TEMPLATE";
1622
- };
1623
- return [hydrate, hydrateNode];
1624
- }
1625
- const allowMismatchAttr = "data-allow-mismatch";
1626
- const MismatchTypeString = {
1627
- [0 /* TEXT */]: "text",
1628
- [1 /* CHILDREN */]: "children",
1629
- [2 /* CLASS */]: "class",
1630
- [3 /* STYLE */]: "style",
1631
- [4 /* ATTRIBUTE */]: "attribute"
1632
- };
1633
- function isMismatchAllowed(el, allowedType) {
1634
- if (allowedType === 0 /* TEXT */ || allowedType === 1 /* CHILDREN */) {
1635
- while (el && !el.hasAttribute(allowMismatchAttr)) {
1636
- el = el.parentElement;
1413
+ } else if (shared.isObject(source)) {
1414
+ if (source[Symbol.iterator]) {
1415
+ ret = Array.from(
1416
+ source,
1417
+ (item, i) => renderItem(item, i, void 0, cached && cached[i])
1418
+ );
1419
+ } else {
1420
+ const keys = Object.keys(source);
1421
+ ret = new Array(keys.length);
1422
+ for (let i = 0, l = keys.length; i < l; i++) {
1423
+ const key = keys[i];
1424
+ ret[i] = renderItem(source[key], key, i, cached && cached[i]);
1425
+ }
1637
1426
  }
1638
- }
1639
- const allowedAttr = el && el.getAttribute(allowMismatchAttr);
1640
- if (allowedAttr == null) {
1641
- return false;
1642
- } else if (allowedAttr === "") {
1643
- return true;
1644
1427
  } else {
1645
- const list = allowedAttr.split(",");
1646
- if (allowedType === 0 /* TEXT */ && list.includes("children")) {
1647
- return true;
1428
+ ret = [];
1429
+ }
1430
+ if (cache) {
1431
+ cache[index] = ret;
1432
+ }
1433
+ return ret;
1434
+ }
1435
+
1436
+ function createSlots(slots, dynamicSlots) {
1437
+ for (let i = 0; i < dynamicSlots.length; i++) {
1438
+ const slot = dynamicSlots[i];
1439
+ if (shared.isArray(slot)) {
1440
+ for (let j = 0; j < slot.length; j++) {
1441
+ slots[slot[j].name] = slot[j].fn;
1442
+ }
1443
+ } else if (slot) {
1444
+ slots[slot.name] = slot.key ? (...args) => {
1445
+ const res = slot.fn(...args);
1446
+ if (res) res.key = slot.key;
1447
+ return res;
1448
+ } : slot.fn;
1648
1449
  }
1649
- return allowedAttr.split(",").includes(MismatchTypeString[allowedType]);
1650
1450
  }
1451
+ return slots;
1651
1452
  }
1652
1453
 
1653
- const requestIdleCallback = shared.getGlobalThis().requestIdleCallback || ((cb) => setTimeout(cb, 1));
1654
- const cancelIdleCallback = shared.getGlobalThis().cancelIdleCallback || ((id) => clearTimeout(id));
1655
- const hydrateOnIdle = (timeout = 1e4) => (hydrate) => {
1656
- const id = requestIdleCallback(hydrate, { timeout });
1657
- return () => cancelIdleCallback(id);
1658
- };
1659
- function elementIsVisibleInViewport(el) {
1660
- const { top, left, bottom, right } = el.getBoundingClientRect();
1661
- const { innerHeight, innerWidth } = window;
1662
- return (top > 0 && top < innerHeight || bottom > 0 && bottom < innerHeight) && (left > 0 && left < innerWidth || right > 0 && right < innerWidth);
1454
+ /*! #__NO_SIDE_EFFECTS__ */
1455
+ // @__NO_SIDE_EFFECTS__
1456
+ function defineComponent(options, extraOptions) {
1457
+ return shared.isFunction(options) ? (
1458
+ // #8236: extend call and options.name access are considered side-effects
1459
+ // by Rollup, so we have to wrap it in a pure-annotated IIFE.
1460
+ /* @__PURE__ */ (() => shared.extend({ name: options.name }, extraOptions, { setup: options }))()
1461
+ ) : options;
1663
1462
  }
1664
- const hydrateOnVisible = (opts) => (hydrate, forEach) => {
1665
- const ob = new IntersectionObserver((entries) => {
1666
- for (const e of entries) {
1667
- if (!e.isIntersecting) continue;
1668
- ob.disconnect();
1669
- hydrate();
1670
- break;
1671
- }
1672
- }, opts);
1673
- forEach((el) => {
1674
- if (!(el instanceof Element)) return;
1675
- if (elementIsVisibleInViewport(el)) {
1676
- hydrate();
1677
- ob.disconnect();
1678
- return false;
1679
- }
1680
- ob.observe(el);
1681
- });
1682
- return () => ob.disconnect();
1683
- };
1684
- const hydrateOnMediaQuery = (query) => (hydrate) => {
1685
- if (query) {
1686
- const mql = matchMedia(query);
1687
- if (mql.matches) {
1688
- hydrate();
1689
- } else {
1690
- mql.addEventListener("change", hydrate, { once: true });
1691
- return () => mql.removeEventListener("change", hydrate);
1463
+
1464
+ function useId() {
1465
+ const i = getCurrentInstance();
1466
+ if (i) {
1467
+ return (i.appContext.config.idPrefix || "v") + "-" + i.ids[0] + i.ids[1]++;
1468
+ }
1469
+ return "";
1470
+ }
1471
+ function markAsyncBoundary(instance) {
1472
+ instance.ids = [instance.ids[0] + instance.ids[2]++ + "-", 0, 0];
1473
+ }
1474
+
1475
+ function useTemplateRef(key) {
1476
+ const i = getCurrentInstance();
1477
+ const r = reactivity.shallowRef(null);
1478
+ if (i) {
1479
+ const refs = i.refs === shared.EMPTY_OBJ ? i.refs = {} : i.refs;
1480
+ {
1481
+ Object.defineProperty(refs, key, {
1482
+ enumerable: true,
1483
+ get: () => r.value,
1484
+ set: (val) => r.value = val
1485
+ });
1692
1486
  }
1693
1487
  }
1694
- };
1695
- const hydrateOnInteraction = (interactions = []) => (hydrate, forEach) => {
1696
- if (shared.isString(interactions)) interactions = [interactions];
1697
- let hasHydrated = false;
1698
- const doHydrate = (e) => {
1699
- if (!hasHydrated) {
1700
- hasHydrated = true;
1701
- teardown();
1702
- hydrate();
1703
- e.target.dispatchEvent(new e.constructor(e.type, e));
1488
+ const ret = r;
1489
+ return ret;
1490
+ }
1491
+
1492
+ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
1493
+ if (shared.isArray(rawRef)) {
1494
+ rawRef.forEach(
1495
+ (r, i) => setRef(
1496
+ r,
1497
+ oldRawRef && (shared.isArray(oldRawRef) ? oldRawRef[i] : oldRawRef),
1498
+ parentSuspense,
1499
+ vnode,
1500
+ isUnmount
1501
+ )
1502
+ );
1503
+ return;
1504
+ }
1505
+ if (isAsyncWrapper(vnode) && !isUnmount) {
1506
+ if (vnode.shapeFlag & 512 && vnode.type.__asyncResolved && vnode.component.subTree.component) {
1507
+ setRef(rawRef, oldRawRef, parentSuspense, vnode.component.subTree);
1704
1508
  }
1509
+ return;
1510
+ }
1511
+ const refValue = vnode.shapeFlag & 4 ? getComponentPublicInstance(vnode.component) : vnode.el;
1512
+ const value = isUnmount ? null : refValue;
1513
+ const { i: owner, r: ref } = rawRef;
1514
+ const oldRef = oldRawRef && oldRawRef.r;
1515
+ const refs = owner.refs === shared.EMPTY_OBJ ? owner.refs = {} : owner.refs;
1516
+ const setupState = owner.setupState;
1517
+ const rawSetupState = reactivity.toRaw(setupState);
1518
+ const canSetSetupRef = setupState === shared.EMPTY_OBJ ? () => false : (key) => {
1519
+ return shared.hasOwn(rawSetupState, key);
1705
1520
  };
1706
- const teardown = () => {
1707
- forEach((el) => {
1708
- for (const i of interactions) {
1709
- el.removeEventListener(i, doHydrate);
1710
- }
1711
- });
1712
- };
1713
- forEach((el) => {
1714
- for (const i of interactions) {
1715
- el.addEventListener(i, doHydrate, { once: true });
1716
- }
1717
- });
1718
- return teardown;
1719
- };
1720
- function forEachElement(node, cb) {
1721
- if (isComment(node) && node.data === "[") {
1722
- let depth = 1;
1723
- let next = node.nextSibling;
1724
- while (next) {
1725
- if (next.nodeType === 1) {
1726
- const result = cb(next);
1727
- if (result === false) {
1728
- break;
1729
- }
1730
- } else if (isComment(next)) {
1731
- if (next.data === "]") {
1732
- if (--depth === 0) break;
1733
- } else if (next.data === "[") {
1734
- depth++;
1735
- }
1521
+ if (oldRef != null && oldRef !== ref) {
1522
+ if (shared.isString(oldRef)) {
1523
+ refs[oldRef] = null;
1524
+ if (canSetSetupRef(oldRef)) {
1525
+ setupState[oldRef] = null;
1736
1526
  }
1737
- next = next.nextSibling;
1527
+ } else if (reactivity.isRef(oldRef)) {
1528
+ oldRef.value = null;
1738
1529
  }
1530
+ }
1531
+ if (shared.isFunction(ref)) {
1532
+ callWithErrorHandling(ref, owner, 12, [value, refs]);
1739
1533
  } else {
1740
- cb(node);
1534
+ const _isString = shared.isString(ref);
1535
+ const _isRef = reactivity.isRef(ref);
1536
+ if (_isString || _isRef) {
1537
+ const doSet = () => {
1538
+ if (rawRef.f) {
1539
+ const existing = _isString ? canSetSetupRef(ref) ? setupState[ref] : refs[ref] : ref.value;
1540
+ if (isUnmount) {
1541
+ shared.isArray(existing) && shared.remove(existing, refValue);
1542
+ } else {
1543
+ if (!shared.isArray(existing)) {
1544
+ if (_isString) {
1545
+ refs[ref] = [refValue];
1546
+ if (canSetSetupRef(ref)) {
1547
+ setupState[ref] = refs[ref];
1548
+ }
1549
+ } else {
1550
+ ref.value = [refValue];
1551
+ if (rawRef.k) refs[rawRef.k] = ref.value;
1552
+ }
1553
+ } else if (!existing.includes(refValue)) {
1554
+ existing.push(refValue);
1555
+ }
1556
+ }
1557
+ } else if (_isString) {
1558
+ refs[ref] = value;
1559
+ if (canSetSetupRef(ref)) {
1560
+ setupState[ref] = value;
1561
+ }
1562
+ } else if (_isRef) {
1563
+ ref.value = value;
1564
+ if (rawRef.k) refs[rawRef.k] = value;
1565
+ } else ;
1566
+ };
1567
+ if (value) {
1568
+ doSet.id = -1;
1569
+ queuePostRenderEffect(doSet, parentSuspense);
1570
+ } else {
1571
+ doSet();
1572
+ }
1573
+ }
1741
1574
  }
1742
1575
  }
1743
1576
 
1744
- const isAsyncWrapper = (i) => !!i.type.__asyncLoader;
1745
- function _getValidZova(instance) {
1746
- while (instance) {
1747
- if (instance.zova) return instance.zova;
1748
- instance = instance.parent;
1749
- }
1750
- }
1751
- /*! #__NO_SIDE_EFFECTS__ */
1752
- // @__NO_SIDE_EFFECTS__
1753
- function defineAsyncComponent(source) {
1754
- if (shared.isFunction(source)) {
1755
- source = { loader: source };
1577
+ let hasLoggedMismatchError = false;
1578
+ const logMismatchError = () => {
1579
+ if (hasLoggedMismatchError) {
1580
+ return;
1756
1581
  }
1582
+ console.error("Hydration completed but contains mismatches.");
1583
+ hasLoggedMismatchError = true;
1584
+ };
1585
+ const isSVGContainer = (container) => container.namespaceURI.includes("svg") && container.tagName !== "foreignObject";
1586
+ const isMathMLContainer = (container) => container.namespaceURI.includes("MathML");
1587
+ const getContainerType = (container) => {
1588
+ if (container.nodeType !== 1) return void 0;
1589
+ if (isSVGContainer(container)) return "svg";
1590
+ if (isMathMLContainer(container)) return "mathml";
1591
+ return void 0;
1592
+ };
1593
+ const isComment = (node) => node.nodeType === 8;
1594
+ function createHydrationFunctions(rendererInternals) {
1757
1595
  const {
1758
- loader,
1759
- loadingComponent,
1760
- errorComponent,
1761
- delay = 200,
1762
- hydrate: hydrateStrategy,
1763
- timeout,
1764
- // undefined = never times out
1765
- suspensible = true,
1766
- onError: userOnError
1767
- } = source;
1768
- let pendingRequest = null;
1769
- let resolvedComp;
1770
- let retries = 0;
1771
- const retry = () => {
1772
- retries++;
1773
- pendingRequest = null;
1774
- return load();
1775
- };
1776
- const load = () => {
1777
- let thisRequest;
1778
- return pendingRequest || (thisRequest = pendingRequest = loader().catch((err) => {
1779
- err = err instanceof Error ? err : new Error(String(err));
1780
- if (userOnError) {
1781
- return new Promise((resolve, reject) => {
1782
- const userRetry = () => resolve(retry());
1783
- const userFail = () => reject(err);
1784
- userOnError(err, userRetry, userFail, retries + 1);
1785
- });
1786
- } else {
1787
- throw err;
1788
- }
1789
- }).then((comp) => {
1790
- if (thisRequest !== pendingRequest && pendingRequest) {
1791
- return pendingRequest;
1792
- }
1793
- if (comp && (comp.__esModule || comp[Symbol.toStringTag] === "Module")) {
1794
- comp = comp.default;
1795
- }
1796
- resolvedComp = comp;
1797
- return comp;
1798
- }));
1596
+ mt: mountComponent,
1597
+ p: patch,
1598
+ o: {
1599
+ patchProp,
1600
+ createText,
1601
+ nextSibling,
1602
+ parentNode,
1603
+ remove,
1604
+ insert,
1605
+ createComment
1606
+ }
1607
+ } = rendererInternals;
1608
+ const hydrate = (vnode, container) => {
1609
+ if (!container.hasChildNodes()) {
1610
+ patch(null, vnode, container);
1611
+ flushPostFlushCbs();
1612
+ container._vnode = vnode;
1613
+ return;
1614
+ }
1615
+ hydrateNode(container.firstChild, vnode, null, null, null);
1616
+ flushPostFlushCbs();
1617
+ container._vnode = vnode;
1799
1618
  };
1800
- return defineComponent({
1801
- name: "AsyncComponentWrapper",
1802
- __asyncLoader: load,
1803
- __asyncHydrate(el, instance, hydrate) {
1804
- const doHydrate = hydrateStrategy ? () => {
1805
- const teardown = hydrateStrategy(
1806
- hydrate,
1807
- (cb) => forEachElement(el, cb)
1808
- );
1809
- if (teardown) {
1810
- (instance.bum || (instance.bum = [])).push(teardown);
1811
- }
1812
- } : hydrate;
1813
- if (resolvedComp) {
1814
- doHydrate();
1815
- } else {
1816
- const zova = _getValidZova(instance);
1817
- zova.meta.$ssr._hydratingInc();
1818
- load().then(() => {
1819
- !instance.isUnmounted && doHydrate();
1820
- zova.meta.$ssr._hydratingDec();
1821
- });
1822
- }
1823
- },
1824
- get __asyncResolved() {
1825
- return resolvedComp;
1826
- },
1827
- setup() {
1828
- const instance = currentInstance;
1829
- markAsyncBoundary(instance);
1830
- if (resolvedComp) {
1831
- return () => createInnerComp(resolvedComp, instance);
1832
- }
1833
- const onError = (err) => {
1834
- pendingRequest = null;
1835
- handleError(
1836
- err,
1837
- instance,
1838
- 13,
1839
- !errorComponent
1840
- );
1841
- };
1842
- if (suspensible && instance.suspense || isInSSRComponentSetup) {
1843
- return load().then((comp) => {
1844
- return () => createInnerComp(comp, instance);
1845
- }).catch((err) => {
1846
- onError(err);
1847
- return () => errorComponent ? createVNode(errorComponent, {
1848
- error: err
1849
- }) : null;
1850
- });
1851
- }
1852
- const loaded = reactivity.ref(false);
1853
- const error = reactivity.ref();
1854
- const delayed = reactivity.ref(!!delay);
1855
- if (delay) {
1856
- setTimeout(() => {
1857
- delayed.value = false;
1858
- }, delay);
1859
- }
1860
- if (timeout != null) {
1861
- setTimeout(() => {
1862
- if (!loaded.value && !error.value) {
1863
- const err = new Error(
1864
- `Async component timed out after ${timeout}ms.`
1865
- );
1866
- onError(err);
1867
- error.value = err;
1619
+ const hydrateNode = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized = false) => {
1620
+ optimized = optimized || !!vnode.dynamicChildren;
1621
+ const isFragmentStart = isComment(node) && node.data === "[";
1622
+ const onMismatch = () => handleMismatch(
1623
+ node,
1624
+ vnode,
1625
+ parentComponent,
1626
+ parentSuspense,
1627
+ slotScopeIds,
1628
+ isFragmentStart
1629
+ );
1630
+ const { type, ref, shapeFlag, patchFlag } = vnode;
1631
+ let domType = node.nodeType;
1632
+ vnode.el = node;
1633
+ if (patchFlag === -2) {
1634
+ optimized = false;
1635
+ vnode.dynamicChildren = null;
1636
+ }
1637
+ let nextNode = null;
1638
+ switch (type) {
1639
+ case Text:
1640
+ if (domType !== 3) {
1641
+ if (vnode.children === "") {
1642
+ insert(vnode.el = createText(""), parentNode(node), node);
1643
+ nextNode = node;
1644
+ } else {
1645
+ nextNode = onMismatch();
1868
1646
  }
1869
- }, timeout);
1870
- }
1871
- load().then(() => {
1872
- loaded.value = true;
1873
- if (instance.parent && isKeepAlive(instance.parent.vnode)) {
1874
- instance.parent.update();
1875
- }
1876
- }).catch((err) => {
1877
- onError(err);
1878
- error.value = err;
1879
- });
1880
- return () => {
1881
- if (loaded.value && resolvedComp) {
1882
- return createInnerComp(resolvedComp, instance);
1883
- } else if (error.value && errorComponent) {
1884
- return createVNode(errorComponent, {
1885
- error: error.value
1886
- });
1887
- } else if (loadingComponent && !delayed.value) {
1888
- return createVNode(loadingComponent);
1647
+ } else {
1648
+ if (node.data !== vnode.children) {
1649
+ node.data = vnode.children;
1650
+ }
1651
+ nextNode = nextSibling(node);
1889
1652
  }
1890
- };
1891
- }
1892
- });
1893
- }
1894
- function createInnerComp(comp, parent) {
1895
- const { ref: ref2, props, children, ce } = parent.vnode;
1896
- const vnode = createVNode(comp, props, children);
1897
- vnode.ref = ref2;
1898
- vnode.ce = ce;
1899
- delete parent.vnode.ce;
1900
- vnode.zovaHostProviders = parent.vnode.zovaHostProviders;
1901
- return vnode;
1902
- }
1903
-
1904
- const isKeepAlive = (vnode) => vnode.type.__isKeepAlive;
1905
- const KeepAliveImpl = {
1906
- name: `KeepAlive`,
1907
- // Marker for special handling inside the renderer. We are not using a ===
1908
- // check directly on KeepAlive in the renderer, because importing it directly
1909
- // would prevent it from being tree-shaken.
1910
- __isKeepAlive: true,
1911
- props: {
1912
- include: [String, RegExp, Array],
1913
- exclude: [String, RegExp, Array],
1914
- max: [String, Number]
1915
- },
1916
- setup(props, { slots }) {
1917
- const instance = getCurrentInstance();
1918
- const sharedContext = instance.ctx;
1919
- if (!sharedContext.renderer) {
1920
- return () => {
1921
- const children = slots.default && slots.default();
1922
- return children && children.length === 1 ? children[0] : children;
1923
- };
1924
- }
1925
- const cache = /* @__PURE__ */ new Map();
1926
- const keys = /* @__PURE__ */ new Set();
1927
- let current = null;
1928
- const parentSuspense = instance.suspense;
1929
- const {
1930
- renderer: {
1931
- p: patch,
1932
- m: move,
1933
- um: _unmount,
1934
- o: { createElement }
1935
- }
1936
- } = sharedContext;
1937
- const storageContainer = createElement("div");
1938
- sharedContext.activate = (vnode, container, anchor, namespace, optimized) => {
1939
- const instance2 = vnode.component;
1940
- move(vnode, container, anchor, 0, parentSuspense);
1941
- patch(
1942
- instance2.vnode,
1943
- vnode,
1944
- container,
1945
- anchor,
1946
- instance2,
1947
- parentSuspense,
1948
- namespace,
1949
- vnode.slotScopeIds,
1950
- optimized
1951
- );
1952
- queuePostRenderEffect(() => {
1953
- instance2.isDeactivated = false;
1954
- if (instance2.a) {
1955
- shared.invokeArrayFns(instance2.a);
1653
+ break;
1654
+ case Comment:
1655
+ if (isTemplateNode(node)) {
1656
+ nextNode = nextSibling(node);
1657
+ replaceNode(
1658
+ vnode.el = node.content.firstChild,
1659
+ node,
1660
+ parentComponent
1661
+ );
1662
+ } else if (domType !== 8 || isFragmentStart) {
1663
+ nextNode = onMismatch();
1664
+ } else {
1665
+ nextNode = nextSibling(node);
1956
1666
  }
1957
- const vnodeHook = vnode.props && vnode.props.onVnodeMounted;
1958
- if (vnodeHook) {
1959
- invokeVNodeHook(vnodeHook, instance2.parent, vnode);
1667
+ break;
1668
+ case Static:
1669
+ if (isFragmentStart) {
1670
+ node = nextSibling(node);
1671
+ domType = node.nodeType;
1960
1672
  }
1961
- }, parentSuspense);
1962
- };
1963
- sharedContext.deactivate = (vnode) => {
1964
- const instance2 = vnode.component;
1965
- invalidateMount(instance2.m);
1966
- invalidateMount(instance2.a);
1967
- move(vnode, storageContainer, null, 1, parentSuspense);
1968
- queuePostRenderEffect(() => {
1969
- if (instance2.da) {
1970
- shared.invokeArrayFns(instance2.da);
1673
+ if (domType === 1 || domType === 3) {
1674
+ nextNode = node;
1675
+ const needToAdoptContent = !vnode.children.length;
1676
+ for (let i = 0; i < vnode.staticCount; i++) {
1677
+ if (needToAdoptContent)
1678
+ vnode.children += nextNode.nodeType === 1 ? nextNode.outerHTML : nextNode.data;
1679
+ if (i === vnode.staticCount - 1) {
1680
+ vnode.anchor = nextNode;
1681
+ }
1682
+ nextNode = nextSibling(nextNode);
1683
+ }
1684
+ return isFragmentStart ? nextSibling(nextNode) : nextNode;
1685
+ } else {
1686
+ onMismatch();
1971
1687
  }
1972
- const vnodeHook = vnode.props && vnode.props.onVnodeUnmounted;
1973
- if (vnodeHook) {
1974
- invokeVNodeHook(vnodeHook, instance2.parent, vnode);
1688
+ break;
1689
+ case Fragment:
1690
+ if (!isFragmentStart) {
1691
+ nextNode = onMismatch();
1692
+ } else {
1693
+ nextNode = hydrateFragment(
1694
+ node,
1695
+ vnode,
1696
+ parentComponent,
1697
+ parentSuspense,
1698
+ slotScopeIds,
1699
+ optimized
1700
+ );
1975
1701
  }
1976
- instance2.isDeactivated = true;
1977
- }, parentSuspense);
1978
- };
1979
- function unmount(vnode) {
1980
- resetShapeFlag(vnode);
1981
- _unmount(vnode, instance, parentSuspense, true);
1702
+ break;
1703
+ default:
1704
+ if (shapeFlag & 1) {
1705
+ if ((domType !== 1 || vnode.type.toLowerCase() !== node.tagName.toLowerCase()) && !isTemplateNode(node)) {
1706
+ nextNode = onMismatch();
1707
+ } else {
1708
+ nextNode = hydrateElement(
1709
+ node,
1710
+ vnode,
1711
+ parentComponent,
1712
+ parentSuspense,
1713
+ slotScopeIds,
1714
+ optimized
1715
+ );
1716
+ }
1717
+ } else if (shapeFlag & 6) {
1718
+ vnode.slotScopeIds = slotScopeIds;
1719
+ const container = parentNode(node);
1720
+ if (isFragmentStart) {
1721
+ nextNode = locateClosingAnchor(node);
1722
+ } else if (isComment(node) && node.data === "teleport start") {
1723
+ nextNode = locateClosingAnchor(node, node.data, "teleport end");
1724
+ } else {
1725
+ nextNode = nextSibling(node);
1726
+ }
1727
+ mountComponent(
1728
+ vnode,
1729
+ container,
1730
+ null,
1731
+ parentComponent,
1732
+ parentSuspense,
1733
+ getContainerType(container),
1734
+ optimized
1735
+ );
1736
+ if (isAsyncWrapper(vnode) && !vnode.type.__asyncResolved) {
1737
+ let subTree;
1738
+ if (isFragmentStart) {
1739
+ subTree = createVNode(Fragment);
1740
+ subTree.anchor = nextNode ? nextNode.previousSibling : container.lastChild;
1741
+ } else {
1742
+ subTree = node.nodeType === 3 ? createTextVNode("") : createVNode("div");
1743
+ }
1744
+ subTree.el = node;
1745
+ vnode.component.subTree = subTree;
1746
+ }
1747
+ } else if (shapeFlag & 64) {
1748
+ if (domType !== 8) {
1749
+ nextNode = onMismatch();
1750
+ } else {
1751
+ nextNode = vnode.type.hydrate(
1752
+ node,
1753
+ vnode,
1754
+ parentComponent,
1755
+ parentSuspense,
1756
+ slotScopeIds,
1757
+ optimized,
1758
+ rendererInternals,
1759
+ hydrateChildren
1760
+ );
1761
+ }
1762
+ } else if (shapeFlag & 128) {
1763
+ nextNode = vnode.type.hydrate(
1764
+ node,
1765
+ vnode,
1766
+ parentComponent,
1767
+ parentSuspense,
1768
+ getContainerType(parentNode(node)),
1769
+ slotScopeIds,
1770
+ optimized,
1771
+ rendererInternals,
1772
+ hydrateNode
1773
+ );
1774
+ } else ;
1982
1775
  }
1983
- function pruneCache(filter) {
1984
- cache.forEach((vnode, key) => {
1985
- const name = getComponentName(vnode.type);
1986
- if (name && !filter(name)) {
1987
- pruneCacheEntry(key);
1988
- }
1989
- });
1776
+ if (ref != null) {
1777
+ setRef(ref, null, parentSuspense, vnode);
1990
1778
  }
1991
- function pruneCacheEntry(key) {
1992
- const cached = cache.get(key);
1993
- if (cached && (!current || !isSameVNodeType(cached, current))) {
1994
- unmount(cached);
1995
- } else if (current) {
1996
- resetShapeFlag(current);
1997
- }
1998
- cache.delete(key);
1999
- keys.delete(key);
1779
+ return nextNode;
1780
+ };
1781
+ function _getValidZova(instance) {
1782
+ while (instance) {
1783
+ if (instance.zova) return instance.zova;
1784
+ instance = instance.parent;
2000
1785
  }
2001
- watch(
2002
- () => [props.include, props.exclude],
2003
- ([include, exclude]) => {
2004
- include && pruneCache((name) => matches(include, name));
2005
- exclude && pruneCache((name) => !matches(exclude, name));
2006
- },
2007
- // prune post-render after `current` has been updated
2008
- { flush: "post", deep: true }
2009
- );
2010
- let pendingCacheKey = null;
2011
- const cacheSubtree = () => {
2012
- if (pendingCacheKey != null) {
2013
- if (isSuspense(instance.subTree.type)) {
2014
- queuePostRenderEffect(() => {
2015
- cache.set(pendingCacheKey, getInnerChild(instance.subTree));
2016
- }, instance.subTree.suspense);
2017
- } else {
2018
- cache.set(pendingCacheKey, getInnerChild(instance.subTree));
1786
+ }
1787
+ const hydrateElement = (el, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
1788
+ optimized = optimized || !!vnode.dynamicChildren;
1789
+ const { type, props, patchFlag, shapeFlag, dirs, transition } = vnode;
1790
+ const forcePatch = type === "input" || type === "option";
1791
+ if (forcePatch || patchFlag !== -1) {
1792
+ if (dirs) {
1793
+ invokeDirectiveHook(vnode, null, parentComponent, "created");
1794
+ }
1795
+ let needCallTransitionHooks = false;
1796
+ if (isTemplateNode(el)) {
1797
+ needCallTransitionHooks = needTransition(
1798
+ null,
1799
+ // no need check parentSuspense in hydration
1800
+ transition
1801
+ ) && parentComponent && parentComponent.vnode.props && parentComponent.vnode.props.appear;
1802
+ const content = el.content.firstChild;
1803
+ if (needCallTransitionHooks) {
1804
+ transition.beforeEnter(content);
2019
1805
  }
1806
+ replaceNode(content, el, parentComponent);
1807
+ vnode.el = el = content;
2020
1808
  }
2021
- };
2022
- onMounted(cacheSubtree);
2023
- onUpdated(cacheSubtree);
2024
- onBeforeUnmount(() => {
2025
- cache.forEach((cached) => {
2026
- const { subTree, suspense } = instance;
2027
- const vnode = getInnerChild(subTree);
2028
- if (cached.type === vnode.type && cached.key === vnode.key) {
2029
- resetShapeFlag(vnode);
2030
- const da = vnode.component.da;
2031
- da && queuePostRenderEffect(da, suspense);
2032
- return;
1809
+ if (shapeFlag & 16 && // skip if element has innerHTML / textContent
1810
+ !(props && (props.innerHTML || props.textContent))) {
1811
+ let next = hydrateChildren(
1812
+ el.firstChild,
1813
+ vnode,
1814
+ el,
1815
+ parentComponent,
1816
+ parentSuspense,
1817
+ slotScopeIds,
1818
+ optimized
1819
+ );
1820
+ while (next) {
1821
+ if (!isMismatchAllowed(el, 1 /* CHILDREN */)) {
1822
+ logMismatchError();
1823
+ }
1824
+ const cur = next;
1825
+ next = next.nextSibling;
1826
+ remove(cur);
1827
+ }
1828
+ } else if (shapeFlag & 8) {
1829
+ let clientText = vnode.children;
1830
+ if (clientText[0] === "\n" && (el.tagName === "PRE" || el.tagName === "TEXTAREA")) {
1831
+ clientText = clientText.slice(1);
1832
+ }
1833
+ if (el.textContent !== clientText) {
1834
+ if (!isMismatchAllowed(el, 0 /* TEXT */)) {
1835
+ logMismatchError();
1836
+ }
1837
+ el.textContent = vnode.children;
2033
1838
  }
2034
- unmount(cached);
2035
- });
2036
- });
2037
- return () => {
2038
- pendingCacheKey = null;
2039
- if (!slots.default) {
2040
- return current = null;
2041
1839
  }
2042
- const children = slots.default();
2043
- const rawVNode = children[0];
2044
- if (children.length > 1) {
2045
- current = null;
2046
- return children;
2047
- } else if (!isVNode(rawVNode) || !(rawVNode.shapeFlag & 4) && !(rawVNode.shapeFlag & 128)) {
2048
- current = null;
2049
- return rawVNode;
1840
+ if (props) {
1841
+ if (forcePatch || !optimized || patchFlag & (16 | 32)) {
1842
+ const isCustomElement = el.tagName.includes("-");
1843
+ for (const key in props) {
1844
+ let clientValue = props[key];
1845
+ const zova = _getValidZova(parentComponent);
1846
+ if (zova) {
1847
+ const res = zova.meta.$ssr._hydratePropHasMismatch(
1848
+ el,
1849
+ key,
1850
+ clientValue,
1851
+ vnode,
1852
+ parentComponent
1853
+ );
1854
+ if (res.ignore) ; else {
1855
+ clientValue = res.clientValue;
1856
+ }
1857
+ }
1858
+ if (forcePatch && (key.endsWith("value") || key === "indeterminate") || shared.isOn(key) && !shared.isReservedProp(key) || // force hydrate v-bind with .prop modifiers
1859
+ key[0] === "." || isCustomElement) {
1860
+ patchProp(el, key, null, props[key], void 0, parentComponent);
1861
+ }
1862
+ }
1863
+ } else if (props.onClick) {
1864
+ patchProp(
1865
+ el,
1866
+ "onClick",
1867
+ null,
1868
+ props.onClick,
1869
+ void 0,
1870
+ parentComponent
1871
+ );
1872
+ } else if (patchFlag & 4 && reactivity.isReactive(props.style)) {
1873
+ for (const key in props.style) props.style[key];
1874
+ }
2050
1875
  }
2051
- let vnode = getInnerChild(rawVNode);
2052
- if (vnode.type === Comment) {
2053
- current = null;
2054
- return vnode;
1876
+ let vnodeHooks;
1877
+ if (vnodeHooks = props && props.onVnodeBeforeMount) {
1878
+ invokeVNodeHook(vnodeHooks, parentComponent, vnode);
2055
1879
  }
2056
- const comp = vnode.type;
2057
- const name = getComponentName(
2058
- isAsyncWrapper(vnode) ? vnode.type.__asyncResolved || {} : comp
2059
- );
2060
- const { include, exclude, max } = props;
2061
- if (include && (!name || !matches(include, name)) || exclude && name && matches(exclude, name)) {
2062
- vnode.shapeFlag &= ~256;
2063
- current = vnode;
2064
- return rawVNode;
1880
+ if (dirs) {
1881
+ invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
2065
1882
  }
2066
- const key = vnode.key == null ? comp : vnode.key;
2067
- const cachedVNode = cache.get(key);
2068
- if (vnode.el) {
2069
- vnode = cloneVNode(vnode);
2070
- if (rawVNode.shapeFlag & 128) {
2071
- rawVNode.ssContent = vnode;
2072
- }
1883
+ if ((vnodeHooks = props && props.onVnodeMounted) || dirs || needCallTransitionHooks) {
1884
+ queueEffectWithSuspense(() => {
1885
+ vnodeHooks && invokeVNodeHook(vnodeHooks, parentComponent, vnode);
1886
+ needCallTransitionHooks && transition.enter(el);
1887
+ dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
1888
+ }, parentSuspense);
2073
1889
  }
2074
- pendingCacheKey = key;
2075
- if (cachedVNode) {
2076
- vnode.el = cachedVNode.el;
2077
- vnode.component = cachedVNode.component;
2078
- vnode.component.zovaHostProviders = vnode.zovaHostProviders;
2079
- if (vnode.transition) {
2080
- setTransitionHooks(vnode, vnode.transition);
1890
+ }
1891
+ return el.nextSibling;
1892
+ };
1893
+ const hydrateChildren = (node, parentVNode, container, parentComponent, parentSuspense, slotScopeIds, optimized) => {
1894
+ optimized = optimized || !!parentVNode.dynamicChildren;
1895
+ const children = parentVNode.children;
1896
+ const l = children.length;
1897
+ for (let i = 0; i < l; i++) {
1898
+ const vnode = optimized ? children[i] : children[i] = normalizeVNode(children[i]);
1899
+ const isText = vnode.type === Text;
1900
+ if (node) {
1901
+ if (isText && !optimized) {
1902
+ if (i + 1 < l && normalizeVNode(children[i + 1]).type === Text) {
1903
+ insert(
1904
+ createText(
1905
+ node.data.slice(vnode.children.length)
1906
+ ),
1907
+ container,
1908
+ nextSibling(node)
1909
+ );
1910
+ node.data = vnode.children;
1911
+ }
2081
1912
  }
2082
- vnode.shapeFlag |= 512;
2083
- keys.delete(key);
2084
- keys.add(key);
1913
+ node = hydrateNode(
1914
+ node,
1915
+ vnode,
1916
+ parentComponent,
1917
+ parentSuspense,
1918
+ slotScopeIds,
1919
+ optimized
1920
+ );
1921
+ } else if (isText && !vnode.children) {
1922
+ insert(vnode.el = createText(""), container);
2085
1923
  } else {
2086
- keys.add(key);
2087
- if (max && keys.size > parseInt(max, 10)) {
2088
- pruneCacheEntry(keys.values().next().value);
1924
+ if (!isMismatchAllowed(container, 1 /* CHILDREN */)) {
1925
+ logMismatchError();
1926
+ }
1927
+ patch(
1928
+ null,
1929
+ vnode,
1930
+ container,
1931
+ null,
1932
+ parentComponent,
1933
+ parentSuspense,
1934
+ getContainerType(container),
1935
+ slotScopeIds
1936
+ );
1937
+ }
1938
+ }
1939
+ return node;
1940
+ };
1941
+ const hydrateFragment = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
1942
+ const { slotScopeIds: fragmentSlotScopeIds } = vnode;
1943
+ if (fragmentSlotScopeIds) {
1944
+ slotScopeIds = slotScopeIds ? slotScopeIds.concat(fragmentSlotScopeIds) : fragmentSlotScopeIds;
1945
+ }
1946
+ const container = parentNode(node);
1947
+ const next = hydrateChildren(
1948
+ nextSibling(node),
1949
+ vnode,
1950
+ container,
1951
+ parentComponent,
1952
+ parentSuspense,
1953
+ slotScopeIds,
1954
+ optimized
1955
+ );
1956
+ if (next && isComment(next) && next.data === "]") {
1957
+ return nextSibling(vnode.anchor = next);
1958
+ } else {
1959
+ logMismatchError();
1960
+ insert(vnode.anchor = createComment(`]`), container, next);
1961
+ return next;
1962
+ }
1963
+ };
1964
+ const handleMismatch = (node, vnode, parentComponent, parentSuspense, slotScopeIds, isFragment) => {
1965
+ if (!isMismatchAllowed(node.parentElement, 1 /* CHILDREN */)) {
1966
+ logMismatchError();
1967
+ }
1968
+ vnode.el = null;
1969
+ if (isFragment) {
1970
+ const end = locateClosingAnchor(node);
1971
+ while (true) {
1972
+ const next2 = nextSibling(node);
1973
+ if (next2 && next2 !== end) {
1974
+ remove(next2);
1975
+ } else {
1976
+ break;
2089
1977
  }
2090
1978
  }
2091
- vnode.shapeFlag |= 256;
2092
- current = vnode;
2093
- return isSuspense(rawVNode.type) ? rawVNode : vnode;
2094
- };
2095
- }
2096
- };
2097
- const KeepAlive = KeepAliveImpl;
2098
- function matches(pattern, name) {
2099
- if (shared.isArray(pattern)) {
2100
- return pattern.some((p) => matches(p, name));
2101
- } else if (shared.isString(pattern)) {
2102
- return pattern.split(",").includes(name);
2103
- } else if (shared.isRegExp(pattern)) {
2104
- pattern.lastIndex = 0;
2105
- return pattern.test(name);
2106
- }
2107
- return false;
2108
- }
2109
- function onActivated(hook, target) {
2110
- registerKeepAliveHook(hook, "a", target);
2111
- }
2112
- function onDeactivated(hook, target) {
2113
- registerKeepAliveHook(hook, "da", target);
2114
- }
2115
- function registerKeepAliveHook(hook, type, target = currentInstance) {
2116
- const wrappedHook = hook.__wdc || (hook.__wdc = () => {
2117
- let current = target;
2118
- while (current) {
2119
- if (current.isDeactivated) {
2120
- return;
1979
+ }
1980
+ const next = nextSibling(node);
1981
+ const container = parentNode(node);
1982
+ remove(node);
1983
+ patch(
1984
+ null,
1985
+ vnode,
1986
+ container,
1987
+ next,
1988
+ parentComponent,
1989
+ parentSuspense,
1990
+ getContainerType(container),
1991
+ slotScopeIds
1992
+ );
1993
+ if (parentComponent) {
1994
+ parentComponent.vnode.el = vnode.el;
1995
+ updateHOCHostEl(parentComponent, vnode.el);
1996
+ }
1997
+ return next;
1998
+ };
1999
+ const locateClosingAnchor = (node, open = "[", close = "]") => {
2000
+ let match = 0;
2001
+ while (node) {
2002
+ node = nextSibling(node);
2003
+ if (node && isComment(node)) {
2004
+ if (node.data === open) match++;
2005
+ if (node.data === close) {
2006
+ if (match === 0) {
2007
+ return nextSibling(node);
2008
+ } else {
2009
+ match--;
2010
+ }
2011
+ }
2121
2012
  }
2122
- current = current.parent;
2123
2013
  }
2124
- return hook();
2125
- });
2126
- injectHook(type, wrappedHook, target);
2127
- if (target) {
2128
- let current = target.parent;
2129
- while (current && current.parent) {
2130
- if (isKeepAlive(current.parent.vnode)) {
2131
- injectToKeepAliveRoot(wrappedHook, type, target, current);
2014
+ return node;
2015
+ };
2016
+ const replaceNode = (newNode, oldNode, parentComponent) => {
2017
+ const parentNode2 = oldNode.parentNode;
2018
+ if (parentNode2) {
2019
+ parentNode2.replaceChild(newNode, oldNode);
2020
+ }
2021
+ let parent = parentComponent;
2022
+ while (parent) {
2023
+ if (parent.vnode.el === oldNode) {
2024
+ parent.vnode.el = parent.subTree.el = newNode;
2132
2025
  }
2133
- current = current.parent;
2026
+ parent = parent.parent;
2134
2027
  }
2135
- }
2136
- }
2137
- function injectToKeepAliveRoot(hook, type, target, keepAliveRoot) {
2138
- const injected = injectHook(
2139
- type,
2140
- hook,
2141
- keepAliveRoot,
2142
- true
2143
- /* prepend */
2144
- );
2145
- onUnmounted(() => {
2146
- shared.remove(keepAliveRoot[type], injected);
2147
- }, target);
2148
- }
2149
- function resetShapeFlag(vnode) {
2150
- vnode.shapeFlag &= ~256;
2151
- vnode.shapeFlag &= ~512;
2152
- }
2153
- function getInnerChild(vnode) {
2154
- return vnode.shapeFlag & 128 ? vnode.ssContent : vnode;
2028
+ };
2029
+ const isTemplateNode = (node) => {
2030
+ return node.nodeType === 1 && node.tagName === "TEMPLATE";
2031
+ };
2032
+ return [hydrate, hydrateNode];
2155
2033
  }
2156
-
2157
- function injectHook(type, hook, target = currentInstance, prepend = false) {
2158
- if (target) {
2159
- const hooks = target[type] || (target[type] = []);
2160
- const wrappedHook = hook.__weh || (hook.__weh = (...args) => {
2161
- reactivity.pauseTracking();
2162
- const reset = setCurrentInstance(target);
2163
- const res = callWithAsyncErrorHandling(hook, target, type, args);
2164
- reset();
2165
- reactivity.resetTracking();
2166
- return res;
2167
- });
2168
- if (prepend) {
2169
- hooks.unshift(wrappedHook);
2170
- } else {
2171
- hooks.push(wrappedHook);
2034
+ const allowMismatchAttr = "data-allow-mismatch";
2035
+ const MismatchTypeString = {
2036
+ [0 /* TEXT */]: "text",
2037
+ [1 /* CHILDREN */]: "children",
2038
+ [2 /* CLASS */]: "class",
2039
+ [3 /* STYLE */]: "style",
2040
+ [4 /* ATTRIBUTE */]: "attribute"
2041
+ };
2042
+ function isMismatchAllowed(el, allowedType) {
2043
+ if (allowedType === 0 /* TEXT */ || allowedType === 1 /* CHILDREN */) {
2044
+ while (el && !el.hasAttribute(allowMismatchAttr)) {
2045
+ el = el.parentElement;
2172
2046
  }
2173
- return wrappedHook;
2174
2047
  }
2175
- }
2176
- const createHook = (lifecycle) => (hook, target = currentInstance) => {
2177
- if (!isInSSRComponentSetup || lifecycle === "sp") {
2178
- injectHook(lifecycle, (...args) => hook(...args), target);
2179
- }
2180
- if (lifecycle === "m" && target && target.isMounted) {
2181
- hook();
2182
- }
2183
- };
2184
- const onBeforeMount = createHook("bm");
2185
- const onMounted = createHook("m");
2186
- const onBeforeUpdate = createHook(
2187
- "bu"
2188
- );
2189
- const onUpdated = createHook("u");
2190
- const onBeforeUnmount = createHook(
2191
- "bum"
2192
- );
2193
- const onUnmounted = createHook("um");
2194
- const onServerPrefetch = createHook(
2195
- "sp"
2196
- );
2197
- const onRenderTriggered = createHook("rtg");
2198
- const onRenderTracked = createHook("rtc");
2199
- function onErrorCaptured(hook, target = currentInstance) {
2200
- injectHook("ec", hook, target);
2201
- }
2202
-
2203
- const COMPONENTS = "components";
2204
- const DIRECTIVES = "directives";
2205
- function resolveComponent(name, maybeSelfReference) {
2206
- return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;
2207
- }
2208
- const NULL_DYNAMIC_COMPONENT = Symbol.for("v-ndc");
2209
- function resolveDynamicComponent(component) {
2210
- if (shared.isString(component)) {
2211
- return resolveAsset(COMPONENTS, component, false) || component;
2048
+ const allowedAttr = el && el.getAttribute(allowMismatchAttr);
2049
+ if (allowedAttr == null) {
2050
+ return false;
2051
+ } else if (allowedAttr === "") {
2052
+ return true;
2212
2053
  } else {
2213
- return component || NULL_DYNAMIC_COMPONENT;
2214
- }
2215
- }
2216
- function resolveDirective(name) {
2217
- return resolveAsset(DIRECTIVES, name);
2218
- }
2219
- function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false) {
2220
- const instance = currentRenderingInstance || currentInstance;
2221
- if (instance) {
2222
- const Component = instance.type;
2223
- if (type === COMPONENTS) {
2224
- const selfName = getComponentName(
2225
- Component,
2226
- false
2227
- );
2228
- if (selfName && (selfName === name || selfName === shared.camelize(name) || selfName === shared.capitalize(shared.camelize(name)))) {
2229
- return Component;
2230
- }
2231
- }
2232
- const res = (
2233
- // local registration
2234
- // check instance[type] first which is resolved for options API
2235
- resolve(instance[type] || Component[type], name) || // global registration
2236
- resolve(instance.appContext[type], name)
2237
- );
2238
- if (!res && maybeSelfReference) {
2239
- return Component;
2054
+ const list = allowedAttr.split(",");
2055
+ if (allowedType === 0 /* TEXT */ && list.includes("children")) {
2056
+ return true;
2240
2057
  }
2241
- return res;
2058
+ return allowedAttr.split(",").includes(MismatchTypeString[allowedType]);
2242
2059
  }
2243
2060
  }
2244
- function resolve(registry, name) {
2245
- return registry && (registry[name] || registry[shared.camelize(name)] || registry[shared.capitalize(shared.camelize(name))]);
2246
- }
2247
2061
 
2248
- function renderList(source, renderItem, cache, index) {
2249
- let ret;
2250
- const cached = cache && cache[index];
2251
- const sourceIsArray = shared.isArray(source);
2252
- if (sourceIsArray || shared.isString(source)) {
2253
- const sourceIsReactiveArray = sourceIsArray && reactivity.isReactive(source);
2254
- let needsWrap = false;
2255
- if (sourceIsReactiveArray) {
2256
- needsWrap = !reactivity.isShallow(source);
2257
- source = reactivity.shallowReadArray(source);
2258
- }
2259
- ret = new Array(source.length);
2260
- for (let i = 0, l = source.length; i < l; i++) {
2261
- ret[i] = renderItem(
2262
- needsWrap ? reactivity.toReactive(source[i]) : source[i],
2263
- i,
2264
- void 0,
2265
- cached && cached[i]
2266
- );
2062
+ const requestIdleCallback = shared.getGlobalThis().requestIdleCallback || ((cb) => setTimeout(cb, 1));
2063
+ const cancelIdleCallback = shared.getGlobalThis().cancelIdleCallback || ((id) => clearTimeout(id));
2064
+ const hydrateOnIdle = (timeout = 1e4) => (hydrate) => {
2065
+ const id = requestIdleCallback(hydrate, { timeout });
2066
+ return () => cancelIdleCallback(id);
2067
+ };
2068
+ function elementIsVisibleInViewport(el) {
2069
+ const { top, left, bottom, right } = el.getBoundingClientRect();
2070
+ const { innerHeight, innerWidth } = window;
2071
+ return (top > 0 && top < innerHeight || bottom > 0 && bottom < innerHeight) && (left > 0 && left < innerWidth || right > 0 && right < innerWidth);
2072
+ }
2073
+ const hydrateOnVisible = (opts) => (hydrate, forEach) => {
2074
+ const ob = new IntersectionObserver((entries) => {
2075
+ for (const e of entries) {
2076
+ if (!e.isIntersecting) continue;
2077
+ ob.disconnect();
2078
+ hydrate();
2079
+ break;
2267
2080
  }
2268
- } else if (typeof source === "number") {
2269
- ret = new Array(source);
2270
- for (let i = 0; i < source; i++) {
2271
- ret[i] = renderItem(i + 1, i, void 0, cached && cached[i]);
2081
+ }, opts);
2082
+ forEach((el) => {
2083
+ if (!(el instanceof Element)) return;
2084
+ if (elementIsVisibleInViewport(el)) {
2085
+ hydrate();
2086
+ ob.disconnect();
2087
+ return false;
2272
2088
  }
2273
- } else if (shared.isObject(source)) {
2274
- if (source[Symbol.iterator]) {
2275
- ret = Array.from(
2276
- source,
2277
- (item, i) => renderItem(item, i, void 0, cached && cached[i])
2278
- );
2089
+ ob.observe(el);
2090
+ });
2091
+ return () => ob.disconnect();
2092
+ };
2093
+ const hydrateOnMediaQuery = (query) => (hydrate) => {
2094
+ if (query) {
2095
+ const mql = matchMedia(query);
2096
+ if (mql.matches) {
2097
+ hydrate();
2279
2098
  } else {
2280
- const keys = Object.keys(source);
2281
- ret = new Array(keys.length);
2282
- for (let i = 0, l = keys.length; i < l; i++) {
2283
- const key = keys[i];
2284
- ret[i] = renderItem(source[key], key, i, cached && cached[i]);
2099
+ mql.addEventListener("change", hydrate, { once: true });
2100
+ return () => mql.removeEventListener("change", hydrate);
2101
+ }
2102
+ }
2103
+ };
2104
+ const hydrateOnInteraction = (interactions = []) => (hydrate, forEach) => {
2105
+ if (shared.isString(interactions)) interactions = [interactions];
2106
+ let hasHydrated = false;
2107
+ const doHydrate = (e) => {
2108
+ if (!hasHydrated) {
2109
+ hasHydrated = true;
2110
+ teardown();
2111
+ hydrate();
2112
+ e.target.dispatchEvent(new e.constructor(e.type, e));
2113
+ }
2114
+ };
2115
+ const teardown = () => {
2116
+ forEach((el) => {
2117
+ for (const i of interactions) {
2118
+ el.removeEventListener(i, doHydrate);
2119
+ }
2120
+ });
2121
+ };
2122
+ forEach((el) => {
2123
+ for (const i of interactions) {
2124
+ el.addEventListener(i, doHydrate, { once: true });
2125
+ }
2126
+ });
2127
+ return teardown;
2128
+ };
2129
+ function forEachElement(node, cb) {
2130
+ if (isComment(node) && node.data === "[") {
2131
+ let depth = 1;
2132
+ let next = node.nextSibling;
2133
+ while (next) {
2134
+ if (next.nodeType === 1) {
2135
+ const result = cb(next);
2136
+ if (result === false) {
2137
+ break;
2138
+ }
2139
+ } else if (isComment(next)) {
2140
+ if (next.data === "]") {
2141
+ if (--depth === 0) break;
2142
+ } else if (next.data === "[") {
2143
+ depth++;
2144
+ }
2285
2145
  }
2146
+ next = next.nextSibling;
2286
2147
  }
2287
2148
  } else {
2288
- ret = [];
2289
- }
2290
- if (cache) {
2291
- cache[index] = ret;
2149
+ cb(node);
2292
2150
  }
2293
- return ret;
2294
2151
  }
2295
2152
 
2296
- function createSlots(slots, dynamicSlots) {
2297
- for (let i = 0; i < dynamicSlots.length; i++) {
2298
- const slot = dynamicSlots[i];
2299
- if (shared.isArray(slot)) {
2300
- for (let j = 0; j < slot.length; j++) {
2301
- slots[slot[j].name] = slot[j].fn;
2153
+ const isAsyncWrapper = (i) => !!i.type.__asyncLoader;
2154
+ function _getValidZova(instance) {
2155
+ while (instance) {
2156
+ if (instance.zova) return instance.zova;
2157
+ instance = instance.parent;
2158
+ }
2159
+ }
2160
+ /*! #__NO_SIDE_EFFECTS__ */
2161
+ // @__NO_SIDE_EFFECTS__
2162
+ function defineAsyncComponent(source) {
2163
+ if (shared.isFunction(source)) {
2164
+ source = { loader: source };
2165
+ }
2166
+ const {
2167
+ loader,
2168
+ loadingComponent,
2169
+ errorComponent,
2170
+ delay = 200,
2171
+ hydrate: hydrateStrategy,
2172
+ timeout,
2173
+ // undefined = never times out
2174
+ suspensible = true,
2175
+ onError: userOnError
2176
+ } = source;
2177
+ let pendingRequest = null;
2178
+ let resolvedComp;
2179
+ let retries = 0;
2180
+ const retry = () => {
2181
+ retries++;
2182
+ pendingRequest = null;
2183
+ return load();
2184
+ };
2185
+ const load = () => {
2186
+ let thisRequest;
2187
+ return pendingRequest || (thisRequest = pendingRequest = loader().catch((err) => {
2188
+ err = err instanceof Error ? err : new Error(String(err));
2189
+ if (userOnError) {
2190
+ return new Promise((resolve, reject) => {
2191
+ const userRetry = () => resolve(retry());
2192
+ const userFail = () => reject(err);
2193
+ userOnError(err, userRetry, userFail, retries + 1);
2194
+ });
2195
+ } else {
2196
+ throw err;
2302
2197
  }
2303
- } else if (slot) {
2304
- slots[slot.name] = slot.key ? (...args) => {
2305
- const res = slot.fn(...args);
2306
- if (res) res.key = slot.key;
2307
- return res;
2308
- } : slot.fn;
2198
+ }).then((comp) => {
2199
+ if (thisRequest !== pendingRequest && pendingRequest) {
2200
+ return pendingRequest;
2201
+ }
2202
+ if (comp && (comp.__esModule || comp[Symbol.toStringTag] === "Module")) {
2203
+ comp = comp.default;
2204
+ }
2205
+ resolvedComp = comp;
2206
+ return comp;
2207
+ }));
2208
+ };
2209
+ return defineComponent({
2210
+ name: "AsyncComponentWrapper",
2211
+ __asyncLoader: load,
2212
+ __asyncHydrate(el, instance, hydrate) {
2213
+ const doHydrate = hydrateStrategy ? () => {
2214
+ const teardown = hydrateStrategy(
2215
+ hydrate,
2216
+ (cb) => forEachElement(el, cb)
2217
+ );
2218
+ if (teardown) {
2219
+ (instance.bum || (instance.bum = [])).push(teardown);
2220
+ }
2221
+ } : hydrate;
2222
+ if (resolvedComp) {
2223
+ doHydrate();
2224
+ } else {
2225
+ const zova = _getValidZova(instance);
2226
+ zova.meta.$ssr._hydratingInc();
2227
+ load().then(() => {
2228
+ !instance.isUnmounted && doHydrate();
2229
+ zova.meta.$ssr._hydratingDec();
2230
+ });
2231
+ }
2232
+ },
2233
+ get __asyncResolved() {
2234
+ return resolvedComp;
2235
+ },
2236
+ setup() {
2237
+ const instance = currentInstance;
2238
+ markAsyncBoundary(instance);
2239
+ if (resolvedComp) {
2240
+ return () => createInnerComp(resolvedComp, instance);
2241
+ }
2242
+ const onError = (err) => {
2243
+ pendingRequest = null;
2244
+ handleError(
2245
+ err,
2246
+ instance,
2247
+ 13,
2248
+ !errorComponent
2249
+ );
2250
+ };
2251
+ if (suspensible && instance.suspense || isInSSRComponentSetup) {
2252
+ return load().then((comp) => {
2253
+ return () => createInnerComp(comp, instance);
2254
+ }).catch((err) => {
2255
+ onError(err);
2256
+ return () => errorComponent ? createVNode(errorComponent, {
2257
+ error: err
2258
+ }) : null;
2259
+ });
2260
+ }
2261
+ const loaded = reactivity.ref(false);
2262
+ const error = reactivity.ref();
2263
+ const delayed = reactivity.ref(!!delay);
2264
+ if (delay) {
2265
+ setTimeout(() => {
2266
+ delayed.value = false;
2267
+ }, delay);
2268
+ }
2269
+ if (timeout != null) {
2270
+ setTimeout(() => {
2271
+ if (!loaded.value && !error.value) {
2272
+ const err = new Error(
2273
+ `Async component timed out after ${timeout}ms.`
2274
+ );
2275
+ onError(err);
2276
+ error.value = err;
2277
+ }
2278
+ }, timeout);
2279
+ }
2280
+ load().then(() => {
2281
+ loaded.value = true;
2282
+ if (instance.parent && isKeepAlive(instance.parent.vnode)) {
2283
+ instance.parent.update();
2284
+ }
2285
+ }).catch((err) => {
2286
+ onError(err);
2287
+ error.value = err;
2288
+ });
2289
+ return () => {
2290
+ if (loaded.value && resolvedComp) {
2291
+ return createInnerComp(resolvedComp, instance);
2292
+ } else if (error.value && errorComponent) {
2293
+ return createVNode(errorComponent, {
2294
+ error: error.value
2295
+ });
2296
+ } else if (loadingComponent && !delayed.value) {
2297
+ return createVNode(loadingComponent);
2298
+ }
2299
+ };
2309
2300
  }
2310
- }
2311
- return slots;
2301
+ });
2302
+ }
2303
+ function createInnerComp(comp, parent) {
2304
+ const { ref: ref2, props, children, ce } = parent.vnode;
2305
+ const vnode = createVNode(comp, props, children);
2306
+ vnode.ref = ref2;
2307
+ vnode.ce = ce;
2308
+ delete parent.vnode.ce;
2309
+ vnode.zovaHostProviders = parent.vnode.zovaHostProviders;
2310
+ return vnode;
2312
2311
  }
2313
2312
 
2314
2313
  function renderSlot(slots, name, props = {}, fallback, noSlotted) {