/** * Bundled by jsDelivr using Rollup v2.79.2 and Terser v5.39.0. * Original file: /npm/markdown-it@14.1.0/index.mjs * * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files */ import*as t from"/npm/mdurl@2.0.0/+esm";import*as e from"/npm/uc.micro@2.1.0/+esm";import{decodeHTML as n}from"/npm/entities@4.5.0/+esm";import r from"/npm/linkify-it@5.0.0/+esm";import s from"/npm/punycode.js@2.3.1/+esm";function o(t){return"[object String]"===function(t){return Object.prototype.toString.call(t)}(t)}const i=Object.prototype.hasOwnProperty;function c(t){return Array.prototype.slice.call(arguments,1).forEach((function(e){if(e){if("object"!=typeof e)throw new TypeError(e+"must be object");Object.keys(e).forEach((function(n){t[n]=e[n]}))}})),t}function l(t,e,n){return[].concat(t.slice(0,e),n,t.slice(e+1))}function a(t){return!(t>=55296&&t<=57343)&&(!(t>=64976&&t<=65007)&&(!!(65535&~t&&65534!=(65535&t))&&(!(t>=0&&t<=8)&&(11!==t&&(!(t>=14&&t<=31)&&(!(t>=127&&t<=159)&&!(t>1114111)))))))}function h(t){if(t>65535){const e=55296+((t-=65536)>>10),n=56320+(1023&t);return String.fromCharCode(e,n)}return String.fromCharCode(t)}const u=/\\([!"#$%&'()*+,\-./:;<=>?@[\\\]^_`{|}~])/g,p=new RegExp(u.source+"|"+/&([a-z#][a-z0-9]{1,31});/gi.source,"gi"),f=/^#((?:x[a-f0-9]{1,8}|[0-9]{1,8}))$/i;function d(t){return t.indexOf("\\")<0&&t.indexOf("&")<0?t:t.replace(p,(function(t,e,r){return e||function(t,e){if(35===e.charCodeAt(0)&&f.test(e)){const n="x"===e[1].toLowerCase()?parseInt(e.slice(2),16):parseInt(e.slice(1),10);return a(n)?h(n):t}const r=n(t);return r!==t?r:t}(t,r)}))}const k=/[&<>"]/,m=/[&<>"]/g,g={"&":"&","<":"<",">":">",'"':"""};function b(t){return g[t]}function _(t){return k.test(t)?t.replace(m,b):t}const C=/[.?*+^$[\]\\(){}|-]/g;function y(t){switch(t){case 9:case 32:return!0}return!1}function A(t){if(t>=8192&&t<=8202)return!0;switch(t){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 x(t){return e.P.test(t)||e.S.test(t)}function M(t){switch(t){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 v(t){return t=t.trim().replace(/\s+/g," "),"Ṿ"==="ẞ".toLowerCase()&&(t=t.replace(/ẞ/g,"ß")),t.toLowerCase().toUpperCase()}const w={mdurl:t,ucmicro:e};var S=Object.freeze({__proto__:null,lib:w,assign:c,isString:o,has:function(t,e){return i.call(t,e)},unescapeMd:function(t){return t.indexOf("\\")<0?t:t.replace(u,"$1")},unescapeAll:d,isValidEntityCode:a,fromCodePoint:h,escapeHtml:_,arrayReplaceAt:l,isSpace:y,isWhiteSpace:A,isMdAsciiPunct:M,isPunctChar:x,escapeRE:function(t){return t.replace(C,"\\$&")},normalizeReference:v});var I=Object.freeze({__proto__:null,parseLinkLabel:function(t,e,n){let r,s,o,i;const c=t.posMax,l=t.pos;for(t.pos=e+1,r=1;t.pos32))return o;if(41===r){if(0===i)break;i--}s++}return e===s||0!==i||(o.str=d(t.slice(e,s)),o.pos=s,o.ok=!0),o},parseLinkTitle:function(t,e,n,r){let s,o=e;const i={ok:!1,can_continue:!1,pos:0,str:"",marker:0};if(r)i.str=r.str,i.marker=r.marker;else{if(o>=n)return i;let r=t.charCodeAt(o);if(34!==r&&39!==r&&40!==r)return i;e++,o++,40===r&&(r=41),i.marker=r}for(;o"+_(o.content)+""},L.code_block=function(t,e,n,r,s){const o=t[e];return""+_(t[e].content)+"\n"},L.fence=function(t,e,n,r,s){const o=t[e],i=o.info?d(o.info).trim():"";let c,l="",a="";if(i){const t=i.split(/(\s+)/g);l=t[0],a=t.slice(2).join("")}if(c=n.highlight&&n.highlight(o.content,l,a)||_(o.content),0===c.indexOf("${c}\n`}return`
${c}
\n`},L.image=function(t,e,n,r,s){const o=t[e];return o.attrs[o.attrIndex("alt")][1]=s.renderInlineAsText(o.children,n,r),s.renderToken(t,e,n)},L.hardbreak=function(t,e,n){return n.xhtmlOut?"
\n":"
\n"},L.softbreak=function(t,e,n){return n.breaks?n.xhtmlOut?"
\n":"
\n":"\n"},L.text=function(t,e){return _(t[e].content)},L.html_block=function(t,e){return t[e].content},L.html_inline=function(t,e){return t[e].content},z.prototype.renderAttrs=function(t){let e,n,r;if(!t.attrs)return"";for(r="",e=0,n=t.attrs.length;e\n":">",s},z.prototype.renderInline=function(t,e,n){let r="";const s=this.rules;for(let o=0,i=t.length;o=0&&(n=this.attrs[e][1]),n},E.prototype.attrJoin=function(t,e){const n=this.attrIndex(t);n<0?this.attrPush([t,e]):this.attrs[n][1]=this.attrs[n][1]+" "+e},$.prototype.Token=E;const O=/\r\n?|\n/g,q=/\0/g;function P(t){return/^<\/a\s*>/i.test(t)}const j=/\+-|\.\.|\?\?\?\?|!!!!|,,|--/,R=/\((c|tm|r)\)/i,Z=/\((c|tm|r)\)/gi,D={c:"©",r:"®",tm:"™"};function N(t,e){return D[e.toLowerCase()]}function B(t){let e=0;for(let n=t.length-1;n>=0;n--){const r=t[n];"text"!==r.type||e||(r.content=r.content.replace(Z,N)),"link_open"===r.type&&"auto"===r.info&&e--,"link_close"===r.type&&"auto"===r.info&&e++}}function W(t){let e=0;for(let n=t.length-1;n>=0;n--){const r=t[n];"text"!==r.type||e||j.test(r.content)&&(r.content=r.content.replace(/\+-/g,"±").replace(/\.{2,}/g,"…").replace(/([?!])…/g,"$1..").replace(/([?!]){4,}/g,"$1$1$1").replace(/,{2,}/g,",").replace(/(^|[^-])---(?=[^-]|$)/gm,"$1—").replace(/(^|\s)--(?=\s|$)/gm,"$1–").replace(/(^|[^-\s])--(?=[^-\s]|$)/gm,"$1–")),"link_open"===r.type&&"auto"===r.info&&e--,"link_close"===r.type&&"auto"===r.info&&e++}}const F=/['"]/,U=/['"]/g;function G(t,e,n){return t.slice(0,e)+n+t.slice(e+1)}function H(t,e){let n;const r=[];for(let s=0;s=0&&!(r[n].level<=i);n--);if(r.length=n+1,"text"!==o.type)continue;let c=o.content,l=0,a=c.length;t:for(;l=0)d=c.charCodeAt(h.index-1);else for(n=s-1;n>=0&&("softbreak"!==t[n].type&&"hardbreak"!==t[n].type);n--)if(t[n].content){d=t[n].content.charCodeAt(t[n].content.length-1);break}let k=32;if(l=48&&d<=57&&(p=u=!1),u&&p&&(u=m,p=g),u||p){if(p)for(n=r.length-1;n>=0;n--){let u=r[n];if(r[n].level=0;i--){const c=s[i];if("link_close"!==c.type){if("html_inline"===c.type&&(n=c.content,/^\s]/i.test(n)&&o>0&&o--,P(c.content)&&o++),!(o>0)&&"text"===c.type&&t.md.linkify.test(c.content)){const n=c.content;let o=t.md.linkify.match(n);const a=[];let h=c.level,u=0;o.length>0&&0===o[0].index&&i>0&&"text_special"===s[i-1].type&&(o=o.slice(1));for(let e=0;eu){const e=new t.Token("text","",0);e.content=n.slice(u,c),e.level=h,a.push(e)}const l=new t.Token("link_open","a",1);l.attrs=[["href",s]],l.level=h++,l.markup="linkify",l.info="auto",a.push(l);const p=new t.Token("text","",0);p.content=i,p.level=h,a.push(p);const f=new t.Token("link_close","a",-1);f.level=--h,f.markup="linkify",f.info="auto",a.push(f),u=o[e].lastIndex}if(u=0;e--)"inline"===t.tokens[e].type&&(R.test(t.tokens[e].content)&&B(t.tokens[e].children),j.test(t.tokens[e].content)&&W(t.tokens[e].children))}],["smartquotes",function(t){if(t.md.options.typographer)for(let e=t.tokens.length-1;e>=0;e--)"inline"===t.tokens[e].type&&F.test(t.tokens[e].content)&&H(t.tokens[e].children,t)}],["text_join",function(t){let e,n;const r=t.tokens,s=r.length;for(let t=0;t0&&this.level++,this.tokens.push(r),r},K.prototype.isEmpty=function(t){return this.bMarks[t]+this.tShift[t]>=this.eMarks[t]},K.prototype.skipEmptyLines=function(t){for(let e=this.lineMax;te;)if(!y(this.src.charCodeAt(--t)))return t+1;return t},K.prototype.skipChars=function(t,e){for(let n=this.src.length;tn;)if(e!==this.src.charCodeAt(--t))return t+1;return t},K.prototype.getLines=function(t,e,n,r){if(t>=e)return"";const s=new Array(e-t);for(let o=0,i=t;in?new Array(t-n+1).join(" ")+this.src.slice(a,l):this.src.slice(a,l)}return s.join("")},K.prototype.Token=E;function Q(t,e){const n=t.bMarks[e]+t.tShift[e],r=t.eMarks[e];return t.src.slice(n,r)}function X(t){const e=[],n=t.length;let r=0,s=t.charCodeAt(r),o=!1,i=0,c="";for(;r=r)return-1;let o=t.src.charCodeAt(s++);if(o<48||o>57)return-1;for(;;){if(s>=r)return-1;if(o=t.src.charCodeAt(s++),!(o>=48&&o<=57)){if(41===o||46===o)break;return-1}if(s-n>=10)return-1}return s`\\x00-\\x20]+|'[^']*'|\"[^\"]*\"))?)*\\s*\\/?>",nt="<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>",rt=new RegExp("^(?:"+et+"|"+nt+"|\x3c!---?>|\x3c!--(?:[^-]|-[^-]|--[^>])*--\x3e|<[?][\\s\\S]*?[?]>|]*>|)"),st=new RegExp("^(?:"+et+"|"+nt+")"),ot=[[/^<(script|pre|style|textarea)(?=(\s|>|$))/i,/<\/(script|pre|style|textarea)>/i,!0],[/^/,!0],[/^<\?/,/\?>/,!0],[/^/,!0],[/^/,!0],[new RegExp("^|$))","i"),/^$/,!0],[new RegExp(st.source+"\\s*$"),/^$/,!1]];const it=[["table",function(t,e,n,r){if(e+2>n)return!1;let s=e+1;if(t.sCount[s]=4)return!1;let o=t.bMarks[s]+t.tShift[s];if(o>=t.eMarks[s])return!1;const i=t.src.charCodeAt(o++);if(124!==i&&45!==i&&58!==i)return!1;if(o>=t.eMarks[s])return!1;const c=t.src.charCodeAt(o++);if(124!==c&&45!==c&&58!==c&&!y(c))return!1;if(45===i&&y(c))return!1;for(;o=4)return!1;a=X(l),a.length&&""===a[0]&&a.shift(),a.length&&""===a[a.length-1]&&a.pop();const u=a.length;if(0===u||u!==h.length)return!1;if(r)return!0;const p=t.parentType;t.parentType="table";const f=t.md.block.ruler.getRules("blockquote"),d=[e,0];t.push("table_open","table",1).map=d,t.push("thead_open","thead",1).map=[e,e+1],t.push("tr_open","tr",1).map=[e,e+1];for(let e=0;e=4)break;if(a=X(l),a.length&&""===a[0]&&a.shift(),a.length&&""===a[a.length-1]&&a.pop(),m+=u-a.length,m>65536)break;if(s===e+2){t.push("tbody_open","tbody",1).map=k=[e+2,0]}t.push("tr_open","tr",1).map=[s,s+1];for(let e=0;e=4))break;r++,s=r}t.line=s;const o=t.push("code_block","code",0);return o.content=t.getLines(e,s,4+t.blkIndent,!1)+"\n",o.map=[e,t.line],!0}],["fence",function(t,e,n,r){let s=t.bMarks[e]+t.tShift[e],o=t.eMarks[e];if(t.sCount[e]-t.blkIndent>=4)return!1;if(s+3>o)return!1;const i=t.src.charCodeAt(s);if(126!==i&&96!==i)return!1;let c=s;s=t.skipChars(s,i);let l=s-c;if(l<3)return!1;const a=t.src.slice(c,s),h=t.src.slice(s,o);if(96===i&&h.indexOf(String.fromCharCode(i))>=0)return!1;if(r)return!0;let u=e,p=!1;for(;(u++,!(u>=n))&&(s=c=t.bMarks[u]+t.tShift[u],o=t.eMarks[u],!(s=4||(s=t.skipChars(s,i),s-c=4)return!1;if(62!==t.src.charCodeAt(s))return!1;if(r)return!0;const c=[],l=[],a=[],h=[],u=t.md.block.ruler.getRules("blockquote"),p=t.parentType;t.parentType="blockquote";let f,d=!1;for(f=e;f=o)break;if(62===t.src.charCodeAt(s++)&&!e){let e,n,r=t.sCount[f]+1;32===t.src.charCodeAt(s)?(s++,r++,n=!1,e=!0):9===t.src.charCodeAt(s)?(e=!0,(t.bsCount[f]+r)%4==3?(s++,r++,n=!1):n=!0):e=!1;let i=r;for(c.push(t.bMarks[f]),t.bMarks[f]=s;s=o,l.push(t.bsCount[f]),t.bsCount[f]=t.sCount[f]+1+(e?1:0),a.push(t.sCount[f]),t.sCount[f]=i-r,h.push(t.tShift[f]),t.tShift[f]=s-t.bMarks[f];continue}if(d)break;let r=!1;for(let e=0,s=u.length;e";const g=[e,0];m.map=g,t.md.block.tokenize(t,e,f),t.push("blockquote_close","blockquote",-1).markup=">",t.lineMax=i,t.parentType=p,g[1]=t.line;for(let n=0;n=4)return!1;let o=t.bMarks[e]+t.tShift[e];const i=t.src.charCodeAt(o++);if(42!==i&&45!==i&&95!==i)return!1;let c=1;for(;o=4)return!1;if(t.listIndent>=0&&t.sCount[l]-t.listIndent>=4&&t.sCount[l]=t.blkIndent&&(f=!0),(p=tt(t,l))>=0){if(h=!0,i=t.bMarks[l]+t.tShift[l],u=Number(t.src.slice(i,p-1)),f&&1!==u)return!1}else{if(!((p=Y(t,l))>=0))return!1;h=!1}if(f&&t.skipSpaces(p)>=t.eMarks[l])return!1;if(r)return!0;const d=t.src.charCodeAt(p-1),k=t.tokens.length;h?(c=t.push("ordered_list_open","ol",1),1!==u&&(c.attrs=[["start",u]])):c=t.push("bullet_list_open","ul",1);const m=[l,0];c.map=m,c.markup=String.fromCharCode(d);let g=!1;const b=t.md.block.ruler.getRules("list"),_=t.parentType;for(t.parentType="list";l=s?1:r-e,f>4&&(f=1);const k=e+f;c=t.push("list_item_open","li",1),c.markup=String.fromCharCode(d);const m=[l,0];c.map=m,h&&(c.info=t.src.slice(i,p-1));const _=t.tight,C=t.tShift[l],y=t.sCount[l],A=t.listIndent;if(t.listIndent=t.blkIndent,t.blkIndent=k,t.tight=!0,t.tShift[l]=u-t.bMarks[l],t.sCount[l]=r,u>=s&&t.isEmpty(l+1)?t.line=Math.min(t.line+2,n):t.md.block.tokenize(t,l,n,!0),t.tight&&!g||(a=!1),g=t.line-l>1&&t.isEmpty(t.line-1),t.blkIndent=t.listIndent,t.listIndent=A,t.tShift[l]=C,t.sCount[l]=y,t.tight=_,c=t.push("list_item_close","li",-1),c.markup=String.fromCharCode(d),l=t.line,m[1]=l,l>=n)break;if(t.sCount[l]=4)break;let x=!1;for(let e=0,r=b.length;e=4)return!1;if(91!==t.src.charCodeAt(s))return!1;function c(e){const n=t.lineMax;if(e>=n||t.isEmpty(e))return null;let r=!1;if(t.sCount[e]-t.blkIndent>3&&(r=!0),t.sCount[e]<0&&(r=!0),!r){const r=t.md.block.ruler.getRules("reference"),s=t.parentType;t.parentType="reference";let o=!1;for(let s=0,i=r.length;s=4)return!1;if(!t.md.options.html)return!1;if(60!==t.src.charCodeAt(s))return!1;let i=t.src.slice(s,o),c=0;for(;c=4)return!1;let i=t.src.charCodeAt(s);if(35!==i||s>=o)return!1;let c=1;for(i=t.src.charCodeAt(++s);35===i&&s6||ss&&y(t.src.charCodeAt(l-1))&&(o=l),t.line=e+1;const a=t.push("heading_open","h"+String(c),1);a.markup="########".slice(0,c),a.map=[e,t.line];const h=t.push("inline","",0);return h.content=t.src.slice(s,o).trim(),h.map=[e,t.line],h.children=[],t.push("heading_close","h"+String(c),-1).markup="########".slice(0,c),!0},["paragraph","reference","blockquote"]],["lheading",function(t,e,n){const r=t.md.block.ruler.getRules("paragraph");if(t.sCount[e]-t.blkIndent>=4)return!1;const s=t.parentType;t.parentType="paragraph";let o,i=0,c=e+1;for(;c3)continue;if(t.sCount[c]>=t.blkIndent){let e=t.bMarks[c]+t.tShift[c];const n=t.eMarks[c];if(e=n))){i=61===o?1:2;break}}if(t.sCount[c]<0)continue;let e=!1;for(let s=0,o=r.length;s3)continue;if(t.sCount[o]<0)continue;let e=!1;for(let s=0,i=r.length;s=n))&&!(t.sCount[i]=o){t.line=n;break}const e=t.line;let l=!1;for(let o=0;o=t.line)throw new Error("block rule didn't increment state.line");break}if(!l)throw new Error("none of the block rules matched");t.tight=!c,t.isEmpty(t.line-1)&&(c=!0),i=t.line,i0&&(this.level++,this._prev_delimiters.push(this.delimiters),this.delimiters=[],s={delimiters:this.delimiters}),this.pendingLevel=this.level,this.tokens.push(r),this.tokens_meta.push(s),r},lt.prototype.scanDelims=function(t,e){const n=this.posMax,r=this.src.charCodeAt(t),s=t>0?this.src.charCodeAt(t-1):32;let o=t;for(;o?@[]^_`{|}~-".split("").forEach((function(t){ut[t.charCodeAt(0)]=1}));var ft={tokenize:function(t,e){const n=t.pos,r=t.src.charCodeAt(n);if(e)return!1;if(126!==r)return!1;const s=t.scanDelims(t.pos,!0);let o=s.length;const i=String.fromCharCode(r);if(o<2)return!1;let c;o%2&&(c=t.push("text","",0),c.content=i,o--);for(let e=0;e=0;n--){const r=e[n];if(95!==r.marker&&42!==r.marker)continue;if(-1===r.end)continue;const s=e[r.end],o=n>0&&e[n-1].end===r.end+1&&e[n-1].marker===r.marker&&e[n-1].token===r.token-1&&e[r.end+1].token===s.token+1,i=String.fromCharCode(r.marker),c=t.tokens[r.token];c.type=o?"strong_open":"em_open",c.tag=o?"strong":"em",c.nesting=1,c.markup=o?i+i:i,c.content="";const l=t.tokens[s.token];l.type=o?"strong_close":"em_close",l.tag=o?"strong":"em",l.nesting=-1,l.markup=o?i+i:i,l.content="",o&&(t.tokens[e[n-1].token].content="",t.tokens[e[r.end+1].token].content="",n--)}}var kt={tokenize:function(t,e){const n=t.pos,r=t.src.charCodeAt(n);if(e)return!1;if(95!==r&&42!==r)return!1;const s=t.scanDelims(t.pos,42===r);for(let e=0;e\x00-\x20]*)$/;const bt=/^&#((?:x[a-f0-9]{1,6}|[0-9]{1,7}));/i,_t=/^&([a-z][a-z0-9]{1,31});/i;function Ct(t){const e={},n=t.length;if(!n)return;let r=0,s=-2;const o=[];for(let i=0;ic;l-=o[l]+1){const e=t[l];if(e.marker===n.marker&&(e.open&&e.end<0)){let r=!1;if((e.close||n.open)&&(e.length+n.length)%3==0&&(e.length%3==0&&n.length%3==0||(r=!0)),!r){const r=l>0&&!t[l-1].open?o[l-1]+1:0;o[i]=i-l+r,o[l]=r,n.open=!1,e.end=i,e.close=!1,a=-1,s=-2;break}}}-1!==a&&(e[n.marker][(n.open?3:0)+(n.length||0)%3]=a)}}const yt=[["text",function(t,e){let n=t.pos;for(;n0)return!1;const n=t.pos;if(n+3>t.posMax)return!1;if(58!==t.src.charCodeAt(n))return!1;if(47!==t.src.charCodeAt(n+1))return!1;if(47!==t.src.charCodeAt(n+2))return!1;const r=t.pending.match(ht);if(!r)return!1;const s=r[1],o=t.md.linkify.matchAtStart(t.src.slice(n-s.length));if(!o)return!1;let i=o.url;if(i.length<=s.length)return!1;i=i.replace(/\*+$/,"");const c=t.md.normalizeLink(i);if(!t.md.validateLink(c))return!1;if(!e){t.pending=t.pending.slice(0,-s.length);const e=t.push("link_open","a",1);e.attrs=[["href",c]],e.markup="linkify",e.info="auto";t.push("text","",0).content=t.md.normalizeLinkText(i);const n=t.push("link_close","a",-1);n.markup="linkify",n.info="auto"}return t.pos+=i.length-s.length,!0}],["newline",function(t,e){let n=t.pos;if(10!==t.src.charCodeAt(n))return!1;const r=t.pending.length-1,s=t.posMax;if(!e)if(r>=0&&32===t.pending.charCodeAt(r))if(r>=1&&32===t.pending.charCodeAt(r-1)){let e=r-1;for(;e>=1&&32===t.pending.charCodeAt(e-1);)e--;t.pending=t.pending.slice(0,e),t.push("hardbreak","br",0)}else t.pending=t.pending.slice(0,-1),t.push("softbreak","br",0);else t.push("softbreak","br",0);for(n++;n=r)return!1;let s=t.src.charCodeAt(n);if(10===s){for(e||t.push("hardbreak","br",0),n++;n=55296&&s<=56319&&n+1=56320&&e<=57343&&(o+=t.src[n+1],n++)}const i="\\"+o;if(!e){const e=t.push("text_special","",0);s<256&&0!==ut[s]?e.content=o:e.content=i,e.markup=i,e.info="escape"}return t.pos=n+1,!0}],["backticks",function(t,e){let n=t.pos;if(96!==t.src.charCodeAt(n))return!1;const r=n;n++;const s=t.posMax;for(;n=u)return!1;if(l=d,s=t.md.helpers.parseLinkDestination(t.src,d,t.posMax),s.ok){for(i=t.md.normalizeLink(s.str),t.md.validateLink(i)?d=s.pos:i="",l=d;d=u||41!==t.src.charCodeAt(d))&&(a=!0),d++}if(a){if(void 0===t.env.references)return!1;if(d=0?r=t.src.slice(l,d++):d=f+1):d=f+1,r||(r=t.src.slice(p,f)),o=t.env.references[v(r)],!o)return t.pos=h,!1;i=o.href,c=o.title}if(!e){t.pos=p,t.posMax=f;const e=[["href",i]];t.push("link_open","a",1).attrs=e,c&&e.push(["title",c]),t.linkLevel++,t.md.inline.tokenize(t),t.linkLevel--,t.push("link_close","a",-1)}return t.pos=d,t.posMax=u,!0}],["image",function(t,e){let n,r,s,o,i,c,l,a,h="";const u=t.pos,p=t.posMax;if(33!==t.src.charCodeAt(t.pos))return!1;if(91!==t.src.charCodeAt(t.pos+1))return!1;const f=t.pos+2,d=t.md.helpers.parseLinkLabel(t,t.pos+1,!1);if(d<0)return!1;if(o=d+1,o=p)return!1;for(a=o,c=t.md.helpers.parseLinkDestination(t.src,o,t.posMax),c.ok&&(h=t.md.normalizeLink(c.str),t.md.validateLink(h)?o=c.pos:h=""),a=o;o=p||41!==t.src.charCodeAt(o))return t.pos=u,!1;o++}else{if(void 0===t.env.references)return!1;if(o=0?s=t.src.slice(a,o++):o=d+1):o=d+1,s||(s=t.src.slice(f,d)),i=t.env.references[v(s)],!i)return t.pos=u,!1;h=i.href,l=i.title}if(!e){r=t.src.slice(f,d);const e=[];t.md.inline.parse(r,t.md,t.env,e);const n=t.push("image","img",0),s=[["src",h],["alt",""]];n.attrs=s,n.children=e,n.content=r,l&&s.push(["title",l])}return t.pos=o,t.posMax=p,!0}],["autolink",function(t,e){let n=t.pos;if(60!==t.src.charCodeAt(n))return!1;const r=t.pos,s=t.posMax;for(;;){if(++n>=s)return!1;const e=t.src.charCodeAt(n);if(60===e)return!1;if(62===e)break}const o=t.src.slice(r+1,n);if(gt.test(o)){const n=t.md.normalizeLink(o);if(!t.md.validateLink(n))return!1;if(!e){const e=t.push("link_open","a",1);e.attrs=[["href",n]],e.markup="autolink",e.info="auto";t.push("text","",0).content=t.md.normalizeLinkText(o);const r=t.push("link_close","a",-1);r.markup="autolink",r.info="auto"}return t.pos+=o.length+2,!0}if(mt.test(o)){const n=t.md.normalizeLink("mailto:"+o);if(!t.md.validateLink(n))return!1;if(!e){const e=t.push("link_open","a",1);e.attrs=[["href",n]],e.markup="autolink",e.info="auto";t.push("text","",0).content=t.md.normalizeLinkText(o);const r=t.push("link_close","a",-1);r.markup="autolink",r.info="auto"}return t.pos+=o.length+2,!0}return!1}],["html_inline",function(t,e){if(!t.md.options.html)return!1;const n=t.posMax,r=t.pos;if(60!==t.src.charCodeAt(r)||r+2>=n)return!1;const s=t.src.charCodeAt(r+1);if(33!==s&&63!==s&&47!==s&&!function(t){const e=32|t;return e>=97&&e<=122}(s))return!1;const o=t.src.slice(r).match(rt);if(!o)return!1;if(!e){const e=t.push("html_inline","",0);e.content=o[0],i=e.content,/^\s]/i.test(i)&&t.linkLevel++,function(t){return/^<\/a\s*>/i.test(t)}(e.content)&&t.linkLevel--}var i;return t.pos+=o[0].length,!0}],["entity",function(t,e){const r=t.pos,s=t.posMax;if(38!==t.src.charCodeAt(r))return!1;if(r+1>=s)return!1;if(35===t.src.charCodeAt(r+1)){const n=t.src.slice(r).match(bt);if(n){if(!e){const e="x"===n[1][0].toLowerCase()?parseInt(n[1].slice(1),16):parseInt(n[1],10),r=t.push("text_special","",0);r.content=a(e)?h(e):h(65533),r.markup=n[0],r.info="entity"}return t.pos+=n[0].length,!0}}else{const s=t.src.slice(r).match(_t);if(s){const r=n(s[0]);if(r!==s[0]){if(!e){const e=t.push("text_special","",0);e.content=r,e.markup=s[0],e.info="entity"}return t.pos+=s[0].length,!0}}}return!1}]],At=[["balance_pairs",function(t){const e=t.tokens_meta,n=t.tokens_meta.length;Ct(t.delimiters);for(let t=0;t0&&r++,"text"===s[e].type&&e+1=t.pos)throw new Error("inline rule didn't increment state.pos");break}}else t.pos=t.posMax;i||t.pos++,o[e]=t.pos},xt.prototype.tokenize=function(t){const e=this.ruler.getRules(""),n=e.length,r=t.posMax,s=t.md.options.maxNesting;for(;t.pos=t.pos)throw new Error("inline rule didn't increment state.pos");break}if(i){if(t.pos>=r)break}else t.pending+=t.src[t.pos++]}t.pending&&t.pushPending()},xt.prototype.parse=function(t,e,n,r){const s=new this.State(t,e,n,r);this.tokenize(s);const o=this.ruler2.getRules(""),i=o.length;for(let t=0;t=0))try{n.hostname=s.toASCII(n.hostname)}catch(t){}return t.encode(t.format(n))}function zt(e){const n=t.parse(e,!0);if(n.hostname&&(!n.protocol||It.indexOf(n.protocol)>=0))try{n.hostname=s.toUnicode(n.hostname)}catch(t){}return t.decode(t.format(n),t.decode.defaultChars+"%")}function Tt(t,e){if(!(this instanceof Tt))return new Tt(t,e);e||o(t)||(e=t||{},t="default"),this.inline=new xt,this.block=new ct,this.core=new V,this.renderer=new z,this.linkify=new r,this.validateLink=St,this.normalizeLink=Lt,this.normalizeLinkText=zt,this.utils=S,this.helpers=c({},I),this.options={},this.configure(t),e&&this.set(e)}Tt.prototype.set=function(t){return c(this.options,t),this},Tt.prototype.configure=function(t){const e=this;if(o(t)){const e=t;if(!(t=Mt[e]))throw new Error('Wrong `markdown-it` preset "'+e+'", check name')}if(!t)throw new Error("Wrong `markdown-it` preset, can't be empty");return t.options&&e.set(t.options),t.components&&Object.keys(t.components).forEach((function(n){t.components[n].rules&&e[n].ruler.enableOnly(t.components[n].rules),t.components[n].rules2&&e[n].ruler2.enableOnly(t.components[n].rules2)})),this},Tt.prototype.enable=function(t,e){let n=[];Array.isArray(t)||(t=[t]),["core","block","inline"].forEach((function(e){n=n.concat(this[e].ruler.enable(t,!0))}),this),n=n.concat(this.inline.ruler2.enable(t,!0));const r=t.filter((function(t){return n.indexOf(t)<0}));if(r.length&&!e)throw new Error("MarkdownIt. Failed to enable unknown rule(s): "+r);return this},Tt.prototype.disable=function(t,e){let n=[];Array.isArray(t)||(t=[t]),["core","block","inline"].forEach((function(e){n=n.concat(this[e].ruler.disable(t,!0))}),this),n=n.concat(this.inline.ruler2.disable(t,!0));const r=t.filter((function(t){return n.indexOf(t)<0}));if(r.length&&!e)throw new Error("MarkdownIt. Failed to disable unknown rule(s): "+r);return this},Tt.prototype.use=function(t){const e=[this].concat(Array.prototype.slice.call(arguments,1));return t.apply(t,e),this},Tt.prototype.parse=function(t,e){if("string"!=typeof t)throw new Error("Input data should be a String");const n=new this.core.State(t,this,e);return this.core.process(n),n.tokens},Tt.prototype.render=function(t,e){return e=e||{},this.renderer.render(this.parse(t,e),this.options,e)},Tt.prototype.parseInline=function(t,e){const n=new this.core.State(t,this,e);return n.inlineMode=!0,this.core.process(n),n.tokens},Tt.prototype.renderInline=function(t,e){return e=e||{},this.renderer.render(this.parseInline(t,e),this.options,e)};export{Tt as default}; //# sourceMappingURL=/sm/8f46d8c3c1217f348e56116eb47a8a3c8be84862ad790ad94a5fa63ec255196d.map