2 lines
33 KiB
JavaScript
2 lines
33 KiB
JavaScript
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).RevealMarkdown=t()}(this,(function(){"use strict";function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(t)}function t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function r(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),e}function s(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}var a=function(e,t){return e(t={exports:{}},t.exports),t.exports}((function(e){function t(){return{baseUrl:null,breaks:!1,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartLists:!1,smartypants:!1,xhtml:!1}}e.exports={defaults:{baseUrl:null,breaks:!1,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartLists:!1,smartypants:!1,xhtml:!1},getDefaults:t,changeDefaults:function(t){e.exports.defaults=t}}})),l=(a.defaults,a.getDefaults,a.changeDefaults,/[&<>"']/),o=/[&<>"']/g,c=/[<>"']|&(?!#?\w+;)/,u=/[<>"']|&(?!#?\w+;)/g,h={"&":"&","<":"<",">":">",'"':""","'":"'"},p=function(e){return h[e]};var g=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi;function f(e){return e.replace(g,(function(e,t){return"colon"===(t=t.toLowerCase())?":":"#"===t.charAt(0)?"x"===t.charAt(1)?String.fromCharCode(parseInt(t.substring(2),16)):String.fromCharCode(+t.substring(1)):""}))}var d=/(^|[^\[])\^/g;var b=/[^\w:]/g,k=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;var m={},x=/^[^:]+:\/*[^/]*$/,y=/^([^:]+:)[\s\S]*$/,v=/^([^:]+:\/*[^/]*)[\s\S]*$/;function w(e,t){m[" "+e]||(x.test(e)?m[" "+e]=e+"/":m[" "+e]=_(e,"/",!0));var n=-1===(e=m[" "+e]).indexOf(":");return"//"===t.substring(0,2)?n?t:e.replace(y,"$1")+t:"/"===t.charAt(0)?n?t:e.replace(v,"$1")+t:e+t}function _(e,t,n){var r=e.length;if(0===r)return"";for(var s=0;s<r;){var i=e.charAt(r-s-1);if(i!==t||n){if(i===t||!n)break;s++}else s++}return e.substr(0,r-s)}var S=function(e,t){if(t){if(l.test(e))return e.replace(o,p)}else if(c.test(e))return e.replace(u,p);return e},A=f,$=function(e,t,n){if(e){var r;try{r=decodeURIComponent(f(n)).replace(b,"").toLowerCase()}catch(e){return null}if(0===r.indexOf("javascript:")||0===r.indexOf("vbscript:")||0===r.indexOf("data:"))return null}t&&!k.test(n)&&(n=w(t,n));try{n=encodeURI(n).replace(/%25/g,"%")}catch(e){return null}return n},R=function(e){for(var t,n,r=1;r<arguments.length;r++)for(n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},z=function(e,t){var n=e.replace(/\|/g,(function(e,t,n){for(var r=!1,s=t;--s>=0&&"\\"===n[s];)r=!r;return r?"|":" |"})).split(/ \|/),r=0;if(n.length>t)n.splice(t);else for(;n.length<t;)n.push("");for(;r<n.length;r++)n[r]=n[r].trim().replace(/\\\|/g,"|");return n},T=_,O=function(e,t){if(-1===e.indexOf(t[1]))return-1;for(var n=e.length,r=0,s=0;s<n;s++)if("\\"===e[s])s++;else if(e[s]===t[0])r++;else if(e[s]===t[1]&&--r<0)return s;return-1},E=function(e){e&&e.sanitize&&!e.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")},P={exec:function(){}},L=function(e,t){e=e.source||e,t=t||"";var n={replace:function(t,r){return r=(r=r.source||r).replace(d,"$1"),e=e.replace(t,r),n},getRegex:function(){return new RegExp(e,t)}};return n},q=R,C={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*\n)|~{3,})([^\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?:\n+|$)|$)/,hr:/^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6}) +([^\n]*?)(?: +#+)? *(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3})(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:"^ {0,3}(?:<(script|pre|style)[\\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{2,}|$)|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$)|</(?!script|pre|style)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$))",def:/^ {0,3}\[(label)\]: *\n? *<?([^\s>]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,nptable:P,table:P,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/,_label:/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,_title:/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/};C.def=L(C.def).replace("label",C._label).replace("title",C._title).getRegex(),C.bullet=/(?:[*+-]|\d{1,9}\.)/,C.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,C.item=L(C.item,"gm").replace(/bull/g,C.bullet).getRegex(),C.list=L(C.list).replace(/bull/g,C.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+C.def.source+")").getRegex(),C._tag="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|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",C._comment=/<!--(?!-?>)[\s\S]*?-->/,C.html=L(C.html,"i").replace("comment",C._comment).replace("tag",C._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),C.paragraph=L(C._paragraph).replace("hr",C.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").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|!--)").replace("tag",C._tag).getRegex(),C.blockquote=L(C.blockquote).replace("paragraph",C.paragraph).getRegex(),C.normal=q({},C),C.gfm=q({},C.normal,{nptable:"^ *([^|\\n ].*\\|.*)\\n *([-:]+ *\\|[-| :]*)(?:\\n((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)",table:"^ *\\|(.+)\\n *\\|?( *[-:]+[-| :]*)(?:\\n *((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"}),C.gfm.nptable=L(C.gfm.nptable).replace("hr",C.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",C._tag).getRegex(),C.gfm.table=L(C.gfm.table).replace("hr",C.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",C._tag).getRegex(),C.pedantic=q({},C.normal,{html:L("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:\"[^\"]*\"|'[^']*'|\\s[^'\"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",C._comment).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]+?) *(?:#+ *)?(?:\n+|$)/,fences:P,paragraph:L(C.normal._paragraph).replace("hr",C.hr).replace("heading"," *#{1,6} *[^\n]").replace("lheading",C.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var I={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:P,tag:"^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>",link:/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(?!\s*\])((?:\\[\[\]]?|[^\[\]\\])+)\]/,nolink:/^!?\[(?!\s*\])((?:\[[^\[\]]*\]|\\[\[\]]|[^\[\]])*)\](?:\[\])?/,strong:/^__([^\s_])__(?!_)|^\*\*([^\s*])\*\*(?!\*)|^__([^\s][\s\S]*?[^\s])__(?!_)|^\*\*([^\s][\s\S]*?[^\s])\*\*(?!\*)/,em:/^_([^\s_])_(?!_)|^_([^\s_<][\s\S]*?[^\s_])_(?!_|[^\spunctuation])|^_([^\s_<][\s\S]*?[^\s])_(?!_|[^\spunctuation])|^\*([^\s*<\[])\*(?!\*)|^\*([^\s<"][\s\S]*?[^\s\[\*])\*(?![\]`punctuation])|^\*([^\s*"<\[][\s\S]*[^\s])\*(?!\*)/,code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:P,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/,_punctuation:"!\"#$%&'()*+\\-./:;<=>?@\\[^_{|}~"};I.em=L(I.em).replace(/punctuation/g,I._punctuation).getRegex(),I._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,I._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,I._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])?)+(?![-_])/,I.autolink=L(I.autolink).replace("scheme",I._scheme).replace("email",I._email).getRegex(),I._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,I.tag=L(I.tag).replace("comment",C._comment).replace("attribute",I._attribute).getRegex(),I._label=/(?:\[[^\[\]]*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,I._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,I._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,I.link=L(I.link).replace("label",I._label).replace("href",I._href).replace("title",I._title).getRegex(),I.reflink=L(I.reflink).replace("label",I._label).getRegex(),I.normal=q({},I),I.pedantic=q({},I.normal,{strong:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,em:/^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/,link:L(/^!?\[(label)\]\((.*?)\)/).replace("label",I._label).getRegex(),reflink:L(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",I._label).getRegex()}),I.gfm=q({},I.normal,{escape:L(I.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/,del:/^~+(?=\S)([\s\S]*?\S)~+/,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*~]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))|(?= {2,}\n|[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))/}),I.gfm.url=L(I.gfm.url,"i").replace("email",I.gfm._extended_email).getRegex(),I.breaks=q({},I.gfm,{br:L(I.br).replace("{2,}","*").getRegex(),text:L(I.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var Z={block:C,inline:I},j=a.defaults,D=Z.block,N=Z.inline,M=T,H=z,B=S,U=O,F=function(){function e(n){t(this,e),this.tokens=[],this.tokens.links=Object.create(null),this.options=n||j,this.rules={block:D.normal,inline:N.normal},this.options.pedantic?(this.rules.block=D.pedantic,this.rules.inline=N.pedantic):this.options.gfm&&(this.rules.block=D.gfm,this.options.breaks?this.rules.inline=N.breaks:this.rules.inline=N.gfm)}return r(e,[{key:"lex",value:function(e){return e=e.replace(/\r\n|\r/g,"\n").replace(/\t/g," "),this.blockTokens(e,this.tokens),this.inline(this.tokens),this.tokens}},{key:"blockTokens",value:function(e,t){var n,r,s,i,a,l,o,c,u,h,p,g,f,d,b,k,m,x=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];for(e=e.replace(/^ +$/gm,"");e;)if((s=this.rules.block.newline.exec(e))&&(e=e.substring(s[0].length),m=s[0],s[0].length>1&&t.push({type:"space",raw:m})),s=this.rules.block.code.exec(e))b=t[t.length-1],e=e.substring(s[0].length),m=s[0],b&&"paragraph"===b.type?(b.text+="\n"+s[0].trimRight(),b.raw+="\n"+m):(s=s[0].replace(/^ {4}/gm,""),t.push({type:"code",raw:m,codeBlockStyle:"indented",text:this.options.pedantic?s:M(s,"\n")}));else if(s=this.rules.block.fences.exec(e))e=e.substring(s[0].length),m=s[0],t.push({type:"code",raw:m,lang:s[2]?s[2].trim():s[2],text:s[3]||""});else if(s=this.rules.block.heading.exec(e))e=e.substring(s[0].length),m=s[0],t.push({type:"heading",raw:m,depth:s[1].length,text:s[2]});else if((s=this.rules.block.nptable.exec(e))&&(l={type:"table",header:H(s[1].replace(/^ *| *\| *$/g,"")),align:s[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:s[3]?s[3].replace(/\n$/,"").split("\n"):[]}).header.length===l.align.length){for(e=e.substring(s[0].length),m=s[0],l.raw=m,p=l.align.length,u=0;u<p;u++)/^ *-+: *$/.test(l.align[u])?l.align[u]="right":/^ *:-+: *$/.test(l.align[u])?l.align[u]="center":/^ *:-+ *$/.test(l.align[u])?l.align[u]="left":l.align[u]=null;for(p=l.cells.length,u=0;u<p;u++)l.cells[u]=H(l.cells[u],l.header.length);t.push(l)}else if(s=this.rules.block.hr.exec(e))e=e.substring(s[0].length),m=s[0],t.push({type:"hr",raw:m});else if(s=this.rules.block.blockquote.exec(e))e=e.substring(s[0].length),m=s[0],s=s[0].replace(/^ *> ?/gm,""),t.push({type:"blockquote",raw:m,tokens:this.blockTokens(s,[],x)});else if(s=this.rules.block.list.exec(e))for(e=e.substring(s[0].length),o={type:"list",raw:m=s[0],ordered:g=(i=s[2]).length>1,start:g?+i:"",loose:!1,items:[]},t.push(o),n=!1,p=(s=s[0].match(this.rules.block.item)).length,u=0;u<p;u++)m=(l=s[u]).trim(),c=l.length,~(l=l.replace(/^ *([*+-]|\d+\.) */,"")).indexOf("\n ")&&(c-=l.length,l=this.options.pedantic?l.replace(/^ {1,4}/gm,""):l.replace(new RegExp("^ {1,"+c+"}","gm"),"")),u!==p-1&&(a=D.bullet.exec(s[u+1])[0],(i.length>1?1===a.length:a.length>1||this.options.smartLists&&a!==i)&&(e=(k=s.slice(u+1).join("\n"))+e,o.raw=o.raw.substring(o.raw.length-k.length),u=p-1)),r=n||/\n\n(?!\s*$)/.test(l),u!==p-1&&(n="\n"===l.charAt(l.length-1),r||(r=n)),r&&(o.loose=!0),d=void 0,(f=/^\[[ xX]\] /.test(l))&&(d=" "!==l[1],l=l.replace(/^\[[ xX]\] +/,"")),o.items.push({raw:m,task:f,checked:d,loose:r,tokens:this.blockTokens(l,[],!1)});else if(s=this.rules.block.html.exec(e))e=e.substring(s[0].length),m=s[0],t.push({type:this.options.sanitize?"paragraph":"html",raw:m,pre:!this.options.sanitizer&&("pre"===s[1]||"script"===s[1]||"style"===s[1]),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(s[0]):B(s[0]):s[0]});else if(x&&(s=this.rules.block.def.exec(e)))e=e.substring(s[0].length),s[3]&&(s[3]=s[3].substring(1,s[3].length-1)),h=s[1].toLowerCase().replace(/\s+/g," "),this.tokens.links[h]||(this.tokens.links[h]={href:s[2],title:s[3]});else if((s=this.rules.block.table.exec(e))&&(l={type:"table",header:H(s[1].replace(/^ *| *\| *$/g,"")),align:s[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:s[3]?s[3].replace(/\n$/,"").split("\n"):[]}).header.length===l.align.length){for(e=e.substring(s[0].length),l.raw=s[0],p=l.align.length,u=0;u<p;u++)/^ *-+: *$/.test(l.align[u])?l.align[u]="right":/^ *:-+: *$/.test(l.align[u])?l.align[u]="center":/^ *:-+ *$/.test(l.align[u])?l.align[u]="left":l.align[u]=null;for(p=l.cells.length,u=0;u<p;u++)l.cells[u]=H(l.cells[u].replace(/^ *\| *| *\| *$/g,""),l.header.length);t.push(l)}else if(s=this.rules.block.lheading.exec(e))e=e.substring(s[0].length),m=s[0],t.push({type:"heading",raw:m,depth:"="===s[2].charAt(0)?1:2,text:s[1]});else if(x&&(s=this.rules.block.paragraph.exec(e)))e=e.substring(s[0].length),m=s[0],t.push({type:"paragraph",raw:m,text:"\n"===s[1].charAt(s[1].length-1)?s[1].slice(0,-1):s[1]});else if(s=this.rules.block.text.exec(e))e=e.substring(s[0].length),m=s[0],t.push({type:"text",raw:m,text:s[0]});else if(e){var y="Infinite loop on byte: "+e.charCodeAt(0);if(!this.options.silent)throw new Error(y);console.error(y)}return t}},{key:"inline",value:function(e){var t,n,r,s,i,a,l=e.length;for(t=0;t<l;t++)switch((a=e[t]).type){case"paragraph":case"text":case"heading":a.tokens=[],this.inlineTokens(a.text,a.tokens);break;case"table":for(a.tokens={header:[],cells:[]},s=a.header.length,n=0;n<s;n++)a.tokens.header[n]=[],this.inlineTokens(a.header[n],a.tokens.header[n]);for(s=a.cells.length,n=0;n<s;n++)for(i=a.cells[n],a.tokens.cells[n]=[],r=0;r<i.length;r++)a.tokens.cells[n][r]=[],this.inlineTokens(i[r],a.tokens.cells[n][r]);break;case"blockquote":this.inline(a.tokens);break;case"list":for(s=a.items.length,n=0;n<s;n++)this.inline(a.items[n].tokens)}return e}},{key:"inlineTokens",value:function(e,t){for(var n,r,s,i,a,l,o,c,u,h,p="";e;)if(l=this.rules.inline.escape.exec(e))e=e.substring(l[0].length),h=l[0],p+=r=B(l[1]),t.push({type:"escape",raw:h,text:r});else if(l=this.rules.inline.tag.exec(e))!this.inLink&&/^<a /i.test(l[0])?this.inLink=!0:this.inLink&&/^<\/a>/i.test(l[0])&&(this.inLink=!1),!this.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(l[0])?this.inRawBlock=!0:this.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(l[0])&&(this.inRawBlock=!1),e=e.substring(l[0].length),h=l[0],r=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(l[0]):B(l[0]):l[0],t.push({type:this.options.sanitize?"text":"html",raw:h,text:r}),p+=r;else if(l=this.rules.inline.link.exec(e))(c=U(l[2],"()"))>-1&&(u=(0===l[0].indexOf("!")?5:4)+l[1].length+c,l[2]=l[2].substring(0,c),l[0]=l[0].substring(0,u).trim(),l[3]=""),e=e.substring(l[0].length),h=l[0],this.inLink=!0,i=l[2],this.options.pedantic?(n=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(i))?(i=n[1],a=n[3]):a="":a=l[3]?l[3].slice(1,-1):"",i=i.trim().replace(/^<([\s\S]*)>$/,"$1"),p+=this.outputLink(l,{href:this.escapes(i),title:this.escapes(a)},t,h),this.inLink=!1;else if((l=this.rules.inline.reflink.exec(e))||(l=this.rules.inline.nolink.exec(e))){if(e=e.substring(l[0].length),h=l[0],n=(l[2]||l[1]).replace(/\s+/g," "),!(n=this.tokens.links[n.toLowerCase()])||!n.href){p+=r=l[0].charAt(0),t.push({type:"text",raw:r,text:r}),e=l[0].substring(1)+e;continue}this.inLink=!0,p+=this.outputLink(l,n,t,h),this.inLink=!1}else if(l=this.rules.inline.strong.exec(e))e=e.substring(l[0].length),h=l[0],s=t?[]:null,r=this.inlineTokens(l[4]||l[3]||l[2]||l[1],s),t.push({type:"strong",raw:h,text:r,tokens:s}),p+=r;else if(l=this.rules.inline.em.exec(e))e=e.substring(l[0].length),h=l[0],s=t?[]:null,r=this.inlineTokens(l[6]||l[5]||l[4]||l[3]||l[2]||l[1],s),t.push({type:"em",raw:h,text:r,tokens:s}),p+=r;else if(l=this.rules.inline.code.exec(e))e=e.substring(l[0].length),h=l[0],r=B(l[2].trim(),!0),t.push({type:"codespan",raw:h,text:r}),p+=r;else if(l=this.rules.inline.br.exec(e))e=e.substring(l[0].length),h=l[0],t.push({type:"br",raw:h}),p+="\n";else if(l=this.rules.inline.del.exec(e))e=e.substring(l[0].length),h=l[0],s=t?[]:null,r=this.inlineTokens(l[1],s),t.push({type:"del",raw:h,text:r,tokens:s}),p+=r;else if(l=this.rules.inline.autolink.exec(e))e=e.substring(l[0].length),h=l[0],i="@"===l[2]?"mailto:"+(r=B(this.options.mangle?this.mangle(l[1]):l[1])):r=B(l[1]),t.push({type:"link",raw:h,text:r,href:i,tokens:[{type:"text",raw:r,text:r}]}),p+=r;else if(this.inLink||!(l=this.rules.inline.url.exec(e))){if(l=this.rules.inline.text.exec(e))e=e.substring(l[0].length),h=l[0],r=this.inRawBlock?this.options.sanitize?this.options.sanitizer?this.options.sanitizer(l[0]):B(l[0]):l[0]:B(this.options.smartypants?this.smartypants(l[0]):l[0]),t.push({type:"text",raw:h,text:r}),p+=r;else if(e){var g="Infinite loop on byte: "+e.charCodeAt(0);if(!this.options.silent)throw new Error(g);console.error(g)}}else{if("@"===l[2])i="mailto:"+(r=B(this.options.mangle?this.mangle(l[0]):l[0]));else{do{o=l[0],l[0]=this.rules.inline._backpedal.exec(l[0])[0]}while(o!==l[0]);r=B(l[0]),i="www."===l[1]?"http://"+r:r}e=e.substring(l[0].length),h=l[0],t.push({type:"link",raw:h,text:r,href:i,tokens:[{type:"text",raw:r,text:r}]}),p+=r}return p}},{key:"escapes",value:function(e){return e?e.replace(N._escapes,"$1"):e}},{key:"outputLink",value:function(e,t,n,r){var s=t.href,i=t.title?B(t.title):null,a=n?[]:null;if("!"!==e[0].charAt(0)){var l=this.inlineTokens(e[1],a);return n.push({type:"link",raw:r,text:l,href:s,title:i,tokens:a}),l}var o=B(e[1]);return n.push({type:"image",raw:r,text:o,href:s,title:i}),o}},{key:"smartypants",value:function(e){return e.replace(/---/g,"—").replace(/--/g,"–").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1‘").replace(/'/g,"’").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1“").replace(/"/g,"”").replace(/\.{3}/g,"…")}},{key:"mangle",value:function(e){var t,n,r="",s=e.length;for(t=0;t<s;t++)n=e.charCodeAt(t),Math.random()>.5&&(n="x"+n.toString(16)),r+="&#"+n+";";return r}}],[{key:"lex",value:function(t,n){return new e(n).lex(t)}},{key:"rules",get:function(){return{block:D,inline:N}}}]),e}(),V=a.defaults,X=$,G=S,J=function(){function e(n){t(this,e),this.options=n||V}return r(e,[{key:"code",value:function(e,t,n){var r=(t||"").match(/\S*/)[0];if(this.options.highlight){var s=this.options.highlight(e,r);null!=s&&s!==e&&(n=!0,e=s)}return r?'<pre><code class="'+this.options.langPrefix+G(r,!0)+'">'+(n?e:G(e,!0))+"</code></pre>\n":"<pre><code>"+(n?e:G(e,!0))+"</code></pre>"}},{key:"blockquote",value:function(e){return"<blockquote>\n"+e+"</blockquote>\n"}},{key:"html",value:function(e){return e}},{key:"heading",value:function(e,t,n,r){return this.options.headerIds?"<h"+t+' id="'+this.options.headerPrefix+r.slug(n)+'">'+e+"</h"+t+">\n":"<h"+t+">"+e+"</h"+t+">\n"}},{key:"hr",value:function(){return this.options.xhtml?"<hr/>\n":"<hr>\n"}},{key:"list",value:function(e,t,n){var r=t?"ol":"ul";return"<"+r+(t&&1!==n?' start="'+n+'"':"")+">\n"+e+"</"+r+">\n"}},{key:"listitem",value:function(e){return"<li>"+e+"</li>\n"}},{key:"checkbox",value:function(e){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "}},{key:"paragraph",value:function(e){return"<p>"+e+"</p>\n"}},{key:"table",value:function(e,t){return t&&(t="<tbody>"+t+"</tbody>"),"<table>\n<thead>\n"+e+"</thead>\n"+t+"</table>\n"}},{key:"tablerow",value:function(e){return"<tr>\n"+e+"</tr>\n"}},{key:"tablecell",value:function(e,t){var n=t.header?"th":"td";return(t.align?"<"+n+' align="'+t.align+'">':"<"+n+">")+e+"</"+n+">\n"}},{key:"strong",value:function(e){return"<strong>"+e+"</strong>"}},{key:"em",value:function(e){return"<em>"+e+"</em>"}},{key:"codespan",value:function(e){return"<code>"+e+"</code>"}},{key:"br",value:function(){return this.options.xhtml?"<br/>":"<br>"}},{key:"del",value:function(e){return"<del>"+e+"</del>"}},{key:"link",value:function(e,t,n){if(null===(e=X(this.options.sanitize,this.options.baseUrl,e)))return n;var r='<a href="'+G(e)+'"';return t&&(r+=' title="'+t+'"'),r+=">"+n+"</a>"}},{key:"image",value:function(e,t,n){if(null===(e=X(this.options.sanitize,this.options.baseUrl,e)))return n;var r='<img src="'+e+'" alt="'+n+'"';return t&&(r+=' title="'+t+'"'),r+=this.options.xhtml?"/>":">"}},{key:"text",value:function(e){return e}}]),e}(),K=function(){function e(){t(this,e)}return r(e,[{key:"strong",value:function(e){return e}},{key:"em",value:function(e){return e}},{key:"codespan",value:function(e){return e}},{key:"del",value:function(e){return e}},{key:"html",value:function(e){return e}},{key:"text",value:function(e){return e}},{key:"link",value:function(e,t,n){return""+n}},{key:"image",value:function(e,t,n){return""+n}},{key:"br",value:function(){return""}}]),e}(),Q=function(){function e(){t(this,e),this.seen={}}return r(e,[{key:"slug",value:function(e){var t=e.toLowerCase().trim().replace(/<[!\/a-z].*?>/gi,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(t)){var n=t;do{this.seen[n]++,t=n+"-"+this.seen[n]}while(this.seen.hasOwnProperty(t))}return this.seen[t]=0,t}}]),e}(),W=a.defaults,Y=A,ee=function(){function e(n){t(this,e),this.options=n||W,this.options.renderer=this.options.renderer||new J,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new K,this.slugger=new Q}return r(e,[{key:"parse",value:function(e){var t,n,r,s,i,a,l,o,c,u,h,p,g,f,d,b,k,m,x=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],y="",v=e.length;for(t=0;t<v;t++)switch((u=e[t]).type){case"space":continue;case"hr":y+=this.renderer.hr();continue;case"heading":y+=this.renderer.heading(this.parseInline(u.tokens),u.depth,Y(this.parseInline(u.tokens,this.textRenderer)),this.slugger);continue;case"code":y+=this.renderer.code(u.text,u.lang,u.escaped);continue;case"table":for(o="",l="",s=u.header.length,n=0;n<s;n++)l+=this.renderer.tablecell(this.parseInline(u.tokens.header[n]),{header:!0,align:u.align[n]});for(o+=this.renderer.tablerow(l),c="",s=u.cells.length,n=0;n<s;n++){for(l="",i=(a=u.tokens.cells[n]).length,r=0;r<i;r++)l+=this.renderer.tablecell(this.parseInline(a[r]),{header:!1,align:u.align[r]});c+=this.renderer.tablerow(l)}y+=this.renderer.table(o,c);continue;case"blockquote":c=this.parse(u.tokens),y+=this.renderer.blockquote(c);continue;case"list":for(h=u.ordered,p=u.start,g=u.loose,s=u.items.length,c="",n=0;n<s;n++)b=(d=u.items[n]).checked,k=d.task,f="",d.task&&(m=this.renderer.checkbox(b),g?"text"===d.tokens[0].type?(d.tokens[0].text=m+" "+d.tokens[0].text,d.tokens[0].tokens&&d.tokens[0].tokens.length>0&&"text"===d.tokens[0].tokens[0].type&&(d.tokens[0].tokens[0].text=m+" "+d.tokens[0].tokens[0].text)):d.tokens.unshift({type:"text",text:m}):f+=m),f+=this.parse(d.tokens,g),c+=this.renderer.listitem(f,k,b);y+=this.renderer.list(c,h,p);continue;case"html":y+=this.renderer.html(u.text);continue;case"paragraph":y+=this.renderer.paragraph(this.parseInline(u.tokens));continue;case"text":for(c=u.tokens?this.parseInline(u.tokens):u.text;t+1<v&&"text"===e[t+1].type;)c+="\n"+((u=e[++t]).tokens?this.parseInline(u.tokens):u.text);y+=x?this.renderer.paragraph(c):c;continue;default:var w='Token with "'+u.type+'" type was not found.';if(this.options.silent)return void console.error(w);throw new Error(w)}return y}},{key:"parseInline",value:function(e,t){t=t||this.renderer;var n,r,s="",i=e.length;for(n=0;n<i;n++)switch((r=e[n]).type){case"escape":s+=t.text(r.text);break;case"html":s+=t.html(r.text);break;case"link":s+=t.link(r.href,r.title,this.parseInline(r.tokens,t));break;case"image":s+=t.image(r.href,r.title,r.text);break;case"strong":s+=t.strong(this.parseInline(r.tokens,t));break;case"em":s+=t.em(this.parseInline(r.tokens,t));break;case"codespan":s+=t.codespan(r.text);break;case"br":s+=t.br();break;case"del":s+=t.del(this.parseInline(r.tokens,t));break;case"text":s+=t.text(r.text);break;default:var a='Token with "'+r.type+'" type was not found.';if(this.options.silent)return void console.error(a);throw new Error(a)}return s}}],[{key:"parse",value:function(t,n){return new e(n).parse(t)}}]),e}(),te=R,ne=E,re=S,se=a.getDefaults,ie=a.changeDefaults,ae=a.defaults;function le(t,n,r){if(null==t)throw new Error("marked(): input parameter is undefined or null");if("string"!=typeof t)throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected");if(r||"function"==typeof n){var s=function(){r||(r=n,n=null),n=te({},le.defaults,n||{}),ne(n);var e,s,i=n.highlight,a=0;try{e=F.lex(t,n)}catch(e){return{v:r(e)}}s=e.length;var l=function(t){if(t)return n.highlight=i,r(t);var s;try{s=ee.parse(e,n)}catch(e){t=e}return n.highlight=i,t?r(t):r(null,s)};if(!i||i.length<3)return{v:l()};if(delete n.highlight,!s)return{v:l()};for(;a<e.length;a++)!function(e){"code"!==e.type?--s||l():i(e.text,e.lang,(function(t,n){return t?l(t):null==n||n===e.text?--s||l():(e.text=n,e.escaped=!0,void(--s||l()))}))}(e[a]);return{v:void 0}}();if("object"===e(s))return s.v}try{return n=te({},le.defaults,n||{}),ne(n),ee.parse(F.lex(t,n),n)}catch(e){if(e.message+="\nPlease report this to https://github.com/markedjs/marked.",(n||le.defaults).silent)return"<p>An error occurred:</p><pre>"+re(e.message+"",!0)+"</pre>";throw e}}le.options=le.setOptions=function(e){return te(le.defaults,e),ie(le.defaults),le},le.getDefaults=se,le.defaults=ae,le.Parser=ee,le.parser=ee.parse,le.Renderer=J,le.TextRenderer=K,le.Lexer=F,le.lexer=F.lex,le.Slugger=Q,le.parse=le;var oe=le,ce=/\[([\s\d,|-]*)\]/;return function(){var e;function t(e){var t=(e.querySelector("[data-template]")||e.querySelector("script")||e).textContent,n=(t=t.replace(new RegExp("__SCRIPT_END__","g"),"<\/script>")).match(/^\n?(\s*)/)[1].length,r=t.match(/^\n?(\t*)/)[1].length;return r>0?t=t.replace(new RegExp("\\n?\\t{"+r+"}","g"),"\n"):n>1&&(t=t.replace(new RegExp("\\n? {"+n+"}","g"),"\n")),t}function n(e){for(var t=e.attributes,n=[],r=0,s=t.length;r<s;r++){var i=t[r].name,a=t[r].value;/data\-(markdown|separator|vertical|notes)/gi.test(i)||(a?n.push(i+'="'+a+'"'):n.push(i))}return n.join(" ")}function r(e){return(e=e||{}).separator=e.separator||"^\r?\n---\r?\n$",e.notesSeparator=e.notesSeparator||"notes?:",e.attributes=e.attributes||"",e}function a(e,t){t=r(t);var n=e.split(new RegExp(t.notesSeparator,"mgi"));return 2===n.length&&(e=n[0]+'<aside class="notes">'+oe(n[1].trim())+"</aside>"),'<script type="text/template">'+(e=e.replace(/<\/script>/g,"__SCRIPT_END__"))+"<\/script>"}function l(e,t){t=r(t);for(var n,s,i,l=new RegExp(t.separator+(t.verticalSeparator?"|"+t.verticalSeparator:""),"mg"),o=new RegExp(t.separator),c=0,u=!0,h=[];n=l.exec(e);)!(s=o.test(n[0]))&&u&&h.push([]),i=e.substring(c,n.index),s&&u?h.push(i):h[h.length-1].push(i),c=l.lastIndex,u=s;(u?h:h[h.length-1]).push(e.substring(c));for(var p="",g=0,f=h.length;g<f;g++)h[g]instanceof Array?(p+="<section "+t.attributes+">",h[g].forEach((function(e){p+="<section data-markdown>"+a(e,t)+"</section>"})),p+="</section>"):p+="<section "+t.attributes+" data-markdown>"+a(h[g],t)+"</section>";return p}function o(e){return new Promise((function(r){var s=[];[].slice.call(e.querySelectorAll("[data-markdown]:not([data-markdown-parsed])")).forEach((function(e,r){e.getAttribute("data-markdown").length?s.push(function(e){return new Promise((function(t,n){var r=new XMLHttpRequest,s=e.getAttribute("data-markdown"),i=e.getAttribute("data-charset");null!=i&&""!=i&&r.overrideMimeType("text/html; charset="+i),r.onreadystatechange=function(e,r){4===r.readyState&&(r.status>=200&&r.status<300||0===r.status?t(r,s):n(r,s))}.bind(this,e,r),r.open("GET",s,!0);try{r.send()}catch(e){console.warn("Failed to get the Markdown file "+s+". Make sure that the presentation and the file are served by a HTTP server and the file can be found there. "+e),t(r,s)}}))}(e).then((function(t,r){e.outerHTML=l(t.responseText,{separator:e.getAttribute("data-separator"),verticalSeparator:e.getAttribute("data-separator-vertical"),notesSeparator:e.getAttribute("data-separator-notes"),attributes:n(e)})}),(function(t,n){e.outerHTML='<section data-state="alert">ERROR: The attempt to fetch '+n+" failed with HTTP status "+t.status+".Check your browser's JavaScript console for more details.<p>Remember that you need to serve the presentation HTML from a HTTP server.</p></section>"}))):e.getAttribute("data-separator")||e.getAttribute("data-separator-vertical")||e.getAttribute("data-separator-notes")?e.outerHTML=l(t(e),{separator:e.getAttribute("data-separator"),verticalSeparator:e.getAttribute("data-separator-vertical"),notesSeparator:e.getAttribute("data-separator-notes"),attributes:n(e)}):e.innerHTML=a(t(e))})),Promise.all(s).then(r)}))}function c(e,t,n){var r,s,i=new RegExp(n,"mg"),a=new RegExp('([^"= ]+?)="([^"]+?)"|(data-[^"= ]+?)(?=[" ])',"mg"),l=e.nodeValue;if(r=i.exec(l)){var o=r[1];for(l=l.substring(0,r.index)+l.substring(i.lastIndex),e.nodeValue=l;s=a.exec(o);)s[2]?t.setAttribute(s[1],s[2]):t.setAttribute(s[3],"");return!0}return!1}function u(){var n=e.getRevealElement().querySelectorAll("[data-markdown]:not([data-markdown-parsed])");return[].slice.call(n).forEach((function(e){e.setAttribute("data-markdown-parsed",!0);var n=e.querySelector("aside.notes"),r=t(e);e.innerHTML=oe(r),function e(t,n,r,s,i){if(null!=n&&null!=n.childNodes&&n.childNodes.length>0)for(var a=n,l=0;l<n.childNodes.length;l++){var o=n.childNodes[l];if(l>0)for(var u=l-1;u>=0;){var h=n.childNodes[u];if("function"==typeof h.setAttribute&&"BR"!=h.tagName){a=h;break}u-=1}var p=t;"section"==o.nodeName&&(p=o,a=o),"function"!=typeof o.setAttribute&&o.nodeType!=Node.COMMENT_NODE||e(p,o,a,s,i)}n.nodeType==Node.COMMENT_NODE&&0==c(n,r,s)&&c(n,t,i)}(e,e,null,e.getAttribute("data-element-attributes")||e.parentNode.getAttribute("data-element-attributes")||"\\.element\\s*?(.+?)$",e.getAttribute("data-attributes")||e.parentNode.getAttribute("data-attributes")||"\\.slide:\\s*?(\\S.+?)$"),n&&e.appendChild(n)})),Promise.resolve()}return{id:"markdown",init:function(t){e=t;var n=new oe.Renderer;return n.code=function(e,t){var n="";return ce.test(t)&&(n=t.match(ce)[1].trim(),n='data-line-numbers="'.concat(n,'"'),t=t.replace(ce,"").trim()),"<pre><code ".concat(n,' class="').concat(t,'">').concat(e,"</code></pre>")},oe.setOptions(function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach((function(t){s(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({renderer:n},e.getConfig().markdown)),o(e.getRevealElement()).then(u)},processSlides:o,convertSlides:u,slidify:l,marked:oe}}}));
|