mermaid
Version:
Markdown-ish syntax for generating flowcharts, mindmaps, sequence diagrams, class diagrams, gantt charts, git graphs and more.
71 lines (70 loc) • 49.7 kB
JavaScript
import{c as me,d as xe}from"./chunk-2NMSUPJH.mjs";import{r as O}from"./chunk-VY2OSTJR.mjs";import{A as F,D as G,F as ge,G as ke,t as fe}from"./chunk-QJSWEUOL.mjs";import{b as E,h as R}from"./chunk-H7VHZCWX.mjs";import{a as h,b as ue,d as de}from"./chunk-AQ6EADP3.mjs";var we=ue((Z,H)=>{"use strict";(function(r){"use strict";var e=function(){},n=r.requestAnimationFrame||r.webkitRequestAnimationFrame||r.mozRequestAnimationFrame||r.msRequestAnimationFrame||function(o){return setTimeout(o,16)};function s(){var o=this;o.reads=[],o.writes=[],o.raf=n.bind(r),e("initialized",o)}h(s,"FastDom"),s.prototype={constructor:s,runTasks:h(function(o){e("run tasks");for(var p;p=o.shift();)p()},"runTasks"),measure:h(function(o,p){e("measure");var u=p?o.bind(p):o;return this.reads.push(u),t(this),u},"measure"),mutate:h(function(o,p){e("mutate");var u=p?o.bind(p):o;return this.writes.push(u),t(this),u},"mutate"),clear:h(function(o){return e("clear",o),i(this.reads,o)||i(this.writes,o)},"clear"),extend:h(function(o){if(e("extend",o),typeof o!="object")throw new Error("expected object");var p=Object.create(this);return l(p,o),p.fastdom=this,p.initialize&&p.initialize(),p},"extend"),catch:null};function t(o){o.scheduled||(o.scheduled=!0,o.raf(a.bind(null,o)),e("flush scheduled"))}h(t,"scheduleFlush");function a(o){e("flush");var p=o.writes,u=o.reads,d;try{e("flushing reads",u.length),o.runTasks(u),e("flushing writes",p.length),o.runTasks(p)}catch(f){d=f}if(o.scheduled=!1,(u.length||p.length)&&t(o),d)if(e("task errored",d.message),o.catch)o.catch(d);else throw d}h(a,"flush");function i(o,p){var u=o.indexOf(p);return!!~u&&!!o.splice(u,1)}h(i,"remove");function l(o,p){for(var u in p)p.hasOwnProperty(u)&&(o[u]=p[u])}h(l,"mixin");var c=r.fastdom=r.fastdom||new s;typeof define=="function"?define(function(){return c}):typeof H=="object"&&(H.exports=c)})(typeof window<"u"?window:typeof Z<"u"?Z:globalThis)});var ye=ue((Qt,N)=>{"use strict";(function(){var r={initialize:h(function(){this._tasks=new Map},"initialize"),mutate:h(function(n,s){return e(this,"mutate",n,s)},"mutate"),measure:h(function(n,s){return e(this,"measure",n,s)},"measure"),clear:h(function(n){var s=this._tasks,t=s.get(n);this.fastdom.clear(t),s.delete(n)},"clear")};function e(n,s,t,a){var i=n._tasks,l=n.fastdom,c,o=new Promise(function(p,u){c=l[s](function(){i.delete(o);try{p(a?t.call(a):t())}catch(d){u(d)}},a)});return i.set(o,c),o}h(e,"create"),(typeof define)[0]=="f"?define(function(){return r}):(typeof N)[0]=="o"?N.exports=r:window.fastdomPromised=r})()});function be(r){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];var s=Array.from(typeof r=="string"?[r]:r);s[s.length-1]=s[s.length-1].replace(/\r?\n([\t ]*)$/,"");var t=s.reduce(function(l,c){var o=c.match(/\n([\t ]+|(?!\s).)/g);return o?l.concat(o.map(function(p){var u,d;return(d=(u=p.match(/[\t ]/g))===null||u===void 0?void 0:u.length)!==null&&d!==void 0?d:0})):l},[]);if(t.length){var a=new RegExp(`
[ ]{`+Math.min.apply(Math,t)+"}","g");s=s.map(function(l){return l.replace(a,`
`)})}s[0]=s[0].replace(/^\r?\n/,"");var i=s[0];return e.forEach(function(l,c){var o=i.match(/(?:^|\n)( *)$/),p=o?o[1]:"",u=l;typeof l=="string"&&l.includes(`
`)&&(u=String(l).split(`
`).map(function(d,f){return f===0?d:""+p+d}).join(`
`)),i+=u+s[c+1]}),i}h(be,"dedent");var Ot=typeof performance<"u"&&typeof performance.now=="function";globalThis.injected??={includeLargeFeatures:!0,profiling:!1,version:"0.0.0"};var Se=de(we(),1),Te=de(ye(),1),Ke=Se.default.extend({raf(r){typeof queueMicrotask=="function"?queueMicrotask(r):setTimeout(r,0)}}).extend(Te.default),$e=Ke;function X(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}h(X,"L");var $=X();function Ae(r){$=r}h(Ae,"G");var A={exec:h(()=>null,"exec")};function k(r,e=""){let n=typeof r=="string"?r:r.source,s={replace:h((t,a)=>{let i=typeof a=="string"?a:a.source;return i=i.replace(b.caret,"$1"),n=n.replace(t,i),s},"replace"),getRegex:h(()=>new RegExp(n,e),"getRegex")};return s}h(k,"h");var b={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:h(r=>new RegExp(`^( {0,3}${r})((?:[ ][^\\n]*)?(?:\\n|$))`),"listItemRegex"),nextBulletRegex:h(r=>new RegExp(`^ {0,${Math.min(3,r-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),"nextBulletRegex"),hrRegex:h(r=>new RegExp(`^ {0,${Math.min(3,r-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),"hrRegex"),fencesBeginRegex:h(r=>new RegExp(`^ {0,${Math.min(3,r-1)}}(?:\`\`\`|~~~)`),"fencesBeginRegex"),headingBeginRegex:h(r=>new RegExp(`^ {0,${Math.min(3,r-1)}}#`),"headingBeginRegex"),htmlBeginRegex:h(r=>new RegExp(`^ {0,${Math.min(3,r-1)}}<(?:[a-z].*>|!--)`,"i"),"htmlBeginRegex")},Ye=/^(?:[ \t]*(?:\n|$))+/,Je=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,et=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,P=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,tt=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,K=/(?:[*+-]|\d{1,9}[.)])/,Pe=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Ee=k(Pe).replace(/bull/g,K).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),nt=k(Pe).replace(/bull/g,K).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Y=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,rt=/^[^\n]+/,J=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,st=k(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",J).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),it=k(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,K).getRegex(),j="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|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",ee=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,lt=k("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",ee).replace("tag",j).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),_e=k(Y).replace("hr",P).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",j).getRegex(),at=k(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",_e).getRegex(),te={blockquote:at,code:Je,def:st,fences:et,heading:tt,hr:P,html:lt,lheading:Ee,list:it,newline:Ye,paragraph:_e,table:A,text:rt},Re=k("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",P).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",j).getRegex(),ot={...te,lheading:nt,table:Re,paragraph:k(Y).replace("hr",P).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Re).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",j).getRegex()},ct={...te,html:k(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ee).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:A,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:k(Y).replace("hr",P).replace("heading",` *#{1,6} *[^
]`).replace("lheading",Ee).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},pt=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,ht=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Ie=/^( {2,}|\\)\n(?!\s*$)/,ut=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,W=/[\p{P}\p{S}]/u,ne=/[\s\p{P}\p{S}]/u,Ce=/[^\s\p{P}\p{S}]/u,dt=k(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,ne).getRegex(),Be=/(?!~)[\p{P}\p{S}]/u,ft=/(?!~)[\s\p{P}\p{S}]/u,gt=/(?:[^\s\p{P}\p{S}]|~)/u,kt=/\[[^\[\]]*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)|`[^`]*?`|<(?! )[^<>]*?>/g,je=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,mt=k(je,"u").replace(/punct/g,W).getRegex(),xt=k(je,"u").replace(/punct/g,Be).getRegex(),We="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",bt=k(We,"gu").replace(/notPunctSpace/g,Ce).replace(/punctSpace/g,ne).replace(/punct/g,W).getRegex(),wt=k(We,"gu").replace(/notPunctSpace/g,gt).replace(/punctSpace/g,ft).replace(/punct/g,Be).getRegex(),yt=k("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Ce).replace(/punctSpace/g,ne).replace(/punct/g,W).getRegex(),St=k(/\\(punct)/,"gu").replace(/punct/g,W).getRegex(),Tt=k(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[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])?)+(?![-_])/).getRegex(),$t=k(ee).replace("(?:-->|$)","-->").getRegex(),Rt=k("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",$t).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),I=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`[^`]*`|[^\[\]\\`])*?/,vt=k(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",I).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),qe=k(/^!?\[(label)\]\[(ref)\]/).replace("label",I).replace("ref",J).getRegex(),De=k(/^!?\[(ref)\](?:\[\])?/).replace("ref",J).getRegex(),zt=k("reflink|nolink(?!\\()","g").replace("reflink",qe).replace("nolink",De).getRegex(),re={_backpedal:A,anyPunctuation:St,autolink:Tt,blockSkip:kt,br:Ie,code:ht,del:A,emStrongLDelim:mt,emStrongRDelimAst:bt,emStrongRDelimUnd:yt,escape:pt,link:vt,nolink:De,punctuation:dt,reflink:qe,reflinkSearch:zt,tag:Rt,text:ut,url:A},Mt={...re,link:k(/^!?\[(label)\]\((.*?)\)/).replace("label",I).getRegex(),reflink:k(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",I).getRegex()},Q={...re,emStrongRDelimAst:wt,emStrongLDelim:xt,url:k(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},Lt={...Q,br:k(Ie).replace("{2,}","*").getRegex(),text:k(Q.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},_={normal:te,gfm:ot,pedantic:ct},z={normal:re,gfm:Q,breaks:Lt,pedantic:Mt},At={"&":"&","<":"<",">":">",'"':""","'":"'"},ve=h(r=>At[r],"ke");function w(r,e){if(e){if(b.escapeTest.test(r))return r.replace(b.escapeReplace,ve)}else if(b.escapeTestNoEncode.test(r))return r.replace(b.escapeReplaceNoEncode,ve);return r}h(w,"w");function ze(r){try{r=encodeURI(r).replace(b.percentDecode,"%")}catch{return null}return r}h(ze,"J");function Me(r,e){let n=r.replace(b.findPipe,(a,i,l)=>{let c=!1,o=i;for(;--o>=0&&l[o]==="\\";)c=!c;return c?"|":" |"}),s=n.split(b.splitPipe),t=0;if(s[0].trim()||s.shift(),s.length>0&&!s.at(-1)?.trim()&&s.pop(),e)if(s.length>e)s.splice(e);else for(;s.length<e;)s.push("");for(;t<s.length;t++)s[t]=s[t].trim().replace(b.slashPipe,"|");return s}h(Me,"V");function M(r,e,n){let s=r.length;if(s===0)return"";let t=0;for(;t<s;){let a=r.charAt(s-t-1);if(a===e&&!n)t++;else if(a!==e&&n)t++;else break}return r.slice(0,s-t)}h(M,"z");function Pt(r,e){if(r.indexOf(e[1])===-1)return-1;let n=0;for(let s=0;s<r.length;s++)if(r[s]==="\\")s++;else if(r[s]===e[0])n++;else if(r[s]===e[1]&&(n--,n<0))return s;return n>0?-2:-1}h(Pt,"ge");function Le(r,e,n,s,t){let a=e.href,i=e.title||null,l=r[1].replace(t.other.outputLinkReplace,"$1");s.state.inLink=!0;let c={type:r[0].charAt(0)==="!"?"image":"link",raw:n,href:a,title:i,text:l,tokens:s.inlineTokens(l)};return s.state.inLink=!1,c}h(Le,"fe");function Et(r,e,n){let s=r.match(n.other.indentCodeCompensation);if(s===null)return e;let t=s[1];return e.split(`
`).map(a=>{let i=a.match(n.other.beginningSpace);if(i===null)return a;let[l]=i;return l.length>=t.length?a.slice(t.length):a}).join(`
`)}h(Et,"Je");var C=class{static{h(this,"y")}options;rules;lexer;constructor(r){this.options=r||$}space(r){let e=this.rules.block.newline.exec(r);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(r){let e=this.rules.block.code.exec(r);if(e){let n=e[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:e[0],codeBlockStyle:"indented",text:this.options.pedantic?n:M(n,`
`)}}}fences(r){let e=this.rules.block.fences.exec(r);if(e){let n=e[0],s=Et(n,e[3]||"",this.rules);return{type:"code",raw:n,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:s}}}heading(r){let e=this.rules.block.heading.exec(r);if(e){let n=e[2].trim();if(this.rules.other.endingHash.test(n)){let s=M(n,"#");(this.options.pedantic||!s||this.rules.other.endingSpaceChar.test(s))&&(n=s.trim())}return{type:"heading",raw:e[0],depth:e[1].length,text:n,tokens:this.lexer.inline(n)}}}hr(r){let e=this.rules.block.hr.exec(r);if(e)return{type:"hr",raw:M(e[0],`
`)}}blockquote(r){let e=this.rules.block.blockquote.exec(r);if(e){let n=M(e[0],`
`).split(`
`),s="",t="",a=[];for(;n.length>0;){let i=!1,l=[],c;for(c=0;c<n.length;c++)if(this.rules.other.blockquoteStart.test(n[c]))l.push(n[c]),i=!0;else if(!i)l.push(n[c]);else break;n=n.slice(c);let o=l.join(`
`),p=o.replace(this.rules.other.blockquoteSetextReplace,`
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");s=s?`${s}
${o}`:o,t=t?`${t}
${p}`:p;let u=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(p,a,!0),this.lexer.state.top=u,n.length===0)break;let d=a.at(-1);if(d?.type==="code")break;if(d?.type==="blockquote"){let f=d,m=f.raw+`
`+n.join(`
`),x=this.blockquote(m);a[a.length-1]=x,s=s.substring(0,s.length-f.raw.length)+x.raw,t=t.substring(0,t.length-f.text.length)+x.text;break}else if(d?.type==="list"){let f=d,m=f.raw+`
`+n.join(`
`),x=this.list(m);a[a.length-1]=x,s=s.substring(0,s.length-d.raw.length)+x.raw,t=t.substring(0,t.length-f.raw.length)+x.raw,n=m.substring(a.at(-1).raw.length).split(`
`);continue}}return{type:"blockquote",raw:s,tokens:a,text:t}}}list(r){let e=this.rules.block.list.exec(r);if(e){let n=e[1].trim(),s=n.length>1,t={type:"list",raw:"",ordered:s,start:s?+n.slice(0,-1):"",loose:!1,items:[]};n=s?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=s?n:"[*+-]");let a=this.rules.other.listItemRegex(n),i=!1;for(;r;){let c=!1,o="",p="";if(!(e=a.exec(r))||this.rules.block.hr.test(r))break;o=e[0],r=r.substring(o.length);let u=e[2].split(`
`,1)[0].replace(this.rules.other.listReplaceTabs,q=>" ".repeat(3*q.length)),d=r.split(`
`,1)[0],f=!u.trim(),m=0;if(this.options.pedantic?(m=2,p=u.trimStart()):f?m=e[1].length+1:(m=e[2].search(this.rules.other.nonSpaceChar),m=m>4?1:m,p=u.slice(m),m+=e[1].length),f&&this.rules.other.blankLine.test(d)&&(o+=d+`
`,r=r.substring(d.length+1),c=!0),!c){let q=this.rules.other.nextBulletRegex(m),ce=this.rules.other.hrRegex(m),pe=this.rules.other.fencesBeginRegex(m),he=this.rules.other.headingBeginRegex(m),Xe=this.rules.other.htmlBeginRegex(m);for(;r;){let D=r.split(`
`,1)[0],v;if(d=D,this.options.pedantic?(d=d.replace(this.rules.other.listReplaceNesting," "),v=d):v=d.replace(this.rules.other.tabCharGlobal," "),pe.test(d)||he.test(d)||Xe.test(d)||q.test(d)||ce.test(d))break;if(v.search(this.rules.other.nonSpaceChar)>=m||!d.trim())p+=`
`+v.slice(m);else{if(f||u.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||pe.test(u)||he.test(u)||ce.test(u))break;p+=`
`+d}!f&&!d.trim()&&(f=!0),o+=D+`
`,r=r.substring(D.length+1),u=v.slice(m)}}t.loose||(i?t.loose=!0:this.rules.other.doubleBlankLine.test(o)&&(i=!0));let x=null,oe;this.options.gfm&&(x=this.rules.other.listIsTask.exec(p),x&&(oe=x[0]!=="[ ] ",p=p.replace(this.rules.other.listReplaceTask,""))),t.items.push({type:"list_item",raw:o,task:!!x,checked:oe,loose:!1,text:p,tokens:[]}),t.raw+=o}let l=t.items.at(-1);if(l)l.raw=l.raw.trimEnd(),l.text=l.text.trimEnd();else return;t.raw=t.raw.trimEnd();for(let c=0;c<t.items.length;c++)if(this.lexer.state.top=!1,t.items[c].tokens=this.lexer.blockTokens(t.items[c].text,[]),!t.loose){let o=t.items[c].tokens.filter(u=>u.type==="space"),p=o.length>0&&o.some(u=>this.rules.other.anyLine.test(u.raw));t.loose=p}if(t.loose)for(let c=0;c<t.items.length;c++)t.items[c].loose=!0;return t}}html(r){let e=this.rules.block.html.exec(r);if(e)return{type:"html",block:!0,raw:e[0],pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:e[0]}}def(r){let e=this.rules.block.def.exec(r);if(e){let n=e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),s=e[2]?e[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",t=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:n,raw:e[0],href:s,title:t}}}table(r){let e=this.rules.block.table.exec(r);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;let n=Me(e[1]),s=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),t=e[3]?.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
`):[],a={type:"table",raw:e[0],header:[],align:[],rows:[]};if(n.length===s.length){for(let i of s)this.rules.other.tableAlignRight.test(i)?a.align.push("right"):this.rules.other.tableAlignCenter.test(i)?a.align.push("center"):this.rules.other.tableAlignLeft.test(i)?a.align.push("left"):a.align.push(null);for(let i=0;i<n.length;i++)a.header.push({text:n[i],tokens:this.lexer.inline(n[i]),header:!0,align:a.align[i]});for(let i of t)a.rows.push(Me(i,a.header.length).map((l,c)=>({text:l,tokens:this.lexer.inline(l),header:!1,align:a.align[c]})));return a}}lheading(r){let e=this.rules.block.lheading.exec(r);if(e)return{type:"heading",raw:e[0],depth:e[2].charAt(0)==="="?1:2,text:e[1],tokens:this.lexer.inline(e[1])}}paragraph(r){let e=this.rules.block.paragraph.exec(r);if(e){let n=e[1].charAt(e[1].length-1)===`
`?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:n,tokens:this.lexer.inline(n)}}}text(r){let e=this.rules.block.text.exec(r);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(r){let e=this.rules.inline.escape.exec(r);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(r){let e=this.rules.inline.tag.exec(r);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(r){let e=this.rules.inline.link.exec(r);if(e){let n=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;let a=M(n.slice(0,-1),"\\");if((n.length-a.length)%2===0)return}else{let a=Pt(e[2],"()");if(a===-2)return;if(a>-1){let i=(e[0].indexOf("!")===0?5:4)+e[1].length+a;e[2]=e[2].substring(0,a),e[0]=e[0].substring(0,i).trim(),e[3]=""}}let s=e[2],t="";if(this.options.pedantic){let a=this.rules.other.pedanticHrefTitle.exec(s);a&&(s=a[1],t=a[3])}else t=e[3]?e[3].slice(1,-1):"";return s=s.trim(),this.rules.other.startAngleBracket.test(s)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(n)?s=s.slice(1):s=s.slice(1,-1)),Le(e,{href:s&&s.replace(this.rules.inline.anyPunctuation,"$1"),title:t&&t.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(r,e){let n;if((n=this.rules.inline.reflink.exec(r))||(n=this.rules.inline.nolink.exec(r))){let s=(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," "),t=e[s.toLowerCase()];if(!t){let a=n[0].charAt(0);return{type:"text",raw:a,text:a}}return Le(n,t,n[0],this.lexer,this.rules)}}emStrong(r,e,n=""){let s=this.rules.inline.emStrongLDelim.exec(r);if(!(!s||s[3]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(s[1]||s[2])||!n||this.rules.inline.punctuation.exec(n))){let t=[...s[0]].length-1,a,i,l=t,c=0,o=s[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(o.lastIndex=0,e=e.slice(-1*r.length+t);(s=o.exec(e))!=null;){if(a=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!a)continue;if(i=[...a].length,s[3]||s[4]){l+=i;continue}else if((s[5]||s[6])&&t%3&&!((t+i)%3)){c+=i;continue}if(l-=i,l>0)continue;i=Math.min(i,i+l+c);let p=[...s[0]][0].length,u=r.slice(0,t+s.index+p+i);if(Math.min(t,i)%2){let f=u.slice(1,-1);return{type:"em",raw:u,text:f,tokens:this.lexer.inlineTokens(f)}}let d=u.slice(2,-2);return{type:"strong",raw:u,text:d,tokens:this.lexer.inlineTokens(d)}}}}codespan(r){let e=this.rules.inline.code.exec(r);if(e){let n=e[2].replace(this.rules.other.newLineCharGlobal," "),s=this.rules.other.nonSpaceChar.test(n),t=this.rules.other.startingSpaceChar.test(n)&&this.rules.other.endingSpaceChar.test(n);return s&&t&&(n=n.substring(1,n.length-1)),{type:"codespan",raw:e[0],text:n}}}br(r){let e=this.rules.inline.br.exec(r);if(e)return{type:"br",raw:e[0]}}del(r){let e=this.rules.inline.del.exec(r);if(e)return{type:"del",raw:e[0],text:e[2],tokens:this.lexer.inlineTokens(e[2])}}autolink(r){let e=this.rules.inline.autolink.exec(r);if(e){let n,s;return e[2]==="@"?(n=e[1],s="mailto:"+n):(n=e[1],s=n),{type:"link",raw:e[0],text:n,href:s,tokens:[{type:"text",raw:n,text:n}]}}}url(r){let e;if(e=this.rules.inline.url.exec(r)){let n,s;if(e[2]==="@")n=e[0],s="mailto:"+n;else{let t;do t=e[0],e[0]=this.rules.inline._backpedal.exec(e[0])?.[0]??"";while(t!==e[0]);n=e[0],e[1]==="www."?s="http://"+e[0]:s=e[0]}return{type:"link",raw:e[0],text:n,href:s,tokens:[{type:"text",raw:n,text:n}]}}}inlineText(r){let e=this.rules.inline.text.exec(r);if(e){let n=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:n}}}},y=class V{static{h(this,"l")}tokens;options;state;tokenizer;inlineQueue;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||$,this.options.tokenizer=this.options.tokenizer||new C,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let n={other:b,block:_.normal,inline:z.normal};this.options.pedantic?(n.block=_.pedantic,n.inline=z.pedantic):this.options.gfm&&(n.block=_.gfm,this.options.breaks?n.inline=z.breaks:n.inline=z.gfm),this.tokenizer.rules=n}static get rules(){return{block:_,inline:z}}static lex(e,n){return new V(n).lex(e)}static lexInline(e,n){return new V(n).inlineTokens(e)}lex(e){e=e.replace(b.carriageReturn,`
`),this.blockTokens(e,this.tokens);for(let n=0;n<this.inlineQueue.length;n++){let s=this.inlineQueue[n];this.inlineTokens(s.src,s.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,n=[],s=!1){for(this.options.pedantic&&(e=e.replace(b.tabCharGlobal," ").replace(b.spaceLine,""));e;){let t;if(this.options.extensions?.block?.some(i=>(t=i.call({lexer:this},e,n))?(e=e.substring(t.raw.length),n.push(t),!0):!1))continue;if(t=this.tokenizer.space(e)){e=e.substring(t.raw.length);let i=n.at(-1);t.raw.length===1&&i!==void 0?i.raw+=`
`:n.push(t);continue}if(t=this.tokenizer.code(e)){e=e.substring(t.raw.length);let i=n.at(-1);i?.type==="paragraph"||i?.type==="text"?(i.raw+=(i.raw.endsWith(`
`)?"":`
`)+t.raw,i.text+=`
`+t.text,this.inlineQueue.at(-1).src=i.text):n.push(t);continue}if(t=this.tokenizer.fences(e)){e=e.substring(t.raw.length),n.push(t);continue}if(t=this.tokenizer.heading(e)){e=e.substring(t.raw.length),n.push(t);continue}if(t=this.tokenizer.hr(e)){e=e.substring(t.raw.length),n.push(t);continue}if(t=this.tokenizer.blockquote(e)){e=e.substring(t.raw.length),n.push(t);continue}if(t=this.tokenizer.list(e)){e=e.substring(t.raw.length),n.push(t);continue}if(t=this.tokenizer.html(e)){e=e.substring(t.raw.length),n.push(t);continue}if(t=this.tokenizer.def(e)){e=e.substring(t.raw.length);let i=n.at(-1);i?.type==="paragraph"||i?.type==="text"?(i.raw+=(i.raw.endsWith(`
`)?"":`
`)+t.raw,i.text+=`
`+t.raw,this.inlineQueue.at(-1).src=i.text):this.tokens.links[t.tag]||(this.tokens.links[t.tag]={href:t.href,title:t.title},n.push(t));continue}if(t=this.tokenizer.table(e)){e=e.substring(t.raw.length),n.push(t);continue}if(t=this.tokenizer.lheading(e)){e=e.substring(t.raw.length),n.push(t);continue}let a=e;if(this.options.extensions?.startBlock){let i=1/0,l=e.slice(1),c;this.options.extensions.startBlock.forEach(o=>{c=o.call({lexer:this},l),typeof c=="number"&&c>=0&&(i=Math.min(i,c))}),i<1/0&&i>=0&&(a=e.substring(0,i+1))}if(this.state.top&&(t=this.tokenizer.paragraph(a))){let i=n.at(-1);s&&i?.type==="paragraph"?(i.raw+=(i.raw.endsWith(`
`)?"":`
`)+t.raw,i.text+=`
`+t.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=i.text):n.push(t),s=a.length!==e.length,e=e.substring(t.raw.length);continue}if(t=this.tokenizer.text(e)){e=e.substring(t.raw.length);let i=n.at(-1);i?.type==="text"?(i.raw+=(i.raw.endsWith(`
`)?"":`
`)+t.raw,i.text+=`
`+t.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=i.text):n.push(t);continue}if(e){let i="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(i);break}else throw new Error(i)}}return this.state.top=!0,n}inline(e,n=[]){return this.inlineQueue.push({src:e,tokens:n}),n}inlineTokens(e,n=[]){let s=e,t=null;if(this.tokens.links){let l=Object.keys(this.tokens.links);if(l.length>0)for(;(t=this.tokenizer.rules.inline.reflinkSearch.exec(s))!=null;)l.includes(t[0].slice(t[0].lastIndexOf("[")+1,-1))&&(s=s.slice(0,t.index)+"["+"a".repeat(t[0].length-2)+"]"+s.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(t=this.tokenizer.rules.inline.anyPunctuation.exec(s))!=null;)s=s.slice(0,t.index)+"++"+s.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;(t=this.tokenizer.rules.inline.blockSkip.exec(s))!=null;)s=s.slice(0,t.index)+"["+"a".repeat(t[0].length-2)+"]"+s.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);s=this.options.hooks?.emStrongMask?.call({lexer:this},s)??s;let a=!1,i="";for(;e;){a||(i=""),a=!1;let l;if(this.options.extensions?.inline?.some(o=>(l=o.call({lexer:this},e,n))?(e=e.substring(l.raw.length),n.push(l),!0):!1))continue;if(l=this.tokenizer.escape(e)){e=e.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.tag(e)){e=e.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.link(e)){e=e.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(l.raw.length);let o=n.at(-1);l.type==="text"&&o?.type==="text"?(o.raw+=l.raw,o.text+=l.text):n.push(l);continue}if(l=this.tokenizer.emStrong(e,s,i)){e=e.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.codespan(e)){e=e.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.br(e)){e=e.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.del(e)){e=e.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.autolink(e)){e=e.substring(l.raw.length),n.push(l);continue}if(!this.state.inLink&&(l=this.tokenizer.url(e))){e=e.substring(l.raw.length),n.push(l);continue}let c=e;if(this.options.extensions?.startInline){let o=1/0,p=e.slice(1),u;this.options.extensions.startInline.forEach(d=>{u=d.call({lexer:this},p),typeof u=="number"&&u>=0&&(o=Math.min(o,u))}),o<1/0&&o>=0&&(c=e.substring(0,o+1))}if(l=this.tokenizer.inlineText(c)){e=e.substring(l.raw.length),l.raw.slice(-1)!=="_"&&(i=l.raw.slice(-1)),a=!0;let o=n.at(-1);o?.type==="text"?(o.raw+=l.raw,o.text+=l.text):n.push(l);continue}if(e){let o="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(o);break}else throw new Error(o)}}return n}},B=class{static{h(this,"P")}options;parser;constructor(r){this.options=r||$}space(r){return""}code({text:r,lang:e,escaped:n}){let s=(e||"").match(b.notSpaceStart)?.[0],t=r.replace(b.endingNewline,"")+`
`;return s?'<pre><code class="language-'+w(s)+'">'+(n?t:w(t,!0))+`</code></pre>
`:"<pre><code>"+(n?t:w(t,!0))+`</code></pre>
`}blockquote({tokens:r}){return`<blockquote>
${this.parser.parse(r)}</blockquote>
`}html({text:r}){return r}def(r){return""}heading({tokens:r,depth:e}){return`<h${e}>${this.parser.parseInline(r)}</h${e}>
`}hr(r){return`<hr>
`}list(r){let e=r.ordered,n=r.start,s="";for(let i=0;i<r.items.length;i++){let l=r.items[i];s+=this.listitem(l)}let t=e?"ol":"ul",a=e&&n!==1?' start="'+n+'"':"";return"<"+t+a+`>
`+s+"</"+t+`>
`}listitem(r){let e="";if(r.task){let n=this.checkbox({checked:!!r.checked});r.loose?r.tokens[0]?.type==="paragraph"?(r.tokens[0].text=n+" "+r.tokens[0].text,r.tokens[0].tokens&&r.tokens[0].tokens.length>0&&r.tokens[0].tokens[0].type==="text"&&(r.tokens[0].tokens[0].text=n+" "+w(r.tokens[0].tokens[0].text),r.tokens[0].tokens[0].escaped=!0)):r.tokens.unshift({type:"text",raw:n+" ",text:n+" ",escaped:!0}):e+=n+" "}return e+=this.parser.parse(r.tokens,!!r.loose),`<li>${e}</li>
`}checkbox({checked:r}){return"<input "+(r?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph({tokens:r}){return`<p>${this.parser.parseInline(r)}</p>
`}table(r){let e="",n="";for(let t=0;t<r.header.length;t++)n+=this.tablecell(r.header[t]);e+=this.tablerow({text:n});let s="";for(let t=0;t<r.rows.length;t++){let a=r.rows[t];n="";for(let i=0;i<a.length;i++)n+=this.tablecell(a[i]);s+=this.tablerow({text:n})}return s&&(s=`<tbody>${s}</tbody>`),`<table>
<thead>
`+e+`</thead>
`+s+`</table>
`}tablerow({text:r}){return`<tr>
${r}</tr>
`}tablecell(r){let e=this.parser.parseInline(r.tokens),n=r.header?"th":"td";return(r.align?`<${n} align="${r.align}">`:`<${n}>`)+e+`</${n}>
`}strong({tokens:r}){return`<strong>${this.parser.parseInline(r)}</strong>`}em({tokens:r}){return`<em>${this.parser.parseInline(r)}</em>`}codespan({text:r}){return`<code>${w(r,!0)}</code>`}br(r){return"<br>"}del({tokens:r}){return`<del>${this.parser.parseInline(r)}</del>`}link({href:r,title:e,tokens:n}){let s=this.parser.parseInline(n),t=ze(r);if(t===null)return s;r=t;let a='<a href="'+r+'"';return e&&(a+=' title="'+w(e)+'"'),a+=">"+s+"</a>",a}image({href:r,title:e,text:n,tokens:s}){s&&(n=this.parser.parseInline(s,this.parser.textRenderer));let t=ze(r);if(t===null)return w(n);r=t;let a=`<img src="${r}" alt="${n}"`;return e&&(a+=` title="${w(e)}"`),a+=">",a}text(r){return"tokens"in r&&r.tokens?this.parser.parseInline(r.tokens):"escaped"in r&&r.escaped?r.text:w(r.text)}},se=class{static{h(this,"$")}strong({text:r}){return r}em({text:r}){return r}codespan({text:r}){return r}del({text:r}){return r}html({text:r}){return r}text({text:r}){return r}link({text:r}){return""+r}image({text:r}){return""+r}br(){return""}},S=class U{static{h(this,"l")}options;renderer;textRenderer;constructor(e){this.options=e||$,this.options.renderer=this.options.renderer||new B,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new se}static parse(e,n){return new U(n).parse(e)}static parseInline(e,n){return new U(n).parseInline(e)}parse(e,n=!0){let s="";for(let t=0;t<e.length;t++){let a=e[t];if(this.options.extensions?.renderers?.[a.type]){let l=a,c=this.options.extensions.renderers[l.type].call({parser:this},l);if(c!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(l.type)){s+=c||"";continue}}let i=a;switch(i.type){case"space":{s+=this.renderer.space(i);continue}case"hr":{s+=this.renderer.hr(i);continue}case"heading":{s+=this.renderer.heading(i);continue}case"code":{s+=this.renderer.code(i);continue}case"table":{s+=this.renderer.table(i);continue}case"blockquote":{s+=this.renderer.blockquote(i);continue}case"list":{s+=this.renderer.list(i);continue}case"html":{s+=this.renderer.html(i);continue}case"def":{s+=this.renderer.def(i);continue}case"paragraph":{s+=this.renderer.paragraph(i);continue}case"text":{let l=i,c=this.renderer.text(l);for(;t+1<e.length&&e[t+1].type==="text";)l=e[++t],c+=`
`+this.renderer.text(l);n?s+=this.renderer.paragraph({type:"paragraph",raw:c,text:c,tokens:[{type:"text",raw:c,text:c,escaped:!0}]}):s+=c;continue}default:{let l='Token with "'+i.type+'" type was not found.';if(this.options.silent)return console.error(l),"";throw new Error(l)}}}return s}parseInline(e,n=this.renderer){let s="";for(let t=0;t<e.length;t++){let a=e[t];if(this.options.extensions?.renderers?.[a.type]){let l=this.options.extensions.renderers[a.type].call({parser:this},a);if(l!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(a.type)){s+=l||"";continue}}let i=a;switch(i.type){case"escape":{s+=n.text(i);break}case"html":{s+=n.html(i);break}case"link":{s+=n.link(i);break}case"image":{s+=n.image(i);break}case"strong":{s+=n.strong(i);break}case"em":{s+=n.em(i);break}case"codespan":{s+=n.codespan(i);break}case"br":{s+=n.br(i);break}case"del":{s+=n.del(i);break}case"text":{s+=n.text(i);break}default:{let l='Token with "'+i.type+'" type was not found.';if(this.options.silent)return console.error(l),"";throw new Error(l)}}}return s}},L=class{static{h(this,"S")}options;block;constructor(r){this.options=r||$}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens","emStrongMask"]);static passThroughHooksRespectAsync=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(r){return r}postprocess(r){return r}processAllTokens(r){return r}emStrongMask(r){return r}provideLexer(){return this.block?y.lex:y.lexInline}provideParser(){return this.block?S.parse:S.parseInline}},_t=class{static{h(this,"B")}defaults=X();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=S;Renderer=B;TextRenderer=se;Lexer=y;Tokenizer=C;Hooks=L;constructor(...r){this.use(...r)}walkTokens(r,e){let n=[];for(let s of r)switch(n=n.concat(e.call(this,s)),s.type){case"table":{let t=s;for(let a of t.header)n=n.concat(this.walkTokens(a.tokens,e));for(let a of t.rows)for(let i of a)n=n.concat(this.walkTokens(i.tokens,e));break}case"list":{let t=s;n=n.concat(this.walkTokens(t.items,e));break}default:{let t=s;this.defaults.extensions?.childTokens?.[t.type]?this.defaults.extensions.childTokens[t.type].forEach(a=>{let i=t[a].flat(1/0);n=n.concat(this.walkTokens(i,e))}):t.tokens&&(n=n.concat(this.walkTokens(t.tokens,e)))}}return n}use(...r){let e=this.defaults.extensions||{renderers:{},childTokens:{}};return r.forEach(n=>{let s={...n};if(s.async=this.defaults.async||s.async||!1,n.extensions&&(n.extensions.forEach(t=>{if(!t.name)throw new Error("extension name required");if("renderer"in t){let a=e.renderers[t.name];a?e.renderers[t.name]=function(...i){let l=t.renderer.apply(this,i);return l===!1&&(l=a.apply(this,i)),l}:e.renderers[t.name]=t.renderer}if("tokenizer"in t){if(!t.level||t.level!=="block"&&t.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let a=e[t.level];a?a.unshift(t.tokenizer):e[t.level]=[t.tokenizer],t.start&&(t.level==="block"?e.startBlock?e.startBlock.push(t.start):e.startBlock=[t.start]:t.level==="inline"&&(e.startInline?e.startInline.push(t.start):e.startInline=[t.start]))}"childTokens"in t&&t.childTokens&&(e.childTokens[t.name]=t.childTokens)}),s.extensions=e),n.renderer){let t=this.defaults.renderer||new B(this.defaults);for(let a in n.renderer){if(!(a in t))throw new Error(`renderer '${a}' does not exist`);if(["options","parser"].includes(a))continue;let i=a,l=n.renderer[i],c=t[i];t[i]=(...o)=>{let p=l.apply(t,o);return p===!1&&(p=c.apply(t,o)),p||""}}s.renderer=t}if(n.tokenizer){let t=this.defaults.tokenizer||new C(this.defaults);for(let a in n.tokenizer){if(!(a in t))throw new Error(`tokenizer '${a}' does not exist`);if(["options","rules","lexer"].includes(a))continue;let i=a,l=n.tokenizer[i],c=t[i];t[i]=(...o)=>{let p=l.apply(t,o);return p===!1&&(p=c.apply(t,o)),p}}s.tokenizer=t}if(n.hooks){let t=this.defaults.hooks||new L;for(let a in n.hooks){if(!(a in t))throw new Error(`hook '${a}' does not exist`);if(["options","block"].includes(a))continue;let i=a,l=n.hooks[i],c=t[i];L.passThroughHooks.has(a)?t[i]=o=>{if(this.defaults.async&&L.passThroughHooksRespectAsync.has(a))return Promise.resolve(l.call(t,o)).then(u=>c.call(t,u));let p=l.call(t,o);return c.call(t,p)}:t[i]=(...o)=>{let p=l.apply(t,o);return p===!1&&(p=c.apply(t,o)),p}}s.hooks=t}if(n.walkTokens){let t=this.defaults.walkTokens,a=n.walkTokens;s.walkTokens=function(i){let l=[];return l.push(a.call(this,i)),t&&(l=l.concat(t.call(this,i))),l}}this.defaults={...this.defaults,...s}}),this}setOptions(r){return this.defaults={...this.defaults,...r},this}lexer(r,e){return y.lex(r,e??this.defaults)}parser(r,e){return S.parse(r,e??this.defaults)}parseMarkdown(r){return(e,n)=>{let s={...n},t={...this.defaults,...s},a=this.onError(!!t.silent,!!t.async);if(this.defaults.async===!0&&s.async===!1)return a(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof e>"u"||e===null)return a(new Error("marked(): input parameter is undefined or null"));if(typeof e!="string")return a(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected"));t.hooks&&(t.hooks.options=t,t.hooks.block=r);let i=t.hooks?t.hooks.provideLexer():r?y.lex:y.lexInline,l=t.hooks?t.hooks.provideParser():r?S.parse:S.parseInline;if(t.async)return Promise.resolve(t.hooks?t.hooks.preprocess(e):e).then(c=>i(c,t)).then(c=>t.hooks?t.hooks.processAllTokens(c):c).then(c=>t.walkTokens?Promise.all(this.walkTokens(c,t.walkTokens)).then(()=>c):c).then(c=>l(c,t)).then(c=>t.hooks?t.hooks.postprocess(c):c).catch(a);try{t.hooks&&(e=t.hooks.preprocess(e));let c=i(e,t);t.hooks&&(c=t.hooks.processAllTokens(c)),t.walkTokens&&this.walkTokens(c,t.walkTokens);let o=l(c,t);return t.hooks&&(o=t.hooks.postprocess(o)),o}catch(c){return a(c)}}}onError(r,e){return n=>{if(n.message+=`
Please report this to https://github.com/markedjs/marked.`,r){let s="<p>An error occurred:</p><pre>"+w(n.message+"",!0)+"</pre>";return e?Promise.resolve(s):s}if(e)return Promise.reject(n);throw n}}},T=new _t;function g(r,e){return T.parse(r,e)}h(g,"d");g.options=g.setOptions=function(r){return T.setOptions(r),g.defaults=T.defaults,Ae(g.defaults),g};g.getDefaults=X;g.defaults=$;g.use=function(...r){return T.use(...r),g.defaults=T.defaults,Ae(g.defaults),g};g.walkTokens=function(r,e){return T.walkTokens(r,e)};g.parseInline=T.parseInline;g.Parser=S;g.parser=S.parse;g.Renderer=B;g.TextRenderer=se;g.Lexer=y;g.lexer=y.lex;g.Tokenizer=C;g.Hooks=L;g.parse=g;var Xt=g.options,Kt=g.setOptions,Yt=g.use,Jt=g.walkTokens,en=g.parseInline;var tn=S.parse,nn=y.lex;function It(r,{markdownAutoWrap:e}){let s=r.replace(/<br\/>/g,`
`).replace(/\n{2,}/g,`
`);return be(s)}h(It,"preprocessMarkdown");function Fe(r){return r.split(/\\n|\n|<br\s*\/?>/gi).map(e=>e.trim().match(/<[^>]+>|[^\s<>]+/g)?.map(n=>({content:n,type:"normal"}))??[])}h(Fe,"nonMarkdownToLines");function Ge(r,e={}){let n=It(r,e),s=g.lexer(n),t=[[]],a=0;function i(l,c="normal"){l.type==="text"?l.text.split(`
`).forEach((p,u)=>{u!==0&&(a++,t.push([])),p.split(" ").forEach(d=>{d=d.replace(/'/g,"'"),d&&t[a].push({content:d,type:c})})}):l.type==="strong"||l.type==="em"?l.tokens.forEach(o=>{i(o,l.type)}):l.type==="html"&&t[a].push({content:l.text,type:"normal"})}return h(i,"processNode"),s.forEach(l=>{l.type==="paragraph"?l.tokens?.forEach(c=>{i(c)}):l.type==="html"?t[a].push({content:l.text,type:"normal"}):t[a].push({content:l.raw,type:"normal"})}),t}h(Ge,"markdownToLines");function Oe(r){return r?`<p>${r.replace(/\\n|\n/g,"<br />")}</p>`:""}h(Oe,"nonMarkdownToHTML");function Ze(r,{markdownAutoWrap:e}={}){let n=g.lexer(r);function s(t){return t.type==="text"?e===!1?t.text.replace(/\n */g,"<br/>").replace(/ /g," "):t.text.replace(/\n */g,"<br/>"):t.type==="strong"?`<strong>${t.tokens?.map(s).join("")}</strong>`:t.type==="em"?`<em>${t.tokens?.map(s).join("")}</em>`:t.type==="paragraph"?`<p>${t.tokens?.map(s).join("")}</p>`:t.type==="space"?"":t.type==="html"?`${t.text}`:t.type==="escape"?t.text:(E.warn(`Unsupported markdown: ${t.type}`),t.raw)}return h(s,"output"),n.map(s).join("")}h(Ze,"markdownToHTML");function Ct(r){return Intl.Segmenter?[...new Intl.Segmenter().segment(r)].map(e=>e.segment):[...r]}h(Ct,"splitTextToChars");function Bt(r,e){let n=Ct(e.content);return He(r,[],n,e.type)}h(Bt,"splitWordToFitWidth");function He(r,e,n,s){if(n.length===0)return[{content:e.join(""),type:s},{content:"",type:s}];let[t,...a]=n,i=[...e,t];return r([{content:i.join(""),type:s}])?He(r,i,a,s):(e.length===0&&t&&(e.push(t),n.shift()),[{content:e.join(""),type:s},{content:n.join(""),type:s}])}h(He,"splitWordToFitWidthRecursion");function Ne(r,e){if(r.some(({content:n})=>n.includes(`
`)))throw new Error("splitLineToFitWidth does not support newlines in the line");return ie(r,e)}h(Ne,"splitLineToFitWidth");function ie(r,e,n=[],s=[]){if(r.length===0)return s.length>0&&n.push(s),n.length>0?n:[];let t="";r[0].content===" "&&(t=" ",r.shift());let a=r.shift()??{content:" ",type:"normal"},i=[...s];if(t!==""&&i.push({content:t,type:"normal"}),i.push(a),e(i))return ie(r,e,n,i);if(s.length>0)n.push(s),r.unshift(a);else if(a.content){let[l,c]=Bt(e,a);n.push([l]),c.content&&r.unshift(c)}return ie(r,e,n)}h(ie,"splitLineToFitWidthRecursion");function Qe(r,e){e&&r.attr("style",e)}h(Qe,"applyStyle");var Ve=16384;async function jt(r,e,n,s,t=!1,a=fe()){let i=r.append("foreignObject");i.attr("width",`${Math.min(10*n,Ve)}px`),i.attr("height",`${Math.min(10*n,Ve)}px`);let l=i.append("xhtml:div"),c=G(e.label)?await ge(e.label.replace(ke.lineBreakRegex,`
`),a):F(e.label,a),o=e.isNode?"nodeLabel":"edgeLabel",p=l.append("span");return p.html(c),Qe(p,e.labelStyle),p.attr("class",`${o} ${s}`),Qe(l,e.labelStyle),l.style("display","table-cell"),l.style("white-space","nowrap"),l.style("line-height","1.5"),n!==Number.POSITIVE_INFINITY&&(l.style("max-width",n+"px"),l.style("text-align","center")),l.attr("xmlns","http://www.w3.org/1999/xhtml"),t&&l.attr("class","labelBkg"),(await $e.measure(()=>l.node().getBoundingClientRect())).width===n&&(l.style("display","table"),l.style("white-space","break-spaces"),l.style("width",n+"px")),i.node()}h(jt,"addHtmlSpan");function le(r,e,n,s=!1){let t=r.append("tspan").attr("class","text-outer-tspan").attr("x",0).attr("y",e*n-.1+"em").attr("dy",n+"em");return s&&t.attr("text-anchor","middle"),t}h(le,"createTspan");function Wt(r,e,n){let s=r.append("text"),t=le(s,1,e);ae(t,n);let a=t.node().getComputedTextLength();return s.remove(),a}h(Wt,"computeWidthOfText");function Ln(r,e,n){let s=r.append("text"),t=le(s,1,e);ae(t,[{content:n,type:"normal"}]);let a=t.node()?.getBoundingClientRect();return a&&s.remove(),a}h(Ln,"computeDimensionOfText");function qt(r,e,n,s=!1,t=!1){let i=e.append("g"),l=i.insert("rect").attr("class","background").attr("style","stroke: none"),c=i.append("text").attr("y","-10.1");t&&c.attr("text-anchor","middle");let o=0;for(let p of n){let u=h(f=>Wt(i,1.1,f)<=r,"checkWidth"),d=u(p)?[p]:Ne(p,u);for(let f of d){let m=le(c,o,1.1,t);ae(m,f),o++}}if(s){let p=c.node().getBBox(),u=2;return l.attr("x",p.x-u).attr("y",p.y-u).attr("width",p.width+2*u).attr("height",p.height+2*u),i.node()}else return c.node()}h(qt,"createFormattedText");function Ue(r){let e=/&(amp|lt|gt);/g;return r.replace(e,(n,s)=>{switch(s){case"amp":return"&";case"lt":return"<";case"gt":return">";default:return n}})}h(Ue,"decodeHTMLEntities");function ae(r,e){r.text(""),e.forEach((n,s)=>{let t=r.append("tspan").attr("font-style",n.type==="em"?"italic":"normal").attr("class","text-inner-tspan").attr("font-weight",n.type==="strong"?"bold":"normal");s===0?t.text(Ue(n.content)):t.text(" "+Ue(n.content))})}h(ae,"updateTextContentAndStyles");async function Dt(r,e={}){let n=[];r.replace(/(fa[bklrs]?):fa-([\w-]+)/g,(t,a,i)=>(n.push((async()=>{let l=`${a}:${i}`;return await me(l)?await xe(l,void 0,{class:"label-icon"}):`<i class='${F(t,e).replace(":"," ")}'></i>`})()),t));let s=await Promise.all(n);return r.replace(/(fa[bklrs]?):fa-([\w-]+)/g,()=>s.shift()??"")}h(Dt,"replaceIconSubstring");var An=h(async(r,e="",{style:n="",isTitle:s=!1,classes:t="",useHtmlLabels:a=!0,markdown:i=!0,isNode:l=!0,width:c=200,addSvgBackground:o=!1}={},p)=>{if(E.debug("XYZ createText",e,n,s,t,a,l,"addSvgBackground: ",o),a){let u=i?Ze(e,p):Oe(e),d=await Dt(O(u),p),f=e.replace(/\\\\/g,"\\"),m={isNode:l,label:G(e)?f:d,labelStyle:n.replace("fill:","color:")};return await jt(r,m,c,t,o,p)}else{let u=O(e.replace(/<br\s*\/?>/g,"<br/>")),d=i?Ge(u.replace("<br>","<br/>"),p):Fe(u),f=qt(c,r,d,e?o:!1,!l);if(l){/stroke:/.exec(n)&&(n=n.replace("stroke:","lineColor:"));let m=n.replace(/stroke:[^;]+;?/g,"").replace(/stroke-width:[^;]+;?/g,"").replace(/fill:[^;]+;?/g,"").replace(/color:/g,"fill:");R(f).attr("style",m)}else{let m=n.replace(/stroke:[^;]+;?/g,"").replace(/stroke-width:[^;]+;?/g,"").replace(/fill:[^;]+;?/g,"").replace(/background:/g,"fill:");R(f).select("rect").attr("style",m.replace(/background:/g,"fill:"));let x=n.replace(/stroke:[^;]+;?/g,"").replace(/stroke-width:[^;]+;?/g,"").replace(/fill:[^;]+;?/g,"").replace(/color:/g,"fill:");R(f).select("text").attr("style",x)}return s?R(f).selectAll("tspan.text-outer-tspan").classed("title-row",!0):R(f).selectAll("tspan.text-outer-tspan").classed("row",!0),f}},"createText");export{be as a,$e as b,Ln as c,An as d};