UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

112 lines • 51.5 kB
/*!
# License information

## Contribution License Agreement

If you contribute code to this project, you are implicitly allowing your code
to be distributed under the MIT license. You are also implicitly verifying that
all code is your original work. `</legalese>`

## Marked

Copyright (c) 2018+, MarkedJS (https://github.com/markedjs/)
Copyright (c) 2011-2018, Christopher Jeffrey (https://github.com/chjj/)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

## Markdown

Copyright © 2004, John Gruber
http://daringfireball.net/
All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
* Neither the name “Markdown” nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

This software is provided by the copyright holders and contributors “as is” and any express or implied warranties, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose are disclaimed. In no event shall the copyright owner or contributors be liable for any direct, indirect, incidental, special, exemplary, or consequential damages (including, but not limited to, procurement of substitute goods or services; loss of use, data, or profits; or business interruption) however caused and on any theory of liability, whether in contract, strict liability, or tort (including negligence or otherwise) arising in any way out of the use of this software, even if advised of the possibility of such damage.
*/
var marked=(()=>{var N=Object.defineProperty;var Qe=Object.getOwnPropertyDescriptor;var Me=Object.getOwnPropertyNames;var je=Object.prototype.hasOwnProperty;var ue=t=>{throw TypeError(t)};var He=(t,e,r)=>e in t?N(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var Ne=(t,e)=>{for(var r in e)N(t,r,{get:e[r],enumerable:!0})},Fe=(t,e,r,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Me(e))!je.call(t,n)&&n!==r&&N(t,n,{get:()=>e[n],enumerable:!(s=Qe(e,n))||s.enumerable});return t};var Ge=t=>Fe(N({},"__esModule",{value:!0}),t);var b=(t,e,r)=>He(t,typeof e!="symbol"?e+"":e,r),Xe=(t,e,r)=>e.has(t)||ue("Cannot "+r);var ge=(t,e,r)=>e.has(t)?ue("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r);var ke=(t,e,r)=>(Xe(t,e,"access private method"),r);var tr={};Ne(tr,{Hooks:()=>B,Lexer:()=>R,Marked:()=>ve,Parser:()=>A,Renderer:()=>Q,TextRenderer:()=>K,Tokenizer:()=>O,defaults:()=>_,getDefaults:()=>J,lexer:()=>er,marked:()=>x,options:()=>Ut,parse:()=>Vt,parseInline:()=>Kt,parser:()=>Yt,setOptions:()=>Wt,use:()=>Ze,walkTokens:()=>Jt});function J(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var _=J();function Ae(t){_=t}var L={exec:()=>null};function E(t){let e=[];return r=>{let s=Math.max(0,Math.min(3,r-1)),n=e[s];return n||(n=t(s),e[s]=n),n}}function k(t,e=""){let r=typeof t=="string"?t:t.source,s={replace:(n,i)=>{let l=typeof i=="string"?i:i.source;return l=l.replace(S.caret,"$1"),r=r.replace(n,l),s},getRegex:()=>new RegExp(r,e)};return s}var Ue=((t="")=>{try{return!!new RegExp("(?<=1)(?<!1)"+t)}catch(e){return!1}})(),S={codeRemoveIndent:/^(?: {0,3}\t| {1,4})/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,endingSpaceTabChar:/[ \t]$/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,leadingSpaceTab:/^[ \t]+/,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ 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,numericCharacterReference:/&#(?:(\d{1,7})|[Xx]([A-Fa-f0-9]{1,6}));/,numericCharacterReferenceOrAmpersand:/&#(?:(\d{1,7})|[Xx]([A-Fa-f0-9]{1,6}));|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,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,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:t=>new RegExp(`^( {0,3}${t})((?:[	 ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:E(t=>new RegExp(`^ {0,${t}}(?:[*+-]|\\d{1,9}[.)])((?:[ 	][^\\n]*)?(?:\\n|$))`)),hrRegex:E(t=>new RegExp(`^ {0,${t}}((?:-[ 	]*){3,}|(?:_[ 	]*){3,}|(?:\\*[ 	]*){3,})(?:\\n+|$)`)),fencesBeginRegex:E(t=>new RegExp(`^ {0,${t}}(?:\`\`\`|~~~)`)),headingBeginRegex:E(t=>new RegExp(`^ {0,${t}}#`)),htmlBeginRegex:E(t=>new RegExp(`^ {0,${t}}(?:</?(?:${j})(?: +|$|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|<![A-Za-z]|<!\\[CDATA\\[)`,"i")),blockquoteBeginRegex:E(t=>new RegExp(`^ {0,${t}}>`))},We=/^(?:[ \t]*(?:\n|$))+/,Je=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Ke=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,M=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Ve=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,re=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,Te=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |fences|blockquote|heading|hr|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,ze=k(Te).replace(/bull/g,re).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}(?:\s|$)/).replace(/hr/g,/ {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),Ye=k(Te).replace(/bull/g,re).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}(?:\s|$)/).replace(/hr/g,/ {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),ne=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,et=/^[^\n]+/,se=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,tt=k(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",se).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),rt=k(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,re).getRegex(),j="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",ie=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,nt=k("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ 	]*)+\\n|$)|<(?!(?:script|pre|style|textarea)(?![a-z0-9-]))([a-z][a-z0-9-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ 	]*)+\\n|$)|</[a-z][a-z0-9-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ 	]*)+\\n|$))","i").replace("comment",ie).replace("tag",j).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),_e=t=>k(ne).replace("hr",M).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list",t).replace("html"," {0,3}(?:</?(?:tag)(?: +|\\n|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|<![A-Za-z]|<!\\[CDATA\\[)").replace("tag",j).getRegex(),st=_e(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),it=_e(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),lt=k(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",it).getRegex(),le={blockquote:lt,code:Je,def:tt,fences:Ke,heading:Ve,hr:M,html:nt,lheading:ze,list:rt,newline:We,paragraph:st,table:L,text:et},fe=k("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",M).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3}	)[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html"," {0,3}(?:</?(?:tag)(?: +|\\n|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|<![A-Za-z]|<!\\[CDATA\\[)").replace("tag",j).getRegex(),at={...le,lheading:Ye,table:fe,paragraph:k(ne).replace("hr",M).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",fe).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]").replace("html"," {0,3}(?:</?(?:tag)(?: +|\\n|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|<![A-Za-z]|<!\\[CDATA\\[)").replace("tag",j).getRegex()},ot={...le,html:k(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ie).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:L,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:k(ne).replace("hr",M).replace("heading",` *#{1,6} *[^
]`).replace("lheading",ze).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},ct=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,pt=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Pe=/^( {2,}|\\)\n(?!\s*$)[ \t]*/,ht=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,T=/[\p{P}\p{S}]/u,v=/[\s\p{P}\p{S}]/u,H=/[^\s\p{P}\p{S}]/u,ut=k(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,v).getRegex(),gt=/[\p{Pi}\p{Ps}"']/u,Le=/(?!~)[\p{P}\p{S}]/u,kt=/(?!~)[\s\p{P}\p{S}]/u,ft=/(?:[^\s\p{P}\p{S}]|~)/u,dt=k(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",Ue?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),Ce=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,xt=k(Ce,"u").replace(/punct/g,T).getRegex(),bt=k(Ce,"u").replace(/punct/g,Le).getRegex(),mt=/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,wt=k(mt,"u").replace(/openQuote/g,gt).replace(/punct/g,T).getRegex(),Ie="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",St=k(Ie,"gu").replace(/notPunctSpace/g,H).replace(/punctSpace/g,v).replace(/punct/g,T).getRegex(),$t=k(Ie,"gu").replace(/notPunctSpace/g,ft).replace(/punctSpace/g,kt).replace(/punct/g,Le).getRegex(),yt="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)",Rt=k(yt,"gu").replace(/notPunctSpace/g,H).replace(/punctSpace/g,v).replace(/punct/g,T).getRegex(),At=k("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,H).replace(/punctSpace/g,v).replace(/punct/g,T).getRegex(),Tt="^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)",zt=k(Tt,"gu").replace(/notPunctSpace/g,H).replace(/punctSpace/g,v).replace(/punct/g,T).getRegex(),_t=k(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,T).getRegex(),Pt="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",Lt=k(Pt,"gu").replace(/notPunctSpace/g,H).replace(/punctSpace/g,v).replace(/punct/g,T).getRegex(),Ct=k(/\\(punct)/,"gu").replace(/punct/g,T).getRegex(),It=k(/(`+)(?:[^`]|[^`][\s\S]*?[^`])\1(?!`)|`+|\\(punct)/,"gu").replace(/punct/g,T).getRegex(),Et=k(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),Bt=k(ie).replace("(?:-->|$)","-->").getRegex(),vt=k("^comment|^</[a-zA-Z][a-zA-Z0-9-]*\\s*>|^<[a-zA-Z][a-zA-Z0-9-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",Bt).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Ee=/\[(?:\\[\s\S]|[^\[\]\\])*\]/,X=k(/(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/).replace("brackets",Ee).getRegex(),Zt=k(/^!?\[(label)\]\([ \t\n]*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?[ \t\n]*\)/).replace("label",X).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),qt=k(/^!?\[(label)\]\[(ref)\]/).replace("label",X).replace("ref",se).getRegex(),Dt=k(/^!?\[(ref)\](?:\[\])?/).replace("ref",se).getRegex(),de=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\]){1,999}/,Ot=k(/(?:[^\[\]\\`]*(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\]))){0,999}?[^\[\]\\`]*?/).replace("brackets",Ee).getRegex(),Qt=k("reflink|nolink(?!\\()","g").replace("reflink",k(/^!?\[(label)\]\[(ref)\]/).replace("label",Ot).replace("ref",de).getRegex()).replace("nolink",k(/^!?\[(ref)\](?:\[\])?/).replace("ref",de).getRegex()).getRegex(),xe=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Mt=/[A-Za-z0-9._+-]+@[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/,jt=k(/(?:mailto:email|xmpp:email(?:\/[A-Za-z0-9@.]+)?)/).replace(/email/g,Mt).getRegex(),ae={_backpedal:L,anyPunctuation:Ct,anyPunctuationOutsideCode:It,autolink:Et,blockSkip:dt,br:Pe,code:pt,del:L,delLDelim:L,delRDelim:L,emStrongLDelim:xt,emStrongRDelimAst:St,emStrongRDelimUnd:At,escape:ct,link:Zt,nolink:Dt,punctuation:ut,reflink:qt,reflinkSearch:Qt,tag:vt,text:ht,url:L},Ht={...ae,emStrongLDelim:wt,emStrongRDelimAst:Rt,emStrongRDelimUnd:zt,link:k(/^!?\[(label)\]\((.*?)\)/).replace("label",X).getRegex(),reflink:k(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",X).getRegex()},ee={...ae,emStrongRDelimAst:$t,emStrongLDelim:bt,delLDelim:_t,delRDelim:Lt,url:k(/^emailProtocol|^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("emailProtocol",jt).replace("protocol",xe).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:k(/^(?:[^a-zA-Z0-9](?=emailProtocol)|(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9](?=emailProtocol)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))))/).replace("protocol",xe).replace(/emailProtocol/g,/(?:mailto|xmpp):/).getRegex()},Nt={...ee,br:k(Pe).replace("{2,}","*").getRegex(),text:k(ee.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},F={normal:le,gfm:at,pedantic:ot},D={normal:ae,gfm:ee,breaks:Nt,pedantic:Ht},Ft={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},be=t=>Ft[t];function y(t,e){if(e){if(S.escapeTest.test(t))return t.replace(S.escapeReplace,be)}else if(S.escapeTestNoEncode.test(t))return t.replace(S.escapeReplaceNoEncode,be);return t}function Gt(t){return S.numericCharacterReference.test(t)?t.replace(S.numericCharacterReferenceOrAmpersand,(e,r,s)=>{if(r===void 0&&s===void 0)return"&amp;";let n=r===void 0?Number.parseInt(s,16):Number.parseInt(r,10);return n===0||n>1114111||n>=55296&&n<=57343?"\uFFFD":n===38?"&amp;":String.fromCodePoint(n)}):t}function me(t){try{t=encodeURI(t).replace(S.percentDecode,"%")}catch(e){return null}return t}function we(t,e){var i;let r=t.replace(S.findPipe,(l,c,a)=>{let h=!1,o=c;for(;--o>=0&&a[o]==="\\";)h=!h;return h?"|":" |"}),s=r.split(S.splitPipe),n=0;if(s[0].trim()||s.shift(),s.length>0&&!((i=s.at(-1))!=null&&i.trim())&&s.pop(),e)if(s.length>e)s.splice(e);else for(;s.length<e;)s.push("");for(;n<s.length;n++)s[n]=s[n].trim().replace(S.slashPipe,"|");return s}function z(t,e,r){let s=t.length;if(s===0)return"";let n=0;for(;n<s;){let i=t.charAt(s-n-1);if(i===e&&!r)n++;else if(i!==e&&r)n++;else break}return t.slice(0,s-n)}function Se(t){let e=t.split(`
`),r=e.length-1;for(;r>=0&&S.blankLine.test(e[r]);)r--;return e.length-r<=2?t:e.slice(0,r+1).join(`
`)}function U(t){return t.trim().toLowerCase().toUpperCase().toLowerCase()}function $e(t,e){if(t.indexOf(e[0])===-1&&t.indexOf(e[1])===-1)return-1;let r=0;for(let s=0;s<t.length;s++)if(t[s]==="\\")s++;else if(t[s]===e[0])r++;else if(t[s]===e[1]&&(r--,r<0))return s;return r>0?-2:-1}function Y(t,e=0){let r=e,s="";for(let n of t)if(n==="	"){let i=4-r%4;s+=" ".repeat(i),r+=i}else s+=n,r++;return s}function ye(t,e,r,s,n){let i=e.href,l=e.title||null,c=t[1].replace(n.other.outputLinkReplace,"$1"),a=t[0].charAt(0)==="!",h=s.state.inLink,o=s.state.linkEmitted,g=s.state.inRawBlock;s.state.inLink=!0,s.state.linkEmitted=!1;let f=s.inlineTokens(c),p=s.state.linkEmitted;if(s.state.linkEmitted=o,s.state.inLink=h,!a){if(p){s.state.inRawBlock=g;return}s.state.linkEmitted=!0}return{type:a?"image":"link",raw:r,href:i,title:l,text:c,tokens:f}}function Xt(t,e,r){let s=t.match(r.other.indentCodeCompensation);if(s===null)return e;let n=s[1];return e.split(`
`).map(i=>{let l=i.match(r.other.beginningSpace);if(l===null)return i;let[c]=l;return i.slice(Math.min(c.length,n.length))}).join(`
`)}function Re(t,e,r,s){if(!e.includes("<"))return!1;for(let n=0;n<e.length;n++){if(e[n]==="\\"){n++;continue}if(e[n]==="`"){let c=s.inline.code.exec(e.slice(n));if(c){n+=c[0].length-1;continue}}if(e[n]!=="<")continue;let i=t.slice(r+n),l=s.inline.tag.exec(i)||s.inline.autolink.exec(i);if(l){if(l[0].length>e.length-n)return!0;n+=l[0].length-1}}return!1}var O=class{constructor(t){b(this,"options");b(this,"rules");b(this,"lexer");this.options=t||_}space(t){let e=this.rules.block.newline.exec(t);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(t){let e=this.rules.block.code.exec(t);if(e){let r=this.options.pedantic?e[0]:Se(e[0]),s=r.replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:r,codeBlockStyle:"indented",text:s}}}fences(t){let e=this.rules.block.fences.exec(t);if(e){let r=e[0],s=Xt(r,e[3]||"",this.rules);return{type:"code",raw:r,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:s}}}heading(t){let e=this.rules.block.heading.exec(t);if(e){let r=e[2].trim();if(this.rules.other.endingHash.test(r)){let s=z(r,"#");(this.options.pedantic||!s||this.rules.other.endingSpaceTabChar.test(s))&&(r=s.trim())}return{type:"heading",raw:z(e[0],`
`),depth:e[1].length,text:r,tokens:this.lexer.inline(r)}}}hr(t){let e=this.rules.block.hr.exec(t);if(e)return{type:"hr",raw:z(e[0],`
`)}}blockquote(t){let e=this.rules.block.blockquote.exec(t);if(e){let r=z(e[0],`
`).split(`
`),s="",n="",i=[];for(;r.length>0;){let l=!1,c=[],a;for(a=0;a<r.length;a++)if(this.rules.other.blockquoteStart.test(r[a]))c.push(r[a]),l=!0;else if(!l)c.push(r[a]);else break;r=r.slice(a);let h=c.join(`
`),o=h.replace(this.rules.other.blockquoteSetextReplace,`
    $1`).replace(this.rules.other.blockquoteSetextReplace2,"");s=s?`${s}
${h}`:h,n=n?`${n}
${o}`:o;let g=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(o,i,!0),this.lexer.state.top=g,r.length===0)break;let f=i.at(-1);if((f==null?void 0:f.type)==="code"||(f==null?void 0:f.type)==="heading"||(f==null?void 0:f.type)==="hr"||(f==null?void 0:f.type)==="html")break;if((f==null?void 0:f.type)==="blockquote"){let p=f,m=r.join(`
`),u=p.raw+`
`+m.replace(this.rules.other.blockquoteSetextReplace2,""),d=this.blockquote(u);i[i.length-1]=d;let $=u.substring(d.raw.length).replace(/^\n/,""),w=$?$.split(`
`).length:0,Z=w?r.slice(0,-w):r;Z.length>0&&(s=`${s}
${Z.join(`
`)}`),n=n.substring(0,n.length-p.text.length)+d.text;break}else if((f==null?void 0:f.type)==="list"){let p=f,m=p.raw+`
`+r.join(`
`),u=this.list(m);i[i.length-1]=u,s=s.substring(0,s.length-f.raw.length)+u.raw,n=n.substring(0,n.length-p.raw.length)+u.raw,r=m.substring(i.at(-1).raw.length).split(`
`);continue}}return{type:"blockquote",raw:s,tokens:i,text:n}}}list(t){let e=this.rules.block.list.exec(t);if(e){let r=t,s=()=>r.length-t.length,n=e[1].trim(),i=n.length>1,l={type:"list",raw:"",ordered:i,start:i?+n.slice(0,-1):"",loose:!1,items:[]};n=i?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=i?n:"[*+-]");let c=this.rules.other.listItemRegex(n),a=!1;for(;t;){let o=!1,g="";if(!(e=c.exec(t))||this.rules.block.hr.test(t))break;let f=s();t=t.substring(e[0].length);let p=e[2].split(`
`,1)[0],m=e[1].length,u=this.options.pedantic?Y(p,m):p.replace(this.rules.other.leadingSpaceTab,V=>Y(V,m)),d=t.split(`
`,1)[0],$=!u.trim(),w=0;if(this.options.pedantic?(w=2,g=u.trimStart()):$?w=m+1:(w=u.search(this.rules.other.nonSpaceChar),w=w>4?1:w,g=u.slice(w),w+=m),$&&this.rules.other.blankLine.test(d)&&(t=t.substring(d.length+1),o=!0),!o){let V=this.rules.other.nextBulletRegex(w),oe=this.rules.other.hrRegex(w),ce=this.rules.other.fencesBeginRegex(w),pe=this.rules.other.headingBeginRegex(w),qe=this.rules.other.htmlBeginRegex(w),De=this.rules.other.blockquoteBeginRegex(w);for(;t;){let he=t.split(`
`,1)[0],q;if(d=he,this.options.pedantic?(d=d.replace(this.rules.other.listReplaceNesting,"  "),q=d):q=d.replace(this.rules.other.leadingSpaceTab,Oe=>Y(Oe)),ce.test(d)||pe.test(d)||qe.test(d)||De.test(d)||V.test(d)||oe.test(d))break;if(q.search(this.rules.other.nonSpaceChar)>=w||!d.trim())g+=`
`+q.slice(w);else{if($||u.replace(this.rules.other.tabCharGlobal,"    ").search(this.rules.other.nonSpaceChar)>=4||ce.test(u)||pe.test(u)||oe.test(u))break;g+=`
`+d}$=!d.trim(),t=t.substring(he.length+1),u=q.slice(w)}}let Z=r.slice(f,s());l.loose||(a?l.loose=!0:this.rules.other.doubleBlankLine.test(Z)&&(a=!0)),l.items.push({type:"list_item",raw:Z,task:!!this.options.gfm&&this.rules.other.listIsTask.test(g),loose:!1,text:g,tokens:[]})}let h=l.items.at(-1);if(h)h.raw=h.raw.trimEnd(),h.text=h.text.trimEnd();else return;l.raw=r.slice(0,s()).trimEnd();for(let o of l.items)if(this.lexer.state.top=!1,o.tokens=this.lexer.blockTokens(o.text,[]),!l.loose){let g=o.tokens.filter(p=>p.type==="space"),f=g.length>0&&g.some(p=>this.rules.other.anyLine.test(p.raw));l.loose=f}for(let o of l.items){let g=o.tokens[0];if(o.task&&((g==null?void 0:g.type)==="text"||(g==null?void 0:g.type)==="paragraph")){o.text=o.text.replace(this.rules.other.listReplaceTask,""),g.raw=g.raw.replace(this.rules.other.listReplaceTask,""),g.text=g.text.replace(this.rules.other.listReplaceTask,"");for(let p=this.lexer.inlineQueue.length-1;p>=0;p--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[p].src)){this.lexer.inlineQueue[p].src=this.lexer.inlineQueue[p].src.replace(this.rules.other.listReplaceTask,"");break}let f=this.rules.other.listTaskCheckbox.exec(o.raw);if(f){let p={type:"checkbox",raw:f[0]+" ",checked:f[0]!=="[ ]"};o.checked=p.checked,l.loose?o.tokens[0]&&["paragraph","text"].includes(o.tokens[0].type)&&"tokens"in o.tokens[0]&&o.tokens[0].tokens?(o.tokens[0].raw=p.raw+o.tokens[0].raw,o.tokens[0].text=p.raw+o.tokens[0].text,o.tokens[0].tokens.unshift(p)):o.tokens.unshift({type:"paragraph",raw:p.raw,text:p.raw,tokens:[p]}):o.tokens.unshift(p)}}else o.task&&(o.task=!1)}if(l.loose)for(let o of l.items){o.loose=!0;for(let g of o.tokens)g.type==="text"&&(g.type="paragraph")}return l}}html(t){let e=this.rules.block.html.exec(t);if(e){let r=Se(e[0]);return{type:"html",block:!0,raw:r,pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:r}}}def(t){let e=this.rules.block.def.exec(t);if(e){if(!this.rules.other.startAngleBracket.test(e[2])&&$e(e[2],"()")!==-1)return;let r=U(e[1]).replace(this.rules.other.multipleSpaceGlobal," "),s=e[2]?e[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",n=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:r,raw:z(e[0],`
`),href:s,title:n}}}table(t){var l;let e=this.rules.block.table.exec(t);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;let r=we(e[1]),s=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),n=(l=e[3])!=null&&l.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
`):[],i={type:"table",raw:z(e[0],`
`),header:[],align:[],rows:[]};if(r.length===s.length){for(let c of s)this.rules.other.tableAlignRight.test(c)?i.align.push("right"):this.rules.other.tableAlignCenter.test(c)?i.align.push("center"):this.rules.other.tableAlignLeft.test(c)?i.align.push("left"):i.align.push(null);for(let c=0;c<r.length;c++)i.header.push({text:r[c],tokens:this.lexer.inline(r[c]),header:!0,align:i.align[c]});for(let c of n)i.rows.push(we(c,i.header.length).map((a,h)=>({text:a,tokens:this.lexer.inline(a),header:!1,align:i.align[h]})));return i}}lheading(t){let e=this.rules.block.lheading.exec(t);if(e){let r=e[1].trim();return{type:"heading",raw:z(e[0],`
`),depth:e[2].charAt(0)==="="?1:2,text:r,tokens:this.lexer.inline(r)}}}paragraph(t){let e=this.rules.block.paragraph.exec(t);if(e){let r=e[1].charAt(e[1].length-1)===`
`?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:r,tokens:this.lexer.inline(r)}}}text(t){let e=this.rules.block.text.exec(t);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(t){let e=this.rules.inline.escape.exec(t);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(t){let e=this.rules.inline.tag.exec(t);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(t){if(this.lexer.state.linkParenPossible===!1)return;let e=this.rules.inline.link.exec(t);if(e){let r=e[0].charAt(0)==="!"?2:1;if(!this.options.pedantic&&Re(t,e[1],r,this.rules))return;let s=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(s)){if(!this.rules.other.endAngleBracket.test(s))return;let l=z(s.slice(0,-1),"\\");if((s.length-l.length)%2===0)return}else{let l=$e(e[2],"()");if(l===-2)return;if(l>-1){let c=(e[0].indexOf("!")===0?5:4)+e[1].length+l;e[2]=e[2].substring(0,l),e[0]=e[0].substring(0,c).trim(),e[3]=""}}let n=e[2],i="";if(this.options.pedantic){let l=this.rules.other.pedanticHrefTitle.exec(n);l&&(n=l[1],i=l[3])}else i=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(s)?n=n.slice(1):n=n.slice(1,-1)),ye(e,{href:n&&n.replace(this.rules.inline.anyPunctuation,"$1"),title:i&&i.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(t,e){let r;if((r=this.rules.inline.reflink.exec(t))||(r=this.rules.inline.nolink.exec(t))){let s=r[0].charAt(0)==="!"?2:1;if(!this.options.pedantic&&Re(t,r[1],s,this.rules))return;let n=(r[2]||r[1]).replace(this.rules.other.multipleSpaceGlobal," "),i=e[U(n)];if(!i){let l=r[0].charAt(0);return{type:"text",raw:l,text:l}}return ye(r,i,r[0],this.lexer,this.rules)}}emStrong(t,e,r=""){let s=this.rules.inline.emStrongLDelim.exec(t);if(!(!s||!s[1]&&!s[2]&&!s[3]&&!s[4]||s[4]&&r.match(this.rules.other.unicodeAlphaNumeric))&&(!(s[1]||s[3])||!r||this.rules.inline.punctuation.exec(r))){let n=[...s[0]].length-1,i,l,c=n,a=0,h=s[0][0],o=r===h,g=h==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(g.lastIndex=0,e=e.slice(-1*t.length+n);(s=g.exec(e))!==null;){if(i=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!i)continue;if(l=[...i].length,s[3]||s[4]){c+=l;continue}else if(s[5]||s[6]){if(n%3&&!((n+l)%3)){a+=l;continue}if(o)break}if(c-=l,c>0)continue;l=Math.min(l,l+c+a);let f=[...s[0]][0].length,p=t.slice(0,n+s.index+f+l);if(Math.min(n,l)%2){let u=p.slice(1,-1);return{type:"em",raw:p,text:u,tokens:this.lexer.inlineTokens(u)}}let m=p.slice(2,-2);return{type:"strong",raw:p,text:m,tokens:this.lexer.inlineTokens(m)}}}}codespan(t){let e=this.rules.inline.code.exec(t);if(e){let r=e[2].replace(this.rules.other.newLineCharGlobal," "),s=this.rules.other.nonSpaceChar.test(r),n=this.rules.other.startingSpaceChar.test(r)&&this.rules.other.endingSpaceChar.test(r);return s&&n&&(r=r.substring(1,r.length-1)),{type:"codespan",raw:e[0],text:r}}}br(t){let e=this.rules.inline.br.exec(t);if(e)return{type:"br",raw:e[0]}}del(t,e,r=""){let s=this.rules.inline.delLDelim.exec(t);if(s&&(!s[1]||!r||this.rules.inline.punctuation.exec(r))){let n=[...s[0]].length-1,i,l,c=n,a=this.rules.inline.delRDelim;for(a.lastIndex=0,e=e.slice(-1*t.length+n);(s=a.exec(e))!==null;){if(i=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!i||(l=[...i].length,l!==n))continue;if(s[3]||s[4]){c+=l;continue}if(c-=l,c>0)continue;l=Math.min(l,l+c);let h=[...s[0]][0].length,o=t.slice(0,n+s.index+h+l),g=o.slice(n,-n);return{type:"del",raw:o,text:g,tokens:this.lexer.inlineTokens(g)}}}}autolink(t){let e=this.rules.inline.autolink.exec(t);if(e){let r,s;return e[2]==="@"?(r=e[1],s="mailto:"+r):(r=e[1],s=r),{type:"link",raw:e[0],text:r,href:s,autolink:!0,tokens:[{type:"text",raw:r,text:r}]}}}url(t){var r,s;let e;if(e=this.rules.inline.url.exec(t)){let n,i;if(e[2]==="@")n=e[0],i="mailto:"+n;else{let l;do l=e[0],e[0]=(s=(r=this.rules.inline._backpedal.exec(e[0]))==null?void 0:r[0])!=null?s:"";while(l!==e[0]);n=e[0],e[1]==="www."?i="http://"+e[0]:i=e[0]}return{type:"link",raw:e[0],text:n,href:i,autolink:!0,tokens:[{type:"text",raw:n,text:n}]}}}inlineText(t){let e=this.rules.inline.text.exec(t);if(e){let r=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:r?e[0]:Gt(e[0]),escaped:r}}}},W,Be,C,R=(C=class{constructor(e){ge(this,W);b(this,"tokens");b(this,"options");b(this,"state");b(this,"inlineQueue");b(this,"tokenizer");this.tokens=[],this.tokens.links=Object.create(null),this.options=e||_,this.options.tokenizer=this.options.tokenizer||new O,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,linkEmitted:!1,linkParenPossible:!0,top:!0};let r={other:S,block:F.normal,inline:D.normal};this.options.pedantic?(r.block=F.pedantic,r.inline=D.pedantic):this.options.gfm&&(r.block=F.gfm,this.options.breaks?r.inline=D.breaks:r.inline=D.gfm),this.tokenizer.rules=r}static get rules(){return{block:F,inline:D}}static lex(e,r){return new C(r).lex(e)}static lexInline(e,r){return new C(r).inlineTokens(e)}lex(e){e=e.replace(S.carriageReturn,`
`),this.blockTokens(e,this.tokens);for(let r=0;r<this.inlineQueue.length;r++){let s=this.inlineQueue[r];this.inlineTokens(s.src,s.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,r=[],s=!1){var i,l,c;this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(S.tabCharGlobal,"    ").replace(S.spaceLine,""));let n=1/0;for(;e;){if(e.length<n)n=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}let a;if((l=(i=this.options.extensions)==null?void 0:i.block)!=null&&l.some(o=>(a=o.call({lexer:this},e,r))?(e=e.substring(a.raw.length),r.push(a),!0):!1))continue;if(a=this.tokenizer.space(e)){e=e.substring(a.raw.length);let o=r.at(-1);a.raw.length===1&&o!==void 0?o.raw+=`
`:r.push(a);continue}if(a=this.tokenizer.code(e)){e=e.substring(a.raw.length);let o=r.at(-1);(o==null?void 0:o.type)==="paragraph"||(o==null?void 0:o.type)==="text"?(o.raw+=(o.raw.endsWith(`
`)?"":`
`)+a.raw,o.text+=`
`+a.text,this.inlineQueue.at(-1).src=o.text):r.push(a);continue}if(a=this.tokenizer.fences(e)){e=e.substring(a.raw.length),r.push(a);continue}if(a=this.tokenizer.heading(e)){e=e.substring(a.raw.length),r.push(a);continue}if(a=this.tokenizer.hr(e)){e=e.substring(a.raw.length),r.push(a);continue}if(a=this.tokenizer.blockquote(e)){e=e.substring(a.raw.length),r.push(a);continue}if(a=this.tokenizer.list(e)){e=e.substring(a.raw.length),r.push(a);continue}if(a=this.tokenizer.html(e)){e=e.substring(a.raw.length),r.push(a);continue}if(a=this.tokenizer.def(e)){e=e.substring(a.raw.length);let o=r.at(-1);(o==null?void 0:o.type)==="paragraph"||(o==null?void 0:o.type)==="text"?(o.raw+=(o.raw.endsWith(`
`)?"":`
`)+a.raw,o.text+=`
`+a.raw,this.inlineQueue.at(-1).src=o.text):this.tokens.links[a.tag]||(this.tokens.links[a.tag]={href:a.href,title:a.title},r.push(a));continue}if(a=this.tokenizer.table(e)){e=e.substring(a.raw.length),r.push(a);continue}if(a=this.tokenizer.lheading(e)){e=e.substring(a.raw.length),r.push(a);continue}let h=e;if((c=this.options.extensions)!=null&&c.startBlock){let o=1/0,g=e.slice(1),f;this.options.extensions.startBlock.forEach(p=>{f=p.call({lexer:this},g),typeof f=="number"&&f>=0&&(o=Math.min(o,f))}),o<1/0&&o>=0&&(h=e.substring(0,o+1))}if(this.state.top&&(a=this.tokenizer.paragraph(h))){let o=r.at(-1);s&&(o==null?void 0:o.type)==="paragraph"?(o.raw+=(o.raw.endsWith(`
`)?"":`
`)+a.raw,o.text+=`
`+a.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=o.text):r.push(a),s=h.length!==e.length,e=e.substring(a.raw.length);continue}if(a=this.tokenizer.text(e)){e=e.substring(a.raw.length);let o=r.at(-1);(o==null?void 0:o.type)==="text"?(o.raw+=(o.raw.endsWith(`
`)?"":`
`)+a.raw,o.text+=`
`+a.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=o.text):r.push(a);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return this.state.top=!0,r}inline(e,r=[]){return this.inlineQueue.push({src:e,tokens:r}),r}linkInText(e){if(!e.includes("["))return!1;let r=this.tokenizer.rules.inline.link;for(let s of e.matchAll(this.tokenizer.rules.inline.blockSkip))if(r.test(s[0])&&e.charAt(s.index-1)!=="!")return!0;for(let s of e.matchAll(this.tokenizer.rules.inline.reflinkSearch)){let n=s[0],i=n.lastIndexOf("[");if(!(n.charAt(0)==="!"||!Object.hasOwn(this.tokens.links,U(n.slice(i+1,-1))))&&!(i>1&&this.linkInText(n.slice(1,i-1))))return!0}return!1}inlineTokens(e,r=[]){this.tokenizer.lexer=this;let s=this.state.linkParenPossible;this.state.linkParenPossible=s&&e.includes(")");try{return ke(this,W,Be).call(this,e,r)}finally{this.state.linkParenPossible=s}}infiniteLoopError(e){let r="Infinite loop on byte: "+e;if(this.options.silent)console.error(r);else throw new Error(r)}},W=new WeakSet,Be=function(e,r){var c,a,h,o,g,f;let s=e;if(this.tokens.links&&e.includes("[")){let p=this.tokenizer.rules.inline.reflinkSearch,m=u=>{let d=u.lastIndexOf("[");if(!Object.hasOwn(this.tokens.links,U(u.slice(d+1,-1))))return u;if(d>1&&u.charAt(0)!=="!"){let $=u.slice(1,d-1);if(this.linkInText($))return"["+$.replace(p,m)+"]["+"a".repeat(u.length-d-2)+"]"}return"["+"a".repeat(u.length-2)+"]"};s=s.replace(p,m)}s=s.replace(this.tokenizer.rules.inline.anyPunctuationOutsideCode,(p,m,u)=>u?"+".repeat(p.length):m?m+p.slice(m.length,-m.length).replace(/`/g,"+")+m:p),s=s.replace(this.tokenizer.rules.inline.blockSkip,(p,m,u)=>{let d=u?u.length:0;return p.slice(0,d)+"["+"a".repeat(p.length-d-2)+"]"}),s=(h=(a=(c=this.options.hooks)==null?void 0:c.emStrongMask)==null?void 0:a.call({lexer:this},s))!=null?h:s;let n=!1,i="",l=1/0;for(;e;){if(e.length<l)l=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}n||(i=""),n=!1;let p;if((g=(o=this.options.extensions)==null?void 0:o.inline)!=null&&g.some(u=>(p=u.call({lexer:this},e,r))?(e=e.substring(p.raw.length),r.push(p),!0):!1))continue;if(p=this.tokenizer.escape(e)){e=e.substring(p.raw.length),r.push(p);continue}if(p=this.tokenizer.tag(e)){e=e.substring(p.raw.length),r.push(p);continue}if(p=this.tokenizer.link(e)){e=e.substring(p.raw.length),r.push(p);continue}if(p=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(p.raw.length);let u=r.at(-1);p.type==="text"&&(u==null?void 0:u.type)==="text"?(u.raw+=p.raw,u.text+=p.text):r.push(p);continue}if(p=this.tokenizer.emStrong(e,s,i)){e=e.substring(p.raw.length),r.push(p);continue}if(p=this.tokenizer.codespan(e)){e=e.substring(p.raw.length),r.push(p);continue}if(p=this.tokenizer.br(e)){e=e.substring(p.raw.length),r.push(p);continue}if(p=this.tokenizer.del(e,s,i)){e=e.substring(p.raw.length),r.push(p);continue}if(p=this.tokenizer.autolink(e)){e=e.substring(p.raw.length),r.push(p);continue}if(!this.state.inLink&&(p=this.tokenizer.url(e))){e=e.substring(p.raw.length),r.push(p);continue}let m=e;if((f=this.options.extensions)!=null&&f.startInline){let u=1/0,d=e.slice(1),$;this.options.extensions.startInline.forEach(w=>{$=w.call({lexer:this},d),typeof $=="number"&&$>=0&&(u=Math.min(u,$))}),u<1/0&&u>=0&&(m=e.substring(0,u+1))}if(p=this.tokenizer.inlineText(m)){e=e.substring(p.raw.length),p.raw.slice(-1)!=="_"&&(i=p.raw.slice(-1)),n=!0;let u=r.at(-1);(u==null?void 0:u.type)==="text"?(u.raw+=p.raw,u.text+=p.text):r.push(p);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return r},C),Q=class{constructor(t){b(this,"options");b(this,"parser");this.options=t||_}space(t){return""}code({text:t,lang:e,escaped:r}){var i;let s=(i=(e||"").match(S.notSpaceStart))==null?void 0:i[0],n=t?t.replace(S.endingNewline,"")+`
`:"";return s?'<pre><code class="language-'+y(s)+'">'+(r?n:y(n,!0))+`</code></pre>
`:"<pre><code>"+(r?n:y(n,!0))+`</code></pre>
`}blockquote({tokens:t}){return`<blockquote>
${this.parser.parse(t)}</blockquote>
`}html({text:t}){return t}def(t){return""}heading({tokens:t,depth:e}){return`<h${e}>${this.parser.parseInline(t)}</h${e}>
`}hr(t){return`<hr>
`}list(t){let e=t.ordered,r=t.start,s="";for(let l=0;l<t.items.length;l++){let c=t.items[l];s+=this.listitem(c)}let n=e?"ol":"ul",i=e&&r!==1?' start="'+r+'"':"";return"<"+n+i+`>
`+s+"</"+n+`>
`}listitem(t){return`<li>${this.parser.parse(t.tokens)}</li>
`}checkbox({checked:t}){return"<input "+(t?'checked="" ':"")+'disabled="" type="checkbox"> '}paragraph({tokens:t}){return`<p>${this.parser.parseInline(t)}</p>
`}table(t){let e="",r="";for(let n=0;n<t.header.length;n++)r+=this.tablecell(t.header[n]);e+=this.tablerow({text:r});let s="";for(let n=0;n<t.rows.length;n++){let i=t.rows[n];r="";for(let l=0;l<i.length;l++)r+=this.tablecell(i[l]);s+=this.tablerow({text:r})}return s&&(s=`<tbody>${s}</tbody>`),`<table>
<thead>
`+e+`</thead>
`+s+`</table>
`}tablerow({text:t}){return`<tr>
${t}</tr>
`}tablecell(t){let e=this.parser.parseInline(t.tokens),r=t.header?"th":"td";return(t.align?`<${r} align="${t.align}">`:`<${r}>`)+e+`</${r}>
`}strong({tokens:t}){return`<strong>${this.parser.parseInline(t)}</strong>`}em({tokens:t}){return`<em>${this.parser.parseInline(t)}</em>`}codespan({text:t}){return`<code>${y(t,!0)}</code>`}br(t){return"<br>"}del({tokens:t}){return`<del>${this.parser.parseInline(t)}</del>`}link({href:t,title:e,text:r,tokens:s,autolink:n}){let i=n?y(r,!0):this.parser.parseInline(s),l=me(t);if(l===null)return i;t=y(l,n);let c='<a href="'+t+'"';return e&&(c+=' title="'+y(e)+'"'),c+=">"+i+"</a>",c}image({href:t,title:e,text:r,tokens:s}){s&&(r=this.parser.parseInline(s,this.parser.textRenderer));let n=me(t);if(n===null)return y(r);t=n;let i=`<img src="${y(t)}" alt="${y(r)}"`;return e&&(i+=` title="${y(e)}"`),i+=">",i}text(t){return"tokens"in t&&t.tokens?this.parser.parseInline(t.tokens):"escaped"in t&&t.escaped?t.text:y(t.text)}},K=class{strong({text:t}){return t}em({text:t}){return t}codespan({text:t}){return t}del({text:t}){return t}html({text:t}){return t}text({text:t}){return t}link({text:t}){return""+t}image({text:t}){return""+t}br(){return""}checkbox({raw:t}){return t}},A=class te{constructor(e){b(this,"options");b(this,"renderer");b(this,"textRenderer");this.options=e||_,this.options.renderer=this.options.renderer||new Q,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new K}static parse(e,r){return new te(r).parse(e)}static parseInline(e,r){return new te(r).parseInline(e)}parse(e){var s,n;this.renderer.parser=this;let r="";for(let i=0;i<e.length;i++){let l=e[i];if((n=(s=this.options.extensions)==null?void 0:s.renderers)!=null&&n[l.type]){let a=l,h=this.options.extensions.renderers[a.type].call({parser:this},a);if(h!==!1||!["space","hr","heading","code","table","blockquote","list","checkbox","html","def","paragraph","text"].includes(a.type)){r+=h||"";continue}}let c=l;switch(c.type){case"space":{r+=this.renderer.space(c);break}case"hr":{r+=this.renderer.hr(c);break}case"heading":{r+=this.renderer.heading(c);break}case"code":{r+=this.renderer.code(c);break}case"table":{r+=this.renderer.table(c);break}case"blockquote":{r+=this.renderer.blockquote(c);break}case"list":{r+=this.renderer.list(c);break}case"checkbox":{r+=this.renderer.checkbox(c);break}case"html":{r+=this.renderer.html(c);break}case"def":{r+=this.renderer.def(c);break}case"paragraph":{r+=this.renderer.paragraph(c);break}case"text":{r+=this.renderer.text(c);break}default:{let a='Token with "'+c.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return r}parseInline(e,r=this.renderer){var n,i;this.renderer.parser=this;let s="";for(let l=0;l<e.length;l++){let c=e[l];if((i=(n=this.options.extensions)==null?void 0:n.renderers)!=null&&i[c.type]){let h=this.options.extensions.renderers[c.type].call({parser:this},c);if(h!==!1||!["escape","html","link","image","checkbox","strong","em","codespan","br","del","text"].includes(c.type)){s+=h||"";continue}}let a=c;switch(a.type){case"escape":{s+=r.text(a);break}case"html":{s+=r.html(a);break}case"link":{s+=r.link(a);break}case"image":{s+=r.image(a);break}case"checkbox":{s+=r.checkbox(a);break}case"strong":{s+=r.strong(a);break}case"em":{s+=r.em(a);break}case"codespan":{s+=r.codespan(a);break}case"br":{s+=r.br(a);break}case"del":{s+=r.del(a);break}case"text":{s+=r.text(a);break}default:{let h='Token with "'+a.type+'" type was not found.';if(this.options.silent)return console.error(h),"";throw new Error(h)}}}return s}},G,B=(G=class{constructor(t){b(this,"options");b(this,"block");this.options=t||_}preprocess(t){return t}postprocess(t){return t}processAllTokens(t){return t}emStrongMask(t){return t}provideLexer(t=this.block){return t?R.lex:R.lexInline}provideParser(t=this.block){return t?A.parse:A.parseInline}},b(G,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),b(G,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),G);function P(t,e){if(Array.isArray(e))for(let r=0;r<e.length;r++)t.push(e[r]);else t.push(e)}var ve=class{constructor(...t){b(this,"defaults",J());b(this,"options",this.setOptions);b(this,"parse",this.parseMarkdown(!0));b(this,"parseInline",this.parseMarkdown(!1));b(this,"Parser",A);b(this,"Renderer",Q);b(this,"TextRenderer",K);b(this,"Lexer",R);b(this,"Tokenizer",O);b(this,"Hooks",B);this.use(...t)}walkTokens(t,e){var s,n;let r=[];for(let i of t)switch(P(r,e.call(this,i)),i.type){case"table":{let l=i;for(let c of l.header)P(r,this.walkTokens(c.tokens,e));for(let c of l.rows)for(let a of c)P(r,this.walkTokens(a.tokens,e));break}case"list":{let l=i;P(r,this.walkTokens(l.items,e));break}default:{let l=i;(n=(s=this.defaults.extensions)==null?void 0:s.childTokens)!=null&&n[l.type]?this.defaults.extensions.childTokens[l.type].forEach(c=>{let a=l[c].flat(1/0);P(r,this.walkTokens(a,e))}):l.tokens&&P(r,this.walkTokens(l.tokens,e))}}return r}use(...t){let e=this.defaults.extensions||{renderers:{},childTokens:{}};return t.forEach(r=>{let s={...r};if(s.async=this.defaults.async||s.async||!1,r.extensions&&(r.extensions.forEach(n=>{if(!n.name)throw new Error("extension name required");if("renderer"in n){let i=e.renderers[n.name];i?e.renderers[n.name]=function(...l){let c=n.renderer.apply(this,l);return c===!1&&(c=i.apply(this,l)),c}:e.renderers[n.name]=n.renderer}if("tokenizer"in n){if(!n.level||n.level!=="block"&&n.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let i=e[n.level];i?i.unshift(n.tokenizer):e[n.level]=[n.tokenizer],n.start&&(n.level==="block"?e.startBlock?e.startBlock.push(n.start):e.startBlock=[n.start]:n.level==="inline"&&(e.startInline?e.startInline.push(n.start):e.startInline=[n.start]))}"childTokens"in n&&n.childTokens&&(e.childTokens[n.name]=n.childTokens)}),s.extensions=e),r.renderer){let n=this.defaults.renderer||new Q(this.defaults);for(let i in r.renderer){if(!(i in n))throw new Error(`renderer '${i}' does not exist`);if(["options","parser"].includes(i))continue;let l=i,c=r.renderer[l],a=n[l];n[l]=(...h)=>{let o=c.apply(n,h);return o===!1&&(o=a.apply(n,h)),o||""}}s.renderer=n}if(r.tokenizer){let n=this.defaults.tokenizer||new O(this.defaults);for(let i in r.tokenizer){if(!(i in n))throw new Error(`tokenizer '${i}' does not exist`);if(["options","rules","lexer"].includes(i))continue;let l=i,c=r.tokenizer[l],a=n[l];n[l]=(...h)=>{let o=c.apply(n,h);return o===!1&&(o=a.apply(n,h)),o}}s.tokenizer=n}if(r.hooks){let n=this.defaults.hooks||new B;for(let i in r.hooks){if(!(i in n))throw new Error(`hook '${i}' does not exist`);if(["options","block"].includes(i))continue;let l=i,c=r.hooks[l],a=n[l];B.passThroughHooks.has(i)?n[l]=h=>{if(this.defaults.async&&B.passThroughHooksRespectAsync.has(i))return(async()=>{let g=await c.call(n,h);return a.call(n,g)})();let o=c.call(n,h);return a.call(n,o)}:n[l]=(...h)=>{if(this.defaults.async)return(async()=>{let g=await c.apply(n,h);return g===!1&&(g=await a.apply(n,h)),g})();let o=c.apply(n,h);return o===!1&&(o=a.apply(n,h)),o}}s.hooks=n}if(r.walkTokens){let n=this.defaults.walkTokens,i=r.walkTokens;s.walkTokens=function(l){let c=[];return c.push(i.call(this,l)),n&&P(c,n.call(this,l)),c}}this.defaults={...this.defaults,...s}}),this}setOptions(t){return this.defaults={...this.defaults,...t},this}lexer(t,e){return R.lex(t,e!=null?e:this.defaults)}parser(t,e){return A.parse(t,e!=null?e:this.defaults)}parseMarkdown(t){return(e,r)=>{let s={...r},n={...this.defaults,...s},i=this.onError(!!n.silent,!!n.async);if(this.defaults.async===!0&&s.async===!1)return i(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 i(new Error("marked(): input parameter is undefined or null"));if(typeof e!="string")return i(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected"));if(n.hooks&&(n.hooks.options=n,n.hooks.block=t),n.async)return(async()=>{let l=n.hooks?await n.hooks.preprocess(e):e,c=await(n.hooks?await n.hooks.provideLexer(t):t?R.lex:R.lexInline)(l,n),a=n.hooks?await n.hooks.processAllTokens(c):c;n.walkTokens&&await Promise.all(this.walkTokens(a,n.walkTokens));let h=await(n.hooks?await n.hooks.provideParser(t):t?A.parse:A.parseInline)(a,n);return n.hooks?await n.hooks.postprocess(h):h})().catch(i);try{n.hooks&&(e=n.hooks.preprocess(e));let l=(n.hooks?n.hooks.provideLexer(t):t?R.lex:R.lexInline)(e,n);n.hooks&&(l=n.hooks.processAllTokens(l)),n.walkTokens&&this.walkTokens(l,n.walkTokens);let c=(n.hooks?n.hooks.provideParser(t):t?A.parse:A.parseInline)(l,n);return n.hooks&&(c=n.hooks.postprocess(c)),c}catch(l){return i(l)}}}onError(t,e){return r=>{if(r.message+=`
Please report this to https://github.com/markedjs/marked.`,t){let s="<p>An error occurred:</p><pre>"+y(r.message+"",!0)+"</pre>";return e?Promise.resolve(s):s}if(e)return Promise.reject(r);throw r}}},I=new ve;function x(t,e){return I.parse(t,e)}x.options=x.setOptions=function(t){return I.setOptions(t),x.defaults=I.defaults,Ae(x.defaults),x};x.getDefaults=J;x.defaults=_;function Ze(...t){return I.use(...t),x.defaults=I.defaults,Ae(x.defaults),x}x.use=Ze;x.walkTokens=function(t,e){return I.walkTokens(t,e)};x.parseInline=I.parseInline;x.Parser=A;x.parser=A.parse;x.Renderer=Q;x.TextRenderer=K;x.Lexer=R;x.lexer=R.lex;x.Tokenizer=O;x.Hooks=B;x.parse=x;var Ut=x.options,Wt=x.setOptions,Jt=x.walkTokens,Kt=x.parseInline,Vt=x,Yt=A.parse,er=R.lex;return Ge(tr);})();