react-server-dom-webpack 0.0.1 → 18.3.0-next-e7c5af45c-20221023

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.
@@ -0,0 +1,2360 @@
1
+ /**
2
+ * @license React
3
+ * react-server-dom-webpack-server.node.development.js
4
+ *
5
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
6
+ *
7
+ * This source code is licensed under the MIT license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ */
10
+
11
+ 'use strict';
12
+
13
+ if (process.env.NODE_ENV !== "production") {
14
+ (function() {
15
+ 'use strict';
16
+
17
+ var React = require('react');
18
+ var util = require('util');
19
+ var async_hooks = require('async_hooks');
20
+ var ReactDOM = require('react-dom');
21
+
22
+ var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
23
+
24
+ function error(format) {
25
+ {
26
+ {
27
+ for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
28
+ args[_key2 - 1] = arguments[_key2];
29
+ }
30
+
31
+ printWarning('error', format, args);
32
+ }
33
+ }
34
+ }
35
+
36
+ function printWarning(level, format, args) {
37
+ // When changing this logic, you might want to also
38
+ // update consoleWithStackDev.www.js as well.
39
+ {
40
+ var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
41
+ var stack = ReactDebugCurrentFrame.getStackAddendum();
42
+
43
+ if (stack !== '') {
44
+ format += '%s';
45
+ args = args.concat([stack]);
46
+ } // eslint-disable-next-line react-internal/safe-string-coercion
47
+
48
+
49
+ var argsWithFormat = args.map(function (item) {
50
+ return String(item);
51
+ }); // Careful: RN currently depends on this prefix
52
+
53
+ argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
54
+ // breaks IE9: https://github.com/facebook/react/issues/13610
55
+ // eslint-disable-next-line react-internal/no-production-logging
56
+
57
+ Function.prototype.apply.call(console[level], console, argsWithFormat);
58
+ }
59
+ }
60
+
61
+ function scheduleWork(callback) {
62
+ setImmediate(callback);
63
+ }
64
+ function flushBuffered(destination) {
65
+ // If we don't have any more data to send right now.
66
+ // Flush whatever is in the buffer to the wire.
67
+ if (typeof destination.flush === 'function') {
68
+ // By convention the Zlib streams provide a flush function for this purpose.
69
+ // For Express, compression middleware adds this method.
70
+ destination.flush();
71
+ }
72
+ }
73
+ var requestStorage = new async_hooks.AsyncLocalStorage();
74
+ var VIEW_SIZE = 2048;
75
+ var currentView = null;
76
+ var writtenBytes = 0;
77
+ var destinationHasCapacity = true;
78
+ function beginWriting(destination) {
79
+ currentView = new Uint8Array(VIEW_SIZE);
80
+ writtenBytes = 0;
81
+ destinationHasCapacity = true;
82
+ }
83
+
84
+ function writeStringChunk(destination, stringChunk) {
85
+ if (stringChunk.length === 0) {
86
+ return;
87
+ } // maximum possible view needed to encode entire string
88
+
89
+
90
+ if (stringChunk.length * 3 > VIEW_SIZE) {
91
+ if (writtenBytes > 0) {
92
+ writeToDestination(destination, currentView.subarray(0, writtenBytes));
93
+ currentView = new Uint8Array(VIEW_SIZE);
94
+ writtenBytes = 0;
95
+ }
96
+
97
+ writeToDestination(destination, textEncoder.encode(stringChunk));
98
+ return;
99
+ }
100
+
101
+ var target = currentView;
102
+
103
+ if (writtenBytes > 0) {
104
+ target = currentView.subarray(writtenBytes);
105
+ }
106
+
107
+ var _textEncoder$encodeIn = textEncoder.encodeInto(stringChunk, target),
108
+ read = _textEncoder$encodeIn.read,
109
+ written = _textEncoder$encodeIn.written;
110
+
111
+ writtenBytes += written;
112
+
113
+ if (read < stringChunk.length) {
114
+ writeToDestination(destination, currentView);
115
+ currentView = new Uint8Array(VIEW_SIZE); // $FlowFixMe[incompatible-call] found when upgrading Flow
116
+
117
+ writtenBytes = textEncoder.encodeInto(stringChunk.slice(read), currentView).written;
118
+ }
119
+
120
+ if (writtenBytes === VIEW_SIZE) {
121
+ writeToDestination(destination, currentView);
122
+ currentView = new Uint8Array(VIEW_SIZE);
123
+ writtenBytes = 0;
124
+ }
125
+ }
126
+
127
+ function writeViewChunk(destination, chunk) {
128
+ if (chunk.byteLength === 0) {
129
+ return;
130
+ }
131
+
132
+ if (chunk.byteLength > VIEW_SIZE) {
133
+ // this chunk may overflow a single view which implies it was not
134
+ // one that is cached by the streaming renderer. We will enqueu
135
+ // it directly and expect it is not re-used
136
+ if (writtenBytes > 0) {
137
+ writeToDestination(destination, currentView.subarray(0, writtenBytes));
138
+ currentView = new Uint8Array(VIEW_SIZE);
139
+ writtenBytes = 0;
140
+ }
141
+
142
+ writeToDestination(destination, chunk);
143
+ return;
144
+ }
145
+
146
+ var bytesToWrite = chunk;
147
+ var allowableBytes = currentView.length - writtenBytes;
148
+
149
+ if (allowableBytes < bytesToWrite.byteLength) {
150
+ // this chunk would overflow the current view. We enqueue a full view
151
+ // and start a new view with the remaining chunk
152
+ if (allowableBytes === 0) {
153
+ // the current view is already full, send it
154
+ writeToDestination(destination, currentView);
155
+ } else {
156
+ // fill up the current view and apply the remaining chunk bytes
157
+ // to a new view.
158
+ currentView.set(bytesToWrite.subarray(0, allowableBytes), writtenBytes);
159
+ writtenBytes += allowableBytes;
160
+ writeToDestination(destination, currentView);
161
+ bytesToWrite = bytesToWrite.subarray(allowableBytes);
162
+ }
163
+
164
+ currentView = new Uint8Array(VIEW_SIZE);
165
+ writtenBytes = 0;
166
+ }
167
+
168
+ currentView.set(bytesToWrite, writtenBytes);
169
+ writtenBytes += bytesToWrite.byteLength;
170
+
171
+ if (writtenBytes === VIEW_SIZE) {
172
+ writeToDestination(destination, currentView);
173
+ currentView = new Uint8Array(VIEW_SIZE);
174
+ writtenBytes = 0;
175
+ }
176
+ }
177
+
178
+ function writeChunk(destination, chunk) {
179
+ if (typeof chunk === 'string') {
180
+ writeStringChunk(destination, chunk);
181
+ } else {
182
+ writeViewChunk(destination, chunk);
183
+ }
184
+ }
185
+
186
+ function writeToDestination(destination, view) {
187
+ var currentHasCapacity = destination.write(view);
188
+ destinationHasCapacity = destinationHasCapacity && currentHasCapacity;
189
+ }
190
+
191
+ function writeChunkAndReturn(destination, chunk) {
192
+ writeChunk(destination, chunk);
193
+ return destinationHasCapacity;
194
+ }
195
+ function completeWriting(destination) {
196
+ if (currentView && writtenBytes > 0) {
197
+ destination.write(currentView.subarray(0, writtenBytes));
198
+ }
199
+
200
+ currentView = null;
201
+ writtenBytes = 0;
202
+ destinationHasCapacity = true;
203
+ }
204
+ function close(destination) {
205
+ destination.end();
206
+ }
207
+ var textEncoder = new util.TextEncoder();
208
+ function stringToChunk(content) {
209
+ return content;
210
+ }
211
+ function stringToPrecomputedChunk(content) {
212
+ return textEncoder.encode(content);
213
+ }
214
+ function closeWithError(destination, error) {
215
+ // $FlowFixMe: This is an Error object or the destination accepts other types.
216
+ destination.destroy(error);
217
+ }
218
+
219
+ // This file is an intermediate layer to translate between Flight
220
+ var stringify = JSON.stringify;
221
+
222
+ function serializeRowHeader(tag, id) {
223
+ return tag + id.toString(16) + ':';
224
+ }
225
+
226
+ function processErrorChunkProd(request, id, digest) {
227
+ {
228
+ // These errors should never make it into a build so we don't need to encode them in codes.json
229
+ // eslint-disable-next-line react-internal/prod-error-codes
230
+ throw new Error('processErrorChunkProd should never be called while in development mode. Use processErrorChunkDev instead. This is a bug in React.');
231
+ }
232
+
233
+ var errorInfo = {
234
+ digest: digest
235
+ };
236
+ var row = serializeRowHeader('E', id) + stringify(errorInfo) + '\n';
237
+ }
238
+ function processErrorChunkDev(request, id, digest, message, stack) {
239
+
240
+ var errorInfo = {
241
+ digest: digest,
242
+ message: message,
243
+ stack: stack
244
+ };
245
+ var row = serializeRowHeader('E', id) + stringify(errorInfo) + '\n';
246
+ return stringToChunk(row);
247
+ }
248
+ function processModelChunk(request, id, model) {
249
+ var json = stringify(model, request.toJSON);
250
+ var row = serializeRowHeader('J', id) + json + '\n';
251
+ return stringToChunk(row);
252
+ }
253
+ function processReferenceChunk(request, id, reference) {
254
+ var json = stringify(reference);
255
+ var row = serializeRowHeader('J', id) + json + '\n';
256
+ return stringToChunk(row);
257
+ }
258
+ function processModuleChunk(request, id, moduleMetaData) {
259
+ var json = stringify(moduleMetaData);
260
+ var row = serializeRowHeader('M', id) + json + '\n';
261
+ return stringToChunk(row);
262
+ }
263
+ function processProviderChunk(request, id, contextName) {
264
+ var row = serializeRowHeader('P', id) + contextName + '\n';
265
+ return stringToChunk(row);
266
+ }
267
+ function processSymbolChunk(request, id, name) {
268
+ var json = stringify(name);
269
+ var row = serializeRowHeader('S', id) + json + '\n';
270
+ return stringToChunk(row);
271
+ }
272
+
273
+ // eslint-disable-next-line no-unused-vars
274
+ var MODULE_TAG = Symbol.for('react.module.reference');
275
+ function getModuleKey(reference) {
276
+ return reference.filepath + '#' + reference.name + (reference.async ? '#async' : '');
277
+ }
278
+ function isModuleReference(reference) {
279
+ return reference.$$typeof === MODULE_TAG;
280
+ }
281
+ function resolveModuleMetaData(config, moduleReference) {
282
+ var resolvedModuleData = config[moduleReference.filepath][moduleReference.name];
283
+
284
+ if (moduleReference.async) {
285
+ return {
286
+ id: resolvedModuleData.id,
287
+ chunks: resolvedModuleData.chunks,
288
+ name: resolvedModuleData.name,
289
+ async: true
290
+ };
291
+ } else {
292
+ return resolvedModuleData;
293
+ }
294
+ }
295
+
296
+ // ATTENTION
297
+ // When adding new symbols to this file,
298
+ // Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'
299
+ // The Symbol used to tag the ReactElement-like types.
300
+ var REACT_ELEMENT_TYPE = Symbol.for('react.element');
301
+ var REACT_FRAGMENT_TYPE = Symbol.for('react.fragment');
302
+ var REACT_PROVIDER_TYPE = Symbol.for('react.provider');
303
+ var REACT_SERVER_CONTEXT_TYPE = Symbol.for('react.server_context');
304
+ var REACT_FORWARD_REF_TYPE = Symbol.for('react.forward_ref');
305
+ var REACT_SUSPENSE_TYPE = Symbol.for('react.suspense');
306
+ var REACT_SUSPENSE_LIST_TYPE = Symbol.for('react.suspense_list');
307
+ var REACT_MEMO_TYPE = Symbol.for('react.memo');
308
+ var REACT_LAZY_TYPE = Symbol.for('react.lazy');
309
+ var REACT_SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED = Symbol.for('react.default_value');
310
+ var REACT_MEMO_CACHE_SENTINEL = Symbol.for('react.memo_cache_sentinel');
311
+
312
+ // A reserved attribute.
313
+ // It is handled by React separately and shouldn't be written to the DOM.
314
+ var RESERVED = 0; // A simple string attribute.
315
+ // Attributes that aren't in the filter are presumed to have this type.
316
+
317
+ var STRING = 1; // A string attribute that accepts booleans in React. In HTML, these are called
318
+ // "enumerated" attributes with "true" and "false" as possible values.
319
+ // When true, it should be set to a "true" string.
320
+ // When false, it should be set to a "false" string.
321
+
322
+ var BOOLEANISH_STRING = 2; // A real boolean attribute.
323
+ // When true, it should be present (set either to an empty string or its name).
324
+ // When false, it should be omitted.
325
+
326
+ var BOOLEAN = 3; // An attribute that can be used as a flag as well as with a value.
327
+ // When true, it should be present (set either to an empty string or its name).
328
+ // When false, it should be omitted.
329
+ // For any other value, should be present with that value.
330
+
331
+ var OVERLOADED_BOOLEAN = 4; // An attribute that must be numeric or parse as a numeric.
332
+ // When falsy, it should be removed.
333
+
334
+ var NUMERIC = 5; // An attribute that must be positive numeric or parse as a positive numeric.
335
+ // When falsy, it should be removed.
336
+
337
+ var POSITIVE_NUMERIC = 6;
338
+
339
+ function PropertyInfoRecord(name, type, mustUseProperty, attributeName, attributeNamespace, sanitizeURL, removeEmptyString) {
340
+ this.acceptsBooleans = type === BOOLEANISH_STRING || type === BOOLEAN || type === OVERLOADED_BOOLEAN;
341
+ this.attributeName = attributeName;
342
+ this.attributeNamespace = attributeNamespace;
343
+ this.mustUseProperty = mustUseProperty;
344
+ this.propertyName = name;
345
+ this.type = type;
346
+ this.sanitizeURL = sanitizeURL;
347
+ this.removeEmptyString = removeEmptyString;
348
+ } // When adding attributes to this list, be sure to also add them to
349
+ // the `possibleStandardNames` module to ensure casing and incorrect
350
+ // name warnings.
351
+
352
+
353
+ var properties = {}; // These props are reserved by React. They shouldn't be written to the DOM.
354
+
355
+ var reservedProps = ['children', 'dangerouslySetInnerHTML', // TODO: This prevents the assignment of defaultValue to regular
356
+ // elements (not just inputs). Now that ReactDOMInput assigns to the
357
+ // defaultValue property -- do we need this?
358
+ 'defaultValue', 'defaultChecked', 'innerHTML', 'suppressContentEditableWarning', 'suppressHydrationWarning', 'style'];
359
+
360
+ reservedProps.forEach(function (name) {
361
+ // $FlowFixMe[invalid-constructor] Flow no longer supports calling new on functions
362
+ properties[name] = new PropertyInfoRecord(name, RESERVED, false, // mustUseProperty
363
+ name, // attributeName
364
+ null, // attributeNamespace
365
+ false, // sanitizeURL
366
+ false);
367
+ }); // A few React string attributes have a different name.
368
+ // This is a mapping from React prop names to the attribute names.
369
+
370
+ [['acceptCharset', 'accept-charset'], ['className', 'class'], ['htmlFor', 'for'], ['httpEquiv', 'http-equiv']].forEach(function (_ref) {
371
+ var name = _ref[0],
372
+ attributeName = _ref[1];
373
+ // $FlowFixMe[invalid-constructor] Flow no longer supports calling new on functions
374
+ properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
375
+ attributeName, // attributeName
376
+ null, // attributeNamespace
377
+ false, // sanitizeURL
378
+ false);
379
+ }); // These are "enumerated" HTML attributes that accept "true" and "false".
380
+ // In React, we let users pass `true` and `false` even though technically
381
+ // these aren't boolean attributes (they are coerced to strings).
382
+
383
+ ['contentEditable', 'draggable', 'spellCheck', 'value'].forEach(function (name) {
384
+ // $FlowFixMe[invalid-constructor] Flow no longer supports calling new on functions
385
+ properties[name] = new PropertyInfoRecord(name, BOOLEANISH_STRING, false, // mustUseProperty
386
+ name.toLowerCase(), // attributeName
387
+ null, // attributeNamespace
388
+ false, // sanitizeURL
389
+ false);
390
+ }); // These are "enumerated" SVG attributes that accept "true" and "false".
391
+ // In React, we let users pass `true` and `false` even though technically
392
+ // these aren't boolean attributes (they are coerced to strings).
393
+ // Since these are SVG attributes, their attribute names are case-sensitive.
394
+
395
+ ['autoReverse', 'externalResourcesRequired', 'focusable', 'preserveAlpha'].forEach(function (name) {
396
+ // $FlowFixMe[invalid-constructor] Flow no longer supports calling new on functions
397
+ properties[name] = new PropertyInfoRecord(name, BOOLEANISH_STRING, false, // mustUseProperty
398
+ name, // attributeName
399
+ null, // attributeNamespace
400
+ false, // sanitizeURL
401
+ false);
402
+ }); // These are HTML boolean attributes.
403
+
404
+ ['allowFullScreen', 'async', // Note: there is a special case that prevents it from being written to the DOM
405
+ // on the client side because the browsers are inconsistent. Instead we call focus().
406
+ 'autoFocus', 'autoPlay', 'controls', 'default', 'defer', 'disabled', 'disablePictureInPicture', 'disableRemotePlayback', 'formNoValidate', 'hidden', 'loop', 'noModule', 'noValidate', 'open', 'playsInline', 'readOnly', 'required', 'reversed', 'scoped', 'seamless', // Microdata
407
+ 'itemScope'].forEach(function (name) {
408
+ // $FlowFixMe[invalid-constructor] Flow no longer supports calling new on functions
409
+ properties[name] = new PropertyInfoRecord(name, BOOLEAN, false, // mustUseProperty
410
+ name.toLowerCase(), // attributeName
411
+ null, // attributeNamespace
412
+ false, // sanitizeURL
413
+ false);
414
+ }); // These are the few React props that we set as DOM properties
415
+ // rather than attributes. These are all booleans.
416
+
417
+ ['checked', // Note: `option.selected` is not updated if `select.multiple` is
418
+ // disabled with `removeAttribute`. We have special logic for handling this.
419
+ 'multiple', 'muted', 'selected' // NOTE: if you add a camelCased prop to this list,
420
+ // you'll need to set attributeName to name.toLowerCase()
421
+ // instead in the assignment below.
422
+ ].forEach(function (name) {
423
+ // $FlowFixMe[invalid-constructor] Flow no longer supports calling new on functions
424
+ properties[name] = new PropertyInfoRecord(name, BOOLEAN, true, // mustUseProperty
425
+ name, // attributeName
426
+ null, // attributeNamespace
427
+ false, // sanitizeURL
428
+ false);
429
+ }); // These are HTML attributes that are "overloaded booleans": they behave like
430
+ // booleans, but can also accept a string value.
431
+
432
+ ['capture', 'download' // NOTE: if you add a camelCased prop to this list,
433
+ // you'll need to set attributeName to name.toLowerCase()
434
+ // instead in the assignment below.
435
+ ].forEach(function (name) {
436
+ // $FlowFixMe[invalid-constructor] Flow no longer supports calling new on functions
437
+ properties[name] = new PropertyInfoRecord(name, OVERLOADED_BOOLEAN, false, // mustUseProperty
438
+ name, // attributeName
439
+ null, // attributeNamespace
440
+ false, // sanitizeURL
441
+ false);
442
+ }); // These are HTML attributes that must be positive numbers.
443
+
444
+ ['cols', 'rows', 'size', 'span' // NOTE: if you add a camelCased prop to this list,
445
+ // you'll need to set attributeName to name.toLowerCase()
446
+ // instead in the assignment below.
447
+ ].forEach(function (name) {
448
+ // $FlowFixMe[invalid-constructor] Flow no longer supports calling new on functions
449
+ properties[name] = new PropertyInfoRecord(name, POSITIVE_NUMERIC, false, // mustUseProperty
450
+ name, // attributeName
451
+ null, // attributeNamespace
452
+ false, // sanitizeURL
453
+ false);
454
+ }); // These are HTML attributes that must be numbers.
455
+
456
+ ['rowSpan', 'start'].forEach(function (name) {
457
+ // $FlowFixMe[invalid-constructor] Flow no longer supports calling new on functions
458
+ properties[name] = new PropertyInfoRecord(name, NUMERIC, false, // mustUseProperty
459
+ name.toLowerCase(), // attributeName
460
+ null, // attributeNamespace
461
+ false, // sanitizeURL
462
+ false);
463
+ });
464
+ var CAMELIZE = /[\-\:]([a-z])/g;
465
+
466
+ var capitalize = function (token) {
467
+ return token[1].toUpperCase();
468
+ }; // This is a list of all SVG attributes that need special casing, namespacing,
469
+ // or boolean value assignment. Regular attributes that just accept strings
470
+ // and have the same names are omitted, just like in the HTML attribute filter.
471
+ // Some of these attributes can be hard to find. This list was created by
472
+ // scraping the MDN documentation.
473
+
474
+
475
+ ['accent-height', 'alignment-baseline', 'arabic-form', 'baseline-shift', 'cap-height', 'clip-path', 'clip-rule', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'dominant-baseline', 'enable-background', 'fill-opacity', 'fill-rule', 'flood-color', 'flood-opacity', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'glyph-name', 'glyph-orientation-horizontal', 'glyph-orientation-vertical', 'horiz-adv-x', 'horiz-origin-x', 'image-rendering', 'letter-spacing', 'lighting-color', 'marker-end', 'marker-mid', 'marker-start', 'overline-position', 'overline-thickness', 'paint-order', 'panose-1', 'pointer-events', 'rendering-intent', 'shape-rendering', 'stop-color', 'stop-opacity', 'strikethrough-position', 'strikethrough-thickness', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke-width', 'text-anchor', 'text-decoration', 'text-rendering', 'underline-position', 'underline-thickness', 'unicode-bidi', 'unicode-range', 'units-per-em', 'v-alphabetic', 'v-hanging', 'v-ideographic', 'v-mathematical', 'vector-effect', 'vert-adv-y', 'vert-origin-x', 'vert-origin-y', 'word-spacing', 'writing-mode', 'xmlns:xlink', 'x-height' // NOTE: if you add a camelCased prop to this list,
476
+ // you'll need to set attributeName to name.toLowerCase()
477
+ // instead in the assignment below.
478
+ ].forEach(function (attributeName) {
479
+ var name = attributeName.replace(CAMELIZE, capitalize); // $FlowFixMe[invalid-constructor] Flow no longer supports calling new on functions
480
+
481
+ properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
482
+ attributeName, null, // attributeNamespace
483
+ false, // sanitizeURL
484
+ false);
485
+ }); // String SVG attributes with the xlink namespace.
486
+
487
+ ['xlink:actuate', 'xlink:arcrole', 'xlink:role', 'xlink:show', 'xlink:title', 'xlink:type' // NOTE: if you add a camelCased prop to this list,
488
+ // you'll need to set attributeName to name.toLowerCase()
489
+ // instead in the assignment below.
490
+ ].forEach(function (attributeName) {
491
+ var name = attributeName.replace(CAMELIZE, capitalize); // $FlowFixMe[invalid-constructor] Flow no longer supports calling new on functions
492
+
493
+ properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
494
+ attributeName, 'http://www.w3.org/1999/xlink', false, // sanitizeURL
495
+ false);
496
+ }); // String SVG attributes with the xml namespace.
497
+
498
+ ['xml:base', 'xml:lang', 'xml:space' // NOTE: if you add a camelCased prop to this list,
499
+ // you'll need to set attributeName to name.toLowerCase()
500
+ // instead in the assignment below.
501
+ ].forEach(function (attributeName) {
502
+ var name = attributeName.replace(CAMELIZE, capitalize); // $FlowFixMe[invalid-constructor] Flow no longer supports calling new on functions
503
+
504
+ properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
505
+ attributeName, 'http://www.w3.org/XML/1998/namespace', false, // sanitizeURL
506
+ false);
507
+ }); // These attribute exists both in HTML and SVG.
508
+ // The attribute name is case-sensitive in SVG so we can't just use
509
+ // the React name like we do for attributes that exist only in HTML.
510
+
511
+ ['tabIndex', 'crossOrigin'].forEach(function (attributeName) {
512
+ // $FlowFixMe[invalid-constructor] Flow no longer supports calling new on functions
513
+ properties[attributeName] = new PropertyInfoRecord(attributeName, STRING, false, // mustUseProperty
514
+ attributeName.toLowerCase(), // attributeName
515
+ null, // attributeNamespace
516
+ false, // sanitizeURL
517
+ false);
518
+ }); // These attributes accept URLs. These must not allow javascript: URLS.
519
+ // These will also need to accept Trusted Types object in the future.
520
+
521
+ var xlinkHref = 'xlinkHref'; // $FlowFixMe[invalid-constructor] Flow no longer supports calling new on functions
522
+
523
+ properties[xlinkHref] = new PropertyInfoRecord('xlinkHref', STRING, false, // mustUseProperty
524
+ 'xlink:href', 'http://www.w3.org/1999/xlink', true, // sanitizeURL
525
+ false);
526
+ ['src', 'href', 'action', 'formAction'].forEach(function (attributeName) {
527
+ // $FlowFixMe[invalid-constructor] Flow no longer supports calling new on functions
528
+ properties[attributeName] = new PropertyInfoRecord(attributeName, STRING, false, // mustUseProperty
529
+ attributeName.toLowerCase(), // attributeName
530
+ null, // attributeNamespace
531
+ true, // sanitizeURL
532
+ true);
533
+ });
534
+
535
+ /**
536
+ * CSS properties which accept numbers but are not in units of "px".
537
+ */
538
+ var isUnitlessNumber = {
539
+ animationIterationCount: true,
540
+ aspectRatio: true,
541
+ borderImageOutset: true,
542
+ borderImageSlice: true,
543
+ borderImageWidth: true,
544
+ boxFlex: true,
545
+ boxFlexGroup: true,
546
+ boxOrdinalGroup: true,
547
+ columnCount: true,
548
+ columns: true,
549
+ flex: true,
550
+ flexGrow: true,
551
+ flexPositive: true,
552
+ flexShrink: true,
553
+ flexNegative: true,
554
+ flexOrder: true,
555
+ gridArea: true,
556
+ gridRow: true,
557
+ gridRowEnd: true,
558
+ gridRowSpan: true,
559
+ gridRowStart: true,
560
+ gridColumn: true,
561
+ gridColumnEnd: true,
562
+ gridColumnSpan: true,
563
+ gridColumnStart: true,
564
+ fontWeight: true,
565
+ lineClamp: true,
566
+ lineHeight: true,
567
+ opacity: true,
568
+ order: true,
569
+ orphans: true,
570
+ tabSize: true,
571
+ widows: true,
572
+ zIndex: true,
573
+ zoom: true,
574
+ // SVG-related properties
575
+ fillOpacity: true,
576
+ floodOpacity: true,
577
+ stopOpacity: true,
578
+ strokeDasharray: true,
579
+ strokeDashoffset: true,
580
+ strokeMiterlimit: true,
581
+ strokeOpacity: true,
582
+ strokeWidth: true
583
+ };
584
+ /**
585
+ * @param {string} prefix vendor-specific prefix, eg: Webkit
586
+ * @param {string} key style name, eg: transitionDuration
587
+ * @return {string} style name prefixed with `prefix`, properly camelCased, eg:
588
+ * WebkitTransitionDuration
589
+ */
590
+
591
+ function prefixKey(prefix, key) {
592
+ return prefix + key.charAt(0).toUpperCase() + key.substring(1);
593
+ }
594
+ /**
595
+ * Support style names that may come passed in prefixed by adding permutations
596
+ * of vendor prefixes.
597
+ */
598
+
599
+
600
+ var prefixes = ['Webkit', 'ms', 'Moz', 'O']; // Using Object.keys here, or else the vanilla for-in loop makes IE8 go into an
601
+ // infinite loop, because it iterates over the newly added props too.
602
+
603
+ Object.keys(isUnitlessNumber).forEach(function (prop) {
604
+ prefixes.forEach(function (prefix) {
605
+ isUnitlessNumber[prefixKey(prefix, prop)] = isUnitlessNumber[prop];
606
+ });
607
+ });
608
+
609
+ var isArrayImpl = Array.isArray; // eslint-disable-next-line no-redeclare
610
+
611
+ function isArray(a) {
612
+ return isArrayImpl(a);
613
+ }
614
+
615
+ // The build script is at scripts/rollup/generate-inline-fizz-runtime.js.
616
+ // Run `yarn generate-inline-fizz-runtime` to generate.
617
+ var clientRenderBoundary = '$RX=function(b,c,d,e){var a=document.getElementById(b);a&&(b=a.previousSibling,b.data="$!",a=a.dataset,c&&(a.dgst=c),d&&(a.msg=d),e&&(a.stck=e),b._reactRetry&&b._reactRetry())};';
618
+ var completeBoundary = '$RC=function(b,c,e){c=document.getElementById(c);c.parentNode.removeChild(c);var a=document.getElementById(b);if(a){b=a.previousSibling;if(e)b.data="$!",a.setAttribute("data-dgst",e);else{e=b.parentNode;a=b.nextSibling;var f=0;do{if(a&&8===a.nodeType){var d=a.data;if("/$"===d)if(0===f)break;else f--;else"$"!==d&&"$?"!==d&&"$!"!==d||f++}d=a.nextSibling;e.removeChild(a);a=d}while(a);for(;c.firstChild;)e.insertBefore(c.firstChild,a);b.data="$"}b._reactRetry&&b._reactRetry()}};';
619
+ var completeBoundaryWithStyles = '$RM=new Map;\n$RR=function(p,q,v){function r(l){this.s=l}for(var t=$RC,u=$RM,m=new Map,n=document,g,e,f=n.querySelectorAll("link[data-precedence],style[data-precedence]"),d=0;e=f[d++];)m.set(e.dataset.precedence,g=e);e=0;f=[];for(var c,h,b,a;c=v[e++];){var k=0;h=c[k++];if(b=u.get(h))"l"!==b.s&&f.push(b);else{a=n.createElement("link");a.href=h;a.rel="stylesheet";for(a.dataset.precedence=d=c[k++];b=c[k++];)a.setAttribute(b,c[k++]);b=a._p=new Promise(function(l,w){a.onload=l;a.onerror=w});b.then(r.bind(b,\n"l"),r.bind(b,"e"));u.set(h,b);f.push(b);c=m.get(d)||g;c===g&&(g=a);m.set(d,a);c?c.parentNode.insertBefore(a,c.nextSibling):(d=n.head,d.insertBefore(a,d.firstChild))}}Promise.all(f).then(t.bind(null,p,q,""),t.bind(null,p,q,"Resource failed to load"))};';
620
+ var completeSegment = '$RS=function(a,b){a=document.getElementById(a);b=document.getElementById(b);for(a.parentNode.removeChild(a);a.firstChild;)b.parentNode.insertBefore(a.firstChild,b);b.parentNode.removeChild(b)};';
621
+
622
+ var ReactDOMSharedInternals = ReactDOM.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
623
+
624
+ var ReactDOMCurrentDispatcher = ReactDOMSharedInternals.Dispatcher;
625
+
626
+ var startInlineScript = stringToPrecomputedChunk('<script>');
627
+ var endInlineScript = stringToPrecomputedChunk('</script>');
628
+ var startScriptSrc = stringToPrecomputedChunk('<script src="');
629
+ var startModuleSrc = stringToPrecomputedChunk('<script type="module" src="');
630
+ var scriptIntegirty = stringToPrecomputedChunk('" integrity="');
631
+ var endAsyncScript = stringToPrecomputedChunk('" async=""></script>');
632
+
633
+ var textSeparator = stringToPrecomputedChunk('<!-- -->');
634
+
635
+ var styleAttributeStart = stringToPrecomputedChunk(' style="');
636
+ var styleAssign = stringToPrecomputedChunk(':');
637
+ var styleSeparator = stringToPrecomputedChunk(';');
638
+
639
+ var attributeSeparator = stringToPrecomputedChunk(' ');
640
+ var attributeAssign = stringToPrecomputedChunk('="');
641
+ var attributeEnd = stringToPrecomputedChunk('"');
642
+ var attributeEmptyString = stringToPrecomputedChunk('=""');
643
+
644
+ var endOfStartTag = stringToPrecomputedChunk('>');
645
+ var endOfStartTagSelfClosing = stringToPrecomputedChunk('/>');
646
+
647
+ var selectedMarkerAttribute = stringToPrecomputedChunk(' selected=""');
648
+
649
+ var leadingNewline = stringToPrecomputedChunk('\n');
650
+
651
+ var DOCTYPE = stringToPrecomputedChunk('<!DOCTYPE html>');
652
+ var endTag1 = stringToPrecomputedChunk('</');
653
+ var endTag2 = stringToPrecomputedChunk('>');
654
+ // A placeholder is a node inside a hidden partial tree that can be filled in later, but before
655
+ // display. It's never visible to users. We use the template tag because it can be used in every
656
+ // type of parent. <script> tags also work in every other tag except <colgroup>.
657
+
658
+ var placeholder1 = stringToPrecomputedChunk('<template id="');
659
+ var placeholder2 = stringToPrecomputedChunk('"></template>');
660
+
661
+ var startCompletedSuspenseBoundary = stringToPrecomputedChunk('<!--$-->');
662
+ var startPendingSuspenseBoundary1 = stringToPrecomputedChunk('<!--$?--><template id="');
663
+ var startPendingSuspenseBoundary2 = stringToPrecomputedChunk('"></template>');
664
+ var startClientRenderedSuspenseBoundary = stringToPrecomputedChunk('<!--$!-->');
665
+ var endSuspenseBoundary = stringToPrecomputedChunk('<!--/$-->');
666
+ var clientRenderedSuspenseBoundaryError1 = stringToPrecomputedChunk('<template');
667
+ var clientRenderedSuspenseBoundaryErrorAttrInterstitial = stringToPrecomputedChunk('"');
668
+ var clientRenderedSuspenseBoundaryError1A = stringToPrecomputedChunk(' data-dgst="');
669
+ var clientRenderedSuspenseBoundaryError1B = stringToPrecomputedChunk(' data-msg="');
670
+ var clientRenderedSuspenseBoundaryError1C = stringToPrecomputedChunk(' data-stck="');
671
+ var clientRenderedSuspenseBoundaryError2 = stringToPrecomputedChunk('></template>');
672
+ var startSegmentHTML = stringToPrecomputedChunk('<div hidden id="');
673
+ var startSegmentHTML2 = stringToPrecomputedChunk('">');
674
+ var endSegmentHTML = stringToPrecomputedChunk('</div>');
675
+ var startSegmentSVG = stringToPrecomputedChunk('<svg aria-hidden="true" style="display:none" id="');
676
+ var startSegmentSVG2 = stringToPrecomputedChunk('">');
677
+ var endSegmentSVG = stringToPrecomputedChunk('</svg>');
678
+ var startSegmentMathML = stringToPrecomputedChunk('<math aria-hidden="true" style="display:none" id="');
679
+ var startSegmentMathML2 = stringToPrecomputedChunk('">');
680
+ var endSegmentMathML = stringToPrecomputedChunk('</math>');
681
+ var startSegmentTable = stringToPrecomputedChunk('<table hidden id="');
682
+ var startSegmentTable2 = stringToPrecomputedChunk('">');
683
+ var endSegmentTable = stringToPrecomputedChunk('</table>');
684
+ var startSegmentTableBody = stringToPrecomputedChunk('<table hidden><tbody id="');
685
+ var startSegmentTableBody2 = stringToPrecomputedChunk('">');
686
+ var endSegmentTableBody = stringToPrecomputedChunk('</tbody></table>');
687
+ var startSegmentTableRow = stringToPrecomputedChunk('<table hidden><tr id="');
688
+ var startSegmentTableRow2 = stringToPrecomputedChunk('">');
689
+ var endSegmentTableRow = stringToPrecomputedChunk('</tr></table>');
690
+ var startSegmentColGroup = stringToPrecomputedChunk('<table hidden><colgroup id="');
691
+ var startSegmentColGroup2 = stringToPrecomputedChunk('">');
692
+ var endSegmentColGroup = stringToPrecomputedChunk('</colgroup></table>');
693
+ var completeSegmentScript1Full = stringToPrecomputedChunk(completeSegment + ';$RS("');
694
+ var completeSegmentScript1Partial = stringToPrecomputedChunk('$RS("');
695
+ var completeSegmentScript2 = stringToPrecomputedChunk('","');
696
+ var completeSegmentScript3 = stringToPrecomputedChunk('")</script>');
697
+ var completeBoundaryScript1Full = stringToPrecomputedChunk(completeBoundary + ';$RC("');
698
+ var completeBoundaryScript1Partial = stringToPrecomputedChunk('$RC("');
699
+ var completeBoundaryWithStylesScript1FullBoth = stringToPrecomputedChunk(completeBoundary + ';' + completeBoundaryWithStyles + ';$RR("');
700
+ var completeBoundaryWithStylesScript1FullPartial = stringToPrecomputedChunk(completeBoundaryWithStyles + ';$RR("');
701
+ var completeBoundaryWithStylesScript1Partial = stringToPrecomputedChunk('$RR("');
702
+ var completeBoundaryScript2 = stringToPrecomputedChunk('","');
703
+ var completeBoundaryScript2a = stringToPrecomputedChunk('",');
704
+ var completeBoundaryScript3 = stringToPrecomputedChunk('"');
705
+ var completeBoundaryScript4 = stringToPrecomputedChunk(')</script>');
706
+ var clientRenderScript1Full = stringToPrecomputedChunk(clientRenderBoundary + ';$RX("');
707
+ var clientRenderScript1Partial = stringToPrecomputedChunk('$RX("');
708
+ var clientRenderScript1A = stringToPrecomputedChunk('"');
709
+ var clientRenderScript2 = stringToPrecomputedChunk(')</script>');
710
+ var clientRenderErrorScriptArgInterstitial = stringToPrecomputedChunk(',');
711
+
712
+ var precedencePlaceholderStart = stringToPrecomputedChunk('<style data-precedence="');
713
+ var precedencePlaceholderEnd = stringToPrecomputedChunk('"></style>');
714
+
715
+ var arrayFirstOpenBracket = stringToPrecomputedChunk('[');
716
+ var arraySubsequentOpenBracket = stringToPrecomputedChunk(',[');
717
+ var arrayInterstitial = stringToPrecomputedChunk(',');
718
+ var arrayCloseBracket = stringToPrecomputedChunk(']');
719
+
720
+ var rendererSigil;
721
+
722
+ {
723
+ // Use this to detect multiple renderers using the same context
724
+ rendererSigil = {};
725
+ } // Used to store the parent path of all context overrides in a shared linked list.
726
+ // Forming a reverse tree.
727
+
728
+
729
+ var rootContextSnapshot = null; // We assume that this runtime owns the "current" field on all ReactContext instances.
730
+ // This global (actually thread local) state represents what state all those "current",
731
+ // fields are currently in.
732
+
733
+ var currentActiveSnapshot = null;
734
+
735
+ function popNode(prev) {
736
+ {
737
+ prev.context._currentValue = prev.parentValue;
738
+ }
739
+ }
740
+
741
+ function pushNode(next) {
742
+ {
743
+ next.context._currentValue = next.value;
744
+ }
745
+ }
746
+
747
+ function popToNearestCommonAncestor(prev, next) {
748
+ if (prev === next) ; else {
749
+ popNode(prev);
750
+ var parentPrev = prev.parent;
751
+ var parentNext = next.parent;
752
+
753
+ if (parentPrev === null) {
754
+ if (parentNext !== null) {
755
+ throw new Error('The stacks must reach the root at the same time. This is a bug in React.');
756
+ }
757
+ } else {
758
+ if (parentNext === null) {
759
+ throw new Error('The stacks must reach the root at the same time. This is a bug in React.');
760
+ }
761
+
762
+ popToNearestCommonAncestor(parentPrev, parentNext); // On the way back, we push the new ones that weren't common.
763
+
764
+ pushNode(next);
765
+ }
766
+ }
767
+ }
768
+
769
+ function popAllPrevious(prev) {
770
+ popNode(prev);
771
+ var parentPrev = prev.parent;
772
+
773
+ if (parentPrev !== null) {
774
+ popAllPrevious(parentPrev);
775
+ }
776
+ }
777
+
778
+ function pushAllNext(next) {
779
+ var parentNext = next.parent;
780
+
781
+ if (parentNext !== null) {
782
+ pushAllNext(parentNext);
783
+ }
784
+
785
+ pushNode(next);
786
+ }
787
+
788
+ function popPreviousToCommonLevel(prev, next) {
789
+ popNode(prev);
790
+ var parentPrev = prev.parent;
791
+
792
+ if (parentPrev === null) {
793
+ throw new Error('The depth must equal at least at zero before reaching the root. This is a bug in React.');
794
+ }
795
+
796
+ if (parentPrev.depth === next.depth) {
797
+ // We found the same level. Now we just need to find a shared ancestor.
798
+ popToNearestCommonAncestor(parentPrev, next);
799
+ } else {
800
+ // We must still be deeper.
801
+ popPreviousToCommonLevel(parentPrev, next);
802
+ }
803
+ }
804
+
805
+ function popNextToCommonLevel(prev, next) {
806
+ var parentNext = next.parent;
807
+
808
+ if (parentNext === null) {
809
+ throw new Error('The depth must equal at least at zero before reaching the root. This is a bug in React.');
810
+ }
811
+
812
+ if (prev.depth === parentNext.depth) {
813
+ // We found the same level. Now we just need to find a shared ancestor.
814
+ popToNearestCommonAncestor(prev, parentNext);
815
+ } else {
816
+ // We must still be deeper.
817
+ popNextToCommonLevel(prev, parentNext);
818
+ }
819
+
820
+ pushNode(next);
821
+ } // Perform context switching to the new snapshot.
822
+ // To make it cheap to read many contexts, while not suspending, we make the switch eagerly by
823
+ // updating all the context's current values. That way reads, always just read the current value.
824
+ // At the cost of updating contexts even if they're never read by this subtree.
825
+
826
+
827
+ function switchContext(newSnapshot) {
828
+ // The basic algorithm we need to do is to pop back any contexts that are no longer on the stack.
829
+ // We also need to update any new contexts that are now on the stack with the deepest value.
830
+ // The easiest way to update new contexts is to just reapply them in reverse order from the
831
+ // perspective of the backpointers. To avoid allocating a lot when switching, we use the stack
832
+ // for that. Therefore this algorithm is recursive.
833
+ // 1) First we pop which ever snapshot tree was deepest. Popping old contexts as we go.
834
+ // 2) Then we find the nearest common ancestor from there. Popping old contexts as we go.
835
+ // 3) Then we reapply new contexts on the way back up the stack.
836
+ var prev = currentActiveSnapshot;
837
+ var next = newSnapshot;
838
+
839
+ if (prev !== next) {
840
+ if (prev === null) {
841
+ // $FlowFixMe: This has to be non-null since it's not equal to prev.
842
+ pushAllNext(next);
843
+ } else if (next === null) {
844
+ popAllPrevious(prev);
845
+ } else if (prev.depth === next.depth) {
846
+ popToNearestCommonAncestor(prev, next);
847
+ } else if (prev.depth > next.depth) {
848
+ popPreviousToCommonLevel(prev, next);
849
+ } else {
850
+ popNextToCommonLevel(prev, next);
851
+ }
852
+
853
+ currentActiveSnapshot = next;
854
+ }
855
+ }
856
+ function pushProvider(context, nextValue) {
857
+ var prevValue;
858
+
859
+ {
860
+ prevValue = context._currentValue;
861
+ context._currentValue = nextValue;
862
+
863
+ {
864
+ if (context._currentRenderer !== undefined && context._currentRenderer !== null && context._currentRenderer !== rendererSigil) {
865
+ error('Detected multiple renderers concurrently rendering the ' + 'same context provider. This is currently unsupported.');
866
+ }
867
+
868
+ context._currentRenderer = rendererSigil;
869
+ }
870
+ }
871
+
872
+ var prevNode = currentActiveSnapshot;
873
+ var newNode = {
874
+ parent: prevNode,
875
+ depth: prevNode === null ? 0 : prevNode.depth + 1,
876
+ context: context,
877
+ parentValue: prevValue,
878
+ value: nextValue
879
+ };
880
+ currentActiveSnapshot = newNode;
881
+ return newNode;
882
+ }
883
+ function popProvider() {
884
+ var prevSnapshot = currentActiveSnapshot;
885
+
886
+ if (prevSnapshot === null) {
887
+ throw new Error('Tried to pop a Context at the root of the app. This is a bug in React.');
888
+ }
889
+
890
+ {
891
+ var value = prevSnapshot.parentValue;
892
+
893
+ if (value === REACT_SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED) {
894
+ prevSnapshot.context._currentValue = prevSnapshot.context._defaultValue;
895
+ } else {
896
+ prevSnapshot.context._currentValue = value;
897
+ }
898
+ }
899
+
900
+ return currentActiveSnapshot = prevSnapshot.parent;
901
+ }
902
+ function getActiveContext() {
903
+ return currentActiveSnapshot;
904
+ }
905
+ function readContext(context) {
906
+ var value = context._currentValue ;
907
+ return value;
908
+ }
909
+
910
+ // Corresponds to ReactFiberWakeable and ReactFizzWakeable modules. Generally,
911
+ // changes to one module should be reflected in the others.
912
+ // TODO: Rename this module and the corresponding Fiber one to "Thenable"
913
+ // instead of "Wakeable". Or some other more appropriate name.
914
+ function createThenableState() {
915
+ // The ThenableState is created the first time a component suspends. If it
916
+ // suspends again, we'll reuse the same state.
917
+ return [];
918
+ }
919
+
920
+ function noop() {}
921
+
922
+ function trackUsedThenable(thenableState, thenable, index) {
923
+ var previous = thenableState[index];
924
+
925
+ if (previous === undefined) {
926
+ thenableState.push(thenable);
927
+ } else {
928
+ if (previous !== thenable) {
929
+ // Reuse the previous thenable, and drop the new one. We can assume
930
+ // they represent the same value, because components are idempotent.
931
+ // Avoid an unhandled rejection errors for the Promises that we'll
932
+ // intentionally ignore.
933
+ thenable.then(noop, noop);
934
+ thenable = previous;
935
+ }
936
+ } // We use an expando to track the status and result of a thenable so that we
937
+ // can synchronously unwrap the value. Think of this as an extension of the
938
+ // Promise API, or a custom interface that is a superset of Thenable.
939
+ //
940
+ // If the thenable doesn't have a status, set it to "pending" and attach
941
+ // a listener that will update its status and result when it resolves.
942
+
943
+
944
+ switch (thenable.status) {
945
+ case 'fulfilled':
946
+ {
947
+ var fulfilledValue = thenable.value;
948
+ return fulfilledValue;
949
+ }
950
+
951
+ case 'rejected':
952
+ {
953
+ var rejectedError = thenable.reason;
954
+ throw rejectedError;
955
+ }
956
+
957
+ default:
958
+ {
959
+ if (typeof thenable.status === 'string') ; else {
960
+ var pendingThenable = thenable;
961
+ pendingThenable.status = 'pending';
962
+ pendingThenable.then(function (fulfilledValue) {
963
+ if (thenable.status === 'pending') {
964
+ var fulfilledThenable = thenable;
965
+ fulfilledThenable.status = 'fulfilled';
966
+ fulfilledThenable.value = fulfilledValue;
967
+ }
968
+ }, function (error) {
969
+ if (thenable.status === 'pending') {
970
+ var rejectedThenable = thenable;
971
+ rejectedThenable.status = 'rejected';
972
+ rejectedThenable.reason = error;
973
+ }
974
+ });
975
+ } // Suspend.
976
+ // TODO: Throwing here is an implementation detail that allows us to
977
+ // unwind the call stack. But we shouldn't allow it to leak into
978
+ // userspace. Throw an opaque placeholder value instead of the
979
+ // actual thenable. If it doesn't get captured by the work loop, log
980
+ // a warning, because that means something in userspace must have
981
+ // caught it.
982
+
983
+
984
+ throw thenable;
985
+ }
986
+ }
987
+ }
988
+
989
+ var currentRequest = null;
990
+ var thenableIndexCounter = 0;
991
+ var thenableState = null;
992
+ function prepareToUseHooksForRequest(request) {
993
+ currentRequest = request;
994
+ }
995
+ function resetHooksForRequest() {
996
+ currentRequest = null;
997
+ }
998
+ function prepareToUseHooksForComponent(prevThenableState) {
999
+ thenableIndexCounter = 0;
1000
+ thenableState = prevThenableState;
1001
+ }
1002
+ function getThenableStateAfterSuspending() {
1003
+ var state = thenableState;
1004
+ thenableState = null;
1005
+ return state;
1006
+ }
1007
+
1008
+ function readContext$1(context) {
1009
+ {
1010
+ if (context.$$typeof !== REACT_SERVER_CONTEXT_TYPE) {
1011
+ error('Only createServerContext is supported in Server Components.');
1012
+ }
1013
+
1014
+ if (currentRequest === null) {
1015
+ error('Context can only be read while React is rendering. ' + 'In classes, you can read it in the render method or getDerivedStateFromProps. ' + 'In function components, you can read it directly in the function body, but not ' + 'inside Hooks like useReducer() or useMemo().');
1016
+ }
1017
+ }
1018
+
1019
+ return readContext(context);
1020
+ }
1021
+
1022
+ var HooksDispatcher = {
1023
+ useMemo: function (nextCreate) {
1024
+ return nextCreate();
1025
+ },
1026
+ useCallback: function (callback) {
1027
+ return callback;
1028
+ },
1029
+ useDebugValue: function () {},
1030
+ useDeferredValue: unsupportedHook,
1031
+ useTransition: unsupportedHook,
1032
+ readContext: readContext$1,
1033
+ useContext: readContext$1,
1034
+ useReducer: unsupportedHook,
1035
+ useRef: unsupportedHook,
1036
+ useState: unsupportedHook,
1037
+ useInsertionEffect: unsupportedHook,
1038
+ useLayoutEffect: unsupportedHook,
1039
+ useImperativeHandle: unsupportedHook,
1040
+ useEffect: unsupportedHook,
1041
+ useId: useId,
1042
+ useMutableSource: unsupportedHook,
1043
+ useSyncExternalStore: unsupportedHook,
1044
+ useCacheRefresh: function () {
1045
+ return unsupportedRefresh;
1046
+ },
1047
+ useMemoCache: function (size) {
1048
+ var data = new Array(size);
1049
+
1050
+ for (var i = 0; i < size; i++) {
1051
+ data[i] = REACT_MEMO_CACHE_SENTINEL;
1052
+ }
1053
+
1054
+ return data;
1055
+ },
1056
+ use: use
1057
+ };
1058
+
1059
+ function unsupportedHook() {
1060
+ throw new Error('This Hook is not supported in Server Components.');
1061
+ }
1062
+
1063
+ function unsupportedRefresh() {
1064
+ throw new Error('Refreshing the cache is not supported in Server Components.');
1065
+ }
1066
+
1067
+ function useId() {
1068
+ if (currentRequest === null) {
1069
+ throw new Error('useId can only be used while React is rendering');
1070
+ }
1071
+
1072
+ var id = currentRequest.identifierCount++; // use 'S' for Flight components to distinguish from 'R' and 'r' in Fizz/Client
1073
+
1074
+ return ':' + currentRequest.identifierPrefix + 'S' + id.toString(32) + ':';
1075
+ }
1076
+
1077
+ function use(usable) {
1078
+ if (usable !== null && typeof usable === 'object') {
1079
+ // $FlowFixMe[method-unbinding]
1080
+ if (typeof usable.then === 'function') {
1081
+ // This is a thenable.
1082
+ var thenable = usable; // Track the position of the thenable within this fiber.
1083
+
1084
+ var index = thenableIndexCounter;
1085
+ thenableIndexCounter += 1;
1086
+
1087
+ if (thenableState === null) {
1088
+ thenableState = createThenableState();
1089
+ }
1090
+
1091
+ return trackUsedThenable(thenableState, thenable, index);
1092
+ } else if (usable.$$typeof === REACT_SERVER_CONTEXT_TYPE) {
1093
+ var context = usable;
1094
+ return readContext$1(context);
1095
+ }
1096
+ } // eslint-disable-next-line react-internal/safe-string-coercion
1097
+
1098
+
1099
+ throw new Error('An unsupported type was passed to use(): ' + String(usable));
1100
+ }
1101
+
1102
+ function createSignal() {
1103
+ return new AbortController().signal;
1104
+ }
1105
+
1106
+ function resolveCache() {
1107
+ if (currentCache) return currentCache;
1108
+
1109
+ {
1110
+ var cache = requestStorage.getStore();
1111
+ if (cache) return cache;
1112
+ } // Since we override the dispatcher all the time, we're effectively always
1113
+ // active and so to support cache() and fetch() outside of render, we yield
1114
+ // an empty Map.
1115
+
1116
+
1117
+ return new Map();
1118
+ }
1119
+
1120
+ var DefaultCacheDispatcher = {
1121
+ getCacheSignal: function () {
1122
+ var cache = resolveCache();
1123
+ var entry = cache.get(createSignal);
1124
+
1125
+ if (entry === undefined) {
1126
+ entry = createSignal(); // $FlowFixMe[incompatible-use] found when upgrading Flow
1127
+
1128
+ cache.set(createSignal, entry);
1129
+ }
1130
+
1131
+ return entry;
1132
+ },
1133
+ getCacheForType: function (resourceType) {
1134
+ var cache = resolveCache();
1135
+ var entry = cache.get(resourceType);
1136
+
1137
+ if (entry === undefined) {
1138
+ entry = resourceType(); // TODO: Warn if undefined?
1139
+ // $FlowFixMe[incompatible-use] found when upgrading Flow
1140
+
1141
+ cache.set(resourceType, entry);
1142
+ }
1143
+
1144
+ return entry;
1145
+ }
1146
+ };
1147
+ var currentCache = null;
1148
+ function setCurrentCache(cache) {
1149
+ currentCache = cache;
1150
+ return currentCache;
1151
+ }
1152
+ function getCurrentCache() {
1153
+ return currentCache;
1154
+ }
1155
+
1156
+ var ContextRegistry = ReactSharedInternals.ContextRegistry;
1157
+ function getOrCreateServerContext(globalName) {
1158
+ if (!ContextRegistry[globalName]) {
1159
+ ContextRegistry[globalName] = React.createServerContext(globalName, // $FlowFixMe function signature doesn't reflect the symbol value
1160
+ REACT_SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED);
1161
+ }
1162
+
1163
+ return ContextRegistry[globalName];
1164
+ }
1165
+
1166
+ var PENDING = 0;
1167
+ var COMPLETED = 1;
1168
+ var ABORTED = 3;
1169
+ var ERRORED = 4;
1170
+ var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher;
1171
+ var ReactCurrentCache = ReactSharedInternals.ReactCurrentCache;
1172
+
1173
+ function defaultErrorHandler(error) {
1174
+ console['error'](error); // Don't transform to our wrapper
1175
+ }
1176
+
1177
+ var OPEN = 0;
1178
+ var CLOSING = 1;
1179
+ var CLOSED = 2;
1180
+ function createRequest(model, bundlerConfig, onError, context, identifierPrefix) {
1181
+ if (ReactCurrentCache.current !== null && ReactCurrentCache.current !== DefaultCacheDispatcher) {
1182
+ throw new Error('Currently React only supports one RSC renderer at a time.');
1183
+ }
1184
+
1185
+ ReactCurrentCache.current = DefaultCacheDispatcher;
1186
+ var abortSet = new Set();
1187
+ var pingedTasks = [];
1188
+ var request = {
1189
+ status: OPEN,
1190
+ fatalError: null,
1191
+ destination: null,
1192
+ bundlerConfig: bundlerConfig,
1193
+ cache: new Map(),
1194
+ nextChunkId: 0,
1195
+ pendingChunks: 0,
1196
+ abortableTasks: abortSet,
1197
+ pingedTasks: pingedTasks,
1198
+ completedModuleChunks: [],
1199
+ completedJSONChunks: [],
1200
+ completedErrorChunks: [],
1201
+ writtenSymbols: new Map(),
1202
+ writtenModules: new Map(),
1203
+ writtenProviders: new Map(),
1204
+ identifierPrefix: identifierPrefix || '',
1205
+ identifierCount: 1,
1206
+ onError: onError === undefined ? defaultErrorHandler : onError,
1207
+ toJSON: function (key, value) {
1208
+ return resolveModelToJSON(request, this, key, value);
1209
+ }
1210
+ };
1211
+ request.pendingChunks++;
1212
+ var rootContext = createRootContext(context);
1213
+ var rootTask = createTask(request, model, rootContext, abortSet);
1214
+ pingedTasks.push(rootTask);
1215
+ return request;
1216
+ }
1217
+
1218
+ function createRootContext(reqContext) {
1219
+ return importServerContexts(reqContext);
1220
+ }
1221
+
1222
+ var POP = {}; // Used for DEV messages to keep track of which parent rendered some props,
1223
+ // in case they error.
1224
+
1225
+ var jsxPropsParents = new WeakMap();
1226
+ var jsxChildrenParents = new WeakMap();
1227
+
1228
+ function readThenable(thenable) {
1229
+ if (thenable.status === 'fulfilled') {
1230
+ return thenable.value;
1231
+ } else if (thenable.status === 'rejected') {
1232
+ throw thenable.reason;
1233
+ }
1234
+
1235
+ throw thenable;
1236
+ }
1237
+
1238
+ function createLazyWrapperAroundWakeable(wakeable) {
1239
+ // This is a temporary fork of the `use` implementation until we accept
1240
+ // promises everywhere.
1241
+ var thenable = wakeable;
1242
+
1243
+ switch (thenable.status) {
1244
+ case 'fulfilled':
1245
+ case 'rejected':
1246
+ break;
1247
+
1248
+ default:
1249
+ {
1250
+ if (typeof thenable.status === 'string') {
1251
+ // Only instrument the thenable if the status if not defined. If
1252
+ // it's defined, but an unknown value, assume it's been instrumented by
1253
+ // some custom userspace implementation. We treat it as "pending".
1254
+ break;
1255
+ }
1256
+
1257
+ var pendingThenable = thenable;
1258
+ pendingThenable.status = 'pending';
1259
+ pendingThenable.then(function (fulfilledValue) {
1260
+ if (thenable.status === 'pending') {
1261
+ var fulfilledThenable = thenable;
1262
+ fulfilledThenable.status = 'fulfilled';
1263
+ fulfilledThenable.value = fulfilledValue;
1264
+ }
1265
+ }, function (error) {
1266
+ if (thenable.status === 'pending') {
1267
+ var rejectedThenable = thenable;
1268
+ rejectedThenable.status = 'rejected';
1269
+ rejectedThenable.reason = error;
1270
+ }
1271
+ });
1272
+ break;
1273
+ }
1274
+ }
1275
+
1276
+ var lazyType = {
1277
+ $$typeof: REACT_LAZY_TYPE,
1278
+ _payload: thenable,
1279
+ _init: readThenable
1280
+ };
1281
+ return lazyType;
1282
+ }
1283
+
1284
+ function attemptResolveElement(type, key, ref, props, prevThenableState) {
1285
+ if (ref !== null && ref !== undefined) {
1286
+ // When the ref moves to the regular props object this will implicitly
1287
+ // throw for functions. We could probably relax it to a DEV warning for other
1288
+ // cases.
1289
+ throw new Error('Refs cannot be used in Server Components, nor passed to Client Components.');
1290
+ }
1291
+
1292
+ {
1293
+ jsxPropsParents.set(props, type);
1294
+
1295
+ if (typeof props.children === 'object') {
1296
+ jsxChildrenParents.set(props.children, type);
1297
+ }
1298
+ }
1299
+
1300
+ if (typeof type === 'function') {
1301
+ if (isModuleReference(type)) {
1302
+ // This is a reference to a Client Component.
1303
+ return [REACT_ELEMENT_TYPE, type, key, props];
1304
+ } // This is a server-side component.
1305
+
1306
+
1307
+ prepareToUseHooksForComponent(prevThenableState);
1308
+ var result = type(props);
1309
+
1310
+ if (typeof result === 'object' && result !== null && typeof result.then === 'function') {
1311
+ return createLazyWrapperAroundWakeable(result);
1312
+ }
1313
+
1314
+ return result;
1315
+ } else if (typeof type === 'string') {
1316
+ // This is a host element. E.g. HTML.
1317
+ return [REACT_ELEMENT_TYPE, type, key, props];
1318
+ } else if (typeof type === 'symbol') {
1319
+ if (type === REACT_FRAGMENT_TYPE) {
1320
+ // For key-less fragments, we add a small optimization to avoid serializing
1321
+ // it as a wrapper.
1322
+ // TODO: If a key is specified, we should propagate its key to any children.
1323
+ // Same as if a Server Component has a key.
1324
+ return props.children;
1325
+ } // This might be a built-in React component. We'll let the client decide.
1326
+ // Any built-in works as long as its props are serializable.
1327
+
1328
+
1329
+ return [REACT_ELEMENT_TYPE, type, key, props];
1330
+ } else if (type != null && typeof type === 'object') {
1331
+ if (isModuleReference(type)) {
1332
+ // This is a reference to a Client Component.
1333
+ return [REACT_ELEMENT_TYPE, type, key, props];
1334
+ }
1335
+
1336
+ switch (type.$$typeof) {
1337
+ case REACT_LAZY_TYPE:
1338
+ {
1339
+ var payload = type._payload;
1340
+ var init = type._init;
1341
+ var wrappedType = init(payload);
1342
+ return attemptResolveElement(wrappedType, key, ref, props, prevThenableState);
1343
+ }
1344
+
1345
+ case REACT_FORWARD_REF_TYPE:
1346
+ {
1347
+ var render = type.render;
1348
+ prepareToUseHooksForComponent(prevThenableState);
1349
+ return render(props, undefined);
1350
+ }
1351
+
1352
+ case REACT_MEMO_TYPE:
1353
+ {
1354
+ return attemptResolveElement(type.type, key, ref, props, prevThenableState);
1355
+ }
1356
+
1357
+ case REACT_PROVIDER_TYPE:
1358
+ {
1359
+ pushProvider(type._context, props.value);
1360
+
1361
+ {
1362
+ var extraKeys = Object.keys(props).filter(function (value) {
1363
+ if (value === 'children' || value === 'value') {
1364
+ return false;
1365
+ }
1366
+
1367
+ return true;
1368
+ });
1369
+
1370
+ if (extraKeys.length !== 0) {
1371
+ error('ServerContext can only have a value prop and children. Found: %s', JSON.stringify(extraKeys));
1372
+ }
1373
+ }
1374
+
1375
+ return [REACT_ELEMENT_TYPE, type, key, // Rely on __popProvider being serialized last to pop the provider.
1376
+ {
1377
+ value: props.value,
1378
+ children: props.children,
1379
+ __pop: POP
1380
+ }];
1381
+ }
1382
+ }
1383
+ }
1384
+
1385
+ throw new Error("Unsupported Server Component type: " + describeValueForErrorMessage(type));
1386
+ }
1387
+
1388
+ function pingTask(request, task) {
1389
+ var pingedTasks = request.pingedTasks;
1390
+ pingedTasks.push(task);
1391
+
1392
+ if (pingedTasks.length === 1) {
1393
+ scheduleWork(function () {
1394
+ return performWork(request);
1395
+ });
1396
+ }
1397
+ }
1398
+
1399
+ function createTask(request, model, context, abortSet) {
1400
+ var id = request.nextChunkId++;
1401
+ var task = {
1402
+ id: id,
1403
+ status: PENDING,
1404
+ model: model,
1405
+ context: context,
1406
+ ping: function () {
1407
+ return pingTask(request, task);
1408
+ },
1409
+ thenableState: null
1410
+ };
1411
+ abortSet.add(task);
1412
+ return task;
1413
+ }
1414
+
1415
+ function serializeByValueID(id) {
1416
+ return '$' + id.toString(16);
1417
+ }
1418
+
1419
+ function serializeByRefID(id) {
1420
+ return '@' + id.toString(16);
1421
+ }
1422
+
1423
+ function serializeModuleReference(request, parent, key, moduleReference) {
1424
+ var moduleKey = getModuleKey(moduleReference);
1425
+ var writtenModules = request.writtenModules;
1426
+ var existingId = writtenModules.get(moduleKey);
1427
+
1428
+ if (existingId !== undefined) {
1429
+ if (parent[0] === REACT_ELEMENT_TYPE && key === '1') {
1430
+ // If we're encoding the "type" of an element, we can refer
1431
+ // to that by a lazy reference instead of directly since React
1432
+ // knows how to deal with lazy values. This lets us suspend
1433
+ // on this component rather than its parent until the code has
1434
+ // loaded.
1435
+ return serializeByRefID(existingId);
1436
+ }
1437
+
1438
+ return serializeByValueID(existingId);
1439
+ }
1440
+
1441
+ try {
1442
+ var moduleMetaData = resolveModuleMetaData(request.bundlerConfig, moduleReference);
1443
+ request.pendingChunks++;
1444
+ var moduleId = request.nextChunkId++;
1445
+ emitModuleChunk(request, moduleId, moduleMetaData);
1446
+ writtenModules.set(moduleKey, moduleId);
1447
+
1448
+ if (parent[0] === REACT_ELEMENT_TYPE && key === '1') {
1449
+ // If we're encoding the "type" of an element, we can refer
1450
+ // to that by a lazy reference instead of directly since React
1451
+ // knows how to deal with lazy values. This lets us suspend
1452
+ // on this component rather than its parent until the code has
1453
+ // loaded.
1454
+ return serializeByRefID(moduleId);
1455
+ }
1456
+
1457
+ return serializeByValueID(moduleId);
1458
+ } catch (x) {
1459
+ request.pendingChunks++;
1460
+ var errorId = request.nextChunkId++;
1461
+ var digest = logRecoverableError(request, x);
1462
+
1463
+ {
1464
+ var _getErrorMessageAndSt = getErrorMessageAndStackDev(x),
1465
+ message = _getErrorMessageAndSt.message,
1466
+ stack = _getErrorMessageAndSt.stack;
1467
+
1468
+ emitErrorChunkDev(request, errorId, digest, message, stack);
1469
+ }
1470
+
1471
+ return serializeByValueID(errorId);
1472
+ }
1473
+ }
1474
+
1475
+ function escapeStringValue(value) {
1476
+ if (value[0] === '$' || value[0] === '@') {
1477
+ // We need to escape $ or @ prefixed strings since we use those to encode
1478
+ // references to IDs and as special symbol values.
1479
+ return '$' + value;
1480
+ } else {
1481
+ return value;
1482
+ }
1483
+ }
1484
+
1485
+ function isObjectPrototype(object) {
1486
+ if (!object) {
1487
+ return false;
1488
+ }
1489
+
1490
+ var ObjectPrototype = Object.prototype;
1491
+
1492
+ if (object === ObjectPrototype) {
1493
+ return true;
1494
+ } // It might be an object from a different Realm which is
1495
+ // still just a plain simple object.
1496
+
1497
+
1498
+ if (Object.getPrototypeOf(object)) {
1499
+ return false;
1500
+ }
1501
+
1502
+ var names = Object.getOwnPropertyNames(object);
1503
+
1504
+ for (var i = 0; i < names.length; i++) {
1505
+ if (!(names[i] in ObjectPrototype)) {
1506
+ return false;
1507
+ }
1508
+ }
1509
+
1510
+ return true;
1511
+ }
1512
+
1513
+ function isSimpleObject(object) {
1514
+ if (!isObjectPrototype(Object.getPrototypeOf(object))) {
1515
+ return false;
1516
+ }
1517
+
1518
+ var names = Object.getOwnPropertyNames(object);
1519
+
1520
+ for (var i = 0; i < names.length; i++) {
1521
+ var descriptor = Object.getOwnPropertyDescriptor(object, names[i]);
1522
+
1523
+ if (!descriptor) {
1524
+ return false;
1525
+ }
1526
+
1527
+ if (!descriptor.enumerable) {
1528
+ if ((names[i] === 'key' || names[i] === 'ref') && typeof descriptor.get === 'function') {
1529
+ // React adds key and ref getters to props objects to issue warnings.
1530
+ // Those getters will not be transferred to the client, but that's ok,
1531
+ // so we'll special case them.
1532
+ continue;
1533
+ }
1534
+
1535
+ return false;
1536
+ }
1537
+ }
1538
+
1539
+ return true;
1540
+ }
1541
+
1542
+ function objectName(object) {
1543
+ // $FlowFixMe[method-unbinding]
1544
+ var name = Object.prototype.toString.call(object);
1545
+ return name.replace(/^\[object (.*)\]$/, function (m, p0) {
1546
+ return p0;
1547
+ });
1548
+ }
1549
+
1550
+ function describeKeyForErrorMessage(key) {
1551
+ var encodedKey = JSON.stringify(key);
1552
+ return '"' + key + '"' === encodedKey ? key : encodedKey;
1553
+ }
1554
+
1555
+ function describeValueForErrorMessage(value) {
1556
+ switch (typeof value) {
1557
+ case 'string':
1558
+ {
1559
+ return JSON.stringify(value.length <= 10 ? value : value.substr(0, 10) + '...');
1560
+ }
1561
+
1562
+ case 'object':
1563
+ {
1564
+ if (isArray(value)) {
1565
+ return '[...]';
1566
+ }
1567
+
1568
+ var name = objectName(value);
1569
+
1570
+ if (name === 'Object') {
1571
+ return '{...}';
1572
+ }
1573
+
1574
+ return name;
1575
+ }
1576
+
1577
+ case 'function':
1578
+ return 'function';
1579
+
1580
+ default:
1581
+ // eslint-disable-next-line react-internal/safe-string-coercion
1582
+ return String(value);
1583
+ }
1584
+ }
1585
+
1586
+ function describeElementType(type) {
1587
+ if (typeof type === 'string') {
1588
+ return type;
1589
+ }
1590
+
1591
+ switch (type) {
1592
+ case REACT_SUSPENSE_TYPE:
1593
+ return 'Suspense';
1594
+
1595
+ case REACT_SUSPENSE_LIST_TYPE:
1596
+ return 'SuspenseList';
1597
+ }
1598
+
1599
+ if (typeof type === 'object') {
1600
+ switch (type.$$typeof) {
1601
+ case REACT_FORWARD_REF_TYPE:
1602
+ return describeElementType(type.render);
1603
+
1604
+ case REACT_MEMO_TYPE:
1605
+ return describeElementType(type.type);
1606
+
1607
+ case REACT_LAZY_TYPE:
1608
+ {
1609
+ var lazyComponent = type;
1610
+ var payload = lazyComponent._payload;
1611
+ var init = lazyComponent._init;
1612
+
1613
+ try {
1614
+ // Lazy may contain any component type so we recursively resolve it.
1615
+ return describeElementType(init(payload));
1616
+ } catch (x) {}
1617
+ }
1618
+ }
1619
+ }
1620
+
1621
+ return '';
1622
+ }
1623
+
1624
+ function describeObjectForErrorMessage(objectOrArray, expandedName) {
1625
+ var objKind = objectName(objectOrArray);
1626
+
1627
+ if (objKind !== 'Object' && objKind !== 'Array') {
1628
+ return objKind;
1629
+ }
1630
+
1631
+ var str = '';
1632
+ var start = -1;
1633
+ var length = 0;
1634
+
1635
+ if (isArray(objectOrArray)) {
1636
+ if ( jsxChildrenParents.has(objectOrArray)) {
1637
+ // Print JSX Children
1638
+ var type = jsxChildrenParents.get(objectOrArray);
1639
+ str = '<' + describeElementType(type) + '>';
1640
+ var array = objectOrArray;
1641
+
1642
+ for (var i = 0; i < array.length; i++) {
1643
+ var _value = array[i];
1644
+ var substr = void 0;
1645
+
1646
+ if (typeof _value === 'string') {
1647
+ substr = _value;
1648
+ } else if (typeof _value === 'object' && _value !== null) {
1649
+ // $FlowFixMe[incompatible-call] found when upgrading Flow
1650
+ substr = '{' + describeObjectForErrorMessage(_value) + '}';
1651
+ } else {
1652
+ substr = '{' + describeValueForErrorMessage(_value) + '}';
1653
+ }
1654
+
1655
+ if ('' + i === expandedName) {
1656
+ start = str.length;
1657
+ length = substr.length;
1658
+ str += substr;
1659
+ } else if (substr.length < 15 && str.length + substr.length < 40) {
1660
+ str += substr;
1661
+ } else {
1662
+ str += '{...}';
1663
+ }
1664
+ }
1665
+
1666
+ str += '</' + describeElementType(type) + '>';
1667
+ } else {
1668
+ // Print Array
1669
+ str = '[';
1670
+ var _array = objectOrArray;
1671
+
1672
+ for (var _i = 0; _i < _array.length; _i++) {
1673
+ if (_i > 0) {
1674
+ str += ', ';
1675
+ }
1676
+
1677
+ var _value2 = _array[_i];
1678
+
1679
+ var _substr = void 0;
1680
+
1681
+ if (typeof _value2 === 'object' && _value2 !== null) {
1682
+ // $FlowFixMe[incompatible-call] found when upgrading Flow
1683
+ _substr = describeObjectForErrorMessage(_value2);
1684
+ } else {
1685
+ _substr = describeValueForErrorMessage(_value2);
1686
+ }
1687
+
1688
+ if ('' + _i === expandedName) {
1689
+ start = str.length;
1690
+ length = _substr.length;
1691
+ str += _substr;
1692
+ } else if (_substr.length < 10 && str.length + _substr.length < 40) {
1693
+ str += _substr;
1694
+ } else {
1695
+ str += '...';
1696
+ }
1697
+ }
1698
+
1699
+ str += ']';
1700
+ }
1701
+ } else {
1702
+ if (objectOrArray.$$typeof === REACT_ELEMENT_TYPE) {
1703
+ str = '<' + describeElementType(objectOrArray.type) + '/>';
1704
+ } else if ( jsxPropsParents.has(objectOrArray)) {
1705
+ // Print JSX
1706
+ var _type = jsxPropsParents.get(objectOrArray);
1707
+
1708
+ str = '<' + (describeElementType(_type) || '...');
1709
+ var object = objectOrArray;
1710
+ var names = Object.keys(object);
1711
+
1712
+ for (var _i2 = 0; _i2 < names.length; _i2++) {
1713
+ str += ' ';
1714
+ var name = names[_i2];
1715
+ str += describeKeyForErrorMessage(name) + '=';
1716
+ var _value3 = object[name];
1717
+
1718
+ var _substr2 = void 0;
1719
+
1720
+ if (name === expandedName && typeof _value3 === 'object' && _value3 !== null) {
1721
+ // $FlowFixMe[incompatible-call] found when upgrading Flow
1722
+ _substr2 = describeObjectForErrorMessage(_value3);
1723
+ } else {
1724
+ _substr2 = describeValueForErrorMessage(_value3);
1725
+ }
1726
+
1727
+ if (typeof _value3 !== 'string') {
1728
+ _substr2 = '{' + _substr2 + '}';
1729
+ }
1730
+
1731
+ if (name === expandedName) {
1732
+ start = str.length;
1733
+ length = _substr2.length;
1734
+ str += _substr2;
1735
+ } else if (_substr2.length < 10 && str.length + _substr2.length < 40) {
1736
+ str += _substr2;
1737
+ } else {
1738
+ str += '...';
1739
+ }
1740
+ }
1741
+
1742
+ str += '>';
1743
+ } else {
1744
+ // Print Object
1745
+ str = '{';
1746
+ var _object = objectOrArray;
1747
+
1748
+ var _names = Object.keys(_object);
1749
+
1750
+ for (var _i3 = 0; _i3 < _names.length; _i3++) {
1751
+ if (_i3 > 0) {
1752
+ str += ', ';
1753
+ }
1754
+
1755
+ var _name = _names[_i3];
1756
+ str += describeKeyForErrorMessage(_name) + ': ';
1757
+ var _value4 = _object[_name];
1758
+
1759
+ var _substr3 = void 0;
1760
+
1761
+ if (typeof _value4 === 'object' && _value4 !== null) {
1762
+ // $FlowFixMe[incompatible-call] found when upgrading Flow
1763
+ _substr3 = describeObjectForErrorMessage(_value4);
1764
+ } else {
1765
+ _substr3 = describeValueForErrorMessage(_value4);
1766
+ }
1767
+
1768
+ if (_name === expandedName) {
1769
+ start = str.length;
1770
+ length = _substr3.length;
1771
+ str += _substr3;
1772
+ } else if (_substr3.length < 10 && str.length + _substr3.length < 40) {
1773
+ str += _substr3;
1774
+ } else {
1775
+ str += '...';
1776
+ }
1777
+ }
1778
+
1779
+ str += '}';
1780
+ }
1781
+ }
1782
+
1783
+ if (expandedName === undefined) {
1784
+ return str;
1785
+ }
1786
+
1787
+ if (start > -1 && length > 0) {
1788
+ var highlight = ' '.repeat(start) + '^'.repeat(length);
1789
+ return '\n ' + str + '\n ' + highlight;
1790
+ }
1791
+
1792
+ return '\n ' + str;
1793
+ }
1794
+
1795
+ var insideContextProps = null;
1796
+ var isInsideContextValue = false;
1797
+ function resolveModelToJSON(request, parent, key, value) {
1798
+ {
1799
+ // $FlowFixMe
1800
+ var originalValue = parent[key];
1801
+
1802
+ if (typeof originalValue === 'object' && originalValue !== value) {
1803
+ if (objectName(originalValue) !== 'Object') {
1804
+ var jsxParentType = jsxChildrenParents.get(parent);
1805
+
1806
+ if (typeof jsxParentType === 'string') {
1807
+ error('%s objects cannot be rendered as text children. Try formatting it using toString().%s', objectName(originalValue), describeObjectForErrorMessage(parent, key));
1808
+ } else {
1809
+ error('Only plain objects can be passed to Client Components from Server Components. ' + '%s objects are not supported.%s', objectName(originalValue), describeObjectForErrorMessage(parent, key));
1810
+ }
1811
+ } else {
1812
+ error('Only plain objects can be passed to Client Components from Server Components. ' + 'Objects with toJSON methods are not supported. Convert it manually ' + 'to a simple value before passing it to props.%s', describeObjectForErrorMessage(parent, key));
1813
+ }
1814
+ }
1815
+ } // Special Symbols
1816
+
1817
+
1818
+ switch (value) {
1819
+ case REACT_ELEMENT_TYPE:
1820
+ return '$';
1821
+ }
1822
+
1823
+ {
1824
+ if (parent[0] === REACT_ELEMENT_TYPE && parent[1] && parent[1].$$typeof === REACT_PROVIDER_TYPE && key === '3') {
1825
+ insideContextProps = value;
1826
+ } else if (insideContextProps === parent && key === 'value') {
1827
+ isInsideContextValue = true;
1828
+ } else if (insideContextProps === parent && key === 'children') {
1829
+ isInsideContextValue = false;
1830
+ }
1831
+ } // Resolve Server Components.
1832
+
1833
+
1834
+ while (typeof value === 'object' && value !== null && (value.$$typeof === REACT_ELEMENT_TYPE || value.$$typeof === REACT_LAZY_TYPE)) {
1835
+ {
1836
+ if (isInsideContextValue) {
1837
+ error('React elements are not allowed in ServerContext');
1838
+ }
1839
+ }
1840
+
1841
+ try {
1842
+ switch (value.$$typeof) {
1843
+ case REACT_ELEMENT_TYPE:
1844
+ {
1845
+ // TODO: Concatenate keys of parents onto children.
1846
+ var element = value; // Attempt to render the Server Component.
1847
+
1848
+ value = attemptResolveElement(element.type, element.key, element.ref, element.props, null);
1849
+ break;
1850
+ }
1851
+
1852
+ case REACT_LAZY_TYPE:
1853
+ {
1854
+ var payload = value._payload;
1855
+ var init = value._init;
1856
+ value = init(payload);
1857
+ break;
1858
+ }
1859
+ }
1860
+ } catch (x) {
1861
+ if (typeof x === 'object' && x !== null && typeof x.then === 'function') {
1862
+ // Something suspended, we'll need to create a new task and resolve it later.
1863
+ request.pendingChunks++;
1864
+ var newTask = createTask(request, value, getActiveContext(), request.abortableTasks);
1865
+ var ping = newTask.ping;
1866
+ x.then(ping, ping);
1867
+ newTask.thenableState = getThenableStateAfterSuspending();
1868
+ return serializeByRefID(newTask.id);
1869
+ } else {
1870
+ // Something errored. We'll still send everything we have up until this point.
1871
+ // We'll replace this element with a lazy reference that throws on the client
1872
+ // once it gets rendered.
1873
+ request.pendingChunks++;
1874
+ var errorId = request.nextChunkId++;
1875
+ var digest = logRecoverableError(request, x);
1876
+
1877
+ {
1878
+ var _getErrorMessageAndSt2 = getErrorMessageAndStackDev(x),
1879
+ message = _getErrorMessageAndSt2.message,
1880
+ stack = _getErrorMessageAndSt2.stack;
1881
+
1882
+ emitErrorChunkDev(request, errorId, digest, message, stack);
1883
+ }
1884
+
1885
+ return serializeByRefID(errorId);
1886
+ }
1887
+ }
1888
+ }
1889
+
1890
+ if (value === null) {
1891
+ return null;
1892
+ }
1893
+
1894
+ if (typeof value === 'object') {
1895
+ if (isModuleReference(value)) {
1896
+ return serializeModuleReference(request, parent, key, value);
1897
+ } else if (value.$$typeof === REACT_PROVIDER_TYPE) {
1898
+ var providerKey = value._context._globalName;
1899
+ var writtenProviders = request.writtenProviders;
1900
+ var providerId = writtenProviders.get(key);
1901
+
1902
+ if (providerId === undefined) {
1903
+ request.pendingChunks++;
1904
+ providerId = request.nextChunkId++;
1905
+ writtenProviders.set(providerKey, providerId);
1906
+ emitProviderChunk(request, providerId, providerKey);
1907
+ }
1908
+
1909
+ return serializeByValueID(providerId);
1910
+ } else if (value === POP) {
1911
+ popProvider();
1912
+
1913
+ {
1914
+ insideContextProps = null;
1915
+ isInsideContextValue = false;
1916
+ }
1917
+
1918
+ return undefined;
1919
+ }
1920
+
1921
+ {
1922
+ if (value !== null && !isArray(value)) {
1923
+ // Verify that this is a simple plain object.
1924
+ if (objectName(value) !== 'Object') {
1925
+ error('Only plain objects can be passed to Client Components from Server Components. ' + '%s objects are not supported.%s', objectName(value), describeObjectForErrorMessage(parent, key));
1926
+ } else if (!isSimpleObject(value)) {
1927
+ error('Only plain objects can be passed to Client Components from Server Components. ' + 'Classes or other objects with methods are not supported.%s', describeObjectForErrorMessage(parent, key));
1928
+ } else if (Object.getOwnPropertySymbols) {
1929
+ var symbols = Object.getOwnPropertySymbols(value);
1930
+
1931
+ if (symbols.length > 0) {
1932
+ error('Only plain objects can be passed to Client Components from Server Components. ' + 'Objects with symbol properties like %s are not supported.%s', symbols[0].description, describeObjectForErrorMessage(parent, key));
1933
+ }
1934
+ }
1935
+ }
1936
+ } // $FlowFixMe
1937
+
1938
+
1939
+ return value;
1940
+ }
1941
+
1942
+ if (typeof value === 'string') {
1943
+ return escapeStringValue(value);
1944
+ }
1945
+
1946
+ if (typeof value === 'boolean' || typeof value === 'number' || typeof value === 'undefined') {
1947
+ return value;
1948
+ }
1949
+
1950
+ if (typeof value === 'function') {
1951
+ if (isModuleReference(value)) {
1952
+ return serializeModuleReference(request, parent, key, value);
1953
+ }
1954
+
1955
+ if (/^on[A-Z]/.test(key)) {
1956
+ throw new Error('Event handlers cannot be passed to Client Component props.' + describeObjectForErrorMessage(parent, key) + '\nIf you need interactivity, consider converting part of this to a Client Component.');
1957
+ } else {
1958
+ throw new Error('Functions cannot be passed directly to Client Components ' + "because they're not serializable." + describeObjectForErrorMessage(parent, key));
1959
+ }
1960
+ }
1961
+
1962
+ if (typeof value === 'symbol') {
1963
+ var writtenSymbols = request.writtenSymbols;
1964
+ var existingId = writtenSymbols.get(value);
1965
+
1966
+ if (existingId !== undefined) {
1967
+ return serializeByValueID(existingId);
1968
+ } // $FlowFixMe `description` might be undefined
1969
+
1970
+
1971
+ var name = value.description;
1972
+
1973
+ if (Symbol.for(name) !== value) {
1974
+ throw new Error('Only global symbols received from Symbol.for(...) can be passed to Client Components. ' + ("The symbol Symbol.for(" + // $FlowFixMe `description` might be undefined
1975
+ value.description + ") cannot be found among global symbols.") + describeObjectForErrorMessage(parent, key));
1976
+ }
1977
+
1978
+ request.pendingChunks++;
1979
+ var symbolId = request.nextChunkId++;
1980
+ emitSymbolChunk(request, symbolId, name);
1981
+ writtenSymbols.set(value, symbolId);
1982
+ return serializeByValueID(symbolId);
1983
+ } // $FlowFixMe: bigint isn't added to Flow yet.
1984
+
1985
+
1986
+ if (typeof value === 'bigint') {
1987
+ throw new Error("BigInt (" + value + ") is not yet supported in Client Component props." + describeObjectForErrorMessage(parent, key));
1988
+ }
1989
+
1990
+ throw new Error("Type " + typeof value + " is not supported in Client Component props." + describeObjectForErrorMessage(parent, key));
1991
+ }
1992
+
1993
+ function logRecoverableError(request, error) {
1994
+ var onError = request.onError;
1995
+ var errorDigest = onError(error);
1996
+
1997
+ if (errorDigest != null && typeof errorDigest !== 'string') {
1998
+ // eslint-disable-next-line react-internal/prod-error-codes
1999
+ throw new Error("onError returned something with a type other than \"string\". onError should return a string and may return null or undefined but must not return anything else. It received something of type \"" + typeof errorDigest + "\" instead");
2000
+ }
2001
+
2002
+ return errorDigest || '';
2003
+ }
2004
+
2005
+ function getErrorMessageAndStackDev(error) {
2006
+ {
2007
+ var message;
2008
+ var stack = '';
2009
+
2010
+ try {
2011
+ if (error instanceof Error) {
2012
+ // eslint-disable-next-line react-internal/safe-string-coercion
2013
+ message = String(error.message); // eslint-disable-next-line react-internal/safe-string-coercion
2014
+
2015
+ stack = String(error.stack);
2016
+ } else {
2017
+ message = 'Error: ' + error;
2018
+ }
2019
+ } catch (x) {
2020
+ message = 'An error occurred but serializing the error message failed.';
2021
+ }
2022
+
2023
+ return {
2024
+ message: message,
2025
+ stack: stack
2026
+ };
2027
+ }
2028
+ }
2029
+
2030
+ function fatalError(request, error) {
2031
+ // This is called outside error handling code such as if an error happens in React internals.
2032
+ if (request.destination !== null) {
2033
+ request.status = CLOSED;
2034
+ closeWithError(request.destination, error);
2035
+ } else {
2036
+ request.status = CLOSING;
2037
+ request.fatalError = error;
2038
+ }
2039
+ }
2040
+
2041
+ function emitErrorChunkProd(request, id, digest) {
2042
+ var processedChunk = processErrorChunkProd(request, id, digest);
2043
+ request.completedErrorChunks.push(processedChunk);
2044
+ }
2045
+
2046
+ function emitErrorChunkDev(request, id, digest, message, stack) {
2047
+ var processedChunk = processErrorChunkDev(request, id, digest, message, stack);
2048
+ request.completedErrorChunks.push(processedChunk);
2049
+ }
2050
+
2051
+ function emitModuleChunk(request, id, moduleMetaData) {
2052
+ var processedChunk = processModuleChunk(request, id, moduleMetaData);
2053
+ request.completedModuleChunks.push(processedChunk);
2054
+ }
2055
+
2056
+ function emitSymbolChunk(request, id, name) {
2057
+ var processedChunk = processSymbolChunk(request, id, name);
2058
+ request.completedModuleChunks.push(processedChunk);
2059
+ }
2060
+
2061
+ function emitProviderChunk(request, id, contextName) {
2062
+ var processedChunk = processProviderChunk(request, id, contextName);
2063
+ request.completedJSONChunks.push(processedChunk);
2064
+ }
2065
+
2066
+ function retryTask(request, task) {
2067
+ if (task.status !== PENDING) {
2068
+ // We completed this by other means before we had a chance to retry it.
2069
+ return;
2070
+ }
2071
+
2072
+ switchContext(task.context);
2073
+
2074
+ try {
2075
+ var _value5 = task.model;
2076
+
2077
+ if (typeof _value5 === 'object' && _value5 !== null && _value5.$$typeof === REACT_ELEMENT_TYPE) {
2078
+ // TODO: Concatenate keys of parents onto children.
2079
+ var element = _value5; // When retrying a component, reuse the thenableState from the
2080
+ // previous attempt.
2081
+
2082
+ var prevThenableState = task.thenableState; // Attempt to render the Server Component.
2083
+ // Doing this here lets us reuse this same task if the next component
2084
+ // also suspends.
2085
+
2086
+ task.model = _value5;
2087
+ _value5 = attemptResolveElement(element.type, element.key, element.ref, element.props, prevThenableState); // Successfully finished this component. We're going to keep rendering
2088
+ // using the same task, but we reset its thenable state before continuing.
2089
+
2090
+ task.thenableState = null; // Keep rendering and reuse the same task. This inner loop is separate
2091
+ // from the render above because we don't need to reset the thenable state
2092
+ // until the next time something suspends and retries.
2093
+
2094
+ while (typeof _value5 === 'object' && _value5 !== null && _value5.$$typeof === REACT_ELEMENT_TYPE) {
2095
+ // TODO: Concatenate keys of parents onto children.
2096
+ var nextElement = _value5;
2097
+ task.model = _value5;
2098
+ _value5 = attemptResolveElement(nextElement.type, nextElement.key, nextElement.ref, nextElement.props, null);
2099
+ }
2100
+ }
2101
+
2102
+ var processedChunk = processModelChunk(request, task.id, _value5);
2103
+ request.completedJSONChunks.push(processedChunk);
2104
+ request.abortableTasks.delete(task);
2105
+ task.status = COMPLETED;
2106
+ } catch (x) {
2107
+ if (typeof x === 'object' && x !== null && typeof x.then === 'function') {
2108
+ // Something suspended again, let's pick it back up later.
2109
+ var ping = task.ping;
2110
+ x.then(ping, ping);
2111
+ task.thenableState = getThenableStateAfterSuspending();
2112
+ return;
2113
+ } else {
2114
+ request.abortableTasks.delete(task);
2115
+ task.status = ERRORED;
2116
+ var digest = logRecoverableError(request, x);
2117
+
2118
+ {
2119
+ var _getErrorMessageAndSt3 = getErrorMessageAndStackDev(x),
2120
+ message = _getErrorMessageAndSt3.message,
2121
+ stack = _getErrorMessageAndSt3.stack;
2122
+
2123
+ emitErrorChunkDev(request, task.id, digest, message, stack);
2124
+ }
2125
+ }
2126
+ }
2127
+ }
2128
+
2129
+ function performWork(request) {
2130
+ var prevDispatcher = ReactCurrentDispatcher.current;
2131
+ var prevCache = getCurrentCache();
2132
+ ReactCurrentDispatcher.current = HooksDispatcher;
2133
+ setCurrentCache(request.cache);
2134
+ prepareToUseHooksForRequest(request);
2135
+
2136
+ try {
2137
+ var pingedTasks = request.pingedTasks;
2138
+ request.pingedTasks = [];
2139
+
2140
+ for (var i = 0; i < pingedTasks.length; i++) {
2141
+ var task = pingedTasks[i];
2142
+ retryTask(request, task);
2143
+ }
2144
+
2145
+ if (request.destination !== null) {
2146
+ flushCompletedChunks(request, request.destination);
2147
+ }
2148
+ } catch (error) {
2149
+ logRecoverableError(request, error);
2150
+ fatalError(request, error);
2151
+ } finally {
2152
+ ReactCurrentDispatcher.current = prevDispatcher;
2153
+ setCurrentCache(prevCache);
2154
+ resetHooksForRequest();
2155
+ }
2156
+ }
2157
+
2158
+ function abortTask(task, request, errorId) {
2159
+ task.status = ABORTED; // Instead of emitting an error per task.id, we emit a model that only
2160
+ // has a single value referencing the error.
2161
+
2162
+ var ref = serializeByValueID(errorId);
2163
+ var processedChunk = processReferenceChunk(request, task.id, ref);
2164
+ request.completedErrorChunks.push(processedChunk);
2165
+ }
2166
+
2167
+ function flushCompletedChunks(request, destination) {
2168
+ beginWriting();
2169
+
2170
+ try {
2171
+ // We emit module chunks first in the stream so that
2172
+ // they can be preloaded as early as possible.
2173
+ var moduleChunks = request.completedModuleChunks;
2174
+ var i = 0;
2175
+
2176
+ for (; i < moduleChunks.length; i++) {
2177
+ request.pendingChunks--;
2178
+ var chunk = moduleChunks[i];
2179
+ var keepWriting = writeChunkAndReturn(destination, chunk);
2180
+
2181
+ if (!keepWriting) {
2182
+ request.destination = null;
2183
+ i++;
2184
+ break;
2185
+ }
2186
+ }
2187
+
2188
+ moduleChunks.splice(0, i); // Next comes model data.
2189
+
2190
+ var jsonChunks = request.completedJSONChunks;
2191
+ i = 0;
2192
+
2193
+ for (; i < jsonChunks.length; i++) {
2194
+ request.pendingChunks--;
2195
+ var _chunk = jsonChunks[i];
2196
+
2197
+ var _keepWriting = writeChunkAndReturn(destination, _chunk);
2198
+
2199
+ if (!_keepWriting) {
2200
+ request.destination = null;
2201
+ i++;
2202
+ break;
2203
+ }
2204
+ }
2205
+
2206
+ jsonChunks.splice(0, i); // Finally, errors are sent. The idea is that it's ok to delay
2207
+ // any error messages and prioritize display of other parts of
2208
+ // the page.
2209
+
2210
+ var errorChunks = request.completedErrorChunks;
2211
+ i = 0;
2212
+
2213
+ for (; i < errorChunks.length; i++) {
2214
+ request.pendingChunks--;
2215
+ var _chunk2 = errorChunks[i];
2216
+
2217
+ var _keepWriting2 = writeChunkAndReturn(destination, _chunk2);
2218
+
2219
+ if (!_keepWriting2) {
2220
+ request.destination = null;
2221
+ i++;
2222
+ break;
2223
+ }
2224
+ }
2225
+
2226
+ errorChunks.splice(0, i);
2227
+ } finally {
2228
+ completeWriting(destination);
2229
+ }
2230
+
2231
+ flushBuffered(destination);
2232
+
2233
+ if (request.pendingChunks === 0) {
2234
+ // We're done.
2235
+ close(destination);
2236
+ }
2237
+ }
2238
+
2239
+ function startWork(request) {
2240
+ {
2241
+ scheduleWork(function () {
2242
+ return requestStorage.run(request.cache, performWork, request);
2243
+ });
2244
+ }
2245
+ }
2246
+ function startFlowing(request, destination) {
2247
+ if (request.status === CLOSING) {
2248
+ request.status = CLOSED;
2249
+ closeWithError(destination, request.fatalError);
2250
+ return;
2251
+ }
2252
+
2253
+ if (request.status === CLOSED) {
2254
+ return;
2255
+ }
2256
+
2257
+ if (request.destination !== null) {
2258
+ // We're already flowing.
2259
+ return;
2260
+ }
2261
+
2262
+ request.destination = destination;
2263
+
2264
+ try {
2265
+ flushCompletedChunks(request, destination);
2266
+ } catch (error) {
2267
+ logRecoverableError(request, error);
2268
+ fatalError(request, error);
2269
+ }
2270
+ } // This is called to early terminate a request. It creates an error at all pending tasks.
2271
+
2272
+ function abort(request, reason) {
2273
+ try {
2274
+ var abortableTasks = request.abortableTasks;
2275
+
2276
+ if (abortableTasks.size > 0) {
2277
+ // We have tasks to abort. We'll emit one error row and then emit a reference
2278
+ // to that row from every row that's still remaining.
2279
+ var _error = reason === undefined ? new Error('The render was aborted by the server without a reason.') : reason;
2280
+
2281
+ var digest = logRecoverableError(request, _error);
2282
+ request.pendingChunks++;
2283
+ var errorId = request.nextChunkId++;
2284
+
2285
+ if (true) {
2286
+ var _getErrorMessageAndSt4 = getErrorMessageAndStackDev(_error),
2287
+ message = _getErrorMessageAndSt4.message,
2288
+ stack = _getErrorMessageAndSt4.stack;
2289
+
2290
+ emitErrorChunkDev(request, errorId, digest, message, stack);
2291
+ } else {
2292
+ emitErrorChunkProd(request, errorId, digest);
2293
+ }
2294
+
2295
+ abortableTasks.forEach(function (task) {
2296
+ return abortTask(task, request, errorId);
2297
+ });
2298
+ abortableTasks.clear();
2299
+ }
2300
+
2301
+ if (request.destination !== null) {
2302
+ flushCompletedChunks(request, request.destination);
2303
+ }
2304
+ } catch (error) {
2305
+ logRecoverableError(request, error);
2306
+ fatalError(request, error);
2307
+ }
2308
+ }
2309
+
2310
+ function importServerContexts(contexts) {
2311
+ if (contexts) {
2312
+ var prevContext = getActiveContext();
2313
+ switchContext(rootContextSnapshot);
2314
+
2315
+ for (var i = 0; i < contexts.length; i++) {
2316
+ var _contexts$i = contexts[i],
2317
+ name = _contexts$i[0],
2318
+ _value6 = _contexts$i[1];
2319
+ var context = getOrCreateServerContext(name);
2320
+ pushProvider(context, _value6);
2321
+ }
2322
+
2323
+ var importedContext = getActiveContext();
2324
+ switchContext(prevContext);
2325
+ return importedContext;
2326
+ }
2327
+
2328
+ return rootContextSnapshot;
2329
+ }
2330
+
2331
+ function createDrainHandler(destination, request) {
2332
+ return function () {
2333
+ return startFlowing(request, destination);
2334
+ };
2335
+ }
2336
+
2337
+ function renderToPipeableStream(model, webpackMap, options) {
2338
+ var request = createRequest(model, webpackMap, options ? options.onError : undefined, options ? options.context : undefined, options ? options.identifierPrefix : undefined);
2339
+ var hasStartedFlowing = false;
2340
+ startWork(request);
2341
+ return {
2342
+ pipe: function (destination) {
2343
+ if (hasStartedFlowing) {
2344
+ throw new Error('React currently only supports piping to one writable stream.');
2345
+ }
2346
+
2347
+ hasStartedFlowing = true;
2348
+ startFlowing(request, destination);
2349
+ destination.on('drain', createDrainHandler(destination, request));
2350
+ return destination;
2351
+ },
2352
+ abort: function (reason) {
2353
+ abort(request, reason);
2354
+ }
2355
+ };
2356
+ }
2357
+
2358
+ exports.renderToPipeableStream = renderToPipeableStream;
2359
+ })();
2360
+ }