inferno-server
Version:
Provides methods to render HTML strings from Inferno elements
2 lines (1 loc) • 19.6 kB
JavaScript
;var e=require("inferno"),t=require("stream"),r="a runtime error occured! Use Inferno in development environment to find the error.",n=Array.isArray;function o(e){var t=typeof e;return"string"===t||"number"===t}function i(e){return void 0===e||null===e}function u(e){return null===e||!1===e||!0===e||void 0===e}function a(e){return"function"===typeof e}function s(e){return"string"===typeof e}function c(e){return"number"===typeof e}function l(e){return null===e}function f(e){return void 0===e}function h(e){throw e||(e=r),new Error("Inferno Error: "+e)}function p(e){if(s(e))return e;var t="";for(var r in e){var n=e[r];o(n)&&(t+=r+":"+n+";")}return t}function d(e){var t=p(e);if(t)return' style="'+t+'"';return""}function v(){return v=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},v.apply(null,arguments)}var y=/["'&<>]/;function g(e){if(!y.test(e))return e;for(var t="",r="",n=0,o=0;o<e.length;++o){switch(e.charCodeAt(o)){case 34:r=""";break;case 39:r="'";break;case 38:r="&";break;case 60:r="<";break;case 62:r=">";break;default:continue}o>n&&(t+=e.slice(n,o)),t+=r,n=o+1}return t+e.slice(n,o)}var m=":A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",b=m+"\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",x=new RegExp("^["+m+"]["+b+"]*$"),w={},T={};function k(e){if(void 0!==T[e])return!0;if(void 0!==w[e])return!1;if(x.test(e))return T[e]=!0,!0;return w[e]=!0,!1}var O=new Set(["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"]);function P(e,t,r){if(e.constructor.getDerivedStateFromProps)return v({},r,e.constructor.getDerivedStateFromProps(t,r));return r}function F(t,r){var n=t.props||e.EMPTY_OBJ;return 32768&t.flags?t.type.render(n,t.ref,r):t.type(n,r)}function S(){return S=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},S.apply(null,arguments)}function Q(t,r,o){var f=t.flags,p=t.type,v=t.props||e.EMPTY_OBJ,y=t.children;if(0!==(14&f)){if(4&f){var m,b=new p(v,o),x=Boolean(p.getDerivedStateFromProps);if(b.$BS=!1,b.$SSR=!0,a(b.getChildContext)&&(m=b.getChildContext()),m=i(m)?o:S({},o,m),b.props===e.EMPTY_OBJ&&(b.props=v),b.context=o,!x&&a(b.componentWillMount)){b.$BR=!0,b.componentWillMount(),b.$BR=!1;var w=b.$PS;if(w){var T=b.state;if(null===T)b.state=w;else for(var _ in w)T[_]=w[_];b.$PSS=!1,b.$PS=null}}x&&(b.state=P(b,v,b.state));var E=b.render(v,b.state,b.context);if(u(E))return"\x3c!--!--\x3e";if(s(E))return g(E);if(c(E))return E+"";return Q(E,t,m)}var N=F(t,o);if(u(N))return"\x3c!--!--\x3e";if(s(N))return g(N);if(c(N))return N+"";return Q(N,t,o)}if(0!==(481&f)){var j,L="<"+p,C=O.has(p),B=t.className;if(s(B)?L+=' class="'+g(B)+'"':c(B)&&(L+=' class="'+B+'"'),!l(v)){for(var M in v){var $=v[M];switch(M){case"dangerouslySetInnerHTML":j=$.__html;break;case"style":i(v.style)||(L+=d(v.style));break;case"children":case"className":break;case"defaultValue":v.value||(L+=' value="'+(s($)?g($):$)+'"');break;case"defaultChecked":v.checked||(L+=' checked="'+$+'"');break;default:k(M)&&(s($)?L+=" "+M+'="'+g($)+'"':c($)?L+=" "+M+'="'+$+'"':!0===$&&(L+=" "+M))}}"option"===p&&"undefined"!==typeof v.value&&v.value===r.props.value&&(L+=" selected")}if(C)L+=">";else{L+=">";var D=t.childFlags;if(2===D)L+=Q(y,t,o);else if(12&D)for(var R=0,A=y.length;R<A;++R)L+=Q(y[R],t,o);else 16===D?L+=""===y?" ":g(y):j&&(L+=j);C||(L+="</"+p+">")}if(String(p).match(/[\s\n/='"\0<>]/))throw L;return L}if(0!==(16&f))return""===y?" ":g(y);if(n(t)||0!==(8192&f)){var V=t.childFlags;if(2===V||n(t)&&0===t.length)return"\x3c!--!--\x3e";if(12&V||n(t)){for(var I=n(t)?t:y,G="",Y=0,W=I.length;Y<W;++Y)G+=Q(I[Y],t,o);return G}}else h();return""}function _(e){return Q(e,{},{})}function E(){return E=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},E.apply(null,arguments)}function N(e){var t=e.$PS;if(t){var r=e.state;e.state=null===r?t:E({},r,t),e.$PS=null}e.$BR=!1}function j(){return j=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},j.apply(null,arguments)}function L(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,C(e,t)}function C(e,t){return C=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},C(e,t)}var B=function(t){function r(e){var r;return(r=t.call(this)||this).collector=[1/0],r.promises=[],r.pushQueue=r.pushQueue.bind(r),e&&r.renderVNodeToQueue(e,null,null),r}L(r,t);var o=r.prototype;return o._read=function(){setTimeout(this.pushQueue,0)},o.addToQueue=function(e,t){if(i(t))"string"===typeof e&&this.collector.length-1===0?this.push(e):"string"===typeof e&&"string"===typeof this.collector[this.collector.length-2]?this.collector[this.collector.length-2]+=e:this.collector.splice(-1,0,e);else{var r=this.promises[t].length-1;"string"===typeof this.promises[t][r]&&"string"===typeof e?this.promises[t][r]+=e:this.promises[t].push(e)}},o.pushQueue=function(){var e=this,t=this.collector[0];"string"===typeof t?(this.push(t),this.collector.shift()):t&&("object"===typeof t||a(t))&&a(t.then)?(t.then((function(t){var r;(r=e.collector).splice.apply(r,[0,1].concat(e.promises[t])),e.promises[t]=null,setTimeout(e.pushQueue,0)})),this.collector[0]=null):t===1/0&&this.emit("end")},o.renderVNodeToQueue=function(t,r,o){var p=this,v=t.flags,y=t.type,m=t.props||e.EMPTY_OBJ,b=t.children;if((14&v)>0)if(4&v){var x,w=new y(m,r),T=Boolean(y.getDerivedStateFromProps);if(w.$BS=!1,w.$SSR=!0,f(w.getChildContext)||(x=w.getChildContext()),i(x)||(r=j({},r,x)),w.props===e.EMPTY_OBJ&&(w.props=m),w.context=r,!T&&a(w.componentWillMount)&&(w.$BR=!0,w.componentWillMount(),N(w)),a(w.getInitialProps)){var S=w.getInitialProps(w.props,w.context);if(S){if(Promise.resolve(S)===S){var Q=this.promises.push([])-1;return void this.addToQueue(S.then((function(e){"object"===typeof e&&(w.props=j({},w.props,e));var t=w.render(w.props,w.state,w.context);return u(t)?p.addToQueue("\x3c!--!--\x3e",Q):s(t)?p.addToQueue(g(t),Q):c(t)?p.addToQueue(t+"",Q):p.renderVNodeToQueue(t,w.context,Q),setTimeout(p.pushQueue,0),Q})),o)}w.props=j({},w.props,S)}}T&&(w.state=P(w,m,w.state));var _=w.render(w.props,w.state,w.context);u(_)?this.addToQueue("\x3c!--!--\x3e",o):s(_)?this.addToQueue(g(_),o):c(_)?this.addToQueue(_+"",o):this.renderVNodeToQueue(_,r,o)}else{var E=F(t,r);u(E)?this.addToQueue("\x3c!--!--\x3e",o):s(E)?this.addToQueue(g(E),o):c(E)?this.addToQueue(E+"",o):this.renderVNodeToQueue(E,r,o)}else if((481&v)>0){var L,C="<"+y,B=O.has(y),M=t.className;if(s(M)?C+=' class="'+g(M)+'"':c(M)&&(C+=' class="'+M+'"'),!l(m))for(var $ in m){var D=m[$];switch($){case"dangerouslySetInnerHTML":L=D.__html;break;case"style":i(m.style)||(C+=d(m.style));break;case"children":case"className":break;case"defaultValue":m.value||(C+=' value="'+(s(D)?g(D):D)+'"');break;case"defaultChecked":m.checked||(C+=' checked="'+D+'"');break;default:k($)&&(s(D)?C+=" "+$+'="'+g(D)+'"':c(D)?C+=" "+$+'="'+D+'"':!0===D&&(C+=" "+$))}}if(C+=">",String(y).match(/[\s\n/='"\0<>]/))throw C;if(B)this.addToQueue(C,o);else{var R=t.childFlags;if(2===R)return this.addToQueue(C,o),this.renderVNodeToQueue(b,r,o),void this.addToQueue("</"+y+">",o);if(16===R)return this.addToQueue(C,o),this.addToQueue(""===b?" ":g(b+""),o),void this.addToQueue("</"+y+">",o);if(12&R){this.addToQueue(C,o);for(var A=0,V=b.length;A<V;++A)this.renderVNodeToQueue(b[A],r,o);return void this.addToQueue("</"+y+">",o)}if(L)return void this.addToQueue(C+L+"</"+y+">",o);B||this.addToQueue(C+"</"+y+">",o)}}else if((16&v)>0)this.addToQueue(""===b?" ":g(b),o);else if(n(t)||0!==(8192&v)){var I=t.childFlags;if(2===I||n(t)&&0===t.length)this.addToQueue("\x3c!--!--\x3e",o);else if(12&I||n(t))for(var G=n(t)?t:t.children,Y=0,W=G.length;Y<W;++Y)this.renderVNodeToQueue(G[Y],r,o)}else h()},r}(t.Readable);function M(e){return new B(e)}function $(){return $=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},$.apply(null,arguments)}function D(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */D=function(){return t};var e,t={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(e,t,r){e[t]=r.value},i="function"==typeof Symbol?Symbol:{},u=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function c(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(e){c=function(e,t,r){return e[t]=r}}function l(e,t,r,n){var i=t&&t.prototype instanceof g?t:g,u=Object.create(i.prototype),a=new E(n||[]);return o(u,"_invoke",{value:F(e,r,a)}),u}function f(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}t.wrap=l;var h="suspendedStart",p="suspendedYield",d="executing",v="completed",y={};function g(){}function m(){}function b(){}var x={};c(x,u,(function(){return this}));var w=Object.getPrototypeOf,T=w&&w(w(N([])));T&&T!==r&&n.call(T,u)&&(x=T);var k=b.prototype=g.prototype=Object.create(x);function O(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function P(e,t){function r(o,i,u,a){var s=f(e[o],e,i);if("throw"!==s.type){var c=s.arg,l=c.value;return l&&"object"==typeof l&&n.call(l,"__await")?t.resolve(l.__await).then((function(e){r("next",e,u,a)}),(function(e){r("throw",e,u,a)})):t.resolve(l).then((function(e){c.value=e,u(c)}),(function(e){return r("throw",e,u,a)}))}a(s.arg)}var i;o(this,"_invoke",{value:function(e,n){function o(){return new t((function(t,o){r(e,n,t,o)}))}return i=i?i.then(o,o):o()}})}function F(t,r,n){var o=h;return function(i,u){if(o===d)throw Error("Generator is already running");if(o===v){if("throw"===i)throw u;return{value:e,done:!0}}for(n.method=i,n.arg=u;;){var a=n.delegate;if(a){var s=S(a,n);if(s){if(s===y)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===h)throw o=v,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=d;var c=f(t,r,n);if("normal"===c.type){if(o=n.done?v:p,c.arg===y)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(o=v,n.method="throw",n.arg=c.arg)}}}function S(t,r){var n=r.method,o=t.iterator[n];if(o===e)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=e,S(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),y;var i=f(o,t.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,y;var u=i.arg;return u?u.done?(r[t.resultName]=u.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,y):u:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,y)}function Q(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function _(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function E(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(Q,this),this.reset(!0)}function N(t){if(t||""===t){var r=t[u];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,i=function r(){for(;++o<t.length;)if(n.call(t,o))return r.value=t[o],r.done=!1,r;return r.value=e,r.done=!0,r};return i.next=i}}throw new TypeError(typeof t+" is not iterable")}return m.prototype=b,o(k,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:m,configurable:!0}),m.displayName=c(b,s,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===m||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,c(e,s,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},O(P.prototype),c(P.prototype,a,(function(){return this})),t.AsyncIterator=P,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var u=new P(l(e,r,n,o),i);return t.isGeneratorFunction(r)?u:u.next().then((function(e){return e.done?e.value:u.next()}))},O(k),c(k,s,"Generator"),c(k,u,(function(){return this})),c(k,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},t.values=N,E.prototype={constructor:E,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(_),!t)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function o(n,o){return a.type="throw",a.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var u=this.tryEntries[i],a=u.completion;if("root"===u.tryLoc)return o("end");if(u.tryLoc<=this.prev){var s=n.call(u,"catchLoc"),c=n.call(u,"finallyLoc");if(s&&c){if(this.prev<u.catchLoc)return o(u.catchLoc,!0);if(this.prev<u.finallyLoc)return o(u.finallyLoc)}else if(s){if(this.prev<u.catchLoc)return o(u.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<u.finallyLoc)return o(u.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var u=i?i.completion:{};return u.type=e,u.arg=t,i?(this.method="next",this.next=i.finallyLoc,y):this.complete(u)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),y},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),_(r),y}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;_(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:N(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),y}},t}function R(e,t,r,n,o,i,u){try{var a=e[i](u),s=a.value}catch(e){return void r(e)}a.done?t(s):Promise.resolve(s).then(n,o)}function A(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var i=e.apply(t,r);function u(e){R(i,n,o,u,a,"next",e)}function a(e){R(i,n,o,u,a,"throw",e)}u(void 0)}))}}function V(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,I(e,t)}function I(e,t){return I=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},I(e,t)}var G=Promise.resolve(),Y=function(e){function t(t){var r;return(r=e.call(this)||this).initNode=void 0,r.started=!1,r.initNode=t,r}V(t,e);var r=t.prototype;return r._read=function(){var e=this;if(this.started)return;this.started=!0,G.then((function(){return e.renderNode(e.initNode,null)})).then((function(){e.push(null)})).catch((function(t){e.emit("error",t)}))},r.renderNode=function(e,t){var r=e.flags;if((14&r)>0)return this.renderComponent(e,t,4&r);if((481&r)>0)return this.renderElement(e,t);if(n(e)||0!==(8192&r))return this.renderArrayOrFragment(e,t);this.renderText(e)},r.renderArrayOrFragment=function(e,t){var r=this,o=e.childFlags;if(2===o||n(e)&&0===e.length)return this.push("\x3c!--!--\x3e");if(12&o||n(e))return(n(e)?e:e.children).reduce(function(){var e=A(D().mark((function e(n,o){return D().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,n.then(A(D().mark((function e(){return D().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Promise.resolve(r.renderNode(o,t)).then((function(){return!!(16&o.flags)}));case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)}))));case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}(),Promise.resolve(!1))},r.renderComponent=function(e,t,r){var n=this,o=e.type,l=e.props;if(!r){var f=F(e,t);if(u(f))return this.push("\x3c!--!--\x3e");if(s(f))return this.push(g(f));if(c(f))return this.push(f+"");return this.renderNode(f,t)}var h,p=new o(l,t),d=Boolean(o.getDerivedStateFromProps);return p.$BS=!1,p.$SSR=!0,a(p.getChildContext)&&(h=p.getChildContext()),i(h)||(t=$({},t,h)),p.context=t,p.$BR=!0,Promise.resolve(!d&&(null==p.componentWillMount?void 0:p.componentWillMount())).then((function(){N(p),d&&(p.state=P(p,l,p.state));var e=p.render(p.props,p.state,p.context);if(u(e))return n.push("\x3c!--!--\x3e");if(s(e))return n.push(g(e));if(c(e))return n.push(e+"");return n.renderNode(e,t)}))},r.renderChildren=function(e,t,r){var n=this;if(2===r)return this.renderNode(e,t);if(16===r)return this.push(""===e?" ":g(e+""));if(12&r)return e.reduce(function(){var e=A(D().mark((function e(r,o){return D().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,r.then(A(D().mark((function e(){return D().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Promise.resolve(n.renderNode(o,t)).then((function(){return!!(16&o.flags)}));case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)}))));case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}(),Promise.resolve(!1))},r.renderText=function(e){this.push(""===e.children?" ":g(e.children))},r.renderElement=function(e,t){var r,n=this,o=e.type,u=e.props,a="<"+o,f=O.has(o),h=e.className;if(s(h)?a+=' class="'+g(h)+'"':c(h)&&(a+=' class="'+h+'"'),!l(u))for(var p in u){var v=u[p];switch(p){case"dangerouslySetInnerHTML":r=v.__html;break;case"style":i(u.style)||(a+=d(u.style));break;case"children":case"className":break;case"defaultValue":u.value||(a+=' value="'+(s(v)?g(v):v)+'"');break;case"defaultChecked":u.checked||(a+=' checked="'+v+'"');break;default:if(k(p)){s(v)?a+=" "+p+'="'+g(v)+'"':c(v)?a+=" "+p+'="'+v+'"':!0===v&&(a+=" "+p);break}}}if(a+=">",this.push(a),String(o).match(/[\s\n/='"\0<>]/))throw a;if(f)return;if(r)return this.push(r),void this.push("</"+o+">");var y=e.childFlags;if(1===y)return void this.push("</"+o+">");return Promise.resolve(this.renderChildren(e.children,t,y)).then((function(){n.push("</"+o+">")}))},t}(t.Readable);function W(e){return new Y(e)}exports.RenderQueueStream=B,exports.RenderStream=Y,exports.renderToStaticMarkup=_,exports.renderToString=_,exports.streamAsStaticMarkup=W,exports.streamAsString=W,exports.streamQueueAsStaticMarkup=M,exports.streamQueueAsString=M;