able-baker/bundled/preact/ssr.mjs

9 lines
8.0 KiB
JavaScript
Raw Normal View History

2024-05-15 09:19:10 -04:00
///<reference types="https://esm.sh/v135/preact-render-to-string@6.4.2/src/index.d.ts"/>
2024-05-14 20:34:18 -04:00
/* esm.sh - esbuild bundle(preact-render-to-string@6.4.2) denonext production */
2024-05-15 09:19:10 -04:00
import
{options as u,h as V,Fragment as E}
from"./compat.js";
2024-05-14 20:34:18 -04:00
var J=/[\s\n\\/='"\0<>]/,M=/^(xlink|xmlns|xml)([A-Z])/,oe=/^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]/,ae=/^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/,ie=/["&<]/;function H(e){if(e.length===0||ie.test(e)===!1)return e;for(var n=0,t=0,r="",a="";t<e.length;t++){switch(e.charCodeAt(t)){case 34:a="&quot;";break;case 38:a="&amp;";break;case 60:a="&lt;";break;default:continue}t!==n&&(r+=e.slice(n,t)),r+=a,n=t+1}return t!==n&&(r+=e.slice(n,t)),r}var Q={},se=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"]),ce=/[A-Z]/g;function le(e){var n="";for(var t in e){var r=e[t];if(r!=null&&r!==""){var a=t[0]=="-"?t:Q[t]||(Q[t]=t.replace(ce,"-$&").toLowerCase()),o=";";typeof r!="number"||a.startsWith("--")||se.has(a)||(o="px;"),n=n+a+":"+r+o}}return n||void 0}function y(e,n,t){if(!e.s){if(t instanceof W){if(!t.s)return void(t.o=y.bind(null,e,n));1&n&&(n=t.s),t=t.v}if(t&&t.then)return void t.then(y.bind(null,e,n),y.bind(null,e,2));e.s=n,e.v=t;let r=e.o;r&&r(e)}}var W=function(){function e(){}return e.prototype.then=function(n,t){var r=new e,a=this.s;if(a){var o=1&a?n:t;if(o){try{y(r,1,o(this.v))}catch(i){y(r,2,i)}return r}return this}return this.o=function(i){try{var l=i.v;1&i.s?y(r,1,n?n(l):l):t?y(r,1,t(l)):y(r,2,l)}catch(_){y(r,2,_)}},r},e}();function D(e){return e instanceof W&&1&e.s}function ue(e,n,t){for(var r;;){var a=e();if(D(a)&&(a=a.v),!a)return o;if(a.then){r=0;break}var o=t();if(o&&o.then){if(!D(o)){r=1;break}o=o.s}if(n){var i=n();if(i&&i.then&&!D(i)){r=2;break}}}var l=new W,_=y.bind(null,l,2);return(r===0?a.then(g):r===1?o.then(m):i.then(v)).then(void 0,_),l;function m(S){o=S;do{if(n&&(i=n())&&i.then&&!D(i))return void i.then(v).then(void 0,_);if(!(a=e())||D(a)&&!a.v)return void y(l,1,o);if(a.then)return void a.then(g).then(void 0,_);D(o=t())&&(o=o.v)}while(!o||!o.then);o.then(m).then(void 0,_)}function g(S){S?(o=t())&&o.then?o.then(m).then(void 0,_):m(o):y(l,1,o)}function v(){(a=e())?a.then?a.then(g).then(void 0,_):g(a):y(l,1,o)}}function fe(e,n){try{var t=e()}catch(r){return n(!0,r)}return t&&t.then?t.then(n.bind(null,!1),n.bind(null,!0)):n(!1,t)}var N,A,P,C,de=function(e,n){try{var t,r=u.__s;u.__s=!0,N=u.__b,A=u.diffed,P=u.__r,C=u.unmount;var a=V(E,null);return a.__k=[e],Promise.resolve(fe(function(){var o=k(e,n||q,!1,void 0,a,!0),i=function(){if(Array.isArray(o)){var l=function(){var v=m.join("");return t=1,v},_=0,m=o,g=ue(function(){return!!m.some(function(v){return typeof v.then=="function"})&&_++<25},void 0,function(){return Promise.resolve(Promise.all(m)).then(function(v){m=v.flat()})});return g&&g.then?g.then(l):l()}}();return i&&i.then?i.then(function(l){return t?l:o}):t?i:o},function(o,i){if(u.__c&&u.__c(e,O),u.__s=r,O.length=0,o)throw i;return i}))}catch(o){return Promise.reject(o)}},O=[],X=Array.isArray,R=Object.assign;function $(e,n){var t=u.__s;u.__s=!0,N=u.__b,A=u.diffed,P=u.__r,C=u.unmount;var r=V(E,null);r.__k=[e];try{return k(e,n||q,!1,void 0,r,!1)}catch(a){throw a.then?new Error('Use "renderToStringAsync" for suspenseful rendering.'):a}finally{u.__c&&u.__c(e,O),u.__s=t,O.length=0}}function Y(){this.__d=!0}var q={};function K(e,n){var t,r=e.type,a=!0;return e.__c?(a=!1,(t=e.__c).state=t.__s):t=new r(e.props,n),e.__c=t,t.__v=e,t.props=e.props,t.context=n,t.__d=!0,t.state==null&&(t.state=q),t.__s==null&&(t.__s=t.state),r.getDerivedStateFromPro
2024-05-15 09:33:06 -04:00
export{me as default,_e as render,ve as renderToStaticMarkup,$ as renderToString,de as renderToStringAsync};