@modern-js/utils 2.65.1 → 2.65.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/dist/compiled/react-server-dom-webpack/LICENSE +21 -0
  2. package/dist/compiled/react-server-dom-webpack/README.md +5 -0
  3. package/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.browser.development.js +2553 -0
  4. package/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.browser.production.js +1637 -0
  5. package/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.edge.development.js +2709 -0
  6. package/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.edge.production.js +1800 -0
  7. package/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.node.development.js +2752 -0
  8. package/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.node.production.js +1849 -0
  9. package/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.node.unbundled.development.js +2714 -0
  10. package/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.node.unbundled.production.js +1814 -0
  11. package/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-node-register.js +69 -0
  12. package/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-plugin.js +399 -0
  13. package/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.browser.development.js +3782 -0
  14. package/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.browser.production.js +2777 -0
  15. package/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.development.js +3812 -0
  16. package/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.production.js +2779 -0
  17. package/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.development.js +3869 -0
  18. package/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.production.js +2871 -0
  19. package/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.unbundled.development.js +3832 -0
  20. package/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.unbundled.production.js +2837 -0
  21. package/dist/compiled/react-server-dom-webpack/client.browser.js +7 -0
  22. package/dist/compiled/react-server-dom-webpack/client.edge.js +7 -0
  23. package/dist/compiled/react-server-dom-webpack/client.js +3 -0
  24. package/dist/compiled/react-server-dom-webpack/client.node.js +7 -0
  25. package/dist/compiled/react-server-dom-webpack/client.node.unbundled.js +7 -0
  26. package/dist/compiled/react-server-dom-webpack/index.js +12 -0
  27. package/dist/compiled/react-server-dom-webpack/package.json +111 -0
  28. package/dist/compiled/react-server-dom-webpack/server.browser.js +17 -0
  29. package/dist/compiled/react-server-dom-webpack/server.edge.js +17 -0
  30. package/dist/compiled/react-server-dom-webpack/server.js +6 -0
  31. package/dist/compiled/react-server-dom-webpack/server.node.js +18 -0
  32. package/dist/compiled/react-server-dom-webpack/server.node.unbundled.js +18 -0
  33. package/package.json +34 -5
@@ -0,0 +1,3832 @@
1
+ /**
2
+ * @license React
3
+ * react-server-dom-webpack-server.node.unbundled.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
+ "production" !== process.env.NODE_ENV &&
13
+ (function () {
14
+ function voidHandler() {}
15
+ function _defineProperty(obj, key, value) {
16
+ key in obj
17
+ ? Object.defineProperty(obj, key, {
18
+ value: value,
19
+ enumerable: !0,
20
+ configurable: !0,
21
+ writable: !0
22
+ })
23
+ : (obj[key] = value);
24
+ return obj;
25
+ }
26
+ function writeToDestination(destination, view) {
27
+ destination = destination.write(view);
28
+ destinationHasCapacity = destinationHasCapacity && destination;
29
+ }
30
+ function writeChunkAndReturn(destination, chunk) {
31
+ if ("string" === typeof chunk) {
32
+ if (0 !== chunk.length)
33
+ if (2048 < 3 * chunk.length)
34
+ 0 < writtenBytes &&
35
+ (writeToDestination(
36
+ destination,
37
+ currentView.subarray(0, writtenBytes)
38
+ ),
39
+ (currentView = new Uint8Array(2048)),
40
+ (writtenBytes = 0)),
41
+ writeToDestination(destination, chunk);
42
+ else {
43
+ var target = currentView;
44
+ 0 < writtenBytes && (target = currentView.subarray(writtenBytes));
45
+ target = textEncoder.encodeInto(chunk, target);
46
+ var read = target.read;
47
+ writtenBytes += target.written;
48
+ read < chunk.length &&
49
+ (writeToDestination(
50
+ destination,
51
+ currentView.subarray(0, writtenBytes)
52
+ ),
53
+ (currentView = new Uint8Array(2048)),
54
+ (writtenBytes = textEncoder.encodeInto(
55
+ chunk.slice(read),
56
+ currentView
57
+ ).written));
58
+ 2048 === writtenBytes &&
59
+ (writeToDestination(destination, currentView),
60
+ (currentView = new Uint8Array(2048)),
61
+ (writtenBytes = 0));
62
+ }
63
+ } else
64
+ 0 !== chunk.byteLength &&
65
+ (2048 < chunk.byteLength
66
+ ? (0 < writtenBytes &&
67
+ (writeToDestination(
68
+ destination,
69
+ currentView.subarray(0, writtenBytes)
70
+ ),
71
+ (currentView = new Uint8Array(2048)),
72
+ (writtenBytes = 0)),
73
+ writeToDestination(destination, chunk))
74
+ : ((target = currentView.length - writtenBytes),
75
+ target < chunk.byteLength &&
76
+ (0 === target
77
+ ? writeToDestination(destination, currentView)
78
+ : (currentView.set(chunk.subarray(0, target), writtenBytes),
79
+ (writtenBytes += target),
80
+ writeToDestination(destination, currentView),
81
+ (chunk = chunk.subarray(target))),
82
+ (currentView = new Uint8Array(2048)),
83
+ (writtenBytes = 0)),
84
+ currentView.set(chunk, writtenBytes),
85
+ (writtenBytes += chunk.byteLength),
86
+ 2048 === writtenBytes &&
87
+ (writeToDestination(destination, currentView),
88
+ (currentView = new Uint8Array(2048)),
89
+ (writtenBytes = 0))));
90
+ return destinationHasCapacity;
91
+ }
92
+ function byteLengthOfChunk(chunk) {
93
+ return "string" === typeof chunk
94
+ ? Buffer.byteLength(chunk, "utf8")
95
+ : chunk.byteLength;
96
+ }
97
+ function isClientReference(reference) {
98
+ return reference.$$typeof === CLIENT_REFERENCE_TAG$1;
99
+ }
100
+ function registerClientReferenceImpl(proxyImplementation, id, async) {
101
+ return Object.defineProperties(proxyImplementation, {
102
+ $$typeof: { value: CLIENT_REFERENCE_TAG$1 },
103
+ $$id: { value: id },
104
+ $$async: { value: async }
105
+ });
106
+ }
107
+ function bind() {
108
+ var newFn = FunctionBind.apply(this, arguments);
109
+ if (this.$$typeof === SERVER_REFERENCE_TAG) {
110
+ null != arguments[0] &&
111
+ console.error(
112
+ 'Cannot bind "this" of a Server Action. Pass null or undefined as the first argument to .bind().'
113
+ );
114
+ var args = ArraySlice.call(arguments, 1),
115
+ $$typeof = { value: SERVER_REFERENCE_TAG },
116
+ $$id = { value: this.$$id };
117
+ args = { value: this.$$bound ? this.$$bound.concat(args) : args };
118
+ return Object.defineProperties(newFn, {
119
+ $$typeof: $$typeof,
120
+ $$id: $$id,
121
+ $$bound: args,
122
+ $$location: { value: this.$$location, configurable: !0 },
123
+ bind: { value: bind, configurable: !0 }
124
+ });
125
+ }
126
+ return newFn;
127
+ }
128
+ function getReference(target, name) {
129
+ switch (name) {
130
+ case "$$typeof":
131
+ return target.$$typeof;
132
+ case "$$id":
133
+ return target.$$id;
134
+ case "$$async":
135
+ return target.$$async;
136
+ case "name":
137
+ return target.name;
138
+ case "defaultProps":
139
+ return;
140
+ case "toJSON":
141
+ return;
142
+ case Symbol.toPrimitive:
143
+ return Object.prototype[Symbol.toPrimitive];
144
+ case Symbol.toStringTag:
145
+ return Object.prototype[Symbol.toStringTag];
146
+ case "__esModule":
147
+ var moduleId = target.$$id;
148
+ target.default = registerClientReferenceImpl(
149
+ function () {
150
+ throw Error(
151
+ "Attempted to call the default export of " +
152
+ moduleId +
153
+ " from the server but it's on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component."
154
+ );
155
+ },
156
+ target.$$id + "#",
157
+ target.$$async
158
+ );
159
+ return !0;
160
+ case "then":
161
+ if (target.then) return target.then;
162
+ if (target.$$async) return;
163
+ var clientReference = registerClientReferenceImpl(
164
+ {},
165
+ target.$$id,
166
+ !0
167
+ ),
168
+ proxy = new Proxy(clientReference, proxyHandlers$1);
169
+ target.status = "fulfilled";
170
+ target.value = proxy;
171
+ return (target.then = registerClientReferenceImpl(
172
+ function (resolve) {
173
+ return Promise.resolve(resolve(proxy));
174
+ },
175
+ target.$$id + "#then",
176
+ !1
177
+ ));
178
+ }
179
+ if ("symbol" === typeof name)
180
+ throw Error(
181
+ "Cannot read Symbol exports. Only named exports are supported on a client module imported on the server."
182
+ );
183
+ clientReference = target[name];
184
+ clientReference ||
185
+ ((clientReference = registerClientReferenceImpl(
186
+ function () {
187
+ throw Error(
188
+ "Attempted to call " +
189
+ String(name) +
190
+ "() from the server but " +
191
+ String(name) +
192
+ " is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component."
193
+ );
194
+ },
195
+ target.$$id + "#" + name,
196
+ target.$$async
197
+ )),
198
+ Object.defineProperty(clientReference, "name", { value: name }),
199
+ (clientReference = target[name] =
200
+ new Proxy(clientReference, deepProxyHandlers)));
201
+ return clientReference;
202
+ }
203
+ function trimOptions(options) {
204
+ if (null == options) return null;
205
+ var hasProperties = !1,
206
+ trimmed = {},
207
+ key;
208
+ for (key in options)
209
+ null != options[key] &&
210
+ ((hasProperties = !0), (trimmed[key] = options[key]));
211
+ return hasProperties ? trimmed : null;
212
+ }
213
+ function prepareStackTrace(error, structuredStackTrace) {
214
+ error = (error.name || "Error") + ": " + (error.message || "");
215
+ for (var i = 0; i < structuredStackTrace.length; i++)
216
+ error += "\n at " + structuredStackTrace[i].toString();
217
+ return error;
218
+ }
219
+ function parseStackTrace(error, skipFrames) {
220
+ a: {
221
+ var previousPrepare = Error.prepareStackTrace;
222
+ Error.prepareStackTrace = prepareStackTrace;
223
+ try {
224
+ var stack = String(error.stack);
225
+ break a;
226
+ } finally {
227
+ Error.prepareStackTrace = previousPrepare;
228
+ }
229
+ stack = void 0;
230
+ }
231
+ stack.startsWith("Error: react-stack-top-frame\n") &&
232
+ (stack = stack.slice(29));
233
+ error = stack.indexOf("react-stack-bottom-frame");
234
+ -1 !== error && (error = stack.lastIndexOf("\n", error));
235
+ -1 !== error && (stack = stack.slice(0, error));
236
+ stack = stack.split("\n");
237
+ for (error = []; skipFrames < stack.length; skipFrames++)
238
+ if ((previousPrepare = frameRegExp.exec(stack[skipFrames]))) {
239
+ var name = previousPrepare[1] || "";
240
+ "<anonymous>" === name && (name = "");
241
+ var filename = previousPrepare[2] || previousPrepare[5] || "";
242
+ "<anonymous>" === filename && (filename = "");
243
+ error.push([
244
+ name,
245
+ filename,
246
+ +(previousPrepare[3] || previousPrepare[6]),
247
+ +(previousPrepare[4] || previousPrepare[7])
248
+ ]);
249
+ }
250
+ return error;
251
+ }
252
+ function createTemporaryReference(temporaryReferences, id) {
253
+ var reference = Object.defineProperties(
254
+ function () {
255
+ throw Error(
256
+ "Attempted to call a temporary Client Reference from the server but it is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component."
257
+ );
258
+ },
259
+ { $$typeof: { value: TEMPORARY_REFERENCE_TAG } }
260
+ );
261
+ reference = new Proxy(reference, proxyHandlers);
262
+ temporaryReferences.set(reference, id);
263
+ return reference;
264
+ }
265
+ function getIteratorFn(maybeIterable) {
266
+ if (null === maybeIterable || "object" !== typeof maybeIterable)
267
+ return null;
268
+ maybeIterable =
269
+ (MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL]) ||
270
+ maybeIterable["@@iterator"];
271
+ return "function" === typeof maybeIterable ? maybeIterable : null;
272
+ }
273
+ function noop$1() {}
274
+ function trackUsedThenable(thenableState, thenable, index) {
275
+ index = thenableState[index];
276
+ void 0 === index
277
+ ? thenableState.push(thenable)
278
+ : index !== thenable &&
279
+ (thenable.then(noop$1, noop$1), (thenable = index));
280
+ switch (thenable.status) {
281
+ case "fulfilled":
282
+ return thenable.value;
283
+ case "rejected":
284
+ throw thenable.reason;
285
+ default:
286
+ "string" === typeof thenable.status
287
+ ? thenable.then(noop$1, noop$1)
288
+ : ((thenableState = thenable),
289
+ (thenableState.status = "pending"),
290
+ thenableState.then(
291
+ function (fulfilledValue) {
292
+ if ("pending" === thenable.status) {
293
+ var fulfilledThenable = thenable;
294
+ fulfilledThenable.status = "fulfilled";
295
+ fulfilledThenable.value = fulfilledValue;
296
+ }
297
+ },
298
+ function (error) {
299
+ if ("pending" === thenable.status) {
300
+ var rejectedThenable = thenable;
301
+ rejectedThenable.status = "rejected";
302
+ rejectedThenable.reason = error;
303
+ }
304
+ }
305
+ ));
306
+ switch (thenable.status) {
307
+ case "fulfilled":
308
+ return thenable.value;
309
+ case "rejected":
310
+ throw thenable.reason;
311
+ }
312
+ suspendedThenable = thenable;
313
+ throw SuspenseException;
314
+ }
315
+ }
316
+ function getSuspendedThenable() {
317
+ if (null === suspendedThenable)
318
+ throw Error(
319
+ "Expected a suspended thenable. This is a bug in React. Please file an issue."
320
+ );
321
+ var thenable = suspendedThenable;
322
+ suspendedThenable = null;
323
+ return thenable;
324
+ }
325
+ function prepareToUseHooksForComponent(
326
+ prevThenableState,
327
+ componentDebugInfo
328
+ ) {
329
+ thenableIndexCounter = 0;
330
+ thenableState = prevThenableState;
331
+ currentComponentDebugInfo = componentDebugInfo;
332
+ }
333
+ function getThenableStateAfterSuspending() {
334
+ var state = thenableState || [];
335
+ state._componentDebugInfo = currentComponentDebugInfo;
336
+ thenableState = currentComponentDebugInfo = null;
337
+ return state;
338
+ }
339
+ function unsupportedHook() {
340
+ throw Error("This Hook is not supported in Server Components.");
341
+ }
342
+ function unsupportedRefresh() {
343
+ throw Error(
344
+ "Refreshing the cache is not supported in Server Components."
345
+ );
346
+ }
347
+ function unsupportedContext() {
348
+ throw Error("Cannot read a Client Context from a Server Component.");
349
+ }
350
+ function resolveOwner() {
351
+ if (currentOwner) return currentOwner;
352
+ var owner = componentStorage.getStore();
353
+ return owner ? owner : null;
354
+ }
355
+ function isObjectPrototype(object) {
356
+ if (!object) return !1;
357
+ var ObjectPrototype = Object.prototype;
358
+ if (object === ObjectPrototype) return !0;
359
+ if (getPrototypeOf(object)) return !1;
360
+ object = Object.getOwnPropertyNames(object);
361
+ for (var i = 0; i < object.length; i++)
362
+ if (!(object[i] in ObjectPrototype)) return !1;
363
+ return !0;
364
+ }
365
+ function isSimpleObject(object) {
366
+ if (!isObjectPrototype(getPrototypeOf(object))) return !1;
367
+ for (
368
+ var names = Object.getOwnPropertyNames(object), i = 0;
369
+ i < names.length;
370
+ i++
371
+ ) {
372
+ var descriptor = Object.getOwnPropertyDescriptor(object, names[i]);
373
+ if (
374
+ !descriptor ||
375
+ (!descriptor.enumerable &&
376
+ (("key" !== names[i] && "ref" !== names[i]) ||
377
+ "function" !== typeof descriptor.get))
378
+ )
379
+ return !1;
380
+ }
381
+ return !0;
382
+ }
383
+ function objectName(object) {
384
+ return Object.prototype.toString
385
+ .call(object)
386
+ .replace(/^\[object (.*)\]$/, function (m, p0) {
387
+ return p0;
388
+ });
389
+ }
390
+ function describeKeyForErrorMessage(key) {
391
+ var encodedKey = JSON.stringify(key);
392
+ return '"' + key + '"' === encodedKey ? key : encodedKey;
393
+ }
394
+ function describeValueForErrorMessage(value) {
395
+ switch (typeof value) {
396
+ case "string":
397
+ return JSON.stringify(
398
+ 10 >= value.length ? value : value.slice(0, 10) + "..."
399
+ );
400
+ case "object":
401
+ if (isArrayImpl(value)) return "[...]";
402
+ if (null !== value && value.$$typeof === CLIENT_REFERENCE_TAG)
403
+ return "client";
404
+ value = objectName(value);
405
+ return "Object" === value ? "{...}" : value;
406
+ case "function":
407
+ return value.$$typeof === CLIENT_REFERENCE_TAG
408
+ ? "client"
409
+ : (value = value.displayName || value.name)
410
+ ? "function " + value
411
+ : "function";
412
+ default:
413
+ return String(value);
414
+ }
415
+ }
416
+ function describeElementType(type) {
417
+ if ("string" === typeof type) return type;
418
+ switch (type) {
419
+ case REACT_SUSPENSE_TYPE:
420
+ return "Suspense";
421
+ case REACT_SUSPENSE_LIST_TYPE:
422
+ return "SuspenseList";
423
+ }
424
+ if ("object" === typeof type)
425
+ switch (type.$$typeof) {
426
+ case REACT_FORWARD_REF_TYPE:
427
+ return describeElementType(type.render);
428
+ case REACT_MEMO_TYPE:
429
+ return describeElementType(type.type);
430
+ case REACT_LAZY_TYPE:
431
+ var payload = type._payload;
432
+ type = type._init;
433
+ try {
434
+ return describeElementType(type(payload));
435
+ } catch (x) {}
436
+ }
437
+ return "";
438
+ }
439
+ function describeObjectForErrorMessage(objectOrArray, expandedName) {
440
+ var objKind = objectName(objectOrArray);
441
+ if ("Object" !== objKind && "Array" !== objKind) return objKind;
442
+ var start = -1,
443
+ length = 0;
444
+ if (isArrayImpl(objectOrArray))
445
+ if (jsxChildrenParents.has(objectOrArray)) {
446
+ var type = jsxChildrenParents.get(objectOrArray);
447
+ objKind = "<" + describeElementType(type) + ">";
448
+ for (var i = 0; i < objectOrArray.length; i++) {
449
+ var value = objectOrArray[i];
450
+ value =
451
+ "string" === typeof value
452
+ ? value
453
+ : "object" === typeof value && null !== value
454
+ ? "{" + describeObjectForErrorMessage(value) + "}"
455
+ : "{" + describeValueForErrorMessage(value) + "}";
456
+ "" + i === expandedName
457
+ ? ((start = objKind.length),
458
+ (length = value.length),
459
+ (objKind += value))
460
+ : (objKind =
461
+ 15 > value.length && 40 > objKind.length + value.length
462
+ ? objKind + value
463
+ : objKind + "{...}");
464
+ }
465
+ objKind += "</" + describeElementType(type) + ">";
466
+ } else {
467
+ objKind = "[";
468
+ for (type = 0; type < objectOrArray.length; type++)
469
+ 0 < type && (objKind += ", "),
470
+ (i = objectOrArray[type]),
471
+ (i =
472
+ "object" === typeof i && null !== i
473
+ ? describeObjectForErrorMessage(i)
474
+ : describeValueForErrorMessage(i)),
475
+ "" + type === expandedName
476
+ ? ((start = objKind.length),
477
+ (length = i.length),
478
+ (objKind += i))
479
+ : (objKind =
480
+ 10 > i.length && 40 > objKind.length + i.length
481
+ ? objKind + i
482
+ : objKind + "...");
483
+ objKind += "]";
484
+ }
485
+ else if (objectOrArray.$$typeof === REACT_ELEMENT_TYPE)
486
+ objKind = "<" + describeElementType(objectOrArray.type) + "/>";
487
+ else {
488
+ if (objectOrArray.$$typeof === CLIENT_REFERENCE_TAG) return "client";
489
+ if (jsxPropsParents.has(objectOrArray)) {
490
+ objKind = jsxPropsParents.get(objectOrArray);
491
+ objKind = "<" + (describeElementType(objKind) || "...");
492
+ type = Object.keys(objectOrArray);
493
+ for (i = 0; i < type.length; i++) {
494
+ objKind += " ";
495
+ value = type[i];
496
+ objKind += describeKeyForErrorMessage(value) + "=";
497
+ var _value2 = objectOrArray[value];
498
+ var _substr2 =
499
+ value === expandedName &&
500
+ "object" === typeof _value2 &&
501
+ null !== _value2
502
+ ? describeObjectForErrorMessage(_value2)
503
+ : describeValueForErrorMessage(_value2);
504
+ "string" !== typeof _value2 && (_substr2 = "{" + _substr2 + "}");
505
+ value === expandedName
506
+ ? ((start = objKind.length),
507
+ (length = _substr2.length),
508
+ (objKind += _substr2))
509
+ : (objKind =
510
+ 10 > _substr2.length && 40 > objKind.length + _substr2.length
511
+ ? objKind + _substr2
512
+ : objKind + "...");
513
+ }
514
+ objKind += ">";
515
+ } else {
516
+ objKind = "{";
517
+ type = Object.keys(objectOrArray);
518
+ for (i = 0; i < type.length; i++)
519
+ 0 < i && (objKind += ", "),
520
+ (value = type[i]),
521
+ (objKind += describeKeyForErrorMessage(value) + ": "),
522
+ (_value2 = objectOrArray[value]),
523
+ (_value2 =
524
+ "object" === typeof _value2 && null !== _value2
525
+ ? describeObjectForErrorMessage(_value2)
526
+ : describeValueForErrorMessage(_value2)),
527
+ value === expandedName
528
+ ? ((start = objKind.length),
529
+ (length = _value2.length),
530
+ (objKind += _value2))
531
+ : (objKind =
532
+ 10 > _value2.length && 40 > objKind.length + _value2.length
533
+ ? objKind + _value2
534
+ : objKind + "...");
535
+ objKind += "}";
536
+ }
537
+ }
538
+ return void 0 === expandedName
539
+ ? objKind
540
+ : -1 < start && 0 < length
541
+ ? ((objectOrArray = " ".repeat(start) + "^".repeat(length)),
542
+ "\n " + objKind + "\n " + objectOrArray)
543
+ : "\n " + objKind;
544
+ }
545
+ function defaultFilterStackFrame(filename) {
546
+ return (
547
+ "" !== filename &&
548
+ !filename.startsWith("node:") &&
549
+ !filename.includes("node_modules")
550
+ );
551
+ }
552
+ function filterStackTrace(request, error, skipFrames) {
553
+ request = request.filterStackFrame;
554
+ error = parseStackTrace(error, skipFrames);
555
+ for (skipFrames = 0; skipFrames < error.length; skipFrames++) {
556
+ var callsite = error[skipFrames],
557
+ functionName = callsite[0],
558
+ url = callsite[1];
559
+ if (url.startsWith("rsc://React/")) {
560
+ var envIdx = url.indexOf("/", 12),
561
+ suffixIdx = url.lastIndexOf("?");
562
+ -1 < envIdx &&
563
+ -1 < suffixIdx &&
564
+ (url = callsite[1] = url.slice(envIdx + 1, suffixIdx));
565
+ }
566
+ request(url, functionName) ||
567
+ (error.splice(skipFrames, 1), skipFrames--);
568
+ }
569
+ return error;
570
+ }
571
+ function patchConsole(consoleInst, methodName) {
572
+ var descriptor = Object.getOwnPropertyDescriptor(consoleInst, methodName);
573
+ if (
574
+ descriptor &&
575
+ (descriptor.configurable || descriptor.writable) &&
576
+ "function" === typeof descriptor.value
577
+ ) {
578
+ var originalMethod = descriptor.value;
579
+ descriptor = Object.getOwnPropertyDescriptor(originalMethod, "name");
580
+ var wrapperMethod = function () {
581
+ var request = resolveRequest();
582
+ if (("assert" !== methodName || !arguments[0]) && null !== request) {
583
+ var stack = filterStackTrace(
584
+ request,
585
+ Error("react-stack-top-frame"),
586
+ 1
587
+ );
588
+ request.pendingChunks++;
589
+ var id = request.nextChunkId++,
590
+ owner = resolveOwner();
591
+ emitConsoleChunk(request, id, methodName, owner, stack, arguments);
592
+ }
593
+ return originalMethod.apply(this, arguments);
594
+ };
595
+ descriptor && Object.defineProperty(wrapperMethod, "name", descriptor);
596
+ Object.defineProperty(consoleInst, methodName, {
597
+ value: wrapperMethod
598
+ });
599
+ }
600
+ }
601
+ function getCurrentStackInDEV() {
602
+ return "";
603
+ }
604
+ function defaultErrorHandler(error) {
605
+ console.error(error);
606
+ }
607
+ function defaultPostponeHandler() {}
608
+ function RequestInstance(
609
+ type,
610
+ model,
611
+ bundlerConfig,
612
+ onError,
613
+ identifierPrefix,
614
+ onPostpone,
615
+ temporaryReferences,
616
+ environmentName,
617
+ filterStackFrame,
618
+ onAllReady,
619
+ onFatalError
620
+ ) {
621
+ if (
622
+ null !== ReactSharedInternalsServer.A &&
623
+ ReactSharedInternalsServer.A !== DefaultAsyncDispatcher
624
+ )
625
+ throw Error(
626
+ "Currently React only supports one RSC renderer at a time."
627
+ );
628
+ ReactSharedInternalsServer.A = DefaultAsyncDispatcher;
629
+ ReactSharedInternalsServer.getCurrentStack = getCurrentStackInDEV;
630
+ var abortSet = new Set(),
631
+ pingedTasks = [],
632
+ hints = new Set();
633
+ this.type = type;
634
+ this.status = OPENING;
635
+ this.flushScheduled = !1;
636
+ this.destination = this.fatalError = null;
637
+ this.bundlerConfig = bundlerConfig;
638
+ this.cache = new Map();
639
+ this.pendingChunks = this.nextChunkId = 0;
640
+ this.hints = hints;
641
+ this.abortListeners = new Set();
642
+ this.abortableTasks = abortSet;
643
+ this.pingedTasks = pingedTasks;
644
+ this.completedImportChunks = [];
645
+ this.completedHintChunks = [];
646
+ this.completedRegularChunks = [];
647
+ this.completedErrorChunks = [];
648
+ this.writtenSymbols = new Map();
649
+ this.writtenClientReferences = new Map();
650
+ this.writtenServerReferences = new Map();
651
+ this.writtenObjects = new WeakMap();
652
+ this.temporaryReferences = temporaryReferences;
653
+ this.identifierPrefix = identifierPrefix || "";
654
+ this.identifierCount = 1;
655
+ this.taintCleanupQueue = [];
656
+ this.onError = void 0 === onError ? defaultErrorHandler : onError;
657
+ this.onPostpone =
658
+ void 0 === onPostpone ? defaultPostponeHandler : onPostpone;
659
+ this.onAllReady = onAllReady;
660
+ this.onFatalError = onFatalError;
661
+ this.environmentName =
662
+ void 0 === environmentName
663
+ ? function () {
664
+ return "Server";
665
+ }
666
+ : "function" !== typeof environmentName
667
+ ? function () {
668
+ return environmentName;
669
+ }
670
+ : environmentName;
671
+ this.filterStackFrame =
672
+ void 0 === filterStackFrame
673
+ ? defaultFilterStackFrame
674
+ : filterStackFrame;
675
+ this.didWarnForKey = null;
676
+ type = createTask(this, model, null, !1, abortSet, null);
677
+ pingedTasks.push(type);
678
+ }
679
+ function noop() {}
680
+ function resolveRequest() {
681
+ if (currentRequest) return currentRequest;
682
+ var store = requestStorage.getStore();
683
+ return store ? store : null;
684
+ }
685
+ function serializeThenable(request, task, thenable) {
686
+ var newTask = createTask(
687
+ request,
688
+ null,
689
+ task.keyPath,
690
+ task.implicitSlot,
691
+ request.abortableTasks,
692
+ task.debugOwner
693
+ );
694
+ (task = thenable._debugInfo) &&
695
+ forwardDebugInfo(request, newTask.id, task);
696
+ switch (thenable.status) {
697
+ case "fulfilled":
698
+ return (
699
+ (newTask.model = thenable.value),
700
+ pingTask(request, newTask),
701
+ newTask.id
702
+ );
703
+ case "rejected":
704
+ task = thenable.reason;
705
+ var digest = logRecoverableError(request, task, null);
706
+ emitErrorChunk(request, newTask.id, digest, task);
707
+ newTask.status = ERRORED$1;
708
+ request.abortableTasks.delete(newTask);
709
+ return newTask.id;
710
+ default:
711
+ if (request.status === ABORTING)
712
+ return (
713
+ request.abortableTasks.delete(newTask),
714
+ (newTask.status = ABORTED),
715
+ (task = stringify(serializeByValueID(request.fatalError))),
716
+ emitModelChunk(request, newTask.id, task),
717
+ newTask.id
718
+ );
719
+ "string" !== typeof thenable.status &&
720
+ ((thenable.status = "pending"),
721
+ thenable.then(
722
+ function (fulfilledValue) {
723
+ "pending" === thenable.status &&
724
+ ((thenable.status = "fulfilled"),
725
+ (thenable.value = fulfilledValue));
726
+ },
727
+ function (error) {
728
+ "pending" === thenable.status &&
729
+ ((thenable.status = "rejected"), (thenable.reason = error));
730
+ }
731
+ ));
732
+ }
733
+ thenable.then(
734
+ function (value) {
735
+ newTask.model = value;
736
+ pingTask(request, newTask);
737
+ },
738
+ function (reason) {
739
+ if (newTask.status === PENDING$1) {
740
+ var _digest = logRecoverableError(request, reason, newTask);
741
+ emitErrorChunk(request, newTask.id, _digest, reason);
742
+ newTask.status = ERRORED$1;
743
+ request.abortableTasks.delete(newTask);
744
+ enqueueFlush(request);
745
+ }
746
+ }
747
+ );
748
+ return newTask.id;
749
+ }
750
+ function serializeReadableStream(request, task, stream) {
751
+ function progress(entry) {
752
+ if (!aborted)
753
+ if (entry.done)
754
+ request.abortListeners.delete(abortStream),
755
+ (entry = streamTask.id.toString(16) + ":C\n"),
756
+ request.completedRegularChunks.push(entry),
757
+ enqueueFlush(request),
758
+ (aborted = !0);
759
+ else
760
+ try {
761
+ (streamTask.model = entry.value),
762
+ request.pendingChunks++,
763
+ tryStreamTask(request, streamTask),
764
+ enqueueFlush(request),
765
+ reader.read().then(progress, error);
766
+ } catch (x$0) {
767
+ error(x$0);
768
+ }
769
+ }
770
+ function error(reason) {
771
+ if (!aborted) {
772
+ aborted = !0;
773
+ request.abortListeners.delete(abortStream);
774
+ var digest = logRecoverableError(request, reason, streamTask);
775
+ emitErrorChunk(request, streamTask.id, digest, reason);
776
+ enqueueFlush(request);
777
+ reader.cancel(reason).then(error, error);
778
+ }
779
+ }
780
+ function abortStream(reason) {
781
+ if (!aborted) {
782
+ aborted = !0;
783
+ request.abortListeners.delete(abortStream);
784
+ var digest = logRecoverableError(request, reason, streamTask);
785
+ emitErrorChunk(request, streamTask.id, digest, reason);
786
+ enqueueFlush(request);
787
+ reader.cancel(reason).then(error, error);
788
+ }
789
+ }
790
+ var supportsBYOB = stream.supportsBYOB;
791
+ if (void 0 === supportsBYOB)
792
+ try {
793
+ stream.getReader({ mode: "byob" }).releaseLock(), (supportsBYOB = !0);
794
+ } catch (x) {
795
+ supportsBYOB = !1;
796
+ }
797
+ var reader = stream.getReader(),
798
+ streamTask = createTask(
799
+ request,
800
+ task.model,
801
+ task.keyPath,
802
+ task.implicitSlot,
803
+ request.abortableTasks,
804
+ task.debugOwner
805
+ );
806
+ request.abortableTasks.delete(streamTask);
807
+ request.pendingChunks++;
808
+ task =
809
+ streamTask.id.toString(16) + ":" + (supportsBYOB ? "r" : "R") + "\n";
810
+ request.completedRegularChunks.push(task);
811
+ var aborted = !1;
812
+ request.abortListeners.add(abortStream);
813
+ reader.read().then(progress, error);
814
+ return serializeByValueID(streamTask.id);
815
+ }
816
+ function serializeAsyncIterable(request, task, iterable, iterator) {
817
+ function progress(entry) {
818
+ if (!aborted)
819
+ if (entry.done) {
820
+ request.abortListeners.delete(abortIterable);
821
+ if (void 0 === entry.value)
822
+ var endStreamRow = streamTask.id.toString(16) + ":C\n";
823
+ else
824
+ try {
825
+ var chunkId = outlineModel(request, entry.value);
826
+ endStreamRow =
827
+ streamTask.id.toString(16) +
828
+ ":C" +
829
+ stringify(serializeByValueID(chunkId)) +
830
+ "\n";
831
+ } catch (x) {
832
+ error(x);
833
+ return;
834
+ }
835
+ request.completedRegularChunks.push(endStreamRow);
836
+ enqueueFlush(request);
837
+ aborted = !0;
838
+ } else
839
+ try {
840
+ (streamTask.model = entry.value),
841
+ request.pendingChunks++,
842
+ tryStreamTask(request, streamTask),
843
+ enqueueFlush(request),
844
+ callIteratorInDEV(iterator, progress, error);
845
+ } catch (x$1) {
846
+ error(x$1);
847
+ }
848
+ }
849
+ function error(reason) {
850
+ if (!aborted) {
851
+ aborted = !0;
852
+ request.abortListeners.delete(abortIterable);
853
+ var digest = logRecoverableError(request, reason, streamTask);
854
+ emitErrorChunk(request, streamTask.id, digest, reason);
855
+ enqueueFlush(request);
856
+ "function" === typeof iterator.throw &&
857
+ iterator.throw(reason).then(error, error);
858
+ }
859
+ }
860
+ function abortIterable(reason) {
861
+ if (!aborted) {
862
+ aborted = !0;
863
+ request.abortListeners.delete(abortIterable);
864
+ var digest = logRecoverableError(request, reason, streamTask);
865
+ emitErrorChunk(request, streamTask.id, digest, reason);
866
+ enqueueFlush(request);
867
+ "function" === typeof iterator.throw &&
868
+ iterator.throw(reason).then(error, error);
869
+ }
870
+ }
871
+ var isIterator = iterable === iterator,
872
+ streamTask = createTask(
873
+ request,
874
+ task.model,
875
+ task.keyPath,
876
+ task.implicitSlot,
877
+ request.abortableTasks,
878
+ task.debugOwner
879
+ );
880
+ request.abortableTasks.delete(streamTask);
881
+ request.pendingChunks++;
882
+ task = streamTask.id.toString(16) + ":" + (isIterator ? "x" : "X") + "\n";
883
+ request.completedRegularChunks.push(task);
884
+ (iterable = iterable._debugInfo) &&
885
+ forwardDebugInfo(request, streamTask.id, iterable);
886
+ var aborted = !1;
887
+ request.abortListeners.add(abortIterable);
888
+ callIteratorInDEV(iterator, progress, error);
889
+ return serializeByValueID(streamTask.id);
890
+ }
891
+ function emitHint(request, code, model) {
892
+ model = stringify(model);
893
+ var id = request.nextChunkId++;
894
+ code = serializeRowHeader("H" + code, id) + model + "\n";
895
+ request.completedHintChunks.push(code);
896
+ enqueueFlush(request);
897
+ }
898
+ function readThenable(thenable) {
899
+ if ("fulfilled" === thenable.status) return thenable.value;
900
+ if ("rejected" === thenable.status) throw thenable.reason;
901
+ throw thenable;
902
+ }
903
+ function createLazyWrapperAroundWakeable(wakeable) {
904
+ switch (wakeable.status) {
905
+ case "fulfilled":
906
+ case "rejected":
907
+ break;
908
+ default:
909
+ "string" !== typeof wakeable.status &&
910
+ ((wakeable.status = "pending"),
911
+ wakeable.then(
912
+ function (fulfilledValue) {
913
+ "pending" === wakeable.status &&
914
+ ((wakeable.status = "fulfilled"),
915
+ (wakeable.value = fulfilledValue));
916
+ },
917
+ function (error) {
918
+ "pending" === wakeable.status &&
919
+ ((wakeable.status = "rejected"), (wakeable.reason = error));
920
+ }
921
+ ));
922
+ }
923
+ var lazyType = {
924
+ $$typeof: REACT_LAZY_TYPE,
925
+ _payload: wakeable,
926
+ _init: readThenable
927
+ };
928
+ lazyType._debugInfo = wakeable._debugInfo || [];
929
+ return lazyType;
930
+ }
931
+ function callWithDebugContextInDEV(request, task, callback, arg) {
932
+ currentOwner = {
933
+ name: "",
934
+ env: task.environmentName,
935
+ key: null,
936
+ owner: task.debugOwner
937
+ };
938
+ try {
939
+ return callback(arg);
940
+ } finally {
941
+ currentOwner = null;
942
+ }
943
+ }
944
+ function renderFunctionComponent(request, task, key, Component, props) {
945
+ var prevThenableState = task.thenableState;
946
+ task.thenableState = null;
947
+ if (null === debugID) return outlineTask(request, task);
948
+ if (null !== prevThenableState)
949
+ var componentDebugInfo = prevThenableState._componentDebugInfo;
950
+ else {
951
+ var componentDebugID = debugID;
952
+ componentDebugInfo = Component.displayName || Component.name || "";
953
+ var componentEnv = (0, request.environmentName)();
954
+ request.pendingChunks++;
955
+ componentDebugInfo = {
956
+ name: componentDebugInfo,
957
+ env: componentEnv,
958
+ key: key,
959
+ owner: task.debugOwner
960
+ };
961
+ componentDebugInfo.props = props;
962
+ outlineComponentInfo(request, componentDebugInfo);
963
+ emitDebugChunk(request, componentDebugID, componentDebugInfo);
964
+ task.environmentName = componentEnv;
965
+ }
966
+ prepareToUseHooksForComponent(prevThenableState, componentDebugInfo);
967
+ props = componentStorage.run(
968
+ componentDebugInfo,
969
+ callComponentInDEV,
970
+ Component,
971
+ props,
972
+ componentDebugInfo
973
+ );
974
+ if (request.status === ABORTING)
975
+ throw (
976
+ ("object" !== typeof props ||
977
+ null === props ||
978
+ "function" !== typeof props.then ||
979
+ isClientReference(props) ||
980
+ props.then(voidHandler, voidHandler),
981
+ null)
982
+ );
983
+ if (
984
+ "object" === typeof props &&
985
+ null !== props &&
986
+ !isClientReference(props)
987
+ ) {
988
+ if ("function" === typeof props.then) {
989
+ prevThenableState = props;
990
+ prevThenableState.then(function (resolvedValue) {
991
+ "object" === typeof resolvedValue &&
992
+ null !== resolvedValue &&
993
+ resolvedValue.$$typeof === REACT_ELEMENT_TYPE &&
994
+ (resolvedValue._store.validated = 1);
995
+ }, voidHandler);
996
+ if ("fulfilled" === prevThenableState.status)
997
+ return prevThenableState.value;
998
+ props = createLazyWrapperAroundWakeable(props);
999
+ }
1000
+ var iteratorFn = getIteratorFn(props);
1001
+ if (iteratorFn) {
1002
+ var iterableChild = props;
1003
+ props = _defineProperty({}, Symbol.iterator, function () {
1004
+ var iterator = iteratorFn.call(iterableChild);
1005
+ iterator !== iterableChild ||
1006
+ ("[object GeneratorFunction]" ===
1007
+ Object.prototype.toString.call(Component) &&
1008
+ "[object Generator]" ===
1009
+ Object.prototype.toString.call(iterableChild)) ||
1010
+ callWithDebugContextInDEV(request, task, function () {
1011
+ console.error(
1012
+ "Returning an Iterator from a Server Component is not supported since it cannot be looped over more than once. "
1013
+ );
1014
+ });
1015
+ return iterator;
1016
+ });
1017
+ props._debugInfo = iterableChild._debugInfo;
1018
+ } else if (
1019
+ "function" !== typeof props[ASYNC_ITERATOR] ||
1020
+ ("function" === typeof ReadableStream &&
1021
+ props instanceof ReadableStream)
1022
+ )
1023
+ props.$$typeof === REACT_ELEMENT_TYPE && (props._store.validated = 1);
1024
+ else {
1025
+ var _iterableChild = props;
1026
+ props = _defineProperty({}, ASYNC_ITERATOR, function () {
1027
+ var iterator = _iterableChild[ASYNC_ITERATOR]();
1028
+ iterator !== _iterableChild ||
1029
+ ("[object AsyncGeneratorFunction]" ===
1030
+ Object.prototype.toString.call(Component) &&
1031
+ "[object AsyncGenerator]" ===
1032
+ Object.prototype.toString.call(_iterableChild)) ||
1033
+ callWithDebugContextInDEV(request, task, function () {
1034
+ console.error(
1035
+ "Returning an AsyncIterator from a Server Component is not supported since it cannot be looped over more than once. "
1036
+ );
1037
+ });
1038
+ return iterator;
1039
+ });
1040
+ props._debugInfo = _iterableChild._debugInfo;
1041
+ }
1042
+ }
1043
+ prevThenableState = task.keyPath;
1044
+ componentDebugID = task.implicitSlot;
1045
+ null !== key
1046
+ ? (task.keyPath =
1047
+ null === prevThenableState ? key : prevThenableState + "," + key)
1048
+ : null === prevThenableState && (task.implicitSlot = !0);
1049
+ key = renderModelDestructive(request, task, emptyRoot, "", props);
1050
+ task.keyPath = prevThenableState;
1051
+ task.implicitSlot = componentDebugID;
1052
+ return key;
1053
+ }
1054
+ function renderFragment(request, task, children) {
1055
+ for (var i = 0; i < children.length; i++) {
1056
+ var child = children[i];
1057
+ null === child ||
1058
+ "object" !== typeof child ||
1059
+ child.$$typeof !== REACT_ELEMENT_TYPE ||
1060
+ null !== child.key ||
1061
+ child._store.validated ||
1062
+ (child._store.validated = 2);
1063
+ }
1064
+ if (null !== task.keyPath)
1065
+ return (
1066
+ (request = [
1067
+ REACT_ELEMENT_TYPE,
1068
+ REACT_FRAGMENT_TYPE,
1069
+ task.keyPath,
1070
+ { children: children },
1071
+ null
1072
+ ]),
1073
+ task.implicitSlot ? [request] : request
1074
+ );
1075
+ if ((i = children._debugInfo)) {
1076
+ if (null === debugID) return outlineTask(request, task);
1077
+ forwardDebugInfo(request, debugID, i);
1078
+ children = Array.from(children);
1079
+ }
1080
+ return children;
1081
+ }
1082
+ function renderAsyncFragment(request, task, children, getAsyncIterator) {
1083
+ if (null !== task.keyPath)
1084
+ return (
1085
+ (request = [
1086
+ REACT_ELEMENT_TYPE,
1087
+ REACT_FRAGMENT_TYPE,
1088
+ task.keyPath,
1089
+ { children: children },
1090
+ null
1091
+ ]),
1092
+ task.implicitSlot ? [request] : request
1093
+ );
1094
+ getAsyncIterator = getAsyncIterator.call(children);
1095
+ return serializeAsyncIterable(request, task, children, getAsyncIterator);
1096
+ }
1097
+ function outlineTask(request, task) {
1098
+ task = createTask(
1099
+ request,
1100
+ task.model,
1101
+ task.keyPath,
1102
+ task.implicitSlot,
1103
+ request.abortableTasks,
1104
+ task.debugOwner
1105
+ );
1106
+ retryTask(request, task);
1107
+ return task.status === COMPLETED
1108
+ ? serializeByValueID(task.id)
1109
+ : "$L" + task.id.toString(16);
1110
+ }
1111
+ function renderElement(request, task, type, key, ref, props) {
1112
+ if (null !== ref && void 0 !== ref)
1113
+ throw Error(
1114
+ "Refs cannot be used in Server Components, nor passed to Client Components."
1115
+ );
1116
+ jsxPropsParents.set(props, type);
1117
+ "object" === typeof props.children &&
1118
+ null !== props.children &&
1119
+ jsxChildrenParents.set(props.children, type);
1120
+ if (
1121
+ "function" !== typeof type ||
1122
+ isClientReference(type) ||
1123
+ type.$$typeof === TEMPORARY_REFERENCE_TAG
1124
+ ) {
1125
+ if (type === REACT_FRAGMENT_TYPE && null === key)
1126
+ return (
1127
+ (type = task.implicitSlot),
1128
+ null === task.keyPath && (task.implicitSlot = !0),
1129
+ (request = renderModelDestructive(
1130
+ request,
1131
+ task,
1132
+ emptyRoot,
1133
+ "",
1134
+ props.children
1135
+ )),
1136
+ (task.implicitSlot = type),
1137
+ request
1138
+ );
1139
+ if (
1140
+ null != type &&
1141
+ "object" === typeof type &&
1142
+ !isClientReference(type)
1143
+ )
1144
+ switch (type.$$typeof) {
1145
+ case REACT_LAZY_TYPE:
1146
+ type = callLazyInitInDEV(type);
1147
+ if (request.status === ABORTING) throw null;
1148
+ return renderElement(request, task, type, key, ref, props);
1149
+ case REACT_FORWARD_REF_TYPE:
1150
+ return renderFunctionComponent(
1151
+ request,
1152
+ task,
1153
+ key,
1154
+ type.render,
1155
+ props
1156
+ );
1157
+ case REACT_MEMO_TYPE:
1158
+ return renderElement(request, task, type.type, key, ref, props);
1159
+ case REACT_ELEMENT_TYPE:
1160
+ type._store.validated = 1;
1161
+ }
1162
+ } else return renderFunctionComponent(request, task, key, type, props);
1163
+ ref = task.keyPath;
1164
+ null === key ? (key = ref) : null !== ref && (key = ref + "," + key);
1165
+ null !== task.debugOwner &&
1166
+ outlineComponentInfo(request, task.debugOwner);
1167
+ request = [REACT_ELEMENT_TYPE, type, key, props, task.debugOwner];
1168
+ task = task.implicitSlot && null !== key ? [request] : request;
1169
+ return task;
1170
+ }
1171
+ function pingTask(request, task) {
1172
+ var pingedTasks = request.pingedTasks;
1173
+ pingedTasks.push(task);
1174
+ 1 === pingedTasks.length &&
1175
+ ((request.flushScheduled = null !== request.destination),
1176
+ request.type === PRERENDER || request.status === OPENING
1177
+ ? scheduleMicrotask(function () {
1178
+ return performWork(request);
1179
+ })
1180
+ : setImmediate(function () {
1181
+ return performWork(request);
1182
+ }));
1183
+ }
1184
+ function createTask(
1185
+ request,
1186
+ model,
1187
+ keyPath,
1188
+ implicitSlot,
1189
+ abortSet,
1190
+ debugOwner
1191
+ ) {
1192
+ request.pendingChunks++;
1193
+ var id = request.nextChunkId++;
1194
+ "object" !== typeof model ||
1195
+ null === model ||
1196
+ null !== keyPath ||
1197
+ implicitSlot ||
1198
+ request.writtenObjects.set(model, serializeByValueID(id));
1199
+ var task = {
1200
+ id: id,
1201
+ status: PENDING$1,
1202
+ model: model,
1203
+ keyPath: keyPath,
1204
+ implicitSlot: implicitSlot,
1205
+ ping: function () {
1206
+ return pingTask(request, task);
1207
+ },
1208
+ toJSON: function (parentPropertyName, value) {
1209
+ var parent = this,
1210
+ originalValue = parent[parentPropertyName];
1211
+ "object" !== typeof originalValue ||
1212
+ originalValue === value ||
1213
+ originalValue instanceof Date ||
1214
+ callWithDebugContextInDEV(request, task, function () {
1215
+ "Object" !== objectName(originalValue)
1216
+ ? "string" === typeof jsxChildrenParents.get(parent)
1217
+ ? console.error(
1218
+ "%s objects cannot be rendered as text children. Try formatting it using toString().%s",
1219
+ objectName(originalValue),
1220
+ describeObjectForErrorMessage(parent, parentPropertyName)
1221
+ )
1222
+ : console.error(
1223
+ "Only plain objects can be passed to Client Components from Server Components. %s objects are not supported.%s",
1224
+ objectName(originalValue),
1225
+ describeObjectForErrorMessage(parent, parentPropertyName)
1226
+ )
1227
+ : console.error(
1228
+ "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",
1229
+ describeObjectForErrorMessage(parent, parentPropertyName)
1230
+ );
1231
+ });
1232
+ return renderModel(request, task, parent, parentPropertyName, value);
1233
+ },
1234
+ thenableState: null
1235
+ };
1236
+ task.environmentName = request.environmentName();
1237
+ task.debugOwner = debugOwner;
1238
+ abortSet.add(task);
1239
+ return task;
1240
+ }
1241
+ function serializeByValueID(id) {
1242
+ return "$" + id.toString(16);
1243
+ }
1244
+ function serializeNumber(number) {
1245
+ return Number.isFinite(number)
1246
+ ? 0 === number && -Infinity === 1 / number
1247
+ ? "$-0"
1248
+ : number
1249
+ : Infinity === number
1250
+ ? "$Infinity"
1251
+ : -Infinity === number
1252
+ ? "$-Infinity"
1253
+ : "$NaN";
1254
+ }
1255
+ function serializeRowHeader(tag, id) {
1256
+ return id.toString(16) + ":" + tag;
1257
+ }
1258
+ function encodeReferenceChunk(request, id, reference) {
1259
+ request = stringify(reference);
1260
+ return id.toString(16) + ":" + request + "\n";
1261
+ }
1262
+ function serializeClientReference(
1263
+ request,
1264
+ parent,
1265
+ parentPropertyName,
1266
+ clientReference
1267
+ ) {
1268
+ var clientReferenceKey = clientReference.$$async
1269
+ ? clientReference.$$id + "#async"
1270
+ : clientReference.$$id,
1271
+ writtenClientReferences = request.writtenClientReferences,
1272
+ existingId = writtenClientReferences.get(clientReferenceKey);
1273
+ if (void 0 !== existingId)
1274
+ return parent[0] === REACT_ELEMENT_TYPE && "1" === parentPropertyName
1275
+ ? "$L" + existingId.toString(16)
1276
+ : serializeByValueID(existingId);
1277
+ try {
1278
+ var config = request.bundlerConfig,
1279
+ modulePath = clientReference.$$id;
1280
+ existingId = "";
1281
+ var resolvedModuleData = config[modulePath];
1282
+ if (resolvedModuleData) existingId = resolvedModuleData.name;
1283
+ else {
1284
+ var idx = modulePath.lastIndexOf("#");
1285
+ -1 !== idx &&
1286
+ ((existingId = modulePath.slice(idx + 1)),
1287
+ (resolvedModuleData = config[modulePath.slice(0, idx)]));
1288
+ if (!resolvedModuleData)
1289
+ throw Error(
1290
+ 'Could not find the module "' +
1291
+ modulePath +
1292
+ '" in the React Client Manifest. This is probably a bug in the React Server Components bundler.'
1293
+ );
1294
+ }
1295
+ if (!0 === resolvedModuleData.async && !0 === clientReference.$$async)
1296
+ throw Error(
1297
+ 'The module "' +
1298
+ modulePath +
1299
+ '" is marked as an async ESM module but was loaded as a CJS proxy. This is probably a bug in the React Server Components bundler.'
1300
+ );
1301
+ var clientReferenceMetadata =
1302
+ !0 === resolvedModuleData.async || !0 === clientReference.$$async
1303
+ ? [resolvedModuleData.id, resolvedModuleData.chunks, existingId, 1]
1304
+ : [resolvedModuleData.id, resolvedModuleData.chunks, existingId];
1305
+ request.pendingChunks++;
1306
+ var importId = request.nextChunkId++,
1307
+ json = stringify(clientReferenceMetadata),
1308
+ processedChunk = serializeRowHeader("I", importId) + json + "\n";
1309
+ request.completedImportChunks.push(processedChunk);
1310
+ writtenClientReferences.set(clientReferenceKey, importId);
1311
+ return parent[0] === REACT_ELEMENT_TYPE && "1" === parentPropertyName
1312
+ ? "$L" + importId.toString(16)
1313
+ : serializeByValueID(importId);
1314
+ } catch (x) {
1315
+ return (
1316
+ request.pendingChunks++,
1317
+ (parent = request.nextChunkId++),
1318
+ (parentPropertyName = logRecoverableError(request, x, null)),
1319
+ emitErrorChunk(request, parent, parentPropertyName, x),
1320
+ serializeByValueID(parent)
1321
+ );
1322
+ }
1323
+ }
1324
+ function outlineModel(request, value) {
1325
+ value = createTask(
1326
+ request,
1327
+ value,
1328
+ null,
1329
+ !1,
1330
+ request.abortableTasks,
1331
+ null
1332
+ );
1333
+ retryTask(request, value);
1334
+ return value.id;
1335
+ }
1336
+ function serializeServerReference(request, serverReference) {
1337
+ var writtenServerReferences = request.writtenServerReferences,
1338
+ existingId = writtenServerReferences.get(serverReference);
1339
+ if (void 0 !== existingId) return "$F" + existingId.toString(16);
1340
+ existingId = serverReference.$$bound;
1341
+ existingId = null === existingId ? null : Promise.resolve(existingId);
1342
+ var id = serverReference.$$id,
1343
+ location = null,
1344
+ error = serverReference.$$location;
1345
+ error &&
1346
+ ((error = parseStackTrace(error, 1)),
1347
+ 0 < error.length && (location = error[0]));
1348
+ existingId =
1349
+ null !== location
1350
+ ? {
1351
+ id: id,
1352
+ bound: existingId,
1353
+ name:
1354
+ "function" === typeof serverReference
1355
+ ? serverReference.name
1356
+ : "",
1357
+ env: (0, request.environmentName)(),
1358
+ location: location
1359
+ }
1360
+ : { id: id, bound: existingId };
1361
+ request = outlineModel(request, existingId);
1362
+ writtenServerReferences.set(serverReference, request);
1363
+ return "$F" + request.toString(16);
1364
+ }
1365
+ function serializeLargeTextString(request, text) {
1366
+ request.pendingChunks++;
1367
+ var textId = request.nextChunkId++;
1368
+ emitTextChunk(request, textId, text);
1369
+ return serializeByValueID(textId);
1370
+ }
1371
+ function serializeMap(request, map) {
1372
+ map = Array.from(map);
1373
+ return "$Q" + outlineModel(request, map).toString(16);
1374
+ }
1375
+ function serializeFormData(request, formData) {
1376
+ formData = Array.from(formData.entries());
1377
+ return "$K" + outlineModel(request, formData).toString(16);
1378
+ }
1379
+ function serializeSet(request, set) {
1380
+ set = Array.from(set);
1381
+ return "$W" + outlineModel(request, set).toString(16);
1382
+ }
1383
+ function serializeTypedArray(request, tag, typedArray) {
1384
+ request.pendingChunks++;
1385
+ var bufferId = request.nextChunkId++;
1386
+ emitTypedArrayChunk(request, bufferId, tag, typedArray);
1387
+ return serializeByValueID(bufferId);
1388
+ }
1389
+ function serializeBlob(request, blob) {
1390
+ function progress(entry) {
1391
+ if (!aborted)
1392
+ if (entry.done)
1393
+ request.abortListeners.delete(abortBlob),
1394
+ (aborted = !0),
1395
+ pingTask(request, newTask);
1396
+ else
1397
+ return (
1398
+ model.push(entry.value), reader.read().then(progress).catch(error)
1399
+ );
1400
+ }
1401
+ function error(reason) {
1402
+ if (!aborted) {
1403
+ aborted = !0;
1404
+ request.abortListeners.delete(abortBlob);
1405
+ var digest = logRecoverableError(request, reason, newTask);
1406
+ emitErrorChunk(request, newTask.id, digest, reason);
1407
+ enqueueFlush(request);
1408
+ reader.cancel(reason).then(error, error);
1409
+ }
1410
+ }
1411
+ function abortBlob(reason) {
1412
+ if (!aborted) {
1413
+ aborted = !0;
1414
+ request.abortListeners.delete(abortBlob);
1415
+ var digest = logRecoverableError(request, reason, newTask);
1416
+ emitErrorChunk(request, newTask.id, digest, reason);
1417
+ enqueueFlush(request);
1418
+ reader.cancel(reason).then(error, error);
1419
+ }
1420
+ }
1421
+ var model = [blob.type],
1422
+ newTask = createTask(
1423
+ request,
1424
+ model,
1425
+ null,
1426
+ !1,
1427
+ request.abortableTasks,
1428
+ null
1429
+ ),
1430
+ reader = blob.stream().getReader(),
1431
+ aborted = !1;
1432
+ request.abortListeners.add(abortBlob);
1433
+ reader.read().then(progress).catch(error);
1434
+ return "$B" + newTask.id.toString(16);
1435
+ }
1436
+ function renderModel(request, task, parent, key, value) {
1437
+ var prevKeyPath = task.keyPath,
1438
+ prevImplicitSlot = task.implicitSlot;
1439
+ try {
1440
+ return renderModelDestructive(request, task, parent, key, value);
1441
+ } catch (thrownValue) {
1442
+ parent = task.model;
1443
+ parent =
1444
+ "object" === typeof parent &&
1445
+ null !== parent &&
1446
+ (parent.$$typeof === REACT_ELEMENT_TYPE ||
1447
+ parent.$$typeof === REACT_LAZY_TYPE);
1448
+ if (request.status === ABORTING)
1449
+ return (
1450
+ (task.status = ABORTED),
1451
+ (task = request.fatalError),
1452
+ parent ? "$L" + task.toString(16) : serializeByValueID(task)
1453
+ );
1454
+ key =
1455
+ thrownValue === SuspenseException
1456
+ ? getSuspendedThenable()
1457
+ : thrownValue;
1458
+ if (
1459
+ "object" === typeof key &&
1460
+ null !== key &&
1461
+ "function" === typeof key.then
1462
+ )
1463
+ return (
1464
+ (request = createTask(
1465
+ request,
1466
+ task.model,
1467
+ task.keyPath,
1468
+ task.implicitSlot,
1469
+ request.abortableTasks,
1470
+ task.debugOwner
1471
+ )),
1472
+ (value = request.ping),
1473
+ key.then(value, value),
1474
+ (request.thenableState = getThenableStateAfterSuspending()),
1475
+ (task.keyPath = prevKeyPath),
1476
+ (task.implicitSlot = prevImplicitSlot),
1477
+ parent
1478
+ ? "$L" + request.id.toString(16)
1479
+ : serializeByValueID(request.id)
1480
+ );
1481
+ task.keyPath = prevKeyPath;
1482
+ task.implicitSlot = prevImplicitSlot;
1483
+ request.pendingChunks++;
1484
+ prevKeyPath = request.nextChunkId++;
1485
+ task = logRecoverableError(request, key, task);
1486
+ emitErrorChunk(request, prevKeyPath, task, key);
1487
+ return parent
1488
+ ? "$L" + prevKeyPath.toString(16)
1489
+ : serializeByValueID(prevKeyPath);
1490
+ }
1491
+ }
1492
+ function renderModelDestructive(
1493
+ request,
1494
+ task,
1495
+ parent,
1496
+ parentPropertyName,
1497
+ value
1498
+ ) {
1499
+ task.model = value;
1500
+ if (value === REACT_ELEMENT_TYPE) return "$";
1501
+ if (null === value) return null;
1502
+ if ("object" === typeof value) {
1503
+ switch (value.$$typeof) {
1504
+ case REACT_ELEMENT_TYPE:
1505
+ var elementReference = null,
1506
+ _writtenObjects = request.writtenObjects;
1507
+ if (null === task.keyPath && !task.implicitSlot) {
1508
+ var _existingReference = _writtenObjects.get(value);
1509
+ if (void 0 !== _existingReference)
1510
+ if (modelRoot === value) modelRoot = null;
1511
+ else return _existingReference;
1512
+ else
1513
+ -1 === parentPropertyName.indexOf(":") &&
1514
+ ((_existingReference = _writtenObjects.get(parent)),
1515
+ void 0 !== _existingReference &&
1516
+ ((elementReference =
1517
+ _existingReference + ":" + parentPropertyName),
1518
+ _writtenObjects.set(value, elementReference)));
1519
+ }
1520
+ if ((_existingReference = value._debugInfo)) {
1521
+ if (null === debugID) return outlineTask(request, task);
1522
+ forwardDebugInfo(request, debugID, _existingReference);
1523
+ }
1524
+ _existingReference = value.props;
1525
+ var refProp = _existingReference.ref;
1526
+ task.debugOwner = value._owner;
1527
+ request = renderElement(
1528
+ request,
1529
+ task,
1530
+ value.type,
1531
+ value.key,
1532
+ void 0 !== refProp ? refProp : null,
1533
+ _existingReference
1534
+ );
1535
+ "object" === typeof request &&
1536
+ null !== request &&
1537
+ null !== elementReference &&
1538
+ (_writtenObjects.has(request) ||
1539
+ _writtenObjects.set(request, elementReference));
1540
+ return request;
1541
+ case REACT_LAZY_TYPE:
1542
+ task.thenableState = null;
1543
+ elementReference = callLazyInitInDEV(value);
1544
+ if (request.status === ABORTING) throw null;
1545
+ if ((_writtenObjects = value._debugInfo)) {
1546
+ if (null === debugID) return outlineTask(request, task);
1547
+ forwardDebugInfo(request, debugID, _writtenObjects);
1548
+ }
1549
+ return renderModelDestructive(
1550
+ request,
1551
+ task,
1552
+ emptyRoot,
1553
+ "",
1554
+ elementReference
1555
+ );
1556
+ case REACT_LEGACY_ELEMENT_TYPE:
1557
+ throw Error(
1558
+ 'A React Element from an older version of React was rendered. This is not supported. It can happen if:\n- Multiple copies of the "react" package is used.\n- A library pre-bundled an old copy of "react" or "react/jsx-runtime".\n- A compiler tries to "inline" JSX instead of using the runtime.'
1559
+ );
1560
+ }
1561
+ if (isClientReference(value))
1562
+ return serializeClientReference(
1563
+ request,
1564
+ parent,
1565
+ parentPropertyName,
1566
+ value
1567
+ );
1568
+ if (
1569
+ void 0 !== request.temporaryReferences &&
1570
+ ((elementReference = request.temporaryReferences.get(value)),
1571
+ void 0 !== elementReference)
1572
+ )
1573
+ return "$T" + elementReference;
1574
+ elementReference = request.writtenObjects;
1575
+ _writtenObjects = elementReference.get(value);
1576
+ if ("function" === typeof value.then) {
1577
+ if (void 0 !== _writtenObjects) {
1578
+ if (null !== task.keyPath || task.implicitSlot)
1579
+ return (
1580
+ "$@" + serializeThenable(request, task, value).toString(16)
1581
+ );
1582
+ if (modelRoot === value) modelRoot = null;
1583
+ else return _writtenObjects;
1584
+ }
1585
+ request = "$@" + serializeThenable(request, task, value).toString(16);
1586
+ elementReference.set(value, request);
1587
+ return request;
1588
+ }
1589
+ if (void 0 !== _writtenObjects)
1590
+ if (modelRoot === value) modelRoot = null;
1591
+ else return _writtenObjects;
1592
+ else if (
1593
+ -1 === parentPropertyName.indexOf(":") &&
1594
+ ((_writtenObjects = elementReference.get(parent)),
1595
+ void 0 !== _writtenObjects)
1596
+ ) {
1597
+ _existingReference = parentPropertyName;
1598
+ if (isArrayImpl(parent) && parent[0] === REACT_ELEMENT_TYPE)
1599
+ switch (parentPropertyName) {
1600
+ case "1":
1601
+ _existingReference = "type";
1602
+ break;
1603
+ case "2":
1604
+ _existingReference = "key";
1605
+ break;
1606
+ case "3":
1607
+ _existingReference = "props";
1608
+ break;
1609
+ case "4":
1610
+ _existingReference = "_owner";
1611
+ }
1612
+ elementReference.set(
1613
+ value,
1614
+ _writtenObjects + ":" + _existingReference
1615
+ );
1616
+ }
1617
+ if (isArrayImpl(value)) return renderFragment(request, task, value);
1618
+ if (value instanceof Map) return serializeMap(request, value);
1619
+ if (value instanceof Set) return serializeSet(request, value);
1620
+ if ("function" === typeof FormData && value instanceof FormData)
1621
+ return serializeFormData(request, value);
1622
+ if (value instanceof Error) return serializeErrorValue(request, value);
1623
+ if (value instanceof ArrayBuffer)
1624
+ return serializeTypedArray(request, "A", new Uint8Array(value));
1625
+ if (value instanceof Int8Array)
1626
+ return serializeTypedArray(request, "O", value);
1627
+ if (value instanceof Uint8Array)
1628
+ return serializeTypedArray(request, "o", value);
1629
+ if (value instanceof Uint8ClampedArray)
1630
+ return serializeTypedArray(request, "U", value);
1631
+ if (value instanceof Int16Array)
1632
+ return serializeTypedArray(request, "S", value);
1633
+ if (value instanceof Uint16Array)
1634
+ return serializeTypedArray(request, "s", value);
1635
+ if (value instanceof Int32Array)
1636
+ return serializeTypedArray(request, "L", value);
1637
+ if (value instanceof Uint32Array)
1638
+ return serializeTypedArray(request, "l", value);
1639
+ if (value instanceof Float32Array)
1640
+ return serializeTypedArray(request, "G", value);
1641
+ if (value instanceof Float64Array)
1642
+ return serializeTypedArray(request, "g", value);
1643
+ if (value instanceof BigInt64Array)
1644
+ return serializeTypedArray(request, "M", value);
1645
+ if (value instanceof BigUint64Array)
1646
+ return serializeTypedArray(request, "m", value);
1647
+ if (value instanceof DataView)
1648
+ return serializeTypedArray(request, "V", value);
1649
+ if ("function" === typeof Blob && value instanceof Blob)
1650
+ return serializeBlob(request, value);
1651
+ if ((elementReference = getIteratorFn(value)))
1652
+ return (
1653
+ (elementReference = elementReference.call(value)),
1654
+ elementReference === value
1655
+ ? "$i" +
1656
+ outlineModel(request, Array.from(elementReference)).toString(16)
1657
+ : renderFragment(request, task, Array.from(elementReference))
1658
+ );
1659
+ if (
1660
+ "function" === typeof ReadableStream &&
1661
+ value instanceof ReadableStream
1662
+ )
1663
+ return serializeReadableStream(request, task, value);
1664
+ elementReference = value[ASYNC_ITERATOR];
1665
+ if ("function" === typeof elementReference)
1666
+ return renderAsyncFragment(request, task, value, elementReference);
1667
+ if (value instanceof Date) return "$D" + value.toJSON();
1668
+ elementReference = getPrototypeOf(value);
1669
+ if (
1670
+ elementReference !== ObjectPrototype &&
1671
+ (null === elementReference ||
1672
+ null !== getPrototypeOf(elementReference))
1673
+ )
1674
+ throw Error(
1675
+ "Only plain objects, and a few built-ins, can be passed to Client Components from Server Components. Classes or null prototypes are not supported." +
1676
+ describeObjectForErrorMessage(parent, parentPropertyName)
1677
+ );
1678
+ if ("Object" !== objectName(value))
1679
+ callWithDebugContextInDEV(request, task, function () {
1680
+ console.error(
1681
+ "Only plain objects can be passed to Client Components from Server Components. %s objects are not supported.%s",
1682
+ objectName(value),
1683
+ describeObjectForErrorMessage(parent, parentPropertyName)
1684
+ );
1685
+ });
1686
+ else if (!isSimpleObject(value))
1687
+ callWithDebugContextInDEV(request, task, function () {
1688
+ console.error(
1689
+ "Only plain objects can be passed to Client Components from Server Components. Classes or other objects with methods are not supported.%s",
1690
+ describeObjectForErrorMessage(parent, parentPropertyName)
1691
+ );
1692
+ });
1693
+ else if (Object.getOwnPropertySymbols) {
1694
+ var symbols = Object.getOwnPropertySymbols(value);
1695
+ 0 < symbols.length &&
1696
+ callWithDebugContextInDEV(request, task, function () {
1697
+ console.error(
1698
+ "Only plain objects can be passed to Client Components from Server Components. Objects with symbol properties like %s are not supported.%s",
1699
+ symbols[0].description,
1700
+ describeObjectForErrorMessage(parent, parentPropertyName)
1701
+ );
1702
+ });
1703
+ }
1704
+ return value;
1705
+ }
1706
+ if ("string" === typeof value)
1707
+ return "Z" === value[value.length - 1] &&
1708
+ parent[parentPropertyName] instanceof Date
1709
+ ? "$D" + value
1710
+ : 1024 <= value.length && null !== byteLengthOfChunk
1711
+ ? serializeLargeTextString(request, value)
1712
+ : "$" === value[0]
1713
+ ? "$" + value
1714
+ : value;
1715
+ if ("boolean" === typeof value) return value;
1716
+ if ("number" === typeof value) return serializeNumber(value);
1717
+ if ("undefined" === typeof value) return "$undefined";
1718
+ if ("function" === typeof value) {
1719
+ if (isClientReference(value))
1720
+ return serializeClientReference(
1721
+ request,
1722
+ parent,
1723
+ parentPropertyName,
1724
+ value
1725
+ );
1726
+ if (value.$$typeof === SERVER_REFERENCE_TAG)
1727
+ return serializeServerReference(request, value);
1728
+ if (
1729
+ void 0 !== request.temporaryReferences &&
1730
+ ((request = request.temporaryReferences.get(value)),
1731
+ void 0 !== request)
1732
+ )
1733
+ return "$T" + request;
1734
+ if (value.$$typeof === TEMPORARY_REFERENCE_TAG)
1735
+ throw Error(
1736
+ "Could not reference an opaque temporary reference. This is likely due to misconfiguring the temporaryReferences options on the server."
1737
+ );
1738
+ if (/^on[A-Z]/.test(parentPropertyName))
1739
+ throw Error(
1740
+ "Event handlers cannot be passed to Client Component props." +
1741
+ describeObjectForErrorMessage(parent, parentPropertyName) +
1742
+ "\nIf you need interactivity, consider converting part of this to a Client Component."
1743
+ );
1744
+ if (
1745
+ jsxChildrenParents.has(parent) ||
1746
+ (jsxPropsParents.has(parent) && "children" === parentPropertyName)
1747
+ )
1748
+ throw (
1749
+ ((request = value.displayName || value.name || "Component"),
1750
+ Error(
1751
+ "Functions are not valid as a child of Client Components. This may happen if you return " +
1752
+ request +
1753
+ " instead of <" +
1754
+ request +
1755
+ " /> from render. Or maybe you meant to call this function rather than return it." +
1756
+ describeObjectForErrorMessage(parent, parentPropertyName)
1757
+ ))
1758
+ );
1759
+ throw Error(
1760
+ 'Functions cannot be passed directly to Client Components unless you explicitly expose it by marking it with "use server". Or maybe you meant to call this function rather than return it.' +
1761
+ describeObjectForErrorMessage(parent, parentPropertyName)
1762
+ );
1763
+ }
1764
+ if ("symbol" === typeof value) {
1765
+ task = request.writtenSymbols;
1766
+ elementReference = task.get(value);
1767
+ if (void 0 !== elementReference)
1768
+ return serializeByValueID(elementReference);
1769
+ elementReference = value.description;
1770
+ if (Symbol.for(elementReference) !== value)
1771
+ throw Error(
1772
+ "Only global symbols received from Symbol.for(...) can be passed to Client Components. The symbol Symbol.for(" +
1773
+ (value.description + ") cannot be found among global symbols.") +
1774
+ describeObjectForErrorMessage(parent, parentPropertyName)
1775
+ );
1776
+ request.pendingChunks++;
1777
+ _writtenObjects = request.nextChunkId++;
1778
+ emitSymbolChunk(request, _writtenObjects, elementReference);
1779
+ task.set(value, _writtenObjects);
1780
+ return serializeByValueID(_writtenObjects);
1781
+ }
1782
+ if ("bigint" === typeof value) return "$n" + value.toString(10);
1783
+ throw Error(
1784
+ "Type " +
1785
+ typeof value +
1786
+ " is not supported in Client Component props." +
1787
+ describeObjectForErrorMessage(parent, parentPropertyName)
1788
+ );
1789
+ }
1790
+ function logRecoverableError(request, error, task) {
1791
+ var prevRequest = currentRequest;
1792
+ currentRequest = null;
1793
+ try {
1794
+ var onError = request.onError;
1795
+ var errorDigest =
1796
+ null !== task
1797
+ ? requestStorage.run(
1798
+ void 0,
1799
+ callWithDebugContextInDEV,
1800
+ request,
1801
+ task,
1802
+ onError,
1803
+ error
1804
+ )
1805
+ : requestStorage.run(void 0, onError, error);
1806
+ } finally {
1807
+ currentRequest = prevRequest;
1808
+ }
1809
+ if (null != errorDigest && "string" !== typeof errorDigest)
1810
+ throw Error(
1811
+ '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 "' +
1812
+ typeof errorDigest +
1813
+ '" instead'
1814
+ );
1815
+ return errorDigest || "";
1816
+ }
1817
+ function fatalError(request, error) {
1818
+ var onFatalError = request.onFatalError;
1819
+ onFatalError(error);
1820
+ null !== request.destination
1821
+ ? ((request.status = CLOSED), request.destination.destroy(error))
1822
+ : ((request.status = CLOSING), (request.fatalError = error));
1823
+ }
1824
+ function serializeErrorValue(request, error) {
1825
+ var env = (0, request.environmentName)();
1826
+ try {
1827
+ var message = String(error.message);
1828
+ var stack = filterStackTrace(request, error, 0);
1829
+ var errorEnv = error.environmentName;
1830
+ "string" === typeof errorEnv && (env = errorEnv);
1831
+ } catch (x) {
1832
+ (message =
1833
+ "An error occurred but serializing the error message failed."),
1834
+ (stack = []);
1835
+ }
1836
+ return (
1837
+ "$Z" +
1838
+ outlineModel(request, {
1839
+ message: message,
1840
+ stack: stack,
1841
+ env: env
1842
+ }).toString(16)
1843
+ );
1844
+ }
1845
+ function emitErrorChunk(request, id, digest, error) {
1846
+ var env = (0, request.environmentName)();
1847
+ try {
1848
+ if (error instanceof Error) {
1849
+ var message = String(error.message);
1850
+ var stack = filterStackTrace(request, error, 0);
1851
+ var errorEnv = error.environmentName;
1852
+ "string" === typeof errorEnv && (env = errorEnv);
1853
+ } else
1854
+ (message =
1855
+ "object" === typeof error && null !== error
1856
+ ? describeObjectForErrorMessage(error)
1857
+ : String(error)),
1858
+ (stack = []);
1859
+ } catch (x) {
1860
+ (message =
1861
+ "An error occurred but serializing the error message failed."),
1862
+ (stack = []);
1863
+ }
1864
+ digest = { digest: digest, message: message, stack: stack, env: env };
1865
+ id = serializeRowHeader("E", id) + stringify(digest) + "\n";
1866
+ request.completedErrorChunks.push(id);
1867
+ }
1868
+ function emitSymbolChunk(request, id, name) {
1869
+ id = encodeReferenceChunk(request, id, "$S" + name);
1870
+ request.completedImportChunks.push(id);
1871
+ }
1872
+ function emitModelChunk(request, id, json) {
1873
+ id = id.toString(16) + ":" + json + "\n";
1874
+ request.completedRegularChunks.push(id);
1875
+ }
1876
+ function emitDebugChunk(request, id, debugInfo) {
1877
+ var counter = { objectLimit: 500 };
1878
+ debugInfo = stringify(debugInfo, function (parentPropertyName, value) {
1879
+ return renderConsoleValue(
1880
+ request,
1881
+ counter,
1882
+ this,
1883
+ parentPropertyName,
1884
+ value
1885
+ );
1886
+ });
1887
+ id = serializeRowHeader("D", id) + debugInfo + "\n";
1888
+ request.completedRegularChunks.push(id);
1889
+ }
1890
+ function outlineComponentInfo(request, componentInfo) {
1891
+ if (!request.writtenObjects.has(componentInfo)) {
1892
+ null != componentInfo.owner &&
1893
+ outlineComponentInfo(request, componentInfo.owner);
1894
+ var objectLimit = 10;
1895
+ null != componentInfo.stack &&
1896
+ (objectLimit += componentInfo.stack.length);
1897
+ objectLimit = { objectLimit: objectLimit };
1898
+ var componentDebugInfo = {
1899
+ name: componentInfo.name,
1900
+ env: componentInfo.env,
1901
+ key: componentInfo.key,
1902
+ owner: componentInfo.owner
1903
+ };
1904
+ componentDebugInfo.props = componentInfo.props;
1905
+ objectLimit = outlineConsoleValue(
1906
+ request,
1907
+ objectLimit,
1908
+ componentDebugInfo
1909
+ );
1910
+ request.writtenObjects.set(
1911
+ componentInfo,
1912
+ serializeByValueID(objectLimit)
1913
+ );
1914
+ }
1915
+ }
1916
+ function emitTypedArrayChunk(request, id, tag, typedArray) {
1917
+ request.pendingChunks++;
1918
+ typedArray = new Uint8Array(
1919
+ typedArray.buffer,
1920
+ typedArray.byteOffset,
1921
+ typedArray.byteLength
1922
+ );
1923
+ var binaryLength = typedArray.byteLength;
1924
+ id = id.toString(16) + ":" + tag + binaryLength.toString(16) + ",";
1925
+ request.completedRegularChunks.push(id, typedArray);
1926
+ }
1927
+ function emitTextChunk(request, id, text) {
1928
+ if (null === byteLengthOfChunk)
1929
+ throw Error(
1930
+ "Existence of byteLengthOfChunk should have already been checked. This is a bug in React."
1931
+ );
1932
+ request.pendingChunks++;
1933
+ var binaryLength = byteLengthOfChunk(text);
1934
+ id = id.toString(16) + ":T" + binaryLength.toString(16) + ",";
1935
+ request.completedRegularChunks.push(id, text);
1936
+ }
1937
+ function renderConsoleValue(
1938
+ request,
1939
+ counter,
1940
+ parent,
1941
+ parentPropertyName,
1942
+ value
1943
+ ) {
1944
+ if (null === value) return null;
1945
+ if (value === REACT_ELEMENT_TYPE) return "$";
1946
+ if ("object" === typeof value) {
1947
+ if (isClientReference(value))
1948
+ return serializeClientReference(
1949
+ request,
1950
+ parent,
1951
+ parentPropertyName,
1952
+ value
1953
+ );
1954
+ if (
1955
+ void 0 !== request.temporaryReferences &&
1956
+ ((parent = request.temporaryReferences.get(value)), void 0 !== parent)
1957
+ )
1958
+ return "$T" + parent;
1959
+ parent = request.writtenObjects.get(value);
1960
+ if (void 0 !== parent) return parent;
1961
+ if (0 >= counter.objectLimit && !doNotLimit.has(value)) return "$Y";
1962
+ counter.objectLimit--;
1963
+ switch (value.$$typeof) {
1964
+ case REACT_ELEMENT_TYPE:
1965
+ return (
1966
+ null != value._owner &&
1967
+ outlineComponentInfo(request, value._owner),
1968
+ "object" === typeof value.type &&
1969
+ null !== value.type &&
1970
+ doNotLimit.add(value.type),
1971
+ "object" === typeof value.key &&
1972
+ null !== value.key &&
1973
+ doNotLimit.add(value.key),
1974
+ doNotLimit.add(value.props),
1975
+ null !== value._owner && doNotLimit.add(value._owner),
1976
+ [
1977
+ REACT_ELEMENT_TYPE,
1978
+ value.type,
1979
+ value.key,
1980
+ value.props,
1981
+ value._owner
1982
+ ]
1983
+ );
1984
+ }
1985
+ if ("function" === typeof value.then) {
1986
+ switch (value.status) {
1987
+ case "fulfilled":
1988
+ return (
1989
+ "$@" +
1990
+ outlineConsoleValue(request, counter, value.value).toString(16)
1991
+ );
1992
+ case "rejected":
1993
+ return (
1994
+ (counter = value.reason),
1995
+ request.pendingChunks++,
1996
+ (value = request.nextChunkId++),
1997
+ emitErrorChunk(request, value, "", counter),
1998
+ "$@" + value.toString(16)
1999
+ );
2000
+ }
2001
+ return "$@";
2002
+ }
2003
+ if (isArrayImpl(value)) return value;
2004
+ if (value instanceof Map) {
2005
+ value = Array.from(value);
2006
+ counter.objectLimit++;
2007
+ for (parent = 0; parent < value.length; parent++) {
2008
+ var entry = value[parent];
2009
+ doNotLimit.add(entry);
2010
+ parentPropertyName = entry[0];
2011
+ entry = entry[1];
2012
+ "object" === typeof parentPropertyName &&
2013
+ null !== parentPropertyName &&
2014
+ doNotLimit.add(parentPropertyName);
2015
+ "object" === typeof entry &&
2016
+ null !== entry &&
2017
+ doNotLimit.add(entry);
2018
+ }
2019
+ return (
2020
+ "$Q" + outlineConsoleValue(request, counter, value).toString(16)
2021
+ );
2022
+ }
2023
+ if (value instanceof Set) {
2024
+ value = Array.from(value);
2025
+ counter.objectLimit++;
2026
+ for (parent = 0; parent < value.length; parent++)
2027
+ (parentPropertyName = value[parent]),
2028
+ "object" === typeof parentPropertyName &&
2029
+ null !== parentPropertyName &&
2030
+ doNotLimit.add(parentPropertyName);
2031
+ return (
2032
+ "$W" + outlineConsoleValue(request, counter, value).toString(16)
2033
+ );
2034
+ }
2035
+ return "function" === typeof FormData && value instanceof FormData
2036
+ ? serializeFormData(request, value)
2037
+ : value instanceof Error
2038
+ ? serializeErrorValue(request, value)
2039
+ : value instanceof ArrayBuffer
2040
+ ? serializeTypedArray(request, "A", new Uint8Array(value))
2041
+ : value instanceof Int8Array
2042
+ ? serializeTypedArray(request, "O", value)
2043
+ : value instanceof Uint8Array
2044
+ ? serializeTypedArray(request, "o", value)
2045
+ : value instanceof Uint8ClampedArray
2046
+ ? serializeTypedArray(request, "U", value)
2047
+ : value instanceof Int16Array
2048
+ ? serializeTypedArray(request, "S", value)
2049
+ : value instanceof Uint16Array
2050
+ ? serializeTypedArray(request, "s", value)
2051
+ : value instanceof Int32Array
2052
+ ? serializeTypedArray(request, "L", value)
2053
+ : value instanceof Uint32Array
2054
+ ? serializeTypedArray(request, "l", value)
2055
+ : value instanceof Float32Array
2056
+ ? serializeTypedArray(request, "G", value)
2057
+ : value instanceof Float64Array
2058
+ ? serializeTypedArray(request, "g", value)
2059
+ : value instanceof BigInt64Array
2060
+ ? serializeTypedArray(request, "M", value)
2061
+ : value instanceof BigUint64Array
2062
+ ? serializeTypedArray(request, "m", value)
2063
+ : value instanceof DataView
2064
+ ? serializeTypedArray(request, "V", value)
2065
+ : "function" === typeof Blob &&
2066
+ value instanceof Blob
2067
+ ? serializeBlob(request, value)
2068
+ : getIteratorFn(value)
2069
+ ? Array.from(value)
2070
+ : value;
2071
+ }
2072
+ if ("string" === typeof value)
2073
+ return "Z" === value[value.length - 1] &&
2074
+ parent[parentPropertyName] instanceof Date
2075
+ ? "$D" + value
2076
+ : 1024 <= value.length
2077
+ ? serializeLargeTextString(request, value)
2078
+ : "$" === value[0]
2079
+ ? "$" + value
2080
+ : value;
2081
+ if ("boolean" === typeof value) return value;
2082
+ if ("number" === typeof value) return serializeNumber(value);
2083
+ if ("undefined" === typeof value) return "$undefined";
2084
+ if ("function" === typeof value)
2085
+ return isClientReference(value)
2086
+ ? serializeClientReference(request, parent, parentPropertyName, value)
2087
+ : void 0 !== request.temporaryReferences &&
2088
+ ((request = request.temporaryReferences.get(value)),
2089
+ void 0 !== request)
2090
+ ? "$T" + request
2091
+ : "$E(" + (Function.prototype.toString.call(value) + ")");
2092
+ if ("symbol" === typeof value) {
2093
+ counter = request.writtenSymbols.get(value);
2094
+ if (void 0 !== counter) return serializeByValueID(counter);
2095
+ counter = value.description;
2096
+ request.pendingChunks++;
2097
+ value = request.nextChunkId++;
2098
+ emitSymbolChunk(request, value, counter);
2099
+ return serializeByValueID(value);
2100
+ }
2101
+ return "bigint" === typeof value
2102
+ ? "$n" + value.toString(10)
2103
+ : value instanceof Date
2104
+ ? "$D" + value.toJSON()
2105
+ : "unknown type " + typeof value;
2106
+ }
2107
+ function outlineConsoleValue(request, counter, model) {
2108
+ function replacer(parentPropertyName, value) {
2109
+ try {
2110
+ return renderConsoleValue(
2111
+ request,
2112
+ counter,
2113
+ this,
2114
+ parentPropertyName,
2115
+ value
2116
+ );
2117
+ } catch (x) {
2118
+ return (
2119
+ "Unknown Value: React could not send it from the server.\n" +
2120
+ x.message
2121
+ );
2122
+ }
2123
+ }
2124
+ "object" === typeof model && null !== model && doNotLimit.add(model);
2125
+ try {
2126
+ var json = stringify(model, replacer);
2127
+ } catch (x) {
2128
+ json = stringify(
2129
+ "Unknown Value: React could not send it from the server.\n" +
2130
+ x.message
2131
+ );
2132
+ }
2133
+ request.pendingChunks++;
2134
+ model = request.nextChunkId++;
2135
+ json = model.toString(16) + ":" + json + "\n";
2136
+ request.completedRegularChunks.push(json);
2137
+ return model;
2138
+ }
2139
+ function emitConsoleChunk(
2140
+ request,
2141
+ id,
2142
+ methodName,
2143
+ owner,
2144
+ stackTrace,
2145
+ args
2146
+ ) {
2147
+ function replacer(parentPropertyName, value) {
2148
+ try {
2149
+ return renderConsoleValue(
2150
+ request,
2151
+ counter,
2152
+ this,
2153
+ parentPropertyName,
2154
+ value
2155
+ );
2156
+ } catch (x) {
2157
+ return (
2158
+ "Unknown Value: React could not send it from the server.\n" +
2159
+ x.message
2160
+ );
2161
+ }
2162
+ }
2163
+ var counter = { objectLimit: 500 };
2164
+ null != owner && outlineComponentInfo(request, owner);
2165
+ var env = (0, request.environmentName)(),
2166
+ payload = [methodName, stackTrace, owner, env];
2167
+ payload.push.apply(payload, args);
2168
+ try {
2169
+ var json = stringify(payload, replacer);
2170
+ } catch (x) {
2171
+ json = stringify(
2172
+ [
2173
+ methodName,
2174
+ stackTrace,
2175
+ owner,
2176
+ env,
2177
+ "Unknown Value: React could not send it from the server.",
2178
+ x
2179
+ ],
2180
+ replacer
2181
+ );
2182
+ }
2183
+ id = serializeRowHeader("W", id) + json + "\n";
2184
+ request.completedRegularChunks.push(id);
2185
+ }
2186
+ function forwardDebugInfo(request, id, debugInfo) {
2187
+ for (var i = 0; i < debugInfo.length; i++)
2188
+ request.pendingChunks++,
2189
+ "string" === typeof debugInfo[i].name &&
2190
+ outlineComponentInfo(request, debugInfo[i]),
2191
+ emitDebugChunk(request, id, debugInfo[i]);
2192
+ }
2193
+ function emitChunk(request, task, value) {
2194
+ var id = task.id;
2195
+ "string" === typeof value && null !== byteLengthOfChunk
2196
+ ? emitTextChunk(request, id, value)
2197
+ : value instanceof ArrayBuffer
2198
+ ? emitTypedArrayChunk(request, id, "A", new Uint8Array(value))
2199
+ : value instanceof Int8Array
2200
+ ? emitTypedArrayChunk(request, id, "O", value)
2201
+ : value instanceof Uint8Array
2202
+ ? emitTypedArrayChunk(request, id, "o", value)
2203
+ : value instanceof Uint8ClampedArray
2204
+ ? emitTypedArrayChunk(request, id, "U", value)
2205
+ : value instanceof Int16Array
2206
+ ? emitTypedArrayChunk(request, id, "S", value)
2207
+ : value instanceof Uint16Array
2208
+ ? emitTypedArrayChunk(request, id, "s", value)
2209
+ : value instanceof Int32Array
2210
+ ? emitTypedArrayChunk(request, id, "L", value)
2211
+ : value instanceof Uint32Array
2212
+ ? emitTypedArrayChunk(request, id, "l", value)
2213
+ : value instanceof Float32Array
2214
+ ? emitTypedArrayChunk(request, id, "G", value)
2215
+ : value instanceof Float64Array
2216
+ ? emitTypedArrayChunk(request, id, "g", value)
2217
+ : value instanceof BigInt64Array
2218
+ ? emitTypedArrayChunk(request, id, "M", value)
2219
+ : value instanceof BigUint64Array
2220
+ ? emitTypedArrayChunk(request, id, "m", value)
2221
+ : value instanceof DataView
2222
+ ? emitTypedArrayChunk(request, id, "V", value)
2223
+ : ((value = stringify(value, task.toJSON)),
2224
+ emitModelChunk(request, task.id, value));
2225
+ }
2226
+ function retryTask(request, task) {
2227
+ if (task.status === PENDING$1) {
2228
+ var prevDebugID = debugID;
2229
+ task.status = RENDERING;
2230
+ try {
2231
+ modelRoot = task.model;
2232
+ debugID = task.id;
2233
+ var resolvedModel = renderModelDestructive(
2234
+ request,
2235
+ task,
2236
+ emptyRoot,
2237
+ "",
2238
+ task.model
2239
+ );
2240
+ debugID = null;
2241
+ modelRoot = resolvedModel;
2242
+ task.keyPath = null;
2243
+ task.implicitSlot = !1;
2244
+ if ("object" === typeof resolvedModel && null !== resolvedModel) {
2245
+ request.writtenObjects.set(
2246
+ resolvedModel,
2247
+ serializeByValueID(task.id)
2248
+ );
2249
+ var currentEnv = (0, request.environmentName)();
2250
+ currentEnv !== task.environmentName &&
2251
+ (request.pendingChunks++,
2252
+ emitDebugChunk(request, task.id, { env: currentEnv }));
2253
+ emitChunk(request, task, resolvedModel);
2254
+ } else {
2255
+ var json = stringify(resolvedModel),
2256
+ _currentEnv = (0, request.environmentName)();
2257
+ _currentEnv !== task.environmentName &&
2258
+ (request.pendingChunks++,
2259
+ emitDebugChunk(request, task.id, { env: _currentEnv }));
2260
+ emitModelChunk(request, task.id, json);
2261
+ }
2262
+ request.abortableTasks.delete(task);
2263
+ task.status = COMPLETED;
2264
+ } catch (thrownValue) {
2265
+ if (request.status === ABORTING) {
2266
+ request.abortableTasks.delete(task);
2267
+ task.status = ABORTED;
2268
+ var model = stringify(serializeByValueID(request.fatalError));
2269
+ emitModelChunk(request, task.id, model);
2270
+ } else {
2271
+ var x =
2272
+ thrownValue === SuspenseException
2273
+ ? getSuspendedThenable()
2274
+ : thrownValue;
2275
+ if (
2276
+ "object" === typeof x &&
2277
+ null !== x &&
2278
+ "function" === typeof x.then
2279
+ ) {
2280
+ task.status = PENDING$1;
2281
+ task.thenableState = getThenableStateAfterSuspending();
2282
+ var ping = task.ping;
2283
+ x.then(ping, ping);
2284
+ } else {
2285
+ request.abortableTasks.delete(task);
2286
+ task.status = ERRORED$1;
2287
+ var digest = logRecoverableError(request, x, task);
2288
+ emitErrorChunk(request, task.id, digest, x);
2289
+ }
2290
+ }
2291
+ } finally {
2292
+ debugID = prevDebugID;
2293
+ }
2294
+ }
2295
+ }
2296
+ function tryStreamTask(request, task) {
2297
+ var prevDebugID = debugID;
2298
+ debugID = null;
2299
+ try {
2300
+ emitChunk(request, task, task.model);
2301
+ } finally {
2302
+ debugID = prevDebugID;
2303
+ }
2304
+ }
2305
+ function performWork(request) {
2306
+ var prevDispatcher = ReactSharedInternalsServer.H;
2307
+ ReactSharedInternalsServer.H = HooksDispatcher;
2308
+ var prevRequest = currentRequest;
2309
+ currentRequest$1 = currentRequest = request;
2310
+ var hadAbortableTasks = 0 < request.abortableTasks.size;
2311
+ try {
2312
+ var pingedTasks = request.pingedTasks;
2313
+ request.pingedTasks = [];
2314
+ for (var i = 0; i < pingedTasks.length; i++)
2315
+ retryTask(request, pingedTasks[i]);
2316
+ null !== request.destination &&
2317
+ flushCompletedChunks(request, request.destination);
2318
+ if (hadAbortableTasks && 0 === request.abortableTasks.size) {
2319
+ var onAllReady = request.onAllReady;
2320
+ onAllReady();
2321
+ }
2322
+ } catch (error) {
2323
+ logRecoverableError(request, error, null), fatalError(request, error);
2324
+ } finally {
2325
+ (ReactSharedInternalsServer.H = prevDispatcher),
2326
+ (currentRequest$1 = null),
2327
+ (currentRequest = prevRequest);
2328
+ }
2329
+ }
2330
+ function flushCompletedChunks(request, destination) {
2331
+ currentView = new Uint8Array(2048);
2332
+ writtenBytes = 0;
2333
+ destinationHasCapacity = !0;
2334
+ try {
2335
+ for (
2336
+ var importsChunks = request.completedImportChunks, i = 0;
2337
+ i < importsChunks.length;
2338
+ i++
2339
+ )
2340
+ if (
2341
+ (request.pendingChunks--,
2342
+ !writeChunkAndReturn(destination, importsChunks[i]))
2343
+ ) {
2344
+ request.destination = null;
2345
+ i++;
2346
+ break;
2347
+ }
2348
+ importsChunks.splice(0, i);
2349
+ var hintChunks = request.completedHintChunks;
2350
+ for (i = 0; i < hintChunks.length; i++)
2351
+ if (!writeChunkAndReturn(destination, hintChunks[i])) {
2352
+ request.destination = null;
2353
+ i++;
2354
+ break;
2355
+ }
2356
+ hintChunks.splice(0, i);
2357
+ var regularChunks = request.completedRegularChunks;
2358
+ for (i = 0; i < regularChunks.length; i++)
2359
+ if (
2360
+ (request.pendingChunks--,
2361
+ !writeChunkAndReturn(destination, regularChunks[i]))
2362
+ ) {
2363
+ request.destination = null;
2364
+ i++;
2365
+ break;
2366
+ }
2367
+ regularChunks.splice(0, i);
2368
+ var errorChunks = request.completedErrorChunks;
2369
+ for (i = 0; i < errorChunks.length; i++)
2370
+ if (
2371
+ (request.pendingChunks--,
2372
+ !writeChunkAndReturn(destination, errorChunks[i]))
2373
+ ) {
2374
+ request.destination = null;
2375
+ i++;
2376
+ break;
2377
+ }
2378
+ errorChunks.splice(0, i);
2379
+ } finally {
2380
+ (request.flushScheduled = !1),
2381
+ currentView &&
2382
+ 0 < writtenBytes &&
2383
+ destination.write(currentView.subarray(0, writtenBytes)),
2384
+ (currentView = null),
2385
+ (writtenBytes = 0),
2386
+ (destinationHasCapacity = !0);
2387
+ }
2388
+ "function" === typeof destination.flush && destination.flush();
2389
+ 0 === request.pendingChunks &&
2390
+ ((request.status = CLOSED),
2391
+ destination.end(),
2392
+ (request.destination = null));
2393
+ }
2394
+ function startWork(request) {
2395
+ request.flushScheduled = null !== request.destination;
2396
+ scheduleMicrotask(function () {
2397
+ requestStorage.run(request, performWork, request);
2398
+ });
2399
+ setImmediate(function () {
2400
+ request.status === OPENING && (request.status = 11);
2401
+ });
2402
+ }
2403
+ function enqueueFlush(request) {
2404
+ !1 === request.flushScheduled &&
2405
+ 0 === request.pingedTasks.length &&
2406
+ null !== request.destination &&
2407
+ ((request.flushScheduled = !0),
2408
+ setImmediate(function () {
2409
+ request.flushScheduled = !1;
2410
+ var destination = request.destination;
2411
+ destination && flushCompletedChunks(request, destination);
2412
+ }));
2413
+ }
2414
+ function startFlowing(request, destination) {
2415
+ if (request.status === CLOSING)
2416
+ (request.status = CLOSED), destination.destroy(request.fatalError);
2417
+ else if (request.status !== CLOSED && null === request.destination) {
2418
+ request.destination = destination;
2419
+ try {
2420
+ flushCompletedChunks(request, destination);
2421
+ } catch (error) {
2422
+ logRecoverableError(request, error, null), fatalError(request, error);
2423
+ }
2424
+ }
2425
+ }
2426
+ function abort(request, reason) {
2427
+ try {
2428
+ 11 >= request.status && (request.status = ABORTING);
2429
+ var abortableTasks = request.abortableTasks;
2430
+ if (0 < abortableTasks.size) {
2431
+ var error =
2432
+ void 0 === reason
2433
+ ? Error(
2434
+ "The render was aborted by the server without a reason."
2435
+ )
2436
+ : "object" === typeof reason &&
2437
+ null !== reason &&
2438
+ "function" === typeof reason.then
2439
+ ? Error(
2440
+ "The render was aborted by the server with a promise."
2441
+ )
2442
+ : reason,
2443
+ digest = logRecoverableError(request, error, null),
2444
+ _errorId2 = request.nextChunkId++;
2445
+ request.fatalError = _errorId2;
2446
+ request.pendingChunks++;
2447
+ emitErrorChunk(request, _errorId2, digest, error);
2448
+ abortableTasks.forEach(function (task) {
2449
+ if (task.status !== RENDERING) {
2450
+ task.status = ABORTED;
2451
+ var ref = serializeByValueID(_errorId2);
2452
+ task = encodeReferenceChunk(request, task.id, ref);
2453
+ request.completedErrorChunks.push(task);
2454
+ }
2455
+ });
2456
+ abortableTasks.clear();
2457
+ var onAllReady = request.onAllReady;
2458
+ onAllReady();
2459
+ }
2460
+ var abortListeners = request.abortListeners;
2461
+ if (0 < abortListeners.size) {
2462
+ var _error =
2463
+ void 0 === reason
2464
+ ? Error("The render was aborted by the server without a reason.")
2465
+ : "object" === typeof reason &&
2466
+ null !== reason &&
2467
+ "function" === typeof reason.then
2468
+ ? Error("The render was aborted by the server with a promise.")
2469
+ : reason;
2470
+ abortListeners.forEach(function (callback) {
2471
+ return callback(_error);
2472
+ });
2473
+ abortListeners.clear();
2474
+ }
2475
+ null !== request.destination &&
2476
+ flushCompletedChunks(request, request.destination);
2477
+ } catch (error$2) {
2478
+ logRecoverableError(request, error$2, null),
2479
+ fatalError(request, error$2);
2480
+ }
2481
+ }
2482
+ function resolveServerReference(bundlerConfig, id) {
2483
+ var idx = id.lastIndexOf("#");
2484
+ bundlerConfig = id.slice(0, idx);
2485
+ id = id.slice(idx + 1);
2486
+ return { specifier: bundlerConfig, name: id };
2487
+ }
2488
+ function preloadModule(metadata) {
2489
+ var existingPromise = asyncModuleCache.get(metadata.specifier);
2490
+ if (existingPromise)
2491
+ return "fulfilled" === existingPromise.status ? null : existingPromise;
2492
+ var modulePromise = import(metadata.specifier);
2493
+ metadata.async &&
2494
+ (modulePromise = modulePromise.then(function (value) {
2495
+ return value.default;
2496
+ }));
2497
+ modulePromise.then(
2498
+ function (value) {
2499
+ var fulfilledThenable = modulePromise;
2500
+ fulfilledThenable.status = "fulfilled";
2501
+ fulfilledThenable.value = value;
2502
+ },
2503
+ function (reason) {
2504
+ var rejectedThenable = modulePromise;
2505
+ rejectedThenable.status = "rejected";
2506
+ rejectedThenable.reason = reason;
2507
+ }
2508
+ );
2509
+ asyncModuleCache.set(metadata.specifier, modulePromise);
2510
+ return modulePromise;
2511
+ }
2512
+ function requireModule(metadata) {
2513
+ var moduleExports = asyncModuleCache.get(metadata.specifier);
2514
+ if ("fulfilled" === moduleExports.status)
2515
+ moduleExports = moduleExports.value;
2516
+ else throw moduleExports.reason;
2517
+ return "*" === metadata.name
2518
+ ? moduleExports
2519
+ : "" === metadata.name
2520
+ ? moduleExports.default
2521
+ : moduleExports[metadata.name];
2522
+ }
2523
+ function Chunk(status, value, reason, response) {
2524
+ this.status = status;
2525
+ this.value = value;
2526
+ this.reason = reason;
2527
+ this._response = response;
2528
+ }
2529
+ function createPendingChunk(response) {
2530
+ return new Chunk("pending", null, null, response);
2531
+ }
2532
+ function wakeChunk(listeners, value) {
2533
+ for (var i = 0; i < listeners.length; i++) (0, listeners[i])(value);
2534
+ }
2535
+ function triggerErrorOnChunk(chunk, error) {
2536
+ if ("pending" !== chunk.status && "blocked" !== chunk.status)
2537
+ chunk.reason.error(error);
2538
+ else {
2539
+ var listeners = chunk.reason;
2540
+ chunk.status = "rejected";
2541
+ chunk.reason = error;
2542
+ null !== listeners && wakeChunk(listeners, error);
2543
+ }
2544
+ }
2545
+ function resolveModelChunk(chunk, value, id) {
2546
+ if ("pending" !== chunk.status)
2547
+ (chunk = chunk.reason),
2548
+ "C" === value[0]
2549
+ ? chunk.close("C" === value ? '"$undefined"' : value.slice(1))
2550
+ : chunk.enqueueModel(value);
2551
+ else {
2552
+ var resolveListeners = chunk.value,
2553
+ rejectListeners = chunk.reason;
2554
+ chunk.status = "resolved_model";
2555
+ chunk.value = value;
2556
+ chunk.reason = id;
2557
+ if (null !== resolveListeners)
2558
+ switch ((initializeModelChunk(chunk), chunk.status)) {
2559
+ case "fulfilled":
2560
+ wakeChunk(resolveListeners, chunk.value);
2561
+ break;
2562
+ case "pending":
2563
+ case "blocked":
2564
+ case "cyclic":
2565
+ if (chunk.value)
2566
+ for (value = 0; value < resolveListeners.length; value++)
2567
+ chunk.value.push(resolveListeners[value]);
2568
+ else chunk.value = resolveListeners;
2569
+ if (chunk.reason) {
2570
+ if (rejectListeners)
2571
+ for (value = 0; value < rejectListeners.length; value++)
2572
+ chunk.reason.push(rejectListeners[value]);
2573
+ } else chunk.reason = rejectListeners;
2574
+ break;
2575
+ case "rejected":
2576
+ rejectListeners && wakeChunk(rejectListeners, chunk.reason);
2577
+ }
2578
+ }
2579
+ }
2580
+ function createResolvedIteratorResultChunk(response, value, done) {
2581
+ return new Chunk(
2582
+ "resolved_model",
2583
+ (done ? '{"done":true,"value":' : '{"done":false,"value":') +
2584
+ value +
2585
+ "}",
2586
+ -1,
2587
+ response
2588
+ );
2589
+ }
2590
+ function resolveIteratorResultChunk(chunk, value, done) {
2591
+ resolveModelChunk(
2592
+ chunk,
2593
+ (done ? '{"done":true,"value":' : '{"done":false,"value":') +
2594
+ value +
2595
+ "}",
2596
+ -1
2597
+ );
2598
+ }
2599
+ function loadServerReference$1(
2600
+ response,
2601
+ id,
2602
+ bound,
2603
+ parentChunk,
2604
+ parentObject,
2605
+ key
2606
+ ) {
2607
+ var serverReference = resolveServerReference(response._bundlerConfig, id);
2608
+ id = preloadModule(serverReference);
2609
+ if (bound)
2610
+ bound = Promise.all([bound, id]).then(function (_ref) {
2611
+ _ref = _ref[0];
2612
+ var fn = requireModule(serverReference);
2613
+ return fn.bind.apply(fn, [null].concat(_ref));
2614
+ });
2615
+ else if (id)
2616
+ bound = Promise.resolve(id).then(function () {
2617
+ return requireModule(serverReference);
2618
+ });
2619
+ else return requireModule(serverReference);
2620
+ bound.then(
2621
+ createModelResolver(
2622
+ parentChunk,
2623
+ parentObject,
2624
+ key,
2625
+ !1,
2626
+ response,
2627
+ createModel,
2628
+ []
2629
+ ),
2630
+ createModelReject(parentChunk)
2631
+ );
2632
+ return null;
2633
+ }
2634
+ function reviveModel(response, parentObj, parentKey, value, reference) {
2635
+ if ("string" === typeof value)
2636
+ return parseModelString(
2637
+ response,
2638
+ parentObj,
2639
+ parentKey,
2640
+ value,
2641
+ reference
2642
+ );
2643
+ if ("object" === typeof value && null !== value)
2644
+ if (
2645
+ (void 0 !== reference &&
2646
+ void 0 !== response._temporaryReferences &&
2647
+ response._temporaryReferences.set(value, reference),
2648
+ Array.isArray(value))
2649
+ )
2650
+ for (var i = 0; i < value.length; i++)
2651
+ value[i] = reviveModel(
2652
+ response,
2653
+ value,
2654
+ "" + i,
2655
+ value[i],
2656
+ void 0 !== reference ? reference + ":" + i : void 0
2657
+ );
2658
+ else
2659
+ for (i in value)
2660
+ hasOwnProperty.call(value, i) &&
2661
+ ((parentObj =
2662
+ void 0 !== reference && -1 === i.indexOf(":")
2663
+ ? reference + ":" + i
2664
+ : void 0),
2665
+ (parentObj = reviveModel(
2666
+ response,
2667
+ value,
2668
+ i,
2669
+ value[i],
2670
+ parentObj
2671
+ )),
2672
+ void 0 !== parentObj ? (value[i] = parentObj) : delete value[i]);
2673
+ return value;
2674
+ }
2675
+ function initializeModelChunk(chunk) {
2676
+ var prevChunk = initializingChunk,
2677
+ prevBlocked = initializingChunkBlockedModel;
2678
+ initializingChunk = chunk;
2679
+ initializingChunkBlockedModel = null;
2680
+ var rootReference =
2681
+ -1 === chunk.reason ? void 0 : chunk.reason.toString(16),
2682
+ resolvedModel = chunk.value;
2683
+ chunk.status = "cyclic";
2684
+ chunk.value = null;
2685
+ chunk.reason = null;
2686
+ try {
2687
+ var rawModel = JSON.parse(resolvedModel),
2688
+ value = reviveModel(
2689
+ chunk._response,
2690
+ { "": rawModel },
2691
+ "",
2692
+ rawModel,
2693
+ rootReference
2694
+ );
2695
+ if (
2696
+ null !== initializingChunkBlockedModel &&
2697
+ 0 < initializingChunkBlockedModel.deps
2698
+ )
2699
+ (initializingChunkBlockedModel.value = value),
2700
+ (chunk.status = "blocked");
2701
+ else {
2702
+ var resolveListeners = chunk.value;
2703
+ chunk.status = "fulfilled";
2704
+ chunk.value = value;
2705
+ null !== resolveListeners && wakeChunk(resolveListeners, value);
2706
+ }
2707
+ } catch (error) {
2708
+ (chunk.status = "rejected"), (chunk.reason = error);
2709
+ } finally {
2710
+ (initializingChunk = prevChunk),
2711
+ (initializingChunkBlockedModel = prevBlocked);
2712
+ }
2713
+ }
2714
+ function reportGlobalError(response, error) {
2715
+ response._chunks.forEach(function (chunk) {
2716
+ "pending" === chunk.status && triggerErrorOnChunk(chunk, error);
2717
+ });
2718
+ }
2719
+ function getChunk(response, id) {
2720
+ var chunks = response._chunks,
2721
+ chunk = chunks.get(id);
2722
+ chunk ||
2723
+ ((chunk = response._formData.get(response._prefix + id)),
2724
+ (chunk =
2725
+ null != chunk
2726
+ ? new Chunk("resolved_model", chunk, id, response)
2727
+ : createPendingChunk(response)),
2728
+ chunks.set(id, chunk));
2729
+ return chunk;
2730
+ }
2731
+ function createModelResolver(
2732
+ chunk,
2733
+ parentObject,
2734
+ key,
2735
+ cyclic,
2736
+ response,
2737
+ map,
2738
+ path
2739
+ ) {
2740
+ if (initializingChunkBlockedModel) {
2741
+ var blocked = initializingChunkBlockedModel;
2742
+ cyclic || blocked.deps++;
2743
+ } else
2744
+ blocked = initializingChunkBlockedModel = {
2745
+ deps: cyclic ? 0 : 1,
2746
+ value: null
2747
+ };
2748
+ return function (value) {
2749
+ for (var i = 1; i < path.length; i++) value = value[path[i]];
2750
+ parentObject[key] = map(response, value);
2751
+ "" === key &&
2752
+ null === blocked.value &&
2753
+ (blocked.value = parentObject[key]);
2754
+ blocked.deps--;
2755
+ 0 === blocked.deps &&
2756
+ "blocked" === chunk.status &&
2757
+ ((value = chunk.value),
2758
+ (chunk.status = "fulfilled"),
2759
+ (chunk.value = blocked.value),
2760
+ null !== value && wakeChunk(value, blocked.value));
2761
+ };
2762
+ }
2763
+ function createModelReject(chunk) {
2764
+ return function (error) {
2765
+ return triggerErrorOnChunk(chunk, error);
2766
+ };
2767
+ }
2768
+ function getOutlinedModel(response, reference, parentObject, key, map) {
2769
+ reference = reference.split(":");
2770
+ var id = parseInt(reference[0], 16);
2771
+ id = getChunk(response, id);
2772
+ switch (id.status) {
2773
+ case "resolved_model":
2774
+ initializeModelChunk(id);
2775
+ }
2776
+ switch (id.status) {
2777
+ case "fulfilled":
2778
+ parentObject = id.value;
2779
+ for (key = 1; key < reference.length; key++)
2780
+ parentObject = parentObject[reference[key]];
2781
+ return map(response, parentObject);
2782
+ case "pending":
2783
+ case "blocked":
2784
+ case "cyclic":
2785
+ var parentChunk = initializingChunk;
2786
+ id.then(
2787
+ createModelResolver(
2788
+ parentChunk,
2789
+ parentObject,
2790
+ key,
2791
+ "cyclic" === id.status,
2792
+ response,
2793
+ map,
2794
+ reference
2795
+ ),
2796
+ createModelReject(parentChunk)
2797
+ );
2798
+ return null;
2799
+ default:
2800
+ throw id.reason;
2801
+ }
2802
+ }
2803
+ function createMap(response, model) {
2804
+ return new Map(model);
2805
+ }
2806
+ function createSet(response, model) {
2807
+ return new Set(model);
2808
+ }
2809
+ function extractIterator(response, model) {
2810
+ return model[Symbol.iterator]();
2811
+ }
2812
+ function createModel(response, model) {
2813
+ return model;
2814
+ }
2815
+ function parseTypedArray(
2816
+ response,
2817
+ reference,
2818
+ constructor,
2819
+ bytesPerElement,
2820
+ parentObject,
2821
+ parentKey
2822
+ ) {
2823
+ reference = parseInt(reference.slice(2), 16);
2824
+ reference = response._formData.get(response._prefix + reference);
2825
+ reference =
2826
+ constructor === ArrayBuffer
2827
+ ? reference.arrayBuffer()
2828
+ : reference.arrayBuffer().then(function (buffer) {
2829
+ return new constructor(buffer);
2830
+ });
2831
+ bytesPerElement = initializingChunk;
2832
+ reference.then(
2833
+ createModelResolver(
2834
+ bytesPerElement,
2835
+ parentObject,
2836
+ parentKey,
2837
+ !1,
2838
+ response,
2839
+ createModel,
2840
+ []
2841
+ ),
2842
+ createModelReject(bytesPerElement)
2843
+ );
2844
+ return null;
2845
+ }
2846
+ function resolveStream(response, id, stream, controller) {
2847
+ var chunks = response._chunks;
2848
+ stream = new Chunk("fulfilled", stream, controller, response);
2849
+ chunks.set(id, stream);
2850
+ response = response._formData.getAll(response._prefix + id);
2851
+ for (id = 0; id < response.length; id++)
2852
+ (chunks = response[id]),
2853
+ "C" === chunks[0]
2854
+ ? controller.close(
2855
+ "C" === chunks ? '"$undefined"' : chunks.slice(1)
2856
+ )
2857
+ : controller.enqueueModel(chunks);
2858
+ }
2859
+ function parseReadableStream(response, reference, type) {
2860
+ reference = parseInt(reference.slice(2), 16);
2861
+ var controller = null;
2862
+ type = new ReadableStream({
2863
+ type: type,
2864
+ start: function (c) {
2865
+ controller = c;
2866
+ }
2867
+ });
2868
+ var previousBlockedChunk = null;
2869
+ resolveStream(response, reference, type, {
2870
+ enqueueModel: function (json) {
2871
+ if (null === previousBlockedChunk) {
2872
+ var chunk = new Chunk("resolved_model", json, -1, response);
2873
+ initializeModelChunk(chunk);
2874
+ "fulfilled" === chunk.status
2875
+ ? controller.enqueue(chunk.value)
2876
+ : (chunk.then(
2877
+ function (v) {
2878
+ return controller.enqueue(v);
2879
+ },
2880
+ function (e) {
2881
+ return controller.error(e);
2882
+ }
2883
+ ),
2884
+ (previousBlockedChunk = chunk));
2885
+ } else {
2886
+ chunk = previousBlockedChunk;
2887
+ var _chunk = createPendingChunk(response);
2888
+ _chunk.then(
2889
+ function (v) {
2890
+ return controller.enqueue(v);
2891
+ },
2892
+ function (e) {
2893
+ return controller.error(e);
2894
+ }
2895
+ );
2896
+ previousBlockedChunk = _chunk;
2897
+ chunk.then(function () {
2898
+ previousBlockedChunk === _chunk && (previousBlockedChunk = null);
2899
+ resolveModelChunk(_chunk, json, -1);
2900
+ });
2901
+ }
2902
+ },
2903
+ close: function () {
2904
+ if (null === previousBlockedChunk) controller.close();
2905
+ else {
2906
+ var blockedChunk = previousBlockedChunk;
2907
+ previousBlockedChunk = null;
2908
+ blockedChunk.then(function () {
2909
+ return controller.close();
2910
+ });
2911
+ }
2912
+ },
2913
+ error: function (error) {
2914
+ if (null === previousBlockedChunk) controller.error(error);
2915
+ else {
2916
+ var blockedChunk = previousBlockedChunk;
2917
+ previousBlockedChunk = null;
2918
+ blockedChunk.then(function () {
2919
+ return controller.error(error);
2920
+ });
2921
+ }
2922
+ }
2923
+ });
2924
+ return type;
2925
+ }
2926
+ function asyncIterator() {
2927
+ return this;
2928
+ }
2929
+ function createIterator(next) {
2930
+ next = { next: next };
2931
+ next[ASYNC_ITERATOR] = asyncIterator;
2932
+ return next;
2933
+ }
2934
+ function parseAsyncIterable(response, reference, iterator) {
2935
+ reference = parseInt(reference.slice(2), 16);
2936
+ var buffer = [],
2937
+ closed = !1,
2938
+ nextWriteIndex = 0,
2939
+ iterable = _defineProperty({}, ASYNC_ITERATOR, function () {
2940
+ var nextReadIndex = 0;
2941
+ return createIterator(function (arg) {
2942
+ if (void 0 !== arg)
2943
+ throw Error(
2944
+ "Values cannot be passed to next() of AsyncIterables passed to Client Components."
2945
+ );
2946
+ if (nextReadIndex === buffer.length) {
2947
+ if (closed)
2948
+ return new Chunk(
2949
+ "fulfilled",
2950
+ { done: !0, value: void 0 },
2951
+ null,
2952
+ response
2953
+ );
2954
+ buffer[nextReadIndex] = createPendingChunk(response);
2955
+ }
2956
+ return buffer[nextReadIndex++];
2957
+ });
2958
+ });
2959
+ iterator = iterator ? iterable[ASYNC_ITERATOR]() : iterable;
2960
+ resolveStream(response, reference, iterator, {
2961
+ enqueueModel: function (value) {
2962
+ nextWriteIndex === buffer.length
2963
+ ? (buffer[nextWriteIndex] = createResolvedIteratorResultChunk(
2964
+ response,
2965
+ value,
2966
+ !1
2967
+ ))
2968
+ : resolveIteratorResultChunk(buffer[nextWriteIndex], value, !1);
2969
+ nextWriteIndex++;
2970
+ },
2971
+ close: function (value) {
2972
+ closed = !0;
2973
+ nextWriteIndex === buffer.length
2974
+ ? (buffer[nextWriteIndex] = createResolvedIteratorResultChunk(
2975
+ response,
2976
+ value,
2977
+ !0
2978
+ ))
2979
+ : resolveIteratorResultChunk(buffer[nextWriteIndex], value, !0);
2980
+ for (nextWriteIndex++; nextWriteIndex < buffer.length; )
2981
+ resolveIteratorResultChunk(
2982
+ buffer[nextWriteIndex++],
2983
+ '"$undefined"',
2984
+ !0
2985
+ );
2986
+ },
2987
+ error: function (error) {
2988
+ closed = !0;
2989
+ for (
2990
+ nextWriteIndex === buffer.length &&
2991
+ (buffer[nextWriteIndex] = createPendingChunk(response));
2992
+ nextWriteIndex < buffer.length;
2993
+
2994
+ )
2995
+ triggerErrorOnChunk(buffer[nextWriteIndex++], error);
2996
+ }
2997
+ });
2998
+ return iterator;
2999
+ }
3000
+ function parseModelString(response, obj, key, value, reference) {
3001
+ if ("$" === value[0]) {
3002
+ switch (value[1]) {
3003
+ case "$":
3004
+ return value.slice(1);
3005
+ case "@":
3006
+ return (
3007
+ (obj = parseInt(value.slice(2), 16)), getChunk(response, obj)
3008
+ );
3009
+ case "F":
3010
+ return (
3011
+ (value = value.slice(2)),
3012
+ (value = getOutlinedModel(
3013
+ response,
3014
+ value,
3015
+ obj,
3016
+ key,
3017
+ createModel
3018
+ )),
3019
+ loadServerReference$1(
3020
+ response,
3021
+ value.id,
3022
+ value.bound,
3023
+ initializingChunk,
3024
+ obj,
3025
+ key
3026
+ )
3027
+ );
3028
+ case "T":
3029
+ if (
3030
+ void 0 === reference ||
3031
+ void 0 === response._temporaryReferences
3032
+ )
3033
+ throw Error(
3034
+ "Could not reference an opaque temporary reference. This is likely due to misconfiguring the temporaryReferences options on the server."
3035
+ );
3036
+ return createTemporaryReference(
3037
+ response._temporaryReferences,
3038
+ reference
3039
+ );
3040
+ case "Q":
3041
+ return (
3042
+ (value = value.slice(2)),
3043
+ getOutlinedModel(response, value, obj, key, createMap)
3044
+ );
3045
+ case "W":
3046
+ return (
3047
+ (value = value.slice(2)),
3048
+ getOutlinedModel(response, value, obj, key, createSet)
3049
+ );
3050
+ case "K":
3051
+ obj = value.slice(2);
3052
+ var formPrefix = response._prefix + obj + "_",
3053
+ data = new FormData();
3054
+ response._formData.forEach(function (entry, entryKey) {
3055
+ entryKey.startsWith(formPrefix) &&
3056
+ data.append(entryKey.slice(formPrefix.length), entry);
3057
+ });
3058
+ return data;
3059
+ case "i":
3060
+ return (
3061
+ (value = value.slice(2)),
3062
+ getOutlinedModel(response, value, obj, key, extractIterator)
3063
+ );
3064
+ case "I":
3065
+ return Infinity;
3066
+ case "-":
3067
+ return "$-0" === value ? -0 : -Infinity;
3068
+ case "N":
3069
+ return NaN;
3070
+ case "u":
3071
+ return;
3072
+ case "D":
3073
+ return new Date(Date.parse(value.slice(2)));
3074
+ case "n":
3075
+ return BigInt(value.slice(2));
3076
+ }
3077
+ switch (value[1]) {
3078
+ case "A":
3079
+ return parseTypedArray(response, value, ArrayBuffer, 1, obj, key);
3080
+ case "O":
3081
+ return parseTypedArray(response, value, Int8Array, 1, obj, key);
3082
+ case "o":
3083
+ return parseTypedArray(response, value, Uint8Array, 1, obj, key);
3084
+ case "U":
3085
+ return parseTypedArray(
3086
+ response,
3087
+ value,
3088
+ Uint8ClampedArray,
3089
+ 1,
3090
+ obj,
3091
+ key
3092
+ );
3093
+ case "S":
3094
+ return parseTypedArray(response, value, Int16Array, 2, obj, key);
3095
+ case "s":
3096
+ return parseTypedArray(response, value, Uint16Array, 2, obj, key);
3097
+ case "L":
3098
+ return parseTypedArray(response, value, Int32Array, 4, obj, key);
3099
+ case "l":
3100
+ return parseTypedArray(response, value, Uint32Array, 4, obj, key);
3101
+ case "G":
3102
+ return parseTypedArray(response, value, Float32Array, 4, obj, key);
3103
+ case "g":
3104
+ return parseTypedArray(response, value, Float64Array, 8, obj, key);
3105
+ case "M":
3106
+ return parseTypedArray(response, value, BigInt64Array, 8, obj, key);
3107
+ case "m":
3108
+ return parseTypedArray(
3109
+ response,
3110
+ value,
3111
+ BigUint64Array,
3112
+ 8,
3113
+ obj,
3114
+ key
3115
+ );
3116
+ case "V":
3117
+ return parseTypedArray(response, value, DataView, 1, obj, key);
3118
+ case "B":
3119
+ return (
3120
+ (obj = parseInt(value.slice(2), 16)),
3121
+ response._formData.get(response._prefix + obj)
3122
+ );
3123
+ }
3124
+ switch (value[1]) {
3125
+ case "R":
3126
+ return parseReadableStream(response, value, void 0);
3127
+ case "r":
3128
+ return parseReadableStream(response, value, "bytes");
3129
+ case "X":
3130
+ return parseAsyncIterable(response, value, !1);
3131
+ case "x":
3132
+ return parseAsyncIterable(response, value, !0);
3133
+ }
3134
+ value = value.slice(1);
3135
+ return getOutlinedModel(response, value, obj, key, createModel);
3136
+ }
3137
+ return value;
3138
+ }
3139
+ function createResponse(
3140
+ bundlerConfig,
3141
+ formFieldPrefix,
3142
+ temporaryReferences
3143
+ ) {
3144
+ var backingFormData =
3145
+ 3 < arguments.length && void 0 !== arguments[3]
3146
+ ? arguments[3]
3147
+ : new FormData(),
3148
+ chunks = new Map();
3149
+ return {
3150
+ _bundlerConfig: bundlerConfig,
3151
+ _prefix: formFieldPrefix,
3152
+ _formData: backingFormData,
3153
+ _chunks: chunks,
3154
+ _temporaryReferences: temporaryReferences
3155
+ };
3156
+ }
3157
+ function resolveField(response, key, value) {
3158
+ response._formData.append(key, value);
3159
+ var prefix = response._prefix;
3160
+ key.startsWith(prefix) &&
3161
+ ((response = response._chunks),
3162
+ (key = +key.slice(prefix.length)),
3163
+ (prefix = response.get(key)) && resolveModelChunk(prefix, value, key));
3164
+ }
3165
+ function close(response) {
3166
+ reportGlobalError(response, Error("Connection closed."));
3167
+ }
3168
+ function loadServerReference(bundlerConfig, id, bound) {
3169
+ var serverReference = resolveServerReference(bundlerConfig, id);
3170
+ bundlerConfig = preloadModule(serverReference);
3171
+ return bound
3172
+ ? Promise.all([bound, bundlerConfig]).then(function (_ref) {
3173
+ _ref = _ref[0];
3174
+ var fn = requireModule(serverReference);
3175
+ return fn.bind.apply(fn, [null].concat(_ref));
3176
+ })
3177
+ : bundlerConfig
3178
+ ? Promise.resolve(bundlerConfig).then(function () {
3179
+ return requireModule(serverReference);
3180
+ })
3181
+ : Promise.resolve(requireModule(serverReference));
3182
+ }
3183
+ function decodeBoundActionMetaData(body, serverManifest, formFieldPrefix) {
3184
+ body = createResponse(serverManifest, formFieldPrefix, void 0, body);
3185
+ close(body);
3186
+ body = getChunk(body, 0);
3187
+ body.then(function () {});
3188
+ if ("fulfilled" !== body.status) throw body.reason;
3189
+ return body.value;
3190
+ }
3191
+ function createDrainHandler(destination, request) {
3192
+ return function () {
3193
+ return startFlowing(request, destination);
3194
+ };
3195
+ }
3196
+ function createCancelHandler(request, reason) {
3197
+ return function () {
3198
+ request.destination = null;
3199
+ abort(request, Error(reason));
3200
+ };
3201
+ }
3202
+ var util = require("util");
3203
+ require("crypto");
3204
+ var async_hooks = require("async_hooks"),
3205
+ ReactDOM = require("react-dom"),
3206
+ React = require("react"),
3207
+ scheduleMicrotask = queueMicrotask,
3208
+ currentView = null,
3209
+ writtenBytes = 0,
3210
+ destinationHasCapacity = !0,
3211
+ textEncoder = new util.TextEncoder(),
3212
+ CLIENT_REFERENCE_TAG$1 = Symbol.for("react.client.reference"),
3213
+ SERVER_REFERENCE_TAG = Symbol.for("react.server.reference"),
3214
+ FunctionBind = Function.prototype.bind,
3215
+ ArraySlice = Array.prototype.slice,
3216
+ PROMISE_PROTOTYPE = Promise.prototype,
3217
+ deepProxyHandlers = {
3218
+ get: function (target, name) {
3219
+ switch (name) {
3220
+ case "$$typeof":
3221
+ return target.$$typeof;
3222
+ case "$$id":
3223
+ return target.$$id;
3224
+ case "$$async":
3225
+ return target.$$async;
3226
+ case "name":
3227
+ return target.name;
3228
+ case "displayName":
3229
+ return;
3230
+ case "defaultProps":
3231
+ return;
3232
+ case "toJSON":
3233
+ return;
3234
+ case Symbol.toPrimitive:
3235
+ return Object.prototype[Symbol.toPrimitive];
3236
+ case Symbol.toStringTag:
3237
+ return Object.prototype[Symbol.toStringTag];
3238
+ case "Provider":
3239
+ throw Error(
3240
+ "Cannot render a Client Context Provider on the Server. Instead, you can export a Client Component wrapper that itself renders a Client Context Provider."
3241
+ );
3242
+ case "then":
3243
+ throw Error(
3244
+ "Cannot await or return from a thenable. You cannot await a client module from a server component."
3245
+ );
3246
+ }
3247
+ throw Error(
3248
+ "Cannot access " +
3249
+ (String(target.name) + "." + String(name)) +
3250
+ " on the server. You cannot dot into a client module from a server component. You can only pass the imported name through."
3251
+ );
3252
+ },
3253
+ set: function () {
3254
+ throw Error("Cannot assign to a client module from a server module.");
3255
+ }
3256
+ },
3257
+ proxyHandlers$1 = {
3258
+ get: function (target, name) {
3259
+ return getReference(target, name);
3260
+ },
3261
+ getOwnPropertyDescriptor: function (target, name) {
3262
+ var descriptor = Object.getOwnPropertyDescriptor(target, name);
3263
+ descriptor ||
3264
+ ((descriptor = {
3265
+ value: getReference(target, name),
3266
+ writable: !1,
3267
+ configurable: !1,
3268
+ enumerable: !1
3269
+ }),
3270
+ Object.defineProperty(target, name, descriptor));
3271
+ return descriptor;
3272
+ },
3273
+ getPrototypeOf: function () {
3274
+ return PROMISE_PROTOTYPE;
3275
+ },
3276
+ set: function () {
3277
+ throw Error("Cannot assign to a client module from a server module.");
3278
+ }
3279
+ },
3280
+ ReactDOMSharedInternals =
3281
+ ReactDOM.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,
3282
+ previousDispatcher = ReactDOMSharedInternals.d;
3283
+ ReactDOMSharedInternals.d = {
3284
+ f: previousDispatcher.f,
3285
+ r: previousDispatcher.r,
3286
+ D: function (href) {
3287
+ if ("string" === typeof href && href) {
3288
+ var request = resolveRequest();
3289
+ if (request) {
3290
+ var hints = request.hints,
3291
+ key = "D|" + href;
3292
+ hints.has(key) || (hints.add(key), emitHint(request, "D", href));
3293
+ } else previousDispatcher.D(href);
3294
+ }
3295
+ },
3296
+ C: function (href, crossOrigin) {
3297
+ if ("string" === typeof href) {
3298
+ var request = resolveRequest();
3299
+ if (request) {
3300
+ var hints = request.hints,
3301
+ key =
3302
+ "C|" +
3303
+ (null == crossOrigin ? "null" : crossOrigin) +
3304
+ "|" +
3305
+ href;
3306
+ hints.has(key) ||
3307
+ (hints.add(key),
3308
+ "string" === typeof crossOrigin
3309
+ ? emitHint(request, "C", [href, crossOrigin])
3310
+ : emitHint(request, "C", href));
3311
+ } else previousDispatcher.C(href, crossOrigin);
3312
+ }
3313
+ },
3314
+ L: function (href, as, options) {
3315
+ if ("string" === typeof href) {
3316
+ var request = resolveRequest();
3317
+ if (request) {
3318
+ var hints = request.hints,
3319
+ key = "L";
3320
+ if ("image" === as && options) {
3321
+ var imageSrcSet = options.imageSrcSet,
3322
+ imageSizes = options.imageSizes,
3323
+ uniquePart = "";
3324
+ "string" === typeof imageSrcSet && "" !== imageSrcSet
3325
+ ? ((uniquePart += "[" + imageSrcSet + "]"),
3326
+ "string" === typeof imageSizes &&
3327
+ (uniquePart += "[" + imageSizes + "]"))
3328
+ : (uniquePart += "[][]" + href);
3329
+ key += "[image]" + uniquePart;
3330
+ } else key += "[" + as + "]" + href;
3331
+ hints.has(key) ||
3332
+ (hints.add(key),
3333
+ (options = trimOptions(options))
3334
+ ? emitHint(request, "L", [href, as, options])
3335
+ : emitHint(request, "L", [href, as]));
3336
+ } else previousDispatcher.L(href, as, options);
3337
+ }
3338
+ },
3339
+ m: function (href, options) {
3340
+ if ("string" === typeof href) {
3341
+ var request = resolveRequest();
3342
+ if (request) {
3343
+ var hints = request.hints,
3344
+ key = "m|" + href;
3345
+ if (hints.has(key)) return;
3346
+ hints.add(key);
3347
+ return (options = trimOptions(options))
3348
+ ? emitHint(request, "m", [href, options])
3349
+ : emitHint(request, "m", href);
3350
+ }
3351
+ previousDispatcher.m(href, options);
3352
+ }
3353
+ },
3354
+ X: function (src, options) {
3355
+ if ("string" === typeof src) {
3356
+ var request = resolveRequest();
3357
+ if (request) {
3358
+ var hints = request.hints,
3359
+ key = "X|" + src;
3360
+ if (hints.has(key)) return;
3361
+ hints.add(key);
3362
+ return (options = trimOptions(options))
3363
+ ? emitHint(request, "X", [src, options])
3364
+ : emitHint(request, "X", src);
3365
+ }
3366
+ previousDispatcher.X(src, options);
3367
+ }
3368
+ },
3369
+ S: function (href, precedence, options) {
3370
+ if ("string" === typeof href) {
3371
+ var request = resolveRequest();
3372
+ if (request) {
3373
+ var hints = request.hints,
3374
+ key = "S|" + href;
3375
+ if (hints.has(key)) return;
3376
+ hints.add(key);
3377
+ return (options = trimOptions(options))
3378
+ ? emitHint(request, "S", [
3379
+ href,
3380
+ "string" === typeof precedence ? precedence : 0,
3381
+ options
3382
+ ])
3383
+ : "string" === typeof precedence
3384
+ ? emitHint(request, "S", [href, precedence])
3385
+ : emitHint(request, "S", href);
3386
+ }
3387
+ previousDispatcher.S(href, precedence, options);
3388
+ }
3389
+ },
3390
+ M: function (src, options) {
3391
+ if ("string" === typeof src) {
3392
+ var request = resolveRequest();
3393
+ if (request) {
3394
+ var hints = request.hints,
3395
+ key = "M|" + src;
3396
+ if (hints.has(key)) return;
3397
+ hints.add(key);
3398
+ return (options = trimOptions(options))
3399
+ ? emitHint(request, "M", [src, options])
3400
+ : emitHint(request, "M", src);
3401
+ }
3402
+ previousDispatcher.M(src, options);
3403
+ }
3404
+ }
3405
+ };
3406
+ var frameRegExp =
3407
+ /^ {3} at (?:(.+) \((?:(.+):(\d+):(\d+)|<anonymous>)\)|(?:async )?(.+):(\d+):(\d+)|<anonymous>)$/,
3408
+ requestStorage = new async_hooks.AsyncLocalStorage(),
3409
+ componentStorage = new async_hooks.AsyncLocalStorage(),
3410
+ TEMPORARY_REFERENCE_TAG = Symbol.for("react.temporary.reference"),
3411
+ proxyHandlers = {
3412
+ get: function (target, name) {
3413
+ switch (name) {
3414
+ case "$$typeof":
3415
+ return target.$$typeof;
3416
+ case "name":
3417
+ return;
3418
+ case "displayName":
3419
+ return;
3420
+ case "defaultProps":
3421
+ return;
3422
+ case "toJSON":
3423
+ return;
3424
+ case Symbol.toPrimitive:
3425
+ return Object.prototype[Symbol.toPrimitive];
3426
+ case Symbol.toStringTag:
3427
+ return Object.prototype[Symbol.toStringTag];
3428
+ case "Provider":
3429
+ throw Error(
3430
+ "Cannot render a Client Context Provider on the Server. Instead, you can export a Client Component wrapper that itself renders a Client Context Provider."
3431
+ );
3432
+ }
3433
+ throw Error(
3434
+ "Cannot access " +
3435
+ String(name) +
3436
+ " on the server. You cannot dot into a temporary client reference from a server component. You can only pass the value through to the client."
3437
+ );
3438
+ },
3439
+ set: function () {
3440
+ throw Error(
3441
+ "Cannot assign to a temporary client reference from a server module."
3442
+ );
3443
+ }
3444
+ },
3445
+ REACT_LEGACY_ELEMENT_TYPE = Symbol.for("react.element"),
3446
+ REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"),
3447
+ REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"),
3448
+ REACT_CONTEXT_TYPE = Symbol.for("react.context"),
3449
+ REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"),
3450
+ REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"),
3451
+ REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"),
3452
+ REACT_MEMO_TYPE = Symbol.for("react.memo"),
3453
+ REACT_LAZY_TYPE = Symbol.for("react.lazy"),
3454
+ REACT_MEMO_CACHE_SENTINEL = Symbol.for("react.memo_cache_sentinel");
3455
+ Symbol.for("react.postpone");
3456
+ var MAYBE_ITERATOR_SYMBOL = Symbol.iterator,
3457
+ ASYNC_ITERATOR = Symbol.asyncIterator,
3458
+ SuspenseException = Error(
3459
+ "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`"
3460
+ ),
3461
+ suspendedThenable = null,
3462
+ currentRequest$1 = null,
3463
+ thenableIndexCounter = 0,
3464
+ thenableState = null,
3465
+ currentComponentDebugInfo = null,
3466
+ HooksDispatcher = {
3467
+ useMemo: function (nextCreate) {
3468
+ return nextCreate();
3469
+ },
3470
+ useCallback: function (callback) {
3471
+ return callback;
3472
+ },
3473
+ useDebugValue: function () {},
3474
+ useDeferredValue: unsupportedHook,
3475
+ useTransition: unsupportedHook,
3476
+ readContext: unsupportedContext,
3477
+ useContext: unsupportedContext,
3478
+ useReducer: unsupportedHook,
3479
+ useRef: unsupportedHook,
3480
+ useState: unsupportedHook,
3481
+ useInsertionEffect: unsupportedHook,
3482
+ useLayoutEffect: unsupportedHook,
3483
+ useImperativeHandle: unsupportedHook,
3484
+ useEffect: unsupportedHook,
3485
+ useId: function () {
3486
+ if (null === currentRequest$1)
3487
+ throw Error("useId can only be used while React is rendering");
3488
+ var id = currentRequest$1.identifierCount++;
3489
+ return (
3490
+ ":" +
3491
+ currentRequest$1.identifierPrefix +
3492
+ "S" +
3493
+ id.toString(32) +
3494
+ ":"
3495
+ );
3496
+ },
3497
+ useSyncExternalStore: unsupportedHook,
3498
+ useCacheRefresh: function () {
3499
+ return unsupportedRefresh;
3500
+ },
3501
+ useMemoCache: function (size) {
3502
+ for (var data = Array(size), i = 0; i < size; i++)
3503
+ data[i] = REACT_MEMO_CACHE_SENTINEL;
3504
+ return data;
3505
+ },
3506
+ use: function (usable) {
3507
+ if (
3508
+ (null !== usable && "object" === typeof usable) ||
3509
+ "function" === typeof usable
3510
+ ) {
3511
+ if ("function" === typeof usable.then) {
3512
+ var index = thenableIndexCounter;
3513
+ thenableIndexCounter += 1;
3514
+ null === thenableState && (thenableState = []);
3515
+ return trackUsedThenable(thenableState, usable, index);
3516
+ }
3517
+ usable.$$typeof === REACT_CONTEXT_TYPE && unsupportedContext();
3518
+ }
3519
+ if (isClientReference(usable)) {
3520
+ if (
3521
+ null != usable.value &&
3522
+ usable.value.$$typeof === REACT_CONTEXT_TYPE
3523
+ )
3524
+ throw Error(
3525
+ "Cannot read a Client Context from a Server Component."
3526
+ );
3527
+ throw Error("Cannot use() an already resolved Client Reference.");
3528
+ }
3529
+ throw Error(
3530
+ "An unsupported type was passed to use(): " + String(usable)
3531
+ );
3532
+ }
3533
+ },
3534
+ currentOwner = null,
3535
+ DefaultAsyncDispatcher = {
3536
+ getCacheForType: function (resourceType) {
3537
+ var cache = (cache = resolveRequest()) ? cache.cache : new Map();
3538
+ var entry = cache.get(resourceType);
3539
+ void 0 === entry &&
3540
+ ((entry = resourceType()), cache.set(resourceType, entry));
3541
+ return entry;
3542
+ }
3543
+ };
3544
+ DefaultAsyncDispatcher.getOwner = resolveOwner;
3545
+ var ReactSharedInternalsServer =
3546
+ React.__SERVER_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
3547
+ if (!ReactSharedInternalsServer)
3548
+ throw Error(
3549
+ 'The "react" package in this environment is not configured correctly. The "react-server" condition must be enabled in any environment that runs React Server Components.'
3550
+ );
3551
+ new ("function" === typeof WeakMap ? WeakMap : Map)();
3552
+ var callComponent = {
3553
+ "react-stack-bottom-frame": function (
3554
+ Component,
3555
+ props,
3556
+ componentDebugInfo
3557
+ ) {
3558
+ currentOwner = componentDebugInfo;
3559
+ try {
3560
+ return Component(props, void 0);
3561
+ } finally {
3562
+ currentOwner = null;
3563
+ }
3564
+ }
3565
+ },
3566
+ callComponentInDEV =
3567
+ callComponent["react-stack-bottom-frame"].bind(callComponent),
3568
+ callLazyInit = {
3569
+ "react-stack-bottom-frame": function (lazy) {
3570
+ var init = lazy._init;
3571
+ return init(lazy._payload);
3572
+ }
3573
+ },
3574
+ callLazyInitInDEV =
3575
+ callLazyInit["react-stack-bottom-frame"].bind(callLazyInit),
3576
+ callIterator = {
3577
+ "react-stack-bottom-frame": function (iterator, progress, error) {
3578
+ iterator.next().then(progress, error);
3579
+ }
3580
+ },
3581
+ callIteratorInDEV =
3582
+ callIterator["react-stack-bottom-frame"].bind(callIterator),
3583
+ isArrayImpl = Array.isArray,
3584
+ getPrototypeOf = Object.getPrototypeOf,
3585
+ jsxPropsParents = new WeakMap(),
3586
+ jsxChildrenParents = new WeakMap(),
3587
+ CLIENT_REFERENCE_TAG = Symbol.for("react.client.reference"),
3588
+ doNotLimit = new WeakSet();
3589
+ "object" === typeof console &&
3590
+ null !== console &&
3591
+ (patchConsole(console, "assert"),
3592
+ patchConsole(console, "debug"),
3593
+ patchConsole(console, "dir"),
3594
+ patchConsole(console, "dirxml"),
3595
+ patchConsole(console, "error"),
3596
+ patchConsole(console, "group"),
3597
+ patchConsole(console, "groupCollapsed"),
3598
+ patchConsole(console, "groupEnd"),
3599
+ patchConsole(console, "info"),
3600
+ patchConsole(console, "log"),
3601
+ patchConsole(console, "table"),
3602
+ patchConsole(console, "trace"),
3603
+ patchConsole(console, "warn"));
3604
+ var ObjectPrototype = Object.prototype,
3605
+ stringify = JSON.stringify,
3606
+ PENDING$1 = 0,
3607
+ COMPLETED = 1,
3608
+ ABORTED = 3,
3609
+ ERRORED$1 = 4,
3610
+ RENDERING = 5,
3611
+ OPENING = 10,
3612
+ ABORTING = 12,
3613
+ CLOSING = 13,
3614
+ CLOSED = 14,
3615
+ PRERENDER = 21,
3616
+ currentRequest = null,
3617
+ debugID = null,
3618
+ modelRoot = !1,
3619
+ emptyRoot = {},
3620
+ asyncModuleCache = new Map(),
3621
+ hasOwnProperty = Object.prototype.hasOwnProperty;
3622
+ Chunk.prototype = Object.create(Promise.prototype);
3623
+ Chunk.prototype.then = function (resolve, reject) {
3624
+ switch (this.status) {
3625
+ case "resolved_model":
3626
+ initializeModelChunk(this);
3627
+ }
3628
+ switch (this.status) {
3629
+ case "fulfilled":
3630
+ resolve(this.value);
3631
+ break;
3632
+ case "pending":
3633
+ case "blocked":
3634
+ case "cyclic":
3635
+ resolve &&
3636
+ (null === this.value && (this.value = []),
3637
+ this.value.push(resolve));
3638
+ reject &&
3639
+ (null === this.reason && (this.reason = []),
3640
+ this.reason.push(reject));
3641
+ break;
3642
+ default:
3643
+ reject(this.reason);
3644
+ }
3645
+ };
3646
+ var initializingChunk = null,
3647
+ initializingChunkBlockedModel = null;
3648
+ exports.createClientModuleProxy = function (moduleId) {
3649
+ moduleId = registerClientReferenceImpl({}, moduleId, !1);
3650
+ return new Proxy(moduleId, proxyHandlers$1);
3651
+ };
3652
+ exports.createTemporaryReferenceSet = function () {
3653
+ return new WeakMap();
3654
+ };
3655
+ exports.decodeAction = function (body, serverManifest) {
3656
+ var formData = new FormData(),
3657
+ action = null;
3658
+ body.forEach(function (value, key) {
3659
+ key.startsWith("$ACTION_")
3660
+ ? key.startsWith("$ACTION_REF_")
3661
+ ? ((value = "$ACTION_" + key.slice(12) + ":"),
3662
+ (value = decodeBoundActionMetaData(body, serverManifest, value)),
3663
+ (action = loadServerReference(
3664
+ serverManifest,
3665
+ value.id,
3666
+ value.bound
3667
+ )))
3668
+ : key.startsWith("$ACTION_ID_") &&
3669
+ ((value = key.slice(11)),
3670
+ (action = loadServerReference(serverManifest, value, null)))
3671
+ : formData.append(key, value);
3672
+ });
3673
+ return null === action
3674
+ ? null
3675
+ : action.then(function (fn) {
3676
+ return fn.bind(null, formData);
3677
+ });
3678
+ };
3679
+ exports.decodeFormState = function (actionResult, body, serverManifest) {
3680
+ var keyPath = body.get("$ACTION_KEY");
3681
+ if ("string" !== typeof keyPath) return Promise.resolve(null);
3682
+ var metaData = null;
3683
+ body.forEach(function (value, key) {
3684
+ key.startsWith("$ACTION_REF_") &&
3685
+ ((value = "$ACTION_" + key.slice(12) + ":"),
3686
+ (metaData = decodeBoundActionMetaData(body, serverManifest, value)));
3687
+ });
3688
+ if (null === metaData) return Promise.resolve(null);
3689
+ var referenceId = metaData.id;
3690
+ return Promise.resolve(metaData.bound).then(function (bound) {
3691
+ return null === bound
3692
+ ? null
3693
+ : [actionResult, keyPath, referenceId, bound.length - 1];
3694
+ });
3695
+ };
3696
+ exports.decodeReply = function (body, webpackMap, options) {
3697
+ if ("string" === typeof body) {
3698
+ var form = new FormData();
3699
+ form.append("0", body);
3700
+ body = form;
3701
+ }
3702
+ body = createResponse(
3703
+ webpackMap,
3704
+ "",
3705
+ options ? options.temporaryReferences : void 0,
3706
+ body
3707
+ );
3708
+ webpackMap = getChunk(body, 0);
3709
+ close(body);
3710
+ return webpackMap;
3711
+ };
3712
+ exports.decodeReplyFromBusboy = function (
3713
+ busboyStream,
3714
+ webpackMap,
3715
+ options
3716
+ ) {
3717
+ var response = createResponse(
3718
+ webpackMap,
3719
+ "",
3720
+ options ? options.temporaryReferences : void 0
3721
+ ),
3722
+ pendingFiles = 0,
3723
+ queuedFields = [];
3724
+ busboyStream.on("field", function (name, value) {
3725
+ 0 < pendingFiles
3726
+ ? queuedFields.push(name, value)
3727
+ : resolveField(response, name, value);
3728
+ });
3729
+ busboyStream.on("file", function (name, value, _ref) {
3730
+ var filename = _ref.filename,
3731
+ mimeType = _ref.mimeType;
3732
+ if ("base64" === _ref.encoding.toLowerCase())
3733
+ throw Error(
3734
+ "React doesn't accept base64 encoded file uploads because we don't expect form data passed from a browser to ever encode data that way. If that's the wrong assumption, we can easily fix it."
3735
+ );
3736
+ pendingFiles++;
3737
+ var JSCompiler_object_inline_chunks_141 = [];
3738
+ value.on("data", function (chunk) {
3739
+ JSCompiler_object_inline_chunks_141.push(chunk);
3740
+ });
3741
+ value.on("end", function () {
3742
+ var blob = new Blob(JSCompiler_object_inline_chunks_141, {
3743
+ type: mimeType
3744
+ });
3745
+ response._formData.append(name, blob, filename);
3746
+ pendingFiles--;
3747
+ if (0 === pendingFiles) {
3748
+ for (blob = 0; blob < queuedFields.length; blob += 2)
3749
+ resolveField(
3750
+ response,
3751
+ queuedFields[blob],
3752
+ queuedFields[blob + 1]
3753
+ );
3754
+ queuedFields.length = 0;
3755
+ }
3756
+ });
3757
+ });
3758
+ busboyStream.on("finish", function () {
3759
+ close(response);
3760
+ });
3761
+ busboyStream.on("error", function (err) {
3762
+ reportGlobalError(response, err);
3763
+ });
3764
+ return getChunk(response, 0);
3765
+ };
3766
+ exports.registerClientReference = function (
3767
+ proxyImplementation,
3768
+ id,
3769
+ exportName
3770
+ ) {
3771
+ return registerClientReferenceImpl(
3772
+ proxyImplementation,
3773
+ id + "#" + exportName,
3774
+ !1
3775
+ );
3776
+ };
3777
+ exports.registerServerReference = function (reference, id, exportName) {
3778
+ return Object.defineProperties(reference, {
3779
+ $$typeof: { value: SERVER_REFERENCE_TAG },
3780
+ $$id: {
3781
+ value: null === exportName ? id : id + "#" + exportName,
3782
+ configurable: !0
3783
+ },
3784
+ $$bound: { value: null, configurable: !0 },
3785
+ $$location: { value: Error("react-stack-top-frame"), configurable: !0 },
3786
+ bind: { value: bind, configurable: !0 }
3787
+ });
3788
+ };
3789
+ exports.renderToPipeableStream = function (model, webpackMap, options) {
3790
+ var request = new RequestInstance(
3791
+ 20,
3792
+ model,
3793
+ webpackMap,
3794
+ options ? options.onError : void 0,
3795
+ options ? options.identifierPrefix : void 0,
3796
+ options ? options.onPostpone : void 0,
3797
+ options ? options.temporaryReferences : void 0,
3798
+ options ? options.environmentName : void 0,
3799
+ options ? options.filterStackFrame : void 0,
3800
+ noop,
3801
+ noop
3802
+ ),
3803
+ hasStartedFlowing = !1;
3804
+ startWork(request);
3805
+ return {
3806
+ pipe: function (destination) {
3807
+ if (hasStartedFlowing)
3808
+ throw Error(
3809
+ "React currently only supports piping to one writable stream."
3810
+ );
3811
+ hasStartedFlowing = !0;
3812
+ startFlowing(request, destination);
3813
+ destination.on("drain", createDrainHandler(destination, request));
3814
+ destination.on(
3815
+ "error",
3816
+ createCancelHandler(
3817
+ request,
3818
+ "The destination stream errored while writing data."
3819
+ )
3820
+ );
3821
+ destination.on(
3822
+ "close",
3823
+ createCancelHandler(request, "The destination stream closed early.")
3824
+ );
3825
+ return destination;
3826
+ },
3827
+ abort: function (reason) {
3828
+ abort(request, reason);
3829
+ }
3830
+ };
3831
+ };
3832
+ })();