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