linktree/node_modules/preact-render-to-string/dist/stream/index.js

3 lines
8.7 KiB
JavaScript
Raw Normal View History

2025-06-16 13:37:14 +02:00
var e=require("preact"),t=/[\s\n\\/='"\0<>]/,r=/^(xlink|xmlns|xml)([A-Z])/,n=/^(?:accessK|auto[A-Z]|cell|ch|col|cont|cross|dateT|encT|form[A-Z]|frame|hrefL|inputM|maxL|minL|noV|playsI|popoverT|readO|rowS|src[A-Z]|tabI|useM|item[A-Z])/,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=new Set(["draggable","spellcheck"]),a=/["&<]/;function s(e){if(0===e.length||!1===a.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 c={},l=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"]),u=/[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:c[r]||(c[r]=r.replace(u,"-$&").toLowerCase()),i=";";"number"!=typeof n||o.startsWith("--")||l.has(o)||(i="px;"),t=t+o+":"+n+i}}return t||void 0}function f(){this.__d=!0}function d(e,t){return{__v:e,context:t,props:e.props,setState:f,forceUpdate:f,__d:!0,__h:new Array(0)}}var h,v,m,_,g=function(){var e=this;this.promise=new Promise(function(t,r){e.resolve=t,e.reject=r})},y={},b=[],x=Array.isArray,k=Object.assign;function w(t,r,n){var o=e.options.__s;e.options.__s=!0,h=e.options.__b,v=e.options.diffed,m=e.options.__r,_=e.options.unmount;var i=e.h(e.Fragment,null);i.__k=[t];try{var a=S(t,r||y,!1,void 0,i,!1,n);return x(a)?a.join(""):a}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=o,b.length=0}}function C(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.state=y),null==r.__s&&(r.__s=r.state),n.getDerivedStateFromProps?r.state=k({},r.state,n.getDerivedStateFromProps(r.props,r.state)):o&&r.componentWillMount?(r.componentWillMount(),r.state=r.__s!==r.state?r.__s:r.state):!o&&r.componentWillUpdate&&r.componentWillUpdate(),m&&m(e),r.render(r.props,r.state,t)}function S(a,c,l,u,f,g,b){if(null==a||!0===a||!1===a||""===a)return"";var w=typeof a;if("object"!=w)return"function"==w?"":"string"==w?s(a):a+"";if(x(a)){var E,L="";f.__k=a;for(var P=a.length,F=0;F<P;F++){var T=a[F];if(null!=T&&"boolean"!=typeof T){var j,W=S(T,c,l,u,f,g,b);"string"==typeof W?L+=W:(E||(E=new Array(P)),L&&E.push(L),L="",x(W)?(j=E).push.apply(j,W):E.push(W))}}return E?(L&&E.push(L),E):L}if(void 0!==a.constructor)return"";a.__=f,h&&h(a);var D=a.type,N=a.props;if("function"==typeof D){var M,U,Z,q=c;if(D===e.Fragment){if("tpl"in N){for(var $="",H=0;H<N.tpl.length;H++)if($+=N.tpl[H],N.exprs&&H<N.exprs.length){var R=N.exprs[H];if(null==R)continue;"object"!=typeof R||void 0!==R.constructor&&!x(R)?$+=R:$+=S(R,c,l,u,a,g,b)}return $}if("UNSTABLE_comment"in N)return"\x3c!--"+s(N.UNSTABLE_comment)+"--\x3e";U=N.children}else{if(null!=(M=D.contextType)){var z=c[M.__c];q=z?z.props.value:M.__}var I=D.prototype&&"function"==typeof D.prototype.render;if(I)U=C(a,q),Z=a.__c;else{a.__c=Z=d(a,q);for(var B=0;Z.__d&&B++<25;)Z.__d=!1,m&&m(a),U=D.call(Z,N,q);Z.__d=!0}if(null!=Z.getChildContext&&(c=k({},c,Z.getChildContext())),I&&e.options.errorBoundaries&&(D.getDerivedStateFromError||Z.componentDidCatch)){U=null!=U&&U.type===e.Fragment&&null==U.key&&null==U.props.tpl?U.props.children:U;try{return S(U,c,l,u,a,g,b)}catch(t){return D.getDerivedStateFrom
//# sourceMappingURL=index.js.map