react-server-dom-webpack 19.2.7 → 19.2.9

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.
@@ -14,8 +14,9 @@ var stream = require("stream"),
14
14
  require("crypto");
15
15
  var async_hooks = require("async_hooks"),
16
16
  ReactDOM = require("react-dom"),
17
- React = require("react"),
18
- REACT_LEGACY_ELEMENT_TYPE = Symbol.for("react.element"),
17
+ React = require("react");
18
+ function noop() {}
19
+ var REACT_LEGACY_ELEMENT_TYPE = Symbol.for("react.element"),
19
20
  REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"),
20
21
  REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"),
21
22
  REACT_CONTEXT_TYPE = Symbol.for("react.context"),
@@ -35,6 +36,11 @@ function getIteratorFn(maybeIterable) {
35
36
  return "function" === typeof maybeIterable ? maybeIterable : null;
36
37
  }
37
38
  var ASYNC_ITERATOR = Symbol.asyncIterator,
39
+ hasOwnProperty = Object.prototype.hasOwnProperty,
40
+ supportsArrayBufferDetached = hasOwnProperty.call(
41
+ ArrayBuffer.prototype,
42
+ "detached"
43
+ ),
38
44
  scheduleMicrotask = queueMicrotask,
39
45
  currentView = null,
40
46
  writtenBytes = 0,
@@ -76,33 +82,37 @@ function writeChunkAndReturn(destination, chunk) {
76
82
  (currentView = new Uint8Array(2048)),
77
83
  (writtenBytes = 0));
78
84
  }
85
+ } else if (0 === chunk.byteLength) {
86
+ if (supportsArrayBufferDetached && chunk.buffer.detached)
87
+ throw Error(
88
+ "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()`."
89
+ );
79
90
  } else
80
- 0 !== chunk.byteLength &&
81
- (2048 < chunk.byteLength
82
- ? (0 < writtenBytes &&
83
- (writeToDestination(
84
- destination,
85
- currentView.subarray(0, writtenBytes)
86
- ),
87
- (currentView = new Uint8Array(2048)),
88
- (writtenBytes = 0)),
89
- writeToDestination(destination, chunk))
90
- : ((target = currentView.length - writtenBytes),
91
- target < chunk.byteLength &&
92
- (0 === target
93
- ? writeToDestination(destination, currentView)
94
- : (currentView.set(chunk.subarray(0, target), writtenBytes),
95
- (writtenBytes += target),
96
- writeToDestination(destination, currentView),
97
- (chunk = chunk.subarray(target))),
98
- (currentView = new Uint8Array(2048)),
99
- (writtenBytes = 0)),
100
- currentView.set(chunk, writtenBytes),
101
- (writtenBytes += chunk.byteLength),
102
- 2048 === writtenBytes &&
103
- (writeToDestination(destination, currentView),
104
- (currentView = new Uint8Array(2048)),
105
- (writtenBytes = 0))));
91
+ 2048 < chunk.byteLength
92
+ ? (0 < writtenBytes &&
93
+ (writeToDestination(
94
+ destination,
95
+ currentView.subarray(0, writtenBytes)
96
+ ),
97
+ (currentView = new Uint8Array(2048)),
98
+ (writtenBytes = 0)),
99
+ writeToDestination(destination, chunk))
100
+ : ((target = currentView.length - writtenBytes),
101
+ target < chunk.byteLength &&
102
+ (0 === target
103
+ ? writeToDestination(destination, currentView)
104
+ : (currentView.set(chunk.subarray(0, target), writtenBytes),
105
+ (writtenBytes += target),
106
+ writeToDestination(destination, currentView),
107
+ (chunk = chunk.subarray(target))),
108
+ (currentView = new Uint8Array(2048)),
109
+ (writtenBytes = 0)),
110
+ currentView.set(chunk, writtenBytes),
111
+ (writtenBytes += chunk.byteLength),
112
+ 2048 === writtenBytes &&
113
+ (writeToDestination(destination, currentView),
114
+ (currentView = new Uint8Array(2048)),
115
+ (writtenBytes = 0)));
106
116
  return destinationHasCapacity;
107
117
  }
108
118
  var textEncoder = new util.TextEncoder();
@@ -575,7 +585,6 @@ function createTemporaryReference(temporaryReferences, id) {
575
585
  temporaryReferences.set(reference, id);
576
586
  return reference;
577
587
  }
578
- function noop() {}
579
588
  var SuspenseException = Error(
580
589
  "Suspense Exception: This is not a real error! It's an implementation detail of `use` to interrupt the current render. You must either rethrow it immediately, or move the `use` call outside of the `try/catch` block. Capturing without rethrowing will lead to unexpected behavior.\n\nTo handle async errors, wrap your component in an error boundary, or call the promise's `.catch` method and pass the result to `use`."
581
590
  );
@@ -840,8 +849,7 @@ function describeObjectForErrorMessage(objectOrArray, expandedName) {
840
849
  "\n " + str + "\n " + objectOrArray)
841
850
  : "\n " + str;
842
851
  }
843
- var hasOwnProperty = Object.prototype.hasOwnProperty,
844
- ObjectPrototype$1 = Object.prototype,
852
+ var ObjectPrototype$1 = Object.prototype,
845
853
  stringify = JSON.stringify;
846
854
  function defaultErrorHandler(error) {
847
855
  console.error(error);
@@ -1074,7 +1082,7 @@ function serializeAsyncIterable(request, task, iterable, iterator) {
1074
1082
  erroredTask(request, streamTask, reason),
1075
1083
  enqueueFlush(request),
1076
1084
  "function" === typeof iterator.throw &&
1077
- iterator.throw(reason).then(error, error));
1085
+ iterator.throw(reason).then(noop, noop));
1078
1086
  }
1079
1087
  function abortIterable() {
1080
1088
  if (0 === streamTask.status) {
@@ -1088,7 +1096,7 @@ function serializeAsyncIterable(request, task, iterable, iterator) {
1088
1096
  : (erroredTask(request, streamTask, signal.reason),
1089
1097
  enqueueFlush(request));
1090
1098
  "function" === typeof iterator.throw &&
1091
- iterator.throw(reason).then(error, error);
1099
+ iterator.throw(reason).then(noop, noop);
1092
1100
  }
1093
1101
  }
1094
1102
  iterable = iterable === iterator;
@@ -1857,11 +1865,28 @@ function emitErrorChunk(request, id, digest) {
1857
1865
  }
1858
1866
  function emitTypedArrayChunk(request, id, tag, typedArray, debug) {
1859
1867
  debug ? request.pendingDebugChunks++ : request.pendingChunks++;
1860
- typedArray = new Uint8Array(
1861
- typedArray.buffer,
1862
- typedArray.byteOffset,
1863
- typedArray.byteLength
1864
- );
1868
+ a: {
1869
+ debug = new Uint8Array(
1870
+ typedArray.buffer,
1871
+ typedArray.byteOffset,
1872
+ typedArray.byteLength
1873
+ );
1874
+ if (2048 < typedArray.byteLength) {
1875
+ if (
1876
+ 0 !== typedArray.byteOffset ||
1877
+ typedArray.byteLength !== typedArray.buffer.byteLength ||
1878
+ typedArray.buffer.resizable
1879
+ ) {
1880
+ typedArray = debug.slice();
1881
+ break a;
1882
+ }
1883
+ if (!supportsArrayBufferDetached) {
1884
+ typedArray = debug.slice();
1885
+ break a;
1886
+ }
1887
+ }
1888
+ typedArray = debug;
1889
+ }
1865
1890
  debug = typedArray.byteLength;
1866
1891
  id = id.toString(16) + ":" + tag + debug.toString(16) + ",";
1867
1892
  request.completedRegularChunks.push(id, typedArray);
@@ -2277,13 +2302,37 @@ function requireModule(metadata) {
2277
2302
  if (hasOwnProperty.call(moduleExports, metadata[2]))
2278
2303
  return moduleExports[metadata[2]];
2279
2304
  }
2280
- function appendBackingEntry(backingStore, key, value) {
2281
- backingStore.data.append(key, value);
2282
- value = backingStore.keys;
2283
- null === value
2284
- ? ((backingStore.keys = Array.from(backingStore.data.keys())),
2285
- (backingStore.keyPointer = 0))
2286
- : value.push(key);
2305
+ function appendBackingEntry(backingStore, value, key) {
2306
+ var prefix = backingStore.prefix;
2307
+ if (key.startsWith(prefix)) {
2308
+ switch (key[prefix.length]) {
2309
+ case "_":
2310
+ prefix = backingStore.referencedEntries;
2311
+ null === prefix && (prefix = backingStore.referencedEntries = []);
2312
+ prefix.push([key, value]);
2313
+ return;
2314
+ case "S":
2315
+ "string" === typeof value &&
2316
+ ((prefix = backingStore.streamChunks),
2317
+ null === prefix && (prefix = backingStore.streamChunks = new Map()),
2318
+ (backingStore = prefix.get(key)),
2319
+ void 0 === backingStore
2320
+ ? prefix.set(key, [value])
2321
+ : backingStore.push(value));
2322
+ return;
2323
+ }
2324
+ "string" === typeof value
2325
+ ? ((prefix = backingStore.stringChunks),
2326
+ null === prefix && (prefix = backingStore.stringChunks = new Map()),
2327
+ prefix.set(key, value))
2328
+ : ((prefix = backingStore.blobs),
2329
+ null === prefix && (prefix = backingStore.blobs = new Map()),
2330
+ prefix.set(key, value));
2331
+ }
2332
+ }
2333
+ function getBackingBlob(backingStore, key) {
2334
+ backingStore = backingStore.blobs;
2335
+ return null === backingStore ? void 0 : backingStore.get(key);
2287
2336
  }
2288
2337
  var RESPONSE_SYMBOL = Symbol();
2289
2338
  function ReactPromise(status, value, reason) {
@@ -2656,15 +2705,18 @@ function reportGlobalError(response, error) {
2656
2705
  function getChunk(response, id) {
2657
2706
  var chunks = response._chunks,
2658
2707
  chunk = chunks.get(id);
2659
- chunk ||
2660
- ((chunk = response._formData.data.get(response._prefix + id)),
2661
- (chunk =
2708
+ if (!chunk) {
2709
+ chunk = response._prefix;
2710
+ var stringChunks = response._formData.stringChunks;
2711
+ chunk = null === stringChunks ? void 0 : stringChunks.get(chunk + id);
2712
+ chunk =
2662
2713
  "string" === typeof chunk
2663
2714
  ? createResolvedModelChunk(response, chunk, id)
2664
2715
  : response._closed
2665
2716
  ? new ReactPromise("rejected", null, response._closedReason)
2666
- : new ReactPromise("pending", null, null)),
2667
- chunks.set(id, chunk));
2717
+ : new ReactPromise("pending", null, null);
2718
+ chunks.set(id, chunk);
2719
+ }
2668
2720
  return chunk;
2669
2721
  }
2670
2722
  function fulfillReference(response, reference, value, arrayRoot) {
@@ -2895,7 +2947,7 @@ function parseTypedArray(
2895
2947
  Error("Already initialized typed array.")
2896
2948
  )
2897
2949
  );
2898
- reference = response._formData.data.get(key).arrayBuffer();
2950
+ reference = getBackingBlob(response._formData, key).arrayBuffer();
2899
2951
  if (initializingHandler) {
2900
2952
  var handler = initializingHandler;
2901
2953
  handler.deps++;
@@ -2939,13 +2991,15 @@ function resolveStream(response, id, stream, controller) {
2939
2991
  var chunks = response._chunks;
2940
2992
  stream = new ReactPromise("fulfilled", stream, controller);
2941
2993
  chunks.set(id, stream);
2942
- response = response._formData.data.getAll(response._prefix + id);
2943
- for (id = 0; id < response.length; id++)
2944
- (chunks = response[id]),
2945
- "string" === typeof chunks &&
2946
- ("C" === chunks[0]
2994
+ chunks = response._prefix;
2995
+ response = response._formData.streamChunks;
2996
+ id = null === response ? void 0 : response.get(chunks + "S" + id);
2997
+ if (void 0 !== id)
2998
+ for (response = 0; response < id.length; response++)
2999
+ (chunks = id[response]),
3000
+ "C" === chunks[0]
2947
3001
  ? controller.close("C" === chunks ? '"$undefined"' : chunks.slice(1))
2948
- : controller.enqueueModel(chunks));
3002
+ : controller.enqueueModel(chunks);
2949
3003
  }
2950
3004
  function parseReadableStream(response, reference, type) {
2951
3005
  function enqueue(value) {
@@ -3111,7 +3165,14 @@ function parseAsyncIterable(response, reference, iterator) {
3111
3165
  });
3112
3166
  return iterator;
3113
3167
  }
3114
- function parseModelString(response, obj, key, value, reference, arrayRoot) {
3168
+ function parseModelString(
3169
+ response,
3170
+ obj,
3171
+ key$jscomp$0,
3172
+ value,
3173
+ reference,
3174
+ arrayRoot
3175
+ ) {
3115
3176
  if ("$" === value[0]) {
3116
3177
  switch (value[1]) {
3117
3178
  case "$":
@@ -3129,7 +3190,7 @@ function parseModelString(response, obj, key, value, reference, arrayRoot) {
3129
3190
  response,
3130
3191
  arrayRoot,
3131
3192
  obj,
3132
- key,
3193
+ key$jscomp$0,
3133
3194
  null,
3134
3195
  loadServerReference$1
3135
3196
  )
@@ -3146,43 +3207,55 @@ function parseModelString(response, obj, key, value, reference, arrayRoot) {
3146
3207
  case "Q":
3147
3208
  return (
3148
3209
  (arrayRoot = value.slice(2)),
3149
- getOutlinedModel(response, arrayRoot, obj, key, null, createMap)
3210
+ getOutlinedModel(
3211
+ response,
3212
+ arrayRoot,
3213
+ obj,
3214
+ key$jscomp$0,
3215
+ null,
3216
+ createMap
3217
+ )
3150
3218
  );
3151
3219
  case "W":
3152
3220
  return (
3153
3221
  (arrayRoot = value.slice(2)),
3154
- getOutlinedModel(response, arrayRoot, obj, key, null, createSet)
3222
+ getOutlinedModel(
3223
+ response,
3224
+ arrayRoot,
3225
+ obj,
3226
+ key$jscomp$0,
3227
+ null,
3228
+ createSet
3229
+ )
3155
3230
  );
3156
3231
  case "K":
3157
- key = value.slice(2);
3158
- obj = response._prefix + "_";
3159
- key = obj + key + "_";
3160
- arrayRoot = new FormData();
3161
- for (response = response._formData; ; ) {
3162
- value = response.keys;
3163
- null === value &&
3164
- ((value = response.keys = Array.from(response.data.keys())),
3165
- (response.keyPointer = 0));
3166
- value = value[response.keyPointer];
3167
- if (void 0 === value) break;
3168
- if (value.startsWith(key)) {
3169
- reference = response.data.getAll(value);
3170
- for (
3171
- var referencedFormDataKey = value.slice(key.length), i = 0;
3172
- i < reference.length;
3173
- i++
3174
- )
3175
- arrayRoot.append(referencedFormDataKey, reference[i]);
3176
- response.data.delete(value);
3177
- response.keyPointer++;
3178
- } else if (value.startsWith(obj)) break;
3179
- else response.keyPointer++;
3232
+ obj = value.slice(2);
3233
+ obj = response._prefix + "_" + obj + "_";
3234
+ response = response._formData;
3235
+ key$jscomp$0 = new FormData();
3236
+ arrayRoot = response.referencedEntries;
3237
+ if (null !== arrayRoot) {
3238
+ for (value = response.keyPointer; value < arrayRoot.length; ) {
3239
+ reference = arrayRoot[value];
3240
+ var key = reference[0];
3241
+ if (!key.startsWith(obj)) break;
3242
+ key$jscomp$0.append(key.slice(obj.length), reference[1]);
3243
+ value++;
3244
+ }
3245
+ response.keyPointer = value;
3180
3246
  }
3181
- return arrayRoot;
3247
+ return key$jscomp$0;
3182
3248
  case "i":
3183
3249
  return (
3184
3250
  (arrayRoot = value.slice(2)),
3185
- getOutlinedModel(response, arrayRoot, obj, key, null, extractIterator)
3251
+ getOutlinedModel(
3252
+ response,
3253
+ arrayRoot,
3254
+ obj,
3255
+ key$jscomp$0,
3256
+ null,
3257
+ extractIterator
3258
+ )
3186
3259
  );
3187
3260
  case "I":
3188
3261
  return Infinity;
@@ -3211,7 +3284,7 @@ function parseModelString(response, obj, key, value, reference, arrayRoot) {
3211
3284
  ArrayBuffer,
3212
3285
  1,
3213
3286
  obj,
3214
- key,
3287
+ key$jscomp$0,
3215
3288
  arrayRoot
3216
3289
  );
3217
3290
  case "O":
@@ -3221,7 +3294,7 @@ function parseModelString(response, obj, key, value, reference, arrayRoot) {
3221
3294
  Int8Array,
3222
3295
  1,
3223
3296
  obj,
3224
- key,
3297
+ key$jscomp$0,
3225
3298
  arrayRoot
3226
3299
  );
3227
3300
  case "o":
@@ -3231,7 +3304,7 @@ function parseModelString(response, obj, key, value, reference, arrayRoot) {
3231
3304
  Uint8Array,
3232
3305
  1,
3233
3306
  obj,
3234
- key,
3307
+ key$jscomp$0,
3235
3308
  arrayRoot
3236
3309
  );
3237
3310
  case "U":
@@ -3241,7 +3314,7 @@ function parseModelString(response, obj, key, value, reference, arrayRoot) {
3241
3314
  Uint8ClampedArray,
3242
3315
  1,
3243
3316
  obj,
3244
- key,
3317
+ key$jscomp$0,
3245
3318
  arrayRoot
3246
3319
  );
3247
3320
  case "S":
@@ -3251,7 +3324,7 @@ function parseModelString(response, obj, key, value, reference, arrayRoot) {
3251
3324
  Int16Array,
3252
3325
  2,
3253
3326
  obj,
3254
- key,
3327
+ key$jscomp$0,
3255
3328
  arrayRoot
3256
3329
  );
3257
3330
  case "s":
@@ -3261,7 +3334,7 @@ function parseModelString(response, obj, key, value, reference, arrayRoot) {
3261
3334
  Uint16Array,
3262
3335
  2,
3263
3336
  obj,
3264
- key,
3337
+ key$jscomp$0,
3265
3338
  arrayRoot
3266
3339
  );
3267
3340
  case "L":
@@ -3271,7 +3344,7 @@ function parseModelString(response, obj, key, value, reference, arrayRoot) {
3271
3344
  Int32Array,
3272
3345
  4,
3273
3346
  obj,
3274
- key,
3347
+ key$jscomp$0,
3275
3348
  arrayRoot
3276
3349
  );
3277
3350
  case "l":
@@ -3281,7 +3354,7 @@ function parseModelString(response, obj, key, value, reference, arrayRoot) {
3281
3354
  Uint32Array,
3282
3355
  4,
3283
3356
  obj,
3284
- key,
3357
+ key$jscomp$0,
3285
3358
  arrayRoot
3286
3359
  );
3287
3360
  case "G":
@@ -3291,7 +3364,7 @@ function parseModelString(response, obj, key, value, reference, arrayRoot) {
3291
3364
  Float32Array,
3292
3365
  4,
3293
3366
  obj,
3294
- key,
3367
+ key$jscomp$0,
3295
3368
  arrayRoot
3296
3369
  );
3297
3370
  case "g":
@@ -3301,7 +3374,7 @@ function parseModelString(response, obj, key, value, reference, arrayRoot) {
3301
3374
  Float64Array,
3302
3375
  8,
3303
3376
  obj,
3304
- key,
3377
+ key$jscomp$0,
3305
3378
  arrayRoot
3306
3379
  );
3307
3380
  case "M":
@@ -3311,7 +3384,7 @@ function parseModelString(response, obj, key, value, reference, arrayRoot) {
3311
3384
  BigInt64Array,
3312
3385
  8,
3313
3386
  obj,
3314
- key,
3387
+ key$jscomp$0,
3315
3388
  arrayRoot
3316
3389
  );
3317
3390
  case "m":
@@ -3321,7 +3394,7 @@ function parseModelString(response, obj, key, value, reference, arrayRoot) {
3321
3394
  BigUint64Array,
3322
3395
  8,
3323
3396
  obj,
3324
- key,
3397
+ key$jscomp$0,
3325
3398
  arrayRoot
3326
3399
  );
3327
3400
  case "V":
@@ -3331,13 +3404,13 @@ function parseModelString(response, obj, key, value, reference, arrayRoot) {
3331
3404
  DataView,
3332
3405
  1,
3333
3406
  obj,
3334
- key,
3407
+ key$jscomp$0,
3335
3408
  arrayRoot
3336
3409
  );
3337
3410
  case "B":
3338
3411
  return (
3339
3412
  (obj = parseInt(value.slice(2), 16)),
3340
- response._formData.data.get(response._prefix + obj)
3413
+ getBackingBlob(response._formData, response._prefix + obj)
3341
3414
  );
3342
3415
  case "R":
3343
3416
  return parseReadableStream(response, value, void 0);
@@ -3349,7 +3422,14 @@ function parseModelString(response, obj, key, value, reference, arrayRoot) {
3349
3422
  return parseAsyncIterable(response, value, !0);
3350
3423
  }
3351
3424
  value = value.slice(1);
3352
- return getOutlinedModel(response, value, obj, key, arrayRoot, createModel);
3425
+ return getOutlinedModel(
3426
+ response,
3427
+ value,
3428
+ obj,
3429
+ key$jscomp$0,
3430
+ arrayRoot,
3431
+ createModel
3432
+ );
3353
3433
  }
3354
3434
  null !== arrayRoot && bumpArrayCount(arrayRoot, value.length, response);
3355
3435
  return value;
@@ -3361,11 +3441,20 @@ function createResponse(bundlerConfig, formFieldPrefix, temporaryReferences) {
3361
3441
  : new FormData(),
3362
3442
  arraySizeLimit =
3363
3443
  4 < arguments.length && void 0 !== arguments[4] ? arguments[4] : 1e6,
3364
- chunks = new Map();
3444
+ chunks = new Map(),
3445
+ backingStore = {
3446
+ prefix: formFieldPrefix,
3447
+ referencedEntries: null,
3448
+ keyPointer: 0,
3449
+ stringChunks: null,
3450
+ streamChunks: null,
3451
+ blobs: null
3452
+ };
3453
+ backingFormData.forEach(appendBackingEntry.bind(null, backingStore));
3365
3454
  return {
3366
3455
  _bundlerConfig: bundlerConfig,
3367
3456
  _prefix: formFieldPrefix,
3368
- _formData: { data: backingFormData, keyPointer: -1, keys: null },
3457
+ _formData: backingStore,
3369
3458
  _chunks: chunks,
3370
3459
  _closed: !1,
3371
3460
  _closedReason: null,
@@ -3375,14 +3464,26 @@ function createResponse(bundlerConfig, formFieldPrefix, temporaryReferences) {
3375
3464
  };
3376
3465
  }
3377
3466
  function resolveField(response, key, value) {
3378
- appendBackingEntry(response._formData, key, value);
3379
3467
  var prefix = response._prefix;
3380
3468
  if (key.startsWith(prefix)) {
3381
3469
  var chunks = response._chunks;
3382
- key = +key.slice(prefix.length);
3383
- (chunks = chunks.get(key)) &&
3384
- resolveModelChunk(response, chunks, value, key);
3470
+ if ("S" === key[prefix.length]) {
3471
+ if (
3472
+ key.length > prefix.length + 1 &&
3473
+ ((prefix = +key.slice(prefix.length + 1)),
3474
+ (chunks = chunks.get(prefix)))
3475
+ ) {
3476
+ resolveModelChunk(response, chunks, value, prefix);
3477
+ return;
3478
+ }
3479
+ } else if (
3480
+ ((prefix = +key.slice(prefix.length)), (chunks = chunks.get(prefix)))
3481
+ ) {
3482
+ resolveModelChunk(response, chunks, value, prefix);
3483
+ return;
3484
+ }
3385
3485
  }
3486
+ appendBackingEntry(response._formData, value, key);
3386
3487
  }
3387
3488
  function close(response) {
3388
3489
  reportGlobalError(response, Error("Connection closed."));
@@ -3480,44 +3581,41 @@ exports.createTemporaryReferenceSet = function () {
3480
3581
  };
3481
3582
  exports.decodeAction = function (body, serverManifest) {
3482
3583
  var formData = new FormData(),
3483
- action = null,
3484
- seenActions = new Set();
3584
+ maybeActionKey = null;
3485
3585
  body.forEach(function (value, key) {
3486
3586
  key.startsWith("$ACTION_")
3487
3587
  ? key.startsWith("$ACTION_REF_")
3488
- ? seenActions.has(key) ||
3489
- (seenActions.add(key),
3490
- (value = "$ACTION_" + key.slice(12) + ":"),
3491
- (value = decodeBoundActionMetaData(body, serverManifest, value)),
3492
- (action = loadServerReference(serverManifest, value)))
3493
- : key.startsWith("$ACTION_ID_") &&
3494
- !seenActions.has(key) &&
3495
- (seenActions.add(key),
3496
- (value = key.slice(11)),
3497
- (action = loadServerReference(serverManifest, {
3498
- id: value,
3499
- bound: null
3500
- })))
3588
+ ? (maybeActionKey = key)
3589
+ : key.startsWith("$ACTION_ID_") && (maybeActionKey = key)
3501
3590
  : formData.append(key, value);
3502
3591
  });
3503
- return null === action
3504
- ? null
3505
- : action.then(function (fn) {
3506
- return fn.bind(null, formData);
3507
- });
3592
+ if (null === maybeActionKey) return null;
3593
+ var actionKey = maybeActionKey,
3594
+ action = null;
3595
+ if (actionKey.startsWith("$ACTION_REF_"))
3596
+ (actionKey = "$ACTION_" + actionKey.slice(12) + ":"),
3597
+ (body = decodeBoundActionMetaData(body, serverManifest, actionKey)),
3598
+ (action = loadServerReference(serverManifest, body));
3599
+ else if (actionKey.startsWith("$ACTION_ID_"))
3600
+ (body = actionKey.slice(11)),
3601
+ (action = loadServerReference(serverManifest, { id: body, bound: null }));
3602
+ else throw Error("Cannot handle action key. This is a bug in React.");
3603
+ return action.then(function (fn) {
3604
+ return fn.bind(null, formData);
3605
+ });
3508
3606
  };
3509
3607
  exports.decodeFormState = function (actionResult, body, serverManifest) {
3510
3608
  var keyPath = body.get("$ACTION_KEY");
3511
3609
  if ("string" !== typeof keyPath) return Promise.resolve(null);
3512
- var metaData = null;
3610
+ var actionKey = null;
3513
3611
  body.forEach(function (value, key) {
3514
- key.startsWith("$ACTION_REF_") &&
3515
- ((value = "$ACTION_" + key.slice(12) + ":"),
3516
- (metaData = decodeBoundActionMetaData(body, serverManifest, value)));
3612
+ key.startsWith("$ACTION_REF_") && (actionKey = key);
3517
3613
  });
3518
- if (null === metaData) return Promise.resolve(null);
3519
- var referenceId = metaData.id;
3520
- return Promise.resolve(metaData.bound).then(function (bound) {
3614
+ if (null === actionKey) return Promise.resolve(null);
3615
+ var formFieldPrefix = "$ACTION_" + actionKey.slice(12) + ":";
3616
+ body = decodeBoundActionMetaData(body, serverManifest, formFieldPrefix);
3617
+ var referenceId = body.id;
3618
+ return Promise.resolve(body.bound).then(function (bound) {
3521
3619
  return null === bound
3522
3620
  ? null
3523
3621
  : [actionResult, keyPath, referenceId, bound.length - 1];
@@ -3553,14 +3651,14 @@ exports.decodeReplyFromAsyncIterable = function (
3553
3651
  _entry$value = _entry$value[1];
3554
3652
  "string" === typeof _entry$value
3555
3653
  ? resolveField(response, entry, _entry$value)
3556
- : appendBackingEntry(response._formData, entry, _entry$value);
3654
+ : appendBackingEntry(response._formData, _entry$value, entry);
3557
3655
  iterator.next().then(progress, error);
3558
3656
  }
3559
3657
  }
3560
3658
  function error(reason) {
3561
3659
  reportGlobalError(response, reason);
3562
3660
  "function" === typeof iterator.throw &&
3563
- iterator.throw(reason).then(error, error);
3661
+ iterator.throw(reason).then(noop, noop);
3564
3662
  }
3565
3663
  var iterator = iterable[ASYNC_ITERATOR](),
3566
3664
  response = createResponse(
@@ -3580,28 +3678,32 @@ exports.decodeReplyFromBusboy = function (busboyStream, webpackMap, options) {
3580
3678
  if (!current.complete) return;
3581
3679
  try {
3582
3680
  var key = current.name,
3583
- handle = current.file,
3584
- blob = new Blob(handle.chunks, { type: handle.mime }),
3585
- backingStore = response._formData,
3586
- key$jscomp$0 = key;
3587
- backingStore.data.append(key$jscomp$0, blob, handle.filename);
3588
- var keys = backingStore.keys;
3589
- null === keys
3590
- ? ((backingStore.keys = Array.from(backingStore.data.keys())),
3591
- (backingStore.keyPointer = 0))
3592
- : keys.push(key$jscomp$0);
3681
+ JSCompiler_temp_const = response._formData;
3682
+ var handle = current.file;
3683
+ if ("function" === typeof File)
3684
+ var JSCompiler_inline_result = new File(
3685
+ handle.chunks,
3686
+ handle.filename,
3687
+ { type: handle.mime }
3688
+ );
3689
+ else {
3690
+ var scratch = new FormData();
3691
+ scratch.append(
3692
+ "file",
3693
+ new Blob(handle.chunks, { type: handle.mime }),
3694
+ handle.filename
3695
+ );
3696
+ JSCompiler_inline_result = scratch.get("file");
3697
+ }
3698
+ appendBackingEntry(
3699
+ JSCompiler_temp_const,
3700
+ JSCompiler_inline_result,
3701
+ key
3702
+ );
3593
3703
  var queuedFields = current.queuedFields;
3594
3704
  if (null !== queuedFields)
3595
- for (
3596
- key$jscomp$0 = 0;
3597
- key$jscomp$0 < queuedFields.length;
3598
- key$jscomp$0 += 2
3599
- )
3600
- resolveField(
3601
- response,
3602
- queuedFields[key$jscomp$0],
3603
- queuedFields[key$jscomp$0 + 1]
3604
- );
3705
+ for (var i = 0; i < queuedFields.length; i += 2)
3706
+ resolveField(response, queuedFields[i], queuedFields[i + 1]);
3605
3707
  } catch (error) {
3606
3708
  busboyStream.destroy(error);
3607
3709
  return;