897af6238e
Upgrade `react-server-dom-webpack` for exports renaming purpose x-ref: https://github.com/facebook/react/pull/25504
1005 lines
No EOL
33 KiB
JavaScript
1005 lines
No EOL
33 KiB
JavaScript
/******/ (() => { // webpackBootstrap
|
|
/******/ "use strict";
|
|
/******/ var __webpack_modules__ = ({
|
|
|
|
/***/ 415:
|
|
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
|
|
/**
|
|
* @license React
|
|
* react-server-dom-webpack-client.development.js
|
|
*
|
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*/
|
|
|
|
|
|
|
|
if (process.env.NODE_ENV !== "production") {
|
|
(function() {
|
|
'use strict';
|
|
|
|
var React = __nccwpck_require__(522);
|
|
|
|
function createStringDecoder() {
|
|
return new TextDecoder();
|
|
}
|
|
var decoderOptions = {
|
|
stream: true
|
|
};
|
|
function readPartialStringChunk(decoder, buffer) {
|
|
return decoder.decode(buffer, decoderOptions);
|
|
}
|
|
function readFinalStringChunk(decoder, buffer) {
|
|
return decoder.decode(buffer);
|
|
}
|
|
|
|
function parseModel(response, json) {
|
|
return JSON.parse(json, response._fromJSON);
|
|
}
|
|
|
|
// eslint-disable-next-line no-unused-vars
|
|
function resolveModuleReference(bundlerConfig, moduleData) {
|
|
if (bundlerConfig) {
|
|
var resolvedModuleData = bundlerConfig[moduleData.id][moduleData.name];
|
|
|
|
if (moduleData.async) {
|
|
return {
|
|
id: resolvedModuleData.id,
|
|
chunks: resolvedModuleData.chunks,
|
|
name: resolvedModuleData.name,
|
|
async: true
|
|
};
|
|
} else {
|
|
return resolvedModuleData;
|
|
}
|
|
}
|
|
|
|
return moduleData;
|
|
} // The chunk cache contains all the chunks we've preloaded so far.
|
|
// If they're still pending they're a thenable. This map also exists
|
|
// in Webpack but unfortunately it's not exposed so we have to
|
|
// replicate it in user space. null means that it has already loaded.
|
|
|
|
var chunkCache = new Map();
|
|
var asyncModuleCache = new Map();
|
|
|
|
function ignoreReject() {// We rely on rejected promises to be handled by another listener.
|
|
} // Start preloading the modules since we might need them soon.
|
|
// This function doesn't suspend.
|
|
|
|
|
|
function preloadModule(moduleData) {
|
|
var chunks = moduleData.chunks;
|
|
var promises = [];
|
|
|
|
for (var i = 0; i < chunks.length; i++) {
|
|
var chunkId = chunks[i];
|
|
var entry = chunkCache.get(chunkId);
|
|
|
|
if (entry === undefined) {
|
|
var thenable = globalThis.__next_chunk_load__(chunkId);
|
|
|
|
promises.push(thenable); // $FlowFixMe[method-unbinding]
|
|
|
|
var resolve = chunkCache.set.bind(chunkCache, chunkId, null);
|
|
thenable.then(resolve, ignoreReject);
|
|
chunkCache.set(chunkId, thenable);
|
|
} else if (entry !== null) {
|
|
promises.push(entry);
|
|
}
|
|
}
|
|
|
|
if (moduleData.async) {
|
|
var existingPromise = asyncModuleCache.get(moduleData.id);
|
|
|
|
if (existingPromise) {
|
|
if (existingPromise.status === 'fulfilled') {
|
|
return null;
|
|
}
|
|
|
|
return existingPromise;
|
|
} else {
|
|
var modulePromise = Promise.all(promises).then(function () {
|
|
return globalThis.__next_require__(moduleData.id);
|
|
});
|
|
modulePromise.then(function (value) {
|
|
var fulfilledThenable = modulePromise;
|
|
fulfilledThenable.status = 'fulfilled';
|
|
fulfilledThenable.value = value;
|
|
}, function (reason) {
|
|
var rejectedThenable = modulePromise;
|
|
rejectedThenable.status = 'rejected';
|
|
rejectedThenable.reason = reason;
|
|
});
|
|
asyncModuleCache.set(moduleData.id, modulePromise);
|
|
return modulePromise;
|
|
}
|
|
} else if (promises.length > 0) {
|
|
return Promise.all(promises);
|
|
} else {
|
|
return null;
|
|
}
|
|
} // Actually require the module or suspend if it's not yet ready.
|
|
// Increase priority if necessary.
|
|
|
|
function requireModule(moduleData) {
|
|
var moduleExports;
|
|
|
|
if (moduleData.async) {
|
|
// We assume that preloadModule has been called before, which
|
|
// should have added something to the module cache.
|
|
var promise = asyncModuleCache.get(moduleData.id);
|
|
|
|
if (promise.status === 'fulfilled') {
|
|
moduleExports = promise.value;
|
|
} else {
|
|
throw promise.reason;
|
|
}
|
|
} else {
|
|
moduleExports = globalThis.__next_require__(moduleData.id);
|
|
}
|
|
|
|
if (moduleData.name === '*') {
|
|
// This is a placeholder value that represents that the caller imported this
|
|
// as a CommonJS module as is.
|
|
return moduleExports;
|
|
}
|
|
|
|
if (moduleData.name === '') {
|
|
// This is a placeholder value that represents that the caller accessed the
|
|
// default property of this if it was an ESM interop module.
|
|
return moduleExports.__esModule ? moduleExports.default : moduleExports;
|
|
}
|
|
|
|
return moduleExports[moduleData.name];
|
|
}
|
|
|
|
// ATTENTION
|
|
// When adding new symbols to this file,
|
|
// Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'
|
|
// The Symbol used to tag the ReactElement-like types.
|
|
var REACT_ELEMENT_TYPE = Symbol.for('react.element');
|
|
var REACT_LAZY_TYPE = Symbol.for('react.lazy');
|
|
var REACT_SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED = Symbol.for('react.default_value');
|
|
|
|
var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
|
|
var ContextRegistry = ReactSharedInternals.ContextRegistry;
|
|
function getOrCreateServerContext(globalName) {
|
|
if (!ContextRegistry[globalName]) {
|
|
ContextRegistry[globalName] = React.createServerContext(globalName, // $FlowFixMe function signature doesn't reflect the symbol value
|
|
REACT_SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED);
|
|
}
|
|
|
|
return ContextRegistry[globalName];
|
|
}
|
|
|
|
var PENDING = 'pending';
|
|
var BLOCKED = 'blocked';
|
|
var RESOLVED_MODEL = 'resolved_model';
|
|
var RESOLVED_MODULE = 'resolved_module';
|
|
var INITIALIZED = 'fulfilled';
|
|
var ERRORED = 'rejected';
|
|
|
|
function Chunk(status, value, reason, response) {
|
|
this.status = status;
|
|
this.value = value;
|
|
this.reason = reason;
|
|
this._response = response;
|
|
} // We subclass Promise.prototype so that we get other methods like .catch
|
|
|
|
|
|
Chunk.prototype = Object.create(Promise.prototype); // TODO: This doesn't return a new Promise chain unlike the real .then
|
|
|
|
Chunk.prototype.then = function (resolve, reject) {
|
|
var chunk = this; // If we have resolved content, we try to initialize it first which
|
|
// might put us back into one of the other states.
|
|
|
|
switch (chunk.status) {
|
|
case RESOLVED_MODEL:
|
|
initializeModelChunk(chunk);
|
|
break;
|
|
|
|
case RESOLVED_MODULE:
|
|
initializeModuleChunk(chunk);
|
|
break;
|
|
} // The status might have changed after initialization.
|
|
|
|
|
|
switch (chunk.status) {
|
|
case INITIALIZED:
|
|
resolve(chunk.value);
|
|
break;
|
|
|
|
case PENDING:
|
|
case BLOCKED:
|
|
if (resolve) {
|
|
if (chunk.value === null) {
|
|
chunk.value = [];
|
|
}
|
|
|
|
chunk.value.push(resolve);
|
|
}
|
|
|
|
if (reject) {
|
|
if (chunk.reason === null) {
|
|
chunk.reason = [];
|
|
}
|
|
|
|
chunk.reason.push(reject);
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
reject(chunk.reason);
|
|
break;
|
|
}
|
|
};
|
|
|
|
function readChunk(chunk) {
|
|
// If we have resolved content, we try to initialize it first which
|
|
// might put us back into one of the other states.
|
|
switch (chunk.status) {
|
|
case RESOLVED_MODEL:
|
|
initializeModelChunk(chunk);
|
|
break;
|
|
|
|
case RESOLVED_MODULE:
|
|
initializeModuleChunk(chunk);
|
|
break;
|
|
} // The status might have changed after initialization.
|
|
|
|
|
|
switch (chunk.status) {
|
|
case INITIALIZED:
|
|
return chunk.value;
|
|
|
|
case PENDING:
|
|
case BLOCKED:
|
|
// eslint-disable-next-line no-throw-literal
|
|
throw chunk;
|
|
|
|
default:
|
|
throw chunk.reason;
|
|
}
|
|
}
|
|
|
|
function getRoot(response) {
|
|
var chunk = getChunk(response, 0);
|
|
return chunk;
|
|
}
|
|
|
|
function createPendingChunk(response) {
|
|
// $FlowFixMe Flow doesn't support functions as constructors
|
|
return new Chunk(PENDING, null, null, response);
|
|
}
|
|
|
|
function createBlockedChunk(response) {
|
|
// $FlowFixMe Flow doesn't support functions as constructors
|
|
return new Chunk(BLOCKED, null, null, response);
|
|
}
|
|
|
|
function createErrorChunk(response, error) {
|
|
// $FlowFixMe Flow doesn't support functions as constructors
|
|
return new Chunk(ERRORED, null, error, response);
|
|
}
|
|
|
|
function createInitializedChunk(response, value) {
|
|
// $FlowFixMe Flow doesn't support functions as constructors
|
|
return new Chunk(INITIALIZED, value, null, response);
|
|
}
|
|
|
|
function wakeChunk(listeners, value) {
|
|
for (var i = 0; i < listeners.length; i++) {
|
|
var listener = listeners[i];
|
|
listener(value);
|
|
}
|
|
}
|
|
|
|
function wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners) {
|
|
switch (chunk.status) {
|
|
case INITIALIZED:
|
|
wakeChunk(resolveListeners, chunk.value);
|
|
break;
|
|
|
|
case PENDING:
|
|
case BLOCKED:
|
|
chunk.value = resolveListeners;
|
|
chunk.reason = rejectListeners;
|
|
break;
|
|
|
|
case ERRORED:
|
|
if (rejectListeners) {
|
|
wakeChunk(rejectListeners, chunk.reason);
|
|
}
|
|
|
|
break;
|
|
}
|
|
}
|
|
|
|
function triggerErrorOnChunk(chunk, error) {
|
|
if (chunk.status !== PENDING && chunk.status !== BLOCKED) {
|
|
// We already resolved. We didn't expect to see this.
|
|
return;
|
|
}
|
|
|
|
var listeners = chunk.reason;
|
|
var erroredChunk = chunk;
|
|
erroredChunk.status = ERRORED;
|
|
erroredChunk.reason = error;
|
|
|
|
if (listeners !== null) {
|
|
wakeChunk(listeners, error);
|
|
}
|
|
}
|
|
|
|
function createResolvedModelChunk(response, value) {
|
|
// $FlowFixMe Flow doesn't support functions as constructors
|
|
return new Chunk(RESOLVED_MODEL, value, null, response);
|
|
}
|
|
|
|
function createResolvedModuleChunk(response, value) {
|
|
// $FlowFixMe Flow doesn't support functions as constructors
|
|
return new Chunk(RESOLVED_MODULE, value, null, response);
|
|
}
|
|
|
|
function resolveModelChunk(chunk, value) {
|
|
if (chunk.status !== PENDING) {
|
|
// We already resolved. We didn't expect to see this.
|
|
return;
|
|
}
|
|
|
|
var resolveListeners = chunk.value;
|
|
var rejectListeners = chunk.reason;
|
|
var resolvedChunk = chunk;
|
|
resolvedChunk.status = RESOLVED_MODEL;
|
|
resolvedChunk.value = value;
|
|
|
|
if (resolveListeners !== null) {
|
|
// This is unfortunate that we're reading this eagerly if
|
|
// we already have listeners attached since they might no
|
|
// longer be rendered or might not be the highest pri.
|
|
initializeModelChunk(resolvedChunk); // The status might have changed after initialization.
|
|
|
|
wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners);
|
|
}
|
|
}
|
|
|
|
function resolveModuleChunk(chunk, value) {
|
|
if (chunk.status !== PENDING && chunk.status !== BLOCKED) {
|
|
// We already resolved. We didn't expect to see this.
|
|
return;
|
|
}
|
|
|
|
var resolveListeners = chunk.value;
|
|
var rejectListeners = chunk.reason;
|
|
var resolvedChunk = chunk;
|
|
resolvedChunk.status = RESOLVED_MODULE;
|
|
resolvedChunk.value = value;
|
|
|
|
if (resolveListeners !== null) {
|
|
initializeModuleChunk(resolvedChunk);
|
|
wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners);
|
|
}
|
|
}
|
|
|
|
var initializingChunk = null;
|
|
var initializingChunkBlockedModel = null;
|
|
|
|
function initializeModelChunk(chunk) {
|
|
var prevChunk = initializingChunk;
|
|
var prevBlocked = initializingChunkBlockedModel;
|
|
initializingChunk = chunk;
|
|
initializingChunkBlockedModel = null;
|
|
|
|
try {
|
|
var _value = parseModel(chunk._response, chunk.value);
|
|
|
|
if (initializingChunkBlockedModel !== null && initializingChunkBlockedModel.deps > 0) {
|
|
initializingChunkBlockedModel.value = _value; // We discovered new dependencies on modules that are not yet resolved.
|
|
// We have to go the BLOCKED state until they're resolved.
|
|
|
|
var blockedChunk = chunk;
|
|
blockedChunk.status = BLOCKED;
|
|
blockedChunk.value = null;
|
|
blockedChunk.reason = null;
|
|
} else {
|
|
var initializedChunk = chunk;
|
|
initializedChunk.status = INITIALIZED;
|
|
initializedChunk.value = _value;
|
|
}
|
|
} catch (error) {
|
|
var erroredChunk = chunk;
|
|
erroredChunk.status = ERRORED;
|
|
erroredChunk.reason = error;
|
|
} finally {
|
|
initializingChunk = prevChunk;
|
|
initializingChunkBlockedModel = prevBlocked;
|
|
}
|
|
}
|
|
|
|
function initializeModuleChunk(chunk) {
|
|
try {
|
|
var _value2 = requireModule(chunk.value);
|
|
|
|
var initializedChunk = chunk;
|
|
initializedChunk.status = INITIALIZED;
|
|
initializedChunk.value = _value2;
|
|
} catch (error) {
|
|
var erroredChunk = chunk;
|
|
erroredChunk.status = ERRORED;
|
|
erroredChunk.reason = error;
|
|
}
|
|
} // Report that any missing chunks in the model is now going to throw this
|
|
// error upon read. Also notify any pending promises.
|
|
|
|
|
|
function reportGlobalError(response, error) {
|
|
response._chunks.forEach(function (chunk) {
|
|
// If this chunk was already resolved or errored, it won't
|
|
// trigger an error but if it wasn't then we need to
|
|
// because we won't be getting any new data to resolve it.
|
|
if (chunk.status === PENDING) {
|
|
triggerErrorOnChunk(chunk, error);
|
|
}
|
|
});
|
|
}
|
|
|
|
function createElement(type, key, props) {
|
|
var element = {
|
|
// This tag allows us to uniquely identify this as a React Element
|
|
$$typeof: REACT_ELEMENT_TYPE,
|
|
// Built-in properties that belong on the element
|
|
type: type,
|
|
key: key,
|
|
ref: null,
|
|
props: props,
|
|
// Record the component responsible for creating this element.
|
|
_owner: null
|
|
};
|
|
|
|
{
|
|
// We don't really need to add any of these but keeping them for good measure.
|
|
// Unfortunately, _store is enumerable in jest matchers so for equality to
|
|
// work, I need to keep it or make _store non-enumerable in the other file.
|
|
element._store = {};
|
|
Object.defineProperty(element._store, 'validated', {
|
|
configurable: false,
|
|
enumerable: false,
|
|
writable: true,
|
|
value: true // This element has already been validated on the server.
|
|
|
|
});
|
|
Object.defineProperty(element, '_self', {
|
|
configurable: false,
|
|
enumerable: false,
|
|
writable: false,
|
|
value: null
|
|
});
|
|
Object.defineProperty(element, '_source', {
|
|
configurable: false,
|
|
enumerable: false,
|
|
writable: false,
|
|
value: null
|
|
});
|
|
}
|
|
|
|
return element;
|
|
}
|
|
|
|
function createLazyChunkWrapper(chunk) {
|
|
var lazyType = {
|
|
$$typeof: REACT_LAZY_TYPE,
|
|
_payload: chunk,
|
|
_init: readChunk
|
|
};
|
|
return lazyType;
|
|
}
|
|
|
|
function getChunk(response, id) {
|
|
var chunks = response._chunks;
|
|
var chunk = chunks.get(id);
|
|
|
|
if (!chunk) {
|
|
chunk = createPendingChunk(response);
|
|
chunks.set(id, chunk);
|
|
}
|
|
|
|
return chunk;
|
|
}
|
|
|
|
function createModelResolver(chunk, parentObject, key) {
|
|
var blocked;
|
|
|
|
if (initializingChunkBlockedModel) {
|
|
blocked = initializingChunkBlockedModel;
|
|
blocked.deps++;
|
|
} else {
|
|
blocked = initializingChunkBlockedModel = {
|
|
deps: 1,
|
|
value: null
|
|
};
|
|
}
|
|
|
|
return function (value) {
|
|
parentObject[key] = value;
|
|
blocked.deps--;
|
|
|
|
if (blocked.deps === 0) {
|
|
if (chunk.status !== BLOCKED) {
|
|
return;
|
|
}
|
|
|
|
var resolveListeners = chunk.value;
|
|
var initializedChunk = chunk;
|
|
initializedChunk.status = INITIALIZED;
|
|
initializedChunk.value = blocked.value;
|
|
|
|
if (resolveListeners !== null) {
|
|
wakeChunk(resolveListeners, blocked.value);
|
|
}
|
|
}
|
|
};
|
|
}
|
|
|
|
function createModelReject(chunk) {
|
|
return function (error) {
|
|
return triggerErrorOnChunk(chunk, error);
|
|
};
|
|
}
|
|
|
|
function parseModelString(response, parentObject, key, value) {
|
|
switch (value[0]) {
|
|
case '$':
|
|
{
|
|
if (value === '$') {
|
|
return REACT_ELEMENT_TYPE;
|
|
} else if (value[1] === '$' || value[1] === '@') {
|
|
// This was an escaped string value.
|
|
return value.substring(1);
|
|
} else {
|
|
var id = parseInt(value.substring(1), 16);
|
|
var chunk = getChunk(response, id);
|
|
|
|
switch (chunk.status) {
|
|
case RESOLVED_MODEL:
|
|
initializeModelChunk(chunk);
|
|
break;
|
|
|
|
case RESOLVED_MODULE:
|
|
initializeModuleChunk(chunk);
|
|
break;
|
|
} // The status might have changed after initialization.
|
|
|
|
|
|
switch (chunk.status) {
|
|
case INITIALIZED:
|
|
return chunk.value;
|
|
|
|
case PENDING:
|
|
case BLOCKED:
|
|
var parentChunk = initializingChunk;
|
|
chunk.then(createModelResolver(parentChunk, parentObject, key), createModelReject(parentChunk));
|
|
return null;
|
|
|
|
default:
|
|
throw chunk.reason;
|
|
}
|
|
}
|
|
}
|
|
|
|
case '@':
|
|
{
|
|
var _id = parseInt(value.substring(1), 16);
|
|
|
|
var _chunk = getChunk(response, _id); // We create a React.lazy wrapper around any lazy values.
|
|
// When passed into React, we'll know how to suspend on this.
|
|
|
|
|
|
return createLazyChunkWrapper(_chunk);
|
|
}
|
|
}
|
|
|
|
return value;
|
|
}
|
|
function parseModelTuple(response, value) {
|
|
var tuple = value;
|
|
|
|
if (tuple[0] === REACT_ELEMENT_TYPE) {
|
|
// TODO: Consider having React just directly accept these arrays as elements.
|
|
// Or even change the ReactElement type to be an array.
|
|
return createElement(tuple[1], tuple[2], tuple[3]);
|
|
}
|
|
|
|
return value;
|
|
}
|
|
function createResponse(bundlerConfig) {
|
|
var chunks = new Map();
|
|
var response = {
|
|
_bundlerConfig: bundlerConfig,
|
|
_chunks: chunks
|
|
};
|
|
return response;
|
|
}
|
|
function resolveModel(response, id, model) {
|
|
var chunks = response._chunks;
|
|
var chunk = chunks.get(id);
|
|
|
|
if (!chunk) {
|
|
chunks.set(id, createResolvedModelChunk(response, model));
|
|
} else {
|
|
resolveModelChunk(chunk, model);
|
|
}
|
|
}
|
|
function resolveProvider(response, id, contextName) {
|
|
var chunks = response._chunks;
|
|
chunks.set(id, createInitializedChunk(response, getOrCreateServerContext(contextName).Provider));
|
|
}
|
|
function resolveModule(response, id, model) {
|
|
var chunks = response._chunks;
|
|
var chunk = chunks.get(id);
|
|
var moduleMetaData = parseModel(response, model);
|
|
var moduleReference = resolveModuleReference(response._bundlerConfig, moduleMetaData); // TODO: Add an option to encode modules that are lazy loaded.
|
|
// For now we preload all modules as early as possible since it's likely
|
|
// that we'll need them.
|
|
|
|
var promise = preloadModule(moduleReference);
|
|
|
|
if (promise) {
|
|
var blockedChunk;
|
|
|
|
if (!chunk) {
|
|
// Technically, we should just treat promise as the chunk in this
|
|
// case. Because it'll just behave as any other promise.
|
|
blockedChunk = createBlockedChunk(response);
|
|
chunks.set(id, blockedChunk);
|
|
} else {
|
|
// This can't actually happen because we don't have any forward
|
|
// references to modules.
|
|
blockedChunk = chunk;
|
|
blockedChunk.status = BLOCKED;
|
|
}
|
|
|
|
promise.then(function () {
|
|
return resolveModuleChunk(blockedChunk, moduleReference);
|
|
}, function (error) {
|
|
return triggerErrorOnChunk(blockedChunk, error);
|
|
});
|
|
} else {
|
|
if (!chunk) {
|
|
chunks.set(id, createResolvedModuleChunk(response, moduleReference));
|
|
} else {
|
|
// This can't actually happen because we don't have any forward
|
|
// references to modules.
|
|
resolveModuleChunk(chunk, moduleReference);
|
|
}
|
|
}
|
|
}
|
|
function resolveSymbol(response, id, name) {
|
|
var chunks = response._chunks; // We assume that we'll always emit the symbol before anything references it
|
|
// to save a few bytes.
|
|
|
|
chunks.set(id, createInitializedChunk(response, Symbol.for(name)));
|
|
}
|
|
function resolveErrorDev(response, id, digest, message, stack) {
|
|
|
|
|
|
var error = new Error(message || 'An error occurred in the Server Components render but no message was provided');
|
|
error.stack = stack;
|
|
error.digest = digest;
|
|
var errorWithDigest = error;
|
|
var chunks = response._chunks;
|
|
var chunk = chunks.get(id);
|
|
|
|
if (!chunk) {
|
|
chunks.set(id, createErrorChunk(response, errorWithDigest));
|
|
} else {
|
|
triggerErrorOnChunk(chunk, errorWithDigest);
|
|
}
|
|
}
|
|
function close(response) {
|
|
// In case there are any remaining unresolved chunks, they won't
|
|
// be resolved now. So we need to issue an error to those.
|
|
// Ideally we should be able to early bail out if we kept a
|
|
// ref count of pending chunks.
|
|
reportGlobalError(response, new Error('Connection closed.'));
|
|
}
|
|
|
|
function processFullRow(response, row) {
|
|
if (row === '') {
|
|
return;
|
|
}
|
|
|
|
var tag = row[0]; // When tags that are not text are added, check them here before
|
|
// parsing the row as text.
|
|
// switch (tag) {
|
|
// }
|
|
|
|
var colon = row.indexOf(':', 1);
|
|
var id = parseInt(row.substring(1, colon), 16);
|
|
var text = row.substring(colon + 1);
|
|
|
|
switch (tag) {
|
|
case 'J':
|
|
{
|
|
resolveModel(response, id, text);
|
|
return;
|
|
}
|
|
|
|
case 'M':
|
|
{
|
|
resolveModule(response, id, text);
|
|
return;
|
|
}
|
|
|
|
case 'P':
|
|
{
|
|
resolveProvider(response, id, text);
|
|
return;
|
|
}
|
|
|
|
case 'S':
|
|
{
|
|
resolveSymbol(response, id, JSON.parse(text));
|
|
return;
|
|
}
|
|
|
|
case 'E':
|
|
{
|
|
var errorInfo = JSON.parse(text);
|
|
|
|
{
|
|
resolveErrorDev(response, id, errorInfo.digest, errorInfo.message, errorInfo.stack);
|
|
}
|
|
|
|
return;
|
|
}
|
|
|
|
default:
|
|
{
|
|
throw new Error("Error parsing the data. It's probably an error code or network corruption.");
|
|
}
|
|
}
|
|
}
|
|
|
|
function processStringChunk(response, chunk, offset) {
|
|
var linebreak = chunk.indexOf('\n', offset);
|
|
|
|
while (linebreak > -1) {
|
|
var fullrow = response._partialRow + chunk.substring(offset, linebreak);
|
|
processFullRow(response, fullrow);
|
|
response._partialRow = '';
|
|
offset = linebreak + 1;
|
|
linebreak = chunk.indexOf('\n', offset);
|
|
}
|
|
|
|
response._partialRow += chunk.substring(offset);
|
|
}
|
|
function processBinaryChunk(response, chunk) {
|
|
|
|
var stringDecoder = response._stringDecoder;
|
|
var linebreak = chunk.indexOf(10); // newline
|
|
|
|
while (linebreak > -1) {
|
|
var fullrow = response._partialRow + readFinalStringChunk(stringDecoder, chunk.subarray(0, linebreak));
|
|
processFullRow(response, fullrow);
|
|
response._partialRow = '';
|
|
chunk = chunk.subarray(linebreak + 1);
|
|
linebreak = chunk.indexOf(10); // newline
|
|
}
|
|
|
|
response._partialRow += readPartialStringChunk(stringDecoder, chunk);
|
|
}
|
|
|
|
function createFromJSONCallback(response) {
|
|
return function (key, value) {
|
|
if (typeof value === 'string') {
|
|
// We can't use .bind here because we need the "this" value.
|
|
return parseModelString(response, this, key, value);
|
|
}
|
|
|
|
if (typeof value === 'object' && value !== null) {
|
|
return parseModelTuple(response, value);
|
|
}
|
|
|
|
return value;
|
|
};
|
|
}
|
|
|
|
function createResponse$1(bundlerConfig) {
|
|
// NOTE: CHECK THE COMPILER OUTPUT EACH TIME YOU CHANGE THIS.
|
|
// It should be inlined to one object literal but minor changes can break it.
|
|
var stringDecoder = createStringDecoder() ;
|
|
var response = createResponse(bundlerConfig);
|
|
response._partialRow = '';
|
|
|
|
{
|
|
response._stringDecoder = stringDecoder;
|
|
} // Don't inline this call because it causes closure to outline the call above.
|
|
|
|
|
|
response._fromJSON = createFromJSONCallback(response);
|
|
return response;
|
|
}
|
|
|
|
function startReadingFromStream(response, stream) {
|
|
var reader = stream.getReader();
|
|
|
|
function progress(_ref) {
|
|
var done = _ref.done,
|
|
value = _ref.value;
|
|
|
|
if (done) {
|
|
close(response);
|
|
return;
|
|
}
|
|
|
|
var buffer = value;
|
|
processBinaryChunk(response, buffer);
|
|
return reader.read().then(progress).catch(error);
|
|
}
|
|
|
|
function error(e) {
|
|
reportGlobalError(response, e);
|
|
}
|
|
|
|
reader.read().then(progress).catch(error);
|
|
}
|
|
|
|
function createFromReadableStream(stream, options) {
|
|
var response = createResponse$1(options && options.moduleMap ? options.moduleMap : null);
|
|
startReadingFromStream(response, stream);
|
|
return getRoot(response);
|
|
}
|
|
|
|
function createFromFetch(promiseForResponse, options) {
|
|
var response = createResponse$1(options && options.moduleMap ? options.moduleMap : null);
|
|
promiseForResponse.then(function (r) {
|
|
startReadingFromStream(response, r.body);
|
|
}, function (e) {
|
|
reportGlobalError(response, e);
|
|
});
|
|
return getRoot(response);
|
|
}
|
|
|
|
function createFromXHR(request, options) {
|
|
var response = createResponse$1(options && options.moduleMap ? options.moduleMap : null);
|
|
var processedLength = 0;
|
|
|
|
function progress(e) {
|
|
var chunk = request.responseText;
|
|
processStringChunk(response, chunk, processedLength);
|
|
processedLength = chunk.length;
|
|
}
|
|
|
|
function load(e) {
|
|
progress();
|
|
close(response);
|
|
}
|
|
|
|
function error(e) {
|
|
reportGlobalError(response, new TypeError('Network error'));
|
|
}
|
|
|
|
request.addEventListener('progress', progress);
|
|
request.addEventListener('load', load);
|
|
request.addEventListener('error', error);
|
|
request.addEventListener('abort', error);
|
|
request.addEventListener('timeout', error);
|
|
return getRoot(response);
|
|
}
|
|
|
|
exports.createFromFetch = createFromFetch;
|
|
exports.createFromReadableStream = createFromReadableStream;
|
|
exports.createFromXHR = createFromXHR;
|
|
})();
|
|
}
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 291:
|
|
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
|
|
/**
|
|
* @license React
|
|
* react-server-dom-webpack-client.production.min.js
|
|
*
|
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*/
|
|
var h=__nccwpck_require__(522),k={stream:!0};function m(a,b){return a?(a=a[b.id][b.name],b.async?{id:a.id,chunks:a.chunks,name:a.name,async:!0}:a):b}var n=new Map,p=new Map;function q(){}
|
|
function r(a){for(var b=a.chunks,c=[],d=0;d<b.length;d++){var e=b[d],f=n.get(e);if(void 0===f){f=globalThis.__next_chunk_load__(e);c.push(f);var l=n.set.bind(n,e,null);f.then(l,q);n.set(e,f)}else null!==f&&c.push(f)}if(a.async){if(b=p.get(a.id))return"fulfilled"===b.status?null:b;var g=Promise.all(c).then(function(){return globalThis.__next_require__(a.id)});g.then(function(a){g.status="fulfilled";g.value=a},function(a){g.status="rejected";g.reason=a});p.set(a.id,g);return g}return 0<c.length?Promise.all(c):null}
|
|
var t=Symbol.for("react.element"),u=Symbol.for("react.lazy"),v=Symbol.for("react.default_value"),w=h.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ContextRegistry;function x(a){w[a]||(w[a]=h.createServerContext(a,v));return w[a]}function y(a,b,c,d){this.status=a;this.value=b;this.reason=c;this._response=d}y.prototype=Object.create(Promise.prototype);
|
|
y.prototype.then=function(a,b){switch(this.status){case "resolved_model":z(this);break;case "resolved_module":B(this)}switch(this.status){case "fulfilled":a(this.value);break;case "pending":case "blocked":a&&(null===this.value&&(this.value=[]),this.value.push(a));b&&(null===this.reason&&(this.reason=[]),this.reason.push(b));break;default:b(this.reason)}};
|
|
function C(a){switch(a.status){case "resolved_model":z(a);break;case "resolved_module":B(a)}switch(a.status){case "fulfilled":return a.value;case "pending":case "blocked":throw a;default:throw a.reason;}}function D(a,b){return new y("fulfilled",b,null,a)}function E(a,b){for(var c=0;c<a.length;c++)(0,a[c])(b)}function F(a,b,c){switch(a.status){case "fulfilled":E(b,a.value);break;case "pending":case "blocked":a.value=b;a.reason=c;break;case "rejected":c&&E(c,a.reason)}}
|
|
function G(a,b){if("pending"===a.status||"blocked"===a.status){var c=a.reason;a.status="rejected";a.reason=b;null!==c&&E(c,b)}}function H(a,b){if("pending"===a.status||"blocked"===a.status){var c=a.value,d=a.reason;a.status="resolved_module";a.value=b;null!==c&&(B(a),F(a,c,d))}}var I=null,J=null;
|
|
function z(a){var b=I,c=J;I=a;J=null;try{var d=JSON.parse(a.value,a._response._fromJSON);null!==J&&0<J.deps?(J.value=d,a.status="blocked",a.value=null,a.reason=null):(a.status="fulfilled",a.value=d)}catch(e){a.status="rejected",a.reason=e}finally{I=b,J=c}}
|
|
function B(a){try{var b=a.value;if(b.async){var c=p.get(b.id);if("fulfilled"===c.status)var d=c.value;else throw c.reason;}else d=globalThis.__next_require__(b.id);var e="*"===b.name?d:""===b.name?d.__esModule?d.default:d:d[b.name];a.status="fulfilled";a.value=e}catch(f){a.status="rejected",a.reason=f}}function K(a,b){a._chunks.forEach(function(a){"pending"===a.status&&G(a,b)})}function L(a,b){var c=a._chunks,d=c.get(b);d||(d=new y("pending",null,null,a),c.set(b,d));return d}
|
|
function N(a,b,c){if(J){var d=J;d.deps++}else d=J={deps:1,value:null};return function(e){b[c]=e;d.deps--;0===d.deps&&"blocked"===a.status&&(e=a.value,a.status="fulfilled",a.value=d.value,null!==e&&E(e,d.value))}}function O(a){return function(b){return G(a,b)}}
|
|
function P(a,b,c,d){switch(d[0]){case "$":if("$"===d)return t;if("$"===d[1]||"@"===d[1])return d.substring(1);d=parseInt(d.substring(1),16);a=L(a,d);switch(a.status){case "resolved_model":z(a);break;case "resolved_module":B(a)}switch(a.status){case "fulfilled":return a.value;case "pending":case "blocked":return d=I,a.then(N(d,b,c),O(d)),null;default:throw a.reason;}case "@":return b=parseInt(d.substring(1),16),b=L(a,b),{$$typeof:u,_payload:b,_init:C}}return d}
|
|
function Q(a,b,c){var d=a._chunks,e=d.get(b);c=JSON.parse(c,a._fromJSON);var f=m(a._bundlerConfig,c);if(c=r(f)){if(e){var l=e;l.status="blocked"}else l=new y("blocked",null,null,a),d.set(b,l);c.then(function(){return H(l,f)},function(a){return G(l,a)})}else e?H(e,f):d.set(b,new y("resolved_module",f,null,a))}function R(a){K(a,Error("Connection closed."))}
|
|
function S(a,b){if(""!==b){var c=b[0],d=b.indexOf(":",1),e=parseInt(b.substring(1,d),16);b=b.substring(d+1);switch(c){case "J":d=a._chunks;(c=d.get(e))?"pending"===c.status&&(a=c.value,e=c.reason,c.status="resolved_model",c.value=b,null!==a&&(z(c),F(c,a,e))):d.set(e,new y("resolved_model",b,null,a));break;case "M":Q(a,e,b);break;case "P":a._chunks.set(e,D(a,x(b).Provider));break;case "S":b=JSON.parse(b);a._chunks.set(e,D(a,Symbol.for(b)));break;case "E":c=JSON.parse(b).digest;b=Error("An error occurred in the Server Components render. The specific message is omitted in production builds to avoid leaking sensitive details. A digest property is included on this error instance which may provide additional details about the nature of the error.");
|
|
b.stack="";b.digest=c;c=a._chunks;(d=c.get(e))?G(d,b):c.set(e,new y("rejected",null,b,a));break;default:throw Error("Error parsing the data. It's probably an error code or network corruption.");}}}function T(a){return function(b,c){return"string"===typeof c?P(a,this,b,c):"object"===typeof c&&null!==c?(b=c[0]===t?{$$typeof:t,type:c[1],key:c[2],ref:null,props:c[3],_owner:null}:c,b):c}}
|
|
function U(a){var b=new TextDecoder,c=new Map;a={_bundlerConfig:a,_chunks:c,_partialRow:"",_stringDecoder:b};a._fromJSON=T(a);return a}function V(a,b){function c(b){var f=b.value;if(b.done)R(a);else{b=f;f=a._stringDecoder;for(var g=b.indexOf(10);-1<g;){var M=a._partialRow;var A=b.subarray(0,g);A=f.decode(A);S(a,M+A);a._partialRow="";b=b.subarray(g+1);g=b.indexOf(10)}a._partialRow+=f.decode(b,k);return e.read().then(c).catch(d)}}function d(b){K(a,b)}var e=b.getReader();e.read().then(c).catch(d)}
|
|
exports.createFromFetch=function(a,b){var c=U(b&&b.moduleMap?b.moduleMap:null);a.then(function(a){V(c,a.body)},function(a){K(c,a)});return L(c,0)};exports.createFromReadableStream=function(a,b){b=U(b&&b.moduleMap?b.moduleMap:null);V(b,a);return L(b,0)};
|
|
exports.createFromXHR=function(a,b){function c(){for(var b=a.responseText,c=f,d=b.indexOf("\n",c);-1<d;)c=e._partialRow+b.substring(c,d),S(e,c),e._partialRow="",c=d+1,d=b.indexOf("\n",c);e._partialRow+=b.substring(c);f=b.length}function d(){K(e,new TypeError("Network error"))}var e=U(b&&b.moduleMap?b.moduleMap:null),f=0;a.addEventListener("progress",c);a.addEventListener("load",function(){c();R(e)});a.addEventListener("error",d);a.addEventListener("abort",d);a.addEventListener("timeout",d);return L(e,
|
|
0)};
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 967:
|
|
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
|
|
|
|
|
|
if (process.env.NODE_ENV === 'production') {
|
|
module.exports = __nccwpck_require__(291);
|
|
} else {
|
|
module.exports = __nccwpck_require__(415);
|
|
}
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 522:
|
|
/***/ ((module) => {
|
|
|
|
module.exports = require("react");
|
|
|
|
/***/ })
|
|
|
|
/******/ });
|
|
/************************************************************************/
|
|
/******/ // The module cache
|
|
/******/ var __webpack_module_cache__ = {};
|
|
/******/
|
|
/******/ // The require function
|
|
/******/ function __nccwpck_require__(moduleId) {
|
|
/******/ // Check if module is in cache
|
|
/******/ var cachedModule = __webpack_module_cache__[moduleId];
|
|
/******/ if (cachedModule !== undefined) {
|
|
/******/ return cachedModule.exports;
|
|
/******/ }
|
|
/******/ // Create a new module (and put it into the cache)
|
|
/******/ var module = __webpack_module_cache__[moduleId] = {
|
|
/******/ // no module.id needed
|
|
/******/ // no module.loaded needed
|
|
/******/ exports: {}
|
|
/******/ };
|
|
/******/
|
|
/******/ // Execute the module function
|
|
/******/ var threw = true;
|
|
/******/ try {
|
|
/******/ __webpack_modules__[moduleId](module, module.exports, __nccwpck_require__);
|
|
/******/ threw = false;
|
|
/******/ } finally {
|
|
/******/ if(threw) delete __webpack_module_cache__[moduleId];
|
|
/******/ }
|
|
/******/
|
|
/******/ // Return the exports of the module
|
|
/******/ return module.exports;
|
|
/******/ }
|
|
/******/
|
|
/************************************************************************/
|
|
/******/ /* webpack/runtime/compat */
|
|
/******/
|
|
/******/ if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/";
|
|
/******/
|
|
/************************************************************************/
|
|
/******/
|
|
/******/ // startup
|
|
/******/ // Load entry module and return exports
|
|
/******/ // This entry module used 'module' so it can't be inlined
|
|
/******/ var __webpack_exports__ = __nccwpck_require__(967);
|
|
/******/ module.exports = __webpack_exports__;
|
|
/******/
|
|
/******/ })()
|
|
; |