@vitejs/plugin-rsc 0.5.34 → 0.5.35

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.
Files changed (81) hide show
  1. package/README.md +15 -0
  2. package/dist/browser.d.ts +1 -1
  3. package/dist/{cjs-AWVWfddx.js → cjs-DhDj_zQT.js} +2 -2
  4. package/dist/client-Dq3oGLRS.d.ts +8 -0
  5. package/dist/{client-reference-DEZtXTv1.d.ts → client-reference-Bk5pzNGN.d.ts} +1 -1
  6. package/dist/client.node-BEQT2PT-.d.ts +9 -0
  7. package/dist/client.shared-D1HxyClg.js +10 -0
  8. package/dist/client.shared-VT232QCM.d.ts +16 -0
  9. package/dist/core/browser.js +1 -1
  10. package/dist/core/plugin.d.ts +2 -3
  11. package/dist/core/rsc.d.ts +1 -1
  12. package/dist/core/rsc.js +1 -1
  13. package/dist/core/ssr.d.ts +1 -7
  14. package/dist/core/ssr.js +1 -1
  15. package/dist/{index-C5IY2S-e.d.ts → index-CROaL0MT.d.ts} +34 -8
  16. package/dist/index.js +1 -1
  17. package/dist/{picocolors-391UXIDd.js → picocolors-DCTC64Zv.js} +1 -1
  18. package/dist/{plugin-Cbs9j6lP.js → plugin-CLvIS10V.js} +37 -27
  19. package/dist/plugin.js +1 -1
  20. package/dist/plugins/cjs.d.ts +2 -3
  21. package/dist/plugins/cjs.js +1 -1
  22. package/dist/react/browser.d.ts +10 -10
  23. package/dist/react/rsc/client.d.ts +1 -1
  24. package/dist/react/rsc/client.js +2 -5
  25. package/dist/react/rsc/client.node.d.ts +2 -0
  26. package/dist/react/rsc/client.node.js +16 -0
  27. package/dist/react/rsc/server.d.ts +2 -2
  28. package/dist/react/rsc/server.node.d.ts +3 -0
  29. package/dist/react/rsc/server.node.js +24 -0
  30. package/dist/react/rsc/static.d.ts +4 -5
  31. package/dist/react/rsc/static.node.d.ts +6 -0
  32. package/dist/react/rsc/static.node.js +11 -0
  33. package/dist/react/rsc.d.ts +3 -3
  34. package/dist/react/ssr.d.ts +9 -9
  35. package/dist/react/ssr.node.d.ts +12 -0
  36. package/dist/react/ssr.node.js +21 -0
  37. package/dist/rsc/client.d.ts +1 -1
  38. package/dist/rsc/client.node.d.ts +2 -0
  39. package/dist/rsc/client.node.js +3 -0
  40. package/dist/rsc/server.d.ts +5 -5
  41. package/dist/rsc/server.node.d.ts +19 -0
  42. package/dist/rsc/server.node.js +13 -0
  43. package/dist/rsc/static.d.ts +4 -5
  44. package/dist/rsc/static.node.d.ts +16 -0
  45. package/dist/rsc/static.node.js +12 -0
  46. package/dist/{rsc-C3UdJLOW.d.ts → rsc-D8UlANI2.d.ts} +1 -1
  47. package/dist/rsc.d.ts +3 -3
  48. package/dist/rsc.node.d.ts +6 -0
  49. package/dist/rsc.node.js +7 -0
  50. package/dist/{scope-Bdx33sQv.js → scope-Ck0n25my.js} +2 -4
  51. package/dist/{server-ZBjqNTqU.d.ts → server-YwgjVtsE.d.ts} +2 -2
  52. package/dist/server.node-DU77AeKU.d.ts +15 -0
  53. package/dist/shared-BWJvctW6.js +34 -0
  54. package/dist/shared-CXQb6hk9.js +89 -0
  55. package/dist/shared-DJBuYpZL.d.ts +20 -0
  56. package/dist/ssr-C-U7jY5S.d.ts +8 -0
  57. package/dist/ssr.d.ts +3 -21
  58. package/dist/ssr.js +1 -87
  59. package/dist/ssr.node.d.ts +5 -0
  60. package/dist/ssr.node.js +4 -0
  61. package/dist/transforms/index.js +67 -60
  62. package/dist/utils/encryption-runtime.d.ts +3 -4
  63. package/dist/utils/encryption-runtime.js +4 -2
  64. package/dist/utils/rpc.d.ts +3 -4
  65. package/dist/vendor/react-server-dom/cjs/react-server-dom-webpack-client.browser.development.js +909 -495
  66. package/dist/vendor/react-server-dom/cjs/react-server-dom-webpack-client.browser.production.js +399 -265
  67. package/dist/vendor/react-server-dom/cjs/react-server-dom-webpack-client.edge.development.js +901 -477
  68. package/dist/vendor/react-server-dom/cjs/react-server-dom-webpack-client.edge.production.js +380 -219
  69. package/dist/vendor/react-server-dom/cjs/react-server-dom-webpack-client.node.development.js +925 -484
  70. package/dist/vendor/react-server-dom/cjs/react-server-dom-webpack-client.node.production.js +385 -221
  71. package/dist/vendor/react-server-dom/cjs/react-server-dom-webpack-server.browser.development.js +726 -388
  72. package/dist/vendor/react-server-dom/cjs/react-server-dom-webpack-server.browser.production.js +566 -397
  73. package/dist/vendor/react-server-dom/cjs/react-server-dom-webpack-server.edge.development.js +734 -397
  74. package/dist/vendor/react-server-dom/cjs/react-server-dom-webpack-server.edge.production.js +477 -238
  75. package/dist/vendor/react-server-dom/cjs/react-server-dom-webpack-server.node.development.js +1029 -620
  76. package/dist/vendor/react-server-dom/cjs/react-server-dom-webpack-server.node.production.js +481 -261
  77. package/dist/vendor/react-server-dom/esm/react-server-dom-webpack-node-loader.production.js +2 -2
  78. package/dist/vendor/react-server-dom/package.json +3 -3
  79. package/package.json +15 -15
  80. package/dist/client-Bhch3O41.d.ts +0 -19
  81. package/dist/dist-uqdtSkzK.js +0 -64
@@ -21,44 +21,19 @@
21
21
  maybeIterable["@@iterator"];
22
22
  return "function" === typeof maybeIterable ? maybeIterable : null;
23
23
  }
24
- function _defineProperty(obj, key, value) {
25
- a: if ("object" == typeof key && key) {
26
- var e = key[Symbol.toPrimitive];
27
- if (void 0 !== e) {
28
- key = e.call(key, "string");
29
- if ("object" != typeof key) break a;
30
- throw new TypeError("@@toPrimitive must return a primitive value.");
31
- }
32
- key = String(key);
33
- }
34
- key = "symbol" == typeof key ? key : key + "";
35
- key in obj
36
- ? Object.defineProperty(obj, key, {
37
- value: value,
38
- enumerable: !0,
39
- configurable: !0,
40
- writable: !0
41
- })
42
- : (obj[key] = value);
43
- return obj;
44
- }
45
24
  function flushBuffered(destination) {
46
25
  "function" === typeof destination.flush && destination.flush();
47
26
  }
48
- function writeToDestination(destination, view) {
49
- destination = destination.write(view);
50
- destinationHasCapacity = destinationHasCapacity && destination;
51
- }
52
- function writeChunkAndReturn(destination, chunk) {
27
+ function writeChunk(destination, chunk) {
53
28
  if ("string" === typeof chunk) {
54
29
  if (0 !== chunk.length)
55
- if (2048 < 3 * chunk.length)
30
+ if (4096 < 3 * chunk.length)
56
31
  0 < writtenBytes &&
57
32
  (writeToDestination(
58
33
  destination,
59
34
  currentView.subarray(0, writtenBytes)
60
35
  ),
61
- (currentView = new Uint8Array(2048)),
36
+ (currentView = new Uint8Array(4096)),
62
37
  (writtenBytes = 0)),
63
38
  writeToDestination(destination, chunk);
64
39
  else {
@@ -72,25 +47,25 @@
72
47
  destination,
73
48
  currentView.subarray(0, writtenBytes)
74
49
  ),
75
- (currentView = new Uint8Array(2048)),
50
+ (currentView = new Uint8Array(4096)),
76
51
  (writtenBytes = textEncoder.encodeInto(
77
52
  chunk.slice(read),
78
53
  currentView
79
54
  ).written));
80
- 2048 === writtenBytes &&
55
+ 4096 === writtenBytes &&
81
56
  (writeToDestination(destination, currentView),
82
- (currentView = new Uint8Array(2048)),
57
+ (currentView = new Uint8Array(4096)),
83
58
  (writtenBytes = 0));
84
59
  }
85
60
  } else
86
61
  0 !== chunk.byteLength &&
87
- (2048 < chunk.byteLength
62
+ (4096 < chunk.byteLength
88
63
  ? (0 < writtenBytes &&
89
64
  (writeToDestination(
90
65
  destination,
91
66
  currentView.subarray(0, writtenBytes)
92
67
  ),
93
- (currentView = new Uint8Array(2048)),
68
+ (currentView = new Uint8Array(4096)),
94
69
  (writtenBytes = 0)),
95
70
  writeToDestination(destination, chunk))
96
71
  : ((target = currentView.length - writtenBytes),
@@ -101,14 +76,21 @@
101
76
  (writtenBytes += target),
102
77
  writeToDestination(destination, currentView),
103
78
  (chunk = chunk.subarray(target))),
104
- (currentView = new Uint8Array(2048)),
79
+ (currentView = new Uint8Array(4096)),
105
80
  (writtenBytes = 0)),
106
81
  currentView.set(chunk, writtenBytes),
107
82
  (writtenBytes += chunk.byteLength),
108
- 2048 === writtenBytes &&
83
+ 4096 === writtenBytes &&
109
84
  (writeToDestination(destination, currentView),
110
- (currentView = new Uint8Array(2048)),
85
+ (currentView = new Uint8Array(4096)),
111
86
  (writtenBytes = 0))));
87
+ }
88
+ function writeToDestination(destination, view) {
89
+ destination = destination.write(view);
90
+ destinationHasCapacity = destinationHasCapacity && destination;
91
+ }
92
+ function writeChunkAndReturn(destination, chunk) {
93
+ writeChunk(destination, chunk);
112
94
  return destinationHasCapacity;
113
95
  }
114
96
  function completeWriting(destination) {
@@ -389,7 +371,7 @@
389
371
  });
390
372
  break;
391
373
  case "stylesheet":
392
- preload(srcSet, "stylesheet", {
374
+ preload(srcSet, "style", {
393
375
  crossOrigin: props.crossOrigin,
394
376
  integrity: props.integrity,
395
377
  nonce: props.nonce,
@@ -584,7 +566,12 @@
584
566
  case "fulfilled":
585
567
  return thenable.value;
586
568
  case "rejected":
587
- throw thenable.reason;
569
+ thenableState = thenable.reason;
570
+ if (void 0 === thenableState && !("reason" in thenable))
571
+ throw Error(
572
+ "A rejected Promise was passed to React without a `reason` property. React threw a generic error from where the Promise was used to assist in identifying the problematic Promise. Make sure that instrumented Promises correctly set the `reason` property when setting `status` to `'rejected'`."
573
+ );
574
+ throw thenableState;
588
575
  default:
589
576
  "string" === typeof thenable.status
590
577
  ? thenable.then(noop, noop)
@@ -726,6 +713,8 @@
726
713
  return "Suspense";
727
714
  case REACT_SUSPENSE_LIST_TYPE:
728
715
  return "SuspenseList";
716
+ case REACT_VIEW_TRANSITION_TYPE:
717
+ return "ViewTransition";
729
718
  }
730
719
  if ("object" === typeof type)
731
720
  switch (type.$$typeof) {
@@ -870,12 +859,19 @@
870
859
  switch (functionName) {
871
860
  case "new Promise":
872
861
  case "Function.withResolvers":
862
+ case "Promise.withResolvers":
873
863
  case "Function.reject":
864
+ case "Promise.reject":
874
865
  case "Function.resolve":
866
+ case "Promise.resolve":
875
867
  case "Function.all":
868
+ case "Promise.all":
876
869
  case "Function.allSettled":
870
+ case "Promise.allSettled":
877
871
  case "Function.race":
872
+ case "Promise.race":
878
873
  case "Function.try":
874
+ case "Promise.try":
879
875
  return !0;
880
876
  default:
881
877
  return !1;
@@ -904,7 +900,8 @@
904
900
  columnNumber = callsite[3];
905
901
  if (
906
902
  !callsite[6] &&
907
- request(url, functionName, lineNumber, columnNumber)
903
+ request(url, functionName, lineNumber, columnNumber) &&
904
+ "" !== url
908
905
  )
909
906
  return !0;
910
907
  }
@@ -918,11 +915,21 @@
918
915
  case "Promise.catch":
919
916
  case "Promise.finally":
920
917
  case "Function.reject":
918
+ case "Promise.reject":
921
919
  case "Function.resolve":
920
+ case "Promise.resolve":
922
921
  case "Function.all":
922
+ case "Promise.all":
923
923
  case "Function.allSettled":
924
+ case "Promise.allSettled":
925
+ case "Function.any":
926
+ case "Promise.any":
924
927
  case "Function.race":
928
+ case "Promise.race":
925
929
  case "Function.try":
930
+ case "Promise.try":
931
+ case "Function.withResolvers":
932
+ case "Promise.withResolvers":
926
933
  return !0;
927
934
  default:
928
935
  return !1;
@@ -941,7 +948,7 @@
941
948
  stack = stack[firstFrame];
942
949
  firstFrame = stack[0];
943
950
  var url = devirtualizeURL(stack[1]);
944
- return request(url, firstFrame, stack[2], stack[3]);
951
+ return request(url, firstFrame, stack[2], stack[3]) && "" !== url;
945
952
  }
946
953
  return !1;
947
954
  }
@@ -1080,11 +1087,11 @@
1080
1087
  model,
1081
1088
  bundlerConfig,
1082
1089
  onError,
1083
- onPostpone,
1084
1090
  onAllReady,
1085
1091
  onFatalError,
1086
1092
  identifierPrefix,
1087
1093
  temporaryReferences,
1094
+ debugStartTime,
1088
1095
  environmentName,
1089
1096
  filterStackFrame,
1090
1097
  keepDebugAlive
@@ -1102,7 +1109,7 @@
1102
1109
  pingedTasks = [],
1103
1110
  hints = new Set();
1104
1111
  this.type = type;
1105
- this.status = 10;
1112
+ this.status = OPENING;
1106
1113
  this.flushScheduled = !1;
1107
1114
  this.destination = this.fatalError = null;
1108
1115
  this.bundlerConfig = bundlerConfig;
@@ -1120,13 +1127,13 @@
1120
1127
  this.writtenClientReferences = new Map();
1121
1128
  this.writtenServerReferences = new Map();
1122
1129
  this.writtenObjects = new WeakMap();
1130
+ this.writtenImportStrings = new Map();
1131
+ this.writtenImportStringsSize = 0;
1123
1132
  this.temporaryReferences = temporaryReferences;
1124
1133
  this.identifierPrefix = identifierPrefix || "";
1125
1134
  this.identifierCount = 1;
1126
1135
  this.taintCleanupQueue = [];
1127
1136
  this.onError = void 0 === onError ? defaultErrorHandler : onError;
1128
- this.onPostpone =
1129
- void 0 === onPostpone ? defaultPostponeHandler : onPostpone;
1130
1137
  this.onAllReady = onAllReady;
1131
1138
  this.onFatalError = onFatalError;
1132
1139
  this.pendingDebugChunks = 0;
@@ -1151,7 +1158,10 @@
1151
1158
  this.deferredDebugObjects = keepDebugAlive
1152
1159
  ? { retained: new Map(), existing: new Map() }
1153
1160
  : null;
1154
- type = this.timeOrigin = performance.now();
1161
+ type =
1162
+ "number" === typeof debugStartTime
1163
+ ? (this.timeOrigin = debugStartTime - performance.timeOrigin)
1164
+ : (this.timeOrigin = performance.now());
1155
1165
  emitTimeOriginChunk(this, type + performance.timeOrigin);
1156
1166
  this.abortTime = -0;
1157
1167
  model = createTask(
@@ -1173,8 +1183,8 @@
1173
1183
  bundlerConfig,
1174
1184
  onError,
1175
1185
  identifierPrefix,
1176
- onPostpone,
1177
1186
  temporaryReferences,
1187
+ debugStartTime,
1178
1188
  environmentName,
1179
1189
  filterStackFrame,
1180
1190
  keepDebugAlive
@@ -1185,11 +1195,11 @@
1185
1195
  model,
1186
1196
  bundlerConfig,
1187
1197
  onError,
1188
- onPostpone,
1189
1198
  noop,
1190
1199
  noop,
1191
1200
  identifierPrefix,
1192
1201
  temporaryReferences,
1202
+ debugStartTime,
1193
1203
  environmentName,
1194
1204
  filterStackFrame,
1195
1205
  keepDebugAlive
@@ -1202,23 +1212,23 @@
1202
1212
  onFatalError,
1203
1213
  onError,
1204
1214
  identifierPrefix,
1205
- onPostpone,
1206
1215
  temporaryReferences,
1216
+ debugStartTime,
1207
1217
  environmentName,
1208
1218
  filterStackFrame,
1209
1219
  keepDebugAlive
1210
1220
  ) {
1211
1221
  resetOwnerStackLimit();
1212
1222
  return new RequestInstance(
1213
- 21,
1223
+ PRERENDER,
1214
1224
  model,
1215
1225
  bundlerConfig,
1216
1226
  onError,
1217
- onPostpone,
1218
1227
  onAllReady,
1219
1228
  onFatalError,
1220
1229
  identifierPrefix,
1221
1230
  temporaryReferences,
1231
+ debugStartTime,
1222
1232
  environmentName,
1223
1233
  filterStackFrame,
1224
1234
  keepDebugAlive
@@ -1262,7 +1272,23 @@
1262
1272
  ((cancelled = !0),
1263
1273
  request.status === ABORTING
1264
1274
  ? emitDebugHaltChunk(request, id)
1265
- : emitOutlinedDebugModelChunk(request, id, counter, value),
1275
+ : (isArrayImpl(value) && 200 < value.length) ||
1276
+ ((value instanceof ArrayBuffer ||
1277
+ value instanceof Int8Array ||
1278
+ value instanceof Uint8Array ||
1279
+ value instanceof Uint8ClampedArray ||
1280
+ value instanceof Int16Array ||
1281
+ value instanceof Uint16Array ||
1282
+ value instanceof Int32Array ||
1283
+ value instanceof Uint32Array ||
1284
+ value instanceof Float32Array ||
1285
+ value instanceof Float64Array ||
1286
+ value instanceof BigInt64Array ||
1287
+ value instanceof BigUint64Array ||
1288
+ value instanceof DataView) &&
1289
+ 1e3 < value.byteLength)
1290
+ ? emitDebugHaltChunk(request, id)
1291
+ : emitOutlinedDebugModelChunk(request, id, counter, value),
1266
1292
  enqueueFlush(request));
1267
1293
  },
1268
1294
  function (reason) {
@@ -1299,8 +1325,8 @@
1299
1325
  }
1300
1326
  );
1301
1327
  }
1302
- function serializeThenable(request, task, thenable) {
1303
- var newTask = createTask(
1328
+ function createThenableTask(request, task, thenable) {
1329
+ return createTask(
1304
1330
  request,
1305
1331
  thenable,
1306
1332
  task.keyPath,
@@ -1312,42 +1338,35 @@
1312
1338
  task.debugStack,
1313
1339
  task.debugTask
1314
1340
  );
1341
+ }
1342
+ function serializeThenable(request, task, thenable) {
1315
1343
  switch (thenable.status) {
1316
1344
  case "fulfilled":
1317
1345
  return (
1318
- forwardDebugInfoFromThenable(
1319
- request,
1320
- newTask,
1321
- thenable,
1322
- null,
1323
- null
1324
- ),
1325
- (newTask.model = thenable.value),
1326
- pingTask(request, newTask),
1327
- newTask.id
1346
+ (task = createThenableTask(request, task, thenable)),
1347
+ forwardDebugInfoFromThenable(request, task, thenable, null, null),
1348
+ (task.model = thenable.value),
1349
+ pingTask(request, task),
1350
+ task.id
1328
1351
  );
1329
1352
  case "rejected":
1330
1353
  return (
1331
- forwardDebugInfoFromThenable(
1332
- request,
1333
- newTask,
1334
- thenable,
1335
- null,
1336
- null
1337
- ),
1338
- erroredTask(request, newTask, thenable.reason),
1339
- newTask.id
1354
+ (task = createThenableTask(request, task, thenable)),
1355
+ forwardDebugInfoFromThenable(request, task, thenable, null, null),
1356
+ erroredTask(request, task, thenable.reason),
1357
+ task.id
1340
1358
  );
1341
1359
  default:
1360
+ var _newTask2 = createThenableTask(request, task, thenable);
1342
1361
  if (request.status === ABORTING)
1343
1362
  return (
1344
- request.abortableTasks.delete(newTask),
1345
- 21 === request.type
1346
- ? (haltTask(newTask), finishHaltedTask(newTask, request))
1363
+ request.abortableTasks.delete(_newTask2),
1364
+ request.type === PRERENDER
1365
+ ? (haltTask(_newTask2), finishHaltedTask(_newTask2, request))
1347
1366
  : ((task = request.fatalError),
1348
- abortTask(newTask),
1349
- finishAbortedTask(newTask, request, task)),
1350
- newTask.id
1367
+ abortTask(_newTask2),
1368
+ finishAbortedTask(_newTask2, request, task)),
1369
+ _newTask2.id
1351
1370
  );
1352
1371
  "string" !== typeof thenable.status &&
1353
1372
  ((thenable.status = "pending"),
@@ -1362,27 +1381,27 @@
1362
1381
  ((thenable.status = "rejected"), (thenable.reason = error));
1363
1382
  }
1364
1383
  ));
1384
+ thenable.then(
1385
+ function (value) {
1386
+ forwardDebugInfoFromCurrentContext(request, _newTask2, thenable);
1387
+ _newTask2.model = value;
1388
+ pingTask(request, _newTask2);
1389
+ },
1390
+ function (reason) {
1391
+ _newTask2.status === PENDING$1 &&
1392
+ ((_newTask2.timed = !0),
1393
+ erroredTask(request, _newTask2, reason),
1394
+ enqueueFlush(request));
1395
+ }
1396
+ );
1397
+ return _newTask2.id;
1365
1398
  }
1366
- thenable.then(
1367
- function (value) {
1368
- forwardDebugInfoFromCurrentContext(request, newTask, thenable);
1369
- newTask.model = value;
1370
- pingTask(request, newTask);
1371
- },
1372
- function (reason) {
1373
- 0 === newTask.status &&
1374
- ((newTask.timed = !0),
1375
- erroredTask(request, newTask, reason),
1376
- enqueueFlush(request));
1377
- }
1378
- );
1379
- return newTask.id;
1380
1399
  }
1381
1400
  function serializeReadableStream(request, task, stream) {
1382
1401
  function progress(entry) {
1383
- if (0 === streamTask.status)
1402
+ if (streamTask.status === PENDING$1)
1384
1403
  if (entry.done)
1385
- (streamTask.status = 1),
1404
+ (streamTask.status = COMPLETED),
1386
1405
  (entry = streamTask.id.toString(16) + ":C\n"),
1387
1406
  request.completedRegularChunks.push(entry),
1388
1407
  request.abortableTasks.delete(streamTask),
@@ -1394,17 +1413,25 @@
1394
1413
  callOnAllReadyIfReady(request);
1395
1414
  else
1396
1415
  try {
1397
- (streamTask.model = entry.value),
1398
- request.pendingChunks++,
1399
- tryStreamTask(request, streamTask),
1416
+ request.pendingChunks++,
1417
+ (streamTask.model = entry.value),
1418
+ isByteStream
1419
+ ? emitTypedArrayChunk(
1420
+ request,
1421
+ streamTask.id,
1422
+ "b",
1423
+ streamTask.model,
1424
+ !1
1425
+ )
1426
+ : tryStreamTask(request, streamTask),
1400
1427
  enqueueFlush(request),
1401
1428
  reader.read().then(progress, error);
1402
- } catch (x$0) {
1403
- error(x$0);
1429
+ } catch (x$6) {
1430
+ error(x$6);
1404
1431
  }
1405
1432
  }
1406
1433
  function error(reason) {
1407
- 0 === streamTask.status &&
1434
+ streamTask.status === PENDING$1 &&
1408
1435
  (request.cacheController.signal.removeEventListener(
1409
1436
  "abort",
1410
1437
  abortStream
@@ -1414,11 +1441,11 @@
1414
1441
  reader.cancel(reason).then(error, error));
1415
1442
  }
1416
1443
  function abortStream() {
1417
- if (0 === streamTask.status) {
1444
+ if (streamTask.status === PENDING$1) {
1418
1445
  var signal = request.cacheController.signal;
1419
1446
  signal.removeEventListener("abort", abortStream);
1420
1447
  signal = signal.reason;
1421
- 21 === request.type
1448
+ request.type === PRERENDER
1422
1449
  ? (request.abortableTasks.delete(streamTask),
1423
1450
  haltTask(streamTask),
1424
1451
  finishHaltedTask(streamTask, request))
@@ -1433,7 +1460,8 @@
1433
1460
  } catch (x) {
1434
1461
  supportsBYOB = !1;
1435
1462
  }
1436
- var reader = stream.getReader(),
1463
+ var isByteStream = supportsBYOB,
1464
+ reader = stream.getReader(),
1437
1465
  streamTask = createTask(
1438
1466
  request,
1439
1467
  task.model,
@@ -1448,7 +1476,7 @@
1448
1476
  );
1449
1477
  request.pendingChunks++;
1450
1478
  task =
1451
- streamTask.id.toString(16) + ":" + (supportsBYOB ? "r" : "R") + "\n";
1479
+ streamTask.id.toString(16) + ":" + (isByteStream ? "r" : "R") + "\n";
1452
1480
  request.completedRegularChunks.push(task);
1453
1481
  request.cacheController.signal.addEventListener("abort", abortStream);
1454
1482
  reader.read().then(progress, error);
@@ -1456,9 +1484,9 @@
1456
1484
  }
1457
1485
  function serializeAsyncIterable(request, task, iterable, iterator) {
1458
1486
  function progress(entry) {
1459
- if (0 === streamTask.status)
1487
+ if (streamTask.status === PENDING$1)
1460
1488
  if (entry.done) {
1461
- streamTask.status = 1;
1489
+ streamTask.status = COMPLETED;
1462
1490
  if (void 0 === entry.value)
1463
1491
  var endStreamRow = streamTask.id.toString(16) + ":C\n";
1464
1492
  else
@@ -1488,12 +1516,12 @@
1488
1516
  tryStreamTask(request, streamTask),
1489
1517
  enqueueFlush(request),
1490
1518
  callIteratorInDEV(iterator, progress, error);
1491
- } catch (x$1) {
1492
- error(x$1);
1519
+ } catch (x$7) {
1520
+ error(x$7);
1493
1521
  }
1494
1522
  }
1495
1523
  function error(reason) {
1496
- 0 === streamTask.status &&
1524
+ streamTask.status === PENDING$1 &&
1497
1525
  (request.cacheController.signal.removeEventListener(
1498
1526
  "abort",
1499
1527
  abortIterable
@@ -1504,11 +1532,11 @@
1504
1532
  iterator.throw(reason).then(noop, noop));
1505
1533
  }
1506
1534
  function abortIterable() {
1507
- if (0 === streamTask.status) {
1535
+ if (streamTask.status === PENDING$1) {
1508
1536
  var signal = request.cacheController.signal;
1509
1537
  signal.removeEventListener("abort", abortIterable);
1510
1538
  var reason = signal.reason;
1511
- 21 === request.type
1539
+ request.type === PRERENDER
1512
1540
  ? (request.abortableTasks.delete(streamTask),
1513
1541
  haltTask(streamTask),
1514
1542
  finishHaltedTask(streamTask, request))
@@ -1629,43 +1657,49 @@
1629
1657
  result.$$typeof === REACT_ELEMENT_TYPE && (result._store.validated = 1);
1630
1658
  var iteratorFn = getIteratorFn(result);
1631
1659
  if (iteratorFn) {
1632
- var multiShot = _defineProperty({}, Symbol.iterator, function () {
1633
- var iterator = iteratorFn.call(result);
1634
- iterator !== result ||
1635
- ("[object GeneratorFunction]" ===
1636
- Object.prototype.toString.call(Component) &&
1637
- "[object Generator]" ===
1638
- Object.prototype.toString.call(result)) ||
1639
- callWithDebugContextInDEV(request, task, function () {
1640
- console.error(
1641
- "Returning an Iterator from a Server Component is not supported since it cannot be looped over more than once. "
1642
- );
1643
- });
1644
- return iterator;
1645
- });
1646
- multiShot._debugInfo = result._debugInfo;
1647
- return multiShot;
1648
- }
1649
- return "function" !== typeof result[ASYNC_ITERATOR] ||
1650
- ("function" === typeof ReadableStream &&
1651
- result instanceof ReadableStream)
1652
- ? result
1653
- : ((multiShot = _defineProperty({}, ASYNC_ITERATOR, function () {
1654
- var iterator = result[ASYNC_ITERATOR]();
1660
+ var $jscomp$compprop0 = {};
1661
+ $jscomp$compprop0 =
1662
+ (($jscomp$compprop0[Symbol.iterator] = function () {
1663
+ var iterator = iteratorFn.call(result);
1655
1664
  iterator !== result ||
1656
- ("[object AsyncGeneratorFunction]" ===
1665
+ ("[object GeneratorFunction]" ===
1657
1666
  Object.prototype.toString.call(Component) &&
1658
- "[object AsyncGenerator]" ===
1667
+ "[object Generator]" ===
1659
1668
  Object.prototype.toString.call(result)) ||
1660
1669
  callWithDebugContextInDEV(request, task, function () {
1661
1670
  console.error(
1662
- "Returning an AsyncIterator from a Server Component is not supported since it cannot be looped over more than once. "
1671
+ "Returning an Iterator from a Server Component is not supported since it cannot be looped over more than once. "
1663
1672
  );
1664
1673
  });
1665
1674
  return iterator;
1666
- })),
1667
- (multiShot._debugInfo = result._debugInfo),
1668
- multiShot);
1675
+ }),
1676
+ $jscomp$compprop0);
1677
+ $jscomp$compprop0._debugInfo = result._debugInfo;
1678
+ return $jscomp$compprop0;
1679
+ }
1680
+ return "function" !== typeof result[ASYNC_ITERATOR] ||
1681
+ ("function" === typeof ReadableStream &&
1682
+ result instanceof ReadableStream)
1683
+ ? result
1684
+ : (($jscomp$compprop0 = {}),
1685
+ ($jscomp$compprop0 =
1686
+ (($jscomp$compprop0[ASYNC_ITERATOR] = function () {
1687
+ var iterator = result[ASYNC_ITERATOR]();
1688
+ iterator !== result ||
1689
+ ("[object AsyncGeneratorFunction]" ===
1690
+ Object.prototype.toString.call(Component) &&
1691
+ "[object AsyncGenerator]" ===
1692
+ Object.prototype.toString.call(result)) ||
1693
+ callWithDebugContextInDEV(request, task, function () {
1694
+ console.error(
1695
+ "Returning an AsyncIterator from a Server Component is not supported since it cannot be looped over more than once. "
1696
+ );
1697
+ });
1698
+ return iterator;
1699
+ }),
1700
+ $jscomp$compprop0)),
1701
+ ($jscomp$compprop0._debugInfo = result._debugInfo),
1702
+ $jscomp$compprop0);
1669
1703
  }
1670
1704
  function renderFunctionComponent(
1671
1705
  request,
@@ -1763,7 +1797,12 @@
1763
1797
  Component = task.keyPath;
1764
1798
  componentDebugInfo = task.implicitSlot;
1765
1799
  null !== key
1766
- ? (task.keyPath = null === Component ? key : Component + "," + key)
1800
+ ? (task.keyPath =
1801
+ key === REACT_OPTIMISTIC_KEY || Component === REACT_OPTIMISTIC_KEY
1802
+ ? REACT_OPTIMISTIC_KEY
1803
+ : null === Component
1804
+ ? key
1805
+ : Component + "," + key)
1767
1806
  : null === Component && (task.implicitSlot = !0);
1768
1807
  request = renderModelDestructive(request, task, emptyRoot, "", props);
1769
1808
  task.keyPath = Component;
@@ -1881,7 +1920,7 @@
1881
1920
  task.debugTask
1882
1921
  );
1883
1922
  retryTask(request, task);
1884
- return 1 === task.status
1923
+ return task.status === COMPLETED
1885
1924
  ? serializeByValueID(task.id)
1886
1925
  : serializeLazyID(task.id);
1887
1926
  }
@@ -1992,7 +2031,13 @@
1992
2031
  validated
1993
2032
  );
1994
2033
  ref = task.keyPath;
1995
- null === key ? (key = ref) : null !== ref && (key = ref + "," + key);
2034
+ null === key
2035
+ ? (key = ref)
2036
+ : null !== ref &&
2037
+ (key =
2038
+ ref === REACT_OPTIMISTIC_KEY || key === REACT_OPTIMISTIC_KEY
2039
+ ? REACT_OPTIMISTIC_KEY
2040
+ : ref + "," + key);
1996
2041
  newFormatContext = null;
1997
2042
  ref = task.debugOwner;
1998
2043
  null !== ref && outlineComponentInfo(request, ref);
@@ -2020,115 +2065,161 @@
2020
2065
  task = task.implicitSlot && null !== key ? [request] : request;
2021
2066
  return task;
2022
2067
  }
2023
- function visitAsyncNode(request, task, node, visited, cutOff) {
2024
- if (visited.has(node)) return null;
2025
- visited.add(node);
2026
- var previousIONode = null;
2027
- if (
2028
- null !== node.previous &&
2029
- node.end > request.timeOrigin &&
2030
- ((previousIONode = visitAsyncNode(
2031
- request,
2032
- task,
2033
- node.previous,
2034
- visited,
2035
- cutOff
2036
- )),
2037
- void 0 === previousIONode)
2068
+ function visitAsyncNode(
2069
+ request,
2070
+ task$jscomp$0,
2071
+ node$jscomp$0,
2072
+ visited,
2073
+ cutOff
2074
+ ) {
2075
+ for (
2076
+ var chain = [];
2077
+ null !== node$jscomp$0 && !visited.has(node$jscomp$0);
2078
+
2038
2079
  )
2039
- return;
2040
- switch (node.tag) {
2041
- case 0:
2042
- return node;
2043
- case 3:
2044
- return previousIONode;
2045
- case 1:
2046
- if (node.end <= request.timeOrigin) return previousIONode;
2047
- var awaited = node.awaited;
2048
- if (null !== awaited) {
2049
- cutOff = visitAsyncNode(request, task, awaited, visited, cutOff);
2050
- if (void 0 === cutOff) break;
2051
- null !== cutOff
2052
- ? (previousIONode =
2053
- 1 === cutOff.tag
2054
- ? cutOff
2080
+ chain.push(node$jscomp$0), (node$jscomp$0 = node$jscomp$0.previous);
2081
+ var previousIONode =
2082
+ null !== node$jscomp$0 ? visited.get(node$jscomp$0) : null;
2083
+ for (
2084
+ node$jscomp$0 = chain.length - 1;
2085
+ 0 <= node$jscomp$0;
2086
+ node$jscomp$0--
2087
+ ) {
2088
+ var n = chain[node$jscomp$0];
2089
+ visited.set(n, null);
2090
+ var result = request;
2091
+ var task = task$jscomp$0,
2092
+ node = n,
2093
+ visited$jscomp$0 = visited,
2094
+ cutOff$jscomp$0 = cutOff;
2095
+ if (0 <= node.end && node.end <= result.timeOrigin) result = null;
2096
+ else
2097
+ switch (node.tag) {
2098
+ case 0:
2099
+ result = node;
2100
+ break;
2101
+ case 3:
2102
+ result = previousIONode;
2103
+ break;
2104
+ case 1:
2105
+ var awaited = node.awaited,
2106
+ promise = node.promise.deref();
2107
+ if (null !== awaited)
2108
+ if (
2109
+ ((cutOff$jscomp$0 = visitAsyncNode(
2110
+ result,
2111
+ task,
2112
+ awaited,
2113
+ visited$jscomp$0,
2114
+ cutOff$jscomp$0
2115
+ )),
2116
+ void 0 === cutOff$jscomp$0)
2117
+ ) {
2118
+ result = void 0;
2119
+ break;
2120
+ } else
2121
+ null !== cutOff$jscomp$0
2122
+ ? (previousIONode =
2123
+ 1 === cutOff$jscomp$0.tag
2124
+ ? cutOff$jscomp$0
2125
+ : (null !== node.stack &&
2126
+ hasUnfilteredFrame(result, node.stack)) ||
2127
+ (void 0 !== promise &&
2128
+ "string" === typeof promise.displayName &&
2129
+ (null === cutOff$jscomp$0.stack ||
2130
+ !hasUnfilteredFrame(
2131
+ result,
2132
+ cutOff$jscomp$0.stack
2133
+ )))
2134
+ ? node
2135
+ : cutOff$jscomp$0)
2136
+ : result.status === ABORTING &&
2137
+ node.start < result.abortTime &&
2138
+ node.end > result.abortTime &&
2139
+ ((null !== node.stack &&
2140
+ hasUnfilteredFrame(result, node.stack)) ||
2141
+ (void 0 !== promise &&
2142
+ "string" === typeof promise.displayName)) &&
2143
+ (previousIONode = node);
2144
+ void 0 !== promise &&
2145
+ ((node = promise._debugInfo),
2146
+ null == node ||
2147
+ visited$jscomp$0.has(node) ||
2148
+ (visited$jscomp$0.set(node, null),
2149
+ forwardDebugInfo(result, task, node)));
2150
+ result = previousIONode;
2151
+ break;
2152
+ case 4:
2153
+ result = previousIONode;
2154
+ break;
2155
+ case 2:
2156
+ awaited = node.awaited;
2157
+ if (null !== awaited)
2158
+ if (
2159
+ ((promise = visitAsyncNode(
2160
+ result,
2161
+ task,
2162
+ awaited,
2163
+ visited$jscomp$0,
2164
+ cutOff$jscomp$0
2165
+ )),
2166
+ void 0 === promise)
2167
+ ) {
2168
+ result = void 0;
2169
+ break;
2170
+ } else if (null !== promise) {
2171
+ var startTime = node.start,
2172
+ endTime = node.end;
2173
+ startTime < cutOff$jscomp$0
2174
+ ? ((previousIONode = promise),
2175
+ null !== node.stack &&
2176
+ isAwaitInUserspace(result, node.stack) &&
2177
+ void 0 !==
2178
+ (null === awaited.promise
2179
+ ? void 0
2180
+ : awaited.promise.deref()) &&
2181
+ serializeIONode(result, promise, awaited.promise))
2055
2182
  : null !== node.stack &&
2056
- hasUnfilteredFrame(request, node.stack)
2057
- ? node
2058
- : cutOff)
2059
- : request.status === ABORTING &&
2060
- node.start < request.abortTime &&
2061
- node.end > request.abortTime &&
2062
- null !== node.stack &&
2063
- hasUnfilteredFrame(request, node.stack) &&
2064
- (previousIONode = node);
2065
- }
2066
- node = node.promise.deref();
2067
- void 0 !== node &&
2068
- ((node = node._debugInfo),
2069
- null == node ||
2070
- visited.has(node) ||
2071
- (visited.add(node), forwardDebugInfo(request, task, node)));
2072
- return previousIONode;
2073
- case 4:
2074
- return previousIONode;
2075
- case 2:
2076
- awaited = node.awaited;
2077
- if (null !== awaited) {
2078
- var _ioNode = visitAsyncNode(
2079
- request,
2080
- task,
2081
- awaited,
2082
- visited,
2083
- cutOff
2084
- );
2085
- if (void 0 === _ioNode) break;
2086
- if (null !== _ioNode) {
2087
- var startTime = node.start,
2088
- endTime = node.end;
2089
- if (endTime <= request.timeOrigin) return null;
2090
- startTime < cutOff
2091
- ? ((previousIONode = _ioNode),
2092
- null !== node.stack &&
2093
- isAwaitInUserspace(request, node.stack) &&
2094
- void 0 !==
2095
- (null === awaited.promise
2096
- ? void 0
2097
- : awaited.promise.deref()) &&
2098
- serializeIONode(request, _ioNode, awaited.promise))
2099
- : null !== node.stack && isAwaitInUserspace(request, node.stack)
2100
- ? (request.status === ABORTING &&
2101
- startTime > request.abortTime) ||
2102
- (serializeIONode(request, _ioNode, awaited.promise),
2103
- null != node.owner &&
2104
- outlineComponentInfo(request, node.owner),
2105
- (cutOff = (0, request.environmentName)()),
2106
- advanceTaskTime(request, task, startTime),
2107
- request.pendingChunks++,
2108
- emitDebugChunk(request, task.id, {
2109
- awaited: _ioNode,
2110
- env: cutOff,
2111
- owner: node.owner,
2112
- stack:
2113
- null === node.stack
2114
- ? null
2115
- : filterStackTrace(request, node.stack)
2116
- }),
2117
- markOperationEndTime(request, task, endTime),
2118
- request.status === ABORTING && (previousIONode = void 0))
2119
- : (previousIONode = _ioNode);
2120
- }
2183
+ isAwaitInUserspace(result, node.stack)
2184
+ ? (result.status === ABORTING &&
2185
+ startTime > result.abortTime) ||
2186
+ (serializeIONode(result, promise, awaited.promise),
2187
+ visited$jscomp$0.set(promise, null),
2188
+ null != node.owner &&
2189
+ outlineComponentInfo(result, node.owner),
2190
+ (cutOff$jscomp$0 = (0, result.environmentName)()),
2191
+ advanceTaskTime(result, task, startTime),
2192
+ result.pendingChunks++,
2193
+ emitDebugChunk(result, task.id, {
2194
+ awaited: promise,
2195
+ env: cutOff$jscomp$0,
2196
+ owner: node.owner,
2197
+ stack:
2198
+ null === node.stack
2199
+ ? null
2200
+ : filterStackTrace(result, node.stack)
2201
+ }),
2202
+ markOperationEndTime(result, task, endTime),
2203
+ result.status === ABORTING && (previousIONode = void 0))
2204
+ : (previousIONode = promise);
2205
+ }
2206
+ node = node.promise.deref();
2207
+ void 0 !== node &&
2208
+ ((node = node._debugInfo),
2209
+ null == node ||
2210
+ visited$jscomp$0.has(node) ||
2211
+ (visited$jscomp$0.set(node, null),
2212
+ forwardDebugInfo(result, task, node)));
2213
+ result = previousIONode;
2214
+ break;
2215
+ default:
2216
+ throw Error("Unknown AsyncSequence tag. This is a bug in React.");
2121
2217
  }
2122
- node = node.promise.deref();
2123
- void 0 !== node &&
2124
- ((node = node._debugInfo),
2125
- null == node ||
2126
- visited.has(node) ||
2127
- (visited.add(node), forwardDebugInfo(request, task, node)));
2128
- return previousIONode;
2129
- default:
2130
- throw Error("Unknown AsyncSequence tag. This is a bug in React.");
2218
+ null !== result && visited.set(n, result);
2219
+ if (void 0 === result) return;
2220
+ previousIONode = result;
2131
2221
  }
2222
+ return previousIONode;
2132
2223
  }
2133
2224
  function emitAsyncSequence(
2134
2225
  request,
@@ -2138,8 +2229,8 @@
2138
2229
  owner,
2139
2230
  stack
2140
2231
  ) {
2141
- var visited = new Set();
2142
- alreadyForwardedDebugInfo && visited.add(alreadyForwardedDebugInfo);
2232
+ var visited = new Map();
2233
+ alreadyForwardedDebugInfo && visited.set(alreadyForwardedDebugInfo, null);
2143
2234
  node = visitAsyncNode(request, task, node, visited, task.time);
2144
2235
  void 0 !== node &&
2145
2236
  null !== node &&
@@ -2174,7 +2265,7 @@
2174
2265
  pingedTasks.push(task);
2175
2266
  1 === pingedTasks.length &&
2176
2267
  ((request.flushScheduled = null !== request.destination),
2177
- 21 === request.type || 10 === request.status
2268
+ request.type === PRERENDER || request.status === OPENING
2178
2269
  ? scheduleMicrotask(function () {
2179
2270
  return performWork(request);
2180
2271
  })
@@ -2193,9 +2284,35 @@
2193
2284
  debugOwner,
2194
2285
  debugStack,
2195
2286
  debugTask
2287
+ ) {
2288
+ return createTaskWithID(
2289
+ request,
2290
+ request.nextChunkId++,
2291
+ model,
2292
+ keyPath,
2293
+ implicitSlot,
2294
+ formatContext,
2295
+ abortSet,
2296
+ lastTimestamp,
2297
+ debugOwner,
2298
+ debugStack,
2299
+ debugTask
2300
+ );
2301
+ }
2302
+ function createTaskWithID(
2303
+ request,
2304
+ id,
2305
+ model,
2306
+ keyPath,
2307
+ implicitSlot,
2308
+ formatContext,
2309
+ abortSet,
2310
+ lastTimestamp,
2311
+ debugOwner,
2312
+ debugStack,
2313
+ debugTask
2196
2314
  ) {
2197
2315
  request.pendingChunks++;
2198
- var id = request.nextChunkId++;
2199
2316
  "object" !== typeof model ||
2200
2317
  null === model ||
2201
2318
  null !== keyPath ||
@@ -2203,7 +2320,7 @@
2203
2320
  request.writtenObjects.set(model, serializeByValueID(id));
2204
2321
  var task = {
2205
2322
  id: id,
2206
- status: 0,
2323
+ status: PENDING$1,
2207
2324
  model: model,
2208
2325
  keyPath: keyPath,
2209
2326
  implicitSlot: implicitSlot,
@@ -2211,32 +2328,6 @@
2211
2328
  ping: function () {
2212
2329
  return pingTask(request, task);
2213
2330
  },
2214
- toJSON: function (parentPropertyName, value) {
2215
- var parent = this,
2216
- originalValue = parent[parentPropertyName];
2217
- "object" !== typeof originalValue ||
2218
- originalValue === value ||
2219
- originalValue instanceof Date ||
2220
- callWithDebugContextInDEV(request, task, function () {
2221
- "Object" !== objectName(originalValue)
2222
- ? "string" === typeof jsxChildrenParents.get(parent)
2223
- ? console.error(
2224
- "%s objects cannot be rendered as text children. Try formatting it using toString().%s",
2225
- objectName(originalValue),
2226
- describeObjectForErrorMessage(parent, parentPropertyName)
2227
- )
2228
- : console.error(
2229
- "Only plain objects can be passed to Client Components from Server Components. %s objects are not supported.%s",
2230
- objectName(originalValue),
2231
- describeObjectForErrorMessage(parent, parentPropertyName)
2232
- )
2233
- : console.error(
2234
- "Only plain objects can be passed to Client Components from Server Components. Objects with toJSON methods are not supported. Convert it manually to a simple value before passing it to props.%s",
2235
- describeObjectForErrorMessage(parent, parentPropertyName)
2236
- );
2237
- });
2238
- return renderModel(request, task, parent, parentPropertyName, value);
2239
- },
2240
2331
  thenableState: null,
2241
2332
  timed: !1
2242
2333
  };
@@ -2248,6 +2339,74 @@
2248
2339
  abortSet.add(task);
2249
2340
  return task;
2250
2341
  }
2342
+ function resolveModel(request, task, parent, parentPropertyName, value) {
2343
+ var jsonValue = value;
2344
+ null !== value &&
2345
+ "object" === typeof value &&
2346
+ "function" === typeof value.toJSON &&
2347
+ (jsonValue = value.toJSON(parentPropertyName));
2348
+ var originalValue = parent[parentPropertyName];
2349
+ "object" !== typeof originalValue ||
2350
+ originalValue === jsonValue ||
2351
+ originalValue instanceof Date ||
2352
+ callWithDebugContextInDEV(request, task, function () {
2353
+ ArrayBuffer.isView(originalValue)
2354
+ ? console.error(
2355
+ "Binary data with a toJSON method, such as a Node.js Buffer, is serialized through toJSON instead of as binary. Pass a Uint8Array or ArrayBuffer to send binary data.%s",
2356
+ describeObjectForErrorMessage(parent, parentPropertyName)
2357
+ )
2358
+ : "Object" !== objectName(originalValue)
2359
+ ? "string" === typeof jsxChildrenParents.get(parent)
2360
+ ? console.error(
2361
+ "%s objects cannot be rendered as text children. Try formatting it using toString().%s",
2362
+ objectName(originalValue),
2363
+ describeObjectForErrorMessage(parent, parentPropertyName)
2364
+ )
2365
+ : console.error(
2366
+ "Only plain objects can be passed to Client Components from Server Components. %s objects are not supported.%s",
2367
+ objectName(originalValue),
2368
+ describeObjectForErrorMessage(parent, parentPropertyName)
2369
+ )
2370
+ : console.error(
2371
+ "Only plain objects can be passed to Client Components from Server Components. Objects with toJSON methods are not supported. Convert it manually to a simple value before passing it to props.%s",
2372
+ describeObjectForErrorMessage(parent, parentPropertyName)
2373
+ );
2374
+ });
2375
+ value = renderModel(request, task, parent, parentPropertyName, jsonValue);
2376
+ if (null === value || "object" !== typeof value) return value;
2377
+ if (isArrayImpl(value)) {
2378
+ var _resolved = [];
2379
+ for (jsonValue = 0; jsonValue < value.length; jsonValue++)
2380
+ _resolved[jsonValue] = resolveModel(
2381
+ request,
2382
+ task,
2383
+ value,
2384
+ "" + jsonValue,
2385
+ value[jsonValue]
2386
+ );
2387
+ return _resolved;
2388
+ }
2389
+ jsonValue = {};
2390
+ for (_resolved in value)
2391
+ if (hasOwnProperty.call(value, _resolved)) {
2392
+ var resolvedValue = resolveModel(
2393
+ request,
2394
+ task,
2395
+ value,
2396
+ _resolved,
2397
+ value[_resolved]
2398
+ );
2399
+ _resolved === __PROTO__$1
2400
+ ? Object.defineProperty(jsonValue, _resolved, {
2401
+ value: resolvedValue,
2402
+ enumerable: !0,
2403
+ writable: !0,
2404
+ configurable: !0
2405
+ })
2406
+ : (jsonValue[_resolved] = resolvedValue);
2407
+ }
2408
+ return jsonValue;
2409
+ }
2251
2410
  function serializeByValueID(id) {
2252
2411
  return "$" + id.toString(16);
2253
2412
  }
@@ -2296,12 +2455,13 @@
2296
2455
  : serializeByValueID(existingId);
2297
2456
  try {
2298
2457
  var clientReferenceMetadata = resolveClientReferenceMetadata(
2299
- request.bundlerConfig,
2300
- clientReference
2301
- );
2458
+ request.bundlerConfig,
2459
+ clientReference
2460
+ ),
2461
+ json = stringifyImportMetadata(request, clientReferenceMetadata, !1);
2302
2462
  request.pendingChunks++;
2303
2463
  var importId = request.nextChunkId++;
2304
- emitImportChunk(request, importId, clientReferenceMetadata, !1);
2464
+ emitImportChunk(request, importId, json, !1);
2305
2465
  writtenClientReferences.set(clientReferenceKey, importId);
2306
2466
  return parent[0] === REACT_ELEMENT_TYPE && "1" === parentPropertyName
2307
2467
  ? serializeLazyID(importId)
@@ -2333,12 +2493,13 @@
2333
2493
  : serializeByValueID(existingId);
2334
2494
  try {
2335
2495
  var clientReferenceMetadata = resolveClientReferenceMetadata(
2336
- request.bundlerConfig,
2337
- clientReference
2338
- );
2496
+ request.bundlerConfig,
2497
+ clientReference
2498
+ ),
2499
+ json = stringifyImportMetadata(request, clientReferenceMetadata, !0);
2339
2500
  request.pendingDebugChunks++;
2340
2501
  var importId = request.nextChunkId++;
2341
- emitImportChunk(request, importId, clientReferenceMetadata, !0);
2502
+ emitImportChunk(request, importId, json, !0);
2342
2503
  return parent[0] === REACT_ELEMENT_TYPE && "1" === parentPropertyName
2343
2504
  ? serializeLazyID(importId)
2344
2505
  : serializeByValueID(importId);
@@ -2427,6 +2588,8 @@
2427
2588
  return serializeByValueID(bufferId);
2428
2589
  }
2429
2590
  function serializeDebugTypedArray(request, tag, typedArray) {
2591
+ if (1e3 < typedArray.byteLength && !doNotLimit.has(typedArray))
2592
+ return serializeDeferredObject(request, typedArray);
2430
2593
  request.pendingDebugChunks++;
2431
2594
  var bufferId = request.nextChunkId++;
2432
2595
  emitTypedArrayChunk(request, bufferId, tag, typedArray, !0);
@@ -2461,7 +2624,7 @@
2461
2624
  }
2462
2625
  function serializeBlob(request, blob) {
2463
2626
  function progress(entry) {
2464
- if (0 === newTask.status)
2627
+ if (newTask.status === PENDING$1)
2465
2628
  if (entry.done)
2466
2629
  request.cacheController.signal.removeEventListener(
2467
2630
  "abort",
@@ -2474,7 +2637,7 @@
2474
2637
  );
2475
2638
  }
2476
2639
  function error(reason) {
2477
- 0 === newTask.status &&
2640
+ newTask.status === PENDING$1 &&
2478
2641
  (request.cacheController.signal.removeEventListener(
2479
2642
  "abort",
2480
2643
  abortBlob
@@ -2484,11 +2647,11 @@
2484
2647
  reader.cancel(reason).then(error, error));
2485
2648
  }
2486
2649
  function abortBlob() {
2487
- if (0 === newTask.status) {
2650
+ if (newTask.status === PENDING$1) {
2488
2651
  var signal = request.cacheController.signal;
2489
2652
  signal.removeEventListener("abort", abortBlob);
2490
2653
  signal = signal.reason;
2491
- 21 === request.type
2654
+ request.type === PRERENDER
2492
2655
  ? (request.abortableTasks.delete(newTask),
2493
2656
  haltTask(newTask),
2494
2657
  finishHaltedTask(newTask, request))
@@ -2514,6 +2677,29 @@
2514
2677
  reader.read().then(progress).catch(error);
2515
2678
  return "$B" + newTask.id.toString(16);
2516
2679
  }
2680
+ function escapeStringValue(value) {
2681
+ return "$" === value[0] ? "$" + value : value;
2682
+ }
2683
+ function serializeImportString(request, value) {
2684
+ if (value.length < MIN_DEDUPLICATED_IMPORT_STRING_LENGTH)
2685
+ return escapeStringValue(value);
2686
+ var writtenStrings = request.writtenImportStrings,
2687
+ existing = writtenStrings.get(value);
2688
+ if (void 0 !== existing) return existing;
2689
+ existing = request.writtenImportStringsSize + value.length;
2690
+ if (existing > MAX_DEDUPLICATED_IMPORT_STRINGS_SIZE)
2691
+ return escapeStringValue(value);
2692
+ request.writtenImportStringsSize = existing;
2693
+ request.pendingChunks++;
2694
+ existing = request.nextChunkId++;
2695
+ var json = stringify(escapeStringValue(value));
2696
+ request.completedImportChunks.push(
2697
+ existing.toString(16) + ":" + json + "\n"
2698
+ );
2699
+ request = serializeByValueID(existing);
2700
+ writtenStrings.set(value, request);
2701
+ return request;
2702
+ }
2517
2703
  function renderModel(request, task, parent, key, value) {
2518
2704
  serializedSize += key.length;
2519
2705
  var prevKeyPath = task.keyPath,
@@ -2528,8 +2714,8 @@
2528
2714
  (parent.$$typeof === REACT_ELEMENT_TYPE ||
2529
2715
  parent.$$typeof === REACT_LAZY_TYPE);
2530
2716
  if (request.status === ABORTING) {
2531
- task.status = 3;
2532
- if (21 === request.type)
2717
+ task.status = ABORTED;
2718
+ if (request.type === PRERENDER)
2533
2719
  return (
2534
2720
  (task = request.nextChunkId++),
2535
2721
  (task = parent
@@ -2597,7 +2783,7 @@
2597
2783
  value
2598
2784
  ) {
2599
2785
  task.model = value;
2600
- "__proto__" === parentPropertyName &&
2786
+ parentPropertyName === __PROTO__$1 &&
2601
2787
  callWithDebugContextInDEV(request, task, function () {
2602
2788
  console.error(
2603
2789
  "Expected not to serialize an object with own property `__proto__`. When parsed this property will be omitted.%s",
@@ -2641,7 +2827,9 @@
2641
2827
  void 0 === value._debugTask
2642
2828
  ) {
2643
2829
  var key = "";
2644
- null !== value.key && (key = ' key="' + value.key + '"');
2830
+ null !== value.key &&
2831
+ value.key !== REACT_OPTIMISTIC_KEY &&
2832
+ (key = ' key="' + value.key + '"');
2645
2833
  console.error(
2646
2834
  "Attempted to render <%s%s> without development properties. This is not supported. It can happen if:\n- The element is created with a production version of React but rendered in development.\n- The element was cloned with a custom function instead of `React.cloneElement`.\nThe props of this element may help locate this element: %o",
2647
2835
  value.type,
@@ -2676,8 +2864,8 @@
2676
2864
  return renderModelDestructive(
2677
2865
  request,
2678
2866
  task,
2679
- emptyRoot,
2680
- "",
2867
+ parent,
2868
+ parentPropertyName,
2681
2869
  elementReference
2682
2870
  );
2683
2871
  case REACT_LEGACY_ELEMENT_TYPE:
@@ -2841,9 +3029,7 @@
2841
3029
  ? "$D" + value
2842
3030
  : 1024 <= value.length && null !== byteLengthOfChunk
2843
3031
  ? serializeLargeTextString(request, value)
2844
- : "$" === value[0]
2845
- ? "$" + value
2846
- : value
3032
+ : escapeStringValue(value)
2847
3033
  );
2848
3034
  if ("boolean" === typeof value) return value;
2849
3035
  if ("number" === typeof value) return serializeNumber(value);
@@ -2952,7 +3138,7 @@
2952
3138
  onFatalError(error);
2953
3139
  null !== request.destination
2954
3140
  ? ((request.status = CLOSED), request.destination.destroy(error))
2955
- : ((request.status = 13), (request.fatalError = error));
3141
+ : ((request.status = CLOSING), (request.fatalError = error));
2956
3142
  request.cacheController.abort(
2957
3143
  Error("The render was aborted due to a fatal error.", { cause: error })
2958
3144
  );
@@ -2971,19 +3157,21 @@
2971
3157
  "An error occurred but serializing the error message failed."),
2972
3158
  (stack = []);
2973
3159
  }
2974
- return (
2975
- "$Z" +
2976
- outlineModel(request, {
2977
- name: name,
2978
- message: message,
2979
- stack: stack,
2980
- env: env
2981
- }).toString(16)
2982
- );
3160
+ name = { name: name, message: message, stack: stack, env: env };
3161
+ "cause" in error &&
3162
+ ((message = outlineModel(request, error.cause)),
3163
+ (name.cause = serializeByValueID(message)));
3164
+ "undefined" !== typeof AggregateError &&
3165
+ error instanceof AggregateError &&
3166
+ ((error = outlineModel(request, error.errors)),
3167
+ (name.errors = serializeByValueID(error)));
3168
+ return "$Z" + outlineModel(request, name).toString(16);
2983
3169
  }
2984
3170
  function emitErrorChunk(request, id, digest, error, debug, owner) {
2985
3171
  var name = "Error",
2986
- env = (0, request.environmentName)();
3172
+ env = (0, request.environmentName)(),
3173
+ causeReference = null,
3174
+ errorsReference = null;
2987
3175
  try {
2988
3176
  if (error instanceof Error) {
2989
3177
  name = error.name;
@@ -2991,6 +3179,23 @@
2991
3179
  var stack = filterStackTrace(request, parseStackTrace(error, 0));
2992
3180
  var errorEnv = error.environmentName;
2993
3181
  "string" === typeof errorEnv && (env = errorEnv);
3182
+ if ("cause" in error) {
3183
+ var cause = error.cause,
3184
+ causeId = debug
3185
+ ? outlineDebugModel(request, { objectLimit: 5 }, cause)
3186
+ : outlineModel(request, cause);
3187
+ causeReference = serializeByValueID(causeId);
3188
+ }
3189
+ if (
3190
+ "undefined" !== typeof AggregateError &&
3191
+ error instanceof AggregateError
3192
+ ) {
3193
+ var errors = error.errors,
3194
+ errorsId = debug
3195
+ ? outlineDebugModel(request, { objectLimit: 5 }, errors)
3196
+ : outlineModel(request, errors);
3197
+ errorsReference = serializeByValueID(errorsId);
3198
+ }
2994
3199
  } else
2995
3200
  (message =
2996
3201
  "object" === typeof error && null !== error
@@ -3011,14 +3216,100 @@
3011
3216
  env: env,
3012
3217
  owner: error
3013
3218
  };
3219
+ null !== causeReference && (digest.cause = causeReference);
3220
+ null !== errorsReference && (digest.errors = errorsReference);
3014
3221
  id = id.toString(16) + ":E" + stringify(digest) + "\n";
3015
3222
  debug
3016
3223
  ? request.completedDebugChunks.push(id)
3017
3224
  : request.completedErrorChunks.push(id);
3018
3225
  }
3019
- function emitImportChunk(request, id, clientReferenceMetadata, debug) {
3020
- clientReferenceMetadata = stringify(clientReferenceMetadata);
3021
- id = id.toString(16) + ":I" + clientReferenceMetadata + "\n";
3226
+ function importMetadataReplacer(key, value) {
3227
+ return "string" === typeof value
3228
+ ? ((key = importStringRequest),
3229
+ null === key
3230
+ ? escapeStringValue(value)
3231
+ : serializeImportString(key, value))
3232
+ : value;
3233
+ }
3234
+ function transformImportMetadata(request, value, depth) {
3235
+ switch (typeof value) {
3236
+ case "string":
3237
+ return serializeImportString(request, value);
3238
+ case "number":
3239
+ case "boolean":
3240
+ case "undefined":
3241
+ return value;
3242
+ case "object":
3243
+ if (null === value) return null;
3244
+ if (
3245
+ depth > MAX_IMPORT_METADATA_DEPTH ||
3246
+ "function" === typeof value.toJSON
3247
+ )
3248
+ return NOT_PLAIN_IMPORT_METADATA;
3249
+ if (isArrayImpl(value)) {
3250
+ for (
3251
+ var length = value.length, _copy = Array(length), i = 0;
3252
+ i < length;
3253
+ i++
3254
+ ) {
3255
+ var element = value[i];
3256
+ if ("string" === typeof element)
3257
+ _copy[i] = serializeImportString(request, element);
3258
+ else {
3259
+ element = transformImportMetadata(request, element, depth + 1);
3260
+ if (element === NOT_PLAIN_IMPORT_METADATA)
3261
+ return NOT_PLAIN_IMPORT_METADATA;
3262
+ _copy[i] = element;
3263
+ }
3264
+ }
3265
+ return _copy;
3266
+ }
3267
+ length = getPrototypeOf(value);
3268
+ if (length !== ObjectPrototype$1 && null !== length)
3269
+ return NOT_PLAIN_IMPORT_METADATA;
3270
+ length = Object.keys(value);
3271
+ _copy = {};
3272
+ for (i = 0; i < length.length; i++) {
3273
+ element = length[i];
3274
+ if (element in ObjectPrototype$1) return NOT_PLAIN_IMPORT_METADATA;
3275
+ var _element = value[element];
3276
+ if ("string" === typeof _element)
3277
+ _copy[element] = serializeImportString(request, _element);
3278
+ else {
3279
+ _element = transformImportMetadata(request, _element, depth + 1);
3280
+ if (_element === NOT_PLAIN_IMPORT_METADATA)
3281
+ return NOT_PLAIN_IMPORT_METADATA;
3282
+ _copy[element] = _element;
3283
+ }
3284
+ }
3285
+ return _copy;
3286
+ default:
3287
+ return NOT_PLAIN_IMPORT_METADATA;
3288
+ }
3289
+ }
3290
+ function stringifyImportMetadata(request, clientReferenceMetadata, debug) {
3291
+ if (!debug) {
3292
+ var copy = transformImportMetadata(request, clientReferenceMetadata, 0);
3293
+ if (copy !== NOT_PLAIN_IMPORT_METADATA) return stringify(copy);
3294
+ }
3295
+ a: {
3296
+ copy = importStringRequest;
3297
+ importStringRequest = debug ? null : request;
3298
+ try {
3299
+ var JSCompiler_inline_result = stringify(
3300
+ clientReferenceMetadata,
3301
+ importMetadataReplacer
3302
+ );
3303
+ break a;
3304
+ } finally {
3305
+ importStringRequest = copy;
3306
+ }
3307
+ JSCompiler_inline_result = void 0;
3308
+ }
3309
+ return JSCompiler_inline_result;
3310
+ }
3311
+ function emitImportChunk(request, id, json, debug) {
3312
+ id = id.toString(16) + ":I" + json + "\n";
3022
3313
  debug
3023
3314
  ? request.completedDebugChunks.push(id)
3024
3315
  : request.completedImportChunks.push(id);
@@ -3034,12 +3325,15 @@
3034
3325
  function emitDebugChunk(request, id, debugInfo) {
3035
3326
  var json = serializeDebugModel(request, 500, debugInfo);
3036
3327
  null !== request.debugDestination
3037
- ? ((debugInfo = request.nextChunkId++),
3038
- (json = debugInfo.toString(16) + ":" + json + "\n"),
3039
- request.pendingDebugChunks++,
3040
- request.completedDebugChunks.push(json),
3041
- (id = id.toString(16) + ':D"$' + debugInfo.toString(16) + '"\n'),
3042
- request.completedRegularChunks.push(id))
3328
+ ? '"' === json[0] && "$" === json[1]
3329
+ ? ((id = id.toString(16) + ":D" + json + "\n"),
3330
+ request.completedRegularChunks.push(id))
3331
+ : ((debugInfo = request.nextChunkId++),
3332
+ (json = debugInfo.toString(16) + ":" + json + "\n"),
3333
+ request.pendingDebugChunks++,
3334
+ request.completedDebugChunks.push(json),
3335
+ (id = id.toString(16) + ':D"$' + debugInfo.toString(16) + '"\n'),
3336
+ request.completedRegularChunks.push(id))
3043
3337
  : ((id = id.toString(16) + ":D" + json + "\n"),
3044
3338
  request.completedRegularChunks.push(id));
3045
3339
  }
@@ -3104,55 +3398,62 @@
3104
3398
  if (void 0 !== existingRef) return existingRef;
3105
3399
  existingRef = null;
3106
3400
  var name = "";
3401
+ if (null !== ioNode.promise) {
3402
+ var promise = ioNode.promise.deref();
3403
+ void 0 !== promise &&
3404
+ "string" === typeof promise.displayName &&
3405
+ (name = promise.displayName);
3406
+ }
3107
3407
  if (null !== ioNode.stack) {
3108
3408
  a: {
3109
3409
  existingRef = ioNode.stack;
3110
- for (name = 0; name < existingRef.length; name++) {
3111
- var callsite = existingRef[name];
3410
+ for (promise = 0; promise < existingRef.length; promise++) {
3411
+ var callsite = existingRef[promise];
3112
3412
  if (!isPromiseCreationInternal(callsite[1], callsite[0])) {
3113
- name = 0 < name ? existingRef.slice(name) : existingRef;
3413
+ promise = 0 < promise ? existingRef.slice(promise) : existingRef;
3114
3414
  break a;
3115
3415
  }
3116
3416
  }
3117
- name = [];
3417
+ promise = [];
3118
3418
  }
3119
- existingRef = filterStackTrace(request, name);
3120
- a: {
3121
- callsite = "";
3122
- for (
3123
- var filterStackFrame = request.filterStackFrame, i = 0;
3124
- i < name.length;
3125
- i++
3126
- ) {
3127
- var callsite$jscomp$0 = name[i],
3128
- functionName = callsite$jscomp$0[0],
3129
- url = devirtualizeURL(callsite$jscomp$0[1]);
3130
- if (
3131
- filterStackFrame(
3132
- url,
3133
- functionName,
3134
- callsite$jscomp$0[2],
3135
- callsite$jscomp$0[3]
3136
- )
3137
- ) {
3138
- if ("" === callsite) {
3139
- name = functionName;
3419
+ existingRef = filterStackTrace(request, promise);
3420
+ if ("" === name) {
3421
+ a: {
3422
+ name = promise;
3423
+ promise = "";
3424
+ callsite = request.filterStackFrame;
3425
+ for (var i = 0; i < name.length; i++) {
3426
+ var callsite$jscomp$0 = name[i],
3427
+ functionName = callsite$jscomp$0[0],
3428
+ url = devirtualizeURL(callsite$jscomp$0[1]);
3429
+ if (
3430
+ callsite(
3431
+ url,
3432
+ functionName,
3433
+ callsite$jscomp$0[2],
3434
+ callsite$jscomp$0[3]
3435
+ ) &&
3436
+ "" !== url
3437
+ ) {
3438
+ if ("" === promise) {
3439
+ name = functionName;
3440
+ break a;
3441
+ }
3442
+ name = promise;
3140
3443
  break a;
3141
- }
3142
- name = callsite;
3143
- break a;
3144
- } else callsite = functionName;
3444
+ } else promise = functionName;
3445
+ }
3446
+ name = "";
3145
3447
  }
3146
- name = "";
3448
+ name.startsWith("Window.")
3449
+ ? (name = name.slice(7))
3450
+ : name.startsWith("<anonymous>.") && (name = name.slice(7));
3147
3451
  }
3148
- name.startsWith("Window.")
3149
- ? (name = name.slice(7))
3150
- : name.startsWith("<anonymous>.") && (name = name.slice(7));
3151
3452
  }
3152
- callsite = ioNode.owner;
3153
- null != callsite && outlineComponentInfo(request, callsite);
3154
- filterStackFrame = void 0;
3155
- null !== promiseRef && (filterStackFrame = promiseRef.deref());
3453
+ promise = ioNode.owner;
3454
+ null != promise && outlineComponentInfo(request, promise);
3455
+ callsite = void 0;
3456
+ null !== promiseRef && (callsite = promiseRef.deref());
3156
3457
  promiseRef = (0, request.environmentName)();
3157
3458
  i = 3 === ioNode.tag ? request.abortTime : ioNode.end;
3158
3459
  request.pendingDebugChunks++;
@@ -3163,9 +3464,9 @@
3163
3464
  name,
3164
3465
  ioNode.start,
3165
3466
  i,
3166
- filterStackFrame,
3167
- promiseRef,
3168
3467
  callsite,
3468
+ promiseRef,
3469
+ promise,
3169
3470
  existingRef
3170
3471
  );
3171
3472
  promiseRef = serializeByValueID(callsite$jscomp$0);
@@ -3182,8 +3483,16 @@
3182
3483
  var binaryLength = typedArray.byteLength;
3183
3484
  id = id.toString(16) + ":" + tag + binaryLength.toString(16) + ",";
3184
3485
  debug
3185
- ? request.completedDebugChunks.push(id, typedArray)
3186
- : request.completedRegularChunks.push(id, typedArray);
3486
+ ? request.completedDebugChunks.push(
3487
+ NEXT_TWO_CHUNKS_ARE_ATOMIC,
3488
+ id,
3489
+ typedArray
3490
+ )
3491
+ : request.completedRegularChunks.push(
3492
+ NEXT_TWO_CHUNKS_ARE_ATOMIC,
3493
+ id,
3494
+ typedArray
3495
+ );
3187
3496
  }
3188
3497
  function emitTextChunk(request, id, text, debug) {
3189
3498
  if (null === byteLengthOfChunk)
@@ -3194,8 +3503,16 @@
3194
3503
  var binaryLength = byteLengthOfChunk(text);
3195
3504
  id = id.toString(16) + ":T" + binaryLength.toString(16) + ",";
3196
3505
  debug
3197
- ? request.completedDebugChunks.push(id, text)
3198
- : request.completedRegularChunks.push(id, text);
3506
+ ? request.completedDebugChunks.push(
3507
+ NEXT_TWO_CHUNKS_ARE_ATOMIC,
3508
+ id,
3509
+ text
3510
+ )
3511
+ : request.completedRegularChunks.push(
3512
+ NEXT_TWO_CHUNKS_ARE_ATOMIC,
3513
+ id,
3514
+ text
3515
+ );
3199
3516
  }
3200
3517
  function renderDebugModel(
3201
3518
  request,
@@ -3374,7 +3691,11 @@
3374
3691
  }
3375
3692
  if ("function" === typeof value.then)
3376
3693
  return serializeDebugThenable(request, counter, value);
3377
- if (isArrayImpl(value)) return value;
3694
+ if (isArrayImpl(value))
3695
+ return 200 < value.length && !doNotLimit.has(value)
3696
+ ? serializeDeferredObject(request, value)
3697
+ : value;
3698
+ if (value instanceof Date) return "$D" + value.toJSON();
3378
3699
  if (value instanceof Map) {
3379
3700
  value = Array.from(value);
3380
3701
  counter.objectLimit++;
@@ -3409,25 +3730,35 @@
3409
3730
  ).toString(16)
3410
3731
  );
3411
3732
  if (value instanceof Error) {
3412
- counter = "Error";
3413
- var env = (0, request.environmentName)();
3733
+ var name = "Error";
3734
+ parent = (0, request.environmentName)();
3414
3735
  try {
3415
- (counter = value.name),
3416
- (ref = String(value.message)),
3417
- (key = filterStackTrace(request, parseStackTrace(value, 0))),
3736
+ (name = value.name),
3737
+ (key = String(value.message)),
3738
+ (ref = filterStackTrace(request, parseStackTrace(value, 0))),
3418
3739
  (entry = value.environmentName),
3419
- "string" === typeof entry && (env = entry);
3740
+ "string" === typeof entry && (parent = entry);
3420
3741
  } catch (x) {
3421
- (ref =
3742
+ (key =
3422
3743
  "An error occurred but serializing the error message failed."),
3423
- (key = []);
3744
+ (ref = []);
3424
3745
  }
3746
+ key = { name: name, message: key, stack: ref, env: parent };
3747
+ "cause" in value &&
3748
+ (counter.objectLimit--,
3749
+ (entry = outlineDebugModel(request, counter, value.cause)),
3750
+ (key.cause = serializeByValueID(entry)));
3751
+ "undefined" !== typeof AggregateError &&
3752
+ value instanceof AggregateError &&
3753
+ (counter.objectLimit--,
3754
+ (value = outlineDebugModel(request, counter, value.errors)),
3755
+ (key.errors = serializeByValueID(value)));
3425
3756
  request =
3426
3757
  "$Z" +
3427
3758
  outlineDebugModel(
3428
3759
  request,
3429
- { objectLimit: 2 * key.length + 1 },
3430
- { name: counter, message: ref, stack: key, env: env }
3760
+ { objectLimit: 2 * ref.length + 1 },
3761
+ key
3431
3762
  ).toString(16);
3432
3763
  return request;
3433
3764
  }
@@ -3463,9 +3794,9 @@
3463
3794
  request = getPrototypeOf(value);
3464
3795
  if (request !== ObjectPrototype$1 && null !== request) {
3465
3796
  counter = Object.create(null);
3466
- for (env in value)
3467
- if (hasOwnProperty.call(value, env) || isGetter(request, env))
3468
- counter[env] = value[env];
3797
+ for (name in value)
3798
+ if (hasOwnProperty.call(value, name) || isGetter(request, name))
3799
+ counter[name] = value[name];
3469
3800
  ref = request.constructor;
3470
3801
  "function" !== typeof ref ||
3471
3802
  ref.prototype !== request ||
@@ -3477,11 +3808,12 @@
3477
3808
  return value;
3478
3809
  }
3479
3810
  if ("string" === typeof value) {
3480
- if (
3481
- "Z" === value[value.length - 1] &&
3482
- parent[parentPropertyName] instanceof Date
3483
- )
3484
- return "$D" + value;
3811
+ if (1e6 < value.length)
3812
+ return (
3813
+ "This string of length " +
3814
+ value.length +
3815
+ " has been omitted by React to avoid sending too much data from the server."
3816
+ );
3485
3817
  if (1024 <= value.length) {
3486
3818
  if (0 >= counter.objectLimit)
3487
3819
  return serializeDeferredObject(request, value);
@@ -3491,7 +3823,7 @@
3491
3823
  emitTextChunk(request, counter, value, !0);
3492
3824
  return serializeByValueID(counter);
3493
3825
  }
3494
- return "$" === value[0] ? "$" + value : value;
3826
+ return escapeStringValue(value);
3495
3827
  }
3496
3828
  if ("boolean" === typeof value) return value;
3497
3829
  if ("number" === typeof value) return serializeNumber(value);
@@ -3543,19 +3875,17 @@
3543
3875
  }
3544
3876
  return "bigint" === typeof value
3545
3877
  ? "$n" + value.toString(10)
3546
- : value instanceof Date
3547
- ? "$D" + value.toJSON()
3548
- : "unknown type " + typeof value;
3878
+ : "unknown type " + typeof value;
3549
3879
  }
3550
3880
  function serializeDebugModel(request, objectLimit, model) {
3551
- function replacer(parentPropertyName, value) {
3881
+ function replacer(parentPropertyName) {
3552
3882
  try {
3553
3883
  return renderDebugModel(
3554
3884
  request,
3555
3885
  counter,
3556
3886
  this,
3557
3887
  parentPropertyName,
3558
- value
3888
+ this[parentPropertyName]
3559
3889
  );
3560
3890
  } catch (x) {
3561
3891
  return (
@@ -3579,14 +3909,14 @@
3579
3909
  }
3580
3910
  }
3581
3911
  function emitOutlinedDebugModelChunk(request, id, counter, model) {
3582
- function replacer(parentPropertyName, value) {
3912
+ function replacer(parentPropertyName) {
3583
3913
  try {
3584
3914
  return renderDebugModel(
3585
3915
  request,
3586
3916
  counter,
3587
3917
  this,
3588
3918
  parentPropertyName,
3589
- value
3919
+ this[parentPropertyName]
3590
3920
  );
3591
3921
  } catch (x) {
3592
3922
  return (
@@ -3651,6 +3981,8 @@
3651
3981
  parseStackTrace(ioInfo$jscomp$0.debugStack, 1)
3652
3982
  )
3653
3983
  : ioInfo$jscomp$0.stack;
3984
+ var env = ioInfo$jscomp$0.env;
3985
+ null == env && (env = (0, request.environmentName)());
3654
3986
  emitIOInfoChunk(
3655
3987
  request,
3656
3988
  id$jscomp$0,
@@ -3658,7 +3990,7 @@
3658
3990
  ioInfo$jscomp$0.start,
3659
3991
  ioInfo$jscomp$0.end,
3660
3992
  ioInfo$jscomp$0.value,
3661
- ioInfo$jscomp$0.env,
3993
+ env,
3662
3994
  owner,
3663
3995
  debugStack
3664
3996
  );
@@ -3677,7 +4009,10 @@
3677
4009
  )
3678
4010
  : info.stack;
3679
4011
  ioInfo = { awaited: ioInfo };
3680
- null != info.env && (ioInfo.env = info.env);
4012
+ ioInfo.env =
4013
+ null != info.env
4014
+ ? info.env
4015
+ : (0, request$jscomp$0.environmentName)();
3681
4016
  null != info.owner && (ioInfo.owner = info.owner);
3682
4017
  null != debugStack && (ioInfo.stack = debugStack);
3683
4018
  request$jscomp$0.pendingChunks++;
@@ -3812,7 +4147,14 @@
3812
4147
  value,
3813
4148
  !1
3814
4149
  )
3815
- : ((value = stringify(value, task.toJSON)),
4150
+ : ((value = resolveModel(
4151
+ request,
4152
+ task,
4153
+ { "": value },
4154
+ "",
4155
+ value
4156
+ )),
4157
+ (value = stringify(value)),
3816
4158
  (task =
3817
4159
  task.id.toString(16) +
3818
4160
  ":" +
@@ -3822,16 +4164,16 @@
3822
4164
  }
3823
4165
  function erroredTask(request, task, error) {
3824
4166
  task.timed && markOperationEndTime(request, task, performance.now());
3825
- task.status = 4;
4167
+ task.status = ERRORED$1;
3826
4168
  var digest = logRecoverableError(request, error, task);
3827
4169
  emitErrorChunk(request, task.id, digest, error, !1, task.debugOwner);
3828
4170
  request.abortableTasks.delete(task);
3829
4171
  callOnAllReadyIfReady(request);
3830
4172
  }
3831
4173
  function retryTask(request, task) {
3832
- if (0 === task.status) {
4174
+ if (task.status === PENDING$1) {
3833
4175
  var prevCanEmitDebugInfo = canEmitDebugInfo;
3834
- task.status = 5;
4176
+ task.status = RENDERING;
3835
4177
  var parentSerializedSize = serializedSize;
3836
4178
  try {
3837
4179
  modelRoot = task.model;
@@ -3863,15 +4205,15 @@
3863
4205
  processedChunk = task.id.toString(16) + ":" + json + "\n";
3864
4206
  request.completedRegularChunks.push(processedChunk);
3865
4207
  }
3866
- task.status = 1;
4208
+ task.status = COMPLETED;
3867
4209
  request.abortableTasks.delete(task);
3868
4210
  callOnAllReadyIfReady(request);
3869
4211
  } catch (thrownValue) {
3870
4212
  if (request.status === ABORTING)
3871
4213
  if (
3872
4214
  (request.abortableTasks.delete(task),
3873
- (task.status = 0),
3874
- 21 === request.type)
4215
+ (task.status = PENDING$1),
4216
+ request.type === PRERENDER)
3875
4217
  )
3876
4218
  haltTask(task), finishHaltedTask(task, request);
3877
4219
  else {
@@ -3889,7 +4231,7 @@
3889
4231
  null !== x &&
3890
4232
  "function" === typeof x.then
3891
4233
  ) {
3892
- task.status = 0;
4234
+ task.status = PENDING$1;
3893
4235
  task.thenableState = getThenableStateAfterSuspending();
3894
4236
  var ping = task.ping;
3895
4237
  x.then(ping, ping);
@@ -3933,10 +4275,10 @@
3933
4275
  }
3934
4276
  }
3935
4277
  function abortTask(task) {
3936
- 0 === task.status && (task.status = 3);
4278
+ task.status === PENDING$1 && (task.status = ABORTED);
3937
4279
  }
3938
4280
  function finishAbortedTask(task, request, errorId) {
3939
- 3 === task.status &&
4281
+ task.status === ABORTED &&
3940
4282
  (forwardDebugInfoFromAbortedTask(request, task),
3941
4283
  task.timed && markOperationEndTime(request, task, request.abortTime),
3942
4284
  (errorId = serializeByValueID(errorId)),
@@ -3944,17 +4286,17 @@
3944
4286
  request.completedErrorChunks.push(task));
3945
4287
  }
3946
4288
  function haltTask(task) {
3947
- 0 === task.status && (task.status = 3);
4289
+ task.status === PENDING$1 && (task.status = ABORTED);
3948
4290
  }
3949
4291
  function finishHaltedTask(task, request) {
3950
- 3 === task.status &&
4292
+ task.status === ABORTED &&
3951
4293
  (forwardDebugInfoFromAbortedTask(request, task),
3952
4294
  request.pendingChunks--);
3953
4295
  }
3954
4296
  function flushCompletedChunks(request) {
3955
4297
  if (null !== request.debugDestination) {
3956
4298
  var debugDestination = request.debugDestination;
3957
- currentView = new Uint8Array(2048);
4299
+ currentView = new Uint8Array(4096);
3958
4300
  writtenBytes = 0;
3959
4301
  destinationHasCapacity = !0;
3960
4302
  try {
@@ -3962,9 +4304,20 @@
3962
4304
  var debugChunks = request.completedDebugChunks, i = 0;
3963
4305
  i < debugChunks.length;
3964
4306
  i++
3965
- )
3966
- request.pendingDebugChunks--,
3967
- writeChunkAndReturn(debugDestination, debugChunks[i]);
4307
+ ) {
4308
+ var item = debugChunks[i];
4309
+ if (item === NEXT_TWO_CHUNKS_ARE_ATOMIC) {
4310
+ if (i + 2 >= debugChunks.length)
4311
+ throw Error(
4312
+ "A chunk pair is incomplete. This is a bug in React."
4313
+ );
4314
+ request.pendingDebugChunks -= 2;
4315
+ writeChunk(debugDestination, debugChunks[i + 1]);
4316
+ writeChunk(debugDestination, debugChunks[i + 2]);
4317
+ i += 2;
4318
+ } else
4319
+ request.pendingDebugChunks--, writeChunk(debugDestination, item);
4320
+ }
3968
4321
  debugChunks.splice(0, i);
3969
4322
  } finally {
3970
4323
  completeWriting(debugDestination);
@@ -3973,7 +4326,7 @@
3973
4326
  }
3974
4327
  debugDestination = request.destination;
3975
4328
  if (null !== debugDestination) {
3976
- currentView = new Uint8Array(2048);
4329
+ currentView = new Uint8Array(4096);
3977
4330
  writtenBytes = 0;
3978
4331
  destinationHasCapacity = !0;
3979
4332
  try {
@@ -4011,18 +4364,33 @@
4011
4364
  debugChunks = 0;
4012
4365
  debugChunks < _debugChunks.length;
4013
4366
  debugChunks++
4014
- )
4015
- if (
4016
- (request.pendingDebugChunks--,
4017
- !writeChunkAndReturn(
4367
+ ) {
4368
+ var _item = _debugChunks[debugChunks];
4369
+ importsChunks = void 0;
4370
+ if (_item === NEXT_TWO_CHUNKS_ARE_ATOMIC) {
4371
+ if (debugChunks + 2 >= _debugChunks.length)
4372
+ throw Error(
4373
+ "A chunk pair is incomplete. This is a bug in React."
4374
+ );
4375
+ request.pendingDebugChunks -= 2;
4376
+ writeChunk(debugDestination, _debugChunks[debugChunks + 1]);
4377
+ importsChunks = writeChunkAndReturn(
4018
4378
  debugDestination,
4019
- _debugChunks[debugChunks]
4020
- ))
4021
- ) {
4379
+ _debugChunks[debugChunks + 2]
4380
+ );
4381
+ debugChunks += 2;
4382
+ } else
4383
+ request.pendingDebugChunks--,
4384
+ (importsChunks = writeChunkAndReturn(
4385
+ debugDestination,
4386
+ _item
4387
+ ));
4388
+ if (!importsChunks) {
4022
4389
  request.destination = null;
4023
4390
  debugChunks++;
4024
4391
  break;
4025
4392
  }
4393
+ }
4026
4394
  _debugChunks.splice(0, debugChunks);
4027
4395
  }
4028
4396
  var regularChunks = request.completedRegularChunks;
@@ -4030,18 +4398,30 @@
4030
4398
  debugChunks = 0;
4031
4399
  debugChunks < regularChunks.length;
4032
4400
  debugChunks++
4033
- )
4034
- if (
4035
- (request.pendingChunks--,
4036
- !writeChunkAndReturn(
4401
+ ) {
4402
+ var _item2 = regularChunks[debugChunks];
4403
+ _debugChunks = void 0;
4404
+ if (_item2 === NEXT_TWO_CHUNKS_ARE_ATOMIC) {
4405
+ if (debugChunks + 2 >= regularChunks.length)
4406
+ throw Error(
4407
+ "A chunk pair is incomplete. This is a bug in React."
4408
+ );
4409
+ request.pendingChunks -= 2;
4410
+ writeChunk(debugDestination, regularChunks[debugChunks + 1]);
4411
+ _debugChunks = writeChunkAndReturn(
4037
4412
  debugDestination,
4038
- regularChunks[debugChunks]
4039
- ))
4040
- ) {
4413
+ regularChunks[debugChunks + 2]
4414
+ );
4415
+ debugChunks += 2;
4416
+ } else
4417
+ request.pendingChunks--,
4418
+ (_debugChunks = writeChunkAndReturn(debugDestination, _item2));
4419
+ if (!_debugChunks) {
4041
4420
  request.destination = null;
4042
4421
  debugChunks++;
4043
4422
  break;
4044
4423
  }
4424
+ }
4045
4425
  regularChunks.splice(0, debugChunks);
4046
4426
  var errorChunks = request.completedErrorChunks;
4047
4427
  for (debugChunks = 0; debugChunks < errorChunks.length; debugChunks++)
@@ -4060,16 +4440,16 @@
4060
4440
  flushBuffered(debugDestination);
4061
4441
  }
4062
4442
  0 === request.pendingChunks &&
4063
- ((importsChunks = request.debugDestination),
4443
+ (request.status < ABORTING &&
4444
+ request.cacheController.abort(
4445
+ Error(
4446
+ "This render completed successfully. All cacheSignals are now aborted to allow clean up of any unused resources."
4447
+ )
4448
+ ),
4449
+ (regularChunks = request.debugDestination),
4064
4450
  0 === request.pendingDebugChunks
4065
- ? (null !== importsChunks &&
4066
- (importsChunks.end(), (request.debugDestination = null)),
4067
- request.status < ABORTING &&
4068
- request.cacheController.abort(
4069
- Error(
4070
- "This render completed successfully. All cacheSignals are now aborted to allow clean up of any unused resources."
4071
- )
4072
- ),
4451
+ ? (null !== regularChunks &&
4452
+ (regularChunks.end(), (request.debugDestination = null)),
4073
4453
  null !== request.destination &&
4074
4454
  ((request.status = CLOSED),
4075
4455
  request.destination.end(),
@@ -4077,7 +4457,7 @@
4077
4457
  null !== request.debugDestination &&
4078
4458
  (request.debugDestination.end(),
4079
4459
  (request.debugDestination = null)))
4080
- : null !== importsChunks &&
4460
+ : null !== regularChunks &&
4081
4461
  null !== request.destination &&
4082
4462
  ((request.status = CLOSED),
4083
4463
  request.destination.end(),
@@ -4089,7 +4469,7 @@
4089
4469
  requestStorage.run(request, performWork, request);
4090
4470
  });
4091
4471
  setImmediate(function () {
4092
- 10 === request.status && (request.status = 11);
4472
+ request.status === OPENING && (request.status = 11);
4093
4473
  });
4094
4474
  }
4095
4475
  function enqueueFlush(request) {
@@ -4107,7 +4487,7 @@
4107
4487
  ((request = request.onAllReady), request());
4108
4488
  }
4109
4489
  function startFlowing(request, destination) {
4110
- if (13 === request.status)
4490
+ if (request.status === CLOSING)
4111
4491
  (request.status = CLOSED), destination.destroy(request.fatalError);
4112
4492
  else if (request.status !== CLOSED && null === request.destination) {
4113
4493
  request.destination = destination;
@@ -4119,7 +4499,7 @@
4119
4499
  }
4120
4500
  }
4121
4501
  function startFlowingDebug(request, debugDestination) {
4122
- if (13 === request.status)
4502
+ if (request.status === CLOSING)
4123
4503
  (request.status = CLOSED), debugDestination.destroy(request.fatalError);
4124
4504
  else if (request.status !== CLOSED && null === request.debugDestination) {
4125
4505
  request.debugDestination = debugDestination;
@@ -4154,6 +4534,17 @@
4154
4534
  logRecoverableError(request, error, null), fatalError(request, error);
4155
4535
  }
4156
4536
  }
4537
+ function attachAbortSignal(request, signal) {
4538
+ signal.aborted
4539
+ ? abort(request, signal.reason)
4540
+ : signal.addEventListener(
4541
+ "abort",
4542
+ function () {
4543
+ abort(request, signal.reason);
4544
+ },
4545
+ { signal: request.cacheController.signal }
4546
+ );
4547
+ }
4157
4548
  function abort(request, reason) {
4158
4549
  if (!(11 < request.status))
4159
4550
  try {
@@ -4162,7 +4553,7 @@
4162
4553
  request.cacheController.abort(reason);
4163
4554
  var abortableTasks = request.abortableTasks;
4164
4555
  if (0 < abortableTasks.size)
4165
- if (21 === request.type)
4556
+ if (request.type === PRERENDER)
4166
4557
  abortableTasks.forEach(function (task) {
4167
4558
  return haltTask(task, request);
4168
4559
  }),
@@ -4183,15 +4574,15 @@
4183
4574
  )
4184
4575
  : reason,
4185
4576
  digest = logRecoverableError(request, error, null),
4186
- _errorId2 = request.nextChunkId++;
4187
- request.fatalError = _errorId2;
4577
+ errorId = request.nextChunkId++;
4578
+ request.fatalError = errorId;
4188
4579
  request.pendingChunks++;
4189
- emitErrorChunk(request, _errorId2, digest, error, !1, null);
4580
+ emitErrorChunk(request, errorId, digest, error, !1, null);
4190
4581
  abortableTasks.forEach(function (task) {
4191
- return abortTask(task, request, _errorId2);
4582
+ return abortTask(task, request, errorId);
4192
4583
  });
4193
4584
  setImmediate(function () {
4194
- return finishAbort(request, abortableTasks, _errorId2);
4585
+ return finishAbort(request, abortableTasks, errorId);
4195
4586
  });
4196
4587
  }
4197
4588
  else {
@@ -4199,9 +4590,9 @@
4199
4590
  onAllReady();
4200
4591
  flushCompletedChunks(request);
4201
4592
  }
4202
- } catch (error$2) {
4203
- logRecoverableError(request, error$2, null),
4204
- fatalError(request, error$2);
4593
+ } catch (error$8) {
4594
+ logRecoverableError(request, error$8, null),
4595
+ fatalError(request, error$8);
4205
4596
  }
4206
4597
  }
4207
4598
  function fromHex(str) {
@@ -4392,6 +4783,16 @@
4392
4783
  null !== listeners && rejectChunk(response, listeners, error);
4393
4784
  }
4394
4785
  }
4786
+ function createResolvedModelChunk(response, value, id) {
4787
+ var $jscomp$compprop2 = {};
4788
+ return new ReactPromise(
4789
+ "resolved_model",
4790
+ value,
4791
+ (($jscomp$compprop2.id = id),
4792
+ ($jscomp$compprop2[RESPONSE_SYMBOL] = response),
4793
+ $jscomp$compprop2)
4794
+ );
4795
+ }
4395
4796
  function resolveModelChunk(response, chunk, value, id) {
4396
4797
  if ("pending" !== chunk.status)
4397
4798
  (chunk = chunk.reason),
@@ -4403,7 +4804,9 @@
4403
4804
  rejectListeners = chunk.reason;
4404
4805
  chunk.status = "resolved_model";
4405
4806
  chunk.value = value;
4406
- chunk.reason = _defineProperty({ id: id }, RESPONSE_SYMBOL, response);
4807
+ value = {};
4808
+ chunk.reason =
4809
+ ((value.id = id), (value[RESPONSE_SYMBOL] = response), value);
4407
4810
  if (null !== resolveListeners)
4408
4811
  switch ((initializeModelChunk(chunk), chunk.status)) {
4409
4812
  case "fulfilled":
@@ -4412,13 +4815,21 @@
4412
4815
  case "blocked":
4413
4816
  case "pending":
4414
4817
  if (chunk.value)
4415
- for (value = 0; value < resolveListeners.length; value++)
4416
- chunk.value.push(resolveListeners[value]);
4818
+ for (
4819
+ response = 0;
4820
+ response < resolveListeners.length;
4821
+ response++
4822
+ )
4823
+ chunk.value.push(resolveListeners[response]);
4417
4824
  else chunk.value = resolveListeners;
4418
4825
  if (chunk.reason) {
4419
4826
  if (rejectListeners)
4420
- for (value = 0; value < rejectListeners.length; value++)
4421
- chunk.reason.push(rejectListeners[value]);
4827
+ for (
4828
+ resolveListeners = 0;
4829
+ resolveListeners < rejectListeners.length;
4830
+ resolveListeners++
4831
+ )
4832
+ chunk.reason.push(rejectListeners[resolveListeners]);
4422
4833
  } else chunk.reason = rejectListeners;
4423
4834
  break;
4424
4835
  case "rejected":
@@ -4428,12 +4839,15 @@
4428
4839
  }
4429
4840
  }
4430
4841
  function createResolvedIteratorResultChunk(response, value, done) {
4842
+ var $jscomp$compprop4 = {};
4431
4843
  return new ReactPromise(
4432
4844
  "resolved_model",
4433
4845
  (done ? '{"done":true,"value":' : '{"done":false,"value":') +
4434
4846
  value +
4435
4847
  "}",
4436
- _defineProperty({ id: -1 }, RESPONSE_SYMBOL, response)
4848
+ (($jscomp$compprop4.id = -1),
4849
+ ($jscomp$compprop4[RESPONSE_SYMBOL] = response),
4850
+ $jscomp$compprop4)
4437
4851
  );
4438
4852
  }
4439
4853
  function resolveIteratorResultChunk(response, chunk, value, done) {
@@ -4490,7 +4904,9 @@
4490
4904
  (cachedPromise = requireModule(serverReference)),
4491
4905
  (id = blockedPromise),
4492
4906
  (id.status = "fulfilled"),
4493
- (id.value = cachedPromise)
4907
+ (id.value = cachedPromise),
4908
+ (id.reason = null),
4909
+ cachedPromise
4494
4910
  );
4495
4911
  if (initializingHandler) {
4496
4912
  var handler = initializingHandler;
@@ -4676,11 +5092,7 @@
4676
5092
  ((chunk = response._formData.data.get(response._prefix + id)),
4677
5093
  (chunk =
4678
5094
  "string" === typeof chunk
4679
- ? new ReactPromise(
4680
- "resolved_model",
4681
- chunk,
4682
- _defineProperty({ id: id }, RESPONSE_SYMBOL, response)
4683
- )
5095
+ ? createResolvedModelChunk(response, chunk, id)
4684
5096
  : response._closed
4685
5097
  ? new ReactPromise("rejected", null, response._closedReason)
4686
5098
  : new ReactPromise("pending", null, null)),
@@ -5006,11 +5418,7 @@
5006
5418
  flightController = {
5007
5419
  enqueueModel: function (json) {
5008
5420
  if (null === previousBlockedChunk) {
5009
- var chunk = new ReactPromise(
5010
- "resolved_model",
5011
- json,
5012
- _defineProperty({ id: -1 }, RESPONSE_SYMBOL, response)
5013
- );
5421
+ var chunk = createResolvedModelChunk(response, json, -1);
5014
5422
  initializeModelChunk(chunk);
5015
5423
  "fulfilled" === chunk.status
5016
5424
  ? enqueue(chunk.value)
@@ -5066,7 +5474,9 @@
5066
5474
  var buffer = [],
5067
5475
  closed = !1,
5068
5476
  nextWriteIndex = 0,
5069
- iterable = _defineProperty({}, ASYNC_ITERATOR, function () {
5477
+ $jscomp$compprop5 = {};
5478
+ $jscomp$compprop5 =
5479
+ (($jscomp$compprop5[ASYNC_ITERATOR] = function () {
5070
5480
  var nextReadIndex = 0;
5071
5481
  return new FlightIterator(function (arg) {
5072
5482
  if (void 0 !== arg)
@@ -5084,8 +5494,11 @@
5084
5494
  }
5085
5495
  return buffer[nextReadIndex++];
5086
5496
  });
5087
- });
5088
- iterator = iterator ? iterable[ASYNC_ITERATOR]() : iterable;
5497
+ }),
5498
+ $jscomp$compprop5);
5499
+ iterator = iterator
5500
+ ? $jscomp$compprop5[ASYNC_ITERATOR]()
5501
+ : $jscomp$compprop5;
5089
5502
  resolveStream(response, reference, iterator, {
5090
5503
  enqueueModel: function (value) {
5091
5504
  nextWriteIndex === buffer.length
@@ -5388,10 +5801,11 @@
5388
5801
  arrayRoot
5389
5802
  );
5390
5803
  case "B":
5391
- return (
5392
- (obj = parseInt(value.slice(2), 16)),
5393
- response._formData.data.get(response._prefix + obj)
5394
- );
5804
+ obj = parseInt(value.slice(2), 16);
5805
+ response = response._formData.data.get(response._prefix + obj);
5806
+ if (!(response instanceof Blob))
5807
+ throw Error("Referenced Blob is not a Blob.");
5808
+ return response;
5395
5809
  case "R":
5396
5810
  return parseReadableStream(response, value, void 0);
5397
5811
  case "r":
@@ -5650,10 +6064,11 @@
5650
6064
  REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"),
5651
6065
  REACT_MEMO_TYPE = Symbol.for("react.memo"),
5652
6066
  REACT_LAZY_TYPE = Symbol.for("react.lazy"),
5653
- REACT_MEMO_CACHE_SENTINEL = Symbol.for("react.memo_cache_sentinel");
5654
- Symbol.for("react.postpone");
5655
- var MAYBE_ITERATOR_SYMBOL = Symbol.iterator,
6067
+ REACT_MEMO_CACHE_SENTINEL = Symbol.for("react.memo_cache_sentinel"),
6068
+ REACT_VIEW_TRANSITION_TYPE = Symbol.for("react.view_transition"),
6069
+ MAYBE_ITERATOR_SYMBOL = Symbol.iterator,
5656
6070
  ASYNC_ITERATOR = Symbol.asyncIterator,
6071
+ REACT_OPTIMISTIC_KEY = Symbol.for("react.optimistic_key"),
5657
6072
  scheduleMicrotask = queueMicrotask,
5658
6073
  currentView = null,
5659
6074
  writtenBytes = 0,
@@ -5672,7 +6087,7 @@
5672
6087
  },
5673
6088
  PROMISE_PROTOTYPE = Promise.prototype,
5674
6089
  deepProxyHandlers = {
5675
- get: function (target, name) {
6090
+ get: function (target, name, receiver) {
5676
6091
  switch (name) {
5677
6092
  case "$$typeof":
5678
6093
  return target.$$typeof;
@@ -5695,9 +6110,7 @@
5695
6110
  case Symbol.toStringTag:
5696
6111
  return Object.prototype[Symbol.toStringTag];
5697
6112
  case "Provider":
5698
- throw Error(
5699
- "Cannot render a Client Context Provider on the Server. Instead, you can export a Client Component wrapper that itself renders a Client Context Provider."
5700
- );
6113
+ return receiver;
5701
6114
  case "then":
5702
6115
  throw Error(
5703
6116
  "Cannot await or return from a thenable. You cannot await a client module from a server component."
@@ -5839,7 +6252,7 @@
5839
6252
  componentStorage = new async_hooks.AsyncLocalStorage(),
5840
6253
  TEMPORARY_REFERENCE_TAG = Symbol.for("react.temporary.reference"),
5841
6254
  proxyHandlers = {
5842
- get: function (target, name) {
6255
+ get: function (target, name, receiver) {
5843
6256
  switch (name) {
5844
6257
  case "$$typeof":
5845
6258
  return target.$$typeof;
@@ -5858,9 +6271,7 @@
5858
6271
  case Symbol.toStringTag:
5859
6272
  return Object.prototype[Symbol.toStringTag];
5860
6273
  case "Provider":
5861
- throw Error(
5862
- "Cannot render a Client Context Provider on the Server. Instead, you can export a Client Component wrapper that itself renders a Client Context Provider."
5863
- );
6274
+ return receiver;
5864
6275
  case "then":
5865
6276
  return;
5866
6277
  }
@@ -5954,22 +6365,22 @@
5954
6365
  },
5955
6366
  useCacheRefresh: function () {
5956
6367
  return unsupportedRefresh;
6368
+ },
6369
+ useEffectEvent: unsupportedHook
6370
+ },
6371
+ DefaultAsyncDispatcher = {
6372
+ getCacheForType: function (resourceType) {
6373
+ var cache = (cache = resolveRequest()) ? cache.cache : new Map();
6374
+ var entry = cache.get(resourceType);
6375
+ void 0 === entry &&
6376
+ ((entry = resourceType()), cache.set(resourceType, entry));
6377
+ return entry;
6378
+ },
6379
+ cacheSignal: function () {
6380
+ var request = resolveRequest();
6381
+ return request ? request.cacheController.signal : null;
5957
6382
  }
5958
6383
  };
5959
- HooksDispatcher.useEffectEvent = unsupportedHook;
5960
- var DefaultAsyncDispatcher = {
5961
- getCacheForType: function (resourceType) {
5962
- var cache = (cache = resolveRequest()) ? cache.cache : new Map();
5963
- var entry = cache.get(resourceType);
5964
- void 0 === entry &&
5965
- ((entry = resourceType()), cache.set(resourceType, entry));
5966
- return entry;
5967
- },
5968
- cacheSignal: function () {
5969
- var request = resolveRequest();
5970
- return request ? request.cacheController.signal : null;
5971
- }
5972
- };
5973
6384
  DefaultAsyncDispatcher.getOwner = resolveOwner;
5974
6385
  var ReactSharedInternalsServer =
5975
6386
  React.__SERVER_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
@@ -6086,67 +6497,76 @@
6086
6497
  previous: null
6087
6498
  });
6088
6499
  else if (
6089
- "Microtask" !== type &&
6090
- "TickObject" !== type &&
6091
- "Immediate" !== type
6092
- )
6093
- if (void 0 === trigger)
6094
- (trigger = resolveOwner()),
6095
- (trigger = {
6096
- tag: 0,
6097
- owner: trigger,
6098
- stack:
6099
- null === trigger
6100
- ? parseStackTracePrivate(Error(), 3)
6101
- : null,
6102
- start: performance.now(),
6103
- end: -1.1,
6104
- promise: null,
6105
- awaited: null,
6106
- previous: null
6107
- });
6108
- else {
6109
- if (2 === trigger.tag || 4 === trigger.tag)
6110
- (resource = resolveOwner()),
6111
- (trigger = {
6112
- tag: 0,
6113
- owner: resource,
6114
- stack:
6115
- null === resource
6116
- ? parseStackTracePrivate(Error(), 3)
6117
- : null,
6118
- start: performance.now(),
6119
- end: -1.1,
6120
- promise: null,
6121
- awaited: null,
6122
- previous: trigger
6123
- });
6124
- }
6125
- else if (void 0 === trigger) return;
6500
+ "bound-anonymous-fn" === type ||
6501
+ "Microtask" === type ||
6502
+ "TickObject" === type ||
6503
+ "Immediate" === type
6504
+ ) {
6505
+ if (void 0 === trigger) return;
6506
+ } else if (void 0 === trigger)
6507
+ (trigger = resolveOwner()),
6508
+ (trigger = {
6509
+ tag: 0,
6510
+ owner: trigger,
6511
+ stack:
6512
+ null === trigger
6513
+ ? parseStackTracePrivate(Error(), 3)
6514
+ : null,
6515
+ start: performance.now(),
6516
+ end: -1.1,
6517
+ promise: null,
6518
+ awaited: null,
6519
+ previous: null
6520
+ });
6521
+ else if (2 === trigger.tag || 4 === trigger.tag)
6522
+ (resource = resolveOwner()),
6523
+ (trigger = {
6524
+ tag: 0,
6525
+ owner: resource,
6526
+ stack:
6527
+ null === resource
6528
+ ? parseStackTracePrivate(Error(), 3)
6529
+ : null,
6530
+ start: performance.now(),
6531
+ end: -1.1,
6532
+ promise: null,
6533
+ awaited: null,
6534
+ previous: trigger
6535
+ });
6126
6536
  pendingOperations.set(asyncId, trigger);
6127
6537
  },
6128
6538
  before: function (asyncId) {
6129
- asyncId = pendingOperations.get(asyncId);
6130
- if (void 0 !== asyncId)
6131
- switch (asyncId.tag) {
6539
+ var node = pendingOperations.get(asyncId);
6540
+ if (void 0 !== node)
6541
+ switch (node.tag) {
6132
6542
  case 0:
6133
6543
  lastRanAwait = null;
6134
- asyncId.end = performance.now();
6544
+ 0 > node.end
6545
+ ? (node.end = performance.now())
6546
+ : ((node = {
6547
+ tag: 0,
6548
+ owner: node.owner,
6549
+ stack: node.stack,
6550
+ start: node.start,
6551
+ end: performance.now(),
6552
+ promise: node.promise,
6553
+ awaited: node.awaited,
6554
+ previous: node.previous
6555
+ }),
6556
+ pendingOperations.set(asyncId, node));
6135
6557
  break;
6136
6558
  case 4:
6137
6559
  lastRanAwait = resolvePromiseOrAwaitNode(
6138
- asyncId,
6560
+ node,
6139
6561
  performance.now()
6140
6562
  );
6141
6563
  break;
6142
6564
  case 2:
6143
- lastRanAwait = asyncId;
6565
+ lastRanAwait = node;
6144
6566
  break;
6145
6567
  case 3:
6146
- resolvePromiseOrAwaitNode(
6147
- asyncId,
6148
- performance.now()
6149
- ).previous = lastRanAwait;
6568
+ resolvePromiseOrAwaitNode(node, performance.now()).previous =
6569
+ lastRanAwait;
6150
6570
  lastRanAwait = null;
6151
6571
  break;
6152
6572
  default:
@@ -6214,14 +6634,28 @@
6214
6634
  patchConsole(console, "warn"));
6215
6635
  var ObjectPrototype$1 = Object.prototype,
6216
6636
  stringify = JSON.stringify,
6637
+ PENDING$1 = 0,
6638
+ COMPLETED = 1,
6639
+ ABORTED = 3,
6640
+ ERRORED$1 = 4,
6641
+ RENDERING = 5,
6642
+ __PROTO__$1 = "__proto__",
6643
+ OPENING = 10,
6217
6644
  ABORTING = 12,
6645
+ CLOSING = 13,
6218
6646
  CLOSED = 14,
6219
- defaultPostponeHandler = noop,
6647
+ PRERENDER = 21,
6648
+ NEXT_TWO_CHUNKS_ARE_ATOMIC = Symbol(),
6220
6649
  currentRequest = null,
6221
6650
  canEmitDebugInfo = !1,
6222
6651
  serializedSize = 0,
6223
6652
  MAX_ROW_SIZE = 3200,
6653
+ MIN_DEDUPLICATED_IMPORT_STRING_LENGTH = 16,
6654
+ MAX_DEDUPLICATED_IMPORT_STRINGS_SIZE = 32768,
6224
6655
  modelRoot = !1,
6656
+ importStringRequest = null,
6657
+ MAX_IMPORT_METADATA_DEPTH = 16,
6658
+ NOT_PLAIN_IMPORT_METADATA = {},
6225
6659
  CONSTRUCTOR_MARKER = Symbol(),
6226
6660
  debugModelRoot = null,
6227
6661
  debugNoOutline = null,
@@ -6230,52 +6664,57 @@
6230
6664
  chunkCache = new Map(),
6231
6665
  RESPONSE_SYMBOL = Symbol();
6232
6666
  ReactPromise.prototype = Object.create(Promise.prototype);
6233
- ReactPromise.prototype.then = function (resolve, reject) {
6234
- switch (this.status) {
6235
- case "resolved_model":
6236
- initializeModelChunk(this);
6237
- }
6238
- switch (this.status) {
6239
- case "fulfilled":
6240
- if ("function" === typeof resolve) {
6241
- for (
6242
- var inspectedValue = this.value,
6243
- cycleProtection = 0,
6244
- visited = new Set();
6245
- inspectedValue instanceof ReactPromise;
6667
+ Object.defineProperty(ReactPromise.prototype, "then", {
6668
+ writable: !0,
6669
+ enumerable: !0,
6670
+ configurable: !0,
6671
+ value: function (resolve, reject) {
6672
+ switch (this.status) {
6673
+ case "resolved_model":
6674
+ initializeModelChunk(this);
6675
+ }
6676
+ switch (this.status) {
6677
+ case "fulfilled":
6678
+ if ("function" === typeof resolve) {
6679
+ for (
6680
+ var inspectedValue = this.value,
6681
+ cycleProtection = 0,
6682
+ visited = new Set();
6683
+ inspectedValue instanceof ReactPromise;
6246
6684
 
6247
- ) {
6248
- cycleProtection++;
6249
- if (
6250
- inspectedValue === this ||
6251
- visited.has(inspectedValue) ||
6252
- 1e3 < cycleProtection
6253
6685
  ) {
6254
- "function" === typeof reject &&
6255
- reject(Error("Cannot have cyclic thenables."));
6256
- return;
6686
+ cycleProtection++;
6687
+ if (
6688
+ inspectedValue === this ||
6689
+ visited.has(inspectedValue) ||
6690
+ 1e3 < cycleProtection
6691
+ ) {
6692
+ "function" === typeof reject &&
6693
+ reject(Error("Cannot have cyclic thenables."));
6694
+ return;
6695
+ }
6696
+ visited.add(inspectedValue);
6697
+ if ("fulfilled" === inspectedValue.status)
6698
+ inspectedValue = inspectedValue.value;
6699
+ else break;
6257
6700
  }
6258
- visited.add(inspectedValue);
6259
- if ("fulfilled" === inspectedValue.status)
6260
- inspectedValue = inspectedValue.value;
6261
- else break;
6701
+ resolve(this.value);
6262
6702
  }
6263
- resolve(this.value);
6264
- }
6265
- break;
6266
- case "pending":
6267
- case "blocked":
6268
- "function" === typeof resolve &&
6269
- (null === this.value && (this.value = []),
6270
- this.value.push(resolve));
6271
- "function" === typeof reject &&
6272
- (null === this.reason && (this.reason = []),
6273
- this.reason.push(reject));
6274
- break;
6275
- default:
6276
- "function" === typeof reject && reject(this.reason);
6703
+ break;
6704
+ case "pending":
6705
+ case "blocked":
6706
+ "function" === typeof resolve &&
6707
+ (null === this.value && (this.value = []),
6708
+ this.value.push(resolve));
6709
+ "function" === typeof reject &&
6710
+ (null === this.reason && (this.reason = []),
6711
+ this.reason.push(reject));
6712
+ break;
6713
+ default:
6714
+ "function" === typeof reject && reject(this.reason);
6715
+ }
6277
6716
  }
6278
- };
6717
+ });
6279
6718
  var ObjectPrototype = Object.prototype,
6280
6719
  ArrayPrototype = Array.prototype,
6281
6720
  initializingHandler = null;
@@ -6529,23 +6968,13 @@
6529
6968
  reject,
6530
6969
  options ? options.onError : void 0,
6531
6970
  options ? options.identifierPrefix : void 0,
6532
- options ? options.onPostpone : void 0,
6533
6971
  options ? options.temporaryReferences : void 0,
6972
+ options ? options.startTime : void 0,
6534
6973
  options ? options.environmentName : void 0,
6535
6974
  options ? options.filterStackFrame : void 0,
6536
6975
  !1
6537
6976
  );
6538
- if (options && options.signal) {
6539
- var signal = options.signal;
6540
- if (signal.aborted) abort(request, signal.reason);
6541
- else {
6542
- var listener = function () {
6543
- abort(request, signal.reason);
6544
- signal.removeEventListener("abort", listener);
6545
- };
6546
- signal.addEventListener("abort", listener);
6547
- }
6548
- }
6977
+ options && options.signal && attachAbortSignal(request, options.signal);
6549
6978
  startWork(request);
6550
6979
  });
6551
6980
  };
@@ -6566,23 +6995,13 @@
6566
6995
  reject,
6567
6996
  options ? options.onError : void 0,
6568
6997
  options ? options.identifierPrefix : void 0,
6569
- options ? options.onPostpone : void 0,
6570
6998
  options ? options.temporaryReferences : void 0,
6999
+ options ? options.startTime : void 0,
6571
7000
  options ? options.environmentName : void 0,
6572
7001
  options ? options.filterStackFrame : void 0,
6573
7002
  !1
6574
7003
  );
6575
- if (options && options.signal) {
6576
- var signal = options.signal;
6577
- if (signal.aborted) abort(request, signal.reason);
6578
- else {
6579
- var listener = function () {
6580
- abort(request, signal.reason);
6581
- signal.removeEventListener("abort", listener);
6582
- };
6583
- signal.addEventListener("abort", listener);
6584
- }
6585
- }
7004
+ options && options.signal && attachAbortSignal(request, options.signal);
6586
7005
  startWork(request);
6587
7006
  });
6588
7007
  };
@@ -6631,8 +7050,8 @@
6631
7050
  webpackMap,
6632
7051
  options ? options.onError : void 0,
6633
7052
  options ? options.identifierPrefix : void 0,
6634
- options ? options.onPostpone : void 0,
6635
7053
  options ? options.temporaryReferences : void 0,
7054
+ options ? options.startTime : void 0,
6636
7055
  options ? options.environmentName : void 0,
6637
7056
  options ? options.filterStackFrame : void 0,
6638
7057
  void 0 !== debugChannelReadable
@@ -6687,23 +7106,13 @@
6687
7106
  webpackMap,
6688
7107
  options ? options.onError : void 0,
6689
7108
  options ? options.identifierPrefix : void 0,
6690
- options ? options.onPostpone : void 0,
6691
7109
  options ? options.temporaryReferences : void 0,
7110
+ options ? options.startTime : void 0,
6692
7111
  options ? options.environmentName : void 0,
6693
7112
  options ? options.filterStackFrame : void 0,
6694
7113
  void 0 !== debugChannelReadable
6695
7114
  );
6696
- if (options && options.signal) {
6697
- var signal = options.signal;
6698
- if (signal.aborted) abort(request, signal.reason);
6699
- else {
6700
- var listener = function () {
6701
- abort(request, signal.reason);
6702
- signal.removeEventListener("abort", listener);
6703
- };
6704
- signal.addEventListener("abort", listener);
6705
- }
6706
- }
7115
+ options && options.signal && attachAbortSignal(request, options.signal);
6707
7116
  if (void 0 !== debugChannelWritable) {
6708
7117
  var debugWritable;
6709
7118
  new ReadableStream(