@vitejs/plugin-rsc 0.4.33 → 0.5.0

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 (93) hide show
  1. package/README.md +4 -0
  2. package/dist/{browser-CQv7Z3J4.d.ts → browser-STIFJSFF.d.ts} +1 -1
  3. package/dist/browser.d.ts +3 -3
  4. package/dist/browser.js +19 -1
  5. package/dist/{cjs-BamOAUgw.js → cjs-C5-IrxV9.js} +1 -1
  6. package/dist/core/browser.d.ts +1 -1
  7. package/dist/core/plugin.js +1 -1
  8. package/dist/core/rsc.d.ts +2 -2
  9. package/dist/core/rsc.js +1 -1
  10. package/dist/core/ssr.d.ts +2 -2
  11. package/dist/core/ssr.js +1 -1
  12. package/dist/{encryption-runtime-DT6dtlC5.js → encryption-runtime-FhNKiASK.js} +2 -2
  13. package/dist/index.d.ts +2 -2
  14. package/dist/index.js +7 -7
  15. package/dist/{plugin-BDLEZ1UW.js → plugin-CrduXSyi.js} +35 -24
  16. package/dist/{plugin-DCLI7Wh8.d.ts → plugin-DGhnAIi6.d.ts} +1 -5
  17. package/dist/plugin.d.ts +2 -2
  18. package/dist/plugin.js +7 -7
  19. package/dist/plugins/cjs.js +2 -2
  20. package/dist/react/browser.d.ts +3 -3
  21. package/dist/react/rsc.d.ts +3 -3
  22. package/dist/react/rsc.js +2 -2
  23. package/dist/react/ssr.d.ts +3 -3
  24. package/dist/react/ssr.js +2 -2
  25. package/dist/{rsc-3bkzqdsJ.d.ts → rsc-Cg31p8XR.d.ts} +1 -1
  26. package/dist/{rsc-BdCB3621.js → rsc-DdBcg-Lb.js} +1 -1
  27. package/dist/rsc.d.ts +4 -4
  28. package/dist/rsc.js +22 -5
  29. package/dist/{ssr-CMjeQ9AS.d.ts → ssr-00tY_Tdf.d.ts} +1 -1
  30. package/dist/{ssr-Cd4SbAaO.js → ssr-CE8X2HyS.js} +1 -1
  31. package/dist/ssr.d.ts +3 -3
  32. package/dist/ssr.js +52 -4
  33. package/dist/transforms/index.d.ts +1 -1
  34. package/dist/transforms/index.js +1 -1
  35. package/dist/utils/encryption-runtime.d.ts +1 -1
  36. package/dist/utils/encryption-runtime.js +4 -4
  37. package/dist/utils/rpc.js +1 -1
  38. package/dist/vendor/react-server-dom/cjs/react-server-dom-webpack-client.browser.development.js +2964 -774
  39. package/dist/vendor/react-server-dom/cjs/react-server-dom-webpack-client.browser.production.js +554 -312
  40. package/dist/vendor/react-server-dom/cjs/react-server-dom-webpack-client.edge.development.js +2721 -724
  41. package/dist/vendor/react-server-dom/cjs/react-server-dom-webpack-client.edge.production.js +541 -300
  42. package/dist/vendor/react-server-dom/cjs/react-server-dom-webpack-client.node.development.js +2955 -858
  43. package/dist/vendor/react-server-dom/cjs/react-server-dom-webpack-client.node.production.js +652 -332
  44. package/dist/vendor/react-server-dom/cjs/react-server-dom-webpack-client.node.unbundled.development.js +2956 -861
  45. package/dist/vendor/react-server-dom/cjs/react-server-dom-webpack-client.node.unbundled.production.js +652 -332
  46. package/dist/vendor/react-server-dom/cjs/react-server-dom-webpack-plugin.js +6 -2
  47. package/dist/vendor/react-server-dom/cjs/react-server-dom-webpack-server.browser.development.js +1931 -713
  48. package/dist/vendor/react-server-dom/cjs/react-server-dom-webpack-server.browser.production.js +544 -295
  49. package/dist/vendor/react-server-dom/cjs/react-server-dom-webpack-server.edge.development.js +1926 -715
  50. package/dist/vendor/react-server-dom/cjs/react-server-dom-webpack-server.edge.production.js +542 -299
  51. package/dist/vendor/react-server-dom/cjs/react-server-dom-webpack-server.node.development.js +2719 -743
  52. package/dist/vendor/react-server-dom/cjs/react-server-dom-webpack-server.node.production.js +725 -338
  53. package/dist/vendor/react-server-dom/cjs/react-server-dom-webpack-server.node.unbundled.development.js +2703 -727
  54. package/dist/vendor/react-server-dom/cjs/react-server-dom-webpack-server.node.unbundled.production.js +725 -338
  55. package/dist/vendor/react-server-dom/package.json +3 -3
  56. package/dist/vendor/react-server-dom/server.node.js +3 -1
  57. package/dist/vendor/react-server-dom/server.node.unbundled.js +3 -1
  58. package/dist/vendor/react-server-dom/static.browser.js +1 -3
  59. package/dist/vendor/react-server-dom/static.edge.js +1 -3
  60. package/dist/vendor/react-server-dom/static.node.js +2 -3
  61. package/dist/vendor/react-server-dom/static.node.unbundled.js +1 -3
  62. package/package.json +12 -7
  63. package/types/index.d.ts +0 -4
  64. package/dist/browser--ZREVnM9.js +0 -22
  65. package/dist/client-C7Eok9hc.js +0 -23
  66. package/dist/extra/browser.d.ts +0 -14
  67. package/dist/extra/browser.js +0 -88
  68. package/dist/extra/rsc.d.ts +0 -2
  69. package/dist/extra/rsc.js +0 -56
  70. package/dist/extra/ssr.d.ts +0 -14
  71. package/dist/extra/ssr.js +0 -37
  72. package/dist/rsc-CiAoLCx8.js +0 -21
  73. package/dist/rsc-c22DF1A7.d.ts +0 -16
  74. package/dist/rsc-html-stream/browser.d.ts +0 -5
  75. package/dist/rsc-html-stream/browser.js +0 -8
  76. package/dist/rsc-html-stream/ssr.d.ts +0 -7
  77. package/dist/rsc-html-stream/ssr.js +0 -8
  78. package/dist/server-DMhFuTz_.js +0 -72
  79. package/dist/ssr-BQwZitKq.js +0 -53
  80. package/types/virtual.d.ts +0 -5
  81. /package/dist/{browser-DwWQeoll.d.ts → browser-CXHICuDc.d.ts} +0 -0
  82. /package/dist/{encryption-runtime-B8xcnJoN.d.ts → encryption-runtime-DwihLkYv.d.ts} +0 -0
  83. /package/dist/{encryption-utils-BDwwcMVT.js → encryption-utils-CoE0gWjC.js} +0 -0
  84. /package/dist/{index-B04iFwO5.d.ts → index-DYBWAuKP.d.ts} +0 -0
  85. /package/dist/{index-CPkExgij.d.ts → index-kBz3NvVt.d.ts} +0 -0
  86. /package/dist/{plugin-CZbI4rhS.js → plugin-BwI7mYXI.js} +0 -0
  87. /package/dist/{rpc-CUvSZurk.js → rpc-D7cb_Wd5.js} +0 -0
  88. /package/dist/{rsc-JJjz3Z0i.d.ts → rsc-Fgmk6j0z.d.ts} +0 -0
  89. /package/dist/{rsc-GFzFWyhT.js → rsc-cp4EenMG.js} +0 -0
  90. /package/dist/{shared-n-ykEs15.js → shared-CceFFukJ.js} +0 -0
  91. /package/dist/{ssr-BrSGyrxe.d.ts → ssr-BnYZ8xo9.d.ts} +0 -0
  92. /package/dist/{ssr-Cm2FP2zD.js → ssr-C468YlFl.js} +0 -0
  93. /package/dist/{transforms-CpF3zNE0.js → transforms-wFF-pWF7.js} +0 -0
@@ -12,6 +12,14 @@
12
12
  "production" !== process.env.NODE_ENV &&
13
13
  (function () {
14
14
  function voidHandler() {}
15
+ function getIteratorFn(maybeIterable) {
16
+ if (null === maybeIterable || "object" !== typeof maybeIterable)
17
+ return null;
18
+ maybeIterable =
19
+ (MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL]) ||
20
+ maybeIterable["@@iterator"];
21
+ return "function" === typeof maybeIterable ? maybeIterable : null;
22
+ }
15
23
  function _defineProperty(obj, key, value) {
16
24
  a: if ("object" == typeof key && key) {
17
25
  var e = key[Symbol.toPrimitive];
@@ -33,6 +41,9 @@
33
41
  : (obj[key] = value);
34
42
  return obj;
35
43
  }
44
+ function flushBuffered(destination) {
45
+ "function" === typeof destination.flush && destination.flush();
46
+ }
36
47
  function writeToDestination(destination, view) {
37
48
  destination = destination.write(view);
38
49
  destinationHasCapacity = destinationHasCapacity && destination;
@@ -99,6 +110,14 @@
99
110
  (writtenBytes = 0))));
100
111
  return destinationHasCapacity;
101
112
  }
113
+ function completeWriting(destination) {
114
+ currentView &&
115
+ 0 < writtenBytes &&
116
+ destination.write(currentView.subarray(0, writtenBytes));
117
+ currentView = null;
118
+ writtenBytes = 0;
119
+ destinationHasCapacity = !0;
120
+ }
102
121
  function byteLengthOfChunk(chunk) {
103
122
  return "string" === typeof chunk
104
123
  ? Buffer.byteLength(chunk, "utf8")
@@ -147,6 +166,8 @@
147
166
  return target.name;
148
167
  case "defaultProps":
149
168
  return;
169
+ case "_debugInfo":
170
+ return;
150
171
  case "toJSON":
151
172
  return;
152
173
  case Symbol.toPrimitive:
@@ -210,6 +231,73 @@
210
231
  new Proxy(clientReference, deepProxyHandlers)));
211
232
  return clientReference;
212
233
  }
234
+ function resolveClientReferenceMetadata(config, clientReference) {
235
+ var modulePath = clientReference.$$id,
236
+ name = "",
237
+ resolvedModuleData = config[modulePath];
238
+ if (resolvedModuleData) name = resolvedModuleData.name;
239
+ else {
240
+ var idx = modulePath.lastIndexOf("#");
241
+ -1 !== idx &&
242
+ ((name = modulePath.slice(idx + 1)),
243
+ (resolvedModuleData = config[modulePath.slice(0, idx)]));
244
+ if (!resolvedModuleData)
245
+ throw Error(
246
+ 'Could not find the module "' +
247
+ modulePath +
248
+ '" in the React Client Manifest. This is probably a bug in the React Server Components bundler.'
249
+ );
250
+ }
251
+ if (!0 === resolvedModuleData.async && !0 === clientReference.$$async)
252
+ throw Error(
253
+ 'The module "' +
254
+ modulePath +
255
+ '" is marked as an async ESM module but was loaded as a CJS proxy. This is probably a bug in the React Server Components bundler.'
256
+ );
257
+ return !0 === resolvedModuleData.async || !0 === clientReference.$$async
258
+ ? [resolvedModuleData.id, resolvedModuleData.chunks, name, 1]
259
+ : [resolvedModuleData.id, resolvedModuleData.chunks, name];
260
+ }
261
+ function preload(href, as, options) {
262
+ if ("string" === typeof href) {
263
+ var request = resolveRequest();
264
+ if (request) {
265
+ var hints = request.hints,
266
+ key = "L";
267
+ if ("image" === as && options) {
268
+ var imageSrcSet = options.imageSrcSet,
269
+ imageSizes = options.imageSizes,
270
+ uniquePart = "";
271
+ "string" === typeof imageSrcSet && "" !== imageSrcSet
272
+ ? ((uniquePart += "[" + imageSrcSet + "]"),
273
+ "string" === typeof imageSizes &&
274
+ (uniquePart += "[" + imageSizes + "]"))
275
+ : (uniquePart += "[][]" + href);
276
+ key += "[image]" + uniquePart;
277
+ } else key += "[" + as + "]" + href;
278
+ hints.has(key) ||
279
+ (hints.add(key),
280
+ (options = trimOptions(options))
281
+ ? emitHint(request, "L", [href, as, options])
282
+ : emitHint(request, "L", [href, as]));
283
+ } else previousDispatcher.L(href, as, options);
284
+ }
285
+ }
286
+ function preloadModule$1(href, options) {
287
+ if ("string" === typeof href) {
288
+ var request = resolveRequest();
289
+ if (request) {
290
+ var hints = request.hints,
291
+ key = "m|" + href;
292
+ if (hints.has(key)) return;
293
+ hints.add(key);
294
+ return (options = trimOptions(options))
295
+ ? emitHint(request, "m", [href, options])
296
+ : emitHint(request, "m", href);
297
+ }
298
+ previousDispatcher.m(href, options);
299
+ }
300
+ }
213
301
  function trimOptions(options) {
214
302
  if (null == options) return null;
215
303
  var hasProperties = !1,
@@ -220,44 +308,257 @@
220
308
  ((hasProperties = !0), (trimmed[key] = options[key]));
221
309
  return hasProperties ? trimmed : null;
222
310
  }
223
- function prepareStackTrace(error, structuredStackTrace) {
311
+ function getChildFormatContext(parentContext, type, props) {
312
+ switch (type) {
313
+ case "img":
314
+ type = props.src;
315
+ var srcSet = props.srcSet;
316
+ if (
317
+ !(
318
+ "lazy" === props.loading ||
319
+ (!type && !srcSet) ||
320
+ ("string" !== typeof type && null != type) ||
321
+ ("string" !== typeof srcSet && null != srcSet) ||
322
+ "low" === props.fetchPriority ||
323
+ parentContext & 3
324
+ ) &&
325
+ ("string" !== typeof type ||
326
+ ":" !== type[4] ||
327
+ ("d" !== type[0] && "D" !== type[0]) ||
328
+ ("a" !== type[1] && "A" !== type[1]) ||
329
+ ("t" !== type[2] && "T" !== type[2]) ||
330
+ ("a" !== type[3] && "A" !== type[3])) &&
331
+ ("string" !== typeof srcSet ||
332
+ ":" !== srcSet[4] ||
333
+ ("d" !== srcSet[0] && "D" !== srcSet[0]) ||
334
+ ("a" !== srcSet[1] && "A" !== srcSet[1]) ||
335
+ ("t" !== srcSet[2] && "T" !== srcSet[2]) ||
336
+ ("a" !== srcSet[3] && "A" !== srcSet[3]))
337
+ ) {
338
+ var sizes = "string" === typeof props.sizes ? props.sizes : void 0;
339
+ var input = props.crossOrigin;
340
+ preload(type || "", "image", {
341
+ imageSrcSet: srcSet,
342
+ imageSizes: sizes,
343
+ crossOrigin:
344
+ "string" === typeof input
345
+ ? "use-credentials" === input
346
+ ? input
347
+ : ""
348
+ : void 0,
349
+ integrity: props.integrity,
350
+ type: props.type,
351
+ fetchPriority: props.fetchPriority,
352
+ referrerPolicy: props.referrerPolicy
353
+ });
354
+ }
355
+ return parentContext;
356
+ case "link":
357
+ type = props.rel;
358
+ srcSet = props.href;
359
+ if (
360
+ !(
361
+ parentContext & 1 ||
362
+ null != props.itemProp ||
363
+ "string" !== typeof type ||
364
+ "string" !== typeof srcSet ||
365
+ "" === srcSet
366
+ )
367
+ )
368
+ switch (type) {
369
+ case "preload":
370
+ preload(srcSet, props.as, {
371
+ crossOrigin: props.crossOrigin,
372
+ integrity: props.integrity,
373
+ nonce: props.nonce,
374
+ type: props.type,
375
+ fetchPriority: props.fetchPriority,
376
+ referrerPolicy: props.referrerPolicy,
377
+ imageSrcSet: props.imageSrcSet,
378
+ imageSizes: props.imageSizes,
379
+ media: props.media
380
+ });
381
+ break;
382
+ case "modulepreload":
383
+ preloadModule$1(srcSet, {
384
+ as: props.as,
385
+ crossOrigin: props.crossOrigin,
386
+ integrity: props.integrity,
387
+ nonce: props.nonce
388
+ });
389
+ break;
390
+ case "stylesheet":
391
+ preload(srcSet, "stylesheet", {
392
+ crossOrigin: props.crossOrigin,
393
+ integrity: props.integrity,
394
+ nonce: props.nonce,
395
+ type: props.type,
396
+ fetchPriority: props.fetchPriority,
397
+ referrerPolicy: props.referrerPolicy,
398
+ media: props.media
399
+ });
400
+ }
401
+ return parentContext;
402
+ case "picture":
403
+ return parentContext | 2;
404
+ case "noscript":
405
+ return parentContext | 1;
406
+ default:
407
+ return parentContext;
408
+ }
409
+ }
410
+ function resolveOwner() {
411
+ if (currentOwner) return currentOwner;
412
+ var owner = componentStorage.getStore();
413
+ return owner ? owner : null;
414
+ }
415
+ function resolvePromiseOrAwaitNode(unresolvedNode, endTime) {
416
+ unresolvedNode.tag = 3 === unresolvedNode.tag ? 1 : 2;
417
+ unresolvedNode.end = endTime;
418
+ return unresolvedNode;
419
+ }
420
+ function getAsyncSequenceFromPromise(promise) {
421
+ try {
422
+ var asyncId = getAsyncId.call(promise);
423
+ } catch (x) {}
424
+ if (void 0 === asyncId) return null;
425
+ promise = pendingOperations.get(asyncId);
426
+ return void 0 === promise ? null : promise;
427
+ }
428
+ function collectStackTracePrivate(error, structuredStackTrace) {
429
+ error = [];
430
+ for (var i = framesToSkip; i < structuredStackTrace.length; i++) {
431
+ var callSite = structuredStackTrace[i],
432
+ name = callSite.getFunctionName() || "<anonymous>";
433
+ if (name.includes("react_stack_bottom_frame")) break;
434
+ else if (callSite.isNative())
435
+ (callSite = callSite.isAsync()),
436
+ error.push([name, "", 0, 0, 0, 0, callSite]);
437
+ else {
438
+ if (callSite.isConstructor()) name = "new " + name;
439
+ else if (!callSite.isToplevel()) {
440
+ var callSite$jscomp$0 = callSite;
441
+ name = callSite$jscomp$0.getTypeName();
442
+ var methodName = callSite$jscomp$0.getMethodName();
443
+ callSite$jscomp$0 = callSite$jscomp$0.getFunctionName();
444
+ var result = "";
445
+ callSite$jscomp$0
446
+ ? (name &&
447
+ identifierRegExp.test(callSite$jscomp$0) &&
448
+ callSite$jscomp$0 !== name &&
449
+ (result += name + "."),
450
+ (result += callSite$jscomp$0),
451
+ !methodName ||
452
+ callSite$jscomp$0 === methodName ||
453
+ callSite$jscomp$0.endsWith("." + methodName) ||
454
+ callSite$jscomp$0.endsWith(" " + methodName) ||
455
+ (result += " [as " + methodName + "]"))
456
+ : (name && (result += name + "."),
457
+ (result = methodName
458
+ ? result + methodName
459
+ : result + "<anonymous>"));
460
+ name = result;
461
+ }
462
+ "<anonymous>" === name && (name = "");
463
+ methodName = callSite.getScriptNameOrSourceURL() || "<anonymous>";
464
+ "<anonymous>" === methodName &&
465
+ ((methodName = ""),
466
+ callSite.isEval() &&
467
+ (callSite$jscomp$0 = callSite.getEvalOrigin()) &&
468
+ (methodName = callSite$jscomp$0.toString() + ", <anonymous>"));
469
+ callSite$jscomp$0 = callSite.getLineNumber() || 0;
470
+ result = callSite.getColumnNumber() || 0;
471
+ var enclosingLine =
472
+ "function" === typeof callSite.getEnclosingLineNumber
473
+ ? callSite.getEnclosingLineNumber() || 0
474
+ : 0,
475
+ enclosingCol =
476
+ "function" === typeof callSite.getEnclosingColumnNumber
477
+ ? callSite.getEnclosingColumnNumber() || 0
478
+ : 0;
479
+ callSite = callSite.isAsync();
480
+ error.push([
481
+ name,
482
+ methodName,
483
+ callSite$jscomp$0,
484
+ result,
485
+ enclosingLine,
486
+ enclosingCol,
487
+ callSite
488
+ ]);
489
+ }
490
+ }
491
+ collectedStackTrace = error;
492
+ return "";
493
+ }
494
+ function collectStackTrace(error, structuredStackTrace) {
495
+ collectStackTracePrivate(error, structuredStackTrace);
224
496
  error = (error.name || "Error") + ": " + (error.message || "");
225
497
  for (var i = 0; i < structuredStackTrace.length; i++)
226
498
  error += "\n at " + structuredStackTrace[i].toString();
227
499
  return error;
228
500
  }
501
+ function parseStackTracePrivate(error, skipFrames) {
502
+ collectedStackTrace = null;
503
+ framesToSkip = skipFrames;
504
+ skipFrames = Error.prepareStackTrace;
505
+ Error.prepareStackTrace = collectStackTracePrivate;
506
+ try {
507
+ if ("" !== error.stack) return null;
508
+ } finally {
509
+ Error.prepareStackTrace = skipFrames;
510
+ }
511
+ return collectedStackTrace;
512
+ }
229
513
  function parseStackTrace(error, skipFrames) {
230
- a: {
231
- var previousPrepare = Error.prepareStackTrace;
232
- Error.prepareStackTrace = prepareStackTrace;
233
- try {
234
- var stack = String(error.stack);
235
- break a;
236
- } finally {
237
- Error.prepareStackTrace = previousPrepare;
238
- }
239
- stack = void 0;
514
+ var existing = stackTraceCache.get(error);
515
+ if (void 0 !== existing) return existing;
516
+ collectedStackTrace = null;
517
+ framesToSkip = skipFrames;
518
+ existing = Error.prepareStackTrace;
519
+ Error.prepareStackTrace = collectStackTrace;
520
+ try {
521
+ var stack = String(error.stack);
522
+ } finally {
523
+ Error.prepareStackTrace = existing;
240
524
  }
525
+ if (null !== collectedStackTrace)
526
+ return (
527
+ (stack = collectedStackTrace),
528
+ (collectedStackTrace = null),
529
+ stackTraceCache.set(error, stack),
530
+ stack
531
+ );
241
532
  stack.startsWith("Error: react-stack-top-frame\n") &&
242
533
  (stack = stack.slice(29));
243
- error = stack.indexOf("react_stack_bottom_frame");
244
- -1 !== error && (error = stack.lastIndexOf("\n", error));
245
- -1 !== error && (stack = stack.slice(0, error));
534
+ existing = stack.indexOf("react_stack_bottom_frame");
535
+ -1 !== existing && (existing = stack.lastIndexOf("\n", existing));
536
+ -1 !== existing && (stack = stack.slice(0, existing));
246
537
  stack = stack.split("\n");
247
- for (error = []; skipFrames < stack.length; skipFrames++)
248
- if ((previousPrepare = frameRegExp.exec(stack[skipFrames]))) {
249
- var name = previousPrepare[1] || "";
250
- "<anonymous>" === name && (name = "");
251
- var filename = previousPrepare[2] || previousPrepare[5] || "";
538
+ for (existing = []; skipFrames < stack.length; skipFrames++) {
539
+ var parsed = frameRegExp.exec(stack[skipFrames]);
540
+ if (parsed) {
541
+ var name = parsed[1] || "",
542
+ isAsync = "async " === parsed[8];
543
+ "<anonymous>" === name
544
+ ? (name = "")
545
+ : name.startsWith("async ") &&
546
+ ((name = name.slice(5)), (isAsync = !0));
547
+ var filename = parsed[2] || parsed[5] || "";
252
548
  "<anonymous>" === filename && (filename = "");
253
- error.push([
549
+ existing.push([
254
550
  name,
255
551
  filename,
256
- +(previousPrepare[3] || previousPrepare[6]),
257
- +(previousPrepare[4] || previousPrepare[7])
552
+ +(parsed[3] || parsed[6]),
553
+ +(parsed[4] || parsed[7]),
554
+ 0,
555
+ 0,
556
+ isAsync
258
557
  ]);
259
558
  }
260
- return error;
559
+ }
560
+ stackTraceCache.set(error, existing);
561
+ return existing;
261
562
  }
262
563
  function createTemporaryReference(temporaryReferences, id) {
263
564
  var reference = Object.defineProperties(
@@ -272,21 +573,13 @@
272
573
  temporaryReferences.set(reference, id);
273
574
  return reference;
274
575
  }
275
- function getIteratorFn(maybeIterable) {
276
- if (null === maybeIterable || "object" !== typeof maybeIterable)
277
- return null;
278
- maybeIterable =
279
- (MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL]) ||
280
- maybeIterable["@@iterator"];
281
- return "function" === typeof maybeIterable ? maybeIterable : null;
282
- }
283
- function noop$1() {}
576
+ function noop() {}
284
577
  function trackUsedThenable(thenableState, thenable, index) {
285
578
  index = thenableState[index];
286
579
  void 0 === index
287
- ? thenableState.push(thenable)
288
- : index !== thenable &&
289
- (thenable.then(noop$1, noop$1), (thenable = index));
580
+ ? (thenableState.push(thenable),
581
+ (thenableState._stacks || (thenableState._stacks = [])).push(Error()))
582
+ : index !== thenable && (thenable.then(noop, noop), (thenable = index));
290
583
  switch (thenable.status) {
291
584
  case "fulfilled":
292
585
  return thenable.value;
@@ -294,7 +587,7 @@
294
587
  throw thenable.reason;
295
588
  default:
296
589
  "string" === typeof thenable.status
297
- ? thenable.then(noop$1, noop$1)
590
+ ? thenable.then(noop, noop)
298
591
  : ((thenableState = thenable),
299
592
  (thenableState.status = "pending"),
300
593
  thenableState.then(
@@ -349,10 +642,11 @@
349
642
  function unsupportedContext() {
350
643
  throw Error("Cannot read a Client Context from a Server Component.");
351
644
  }
352
- function resolveOwner() {
353
- if (currentOwner) return currentOwner;
354
- var owner = componentStorage.getStore();
355
- return owner ? owner : null;
645
+ function prepareStackTrace(error, structuredStackTrace) {
646
+ error = (error.name || "Error") + ": " + (error.message || "");
647
+ for (var i = 0; i < structuredStackTrace.length; i++)
648
+ error += "\n at " + structuredStackTrace[i].toString();
649
+ return error;
356
650
  }
357
651
  function resetOwnerStackLimit() {
358
652
  var now = getCurrentTime();
@@ -370,6 +664,13 @@
370
664
  if (!(object[i] in ObjectPrototype)) return !1;
371
665
  return !0;
372
666
  }
667
+ function isGetter(object, name) {
668
+ if (object === Object.prototype || null === object) return !1;
669
+ var descriptor = Object.getOwnPropertyDescriptor(object, name);
670
+ return void 0 === descriptor
671
+ ? isGetter(getPrototypeOf(object), name)
672
+ : "function" === typeof descriptor.get;
673
+ }
373
674
  function isSimpleObject(object) {
374
675
  if (!isObjectPrototype(getPrototypeOf(object))) return !1;
375
676
  for (
@@ -389,11 +690,8 @@
389
690
  return !0;
390
691
  }
391
692
  function objectName(object) {
392
- return Object.prototype.toString
393
- .call(object)
394
- .replace(/^\[object (.*)\]$/, function (m, p0) {
395
- return p0;
396
- });
693
+ object = Object.prototype.toString.call(object);
694
+ return object.slice(8, object.length - 1);
397
695
  }
398
696
  function describeKeyForErrorMessage(key) {
399
697
  var encodedKey = JSON.stringify(key);
@@ -557,24 +855,95 @@
557
855
  !filename.includes("node_modules")
558
856
  );
559
857
  }
560
- function filterStackTrace(request, error, skipFrames) {
858
+ function devirtualizeURL(url) {
859
+ if (url.startsWith("about://React/")) {
860
+ var envIdx = url.indexOf("/", 14),
861
+ suffixIdx = url.lastIndexOf("?");
862
+ if (-1 < envIdx && -1 < suffixIdx)
863
+ return decodeURI(url.slice(envIdx + 1, suffixIdx));
864
+ }
865
+ return url;
866
+ }
867
+ function isPromiseCreationInternal(url, functionName) {
868
+ if ("node:internal/async_hooks" === url) return !0;
869
+ if ("" !== url) return !1;
870
+ switch (functionName) {
871
+ case "new Promise":
872
+ case "Function.withResolvers":
873
+ case "Function.reject":
874
+ case "Function.resolve":
875
+ case "Function.all":
876
+ case "Function.allSettled":
877
+ case "Function.race":
878
+ case "Function.try":
879
+ return !0;
880
+ default:
881
+ return !1;
882
+ }
883
+ }
884
+ function filterStackTrace(request, stack) {
561
885
  request = request.filterStackFrame;
562
- error = parseStackTrace(error, skipFrames);
563
- for (skipFrames = 0; skipFrames < error.length; skipFrames++) {
564
- var callsite = error[skipFrames],
886
+ for (var filteredStack = [], i = 0; i < stack.length; i++) {
887
+ var callsite = stack[i],
565
888
  functionName = callsite[0],
566
- url = callsite[1];
567
- if (url.startsWith("rsc://React/")) {
568
- var envIdx = url.indexOf("/", 12),
569
- suffixIdx = url.lastIndexOf("?");
570
- -1 < envIdx &&
571
- -1 < suffixIdx &&
572
- (url = callsite[1] = url.slice(envIdx + 1, suffixIdx));
573
- }
574
- request(url, functionName) ||
575
- (error.splice(skipFrames, 1), skipFrames--);
889
+ url = devirtualizeURL(callsite[1]);
890
+ request(url, functionName, callsite[2], callsite[3]) &&
891
+ ((callsite = callsite.slice(0)),
892
+ (callsite[1] = url),
893
+ filteredStack.push(callsite));
894
+ }
895
+ return filteredStack;
896
+ }
897
+ function hasUnfilteredFrame(request, stack) {
898
+ request = request.filterStackFrame;
899
+ for (var i = 0; i < stack.length; i++) {
900
+ var callsite = stack[i],
901
+ functionName = callsite[0],
902
+ url = devirtualizeURL(callsite[1]),
903
+ lineNumber = callsite[2],
904
+ columnNumber = callsite[3];
905
+ if (
906
+ !callsite[6] &&
907
+ request(url, functionName, lineNumber, columnNumber)
908
+ )
909
+ return !0;
910
+ }
911
+ return !1;
912
+ }
913
+ function isPromiseAwaitInternal(url, functionName) {
914
+ if ("node:internal/async_hooks" === url) return !0;
915
+ if ("" !== url) return !1;
916
+ switch (functionName) {
917
+ case "Promise.then":
918
+ case "Promise.catch":
919
+ case "Promise.finally":
920
+ case "Function.reject":
921
+ case "Function.resolve":
922
+ case "Function.all":
923
+ case "Function.allSettled":
924
+ case "Function.race":
925
+ case "Function.try":
926
+ return !0;
927
+ default:
928
+ return !1;
576
929
  }
577
- return error;
930
+ }
931
+ function isAwaitInUserspace(request, stack) {
932
+ for (
933
+ var firstFrame = 0;
934
+ stack.length > firstFrame &&
935
+ isPromiseAwaitInternal(stack[firstFrame][1], stack[firstFrame][0]);
936
+
937
+ )
938
+ firstFrame++;
939
+ if (stack.length > firstFrame) {
940
+ request = request.filterStackFrame;
941
+ stack = stack[firstFrame];
942
+ firstFrame = stack[0];
943
+ var url = devirtualizeURL(stack[1]);
944
+ return request(url, firstFrame, stack[2], stack[3]);
945
+ }
946
+ return !1;
578
947
  }
579
948
  function patchConsole(consoleInst, methodName) {
580
949
  var descriptor = Object.getOwnPropertyDescriptor(consoleInst, methodName);
@@ -590,12 +959,55 @@
590
959
  if (("assert" !== methodName || !arguments[0]) && null !== request) {
591
960
  var stack = filterStackTrace(
592
961
  request,
593
- Error("react-stack-top-frame"),
594
- 1
962
+ parseStackTracePrivate(Error("react-stack-top-frame"), 1) || []
963
+ );
964
+ request.pendingDebugChunks++;
965
+ var owner = resolveOwner(),
966
+ args = Array.from(arguments);
967
+ a: {
968
+ var env = 0;
969
+ switch (methodName) {
970
+ case "dir":
971
+ case "dirxml":
972
+ case "groupEnd":
973
+ case "table":
974
+ env = null;
975
+ break a;
976
+ case "assert":
977
+ env = 1;
978
+ }
979
+ var format = args[env],
980
+ style = args[env + 1],
981
+ badge = args[env + 2];
982
+ "string" === typeof format &&
983
+ format.startsWith("\u001b[0m\u001b[7m%c%s\u001b[0m%c") &&
984
+ "background: #e6e6e6;background: light-dark(rgba(0,0,0,0.1), rgba(255,255,255,0.25));color: #000000;color: light-dark(#000000, #ffffff);border-radius: 2px" ===
985
+ style &&
986
+ "string" === typeof badge
987
+ ? ((format = format.slice(18)),
988
+ " " === format[0] && (format = format.slice(1)),
989
+ args.splice(env, 4, format),
990
+ (env = badge.slice(1, badge.length - 1)))
991
+ : (env = null);
992
+ }
993
+ null === env && (env = (0, request.environmentName)());
994
+ null != owner && outlineComponentInfo(request, owner);
995
+ badge = [methodName, stack, owner, env];
996
+ badge.push.apply(badge, args);
997
+ args = serializeDebugModel(
998
+ request,
999
+ (null === request.deferredDebugObjects ? 500 : 10) + stack.length,
1000
+ badge
595
1001
  );
596
- request.pendingChunks++;
597
- var owner = resolveOwner();
598
- emitConsoleChunk(request, methodName, owner, stack, arguments);
1002
+ "[" !== args[0] &&
1003
+ (args = serializeDebugModel(request, 10 + stack.length, [
1004
+ methodName,
1005
+ stack,
1006
+ owner,
1007
+ env,
1008
+ "Unknown Value: React could not send it from the server."
1009
+ ]));
1010
+ request.completedDebugChunks.push(":W" + args + "\n");
599
1011
  }
600
1012
  return originalMethod.apply(this, arguments);
601
1013
  };
@@ -663,19 +1075,19 @@
663
1075
  function defaultErrorHandler(error) {
664
1076
  console.error(error);
665
1077
  }
666
- function defaultPostponeHandler() {}
667
1078
  function RequestInstance(
668
1079
  type,
669
1080
  model,
670
1081
  bundlerConfig,
671
1082
  onError,
672
- identifierPrefix,
673
1083
  onPostpone,
1084
+ onAllReady,
1085
+ onFatalError,
1086
+ identifierPrefix,
674
1087
  temporaryReferences,
675
1088
  environmentName,
676
1089
  filterStackFrame,
677
- onAllReady,
678
- onFatalError
1090
+ keepDebugAlive
679
1091
  ) {
680
1092
  if (
681
1093
  null !== ReactSharedInternalsServer.A &&
@@ -690,14 +1102,14 @@
690
1102
  pingedTasks = [],
691
1103
  hints = new Set();
692
1104
  this.type = type;
693
- this.status = OPENING;
1105
+ this.status = 10;
694
1106
  this.flushScheduled = !1;
695
1107
  this.destination = this.fatalError = null;
696
1108
  this.bundlerConfig = bundlerConfig;
697
1109
  this.cache = new Map();
1110
+ this.cacheController = new AbortController();
698
1111
  this.pendingChunks = this.nextChunkId = 0;
699
1112
  this.hints = hints;
700
- this.abortListeners = new Set();
701
1113
  this.abortableTasks = abortSet;
702
1114
  this.pingedTasks = pingedTasks;
703
1115
  this.completedImportChunks = [];
@@ -717,6 +1129,9 @@
717
1129
  void 0 === onPostpone ? defaultPostponeHandler : onPostpone;
718
1130
  this.onAllReady = onAllReady;
719
1131
  this.onFatalError = onFatalError;
1132
+ this.pendingDebugChunks = 0;
1133
+ this.completedDebugChunks = [];
1134
+ this.debugDestination = null;
720
1135
  this.environmentName =
721
1136
  void 0 === environmentName
722
1137
  ? function () {
@@ -732,10 +1147,27 @@
732
1147
  ? defaultFilterStackFrame
733
1148
  : filterStackFrame;
734
1149
  this.didWarnForKey = null;
735
- type = createTask(this, model, null, !1, abortSet, null, null, null);
736
- pingedTasks.push(type);
1150
+ this.writtenDebugObjects = new WeakMap();
1151
+ this.deferredDebugObjects = keepDebugAlive
1152
+ ? { retained: new Map(), existing: new Map() }
1153
+ : null;
1154
+ type = this.timeOrigin = performance.now();
1155
+ emitTimeOriginChunk(this, type + performance.timeOrigin);
1156
+ this.abortTime = -0;
1157
+ model = createTask(
1158
+ this,
1159
+ model,
1160
+ null,
1161
+ !1,
1162
+ 0,
1163
+ abortSet,
1164
+ type,
1165
+ null,
1166
+ null,
1167
+ null
1168
+ );
1169
+ pingedTasks.push(model);
737
1170
  }
738
- function noop() {}
739
1171
  function createRequest(
740
1172
  model,
741
1173
  bundlerConfig,
@@ -744,7 +1176,8 @@
744
1176
  onPostpone,
745
1177
  temporaryReferences,
746
1178
  environmentName,
747
- filterStackFrame
1179
+ filterStackFrame,
1180
+ keepDebugAlive
748
1181
  ) {
749
1182
  resetOwnerStackLimit();
750
1183
  return new RequestInstance(
@@ -752,13 +1185,14 @@
752
1185
  model,
753
1186
  bundlerConfig,
754
1187
  onError,
755
- identifierPrefix,
756
1188
  onPostpone,
1189
+ noop,
1190
+ noop,
1191
+ identifierPrefix,
757
1192
  temporaryReferences,
758
1193
  environmentName,
759
1194
  filterStackFrame,
760
- noop,
761
- noop
1195
+ keepDebugAlive
762
1196
  );
763
1197
  }
764
1198
  function createPrerenderRequest(
@@ -771,21 +1205,23 @@
771
1205
  onPostpone,
772
1206
  temporaryReferences,
773
1207
  environmentName,
774
- filterStackFrame
1208
+ filterStackFrame,
1209
+ keepDebugAlive
775
1210
  ) {
776
1211
  resetOwnerStackLimit();
777
1212
  return new RequestInstance(
778
- PRERENDER,
1213
+ 21,
779
1214
  model,
780
1215
  bundlerConfig,
781
1216
  onError,
782
- identifierPrefix,
783
1217
  onPostpone,
1218
+ onAllReady,
1219
+ onFatalError,
1220
+ identifierPrefix,
784
1221
  temporaryReferences,
785
1222
  environmentName,
786
1223
  filterStackFrame,
787
- onAllReady,
788
- onFatalError
1224
+ keepDebugAlive
789
1225
  );
790
1226
  }
791
1227
  function resolveRequest() {
@@ -793,35 +1229,124 @@
793
1229
  var store = requestStorage.getStore();
794
1230
  return store ? store : null;
795
1231
  }
1232
+ function serializeDebugThenable(request, counter, thenable) {
1233
+ request.pendingDebugChunks++;
1234
+ var id = request.nextChunkId++,
1235
+ ref = "$@" + id.toString(16);
1236
+ request.writtenDebugObjects.set(thenable, ref);
1237
+ switch (thenable.status) {
1238
+ case "fulfilled":
1239
+ return (
1240
+ emitOutlinedDebugModelChunk(request, id, counter, thenable.value),
1241
+ ref
1242
+ );
1243
+ case "rejected":
1244
+ return (
1245
+ emitErrorChunk(request, id, "", thenable.reason, !0, null), ref
1246
+ );
1247
+ }
1248
+ if (request.status === ABORTING)
1249
+ return emitDebugHaltChunk(request, id), ref;
1250
+ var deferredDebugObjects = request.deferredDebugObjects;
1251
+ if (null !== deferredDebugObjects)
1252
+ return (
1253
+ deferredDebugObjects.retained.set(id, thenable),
1254
+ (ref = "$Y@" + id.toString(16)),
1255
+ request.writtenDebugObjects.set(thenable, ref),
1256
+ ref
1257
+ );
1258
+ var cancelled = !1;
1259
+ thenable.then(
1260
+ function (value) {
1261
+ cancelled ||
1262
+ ((cancelled = !0),
1263
+ request.status === ABORTING
1264
+ ? emitDebugHaltChunk(request, id)
1265
+ : emitOutlinedDebugModelChunk(request, id, counter, value),
1266
+ enqueueFlush(request));
1267
+ },
1268
+ function (reason) {
1269
+ cancelled ||
1270
+ ((cancelled = !0),
1271
+ request.status === ABORTING
1272
+ ? emitDebugHaltChunk(request, id)
1273
+ : emitErrorChunk(request, id, "", reason, !0, null),
1274
+ enqueueFlush(request));
1275
+ }
1276
+ );
1277
+ Promise.resolve().then(function () {
1278
+ cancelled ||
1279
+ ((cancelled = !0),
1280
+ emitDebugHaltChunk(request, id),
1281
+ enqueueFlush(request),
1282
+ (counter = request = null));
1283
+ });
1284
+ return ref;
1285
+ }
1286
+ function emitRequestedDebugThenable(request, id, counter, thenable) {
1287
+ thenable.then(
1288
+ function (value) {
1289
+ request.status === ABORTING
1290
+ ? emitDebugHaltChunk(request, id)
1291
+ : emitOutlinedDebugModelChunk(request, id, counter, value);
1292
+ enqueueFlush(request);
1293
+ },
1294
+ function (reason) {
1295
+ request.status === ABORTING
1296
+ ? emitDebugHaltChunk(request, id)
1297
+ : emitErrorChunk(request, id, "", reason, !0, null);
1298
+ enqueueFlush(request);
1299
+ }
1300
+ );
1301
+ }
796
1302
  function serializeThenable(request, task, thenable) {
797
1303
  var newTask = createTask(
798
1304
  request,
799
- null,
1305
+ thenable,
800
1306
  task.keyPath,
801
1307
  task.implicitSlot,
1308
+ task.formatContext,
802
1309
  request.abortableTasks,
1310
+ task.time,
803
1311
  task.debugOwner,
804
1312
  task.debugStack,
805
1313
  task.debugTask
806
1314
  );
807
- (task = thenable._debugInfo) &&
808
- forwardDebugInfo(request, newTask.id, task);
809
1315
  switch (thenable.status) {
810
1316
  case "fulfilled":
811
1317
  return (
1318
+ forwardDebugInfoFromThenable(
1319
+ request,
1320
+ newTask,
1321
+ thenable,
1322
+ null,
1323
+ null
1324
+ ),
812
1325
  (newTask.model = thenable.value),
813
1326
  pingTask(request, newTask),
814
1327
  newTask.id
815
1328
  );
816
1329
  case "rejected":
817
- return erroredTask(request, newTask, thenable.reason), newTask.id;
1330
+ return (
1331
+ forwardDebugInfoFromThenable(
1332
+ request,
1333
+ newTask,
1334
+ thenable,
1335
+ null,
1336
+ null
1337
+ ),
1338
+ erroredTask(request, newTask, thenable.reason),
1339
+ newTask.id
1340
+ );
818
1341
  default:
819
1342
  if (request.status === ABORTING)
820
1343
  return (
821
1344
  request.abortableTasks.delete(newTask),
822
- (newTask.status = ABORTED),
823
- (task = stringify(serializeByValueID(request.fatalError))),
824
- emitModelChunk(request, newTask.id, task),
1345
+ 21 === request.type
1346
+ ? (haltTask(newTask), finishHaltedTask(newTask, request))
1347
+ : ((task = request.fatalError),
1348
+ abortTask(newTask),
1349
+ finishAbortedTask(newTask, request, task)),
825
1350
  newTask.id
826
1351
  );
827
1352
  "string" !== typeof thenable.status &&
@@ -840,25 +1365,33 @@
840
1365
  }
841
1366
  thenable.then(
842
1367
  function (value) {
1368
+ forwardDebugInfoFromCurrentContext(request, newTask, thenable);
843
1369
  newTask.model = value;
844
1370
  pingTask(request, newTask);
845
1371
  },
846
1372
  function (reason) {
847
- newTask.status === PENDING$1 &&
848
- (erroredTask(request, newTask, reason), enqueueFlush(request));
1373
+ 0 === newTask.status &&
1374
+ ((newTask.timed = !0),
1375
+ erroredTask(request, newTask, reason),
1376
+ enqueueFlush(request));
849
1377
  }
850
1378
  );
851
1379
  return newTask.id;
852
1380
  }
853
1381
  function serializeReadableStream(request, task, stream) {
854
1382
  function progress(entry) {
855
- if (!aborted)
1383
+ if (0 === streamTask.status)
856
1384
  if (entry.done)
857
- request.abortListeners.delete(abortStream),
1385
+ (streamTask.status = 1),
858
1386
  (entry = streamTask.id.toString(16) + ":C\n"),
859
1387
  request.completedRegularChunks.push(entry),
1388
+ request.abortableTasks.delete(streamTask),
1389
+ request.cacheController.signal.removeEventListener(
1390
+ "abort",
1391
+ abortStream
1392
+ ),
860
1393
  enqueueFlush(request),
861
- (aborted = !0);
1394
+ callOnAllReadyIfReady(request);
862
1395
  else
863
1396
  try {
864
1397
  (streamTask.model = entry.value),
@@ -871,20 +1404,27 @@
871
1404
  }
872
1405
  }
873
1406
  function error(reason) {
874
- aborted ||
875
- ((aborted = !0),
876
- request.abortListeners.delete(abortStream),
1407
+ 0 === streamTask.status &&
1408
+ (request.cacheController.signal.removeEventListener(
1409
+ "abort",
1410
+ abortStream
1411
+ ),
877
1412
  erroredTask(request, streamTask, reason),
878
1413
  enqueueFlush(request),
879
1414
  reader.cancel(reason).then(error, error));
880
1415
  }
881
- function abortStream(reason) {
882
- aborted ||
883
- ((aborted = !0),
884
- request.abortListeners.delete(abortStream),
885
- erroredTask(request, streamTask, reason),
886
- enqueueFlush(request),
887
- reader.cancel(reason).then(error, error));
1416
+ function abortStream() {
1417
+ if (0 === streamTask.status) {
1418
+ var signal = request.cacheController.signal;
1419
+ signal.removeEventListener("abort", abortStream);
1420
+ signal = signal.reason;
1421
+ 21 === request.type
1422
+ ? (request.abortableTasks.delete(streamTask),
1423
+ haltTask(streamTask),
1424
+ finishHaltedTask(streamTask, request))
1425
+ : (erroredTask(request, streamTask, signal), enqueueFlush(request));
1426
+ reader.cancel(signal).then(error, error);
1427
+ }
888
1428
  }
889
1429
  var supportsBYOB = stream.supportsBYOB;
890
1430
  if (void 0 === supportsBYOB)
@@ -899,26 +1439,26 @@
899
1439
  task.model,
900
1440
  task.keyPath,
901
1441
  task.implicitSlot,
1442
+ task.formatContext,
902
1443
  request.abortableTasks,
1444
+ task.time,
903
1445
  task.debugOwner,
904
1446
  task.debugStack,
905
1447
  task.debugTask
906
1448
  );
907
- request.abortableTasks.delete(streamTask);
908
1449
  request.pendingChunks++;
909
1450
  task =
910
1451
  streamTask.id.toString(16) + ":" + (supportsBYOB ? "r" : "R") + "\n";
911
1452
  request.completedRegularChunks.push(task);
912
- var aborted = !1;
913
- request.abortListeners.add(abortStream);
1453
+ request.cacheController.signal.addEventListener("abort", abortStream);
914
1454
  reader.read().then(progress, error);
915
1455
  return serializeByValueID(streamTask.id);
916
1456
  }
917
1457
  function serializeAsyncIterable(request, task, iterable, iterator) {
918
1458
  function progress(entry) {
919
- if (!aborted)
1459
+ if (0 === streamTask.status)
920
1460
  if (entry.done) {
921
- request.abortListeners.delete(abortIterable);
1461
+ streamTask.status = 1;
922
1462
  if (void 0 === entry.value)
923
1463
  var endStreamRow = streamTask.id.toString(16) + ":C\n";
924
1464
  else
@@ -934,8 +1474,13 @@
934
1474
  return;
935
1475
  }
936
1476
  request.completedRegularChunks.push(endStreamRow);
1477
+ request.abortableTasks.delete(streamTask);
1478
+ request.cacheController.signal.removeEventListener(
1479
+ "abort",
1480
+ abortIterable
1481
+ );
937
1482
  enqueueFlush(request);
938
- aborted = !0;
1483
+ callOnAllReadyIfReady(request);
939
1484
  } else
940
1485
  try {
941
1486
  (streamTask.model = entry.value),
@@ -948,22 +1493,30 @@
948
1493
  }
949
1494
  }
950
1495
  function error(reason) {
951
- aborted ||
952
- ((aborted = !0),
953
- request.abortListeners.delete(abortIterable),
1496
+ 0 === streamTask.status &&
1497
+ (request.cacheController.signal.removeEventListener(
1498
+ "abort",
1499
+ abortIterable
1500
+ ),
954
1501
  erroredTask(request, streamTask, reason),
955
1502
  enqueueFlush(request),
956
1503
  "function" === typeof iterator.throw &&
957
1504
  iterator.throw(reason).then(error, error));
958
1505
  }
959
- function abortIterable(reason) {
960
- aborted ||
961
- ((aborted = !0),
962
- request.abortListeners.delete(abortIterable),
963
- erroredTask(request, streamTask, reason),
964
- enqueueFlush(request),
1506
+ function abortIterable() {
1507
+ if (0 === streamTask.status) {
1508
+ var signal = request.cacheController.signal;
1509
+ signal.removeEventListener("abort", abortIterable);
1510
+ var reason = signal.reason;
1511
+ 21 === request.type
1512
+ ? (request.abortableTasks.delete(streamTask),
1513
+ haltTask(streamTask),
1514
+ finishHaltedTask(streamTask, request))
1515
+ : (erroredTask(request, streamTask, signal.reason),
1516
+ enqueueFlush(request));
965
1517
  "function" === typeof iterator.throw &&
966
- iterator.throw(reason).then(error, error));
1518
+ iterator.throw(reason).then(error, error);
1519
+ }
967
1520
  }
968
1521
  var isIterator = iterable === iterator,
969
1522
  streamTask = createTask(
@@ -971,19 +1524,20 @@
971
1524
  task.model,
972
1525
  task.keyPath,
973
1526
  task.implicitSlot,
1527
+ task.formatContext,
974
1528
  request.abortableTasks,
1529
+ task.time,
975
1530
  task.debugOwner,
976
1531
  task.debugStack,
977
1532
  task.debugTask
978
1533
  );
979
- request.abortableTasks.delete(streamTask);
1534
+ (task = iterable._debugInfo) &&
1535
+ forwardDebugInfo(request, streamTask, task);
980
1536
  request.pendingChunks++;
981
- task = streamTask.id.toString(16) + ":" + (isIterator ? "x" : "X") + "\n";
982
- request.completedRegularChunks.push(task);
983
- (iterable = iterable._debugInfo) &&
984
- forwardDebugInfo(request, streamTask.id, iterable);
985
- var aborted = !1;
986
- request.abortListeners.add(abortIterable);
1537
+ isIterator =
1538
+ streamTask.id.toString(16) + ":" + (isIterator ? "x" : "X") + "\n";
1539
+ request.completedRegularChunks.push(isIterator);
1540
+ request.cacheController.signal.addEventListener("abort", abortIterable);
987
1541
  callIteratorInDEV(iterator, progress, error);
988
1542
  return serializeByValueID(streamTask.id);
989
1543
  }
@@ -997,33 +1551,38 @@
997
1551
  if ("rejected" === thenable.status) throw thenable.reason;
998
1552
  throw thenable;
999
1553
  }
1000
- function createLazyWrapperAroundWakeable(wakeable) {
1554
+ function createLazyWrapperAroundWakeable(request, task, wakeable) {
1001
1555
  switch (wakeable.status) {
1002
1556
  case "fulfilled":
1557
+ return (
1558
+ forwardDebugInfoFromThenable(request, task, wakeable, null, null),
1559
+ wakeable.value
1560
+ );
1003
1561
  case "rejected":
1562
+ forwardDebugInfoFromThenable(request, task, wakeable, null, null);
1004
1563
  break;
1005
1564
  default:
1006
1565
  "string" !== typeof wakeable.status &&
1007
1566
  ((wakeable.status = "pending"),
1008
1567
  wakeable.then(
1009
1568
  function (fulfilledValue) {
1569
+ forwardDebugInfoFromCurrentContext(request, task, wakeable);
1010
1570
  "pending" === wakeable.status &&
1011
1571
  ((wakeable.status = "fulfilled"),
1012
1572
  (wakeable.value = fulfilledValue));
1013
1573
  },
1014
1574
  function (error) {
1575
+ forwardDebugInfoFromCurrentContext(request, task, wakeable);
1015
1576
  "pending" === wakeable.status &&
1016
1577
  ((wakeable.status = "rejected"), (wakeable.reason = error));
1017
1578
  }
1018
1579
  ));
1019
1580
  }
1020
- var lazyType = {
1581
+ return {
1021
1582
  $$typeof: REACT_LAZY_TYPE,
1022
1583
  _payload: wakeable,
1023
1584
  _init: readThenable
1024
1585
  };
1025
- lazyType._debugInfo = wakeable._debugInfo || [];
1026
- return lazyType;
1027
1586
  }
1028
1587
  function callWithDebugContextInDEV(request, task, callback, arg) {
1029
1588
  var componentDebugInfo = {
@@ -1035,7 +1594,7 @@
1035
1594
  componentDebugInfo.stack =
1036
1595
  null === task.debugStack
1037
1596
  ? null
1038
- : filterStackTrace(request, task.debugStack, 1);
1597
+ : filterStackTrace(request, parseStackTrace(task.debugStack, 1));
1039
1598
  componentDebugInfo.debugStack = task.debugStack;
1040
1599
  request = componentDebugInfo.debugTask = task.debugTask;
1041
1600
  currentOwner = componentDebugInfo;
@@ -1065,9 +1624,7 @@
1065
1624
  resolvedValue.$$typeof === REACT_ELEMENT_TYPE &&
1066
1625
  (resolvedValue._store.validated = 1);
1067
1626
  }, voidHandler),
1068
- "fulfilled" === result.status
1069
- ? result.value
1070
- : createLazyWrapperAroundWakeable(result)
1627
+ createLazyWrapperAroundWakeable(request, task, result)
1071
1628
  );
1072
1629
  result.$$typeof === REACT_ELEMENT_TYPE && (result._store.validated = 1);
1073
1630
  var iteratorFn = getIteratorFn(result);
@@ -1120,33 +1677,35 @@
1120
1677
  ) {
1121
1678
  var prevThenableState = task.thenableState;
1122
1679
  task.thenableState = null;
1123
- if (null === debugID) return outlineTask(request, task);
1124
- if (null !== prevThenableState)
1125
- var componentDebugInfo = prevThenableState._componentDebugInfo;
1126
- else {
1127
- var componentDebugID = debugID;
1128
- componentDebugInfo = Component.displayName || Component.name || "";
1129
- var componentEnv = (0, request.environmentName)();
1130
- request.pendingChunks++;
1131
- componentDebugInfo = {
1132
- name: componentDebugInfo,
1133
- env: componentEnv,
1134
- key: key,
1135
- owner: task.debugOwner
1136
- };
1137
- componentDebugInfo.stack =
1138
- null === task.debugStack
1139
- ? null
1140
- : filterStackTrace(request, task.debugStack, 1);
1141
- componentDebugInfo.props = props;
1142
- componentDebugInfo.debugStack = task.debugStack;
1143
- componentDebugInfo.debugTask = task.debugTask;
1144
- outlineComponentInfo(request, componentDebugInfo);
1145
- emitDebugChunk(request, componentDebugID, componentDebugInfo);
1146
- task.environmentName = componentEnv;
1147
- 2 === validated &&
1148
- warnForMissingKey(request, key, componentDebugInfo, task.debugTask);
1149
- }
1680
+ if (canEmitDebugInfo)
1681
+ if (null !== prevThenableState)
1682
+ var componentDebugInfo = prevThenableState._componentDebugInfo;
1683
+ else {
1684
+ var componentDebugID = task.id;
1685
+ componentDebugInfo = Component.displayName || Component.name || "";
1686
+ var componentEnv = (0, request.environmentName)();
1687
+ request.pendingChunks++;
1688
+ componentDebugInfo = {
1689
+ name: componentDebugInfo,
1690
+ env: componentEnv,
1691
+ key: key,
1692
+ owner: task.debugOwner
1693
+ };
1694
+ componentDebugInfo.stack =
1695
+ null === task.debugStack
1696
+ ? null
1697
+ : filterStackTrace(request, parseStackTrace(task.debugStack, 1));
1698
+ componentDebugInfo.props = props;
1699
+ componentDebugInfo.debugStack = task.debugStack;
1700
+ componentDebugInfo.debugTask = task.debugTask;
1701
+ outlineComponentInfo(request, componentDebugInfo);
1702
+ advanceTaskTime(request, task, performance.now());
1703
+ emitDebugChunk(request, componentDebugID, componentDebugInfo);
1704
+ task.environmentName = componentEnv;
1705
+ 2 === validated &&
1706
+ warnForMissingKey(request, key, componentDebugInfo, task.debugTask);
1707
+ }
1708
+ else return outlineTask(request, task);
1150
1709
  thenableIndexCounter = 0;
1151
1710
  thenableState = prevThenableState;
1152
1711
  currentComponentDebugInfo = componentDebugInfo;
@@ -1177,20 +1736,38 @@
1177
1736
  props.then(voidHandler, voidHandler),
1178
1737
  null)
1179
1738
  );
1739
+ validated = thenableState;
1740
+ if (null !== validated)
1741
+ for (
1742
+ prevThenableState = validated._stacks || (validated._stacks = []),
1743
+ componentDebugID = 0;
1744
+ componentDebugID < validated.length;
1745
+ componentDebugID++
1746
+ )
1747
+ forwardDebugInfoFromThenable(
1748
+ request,
1749
+ task,
1750
+ validated[componentDebugID],
1751
+ componentDebugInfo,
1752
+ prevThenableState[componentDebugID]
1753
+ );
1180
1754
  props = processServerComponentReturnValue(
1181
1755
  request,
1182
1756
  task,
1183
1757
  Component,
1184
1758
  props
1185
1759
  );
1760
+ task.debugOwner = componentDebugInfo;
1761
+ task.debugStack = null;
1762
+ task.debugTask = null;
1186
1763
  Component = task.keyPath;
1187
- validated = task.implicitSlot;
1764
+ componentDebugInfo = task.implicitSlot;
1188
1765
  null !== key
1189
1766
  ? (task.keyPath = null === Component ? key : Component + "," + key)
1190
1767
  : null === Component && (task.implicitSlot = !0);
1191
1768
  request = renderModelDestructive(request, task, emptyRoot, "", props);
1192
1769
  task.keyPath = Component;
1193
- task.implicitSlot = validated;
1770
+ task.implicitSlot = componentDebugInfo;
1194
1771
  return request;
1195
1772
  }
1196
1773
  function warnForMissingKey(request, key, componentDebugInfo, debugTask) {
@@ -1251,8 +1828,8 @@
1251
1828
  task.implicitSlot ? [request] : request
1252
1829
  );
1253
1830
  if ((i = children._debugInfo)) {
1254
- if (null === debugID) return outlineTask(request, task);
1255
- forwardDebugInfo(request, debugID, i);
1831
+ if (canEmitDebugInfo) forwardDebugInfo(request, task, i);
1832
+ else return outlineTask(request, task);
1256
1833
  children = Array.from(children);
1257
1834
  }
1258
1835
  return children;
@@ -1274,21 +1851,39 @@
1274
1851
  getAsyncIterator = getAsyncIterator.call(children);
1275
1852
  return serializeAsyncIterable(request, task, children, getAsyncIterator);
1276
1853
  }
1854
+ function deferTask(request, task) {
1855
+ task = createTask(
1856
+ request,
1857
+ task.model,
1858
+ task.keyPath,
1859
+ task.implicitSlot,
1860
+ task.formatContext,
1861
+ request.abortableTasks,
1862
+ task.time,
1863
+ task.debugOwner,
1864
+ task.debugStack,
1865
+ task.debugTask
1866
+ );
1867
+ pingTask(request, task);
1868
+ return serializeLazyID(task.id);
1869
+ }
1277
1870
  function outlineTask(request, task) {
1278
1871
  task = createTask(
1279
1872
  request,
1280
1873
  task.model,
1281
1874
  task.keyPath,
1282
1875
  task.implicitSlot,
1876
+ task.formatContext,
1283
1877
  request.abortableTasks,
1878
+ task.time,
1284
1879
  task.debugOwner,
1285
1880
  task.debugStack,
1286
1881
  task.debugTask
1287
1882
  );
1288
1883
  retryTask(request, task);
1289
- return task.status === COMPLETED
1884
+ return 1 === task.status
1290
1885
  ? serializeByValueID(task.id)
1291
- : "$L" + task.id.toString(16);
1886
+ : serializeLazyID(task.id);
1292
1887
  }
1293
1888
  function renderElement(request, task, type, key, ref, props, validated) {
1294
1889
  if (null !== ref && void 0 !== ref)
@@ -1315,7 +1910,10 @@
1315
1910
  stack:
1316
1911
  null === task.debugStack
1317
1912
  ? null
1318
- : filterStackTrace(request, task.debugStack, 1),
1913
+ : filterStackTrace(
1914
+ request,
1915
+ parseStackTrace(task.debugStack, 1)
1916
+ ),
1319
1917
  props: props,
1320
1918
  debugStack: task.debugStack,
1321
1919
  debugTask: task.debugTask
@@ -1373,6 +1971,17 @@
1373
1971
  case REACT_ELEMENT_TYPE:
1374
1972
  type._store.validated = 1;
1375
1973
  }
1974
+ else if ("string" === typeof type) {
1975
+ ref = task.formatContext;
1976
+ var newFormatContext = getChildFormatContext(ref, type, props);
1977
+ ref !== newFormatContext &&
1978
+ null != props.children &&
1979
+ outlineModelWithFormatContext(
1980
+ request,
1981
+ props.children,
1982
+ newFormatContext
1983
+ );
1984
+ }
1376
1985
  } else
1377
1986
  return renderFunctionComponent(
1378
1987
  request,
@@ -1384,41 +1993,203 @@
1384
1993
  );
1385
1994
  ref = task.keyPath;
1386
1995
  null === key ? (key = ref) : null !== ref && (key = ref + "," + key);
1387
- null !== task.debugOwner &&
1388
- outlineComponentInfo(request, task.debugOwner);
1996
+ newFormatContext = null;
1997
+ ref = task.debugOwner;
1998
+ null !== ref && outlineComponentInfo(request, ref);
1999
+ if (null !== task.debugStack) {
2000
+ newFormatContext = filterStackTrace(
2001
+ request,
2002
+ parseStackTrace(task.debugStack, 1)
2003
+ );
2004
+ var id = outlineDebugModel(
2005
+ request,
2006
+ { objectLimit: 2 * newFormatContext.length + 1 },
2007
+ newFormatContext
2008
+ );
2009
+ request.writtenObjects.set(newFormatContext, serializeByValueID(id));
2010
+ }
1389
2011
  request = [
1390
2012
  REACT_ELEMENT_TYPE,
1391
2013
  type,
1392
2014
  key,
1393
2015
  props,
1394
- task.debugOwner,
1395
- null === task.debugStack
1396
- ? null
1397
- : filterStackTrace(request, task.debugStack, 1),
2016
+ ref,
2017
+ newFormatContext,
1398
2018
  validated
1399
2019
  ];
1400
2020
  task = task.implicitSlot && null !== key ? [request] : request;
1401
2021
  return task;
1402
2022
  }
1403
- function pingTask(request, task) {
1404
- var pingedTasks = request.pingedTasks;
1405
- pingedTasks.push(task);
1406
- 1 === pingedTasks.length &&
1407
- ((request.flushScheduled = null !== request.destination),
1408
- request.type === PRERENDER || request.status === OPENING
1409
- ? scheduleMicrotask(function () {
1410
- return performWork(request);
1411
- })
1412
- : setImmediate(function () {
1413
- return performWork(request);
1414
- }));
1415
- }
1416
- function createTask(
1417
- request,
1418
- model,
1419
- keyPath,
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)
2038
+ )
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
2055
+ : 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
+ }
2121
+ }
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.");
2131
+ }
2132
+ }
2133
+ function emitAsyncSequence(
2134
+ request,
2135
+ task,
2136
+ node,
2137
+ alreadyForwardedDebugInfo,
2138
+ owner,
2139
+ stack
2140
+ ) {
2141
+ var visited = new Set();
2142
+ alreadyForwardedDebugInfo && visited.add(alreadyForwardedDebugInfo);
2143
+ node = visitAsyncNode(request, task, node, visited, task.time);
2144
+ void 0 !== node &&
2145
+ null !== node &&
2146
+ (serializeIONode(request, node, node.promise),
2147
+ request.pendingChunks++,
2148
+ (alreadyForwardedDebugInfo = (0, request.environmentName)()),
2149
+ (alreadyForwardedDebugInfo = {
2150
+ awaited: node,
2151
+ env: alreadyForwardedDebugInfo
2152
+ }),
2153
+ null === owner && null === stack
2154
+ ? (null !== task.debugOwner &&
2155
+ (alreadyForwardedDebugInfo.owner = task.debugOwner),
2156
+ null !== task.debugStack &&
2157
+ (alreadyForwardedDebugInfo.stack = filterStackTrace(
2158
+ request,
2159
+ parseStackTrace(task.debugStack, 1)
2160
+ )))
2161
+ : (null != owner && (alreadyForwardedDebugInfo.owner = owner),
2162
+ null != stack &&
2163
+ (alreadyForwardedDebugInfo.stack = filterStackTrace(
2164
+ request,
2165
+ parseStackTrace(stack, 1)
2166
+ ))),
2167
+ advanceTaskTime(request, task, task.time),
2168
+ emitDebugChunk(request, task.id, alreadyForwardedDebugInfo),
2169
+ markOperationEndTime(request, task, node.end));
2170
+ }
2171
+ function pingTask(request, task) {
2172
+ task.timed = !0;
2173
+ var pingedTasks = request.pingedTasks;
2174
+ pingedTasks.push(task);
2175
+ 1 === pingedTasks.length &&
2176
+ ((request.flushScheduled = null !== request.destination),
2177
+ 21 === request.type || 10 === request.status
2178
+ ? scheduleMicrotask(function () {
2179
+ return performWork(request);
2180
+ })
2181
+ : setImmediate(function () {
2182
+ return performWork(request);
2183
+ }));
2184
+ }
2185
+ function createTask(
2186
+ request,
2187
+ model,
2188
+ keyPath,
1420
2189
  implicitSlot,
2190
+ formatContext,
1421
2191
  abortSet,
2192
+ lastTimestamp,
1422
2193
  debugOwner,
1423
2194
  debugStack,
1424
2195
  debugTask
@@ -1432,10 +2203,11 @@
1432
2203
  request.writtenObjects.set(model, serializeByValueID(id));
1433
2204
  var task = {
1434
2205
  id: id,
1435
- status: PENDING$1,
2206
+ status: 0,
1436
2207
  model: model,
1437
2208
  keyPath: keyPath,
1438
2209
  implicitSlot: implicitSlot,
2210
+ formatContext: formatContext,
1439
2211
  ping: function () {
1440
2212
  return pingTask(request, task);
1441
2213
  },
@@ -1465,8 +2237,10 @@
1465
2237
  });
1466
2238
  return renderModel(request, task, parent, parentPropertyName, value);
1467
2239
  },
1468
- thenableState: null
2240
+ thenableState: null,
2241
+ timed: !1
1469
2242
  };
2243
+ task.time = lastTimestamp;
1470
2244
  task.environmentName = request.environmentName();
1471
2245
  task.debugOwner = debugOwner;
1472
2246
  task.debugStack = debugStack;
@@ -1477,6 +2251,19 @@
1477
2251
  function serializeByValueID(id) {
1478
2252
  return "$" + id.toString(16);
1479
2253
  }
2254
+ function serializeLazyID(id) {
2255
+ return "$L" + id.toString(16);
2256
+ }
2257
+ function serializeDeferredObject(request, value) {
2258
+ var deferredDebugObjects = request.deferredDebugObjects;
2259
+ return null !== deferredDebugObjects
2260
+ ? (request.pendingDebugChunks++,
2261
+ (request = request.nextChunkId++),
2262
+ deferredDebugObjects.existing.set(value, request),
2263
+ deferredDebugObjects.retained.set(request, value),
2264
+ "$Y" + request.toString(16))
2265
+ : "$Y";
2266
+ }
1480
2267
  function serializeNumber(number) {
1481
2268
  return Number.isFinite(number)
1482
2269
  ? 0 === number && -Infinity === 1 / number
@@ -1505,62 +2292,78 @@
1505
2292
  existingId = writtenClientReferences.get(clientReferenceKey);
1506
2293
  if (void 0 !== existingId)
1507
2294
  return parent[0] === REACT_ELEMENT_TYPE && "1" === parentPropertyName
1508
- ? "$L" + existingId.toString(16)
2295
+ ? serializeLazyID(existingId)
1509
2296
  : serializeByValueID(existingId);
1510
2297
  try {
1511
- var config = request.bundlerConfig,
1512
- modulePath = clientReference.$$id;
1513
- existingId = "";
1514
- var resolvedModuleData = config[modulePath];
1515
- if (resolvedModuleData) existingId = resolvedModuleData.name;
1516
- else {
1517
- var idx = modulePath.lastIndexOf("#");
1518
- -1 !== idx &&
1519
- ((existingId = modulePath.slice(idx + 1)),
1520
- (resolvedModuleData = config[modulePath.slice(0, idx)]));
1521
- if (!resolvedModuleData)
1522
- throw Error(
1523
- 'Could not find the module "' +
1524
- modulePath +
1525
- '" in the React Client Manifest. This is probably a bug in the React Server Components bundler.'
1526
- );
1527
- }
1528
- if (!0 === resolvedModuleData.async && !0 === clientReference.$$async)
1529
- throw Error(
1530
- 'The module "' +
1531
- modulePath +
1532
- '" is marked as an async ESM module but was loaded as a CJS proxy. This is probably a bug in the React Server Components bundler.'
1533
- );
1534
- var clientReferenceMetadata =
1535
- !0 === resolvedModuleData.async || !0 === clientReference.$$async
1536
- ? [resolvedModuleData.id, resolvedModuleData.chunks, existingId, 1]
1537
- : [resolvedModuleData.id, resolvedModuleData.chunks, existingId];
2298
+ var clientReferenceMetadata = resolveClientReferenceMetadata(
2299
+ request.bundlerConfig,
2300
+ clientReference
2301
+ );
1538
2302
  request.pendingChunks++;
1539
- var importId = request.nextChunkId++,
1540
- json = stringify(clientReferenceMetadata),
1541
- processedChunk = importId.toString(16) + ":I" + json + "\n";
1542
- request.completedImportChunks.push(processedChunk);
2303
+ var importId = request.nextChunkId++;
2304
+ emitImportChunk(request, importId, clientReferenceMetadata, !1);
1543
2305
  writtenClientReferences.set(clientReferenceKey, importId);
1544
2306
  return parent[0] === REACT_ELEMENT_TYPE && "1" === parentPropertyName
1545
- ? "$L" + importId.toString(16)
2307
+ ? serializeLazyID(importId)
1546
2308
  : serializeByValueID(importId);
1547
2309
  } catch (x) {
1548
2310
  return (
1549
2311
  request.pendingChunks++,
1550
2312
  (parent = request.nextChunkId++),
1551
2313
  (parentPropertyName = logRecoverableError(request, x, null)),
1552
- emitErrorChunk(request, parent, parentPropertyName, x),
2314
+ emitErrorChunk(request, parent, parentPropertyName, x, !1, null),
2315
+ serializeByValueID(parent)
2316
+ );
2317
+ }
2318
+ }
2319
+ function serializeDebugClientReference(
2320
+ request,
2321
+ parent,
2322
+ parentPropertyName,
2323
+ clientReference
2324
+ ) {
2325
+ var existingId = request.writtenClientReferences.get(
2326
+ clientReference.$$async
2327
+ ? clientReference.$$id + "#async"
2328
+ : clientReference.$$id
2329
+ );
2330
+ if (void 0 !== existingId)
2331
+ return parent[0] === REACT_ELEMENT_TYPE && "1" === parentPropertyName
2332
+ ? serializeLazyID(existingId)
2333
+ : serializeByValueID(existingId);
2334
+ try {
2335
+ var clientReferenceMetadata = resolveClientReferenceMetadata(
2336
+ request.bundlerConfig,
2337
+ clientReference
2338
+ );
2339
+ request.pendingDebugChunks++;
2340
+ var importId = request.nextChunkId++;
2341
+ emitImportChunk(request, importId, clientReferenceMetadata, !0);
2342
+ return parent[0] === REACT_ELEMENT_TYPE && "1" === parentPropertyName
2343
+ ? serializeLazyID(importId)
2344
+ : serializeByValueID(importId);
2345
+ } catch (x) {
2346
+ return (
2347
+ request.pendingDebugChunks++,
2348
+ (parent = request.nextChunkId++),
2349
+ (parentPropertyName = logRecoverableError(request, x, null)),
2350
+ emitErrorChunk(request, parent, parentPropertyName, x, !0, null),
1553
2351
  serializeByValueID(parent)
1554
2352
  );
1555
2353
  }
1556
2354
  }
1557
2355
  function outlineModel(request, value) {
2356
+ return outlineModelWithFormatContext(request, value, 0);
2357
+ }
2358
+ function outlineModelWithFormatContext(request, value, formatContext) {
1558
2359
  value = createTask(
1559
2360
  request,
1560
2361
  value,
1561
2362
  null,
1562
2363
  !1,
2364
+ formatContext,
1563
2365
  request.abortableTasks,
2366
+ performance.now(),
1564
2367
  null,
1565
2368
  null,
1566
2369
  null
@@ -1579,7 +2382,9 @@
1579
2382
  error = serverReference.$$location;
1580
2383
  error &&
1581
2384
  ((error = parseStackTrace(error, 1)),
1582
- 0 < error.length && (location = error[0]));
2385
+ 0 < error.length &&
2386
+ ((location = error[0]),
2387
+ (location = [location[0], location[1], location[2], location[3]])));
1583
2388
  existingId =
1584
2389
  null !== location
1585
2390
  ? {
@@ -1600,7 +2405,7 @@
1600
2405
  function serializeLargeTextString(request, text) {
1601
2406
  request.pendingChunks++;
1602
2407
  var textId = request.nextChunkId++;
1603
- emitTextChunk(request, textId, text);
2408
+ emitTextChunk(request, textId, text, !1);
1604
2409
  return serializeByValueID(textId);
1605
2410
  }
1606
2411
  function serializeMap(request, map) {
@@ -1618,15 +2423,50 @@
1618
2423
  function serializeTypedArray(request, tag, typedArray) {
1619
2424
  request.pendingChunks++;
1620
2425
  var bufferId = request.nextChunkId++;
1621
- emitTypedArrayChunk(request, bufferId, tag, typedArray);
2426
+ emitTypedArrayChunk(request, bufferId, tag, typedArray, !1);
1622
2427
  return serializeByValueID(bufferId);
1623
2428
  }
2429
+ function serializeDebugTypedArray(request, tag, typedArray) {
2430
+ request.pendingDebugChunks++;
2431
+ var bufferId = request.nextChunkId++;
2432
+ emitTypedArrayChunk(request, bufferId, tag, typedArray, !0);
2433
+ return serializeByValueID(bufferId);
2434
+ }
2435
+ function serializeDebugBlob(request, blob) {
2436
+ function progress(entry) {
2437
+ if (entry.done)
2438
+ emitOutlinedDebugModelChunk(
2439
+ request,
2440
+ id,
2441
+ { objectLimit: model.length + 2 },
2442
+ model
2443
+ ),
2444
+ enqueueFlush(request);
2445
+ else
2446
+ return (
2447
+ model.push(entry.value), reader.read().then(progress).catch(error)
2448
+ );
2449
+ }
2450
+ function error(reason) {
2451
+ emitErrorChunk(request, id, "", reason, !0, null);
2452
+ enqueueFlush(request);
2453
+ reader.cancel(reason).then(noop, noop);
2454
+ }
2455
+ var model = [blob.type],
2456
+ reader = blob.stream().getReader();
2457
+ request.pendingDebugChunks++;
2458
+ var id = request.nextChunkId++;
2459
+ reader.read().then(progress).catch(error);
2460
+ return "$B" + id.toString(16);
2461
+ }
1624
2462
  function serializeBlob(request, blob) {
1625
2463
  function progress(entry) {
1626
- if (!aborted)
2464
+ if (0 === newTask.status)
1627
2465
  if (entry.done)
1628
- request.abortListeners.delete(abortBlob),
1629
- (aborted = !0),
2466
+ request.cacheController.signal.removeEventListener(
2467
+ "abort",
2468
+ abortBlob
2469
+ ),
1630
2470
  pingTask(request, newTask);
1631
2471
  else
1632
2472
  return (
@@ -1634,20 +2474,27 @@
1634
2474
  );
1635
2475
  }
1636
2476
  function error(reason) {
1637
- aborted ||
1638
- ((aborted = !0),
1639
- request.abortListeners.delete(abortBlob),
2477
+ 0 === newTask.status &&
2478
+ (request.cacheController.signal.removeEventListener(
2479
+ "abort",
2480
+ abortBlob
2481
+ ),
1640
2482
  erroredTask(request, newTask, reason),
1641
2483
  enqueueFlush(request),
1642
2484
  reader.cancel(reason).then(error, error));
1643
2485
  }
1644
- function abortBlob(reason) {
1645
- aborted ||
1646
- ((aborted = !0),
1647
- request.abortListeners.delete(abortBlob),
1648
- erroredTask(request, newTask, reason),
1649
- enqueueFlush(request),
1650
- reader.cancel(reason).then(error, error));
2486
+ function abortBlob() {
2487
+ if (0 === newTask.status) {
2488
+ var signal = request.cacheController.signal;
2489
+ signal.removeEventListener("abort", abortBlob);
2490
+ signal = signal.reason;
2491
+ 21 === request.type
2492
+ ? (request.abortableTasks.delete(newTask),
2493
+ haltTask(newTask),
2494
+ finishHaltedTask(newTask, request))
2495
+ : (erroredTask(request, newTask, signal), enqueueFlush(request));
2496
+ reader.cancel(signal).then(error, error);
2497
+ }
1651
2498
  }
1652
2499
  var model = [blob.type],
1653
2500
  newTask = createTask(
@@ -1655,18 +2502,20 @@
1655
2502
  model,
1656
2503
  null,
1657
2504
  !1,
2505
+ 0,
1658
2506
  request.abortableTasks,
2507
+ performance.now(),
1659
2508
  null,
1660
2509
  null,
1661
2510
  null
1662
2511
  ),
1663
- reader = blob.stream().getReader(),
1664
- aborted = !1;
1665
- request.abortListeners.add(abortBlob);
2512
+ reader = blob.stream().getReader();
2513
+ request.cacheController.signal.addEventListener("abort", abortBlob);
1666
2514
  reader.read().then(progress).catch(error);
1667
2515
  return "$B" + newTask.id.toString(16);
1668
2516
  }
1669
2517
  function renderModel(request, task, parent, key, value) {
2518
+ serializedSize += key.length;
1670
2519
  var prevKeyPath = task.keyPath,
1671
2520
  prevImplicitSlot = task.implicitSlot;
1672
2521
  try {
@@ -1678,12 +2527,19 @@
1678
2527
  null !== parent &&
1679
2528
  (parent.$$typeof === REACT_ELEMENT_TYPE ||
1680
2529
  parent.$$typeof === REACT_LAZY_TYPE);
1681
- if (request.status === ABORTING)
1682
- return (
1683
- (task.status = ABORTED),
1684
- (task = request.fatalError),
1685
- parent ? "$L" + task.toString(16) : serializeByValueID(task)
1686
- );
2530
+ if (request.status === ABORTING) {
2531
+ task.status = 3;
2532
+ if (21 === request.type)
2533
+ return (
2534
+ (task = request.nextChunkId++),
2535
+ (task = parent
2536
+ ? serializeLazyID(task)
2537
+ : serializeByValueID(task)),
2538
+ task
2539
+ );
2540
+ task = request.fatalError;
2541
+ return parent ? serializeLazyID(task) : serializeByValueID(task);
2542
+ }
1687
2543
  key =
1688
2544
  thrownValue === SuspenseException
1689
2545
  ? getSuspendedThenable()
@@ -1699,7 +2555,9 @@
1699
2555
  task.model,
1700
2556
  task.keyPath,
1701
2557
  task.implicitSlot,
2558
+ task.formatContext,
1702
2559
  request.abortableTasks,
2560
+ task.time,
1703
2561
  task.debugOwner,
1704
2562
  task.debugStack,
1705
2563
  task.debugTask
@@ -1710,17 +2568,24 @@
1710
2568
  (task.keyPath = prevKeyPath),
1711
2569
  (task.implicitSlot = prevImplicitSlot),
1712
2570
  parent
1713
- ? "$L" + request.id.toString(16)
2571
+ ? serializeLazyID(request.id)
1714
2572
  : serializeByValueID(request.id)
1715
2573
  );
1716
2574
  task.keyPath = prevKeyPath;
1717
2575
  task.implicitSlot = prevImplicitSlot;
1718
2576
  request.pendingChunks++;
1719
2577
  prevKeyPath = request.nextChunkId++;
1720
- task = logRecoverableError(request, key, task);
1721
- emitErrorChunk(request, prevKeyPath, task, key);
2578
+ prevImplicitSlot = logRecoverableError(request, key, task);
2579
+ emitErrorChunk(
2580
+ request,
2581
+ prevKeyPath,
2582
+ prevImplicitSlot,
2583
+ key,
2584
+ !1,
2585
+ task.debugOwner
2586
+ );
1722
2587
  return parent
1723
- ? "$L" + prevKeyPath.toString(16)
2588
+ ? serializeLazyID(prevKeyPath)
1724
2589
  : serializeByValueID(prevKeyPath);
1725
2590
  }
1726
2591
  }
@@ -1752,21 +2617,37 @@
1752
2617
  _existingReference + ":" + parentPropertyName),
1753
2618
  _writtenObjects.set(value, elementReference)));
1754
2619
  }
1755
- if ((_existingReference = value._debugInfo)) {
1756
- if (null === debugID) return outlineTask(request, task);
1757
- forwardDebugInfo(request, debugID, _existingReference);
1758
- }
2620
+ if (serializedSize > MAX_ROW_SIZE) return deferTask(request, task);
2621
+ if ((_existingReference = value._debugInfo))
2622
+ if (canEmitDebugInfo)
2623
+ forwardDebugInfo(request, task, _existingReference);
2624
+ else return outlineTask(request, task);
1759
2625
  _existingReference = value.props;
1760
2626
  var refProp = _existingReference.ref;
2627
+ refProp = void 0 !== refProp ? refProp : null;
1761
2628
  task.debugOwner = value._owner;
1762
2629
  task.debugStack = value._debugStack;
1763
2630
  task.debugTask = value._debugTask;
2631
+ if (
2632
+ void 0 === value._owner ||
2633
+ void 0 === value._debugStack ||
2634
+ void 0 === value._debugTask
2635
+ ) {
2636
+ var key = "";
2637
+ null !== value.key && (key = ' key="' + value.key + '"');
2638
+ console.error(
2639
+ "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",
2640
+ value.type,
2641
+ key,
2642
+ value.props
2643
+ );
2644
+ }
1764
2645
  request = renderElement(
1765
2646
  request,
1766
2647
  task,
1767
2648
  value.type,
1768
2649
  value.key,
1769
- void 0 !== refProp ? refProp : null,
2650
+ refProp,
1770
2651
  _existingReference,
1771
2652
  value._store.validated
1772
2653
  );
@@ -1777,13 +2658,14 @@
1777
2658
  _writtenObjects.set(request, elementReference));
1778
2659
  return request;
1779
2660
  case REACT_LAZY_TYPE:
2661
+ if (serializedSize > MAX_ROW_SIZE) return deferTask(request, task);
1780
2662
  task.thenableState = null;
1781
2663
  elementReference = callLazyInitInDEV(value);
1782
2664
  if (request.status === ABORTING) throw null;
1783
- if ((_writtenObjects = value._debugInfo)) {
1784
- if (null === debugID) return outlineTask(request, task);
1785
- forwardDebugInfo(request, debugID, _writtenObjects);
1786
- }
2665
+ if ((_writtenObjects = value._debugInfo))
2666
+ if (canEmitDebugInfo)
2667
+ forwardDebugInfo(request, task, _writtenObjects);
2668
+ else return outlineTask(request, task);
1787
2669
  return renderModelDestructive(
1788
2670
  request,
1789
2671
  task,
@@ -1825,8 +2707,11 @@
1825
2707
  return request;
1826
2708
  }
1827
2709
  if (void 0 !== _writtenObjects)
1828
- if (modelRoot === value) modelRoot = null;
1829
- else return _writtenObjects;
2710
+ if (modelRoot === value) {
2711
+ if (_writtenObjects !== serializeByValueID(task.id))
2712
+ return _writtenObjects;
2713
+ modelRoot = null;
2714
+ } else return _writtenObjects;
1830
2715
  else if (
1831
2716
  -1 === parentPropertyName.indexOf(":") &&
1832
2717
  ((_writtenObjects = elementReference.get(parent)),
@@ -1942,14 +2827,17 @@
1942
2827
  return value;
1943
2828
  }
1944
2829
  if ("string" === typeof value)
1945
- return "Z" === value[value.length - 1] &&
2830
+ return (
2831
+ (serializedSize += value.length),
2832
+ "Z" === value[value.length - 1] &&
1946
2833
  parent[parentPropertyName] instanceof Date
1947
- ? "$D" + value
1948
- : 1024 <= value.length && null !== byteLengthOfChunk
1949
- ? serializeLargeTextString(request, value)
1950
- : "$" === value[0]
1951
- ? "$" + value
1952
- : value;
2834
+ ? "$D" + value
2835
+ : 1024 <= value.length && null !== byteLengthOfChunk
2836
+ ? serializeLargeTextString(request, value)
2837
+ : "$" === value[0]
2838
+ ? "$" + value
2839
+ : value
2840
+ );
1953
2841
  if ("boolean" === typeof value) return value;
1954
2842
  if ("number" === typeof value) return serializeNumber(value);
1955
2843
  if ("undefined" === typeof value) return "$undefined";
@@ -2057,7 +2945,10 @@
2057
2945
  onFatalError(error);
2058
2946
  null !== request.destination
2059
2947
  ? ((request.status = CLOSED), request.destination.destroy(error))
2060
- : ((request.status = CLOSING), (request.fatalError = error));
2948
+ : ((request.status = 13), (request.fatalError = error));
2949
+ request.cacheController.abort(
2950
+ Error("The render was aborted due to a fatal error.", { cause: error })
2951
+ );
2061
2952
  }
2062
2953
  function serializeErrorValue(request, error) {
2063
2954
  var name = "Error",
@@ -2065,7 +2956,7 @@
2065
2956
  try {
2066
2957
  name = error.name;
2067
2958
  var message = String(error.message);
2068
- var stack = filterStackTrace(request, error, 0);
2959
+ var stack = filterStackTrace(request, parseStackTrace(error, 0));
2069
2960
  var errorEnv = error.environmentName;
2070
2961
  "string" === typeof errorEnv && (env = errorEnv);
2071
2962
  } catch (x) {
@@ -2083,14 +2974,14 @@
2083
2974
  }).toString(16)
2084
2975
  );
2085
2976
  }
2086
- function emitErrorChunk(request, id, digest, error) {
2977
+ function emitErrorChunk(request, id, digest, error, debug, owner) {
2087
2978
  var name = "Error",
2088
2979
  env = (0, request.environmentName)();
2089
2980
  try {
2090
2981
  if (error instanceof Error) {
2091
2982
  name = error.name;
2092
2983
  var message = String(error.message);
2093
- var stack = filterStackTrace(request, error, 0);
2984
+ var stack = filterStackTrace(request, parseStackTrace(error, 0));
2094
2985
  var errorEnv = error.environmentName;
2095
2986
  "string" === typeof errorEnv && (env = errorEnv);
2096
2987
  } else
@@ -2104,67 +2995,178 @@
2104
2995
  "An error occurred but serializing the error message failed."),
2105
2996
  (stack = []);
2106
2997
  }
2998
+ error = null == owner ? null : outlineComponentInfo(request, owner);
2107
2999
  digest = {
2108
3000
  digest: digest,
2109
3001
  name: name,
2110
3002
  message: message,
2111
3003
  stack: stack,
2112
- env: env
3004
+ env: env,
3005
+ owner: error
2113
3006
  };
2114
3007
  id = id.toString(16) + ":E" + stringify(digest) + "\n";
2115
- request.completedErrorChunks.push(id);
3008
+ debug
3009
+ ? request.completedDebugChunks.push(id)
3010
+ : request.completedErrorChunks.push(id);
3011
+ }
3012
+ function emitImportChunk(request, id, clientReferenceMetadata, debug) {
3013
+ clientReferenceMetadata = stringify(clientReferenceMetadata);
3014
+ id = id.toString(16) + ":I" + clientReferenceMetadata + "\n";
3015
+ debug
3016
+ ? request.completedDebugChunks.push(id)
3017
+ : request.completedImportChunks.push(id);
2116
3018
  }
2117
3019
  function emitSymbolChunk(request, id, name) {
2118
3020
  id = encodeReferenceChunk(request, id, "$S" + name);
2119
3021
  request.completedImportChunks.push(id);
2120
3022
  }
2121
- function emitModelChunk(request, id, json) {
2122
- id = id.toString(16) + ":" + json + "\n";
2123
- request.completedRegularChunks.push(id);
3023
+ function emitDebugHaltChunk(request, id) {
3024
+ id = id.toString(16) + ":\n";
3025
+ request.completedDebugChunks.push(id);
2124
3026
  }
2125
3027
  function emitDebugChunk(request, id, debugInfo) {
2126
- var counter = { objectLimit: 500 };
2127
- debugInfo = stringify(debugInfo, function (parentPropertyName, value) {
2128
- return renderConsoleValue(
2129
- request,
2130
- counter,
2131
- this,
2132
- parentPropertyName,
2133
- value
2134
- );
2135
- });
2136
- id = id.toString(16) + ":D" + debugInfo + "\n";
2137
- request.completedRegularChunks.push(id);
3028
+ var json = serializeDebugModel(request, 500, debugInfo);
3029
+ null !== request.debugDestination
3030
+ ? ((debugInfo = request.nextChunkId++),
3031
+ (json = debugInfo.toString(16) + ":" + json + "\n"),
3032
+ request.pendingDebugChunks++,
3033
+ request.completedDebugChunks.push(json),
3034
+ (id = id.toString(16) + ':D"$' + debugInfo.toString(16) + '"\n'),
3035
+ request.completedRegularChunks.push(id))
3036
+ : ((id = id.toString(16) + ":D" + json + "\n"),
3037
+ request.completedRegularChunks.push(id));
2138
3038
  }
2139
3039
  function outlineComponentInfo(request, componentInfo) {
2140
- if (!request.writtenObjects.has(componentInfo)) {
2141
- null != componentInfo.owner &&
2142
- outlineComponentInfo(request, componentInfo.owner);
2143
- var objectLimit = 10;
2144
- null != componentInfo.stack &&
2145
- (objectLimit += componentInfo.stack.length);
2146
- objectLimit = { objectLimit: objectLimit };
2147
- var componentDebugInfo = {
2148
- name: componentInfo.name,
2149
- env: componentInfo.env,
2150
- key: componentInfo.key,
2151
- owner: componentInfo.owner
2152
- };
2153
- componentDebugInfo.stack = componentInfo.stack;
2154
- componentDebugInfo.props = componentInfo.props;
2155
- objectLimit = outlineConsoleValue(
2156
- request,
2157
- objectLimit,
2158
- componentDebugInfo
2159
- );
2160
- request.writtenObjects.set(
2161
- componentInfo,
2162
- serializeByValueID(objectLimit)
2163
- );
3040
+ var existingRef = request.writtenDebugObjects.get(componentInfo);
3041
+ if (void 0 !== existingRef) return existingRef;
3042
+ null != componentInfo.owner &&
3043
+ outlineComponentInfo(request, componentInfo.owner);
3044
+ existingRef = 10;
3045
+ null != componentInfo.stack &&
3046
+ (existingRef += componentInfo.stack.length);
3047
+ existingRef = { objectLimit: existingRef };
3048
+ var componentDebugInfo = {
3049
+ name: componentInfo.name,
3050
+ key: componentInfo.key
3051
+ };
3052
+ null != componentInfo.env && (componentDebugInfo.env = componentInfo.env);
3053
+ null != componentInfo.owner &&
3054
+ (componentDebugInfo.owner = componentInfo.owner);
3055
+ null == componentInfo.stack && null != componentInfo.debugStack
3056
+ ? (componentDebugInfo.stack = filterStackTrace(
3057
+ request,
3058
+ parseStackTrace(componentInfo.debugStack, 1)
3059
+ ))
3060
+ : null != componentInfo.stack &&
3061
+ (componentDebugInfo.stack = componentInfo.stack);
3062
+ componentDebugInfo.props = componentInfo.props;
3063
+ existingRef = outlineDebugModel(request, existingRef, componentDebugInfo);
3064
+ existingRef = serializeByValueID(existingRef);
3065
+ request.writtenDebugObjects.set(componentInfo, existingRef);
3066
+ request.writtenObjects.set(componentInfo, existingRef);
3067
+ return existingRef;
3068
+ }
3069
+ function emitIOInfoChunk(
3070
+ request,
3071
+ id,
3072
+ name,
3073
+ start,
3074
+ end,
3075
+ value,
3076
+ env,
3077
+ owner,
3078
+ stack
3079
+ ) {
3080
+ var objectLimit = 10;
3081
+ stack && (objectLimit += stack.length);
3082
+ name = {
3083
+ name: name,
3084
+ start: start - request.timeOrigin,
3085
+ end: end - request.timeOrigin
3086
+ };
3087
+ null != env && (name.env = env);
3088
+ null != stack && (name.stack = stack);
3089
+ null != owner && (name.owner = owner);
3090
+ void 0 !== value && (name.value = value);
3091
+ value = serializeDebugModel(request, objectLimit, name);
3092
+ id = id.toString(16) + ":J" + value + "\n";
3093
+ request.completedDebugChunks.push(id);
3094
+ }
3095
+ function serializeIONode(request, ioNode, promiseRef) {
3096
+ var existingRef = request.writtenDebugObjects.get(ioNode);
3097
+ if (void 0 !== existingRef) return existingRef;
3098
+ existingRef = null;
3099
+ var name = "";
3100
+ if (null !== ioNode.stack) {
3101
+ a: {
3102
+ existingRef = ioNode.stack;
3103
+ for (name = 0; name < existingRef.length; name++) {
3104
+ var callsite = existingRef[name];
3105
+ if (!isPromiseCreationInternal(callsite[1], callsite[0])) {
3106
+ name = 0 < name ? existingRef.slice(name) : existingRef;
3107
+ break a;
3108
+ }
3109
+ }
3110
+ name = [];
3111
+ }
3112
+ existingRef = filterStackTrace(request, name);
3113
+ a: {
3114
+ callsite = "";
3115
+ for (
3116
+ var filterStackFrame = request.filterStackFrame, i = 0;
3117
+ i < name.length;
3118
+ i++
3119
+ ) {
3120
+ var callsite$jscomp$0 = name[i],
3121
+ functionName = callsite$jscomp$0[0],
3122
+ url = devirtualizeURL(callsite$jscomp$0[1]);
3123
+ if (
3124
+ filterStackFrame(
3125
+ url,
3126
+ functionName,
3127
+ callsite$jscomp$0[2],
3128
+ callsite$jscomp$0[3]
3129
+ )
3130
+ ) {
3131
+ if ("" === callsite) {
3132
+ name = functionName;
3133
+ break a;
3134
+ }
3135
+ name = callsite;
3136
+ break a;
3137
+ } else callsite = functionName;
3138
+ }
3139
+ name = "";
3140
+ }
3141
+ name.startsWith("Window.")
3142
+ ? (name = name.slice(7))
3143
+ : name.startsWith("<anonymous>.") && (name = name.slice(7));
2164
3144
  }
3145
+ callsite = ioNode.owner;
3146
+ null != callsite && outlineComponentInfo(request, callsite);
3147
+ filterStackFrame = void 0;
3148
+ null !== promiseRef && (filterStackFrame = promiseRef.deref());
3149
+ promiseRef = (0, request.environmentName)();
3150
+ i = 3 === ioNode.tag ? request.abortTime : ioNode.end;
3151
+ request.pendingDebugChunks++;
3152
+ callsite$jscomp$0 = request.nextChunkId++;
3153
+ emitIOInfoChunk(
3154
+ request,
3155
+ callsite$jscomp$0,
3156
+ name,
3157
+ ioNode.start,
3158
+ i,
3159
+ filterStackFrame,
3160
+ promiseRef,
3161
+ callsite,
3162
+ existingRef
3163
+ );
3164
+ promiseRef = serializeByValueID(callsite$jscomp$0);
3165
+ request.writtenDebugObjects.set(ioNode, promiseRef);
3166
+ return promiseRef;
2165
3167
  }
2166
- function emitTypedArrayChunk(request, id, tag, typedArray) {
2167
- request.pendingChunks++;
3168
+ function emitTypedArrayChunk(request, id, tag, typedArray, debug) {
3169
+ debug ? request.pendingDebugChunks++ : request.pendingChunks++;
2168
3170
  typedArray = new Uint8Array(
2169
3171
  typedArray.buffer,
2170
3172
  typedArray.byteOffset,
@@ -2172,19 +3174,23 @@
2172
3174
  );
2173
3175
  var binaryLength = typedArray.byteLength;
2174
3176
  id = id.toString(16) + ":" + tag + binaryLength.toString(16) + ",";
2175
- request.completedRegularChunks.push(id, typedArray);
3177
+ debug
3178
+ ? request.completedDebugChunks.push(id, typedArray)
3179
+ : request.completedRegularChunks.push(id, typedArray);
2176
3180
  }
2177
- function emitTextChunk(request, id, text) {
3181
+ function emitTextChunk(request, id, text, debug) {
2178
3182
  if (null === byteLengthOfChunk)
2179
3183
  throw Error(
2180
3184
  "Existence of byteLengthOfChunk should have already been checked. This is a bug in React."
2181
3185
  );
2182
- request.pendingChunks++;
3186
+ debug ? request.pendingDebugChunks++ : request.pendingChunks++;
2183
3187
  var binaryLength = byteLengthOfChunk(text);
2184
3188
  id = id.toString(16) + ":T" + binaryLength.toString(16) + ",";
2185
- request.completedRegularChunks.push(id, text);
3189
+ debug
3190
+ ? request.completedDebugChunks.push(id, text)
3191
+ : request.completedRegularChunks.push(id, text);
2186
3192
  }
2187
- function renderConsoleValue(
3193
+ function renderDebugModel(
2188
3194
  request,
2189
3195
  counter,
2190
3196
  parent,
@@ -2195,21 +3201,80 @@
2195
3201
  if (value === REACT_ELEMENT_TYPE) return "$";
2196
3202
  if ("object" === typeof value) {
2197
3203
  if (isClientReference(value))
2198
- return serializeClientReference(
3204
+ return serializeDebugClientReference(
2199
3205
  request,
2200
3206
  parent,
2201
3207
  parentPropertyName,
2202
3208
  value
2203
3209
  );
2204
- if (
2205
- void 0 !== request.temporaryReferences &&
2206
- ((parent = request.temporaryReferences.get(value)), void 0 !== parent)
2207
- )
2208
- return "$T" + parent;
3210
+ if (value.$$typeof === CONSTRUCTOR_MARKER) {
3211
+ value = value.constructor;
3212
+ var ref = request.writtenDebugObjects.get(value);
3213
+ void 0 === ref &&
3214
+ ((request = outlineDebugModel(request, counter, value)),
3215
+ (ref = serializeByValueID(request)));
3216
+ return "$P" + ref.slice(1);
3217
+ }
3218
+ if (void 0 !== request.temporaryReferences) {
3219
+ var tempRef = request.temporaryReferences.get(value);
3220
+ if (void 0 !== tempRef) return "$T" + tempRef;
3221
+ }
3222
+ tempRef = request.writtenDebugObjects;
3223
+ var existingDebugReference = tempRef.get(value);
3224
+ if (void 0 !== existingDebugReference)
3225
+ if (debugModelRoot === value) debugModelRoot = null;
3226
+ else return existingDebugReference;
3227
+ else if (-1 === parentPropertyName.indexOf(":"))
3228
+ if (
3229
+ ((existingDebugReference = tempRef.get(parent)),
3230
+ void 0 !== existingDebugReference)
3231
+ ) {
3232
+ if (0 >= counter.objectLimit && !doNotLimit.has(value))
3233
+ return serializeDeferredObject(request, value);
3234
+ var propertyName = parentPropertyName;
3235
+ if (isArrayImpl(parent) && parent[0] === REACT_ELEMENT_TYPE)
3236
+ switch (parentPropertyName) {
3237
+ case "1":
3238
+ propertyName = "type";
3239
+ break;
3240
+ case "2":
3241
+ propertyName = "key";
3242
+ break;
3243
+ case "3":
3244
+ propertyName = "props";
3245
+ break;
3246
+ case "4":
3247
+ propertyName = "_owner";
3248
+ }
3249
+ tempRef.set(value, existingDebugReference + ":" + propertyName);
3250
+ } else if (debugNoOutline !== value) {
3251
+ if ("function" === typeof value.then)
3252
+ return serializeDebugThenable(request, counter, value);
3253
+ request = outlineDebugModel(request, counter, value);
3254
+ return serializeByValueID(request);
3255
+ }
2209
3256
  parent = request.writtenObjects.get(value);
2210
3257
  if (void 0 !== parent) return parent;
2211
- if (0 >= counter.objectLimit && !doNotLimit.has(value)) return "$Y";
3258
+ if (0 >= counter.objectLimit && !doNotLimit.has(value))
3259
+ return serializeDeferredObject(request, value);
2212
3260
  counter.objectLimit--;
3261
+ parent = request.deferredDebugObjects;
3262
+ if (
3263
+ null !== parent &&
3264
+ ((parentPropertyName = parent.existing.get(value)),
3265
+ void 0 !== parentPropertyName)
3266
+ )
3267
+ return (
3268
+ parent.existing.delete(value),
3269
+ parent.retained.delete(parentPropertyName),
3270
+ emitOutlinedDebugModelChunk(
3271
+ request,
3272
+ parentPropertyName,
3273
+ counter,
3274
+ value
3275
+ ),
3276
+ serializeByValueID(parentPropertyName)
3277
+ );
2213
3278
  switch (value.$$typeof) {
2214
3279
  case REACT_ELEMENT_TYPE:
2215
3280
  null != value._owner && outlineComponentInfo(request, value._owner);
@@ -2224,7 +3289,10 @@
2224
3289
  counter = null;
2225
3290
  if (null != value._debugStack)
2226
3291
  for (
2227
- counter = filterStackTrace(request, value._debugStack, 1),
3292
+ counter = filterStackTrace(
3293
+ request,
3294
+ parseStackTrace(value._debugStack, 1)
3295
+ ),
2228
3296
  doNotLimit.add(counter),
2229
3297
  request = 0;
2230
3298
  request < counter.length;
@@ -2240,122 +3308,231 @@
2240
3308
  counter,
2241
3309
  value._store.validated
2242
3310
  ];
3311
+ case REACT_LAZY_TYPE:
3312
+ value = value._payload;
3313
+ if (null !== value && "object" === typeof value) {
3314
+ switch (value._status) {
3315
+ case 1:
3316
+ return (
3317
+ (request = outlineDebugModel(
3318
+ request,
3319
+ counter,
3320
+ value._result
3321
+ )),
3322
+ serializeLazyID(request)
3323
+ );
3324
+ case 2:
3325
+ return (
3326
+ (counter = request.nextChunkId++),
3327
+ emitErrorChunk(
3328
+ request,
3329
+ counter,
3330
+ "",
3331
+ value._result,
3332
+ !0,
3333
+ null
3334
+ ),
3335
+ serializeLazyID(counter)
3336
+ );
3337
+ }
3338
+ switch (value.status) {
3339
+ case "fulfilled":
3340
+ return (
3341
+ (request = outlineDebugModel(
3342
+ request,
3343
+ counter,
3344
+ value.value
3345
+ )),
3346
+ serializeLazyID(request)
3347
+ );
3348
+ case "rejected":
3349
+ return (
3350
+ (counter = request.nextChunkId++),
3351
+ emitErrorChunk(
3352
+ request,
3353
+ counter,
3354
+ "",
3355
+ value.reason,
3356
+ !0,
3357
+ null
3358
+ ),
3359
+ serializeLazyID(counter)
3360
+ );
3361
+ }
3362
+ }
3363
+ request.pendingDebugChunks++;
3364
+ value = request.nextChunkId++;
3365
+ emitDebugHaltChunk(request, value);
3366
+ return serializeLazyID(value);
2243
3367
  }
2244
- if ("function" === typeof value.then) {
2245
- switch (value.status) {
2246
- case "fulfilled":
2247
- return (
2248
- "$@" +
2249
- outlineConsoleValue(request, counter, value.value).toString(16)
2250
- );
2251
- case "rejected":
2252
- return (
2253
- (counter = value.reason),
2254
- request.pendingChunks++,
2255
- (value = request.nextChunkId++),
2256
- emitErrorChunk(request, value, "", counter),
2257
- "$@" + value.toString(16)
2258
- );
2259
- }
2260
- return "$@";
2261
- }
3368
+ if ("function" === typeof value.then)
3369
+ return serializeDebugThenable(request, counter, value);
2262
3370
  if (isArrayImpl(value)) return value;
2263
3371
  if (value instanceof Map) {
2264
3372
  value = Array.from(value);
2265
3373
  counter.objectLimit++;
2266
- for (parent = 0; parent < value.length; parent++) {
2267
- var entry = value[parent];
3374
+ for (ref = 0; ref < value.length; ref++) {
3375
+ var entry = value[ref];
2268
3376
  doNotLimit.add(entry);
2269
- parentPropertyName = entry[0];
3377
+ var key = entry[0];
2270
3378
  entry = entry[1];
2271
- "object" === typeof parentPropertyName &&
2272
- null !== parentPropertyName &&
2273
- doNotLimit.add(parentPropertyName);
3379
+ "object" === typeof key && null !== key && doNotLimit.add(key);
2274
3380
  "object" === typeof entry &&
2275
3381
  null !== entry &&
2276
3382
  doNotLimit.add(entry);
2277
3383
  }
2278
- return (
2279
- "$Q" + outlineConsoleValue(request, counter, value).toString(16)
2280
- );
3384
+ return "$Q" + outlineDebugModel(request, counter, value).toString(16);
2281
3385
  }
2282
3386
  if (value instanceof Set) {
2283
3387
  value = Array.from(value);
2284
3388
  counter.objectLimit++;
2285
- for (parent = 0; parent < value.length; parent++)
2286
- (parentPropertyName = value[parent]),
2287
- "object" === typeof parentPropertyName &&
2288
- null !== parentPropertyName &&
2289
- doNotLimit.add(parentPropertyName);
3389
+ for (ref = 0; ref < value.length; ref++)
3390
+ (key = value[ref]),
3391
+ "object" === typeof key && null !== key && doNotLimit.add(key);
3392
+ return "$W" + outlineDebugModel(request, counter, value).toString(16);
3393
+ }
3394
+ if ("function" === typeof FormData && value instanceof FormData)
2290
3395
  return (
2291
- "$W" + outlineConsoleValue(request, counter, value).toString(16)
3396
+ (value = Array.from(value.entries())),
3397
+ "$K" +
3398
+ outlineDebugModel(
3399
+ request,
3400
+ { objectLimit: 2 * value.length + 1 },
3401
+ value
3402
+ ).toString(16)
2292
3403
  );
3404
+ if (value instanceof Error) {
3405
+ counter = "Error";
3406
+ var env = (0, request.environmentName)();
3407
+ try {
3408
+ (counter = value.name),
3409
+ (ref = String(value.message)),
3410
+ (key = filterStackTrace(request, parseStackTrace(value, 0))),
3411
+ (entry = value.environmentName),
3412
+ "string" === typeof entry && (env = entry);
3413
+ } catch (x) {
3414
+ (ref =
3415
+ "An error occurred but serializing the error message failed."),
3416
+ (key = []);
3417
+ }
3418
+ request =
3419
+ "$Z" +
3420
+ outlineDebugModel(
3421
+ request,
3422
+ { objectLimit: 2 * key.length + 1 },
3423
+ { name: counter, message: ref, stack: key, env: env }
3424
+ ).toString(16);
3425
+ return request;
3426
+ }
3427
+ if (value instanceof ArrayBuffer)
3428
+ return serializeDebugTypedArray(request, "A", new Uint8Array(value));
3429
+ if (value instanceof Int8Array)
3430
+ return serializeDebugTypedArray(request, "O", value);
3431
+ if (value instanceof Uint8Array)
3432
+ return serializeDebugTypedArray(request, "o", value);
3433
+ if (value instanceof Uint8ClampedArray)
3434
+ return serializeDebugTypedArray(request, "U", value);
3435
+ if (value instanceof Int16Array)
3436
+ return serializeDebugTypedArray(request, "S", value);
3437
+ if (value instanceof Uint16Array)
3438
+ return serializeDebugTypedArray(request, "s", value);
3439
+ if (value instanceof Int32Array)
3440
+ return serializeDebugTypedArray(request, "L", value);
3441
+ if (value instanceof Uint32Array)
3442
+ return serializeDebugTypedArray(request, "l", value);
3443
+ if (value instanceof Float32Array)
3444
+ return serializeDebugTypedArray(request, "G", value);
3445
+ if (value instanceof Float64Array)
3446
+ return serializeDebugTypedArray(request, "g", value);
3447
+ if (value instanceof BigInt64Array)
3448
+ return serializeDebugTypedArray(request, "M", value);
3449
+ if (value instanceof BigUint64Array)
3450
+ return serializeDebugTypedArray(request, "m", value);
3451
+ if (value instanceof DataView)
3452
+ return serializeDebugTypedArray(request, "V", value);
3453
+ if ("function" === typeof Blob && value instanceof Blob)
3454
+ return serializeDebugBlob(request, value);
3455
+ if (getIteratorFn(value)) return Array.from(value);
3456
+ request = getPrototypeOf(value);
3457
+ if (request !== ObjectPrototype && null !== request) {
3458
+ counter = Object.create(null);
3459
+ for (env in value)
3460
+ if (hasOwnProperty.call(value, env) || isGetter(request, env))
3461
+ counter[env] = value[env];
3462
+ ref = request.constructor;
3463
+ "function" !== typeof ref ||
3464
+ ref.prototype !== request ||
3465
+ hasOwnProperty.call(value, "") ||
3466
+ isGetter(request, "") ||
3467
+ (counter[""] = { $$typeof: CONSTRUCTOR_MARKER, constructor: ref });
3468
+ return counter;
2293
3469
  }
2294
- return "function" === typeof FormData && value instanceof FormData
2295
- ? serializeFormData(request, value)
2296
- : value instanceof Error
2297
- ? serializeErrorValue(request, value)
2298
- : value instanceof ArrayBuffer
2299
- ? serializeTypedArray(request, "A", new Uint8Array(value))
2300
- : value instanceof Int8Array
2301
- ? serializeTypedArray(request, "O", value)
2302
- : value instanceof Uint8Array
2303
- ? serializeTypedArray(request, "o", value)
2304
- : value instanceof Uint8ClampedArray
2305
- ? serializeTypedArray(request, "U", value)
2306
- : value instanceof Int16Array
2307
- ? serializeTypedArray(request, "S", value)
2308
- : value instanceof Uint16Array
2309
- ? serializeTypedArray(request, "s", value)
2310
- : value instanceof Int32Array
2311
- ? serializeTypedArray(request, "L", value)
2312
- : value instanceof Uint32Array
2313
- ? serializeTypedArray(request, "l", value)
2314
- : value instanceof Float32Array
2315
- ? serializeTypedArray(request, "G", value)
2316
- : value instanceof Float64Array
2317
- ? serializeTypedArray(request, "g", value)
2318
- : value instanceof BigInt64Array
2319
- ? serializeTypedArray(request, "M", value)
2320
- : value instanceof BigUint64Array
2321
- ? serializeTypedArray(request, "m", value)
2322
- : value instanceof DataView
2323
- ? serializeTypedArray(request, "V", value)
2324
- : "function" === typeof Blob &&
2325
- value instanceof Blob
2326
- ? serializeBlob(request, value)
2327
- : getIteratorFn(value)
2328
- ? Array.from(value)
2329
- : value;
3470
+ return value;
2330
3471
  }
2331
- if ("string" === typeof value)
2332
- return "Z" === value[value.length - 1] &&
3472
+ if ("string" === typeof value) {
3473
+ if (
3474
+ "Z" === value[value.length - 1] &&
2333
3475
  parent[parentPropertyName] instanceof Date
2334
- ? "$D" + value
2335
- : 1024 <= value.length
2336
- ? serializeLargeTextString(request, value)
2337
- : "$" === value[0]
2338
- ? "$" + value
2339
- : value;
3476
+ )
3477
+ return "$D" + value;
3478
+ if (1024 <= value.length) {
3479
+ if (0 >= counter.objectLimit)
3480
+ return serializeDeferredObject(request, value);
3481
+ counter.objectLimit--;
3482
+ request.pendingDebugChunks++;
3483
+ counter = request.nextChunkId++;
3484
+ emitTextChunk(request, counter, value, !0);
3485
+ return serializeByValueID(counter);
3486
+ }
3487
+ return "$" === value[0] ? "$" + value : value;
3488
+ }
2340
3489
  if ("boolean" === typeof value) return value;
2341
3490
  if ("number" === typeof value) return serializeNumber(value);
2342
3491
  if ("undefined" === typeof value) return "$undefined";
2343
- if ("function" === typeof value)
2344
- return isClientReference(value)
2345
- ? serializeClientReference(request, parent, parentPropertyName, value)
2346
- : void 0 !== request.temporaryReferences &&
2347
- ((request = request.temporaryReferences.get(value)),
2348
- void 0 !== request)
2349
- ? "$T" + request
2350
- : "$E(" + (Function.prototype.toString.call(value) + ")");
3492
+ if ("function" === typeof value) {
3493
+ if (isClientReference(value))
3494
+ return serializeDebugClientReference(
3495
+ request,
3496
+ parent,
3497
+ parentPropertyName,
3498
+ value
3499
+ );
3500
+ if (
3501
+ void 0 !== request.temporaryReferences &&
3502
+ ((counter = request.temporaryReferences.get(value)),
3503
+ void 0 !== counter)
3504
+ )
3505
+ return "$T" + counter;
3506
+ counter = request.writtenDebugObjects;
3507
+ ref = counter.get(value);
3508
+ if (void 0 !== ref) return ref;
3509
+ ref = Function.prototype.toString.call(value);
3510
+ key = value.name;
3511
+ key =
3512
+ "$E" +
3513
+ ("string" === typeof key
3514
+ ? "Object.defineProperty(" +
3515
+ ref +
3516
+ ',"name",{value:' +
3517
+ JSON.stringify(key) +
3518
+ "})"
3519
+ : "(" + ref + ")");
3520
+ request.pendingDebugChunks++;
3521
+ ref = request.nextChunkId++;
3522
+ key = encodeReferenceChunk(request, ref, key);
3523
+ request.completedDebugChunks.push(key);
3524
+ request = serializeByValueID(ref);
3525
+ counter.set(value, request);
3526
+ return request;
3527
+ }
2351
3528
  if ("symbol" === typeof value) {
2352
3529
  counter = request.writtenSymbols.get(value);
2353
3530
  if (void 0 !== counter) return serializeByValueID(counter);
2354
- counter = value.description;
3531
+ value = value.description;
2355
3532
  request.pendingChunks++;
2356
- value = request.nextChunkId++;
2357
- emitSymbolChunk(request, value, counter);
2358
- return serializeByValueID(value);
3533
+ counter = request.nextChunkId++;
3534
+ emitSymbolChunk(request, counter, value);
3535
+ return serializeByValueID(counter);
2359
3536
  }
2360
3537
  return "bigint" === typeof value
2361
3538
  ? "$n" + value.toString(10)
@@ -2363,10 +3540,10 @@
2363
3540
  ? "$D" + value.toJSON()
2364
3541
  : "unknown type " + typeof value;
2365
3542
  }
2366
- function outlineConsoleValue(request, counter, model) {
3543
+ function serializeDebugModel(request, objectLimit, model) {
2367
3544
  function replacer(parentPropertyName, value) {
2368
3545
  try {
2369
- return renderConsoleValue(
3546
+ return renderDebugModel(
2370
3547
  request,
2371
3548
  counter,
2372
3549
  this,
@@ -2380,25 +3557,24 @@
2380
3557
  );
2381
3558
  }
2382
3559
  }
2383
- "object" === typeof model && null !== model && doNotLimit.add(model);
3560
+ var counter = { objectLimit: objectLimit };
3561
+ objectLimit = debugNoOutline;
3562
+ debugNoOutline = model;
2384
3563
  try {
2385
- var json = stringify(model, replacer);
3564
+ return stringify(model, replacer);
2386
3565
  } catch (x) {
2387
- json = stringify(
3566
+ return stringify(
2388
3567
  "Unknown Value: React could not send it from the server.\n" +
2389
3568
  x.message
2390
3569
  );
3570
+ } finally {
3571
+ debugNoOutline = objectLimit;
2391
3572
  }
2392
- request.pendingChunks++;
2393
- model = request.nextChunkId++;
2394
- json = model.toString(16) + ":" + json + "\n";
2395
- request.completedRegularChunks.push(json);
2396
- return model;
2397
3573
  }
2398
- function emitConsoleChunk(request, methodName, owner, stackTrace, args) {
3574
+ function emitOutlinedDebugModelChunk(request, id, counter, model) {
2399
3575
  function replacer(parentPropertyName, value) {
2400
3576
  try {
2401
- return renderConsoleValue(
3577
+ return renderDebugModel(
2402
3578
  request,
2403
3579
  counter,
2404
3580
  this,
@@ -2412,82 +3588,247 @@
2412
3588
  );
2413
3589
  }
2414
3590
  }
2415
- var counter = { objectLimit: 500 };
2416
- null != owner && outlineComponentInfo(request, owner);
2417
- var env = (0, request.environmentName)(),
2418
- payload = [methodName, stackTrace, owner, env];
2419
- payload.push.apply(payload, args);
3591
+ "object" === typeof model && null !== model && doNotLimit.add(model);
3592
+ var prevModelRoot = debugModelRoot;
3593
+ debugModelRoot = model;
3594
+ "object" === typeof model &&
3595
+ null !== model &&
3596
+ request.writtenDebugObjects.set(model, serializeByValueID(id));
2420
3597
  try {
2421
- var json = stringify(payload, replacer);
3598
+ var json = stringify(model, replacer);
2422
3599
  } catch (x) {
2423
3600
  json = stringify(
2424
- [
2425
- methodName,
2426
- stackTrace,
2427
- owner,
2428
- env,
2429
- "Unknown Value: React could not send it from the server.",
2430
- x
2431
- ],
2432
- replacer
3601
+ "Unknown Value: React could not send it from the server.\n" +
3602
+ x.message
2433
3603
  );
3604
+ } finally {
3605
+ debugModelRoot = prevModelRoot;
2434
3606
  }
2435
- request.completedRegularChunks.push(":W" + json + "\n");
3607
+ id = id.toString(16) + ":" + json + "\n";
3608
+ request.completedDebugChunks.push(id);
2436
3609
  }
2437
- function forwardDebugInfo(request, id, debugInfo) {
2438
- for (var i = 0; i < debugInfo.length; i++)
2439
- "number" !== typeof debugInfo[i].time &&
2440
- (request.pendingChunks++,
2441
- "string" === typeof debugInfo[i].name &&
2442
- outlineComponentInfo(request, debugInfo[i]),
2443
- emitDebugChunk(request, id, debugInfo[i]));
3610
+ function outlineDebugModel(request, counter, model) {
3611
+ var id = request.nextChunkId++;
3612
+ request.pendingDebugChunks++;
3613
+ emitOutlinedDebugModelChunk(request, id, counter, model);
3614
+ return id;
3615
+ }
3616
+ function emitTimeOriginChunk(request, timeOrigin) {
3617
+ request.pendingDebugChunks++;
3618
+ request.completedDebugChunks.push(":N" + timeOrigin + "\n");
3619
+ }
3620
+ function forwardDebugInfo(request$jscomp$0, task, debugInfo) {
3621
+ for (var id = task.id, i = 0; i < debugInfo.length; i++) {
3622
+ var info = debugInfo[i];
3623
+ if ("number" === typeof info.time)
3624
+ markOperationEndTime(request$jscomp$0, task, info.time);
3625
+ else if ("string" === typeof info.name)
3626
+ outlineComponentInfo(request$jscomp$0, info),
3627
+ request$jscomp$0.pendingChunks++,
3628
+ emitDebugChunk(request$jscomp$0, id, info);
3629
+ else if (info.awaited) {
3630
+ var ioInfo = info.awaited;
3631
+ if (!(ioInfo.end <= request$jscomp$0.timeOrigin)) {
3632
+ var request = request$jscomp$0,
3633
+ ioInfo$jscomp$0 = ioInfo;
3634
+ if (!request.writtenObjects.has(ioInfo$jscomp$0)) {
3635
+ request.pendingDebugChunks++;
3636
+ var id$jscomp$0 = request.nextChunkId++,
3637
+ owner = ioInfo$jscomp$0.owner;
3638
+ null != owner && outlineComponentInfo(request, owner);
3639
+ var debugStack =
3640
+ null == ioInfo$jscomp$0.stack &&
3641
+ null != ioInfo$jscomp$0.debugStack
3642
+ ? filterStackTrace(
3643
+ request,
3644
+ parseStackTrace(ioInfo$jscomp$0.debugStack, 1)
3645
+ )
3646
+ : ioInfo$jscomp$0.stack;
3647
+ emitIOInfoChunk(
3648
+ request,
3649
+ id$jscomp$0,
3650
+ ioInfo$jscomp$0.name,
3651
+ ioInfo$jscomp$0.start,
3652
+ ioInfo$jscomp$0.end,
3653
+ ioInfo$jscomp$0.value,
3654
+ ioInfo$jscomp$0.env,
3655
+ owner,
3656
+ debugStack
3657
+ );
3658
+ request.writtenDebugObjects.set(
3659
+ ioInfo$jscomp$0,
3660
+ serializeByValueID(id$jscomp$0)
3661
+ );
3662
+ }
3663
+ null != info.owner &&
3664
+ outlineComponentInfo(request$jscomp$0, info.owner);
3665
+ debugStack =
3666
+ null == info.stack && null != info.debugStack
3667
+ ? filterStackTrace(
3668
+ request$jscomp$0,
3669
+ parseStackTrace(info.debugStack, 1)
3670
+ )
3671
+ : info.stack;
3672
+ ioInfo = { awaited: ioInfo };
3673
+ null != info.env && (ioInfo.env = info.env);
3674
+ null != info.owner && (ioInfo.owner = info.owner);
3675
+ null != debugStack && (ioInfo.stack = debugStack);
3676
+ request$jscomp$0.pendingChunks++;
3677
+ emitDebugChunk(request$jscomp$0, id, ioInfo);
3678
+ }
3679
+ } else
3680
+ request$jscomp$0.pendingChunks++,
3681
+ emitDebugChunk(request$jscomp$0, id, info);
3682
+ }
3683
+ }
3684
+ function forwardDebugInfoFromThenable(
3685
+ request,
3686
+ task,
3687
+ thenable,
3688
+ owner,
3689
+ stack
3690
+ ) {
3691
+ var debugInfo;
3692
+ (debugInfo = thenable._debugInfo) &&
3693
+ forwardDebugInfo(request, task, debugInfo);
3694
+ thenable = getAsyncSequenceFromPromise(thenable);
3695
+ null !== thenable &&
3696
+ emitAsyncSequence(request, task, thenable, debugInfo, owner, stack);
3697
+ }
3698
+ function forwardDebugInfoFromCurrentContext(request, task, thenable) {
3699
+ (thenable = thenable._debugInfo) &&
3700
+ forwardDebugInfo(request, task, thenable);
3701
+ var sequence = pendingOperations.get(async_hooks.executionAsyncId());
3702
+ sequence = void 0 === sequence ? null : sequence;
3703
+ null !== sequence &&
3704
+ emitAsyncSequence(request, task, sequence, thenable, null, null);
3705
+ }
3706
+ function forwardDebugInfoFromAbortedTask(request, task) {
3707
+ var model = task.model;
3708
+ if ("object" === typeof model && null !== model) {
3709
+ var debugInfo;
3710
+ (debugInfo = model._debugInfo) &&
3711
+ forwardDebugInfo(request, task, debugInfo);
3712
+ var thenable = null;
3713
+ "function" === typeof model.then
3714
+ ? (thenable = model)
3715
+ : model.$$typeof === REACT_LAZY_TYPE &&
3716
+ ((model = model._payload),
3717
+ "function" === typeof model.then && (thenable = model));
3718
+ if (
3719
+ null !== thenable &&
3720
+ ((model = getAsyncSequenceFromPromise(thenable)), null !== model)
3721
+ ) {
3722
+ for (
3723
+ thenable = model;
3724
+ 4 === thenable.tag && null !== thenable.awaited;
3725
+
3726
+ )
3727
+ thenable = thenable.awaited;
3728
+ 3 === thenable.tag
3729
+ ? (serializeIONode(request, thenable, null),
3730
+ request.pendingChunks++,
3731
+ (debugInfo = (0, request.environmentName)()),
3732
+ (debugInfo = { awaited: thenable, env: debugInfo }),
3733
+ advanceTaskTime(request, task, task.time),
3734
+ emitDebugChunk(request, task.id, debugInfo))
3735
+ : emitAsyncSequence(request, task, model, debugInfo, null, null);
3736
+ }
3737
+ }
3738
+ }
3739
+ function emitTimingChunk(request, id, timestamp) {
3740
+ request.pendingChunks++;
3741
+ var json = '{"time":' + (timestamp - request.timeOrigin) + "}";
3742
+ null !== request.debugDestination
3743
+ ? ((timestamp = request.nextChunkId++),
3744
+ (json = timestamp.toString(16) + ":" + json + "\n"),
3745
+ request.pendingDebugChunks++,
3746
+ request.completedDebugChunks.push(json),
3747
+ (id = id.toString(16) + ':D"$' + timestamp.toString(16) + '"\n'),
3748
+ request.completedRegularChunks.push(id))
3749
+ : ((id = id.toString(16) + ":D" + json + "\n"),
3750
+ request.completedRegularChunks.push(id));
3751
+ }
3752
+ function advanceTaskTime(request, task, timestamp) {
3753
+ timestamp > task.time
3754
+ ? (emitTimingChunk(request, task.id, timestamp),
3755
+ (task.time = timestamp))
3756
+ : task.timed || emitTimingChunk(request, task.id, task.time);
3757
+ task.timed = !0;
3758
+ }
3759
+ function markOperationEndTime(request, task, timestamp) {
3760
+ (request.status === ABORTING && timestamp > request.abortTime) ||
3761
+ (timestamp > task.time
3762
+ ? (emitTimingChunk(request, task.id, timestamp),
3763
+ (task.time = timestamp))
3764
+ : emitTimingChunk(request, task.id, task.time));
2444
3765
  }
2445
3766
  function emitChunk(request, task, value) {
2446
3767
  var id = task.id;
2447
3768
  "string" === typeof value && null !== byteLengthOfChunk
2448
- ? emitTextChunk(request, id, value)
3769
+ ? emitTextChunk(request, id, value, !1)
2449
3770
  : value instanceof ArrayBuffer
2450
- ? emitTypedArrayChunk(request, id, "A", new Uint8Array(value))
3771
+ ? emitTypedArrayChunk(request, id, "A", new Uint8Array(value), !1)
2451
3772
  : value instanceof Int8Array
2452
- ? emitTypedArrayChunk(request, id, "O", value)
3773
+ ? emitTypedArrayChunk(request, id, "O", value, !1)
2453
3774
  : value instanceof Uint8Array
2454
- ? emitTypedArrayChunk(request, id, "o", value)
3775
+ ? emitTypedArrayChunk(request, id, "o", value, !1)
2455
3776
  : value instanceof Uint8ClampedArray
2456
- ? emitTypedArrayChunk(request, id, "U", value)
3777
+ ? emitTypedArrayChunk(request, id, "U", value, !1)
2457
3778
  : value instanceof Int16Array
2458
- ? emitTypedArrayChunk(request, id, "S", value)
3779
+ ? emitTypedArrayChunk(request, id, "S", value, !1)
2459
3780
  : value instanceof Uint16Array
2460
- ? emitTypedArrayChunk(request, id, "s", value)
3781
+ ? emitTypedArrayChunk(request, id, "s", value, !1)
2461
3782
  : value instanceof Int32Array
2462
- ? emitTypedArrayChunk(request, id, "L", value)
3783
+ ? emitTypedArrayChunk(request, id, "L", value, !1)
2463
3784
  : value instanceof Uint32Array
2464
- ? emitTypedArrayChunk(request, id, "l", value)
3785
+ ? emitTypedArrayChunk(request, id, "l", value, !1)
2465
3786
  : value instanceof Float32Array
2466
- ? emitTypedArrayChunk(request, id, "G", value)
3787
+ ? emitTypedArrayChunk(request, id, "G", value, !1)
2467
3788
  : value instanceof Float64Array
2468
- ? emitTypedArrayChunk(request, id, "g", value)
3789
+ ? emitTypedArrayChunk(request, id, "g", value, !1)
2469
3790
  : value instanceof BigInt64Array
2470
- ? emitTypedArrayChunk(request, id, "M", value)
3791
+ ? emitTypedArrayChunk(request, id, "M", value, !1)
2471
3792
  : value instanceof BigUint64Array
2472
- ? emitTypedArrayChunk(request, id, "m", value)
3793
+ ? emitTypedArrayChunk(
3794
+ request,
3795
+ id,
3796
+ "m",
3797
+ value,
3798
+ !1
3799
+ )
2473
3800
  : value instanceof DataView
2474
- ? emitTypedArrayChunk(request, id, "V", value)
3801
+ ? emitTypedArrayChunk(
3802
+ request,
3803
+ id,
3804
+ "V",
3805
+ value,
3806
+ !1
3807
+ )
2475
3808
  : ((value = stringify(value, task.toJSON)),
2476
- emitModelChunk(request, task.id, value));
3809
+ (task =
3810
+ task.id.toString(16) +
3811
+ ":" +
3812
+ value +
3813
+ "\n"),
3814
+ request.completedRegularChunks.push(task));
2477
3815
  }
2478
3816
  function erroredTask(request, task, error) {
2479
- request.abortableTasks.delete(task);
2480
- task.status = ERRORED$1;
3817
+ task.timed && markOperationEndTime(request, task, performance.now());
3818
+ task.status = 4;
2481
3819
  var digest = logRecoverableError(request, error, task);
2482
- emitErrorChunk(request, task.id, digest, error);
3820
+ emitErrorChunk(request, task.id, digest, error, !1, task.debugOwner);
3821
+ request.abortableTasks.delete(task);
3822
+ callOnAllReadyIfReady(request);
2483
3823
  }
2484
3824
  function retryTask(request, task) {
2485
- if (task.status === PENDING$1) {
2486
- var prevDebugID = debugID;
2487
- task.status = RENDERING;
3825
+ if (0 === task.status) {
3826
+ var prevCanEmitDebugInfo = canEmitDebugInfo;
3827
+ task.status = 5;
3828
+ var parentSerializedSize = serializedSize;
2488
3829
  try {
2489
3830
  modelRoot = task.model;
2490
- debugID = task.id;
3831
+ canEmitDebugInfo = !0;
2491
3832
  var resolvedModel = renderModelDestructive(
2492
3833
  request,
2493
3834
  task,
@@ -2495,7 +3836,7 @@
2495
3836
  "",
2496
3837
  task.model
2497
3838
  );
2498
- debugID = null;
3839
+ canEmitDebugInfo = !1;
2499
3840
  modelRoot = resolvedModel;
2500
3841
  task.keyPath = null;
2501
3842
  task.implicitSlot = !1;
@@ -2503,6 +3844,7 @@
2503
3844
  currentEnv !== task.environmentName &&
2504
3845
  (request.pendingChunks++,
2505
3846
  emitDebugChunk(request, task.id, { env: currentEnv }));
3847
+ task.timed && markOperationEndTime(request, task, performance.now());
2506
3848
  if ("object" === typeof resolvedModel && null !== resolvedModel)
2507
3849
  request.writtenObjects.set(
2508
3850
  resolvedModel,
@@ -2510,18 +3852,27 @@
2510
3852
  ),
2511
3853
  emitChunk(request, task, resolvedModel);
2512
3854
  else {
2513
- var json = stringify(resolvedModel);
2514
- emitModelChunk(request, task.id, json);
3855
+ var json = stringify(resolvedModel),
3856
+ processedChunk = task.id.toString(16) + ":" + json + "\n";
3857
+ request.completedRegularChunks.push(processedChunk);
2515
3858
  }
3859
+ task.status = 1;
2516
3860
  request.abortableTasks.delete(task);
2517
- task.status = COMPLETED;
3861
+ callOnAllReadyIfReady(request);
2518
3862
  } catch (thrownValue) {
2519
- if (request.status === ABORTING) {
2520
- request.abortableTasks.delete(task);
2521
- task.status = ABORTED;
2522
- var model = stringify(serializeByValueID(request.fatalError));
2523
- emitModelChunk(request, task.id, model);
2524
- } else {
3863
+ if (request.status === ABORTING)
3864
+ if (
3865
+ (request.abortableTasks.delete(task),
3866
+ (task.status = 0),
3867
+ 21 === request.type)
3868
+ )
3869
+ haltTask(task), finishHaltedTask(task, request);
3870
+ else {
3871
+ var errorId = request.fatalError;
3872
+ abortTask(task);
3873
+ finishAbortedTask(task, request, errorId);
3874
+ }
3875
+ else {
2525
3876
  var x =
2526
3877
  thrownValue === SuspenseException
2527
3878
  ? getSuspendedThenable()
@@ -2531,43 +3882,41 @@
2531
3882
  null !== x &&
2532
3883
  "function" === typeof x.then
2533
3884
  ) {
2534
- task.status = PENDING$1;
3885
+ task.status = 0;
2535
3886
  task.thenableState = getThenableStateAfterSuspending();
2536
3887
  var ping = task.ping;
2537
3888
  x.then(ping, ping);
2538
3889
  } else erroredTask(request, task, x);
2539
3890
  }
2540
3891
  } finally {
2541
- debugID = prevDebugID;
3892
+ (canEmitDebugInfo = prevCanEmitDebugInfo),
3893
+ (serializedSize = parentSerializedSize);
2542
3894
  }
2543
3895
  }
2544
3896
  }
2545
3897
  function tryStreamTask(request, task) {
2546
- var prevDebugID = debugID;
2547
- debugID = null;
3898
+ var prevCanEmitDebugInfo = canEmitDebugInfo;
3899
+ canEmitDebugInfo = !1;
3900
+ var parentSerializedSize = serializedSize;
2548
3901
  try {
2549
3902
  emitChunk(request, task, task.model);
2550
3903
  } finally {
2551
- debugID = prevDebugID;
3904
+ (serializedSize = parentSerializedSize),
3905
+ (canEmitDebugInfo = prevCanEmitDebugInfo);
2552
3906
  }
2553
3907
  }
2554
3908
  function performWork(request) {
3909
+ pendingOperations.delete(async_hooks.executionAsyncId());
2555
3910
  var prevDispatcher = ReactSharedInternalsServer.H;
2556
3911
  ReactSharedInternalsServer.H = HooksDispatcher;
2557
3912
  var prevRequest = currentRequest;
2558
3913
  currentRequest$1 = currentRequest = request;
2559
- var hadAbortableTasks = 0 < request.abortableTasks.size;
2560
3914
  try {
2561
3915
  var pingedTasks = request.pingedTasks;
2562
3916
  request.pingedTasks = [];
2563
3917
  for (var i = 0; i < pingedTasks.length; i++)
2564
3918
  retryTask(request, pingedTasks[i]);
2565
- null !== request.destination &&
2566
- flushCompletedChunks(request, request.destination);
2567
- if (hadAbortableTasks && 0 === request.abortableTasks.size) {
2568
- var onAllReady = request.onAllReady;
2569
- onAllReady();
2570
- }
3919
+ flushCompletedChunks(request);
2571
3920
  } catch (error) {
2572
3921
  logRecoverableError(request, error, null), fatalError(request, error);
2573
3922
  } finally {
@@ -2576,69 +3925,156 @@
2576
3925
  (currentRequest = prevRequest);
2577
3926
  }
2578
3927
  }
2579
- function flushCompletedChunks(request, destination) {
2580
- currentView = new Uint8Array(2048);
2581
- writtenBytes = 0;
2582
- destinationHasCapacity = !0;
2583
- try {
2584
- for (
2585
- var importsChunks = request.completedImportChunks, i = 0;
2586
- i < importsChunks.length;
2587
- i++
2588
- )
2589
- if (
2590
- (request.pendingChunks--,
2591
- !writeChunkAndReturn(destination, importsChunks[i]))
2592
- ) {
2593
- request.destination = null;
2594
- i++;
2595
- break;
2596
- }
2597
- importsChunks.splice(0, i);
2598
- var hintChunks = request.completedHintChunks;
2599
- for (i = 0; i < hintChunks.length; i++)
2600
- if (!writeChunkAndReturn(destination, hintChunks[i])) {
2601
- request.destination = null;
2602
- i++;
2603
- break;
2604
- }
2605
- hintChunks.splice(0, i);
2606
- var regularChunks = request.completedRegularChunks;
2607
- for (i = 0; i < regularChunks.length; i++)
2608
- if (
2609
- (request.pendingChunks--,
2610
- !writeChunkAndReturn(destination, regularChunks[i]))
2611
- ) {
2612
- request.destination = null;
2613
- i++;
2614
- break;
2615
- }
2616
- regularChunks.splice(0, i);
2617
- var errorChunks = request.completedErrorChunks;
2618
- for (i = 0; i < errorChunks.length; i++)
2619
- if (
2620
- (request.pendingChunks--,
2621
- !writeChunkAndReturn(destination, errorChunks[i]))
2622
- ) {
2623
- request.destination = null;
2624
- i++;
2625
- break;
3928
+ function abortTask(task) {
3929
+ 0 === task.status && (task.status = 3);
3930
+ }
3931
+ function finishAbortedTask(task, request, errorId) {
3932
+ 3 === task.status &&
3933
+ (forwardDebugInfoFromAbortedTask(request, task),
3934
+ task.timed && markOperationEndTime(request, task, request.abortTime),
3935
+ (errorId = serializeByValueID(errorId)),
3936
+ (task = encodeReferenceChunk(request, task.id, errorId)),
3937
+ request.completedErrorChunks.push(task));
3938
+ }
3939
+ function haltTask(task) {
3940
+ 0 === task.status && (task.status = 3);
3941
+ }
3942
+ function finishHaltedTask(task, request) {
3943
+ 3 === task.status &&
3944
+ (forwardDebugInfoFromAbortedTask(request, task),
3945
+ request.pendingChunks--);
3946
+ }
3947
+ function flushCompletedChunks(request) {
3948
+ if (null !== request.debugDestination) {
3949
+ var debugDestination = request.debugDestination;
3950
+ currentView = new Uint8Array(2048);
3951
+ writtenBytes = 0;
3952
+ destinationHasCapacity = !0;
3953
+ try {
3954
+ for (
3955
+ var debugChunks = request.completedDebugChunks, i = 0;
3956
+ i < debugChunks.length;
3957
+ i++
3958
+ )
3959
+ request.pendingDebugChunks--,
3960
+ writeChunkAndReturn(debugDestination, debugChunks[i]);
3961
+ debugChunks.splice(0, i);
3962
+ } finally {
3963
+ completeWriting(debugDestination);
3964
+ }
3965
+ flushBuffered(debugDestination);
3966
+ }
3967
+ debugDestination = request.destination;
3968
+ if (null !== debugDestination) {
3969
+ currentView = new Uint8Array(2048);
3970
+ writtenBytes = 0;
3971
+ destinationHasCapacity = !0;
3972
+ try {
3973
+ var importsChunks = request.completedImportChunks;
3974
+ for (
3975
+ debugChunks = 0;
3976
+ debugChunks < importsChunks.length;
3977
+ debugChunks++
3978
+ )
3979
+ if (
3980
+ (request.pendingChunks--,
3981
+ !writeChunkAndReturn(
3982
+ debugDestination,
3983
+ importsChunks[debugChunks]
3984
+ ))
3985
+ ) {
3986
+ request.destination = null;
3987
+ debugChunks++;
3988
+ break;
3989
+ }
3990
+ importsChunks.splice(0, debugChunks);
3991
+ var hintChunks = request.completedHintChunks;
3992
+ for (debugChunks = 0; debugChunks < hintChunks.length; debugChunks++)
3993
+ if (
3994
+ !writeChunkAndReturn(debugDestination, hintChunks[debugChunks])
3995
+ ) {
3996
+ request.destination = null;
3997
+ debugChunks++;
3998
+ break;
3999
+ }
4000
+ hintChunks.splice(0, debugChunks);
4001
+ if (null === request.debugDestination) {
4002
+ var _debugChunks = request.completedDebugChunks;
4003
+ for (
4004
+ debugChunks = 0;
4005
+ debugChunks < _debugChunks.length;
4006
+ debugChunks++
4007
+ )
4008
+ if (
4009
+ (request.pendingDebugChunks--,
4010
+ !writeChunkAndReturn(
4011
+ debugDestination,
4012
+ _debugChunks[debugChunks]
4013
+ ))
4014
+ ) {
4015
+ request.destination = null;
4016
+ debugChunks++;
4017
+ break;
4018
+ }
4019
+ _debugChunks.splice(0, debugChunks);
2626
4020
  }
2627
- errorChunks.splice(0, i);
2628
- } finally {
2629
- (request.flushScheduled = !1),
2630
- currentView &&
2631
- 0 < writtenBytes &&
2632
- destination.write(currentView.subarray(0, writtenBytes)),
2633
- (currentView = null),
2634
- (writtenBytes = 0),
2635
- (destinationHasCapacity = !0);
4021
+ var regularChunks = request.completedRegularChunks;
4022
+ for (
4023
+ debugChunks = 0;
4024
+ debugChunks < regularChunks.length;
4025
+ debugChunks++
4026
+ )
4027
+ if (
4028
+ (request.pendingChunks--,
4029
+ !writeChunkAndReturn(
4030
+ debugDestination,
4031
+ regularChunks[debugChunks]
4032
+ ))
4033
+ ) {
4034
+ request.destination = null;
4035
+ debugChunks++;
4036
+ break;
4037
+ }
4038
+ regularChunks.splice(0, debugChunks);
4039
+ var errorChunks = request.completedErrorChunks;
4040
+ for (debugChunks = 0; debugChunks < errorChunks.length; debugChunks++)
4041
+ if (
4042
+ (request.pendingChunks--,
4043
+ !writeChunkAndReturn(debugDestination, errorChunks[debugChunks]))
4044
+ ) {
4045
+ request.destination = null;
4046
+ debugChunks++;
4047
+ break;
4048
+ }
4049
+ errorChunks.splice(0, debugChunks);
4050
+ } finally {
4051
+ (request.flushScheduled = !1), completeWriting(debugDestination);
4052
+ }
4053
+ flushBuffered(debugDestination);
2636
4054
  }
2637
- "function" === typeof destination.flush && destination.flush();
2638
4055
  0 === request.pendingChunks &&
2639
- ((request.status = CLOSED),
2640
- destination.end(),
2641
- (request.destination = null));
4056
+ ((importsChunks = request.debugDestination),
4057
+ 0 === request.pendingDebugChunks
4058
+ ? (null !== importsChunks &&
4059
+ (importsChunks.end(), (request.debugDestination = null)),
4060
+ request.status < ABORTING &&
4061
+ request.cacheController.abort(
4062
+ Error(
4063
+ "This render completed successfully. All cacheSignals are now aborted to allow clean up of any unused resources."
4064
+ )
4065
+ ),
4066
+ null !== request.destination &&
4067
+ ((request.status = CLOSED),
4068
+ request.destination.end(),
4069
+ (request.destination = null)),
4070
+ null !== request.debugDestination &&
4071
+ (request.debugDestination.end(),
4072
+ (request.debugDestination = null)))
4073
+ : null !== importsChunks &&
4074
+ null !== request.destination &&
4075
+ ((request.status = CLOSED),
4076
+ request.destination.end(),
4077
+ (request.destination = null)));
2642
4078
  }
2643
4079
  function startWork(request) {
2644
4080
  request.flushScheduled = null !== request.destination;
@@ -2646,88 +4082,194 @@
2646
4082
  requestStorage.run(request, performWork, request);
2647
4083
  });
2648
4084
  setImmediate(function () {
2649
- request.status === OPENING && (request.status = 11);
4085
+ 10 === request.status && (request.status = 11);
2650
4086
  });
2651
4087
  }
2652
4088
  function enqueueFlush(request) {
2653
- !1 === request.flushScheduled &&
2654
- 0 === request.pingedTasks.length &&
2655
- null !== request.destination &&
4089
+ !1 !== request.flushScheduled ||
4090
+ 0 !== request.pingedTasks.length ||
4091
+ (null === request.destination && null === request.debugDestination) ||
2656
4092
  ((request.flushScheduled = !0),
2657
4093
  setImmediate(function () {
2658
4094
  request.flushScheduled = !1;
2659
- var destination = request.destination;
2660
- destination && flushCompletedChunks(request, destination);
4095
+ flushCompletedChunks(request);
2661
4096
  }));
2662
4097
  }
4098
+ function callOnAllReadyIfReady(request) {
4099
+ 0 === request.abortableTasks.size &&
4100
+ ((request = request.onAllReady), request());
4101
+ }
2663
4102
  function startFlowing(request, destination) {
2664
- if (request.status === CLOSING)
4103
+ if (13 === request.status)
2665
4104
  (request.status = CLOSED), destination.destroy(request.fatalError);
2666
4105
  else if (request.status !== CLOSED && null === request.destination) {
2667
4106
  request.destination = destination;
2668
4107
  try {
2669
- flushCompletedChunks(request, destination);
4108
+ flushCompletedChunks(request);
2670
4109
  } catch (error) {
2671
4110
  logRecoverableError(request, error, null), fatalError(request, error);
2672
4111
  }
2673
4112
  }
2674
4113
  }
4114
+ function startFlowingDebug(request, debugDestination) {
4115
+ if (13 === request.status)
4116
+ (request.status = CLOSED), debugDestination.destroy(request.fatalError);
4117
+ else if (request.status !== CLOSED && null === request.debugDestination) {
4118
+ request.debugDestination = debugDestination;
4119
+ try {
4120
+ flushCompletedChunks(request);
4121
+ } catch (error) {
4122
+ logRecoverableError(request, error, null), fatalError(request, error);
4123
+ }
4124
+ }
4125
+ }
4126
+ function finishHalt(request, abortedTasks) {
4127
+ try {
4128
+ abortedTasks.forEach(function (task) {
4129
+ return finishHaltedTask(task, request);
4130
+ });
4131
+ var onAllReady = request.onAllReady;
4132
+ onAllReady();
4133
+ flushCompletedChunks(request);
4134
+ } catch (error) {
4135
+ logRecoverableError(request, error, null), fatalError(request, error);
4136
+ }
4137
+ }
4138
+ function finishAbort(request, abortedTasks, errorId) {
4139
+ try {
4140
+ abortedTasks.forEach(function (task) {
4141
+ return finishAbortedTask(task, request, errorId);
4142
+ });
4143
+ var onAllReady = request.onAllReady;
4144
+ onAllReady();
4145
+ flushCompletedChunks(request);
4146
+ } catch (error) {
4147
+ logRecoverableError(request, error, null), fatalError(request, error);
4148
+ }
4149
+ }
2675
4150
  function abort(request, reason) {
2676
- try {
2677
- 11 >= request.status && (request.status = ABORTING);
2678
- var abortableTasks = request.abortableTasks;
2679
- if (0 < abortableTasks.size) {
2680
- var error =
2681
- void 0 === reason
2682
- ? Error(
2683
- "The render was aborted by the server without a reason."
2684
- )
2685
- : "object" === typeof reason &&
2686
- null !== reason &&
2687
- "function" === typeof reason.then
2688
- ? Error(
2689
- "The render was aborted by the server with a promise."
2690
- )
2691
- : reason,
2692
- digest = logRecoverableError(request, error, null),
2693
- _errorId2 = request.nextChunkId++;
2694
- request.fatalError = _errorId2;
2695
- request.pendingChunks++;
2696
- emitErrorChunk(request, _errorId2, digest, error);
2697
- abortableTasks.forEach(function (task) {
2698
- if (task.status !== RENDERING) {
2699
- task.status = ABORTED;
2700
- var ref = serializeByValueID(_errorId2);
2701
- task = encodeReferenceChunk(request, task.id, ref);
2702
- request.completedErrorChunks.push(task);
4151
+ if (!(11 < request.status))
4152
+ try {
4153
+ request.status = ABORTING;
4154
+ request.abortTime = performance.now();
4155
+ request.cacheController.abort(reason);
4156
+ var abortableTasks = request.abortableTasks;
4157
+ if (0 < abortableTasks.size)
4158
+ if (21 === request.type)
4159
+ abortableTasks.forEach(function (task) {
4160
+ return haltTask(task, request);
4161
+ }),
4162
+ setImmediate(function () {
4163
+ return finishHalt(request, abortableTasks);
4164
+ });
4165
+ else {
4166
+ var error =
4167
+ void 0 === reason
4168
+ ? Error(
4169
+ "The render was aborted by the server without a reason."
4170
+ )
4171
+ : "object" === typeof reason &&
4172
+ null !== reason &&
4173
+ "function" === typeof reason.then
4174
+ ? Error(
4175
+ "The render was aborted by the server with a promise."
4176
+ )
4177
+ : reason,
4178
+ digest = logRecoverableError(request, error, null),
4179
+ _errorId2 = request.nextChunkId++;
4180
+ request.fatalError = _errorId2;
4181
+ request.pendingChunks++;
4182
+ emitErrorChunk(request, _errorId2, digest, error, !1, null);
4183
+ abortableTasks.forEach(function (task) {
4184
+ return abortTask(task, request, _errorId2);
4185
+ });
4186
+ setImmediate(function () {
4187
+ return finishAbort(request, abortableTasks, _errorId2);
4188
+ });
2703
4189
  }
2704
- });
2705
- abortableTasks.clear();
2706
- var onAllReady = request.onAllReady;
2707
- onAllReady();
4190
+ else {
4191
+ var onAllReady = request.onAllReady;
4192
+ onAllReady();
4193
+ flushCompletedChunks(request);
4194
+ }
4195
+ } catch (error$2) {
4196
+ logRecoverableError(request, error$2, null),
4197
+ fatalError(request, error$2);
2708
4198
  }
2709
- var abortListeners = request.abortListeners;
2710
- if (0 < abortListeners.size) {
2711
- var _error =
2712
- void 0 === reason
2713
- ? Error("The render was aborted by the server without a reason.")
2714
- : "object" === typeof reason &&
2715
- null !== reason &&
2716
- "function" === typeof reason.then
2717
- ? Error("The render was aborted by the server with a promise.")
2718
- : reason;
2719
- abortListeners.forEach(function (callback) {
2720
- return callback(_error);
2721
- });
2722
- abortListeners.clear();
4199
+ }
4200
+ function fromHex(str) {
4201
+ return parseInt(str, 16);
4202
+ }
4203
+ function resolveDebugMessage(request, message) {
4204
+ var deferredDebugObjects = request.deferredDebugObjects;
4205
+ if (null === deferredDebugObjects)
4206
+ throw Error(
4207
+ "resolveDebugMessage/closeDebugChannel should not be called for a Request that wasn't kept alive. This is a bug in React."
4208
+ );
4209
+ if ("" === message) closeDebugChannel(request);
4210
+ else {
4211
+ var command = message.charCodeAt(0);
4212
+ message = message.slice(2).split(",").map(fromHex);
4213
+ switch (command) {
4214
+ case 82:
4215
+ for (command = 0; command < message.length; command++) {
4216
+ var id = message[command],
4217
+ retainedValue = deferredDebugObjects.retained.get(id);
4218
+ void 0 !== retainedValue &&
4219
+ (request.pendingDebugChunks--,
4220
+ deferredDebugObjects.retained.delete(id),
4221
+ deferredDebugObjects.existing.delete(retainedValue),
4222
+ enqueueFlush(request));
4223
+ }
4224
+ break;
4225
+ case 81:
4226
+ for (command = 0; command < message.length; command++)
4227
+ (id = message[command]),
4228
+ (retainedValue = deferredDebugObjects.retained.get(id)),
4229
+ void 0 !== retainedValue &&
4230
+ (deferredDebugObjects.retained.delete(id),
4231
+ deferredDebugObjects.existing.delete(retainedValue),
4232
+ emitOutlinedDebugModelChunk(
4233
+ request,
4234
+ id,
4235
+ { objectLimit: 10 },
4236
+ retainedValue
4237
+ ),
4238
+ enqueueFlush(request));
4239
+ break;
4240
+ case 80:
4241
+ for (command = 0; command < message.length; command++)
4242
+ (id = message[command]),
4243
+ (retainedValue = deferredDebugObjects.retained.get(id)),
4244
+ void 0 !== retainedValue &&
4245
+ (deferredDebugObjects.retained.delete(id),
4246
+ emitRequestedDebugThenable(
4247
+ request,
4248
+ id,
4249
+ { objectLimit: 10 },
4250
+ retainedValue
4251
+ ));
4252
+ break;
4253
+ default:
4254
+ throw Error(
4255
+ "Unknown command. The debugChannel was not wired up properly."
4256
+ );
2723
4257
  }
2724
- null !== request.destination &&
2725
- flushCompletedChunks(request, request.destination);
2726
- } catch (error$2) {
2727
- logRecoverableError(request, error$2, null),
2728
- fatalError(request, error$2);
2729
4258
  }
2730
4259
  }
4260
+ function closeDebugChannel(request) {
4261
+ var deferredDebugObjects = request.deferredDebugObjects;
4262
+ if (null === deferredDebugObjects)
4263
+ throw Error(
4264
+ "resolveDebugMessage/closeDebugChannel should not be called for a Request that wasn't kept alive. This is a bug in React."
4265
+ );
4266
+ deferredDebugObjects.retained.forEach(function (value, id) {
4267
+ request.pendingDebugChunks--;
4268
+ deferredDebugObjects.retained.delete(id);
4269
+ deferredDebugObjects.existing.delete(value);
4270
+ });
4271
+ enqueueFlush(request);
4272
+ }
2731
4273
  function resolveServerReference(bundlerConfig, id) {
2732
4274
  var name = "",
2733
4275
  resolvedModuleData = bundlerConfig[id];
@@ -3491,7 +5033,122 @@
3491
5033
  abort(request, Error(reason));
3492
5034
  };
3493
5035
  }
3494
- function createFakeWritable(readable) {
5036
+ function startReadingFromDebugChannelReadable(request, stream) {
5037
+ function onData(chunk) {
5038
+ if ("string" === typeof chunk) {
5039
+ if (lastWasPartial) {
5040
+ var JSCompiler_temp_const = stringBuffer;
5041
+ var JSCompiler_inline_result = new Uint8Array(0);
5042
+ JSCompiler_inline_result = stringDecoder.decode(
5043
+ JSCompiler_inline_result
5044
+ );
5045
+ stringBuffer = JSCompiler_temp_const + JSCompiler_inline_result;
5046
+ lastWasPartial = !1;
5047
+ }
5048
+ stringBuffer += chunk;
5049
+ } else
5050
+ (stringBuffer += stringDecoder.decode(chunk, decoderOptions)),
5051
+ (lastWasPartial = !0);
5052
+ chunk = stringBuffer.split("\n");
5053
+ for (
5054
+ JSCompiler_temp_const = 0;
5055
+ JSCompiler_temp_const < chunk.length - 1;
5056
+ JSCompiler_temp_const++
5057
+ )
5058
+ resolveDebugMessage(request, chunk[JSCompiler_temp_const]);
5059
+ stringBuffer = chunk[chunk.length - 1];
5060
+ }
5061
+ function onError(error) {
5062
+ abort(
5063
+ request,
5064
+ Error("Lost connection to the Debug Channel.", { cause: error })
5065
+ );
5066
+ }
5067
+ function onClose() {
5068
+ closeDebugChannel(request);
5069
+ }
5070
+ var stringDecoder = new util.TextDecoder(),
5071
+ lastWasPartial = !1,
5072
+ stringBuffer = "";
5073
+ "function" === typeof stream.addEventListener &&
5074
+ "string" === typeof stream.binaryType
5075
+ ? ((stream.binaryType = "arraybuffer"),
5076
+ stream.addEventListener("message", function (event) {
5077
+ onData(event.data);
5078
+ }),
5079
+ stream.addEventListener("error", function (event) {
5080
+ onError(event.error);
5081
+ }),
5082
+ stream.addEventListener("close", onClose))
5083
+ : (stream.on("data", onData),
5084
+ stream.on("error", onError),
5085
+ stream.on("end", onClose));
5086
+ }
5087
+ function createFakeWritableFromWebSocket(webSocket) {
5088
+ return {
5089
+ write: function (chunk) {
5090
+ webSocket.send(chunk);
5091
+ return !0;
5092
+ },
5093
+ end: function () {
5094
+ webSocket.close();
5095
+ },
5096
+ destroy: function (reason) {
5097
+ "object" === typeof reason &&
5098
+ null !== reason &&
5099
+ (reason = reason.message);
5100
+ "string" === typeof reason
5101
+ ? webSocket.close(1011, reason)
5102
+ : webSocket.close(1011);
5103
+ }
5104
+ };
5105
+ }
5106
+ function createFakeWritableFromReadableStreamController(controller) {
5107
+ return {
5108
+ write: function (chunk) {
5109
+ "string" === typeof chunk && (chunk = textEncoder.encode(chunk));
5110
+ controller.enqueue(chunk);
5111
+ return !0;
5112
+ },
5113
+ end: function () {
5114
+ controller.close();
5115
+ },
5116
+ destroy: function (error) {
5117
+ "function" === typeof controller.error
5118
+ ? controller.error(error)
5119
+ : controller.close();
5120
+ }
5121
+ };
5122
+ }
5123
+ function startReadingFromDebugChannelReadableStream(request, stream) {
5124
+ function progress(_ref) {
5125
+ var done = _ref.done,
5126
+ buffer = _ref.value;
5127
+ _ref = stringBuffer;
5128
+ done
5129
+ ? ((buffer = new Uint8Array(0)),
5130
+ (buffer = stringDecoder.decode(buffer)))
5131
+ : (buffer = stringDecoder.decode(buffer, decoderOptions));
5132
+ stringBuffer = _ref + buffer;
5133
+ _ref = stringBuffer.split("\n");
5134
+ for (buffer = 0; buffer < _ref.length - 1; buffer++)
5135
+ resolveDebugMessage(request, _ref[buffer]);
5136
+ stringBuffer = _ref[_ref.length - 1];
5137
+ if (done) closeDebugChannel(request);
5138
+ else return reader.read().then(progress).catch(error);
5139
+ }
5140
+ function error(e) {
5141
+ abort(
5142
+ request,
5143
+ Error("Lost connection to the Debug Channel.", { cause: e })
5144
+ );
5145
+ }
5146
+ var reader = stream.getReader(),
5147
+ stringDecoder = new util.TextDecoder(),
5148
+ stringBuffer = "";
5149
+ reader.read().then(progress).catch(error);
5150
+ }
5151
+ function createFakeWritableFromNodeReadable(readable) {
3495
5152
  return {
3496
5153
  write: function (chunk) {
3497
5154
  return readable.push(chunk);
@@ -3510,6 +5167,19 @@
3510
5167
  var async_hooks = require("async_hooks"),
3511
5168
  ReactDOM = require("react-dom"),
3512
5169
  React = require("react"),
5170
+ REACT_LEGACY_ELEMENT_TYPE = Symbol.for("react.element"),
5171
+ REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"),
5172
+ REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"),
5173
+ REACT_CONTEXT_TYPE = Symbol.for("react.context"),
5174
+ REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"),
5175
+ REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"),
5176
+ REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"),
5177
+ REACT_MEMO_TYPE = Symbol.for("react.memo"),
5178
+ REACT_LAZY_TYPE = Symbol.for("react.lazy"),
5179
+ REACT_MEMO_CACHE_SENTINEL = Symbol.for("react.memo_cache_sentinel");
5180
+ Symbol.for("react.postpone");
5181
+ var MAYBE_ITERATOR_SYMBOL = Symbol.iterator,
5182
+ ASYNC_ITERATOR = Symbol.asyncIterator,
3513
5183
  scheduleMicrotask = queueMicrotask,
3514
5184
  currentView = null,
3515
5185
  writtenBytes = 0,
@@ -3535,6 +5205,8 @@
3535
5205
  return;
3536
5206
  case "defaultProps":
3537
5207
  return;
5208
+ case "_debugInfo":
5209
+ return;
3538
5210
  case "toJSON":
3539
5211
  return;
3540
5212
  case Symbol.toPrimitive:
@@ -3617,46 +5289,8 @@
3617
5289
  } else previousDispatcher.C(href, crossOrigin);
3618
5290
  }
3619
5291
  },
3620
- L: function (href, as, options) {
3621
- if ("string" === typeof href) {
3622
- var request = resolveRequest();
3623
- if (request) {
3624
- var hints = request.hints,
3625
- key = "L";
3626
- if ("image" === as && options) {
3627
- var imageSrcSet = options.imageSrcSet,
3628
- imageSizes = options.imageSizes,
3629
- uniquePart = "";
3630
- "string" === typeof imageSrcSet && "" !== imageSrcSet
3631
- ? ((uniquePart += "[" + imageSrcSet + "]"),
3632
- "string" === typeof imageSizes &&
3633
- (uniquePart += "[" + imageSizes + "]"))
3634
- : (uniquePart += "[][]" + href);
3635
- key += "[image]" + uniquePart;
3636
- } else key += "[" + as + "]" + href;
3637
- hints.has(key) ||
3638
- (hints.add(key),
3639
- (options = trimOptions(options))
3640
- ? emitHint(request, "L", [href, as, options])
3641
- : emitHint(request, "L", [href, as]));
3642
- } else previousDispatcher.L(href, as, options);
3643
- }
3644
- },
3645
- m: function (href, options) {
3646
- if ("string" === typeof href) {
3647
- var request = resolveRequest();
3648
- if (request) {
3649
- var hints = request.hints,
3650
- key = "m|" + href;
3651
- if (hints.has(key)) return;
3652
- hints.add(key);
3653
- return (options = trimOptions(options))
3654
- ? emitHint(request, "m", [href, options])
3655
- : emitHint(request, "m", href);
3656
- }
3657
- previousDispatcher.m(href, options);
3658
- }
3659
- },
5292
+ L: preload,
5293
+ m: preloadModule$1,
3660
5294
  X: function (src, options) {
3661
5295
  if ("string" === typeof src) {
3662
5296
  var request = resolveRequest();
@@ -3709,8 +5343,17 @@
3709
5343
  }
3710
5344
  }
3711
5345
  };
3712
- var frameRegExp =
5346
+ var currentOwner = null,
5347
+ getAsyncId = async_hooks.AsyncResource.prototype.asyncId,
5348
+ pendingOperations = new Map(),
5349
+ lastRanAwait = null,
5350
+ emptyStack = [],
5351
+ framesToSkip = 0,
5352
+ collectedStackTrace = null,
5353
+ identifierRegExp = /^[a-zA-Z_$][0-9a-zA-Z_$]*$/,
5354
+ frameRegExp =
3713
5355
  /^ {3} at (?:(.+) \((?:(.+):(\d+):(\d+)|<anonymous>)\)|(?:async )?(.+):(\d+):(\d+)|<anonymous>)$/,
5356
+ stackTraceCache = new WeakMap(),
3714
5357
  requestStorage = new async_hooks.AsyncLocalStorage(),
3715
5358
  componentStorage = new async_hooks.AsyncLocalStorage(),
3716
5359
  TEMPORARY_REFERENCE_TAG = Symbol.for("react.temporary.reference"),
@@ -3725,6 +5368,8 @@
3725
5368
  return;
3726
5369
  case "defaultProps":
3727
5370
  return;
5371
+ case "_debugInfo":
5372
+ return;
3728
5373
  case "toJSON":
3729
5374
  return;
3730
5375
  case Symbol.toPrimitive:
@@ -3735,6 +5380,8 @@
3735
5380
  throw Error(
3736
5381
  "Cannot render a Client Context Provider on the Server. Instead, you can export a Client Component wrapper that itself renders a Client Context Provider."
3737
5382
  );
5383
+ case "then":
5384
+ return;
3738
5385
  }
3739
5386
  throw Error(
3740
5387
  "Cannot access " +
@@ -3748,19 +5395,6 @@
3748
5395
  );
3749
5396
  }
3750
5397
  },
3751
- REACT_LEGACY_ELEMENT_TYPE = Symbol.for("react.element"),
3752
- REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"),
3753
- REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"),
3754
- REACT_CONTEXT_TYPE = Symbol.for("react.context"),
3755
- REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"),
3756
- REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"),
3757
- REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"),
3758
- REACT_MEMO_TYPE = Symbol.for("react.memo"),
3759
- REACT_LAZY_TYPE = Symbol.for("react.lazy"),
3760
- REACT_MEMO_CACHE_SENTINEL = Symbol.for("react.memo_cache_sentinel");
3761
- Symbol.for("react.postpone");
3762
- var MAYBE_ITERATOR_SYMBOL = Symbol.iterator,
3763
- ASYNC_ITERATOR = Symbol.asyncIterator,
3764
5398
  SuspenseException = Error(
3765
5399
  "Suspense Exception: This is not a real error! It's an implementation detail of `use` to interrupt the current render. You must either rethrow it immediately, or move the `use` call outside of the `try/catch` block. Capturing without rethrowing will lead to unexpected behavior.\n\nTo handle async errors, wrap your component in an error boundary, or call the promise's `.catch` method and pass the result to `use`."
3766
5400
  ),
@@ -3821,11 +5455,11 @@
3821
5455
  throw Error("useId can only be used while React is rendering");
3822
5456
  var id = currentRequest$1.identifierCount++;
3823
5457
  return (
3824
- ":" +
5458
+ "_" +
3825
5459
  currentRequest$1.identifierPrefix +
3826
- "S" +
5460
+ "S_" +
3827
5461
  id.toString(32) +
3828
- ":"
5462
+ "_"
3829
5463
  );
3830
5464
  },
3831
5465
  useHostTransitionStatus: unsupportedHook,
@@ -3840,17 +5474,21 @@
3840
5474
  useCacheRefresh: function () {
3841
5475
  return unsupportedRefresh;
3842
5476
  }
3843
- },
3844
- currentOwner = null,
3845
- DefaultAsyncDispatcher = {
3846
- getCacheForType: function (resourceType) {
3847
- var cache = (cache = resolveRequest()) ? cache.cache : new Map();
3848
- var entry = cache.get(resourceType);
3849
- void 0 === entry &&
3850
- ((entry = resourceType()), cache.set(resourceType, entry));
3851
- return entry;
3852
- }
3853
5477
  };
5478
+ HooksDispatcher.useEffectEvent = unsupportedHook;
5479
+ var DefaultAsyncDispatcher = {
5480
+ getCacheForType: function (resourceType) {
5481
+ var cache = (cache = resolveRequest()) ? cache.cache : new Map();
5482
+ var entry = cache.get(resourceType);
5483
+ void 0 === entry &&
5484
+ ((entry = resourceType()), cache.set(resourceType, entry));
5485
+ return entry;
5486
+ },
5487
+ cacheSignal: function () {
5488
+ var request = resolveRequest();
5489
+ return request ? request.cacheController.signal : null;
5490
+ }
5491
+ };
3854
5492
  DefaultAsyncDispatcher.getOwner = resolveOwner;
3855
5493
  var ReactSharedInternalsServer =
3856
5494
  React.__SERVER_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
@@ -3911,7 +5549,173 @@
3911
5549
  jsxPropsParents = new WeakMap(),
3912
5550
  jsxChildrenParents = new WeakMap(),
3913
5551
  CLIENT_REFERENCE_TAG = Symbol.for("react.client.reference"),
5552
+ hasOwnProperty = Object.prototype.hasOwnProperty,
3914
5553
  doNotLimit = new WeakSet();
5554
+ (function () {
5555
+ async_hooks
5556
+ .createHook({
5557
+ init: function (asyncId, type, triggerAsyncId, resource) {
5558
+ var trigger = pendingOperations.get(triggerAsyncId);
5559
+ if ("PROMISE" === type)
5560
+ if (
5561
+ ((type = async_hooks.executionAsyncId()),
5562
+ type !== triggerAsyncId)
5563
+ ) {
5564
+ if (void 0 === trigger) return;
5565
+ triggerAsyncId = null;
5566
+ if (
5567
+ null === trigger.stack ||
5568
+ (2 !== trigger.tag && 4 !== trigger.tag)
5569
+ ) {
5570
+ resource = new WeakRef(resource);
5571
+ var request = resolveRequest();
5572
+ null !== request &&
5573
+ ((triggerAsyncId = parseStackTracePrivate(Error(), 5)),
5574
+ null === triggerAsyncId ||
5575
+ isAwaitInUserspace(request, triggerAsyncId) ||
5576
+ (triggerAsyncId = null));
5577
+ } else
5578
+ (triggerAsyncId = emptyStack),
5579
+ (resource =
5580
+ void 0 !== resource._debugInfo
5581
+ ? new WeakRef(resource)
5582
+ : trigger.promise);
5583
+ type = pendingOperations.get(type);
5584
+ trigger = {
5585
+ tag: 4,
5586
+ owner: resolveOwner(),
5587
+ stack: triggerAsyncId,
5588
+ start: performance.now(),
5589
+ end: -1.1,
5590
+ promise: resource,
5591
+ awaited: trigger,
5592
+ previous: void 0 === type ? null : type
5593
+ };
5594
+ } else
5595
+ (type = resolveOwner()),
5596
+ (trigger = {
5597
+ tag: 3,
5598
+ owner: type,
5599
+ stack:
5600
+ null === type ? null : parseStackTracePrivate(Error(), 5),
5601
+ start: performance.now(),
5602
+ end: -1.1,
5603
+ promise: new WeakRef(resource),
5604
+ awaited: void 0 === trigger ? null : trigger,
5605
+ previous: null
5606
+ });
5607
+ else if (
5608
+ "Microtask" !== type &&
5609
+ "TickObject" !== type &&
5610
+ "Immediate" !== type
5611
+ )
5612
+ if (void 0 === trigger)
5613
+ (trigger = resolveOwner()),
5614
+ (trigger = {
5615
+ tag: 0,
5616
+ owner: trigger,
5617
+ stack:
5618
+ null === trigger
5619
+ ? parseStackTracePrivate(Error(), 3)
5620
+ : null,
5621
+ start: performance.now(),
5622
+ end: -1.1,
5623
+ promise: null,
5624
+ awaited: null,
5625
+ previous: null
5626
+ });
5627
+ else {
5628
+ if (2 === trigger.tag || 4 === trigger.tag)
5629
+ (resource = resolveOwner()),
5630
+ (trigger = {
5631
+ tag: 0,
5632
+ owner: resource,
5633
+ stack:
5634
+ null === resource
5635
+ ? parseStackTracePrivate(Error(), 3)
5636
+ : null,
5637
+ start: performance.now(),
5638
+ end: -1.1,
5639
+ promise: null,
5640
+ awaited: null,
5641
+ previous: trigger
5642
+ });
5643
+ }
5644
+ else if (void 0 === trigger) return;
5645
+ pendingOperations.set(asyncId, trigger);
5646
+ },
5647
+ before: function (asyncId) {
5648
+ asyncId = pendingOperations.get(asyncId);
5649
+ if (void 0 !== asyncId)
5650
+ switch (asyncId.tag) {
5651
+ case 0:
5652
+ lastRanAwait = null;
5653
+ asyncId.end = performance.now();
5654
+ break;
5655
+ case 4:
5656
+ lastRanAwait = resolvePromiseOrAwaitNode(
5657
+ asyncId,
5658
+ performance.now()
5659
+ );
5660
+ break;
5661
+ case 2:
5662
+ lastRanAwait = asyncId;
5663
+ break;
5664
+ case 3:
5665
+ resolvePromiseOrAwaitNode(
5666
+ asyncId,
5667
+ performance.now()
5668
+ ).previous = lastRanAwait;
5669
+ lastRanAwait = null;
5670
+ break;
5671
+ default:
5672
+ lastRanAwait = null;
5673
+ }
5674
+ },
5675
+ promiseResolve: function (asyncId) {
5676
+ var node = pendingOperations.get(asyncId);
5677
+ if (void 0 !== node) {
5678
+ switch (node.tag) {
5679
+ case 4:
5680
+ case 3:
5681
+ node = resolvePromiseOrAwaitNode(node, performance.now());
5682
+ break;
5683
+ case 2:
5684
+ case 1:
5685
+ break;
5686
+ default:
5687
+ throw Error(
5688
+ "A Promise should never be an IO_NODE. This is a bug in React."
5689
+ );
5690
+ }
5691
+ var currentAsyncId = async_hooks.executionAsyncId();
5692
+ asyncId !== currentAsyncId &&
5693
+ ((asyncId = pendingOperations.get(currentAsyncId)),
5694
+ 1 === node.tag
5695
+ ? (node.awaited = void 0 === asyncId ? null : asyncId)
5696
+ : void 0 !== asyncId &&
5697
+ ((currentAsyncId = {
5698
+ tag: 2,
5699
+ owner: node.owner,
5700
+ stack: node.stack,
5701
+ start: node.start,
5702
+ end: node.end,
5703
+ promise: node.promise,
5704
+ awaited: node.awaited,
5705
+ previous: node.previous
5706
+ }),
5707
+ (node.start = node.end),
5708
+ (node.end = performance.now()),
5709
+ (node.previous = currentAsyncId),
5710
+ (node.awaited = asyncId)));
5711
+ }
5712
+ },
5713
+ destroy: function (asyncId) {
5714
+ pendingOperations.delete(asyncId);
5715
+ }
5716
+ })
5717
+ .enable();
5718
+ })();
3915
5719
  "object" === typeof console &&
3916
5720
  null !== console &&
3917
5721
  (patchConsole(console, "assert"),
@@ -3929,22 +5733,20 @@
3929
5733
  patchConsole(console, "warn"));
3930
5734
  var ObjectPrototype = Object.prototype,
3931
5735
  stringify = JSON.stringify,
3932
- PENDING$1 = 0,
3933
- COMPLETED = 1,
3934
- ABORTED = 3,
3935
- ERRORED$1 = 4,
3936
- RENDERING = 5,
3937
- OPENING = 10,
3938
5736
  ABORTING = 12,
3939
- CLOSING = 13,
3940
5737
  CLOSED = 14,
3941
- PRERENDER = 21,
5738
+ defaultPostponeHandler = noop,
3942
5739
  currentRequest = null,
3943
- debugID = null,
5740
+ canEmitDebugInfo = !1,
5741
+ serializedSize = 0,
5742
+ MAX_ROW_SIZE = 3200,
3944
5743
  modelRoot = !1,
5744
+ CONSTRUCTOR_MARKER = Symbol(),
5745
+ debugModelRoot = null,
5746
+ debugNoOutline = null,
3945
5747
  emptyRoot = {},
3946
- chunkCache = new Map(),
3947
- hasOwnProperty = Object.prototype.hasOwnProperty;
5748
+ decoderOptions = { stream: !0 },
5749
+ chunkCache = new Map();
3948
5750
  Chunk.prototype = Object.create(Promise.prototype);
3949
5751
  Chunk.prototype.then = function (resolve, reject) {
3950
5752
  switch (this.status) {
@@ -4035,6 +5837,37 @@
4035
5837
  close(body);
4036
5838
  return webpackMap;
4037
5839
  };
5840
+ exports.decodeReplyFromAsyncIterable = function (
5841
+ iterable,
5842
+ webpackMap,
5843
+ options
5844
+ ) {
5845
+ function progress(entry) {
5846
+ if (entry.done) close(response);
5847
+ else {
5848
+ var _entry$value = entry.value;
5849
+ entry = _entry$value[0];
5850
+ _entry$value = _entry$value[1];
5851
+ "string" === typeof _entry$value
5852
+ ? resolveField(response, entry, _entry$value)
5853
+ : response._formData.append(entry, _entry$value);
5854
+ iterator.next().then(progress, error);
5855
+ }
5856
+ }
5857
+ function error(reason) {
5858
+ reportGlobalError(response, reason);
5859
+ "function" === typeof iterator.throw &&
5860
+ iterator.throw(reason).then(error, error);
5861
+ }
5862
+ var iterator = iterable[ASYNC_ITERATOR](),
5863
+ response = createResponse(
5864
+ webpackMap,
5865
+ "",
5866
+ options ? options.temporaryReferences : void 0
5867
+ );
5868
+ iterator.next().then(progress, error);
5869
+ return getChunk(response, 0);
5870
+ };
4038
5871
  exports.decodeReplyFromBusboy = function (
4039
5872
  busboyStream,
4040
5873
  webpackMap,
@@ -4052,20 +5885,20 @@
4052
5885
  ? queuedFields.push(name, value)
4053
5886
  : resolveField(response, name, value);
4054
5887
  });
4055
- busboyStream.on("file", function (name, value, _ref) {
4056
- var filename = _ref.filename,
4057
- mimeType = _ref.mimeType;
4058
- if ("base64" === _ref.encoding.toLowerCase())
5888
+ busboyStream.on("file", function (name, value, _ref2) {
5889
+ var filename = _ref2.filename,
5890
+ mimeType = _ref2.mimeType;
5891
+ if ("base64" === _ref2.encoding.toLowerCase())
4059
5892
  throw Error(
4060
5893
  "React doesn't accept base64 encoded file uploads because we don't expect form data passed from a browser to ever encode data that way. If that's the wrong assumption, we can easily fix it."
4061
5894
  );
4062
5895
  pendingFiles++;
4063
- var JSCompiler_object_inline_chunks_153 = [];
5896
+ var JSCompiler_object_inline_chunks_250 = [];
4064
5897
  value.on("data", function (chunk) {
4065
- JSCompiler_object_inline_chunks_153.push(chunk);
5898
+ JSCompiler_object_inline_chunks_250.push(chunk);
4066
5899
  });
4067
5900
  value.on("end", function () {
4068
- var blob = new Blob(JSCompiler_object_inline_chunks_153, {
5901
+ var blob = new Blob(JSCompiler_object_inline_chunks_250, {
4069
5902
  type: mimeType
4070
5903
  });
4071
5904
  response._formData.append(name, blob, filename);
@@ -4089,6 +5922,94 @@
4089
5922
  });
4090
5923
  return getChunk(response, 0);
4091
5924
  };
5925
+ exports.prerender = function (model, webpackMap, options) {
5926
+ return new Promise(function (resolve, reject) {
5927
+ var request = createPrerenderRequest(
5928
+ model,
5929
+ webpackMap,
5930
+ function () {
5931
+ var writable,
5932
+ stream = new ReadableStream(
5933
+ {
5934
+ type: "bytes",
5935
+ start: function (controller) {
5936
+ writable =
5937
+ createFakeWritableFromReadableStreamController(
5938
+ controller
5939
+ );
5940
+ },
5941
+ pull: function () {
5942
+ startFlowing(request, writable);
5943
+ },
5944
+ cancel: function (reason) {
5945
+ request.destination = null;
5946
+ abort(request, reason);
5947
+ }
5948
+ },
5949
+ { highWaterMark: 0 }
5950
+ );
5951
+ resolve({ prelude: stream });
5952
+ },
5953
+ reject,
5954
+ options ? options.onError : void 0,
5955
+ options ? options.identifierPrefix : void 0,
5956
+ options ? options.onPostpone : void 0,
5957
+ options ? options.temporaryReferences : void 0,
5958
+ options ? options.environmentName : void 0,
5959
+ options ? options.filterStackFrame : void 0,
5960
+ !1
5961
+ );
5962
+ if (options && options.signal) {
5963
+ var signal = options.signal;
5964
+ if (signal.aborted) abort(request, signal.reason);
5965
+ else {
5966
+ var listener = function () {
5967
+ abort(request, signal.reason);
5968
+ signal.removeEventListener("abort", listener);
5969
+ };
5970
+ signal.addEventListener("abort", listener);
5971
+ }
5972
+ }
5973
+ startWork(request);
5974
+ });
5975
+ };
5976
+ exports.prerenderToNodeStream = function (model, webpackMap, options) {
5977
+ return new Promise(function (resolve, reject) {
5978
+ var request = createPrerenderRequest(
5979
+ model,
5980
+ webpackMap,
5981
+ function () {
5982
+ var readable = new stream.Readable({
5983
+ read: function () {
5984
+ startFlowing(request, writable);
5985
+ }
5986
+ }),
5987
+ writable = createFakeWritableFromNodeReadable(readable);
5988
+ resolve({ prelude: readable });
5989
+ },
5990
+ reject,
5991
+ options ? options.onError : void 0,
5992
+ options ? options.identifierPrefix : void 0,
5993
+ options ? options.onPostpone : void 0,
5994
+ options ? options.temporaryReferences : void 0,
5995
+ options ? options.environmentName : void 0,
5996
+ options ? options.filterStackFrame : void 0,
5997
+ !1
5998
+ );
5999
+ if (options && options.signal) {
6000
+ var signal = options.signal;
6001
+ if (signal.aborted) abort(request, signal.reason);
6002
+ else {
6003
+ var listener = function () {
6004
+ abort(request, signal.reason);
6005
+ signal.removeEventListener("abort", listener);
6006
+ };
6007
+ signal.addEventListener("abort", listener);
6008
+ }
6009
+ }
6010
+ startWork(request);
6011
+ });
6012
+ };
4092
6013
  exports.registerClientReference = function (
4093
6014
  proxyImplementation,
4094
6015
  id,
@@ -4113,6 +6034,21 @@
4113
6034
  });
4114
6035
  };
4115
6036
  exports.renderToPipeableStream = function (model, webpackMap, options) {
6037
+ var debugChannel = options ? options.debugChannel : void 0,
6038
+ debugChannelReadable =
6039
+ void 0 === debugChannel ||
6040
+ ("function" !== typeof debugChannel.read &&
6041
+ "number" !== typeof debugChannel.readyState)
6042
+ ? void 0
6043
+ : debugChannel;
6044
+ debugChannel =
6045
+ void 0 !== debugChannel
6046
+ ? "function" === typeof debugChannel.write
6047
+ ? debugChannel
6048
+ : "function" === typeof debugChannel.send
6049
+ ? createFakeWritableFromWebSocket(debugChannel)
6050
+ : void 0
6051
+ : void 0;
4116
6052
  var request = createRequest(
4117
6053
  model,
4118
6054
  webpackMap,
@@ -4121,10 +6057,14 @@
4121
6057
  options ? options.onPostpone : void 0,
4122
6058
  options ? options.temporaryReferences : void 0,
4123
6059
  options ? options.environmentName : void 0,
4124
- options ? options.filterStackFrame : void 0
6060
+ options ? options.filterStackFrame : void 0,
6061
+ void 0 !== debugChannelReadable
4125
6062
  ),
4126
6063
  hasStartedFlowing = !1;
4127
6064
  startWork(request);
6065
+ void 0 !== debugChannel && startFlowingDebug(request, debugChannel);
6066
+ void 0 !== debugChannelReadable &&
6067
+ startReadingFromDebugChannelReadable(request, debugChannelReadable);
4128
6068
  return {
4129
6069
  pipe: function (destination) {
4130
6070
  if (hasStartedFlowing)
@@ -4141,10 +6081,14 @@
4141
6081
  "The destination stream errored while writing data."
4142
6082
  )
4143
6083
  );
4144
- destination.on(
4145
- "close",
4146
- createCancelHandler(request, "The destination stream closed early.")
4147
- );
6084
+ if (void 0 === debugChannelReadable)
6085
+ destination.on(
6086
+ "close",
6087
+ createCancelHandler(
6088
+ request,
6089
+ "The destination stream closed early."
6090
+ )
6091
+ );
4148
6092
  return destination;
4149
6093
  },
4150
6094
  abort: function (reason) {
@@ -4152,44 +6096,76 @@
4152
6096
  }
4153
6097
  };
4154
6098
  };
4155
- exports.unstable_prerenderToNodeStream = function (
4156
- model,
4157
- webpackMap,
4158
- options
4159
- ) {
4160
- return new Promise(function (resolve, reject) {
4161
- var request = createPrerenderRequest(
6099
+ exports.renderToReadableStream = function (model, webpackMap, options) {
6100
+ var debugChannelReadable =
6101
+ options && options.debugChannel
6102
+ ? options.debugChannel.readable
6103
+ : void 0,
6104
+ debugChannelWritable =
6105
+ options && options.debugChannel
6106
+ ? options.debugChannel.writable
6107
+ : void 0,
6108
+ request = createRequest(
4162
6109
  model,
4163
6110
  webpackMap,
4164
- function () {
4165
- var readable = new stream.Readable({
4166
- read: function () {
4167
- startFlowing(request, writable);
4168
- }
4169
- }),
4170
- writable = createFakeWritable(readable);
4171
- resolve({ prelude: readable });
4172
- },
4173
- reject,
4174
6111
  options ? options.onError : void 0,
4175
6112
  options ? options.identifierPrefix : void 0,
4176
6113
  options ? options.onPostpone : void 0,
4177
6114
  options ? options.temporaryReferences : void 0,
4178
6115
  options ? options.environmentName : void 0,
4179
- options ? options.filterStackFrame : void 0
6116
+ options ? options.filterStackFrame : void 0,
6117
+ void 0 !== debugChannelReadable
4180
6118
  );
4181
- if (options && options.signal) {
4182
- var signal = options.signal;
4183
- if (signal.aborted) abort(request, signal.reason);
4184
- else {
4185
- var listener = function () {
4186
- abort(request, signal.reason);
4187
- signal.removeEventListener("abort", listener);
4188
- };
4189
- signal.addEventListener("abort", listener);
4190
- }
6119
+ if (options && options.signal) {
6120
+ var signal = options.signal;
6121
+ if (signal.aborted) abort(request, signal.reason);
6122
+ else {
6123
+ var listener = function () {
6124
+ abort(request, signal.reason);
6125
+ signal.removeEventListener("abort", listener);
6126
+ };
6127
+ signal.addEventListener("abort", listener);
4191
6128
  }
4192
- startWork(request);
4193
- });
6129
+ }
6130
+ if (void 0 !== debugChannelWritable) {
6131
+ var debugWritable;
6132
+ new ReadableStream(
6133
+ {
6134
+ type: "bytes",
6135
+ start: function (controller) {
6136
+ debugWritable =
6137
+ createFakeWritableFromReadableStreamController(controller);
6138
+ },
6139
+ pull: function () {
6140
+ startFlowingDebug(request, debugWritable);
6141
+ }
6142
+ },
6143
+ { highWaterMark: 0 }
6144
+ ).pipeTo(debugChannelWritable);
6145
+ }
6146
+ void 0 !== debugChannelReadable &&
6147
+ startReadingFromDebugChannelReadableStream(
6148
+ request,
6149
+ debugChannelReadable
6150
+ );
6151
+ var writable;
6152
+ return new ReadableStream(
6153
+ {
6154
+ type: "bytes",
6155
+ start: function (controller) {
6156
+ writable =
6157
+ createFakeWritableFromReadableStreamController(controller);
6158
+ startWork(request);
6159
+ },
6160
+ pull: function () {
6161
+ startFlowing(request, writable);
6162
+ },
6163
+ cancel: function (reason) {
6164
+ request.destination = null;
6165
+ abort(request, reason);
6166
+ }
6167
+ },
6168
+ { highWaterMark: 0 }
6169
+ );
4194
6170
  };
4195
6171
  })();