@shopify/hydrogen 1.3.1 → 1.3.2

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 (60) hide show
  1. package/dist/esnext/entry-client.js +1 -1
  2. package/dist/esnext/entry-server.js +20 -25
  3. package/dist/esnext/foundation/HydrogenResponse/HydrogenResponse.server.d.ts +4 -0
  4. package/dist/esnext/foundation/HydrogenResponse/HydrogenResponse.server.js +16 -1
  5. package/dist/esnext/foundation/fetchSync/ResponseSync.d.ts +2 -1
  6. package/dist/esnext/foundation/fetchSync/ResponseSync.js +14 -2
  7. package/dist/esnext/framework/plugin.js +2 -2
  8. package/dist/esnext/framework/plugins/vite-plugin-assets-version.js +4 -0
  9. package/dist/esnext/framework/plugins/vite-plugin-client-imports.js +6 -3
  10. package/dist/esnext/framework/plugins/vite-plugin-css-modules-rsc.js +3 -0
  11. package/dist/esnext/framework/plugins/vite-plugin-css-rsc.js +8 -0
  12. package/dist/esnext/framework/plugins/vite-plugin-hydration-auto-import.js +7 -1
  13. package/dist/esnext/framework/plugins/vite-plugin-hydrogen-client-components-cache.d.ts +3 -0
  14. package/dist/esnext/framework/plugins/{vite-plugin-hydrogen-client-middleware.js → vite-plugin-hydrogen-client-components-cache.js} +2 -2
  15. package/dist/esnext/framework/plugins/vite-plugin-hydrogen-config.js +101 -91
  16. package/dist/esnext/framework/plugins/vite-plugin-hydrogen-middleware.js +6 -6
  17. package/dist/esnext/framework/plugins/vite-plugin-hydrogen-suppress-warnings.js +5 -0
  18. package/dist/esnext/framework/plugins/vite-plugin-hydrogen-virtual-files.js +21 -1
  19. package/dist/esnext/framework/plugins/vite-plugin-platform-entry.js +14 -1
  20. package/dist/esnext/framework/plugins/vite-plugin-ssr-interop.js +5 -1
  21. package/dist/esnext/framework/viteception.js +7 -1
  22. package/dist/esnext/types.d.ts +2 -1
  23. package/dist/esnext/utilities/apiRoutes.d.ts +2 -0
  24. package/dist/esnext/utilities/apiRoutes.js +1 -0
  25. package/dist/esnext/utilities/log/log.js +12 -3
  26. package/dist/esnext/utilities/template.d.ts +7 -6
  27. package/dist/esnext/utilities/template.js +39 -1
  28. package/dist/esnext/utilities/vite.d.ts +1 -0
  29. package/dist/esnext/utilities/vite.js +4 -0
  30. package/dist/esnext/version.d.ts +1 -1
  31. package/dist/esnext/version.js +1 -1
  32. package/dist/node/framework/plugin.js +2 -2
  33. package/dist/node/framework/plugins/vite-plugin-assets-version.js +4 -0
  34. package/dist/node/framework/plugins/vite-plugin-client-imports.js +6 -3
  35. package/dist/node/framework/plugins/vite-plugin-css-modules-rsc.js +3 -0
  36. package/dist/node/framework/plugins/vite-plugin-css-rsc.js +8 -0
  37. package/dist/node/framework/plugins/vite-plugin-hydration-auto-import.js +7 -1
  38. package/dist/node/framework/plugins/vite-plugin-hydrogen-client-components-cache.d.ts +3 -0
  39. package/dist/node/framework/plugins/{vite-plugin-hydrogen-client-middleware.js → vite-plugin-hydrogen-client-components-cache.js} +2 -2
  40. package/dist/node/framework/plugins/vite-plugin-hydrogen-config.js +101 -91
  41. package/dist/node/framework/plugins/vite-plugin-hydrogen-middleware.js +6 -6
  42. package/dist/node/framework/plugins/vite-plugin-hydrogen-suppress-warnings.js +5 -0
  43. package/dist/node/framework/plugins/vite-plugin-hydrogen-virtual-files.js +21 -1
  44. package/dist/node/framework/plugins/vite-plugin-platform-entry.js +14 -1
  45. package/dist/node/framework/plugins/vite-plugin-ssr-interop.js +5 -1
  46. package/dist/node/framework/viteception.js +7 -1
  47. package/dist/node/utilities/vite.d.ts +1 -0
  48. package/dist/node/utilities/vite.js +30 -0
  49. package/package.json +3 -3
  50. package/vendor/react-server-dom-vite/cjs/react-server-dom-vite-plugin.js +31 -21
  51. package/vendor/react-server-dom-vite/cjs/react-server-dom-vite-writer.browser.development.server.js +105 -29
  52. package/vendor/react-server-dom-vite/cjs/react-server-dom-vite-writer.browser.production.min.server.js +30 -29
  53. package/vendor/react-server-dom-vite/cjs/react-server-dom-vite-writer.node.development.server.js +92 -29
  54. package/vendor/react-server-dom-vite/cjs/react-server-dom-vite-writer.node.production.min.server.js +31 -29
  55. package/vendor/react-server-dom-vite/esm/react-server-dom-vite-plugin.js +24 -14
  56. package/vendor/react-server-dom-vite/esm/react-server-dom-vite-writer.browser.server.js +105 -29
  57. package/vendor/react-server-dom-vite/esm/react-server-dom-vite-writer.node.server.js +92 -29
  58. package/vendor/react-server-dom-vite/package.json +2 -2
  59. package/dist/esnext/framework/plugins/vite-plugin-hydrogen-client-middleware.d.ts +0 -9
  60. package/dist/node/framework/plugins/vite-plugin-hydrogen-client-middleware.d.ts +0 -9
@@ -7,7 +7,7 @@
7
7
  * This source code is licensed under the MIT license found in the
8
8
  * LICENSE file in the root directory of this source tree.
9
9
  */
10
- 'use strict';var e=require("react"),aa=Object.assign,k=null,m=0;function n(a,b){if(0!==b.length)if(512<b.length)0<m&&(a.enqueue(new Uint8Array(k.buffer,0,m)),k=new Uint8Array(512),m=0),a.enqueue(b);else{var d=k.length-m;d<b.length&&(0===d?a.enqueue(k):(k.set(b.subarray(0,d),m),a.enqueue(k),b=b.subarray(d)),k=new Uint8Array(512),m=0);k.set(b,m);m+=b.length}return!0}var q=new TextEncoder;function r(a){return q.encode(a)}function u(a,b){"function"===typeof a.error?a.error(b):a.close()}
10
+ 'use strict';var e=require("react"),aa=Object.assign,l=null,n=0;function p(a,b){if(0!==b.length)if(512<b.length)0<n&&(a.enqueue(new Uint8Array(l.buffer,0,n)),l=new Uint8Array(512),n=0),a.enqueue(b);else{var d=l.length-n;d<b.length&&(0===d?a.enqueue(l):(l.set(b.subarray(0,d),n),a.enqueue(l),b=b.subarray(d)),l=new Uint8Array(512),n=0);l.set(b,n);n+=b.length}return!0}var q=new TextEncoder;function r(a){return q.encode(a)}function u(a,b){"function"===typeof a.error?a.error(b):a.close()}
11
11
  var w=JSON.stringify,ba=Symbol.for("react.module.reference");function x(a){return"string"===typeof a?!!globalThis.__STRING_REFERENCE_INDEX[a]:a.$$typeof===ba}var y=Symbol.for("react.element"),ca=Symbol.for("react.fragment"),z=Symbol.for("react.provider"),da=Symbol.for("react.forward_ref"),ea=Symbol.for("react.memo"),A=Symbol.for("react.lazy"),B=Symbol.for("react.default_value");
12
12
  function C(a,b,d,c,f,g,h){this.acceptsBooleans=2===b||3===b||4===b;this.attributeName=c;this.attributeNamespace=f;this.mustUseProperty=d;this.propertyName=a;this.type=b;this.sanitizeURL=g;this.removeEmptyString=h}var D="children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ");D.push("innerText","textContent");D.forEach(function(a){new C(a,0,!1,a,null,!1,!1)});
13
13
  [["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(a){new C(a[0],1,!1,a[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(a){new C(a,2,!1,a.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(a){new C(a,2,!1,a,null,!1,!1)});
@@ -17,31 +17,32 @@ function C(a,b,d,c,f,g,h){this.acceptsBooleans=2===b||3===b||4===b;this.attribut
17
17
  F);new C(b,1,!1,a,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(a){var b=a.replace(E,F);new C(b,1,!1,a,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(a){var b=a.replace(E,F);new C(b,1,!1,a,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(a){new C(a,1,!1,a.toLowerCase(),null,!1,!1)});
18
18
  new C("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(a){new C(a,1,!1,a.toLowerCase(),null,!0,!0)});
19
19
  var G={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,
20
- fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},fa=["Webkit","ms","Moz","O"];Object.keys(G).forEach(function(a){fa.forEach(function(b){b=b+a.charAt(0).toUpperCase()+a.substring(1);G[b]=G[a]})});var H=Array.isArray;r("<script>");r("\x3c/script>");r('<script src="');r('<script type="module" src="');r('" async="">\x3c/script>');r("\x3c!-- --\x3e");r(' style="');r(":");r(";");r(" ");r('="');r('"');r('=""');r(">");
21
- r("/>");r(' selected=""');r("\n");r("<!DOCTYPE html>");r("</");r(">");r('<template id="');r('"></template>');r("\x3c!--$--\x3e");r('\x3c!--$?--\x3e<template id="');r('"></template>');r("\x3c!--$!--\x3e");r("\x3c!--/$--\x3e");r("<template");r('"');r(' data-dgst="');r(' data-msg="');r(' data-stck="');r("></template>");r('<div hidden id="');r('">');r("</div>");r('<svg aria-hidden="true" style="display:none" id="');r('">');r("</svg>");r('<math aria-hidden="true" style="display:none" id="');r('">');r("</math>");
22
- r('<table hidden id="');r('">');r("</table>");r('<table hidden><tbody id="');r('">');r("</tbody></table>");r('<table hidden><tr id="');r('">');r("</tr></table>");r('<table hidden><colgroup id="');r('">');r("</colgroup></table>");r('function $RS(a,b){a=document.getElementById(a);b=document.getElementById(b);for(a.parentNode.removeChild(a);a.firstChild;)b.parentNode.insertBefore(a.firstChild,b);b.parentNode.removeChild(b)};$RS("');r('$RS("');r('","');r('")\x3c/script>');r('function $RC(a,b){a=document.getElementById(a);b=document.getElementById(b);b.parentNode.removeChild(b);if(a){a=a.previousSibling;var f=a.parentNode,c=a.nextSibling,e=0;do{if(c&&8===c.nodeType){var d=c.data;if("/$"===d)if(0===e)break;else e--;else"$"!==d&&"$?"!==d&&"$!"!==d||e++}d=c.nextSibling;f.removeChild(c);c=d}while(c);for(;b.firstChild;)f.insertBefore(b.firstChild,c);a.data="$";a._reactRetry&&a._reactRetry()}};$RC("');
23
- r('$RC("');r('","');r('")\x3c/script>');r('function $RX(b,c,d,e){var a=document.getElementById(b);a&&(b=a.previousSibling,b.data="$!",a=a.dataset,c&&(a.dgst=c),d&&(a.msg=d),e&&(a.stck=e),b._reactRetry&&b._reactRetry())};$RX("');r('$RX("');r('"');r(")\x3c/script>");r(",");var I=null;
24
- function J(a,b){if(a!==b){a.context._currentValue=a.parentValue;a=a.parent;var d=b.parent;if(null===a){if(null!==d)throw Error("The stacks must reach the root at the same time. This is a bug in React.");}else{if(null===d)throw Error("The stacks must reach the root at the same time. This is a bug in React.");J(a,d);b.context._currentValue=b.value}}}function K(a){a.context._currentValue=a.parentValue;a=a.parent;null!==a&&K(a)}
25
- function ha(a){var b=a.parent;null!==b&&ha(b);a.context._currentValue=a.value}function ia(a,b){a.context._currentValue=a.parentValue;a=a.parent;if(null===a)throw Error("The depth must equal at least at zero before reaching the root. This is a bug in React.");a.depth===b.depth?J(a,b):ia(a,b)}
26
- function ja(a,b){var d=b.parent;if(null===d)throw Error("The depth must equal at least at zero before reaching the root. This is a bug in React.");a.depth===d.depth?J(a,d):ja(a,d);b.context._currentValue=b.value}function L(a){var b=I;b!==a&&(null===b?ha(a):null===a?K(b):b.depth===a.depth?J(b,a):b.depth>a.depth?ia(b,a):ja(b,a),I=a)}function ka(a,b){var d=a._currentValue;a._currentValue=b;var c=I;return I=a={parent:c,depth:null===c?0:c.depth+1,context:a,parentValue:d,value:b}}var M=null;
27
- function ma(a){return a._currentValue}
28
- var pa={useMemo:function(a){return a()},useCallback:function(a){return a},useDebugValue:function(){},useDeferredValue:N,useTransition:N,getCacheForType:function(a){if(!O)throw Error("Reading the cache is only supported while rendering.");var b=O.get(a);void 0===b&&(b=a(),O.set(a,b));return b},readContext:ma,useContext:ma,useReducer:N,useRef:N,useState:N,useInsertionEffect:N,useLayoutEffect:N,useImperativeHandle:N,useEffect:N,useId:na,useMutableSource:N,useSyncExternalStore:N,useCacheRefresh:function(){return oa}};
29
- function N(){throw Error("This Hook is not supported in Server Components.");}function oa(){if(!O)throw Error("Refreshing the cache is not supported in Server Components.");}var O=null;function na(){if(null===M)throw Error("useId can only be used while React is rendering");var a=M.identifierCount++;return":"+M.identifierPrefix+"S"+a.toString(32)+":"}var qa=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,P=qa.ContextRegistry,Q=qa.ReactCurrentDispatcher;function ra(a){console.error(a)}
30
- function sa(a,b,d,c,f){var g=[],h={status:0,fatalError:null,destination:null,bundlerConfig:b,cache:new Map,nextChunkId:0,pendingChunks:0,pingedSegments:g,completedModuleChunks:[],completedJSONChunks:[],completedErrorChunks:[],writtenSymbols:new Map,writtenModules:new Map,writtenProviders:new Map,identifierPrefix:f||"",identifierCount:1,onError:void 0===d?ra:d,toJSON:function(a,b){return ta(h,this,a,b)}};h.pendingChunks++;b=ua(c);a=va(h,a,b);g.push(a);return h}var wa={};
31
- function U(a,b,d,c){if(null!==d&&void 0!==d)throw Error("Refs cannot be used in server components, nor passed to client components.");if("function"===typeof a)return x(a)?[y,a,b,c]:a(c);if("string"===typeof a)return[y,a,b,c];if("symbol"===typeof a)return a===ca?c.children:[y,a,b,c];if(null!=a&&"object"===typeof a){if(x(a))return[y,a,b,c];switch(a.$$typeof){case A:var f=a._init;a=f(a._payload);return U(a,b,d,c);case da:return b=a.render,b(c,void 0);case ea:return U(a.type,b,d,c);case z:return ka(a._context,
32
- c.value),[y,a,b,{value:c.value,children:c.children,__pop:wa}]}}throw Error("Unsupported server component type: "+V(a));}function va(a,b,d){var c={id:a.nextChunkId++,model:b,context:d,ping:function(){var b=a.pingedSegments;b.push(c);1===b.length&&xa(a)}};return c}function ya(a){return Object.prototype.toString.call(a).replace(/^\[object (.*)\]$/,function(a,d){return d})}function W(a){var b=JSON.stringify(a);return'"'+a+'"'===b?a:b}
33
- function V(a){switch(typeof a){case "string":return JSON.stringify(10>=a.length?a:a.substr(0,10)+"...");case "object":if(H(a))return"[...]";a=ya(a);return"Object"===a?"{...}":a;case "function":return"function";default:return String(a)}}
34
- function X(a,b){if(H(a)){for(var d="[",c=0;c<a.length;c++){0<c&&(d+=", ");if(6<c){d+="...";break}var f=a[c];d=""+c===b&&"object"===typeof f&&null!==f?d+X(f):d+V(f)}return d+"]"}d="{";c=Object.keys(a);for(f=0;f<c.length;f++){0<f&&(d+=", ");if(6<f){d+="...";break}var g=c[f];d+=W(g)+": ";var h=a[g];d=g===b&&"object"===typeof h&&null!==h?d+X(h):d+V(h)}return d+"}"}
35
- function ta(a,b,d,c){switch(c){case y:return"$"}for(;"object"===typeof c&&null!==c&&(c.$$typeof===y||c.$$typeof===A);)try{switch(c.$$typeof){case y:var f=c;c=U(f.type,f.key,f.ref,f.props);break;case A:var g=c._init;c=g(c._payload)}}catch(t){if("object"===typeof t&&null!==t&&"function"===typeof t.then)return a.pendingChunks++,a=va(a,c,I),d=a.ping,t.then(d,d),"@"+a.id.toString(16);Y(a,t);a.pendingChunks++;d=a.nextChunkId++;Z(a,d,t);return"@"+d.toString(16)}if(null==c)return c;if("object"===typeof c||
36
- x(c)){if(x(c)){f=c;"string"===typeof f&&(f=globalThis.__STRING_REFERENCE_INDEX[f]);f=f.filepath+"#"+f.name;g=a.writtenModules;var h=g.get(f);if(void 0!==h)return b[0]===y&&"1"===d?"@"+h.toString(16):"$"+h.toString(16);try{"string"===typeof c&&(c=globalThis.__STRING_REFERENCE_INDEX[c]);var p={id:c.filepath,name:c.name};a.pendingChunks++;var l=a.nextChunkId++,R=w(p),S="M"+l.toString(16)+":"+R+"\n";var T=q.encode(S);a.completedModuleChunks.push(T);g.set(f,l);return b[0]===y&&"1"===d?"@"+l.toString(16):
37
- "$"+l.toString(16)}catch(t){return a.pendingChunks++,d=a.nextChunkId++,Z(a,d,t),"$"+d.toString(16)}}else{if(c.$$typeof===z)return b=c._context._globalName,c=a.writtenProviders,d=c.get(d),void 0===d&&(a.pendingChunks++,d=a.nextChunkId++,c.set(b,d),b="P"+d.toString(16)+":"+b+"\n",b=q.encode(b),a.completedJSONChunks.push(b)),"$"+d.toString(16);if(c===wa){a=I;if(null===a)throw Error("Tried to pop a Context at the root of the app. This is a bug in React.");d=a.parentValue;a.context._currentValue=d===B?
38
- a.context._defaultValue:d;I=a.parent;return}}return c}if("string"===typeof c)return a="$"===c[0]||"@"===c[0]?"$"+c:c,a;if("boolean"===typeof c||"number"===typeof c||"undefined"===typeof c)return c;if("function"===typeof c){if(/^on[A-Z]/.test(d))throw Error("Event handlers cannot be passed to client component props. Remove "+(W(d)+" from these props if possible: "+X(b)+"\nIf you need interactivity, consider converting part of this to a client component."));throw Error("Functions cannot be passed directly to client components because they're not serializable. Remove "+
39
- (W(d)+" ("+(c.displayName||c.name||"function")+") from this object, or avoid the entire object: "+X(b)));}if("symbol"===typeof c){p=a.writtenSymbols;l=p.get(c);if(void 0!==l)return"$"+l.toString(16);l=c.description;if(Symbol.for(l)!==c)throw Error("Only global symbols received from Symbol.for(...) can be passed to client components. The symbol Symbol.for("+(c.description+") cannot be found among global symbols. Remove ")+(W(d)+" from this object, or avoid the entire object: "+X(b)));a.pendingChunks++;
40
- d=a.nextChunkId++;b=w(l);b="S"+d.toString(16)+":"+b+"\n";b=q.encode(b);a.completedModuleChunks.push(b);p.set(c,d);return"$"+d.toString(16)}if("bigint"===typeof c)throw Error("BigInt ("+c+") is not yet supported in client component props. Remove "+(W(d)+" from this object or use a plain number instead: "+X(b)));throw Error("Type "+typeof c+" is not supported in client component props. Remove "+(W(d)+" from this object, or avoid the entire object: "+X(b)));}function Y(a,b){a=a.onError;a(b)}
41
- function za(a,b){null!==a.destination?(a.status=2,u(a.destination,b)):(a.status=1,a.fatalError=b)}function Z(a,b,d){var c="";try{if(d instanceof Error){var f=String(d.message);c=String(d.stack)}else f="Error: "+d}catch(g){f="An error occurred but serializing the error message failed."}d={message:f,stack:c};b="E"+b.toString(16)+":"+w(d)+"\n";b=q.encode(b);a.completedErrorChunks.push(b)}
42
- function xa(a){var b=Q.current,d=O;Q.current=pa;O=a.cache;M=a;try{var c=a.pingedSegments;a.pingedSegments=[];for(var f=0;f<c.length;f++){var g=c[f];var h=a;L(g.context);try{for(var p=g.model;"object"===typeof p&&null!==p&&p.$$typeof===y;){var l=p;g.model=p;p=U(l.type,l.key,l.ref,l.props)}var R=g.id,S=w(p,h.toJSON),T="J"+R.toString(16)+":"+S+"\n";var t=q.encode(T);h.completedJSONChunks.push(t)}catch(v){if("object"===typeof v&&null!==v&&"function"===typeof v.then){var la=g.ping;v.then(la,la)}else Y(h,
43
- v),Z(h,g.id,v)}}null!==a.destination&&Aa(a,a.destination)}catch(v){Y(a,v),za(a,v)}finally{Q.current=b,O=d,M=null}}
44
- function Aa(a,b){k=new Uint8Array(512);m=0;try{for(var d=a.completedModuleChunks,c=0;c<d.length;c++)if(a.pendingChunks--,!n(b,d[c])){a.destination=null;c++;break}d.splice(0,c);var f=a.completedJSONChunks;for(c=0;c<f.length;c++)if(a.pendingChunks--,!n(b,f[c])){a.destination=null;c++;break}f.splice(0,c);var g=a.completedErrorChunks;for(c=0;c<g.length;c++)if(a.pendingChunks--,!n(b,g[c])){a.destination=null;c++;break}g.splice(0,c)}finally{k&&0<m&&(b.enqueue(new Uint8Array(k.buffer,0,m)),k=null,m=0)}0===
45
- a.pendingChunks&&b.close()}function ua(a){if(a){var b=I;L(null);for(var d=0;d<a.length;d++){var c=a[d],f=c[0];c=c[1];P[f]||(P[f]=e.createServerContext(f,B));ka(P[f],c)}a=I;L(b);return a}return null}
46
- exports.renderToReadableStream=function(a,b){var d=sa(aa({},a,{$$typeof:Symbol.for("react.element"),props:{children:a},type:function(){e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentDispatcher.current.isRsc=!0;return a}}),{},b?b.onError:void 0,b?b.context:void 0,b?b.identifierPrefix:void 0);return new ReadableStream({type:"bytes",start:function(){xa(d)},pull:function(a){if(1===d.status)d.status=2,u(a,d.fatalError);else if(2!==d.status&&null===d.destination){d.destination=a;try{Aa(d,
47
- a)}catch(f){Y(d,f),za(d,f)}}},cancel:function(){}},{highWaterMark:0})};
20
+ fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},fa=["Webkit","ms","Moz","O"];Object.keys(G).forEach(function(a){fa.forEach(function(b){b=b+a.charAt(0).toUpperCase()+a.substring(1);G[b]=G[a]})});var ha=Array.isArray;r("<script>");r("\x3c/script>");r('<script src="');r('<script type="module" src="');r('" integrity="');r('" async="">\x3c/script>');r("\x3c!-- --\x3e");r(' style="');r(":");r(";");r(" ");r('="');r('"');
21
+ r('=""');r(">");r("/>");r(' selected=""');r("\n");r("<!DOCTYPE html>");r("</");r(">");r('<template id="');r('"></template>');r("\x3c!--$--\x3e");r('\x3c!--$?--\x3e<template id="');r('"></template>');r("\x3c!--$!--\x3e");r("\x3c!--/$--\x3e");r("<template");r('"');r(' data-dgst="');r(' data-msg="');r(' data-stck="');r("></template>");r('<div hidden id="');r('">');r("</div>");r('<svg aria-hidden="true" style="display:none" id="');r('">');r("</svg>");r('<math aria-hidden="true" style="display:none" id="');
22
+ r('">');r("</math>");r('<table hidden id="');r('">');r("</table>");r('<table hidden><tbody id="');r('">');r("</tbody></table>");r('<table hidden><tr id="');r('">');r("</tr></table>");r('<table hidden><colgroup id="');r('">');r("</colgroup></table>");r('function $RS(a,b){a=document.getElementById(a);b=document.getElementById(b);for(a.parentNode.removeChild(a);a.firstChild;)b.parentNode.insertBefore(a.firstChild,b);b.parentNode.removeChild(b)};$RS("');r('$RS("');r('","');r('")\x3c/script>');r('function $RC(a,b){a=document.getElementById(a);b=document.getElementById(b);b.parentNode.removeChild(b);if(a){a=a.previousSibling;var f=a.parentNode,c=a.nextSibling,e=0;do{if(c&&8===c.nodeType){var d=c.data;if("/$"===d)if(0===e)break;else e--;else"$"!==d&&"$?"!==d&&"$!"!==d||e++}d=c.nextSibling;f.removeChild(c);c=d}while(c);for(;b.firstChild;)f.insertBefore(b.firstChild,c);a.data="$";a._reactRetry&&a._reactRetry()}};$RC("');
23
+ r('$RC("');r('","');r('")\x3c/script>');r('function $RX(b,c,d,e){var a=document.getElementById(b);a&&(b=a.previousSibling,b.data="$!",a=a.dataset,c&&(a.dgst=c),d&&(a.msg=d),e&&(a.stck=e),b._reactRetry&&b._reactRetry())};$RX("');r('$RX("');r('"');r(")\x3c/script>");r(",");var H=null;
24
+ function I(a,b){if(a!==b){a.context._currentValue=a.parentValue;a=a.parent;var d=b.parent;if(null===a){if(null!==d)throw Error("The stacks must reach the root at the same time. This is a bug in React.");}else{if(null===d)throw Error("The stacks must reach the root at the same time. This is a bug in React.");I(a,d);b.context._currentValue=b.value}}}function ia(a){a.context._currentValue=a.parentValue;a=a.parent;null!==a&&ia(a)}
25
+ function ja(a){var b=a.parent;null!==b&&ja(b);a.context._currentValue=a.value}function ka(a,b){a.context._currentValue=a.parentValue;a=a.parent;if(null===a)throw Error("The depth must equal at least at zero before reaching the root. This is a bug in React.");a.depth===b.depth?I(a,b):ka(a,b)}
26
+ function la(a,b){var d=b.parent;if(null===d)throw Error("The depth must equal at least at zero before reaching the root. This is a bug in React.");a.depth===d.depth?I(a,d):la(a,d);b.context._currentValue=b.value}function J(a){var b=H;b!==a&&(null===b?ja(a):null===a?ia(b):b.depth===a.depth?I(b,a):b.depth>a.depth?ka(b,a):la(b,a),H=a)}function na(a,b){var d=a._currentValue;a._currentValue=b;var c=H;return H=a={parent:c,depth:null===c?0:c.depth+1,context:a,parentValue:d,value:b}}var K=null;
27
+ function oa(a){return a._currentValue}
28
+ var ra={useMemo:function(a){return a()},useCallback:function(a){return a},useDebugValue:function(){},useDeferredValue:L,useTransition:L,getCacheForType:function(a){if(!M)throw Error("Reading the cache is only supported while rendering.");var b=M.get(a);void 0===b&&(b=a(),M.set(a,b));return b},readContext:oa,useContext:oa,useReducer:L,useRef:L,useState:L,useInsertionEffect:L,useLayoutEffect:L,useImperativeHandle:L,useEffect:L,useId:pa,useMutableSource:L,useSyncExternalStore:L,useCacheRefresh:function(){return qa}};
29
+ function L(){throw Error("This Hook is not supported in Server Components.");}function qa(){if(!M)throw Error("Refreshing the cache is not supported in Server Components.");}var M=null;function pa(){if(null===K)throw Error("useId can only be used while React is rendering");var a=K.identifierCount++;return":"+K.identifierPrefix+"S"+a.toString(32)+":"}var sa=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,N=sa.ContextRegistry,O=sa.ReactCurrentDispatcher;function ta(a){console.error(a)}
30
+ function ua(a,b,d,c,f){var g=new Set,h=[],k={status:0,fatalError:null,destination:null,bundlerConfig:b,cache:new Map,nextChunkId:0,pendingChunks:0,abortableTasks:g,pingedTasks:h,completedModuleChunks:[],completedJSONChunks:[],completedErrorChunks:[],writtenSymbols:new Map,writtenModules:new Map,writtenProviders:new Map,identifierPrefix:f||"",identifierCount:1,onError:void 0===d?ta:d,toJSON:function(a,b){return va(k,this,a,b)}};k.pendingChunks++;b=wa(c);a=xa(k,a,b,g);h.push(a);return k}var ya={};
31
+ function P(a,b,d,c){if(null!==d&&void 0!==d)throw Error("Refs cannot be used in server components, nor passed to client components.");if("function"===typeof a)return x(a)?[y,a,b,c]:a(c);if("string"===typeof a)return[y,a,b,c];if("symbol"===typeof a)return a===ca?c.children:[y,a,b,c];if(null!=a&&"object"===typeof a){if(x(a))return[y,a,b,c];switch(a.$$typeof){case A:var f=a._init;a=f(a._payload);return P(a,b,d,c);case da:return b=a.render,b(c,void 0);case ea:return P(a.type,b,d,c);case z:return na(a._context,
32
+ c.value),[y,a,b,{value:c.value,children:c.children,__pop:ya}]}}throw Error("Unsupported server component type: "+R(a));}function xa(a,b,d,c){var f={id:a.nextChunkId++,status:0,model:b,context:d,ping:function(){var b=a.pingedTasks;b.push(f);1===b.length&&za(a)}};c.add(f);return f}function Aa(a){return Object.prototype.toString.call(a).replace(/^\[object (.*)\]$/,function(a,d){return d})}function U(a){var b=JSON.stringify(a);return'"'+a+'"'===b?a:b}
33
+ function R(a){switch(typeof a){case "string":return JSON.stringify(10>=a.length?a:a.substr(0,10)+"...");case "object":if(ha(a))return"[...]";a=Aa(a);return"Object"===a?"{...}":a;case "function":return"function";default:return String(a)}}
34
+ function V(a,b){if(ha(a)){for(var d="[",c=0;c<a.length;c++){0<c&&(d+=", ");if(6<c){d+="...";break}var f=a[c];d=""+c===b&&"object"===typeof f&&null!==f?d+V(f):d+R(f)}return d+"]"}d="{";c=Object.keys(a);for(f=0;f<c.length;f++){0<f&&(d+=", ");if(6<f){d+="...";break}var g=c[f];d+=U(g)+": ";var h=a[g];d=g===b&&"object"===typeof h&&null!==h?d+V(h):d+R(h)}return d+"}"}
35
+ function va(a,b,d,c){switch(c){case y:return"$"}for(;"object"===typeof c&&null!==c&&(c.$$typeof===y||c.$$typeof===A);)try{switch(c.$$typeof){case y:var f=c;c=P(f.type,f.key,f.ref,f.props);break;case A:var g=c._init;c=g(c._payload)}}catch(t){if("object"===typeof t&&null!==t&&"function"===typeof t.then)return a.pendingChunks++,a=xa(a,c,H,a.abortableTasks),d=a.ping,t.then(d,d),"@"+a.id.toString(16);W(a,t);a.pendingChunks++;d=a.nextChunkId++;X(a,d,t);return"@"+d.toString(16)}if(null==c)return c;if("object"===
36
+ typeof c||x(c)){if(x(c)){f=c;"string"===typeof f&&(f=globalThis.__STRING_REFERENCE_INDEX[f]);f=f.filepath+"#"+f.name;g=a.writtenModules;var h=g.get(f);if(void 0!==h)return b[0]===y&&"1"===d?"@"+h.toString(16):"$"+h.toString(16);try{"string"===typeof c&&(c=globalThis.__STRING_REFERENCE_INDEX[c]);var k={id:c.filepath,name:c.name};a.pendingChunks++;var m=a.nextChunkId++,Q=w(k),S="M"+m.toString(16)+":"+Q+"\n";var T=q.encode(S);a.completedModuleChunks.push(T);g.set(f,m);return b[0]===y&&"1"===d?"@"+m.toString(16):
37
+ "$"+m.toString(16)}catch(t){return a.pendingChunks++,d=a.nextChunkId++,X(a,d,t),"$"+d.toString(16)}}else{if(c.$$typeof===z)return b=c._context._globalName,c=a.writtenProviders,d=c.get(d),void 0===d&&(a.pendingChunks++,d=a.nextChunkId++,c.set(b,d),b="P"+d.toString(16)+":"+b+"\n",b=q.encode(b),a.completedJSONChunks.push(b)),"$"+d.toString(16);if(c===ya){a=H;if(null===a)throw Error("Tried to pop a Context at the root of the app. This is a bug in React.");d=a.parentValue;a.context._currentValue=d===B?
38
+ a.context._defaultValue:d;H=a.parent;return}}return c}if("string"===typeof c)return a="$"===c[0]||"@"===c[0]?"$"+c:c,a;if("boolean"===typeof c||"number"===typeof c||"undefined"===typeof c)return c;if("function"===typeof c){if(/^on[A-Z]/.test(d))throw Error("Event handlers cannot be passed to client component props. Remove "+(U(d)+" from these props if possible: "+V(b)+"\nIf you need interactivity, consider converting part of this to a client component."));throw Error("Functions cannot be passed directly to client components because they're not serializable. Remove "+
39
+ (U(d)+" ("+(c.displayName||c.name||"function")+") from this object, or avoid the entire object: "+V(b)));}if("symbol"===typeof c){k=a.writtenSymbols;m=k.get(c);if(void 0!==m)return"$"+m.toString(16);m=c.description;if(Symbol.for(m)!==c)throw Error("Only global symbols received from Symbol.for(...) can be passed to client components. The symbol Symbol.for("+(c.description+") cannot be found among global symbols. Remove ")+(U(d)+" from this object, or avoid the entire object: "+V(b)));a.pendingChunks++;
40
+ d=a.nextChunkId++;b=w(m);b="S"+d.toString(16)+":"+b+"\n";b=q.encode(b);a.completedModuleChunks.push(b);k.set(c,d);return"$"+d.toString(16)}if("bigint"===typeof c)throw Error("BigInt ("+c+") is not yet supported in client component props. Remove "+(U(d)+" from this object or use a plain number instead: "+V(b)));throw Error("Type "+typeof c+" is not supported in client component props. Remove "+(U(d)+" from this object, or avoid the entire object: "+V(b)));}function W(a,b){a=a.onError;a(b)}
41
+ function Y(a,b){null!==a.destination?(a.status=2,u(a.destination,b)):(a.status=1,a.fatalError=b)}function X(a,b,d){var c="";try{if(d instanceof Error){var f=String(d.message);c=String(d.stack)}else f="Error: "+d}catch(g){f="An error occurred but serializing the error message failed."}d={message:f,stack:c};b="E"+b.toString(16)+":"+w(d)+"\n";b=q.encode(b);a.completedErrorChunks.push(b)}
42
+ function za(a){var b=O.current,d=M;O.current=ra;M=a.cache;K=a;try{var c=a.pingedTasks;a.pingedTasks=[];for(var f=0;f<c.length;f++){var g=c[f];var h=a;if(0===g.status){J(g.context);try{for(var k=g.model;"object"===typeof k&&null!==k&&k.$$typeof===y;){var m=k;g.model=k;k=P(m.type,m.key,m.ref,m.props)}var Q=g.id,S=w(k,h.toJSON),T="J"+Q.toString(16)+":"+S+"\n";var t=q.encode(T);h.completedJSONChunks.push(t);h.abortableTasks.delete(g);g.status=1}catch(v){if("object"===typeof v&&null!==v&&"function"===
43
+ typeof v.then){var ma=g.ping;v.then(ma,ma)}else h.abortableTasks.delete(g),g.status=4,W(h,v),X(h,g.id,v)}}}null!==a.destination&&Z(a,a.destination)}catch(v){W(a,v),Y(a,v)}finally{O.current=b,M=d,K=null}}
44
+ function Z(a,b){l=new Uint8Array(512);n=0;try{for(var d=a.completedModuleChunks,c=0;c<d.length;c++)if(a.pendingChunks--,!p(b,d[c])){a.destination=null;c++;break}d.splice(0,c);var f=a.completedJSONChunks;for(c=0;c<f.length;c++)if(a.pendingChunks--,!p(b,f[c])){a.destination=null;c++;break}f.splice(0,c);var g=a.completedErrorChunks;for(c=0;c<g.length;c++)if(a.pendingChunks--,!p(b,g[c])){a.destination=null;c++;break}g.splice(0,c)}finally{l&&0<n&&(b.enqueue(new Uint8Array(l.buffer,0,n)),l=null,n=0)}0===
45
+ a.pendingChunks&&b.close()}function Ba(a,b){try{var d=a.abortableTasks;if(0<d.size){var c=void 0===b?Error("The render was aborted by the server without a reason."):b;W(a,c);a.pendingChunks++;var f=a.nextChunkId++;X(a,f,c);d.forEach(function(b){b.status=3;var c="$"+f.toString(16);b=b.id;c=w(c);c="J"+b.toString(16)+":"+c+"\n";c=q.encode(c);a.completedJSONChunks.push(c)});d.clear()}null!==a.destination&&Z(a,a.destination)}catch(g){W(a,g),Y(a,g)}}
46
+ function wa(a){if(a){var b=H;J(null);for(var d=0;d<a.length;d++){var c=a[d],f=c[0];c=c[1];N[f]||(N[f]=e.createServerContext(f,B));na(N[f],c)}a=H;J(b);return a}return null}
47
+ exports.renderToReadableStream=function(a,b){var d=ua(aa({},a,{$$typeof:Symbol.for("react.element"),props:{children:a},type:function(){e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentDispatcher.current.isRsc=!0;return a}}),{},b?b.onError:void 0,b?b.context:void 0,b?b.identifierPrefix:void 0);if(b&&b.signal){var c=b.signal;if(c.aborted)Ba(d,c.reason);else{var f=function(){Ba(d,c.reason);c.removeEventListener("abort",f)};c.addEventListener("abort",f)}}return new ReadableStream({type:"bytes",
48
+ start:function(){za(d)},pull:function(a){if(1===d.status)d.status=2,u(a,d.fatalError);else if(2!==d.status&&null===d.destination){d.destination=a;try{Z(d,a)}catch(h){W(d,h),Y(d,h)}}},cancel:function(){}},{highWaterMark:0})};
@@ -234,6 +234,11 @@ function processModelChunk(request, id, model) {
234
234
  var row = serializeRowHeader('J', id) + json + '\n';
235
235
  return stringToChunk(row);
236
236
  }
237
+ function processReferenceChunk(request, id, reference) {
238
+ var json = stringify(reference);
239
+ var row = serializeRowHeader('J', id) + json + '\n';
240
+ return stringToChunk(row);
241
+ }
237
242
  function processModuleChunk(request, id, moduleMetaData) {
238
243
  var json = stringify(moduleMetaData);
239
244
  var row = serializeRowHeader('M', id) + json + '\n';
@@ -576,6 +581,7 @@ var startInlineScript = stringToPrecomputedChunk('<script>');
576
581
  var endInlineScript = stringToPrecomputedChunk('</script>');
577
582
  var startScriptSrc = stringToPrecomputedChunk('<script src="');
578
583
  var startModuleSrc = stringToPrecomputedChunk('<script type="module" src="');
584
+ var scriptIntegirty = stringToPrecomputedChunk('" integrity="');
579
585
  var endAsyncScript = stringToPrecomputedChunk('" async=""></script>');
580
586
 
581
587
  var textSeparator = stringToPrecomputedChunk('<!-- -->');
@@ -1053,6 +1059,10 @@ function getOrCreateServerContext(globalName) {
1053
1059
  return ContextRegistry[globalName];
1054
1060
  }
1055
1061
 
1062
+ var PENDING = 0;
1063
+ var COMPLETED = 1;
1064
+ var ABORTED = 3;
1065
+ var ERRORED = 4;
1056
1066
  var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher;
1057
1067
 
1058
1068
  function defaultErrorHandler(error) {
@@ -1063,7 +1073,8 @@ var OPEN = 0;
1063
1073
  var CLOSING = 1;
1064
1074
  var CLOSED = 2;
1065
1075
  function createRequest(model, bundlerConfig, onError, context, identifierPrefix) {
1066
- var pingedSegments = [];
1076
+ var abortSet = new Set();
1077
+ var pingedTasks = [];
1067
1078
  var request = {
1068
1079
  status: OPEN,
1069
1080
  fatalError: null,
@@ -1072,7 +1083,8 @@ function createRequest(model, bundlerConfig, onError, context, identifierPrefix)
1072
1083
  cache: new Map(),
1073
1084
  nextChunkId: 0,
1074
1085
  pendingChunks: 0,
1075
- pingedSegments: pingedSegments,
1086
+ abortableTasks: abortSet,
1087
+ pingedTasks: pingedTasks,
1076
1088
  completedModuleChunks: [],
1077
1089
  completedJSONChunks: [],
1078
1090
  completedErrorChunks: [],
@@ -1088,8 +1100,8 @@ function createRequest(model, bundlerConfig, onError, context, identifierPrefix)
1088
1100
  };
1089
1101
  request.pendingChunks++;
1090
1102
  var rootContext = createRootContext(context);
1091
- var rootSegment = createSegment(request, model, rootContext);
1092
- pingedSegments.push(rootSegment);
1103
+ var rootTask = createTask(request, model, rootContext, abortSet);
1104
+ pingedTasks.push(rootTask);
1093
1105
  return request;
1094
1106
  }
1095
1107
 
@@ -1187,28 +1199,30 @@ function attemptResolveElement(type, key, ref, props) {
1187
1199
  throw new Error("Unsupported server component type: " + describeValueForErrorMessage(type));
1188
1200
  }
1189
1201
 
1190
- function pingSegment(request, segment) {
1191
- var pingedSegments = request.pingedSegments;
1192
- pingedSegments.push(segment);
1202
+ function pingTask(request, task) {
1203
+ var pingedTasks = request.pingedTasks;
1204
+ pingedTasks.push(task);
1193
1205
 
1194
- if (pingedSegments.length === 1) {
1206
+ if (pingedTasks.length === 1) {
1195
1207
  scheduleWork(function () {
1196
1208
  return performWork(request);
1197
1209
  });
1198
1210
  }
1199
1211
  }
1200
1212
 
1201
- function createSegment(request, model, context) {
1213
+ function createTask(request, model, context, abortSet) {
1202
1214
  var id = request.nextChunkId++;
1203
- var segment = {
1215
+ var task = {
1204
1216
  id: id,
1217
+ status: PENDING,
1205
1218
  model: model,
1206
1219
  context: context,
1207
1220
  ping: function () {
1208
- return pingSegment(request, segment);
1221
+ return pingTask(request, task);
1209
1222
  }
1210
1223
  };
1211
- return segment;
1224
+ abortSet.add(task);
1225
+ return task;
1212
1226
  }
1213
1227
 
1214
1228
  function serializeByValueID(id) {
@@ -1443,12 +1457,12 @@ function resolveModelToJSON(request, parent, key, value) {
1443
1457
  }
1444
1458
  } catch (x) {
1445
1459
  if (typeof x === 'object' && x !== null && typeof x.then === 'function') {
1446
- // Something suspended, we'll need to create a new segment and resolve it later.
1460
+ // Something suspended, we'll need to create a new task and resolve it later.
1447
1461
  request.pendingChunks++;
1448
- var newSegment = createSegment(request, value, getActiveContext());
1449
- var ping = newSegment.ping;
1462
+ var newTask = createTask(request, value, getActiveContext(), request.abortableTasks);
1463
+ var ping = newTask.ping;
1450
1464
  x.then(ping, ping);
1451
- return serializeByRefID(newSegment.id);
1465
+ return serializeByRefID(newTask.id);
1452
1466
  } else {
1453
1467
  logRecoverableError(request, x); // Something errored. We'll still send everything we have up until this point.
1454
1468
  // We'll replace this element with a lazy reference that throws on the client
@@ -1656,34 +1670,43 @@ function emitProviderChunk(request, id, contextName) {
1656
1670
  request.completedJSONChunks.push(processedChunk);
1657
1671
  }
1658
1672
 
1659
- function retrySegment(request, segment) {
1660
- switchContext(segment.context);
1673
+ function retryTask(request, task) {
1674
+ if (task.status !== PENDING) {
1675
+ // We completed this by other means before we had a chance to retry it.
1676
+ return;
1677
+ }
1678
+
1679
+ switchContext(task.context);
1661
1680
 
1662
1681
  try {
1663
- var _value3 = segment.model;
1682
+ var _value3 = task.model;
1664
1683
 
1665
1684
  while (typeof _value3 === 'object' && _value3 !== null && _value3.$$typeof === REACT_ELEMENT_TYPE) {
1666
1685
  // TODO: Concatenate keys of parents onto children.
1667
1686
  var element = _value3; // Attempt to render the server component.
1668
- // Doing this here lets us reuse this same segment if the next component
1687
+ // Doing this here lets us reuse this same task if the next component
1669
1688
  // also suspends.
1670
1689
 
1671
- segment.model = _value3;
1690
+ task.model = _value3;
1672
1691
  _value3 = attemptResolveElement(element.type, element.key, element.ref, element.props);
1673
1692
  }
1674
1693
 
1675
- var processedChunk = processModelChunk(request, segment.id, _value3);
1694
+ var processedChunk = processModelChunk(request, task.id, _value3);
1676
1695
  request.completedJSONChunks.push(processedChunk);
1696
+ request.abortableTasks.delete(task);
1697
+ task.status = COMPLETED;
1677
1698
  } catch (x) {
1678
1699
  if (typeof x === 'object' && x !== null && typeof x.then === 'function') {
1679
1700
  // Something suspended again, let's pick it back up later.
1680
- var ping = segment.ping;
1701
+ var ping = task.ping;
1681
1702
  x.then(ping, ping);
1682
1703
  return;
1683
1704
  } else {
1705
+ request.abortableTasks.delete(task);
1706
+ task.status = ERRORED;
1684
1707
  logRecoverableError(request, x); // This errored, we need to serialize this error to the
1685
1708
 
1686
- emitErrorChunk(request, segment.id, x);
1709
+ emitErrorChunk(request, task.id, x);
1687
1710
  }
1688
1711
  }
1689
1712
  }
@@ -1696,12 +1719,12 @@ function performWork(request) {
1696
1719
  prepareToUseHooksForRequest(request);
1697
1720
 
1698
1721
  try {
1699
- var pingedSegments = request.pingedSegments;
1700
- request.pingedSegments = [];
1722
+ var pingedTasks = request.pingedTasks;
1723
+ request.pingedTasks = [];
1701
1724
 
1702
- for (var i = 0; i < pingedSegments.length; i++) {
1703
- var segment = pingedSegments[i];
1704
- retrySegment(request, segment);
1725
+ for (var i = 0; i < pingedTasks.length; i++) {
1726
+ var task = pingedTasks[i];
1727
+ retryTask(request, task);
1705
1728
  }
1706
1729
 
1707
1730
  if (request.destination !== null) {
@@ -1717,6 +1740,15 @@ function performWork(request) {
1717
1740
  }
1718
1741
  }
1719
1742
 
1743
+ function abortTask(task, request, errorId) {
1744
+ task.status = ABORTED; // Instead of emitting an error per task.id, we emit a model that only
1745
+ // has a single value referencing the error.
1746
+
1747
+ var ref = serializeByValueID(errorId);
1748
+ var processedChunk = processReferenceChunk(request, task.id, ref);
1749
+ request.completedJSONChunks.push(processedChunk);
1750
+ }
1751
+
1720
1752
  function flushCompletedChunks(request, destination) {
1721
1753
  beginWriting();
1722
1754
 
@@ -1818,6 +1850,34 @@ function startFlowing(request, destination) {
1818
1850
  logRecoverableError(request, error);
1819
1851
  fatalError(request, error);
1820
1852
  }
1853
+ } // This is called to early terminate a request. It creates an error at all pending tasks.
1854
+
1855
+ function abort(request, reason) {
1856
+ try {
1857
+ var abortableTasks = request.abortableTasks;
1858
+
1859
+ if (abortableTasks.size > 0) {
1860
+ // We have tasks to abort. We'll emit one error row and then emit a reference
1861
+ // to that row from every row that's still remaining.
1862
+ var _error = reason === undefined ? new Error('The render was aborted by the server without a reason.') : reason;
1863
+
1864
+ logRecoverableError(request, _error);
1865
+ request.pendingChunks++;
1866
+ var errorId = request.nextChunkId++;
1867
+ emitErrorChunk(request, errorId, _error);
1868
+ abortableTasks.forEach(function (task) {
1869
+ return abortTask(task, request, errorId);
1870
+ });
1871
+ abortableTasks.clear();
1872
+ }
1873
+
1874
+ if (request.destination !== null) {
1875
+ flushCompletedChunks(request, request.destination);
1876
+ }
1877
+ } catch (error) {
1878
+ logRecoverableError(request, error);
1879
+ fatalError(request, error);
1880
+ }
1821
1881
  }
1822
1882
 
1823
1883
  function importServerContexts(contexts) {
@@ -1873,6 +1933,9 @@ function renderToPipeableStream(model, options) {
1873
1933
  startFlowing(request, destination);
1874
1934
  destination.on('drain', createDrainHandler(destination, request));
1875
1935
  return destination;
1936
+ },
1937
+ abort: function (reason) {
1938
+ abort(request, reason);
1876
1939
  }
1877
1940
  };
1878
1941
  }
@@ -7,9 +7,9 @@
7
7
  * This source code is licensed under the MIT license found in the
8
8
  * LICENSE file in the root directory of this source tree.
9
9
  */
10
- 'use strict';var e=require("react"),aa=require("util"),ba=Object.assign,h=null,k=0,m=!0;function q(a,b){a=a.write(b);m=m&&a}
10
+ 'use strict';var e=require("react"),aa=require("util"),ba=Object.assign,h=null,k=0,n=!0;function q(a,b){a=a.write(b);n=n&&a}
11
11
  function r(a,b){if("string"===typeof b){if(0!==b.length)if(2048<3*b.length)0<k&&(q(a,h.subarray(0,k)),h=new Uint8Array(2048),k=0),q(a,u.encode(b));else{var d=h;0<k&&(d=h.subarray(k));d=u.encodeInto(b,d);var c=d.read;k+=d.written;c<b.length&&(q(a,h),h=new Uint8Array(2048),k=u.encodeInto(b.slice(c),h).written);2048===k&&(q(a,h),h=new Uint8Array(2048),k=0)}}else 0!==b.byteLength&&(2048<b.byteLength?(0<k&&(q(a,h.subarray(0,k)),h=new Uint8Array(2048),k=0),q(a,b)):(d=h.length-k,d<b.byteLength&&(0===d?q(a,
12
- h):(h.set(b.subarray(0,d),k),k+=d,q(a,h),b=b.subarray(d)),h=new Uint8Array(2048),k=0),h.set(b,k),k+=b.byteLength,2048===k&&(q(a,h),h=new Uint8Array(2048),k=0)));return m}var u=new aa.TextEncoder;function v(a){return u.encode(a)}var x=JSON.stringify,ca=Symbol.for("react.module.reference");function y(a){return"string"===typeof a?!!globalThis.__STRING_REFERENCE_INDEX[a]:a.$$typeof===ca}
12
+ h):(h.set(b.subarray(0,d),k),k+=d,q(a,h),b=b.subarray(d)),h=new Uint8Array(2048),k=0),h.set(b,k),k+=b.byteLength,2048===k&&(q(a,h),h=new Uint8Array(2048),k=0)));return n}var u=new aa.TextEncoder;function v(a){return u.encode(a)}var x=JSON.stringify,ca=Symbol.for("react.module.reference");function y(a){return"string"===typeof a?!!globalThis.__STRING_REFERENCE_INDEX[a]:a.$$typeof===ca}
13
13
  var z=Symbol.for("react.element"),da=Symbol.for("react.fragment"),A=Symbol.for("react.provider"),ea=Symbol.for("react.forward_ref"),fa=Symbol.for("react.memo"),B=Symbol.for("react.lazy"),C=Symbol.for("react.default_value");function D(a,b,d,c,f,g,l){this.acceptsBooleans=2===b||3===b||4===b;this.attributeName=c;this.attributeNamespace=f;this.mustUseProperty=d;this.propertyName=a;this.type=b;this.sanitizeURL=g;this.removeEmptyString=l}var E="children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ");
14
14
  E.push("innerText","textContent");E.forEach(function(a){new D(a,0,!1,a,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(a){new D(a[0],1,!1,a[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(a){new D(a,2,!1,a.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(a){new D(a,2,!1,a,null,!1,!1)});
15
15
  "allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(a){new D(a,3,!1,a.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(a){new D(a,3,!0,a,null,!1,!1)});["capture","download"].forEach(function(a){new D(a,4,!1,a,null,!1,!1)});
@@ -18,30 +18,32 @@ E.push("innerText","textContent");E.forEach(function(a){new D(a,0,!1,a,null,!1,!
18
18
  G);new D(b,1,!1,a,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(a){var b=a.replace(F,G);new D(b,1,!1,a,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(a){var b=a.replace(F,G);new D(b,1,!1,a,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(a){new D(a,1,!1,a.toLowerCase(),null,!1,!1)});
19
19
  new D("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(a){new D(a,1,!1,a.toLowerCase(),null,!0,!0)});
20
20
  var H={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,
21
- fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},ha=["Webkit","ms","Moz","O"];Object.keys(H).forEach(function(a){ha.forEach(function(b){b=b+a.charAt(0).toUpperCase()+a.substring(1);H[b]=H[a]})});var I=Array.isArray;v("<script>");v("\x3c/script>");v('<script src="');v('<script type="module" src="');v('" async="">\x3c/script>');v("\x3c!-- --\x3e");v(' style="');v(":");v(";");v(" ");v('="');v('"');v('=""');v(">");
22
- v("/>");v(' selected=""');v("\n");v("<!DOCTYPE html>");v("</");v(">");v('<template id="');v('"></template>');v("\x3c!--$--\x3e");v('\x3c!--$?--\x3e<template id="');v('"></template>');v("\x3c!--$!--\x3e");v("\x3c!--/$--\x3e");v("<template");v('"');v(' data-dgst="');v(' data-msg="');v(' data-stck="');v("></template>");v('<div hidden id="');v('">');v("</div>");v('<svg aria-hidden="true" style="display:none" id="');v('">');v("</svg>");v('<math aria-hidden="true" style="display:none" id="');v('">');v("</math>");
23
- v('<table hidden id="');v('">');v("</table>");v('<table hidden><tbody id="');v('">');v("</tbody></table>");v('<table hidden><tr id="');v('">');v("</tr></table>");v('<table hidden><colgroup id="');v('">');v("</colgroup></table>");v('function $RS(a,b){a=document.getElementById(a);b=document.getElementById(b);for(a.parentNode.removeChild(a);a.firstChild;)b.parentNode.insertBefore(a.firstChild,b);b.parentNode.removeChild(b)};$RS("');v('$RS("');v('","');v('")\x3c/script>');v('function $RC(a,b){a=document.getElementById(a);b=document.getElementById(b);b.parentNode.removeChild(b);if(a){a=a.previousSibling;var f=a.parentNode,c=a.nextSibling,e=0;do{if(c&&8===c.nodeType){var d=c.data;if("/$"===d)if(0===e)break;else e--;else"$"!==d&&"$?"!==d&&"$!"!==d||e++}d=c.nextSibling;f.removeChild(c);c=d}while(c);for(;b.firstChild;)f.insertBefore(b.firstChild,c);a.data="$";a._reactRetry&&a._reactRetry()}};$RC("');
24
- v('$RC("');v('","');v('")\x3c/script>');v('function $RX(b,c,d,e){var a=document.getElementById(b);a&&(b=a.previousSibling,b.data="$!",a=a.dataset,c&&(a.dgst=c),d&&(a.msg=d),e&&(a.stck=e),b._reactRetry&&b._reactRetry())};$RX("');v('$RX("');v('"');v(")\x3c/script>");v(",");var J=null;
25
- function K(a,b){if(a!==b){a.context._currentValue=a.parentValue;a=a.parent;var d=b.parent;if(null===a){if(null!==d)throw Error("The stacks must reach the root at the same time. This is a bug in React.");}else{if(null===d)throw Error("The stacks must reach the root at the same time. This is a bug in React.");K(a,d);b.context._currentValue=b.value}}}function L(a){a.context._currentValue=a.parentValue;a=a.parent;null!==a&&L(a)}
26
- function ia(a){var b=a.parent;null!==b&&ia(b);a.context._currentValue=a.value}function ja(a,b){a.context._currentValue=a.parentValue;a=a.parent;if(null===a)throw Error("The depth must equal at least at zero before reaching the root. This is a bug in React.");a.depth===b.depth?K(a,b):ja(a,b)}
27
- function ka(a,b){var d=b.parent;if(null===d)throw Error("The depth must equal at least at zero before reaching the root. This is a bug in React.");a.depth===d.depth?K(a,d):ka(a,d);b.context._currentValue=b.value}function M(a){var b=J;b!==a&&(null===b?ia(a):null===a?L(b):b.depth===a.depth?K(b,a):b.depth>a.depth?ja(b,a):ka(b,a),J=a)}function ma(a,b){var d=a._currentValue;a._currentValue=b;var c=J;return J=a={parent:c,depth:null===c?0:c.depth+1,context:a,parentValue:d,value:b}}var N=null;
28
- function na(a){return a._currentValue}
29
- var qa={useMemo:function(a){return a()},useCallback:function(a){return a},useDebugValue:function(){},useDeferredValue:O,useTransition:O,getCacheForType:function(a){if(!P)throw Error("Reading the cache is only supported while rendering.");var b=P.get(a);void 0===b&&(b=a(),P.set(a,b));return b},readContext:na,useContext:na,useReducer:O,useRef:O,useState:O,useInsertionEffect:O,useLayoutEffect:O,useImperativeHandle:O,useEffect:O,useId:oa,useMutableSource:O,useSyncExternalStore:O,useCacheRefresh:function(){return pa}};
30
- function O(){throw Error("This Hook is not supported in Server Components.");}function pa(){if(!P)throw Error("Refreshing the cache is not supported in Server Components.");}var P=null;function oa(){if(null===N)throw Error("useId can only be used while React is rendering");var a=N.identifierCount++;return":"+N.identifierPrefix+"S"+a.toString(32)+":"}var ra=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Q=ra.ContextRegistry,R=ra.ReactCurrentDispatcher;function sa(a){console.error(a)}
31
- function ta(a,b,d,c,f){var g=[],l={status:0,fatalError:null,destination:null,bundlerConfig:b,cache:new Map,nextChunkId:0,pendingChunks:0,pingedSegments:g,completedModuleChunks:[],completedJSONChunks:[],completedErrorChunks:[],writtenSymbols:new Map,writtenModules:new Map,writtenProviders:new Map,identifierPrefix:f||"",identifierCount:1,onError:void 0===d?sa:d,toJSON:function(a,b){return ua(l,this,a,b)}};l.pendingChunks++;b=va(c);a=wa(l,a,b);g.push(a);return l}var xa={};
32
- function S(a,b,d,c){if(null!==d&&void 0!==d)throw Error("Refs cannot be used in server components, nor passed to client components.");if("function"===typeof a)return y(a)?[z,a,b,c]:a(c);if("string"===typeof a)return[z,a,b,c];if("symbol"===typeof a)return a===da?c.children:[z,a,b,c];if(null!=a&&"object"===typeof a){if(y(a))return[z,a,b,c];switch(a.$$typeof){case B:var f=a._init;a=f(a._payload);return S(a,b,d,c);case ea:return b=a.render,b(c,void 0);case fa:return S(a.type,b,d,c);case A:return ma(a._context,
33
- c.value),[z,a,b,{value:c.value,children:c.children,__pop:xa}]}}throw Error("Unsupported server component type: "+V(a));}function ya(a,b){var d=a.pingedSegments;d.push(b);1===d.length&&setImmediate(function(){return za(a)})}function wa(a,b,d){var c={id:a.nextChunkId++,model:b,context:d,ping:function(){return ya(a,c)}};return c}function Aa(a){return Object.prototype.toString.call(a).replace(/^\[object (.*)\]$/,function(a,d){return d})}function W(a){var b=JSON.stringify(a);return'"'+a+'"'===b?a:b}
34
- function V(a){switch(typeof a){case "string":return JSON.stringify(10>=a.length?a:a.substr(0,10)+"...");case "object":if(I(a))return"[...]";a=Aa(a);return"Object"===a?"{...}":a;case "function":return"function";default:return String(a)}}
35
- function X(a,b){if(I(a)){for(var d="[",c=0;c<a.length;c++){0<c&&(d+=", ");if(6<c){d+="...";break}var f=a[c];d=""+c===b&&"object"===typeof f&&null!==f?d+X(f):d+V(f)}return d+"]"}d="{";c=Object.keys(a);for(f=0;f<c.length;f++){0<f&&(d+=", ");if(6<f){d+="...";break}var g=c[f];d+=W(g)+": ";var l=a[g];d=g===b&&"object"===typeof l&&null!==l?d+X(l):d+V(l)}return d+"}"}
36
- function ua(a,b,d,c){switch(c){case z:return"$"}for(;"object"===typeof c&&null!==c&&(c.$$typeof===z||c.$$typeof===B);)try{switch(c.$$typeof){case z:var f=c;c=S(f.type,f.key,f.ref,f.props);break;case B:var g=c._init;c=g(c._payload)}}catch(t){if("object"===typeof t&&null!==t&&"function"===typeof t.then)return a.pendingChunks++,a=wa(a,c,J),d=a.ping,t.then(d,d),"@"+a.id.toString(16);Y(a,t);a.pendingChunks++;d=a.nextChunkId++;Z(a,d,t);return"@"+d.toString(16)}if(null==c)return c;if("object"===typeof c||
37
- y(c)){if(y(c)){f=c;"string"===typeof f&&(f=globalThis.__STRING_REFERENCE_INDEX[f]);f=f.filepath+"#"+f.name;g=a.writtenModules;var l=g.get(f);if(void 0!==l)return b[0]===z&&"1"===d?"@"+l.toString(16):"$"+l.toString(16);try{"string"===typeof c&&(c=globalThis.__STRING_REFERENCE_INDEX[c]);var p={id:c.filepath,name:c.name};a.pendingChunks++;var n=a.nextChunkId++,T=x(p);var U="M"+n.toString(16)+":"+T+"\n";a.completedModuleChunks.push(U);g.set(f,n);return b[0]===z&&"1"===d?"@"+n.toString(16):"$"+n.toString(16)}catch(t){return a.pendingChunks++,
38
- d=a.nextChunkId++,Z(a,d,t),"$"+d.toString(16)}}else{if(c.$$typeof===A)return b=c._context._globalName,c=a.writtenProviders,d=c.get(d),void 0===d&&(a.pendingChunks++,d=a.nextChunkId++,c.set(b,d),b="P"+d.toString(16)+":"+b+"\n",a.completedJSONChunks.push(b)),"$"+d.toString(16);if(c===xa){a=J;if(null===a)throw Error("Tried to pop a Context at the root of the app. This is a bug in React.");d=a.parentValue;a.context._currentValue=d===C?a.context._defaultValue:d;J=a.parent;return}}return c}if("string"===
39
- typeof c)return a="$"===c[0]||"@"===c[0]?"$"+c:c,a;if("boolean"===typeof c||"number"===typeof c||"undefined"===typeof c)return c;if("function"===typeof c){if(/^on[A-Z]/.test(d))throw Error("Event handlers cannot be passed to client component props. Remove "+(W(d)+" from these props if possible: "+X(b)+"\nIf you need interactivity, consider converting part of this to a client component."));throw Error("Functions cannot be passed directly to client components because they're not serializable. Remove "+
40
- (W(d)+" ("+(c.displayName||c.name||"function")+") from this object, or avoid the entire object: "+X(b)));}if("symbol"===typeof c){p=a.writtenSymbols;n=p.get(c);if(void 0!==n)return"$"+n.toString(16);n=c.description;if(Symbol.for(n)!==c)throw Error("Only global symbols received from Symbol.for(...) can be passed to client components. The symbol Symbol.for("+(c.description+") cannot be found among global symbols. Remove ")+(W(d)+" from this object, or avoid the entire object: "+X(b)));a.pendingChunks++;
41
- d=a.nextChunkId++;b=x(n);b="S"+d.toString(16)+":"+b+"\n";a.completedModuleChunks.push(b);p.set(c,d);return"$"+d.toString(16)}if("bigint"===typeof c)throw Error("BigInt ("+c+") is not yet supported in client component props. Remove "+(W(d)+" from this object or use a plain number instead: "+X(b)));throw Error("Type "+typeof c+" is not supported in client component props. Remove "+(W(d)+" from this object, or avoid the entire object: "+X(b)));}function Y(a,b){a=a.onError;a(b)}
42
- function Ba(a,b){null!==a.destination?(a.status=2,a.destination.destroy(b)):(a.status=1,a.fatalError=b)}function Z(a,b,d){var c="";try{if(d instanceof Error){var f=String(d.message);c=String(d.stack)}else f="Error: "+d}catch(g){f="An error occurred but serializing the error message failed."}d={message:f,stack:c};b="E"+b.toString(16)+":"+x(d)+"\n";a.completedErrorChunks.push(b)}
43
- function za(a){var b=R.current,d=P;R.current=qa;P=a.cache;N=a;try{var c=a.pingedSegments;a.pingedSegments=[];for(var f=0;f<c.length;f++){var g=c[f];var l=a;M(g.context);try{for(var p=g.model;"object"===typeof p&&null!==p&&p.$$typeof===z;){var n=p;g.model=p;p=S(n.type,n.key,n.ref,n.props)}var T=g.id,U=x(p,l.toJSON);var t="J"+T.toString(16)+":"+U+"\n";l.completedJSONChunks.push(t)}catch(w){if("object"===typeof w&&null!==w&&"function"===typeof w.then){var la=g.ping;w.then(la,la)}else Y(l,w),Z(l,g.id,
44
- w)}}null!==a.destination&&Ca(a,a.destination)}catch(w){Y(a,w),Ba(a,w)}finally{R.current=b,P=d,N=null}}
45
- function Ca(a,b){h=new Uint8Array(2048);k=0;m=!0;try{for(var d=a.completedModuleChunks,c=0;c<d.length;c++)if(a.pendingChunks--,!r(b,d[c])){a.destination=null;c++;break}d.splice(0,c);var f=a.completedJSONChunks;for(c=0;c<f.length;c++)if(a.pendingChunks--,!r(b,f[c])){a.destination=null;c++;break}f.splice(0,c);var g=a.completedErrorChunks;for(c=0;c<g.length;c++)if(a.pendingChunks--,!r(b,g[c])){a.destination=null;c++;break}g.splice(0,c)}finally{h&&0<k&&b.write(h.subarray(0,k)),h=null,k=0,m=!0}"function"===
46
- typeof b.flush&&b.flush();0===a.pendingChunks&&b.end()}function Da(a){setImmediate(function(){return za(a)})}function Ea(a,b){if(1===a.status)a.status=2,b.destroy(a.fatalError);else if(2!==a.status&&null===a.destination){a.destination=b;try{Ca(a,b)}catch(d){Y(a,d),Ba(a,d)}}}function va(a){if(a){var b=J;M(null);for(var d=0;d<a.length;d++){var c=a[d],f=c[0];c=c[1];Q[f]||(Q[f]=e.createServerContext(f,C));ma(Q[f],c)}a=J;M(b);return a}return null}function Fa(a,b){return function(){return Ea(b,a)}}
47
- exports.renderToPipeableStream=function(a,b){var d=ta(ba({},a,{$$typeof:Symbol.for("react.element"),props:{children:a},type:function(){e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentDispatcher.current.isRsc=!0;return a}}),{},b?b.onError:void 0,b?b.context:void 0,b?b.identifierPrefix:void 0),c=!1;Da(d);return{pipe:function(a){if(c)throw Error("React currently only supports piping to one writable stream.");c=!0;Ea(d,a);a.on("drain",Fa(a,d));return a}}};
21
+ fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},ha=["Webkit","ms","Moz","O"];Object.keys(H).forEach(function(a){ha.forEach(function(b){b=b+a.charAt(0).toUpperCase()+a.substring(1);H[b]=H[a]})});var ia=Array.isArray;v("<script>");v("\x3c/script>");v('<script src="');v('<script type="module" src="');v('" integrity="');v('" async="">\x3c/script>');v("\x3c!-- --\x3e");v(' style="');v(":");v(";");v(" ");v('="');v('"');
22
+ v('=""');v(">");v("/>");v(' selected=""');v("\n");v("<!DOCTYPE html>");v("</");v(">");v('<template id="');v('"></template>');v("\x3c!--$--\x3e");v('\x3c!--$?--\x3e<template id="');v('"></template>');v("\x3c!--$!--\x3e");v("\x3c!--/$--\x3e");v("<template");v('"');v(' data-dgst="');v(' data-msg="');v(' data-stck="');v("></template>");v('<div hidden id="');v('">');v("</div>");v('<svg aria-hidden="true" style="display:none" id="');v('">');v("</svg>");v('<math aria-hidden="true" style="display:none" id="');
23
+ v('">');v("</math>");v('<table hidden id="');v('">');v("</table>");v('<table hidden><tbody id="');v('">');v("</tbody></table>");v('<table hidden><tr id="');v('">');v("</tr></table>");v('<table hidden><colgroup id="');v('">');v("</colgroup></table>");v('function $RS(a,b){a=document.getElementById(a);b=document.getElementById(b);for(a.parentNode.removeChild(a);a.firstChild;)b.parentNode.insertBefore(a.firstChild,b);b.parentNode.removeChild(b)};$RS("');v('$RS("');v('","');v('")\x3c/script>');v('function $RC(a,b){a=document.getElementById(a);b=document.getElementById(b);b.parentNode.removeChild(b);if(a){a=a.previousSibling;var f=a.parentNode,c=a.nextSibling,e=0;do{if(c&&8===c.nodeType){var d=c.data;if("/$"===d)if(0===e)break;else e--;else"$"!==d&&"$?"!==d&&"$!"!==d||e++}d=c.nextSibling;f.removeChild(c);c=d}while(c);for(;b.firstChild;)f.insertBefore(b.firstChild,c);a.data="$";a._reactRetry&&a._reactRetry()}};$RC("');
24
+ v('$RC("');v('","');v('")\x3c/script>');v('function $RX(b,c,d,e){var a=document.getElementById(b);a&&(b=a.previousSibling,b.data="$!",a=a.dataset,c&&(a.dgst=c),d&&(a.msg=d),e&&(a.stck=e),b._reactRetry&&b._reactRetry())};$RX("');v('$RX("');v('"');v(")\x3c/script>");v(",");var I=null;
25
+ function J(a,b){if(a!==b){a.context._currentValue=a.parentValue;a=a.parent;var d=b.parent;if(null===a){if(null!==d)throw Error("The stacks must reach the root at the same time. This is a bug in React.");}else{if(null===d)throw Error("The stacks must reach the root at the same time. This is a bug in React.");J(a,d);b.context._currentValue=b.value}}}function ja(a){a.context._currentValue=a.parentValue;a=a.parent;null!==a&&ja(a)}
26
+ function ka(a){var b=a.parent;null!==b&&ka(b);a.context._currentValue=a.value}function la(a,b){a.context._currentValue=a.parentValue;a=a.parent;if(null===a)throw Error("The depth must equal at least at zero before reaching the root. This is a bug in React.");a.depth===b.depth?J(a,b):la(a,b)}
27
+ function na(a,b){var d=b.parent;if(null===d)throw Error("The depth must equal at least at zero before reaching the root. This is a bug in React.");a.depth===d.depth?J(a,d):na(a,d);b.context._currentValue=b.value}function K(a){var b=I;b!==a&&(null===b?ka(a):null===a?ja(b):b.depth===a.depth?J(b,a):b.depth>a.depth?la(b,a):na(b,a),I=a)}function oa(a,b){var d=a._currentValue;a._currentValue=b;var c=I;return I=a={parent:c,depth:null===c?0:c.depth+1,context:a,parentValue:d,value:b}}var L=null;
28
+ function pa(a){return a._currentValue}
29
+ var sa={useMemo:function(a){return a()},useCallback:function(a){return a},useDebugValue:function(){},useDeferredValue:M,useTransition:M,getCacheForType:function(a){if(!N)throw Error("Reading the cache is only supported while rendering.");var b=N.get(a);void 0===b&&(b=a(),N.set(a,b));return b},readContext:pa,useContext:pa,useReducer:M,useRef:M,useState:M,useInsertionEffect:M,useLayoutEffect:M,useImperativeHandle:M,useEffect:M,useId:qa,useMutableSource:M,useSyncExternalStore:M,useCacheRefresh:function(){return ra}};
30
+ function M(){throw Error("This Hook is not supported in Server Components.");}function ra(){if(!N)throw Error("Refreshing the cache is not supported in Server Components.");}var N=null;function qa(){if(null===L)throw Error("useId can only be used while React is rendering");var a=L.identifierCount++;return":"+L.identifierPrefix+"S"+a.toString(32)+":"}var ta=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,O=ta.ContextRegistry,P=ta.ReactCurrentDispatcher;function ua(a){console.error(a)}
31
+ function va(a,b,d,c,f){var g=new Set,l=[],m={status:0,fatalError:null,destination:null,bundlerConfig:b,cache:new Map,nextChunkId:0,pendingChunks:0,abortableTasks:g,pingedTasks:l,completedModuleChunks:[],completedJSONChunks:[],completedErrorChunks:[],writtenSymbols:new Map,writtenModules:new Map,writtenProviders:new Map,identifierPrefix:f||"",identifierCount:1,onError:void 0===d?ua:d,toJSON:function(a,b){return wa(m,this,a,b)}};m.pendingChunks++;b=xa(c);a=ya(m,a,b,g);l.push(a);return m}var za={};
32
+ function Q(a,b,d,c){if(null!==d&&void 0!==d)throw Error("Refs cannot be used in server components, nor passed to client components.");if("function"===typeof a)return y(a)?[z,a,b,c]:a(c);if("string"===typeof a)return[z,a,b,c];if("symbol"===typeof a)return a===da?c.children:[z,a,b,c];if(null!=a&&"object"===typeof a){if(y(a))return[z,a,b,c];switch(a.$$typeof){case B:var f=a._init;a=f(a._payload);return Q(a,b,d,c);case ea:return b=a.render,b(c,void 0);case fa:return Q(a.type,b,d,c);case A:return oa(a._context,
33
+ c.value),[z,a,b,{value:c.value,children:c.children,__pop:za}]}}throw Error("Unsupported server component type: "+R(a));}function Aa(a,b){var d=a.pingedTasks;d.push(b);1===d.length&&setImmediate(function(){return Ba(a)})}function ya(a,b,d,c){var f={id:a.nextChunkId++,status:0,model:b,context:d,ping:function(){return Aa(a,f)}};c.add(f);return f}function Ca(a){return Object.prototype.toString.call(a).replace(/^\[object (.*)\]$/,function(a,d){return d})}
34
+ function T(a){var b=JSON.stringify(a);return'"'+a+'"'===b?a:b}function R(a){switch(typeof a){case "string":return JSON.stringify(10>=a.length?a:a.substr(0,10)+"...");case "object":if(ia(a))return"[...]";a=Ca(a);return"Object"===a?"{...}":a;case "function":return"function";default:return String(a)}}
35
+ function V(a,b){if(ia(a)){for(var d="[",c=0;c<a.length;c++){0<c&&(d+=", ");if(6<c){d+="...";break}var f=a[c];d=""+c===b&&"object"===typeof f&&null!==f?d+V(f):d+R(f)}return d+"]"}d="{";c=Object.keys(a);for(f=0;f<c.length;f++){0<f&&(d+=", ");if(6<f){d+="...";break}var g=c[f];d+=T(g)+": ";var l=a[g];d=g===b&&"object"===typeof l&&null!==l?d+V(l):d+R(l)}return d+"}"}
36
+ function wa(a,b,d,c){switch(c){case z:return"$"}for(;"object"===typeof c&&null!==c&&(c.$$typeof===z||c.$$typeof===B);)try{switch(c.$$typeof){case z:var f=c;c=Q(f.type,f.key,f.ref,f.props);break;case B:var g=c._init;c=g(c._payload)}}catch(t){if("object"===typeof t&&null!==t&&"function"===typeof t.then)return a.pendingChunks++,a=ya(a,c,I,a.abortableTasks),d=a.ping,t.then(d,d),"@"+a.id.toString(16);W(a,t);a.pendingChunks++;d=a.nextChunkId++;X(a,d,t);return"@"+d.toString(16)}if(null==c)return c;if("object"===
37
+ typeof c||y(c)){if(y(c)){f=c;"string"===typeof f&&(f=globalThis.__STRING_REFERENCE_INDEX[f]);f=f.filepath+"#"+f.name;g=a.writtenModules;var l=g.get(f);if(void 0!==l)return b[0]===z&&"1"===d?"@"+l.toString(16):"$"+l.toString(16);try{"string"===typeof c&&(c=globalThis.__STRING_REFERENCE_INDEX[c]);var m={id:c.filepath,name:c.name};a.pendingChunks++;var p=a.nextChunkId++,S=x(m);var U="M"+p.toString(16)+":"+S+"\n";a.completedModuleChunks.push(U);g.set(f,p);return b[0]===z&&"1"===d?"@"+p.toString(16):"$"+
38
+ p.toString(16)}catch(t){return a.pendingChunks++,d=a.nextChunkId++,X(a,d,t),"$"+d.toString(16)}}else{if(c.$$typeof===A)return b=c._context._globalName,c=a.writtenProviders,d=c.get(d),void 0===d&&(a.pendingChunks++,d=a.nextChunkId++,c.set(b,d),b="P"+d.toString(16)+":"+b+"\n",a.completedJSONChunks.push(b)),"$"+d.toString(16);if(c===za){a=I;if(null===a)throw Error("Tried to pop a Context at the root of the app. This is a bug in React.");d=a.parentValue;a.context._currentValue=d===C?a.context._defaultValue:
39
+ d;I=a.parent;return}}return c}if("string"===typeof c)return a="$"===c[0]||"@"===c[0]?"$"+c:c,a;if("boolean"===typeof c||"number"===typeof c||"undefined"===typeof c)return c;if("function"===typeof c){if(/^on[A-Z]/.test(d))throw Error("Event handlers cannot be passed to client component props. Remove "+(T(d)+" from these props if possible: "+V(b)+"\nIf you need interactivity, consider converting part of this to a client component."));throw Error("Functions cannot be passed directly to client components because they're not serializable. Remove "+
40
+ (T(d)+" ("+(c.displayName||c.name||"function")+") from this object, or avoid the entire object: "+V(b)));}if("symbol"===typeof c){m=a.writtenSymbols;p=m.get(c);if(void 0!==p)return"$"+p.toString(16);p=c.description;if(Symbol.for(p)!==c)throw Error("Only global symbols received from Symbol.for(...) can be passed to client components. The symbol Symbol.for("+(c.description+") cannot be found among global symbols. Remove ")+(T(d)+" from this object, or avoid the entire object: "+V(b)));a.pendingChunks++;
41
+ d=a.nextChunkId++;b=x(p);b="S"+d.toString(16)+":"+b+"\n";a.completedModuleChunks.push(b);m.set(c,d);return"$"+d.toString(16)}if("bigint"===typeof c)throw Error("BigInt ("+c+") is not yet supported in client component props. Remove "+(T(d)+" from this object or use a plain number instead: "+V(b)));throw Error("Type "+typeof c+" is not supported in client component props. Remove "+(T(d)+" from this object, or avoid the entire object: "+V(b)));}function W(a,b){a=a.onError;a(b)}
42
+ function Y(a,b){null!==a.destination?(a.status=2,a.destination.destroy(b)):(a.status=1,a.fatalError=b)}function X(a,b,d){var c="";try{if(d instanceof Error){var f=String(d.message);c=String(d.stack)}else f="Error: "+d}catch(g){f="An error occurred but serializing the error message failed."}d={message:f,stack:c};b="E"+b.toString(16)+":"+x(d)+"\n";a.completedErrorChunks.push(b)}
43
+ function Ba(a){var b=P.current,d=N;P.current=sa;N=a.cache;L=a;try{var c=a.pingedTasks;a.pingedTasks=[];for(var f=0;f<c.length;f++){var g=c[f];var l=a;if(0===g.status){K(g.context);try{for(var m=g.model;"object"===typeof m&&null!==m&&m.$$typeof===z;){var p=m;g.model=m;m=Q(p.type,p.key,p.ref,p.props)}var S=g.id,U=x(m,l.toJSON);var t="J"+S.toString(16)+":"+U+"\n";l.completedJSONChunks.push(t);l.abortableTasks.delete(g);g.status=1}catch(w){if("object"===typeof w&&null!==w&&"function"===typeof w.then){var ma=
44
+ g.ping;w.then(ma,ma)}else l.abortableTasks.delete(g),g.status=4,W(l,w),X(l,g.id,w)}}}null!==a.destination&&Z(a,a.destination)}catch(w){W(a,w),Y(a,w)}finally{P.current=b,N=d,L=null}}
45
+ function Z(a,b){h=new Uint8Array(2048);k=0;n=!0;try{for(var d=a.completedModuleChunks,c=0;c<d.length;c++)if(a.pendingChunks--,!r(b,d[c])){a.destination=null;c++;break}d.splice(0,c);var f=a.completedJSONChunks;for(c=0;c<f.length;c++)if(a.pendingChunks--,!r(b,f[c])){a.destination=null;c++;break}f.splice(0,c);var g=a.completedErrorChunks;for(c=0;c<g.length;c++)if(a.pendingChunks--,!r(b,g[c])){a.destination=null;c++;break}g.splice(0,c)}finally{h&&0<k&&b.write(h.subarray(0,k)),h=null,k=0,n=!0}"function"===
46
+ typeof b.flush&&b.flush();0===a.pendingChunks&&b.end()}function Da(a){setImmediate(function(){return Ba(a)})}function Ea(a,b){if(1===a.status)a.status=2,b.destroy(a.fatalError);else if(2!==a.status&&null===a.destination){a.destination=b;try{Z(a,b)}catch(d){W(a,d),Y(a,d)}}}
47
+ function Fa(a,b){try{var d=a.abortableTasks;if(0<d.size){var c=void 0===b?Error("The render was aborted by the server without a reason."):b;W(a,c);a.pendingChunks++;var f=a.nextChunkId++;X(a,f,c);d.forEach(function(b){b.status=3;var c="$"+f.toString(16);b=b.id;c=x(c);c="J"+b.toString(16)+":"+c+"\n";a.completedJSONChunks.push(c)});d.clear()}null!==a.destination&&Z(a,a.destination)}catch(g){W(a,g),Y(a,g)}}
48
+ function xa(a){if(a){var b=I;K(null);for(var d=0;d<a.length;d++){var c=a[d],f=c[0];c=c[1];O[f]||(O[f]=e.createServerContext(f,C));oa(O[f],c)}a=I;K(b);return a}return null}function Ga(a,b){return function(){return Ea(b,a)}}
49
+ exports.renderToPipeableStream=function(a,b){var d=va(ba({},a,{$$typeof:Symbol.for("react.element"),props:{children:a},type:function(){e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentDispatcher.current.isRsc=!0;return a}}),{},b?b.onError:void 0,b?b.context:void 0,b?b.identifierPrefix:void 0),c=!1;Da(d);return{pipe:function(a){if(c)throw Error("React currently only supports piping to one writable stream.");c=!0;Ea(d,a);a.on("drain",Ga(a,d));return a},abort:function(a){Fa(d,a)}}};
@@ -10,9 +10,9 @@
10
10
 
11
11
  import { init, parse } from 'es-module-lexer';
12
12
  import MagicString from 'magic-string';
13
- import { normalizePath, transformWithEsbuild, createServer } from 'vite';
14
13
  import { promises } from 'fs';
15
14
  import path from 'path';
15
+ import { version, normalizePath as normalizePath$1, transformWithEsbuild as transformWithEsbuild$1, createServer as createServer$1 } from 'vite';
16
16
 
17
17
  function _unsupportedIterableToArray(o, minLen) {
18
18
  if (!o) return;
@@ -90,6 +90,10 @@ function _createForOfIteratorHelper(o, allowArrayLike) {
90
90
 
91
91
  var assign = Object.assign;
92
92
 
93
+ var normalizePath = normalizePath$1,
94
+ transformWithEsbuild = transformWithEsbuild$1,
95
+ createServer = createServer$1;
96
+ var isVite3 = version && version.startsWith('3.');
93
97
  var rscViteFileRE = /\/react-server-dom-vite.js/;
94
98
  var noProxyRE = /[&?]no-proxy($|&)/;
95
99
 
@@ -407,8 +411,10 @@ async function findClientBoundariesForClientBuild(serverEntries, optimizeBoundar
407
411
  root: root,
408
412
  clearScreen: false,
409
413
  server: {
410
- middlewareMode: 'ssr'
411
- }
414
+ middlewareMode: isVite3 ? true : 'ssr',
415
+ hmr: false
416
+ },
417
+ appType: 'custom'
412
418
  });
413
419
 
414
420
  try {
@@ -431,7 +437,8 @@ var hashImportsPlugin = {
431
437
  if (rscViteFileRE.test(id)) {
432
438
  var s = new MagicString(code);
433
439
  s.replace(/\/\*\s*HASH_BEGIN\s*\*\/\s*([^]+?)\/\*\s*HASH_END\s*\*\//gm, function (_, imports) {
434
- return imports.trim().replace(/"([^"]+?)":/gm, function (__, relativePath) {
440
+ return imports.trim().replace(/"([^"]+?)":/gm, function (all, relativePath) {
441
+ if (relativePath === '__VITE_PRELOAD__') return all;
435
442
  var absolutePath = path.resolve(path.dirname(id.split('?')[0]), relativePath);
436
443
  return "\"" + getComponentId(normalizePath(absolutePath)) + "\":";
437
444
  });
@@ -525,17 +532,20 @@ function isDirectImportInServer(originalMod, currentMod, accModInfo) {
525
532
  });
526
533
  }
527
534
 
528
- function resolveModPath(modPath, dirname, retryExtension) {
529
- var absolutePath = '';
535
+ var RESOLVE_EXTENSIONS = ['', '.js', '.ts', '.jsx', '.tsx', '/index', '/index.js', '/index.ts', '/index.jsx', '/index.tsx']; // Resolve relative paths and aliases. Examples:
536
+ // - import {XYZ} from '~/components' => import {XYZ} from '<absolute>/src/components/index.ts'
537
+ // - import {XYZ} from '/src/component.client' => import {XYZ} from '<absolute>/src/component.client.jsx'`
530
538
 
531
- try {
532
- absolutePath = modPath.startsWith('.') ? normalizePath(path.resolve(dirname, modPath)) : modPath;
533
- return normalizePath(require.resolve(absolutePath + (retryExtension || '')));
534
- } catch (error) {
535
- if (!/\.[jt]sx?$/.test(absolutePath) && retryExtension !== '.tsx') {
536
- // Node cannot infer .[jt]sx extensions.
537
- // Append them here and retry a couple of times.
538
- return resolveModPath(absolutePath, dirname, retryExtension ? '.tsx' : '.jsx');
539
+ function resolveModPath(modPath, dirname) {
540
+ var extensions = /\.[jt]sx?$/.test(modPath) ? [''] : RESOLVE_EXTENSIONS;
541
+
542
+ for (var i = 0; i < extensions.length; i++) {
543
+ var extension = extensions[i];
544
+
545
+ try {
546
+ var absolutePath = modPath.startsWith('.') ? normalizePath(path.resolve(dirname, modPath)) : modPath;
547
+ return normalizePath(require.resolve(absolutePath + extension));
548
+ } catch (error) {// Do not throw, this is likely a virtual module or another exception
539
549
  }
540
550
  }
541
551
  }