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