next
Version:
The React Framework
26 lines (25 loc) • 6.79 kB
JavaScript
/** @license React vundefined
* react-server-dom-webpack-writer.browser.production.min.server.js
*
* Copyright (c) Facebook, Inc. and its 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=require("react");function m(a){for(var d="https://reactjs.org/docs/error-decoder.html?invariant="+a,c=1;c<arguments.length;c++)d+="&args[]="+encodeURIComponent(arguments[c]);return"Minified React error #"+a+"; visit "+d+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function p(a,d){a.enqueue(d);return 0<a.desiredSize}var r=new TextEncoder;function t(a,d){"function"===typeof a.error?a.error(d):a.close()}
var u=JSON.stringify,v=Symbol.for("react.module.reference"),w=60103,x=60107,y=60112,z=60115,A=60116;if("function"===typeof Symbol&&Symbol.for){var B=Symbol.for;w=B("react.element");x=B("react.fragment");y=B("react.forward_ref");z=B("react.memo");A=B("react.lazy")}var C=Array.isArray,D=h.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentDispatcher;function H(a){console.error(a)}
function I(a,d,c){var b=[],e={status:0,fatalError:null,destination:null,bundlerConfig:d,cache:new Map,nextChunkId:0,pendingChunks:0,pingedSegments:b,completedModuleChunks:[],completedJSONChunks:[],completedErrorChunks:[],writtenSymbols:new Map,writtenModules:new Map,onError:void 0===c?H:c,toJSON:function(a,b){return J(e,this,a,b)}};e.pendingChunks++;a=K(e,a);b.push(a);return e}
function L(a,d,c,b){if(null!==c&&void 0!==c)throw Error(m(379));if("function"===typeof a)return a(b);if("string"===typeof a)return[w,a,d,b];if("symbol"===typeof a)return a===x?b.children:[w,a,d,b];if(null!=a&&"object"===typeof a){if(a.$$typeof===v)return[w,a,d,b];switch(a.$$typeof){case y:return a=a.render,a(b,void 0);case z:return L(a.type,d,c,b)}}throw Error(m(351,M(a)));}
function K(a,d){var c={id:a.nextChunkId++,model:d,ping:function(){var b=a.pingedSegments;b.push(c);1===b.length&&N(a)}};return c}function O(a){return Object.prototype.toString.call(a).replace(/^\[object (.*)\]$/,function(a,c){return c})}function P(a){var d=JSON.stringify(a);return'"'+a+'"'===d?a:d}
function M(a){switch(typeof a){case "string":return JSON.stringify(10>=a.length?a:a.substr(0,10)+"...");case "object":if(C(a))return"[...]";a=O(a);return"Object"===a?"{...}":a;case "function":return"function";default:return String(a)}}
function Q(a,d){if(C(a)){for(var c="[",b=0;b<a.length;b++){0<b&&(c+=", ");if(6<b){c+="...";break}var e=a[b];c=""+b===d&&"object"===typeof e&&null!==e?c+Q(e):c+M(e)}return c+"]"}c="{";b=Object.keys(a);for(e=0;e<b.length;e++){0<e&&(c+=", ");if(6<e){c+="...";break}var k=b[e];c+=P(k)+": ";var f=a[k];c=k===d&&"object"===typeof f&&null!==f?c+Q(f):c+M(f)}return c+"}"}
function J(a,d,c,b){switch(b){case w:return"$";case A:throw Error(m(352));}for(;"object"===typeof b&&null!==b&&b.$$typeof===w;){var e=b;try{b=L(e.type,e.key,e.ref,e.props)}catch(n){if("object"===typeof n&&null!==n&&"function"===typeof n.then)return a.pendingChunks++,a=K(a,b),d=a.ping,n.then(d,d),"@"+a.id.toString(16);S(a,n);a.pendingChunks++;d=a.nextChunkId++;T(a,d,n);return"@"+d.toString(16)}}if(null===b)return null;if("object"===typeof b){if(b.$$typeof===v){e=b.filepath+"#"+b.name;var k=a.writtenModules,
f=k.get(e);if(void 0!==f)return d[0]===w&&"1"===c?"@"+f.toString(16):"$"+f.toString(16);try{var l=a.bundlerConfig[b.filepath][b.name];a.pendingChunks++;var g=a.nextChunkId++,E=u(l),F="M"+g.toString(16)+":"+E+"\n";var G=r.encode(F);a.completedModuleChunks.push(G);k.set(e,g);return d[0]===w&&"1"===c?"@"+g.toString(16):"$"+g.toString(16)}catch(n){return a.pendingChunks++,d=a.nextChunkId++,T(a,d,n),"$"+d.toString(16)}}return b}if("string"===typeof b)return a="$"===b[0]||"@"===b[0]?"$"+b:b,a;if("boolean"===
typeof b||"number"===typeof b||"undefined"===typeof b)return b;if("function"===typeof b){if(/^on[A-Z]/.test(c))throw Error(m(374,P(c),Q(d)));throw Error(m(375,P(c),b.displayName||b.name||"function",Q(d)));}if("symbol"===typeof b){l=a.writtenSymbols;g=l.get(b);if(void 0!==g)return"$"+g.toString(16);g=b.description;if(Symbol.for(g)!==b)throw Error(m(376,b.description,P(c),Q(d)));a.pendingChunks++;d=a.nextChunkId++;c=u(g);c="S"+d.toString(16)+":"+c+"\n";c=r.encode(c);a.completedModuleChunks.push(c);
l.set(b,d);return"$"+d.toString(16)}if("bigint"===typeof b)throw Error(m(377,b,P(c),Q(d)));throw Error(m(378,typeof b,P(c),Q(d)));}function S(a,d){a=a.onError;a(d)}function U(a,d){null!==a.destination?(a.status=2,t(a.destination,d)):(a.status=1,a.fatalError=d)}
function T(a,d,c){var b="";try{if(c instanceof Error){var e=String(c.message);b=String(c.stack)}else e="Error: "+c}catch(k){e="An error occurred but serializing the error message failed."}c={message:e,stack:b};d="E"+d.toString(16)+":"+u(c)+"\n";d=r.encode(d);a.completedErrorChunks.push(d)}
function N(a){var d=D.current,c=V;D.current=W;V=a.cache;try{var b=a.pingedSegments;a.pingedSegments=[];for(var e=0;e<b.length;e++){var k=b[e];var f=a;try{for(var l=k.model;"object"===typeof l&&null!==l&&l.$$typeof===w;){var g=l;k.model=l;l=L(g.type,g.key,g.ref,g.props)}var E=k.id,F=u(l,f.toJSON),G="J"+E.toString(16)+":"+F+"\n";var n=r.encode(G);f.completedJSONChunks.push(n)}catch(q){if("object"===typeof q&&null!==q&&"function"===typeof q.then){var R=k.ping;q.then(R,R)}else S(f,q),T(f,k.id,q)}}null!==
a.destination&&X(a,a.destination)}catch(q){S(a,q),U(a,q)}finally{D.current=d,V=c}}
function X(a,d){for(var c=a.completedModuleChunks,b=0;b<c.length;b++)if(a.pendingChunks--,!p(d,c[b])){a.destination=null;b++;break}c.splice(0,b);c=a.completedJSONChunks;for(b=0;b<c.length;b++)if(a.pendingChunks--,!p(d,c[b])){a.destination=null;b++;break}c.splice(0,b);c=a.completedErrorChunks;for(b=0;b<c.length;b++)if(a.pendingChunks--,!p(d,c[b])){a.destination=null;b++;break}c.splice(0,b);0===a.pendingChunks&&d.close()}function Y(){throw Error(m(373));}function Z(){if(!V)throw Error(m(384));}
var V=null,W={useMemo:function(a){return a()},useCallback:function(a){return a},useDebugValue:function(){},useDeferredValue:Y,useTransition:Y,getCacheForType:function(a){if(!V)throw Error(m(380));var d=V.get(a);void 0===d&&(d=a(),V.set(a,d));return d},readContext:Y,useContext:Y,useReducer:Y,useRef:Y,useState:Y,useInsertionEffect:Y,useLayoutEffect:Y,useImperativeHandle:Y,useEffect:Y,useOpaqueIdentifier:Y,useMutableSource:Y,useSyncExternalStore:Y,useCacheRefresh:function(){return Z}};
exports.renderToReadableStream=function(a,d,c){var b=I(a,d,c?c.onError:void 0),e=new ReadableStream({start:function(){N(b)},pull:function(a){if(e.locked)if(1===b.status)b.status=2,t(a,b.fatalError);else if(2!==b.status){b.destination=a;try{X(b,a)}catch(f){S(b,f),U(b,f)}}},cancel:function(){}});return e};