react-server-dom-webpack 18.3.0-next-fa4314841-20230502 → 19.0.0-beta-4508873393-20240430

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/cjs/react-server-dom-webpack-client.browser.development.js +1893 -1200
  2. package/cjs/react-server-dom-webpack-client.browser.production.js +931 -0
  3. package/cjs/react-server-dom-webpack-client.edge.development.js +1888 -241
  4. package/cjs/react-server-dom-webpack-client.edge.production.js +1093 -0
  5. package/cjs/react-server-dom-webpack-client.node.development.js +1876 -259
  6. package/cjs/react-server-dom-webpack-client.node.production.js +1070 -0
  7. package/cjs/react-server-dom-webpack-client.node.unbundled.development.js +1833 -212
  8. package/cjs/react-server-dom-webpack-client.node.unbundled.production.js +1049 -0
  9. package/cjs/react-server-dom-webpack-node-register.js +59 -10
  10. package/cjs/react-server-dom-webpack-plugin.js +389 -11
  11. package/cjs/react-server-dom-webpack-server.browser.development.js +2187 -937
  12. package/cjs/react-server-dom-webpack-server.browser.production.js +1935 -0
  13. package/cjs/react-server-dom-webpack-server.edge.development.js +2183 -941
  14. package/cjs/react-server-dom-webpack-server.edge.production.js +1956 -0
  15. package/cjs/react-server-dom-webpack-server.node.development.js +2169 -929
  16. package/cjs/react-server-dom-webpack-server.node.production.js +2083 -0
  17. package/cjs/react-server-dom-webpack-server.node.unbundled.development.js +2116 -881
  18. package/cjs/react-server-dom-webpack-server.node.unbundled.production.js +2051 -0
  19. package/client.browser.js +1 -1
  20. package/client.edge.js +1 -1
  21. package/client.node.js +1 -1
  22. package/client.node.unbundled.js +1 -1
  23. package/esm/{react-server-dom-webpack-node-loader.production.min.js → react-server-dom-webpack-node-loader.production.js} +20 -13
  24. package/package.json +8 -15
  25. package/server.browser.js +1 -1
  26. package/server.edge.js +1 -1
  27. package/server.node.js +1 -1
  28. package/server.node.unbundled.js +1 -1
  29. package/cjs/react-server-dom-webpack-client.browser.production.min.js +0 -34
  30. package/cjs/react-server-dom-webpack-client.edge.production.min.js +0 -28
  31. package/cjs/react-server-dom-webpack-client.node.production.min.js +0 -28
  32. package/cjs/react-server-dom-webpack-client.node.unbundled.production.min.js +0 -26
  33. package/cjs/react-server-dom-webpack-server.browser.production.min.js +0 -62
  34. package/cjs/react-server-dom-webpack-server.edge.production.min.js +0 -62
  35. package/cjs/react-server-dom-webpack-server.node.production.min.js +0 -67
  36. package/cjs/react-server-dom-webpack-server.node.unbundled.production.min.js +0 -65
  37. package/umd/react-server-dom-webpack-client.browser.development.js +0 -1731
  38. package/umd/react-server-dom-webpack-client.browser.production.min.js +0 -29
  39. package/umd/react-server-dom-webpack-server.browser.development.js +0 -2904
  40. package/umd/react-server-dom-webpack-server.browser.production.min.js +0 -51
@@ -0,0 +1,1935 @@
1
+ /**
2
+ * @license React
3
+ * react-server-dom-webpack-server.browser.production.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
+ var ReactDOM = require("react-dom"),
13
+ React = require("react"),
14
+ currentView = null,
15
+ writtenBytes = 0;
16
+ function writeChunkAndReturn(destination, chunk) {
17
+ if (0 !== chunk.byteLength)
18
+ if (2048 < chunk.byteLength)
19
+ 0 < writtenBytes &&
20
+ (destination.enqueue(
21
+ new Uint8Array(currentView.buffer, 0, writtenBytes)
22
+ ),
23
+ (currentView = new Uint8Array(2048)),
24
+ (writtenBytes = 0)),
25
+ destination.enqueue(chunk);
26
+ else {
27
+ var allowableBytes = currentView.length - writtenBytes;
28
+ allowableBytes < chunk.byteLength &&
29
+ (0 === allowableBytes
30
+ ? destination.enqueue(currentView)
31
+ : (currentView.set(chunk.subarray(0, allowableBytes), writtenBytes),
32
+ destination.enqueue(currentView),
33
+ (chunk = chunk.subarray(allowableBytes))),
34
+ (currentView = new Uint8Array(2048)),
35
+ (writtenBytes = 0));
36
+ currentView.set(chunk, writtenBytes);
37
+ writtenBytes += chunk.byteLength;
38
+ }
39
+ return !0;
40
+ }
41
+ var textEncoder = new TextEncoder();
42
+ function closeWithError(destination, error) {
43
+ "function" === typeof destination.error
44
+ ? destination.error(error)
45
+ : destination.close();
46
+ }
47
+ var CLIENT_REFERENCE_TAG$1 = Symbol.for("react.client.reference"),
48
+ SERVER_REFERENCE_TAG = Symbol.for("react.server.reference");
49
+ function registerClientReferenceImpl(proxyImplementation, id, async) {
50
+ return Object.defineProperties(proxyImplementation, {
51
+ $$typeof: { value: CLIENT_REFERENCE_TAG$1 },
52
+ $$id: { value: id },
53
+ $$async: { value: async }
54
+ });
55
+ }
56
+ var FunctionBind = Function.prototype.bind,
57
+ ArraySlice = Array.prototype.slice;
58
+ function bind() {
59
+ var newFn = FunctionBind.apply(this, arguments);
60
+ if (this.$$typeof === SERVER_REFERENCE_TAG) {
61
+ var args = ArraySlice.call(arguments, 1);
62
+ return Object.defineProperties(newFn, {
63
+ $$typeof: { value: SERVER_REFERENCE_TAG },
64
+ $$id: { value: this.$$id },
65
+ $$bound: { value: this.$$bound ? this.$$bound.concat(args) : args },
66
+ bind: { value: bind }
67
+ });
68
+ }
69
+ return newFn;
70
+ }
71
+ var PROMISE_PROTOTYPE = Promise.prototype,
72
+ deepProxyHandlers = {
73
+ get: function (target, name) {
74
+ switch (name) {
75
+ case "$$typeof":
76
+ return target.$$typeof;
77
+ case "$$id":
78
+ return target.$$id;
79
+ case "$$async":
80
+ return target.$$async;
81
+ case "name":
82
+ return target.name;
83
+ case "displayName":
84
+ return;
85
+ case "defaultProps":
86
+ return;
87
+ case "toJSON":
88
+ return;
89
+ case Symbol.toPrimitive:
90
+ return Object.prototype[Symbol.toPrimitive];
91
+ case Symbol.toStringTag:
92
+ return Object.prototype[Symbol.toStringTag];
93
+ case "Provider":
94
+ throw Error(
95
+ "Cannot render a Client Context Provider on the Server. Instead, you can export a Client Component wrapper that itself renders a Client Context Provider."
96
+ );
97
+ }
98
+ throw Error(
99
+ "Cannot access " +
100
+ (String(target.name) + "." + String(name)) +
101
+ " on the server. You cannot dot into a client module from a server component. You can only pass the imported name through."
102
+ );
103
+ },
104
+ set: function () {
105
+ throw Error("Cannot assign to a client module from a server module.");
106
+ }
107
+ };
108
+ function getReference(target, name) {
109
+ switch (name) {
110
+ case "$$typeof":
111
+ return target.$$typeof;
112
+ case "$$id":
113
+ return target.$$id;
114
+ case "$$async":
115
+ return target.$$async;
116
+ case "name":
117
+ return target.name;
118
+ case "defaultProps":
119
+ return;
120
+ case "toJSON":
121
+ return;
122
+ case Symbol.toPrimitive:
123
+ return Object.prototype[Symbol.toPrimitive];
124
+ case Symbol.toStringTag:
125
+ return Object.prototype[Symbol.toStringTag];
126
+ case "__esModule":
127
+ var moduleId = target.$$id;
128
+ target.default = registerClientReferenceImpl(
129
+ function () {
130
+ throw Error(
131
+ "Attempted to call the default export of " +
132
+ moduleId +
133
+ " from the server but it's on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component."
134
+ );
135
+ },
136
+ target.$$id + "#",
137
+ target.$$async
138
+ );
139
+ return !0;
140
+ case "then":
141
+ if (target.then) return target.then;
142
+ if (target.$$async) return;
143
+ var clientReference = registerClientReferenceImpl({}, target.$$id, !0),
144
+ proxy = new Proxy(clientReference, proxyHandlers$1);
145
+ target.status = "fulfilled";
146
+ target.value = proxy;
147
+ return (target.then = registerClientReferenceImpl(
148
+ function (resolve) {
149
+ return Promise.resolve(resolve(proxy));
150
+ },
151
+ target.$$id + "#then",
152
+ !1
153
+ ));
154
+ }
155
+ if ("symbol" === typeof name)
156
+ throw Error(
157
+ "Cannot read Symbol exports. Only named exports are supported on a client module imported on the server."
158
+ );
159
+ clientReference = target[name];
160
+ clientReference ||
161
+ ((clientReference = registerClientReferenceImpl(
162
+ function () {
163
+ throw Error(
164
+ "Attempted to call " +
165
+ String(name) +
166
+ "() from the server but " +
167
+ String(name) +
168
+ " 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."
169
+ );
170
+ },
171
+ target.$$id + "#" + name,
172
+ target.$$async
173
+ )),
174
+ Object.defineProperty(clientReference, "name", { value: name }),
175
+ (clientReference = target[name] =
176
+ new Proxy(clientReference, deepProxyHandlers)));
177
+ return clientReference;
178
+ }
179
+ var proxyHandlers$1 = {
180
+ get: function (target, name) {
181
+ return getReference(target, name);
182
+ },
183
+ getOwnPropertyDescriptor: function (target, name) {
184
+ var descriptor = Object.getOwnPropertyDescriptor(target, name);
185
+ descriptor ||
186
+ ((descriptor = {
187
+ value: getReference(target, name),
188
+ writable: !1,
189
+ configurable: !1,
190
+ enumerable: !1
191
+ }),
192
+ Object.defineProperty(target, name, descriptor));
193
+ return descriptor;
194
+ },
195
+ getPrototypeOf: function () {
196
+ return PROMISE_PROTOTYPE;
197
+ },
198
+ set: function () {
199
+ throw Error("Cannot assign to a client module from a server module.");
200
+ }
201
+ },
202
+ ReactDOMSharedInternals =
203
+ ReactDOM.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,
204
+ previousDispatcher = ReactDOMSharedInternals.d;
205
+ ReactDOMSharedInternals.d = {
206
+ f: previousDispatcher.f,
207
+ r: previousDispatcher.r,
208
+ D: prefetchDNS,
209
+ C: preconnect,
210
+ L: preload,
211
+ m: preloadModule$1,
212
+ X: preinitScript,
213
+ S: preinitStyle,
214
+ M: preinitModuleScript
215
+ };
216
+ function prefetchDNS(href) {
217
+ if ("string" === typeof href && href) {
218
+ var request = currentRequest ? currentRequest : null;
219
+ if (request) {
220
+ var hints = request.hints,
221
+ key = "D|" + href;
222
+ hints.has(key) || (hints.add(key), emitHint(request, "D", href));
223
+ } else previousDispatcher.D(href);
224
+ }
225
+ }
226
+ function preconnect(href, crossOrigin) {
227
+ if ("string" === typeof href) {
228
+ var request = currentRequest ? currentRequest : null;
229
+ if (request) {
230
+ var hints = request.hints,
231
+ key = "C|" + (null == crossOrigin ? "null" : crossOrigin) + "|" + href;
232
+ hints.has(key) ||
233
+ (hints.add(key),
234
+ "string" === typeof crossOrigin
235
+ ? emitHint(request, "C", [href, crossOrigin])
236
+ : emitHint(request, "C", href));
237
+ } else previousDispatcher.C(href, crossOrigin);
238
+ }
239
+ }
240
+ function preload(href, as, options) {
241
+ if ("string" === typeof href) {
242
+ var request = currentRequest ? currentRequest : null;
243
+ if (request) {
244
+ var hints = request.hints,
245
+ key = "L";
246
+ if ("image" === as && options) {
247
+ var imageSrcSet = options.imageSrcSet,
248
+ imageSizes = options.imageSizes,
249
+ uniquePart = "";
250
+ "string" === typeof imageSrcSet && "" !== imageSrcSet
251
+ ? ((uniquePart += "[" + imageSrcSet + "]"),
252
+ "string" === typeof imageSizes &&
253
+ (uniquePart += "[" + imageSizes + "]"))
254
+ : (uniquePart += "[][]" + href);
255
+ key += "[image]" + uniquePart;
256
+ } else key += "[" + as + "]" + href;
257
+ hints.has(key) ||
258
+ (hints.add(key),
259
+ (options = trimOptions(options))
260
+ ? emitHint(request, "L", [href, as, options])
261
+ : emitHint(request, "L", [href, as]));
262
+ } else previousDispatcher.L(href, as, options);
263
+ }
264
+ }
265
+ function preloadModule$1(href, options) {
266
+ if ("string" === typeof href) {
267
+ var request = currentRequest ? currentRequest : null;
268
+ if (request) {
269
+ var hints = request.hints,
270
+ key = "m|" + href;
271
+ if (hints.has(key)) return;
272
+ hints.add(key);
273
+ return (options = trimOptions(options))
274
+ ? emitHint(request, "m", [href, options])
275
+ : emitHint(request, "m", href);
276
+ }
277
+ previousDispatcher.m(href, options);
278
+ }
279
+ }
280
+ function preinitStyle(href, precedence, options) {
281
+ if ("string" === typeof href) {
282
+ var request = currentRequest ? currentRequest : null;
283
+ if (request) {
284
+ var hints = request.hints,
285
+ key = "S|" + href;
286
+ if (hints.has(key)) return;
287
+ hints.add(key);
288
+ return (options = trimOptions(options))
289
+ ? emitHint(request, "S", [
290
+ href,
291
+ "string" === typeof precedence ? precedence : 0,
292
+ options
293
+ ])
294
+ : "string" === typeof precedence
295
+ ? emitHint(request, "S", [href, precedence])
296
+ : emitHint(request, "S", href);
297
+ }
298
+ previousDispatcher.S(href, precedence, options);
299
+ }
300
+ }
301
+ function preinitScript(src, options) {
302
+ if ("string" === typeof src) {
303
+ var request = currentRequest ? currentRequest : null;
304
+ if (request) {
305
+ var hints = request.hints,
306
+ key = "X|" + src;
307
+ if (hints.has(key)) return;
308
+ hints.add(key);
309
+ return (options = trimOptions(options))
310
+ ? emitHint(request, "X", [src, options])
311
+ : emitHint(request, "X", src);
312
+ }
313
+ previousDispatcher.X(src, options);
314
+ }
315
+ }
316
+ function preinitModuleScript(src, options) {
317
+ if ("string" === typeof src) {
318
+ var request = currentRequest ? currentRequest : null;
319
+ if (request) {
320
+ var hints = request.hints,
321
+ key = "M|" + src;
322
+ if (hints.has(key)) return;
323
+ hints.add(key);
324
+ return (options = trimOptions(options))
325
+ ? emitHint(request, "M", [src, options])
326
+ : emitHint(request, "M", src);
327
+ }
328
+ previousDispatcher.M(src, options);
329
+ }
330
+ }
331
+ function trimOptions(options) {
332
+ if (null == options) return null;
333
+ var hasProperties = !1,
334
+ trimmed = {},
335
+ key;
336
+ for (key in options)
337
+ null != options[key] &&
338
+ ((hasProperties = !0), (trimmed[key] = options[key]));
339
+ return hasProperties ? trimmed : null;
340
+ }
341
+ var TEMPORARY_REFERENCE_TAG = Symbol.for("react.temporary.reference"),
342
+ proxyHandlers = {
343
+ get: function (target, name) {
344
+ switch (name) {
345
+ case "$$typeof":
346
+ return target.$$typeof;
347
+ case "$$id":
348
+ return target.$$id;
349
+ case "$$async":
350
+ return target.$$async;
351
+ case "name":
352
+ return;
353
+ case "displayName":
354
+ return;
355
+ case "defaultProps":
356
+ return;
357
+ case "toJSON":
358
+ return;
359
+ case Symbol.toPrimitive:
360
+ return Object.prototype[Symbol.toPrimitive];
361
+ case Symbol.toStringTag:
362
+ return Object.prototype[Symbol.toStringTag];
363
+ case "Provider":
364
+ throw Error(
365
+ "Cannot render a Client Context Provider on the Server. Instead, you can export a Client Component wrapper that itself renders a Client Context Provider."
366
+ );
367
+ }
368
+ throw Error(
369
+ "Cannot access " +
370
+ String(name) +
371
+ " 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."
372
+ );
373
+ },
374
+ set: function () {
375
+ throw Error(
376
+ "Cannot assign to a temporary client reference from a server module."
377
+ );
378
+ }
379
+ };
380
+ function createTemporaryReference(id) {
381
+ id = Object.defineProperties(
382
+ function () {
383
+ throw Error(
384
+ "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."
385
+ );
386
+ },
387
+ { $$typeof: { value: TEMPORARY_REFERENCE_TAG }, $$id: { value: id } }
388
+ );
389
+ return new Proxy(id, proxyHandlers);
390
+ }
391
+ var REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"),
392
+ REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"),
393
+ REACT_CONTEXT_TYPE = Symbol.for("react.context"),
394
+ REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"),
395
+ REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"),
396
+ REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"),
397
+ REACT_MEMO_TYPE = Symbol.for("react.memo"),
398
+ REACT_LAZY_TYPE = Symbol.for("react.lazy"),
399
+ REACT_MEMO_CACHE_SENTINEL = Symbol.for("react.memo_cache_sentinel");
400
+ Symbol.for("react.postpone");
401
+ var MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
402
+ function getIteratorFn(maybeIterable) {
403
+ if (null === maybeIterable || "object" !== typeof maybeIterable) return null;
404
+ maybeIterable =
405
+ (MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL]) ||
406
+ maybeIterable["@@iterator"];
407
+ return "function" === typeof maybeIterable ? maybeIterable : null;
408
+ }
409
+ var SuspenseException = Error(
410
+ "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`"
411
+ );
412
+ function noop() {}
413
+ function trackUsedThenable(thenableState, thenable, index) {
414
+ index = thenableState[index];
415
+ void 0 === index
416
+ ? thenableState.push(thenable)
417
+ : index !== thenable && (thenable.then(noop, noop), (thenable = index));
418
+ switch (thenable.status) {
419
+ case "fulfilled":
420
+ return thenable.value;
421
+ case "rejected":
422
+ throw thenable.reason;
423
+ default:
424
+ "string" === typeof thenable.status
425
+ ? thenable.then(noop, noop)
426
+ : ((thenableState = thenable),
427
+ (thenableState.status = "pending"),
428
+ thenableState.then(
429
+ function (fulfilledValue) {
430
+ if ("pending" === thenable.status) {
431
+ var fulfilledThenable = thenable;
432
+ fulfilledThenable.status = "fulfilled";
433
+ fulfilledThenable.value = fulfilledValue;
434
+ }
435
+ },
436
+ function (error) {
437
+ if ("pending" === thenable.status) {
438
+ var rejectedThenable = thenable;
439
+ rejectedThenable.status = "rejected";
440
+ rejectedThenable.reason = error;
441
+ }
442
+ }
443
+ ));
444
+ switch (thenable.status) {
445
+ case "fulfilled":
446
+ return thenable.value;
447
+ case "rejected":
448
+ throw thenable.reason;
449
+ }
450
+ suspendedThenable = thenable;
451
+ throw SuspenseException;
452
+ }
453
+ }
454
+ var suspendedThenable = null;
455
+ function getSuspendedThenable() {
456
+ if (null === suspendedThenable)
457
+ throw Error(
458
+ "Expected a suspended thenable. This is a bug in React. Please file an issue."
459
+ );
460
+ var thenable = suspendedThenable;
461
+ suspendedThenable = null;
462
+ return thenable;
463
+ }
464
+ var currentRequest$1 = null,
465
+ thenableIndexCounter = 0,
466
+ thenableState = null;
467
+ function getThenableStateAfterSuspending() {
468
+ var state = thenableState || [];
469
+ thenableState = null;
470
+ return state;
471
+ }
472
+ var HooksDispatcher = {
473
+ useMemo: function (nextCreate) {
474
+ return nextCreate();
475
+ },
476
+ useCallback: function (callback) {
477
+ return callback;
478
+ },
479
+ useDebugValue: function () {},
480
+ useDeferredValue: unsupportedHook,
481
+ useTransition: unsupportedHook,
482
+ readContext: unsupportedContext,
483
+ useContext: unsupportedContext,
484
+ useReducer: unsupportedHook,
485
+ useRef: unsupportedHook,
486
+ useState: unsupportedHook,
487
+ useInsertionEffect: unsupportedHook,
488
+ useLayoutEffect: unsupportedHook,
489
+ useImperativeHandle: unsupportedHook,
490
+ useEffect: unsupportedHook,
491
+ useId: useId,
492
+ useSyncExternalStore: unsupportedHook,
493
+ useCacheRefresh: function () {
494
+ return unsupportedRefresh;
495
+ },
496
+ useMemoCache: function (size) {
497
+ for (var data = Array(size), i = 0; i < size; i++)
498
+ data[i] = REACT_MEMO_CACHE_SENTINEL;
499
+ return data;
500
+ },
501
+ use: use
502
+ };
503
+ function unsupportedHook() {
504
+ throw Error("This Hook is not supported in Server Components.");
505
+ }
506
+ function unsupportedRefresh() {
507
+ throw Error("Refreshing the cache is not supported in Server Components.");
508
+ }
509
+ function unsupportedContext() {
510
+ throw Error("Cannot read a Client Context from a Server Component.");
511
+ }
512
+ function useId() {
513
+ if (null === currentRequest$1)
514
+ throw Error("useId can only be used while React is rendering");
515
+ var id = currentRequest$1.identifierCount++;
516
+ return ":" + currentRequest$1.identifierPrefix + "S" + id.toString(32) + ":";
517
+ }
518
+ function use(usable) {
519
+ if (
520
+ (null !== usable && "object" === typeof usable) ||
521
+ "function" === typeof usable
522
+ ) {
523
+ if ("function" === typeof usable.then) {
524
+ var index = thenableIndexCounter;
525
+ thenableIndexCounter += 1;
526
+ null === thenableState && (thenableState = []);
527
+ return trackUsedThenable(thenableState, usable, index);
528
+ }
529
+ usable.$$typeof === REACT_CONTEXT_TYPE && unsupportedContext();
530
+ }
531
+ if (usable.$$typeof === CLIENT_REFERENCE_TAG$1) {
532
+ if (null != usable.value && usable.value.$$typeof === REACT_CONTEXT_TYPE)
533
+ throw Error("Cannot read a Client Context from a Server Component.");
534
+ throw Error("Cannot use() an already resolved Client Reference.");
535
+ }
536
+ throw Error("An unsupported type was passed to use(): " + String(usable));
537
+ }
538
+ var DefaultAsyncDispatcher = {
539
+ getCacheForType: function (resourceType) {
540
+ var JSCompiler_inline_result = (JSCompiler_inline_result = currentRequest
541
+ ? currentRequest
542
+ : null)
543
+ ? JSCompiler_inline_result.cache
544
+ : new Map();
545
+ var entry = JSCompiler_inline_result.get(resourceType);
546
+ void 0 === entry &&
547
+ ((entry = resourceType()),
548
+ JSCompiler_inline_result.set(resourceType, entry));
549
+ return entry;
550
+ }
551
+ },
552
+ isArrayImpl = Array.isArray,
553
+ getPrototypeOf = Object.getPrototypeOf;
554
+ function objectName(object) {
555
+ return Object.prototype.toString
556
+ .call(object)
557
+ .replace(/^\[object (.*)\]$/, function (m, p0) {
558
+ return p0;
559
+ });
560
+ }
561
+ function describeValueForErrorMessage(value) {
562
+ switch (typeof value) {
563
+ case "string":
564
+ return JSON.stringify(
565
+ 10 >= value.length ? value : value.slice(0, 10) + "..."
566
+ );
567
+ case "object":
568
+ if (isArrayImpl(value)) return "[...]";
569
+ if (null !== value && value.$$typeof === CLIENT_REFERENCE_TAG)
570
+ return "client";
571
+ value = objectName(value);
572
+ return "Object" === value ? "{...}" : value;
573
+ case "function":
574
+ return value.$$typeof === CLIENT_REFERENCE_TAG
575
+ ? "client"
576
+ : (value = value.displayName || value.name)
577
+ ? "function " + value
578
+ : "function";
579
+ default:
580
+ return String(value);
581
+ }
582
+ }
583
+ function describeElementType(type) {
584
+ if ("string" === typeof type) return type;
585
+ switch (type) {
586
+ case REACT_SUSPENSE_TYPE:
587
+ return "Suspense";
588
+ case REACT_SUSPENSE_LIST_TYPE:
589
+ return "SuspenseList";
590
+ }
591
+ if ("object" === typeof type)
592
+ switch (type.$$typeof) {
593
+ case REACT_FORWARD_REF_TYPE:
594
+ return describeElementType(type.render);
595
+ case REACT_MEMO_TYPE:
596
+ return describeElementType(type.type);
597
+ case REACT_LAZY_TYPE:
598
+ var payload = type._payload;
599
+ type = type._init;
600
+ try {
601
+ return describeElementType(type(payload));
602
+ } catch (x) {}
603
+ }
604
+ return "";
605
+ }
606
+ var CLIENT_REFERENCE_TAG = Symbol.for("react.client.reference");
607
+ function describeObjectForErrorMessage(objectOrArray, expandedName) {
608
+ var objKind = objectName(objectOrArray);
609
+ if ("Object" !== objKind && "Array" !== objKind) return objKind;
610
+ objKind = -1;
611
+ var length = 0;
612
+ if (isArrayImpl(objectOrArray)) {
613
+ var str = "[";
614
+ for (var i = 0; i < objectOrArray.length; i++) {
615
+ 0 < i && (str += ", ");
616
+ var value = objectOrArray[i];
617
+ value =
618
+ "object" === typeof value && null !== value
619
+ ? describeObjectForErrorMessage(value)
620
+ : describeValueForErrorMessage(value);
621
+ "" + i === expandedName
622
+ ? ((objKind = str.length), (length = value.length), (str += value))
623
+ : (str =
624
+ 10 > value.length && 40 > str.length + value.length
625
+ ? str + value
626
+ : str + "...");
627
+ }
628
+ str += "]";
629
+ } else if (objectOrArray.$$typeof === REACT_ELEMENT_TYPE)
630
+ str = "<" + describeElementType(objectOrArray.type) + "/>";
631
+ else {
632
+ if (objectOrArray.$$typeof === CLIENT_REFERENCE_TAG) return "client";
633
+ str = "{";
634
+ i = Object.keys(objectOrArray);
635
+ for (value = 0; value < i.length; value++) {
636
+ 0 < value && (str += ", ");
637
+ var name = i[value],
638
+ encodedKey = JSON.stringify(name);
639
+ str += ('"' + name + '"' === encodedKey ? name : encodedKey) + ": ";
640
+ encodedKey = objectOrArray[name];
641
+ encodedKey =
642
+ "object" === typeof encodedKey && null !== encodedKey
643
+ ? describeObjectForErrorMessage(encodedKey)
644
+ : describeValueForErrorMessage(encodedKey);
645
+ name === expandedName
646
+ ? ((objKind = str.length),
647
+ (length = encodedKey.length),
648
+ (str += encodedKey))
649
+ : (str =
650
+ 10 > encodedKey.length && 40 > str.length + encodedKey.length
651
+ ? str + encodedKey
652
+ : str + "...");
653
+ }
654
+ str += "}";
655
+ }
656
+ return void 0 === expandedName
657
+ ? str
658
+ : -1 < objKind && 0 < length
659
+ ? ((objectOrArray = " ".repeat(objKind) + "^".repeat(length)),
660
+ "\n " + str + "\n " + objectOrArray)
661
+ : "\n " + str;
662
+ }
663
+ var ReactSharedInternalsServer =
664
+ React.__SERVER_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
665
+ if (!ReactSharedInternalsServer)
666
+ throw Error(
667
+ '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.'
668
+ );
669
+ var ObjectPrototype = Object.prototype,
670
+ stringify = JSON.stringify;
671
+ function defaultErrorHandler(error) {
672
+ console.error(error);
673
+ }
674
+ function defaultPostponeHandler() {}
675
+ function createRequest(
676
+ model,
677
+ bundlerConfig,
678
+ onError,
679
+ identifierPrefix,
680
+ onPostpone
681
+ ) {
682
+ if (
683
+ null !== ReactSharedInternalsServer.A &&
684
+ ReactSharedInternalsServer.A !== DefaultAsyncDispatcher
685
+ )
686
+ throw Error("Currently React only supports one RSC renderer at a time.");
687
+ ReactSharedInternalsServer.A = DefaultAsyncDispatcher;
688
+ var abortSet = new Set(),
689
+ pingedTasks = [],
690
+ hints = new Set();
691
+ bundlerConfig = {
692
+ status: 0,
693
+ flushScheduled: !1,
694
+ fatalError: null,
695
+ destination: null,
696
+ bundlerConfig: bundlerConfig,
697
+ cache: new Map(),
698
+ nextChunkId: 0,
699
+ pendingChunks: 0,
700
+ hints: hints,
701
+ abortListeners: new Set(),
702
+ abortableTasks: abortSet,
703
+ pingedTasks: pingedTasks,
704
+ completedImportChunks: [],
705
+ completedHintChunks: [],
706
+ completedRegularChunks: [],
707
+ completedErrorChunks: [],
708
+ writtenSymbols: new Map(),
709
+ writtenClientReferences: new Map(),
710
+ writtenServerReferences: new Map(),
711
+ writtenObjects: new WeakMap(),
712
+ identifierPrefix: identifierPrefix || "",
713
+ identifierCount: 1,
714
+ taintCleanupQueue: [],
715
+ onError: void 0 === onError ? defaultErrorHandler : onError,
716
+ onPostpone: void 0 === onPostpone ? defaultPostponeHandler : onPostpone
717
+ };
718
+ model = createTask(bundlerConfig, model, null, !1, abortSet);
719
+ pingedTasks.push(model);
720
+ return bundlerConfig;
721
+ }
722
+ var currentRequest = null;
723
+ function serializeThenable(request, task, thenable) {
724
+ var newTask = createTask(
725
+ request,
726
+ null,
727
+ task.keyPath,
728
+ task.implicitSlot,
729
+ request.abortableTasks
730
+ );
731
+ switch (thenable.status) {
732
+ case "fulfilled":
733
+ return (
734
+ (newTask.model = thenable.value), pingTask(request, newTask), newTask.id
735
+ );
736
+ case "rejected":
737
+ return (
738
+ (task = logRecoverableError(request, thenable.reason)),
739
+ emitErrorChunk(request, newTask.id, task),
740
+ newTask.id
741
+ );
742
+ default:
743
+ "string" !== typeof thenable.status &&
744
+ ((thenable.status = "pending"),
745
+ thenable.then(
746
+ function (fulfilledValue) {
747
+ "pending" === thenable.status &&
748
+ ((thenable.status = "fulfilled"),
749
+ (thenable.value = fulfilledValue));
750
+ },
751
+ function (error) {
752
+ "pending" === thenable.status &&
753
+ ((thenable.status = "rejected"), (thenable.reason = error));
754
+ }
755
+ ));
756
+ }
757
+ thenable.then(
758
+ function (value) {
759
+ newTask.model = value;
760
+ pingTask(request, newTask);
761
+ },
762
+ function (reason) {
763
+ newTask.status = 4;
764
+ reason = logRecoverableError(request, reason);
765
+ emitErrorChunk(request, newTask.id, reason);
766
+ request.abortableTasks.delete(newTask);
767
+ enqueueFlush(request);
768
+ }
769
+ );
770
+ return newTask.id;
771
+ }
772
+ function emitHint(request, code, model) {
773
+ model = stringify(model);
774
+ var id = request.nextChunkId++;
775
+ code = "H" + code;
776
+ code = id.toString(16) + ":" + code;
777
+ model = textEncoder.encode(code + model + "\n");
778
+ request.completedHintChunks.push(model);
779
+ enqueueFlush(request);
780
+ }
781
+ function readThenable(thenable) {
782
+ if ("fulfilled" === thenable.status) return thenable.value;
783
+ if ("rejected" === thenable.status) throw thenable.reason;
784
+ throw thenable;
785
+ }
786
+ function createLazyWrapperAroundWakeable(wakeable) {
787
+ switch (wakeable.status) {
788
+ case "fulfilled":
789
+ case "rejected":
790
+ break;
791
+ default:
792
+ "string" !== typeof wakeable.status &&
793
+ ((wakeable.status = "pending"),
794
+ wakeable.then(
795
+ function (fulfilledValue) {
796
+ "pending" === wakeable.status &&
797
+ ((wakeable.status = "fulfilled"),
798
+ (wakeable.value = fulfilledValue));
799
+ },
800
+ function (error) {
801
+ "pending" === wakeable.status &&
802
+ ((wakeable.status = "rejected"), (wakeable.reason = error));
803
+ }
804
+ ));
805
+ }
806
+ return { $$typeof: REACT_LAZY_TYPE, _payload: wakeable, _init: readThenable };
807
+ }
808
+ function renderFunctionComponent(request, task, key, Component, props) {
809
+ var prevThenableState = task.thenableState;
810
+ task.thenableState = null;
811
+ thenableIndexCounter = 0;
812
+ thenableState = prevThenableState;
813
+ Component = Component(props, void 0);
814
+ if ("object" === typeof Component && null !== Component) {
815
+ if ("function" === typeof Component.then) {
816
+ props = Component;
817
+ if ("fulfilled" === props.status) return props.value;
818
+ Component = createLazyWrapperAroundWakeable(Component);
819
+ }
820
+ var iteratorFn = getIteratorFn(Component);
821
+ if (iteratorFn) {
822
+ var iterableChild = Component;
823
+ Component = {};
824
+ Component =
825
+ ((Component[Symbol.iterator] = function () {
826
+ return iteratorFn.call(iterableChild);
827
+ }),
828
+ Component);
829
+ }
830
+ }
831
+ props = task.keyPath;
832
+ prevThenableState = task.implicitSlot;
833
+ null !== key
834
+ ? (task.keyPath = null === props ? key : props + "," + key)
835
+ : null === props && (task.implicitSlot = !0);
836
+ request = renderModelDestructive(request, task, emptyRoot, "", Component);
837
+ task.keyPath = props;
838
+ task.implicitSlot = prevThenableState;
839
+ return request;
840
+ }
841
+ function renderFragment(request, task, children) {
842
+ return null !== task.keyPath
843
+ ? ((request = [
844
+ REACT_ELEMENT_TYPE,
845
+ REACT_FRAGMENT_TYPE,
846
+ task.keyPath,
847
+ { children: children }
848
+ ]),
849
+ task.implicitSlot ? [request] : request)
850
+ : children;
851
+ }
852
+ function renderClientElement(task, type, key, props) {
853
+ var keyPath = task.keyPath;
854
+ null === key
855
+ ? (key = keyPath)
856
+ : null !== keyPath && (key = keyPath + "," + key);
857
+ type = [REACT_ELEMENT_TYPE, type, key, props];
858
+ return task.implicitSlot && null !== key ? [type] : type;
859
+ }
860
+ function renderElement(request, task, type, key, ref, props) {
861
+ if (null !== ref && void 0 !== ref)
862
+ throw Error(
863
+ "Refs cannot be used in Server Components, nor passed to Client Components."
864
+ );
865
+ if ("function" === typeof type)
866
+ return type.$$typeof === CLIENT_REFERENCE_TAG$1 ||
867
+ type.$$typeof === TEMPORARY_REFERENCE_TAG
868
+ ? renderClientElement(task, type, key, props)
869
+ : renderFunctionComponent(request, task, key, type, props);
870
+ if ("string" === typeof type)
871
+ return renderClientElement(task, type, key, props);
872
+ if ("symbol" === typeof type)
873
+ return type === REACT_FRAGMENT_TYPE && null === key
874
+ ? ((key = task.implicitSlot),
875
+ null === task.keyPath && (task.implicitSlot = !0),
876
+ (request = renderModelDestructive(
877
+ request,
878
+ task,
879
+ emptyRoot,
880
+ "",
881
+ props.children
882
+ )),
883
+ (task.implicitSlot = key),
884
+ request)
885
+ : renderClientElement(task, type, key, props);
886
+ if (null != type && "object" === typeof type) {
887
+ if (type.$$typeof === CLIENT_REFERENCE_TAG$1)
888
+ return renderClientElement(task, type, key, props);
889
+ switch (type.$$typeof) {
890
+ case REACT_LAZY_TYPE:
891
+ var init = type._init;
892
+ type = init(type._payload);
893
+ return renderElement(request, task, type, key, ref, props);
894
+ case REACT_FORWARD_REF_TYPE:
895
+ return renderFunctionComponent(request, task, key, type.render, props);
896
+ case REACT_MEMO_TYPE:
897
+ return renderElement(request, task, type.type, key, ref, props);
898
+ }
899
+ }
900
+ throw Error(
901
+ "Unsupported Server Component type: " + describeValueForErrorMessage(type)
902
+ );
903
+ }
904
+ function pingTask(request, task) {
905
+ var pingedTasks = request.pingedTasks;
906
+ pingedTasks.push(task);
907
+ 1 === pingedTasks.length &&
908
+ ((request.flushScheduled = null !== request.destination),
909
+ performWork(request));
910
+ }
911
+ function createTask(request, model, keyPath, implicitSlot, abortSet) {
912
+ request.pendingChunks++;
913
+ var id = request.nextChunkId++;
914
+ "object" !== typeof model ||
915
+ null === model ||
916
+ null !== keyPath ||
917
+ implicitSlot ||
918
+ request.writtenObjects.set(model, id);
919
+ var task = {
920
+ id: id,
921
+ status: 0,
922
+ model: model,
923
+ keyPath: keyPath,
924
+ implicitSlot: implicitSlot,
925
+ ping: function () {
926
+ return pingTask(request, task);
927
+ },
928
+ toJSON: function (parentPropertyName, value) {
929
+ var prevKeyPath = task.keyPath,
930
+ prevImplicitSlot = task.implicitSlot;
931
+ try {
932
+ var JSCompiler_inline_result = renderModelDestructive(
933
+ request,
934
+ task,
935
+ this,
936
+ parentPropertyName,
937
+ value
938
+ );
939
+ } catch (thrownValue) {
940
+ if (
941
+ ((parentPropertyName =
942
+ thrownValue === SuspenseException
943
+ ? getSuspendedThenable()
944
+ : thrownValue),
945
+ (value = task.model),
946
+ (value =
947
+ "object" === typeof value &&
948
+ null !== value &&
949
+ (value.$$typeof === REACT_ELEMENT_TYPE ||
950
+ value.$$typeof === REACT_LAZY_TYPE)),
951
+ "object" === typeof parentPropertyName &&
952
+ null !== parentPropertyName &&
953
+ "function" === typeof parentPropertyName.then)
954
+ ) {
955
+ JSCompiler_inline_result = createTask(
956
+ request,
957
+ task.model,
958
+ task.keyPath,
959
+ task.implicitSlot,
960
+ request.abortableTasks
961
+ );
962
+ var ping = JSCompiler_inline_result.ping;
963
+ parentPropertyName.then(ping, ping);
964
+ JSCompiler_inline_result.thenableState =
965
+ getThenableStateAfterSuspending();
966
+ task.keyPath = prevKeyPath;
967
+ task.implicitSlot = prevImplicitSlot;
968
+ JSCompiler_inline_result = value
969
+ ? "$L" + JSCompiler_inline_result.id.toString(16)
970
+ : serializeByValueID(JSCompiler_inline_result.id);
971
+ } else if (
972
+ ((task.keyPath = prevKeyPath),
973
+ (task.implicitSlot = prevImplicitSlot),
974
+ value)
975
+ )
976
+ request.pendingChunks++,
977
+ (prevKeyPath = request.nextChunkId++),
978
+ (prevImplicitSlot = logRecoverableError(
979
+ request,
980
+ parentPropertyName
981
+ )),
982
+ emitErrorChunk(request, prevKeyPath, prevImplicitSlot),
983
+ (JSCompiler_inline_result = "$L" + prevKeyPath.toString(16));
984
+ else throw parentPropertyName;
985
+ }
986
+ return JSCompiler_inline_result;
987
+ },
988
+ thenableState: null
989
+ };
990
+ abortSet.add(task);
991
+ return task;
992
+ }
993
+ function serializeByValueID(id) {
994
+ return "$" + id.toString(16);
995
+ }
996
+ function encodeReferenceChunk(request, id, reference) {
997
+ request = stringify(reference);
998
+ id = id.toString(16) + ":" + request + "\n";
999
+ return textEncoder.encode(id);
1000
+ }
1001
+ function serializeClientReference(
1002
+ request,
1003
+ parent,
1004
+ parentPropertyName,
1005
+ clientReference
1006
+ ) {
1007
+ var clientReferenceKey = clientReference.$$async
1008
+ ? clientReference.$$id + "#async"
1009
+ : clientReference.$$id,
1010
+ writtenClientReferences = request.writtenClientReferences,
1011
+ existingId = writtenClientReferences.get(clientReferenceKey);
1012
+ if (void 0 !== existingId)
1013
+ return parent[0] === REACT_ELEMENT_TYPE && "1" === parentPropertyName
1014
+ ? "$L" + existingId.toString(16)
1015
+ : serializeByValueID(existingId);
1016
+ try {
1017
+ var config = request.bundlerConfig,
1018
+ modulePath = clientReference.$$id;
1019
+ existingId = "";
1020
+ var resolvedModuleData = config[modulePath];
1021
+ if (resolvedModuleData) existingId = resolvedModuleData.name;
1022
+ else {
1023
+ var idx = modulePath.lastIndexOf("#");
1024
+ -1 !== idx &&
1025
+ ((existingId = modulePath.slice(idx + 1)),
1026
+ (resolvedModuleData = config[modulePath.slice(0, idx)]));
1027
+ if (!resolvedModuleData)
1028
+ throw Error(
1029
+ 'Could not find the module "' +
1030
+ modulePath +
1031
+ '" in the React Client Manifest. This is probably a bug in the React Server Components bundler.'
1032
+ );
1033
+ }
1034
+ var JSCompiler_inline_result =
1035
+ !0 === clientReference.$$async
1036
+ ? [resolvedModuleData.id, resolvedModuleData.chunks, existingId, 1]
1037
+ : [resolvedModuleData.id, resolvedModuleData.chunks, existingId];
1038
+ request.pendingChunks++;
1039
+ var importId = request.nextChunkId++,
1040
+ json = stringify(JSCompiler_inline_result),
1041
+ row = importId.toString(16) + ":I" + json + "\n",
1042
+ processedChunk = textEncoder.encode(row);
1043
+ request.completedImportChunks.push(processedChunk);
1044
+ writtenClientReferences.set(clientReferenceKey, importId);
1045
+ return parent[0] === REACT_ELEMENT_TYPE && "1" === parentPropertyName
1046
+ ? "$L" + importId.toString(16)
1047
+ : serializeByValueID(importId);
1048
+ } catch (x) {
1049
+ return (
1050
+ request.pendingChunks++,
1051
+ (parent = request.nextChunkId++),
1052
+ (parentPropertyName = logRecoverableError(request, x)),
1053
+ emitErrorChunk(request, parent, parentPropertyName),
1054
+ serializeByValueID(parent)
1055
+ );
1056
+ }
1057
+ }
1058
+ function outlineModel(request, value) {
1059
+ value = createTask(request, value, null, !1, request.abortableTasks);
1060
+ retryTask(request, value);
1061
+ return value.id;
1062
+ }
1063
+ var modelRoot = !1;
1064
+ function renderModelDestructive(
1065
+ request,
1066
+ task,
1067
+ parent,
1068
+ parentPropertyName,
1069
+ value
1070
+ ) {
1071
+ task.model = value;
1072
+ if (value === REACT_ELEMENT_TYPE) return "$";
1073
+ if (null === value) return null;
1074
+ if ("object" === typeof value) {
1075
+ switch (value.$$typeof) {
1076
+ case REACT_ELEMENT_TYPE:
1077
+ parent = request.writtenObjects;
1078
+ parentPropertyName = parent.get(value);
1079
+ if (void 0 !== parentPropertyName) {
1080
+ if (null === task.keyPath && !task.implicitSlot)
1081
+ if (modelRoot === value) modelRoot = null;
1082
+ else
1083
+ return -1 === parentPropertyName
1084
+ ? ((request = outlineModel(request, value)),
1085
+ serializeByValueID(request))
1086
+ : serializeByValueID(parentPropertyName);
1087
+ } else parent.set(value, -1), parent.set(value.props, -2);
1088
+ parent = value.props;
1089
+ parentPropertyName = parent.ref;
1090
+ return renderElement(
1091
+ request,
1092
+ task,
1093
+ value.type,
1094
+ value.key,
1095
+ void 0 !== parentPropertyName ? parentPropertyName : null,
1096
+ parent
1097
+ );
1098
+ case REACT_LAZY_TYPE:
1099
+ return (
1100
+ (task.thenableState = null),
1101
+ (parent = value._init),
1102
+ (value = parent(value._payload)),
1103
+ renderModelDestructive(request, task, emptyRoot, "", value)
1104
+ );
1105
+ }
1106
+ if (value.$$typeof === CLIENT_REFERENCE_TAG$1)
1107
+ return serializeClientReference(
1108
+ request,
1109
+ parent,
1110
+ parentPropertyName,
1111
+ value
1112
+ );
1113
+ parent = request.writtenObjects;
1114
+ parentPropertyName = parent.get(value);
1115
+ if ("function" === typeof value.then) {
1116
+ if (void 0 !== parentPropertyName) {
1117
+ if (null !== task.keyPath || task.implicitSlot)
1118
+ return "$@" + serializeThenable(request, task, value).toString(16);
1119
+ if (modelRoot === value) modelRoot = null;
1120
+ else return "$@" + parentPropertyName.toString(16);
1121
+ }
1122
+ request = serializeThenable(request, task, value);
1123
+ parent.set(value, request);
1124
+ return "$@" + request.toString(16);
1125
+ }
1126
+ if (void 0 !== parentPropertyName)
1127
+ if (modelRoot === value) modelRoot = null;
1128
+ else {
1129
+ if (-1 === parentPropertyName)
1130
+ return (
1131
+ (request = outlineModel(request, value)),
1132
+ serializeByValueID(request)
1133
+ );
1134
+ if (-2 !== parentPropertyName)
1135
+ return serializeByValueID(parentPropertyName);
1136
+ }
1137
+ else parent.set(value, -1);
1138
+ if (isArrayImpl(value)) return renderFragment(request, task, value);
1139
+ if (value instanceof Map) {
1140
+ value = Array.from(value);
1141
+ for (task = 0; task < value.length; task++)
1142
+ (parent = value[task][0]),
1143
+ "object" === typeof parent &&
1144
+ null !== parent &&
1145
+ ((parentPropertyName = request.writtenObjects),
1146
+ void 0 === parentPropertyName.get(parent) &&
1147
+ parentPropertyName.set(parent, -1));
1148
+ return "$Q" + outlineModel(request, value).toString(16);
1149
+ }
1150
+ if (value instanceof Set) {
1151
+ value = Array.from(value);
1152
+ for (task = 0; task < value.length; task++)
1153
+ (parent = value[task]),
1154
+ "object" === typeof parent &&
1155
+ null !== parent &&
1156
+ ((parentPropertyName = request.writtenObjects),
1157
+ void 0 === parentPropertyName.get(parent) &&
1158
+ parentPropertyName.set(parent, -1));
1159
+ return "$W" + outlineModel(request, value).toString(16);
1160
+ }
1161
+ if ("function" === typeof FormData && value instanceof FormData)
1162
+ return (
1163
+ (value = Array.from(value.entries())),
1164
+ "$K" + outlineModel(request, value).toString(16)
1165
+ );
1166
+ if ((parent = getIteratorFn(value)))
1167
+ return (
1168
+ (parent = parent.call(value)),
1169
+ parent === value
1170
+ ? "$i" + outlineModel(request, Array.from(parent)).toString(16)
1171
+ : renderFragment(request, task, Array.from(parent))
1172
+ );
1173
+ request = getPrototypeOf(value);
1174
+ if (
1175
+ request !== ObjectPrototype &&
1176
+ (null === request || null !== getPrototypeOf(request))
1177
+ )
1178
+ throw Error(
1179
+ "Only plain objects, and a few built-ins, can be passed to Client Components from Server Components. Classes or null prototypes are not supported."
1180
+ );
1181
+ return value;
1182
+ }
1183
+ if ("string" === typeof value) {
1184
+ if (
1185
+ "Z" === value[value.length - 1] &&
1186
+ parent[parentPropertyName] instanceof Date
1187
+ )
1188
+ return "$D" + value;
1189
+ if (1024 <= value.length)
1190
+ return (
1191
+ request.pendingChunks++,
1192
+ (task = request.nextChunkId++),
1193
+ emitTextChunk(request, task, value),
1194
+ serializeByValueID(task)
1195
+ );
1196
+ request = "$" === value[0] ? "$" + value : value;
1197
+ return request;
1198
+ }
1199
+ if ("boolean" === typeof value) return value;
1200
+ if ("number" === typeof value)
1201
+ return Number.isFinite(value)
1202
+ ? 0 === value && -Infinity === 1 / value
1203
+ ? "$-0"
1204
+ : value
1205
+ : Infinity === value
1206
+ ? "$Infinity"
1207
+ : -Infinity === value
1208
+ ? "$-Infinity"
1209
+ : "$NaN";
1210
+ if ("undefined" === typeof value) return "$undefined";
1211
+ if ("function" === typeof value) {
1212
+ if (value.$$typeof === CLIENT_REFERENCE_TAG$1)
1213
+ return serializeClientReference(
1214
+ request,
1215
+ parent,
1216
+ parentPropertyName,
1217
+ value
1218
+ );
1219
+ if (value.$$typeof === SERVER_REFERENCE_TAG)
1220
+ return (
1221
+ (task = request.writtenServerReferences),
1222
+ (parent = task.get(value)),
1223
+ void 0 !== parent
1224
+ ? (request = "$F" + parent.toString(16))
1225
+ : ((parent = value.$$bound),
1226
+ (parent = {
1227
+ id: value.$$id,
1228
+ bound: parent ? Promise.resolve(parent) : null
1229
+ }),
1230
+ (request = outlineModel(request, parent)),
1231
+ task.set(value, request),
1232
+ (request = "$F" + request.toString(16))),
1233
+ request
1234
+ );
1235
+ if (value.$$typeof === TEMPORARY_REFERENCE_TAG) return "$T" + value.$$id;
1236
+ if (/^on[A-Z]/.test(parentPropertyName))
1237
+ throw Error(
1238
+ "Event handlers cannot be passed to Client Component props." +
1239
+ describeObjectForErrorMessage(parent, parentPropertyName) +
1240
+ "\nIf you need interactivity, consider converting part of this to a Client Component."
1241
+ );
1242
+ throw Error(
1243
+ '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.' +
1244
+ describeObjectForErrorMessage(parent, parentPropertyName)
1245
+ );
1246
+ }
1247
+ if ("symbol" === typeof value) {
1248
+ task = request.writtenSymbols;
1249
+ var existingId$10 = task.get(value);
1250
+ if (void 0 !== existingId$10) return serializeByValueID(existingId$10);
1251
+ existingId$10 = value.description;
1252
+ if (Symbol.for(existingId$10) !== value)
1253
+ throw Error(
1254
+ "Only global symbols received from Symbol.for(...) can be passed to Client Components. The symbol Symbol.for(" +
1255
+ (value.description + ") cannot be found among global symbols.") +
1256
+ describeObjectForErrorMessage(parent, parentPropertyName)
1257
+ );
1258
+ request.pendingChunks++;
1259
+ parent = request.nextChunkId++;
1260
+ parentPropertyName = encodeReferenceChunk(
1261
+ request,
1262
+ parent,
1263
+ "$S" + existingId$10
1264
+ );
1265
+ request.completedImportChunks.push(parentPropertyName);
1266
+ task.set(value, parent);
1267
+ return serializeByValueID(parent);
1268
+ }
1269
+ if ("bigint" === typeof value) return "$n" + value.toString(10);
1270
+ throw Error(
1271
+ "Type " +
1272
+ typeof value +
1273
+ " is not supported in Client Component props." +
1274
+ describeObjectForErrorMessage(parent, parentPropertyName)
1275
+ );
1276
+ }
1277
+ function logRecoverableError(request, error) {
1278
+ var prevRequest = currentRequest;
1279
+ currentRequest = null;
1280
+ try {
1281
+ var onError = request.onError;
1282
+ var errorDigest = onError(error);
1283
+ } finally {
1284
+ currentRequest = prevRequest;
1285
+ }
1286
+ if (null != errorDigest && "string" !== typeof errorDigest)
1287
+ throw Error(
1288
+ '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 "' +
1289
+ typeof errorDigest +
1290
+ '" instead'
1291
+ );
1292
+ return errorDigest || "";
1293
+ }
1294
+ function fatalError(request, error) {
1295
+ null !== request.destination
1296
+ ? ((request.status = 2), closeWithError(request.destination, error))
1297
+ : ((request.status = 1), (request.fatalError = error));
1298
+ }
1299
+ function emitErrorChunk(request, id, digest) {
1300
+ digest = { digest: digest };
1301
+ id = id.toString(16) + ":E" + stringify(digest) + "\n";
1302
+ id = textEncoder.encode(id);
1303
+ request.completedErrorChunks.push(id);
1304
+ }
1305
+ function emitModelChunk(request, id, json) {
1306
+ id = id.toString(16) + ":" + json + "\n";
1307
+ id = textEncoder.encode(id);
1308
+ request.completedRegularChunks.push(id);
1309
+ }
1310
+ function emitTextChunk(request, id, text) {
1311
+ request.pendingChunks++;
1312
+ text = textEncoder.encode(text);
1313
+ var binaryLength = text.byteLength;
1314
+ id = id.toString(16) + ":T" + binaryLength.toString(16) + ",";
1315
+ id = textEncoder.encode(id);
1316
+ request.completedRegularChunks.push(id, text);
1317
+ }
1318
+ var emptyRoot = {};
1319
+ function retryTask(request, task) {
1320
+ if (0 === task.status)
1321
+ try {
1322
+ modelRoot = task.model;
1323
+ var resolvedModel = renderModelDestructive(
1324
+ request,
1325
+ task,
1326
+ emptyRoot,
1327
+ "",
1328
+ task.model
1329
+ );
1330
+ modelRoot = resolvedModel;
1331
+ task.keyPath = null;
1332
+ task.implicitSlot = !1;
1333
+ if ("object" === typeof resolvedModel && null !== resolvedModel) {
1334
+ var id = task.id;
1335
+ if ("string" === typeof resolvedModel)
1336
+ emitTextChunk(request, id, resolvedModel);
1337
+ else {
1338
+ var json = stringify(resolvedModel, task.toJSON);
1339
+ emitModelChunk(request, task.id, json);
1340
+ }
1341
+ } else {
1342
+ var json$jscomp$0 = stringify(resolvedModel);
1343
+ emitModelChunk(request, task.id, json$jscomp$0);
1344
+ }
1345
+ request.abortableTasks.delete(task);
1346
+ task.status = 1;
1347
+ } catch (thrownValue) {
1348
+ var x =
1349
+ thrownValue === SuspenseException
1350
+ ? getSuspendedThenable()
1351
+ : thrownValue;
1352
+ if ("object" === typeof x && null !== x && "function" === typeof x.then) {
1353
+ var ping = task.ping;
1354
+ x.then(ping, ping);
1355
+ task.thenableState = getThenableStateAfterSuspending();
1356
+ } else {
1357
+ request.abortableTasks.delete(task);
1358
+ task.status = 4;
1359
+ var digest = logRecoverableError(request, x);
1360
+ emitErrorChunk(request, task.id, digest);
1361
+ }
1362
+ } finally {
1363
+ }
1364
+ }
1365
+ function performWork(request) {
1366
+ var prevDispatcher = ReactSharedInternalsServer.H;
1367
+ ReactSharedInternalsServer.H = HooksDispatcher;
1368
+ var prevRequest = currentRequest;
1369
+ currentRequest$1 = currentRequest = request;
1370
+ try {
1371
+ var pingedTasks = request.pingedTasks;
1372
+ request.pingedTasks = [];
1373
+ for (var i = 0; i < pingedTasks.length; i++)
1374
+ retryTask(request, pingedTasks[i]);
1375
+ null !== request.destination &&
1376
+ flushCompletedChunks(request, request.destination);
1377
+ } catch (error) {
1378
+ logRecoverableError(request, error), fatalError(request, error);
1379
+ } finally {
1380
+ (ReactSharedInternalsServer.H = prevDispatcher),
1381
+ (currentRequest$1 = null),
1382
+ (currentRequest = prevRequest);
1383
+ }
1384
+ }
1385
+ function flushCompletedChunks(request, destination) {
1386
+ currentView = new Uint8Array(2048);
1387
+ writtenBytes = 0;
1388
+ try {
1389
+ for (
1390
+ var importsChunks = request.completedImportChunks, i = 0;
1391
+ i < importsChunks.length;
1392
+ i++
1393
+ )
1394
+ request.pendingChunks--,
1395
+ writeChunkAndReturn(destination, importsChunks[i]);
1396
+ importsChunks.splice(0, i);
1397
+ var hintChunks = request.completedHintChunks;
1398
+ for (i = 0; i < hintChunks.length; i++)
1399
+ writeChunkAndReturn(destination, hintChunks[i]);
1400
+ hintChunks.splice(0, i);
1401
+ var regularChunks = request.completedRegularChunks;
1402
+ for (i = 0; i < regularChunks.length; i++)
1403
+ request.pendingChunks--,
1404
+ writeChunkAndReturn(destination, regularChunks[i]);
1405
+ regularChunks.splice(0, i);
1406
+ var errorChunks = request.completedErrorChunks;
1407
+ for (i = 0; i < errorChunks.length; i++)
1408
+ request.pendingChunks--, writeChunkAndReturn(destination, errorChunks[i]);
1409
+ errorChunks.splice(0, i);
1410
+ } finally {
1411
+ (request.flushScheduled = !1),
1412
+ currentView &&
1413
+ 0 < writtenBytes &&
1414
+ (destination.enqueue(
1415
+ new Uint8Array(currentView.buffer, 0, writtenBytes)
1416
+ ),
1417
+ (currentView = null),
1418
+ (writtenBytes = 0));
1419
+ }
1420
+ 0 === request.pendingChunks &&
1421
+ (destination.close(), (request.destination = null));
1422
+ }
1423
+ function enqueueFlush(request) {
1424
+ if (
1425
+ !1 === request.flushScheduled &&
1426
+ 0 === request.pingedTasks.length &&
1427
+ null !== request.destination
1428
+ ) {
1429
+ var destination = request.destination;
1430
+ request.flushScheduled = !0;
1431
+ flushCompletedChunks(request, destination);
1432
+ }
1433
+ }
1434
+ function abort(request, reason) {
1435
+ try {
1436
+ var abortableTasks = request.abortableTasks;
1437
+ if (0 < abortableTasks.size) {
1438
+ request.pendingChunks++;
1439
+ var errorId = request.nextChunkId++,
1440
+ error =
1441
+ void 0 === reason
1442
+ ? Error("The render was aborted by the server without a reason.")
1443
+ : reason,
1444
+ digest = logRecoverableError(request, error);
1445
+ emitErrorChunk(request, errorId, digest, error);
1446
+ abortableTasks.forEach(function (task) {
1447
+ task.status = 3;
1448
+ var ref = serializeByValueID(errorId);
1449
+ task = encodeReferenceChunk(request, task.id, ref);
1450
+ request.completedErrorChunks.push(task);
1451
+ });
1452
+ abortableTasks.clear();
1453
+ }
1454
+ var abortListeners = request.abortListeners;
1455
+ if (0 < abortListeners.size) {
1456
+ var error$17 =
1457
+ void 0 === reason
1458
+ ? Error("The render was aborted by the server without a reason.")
1459
+ : reason;
1460
+ abortListeners.forEach(function (callback) {
1461
+ return callback(error$17);
1462
+ });
1463
+ abortListeners.clear();
1464
+ }
1465
+ null !== request.destination &&
1466
+ flushCompletedChunks(request, request.destination);
1467
+ } catch (error$18) {
1468
+ logRecoverableError(request, error$18), fatalError(request, error$18);
1469
+ }
1470
+ }
1471
+ function resolveServerReference(bundlerConfig, id) {
1472
+ var name = "",
1473
+ resolvedModuleData = bundlerConfig[id];
1474
+ if (resolvedModuleData) name = resolvedModuleData.name;
1475
+ else {
1476
+ var idx = id.lastIndexOf("#");
1477
+ -1 !== idx &&
1478
+ ((name = id.slice(idx + 1)),
1479
+ (resolvedModuleData = bundlerConfig[id.slice(0, idx)]));
1480
+ if (!resolvedModuleData)
1481
+ throw Error(
1482
+ 'Could not find the module "' +
1483
+ id +
1484
+ '" in the React Server Manifest. This is probably a bug in the React Server Components bundler.'
1485
+ );
1486
+ }
1487
+ return [resolvedModuleData.id, resolvedModuleData.chunks, name];
1488
+ }
1489
+ var chunkCache = new Map();
1490
+ function requireAsyncModule(id) {
1491
+ var promise = __webpack_require__(id);
1492
+ if ("function" !== typeof promise.then || "fulfilled" === promise.status)
1493
+ return null;
1494
+ promise.then(
1495
+ function (value) {
1496
+ promise.status = "fulfilled";
1497
+ promise.value = value;
1498
+ },
1499
+ function (reason) {
1500
+ promise.status = "rejected";
1501
+ promise.reason = reason;
1502
+ }
1503
+ );
1504
+ return promise;
1505
+ }
1506
+ function ignoreReject() {}
1507
+ function preloadModule(metadata) {
1508
+ for (var chunks = metadata[1], promises = [], i = 0; i < chunks.length; ) {
1509
+ var chunkId = chunks[i++],
1510
+ chunkFilename = chunks[i++],
1511
+ entry = chunkCache.get(chunkId);
1512
+ void 0 === entry
1513
+ ? (chunkMap.set(chunkId, chunkFilename),
1514
+ (chunkFilename = __webpack_chunk_load__(chunkId)),
1515
+ promises.push(chunkFilename),
1516
+ (entry = chunkCache.set.bind(chunkCache, chunkId, null)),
1517
+ chunkFilename.then(entry, ignoreReject),
1518
+ chunkCache.set(chunkId, chunkFilename))
1519
+ : null !== entry && promises.push(entry);
1520
+ }
1521
+ return 4 === metadata.length
1522
+ ? 0 === promises.length
1523
+ ? requireAsyncModule(metadata[0])
1524
+ : Promise.all(promises).then(function () {
1525
+ return requireAsyncModule(metadata[0]);
1526
+ })
1527
+ : 0 < promises.length
1528
+ ? Promise.all(promises)
1529
+ : null;
1530
+ }
1531
+ function requireModule(metadata) {
1532
+ var moduleExports = __webpack_require__(metadata[0]);
1533
+ if (4 === metadata.length && "function" === typeof moduleExports.then)
1534
+ if ("fulfilled" === moduleExports.status)
1535
+ moduleExports = moduleExports.value;
1536
+ else throw moduleExports.reason;
1537
+ return "*" === metadata[2]
1538
+ ? moduleExports
1539
+ : "" === metadata[2]
1540
+ ? moduleExports.__esModule
1541
+ ? moduleExports.default
1542
+ : moduleExports
1543
+ : moduleExports[metadata[2]];
1544
+ }
1545
+ var chunkMap = new Map(),
1546
+ webpackGetChunkFilename = __webpack_require__.u;
1547
+ __webpack_require__.u = function (chunkId) {
1548
+ var flightChunk = chunkMap.get(chunkId);
1549
+ return void 0 !== flightChunk
1550
+ ? flightChunk
1551
+ : webpackGetChunkFilename(chunkId);
1552
+ };
1553
+ function Chunk(status, value, reason, response) {
1554
+ this.status = status;
1555
+ this.value = value;
1556
+ this.reason = reason;
1557
+ this._response = response;
1558
+ }
1559
+ Chunk.prototype = Object.create(Promise.prototype);
1560
+ Chunk.prototype.then = function (resolve, reject) {
1561
+ switch (this.status) {
1562
+ case "resolved_model":
1563
+ initializeModelChunk(this);
1564
+ }
1565
+ switch (this.status) {
1566
+ case "fulfilled":
1567
+ resolve(this.value);
1568
+ break;
1569
+ case "pending":
1570
+ case "blocked":
1571
+ resolve &&
1572
+ (null === this.value && (this.value = []), this.value.push(resolve));
1573
+ reject &&
1574
+ (null === this.reason && (this.reason = []), this.reason.push(reject));
1575
+ break;
1576
+ default:
1577
+ reject(this.reason);
1578
+ }
1579
+ };
1580
+ function wakeChunk(listeners, value) {
1581
+ for (var i = 0; i < listeners.length; i++) (0, listeners[i])(value);
1582
+ }
1583
+ function triggerErrorOnChunk(chunk, error) {
1584
+ if ("pending" === chunk.status || "blocked" === chunk.status) {
1585
+ var listeners = chunk.reason;
1586
+ chunk.status = "rejected";
1587
+ chunk.reason = error;
1588
+ null !== listeners && wakeChunk(listeners, error);
1589
+ }
1590
+ }
1591
+ function loadServerReference$1(
1592
+ response,
1593
+ id,
1594
+ bound,
1595
+ parentChunk,
1596
+ parentObject,
1597
+ key
1598
+ ) {
1599
+ var serverReference = resolveServerReference(response._bundlerConfig, id);
1600
+ response = preloadModule(serverReference);
1601
+ if (bound)
1602
+ bound = Promise.all([bound, response]).then(function (_ref) {
1603
+ _ref = _ref[0];
1604
+ var fn = requireModule(serverReference);
1605
+ return fn.bind.apply(fn, [null].concat(_ref));
1606
+ });
1607
+ else if (response)
1608
+ bound = Promise.resolve(response).then(function () {
1609
+ return requireModule(serverReference);
1610
+ });
1611
+ else return requireModule(serverReference);
1612
+ bound.then(
1613
+ createModelResolver(parentChunk, parentObject, key),
1614
+ createModelReject(parentChunk)
1615
+ );
1616
+ return null;
1617
+ }
1618
+ var initializingChunk = null,
1619
+ initializingChunkBlockedModel = null;
1620
+ function initializeModelChunk(chunk) {
1621
+ var prevChunk = initializingChunk,
1622
+ prevBlocked = initializingChunkBlockedModel;
1623
+ initializingChunk = chunk;
1624
+ initializingChunkBlockedModel = null;
1625
+ try {
1626
+ var value = JSON.parse(chunk.value, chunk._response._fromJSON);
1627
+ null !== initializingChunkBlockedModel &&
1628
+ 0 < initializingChunkBlockedModel.deps
1629
+ ? ((initializingChunkBlockedModel.value = value),
1630
+ (chunk.status = "blocked"),
1631
+ (chunk.value = null),
1632
+ (chunk.reason = null))
1633
+ : ((chunk.status = "fulfilled"), (chunk.value = value));
1634
+ } catch (error) {
1635
+ (chunk.status = "rejected"), (chunk.reason = error);
1636
+ } finally {
1637
+ (initializingChunk = prevChunk),
1638
+ (initializingChunkBlockedModel = prevBlocked);
1639
+ }
1640
+ }
1641
+ function reportGlobalError(response, error) {
1642
+ response._chunks.forEach(function (chunk) {
1643
+ "pending" === chunk.status && triggerErrorOnChunk(chunk, error);
1644
+ });
1645
+ }
1646
+ function getChunk(response, id) {
1647
+ var chunks = response._chunks,
1648
+ chunk = chunks.get(id);
1649
+ chunk ||
1650
+ ((chunk = response._formData.get(response._prefix + id)),
1651
+ (chunk =
1652
+ null != chunk
1653
+ ? new Chunk("resolved_model", chunk, null, response)
1654
+ : new Chunk("pending", null, null, response)),
1655
+ chunks.set(id, chunk));
1656
+ return chunk;
1657
+ }
1658
+ function createModelResolver(chunk, parentObject, key) {
1659
+ if (initializingChunkBlockedModel) {
1660
+ var blocked = initializingChunkBlockedModel;
1661
+ blocked.deps++;
1662
+ } else blocked = initializingChunkBlockedModel = { deps: 1, value: null };
1663
+ return function (value) {
1664
+ parentObject[key] = value;
1665
+ blocked.deps--;
1666
+ 0 === blocked.deps &&
1667
+ "blocked" === chunk.status &&
1668
+ ((value = chunk.value),
1669
+ (chunk.status = "fulfilled"),
1670
+ (chunk.value = blocked.value),
1671
+ null !== value && wakeChunk(value, blocked.value));
1672
+ };
1673
+ }
1674
+ function createModelReject(chunk) {
1675
+ return function (error) {
1676
+ return triggerErrorOnChunk(chunk, error);
1677
+ };
1678
+ }
1679
+ function getOutlinedModel(response, id) {
1680
+ response = getChunk(response, id);
1681
+ "resolved_model" === response.status && initializeModelChunk(response);
1682
+ if ("fulfilled" !== response.status) throw response.reason;
1683
+ return response.value;
1684
+ }
1685
+ function parseModelString(response, obj, key, value) {
1686
+ if ("$" === value[0]) {
1687
+ switch (value[1]) {
1688
+ case "$":
1689
+ return value.slice(1);
1690
+ case "@":
1691
+ return (obj = parseInt(value.slice(2), 16)), getChunk(response, obj);
1692
+ case "F":
1693
+ return (
1694
+ (value = parseInt(value.slice(2), 16)),
1695
+ (value = getOutlinedModel(response, value)),
1696
+ loadServerReference$1(
1697
+ response,
1698
+ value.id,
1699
+ value.bound,
1700
+ initializingChunk,
1701
+ obj,
1702
+ key
1703
+ )
1704
+ );
1705
+ case "T":
1706
+ return createTemporaryReference(value.slice(2));
1707
+ case "Q":
1708
+ return (
1709
+ (obj = parseInt(value.slice(2), 16)),
1710
+ (response = getOutlinedModel(response, obj)),
1711
+ new Map(response)
1712
+ );
1713
+ case "W":
1714
+ return (
1715
+ (obj = parseInt(value.slice(2), 16)),
1716
+ (response = getOutlinedModel(response, obj)),
1717
+ new Set(response)
1718
+ );
1719
+ case "K":
1720
+ obj = value.slice(2);
1721
+ var formPrefix = response._prefix + obj + "_",
1722
+ data$23 = new FormData();
1723
+ response._formData.forEach(function (entry, entryKey) {
1724
+ entryKey.startsWith(formPrefix) &&
1725
+ data$23.append(entryKey.slice(formPrefix.length), entry);
1726
+ });
1727
+ return data$23;
1728
+ case "i":
1729
+ return (
1730
+ (obj = parseInt(value.slice(2), 16)),
1731
+ getOutlinedModel(response, obj)[Symbol.iterator]()
1732
+ );
1733
+ case "I":
1734
+ return Infinity;
1735
+ case "-":
1736
+ return "$-0" === value ? -0 : -Infinity;
1737
+ case "N":
1738
+ return NaN;
1739
+ case "u":
1740
+ return;
1741
+ case "D":
1742
+ return new Date(Date.parse(value.slice(2)));
1743
+ case "n":
1744
+ return BigInt(value.slice(2));
1745
+ }
1746
+ value = parseInt(value.slice(1), 16);
1747
+ response = getChunk(response, value);
1748
+ switch (response.status) {
1749
+ case "resolved_model":
1750
+ initializeModelChunk(response);
1751
+ }
1752
+ switch (response.status) {
1753
+ case "fulfilled":
1754
+ return response.value;
1755
+ case "pending":
1756
+ case "blocked":
1757
+ return (
1758
+ (value = initializingChunk),
1759
+ response.then(
1760
+ createModelResolver(value, obj, key),
1761
+ createModelReject(value)
1762
+ ),
1763
+ null
1764
+ );
1765
+ default:
1766
+ throw response.reason;
1767
+ }
1768
+ }
1769
+ return value;
1770
+ }
1771
+ function createResponse(bundlerConfig, formFieldPrefix) {
1772
+ var backingFormData =
1773
+ 2 < arguments.length && void 0 !== arguments[2]
1774
+ ? arguments[2]
1775
+ : new FormData(),
1776
+ chunks = new Map(),
1777
+ response = {
1778
+ _bundlerConfig: bundlerConfig,
1779
+ _prefix: formFieldPrefix,
1780
+ _formData: backingFormData,
1781
+ _chunks: chunks,
1782
+ _fromJSON: function (key, value) {
1783
+ return "string" === typeof value
1784
+ ? parseModelString(response, this, key, value)
1785
+ : value;
1786
+ }
1787
+ };
1788
+ return response;
1789
+ }
1790
+ function close(response) {
1791
+ reportGlobalError(response, Error("Connection closed."));
1792
+ }
1793
+ function loadServerReference(bundlerConfig, id, bound) {
1794
+ var serverReference = resolveServerReference(bundlerConfig, id);
1795
+ bundlerConfig = preloadModule(serverReference);
1796
+ return bound
1797
+ ? Promise.all([bound, bundlerConfig]).then(function (_ref) {
1798
+ _ref = _ref[0];
1799
+ var fn = requireModule(serverReference);
1800
+ return fn.bind.apply(fn, [null].concat(_ref));
1801
+ })
1802
+ : bundlerConfig
1803
+ ? Promise.resolve(bundlerConfig).then(function () {
1804
+ return requireModule(serverReference);
1805
+ })
1806
+ : Promise.resolve(requireModule(serverReference));
1807
+ }
1808
+ function decodeBoundActionMetaData(body, serverManifest, formFieldPrefix) {
1809
+ body = createResponse(serverManifest, formFieldPrefix, body);
1810
+ close(body);
1811
+ body = getChunk(body, 0);
1812
+ body.then(function () {});
1813
+ if ("fulfilled" !== body.status) throw body.reason;
1814
+ return body.value;
1815
+ }
1816
+ exports.createClientModuleProxy = function (moduleId) {
1817
+ moduleId = registerClientReferenceImpl({}, moduleId, !1);
1818
+ return new Proxy(moduleId, proxyHandlers$1);
1819
+ };
1820
+ exports.decodeAction = function (body, serverManifest) {
1821
+ var formData = new FormData(),
1822
+ action = null;
1823
+ body.forEach(function (value, key) {
1824
+ key.startsWith("$ACTION_")
1825
+ ? key.startsWith("$ACTION_REF_")
1826
+ ? ((value = "$ACTION_" + key.slice(12) + ":"),
1827
+ (value = decodeBoundActionMetaData(body, serverManifest, value)),
1828
+ (action = loadServerReference(serverManifest, value.id, value.bound)))
1829
+ : key.startsWith("$ACTION_ID_") &&
1830
+ ((value = key.slice(11)),
1831
+ (action = loadServerReference(serverManifest, value, null)))
1832
+ : formData.append(key, value);
1833
+ });
1834
+ return null === action
1835
+ ? null
1836
+ : action.then(function (fn) {
1837
+ return fn.bind(null, formData);
1838
+ });
1839
+ };
1840
+ exports.decodeFormState = function (actionResult, body, serverManifest) {
1841
+ var keyPath = body.get("$ACTION_KEY");
1842
+ if ("string" !== typeof keyPath) return Promise.resolve(null);
1843
+ var metaData = null;
1844
+ body.forEach(function (value, key) {
1845
+ key.startsWith("$ACTION_REF_") &&
1846
+ ((value = "$ACTION_" + key.slice(12) + ":"),
1847
+ (metaData = decodeBoundActionMetaData(body, serverManifest, value)));
1848
+ });
1849
+ if (null === metaData) return Promise.resolve(null);
1850
+ var referenceId = metaData.id;
1851
+ return Promise.resolve(metaData.bound).then(function (bound) {
1852
+ return null === bound
1853
+ ? null
1854
+ : [actionResult, keyPath, referenceId, bound.length - 1];
1855
+ });
1856
+ };
1857
+ exports.decodeReply = function (body, webpackMap) {
1858
+ if ("string" === typeof body) {
1859
+ var form = new FormData();
1860
+ form.append("0", body);
1861
+ body = form;
1862
+ }
1863
+ body = createResponse(webpackMap, "", body);
1864
+ webpackMap = getChunk(body, 0);
1865
+ close(body);
1866
+ return webpackMap;
1867
+ };
1868
+ exports.registerClientReference = function (
1869
+ proxyImplementation,
1870
+ id,
1871
+ exportName
1872
+ ) {
1873
+ return registerClientReferenceImpl(
1874
+ proxyImplementation,
1875
+ id + "#" + exportName,
1876
+ !1
1877
+ );
1878
+ };
1879
+ exports.registerServerReference = function (reference, id, exportName) {
1880
+ return Object.defineProperties(reference, {
1881
+ $$typeof: { value: SERVER_REFERENCE_TAG },
1882
+ $$id: {
1883
+ value: null === exportName ? id : id + "#" + exportName,
1884
+ configurable: !0
1885
+ },
1886
+ $$bound: { value: null, configurable: !0 },
1887
+ bind: { value: bind, configurable: !0 }
1888
+ });
1889
+ };
1890
+ exports.renderToReadableStream = function (model, webpackMap, options) {
1891
+ var request = createRequest(
1892
+ model,
1893
+ webpackMap,
1894
+ options ? options.onError : void 0,
1895
+ options ? options.identifierPrefix : void 0,
1896
+ options ? options.onPostpone : void 0
1897
+ );
1898
+ if (options && options.signal) {
1899
+ var signal = options.signal;
1900
+ if (signal.aborted) abort(request, signal.reason);
1901
+ else {
1902
+ var listener = function () {
1903
+ abort(request, signal.reason);
1904
+ signal.removeEventListener("abort", listener);
1905
+ };
1906
+ signal.addEventListener("abort", listener);
1907
+ }
1908
+ }
1909
+ return new ReadableStream(
1910
+ {
1911
+ type: "bytes",
1912
+ start: function () {
1913
+ request.flushScheduled = null !== request.destination;
1914
+ performWork(request);
1915
+ },
1916
+ pull: function (controller) {
1917
+ if (1 === request.status)
1918
+ (request.status = 2), closeWithError(controller, request.fatalError);
1919
+ else if (2 !== request.status && null === request.destination) {
1920
+ request.destination = controller;
1921
+ try {
1922
+ flushCompletedChunks(request, controller);
1923
+ } catch (error) {
1924
+ logRecoverableError(request, error), fatalError(request, error);
1925
+ }
1926
+ }
1927
+ },
1928
+ cancel: function (reason) {
1929
+ request.destination = null;
1930
+ abort(request, reason);
1931
+ }
1932
+ },
1933
+ { highWaterMark: 0 }
1934
+ );
1935
+ };