react-server-dom-turbopack 19.1.8 → 19.1.10

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.
@@ -47,31 +47,39 @@
47
47
  });
48
48
  }
49
49
  function writeChunkAndReturn(destination, chunk) {
50
- if (0 !== chunk.byteLength)
51
- if (2048 < chunk.byteLength)
52
- 0 < writtenBytes &&
53
- (destination.enqueue(
54
- new Uint8Array(currentView.buffer, 0, writtenBytes)
50
+ if (0 === chunk.byteLength)
51
+ if (supportsArrayBufferDetached) {
52
+ if (chunk.buffer.detached)
53
+ throw Error(
54
+ "Cannot transport a detached buffer. This usually happens when trying to transport multiple buffer-spanning views on the same underyling buffer. Either reuse the exact same view by identity or copy the underlying buffer manually via `view.slice()`."
55
+ );
56
+ } else
57
+ didWarnAboutMissingArrayBufferDetached ||
58
+ (console.error(
59
+ "React encountered an empty buffer when writing in an environment that does not support ArrayBuffer.prototype.detached. This could be a security issue if the buffer was not actually empty. Please use a modern Edge runtime that supports ArrayBuffer.prototype.detached."
55
60
  ),
56
- (currentView = new Uint8Array(2048)),
57
- (writtenBytes = 0)),
58
- destination.enqueue(chunk);
59
- else {
60
- var allowableBytes = currentView.length - writtenBytes;
61
- allowableBytes < chunk.byteLength &&
62
- (0 === allowableBytes
63
- ? destination.enqueue(currentView)
64
- : (currentView.set(
65
- chunk.subarray(0, allowableBytes),
66
- writtenBytes
67
- ),
68
- destination.enqueue(currentView),
69
- (chunk = chunk.subarray(allowableBytes))),
70
- (currentView = new Uint8Array(2048)),
71
- (writtenBytes = 0));
72
- currentView.set(chunk, writtenBytes);
73
- writtenBytes += chunk.byteLength;
74
- }
61
+ (didWarnAboutMissingArrayBufferDetached = !0));
62
+ else if (2048 < chunk.byteLength)
63
+ 0 < writtenBytes &&
64
+ (destination.enqueue(
65
+ new Uint8Array(currentView.buffer, 0, writtenBytes)
66
+ ),
67
+ (currentView = new Uint8Array(2048)),
68
+ (writtenBytes = 0)),
69
+ destination.enqueue(chunk);
70
+ else {
71
+ var allowableBytes = currentView.length - writtenBytes;
72
+ allowableBytes < chunk.byteLength &&
73
+ (0 === allowableBytes
74
+ ? destination.enqueue(currentView)
75
+ : (currentView.set(chunk.subarray(0, allowableBytes), writtenBytes),
76
+ destination.enqueue(currentView),
77
+ (chunk = chunk.subarray(allowableBytes))),
78
+ (currentView = new Uint8Array(2048)),
79
+ (writtenBytes = 0));
80
+ currentView.set(chunk, writtenBytes);
81
+ writtenBytes += chunk.byteLength;
82
+ }
75
83
  return !0;
76
84
  }
77
85
  function stringToChunk(content) {
@@ -253,13 +261,13 @@
253
261
  temporaryReferences.set(reference, id);
254
262
  return reference;
255
263
  }
256
- function noop$1() {}
264
+ function noop$2() {}
257
265
  function trackUsedThenable(thenableState, thenable, index) {
258
266
  index = thenableState[index];
259
267
  void 0 === index
260
268
  ? thenableState.push(thenable)
261
269
  : index !== thenable &&
262
- (thenable.then(noop$1, noop$1), (thenable = index));
270
+ (thenable.then(noop$2, noop$2), (thenable = index));
263
271
  switch (thenable.status) {
264
272
  case "fulfilled":
265
273
  return thenable.value;
@@ -267,7 +275,7 @@
267
275
  throw thenable.reason;
268
276
  default:
269
277
  "string" === typeof thenable.status
270
- ? thenable.then(noop$1, noop$1)
278
+ ? thenable.then(noop$2, noop$2)
271
279
  : ((thenableState = thenable),
272
280
  (thenableState.status = "pending"),
273
281
  thenableState.then(
@@ -711,7 +719,7 @@
711
719
  type = createTask(this, model, null, !1, abortSet, null, null, null);
712
720
  pingedTasks.push(type);
713
721
  }
714
- function noop() {}
722
+ function noop$1() {}
715
723
  function createRequest(
716
724
  model,
717
725
  bundlerConfig,
@@ -733,8 +741,8 @@
733
741
  temporaryReferences,
734
742
  environmentName,
735
743
  filterStackFrame,
736
- noop,
737
- noop
744
+ noop$1,
745
+ noop$1
738
746
  );
739
747
  }
740
748
  function createPrerenderRequest(
@@ -933,7 +941,7 @@
933
941
  erroredTask(request, streamTask, reason),
934
942
  enqueueFlush(request),
935
943
  "function" === typeof iterator.throw &&
936
- iterator.throw(reason).then(error, error));
944
+ iterator.throw(reason).then(noop$1, noop$1));
937
945
  }
938
946
  function abortIterable(reason) {
939
947
  aborted ||
@@ -942,7 +950,7 @@
942
950
  erroredTask(request, streamTask, reason),
943
951
  enqueueFlush(request),
944
952
  "function" === typeof iterator.throw &&
945
- iterator.throw(reason).then(error, error));
953
+ iterator.throw(reason).then(noop$1, noop$1));
946
954
  }
947
955
  var isIterator = iterable === iterator,
948
956
  streamTask = createTask(
@@ -2184,14 +2192,35 @@
2184
2192
  }
2185
2193
  function emitTypedArrayChunk(request, id, tag, typedArray) {
2186
2194
  request.pendingChunks++;
2187
- var buffer = new Uint8Array(
2188
- typedArray.buffer,
2189
- typedArray.byteOffset,
2190
- typedArray.byteLength
2191
- );
2192
- typedArray = 2048 < typedArray.byteLength ? buffer.slice() : buffer;
2193
- buffer = typedArray.byteLength;
2194
- id = id.toString(16) + ":" + tag + buffer.toString(16) + ",";
2195
+ a: {
2196
+ var view = new Uint8Array(
2197
+ typedArray.buffer,
2198
+ typedArray.byteOffset,
2199
+ typedArray.byteLength
2200
+ );
2201
+ if (2048 < typedArray.byteLength) {
2202
+ if (
2203
+ 0 !== typedArray.byteOffset ||
2204
+ typedArray.byteLength !== typedArray.buffer.byteLength ||
2205
+ typedArray.buffer.resizable
2206
+ ) {
2207
+ typedArray = view.slice();
2208
+ break a;
2209
+ }
2210
+ if (!supportsArrayBufferDetached) {
2211
+ didWarnAboutMissingArrayBufferDetached ||
2212
+ (console.error(
2213
+ "React copied a partial view into a fresh buffer as a safety precaution because the environment does not implement ArrayBuffer.prototype.detached. This negatively impacts performance. Please upgrade to a modern Edge runtime."
2214
+ ),
2215
+ (didWarnAboutMissingArrayBufferDetached = !0));
2216
+ typedArray = view.slice();
2217
+ break a;
2218
+ }
2219
+ }
2220
+ typedArray = view;
2221
+ }
2222
+ view = typedArray.byteLength;
2223
+ id = id.toString(16) + ":" + tag + view.toString(16) + ",";
2195
2224
  id = stringToChunk(id);
2196
2225
  request.completedRegularChunks.push(id, typedArray);
2197
2226
  }
@@ -2830,13 +2859,38 @@
2830
2859
  if (hasOwnProperty.call(moduleExports, metadata[2]))
2831
2860
  return moduleExports[metadata[2]];
2832
2861
  }
2833
- function appendBackingEntry(backingStore, key, value) {
2834
- backingStore.data.append(key, value);
2835
- value = backingStore.keys;
2836
- null === value
2837
- ? ((backingStore.keys = Array.from(backingStore.data.keys())),
2838
- (backingStore.keyPointer = 0))
2839
- : value.push(key);
2862
+ function appendBackingEntry(backingStore, value, key) {
2863
+ var prefix = backingStore.prefix;
2864
+ if (key.startsWith(prefix)) {
2865
+ switch (key[prefix.length]) {
2866
+ case "_":
2867
+ prefix = backingStore.referencedEntries;
2868
+ null === prefix && (prefix = backingStore.referencedEntries = []);
2869
+ prefix.push([key, value]);
2870
+ return;
2871
+ case "S":
2872
+ "string" === typeof value &&
2873
+ ((prefix = backingStore.streamChunks),
2874
+ null === prefix &&
2875
+ (prefix = backingStore.streamChunks = new Map()),
2876
+ (backingStore = prefix.get(key)),
2877
+ void 0 === backingStore
2878
+ ? prefix.set(key, [value])
2879
+ : backingStore.push(value));
2880
+ return;
2881
+ }
2882
+ "string" === typeof value
2883
+ ? ((prefix = backingStore.stringChunks),
2884
+ null === prefix && (prefix = backingStore.stringChunks = new Map()),
2885
+ prefix.set(key, value))
2886
+ : ((prefix = backingStore.blobs),
2887
+ null === prefix && (prefix = backingStore.blobs = new Map()),
2888
+ prefix.set(key, value));
2889
+ }
2890
+ }
2891
+ function getBackingBlob(backingStore, key) {
2892
+ backingStore = backingStore.blobs;
2893
+ return null === backingStore ? void 0 : backingStore.get(key);
2840
2894
  }
2841
2895
  function ReactPromise(status, value, reason) {
2842
2896
  this.status = status;
@@ -3149,9 +3203,11 @@
3149
3203
  function getChunk(response, id) {
3150
3204
  var chunks = response._chunks,
3151
3205
  chunk = chunks.get(id);
3152
- chunk ||
3153
- ((chunk = response._formData.data.get(response._prefix + id)),
3154
- (chunk =
3206
+ if (!chunk) {
3207
+ chunk = response._prefix;
3208
+ var stringChunks = response._formData.stringChunks;
3209
+ chunk = null === stringChunks ? void 0 : stringChunks.get(chunk + id);
3210
+ chunk =
3155
3211
  "string" === typeof chunk
3156
3212
  ? new ReactPromise(
3157
3213
  "resolved_model",
@@ -3160,8 +3216,9 @@
3160
3216
  )
3161
3217
  : response._closed
3162
3218
  ? new ReactPromise("rejected", null, response._closedReason)
3163
- : new ReactPromise("pending", null, null)),
3164
- chunks.set(id, chunk));
3219
+ : new ReactPromise("pending", null, null);
3220
+ chunks.set(id, chunk);
3221
+ }
3165
3222
  return chunk;
3166
3223
  }
3167
3224
  function fulfillReference(response, reference, value, arrayRoot) {
@@ -3408,7 +3465,7 @@
3408
3465
  Error("Already initialized typed array.")
3409
3466
  )
3410
3467
  );
3411
- reference = response._formData.data.get(key).arrayBuffer();
3468
+ reference = getBackingBlob(response._formData, key).arrayBuffer();
3412
3469
  if (initializingHandler) {
3413
3470
  var handler = initializingHandler;
3414
3471
  handler.deps++;
@@ -3452,15 +3509,17 @@
3452
3509
  var chunks = response._chunks;
3453
3510
  stream = new ReactPromise("fulfilled", stream, controller);
3454
3511
  chunks.set(id, stream);
3455
- response = response._formData.data.getAll(response._prefix + id);
3456
- for (id = 0; id < response.length; id++)
3457
- (chunks = response[id]),
3458
- "string" === typeof chunks &&
3459
- ("C" === chunks[0]
3512
+ chunks = response._prefix;
3513
+ response = response._formData.streamChunks;
3514
+ id = null === response ? void 0 : response.get(chunks + "S" + id);
3515
+ if (void 0 !== id)
3516
+ for (response = 0; response < id.length; response++)
3517
+ (chunks = id[response]),
3518
+ "C" === chunks[0]
3460
3519
  ? controller.close(
3461
3520
  "C" === chunks ? '"$undefined"' : chunks.slice(1)
3462
3521
  )
3463
- : controller.enqueueModel(chunks));
3522
+ : controller.enqueueModel(chunks);
3464
3523
  }
3465
3524
  function parseReadableStream(response, reference, type) {
3466
3525
  function enqueue(value) {
@@ -3624,7 +3683,14 @@
3624
3683
  });
3625
3684
  return iterator;
3626
3685
  }
3627
- function parseModelString(response, obj, key, value, reference, arrayRoot) {
3686
+ function parseModelString(
3687
+ response,
3688
+ obj,
3689
+ key$jscomp$0,
3690
+ value,
3691
+ reference,
3692
+ arrayRoot
3693
+ ) {
3628
3694
  if ("$" === value[0]) {
3629
3695
  switch (value[1]) {
3630
3696
  case "$":
@@ -3644,7 +3710,7 @@
3644
3710
  response,
3645
3711
  arrayRoot,
3646
3712
  obj,
3647
- key,
3713
+ key$jscomp$0,
3648
3714
  null,
3649
3715
  loadServerReference$1
3650
3716
  )
@@ -3664,41 +3730,44 @@
3664
3730
  case "Q":
3665
3731
  return (
3666
3732
  (arrayRoot = value.slice(2)),
3667
- getOutlinedModel(response, arrayRoot, obj, key, null, createMap)
3733
+ getOutlinedModel(
3734
+ response,
3735
+ arrayRoot,
3736
+ obj,
3737
+ key$jscomp$0,
3738
+ null,
3739
+ createMap
3740
+ )
3668
3741
  );
3669
3742
  case "W":
3670
3743
  return (
3671
3744
  (arrayRoot = value.slice(2)),
3672
- getOutlinedModel(response, arrayRoot, obj, key, null, createSet)
3745
+ getOutlinedModel(
3746
+ response,
3747
+ arrayRoot,
3748
+ obj,
3749
+ key$jscomp$0,
3750
+ null,
3751
+ createSet
3752
+ )
3673
3753
  );
3674
3754
  case "K":
3675
- key = value.slice(2);
3676
- obj = response._prefix + "_";
3677
- key = obj + key + "_";
3678
- arrayRoot = new FormData();
3679
- for (response = response._formData; ; ) {
3680
- value = response;
3681
- reference = value.keys;
3682
- null === reference &&
3683
- ((reference = value.keys = Array.from(value.data.keys())),
3684
- (value.keyPointer = 0));
3685
- value = reference[value.keyPointer];
3686
- if (void 0 === value) break;
3687
- if (value.startsWith(key)) {
3688
- reference = response.data.getAll(value);
3689
- for (
3690
- var referencedFormDataKey = value.slice(key.length), i = 0;
3691
- i < reference.length;
3692
- i++
3693
- )
3694
- arrayRoot.append(referencedFormDataKey, reference[i]);
3695
- reference = response;
3696
- reference.data.delete(value);
3697
- reference.keyPointer++;
3698
- } else if (value.startsWith(obj)) break;
3699
- else response.keyPointer++;
3755
+ key$jscomp$0 = value.slice(2);
3756
+ obj = response._formData;
3757
+ response = response._prefix + "_" + key$jscomp$0 + "_";
3758
+ key$jscomp$0 = new FormData();
3759
+ arrayRoot = obj.referencedEntries;
3760
+ if (null !== arrayRoot) {
3761
+ for (value = obj.keyPointer; value < arrayRoot.length; ) {
3762
+ reference = arrayRoot[value];
3763
+ var key = reference[0];
3764
+ if (!key.startsWith(response)) break;
3765
+ key$jscomp$0.append(key.slice(response.length), reference[1]);
3766
+ value++;
3767
+ }
3768
+ obj.keyPointer = value;
3700
3769
  }
3701
- return arrayRoot;
3770
+ return key$jscomp$0;
3702
3771
  case "i":
3703
3772
  return (
3704
3773
  (arrayRoot = value.slice(2)),
@@ -3706,7 +3775,7 @@
3706
3775
  response,
3707
3776
  arrayRoot,
3708
3777
  obj,
3709
- key,
3778
+ key$jscomp$0,
3710
3779
  null,
3711
3780
  extractIterator
3712
3781
  )
@@ -3741,7 +3810,7 @@
3741
3810
  ArrayBuffer,
3742
3811
  1,
3743
3812
  obj,
3744
- key,
3813
+ key$jscomp$0,
3745
3814
  arrayRoot
3746
3815
  );
3747
3816
  case "O":
@@ -3751,7 +3820,7 @@
3751
3820
  Int8Array,
3752
3821
  1,
3753
3822
  obj,
3754
- key,
3823
+ key$jscomp$0,
3755
3824
  arrayRoot
3756
3825
  );
3757
3826
  case "o":
@@ -3761,7 +3830,7 @@
3761
3830
  Uint8Array,
3762
3831
  1,
3763
3832
  obj,
3764
- key,
3833
+ key$jscomp$0,
3765
3834
  arrayRoot
3766
3835
  );
3767
3836
  case "U":
@@ -3771,7 +3840,7 @@
3771
3840
  Uint8ClampedArray,
3772
3841
  1,
3773
3842
  obj,
3774
- key,
3843
+ key$jscomp$0,
3775
3844
  arrayRoot
3776
3845
  );
3777
3846
  case "S":
@@ -3781,7 +3850,7 @@
3781
3850
  Int16Array,
3782
3851
  2,
3783
3852
  obj,
3784
- key,
3853
+ key$jscomp$0,
3785
3854
  arrayRoot
3786
3855
  );
3787
3856
  case "s":
@@ -3791,7 +3860,7 @@
3791
3860
  Uint16Array,
3792
3861
  2,
3793
3862
  obj,
3794
- key,
3863
+ key$jscomp$0,
3795
3864
  arrayRoot
3796
3865
  );
3797
3866
  case "L":
@@ -3801,7 +3870,7 @@
3801
3870
  Int32Array,
3802
3871
  4,
3803
3872
  obj,
3804
- key,
3873
+ key$jscomp$0,
3805
3874
  arrayRoot
3806
3875
  );
3807
3876
  case "l":
@@ -3811,7 +3880,7 @@
3811
3880
  Uint32Array,
3812
3881
  4,
3813
3882
  obj,
3814
- key,
3883
+ key$jscomp$0,
3815
3884
  arrayRoot
3816
3885
  );
3817
3886
  case "G":
@@ -3821,7 +3890,7 @@
3821
3890
  Float32Array,
3822
3891
  4,
3823
3892
  obj,
3824
- key,
3893
+ key$jscomp$0,
3825
3894
  arrayRoot
3826
3895
  );
3827
3896
  case "g":
@@ -3831,7 +3900,7 @@
3831
3900
  Float64Array,
3832
3901
  8,
3833
3902
  obj,
3834
- key,
3903
+ key$jscomp$0,
3835
3904
  arrayRoot
3836
3905
  );
3837
3906
  case "M":
@@ -3841,7 +3910,7 @@
3841
3910
  BigInt64Array,
3842
3911
  8,
3843
3912
  obj,
3844
- key,
3913
+ key$jscomp$0,
3845
3914
  arrayRoot
3846
3915
  );
3847
3916
  case "m":
@@ -3851,7 +3920,7 @@
3851
3920
  BigUint64Array,
3852
3921
  8,
3853
3922
  obj,
3854
- key,
3923
+ key$jscomp$0,
3855
3924
  arrayRoot
3856
3925
  );
3857
3926
  case "V":
@@ -3861,13 +3930,13 @@
3861
3930
  DataView,
3862
3931
  1,
3863
3932
  obj,
3864
- key,
3933
+ key$jscomp$0,
3865
3934
  arrayRoot
3866
3935
  );
3867
3936
  case "B":
3868
3937
  return (
3869
3938
  (obj = parseInt(value.slice(2), 16)),
3870
- response._formData.data.get(response._prefix + obj)
3939
+ getBackingBlob(response._formData, response._prefix + obj)
3871
3940
  );
3872
3941
  case "R":
3873
3942
  return parseReadableStream(response, value, void 0);
@@ -3883,7 +3952,7 @@
3883
3952
  response,
3884
3953
  value,
3885
3954
  obj,
3886
- key,
3955
+ key$jscomp$0,
3887
3956
  arrayRoot,
3888
3957
  createModel
3889
3958
  );
@@ -3902,11 +3971,20 @@
3902
3971
  : new FormData(),
3903
3972
  arraySizeLimit =
3904
3973
  4 < arguments.length && void 0 !== arguments[4] ? arguments[4] : 1e6,
3905
- chunks = new Map();
3974
+ chunks = new Map(),
3975
+ backingStore = {
3976
+ prefix: formFieldPrefix,
3977
+ referencedEntries: null,
3978
+ keyPointer: 0,
3979
+ stringChunks: null,
3980
+ streamChunks: null,
3981
+ blobs: null
3982
+ };
3983
+ backingFormData.forEach(appendBackingEntry.bind(null, backingStore));
3906
3984
  return {
3907
3985
  _bundlerConfig: bundlerConfig,
3908
3986
  _prefix: formFieldPrefix,
3909
- _formData: { data: backingFormData, keyPointer: -1, keys: null },
3987
+ _formData: backingStore,
3910
3988
  _chunks: chunks,
3911
3989
  _closed: !1,
3912
3990
  _closedReason: null,
@@ -3963,6 +4041,7 @@
3963
4041
  if ("fulfilled" !== body.status) throw body.reason;
3964
4042
  return body.value;
3965
4043
  }
4044
+ function noop() {}
3966
4045
  var ReactDOM = require("react-dom"),
3967
4046
  React = require("react"),
3968
4047
  REACT_LEGACY_ELEMENT_TYPE = Symbol.for("react.element"),
@@ -3978,6 +4057,12 @@
3978
4057
  Symbol.for("react.postpone");
3979
4058
  var MAYBE_ITERATOR_SYMBOL = Symbol.iterator,
3980
4059
  ASYNC_ITERATOR = Symbol.asyncIterator,
4060
+ hasOwnProperty = Object.prototype.hasOwnProperty,
4061
+ supportsArrayBufferDetached = hasOwnProperty.call(
4062
+ ArrayBuffer.prototype,
4063
+ "detached"
4064
+ ),
4065
+ didWarnAboutMissingArrayBufferDetached = !1,
3981
4066
  LocalPromise = Promise,
3982
4067
  scheduleMicrotask =
3983
4068
  "function" === typeof queueMicrotask
@@ -4423,7 +4508,6 @@
4423
4508
  debugID = null,
4424
4509
  modelRoot = !1,
4425
4510
  emptyRoot = {},
4426
- hasOwnProperty = Object.prototype.hasOwnProperty,
4427
4511
  chunkCache = new Map(),
4428
4512
  RESPONSE_SYMBOL = Symbol();
4429
4513
  ReactPromise.prototype = Object.create(Promise.prototype);
@@ -4491,44 +4575,44 @@
4491
4575
  };
4492
4576
  exports.decodeAction = function (body, serverManifest) {
4493
4577
  var formData = new FormData(),
4494
- action = null,
4495
- seenActions = new Set();
4578
+ maybeActionKey = null;
4496
4579
  body.forEach(function (value, key) {
4497
4580
  key.startsWith("$ACTION_")
4498
4581
  ? key.startsWith("$ACTION_REF_")
4499
- ? seenActions.has(key) ||
4500
- (seenActions.add(key),
4501
- (value = "$ACTION_" + key.slice(12) + ":"),
4502
- (value = decodeBoundActionMetaData(body, serverManifest, value)),
4503
- (action = loadServerReference(serverManifest, value)))
4504
- : key.startsWith("$ACTION_ID_") &&
4505
- !seenActions.has(key) &&
4506
- (seenActions.add(key),
4507
- (value = key.slice(11)),
4508
- (action = loadServerReference(serverManifest, {
4509
- id: value,
4510
- bound: null
4511
- })))
4582
+ ? (maybeActionKey = key)
4583
+ : key.startsWith("$ACTION_ID_") && (maybeActionKey = key)
4512
4584
  : formData.append(key, value);
4513
4585
  });
4514
- return null === action
4515
- ? null
4516
- : action.then(function (fn) {
4517
- return fn.bind(null, formData);
4518
- });
4586
+ if (null === maybeActionKey) return null;
4587
+ var actionKey = maybeActionKey,
4588
+ action = null;
4589
+ if (actionKey.startsWith("$ACTION_REF_"))
4590
+ (actionKey = "$ACTION_" + actionKey.slice(12) + ":"),
4591
+ (body = decodeBoundActionMetaData(body, serverManifest, actionKey)),
4592
+ (action = loadServerReference(serverManifest, body));
4593
+ else if (actionKey.startsWith("$ACTION_ID_"))
4594
+ (body = actionKey.slice(11)),
4595
+ (action = loadServerReference(serverManifest, {
4596
+ id: body,
4597
+ bound: null
4598
+ }));
4599
+ else throw Error("Cannot handle action key. This is a bug in React.");
4600
+ return action.then(function (fn) {
4601
+ return fn.bind(null, formData);
4602
+ });
4519
4603
  };
4520
4604
  exports.decodeFormState = function (actionResult, body, serverManifest) {
4521
4605
  var keyPath = body.get("$ACTION_KEY");
4522
4606
  if ("string" !== typeof keyPath) return Promise.resolve(null);
4523
- var metaData = null;
4607
+ var actionKey = null;
4524
4608
  body.forEach(function (value, key) {
4525
- key.startsWith("$ACTION_REF_") &&
4526
- ((value = "$ACTION_" + key.slice(12) + ":"),
4527
- (metaData = decodeBoundActionMetaData(body, serverManifest, value)));
4609
+ key.startsWith("$ACTION_REF_") && (actionKey = key);
4528
4610
  });
4529
- if (null === metaData) return Promise.resolve(null);
4530
- var referenceId = metaData.id;
4531
- return Promise.resolve(metaData.bound).then(function (bound) {
4611
+ if (null === actionKey) return Promise.resolve(null);
4612
+ var formFieldPrefix = "$ACTION_" + actionKey.slice(12) + ":";
4613
+ body = decodeBoundActionMetaData(body, serverManifest, formFieldPrefix);
4614
+ var referenceId = body.id;
4615
+ return Promise.resolve(body.bound).then(function (bound) {
4532
4616
  return null === bound
4533
4617
  ? null
4534
4618
  : [actionResult, keyPath, referenceId, bound.length - 1];
@@ -4559,27 +4643,47 @@
4559
4643
  function progress(entry) {
4560
4644
  if (entry.done) close(response$jscomp$0);
4561
4645
  else {
4562
- entry = entry.value;
4563
- var name = entry[0];
4564
- entry = entry[1];
4565
- if ("string" === typeof entry) {
4566
- var response = response$jscomp$0;
4567
- appendBackingEntry(response._formData, name, entry);
4568
- var prefix = response._prefix;
4569
- if (name.startsWith(prefix)) {
4570
- var chunks = response._chunks;
4571
- name = +name.slice(prefix.length);
4572
- (chunks = chunks.get(name)) &&
4573
- resolveModelChunk(response, chunks, entry, name);
4646
+ var _entry$value = entry.value;
4647
+ entry = _entry$value[0];
4648
+ _entry$value = _entry$value[1];
4649
+ if ("string" === typeof _entry$value)
4650
+ a: {
4651
+ var response = response$jscomp$0,
4652
+ prefix = response._prefix;
4653
+ if (entry.startsWith(prefix)) {
4654
+ var chunks = response._chunks;
4655
+ if ("S" === entry[prefix.length]) {
4656
+ if (
4657
+ entry.length > prefix.length + 1 &&
4658
+ ((prefix = +entry.slice(prefix.length + 1)),
4659
+ (chunks = chunks.get(prefix)))
4660
+ ) {
4661
+ resolveModelChunk(response, chunks, _entry$value, prefix);
4662
+ break a;
4663
+ }
4664
+ } else if (
4665
+ ((prefix = +entry.slice(prefix.length)),
4666
+ (chunks = chunks.get(prefix)))
4667
+ ) {
4668
+ resolveModelChunk(response, chunks, _entry$value, prefix);
4669
+ break a;
4670
+ }
4671
+ }
4672
+ appendBackingEntry(response._formData, _entry$value, entry);
4574
4673
  }
4575
- } else appendBackingEntry(response$jscomp$0._formData, name, entry);
4674
+ else
4675
+ appendBackingEntry(
4676
+ response$jscomp$0._formData,
4677
+ _entry$value,
4678
+ entry
4679
+ );
4576
4680
  iterator.next().then(progress, error);
4577
4681
  }
4578
4682
  }
4579
4683
  function error(reason) {
4580
4684
  reportGlobalError(response$jscomp$0, reason);
4581
4685
  "function" === typeof iterator.throw &&
4582
- iterator.throw(reason).then(error, error);
4686
+ iterator.throw(reason).then(noop, noop);
4583
4687
  }
4584
4688
  var iterator = iterable[ASYNC_ITERATOR](),
4585
4689
  response$jscomp$0 = createResponse(