@vitejs/plugin-rsc 0.4.34 → 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 (92) hide show
  1. package/dist/{browser-CQv7Z3J4.d.ts → browser-STIFJSFF.d.ts} +1 -1
  2. package/dist/browser.d.ts +3 -3
  3. package/dist/browser.js +19 -1
  4. package/dist/{cjs-BamOAUgw.js → cjs-C5-IrxV9.js} +1 -1
  5. package/dist/core/browser.d.ts +1 -1
  6. package/dist/core/plugin.js +1 -1
  7. package/dist/core/rsc.d.ts +2 -2
  8. package/dist/core/rsc.js +1 -1
  9. package/dist/core/ssr.d.ts +2 -2
  10. package/dist/core/ssr.js +1 -1
  11. package/dist/{encryption-runtime-DT6dtlC5.js → encryption-runtime-FhNKiASK.js} +2 -2
  12. package/dist/index.d.ts +2 -2
  13. package/dist/index.js +7 -7
  14. package/dist/{plugin-BLedJFh7.js → plugin-CrduXSyi.js} +6 -14
  15. package/dist/{plugin-DCLI7Wh8.d.ts → plugin-DGhnAIi6.d.ts} +1 -5
  16. package/dist/plugin.d.ts +2 -2
  17. package/dist/plugin.js +7 -7
  18. package/dist/plugins/cjs.js +2 -2
  19. package/dist/react/browser.d.ts +3 -3
  20. package/dist/react/rsc.d.ts +3 -3
  21. package/dist/react/rsc.js +2 -2
  22. package/dist/react/ssr.d.ts +3 -3
  23. package/dist/react/ssr.js +2 -2
  24. package/dist/{rsc-3bkzqdsJ.d.ts → rsc-Cg31p8XR.d.ts} +1 -1
  25. package/dist/{rsc-BdCB3621.js → rsc-DdBcg-Lb.js} +1 -1
  26. package/dist/rsc.d.ts +4 -4
  27. package/dist/rsc.js +22 -5
  28. package/dist/{ssr-CMjeQ9AS.d.ts → ssr-00tY_Tdf.d.ts} +1 -1
  29. package/dist/{ssr-Cd4SbAaO.js → ssr-CE8X2HyS.js} +1 -1
  30. package/dist/ssr.d.ts +3 -3
  31. package/dist/ssr.js +52 -4
  32. package/dist/transforms/index.d.ts +1 -1
  33. package/dist/transforms/index.js +1 -1
  34. package/dist/utils/encryption-runtime.d.ts +1 -1
  35. package/dist/utils/encryption-runtime.js +4 -4
  36. package/dist/utils/rpc.js +1 -1
  37. package/dist/vendor/react-server-dom/cjs/react-server-dom-webpack-client.browser.development.js +2964 -774
  38. package/dist/vendor/react-server-dom/cjs/react-server-dom-webpack-client.browser.production.js +554 -312
  39. package/dist/vendor/react-server-dom/cjs/react-server-dom-webpack-client.edge.development.js +2721 -724
  40. package/dist/vendor/react-server-dom/cjs/react-server-dom-webpack-client.edge.production.js +541 -300
  41. package/dist/vendor/react-server-dom/cjs/react-server-dom-webpack-client.node.development.js +2955 -858
  42. package/dist/vendor/react-server-dom/cjs/react-server-dom-webpack-client.node.production.js +652 -332
  43. package/dist/vendor/react-server-dom/cjs/react-server-dom-webpack-client.node.unbundled.development.js +2956 -861
  44. package/dist/vendor/react-server-dom/cjs/react-server-dom-webpack-client.node.unbundled.production.js +652 -332
  45. package/dist/vendor/react-server-dom/cjs/react-server-dom-webpack-plugin.js +6 -2
  46. package/dist/vendor/react-server-dom/cjs/react-server-dom-webpack-server.browser.development.js +1931 -713
  47. package/dist/vendor/react-server-dom/cjs/react-server-dom-webpack-server.browser.production.js +544 -295
  48. package/dist/vendor/react-server-dom/cjs/react-server-dom-webpack-server.edge.development.js +1926 -715
  49. package/dist/vendor/react-server-dom/cjs/react-server-dom-webpack-server.edge.production.js +542 -299
  50. package/dist/vendor/react-server-dom/cjs/react-server-dom-webpack-server.node.development.js +2719 -743
  51. package/dist/vendor/react-server-dom/cjs/react-server-dom-webpack-server.node.production.js +725 -338
  52. package/dist/vendor/react-server-dom/cjs/react-server-dom-webpack-server.node.unbundled.development.js +2703 -727
  53. package/dist/vendor/react-server-dom/cjs/react-server-dom-webpack-server.node.unbundled.production.js +725 -338
  54. package/dist/vendor/react-server-dom/package.json +3 -3
  55. package/dist/vendor/react-server-dom/server.node.js +3 -1
  56. package/dist/vendor/react-server-dom/server.node.unbundled.js +3 -1
  57. package/dist/vendor/react-server-dom/static.browser.js +1 -3
  58. package/dist/vendor/react-server-dom/static.edge.js +1 -3
  59. package/dist/vendor/react-server-dom/static.node.js +2 -3
  60. package/dist/vendor/react-server-dom/static.node.unbundled.js +1 -3
  61. package/package.json +6 -7
  62. package/types/index.d.ts +0 -4
  63. package/dist/browser--ZREVnM9.js +0 -22
  64. package/dist/client-C7Eok9hc.js +0 -23
  65. package/dist/extra/browser.d.ts +0 -14
  66. package/dist/extra/browser.js +0 -88
  67. package/dist/extra/rsc.d.ts +0 -2
  68. package/dist/extra/rsc.js +0 -56
  69. package/dist/extra/ssr.d.ts +0 -14
  70. package/dist/extra/ssr.js +0 -37
  71. package/dist/rsc-CiAoLCx8.js +0 -21
  72. package/dist/rsc-c22DF1A7.d.ts +0 -16
  73. package/dist/rsc-html-stream/browser.d.ts +0 -5
  74. package/dist/rsc-html-stream/browser.js +0 -8
  75. package/dist/rsc-html-stream/ssr.d.ts +0 -7
  76. package/dist/rsc-html-stream/ssr.js +0 -8
  77. package/dist/server-DMhFuTz_.js +0 -72
  78. package/dist/ssr-BQwZitKq.js +0 -53
  79. package/types/virtual.d.ts +0 -5
  80. /package/dist/{browser-DwWQeoll.d.ts → browser-CXHICuDc.d.ts} +0 -0
  81. /package/dist/{encryption-runtime-B8xcnJoN.d.ts → encryption-runtime-DwihLkYv.d.ts} +0 -0
  82. /package/dist/{encryption-utils-BDwwcMVT.js → encryption-utils-CoE0gWjC.js} +0 -0
  83. /package/dist/{index-B04iFwO5.d.ts → index-DYBWAuKP.d.ts} +0 -0
  84. /package/dist/{index-CPkExgij.d.ts → index-kBz3NvVt.d.ts} +0 -0
  85. /package/dist/{plugin-CZbI4rhS.js → plugin-BwI7mYXI.js} +0 -0
  86. /package/dist/{rpc-CUvSZurk.js → rpc-D7cb_Wd5.js} +0 -0
  87. /package/dist/{rsc-JJjz3Z0i.d.ts → rsc-Fgmk6j0z.d.ts} +0 -0
  88. /package/dist/{rsc-GFzFWyhT.js → rsc-cp4EenMG.js} +0 -0
  89. /package/dist/{shared-n-ykEs15.js → shared-CceFFukJ.js} +0 -0
  90. /package/dist/{ssr-BrSGyrxe.d.ts → ssr-BnYZ8xo9.d.ts} +0 -0
  91. /package/dist/{ssr-Cm2FP2zD.js → ssr-C468YlFl.js} +0 -0
  92. /package/dist/{transforms-CpF3zNE0.js → transforms-wFF-pWF7.js} +0 -0
@@ -70,6 +70,15 @@
70
70
  }
71
71
  return !0;
72
72
  }
73
+ function completeWriting(destination) {
74
+ currentView &&
75
+ 0 < writtenBytes &&
76
+ (destination.enqueue(
77
+ new Uint8Array(currentView.buffer, 0, writtenBytes)
78
+ ),
79
+ (currentView = null),
80
+ (writtenBytes = 0));
81
+ }
73
82
  function stringToChunk(content) {
74
83
  return textEncoder.encode(content);
75
84
  }
@@ -124,6 +133,8 @@
124
133
  return target.name;
125
134
  case "defaultProps":
126
135
  return;
136
+ case "_debugInfo":
137
+ return;
127
138
  case "toJSON":
128
139
  return;
129
140
  case Symbol.toPrimitive:
@@ -187,6 +198,73 @@
187
198
  new Proxy(clientReference, deepProxyHandlers)));
188
199
  return clientReference;
189
200
  }
201
+ function resolveClientReferenceMetadata(config, clientReference) {
202
+ var modulePath = clientReference.$$id,
203
+ name = "",
204
+ resolvedModuleData = config[modulePath];
205
+ if (resolvedModuleData) name = resolvedModuleData.name;
206
+ else {
207
+ var idx = modulePath.lastIndexOf("#");
208
+ -1 !== idx &&
209
+ ((name = modulePath.slice(idx + 1)),
210
+ (resolvedModuleData = config[modulePath.slice(0, idx)]));
211
+ if (!resolvedModuleData)
212
+ throw Error(
213
+ 'Could not find the module "' +
214
+ modulePath +
215
+ '" in the React Client Manifest. This is probably a bug in the React Server Components bundler.'
216
+ );
217
+ }
218
+ if (!0 === resolvedModuleData.async && !0 === clientReference.$$async)
219
+ throw Error(
220
+ 'The module "' +
221
+ modulePath +
222
+ '" 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.'
223
+ );
224
+ return !0 === resolvedModuleData.async || !0 === clientReference.$$async
225
+ ? [resolvedModuleData.id, resolvedModuleData.chunks, name, 1]
226
+ : [resolvedModuleData.id, resolvedModuleData.chunks, name];
227
+ }
228
+ function preload(href, as, options) {
229
+ if ("string" === typeof href) {
230
+ var request = resolveRequest();
231
+ if (request) {
232
+ var hints = request.hints,
233
+ key = "L";
234
+ if ("image" === as && options) {
235
+ var imageSrcSet = options.imageSrcSet,
236
+ imageSizes = options.imageSizes,
237
+ uniquePart = "";
238
+ "string" === typeof imageSrcSet && "" !== imageSrcSet
239
+ ? ((uniquePart += "[" + imageSrcSet + "]"),
240
+ "string" === typeof imageSizes &&
241
+ (uniquePart += "[" + imageSizes + "]"))
242
+ : (uniquePart += "[][]" + href);
243
+ key += "[image]" + uniquePart;
244
+ } else key += "[" + as + "]" + href;
245
+ hints.has(key) ||
246
+ (hints.add(key),
247
+ (options = trimOptions(options))
248
+ ? emitHint(request, "L", [href, as, options])
249
+ : emitHint(request, "L", [href, as]));
250
+ } else previousDispatcher.L(href, as, options);
251
+ }
252
+ }
253
+ function preloadModule$1(href, options) {
254
+ if ("string" === typeof href) {
255
+ var request = resolveRequest();
256
+ if (request) {
257
+ var hints = request.hints,
258
+ key = "m|" + href;
259
+ if (hints.has(key)) return;
260
+ hints.add(key);
261
+ return (options = trimOptions(options))
262
+ ? emitHint(request, "m", [href, options])
263
+ : emitHint(request, "m", href);
264
+ }
265
+ previousDispatcher.m(href, options);
266
+ }
267
+ }
190
268
  function trimOptions(options) {
191
269
  if (null == options) return null;
192
270
  var hasProperties = !1,
@@ -197,38 +275,227 @@
197
275
  ((hasProperties = !0), (trimmed[key] = options[key]));
198
276
  return hasProperties ? trimmed : null;
199
277
  }
200
- function parseStackTrace(error, skipFrames) {
201
- a: {
202
- var previousPrepare = Error.prepareStackTrace;
203
- Error.prepareStackTrace = void 0;
204
- try {
205
- var stack = String(error.stack);
206
- break a;
207
- } finally {
208
- Error.prepareStackTrace = previousPrepare;
278
+ function getChildFormatContext(parentContext, type, props) {
279
+ switch (type) {
280
+ case "img":
281
+ type = props.src;
282
+ var srcSet = props.srcSet;
283
+ if (
284
+ !(
285
+ "lazy" === props.loading ||
286
+ (!type && !srcSet) ||
287
+ ("string" !== typeof type && null != type) ||
288
+ ("string" !== typeof srcSet && null != srcSet) ||
289
+ "low" === props.fetchPriority ||
290
+ parentContext & 3
291
+ ) &&
292
+ ("string" !== typeof type ||
293
+ ":" !== type[4] ||
294
+ ("d" !== type[0] && "D" !== type[0]) ||
295
+ ("a" !== type[1] && "A" !== type[1]) ||
296
+ ("t" !== type[2] && "T" !== type[2]) ||
297
+ ("a" !== type[3] && "A" !== type[3])) &&
298
+ ("string" !== typeof srcSet ||
299
+ ":" !== srcSet[4] ||
300
+ ("d" !== srcSet[0] && "D" !== srcSet[0]) ||
301
+ ("a" !== srcSet[1] && "A" !== srcSet[1]) ||
302
+ ("t" !== srcSet[2] && "T" !== srcSet[2]) ||
303
+ ("a" !== srcSet[3] && "A" !== srcSet[3]))
304
+ ) {
305
+ var sizes = "string" === typeof props.sizes ? props.sizes : void 0;
306
+ var input = props.crossOrigin;
307
+ preload(type || "", "image", {
308
+ imageSrcSet: srcSet,
309
+ imageSizes: sizes,
310
+ crossOrigin:
311
+ "string" === typeof input
312
+ ? "use-credentials" === input
313
+ ? input
314
+ : ""
315
+ : void 0,
316
+ integrity: props.integrity,
317
+ type: props.type,
318
+ fetchPriority: props.fetchPriority,
319
+ referrerPolicy: props.referrerPolicy
320
+ });
321
+ }
322
+ return parentContext;
323
+ case "link":
324
+ type = props.rel;
325
+ srcSet = props.href;
326
+ if (
327
+ !(
328
+ parentContext & 1 ||
329
+ null != props.itemProp ||
330
+ "string" !== typeof type ||
331
+ "string" !== typeof srcSet ||
332
+ "" === srcSet
333
+ )
334
+ )
335
+ switch (type) {
336
+ case "preload":
337
+ preload(srcSet, props.as, {
338
+ crossOrigin: props.crossOrigin,
339
+ integrity: props.integrity,
340
+ nonce: props.nonce,
341
+ type: props.type,
342
+ fetchPriority: props.fetchPriority,
343
+ referrerPolicy: props.referrerPolicy,
344
+ imageSrcSet: props.imageSrcSet,
345
+ imageSizes: props.imageSizes,
346
+ media: props.media
347
+ });
348
+ break;
349
+ case "modulepreload":
350
+ preloadModule$1(srcSet, {
351
+ as: props.as,
352
+ crossOrigin: props.crossOrigin,
353
+ integrity: props.integrity,
354
+ nonce: props.nonce
355
+ });
356
+ break;
357
+ case "stylesheet":
358
+ preload(srcSet, "stylesheet", {
359
+ crossOrigin: props.crossOrigin,
360
+ integrity: props.integrity,
361
+ nonce: props.nonce,
362
+ type: props.type,
363
+ fetchPriority: props.fetchPriority,
364
+ referrerPolicy: props.referrerPolicy,
365
+ media: props.media
366
+ });
367
+ }
368
+ return parentContext;
369
+ case "picture":
370
+ return parentContext | 2;
371
+ case "noscript":
372
+ return parentContext | 1;
373
+ default:
374
+ return parentContext;
375
+ }
376
+ }
377
+ function collectStackTracePrivate(error, structuredStackTrace) {
378
+ error = [];
379
+ for (var i = framesToSkip; i < structuredStackTrace.length; i++) {
380
+ var callSite = structuredStackTrace[i],
381
+ name = callSite.getFunctionName() || "<anonymous>";
382
+ if (name.includes("react_stack_bottom_frame")) break;
383
+ else if (callSite.isNative())
384
+ (callSite = callSite.isAsync()),
385
+ error.push([name, "", 0, 0, 0, 0, callSite]);
386
+ else {
387
+ if (callSite.isConstructor()) name = "new " + name;
388
+ else if (!callSite.isToplevel()) {
389
+ var callSite$jscomp$0 = callSite;
390
+ name = callSite$jscomp$0.getTypeName();
391
+ var methodName = callSite$jscomp$0.getMethodName();
392
+ callSite$jscomp$0 = callSite$jscomp$0.getFunctionName();
393
+ var result = "";
394
+ callSite$jscomp$0
395
+ ? (name &&
396
+ identifierRegExp.test(callSite$jscomp$0) &&
397
+ callSite$jscomp$0 !== name &&
398
+ (result += name + "."),
399
+ (result += callSite$jscomp$0),
400
+ !methodName ||
401
+ callSite$jscomp$0 === methodName ||
402
+ callSite$jscomp$0.endsWith("." + methodName) ||
403
+ callSite$jscomp$0.endsWith(" " + methodName) ||
404
+ (result += " [as " + methodName + "]"))
405
+ : (name && (result += name + "."),
406
+ (result = methodName
407
+ ? result + methodName
408
+ : result + "<anonymous>"));
409
+ name = result;
410
+ }
411
+ "<anonymous>" === name && (name = "");
412
+ methodName = callSite.getScriptNameOrSourceURL() || "<anonymous>";
413
+ "<anonymous>" === methodName &&
414
+ ((methodName = ""),
415
+ callSite.isEval() &&
416
+ (callSite$jscomp$0 = callSite.getEvalOrigin()) &&
417
+ (methodName = callSite$jscomp$0.toString() + ", <anonymous>"));
418
+ callSite$jscomp$0 = callSite.getLineNumber() || 0;
419
+ result = callSite.getColumnNumber() || 0;
420
+ var enclosingLine =
421
+ "function" === typeof callSite.getEnclosingLineNumber
422
+ ? callSite.getEnclosingLineNumber() || 0
423
+ : 0,
424
+ enclosingCol =
425
+ "function" === typeof callSite.getEnclosingColumnNumber
426
+ ? callSite.getEnclosingColumnNumber() || 0
427
+ : 0;
428
+ callSite = callSite.isAsync();
429
+ error.push([
430
+ name,
431
+ methodName,
432
+ callSite$jscomp$0,
433
+ result,
434
+ enclosingLine,
435
+ enclosingCol,
436
+ callSite
437
+ ]);
209
438
  }
210
- stack = void 0;
211
439
  }
440
+ collectedStackTrace = error;
441
+ return "";
442
+ }
443
+ function collectStackTrace(error, structuredStackTrace) {
444
+ collectStackTracePrivate(error, structuredStackTrace);
445
+ error = (error.name || "Error") + ": " + (error.message || "");
446
+ for (var i = 0; i < structuredStackTrace.length; i++)
447
+ error += "\n at " + structuredStackTrace[i].toString();
448
+ return error;
449
+ }
450
+ function parseStackTrace(error, skipFrames) {
451
+ var existing = stackTraceCache.get(error);
452
+ if (void 0 !== existing) return existing;
453
+ collectedStackTrace = null;
454
+ framesToSkip = skipFrames;
455
+ existing = Error.prepareStackTrace;
456
+ Error.prepareStackTrace = collectStackTrace;
457
+ try {
458
+ var stack = String(error.stack);
459
+ } finally {
460
+ Error.prepareStackTrace = existing;
461
+ }
462
+ if (null !== collectedStackTrace)
463
+ return (
464
+ (stack = collectedStackTrace),
465
+ (collectedStackTrace = null),
466
+ stackTraceCache.set(error, stack),
467
+ stack
468
+ );
212
469
  stack.startsWith("Error: react-stack-top-frame\n") &&
213
470
  (stack = stack.slice(29));
214
- error = stack.indexOf("react_stack_bottom_frame");
215
- -1 !== error && (error = stack.lastIndexOf("\n", error));
216
- -1 !== error && (stack = stack.slice(0, error));
471
+ existing = stack.indexOf("react_stack_bottom_frame");
472
+ -1 !== existing && (existing = stack.lastIndexOf("\n", existing));
473
+ -1 !== existing && (stack = stack.slice(0, existing));
217
474
  stack = stack.split("\n");
218
- for (error = []; skipFrames < stack.length; skipFrames++)
219
- if ((previousPrepare = frameRegExp.exec(stack[skipFrames]))) {
220
- var name = previousPrepare[1] || "";
221
- "<anonymous>" === name && (name = "");
222
- var filename = previousPrepare[2] || previousPrepare[5] || "";
475
+ for (existing = []; skipFrames < stack.length; skipFrames++) {
476
+ var parsed = frameRegExp.exec(stack[skipFrames]);
477
+ if (parsed) {
478
+ var name = parsed[1] || "",
479
+ isAsync = "async " === parsed[8];
480
+ "<anonymous>" === name
481
+ ? (name = "")
482
+ : name.startsWith("async ") &&
483
+ ((name = name.slice(5)), (isAsync = !0));
484
+ var filename = parsed[2] || parsed[5] || "";
223
485
  "<anonymous>" === filename && (filename = "");
224
- error.push([
486
+ existing.push([
225
487
  name,
226
488
  filename,
227
- +(previousPrepare[3] || previousPrepare[6]),
228
- +(previousPrepare[4] || previousPrepare[7])
489
+ +(parsed[3] || parsed[6]),
490
+ +(parsed[4] || parsed[7]),
491
+ 0,
492
+ 0,
493
+ isAsync
229
494
  ]);
230
495
  }
231
- return error;
496
+ }
497
+ stackTraceCache.set(error, existing);
498
+ return existing;
232
499
  }
233
500
  function createTemporaryReference(temporaryReferences, id) {
234
501
  var reference = Object.defineProperties(
@@ -251,13 +518,13 @@
251
518
  maybeIterable["@@iterator"];
252
519
  return "function" === typeof maybeIterable ? maybeIterable : null;
253
520
  }
254
- function noop$1() {}
521
+ function noop() {}
255
522
  function trackUsedThenable(thenableState, thenable, index) {
256
523
  index = thenableState[index];
257
524
  void 0 === index
258
- ? thenableState.push(thenable)
259
- : index !== thenable &&
260
- (thenable.then(noop$1, noop$1), (thenable = index));
525
+ ? (thenableState.push(thenable),
526
+ (thenableState._stacks || (thenableState._stacks = [])).push(Error()))
527
+ : index !== thenable && (thenable.then(noop, noop), (thenable = index));
261
528
  switch (thenable.status) {
262
529
  case "fulfilled":
263
530
  return thenable.value;
@@ -265,7 +532,7 @@
265
532
  throw thenable.reason;
266
533
  default:
267
534
  "string" === typeof thenable.status
268
- ? thenable.then(noop$1, noop$1)
535
+ ? thenable.then(noop, noop)
269
536
  : ((thenableState = thenable),
270
537
  (thenableState.status = "pending"),
271
538
  thenableState.then(
@@ -339,6 +606,13 @@
339
606
  if (!(object[i] in ObjectPrototype)) return !1;
340
607
  return !0;
341
608
  }
609
+ function isGetter(object, name) {
610
+ if (object === Object.prototype || null === object) return !1;
611
+ var descriptor = Object.getOwnPropertyDescriptor(object, name);
612
+ return void 0 === descriptor
613
+ ? isGetter(getPrototypeOf(object), name)
614
+ : "function" === typeof descriptor.get;
615
+ }
342
616
  function isSimpleObject(object) {
343
617
  if (!isObjectPrototype(getPrototypeOf(object))) return !1;
344
618
  for (
@@ -358,11 +632,8 @@
358
632
  return !0;
359
633
  }
360
634
  function objectName(object) {
361
- return Object.prototype.toString
362
- .call(object)
363
- .replace(/^\[object (.*)\]$/, function (m, p0) {
364
- return p0;
365
- });
635
+ object = Object.prototype.toString.call(object);
636
+ return object.slice(8, object.length - 1);
366
637
  }
367
638
  function describeKeyForErrorMessage(key) {
368
639
  var encodedKey = JSON.stringify(key);
@@ -526,24 +797,25 @@
526
797
  !filename.includes("node_modules")
527
798
  );
528
799
  }
529
- function filterStackTrace(request, error, skipFrames) {
800
+ function filterStackTrace(request, stack) {
530
801
  request = request.filterStackFrame;
531
- error = parseStackTrace(error, skipFrames);
532
- for (skipFrames = 0; skipFrames < error.length; skipFrames++) {
533
- var callsite = error[skipFrames],
534
- functionName = callsite[0],
535
- url = callsite[1];
536
- if (url.startsWith("rsc://React/")) {
537
- var envIdx = url.indexOf("/", 12),
802
+ for (var filteredStack = [], i = 0; i < stack.length; i++) {
803
+ var callsite = stack[i],
804
+ functionName = callsite[0];
805
+ var url = callsite[1];
806
+ if (url.startsWith("about://React/")) {
807
+ var envIdx = url.indexOf("/", 14),
538
808
  suffixIdx = url.lastIndexOf("?");
539
809
  -1 < envIdx &&
540
810
  -1 < suffixIdx &&
541
- (url = callsite[1] = url.slice(envIdx + 1, suffixIdx));
811
+ (url = decodeURI(url.slice(envIdx + 1, suffixIdx)));
542
812
  }
543
- request(url, functionName) ||
544
- (error.splice(skipFrames, 1), skipFrames--);
813
+ request(url, functionName, callsite[2], callsite[3]) &&
814
+ ((callsite = callsite.slice(0)),
815
+ (callsite[1] = url),
816
+ filteredStack.push(callsite));
545
817
  }
546
- return error;
818
+ return filteredStack;
547
819
  }
548
820
  function patchConsole(consoleInst, methodName) {
549
821
  var descriptor = Object.getOwnPropertyDescriptor(consoleInst, methodName);
@@ -555,16 +827,83 @@
555
827
  var originalMethod = descriptor.value;
556
828
  descriptor = Object.getOwnPropertyDescriptor(originalMethod, "name");
557
829
  var wrapperMethod = function () {
558
- var request = currentRequest ? currentRequest : null;
830
+ var request = resolveRequest();
559
831
  if (("assert" !== methodName || !arguments[0]) && null !== request) {
560
- var stack = filterStackTrace(
832
+ a: {
833
+ var error = Error("react-stack-top-frame");
834
+ collectedStackTrace = null;
835
+ framesToSkip = 1;
836
+ var previousPrepare = Error.prepareStackTrace;
837
+ Error.prepareStackTrace = collectStackTracePrivate;
838
+ try {
839
+ if ("" !== error.stack) {
840
+ var JSCompiler_inline_result = null;
841
+ break a;
842
+ }
843
+ } finally {
844
+ Error.prepareStackTrace = previousPrepare;
845
+ }
846
+ JSCompiler_inline_result = collectedStackTrace;
847
+ }
848
+ JSCompiler_inline_result = filterStackTrace(
849
+ request,
850
+ JSCompiler_inline_result || []
851
+ );
852
+ request.pendingDebugChunks++;
853
+ error = resolveOwner();
854
+ previousPrepare = Array.from(arguments);
855
+ a: {
856
+ var env = 0;
857
+ switch (methodName) {
858
+ case "dir":
859
+ case "dirxml":
860
+ case "groupEnd":
861
+ case "table":
862
+ env = null;
863
+ break a;
864
+ case "assert":
865
+ env = 1;
866
+ }
867
+ var format = previousPrepare[env],
868
+ style = previousPrepare[env + 1],
869
+ badge = previousPrepare[env + 2];
870
+ "string" === typeof format &&
871
+ format.startsWith("%c%s%c") &&
872
+ "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" ===
873
+ style &&
874
+ "string" === typeof badge
875
+ ? ((format = format.slice(6)),
876
+ " " === format[0] && (format = format.slice(1)),
877
+ previousPrepare.splice(env, 4, format),
878
+ (env = badge.slice(1, badge.length - 1)))
879
+ : (env = null);
880
+ }
881
+ null === env && (env = (0, request.environmentName)());
882
+ null != error && outlineComponentInfo(request, error);
883
+ badge = [methodName, JSCompiler_inline_result, error, env];
884
+ badge.push.apply(badge, previousPrepare);
885
+ previousPrepare = serializeDebugModel(
561
886
  request,
562
- Error("react-stack-top-frame"),
563
- 1
887
+ (null === request.deferredDebugObjects ? 500 : 10) +
888
+ JSCompiler_inline_result.length,
889
+ badge
564
890
  );
565
- request.pendingChunks++;
566
- var owner = resolveOwner();
567
- emitConsoleChunk(request, methodName, owner, stack, arguments);
891
+ "[" !== previousPrepare[0] &&
892
+ (previousPrepare = serializeDebugModel(
893
+ request,
894
+ 10 + JSCompiler_inline_result.length,
895
+ [
896
+ methodName,
897
+ JSCompiler_inline_result,
898
+ error,
899
+ env,
900
+ "Unknown Value: React could not send it from the server."
901
+ ]
902
+ ));
903
+ JSCompiler_inline_result = stringToChunk(
904
+ ":W" + previousPrepare + "\n"
905
+ );
906
+ request.completedDebugChunks.push(JSCompiler_inline_result);
568
907
  }
569
908
  return originalMethod.apply(this, arguments);
570
909
  };
@@ -632,19 +971,19 @@
632
971
  function defaultErrorHandler(error) {
633
972
  console.error(error);
634
973
  }
635
- function defaultPostponeHandler() {}
636
974
  function RequestInstance(
637
975
  type,
638
976
  model,
639
977
  bundlerConfig,
640
978
  onError,
641
- identifierPrefix,
642
979
  onPostpone,
980
+ onAllReady,
981
+ onFatalError,
982
+ identifierPrefix,
643
983
  temporaryReferences,
644
984
  environmentName,
645
985
  filterStackFrame,
646
- onAllReady,
647
- onFatalError
986
+ keepDebugAlive
648
987
  ) {
649
988
  if (
650
989
  null !== ReactSharedInternalsServer.A &&
@@ -659,14 +998,14 @@
659
998
  pingedTasks = [],
660
999
  hints = new Set();
661
1000
  this.type = type;
662
- this.status = OPENING;
1001
+ this.status = 10;
663
1002
  this.flushScheduled = !1;
664
1003
  this.destination = this.fatalError = null;
665
1004
  this.bundlerConfig = bundlerConfig;
666
1005
  this.cache = new Map();
1006
+ this.cacheController = new AbortController();
667
1007
  this.pendingChunks = this.nextChunkId = 0;
668
1008
  this.hints = hints;
669
- this.abortListeners = new Set();
670
1009
  this.abortableTasks = abortSet;
671
1010
  this.pingedTasks = pingedTasks;
672
1011
  this.completedImportChunks = [];
@@ -686,6 +1025,9 @@
686
1025
  void 0 === onPostpone ? defaultPostponeHandler : onPostpone;
687
1026
  this.onAllReady = onAllReady;
688
1027
  this.onFatalError = onFatalError;
1028
+ this.pendingDebugChunks = 0;
1029
+ this.completedDebugChunks = [];
1030
+ this.debugDestination = null;
689
1031
  this.environmentName =
690
1032
  void 0 === environmentName
691
1033
  ? function () {
@@ -701,10 +1043,27 @@
701
1043
  ? defaultFilterStackFrame
702
1044
  : filterStackFrame;
703
1045
  this.didWarnForKey = null;
704
- type = createTask(this, model, null, !1, abortSet, null, null, null);
705
- pingedTasks.push(type);
1046
+ this.writtenDebugObjects = new WeakMap();
1047
+ this.deferredDebugObjects = keepDebugAlive
1048
+ ? { retained: new Map(), existing: new Map() }
1049
+ : null;
1050
+ type = this.timeOrigin = performance.now();
1051
+ emitTimeOriginChunk(this, type + performance.timeOrigin);
1052
+ this.abortTime = -0;
1053
+ model = createTask(
1054
+ this,
1055
+ model,
1056
+ null,
1057
+ !1,
1058
+ 0,
1059
+ abortSet,
1060
+ type,
1061
+ null,
1062
+ null,
1063
+ null
1064
+ );
1065
+ pingedTasks.push(model);
706
1066
  }
707
- function noop() {}
708
1067
  function createRequest(
709
1068
  model,
710
1069
  bundlerConfig,
@@ -713,7 +1072,8 @@
713
1072
  onPostpone,
714
1073
  temporaryReferences,
715
1074
  environmentName,
716
- filterStackFrame
1075
+ filterStackFrame,
1076
+ keepDebugAlive
717
1077
  ) {
718
1078
  resetOwnerStackLimit();
719
1079
  return new RequestInstance(
@@ -721,13 +1081,14 @@
721
1081
  model,
722
1082
  bundlerConfig,
723
1083
  onError,
724
- identifierPrefix,
725
1084
  onPostpone,
1085
+ noop,
1086
+ noop,
1087
+ identifierPrefix,
726
1088
  temporaryReferences,
727
1089
  environmentName,
728
1090
  filterStackFrame,
729
- noop,
730
- noop
1091
+ keepDebugAlive
731
1092
  );
732
1093
  }
733
1094
  function createPrerenderRequest(
@@ -740,52 +1101,146 @@
740
1101
  onPostpone,
741
1102
  temporaryReferences,
742
1103
  environmentName,
743
- filterStackFrame
1104
+ filterStackFrame,
1105
+ keepDebugAlive
744
1106
  ) {
745
1107
  resetOwnerStackLimit();
746
1108
  return new RequestInstance(
747
- PRERENDER,
1109
+ 21,
748
1110
  model,
749
1111
  bundlerConfig,
750
1112
  onError,
751
- identifierPrefix,
752
1113
  onPostpone,
1114
+ onAllReady,
1115
+ onFatalError,
1116
+ identifierPrefix,
753
1117
  temporaryReferences,
754
1118
  environmentName,
755
1119
  filterStackFrame,
756
- onAllReady,
757
- onFatalError
1120
+ keepDebugAlive
1121
+ );
1122
+ }
1123
+ function resolveRequest() {
1124
+ return currentRequest ? currentRequest : null;
1125
+ }
1126
+ function serializeDebugThenable(request, counter, thenable) {
1127
+ request.pendingDebugChunks++;
1128
+ var id = request.nextChunkId++,
1129
+ ref = "$@" + id.toString(16);
1130
+ request.writtenDebugObjects.set(thenable, ref);
1131
+ switch (thenable.status) {
1132
+ case "fulfilled":
1133
+ return (
1134
+ emitOutlinedDebugModelChunk(request, id, counter, thenable.value),
1135
+ ref
1136
+ );
1137
+ case "rejected":
1138
+ return (
1139
+ emitErrorChunk(request, id, "", thenable.reason, !0, null), ref
1140
+ );
1141
+ }
1142
+ if (request.status === ABORTING)
1143
+ return emitDebugHaltChunk(request, id), ref;
1144
+ var deferredDebugObjects = request.deferredDebugObjects;
1145
+ if (null !== deferredDebugObjects)
1146
+ return (
1147
+ deferredDebugObjects.retained.set(id, thenable),
1148
+ (ref = "$Y@" + id.toString(16)),
1149
+ request.writtenDebugObjects.set(thenable, ref),
1150
+ ref
1151
+ );
1152
+ var cancelled = !1;
1153
+ thenable.then(
1154
+ function (value) {
1155
+ cancelled ||
1156
+ ((cancelled = !0),
1157
+ request.status === ABORTING
1158
+ ? emitDebugHaltChunk(request, id)
1159
+ : emitOutlinedDebugModelChunk(request, id, counter, value),
1160
+ enqueueFlush(request));
1161
+ },
1162
+ function (reason) {
1163
+ cancelled ||
1164
+ ((cancelled = !0),
1165
+ request.status === ABORTING
1166
+ ? emitDebugHaltChunk(request, id)
1167
+ : emitErrorChunk(request, id, "", reason, !0, null),
1168
+ enqueueFlush(request));
1169
+ }
1170
+ );
1171
+ Promise.resolve().then(function () {
1172
+ cancelled ||
1173
+ ((cancelled = !0),
1174
+ emitDebugHaltChunk(request, id),
1175
+ enqueueFlush(request),
1176
+ (counter = request = null));
1177
+ });
1178
+ return ref;
1179
+ }
1180
+ function emitRequestedDebugThenable(request, id, counter, thenable) {
1181
+ thenable.then(
1182
+ function (value) {
1183
+ request.status === ABORTING
1184
+ ? emitDebugHaltChunk(request, id)
1185
+ : emitOutlinedDebugModelChunk(request, id, counter, value);
1186
+ enqueueFlush(request);
1187
+ },
1188
+ function (reason) {
1189
+ request.status === ABORTING
1190
+ ? emitDebugHaltChunk(request, id)
1191
+ : emitErrorChunk(request, id, "", reason, !0, null);
1192
+ enqueueFlush(request);
1193
+ }
758
1194
  );
759
1195
  }
760
1196
  function serializeThenable(request, task, thenable) {
761
1197
  var newTask = createTask(
762
1198
  request,
763
- null,
1199
+ thenable,
764
1200
  task.keyPath,
765
1201
  task.implicitSlot,
1202
+ task.formatContext,
766
1203
  request.abortableTasks,
1204
+ task.time,
767
1205
  task.debugOwner,
768
1206
  task.debugStack,
769
1207
  task.debugTask
770
1208
  );
771
- (task = thenable._debugInfo) &&
772
- forwardDebugInfo(request, newTask.id, task);
773
1209
  switch (thenable.status) {
774
1210
  case "fulfilled":
775
1211
  return (
1212
+ forwardDebugInfoFromThenable(
1213
+ request,
1214
+ newTask,
1215
+ thenable,
1216
+ null,
1217
+ null
1218
+ ),
776
1219
  (newTask.model = thenable.value),
777
1220
  pingTask(request, newTask),
778
1221
  newTask.id
779
1222
  );
780
1223
  case "rejected":
781
- return erroredTask(request, newTask, thenable.reason), newTask.id;
1224
+ return (
1225
+ forwardDebugInfoFromThenable(
1226
+ request,
1227
+ newTask,
1228
+ thenable,
1229
+ null,
1230
+ null
1231
+ ),
1232
+ erroredTask(request, newTask, thenable.reason),
1233
+ newTask.id
1234
+ );
782
1235
  default:
783
1236
  if (request.status === ABORTING)
784
1237
  return (
785
1238
  request.abortableTasks.delete(newTask),
786
- (newTask.status = ABORTED),
787
- (task = stringify(serializeByValueID(request.fatalError))),
788
- emitModelChunk(request, newTask.id, task),
1239
+ 21 === request.type
1240
+ ? (haltTask(newTask), finishHaltedTask(newTask, request))
1241
+ : ((task = request.fatalError),
1242
+ abortTask(newTask),
1243
+ finishAbortedTask(newTask, request, task)),
789
1244
  newTask.id
790
1245
  );
791
1246
  "string" !== typeof thenable.status &&
@@ -804,25 +1259,33 @@
804
1259
  }
805
1260
  thenable.then(
806
1261
  function (value) {
1262
+ forwardDebugInfoFromCurrentContext(request, newTask, thenable);
807
1263
  newTask.model = value;
808
1264
  pingTask(request, newTask);
809
1265
  },
810
1266
  function (reason) {
811
- newTask.status === PENDING$1 &&
812
- (erroredTask(request, newTask, reason), enqueueFlush(request));
1267
+ 0 === newTask.status &&
1268
+ ((newTask.timed = !0),
1269
+ erroredTask(request, newTask, reason),
1270
+ enqueueFlush(request));
813
1271
  }
814
1272
  );
815
1273
  return newTask.id;
816
1274
  }
817
1275
  function serializeReadableStream(request, task, stream) {
818
1276
  function progress(entry) {
819
- if (!aborted)
1277
+ if (0 === streamTask.status)
820
1278
  if (entry.done)
821
- request.abortListeners.delete(abortStream),
1279
+ (streamTask.status = 1),
822
1280
  (entry = streamTask.id.toString(16) + ":C\n"),
823
1281
  request.completedRegularChunks.push(stringToChunk(entry)),
1282
+ request.abortableTasks.delete(streamTask),
1283
+ request.cacheController.signal.removeEventListener(
1284
+ "abort",
1285
+ abortStream
1286
+ ),
824
1287
  enqueueFlush(request),
825
- (aborted = !0);
1288
+ callOnAllReadyIfReady(request);
826
1289
  else
827
1290
  try {
828
1291
  (streamTask.model = entry.value),
@@ -835,20 +1298,27 @@
835
1298
  }
836
1299
  }
837
1300
  function error(reason) {
838
- aborted ||
839
- ((aborted = !0),
840
- request.abortListeners.delete(abortStream),
1301
+ 0 === streamTask.status &&
1302
+ (request.cacheController.signal.removeEventListener(
1303
+ "abort",
1304
+ abortStream
1305
+ ),
841
1306
  erroredTask(request, streamTask, reason),
842
1307
  enqueueFlush(request),
843
1308
  reader.cancel(reason).then(error, error));
844
1309
  }
845
- function abortStream(reason) {
846
- aborted ||
847
- ((aborted = !0),
848
- request.abortListeners.delete(abortStream),
849
- erroredTask(request, streamTask, reason),
850
- enqueueFlush(request),
851
- reader.cancel(reason).then(error, error));
1310
+ function abortStream() {
1311
+ if (0 === streamTask.status) {
1312
+ var signal = request.cacheController.signal;
1313
+ signal.removeEventListener("abort", abortStream);
1314
+ signal = signal.reason;
1315
+ 21 === request.type
1316
+ ? (request.abortableTasks.delete(streamTask),
1317
+ haltTask(streamTask),
1318
+ finishHaltedTask(streamTask, request))
1319
+ : (erroredTask(request, streamTask, signal), enqueueFlush(request));
1320
+ reader.cancel(signal).then(error, error);
1321
+ }
852
1322
  }
853
1323
  var supportsBYOB = stream.supportsBYOB;
854
1324
  if (void 0 === supportsBYOB)
@@ -863,26 +1333,26 @@
863
1333
  task.model,
864
1334
  task.keyPath,
865
1335
  task.implicitSlot,
1336
+ task.formatContext,
866
1337
  request.abortableTasks,
1338
+ task.time,
867
1339
  task.debugOwner,
868
1340
  task.debugStack,
869
1341
  task.debugTask
870
1342
  );
871
- request.abortableTasks.delete(streamTask);
872
1343
  request.pendingChunks++;
873
1344
  task =
874
1345
  streamTask.id.toString(16) + ":" + (supportsBYOB ? "r" : "R") + "\n";
875
1346
  request.completedRegularChunks.push(stringToChunk(task));
876
- var aborted = !1;
877
- request.abortListeners.add(abortStream);
1347
+ request.cacheController.signal.addEventListener("abort", abortStream);
878
1348
  reader.read().then(progress, error);
879
1349
  return serializeByValueID(streamTask.id);
880
1350
  }
881
1351
  function serializeAsyncIterable(request, task, iterable, iterator) {
882
1352
  function progress(entry) {
883
- if (!aborted)
1353
+ if (0 === streamTask.status)
884
1354
  if (entry.done) {
885
- request.abortListeners.delete(abortIterable);
1355
+ streamTask.status = 1;
886
1356
  if (void 0 === entry.value)
887
1357
  var endStreamRow = streamTask.id.toString(16) + ":C\n";
888
1358
  else
@@ -898,8 +1368,13 @@
898
1368
  return;
899
1369
  }
900
1370
  request.completedRegularChunks.push(stringToChunk(endStreamRow));
1371
+ request.abortableTasks.delete(streamTask);
1372
+ request.cacheController.signal.removeEventListener(
1373
+ "abort",
1374
+ abortIterable
1375
+ );
901
1376
  enqueueFlush(request);
902
- aborted = !0;
1377
+ callOnAllReadyIfReady(request);
903
1378
  } else
904
1379
  try {
905
1380
  (streamTask.model = entry.value),
@@ -912,22 +1387,30 @@
912
1387
  }
913
1388
  }
914
1389
  function error(reason) {
915
- aborted ||
916
- ((aborted = !0),
917
- request.abortListeners.delete(abortIterable),
1390
+ 0 === streamTask.status &&
1391
+ (request.cacheController.signal.removeEventListener(
1392
+ "abort",
1393
+ abortIterable
1394
+ ),
918
1395
  erroredTask(request, streamTask, reason),
919
1396
  enqueueFlush(request),
920
1397
  "function" === typeof iterator.throw &&
921
1398
  iterator.throw(reason).then(error, error));
922
1399
  }
923
- function abortIterable(reason) {
924
- aborted ||
925
- ((aborted = !0),
926
- request.abortListeners.delete(abortIterable),
927
- erroredTask(request, streamTask, reason),
928
- enqueueFlush(request),
1400
+ function abortIterable() {
1401
+ if (0 === streamTask.status) {
1402
+ var signal = request.cacheController.signal;
1403
+ signal.removeEventListener("abort", abortIterable);
1404
+ var reason = signal.reason;
1405
+ 21 === request.type
1406
+ ? (request.abortableTasks.delete(streamTask),
1407
+ haltTask(streamTask),
1408
+ finishHaltedTask(streamTask, request))
1409
+ : (erroredTask(request, streamTask, signal.reason),
1410
+ enqueueFlush(request));
929
1411
  "function" === typeof iterator.throw &&
930
- iterator.throw(reason).then(error, error));
1412
+ iterator.throw(reason).then(error, error);
1413
+ }
931
1414
  }
932
1415
  var isIterator = iterable === iterator,
933
1416
  streamTask = createTask(
@@ -935,19 +1418,20 @@
935
1418
  task.model,
936
1419
  task.keyPath,
937
1420
  task.implicitSlot,
1421
+ task.formatContext,
938
1422
  request.abortableTasks,
1423
+ task.time,
939
1424
  task.debugOwner,
940
1425
  task.debugStack,
941
1426
  task.debugTask
942
1427
  );
943
- request.abortableTasks.delete(streamTask);
1428
+ (task = iterable._debugInfo) &&
1429
+ forwardDebugInfo(request, streamTask, task);
944
1430
  request.pendingChunks++;
945
- task = streamTask.id.toString(16) + ":" + (isIterator ? "x" : "X") + "\n";
946
- request.completedRegularChunks.push(stringToChunk(task));
947
- (iterable = iterable._debugInfo) &&
948
- forwardDebugInfo(request, streamTask.id, iterable);
949
- var aborted = !1;
950
- request.abortListeners.add(abortIterable);
1431
+ isIterator =
1432
+ streamTask.id.toString(16) + ":" + (isIterator ? "x" : "X") + "\n";
1433
+ request.completedRegularChunks.push(stringToChunk(isIterator));
1434
+ request.cacheController.signal.addEventListener("abort", abortIterable);
951
1435
  callIteratorInDEV(iterator, progress, error);
952
1436
  return serializeByValueID(streamTask.id);
953
1437
  }
@@ -962,33 +1446,38 @@
962
1446
  if ("rejected" === thenable.status) throw thenable.reason;
963
1447
  throw thenable;
964
1448
  }
965
- function createLazyWrapperAroundWakeable(wakeable) {
1449
+ function createLazyWrapperAroundWakeable(request, task, wakeable) {
966
1450
  switch (wakeable.status) {
967
1451
  case "fulfilled":
1452
+ return (
1453
+ forwardDebugInfoFromThenable(request, task, wakeable, null, null),
1454
+ wakeable.value
1455
+ );
968
1456
  case "rejected":
1457
+ forwardDebugInfoFromThenable(request, task, wakeable, null, null);
969
1458
  break;
970
1459
  default:
971
1460
  "string" !== typeof wakeable.status &&
972
1461
  ((wakeable.status = "pending"),
973
1462
  wakeable.then(
974
1463
  function (fulfilledValue) {
1464
+ forwardDebugInfoFromCurrentContext(request, task, wakeable);
975
1465
  "pending" === wakeable.status &&
976
1466
  ((wakeable.status = "fulfilled"),
977
1467
  (wakeable.value = fulfilledValue));
978
1468
  },
979
1469
  function (error) {
1470
+ forwardDebugInfoFromCurrentContext(request, task, wakeable);
980
1471
  "pending" === wakeable.status &&
981
1472
  ((wakeable.status = "rejected"), (wakeable.reason = error));
982
1473
  }
983
1474
  ));
984
1475
  }
985
- var lazyType = {
1476
+ return {
986
1477
  $$typeof: REACT_LAZY_TYPE,
987
1478
  _payload: wakeable,
988
1479
  _init: readThenable
989
1480
  };
990
- lazyType._debugInfo = wakeable._debugInfo || [];
991
- return lazyType;
992
1481
  }
993
1482
  function callWithDebugContextInDEV(request, task, callback, arg) {
994
1483
  var componentDebugInfo = {
@@ -1000,7 +1489,7 @@
1000
1489
  componentDebugInfo.stack =
1001
1490
  null === task.debugStack
1002
1491
  ? null
1003
- : filterStackTrace(request, task.debugStack, 1);
1492
+ : filterStackTrace(request, parseStackTrace(task.debugStack, 1));
1004
1493
  componentDebugInfo.debugStack = task.debugStack;
1005
1494
  request = componentDebugInfo.debugTask = task.debugTask;
1006
1495
  currentOwner = componentDebugInfo;
@@ -1030,9 +1519,7 @@
1030
1519
  resolvedValue.$$typeof === REACT_ELEMENT_TYPE &&
1031
1520
  (resolvedValue._store.validated = 1);
1032
1521
  }, voidHandler),
1033
- "fulfilled" === result.status
1034
- ? result.value
1035
- : createLazyWrapperAroundWakeable(result)
1522
+ createLazyWrapperAroundWakeable(request, task, result)
1036
1523
  );
1037
1524
  result.$$typeof === REACT_ELEMENT_TYPE && (result._store.validated = 1);
1038
1525
  var iteratorFn = getIteratorFn(result);
@@ -1085,33 +1572,40 @@
1085
1572
  ) {
1086
1573
  var prevThenableState = task.thenableState;
1087
1574
  task.thenableState = null;
1088
- if (null === debugID) return outlineTask(request, task);
1089
- if (null !== prevThenableState)
1090
- var componentDebugInfo = prevThenableState._componentDebugInfo;
1091
- else {
1092
- var componentDebugID = debugID;
1093
- componentDebugInfo = Component.displayName || Component.name || "";
1094
- var componentEnv = (0, request.environmentName)();
1095
- request.pendingChunks++;
1096
- componentDebugInfo = {
1097
- name: componentDebugInfo,
1098
- env: componentEnv,
1099
- key: key,
1100
- owner: task.debugOwner
1101
- };
1102
- componentDebugInfo.stack =
1103
- null === task.debugStack
1104
- ? null
1105
- : filterStackTrace(request, task.debugStack, 1);
1106
- componentDebugInfo.props = props;
1107
- componentDebugInfo.debugStack = task.debugStack;
1108
- componentDebugInfo.debugTask = task.debugTask;
1109
- outlineComponentInfo(request, componentDebugInfo);
1110
- emitDebugChunk(request, componentDebugID, componentDebugInfo);
1111
- task.environmentName = componentEnv;
1112
- 2 === validated &&
1113
- warnForMissingKey(request, key, componentDebugInfo, task.debugTask);
1114
- }
1575
+ if (canEmitDebugInfo)
1576
+ if (null !== prevThenableState)
1577
+ var componentDebugInfo = prevThenableState._componentDebugInfo;
1578
+ else {
1579
+ var componentDebugID = task.id;
1580
+ componentDebugInfo = Component.displayName || Component.name || "";
1581
+ var componentEnv = (0, request.environmentName)();
1582
+ request.pendingChunks++;
1583
+ componentDebugInfo = {
1584
+ name: componentDebugInfo,
1585
+ env: componentEnv,
1586
+ key: key,
1587
+ owner: task.debugOwner
1588
+ };
1589
+ componentDebugInfo.stack =
1590
+ null === task.debugStack
1591
+ ? null
1592
+ : filterStackTrace(request, parseStackTrace(task.debugStack, 1));
1593
+ componentDebugInfo.props = props;
1594
+ componentDebugInfo.debugStack = task.debugStack;
1595
+ componentDebugInfo.debugTask = task.debugTask;
1596
+ outlineComponentInfo(request, componentDebugInfo);
1597
+ var timestamp = performance.now();
1598
+ timestamp > task.time
1599
+ ? (emitTimingChunk(request, task.id, timestamp),
1600
+ (task.time = timestamp))
1601
+ : task.timed || emitTimingChunk(request, task.id, task.time);
1602
+ task.timed = !0;
1603
+ emitDebugChunk(request, componentDebugID, componentDebugInfo);
1604
+ task.environmentName = componentEnv;
1605
+ 2 === validated &&
1606
+ warnForMissingKey(request, key, componentDebugInfo, task.debugTask);
1607
+ }
1608
+ else return outlineTask(request, task);
1115
1609
  thenableIndexCounter = 0;
1116
1610
  thenableState = prevThenableState;
1117
1611
  currentComponentDebugInfo = componentDebugInfo;
@@ -1129,20 +1623,38 @@
1129
1623
  props.then(voidHandler, voidHandler),
1130
1624
  null)
1131
1625
  );
1626
+ validated = thenableState;
1627
+ if (null !== validated)
1628
+ for (
1629
+ prevThenableState = validated._stacks || (validated._stacks = []),
1630
+ componentDebugID = 0;
1631
+ componentDebugID < validated.length;
1632
+ componentDebugID++
1633
+ )
1634
+ forwardDebugInfoFromThenable(
1635
+ request,
1636
+ task,
1637
+ validated[componentDebugID],
1638
+ componentDebugInfo,
1639
+ prevThenableState[componentDebugID]
1640
+ );
1132
1641
  props = processServerComponentReturnValue(
1133
1642
  request,
1134
1643
  task,
1135
1644
  Component,
1136
1645
  props
1137
1646
  );
1647
+ task.debugOwner = componentDebugInfo;
1648
+ task.debugStack = null;
1649
+ task.debugTask = null;
1138
1650
  Component = task.keyPath;
1139
- validated = task.implicitSlot;
1651
+ componentDebugInfo = task.implicitSlot;
1140
1652
  null !== key
1141
1653
  ? (task.keyPath = null === Component ? key : Component + "," + key)
1142
1654
  : null === Component && (task.implicitSlot = !0);
1143
1655
  request = renderModelDestructive(request, task, emptyRoot, "", props);
1144
1656
  task.keyPath = Component;
1145
- task.implicitSlot = validated;
1657
+ task.implicitSlot = componentDebugInfo;
1146
1658
  return request;
1147
1659
  }
1148
1660
  function warnForMissingKey(request, key, componentDebugInfo, debugTask) {
@@ -1190,8 +1702,8 @@
1190
1702
  task.implicitSlot ? [request] : request
1191
1703
  );
1192
1704
  if ((i = children._debugInfo)) {
1193
- if (null === debugID) return outlineTask(request, task);
1194
- forwardDebugInfo(request, debugID, i);
1705
+ if (canEmitDebugInfo) forwardDebugInfo(request, task, i);
1706
+ else return outlineTask(request, task);
1195
1707
  children = Array.from(children);
1196
1708
  }
1197
1709
  return children;
@@ -1213,21 +1725,39 @@
1213
1725
  getAsyncIterator = getAsyncIterator.call(children);
1214
1726
  return serializeAsyncIterable(request, task, children, getAsyncIterator);
1215
1727
  }
1728
+ function deferTask(request, task) {
1729
+ task = createTask(
1730
+ request,
1731
+ task.model,
1732
+ task.keyPath,
1733
+ task.implicitSlot,
1734
+ task.formatContext,
1735
+ request.abortableTasks,
1736
+ task.time,
1737
+ task.debugOwner,
1738
+ task.debugStack,
1739
+ task.debugTask
1740
+ );
1741
+ pingTask(request, task);
1742
+ return serializeLazyID(task.id);
1743
+ }
1216
1744
  function outlineTask(request, task) {
1217
1745
  task = createTask(
1218
1746
  request,
1219
1747
  task.model,
1220
1748
  task.keyPath,
1221
1749
  task.implicitSlot,
1750
+ task.formatContext,
1222
1751
  request.abortableTasks,
1752
+ task.time,
1223
1753
  task.debugOwner,
1224
1754
  task.debugStack,
1225
1755
  task.debugTask
1226
1756
  );
1227
1757
  retryTask(request, task);
1228
- return task.status === COMPLETED
1758
+ return 1 === task.status
1229
1759
  ? serializeByValueID(task.id)
1230
- : "$L" + task.id.toString(16);
1760
+ : serializeLazyID(task.id);
1231
1761
  }
1232
1762
  function renderElement(request, task, type, key, ref, props, validated) {
1233
1763
  if (null !== ref && void 0 !== ref)
@@ -1254,7 +1784,10 @@
1254
1784
  stack:
1255
1785
  null === task.debugStack
1256
1786
  ? null
1257
- : filterStackTrace(request, task.debugStack, 1),
1787
+ : filterStackTrace(
1788
+ request,
1789
+ parseStackTrace(task.debugStack, 1)
1790
+ ),
1258
1791
  props: props,
1259
1792
  debugStack: task.debugStack,
1260
1793
  debugTask: task.debugTask
@@ -1312,6 +1845,17 @@
1312
1845
  case REACT_ELEMENT_TYPE:
1313
1846
  type._store.validated = 1;
1314
1847
  }
1848
+ else if ("string" === typeof type) {
1849
+ ref = task.formatContext;
1850
+ var newFormatContext = getChildFormatContext(ref, type, props);
1851
+ ref !== newFormatContext &&
1852
+ null != props.children &&
1853
+ outlineModelWithFormatContext(
1854
+ request,
1855
+ props.children,
1856
+ newFormatContext
1857
+ );
1858
+ }
1315
1859
  } else
1316
1860
  return renderFunctionComponent(
1317
1861
  request,
@@ -1323,28 +1867,40 @@
1323
1867
  );
1324
1868
  ref = task.keyPath;
1325
1869
  null === key ? (key = ref) : null !== ref && (key = ref + "," + key);
1326
- null !== task.debugOwner &&
1327
- outlineComponentInfo(request, task.debugOwner);
1870
+ newFormatContext = null;
1871
+ ref = task.debugOwner;
1872
+ null !== ref && outlineComponentInfo(request, ref);
1873
+ if (null !== task.debugStack) {
1874
+ newFormatContext = filterStackTrace(
1875
+ request,
1876
+ parseStackTrace(task.debugStack, 1)
1877
+ );
1878
+ var id = outlineDebugModel(
1879
+ request,
1880
+ { objectLimit: 2 * newFormatContext.length + 1 },
1881
+ newFormatContext
1882
+ );
1883
+ request.writtenObjects.set(newFormatContext, serializeByValueID(id));
1884
+ }
1328
1885
  request = [
1329
1886
  REACT_ELEMENT_TYPE,
1330
1887
  type,
1331
1888
  key,
1332
1889
  props,
1333
- task.debugOwner,
1334
- null === task.debugStack
1335
- ? null
1336
- : filterStackTrace(request, task.debugStack, 1),
1890
+ ref,
1891
+ newFormatContext,
1337
1892
  validated
1338
1893
  ];
1339
1894
  task = task.implicitSlot && null !== key ? [request] : request;
1340
1895
  return task;
1341
1896
  }
1342
1897
  function pingTask(request, task) {
1898
+ task.timed = !0;
1343
1899
  var pingedTasks = request.pingedTasks;
1344
1900
  pingedTasks.push(task);
1345
1901
  1 === pingedTasks.length &&
1346
1902
  ((request.flushScheduled = null !== request.destination),
1347
- request.type === PRERENDER || request.status === OPENING
1903
+ 21 === request.type || 10 === request.status
1348
1904
  ? scheduleMicrotask(function () {
1349
1905
  return performWork(request);
1350
1906
  })
@@ -1357,7 +1913,9 @@
1357
1913
  model,
1358
1914
  keyPath,
1359
1915
  implicitSlot,
1916
+ formatContext,
1360
1917
  abortSet,
1918
+ lastTimestamp,
1361
1919
  debugOwner,
1362
1920
  debugStack,
1363
1921
  debugTask
@@ -1371,10 +1929,11 @@
1371
1929
  request.writtenObjects.set(model, serializeByValueID(id));
1372
1930
  var task = {
1373
1931
  id: id,
1374
- status: PENDING$1,
1932
+ status: 0,
1375
1933
  model: model,
1376
1934
  keyPath: keyPath,
1377
1935
  implicitSlot: implicitSlot,
1936
+ formatContext: formatContext,
1378
1937
  ping: function () {
1379
1938
  return pingTask(request, task);
1380
1939
  },
@@ -1404,8 +1963,10 @@
1404
1963
  });
1405
1964
  return renderModel(request, task, parent, parentPropertyName, value);
1406
1965
  },
1407
- thenableState: null
1966
+ thenableState: null,
1967
+ timed: !1
1408
1968
  };
1969
+ task.time = lastTimestamp;
1409
1970
  task.environmentName = request.environmentName();
1410
1971
  task.debugOwner = debugOwner;
1411
1972
  task.debugStack = debugStack;
@@ -1416,6 +1977,19 @@
1416
1977
  function serializeByValueID(id) {
1417
1978
  return "$" + id.toString(16);
1418
1979
  }
1980
+ function serializeLazyID(id) {
1981
+ return "$L" + id.toString(16);
1982
+ }
1983
+ function serializeDeferredObject(request, value) {
1984
+ var deferredDebugObjects = request.deferredDebugObjects;
1985
+ return null !== deferredDebugObjects
1986
+ ? (request.pendingDebugChunks++,
1987
+ (request = request.nextChunkId++),
1988
+ deferredDebugObjects.existing.set(value, request),
1989
+ deferredDebugObjects.retained.set(request, value),
1990
+ "$Y" + request.toString(16))
1991
+ : "$Y";
1992
+ }
1419
1993
  function serializeNumber(number) {
1420
1994
  return Number.isFinite(number)
1421
1995
  ? 0 === number && -Infinity === 1 / number
@@ -1445,63 +2019,78 @@
1445
2019
  existingId = writtenClientReferences.get(clientReferenceKey);
1446
2020
  if (void 0 !== existingId)
1447
2021
  return parent[0] === REACT_ELEMENT_TYPE && "1" === parentPropertyName
1448
- ? "$L" + existingId.toString(16)
2022
+ ? serializeLazyID(existingId)
1449
2023
  : serializeByValueID(existingId);
1450
2024
  try {
1451
- var config = request.bundlerConfig,
1452
- modulePath = clientReference.$$id;
1453
- existingId = "";
1454
- var resolvedModuleData = config[modulePath];
1455
- if (resolvedModuleData) existingId = resolvedModuleData.name;
1456
- else {
1457
- var idx = modulePath.lastIndexOf("#");
1458
- -1 !== idx &&
1459
- ((existingId = modulePath.slice(idx + 1)),
1460
- (resolvedModuleData = config[modulePath.slice(0, idx)]));
1461
- if (!resolvedModuleData)
1462
- throw Error(
1463
- 'Could not find the module "' +
1464
- modulePath +
1465
- '" in the React Client Manifest. This is probably a bug in the React Server Components bundler.'
1466
- );
1467
- }
1468
- if (!0 === resolvedModuleData.async && !0 === clientReference.$$async)
1469
- throw Error(
1470
- 'The module "' +
1471
- modulePath +
1472
- '" 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.'
1473
- );
1474
- var clientReferenceMetadata =
1475
- !0 === resolvedModuleData.async || !0 === clientReference.$$async
1476
- ? [resolvedModuleData.id, resolvedModuleData.chunks, existingId, 1]
1477
- : [resolvedModuleData.id, resolvedModuleData.chunks, existingId];
2025
+ var clientReferenceMetadata = resolveClientReferenceMetadata(
2026
+ request.bundlerConfig,
2027
+ clientReference
2028
+ );
1478
2029
  request.pendingChunks++;
1479
- var importId = request.nextChunkId++,
1480
- json = stringify(clientReferenceMetadata),
1481
- row = importId.toString(16) + ":I" + json + "\n",
1482
- processedChunk = stringToChunk(row);
1483
- request.completedImportChunks.push(processedChunk);
2030
+ var importId = request.nextChunkId++;
2031
+ emitImportChunk(request, importId, clientReferenceMetadata, !1);
1484
2032
  writtenClientReferences.set(clientReferenceKey, importId);
1485
2033
  return parent[0] === REACT_ELEMENT_TYPE && "1" === parentPropertyName
1486
- ? "$L" + importId.toString(16)
2034
+ ? serializeLazyID(importId)
1487
2035
  : serializeByValueID(importId);
1488
2036
  } catch (x) {
1489
2037
  return (
1490
2038
  request.pendingChunks++,
1491
2039
  (parent = request.nextChunkId++),
1492
2040
  (parentPropertyName = logRecoverableError(request, x, null)),
1493
- emitErrorChunk(request, parent, parentPropertyName, x),
2041
+ emitErrorChunk(request, parent, parentPropertyName, x, !1, null),
2042
+ serializeByValueID(parent)
2043
+ );
2044
+ }
2045
+ }
2046
+ function serializeDebugClientReference(
2047
+ request,
2048
+ parent,
2049
+ parentPropertyName,
2050
+ clientReference
2051
+ ) {
2052
+ var existingId = request.writtenClientReferences.get(
2053
+ clientReference.$$async
2054
+ ? clientReference.$$id + "#async"
2055
+ : clientReference.$$id
2056
+ );
2057
+ if (void 0 !== existingId)
2058
+ return parent[0] === REACT_ELEMENT_TYPE && "1" === parentPropertyName
2059
+ ? serializeLazyID(existingId)
2060
+ : serializeByValueID(existingId);
2061
+ try {
2062
+ var clientReferenceMetadata = resolveClientReferenceMetadata(
2063
+ request.bundlerConfig,
2064
+ clientReference
2065
+ );
2066
+ request.pendingDebugChunks++;
2067
+ var importId = request.nextChunkId++;
2068
+ emitImportChunk(request, importId, clientReferenceMetadata, !0);
2069
+ return parent[0] === REACT_ELEMENT_TYPE && "1" === parentPropertyName
2070
+ ? serializeLazyID(importId)
2071
+ : serializeByValueID(importId);
2072
+ } catch (x) {
2073
+ return (
2074
+ request.pendingDebugChunks++,
2075
+ (parent = request.nextChunkId++),
2076
+ (parentPropertyName = logRecoverableError(request, x, null)),
2077
+ emitErrorChunk(request, parent, parentPropertyName, x, !0, null),
1494
2078
  serializeByValueID(parent)
1495
2079
  );
1496
2080
  }
1497
2081
  }
1498
2082
  function outlineModel(request, value) {
2083
+ return outlineModelWithFormatContext(request, value, 0);
2084
+ }
2085
+ function outlineModelWithFormatContext(request, value, formatContext) {
1499
2086
  value = createTask(
1500
2087
  request,
1501
2088
  value,
1502
2089
  null,
1503
2090
  !1,
2091
+ formatContext,
1504
2092
  request.abortableTasks,
2093
+ performance.now(),
1505
2094
  null,
1506
2095
  null,
1507
2096
  null
@@ -1520,7 +2109,9 @@
1520
2109
  error = serverReference.$$location;
1521
2110
  error &&
1522
2111
  ((error = parseStackTrace(error, 1)),
1523
- 0 < error.length && (location = error[0]));
2112
+ 0 < error.length &&
2113
+ ((location = error[0]),
2114
+ (location = [location[0], location[1], location[2], location[3]])));
1524
2115
  existingId =
1525
2116
  null !== location
1526
2117
  ? {
@@ -1541,7 +2132,7 @@
1541
2132
  function serializeLargeTextString(request, text) {
1542
2133
  request.pendingChunks++;
1543
2134
  var textId = request.nextChunkId++;
1544
- emitTextChunk(request, textId, text);
2135
+ emitTextChunk(request, textId, text, !1);
1545
2136
  return serializeByValueID(textId);
1546
2137
  }
1547
2138
  function serializeMap(request, map) {
@@ -1559,15 +2150,50 @@
1559
2150
  function serializeTypedArray(request, tag, typedArray) {
1560
2151
  request.pendingChunks++;
1561
2152
  var bufferId = request.nextChunkId++;
1562
- emitTypedArrayChunk(request, bufferId, tag, typedArray);
2153
+ emitTypedArrayChunk(request, bufferId, tag, typedArray, !1);
2154
+ return serializeByValueID(bufferId);
2155
+ }
2156
+ function serializeDebugTypedArray(request, tag, typedArray) {
2157
+ request.pendingDebugChunks++;
2158
+ var bufferId = request.nextChunkId++;
2159
+ emitTypedArrayChunk(request, bufferId, tag, typedArray, !0);
1563
2160
  return serializeByValueID(bufferId);
1564
2161
  }
2162
+ function serializeDebugBlob(request, blob) {
2163
+ function progress(entry) {
2164
+ if (entry.done)
2165
+ emitOutlinedDebugModelChunk(
2166
+ request,
2167
+ id,
2168
+ { objectLimit: model.length + 2 },
2169
+ model
2170
+ ),
2171
+ enqueueFlush(request);
2172
+ else
2173
+ return (
2174
+ model.push(entry.value), reader.read().then(progress).catch(error)
2175
+ );
2176
+ }
2177
+ function error(reason) {
2178
+ emitErrorChunk(request, id, "", reason, !0, null);
2179
+ enqueueFlush(request);
2180
+ reader.cancel(reason).then(noop, noop);
2181
+ }
2182
+ var model = [blob.type],
2183
+ reader = blob.stream().getReader();
2184
+ request.pendingDebugChunks++;
2185
+ var id = request.nextChunkId++;
2186
+ reader.read().then(progress).catch(error);
2187
+ return "$B" + id.toString(16);
2188
+ }
1565
2189
  function serializeBlob(request, blob) {
1566
2190
  function progress(entry) {
1567
- if (!aborted)
2191
+ if (0 === newTask.status)
1568
2192
  if (entry.done)
1569
- request.abortListeners.delete(abortBlob),
1570
- (aborted = !0),
2193
+ request.cacheController.signal.removeEventListener(
2194
+ "abort",
2195
+ abortBlob
2196
+ ),
1571
2197
  pingTask(request, newTask);
1572
2198
  else
1573
2199
  return (
@@ -1575,20 +2201,27 @@
1575
2201
  );
1576
2202
  }
1577
2203
  function error(reason) {
1578
- aborted ||
1579
- ((aborted = !0),
1580
- request.abortListeners.delete(abortBlob),
2204
+ 0 === newTask.status &&
2205
+ (request.cacheController.signal.removeEventListener(
2206
+ "abort",
2207
+ abortBlob
2208
+ ),
1581
2209
  erroredTask(request, newTask, reason),
1582
2210
  enqueueFlush(request),
1583
2211
  reader.cancel(reason).then(error, error));
1584
2212
  }
1585
- function abortBlob(reason) {
1586
- aborted ||
1587
- ((aborted = !0),
1588
- request.abortListeners.delete(abortBlob),
1589
- erroredTask(request, newTask, reason),
1590
- enqueueFlush(request),
1591
- reader.cancel(reason).then(error, error));
2213
+ function abortBlob() {
2214
+ if (0 === newTask.status) {
2215
+ var signal = request.cacheController.signal;
2216
+ signal.removeEventListener("abort", abortBlob);
2217
+ signal = signal.reason;
2218
+ 21 === request.type
2219
+ ? (request.abortableTasks.delete(newTask),
2220
+ haltTask(newTask),
2221
+ finishHaltedTask(newTask, request))
2222
+ : (erroredTask(request, newTask, signal), enqueueFlush(request));
2223
+ reader.cancel(signal).then(error, error);
2224
+ }
1592
2225
  }
1593
2226
  var model = [blob.type],
1594
2227
  newTask = createTask(
@@ -1596,18 +2229,20 @@
1596
2229
  model,
1597
2230
  null,
1598
2231
  !1,
2232
+ 0,
1599
2233
  request.abortableTasks,
2234
+ performance.now(),
1600
2235
  null,
1601
2236
  null,
1602
2237
  null
1603
2238
  ),
1604
- reader = blob.stream().getReader(),
1605
- aborted = !1;
1606
- request.abortListeners.add(abortBlob);
2239
+ reader = blob.stream().getReader();
2240
+ request.cacheController.signal.addEventListener("abort", abortBlob);
1607
2241
  reader.read().then(progress).catch(error);
1608
2242
  return "$B" + newTask.id.toString(16);
1609
2243
  }
1610
2244
  function renderModel(request, task, parent, key, value) {
2245
+ serializedSize += key.length;
1611
2246
  var prevKeyPath = task.keyPath,
1612
2247
  prevImplicitSlot = task.implicitSlot;
1613
2248
  try {
@@ -1619,12 +2254,19 @@
1619
2254
  null !== parent &&
1620
2255
  (parent.$$typeof === REACT_ELEMENT_TYPE ||
1621
2256
  parent.$$typeof === REACT_LAZY_TYPE);
1622
- if (request.status === ABORTING)
1623
- return (
1624
- (task.status = ABORTED),
1625
- (task = request.fatalError),
1626
- parent ? "$L" + task.toString(16) : serializeByValueID(task)
1627
- );
2257
+ if (request.status === ABORTING) {
2258
+ task.status = 3;
2259
+ if (21 === request.type)
2260
+ return (
2261
+ (task = request.nextChunkId++),
2262
+ (task = parent
2263
+ ? serializeLazyID(task)
2264
+ : serializeByValueID(task)),
2265
+ task
2266
+ );
2267
+ task = request.fatalError;
2268
+ return parent ? serializeLazyID(task) : serializeByValueID(task);
2269
+ }
1628
2270
  key =
1629
2271
  thrownValue === SuspenseException
1630
2272
  ? getSuspendedThenable()
@@ -1640,7 +2282,9 @@
1640
2282
  task.model,
1641
2283
  task.keyPath,
1642
2284
  task.implicitSlot,
2285
+ task.formatContext,
1643
2286
  request.abortableTasks,
2287
+ task.time,
1644
2288
  task.debugOwner,
1645
2289
  task.debugStack,
1646
2290
  task.debugTask
@@ -1651,17 +2295,24 @@
1651
2295
  (task.keyPath = prevKeyPath),
1652
2296
  (task.implicitSlot = prevImplicitSlot),
1653
2297
  parent
1654
- ? "$L" + request.id.toString(16)
2298
+ ? serializeLazyID(request.id)
1655
2299
  : serializeByValueID(request.id)
1656
2300
  );
1657
2301
  task.keyPath = prevKeyPath;
1658
2302
  task.implicitSlot = prevImplicitSlot;
1659
2303
  request.pendingChunks++;
1660
2304
  prevKeyPath = request.nextChunkId++;
1661
- task = logRecoverableError(request, key, task);
1662
- emitErrorChunk(request, prevKeyPath, task, key);
2305
+ prevImplicitSlot = logRecoverableError(request, key, task);
2306
+ emitErrorChunk(
2307
+ request,
2308
+ prevKeyPath,
2309
+ prevImplicitSlot,
2310
+ key,
2311
+ !1,
2312
+ task.debugOwner
2313
+ );
1663
2314
  return parent
1664
- ? "$L" + prevKeyPath.toString(16)
2315
+ ? serializeLazyID(prevKeyPath)
1665
2316
  : serializeByValueID(prevKeyPath);
1666
2317
  }
1667
2318
  }
@@ -1693,21 +2344,37 @@
1693
2344
  _existingReference + ":" + parentPropertyName),
1694
2345
  _writtenObjects.set(value, elementReference)));
1695
2346
  }
1696
- if ((_existingReference = value._debugInfo)) {
1697
- if (null === debugID) return outlineTask(request, task);
1698
- forwardDebugInfo(request, debugID, _existingReference);
1699
- }
2347
+ if (serializedSize > MAX_ROW_SIZE) return deferTask(request, task);
2348
+ if ((_existingReference = value._debugInfo))
2349
+ if (canEmitDebugInfo)
2350
+ forwardDebugInfo(request, task, _existingReference);
2351
+ else return outlineTask(request, task);
1700
2352
  _existingReference = value.props;
1701
2353
  var refProp = _existingReference.ref;
2354
+ refProp = void 0 !== refProp ? refProp : null;
1702
2355
  task.debugOwner = value._owner;
1703
2356
  task.debugStack = value._debugStack;
1704
2357
  task.debugTask = value._debugTask;
2358
+ if (
2359
+ void 0 === value._owner ||
2360
+ void 0 === value._debugStack ||
2361
+ void 0 === value._debugTask
2362
+ ) {
2363
+ var key = "";
2364
+ null !== value.key && (key = ' key="' + value.key + '"');
2365
+ console.error(
2366
+ "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",
2367
+ value.type,
2368
+ key,
2369
+ value.props
2370
+ );
2371
+ }
1705
2372
  request = renderElement(
1706
2373
  request,
1707
2374
  task,
1708
2375
  value.type,
1709
2376
  value.key,
1710
- void 0 !== refProp ? refProp : null,
2377
+ refProp,
1711
2378
  _existingReference,
1712
2379
  value._store.validated
1713
2380
  );
@@ -1718,13 +2385,14 @@
1718
2385
  _writtenObjects.set(request, elementReference));
1719
2386
  return request;
1720
2387
  case REACT_LAZY_TYPE:
2388
+ if (serializedSize > MAX_ROW_SIZE) return deferTask(request, task);
1721
2389
  task.thenableState = null;
1722
2390
  elementReference = callLazyInitInDEV(value);
1723
2391
  if (request.status === ABORTING) throw null;
1724
- if ((_writtenObjects = value._debugInfo)) {
1725
- if (null === debugID) return outlineTask(request, task);
1726
- forwardDebugInfo(request, debugID, _writtenObjects);
1727
- }
2392
+ if ((_writtenObjects = value._debugInfo))
2393
+ if (canEmitDebugInfo)
2394
+ forwardDebugInfo(request, task, _writtenObjects);
2395
+ else return outlineTask(request, task);
1728
2396
  return renderModelDestructive(
1729
2397
  request,
1730
2398
  task,
@@ -1766,8 +2434,11 @@
1766
2434
  return request;
1767
2435
  }
1768
2436
  if (void 0 !== _writtenObjects)
1769
- if (modelRoot === value) modelRoot = null;
1770
- else return _writtenObjects;
2437
+ if (modelRoot === value) {
2438
+ if (_writtenObjects !== serializeByValueID(task.id))
2439
+ return _writtenObjects;
2440
+ modelRoot = null;
2441
+ } else return _writtenObjects;
1771
2442
  else if (
1772
2443
  -1 === parentPropertyName.indexOf(":") &&
1773
2444
  ((_writtenObjects = elementReference.get(parent)),
@@ -1883,14 +2554,17 @@
1883
2554
  return value;
1884
2555
  }
1885
2556
  if ("string" === typeof value)
1886
- return "Z" === value[value.length - 1] &&
2557
+ return (
2558
+ (serializedSize += value.length),
2559
+ "Z" === value[value.length - 1] &&
1887
2560
  parent[parentPropertyName] instanceof Date
1888
- ? "$D" + value
1889
- : 1024 <= value.length && null !== byteLengthOfChunk
1890
- ? serializeLargeTextString(request, value)
1891
- : "$" === value[0]
1892
- ? "$" + value
1893
- : value;
2561
+ ? "$D" + value
2562
+ : 1024 <= value.length && null !== byteLengthOfChunk
2563
+ ? serializeLargeTextString(request, value)
2564
+ : "$" === value[0]
2565
+ ? "$" + value
2566
+ : value
2567
+ );
1894
2568
  if ("boolean" === typeof value) return value;
1895
2569
  if ("number" === typeof value) return serializeNumber(value);
1896
2570
  if ("undefined" === typeof value) return "$undefined";
@@ -1992,7 +2666,10 @@
1992
2666
  null !== request.destination
1993
2667
  ? ((request.status = CLOSED),
1994
2668
  closeWithError(request.destination, error))
1995
- : ((request.status = CLOSING), (request.fatalError = error));
2669
+ : ((request.status = 13), (request.fatalError = error));
2670
+ request.cacheController.abort(
2671
+ Error("The render was aborted due to a fatal error.", { cause: error })
2672
+ );
1996
2673
  }
1997
2674
  function serializeErrorValue(request, error) {
1998
2675
  var name = "Error",
@@ -2000,7 +2677,7 @@
2000
2677
  try {
2001
2678
  name = error.name;
2002
2679
  var message = String(error.message);
2003
- var stack = filterStackTrace(request, error, 0);
2680
+ var stack = filterStackTrace(request, parseStackTrace(error, 0));
2004
2681
  var errorEnv = error.environmentName;
2005
2682
  "string" === typeof errorEnv && (env = errorEnv);
2006
2683
  } catch (x) {
@@ -2018,14 +2695,14 @@
2018
2695
  }).toString(16)
2019
2696
  );
2020
2697
  }
2021
- function emitErrorChunk(request, id, digest, error) {
2698
+ function emitErrorChunk(request, id, digest, error, debug, owner) {
2022
2699
  var name = "Error",
2023
2700
  env = (0, request.environmentName)();
2024
2701
  try {
2025
2702
  if (error instanceof Error) {
2026
2703
  name = error.name;
2027
2704
  var message = String(error.message);
2028
- var stack = filterStackTrace(request, error, 0);
2705
+ var stack = filterStackTrace(request, parseStackTrace(error, 0));
2029
2706
  var errorEnv = error.environmentName;
2030
2707
  "string" === typeof errorEnv && (env = errorEnv);
2031
2708
  } else
@@ -2039,16 +2716,28 @@
2039
2716
  "An error occurred but serializing the error message failed."),
2040
2717
  (stack = []);
2041
2718
  }
2719
+ error = null == owner ? null : outlineComponentInfo(request, owner);
2042
2720
  digest = {
2043
2721
  digest: digest,
2044
2722
  name: name,
2045
2723
  message: message,
2046
2724
  stack: stack,
2047
- env: env
2725
+ env: env,
2726
+ owner: error
2048
2727
  };
2049
2728
  id = id.toString(16) + ":E" + stringify(digest) + "\n";
2050
2729
  id = stringToChunk(id);
2051
- request.completedErrorChunks.push(id);
2730
+ debug
2731
+ ? request.completedDebugChunks.push(id)
2732
+ : request.completedErrorChunks.push(id);
2733
+ }
2734
+ function emitImportChunk(request, id, clientReferenceMetadata, debug) {
2735
+ clientReferenceMetadata = stringify(clientReferenceMetadata);
2736
+ id = id.toString(16) + ":I" + clientReferenceMetadata + "\n";
2737
+ id = stringToChunk(id);
2738
+ debug
2739
+ ? request.completedDebugChunks.push(id)
2740
+ : request.completedImportChunks.push(id);
2052
2741
  }
2053
2742
  function emitSymbolChunk(request, id, name) {
2054
2743
  id = encodeReferenceChunk(request, id, "$S" + name);
@@ -2059,50 +2748,55 @@
2059
2748
  id = stringToChunk(id);
2060
2749
  request.completedRegularChunks.push(id);
2061
2750
  }
2062
- function emitDebugChunk(request, id, debugInfo) {
2063
- var counter = { objectLimit: 500 };
2064
- debugInfo = stringify(debugInfo, function (parentPropertyName, value) {
2065
- return renderConsoleValue(
2066
- request,
2067
- counter,
2068
- this,
2069
- parentPropertyName,
2070
- value
2071
- );
2072
- });
2073
- id = id.toString(16) + ":D" + debugInfo + "\n";
2751
+ function emitDebugHaltChunk(request, id) {
2752
+ id = id.toString(16) + ":\n";
2074
2753
  id = stringToChunk(id);
2075
- request.completedRegularChunks.push(id);
2754
+ request.completedDebugChunks.push(id);
2076
2755
  }
2077
- function outlineComponentInfo(request, componentInfo) {
2078
- if (!request.writtenObjects.has(componentInfo)) {
2079
- null != componentInfo.owner &&
2080
- outlineComponentInfo(request, componentInfo.owner);
2081
- var objectLimit = 10;
2082
- null != componentInfo.stack &&
2083
- (objectLimit += componentInfo.stack.length);
2084
- objectLimit = { objectLimit: objectLimit };
2085
- var componentDebugInfo = {
2086
- name: componentInfo.name,
2087
- env: componentInfo.env,
2088
- key: componentInfo.key,
2089
- owner: componentInfo.owner
2090
- };
2091
- componentDebugInfo.stack = componentInfo.stack;
2092
- componentDebugInfo.props = componentInfo.props;
2093
- objectLimit = outlineConsoleValue(
2094
- request,
2095
- objectLimit,
2096
- componentDebugInfo
2097
- );
2098
- request.writtenObjects.set(
2099
- componentInfo,
2100
- serializeByValueID(objectLimit)
2101
- );
2102
- }
2756
+ function emitDebugChunk(request, id, debugInfo) {
2757
+ var json = serializeDebugModel(request, 500, debugInfo);
2758
+ null !== request.debugDestination
2759
+ ? ((debugInfo = request.nextChunkId++),
2760
+ (json = debugInfo.toString(16) + ":" + json + "\n"),
2761
+ request.pendingDebugChunks++,
2762
+ request.completedDebugChunks.push(stringToChunk(json)),
2763
+ (id = id.toString(16) + ':D"$' + debugInfo.toString(16) + '"\n'),
2764
+ request.completedRegularChunks.push(stringToChunk(id)))
2765
+ : ((id = id.toString(16) + ":D" + json + "\n"),
2766
+ request.completedRegularChunks.push(stringToChunk(id)));
2103
2767
  }
2104
- function emitTypedArrayChunk(request, id, tag, typedArray) {
2105
- request.pendingChunks++;
2768
+ function outlineComponentInfo(request, componentInfo) {
2769
+ var existingRef = request.writtenDebugObjects.get(componentInfo);
2770
+ if (void 0 !== existingRef) return existingRef;
2771
+ null != componentInfo.owner &&
2772
+ outlineComponentInfo(request, componentInfo.owner);
2773
+ existingRef = 10;
2774
+ null != componentInfo.stack &&
2775
+ (existingRef += componentInfo.stack.length);
2776
+ existingRef = { objectLimit: existingRef };
2777
+ var componentDebugInfo = {
2778
+ name: componentInfo.name,
2779
+ key: componentInfo.key
2780
+ };
2781
+ null != componentInfo.env && (componentDebugInfo.env = componentInfo.env);
2782
+ null != componentInfo.owner &&
2783
+ (componentDebugInfo.owner = componentInfo.owner);
2784
+ null == componentInfo.stack && null != componentInfo.debugStack
2785
+ ? (componentDebugInfo.stack = filterStackTrace(
2786
+ request,
2787
+ parseStackTrace(componentInfo.debugStack, 1)
2788
+ ))
2789
+ : null != componentInfo.stack &&
2790
+ (componentDebugInfo.stack = componentInfo.stack);
2791
+ componentDebugInfo.props = componentInfo.props;
2792
+ existingRef = outlineDebugModel(request, existingRef, componentDebugInfo);
2793
+ existingRef = serializeByValueID(existingRef);
2794
+ request.writtenDebugObjects.set(componentInfo, existingRef);
2795
+ request.writtenObjects.set(componentInfo, existingRef);
2796
+ return existingRef;
2797
+ }
2798
+ function emitTypedArrayChunk(request, id, tag, typedArray, debug) {
2799
+ debug ? request.pendingDebugChunks++ : request.pendingChunks++;
2106
2800
  var buffer = new Uint8Array(
2107
2801
  typedArray.buffer,
2108
2802
  typedArray.byteOffset,
@@ -2112,21 +2806,25 @@
2112
2806
  buffer = typedArray.byteLength;
2113
2807
  id = id.toString(16) + ":" + tag + buffer.toString(16) + ",";
2114
2808
  id = stringToChunk(id);
2115
- request.completedRegularChunks.push(id, typedArray);
2809
+ debug
2810
+ ? request.completedDebugChunks.push(id, typedArray)
2811
+ : request.completedRegularChunks.push(id, typedArray);
2116
2812
  }
2117
- function emitTextChunk(request, id, text) {
2813
+ function emitTextChunk(request, id, text, debug) {
2118
2814
  if (null === byteLengthOfChunk)
2119
2815
  throw Error(
2120
2816
  "Existence of byteLengthOfChunk should have already been checked. This is a bug in React."
2121
2817
  );
2122
- request.pendingChunks++;
2818
+ debug ? request.pendingDebugChunks++ : request.pendingChunks++;
2123
2819
  text = stringToChunk(text);
2124
2820
  var binaryLength = text.byteLength;
2125
2821
  id = id.toString(16) + ":T" + binaryLength.toString(16) + ",";
2126
2822
  id = stringToChunk(id);
2127
- request.completedRegularChunks.push(id, text);
2823
+ debug
2824
+ ? request.completedDebugChunks.push(id, text)
2825
+ : request.completedRegularChunks.push(id, text);
2128
2826
  }
2129
- function renderConsoleValue(
2827
+ function renderDebugModel(
2130
2828
  request,
2131
2829
  counter,
2132
2830
  parent,
@@ -2137,21 +2835,80 @@
2137
2835
  if (value === REACT_ELEMENT_TYPE) return "$";
2138
2836
  if ("object" === typeof value) {
2139
2837
  if (isClientReference(value))
2140
- return serializeClientReference(
2838
+ return serializeDebugClientReference(
2141
2839
  request,
2142
2840
  parent,
2143
2841
  parentPropertyName,
2144
2842
  value
2145
2843
  );
2146
- if (
2147
- void 0 !== request.temporaryReferences &&
2148
- ((parent = request.temporaryReferences.get(value)), void 0 !== parent)
2149
- )
2150
- return "$T" + parent;
2844
+ if (value.$$typeof === CONSTRUCTOR_MARKER) {
2845
+ value = value.constructor;
2846
+ var ref = request.writtenDebugObjects.get(value);
2847
+ void 0 === ref &&
2848
+ ((request = outlineDebugModel(request, counter, value)),
2849
+ (ref = serializeByValueID(request)));
2850
+ return "$P" + ref.slice(1);
2851
+ }
2852
+ if (void 0 !== request.temporaryReferences) {
2853
+ var tempRef = request.temporaryReferences.get(value);
2854
+ if (void 0 !== tempRef) return "$T" + tempRef;
2855
+ }
2856
+ tempRef = request.writtenDebugObjects;
2857
+ var existingDebugReference = tempRef.get(value);
2858
+ if (void 0 !== existingDebugReference)
2859
+ if (debugModelRoot === value) debugModelRoot = null;
2860
+ else return existingDebugReference;
2861
+ else if (-1 === parentPropertyName.indexOf(":"))
2862
+ if (
2863
+ ((existingDebugReference = tempRef.get(parent)),
2864
+ void 0 !== existingDebugReference)
2865
+ ) {
2866
+ if (0 >= counter.objectLimit && !doNotLimit.has(value))
2867
+ return serializeDeferredObject(request, value);
2868
+ var propertyName = parentPropertyName;
2869
+ if (isArrayImpl(parent) && parent[0] === REACT_ELEMENT_TYPE)
2870
+ switch (parentPropertyName) {
2871
+ case "1":
2872
+ propertyName = "type";
2873
+ break;
2874
+ case "2":
2875
+ propertyName = "key";
2876
+ break;
2877
+ case "3":
2878
+ propertyName = "props";
2879
+ break;
2880
+ case "4":
2881
+ propertyName = "_owner";
2882
+ }
2883
+ tempRef.set(value, existingDebugReference + ":" + propertyName);
2884
+ } else if (debugNoOutline !== value) {
2885
+ if ("function" === typeof value.then)
2886
+ return serializeDebugThenable(request, counter, value);
2887
+ request = outlineDebugModel(request, counter, value);
2888
+ return serializeByValueID(request);
2889
+ }
2151
2890
  parent = request.writtenObjects.get(value);
2152
2891
  if (void 0 !== parent) return parent;
2153
- if (0 >= counter.objectLimit && !doNotLimit.has(value)) return "$Y";
2892
+ if (0 >= counter.objectLimit && !doNotLimit.has(value))
2893
+ return serializeDeferredObject(request, value);
2154
2894
  counter.objectLimit--;
2895
+ parent = request.deferredDebugObjects;
2896
+ if (
2897
+ null !== parent &&
2898
+ ((parentPropertyName = parent.existing.get(value)),
2899
+ void 0 !== parentPropertyName)
2900
+ )
2901
+ return (
2902
+ parent.existing.delete(value),
2903
+ parent.retained.delete(parentPropertyName),
2904
+ emitOutlinedDebugModelChunk(
2905
+ request,
2906
+ parentPropertyName,
2907
+ counter,
2908
+ value
2909
+ ),
2910
+ serializeByValueID(parentPropertyName)
2911
+ );
2155
2912
  switch (value.$$typeof) {
2156
2913
  case REACT_ELEMENT_TYPE:
2157
2914
  null != value._owner && outlineComponentInfo(request, value._owner);
@@ -2166,7 +2923,10 @@
2166
2923
  counter = null;
2167
2924
  if (null != value._debugStack)
2168
2925
  for (
2169
- counter = filterStackTrace(request, value._debugStack, 1),
2926
+ counter = filterStackTrace(
2927
+ request,
2928
+ parseStackTrace(value._debugStack, 1)
2929
+ ),
2170
2930
  doNotLimit.add(counter),
2171
2931
  request = 0;
2172
2932
  request < counter.length;
@@ -2182,122 +2942,231 @@
2182
2942
  counter,
2183
2943
  value._store.validated
2184
2944
  ];
2945
+ case REACT_LAZY_TYPE:
2946
+ value = value._payload;
2947
+ if (null !== value && "object" === typeof value) {
2948
+ switch (value._status) {
2949
+ case 1:
2950
+ return (
2951
+ (request = outlineDebugModel(
2952
+ request,
2953
+ counter,
2954
+ value._result
2955
+ )),
2956
+ serializeLazyID(request)
2957
+ );
2958
+ case 2:
2959
+ return (
2960
+ (counter = request.nextChunkId++),
2961
+ emitErrorChunk(
2962
+ request,
2963
+ counter,
2964
+ "",
2965
+ value._result,
2966
+ !0,
2967
+ null
2968
+ ),
2969
+ serializeLazyID(counter)
2970
+ );
2971
+ }
2972
+ switch (value.status) {
2973
+ case "fulfilled":
2974
+ return (
2975
+ (request = outlineDebugModel(
2976
+ request,
2977
+ counter,
2978
+ value.value
2979
+ )),
2980
+ serializeLazyID(request)
2981
+ );
2982
+ case "rejected":
2983
+ return (
2984
+ (counter = request.nextChunkId++),
2985
+ emitErrorChunk(
2986
+ request,
2987
+ counter,
2988
+ "",
2989
+ value.reason,
2990
+ !0,
2991
+ null
2992
+ ),
2993
+ serializeLazyID(counter)
2994
+ );
2995
+ }
2996
+ }
2997
+ request.pendingDebugChunks++;
2998
+ value = request.nextChunkId++;
2999
+ emitDebugHaltChunk(request, value);
3000
+ return serializeLazyID(value);
2185
3001
  }
2186
- if ("function" === typeof value.then) {
2187
- switch (value.status) {
2188
- case "fulfilled":
2189
- return (
2190
- "$@" +
2191
- outlineConsoleValue(request, counter, value.value).toString(16)
2192
- );
2193
- case "rejected":
2194
- return (
2195
- (counter = value.reason),
2196
- request.pendingChunks++,
2197
- (value = request.nextChunkId++),
2198
- emitErrorChunk(request, value, "", counter),
2199
- "$@" + value.toString(16)
2200
- );
2201
- }
2202
- return "$@";
2203
- }
3002
+ if ("function" === typeof value.then)
3003
+ return serializeDebugThenable(request, counter, value);
2204
3004
  if (isArrayImpl(value)) return value;
2205
3005
  if (value instanceof Map) {
2206
3006
  value = Array.from(value);
2207
3007
  counter.objectLimit++;
2208
- for (parent = 0; parent < value.length; parent++) {
2209
- var entry = value[parent];
3008
+ for (ref = 0; ref < value.length; ref++) {
3009
+ var entry = value[ref];
2210
3010
  doNotLimit.add(entry);
2211
- parentPropertyName = entry[0];
3011
+ var key = entry[0];
2212
3012
  entry = entry[1];
2213
- "object" === typeof parentPropertyName &&
2214
- null !== parentPropertyName &&
2215
- doNotLimit.add(parentPropertyName);
3013
+ "object" === typeof key && null !== key && doNotLimit.add(key);
2216
3014
  "object" === typeof entry &&
2217
3015
  null !== entry &&
2218
3016
  doNotLimit.add(entry);
2219
3017
  }
2220
- return (
2221
- "$Q" + outlineConsoleValue(request, counter, value).toString(16)
2222
- );
3018
+ return "$Q" + outlineDebugModel(request, counter, value).toString(16);
2223
3019
  }
2224
3020
  if (value instanceof Set) {
2225
3021
  value = Array.from(value);
2226
3022
  counter.objectLimit++;
2227
- for (parent = 0; parent < value.length; parent++)
2228
- (parentPropertyName = value[parent]),
2229
- "object" === typeof parentPropertyName &&
2230
- null !== parentPropertyName &&
2231
- doNotLimit.add(parentPropertyName);
3023
+ for (ref = 0; ref < value.length; ref++)
3024
+ (key = value[ref]),
3025
+ "object" === typeof key && null !== key && doNotLimit.add(key);
3026
+ return "$W" + outlineDebugModel(request, counter, value).toString(16);
3027
+ }
3028
+ if ("function" === typeof FormData && value instanceof FormData)
2232
3029
  return (
2233
- "$W" + outlineConsoleValue(request, counter, value).toString(16)
3030
+ (value = Array.from(value.entries())),
3031
+ "$K" +
3032
+ outlineDebugModel(
3033
+ request,
3034
+ { objectLimit: 2 * value.length + 1 },
3035
+ value
3036
+ ).toString(16)
2234
3037
  );
3038
+ if (value instanceof Error) {
3039
+ counter = "Error";
3040
+ var env = (0, request.environmentName)();
3041
+ try {
3042
+ (counter = value.name),
3043
+ (ref = String(value.message)),
3044
+ (key = filterStackTrace(request, parseStackTrace(value, 0))),
3045
+ (entry = value.environmentName),
3046
+ "string" === typeof entry && (env = entry);
3047
+ } catch (x) {
3048
+ (ref =
3049
+ "An error occurred but serializing the error message failed."),
3050
+ (key = []);
3051
+ }
3052
+ request =
3053
+ "$Z" +
3054
+ outlineDebugModel(
3055
+ request,
3056
+ { objectLimit: 2 * key.length + 1 },
3057
+ { name: counter, message: ref, stack: key, env: env }
3058
+ ).toString(16);
3059
+ return request;
3060
+ }
3061
+ if (value instanceof ArrayBuffer)
3062
+ return serializeDebugTypedArray(request, "A", new Uint8Array(value));
3063
+ if (value instanceof Int8Array)
3064
+ return serializeDebugTypedArray(request, "O", value);
3065
+ if (value instanceof Uint8Array)
3066
+ return serializeDebugTypedArray(request, "o", value);
3067
+ if (value instanceof Uint8ClampedArray)
3068
+ return serializeDebugTypedArray(request, "U", value);
3069
+ if (value instanceof Int16Array)
3070
+ return serializeDebugTypedArray(request, "S", value);
3071
+ if (value instanceof Uint16Array)
3072
+ return serializeDebugTypedArray(request, "s", value);
3073
+ if (value instanceof Int32Array)
3074
+ return serializeDebugTypedArray(request, "L", value);
3075
+ if (value instanceof Uint32Array)
3076
+ return serializeDebugTypedArray(request, "l", value);
3077
+ if (value instanceof Float32Array)
3078
+ return serializeDebugTypedArray(request, "G", value);
3079
+ if (value instanceof Float64Array)
3080
+ return serializeDebugTypedArray(request, "g", value);
3081
+ if (value instanceof BigInt64Array)
3082
+ return serializeDebugTypedArray(request, "M", value);
3083
+ if (value instanceof BigUint64Array)
3084
+ return serializeDebugTypedArray(request, "m", value);
3085
+ if (value instanceof DataView)
3086
+ return serializeDebugTypedArray(request, "V", value);
3087
+ if ("function" === typeof Blob && value instanceof Blob)
3088
+ return serializeDebugBlob(request, value);
3089
+ if (getIteratorFn(value)) return Array.from(value);
3090
+ request = getPrototypeOf(value);
3091
+ if (request !== ObjectPrototype && null !== request) {
3092
+ counter = Object.create(null);
3093
+ for (env in value)
3094
+ if (hasOwnProperty.call(value, env) || isGetter(request, env))
3095
+ counter[env] = value[env];
3096
+ ref = request.constructor;
3097
+ "function" !== typeof ref ||
3098
+ ref.prototype !== request ||
3099
+ hasOwnProperty.call(value, "") ||
3100
+ isGetter(request, "") ||
3101
+ (counter[""] = { $$typeof: CONSTRUCTOR_MARKER, constructor: ref });
3102
+ return counter;
2235
3103
  }
2236
- return "function" === typeof FormData && value instanceof FormData
2237
- ? serializeFormData(request, value)
2238
- : value instanceof Error
2239
- ? serializeErrorValue(request, value)
2240
- : value instanceof ArrayBuffer
2241
- ? serializeTypedArray(request, "A", new Uint8Array(value))
2242
- : value instanceof Int8Array
2243
- ? serializeTypedArray(request, "O", value)
2244
- : value instanceof Uint8Array
2245
- ? serializeTypedArray(request, "o", value)
2246
- : value instanceof Uint8ClampedArray
2247
- ? serializeTypedArray(request, "U", value)
2248
- : value instanceof Int16Array
2249
- ? serializeTypedArray(request, "S", value)
2250
- : value instanceof Uint16Array
2251
- ? serializeTypedArray(request, "s", value)
2252
- : value instanceof Int32Array
2253
- ? serializeTypedArray(request, "L", value)
2254
- : value instanceof Uint32Array
2255
- ? serializeTypedArray(request, "l", value)
2256
- : value instanceof Float32Array
2257
- ? serializeTypedArray(request, "G", value)
2258
- : value instanceof Float64Array
2259
- ? serializeTypedArray(request, "g", value)
2260
- : value instanceof BigInt64Array
2261
- ? serializeTypedArray(request, "M", value)
2262
- : value instanceof BigUint64Array
2263
- ? serializeTypedArray(request, "m", value)
2264
- : value instanceof DataView
2265
- ? serializeTypedArray(request, "V", value)
2266
- : "function" === typeof Blob &&
2267
- value instanceof Blob
2268
- ? serializeBlob(request, value)
2269
- : getIteratorFn(value)
2270
- ? Array.from(value)
2271
- : value;
3104
+ return value;
2272
3105
  }
2273
- if ("string" === typeof value)
2274
- return "Z" === value[value.length - 1] &&
3106
+ if ("string" === typeof value) {
3107
+ if (
3108
+ "Z" === value[value.length - 1] &&
2275
3109
  parent[parentPropertyName] instanceof Date
2276
- ? "$D" + value
2277
- : 1024 <= value.length
2278
- ? serializeLargeTextString(request, value)
2279
- : "$" === value[0]
2280
- ? "$" + value
2281
- : value;
3110
+ )
3111
+ return "$D" + value;
3112
+ if (1024 <= value.length) {
3113
+ if (0 >= counter.objectLimit)
3114
+ return serializeDeferredObject(request, value);
3115
+ counter.objectLimit--;
3116
+ request.pendingDebugChunks++;
3117
+ counter = request.nextChunkId++;
3118
+ emitTextChunk(request, counter, value, !0);
3119
+ return serializeByValueID(counter);
3120
+ }
3121
+ return "$" === value[0] ? "$" + value : value;
3122
+ }
2282
3123
  if ("boolean" === typeof value) return value;
2283
3124
  if ("number" === typeof value) return serializeNumber(value);
2284
3125
  if ("undefined" === typeof value) return "$undefined";
2285
- if ("function" === typeof value)
2286
- return isClientReference(value)
2287
- ? serializeClientReference(request, parent, parentPropertyName, value)
2288
- : void 0 !== request.temporaryReferences &&
2289
- ((request = request.temporaryReferences.get(value)),
2290
- void 0 !== request)
2291
- ? "$T" + request
2292
- : "$E(" + (Function.prototype.toString.call(value) + ")");
3126
+ if ("function" === typeof value) {
3127
+ if (isClientReference(value))
3128
+ return serializeDebugClientReference(
3129
+ request,
3130
+ parent,
3131
+ parentPropertyName,
3132
+ value
3133
+ );
3134
+ if (
3135
+ void 0 !== request.temporaryReferences &&
3136
+ ((counter = request.temporaryReferences.get(value)),
3137
+ void 0 !== counter)
3138
+ )
3139
+ return "$T" + counter;
3140
+ counter = request.writtenDebugObjects;
3141
+ ref = counter.get(value);
3142
+ if (void 0 !== ref) return ref;
3143
+ ref = Function.prototype.toString.call(value);
3144
+ key = value.name;
3145
+ key =
3146
+ "$E" +
3147
+ ("string" === typeof key
3148
+ ? "Object.defineProperty(" +
3149
+ ref +
3150
+ ',"name",{value:' +
3151
+ JSON.stringify(key) +
3152
+ "})"
3153
+ : "(" + ref + ")");
3154
+ request.pendingDebugChunks++;
3155
+ ref = request.nextChunkId++;
3156
+ key = encodeReferenceChunk(request, ref, key);
3157
+ request.completedDebugChunks.push(key);
3158
+ request = serializeByValueID(ref);
3159
+ counter.set(value, request);
3160
+ return request;
3161
+ }
2293
3162
  if ("symbol" === typeof value) {
2294
3163
  counter = request.writtenSymbols.get(value);
2295
3164
  if (void 0 !== counter) return serializeByValueID(counter);
2296
- counter = value.description;
3165
+ value = value.description;
2297
3166
  request.pendingChunks++;
2298
- value = request.nextChunkId++;
2299
- emitSymbolChunk(request, value, counter);
2300
- return serializeByValueID(value);
3167
+ counter = request.nextChunkId++;
3168
+ emitSymbolChunk(request, counter, value);
3169
+ return serializeByValueID(counter);
2301
3170
  }
2302
3171
  return "bigint" === typeof value
2303
3172
  ? "$n" + value.toString(10)
@@ -2305,10 +3174,10 @@
2305
3174
  ? "$D" + value.toJSON()
2306
3175
  : "unknown type " + typeof value;
2307
3176
  }
2308
- function outlineConsoleValue(request, counter, model) {
3177
+ function serializeDebugModel(request, objectLimit, model) {
2309
3178
  function replacer(parentPropertyName, value) {
2310
3179
  try {
2311
- return renderConsoleValue(
3180
+ return renderDebugModel(
2312
3181
  request,
2313
3182
  counter,
2314
3183
  this,
@@ -2322,26 +3191,24 @@
2322
3191
  );
2323
3192
  }
2324
3193
  }
2325
- "object" === typeof model && null !== model && doNotLimit.add(model);
3194
+ var counter = { objectLimit: objectLimit };
3195
+ objectLimit = debugNoOutline;
3196
+ debugNoOutline = model;
2326
3197
  try {
2327
- var json = stringify(model, replacer);
3198
+ return stringify(model, replacer);
2328
3199
  } catch (x) {
2329
- json = stringify(
3200
+ return stringify(
2330
3201
  "Unknown Value: React could not send it from the server.\n" +
2331
3202
  x.message
2332
3203
  );
3204
+ } finally {
3205
+ debugNoOutline = objectLimit;
2333
3206
  }
2334
- request.pendingChunks++;
2335
- model = request.nextChunkId++;
2336
- json = model.toString(16) + ":" + json + "\n";
2337
- json = stringToChunk(json);
2338
- request.completedRegularChunks.push(json);
2339
- return model;
2340
3207
  }
2341
- function emitConsoleChunk(request, methodName, owner, stackTrace, args) {
3208
+ function emitOutlinedDebugModelChunk(request, id, counter, model) {
2342
3209
  function replacer(parentPropertyName, value) {
2343
3210
  try {
2344
- return renderConsoleValue(
3211
+ return renderDebugModel(
2345
3212
  request,
2346
3213
  counter,
2347
3214
  this,
@@ -2355,83 +3222,209 @@
2355
3222
  );
2356
3223
  }
2357
3224
  }
2358
- var counter = { objectLimit: 500 };
2359
- null != owner && outlineComponentInfo(request, owner);
2360
- var env = (0, request.environmentName)(),
2361
- payload = [methodName, stackTrace, owner, env];
2362
- payload.push.apply(payload, args);
3225
+ "object" === typeof model && null !== model && doNotLimit.add(model);
3226
+ var prevModelRoot = debugModelRoot;
3227
+ debugModelRoot = model;
3228
+ "object" === typeof model &&
3229
+ null !== model &&
3230
+ request.writtenDebugObjects.set(model, serializeByValueID(id));
2363
3231
  try {
2364
- var json = stringify(payload, replacer);
3232
+ var json = stringify(model, replacer);
2365
3233
  } catch (x) {
2366
3234
  json = stringify(
2367
- [
2368
- methodName,
2369
- stackTrace,
2370
- owner,
2371
- env,
2372
- "Unknown Value: React could not send it from the server.",
2373
- x
2374
- ],
2375
- replacer
3235
+ "Unknown Value: React could not send it from the server.\n" +
3236
+ x.message
2376
3237
  );
3238
+ } finally {
3239
+ debugModelRoot = prevModelRoot;
3240
+ }
3241
+ id = id.toString(16) + ":" + json + "\n";
3242
+ id = stringToChunk(id);
3243
+ request.completedDebugChunks.push(id);
3244
+ }
3245
+ function outlineDebugModel(request, counter, model) {
3246
+ var id = request.nextChunkId++;
3247
+ request.pendingDebugChunks++;
3248
+ emitOutlinedDebugModelChunk(request, id, counter, model);
3249
+ return id;
3250
+ }
3251
+ function emitTimeOriginChunk(request, timeOrigin) {
3252
+ request.pendingDebugChunks++;
3253
+ timeOrigin = stringToChunk(":N" + timeOrigin + "\n");
3254
+ request.completedDebugChunks.push(timeOrigin);
3255
+ }
3256
+ function forwardDebugInfo(request$jscomp$1, task, debugInfo) {
3257
+ for (var id = task.id, i = 0; i < debugInfo.length; i++) {
3258
+ var info = debugInfo[i];
3259
+ if ("number" === typeof info.time)
3260
+ markOperationEndTime(request$jscomp$1, task, info.time);
3261
+ else if ("string" === typeof info.name)
3262
+ outlineComponentInfo(request$jscomp$1, info),
3263
+ request$jscomp$1.pendingChunks++,
3264
+ emitDebugChunk(request$jscomp$1, id, info);
3265
+ else if (info.awaited) {
3266
+ var ioInfo = info.awaited;
3267
+ if (!(ioInfo.end <= request$jscomp$1.timeOrigin)) {
3268
+ var request = request$jscomp$1,
3269
+ ioInfo$jscomp$0 = ioInfo;
3270
+ if (!request.writtenObjects.has(ioInfo$jscomp$0)) {
3271
+ request.pendingDebugChunks++;
3272
+ var id$jscomp$0 = request.nextChunkId++,
3273
+ owner = ioInfo$jscomp$0.owner;
3274
+ null != owner && outlineComponentInfo(request, owner);
3275
+ var debugStack =
3276
+ null == ioInfo$jscomp$0.stack &&
3277
+ null != ioInfo$jscomp$0.debugStack
3278
+ ? filterStackTrace(
3279
+ request,
3280
+ parseStackTrace(ioInfo$jscomp$0.debugStack, 1)
3281
+ )
3282
+ : ioInfo$jscomp$0.stack;
3283
+ var request$jscomp$0 = request,
3284
+ id$jscomp$1 = id$jscomp$0,
3285
+ value = ioInfo$jscomp$0.value,
3286
+ env = ioInfo$jscomp$0.env,
3287
+ objectLimit = 10;
3288
+ debugStack && (objectLimit += debugStack.length);
3289
+ var debugIOInfo = {
3290
+ name: ioInfo$jscomp$0.name,
3291
+ start: ioInfo$jscomp$0.start - request$jscomp$0.timeOrigin,
3292
+ end: ioInfo$jscomp$0.end - request$jscomp$0.timeOrigin
3293
+ };
3294
+ null != env && (debugIOInfo.env = env);
3295
+ null != debugStack && (debugIOInfo.stack = debugStack);
3296
+ null != owner && (debugIOInfo.owner = owner);
3297
+ void 0 !== value && (debugIOInfo.value = value);
3298
+ value = serializeDebugModel(
3299
+ request$jscomp$0,
3300
+ objectLimit,
3301
+ debugIOInfo
3302
+ );
3303
+ id$jscomp$1 = id$jscomp$1.toString(16) + ":J" + value + "\n";
3304
+ id$jscomp$1 = stringToChunk(id$jscomp$1);
3305
+ request$jscomp$0.completedDebugChunks.push(id$jscomp$1);
3306
+ request.writtenDebugObjects.set(
3307
+ ioInfo$jscomp$0,
3308
+ serializeByValueID(id$jscomp$0)
3309
+ );
3310
+ }
3311
+ null != info.owner &&
3312
+ outlineComponentInfo(request$jscomp$1, info.owner);
3313
+ request =
3314
+ null == info.stack && null != info.debugStack
3315
+ ? filterStackTrace(
3316
+ request$jscomp$1,
3317
+ parseStackTrace(info.debugStack, 1)
3318
+ )
3319
+ : info.stack;
3320
+ ioInfo = { awaited: ioInfo };
3321
+ null != info.env && (ioInfo.env = info.env);
3322
+ null != info.owner && (ioInfo.owner = info.owner);
3323
+ null != request && (ioInfo.stack = request);
3324
+ request$jscomp$1.pendingChunks++;
3325
+ emitDebugChunk(request$jscomp$1, id, ioInfo);
3326
+ }
3327
+ } else
3328
+ request$jscomp$1.pendingChunks++,
3329
+ emitDebugChunk(request$jscomp$1, id, info);
2377
3330
  }
2378
- methodName = stringToChunk(":W" + json + "\n");
2379
- request.completedRegularChunks.push(methodName);
2380
3331
  }
2381
- function forwardDebugInfo(request, id, debugInfo) {
2382
- for (var i = 0; i < debugInfo.length; i++)
2383
- "number" !== typeof debugInfo[i].time &&
2384
- (request.pendingChunks++,
2385
- "string" === typeof debugInfo[i].name &&
2386
- outlineComponentInfo(request, debugInfo[i]),
2387
- emitDebugChunk(request, id, debugInfo[i]));
3332
+ function forwardDebugInfoFromThenable(request, task, thenable) {
3333
+ (thenable = thenable._debugInfo) &&
3334
+ forwardDebugInfo(request, task, thenable);
3335
+ }
3336
+ function forwardDebugInfoFromCurrentContext(request, task, thenable) {
3337
+ (thenable = thenable._debugInfo) &&
3338
+ forwardDebugInfo(request, task, thenable);
3339
+ }
3340
+ function forwardDebugInfoFromAbortedTask(request, task) {
3341
+ var model = task.model;
3342
+ "object" === typeof model &&
3343
+ null !== model &&
3344
+ (model = model._debugInfo) &&
3345
+ forwardDebugInfo(request, task, model);
3346
+ }
3347
+ function emitTimingChunk(request, id, timestamp) {
3348
+ request.pendingChunks++;
3349
+ var json = '{"time":' + (timestamp - request.timeOrigin) + "}";
3350
+ null !== request.debugDestination
3351
+ ? ((timestamp = request.nextChunkId++),
3352
+ (json = timestamp.toString(16) + ":" + json + "\n"),
3353
+ request.pendingDebugChunks++,
3354
+ request.completedDebugChunks.push(stringToChunk(json)),
3355
+ (id = id.toString(16) + ':D"$' + timestamp.toString(16) + '"\n'),
3356
+ request.completedRegularChunks.push(stringToChunk(id)))
3357
+ : ((id = id.toString(16) + ":D" + json + "\n"),
3358
+ request.completedRegularChunks.push(stringToChunk(id)));
3359
+ }
3360
+ function markOperationEndTime(request, task, timestamp) {
3361
+ (request.status === ABORTING && timestamp > request.abortTime) ||
3362
+ (timestamp > task.time
3363
+ ? (emitTimingChunk(request, task.id, timestamp),
3364
+ (task.time = timestamp))
3365
+ : emitTimingChunk(request, task.id, task.time));
2388
3366
  }
2389
3367
  function emitChunk(request, task, value) {
2390
3368
  var id = task.id;
2391
3369
  "string" === typeof value && null !== byteLengthOfChunk
2392
- ? emitTextChunk(request, id, value)
3370
+ ? emitTextChunk(request, id, value, !1)
2393
3371
  : value instanceof ArrayBuffer
2394
- ? emitTypedArrayChunk(request, id, "A", new Uint8Array(value))
3372
+ ? emitTypedArrayChunk(request, id, "A", new Uint8Array(value), !1)
2395
3373
  : value instanceof Int8Array
2396
- ? emitTypedArrayChunk(request, id, "O", value)
3374
+ ? emitTypedArrayChunk(request, id, "O", value, !1)
2397
3375
  : value instanceof Uint8Array
2398
- ? emitTypedArrayChunk(request, id, "o", value)
3376
+ ? emitTypedArrayChunk(request, id, "o", value, !1)
2399
3377
  : value instanceof Uint8ClampedArray
2400
- ? emitTypedArrayChunk(request, id, "U", value)
3378
+ ? emitTypedArrayChunk(request, id, "U", value, !1)
2401
3379
  : value instanceof Int16Array
2402
- ? emitTypedArrayChunk(request, id, "S", value)
3380
+ ? emitTypedArrayChunk(request, id, "S", value, !1)
2403
3381
  : value instanceof Uint16Array
2404
- ? emitTypedArrayChunk(request, id, "s", value)
3382
+ ? emitTypedArrayChunk(request, id, "s", value, !1)
2405
3383
  : value instanceof Int32Array
2406
- ? emitTypedArrayChunk(request, id, "L", value)
3384
+ ? emitTypedArrayChunk(request, id, "L", value, !1)
2407
3385
  : value instanceof Uint32Array
2408
- ? emitTypedArrayChunk(request, id, "l", value)
3386
+ ? emitTypedArrayChunk(request, id, "l", value, !1)
2409
3387
  : value instanceof Float32Array
2410
- ? emitTypedArrayChunk(request, id, "G", value)
3388
+ ? emitTypedArrayChunk(request, id, "G", value, !1)
2411
3389
  : value instanceof Float64Array
2412
- ? emitTypedArrayChunk(request, id, "g", value)
3390
+ ? emitTypedArrayChunk(request, id, "g", value, !1)
2413
3391
  : value instanceof BigInt64Array
2414
- ? emitTypedArrayChunk(request, id, "M", value)
3392
+ ? emitTypedArrayChunk(request, id, "M", value, !1)
2415
3393
  : value instanceof BigUint64Array
2416
- ? emitTypedArrayChunk(request, id, "m", value)
3394
+ ? emitTypedArrayChunk(
3395
+ request,
3396
+ id,
3397
+ "m",
3398
+ value,
3399
+ !1
3400
+ )
2417
3401
  : value instanceof DataView
2418
- ? emitTypedArrayChunk(request, id, "V", value)
3402
+ ? emitTypedArrayChunk(
3403
+ request,
3404
+ id,
3405
+ "V",
3406
+ value,
3407
+ !1
3408
+ )
2419
3409
  : ((value = stringify(value, task.toJSON)),
2420
3410
  emitModelChunk(request, task.id, value));
2421
3411
  }
2422
3412
  function erroredTask(request, task, error) {
2423
- request.abortableTasks.delete(task);
2424
- task.status = ERRORED$1;
3413
+ task.timed && markOperationEndTime(request, task, performance.now());
3414
+ task.status = 4;
2425
3415
  var digest = logRecoverableError(request, error, task);
2426
- emitErrorChunk(request, task.id, digest, error);
3416
+ emitErrorChunk(request, task.id, digest, error, !1, task.debugOwner);
3417
+ request.abortableTasks.delete(task);
3418
+ callOnAllReadyIfReady(request);
2427
3419
  }
2428
3420
  function retryTask(request, task) {
2429
- if (task.status === PENDING$1) {
2430
- var prevDebugID = debugID;
2431
- task.status = RENDERING;
3421
+ if (0 === task.status) {
3422
+ var prevCanEmitDebugInfo = canEmitDebugInfo;
3423
+ task.status = 5;
3424
+ var parentSerializedSize = serializedSize;
2432
3425
  try {
2433
3426
  modelRoot = task.model;
2434
- debugID = task.id;
3427
+ canEmitDebugInfo = !0;
2435
3428
  var resolvedModel = renderModelDestructive(
2436
3429
  request,
2437
3430
  task,
@@ -2439,7 +3432,7 @@
2439
3432
  "",
2440
3433
  task.model
2441
3434
  );
2442
- debugID = null;
3435
+ canEmitDebugInfo = !1;
2443
3436
  modelRoot = resolvedModel;
2444
3437
  task.keyPath = null;
2445
3438
  task.implicitSlot = !1;
@@ -2447,6 +3440,7 @@
2447
3440
  currentEnv !== task.environmentName &&
2448
3441
  (request.pendingChunks++,
2449
3442
  emitDebugChunk(request, task.id, { env: currentEnv }));
3443
+ task.timed && markOperationEndTime(request, task, performance.now());
2450
3444
  if ("object" === typeof resolvedModel && null !== resolvedModel)
2451
3445
  request.writtenObjects.set(
2452
3446
  resolvedModel,
@@ -2457,15 +3451,23 @@
2457
3451
  var json = stringify(resolvedModel);
2458
3452
  emitModelChunk(request, task.id, json);
2459
3453
  }
3454
+ task.status = 1;
2460
3455
  request.abortableTasks.delete(task);
2461
- task.status = COMPLETED;
3456
+ callOnAllReadyIfReady(request);
2462
3457
  } catch (thrownValue) {
2463
- if (request.status === ABORTING) {
2464
- request.abortableTasks.delete(task);
2465
- task.status = ABORTED;
2466
- var model = stringify(serializeByValueID(request.fatalError));
2467
- emitModelChunk(request, task.id, model);
2468
- } else {
3458
+ if (request.status === ABORTING)
3459
+ if (
3460
+ (request.abortableTasks.delete(task),
3461
+ (task.status = 0),
3462
+ 21 === request.type)
3463
+ )
3464
+ haltTask(task), finishHaltedTask(task, request);
3465
+ else {
3466
+ var errorId = request.fatalError;
3467
+ abortTask(task);
3468
+ finishAbortedTask(task, request, errorId);
3469
+ }
3470
+ else {
2469
3471
  var x =
2470
3472
  thrownValue === SuspenseException
2471
3473
  ? getSuspendedThenable()
@@ -2475,24 +3477,27 @@
2475
3477
  null !== x &&
2476
3478
  "function" === typeof x.then
2477
3479
  ) {
2478
- task.status = PENDING$1;
3480
+ task.status = 0;
2479
3481
  task.thenableState = getThenableStateAfterSuspending();
2480
3482
  var ping = task.ping;
2481
3483
  x.then(ping, ping);
2482
3484
  } else erroredTask(request, task, x);
2483
3485
  }
2484
3486
  } finally {
2485
- debugID = prevDebugID;
3487
+ (canEmitDebugInfo = prevCanEmitDebugInfo),
3488
+ (serializedSize = parentSerializedSize);
2486
3489
  }
2487
3490
  }
2488
3491
  }
2489
3492
  function tryStreamTask(request, task) {
2490
- var prevDebugID = debugID;
2491
- debugID = null;
3493
+ var prevCanEmitDebugInfo = canEmitDebugInfo;
3494
+ canEmitDebugInfo = !1;
3495
+ var parentSerializedSize = serializedSize;
2492
3496
  try {
2493
3497
  emitChunk(request, task, task.model);
2494
3498
  } finally {
2495
- debugID = prevDebugID;
3499
+ (serializedSize = parentSerializedSize),
3500
+ (canEmitDebugInfo = prevCanEmitDebugInfo);
2496
3501
  }
2497
3502
  }
2498
3503
  function performWork(request) {
@@ -2500,18 +3505,12 @@
2500
3505
  ReactSharedInternalsServer.H = HooksDispatcher;
2501
3506
  var prevRequest = currentRequest;
2502
3507
  currentRequest$1 = currentRequest = request;
2503
- var hadAbortableTasks = 0 < request.abortableTasks.size;
2504
3508
  try {
2505
3509
  var pingedTasks = request.pingedTasks;
2506
3510
  request.pingedTasks = [];
2507
3511
  for (var i = 0; i < pingedTasks.length; i++)
2508
3512
  retryTask(request, pingedTasks[i]);
2509
- null !== request.destination &&
2510
- flushCompletedChunks(request, request.destination);
2511
- if (hadAbortableTasks && 0 === request.abortableTasks.size) {
2512
- var onAllReady = request.onAllReady;
2513
- onAllReady();
2514
- }
3513
+ flushCompletedChunks(request);
2515
3514
  } catch (error) {
2516
3515
  logRecoverableError(request, error, null), fatalError(request, error);
2517
3516
  } finally {
@@ -2520,68 +3519,152 @@
2520
3519
  (currentRequest = prevRequest);
2521
3520
  }
2522
3521
  }
2523
- function flushCompletedChunks(request, destination) {
2524
- currentView = new Uint8Array(2048);
2525
- writtenBytes = 0;
2526
- try {
2527
- for (
2528
- var importsChunks = request.completedImportChunks, i = 0;
2529
- i < importsChunks.length;
2530
- i++
2531
- )
2532
- if (
2533
- (request.pendingChunks--,
2534
- !writeChunkAndReturn(destination, importsChunks[i]))
2535
- ) {
2536
- request.destination = null;
2537
- i++;
2538
- break;
2539
- }
2540
- importsChunks.splice(0, i);
2541
- var hintChunks = request.completedHintChunks;
2542
- for (i = 0; i < hintChunks.length; i++)
2543
- if (!writeChunkAndReturn(destination, hintChunks[i])) {
2544
- request.destination = null;
2545
- i++;
2546
- break;
2547
- }
2548
- hintChunks.splice(0, i);
2549
- var regularChunks = request.completedRegularChunks;
2550
- for (i = 0; i < regularChunks.length; i++)
2551
- if (
2552
- (request.pendingChunks--,
2553
- !writeChunkAndReturn(destination, regularChunks[i]))
2554
- ) {
2555
- request.destination = null;
2556
- i++;
2557
- break;
2558
- }
2559
- regularChunks.splice(0, i);
2560
- var errorChunks = request.completedErrorChunks;
2561
- for (i = 0; i < errorChunks.length; i++)
2562
- if (
2563
- (request.pendingChunks--,
2564
- !writeChunkAndReturn(destination, errorChunks[i]))
2565
- ) {
2566
- request.destination = null;
2567
- i++;
2568
- break;
3522
+ function abortTask(task) {
3523
+ 0 === task.status && (task.status = 3);
3524
+ }
3525
+ function finishAbortedTask(task, request, errorId) {
3526
+ 3 === task.status &&
3527
+ (forwardDebugInfoFromAbortedTask(request, task),
3528
+ task.timed && markOperationEndTime(request, task, request.abortTime),
3529
+ (errorId = serializeByValueID(errorId)),
3530
+ (task = encodeReferenceChunk(request, task.id, errorId)),
3531
+ request.completedErrorChunks.push(task));
3532
+ }
3533
+ function haltTask(task) {
3534
+ 0 === task.status && (task.status = 3);
3535
+ }
3536
+ function finishHaltedTask(task, request) {
3537
+ 3 === task.status &&
3538
+ (forwardDebugInfoFromAbortedTask(request, task),
3539
+ request.pendingChunks--);
3540
+ }
3541
+ function flushCompletedChunks(request) {
3542
+ if (null !== request.debugDestination) {
3543
+ var debugDestination = request.debugDestination;
3544
+ currentView = new Uint8Array(2048);
3545
+ writtenBytes = 0;
3546
+ try {
3547
+ for (
3548
+ var debugChunks = request.completedDebugChunks, i = 0;
3549
+ i < debugChunks.length;
3550
+ i++
3551
+ )
3552
+ request.pendingDebugChunks--,
3553
+ writeChunkAndReturn(debugDestination, debugChunks[i]);
3554
+ debugChunks.splice(0, i);
3555
+ } finally {
3556
+ completeWriting(debugDestination);
3557
+ }
3558
+ }
3559
+ debugDestination = request.destination;
3560
+ if (null !== debugDestination) {
3561
+ currentView = new Uint8Array(2048);
3562
+ writtenBytes = 0;
3563
+ try {
3564
+ var importsChunks = request.completedImportChunks;
3565
+ for (
3566
+ debugChunks = 0;
3567
+ debugChunks < importsChunks.length;
3568
+ debugChunks++
3569
+ )
3570
+ if (
3571
+ (request.pendingChunks--,
3572
+ !writeChunkAndReturn(
3573
+ debugDestination,
3574
+ importsChunks[debugChunks]
3575
+ ))
3576
+ ) {
3577
+ request.destination = null;
3578
+ debugChunks++;
3579
+ break;
3580
+ }
3581
+ importsChunks.splice(0, debugChunks);
3582
+ var hintChunks = request.completedHintChunks;
3583
+ for (debugChunks = 0; debugChunks < hintChunks.length; debugChunks++)
3584
+ if (
3585
+ !writeChunkAndReturn(debugDestination, hintChunks[debugChunks])
3586
+ ) {
3587
+ request.destination = null;
3588
+ debugChunks++;
3589
+ break;
3590
+ }
3591
+ hintChunks.splice(0, debugChunks);
3592
+ if (null === request.debugDestination) {
3593
+ var _debugChunks = request.completedDebugChunks;
3594
+ for (
3595
+ debugChunks = 0;
3596
+ debugChunks < _debugChunks.length;
3597
+ debugChunks++
3598
+ )
3599
+ if (
3600
+ (request.pendingDebugChunks--,
3601
+ !writeChunkAndReturn(
3602
+ debugDestination,
3603
+ _debugChunks[debugChunks]
3604
+ ))
3605
+ ) {
3606
+ request.destination = null;
3607
+ debugChunks++;
3608
+ break;
3609
+ }
3610
+ _debugChunks.splice(0, debugChunks);
2569
3611
  }
2570
- errorChunks.splice(0, i);
2571
- } finally {
2572
- (request.flushScheduled = !1),
2573
- currentView &&
2574
- 0 < writtenBytes &&
2575
- (destination.enqueue(
2576
- new Uint8Array(currentView.buffer, 0, writtenBytes)
2577
- ),
2578
- (currentView = null),
2579
- (writtenBytes = 0));
3612
+ var regularChunks = request.completedRegularChunks;
3613
+ for (
3614
+ debugChunks = 0;
3615
+ debugChunks < regularChunks.length;
3616
+ debugChunks++
3617
+ )
3618
+ if (
3619
+ (request.pendingChunks--,
3620
+ !writeChunkAndReturn(
3621
+ debugDestination,
3622
+ regularChunks[debugChunks]
3623
+ ))
3624
+ ) {
3625
+ request.destination = null;
3626
+ debugChunks++;
3627
+ break;
3628
+ }
3629
+ regularChunks.splice(0, debugChunks);
3630
+ var errorChunks = request.completedErrorChunks;
3631
+ for (debugChunks = 0; debugChunks < errorChunks.length; debugChunks++)
3632
+ if (
3633
+ (request.pendingChunks--,
3634
+ !writeChunkAndReturn(debugDestination, errorChunks[debugChunks]))
3635
+ ) {
3636
+ request.destination = null;
3637
+ debugChunks++;
3638
+ break;
3639
+ }
3640
+ errorChunks.splice(0, debugChunks);
3641
+ } finally {
3642
+ (request.flushScheduled = !1), completeWriting(debugDestination);
3643
+ }
2580
3644
  }
2581
3645
  0 === request.pendingChunks &&
2582
- ((request.status = CLOSED),
2583
- destination.close(),
2584
- (request.destination = null));
3646
+ ((importsChunks = request.debugDestination),
3647
+ 0 === request.pendingDebugChunks
3648
+ ? (null !== importsChunks &&
3649
+ (importsChunks.close(), (request.debugDestination = null)),
3650
+ request.status < ABORTING &&
3651
+ request.cacheController.abort(
3652
+ Error(
3653
+ "This render completed successfully. All cacheSignals are now aborted to allow clean up of any unused resources."
3654
+ )
3655
+ ),
3656
+ null !== request.destination &&
3657
+ ((request.status = CLOSED),
3658
+ request.destination.close(),
3659
+ (request.destination = null)),
3660
+ null !== request.debugDestination &&
3661
+ (request.debugDestination.close(),
3662
+ (request.debugDestination = null)))
3663
+ : null !== importsChunks &&
3664
+ null !== request.destination &&
3665
+ ((request.status = CLOSED),
3666
+ request.destination.close(),
3667
+ (request.destination = null)));
2585
3668
  }
2586
3669
  function startWork(request) {
2587
3670
  request.flushScheduled = null !== request.destination;
@@ -2589,88 +3672,125 @@
2589
3672
  return performWork(request);
2590
3673
  });
2591
3674
  scheduleWork(function () {
2592
- request.status === OPENING && (request.status = 11);
3675
+ 10 === request.status && (request.status = 11);
2593
3676
  });
2594
3677
  }
2595
3678
  function enqueueFlush(request) {
2596
- !1 === request.flushScheduled &&
2597
- 0 === request.pingedTasks.length &&
2598
- null !== request.destination &&
3679
+ !1 !== request.flushScheduled ||
3680
+ 0 !== request.pingedTasks.length ||
3681
+ (null === request.destination && null === request.debugDestination) ||
2599
3682
  ((request.flushScheduled = !0),
2600
3683
  scheduleWork(function () {
2601
3684
  request.flushScheduled = !1;
2602
- var destination = request.destination;
2603
- destination && flushCompletedChunks(request, destination);
3685
+ flushCompletedChunks(request);
2604
3686
  }));
2605
3687
  }
3688
+ function callOnAllReadyIfReady(request) {
3689
+ 0 === request.abortableTasks.size &&
3690
+ ((request = request.onAllReady), request());
3691
+ }
2606
3692
  function startFlowing(request, destination) {
2607
- if (request.status === CLOSING)
3693
+ if (13 === request.status)
2608
3694
  (request.status = CLOSED),
2609
3695
  closeWithError(destination, request.fatalError);
2610
3696
  else if (request.status !== CLOSED && null === request.destination) {
2611
3697
  request.destination = destination;
2612
3698
  try {
2613
- flushCompletedChunks(request, destination);
3699
+ flushCompletedChunks(request);
2614
3700
  } catch (error) {
2615
3701
  logRecoverableError(request, error, null), fatalError(request, error);
2616
3702
  }
2617
3703
  }
2618
3704
  }
2619
- function abort(request, reason) {
3705
+ function finishHalt(request, abortedTasks) {
2620
3706
  try {
2621
- 11 >= request.status && (request.status = ABORTING);
2622
- var abortableTasks = request.abortableTasks;
2623
- if (0 < abortableTasks.size) {
2624
- var error =
2625
- void 0 === reason
2626
- ? Error(
2627
- "The render was aborted by the server without a reason."
2628
- )
2629
- : "object" === typeof reason &&
2630
- null !== reason &&
2631
- "function" === typeof reason.then
2632
- ? Error(
2633
- "The render was aborted by the server with a promise."
2634
- )
2635
- : reason,
2636
- digest = logRecoverableError(request, error, null),
2637
- _errorId2 = request.nextChunkId++;
2638
- request.fatalError = _errorId2;
2639
- request.pendingChunks++;
2640
- emitErrorChunk(request, _errorId2, digest, error);
2641
- abortableTasks.forEach(function (task) {
2642
- if (task.status !== RENDERING) {
2643
- task.status = ABORTED;
2644
- var ref = serializeByValueID(_errorId2);
2645
- task = encodeReferenceChunk(request, task.id, ref);
2646
- request.completedErrorChunks.push(task);
3707
+ abortedTasks.forEach(function (task) {
3708
+ return finishHaltedTask(task, request);
3709
+ });
3710
+ var onAllReady = request.onAllReady;
3711
+ onAllReady();
3712
+ flushCompletedChunks(request);
3713
+ } catch (error) {
3714
+ logRecoverableError(request, error, null), fatalError(request, error);
3715
+ }
3716
+ }
3717
+ function finishAbort(request, abortedTasks, errorId) {
3718
+ try {
3719
+ abortedTasks.forEach(function (task) {
3720
+ return finishAbortedTask(task, request, errorId);
3721
+ });
3722
+ var onAllReady = request.onAllReady;
3723
+ onAllReady();
3724
+ flushCompletedChunks(request);
3725
+ } catch (error) {
3726
+ logRecoverableError(request, error, null), fatalError(request, error);
3727
+ }
3728
+ }
3729
+ function abort(request, reason) {
3730
+ if (!(11 < request.status))
3731
+ try {
3732
+ request.status = ABORTING;
3733
+ request.abortTime = performance.now();
3734
+ request.cacheController.abort(reason);
3735
+ var abortableTasks = request.abortableTasks;
3736
+ if (0 < abortableTasks.size)
3737
+ if (21 === request.type)
3738
+ abortableTasks.forEach(function (task) {
3739
+ return haltTask(task, request);
3740
+ }),
3741
+ scheduleWork(function () {
3742
+ return finishHalt(request, abortableTasks);
3743
+ });
3744
+ else {
3745
+ var error =
3746
+ void 0 === reason
3747
+ ? Error(
3748
+ "The render was aborted by the server without a reason."
3749
+ )
3750
+ : "object" === typeof reason &&
3751
+ null !== reason &&
3752
+ "function" === typeof reason.then
3753
+ ? Error(
3754
+ "The render was aborted by the server with a promise."
3755
+ )
3756
+ : reason,
3757
+ digest = logRecoverableError(request, error, null),
3758
+ _errorId2 = request.nextChunkId++;
3759
+ request.fatalError = _errorId2;
3760
+ request.pendingChunks++;
3761
+ emitErrorChunk(request, _errorId2, digest, error, !1, null);
3762
+ abortableTasks.forEach(function (task) {
3763
+ return abortTask(task, request, _errorId2);
3764
+ });
3765
+ scheduleWork(function () {
3766
+ return finishAbort(request, abortableTasks, _errorId2);
3767
+ });
2647
3768
  }
2648
- });
2649
- abortableTasks.clear();
2650
- var onAllReady = request.onAllReady;
2651
- onAllReady();
2652
- }
2653
- var abortListeners = request.abortListeners;
2654
- if (0 < abortListeners.size) {
2655
- var _error =
2656
- void 0 === reason
2657
- ? Error("The render was aborted by the server without a reason.")
2658
- : "object" === typeof reason &&
2659
- null !== reason &&
2660
- "function" === typeof reason.then
2661
- ? Error("The render was aborted by the server with a promise.")
2662
- : reason;
2663
- abortListeners.forEach(function (callback) {
2664
- return callback(_error);
2665
- });
2666
- abortListeners.clear();
3769
+ else {
3770
+ var onAllReady = request.onAllReady;
3771
+ onAllReady();
3772
+ flushCompletedChunks(request);
3773
+ }
3774
+ } catch (error$2) {
3775
+ logRecoverableError(request, error$2, null),
3776
+ fatalError(request, error$2);
2667
3777
  }
2668
- null !== request.destination &&
2669
- flushCompletedChunks(request, request.destination);
2670
- } catch (error$2) {
2671
- logRecoverableError(request, error$2, null),
2672
- fatalError(request, error$2);
2673
- }
3778
+ }
3779
+ function fromHex(str) {
3780
+ return parseInt(str, 16);
3781
+ }
3782
+ function closeDebugChannel(request) {
3783
+ var deferredDebugObjects = request.deferredDebugObjects;
3784
+ if (null === deferredDebugObjects)
3785
+ throw Error(
3786
+ "resolveDebugMessage/closeDebugChannel should not be called for a Request that wasn't kept alive. This is a bug in React."
3787
+ );
3788
+ deferredDebugObjects.retained.forEach(function (value, id) {
3789
+ request.pendingDebugChunks--;
3790
+ deferredDebugObjects.retained.delete(id);
3791
+ deferredDebugObjects.existing.delete(value);
3792
+ });
3793
+ enqueueFlush(request);
2674
3794
  }
2675
3795
  function resolveServerReference(bundlerConfig, id) {
2676
3796
  var name = "",
@@ -3420,6 +4540,94 @@
3420
4540
  if ("fulfilled" !== body.status) throw body.reason;
3421
4541
  return body.value;
3422
4542
  }
4543
+ function startReadingFromDebugChannelReadableStream(
4544
+ request$jscomp$0,
4545
+ stream
4546
+ ) {
4547
+ function progress(_ref) {
4548
+ var done = _ref.done,
4549
+ buffer = _ref.value;
4550
+ _ref = stringBuffer;
4551
+ done
4552
+ ? ((buffer = new Uint8Array(0)),
4553
+ (buffer = stringDecoder.decode(buffer)))
4554
+ : (buffer = stringDecoder.decode(buffer, decoderOptions));
4555
+ stringBuffer = _ref + buffer;
4556
+ _ref = stringBuffer.split("\n");
4557
+ for (buffer = 0; buffer < _ref.length - 1; buffer++) {
4558
+ var request = request$jscomp$0,
4559
+ message = _ref[buffer],
4560
+ deferredDebugObjects = request.deferredDebugObjects;
4561
+ if (null === deferredDebugObjects)
4562
+ throw Error(
4563
+ "resolveDebugMessage/closeDebugChannel should not be called for a Request that wasn't kept alive. This is a bug in React."
4564
+ );
4565
+ if ("" === message) closeDebugChannel(request);
4566
+ else {
4567
+ var command = message.charCodeAt(0);
4568
+ message = message.slice(2).split(",").map(fromHex);
4569
+ switch (command) {
4570
+ case 82:
4571
+ for (command = 0; command < message.length; command++) {
4572
+ var id = message[command],
4573
+ retainedValue = deferredDebugObjects.retained.get(id);
4574
+ void 0 !== retainedValue &&
4575
+ (request.pendingDebugChunks--,
4576
+ deferredDebugObjects.retained.delete(id),
4577
+ deferredDebugObjects.existing.delete(retainedValue),
4578
+ enqueueFlush(request));
4579
+ }
4580
+ break;
4581
+ case 81:
4582
+ for (command = 0; command < message.length; command++)
4583
+ (id = message[command]),
4584
+ (retainedValue = deferredDebugObjects.retained.get(id)),
4585
+ void 0 !== retainedValue &&
4586
+ (deferredDebugObjects.retained.delete(id),
4587
+ deferredDebugObjects.existing.delete(retainedValue),
4588
+ emitOutlinedDebugModelChunk(
4589
+ request,
4590
+ id,
4591
+ { objectLimit: 10 },
4592
+ retainedValue
4593
+ ),
4594
+ enqueueFlush(request));
4595
+ break;
4596
+ case 80:
4597
+ for (command = 0; command < message.length; command++)
4598
+ (id = message[command]),
4599
+ (retainedValue = deferredDebugObjects.retained.get(id)),
4600
+ void 0 !== retainedValue &&
4601
+ (deferredDebugObjects.retained.delete(id),
4602
+ emitRequestedDebugThenable(
4603
+ request,
4604
+ id,
4605
+ { objectLimit: 10 },
4606
+ retainedValue
4607
+ ));
4608
+ break;
4609
+ default:
4610
+ throw Error(
4611
+ "Unknown command. The debugChannel was not wired up properly."
4612
+ );
4613
+ }
4614
+ }
4615
+ }
4616
+ stringBuffer = _ref[_ref.length - 1];
4617
+ if (done) closeDebugChannel(request$jscomp$0);
4618
+ else return reader.read().then(progress).catch(error);
4619
+ }
4620
+ function error(e) {
4621
+ abort(
4622
+ request$jscomp$0,
4623
+ Error("Lost connection to the Debug Channel.", { cause: e })
4624
+ );
4625
+ }
4626
+ var reader = stream.getReader(),
4627
+ stringDecoder = new TextDecoder(),
4628
+ stringBuffer = "";
4629
+ reader.read().then(progress).catch(error);
4630
+ }
3423
4631
  var ReactDOM = require("react-dom"),
3424
4632
  React = require("react"),
3425
4633
  channel = new MessageChannel(),
@@ -3460,6 +4668,8 @@
3460
4668
  return;
3461
4669
  case "defaultProps":
3462
4670
  return;
4671
+ case "_debugInfo":
4672
+ return;
3463
4673
  case "toJSON":
3464
4674
  return;
3465
4675
  case Symbol.toPrimitive:
@@ -3516,7 +4726,7 @@
3516
4726
  r: previousDispatcher.r,
3517
4727
  D: function (href) {
3518
4728
  if ("string" === typeof href && href) {
3519
- var request = currentRequest ? currentRequest : null;
4729
+ var request = resolveRequest();
3520
4730
  if (request) {
3521
4731
  var hints = request.hints,
3522
4732
  key = "D|" + href;
@@ -3526,7 +4736,7 @@
3526
4736
  },
3527
4737
  C: function (href, crossOrigin) {
3528
4738
  if ("string" === typeof href) {
3529
- var request = currentRequest ? currentRequest : null;
4739
+ var request = resolveRequest();
3530
4740
  if (request) {
3531
4741
  var hints = request.hints,
3532
4742
  key =
@@ -3542,49 +4752,11 @@
3542
4752
  } else previousDispatcher.C(href, crossOrigin);
3543
4753
  }
3544
4754
  },
3545
- L: function (href, as, options) {
3546
- if ("string" === typeof href) {
3547
- var request = currentRequest ? currentRequest : null;
3548
- if (request) {
3549
- var hints = request.hints,
3550
- key = "L";
3551
- if ("image" === as && options) {
3552
- var imageSrcSet = options.imageSrcSet,
3553
- imageSizes = options.imageSizes,
3554
- uniquePart = "";
3555
- "string" === typeof imageSrcSet && "" !== imageSrcSet
3556
- ? ((uniquePart += "[" + imageSrcSet + "]"),
3557
- "string" === typeof imageSizes &&
3558
- (uniquePart += "[" + imageSizes + "]"))
3559
- : (uniquePart += "[][]" + href);
3560
- key += "[image]" + uniquePart;
3561
- } else key += "[" + as + "]" + href;
3562
- hints.has(key) ||
3563
- (hints.add(key),
3564
- (options = trimOptions(options))
3565
- ? emitHint(request, "L", [href, as, options])
3566
- : emitHint(request, "L", [href, as]));
3567
- } else previousDispatcher.L(href, as, options);
3568
- }
3569
- },
3570
- m: function (href, options) {
3571
- if ("string" === typeof href) {
3572
- var request = currentRequest ? currentRequest : null;
3573
- if (request) {
3574
- var hints = request.hints,
3575
- key = "m|" + href;
3576
- if (hints.has(key)) return;
3577
- hints.add(key);
3578
- return (options = trimOptions(options))
3579
- ? emitHint(request, "m", [href, options])
3580
- : emitHint(request, "m", href);
3581
- }
3582
- previousDispatcher.m(href, options);
3583
- }
3584
- },
4755
+ L: preload,
4756
+ m: preloadModule$1,
3585
4757
  X: function (src, options) {
3586
4758
  if ("string" === typeof src) {
3587
- var request = currentRequest ? currentRequest : null;
4759
+ var request = resolveRequest();
3588
4760
  if (request) {
3589
4761
  var hints = request.hints,
3590
4762
  key = "X|" + src;
@@ -3599,7 +4771,7 @@
3599
4771
  },
3600
4772
  S: function (href, precedence, options) {
3601
4773
  if ("string" === typeof href) {
3602
- var request = currentRequest ? currentRequest : null;
4774
+ var request = resolveRequest();
3603
4775
  if (request) {
3604
4776
  var hints = request.hints,
3605
4777
  key = "S|" + href;
@@ -3620,7 +4792,7 @@
3620
4792
  },
3621
4793
  M: function (src, options) {
3622
4794
  if ("string" === typeof src) {
3623
- var request = currentRequest ? currentRequest : null;
4795
+ var request = resolveRequest();
3624
4796
  if (request) {
3625
4797
  var hints = request.hints,
3626
4798
  key = "M|" + src;
@@ -3634,8 +4806,12 @@
3634
4806
  }
3635
4807
  }
3636
4808
  };
3637
- var frameRegExp =
4809
+ var framesToSkip = 0,
4810
+ collectedStackTrace = null,
4811
+ identifierRegExp = /^[a-zA-Z_$][0-9a-zA-Z_$]*$/,
4812
+ frameRegExp =
3638
4813
  /^ {3} at (?:(.+) \((?:(.+):(\d+):(\d+)|<anonymous>)\)|(?:async )?(.+):(\d+):(\d+)|<anonymous>)$/,
4814
+ stackTraceCache = new WeakMap(),
3639
4815
  TEMPORARY_REFERENCE_TAG = Symbol.for("react.temporary.reference"),
3640
4816
  proxyHandlers = {
3641
4817
  get: function (target, name) {
@@ -3648,6 +4824,8 @@
3648
4824
  return;
3649
4825
  case "defaultProps":
3650
4826
  return;
4827
+ case "_debugInfo":
4828
+ return;
3651
4829
  case "toJSON":
3652
4830
  return;
3653
4831
  case Symbol.toPrimitive:
@@ -3658,6 +4836,8 @@
3658
4836
  throw Error(
3659
4837
  "Cannot render a Client Context Provider on the Server. Instead, you can export a Client Component wrapper that itself renders a Client Context Provider."
3660
4838
  );
4839
+ case "then":
4840
+ return;
3661
4841
  }
3662
4842
  throw Error(
3663
4843
  "Cannot access " +
@@ -3744,11 +4924,11 @@
3744
4924
  throw Error("useId can only be used while React is rendering");
3745
4925
  var id = currentRequest$1.identifierCount++;
3746
4926
  return (
3747
- ":" +
4927
+ "_" +
3748
4928
  currentRequest$1.identifierPrefix +
3749
- "S" +
4929
+ "S_" +
3750
4930
  id.toString(32) +
3751
- ":"
4931
+ "_"
3752
4932
  );
3753
4933
  },
3754
4934
  useHostTransitionStatus: unsupportedHook,
@@ -3763,17 +4943,20 @@
3763
4943
  useCacheRefresh: function () {
3764
4944
  return unsupportedRefresh;
3765
4945
  }
3766
- },
3767
- currentOwner = null,
4946
+ };
4947
+ HooksDispatcher.useEffectEvent = unsupportedHook;
4948
+ var currentOwner = null,
3768
4949
  DefaultAsyncDispatcher = {
3769
4950
  getCacheForType: function (resourceType) {
3770
- var cache = (cache = currentRequest ? currentRequest : null)
3771
- ? cache.cache
3772
- : new Map();
4951
+ var cache = (cache = resolveRequest()) ? cache.cache : new Map();
3773
4952
  var entry = cache.get(resourceType);
3774
4953
  void 0 === entry &&
3775
4954
  ((entry = resourceType()), cache.set(resourceType, entry));
3776
4955
  return entry;
4956
+ },
4957
+ cacheSignal: function () {
4958
+ var request = resolveRequest();
4959
+ return request ? request.cacheController.signal : null;
3777
4960
  }
3778
4961
  };
3779
4962
  DefaultAsyncDispatcher.getOwner = resolveOwner;
@@ -3836,6 +5019,7 @@
3836
5019
  jsxPropsParents = new WeakMap(),
3837
5020
  jsxChildrenParents = new WeakMap(),
3838
5021
  CLIENT_REFERENCE_TAG = Symbol.for("react.client.reference"),
5022
+ hasOwnProperty = Object.prototype.hasOwnProperty,
3839
5023
  doNotLimit = new WeakSet();
3840
5024
  "object" === typeof console &&
3841
5025
  null !== console &&
@@ -3854,20 +5038,19 @@
3854
5038
  patchConsole(console, "warn"));
3855
5039
  var ObjectPrototype = Object.prototype,
3856
5040
  stringify = JSON.stringify,
3857
- PENDING$1 = 0,
3858
- COMPLETED = 1,
3859
- ABORTED = 3,
3860
- ERRORED$1 = 4,
3861
- RENDERING = 5,
3862
- OPENING = 10,
3863
5041
  ABORTING = 12,
3864
- CLOSING = 13,
3865
5042
  CLOSED = 14,
3866
- PRERENDER = 21,
5043
+ defaultPostponeHandler = noop,
3867
5044
  currentRequest = null,
3868
- debugID = null,
5045
+ canEmitDebugInfo = !1,
5046
+ serializedSize = 0,
5047
+ MAX_ROW_SIZE = 3200,
3869
5048
  modelRoot = !1,
5049
+ CONSTRUCTOR_MARKER = Symbol(),
5050
+ debugModelRoot = null,
5051
+ debugNoOutline = null,
3870
5052
  emptyRoot = {},
5053
+ decoderOptions = { stream: !0 },
3871
5054
  chunkCache = new Map(),
3872
5055
  chunkMap = new Map(),
3873
5056
  webpackGetChunkFilename = __webpack_require__.u;
@@ -3877,7 +5060,6 @@
3877
5060
  ? flightChunk
3878
5061
  : webpackGetChunkFilename(chunkId);
3879
5062
  };
3880
- var hasOwnProperty = Object.prototype.hasOwnProperty;
3881
5063
  Chunk.prototype = Object.create(Promise.prototype);
3882
5064
  Chunk.prototype.then = function (resolve, reject) {
3883
5065
  switch (this.status) {
@@ -3968,6 +5150,50 @@
3968
5150
  close(body);
3969
5151
  return webpackMap;
3970
5152
  };
5153
+ exports.prerender = function (model, webpackMap, options) {
5154
+ return new Promise(function (resolve, reject) {
5155
+ var request = createPrerenderRequest(
5156
+ model,
5157
+ webpackMap,
5158
+ function () {
5159
+ var stream = new ReadableStream(
5160
+ {
5161
+ type: "bytes",
5162
+ pull: function (controller) {
5163
+ startFlowing(request, controller);
5164
+ },
5165
+ cancel: function (reason) {
5166
+ request.destination = null;
5167
+ abort(request, reason);
5168
+ }
5169
+ },
5170
+ { highWaterMark: 0 }
5171
+ );
5172
+ resolve({ prelude: stream });
5173
+ },
5174
+ reject,
5175
+ options ? options.onError : void 0,
5176
+ options ? options.identifierPrefix : void 0,
5177
+ options ? options.onPostpone : void 0,
5178
+ options ? options.temporaryReferences : void 0,
5179
+ options ? options.environmentName : void 0,
5180
+ options ? options.filterStackFrame : void 0,
5181
+ !1
5182
+ );
5183
+ if (options && options.signal) {
5184
+ var signal = options.signal;
5185
+ if (signal.aborted) abort(request, signal.reason);
5186
+ else {
5187
+ var listener = function () {
5188
+ abort(request, signal.reason);
5189
+ signal.removeEventListener("abort", listener);
5190
+ };
5191
+ signal.addEventListener("abort", listener);
5192
+ }
5193
+ }
5194
+ startWork(request);
5195
+ });
5196
+ };
3971
5197
  exports.registerClientReference = function (
3972
5198
  proxyImplementation,
3973
5199
  id,
@@ -3992,16 +5218,25 @@
3992
5218
  });
3993
5219
  };
3994
5220
  exports.renderToReadableStream = function (model, webpackMap, options) {
3995
- var request = createRequest(
3996
- model,
3997
- webpackMap,
3998
- options ? options.onError : void 0,
3999
- options ? options.identifierPrefix : void 0,
4000
- options ? options.onPostpone : void 0,
4001
- options ? options.temporaryReferences : void 0,
4002
- options ? options.environmentName : void 0,
4003
- options ? options.filterStackFrame : void 0
4004
- );
5221
+ var debugChannelReadable =
5222
+ options && options.debugChannel
5223
+ ? options.debugChannel.readable
5224
+ : void 0,
5225
+ debugChannelWritable =
5226
+ options && options.debugChannel
5227
+ ? options.debugChannel.writable
5228
+ : void 0,
5229
+ request = createRequest(
5230
+ model,
5231
+ webpackMap,
5232
+ options ? options.onError : void 0,
5233
+ options ? options.identifierPrefix : void 0,
5234
+ options ? options.onPostpone : void 0,
5235
+ options ? options.temporaryReferences : void 0,
5236
+ options ? options.environmentName : void 0,
5237
+ options ? options.filterStackFrame : void 0,
5238
+ void 0 !== debugChannelReadable
5239
+ );
4005
5240
  if (options && options.signal) {
4006
5241
  var signal = options.signal;
4007
5242
  if (signal.aborted) abort(request, signal.reason);
@@ -4013,6 +5248,35 @@
4013
5248
  signal.addEventListener("abort", listener);
4014
5249
  }
4015
5250
  }
5251
+ void 0 !== debugChannelWritable &&
5252
+ new ReadableStream(
5253
+ {
5254
+ type: "bytes",
5255
+ pull: function (controller) {
5256
+ if (13 === request.status)
5257
+ (request.status = CLOSED),
5258
+ closeWithError(controller, request.fatalError);
5259
+ else if (
5260
+ request.status !== CLOSED &&
5261
+ null === request.debugDestination
5262
+ ) {
5263
+ request.debugDestination = controller;
5264
+ try {
5265
+ flushCompletedChunks(request);
5266
+ } catch (error) {
5267
+ logRecoverableError(request, error, null),
5268
+ fatalError(request, error);
5269
+ }
5270
+ }
5271
+ }
5272
+ },
5273
+ { highWaterMark: 0 }
5274
+ ).pipeTo(debugChannelWritable);
5275
+ void 0 !== debugChannelReadable &&
5276
+ startReadingFromDebugChannelReadableStream(
5277
+ request,
5278
+ debugChannelReadable
5279
+ );
4016
5280
  return new ReadableStream(
4017
5281
  {
4018
5282
  type: "bytes",
@@ -4030,50 +5294,4 @@
4030
5294
  { highWaterMark: 0 }
4031
5295
  );
4032
5296
  };
4033
- exports.unstable_prerender = function (model, webpackMap, options) {
4034
- return new Promise(function (resolve, reject) {
4035
- var request = createPrerenderRequest(
4036
- model,
4037
- webpackMap,
4038
- function () {
4039
- var stream = new ReadableStream(
4040
- {
4041
- type: "bytes",
4042
- start: function () {
4043
- startWork(request);
4044
- },
4045
- pull: function (controller) {
4046
- startFlowing(request, controller);
4047
- },
4048
- cancel: function (reason) {
4049
- request.destination = null;
4050
- abort(request, reason);
4051
- }
4052
- },
4053
- { highWaterMark: 0 }
4054
- );
4055
- resolve({ prelude: stream });
4056
- },
4057
- reject,
4058
- options ? options.onError : void 0,
4059
- options ? options.identifierPrefix : void 0,
4060
- options ? options.onPostpone : void 0,
4061
- options ? options.temporaryReferences : void 0,
4062
- options ? options.environmentName : void 0,
4063
- options ? options.filterStackFrame : void 0
4064
- );
4065
- if (options && options.signal) {
4066
- var signal = options.signal;
4067
- if (signal.aborted) abort(request, signal.reason);
4068
- else {
4069
- var listener = function () {
4070
- abort(request, signal.reason);
4071
- signal.removeEventListener("abort", listener);
4072
- };
4073
- signal.addEventListener("abort", listener);
4074
- }
4075
- }
4076
- startWork(request);
4077
- });
4078
- };
4079
5297
  })();