isomorfeus-preact 10.6.62 → 10.7.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (93) hide show
  1. checksums.yaml +4 -4
  2. data/lib/lucid_prop_declaration/mixin.rb +3 -3
  3. data/lib/preact/component/callbacks.rb +2 -2
  4. data/lib/preact/component_resolution.rb +10 -2
  5. data/lib/preact/version.rb +1 -1
  6. data/node_modules/.package-lock.json +40 -40
  7. data/node_modules/preact/README.md +39 -38
  8. data/node_modules/preact/compat/client.js +13 -0
  9. data/node_modules/preact/compat/client.mjs +13 -0
  10. data/node_modules/preact/compat/dist/compat.js +1 -1
  11. data/node_modules/preact/compat/dist/compat.js.map +1 -1
  12. data/node_modules/preact/compat/dist/compat.mjs +1 -1
  13. data/node_modules/preact/compat/dist/compat.module.js +1 -1
  14. data/node_modules/preact/compat/dist/compat.module.js.map +1 -1
  15. data/node_modules/preact/compat/dist/compat.umd.js +1 -1
  16. data/node_modules/preact/compat/dist/compat.umd.js.map +1 -1
  17. data/node_modules/preact/compat/src/forwardRef.js +2 -9
  18. data/node_modules/preact/compat/src/index.d.ts +15 -1
  19. data/node_modules/preact/compat/src/portals.js +3 -1
  20. data/node_modules/preact/compat/src/suspense.js +2 -2
  21. data/node_modules/preact/debug/dist/debug.js +1 -1
  22. data/node_modules/preact/debug/dist/debug.js.map +1 -1
  23. data/node_modules/preact/debug/dist/debug.mjs +1 -1
  24. data/node_modules/preact/debug/dist/debug.module.js +1 -1
  25. data/node_modules/preact/debug/dist/debug.module.js.map +1 -1
  26. data/node_modules/preact/debug/dist/debug.umd.js +1 -1
  27. data/node_modules/preact/debug/dist/debug.umd.js.map +1 -1
  28. data/node_modules/preact/debug/src/debug.js +4 -2
  29. data/node_modules/preact/devtools/dist/devtools.js +1 -1
  30. data/node_modules/preact/devtools/dist/devtools.js.map +1 -1
  31. data/node_modules/preact/devtools/dist/devtools.mjs +1 -1
  32. data/node_modules/preact/devtools/dist/devtools.module.js +1 -1
  33. data/node_modules/preact/devtools/dist/devtools.module.js.map +1 -1
  34. data/node_modules/preact/devtools/dist/devtools.umd.js +1 -1
  35. data/node_modules/preact/devtools/dist/devtools.umd.js.map +1 -1
  36. data/node_modules/preact/devtools/src/devtools.js +1 -1
  37. data/node_modules/preact/dist/preact.js +1 -1
  38. data/node_modules/preact/dist/preact.js.map +1 -1
  39. data/node_modules/preact/dist/preact.min.js +1 -1
  40. data/node_modules/preact/dist/preact.min.js.map +1 -1
  41. data/node_modules/preact/dist/preact.mjs +1 -1
  42. data/node_modules/preact/dist/preact.module.js +1 -1
  43. data/node_modules/preact/dist/preact.module.js.map +1 -1
  44. data/node_modules/preact/dist/preact.umd.js +1 -1
  45. data/node_modules/preact/dist/preact.umd.js.map +1 -1
  46. data/node_modules/preact/hooks/dist/hooks.js +1 -1
  47. data/node_modules/preact/hooks/dist/hooks.js.map +1 -1
  48. data/node_modules/preact/hooks/dist/hooks.mjs +1 -1
  49. data/node_modules/preact/hooks/dist/hooks.module.js +1 -1
  50. data/node_modules/preact/hooks/dist/hooks.module.js.map +1 -1
  51. data/node_modules/preact/hooks/dist/hooks.umd.js +1 -1
  52. data/node_modules/preact/hooks/dist/hooks.umd.js.map +1 -1
  53. data/node_modules/preact/hooks/src/index.js +7 -2
  54. data/node_modules/preact/jsx-runtime/dist/jsxRuntime.js +1 -1
  55. data/node_modules/preact/jsx-runtime/dist/jsxRuntime.js.map +1 -1
  56. data/node_modules/preact/jsx-runtime/dist/jsxRuntime.mjs +1 -1
  57. data/node_modules/preact/jsx-runtime/dist/jsxRuntime.module.js +1 -1
  58. data/node_modules/preact/jsx-runtime/dist/jsxRuntime.module.js.map +1 -1
  59. data/node_modules/preact/jsx-runtime/dist/jsxRuntime.umd.js +1 -1
  60. data/node_modules/preact/jsx-runtime/dist/jsxRuntime.umd.js.map +1 -1
  61. data/node_modules/preact/jsx-runtime/src/index.js +2 -2
  62. data/node_modules/preact/package.json +41 -30
  63. data/node_modules/preact/src/diff/catch-error.js +4 -2
  64. data/node_modules/preact/src/diff/props.js +1 -1
  65. data/node_modules/preact/src/index.d.ts +8 -1
  66. data/node_modules/preact/src/internal.d.ts +10 -1
  67. data/node_modules/preact/src/jsx.d.ts +8 -1
  68. data/node_modules/preact/test-utils/dist/testUtils.js +1 -1
  69. data/node_modules/preact/test-utils/dist/testUtils.js.map +1 -1
  70. data/node_modules/preact/test-utils/dist/testUtils.mjs +1 -1
  71. data/node_modules/preact/test-utils/dist/testUtils.module.js +1 -1
  72. data/node_modules/preact/test-utils/dist/testUtils.module.js.map +1 -1
  73. data/node_modules/preact/test-utils/dist/testUtils.umd.js +1 -1
  74. data/node_modules/preact/test-utils/dist/testUtils.umd.js.map +1 -1
  75. data/node_modules/preact/test-utils/src/index.js +2 -1
  76. data/node_modules/preact-render-to-string/dist/commonjs.js +1 -1
  77. data/node_modules/preact-render-to-string/dist/commonjs.js.map +1 -1
  78. data/node_modules/preact-render-to-string/dist/index.js.map +1 -1
  79. data/node_modules/preact-render-to-string/dist/index.mjs +1 -1
  80. data/node_modules/preact-render-to-string/dist/index.module.js +1 -1
  81. data/node_modules/preact-render-to-string/dist/index.module.js.map +1 -1
  82. data/node_modules/preact-render-to-string/dist/jsx-entry.js +1 -1
  83. data/node_modules/preact-render-to-string/dist/jsx-entry.js.map +1 -1
  84. data/node_modules/preact-render-to-string/dist/jsx.js.map +1 -1
  85. data/node_modules/preact-render-to-string/dist/jsx.mjs +1 -1
  86. data/node_modules/preact-render-to-string/dist/jsx.modern.js +1 -1
  87. data/node_modules/preact-render-to-string/dist/jsx.modern.js.map +1 -1
  88. data/node_modules/preact-render-to-string/dist/jsx.module.js +1 -1
  89. data/node_modules/preact-render-to-string/dist/jsx.module.js.map +1 -1
  90. data/node_modules/preact-render-to-string/package.json +1 -1
  91. data/node_modules/preact-render-to-string/src/index.js +31 -9
  92. data/package.json +2 -2
  93. metadata +22 -14
@@ -61,11 +61,12 @@ export function act(cb) {
61
61
  toFlush();
62
62
  rerender();
63
63
  }
64
- teardown();
65
64
  } catch (e) {
66
65
  if (!err) {
67
66
  err = e;
68
67
  }
68
+ } finally {
69
+ teardown();
69
70
  }
70
71
 
71
72
  options.requestAnimationFrame = previousRequestAnimationFrame;
@@ -1,2 +1,2 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("preact")):"function"==typeof define&&define.amd?define(["exports","preact"],t):t((e||self).preactRenderToString={},e.preact)}(this,function(e,t){var n=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|^--/i,r=/[&<>"]/;function o(e){var t=String(e);return r.test(t)?t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;"):t}var i=function(e,t){return String(e).replace(/(\n+)/g,"$1"+(t||"\t"))},a=function(e,t,n){return String(e).length>(t||40)||!n&&-1!==String(e).indexOf("\n")||-1!==String(e).indexOf("<")},l={};function s(e){var t="";for(var r in e){var o=e[r];null!=o&&""!==o&&(t&&(t+=" "),t+="-"==r[0]?r:l[r]||(l[r]=r.replace(/([A-Z])/g,"-$1").toLowerCase()),t+=": ",t+=o,"number"==typeof o&&!1===n.test(r)&&(t+="px"),t+=";")}return t||void 0}function f(e,t){for(var n in t)e[n]=t[n];return e}function p(e,t){return Array.isArray(t)?t.reduce(p,e):null!=t&&!1!==t&&e.push(t),e}var u={shallow:!0},c=[],_=/^(area|base|br|col|embed|hr|img|input|link|meta|param|source|track|wbr)$/,d=/[\s\n\\/='"\0<>]/,v=function(){};y.render=y;var g=function(e,t){return y(e,t,u)},h=[];function y(e,n,r){n=n||{},r=r||{};var o=t.options.__s;t.options.__s=!0;var i=m(e,n,r);return t.options.__c&&t.options.__c(e,h),h.length=0,t.options.__s=o,i}function m(e,n,r,l,u,g){if(null==e||"boolean"==typeof e)return"";if("object"!=typeof e)return o(e);var h=r.pretty,y=h&&"string"==typeof h?h:"\t";if(Array.isArray(e)){for(var x="",b=0;b<e.length;b++)h&&b>0&&(x+="\n"),x+=m(e[b],n,r,l,u,g);return x}var S,w=e.type,k=e.props,O=!1;if("function"==typeof w){if(O=!0,!r.shallow||!l&&!1!==r.renderRootComponent){if(w===t.Fragment){var T=[];return p(T,e.props.children),m(T,n,r,!1!==r.shallowHighOrder,u,g)}var C,A=e.__c={__v:e,context:n,props:e.props,setState:v,forceUpdate:v,__h:[]};if(t.options.__b&&t.options.__b(e),t.options.__r&&t.options.__r(e),w.prototype&&"function"==typeof w.prototype.render){var j=w.contextType,F=j&&n[j.__c],H=null!=j?F?F.props.value:j.__:n;(A=e.__c=new w(k,H)).__v=e,A._dirty=A.__d=!0,A.props=k,null==A.state&&(A.state={}),null==A._nextState&&null==A.__s&&(A._nextState=A.__s=A.state),A.context=H,w.getDerivedStateFromProps?A.state=f(f({},A.state),w.getDerivedStateFromProps(A.props,A.state)):A.componentWillMount&&(A.componentWillMount(),A.state=A._nextState!==A.state?A._nextState:A.__s!==A.state?A.__s:A.state),C=A.render(A.props,A.state,A.context)}else{var M=w.contextType,$=M&&n[M.__c];C=w.call(e.__c,k,null!=M?$?$.props.value:M.__:n)}return A.getChildContext&&(n=f(f({},n),A.getChildContext())),t.options.diffed&&t.options.diffed(e),m(C,n,r,!1!==r.shallowHighOrder,u,g)}w=(S=w).displayName||S!==Function&&S.name||function(e){var t=(Function.prototype.toString.call(e).match(/^\s*function\s+([^( ]+)/)||"")[1];if(!t){for(var n=-1,r=c.length;r--;)if(c[r]===e){n=r;break}n<0&&(n=c.push(e)-1),t="UnnamedComponent"+n}return t}(S)}var L,R,E="<"+w;if(k){var q=Object.keys(k);r&&!0===r.sortAttributes&&q.sort();for(var D=0;D<q.length;D++){var N=q[D],P=k[N];if("children"!==N){if(!d.test(N)&&(r&&r.allAttributes||"key"!==N&&"ref"!==N&&"__self"!==N&&"__source"!==N)){if("defaultValue"===N)N="value";else if("className"===N){if(void 0!==k.class)continue;N="class"}else u&&N.match(/^xlink:?./)&&(N=N.toLowerCase().replace(/^xlink:?/,"xlink:"));if("htmlFor"===N){if(k.for)continue;N="for"}"style"===N&&P&&"object"==typeof P&&(P=s(P)),"a"===N[0]&&"r"===N[1]&&"boolean"==typeof P&&(P=String(P));var U=r.attributeHook&&r.attributeHook(N,P,n,r,O);if(U||""===U)E+=U;else if("dangerouslySetInnerHTML"===N)R=P&&P.__html;else if("textarea"===w&&"value"===N)L=P;else if((P||0===P||""===P)&&"function"!=typeof P){if(!(!0!==P&&""!==P||(P=N,r&&r.xml))){E+=" "+N;continue}if("value"===N){if("select"===w){g=P;continue}"option"===w&&g==P&&(E+=" selected")}E+=" "+N+'="'+o(P)+'"'}}}else L=P}}if(h){var W=E.replace(/\n\s*/," ");W===E||~W.indexOf("\n")?h&&~E.indexOf("\n")&&(E+="\n"):E=W}if(E+=">",d.test(w))throw new Error(w+" is not a valid HTML tag name in "+E);var z,I=_.test(w)||r.voidElements&&r.voidElements.test(w),V=[];if(R)h&&a(R)&&(R="\n"+y+i(R,y)),E+=R;else if(null!=L&&p(z=[],L).length){for(var Z=h&&~E.indexOf("\n"),B=!1,G=0;G<z.length;G++){var J=z[G];if(null!=J&&!1!==J){var K=m(J,n,r,!0,"svg"===w||"foreignObject"!==w&&u,g);if(h&&!Z&&a(K)&&(Z=!0),K)if(h){var Q=K.length>0&&"<"!=K[0];B&&Q?V[V.length-1]+=K:V.push(K),B=Q}else V.push(K)}}if(h&&Z)for(var X=V.length;X--;)V[X]="\n"+y+i(V[X],y)}if(V.length||R)E+=V.join("");else if(r&&r.xml)return E.substring(0,E.length-1)+" />";return!I||z||R?(h&&~E.indexOf("\n")&&(E+="\n"),E+="</"+w+">"):E=E.replace(/>$/," />"),E}y.shallowRender=g,e.default=y,e.render=y,e.renderToStaticMarkup=y,e.renderToString=y,e.shallowRender=g});
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("preact")):"function"==typeof define&&define.amd?define(["exports","preact"],t):t((e||self).preactRenderToString={},e.preact)}(this,function(e,t){var n=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|^--/i,r=/[&<>"]/;function o(e){var t=String(e);return r.test(t)?t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;"):t}var i=function(e,t){return String(e).replace(/(\n+)/g,"$1"+(t||"\t"))},a=function(e,t,n){return String(e).length>(t||40)||!n&&-1!==String(e).indexOf("\n")||-1!==String(e).indexOf("<")},l={};function s(e){var t="";for(var r in e){var o=e[r];null!=o&&""!==o&&(t&&(t+=" "),t+="-"==r[0]?r:l[r]||(l[r]=r.replace(/([A-Z])/g,"-$1").toLowerCase()),t+=": ",t+=o,"number"==typeof o&&!1===n.test(r)&&(t+="px"),t+=";")}return t||void 0}function f(e,t){for(var n in t)e[n]=t[n];return e}function p(e,t){return Array.isArray(t)?t.reduce(p,e):null!=t&&!1!==t&&e.push(t),e}var u={shallow:!0},c=[],_=/^(area|base|br|col|embed|hr|img|input|link|meta|param|source|track|wbr)$/,d=/[\s\n\\/='"\0<>]/;function v(){this.__d=!0}y.render=y;var g=function(e,t){return y(e,t,u)},h=[];function y(e,n,r){n=n||{},r=r||{};var o=t.options.__s;t.options.__s=!0;var i=m(e,n,r);return t.options.__c&&t.options.__c(e,h),h.length=0,t.options.__s=o,i}function m(e,n,r,l,u,g){if(null==e||"boolean"==typeof e)return"";if("object"!=typeof e)return o(e);var h=r.pretty,y=h&&"string"==typeof h?h:"\t";if(Array.isArray(e)){for(var x="",b=0;b<e.length;b++)h&&b>0&&(x+="\n"),x+=m(e[b],n,r,l,u,g);return x}var S,w=e.type,k=e.props,O=!1;if("function"==typeof w){if(O=!0,!r.shallow||!l&&!1!==r.renderRootComponent){if(w===t.Fragment){var T=[];return p(T,e.props.children),m(T,n,r,!1!==r.shallowHighOrder,u,g)}var C,A=e.__c={__v:e,context:n,props:e.props,setState:v,forceUpdate:v,__d:!0,__h:[]};t.options.__b&&t.options.__b(e);var j=t.options.__r;if(w.prototype&&"function"==typeof w.prototype.render){var F=w.contextType,H=F&&n[F.__c],M=null!=F?H?H.props.value:F.__:n;(A=e.__c=new w(k,M)).__v=e,A._dirty=A.__d=!0,A.props=k,null==A.state&&(A.state={}),null==A._nextState&&null==A.__s&&(A._nextState=A.__s=A.state),A.context=M,w.getDerivedStateFromProps?A.state=f(f({},A.state),w.getDerivedStateFromProps(A.props,A.state)):A.componentWillMount&&(A.componentWillMount(),A.state=A._nextState!==A.state?A._nextState:A.__s!==A.state?A.__s:A.state),j&&j(e),C=A.render(A.props,A.state,A.context)}else for(var $=w.contextType,L=$&&n[$.__c],R=null!=$?L?L.props.value:$.__:n,E=0;A.__d&&E++<25;)A.__d=!1,j&&j(e),C=w.call(e.__c,k,R);return A.getChildContext&&(n=f(f({},n),A.getChildContext())),t.options.diffed&&t.options.diffed(e),m(C,n,r,!1!==r.shallowHighOrder,u,g)}w=(S=w).displayName||S!==Function&&S.name||function(e){var t=(Function.prototype.toString.call(e).match(/^\s*function\s+([^( ]+)/)||"")[1];if(!t){for(var n=-1,r=c.length;r--;)if(c[r]===e){n=r;break}n<0&&(n=c.push(e)-1),t="UnnamedComponent"+n}return t}(S)}var q,D,N="<"+w;if(k){var P=Object.keys(k);r&&!0===r.sortAttributes&&P.sort();for(var U=0;U<P.length;U++){var W=P[U],z=k[W];if("children"!==W){if(!d.test(W)&&(r&&r.allAttributes||"key"!==W&&"ref"!==W&&"__self"!==W&&"__source"!==W)){if("defaultValue"===W)W="value";else if("className"===W){if(void 0!==k.class)continue;W="class"}else u&&W.match(/^xlink:?./)&&(W=W.toLowerCase().replace(/^xlink:?/,"xlink:"));if("htmlFor"===W){if(k.for)continue;W="for"}"style"===W&&z&&"object"==typeof z&&(z=s(z)),"a"===W[0]&&"r"===W[1]&&"boolean"==typeof z&&(z=String(z));var I=r.attributeHook&&r.attributeHook(W,z,n,r,O);if(I||""===I)N+=I;else if("dangerouslySetInnerHTML"===W)D=z&&z.__html;else if("textarea"===w&&"value"===W)q=z;else if((z||0===z||""===z)&&"function"!=typeof z){if(!(!0!==z&&""!==z||(z=W,r&&r.xml))){N+=" "+W;continue}if("value"===W){if("select"===w){g=z;continue}"option"===w&&g==z&&void 0===k.selected&&(N+=" selected")}N+=" "+W+'="'+o(z)+'"'}}}else q=z}}if(h){var V=N.replace(/\n\s*/," ");V===N||~V.indexOf("\n")?h&&~N.indexOf("\n")&&(N+="\n"):N=V}if(N+=">",d.test(w))throw new Error(w+" is not a valid HTML tag name in "+N);var Z,B=_.test(w)||r.voidElements&&r.voidElements.test(w),G=[];if(D)h&&a(D)&&(D="\n"+y+i(D,y)),N+=D;else if(null!=q&&p(Z=[],q).length){for(var J=h&&~N.indexOf("\n"),K=!1,Q=0;Q<Z.length;Q++){var X=Z[Q];if(null!=X&&!1!==X){var Y=m(X,n,r,!0,"svg"===w||"foreignObject"!==w&&u,g);if(h&&!J&&a(Y)&&(J=!0),Y)if(h){var ee=Y.length>0&&"<"!=Y[0];K&&ee?G[G.length-1]+=Y:G.push(Y),K=ee}else G.push(Y)}}if(h&&J)for(var te=G.length;te--;)G[te]="\n"+y+i(G[te],y)}if(G.length||D)N+=G.join("");else if(r&&r.xml)return N.substring(0,N.length-1)+" />";return!B||Z||D?(h&&~N.indexOf("\n")&&(N+="\n"),N+="</"+w+">"):N=N.replace(/>$/," />"),N}y.shallowRender=g,e.default=y,e.render=y,e.renderToStaticMarkup=y,e.renderToString=y,e.shallowRender=g});
2
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../src/util.js","../src/index.js"],"sourcesContent":["// DOM properties that should NOT have \"px\" added when numeric\nexport const IS_NON_DIMENSIONAL = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|^--/i;\n\nconst ENCODED_ENTITIES = /[&<>\"]/;\n\nexport function encodeEntities(input) {\n\tconst s = String(input);\n\tif (!ENCODED_ENTITIES.test(s)) {\n\t\treturn s;\n\t}\n\treturn s\n\t\t.replace(/&/g, '&amp;')\n\t\t.replace(/</g, '&lt;')\n\t\t.replace(/>/g, '&gt;')\n\t\t.replace(/\"/g, '&quot;');\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\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\tif (str) str += ' ';\n\t\t\t// str += jsToCss(prop);\n\t\t\tstr +=\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(/([A-Z])/g, '-$1').toLowerCase());\n\t\t\tstr += ': ';\n\t\t\tstr += val;\n\t\t\tif (typeof val === 'number' && IS_NON_DIMENSIONAL.test(prop) === false) {\n\t\t\t\tstr += 'px';\n\t\t\t}\n\t\t\tstr += ';';\n\t\t}\n\t}\n\treturn str || undefined;\n}\n\n/**\n * Copy all properties from `props` onto `obj`.\n * @param {object} obj Object onto which properties should be copied.\n * @param {object} props Object from which to copy properties.\n * @returns {object}\n * @private\n */\nexport function assign(obj, props) {\n\tfor (let i in props) obj[i] = props[i];\n\treturn obj;\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","import {\n\tencodeEntities,\n\tindent,\n\tisLargeString,\n\tstyleObjToCss,\n\tassign,\n\tgetChildren\n} from './util';\nimport { options, Fragment } from 'preact';\n\n/** @typedef {import('preact').VNode} VNode */\n\nconst SHALLOW = { shallow: true };\n\n// components without names, kept as a hash for later comparison to return consistent UnnamedComponentXX names.\nconst UNNAMED = [];\n\nconst VOID_ELEMENTS =\n\t/^(area|base|br|col|embed|hr|img|input|link|meta|param|source|track|wbr)$/;\n\nconst UNSAFE_NAME = /[\\s\\n\\\\/='\"\\0<>]/;\n\nconst noop = () => {};\n\n/** Render Preact JSX + Components to an HTML string.\n *\t@name render\n *\t@function\n *\t@param {VNode} vnode\tJSX VNode to render.\n *\t@param {Object} [context={}]\tOptionally pass an initial context object through the render path.\n *\t@param {Object} [options={}]\tRendering options\n *\t@param {Boolean} [options.shallow=false]\tIf `true`, renders nested Components as HTML elements (`<Foo a=\"b\" />`).\n *\t@param {Boolean} [options.xml=false]\t\tIf `true`, uses self-closing tags for elements without children.\n *\t@param {Boolean} [options.pretty=false]\t\tIf `true`, adds whitespace for readability\n *\t@param {RegExp|undefined} [options.voidElements] RegeEx that matches elements that are considered void (self-closing)\n */\nrenderToString.render = renderToString;\n\n/** Only render elements, leaving Components inline as `<ComponentName ... />`.\n *\tThis method is just a convenience alias for `render(vnode, context, { shallow:true })`\n *\t@name shallow\n *\t@function\n *\t@param {VNode} vnode\tJSX VNode to render.\n *\t@param {Object} [context={}]\tOptionally pass an initial context object through the render path.\n */\nlet shallowRender = (vnode, context) => renderToString(vnode, context, SHALLOW);\n\nconst EMPTY_ARR = [];\nfunction renderToString(vnode, context, opts) {\n\tcontext = context || {};\n\topts = opts || {};\n\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.__s;\n\toptions.__s = true;\n\n\tconst res = _renderToString(vnode, context, opts);\n\n\t// options._commit, we don't schedule any effects in this library right now,\n\t// so we can pass an empty queue to this hook.\n\tif (options.__c) options.__c(vnode, EMPTY_ARR);\n\tEMPTY_ARR.length = 0;\n\toptions.__s = previousSkipEffects;\n\treturn res;\n}\n\n/** The default export is an alias of `render()`. */\nfunction _renderToString(vnode, context, opts, inner, isSvgMode, selectValue) {\n\tif (vnode == null || typeof vnode === 'boolean') {\n\t\treturn '';\n\t}\n\n\t// #text nodes\n\tif (typeof vnode !== 'object') {\n\t\treturn encodeEntities(vnode);\n\t}\n\n\tlet pretty = opts.pretty,\n\t\tindentChar = pretty && typeof pretty === 'string' ? pretty : '\\t';\n\n\tif (Array.isArray(vnode)) {\n\t\tlet rendered = '';\n\t\tfor (let i = 0; i < vnode.length; i++) {\n\t\t\tif (pretty && i > 0) rendered += '\\n';\n\t\t\trendered += _renderToString(\n\t\t\t\tvnode[i],\n\t\t\t\tcontext,\n\t\t\t\topts,\n\t\t\t\tinner,\n\t\t\t\tisSvgMode,\n\t\t\t\tselectValue\n\t\t\t);\n\t\t}\n\t\treturn rendered;\n\t}\n\n\tlet nodeName = vnode.type,\n\t\tprops = vnode.props,\n\t\tisComponent = false;\n\n\t// components\n\tif (typeof nodeName === 'function') {\n\t\tisComponent = true;\n\t\tif (opts.shallow && (inner || opts.renderRootComponent === false)) {\n\t\t\tnodeName = getComponentName(nodeName);\n\t\t} else if (nodeName === Fragment) {\n\t\t\tconst children = [];\n\t\t\tgetChildren(children, vnode.props.children);\n\t\t\treturn _renderToString(\n\t\t\t\tchildren,\n\t\t\t\tcontext,\n\t\t\t\topts,\n\t\t\t\topts.shallowHighOrder !== false,\n\t\t\t\tisSvgMode,\n\t\t\t\tselectValue\n\t\t\t);\n\t\t} else {\n\t\t\tlet rendered;\n\n\t\t\tlet c = (vnode.__c = {\n\t\t\t\t__v: vnode,\n\t\t\t\tcontext,\n\t\t\t\tprops: vnode.props,\n\t\t\t\t// silently drop state updates\n\t\t\t\tsetState: noop,\n\t\t\t\tforceUpdate: noop,\n\t\t\t\t// hooks\n\t\t\t\t__h: []\n\t\t\t});\n\n\t\t\t// options._diff\n\t\t\tif (options.__b) options.__b(vnode);\n\n\t\t\t// options._render\n\t\t\tif (options.__r) options.__r(vnode);\n\n\t\t\tif (\n\t\t\t\t!nodeName.prototype ||\n\t\t\t\ttypeof nodeName.prototype.render !== 'function'\n\t\t\t) {\n\t\t\t\t// Necessary for createContext api. Setting this property will pass\n\t\t\t\t// the context value as `this.context` just for this component.\n\t\t\t\tlet cxType = nodeName.contextType;\n\t\t\t\tlet provider = cxType && context[cxType.__c];\n\t\t\t\tlet cctx =\n\t\t\t\t\tcxType != null\n\t\t\t\t\t\t? provider\n\t\t\t\t\t\t\t? provider.props.value\n\t\t\t\t\t\t\t: cxType.__\n\t\t\t\t\t\t: context;\n\n\t\t\t\t// stateless functional components\n\t\t\t\trendered = nodeName.call(vnode.__c, props, cctx);\n\t\t\t} else {\n\t\t\t\t// class-based components\n\t\t\t\tlet cxType = nodeName.contextType;\n\t\t\t\tlet provider = cxType && context[cxType.__c];\n\t\t\t\tlet cctx =\n\t\t\t\t\tcxType != null\n\t\t\t\t\t\t? provider\n\t\t\t\t\t\t\t? provider.props.value\n\t\t\t\t\t\t\t: cxType.__\n\t\t\t\t\t\t: context;\n\n\t\t\t\t// c = new nodeName(props, context);\n\t\t\t\tc = vnode.__c = new nodeName(props, cctx);\n\t\t\t\tc.__v = vnode;\n\t\t\t\t// turn off stateful re-rendering:\n\t\t\t\tc._dirty = c.__d = true;\n\t\t\t\tc.props = props;\n\t\t\t\tif (c.state == null) c.state = {};\n\n\t\t\t\tif (c._nextState == null && c.__s == null) {\n\t\t\t\t\tc._nextState = c.__s = c.state;\n\t\t\t\t}\n\n\t\t\t\tc.context = cctx;\n\t\t\t\tif (nodeName.getDerivedStateFromProps)\n\t\t\t\t\tc.state = assign(\n\t\t\t\t\t\tassign({}, c.state),\n\t\t\t\t\t\tnodeName.getDerivedStateFromProps(c.props, c.state)\n\t\t\t\t\t);\n\t\t\t\telse if (c.componentWillMount) {\n\t\t\t\t\tc.componentWillMount();\n\n\t\t\t\t\t// If the user called setState in cWM we need to flush pending,\n\t\t\t\t\t// state updates. This is the same behaviour in React.\n\t\t\t\t\tc.state =\n\t\t\t\t\t\tc._nextState !== c.state\n\t\t\t\t\t\t\t? c._nextState\n\t\t\t\t\t\t\t: c.__s !== c.state\n\t\t\t\t\t\t\t? c.__s\n\t\t\t\t\t\t\t: c.state;\n\t\t\t\t}\n\n\t\t\t\trendered = c.render(c.props, c.state, c.context);\n\t\t\t}\n\n\t\t\tif (c.getChildContext) {\n\t\t\t\tcontext = assign(assign({}, context), c.getChildContext());\n\t\t\t}\n\n\t\t\tif (options.diffed) options.diffed(vnode);\n\t\t\treturn _renderToString(\n\t\t\t\trendered,\n\t\t\t\tcontext,\n\t\t\t\topts,\n\t\t\t\topts.shallowHighOrder !== false,\n\t\t\t\tisSvgMode,\n\t\t\t\tselectValue\n\t\t\t);\n\t\t}\n\t}\n\n\t// render JSX to HTML\n\tlet s = '<' + nodeName,\n\t\tpropChildren,\n\t\thtml;\n\n\tif (props) {\n\t\tlet attrs = Object.keys(props);\n\n\t\t// allow sorting lexicographically for more determinism (useful for tests, such as via preact-jsx-chai)\n\t\tif (opts && opts.sortAttributes === true) attrs.sort();\n\n\t\tfor (let i = 0; i < attrs.length; i++) {\n\t\t\tlet name = attrs[i],\n\t\t\t\tv = props[name];\n\t\t\tif (name === 'children') {\n\t\t\t\tpropChildren = v;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (UNSAFE_NAME.test(name)) continue;\n\n\t\t\tif (\n\t\t\t\t!(opts && opts.allAttributes) &&\n\t\t\t\t(name === 'key' ||\n\t\t\t\t\tname === 'ref' ||\n\t\t\t\t\tname === '__self' ||\n\t\t\t\t\tname === '__source')\n\t\t\t)\n\t\t\t\tcontinue;\n\n\t\t\tif (name === 'defaultValue') {\n\t\t\t\tname = 'value';\n\t\t\t} else if (name === 'className') {\n\t\t\t\tif (typeof props.class !== 'undefined') continue;\n\t\t\t\tname = 'class';\n\t\t\t} else if (isSvgMode && name.match(/^xlink:?./)) {\n\t\t\t\tname = name.toLowerCase().replace(/^xlink:?/, 'xlink:');\n\t\t\t}\n\n\t\t\tif (name === 'htmlFor') {\n\t\t\t\tif (props.for) continue;\n\t\t\t\tname = 'for';\n\t\t\t}\n\n\t\t\tif (name === 'style' && v && typeof v === 'object') {\n\t\t\t\tv = styleObjToCss(v);\n\t\t\t}\n\n\t\t\t// always use string values instead of booleans for aria attributes\n\t\t\t// also see https://github.com/preactjs/preact/pull/2347/files\n\t\t\tif (name[0] === 'a' && name['1'] === 'r' && typeof v === 'boolean') {\n\t\t\t\tv = String(v);\n\t\t\t}\n\n\t\t\tlet hooked =\n\t\t\t\topts.attributeHook &&\n\t\t\t\topts.attributeHook(name, v, context, opts, isComponent);\n\t\t\tif (hooked || hooked === '') {\n\t\t\t\ts += hooked;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (name === 'dangerouslySetInnerHTML') {\n\t\t\t\thtml = v && v.__html;\n\t\t\t} else if (nodeName === 'textarea' && name === 'value') {\n\t\t\t\t// <textarea value=\"a&b\"> --> <textarea>a&amp;b</textarea>\n\t\t\t\tpropChildren = v;\n\t\t\t} else if ((v || v === 0 || v === '') && typeof v !== 'function') {\n\t\t\t\tif (v === true || v === '') {\n\t\t\t\t\tv = name;\n\t\t\t\t\t// in non-xml mode, allow boolean attributes\n\t\t\t\t\tif (!opts || !opts.xml) {\n\t\t\t\t\t\ts += ' ' + name;\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (name === 'value') {\n\t\t\t\t\tif (nodeName === 'select') {\n\t\t\t\t\t\tselectValue = v;\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t} else if (nodeName === 'option' && selectValue == v) {\n\t\t\t\t\t\ts += ` selected`;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\ts += ` ${name}=\"${encodeEntities(v)}\"`;\n\t\t\t}\n\t\t}\n\t}\n\n\t// account for >1 multiline attribute\n\tif (pretty) {\n\t\tlet sub = s.replace(/\\n\\s*/, ' ');\n\t\tif (sub !== s && !~sub.indexOf('\\n')) s = sub;\n\t\telse if (pretty && ~s.indexOf('\\n')) s += '\\n';\n\t}\n\n\ts += '>';\n\n\tif (UNSAFE_NAME.test(nodeName))\n\t\tthrow new Error(`${nodeName} is not a valid HTML tag name in ${s}`);\n\n\tlet isVoid =\n\t\tVOID_ELEMENTS.test(nodeName) ||\n\t\t(opts.voidElements && opts.voidElements.test(nodeName));\n\tlet pieces = [];\n\n\tlet children;\n\tif (html) {\n\t\t// if multiline, indent.\n\t\tif (pretty && isLargeString(html)) {\n\t\t\thtml = '\\n' + indentChar + indent(html, indentChar);\n\t\t}\n\t\ts += html;\n\t} else if (\n\t\tpropChildren != null &&\n\t\tgetChildren((children = []), propChildren).length\n\t) {\n\t\tlet hasLarge = pretty && ~s.indexOf('\\n');\n\t\tlet lastWasText = false;\n\n\t\tfor (let i = 0; i < children.length; i++) {\n\t\t\tlet child = children[i];\n\n\t\t\tif (child != null && child !== false) {\n\t\t\t\tlet childSvgMode =\n\t\t\t\t\t\tnodeName === 'svg'\n\t\t\t\t\t\t\t? true\n\t\t\t\t\t\t\t: nodeName === 'foreignObject'\n\t\t\t\t\t\t\t? false\n\t\t\t\t\t\t\t: isSvgMode,\n\t\t\t\t\tret = _renderToString(\n\t\t\t\t\t\tchild,\n\t\t\t\t\t\tcontext,\n\t\t\t\t\t\topts,\n\t\t\t\t\t\ttrue,\n\t\t\t\t\t\tchildSvgMode,\n\t\t\t\t\t\tselectValue\n\t\t\t\t\t);\n\n\t\t\t\tif (pretty && !hasLarge && isLargeString(ret)) hasLarge = true;\n\n\t\t\t\t// Skip if we received an empty string\n\t\t\t\tif (ret) {\n\t\t\t\t\tif (pretty) {\n\t\t\t\t\t\tlet isText = ret.length > 0 && ret[0] != '<';\n\n\t\t\t\t\t\t// We merge adjacent text nodes, otherwise each piece would be printed\n\t\t\t\t\t\t// on a new line.\n\t\t\t\t\t\tif (lastWasText && isText) {\n\t\t\t\t\t\t\tpieces[pieces.length - 1] += ret;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tpieces.push(ret);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tlastWasText = isText;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tpieces.push(ret);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (pretty && hasLarge) {\n\t\t\tfor (let i = pieces.length; i--; ) {\n\t\t\t\tpieces[i] = '\\n' + indentChar + indent(pieces[i], indentChar);\n\t\t\t}\n\t\t}\n\t}\n\n\tif (pieces.length || html) {\n\t\ts += pieces.join('');\n\t} else if (opts && opts.xml) {\n\t\treturn s.substring(0, s.length - 1) + ' />';\n\t}\n\n\tif (isVoid && !children && !html) {\n\t\ts = s.replace(/>$/, ' />');\n\t} else {\n\t\tif (pretty && ~s.indexOf('\\n')) s += '\\n';\n\t\ts += `</${nodeName}>`;\n\t}\n\n\treturn s;\n}\n\nfunction getComponentName(component) {\n\treturn (\n\t\tcomponent.displayName ||\n\t\t(component !== Function && component.name) ||\n\t\tgetFallbackComponentName(component)\n\t);\n}\n\nfunction getFallbackComponentName(component) {\n\tlet str = Function.prototype.toString.call(component),\n\t\tname = (str.match(/^\\s*function\\s+([^( ]+)/) || '')[1];\n\tif (!name) {\n\t\t// search for an existing indexed name for the given component:\n\t\tlet index = -1;\n\t\tfor (let i = UNNAMED.length; i--; ) {\n\t\t\tif (UNNAMED[i] === component) {\n\t\t\t\tindex = i;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t// not found, create a new indexed name:\n\t\tif (index < 0) {\n\t\t\tindex = UNNAMED.push(component) - 1;\n\t\t}\n\t\tname = `UnnamedComponent${index}`;\n\t}\n\treturn name;\n}\nrenderToString.shallowRender = shallowRender;\n\nexport default renderToString;\n\nexport {\n\trenderToString as render,\n\trenderToString as renderToStaticMarkup,\n\trenderToString,\n\tshallowRender\n};\n"],"names":["IS_NON_DIMENSIONAL","ENCODED_ENTITIES","encodeEntities","input","s","String","test","replace","indent","char","isLargeString","length","ignoreLines","indexOf","JS_TO_CSS","styleObjToCss","str","prop","val","toLowerCase","undefined","assign","obj","props","i","getChildren","accumulator","children","Array","isArray","reduce","push","SHALLOW","shallow","UNNAMED","VOID_ELEMENTS","UNSAFE_NAME","noop","renderToString","render","shallowRender","vnode","context","EMPTY_ARR","opts","previousSkipEffects","options","__s","res","_renderToString","__c","inner","isSvgMode","selectValue","pretty","indentChar","rendered","component","nodeName","type","isComponent","renderRootComponent","Fragment","shallowHighOrder","c","__v","setState","forceUpdate","__h","__b","__r","prototype","cxType","contextType","provider","cctx","value","__","_dirty","__d","state","_nextState","getDerivedStateFromProps","componentWillMount","call","getChildContext","diffed","displayName","Function","name","toString","match","index","getFallbackComponentName","propChildren","html","attrs","Object","keys","sortAttributes","sort","v","allAttributes","hooked","attributeHook","__html","xml","sub","Error","isVoid","voidElements","pieces","hasLarge","lastWasText","child","ret","isText","join","substring"],"mappings":"wRACaA,EAAqB,kEAE5BC,EAAmB,kBAETC,EAAeC,GAC9B,IAAMC,EAAIC,OAAOF,GACjB,OAAKF,EAAiBK,KAAKF,GAGpBA,EACLG,QAAQ,KAAM,SACdA,QAAQ,KAAM,QACdA,QAAQ,KAAM,QACdA,QAAQ,KAAM,UANRH,MASEI,EAAS,SAACJ,EAAGK,UACvBJ,OAAOD,GAAGG,QAAQ,SAAU,MAAQE,GAAQ,QAElCC,EAAgB,SAACN,EAAGO,EAAQC,UACtCP,OAAOD,GAAGO,QAAUA,GAAU,MAC5BC,IAA4C,IAA7BP,OAAOD,GAAGS,QAAQ,QACP,IAA5BR,OAAOD,GAAGS,QAAQ,MAEbC,EAAY,YAGFC,EAAcX,GAC7B,IAAIY,EAAM,GACV,IAAK,IAAIC,KAAQb,EAAG,CACnB,IAAIc,EAAMd,EAAEa,GACD,MAAPC,GAAuB,KAARA,IACdF,IAAKA,GAAO,KAEhBA,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AAES,QAAQ,QAAOT,GAAK,MACrCA,QAAUsD,OAHVtD,EAAIA,EAAEG,QAAQ,KAAM,OAMdH,EA+BRkC,EAAeE,cAAgBA"}
1
+ {"version":3,"file":"index.js","sources":["../src/util.js","../src/index.js"],"sourcesContent":["// DOM properties that should NOT have \"px\" added when numeric\nexport const IS_NON_DIMENSIONAL = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|^--/i;\n\nconst ENCODED_ENTITIES = /[&<>\"]/;\n\nexport function encodeEntities(input) {\n\tconst s = String(input);\n\tif (!ENCODED_ENTITIES.test(s)) {\n\t\treturn s;\n\t}\n\treturn s\n\t\t.replace(/&/g, '&amp;')\n\t\t.replace(/</g, '&lt;')\n\t\t.replace(/>/g, '&gt;')\n\t\t.replace(/\"/g, '&quot;');\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\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\tif (str) str += ' ';\n\t\t\t// str += jsToCss(prop);\n\t\t\tstr +=\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(/([A-Z])/g, '-$1').toLowerCase());\n\t\t\tstr += ': ';\n\t\t\tstr += val;\n\t\t\tif (typeof val === 'number' && IS_NON_DIMENSIONAL.test(prop) === false) {\n\t\t\t\tstr += 'px';\n\t\t\t}\n\t\t\tstr += ';';\n\t\t}\n\t}\n\treturn str || undefined;\n}\n\n/**\n * Copy all properties from `props` onto `obj`.\n * @param {object} obj Object onto which properties should be copied.\n * @param {object} props Object from which to copy properties.\n * @returns {object}\n * @private\n */\nexport function assign(obj, props) {\n\tfor (let i in props) obj[i] = props[i];\n\treturn obj;\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","import {\n\tencodeEntities,\n\tindent,\n\tisLargeString,\n\tstyleObjToCss,\n\tassign,\n\tgetChildren\n} from './util';\nimport { options, Fragment } from 'preact';\n\n/** @typedef {import('preact').VNode} VNode */\n\nconst SHALLOW = { shallow: true };\n\n// components without names, kept as a hash for later comparison to return consistent UnnamedComponentXX names.\nconst UNNAMED = [];\n\nconst VOID_ELEMENTS = /^(area|base|br|col|embed|hr|img|input|link|meta|param|source|track|wbr)$/;\n\nconst UNSAFE_NAME = /[\\s\\n\\\\/='\"\\0<>]/;\n\nfunction markAsDirty() {\n\tthis.__d = true;\n}\n\n/** Render Preact JSX + Components to an HTML string.\n *\t@name render\n *\t@function\n *\t@param {VNode} vnode\tJSX VNode to render.\n *\t@param {Object} [context={}]\tOptionally pass an initial context object through the render path.\n *\t@param {Object} [options={}]\tRendering options\n *\t@param {Boolean} [options.shallow=false]\tIf `true`, renders nested Components as HTML elements (`<Foo a=\"b\" />`).\n *\t@param {Boolean} [options.xml=false]\t\tIf `true`, uses self-closing tags for elements without children.\n *\t@param {Boolean} [options.pretty=false]\t\tIf `true`, adds whitespace for readability\n *\t@param {RegExp|undefined} [options.voidElements] RegeEx that matches elements that are considered void (self-closing)\n */\nrenderToString.render = renderToString;\n\n/** Only render elements, leaving Components inline as `<ComponentName ... />`.\n *\tThis method is just a convenience alias for `render(vnode, context, { shallow:true })`\n *\t@name shallow\n *\t@function\n *\t@param {VNode} vnode\tJSX VNode to render.\n *\t@param {Object} [context={}]\tOptionally pass an initial context object through the render path.\n */\nlet shallowRender = (vnode, context) => renderToString(vnode, context, SHALLOW);\n\nconst EMPTY_ARR = [];\nfunction renderToString(vnode, context, opts) {\n\tcontext = context || {};\n\topts = opts || {};\n\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.__s;\n\toptions.__s = true;\n\n\tconst res = _renderToString(vnode, context, opts);\n\n\t// options._commit, we don't schedule any effects in this library right now,\n\t// so we can pass an empty queue to this hook.\n\tif (options.__c) options.__c(vnode, EMPTY_ARR);\n\tEMPTY_ARR.length = 0;\n\toptions.__s = previousSkipEffects;\n\treturn res;\n}\n\n/** The default export is an alias of `render()`. */\nfunction _renderToString(vnode, context, opts, inner, isSvgMode, selectValue) {\n\tif (vnode == null || typeof vnode === 'boolean') {\n\t\treturn '';\n\t}\n\n\t// #text nodes\n\tif (typeof vnode !== 'object') {\n\t\treturn encodeEntities(vnode);\n\t}\n\n\tlet pretty = opts.pretty,\n\t\tindentChar = pretty && typeof pretty === 'string' ? pretty : '\\t';\n\n\tif (Array.isArray(vnode)) {\n\t\tlet rendered = '';\n\t\tfor (let i = 0; i < vnode.length; i++) {\n\t\t\tif (pretty && i > 0) rendered += '\\n';\n\t\t\trendered += _renderToString(\n\t\t\t\tvnode[i],\n\t\t\t\tcontext,\n\t\t\t\topts,\n\t\t\t\tinner,\n\t\t\t\tisSvgMode,\n\t\t\t\tselectValue\n\t\t\t);\n\t\t}\n\t\treturn rendered;\n\t}\n\n\tlet nodeName = vnode.type,\n\t\tprops = vnode.props,\n\t\tisComponent = false;\n\n\t// components\n\tif (typeof nodeName === 'function') {\n\t\tisComponent = true;\n\t\tif (opts.shallow && (inner || opts.renderRootComponent === false)) {\n\t\t\tnodeName = getComponentName(nodeName);\n\t\t} else if (nodeName === Fragment) {\n\t\t\tconst children = [];\n\t\t\tgetChildren(children, vnode.props.children);\n\t\t\treturn _renderToString(\n\t\t\t\tchildren,\n\t\t\t\tcontext,\n\t\t\t\topts,\n\t\t\t\topts.shallowHighOrder !== false,\n\t\t\t\tisSvgMode,\n\t\t\t\tselectValue\n\t\t\t);\n\t\t} else {\n\t\t\tlet rendered;\n\n\t\t\tlet c = (vnode.__c = {\n\t\t\t\t__v: vnode,\n\t\t\t\tcontext,\n\t\t\t\tprops: vnode.props,\n\t\t\t\t// silently drop state updates\n\t\t\t\tsetState: markAsDirty,\n\t\t\t\tforceUpdate: markAsDirty,\n\t\t\t\t__d: true,\n\t\t\t\t// hooks\n\t\t\t\t__h: []\n\t\t\t});\n\n\t\t\t// options._diff\n\t\t\tif (options.__b) options.__b(vnode);\n\n\t\t\t// options._render\n\t\t\tlet renderHook = options.__r;\n\n\t\t\tif (\n\t\t\t\t!nodeName.prototype ||\n\t\t\t\ttypeof nodeName.prototype.render !== 'function'\n\t\t\t) {\n\t\t\t\t// Necessary for createContext api. Setting this property will pass\n\t\t\t\t// the context value as `this.context` just for this component.\n\t\t\t\tlet cxType = nodeName.contextType;\n\t\t\t\tlet provider = cxType && context[cxType.__c];\n\t\t\t\tlet cctx =\n\t\t\t\t\tcxType != null\n\t\t\t\t\t\t? provider\n\t\t\t\t\t\t\t? provider.props.value\n\t\t\t\t\t\t\t: cxType.__\n\t\t\t\t\t\t: context;\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 (c.__d && count++ < 25) {\n\t\t\t\t\tc.__d = false;\n\n\t\t\t\t\tif (renderHook) renderHook(vnode);\n\n\t\t\t\t\t// stateless functional components\n\t\t\t\t\trendered = nodeName.call(vnode.__c, props, cctx);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// class-based components\n\t\t\t\tlet cxType = nodeName.contextType;\n\t\t\t\tlet provider = cxType && context[cxType.__c];\n\t\t\t\tlet cctx =\n\t\t\t\t\tcxType != null\n\t\t\t\t\t\t? provider\n\t\t\t\t\t\t\t? provider.props.value\n\t\t\t\t\t\t\t: cxType.__\n\t\t\t\t\t\t: context;\n\n\t\t\t\t// c = new nodeName(props, context);\n\t\t\t\tc = vnode.__c = new nodeName(props, cctx);\n\t\t\t\tc.__v = vnode;\n\t\t\t\t// turn off stateful re-rendering:\n\t\t\t\tc._dirty = c.__d = true;\n\t\t\t\tc.props = props;\n\t\t\t\tif (c.state == null) c.state = {};\n\n\t\t\t\tif (c._nextState == null && c.__s == null) {\n\t\t\t\t\tc._nextState = c.__s = c.state;\n\t\t\t\t}\n\n\t\t\t\tc.context = cctx;\n\t\t\t\tif (nodeName.getDerivedStateFromProps)\n\t\t\t\t\tc.state = assign(\n\t\t\t\t\t\tassign({}, c.state),\n\t\t\t\t\t\tnodeName.getDerivedStateFromProps(c.props, c.state)\n\t\t\t\t\t);\n\t\t\t\telse if (c.componentWillMount) {\n\t\t\t\t\tc.componentWillMount();\n\n\t\t\t\t\t// If the user called setState in cWM we need to flush pending,\n\t\t\t\t\t// state updates. This is the same behaviour in React.\n\t\t\t\t\tc.state =\n\t\t\t\t\t\tc._nextState !== c.state\n\t\t\t\t\t\t\t? c._nextState\n\t\t\t\t\t\t\t: c.__s !== c.state\n\t\t\t\t\t\t\t? c.__s\n\t\t\t\t\t\t\t: c.state;\n\t\t\t\t}\n\n\t\t\t\tif (renderHook) renderHook(vnode);\n\n\t\t\t\trendered = c.render(c.props, c.state, c.context);\n\t\t\t}\n\n\t\t\tif (c.getChildContext) {\n\t\t\t\tcontext = assign(assign({}, context), c.getChildContext());\n\t\t\t}\n\n\t\t\tif (options.diffed) options.diffed(vnode);\n\t\t\treturn _renderToString(\n\t\t\t\trendered,\n\t\t\t\tcontext,\n\t\t\t\topts,\n\t\t\t\topts.shallowHighOrder !== false,\n\t\t\t\tisSvgMode,\n\t\t\t\tselectValue\n\t\t\t);\n\t\t}\n\t}\n\n\t// render JSX to HTML\n\tlet s = '<' + nodeName,\n\t\tpropChildren,\n\t\thtml;\n\n\tif (props) {\n\t\tlet attrs = Object.keys(props);\n\n\t\t// allow sorting lexicographically for more determinism (useful for tests, such as via preact-jsx-chai)\n\t\tif (opts && opts.sortAttributes === true) attrs.sort();\n\n\t\tfor (let i = 0; i < attrs.length; i++) {\n\t\t\tlet name = attrs[i],\n\t\t\t\tv = props[name];\n\t\t\tif (name === 'children') {\n\t\t\t\tpropChildren = v;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (UNSAFE_NAME.test(name)) continue;\n\n\t\t\tif (\n\t\t\t\t!(opts && opts.allAttributes) &&\n\t\t\t\t(name === 'key' ||\n\t\t\t\t\tname === 'ref' ||\n\t\t\t\t\tname === '__self' ||\n\t\t\t\t\tname === '__source')\n\t\t\t)\n\t\t\t\tcontinue;\n\n\t\t\tif (name === 'defaultValue') {\n\t\t\t\tname = 'value';\n\t\t\t} else if (name === 'className') {\n\t\t\t\tif (typeof props.class !== 'undefined') continue;\n\t\t\t\tname = 'class';\n\t\t\t} else if (isSvgMode && name.match(/^xlink:?./)) {\n\t\t\t\tname = name.toLowerCase().replace(/^xlink:?/, 'xlink:');\n\t\t\t}\n\n\t\t\tif (name === 'htmlFor') {\n\t\t\t\tif (props.for) continue;\n\t\t\t\tname = 'for';\n\t\t\t}\n\n\t\t\tif (name === 'style' && v && typeof v === 'object') {\n\t\t\t\tv = styleObjToCss(v);\n\t\t\t}\n\n\t\t\t// always use string values instead of booleans for aria attributes\n\t\t\t// also see https://github.com/preactjs/preact/pull/2347/files\n\t\t\tif (name[0] === 'a' && name['1'] === 'r' && typeof v === 'boolean') {\n\t\t\t\tv = String(v);\n\t\t\t}\n\n\t\t\tlet hooked =\n\t\t\t\topts.attributeHook &&\n\t\t\t\topts.attributeHook(name, v, context, opts, isComponent);\n\t\t\tif (hooked || hooked === '') {\n\t\t\t\ts += hooked;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (name === 'dangerouslySetInnerHTML') {\n\t\t\t\thtml = v && v.__html;\n\t\t\t} else if (nodeName === 'textarea' && name === 'value') {\n\t\t\t\t// <textarea value=\"a&b\"> --> <textarea>a&amp;b</textarea>\n\t\t\t\tpropChildren = v;\n\t\t\t} else if ((v || v === 0 || v === '') && typeof v !== 'function') {\n\t\t\t\tif (v === true || v === '') {\n\t\t\t\t\tv = name;\n\t\t\t\t\t// in non-xml mode, allow boolean attributes\n\t\t\t\t\tif (!opts || !opts.xml) {\n\t\t\t\t\t\ts += ' ' + name;\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (name === 'value') {\n\t\t\t\t\tif (nodeName === 'select') {\n\t\t\t\t\t\tselectValue = v;\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t} else if (\n\t\t\t\t\t\t// If we're looking at an <option> and it's the currently selected one\n\t\t\t\t\t\tnodeName === 'option' &&\n\t\t\t\t\t\tselectValue == v &&\n\t\t\t\t\t\t// and the <option> doesn't already have a selected attribute on it\n\t\t\t\t\t\ttypeof props.selected === 'undefined'\n\t\t\t\t\t) {\n\t\t\t\t\t\ts += ` selected`;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\ts += ` ${name}=\"${encodeEntities(v)}\"`;\n\t\t\t}\n\t\t}\n\t}\n\n\t// account for >1 multiline attribute\n\tif (pretty) {\n\t\tlet sub = s.replace(/\\n\\s*/, ' ');\n\t\tif (sub !== s && !~sub.indexOf('\\n')) s = sub;\n\t\telse if (pretty && ~s.indexOf('\\n')) s += '\\n';\n\t}\n\n\ts += '>';\n\n\tif (UNSAFE_NAME.test(nodeName))\n\t\tthrow new Error(`${nodeName} is not a valid HTML tag name in ${s}`);\n\n\tlet isVoid =\n\t\tVOID_ELEMENTS.test(nodeName) ||\n\t\t(opts.voidElements && opts.voidElements.test(nodeName));\n\tlet pieces = [];\n\n\tlet children;\n\tif (html) {\n\t\t// if multiline, indent.\n\t\tif (pretty && isLargeString(html)) {\n\t\t\thtml = '\\n' + indentChar + indent(html, indentChar);\n\t\t}\n\t\ts += html;\n\t} else if (\n\t\tpropChildren != null &&\n\t\tgetChildren((children = []), propChildren).length\n\t) {\n\t\tlet hasLarge = pretty && ~s.indexOf('\\n');\n\t\tlet lastWasText = false;\n\n\t\tfor (let i = 0; i < children.length; i++) {\n\t\t\tlet child = children[i];\n\n\t\t\tif (child != null && child !== false) {\n\t\t\t\tlet childSvgMode =\n\t\t\t\t\t\tnodeName === 'svg'\n\t\t\t\t\t\t\t? true\n\t\t\t\t\t\t\t: nodeName === 'foreignObject'\n\t\t\t\t\t\t\t? false\n\t\t\t\t\t\t\t: isSvgMode,\n\t\t\t\t\tret = _renderToString(\n\t\t\t\t\t\tchild,\n\t\t\t\t\t\tcontext,\n\t\t\t\t\t\topts,\n\t\t\t\t\t\ttrue,\n\t\t\t\t\t\tchildSvgMode,\n\t\t\t\t\t\tselectValue\n\t\t\t\t\t);\n\n\t\t\t\tif (pretty && !hasLarge && isLargeString(ret)) hasLarge = true;\n\n\t\t\t\t// Skip if we received an empty string\n\t\t\t\tif (ret) {\n\t\t\t\t\tif (pretty) {\n\t\t\t\t\t\tlet isText = ret.length > 0 && ret[0] != '<';\n\n\t\t\t\t\t\t// We merge adjacent text nodes, otherwise each piece would be printed\n\t\t\t\t\t\t// on a new line.\n\t\t\t\t\t\tif (lastWasText && isText) {\n\t\t\t\t\t\t\tpieces[pieces.length - 1] += ret;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tpieces.push(ret);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tlastWasText = isText;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tpieces.push(ret);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (pretty && hasLarge) {\n\t\t\tfor (let i = pieces.length; i--; ) {\n\t\t\t\tpieces[i] = '\\n' + indentChar + indent(pieces[i], indentChar);\n\t\t\t}\n\t\t}\n\t}\n\n\tif (pieces.length || html) {\n\t\ts += pieces.join('');\n\t} else if (opts && opts.xml) {\n\t\treturn s.substring(0, s.length - 1) + ' />';\n\t}\n\n\tif (isVoid && !children && !html) {\n\t\ts = s.replace(/>$/, ' />');\n\t} else {\n\t\tif (pretty && ~s.indexOf('\\n')) s += '\\n';\n\t\ts += `</${nodeName}>`;\n\t}\n\n\treturn s;\n}\n\nfunction getComponentName(component) {\n\treturn (\n\t\tcomponent.displayName ||\n\t\t(component !== Function && component.name) ||\n\t\tgetFallbackComponentName(component)\n\t);\n}\n\nfunction getFallbackComponentName(component) {\n\tlet str = Function.prototype.toString.call(component),\n\t\tname = (str.match(/^\\s*function\\s+([^( ]+)/) || '')[1];\n\tif (!name) {\n\t\t// search for an existing indexed name for the given component:\n\t\tlet index = -1;\n\t\tfor (let i = UNNAMED.length; i--; ) {\n\t\t\tif (UNNAMED[i] === component) {\n\t\t\t\tindex = i;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t// not found, create a new indexed name:\n\t\tif (index < 0) {\n\t\t\tindex = UNNAMED.push(component) - 1;\n\t\t}\n\t\tname = `UnnamedComponent${index}`;\n\t}\n\treturn name;\n}\nrenderToString.shallowRender = shallowRender;\n\nexport default renderToString;\n\nexport {\n\trenderToString as render,\n\trenderToString as renderToStaticMarkup,\n\trenderToString,\n\tshallowRender\n};\n"],"names":["IS_NON_DIMENSIONAL","ENCODED_ENTITIES","encodeEntities","input","s","String","test","replace","indent","char","isLargeString","length","ignoreLines","indexOf","JS_TO_CSS","styleObjToCss","str","prop","val","toLowerCase","undefined","assign","obj","props","i","getChildren","accumulator","children","Array","isArray","reduce","push","SHALLOW","shallow","UNNAMED","VOID_ELEMENTS","UNSAFE_NAME","markAsDirty","this","__d","renderToString","render","shallowRender","vnode","context","EMPTY_ARR","opts","previousSkipEffects","options","__s","res","_renderToString","__c","inner","isSvgMode","selectValue","pretty","indentChar","rendered","component","nodeName","type","isComponent","renderRootComponent","Fragment","shallowHighOrder","c","__v","setState","forceUpdate","__h","__b","renderHook","__r","prototype","cxType","contextType","provider","cctx","value","__","_dirty","state","_nextState","getDerivedStateFromProps","componentWillMount","count","call","getChildContext","diffed","displayName","Function","name","toString","match","index","getFallbackComponentName","propChildren","html","attrs","Object","keys","sortAttributes","sort","v","allAttributes","hooked","attributeHook","__html","xml","selected","sub","Error","isVoid","voidElements","pieces","hasLarge","lastWasText","child","ret","isText","join","substring"],"mappings":"wRACaA,EAAqB,kEAE5BC,EAAmB,kBAETC,EAAeC,GAC9B,IAAMC,EAAIC,OAAOF,GACjB,OAAKF,EAAiBK,KAAKF,GAGpBA,EACLG,QAAQ,KAAM,SACdA,QAAQ,KAAM,QACdA,QAAQ,KAAM,QACdA,QAAQ,KAAM,UANRH,MASEI,EAAS,SAACJ,EAAGK,UACvBJ,OAAOD,GAAGG,QAAQ,SAAU,MAAQE,GAAQ,QAElCC,EAAgB,SAACN,EAAGO,EAAQC,UACtCP,OAAOD,GAAGO,QAAUA,GAAU,MAC5BC,IAA4C,IAA7BP,OAAOD,GAAGS,QAAQ,QACP,IAA5BR,OAAOD,GAAGS,QAAQ,MAEbC,EAAY,YAGFC,EAAcX,GAC7B,IAAIY,EAAM,GACV,IAAK,IAAIC,KAAQb,EAAG,CACnB,IAAIc,EAAMd,EAAEa,GACD,MAAPC,GAAuB,KAARA,IACdF,IAAKA,GAAO,KAEhBA,GACY,KAAXC,EAAK,GACFA,EACAH,EAAUG,KACTH,EAAUG,GAAQA,EAAKV,QAAQ,WAAY,OAAOY,eACvDH,GAAO,KACPA,GAAOE,EACY,iBAARA,IAAsD,IAAlClB,EAAmBM,KAAKW,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AWtF,GAAauE,GAGvB1C,IAAWpD,EAAES,QAAQ,QAAOT,GAAK,MACrCA,QAAUwD,OAHVxD,EAAIA,EAAEG,QAAQ,KAAM,OAMdH,EA+BRoC,EAAeE,cAAgBA"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../src/util.js","../src/index.js"],"sourcesContent":["// DOM properties that should NOT have \"px\" added when numeric\nexport const IS_NON_DIMENSIONAL = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|^--/i;\n\nconst ENCODED_ENTITIES = /[&<>\"]/;\n\nexport function encodeEntities(input) {\n\tconst s = String(input);\n\tif (!ENCODED_ENTITIES.test(s)) {\n\t\treturn s;\n\t}\n\treturn s\n\t\t.replace(/&/g, '&amp;')\n\t\t.replace(/</g, '&lt;')\n\t\t.replace(/>/g, '&gt;')\n\t\t.replace(/\"/g, '&quot;');\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\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\tif (str) str += ' ';\n\t\t\t// str += jsToCss(prop);\n\t\t\tstr +=\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(/([A-Z])/g, '-$1').toLowerCase());\n\t\t\tstr += ': ';\n\t\t\tstr += val;\n\t\t\tif (typeof val === 'number' && IS_NON_DIMENSIONAL.test(prop) === false) {\n\t\t\t\tstr += 'px';\n\t\t\t}\n\t\t\tstr += ';';\n\t\t}\n\t}\n\treturn str || undefined;\n}\n\n/**\n * Copy all properties from `props` onto `obj`.\n * @param {object} obj Object onto which properties should be copied.\n * @param {object} props Object from which to copy properties.\n * @returns {object}\n * @private\n */\nexport function assign(obj, props) {\n\tfor (let i in props) obj[i] = props[i];\n\treturn obj;\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","import {\n\tencodeEntities,\n\tindent,\n\tisLargeString,\n\tstyleObjToCss,\n\tassign,\n\tgetChildren\n} from './util';\nimport { options, Fragment } from 'preact';\n\n/** @typedef {import('preact').VNode} VNode */\n\nconst SHALLOW = { shallow: true };\n\n// components without names, kept as a hash for later comparison to return consistent UnnamedComponentXX names.\nconst UNNAMED = [];\n\nconst VOID_ELEMENTS =\n\t/^(area|base|br|col|embed|hr|img|input|link|meta|param|source|track|wbr)$/;\n\nconst UNSAFE_NAME = /[\\s\\n\\\\/='\"\\0<>]/;\n\nconst noop = () => {};\n\n/** Render Preact JSX + Components to an HTML string.\n *\t@name render\n *\t@function\n *\t@param {VNode} vnode\tJSX VNode to render.\n *\t@param {Object} [context={}]\tOptionally pass an initial context object through the render path.\n *\t@param {Object} [options={}]\tRendering options\n *\t@param {Boolean} [options.shallow=false]\tIf `true`, renders nested Components as HTML elements (`<Foo a=\"b\" />`).\n *\t@param {Boolean} [options.xml=false]\t\tIf `true`, uses self-closing tags for elements without children.\n *\t@param {Boolean} [options.pretty=false]\t\tIf `true`, adds whitespace for readability\n *\t@param {RegExp|undefined} [options.voidElements] RegeEx that matches elements that are considered void (self-closing)\n */\nrenderToString.render = renderToString;\n\n/** Only render elements, leaving Components inline as `<ComponentName ... />`.\n *\tThis method is just a convenience alias for `render(vnode, context, { shallow:true })`\n *\t@name shallow\n *\t@function\n *\t@param {VNode} vnode\tJSX VNode to render.\n *\t@param {Object} [context={}]\tOptionally pass an initial context object through the render path.\n */\nlet shallowRender = (vnode, context) => renderToString(vnode, context, SHALLOW);\n\nconst EMPTY_ARR = [];\nfunction renderToString(vnode, context, opts) {\n\tcontext = context || {};\n\topts = opts || {};\n\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.__s;\n\toptions.__s = true;\n\n\tconst res = _renderToString(vnode, context, opts);\n\n\t// options._commit, we don't schedule any effects in this library right now,\n\t// so we can pass an empty queue to this hook.\n\tif (options.__c) options.__c(vnode, EMPTY_ARR);\n\tEMPTY_ARR.length = 0;\n\toptions.__s = previousSkipEffects;\n\treturn res;\n}\n\n/** The default export is an alias of `render()`. */\nfunction _renderToString(vnode, context, opts, inner, isSvgMode, selectValue) {\n\tif (vnode == null || typeof vnode === 'boolean') {\n\t\treturn '';\n\t}\n\n\t// #text nodes\n\tif (typeof vnode !== 'object') {\n\t\treturn encodeEntities(vnode);\n\t}\n\n\tlet pretty = opts.pretty,\n\t\tindentChar = pretty && typeof pretty === 'string' ? pretty : '\\t';\n\n\tif (Array.isArray(vnode)) {\n\t\tlet rendered = '';\n\t\tfor (let i = 0; i < vnode.length; i++) {\n\t\t\tif (pretty && i > 0) rendered += '\\n';\n\t\t\trendered += _renderToString(\n\t\t\t\tvnode[i],\n\t\t\t\tcontext,\n\t\t\t\topts,\n\t\t\t\tinner,\n\t\t\t\tisSvgMode,\n\t\t\t\tselectValue\n\t\t\t);\n\t\t}\n\t\treturn rendered;\n\t}\n\n\tlet nodeName = vnode.type,\n\t\tprops = vnode.props,\n\t\tisComponent = false;\n\n\t// components\n\tif (typeof nodeName === 'function') {\n\t\tisComponent = true;\n\t\tif (opts.shallow && (inner || opts.renderRootComponent === false)) {\n\t\t\tnodeName = getComponentName(nodeName);\n\t\t} else if (nodeName === Fragment) {\n\t\t\tconst children = [];\n\t\t\tgetChildren(children, vnode.props.children);\n\t\t\treturn _renderToString(\n\t\t\t\tchildren,\n\t\t\t\tcontext,\n\t\t\t\topts,\n\t\t\t\topts.shallowHighOrder !== false,\n\t\t\t\tisSvgMode,\n\t\t\t\tselectValue\n\t\t\t);\n\t\t} else {\n\t\t\tlet rendered;\n\n\t\t\tlet c = (vnode.__c = {\n\t\t\t\t__v: vnode,\n\t\t\t\tcontext,\n\t\t\t\tprops: vnode.props,\n\t\t\t\t// silently drop state updates\n\t\t\t\tsetState: noop,\n\t\t\t\tforceUpdate: noop,\n\t\t\t\t// hooks\n\t\t\t\t__h: []\n\t\t\t});\n\n\t\t\t// options._diff\n\t\t\tif (options.__b) options.__b(vnode);\n\n\t\t\t// options._render\n\t\t\tif (options.__r) options.__r(vnode);\n\n\t\t\tif (\n\t\t\t\t!nodeName.prototype ||\n\t\t\t\ttypeof nodeName.prototype.render !== 'function'\n\t\t\t) {\n\t\t\t\t// Necessary for createContext api. Setting this property will pass\n\t\t\t\t// the context value as `this.context` just for this component.\n\t\t\t\tlet cxType = nodeName.contextType;\n\t\t\t\tlet provider = cxType && context[cxType.__c];\n\t\t\t\tlet cctx =\n\t\t\t\t\tcxType != null\n\t\t\t\t\t\t? provider\n\t\t\t\t\t\t\t? provider.props.value\n\t\t\t\t\t\t\t: cxType.__\n\t\t\t\t\t\t: context;\n\n\t\t\t\t// stateless functional components\n\t\t\t\trendered = nodeName.call(vnode.__c, props, cctx);\n\t\t\t} else {\n\t\t\t\t// class-based components\n\t\t\t\tlet cxType = nodeName.contextType;\n\t\t\t\tlet provider = cxType && context[cxType.__c];\n\t\t\t\tlet cctx =\n\t\t\t\t\tcxType != null\n\t\t\t\t\t\t? provider\n\t\t\t\t\t\t\t? provider.props.value\n\t\t\t\t\t\t\t: cxType.__\n\t\t\t\t\t\t: context;\n\n\t\t\t\t// c = new nodeName(props, context);\n\t\t\t\tc = vnode.__c = new nodeName(props, cctx);\n\t\t\t\tc.__v = vnode;\n\t\t\t\t// turn off stateful re-rendering:\n\t\t\t\tc._dirty = c.__d = true;\n\t\t\t\tc.props = props;\n\t\t\t\tif (c.state == null) c.state = {};\n\n\t\t\t\tif (c._nextState == null && c.__s == null) {\n\t\t\t\t\tc._nextState = c.__s = c.state;\n\t\t\t\t}\n\n\t\t\t\tc.context = cctx;\n\t\t\t\tif (nodeName.getDerivedStateFromProps)\n\t\t\t\t\tc.state = assign(\n\t\t\t\t\t\tassign({}, c.state),\n\t\t\t\t\t\tnodeName.getDerivedStateFromProps(c.props, c.state)\n\t\t\t\t\t);\n\t\t\t\telse if (c.componentWillMount) {\n\t\t\t\t\tc.componentWillMount();\n\n\t\t\t\t\t// If the user called setState in cWM we need to flush pending,\n\t\t\t\t\t// state updates. This is the same behaviour in React.\n\t\t\t\t\tc.state =\n\t\t\t\t\t\tc._nextState !== c.state\n\t\t\t\t\t\t\t? c._nextState\n\t\t\t\t\t\t\t: c.__s !== c.state\n\t\t\t\t\t\t\t? c.__s\n\t\t\t\t\t\t\t: c.state;\n\t\t\t\t}\n\n\t\t\t\trendered = c.render(c.props, c.state, c.context);\n\t\t\t}\n\n\t\t\tif (c.getChildContext) {\n\t\t\t\tcontext = assign(assign({}, context), c.getChildContext());\n\t\t\t}\n\n\t\t\tif (options.diffed) options.diffed(vnode);\n\t\t\treturn _renderToString(\n\t\t\t\trendered,\n\t\t\t\tcontext,\n\t\t\t\topts,\n\t\t\t\topts.shallowHighOrder !== false,\n\t\t\t\tisSvgMode,\n\t\t\t\tselectValue\n\t\t\t);\n\t\t}\n\t}\n\n\t// render JSX to HTML\n\tlet s = '<' + nodeName,\n\t\tpropChildren,\n\t\thtml;\n\n\tif (props) {\n\t\tlet attrs = Object.keys(props);\n\n\t\t// allow sorting lexicographically for more determinism (useful for tests, such as via preact-jsx-chai)\n\t\tif (opts && opts.sortAttributes === true) attrs.sort();\n\n\t\tfor (let i = 0; i < attrs.length; i++) {\n\t\t\tlet name = attrs[i],\n\t\t\t\tv = props[name];\n\t\t\tif (name === 'children') {\n\t\t\t\tpropChildren = v;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (UNSAFE_NAME.test(name)) continue;\n\n\t\t\tif (\n\t\t\t\t!(opts && opts.allAttributes) &&\n\t\t\t\t(name === 'key' ||\n\t\t\t\t\tname === 'ref' ||\n\t\t\t\t\tname === '__self' ||\n\t\t\t\t\tname === '__source')\n\t\t\t)\n\t\t\t\tcontinue;\n\n\t\t\tif (name === 'defaultValue') {\n\t\t\t\tname = 'value';\n\t\t\t} else if (name === 'className') {\n\t\t\t\tif (typeof props.class !== 'undefined') continue;\n\t\t\t\tname = 'class';\n\t\t\t} else if (isSvgMode && name.match(/^xlink:?./)) {\n\t\t\t\tname = name.toLowerCase().replace(/^xlink:?/, 'xlink:');\n\t\t\t}\n\n\t\t\tif (name === 'htmlFor') {\n\t\t\t\tif (props.for) continue;\n\t\t\t\tname = 'for';\n\t\t\t}\n\n\t\t\tif (name === 'style' && v && typeof v === 'object') {\n\t\t\t\tv = styleObjToCss(v);\n\t\t\t}\n\n\t\t\t// always use string values instead of booleans for aria attributes\n\t\t\t// also see https://github.com/preactjs/preact/pull/2347/files\n\t\t\tif (name[0] === 'a' && name['1'] === 'r' && typeof v === 'boolean') {\n\t\t\t\tv = String(v);\n\t\t\t}\n\n\t\t\tlet hooked =\n\t\t\t\topts.attributeHook &&\n\t\t\t\topts.attributeHook(name, v, context, opts, isComponent);\n\t\t\tif (hooked || hooked === '') {\n\t\t\t\ts += hooked;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (name === 'dangerouslySetInnerHTML') {\n\t\t\t\thtml = v && v.__html;\n\t\t\t} else if (nodeName === 'textarea' && name === 'value') {\n\t\t\t\t// <textarea value=\"a&b\"> --> <textarea>a&amp;b</textarea>\n\t\t\t\tpropChildren = v;\n\t\t\t} else if ((v || v === 0 || v === '') && typeof v !== 'function') {\n\t\t\t\tif (v === true || v === '') {\n\t\t\t\t\tv = name;\n\t\t\t\t\t// in non-xml mode, allow boolean attributes\n\t\t\t\t\tif (!opts || !opts.xml) {\n\t\t\t\t\t\ts += ' ' + name;\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (name === 'value') {\n\t\t\t\t\tif (nodeName === 'select') {\n\t\t\t\t\t\tselectValue = v;\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t} else if (nodeName === 'option' && selectValue == v) {\n\t\t\t\t\t\ts += ` selected`;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\ts += ` ${name}=\"${encodeEntities(v)}\"`;\n\t\t\t}\n\t\t}\n\t}\n\n\t// account for >1 multiline attribute\n\tif (pretty) {\n\t\tlet sub = s.replace(/\\n\\s*/, ' ');\n\t\tif (sub !== s && !~sub.indexOf('\\n')) s = sub;\n\t\telse if (pretty && ~s.indexOf('\\n')) s += '\\n';\n\t}\n\n\ts += '>';\n\n\tif (UNSAFE_NAME.test(nodeName))\n\t\tthrow new Error(`${nodeName} is not a valid HTML tag name in ${s}`);\n\n\tlet isVoid =\n\t\tVOID_ELEMENTS.test(nodeName) ||\n\t\t(opts.voidElements && opts.voidElements.test(nodeName));\n\tlet pieces = [];\n\n\tlet children;\n\tif (html) {\n\t\t// if multiline, indent.\n\t\tif (pretty && isLargeString(html)) {\n\t\t\thtml = '\\n' + indentChar + indent(html, indentChar);\n\t\t}\n\t\ts += html;\n\t} else if (\n\t\tpropChildren != null &&\n\t\tgetChildren((children = []), propChildren).length\n\t) {\n\t\tlet hasLarge = pretty && ~s.indexOf('\\n');\n\t\tlet lastWasText = false;\n\n\t\tfor (let i = 0; i < children.length; i++) {\n\t\t\tlet child = children[i];\n\n\t\t\tif (child != null && child !== false) {\n\t\t\t\tlet childSvgMode =\n\t\t\t\t\t\tnodeName === 'svg'\n\t\t\t\t\t\t\t? true\n\t\t\t\t\t\t\t: nodeName === 'foreignObject'\n\t\t\t\t\t\t\t? false\n\t\t\t\t\t\t\t: isSvgMode,\n\t\t\t\t\tret = _renderToString(\n\t\t\t\t\t\tchild,\n\t\t\t\t\t\tcontext,\n\t\t\t\t\t\topts,\n\t\t\t\t\t\ttrue,\n\t\t\t\t\t\tchildSvgMode,\n\t\t\t\t\t\tselectValue\n\t\t\t\t\t);\n\n\t\t\t\tif (pretty && !hasLarge && isLargeString(ret)) hasLarge = true;\n\n\t\t\t\t// Skip if we received an empty string\n\t\t\t\tif (ret) {\n\t\t\t\t\tif (pretty) {\n\t\t\t\t\t\tlet isText = ret.length > 0 && ret[0] != '<';\n\n\t\t\t\t\t\t// We merge adjacent text nodes, otherwise each piece would be printed\n\t\t\t\t\t\t// on a new line.\n\t\t\t\t\t\tif (lastWasText && isText) {\n\t\t\t\t\t\t\tpieces[pieces.length - 1] += ret;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tpieces.push(ret);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tlastWasText = isText;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tpieces.push(ret);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (pretty && hasLarge) {\n\t\t\tfor (let i = pieces.length; i--; ) {\n\t\t\t\tpieces[i] = '\\n' + indentChar + indent(pieces[i], indentChar);\n\t\t\t}\n\t\t}\n\t}\n\n\tif (pieces.length || html) {\n\t\ts += pieces.join('');\n\t} else if (opts && opts.xml) {\n\t\treturn s.substring(0, s.length - 1) + ' />';\n\t}\n\n\tif (isVoid && !children && !html) {\n\t\ts = s.replace(/>$/, ' />');\n\t} else {\n\t\tif (pretty && ~s.indexOf('\\n')) s += '\\n';\n\t\ts += `</${nodeName}>`;\n\t}\n\n\treturn s;\n}\n\nfunction getComponentName(component) {\n\treturn (\n\t\tcomponent.displayName ||\n\t\t(component !== Function && component.name) ||\n\t\tgetFallbackComponentName(component)\n\t);\n}\n\nfunction getFallbackComponentName(component) {\n\tlet str = Function.prototype.toString.call(component),\n\t\tname = (str.match(/^\\s*function\\s+([^( ]+)/) || '')[1];\n\tif (!name) {\n\t\t// search for an existing indexed name for the given component:\n\t\tlet index = -1;\n\t\tfor (let i = UNNAMED.length; i--; ) {\n\t\t\tif (UNNAMED[i] === component) {\n\t\t\t\tindex = i;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t// not found, create a new indexed name:\n\t\tif (index < 0) {\n\t\t\tindex = UNNAMED.push(component) - 1;\n\t\t}\n\t\tname = `UnnamedComponent${index}`;\n\t}\n\treturn name;\n}\nrenderToString.shallowRender = shallowRender;\n\nexport default renderToString;\n\nexport {\n\trenderToString as render,\n\trenderToString as renderToStaticMarkup,\n\trenderToString,\n\tshallowRender\n};\n"],"names":["IS_NON_DIMENSIONAL","ENCODED_ENTITIES","encodeEntities","input","s","String","test","replace","indent","char","isLargeString","length","ignoreLines","indexOf","JS_TO_CSS","styleObjToCss","str","prop","val","toLowerCase","undefined","assign","obj","props","i","getChildren","accumulator","children","Array","isArray","reduce","push","SHALLOW","shallow","UNNAMED","VOID_ELEMENTS","UNSAFE_NAME","noop","renderToString","render","shallowRender","vnode","context","EMPTY_ARR","opts","previousSkipEffects","options","__s","res","_renderToString","__c","inner","isSvgMode","selectValue","pretty","indentChar","rendered","component","nodeName","type","isComponent","renderRootComponent","Fragment","shallowHighOrder","c","__v","setState","forceUpdate","__h","__b","__r","prototype","cxType","contextType","provider","cctx","value","__","_dirty","__d","state","_nextState","getDerivedStateFromProps","componentWillMount","call","getChildContext","diffed","displayName","Function","name","toString","match","index","getFallbackComponentName","propChildren","html","attrs","Object","keys","sortAttributes","sort","v","allAttributes","hooked","attributeHook","__html","xml","sub","Error","isVoid","voidElements","pieces","hasLarge","lastWasText","child","ret","isText","join","substring"],"mappings":"wRACaA,EAAqB,kEAE5BC,EAAmB,kBAETC,EAAeC,GAC9B,IAAMC,EAAIC,OAAOF,GACjB,OAAKF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,IAAI8D,EAASD,EAAIxG,OAAS,GAAe,KAAVwG,EAAI,GAI/BF,GAAeG,EAClBL,EAAOA,EAAOpG,OAAS,IAAMwG,EAE7BJ,EAAOhF,KAAKoF,GAGbF,EAAcG,OAEdL,EAAOhF,KAAKoF,IAKhB,GAAI7D,GAAU0D,EACb,IAAK,IAAIxF,EAAIuF,EAAOpG,OAAQa,KAC3BuF,EAAOvF,GAAK,KAAO+B,EAAa/C,EAAOuG,EAAOvF,GAAI+B,GAKrD,GAAIwD,EAAOpG,QAAUoF,EACpB3F,GAAK2G,EAAOM,KAAK,YACPzE,GAAQA,EAAK8D,IACvB,OAAOtG,EAAEkH,UAAU,EAAGlH,EAAEO,OAAS,GAAK,MAUvC,OAPIkG,GAAWlF,GAAaoE,GAGvBzC,IAAWlD,EAAES,QAAQ,QAAOT,GAAK,MACrCA,QAAUsD,OAHVtD,EAAIA,EAAEG,QAAQ,KAAM,OAMdH,EA+BRkC,EAAeE,cAAgBA"}
1
+ {"version":3,"file":"index.js","sources":["../src/util.js","../src/index.js"],"sourcesContent":["// DOM properties that should NOT have \"px\" added when numeric\nexport const IS_NON_DIMENSIONAL = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|^--/i;\n\nconst ENCODED_ENTITIES = /[&<>\"]/;\n\nexport function encodeEntities(input) {\n\tconst s = String(input);\n\tif (!ENCODED_ENTITIES.test(s)) {\n\t\treturn s;\n\t}\n\treturn s\n\t\t.replace(/&/g, '&amp;')\n\t\t.replace(/</g, '&lt;')\n\t\t.replace(/>/g, '&gt;')\n\t\t.replace(/\"/g, '&quot;');\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\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\tif (str) str += ' ';\n\t\t\t// str += jsToCss(prop);\n\t\t\tstr +=\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(/([A-Z])/g, '-$1').toLowerCase());\n\t\t\tstr += ': ';\n\t\t\tstr += val;\n\t\t\tif (typeof val === 'number' && IS_NON_DIMENSIONAL.test(prop) === false) {\n\t\t\t\tstr += 'px';\n\t\t\t}\n\t\t\tstr += ';';\n\t\t}\n\t}\n\treturn str || undefined;\n}\n\n/**\n * Copy all properties from `props` onto `obj`.\n * @param {object} obj Object onto which properties should be copied.\n * @param {object} props Object from which to copy properties.\n * @returns {object}\n * @private\n */\nexport function assign(obj, props) {\n\tfor (let i in props) obj[i] = props[i];\n\treturn obj;\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","import {\n\tencodeEntities,\n\tindent,\n\tisLargeString,\n\tstyleObjToCss,\n\tassign,\n\tgetChildren\n} from './util';\nimport { options, Fragment } from 'preact';\n\n/** @typedef {import('preact').VNode} VNode */\n\nconst SHALLOW = { shallow: true };\n\n// components without names, kept as a hash for later comparison to return consistent UnnamedComponentXX names.\nconst UNNAMED = [];\n\nconst VOID_ELEMENTS = /^(area|base|br|col|embed|hr|img|input|link|meta|param|source|track|wbr)$/;\n\nconst UNSAFE_NAME = /[\\s\\n\\\\/='\"\\0<>]/;\n\nfunction markAsDirty() {\n\tthis.__d = true;\n}\n\n/** Render Preact JSX + Components to an HTML string.\n *\t@name render\n *\t@function\n *\t@param {VNode} vnode\tJSX VNode to render.\n *\t@param {Object} [context={}]\tOptionally pass an initial context object through the render path.\n *\t@param {Object} [options={}]\tRendering options\n *\t@param {Boolean} [options.shallow=false]\tIf `true`, renders nested Components as HTML elements (`<Foo a=\"b\" />`).\n *\t@param {Boolean} [options.xml=false]\t\tIf `true`, uses self-closing tags for elements without children.\n *\t@param {Boolean} [options.pretty=false]\t\tIf `true`, adds whitespace for readability\n *\t@param {RegExp|undefined} [options.voidElements] RegeEx that matches elements that are considered void (self-closing)\n */\nrenderToString.render = renderToString;\n\n/** Only render elements, leaving Components inline as `<ComponentName ... />`.\n *\tThis method is just a convenience alias for `render(vnode, context, { shallow:true })`\n *\t@name shallow\n *\t@function\n *\t@param {VNode} vnode\tJSX VNode to render.\n *\t@param {Object} [context={}]\tOptionally pass an initial context object through the render path.\n */\nlet shallowRender = (vnode, context) => renderToString(vnode, context, SHALLOW);\n\nconst EMPTY_ARR = [];\nfunction renderToString(vnode, context, opts) {\n\tcontext = context || {};\n\topts = opts || {};\n\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.__s;\n\toptions.__s = true;\n\n\tconst res = _renderToString(vnode, context, opts);\n\n\t// options._commit, we don't schedule any effects in this library right now,\n\t// so we can pass an empty queue to this hook.\n\tif (options.__c) options.__c(vnode, EMPTY_ARR);\n\tEMPTY_ARR.length = 0;\n\toptions.__s = previousSkipEffects;\n\treturn res;\n}\n\n/** The default export is an alias of `render()`. */\nfunction _renderToString(vnode, context, opts, inner, isSvgMode, selectValue) {\n\tif (vnode == null || typeof vnode === 'boolean') {\n\t\treturn '';\n\t}\n\n\t// #text nodes\n\tif (typeof vnode !== 'object') {\n\t\treturn encodeEntities(vnode);\n\t}\n\n\tlet pretty = opts.pretty,\n\t\tindentChar = pretty && typeof pretty === 'string' ? pretty : '\\t';\n\n\tif (Array.isArray(vnode)) {\n\t\tlet rendered = '';\n\t\tfor (let i = 0; i < vnode.length; i++) {\n\t\t\tif (pretty && i > 0) rendered += '\\n';\n\t\t\trendered += _renderToString(\n\t\t\t\tvnode[i],\n\t\t\t\tcontext,\n\t\t\t\topts,\n\t\t\t\tinner,\n\t\t\t\tisSvgMode,\n\t\t\t\tselectValue\n\t\t\t);\n\t\t}\n\t\treturn rendered;\n\t}\n\n\tlet nodeName = vnode.type,\n\t\tprops = vnode.props,\n\t\tisComponent = false;\n\n\t// components\n\tif (typeof nodeName === 'function') {\n\t\tisComponent = true;\n\t\tif (opts.shallow && (inner || opts.renderRootComponent === false)) {\n\t\t\tnodeName = getComponentName(nodeName);\n\t\t} else if (nodeName === Fragment) {\n\t\t\tconst children = [];\n\t\t\tgetChildren(children, vnode.props.children);\n\t\t\treturn _renderToString(\n\t\t\t\tchildren,\n\t\t\t\tcontext,\n\t\t\t\topts,\n\t\t\t\topts.shallowHighOrder !== false,\n\t\t\t\tisSvgMode,\n\t\t\t\tselectValue\n\t\t\t);\n\t\t} else {\n\t\t\tlet rendered;\n\n\t\t\tlet c = (vnode.__c = {\n\t\t\t\t__v: vnode,\n\t\t\t\tcontext,\n\t\t\t\tprops: vnode.props,\n\t\t\t\t// silently drop state updates\n\t\t\t\tsetState: markAsDirty,\n\t\t\t\tforceUpdate: markAsDirty,\n\t\t\t\t__d: true,\n\t\t\t\t// hooks\n\t\t\t\t__h: []\n\t\t\t});\n\n\t\t\t// options._diff\n\t\t\tif (options.__b) options.__b(vnode);\n\n\t\t\t// options._render\n\t\t\tlet renderHook = options.__r;\n\n\t\t\tif (\n\t\t\t\t!nodeName.prototype ||\n\t\t\t\ttypeof nodeName.prototype.render !== 'function'\n\t\t\t) {\n\t\t\t\t// Necessary for createContext api. Setting this property will pass\n\t\t\t\t// the context value as `this.context` just for this component.\n\t\t\t\tlet cxType = nodeName.contextType;\n\t\t\t\tlet provider = cxType && context[cxType.__c];\n\t\t\t\tlet cctx =\n\t\t\t\t\tcxType != null\n\t\t\t\t\t\t? provider\n\t\t\t\t\t\t\t? provider.props.value\n\t\t\t\t\t\t\t: cxType.__\n\t\t\t\t\t\t: context;\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 (c.__d && count++ < 25) {\n\t\t\t\t\tc.__d = false;\n\n\t\t\t\t\tif (renderHook) renderHook(vnode);\n\n\t\t\t\t\t// stateless functional components\n\t\t\t\t\trendered = nodeName.call(vnode.__c, props, cctx);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// class-based components\n\t\t\t\tlet cxType = nodeName.contextType;\n\t\t\t\tlet provider = cxType && context[cxType.__c];\n\t\t\t\tlet cctx =\n\t\t\t\t\tcxType != null\n\t\t\t\t\t\t? provider\n\t\t\t\t\t\t\t? provider.props.value\n\t\t\t\t\t\t\t: cxType.__\n\t\t\t\t\t\t: context;\n\n\t\t\t\t// c = new nodeName(props, context);\n\t\t\t\tc = vnode.__c = new nodeName(props, cctx);\n\t\t\t\tc.__v = vnode;\n\t\t\t\t// turn off stateful re-rendering:\n\t\t\t\tc._dirty = c.__d = true;\n\t\t\t\tc.props = props;\n\t\t\t\tif (c.state == null) c.state = {};\n\n\t\t\t\tif (c._nextState == null && c.__s == null) {\n\t\t\t\t\tc._nextState = c.__s = c.state;\n\t\t\t\t}\n\n\t\t\t\tc.context = cctx;\n\t\t\t\tif (nodeName.getDerivedStateFromProps)\n\t\t\t\t\tc.state = assign(\n\t\t\t\t\t\tassign({}, c.state),\n\t\t\t\t\t\tnodeName.getDerivedStateFromProps(c.props, c.state)\n\t\t\t\t\t);\n\t\t\t\telse if (c.componentWillMount) {\n\t\t\t\t\tc.componentWillMount();\n\n\t\t\t\t\t// If the user called setState in cWM we need to flush pending,\n\t\t\t\t\t// state updates. This is the same behaviour in React.\n\t\t\t\t\tc.state =\n\t\t\t\t\t\tc._nextState !== c.state\n\t\t\t\t\t\t\t? c._nextState\n\t\t\t\t\t\t\t: c.__s !== c.state\n\t\t\t\t\t\t\t? c.__s\n\t\t\t\t\t\t\t: c.state;\n\t\t\t\t}\n\n\t\t\t\tif (renderHook) renderHook(vnode);\n\n\t\t\t\trendered = c.render(c.props, c.state, c.context);\n\t\t\t}\n\n\t\t\tif (c.getChildContext) {\n\t\t\t\tcontext = assign(assign({}, context), c.getChildContext());\n\t\t\t}\n\n\t\t\tif (options.diffed) options.diffed(vnode);\n\t\t\treturn _renderToString(\n\t\t\t\trendered,\n\t\t\t\tcontext,\n\t\t\t\topts,\n\t\t\t\topts.shallowHighOrder !== false,\n\t\t\t\tisSvgMode,\n\t\t\t\tselectValue\n\t\t\t);\n\t\t}\n\t}\n\n\t// render JSX to HTML\n\tlet s = '<' + nodeName,\n\t\tpropChildren,\n\t\thtml;\n\n\tif (props) {\n\t\tlet attrs = Object.keys(props);\n\n\t\t// allow sorting lexicographically for more determinism (useful for tests, such as via preact-jsx-chai)\n\t\tif (opts && opts.sortAttributes === true) attrs.sort();\n\n\t\tfor (let i = 0; i < attrs.length; i++) {\n\t\t\tlet name = attrs[i],\n\t\t\t\tv = props[name];\n\t\t\tif (name === 'children') {\n\t\t\t\tpropChildren = v;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (UNSAFE_NAME.test(name)) continue;\n\n\t\t\tif (\n\t\t\t\t!(opts && opts.allAttributes) &&\n\t\t\t\t(name === 'key' ||\n\t\t\t\t\tname === 'ref' ||\n\t\t\t\t\tname === '__self' ||\n\t\t\t\t\tname === '__source')\n\t\t\t)\n\t\t\t\tcontinue;\n\n\t\t\tif (name === 'defaultValue') {\n\t\t\t\tname = 'value';\n\t\t\t} else if (name === 'className') {\n\t\t\t\tif (typeof props.class !== 'undefined') continue;\n\t\t\t\tname = 'class';\n\t\t\t} else if (isSvgMode && name.match(/^xlink:?./)) {\n\t\t\t\tname = name.toLowerCase().replace(/^xlink:?/, 'xlink:');\n\t\t\t}\n\n\t\t\tif (name === 'htmlFor') {\n\t\t\t\tif (props.for) continue;\n\t\t\t\tname = 'for';\n\t\t\t}\n\n\t\t\tif (name === 'style' && v && typeof v === 'object') {\n\t\t\t\tv = styleObjToCss(v);\n\t\t\t}\n\n\t\t\t// always use string values instead of booleans for aria attributes\n\t\t\t// also see https://github.com/preactjs/preact/pull/2347/files\n\t\t\tif (name[0] === 'a' && name['1'] === 'r' && typeof v === 'boolean') {\n\t\t\t\tv = String(v);\n\t\t\t}\n\n\t\t\tlet hooked =\n\t\t\t\topts.attributeHook &&\n\t\t\t\topts.attributeHook(name, v, context, opts, isComponent);\n\t\t\tif (hooked || hooked === '') {\n\t\t\t\ts += hooked;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (name === 'dangerouslySetInnerHTML') {\n\t\t\t\thtml = v && v.__html;\n\t\t\t} else if (nodeName === 'textarea' && name === 'value') {\n\t\t\t\t// <textarea value=\"a&b\"> --> <textarea>a&amp;b</textarea>\n\t\t\t\tpropChildren = v;\n\t\t\t} else if ((v || v === 0 || v === '') && typeof v !== 'function') {\n\t\t\t\tif (v === true || v === '') {\n\t\t\t\t\tv = name;\n\t\t\t\t\t// in non-xml mode, allow boolean attributes\n\t\t\t\t\tif (!opts || !opts.xml) {\n\t\t\t\t\t\ts += ' ' + name;\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (name === 'value') {\n\t\t\t\t\tif (nodeName === 'select') {\n\t\t\t\t\t\tselectValue = v;\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t} else if (\n\t\t\t\t\t\t// If we're looking at an <option> and it's the currently selected one\n\t\t\t\t\t\tnodeName === 'option' &&\n\t\t\t\t\t\tselectValue == v &&\n\t\t\t\t\t\t// and the <option> doesn't already have a selected attribute on it\n\t\t\t\t\t\ttypeof props.selected === 'undefined'\n\t\t\t\t\t) {\n\t\t\t\t\t\ts += ` selected`;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\ts += ` ${name}=\"${encodeEntities(v)}\"`;\n\t\t\t}\n\t\t}\n\t}\n\n\t// account for >1 multiline attribute\n\tif (pretty) {\n\t\tlet sub = s.replace(/\\n\\s*/, ' ');\n\t\tif (sub !== s && !~sub.indexOf('\\n')) s = sub;\n\t\telse if (pretty && ~s.indexOf('\\n')) s += '\\n';\n\t}\n\n\ts += '>';\n\n\tif (UNSAFE_NAME.test(nodeName))\n\t\tthrow new Error(`${nodeName} is not a valid HTML tag name in ${s}`);\n\n\tlet isVoid =\n\t\tVOID_ELEMENTS.test(nodeName) ||\n\t\t(opts.voidElements && opts.voidElements.test(nodeName));\n\tlet pieces = [];\n\n\tlet children;\n\tif (html) {\n\t\t// if multiline, indent.\n\t\tif (pretty && isLargeString(html)) {\n\t\t\thtml = '\\n' + indentChar + indent(html, indentChar);\n\t\t}\n\t\ts += html;\n\t} else if (\n\t\tpropChildren != null &&\n\t\tgetChildren((children = []), propChildren).length\n\t) {\n\t\tlet hasLarge = pretty && ~s.indexOf('\\n');\n\t\tlet lastWasText = false;\n\n\t\tfor (let i = 0; i < children.length; i++) {\n\t\t\tlet child = children[i];\n\n\t\t\tif (child != null && child !== false) {\n\t\t\t\tlet childSvgMode =\n\t\t\t\t\t\tnodeName === 'svg'\n\t\t\t\t\t\t\t? true\n\t\t\t\t\t\t\t: nodeName === 'foreignObject'\n\t\t\t\t\t\t\t? false\n\t\t\t\t\t\t\t: isSvgMode,\n\t\t\t\t\tret = _renderToString(\n\t\t\t\t\t\tchild,\n\t\t\t\t\t\tcontext,\n\t\t\t\t\t\topts,\n\t\t\t\t\t\ttrue,\n\t\t\t\t\t\tchildSvgMode,\n\t\t\t\t\t\tselectValue\n\t\t\t\t\t);\n\n\t\t\t\tif (pretty && !hasLarge && isLargeString(ret)) hasLarge = true;\n\n\t\t\t\t// Skip if we received an empty string\n\t\t\t\tif (ret) {\n\t\t\t\t\tif (pretty) {\n\t\t\t\t\t\tlet isText = ret.length > 0 && ret[0] != '<';\n\n\t\t\t\t\t\t// We merge adjacent text nodes, otherwise each piece would be printed\n\t\t\t\t\t\t// on a new line.\n\t\t\t\t\t\tif (lastWasText && isText) {\n\t\t\t\t\t\t\tpieces[pieces.length - 1] += ret;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tpieces.push(ret);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tlastWasText = isText;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tpieces.push(ret);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (pretty && hasLarge) {\n\t\t\tfor (let i = pieces.length; i--; ) {\n\t\t\t\tpieces[i] = '\\n' + indentChar + indent(pieces[i], indentChar);\n\t\t\t}\n\t\t}\n\t}\n\n\tif (pieces.length || html) {\n\t\ts += pieces.join('');\n\t} else if (opts && opts.xml) {\n\t\treturn s.substring(0, s.length - 1) + ' />';\n\t}\n\n\tif (isVoid && !children && !html) {\n\t\ts = s.replace(/>$/, ' />');\n\t} else {\n\t\tif (pretty && ~s.indexOf('\\n')) s += '\\n';\n\t\ts += `</${nodeName}>`;\n\t}\n\n\treturn s;\n}\n\nfunction getComponentName(component) {\n\treturn (\n\t\tcomponent.displayName ||\n\t\t(component !== Function && component.name) ||\n\t\tgetFallbackComponentName(component)\n\t);\n}\n\nfunction getFallbackComponentName(component) {\n\tlet str = Function.prototype.toString.call(component),\n\t\tname = (str.match(/^\\s*function\\s+([^( ]+)/) || '')[1];\n\tif (!name) {\n\t\t// search for an existing indexed name for the given component:\n\t\tlet index = -1;\n\t\tfor (let i = UNNAMED.length; i--; ) {\n\t\t\tif (UNNAMED[i] === component) {\n\t\t\t\tindex = i;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t// not found, create a new indexed name:\n\t\tif (index < 0) {\n\t\t\tindex = UNNAMED.push(component) - 1;\n\t\t}\n\t\tname = `UnnamedComponent${index}`;\n\t}\n\treturn name;\n}\nrenderToString.shallowRender = shallowRender;\n\nexport default renderToString;\n\nexport {\n\trenderToString as render,\n\trenderToString as renderToStaticMarkup,\n\trenderToString,\n\tshallowRender\n};\n"],"names":["IS_NON_DIMENSIONAL","ENCODED_ENTITIES","encodeEntities","input","s","String","test","replace","indent","char","isLargeString","length","ignoreLines","indexOf","JS_TO_CSS","styleObjToCss","str","prop","val","toLowerCase","undefined","assign","obj","props","i","getChildren","accumulator","children","Array","isArray","reduce","push","SHALLOW","shallow","UNNAMED","VOID_ELEMENTS","UNSAFE_NAME","markAsDirty","this","__d","renderToString","render","shallowRender","vnode","context","EMPTY_ARR","opts","previousSkipEffects","options","__s","res","_renderToString","__c","inner","isSvgMode","selectValue","pretty","indentChar","rendered","component","nodeName","type","isComponent","renderRootComponent","Fragment","shallowHighOrder","c","__v","setState","forceUpdate","__h","__b","renderHook","__r","prototype","cxType","contextType","provider","cctx","value","__","_dirty","state","_nextState","getDerivedStateFromProps","componentWillMount","count","call","getChildContext","diffed","displayName","Function","name","toString","match","index","getFallbackComponentName","propChildren","html","attrs","Object","keys","sortAttributes","sort","v","allAttributes","hooked","attributeHook","__html","xml","selected","sub","Error","isVoid","voidElements","pieces","hasLarge","lastWasText","child","ret","isText","join","substring"],"mappings":"wRACaA,EAAqB,kEAE5BC,EAAmB,kBAETC,EAAeC,GAC9B,IAAMC,EAAIC,OAAOF,GACjB,OAAKF,EAAiBK,KAAKF,GAGpBA,EACLG,QAAQ,KAAM,SACdA,QAAQ,KAAM,QACdA,QAAQ,KAAM,QACdA,QAAQ,KAAM,UANRH,MASEI,EAAS,SAACJ,EAAGK,UACvBJ,OAAOD,GAAG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W,GAGtDG,EACH,GAAI/D,EAAQ,CACX,IAAIgE,GAASD,EAAI5G,OAAS,GAAe,KAAV4G,EAAI,GAI/BF,GAAeG,GAClBL,EAAOA,EAAOxG,OAAS,IAAM4G,EAE7BJ,EAAOpF,KAAKwF,GAGbF,EAAcG,QAEdL,EAAOpF,KAAKwF,IAKhB,GAAI/D,GAAU4D,EACb,IAAK,IAAI5F,GAAI2F,EAAOxG,OAAQa,MAC3B2F,EAAO3F,IAAK,KAAOiC,EAAajD,EAAO2G,EAAO3F,IAAIiC,GAKrD,GAAI0D,EAAOxG,QAAUuF,EACpB9F,GAAK+G,EAAOM,KAAK,YACP3E,GAAQA,EAAK+D,IACvB,OAAOzG,EAAEsH,UAAU,EAAGtH,EAAEO,OAAS,GAAK,MAUvC,OAPIsG,GAAWtF,GAAauE,GAGvB1C,IAAWpD,EAAES,QAAQ,QAAOT,GAAK,MACrCA,QAAUwD,OAHVxD,EAAIA,EAAEG,QAAQ,KAAM,OAMdH,EA+BRoC,EAAeE,cAAgBA"}
@@ -1,2 +1,2 @@
1
- import{options as e,Fragment as t}from"preact";var r=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|^--/i,n=/[&<>"]/;function o(e){var t=String(e);return n.test(t)?t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;"):t}var a=function(e,t){return String(e).replace(/(\n+)/g,"$1"+(t||"\t"))},i=function(e,t,r){return String(e).length>(t||40)||!r&&-1!==String(e).indexOf("\n")||-1!==String(e).indexOf("<")},l={};function s(e){var t="";for(var n in e){var o=e[n];null!=o&&""!==o&&(t&&(t+=" "),t+="-"==n[0]?n:l[n]||(l[n]=n.replace(/([A-Z])/g,"-$1").toLowerCase()),t+=": ",t+=o,"number"==typeof o&&!1===r.test(n)&&(t+="px"),t+=";")}return t||void 0}function f(e,t){for(var r in t)e[r]=t[r];return e}function u(e,t){return Array.isArray(t)?t.reduce(u,e):null!=t&&!1!==t&&e.push(t),e}var c={shallow:!0},p=[],_=/^(area|base|br|col|embed|hr|img|input|link|meta|param|source|track|wbr)$/,v=/[\s\n\\/='"\0<>]/,d=function(){};m.render=m;var g=function(e,t){return m(e,t,c)},h=[];function m(t,r,n){r=r||{},n=n||{};var o=e.__s;e.__s=!0;var a=x(t,r,n);return e.__c&&e.__c(t,h),h.length=0,e.__s=o,a}function x(r,n,l,c,g,h){if(null==r||"boolean"==typeof r)return"";if("object"!=typeof r)return o(r);var m=l.pretty,y=m&&"string"==typeof m?m:"\t";if(Array.isArray(r)){for(var b="",S=0;S<r.length;S++)m&&S>0&&(b+="\n"),b+=x(r[S],n,l,c,g,h);return b}var w,k=r.type,O=r.props,C=!1;if("function"==typeof k){if(C=!0,!l.shallow||!c&&!1!==l.renderRootComponent){if(k===t){var A=[];return u(A,r.props.children),x(A,n,l,!1!==l.shallowHighOrder,g,h)}var H,j=r.__c={__v:r,context:n,props:r.props,setState:d,forceUpdate:d,__h:[]};if(e.__b&&e.__b(r),e.__r&&e.__r(r),k.prototype&&"function"==typeof k.prototype.render){var F=k.contextType,M=F&&n[F.__c],T=null!=F?M?M.props.value:F.__:n;(j=r.__c=new k(O,T)).__v=r,j._dirty=j.__d=!0,j.props=O,null==j.state&&(j.state={}),null==j._nextState&&null==j.__s&&(j._nextState=j.__s=j.state),j.context=T,k.getDerivedStateFromProps?j.state=f(f({},j.state),k.getDerivedStateFromProps(j.props,j.state)):j.componentWillMount&&(j.componentWillMount(),j.state=j._nextState!==j.state?j._nextState:j.__s!==j.state?j.__s:j.state),H=j.render(j.props,j.state,j.context)}else{var $=k.contextType,L=$&&n[$.__c];H=k.call(r.__c,O,null!=$?L?L.props.value:$.__:n)}return j.getChildContext&&(n=f(f({},n),j.getChildContext())),e.diffed&&e.diffed(r),x(H,n,l,!1!==l.shallowHighOrder,g,h)}k=(w=k).displayName||w!==Function&&w.name||function(e){var t=(Function.prototype.toString.call(e).match(/^\s*function\s+([^( ]+)/)||"")[1];if(!t){for(var r=-1,n=p.length;n--;)if(p[n]===e){r=n;break}r<0&&(r=p.push(e)-1),t="UnnamedComponent"+r}return t}(w)}var E,D,N="<"+k;if(O){var P=Object.keys(O);l&&!0===l.sortAttributes&&P.sort();for(var R=0;R<P.length;R++){var U=P[R],W=O[U];if("children"!==U){if(!v.test(U)&&(l&&l.allAttributes||"key"!==U&&"ref"!==U&&"__self"!==U&&"__source"!==U)){if("defaultValue"===U)U="value";else if("className"===U){if(void 0!==O.class)continue;U="class"}else g&&U.match(/^xlink:?./)&&(U=U.toLowerCase().replace(/^xlink:?/,"xlink:"));if("htmlFor"===U){if(O.for)continue;U="for"}"style"===U&&W&&"object"==typeof W&&(W=s(W)),"a"===U[0]&&"r"===U[1]&&"boolean"==typeof W&&(W=String(W));var q=l.attributeHook&&l.attributeHook(U,W,n,l,C);if(q||""===q)N+=q;else if("dangerouslySetInnerHTML"===U)D=W&&W.__html;else if("textarea"===k&&"value"===U)E=W;else if((W||0===W||""===W)&&"function"!=typeof W){if(!(!0!==W&&""!==W||(W=U,l&&l.xml))){N+=" "+U;continue}if("value"===U){if("select"===k){h=W;continue}"option"===k&&h==W&&(N+=" selected")}N+=" "+U+'="'+o(W)+'"'}}}else E=W}}if(m){var z=N.replace(/\n\s*/," ");z===N||~z.indexOf("\n")?m&&~N.indexOf("\n")&&(N+="\n"):N=z}if(N+=">",v.test(k))throw new Error(k+" is not a valid HTML tag name in "+N);var I,V=_.test(k)||l.voidElements&&l.voidElements.test(k),Z=[];if(D)m&&i(D)&&(D="\n"+y+a(D,y)),N+=D;else if(null!=E&&u(I=[],E).length){for(var B=m&&~N.indexOf("\n"),G=!1,J=0;J<I.length;J++){var K=I[J];if(null!=K&&!1!==K){var Q=x(K,n,l,!0,"svg"===k||"foreignObject"!==k&&g,h);if(m&&!B&&i(Q)&&(B=!0),Q)if(m){var X=Q.length>0&&"<"!=Q[0];G&&X?Z[Z.length-1]+=Q:Z.push(Q),G=X}else Z.push(Q)}}if(m&&B)for(var Y=Z.length;Y--;)Z[Y]="\n"+y+a(Z[Y],y)}if(Z.length||D)N+=Z.join("");else if(l&&l.xml)return N.substring(0,N.length-1)+" />";return!V||I||D?(m&&~N.indexOf("\n")&&(N+="\n"),N+="</"+k+">"):N=N.replace(/>$/," />"),N}m.shallowRender=g;export default m;export{m as render,m as renderToStaticMarkup,m as renderToString,g as shallowRender};
1
+ import{options as e,Fragment as t}from"preact";var r=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|^--/i,n=/[&<>"]/;function o(e){var t=String(e);return n.test(t)?t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;"):t}var a=function(e,t){return String(e).replace(/(\n+)/g,"$1"+(t||"\t"))},i=function(e,t,r){return String(e).length>(t||40)||!r&&-1!==String(e).indexOf("\n")||-1!==String(e).indexOf("<")},l={};function s(e){var t="";for(var n in e){var o=e[n];null!=o&&""!==o&&(t&&(t+=" "),t+="-"==n[0]?n:l[n]||(l[n]=n.replace(/([A-Z])/g,"-$1").toLowerCase()),t+=": ",t+=o,"number"==typeof o&&!1===r.test(n)&&(t+="px"),t+=";")}return t||void 0}function f(e,t){for(var r in t)e[r]=t[r];return e}function u(e,t){return Array.isArray(t)?t.reduce(u,e):null!=t&&!1!==t&&e.push(t),e}var c={shallow:!0},p=[],_=/^(area|base|br|col|embed|hr|img|input|link|meta|param|source|track|wbr)$/,d=/[\s\n\\/='"\0<>]/;function v(){this.__d=!0}m.render=m;var g=function(e,t){return m(e,t,c)},h=[];function m(t,r,n){r=r||{},n=n||{};var o=e.__s;e.__s=!0;var a=x(t,r,n);return e.__c&&e.__c(t,h),h.length=0,e.__s=o,a}function x(r,n,l,c,g,h){if(null==r||"boolean"==typeof r)return"";if("object"!=typeof r)return o(r);var m=l.pretty,y=m&&"string"==typeof m?m:"\t";if(Array.isArray(r)){for(var b="",S=0;S<r.length;S++)m&&S>0&&(b+="\n"),b+=x(r[S],n,l,c,g,h);return b}var w,k=r.type,O=r.props,C=!1;if("function"==typeof k){if(C=!0,!l.shallow||!c&&!1!==l.renderRootComponent){if(k===t){var A=[];return u(A,r.props.children),x(A,n,l,!1!==l.shallowHighOrder,g,h)}var H,j=r.__c={__v:r,context:n,props:r.props,setState:v,forceUpdate:v,__d:!0,__h:[]};e.__b&&e.__b(r);var F=e.__r;if(k.prototype&&"function"==typeof k.prototype.render){var M=k.contextType,T=M&&n[M.__c],$=null!=M?T?T.props.value:M.__:n;(j=r.__c=new k(O,$)).__v=r,j._dirty=j.__d=!0,j.props=O,null==j.state&&(j.state={}),null==j._nextState&&null==j.__s&&(j._nextState=j.__s=j.state),j.context=$,k.getDerivedStateFromProps?j.state=f(f({},j.state),k.getDerivedStateFromProps(j.props,j.state)):j.componentWillMount&&(j.componentWillMount(),j.state=j._nextState!==j.state?j._nextState:j.__s!==j.state?j.__s:j.state),F&&F(r),H=j.render(j.props,j.state,j.context)}else for(var L=k.contextType,E=L&&n[L.__c],D=null!=L?E?E.props.value:L.__:n,N=0;j.__d&&N++<25;)j.__d=!1,F&&F(r),H=k.call(r.__c,O,D);return j.getChildContext&&(n=f(f({},n),j.getChildContext())),e.diffed&&e.diffed(r),x(H,n,l,!1!==l.shallowHighOrder,g,h)}k=(w=k).displayName||w!==Function&&w.name||function(e){var t=(Function.prototype.toString.call(e).match(/^\s*function\s+([^( ]+)/)||"")[1];if(!t){for(var r=-1,n=p.length;n--;)if(p[n]===e){r=n;break}r<0&&(r=p.push(e)-1),t="UnnamedComponent"+r}return t}(w)}var P,R,U="<"+k;if(O){var W=Object.keys(O);l&&!0===l.sortAttributes&&W.sort();for(var q=0;q<W.length;q++){var z=W[q],I=O[z];if("children"!==z){if(!d.test(z)&&(l&&l.allAttributes||"key"!==z&&"ref"!==z&&"__self"!==z&&"__source"!==z)){if("defaultValue"===z)z="value";else if("className"===z){if(void 0!==O.class)continue;z="class"}else g&&z.match(/^xlink:?./)&&(z=z.toLowerCase().replace(/^xlink:?/,"xlink:"));if("htmlFor"===z){if(O.for)continue;z="for"}"style"===z&&I&&"object"==typeof I&&(I=s(I)),"a"===z[0]&&"r"===z[1]&&"boolean"==typeof I&&(I=String(I));var V=l.attributeHook&&l.attributeHook(z,I,n,l,C);if(V||""===V)U+=V;else if("dangerouslySetInnerHTML"===z)R=I&&I.__html;else if("textarea"===k&&"value"===z)P=I;else if((I||0===I||""===I)&&"function"!=typeof I){if(!(!0!==I&&""!==I||(I=z,l&&l.xml))){U+=" "+z;continue}if("value"===z){if("select"===k){h=I;continue}"option"===k&&h==I&&void 0===O.selected&&(U+=" selected")}U+=" "+z+'="'+o(I)+'"'}}}else P=I}}if(m){var Z=U.replace(/\n\s*/," ");Z===U||~Z.indexOf("\n")?m&&~U.indexOf("\n")&&(U+="\n"):U=Z}if(U+=">",d.test(k))throw new Error(k+" is not a valid HTML tag name in "+U);var B,G=_.test(k)||l.voidElements&&l.voidElements.test(k),J=[];if(R)m&&i(R)&&(R="\n"+y+a(R,y)),U+=R;else if(null!=P&&u(B=[],P).length){for(var K=m&&~U.indexOf("\n"),Q=!1,X=0;X<B.length;X++){var Y=B[X];if(null!=Y&&!1!==Y){var ee=x(Y,n,l,!0,"svg"===k||"foreignObject"!==k&&g,h);if(m&&!K&&i(ee)&&(K=!0),ee)if(m){var te=ee.length>0&&"<"!=ee[0];Q&&te?J[J.length-1]+=ee:J.push(ee),Q=te}else J.push(ee)}}if(m&&K)for(var re=J.length;re--;)J[re]="\n"+y+a(J[re],y)}if(J.length||R)U+=J.join("");else if(l&&l.xml)return U.substring(0,U.length-1)+" />";return!G||B||R?(m&&~U.indexOf("\n")&&(U+="\n"),U+="</"+k+">"):U=U.replace(/>$/," />"),U}m.shallowRender=g;export default m;export{m as render,m as renderToStaticMarkup,m as renderToString,g as shallowRender};
2
2
  //# sourceMappingURL=index.module.js.map
@@ -1,2 +1,2 @@
1
- import{options as e,Fragment as t}from"preact";var r=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|^--/i,n=/[&<>"]/;function o(e){var t=String(e);return n.test(t)?t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;"):t}var a=function(e,t){return String(e).replace(/(\n+)/g,"$1"+(t||"\t"))},i=function(e,t,r){return String(e).length>(t||40)||!r&&-1!==String(e).indexOf("\n")||-1!==String(e).indexOf("<")},l={};function s(e){var t="";for(var n in e){var o=e[n];null!=o&&""!==o&&(t&&(t+=" "),t+="-"==n[0]?n:l[n]||(l[n]=n.replace(/([A-Z])/g,"-$1").toLowerCase()),t+=": ",t+=o,"number"==typeof o&&!1===r.test(n)&&(t+="px"),t+=";")}return t||void 0}function f(e,t){for(var r in t)e[r]=t[r];return e}function u(e,t){return Array.isArray(t)?t.reduce(u,e):null!=t&&!1!==t&&e.push(t),e}var c={shallow:!0},p=[],_=/^(area|base|br|col|embed|hr|img|input|link|meta|param|source|track|wbr)$/,v=/[\s\n\\/='"\0<>]/,d=function(){};m.render=m;var g=function(e,t){return m(e,t,c)},h=[];function m(t,r,n){r=r||{},n=n||{};var o=e.__s;e.__s=!0;var a=x(t,r,n);return e.__c&&e.__c(t,h),h.length=0,e.__s=o,a}function x(r,n,l,c,g,h){if(null==r||"boolean"==typeof r)return"";if("object"!=typeof r)return o(r);var m=l.pretty,y=m&&"string"==typeof m?m:"\t";if(Array.isArray(r)){for(var b="",S=0;S<r.length;S++)m&&S>0&&(b+="\n"),b+=x(r[S],n,l,c,g,h);return b}var w,k=r.type,O=r.props,C=!1;if("function"==typeof k){if(C=!0,!l.shallow||!c&&!1!==l.renderRootComponent){if(k===t){var A=[];return u(A,r.props.children),x(A,n,l,!1!==l.shallowHighOrder,g,h)}var H,j=r.__c={__v:r,context:n,props:r.props,setState:d,forceUpdate:d,__h:[]};if(e.__b&&e.__b(r),e.__r&&e.__r(r),k.prototype&&"function"==typeof k.prototype.render){var F=k.contextType,M=F&&n[F.__c],T=null!=F?M?M.props.value:F.__:n;(j=r.__c=new k(O,T)).__v=r,j._dirty=j.__d=!0,j.props=O,null==j.state&&(j.state={}),null==j._nextState&&null==j.__s&&(j._nextState=j.__s=j.state),j.context=T,k.getDerivedStateFromProps?j.state=f(f({},j.state),k.getDerivedStateFromProps(j.props,j.state)):j.componentWillMount&&(j.componentWillMount(),j.state=j._nextState!==j.state?j._nextState:j.__s!==j.state?j.__s:j.state),H=j.render(j.props,j.state,j.context)}else{var $=k.contextType,L=$&&n[$.__c];H=k.call(r.__c,O,null!=$?L?L.props.value:$.__:n)}return j.getChildContext&&(n=f(f({},n),j.getChildContext())),e.diffed&&e.diffed(r),x(H,n,l,!1!==l.shallowHighOrder,g,h)}k=(w=k).displayName||w!==Function&&w.name||function(e){var t=(Function.prototype.toString.call(e).match(/^\s*function\s+([^( ]+)/)||"")[1];if(!t){for(var r=-1,n=p.length;n--;)if(p[n]===e){r=n;break}r<0&&(r=p.push(e)-1),t="UnnamedComponent"+r}return t}(w)}var E,D,N="<"+k;if(O){var P=Object.keys(O);l&&!0===l.sortAttributes&&P.sort();for(var R=0;R<P.length;R++){var U=P[R],W=O[U];if("children"!==U){if(!v.test(U)&&(l&&l.allAttributes||"key"!==U&&"ref"!==U&&"__self"!==U&&"__source"!==U)){if("defaultValue"===U)U="value";else if("className"===U){if(void 0!==O.class)continue;U="class"}else g&&U.match(/^xlink:?./)&&(U=U.toLowerCase().replace(/^xlink:?/,"xlink:"));if("htmlFor"===U){if(O.for)continue;U="for"}"style"===U&&W&&"object"==typeof W&&(W=s(W)),"a"===U[0]&&"r"===U[1]&&"boolean"==typeof W&&(W=String(W));var q=l.attributeHook&&l.attributeHook(U,W,n,l,C);if(q||""===q)N+=q;else if("dangerouslySetInnerHTML"===U)D=W&&W.__html;else if("textarea"===k&&"value"===U)E=W;else if((W||0===W||""===W)&&"function"!=typeof W){if(!(!0!==W&&""!==W||(W=U,l&&l.xml))){N+=" "+U;continue}if("value"===U){if("select"===k){h=W;continue}"option"===k&&h==W&&(N+=" selected")}N+=" "+U+'="'+o(W)+'"'}}}else E=W}}if(m){var z=N.replace(/\n\s*/," ");z===N||~z.indexOf("\n")?m&&~N.indexOf("\n")&&(N+="\n"):N=z}if(N+=">",v.test(k))throw new Error(k+" is not a valid HTML tag name in "+N);var I,V=_.test(k)||l.voidElements&&l.voidElements.test(k),Z=[];if(D)m&&i(D)&&(D="\n"+y+a(D,y)),N+=D;else if(null!=E&&u(I=[],E).length){for(var B=m&&~N.indexOf("\n"),G=!1,J=0;J<I.length;J++){var K=I[J];if(null!=K&&!1!==K){var Q=x(K,n,l,!0,"svg"===k||"foreignObject"!==k&&g,h);if(m&&!B&&i(Q)&&(B=!0),Q)if(m){var X=Q.length>0&&"<"!=Q[0];G&&X?Z[Z.length-1]+=Q:Z.push(Q),G=X}else Z.push(Q)}}if(m&&B)for(var Y=Z.length;Y--;)Z[Y]="\n"+y+a(Z[Y],y)}if(Z.length||D)N+=Z.join("");else if(l&&l.xml)return N.substring(0,N.length-1)+" />";return!V||I||D?(m&&~N.indexOf("\n")&&(N+="\n"),N+="</"+k+">"):N=N.replace(/>$/," />"),N}m.shallowRender=g;export default m;export{m as render,m as renderToStaticMarkup,m as renderToString,g as shallowRender};
1
+ import{options as e,Fragment as t}from"preact";var r=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|^--/i,n=/[&<>"]/;function o(e){var t=String(e);return n.test(t)?t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;"):t}var a=function(e,t){return String(e).replace(/(\n+)/g,"$1"+(t||"\t"))},i=function(e,t,r){return String(e).length>(t||40)||!r&&-1!==String(e).indexOf("\n")||-1!==String(e).indexOf("<")},l={};function s(e){var t="";for(var n in e){var o=e[n];null!=o&&""!==o&&(t&&(t+=" "),t+="-"==n[0]?n:l[n]||(l[n]=n.replace(/([A-Z])/g,"-$1").toLowerCase()),t+=": ",t+=o,"number"==typeof o&&!1===r.test(n)&&(t+="px"),t+=";")}return t||void 0}function f(e,t){for(var r in t)e[r]=t[r];return e}function u(e,t){return Array.isArray(t)?t.reduce(u,e):null!=t&&!1!==t&&e.push(t),e}var c={shallow:!0},p=[],_=/^(area|base|br|col|embed|hr|img|input|link|meta|param|source|track|wbr)$/,d=/[\s\n\\/='"\0<>]/;function v(){this.__d=!0}m.render=m;var g=function(e,t){return m(e,t,c)},h=[];function m(t,r,n){r=r||{},n=n||{};var o=e.__s;e.__s=!0;var a=x(t,r,n);return e.__c&&e.__c(t,h),h.length=0,e.__s=o,a}function x(r,n,l,c,g,h){if(null==r||"boolean"==typeof r)return"";if("object"!=typeof r)return o(r);var m=l.pretty,y=m&&"string"==typeof m?m:"\t";if(Array.isArray(r)){for(var b="",S=0;S<r.length;S++)m&&S>0&&(b+="\n"),b+=x(r[S],n,l,c,g,h);return b}var w,k=r.type,O=r.props,C=!1;if("function"==typeof k){if(C=!0,!l.shallow||!c&&!1!==l.renderRootComponent){if(k===t){var A=[];return u(A,r.props.children),x(A,n,l,!1!==l.shallowHighOrder,g,h)}var H,j=r.__c={__v:r,context:n,props:r.props,setState:v,forceUpdate:v,__d:!0,__h:[]};e.__b&&e.__b(r);var F=e.__r;if(k.prototype&&"function"==typeof k.prototype.render){var M=k.contextType,T=M&&n[M.__c],$=null!=M?T?T.props.value:M.__:n;(j=r.__c=new k(O,$)).__v=r,j._dirty=j.__d=!0,j.props=O,null==j.state&&(j.state={}),null==j._nextState&&null==j.__s&&(j._nextState=j.__s=j.state),j.context=$,k.getDerivedStateFromProps?j.state=f(f({},j.state),k.getDerivedStateFromProps(j.props,j.state)):j.componentWillMount&&(j.componentWillMount(),j.state=j._nextState!==j.state?j._nextState:j.__s!==j.state?j.__s:j.state),F&&F(r),H=j.render(j.props,j.state,j.context)}else for(var L=k.contextType,E=L&&n[L.__c],D=null!=L?E?E.props.value:L.__:n,N=0;j.__d&&N++<25;)j.__d=!1,F&&F(r),H=k.call(r.__c,O,D);return j.getChildContext&&(n=f(f({},n),j.getChildContext())),e.diffed&&e.diffed(r),x(H,n,l,!1!==l.shallowHighOrder,g,h)}k=(w=k).displayName||w!==Function&&w.name||function(e){var t=(Function.prototype.toString.call(e).match(/^\s*function\s+([^( ]+)/)||"")[1];if(!t){for(var r=-1,n=p.length;n--;)if(p[n]===e){r=n;break}r<0&&(r=p.push(e)-1),t="UnnamedComponent"+r}return t}(w)}var P,R,U="<"+k;if(O){var W=Object.keys(O);l&&!0===l.sortAttributes&&W.sort();for(var q=0;q<W.length;q++){var z=W[q],I=O[z];if("children"!==z){if(!d.test(z)&&(l&&l.allAttributes||"key"!==z&&"ref"!==z&&"__self"!==z&&"__source"!==z)){if("defaultValue"===z)z="value";else if("className"===z){if(void 0!==O.class)continue;z="class"}else g&&z.match(/^xlink:?./)&&(z=z.toLowerCase().replace(/^xlink:?/,"xlink:"));if("htmlFor"===z){if(O.for)continue;z="for"}"style"===z&&I&&"object"==typeof I&&(I=s(I)),"a"===z[0]&&"r"===z[1]&&"boolean"==typeof I&&(I=String(I));var V=l.attributeHook&&l.attributeHook(z,I,n,l,C);if(V||""===V)U+=V;else if("dangerouslySetInnerHTML"===z)R=I&&I.__html;else if("textarea"===k&&"value"===z)P=I;else if((I||0===I||""===I)&&"function"!=typeof I){if(!(!0!==I&&""!==I||(I=z,l&&l.xml))){U+=" "+z;continue}if("value"===z){if("select"===k){h=I;continue}"option"===k&&h==I&&void 0===O.selected&&(U+=" selected")}U+=" "+z+'="'+o(I)+'"'}}}else P=I}}if(m){var Z=U.replace(/\n\s*/," ");Z===U||~Z.indexOf("\n")?m&&~U.indexOf("\n")&&(U+="\n"):U=Z}if(U+=">",d.test(k))throw new Error(k+" is not a valid HTML tag name in "+U);var B,G=_.test(k)||l.voidElements&&l.voidElements.test(k),J=[];if(R)m&&i(R)&&(R="\n"+y+a(R,y)),U+=R;else if(null!=P&&u(B=[],P).length){for(var K=m&&~U.indexOf("\n"),Q=!1,X=0;X<B.length;X++){var Y=B[X];if(null!=Y&&!1!==Y){var ee=x(Y,n,l,!0,"svg"===k||"foreignObject"!==k&&g,h);if(m&&!K&&i(ee)&&(K=!0),ee)if(m){var te=ee.length>0&&"<"!=ee[0];Q&&te?J[J.length-1]+=ee:J.push(ee),Q=te}else J.push(ee)}}if(m&&K)for(var re=J.length;re--;)J[re]="\n"+y+a(J[re],y)}if(J.length||R)U+=J.join("");else if(l&&l.xml)return U.substring(0,U.length-1)+" />";return!G||B||R?(m&&~U.indexOf("\n")&&(U+="\n"),U+="</"+k+">"):U=U.replace(/>$/," />"),U}m.shallowRender=g;export default m;export{m as render,m as renderToStaticMarkup,m as renderToString,g as shallowRender};
2
2
  //# sourceMappingURL=index.module.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.module.js","sources":["../src/util.js","../src/index.js"],"sourcesContent":["// DOM properties that should NOT have \"px\" added when numeric\nexport const IS_NON_DIMENSIONAL = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|^--/i;\n\nconst ENCODED_ENTITIES = /[&<>\"]/;\n\nexport function encodeEntities(input) {\n\tconst s = String(input);\n\tif (!ENCODED_ENTITIES.test(s)) {\n\t\treturn s;\n\t}\n\treturn s\n\t\t.replace(/&/g, '&amp;')\n\t\t.replace(/</g, '&lt;')\n\t\t.replace(/>/g, '&gt;')\n\t\t.replace(/\"/g, '&quot;');\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\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\tif (str) str += ' ';\n\t\t\t// str += jsToCss(prop);\n\t\t\tstr +=\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(/([A-Z])/g, '-$1').toLowerCase());\n\t\t\tstr += ': ';\n\t\t\tstr += val;\n\t\t\tif (typeof val === 'number' && IS_NON_DIMENSIONAL.test(prop) === false) {\n\t\t\t\tstr += 'px';\n\t\t\t}\n\t\t\tstr += ';';\n\t\t}\n\t}\n\treturn str || undefined;\n}\n\n/**\n * Copy all properties from `props` onto `obj`.\n * @param {object} obj Object onto which properties should be copied.\n * @param {object} props Object from which to copy properties.\n * @returns {object}\n * @private\n */\nexport function assign(obj, props) {\n\tfor (let i in props) obj[i] = props[i];\n\treturn obj;\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","import {\n\tencodeEntities,\n\tindent,\n\tisLargeString,\n\tstyleObjToCss,\n\tassign,\n\tgetChildren\n} from './util';\nimport { options, Fragment } from 'preact';\n\n/** @typedef {import('preact').VNode} VNode */\n\nconst SHALLOW = { shallow: true };\n\n// components without names, kept as a hash for later comparison to return consistent UnnamedComponentXX names.\nconst UNNAMED = [];\n\nconst VOID_ELEMENTS =\n\t/^(area|base|br|col|embed|hr|img|input|link|meta|param|source|track|wbr)$/;\n\nconst UNSAFE_NAME = /[\\s\\n\\\\/='\"\\0<>]/;\n\nconst noop = () => {};\n\n/** Render Preact JSX + Components to an HTML string.\n *\t@name render\n *\t@function\n *\t@param {VNode} vnode\tJSX VNode to render.\n *\t@param {Object} [context={}]\tOptionally pass an initial context object through the render path.\n *\t@param {Object} [options={}]\tRendering options\n *\t@param {Boolean} [options.shallow=false]\tIf `true`, renders nested Components as HTML elements (`<Foo a=\"b\" />`).\n *\t@param {Boolean} [options.xml=false]\t\tIf `true`, uses self-closing tags for elements without children.\n *\t@param {Boolean} [options.pretty=false]\t\tIf `true`, adds whitespace for readability\n *\t@param {RegExp|undefined} [options.voidElements] RegeEx that matches elements that are considered void (self-closing)\n */\nrenderToString.render = renderToString;\n\n/** Only render elements, leaving Components inline as `<ComponentName ... />`.\n *\tThis method is just a convenience alias for `render(vnode, context, { shallow:true })`\n *\t@name shallow\n *\t@function\n *\t@param {VNode} vnode\tJSX VNode to render.\n *\t@param {Object} [context={}]\tOptionally pass an initial context object through the render path.\n */\nlet shallowRender = (vnode, context) => renderToString(vnode, context, SHALLOW);\n\nconst EMPTY_ARR = [];\nfunction renderToString(vnode, context, opts) {\n\tcontext = context || {};\n\topts = opts || {};\n\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.__s;\n\toptions.__s = true;\n\n\tconst res = _renderToString(vnode, context, opts);\n\n\t// options._commit, we don't schedule any effects in this library right now,\n\t// so we can pass an empty queue to this hook.\n\tif (options.__c) options.__c(vnode, EMPTY_ARR);\n\tEMPTY_ARR.length = 0;\n\toptions.__s = previousSkipEffects;\n\treturn res;\n}\n\n/** The default export is an alias of `render()`. */\nfunction _renderToString(vnode, context, opts, inner, isSvgMode, selectValue) {\n\tif (vnode == null || typeof vnode === 'boolean') {\n\t\treturn '';\n\t}\n\n\t// #text nodes\n\tif (typeof vnode !== 'object') {\n\t\treturn encodeEntities(vnode);\n\t}\n\n\tlet pretty = opts.pretty,\n\t\tindentChar = pretty && typeof pretty === 'string' ? pretty : '\\t';\n\n\tif (Array.isArray(vnode)) {\n\t\tlet rendered = '';\n\t\tfor (let i = 0; i < vnode.length; i++) {\n\t\t\tif (pretty && i > 0) rendered += '\\n';\n\t\t\trendered += _renderToString(\n\t\t\t\tvnode[i],\n\t\t\t\tcontext,\n\t\t\t\topts,\n\t\t\t\tinner,\n\t\t\t\tisSvgMode,\n\t\t\t\tselectValue\n\t\t\t);\n\t\t}\n\t\treturn rendered;\n\t}\n\n\tlet nodeName = vnode.type,\n\t\tprops = vnode.props,\n\t\tisComponent = false;\n\n\t// components\n\tif (typeof nodeName === 'function') {\n\t\tisComponent = true;\n\t\tif (opts.shallow && (inner || opts.renderRootComponent === false)) {\n\t\t\tnodeName = getComponentName(nodeName);\n\t\t} else if (nodeName === Fragment) {\n\t\t\tconst children = [];\n\t\t\tgetChildren(children, vnode.props.children);\n\t\t\treturn _renderToString(\n\t\t\t\tchildren,\n\t\t\t\tcontext,\n\t\t\t\topts,\n\t\t\t\topts.shallowHighOrder !== false,\n\t\t\t\tisSvgMode,\n\t\t\t\tselectValue\n\t\t\t);\n\t\t} else {\n\t\t\tlet rendered;\n\n\t\t\tlet c = (vnode.__c = {\n\t\t\t\t__v: vnode,\n\t\t\t\tcontext,\n\t\t\t\tprops: vnode.props,\n\t\t\t\t// silently drop state updates\n\t\t\t\tsetState: noop,\n\t\t\t\tforceUpdate: noop,\n\t\t\t\t// hooks\n\t\t\t\t__h: []\n\t\t\t});\n\n\t\t\t// options._diff\n\t\t\tif (options.__b) options.__b(vnode);\n\n\t\t\t// options._render\n\t\t\tif (options.__r) options.__r(vnode);\n\n\t\t\tif (\n\t\t\t\t!nodeName.prototype ||\n\t\t\t\ttypeof nodeName.prototype.render !== 'function'\n\t\t\t) {\n\t\t\t\t// Necessary for createContext api. Setting this property will pass\n\t\t\t\t// the context value as `this.context` just for this component.\n\t\t\t\tlet cxType = nodeName.contextType;\n\t\t\t\tlet provider = cxType && context[cxType.__c];\n\t\t\t\tlet cctx =\n\t\t\t\t\tcxType != null\n\t\t\t\t\t\t? provider\n\t\t\t\t\t\t\t? provider.props.value\n\t\t\t\t\t\t\t: cxType.__\n\t\t\t\t\t\t: context;\n\n\t\t\t\t// stateless functional components\n\t\t\t\trendered = nodeName.call(vnode.__c, props, cctx);\n\t\t\t} else {\n\t\t\t\t// class-based components\n\t\t\t\tlet cxType = nodeName.contextType;\n\t\t\t\tlet provider = cxType && context[cxType.__c];\n\t\t\t\tlet cctx =\n\t\t\t\t\tcxType != null\n\t\t\t\t\t\t? provider\n\t\t\t\t\t\t\t? provider.props.value\n\t\t\t\t\t\t\t: cxType.__\n\t\t\t\t\t\t: context;\n\n\t\t\t\t// c = new nodeName(props, context);\n\t\t\t\tc = vnode.__c = new nodeName(props, cctx);\n\t\t\t\tc.__v = vnode;\n\t\t\t\t// turn off stateful re-rendering:\n\t\t\t\tc._dirty = c.__d = true;\n\t\t\t\tc.props = props;\n\t\t\t\tif (c.state == null) c.state = {};\n\n\t\t\t\tif (c._nextState == null && c.__s == null) {\n\t\t\t\t\tc._nextState = c.__s = c.state;\n\t\t\t\t}\n\n\t\t\t\tc.context = cctx;\n\t\t\t\tif (nodeName.getDerivedStateFromProps)\n\t\t\t\t\tc.state = assign(\n\t\t\t\t\t\tassign({}, c.state),\n\t\t\t\t\t\tnodeName.getDerivedStateFromProps(c.props, c.state)\n\t\t\t\t\t);\n\t\t\t\telse if (c.componentWillMount) {\n\t\t\t\t\tc.componentWillMount();\n\n\t\t\t\t\t// If the user called setState in cWM we need to flush pending,\n\t\t\t\t\t// state updates. This is the same behaviour in React.\n\t\t\t\t\tc.state =\n\t\t\t\t\t\tc._nextState !== c.state\n\t\t\t\t\t\t\t? c._nextState\n\t\t\t\t\t\t\t: c.__s !== c.state\n\t\t\t\t\t\t\t? c.__s\n\t\t\t\t\t\t\t: c.state;\n\t\t\t\t}\n\n\t\t\t\trendered = c.render(c.props, c.state, c.context);\n\t\t\t}\n\n\t\t\tif (c.getChildContext) {\n\t\t\t\tcontext = assign(assign({}, context), c.getChildContext());\n\t\t\t}\n\n\t\t\tif (options.diffed) options.diffed(vnode);\n\t\t\treturn _renderToString(\n\t\t\t\trendered,\n\t\t\t\tcontext,\n\t\t\t\topts,\n\t\t\t\topts.shallowHighOrder !== false,\n\t\t\t\tisSvgMode,\n\t\t\t\tselectValue\n\t\t\t);\n\t\t}\n\t}\n\n\t// render JSX to HTML\n\tlet s = '<' + nodeName,\n\t\tpropChildren,\n\t\thtml;\n\n\tif (props) {\n\t\tlet attrs = Object.keys(props);\n\n\t\t// allow sorting lexicographically for more determinism (useful for tests, such as via preact-jsx-chai)\n\t\tif (opts && opts.sortAttributes === true) attrs.sort();\n\n\t\tfor (let i = 0; i < attrs.length; i++) {\n\t\t\tlet name = attrs[i],\n\t\t\t\tv = props[name];\n\t\t\tif (name === 'children') {\n\t\t\t\tpropChildren = v;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (UNSAFE_NAME.test(name)) continue;\n\n\t\t\tif (\n\t\t\t\t!(opts && opts.allAttributes) &&\n\t\t\t\t(name === 'key' ||\n\t\t\t\t\tname === 'ref' ||\n\t\t\t\t\tname === '__self' ||\n\t\t\t\t\tname === '__source')\n\t\t\t)\n\t\t\t\tcontinue;\n\n\t\t\tif (name === 'defaultValue') {\n\t\t\t\tname = 'value';\n\t\t\t} else if (name === 'className') {\n\t\t\t\tif (typeof props.class !== 'undefined') continue;\n\t\t\t\tname = 'class';\n\t\t\t} else if (isSvgMode && name.match(/^xlink:?./)) {\n\t\t\t\tname = name.toLowerCase().replace(/^xlink:?/, 'xlink:');\n\t\t\t}\n\n\t\t\tif (name === 'htmlFor') {\n\t\t\t\tif (props.for) continue;\n\t\t\t\tname = 'for';\n\t\t\t}\n\n\t\t\tif (name === 'style' && v && typeof v === 'object') {\n\t\t\t\tv = styleObjToCss(v);\n\t\t\t}\n\n\t\t\t// always use string values instead of booleans for aria attributes\n\t\t\t// also see https://github.com/preactjs/preact/pull/2347/files\n\t\t\tif (name[0] === 'a' && name['1'] === 'r' && typeof v === 'boolean') {\n\t\t\t\tv = String(v);\n\t\t\t}\n\n\t\t\tlet hooked =\n\t\t\t\topts.attributeHook &&\n\t\t\t\topts.attributeHook(name, v, context, opts, isComponent);\n\t\t\tif (hooked || hooked === '') {\n\t\t\t\ts += hooked;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (name === 'dangerouslySetInnerHTML') {\n\t\t\t\thtml = v && v.__html;\n\t\t\t} else if (nodeName === 'textarea' && name === 'value') {\n\t\t\t\t// <textarea value=\"a&b\"> --> <textarea>a&amp;b</textarea>\n\t\t\t\tpropChildren = v;\n\t\t\t} else if ((v || v === 0 || v === '') && typeof v !== 'function') {\n\t\t\t\tif (v === true || v === '') {\n\t\t\t\t\tv = name;\n\t\t\t\t\t// in non-xml mode, allow boolean attributes\n\t\t\t\t\tif (!opts || !opts.xml) {\n\t\t\t\t\t\ts += ' ' + name;\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (name === 'value') {\n\t\t\t\t\tif (nodeName === 'select') {\n\t\t\t\t\t\tselectValue = v;\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t} else if (nodeName === 'option' && selectValue == v) {\n\t\t\t\t\t\ts += ` selected`;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\ts += ` ${name}=\"${encodeEntities(v)}\"`;\n\t\t\t}\n\t\t}\n\t}\n\n\t// account for >1 multiline attribute\n\tif (pretty) {\n\t\tlet sub = s.replace(/\\n\\s*/, ' ');\n\t\tif (sub !== s && !~sub.indexOf('\\n')) s = sub;\n\t\telse if (pretty && ~s.indexOf('\\n')) s += '\\n';\n\t}\n\n\ts += '>';\n\n\tif (UNSAFE_NAME.test(nodeName))\n\t\tthrow new Error(`${nodeName} is not a valid HTML tag name in ${s}`);\n\n\tlet isVoid =\n\t\tVOID_ELEMENTS.test(nodeName) ||\n\t\t(opts.voidElements && opts.voidElements.test(nodeName));\n\tlet pieces = [];\n\n\tlet children;\n\tif (html) {\n\t\t// if multiline, indent.\n\t\tif (pretty && isLargeString(html)) {\n\t\t\thtml = '\\n' + indentChar + indent(html, indentChar);\n\t\t}\n\t\ts += html;\n\t} else if (\n\t\tpropChildren != null &&\n\t\tgetChildren((children = []), propChildren).length\n\t) {\n\t\tlet hasLarge = pretty && ~s.indexOf('\\n');\n\t\tlet lastWasText = false;\n\n\t\tfor (let i = 0; i < children.length; i++) {\n\t\t\tlet child = children[i];\n\n\t\t\tif (child != null && child !== false) {\n\t\t\t\tlet childSvgMode =\n\t\t\t\t\t\tnodeName === 'svg'\n\t\t\t\t\t\t\t? true\n\t\t\t\t\t\t\t: nodeName === 'foreignObject'\n\t\t\t\t\t\t\t? false\n\t\t\t\t\t\t\t: isSvgMode,\n\t\t\t\t\tret = _renderToString(\n\t\t\t\t\t\tchild,\n\t\t\t\t\t\tcontext,\n\t\t\t\t\t\topts,\n\t\t\t\t\t\ttrue,\n\t\t\t\t\t\tchildSvgMode,\n\t\t\t\t\t\tselectValue\n\t\t\t\t\t);\n\n\t\t\t\tif (pretty && !hasLarge && isLargeString(ret)) hasLarge = true;\n\n\t\t\t\t// Skip if we received an empty string\n\t\t\t\tif (ret) {\n\t\t\t\t\tif (pretty) {\n\t\t\t\t\t\tlet isText = ret.length > 0 && ret[0] != '<';\n\n\t\t\t\t\t\t// We merge adjacent text nodes, otherwise each piece would be printed\n\t\t\t\t\t\t// on a new line.\n\t\t\t\t\t\tif (lastWasText && isText) {\n\t\t\t\t\t\t\tpieces[pieces.length - 1] += ret;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tpieces.push(ret);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tlastWasText = isText;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tpieces.push(ret);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (pretty && hasLarge) {\n\t\t\tfor (let i = pieces.length; i--; ) {\n\t\t\t\tpieces[i] = '\\n' + indentChar + indent(pieces[i], indentChar);\n\t\t\t}\n\t\t}\n\t}\n\n\tif (pieces.length || html) {\n\t\ts += pieces.join('');\n\t} else if (opts && opts.xml) {\n\t\treturn s.substring(0, s.length - 1) + ' />';\n\t}\n\n\tif (isVoid && !children && !html) {\n\t\ts = s.replace(/>$/, ' />');\n\t} else {\n\t\tif (pretty && ~s.indexOf('\\n')) s += '\\n';\n\t\ts += `</${nodeName}>`;\n\t}\n\n\treturn s;\n}\n\nfunction getComponentName(component) {\n\treturn (\n\t\tcomponent.displayName ||\n\t\t(component !== Function && component.name) ||\n\t\tgetFallbackComponentName(component)\n\t);\n}\n\nfunction getFallbackComponentName(component) {\n\tlet str = Function.prototype.toString.call(component),\n\t\tname = (str.match(/^\\s*function\\s+([^( ]+)/) || '')[1];\n\tif (!name) {\n\t\t// search for an existing indexed name for the given component:\n\t\tlet index = -1;\n\t\tfor (let i = UNNAMED.length; i--; ) {\n\t\t\tif (UNNAMED[i] === component) {\n\t\t\t\tindex = i;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t// not found, create a new indexed name:\n\t\tif (index < 0) {\n\t\t\tindex = UNNAMED.push(component) - 1;\n\t\t}\n\t\tname = `UnnamedComponent${index}`;\n\t}\n\treturn name;\n}\nrenderToString.shallowRender = shallowRender;\n\nexport default renderToString;\n\nexport {\n\trenderToString as render,\n\trenderToString as renderToStaticMarkup,\n\trenderToString,\n\tshallowRender\n};\n"],"names":["IS_NON_DIMENSIONAL","ENCODED_ENTITIES","encodeEntities","input","s","String","test","replace","indent","char","isLargeString","length","ignoreLines","indexOf","JS_TO_CSS","styleObjToCss","str","prop","val","toLowerCase","undefined","assign","obj","props","i","getChildren","accumulator","children","Array","isArray","reduce","push","SHALLOW","shallow","UNNAMED","VOID_ELEMENTS","UNSAFE_NAME","noop","renderToString","render","shallowRender","vnode","context","EMPTY_ARR","opts","previousSkipEffects","options","__s","res","_renderToString","__c","inner","isSvgMode","selectValue","pretty","indentChar","rendered","component","nodeName","type","isComponent","renderRootComponent","Fragment","shallowHighOrder","c","__v","setState","forceUpdate","__h","__b","__r","prototype","cxType","contextType","provider","cctx","value","__","_dirty","__d","state","_nextState","getDerivedStateFromProps","componentWillMount","call","getChildContext","diffed","displayName","Function","name","toString","match","index","getFallbackComponentName","propChildren","html","attrs","Object","keys","sortAttributes","sort","v","allAttributes","hooked","attributeHook","__html","xml","sub","Error","isVoid","voidElements","pieces","hasLarge","lastWasText","child","ret","isText","join","substring"],"mappings":"mDACaA,EAAqB,kEAE5BC,EAAmB,kBAETC,EAAeC,GAC9B,IAAMC,EAAIC,OAAOF,GACjB,OAAKF,EAAiBK,KAAKF,GAGpBA,EACLG,QAAQ,KAAM,SACdA,QAAQ,KAAM,QACdA,QAAQ,KAAM,QACdA,QAAQ,KAAM,UANRH,MASEI,EAAS,SAACJ,EAAGK,UACvBJ,OAAOD,GAAGG,QAAQ,SAAU,MAAQE,GAAQ,QAElCC,EAAgB,SAACN,EAAGO,EAAQC,UACtCP,OAAOD,GAAGO,QAAUA,GAAU,MAC5BC,IAA4C,IAA7BP,OAAOD,GAAGS,QAAQ,QACP,IAA5BR,OAAOD,GAAGS,QAAQ,MAEbC,EAAY,YAGFC,EAAcX,GAC7B,IAAIY,EAAM,GACV,IAAK,IAAIC,KAAQb,EAAG,CACnB,IAAIc,EAAMd,EAAEa,GACD,MAAPC,GAAuB,KAARA,IACdF,IAAKA,GAAO,KAEhBA,GACY,KAAXC,EAAK,GACFA,EACAH,EAAUG,KACTH,EAAUG,GAAQA,EAAKV,QAAQ,WAAY,OAAOY,eACvDH,GAAO,KACPA,GAAOE,EACY,iBAARA,IAAsD,IAAlClB,EAAmBM,KAAKW,KACtDD,GAAO,MAERA,GAAO,KAGT,OAAOA,QAAOI,WAUCC,EAAOC,EAAKC,GAC3B,IAAK,IAAIC,KAAKD,EAAOD,EAAIE,GAAKD,EAAMC,GACpC,OAAOF,WAUQG,EAAYC,EAAaC,GAMxC,OALIC,MAAMC,QAAQF,GACjBA,EAASG,OAAOL,EAAaC,GACP,MAAZC,IAAiC,IAAbA,GAC9BD,EAAYK,KAAKJ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AES,QAAQ,MAChCoG,GAAc,EAETzF,EAAI,EAAGA,EAAIG,EAAShB,OAAQa,IAAK,CACzC,IAAI0F,EAAQvF,EAASH,GAErB,GAAa,MAAT0F,IAA2B,IAAVA,EAAiB,CACrC,IAMCC,EAAMlE,EACLiE,EACAxE,EACAE,GACA,EATa,QAAbc,GAEgB,kBAAbA,GAEAN,EAOHC,GAMF,GAHIC,IAAW0D,GAAYtG,EAAcyG,KAAMH,GAAW,GAGtDG,EACH,GAAI7D,EAAQ,CACX,IAAI8D,EAASD,EAAIxG,OAAS,GAAe,KAAVwG,EAAI,GAI/BF,GAAeG,EAClBL,EAAOA,EAAOpG,OAAS,IAAMwG,EAE7BJ,EAAOhF,KAAKoF,GAGbF,EAAcG,OAEdL,EAAOhF,KAAKoF,IAKhB,GAAI7D,GAAU0D,EACb,IAAK,IAAIxF,EAAIuF,EAAOpG,OAAQa,KAC3BuF,EAAOvF,GAAK,KAAO+B,EAAa/C,EAAOuG,EAAOvF,GAAI+B,GAKrD,GAAIwD,EAAOpG,QAAUoF,EACpB3F,GAAK2G,EAAOM,KAAK,YACPzE,GAAQA,EAAK8D,IACvB,OAAOtG,EAAEkH,UAAU,EAAGlH,EAAEO,OAAS,GAAK,MAUvC,OAPIkG,GAAWlF,GAAaoE,GAGvBzC,IAAWlD,EAAES,QAAQ,QAAOT,GAAK,MACrCA,QAAUsD,OAHVtD,EAAIA,EAAEG,QAAQ,KAAM,OAMdH,EA+BRkC,EAAeE,cAAgBA"}
1
+ {"version":3,"file":"index.module.js","sources":["../src/util.js","../src/index.js"],"sourcesContent":["// DOM properties that should NOT have \"px\" added when numeric\nexport const IS_NON_DIMENSIONAL = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|^--/i;\n\nconst ENCODED_ENTITIES = /[&<>\"]/;\n\nexport function encodeEntities(input) {\n\tconst s = String(input);\n\tif (!ENCODED_ENTITIES.test(s)) {\n\t\treturn s;\n\t}\n\treturn s\n\t\t.replace(/&/g, '&amp;')\n\t\t.replace(/</g, '&lt;')\n\t\t.replace(/>/g, '&gt;')\n\t\t.replace(/\"/g, '&quot;');\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\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\tif (str) str += ' ';\n\t\t\t// str += jsToCss(prop);\n\t\t\tstr +=\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(/([A-Z])/g, '-$1').toLowerCase());\n\t\t\tstr += ': ';\n\t\t\tstr += val;\n\t\t\tif (typeof val === 'number' && IS_NON_DIMENSIONAL.test(prop) === false) {\n\t\t\t\tstr += 'px';\n\t\t\t}\n\t\t\tstr += ';';\n\t\t}\n\t}\n\treturn str || undefined;\n}\n\n/**\n * Copy all properties from `props` onto `obj`.\n * @param {object} obj Object onto which properties should be copied.\n * @param {object} props Object from which to copy properties.\n * @returns {object}\n * @private\n */\nexport function assign(obj, props) {\n\tfor (let i in props) obj[i] = props[i];\n\treturn obj;\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","import {\n\tencodeEntities,\n\tindent,\n\tisLargeString,\n\tstyleObjToCss,\n\tassign,\n\tgetChildren\n} from './util';\nimport { options, Fragment } from 'preact';\n\n/** @typedef {import('preact').VNode} VNode */\n\nconst SHALLOW = { shallow: true };\n\n// components without names, kept as a hash for later comparison to return consistent UnnamedComponentXX names.\nconst UNNAMED = [];\n\nconst VOID_ELEMENTS = /^(area|base|br|col|embed|hr|img|input|link|meta|param|source|track|wbr)$/;\n\nconst UNSAFE_NAME = /[\\s\\n\\\\/='\"\\0<>]/;\n\nfunction markAsDirty() {\n\tthis.__d = true;\n}\n\n/** Render Preact JSX + Components to an HTML string.\n *\t@name render\n *\t@function\n *\t@param {VNode} vnode\tJSX VNode to render.\n *\t@param {Object} [context={}]\tOptionally pass an initial context object through the render path.\n *\t@param {Object} [options={}]\tRendering options\n *\t@param {Boolean} [options.shallow=false]\tIf `true`, renders nested Components as HTML elements (`<Foo a=\"b\" />`).\n *\t@param {Boolean} [options.xml=false]\t\tIf `true`, uses self-closing tags for elements without children.\n *\t@param {Boolean} [options.pretty=false]\t\tIf `true`, adds whitespace for readability\n *\t@param {RegExp|undefined} [options.voidElements] RegeEx that matches elements that are considered void (self-closing)\n */\nrenderToString.render = renderToString;\n\n/** Only render elements, leaving Components inline as `<ComponentName ... />`.\n *\tThis method is just a convenience alias for `render(vnode, context, { shallow:true })`\n *\t@name shallow\n *\t@function\n *\t@param {VNode} vnode\tJSX VNode to render.\n *\t@param {Object} [context={}]\tOptionally pass an initial context object through the render path.\n */\nlet shallowRender = (vnode, context) => renderToString(vnode, context, SHALLOW);\n\nconst EMPTY_ARR = [];\nfunction renderToString(vnode, context, opts) {\n\tcontext = context || {};\n\topts = opts || {};\n\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.__s;\n\toptions.__s = true;\n\n\tconst res = _renderToString(vnode, context, opts);\n\n\t// options._commit, we don't schedule any effects in this library right now,\n\t// so we can pass an empty queue to this hook.\n\tif (options.__c) options.__c(vnode, EMPTY_ARR);\n\tEMPTY_ARR.length = 0;\n\toptions.__s = previousSkipEffects;\n\treturn res;\n}\n\n/** The default export is an alias of `render()`. */\nfunction _renderToString(vnode, context, opts, inner, isSvgMode, selectValue) {\n\tif (vnode == null || typeof vnode === 'boolean') {\n\t\treturn '';\n\t}\n\n\t// #text nodes\n\tif (typeof vnode !== 'object') {\n\t\treturn encodeEntities(vnode);\n\t}\n\n\tlet pretty = opts.pretty,\n\t\tindentChar = pretty && typeof pretty === 'string' ? pretty : '\\t';\n\n\tif (Array.isArray(vnode)) {\n\t\tlet rendered = '';\n\t\tfor (let i = 0; i < vnode.length; i++) {\n\t\t\tif (pretty && i > 0) rendered += '\\n';\n\t\t\trendered += _renderToString(\n\t\t\t\tvnode[i],\n\t\t\t\tcontext,\n\t\t\t\topts,\n\t\t\t\tinner,\n\t\t\t\tisSvgMode,\n\t\t\t\tselectValue\n\t\t\t);\n\t\t}\n\t\treturn rendered;\n\t}\n\n\tlet nodeName = vnode.type,\n\t\tprops = vnode.props,\n\t\tisComponent = false;\n\n\t// components\n\tif (typeof nodeName === 'function') {\n\t\tisComponent = true;\n\t\tif (opts.shallow && (inner || opts.renderRootComponent === false)) {\n\t\t\tnodeName = getComponentName(nodeName);\n\t\t} else if (nodeName === Fragment) {\n\t\t\tconst children = [];\n\t\t\tgetChildren(children, vnode.props.children);\n\t\t\treturn _renderToString(\n\t\t\t\tchildren,\n\t\t\t\tcontext,\n\t\t\t\topts,\n\t\t\t\topts.shallowHighOrder !== false,\n\t\t\t\tisSvgMode,\n\t\t\t\tselectValue\n\t\t\t);\n\t\t} else {\n\t\t\tlet rendered;\n\n\t\t\tlet c = (vnode.__c = {\n\t\t\t\t__v: vnode,\n\t\t\t\tcontext,\n\t\t\t\tprops: vnode.props,\n\t\t\t\t// silently drop state updates\n\t\t\t\tsetState: markAsDirty,\n\t\t\t\tforceUpdate: markAsDirty,\n\t\t\t\t__d: true,\n\t\t\t\t// hooks\n\t\t\t\t__h: []\n\t\t\t});\n\n\t\t\t// options._diff\n\t\t\tif (options.__b) options.__b(vnode);\n\n\t\t\t// options._render\n\t\t\tlet renderHook = options.__r;\n\n\t\t\tif (\n\t\t\t\t!nodeName.prototype ||\n\t\t\t\ttypeof nodeName.prototype.render !== 'function'\n\t\t\t) {\n\t\t\t\t// Necessary for createContext api. Setting this property will pass\n\t\t\t\t// the context value as `this.context` just for this component.\n\t\t\t\tlet cxType = nodeName.contextType;\n\t\t\t\tlet provider = cxType && context[cxType.__c];\n\t\t\t\tlet cctx =\n\t\t\t\t\tcxType != null\n\t\t\t\t\t\t? provider\n\t\t\t\t\t\t\t? provider.props.value\n\t\t\t\t\t\t\t: cxType.__\n\t\t\t\t\t\t: context;\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 (c.__d && count++ < 25) {\n\t\t\t\t\tc.__d = false;\n\n\t\t\t\t\tif (renderHook) renderHook(vnode);\n\n\t\t\t\t\t// stateless functional components\n\t\t\t\t\trendered = nodeName.call(vnode.__c, props, cctx);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// class-based components\n\t\t\t\tlet cxType = nodeName.contextType;\n\t\t\t\tlet provider = cxType && context[cxType.__c];\n\t\t\t\tlet cctx =\n\t\t\t\t\tcxType != null\n\t\t\t\t\t\t? provider\n\t\t\t\t\t\t\t? provider.props.value\n\t\t\t\t\t\t\t: cxType.__\n\t\t\t\t\t\t: context;\n\n\t\t\t\t// c = new nodeName(props, context);\n\t\t\t\tc = vnode.__c = new nodeName(props, cctx);\n\t\t\t\tc.__v = vnode;\n\t\t\t\t// turn off stateful re-rendering:\n\t\t\t\tc._dirty = c.__d = true;\n\t\t\t\tc.props = props;\n\t\t\t\tif (c.state == null) c.state = {};\n\n\t\t\t\tif (c._nextState == null && c.__s == null) {\n\t\t\t\t\tc._nextState = c.__s = c.state;\n\t\t\t\t}\n\n\t\t\t\tc.context = cctx;\n\t\t\t\tif (nodeName.getDerivedStateFromProps)\n\t\t\t\t\tc.state = assign(\n\t\t\t\t\t\tassign({}, c.state),\n\t\t\t\t\t\tnodeName.getDerivedStateFromProps(c.props, c.state)\n\t\t\t\t\t);\n\t\t\t\telse if (c.componentWillMount) {\n\t\t\t\t\tc.componentWillMount();\n\n\t\t\t\t\t// If the user called setState in cWM we need to flush pending,\n\t\t\t\t\t// state updates. This is the same behaviour in React.\n\t\t\t\t\tc.state =\n\t\t\t\t\t\tc._nextState !== c.state\n\t\t\t\t\t\t\t? c._nextState\n\t\t\t\t\t\t\t: c.__s !== c.state\n\t\t\t\t\t\t\t? c.__s\n\t\t\t\t\t\t\t: c.state;\n\t\t\t\t}\n\n\t\t\t\tif (renderHook) renderHook(vnode);\n\n\t\t\t\trendered = c.render(c.props, c.state, c.context);\n\t\t\t}\n\n\t\t\tif (c.getChildContext) {\n\t\t\t\tcontext = assign(assign({}, context), c.getChildContext());\n\t\t\t}\n\n\t\t\tif (options.diffed) options.diffed(vnode);\n\t\t\treturn _renderToString(\n\t\t\t\trendered,\n\t\t\t\tcontext,\n\t\t\t\topts,\n\t\t\t\topts.shallowHighOrder !== false,\n\t\t\t\tisSvgMode,\n\t\t\t\tselectValue\n\t\t\t);\n\t\t}\n\t}\n\n\t// render JSX to HTML\n\tlet s = '<' + nodeName,\n\t\tpropChildren,\n\t\thtml;\n\n\tif (props) {\n\t\tlet attrs = Object.keys(props);\n\n\t\t// allow sorting lexicographically for more determinism (useful for tests, such as via preact-jsx-chai)\n\t\tif (opts && opts.sortAttributes === true) attrs.sort();\n\n\t\tfor (let i = 0; i < attrs.length; i++) {\n\t\t\tlet name = attrs[i],\n\t\t\t\tv = props[name];\n\t\t\tif (name === 'children') {\n\t\t\t\tpropChildren = v;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (UNSAFE_NAME.test(name)) continue;\n\n\t\t\tif (\n\t\t\t\t!(opts && opts.allAttributes) &&\n\t\t\t\t(name === 'key' ||\n\t\t\t\t\tname === 'ref' ||\n\t\t\t\t\tname === '__self' ||\n\t\t\t\t\tname === '__source')\n\t\t\t)\n\t\t\t\tcontinue;\n\n\t\t\tif (name === 'defaultValue') {\n\t\t\t\tname = 'value';\n\t\t\t} else if (name === 'className') {\n\t\t\t\tif (typeof props.class !== 'undefined') continue;\n\t\t\t\tname = 'class';\n\t\t\t} else if (isSvgMode && name.match(/^xlink:?./)) {\n\t\t\t\tname = name.toLowerCase().replace(/^xlink:?/, 'xlink:');\n\t\t\t}\n\n\t\t\tif (name === 'htmlFor') {\n\t\t\t\tif (props.for) continue;\n\t\t\t\tname = 'for';\n\t\t\t}\n\n\t\t\tif (name === 'style' && v && typeof v === 'object') {\n\t\t\t\tv = styleObjToCss(v);\n\t\t\t}\n\n\t\t\t// always use string values instead of booleans for aria attributes\n\t\t\t// also see https://github.com/preactjs/preact/pull/2347/files\n\t\t\tif (name[0] === 'a' && name['1'] === 'r' && typeof v === 'boolean') {\n\t\t\t\tv = String(v);\n\t\t\t}\n\n\t\t\tlet hooked =\n\t\t\t\topts.attributeHook &&\n\t\t\t\topts.attributeHook(name, v, context, opts, isComponent);\n\t\t\tif (hooked || hooked === '') {\n\t\t\t\ts += hooked;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (name === 'dangerouslySetInnerHTML') {\n\t\t\t\thtml = v && v.__html;\n\t\t\t} else if (nodeName === 'textarea' && name === 'value') {\n\t\t\t\t// <textarea value=\"a&b\"> --> <textarea>a&amp;b</textarea>\n\t\t\t\tpropChildren = v;\n\t\t\t} else if ((v || v === 0 || v === '') && typeof v !== 'function') {\n\t\t\t\tif (v === true || v === '') {\n\t\t\t\t\tv = name;\n\t\t\t\t\t// in non-xml mode, allow boolean attributes\n\t\t\t\t\tif (!opts || !opts.xml) {\n\t\t\t\t\t\ts += ' ' + name;\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (name === 'value') {\n\t\t\t\t\tif (nodeName === 'select') {\n\t\t\t\t\t\tselectValue = v;\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t} else if (\n\t\t\t\t\t\t// If we're looking at an <option> and it's the currently selected one\n\t\t\t\t\t\tnodeName === 'option' &&\n\t\t\t\t\t\tselectValue == v &&\n\t\t\t\t\t\t// and the <option> doesn't already have a selected attribute on it\n\t\t\t\t\t\ttypeof props.selected === 'undefined'\n\t\t\t\t\t) {\n\t\t\t\t\t\ts += ` selected`;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\ts += ` ${name}=\"${encodeEntities(v)}\"`;\n\t\t\t}\n\t\t}\n\t}\n\n\t// account for >1 multiline attribute\n\tif (pretty) {\n\t\tlet sub = s.replace(/\\n\\s*/, ' ');\n\t\tif (sub !== s && !~sub.indexOf('\\n')) s = sub;\n\t\telse if (pretty && ~s.indexOf('\\n')) s += '\\n';\n\t}\n\n\ts += '>';\n\n\tif (UNSAFE_NAME.test(nodeName))\n\t\tthrow new Error(`${nodeName} is not a valid HTML tag name in ${s}`);\n\n\tlet isVoid =\n\t\tVOID_ELEMENTS.test(nodeName) ||\n\t\t(opts.voidElements && opts.voidElements.test(nodeName));\n\tlet pieces = [];\n\n\tlet children;\n\tif (html) {\n\t\t// if multiline, indent.\n\t\tif (pretty && isLargeString(html)) {\n\t\t\thtml = '\\n' + indentChar + indent(html, indentChar);\n\t\t}\n\t\ts += html;\n\t} else if (\n\t\tpropChildren != null &&\n\t\tgetChildren((children = []), propChildren).length\n\t) {\n\t\tlet hasLarge = pretty && ~s.indexOf('\\n');\n\t\tlet lastWasText = false;\n\n\t\tfor (let i = 0; i < children.length; i++) {\n\t\t\tlet child = children[i];\n\n\t\t\tif (child != null && child !== false) {\n\t\t\t\tlet childSvgMode =\n\t\t\t\t\t\tnodeName === 'svg'\n\t\t\t\t\t\t\t? true\n\t\t\t\t\t\t\t: nodeName === 'foreignObject'\n\t\t\t\t\t\t\t? false\n\t\t\t\t\t\t\t: isSvgMode,\n\t\t\t\t\tret = _renderToString(\n\t\t\t\t\t\tchild,\n\t\t\t\t\t\tcontext,\n\t\t\t\t\t\topts,\n\t\t\t\t\t\ttrue,\n\t\t\t\t\t\tchildSvgMode,\n\t\t\t\t\t\tselectValue\n\t\t\t\t\t);\n\n\t\t\t\tif (pretty && !hasLarge && isLargeString(ret)) hasLarge = true;\n\n\t\t\t\t// Skip if we received an empty string\n\t\t\t\tif (ret) {\n\t\t\t\t\tif (pretty) {\n\t\t\t\t\t\tlet isText = ret.length > 0 && ret[0] != '<';\n\n\t\t\t\t\t\t// We merge adjacent text nodes, otherwise each piece would be printed\n\t\t\t\t\t\t// on a new line.\n\t\t\t\t\t\tif (lastWasText && isText) {\n\t\t\t\t\t\t\tpieces[pieces.length - 1] += ret;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tpieces.push(ret);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tlastWasText = isText;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tpieces.push(ret);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (pretty && hasLarge) {\n\t\t\tfor (let i = pieces.length; i--; ) {\n\t\t\t\tpieces[i] = '\\n' + indentChar + indent(pieces[i], indentChar);\n\t\t\t}\n\t\t}\n\t}\n\n\tif (pieces.length || html) {\n\t\ts += pieces.join('');\n\t} else if (opts && opts.xml) {\n\t\treturn s.substring(0, s.length - 1) + ' />';\n\t}\n\n\tif (isVoid && !children && !html) {\n\t\ts = s.replace(/>$/, ' />');\n\t} else {\n\t\tif (pretty && ~s.indexOf('\\n')) s += '\\n';\n\t\ts += `</${nodeName}>`;\n\t}\n\n\treturn s;\n}\n\nfunction getComponentName(component) {\n\treturn (\n\t\tcomponent.displayName ||\n\t\t(component !== Function && component.name) ||\n\t\tgetFallbackComponentName(component)\n\t);\n}\n\nfunction getFallbackComponentName(component) {\n\tlet str = Function.prototype.toString.call(component),\n\t\tname = (str.match(/^\\s*function\\s+([^( ]+)/) || '')[1];\n\tif (!name) {\n\t\t// search for an existing indexed name for the given component:\n\t\tlet index = -1;\n\t\tfor (let i = UNNAMED.length; i--; ) {\n\t\t\tif (UNNAMED[i] === component) {\n\t\t\t\tindex = i;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t// not found, create a new indexed name:\n\t\tif (index < 0) {\n\t\t\tindex = UNNAMED.push(component) - 1;\n\t\t}\n\t\tname = `UnnamedComponent${index}`;\n\t}\n\treturn name;\n}\nrenderToString.shallowRender = shallowRender;\n\nexport default renderToString;\n\nexport {\n\trenderToString as render,\n\trenderToString as renderToStaticMarkup,\n\trenderToString,\n\tshallowRender\n};\n"],"names":["IS_NON_DIMENSIONAL","ENCODED_ENTITIES","encodeEntities","input","s","String","test","replace","indent","char","isLargeString","length","ignoreLines","indexOf","JS_TO_CSS","styleObjToCss","str","prop","val","toLowerCase","undefined","assign","obj","props","i","getChildren","accumulator","children","Array","isArray","reduce","push","SHALLOW","shallow","UNNAMED","VOID_ELEMENTS","UNSAFE_NAME","markAsDirty","this","__d","renderToString","render","shallowRender","vnode","context","EMPTY_ARR","opts","previousSkipEffects","options","__s","res","_renderToString","__c","inner","isSvgMode","selectValue","pretty","indentChar","rendered","component","nodeName","type","isComponent","renderRootComponent","Fragment","shallowHighOrder","c","__v","setState","forceUpdate","__h","__b","renderHook","__r","prototype","cxType","contextType","provider","cctx","value","__","_dirty","state","_nextState","getDerivedStateFromProps","componentWillMount","count","call","getChildContext","diffed","displayName","Function","name","toString","match","index","getFallbackComponentName","propChildren","html","attrs","Object","keys","sortAttributes","sort","v","allAttributes","hooked","attributeHook","__html","xml","selected","sub","Error","isVoid","voidElements","pieces","hasLarge","lastWasText","child","ret","isText","join","substring"],"mappings":"mDACaA,EAAqB,kEAE5BC,EAAmB,kBAETC,EAAeC,GAC9B,IAAMC,EAAIC,OAAOF,GACjB,OAAKF,EAAiBK,KAAKF,GAGpBA,EACLG,QAAQ,KAAM,SACdA,QAAQ,KAAM,QACdA,QAAQ,KAAM,QACdA,QAAQ,KAAM,UANRH,MASEI,EAAS,SAACJ,EAAGK,UACvBJ,OAAOD,GAAGG,QAAQ,SAAU,MAAQE,GAAQ,QAElCC,EAAgB,SAACN,EAAGO,EAAQC,UACtCP,OAAOD,GAAGO,QAAUA,GAAU,MAC5BC,IAA4C,IAA7BP,OAAOD,GAAGS,QAAQ,QACP,IAA5BR,OAAOD,GAAGS,QAAQ,MAEbC,EAAY,YAGFC,EAAcX,GAC7B,IAAIY,EAAM,GACV,IAAK,IAAIC,KAAQb,EAAG,CACnB,IAAIc,EAAMd,EAAEa,GACD,MAAPC,GAAuB,KAARA,IACdF,IAAKA,GAAO,KAEhBA,GACY,KAAXC,EAAK,GACFA,EACAH,EAAUG,KACTH,EAAUG,GAAQA,EAAKV,QAAQ,WAAY,OAAOY,eACvDH,GAAO,KACPA,GAAOE,EACY,iBAARA,IAAsD,IAAlClB,EAAmBM,KAAKW,KACtDD,GAAO,MAERA,GAAO,KAGT,OAAOA,QAAOI,WAUCC,EAAOC,EAAKC,GAC3B,IAAK,IAAIC,KAAKD,EAAOD,EAAIE,GAAKD,EAAMC,GACpC,OAAOF,WAUQG,EAAYC,EAAaC,GAMxC,OALIC,MAAMC,QAAQF,GACjBA,EAASG,OAAOL,EAAaC,GACP,MAAZC,IAAiC,IAAbA,GAC9BD,EAAYK,KAAKJ,GAEXD,EChER,IAAMM,EAAU,CAAEC,SAAS,GAGrBC,EAAU,GAEVC,EAAgB,2EAEhBC,EAAc,mBAEpB,SAASC,IACRC,KAAKC,KAAM,EAcZC,EAAeC,OAASD,EASpBE,IAAAA,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