preact-render-to-string 6.6.5 → 6.6.6

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.
package/README.md CHANGED
@@ -144,6 +144,104 @@ main().catch((error) => {
144
144
 
145
145
  ---
146
146
 
147
+ ### Streaming
148
+
149
+ > [!NOTE]
150
+ > This is an early version of our streaming implementation.
151
+
152
+ Preact supports streaming HTML to the client incrementally, flushing `<Suspense>` fallbacks immediately and replacing them with the resolved content as data arrives. This reduces Time to First Byte and allows the browser to start parsing earlier.
153
+
154
+ #### `renderToReadableStream` — Web Streams
155
+
156
+ ```jsx
157
+ import { renderToReadableStream } from 'preact-render-to-string/stream';
158
+ import { Suspense, lazy } from 'preact/compat';
159
+
160
+ const Profile = lazy(() => import('./Profile'));
161
+
162
+ const App = () => (
163
+ <html>
164
+ <head><title>My App</title></head>
165
+ <body>
166
+ <Suspense fallback={<p>Loading profile…</p>}>
167
+ <Profile />
168
+ </Suspense>
169
+ </body>
170
+ </html>
171
+ );
172
+
173
+ // Works in any Web Streams environment (Deno, Bun, Cloudflare Workers, …)
174
+ export default {
175
+ fetch() {
176
+ const stream = renderToReadableStream(<App />);
177
+
178
+ // stream.allReady resolves once all suspended content has been flushed
179
+ return new Response(stream, {
180
+ headers: { 'Content-Type': 'text/html' }
181
+ });
182
+ }
183
+ };
184
+ ```
185
+
186
+ The returned `ReadableStream` has an extra `allReady: Promise<void>` property that resolves once every suspended subtree has been written. Await it before sending the response if you need the complete document before anything is flushed (e.g. for static export). At which point you might be better off using `renderToStringAsync` though.
187
+
188
+ ```js
189
+ const stream = renderToReadableStream(<App />);
190
+ await stream.allReady; // wait for full render
191
+ ```
192
+
193
+ #### `renderToPipeableStream` — Node.js Streams
194
+
195
+ ```jsx
196
+ import { createServer } from 'node:http';
197
+ import { renderToPipeableStream } from 'preact-render-to-string/stream-node';
198
+ import { Suspense, lazy } from 'preact/compat';
199
+
200
+ const Profile = lazy(() => import('./Profile'));
201
+
202
+ const App = () => (
203
+ <html>
204
+ <head><title>My App</title></head>
205
+ <body>
206
+ <Suspense fallback={<p>Loading profile…</p>}>
207
+ <Profile />
208
+ </Suspense>
209
+ </body>
210
+ </html>
211
+ );
212
+
213
+ createServer((req, res) => {
214
+ res.setHeader('Content-Type', 'text/html');
215
+
216
+ const { pipe, abort } = renderToPipeableStream(<App />, {
217
+ onShellReady() {
218
+ // Called once the synchronous shell is ready to stream.
219
+ pipe(res);
220
+ },
221
+ onAllReady() {
222
+ // Called once every suspended subtree has been flushed.
223
+ },
224
+ onError(error) {
225
+ console.error(error);
226
+ res.statusCode = 500;
227
+ }
228
+ });
229
+
230
+ // Optional: abort the render after a timeout
231
+ setTimeout(abort, 10_000);
232
+ }).listen(8080);
233
+ ```
234
+
235
+ | Option | Description |
236
+ |---|---|
237
+ | `onShellReady()` | Called synchronously once the initial shell has been rendered and streaming is about to start. Pipe here for fastest TTFB. |
238
+ | `onAllReady()` | Called after all `<Suspense>` boundaries have resolved and the stream is complete. |
239
+ | `onError(error)` | Called for render errors inside suspended subtrees. |
240
+
241
+ Calling `abort()` stops the render and destroys the stream; any pending suspended subtrees are dropped.
242
+
243
+ ---
244
+
147
245
  ### License
148
246
 
149
247
  [MIT](http://choosealicense.com/licenses/mit/)
@@ -1,2 +1,2 @@
1
- var e=require("preact"),t="__s",r="__c",n="__d",o="__s",i=/[\s\n\\/='"\0<>]/,a=/^(xlink|xmlns|xml)([A-Z])/,s=/^(?:accessK|auto[A-Z]|cell|ch|col|cont|cross|dateT|encT|form[A-Z]|frame|hrefL|inputM|maxL|minL|noV|playsI|popoverT|readO|rowS|src[A-Z]|tabI|useM|item[A-Z])/,c=/^ac|^ali|arabic|basel|cap|clipPath$|clipRule$|color|dominant|enable|fill|flood|font|glyph[^R]|horiz|image|letter|lighting|marker[^WUH]|overline|panose|pointe|paint|rendering|shape|stop|strikethrough|stroke|text[^L]|transform|underline|unicode|units|^v[^i]|^w|^xH/,l=new Set(["draggable","spellcheck"]);function u(e){void 0!==e.__g?e.__g|=8:e[n]=!0}function p(e){void 0!==e.__g?e.__g&=-9:e[n]=!1}function f(e){return void 0!==e.__g?!!(8&e.__g):!0===e[n]}var d=/["&<]/;function h(e){if(0===e.length||!1===d.test(e))return e;for(var t=0,r=0,n="",o="";r<e.length;r++){switch(e.charCodeAt(r)){case 34:o="&quot;";break;case 38:o="&amp;";break;case 60:o="&lt;";break;default:continue}r!==t&&(n+=e.slice(t,r)),n+=o,t=r+1}return r!==t&&(n+=e.slice(t,r)),n}var v={},m=new Set(["animation-iteration-count","border-image-outset","border-image-slice","border-image-width","box-flex","box-flex-group","box-ordinal-group","column-count","fill-opacity","flex","flex-grow","flex-negative","flex-order","flex-positive","flex-shrink","flood-opacity","font-weight","grid-column","grid-row","line-clamp","line-height","opacity","order","orphans","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","widows","z-index","zoom"]),g=/[A-Z]/g;function _(e){var t="";for(var r in e){var n=e[r];if(null!=n&&""!==n){var o="-"==r[0]?r:v[r]||(v[r]=r.replace(g,"-$&").toLowerCase()),i=";";"number"!=typeof n||o.startsWith("--")||m.has(o)||(i="px;"),t=t+o+":"+n+i}}return t||void 0}function y(){this.__d=!0}function b(e,t){return{__v:e,context:t,props:e.props,setState:y,forceUpdate:y,__d:!0,__h:new Array(0)}}var x,k,w,C,S=function(){var e=this;this.promise=new Promise(function(t,r){e.resolve=t,e.reject=r})},A={},E=[],L=Array.isArray,P=Object.assign,j="",F="\x3c!--$s--\x3e",T="\x3c!--/$s--\x3e";function W(r,n,o){var i=e.options[t];e.options[t]=!0,x=e.options.__b,k=e.options.diffed,w=e.options.__r,C=e.options.unmount;var a=e.h(e.Fragment,null);a.__k=[r];try{var s=N(r,n||A,!1,void 0,a,!1,o);return L(s)?s.join(j):s}catch(e){if(e.then)throw new Error('Use "renderToStringAsync" for suspenseful rendering.');throw e}finally{e.options.__c&&e.options.__c(r,E),e.options[t]=i,E.length=0}}function D(e,t){var n,i=e.type,a=!0;return e[r]?(a=!1,(n=e[r]).state=n[o]):n=new i(e.props,t),e[r]=n,n.__v=e,n.props=e.props,n.context=t,u(n),null==n.state&&(n.state=A),null==n[o]&&(n[o]=n.state),i.getDerivedStateFromProps?n.state=P({},n.state,i.getDerivedStateFromProps(n.props,n.state)):a&&n.componentWillMount?(n.componentWillMount(),n.state=n[o]!==n.state?n[o]:n.state):!a&&n.componentWillUpdate&&n.componentWillUpdate(),w&&w(e),n.render(n.props,n.state,t)}function N(t,n,d,v,m,g,y){if(null==t||!0===t||!1===t||t===j)return j;var S=typeof t;if("object"!=S)return"function"==S?j:"string"==S?h(t):t+j;if(L(t)){var E,W=j;m.__k=t;for(var U=t.length,Z=0;Z<U;Z++){var q=t[Z];if(null!=q&&"boolean"!=typeof q){var H,R=N(q,n,d,v,m,g,y);"string"==typeof R?W+=R:(E||(E=new Array(U)),W&&E.push(W),W=j,L(R)?(H=E).push.apply(H,R):E.push(R))}}return E?(W&&E.push(W),E):W}if(void 0!==t.constructor)return j;t.__=m,x&&x(t);var z=t.type,I=t.props;if("function"==typeof z){var B,O,V,K=n;if(z===e.Fragment){if("tpl"in I){for(var G=j,J=0;J<I.tpl.length;J++)if(G+=I.tpl[J],I.exprs&&J<I.exprs.length){var Q=I.exprs[J];if(null==Q)continue;"object"!=typeof Q||void 0!==Q.constructor&&!L(Q)?G+=Q:G+=N(Q,n,d,v,t,g,y)}return G}if("UNSTABLE_comment"in I)return"\x3c!--"+h(I.UNSTABLE_comment)+"--\x3e";O=I.children}else{if(null!=(B=z.contextType)){var X=n[B.__c];K=X?X.props.value:B.__}var Y=z.prototype&&"function"==typeof z.prototype.render;if(Y)O=/**#__NOINLINE__**/D(t,K),V=t[r];else{t[r]=V=/**#__NOINLINE__**/b(t,K);for(var ee=0;f(V)&&ee++<25;){p(V),w&&w(t);try{O=z.call(V,I,K)}catch(e){throw g&&e&&"function"==typeof e.then&&(t._suspended=!0),e}}u(V)}if(null!=V.getChildContext&&(n=P({},n,V.getChildContext())),Y&&e.options.errorBoundaries&&(z.getDerivedStateFromError||V.componentDidCatch)){O=null!=O&&O.type===e.Fragment&&null==O.key&&null==O.props.tpl?O.props.children:O;try{return N(O,n,d,v,t,g,!1)}catch(i){return z.getDerivedStateFromError&&(V[o]=z.getDerivedStateFromError(i)),V.componentDidCatch&&V.componentDidCatch(i,A),f(V)?(O=D(t,n),null!=(V=t[r]).getChildContext&&(n=P({},n,V.getChildContext())),N(O=null!=O&&O.type===e.Fragment&&null==O.key&&null==O.props.tpl?O.props.children:O,n,d,v,t,g,y)):j}finally{k&&k(t),C&&C(t)}}}O=null!=O&&O.type===e.Fragment&&null==O.key&&null==O.props.tpl?O.props.children:O;try{var te=N(O,n,d,v,t,g,y);return k&&k(t),e.options.unmount&&e.options.unmount(t),t._suspended?"string"==typeof te?F+te+T:L(te)?(te.unshift(F),te.push(T),te):te.then(function(e){return F+e+T}):te}catch(r){if(!g&&y&&y.onError){var re=function e(r){return y.onError(r,t,function(t,r){try{return N(t,n,d,v,r,g,y)}catch(t){return e(t)}})}(r);if(void 0!==re)return re;var ne=e.options.__e;return ne&&ne(r,t),j}if(!g)throw r;if(!r||"function"!=typeof r.then)throw r;return r.then(function e(){try{var r=N(O,n,d,v,t,g,y);return t._suspended?F+r+T:r}catch(t){if(!t||"function"!=typeof t.then)throw t;return t.then(e)}})}}var oe,ie="<"+z,ae=j;for(var se in I){var ce=I[se];if("function"!=typeof(ce=M(ce)?ce.value:ce)||"class"===se||"className"===se){switch(se){case"children":oe=ce;continue;case"key":case"ref":case"__self":case"__source":continue;case"htmlFor":if("for"in I)continue;se="for";break;case"className":if("class"in I)continue;se="class";break;case"defaultChecked":se="checked";break;case"defaultSelected":se="selected";break;case"defaultValue":case"value":switch(se="value",z){case"textarea":oe=ce;continue;case"select":v=ce;continue;case"option":v!=ce||"selected"in I||(ie+=" selected")}break;case"dangerouslySetInnerHTML":ae=ce&&ce.__html;continue;case"style":"object"==typeof ce&&(ce=_(ce));break;case"acceptCharset":se="accept-charset";break;case"httpEquiv":se="http-equiv";break;default:if(a.test(se))se=se.replace(a,"$1:$2").toLowerCase();else{if(i.test(se))continue;"-"!==se[4]&&!l.has(se)||null==ce?d?c.test(se)&&(se="panose1"===se?"panose-1":se.replace(/([A-Z])/g,"-$1").toLowerCase()):s.test(se)&&(se=se.toLowerCase()):ce+=j}}null!=ce&&!1!==ce&&(ie=!0===ce||ce===j?ie+" "+se:ie+" "+se+'="'+("string"==typeof ce?h(ce):ce+j)+'"')}}if(i.test(z))throw new Error(z+" is not a valid HTML tag name in "+ie+">");if(ae||("string"==typeof oe?ae=h(oe):null!=oe&&!1!==oe&&!0!==oe&&(ae=N(oe,n,"svg"===z||"foreignObject"!==z&&d,v,t,g,y))),k&&k(t),C&&C(t),!ae&&$.has(z))return ie+"/>";var le="</"+z+">",ue=ie+">";return L(ae)?[ue].concat(ae,[le]):"string"!=typeof ae?[ue,ae,le]:ue+ae+le}var $=new Set(["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"]);function M(e){return null!==e&&"object"==typeof e&&"function"==typeof e.peek&&"value"in e}function U(e,t){return'<preact-island hidden data-target="'+e+'">'+t+"</preact-island>"}var Z=function e(t){try{var r=function(){if(t.suspended.length>0){var r=[].concat(t.suspended);return Promise.resolve(Promise.all(t.suspended.map(function(e){return e.promise}))).then(function(){return t.suspended=t.suspended.filter(function(e){return!r.includes(e)}),Promise.resolve(e(t)).then(function(){})})}}();return Promise.resolve(r&&r.then?r.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},q=function(e,t){var r=t.context,n=t.onWrite,o=t.abortSignal;try{r=r||{};var i={start:Date.now(),abortSignal:o,onWrite:n,onError:H,suspended:[]},a=W(e,r,i);n(a);var s=i.suspended.length,c=function(){if(s>0)return n("<div hidden>"),n('<script>(function(){class e extends HTMLElement{connectedCallback(){var e=this;if(!e.isConnected)return;let t=this.getAttribute("data-target");if(t){for(var r,a,i=document.createNodeIterator(document,128);i.nextNode();){let e=i.referenceNode;if(e.data=="preact-island:"+t?r=e:e.data=="/preact-island:"+t&&(a=e),r&&a)break}r&&a&&requestAnimationFrame((()=>{for(var t=a.previousSibling;t!=r&&t&&t!=r;)a.parentNode.removeChild(t),t=a.previousSibling;for(i=r;e.firstChild;)r=e.firstChild,e.removeChild(r),i.after(r),i=r;e.parentNode.removeChild(e)}))}}}customElements.define("preact-island",e);}())<\/script>'),Promise.resolve(Z(i)).then(function(){n("</div>")})}();return Promise.resolve(c&&c.then?c.then(function(){}):void 0)}catch(e){return Promise.reject(e)}};function H(e,t,n){var o=this;if(e&&e.then){for(;t=t.__;){var i=t[r];if(i&&i.__c)break}if(t){var a=t.__v,s=this.suspended.find(function(e){return e.id===a}),c=new S,l=this.abortSignal;l&&(l.aborted?c.resolve():l.addEventListener("abort",c.resolve));var u=e.then(function(){if(!l||!l.aborted){var e=n(t.props.children,t);e&&o.onWrite(U(a,e))}},this.onError);this.suspended.push({id:a,vnode:t,promise:Promise.race([u,c.promise])});var p=n(t.props.fallback);return s?"":"\x3c!--preact-island:"+a+"--\x3e"+p+"\x3c!--/preact-island:"+a+"--\x3e"}}}exports.renderToReadableStream=function(e,t){var r=new S,n=new TextEncoder("utf-8"),o=new ReadableStream({start:function(o){q(e,{context:t,onError:function(e){r.reject(e),o.abort(e)},onWrite:function(e){o.enqueue(n.encode(e))}}).then(function(){o.close(),r.resolve()}).catch(function(e){o.error(e),r.reject(e)})}});return o.allReady=r.promise,o};
1
+ var e=require("preact"),t="__s",r="__c",n="__d",o="__s",i=/[\s\n\\/='"\0<>]/,a=/^(xlink|xmlns|xml)([A-Z])/,s=/^(?:accessK|auto[A-Z]|cell|ch|col|cont|cross|dateT|encT|form[A-Z]|frame|hrefL|inputM|maxL|minL|noV|playsI|popoverT|readO|rowS|src[A-Z]|tabI|useM|item[A-Z])/,c=/^ac|^ali|arabic|basel|cap|clipPath$|clipRule$|color|dominant|enable|fill|flood|font|glyph[^R]|horiz|image|letter|lighting|marker[^WUH]|overline|panose|pointe|paint|rendering|shape|stop|strikethrough|stroke|text[^L]|transform|underline|unicode|units|^v[^i]|^w|^xH/,l=new Set(["draggable","spellcheck"]);function u(e){void 0!==e.__g?e.__g|=8:e[n]=!0}function p(e){void 0!==e.__g?e.__g&=-9:e[n]=!1}function f(e){return void 0!==e.__g?!!(8&e.__g):!0===e[n]}var d=/["&<]/;function h(e){if(0===e.length||!1===d.test(e))return e;for(var t=0,r=0,n="",o="";r<e.length;r++){switch(e.charCodeAt(r)){case 34:o="&quot;";break;case 38:o="&amp;";break;case 60:o="&lt;";break;default:continue}r!==t&&(n+=e.slice(t,r)),n+=o,t=r+1}return r!==t&&(n+=e.slice(t,r)),n}var v={},m=new Set(["animation-iteration-count","border-image-outset","border-image-slice","border-image-width","box-flex","box-flex-group","box-ordinal-group","column-count","fill-opacity","flex","flex-grow","flex-negative","flex-order","flex-positive","flex-shrink","flood-opacity","font-weight","grid-column","grid-row","line-clamp","line-height","opacity","order","orphans","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","widows","z-index","zoom"]),g=/[A-Z]/g;function _(e){var t="";for(var r in e){var n=e[r];if(null!=n&&""!==n){var o="-"==r[0]?r:v[r]||(v[r]=r.replace(g,"-$&").toLowerCase()),i=";";"number"!=typeof n||o.startsWith("--")||m.has(o)||(i="px;"),t=t+o+":"+n+i}}return t||void 0}function y(){this.__d=!0}function b(e,t){return{__v:e,context:t,props:e.props,setState:y,forceUpdate:y,__d:!0,__h:new Array(0)}}var x,k,w,C,S=function(){var e=this;this.promise=new Promise(function(t,r){e.resolve=t,e.reject=r})},E={},A=[],L=Array.isArray,P=Object.assign,T="",j="\x3c!--$s--\x3e",F="\x3c!--/$s--\x3e";function W(r,n,o){var i=e.options[t];e.options[t]=!0,x=e.options.__b,k=e.options.diffed,w=e.options.__r,C=e.options.unmount;var a=e.h(e.Fragment,null);a.__k=[r];try{var s=N(r,n||E,!1,void 0,a,!1,o);return L(s)?s.join(T):s}catch(e){if(e.then)throw new Error('Use "renderToStringAsync" for suspenseful rendering.');throw e}finally{e.options.__c&&e.options.__c(r,A),e.options[t]=i,A.length=0}}function D(e,t){var n,i=e.type,a=!0;return e[r]?(a=!1,(n=e[r]).state=n[o]):n=new i(e.props,t),e[r]=n,n.__v=e,n.props=e.props,n.context=t,u(n),null==n.state&&(n.state=E),null==n[o]&&(n[o]=n.state),i.getDerivedStateFromProps?n.state=P({},n.state,i.getDerivedStateFromProps(n.props,n.state)):a&&n.componentWillMount?(n.componentWillMount(),n.state=n[o]!==n.state?n[o]:n.state):!a&&n.componentWillUpdate&&n.componentWillUpdate(),w&&w(e),n.render(n.props,n.state,t)}function N(t,n,d,v,m,g,y){if(null==t||!0===t||!1===t||t===T)return T;var S=typeof t;if("object"!=S)return"function"==S?T:"string"==S?h(t):t+T;if(L(t)){var A,W=T;m.__k=t;for(var U=t.length,Z=0;Z<U;Z++){var q=t[Z];if(null!=q&&"boolean"!=typeof q){var H,I=N(q,n,d,v,m,g,y);"string"==typeof I?W+=I:(A||(A=new Array(U)),W&&A.push(W),W=T,L(I)?(H=A).push.apply(H,I):A.push(I))}}return A?(W&&A.push(W),A):W}if(void 0!==t.constructor)return T;t.__=m,x&&x(t);var O=t.type,R=t.props;if("function"==typeof O){var z,B,V,K=n;if(O===e.Fragment){if("tpl"in R){for(var Y=T,G=0;G<R.tpl.length;G++)if(Y+=R.tpl[G],R.exprs&&G<R.exprs.length){var J=R.exprs[G];if(null==J)continue;"object"!=typeof J||void 0!==J.constructor&&!L(J)?Y+=J:Y+=N(J,n,d,v,t,g,y)}return Y}if("UNSTABLE_comment"in R)return"\x3c!--"+h(R.UNSTABLE_comment)+"--\x3e";B=R.children}else{if(null!=(z=O.contextType)){var Q=n[z.__c];K=Q?Q.props.value:z.__}var X=O.prototype&&"function"==typeof O.prototype.render;if(X)B=/**#__NOINLINE__**/D(t,K),V=t[r];else{t[r]=V=/**#__NOINLINE__**/b(t,K);for(var ee=0;f(V)&&ee++<25;){p(V),w&&w(t);try{B=O.call(V,R,K)}catch(e){throw g&&e&&"function"==typeof e.then&&(t._suspended=!0),e}}u(V)}if(null!=V.getChildContext&&(n=P({},n,V.getChildContext())),X&&e.options.errorBoundaries&&(O.getDerivedStateFromError||V.componentDidCatch)){B=null!=B&&B.type===e.Fragment&&null==B.key&&null==B.props.tpl?B.props.children:B;try{return N(B,n,d,v,t,g,!1)}catch(i){return O.getDerivedStateFromError&&(V[o]=O.getDerivedStateFromError(i)),V.componentDidCatch&&V.componentDidCatch(i,E),f(V)?(B=D(t,n),null!=(V=t[r]).getChildContext&&(n=P({},n,V.getChildContext())),N(B=null!=B&&B.type===e.Fragment&&null==B.key&&null==B.props.tpl?B.props.children:B,n,d,v,t,g,y)):T}finally{k&&k(t),C&&C(t)}}}B=null!=B&&B.type===e.Fragment&&null==B.key&&null==B.props.tpl?B.props.children:B;try{var te=N(B,n,d,v,t,g,y);return k&&k(t),e.options.unmount&&e.options.unmount(t),t._suspended?"string"==typeof te?j+te+F:L(te)?(te.unshift(j),te.push(F),te):te.then(function(e){return j+e+F}):te}catch(r){if(!g&&y&&y.onError){var re=function e(r){return y.onError(r,t,function(t,r){try{return N(t,n,d,v,r,g,y)}catch(t){return e(t)}})}(r);if(void 0!==re)return re;var ne=e.options.__e;return ne&&ne(r,t),T}if(!g)throw r;if(!r||"function"!=typeof r.then)throw r;return r.then(function e(){try{var r=N(B,n,d,v,t,g,y);return t._suspended?j+r+F:r}catch(t){if(!t||"function"!=typeof t.then)throw t;return t.then(e)}})}}var oe,ie="<"+O,ae=T;for(var se in R){var ce=R[se];if("function"!=typeof(ce=M(ce)?ce.value:ce)||"class"===se||"className"===se){switch(se){case"children":oe=ce;continue;case"key":case"ref":case"__self":case"__source":continue;case"htmlFor":if("for"in R)continue;se="for";break;case"className":if("class"in R)continue;se="class";break;case"defaultChecked":se="checked";break;case"defaultSelected":se="selected";break;case"defaultValue":case"value":switch(se="value",O){case"textarea":oe=ce;continue;case"select":v=ce;continue;case"option":v!=ce||"selected"in R||(ie+=" selected")}break;case"dangerouslySetInnerHTML":ae=ce&&ce.__html;continue;case"style":"object"==typeof ce&&(ce=_(ce));break;case"acceptCharset":se="accept-charset";break;case"httpEquiv":se="http-equiv";break;default:if(a.test(se))se=se.replace(a,"$1:$2").toLowerCase();else{if(i.test(se))continue;"-"!==se[4]&&!l.has(se)||null==ce?d?c.test(se)&&(se="panose1"===se?"panose-1":se.replace(/([A-Z])/g,"-$1").toLowerCase()):s.test(se)&&(se=se.toLowerCase()):ce+=T}}null!=ce&&!1!==ce&&(ie=!0===ce||ce===T?ie+" "+se:ie+" "+se+'="'+("string"==typeof ce?h(ce):ce+T)+'"')}}if(i.test(O))throw new Error(O+" is not a valid HTML tag name in "+ie+">");if(ae||("string"==typeof oe?ae=h(oe):null!=oe&&!1!==oe&&!0!==oe&&(ae=N(oe,n,"svg"===O||"foreignObject"!==O&&d,v,t,g,y))),k&&k(t),C&&C(t),!ae&&$.has(O))return ie+"/>";var le="</"+O+">",ue=ie+">";return L(ae)?[ue].concat(ae,[le]):"string"!=typeof ae?[ue,ae,le]:ue+ae+le}var $=new Set(["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"]);function M(e){return null!==e&&"object"==typeof e&&"function"==typeof e.peek&&"value"in e}function U(e,t){return'<preact-island hidden data-target="'+e+'">'+t+"</preact-island>"}var Z=function e(t){try{var r=function(){if(t.suspended.length>0){var r=[].concat(t.suspended);return Promise.resolve(Promise.all(t.suspended.map(function(e){return e.promise}))).then(function(){return t.suspended=t.suspended.filter(function(e){return!r.includes(e)}),Promise.resolve(e(t)).then(function(){})})}}();return Promise.resolve(r&&r.then?r.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},q=function(e,t){var r=t.context,n=t.onWrite,o=t.abortSignal;try{r=r||{};var i={start:Date.now(),abortSignal:o,onWrite:n,onError:H,suspended:[]},a=W(e,r,i),s=i.suspended.length,c=function(){if(s>0){var e=a.lastIndexOf("</body>"),t=a.trimStart().startsWith("<html"),r=-1!==e?a.slice(0,e):a;return n((t?"<!DOCTYPE html>":"")+r),n("<div hidden>"),n('<script>(function(){class e extends HTMLElement{connectedCallback(){var e=this;if(!e.isConnected)return;let t=this.getAttribute("data-target");if(t){for(var r,a,i=document.createNodeIterator(document,128);i.nextNode();){let e=i.referenceNode;if(e.data=="preact-island:"+t?r=e:e.data=="/preact-island:"+t&&(a=e),r&&a)break}r&&a&&r.parentNode!==document&&requestAnimationFrame((()=>{for(var t=a.previousSibling;t!=r&&t&&t!=r;)a.parentNode.removeChild(t),t=a.previousSibling;for(i=r;e.firstChild;)r=e.firstChild,e.removeChild(r),i.after(r),i=r;e.parentNode.removeChild(e)}))}}}customElements.define("preact-island",e);}())<\/script>'),Promise.resolve(Z(i)).then(function(){n("</div>"),-1!==e&&n(a.slice(e))})}n(a)}();return Promise.resolve(c&&c.then?c.then(function(){}):void 0)}catch(e){return Promise.reject(e)}};function H(e,t,n){var o=this;if(e&&e.then){for(;t=t.__;){var i=t[r];if(i&&i.__c)break}if(t){var a=t.__v,s=this.suspended.find(function(e){return e.id===a}),c=new S,l=this.abortSignal;l&&(l.aborted?c.resolve():l.addEventListener("abort",c.resolve));var u=e.then(function(){if(!l||!l.aborted){var e=n(t.props.children,t);e&&o.onWrite(U(a,e))}},this.onError);this.suspended.push({id:a,vnode:t,promise:Promise.race([u,c.promise])});var p=n(t.props.fallback);return s?"":"\x3c!--preact-island:"+a+"--\x3e"+p+"\x3c!--/preact-island:"+a+"--\x3e"}}}exports.renderToReadableStream=function(e,t){var r=new S,n=new TextEncoder("utf-8"),o=new ReadableStream({start:function(o){q(e,{context:t,onError:function(e){r.reject(e),o.abort(e)},onWrite:function(e){o.enqueue(n.encode(e))}}).then(function(){o.close(),r.resolve()}).catch(function(e){o.error(e),r.reject(e)})}});return o.allReady=r.promise,o};
2
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../src/lib/constants.js","../../src/lib/util.js","../../src/index.js","../../src/lib/client.js","../../src/lib/chunked.js","../../src/stream.js"],"sourcesContent":["// Options hooks\nexport const DIFF = '__b';\nexport const RENDER = '__r';\nexport const DIFFED = 'diffed';\nexport const COMMIT = '__c';\nexport const SKIP_EFFECTS = '__s';\nexport const CATCH_ERROR = '__e';\n\n// VNode properties\nexport const COMPONENT = '__c';\nexport const CHILDREN = '__k';\nexport const PARENT = '__';\nexport const MASK = '__m';\n\n// Component properties\nexport const VNODE = '__v';\nexport const DIRTY = '__d';\nexport const BITS = '__g';\nexport const NEXT_STATE = '__s';\nexport const CHILD_DID_SUSPEND = '__c';\n","import { DIRTY, BITS } from './constants';\n\nexport const VOID_ELEMENTS = /^(?:area|base|br|col|embed|hr|img|input|link|meta|param|source|track|wbr)$/;\n// oxlint-disable-next-line no-control-regex\nexport const UNSAFE_NAME = /[\\s\\n\\\\/='\"\\0<>]/;\nexport const NAMESPACE_REPLACE_REGEX = /^(xlink|xmlns|xml)([A-Z])/;\nexport const HTML_LOWER_CASE = /^(?:accessK|auto[A-Z]|cell|ch|col|cont|cross|dateT|encT|form[A-Z]|frame|hrefL|inputM|maxL|minL|noV|playsI|popoverT|readO|rowS|src[A-Z]|tabI|useM|item[A-Z])/;\nexport const SVG_CAMEL_CASE = /^ac|^ali|arabic|basel|cap|clipPath$|clipRule$|color|dominant|enable|fill|flood|font|glyph[^R]|horiz|image|letter|lighting|marker[^WUH]|overline|panose|pointe|paint|rendering|shape|stop|strikethrough|stroke|text[^L]|transform|underline|unicode|units|^v[^i]|^w|^xH/;\n\n// Boolean DOM properties that translate to enumerated ('true'/'false') attributes\nexport const HTML_ENUMERATED = new Set(['draggable', 'spellcheck']);\n\nexport const COMPONENT_DIRTY_BIT = 1 << 3;\nexport function setDirty(component) {\n\tif (component[BITS] !== undefined) {\n\t\tcomponent[BITS] |= COMPONENT_DIRTY_BIT;\n\t} else {\n\t\tcomponent[DIRTY] = true;\n\t}\n}\n\nexport function unsetDirty(component) {\n\tif (component.__g !== undefined) {\n\t\tcomponent.__g &= ~COMPONENT_DIRTY_BIT;\n\t} else {\n\t\tcomponent[DIRTY] = false;\n\t}\n}\n\nexport function isDirty(component) {\n\tif (component.__g !== undefined) {\n\t\treturn (component.__g & COMPONENT_DIRTY_BIT) !== 0;\n\t}\n\treturn component[DIRTY] === true;\n}\n\n// DOM properties that should NOT have \"px\" added when numeric\nconst ENCODED_ENTITIES = /[\"&<]/;\n\n/** @param {string} str */\nexport function encodeEntities(str) {\n\t// Skip all work for strings with no entities needing encoding:\n\tif (str.length === 0 || ENCODED_ENTITIES.test(str) === false) return str;\n\n\tlet last = 0,\n\t\ti = 0,\n\t\tout = '',\n\t\tch = '';\n\n\t// Seek forward in str until the next entity char:\n\tfor (; i < str.length; i++) {\n\t\tswitch (str.charCodeAt(i)) {\n\t\t\tcase 34:\n\t\t\t\tch = '&quot;';\n\t\t\t\tbreak;\n\t\t\tcase 38:\n\t\t\t\tch = '&amp;';\n\t\t\t\tbreak;\n\t\t\tcase 60:\n\t\t\t\tch = '&lt;';\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tcontinue;\n\t\t}\n\t\t// Append skipped/buffered characters and the encoded entity:\n\t\tif (i !== last) out = out + str.slice(last, i);\n\t\tout = out + ch;\n\t\t// Start the next seek/buffer after the entity's offset:\n\t\tlast = i + 1;\n\t}\n\tif (i !== last) out = out + str.slice(last, i);\n\treturn out;\n}\n\nexport let indent = (s, char) =>\n\tString(s).replace(/(\\n+)/g, '$1' + (char || '\\t'));\n\nexport let isLargeString = (s, length, ignoreLines) =>\n\tString(s).length > (length || 40) ||\n\t(!ignoreLines && String(s).indexOf('\\n') !== -1) ||\n\tString(s).indexOf('<') !== -1;\n\nconst JS_TO_CSS = {};\n\nconst IS_NON_DIMENSIONAL = new Set([\n\t'animation-iteration-count',\n\t'border-image-outset',\n\t'border-image-slice',\n\t'border-image-width',\n\t'box-flex',\n\t'box-flex-group',\n\t'box-ordinal-group',\n\t'column-count',\n\t'fill-opacity',\n\t'flex',\n\t'flex-grow',\n\t'flex-negative',\n\t'flex-order',\n\t'flex-positive',\n\t'flex-shrink',\n\t'flood-opacity',\n\t'font-weight',\n\t'grid-column',\n\t'grid-row',\n\t'line-clamp',\n\t'line-height',\n\t'opacity',\n\t'order',\n\t'orphans',\n\t'stop-opacity',\n\t'stroke-dasharray',\n\t'stroke-dashoffset',\n\t'stroke-miterlimit',\n\t'stroke-opacity',\n\t'stroke-width',\n\t'tab-size',\n\t'widows',\n\t'z-index',\n\t'zoom'\n]);\n\nconst CSS_REGEX = /[A-Z]/g;\n// Convert an Object style to a CSSText string\nexport function styleObjToCss(s) {\n\tlet str = '';\n\tfor (let prop in s) {\n\t\tlet val = s[prop];\n\t\tif (val != null && val !== '') {\n\t\t\tconst name =\n\t\t\t\tprop[0] == '-'\n\t\t\t\t\t? prop\n\t\t\t\t\t: JS_TO_CSS[prop] ||\n\t\t\t\t\t (JS_TO_CSS[prop] = prop.replace(CSS_REGEX, '-$&').toLowerCase());\n\n\t\t\tlet suffix = ';';\n\t\t\tif (\n\t\t\t\ttypeof val === 'number' &&\n\t\t\t\t// Exclude custom-attributes\n\t\t\t\t!name.startsWith('--') &&\n\t\t\t\t!IS_NON_DIMENSIONAL.has(name)\n\t\t\t) {\n\t\t\t\tsuffix = 'px;';\n\t\t\t}\n\t\t\tstr = str + name + ':' + val + suffix;\n\t\t}\n\t}\n\treturn str || undefined;\n}\n\n/**\n * Get flattened children from the children prop\n * @param {Array} accumulator\n * @param {any} children A `props.children` opaque object.\n * @returns {Array} accumulator\n * @private\n */\nexport function getChildren(accumulator, children) {\n\tif (Array.isArray(children)) {\n\t\tchildren.reduce(getChildren, accumulator);\n\t} else if (children != null && children !== false) {\n\t\taccumulator.push(children);\n\t}\n\treturn accumulator;\n}\n\nfunction markAsDirty() {\n\tthis.__d = true;\n}\n\nexport function createComponent(vnode, context) {\n\treturn {\n\t\t__v: vnode,\n\t\tcontext,\n\t\tprops: vnode.props,\n\t\t// silently drop state updates\n\t\tsetState: markAsDirty,\n\t\tforceUpdate: markAsDirty,\n\t\t__d: true,\n\t\t// hooks\n\t\t// oxlint-disable-next-line no-new-array\n\t\t__h: new Array(0)\n\t};\n}\n\n// Necessary for createContext api. Setting this property will pass\n// the context value as `this.context` just for this component.\nexport function getContext(nodeName, context) {\n\tlet cxType = nodeName.contextType;\n\tlet provider = cxType && context[cxType.__c];\n\treturn cxType != null\n\t\t? provider\n\t\t\t? provider.props.value\n\t\t\t: cxType.__\n\t\t: context;\n}\n\n/**\n * @template T\n */\nexport class Deferred {\n\tconstructor() {\n\t\t/** @type {Promise<T>} */\n\t\tthis.promise = new Promise((resolve, reject) => {\n\t\t\tthis.resolve = resolve;\n\t\t\tthis.reject = reject;\n\t\t});\n\t}\n}\n","import {\n\tencodeEntities,\n\tstyleObjToCss,\n\tUNSAFE_NAME,\n\tNAMESPACE_REPLACE_REGEX,\n\tHTML_LOWER_CASE,\n\tHTML_ENUMERATED,\n\tSVG_CAMEL_CASE,\n\tcreateComponent,\n\tsetDirty,\n\tunsetDirty,\n\tisDirty\n} from './lib/util.js';\nimport { options, h, Fragment } from 'preact';\nimport {\n\tCHILDREN,\n\tCOMMIT,\n\tCOMPONENT,\n\tDIFF,\n\tDIFFED,\n\tNEXT_STATE,\n\tPARENT,\n\tRENDER,\n\tSKIP_EFFECTS,\n\tVNODE,\n\tCATCH_ERROR\n} from './lib/constants.js';\n\nconst EMPTY_OBJ = {};\nconst EMPTY_ARR = [];\nconst isArray = Array.isArray;\nconst assign = Object.assign;\nconst EMPTY_STR = '';\nconst BEGIN_SUSPENSE_DENOMINATOR = '<!--$s-->';\nconst END_SUSPENSE_DENOMINATOR = '<!--/$s-->';\n\n// Global state for the current render pass\nlet beforeDiff, afterDiff, renderHook, ummountHook;\n\n/**\n * Render Preact JSX + Components to an HTML string.\n * @param {VNode} vnode\tJSX Element / VNode to render\n * @param {Object} [context={}] Initial root context object\n * @param {RendererState} [_rendererState] for internal use\n * @returns {string} serialized HTML\n */\nexport function renderToString(vnode, context, _rendererState) {\n\t// Performance optimization: `renderToString` is synchronous and we\n\t// therefore don't execute any effects. To do that we pass an empty\n\t// array to `options._commit` (`__c`). But we can go one step further\n\t// and avoid a lot of dirty checks and allocations by setting\n\t// `options._skipEffects` (`__s`) too.\n\tconst previousSkipEffects = options[SKIP_EFFECTS];\n\toptions[SKIP_EFFECTS] = true;\n\n\t// store options hooks once before each synchronous render call\n\tbeforeDiff = options[DIFF];\n\tafterDiff = options[DIFFED];\n\trenderHook = options[RENDER];\n\tummountHook = options.unmount;\n\n\tconst parent = h(Fragment, null);\n\tparent[CHILDREN] = [vnode];\n\n\ttry {\n\t\tconst rendered = _renderToString(\n\t\t\tvnode,\n\t\t\tcontext || EMPTY_OBJ,\n\t\t\tfalse,\n\t\t\tundefined,\n\t\t\tparent,\n\t\t\tfalse,\n\t\t\t_rendererState\n\t\t);\n\n\t\tif (isArray(rendered)) {\n\t\t\treturn rendered.join(EMPTY_STR);\n\t\t}\n\t\treturn rendered;\n\t} catch (e) {\n\t\tif (e.then) {\n\t\t\tthrow new Error('Use \"renderToStringAsync\" for suspenseful rendering.');\n\t\t}\n\n\t\tthrow e;\n\t} finally {\n\t\t// options._commit, we don't schedule any effects in this library right now,\n\t\t// so we can pass an empty queue to this hook.\n\t\tif (options[COMMIT]) options[COMMIT](vnode, EMPTY_ARR);\n\t\toptions[SKIP_EFFECTS] = previousSkipEffects;\n\t\tEMPTY_ARR.length = 0;\n\t}\n}\n\n/**\n * Render Preact JSX + Components to an HTML string.\n * @param {VNode} vnode\tJSX Element / VNode to render\n * @param {Object} [context={}] Initial root context object\n * @returns {string} serialized HTML\n */\nexport async function renderToStringAsync(vnode, context) {\n\t// Performance optimization: `renderToString` is synchronous and we\n\t// therefore don't execute any effects. To do that we pass an empty\n\t// array to `options._commit` (`__c`). But we can go one step further\n\t// and avoid a lot of dirty checks and allocations by setting\n\t// `options._skipEffects` (`__s`) too.\n\tconst previousSkipEffects = options[SKIP_EFFECTS];\n\toptions[SKIP_EFFECTS] = true;\n\n\t// store options hooks once before each synchronous render call\n\tbeforeDiff = options[DIFF];\n\tafterDiff = options[DIFFED];\n\trenderHook = options[RENDER];\n\tummountHook = options.unmount;\n\n\tconst parent = h(Fragment, null);\n\tparent[CHILDREN] = [vnode];\n\n\ttry {\n\t\tconst rendered = await _renderToString(\n\t\t\tvnode,\n\t\t\tcontext || EMPTY_OBJ,\n\t\t\tfalse,\n\t\t\tundefined,\n\t\t\tparent,\n\t\t\ttrue,\n\t\t\tundefined\n\t\t);\n\n\t\tif (isArray(rendered)) {\n\t\t\tlet count = 0;\n\t\t\tlet resolved = rendered;\n\n\t\t\t// Resolving nested Promises with a maximum depth of 25\n\t\t\twhile (\n\t\t\t\tresolved.some(\n\t\t\t\t\t(element) => element && typeof element.then === 'function'\n\t\t\t\t) &&\n\t\t\t\tcount++ < 25\n\t\t\t) {\n\t\t\t\tresolved = (await Promise.all(resolved)).flat();\n\t\t\t}\n\n\t\t\treturn resolved.join(EMPTY_STR);\n\t\t}\n\n\t\treturn rendered;\n\t} finally {\n\t\t// options._commit, we don't schedule any effects in this library right now,\n\t\t// so we can pass an empty queue to this hook.\n\t\tif (options[COMMIT]) options[COMMIT](vnode, EMPTY_ARR);\n\t\toptions[SKIP_EFFECTS] = previousSkipEffects;\n\t\tEMPTY_ARR.length = 0;\n\t}\n}\n\n/**\n * @param {VNode} vnode\n * @param {Record<string, unknown>} context\n */\nfunction renderClassComponent(vnode, context) {\n\tlet type = /** @type {import(\"preact\").ComponentClass<typeof vnode.props>} */ (vnode.type);\n\n\tlet isMounting = true;\n\tlet c;\n\tif (vnode[COMPONENT]) {\n\t\tisMounting = false;\n\t\tc = vnode[COMPONENT];\n\t\tc.state = c[NEXT_STATE];\n\t} else {\n\t\tc = new type(vnode.props, context);\n\t}\n\n\tvnode[COMPONENT] = c;\n\tc[VNODE] = vnode;\n\n\tc.props = vnode.props;\n\tc.context = context;\n\n\t// Turn off stateful rendering\n\tsetDirty(c);\n\n\tif (c.state == null) c.state = EMPTY_OBJ;\n\n\tif (c[NEXT_STATE] == null) {\n\t\tc[NEXT_STATE] = c.state;\n\t}\n\n\tif (type.getDerivedStateFromProps) {\n\t\tc.state = assign(\n\t\t\t{},\n\t\t\tc.state,\n\t\t\ttype.getDerivedStateFromProps(c.props, c.state)\n\t\t);\n\t} else if (isMounting && c.componentWillMount) {\n\t\tc.componentWillMount();\n\n\t\t// If the user called setState in cWM we need to flush pending,\n\t\t// state updates. This is the same behaviour in React.\n\t\tc.state = c[NEXT_STATE] !== c.state ? c[NEXT_STATE] : c.state;\n\t} else if (!isMounting && c.componentWillUpdate) {\n\t\tc.componentWillUpdate();\n\t}\n\n\tif (renderHook) renderHook(vnode);\n\n\treturn c.render(c.props, c.state, context);\n}\n\n/**\n * Recursively render VNodes to HTML.\n * @param {VNode|any} vnode\n * @param {any} context\n * @param {boolean} isSvgMode\n * @param {any} selectValue\n * @param {VNode} parent\n * @param {boolean} asyncMode\n * @param {RendererState | undefined} [renderer]\n * @returns {string | Promise<string> | (string | Promise<string>)[]}\n */\nfunction _renderToString(\n\tvnode,\n\tcontext,\n\tisSvgMode,\n\tselectValue,\n\tparent,\n\tasyncMode,\n\trenderer\n) {\n\t// Ignore non-rendered VNodes/values\n\tif (\n\t\tvnode == null ||\n\t\tvnode === true ||\n\t\tvnode === false ||\n\t\tvnode === EMPTY_STR\n\t) {\n\t\treturn EMPTY_STR;\n\t}\n\n\tlet vnodeType = typeof vnode;\n\t// Text VNodes: escape as HTML\n\tif (vnodeType != 'object') {\n\t\tif (vnodeType == 'function') return EMPTY_STR;\n\t\treturn vnodeType == 'string' ? encodeEntities(vnode) : vnode + EMPTY_STR;\n\t}\n\n\t// Recurse into children / Arrays\n\tif (isArray(vnode)) {\n\t\tlet rendered = EMPTY_STR,\n\t\t\trenderArray;\n\t\tparent[CHILDREN] = vnode;\n\t\tconst vnodeLength = vnode.length;\n\t\tfor (let i = 0; i < vnodeLength; i++) {\n\t\t\tlet child = vnode[i];\n\t\t\tif (child == null || typeof child == 'boolean') continue;\n\n\t\t\tconst childRender = _renderToString(\n\t\t\t\tchild,\n\t\t\t\tcontext,\n\t\t\t\tisSvgMode,\n\t\t\t\tselectValue,\n\t\t\t\tparent,\n\t\t\t\tasyncMode,\n\t\t\t\trenderer\n\t\t\t);\n\n\t\t\tif (typeof childRender == 'string') {\n\t\t\t\trendered = rendered + childRender;\n\t\t\t} else {\n\t\t\t\tif (!renderArray) {\n\t\t\t\t\t// oxlint-disable-next-line no-new-array\n\t\t\t\t\trenderArray = new Array(vnodeLength);\n\t\t\t\t}\n\n\t\t\t\tif (rendered) renderArray.push(rendered);\n\n\t\t\t\trendered = EMPTY_STR;\n\n\t\t\t\tif (isArray(childRender)) {\n\t\t\t\t\trenderArray.push(...childRender);\n\t\t\t\t} else {\n\t\t\t\t\trenderArray.push(childRender);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (renderArray) {\n\t\t\tif (rendered) renderArray.push(rendered);\n\t\t\treturn renderArray;\n\t\t}\n\n\t\treturn rendered;\n\t}\n\n\t// VNodes have {constructor:undefined} to prevent JSON injection:\n\tif (vnode.constructor !== undefined) return EMPTY_STR;\n\n\tvnode[PARENT] = parent;\n\tif (beforeDiff) beforeDiff(vnode);\n\n\tlet type = vnode.type,\n\t\tprops = vnode.props;\n\n\t// Invoke rendering on Components\n\tif (typeof type == 'function') {\n\t\tlet cctx = context,\n\t\t\tcontextType,\n\t\t\trendered,\n\t\t\tcomponent;\n\t\tif (type === Fragment) {\n\t\t\t// Serialized precompiled JSX.\n\t\t\tif ('tpl' in props) {\n\t\t\t\tlet out = EMPTY_STR;\n\t\t\t\tfor (let i = 0; i < props.tpl.length; i++) {\n\t\t\t\t\tout = out + props.tpl[i];\n\n\t\t\t\t\tif (props.exprs && i < props.exprs.length) {\n\t\t\t\t\t\tconst value = props.exprs[i];\n\t\t\t\t\t\tif (value == null) continue;\n\n\t\t\t\t\t\t// Check if we're dealing with a vnode or an array of nodes\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\ttypeof value == 'object' &&\n\t\t\t\t\t\t\t(value.constructor === undefined || isArray(value))\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tout =\n\t\t\t\t\t\t\t\tout +\n\t\t\t\t\t\t\t\t_renderToString(\n\t\t\t\t\t\t\t\t\tvalue,\n\t\t\t\t\t\t\t\t\tcontext,\n\t\t\t\t\t\t\t\t\tisSvgMode,\n\t\t\t\t\t\t\t\t\tselectValue,\n\t\t\t\t\t\t\t\t\tvnode,\n\t\t\t\t\t\t\t\t\tasyncMode,\n\t\t\t\t\t\t\t\t\trenderer\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t// Values are pre-escaped by the JSX transform\n\t\t\t\t\t\t\tout = out + value;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn out;\n\t\t\t} else if ('UNSTABLE_comment' in props) {\n\t\t\t\t// Fragments are the least used components of core that's why\n\t\t\t\t// branching here for comments has the least effect on perf.\n\t\t\t\treturn '<!--' + encodeEntities(props.UNSTABLE_comment) + '-->';\n\t\t\t}\n\n\t\t\trendered = props.children;\n\t\t} else {\n\t\t\tcontextType = type.contextType;\n\t\t\tif (contextType != null) {\n\t\t\t\tlet provider = context[contextType.__c];\n\t\t\t\tcctx = provider ? provider.props.value : contextType.__;\n\t\t\t}\n\n\t\t\tlet isClassComponent =\n\t\t\t\ttype.prototype && typeof type.prototype.render == 'function';\n\t\t\tif (isClassComponent) {\n\t\t\t\trendered = /**#__NOINLINE__**/ renderClassComponent(vnode, cctx);\n\t\t\t\tcomponent = vnode[COMPONENT];\n\t\t\t} else {\n\t\t\t\tvnode[COMPONENT] = component = /**#__NOINLINE__**/ createComponent(\n\t\t\t\t\tvnode,\n\t\t\t\t\tcctx\n\t\t\t\t);\n\n\t\t\t\t// If a hook invokes setState() to invalidate the component during rendering,\n\t\t\t\t// re-render it up to 25 times to allow \"settling\" of memoized states.\n\t\t\t\t// Note:\n\t\t\t\t// This will need to be updated for Preact 11 to use internal.flags rather than component._dirty:\n\t\t\t\t// https://github.com/preactjs/preact/blob/d4ca6fdb19bc715e49fd144e69f7296b2f4daa40/src/diff/component.js#L35-L44\n\t\t\t\tlet count = 0;\n\t\t\t\twhile (isDirty(component) && count++ < 25) {\n\t\t\t\t\tunsetDirty(component);\n\n\t\t\t\t\tif (renderHook) renderHook(vnode);\n\n\t\t\t\t\ttry {\n\t\t\t\t\t\trendered = type.call(component, props, cctx);\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\tif (asyncMode && error && typeof error.then == 'function') {\n\t\t\t\t\t\t\tvnode._suspended = true;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tthrow error;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tsetDirty(component);\n\t\t\t}\n\n\t\t\tif (component.getChildContext != null) {\n\t\t\t\tcontext = assign({}, context, component.getChildContext());\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\tisClassComponent &&\n\t\t\t\toptions.errorBoundaries &&\n\t\t\t\t(type.getDerivedStateFromError || component.componentDidCatch)\n\t\t\t) {\n\t\t\t\t// When a component returns a Fragment node we flatten it in core, so we\n\t\t\t\t// need to mirror that logic here too\n\t\t\t\tlet isTopLevelFragment =\n\t\t\t\t\trendered != null &&\n\t\t\t\t\trendered.type === Fragment &&\n\t\t\t\t\trendered.key == null &&\n\t\t\t\t\trendered.props.tpl == null;\n\t\t\t\trendered = isTopLevelFragment ? rendered.props.children : rendered;\n\n\t\t\t\ttry {\n\t\t\t\t\treturn _renderToString(\n\t\t\t\t\t\trendered,\n\t\t\t\t\t\tcontext,\n\t\t\t\t\t\tisSvgMode,\n\t\t\t\t\t\tselectValue,\n\t\t\t\t\t\tvnode,\n\t\t\t\t\t\tasyncMode,\n\t\t\t\t\t\tfalse,\n\t\t\t\t\t\trenderer\n\t\t\t\t\t);\n\t\t\t\t} catch (err) {\n\t\t\t\t\tif (type.getDerivedStateFromError) {\n\t\t\t\t\t\tcomponent[NEXT_STATE] = type.getDerivedStateFromError(err);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (component.componentDidCatch) {\n\t\t\t\t\t\tcomponent.componentDidCatch(err, EMPTY_OBJ);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (isDirty(component)) {\n\t\t\t\t\t\trendered = renderClassComponent(vnode, context);\n\t\t\t\t\t\tcomponent = vnode[COMPONENT];\n\n\t\t\t\t\t\tif (component.getChildContext != null) {\n\t\t\t\t\t\t\tcontext = assign({}, context, component.getChildContext());\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tlet isTopLevelFragment =\n\t\t\t\t\t\t\trendered != null &&\n\t\t\t\t\t\t\trendered.type === Fragment &&\n\t\t\t\t\t\t\trendered.key == null &&\n\t\t\t\t\t\t\trendered.props.tpl == null;\n\t\t\t\t\t\trendered = isTopLevelFragment ? rendered.props.children : rendered;\n\n\t\t\t\t\t\treturn _renderToString(\n\t\t\t\t\t\t\trendered,\n\t\t\t\t\t\t\tcontext,\n\t\t\t\t\t\t\tisSvgMode,\n\t\t\t\t\t\t\tselectValue,\n\t\t\t\t\t\t\tvnode,\n\t\t\t\t\t\t\tasyncMode,\n\t\t\t\t\t\t\trenderer\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\treturn EMPTY_STR;\n\t\t\t\t} finally {\n\t\t\t\t\tif (afterDiff) afterDiff(vnode);\n\n\t\t\t\t\tif (ummountHook) ummountHook(vnode);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// When a component returns a Fragment node we flatten it in core, so we\n\t\t// need to mirror that logic here too\n\t\tlet isTopLevelFragment =\n\t\t\trendered != null &&\n\t\t\trendered.type === Fragment &&\n\t\t\trendered.key == null &&\n\t\t\trendered.props.tpl == null;\n\t\trendered = isTopLevelFragment ? rendered.props.children : rendered;\n\n\t\ttry {\n\t\t\t// Recurse into children before invoking the after-diff hook\n\t\t\tconst str = _renderToString(\n\t\t\t\trendered,\n\t\t\t\tcontext,\n\t\t\t\tisSvgMode,\n\t\t\t\tselectValue,\n\t\t\t\tvnode,\n\t\t\t\tasyncMode,\n\t\t\t\trenderer\n\t\t\t);\n\n\t\t\tif (afterDiff) afterDiff(vnode);\n\t\t\t// when we are dealing with suspense we can't do this...\n\n\t\t\tif (options.unmount) options.unmount(vnode);\n\n\t\t\tif (vnode._suspended) {\n\t\t\t\tif (typeof str === 'string') {\n\t\t\t\t\treturn BEGIN_SUSPENSE_DENOMINATOR + str + END_SUSPENSE_DENOMINATOR;\n\t\t\t\t} else if (isArray(str)) {\n\t\t\t\t\tstr.unshift(BEGIN_SUSPENSE_DENOMINATOR);\n\t\t\t\t\tstr.push(END_SUSPENSE_DENOMINATOR);\n\t\t\t\t\treturn str;\n\t\t\t\t}\n\n\t\t\t\treturn str.then(\n\t\t\t\t\t(resolved) =>\n\t\t\t\t\t\tBEGIN_SUSPENSE_DENOMINATOR + resolved + END_SUSPENSE_DENOMINATOR\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn str;\n\t\t} catch (error) {\n\t\t\tif (!asyncMode && renderer && renderer.onError) {\n\t\t\t\tconst onError = (error) => {\n\t\t\t\t\treturn renderer.onError(error, vnode, (child, parent) => {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\treturn _renderToString(\n\t\t\t\t\t\t\t\tchild,\n\t\t\t\t\t\t\t\tcontext,\n\t\t\t\t\t\t\t\tisSvgMode,\n\t\t\t\t\t\t\t\tselectValue,\n\t\t\t\t\t\t\t\tparent,\n\t\t\t\t\t\t\t\tasyncMode,\n\t\t\t\t\t\t\t\trenderer\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\t\treturn onError(e);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t};\n\t\t\t\tlet res = onError(error);\n\n\t\t\t\tif (res !== undefined) return res;\n\n\t\t\t\tlet errorHook = options[CATCH_ERROR];\n\t\t\t\tif (errorHook) errorHook(error, vnode);\n\t\t\t\treturn EMPTY_STR;\n\t\t\t}\n\n\t\t\tif (!asyncMode) throw error;\n\n\t\t\tif (!error || typeof error.then != 'function') throw error;\n\n\t\t\tconst renderNestedChildren = () => {\n\t\t\t\ttry {\n\t\t\t\t\tconst result = _renderToString(\n\t\t\t\t\t\trendered,\n\t\t\t\t\t\tcontext,\n\t\t\t\t\t\tisSvgMode,\n\t\t\t\t\t\tselectValue,\n\t\t\t\t\t\tvnode,\n\t\t\t\t\t\tasyncMode,\n\t\t\t\t\t\trenderer\n\t\t\t\t\t);\n\t\t\t\t\treturn vnode._suspended\n\t\t\t\t\t\t? BEGIN_SUSPENSE_DENOMINATOR + result + END_SUSPENSE_DENOMINATOR\n\t\t\t\t\t\t: result;\n\t\t\t\t} catch (e) {\n\t\t\t\t\tif (!e || typeof e.then != 'function') throw e;\n\n\t\t\t\t\treturn e.then(renderNestedChildren);\n\t\t\t\t}\n\t\t\t};\n\n\t\t\treturn error.then(renderNestedChildren);\n\t\t}\n\t}\n\n\t// Serialize Element VNodes to HTML\n\tlet s = '<' + type,\n\t\thtml = EMPTY_STR,\n\t\tchildren;\n\n\tfor (let name in props) {\n\t\tlet v = props[name];\n\t\tv = isSignal(v) ? v.value : v;\n\n\t\tif (typeof v == 'function' && name !== 'class' && name !== 'className') {\n\t\t\tcontinue;\n\t\t}\n\n\t\tswitch (name) {\n\t\t\tcase 'children':\n\t\t\t\tchildren = v;\n\t\t\t\tcontinue;\n\n\t\t\t// VDOM-specific props\n\t\t\tcase 'key':\n\t\t\tcase 'ref':\n\t\t\tcase '__self':\n\t\t\tcase '__source':\n\t\t\t\tcontinue;\n\n\t\t\t// prefer for/class over htmlFor/className\n\t\t\tcase 'htmlFor':\n\t\t\t\tif ('for' in props) continue;\n\t\t\t\tname = 'for';\n\t\t\t\tbreak;\n\t\t\tcase 'className':\n\t\t\t\tif ('class' in props) continue;\n\t\t\t\tname = 'class';\n\t\t\t\tbreak;\n\n\t\t\t// Form element reflected properties\n\t\t\tcase 'defaultChecked':\n\t\t\t\tname = 'checked';\n\t\t\t\tbreak;\n\t\t\tcase 'defaultSelected':\n\t\t\t\tname = 'selected';\n\t\t\t\tbreak;\n\n\t\t\t// Special value attribute handling\n\t\t\tcase 'defaultValue':\n\t\t\tcase 'value':\n\t\t\t\tname = 'value';\n\t\t\t\tswitch (type) {\n\t\t\t\t\t// <textarea value=\"a&b\"> --> <textarea>a&amp;b</textarea>\n\t\t\t\t\tcase 'textarea':\n\t\t\t\t\t\tchildren = v;\n\t\t\t\t\t\tcontinue;\n\n\t\t\t\t\t// <select value> is serialized as a selected attribute on the matching option child\n\t\t\t\t\tcase 'select':\n\t\t\t\t\t\tselectValue = v;\n\t\t\t\t\t\tcontinue;\n\n\t\t\t\t\t// Add a selected attribute to <option> if its value matches the parent <select> value\n\t\t\t\t\tcase 'option':\n\t\t\t\t\t\tif (selectValue == v && !('selected' in props)) {\n\t\t\t\t\t\t\ts = s + ' selected';\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tcase 'dangerouslySetInnerHTML':\n\t\t\t\thtml = v && v.__html;\n\t\t\t\tcontinue;\n\n\t\t\t// serialize object styles to a CSS string\n\t\t\tcase 'style':\n\t\t\t\tif (typeof v === 'object') {\n\t\t\t\t\tv = styleObjToCss(v);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 'acceptCharset':\n\t\t\t\tname = 'accept-charset';\n\t\t\t\tbreak;\n\t\t\tcase 'httpEquiv':\n\t\t\t\tname = 'http-equiv';\n\t\t\t\tbreak;\n\n\t\t\tdefault: {\n\t\t\t\tif (NAMESPACE_REPLACE_REGEX.test(name)) {\n\t\t\t\t\tname = name.replace(NAMESPACE_REPLACE_REGEX, '$1:$2').toLowerCase();\n\t\t\t\t} else if (UNSAFE_NAME.test(name)) {\n\t\t\t\t\tcontinue;\n\t\t\t\t} else if (\n\t\t\t\t\t(name[4] === '-' || HTML_ENUMERATED.has(name)) &&\n\t\t\t\t\tv != null\n\t\t\t\t) {\n\t\t\t\t\t// serialize boolean aria-xyz or enumerated attribute values as strings\n\t\t\t\t\tv = v + EMPTY_STR;\n\t\t\t\t} else if (isSvgMode) {\n\t\t\t\t\tif (SVG_CAMEL_CASE.test(name)) {\n\t\t\t\t\t\tname =\n\t\t\t\t\t\t\tname === 'panose1'\n\t\t\t\t\t\t\t\t? 'panose-1'\n\t\t\t\t\t\t\t\t: name.replace(/([A-Z])/g, '-$1').toLowerCase();\n\t\t\t\t\t}\n\t\t\t\t} else if (HTML_LOWER_CASE.test(name)) {\n\t\t\t\t\tname = name.toLowerCase();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// write this attribute to the buffer\n\t\tif (v != null && v !== false) {\n\t\t\tif (v === true || v === EMPTY_STR) {\n\t\t\t\ts = s + ' ' + name;\n\t\t\t} else {\n\t\t\t\ts =\n\t\t\t\t\ts +\n\t\t\t\t\t' ' +\n\t\t\t\t\tname +\n\t\t\t\t\t'=\"' +\n\t\t\t\t\t(typeof v == 'string' ? encodeEntities(v) : v + EMPTY_STR) +\n\t\t\t\t\t'\"';\n\t\t\t}\n\t\t}\n\t}\n\n\tif (UNSAFE_NAME.test(type)) {\n\t\t// this seems to performs a lot better than throwing\n\t\t// return '<!-- -->';\n\t\tthrow new Error(`${type} is not a valid HTML tag name in ${s}>`);\n\t}\n\n\tif (html) {\n\t\t// dangerouslySetInnerHTML defined this node's contents\n\t} else if (typeof children === 'string') {\n\t\t// single text child\n\t\thtml = encodeEntities(children);\n\t} else if (children != null && children !== false && children !== true) {\n\t\t// recurse into this element VNode's children\n\t\tlet childSvgMode =\n\t\t\ttype === 'svg' || (type !== 'foreignObject' && isSvgMode);\n\t\thtml = _renderToString(\n\t\t\tchildren,\n\t\t\tcontext,\n\t\t\tchildSvgMode,\n\t\t\tselectValue,\n\t\t\tvnode,\n\t\t\tasyncMode,\n\t\t\trenderer\n\t\t);\n\t}\n\n\tif (afterDiff) afterDiff(vnode);\n\n\tif (ummountHook) ummountHook(vnode);\n\n\t// Emit self-closing tag for empty void elements:\n\tif (!html && SELF_CLOSING.has(type)) {\n\t\treturn s + '/>';\n\t}\n\n\tconst endTag = '</' + type + '>';\n\tconst startTag = s + '>';\n\n\tif (isArray(html)) return [startTag, ...html, endTag];\n\telse if (typeof html != 'string') return [startTag, html, endTag];\n\treturn startTag + html + endTag;\n}\n\nconst SELF_CLOSING = new Set([\n\t'area',\n\t'base',\n\t'br',\n\t'col',\n\t'command',\n\t'embed',\n\t'hr',\n\t'img',\n\t'input',\n\t'keygen',\n\t'link',\n\t'meta',\n\t'param',\n\t'source',\n\t'track',\n\t'wbr'\n]);\n\nexport default renderToString;\nexport const render = renderToString;\nexport const renderToStaticMarkup = renderToString;\n\nfunction isSignal(x) {\n\treturn (\n\t\tx !== null &&\n\t\ttypeof x === 'object' &&\n\t\ttypeof x.peek === 'function' &&\n\t\t'value' in x\n\t);\n}\n","/* eslint-disable no-var, key-spacing, object-curly-spacing, prefer-arrow-callback, semi, keyword-spacing */\n\n// function initPreactIslandElement() {\n// \tclass PreactIslandElement extends HTMLElement {\n// \t\tconnectedCallback() {\n// \t\t\tvar d = this;\n// \t\t\tif (!d.isConnected) return;\n\n// \t\t\tlet i = this.getAttribute('data-target');\n// \t\t\tif (!i) return;\n\n// \t\t\tvar s,\n// \t\t\t\te,\n// \t\t\t\tc = document.createNodeIterator(document, 128);\n// \t\t\twhile (c.nextNode()) {\n// \t\t\t\tlet n = c.referenceNode;\n\n// \t\t\t\tif (n.data == 'preact-island:' + i) s = n;\n// \t\t\t\telse if (n.data == '/preact-island:' + i) e = n;\n// \t\t\t\tif (s && e) break;\n// \t\t\t}\n// \t\t\tif (s && e) {\n// \t\t\t\trequestAnimationFrame(() => {\n// \t\t\t\t\tvar p = e.previousSibling;\n// \t\t\t\t\twhile (p != s) {\n// \t\t\t\t\t\tif (!p || p == s) break;\n// \t\t\t\t\t\te.parentNode.removeChild(p);\n// \t\t\t\t\t\tp = e.previousSibling;\n// \t\t\t\t\t}\n\n// \t\t\t\t\tc = s;\n// \t\t\t\t\twhile (d.firstChild) {\n// \t\t\t\t\t\ts = d.firstChild;\n// \t\t\t\t\t\td.removeChild(s);\n// \t\t\t\t\t\tc.after(s);\n// \t\t\t\t\t\tc = s;\n// \t\t\t\t\t}\n\n// \t\t\t\t\td.parentNode.removeChild(d);\n// \t\t\t\t});\n// \t\t\t}\n// \t\t}\n// \t}\n\n// \tcustomElements.define('preact-island', PreactIslandElement);\n// }\n\n// To modify the INIT_SCRIPT, uncomment the above code, modify it, and paste it into https://try.terser.org/.\nconst INIT_SCRIPT = `class e extends HTMLElement{connectedCallback(){var e=this;if(!e.isConnected)return;let t=this.getAttribute(\"data-target\");if(t){for(var r,a,i=document.createNodeIterator(document,128);i.nextNode();){let e=i.referenceNode;if(e.data==\"preact-island:\"+t?r=e:e.data==\"/preact-island:\"+t&&(a=e),r&&a)break}r&&a&&requestAnimationFrame((()=>{for(var t=a.previousSibling;t!=r&&t&&t!=r;)a.parentNode.removeChild(t),t=a.previousSibling;for(i=r;e.firstChild;)r=e.firstChild,e.removeChild(r),i.after(r),i=r;e.parentNode.removeChild(e)}))}}}customElements.define(\"preact-island\",e);`;\n\nexport function createInitScript() {\n\treturn `<script>(function(){${INIT_SCRIPT}}())</script>`;\n}\n\n/**\n * @param {string} id\n * @param {string} content\n * @returns {string}\n */\nexport function createSubtree(id, content) {\n\treturn `<preact-island hidden data-target=\"${id}\">${content}</preact-island>`;\n}\n","import { renderToString } from '../index.js';\nimport { CHILD_DID_SUSPEND, COMPONENT, PARENT } from './constants.js';\nimport { Deferred } from './util.js';\nimport { createInitScript, createSubtree } from './client.js';\n\n/**\n * @param {VNode} vnode\n * @param {RenderToChunksOptions} options\n * @returns {Promise<void>}\n */\nexport async function renderToChunks(vnode, { context, onWrite, abortSignal }) {\n\tcontext = context || {};\n\n\t/** @type {RendererState} */\n\tconst renderer = {\n\t\tstart: Date.now(),\n\t\tabortSignal,\n\t\tonWrite,\n\t\tonError: handleError,\n\t\tsuspended: []\n\t};\n\n\t// Synchronously render the shell\n\t// @ts-ignore - using third internal RendererState argument\n\tconst shell = renderToString(vnode, context, renderer);\n\tonWrite(shell);\n\n\t// Wait for any suspended sub-trees if there are any\n\tconst len = renderer.suspended.length;\n\tif (len > 0) {\n\t\tonWrite('<div hidden>');\n\t\tonWrite(createInitScript(len));\n\t\t// We should keep checking all promises\n\t\tawait forkPromises(renderer);\n\t\tonWrite('</div>');\n\t}\n}\n\nasync function forkPromises(renderer) {\n\tif (renderer.suspended.length > 0) {\n\t\tconst suspensions = [...renderer.suspended];\n\t\tawait Promise.all(renderer.suspended.map((s) => s.promise));\n\t\trenderer.suspended = renderer.suspended.filter(\n\t\t\t(s) => !suspensions.includes(s)\n\t\t);\n\t\tawait forkPromises(renderer);\n\t}\n}\n\n/** @type {RendererErrorHandler} */\nfunction handleError(error, vnode, renderChild) {\n\tif (!error || !error.then) return;\n\n\t// walk up to the Suspense boundary\n\twhile ((vnode = vnode[PARENT])) {\n\t\tlet component = vnode[COMPONENT];\n\t\tif (component && component[CHILD_DID_SUSPEND]) {\n\t\t\tbreak;\n\t\t}\n\t}\n\n\tif (!vnode) return;\n\n\tconst id = vnode.__v;\n\tconst found = this.suspended.find((x) => x.id === id);\n\tconst race = new Deferred();\n\n\tconst abortSignal = this.abortSignal;\n\tif (abortSignal) {\n\t\t// @ts-ignore 2554 - implicit undefined arg\n\t\tif (abortSignal.aborted) race.resolve();\n\t\telse abortSignal.addEventListener('abort', race.resolve);\n\t}\n\n\tconst promise = error.then(\n\t\t() => {\n\t\t\tif (abortSignal && abortSignal.aborted) return;\n\t\t\tconst child = renderChild(vnode.props.children, vnode);\n\t\t\tif (child) this.onWrite(createSubtree(id, child));\n\t\t},\n\t\t// TODO: Abort and send hydration code snippet to client\n\t\t// to attempt to recover during hydration\n\t\tthis.onError\n\t);\n\n\tthis.suspended.push({\n\t\tid,\n\t\tvnode,\n\t\tpromise: Promise.race([promise, race.promise])\n\t});\n\n\tconst fallback = renderChild(vnode.props.fallback);\n\n\treturn found\n\t\t? ''\n\t\t: `<!--preact-island:${id}-->${fallback}<!--/preact-island:${id}-->`;\n}\n","import { Deferred } from './lib/util.js';\nimport { renderToChunks } from './lib/chunked.js';\n\n/** @typedef {ReadableStream<Uint8Array> & { allReady: Promise<void>}} RenderStream */\n\n/**\n * @param {import('preact').VNode} vnode\n * @param {any} [context]\n * @returns {RenderStream}\n */\nexport function renderToReadableStream(vnode, context) {\n\t/** @type {Deferred<void>} */\n\tconst allReady = new Deferred();\n\tconst encoder = new TextEncoder('utf-8');\n\n\t/** @type {RenderStream} */\n\tconst stream = new ReadableStream({\n\t\tstart(controller) {\n\t\t\trenderToChunks(vnode, {\n\t\t\t\tcontext,\n\t\t\t\tonError: (error) => {\n\t\t\t\t\tallReady.reject(error);\n\t\t\t\t\tcontroller.abort(error);\n\t\t\t\t},\n\t\t\t\tonWrite(s) {\n\t\t\t\t\tcontroller.enqueue(encoder.encode(s));\n\t\t\t\t}\n\t\t\t})\n\t\t\t\t.then(() => {\n\t\t\t\t\tcontroller.close();\n\t\t\t\t\tallReady.resolve();\n\t\t\t\t})\n\t\t\t\t.catch((error) => {\n\t\t\t\t\tcontroller.error(error);\n\t\t\t\t\tallReady.reject(error);\n\t\t\t\t});\n\t\t}\n\t});\n\n\tstream.allReady = allReady.promise;\n\n\treturn stream;\n}\n"],"names":["SKIP_EFFECTS","COMPONENT","DIRTY","NEXT_STATE","UNSAFE_NAME","NAMESPACE_REPLACE_REGEX","HTML_LOWER_CASE","SVG_CAMEL_CASE","HTML_ENUMERATED","Set","setDirty","component","undefined","unsetDirty","__g","isDirty","ENCODED_ENTITIES","encodeEntities","str","length","test","last","i","out","ch","charCodeAt","slice","JS_TO_CSS","IS_NON_DIMENSIONAL","CSS_REGEX","styleObjToCss","s","prop","val","name","replace","toLowerCase","suffix","startsWith","has","markAsDirty","this","__d","createComponent","vnode","context","__v","props","setState","forceUpdate","__h","Array","beforeDiff","afterDiff","renderHook","ummountHook","Deferred","_this","promise","Promise","resolve","reject","EMPTY_OBJ","EMPTY_ARR","isArray","assign","Object","EMPTY_STR","BEGIN_SUSPENSE_DENOMINATOR","END_SUSPENSE_DENOMINATOR","renderToString","_rendererState","previousSkipEffects","options","unmount","parent","h","Fragment","rendered","_renderToString","join","e","then","Error","renderClassComponent","c","type","isMounting","state","getDerivedStateFromProps","componentWillMount","componentWillUpdate","render","isSvgMode","selectValue","asyncMode","renderer","vnodeType","renderArray","vnodeLength","child","childRender","push","constructor","contextType","cctx","tpl","exprs","value","UNSTABLE_comment","children","provider","__c","__","isClassComponent","prototype","count","call","error","_suspended","getChildContext","errorBoundaries","getDerivedStateFromError","componentDidCatch","key","err","unshift","resolved","onError","res","errorHook","renderNestedChildren","result","html","v","isSignal","__html","SELF_CLOSING","endTag","startTag","x","peek","createSubtree","id","content","forkPromises","suspended","suspensions","concat","all","map","filter","includes","_temp4","renderToChunks","_ref","onWrite","abortSignal","start","Date","now","handleError","shell","len","_temp2","INIT_SCRIPT","renderChild","found","find","race","aborted","addEventListener","fallback","allReady","encoder","TextEncoder","stream","ReadableStream","controller","abort","enqueue","encode","close"],"mappings":"wBAKaA,EAAe,MAIfC,EAAY,MAOZC,EAAQ,MAERC,EAAa,MCdbC,EAAc,mBACdC,EAA0B,4BAC1BC,EAAkB,8JAClBC,EAAiB,yQAGjBC,EAAkB,IAAIC,IAAI,CAAC,YAAa,eAG9C,SAASC,EAASC,QACAC,IAApBD,EAAS,IACZA,EAAS,KAHwB,EAKjCA,EAAUT,IAAS,CAEpB,UAEeW,EAAWF,QACJC,IAAlBD,EAAUG,IACbH,EAAUG,MAAO,EAEjBH,EAAUT,IAAS,CAEpB,CAEM,SAASa,EAAQJ,GACvB,YAAsBC,IAAlBD,EAAUG,OAlBoB,EAmBzBH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../src/lib/util.js","../../src/index.js","../../src/lib/client.js","../../src/lib/chunked.js","../../src/stream.js"],"sourcesContent":["// Options hooks\nexport const DIFF = '__b';\nexport const RENDER = '__r';\nexport const DIFFED = 'diffed';\nexport const COMMIT = '__c';\nexport const SKIP_EFFECTS = '__s';\nexport const CATCH_ERROR = '__e';\n\n// VNode properties\nexport const COMPONENT = '__c';\nexport const CHILDREN = '__k';\nexport const PARENT = '__';\nexport const MASK = '__m';\n\n// Component properties\nexport const VNODE = '__v';\nexport const DIRTY = '__d';\nexport const BITS = '__g';\nexport const NEXT_STATE = '__s';\nexport const CHILD_DID_SUSPEND = '__c';\n","import { DIRTY, BITS } from './constants';\n\nexport const VOID_ELEMENTS = /^(?:area|base|br|col|embed|hr|img|input|link|meta|param|source|track|wbr)$/;\n// oxlint-disable-next-line no-control-regex\nexport const UNSAFE_NAME = /[\\s\\n\\\\/='\"\\0<>]/;\nexport const NAMESPACE_REPLACE_REGEX = /^(xlink|xmlns|xml)([A-Z])/;\nexport const HTML_LOWER_CASE = /^(?:accessK|auto[A-Z]|cell|ch|col|cont|cross|dateT|encT|form[A-Z]|frame|hrefL|inputM|maxL|minL|noV|playsI|popoverT|readO|rowS|src[A-Z]|tabI|useM|item[A-Z])/;\nexport const SVG_CAMEL_CASE = /^ac|^ali|arabic|basel|cap|clipPath$|clipRule$|color|dominant|enable|fill|flood|font|glyph[^R]|horiz|image|letter|lighting|marker[^WUH]|overline|panose|pointe|paint|rendering|shape|stop|strikethrough|stroke|text[^L]|transform|underline|unicode|units|^v[^i]|^w|^xH/;\n\n// Boolean DOM properties that translate to enumerated ('true'/'false') attributes\nexport const HTML_ENUMERATED = new Set(['draggable', 'spellcheck']);\n\nexport const COMPONENT_DIRTY_BIT = 1 << 3;\nexport function setDirty(component) {\n\tif (component[BITS] !== undefined) {\n\t\tcomponent[BITS] |= COMPONENT_DIRTY_BIT;\n\t} else {\n\t\tcomponent[DIRTY] = true;\n\t}\n}\n\nexport function unsetDirty(component) {\n\tif (component.__g !== undefined) {\n\t\tcomponent.__g &= ~COMPONENT_DIRTY_BIT;\n\t} else {\n\t\tcomponent[DIRTY] = false;\n\t}\n}\n\nexport function isDirty(component) {\n\tif (component.__g !== undefined) {\n\t\treturn (component.__g & COMPONENT_DIRTY_BIT) !== 0;\n\t}\n\treturn component[DIRTY] === true;\n}\n\n// DOM properties that should NOT have \"px\" added when numeric\nconst ENCODED_ENTITIES = /[\"&<]/;\n\n/** @param {string} str */\nexport function encodeEntities(str) {\n\t// Skip all work for strings with no entities needing encoding:\n\tif (str.length === 0 || ENCODED_ENTITIES.test(str) === false) return str;\n\n\tlet last = 0,\n\t\ti = 0,\n\t\tout = '',\n\t\tch = '';\n\n\t// Seek forward in str until the next entity char:\n\tfor (; i < str.length; i++) {\n\t\tswitch (str.charCodeAt(i)) {\n\t\t\tcase 34:\n\t\t\t\tch = '&quot;';\n\t\t\t\tbreak;\n\t\t\tcase 38:\n\t\t\t\tch = '&amp;';\n\t\t\t\tbreak;\n\t\t\tcase 60:\n\t\t\t\tch = '&lt;';\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tcontinue;\n\t\t}\n\t\t// Append skipped/buffered characters and the encoded entity:\n\t\tif (i !== last) out = out + str.slice(last, i);\n\t\tout = out + ch;\n\t\t// Start the next seek/buffer after the entity's offset:\n\t\tlast = i + 1;\n\t}\n\tif (i !== last) out = out + str.slice(last, i);\n\treturn out;\n}\n\nexport let indent = (s, char) =>\n\tString(s).replace(/(\\n+)/g, '$1' + (char || '\\t'));\n\nexport let isLargeString = (s, length, ignoreLines) =>\n\tString(s).length > (length || 40) ||\n\t(!ignoreLines && String(s).indexOf('\\n') !== -1) ||\n\tString(s).indexOf('<') !== -1;\n\nconst JS_TO_CSS = {};\n\nconst IS_NON_DIMENSIONAL = new Set([\n\t'animation-iteration-count',\n\t'border-image-outset',\n\t'border-image-slice',\n\t'border-image-width',\n\t'box-flex',\n\t'box-flex-group',\n\t'box-ordinal-group',\n\t'column-count',\n\t'fill-opacity',\n\t'flex',\n\t'flex-grow',\n\t'flex-negative',\n\t'flex-order',\n\t'flex-positive',\n\t'flex-shrink',\n\t'flood-opacity',\n\t'font-weight',\n\t'grid-column',\n\t'grid-row',\n\t'line-clamp',\n\t'line-height',\n\t'opacity',\n\t'order',\n\t'orphans',\n\t'stop-opacity',\n\t'stroke-dasharray',\n\t'stroke-dashoffset',\n\t'stroke-miterlimit',\n\t'stroke-opacity',\n\t'stroke-width',\n\t'tab-size',\n\t'widows',\n\t'z-index',\n\t'zoom'\n]);\n\nconst CSS_REGEX = /[A-Z]/g;\n// Convert an Object style to a CSSText string\nexport function styleObjToCss(s) {\n\tlet str = '';\n\tfor (let prop in s) {\n\t\tlet val = s[prop];\n\t\tif (val != null && val !== '') {\n\t\t\tconst name =\n\t\t\t\tprop[0] == '-'\n\t\t\t\t\t? prop\n\t\t\t\t\t: JS_TO_CSS[prop] ||\n\t\t\t\t\t (JS_TO_CSS[prop] = prop.replace(CSS_REGEX, '-$&').toLowerCase());\n\n\t\t\tlet suffix = ';';\n\t\t\tif (\n\t\t\t\ttypeof val === 'number' &&\n\t\t\t\t// Exclude custom-attributes\n\t\t\t\t!name.startsWith('--') &&\n\t\t\t\t!IS_NON_DIMENSIONAL.has(name)\n\t\t\t) {\n\t\t\t\tsuffix = 'px;';\n\t\t\t}\n\t\t\tstr = str + name + ':' + val + suffix;\n\t\t}\n\t}\n\treturn str || undefined;\n}\n\n/**\n * Get flattened children from the children prop\n * @param {Array} accumulator\n * @param {any} children A `props.children` opaque object.\n * @returns {Array} accumulator\n * @private\n */\nexport function getChildren(accumulator, children) {\n\tif (Array.isArray(children)) {\n\t\tchildren.reduce(getChildren, accumulator);\n\t} else if (children != null && children !== false) {\n\t\taccumulator.push(children);\n\t}\n\treturn accumulator;\n}\n\nfunction markAsDirty() {\n\tthis.__d = true;\n}\n\nexport function createComponent(vnode, context) {\n\treturn {\n\t\t__v: vnode,\n\t\tcontext,\n\t\tprops: vnode.props,\n\t\t// silently drop state updates\n\t\tsetState: markAsDirty,\n\t\tforceUpdate: markAsDirty,\n\t\t__d: true,\n\t\t// hooks\n\t\t// oxlint-disable-next-line no-new-array\n\t\t__h: new Array(0)\n\t};\n}\n\n// Necessary for createContext api. Setting this property will pass\n// the context value as `this.context` just for this component.\nexport function getContext(nodeName, context) {\n\tlet cxType = nodeName.contextType;\n\tlet provider = cxType && context[cxType.__c];\n\treturn cxType != null\n\t\t? provider\n\t\t\t? provider.props.value\n\t\t\t: cxType.__\n\t\t: context;\n}\n\n/**\n * @template T\n */\nexport class Deferred {\n\tconstructor() {\n\t\t/** @type {Promise<T>} */\n\t\tthis.promise = new Promise((resolve, reject) => {\n\t\t\tthis.resolve = resolve;\n\t\t\tthis.reject = reject;\n\t\t});\n\t}\n}\n","import {\n\tencodeEntities,\n\tstyleObjToCss,\n\tUNSAFE_NAME,\n\tNAMESPACE_REPLACE_REGEX,\n\tHTML_LOWER_CASE,\n\tHTML_ENUMERATED,\n\tSVG_CAMEL_CASE,\n\tcreateComponent,\n\tsetDirty,\n\tunsetDirty,\n\tisDirty\n} from './lib/util.js';\nimport { options, h, Fragment } from 'preact';\nimport {\n\tCHILDREN,\n\tCOMMIT,\n\tCOMPONENT,\n\tDIFF,\n\tDIFFED,\n\tNEXT_STATE,\n\tPARENT,\n\tRENDER,\n\tSKIP_EFFECTS,\n\tVNODE,\n\tCATCH_ERROR\n} from './lib/constants.js';\n\nconst EMPTY_OBJ = {};\nconst EMPTY_ARR = [];\nconst isArray = Array.isArray;\nconst assign = Object.assign;\nconst EMPTY_STR = '';\nconst BEGIN_SUSPENSE_DENOMINATOR = '<!--$s-->';\nconst END_SUSPENSE_DENOMINATOR = '<!--/$s-->';\n\n// Global state for the current render pass\nlet beforeDiff, afterDiff, renderHook, ummountHook;\n\n/**\n * Render Preact JSX + Components to an HTML string.\n * @param {VNode} vnode\tJSX Element / VNode to render\n * @param {Object} [context={}] Initial root context object\n * @param {RendererState} [_rendererState] for internal use\n * @returns {string} serialized HTML\n */\nexport function renderToString(vnode, context, _rendererState) {\n\t// Performance optimization: `renderToString` is synchronous and we\n\t// therefore don't execute any effects. To do that we pass an empty\n\t// array to `options._commit` (`__c`). But we can go one step further\n\t// and avoid a lot of dirty checks and allocations by setting\n\t// `options._skipEffects` (`__s`) too.\n\tconst previousSkipEffects = options[SKIP_EFFECTS];\n\toptions[SKIP_EFFECTS] = true;\n\n\t// store options hooks once before each synchronous render call\n\tbeforeDiff = options[DIFF];\n\tafterDiff = options[DIFFED];\n\trenderHook = options[RENDER];\n\tummountHook = options.unmount;\n\n\tconst parent = h(Fragment, null);\n\tparent[CHILDREN] = [vnode];\n\n\ttry {\n\t\tconst rendered = _renderToString(\n\t\t\tvnode,\n\t\t\tcontext || EMPTY_OBJ,\n\t\t\tfalse,\n\t\t\tundefined,\n\t\t\tparent,\n\t\t\tfalse,\n\t\t\t_rendererState\n\t\t);\n\n\t\tif (isArray(rendered)) {\n\t\t\treturn rendered.join(EMPTY_STR);\n\t\t}\n\t\treturn rendered;\n\t} catch (e) {\n\t\tif (e.then) {\n\t\t\tthrow new Error('Use \"renderToStringAsync\" for suspenseful rendering.');\n\t\t}\n\n\t\tthrow e;\n\t} finally {\n\t\t// options._commit, we don't schedule any effects in this library right now,\n\t\t// so we can pass an empty queue to this hook.\n\t\tif (options[COMMIT]) options[COMMIT](vnode, EMPTY_ARR);\n\t\toptions[SKIP_EFFECTS] = previousSkipEffects;\n\t\tEMPTY_ARR.length = 0;\n\t}\n}\n\n/**\n * Render Preact JSX + Components to an HTML string.\n * @param {VNode} vnode\tJSX Element / VNode to render\n * @param {Object} [context={}] Initial root context object\n * @returns {string} serialized HTML\n */\nexport async function renderToStringAsync(vnode, context) {\n\t// Performance optimization: `renderToString` is synchronous and we\n\t// therefore don't execute any effects. To do that we pass an empty\n\t// array to `options._commit` (`__c`). But we can go one step further\n\t// and avoid a lot of dirty checks and allocations by setting\n\t// `options._skipEffects` (`__s`) too.\n\tconst previousSkipEffects = options[SKIP_EFFECTS];\n\toptions[SKIP_EFFECTS] = true;\n\n\t// store options hooks once before each synchronous render call\n\tbeforeDiff = options[DIFF];\n\tafterDiff = options[DIFFED];\n\trenderHook = options[RENDER];\n\tummountHook = options.unmount;\n\n\tconst parent = h(Fragment, null);\n\tparent[CHILDREN] = [vnode];\n\n\ttry {\n\t\tconst rendered = await _renderToString(\n\t\t\tvnode,\n\t\t\tcontext || EMPTY_OBJ,\n\t\t\tfalse,\n\t\t\tundefined,\n\t\t\tparent,\n\t\t\ttrue,\n\t\t\tundefined\n\t\t);\n\n\t\tif (isArray(rendered)) {\n\t\t\tlet count = 0;\n\t\t\tlet resolved = rendered;\n\n\t\t\t// Resolving nested Promises with a maximum depth of 25\n\t\t\twhile (\n\t\t\t\tresolved.some(\n\t\t\t\t\t(element) => element && typeof element.then === 'function'\n\t\t\t\t) &&\n\t\t\t\tcount++ < 25\n\t\t\t) {\n\t\t\t\tresolved = (await Promise.all(resolved)).flat();\n\t\t\t}\n\n\t\t\treturn resolved.join(EMPTY_STR);\n\t\t}\n\n\t\treturn rendered;\n\t} finally {\n\t\t// options._commit, we don't schedule any effects in this library right now,\n\t\t// so we can pass an empty queue to this hook.\n\t\tif (options[COMMIT]) options[COMMIT](vnode, EMPTY_ARR);\n\t\toptions[SKIP_EFFECTS] = previousSkipEffects;\n\t\tEMPTY_ARR.length = 0;\n\t}\n}\n\n/**\n * @param {VNode} vnode\n * @param {Record<string, unknown>} context\n */\nfunction renderClassComponent(vnode, context) {\n\tlet type = /** @type {import(\"preact\").ComponentClass<typeof vnode.props>} */ (vnode.type);\n\n\tlet isMounting = true;\n\tlet c;\n\tif (vnode[COMPONENT]) {\n\t\tisMounting = false;\n\t\tc = vnode[COMPONENT];\n\t\tc.state = c[NEXT_STATE];\n\t} else {\n\t\tc = new type(vnode.props, context);\n\t}\n\n\tvnode[COMPONENT] = c;\n\tc[VNODE] = vnode;\n\n\tc.props = vnode.props;\n\tc.context = context;\n\n\t// Turn off stateful rendering\n\tsetDirty(c);\n\n\tif (c.state == null) c.state = EMPTY_OBJ;\n\n\tif (c[NEXT_STATE] == null) {\n\t\tc[NEXT_STATE] = c.state;\n\t}\n\n\tif (type.getDerivedStateFromProps) {\n\t\tc.state = assign(\n\t\t\t{},\n\t\t\tc.state,\n\t\t\ttype.getDerivedStateFromProps(c.props, c.state)\n\t\t);\n\t} else if (isMounting && c.componentWillMount) {\n\t\tc.componentWillMount();\n\n\t\t// If the user called setState in cWM we need to flush pending,\n\t\t// state updates. This is the same behaviour in React.\n\t\tc.state = c[NEXT_STATE] !== c.state ? c[NEXT_STATE] : c.state;\n\t} else if (!isMounting && c.componentWillUpdate) {\n\t\tc.componentWillUpdate();\n\t}\n\n\tif (renderHook) renderHook(vnode);\n\n\treturn c.render(c.props, c.state, context);\n}\n\n/**\n * Recursively render VNodes to HTML.\n * @param {VNode|any} vnode\n * @param {any} context\n * @param {boolean} isSvgMode\n * @param {any} selectValue\n * @param {VNode} parent\n * @param {boolean} asyncMode\n * @param {RendererState | undefined} [renderer]\n * @returns {string | Promise<string> | (string | Promise<string>)[]}\n */\nfunction _renderToString(\n\tvnode,\n\tcontext,\n\tisSvgMode,\n\tselectValue,\n\tparent,\n\tasyncMode,\n\trenderer\n) {\n\t// Ignore non-rendered VNodes/values\n\tif (\n\t\tvnode == null ||\n\t\tvnode === true ||\n\t\tvnode === false ||\n\t\tvnode === EMPTY_STR\n\t) {\n\t\treturn EMPTY_STR;\n\t}\n\n\tlet vnodeType = typeof vnode;\n\t// Text VNodes: escape as HTML\n\tif (vnodeType != 'object') {\n\t\tif (vnodeType == 'function') return EMPTY_STR;\n\t\treturn vnodeType == 'string' ? encodeEntities(vnode) : vnode + EMPTY_STR;\n\t}\n\n\t// Recurse into children / Arrays\n\tif (isArray(vnode)) {\n\t\tlet rendered = EMPTY_STR,\n\t\t\trenderArray;\n\t\tparent[CHILDREN] = vnode;\n\t\tconst vnodeLength = vnode.length;\n\t\tfor (let i = 0; i < vnodeLength; i++) {\n\t\t\tlet child = vnode[i];\n\t\t\tif (child == null || typeof child == 'boolean') continue;\n\n\t\t\tconst childRender = _renderToString(\n\t\t\t\tchild,\n\t\t\t\tcontext,\n\t\t\t\tisSvgMode,\n\t\t\t\tselectValue,\n\t\t\t\tparent,\n\t\t\t\tasyncMode,\n\t\t\t\trenderer\n\t\t\t);\n\n\t\t\tif (typeof childRender == 'string') {\n\t\t\t\trendered = rendered + childRender;\n\t\t\t} else {\n\t\t\t\tif (!renderArray) {\n\t\t\t\t\t// oxlint-disable-next-line no-new-array\n\t\t\t\t\trenderArray = new Array(vnodeLength);\n\t\t\t\t}\n\n\t\t\t\tif (rendered) renderArray.push(rendered);\n\n\t\t\t\trendered = EMPTY_STR;\n\n\t\t\t\tif (isArray(childRender)) {\n\t\t\t\t\trenderArray.push(...childRender);\n\t\t\t\t} else {\n\t\t\t\t\trenderArray.push(childRender);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (renderArray) {\n\t\t\tif (rendered) renderArray.push(rendered);\n\t\t\treturn renderArray;\n\t\t}\n\n\t\treturn rendered;\n\t}\n\n\t// VNodes have {constructor:undefined} to prevent JSON injection:\n\tif (vnode.constructor !== undefined) return EMPTY_STR;\n\n\tvnode[PARENT] = parent;\n\tif (beforeDiff) beforeDiff(vnode);\n\n\tlet type = vnode.type,\n\t\tprops = vnode.props;\n\n\t// Invoke rendering on Components\n\tif (typeof type == 'function') {\n\t\tlet cctx = context,\n\t\t\tcontextType,\n\t\t\trendered,\n\t\t\tcomponent;\n\t\tif (type === Fragment) {\n\t\t\t// Serialized precompiled JSX.\n\t\t\tif ('tpl' in props) {\n\t\t\t\tlet out = EMPTY_STR;\n\t\t\t\tfor (let i = 0; i < props.tpl.length; i++) {\n\t\t\t\t\tout = out + props.tpl[i];\n\n\t\t\t\t\tif (props.exprs && i < props.exprs.length) {\n\t\t\t\t\t\tconst value = props.exprs[i];\n\t\t\t\t\t\tif (value == null) continue;\n\n\t\t\t\t\t\t// Check if we're dealing with a vnode or an array of nodes\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\ttypeof value == 'object' &&\n\t\t\t\t\t\t\t(value.constructor === undefined || isArray(value))\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tout =\n\t\t\t\t\t\t\t\tout +\n\t\t\t\t\t\t\t\t_renderToString(\n\t\t\t\t\t\t\t\t\tvalue,\n\t\t\t\t\t\t\t\t\tcontext,\n\t\t\t\t\t\t\t\t\tisSvgMode,\n\t\t\t\t\t\t\t\t\tselectValue,\n\t\t\t\t\t\t\t\t\tvnode,\n\t\t\t\t\t\t\t\t\tasyncMode,\n\t\t\t\t\t\t\t\t\trenderer\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t// Values are pre-escaped by the JSX transform\n\t\t\t\t\t\t\tout = out + value;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn out;\n\t\t\t} else if ('UNSTABLE_comment' in props) {\n\t\t\t\t// Fragments are the least used components of core that's why\n\t\t\t\t// branching here for comments has the least effect on perf.\n\t\t\t\treturn '<!--' + encodeEntities(props.UNSTABLE_comment) + '-->';\n\t\t\t}\n\n\t\t\trendered = props.children;\n\t\t} else {\n\t\t\tcontextType = type.contextType;\n\t\t\tif (contextType != null) {\n\t\t\t\tlet provider = context[contextType.__c];\n\t\t\t\tcctx = provider ? provider.props.value : contextType.__;\n\t\t\t}\n\n\t\t\tlet isClassComponent =\n\t\t\t\ttype.prototype && typeof type.prototype.render == 'function';\n\t\t\tif (isClassComponent) {\n\t\t\t\trendered = /**#__NOINLINE__**/ renderClassComponent(vnode, cctx);\n\t\t\t\tcomponent = vnode[COMPONENT];\n\t\t\t} else {\n\t\t\t\tvnode[COMPONENT] = component = /**#__NOINLINE__**/ createComponent(\n\t\t\t\t\tvnode,\n\t\t\t\t\tcctx\n\t\t\t\t);\n\n\t\t\t\t// If a hook invokes setState() to invalidate the component during rendering,\n\t\t\t\t// re-render it up to 25 times to allow \"settling\" of memoized states.\n\t\t\t\t// Note:\n\t\t\t\t// This will need to be updated for Preact 11 to use internal.flags rather than component._dirty:\n\t\t\t\t// https://github.com/preactjs/preact/blob/d4ca6fdb19bc715e49fd144e69f7296b2f4daa40/src/diff/component.js#L35-L44\n\t\t\t\tlet count = 0;\n\t\t\t\twhile (isDirty(component) && count++ < 25) {\n\t\t\t\t\tunsetDirty(component);\n\n\t\t\t\t\tif (renderHook) renderHook(vnode);\n\n\t\t\t\t\ttry {\n\t\t\t\t\t\trendered = type.call(component, props, cctx);\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\tif (asyncMode && error && typeof error.then == 'function') {\n\t\t\t\t\t\t\tvnode._suspended = true;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tthrow error;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tsetDirty(component);\n\t\t\t}\n\n\t\t\tif (component.getChildContext != null) {\n\t\t\t\tcontext = assign({}, context, component.getChildContext());\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\tisClassComponent &&\n\t\t\t\toptions.errorBoundaries &&\n\t\t\t\t(type.getDerivedStateFromError || component.componentDidCatch)\n\t\t\t) {\n\t\t\t\t// When a component returns a Fragment node we flatten it in core, so we\n\t\t\t\t// need to mirror that logic here too\n\t\t\t\tlet isTopLevelFragment =\n\t\t\t\t\trendered != null &&\n\t\t\t\t\trendered.type === Fragment &&\n\t\t\t\t\trendered.key == null &&\n\t\t\t\t\trendered.props.tpl == null;\n\t\t\t\trendered = isTopLevelFragment ? rendered.props.children : rendered;\n\n\t\t\t\ttry {\n\t\t\t\t\treturn _renderToString(\n\t\t\t\t\t\trendered,\n\t\t\t\t\t\tcontext,\n\t\t\t\t\t\tisSvgMode,\n\t\t\t\t\t\tselectValue,\n\t\t\t\t\t\tvnode,\n\t\t\t\t\t\tasyncMode,\n\t\t\t\t\t\tfalse,\n\t\t\t\t\t\trenderer\n\t\t\t\t\t);\n\t\t\t\t} catch (err) {\n\t\t\t\t\tif (type.getDerivedStateFromError) {\n\t\t\t\t\t\tcomponent[NEXT_STATE] = type.getDerivedStateFromError(err);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (component.componentDidCatch) {\n\t\t\t\t\t\tcomponent.componentDidCatch(err, EMPTY_OBJ);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (isDirty(component)) {\n\t\t\t\t\t\trendered = renderClassComponent(vnode, context);\n\t\t\t\t\t\tcomponent = vnode[COMPONENT];\n\n\t\t\t\t\t\tif (component.getChildContext != null) {\n\t\t\t\t\t\t\tcontext = assign({}, context, component.getChildContext());\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tlet isTopLevelFragment =\n\t\t\t\t\t\t\trendered != null &&\n\t\t\t\t\t\t\trendered.type === Fragment &&\n\t\t\t\t\t\t\trendered.key == null &&\n\t\t\t\t\t\t\trendered.props.tpl == null;\n\t\t\t\t\t\trendered = isTopLevelFragment ? rendered.props.children : rendered;\n\n\t\t\t\t\t\treturn _renderToString(\n\t\t\t\t\t\t\trendered,\n\t\t\t\t\t\t\tcontext,\n\t\t\t\t\t\t\tisSvgMode,\n\t\t\t\t\t\t\tselectValue,\n\t\t\t\t\t\t\tvnode,\n\t\t\t\t\t\t\tasyncMode,\n\t\t\t\t\t\t\trenderer\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\treturn EMPTY_STR;\n\t\t\t\t} finally {\n\t\t\t\t\tif (afterDiff) afterDiff(vnode);\n\n\t\t\t\t\tif (ummountHook) ummountHook(vnode);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// When a component returns a Fragment node we flatten it in core, so we\n\t\t// need to mirror that logic here too\n\t\tlet isTopLevelFragment =\n\t\t\trendered != null &&\n\t\t\trendered.type === Fragment &&\n\t\t\trendered.key == null &&\n\t\t\trendered.props.tpl == null;\n\t\trendered = isTopLevelFragment ? rendered.props.children : rendered;\n\n\t\ttry {\n\t\t\t// Recurse into children before invoking the after-diff hook\n\t\t\tconst str = _renderToString(\n\t\t\t\trendered,\n\t\t\t\tcontext,\n\t\t\t\tisSvgMode,\n\t\t\t\tselectValue,\n\t\t\t\tvnode,\n\t\t\t\tasyncMode,\n\t\t\t\trenderer\n\t\t\t);\n\n\t\t\tif (afterDiff) afterDiff(vnode);\n\t\t\t// when we are dealing with suspense we can't do this...\n\n\t\t\tif (options.unmount) options.unmount(vnode);\n\n\t\t\tif (vnode._suspended) {\n\t\t\t\tif (typeof str === 'string') {\n\t\t\t\t\treturn BEGIN_SUSPENSE_DENOMINATOR + str + END_SUSPENSE_DENOMINATOR;\n\t\t\t\t} else if (isArray(str)) {\n\t\t\t\t\tstr.unshift(BEGIN_SUSPENSE_DENOMINATOR);\n\t\t\t\t\tstr.push(END_SUSPENSE_DENOMINATOR);\n\t\t\t\t\treturn str;\n\t\t\t\t}\n\n\t\t\t\treturn str.then(\n\t\t\t\t\t(resolved) =>\n\t\t\t\t\t\tBEGIN_SUSPENSE_DENOMINATOR + resolved + END_SUSPENSE_DENOMINATOR\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn str;\n\t\t} catch (error) {\n\t\t\tif (!asyncMode && renderer && renderer.onError) {\n\t\t\t\tconst onError = (error) => {\n\t\t\t\t\treturn renderer.onError(error, vnode, (child, parent) => {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\treturn _renderToString(\n\t\t\t\t\t\t\t\tchild,\n\t\t\t\t\t\t\t\tcontext,\n\t\t\t\t\t\t\t\tisSvgMode,\n\t\t\t\t\t\t\t\tselectValue,\n\t\t\t\t\t\t\t\tparent,\n\t\t\t\t\t\t\t\tasyncMode,\n\t\t\t\t\t\t\t\trenderer\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\t\treturn onError(e);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t};\n\t\t\t\tlet res = onError(error);\n\n\t\t\t\tif (res !== undefined) return res;\n\n\t\t\t\tlet errorHook = options[CATCH_ERROR];\n\t\t\t\tif (errorHook) errorHook(error, vnode);\n\t\t\t\treturn EMPTY_STR;\n\t\t\t}\n\n\t\t\tif (!asyncMode) throw error;\n\n\t\t\tif (!error || typeof error.then != 'function') throw error;\n\n\t\t\tconst renderNestedChildren = () => {\n\t\t\t\ttry {\n\t\t\t\t\tconst result = _renderToString(\n\t\t\t\t\t\trendered,\n\t\t\t\t\t\tcontext,\n\t\t\t\t\t\tisSvgMode,\n\t\t\t\t\t\tselectValue,\n\t\t\t\t\t\tvnode,\n\t\t\t\t\t\tasyncMode,\n\t\t\t\t\t\trenderer\n\t\t\t\t\t);\n\t\t\t\t\treturn vnode._suspended\n\t\t\t\t\t\t? BEGIN_SUSPENSE_DENOMINATOR + result + END_SUSPENSE_DENOMINATOR\n\t\t\t\t\t\t: result;\n\t\t\t\t} catch (e) {\n\t\t\t\t\tif (!e || typeof e.then != 'function') throw e;\n\n\t\t\t\t\treturn e.then(renderNestedChildren);\n\t\t\t\t}\n\t\t\t};\n\n\t\t\treturn error.then(renderNestedChildren);\n\t\t}\n\t}\n\n\t// Serialize Element VNodes to HTML\n\tlet s = '<' + type,\n\t\thtml = EMPTY_STR,\n\t\tchildren;\n\n\tfor (let name in props) {\n\t\tlet v = props[name];\n\t\tv = isSignal(v) ? v.value : v;\n\n\t\tif (typeof v == 'function' && name !== 'class' && name !== 'className') {\n\t\t\tcontinue;\n\t\t}\n\n\t\tswitch (name) {\n\t\t\tcase 'children':\n\t\t\t\tchildren = v;\n\t\t\t\tcontinue;\n\n\t\t\t// VDOM-specific props\n\t\t\tcase 'key':\n\t\t\tcase 'ref':\n\t\t\tcase '__self':\n\t\t\tcase '__source':\n\t\t\t\tcontinue;\n\n\t\t\t// prefer for/class over htmlFor/className\n\t\t\tcase 'htmlFor':\n\t\t\t\tif ('for' in props) continue;\n\t\t\t\tname = 'for';\n\t\t\t\tbreak;\n\t\t\tcase 'className':\n\t\t\t\tif ('class' in props) continue;\n\t\t\t\tname = 'class';\n\t\t\t\tbreak;\n\n\t\t\t// Form element reflected properties\n\t\t\tcase 'defaultChecked':\n\t\t\t\tname = 'checked';\n\t\t\t\tbreak;\n\t\t\tcase 'defaultSelected':\n\t\t\t\tname = 'selected';\n\t\t\t\tbreak;\n\n\t\t\t// Special value attribute handling\n\t\t\tcase 'defaultValue':\n\t\t\tcase 'value':\n\t\t\t\tname = 'value';\n\t\t\t\tswitch (type) {\n\t\t\t\t\t// <textarea value=\"a&b\"> --> <textarea>a&amp;b</textarea>\n\t\t\t\t\tcase 'textarea':\n\t\t\t\t\t\tchildren = v;\n\t\t\t\t\t\tcontinue;\n\n\t\t\t\t\t// <select value> is serialized as a selected attribute on the matching option child\n\t\t\t\t\tcase 'select':\n\t\t\t\t\t\tselectValue = v;\n\t\t\t\t\t\tcontinue;\n\n\t\t\t\t\t// Add a selected attribute to <option> if its value matches the parent <select> value\n\t\t\t\t\tcase 'option':\n\t\t\t\t\t\tif (selectValue == v && !('selected' in props)) {\n\t\t\t\t\t\t\ts = s + ' selected';\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tcase 'dangerouslySetInnerHTML':\n\t\t\t\thtml = v && v.__html;\n\t\t\t\tcontinue;\n\n\t\t\t// serialize object styles to a CSS string\n\t\t\tcase 'style':\n\t\t\t\tif (typeof v === 'object') {\n\t\t\t\t\tv = styleObjToCss(v);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 'acceptCharset':\n\t\t\t\tname = 'accept-charset';\n\t\t\t\tbreak;\n\t\t\tcase 'httpEquiv':\n\t\t\t\tname = 'http-equiv';\n\t\t\t\tbreak;\n\n\t\t\tdefault: {\n\t\t\t\tif (NAMESPACE_REPLACE_REGEX.test(name)) {\n\t\t\t\t\tname = name.replace(NAMESPACE_REPLACE_REGEX, '$1:$2').toLowerCase();\n\t\t\t\t} else if (UNSAFE_NAME.test(name)) {\n\t\t\t\t\tcontinue;\n\t\t\t\t} else if (\n\t\t\t\t\t(name[4] === '-' || HTML_ENUMERATED.has(name)) &&\n\t\t\t\t\tv != null\n\t\t\t\t) {\n\t\t\t\t\t// serialize boolean aria-xyz or enumerated attribute values as strings\n\t\t\t\t\tv = v + EMPTY_STR;\n\t\t\t\t} else if (isSvgMode) {\n\t\t\t\t\tif (SVG_CAMEL_CASE.test(name)) {\n\t\t\t\t\t\tname =\n\t\t\t\t\t\t\tname === 'panose1'\n\t\t\t\t\t\t\t\t? 'panose-1'\n\t\t\t\t\t\t\t\t: name.replace(/([A-Z])/g, '-$1').toLowerCase();\n\t\t\t\t\t}\n\t\t\t\t} else if (HTML_LOWER_CASE.test(name)) {\n\t\t\t\t\tname = name.toLowerCase();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// write this attribute to the buffer\n\t\tif (v != null && v !== false) {\n\t\t\tif (v === true || v === EMPTY_STR) {\n\t\t\t\ts = s + ' ' + name;\n\t\t\t} else {\n\t\t\t\ts =\n\t\t\t\t\ts +\n\t\t\t\t\t' ' +\n\t\t\t\t\tname +\n\t\t\t\t\t'=\"' +\n\t\t\t\t\t(typeof v == 'string' ? encodeEntities(v) : v + EMPTY_STR) +\n\t\t\t\t\t'\"';\n\t\t\t}\n\t\t}\n\t}\n\n\tif (UNSAFE_NAME.test(type)) {\n\t\t// this seems to performs a lot better than throwing\n\t\t// return '<!-- -->';\n\t\tthrow new Error(`${type} is not a valid HTML tag name in ${s}>`);\n\t}\n\n\tif (html) {\n\t\t// dangerouslySetInnerHTML defined this node's contents\n\t} else if (typeof children === 'string') {\n\t\t// single text child\n\t\thtml = encodeEntities(children);\n\t} else if (children != null && children !== false && children !== true) {\n\t\t// recurse into this element VNode's children\n\t\tlet childSvgMode =\n\t\t\ttype === 'svg' || (type !== 'foreignObject' && isSvgMode);\n\t\thtml = _renderToString(\n\t\t\tchildren,\n\t\t\tcontext,\n\t\t\tchildSvgMode,\n\t\t\tselectValue,\n\t\t\tvnode,\n\t\t\tasyncMode,\n\t\t\trenderer\n\t\t);\n\t}\n\n\tif (afterDiff) afterDiff(vnode);\n\n\tif (ummountHook) ummountHook(vnode);\n\n\t// Emit self-closing tag for empty void elements:\n\tif (!html && SELF_CLOSING.has(type)) {\n\t\treturn s + '/>';\n\t}\n\n\tconst endTag = '</' + type + '>';\n\tconst startTag = s + '>';\n\n\tif (isArray(html)) return [startTag, ...html, endTag];\n\telse if (typeof html != 'string') return [startTag, html, endTag];\n\treturn startTag + html + endTag;\n}\n\nconst SELF_CLOSING = new Set([\n\t'area',\n\t'base',\n\t'br',\n\t'col',\n\t'command',\n\t'embed',\n\t'hr',\n\t'img',\n\t'input',\n\t'keygen',\n\t'link',\n\t'meta',\n\t'param',\n\t'source',\n\t'track',\n\t'wbr'\n]);\n\nexport default renderToString;\nexport const render = renderToString;\nexport const renderToStaticMarkup = renderToString;\n\nfunction isSignal(x) {\n\treturn (\n\t\tx !== null &&\n\t\ttypeof x === 'object' &&\n\t\ttypeof x.peek === 'function' &&\n\t\t'value' in x\n\t);\n}\n","/* eslint-disable no-var, key-spacing, object-curly-spacing, prefer-arrow-callback, semi, keyword-spacing */\n\n// function initPreactIslandElement() {\n// \tclass PreactIslandElement extends HTMLElement {\n// \t\tconnectedCallback() {\n// \t\t\tvar d = this;\n// \t\t\tif (!d.isConnected) return;\n\n// \t\t\tlet i = this.getAttribute('data-target');\n// \t\t\tif (!i) return;\n\n// \t\t\tvar s,\n// \t\t\t\te,\n// \t\t\t\tc = document.createNodeIterator(document, 128);\n// \t\t\twhile (c.nextNode()) {\n// \t\t\t\tlet n = c.referenceNode;\n\n// \t\t\t\tif (n.data == 'preact-island:' + i) s = n;\n// \t\t\t\telse if (n.data == '/preact-island:' + i) e = n;\n// \t\t\t\tif (s && e) break;\n// \t\t\t}\n// \t\t\tif (s && e && s.parentNode !== document) {\n// \t\t\t\trequestAnimationFrame(() => {\n// \t\t\t\t\tvar p = e.previousSibling;\n// \t\t\t\t\twhile (p != s) {\n// \t\t\t\t\t\tif (!p || p == s) break;\n// \t\t\t\t\t\te.parentNode.removeChild(p);\n// \t\t\t\t\t\tp = e.previousSibling;\n// \t\t\t\t\t}\n\n// \t\t\t\t\tc = s;\n// \t\t\t\t\twhile (d.firstChild) {\n// \t\t\t\t\t\ts = d.firstChild;\n// \t\t\t\t\t\td.removeChild(s);\n// \t\t\t\t\t\tc.after(s);\n// \t\t\t\t\t\tc = s;\n// \t\t\t\t\t}\n\n// \t\t\t\t\td.parentNode.removeChild(d);\n// \t\t\t\t});\n// \t\t\t}\n// \t\t}\n// \t}\n\n// \tcustomElements.define('preact-island', PreactIslandElement);\n// }\n\n// To modify the INIT_SCRIPT, uncomment the above code, modify it, and paste it into https://try.terser.org/.\nconst INIT_SCRIPT = `class e extends HTMLElement{connectedCallback(){var e=this;if(!e.isConnected)return;let t=this.getAttribute(\"data-target\");if(t){for(var r,a,i=document.createNodeIterator(document,128);i.nextNode();){let e=i.referenceNode;if(e.data==\"preact-island:\"+t?r=e:e.data==\"/preact-island:\"+t&&(a=e),r&&a)break}r&&a&&r.parentNode!==document&&requestAnimationFrame((()=>{for(var t=a.previousSibling;t!=r&&t&&t!=r;)a.parentNode.removeChild(t),t=a.previousSibling;for(i=r;e.firstChild;)r=e.firstChild,e.removeChild(r),i.after(r),i=r;e.parentNode.removeChild(e)}))}}}customElements.define(\"preact-island\",e);`;\n\nexport function createInitScript() {\n\treturn `<script>(function(){${INIT_SCRIPT}}())</script>`;\n}\n\n/**\n * @param {string} id\n * @param {string} content\n * @returns {string}\n */\nexport function createSubtree(id, content) {\n\treturn `<preact-island hidden data-target=\"${id}\">${content}</preact-island>`;\n}\n","import { renderToString } from '../index.js';\nimport { CHILD_DID_SUSPEND, COMPONENT, PARENT } from './constants.js';\nimport { Deferred } from './util.js';\nimport { createInitScript, createSubtree } from './client.js';\n\n/**\n * @param {VNode} vnode\n * @param {RenderToChunksOptions} options\n * @returns {Promise<void>}\n */\nexport async function renderToChunks(vnode, { context, onWrite, abortSignal }) {\n\tcontext = context || {};\n\n\t/** @type {RendererState} */\n\tconst renderer = {\n\t\tstart: Date.now(),\n\t\tabortSignal,\n\t\tonWrite,\n\t\tonError: handleError,\n\t\tsuspended: []\n\t};\n\n\t// Synchronously render the shell\n\t// @ts-ignore - using third internal RendererState argument\n\tconst shell = renderToString(vnode, context, renderer);\n\n\t// Wait for any suspended sub-trees if there are any\n\tconst len = renderer.suspended.length;\n\tif (len > 0) {\n\t\t// When rendering a full HTML document, the shell ends with </body></html>.\n\t\t// Inserting the deferred <div hidden> wrapper after </html> is invalid HTML\n\t\t// and causes browsers to reject the content. Instead, we inject the deferred\n\t\t// content before the closing tags, then emit them last.\n\t\tconst docSuffixIndex = getDocumentClosingTagsIndex(shell);\n\t\tconst hasHtmlTag = shell.trimStart().startsWith('<html');\n\t\tconst initialWrite =\n\t\t\tdocSuffixIndex !== -1 ? shell.slice(0, docSuffixIndex) : shell;\n\t\tconst prefix = hasHtmlTag ? '<!DOCTYPE html>' : '';\n\t\tonWrite(prefix + initialWrite);\n\t\tonWrite('<div hidden>');\n\t\tonWrite(createInitScript(len));\n\t\t// We should keep checking all promises\n\t\tawait forkPromises(renderer);\n\t\tonWrite('</div>');\n\t\tif (docSuffixIndex !== -1) onWrite(shell.slice(docSuffixIndex));\n\t} else {\n\t\tonWrite(shell);\n\t}\n}\n\n/**\n * If the shell ends with </body></html> (full document rendering), return that\n * suffix so it can be emitted *after* the deferred content, keeping the HTML valid.\n * @param {string} html\n * @returns {number}\n */\nfunction getDocumentClosingTagsIndex(html) {\n\treturn html.lastIndexOf('</body>');\n}\n\nasync function forkPromises(renderer) {\n\tif (renderer.suspended.length > 0) {\n\t\tconst suspensions = [...renderer.suspended];\n\t\tawait Promise.all(renderer.suspended.map((s) => s.promise));\n\t\trenderer.suspended = renderer.suspended.filter(\n\t\t\t(s) => !suspensions.includes(s)\n\t\t);\n\t\tawait forkPromises(renderer);\n\t}\n}\n\n/** @type {RendererErrorHandler} */\nfunction handleError(error, vnode, renderChild) {\n\tif (!error || !error.then) return;\n\n\t// walk up to the Suspense boundary\n\twhile ((vnode = vnode[PARENT])) {\n\t\tlet component = vnode[COMPONENT];\n\t\tif (component && component[CHILD_DID_SUSPEND]) {\n\t\t\tbreak;\n\t\t}\n\t}\n\n\tif (!vnode) return;\n\n\tconst id = vnode.__v;\n\tconst found = this.suspended.find((x) => x.id === id);\n\tconst race = new Deferred();\n\n\tconst abortSignal = this.abortSignal;\n\tif (abortSignal) {\n\t\t// @ts-ignore 2554 - implicit undefined arg\n\t\tif (abortSignal.aborted) race.resolve();\n\t\telse abortSignal.addEventListener('abort', race.resolve);\n\t}\n\n\tconst promise = error.then(\n\t\t() => {\n\t\t\tif (abortSignal && abortSignal.aborted) return;\n\t\t\tconst child = renderChild(vnode.props.children, vnode);\n\t\t\tif (child) this.onWrite(createSubtree(id, child));\n\t\t},\n\t\t// TODO: Abort and send hydration code snippet to client\n\t\t// to attempt to recover during hydration\n\t\tthis.onError\n\t);\n\n\tthis.suspended.push({\n\t\tid,\n\t\tvnode,\n\t\tpromise: Promise.race([promise, race.promise])\n\t});\n\n\tconst fallback = renderChild(vnode.props.fallback);\n\n\treturn found\n\t\t? ''\n\t\t: `<!--preact-island:${id}-->${fallback}<!--/preact-island:${id}-->`;\n}\n","import { Deferred } from './lib/util.js';\nimport { renderToChunks } from './lib/chunked.js';\n\n/** @typedef {ReadableStream<Uint8Array> & { allReady: Promise<void>}} RenderStream */\n\n/**\n * @param {import('preact').VNode} vnode\n * @param {any} [context]\n * @returns {RenderStream}\n */\nexport function renderToReadableStream(vnode, context) {\n\t/** @type {Deferred<void>} */\n\tconst allReady = new Deferred();\n\tconst encoder = new TextEncoder('utf-8');\n\n\t/** @type {RenderStream} */\n\tconst stream = new ReadableStream({\n\t\tstart(controller) {\n\t\t\trenderToChunks(vnode, {\n\t\t\t\tcontext,\n\t\t\t\tonError: (error) => {\n\t\t\t\t\tallReady.reject(error);\n\t\t\t\t\tcontroller.abort(error);\n\t\t\t\t},\n\t\t\t\tonWrite(s) {\n\t\t\t\t\tcontroller.enqueue(encoder.encode(s));\n\t\t\t\t}\n\t\t\t})\n\t\t\t\t.then(() => {\n\t\t\t\t\tcontroller.close();\n\t\t\t\t\tallReady.resolve();\n\t\t\t\t})\n\t\t\t\t.catch((error) => {\n\t\t\t\t\tcontroller.error(error);\n\t\t\t\t\tallReady.reject(error);\n\t\t\t\t});\n\t\t}\n\t});\n\n\tstream.allReady = allReady.promise;\n\n\treturn stream;\n}\n"],"names":["SKIP_EFFECTS","COMPONENT","DIRTY","NEXT_STATE","UNSAFE_NAME","NAMESPACE_REPLACE_REGEX","HTML_LOWER_CASE","SVG_CAMEL_CASE","HTML_ENUMERATED","Set","setDirty","component","undefined","unsetDirty","__g","isDirty","ENCODED_ENTITIES","encodeEntities","str","length","test","last","i","out","ch","charCodeAt","slice","JS_TO_CSS","IS_NON_DIMENSIONAL","CSS_REGEX","styleObjToCss","s","prop","val","name","replace","toLowerCase","suffix","startsWith","has","markAsDirty","this","__d","createComponent","vnode","context","__v","props","setState","forceUpdate","__h","Array","beforeDiff","afterDiff","renderHook","ummountHook","Deferred","_this","promise","Promise","resolve","reject","EMPTY_OBJ","EMPTY_ARR","isArray","assign","Object","EMPTY_STR","BEGIN_SUSPENSE_DENOMINATOR","END_SUSPENSE_DENOMINATOR","renderToString","_rendererState","previousSkipEffects","options","unmount","parent","h","Fragment","rendered","_renderToString","join","e","then","Error","renderClassComponent","c","type","isMounting","state","getDerivedStateFromProps","componentWillMount","componentWillUpdate","render","isSvgMode","selectValue","asyncMode","renderer","vnodeType","renderArray","vnodeLength","child","childRender","push","constructor","contextType","cctx","tpl","exprs","value","UNSTABLE_comment","children","provider","__c","__","isClassComponent","prototype","count","call","error","_suspended","getChildContext","errorBoundaries","getDerivedStateFromError","componentDidCatch","key","err","unshift","resolved","onError","res","errorHook","renderNestedChildren","result","html","v","isSignal","__html","SELF_CLOSING","endTag","startTag","x","peek","createSubtree","id","content","forkPromises","suspended","suspensions","all","map","filter","includes","_temp4","renderToChunks","_ref","onWrite","abortSignal","start","Date","now","handleError","shell","len","docSuffixIndex","lastIndexOf","hasHtmlTag","trimStart","initialWrite","INIT_SCRIPT","_temp2","renderChild","found","find","race","aborted","addEventListener","fallback","allReady","encoder","TextEncoder","stream","ReadableStream","controller","abort","enqueue","encode","close"],"mappings":"wBAKaA,EAAe,MAIfC,EAAY,MAOZC,EAAQ,MAERC,EAAa,MCdbC,EAAc,mBACdC,EAA0B,4BAC1BC,EAAkB,8JAClBC,EAAiB,yQAGjBC,EAAkB,IAAIC,IAAI,CAAC,YAAa,eAG9C,SAASC,EAASC,QACAC,IAApBD,EAAS,IACZA,EAAS,KAHwB,EAKjCA,EAAUT,IAAS,CAEpB,UAEeW,EAAWF,QACJC,IAAlBD,EAAUG,IACbH,EAAUG,MAAO,EAEjBH,EAAUT,IAAS,CAEpB,CAEM,SAASa,EAAQJ,GACvB,YAAsBC,IAAlBD,EAAUG,OAlBoB,EAmBzBH,EAAUG,MAES,IAArBH,EAAUT,EACjB,CAGD,IAAMc,EAAmB,QAGTC,SAAAA,EAAeC,GAE9B,GAAmB,IAAfA,EAAIC,SAA+C,IAA/BH,EAAiBI,KAAKF,GAAgB,OAAOA,EAQrE,IANA,IAAIG,EAAO,EACVC,EAAI,EACJC,EAAM,GACNC,EAAK,GAGCF,EAAIJ,EAAIC,OAAQG,IAAK,CAC3B,OAAQJ,EAAIO,WAAWH,IACtB,KAAA,GACCE,EAAK,SACL,MACD,QACCA,EAAK,QACL,MACD,KAAA,GACCA,EAAK,OACL,MACD,QACC,SAGEF,IAAMD,IAAME,GAAYL,EAAIQ,MAAML,EAAMC,IAC5CC,GAAYC,EAEZH,EAAOC,EAAI,CACX,CAED,OADIA,IAAMD,IAAME,GAAYL,EAAIQ,MAAML,EAAMC,IACrCC,CACP,CAUD,IAAMI,EAAY,GAEZC,EAAqB,IAAInB,IAAI,CAClC,4BACA,sBACA,qBACA,qBACA,WACA,iBACA,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QAAQb,EAAcC,EAAI3C,GAD1C,CAEA,EAGD3D,KAAKuF,SAGNvF,KAAKyG,UAAU5C,KAAK,CACnByC,GAAAA,EACAnG,MAAAA,EACAc,QAASC,QAAQkH,KAAK,CAACnH,EAASmH,EAAKnH,YAGtC,IAAMsH,EAAWN,EAAY9H,EAAMG,MAAMiI,UAEzC,OAAOL,EACJ,GADS,wBAEY5B,EAFZ,SAEoBiC,EAFpB,yBAEkDjC,EAC9D,QAjCA,CAZ2B,CA6C3B,gCC5GM,SAAgCnG,EAAOC,GAE7C,IAAMoI,EAAW,IAAIzH,EACf0H,EAAU,IAAIC,YAAY,SAG1BC,EAAS,IAAIC,eAAe,CACjCxB,MADiC,SAC3ByB,GACL7B,EAAe7G,EAAO,CACrBC,QAAAA,EACAmF,QAAS,SAACV,GACT2D,EAASpH,OAAOyD,GAChBgE,EAAWC,MAAMjE,EACjB,EACDqC,QAAQ5H,SAAAA,GACPuJ,EAAWE,QAAQN,EAAQO,OAAO1J,GAClC,IAEAmD,KAAK,WACLoG,EAAWI,QACXT,EAASrH,SACT,GAbF,MAcQ,SAAC0D,GACPgE,EAAWhE,MAAMA,GACjB2D,EAASpH,OAAOyD,EAChB,EACF,IAKF,OAFA8D,EAAOH,SAAWA,EAASvH,QAEpB0H,CACP"}
@@ -1,2 +1,2 @@
1
- import{options as e,h as t,Fragment as r}from"preact";var n="__s",o="__c",i="__d",a="__s",s=/[\s\n\\/='"\0<>]/,c=/^(xlink|xmlns|xml)([A-Z])/,l=/^(?:accessK|auto[A-Z]|cell|ch|col|cont|cross|dateT|encT|form[A-Z]|frame|hrefL|inputM|maxL|minL|noV|playsI|popoverT|readO|rowS|src[A-Z]|tabI|useM|item[A-Z])/,u=/^ac|^ali|arabic|basel|cap|clipPath$|clipRule$|color|dominant|enable|fill|flood|font|glyph[^R]|horiz|image|letter|lighting|marker[^WUH]|overline|panose|pointe|paint|rendering|shape|stop|strikethrough|stroke|text[^L]|transform|underline|unicode|units|^v[^i]|^w|^xH/,p=new Set(["draggable","spellcheck"]);function f(e){void 0!==e.__g?e.__g|=8:e[i]=!0}function d(e){void 0!==e.__g?e.__g&=-9:e[i]=!1}function h(e){return void 0!==e.__g?!!(8&e.__g):!0===e[i]}var v=/["&<]/;function m(e){if(0===e.length||!1===v.test(e))return e;for(var t=0,r=0,n="",o="";r<e.length;r++){switch(e.charCodeAt(r)){case 34:o="&quot;";break;case 38:o="&amp;";break;case 60:o="&lt;";break;default:continue}r!==t&&(n+=e.slice(t,r)),n+=o,t=r+1}return r!==t&&(n+=e.slice(t,r)),n}var g={},_=new Set(["animation-iteration-count","border-image-outset","border-image-slice","border-image-width","box-flex","box-flex-group","box-ordinal-group","column-count","fill-opacity","flex","flex-grow","flex-negative","flex-order","flex-positive","flex-shrink","flood-opacity","font-weight","grid-column","grid-row","line-clamp","line-height","opacity","order","orphans","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","widows","z-index","zoom"]),y=/[A-Z]/g;function b(e){var t="";for(var r in e){var n=e[r];if(null!=n&&""!==n){var o="-"==r[0]?r:g[r]||(g[r]=r.replace(y,"-$&").toLowerCase()),i=";";"number"!=typeof n||o.startsWith("--")||_.has(o)||(i="px;"),t=t+o+":"+n+i}}return t||void 0}function x(){this.__d=!0}function k(e,t){return{__v:e,context:t,props:e.props,setState:x,forceUpdate:x,__d:!0,__h:new Array(0)}}var w,C,S,A,E=function(){var e=this;this.promise=new Promise(function(t,r){e.resolve=t,e.reject=r})},L={},P=[],j=Array.isArray,T=Object.assign,W="",D="\x3c!--$s--\x3e",N="\x3c!--/$s--\x3e";function $(o,i,a){var s=e[n];e[n]=!0,w=e.__b,C=e.diffed,S=e.__r,A=e.unmount;var c=t(r,null);c.__k=[o];try{var l=M(o,i||L,!1,void 0,c,!1,a);return j(l)?l.join(W):l}catch(e){if(e.then)throw new Error('Use "renderToStringAsync" for suspenseful rendering.');throw e}finally{e.__c&&e.__c(o,P),e[n]=s,P.length=0}}function F(e,t){var r,n=e.type,i=!0;return e[o]?(i=!1,(r=e[o]).state=r[a]):r=new n(e.props,t),e[o]=r,r.__v=e,r.props=e.props,r.context=t,f(r),null==r.state&&(r.state=L),null==r[a]&&(r[a]=r.state),n.getDerivedStateFromProps?r.state=T({},r.state,n.getDerivedStateFromProps(r.props,r.state)):i&&r.componentWillMount?(r.componentWillMount(),r.state=r[a]!==r.state?r[a]:r.state):!i&&r.componentWillUpdate&&r.componentWillUpdate(),S&&S(e),r.render(r.props,r.state,t)}function M(t,n,i,v,g,_,y){if(null==t||!0===t||!1===t||t===W)return W;var x=typeof t;if("object"!=x)return"function"==x?W:"string"==x?m(t):t+W;if(j(t)){var E,P=W;g.__k=t;for(var $=t.length,q=0;q<$;q++){var H=t[q];if(null!=H&&"boolean"!=typeof H){var z,I=M(H,n,i,v,g,_,y);"string"==typeof I?P+=I:(E||(E=new Array($)),P&&E.push(P),P=W,j(I)?(z=E).push.apply(z,I):E.push(I))}}return E?(P&&E.push(P),E):P}if(void 0!==t.constructor)return W;t.__=g,w&&w(t);var R=t.type,B=t.props;if("function"==typeof R){var O,V,K,G=n;if(R===r){if("tpl"in B){for(var J=W,Q=0;Q<B.tpl.length;Q++)if(J+=B.tpl[Q],B.exprs&&Q<B.exprs.length){var X=B.exprs[Q];if(null==X)continue;"object"!=typeof X||void 0!==X.constructor&&!j(X)?J+=X:J+=M(X,n,i,v,t,_,y)}return J}if("UNSTABLE_comment"in B)return"\x3c!--"+m(B.UNSTABLE_comment)+"--\x3e";V=B.children}else{if(null!=(O=R.contextType)){var Y=n[O.__c];G=Y?Y.props.value:O.__}var ee=R.prototype&&"function"==typeof R.prototype.render;if(ee)V=/**#__NOINLINE__**/F(t,G),K=t[o];else{t[o]=K=/**#__NOINLINE__**/k(t,G);for(var te=0;h(K)&&te++<25;){d(K),S&&S(t);try{V=R.call(K,B,G)}catch(e){throw _&&e&&"function"==typeof e.then&&(t._suspended=!0),e}}f(K)}if(null!=K.getChildContext&&(n=T({},n,K.getChildContext())),ee&&e.errorBoundaries&&(R.getDerivedStateFromError||K.componentDidCatch)){V=null!=V&&V.type===r&&null==V.key&&null==V.props.tpl?V.props.children:V;try{return M(V,n,i,v,t,_,!1)}catch(e){return R.getDerivedStateFromError&&(K[a]=R.getDerivedStateFromError(e)),K.componentDidCatch&&K.componentDidCatch(e,L),h(K)?(V=F(t,n),null!=(K=t[o]).getChildContext&&(n=T({},n,K.getChildContext())),M(V=null!=V&&V.type===r&&null==V.key&&null==V.props.tpl?V.props.children:V,n,i,v,t,_,y)):W}finally{C&&C(t),A&&A(t)}}}V=null!=V&&V.type===r&&null==V.key&&null==V.props.tpl?V.props.children:V;try{var re=M(V,n,i,v,t,_,y);return C&&C(t),e.unmount&&e.unmount(t),t._suspended?"string"==typeof re?D+re+N:j(re)?(re.unshift(D),re.push(N),re):re.then(function(e){return D+e+N}):re}catch(r){if(!_&&y&&y.onError){var ne=function e(r){return y.onError(r,t,function(t,r){try{return M(t,n,i,v,r,_,y)}catch(t){return e(t)}})}(r);if(void 0!==ne)return ne;var oe=e.__e;return oe&&oe(r,t),W}if(!_)throw r;if(!r||"function"!=typeof r.then)throw r;return r.then(function e(){try{var r=M(V,n,i,v,t,_,y);return t._suspended?D+r+N:r}catch(t){if(!t||"function"!=typeof t.then)throw t;return t.then(e)}})}}var ie,ae="<"+R,se=W;for(var ce in B){var le=B[ce];if("function"!=typeof(le=Z(le)?le.value:le)||"class"===ce||"className"===ce){switch(ce){case"children":ie=le;continue;case"key":case"ref":case"__self":case"__source":continue;case"htmlFor":if("for"in B)continue;ce="for";break;case"className":if("class"in B)continue;ce="class";break;case"defaultChecked":ce="checked";break;case"defaultSelected":ce="selected";break;case"defaultValue":case"value":switch(ce="value",R){case"textarea":ie=le;continue;case"select":v=le;continue;case"option":v!=le||"selected"in B||(ae+=" selected")}break;case"dangerouslySetInnerHTML":se=le&&le.__html;continue;case"style":"object"==typeof le&&(le=b(le));break;case"acceptCharset":ce="accept-charset";break;case"httpEquiv":ce="http-equiv";break;default:if(c.test(ce))ce=ce.replace(c,"$1:$2").toLowerCase();else{if(s.test(ce))continue;"-"!==ce[4]&&!p.has(ce)||null==le?i?u.test(ce)&&(ce="panose1"===ce?"panose-1":ce.replace(/([A-Z])/g,"-$1").toLowerCase()):l.test(ce)&&(ce=ce.toLowerCase()):le+=W}}null!=le&&!1!==le&&(ae=!0===le||le===W?ae+" "+ce:ae+" "+ce+'="'+("string"==typeof le?m(le):le+W)+'"')}}if(s.test(R))throw new Error(R+" is not a valid HTML tag name in "+ae+">");if(se||("string"==typeof ie?se=m(ie):null!=ie&&!1!==ie&&!0!==ie&&(se=M(ie,n,"svg"===R||"foreignObject"!==R&&i,v,t,_,y))),C&&C(t),A&&A(t),!se&&U.has(R))return ae+"/>";var ue="</"+R+">",pe=ae+">";return j(se)?[pe].concat(se,[ue]):"string"!=typeof se?[pe,se,ue]:pe+se+ue}var U=new Set(["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"]);function Z(e){return null!==e&&"object"==typeof e&&"function"==typeof e.peek&&"value"in e}function q(e,t){return'<preact-island hidden data-target="'+e+'">'+t+"</preact-island>"}var H=function e(t){try{var r=function(){if(t.suspended.length>0){var r=[].concat(t.suspended);return Promise.resolve(Promise.all(t.suspended.map(function(e){return e.promise}))).then(function(){return t.suspended=t.suspended.filter(function(e){return!r.includes(e)}),Promise.resolve(e(t)).then(function(){})})}}();return Promise.resolve(r&&r.then?r.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},z=function(e,t){var r=t.context,n=t.onWrite,o=t.abortSignal;try{r=r||{};var i={start:Date.now(),abortSignal:o,onWrite:n,onError:I,suspended:[]},a=$(e,r,i);n(a);var s=i.suspended.length,c=function(){if(s>0)return n("<div hidden>"),n('<script>(function(){class e extends HTMLElement{connectedCallback(){var e=this;if(!e.isConnected)return;let t=this.getAttribute("data-target");if(t){for(var r,a,i=document.createNodeIterator(document,128);i.nextNode();){let e=i.referenceNode;if(e.data=="preact-island:"+t?r=e:e.data=="/preact-island:"+t&&(a=e),r&&a)break}r&&a&&requestAnimationFrame((()=>{for(var t=a.previousSibling;t!=r&&t&&t!=r;)a.parentNode.removeChild(t),t=a.previousSibling;for(i=r;e.firstChild;)r=e.firstChild,e.removeChild(r),i.after(r),i=r;e.parentNode.removeChild(e)}))}}}customElements.define("preact-island",e);}())<\/script>'),Promise.resolve(H(i)).then(function(){n("</div>")})}();return Promise.resolve(c&&c.then?c.then(function(){}):void 0)}catch(e){return Promise.reject(e)}};function I(e,t,r){var n=this;if(e&&e.then){for(;t=t.__;){var i=t[o];if(i&&i.__c)break}if(t){var a=t.__v,s=this.suspended.find(function(e){return e.id===a}),c=new E,l=this.abortSignal;l&&(l.aborted?c.resolve():l.addEventListener("abort",c.resolve));var u=e.then(function(){if(!l||!l.aborted){var e=r(t.props.children,t);e&&n.onWrite(q(a,e))}},this.onError);this.suspended.push({id:a,vnode:t,promise:Promise.race([u,c.promise])});var p=r(t.props.fallback);return s?"":"\x3c!--preact-island:"+a+"--\x3e"+p+"\x3c!--/preact-island:"+a+"--\x3e"}}}function R(e,t){var r=new E,n=new TextEncoder("utf-8"),o=new ReadableStream({start:function(o){z(e,{context:t,onError:function(e){r.reject(e),o.abort(e)},onWrite:function(e){o.enqueue(n.encode(e))}}).then(function(){o.close(),r.resolve()}).catch(function(e){o.error(e),r.reject(e)})}});return o.allReady=r.promise,o}export{R as renderToReadableStream};
1
+ import{options as e,h as t,Fragment as r}from"preact";var n="__s",o="__c",i="__d",a="__s",s=/[\s\n\\/='"\0<>]/,c=/^(xlink|xmlns|xml)([A-Z])/,l=/^(?:accessK|auto[A-Z]|cell|ch|col|cont|cross|dateT|encT|form[A-Z]|frame|hrefL|inputM|maxL|minL|noV|playsI|popoverT|readO|rowS|src[A-Z]|tabI|useM|item[A-Z])/,u=/^ac|^ali|arabic|basel|cap|clipPath$|clipRule$|color|dominant|enable|fill|flood|font|glyph[^R]|horiz|image|letter|lighting|marker[^WUH]|overline|panose|pointe|paint|rendering|shape|stop|strikethrough|stroke|text[^L]|transform|underline|unicode|units|^v[^i]|^w|^xH/,p=new Set(["draggable","spellcheck"]);function f(e){void 0!==e.__g?e.__g|=8:e[i]=!0}function d(e){void 0!==e.__g?e.__g&=-9:e[i]=!1}function h(e){return void 0!==e.__g?!!(8&e.__g):!0===e[i]}var v=/["&<]/;function m(e){if(0===e.length||!1===v.test(e))return e;for(var t=0,r=0,n="",o="";r<e.length;r++){switch(e.charCodeAt(r)){case 34:o="&quot;";break;case 38:o="&amp;";break;case 60:o="&lt;";break;default:continue}r!==t&&(n+=e.slice(t,r)),n+=o,t=r+1}return r!==t&&(n+=e.slice(t,r)),n}var g={},_=new Set(["animation-iteration-count","border-image-outset","border-image-slice","border-image-width","box-flex","box-flex-group","box-ordinal-group","column-count","fill-opacity","flex","flex-grow","flex-negative","flex-order","flex-positive","flex-shrink","flood-opacity","font-weight","grid-column","grid-row","line-clamp","line-height","opacity","order","orphans","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","widows","z-index","zoom"]),y=/[A-Z]/g;function b(e){var t="";for(var r in e){var n=e[r];if(null!=n&&""!==n){var o="-"==r[0]?r:g[r]||(g[r]=r.replace(y,"-$&").toLowerCase()),i=";";"number"!=typeof n||o.startsWith("--")||_.has(o)||(i="px;"),t=t+o+":"+n+i}}return t||void 0}function x(){this.__d=!0}function k(e,t){return{__v:e,context:t,props:e.props,setState:x,forceUpdate:x,__d:!0,__h:new Array(0)}}var w,C,S,E,A=function(){var e=this;this.promise=new Promise(function(t,r){e.resolve=t,e.reject=r})},L={},P=[],j=Array.isArray,T=Object.assign,W="",D="\x3c!--$s--\x3e",N="\x3c!--/$s--\x3e";function $(o,i,a){var s=e[n];e[n]=!0,w=e.__b,C=e.diffed,S=e.__r,E=e.unmount;var c=t(r,null);c.__k=[o];try{var l=M(o,i||L,!1,void 0,c,!1,a);return j(l)?l.join(W):l}catch(e){if(e.then)throw new Error('Use "renderToStringAsync" for suspenseful rendering.');throw e}finally{e.__c&&e.__c(o,P),e[n]=s,P.length=0}}function F(e,t){var r,n=e.type,i=!0;return e[o]?(i=!1,(r=e[o]).state=r[a]):r=new n(e.props,t),e[o]=r,r.__v=e,r.props=e.props,r.context=t,f(r),null==r.state&&(r.state=L),null==r[a]&&(r[a]=r.state),n.getDerivedStateFromProps?r.state=T({},r.state,n.getDerivedStateFromProps(r.props,r.state)):i&&r.componentWillMount?(r.componentWillMount(),r.state=r[a]!==r.state?r[a]:r.state):!i&&r.componentWillUpdate&&r.componentWillUpdate(),S&&S(e),r.render(r.props,r.state,t)}function M(t,n,i,v,g,_,y){if(null==t||!0===t||!1===t||t===W)return W;var x=typeof t;if("object"!=x)return"function"==x?W:"string"==x?m(t):t+W;if(j(t)){var A,P=W;g.__k=t;for(var $=t.length,q=0;q<$;q++){var H=t[q];if(null!=H&&"boolean"!=typeof H){var I,O=M(H,n,i,v,g,_,y);"string"==typeof O?P+=O:(A||(A=new Array($)),P&&A.push(P),P=W,j(O)?(I=A).push.apply(I,O):A.push(O))}}return A?(P&&A.push(P),A):P}if(void 0!==t.constructor)return W;t.__=g,w&&w(t);var z=t.type,R=t.props;if("function"==typeof z){var B,V,K,Y=n;if(z===r){if("tpl"in R){for(var G=W,J=0;J<R.tpl.length;J++)if(G+=R.tpl[J],R.exprs&&J<R.exprs.length){var Q=R.exprs[J];if(null==Q)continue;"object"!=typeof Q||void 0!==Q.constructor&&!j(Q)?G+=Q:G+=M(Q,n,i,v,t,_,y)}return G}if("UNSTABLE_comment"in R)return"\x3c!--"+m(R.UNSTABLE_comment)+"--\x3e";V=R.children}else{if(null!=(B=z.contextType)){var X=n[B.__c];Y=X?X.props.value:B.__}var ee=z.prototype&&"function"==typeof z.prototype.render;if(ee)V=/**#__NOINLINE__**/F(t,Y),K=t[o];else{t[o]=K=/**#__NOINLINE__**/k(t,Y);for(var te=0;h(K)&&te++<25;){d(K),S&&S(t);try{V=z.call(K,R,Y)}catch(e){throw _&&e&&"function"==typeof e.then&&(t._suspended=!0),e}}f(K)}if(null!=K.getChildContext&&(n=T({},n,K.getChildContext())),ee&&e.errorBoundaries&&(z.getDerivedStateFromError||K.componentDidCatch)){V=null!=V&&V.type===r&&null==V.key&&null==V.props.tpl?V.props.children:V;try{return M(V,n,i,v,t,_,!1)}catch(e){return z.getDerivedStateFromError&&(K[a]=z.getDerivedStateFromError(e)),K.componentDidCatch&&K.componentDidCatch(e,L),h(K)?(V=F(t,n),null!=(K=t[o]).getChildContext&&(n=T({},n,K.getChildContext())),M(V=null!=V&&V.type===r&&null==V.key&&null==V.props.tpl?V.props.children:V,n,i,v,t,_,y)):W}finally{C&&C(t),E&&E(t)}}}V=null!=V&&V.type===r&&null==V.key&&null==V.props.tpl?V.props.children:V;try{var re=M(V,n,i,v,t,_,y);return C&&C(t),e.unmount&&e.unmount(t),t._suspended?"string"==typeof re?D+re+N:j(re)?(re.unshift(D),re.push(N),re):re.then(function(e){return D+e+N}):re}catch(r){if(!_&&y&&y.onError){var ne=function e(r){return y.onError(r,t,function(t,r){try{return M(t,n,i,v,r,_,y)}catch(t){return e(t)}})}(r);if(void 0!==ne)return ne;var oe=e.__e;return oe&&oe(r,t),W}if(!_)throw r;if(!r||"function"!=typeof r.then)throw r;return r.then(function e(){try{var r=M(V,n,i,v,t,_,y);return t._suspended?D+r+N:r}catch(t){if(!t||"function"!=typeof t.then)throw t;return t.then(e)}})}}var ie,ae="<"+z,se=W;for(var ce in R){var le=R[ce];if("function"!=typeof(le=Z(le)?le.value:le)||"class"===ce||"className"===ce){switch(ce){case"children":ie=le;continue;case"key":case"ref":case"__self":case"__source":continue;case"htmlFor":if("for"in R)continue;ce="for";break;case"className":if("class"in R)continue;ce="class";break;case"defaultChecked":ce="checked";break;case"defaultSelected":ce="selected";break;case"defaultValue":case"value":switch(ce="value",z){case"textarea":ie=le;continue;case"select":v=le;continue;case"option":v!=le||"selected"in R||(ae+=" selected")}break;case"dangerouslySetInnerHTML":se=le&&le.__html;continue;case"style":"object"==typeof le&&(le=b(le));break;case"acceptCharset":ce="accept-charset";break;case"httpEquiv":ce="http-equiv";break;default:if(c.test(ce))ce=ce.replace(c,"$1:$2").toLowerCase();else{if(s.test(ce))continue;"-"!==ce[4]&&!p.has(ce)||null==le?i?u.test(ce)&&(ce="panose1"===ce?"panose-1":ce.replace(/([A-Z])/g,"-$1").toLowerCase()):l.test(ce)&&(ce=ce.toLowerCase()):le+=W}}null!=le&&!1!==le&&(ae=!0===le||le===W?ae+" "+ce:ae+" "+ce+'="'+("string"==typeof le?m(le):le+W)+'"')}}if(s.test(z))throw new Error(z+" is not a valid HTML tag name in "+ae+">");if(se||("string"==typeof ie?se=m(ie):null!=ie&&!1!==ie&&!0!==ie&&(se=M(ie,n,"svg"===z||"foreignObject"!==z&&i,v,t,_,y))),C&&C(t),E&&E(t),!se&&U.has(z))return ae+"/>";var ue="</"+z+">",pe=ae+">";return j(se)?[pe].concat(se,[ue]):"string"!=typeof se?[pe,se,ue]:pe+se+ue}var U=new Set(["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"]);function Z(e){return null!==e&&"object"==typeof e&&"function"==typeof e.peek&&"value"in e}function q(e,t){return'<preact-island hidden data-target="'+e+'">'+t+"</preact-island>"}var H=function e(t){try{var r=function(){if(t.suspended.length>0){var r=[].concat(t.suspended);return Promise.resolve(Promise.all(t.suspended.map(function(e){return e.promise}))).then(function(){return t.suspended=t.suspended.filter(function(e){return!r.includes(e)}),Promise.resolve(e(t)).then(function(){})})}}();return Promise.resolve(r&&r.then?r.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},I=function(e,t){var r=t.context,n=t.onWrite,o=t.abortSignal;try{r=r||{};var i={start:Date.now(),abortSignal:o,onWrite:n,onError:O,suspended:[]},a=$(e,r,i),s=i.suspended.length,c=function(){if(s>0){var e=a.lastIndexOf("</body>"),t=a.trimStart().startsWith("<html"),r=-1!==e?a.slice(0,e):a;return n((t?"<!DOCTYPE html>":"")+r),n("<div hidden>"),n('<script>(function(){class e extends HTMLElement{connectedCallback(){var e=this;if(!e.isConnected)return;let t=this.getAttribute("data-target");if(t){for(var r,a,i=document.createNodeIterator(document,128);i.nextNode();){let e=i.referenceNode;if(e.data=="preact-island:"+t?r=e:e.data=="/preact-island:"+t&&(a=e),r&&a)break}r&&a&&r.parentNode!==document&&requestAnimationFrame((()=>{for(var t=a.previousSibling;t!=r&&t&&t!=r;)a.parentNode.removeChild(t),t=a.previousSibling;for(i=r;e.firstChild;)r=e.firstChild,e.removeChild(r),i.after(r),i=r;e.parentNode.removeChild(e)}))}}}customElements.define("preact-island",e);}())<\/script>'),Promise.resolve(H(i)).then(function(){n("</div>"),-1!==e&&n(a.slice(e))})}n(a)}();return Promise.resolve(c&&c.then?c.then(function(){}):void 0)}catch(e){return Promise.reject(e)}};function O(e,t,r){var n=this;if(e&&e.then){for(;t=t.__;){var i=t[o];if(i&&i.__c)break}if(t){var a=t.__v,s=this.suspended.find(function(e){return e.id===a}),c=new A,l=this.abortSignal;l&&(l.aborted?c.resolve():l.addEventListener("abort",c.resolve));var u=e.then(function(){if(!l||!l.aborted){var e=r(t.props.children,t);e&&n.onWrite(q(a,e))}},this.onError);this.suspended.push({id:a,vnode:t,promise:Promise.race([u,c.promise])});var p=r(t.props.fallback);return s?"":"\x3c!--preact-island:"+a+"--\x3e"+p+"\x3c!--/preact-island:"+a+"--\x3e"}}}function z(e,t){var r=new A,n=new TextEncoder("utf-8"),o=new ReadableStream({start:function(o){I(e,{context:t,onError:function(e){r.reject(e),o.abort(e)},onWrite:function(e){o.enqueue(n.encode(e))}}).then(function(){o.close(),r.resolve()}).catch(function(e){o.error(e),r.reject(e)})}});return o.allReady=r.promise,o}export{z as renderToReadableStream};
2
2
  //# sourceMappingURL=index.module.js.map
@@ -1,2 +1,2 @@
1
- import{options as e,h as t,Fragment as r}from"preact";var n="__s",o="__c",i="__d",a="__s",s=/[\s\n\\/='"\0<>]/,c=/^(xlink|xmlns|xml)([A-Z])/,l=/^(?:accessK|auto[A-Z]|cell|ch|col|cont|cross|dateT|encT|form[A-Z]|frame|hrefL|inputM|maxL|minL|noV|playsI|popoverT|readO|rowS|src[A-Z]|tabI|useM|item[A-Z])/,u=/^ac|^ali|arabic|basel|cap|clipPath$|clipRule$|color|dominant|enable|fill|flood|font|glyph[^R]|horiz|image|letter|lighting|marker[^WUH]|overline|panose|pointe|paint|rendering|shape|stop|strikethrough|stroke|text[^L]|transform|underline|unicode|units|^v[^i]|^w|^xH/,p=new Set(["draggable","spellcheck"]);function f(e){void 0!==e.__g?e.__g|=8:e[i]=!0}function d(e){void 0!==e.__g?e.__g&=-9:e[i]=!1}function h(e){return void 0!==e.__g?!!(8&e.__g):!0===e[i]}var v=/["&<]/;function m(e){if(0===e.length||!1===v.test(e))return e;for(var t=0,r=0,n="",o="";r<e.length;r++){switch(e.charCodeAt(r)){case 34:o="&quot;";break;case 38:o="&amp;";break;case 60:o="&lt;";break;default:continue}r!==t&&(n+=e.slice(t,r)),n+=o,t=r+1}return r!==t&&(n+=e.slice(t,r)),n}var g={},_=new Set(["animation-iteration-count","border-image-outset","border-image-slice","border-image-width","box-flex","box-flex-group","box-ordinal-group","column-count","fill-opacity","flex","flex-grow","flex-negative","flex-order","flex-positive","flex-shrink","flood-opacity","font-weight","grid-column","grid-row","line-clamp","line-height","opacity","order","orphans","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","widows","z-index","zoom"]),y=/[A-Z]/g;function b(e){var t="";for(var r in e){var n=e[r];if(null!=n&&""!==n){var o="-"==r[0]?r:g[r]||(g[r]=r.replace(y,"-$&").toLowerCase()),i=";";"number"!=typeof n||o.startsWith("--")||_.has(o)||(i="px;"),t=t+o+":"+n+i}}return t||void 0}function x(){this.__d=!0}function k(e,t){return{__v:e,context:t,props:e.props,setState:x,forceUpdate:x,__d:!0,__h:new Array(0)}}var w,C,S,A,E=function(){var e=this;this.promise=new Promise(function(t,r){e.resolve=t,e.reject=r})},L={},P=[],j=Array.isArray,T=Object.assign,W="",D="\x3c!--$s--\x3e",N="\x3c!--/$s--\x3e";function $(o,i,a){var s=e[n];e[n]=!0,w=e.__b,C=e.diffed,S=e.__r,A=e.unmount;var c=t(r,null);c.__k=[o];try{var l=M(o,i||L,!1,void 0,c,!1,a);return j(l)?l.join(W):l}catch(e){if(e.then)throw new Error('Use "renderToStringAsync" for suspenseful rendering.');throw e}finally{e.__c&&e.__c(o,P),e[n]=s,P.length=0}}function F(e,t){var r,n=e.type,i=!0;return e[o]?(i=!1,(r=e[o]).state=r[a]):r=new n(e.props,t),e[o]=r,r.__v=e,r.props=e.props,r.context=t,f(r),null==r.state&&(r.state=L),null==r[a]&&(r[a]=r.state),n.getDerivedStateFromProps?r.state=T({},r.state,n.getDerivedStateFromProps(r.props,r.state)):i&&r.componentWillMount?(r.componentWillMount(),r.state=r[a]!==r.state?r[a]:r.state):!i&&r.componentWillUpdate&&r.componentWillUpdate(),S&&S(e),r.render(r.props,r.state,t)}function M(t,n,i,v,g,_,y){if(null==t||!0===t||!1===t||t===W)return W;var x=typeof t;if("object"!=x)return"function"==x?W:"string"==x?m(t):t+W;if(j(t)){var E,P=W;g.__k=t;for(var $=t.length,q=0;q<$;q++){var H=t[q];if(null!=H&&"boolean"!=typeof H){var z,I=M(H,n,i,v,g,_,y);"string"==typeof I?P+=I:(E||(E=new Array($)),P&&E.push(P),P=W,j(I)?(z=E).push.apply(z,I):E.push(I))}}return E?(P&&E.push(P),E):P}if(void 0!==t.constructor)return W;t.__=g,w&&w(t);var R=t.type,B=t.props;if("function"==typeof R){var O,V,K,G=n;if(R===r){if("tpl"in B){for(var J=W,Q=0;Q<B.tpl.length;Q++)if(J+=B.tpl[Q],B.exprs&&Q<B.exprs.length){var X=B.exprs[Q];if(null==X)continue;"object"!=typeof X||void 0!==X.constructor&&!j(X)?J+=X:J+=M(X,n,i,v,t,_,y)}return J}if("UNSTABLE_comment"in B)return"\x3c!--"+m(B.UNSTABLE_comment)+"--\x3e";V=B.children}else{if(null!=(O=R.contextType)){var Y=n[O.__c];G=Y?Y.props.value:O.__}var ee=R.prototype&&"function"==typeof R.prototype.render;if(ee)V=/**#__NOINLINE__**/F(t,G),K=t[o];else{t[o]=K=/**#__NOINLINE__**/k(t,G);for(var te=0;h(K)&&te++<25;){d(K),S&&S(t);try{V=R.call(K,B,G)}catch(e){throw _&&e&&"function"==typeof e.then&&(t._suspended=!0),e}}f(K)}if(null!=K.getChildContext&&(n=T({},n,K.getChildContext())),ee&&e.errorBoundaries&&(R.getDerivedStateFromError||K.componentDidCatch)){V=null!=V&&V.type===r&&null==V.key&&null==V.props.tpl?V.props.children:V;try{return M(V,n,i,v,t,_,!1)}catch(e){return R.getDerivedStateFromError&&(K[a]=R.getDerivedStateFromError(e)),K.componentDidCatch&&K.componentDidCatch(e,L),h(K)?(V=F(t,n),null!=(K=t[o]).getChildContext&&(n=T({},n,K.getChildContext())),M(V=null!=V&&V.type===r&&null==V.key&&null==V.props.tpl?V.props.children:V,n,i,v,t,_,y)):W}finally{C&&C(t),A&&A(t)}}}V=null!=V&&V.type===r&&null==V.key&&null==V.props.tpl?V.props.children:V;try{var re=M(V,n,i,v,t,_,y);return C&&C(t),e.unmount&&e.unmount(t),t._suspended?"string"==typeof re?D+re+N:j(re)?(re.unshift(D),re.push(N),re):re.then(function(e){return D+e+N}):re}catch(r){if(!_&&y&&y.onError){var ne=function e(r){return y.onError(r,t,function(t,r){try{return M(t,n,i,v,r,_,y)}catch(t){return e(t)}})}(r);if(void 0!==ne)return ne;var oe=e.__e;return oe&&oe(r,t),W}if(!_)throw r;if(!r||"function"!=typeof r.then)throw r;return r.then(function e(){try{var r=M(V,n,i,v,t,_,y);return t._suspended?D+r+N:r}catch(t){if(!t||"function"!=typeof t.then)throw t;return t.then(e)}})}}var ie,ae="<"+R,se=W;for(var ce in B){var le=B[ce];if("function"!=typeof(le=Z(le)?le.value:le)||"class"===ce||"className"===ce){switch(ce){case"children":ie=le;continue;case"key":case"ref":case"__self":case"__source":continue;case"htmlFor":if("for"in B)continue;ce="for";break;case"className":if("class"in B)continue;ce="class";break;case"defaultChecked":ce="checked";break;case"defaultSelected":ce="selected";break;case"defaultValue":case"value":switch(ce="value",R){case"textarea":ie=le;continue;case"select":v=le;continue;case"option":v!=le||"selected"in B||(ae+=" selected")}break;case"dangerouslySetInnerHTML":se=le&&le.__html;continue;case"style":"object"==typeof le&&(le=b(le));break;case"acceptCharset":ce="accept-charset";break;case"httpEquiv":ce="http-equiv";break;default:if(c.test(ce))ce=ce.replace(c,"$1:$2").toLowerCase();else{if(s.test(ce))continue;"-"!==ce[4]&&!p.has(ce)||null==le?i?u.test(ce)&&(ce="panose1"===ce?"panose-1":ce.replace(/([A-Z])/g,"-$1").toLowerCase()):l.test(ce)&&(ce=ce.toLowerCase()):le+=W}}null!=le&&!1!==le&&(ae=!0===le||le===W?ae+" "+ce:ae+" "+ce+'="'+("string"==typeof le?m(le):le+W)+'"')}}if(s.test(R))throw new Error(R+" is not a valid HTML tag name in "+ae+">");if(se||("string"==typeof ie?se=m(ie):null!=ie&&!1!==ie&&!0!==ie&&(se=M(ie,n,"svg"===R||"foreignObject"!==R&&i,v,t,_,y))),C&&C(t),A&&A(t),!se&&U.has(R))return ae+"/>";var ue="</"+R+">",pe=ae+">";return j(se)?[pe].concat(se,[ue]):"string"!=typeof se?[pe,se,ue]:pe+se+ue}var U=new Set(["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"]);function Z(e){return null!==e&&"object"==typeof e&&"function"==typeof e.peek&&"value"in e}function q(e,t){return'<preact-island hidden data-target="'+e+'">'+t+"</preact-island>"}var H=function e(t){try{var r=function(){if(t.suspended.length>0){var r=[].concat(t.suspended);return Promise.resolve(Promise.all(t.suspended.map(function(e){return e.promise}))).then(function(){return t.suspended=t.suspended.filter(function(e){return!r.includes(e)}),Promise.resolve(e(t)).then(function(){})})}}();return Promise.resolve(r&&r.then?r.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},z=function(e,t){var r=t.context,n=t.onWrite,o=t.abortSignal;try{r=r||{};var i={start:Date.now(),abortSignal:o,onWrite:n,onError:I,suspended:[]},a=$(e,r,i);n(a);var s=i.suspended.length,c=function(){if(s>0)return n("<div hidden>"),n('<script>(function(){class e extends HTMLElement{connectedCallback(){var e=this;if(!e.isConnected)return;let t=this.getAttribute("data-target");if(t){for(var r,a,i=document.createNodeIterator(document,128);i.nextNode();){let e=i.referenceNode;if(e.data=="preact-island:"+t?r=e:e.data=="/preact-island:"+t&&(a=e),r&&a)break}r&&a&&requestAnimationFrame((()=>{for(var t=a.previousSibling;t!=r&&t&&t!=r;)a.parentNode.removeChild(t),t=a.previousSibling;for(i=r;e.firstChild;)r=e.firstChild,e.removeChild(r),i.after(r),i=r;e.parentNode.removeChild(e)}))}}}customElements.define("preact-island",e);}())<\/script>'),Promise.resolve(H(i)).then(function(){n("</div>")})}();return Promise.resolve(c&&c.then?c.then(function(){}):void 0)}catch(e){return Promise.reject(e)}};function I(e,t,r){var n=this;if(e&&e.then){for(;t=t.__;){var i=t[o];if(i&&i.__c)break}if(t){var a=t.__v,s=this.suspended.find(function(e){return e.id===a}),c=new E,l=this.abortSignal;l&&(l.aborted?c.resolve():l.addEventListener("abort",c.resolve));var u=e.then(function(){if(!l||!l.aborted){var e=r(t.props.children,t);e&&n.onWrite(q(a,e))}},this.onError);this.suspended.push({id:a,vnode:t,promise:Promise.race([u,c.promise])});var p=r(t.props.fallback);return s?"":"\x3c!--preact-island:"+a+"--\x3e"+p+"\x3c!--/preact-island:"+a+"--\x3e"}}}function R(e,t){var r=new E,n=new TextEncoder("utf-8"),o=new ReadableStream({start:function(o){z(e,{context:t,onError:function(e){r.reject(e),o.abort(e)},onWrite:function(e){o.enqueue(n.encode(e))}}).then(function(){o.close(),r.resolve()}).catch(function(e){o.error(e),r.reject(e)})}});return o.allReady=r.promise,o}export{R as renderToReadableStream};
1
+ import{options as e,h as t,Fragment as r}from"preact";var n="__s",o="__c",i="__d",a="__s",s=/[\s\n\\/='"\0<>]/,c=/^(xlink|xmlns|xml)([A-Z])/,l=/^(?:accessK|auto[A-Z]|cell|ch|col|cont|cross|dateT|encT|form[A-Z]|frame|hrefL|inputM|maxL|minL|noV|playsI|popoverT|readO|rowS|src[A-Z]|tabI|useM|item[A-Z])/,u=/^ac|^ali|arabic|basel|cap|clipPath$|clipRule$|color|dominant|enable|fill|flood|font|glyph[^R]|horiz|image|letter|lighting|marker[^WUH]|overline|panose|pointe|paint|rendering|shape|stop|strikethrough|stroke|text[^L]|transform|underline|unicode|units|^v[^i]|^w|^xH/,p=new Set(["draggable","spellcheck"]);function f(e){void 0!==e.__g?e.__g|=8:e[i]=!0}function d(e){void 0!==e.__g?e.__g&=-9:e[i]=!1}function h(e){return void 0!==e.__g?!!(8&e.__g):!0===e[i]}var v=/["&<]/;function m(e){if(0===e.length||!1===v.test(e))return e;for(var t=0,r=0,n="",o="";r<e.length;r++){switch(e.charCodeAt(r)){case 34:o="&quot;";break;case 38:o="&amp;";break;case 60:o="&lt;";break;default:continue}r!==t&&(n+=e.slice(t,r)),n+=o,t=r+1}return r!==t&&(n+=e.slice(t,r)),n}var g={},_=new Set(["animation-iteration-count","border-image-outset","border-image-slice","border-image-width","box-flex","box-flex-group","box-ordinal-group","column-count","fill-opacity","flex","flex-grow","flex-negative","flex-order","flex-positive","flex-shrink","flood-opacity","font-weight","grid-column","grid-row","line-clamp","line-height","opacity","order","orphans","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","widows","z-index","zoom"]),y=/[A-Z]/g;function b(e){var t="";for(var r in e){var n=e[r];if(null!=n&&""!==n){var o="-"==r[0]?r:g[r]||(g[r]=r.replace(y,"-$&").toLowerCase()),i=";";"number"!=typeof n||o.startsWith("--")||_.has(o)||(i="px;"),t=t+o+":"+n+i}}return t||void 0}function x(){this.__d=!0}function k(e,t){return{__v:e,context:t,props:e.props,setState:x,forceUpdate:x,__d:!0,__h:new Array(0)}}var w,C,S,E,A=function(){var e=this;this.promise=new Promise(function(t,r){e.resolve=t,e.reject=r})},L={},P=[],j=Array.isArray,T=Object.assign,W="",D="\x3c!--$s--\x3e",N="\x3c!--/$s--\x3e";function $(o,i,a){var s=e[n];e[n]=!0,w=e.__b,C=e.diffed,S=e.__r,E=e.unmount;var c=t(r,null);c.__k=[o];try{var l=M(o,i||L,!1,void 0,c,!1,a);return j(l)?l.join(W):l}catch(e){if(e.then)throw new Error('Use "renderToStringAsync" for suspenseful rendering.');throw e}finally{e.__c&&e.__c(o,P),e[n]=s,P.length=0}}function F(e,t){var r,n=e.type,i=!0;return e[o]?(i=!1,(r=e[o]).state=r[a]):r=new n(e.props,t),e[o]=r,r.__v=e,r.props=e.props,r.context=t,f(r),null==r.state&&(r.state=L),null==r[a]&&(r[a]=r.state),n.getDerivedStateFromProps?r.state=T({},r.state,n.getDerivedStateFromProps(r.props,r.state)):i&&r.componentWillMount?(r.componentWillMount(),r.state=r[a]!==r.state?r[a]:r.state):!i&&r.componentWillUpdate&&r.componentWillUpdate(),S&&S(e),r.render(r.props,r.state,t)}function M(t,n,i,v,g,_,y){if(null==t||!0===t||!1===t||t===W)return W;var x=typeof t;if("object"!=x)return"function"==x?W:"string"==x?m(t):t+W;if(j(t)){var A,P=W;g.__k=t;for(var $=t.length,q=0;q<$;q++){var H=t[q];if(null!=H&&"boolean"!=typeof H){var I,O=M(H,n,i,v,g,_,y);"string"==typeof O?P+=O:(A||(A=new Array($)),P&&A.push(P),P=W,j(O)?(I=A).push.apply(I,O):A.push(O))}}return A?(P&&A.push(P),A):P}if(void 0!==t.constructor)return W;t.__=g,w&&w(t);var z=t.type,R=t.props;if("function"==typeof z){var B,V,K,Y=n;if(z===r){if("tpl"in R){for(var G=W,J=0;J<R.tpl.length;J++)if(G+=R.tpl[J],R.exprs&&J<R.exprs.length){var Q=R.exprs[J];if(null==Q)continue;"object"!=typeof Q||void 0!==Q.constructor&&!j(Q)?G+=Q:G+=M(Q,n,i,v,t,_,y)}return G}if("UNSTABLE_comment"in R)return"\x3c!--"+m(R.UNSTABLE_comment)+"--\x3e";V=R.children}else{if(null!=(B=z.contextType)){var X=n[B.__c];Y=X?X.props.value:B.__}var ee=z.prototype&&"function"==typeof z.prototype.render;if(ee)V=/**#__NOINLINE__**/F(t,Y),K=t[o];else{t[o]=K=/**#__NOINLINE__**/k(t,Y);for(var te=0;h(K)&&te++<25;){d(K),S&&S(t);try{V=z.call(K,R,Y)}catch(e){throw _&&e&&"function"==typeof e.then&&(t._suspended=!0),e}}f(K)}if(null!=K.getChildContext&&(n=T({},n,K.getChildContext())),ee&&e.errorBoundaries&&(z.getDerivedStateFromError||K.componentDidCatch)){V=null!=V&&V.type===r&&null==V.key&&null==V.props.tpl?V.props.children:V;try{return M(V,n,i,v,t,_,!1)}catch(e){return z.getDerivedStateFromError&&(K[a]=z.getDerivedStateFromError(e)),K.componentDidCatch&&K.componentDidCatch(e,L),h(K)?(V=F(t,n),null!=(K=t[o]).getChildContext&&(n=T({},n,K.getChildContext())),M(V=null!=V&&V.type===r&&null==V.key&&null==V.props.tpl?V.props.children:V,n,i,v,t,_,y)):W}finally{C&&C(t),E&&E(t)}}}V=null!=V&&V.type===r&&null==V.key&&null==V.props.tpl?V.props.children:V;try{var re=M(V,n,i,v,t,_,y);return C&&C(t),e.unmount&&e.unmount(t),t._suspended?"string"==typeof re?D+re+N:j(re)?(re.unshift(D),re.push(N),re):re.then(function(e){return D+e+N}):re}catch(r){if(!_&&y&&y.onError){var ne=function e(r){return y.onError(r,t,function(t,r){try{return M(t,n,i,v,r,_,y)}catch(t){return e(t)}})}(r);if(void 0!==ne)return ne;var oe=e.__e;return oe&&oe(r,t),W}if(!_)throw r;if(!r||"function"!=typeof r.then)throw r;return r.then(function e(){try{var r=M(V,n,i,v,t,_,y);return t._suspended?D+r+N:r}catch(t){if(!t||"function"!=typeof t.then)throw t;return t.then(e)}})}}var ie,ae="<"+z,se=W;for(var ce in R){var le=R[ce];if("function"!=typeof(le=Z(le)?le.value:le)||"class"===ce||"className"===ce){switch(ce){case"children":ie=le;continue;case"key":case"ref":case"__self":case"__source":continue;case"htmlFor":if("for"in R)continue;ce="for";break;case"className":if("class"in R)continue;ce="class";break;case"defaultChecked":ce="checked";break;case"defaultSelected":ce="selected";break;case"defaultValue":case"value":switch(ce="value",z){case"textarea":ie=le;continue;case"select":v=le;continue;case"option":v!=le||"selected"in R||(ae+=" selected")}break;case"dangerouslySetInnerHTML":se=le&&le.__html;continue;case"style":"object"==typeof le&&(le=b(le));break;case"acceptCharset":ce="accept-charset";break;case"httpEquiv":ce="http-equiv";break;default:if(c.test(ce))ce=ce.replace(c,"$1:$2").toLowerCase();else{if(s.test(ce))continue;"-"!==ce[4]&&!p.has(ce)||null==le?i?u.test(ce)&&(ce="panose1"===ce?"panose-1":ce.replace(/([A-Z])/g,"-$1").toLowerCase()):l.test(ce)&&(ce=ce.toLowerCase()):le+=W}}null!=le&&!1!==le&&(ae=!0===le||le===W?ae+" "+ce:ae+" "+ce+'="'+("string"==typeof le?m(le):le+W)+'"')}}if(s.test(z))throw new Error(z+" is not a valid HTML tag name in "+ae+">");if(se||("string"==typeof ie?se=m(ie):null!=ie&&!1!==ie&&!0!==ie&&(se=M(ie,n,"svg"===z||"foreignObject"!==z&&i,v,t,_,y))),C&&C(t),E&&E(t),!se&&U.has(z))return ae+"/>";var ue="</"+z+">",pe=ae+">";return j(se)?[pe].concat(se,[ue]):"string"!=typeof se?[pe,se,ue]:pe+se+ue}var U=new Set(["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"]);function Z(e){return null!==e&&"object"==typeof e&&"function"==typeof e.peek&&"value"in e}function q(e,t){return'<preact-island hidden data-target="'+e+'">'+t+"</preact-island>"}var H=function e(t){try{var r=function(){if(t.suspended.length>0){var r=[].concat(t.suspended);return Promise.resolve(Promise.all(t.suspended.map(function(e){return e.promise}))).then(function(){return t.suspended=t.suspended.filter(function(e){return!r.includes(e)}),Promise.resolve(e(t)).then(function(){})})}}();return Promise.resolve(r&&r.then?r.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},I=function(e,t){var r=t.context,n=t.onWrite,o=t.abortSignal;try{r=r||{};var i={start:Date.now(),abortSignal:o,onWrite:n,onError:O,suspended:[]},a=$(e,r,i),s=i.suspended.length,c=function(){if(s>0){var e=a.lastIndexOf("</body>"),t=a.trimStart().startsWith("<html"),r=-1!==e?a.slice(0,e):a;return n((t?"<!DOCTYPE html>":"")+r),n("<div hidden>"),n('<script>(function(){class e extends HTMLElement{connectedCallback(){var e=this;if(!e.isConnected)return;let t=this.getAttribute("data-target");if(t){for(var r,a,i=document.createNodeIterator(document,128);i.nextNode();){let e=i.referenceNode;if(e.data=="preact-island:"+t?r=e:e.data=="/preact-island:"+t&&(a=e),r&&a)break}r&&a&&r.parentNode!==document&&requestAnimationFrame((()=>{for(var t=a.previousSibling;t!=r&&t&&t!=r;)a.parentNode.removeChild(t),t=a.previousSibling;for(i=r;e.firstChild;)r=e.firstChild,e.removeChild(r),i.after(r),i=r;e.parentNode.removeChild(e)}))}}}customElements.define("preact-island",e);}())<\/script>'),Promise.resolve(H(i)).then(function(){n("</div>"),-1!==e&&n(a.slice(e))})}n(a)}();return Promise.resolve(c&&c.then?c.then(function(){}):void 0)}catch(e){return Promise.reject(e)}};function O(e,t,r){var n=this;if(e&&e.then){for(;t=t.__;){var i=t[o];if(i&&i.__c)break}if(t){var a=t.__v,s=this.suspended.find(function(e){return e.id===a}),c=new A,l=this.abortSignal;l&&(l.aborted?c.resolve():l.addEventListener("abort",c.resolve));var u=e.then(function(){if(!l||!l.aborted){var e=r(t.props.children,t);e&&n.onWrite(q(a,e))}},this.onError);this.suspended.push({id:a,vnode:t,promise:Promise.race([u,c.promise])});var p=r(t.props.fallback);return s?"":"\x3c!--preact-island:"+a+"--\x3e"+p+"\x3c!--/preact-island:"+a+"--\x3e"}}}function z(e,t){var r=new A,n=new TextEncoder("utf-8"),o=new ReadableStream({start:function(o){I(e,{context:t,onError:function(e){r.reject(e),o.abort(e)},onWrite:function(e){o.enqueue(n.encode(e))}}).then(function(){o.close(),r.resolve()}).catch(function(e){o.error(e),r.reject(e)})}});return o.allReady=r.promise,o}export{z as renderToReadableStream};
2
2
  //# sourceMappingURL=index.module.js.map