mirror of
https://github.com/kuaifan/dootask.git
synced 2025-12-12 03:01:12 +00:00
16 lines
48 KiB
JavaScript
Vendored
16 lines
48 KiB
JavaScript
Vendored
import{m as ve,u as ke,e as Pe,f as de,d as te}from"./mdurl.ce6c1dd8.js";import{P as Re,r as ze,u as Oe}from"./uc.micro.8d343c98.js";import{d as me}from"./entities.48a44fec.js";import{L as De}from"./linkify-it.c5e8196e.js";import{p as xe}from"./punycode.js.4b3f125a.js";function Fe(e){return Object.prototype.toString.call(e)}function ee(e){return Fe(e)==="[object String]"}const Le=Object.prototype.hasOwnProperty;function $e(e,n){return Le.call(e,n)}function G(e){return Array.prototype.slice.call(arguments,1).forEach(function(r){if(!!r){if(typeof r!="object")throw new TypeError(r+"must be object");Object.keys(r).forEach(function(t){e[t]=r[t]})}}),e}function ge(e,n,r){return[].concat(e.slice(0,n),r,e.slice(n+1))}function ne(e){return!(e>=55296&&e<=57343||e>=64976&&e<=65007||(e&65535)===65535||(e&65535)===65534||e>=0&&e<=8||e===11||e>=14&&e<=31||e>=127&&e<=159||e>1114111)}function H(e){if(e>65535){e-=65536;const n=55296+(e>>10),r=56320+(e&1023);return String.fromCharCode(n,r)}return String.fromCharCode(e)}const _e=/\\([!"#$%&'()*+,\-./:;<=>?@[\\\]^_`{|}~])/g,Be=/&([a-z#][a-z0-9]{1,31});/gi,je=new RegExp(_e.source+"|"+Be.source,"gi"),qe=/^#((?:x[a-f0-9]{1,8}|[0-9]{1,8}))$/i;function Ne(e,n){if(n.charCodeAt(0)===35&&qe.test(n)){const t=n[1].toLowerCase()==="x"?parseInt(n.slice(2),16):parseInt(n.slice(1),10);return ne(t)?H(t):e}const r=me(e);return r!==e?r:e}function Ze(e){return e.indexOf("\\")<0?e:e.replace(_e,"$1")}function D(e){return e.indexOf("\\")<0&&e.indexOf("&")<0?e:e.replace(je,function(n,r,t){return r||Ne(n,t)})}const Ue=/[&<>"]/,He=/[&<>"]/g,Ge={"&":"&","<":"<",">":">",'"':"""};function We(e){return Ge[e]}function R(e){return Ue.test(e)?e.replace(He,We):e}const Qe=/[.?*+^$[\]\\(){}|-]/g;function Je(e){return e.replace(Qe,"\\$&")}function A(e){switch(e){case 9:case 32:return!0}return!1}function $(e){if(e>=8192&&e<=8202)return!0;switch(e){case 9:case 10:case 11:case 12:case 13:case 32:case 160:case 5760:case 8239:case 8287:case 12288:return!0}return!1}function B(e){return Re.test(e)||ze.test(e)}function j(e){switch(e){case 33:case 34:case 35:case 36:case 37:case 38:case 39:case 40:case 41:case 42:case 43:case 44:case 45:case 46:case 47:case 58:case 59:case 60:case 61:case 62:case 63:case 64:case 91:case 92:case 93:case 94:case 95:case 96:case 123:case 124:case 125:case 126:return!0;default:return!1}}function W(e){return e=e.trim().replace(/\s+/g," "),"\u1E9E".toLowerCase()==="\u1E7E"&&(e=e.replace(/ẞ/g,"\xDF")),e.toLowerCase().toUpperCase()}const Ve={mdurl:ve,ucmicro:Oe};var Xe=Object.freeze(Object.defineProperty({__proto__:null,lib:Ve,assign:G,isString:ee,has:$e,unescapeMd:Ze,unescapeAll:D,isValidEntityCode:ne,fromCodePoint:H,escapeHtml:R,arrayReplaceAt:ge,isSpace:A,isWhiteSpace:$,isMdAsciiPunct:j,isPunctChar:B,escapeRE:Je,normalizeReference:W},Symbol.toStringTag,{value:"Module"}));function Ye(e,n,r){let t,o,i,l;const c=e.posMax,s=e.pos;for(e.pos=n+1,t=1;e.pos<c;){if(i=e.src.charCodeAt(e.pos),i===93&&(t--,t===0)){o=!0;break}if(l=e.pos,e.md.inline.skipToken(e),i===91){if(l===e.pos-1)t++;else if(r)return e.pos=s,-1}}let f=-1;return o&&(f=e.pos),e.pos=s,f}function Ke(e,n,r){let t,o=n;const i={ok:!1,pos:0,str:""};if(e.charCodeAt(o)===60){for(o++;o<r;){if(t=e.charCodeAt(o),t===10||t===60)return i;if(t===62)return i.pos=o+1,i.str=D(e.slice(n+1,o)),i.ok=!0,i;if(t===92&&o+1<r){o+=2;continue}o++}return i}let l=0;for(;o<r&&(t=e.charCodeAt(o),!(t===32||t<32||t===127));){if(t===92&&o+1<r){if(e.charCodeAt(o+1)===32)break;o+=2;continue}if(t===40&&(l++,l>32))return i;if(t===41){if(l===0)break;l--}o++}return n===o||l!==0||(i.str=D(e.slice(n,o)),i.pos=o,i.ok=!0),i}function en(e,n,r,t){let o,i=n;const l={ok:!1,can_continue:!1,pos:0,str:"",marker:0};if(t)l.str=t.str,l.marker=t.marker;else{if(i>=r)return l;let c=e.charCodeAt(i);if(c!==34&&c!==39&&c!==40)return l;n++,i++,c===40&&(c=41),l.marker=c}for(;i<r;){if(o=e.charCodeAt(i),o===l.marker)return l.pos=i+1,l.str+=D(e.slice(n,i)),l.ok=!0,l;if(o===40&&l.marker===41)return l;o===92&&i+1<r&&i++,i++}return l.can_continue=!0,l.str+=D(e.slice(n,i)),l}var nn=Object.freeze(Object.defineProperty({__proto__:null,parseLinkLabel:Ye,parseLinkDestination:Ke,parseLinkTitle:en},Symbol.toStringTag,{value:"Module"}));const I={};I.code_inline=function(e,n,r,t,o){const i=e[n];return"<code"+o.renderAttrs(i)+">"+R(i.content)+"</code>"};I.code_block=function(e,n,r,t,o){const i=e[n];return"<pre"+o.renderAttrs(i)+"><code>"+R(e[n].content)+`</code></pre>
|
|
`};I.fence=function(e,n,r,t,o){const i=e[n],l=i.info?D(i.info).trim():"";let c="",s="";if(l){const h=l.split(/(\s+)/g);c=h[0],s=h.slice(2).join("")}let f;if(r.highlight?f=r.highlight(i.content,c,s)||R(i.content):f=R(i.content),f.indexOf("<pre")===0)return f+`
|
|
`;if(l){const h=i.attrIndex("class"),p=i.attrs?i.attrs.slice():[];h<0?p.push(["class",r.langPrefix+c]):(p[h]=p[h].slice(),p[h][1]+=" "+r.langPrefix+c);const k={attrs:p};return`<pre><code${o.renderAttrs(k)}>${f}</code></pre>
|
|
`}return`<pre><code${o.renderAttrs(i)}>${f}</code></pre>
|
|
`};I.image=function(e,n,r,t,o){const i=e[n];return i.attrs[i.attrIndex("alt")][1]=o.renderInlineAsText(i.children,r,t),o.renderToken(e,n,r)};I.hardbreak=function(e,n,r){return r.xhtmlOut?`<br />
|
|
`:`<br>
|
|
`};I.softbreak=function(e,n,r){return r.breaks?r.xhtmlOut?`<br />
|
|
`:`<br>
|
|
`:`
|
|
`};I.text=function(e,n){return R(e[n].content)};I.html_block=function(e,n){return e[n].content};I.html_inline=function(e,n){return e[n].content};function F(){this.rules=G({},I)}F.prototype.renderAttrs=function(n){let r,t,o;if(!n.attrs)return"";for(o="",r=0,t=n.attrs.length;r<t;r++)o+=" "+R(n.attrs[r][0])+'="'+R(n.attrs[r][1])+'"';return o};F.prototype.renderToken=function(n,r,t){const o=n[r];let i="";if(o.hidden)return"";o.block&&o.nesting!==-1&&r&&n[r-1].hidden&&(i+=`
|
|
`),i+=(o.nesting===-1?"</":"<")+o.tag,i+=this.renderAttrs(o),o.nesting===0&&t.xhtmlOut&&(i+=" /");let l=!1;if(o.block&&(l=!0,o.nesting===1&&r+1<n.length)){const c=n[r+1];(c.type==="inline"||c.hidden||c.nesting===-1&&c.tag===o.tag)&&(l=!1)}return i+=l?`>
|
|
`:">",i};F.prototype.renderInline=function(e,n,r){let t="";const o=this.rules;for(let i=0,l=e.length;i<l;i++){const c=e[i].type;typeof o[c]!="undefined"?t+=o[c](e,i,n,r,this):t+=this.renderToken(e,i,n)}return t};F.prototype.renderInlineAsText=function(e,n,r){let t="";for(let o=0,i=e.length;o<i;o++)switch(e[o].type){case"text":t+=e[o].content;break;case"image":t+=this.renderInlineAsText(e[o].children,n,r);break;case"html_inline":case"html_block":t+=e[o].content;break;case"softbreak":case"hardbreak":t+=`
|
|
`;break}return t};F.prototype.render=function(e,n,r){let t="";const o=this.rules;for(let i=0,l=e.length;i<l;i++){const c=e[i].type;c==="inline"?t+=this.renderInline(e[i].children,n,r):typeof o[c]!="undefined"?t+=o[c](e,i,n,r,this):t+=this.renderToken(e,i,n,r)}return t};function S(){this.__rules__=[],this.__cache__=null}S.prototype.__find__=function(e){for(let n=0;n<this.__rules__.length;n++)if(this.__rules__[n].name===e)return n;return-1};S.prototype.__compile__=function(){const e=this,n=[""];e.__rules__.forEach(function(r){!r.enabled||r.alt.forEach(function(t){n.indexOf(t)<0&&n.push(t)})}),e.__cache__={},n.forEach(function(r){e.__cache__[r]=[],e.__rules__.forEach(function(t){!t.enabled||r&&t.alt.indexOf(r)<0||e.__cache__[r].push(t.fn)})})};S.prototype.at=function(e,n,r){const t=this.__find__(e),o=r||{};if(t===-1)throw new Error("Parser rule not found: "+e);this.__rules__[t].fn=n,this.__rules__[t].alt=o.alt||[],this.__cache__=null};S.prototype.before=function(e,n,r,t){const o=this.__find__(e),i=t||{};if(o===-1)throw new Error("Parser rule not found: "+e);this.__rules__.splice(o,0,{name:n,enabled:!0,fn:r,alt:i.alt||[]}),this.__cache__=null};S.prototype.after=function(e,n,r,t){const o=this.__find__(e),i=t||{};if(o===-1)throw new Error("Parser rule not found: "+e);this.__rules__.splice(o+1,0,{name:n,enabled:!0,fn:r,alt:i.alt||[]}),this.__cache__=null};S.prototype.push=function(e,n,r){const t=r||{};this.__rules__.push({name:e,enabled:!0,fn:n,alt:t.alt||[]}),this.__cache__=null};S.prototype.enable=function(e,n){Array.isArray(e)||(e=[e]);const r=[];return e.forEach(function(t){const o=this.__find__(t);if(o<0){if(n)return;throw new Error("Rules manager: invalid rule name "+t)}this.__rules__[o].enabled=!0,r.push(t)},this),this.__cache__=null,r};S.prototype.enableOnly=function(e,n){Array.isArray(e)||(e=[e]),this.__rules__.forEach(function(r){r.enabled=!1}),this.enable(e,n)};S.prototype.disable=function(e,n){Array.isArray(e)||(e=[e]);const r=[];return e.forEach(function(t){const o=this.__find__(t);if(o<0){if(n)return;throw new Error("Rules manager: invalid rule name "+t)}this.__rules__[o].enabled=!1,r.push(t)},this),this.__cache__=null,r};S.prototype.getRules=function(e){return this.__cache__===null&&this.__compile__(),this.__cache__[e]||[]};function T(e,n,r){this.type=e,this.tag=n,this.attrs=null,this.map=null,this.nesting=r,this.level=0,this.children=null,this.content="",this.markup="",this.info="",this.meta=null,this.block=!1,this.hidden=!1}T.prototype.attrIndex=function(n){if(!this.attrs)return-1;const r=this.attrs;for(let t=0,o=r.length;t<o;t++)if(r[t][0]===n)return t;return-1};T.prototype.attrPush=function(n){this.attrs?this.attrs.push(n):this.attrs=[n]};T.prototype.attrSet=function(n,r){const t=this.attrIndex(n),o=[n,r];t<0?this.attrPush(o):this.attrs[t]=o};T.prototype.attrGet=function(n){const r=this.attrIndex(n);let t=null;return r>=0&&(t=this.attrs[r][1]),t};T.prototype.attrJoin=function(n,r){const t=this.attrIndex(n);t<0?this.attrPush([n,r]):this.attrs[t][1]=this.attrs[t][1]+" "+r};function be(e,n,r){this.src=e,this.env=r,this.tokens=[],this.inlineMode=!1,this.md=n}be.prototype.Token=T;const rn=/\r\n?|\n/g,on=/\0/g;function tn(e){let n;n=e.src.replace(rn,`
|
|
`),n=n.replace(on,"\uFFFD"),e.src=n}function ln(e){let n;e.inlineMode?(n=new e.Token("inline","",0),n.content=e.src,n.map=[0,1],n.children=[],e.tokens.push(n)):e.md.block.parse(e.src,e.md,e.env,e.tokens)}function cn(e){const n=e.tokens;for(let r=0,t=n.length;r<t;r++){const o=n[r];o.type==="inline"&&e.md.inline.parse(o.content,e.md,e.env,o.children)}}function sn(e){return/^<a[>\s]/i.test(e)}function fn(e){return/^<\/a\s*>/i.test(e)}function un(e){const n=e.tokens;if(!!e.md.options.linkify)for(let r=0,t=n.length;r<t;r++){if(n[r].type!=="inline"||!e.md.linkify.pretest(n[r].content))continue;let o=n[r].children,i=0;for(let l=o.length-1;l>=0;l--){const c=o[l];if(c.type==="link_close"){for(l--;o[l].level!==c.level&&o[l].type!=="link_open";)l--;continue}if(c.type==="html_inline"&&(sn(c.content)&&i>0&&i--,fn(c.content)&&i++),!(i>0)&&c.type==="text"&&e.md.linkify.test(c.content)){const s=c.content;let f=e.md.linkify.match(s);const h=[];let p=c.level,k=0;f.length>0&&f[0].index===0&&l>0&&o[l-1].type==="text_special"&&(f=f.slice(1));for(let a=0;a<f.length;a++){const u=f[a].url,C=e.md.normalizeLink(u);if(!e.md.validateLink(C))continue;let _=f[a].text;f[a].schema?f[a].schema==="mailto:"&&!/^mailto:/i.test(_)?_=e.md.normalizeLinkText("mailto:"+_).replace(/^mailto:/,""):_=e.md.normalizeLinkText(_):_=e.md.normalizeLinkText("http://"+_).replace(/^http:\/\//,"");const y=f[a].index;if(y>k){const g=new e.Token("text","",0);g.content=s.slice(k,y),g.level=p,h.push(g)}const d=new e.Token("link_open","a",1);d.attrs=[["href",C]],d.level=p++,d.markup="linkify",d.info="auto",h.push(d);const x=new e.Token("text","",0);x.content=_,x.level=p,h.push(x);const m=new e.Token("link_close","a",-1);m.level=--p,m.markup="linkify",m.info="auto",h.push(m),k=f[a].lastIndex}if(k<s.length){const a=new e.Token("text","",0);a.content=s.slice(k),a.level=p,h.push(a)}n[r].children=o=ge(o,l,h)}}}}const Ce=/\+-|\.\.|\?\?\?\?|!!!!|,,|--/,hn=/\((c|tm|r)\)/i,pn=/\((c|tm|r)\)/ig,an={c:"\xA9",r:"\xAE",tm:"\u2122"};function kn(e,n){return an[n.toLowerCase()]}function dn(e){let n=0;for(let r=e.length-1;r>=0;r--){const t=e[r];t.type==="text"&&!n&&(t.content=t.content.replace(pn,kn)),t.type==="link_open"&&t.info==="auto"&&n--,t.type==="link_close"&&t.info==="auto"&&n++}}function mn(e){let n=0;for(let r=e.length-1;r>=0;r--){const t=e[r];t.type==="text"&&!n&&Ce.test(t.content)&&(t.content=t.content.replace(/\+-/g,"\xB1").replace(/\.{2,}/g,"\u2026").replace(/([?!])…/g,"$1..").replace(/([?!]){4,}/g,"$1$1$1").replace(/,{2,}/g,",").replace(/(^|[^-])---(?=[^-]|$)/mg,"$1\u2014").replace(/(^|\s)--(?=\s|$)/mg,"$1\u2013").replace(/(^|[^-\s])--(?=[^-\s]|$)/mg,"$1\u2013")),t.type==="link_open"&&t.info==="auto"&&n--,t.type==="link_close"&&t.info==="auto"&&n++}}function xn(e){let n;if(!!e.md.options.typographer)for(n=e.tokens.length-1;n>=0;n--)e.tokens[n].type==="inline"&&(hn.test(e.tokens[n].content)&&dn(e.tokens[n].children),Ce.test(e.tokens[n].content)&&mn(e.tokens[n].children))}const gn=/['"]/,le=/['"]/g,ce="\u2019";function Z(e,n,r){return e.slice(0,n)+r+e.slice(n+1)}function _n(e,n){let r;const t=[];for(let o=0;o<e.length;o++){const i=e[o],l=e[o].level;for(r=t.length-1;r>=0&&!(t[r].level<=l);r--);if(t.length=r+1,i.type!=="text")continue;let c=i.content,s=0,f=c.length;e:for(;s<f;){le.lastIndex=s;const h=le.exec(c);if(!h)break;let p=!0,k=!0;s=h.index+1;const a=h[0]==="'";let u=32;if(h.index-1>=0)u=c.charCodeAt(h.index-1);else for(r=o-1;r>=0&&!(e[r].type==="softbreak"||e[r].type==="hardbreak");r--)if(!!e[r].content){u=e[r].content.charCodeAt(e[r].content.length-1);break}let C=32;if(s<f)C=c.charCodeAt(s);else for(r=o+1;r<e.length&&!(e[r].type==="softbreak"||e[r].type==="hardbreak");r++)if(!!e[r].content){C=e[r].content.charCodeAt(0);break}const _=j(u)||B(String.fromCharCode(u)),y=j(C)||B(String.fromCharCode(C)),d=$(u),x=$(C);if(x?p=!1:y&&(d||_||(p=!1)),d?k=!1:_&&(x||y||(k=!1)),C===34&&h[0]==='"'&&u>=48&&u<=57&&(k=p=!1),p&&k&&(p=_,k=y),!p&&!k){a&&(i.content=Z(i.content,h.index,ce));continue}if(k)for(r=t.length-1;r>=0;r--){let m=t[r];if(t[r].level<l)break;if(m.single===a&&t[r].level===l){m=t[r];let g,b;a?(g=n.md.options.quotes[2],b=n.md.options.quotes[3]):(g=n.md.options.quotes[0],b=n.md.options.quotes[1]),i.content=Z(i.content,h.index,b),e[m.token].content=Z(e[m.token].content,m.pos,g),s+=b.length-1,m.token===o&&(s+=g.length-1),c=i.content,f=c.length,t.length=r;continue e}}p?t.push({token:o,pos:h.index,single:a,level:l}):k&&a&&(i.content=Z(i.content,h.index,ce))}}}function bn(e){if(!!e.md.options.typographer)for(let n=e.tokens.length-1;n>=0;n--)e.tokens[n].type!=="inline"||!gn.test(e.tokens[n].content)||_n(e.tokens[n].children,e)}function Cn(e){let n,r;const t=e.tokens,o=t.length;for(let i=0;i<o;i++){if(t[i].type!=="inline")continue;const l=t[i].children,c=l.length;for(n=0;n<c;n++)l[n].type==="text_special"&&(l[n].type="text");for(n=r=0;n<c;n++)l[n].type==="text"&&n+1<c&&l[n+1].type==="text"?l[n+1].content=l[n].content+l[n+1].content:(n!==r&&(l[r]=l[n]),r++);n!==r&&(l.length=r)}}const V=[["normalize",tn],["block",ln],["inline",cn],["linkify",un],["replacements",xn],["smartquotes",bn],["text_join",Cn]];function re(){this.ruler=new S;for(let e=0;e<V.length;e++)this.ruler.push(V[e][0],V[e][1])}re.prototype.process=function(e){const n=this.ruler.getRules("");for(let r=0,t=n.length;r<t;r++)n[r](e)};re.prototype.State=be;function v(e,n,r,t){this.src=e,this.md=n,this.env=r,this.tokens=t,this.bMarks=[],this.eMarks=[],this.tShift=[],this.sCount=[],this.bsCount=[],this.blkIndent=0,this.line=0,this.lineMax=0,this.tight=!1,this.ddIndent=-1,this.listIndent=-1,this.parentType="root",this.level=0;const o=this.src;for(let i=0,l=0,c=0,s=0,f=o.length,h=!1;l<f;l++){const p=o.charCodeAt(l);if(!h)if(A(p)){c++,p===9?s+=4-s%4:s++;continue}else h=!0;(p===10||l===f-1)&&(p!==10&&l++,this.bMarks.push(i),this.eMarks.push(l),this.tShift.push(c),this.sCount.push(s),this.bsCount.push(0),h=!1,c=0,s=0,i=l+1)}this.bMarks.push(o.length),this.eMarks.push(o.length),this.tShift.push(0),this.sCount.push(0),this.bsCount.push(0),this.lineMax=this.bMarks.length-1}v.prototype.push=function(e,n,r){const t=new T(e,n,r);return t.block=!0,r<0&&this.level--,t.level=this.level,r>0&&this.level++,this.tokens.push(t),t};v.prototype.isEmpty=function(n){return this.bMarks[n]+this.tShift[n]>=this.eMarks[n]};v.prototype.skipEmptyLines=function(n){for(let r=this.lineMax;n<r&&!(this.bMarks[n]+this.tShift[n]<this.eMarks[n]);n++);return n};v.prototype.skipSpaces=function(n){for(let r=this.src.length;n<r;n++){const t=this.src.charCodeAt(n);if(!A(t))break}return n};v.prototype.skipSpacesBack=function(n,r){if(n<=r)return n;for(;n>r;)if(!A(this.src.charCodeAt(--n)))return n+1;return n};v.prototype.skipChars=function(n,r){for(let t=this.src.length;n<t&&this.src.charCodeAt(n)===r;n++);return n};v.prototype.skipCharsBack=function(n,r,t){if(n<=t)return n;for(;n>t;)if(r!==this.src.charCodeAt(--n))return n+1;return n};v.prototype.getLines=function(n,r,t,o){if(n>=r)return"";const i=new Array(r-n);for(let l=0,c=n;c<r;c++,l++){let s=0;const f=this.bMarks[c];let h=f,p;for(c+1<r||o?p=this.eMarks[c]+1:p=this.eMarks[c];h<p&&s<t;){const k=this.src.charCodeAt(h);if(A(k))k===9?s+=4-(s+this.bsCount[c])%4:s++;else if(h-f<this.tShift[c])s++;else break;h++}s>t?i[l]=new Array(s-t+1).join(" ")+this.src.slice(h,p):i[l]=this.src.slice(h,p)}return i.join("")};v.prototype.Token=T;const An=65536;function X(e,n){const r=e.bMarks[n]+e.tShift[n],t=e.eMarks[n];return e.src.slice(r,t)}function se(e){const n=[],r=e.length;let t=0,o=e.charCodeAt(t),i=!1,l=0,c="";for(;t<r;)o===124&&(i?(c+=e.substring(l,t-1),l=t):(n.push(c+e.substring(l,t)),c="",l=t+1)),i=o===92,t++,o=e.charCodeAt(t);return n.push(c+e.substring(l)),n}function yn(e,n,r,t){if(n+2>r)return!1;let o=n+1;if(e.sCount[o]<e.blkIndent||e.sCount[o]-e.blkIndent>=4)return!1;let i=e.bMarks[o]+e.tShift[o];if(i>=e.eMarks[o])return!1;const l=e.src.charCodeAt(i++);if(l!==124&&l!==45&&l!==58||i>=e.eMarks[o])return!1;const c=e.src.charCodeAt(i++);if(c!==124&&c!==45&&c!==58&&!A(c)||l===45&&A(c))return!1;for(;i<e.eMarks[o];){const m=e.src.charCodeAt(i);if(m!==124&&m!==45&&m!==58&&!A(m))return!1;i++}let s=X(e,n+1),f=s.split("|");const h=[];for(let m=0;m<f.length;m++){const g=f[m].trim();if(!g){if(m===0||m===f.length-1)continue;return!1}if(!/^:?-+:?$/.test(g))return!1;g.charCodeAt(g.length-1)===58?h.push(g.charCodeAt(0)===58?"center":"right"):g.charCodeAt(0)===58?h.push("left"):h.push("")}if(s=X(e,n).trim(),s.indexOf("|")===-1||e.sCount[n]-e.blkIndent>=4)return!1;f=se(s),f.length&&f[0]===""&&f.shift(),f.length&&f[f.length-1]===""&&f.pop();const p=f.length;if(p===0||p!==h.length)return!1;if(t)return!0;const k=e.parentType;e.parentType="table";const a=e.md.block.ruler.getRules("blockquote"),u=e.push("table_open","table",1),C=[n,0];u.map=C;const _=e.push("thead_open","thead",1);_.map=[n,n+1];const y=e.push("tr_open","tr",1);y.map=[n,n+1];for(let m=0;m<f.length;m++){const g=e.push("th_open","th",1);h[m]&&(g.attrs=[["style","text-align:"+h[m]]]);const b=e.push("inline","",0);b.content=f[m].trim(),b.children=[],e.push("th_close","th",-1)}e.push("tr_close","tr",-1),e.push("thead_close","thead",-1);let d,x=0;for(o=n+2;o<r&&!(e.sCount[o]<e.blkIndent);o++){let m=!1;for(let b=0,E=a.length;b<E;b++)if(a[b](e,o,r,!0)){m=!0;break}if(m||(s=X(e,o).trim(),!s)||e.sCount[o]-e.blkIndent>=4||(f=se(s),f.length&&f[0]===""&&f.shift(),f.length&&f[f.length-1]===""&&f.pop(),x+=p-f.length,x>An))break;if(o===n+2){const b=e.push("tbody_open","tbody",1);b.map=d=[n+2,0]}const g=e.push("tr_open","tr",1);g.map=[o,o+1];for(let b=0;b<p;b++){const E=e.push("td_open","td",1);h[b]&&(E.attrs=[["style","text-align:"+h[b]]]);const M=e.push("inline","",0);M.content=f[b]?f[b].trim():"",M.children=[],e.push("td_close","td",-1)}e.push("tr_close","tr",-1)}return d&&(e.push("tbody_close","tbody",-1),d[1]=o),e.push("table_close","table",-1),C[1]=o,e.parentType=k,e.line=o,!0}function En(e,n,r){if(e.sCount[n]-e.blkIndent<4)return!1;let t=n+1,o=t;for(;t<r;){if(e.isEmpty(t)){t++;continue}if(e.sCount[t]-e.blkIndent>=4){t++,o=t;continue}break}e.line=o;const i=e.push("code_block","code",0);return i.content=e.getLines(n,o,4+e.blkIndent,!1)+`
|
|
`,i.map=[n,e.line],!0}function Sn(e,n,r,t){let o=e.bMarks[n]+e.tShift[n],i=e.eMarks[n];if(e.sCount[n]-e.blkIndent>=4||o+3>i)return!1;const l=e.src.charCodeAt(o);if(l!==126&&l!==96)return!1;let c=o;o=e.skipChars(o,l);let s=o-c;if(s<3)return!1;const f=e.src.slice(c,o),h=e.src.slice(o,i);if(l===96&&h.indexOf(String.fromCharCode(l))>=0)return!1;if(t)return!0;let p=n,k=!1;for(;p++,!(p>=r||(o=c=e.bMarks[p]+e.tShift[p],i=e.eMarks[p],o<i&&e.sCount[p]<e.blkIndent));)if(e.src.charCodeAt(o)===l&&!(e.sCount[p]-e.blkIndent>=4)&&(o=e.skipChars(o,l),!(o-c<s)&&(o=e.skipSpaces(o),!(o<i)))){k=!0;break}s=e.sCount[n],e.line=p+(k?1:0);const a=e.push("fence","code",0);return a.info=h,a.content=e.getLines(n+1,p,s,!0),a.markup=f,a.map=[n,e.line],!0}function Mn(e,n,r,t){let o=e.bMarks[n]+e.tShift[n],i=e.eMarks[n];const l=e.lineMax;if(e.sCount[n]-e.blkIndent>=4||e.src.charCodeAt(o)!==62)return!1;if(t)return!0;const c=[],s=[],f=[],h=[],p=e.md.block.ruler.getRules("blockquote"),k=e.parentType;e.parentType="blockquote";let a=!1,u;for(u=n;u<r;u++){const x=e.sCount[u]<e.blkIndent;if(o=e.bMarks[u]+e.tShift[u],i=e.eMarks[u],o>=i)break;if(e.src.charCodeAt(o++)===62&&!x){let g=e.sCount[u]+1,b,E;e.src.charCodeAt(o)===32?(o++,g++,E=!1,b=!0):e.src.charCodeAt(o)===9?(b=!0,(e.bsCount[u]+g)%4===3?(o++,g++,E=!1):E=!0):b=!1;let M=g;for(c.push(e.bMarks[u]),e.bMarks[u]=o;o<i;){const P=e.src.charCodeAt(o);if(A(P))P===9?M+=4-(M+e.bsCount[u]+(E?1:0))%4:M++;else break;o++}a=o>=i,s.push(e.bsCount[u]),e.bsCount[u]=e.sCount[u]+1+(b?1:0),f.push(e.sCount[u]),e.sCount[u]=M-g,h.push(e.tShift[u]),e.tShift[u]=o-e.bMarks[u];continue}if(a)break;let m=!1;for(let g=0,b=p.length;g<b;g++)if(p[g](e,u,r,!0)){m=!0;break}if(m){e.lineMax=u,e.blkIndent!==0&&(c.push(e.bMarks[u]),s.push(e.bsCount[u]),h.push(e.tShift[u]),f.push(e.sCount[u]),e.sCount[u]-=e.blkIndent);break}c.push(e.bMarks[u]),s.push(e.bsCount[u]),h.push(e.tShift[u]),f.push(e.sCount[u]),e.sCount[u]=-1}const C=e.blkIndent;e.blkIndent=0;const _=e.push("blockquote_open","blockquote",1);_.markup=">";const y=[n,0];_.map=y,e.md.block.tokenize(e,n,u);const d=e.push("blockquote_close","blockquote",-1);d.markup=">",e.lineMax=l,e.parentType=k,y[1]=e.line;for(let x=0;x<h.length;x++)e.bMarks[x+n]=c[x],e.tShift[x+n]=h[x],e.sCount[x+n]=f[x],e.bsCount[x+n]=s[x];return e.blkIndent=C,!0}function wn(e,n,r,t){const o=e.eMarks[n];if(e.sCount[n]-e.blkIndent>=4)return!1;let i=e.bMarks[n]+e.tShift[n];const l=e.src.charCodeAt(i++);if(l!==42&&l!==45&&l!==95)return!1;let c=1;for(;i<o;){const f=e.src.charCodeAt(i++);if(f!==l&&!A(f))return!1;f===l&&c++}if(c<3)return!1;if(t)return!0;e.line=n+1;const s=e.push("hr","hr",0);return s.map=[n,e.line],s.markup=Array(c+1).join(String.fromCharCode(l)),!0}function fe(e,n){const r=e.eMarks[n];let t=e.bMarks[n]+e.tShift[n];const o=e.src.charCodeAt(t++);if(o!==42&&o!==45&&o!==43)return-1;if(t<r){const i=e.src.charCodeAt(t);if(!A(i))return-1}return t}function ue(e,n){const r=e.bMarks[n]+e.tShift[n],t=e.eMarks[n];let o=r;if(o+1>=t)return-1;let i=e.src.charCodeAt(o++);if(i<48||i>57)return-1;for(;;){if(o>=t)return-1;if(i=e.src.charCodeAt(o++),i>=48&&i<=57){if(o-r>=10)return-1;continue}if(i===41||i===46)break;return-1}return o<t&&(i=e.src.charCodeAt(o),!A(i))?-1:o}function Tn(e,n){const r=e.level+2;for(let t=n+2,o=e.tokens.length-2;t<o;t++)e.tokens[t].level===r&&e.tokens[t].type==="paragraph_open"&&(e.tokens[t+2].hidden=!0,e.tokens[t].hidden=!0,t+=2)}function In(e,n,r,t){let o,i,l,c,s=n,f=!0;if(e.sCount[s]-e.blkIndent>=4||e.listIndent>=0&&e.sCount[s]-e.listIndent>=4&&e.sCount[s]<e.blkIndent)return!1;let h=!1;t&&e.parentType==="paragraph"&&e.sCount[s]>=e.blkIndent&&(h=!0);let p,k,a;if((a=ue(e,s))>=0){if(p=!0,l=e.bMarks[s]+e.tShift[s],k=Number(e.src.slice(l,a-1)),h&&k!==1)return!1}else if((a=fe(e,s))>=0)p=!1;else return!1;if(h&&e.skipSpaces(a)>=e.eMarks[s])return!1;if(t)return!0;const u=e.src.charCodeAt(a-1),C=e.tokens.length;p?(c=e.push("ordered_list_open","ol",1),k!==1&&(c.attrs=[["start",k]])):c=e.push("bullet_list_open","ul",1);const _=[s,0];c.map=_,c.markup=String.fromCharCode(u);let y=!1;const d=e.md.block.ruler.getRules("list"),x=e.parentType;for(e.parentType="list";s<r;){i=a,o=e.eMarks[s];const m=e.sCount[s]+a-(e.bMarks[s]+e.tShift[s]);let g=m;for(;i<o;){const z=e.src.charCodeAt(i);if(z===9)g+=4-(g+e.bsCount[s])%4;else if(z===32)g++;else break;i++}const b=i;let E;b>=o?E=1:E=g-m,E>4&&(E=1);const M=m+E;c=e.push("list_item_open","li",1),c.markup=String.fromCharCode(u);const P=[s,0];c.map=P,p&&(c.info=e.src.slice(l,a-1));const L=e.tight,J=e.tShift[s],we=e.sCount[s],Te=e.listIndent;if(e.listIndent=e.blkIndent,e.blkIndent=M,e.tight=!0,e.tShift[s]=b-e.bMarks[s],e.sCount[s]=g,b>=o&&e.isEmpty(s+1)?e.line=Math.min(e.line+2,r):e.md.block.tokenize(e,s,r,!0),(!e.tight||y)&&(f=!1),y=e.line-s>1&&e.isEmpty(e.line-1),e.blkIndent=e.listIndent,e.listIndent=Te,e.tShift[s]=J,e.sCount[s]=we,e.tight=L,c=e.push("list_item_close","li",-1),c.markup=String.fromCharCode(u),s=e.line,P[1]=s,s>=r||e.sCount[s]<e.blkIndent||e.sCount[s]-e.blkIndent>=4)break;let ie=!1;for(let z=0,Ie=d.length;z<Ie;z++)if(d[z](e,s,r,!0)){ie=!0;break}if(ie)break;if(p){if(a=ue(e,s),a<0)break;l=e.bMarks[s]+e.tShift[s]}else if(a=fe(e,s),a<0)break;if(u!==e.src.charCodeAt(a-1))break}return p?c=e.push("ordered_list_close","ol",-1):c=e.push("bullet_list_close","ul",-1),c.markup=String.fromCharCode(u),_[1]=s,e.line=s,e.parentType=x,f&&Tn(e,C),!0}function vn(e,n,r,t){let o=e.bMarks[n]+e.tShift[n],i=e.eMarks[n],l=n+1;if(e.sCount[n]-e.blkIndent>=4||e.src.charCodeAt(o)!==91)return!1;function c(d){const x=e.lineMax;if(d>=x||e.isEmpty(d))return null;let m=!1;if(e.sCount[d]-e.blkIndent>3&&(m=!0),e.sCount[d]<0&&(m=!0),!m){const E=e.md.block.ruler.getRules("reference"),M=e.parentType;e.parentType="reference";let P=!1;for(let L=0,J=E.length;L<J;L++)if(E[L](e,d,x,!0)){P=!0;break}if(e.parentType=M,P)return null}const g=e.bMarks[d]+e.tShift[d],b=e.eMarks[d];return e.src.slice(g,b+1)}let s=e.src.slice(o,i+1);i=s.length;let f=-1;for(o=1;o<i;o++){const d=s.charCodeAt(o);if(d===91)return!1;if(d===93){f=o;break}else if(d===10){const x=c(l);x!==null&&(s+=x,i=s.length,l++)}else if(d===92&&(o++,o<i&&s.charCodeAt(o)===10)){const x=c(l);x!==null&&(s+=x,i=s.length,l++)}}if(f<0||s.charCodeAt(f+1)!==58)return!1;for(o=f+2;o<i;o++){const d=s.charCodeAt(o);if(d===10){const x=c(l);x!==null&&(s+=x,i=s.length,l++)}else if(!A(d))break}const h=e.md.helpers.parseLinkDestination(s,o,i);if(!h.ok)return!1;const p=e.md.normalizeLink(h.str);if(!e.md.validateLink(p))return!1;o=h.pos;const k=o,a=l,u=o;for(;o<i;o++){const d=s.charCodeAt(o);if(d===10){const x=c(l);x!==null&&(s+=x,i=s.length,l++)}else if(!A(d))break}let C=e.md.helpers.parseLinkTitle(s,o,i);for(;C.can_continue;){const d=c(l);if(d===null)break;s+=d,o=i,i=s.length,l++,C=e.md.helpers.parseLinkTitle(s,o,i,C)}let _;for(o<i&&u!==o&&C.ok?(_=C.str,o=C.pos):(_="",o=k,l=a);o<i;){const d=s.charCodeAt(o);if(!A(d))break;o++}if(o<i&&s.charCodeAt(o)!==10&&_)for(_="",o=k,l=a;o<i;){const d=s.charCodeAt(o);if(!A(d))break;o++}if(o<i&&s.charCodeAt(o)!==10)return!1;const y=W(s.slice(1,f));return y?(t||(typeof e.env.references=="undefined"&&(e.env.references={}),typeof e.env.references[y]=="undefined"&&(e.env.references[y]={title:_,href:p}),e.line=l),!0):!1}var Pn=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"];const Rn="[a-zA-Z_:][a-zA-Z0-9:._-]*",zn="[^\"'=<>`\\x00-\\x20]+",On="'[^']*'",Dn='"[^"]*"',Fn="(?:"+zn+"|"+On+"|"+Dn+")",Ln="(?:\\s+"+Rn+"(?:\\s*=\\s*"+Fn+")?)",Ae="<[A-Za-z][A-Za-z0-9\\-]*"+Ln+"*\\s*\\/?>",ye="<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>",$n="<!---?>|<!--(?:[^-]|-[^-]|--[^>])*-->",Bn="<[?][\\s\\S]*?[?]>",jn="<![A-Za-z][^>]*>",qn="<!\\[CDATA\\[[\\s\\S]*?\\]\\]>",Nn=new RegExp("^(?:"+Ae+"|"+ye+"|"+$n+"|"+Bn+"|"+jn+"|"+qn+")"),Zn=new RegExp("^(?:"+Ae+"|"+ye+")"),O=[[/^<(script|pre|style|textarea)(?=(\s|>|$))/i,/<\/(script|pre|style|textarea)>/i,!0],[/^<!--/,/-->/,!0],[/^<\?/,/\?>/,!0],[/^<![A-Z]/,/>/,!0],[/^<!\[CDATA\[/,/\]\]>/,!0],[new RegExp("^</?("+Pn.join("|")+")(?=(\\s|/?>|$))","i"),/^$/,!0],[new RegExp(Zn.source+"\\s*$"),/^$/,!1]];function Un(e,n,r,t){let o=e.bMarks[n]+e.tShift[n],i=e.eMarks[n];if(e.sCount[n]-e.blkIndent>=4||!e.md.options.html||e.src.charCodeAt(o)!==60)return!1;let l=e.src.slice(o,i),c=0;for(;c<O.length&&!O[c][0].test(l);c++);if(c===O.length)return!1;if(t)return O[c][2];let s=n+1;if(!O[c][1].test(l)){for(;s<r&&!(e.sCount[s]<e.blkIndent);s++)if(o=e.bMarks[s]+e.tShift[s],i=e.eMarks[s],l=e.src.slice(o,i),O[c][1].test(l)){l.length!==0&&s++;break}}e.line=s;const f=e.push("html_block","",0);return f.map=[n,s],f.content=e.getLines(n,s,e.blkIndent,!0),!0}function Hn(e,n,r,t){let o=e.bMarks[n]+e.tShift[n],i=e.eMarks[n];if(e.sCount[n]-e.blkIndent>=4)return!1;let l=e.src.charCodeAt(o);if(l!==35||o>=i)return!1;let c=1;for(l=e.src.charCodeAt(++o);l===35&&o<i&&c<=6;)c++,l=e.src.charCodeAt(++o);if(c>6||o<i&&!A(l))return!1;if(t)return!0;i=e.skipSpacesBack(i,o);const s=e.skipCharsBack(i,35,o);s>o&&A(e.src.charCodeAt(s-1))&&(i=s),e.line=n+1;const f=e.push("heading_open","h"+String(c),1);f.markup="########".slice(0,c),f.map=[n,e.line];const h=e.push("inline","",0);h.content=e.src.slice(o,i).trim(),h.map=[n,e.line],h.children=[];const p=e.push("heading_close","h"+String(c),-1);return p.markup="########".slice(0,c),!0}function Gn(e,n,r){const t=e.md.block.ruler.getRules("paragraph");if(e.sCount[n]-e.blkIndent>=4)return!1;const o=e.parentType;e.parentType="paragraph";let i=0,l,c=n+1;for(;c<r&&!e.isEmpty(c);c++){if(e.sCount[c]-e.blkIndent>3)continue;if(e.sCount[c]>=e.blkIndent){let a=e.bMarks[c]+e.tShift[c];const u=e.eMarks[c];if(a<u&&(l=e.src.charCodeAt(a),(l===45||l===61)&&(a=e.skipChars(a,l),a=e.skipSpaces(a),a>=u))){i=l===61?1:2;break}}if(e.sCount[c]<0)continue;let k=!1;for(let a=0,u=t.length;a<u;a++)if(t[a](e,c,r,!0)){k=!0;break}if(k)break}if(!i)return!1;const s=e.getLines(n,c,e.blkIndent,!1).trim();e.line=c+1;const f=e.push("heading_open","h"+String(i),1);f.markup=String.fromCharCode(l),f.map=[n,e.line];const h=e.push("inline","",0);h.content=s,h.map=[n,e.line-1],h.children=[];const p=e.push("heading_close","h"+String(i),-1);return p.markup=String.fromCharCode(l),e.parentType=o,!0}function Wn(e,n,r){const t=e.md.block.ruler.getRules("paragraph"),o=e.parentType;let i=n+1;for(e.parentType="paragraph";i<r&&!e.isEmpty(i);i++){if(e.sCount[i]-e.blkIndent>3||e.sCount[i]<0)continue;let f=!1;for(let h=0,p=t.length;h<p;h++)if(t[h](e,i,r,!0)){f=!0;break}if(f)break}const l=e.getLines(n,i,e.blkIndent,!1).trim();e.line=i;const c=e.push("paragraph_open","p",1);c.map=[n,e.line];const s=e.push("inline","",0);return s.content=l,s.map=[n,e.line],s.children=[],e.push("paragraph_close","p",-1),e.parentType=o,!0}const U=[["table",yn,["paragraph","reference"]],["code",En],["fence",Sn,["paragraph","reference","blockquote","list"]],["blockquote",Mn,["paragraph","reference","blockquote","list"]],["hr",wn,["paragraph","reference","blockquote","list"]],["list",In,["paragraph","reference","blockquote"]],["reference",vn],["html_block",Un,["paragraph","reference","blockquote"]],["heading",Hn,["paragraph","reference","blockquote"]],["lheading",Gn],["paragraph",Wn]];function Q(){this.ruler=new S;for(let e=0;e<U.length;e++)this.ruler.push(U[e][0],U[e][1],{alt:(U[e][2]||[]).slice()})}Q.prototype.tokenize=function(e,n,r){const t=this.ruler.getRules(""),o=t.length,i=e.md.options.maxNesting;let l=n,c=!1;for(;l<r&&(e.line=l=e.skipEmptyLines(l),!(l>=r||e.sCount[l]<e.blkIndent));){if(e.level>=i){e.line=r;break}const s=e.line;let f=!1;for(let h=0;h<o;h++)if(f=t[h](e,l,r,!1),f){if(s>=e.line)throw new Error("block rule didn't increment state.line");break}if(!f)throw new Error("none of the block rules matched");e.tight=!c,e.isEmpty(e.line-1)&&(c=!0),l=e.line,l<r&&e.isEmpty(l)&&(c=!0,l++,e.line=l)}};Q.prototype.parse=function(e,n,r,t){if(!e)return;const o=new this.State(e,n,r,t);this.tokenize(o,o.line,o.lineMax)};Q.prototype.State=v;function q(e,n,r,t){this.src=e,this.env=r,this.md=n,this.tokens=t,this.tokens_meta=Array(t.length),this.pos=0,this.posMax=this.src.length,this.level=0,this.pending="",this.pendingLevel=0,this.cache={},this.delimiters=[],this._prev_delimiters=[],this.backticks={},this.backticksScanned=!1,this.linkLevel=0}q.prototype.pushPending=function(){const e=new T("text","",0);return e.content=this.pending,e.level=this.pendingLevel,this.tokens.push(e),this.pending="",e};q.prototype.push=function(e,n,r){this.pending&&this.pushPending();const t=new T(e,n,r);let o=null;return r<0&&(this.level--,this.delimiters=this._prev_delimiters.pop()),t.level=this.level,r>0&&(this.level++,this._prev_delimiters.push(this.delimiters),this.delimiters=[],o={delimiters:this.delimiters}),this.pendingLevel=this.level,this.tokens.push(t),this.tokens_meta.push(o),t};q.prototype.scanDelims=function(e,n){const r=this.posMax,t=this.src.charCodeAt(e),o=e>0?this.src.charCodeAt(e-1):32;let i=e;for(;i<r&&this.src.charCodeAt(i)===t;)i++;const l=i-e,c=i<r?this.src.charCodeAt(i):32,s=j(o)||B(String.fromCharCode(o)),f=j(c)||B(String.fromCharCode(c)),h=$(o),p=$(c),k=!p&&(!f||h||s),a=!h&&(!s||p||f);return{can_open:k&&(n||!a||s),can_close:a&&(n||!k||f),length:l}};q.prototype.Token=T;function Qn(e){switch(e){case 10:case 33:case 35:case 36:case 37:case 38:case 42:case 43:case 45:case 58:case 60:case 61:case 62:case 64:case 91:case 92:case 93:case 94:case 95:case 96:case 123:case 125:case 126:return!0;default:return!1}}function Jn(e,n){let r=e.pos;for(;r<e.posMax&&!Qn(e.src.charCodeAt(r));)r++;return r===e.pos?!1:(n||(e.pending+=e.src.slice(e.pos,r)),e.pos=r,!0)}const Vn=/(?:^|[^a-z0-9.+-])([a-z][a-z0-9.+-]*)$/i;function Xn(e,n){if(!e.md.options.linkify||e.linkLevel>0)return!1;const r=e.pos,t=e.posMax;if(r+3>t||e.src.charCodeAt(r)!==58||e.src.charCodeAt(r+1)!==47||e.src.charCodeAt(r+2)!==47)return!1;const o=e.pending.match(Vn);if(!o)return!1;const i=o[1],l=e.md.linkify.matchAtStart(e.src.slice(r-i.length));if(!l)return!1;let c=l.url;if(c.length<=i.length)return!1;c=c.replace(/\*+$/,"");const s=e.md.normalizeLink(c);if(!e.md.validateLink(s))return!1;if(!n){e.pending=e.pending.slice(0,-i.length);const f=e.push("link_open","a",1);f.attrs=[["href",s]],f.markup="linkify",f.info="auto";const h=e.push("text","",0);h.content=e.md.normalizeLinkText(c);const p=e.push("link_close","a",-1);p.markup="linkify",p.info="auto"}return e.pos+=c.length-i.length,!0}function Yn(e,n){let r=e.pos;if(e.src.charCodeAt(r)!==10)return!1;const t=e.pending.length-1,o=e.posMax;if(!n)if(t>=0&&e.pending.charCodeAt(t)===32)if(t>=1&&e.pending.charCodeAt(t-1)===32){let i=t-1;for(;i>=1&&e.pending.charCodeAt(i-1)===32;)i--;e.pending=e.pending.slice(0,i),e.push("hardbreak","br",0)}else e.pending=e.pending.slice(0,-1),e.push("softbreak","br",0);else e.push("softbreak","br",0);for(r++;r<o&&A(e.src.charCodeAt(r));)r++;return e.pos=r,!0}const oe=[];for(let e=0;e<256;e++)oe.push(0);"\\!\"#$%&'()*+,./:;<=>?@[]^_`{|}~-".split("").forEach(function(e){oe[e.charCodeAt(0)]=1});function Kn(e,n){let r=e.pos;const t=e.posMax;if(e.src.charCodeAt(r)!==92||(r++,r>=t))return!1;let o=e.src.charCodeAt(r);if(o===10){for(n||e.push("hardbreak","br",0),r++;r<t&&(o=e.src.charCodeAt(r),!!A(o));)r++;return e.pos=r,!0}let i=e.src[r];if(o>=55296&&o<=56319&&r+1<t){const c=e.src.charCodeAt(r+1);c>=56320&&c<=57343&&(i+=e.src[r+1],r++)}const l="\\"+i;if(!n){const c=e.push("text_special","",0);o<256&&oe[o]!==0?c.content=i:c.content=l,c.markup=l,c.info="escape"}return e.pos=r+1,!0}function er(e,n){let r=e.pos;if(e.src.charCodeAt(r)!==96)return!1;const o=r;r++;const i=e.posMax;for(;r<i&&e.src.charCodeAt(r)===96;)r++;const l=e.src.slice(o,r),c=l.length;if(e.backticksScanned&&(e.backticks[c]||0)<=o)return n||(e.pending+=l),e.pos+=c,!0;let s=r,f;for(;(f=e.src.indexOf("`",s))!==-1;){for(s=f+1;s<i&&e.src.charCodeAt(s)===96;)s++;const h=s-f;if(h===c){if(!n){const p=e.push("code_inline","code",0);p.markup=l,p.content=e.src.slice(r,f).replace(/\n/g," ").replace(/^ (.+) $/,"$1")}return e.pos=s,!0}e.backticks[h]=f}return e.backticksScanned=!0,n||(e.pending+=l),e.pos+=c,!0}function nr(e,n){const r=e.pos,t=e.src.charCodeAt(r);if(n||t!==126)return!1;const o=e.scanDelims(e.pos,!0);let i=o.length;const l=String.fromCharCode(t);if(i<2)return!1;let c;i%2&&(c=e.push("text","",0),c.content=l,i--);for(let s=0;s<i;s+=2)c=e.push("text","",0),c.content=l+l,e.delimiters.push({marker:t,length:0,token:e.tokens.length-1,end:-1,open:o.can_open,close:o.can_close});return e.pos+=o.length,!0}function he(e,n){let r;const t=[],o=n.length;for(let i=0;i<o;i++){const l=n[i];if(l.marker!==126||l.end===-1)continue;const c=n[l.end];r=e.tokens[l.token],r.type="s_open",r.tag="s",r.nesting=1,r.markup="~~",r.content="",r=e.tokens[c.token],r.type="s_close",r.tag="s",r.nesting=-1,r.markup="~~",r.content="",e.tokens[c.token-1].type==="text"&&e.tokens[c.token-1].content==="~"&&t.push(c.token-1)}for(;t.length;){const i=t.pop();let l=i+1;for(;l<e.tokens.length&&e.tokens[l].type==="s_close";)l++;l--,i!==l&&(r=e.tokens[l],e.tokens[l]=e.tokens[i],e.tokens[i]=r)}}function rr(e){const n=e.tokens_meta,r=e.tokens_meta.length;he(e,e.delimiters);for(let t=0;t<r;t++)n[t]&&n[t].delimiters&&he(e,n[t].delimiters)}var Ee={tokenize:nr,postProcess:rr};function or(e,n){const r=e.pos,t=e.src.charCodeAt(r);if(n||t!==95&&t!==42)return!1;const o=e.scanDelims(e.pos,t===42);for(let i=0;i<o.length;i++){const l=e.push("text","",0);l.content=String.fromCharCode(t),e.delimiters.push({marker:t,length:o.length,token:e.tokens.length-1,end:-1,open:o.can_open,close:o.can_close})}return e.pos+=o.length,!0}function pe(e,n){const r=n.length;for(let t=r-1;t>=0;t--){const o=n[t];if(o.marker!==95&&o.marker!==42||o.end===-1)continue;const i=n[o.end],l=t>0&&n[t-1].end===o.end+1&&n[t-1].marker===o.marker&&n[t-1].token===o.token-1&&n[o.end+1].token===i.token+1,c=String.fromCharCode(o.marker),s=e.tokens[o.token];s.type=l?"strong_open":"em_open",s.tag=l?"strong":"em",s.nesting=1,s.markup=l?c+c:c,s.content="";const f=e.tokens[i.token];f.type=l?"strong_close":"em_close",f.tag=l?"strong":"em",f.nesting=-1,f.markup=l?c+c:c,f.content="",l&&(e.tokens[n[t-1].token].content="",e.tokens[n[o.end+1].token].content="",t--)}}function ir(e){const n=e.tokens_meta,r=e.tokens_meta.length;pe(e,e.delimiters);for(let t=0;t<r;t++)n[t]&&n[t].delimiters&&pe(e,n[t].delimiters)}var Se={tokenize:or,postProcess:ir};function tr(e,n){let r,t,o,i,l="",c="",s=e.pos,f=!0;if(e.src.charCodeAt(e.pos)!==91)return!1;const h=e.pos,p=e.posMax,k=e.pos+1,a=e.md.helpers.parseLinkLabel(e,e.pos,!0);if(a<0)return!1;let u=a+1;if(u<p&&e.src.charCodeAt(u)===40){for(f=!1,u++;u<p&&(r=e.src.charCodeAt(u),!(!A(r)&&r!==10));u++);if(u>=p)return!1;if(s=u,o=e.md.helpers.parseLinkDestination(e.src,u,e.posMax),o.ok){for(l=e.md.normalizeLink(o.str),e.md.validateLink(l)?u=o.pos:l="",s=u;u<p&&(r=e.src.charCodeAt(u),!(!A(r)&&r!==10));u++);if(o=e.md.helpers.parseLinkTitle(e.src,u,e.posMax),u<p&&s!==u&&o.ok)for(c=o.str,u=o.pos;u<p&&(r=e.src.charCodeAt(u),!(!A(r)&&r!==10));u++);}(u>=p||e.src.charCodeAt(u)!==41)&&(f=!0),u++}if(f){if(typeof e.env.references=="undefined")return!1;if(u<p&&e.src.charCodeAt(u)===91?(s=u+1,u=e.md.helpers.parseLinkLabel(e,u),u>=0?t=e.src.slice(s,u++):u=a+1):u=a+1,t||(t=e.src.slice(k,a)),i=e.env.references[W(t)],!i)return e.pos=h,!1;l=i.href,c=i.title}if(!n){e.pos=k,e.posMax=a;const C=e.push("link_open","a",1),_=[["href",l]];C.attrs=_,c&&_.push(["title",c]),e.linkLevel++,e.md.inline.tokenize(e),e.linkLevel--,e.push("link_close","a",-1)}return e.pos=u,e.posMax=p,!0}function lr(e,n){let r,t,o,i,l,c,s,f,h="";const p=e.pos,k=e.posMax;if(e.src.charCodeAt(e.pos)!==33||e.src.charCodeAt(e.pos+1)!==91)return!1;const a=e.pos+2,u=e.md.helpers.parseLinkLabel(e,e.pos+1,!1);if(u<0)return!1;if(i=u+1,i<k&&e.src.charCodeAt(i)===40){for(i++;i<k&&(r=e.src.charCodeAt(i),!(!A(r)&&r!==10));i++);if(i>=k)return!1;for(f=i,c=e.md.helpers.parseLinkDestination(e.src,i,e.posMax),c.ok&&(h=e.md.normalizeLink(c.str),e.md.validateLink(h)?i=c.pos:h=""),f=i;i<k&&(r=e.src.charCodeAt(i),!(!A(r)&&r!==10));i++);if(c=e.md.helpers.parseLinkTitle(e.src,i,e.posMax),i<k&&f!==i&&c.ok)for(s=c.str,i=c.pos;i<k&&(r=e.src.charCodeAt(i),!(!A(r)&&r!==10));i++);else s="";if(i>=k||e.src.charCodeAt(i)!==41)return e.pos=p,!1;i++}else{if(typeof e.env.references=="undefined")return!1;if(i<k&&e.src.charCodeAt(i)===91?(f=i+1,i=e.md.helpers.parseLinkLabel(e,i),i>=0?o=e.src.slice(f,i++):i=u+1):i=u+1,o||(o=e.src.slice(a,u)),l=e.env.references[W(o)],!l)return e.pos=p,!1;h=l.href,s=l.title}if(!n){t=e.src.slice(a,u);const C=[];e.md.inline.parse(t,e.md,e.env,C);const _=e.push("image","img",0),y=[["src",h],["alt",""]];_.attrs=y,_.children=C,_.content=t,s&&y.push(["title",s])}return e.pos=i,e.posMax=k,!0}const cr=/^([a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*)$/,sr=/^([a-zA-Z][a-zA-Z0-9+.-]{1,31}):([^<>\x00-\x20]*)$/;function fr(e,n){let r=e.pos;if(e.src.charCodeAt(r)!==60)return!1;const t=e.pos,o=e.posMax;for(;;){if(++r>=o)return!1;const l=e.src.charCodeAt(r);if(l===60)return!1;if(l===62)break}const i=e.src.slice(t+1,r);if(sr.test(i)){const l=e.md.normalizeLink(i);if(!e.md.validateLink(l))return!1;if(!n){const c=e.push("link_open","a",1);c.attrs=[["href",l]],c.markup="autolink",c.info="auto";const s=e.push("text","",0);s.content=e.md.normalizeLinkText(i);const f=e.push("link_close","a",-1);f.markup="autolink",f.info="auto"}return e.pos+=i.length+2,!0}if(cr.test(i)){const l=e.md.normalizeLink("mailto:"+i);if(!e.md.validateLink(l))return!1;if(!n){const c=e.push("link_open","a",1);c.attrs=[["href",l]],c.markup="autolink",c.info="auto";const s=e.push("text","",0);s.content=e.md.normalizeLinkText(i);const f=e.push("link_close","a",-1);f.markup="autolink",f.info="auto"}return e.pos+=i.length+2,!0}return!1}function ur(e){return/^<a[>\s]/i.test(e)}function hr(e){return/^<\/a\s*>/i.test(e)}function pr(e){const n=e|32;return n>=97&&n<=122}function ar(e,n){if(!e.md.options.html)return!1;const r=e.posMax,t=e.pos;if(e.src.charCodeAt(t)!==60||t+2>=r)return!1;const o=e.src.charCodeAt(t+1);if(o!==33&&o!==63&&o!==47&&!pr(o))return!1;const i=e.src.slice(t).match(Nn);if(!i)return!1;if(!n){const l=e.push("html_inline","",0);l.content=i[0],ur(l.content)&&e.linkLevel++,hr(l.content)&&e.linkLevel--}return e.pos+=i[0].length,!0}const kr=/^&#((?:x[a-f0-9]{1,6}|[0-9]{1,7}));/i,dr=/^&([a-z][a-z0-9]{1,31});/i;function mr(e,n){const r=e.pos,t=e.posMax;if(e.src.charCodeAt(r)!==38||r+1>=t)return!1;if(e.src.charCodeAt(r+1)===35){const i=e.src.slice(r).match(kr);if(i){if(!n){const l=i[1][0].toLowerCase()==="x"?parseInt(i[1].slice(1),16):parseInt(i[1],10),c=e.push("text_special","",0);c.content=ne(l)?H(l):H(65533),c.markup=i[0],c.info="entity"}return e.pos+=i[0].length,!0}}else{const i=e.src.slice(r).match(dr);if(i){const l=me(i[0]);if(l!==i[0]){if(!n){const c=e.push("text_special","",0);c.content=l,c.markup=i[0],c.info="entity"}return e.pos+=i[0].length,!0}}}return!1}function ae(e){const n={},r=e.length;if(!r)return;let t=0,o=-2;const i=[];for(let l=0;l<r;l++){const c=e[l];if(i.push(0),(e[t].marker!==c.marker||o!==c.token-1)&&(t=l),o=c.token,c.length=c.length||0,!c.close)continue;n.hasOwnProperty(c.marker)||(n[c.marker]=[-1,-1,-1,-1,-1,-1]);const s=n[c.marker][(c.open?3:0)+c.length%3];let f=t-i[t]-1,h=f;for(;f>s;f-=i[f]+1){const p=e[f];if(p.marker===c.marker&&p.open&&p.end<0){let k=!1;if((p.close||c.open)&&(p.length+c.length)%3===0&&(p.length%3!==0||c.length%3!==0)&&(k=!0),!k){const a=f>0&&!e[f-1].open?i[f-1]+1:0;i[l]=l-f+a,i[f]=a,c.open=!1,p.end=l,p.close=!1,h=-1,o=-2;break}}}h!==-1&&(n[c.marker][(c.open?3:0)+(c.length||0)%3]=h)}}function xr(e){const n=e.tokens_meta,r=e.tokens_meta.length;ae(e.delimiters);for(let t=0;t<r;t++)n[t]&&n[t].delimiters&&ae(n[t].delimiters)}function gr(e){let n,r,t=0;const o=e.tokens,i=e.tokens.length;for(n=r=0;n<i;n++)o[n].nesting<0&&t--,o[n].level=t,o[n].nesting>0&&t++,o[n].type==="text"&&n+1<i&&o[n+1].type==="text"?o[n+1].content=o[n].content+o[n+1].content:(n!==r&&(o[r]=o[n]),r++);n!==r&&(o.length=r)}const Y=[["text",Jn],["linkify",Xn],["newline",Yn],["escape",Kn],["backticks",er],["strikethrough",Ee.tokenize],["emphasis",Se.tokenize],["link",tr],["image",lr],["autolink",fr],["html_inline",ar],["entity",mr]],K=[["balance_pairs",xr],["strikethrough",Ee.postProcess],["emphasis",Se.postProcess],["fragments_join",gr]];function N(){this.ruler=new S;for(let e=0;e<Y.length;e++)this.ruler.push(Y[e][0],Y[e][1]);this.ruler2=new S;for(let e=0;e<K.length;e++)this.ruler2.push(K[e][0],K[e][1])}N.prototype.skipToken=function(e){const n=e.pos,r=this.ruler.getRules(""),t=r.length,o=e.md.options.maxNesting,i=e.cache;if(typeof i[n]!="undefined"){e.pos=i[n];return}let l=!1;if(e.level<o){for(let c=0;c<t;c++)if(e.level++,l=r[c](e,!0),e.level--,l){if(n>=e.pos)throw new Error("inline rule didn't increment state.pos");break}}else e.pos=e.posMax;l||e.pos++,i[n]=e.pos};N.prototype.tokenize=function(e){const n=this.ruler.getRules(""),r=n.length,t=e.posMax,o=e.md.options.maxNesting;for(;e.pos<t;){const i=e.pos;let l=!1;if(e.level<o){for(let c=0;c<r;c++)if(l=n[c](e,!1),l){if(i>=e.pos)throw new Error("inline rule didn't increment state.pos");break}}if(l){if(e.pos>=t)break;continue}e.pending+=e.src[e.pos++]}e.pending&&e.pushPending()};N.prototype.parse=function(e,n,r,t){const o=new this.State(e,n,r,t);this.tokenize(o);const i=this.ruler2.getRules(""),l=i.length;for(let c=0;c<l;c++)i[c](o)};N.prototype.State=q;var _r={options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"\u201C\u201D\u2018\u2019",highlight:null,maxNesting:100},components:{core:{},block:{},inline:{}}},br={options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"\u201C\u201D\u2018\u2019",highlight:null,maxNesting:20},components:{core:{rules:["normalize","block","inline","text_join"]},block:{rules:["paragraph"]},inline:{rules:["text"],rules2:["balance_pairs","fragments_join"]}}},Cr={options:{html:!0,xhtmlOut:!0,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"\u201C\u201D\u2018\u2019",highlight:null,maxNesting:20},components:{core:{rules:["normalize","block","inline","text_join"]},block:{rules:["blockquote","code","fence","heading","hr","html_block","lheading","list","reference","paragraph"]},inline:{rules:["autolink","backticks","emphasis","entity","escape","html_inline","image","link","newline","text"],rules2:["balance_pairs","emphasis","fragments_join"]}}};const Ar={default:_r,zero:br,commonmark:Cr},yr=/^(vbscript|javascript|file|data):/,Er=/^data:image\/(gif|png|jpeg|webp);/;function Sr(e){const n=e.trim().toLowerCase();return yr.test(n)?Er.test(n):!0}const Me=["http:","https:","mailto:"];function Mr(e){const n=ke(e,!0);if(n.hostname&&(!n.protocol||Me.indexOf(n.protocol)>=0))try{n.hostname=xe.toASCII(n.hostname)}catch{}return Pe(de(n))}function wr(e){const n=ke(e,!0);if(n.hostname&&(!n.protocol||Me.indexOf(n.protocol)>=0))try{n.hostname=xe.toUnicode(n.hostname)}catch{}return te(de(n),te.defaultChars+"%")}function w(e,n){if(!(this instanceof w))return new w(e,n);n||ee(e)||(n=e||{},e="default"),this.inline=new N,this.block=new Q,this.core=new re,this.renderer=new F,this.linkify=new De,this.validateLink=Sr,this.normalizeLink=Mr,this.normalizeLinkText=wr,this.utils=Xe,this.helpers=G({},nn),this.options={},this.configure(e),n&&this.set(n)}w.prototype.set=function(e){return G(this.options,e),this};w.prototype.configure=function(e){const n=this;if(ee(e)){const r=e;if(e=Ar[r],!e)throw new Error('Wrong `markdown-it` preset "'+r+'", check name')}if(!e)throw new Error("Wrong `markdown-it` preset, can't be empty");return e.options&&n.set(e.options),e.components&&Object.keys(e.components).forEach(function(r){e.components[r].rules&&n[r].ruler.enableOnly(e.components[r].rules),e.components[r].rules2&&n[r].ruler2.enableOnly(e.components[r].rules2)}),this};w.prototype.enable=function(e,n){let r=[];Array.isArray(e)||(e=[e]),["core","block","inline"].forEach(function(o){r=r.concat(this[o].ruler.enable(e,!0))},this),r=r.concat(this.inline.ruler2.enable(e,!0));const t=e.filter(function(o){return r.indexOf(o)<0});if(t.length&&!n)throw new Error("MarkdownIt. Failed to enable unknown rule(s): "+t);return this};w.prototype.disable=function(e,n){let r=[];Array.isArray(e)||(e=[e]),["core","block","inline"].forEach(function(o){r=r.concat(this[o].ruler.disable(e,!0))},this),r=r.concat(this.inline.ruler2.disable(e,!0));const t=e.filter(function(o){return r.indexOf(o)<0});if(t.length&&!n)throw new Error("MarkdownIt. Failed to disable unknown rule(s): "+t);return this};w.prototype.use=function(e){const n=[this].concat(Array.prototype.slice.call(arguments,1));return e.apply(e,n),this};w.prototype.parse=function(e,n){if(typeof e!="string")throw new Error("Input data should be a String");const r=new this.core.State(e,this,n);return this.core.process(r),r.tokens};w.prototype.render=function(e,n){return n=n||{},this.renderer.render(this.parse(e,n),this.options,n)};w.prototype.parseInline=function(e,n){const r=new this.core.State(e,this,n);return r.inlineMode=!0,this.core.process(r),r.tokens};w.prototype.renderInline=function(e,n){return n=n||{},this.renderer.render(this.parseInline(e,n),this.options,n)};export{w as M};
|