react-dom 19.1.0-canary-d46b04a2-20250117 → 19.1.0-canary-18eaf51b-20250118

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.
@@ -850,8 +850,7 @@
850
850
  segmentPrefix: stringToPrecomputedChunk(idPrefix + "S:"),
851
851
  boundaryPrefix: stringToPrecomputedChunk(idPrefix + "B:"),
852
852
  startInlineScript: inlineScriptWithNonce,
853
- htmlChunks: null,
854
- headChunks: null,
853
+ preamble: createPreambleState(),
855
854
  externalRuntimeScript: null,
856
855
  bootstrapChunks: externalRuntimeConfig,
857
856
  importMapChunks: bootstrapScriptContent,
@@ -1017,6 +1016,9 @@
1017
1016
  moduleScriptResources: {}
1018
1017
  };
1019
1018
  }
1019
+ function createPreambleState() {
1020
+ return { htmlChunks: null, headChunks: null, bodyChunks: null };
1021
+ }
1020
1022
  function createFormatContext(insertionMode, selectedValue, tagScope) {
1021
1023
  return {
1022
1024
  insertionMode: insertionMode,
@@ -1087,16 +1089,26 @@
1087
1089
  null,
1088
1090
  parentContext.tagScope
1089
1091
  );
1092
+ case "head":
1093
+ if (parentContext.insertionMode < HTML_MODE)
1094
+ return createFormatContext(
1095
+ HTML_HEAD_MODE,
1096
+ null,
1097
+ parentContext.tagScope
1098
+ );
1099
+ break;
1100
+ case "html":
1101
+ if (parentContext.insertionMode === ROOT_HTML_MODE)
1102
+ return createFormatContext(
1103
+ HTML_HTML_MODE,
1104
+ null,
1105
+ parentContext.tagScope
1106
+ );
1090
1107
  }
1091
- return parentContext.insertionMode >= HTML_TABLE_MODE
1108
+ return parentContext.insertionMode >= HTML_TABLE_MODE ||
1109
+ parentContext.insertionMode < HTML_MODE
1092
1110
  ? createFormatContext(HTML_MODE, null, parentContext.tagScope)
1093
- : parentContext.insertionMode === ROOT_HTML_MODE
1094
- ? "html" === type
1095
- ? createFormatContext(HTML_HTML_MODE, null, parentContext.tagScope)
1096
- : createFormatContext(HTML_MODE, null, parentContext.tagScope)
1097
- : parentContext.insertionMode === HTML_HTML_MODE
1098
- ? createFormatContext(HTML_MODE, null, parentContext.tagScope)
1099
- : parentContext;
1111
+ : parentContext;
1100
1112
  }
1101
1113
  function pushTextInstance(target, text, renderState, textEmbedded) {
1102
1114
  if ("" === text) return textEmbedded;
@@ -1787,6 +1799,7 @@
1787
1799
  props,
1788
1800
  resumableState,
1789
1801
  renderState,
1802
+ preambleState,
1790
1803
  hoistableState,
1791
1804
  formatContext,
1792
1805
  textEmbedded,
@@ -2955,13 +2968,13 @@
2955
2968
  case "missing-glyph":
2956
2969
  break;
2957
2970
  case "head":
2958
- if (
2959
- formatContext.insertionMode < HTML_MODE &&
2960
- null === renderState.headChunks
2961
- ) {
2962
- renderState.headChunks = [];
2971
+ if (formatContext.insertionMode < HTML_MODE) {
2972
+ var preamble = preambleState || renderState.preamble;
2973
+ if (preamble.headChunks)
2974
+ throw Error("The `<head>` tag may only be rendered once.");
2975
+ preamble.headChunks = [];
2963
2976
  var JSCompiler_inline_result$jscomp$9 = pushStartGenericElement(
2964
- renderState.headChunks,
2977
+ preamble.headChunks,
2965
2978
  props,
2966
2979
  "head"
2967
2980
  );
@@ -2972,24 +2985,42 @@
2972
2985
  "head"
2973
2986
  );
2974
2987
  return JSCompiler_inline_result$jscomp$9;
2975
- case "html":
2976
- if (
2977
- formatContext.insertionMode === ROOT_HTML_MODE &&
2978
- null === renderState.htmlChunks
2979
- ) {
2980
- renderState.htmlChunks = [doctypeChunk];
2988
+ case "body":
2989
+ if (formatContext.insertionMode < HTML_MODE) {
2990
+ var preamble$jscomp$0 = preambleState || renderState.preamble;
2991
+ if (preamble$jscomp$0.bodyChunks)
2992
+ throw Error("The `<body>` tag may only be rendered once.");
2993
+ preamble$jscomp$0.bodyChunks = [];
2981
2994
  var JSCompiler_inline_result$jscomp$10 = pushStartGenericElement(
2982
- renderState.htmlChunks,
2995
+ preamble$jscomp$0.bodyChunks,
2983
2996
  props,
2984
- "html"
2997
+ "body"
2985
2998
  );
2986
2999
  } else
2987
3000
  JSCompiler_inline_result$jscomp$10 = pushStartGenericElement(
2988
3001
  target$jscomp$0,
2989
3002
  props,
2990
- "html"
3003
+ "body"
2991
3004
  );
2992
3005
  return JSCompiler_inline_result$jscomp$10;
3006
+ case "html":
3007
+ if (formatContext.insertionMode === ROOT_HTML_MODE) {
3008
+ var preamble$jscomp$1 = preambleState || renderState.preamble;
3009
+ if (preamble$jscomp$1.htmlChunks)
3010
+ throw Error("The `<html>` tag may only be rendered once.");
3011
+ preamble$jscomp$1.htmlChunks = [doctypeChunk];
3012
+ var JSCompiler_inline_result$jscomp$11 = pushStartGenericElement(
3013
+ preamble$jscomp$1.htmlChunks,
3014
+ props,
3015
+ "html"
3016
+ );
3017
+ } else
3018
+ JSCompiler_inline_result$jscomp$11 = pushStartGenericElement(
3019
+ target$jscomp$0,
3020
+ props,
3021
+ "html"
3022
+ );
3023
+ return JSCompiler_inline_result$jscomp$11;
2993
3024
  default:
2994
3025
  if (-1 !== type.indexOf("-")) {
2995
3026
  target$jscomp$0.push(startChunkForTag(type));
@@ -3059,6 +3090,15 @@
3059
3090
  endTagCache.set(tag, chunk));
3060
3091
  return chunk;
3061
3092
  }
3093
+ function hoistPreambleState(renderState, preambleState) {
3094
+ renderState = renderState.preamble;
3095
+ null === renderState.htmlChunks &&
3096
+ (renderState.htmlChunks = preambleState.htmlChunks);
3097
+ null === renderState.headChunks &&
3098
+ (renderState.headChunks = preambleState.headChunks);
3099
+ null === renderState.bodyChunks &&
3100
+ (renderState.bodyChunks = preambleState.bodyChunks);
3101
+ }
3062
3102
  function writeBootstrap(destination, renderState) {
3063
3103
  renderState = renderState.bootstrapChunks;
3064
3104
  for (var i = 0; i < renderState.length - 1; i++)
@@ -3083,6 +3123,7 @@
3083
3123
  switch (formatContext.insertionMode) {
3084
3124
  case ROOT_HTML_MODE:
3085
3125
  case HTML_HTML_MODE:
3126
+ case HTML_HEAD_MODE:
3086
3127
  case HTML_MODE:
3087
3128
  return (
3088
3129
  writeChunk(destination, startSegmentHTML),
@@ -3140,6 +3181,7 @@
3140
3181
  switch (formatContext.insertionMode) {
3141
3182
  case ROOT_HTML_MODE:
3142
3183
  case HTML_HTML_MODE:
3184
+ case HTML_HEAD_MODE:
3143
3185
  case HTML_MODE:
3144
3186
  return writeChunkAndReturn(destination, endSegmentHTML);
3145
3187
  case SVG_MODE:
@@ -4348,7 +4390,7 @@
4348
4390
  this.status = 10;
4349
4391
  this.fatalError = null;
4350
4392
  this.pendingRootTasks = this.allPendingTasks = this.nextSegmentId = 0;
4351
- this.completedRootSegment = null;
4393
+ this.completedPreambleSegments = this.completedRootSegment = null;
4352
4394
  this.abortableTasks = abortSet;
4353
4395
  this.pingedTasks = [];
4354
4396
  this.clientRenderedBoundaries = [];
@@ -4408,6 +4450,7 @@
4408
4450
  null,
4409
4451
  renderState,
4410
4452
  null,
4453
+ null,
4411
4454
  resumableState.abortableTasks,
4412
4455
  null,
4413
4456
  rootFormatContext,
@@ -4474,7 +4517,12 @@
4474
4517
  return performWork(request);
4475
4518
  }, 0));
4476
4519
  }
4477
- function createSuspenseBoundary(request, fallbackAbortableTasks) {
4520
+ function createSuspenseBoundary(
4521
+ request,
4522
+ fallbackAbortableTasks,
4523
+ contentPreamble,
4524
+ fallbackPreamble
4525
+ ) {
4478
4526
  return {
4479
4527
  status: PENDING,
4480
4528
  rootSegmentID: -1,
@@ -4486,6 +4534,8 @@
4486
4534
  errorDigest: null,
4487
4535
  contentState: createHoistableState(),
4488
4536
  fallbackState: createHoistableState(),
4537
+ contentPreamble: contentPreamble,
4538
+ fallbackPreamble: fallbackPreamble,
4489
4539
  trackedContentKeyPath: null,
4490
4540
  trackedFallbackNode: null,
4491
4541
  errorMessage: null,
@@ -4500,6 +4550,7 @@
4500
4550
  childIndex,
4501
4551
  blockedBoundary,
4502
4552
  blockedSegment,
4553
+ blockedPreamble,
4503
4554
  hoistableState,
4504
4555
  abortSet,
4505
4556
  keyPath,
@@ -4522,6 +4573,7 @@
4522
4573
  },
4523
4574
  blockedBoundary: blockedBoundary,
4524
4575
  blockedSegment: blockedSegment,
4576
+ blockedPreamble: blockedPreamble,
4525
4577
  hoistableState: hoistableState,
4526
4578
  abortSet: abortSet,
4527
4579
  keyPath: keyPath,
@@ -4565,6 +4617,7 @@
4565
4617
  },
4566
4618
  blockedBoundary: blockedBoundary,
4567
4619
  blockedSegment: null,
4620
+ blockedPreamble: null,
4568
4621
  hoistableState: hoistableState,
4569
4622
  abortSet: abortSet,
4570
4623
  keyPath: keyPath,
@@ -4588,11 +4641,12 @@
4588
4641
  ) {
4589
4642
  return {
4590
4643
  status: PENDING,
4644
+ parentFlushed: !1,
4591
4645
  id: -1,
4592
4646
  index: index,
4593
- parentFlushed: !1,
4594
4647
  chunks: [],
4595
4648
  children: [],
4649
+ preambleChildren: [],
4596
4650
  parentFormatContext: parentFormatContext,
4597
4651
  boundary: boundary,
4598
4652
  lastPushedText: lastPushedText,
@@ -5233,6 +5287,7 @@
5233
5287
  props,
5234
5288
  request.resumableState,
5235
5289
  request.renderState,
5290
+ task.blockedPreamble,
5236
5291
  task.hoistableState,
5237
5292
  task.formatContext,
5238
5293
  segment.lastPushedText,
@@ -5241,9 +5296,43 @@
5241
5296
  segment.lastPushedText = !1;
5242
5297
  var _prevContext = task.formatContext,
5243
5298
  _prevKeyPath2 = task.keyPath;
5244
- task.formatContext = getChildFormatContext(_prevContext, type, props);
5245
5299
  task.keyPath = keyPath;
5246
- renderNode(request, task, _children, -1);
5300
+ if (
5301
+ (task.formatContext = getChildFormatContext(
5302
+ _prevContext,
5303
+ type,
5304
+ props
5305
+ )).insertionMode === HTML_HEAD_MODE
5306
+ ) {
5307
+ var preambleSegment = createPendingSegment(
5308
+ request,
5309
+ 0,
5310
+ null,
5311
+ task.formatContext,
5312
+ !1,
5313
+ !1
5314
+ );
5315
+ segment.preambleChildren.push(preambleSegment);
5316
+ var preambleTask = createRenderTask(
5317
+ request,
5318
+ null,
5319
+ _children,
5320
+ -1,
5321
+ task.blockedBoundary,
5322
+ preambleSegment,
5323
+ task.blockedPreamble,
5324
+ task.hoistableState,
5325
+ request.abortableTasks,
5326
+ task.keyPath,
5327
+ task.formatContext,
5328
+ task.context,
5329
+ task.treeContext,
5330
+ task.componentStack,
5331
+ task.isFallback
5332
+ );
5333
+ pushComponentStack(preambleTask);
5334
+ request.pingedTasks.push(preambleTask);
5335
+ } else renderNode(request, task, _children, -1);
5247
5336
  task.formatContext = _prevContext;
5248
5337
  task.keyPath = _prevKeyPath2;
5249
5338
  a: {
@@ -5280,6 +5369,9 @@
5280
5369
  resumableState.hasHtml = !0;
5281
5370
  break a;
5282
5371
  }
5372
+ break;
5373
+ case "head":
5374
+ if (_prevContext.insertionMode <= HTML_HTML_MODE) break a;
5283
5375
  }
5284
5376
  target.push(endChunkForTag(type));
5285
5377
  }
@@ -5328,12 +5420,26 @@
5328
5420
  } else {
5329
5421
  var prevKeyPath$jscomp$3 = task.keyPath,
5330
5422
  parentBoundary = task.blockedBoundary,
5423
+ parentPreamble = task.blockedPreamble,
5331
5424
  parentHoistableState = task.hoistableState,
5332
5425
  parentSegment = task.blockedSegment,
5333
5426
  fallback = props.fallback,
5334
5427
  content = props.children,
5335
- fallbackAbortSet = new Set(),
5336
- newBoundary = createSuspenseBoundary(request, fallbackAbortSet);
5428
+ fallbackAbortSet = new Set();
5429
+ var newBoundary =
5430
+ task.formatContext.insertionMode < HTML_MODE
5431
+ ? createSuspenseBoundary(
5432
+ request,
5433
+ fallbackAbortSet,
5434
+ createPreambleState(),
5435
+ createPreambleState()
5436
+ )
5437
+ : createSuspenseBoundary(
5438
+ request,
5439
+ fallbackAbortSet,
5440
+ null,
5441
+ null
5442
+ );
5337
5443
  null !== request.trackedPostpones &&
5338
5444
  (newBoundary.trackedContentKeyPath = keyPath);
5339
5445
  var boundarySegment = createPendingSegment(
@@ -5373,6 +5479,7 @@
5373
5479
  );
5374
5480
  newBoundary.trackedFallbackNode = fallbackReplayNode;
5375
5481
  task.blockedSegment = boundarySegment;
5482
+ task.blockedPreamble = newBoundary.fallbackPreamble;
5376
5483
  task.keyPath = fallbackKeyPath;
5377
5484
  boundarySegment.status = 6;
5378
5485
  try {
@@ -5388,6 +5495,7 @@
5388
5495
  );
5389
5496
  } finally {
5390
5497
  (task.blockedSegment = parentSegment),
5498
+ (task.blockedPreamble = parentPreamble),
5391
5499
  (task.keyPath = prevKeyPath$jscomp$3);
5392
5500
  }
5393
5501
  var suspendedPrimaryTask = createRenderTask(
@@ -5397,6 +5505,7 @@
5397
5505
  -1,
5398
5506
  newBoundary,
5399
5507
  contentRootSegment,
5508
+ newBoundary.contentPreamble,
5400
5509
  newBoundary.contentState,
5401
5510
  task.abortSet,
5402
5511
  keyPath,
@@ -5410,6 +5519,7 @@
5410
5519
  request.pingedTasks.push(suspendedPrimaryTask);
5411
5520
  } else {
5412
5521
  task.blockedBoundary = newBoundary;
5522
+ task.blockedPreamble = newBoundary.contentPreamble;
5413
5523
  task.hoistableState = newBoundary.contentState;
5414
5524
  task.blockedSegment = contentRootSegment;
5415
5525
  task.keyPath = keyPath;
@@ -5426,6 +5536,9 @@
5426
5536
  newBoundary.status === PENDING)
5427
5537
  ) {
5428
5538
  newBoundary.status = COMPLETED;
5539
+ 0 === request.pendingRootTasks &&
5540
+ task.blockedPreamble &&
5541
+ preparePreamble(request);
5429
5542
  break a;
5430
5543
  }
5431
5544
  } catch (thrownValue$2) {
@@ -5451,6 +5564,7 @@
5451
5564
  untrackBoundary(request, newBoundary);
5452
5565
  } finally {
5453
5566
  (task.blockedBoundary = parentBoundary),
5567
+ (task.blockedPreamble = parentPreamble),
5454
5568
  (task.hoistableState = parentHoistableState),
5455
5569
  (task.blockedSegment = parentSegment),
5456
5570
  (task.keyPath = prevKeyPath$jscomp$3);
@@ -5462,6 +5576,7 @@
5462
5576
  -1,
5463
5577
  parentBoundary,
5464
5578
  boundarySegment,
5579
+ newBoundary.fallbackPreamble,
5465
5580
  newBoundary.fallbackState,
5466
5581
  fallbackAbortSet,
5467
5582
  [keyPath[0], "Suspense Fallback", keyPath[2]],
@@ -5719,17 +5834,27 @@
5719
5834
  previousReplaySet = task.replay,
5720
5835
  parentBoundary = task.blockedBoundary,
5721
5836
  parentHoistableState = task.hoistableState,
5722
- content = props.children;
5723
- props = props.fallback;
5724
- var fallbackAbortSet = new Set(),
5725
- resumedBoundary = createSuspenseBoundary(
5726
- request,
5727
- fallbackAbortSet
5728
- );
5729
- resumedBoundary.parentFlushed = !0;
5730
- resumedBoundary.rootSegmentID = ref;
5731
- task.blockedBoundary = resumedBoundary;
5732
- task.hoistableState = resumedBoundary.contentState;
5837
+ content = props.children,
5838
+ fallback = props.fallback,
5839
+ fallbackAbortSet = new Set();
5840
+ props =
5841
+ task.formatContext.insertionMode < HTML_MODE
5842
+ ? createSuspenseBoundary(
5843
+ request,
5844
+ fallbackAbortSet,
5845
+ createPreambleState(),
5846
+ createPreambleState()
5847
+ )
5848
+ : createSuspenseBoundary(
5849
+ request,
5850
+ fallbackAbortSet,
5851
+ null,
5852
+ null
5853
+ );
5854
+ props.parentFlushed = !0;
5855
+ props.rootSegmentID = ref;
5856
+ task.blockedBoundary = props;
5857
+ task.hoistableState = props.contentState;
5733
5858
  task.keyPath = keyPath;
5734
5859
  task.replay = {
5735
5860
  nodes: replay,
@@ -5747,15 +5872,15 @@
5747
5872
  );
5748
5873
  task.replay.pendingTasks--;
5749
5874
  if (
5750
- 0 === resumedBoundary.pendingTasks &&
5751
- resumedBoundary.status === PENDING
5875
+ 0 === props.pendingTasks &&
5876
+ props.status === PENDING
5752
5877
  ) {
5753
- resumedBoundary.status = COMPLETED;
5754
- request.completedBoundaries.push(resumedBoundary);
5878
+ props.status = COMPLETED;
5879
+ request.completedBoundaries.push(props);
5755
5880
  break a;
5756
5881
  }
5757
5882
  } catch (error) {
5758
- (resumedBoundary.status = CLIENT_RENDERED),
5883
+ (props.status = CLIENT_RENDERED),
5759
5884
  (childNodes = getThrownInfo(task.componentStack)),
5760
5885
  (type = logRecoverableError(
5761
5886
  request,
@@ -5763,16 +5888,14 @@
5763
5888
  childNodes
5764
5889
  )),
5765
5890
  encodeErrorForBoundary(
5766
- resumedBoundary,
5891
+ props,
5767
5892
  type,
5768
5893
  error,
5769
5894
  childNodes,
5770
5895
  !1
5771
5896
  ),
5772
5897
  task.replay.pendingTasks--,
5773
- request.clientRenderedBoundaries.push(
5774
- resumedBoundary
5775
- );
5898
+ request.clientRenderedBoundaries.push(props);
5776
5899
  } finally {
5777
5900
  (task.blockedBoundary = parentBoundary),
5778
5901
  (task.hoistableState = parentHoistableState),
@@ -5783,10 +5906,10 @@
5783
5906
  request,
5784
5907
  null,
5785
5908
  { nodes: keyOrIndex, slots: key, pendingTasks: 0 },
5786
- props,
5909
+ fallback,
5787
5910
  -1,
5788
5911
  parentBoundary,
5789
- resumedBoundary.fallbackState,
5912
+ props.fallbackState,
5790
5913
  fallbackAbortSet,
5791
5914
  [keyPath[0], "Suspense Fallback", keyPath[2]],
5792
5915
  task.formatContext,
@@ -6115,6 +6238,7 @@
6115
6238
  task.childIndex,
6116
6239
  task.blockedBoundary,
6117
6240
  newSegment,
6241
+ task.blockedPreamble,
6118
6242
  task.hoistableState,
6119
6243
  task.abortSet,
6120
6244
  task.keyPath,
@@ -6283,7 +6407,12 @@
6283
6407
  errorDigest = errorDigest$jscomp$0,
6284
6408
  errorInfo = errorInfo$jscomp$0,
6285
6409
  wasAborted = aborted,
6286
- resumedBoundary = createSuspenseBoundary(request, new Set());
6410
+ resumedBoundary = createSuspenseBoundary(
6411
+ request,
6412
+ new Set(),
6413
+ null,
6414
+ null
6415
+ );
6287
6416
  resumedBoundary.parentFlushed = !0;
6288
6417
  resumedBoundary.rootSegmentID = node;
6289
6418
  resumedBoundary.status = CLIENT_RENDERED;
@@ -6436,6 +6565,7 @@
6436
6565
  }
6437
6566
  function completeShell(request) {
6438
6567
  null === request.trackedPostpones && safelyEmitEarlyPreloads(request, !0);
6568
+ null === request.trackedPostpones && preparePreamble(request);
6439
6569
  request.onShellError = noop;
6440
6570
  request = request.onShellReady;
6441
6571
  request();
@@ -6448,6 +6578,7 @@
6448
6578
  : null === request.completedRootSegment ||
6449
6579
  request.completedRootSegment.status !== POSTPONED
6450
6580
  );
6581
+ preparePreamble(request);
6451
6582
  request = request.onAllReady;
6452
6583
  request();
6453
6584
  }
@@ -6492,7 +6623,11 @@
6492
6623
  abortTaskSoft,
6493
6624
  request
6494
6625
  ),
6495
- boundary.fallbackAbortableTasks.clear()))
6626
+ boundary.fallbackAbortableTasks.clear(),
6627
+ 0 === request.pendingRootTasks &&
6628
+ null === request.trackedPostpones &&
6629
+ null !== boundary.contentPreamble &&
6630
+ preparePreamble(request)))
6496
6631
  : null !== segment &&
6497
6632
  segment.parentFlushed &&
6498
6633
  segment.status === COMPLETED &&
@@ -6662,7 +6797,11 @@
6662
6797
  ),
6663
6798
  untrackBoundary(request, boundary),
6664
6799
  boundary.parentFlushed &&
6665
- request.clientRenderedBoundaries.push(boundary)));
6800
+ request.clientRenderedBoundaries.push(boundary),
6801
+ 0 === request.pendingRootTasks &&
6802
+ null === request.trackedPostpones &&
6803
+ null !== boundary.contentPreamble &&
6804
+ preparePreamble(request)));
6666
6805
  request.allPendingTasks--;
6667
6806
  0 === request.allPendingTasks && completeAll(request);
6668
6807
  }
@@ -6691,6 +6830,85 @@
6691
6830
  }
6692
6831
  }
6693
6832
  }
6833
+ function preparePreambleFromSubtree(
6834
+ request,
6835
+ segment,
6836
+ collectedPreambleSegments
6837
+ ) {
6838
+ segment.preambleChildren.length &&
6839
+ collectedPreambleSegments.push(segment.preambleChildren);
6840
+ for (var pendingPreambles = !1, i = 0; i < segment.children.length; i++)
6841
+ pendingPreambles =
6842
+ preparePreambleFromSegment(
6843
+ request,
6844
+ segment.children[i],
6845
+ collectedPreambleSegments
6846
+ ) || pendingPreambles;
6847
+ return pendingPreambles;
6848
+ }
6849
+ function preparePreambleFromSegment(
6850
+ request,
6851
+ segment,
6852
+ collectedPreambleSegments
6853
+ ) {
6854
+ var boundary = segment.boundary;
6855
+ if (null === boundary)
6856
+ return preparePreambleFromSubtree(
6857
+ request,
6858
+ segment,
6859
+ collectedPreambleSegments
6860
+ );
6861
+ var preamble = boundary.contentPreamble,
6862
+ fallbackPreamble = boundary.fallbackPreamble;
6863
+ if (null === preamble || null === fallbackPreamble) return !1;
6864
+ switch (boundary.status) {
6865
+ case COMPLETED:
6866
+ hoistPreambleState(request.renderState, preamble);
6867
+ segment = boundary.completedSegments[0];
6868
+ if (!segment)
6869
+ throw Error(
6870
+ "A previously unvisited boundary must have exactly one root segment. This is a bug in React."
6871
+ );
6872
+ return preparePreambleFromSubtree(
6873
+ request,
6874
+ segment,
6875
+ collectedPreambleSegments
6876
+ );
6877
+ case POSTPONED:
6878
+ if (null !== request.trackedPostpones) return !0;
6879
+ case CLIENT_RENDERED:
6880
+ if (segment.status === COMPLETED)
6881
+ return (
6882
+ hoistPreambleState(request.renderState, fallbackPreamble),
6883
+ preparePreambleFromSubtree(
6884
+ request,
6885
+ segment,
6886
+ collectedPreambleSegments
6887
+ )
6888
+ );
6889
+ default:
6890
+ return !0;
6891
+ }
6892
+ }
6893
+ function preparePreamble(request) {
6894
+ if (
6895
+ request.completedRootSegment &&
6896
+ null === request.completedPreambleSegments
6897
+ ) {
6898
+ var collectedPreambleSegments = [],
6899
+ hasPendingPreambles = preparePreambleFromSegment(
6900
+ request,
6901
+ request.completedRootSegment,
6902
+ collectedPreambleSegments
6903
+ ),
6904
+ preamble = request.renderState.preamble;
6905
+ if (
6906
+ !1 === hasPendingPreambles ||
6907
+ (preamble.headChunks && preamble.bodyChunks)
6908
+ )
6909
+ request.completedPreambleSegments = collectedPreambleSegments;
6910
+ }
6911
+ }
6694
6912
  function flushSubtree(request, destination, segment, hoistableState) {
6695
6913
  segment.parentFlushed = !0;
6696
6914
  switch (segment.status) {
@@ -6957,9 +7175,12 @@
6957
7175
  completedRootSegment = request.completedRootSegment;
6958
7176
  if (null !== completedRootSegment) {
6959
7177
  if (completedRootSegment.status === POSTPONED) return;
7178
+ var completedPreambleSegments = request.completedPreambleSegments;
7179
+ if (null === completedPreambleSegments) return;
6960
7180
  var renderState = request.renderState,
6961
- htmlChunks = renderState.htmlChunks,
6962
- headChunks = renderState.headChunks,
7181
+ preamble = renderState.preamble,
7182
+ htmlChunks = preamble.htmlChunks,
7183
+ headChunks = preamble.headChunks,
6963
7184
  i$jscomp$0;
6964
7185
  if (htmlChunks) {
6965
7186
  for (i$jscomp$0 = 0; i$jscomp$0 < htmlChunks.length; i$jscomp$0++)
@@ -7020,10 +7241,27 @@
7020
7241
  i$jscomp$0++
7021
7242
  )
7022
7243
  writeChunk(destination, hoistableChunks[i$jscomp$0]);
7023
- hoistableChunks.length = 0;
7024
- htmlChunks &&
7025
- null === headChunks &&
7244
+ for (
7245
+ renderState = hoistableChunks.length = 0;
7246
+ renderState < completedPreambleSegments.length;
7247
+ renderState++
7248
+ ) {
7249
+ var segments = completedPreambleSegments[renderState];
7250
+ for (preamble = 0; preamble < segments.length; preamble++)
7251
+ flushSegment(request, destination, segments[preamble], null);
7252
+ }
7253
+ var preamble$jscomp$0 = request.renderState.preamble,
7254
+ headChunks$jscomp$0 = preamble$jscomp$0.headChunks;
7255
+ (preamble$jscomp$0.htmlChunks || headChunks$jscomp$0) &&
7026
7256
  writeChunk(destination, endChunkForTag("head"));
7257
+ var bodyChunks = preamble$jscomp$0.bodyChunks;
7258
+ if (bodyChunks)
7259
+ for (
7260
+ completedPreambleSegments = 0;
7261
+ completedPreambleSegments < bodyChunks.length;
7262
+ completedPreambleSegments++
7263
+ )
7264
+ writeChunk(destination, bodyChunks[completedPreambleSegments]);
7027
7265
  flushSegment(request, destination, completedRootSegment, null);
7028
7266
  request.completedRootSegment = null;
7029
7267
  writeBootstrap(destination, request.renderState);
@@ -7319,11 +7557,11 @@
7319
7557
  }
7320
7558
  function ensureCorrectIsomorphicReactVersion() {
7321
7559
  var isomorphicReactPackageVersion = React.version;
7322
- if ("19.1.0-canary-d46b04a2-20250117" !== isomorphicReactPackageVersion)
7560
+ if ("19.1.0-canary-18eaf51b-20250118" !== isomorphicReactPackageVersion)
7323
7561
  throw Error(
7324
7562
  'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' +
7325
7563
  (isomorphicReactPackageVersion +
7326
- "\n - react-dom: 19.1.0-canary-d46b04a2-20250117\nLearn more: https://react.dev/warnings/version-mismatch")
7564
+ "\n - react-dom: 19.1.0-canary-18eaf51b-20250118\nLearn more: https://react.dev/warnings/version-mismatch")
7327
7565
  );
7328
7566
  }
7329
7567
  var React = require("react"),
@@ -8426,12 +8664,13 @@
8426
8664
  var ROOT_HTML_MODE = 0,
8427
8665
  HTML_HTML_MODE = 1,
8428
8666
  HTML_MODE = 2,
8429
- SVG_MODE = 3,
8430
- MATHML_MODE = 4,
8431
- HTML_TABLE_MODE = 5,
8432
- HTML_TABLE_BODY_MODE = 6,
8433
- HTML_TABLE_ROW_MODE = 7,
8434
- HTML_COLGROUP_MODE = 8,
8667
+ HTML_HEAD_MODE = 3,
8668
+ SVG_MODE = 4,
8669
+ MATHML_MODE = 5,
8670
+ HTML_TABLE_MODE = 6,
8671
+ HTML_TABLE_BODY_MODE = 7,
8672
+ HTML_TABLE_ROW_MODE = 8,
8673
+ HTML_COLGROUP_MODE = 9,
8435
8674
  textSeparator = stringToPrecomputedChunk("\x3c!-- --\x3e"),
8436
8675
  styleNameCache = new Map(),
8437
8676
  styleAttributeStart = stringToPrecomputedChunk(' style="'),
@@ -8968,5 +9207,5 @@
8968
9207
  startWork(request);
8969
9208
  });
8970
9209
  };
8971
- exports.version = "19.1.0-canary-d46b04a2-20250117";
9210
+ exports.version = "19.1.0-canary-18eaf51b-20250118";
8972
9211
  })();