S2OJ/web/js/h2m.js

6 lines
141 KiB
JavaScript
Raw Normal View History

2022-10-14 23:07:45 +00:00
/*! h2m v0.7.0 (forked version) | https://github.com/renbaoshuo/h2m */
!function t(e,r,n){function i(s,a){if(!r[s]){if(!e[s]){var c="function"==typeof require&&require;if(!a&&c)return c(s,!0);if(o)return o(s,!0);var u=new Error("Cannot find module '"+s+"'");throw u.code="MODULE_NOT_FOUND",u}var l=r[s]={exports:{}};e[s][0].call(l.exports,(function(t){return i(e[s][1][t]||t)}),l,l.exports,t,e,r,n)}return r[s].exports}for(var o="function"==typeof require&&require,s=0;s<n.length;s++)i(n[s]);return i}({1:[function(t,e,r){window.h2m=t("./index")},{"./index":6}],2:[function(t,e,r){var n="H2M_LI_HEADER";e.exports={em:function(t){if(t.md)return`*${t.md}*`},strong:function(t){if(t.md)return`**${t.md}**`},h1:function(t){if(t.md)return`\n# ${t.md}\n`},h2:function(t){if(t.md)return`\n## ${t.md}\n`},h3:function(t){if(t.md)return`\n### ${t.md}\n`},h4:function(t){if(t.md)return`\n#### ${t.md}\n`},h5:function(t){if(t.md)return`\n##### ${t.md}\n`},h6:function(t){if(t.md)return`\n###### ${t.md}\n`},a:function(t){var e=t.md||t.attrs.href,r=t.attrs.href||e;if(e)return`[${e}](${r})`},img:function(t){var e=t.attrs.src;if(e)return`![${(t.attrs.title||t.attrs.alt||"").trim()}](${e})`},blockquote:function(t){var e=t.md;if(e)return`\n${e=(e=e.replace(/(^\n+|\n+$)/g,"")).split("\n").map((function(t){return`> ${t}\n`})).join("")}\n`},ul:function(t){if(t.md)return`\n${t.md.replace(new RegExp(n,"ig"),"-")}\n`},ol:function(t){var e=1;if(t.md)return`\n${t.md.replace(new RegExp(n,"ig"),(function(){return e+++"."}))}\n`},li:function(t){if(t.md)return`${n} ${t.md}\n`},hr:function(){return"\n---\n"},code:function(t){if(t.md)return t.isInPreNode?t.md:`\`${t.md}\``},br:function(){return"\n"},pre:function(t){var e=t.md;if(e)return`\n${e=e.split("\n").map((function(t){return` ${t}\n`})).join("")}\n`},p:function(t){var e=t.md;if(e)return`\n${e}\n`},div:function(t){var e=t.md;if(e)return`\n${e}\n`},default:function(t){return t.md},cleanup:function(t){return t.replace(/(^\n+|\n+$)/g,"").replace(/\n{3,}/g,"\n\n")}}},{}],3:[function(t,e,r){var n=t("./commonmark"),i=Object.create(n);i.pre=function(t){return`\n\`\`\`\n${t.md}\n\`\`\`\n`};var o=!1,s=!1,a=0,c=0;function u(){isTr=!1,s=!1,c=0,a=0,o=!1}function l(){for(var t="|",e=c;e>0;e--)t+="--------|";return t}i.table=function(t){var e="";return o||(e=l()+"\n"),s?(u(),`\n${t.md}\n${e}`):(u(),"")},i.tr=function(t){var e;if(a++,e=`\n|${t.md}`,o||2!=a)return`${e}`;var r=l();return o=!0,`\n${r}${e}`},i.th=function(t){return s=!0,c++,`${t.md}|`},i.td=function(t){return s=!0,0==a&&c++,`${t.md.replace(/(<br>)|(<br\/>)|(\n)|(\r\n)/g,"")}|`},e.exports=i},{"./commonmark":2}],4:[function(t,e,r){e.exports={CommonMark:t("./commonmark"),MarkdownExtra:t("./markdown-extra"),Gfm:t("./gfm")}},{"./commonmark":2,"./gfm":3,"./markdown-extra":5}],5:[function(t,e,r){var n=t("./commonmark"),i=["id","class","href","src","alt"];function o(t){var e=[],r=t.attrs.id;return r&&e.push(`#${r}`),(r=t.attrs.class)&&e.push(r.split(/\s+/).map((function(t){return`.${t}`})).join(" ")),Object.keys(t.attrs).forEach((function(t){-1==i.indexOf(t)&&e.push(`${t}=${r}`)})),(e=e.join(" ")).length<=0?"":` (${e})`}for(var s=Object.create(n),a=0;a<6;a++)!function(t){s[`h${t}`]=function(e){var r="#".repeat(t);return`\n${r} ${e.md} ${r}${o(e)}\n`}}(a+1);s.a=function(t){return`${n.a(t)}${o(t)}`},s.img=function(t){return`${n.img(t)}${o(t)}`},s.pre=function(t){return`\n\`\`\`\n${t.md}\n\`\`\`\n`};var c=[];s.abbr=function(t){return""!=t.attrs.title&&c.push({word:t.md,title:t.attrs.title}),t.md};var u=!1,l=!1,p=0,h=0;function f(){isTr=!1,l=!1,h=0,p=0,u=!1}function d(){for(var t="|",e=h;e>0;e--)t+="--------|";return t}s.table=function(t){var e="";return u||(e=d()+"\n"),l?(f(),`\n${t.md}\n${e}`):(f(),"")},s.tr=function(t){var e;if(p++,e=`\n|${t.md}`,u||2!=p)return`${e}`;var r=d();return u=!0,`\n${r}${e}`},s.th=function(t){return l=!0,h++,`${t.md}|`},s.td=function(t){return l=!0,0==p&&h++,`${t.md.replace(/(<br>)|(<br\/>)|(\n)|(\r\n)/g,"")}|`},s.dl=function(t){var e=t.md;if(e)return`\n${e}\n`},s.dt=function(t){var e=t.md;if(e)return`${e}\n`},s.dd=function(t){var e=t.md;if(e)return`: ${e}\n\n`},s.cleanup=function(t){return n.cleanup(`${t}\n\n
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
r.read=function(t,e,r,n,i){var o,s,a=8*i-n-1,c=(1<<a)-1,u=c>>1,l=-7,p=r?i-1:0,h=r?-1:1,f=t[e+p];for(p+=h,o=f&(1<<-l)-1,f>>=-l,l+=a;l>0;o=256*o+t[e+p],p+=h,l-=8);for(s=o&(1<<-l)-1,o>>=-l,l+=n;l>0;s=256*s+t[e+p],p+=h,l-=8);if(0===o)o=1-u;else{if(o===c)return s?NaN:1/0*(f?-1:1);s+=Math.pow(2,n),o-=u}return(f?-1:1)*s*Math.pow(2,o-n)},r.write=function(t,e,r,n,i,o){var s,a,c,u=8*o-i-1,l=(1<<u)-1,p=l>>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=n?0:o-1,d=n?1:-1,g=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=l):(s=Math.floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-s))<1&&(s--,c*=2),(e+=s+p>=1?h/c:h*Math.pow(2,1-p))*c>=2&&(s++,c/=2),s+p>=l?(a=0,s=l):s+p>=1?(a=(e*c-1)*Math.pow(2,i),s+=p):(a=e*Math.pow(2,p-1)*Math.pow(2,i),s=0));i>=8;t[r+f]=255&a,f+=d,a/=256,i-=8);for(s=s<<i|a,u+=i;u>0;t[r+f]=255&s,f+=d,s/=256,u-=8);t[r+f-d]|=128*g}},{}],49:[function(t,e,r){"function"==typeof Object.create?e.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(t,e){if(e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}}},{}]},{},[1]);