const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mermaid.core-fp4eZkQa.js","assets/index-DOFLUERq.js","assets/index-Cl-AM8AM.css","assets/_commonjsHelpers-CE1G-McA.js"])))=>i.map(i=>d[i]);
import{d as Pe,w as ue,o as Ze,n as R,M as He,A as Q,J as v,_ as I,P as M,O as J,i as P,C as Z,H as pe,G as be,j as Oe,r as L,$ as je,a0 as Qe,g as z}from"./index-DOFLUERq.js";import{l as Ne}from"./index-w6PwaWGP.js";import{_ as Ve}from"./_plugin-vue_export-helper-DlAUqK2U.js";function de(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}let B=de();function ze(c){B=c}const Re=/[&<>"']/,Ue=new RegExp(Re.source,"g"),Se=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,We=new RegExp(Se.source,"g"),Xe={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},ye=c=>Xe[c];function $(c,e){if(e){if(Re.test(c))return c.replace(Ue,ye)}else if(Se.test(c))return c.replace(We,ye);return c}const Fe=/(^|[^\[])\^/g;function m(c,e){let t=typeof c=="string"?c:c.source;e=e||"";const n={replace:(s,i)=>{let r=typeof i=="string"?i:i.source;return r=r.replace(Fe,"$1"),t=t.replace(s,r),n},getRegex:()=>new RegExp(t,e)};return n}function ve(c){try{c=encodeURI(c).replace(/%25/g,"%")}catch{return null}return c}const U={exec:()=>null};function $e(c,e){const t=c.replace(/\|/g,(i,r,l)=>{let a=!1,o=r;for(;--o>=0&&l[o]==="\\";)a=!a;return a?"|":" |"}),n=t.split(/ \|/);let s=0;if(n[0].trim()||n.shift(),n.length>0&&!n[n.length-1].trim()&&n.pop(),e)if(n.length>e)n.splice(e);else for(;n.length<e;)n.push("");for(;s<n.length;s++)n[s]=n[s].trim().replace(/\\\|/g,"|");return n}function N(c,e,t){const n=c.length;if(n===0)return"";let s=0;for(;s<n&&c.charAt(n-s-1)===e;)s++;return c.slice(0,n-s)}function Ge(c,e){if(c.indexOf(e[1])===-1)return-1;let t=0;for(let n=0;n<c.length;n++)if(c[n]==="\\")n++;else if(c[n]===e[0])t++;else if(c[n]===e[1]&&(t--,t<0))return n;return-1}function _e(c,e,t,n){const s=e.href,i=e.title?$(e.title):null,r=c[1].replace(/\\([\[\]])/g,"$1");if(c[0].charAt(0)!=="!"){n.state.inLink=!0;const l={type:"link",raw:t,href:s,title:i,text:r,tokens:n.inlineTokens(r)};return n.state.inLink=!1,l}return{type:"image",raw:t,href:s,title:i,text:$(r)}}function Je(c,e){const t=c.match(/^(\s+)(?:```)/);if(t===null)return e;const n=t[1];return e.split(`
`).map(s=>{const i=s.match(/^\s+/);if(i===null)return s;const[r]=i;return r.length>=n.length?s.slice(n.length):s}).join(`
`)}class ee{options;rules;lexer;constructor(e){this.options=e||B}space(e){const t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){const t=this.rules.block.code.exec(e);if(t){const n=t[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?n:N(n,`
`)}}}fences(e){const t=this.rules.block.fences.exec(e);if(t){const n=t[0],s=Je(n,t[3]||"");return{type:"code",raw:n,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:s}}}heading(e){const t=this.rules.block.heading.exec(e);if(t){let n=t[2].trim();if(/#$/.test(n)){const s=N(n,"#");(this.options.pedantic||!s||/ $/.test(s))&&(n=s.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:n,tokens:this.lexer.inline(n)}}}hr(e){const t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:N(t[0],`
`)}}blockquote(e){const t=this.rules.block.blockquote.exec(e);if(t){let n=N(t[0],`
`).split(`
`),s="",i="";const r=[];for(;n.length>0;){let l=!1;const a=[];let o;for(o=0;o<n.length;o++)if(/^ {0,3}>/.test(n[o]))a.push(n[o]),l=!0;else if(!l)a.push(n[o]);else break;n=n.slice(o);const u=a.join(`
`),p=u.replace(/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,`
    $1`).replace(/^ {0,3}>[ \t]?/gm,"");s=s?`${s}
${u}`:u,i=i?`${i}
${p}`:p;const h=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(p,r,!0),this.lexer.state.top=h,n.length===0)break;const x=r[r.length-1];if(x?.type==="code")break;if(x?.type==="blockquote"){const f=x,w=f.raw+`
`+n.join(`
`),_=this.blockquote(w);r[r.length-1]=_,s=s.substring(0,s.length-f.raw.length)+_.raw,i=i.substring(0,i.length-f.text.length)+_.text;break}else if(x?.type==="list"){const f=x,w=f.raw+`
`+n.join(`
`),_=this.list(w);r[r.length-1]=_,s=s.substring(0,s.length-x.raw.length)+_.raw,i=i.substring(0,i.length-f.raw.length)+_.raw,n=w.substring(r[r.length-1].raw.length).split(`
`);continue}}return{type:"blockquote",raw:s,tokens:r,text:i}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim();const s=n.length>1,i={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:"[*+-]");const r=new RegExp(`^( {0,3}${n})((?:[	 ][^\\n]*)?(?:\\n|$))`);let l=!1;for(;e;){let a=!1,o="",u="";if(!(t=r.exec(e))||this.rules.block.hr.test(e))break;o=t[0],e=e.substring(o.length);let p=t[2].split(`
`,1)[0].replace(/^\t+/,C=>" ".repeat(3*C.length)),h=e.split(`
`,1)[0],x=!p.trim(),f=0;if(this.options.pedantic?(f=2,u=p.trimStart()):x?f=t[1].length+1:(f=t[2].search(/[^ ]/),f=f>4?1:f,u=p.slice(f),f+=t[1].length),x&&/^ *$/.test(h)&&(o+=h+`
`,e=e.substring(h.length+1),a=!0),!a){const C=new RegExp(`^ {0,${Math.min(3,f-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ 	][^\\n]*)?(?:\\n|$))`),D=new RegExp(`^ {0,${Math.min(3,f-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),H=new RegExp(`^ {0,${Math.min(3,f-1)}}(?:\`\`\`|~~~)`),F=new RegExp(`^ {0,${Math.min(3,f-1)}}#`);for(;e;){const O=e.split(`
`,1)[0];if(h=O,this.options.pedantic&&(h=h.replace(/^ {1,4}(?=( {4})*[^ ])/g,"  ")),H.test(h)||F.test(h)||C.test(h)||D.test(e))break;if(h.search(/[^ ]/)>=f||!h.trim())u+=`
`+h.slice(f);else{if(x||p.search(/[^ ]/)>=4||H.test(p)||F.test(p)||D.test(p))break;u+=`
`+h}!x&&!h.trim()&&(x=!0),o+=O+`
`,e=e.substring(O.length+1),p=h.slice(f)}}i.loose||(l?i.loose=!0:/\n *\n *$/.test(o)&&(l=!0));let w=null,_;this.options.gfm&&(w=/^\[[ xX]\] /.exec(u),w&&(_=w[0]!=="[ ] ",u=u.replace(/^\[[ xX]\] +/,""))),i.items.push({type:"list_item",raw:o,task:!!w,checked:_,loose:!1,text:u,tokens:[]}),i.raw+=o}i.items[i.items.length-1].raw=i.items[i.items.length-1].raw.trimEnd(),i.items[i.items.length-1].text=i.items[i.items.length-1].text.trimEnd(),i.raw=i.raw.trimEnd();for(let a=0;a<i.items.length;a++)if(this.lexer.state.top=!1,i.items[a].tokens=this.lexer.blockTokens(i.items[a].text,[]),!i.loose){const o=i.items[a].tokens.filter(p=>p.type==="space"),u=o.length>0&&o.some(p=>/\n.*\n/.test(p.raw));i.loose=u}if(i.loose)for(let a=0;a<i.items.length;a++)i.items[a].loose=!0;return i}}html(e){const t=this.rules.block.html.exec(e);if(t)return{type:"html",block:!0,raw:t[0],pre:t[1]==="pre"||t[1]==="script"||t[1]==="style",text:t[0]}}def(e){const t=this.rules.block.def.exec(e);if(t){const n=t[1].toLowerCase().replace(/\s+/g," "),s=t[2]?t[2].replace(/^<(.*)>$/,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",i=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:n,raw:t[0],href:s,title:i}}}table(e){const t=this.rules.block.table.exec(e);if(!t||!/[:|]/.test(t[2]))return;const n=$e(t[1]),s=t[2].replace(/^\||\| *$/g,"").split("|"),i=t[3]&&t[3].trim()?t[3].replace(/\n[ \t]*$/,"").split(`
`):[],r={type:"table",raw:t[0],header:[],align:[],rows:[]};if(n.length===s.length){for(const l of s)/^ *-+: *$/.test(l)?r.align.push("right"):/^ *:-+: *$/.test(l)?r.align.push("center"):/^ *:-+ *$/.test(l)?r.align.push("left"):r.align.push(null);for(let l=0;l<n.length;l++)r.header.push({text:n[l],tokens:this.lexer.inline(n[l]),header:!0,align:r.align[l]});for(const l of i)r.rows.push($e(l,r.header.length).map((a,o)=>({text:a,tokens:this.lexer.inline(a),header:!1,align:r.align[o]})));return r}}lheading(e){const t=this.rules.block.lheading.exec(e);if(t)return{type:"heading",raw:t[0],depth:t[2].charAt(0)==="="?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){const t=this.rules.block.paragraph.exec(e);if(t){const n=t[1].charAt(t[1].length-1)===`
`?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:n,tokens:this.lexer.inline(n)}}}text(e){const t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){const t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:$(t[1])}}tag(e){const t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&/^<a /i.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&/^<\/a>/i.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){const t=this.rules.inline.link.exec(e);if(t){const n=t[2].trim();if(!this.options.pedantic&&/^</.test(n)){if(!/>$/.test(n))return;const r=N(n.slice(0,-1),"\\");if((n.length-r.length)%2===0)return}else{const r=Ge(t[2],"()");if(r>-1){const a=(t[0].indexOf("!")===0?5:4)+t[1].length+r;t[2]=t[2].substring(0,r),t[0]=t[0].substring(0,a).trim(),t[3]=""}}let s=t[2],i="";if(this.options.pedantic){const r=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(s);r&&(s=r[1],i=r[3])}else i=t[3]?t[3].slice(1,-1):"";return s=s.trim(),/^</.test(s)&&(this.options.pedantic&&!/>$/.test(n)?s=s.slice(1):s=s.slice(1,-1)),_e(t,{href:s&&s.replace(this.rules.inline.anyPunctuation,"$1"),title:i&&i.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){const s=(n[2]||n[1]).replace(/\s+/g," "),i=t[s.toLowerCase()];if(!i){const r=n[0].charAt(0);return{type:"text",raw:r,text:r}}return _e(n,i,n[0],this.lexer)}}emStrong(e,t,n=""){let s=this.rules.inline.emStrongLDelim.exec(e);if(!s||s[3]&&n.match(/[\p{L}\p{N}]/u))return;if(!(s[1]||s[2]||"")||!n||this.rules.inline.punctuation.exec(n)){const r=[...s[0]].length-1;let l,a,o=r,u=0;const p=s[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(p.lastIndex=0,t=t.slice(-1*e.length+r);(s=p.exec(t))!=null;){if(l=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!l)continue;if(a=[...l].length,s[3]||s[4]){o+=a;continue}else if((s[5]||s[6])&&r%3&&!((r+a)%3)){u+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o+u);const h=[...s[0]][0].length,x=e.slice(0,r+s.index+h+a);if(Math.min(r,a)%2){const w=x.slice(1,-1);return{type:"em",raw:x,text:w,tokens:this.lexer.inlineTokens(w)}}const f=x.slice(2,-2);return{type:"strong",raw:x,text:f,tokens:this.lexer.inlineTokens(f)}}}}codespan(e){const t=this.rules.inline.code.exec(e);if(t){let n=t[2].replace(/\n/g," ");const s=/[^ ]/.test(n),i=/^ /.test(n)&&/ $/.test(n);return s&&i&&(n=n.substring(1,n.length-1)),n=$(n,!0),{type:"codespan",raw:t[0],text:n}}}br(e){const t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){const t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){const t=this.rules.inline.autolink.exec(e);if(t){let n,s;return t[2]==="@"?(n=$(t[1]),s="mailto:"+n):(n=$(t[1]),s=n),{type:"link",raw:t[0],text:n,href:s,tokens:[{type:"text",raw:n,text:n}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let n,s;if(t[2]==="@")n=$(t[0]),s="mailto:"+n;else{let i;do i=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??"";while(i!==t[0]);n=$(t[0]),t[1]==="www."?s="http://"+t[0]:s=t[0]}return{type:"link",raw:t[0],text:n,href:s,tokens:[{type:"text",raw:n,text:n}]}}}inlineText(e){const t=this.rules.inline.text.exec(e);if(t){let n;return this.lexer.state.inRawBlock?n=t[0]:n=$(t[0]),{type:"text",raw:t[0],text:n}}}}const Ke=/^(?: *(?:\n|$))+/,Ye=/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,et=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,W=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,tt=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Ee=/(?:[*+-]|\d{1,9}[.)])/,Le=m(/^(?!bull |blockCode|fences|blockquote|heading|html)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g,Ee).replace(/blockCode/g,/ {4}/).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/).getRegex(),fe=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,nt=/^[^\n]+/,ge=/(?!\s*\])(?:\\.|[^\[\]\\])+/,st=m(/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/).replace("label",ge).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),it=m(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Ee).getRegex(),se="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",ke=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,rt=m("^ {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",ke).replace("tag",se).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Ce=m(fe).replace("hr",W).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",se).getRegex(),lt=m(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Ce).getRegex(),me={blockquote:lt,code:Ye,def:st,fences:et,heading:tt,hr:W,html:rt,lheading:Le,list:it,newline:Ke,paragraph:Ce,table:U,text:nt},Te=m("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",W).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\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",se).getRegex(),ot={...me,table:Te,paragraph:m(fe).replace("hr",W).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Te).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",se).getRegex()},at={...me,html:m(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ke).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:U,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:m(fe).replace("hr",W).replace("heading",` *#{1,6} *[^
]`).replace("lheading",Le).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Ae=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,ct=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Ie=/^( {2,}|\\)\n(?!\s*$)/,ut=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,X="\\p{P}\\p{S}",pt=m(/^((?![*_])[\spunctuation])/,"u").replace(/punctuation/g,X).getRegex(),ht=/\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g,dt=m(/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/,"u").replace(/punct/g,X).getRegex(),ft=m("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)[punct](\\*+)(?=[\\s]|$)|[^punct\\s](\\*+)(?!\\*)(?=[punct\\s]|$)|(?!\\*)[punct\\s](\\*+)(?=[^punct\\s])|[\\s](\\*+)(?!\\*)(?=[punct])|(?!\\*)[punct](\\*+)(?!\\*)(?=[punct])|[^punct\\s](\\*+)(?=[^punct\\s])","gu").replace(/punct/g,X).getRegex(),gt=m("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\\s]|$)|[^punct\\s](_+)(?!_)(?=[punct\\s]|$)|(?!_)[punct\\s](_+)(?=[^punct\\s])|[\\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])","gu").replace(/punct/g,X).getRegex(),kt=m(/\\([punct])/,"gu").replace(/punct/g,X).getRegex(),mt=m(/^<(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(),xt=m(ke).replace("(?:-->|$)","-->").getRegex(),wt=m("^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",xt).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),te=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,bt=m(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label",te).replace("href",/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Me=m(/^!?\[(label)\]\[(ref)\]/).replace("label",te).replace("ref",ge).getRegex(),qe=m(/^!?\[(ref)\](?:\[\])?/).replace("ref",ge).getRegex(),yt=m("reflink|nolink(?!\\()","g").replace("reflink",Me).replace("nolink",qe).getRegex(),xe={_backpedal:U,anyPunctuation:kt,autolink:mt,blockSkip:ht,br:Ie,code:ct,del:U,emStrongLDelim:dt,emStrongRDelimAst:ft,emStrongRDelimUnd:gt,escape:Ae,link:bt,nolink:qe,punctuation:pt,reflink:Me,reflinkSearch:yt,tag:wt,text:ut,url:U},vt={...xe,link:m(/^!?\[(label)\]\((.*?)\)/).replace("label",te).getRegex(),reflink:m(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",te).getRegex()},he={...xe,escape:m(Ae).replace("])","~|])").getRegex(),url:m(/^((?: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~])\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},$t={...he,br:m(Ie).replace("{2,}","*").getRegex(),text:m(he.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},K={normal:me,gfm:ot,pedantic:at},V={normal:xe,gfm:he,breaks:$t,pedantic:vt};class S{tokens;options;state;tokenizer;inlineQueue;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||B,this.options.tokenizer=this.options.tokenizer||new ee,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};const t={block:K.normal,inline:V.normal};this.options.pedantic?(t.block=K.pedantic,t.inline=V.pedantic):this.options.gfm&&(t.block=K.gfm,this.options.breaks?t.inline=V.breaks:t.inline=V.gfm),this.tokenizer.rules=t}static get rules(){return{block:K,inline:V}}static lex(e,t){return new S(t).lex(e)}static lexInline(e,t){return new S(t).inlineTokens(e)}lex(e){e=e.replace(/\r\n|\r/g,`
`),this.blockTokens(e,this.tokens);for(let t=0;t<this.inlineQueue.length;t++){const n=this.inlineQueue[t];this.inlineTokens(n.src,n.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],n=!1){this.options.pedantic?e=e.replace(/\t/g,"    ").replace(/^ +$/gm,""):e=e.replace(/^( *)(\t+)/gm,(l,a,o)=>a+"    ".repeat(o.length));let s,i,r;for(;e;)if(!(this.options.extensions&&this.options.extensions.block&&this.options.extensions.block.some(l=>(s=l.call({lexer:this},e,t))?(e=e.substring(s.raw.length),t.push(s),!0):!1))){if(s=this.tokenizer.space(e)){e=e.substring(s.raw.length),s.raw.length===1&&t.length>0?t[t.length-1].raw+=`
`:t.push(s);continue}if(s=this.tokenizer.code(e)){e=e.substring(s.raw.length),i=t[t.length-1],i&&(i.type==="paragraph"||i.type==="text")?(i.raw+=`
`+s.raw,i.text+=`
`+s.text,this.inlineQueue[this.inlineQueue.length-1].src=i.text):t.push(s);continue}if(s=this.tokenizer.fences(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.heading(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.hr(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.blockquote(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.list(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.html(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.def(e)){e=e.substring(s.raw.length),i=t[t.length-1],i&&(i.type==="paragraph"||i.type==="text")?(i.raw+=`
`+s.raw,i.text+=`
`+s.raw,this.inlineQueue[this.inlineQueue.length-1].src=i.text):this.tokens.links[s.tag]||(this.tokens.links[s.tag]={href:s.href,title:s.title});continue}if(s=this.tokenizer.table(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.lheading(e)){e=e.substring(s.raw.length),t.push(s);continue}if(r=e,this.options.extensions&&this.options.extensions.startBlock){let l=1/0;const a=e.slice(1);let o;this.options.extensions.startBlock.forEach(u=>{o=u.call({lexer:this},a),typeof o=="number"&&o>=0&&(l=Math.min(l,o))}),l<1/0&&l>=0&&(r=e.substring(0,l+1))}if(this.state.top&&(s=this.tokenizer.paragraph(r))){i=t[t.length-1],n&&i?.type==="paragraph"?(i.raw+=`
`+s.raw,i.text+=`
`+s.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=i.text):t.push(s),n=r.length!==e.length,e=e.substring(s.raw.length);continue}if(s=this.tokenizer.text(e)){e=e.substring(s.raw.length),i=t[t.length-1],i&&i.type==="text"?(i.raw+=`
`+s.raw,i.text+=`
`+s.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=i.text):t.push(s);continue}if(e){const l="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(l);break}else throw new Error(l)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){let n,s,i,r=e,l,a,o;if(this.tokens.links){const u=Object.keys(this.tokens.links);if(u.length>0)for(;(l=this.tokenizer.rules.inline.reflinkSearch.exec(r))!=null;)u.includes(l[0].slice(l[0].lastIndexOf("[")+1,-1))&&(r=r.slice(0,l.index)+"["+"a".repeat(l[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(l=this.tokenizer.rules.inline.blockSkip.exec(r))!=null;)r=r.slice(0,l.index)+"["+"a".repeat(l[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;(l=this.tokenizer.rules.inline.anyPunctuation.exec(r))!=null;)r=r.slice(0,l.index)+"++"+r.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;e;)if(a||(o=""),a=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some(u=>(n=u.call({lexer:this},e,t))?(e=e.substring(n.raw.length),t.push(n),!0):!1))){if(n=this.tokenizer.escape(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.tag(e)){e=e.substring(n.raw.length),s=t[t.length-1],s&&n.type==="text"&&s.type==="text"?(s.raw+=n.raw,s.text+=n.text):t.push(n);continue}if(n=this.tokenizer.link(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(n.raw.length),s=t[t.length-1],s&&n.type==="text"&&s.type==="text"?(s.raw+=n.raw,s.text+=n.text):t.push(n);continue}if(n=this.tokenizer.emStrong(e,r,o)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.codespan(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.br(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.del(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.autolink(e)){e=e.substring(n.raw.length),t.push(n);continue}if(!this.state.inLink&&(n=this.tokenizer.url(e))){e=e.substring(n.raw.length),t.push(n);continue}if(i=e,this.options.extensions&&this.options.extensions.startInline){let u=1/0;const p=e.slice(1);let h;this.options.extensions.startInline.forEach(x=>{h=x.call({lexer:this},p),typeof h=="number"&&h>=0&&(u=Math.min(u,h))}),u<1/0&&u>=0&&(i=e.substring(0,u+1))}if(n=this.tokenizer.inlineText(i)){e=e.substring(n.raw.length),n.raw.slice(-1)!=="_"&&(o=n.raw.slice(-1)),a=!0,s=t[t.length-1],s&&s.type==="text"?(s.raw+=n.raw,s.text+=n.text):t.push(n);continue}if(e){const u="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(u);break}else throw new Error(u)}}return t}}class ne{options;parser;constructor(e){this.options=e||B}space(e){return""}code({text:e,lang:t,escaped:n}){const s=(t||"").match(/^\S*/)?.[0],i=e.replace(/\n$/,"")+`
`;return s?'<pre><code class="language-'+$(s)+'">'+(n?i:$(i,!0))+`</code></pre>
`:"<pre><code>"+(n?i:$(i,!0))+`</code></pre>
`}blockquote({tokens:e}){return`<blockquote>
${this.parser.parse(e)}</blockquote>
`}html({text:e}){return e}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
`}hr(e){return`<hr>
`}list(e){const t=e.ordered,n=e.start;let s="";for(let l=0;l<e.items.length;l++){const a=e.items[l];s+=this.listitem(a)}const i=t?"ol":"ul",r=t&&n!==1?' start="'+n+'"':"";return"<"+i+r+`>
`+s+"</"+i+`>
`}listitem(e){let t="";if(e.task){const n=this.checkbox({checked:!!e.checked});e.loose?e.tokens.length>0&&e.tokens[0].type==="paragraph"?(e.tokens[0].text=n+" "+e.tokens[0].text,e.tokens[0].tokens&&e.tokens[0].tokens.length>0&&e.tokens[0].tokens[0].type==="text"&&(e.tokens[0].tokens[0].text=n+" "+e.tokens[0].tokens[0].text)):e.tokens.unshift({type:"text",raw:n+" ",text:n+" "}):t+=n+" "}return t+=this.parser.parse(e.tokens,!!e.loose),`<li>${t}</li>
`}checkbox({checked:e}){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
`}table(e){let t="",n="";for(let i=0;i<e.header.length;i++)n+=this.tablecell(e.header[i]);t+=this.tablerow({text:n});let s="";for(let i=0;i<e.rows.length;i++){const r=e.rows[i];n="";for(let l=0;l<r.length;l++)n+=this.tablecell(r[l]);s+=this.tablerow({text:n})}return s&&(s=`<tbody>${s}</tbody>`),`<table>
<thead>
`+t+`</thead>
`+s+`</table>
`}tablerow({text:e}){return`<tr>
${e}</tr>
`}tablecell(e){const t=this.parser.parseInline(e.tokens),n=e.header?"th":"td";return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${e}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){const s=this.parser.parseInline(n),i=ve(e);if(i===null)return s;e=i;let r='<a href="'+e+'"';return t&&(r+=' title="'+t+'"'),r+=">"+s+"</a>",r}image({href:e,title:t,text:n}){const s=ve(e);if(s===null)return n;e=s;let i=`<img src="${e}" alt="${n}"`;return t&&(i+=` title="${t}"`),i+=">",i}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):e.text}}class we{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return""+e}image({text:e}){return""+e}br(){return""}}class E{options;renderer;textRenderer;constructor(e){this.options=e||B,this.options.renderer=this.options.renderer||new ne,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new we}static parse(e,t){return new E(t).parse(e)}static parseInline(e,t){return new E(t).parseInline(e)}parse(e,t=!0){let n="";for(let s=0;s<e.length;s++){const i=e[s];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[i.type]){const l=i,a=this.options.extensions.renderers[l.type].call({parser:this},l);if(a!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(l.type)){n+=a||"";continue}}const r=i;switch(r.type){case"space":{n+=this.renderer.space(r);continue}case"hr":{n+=this.renderer.hr(r);continue}case"heading":{n+=this.renderer.heading(r);continue}case"code":{n+=this.renderer.code(r);continue}case"table":{n+=this.renderer.table(r);continue}case"blockquote":{n+=this.renderer.blockquote(r);continue}case"list":{n+=this.renderer.list(r);continue}case"html":{n+=this.renderer.html(r);continue}case"paragraph":{n+=this.renderer.paragraph(r);continue}case"text":{let l=r,a=this.renderer.text(l);for(;s+1<e.length&&e[s+1].type==="text";)l=e[++s],a+=`
`+this.renderer.text(l);t?n+=this.renderer.paragraph({type:"paragraph",raw:a,text:a,tokens:[{type:"text",raw:a,text:a}]}):n+=a;continue}default:{const l='Token with "'+r.type+'" type was not found.';if(this.options.silent)return console.error(l),"";throw new Error(l)}}}return n}parseInline(e,t){t=t||this.renderer;let n="";for(let s=0;s<e.length;s++){const i=e[s];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[i.type]){const l=this.options.extensions.renderers[i.type].call({parser:this},i);if(l!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(i.type)){n+=l||"";continue}}const r=i;switch(r.type){case"escape":{n+=t.text(r);break}case"html":{n+=t.html(r);break}case"link":{n+=t.link(r);break}case"image":{n+=t.image(r);break}case"strong":{n+=t.strong(r);break}case"em":{n+=t.em(r);break}case"codespan":{n+=t.codespan(r);break}case"br":{n+=t.br(r);break}case"del":{n+=t.del(r);break}case"text":{n+=t.text(r);break}default:{const l='Token with "'+r.type+'" type was not found.';if(this.options.silent)return console.error(l),"";throw new Error(l)}}}return n}}class Y{options;constructor(e){this.options=e||B}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}}class _t{defaults=de();options=this.setOptions;parse=this.parseMarkdown(S.lex,E.parse);parseInline=this.parseMarkdown(S.lexInline,E.parseInline);Parser=E;Renderer=ne;TextRenderer=we;Lexer=S;Tokenizer=ee;Hooks=Y;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(const s of e)switch(n=n.concat(t.call(this,s)),s.type){case"table":{const i=s;for(const r of i.header)n=n.concat(this.walkTokens(r.tokens,t));for(const r of i.rows)for(const l of r)n=n.concat(this.walkTokens(l.tokens,t));break}case"list":{const i=s;n=n.concat(this.walkTokens(i.items,t));break}default:{const i=s;this.defaults.extensions?.childTokens?.[i.type]?this.defaults.extensions.childTokens[i.type].forEach(r=>{const l=i[r].flat(1/0);n=n.concat(this.walkTokens(l,t))}):i.tokens&&(n=n.concat(this.walkTokens(i.tokens,t)))}}return n}use(...e){const t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(n=>{const s={...n};if(s.async=this.defaults.async||s.async||!1,n.extensions&&(n.extensions.forEach(i=>{if(!i.name)throw new Error("extension name required");if("renderer"in i){const r=t.renderers[i.name];r?t.renderers[i.name]=function(...l){let a=i.renderer.apply(this,l);return a===!1&&(a=r.apply(this,l)),a}:t.renderers[i.name]=i.renderer}if("tokenizer"in i){if(!i.level||i.level!=="block"&&i.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");const r=t[i.level];r?r.unshift(i.tokenizer):t[i.level]=[i.tokenizer],i.start&&(i.level==="block"?t.startBlock?t.startBlock.push(i.start):t.startBlock=[i.start]:i.level==="inline"&&(t.startInline?t.startInline.push(i.start):t.startInline=[i.start]))}"childTokens"in i&&i.childTokens&&(t.childTokens[i.name]=i.childTokens)}),s.extensions=t),n.renderer){const i=this.defaults.renderer||new ne(this.defaults);for(const r in n.renderer){if(!(r in i))throw new Error(`renderer '${r}' does not exist`);if(["options","parser"].includes(r))continue;const l=r,a=n.renderer[l],o=i[l];i[l]=(...u)=>{let p=a.apply(i,u);return p===!1&&(p=o.apply(i,u)),p||""}}s.renderer=i}if(n.tokenizer){const i=this.defaults.tokenizer||new ee(this.defaults);for(const r in n.tokenizer){if(!(r in i))throw new Error(`tokenizer '${r}' does not exist`);if(["options","rules","lexer"].includes(r))continue;const l=r,a=n.tokenizer[l],o=i[l];i[l]=(...u)=>{let p=a.apply(i,u);return p===!1&&(p=o.apply(i,u)),p}}s.tokenizer=i}if(n.hooks){const i=this.defaults.hooks||new Y;for(const r in n.hooks){if(!(r in i))throw new Error(`hook '${r}' does not exist`);if(r==="options")continue;const l=r,a=n.hooks[l],o=i[l];Y.passThroughHooks.has(r)?i[l]=u=>{if(this.defaults.async)return Promise.resolve(a.call(i,u)).then(h=>o.call(i,h));const p=a.call(i,u);return o.call(i,p)}:i[l]=(...u)=>{let p=a.apply(i,u);return p===!1&&(p=o.apply(i,u)),p}}s.hooks=i}if(n.walkTokens){const i=this.defaults.walkTokens,r=n.walkTokens;s.walkTokens=function(l){let a=[];return a.push(r.call(this,l)),i&&(a=a.concat(i.call(this,l))),a}}this.defaults={...this.defaults,...s}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return S.lex(e,t??this.defaults)}parser(e,t){return E.parse(e,t??this.defaults)}parseMarkdown(e,t){return(s,i)=>{const r={...i},l={...this.defaults,...r},a=this.onError(!!l.silent,!!l.async);if(this.defaults.async===!0&&r.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 s>"u"||s===null)return a(new Error("marked(): input parameter is undefined or null"));if(typeof s!="string")return a(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(s)+", string expected"));if(l.hooks&&(l.hooks.options=l),l.async)return Promise.resolve(l.hooks?l.hooks.preprocess(s):s).then(o=>e(o,l)).then(o=>l.hooks?l.hooks.processAllTokens(o):o).then(o=>l.walkTokens?Promise.all(this.walkTokens(o,l.walkTokens)).then(()=>o):o).then(o=>t(o,l)).then(o=>l.hooks?l.hooks.postprocess(o):o).catch(a);try{l.hooks&&(s=l.hooks.preprocess(s));let o=e(s,l);l.hooks&&(o=l.hooks.processAllTokens(o)),l.walkTokens&&this.walkTokens(o,l.walkTokens);let u=t(o,l);return l.hooks&&(u=l.hooks.postprocess(u)),u}catch(o){return a(o)}}}onError(e,t){return n=>{if(n.message+=`
Please report this to https://github.com/markedjs/marked.`,e){const s="<p>An error occurred:</p><pre>"+$(n.message+"",!0)+"</pre>";return t?Promise.resolve(s):s}if(t)return Promise.reject(n);throw n}}}const q=new _t;function g(c,e){return q.parse(c,e)}g.options=g.setOptions=function(c){return q.setOptions(c),g.defaults=q.defaults,ze(g.defaults),g};g.getDefaults=de;g.defaults=B;g.use=function(...c){return q.use(...c),g.defaults=q.defaults,ze(g.defaults),g};g.walkTokens=function(c,e){return q.walkTokens(c,e)};g.parseInline=q.parseInline;g.Parser=E;g.parser=E.parse;g.Renderer=ne;g.TextRenderer=we;g.Lexer=S;g.lexer=S.lex;g.Tokenizer=ee;g.Hooks=Y;g.parse=g;g.options;g.setOptions;g.use;g.walkTokens;g.parseInline;E.parse;S.lex;const Tt={class:"field-label"},zt={key:0,class:"required"},Rt={class:"md-editor"},St={class:"md-editor__toolbar"},Et={key:0,class:"md-editor__single"},Lt={key:1,class:"md-editor__single"},Ct=Pe({__name:"MarkdownEditor",props:{df:{},record:{},canEdit:{type:Boolean},ctx:{}},setup(c){const e=c,t=e.df.label_layout||"vertical",n=L(null),s=L(null),i=L(null),r=L(null),l=L(null);let a=null,o=null;const u=L(!1),p=L("split"),h=L(50),x=L(!1);let f=0,w=null;async function _(){return w||(w=(await Qe(()=>import("./mermaid.core-fp4eZkQa.js").then(d=>d.aZ),__vite__mapDeps([0,1,2,3]))).default,w.initialize({startOnLoad:!1,theme:"default"})),w}async function C(){const k=p.value==="preview"||p.value==="edit"?i.value:r.value;if(!k)return;let d;try{d=g.parse(String(e.record[e.df.fieldname]||""))}catch{d=String(e.record[e.df.fieldname]||"")}const b=await _();f=0;const y=document.createElement("div");y.innerHTML=d;const T=y.querySelectorAll("pre code.language-mermaid");for(const j of Array.from(T)){const ae=j.parentElement;if(!ae)continue;const G=j.textContent||"",ce=`md-mermaid-${++f}`;try{const{svg:A}=await b.render(ce,G);ae.outerHTML=`<div class="mermaid-diagram">${A}</div>`}catch(A){console.error("[MarkdownEditor] Mermaid render error:",A)}}const De=y.querySelectorAll("p");for(const j of Array.from(De)){const G=(j.textContent||"").trim();if(/^(flowchart|graph|sequenceDiagram|classDiagram|stateDiagram|erDiagram|gantt|pie|requirementDiagram|gitGraph|journey)\s/i.test(G)){const ce=`md-mermaid-${++f}`;try{const{svg:A}=await b.render(ce,G);j.outerHTML=`<div class="mermaid-diagram">${A}</div>`}catch(A){console.error("[MarkdownEditor] Mermaid render error:",A)}}}k.innerHTML=y.innerHTML}async function D(k){if(!k)return;a||(a=await Ne.init()),H(),o=a.editor.create(k,{value:String(e.record[e.df.fieldname]||""),language:"markdown",automaticLayout:!0,folding:!0,minimap:{enabled:!1},readOnly:!e.canEdit,wordWrap:"on",wordWrapColumn:120,wrappingStrategy:"advanced",scrollBeyondLastLine:!1,scrollBeyondLastColumn:0,scrollbar:{horizontal:"hidden",vertical:"auto",horizontalScrollbarSize:6,verticalScrollbarSize:6,alwaysConsumeMouseWheel:!1}});const d=()=>{if(!o||!k)return;const b=o.getLayoutInfo(),y=o.getScrollHeight()>b.height+1,T=o.getScrollWidth()>b.width+1;k.classList.toggle("no-scroll-y",!y),k.classList.toggle("no-scroll-x",!T)};d(),o.onDidContentSizeChange(()=>d()),o.onDidScrollChange(()=>d()),o.onDidLayoutChange(()=>d()),o.onDidChangeModelContent(()=>{o&&(e.record[e.df.fieldname]=o.getValue(),d())})}function H(){try{o?.dispose()}catch{}o=null}function F(){u.value=!u.value,R(()=>o?.layout())}function O(k){k.preventDefault(),x.value=!0,document.addEventListener("mousemove",ie),document.addEventListener("mouseup",re)}function ie(k){if(!x.value||!l.value)return;const d=l.value.getBoundingClientRect(),b=20,y=80;let T=(k.clientX-d.left)/d.width*100;T=Math.max(b,Math.min(y,T)),h.value=T,R(()=>o?.layout())}function re(){x.value=!1,document.removeEventListener("mousemove",ie),document.removeEventListener("mouseup",re)}function Be(k){k.preventDefault(),x.value=!0,document.addEventListener("touchmove",le,{passive:!1}),document.addEventListener("touchend",oe)}function le(k){if(!x.value||!l.value||!k.touches[0])return;k.preventDefault();const d=l.value.getBoundingClientRect(),b=20,y=80;let T=(k.touches[0].clientX-d.left)/d.width*100;T=Math.max(b,Math.min(y,T)),h.value=T,R(()=>o?.layout())}function oe(){x.value=!1,document.removeEventListener("touchmove",le),document.removeEventListener("touchend",oe)}return ue(()=>e.canEdit,k=>{o?.updateOptions({readOnly:!k})}),ue(()=>e.record[e.df.fieldname],async k=>{o&&k!==o.getValue()&&o.setValue(String(k||"")),await R(),await C()},{flush:"post"}),Ze(async()=>{await R(),await D(s.value),await R(),await C()}),ue(p,async k=>{k==="edit"?(await R(),await D(n.value)):k==="split"?(await R(),await D(s.value),await R(),await C()):(await R(),await C())}),He(()=>{document.removeEventListener("mousemove",ie),document.removeEventListener("mouseup",re),document.removeEventListener("touchmove",le),document.removeEventListener("touchend",oe),H()}),(k,d)=>{const b=je("n-button");return z(),Q("div",{class:pe(["field-wrapper",`layout-${Oe(t)}`])},[v("label",Tt,[I(M(c.ctx?.t?c.ctx.t(c.df.label||c.df.fieldname):c.df.label||c.df.fieldname)+" ",1),c.df.reqd?(z(),Q("span",zt,"*")):J("",!0)]),v("div",Rt,[v("div",St,[p.value==="edit"?(z(),P(b,{key:0,size:"tiny",quaternary:"",type:"default",onClick:d[0]||(d[0]=y=>p.value="split")},{default:Z(()=>[I(M(e.ctx?.t?e.ctx.t("Split"):"Split"),1)]),_:1})):p.value==="split"?(z(),P(b,{key:1,size:"tiny",quaternary:"",type:"default",onClick:d[1]||(d[1]=y=>p.value="edit")},{default:Z(()=>[I(M(e.ctx?.t?e.ctx.t("Edit"):"Edit"),1)]),_:1})):(z(),P(b,{key:2,size:"tiny",quaternary:"",type:"default",onClick:d[2]||(d[2]=y=>p.value="split")},{default:Z(()=>[I(M(e.ctx?.t?e.ctx.t("Split"):"Split"),1)]),_:1})),p.value==="preview"?(z(),P(b,{key:3,size:"tiny",quaternary:"",type:"default",onClick:d[3]||(d[3]=y=>p.value="split")},{default:Z(()=>[I(M(e.ctx?.t?e.ctx.t("Edit"):"Edit"),1)]),_:1})):J("",!0),p.value==="edit"||p.value==="split"?(z(),P(b,{key:4,size:"tiny",quaternary:"",type:"default",onClick:d[4]||(d[4]=y=>p.value="preview")},{default:Z(()=>[I(M(e.ctx?.t?e.ctx.t("Preview"):"Preview"),1)]),_:1})):J("",!0),p.value==="edit"||p.value==="split"?(z(),P(b,{key:5,size:"tiny",quaternary:"",type:"default",onClick:F},{default:Z(()=>[I(M(u.value?e.ctx?.t?e.ctx.t("Collapse"):"Collapse":e.ctx?.t?e.ctx.t("Expand"):"Expand"),1)]),_:1})):J("",!0)]),p.value==="edit"?(z(),Q("div",Et,[v("div",{ref_key:"editorHostEdit",ref:n,class:pe(["md-editor__monaco",{collapsed:!u.value}])},null,2)])):p.value==="preview"?(z(),Q("div",Lt,[v("div",{ref_key:"previewHostEdit",ref:i,class:"md-editor__preview"},null,512)])):(z(),Q("div",{key:2,ref_key:"containerRef",ref:l,class:"md-editor__split"},[v("div",{class:"md-editor__split-left",style:be({width:h.value+"%"})},[v("div",{ref_key:"editorHostSplit",ref:s,class:"md-editor__monaco in-split"},null,512)],4),v("div",{class:pe(["md-editor__divider",{dragging:x.value}]),onMousedown:O,onTouchstart:Be},[...d[5]||(d[5]=[v("div",{class:"md-editor__divider-handle"},[v("span"),v("span"),v("span")],-1)])],34),v("div",{class:"md-editor__split-right",style:be({width:100-h.value+"%"})},[v("div",{ref_key:"previewHostSplit",ref:r,class:"md-editor__preview"},null,512)],4)],512))])],2)}}}),At=Ve(Ct,[["__scopeId","data-v-e5487311"]]),Bt=Object.freeze(Object.defineProperty({__proto__:null,default:At},Symbol.toStringTag,{value:"Module"}));export{At as M,Bt as _};
