(function(){var d={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:l,hr:/^( *[-*_]){3,} *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *#* *(?:\n+|$)/,nptable:l,lheading:/^([^\n]+)\n *(=|-){2,} *(?:\n+|$)/,blockquote:/^( *>[^\n]+(\n(?!def)[^\n]+)*\n*)+/,list:/^( *)(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:/^ *(?:comment|closed|closing) *(?:\n{2,}|\s*$)/,def:/^ *\[([^\]]+)\]: *]+)>?(?: +["(]([^\n]+)[")])? *(?:\n+|$)/,table:l,paragraph:/^((?:[^\n]+\n?(?!hr|heading|lheading|blockquote|tag|def))+)\n*/,text:/^[^\n]+/};d.bullet=/(?:[*+-]|\d+\.)/;d.item=/^( *)(bull) [^\n]*(?:\n(?!\1bull )[^\n]*)*/;d.item=c(d.item,"gm")(/bull/g,d.bullet)();d.list=c(d.list)(/bull/g,d.bullet)("hr","\\n+(?=\\1?(?:[-*_] *){3,}(?:\\n+|$))")("def","\\n+(?="+d.def.source+")")();d.blockquote=c(d.blockquote)("def",d.def)();d._tag="(?!(?: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";d.html=c(d.html)("comment",//)("closed",/<(tag)[\s\S]+?<\/\1>/)("closing",/])*?>/)(/tag/g,d._tag)();d.paragraph=c(d.paragraph)("hr",d.hr)("heading",d.heading)("lheading",d.lheading)("blockquote",d.blockquote)("tag","<"+d._tag)("def",d.def)();d.normal=i({},d);d.gfm=i({},d.normal,{fences:/^ *(`{3,}|~{3,}) *(\S+)? *\n([\s\S]+?)\s*\1 *(?:\n+|$)/,paragraph:/^/});d.gfm.paragraph=c(d.paragraph)("(?!","(?!"+d.gfm.fences.source.replace("\\1","\\2")+"|"+d.list.source.replace("\\1","\\3")+"|")();d.tables=i({},d.gfm,{nptable:/^ *(\S.*\|.*)\n *([-:]+ *\|[-| :]*)\n((?:.*\|.*(?:\n|$))*)\n*/,table:/^ *\|(.+)\n *\|( *[-:]+[-| :]*)\n((?: *\|.*(?:\n|$))*)\n*/});function b(m){this.tokens=[];this.tokens.links={};this.options=m||a.defaults;this.rules=d.normal;if(this.options.gfm){if(this.options.tables){this.rules=d.tables}else{this.rules=d.gfm}}}b.rules=d;b.lex=function(o,m){var n=new b(m);return n.lex(o)};b.prototype.lex=function(m){m=m.replace(/\r\n|\r/g,"\n").replace(/\t/g," ").replace(/\u00a0/g," ").replace(/\u2424/g,"\n");return this.token(m,true)};b.prototype.token=function(n,t,x){var n=n.replace(/^ +$/gm,""),r,p,v,s,u,w,m,q,o;while(n){if(v=this.rules.newline.exec(n)){n=n.substring(v[0].length);if(v[0].length>1){this.tokens.push({type:"space"})}}if(v=this.rules.code.exec(n)){n=n.substring(v[0].length);v=v[0].replace(/^ {4}/gm,"");this.tokens.push({type:"code",text:!this.options.pedantic?v.replace(/\n+$/,""):v});continue}if(v=this.rules.fences.exec(n)){n=n.substring(v[0].length);this.tokens.push({type:"code",lang:v[2],text:v[3]});continue}if(v=this.rules.heading.exec(n)){n=n.substring(v[0].length);this.tokens.push({type:"heading",depth:v[1].length,text:v[2]});continue}if(t&&(v=this.rules.nptable.exec(n))){n=n.substring(v[0].length);w={type:"table",header:v[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:v[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:v[3].replace(/\n$/,"").split("\n")};for(q=0;q ?/gm,"");this.token(v,t,true);this.tokens.push({type:"blockquote_end"});continue}if(v=this.rules.list.exec(n)){n=n.substring(v[0].length);s=v[2];this.tokens.push({type:"list_start",ordered:s.length>1});v=v[0].match(this.rules.item);r=false;o=v.length;q=0;for(;q1&&u.length>1)){n=v.slice(q+1).join("\n")+n;q=o-1}}p=r||/\n\n(?!\s*$)/.test(w);if(q!==o-1){r=w.charAt(w.length-1)==="\n";if(!p){p=r}}this.tokens.push({type:p?"loose_item_start":"list_item_start"});this.token(w,false,x);this.tokens.push({type:"list_item_end"})}this.tokens.push({type:"list_end"});continue}if(v=this.rules.html.exec(n)){n=n.substring(v[0].length);this.tokens.push({type:this.options.sanitize?"paragraph":"html",pre:v[1]==="pre"||v[1]==="script"||v[1]==="style",text:v[0]});continue}if((!x&&t)&&(v=this.rules.def.exec(n))){n=n.substring(v[0].length);this.tokens.links[v[1].toLowerCase()]={href:v[2],title:v[3]};continue}if(t&&(v=this.rules.table.exec(n))){n=n.substring(v[0].length);w={type:"table",header:v[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:v[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:v[3].replace(/(?: *\| *)?\n$/,"").split("\n")};for(q=0;q])/,autolink:/^<([^ >]+(@|:\/)[^ >]+)>/,url:l,tag:/^|^<\/?\w+(?:"[^"]*"|'[^']*'|[^'">])*?>/,link:/^!?\[(inside)\]\(href\)/,reflink:/^!?\[(inside)\]\s*\[([^\]]*)\]/,nolink:/^!?\[((?:\[[^\]]*\]|[^\[\]])*)\]/,strong:/^__([\s\S]+?)__(?!_)|^\*\*([\s\S]+?)\*\*(?!\*)/,em:/^\b_((?:__|[\s\S])+?)_\b|^\*((?:\*\*|[\s\S])+?)\*(?!\*)/,code:/^(`+)\s*([\s\S]*?[^`])\s*\1(?!`)/,br:/^ {2,}\n(?!\s*$)/,del:l,text:/^[\s\S]+?(?=[\\?(?:\s+['"]([\s\S]*?)['"])?\s*/;h.link=c(h.link)("inside",h._inside)("href",h._href)();h.reflink=c(h.reflink)("inside",h._inside)();h.normal=i({},h);h.pedantic=i({},h.normal,{strong:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,em:/^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/});h.gfm=i({},h.normal,{escape:c(h.escape)("])","~|])")(),url:/^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/,del:/^~~(?=\S)([\s\S]*?\S)~~/,text:c(h.text)("]|","~]|")("|","|https?://|")()});h.breaks=i({},h.gfm,{br:c(h.br)("{2,}","*")(),text:c(h.gfm.text)("{2,}","*")()});function j(m,n){this.options=n||a.defaults;this.links=m;this.rules=h.normal;this.renderer=this.options.renderer||new f;this.renderer.options=this.options;if(!this.links){throw new Error("Tokens array requires a `links` property.")}if(this.options.gfm){if(this.options.breaks){this.rules=h.breaks}else{this.rules=h.gfm}}else{if(this.options.pedantic){this.rules=h.pedantic}}}j.rules=h;j.output=function(p,m,n){var o=new j(m,n);return o.output(p)};j.prototype.output=function(r){var n="",p,q,m,o;while(r){if(o=this.rules.escape.exec(r)){r=r.substring(o[0].length);n+=o[1];continue}if(o=this.rules.autolink.exec(r)){r=r.substring(o[0].length);if(o[2]==="@"){q=o[1].charAt(6)===":"?this.mangle(o[1].substring(7)):this.mangle(o[1]);m=this.mangle("mailto:")+q}else{q=k(o[1]);m=q}n+=this.renderer.link(m,null,q);continue}if(!this.inLink&&(o=this.rules.url.exec(r))){r=r.substring(o[0].length);q=k(o[1]);m=q;n+=this.renderer.link(m,null,q);continue}if(o=this.rules.tag.exec(r)){if(!this.inLink&&/^/i.test(o[0])){this.inLink=false}}r=r.substring(o[0].length);n+=this.options.sanitize?k(o[0]):o[0];continue}if(o=this.rules.link.exec(r)){r=r.substring(o[0].length);this.inLink=true;n+=this.outputLink(o,{href:o[2],title:o[3]});this.inLink=false;continue}if((o=this.rules.reflink.exec(r))||(o=this.rules.nolink.exec(r))){r=r.substring(o[0].length);p=(o[2]||o[1]).replace(/\s+/g," ");p=this.links[p.toLowerCase()];if(!p||!p.href){n+=o[0].charAt(0);r=o[0].substring(1)+r;continue}this.inLink=true;n+=this.outputLink(o,p);this.inLink=false;continue}if(o=this.rules.strong.exec(r)){r=r.substring(o[0].length);n+=this.renderer.strong(this.output(o[2]||o[1]));continue}if(o=this.rules.em.exec(r)){r=r.substring(o[0].length);n+=this.renderer.em(this.output(o[2]||o[1]));continue}if(o=this.rules.code.exec(r)){r=r.substring(o[0].length);n+=this.renderer.codespan(k(o[2],true));continue}if(o=this.rules.br.exec(r)){r=r.substring(o[0].length);n+=this.renderer.br();continue}if(o=this.rules.del.exec(r)){r=r.substring(o[0].length);n+=this.renderer.del(this.output(o[1]));continue}if(o=this.rules.text.exec(r)){r=r.substring(o[0].length);n+=k(this.smartypants(o[0]));continue}if(r){throw new Error("Infinite loop on byte: "+r.charCodeAt(0))}}return n};j.prototype.outputLink=function(n,o){var m=k(o.href),p=o.title?k(o.title):null;return n[0].charAt(0)!=="!"?this.renderer.link(m,p,this.output(n[1])):this.renderer.image(m,p,k(n[1]))};j.prototype.smartypants=function(m){if(!this.options.smartypants){return m}return m.replace(/--/g,"\u2014").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1\u2018").replace(/'/g,"\u2019").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1\u201c").replace(/"/g,"\u201d").replace(/\.{3}/g,"\u2026")};j.prototype.mangle=function(q){var n="",m=q.length,o=0,p;for(;o0.5){p="x"+p.toString(16)}n+="&#"+p+";"}return n};function f(m){this.options=m||{}}f.prototype.code=function(n,p,o){if(this.options.highlight){var m=this.options.highlight(n,p);if(m!=null&&m!==n){o=true;n=m}}if(!p){return"
"+(o?n:k(n,true))+"\n
"}return'
'+(o?n:k(n,true))+"\n
\n"};f.prototype.blockquote=function(m){return"
\n"+m+"
\n"};f.prototype.html=function(m){return m};f.prototype.heading=function(n,o,m){return"'+n+"\n"};f.prototype.hr=function(){return this.options.xhtml?"
\n":"
\n"};f.prototype.list=function(m,n){var o=n?"ol":"ul";return"<"+o+">\n"+m+"\n"};f.prototype.listitem=function(m){return"
  • "+m+"
  • \n"};f.prototype.paragraph=function(m){return"

    "+m+"

    \n"};f.prototype.table=function(n,m){return"\n\n"+n+"\n\n"+m+"\n
    \n"};f.prototype.tablerow=function(m){return"\n"+m+"\n"};f.prototype.tablecell=function(p,n){var o=n.header?"th":"td";var m=n.align?"<"+o+' style="text-align:'+n.align+'">':"<"+o+">";return m+p+"\n"};f.prototype.strong=function(m){return""+m+""};f.prototype.em=function(m){return""+m+""};f.prototype.codespan=function(m){return""+m+""};f.prototype.br=function(){return this.options.xhtml?"
    ":"
    "};f.prototype.del=function(m){return""+m+""};f.prototype.link=function(m,r,q){if(this.options.sanitize){try{var o=decodeURIComponent(g(m)).replace(/[^\w:]/g,"").toLowerCase()}catch(p){return""}if(o.indexOf("javascript:")===0){return""}}var n='
    ";return n};f.prototype.image=function(m,p,o){var n=''+o+'":">";return n};function e(m){this.tokens=[];this.token=null;this.options=m||a.defaults;this.options.renderer=this.options.renderer||new f;this.renderer=this.options.renderer;this.renderer.options=this.options}e.parse=function(o,m,n){var p=new e(m,n);return p.parse(o)};e.prototype.parse=function(n){this.inline=new j(n.links,this.options,this.renderer);this.tokens=n.reverse();var m="";while(this.next()){m+=this.tok()}return m};e.prototype.next=function(){return this.token=this.tokens.pop()};e.prototype.peek=function(){return this.tokens[this.tokens.length-1]||0};e.prototype.parseText=function(){var m=this.token.text;while(this.peek().type==="text"){m+="\n"+this.next().text}return this.inline.output(m)};e.prototype.tok=function(){switch(this.token.type){case"space":return"";case"hr":return this.renderer.hr();case"heading":return this.renderer.heading(this.inline.output(this.token.text),this.token.depth,this.token.text);case"code":return this.renderer.code(this.token.text,this.token.lang,this.token.escaped);case"table":var q="",s="",o,u,t,m,n;t="";for(o=0;o/g,">").replace(/"/g,""").replace(/'/g,"'")}function g(m){return m.replace(/&([#\w]+);/g,function(o,p){p=p.toLowerCase();if(p==="colon"){return":"}if(p.charAt(0)==="#"){return p.charAt(1)==="x"?String.fromCharCode(parseInt(p.substring(2),16)):String.fromCharCode(+p.substring(1))}return""})}function c(o,n){o=o.source;n=n||"";return function m(p,q){if(!p){return new RegExp(o,n)}q=q.source||q;q=q.replace(/(^|[^\[])\^/g,"$1");o=o.replace(p,q);return m}}function l(){}l.exec=l;function i(p){var n=1,o,m;for(;nAn error occured:

    "+k(s.message+"",true)+"
    "}throw s}}a.options=a.setOptions=function(m){i(a.defaults,m);return a};a.defaults={gfm:true,tables:true,breaks:false,pedantic:false,sanitize:false,smartLists:false,silent:false,highlight:null,langPrefix:"lang-",smartypants:false,headerPrefix:"",renderer:new f,xhtml:false};a.Parser=e;a.parser=e.parse;a.Renderer=f;a.Lexer=b;a.lexer=b.lex;a.InlineLexer=j;a.inlineLexer=j.output;a.parse=a;if(typeof exports==="object"){module.exports=a}else{if(typeof define==="function"&&define.amd){define(function(){return a})}else{this.marked=a}}}).call(function(){return this||(typeof window!=="undefined"?window:global)}());