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