@mxtommy/kip
Version:
An advanced and versatile marine instrumentation package to display Signal K data.
59 lines • 76.1 kB
JavaScript
import{g as Et}from"./chunk-6QHCHGTT.js";import{$a as bt,$b as J,$c as se,Ad as A,Ae as Fe,Bb as W,Ce as Ht,Da as dt,Dc as Rt,Ea as Y,Ec as St,Ed as It,Fa as X,Ga as mt,H as ot,Hb as N,Ib as Ie,Id as Pt,J as L,Jb as Ee,Jd as At,K as at,Ka as Re,Nb as Pe,Nd as Ot,Ne as qt,Oa as E,Oc as De,Pa as Se,Pe as Ut,Q as lt,R as ct,Rc as Le,Sc as $e,Se as fe,Ta as z,Td as Ne,U as ut,Vd as Dt,Ve as Vt,Wa as ft,Xb as yt,Xc as ie,Yb as K,Zb as Ae,_a as gt,a as f,b as T,bc as wt,da as ht,dc as vt,de as Lt,eb as kt,ee as $t,f as rt,fa as $,fd as ze,g as he,ga as G,ge as zt,ha as pe,ic as P,jc as B,kc as Oe,ke as Nt,le as Be,m as C,oa as pt,oc as Mt,pa as Te,pb as _t,qc as F,ra as w,rc as j,re as Bt,sc as ee,se as Ft,t as Z,ta as I,tc as H,ua as g,ub as Q,ud as Ct,ue as jt,vc as me,wb as Ce,wc as Tt,xc as te,yb as xt,yc as ne,z as Me,zb as de}from"./chunk-Y7X77HSW.js";function qe(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var D=qe();function Wt(a){D=a}var ae={exec:()=>null};function b(a,i=""){let e=typeof a=="string"?a:a.source,t={replace:(n,s)=>{let r=typeof s=="string"?s:s.source;return r=r.replace(x.caret,"$1"),e=e.replace(n,r),t},getRegex:()=>new RegExp(e,i)};return t}var x={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:a=>new RegExp(`^( {0,3}${a})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:a=>new RegExp(`^ {0,${Math.min(3,a-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:a=>new RegExp(`^ {0,${Math.min(3,a-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:a=>new RegExp(`^ {0,${Math.min(3,a-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:a=>new RegExp(`^ {0,${Math.min(3,a-1)}}#`),htmlBeginRegex:a=>new RegExp(`^ {0,${Math.min(3,a-1)}}<(?:[a-z].*>|!--)`,"i")},kn=/^(?:[ \t]*(?:\n|$))+/,_n=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,xn=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,ce=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,yn=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Ue=/(?:[*+-]|\d{1,9}[.)])/,Kt=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Jt=b(Kt).replace(/bull/g,Ue).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(),wn=b(Kt).replace(/bull/g,Ue).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(),Ve=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,vn=/^[^\n]+/,Ze=/(?!\s*\])(?:\\.|[^\[\]\\])+/,Mn=b(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Ze).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Tn=b(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Ue).getRegex(),ke="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",Ge=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Rn=b("^ {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",Ge).replace("tag",ke).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),en=b(Ve).replace("hr",ce).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",ke).getRegex(),Sn=b(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",en).getRegex(),Ye={blockquote:Sn,code:_n,def:Mn,fences:xn,heading:yn,hr:ce,html:Rn,lheading:Jt,list:Tn,newline:kn,paragraph:en,table:ae,text:vn},Zt=b("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",ce).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",ke).getRegex(),Cn=T(f({},Ye),{lheading:wn,table:Zt,paragraph:b(Ve).replace("hr",ce).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Zt).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",ke).getRegex()}),In=T(f({},Ye),{html:b(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Ge).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:ae,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:b(Ve).replace("hr",ce).replace("heading",` *#{1,6} *[^
]`).replace("lheading",Jt).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()}),En=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Pn=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,tn=/^( {2,}|\\)\n(?!\s*$)/,An=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,_e=/[\p{P}\p{S}]/u,Xe=/[\s\p{P}\p{S}]/u,nn=/[^\s\p{P}\p{S}]/u,On=b(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Xe).getRegex(),sn=/(?!~)[\p{P}\p{S}]/u,Dn=/(?!~)[\s\p{P}\p{S}]/u,Ln=/(?:[^\s\p{P}\p{S}]|~)/u,$n=/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,rn=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,zn=b(rn,"u").replace(/punct/g,_e).getRegex(),Nn=b(rn,"u").replace(/punct/g,sn).getRegex(),on="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",Bn=b(on,"gu").replace(/notPunctSpace/g,nn).replace(/punctSpace/g,Xe).replace(/punct/g,_e).getRegex(),Fn=b(on,"gu").replace(/notPunctSpace/g,Ln).replace(/punctSpace/g,Dn).replace(/punct/g,sn).getRegex(),jn=b("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,nn).replace(/punctSpace/g,Xe).replace(/punct/g,_e).getRegex(),Hn=b(/\\(punct)/,"gu").replace(/punct/g,_e).getRegex(),qn=b(/^<(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(),Un=b(Ge).replace("(?:-->|$)","-->").getRegex(),Vn=b("^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",Un).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),be=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,Zn=b(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label",be).replace("href",/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),an=b(/^!?\[(label)\]\[(ref)\]/).replace("label",be).replace("ref",Ze).getRegex(),ln=b(/^!?\[(ref)\](?:\[\])?/).replace("ref",Ze).getRegex(),Gn=b("reflink|nolink(?!\\()","g").replace("reflink",an).replace("nolink",ln).getRegex(),Qe={_backpedal:ae,anyPunctuation:Hn,autolink:qn,blockSkip:$n,br:tn,code:Pn,del:ae,emStrongLDelim:zn,emStrongRDelimAst:Bn,emStrongRDelimUnd:jn,escape:En,link:Zn,nolink:ln,punctuation:On,reflink:an,reflinkSearch:Gn,tag:Vn,text:An,url:ae},Yn=T(f({},Qe),{link:b(/^!?\[(label)\]\((.*?)\)/).replace("label",be).getRegex(),reflink:b(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",be).getRegex()}),je=T(f({},Qe),{emStrongRDelimAst:Fn,emStrongLDelim:Nn,url:b(/^((?: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~\\]))\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/}),Xn=T(f({},je),{br:b(tn).replace("{2,}","*").getRegex(),text:b(je.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()}),ge={normal:Ye,gfm:Cn,pedantic:In},re={normal:Qe,gfm:je,breaks:Xn,pedantic:Yn},Qn={"&":"&","<":"<",">":">",'"':""","'":"'"},Gt=a=>Qn[a];function R(a,i){if(i){if(x.escapeTest.test(a))return a.replace(x.escapeReplace,Gt)}else if(x.escapeTestNoEncode.test(a))return a.replace(x.escapeReplaceNoEncode,Gt);return a}function Yt(a){try{a=encodeURI(a).replace(x.percentDecode,"%")}catch{return null}return a}function Xt(a,i){let e=a.replace(x.findPipe,(s,r,o)=>{let l=!1,c=r;for(;--c>=0&&o[c]==="\\";)l=!l;return l?"|":" |"}),t=e.split(x.splitPipe),n=0;if(t[0].trim()||t.shift(),t.length>0&&!t.at(-1)?.trim()&&t.pop(),i)if(t.length>i)t.splice(i);else for(;t.length<i;)t.push("");for(;n<t.length;n++)t[n]=t[n].trim().replace(x.slashPipe,"|");return t}function oe(a,i,e){let t=a.length;if(t===0)return"";let n=0;for(;n<t&&a.charAt(t-n-1)===i;)n++;return a.slice(0,t-n)}function Wn(a,i){if(a.indexOf(i[1])===-1)return-1;let e=0;for(let t=0;t<a.length;t++)if(a[t]==="\\")t++;else if(a[t]===i[0])e++;else if(a[t]===i[1]&&(e--,e<0))return t;return-1}function Qt(a,i,e,t,n){let s=i.href,r=i.title||null,o=a[1].replace(n.other.outputLinkReplace,"$1");if(a[0].charAt(0)!=="!"){t.state.inLink=!0;let l={type:"link",raw:e,href:s,title:r,text:o,tokens:t.inlineTokens(o)};return t.state.inLink=!1,l}return{type:"image",raw:e,href:s,title:r,text:o}}function Kn(a,i,e){let t=a.match(e.other.indentCodeCompensation);if(t===null)return i;let n=t[1];return i.split(`
`).map(s=>{let r=s.match(e.other.beginningSpace);if(r===null)return s;let[o]=r;return o.length>=n.length?s.slice(n.length):s}).join(`
`)}var U=class{options;rules;lexer;constructor(i){this.options=i||D}space(i){let e=this.rules.block.newline.exec(i);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(i){let e=this.rules.block.code.exec(i);if(e){let t=e[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:e[0],codeBlockStyle:"indented",text:this.options.pedantic?t:oe(t,`
`)}}}fences(i){let e=this.rules.block.fences.exec(i);if(e){let t=e[0],n=Kn(t,e[3]||"",this.rules);return{type:"code",raw:t,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:n}}}heading(i){let e=this.rules.block.heading.exec(i);if(e){let t=e[2].trim();if(this.rules.other.endingHash.test(t)){let n=oe(t,"#");(this.options.pedantic||!n||this.rules.other.endingSpaceChar.test(n))&&(t=n.trim())}return{type:"heading",raw:e[0],depth:e[1].length,text:t,tokens:this.lexer.inline(t)}}}hr(i){let e=this.rules.block.hr.exec(i);if(e)return{type:"hr",raw:oe(e[0],`
`)}}blockquote(i){let e=this.rules.block.blockquote.exec(i);if(e){let t=oe(e[0],`
`).split(`
`),n="",s="",r=[];for(;t.length>0;){let o=!1,l=[],c;for(c=0;c<t.length;c++)if(this.rules.other.blockquoteStart.test(t[c]))l.push(t[c]),o=!0;else if(!o)l.push(t[c]);else break;t=t.slice(c);let u=l.join(`
`),h=u.replace(this.rules.other.blockquoteSetextReplace,`
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");n=n?`${n}
${u}`:u,s=s?`${s}
${h}`:h;let d=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(h,r,!0),this.lexer.state.top=d,t.length===0)break;let p=r.at(-1);if(p?.type==="code")break;if(p?.type==="blockquote"){let k=p,_=k.raw+`
`+t.join(`
`),y=this.blockquote(_);r[r.length-1]=y,n=n.substring(0,n.length-k.raw.length)+y.raw,s=s.substring(0,s.length-k.text.length)+y.text;break}else if(p?.type==="list"){let k=p,_=k.raw+`
`+t.join(`
`),y=this.list(_);r[r.length-1]=y,n=n.substring(0,n.length-p.raw.length)+y.raw,s=s.substring(0,s.length-k.raw.length)+y.raw,t=_.substring(r.at(-1).raw.length).split(`
`);continue}}return{type:"blockquote",raw:n,tokens:r,text:s}}}list(i){let e=this.rules.block.list.exec(i);if(e){let t=e[1].trim(),n=t.length>1,s={type:"list",raw:"",ordered:n,start:n?+t.slice(0,-1):"",loose:!1,items:[]};t=n?`\\d{1,9}\\${t.slice(-1)}`:`\\${t}`,this.options.pedantic&&(t=n?t:"[*+-]");let r=this.rules.other.listItemRegex(t),o=!1;for(;i;){let c=!1,u="",h="";if(!(e=r.exec(i))||this.rules.block.hr.test(i))break;u=e[0],i=i.substring(u.length);let d=e[2].split(`
`,1)[0].replace(this.rules.other.listReplaceTabs,we=>" ".repeat(3*we.length)),p=i.split(`
`,1)[0],k=!d.trim(),_=0;if(this.options.pedantic?(_=2,h=d.trimStart()):k?_=e[1].length+1:(_=e[2].search(this.rules.other.nonSpaceChar),_=_>4?1:_,h=d.slice(_),_+=e[1].length),k&&this.rules.other.blankLine.test(p)&&(u+=p+`
`,i=i.substring(p.length+1),c=!0),!c){let we=this.rules.other.nextBulletRegex(_),nt=this.rules.other.hrRegex(_),it=this.rules.other.fencesBeginRegex(_),st=this.rules.other.headingBeginRegex(_),bn=this.rules.other.htmlBeginRegex(_);for(;i;){let ve=i.split(`
`,1)[0],V;if(p=ve,this.options.pedantic?(p=p.replace(this.rules.other.listReplaceNesting," "),V=p):V=p.replace(this.rules.other.tabCharGlobal," "),it.test(p)||st.test(p)||bn.test(p)||we.test(p)||nt.test(p))break;if(V.search(this.rules.other.nonSpaceChar)>=_||!p.trim())h+=`
`+V.slice(_);else{if(k||d.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||it.test(d)||st.test(d)||nt.test(d))break;h+=`
`+p}!k&&!p.trim()&&(k=!0),u+=ve+`
`,i=i.substring(ve.length+1),d=V.slice(_)}}s.loose||(o?s.loose=!0:this.rules.other.doubleBlankLine.test(u)&&(o=!0));let y=null,tt;this.options.gfm&&(y=this.rules.other.listIsTask.exec(h),y&&(tt=y[0]!=="[ ] ",h=h.replace(this.rules.other.listReplaceTask,""))),s.items.push({type:"list_item",raw:u,task:!!y,checked:tt,loose:!1,text:h,tokens:[]}),s.raw+=u}let l=s.items.at(-1);if(l)l.raw=l.raw.trimEnd(),l.text=l.text.trimEnd();else return;s.raw=s.raw.trimEnd();for(let c=0;c<s.items.length;c++)if(this.lexer.state.top=!1,s.items[c].tokens=this.lexer.blockTokens(s.items[c].text,[]),!s.loose){let u=s.items[c].tokens.filter(d=>d.type==="space"),h=u.length>0&&u.some(d=>this.rules.other.anyLine.test(d.raw));s.loose=h}if(s.loose)for(let c=0;c<s.items.length;c++)s.items[c].loose=!0;return s}}html(i){let e=this.rules.block.html.exec(i);if(e)return{type:"html",block:!0,raw:e[0],pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:e[0]}}def(i){let e=this.rules.block.def.exec(i);if(e){let t=e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),n=e[2]?e[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",s=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:t,raw:e[0],href:n,title:s}}}table(i){let e=this.rules.block.table.exec(i);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;let t=Xt(e[1]),n=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),s=e[3]?.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
`):[],r={type:"table",raw:e[0],header:[],align:[],rows:[]};if(t.length===n.length){for(let o of n)this.rules.other.tableAlignRight.test(o)?r.align.push("right"):this.rules.other.tableAlignCenter.test(o)?r.align.push("center"):this.rules.other.tableAlignLeft.test(o)?r.align.push("left"):r.align.push(null);for(let o=0;o<t.length;o++)r.header.push({text:t[o],tokens:this.lexer.inline(t[o]),header:!0,align:r.align[o]});for(let o of s)r.rows.push(Xt(o,r.header.length).map((l,c)=>({text:l,tokens:this.lexer.inline(l),header:!1,align:r.align[c]})));return r}}lheading(i){let e=this.rules.block.lheading.exec(i);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(i){let e=this.rules.block.paragraph.exec(i);if(e){let t=e[1].charAt(e[1].length-1)===`
`?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:t,tokens:this.lexer.inline(t)}}}text(i){let e=this.rules.block.text.exec(i);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(i){let e=this.rules.inline.escape.exec(i);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(i){let e=this.rules.inline.tag.exec(i);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(i){let e=this.rules.inline.link.exec(i);if(e){let t=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(t)){if(!this.rules.other.endAngleBracket.test(t))return;let r=oe(t.slice(0,-1),"\\");if((t.length-r.length)%2===0)return}else{let r=Wn(e[2],"()");if(r>-1){let l=(e[0].indexOf("!")===0?5:4)+e[1].length+r;e[2]=e[2].substring(0,r),e[0]=e[0].substring(0,l).trim(),e[3]=""}}let n=e[2],s="";if(this.options.pedantic){let r=this.rules.other.pedanticHrefTitle.exec(n);r&&(n=r[1],s=r[3])}else s=e[3]?e[3].slice(1,-1):"";return n=n.trim(),this.rules.other.startAngleBracket.test(n)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(t)?n=n.slice(1):n=n.slice(1,-1)),Qt(e,{href:n&&n.replace(this.rules.inline.anyPunctuation,"$1"),title:s&&s.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(i,e){let t;if((t=this.rules.inline.reflink.exec(i))||(t=this.rules.inline.nolink.exec(i))){let n=(t[2]||t[1]).replace(this.rules.other.multipleSpaceGlobal," "),s=e[n.toLowerCase()];if(!s){let r=t[0].charAt(0);return{type:"text",raw:r,text:r}}return Qt(t,s,t[0],this.lexer,this.rules)}}emStrong(i,e,t=""){let n=this.rules.inline.emStrongLDelim.exec(i);if(!n||n[3]&&t.match(this.rules.other.unicodeAlphaNumeric))return;if(!(n[1]||n[2]||"")||!t||this.rules.inline.punctuation.exec(t)){let r=[...n[0]].length-1,o,l,c=r,u=0,h=n[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(h.lastIndex=0,e=e.slice(-1*i.length+r);(n=h.exec(e))!=null;){if(o=n[1]||n[2]||n[3]||n[4]||n[5]||n[6],!o)continue;if(l=[...o].length,n[3]||n[4]){c+=l;continue}else if((n[5]||n[6])&&r%3&&!((r+l)%3)){u+=l;continue}if(c-=l,c>0)continue;l=Math.min(l,l+c+u);let d=[...n[0]][0].length,p=i.slice(0,r+n.index+d+l);if(Math.min(r,l)%2){let _=p.slice(1,-1);return{type:"em",raw:p,text:_,tokens:this.lexer.inlineTokens(_)}}let k=p.slice(2,-2);return{type:"strong",raw:p,text:k,tokens:this.lexer.inlineTokens(k)}}}}codespan(i){let e=this.rules.inline.code.exec(i);if(e){let t=e[2].replace(this.rules.other.newLineCharGlobal," "),n=this.rules.other.nonSpaceChar.test(t),s=this.rules.other.startingSpaceChar.test(t)&&this.rules.other.endingSpaceChar.test(t);return n&&s&&(t=t.substring(1,t.length-1)),{type:"codespan",raw:e[0],text:t}}}br(i){let e=this.rules.inline.br.exec(i);if(e)return{type:"br",raw:e[0]}}del(i){let e=this.rules.inline.del.exec(i);if(e)return{type:"del",raw:e[0],text:e[2],tokens:this.lexer.inlineTokens(e[2])}}autolink(i){let e=this.rules.inline.autolink.exec(i);if(e){let t,n;return e[2]==="@"?(t=e[1],n="mailto:"+t):(t=e[1],n=t),{type:"link",raw:e[0],text:t,href:n,tokens:[{type:"text",raw:t,text:t}]}}}url(i){let e;if(e=this.rules.inline.url.exec(i)){let t,n;if(e[2]==="@")t=e[0],n="mailto:"+t;else{let s;do s=e[0],e[0]=this.rules.inline._backpedal.exec(e[0])?.[0]??"";while(s!==e[0]);t=e[0],e[1]==="www."?n="http://"+e[0]:n=e[0]}return{type:"link",raw:e[0],text:t,href:n,tokens:[{type:"text",raw:t,text:t}]}}}inlineText(i){let e=this.rules.inline.text.exec(i);if(e){let t=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:t}}}},v=class a{tokens;options;state;tokenizer;inlineQueue;constructor(i){this.tokens=[],this.tokens.links=Object.create(null),this.options=i||D,this.options.tokenizer=this.options.tokenizer||new U,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 e={other:x,block:ge.normal,inline:re.normal};this.options.pedantic?(e.block=ge.pedantic,e.inline=re.pedantic):this.options.gfm&&(e.block=ge.gfm,this.options.breaks?e.inline=re.breaks:e.inline=re.gfm),this.tokenizer.rules=e}static get rules(){return{block:ge,inline:re}}static lex(i,e){return new a(e).lex(i)}static lexInline(i,e){return new a(e).inlineTokens(i)}lex(i){i=i.replace(x.carriageReturn,`
`),this.blockTokens(i,this.tokens);for(let e=0;e<this.inlineQueue.length;e++){let t=this.inlineQueue[e];this.inlineTokens(t.src,t.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(i,e=[],t=!1){for(this.options.pedantic&&(i=i.replace(x.tabCharGlobal," ").replace(x.spaceLine,""));i;){let n;if(this.options.extensions?.block?.some(r=>(n=r.call({lexer:this},i,e))?(i=i.substring(n.raw.length),e.push(n),!0):!1))continue;if(n=this.tokenizer.space(i)){i=i.substring(n.raw.length);let r=e.at(-1);n.raw.length===1&&r!==void 0?r.raw+=`
`:e.push(n);continue}if(n=this.tokenizer.code(i)){i=i.substring(n.raw.length);let r=e.at(-1);r?.type==="paragraph"||r?.type==="text"?(r.raw+=`
`+n.raw,r.text+=`
`+n.text,this.inlineQueue.at(-1).src=r.text):e.push(n);continue}if(n=this.tokenizer.fences(i)){i=i.substring(n.raw.length),e.push(n);continue}if(n=this.tokenizer.heading(i)){i=i.substring(n.raw.length),e.push(n);continue}if(n=this.tokenizer.hr(i)){i=i.substring(n.raw.length),e.push(n);continue}if(n=this.tokenizer.blockquote(i)){i=i.substring(n.raw.length),e.push(n);continue}if(n=this.tokenizer.list(i)){i=i.substring(n.raw.length),e.push(n);continue}if(n=this.tokenizer.html(i)){i=i.substring(n.raw.length),e.push(n);continue}if(n=this.tokenizer.def(i)){i=i.substring(n.raw.length);let r=e.at(-1);r?.type==="paragraph"||r?.type==="text"?(r.raw+=`
`+n.raw,r.text+=`
`+n.raw,this.inlineQueue.at(-1).src=r.text):this.tokens.links[n.tag]||(this.tokens.links[n.tag]={href:n.href,title:n.title});continue}if(n=this.tokenizer.table(i)){i=i.substring(n.raw.length),e.push(n);continue}if(n=this.tokenizer.lheading(i)){i=i.substring(n.raw.length),e.push(n);continue}let s=i;if(this.options.extensions?.startBlock){let r=1/0,o=i.slice(1),l;this.options.extensions.startBlock.forEach(c=>{l=c.call({lexer:this},o),typeof l=="number"&&l>=0&&(r=Math.min(r,l))}),r<1/0&&r>=0&&(s=i.substring(0,r+1))}if(this.state.top&&(n=this.tokenizer.paragraph(s))){let r=e.at(-1);t&&r?.type==="paragraph"?(r.raw+=`
`+n.raw,r.text+=`
`+n.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=r.text):e.push(n),t=s.length!==i.length,i=i.substring(n.raw.length);continue}if(n=this.tokenizer.text(i)){i=i.substring(n.raw.length);let r=e.at(-1);r?.type==="text"?(r.raw+=`
`+n.raw,r.text+=`
`+n.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=r.text):e.push(n);continue}if(i){let r="Infinite loop on byte: "+i.charCodeAt(0);if(this.options.silent){console.error(r);break}else throw new Error(r)}}return this.state.top=!0,e}inline(i,e=[]){return this.inlineQueue.push({src:i,tokens:e}),e}inlineTokens(i,e=[]){let t=i,n=null;if(this.tokens.links){let o=Object.keys(this.tokens.links);if(o.length>0)for(;(n=this.tokenizer.rules.inline.reflinkSearch.exec(t))!=null;)o.includes(n[0].slice(n[0].lastIndexOf("[")+1,-1))&&(t=t.slice(0,n.index)+"["+"a".repeat(n[0].length-2)+"]"+t.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(n=this.tokenizer.rules.inline.blockSkip.exec(t))!=null;)t=t.slice(0,n.index)+"["+"a".repeat(n[0].length-2)+"]"+t.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;(n=this.tokenizer.rules.inline.anyPunctuation.exec(t))!=null;)t=t.slice(0,n.index)+"++"+t.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let s=!1,r="";for(;i;){s||(r=""),s=!1;let o;if(this.options.extensions?.inline?.some(c=>(o=c.call({lexer:this},i,e))?(i=i.substring(o.raw.length),e.push(o),!0):!1))continue;if(o=this.tokenizer.escape(i)){i=i.substring(o.raw.length),e.push(o);continue}if(o=this.tokenizer.tag(i)){i=i.substring(o.raw.length),e.push(o);continue}if(o=this.tokenizer.link(i)){i=i.substring(o.raw.length),e.push(o);continue}if(o=this.tokenizer.reflink(i,this.tokens.links)){i=i.substring(o.raw.length);let c=e.at(-1);o.type==="text"&&c?.type==="text"?(c.raw+=o.raw,c.text+=o.text):e.push(o);continue}if(o=this.tokenizer.emStrong(i,t,r)){i=i.substring(o.raw.length),e.push(o);continue}if(o=this.tokenizer.codespan(i)){i=i.substring(o.raw.length),e.push(o);continue}if(o=this.tokenizer.br(i)){i=i.substring(o.raw.length),e.push(o);continue}if(o=this.tokenizer.del(i)){i=i.substring(o.raw.length),e.push(o);continue}if(o=this.tokenizer.autolink(i)){i=i.substring(o.raw.length),e.push(o);continue}if(!this.state.inLink&&(o=this.tokenizer.url(i))){i=i.substring(o.raw.length),e.push(o);continue}let l=i;if(this.options.extensions?.startInline){let c=1/0,u=i.slice(1),h;this.options.extensions.startInline.forEach(d=>{h=d.call({lexer:this},u),typeof h=="number"&&h>=0&&(c=Math.min(c,h))}),c<1/0&&c>=0&&(l=i.substring(0,c+1))}if(o=this.tokenizer.inlineText(l)){i=i.substring(o.raw.length),o.raw.slice(-1)!=="_"&&(r=o.raw.slice(-1)),s=!0;let c=e.at(-1);c?.type==="text"?(c.raw+=o.raw,c.text+=o.text):e.push(o);continue}if(i){let c="Infinite loop on byte: "+i.charCodeAt(0);if(this.options.silent){console.error(c);break}else throw new Error(c)}}return e}},S=class{options;parser;constructor(i){this.options=i||D}space(i){return""}code({text:i,lang:e,escaped:t}){let n=(e||"").match(x.notSpaceStart)?.[0],s=i.replace(x.endingNewline,"")+`
`;return n?'<pre><code class="language-'+R(n)+'">'+(t?s:R(s,!0))+`</code></pre>
`:"<pre><code>"+(t?s:R(s,!0))+`</code></pre>
`}blockquote({tokens:i}){return`<blockquote>
${this.parser.parse(i)}</blockquote>
`}html({text:i}){return i}heading({tokens:i,depth:e}){return`<h${e}>${this.parser.parseInline(i)}</h${e}>
`}hr(i){return`<hr>
`}list(i){let e=i.ordered,t=i.start,n="";for(let o=0;o<i.items.length;o++){let l=i.items[o];n+=this.listitem(l)}let s=e?"ol":"ul",r=e&&t!==1?' start="'+t+'"':"";return"<"+s+r+`>
`+n+"</"+s+`>
`}listitem(i){let e="";if(i.task){let t=this.checkbox({checked:!!i.checked});i.loose?i.tokens[0]?.type==="paragraph"?(i.tokens[0].text=t+" "+i.tokens[0].text,i.tokens[0].tokens&&i.tokens[0].tokens.length>0&&i.tokens[0].tokens[0].type==="text"&&(i.tokens[0].tokens[0].text=t+" "+R(i.tokens[0].tokens[0].text),i.tokens[0].tokens[0].escaped=!0)):i.tokens.unshift({type:"text",raw:t+" ",text:t+" ",escaped:!0}):e+=t+" "}return e+=this.parser.parse(i.tokens,!!i.loose),`<li>${e}</li>
`}checkbox({checked:i}){return"<input "+(i?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph({tokens:i}){return`<p>${this.parser.parseInline(i)}</p>
`}table(i){let e="",t="";for(let s=0;s<i.header.length;s++)t+=this.tablecell(i.header[s]);e+=this.tablerow({text:t});let n="";for(let s=0;s<i.rows.length;s++){let r=i.rows[s];t="";for(let o=0;o<r.length;o++)t+=this.tablecell(r[o]);n+=this.tablerow({text:t})}return n&&(n=`<tbody>${n}</tbody>`),`<table>
<thead>
`+e+`</thead>
`+n+`</table>
`}tablerow({text:i}){return`<tr>
${i}</tr>
`}tablecell(i){let e=this.parser.parseInline(i.tokens),t=i.header?"th":"td";return(i.align?`<${t} align="${i.align}">`:`<${t}>`)+e+`</${t}>
`}strong({tokens:i}){return`<strong>${this.parser.parseInline(i)}</strong>`}em({tokens:i}){return`<em>${this.parser.parseInline(i)}</em>`}codespan({text:i}){return`<code>${R(i,!0)}</code>`}br(i){return"<br>"}del({tokens:i}){return`<del>${this.parser.parseInline(i)}</del>`}link({href:i,title:e,tokens:t}){let n=this.parser.parseInline(t),s=Yt(i);if(s===null)return n;i=s;let r='<a href="'+i+'"';return e&&(r+=' title="'+R(e)+'"'),r+=">"+n+"</a>",r}image({href:i,title:e,text:t}){let n=Yt(i);if(n===null)return R(t);i=n;let s=`<img src="${i}" alt="${t}"`;return e&&(s+=` title="${R(e)}"`),s+=">",s}text(i){return"tokens"in i&&i.tokens?this.parser.parseInline(i.tokens):"escaped"in i&&i.escaped?i.text:R(i.text)}},le=class{strong({text:i}){return i}em({text:i}){return i}codespan({text:i}){return i}del({text:i}){return i}html({text:i}){return i}text({text:i}){return i}link({text:i}){return""+i}image({text:i}){return""+i}br(){return""}},M=class a{options;renderer;textRenderer;constructor(i){this.options=i||D,this.options.renderer=this.options.renderer||new S,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new le}static parse(i,e){return new a(e).parse(i)}static parseInline(i,e){return new a(e).parseInline(i)}parse(i,e=!0){let t="";for(let n=0;n<i.length;n++){let s=i[n];if(this.options.extensions?.renderers?.[s.type]){let o=s,l=this.options.extensions.renderers[o.type].call({parser:this},o);if(l!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(o.type)){t+=l||"";continue}}let r=s;switch(r.type){case"space":{t+=this.renderer.space(r);continue}case"hr":{t+=this.renderer.hr(r);continue}case"heading":{t+=this.renderer.heading(r);continue}case"code":{t+=this.renderer.code(r);continue}case"table":{t+=this.renderer.table(r);continue}case"blockquote":{t+=this.renderer.blockquote(r);continue}case"list":{t+=this.renderer.list(r);continue}case"html":{t+=this.renderer.html(r);continue}case"paragraph":{t+=this.renderer.paragraph(r);continue}case"text":{let o=r,l=this.renderer.text(o);for(;n+1<i.length&&i[n+1].type==="text";)o=i[++n],l+=`
`+this.renderer.text(o);e?t+=this.renderer.paragraph({type:"paragraph",raw:l,text:l,tokens:[{type:"text",raw:l,text:l,escaped:!0}]}):t+=l;continue}default:{let o='Token with "'+r.type+'" type was not found.';if(this.options.silent)return console.error(o),"";throw new Error(o)}}}return t}parseInline(i,e=this.renderer){let t="";for(let n=0;n<i.length;n++){let s=i[n];if(this.options.extensions?.renderers?.[s.type]){let o=this.options.extensions.renderers[s.type].call({parser:this},s);if(o!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(s.type)){t+=o||"";continue}}let r=s;switch(r.type){case"escape":{t+=e.text(r);break}case"html":{t+=e.html(r);break}case"link":{t+=e.link(r);break}case"image":{t+=e.image(r);break}case"strong":{t+=e.strong(r);break}case"em":{t+=e.em(r);break}case"codespan":{t+=e.codespan(r);break}case"br":{t+=e.br(r);break}case"del":{t+=e.del(r);break}case"text":{t+=e.text(r);break}default:{let o='Token with "'+r.type+'" type was not found.';if(this.options.silent)return console.error(o),"";throw new Error(o)}}}return t}},q=class{options;block;constructor(i){this.options=i||D}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(i){return i}postprocess(i){return i}processAllTokens(i){return i}provideLexer(){return this.block?v.lex:v.lexInline}provideParser(){return this.block?M.parse:M.parseInline}},He=class{defaults=qe();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=M;Renderer=S;TextRenderer=le;Lexer=v;Tokenizer=U;Hooks=q;constructor(...i){this.use(...i)}walkTokens(i,e){let t=[];for(let n of i)switch(t=t.concat(e.call(this,n)),n.type){case"table":{let s=n;for(let r of s.header)t=t.concat(this.walkTokens(r.tokens,e));for(let r of s.rows)for(let o of r)t=t.concat(this.walkTokens(o.tokens,e));break}case"list":{let s=n;t=t.concat(this.walkTokens(s.items,e));break}default:{let s=n;this.defaults.extensions?.childTokens?.[s.type]?this.defaults.extensions.childTokens[s.type].forEach(r=>{let o=s[r].flat(1/0);t=t.concat(this.walkTokens(o,e))}):s.tokens&&(t=t.concat(this.walkTokens(s.tokens,e)))}}return t}use(...i){let e=this.defaults.extensions||{renderers:{},childTokens:{}};return i.forEach(t=>{let n=f({},t);if(n.async=this.defaults.async||n.async||!1,t.extensions&&(t.extensions.forEach(s=>{if(!s.name)throw new Error("extension name required");if("renderer"in s){let r=e.renderers[s.name];r?e.renderers[s.name]=function(...o){let l=s.renderer.apply(this,o);return l===!1&&(l=r.apply(this,o)),l}:e.renderers[s.name]=s.renderer}if("tokenizer"in s){if(!s.level||s.level!=="block"&&s.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let r=e[s.level];r?r.unshift(s.tokenizer):e[s.level]=[s.tokenizer],s.start&&(s.level==="block"?e.startBlock?e.startBlock.push(s.start):e.startBlock=[s.start]:s.level==="inline"&&(e.startInline?e.startInline.push(s.start):e.startInline=[s.start]))}"childTokens"in s&&s.childTokens&&(e.childTokens[s.name]=s.childTokens)}),n.extensions=e),t.renderer){let s=this.defaults.renderer||new S(this.defaults);for(let r in t.renderer){if(!(r in s))throw new Error(`renderer '${r}' does not exist`);if(["options","parser"].includes(r))continue;let o=r,l=t.renderer[o],c=s[o];s[o]=(...u)=>{let h=l.apply(s,u);return h===!1&&(h=c.apply(s,u)),h||""}}n.renderer=s}if(t.tokenizer){let s=this.defaults.tokenizer||new U(this.defaults);for(let r in t.tokenizer){if(!(r in s))throw new Error(`tokenizer '${r}' does not exist`);if(["options","rules","lexer"].includes(r))continue;let o=r,l=t.tokenizer[o],c=s[o];s[o]=(...u)=>{let h=l.apply(s,u);return h===!1&&(h=c.apply(s,u)),h}}n.tokenizer=s}if(t.hooks){let s=this.defaults.hooks||new q;for(let r in t.hooks){if(!(r in s))throw new Error(`hook '${r}' does not exist`);if(["options","block"].includes(r))continue;let o=r,l=t.hooks[o],c=s[o];q.passThroughHooks.has(r)?s[o]=u=>{if(this.defaults.async)return Promise.resolve(l.call(s,u)).then(d=>c.call(s,d));let h=l.call(s,u);return c.call(s,h)}:s[o]=(...u)=>{let h=l.apply(s,u);return h===!1&&(h=c.apply(s,u)),h}}n.hooks=s}if(t.walkTokens){let s=this.defaults.walkTokens,r=t.walkTokens;n.walkTokens=function(o){let l=[];return l.push(r.call(this,o)),s&&(l=l.concat(s.call(this,o))),l}}this.defaults=f(f({},this.defaults),n)}),this}setOptions(i){return this.defaults=f(f({},this.defaults),i),this}lexer(i,e){return v.lex(i,e??this.defaults)}parser(i,e){return M.parse(i,e??this.defaults)}parseMarkdown(i){return(t,n)=>{let s=f({},n),r=f(f({},this.defaults),s),o=this.onError(!!r.silent,!!r.async);if(this.defaults.async===!0&&s.async===!1)return o(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 t>"u"||t===null)return o(new Error("marked(): input parameter is undefined or null"));if(typeof t!="string")return o(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));r.hooks&&(r.hooks.options=r,r.hooks.block=i);let l=r.hooks?r.hooks.provideLexer():i?v.lex:v.lexInline,c=r.hooks?r.hooks.provideParser():i?M.parse:M.parseInline;if(r.async)return Promise.resolve(r.hooks?r.hooks.preprocess(t):t).then(u=>l(u,r)).then(u=>r.hooks?r.hooks.processAllTokens(u):u).then(u=>r.walkTokens?Promise.all(this.walkTokens(u,r.walkTokens)).then(()=>u):u).then(u=>c(u,r)).then(u=>r.hooks?r.hooks.postprocess(u):u).catch(o);try{r.hooks&&(t=r.hooks.preprocess(t));let u=l(t,r);r.hooks&&(u=r.hooks.processAllTokens(u)),r.walkTokens&&this.walkTokens(u,r.walkTokens);let h=c(u,r);return r.hooks&&(h=r.hooks.postprocess(h)),h}catch(u){return o(u)}}}onError(i,e){return t=>{if(t.message+=`
Please report this to https://github.com/markedjs/marked.`,i){let n="<p>An error occurred:</p><pre>"+R(t.message+"",!0)+"</pre>";return e?Promise.resolve(n):n}if(e)return Promise.reject(t);throw t}}},O=new He;function m(a,i){return O.parse(a,i)}m.options=m.setOptions=function(a){return O.setOptions(a),m.defaults=O.defaults,Wt(m.defaults),m};m.getDefaults=qe;m.defaults=D;m.use=function(...a){return O.use(...a),m.defaults=O.defaults,Wt(m.defaults),m};m.walkTokens=function(a,i){return O.walkTokens(a,i)};m.parseInline=O.parseInline;m.Parser=M;m.parser=M.parse;m.Renderer=S;m.TextRenderer=le;m.Lexer=v;m.lexer=v.lex;m.Tokenizer=U;m.Hooks=q;m.parse=m;var Pi=m.options,Ai=m.setOptions,Oi=m.use,Di=m.walkTokens,Li=m.parseInline;var $i=M.parse,zi=v.lex;var ei=["*"],ti="Copy",ni="Copied",ii=(()=>{class a{constructor(){this._buttonClick$=new C,this.copied$=this._buttonClick$.pipe(G(()=>L(Z(!0),ot(3e3).pipe(ct(!1)))),ut(),ht(1)),this.copiedText$=this.copied$.pipe($(!1),Me(e=>e?ni:ti))}onCopyToClipboardClick(){this._buttonClick$.next()}static{this.\u0275fac=function(t){return new(t||a)}}static{this.\u0275cmp=N({type:a,selectors:[["markdown-clipboard"]],decls:4,vars:7,consts:[[1,"markdown-clipboard-button",3,"click"]],template:function(t,n){t&1&&(P(0,"button",0),Le(1,"async"),F("click",function(){return n.onCopyToClipboardClick()}),Rt(2),Le(3,"async"),B()),t&2&&(J("copied",$e(1,3,n.copied$)),Q(2),St($e(3,5,n.copiedText$)))},dependencies:[Ct],encapsulation:2,changeDetection:0})}}return a})(),si=new w("CLIPBOARD_OPTIONS");var We=function(a){return a.CommandLine="command-line",a.LineHighlight="line-highlight",a.LineNumbers="line-numbers",a}(We||{}),cn=new w("MARKED_EXTENSIONS"),ri=new w("MARKED_OPTIONS"),oi=new w("MERMAID_OPTIONS"),ai="[ngx-markdown] When using the `emoji` attribute you *have to* include Emoji-Toolkit files to `angular.json` or use imports. See README for more information",li="[ngx-markdown] When using the `katex` attribute you *have to* include KaTeX files to `angular.json` or use imports. See README for more information",ci="[ngx-markdown] When using the `mermaid` attribute you *have to* include Mermaid files to `angular.json` or use imports. See README for more information",ui="[ngx-markdown] When using the `clipboard` attribute you *have to* include Clipboard files to `angular.json` or use imports. See README for more information",hi="[ngx-markdown] When using the `clipboard` attribute you *have to* provide the `viewContainerRef` parameter to `MarkdownService.render()` function",pi="[ngx-markdown] When using the `src` attribute you *have to* pass the `HttpClient` as a parameter of the `forRoot` method. See README for more information",un=new w("SECURITY_CONTEXT");var hn=(()=>{class a{get options(){return this._options}set options(e){this._options=f(f({},this.DEFAULT_MARKED_OPTIONS),e)}get renderer(){return this.options.renderer}set renderer(e){this.options.renderer=e}constructor(e,t,n,s,r,o,l,c){this.clipboardOptions=e,this.extensions=t,this.mermaidOptions=s,this.platform=r,this.securityContext=o,this.http=l,this.sanitizer=c,this.DEFAULT_MARKED_OPTIONS={renderer:new S},this.DEFAULT_KATEX_OPTIONS={delimiters:[{left:"$$",right:"$$",display:!0},{left:"$",right:"$",display:!1},{left:"\\(",right:"\\)",display:!1},{left:"\\begin{equation}",right:"\\end{equation}",display:!0},{left:"\\begin{align}",right:"\\end{align}",display:!0},{left:"\\begin{alignat}",right:"\\end{alignat}",display:!0},{left:"\\begin{gather}",right:"\\end{gather}",display:!0},{left:"\\begin{CD}",right:"\\end{CD}",display:!0},{left:"\\[",right:"\\]",display:!0}]},this.DEFAULT_MERMAID_OPTIONS={startOnLoad:!1},this.DEFAULT_CLIPBOARD_OPTIONS={buttonComponent:void 0},this.DEFAULT_PARSE_OPTIONS={decodeHtml:!1,inline:!1,emoji:!1,mermaid:!1,markedOptions:void 0,disableSanitizer:!1},this.DEFAULT_RENDER_OPTIONS={clipboard:!1,clipboardOptions:void 0,katex:!1,katexOptions:void 0,mermaid:!1,mermaidOptions:void 0},this._reload$=new C,this.reload$=this._reload$.asObservable(),this.options=n}parse(e,t=this.DEFAULT_PARSE_OPTIONS){let{decodeHtml:n,inline:s,emoji:r,mermaid:o,disableSanitizer:l}=t,c=f(f({},this.options),t.markedOptions),u=c.renderer||this.renderer||new S;this.extensions&&(this.renderer=this.extendsRendererForExtensions(u)),o&&(this.renderer=this.extendsRendererForMermaid(u));let h=this.trimIndentation(e),d=n?this.decodeHtml(h):h,p=r?this.parseEmoji(d):d,k=this.parseMarked(p,c,s);return(l?k:this.sanitizer.sanitize(this.securityContext,k))||""}render(e,t=this.DEFAULT_RENDER_OPTIONS,n){let{clipboard:s,clipboardOptions:r,katex:o,katexOptions:l,mermaid:c,mermaidOptions:u}=t;o&&this.renderKatex(e,f(f({},this.DEFAULT_KATEX_OPTIONS),l)),c&&this.renderMermaid(e,f(f(f({},this.DEFAULT_MERMAID_OPTIONS),this.mermaidOptions),u)),s&&this.renderClipboard(e,n,f(f(f({},this.DEFAULT_CLIPBOARD_OPTIONS),this.clipboardOptions),r)),this.highlight(e)}reload(){this._reload$.next()}getSource(e){if(!this.http)throw new Error(pi);return this.http.get(e,{responseType:"text"}).pipe(Me(t=>this.handleExtension(e,t)))}highlight(e){if(!A(this.platform)||typeof Prism>"u"||typeof Prism.highlightAllUnder>"u")return;e||(e=document);let t=e.querySelectorAll('pre code:not([class*="language-"])');Array.prototype.forEach.call(t,n=>n.classList.add("language-none")),Prism.highlightAllUnder(e)}decodeHtml(e){if(!A(this.platform))return e;let t=document.createElement("textarea");return t.innerHTML=e,t.value}extendsRendererForExtensions(e){let t=e;return t.\u0275NgxMarkdownRendererExtendedForExtensions===!0||(this.extensions?.length>0&&m.use(...this.extensions),t.\u0275NgxMarkdownRendererExtendedForExtensions=!0),e}extendsRendererForMermaid(e){let t=e;if(t.\u0275NgxMarkdownRendererExtendedForMermaid===!0)return e;let n=e.code;return e.code=s=>s.lang==="mermaid"?`<div class="mermaid">${s.text}</div>`:n(s),t.\u0275NgxMarkdownRendererExtendedForMermaid=!0,e}handleExtension(e,t){let n=e.lastIndexOf("://"),s=n>-1?e.substring(n+4):e,r=s.lastIndexOf("/"),o=r>-1?s.substring(r+1).split("?")[0]:"",l=o.lastIndexOf("."),c=l>-1?o.substring(l+1):"";return c&&c!=="md"?"```"+c+`
`+t+"\n```":t}parseMarked(e,t,n=!1){if(t.renderer){let s=f({},t.renderer);delete s.\u0275NgxMarkdownRendererExtendedForExtensions,delete s.\u0275NgxMarkdownRendererExtendedForMermaid,delete t.renderer,m.use({renderer:s})}return n?m.parseInline(e,t):m.parse(e,t)}parseEmoji(e){if(!A(this.platform))return e;if(typeof joypixels>"u"||typeof joypixels.shortnameToUnicode>"u")throw new Error(ai);return joypixels.shortnameToUnicode(e)}renderKatex(e,t){if(A(this.platform)){if(typeof katex>"u"||typeof renderMathInElement>"u")throw new Error(li);renderMathInElement(e,t)}}renderClipboard(e,t,n){if(!A(this.platform))return;if(typeof ClipboardJS>"u")throw new Error(ui);if(!t)throw new Error(hi);let{buttonComponent:s,buttonTemplate:r}=n,o=e.querySelectorAll("pre");for(let l=0;l<o.length;l++){let c=o.item(l),u=document.createElement("div");u.style.position="relative",c.parentNode.insertBefore(u,c),u.appendChild(c);let h=document.createElement("div");h.classList.add("markdown-clipboard-toolbar"),h.style.position="absolute",h.style.top=".5em",h.style.right=".5em",h.style.zIndex="1",u.insertAdjacentElement("beforeend",h),u.onmouseenter=()=>h.classList.add("hover"),u.onmouseleave=()=>h.classList.remove("hover");let d;if(s){let k=t.createComponent(s);d=k.hostView,k.changeDetectorRef.markForCheck()}else if(r)d=t.createEmbeddedView(r);else{let k=t.createComponent(ii);d=k.hostView,k.changeDetectorRef.markForCheck()}let p;d.rootNodes.forEach(k=>{h.appendChild(k),p=new ClipboardJS(k,{text:()=>c.innerText})}),d.onDestroy(()=>p.destroy())}}renderMermaid(e,t=this.DEFAULT_MERMAID_OPTIONS){if(!A(this.platform))return;if(typeof mermaid>"u"||typeof mermaid.initialize>"u")throw new Error(ci);let n=e.querySelectorAll(".mermaid");n.length!==0&&(mermaid.initialize(t),mermaid.run({nodes:n}))}trimIndentation(e){if(!e)return"";let t;return e.split(`
`).map(n=>{let s=t;return n.length>0&&(s=isNaN(s)?n.search(/\S|$/):Math.min(n.search(/\S|$/),s)),isNaN(t)&&(t=s),s?n.substring(s):n}).join(`
`)}static{this.\u0275fac=function(t){return new(t||a)(I(si,8),I(cn,8),I(ri,8),I(oi,8),I(gt),I(un),I(It,8),I(Et))}}static{this.\u0275prov=pt({token:a,factory:a.\u0275fac})}}return a})(),rs=(()=>{class a{get disableSanitizer(){return this._disableSanitizer}set disableSanitizer(e){this._disableSanitizer=this.coerceBooleanProperty(e)}get inline(){return this._inline}set inline(e){this._inline=this.coerceBooleanProperty(e)}get clipboard(){return this._clipboard}set clipboard(e){this._clipboard=this.coerceBooleanProperty(e)}get emoji(){return this._emoji}set emoji(e){this._emoji=this.coerceBooleanProperty(e)}get katex(){return this._katex}set katex(e){this._katex=this.coerceBooleanProperty(e)}get mermaid(){return this._mermaid}set mermaid(e){this._mermaid=this.coerceBooleanProperty(e)}get lineHighlight(){return this._lineHighlight}set lineHighlight(e){this._lineHighlight=this.coerceBooleanProperty(e)}get lineNumbers(){return this._lineNumbers}set lineNumbers(e){this._lineNumbers=this.coerceBooleanProperty(e)}get commandLine(){return this._commandLine}set commandLine(e){this._commandLine=this.coerceBooleanProperty(e)}constructor(e,t,n){this.element=e,this.markdownService=t,this.viewContainerRef=n,this.error=new E,this.load=new E,this.ready=new E,this._clipboard=!1,this._commandLine=!1,this._disableSanitizer=!1,this._emoji=!1,this._inline=!1,this._katex=!1,this._lineHighlight=!1,this._lineNumbers=!1,this._mermaid=!1,this.destroyed$=new C}ngOnChanges(){this.loadContent()}loadContent(){if(this.data!=null){this.handleData();return}if(this.src!=null){this.handleSrc();return}}ngAfterViewInit(){!this.data&&!this.src&&this.handleTransclusion(),this.markdownService.reload$.pipe(pe(this.destroyed$)).subscribe(()=>this.loadContent())}ngOnDestroy(){this.destroyed$.next(),this.destroyed$.complete()}render(e,t=!1){return rt(this,null,function*(){let n={decodeHtml:t,inline:this.inline,emoji:this.emoji,mermaid:this.mermaid,disableSanitizer:this.disableSanitizer},s={clipboard:this.clipboard,clipboardOptions:this.getClipboardOptions(),katex:this.katex,katexOptions:this.katexOptions,mermaid:this.mermaid,mermaidOptions:this.mermaidOptions},r=yield this.markdownService.parse(e,n);this.element.nativeElement.innerHTML=r,this.handlePlugins(),this.markdownService.render(this.element.nativeElement,s,this.viewContainerRef),this.ready.emit()})}coerceBooleanProperty(e){return e!=null&&`${String(e)}`!="false"}getClipboardOptions(){if(this.clipboardButtonComponent||this.clipboardButtonTemplate)return{buttonComponent:this.clipboardButtonComponent,buttonTemplate:this.clipboardButtonTemplate}}handleData(){this.render(this.data)}handleSrc(){this.markdownService.getSource(this.src).subscribe({next:e=>{this.render(e).then(()=>{this.load.emit(e)})},error:e=>this.error.emit(e)})}handleTransclusion(){this.render(this.element.nativeElement.innerHTML,!0)}handlePlugins(){this.commandLine&&(this.setPluginClass(this.element.nativeElement,We.CommandLine),this.setPluginOptions(this.element.nativeElement,{dataFilterOutput:this.filterOutput,dataHost:this.host,dataPrompt:this.prompt,dataOutput:this.output,dataUser:this.user})),this.lineHighlight&&this.setPluginOptions(this.element.nativeElement,{dataLine:this.line,dataLineOffset:this.lineOffset}),this.lineNumbers&&(this.setPluginClass(this.eleme