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.pos32))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(i.content)+""};I.code_block=function(e,n,r,t,o){const i=e[n];return""+R(e[n].content)+` `};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("${f} `}return`
${f}
`};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?`
`:`
`};I.softbreak=function(e,n,r){return r.breaks?r.xhtmlOut?`
`:`
`:` `};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 `:">",i};F.prototype.renderInline=function(e,n,r){let t="";const o=this.rules;for(let i=0,l=e.length;i=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\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=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;ak){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=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=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=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=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=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;i0&&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;nr;)if(!A(this.src.charCodeAt(--n)))return n+1;return n};v.prototype.skipChars=function(n,r){for(let t=this.src.length;nt;)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;ct?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(;tr)return!1;let o=n+1;if(e.sCount[o]=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=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=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=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=4)&&(o=e.skipChars(o,l),!(o-c=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=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,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";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=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=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=4||e.listIndent>=0&&e.sCount[s]-e.listIndent>=4&&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=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]=4)break;let ie=!1;for(let z=0,Ie=d.length;z=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`\\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="]*>",qn="",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],[/^/,!0],[/^/,!0],[new RegExp("^|$))","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=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&&o6||oo&&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(;c3)continue;if(e.sCount[c]>=e.blkIndent){let a=e.bMarks[c]+e.tShift[c];const u=e.eMarks[c];if(a=u))){i=l===61?1:2;break}}if(e.sCount[c]<0)continue;let k=!1;for(let a=0,u=t.length;a3||e.sCount[i]<0)continue;let f=!1;for(let h=0,p=t.length;h=r||e.sCount[l]=i){e.line=r;break}const s=e.line;let f=!1;for(let h=0;h=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,l0&&(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(;i0)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?@[]^_`{|}~-".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=55296&&o<=56319&&r+1=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=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=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||e.src.charCodeAt(u)!==41)&&(f=!0),u++}if(f){if(typeof e.env.references=="undefined")return!1;if(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)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||e.src.charCodeAt(i)!==41)return e.pos=p,!1;i++}else{if(typeof e.env.references=="undefined")return!1;if(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/^\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;ls;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;t0&&t++,o[n].type==="text"&&n+1=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=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=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};