site/node_modules/preact-render-to-string/dist/index.mjs

3 lines
7.9 KiB
JavaScript
Raw Normal View History

2024-10-14 06:09:33 +00:00
import{options as e,h as t,Fragment as r}from"preact";var n=/[\s\n\\/='"\0<>]/,o=/^(xlink|xmlns|xml)([A-Z])/,i=/^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]/,a=/^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/,c=/["&<]/;function s(e){if(0===e.length||!1===c.test(e))return e;for(var t=0,r=0,n="",o="";r<e.length;r++){switch(e.charCodeAt(r)){case 34:o="&quot;";break;case 38:o="&amp;";break;case 60:o="&lt;";break;default:continue}r!==t&&(n+=e.slice(t,r)),n+=o,t=r+1}return r!==t&&(n+=e.slice(t,r)),n}var l={},u=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"]),f=/[A-Z]/g;function p(e){var t="";for(var r in e){var n=e[r];if(null!=n&&""!==n){var o="-"==r[0]?r:l[r]||(l[r]=r.replace(f,"-$&").toLowerCase()),i=";";"number"!=typeof n||o.startsWith("--")||u.has(o)||(i="px;"),t=t+o+":"+n+i}}return t||void 0}function h(e,t,r){if(!e.s){if(r instanceof d){if(!r.s)return void(r.o=h.bind(null,e,t));1&t&&(t=r.s),r=r.v}if(r&&r.then)return void r.then(h.bind(null,e,t),h.bind(null,e,2));e.s=t,e.v=r;const n=e.o;n&&n(e)}}var d=/*#__PURE__*/function(){function e(){}return e.prototype.then=function(t,r){var n=new e,o=this.s;if(o){var i=1&o?t:r;if(i){try{h(n,1,i(this.v))}catch(e){h(n,2,e)}return n}return this}return this.o=function(e){try{var o=e.v;1&e.s?h(n,1,t?t(o):o):r?h(n,1,r(o)):h(n,2,o)}catch(e){h(n,2,e)}},n},e}();function _(e){return e instanceof d&&1&e.s}function v(e,t,r){for(var n;;){var o=e();if(_(o)&&(o=o.v),!o)return i;if(o.then){n=0;break}var i=r();if(i&&i.then){if(!_(i)){n=1;break}i=i.s}if(t){var a=t();if(a&&a.then&&!_(a)){n=2;break}}}var c=new d,s=h.bind(null,c,2);return(0===n?o.then(u):1===n?i.then(l):a.then(f)).then(void 0,s),c;function l(n){i=n;do{if(t&&(a=t())&&a.then&&!_(a))return void a.then(f).then(void 0,s);if(!(o=e())||_(o)&&!o.v)return void h(c,1,i);if(o.then)return void o.then(u).then(void 0,s);_(i=r())&&(i=i.v)}while(!i||!i.then);i.then(l).then(void 0,s)}function u(e){e?(i=r())&&i.then?i.then(l).then(void 0,s):l(i):h(c,1,i)}function f(){(o=e())?o.then?o.then(u).then(void 0,s):u(o):h(c,1,i)}}function y(e,t){try{var r=e()}catch(e){return t(!0,e)}return r&&r.then?r.then(t.bind(null,!1),t.bind(null,!0)):t(!1,r)}var m,g,b,k,x=function(n,o){try{var i,a=e.__s;e.__s=!0,m=e.__b,g=e.diffed,b=e.__r,k=e.unmount;var c=t(r,null);return c.__k=[n],Promise.resolve(y(function(){var e=T(n,o||D,!1,void 0,c,!0),t=function(){if(Array.isArray(e)){var t=function(){var e=n.join("");return i=1,e},r=0,n=e,o=v(function(){return!!n.some(function(e){return"function"==typeof e.then})&&r++<25},void 0,function(){return Promise.resolve(Promise.all(n)).then(function(e){n=e.flat()})});return o&&o.then?o.then(t):t()}}();return t&&t.then?t.then(function(t){return i?t:e}):i?t:e},function(t,r){if(e.__c&&e.__c(n,w),e.__s=a,w.length=0,t)throw r;return r}))}catch(e){return Promise.reject(e)}},w=[],A=Array.isArray,C=Object.assign;function S(n,o){var i=e.__s;e.__s=!0,m=e.__b,g=e.diffed,b=e.__r,k=e.unmount;var a=t(r,null);a.__k=[n];try{return T(n,o||D,!1,void 0,a,!1)}catch(e){if(e.then)throw new Error('Use "renderToStringAsync" for suspenseful rendering.');throw e}finally{e.__c&&e.__c(n,w),e.__s=i,w.length=0}}function L(){this.__d=!0}var D={};function E(e,t){var r,n=e.type,o=!0;return e.__c?(o=!1,(r=e.__c).state=r.__s):r=new n(e.props,t),e.__c=r,r.__v=e,r.props=e.props,r.context=t,r.__d=!0,null==r.state&&(r
//# sourceMappingURL=index.module.js.map