site/node_modules/preact-render-to-string/dist/commonjs.js

3 lines
8 KiB
JavaScript
Raw Permalink Normal View History

2024-10-14 06:09:33 +00:00
var e=require("preact"),t=/[\s\n\\/='"\0<>]/,n=/^(xlink|xmlns|xml)([A-Z])/,r=/^accessK|^auto[A-Z]|^ch|^col|cont|cross|dateT|encT|form[A-Z]|frame|hrefL|inputM|maxL|minL|noV|playsI|readO|rowS|spellC|src[A-Z]|tabI|item[A-Z]/,o=/^ac|^ali|arabic|basel|cap|clipPath$|clipRule$|color|dominant|enable|fill|flood|font|glyph[^R]|horiz|image|letter|lighting|marker[^WUH]|overline|panose|pointe|paint|rendering|shape|stop|strikethrough|stroke|text[^L]|transform|underline|unicode|units|^v[^i]|^w|^xH/,i=/["&<]/;function a(e){if(0===e.length||!1===i.test(e))return e;for(var t=0,n=0,r="",o="";n<e.length;n++){switch(e.charCodeAt(n)){case 34:o="&quot;";break;case 38:o="&amp;";break;case 60:o="&lt;";break;default:continue}n!==t&&(r+=e.slice(t,n)),r+=o,t=n+1}return n!==t&&(r+=e.slice(t,n)),r}var s={},c=new Set(["animation-iteration-count","border-image-outset","border-image-slice","border-image-width","box-flex","box-flex-group","box-ordinal-group","column-count","fill-opacity","flex","flex-grow","flex-negative","flex-order","flex-positive","flex-shrink","flood-opacity","font-weight","grid-column","grid-row","line-clamp","line-height","opacity","order","orphans","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","widows","z-index","zoom"]),l=/[A-Z]/g;function u(e){var t="";for(var n in e){var r=e[n];if(null!=r&&""!==r){var o="-"==n[0]?n:s[n]||(s[n]=n.replace(l,"-$&").toLowerCase()),i=";";"number"!=typeof r||o.startsWith("--")||c.has(o)||(i="px;"),t=t+o+":"+r+i}}return t||void 0}function f(e,t,n){if(!e.s){if(n instanceof p){if(!n.s)return void(n.o=f.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(f.bind(null,e,t),f.bind(null,e,2));e.s=t,e.v=n;const r=e.o;r&&r(e)}}var p=/*#__PURE__*/function(){function e(){}return e.prototype.then=function(t,n){var r=new e,o=this.s;if(o){var i=1&o?t:n;if(i){try{f(r,1,i(this.v))}catch(e){f(r,2,e)}return r}return this}return this.o=function(e){try{var o=e.v;1&e.s?f(r,1,t?t(o):o):n?f(r,1,n(o)):f(r,2,o)}catch(e){f(r,2,e)}},r},e}();function h(e){return e instanceof p&&1&e.s}function d(e,t,n){for(var r;;){var o=e();if(h(o)&&(o=o.v),!o)return i;if(o.then){r=0;break}var i=n();if(i&&i.then){if(!h(i)){r=1;break}i=i.s}if(t){var a=t();if(a&&a.then&&!h(a)){r=2;break}}}var s=new p,c=f.bind(null,s,2);return(0===r?o.then(u):1===r?i.then(l):a.then(d)).then(void 0,c),s;function l(r){i=r;do{if(t&&(a=t())&&a.then&&!h(a))return void a.then(d).then(void 0,c);if(!(o=e())||h(o)&&!o.v)return void f(s,1,i);if(o.then)return void o.then(u).then(void 0,c);h(i=n())&&(i=i.v)}while(!i||!i.then);i.then(l).then(void 0,c)}function u(e){e?(i=n())&&i.then?i.then(l).then(void 0,c):l(i):f(s,1,i)}function d(){(o=e())?o.then?o.then(u).then(void 0,c):u(o):f(s,1,i)}}function _(e,t){try{var n=e()}catch(e){return t(!0,e)}return n&&n.then?n.then(t.bind(null,!1),t.bind(null,!0)):t(!1,n)}var v,m,y,g,b=[],k=Array.isArray,x=Object.assign;function w(t,n){var r=e.options.__s;e.options.__s=!0,v=e.options.__b,m=e.options.diffed,y=e.options.__r,g=e.options.unmount;var o=e.h(e.Fragment,null);o.__k=[t];try{return F(t,n||C,!1,void 0,o,!1)}catch(e){if(e.then)throw new Error('Use "renderToStringAsync" for suspenseful rendering.');throw e}finally{e.options.__c&&e.options.__c(t,b),e.options.__s=r,b.length=0}}function A(){this.__d=!0}var C={};function S(e,t){var n,r=e.type,o=!0;return e.__c?(o=!1,(n=e.__c).state=n.__s):n=new r(e.props,t),e.__c=n,n.__v=e,n.props=e.props,n.context=t,n.__d=!0,null==n.state&&(n.state=C),null==n.__s&&(n.__s=n.state),r.getDerivedStateFromProps?n.state=x({},n.state,r.getDerivedStateFromProps(n.props,n.state)):o&&n.componentWillMount?(n.componentWillMount(),n.state=n.__s!==n.state?n.__s:n.state):!o&&n.componentWillUpdate&&n.componentWillUpdate(),y&&y(e),n.render(n.props,n.state,t)}function F(i,s,c,l,f,p){if(null==i||!0===i||!1===i||""===i)return"";if("object"!=typeof i)return"function"==typeof i?"":a(i+"");if(k(i)){var h,d="";f.__k=i;for(var _=0;_<i.length;_++){var b=i[_];if(null!=b&&"boolean"!=typeof b){var w,C=F(b,s,c,l,f,p);"string"==typeof C?d+=C:(h=h||[],d&&h.
//# sourceMappingURL=index.js.map