vite-plugin-react-server 1.2.5 → 1.3.0

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