site/node_modules/preact-render-to-string/dist/jsx.module.js

3 lines
11 KiB
JavaScript
Raw Normal View History

2024-10-14 06:09:33 +00:00
import{options as t,Fragment as e}from"preact";if("function"!=typeof Symbol){var n=0;Symbol=function(t){return"@@"+t+ ++n},Symbol.for=function(t){return"@@"+t}}var r=/^(?:area|base|br|col|embed|hr|img|input|link|meta|param|source|track|wbr)$/,o=/[\s\n\\/='"\0<>]/,i=/^(xlink|xmlns|xml)([A-Z])/,a=/^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]/,c=/^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/,l=/["&<]/;function s(t){if(0===t.length||!1===l.test(t))return t;for(var e=0,n=0,r="",o="";n<t.length;n++){switch(t.charCodeAt(n)){case 34:o="&quot;";break;case 38:o="&amp;";break;case 60:o="&lt;";break;default:continue}n!==e&&(r+=t.slice(e,n)),r+=o,e=n+1}return n!==e&&(r+=t.slice(e,n)),r}var u=function(t,e){return String(t).replace(/(\n+)/g,"$1"+(e||"\t"))},f=function(t,e,n){return String(t).length>(e||40)||!n&&-1!==String(t).indexOf("\n")||-1!==String(t).indexOf("<")},p={},d=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"]),g=/[A-Z]/g;function y(t){var e="";for(var n in t){var r=t[n];if(null!=r&&""!==r){var o="-"==n[0]?n:p[n]||(p[n]=n.replace(g,"-$&").toLowerCase()),i=";";"number"!=typeof r||o.startsWith("--")||d.has(o)||(i="px;"),e=e+o+":"+r+i}}return e||void 0}function b(t,e){return Array.isArray(e)?e.reduce(b,t):null!=e&&!1!==e&&t.push(e),t}function m(){this.__d=!0}function h(t,e){return{__v:t,context:e,props:t.props,setState:m,forceUpdate:m,__d:!0,__h:[]}}var v=[],_=[];function x(e,n,r,o){var i=t.__s;t.__s=!0;try{return j(e,n||{},r,o)}finally{t.__c&&t.__c(e,_),t.__s=i,_.length=0}}function j(n,l,p,d,g,m){if(null==n||"boolean"==typeof n)return"";if("object"!=typeof n)return"function"==typeof n?"":s(n+"");var v=p.pretty,_=v&&"string"==typeof v?v:"\t";if(Array.isArray(n)){for(var x="",k=0;k<n.length;k++)v&&k>0&&(x+="\n"),x+=j(n[k],l,p,d,g,m);return x}if(void 0!==n.constructor)return"";t.__b&&t.__b(n);var A,w=n.type,O=n.props,C=!1;if("function"==typeof w){if(C=!0,!p.shallow||!d&&!1!==p.renderRootComponent){if(w===e){var F=[];return b(F,n.props.children),j(F,l,p,!1!==p.shallowHighOrder,g,m)}var E,$=n.__c=h(n,l),H=t.__r,L=l,M=w.contextType;if(null!=M){var I=l[M.__c];L=I?I.props.value:M.__}if(w.prototype&&"function"==typeof w.prototype.render)($=n.__c=new w(O,L)).__v=n,$._dirty=$.__d=!0,$.props=O,null==$.state&&($.state={}),null==$._nextState&&null==$.__s&&($._nextState=$.__s=$.state),$.context=L,w.getDerivedStateFromProps?$.state=Object.assign({},$.state,w.getDerivedStateFromProps($.props,$.state)):$.componentWillMount&&($.componentWillMount(),$.state=$._nextState!==$.state?$._nextState:$.__s!==$.state?$.__s:$.state),H&&H(n),E=$.render($.props,$.state,$.context);else for(var N=0;$.__d&&N++<25;)$.__d=!1,H&&H(n),E=w.call(n.__c,O,L);$.getChildContext&&(l=Object.assign({},l,$.getChildContext()));var D=j(E,l,p,!1!==p.shallowHighOrder,g,m);return t.diffed&&t.diffed(n),D}w=(A=w).displayName||A!==Function&&A.name||S(A)}var W,U,Z="<"+w;if(O){var P=Object.keys(O);p&&!0===p.sortAttributes&&P.sort();for(var T=0;T<P.length;T++){var R=P[T],z=O[R];if("children"!==R){if(!o.test(R)&&(p&&p.allAttributes||"key"!==R&&"ref"!==R&&"__self"!==R&&"__source"!==R)){if("defaultValue"===R)R="value";else if("defaultChecked"===R)R="checked";else if("defaultSelected"===R)R="selected";else if("className"===R){if(void 0!==O.class)continue;R="class"}else"acceptCharset"===R?R="accept-charset":"httpEquiv"===R?
//# sourceMappingURL=jsx.module.js.map