mirror of
https://gitee.com/docsifyjs/docsify.git
synced 2024-12-02 03:59:19 +08:00
2 lines
28 KiB
JavaScript
2 lines
28 KiB
JavaScript
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.Docsify=t()}(this,function(){"use strict";function e(e,t){return t={exports:{}},e(t,t.exports),t.exports}function t(){function e(){for(var e=0,t=n.length;e<t;e+=1){var i=n[e].parentNode,a=i.getBoundingClientRect();if(a.top<150&&a.bottom>150){var o=r[i.id];if(o===s)return;return s&&s.classList.remove("active"),o.classList.add("active"),void(s=o)}}}function t(){var e=window.location.hash.slice(1);if(e){var t=document.querySelector("#"+e);t&&t.scrollIntoView()}}if(!/mobile/i.test(navigator.userAgent)){for(var n=document.querySelectorAll(".anchor"),r={},i=document.querySelectorAll(".sidebar li"),s=null,a=0,o=i.length;a<o;a+=1){var l=i[a],u=l.querySelector("a");r[u.getAttribute("href").slice(1)]=l}document.querySelector("main .content").addEventListener("scroll",e),e(),window.addEventListener("hashchange",t),t()}}var n=function(e,t){void 0===t&&(t={});var n=new XMLHttpRequest;return n.open(t.method||"get",e),n.send(),{then:function(e){return n.addEventListener("load",e)}}},r="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},i=e(function(e,t){(function(){function n(e){this.tokens=[],this.tokens.links={},this.options=e||p.defaults,this.rules=h.normal,this.options.gfm&&(this.options.tables?this.rules=h.tables:this.rules=h.gfm)}function r(e,t){if(this.options=t||p.defaults,this.links=e,this.rules=g.normal,this.renderer=this.options.renderer||new i,this.renderer.options=this.options,!this.links)throw new Error("Tokens array requires a `links` property.");this.options.gfm?this.options.breaks?this.rules=g.breaks:this.rules=g.gfm:this.options.pedantic&&(this.rules=g.pedantic)}function i(e){this.options=e||{}}function s(e){this.tokens=[],this.token=null,this.options=e||p.defaults,this.options.renderer=this.options.renderer||new i,this.renderer=this.options.renderer,this.renderer.options=this.options}function a(e,t){return e.replace(t?/&/g:/&(?!#?\w+;)/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function o(e){return e.replace(/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/g,function(e,t){return t=t.toLowerCase(),"colon"===t?":":"#"===t.charAt(0)?"x"===t.charAt(1)?String.fromCharCode(parseInt(t.substring(2),16)):String.fromCharCode(+t.substring(1)):""})}function l(e,t){return e=e.source,t=t||"",function n(r,i){return r?(i=i.source||i,i=i.replace(/(^|[^\[])\^/g,"$1"),e=e.replace(r,i),n):new RegExp(e,t)}}function u(){}function c(e){for(var t,n,r=arguments,i=1;i<arguments.length;i++){t=r[i];for(n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e}function p(e,t,r){if(r||"function"==typeof t){r||(r=t,t=null),t=c({},p.defaults,t||{});var i,o,l=t.highlight,u=0;try{i=n.lex(e,t)}catch(e){return r(e)}o=i.length;var h=function(e){if(e)return t.highlight=l,r(e);var n;try{n=s.parse(i,t)}catch(t){e=t}return t.highlight=l,e?r(e):r(null,n)};if(!l||l.length<3)return h();if(delete t.highlight,!o)return h();for(;u<i.length;u++)!function(e){return"code"!==e.type?--o||h():l(e.text,e.lang,function(t,n){return t?h(t):null==n||n===e.text?--o||h():(e.text=n,e.escaped=!0,void(--o||h()))})}(i[u])}else try{return t&&(t=c({},p.defaults,t)),s.parse(n.lex(e,t),t)}catch(e){if(e.message+="\nPlease report this to https://github.com/chjj/marked.",(t||p.defaults).silent)return"<p>An error occured:</p><pre>"+a(e.message+"",!0)+"</pre>";throw e}}var h={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:u,hr:/^( *[-*_]){3,} *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *#* *(?:\n+|$)/,nptable:u,lheading:/^([^\n]+)\n *(=|-){2,} *(?:\n+|$)/,blockquote:/^( *>[^\n]+(\n(?!def)[^\n]+)*\n*)+/,list:/^( *)(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:/^ *(?:comment *(?:\n|\s*$)|closed *(?:\n{2,}|\s*$)|closing *(?:\n{2,}|\s*$))/,def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +["(]([^\n]+)[")])? *(?:\n+|$)/,table:u,paragraph:/^((?:[^\n]+\n?(?!hr|heading|lheading|blockquote|tag|def))+)\n*/,text:/^[^\n]+/};h.bullet=/(?:[*+-]|\d+\.)/,h.item=/^( *)(bull) [^\n]*(?:\n(?!\1bull )[^\n]*)*/,h.item=l(h.item,"gm")(/bull/g,h.bullet)(),h.list=l(h.list)(/bull/g,h.bullet)("hr","\\n+(?=\\1?(?:[-*_] *){3,}(?:\\n+|$))")("def","\\n+(?="+h.def.source+")")(),h.blockquote=l(h.blockquote)("def",h.def)(),h._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",h.html=l(h.html)("comment",/<!--[\s\S]*?-->/)("closed",/<(tag)[\s\S]+?<\/\1>/)("closing",/<tag(?:"[^"]*"|'[^']*'|[^'">])*?>/)(/tag/g,h._tag)(),h.paragraph=l(h.paragraph)("hr",h.hr)("heading",h.heading)("lheading",h.lheading)("blockquote",h.blockquote)("tag","<"+h._tag)("def",h.def)(),h.normal=c({},h),h.gfm=c({},h.normal,{fences:/^ *(`{3,}|~{3,})[ \.]*(\S+)? *\n([\s\S]*?)\s*\1 *(?:\n+|$)/,paragraph:/^/,heading:/^ *(#{1,6}) +([^\n]+?) *#* *(?:\n+|$)/}),h.gfm.paragraph=l(h.paragraph)("(?!","(?!"+h.gfm.fences.source.replace("\\1","\\2")+"|"+h.list.source.replace("\\1","\\3")+"|")(),h.tables=c({},h.gfm,{nptable:/^ *(\S.*\|.*)\n *([-:]+ *\|[-| :]*)\n((?:.*\|.*(?:\n|$))*)\n*/,table:/^ *\|(.+)\n *\|( *[-:]+[-| :]*)\n((?: *\|.*(?:\n|$))*)\n*/}),n.rules=h,n.lex=function(e,t){var r=new n(t);return r.lex(e)},n.prototype.lex=function(e){return e=e.replace(/\r\n|\r/g,"\n").replace(/\t/g," ").replace(/\u00a0/g," ").replace(/\u2424/g,"\n"),this.token(e,!0)},n.prototype.token=function(e,t,n){for(var r,i,s,a,o,l,u,c,p,g=this,e=e.replace(/^ +$/gm,"");e;)if((s=g.rules.newline.exec(e))&&(e=e.substring(s[0].length),s[0].length>1&&g.tokens.push({type:"space"})),s=g.rules.code.exec(e))e=e.substring(s[0].length),s=s[0].replace(/^ {4}/gm,""),g.tokens.push({type:"code",text:g.options.pedantic?s:s.replace(/\n+$/,"")});else if(s=g.rules.fences.exec(e))e=e.substring(s[0].length),g.tokens.push({type:"code",lang:s[2],text:s[3]||""});else if(s=g.rules.heading.exec(e))e=e.substring(s[0].length),g.tokens.push({type:"heading",depth:s[1].length,text:s[2]});else if(t&&(s=g.rules.nptable.exec(e))){for(e=e.substring(s[0].length),l={type:"table",header:s[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:s[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:s[3].replace(/\n$/,"").split("\n")},c=0;c<l.align.length;c++)/^ *-+: *$/.test(l.align[c])?l.align[c]="right":/^ *:-+: *$/.test(l.align[c])?l.align[c]="center":/^ *:-+ *$/.test(l.align[c])?l.align[c]="left":l.align[c]=null;for(c=0;c<l.cells.length;c++)l.cells[c]=l.cells[c].split(/ *\| */);g.tokens.push(l)}else if(s=g.rules.lheading.exec(e))e=e.substring(s[0].length),g.tokens.push({type:"heading",depth:"="===s[2]?1:2,text:s[1]});else if(s=g.rules.hr.exec(e))e=e.substring(s[0].length),g.tokens.push({type:"hr"});else if(s=g.rules.blockquote.exec(e))e=e.substring(s[0].length),g.tokens.push({type:"blockquote_start"}),s=s[0].replace(/^ *> ?/gm,""),g.token(s,t,!0),g.tokens.push({type:"blockquote_end"});else if(s=g.rules.list.exec(e)){for(e=e.substring(s[0].length),a=s[2],g.tokens.push({type:"list_start",ordered:a.length>1}),s=s[0].match(g.rules.item),r=!1,p=s.length,c=0;c<p;c++)l=s[c],u=l.length,l=l.replace(/^ *([*+-]|\d+\.) +/,""),~l.indexOf("\n ")&&(u-=l.length,l=g.options.pedantic?l.replace(/^ {1,4}/gm,""):l.replace(new RegExp("^ {1,"+u+"}","gm"),"")),g.options.smartLists&&c!==p-1&&(o=h.bullet.exec(s[c+1])[0],a===o||a.length>1&&o.length>1||(e=s.slice(c+1).join("\n")+e,c=p-1)),i=r||/\n\n(?!\s*$)/.test(l),c!==p-1&&(r="\n"===l.charAt(l.length-1),i||(i=r)),g.tokens.push({type:i?"loose_item_start":"list_item_start"}),g.token(l,!1,n),g.tokens.push({type:"list_item_end"});g.tokens.push({type:"list_end"})}else if(s=g.rules.html.exec(e))e=e.substring(s[0].length),g.tokens.push({type:g.options.sanitize?"paragraph":"html",pre:!g.options.sanitizer&&("pre"===s[1]||"script"===s[1]||"style"===s[1]),text:s[0]});else if(!n&&t&&(s=g.rules.def.exec(e)))e=e.substring(s[0].length),g.tokens.links[s[1].toLowerCase()]={href:s[2],title:s[3]};else if(t&&(s=g.rules.table.exec(e))){for(e=e.substring(s[0].length),l={type:"table",header:s[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:s[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:s[3].replace(/(?: *\| *)?\n$/,"").split("\n")},c=0;c<l.align.length;c++)/^ *-+: *$/.test(l.align[c])?l.align[c]="right":/^ *:-+: *$/.test(l.align[c])?l.align[c]="center":/^ *:-+ *$/.test(l.align[c])?l.align[c]="left":l.align[c]=null;for(c=0;c<l.cells.length;c++)l.cells[c]=l.cells[c].replace(/^ *\| *| *\| *$/g,"").split(/ *\| */);g.tokens.push(l)}else if(t&&(s=g.rules.paragraph.exec(e)))e=e.substring(s[0].length),g.tokens.push({type:"paragraph",text:"\n"===s[1].charAt(s[1].length-1)?s[1].slice(0,-1):s[1]});else if(s=g.rules.text.exec(e))e=e.substring(s[0].length),g.tokens.push({type:"text",text:s[0]});else if(e)throw new Error("Infinite loop on byte: "+e.charCodeAt(0));return this.tokens};var g={escape:/^\\([\\`*{}\[\]()#+\-.!_>])/,autolink:/^<([^ >]+(@|:\/)[^ >]+)>/,url:u,tag:/^<!--[\s\S]*?-->|^<\/?\w+(?:"[^"]*"|'[^']*'|[^'">])*?>/,link:/^!?\[(inside)\]\(href\)/,reflink:/^!?\[(inside)\]\s*\[([^\]]*)\]/,nolink:/^!?\[((?:\[[^\]]*\]|[^\[\]])*)\]/,strong:/^__([\s\S]+?)__(?!_)|^\*\*([\s\S]+?)\*\*(?!\*)/,em:/^\b_((?:[^_]|__)+?)_\b|^\*((?:\*\*|[\s\S])+?)\*(?!\*)/,code:/^(`+)\s*([\s\S]*?[^`])\s*\1(?!`)/,br:/^ {2,}\n(?!\s*$)/,del:u,text:/^[\s\S]+?(?=[\\<!\[_*`]| {2,}\n|$)/};g._inside=/(?:\[[^\]]*\]|[^\[\]]|\](?=[^\[]*\]))*/,g._href=/\s*<?([\s\S]*?)>?(?:\s+['"]([\s\S]*?)['"])?\s*/,g.link=l(g.link)("inside",g._inside)("href",g._href)(),g.reflink=l(g.reflink)("inside",g._inside)(),g.normal=c({},g),g.pedantic=c({},g.normal,{strong:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,em:/^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/}),g.gfm=c({},g.normal,{escape:l(g.escape)("])","~|])")(),url:/^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/,del:/^~~(?=\S)([\s\S]*?\S)~~/,text:l(g.text)("]|","~]|")("|","|https?://|")()}),g.breaks=c({},g.gfm,{br:l(g.br)("{2,}","*")(),text:l(g.gfm.text)("{2,}","*")()}),r.rules=g,r.output=function(e,t,n){var i=new r(t,n);return i.output(e)},r.prototype.output=function(e){for(var t,n,r,i,s=this,o="";e;)if(i=s.rules.escape.exec(e))e=e.substring(i[0].length),o+=i[1];else if(i=s.rules.autolink.exec(e))e=e.substring(i[0].length),"@"===i[2]?(n=":"===i[1].charAt(6)?s.mangle(i[1].substring(7)):s.mangle(i[1]),r=s.mangle("mailto:")+n):(n=a(i[1]),r=n),o+=s.renderer.link(r,null,n);else if(s.inLink||!(i=s.rules.url.exec(e))){if(i=s.rules.tag.exec(e))!s.inLink&&/^<a /i.test(i[0])?s.inLink=!0:s.inLink&&/^<\/a>/i.test(i[0])&&(s.inLink=!1),e=e.substring(i[0].length),o+=s.options.sanitize?s.options.sanitizer?s.options.sanitizer(i[0]):a(i[0]):i[0];else if(i=s.rules.link.exec(e))e=e.substring(i[0].length),s.inLink=!0,o+=s.outputLink(i,{href:i[2],title:i[3]}),s.inLink=!1;else if((i=s.rules.reflink.exec(e))||(i=s.rules.nolink.exec(e))){if(e=e.substring(i[0].length),t=(i[2]||i[1]).replace(/\s+/g," "),t=s.links[t.toLowerCase()],!t||!t.href){o+=i[0].charAt(0),e=i[0].substring(1)+e;continue}s.inLink=!0,o+=s.outputLink(i,t),s.inLink=!1}else if(i=s.rules.strong.exec(e))e=e.substring(i[0].length),o+=s.renderer.strong(s.output(i[2]||i[1]));else if(i=s.rules.em.exec(e))e=e.substring(i[0].length),o+=s.renderer.em(s.output(i[2]||i[1]));else if(i=s.rules.code.exec(e))e=e.substring(i[0].length),o+=s.renderer.codespan(a(i[2],!0));else if(i=s.rules.br.exec(e))e=e.substring(i[0].length),o+=s.renderer.br();else if(i=s.rules.del.exec(e))e=e.substring(i[0].length),o+=s.renderer.del(s.output(i[1]));else if(i=s.rules.text.exec(e))e=e.substring(i[0].length),o+=s.renderer.text(a(s.smartypants(i[0])));else if(e)throw new Error("Infinite loop on byte: "+e.charCodeAt(0))}else e=e.substring(i[0].length),n=a(i[1]),r=n,o+=s.renderer.link(r,null,n);return o},r.prototype.outputLink=function(e,t){var n=a(t.href),r=t.title?a(t.title):null;return"!"!==e[0].charAt(0)?this.renderer.link(n,r,this.output(e[1])):this.renderer.image(n,r,a(e[1]))},r.prototype.smartypants=function(e){return this.options.smartypants?e.replace(/---/g,"—").replace(/--/g,"–").replace(/(^|[-\u2014\/(\[{"\s])'/g,"$1‘").replace(/'/g,"’").replace(/(^|[-\u2014\/(\[{\u2018\s])"/g,"$1“").replace(/"/g,"”").replace(/\.{3}/g,"…"):e},r.prototype.mangle=function(e){if(!this.options.mangle)return e;for(var t,n="",r=e.length,i=0;i<r;i++)t=e.charCodeAt(i),Math.random()>.5&&(t="x"+t.toString(16)),n+="&#"+t+";";return n},i.prototype.code=function(e,t,n){if(this.options.highlight){var r=this.options.highlight(e,t);null!=r&&r!==e&&(n=!0,e=r)}return t?'<pre><code class="'+this.options.langPrefix+a(t,!0)+'">'+(n?e:a(e,!0))+"\n</code></pre>\n":"<pre><code>"+(n?e:a(e,!0))+"\n</code></pre>"},i.prototype.blockquote=function(e){return"<blockquote>\n"+e+"</blockquote>\n"},i.prototype.html=function(e){return e},i.prototype.heading=function(e,t,n){return"<h"+t+' id="'+this.options.headerPrefix+n.toLowerCase().replace(/[^\w]+/g,"-")+'">'+e+"</h"+t+">\n"},i.prototype.hr=function(){return this.options.xhtml?"<hr/>\n":"<hr>\n"},i.prototype.list=function(e,t){var n=t?"ol":"ul";return"<"+n+">\n"+e+"</"+n+">\n"},i.prototype.listitem=function(e){return"<li>"+e+"</li>\n"},i.prototype.paragraph=function(e){return"<p>"+e+"</p>\n"},i.prototype.table=function(e,t){return"<table>\n<thead>\n"+e+"</thead>\n<tbody>\n"+t+"</tbody>\n</table>\n"},i.prototype.tablerow=function(e){return"<tr>\n"+e+"</tr>\n"},i.prototype.tablecell=function(e,t){var n=t.header?"th":"td",r=t.align?"<"+n+' style="text-align:'+t.align+'">':"<"+n+">";return r+e+"</"+n+">\n"},i.prototype.strong=function(e){return"<strong>"+e+"</strong>"},i.prototype.em=function(e){return"<em>"+e+"</em>"},i.prototype.codespan=function(e){return"<code>"+e+"</code>"},i.prototype.br=function(){return this.options.xhtml?"<br/>":"<br>"},i.prototype.del=function(e){return"<del>"+e+"</del>"},i.prototype.link=function(e,t,n){if(this.options.sanitize){try{var r=decodeURIComponent(o(e)).replace(/[^\w:]/g,"").toLowerCase()}catch(e){return""}if(0===r.indexOf("javascript:")||0===r.indexOf("vbscript:"))return""}var i='<a href="'+e+'"';return t&&(i+=' title="'+t+'"'),i+=">"+n+"</a>"},i.prototype.image=function(e,t,n){var r='<img src="'+e+'" alt="'+n+'"';return t&&(r+=' title="'+t+'"'),r+=this.options.xhtml?"/>":">"},i.prototype.text=function(e){return e},s.parse=function(e,t,n){var r=new s(t,n);return r.parse(e)},s.prototype.parse=function(e){var t=this;this.inline=new r(e.links,this.options,this.renderer),this.tokens=e.reverse();for(var n="";this.next();)n+=t.tok();return n},s.prototype.next=function(){return this.token=this.tokens.pop()},s.prototype.peek=function(){return this.tokens[this.tokens.length-1]||0},s.prototype.parseText=function(){for(var e=this,t=this.token.text;"text"===this.peek().type;)t+="\n"+e.next().text;return this.inline.output(t)},s.prototype.tok=function(){var e=this;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 t,n,r,i,s,a="",o="";for(r="",t=0;t<this.token.header.length;t++)i={header:!0,align:e.token.align[t]},r+=e.renderer.tablecell(e.inline.output(e.token.header[t]),{header:!0,align:e.token.align[t]});for(a+=this.renderer.tablerow(r),t=0;t<this.token.cells.length;t++){for(n=e.token.cells[t],r="",s=0;s<n.length;s++)r+=e.renderer.tablecell(e.inline.output(n[s]),{header:!1,align:e.token.align[s]});o+=e.renderer.tablerow(r)}return this.renderer.table(a,o);case"blockquote_start":for(var o="";"blockquote_end"!==this.next().type;)o+=e.tok();return this.renderer.blockquote(o);case"list_start":for(var o="",l=this.token.ordered;"list_end"!==this.next().type;)o+=e.tok();return this.renderer.list(o,l);case"list_item_start":for(var o="";"list_item_end"!==this.next().type;)o+="text"===e.token.type?e.parseText():e.tok();return this.renderer.listitem(o);case"loose_item_start":for(var o="";"list_item_end"!==this.next().type;)o+=e.tok();return this.renderer.listitem(o);case"html":var u=this.token.pre||this.options.pedantic?this.token.text:this.inline.output(this.token.text);return this.renderer.html(u);case"paragraph":return this.renderer.paragraph(this.inline.output(this.token.text));case"text":return this.renderer.paragraph(this.parseText())}},u.exec=u,p.options=p.setOptions=function(e){return c(p.defaults,e),p},p.defaults={gfm:!0,tables:!0,breaks:!1,pedantic:!1,sanitize:!1,sanitizer:null,mangle:!0,smartLists:!1,silent:!1,highlight:null,langPrefix:"lang-",smartypants:!1,headerPrefix:"",renderer:new i,xhtml:!1},p.Parser=s,p.parser=s.parse,p.Renderer=i,p.Lexer=n,p.lexer=n.lex,p.InlineLexer=r,p.inlineLexer=r.output,p.parse=p,"undefined"!=typeof e&&"object"==typeof t?e.exports=p:"function"==typeof define&&define.amd?define(function(){return p}):this.marked=p}).call(function(){return this||("undefined"!=typeof window?window:r)}())}),s=e(function(e){var t="undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?self:{},n=function(){var e=/\blang(?:uage)?-(\w+)\b/i,n=0,r=t.Prism={util:{encode:function(e){return e instanceof i?new i(e.type,r.util.encode(e.content),e.alias):"Array"===r.util.type(e)?e.map(r.util.encode):e.replace(/&/g,"&").replace(/</g,"<").replace(/\u00a0/g," ")},type:function(e){return Object.prototype.toString.call(e).match(/\[object (\w+)\]/)[1]},objId:function(e){return e.__id||Object.defineProperty(e,"__id",{value:++n}),e.__id},clone:function(e){var t=r.util.type(e);switch(t){case"Object":var n={};for(var i in e)e.hasOwnProperty(i)&&(n[i]=r.util.clone(e[i]));return n;case"Array":return e.map&&e.map(function(e){return r.util.clone(e)})}return e}},languages:{extend:function(e,t){var n=r.util.clone(r.languages[e]);for(var i in t)n[i]=t[i];return n},insertBefore:function(e,t,n,i){i=i||r.languages;var s=i[e];if(2==arguments.length){n=arguments[1];for(var a in n)n.hasOwnProperty(a)&&(s[a]=n[a]);return s}var o={};for(var l in s)if(s.hasOwnProperty(l)){if(l==t)for(var a in n)n.hasOwnProperty(a)&&(o[a]=n[a]);o[l]=s[l]}return r.languages.DFS(r.languages,function(t,n){n===i[e]&&t!=e&&(this[t]=o)}),i[e]=o},DFS:function(e,t,n,i){i=i||{};for(var s in e)e.hasOwnProperty(s)&&(t.call(e,s,e[s],n||s),"Object"!==r.util.type(e[s])||i[r.util.objId(e[s])]?"Array"!==r.util.type(e[s])||i[r.util.objId(e[s])]||(i[r.util.objId(e[s])]=!0,r.languages.DFS(e[s],t,s,i)):(i[r.util.objId(e[s])]=!0,r.languages.DFS(e[s],t,null,i)))}},plugins:{},highlightAll:function(e,t){var n={callback:t,selector:'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'};r.hooks.run("before-highlightall",n);for(var i,s=n.elements||document.querySelectorAll(n.selector),a=0;i=s[a++];)r.highlightElement(i,e===!0,n.callback)},highlightElement:function(n,i,s){for(var a,o,l=n;l&&!e.test(l.className);)l=l.parentNode;l&&(a=(l.className.match(e)||[,""])[1].toLowerCase(),o=r.languages[a]),n.className=n.className.replace(e,"").replace(/\s+/g," ")+" language-"+a,l=n.parentNode,/pre/i.test(l.nodeName)&&(l.className=l.className.replace(e,"").replace(/\s+/g," ")+" language-"+a);var u=n.textContent,c={element:n,language:a,grammar:o,code:u};if(r.hooks.run("before-sanity-check",c),!c.code||!c.grammar)return void r.hooks.run("complete",c);if(r.hooks.run("before-highlight",c),i&&t.Worker){var p=new Worker(r.filename);p.onmessage=function(e){c.highlightedCode=e.data,r.hooks.run("before-insert",c),c.element.innerHTML=c.highlightedCode,s&&s.call(c.element),r.hooks.run("after-highlight",c),r.hooks.run("complete",c)},p.postMessage(JSON.stringify({language:c.language,code:c.code,immediateClose:!0}))}else c.highlightedCode=r.highlight(c.code,c.grammar,c.language),r.hooks.run("before-insert",c),c.element.innerHTML=c.highlightedCode,s&&s.call(n),r.hooks.run("after-highlight",c),r.hooks.run("complete",c)},highlight:function(e,t,n){var s=r.tokenize(e,t);return i.stringify(r.util.encode(s),n)},tokenize:function(e,t,n){var i=r.Token,s=[e],a=t.rest;if(a){for(var o in a)t[o]=a[o];delete t.rest}e:for(var o in t)if(t.hasOwnProperty(o)&&t[o]){var l=t[o];l="Array"===r.util.type(l)?l:[l];for(var u=0;u<l.length;++u){var c=l[u],p=c.inside,h=!!c.lookbehind,g=!!c.greedy,d=0,f=c.alias;c=c.pattern||c;for(var m=0;m<s.length;m++){var y=s[m];if(s.length>e.length)break e;if(!(y instanceof i)){c.lastIndex=0;var b=c.exec(y),k=1;if(!b&&g&&m!=s.length-1){var x=s[m+1].matchedStr||s[m+1],v=y+x;if(m<s.length-2&&(v+=s[m+2].matchedStr||s[m+2]),c.lastIndex=0,b=c.exec(v),!b)continue;var w=b.index+(h?b[1].length:0);if(w>=y.length)continue;var _=b.index+b[0].length,S=y.length+x.length;if(k=3,_<=S){if(s[m+1].greedy)continue;k=2,v=v.slice(0,S)}y=v}if(b){h&&(d=b[1].length);var w=b.index+d,b=b[0].slice(d),_=w+b.length,L=y.slice(0,w),$=y.slice(_),A=[m,k];L&&A.push(L);var C=new i(o,p?r.tokenize(b,p):b,f,b,g);A.push(C),$&&A.push($),Array.prototype.splice.apply(s,A)}}}}}return s},hooks:{all:{},add:function(e,t){var n=r.hooks.all;n[e]=n[e]||[],n[e].push(t)},run:function(e,t){var n=r.hooks.all[e];if(n&&n.length)for(var i,s=0;i=n[s++];)i(t)}}},i=r.Token=function(e,t,n,r,i){this.type=e,this.content=t,this.alias=n,this.matchedStr=r||null,this.greedy=!!i};if(i.stringify=function(e,t,n){if("string"==typeof e)return e;if("Array"===r.util.type(e))return e.map(function(n){return i.stringify(n,t,e)}).join("");var s={type:e.type,content:i.stringify(e.content,t,n),tag:"span",classes:["token",e.type],attributes:{},language:t,parent:n};if("comment"==s.type&&(s.attributes.spellcheck="true"),e.alias){var a="Array"===r.util.type(e.alias)?e.alias:[e.alias];Array.prototype.push.apply(s.classes,a)}r.hooks.run("wrap",s);var o="";for(var l in s.attributes)o+=(o?" ":"")+l+'="'+(s.attributes[l]||"")+'"';return"<"+s.tag+' class="'+s.classes.join(" ")+'" '+o+">"+s.content+"</"+s.tag+">"},!t.document)return t.addEventListener?(t.addEventListener("message",function(e){var n=JSON.parse(e.data),i=n.language,s=n.code,a=n.immediateClose;t.postMessage(r.highlight(s,r.languages[i],i)),a&&t.close()},!1),t.Prism):t.Prism;var s=document.currentScript||[].slice.call(document.getElementsByTagName("script")).pop();return s&&(r.filename=s.src,document.addEventListener&&!s.hasAttribute("data-manual")&&("loading"!==document.readyState?requestAnimationFrame(r.highlightAll,0):document.addEventListener("DOMContentLoaded",r.highlightAll))),t.Prism}();"undefined"!=typeof e&&e.exports&&(e.exports=n),"undefined"!=typeof r&&(r.Prism=n),n.languages.markup={comment:/<!--[\w\W]*?-->/,prolog:/<\?[\w\W]+?\?>/,doctype:/<!DOCTYPE[\w\W]+?>/,cdata:/<!\[CDATA\[[\w\W]*?]]>/i,tag:{pattern:/<\/?(?!\d)[^\s>\/=.$<]+(?:\s+[^\s>\/=]+(?:=(?:("|')(?:\\\1|\\?(?!\1)[\w\W])*\1|[^\s'">=]+))?)*\s*\/?>/i,inside:{tag:{pattern:/^<\/?[^\s>\/]+/i,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"attr-value":{pattern:/=(?:('|")[\w\W]*?(\1)|[^\s>]+)/i,inside:{punctuation:/[=>"']/}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:/&#?[\da-z]{1,8};/i},n.hooks.add("wrap",function(e){"entity"===e.type&&(e.attributes.title=e.content.replace(/&/,"&"))}),n.languages.xml=n.languages.markup,n.languages.html=n.languages.markup,n.languages.mathml=n.languages.markup,n.languages.svg=n.languages.markup,n.languages.css={comment:/\/\*[\w\W]*?\*\//,atrule:{pattern:/@[\w-]+?.*?(;|(?=\s*\{))/i,inside:{rule:/@[\w-]+/}},url:/url\((?:(["'])(\\(?:\r\n|[\w\W])|(?!\1)[^\\\r\n])*\1|.*?)\)/i,selector:/[^\{\}\s][^\{\};]*?(?=\s*\{)/,string:/("|')(\\(?:\r\n|[\w\W])|(?!\1)[^\\\r\n])*\1/,property:/(\b|\B)[\w-]+(?=\s*:)/i,important:/\B!important\b/i,function:/[-a-z0-9]+(?=\()/i,punctuation:/[(){};:]/},n.languages.css.atrule.inside.rest=n.util.clone(n.languages.css),n.languages.markup&&(n.languages.insertBefore("markup","tag",{style:{pattern:/(<style[\w\W]*?>)[\w\W]*?(?=<\/style>)/i,lookbehind:!0,inside:n.languages.css,alias:"language-css"}}),n.languages.insertBefore("inside","attr-value",{"style-attr":{pattern:/\s*style=("|').*?\1/i,inside:{"attr-name":{pattern:/^\s*style/i,inside:n.languages.markup.tag.inside},punctuation:/^\s*=\s*['"]|['"]\s*$/,"attr-value":{pattern:/.+/i,inside:n.languages.css}},alias:"language-css"}},n.languages.markup.tag)),n.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\w\W]*?\*\//,lookbehind:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0}],string:{pattern:/(["'])(\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/((?:\b(?:class|interface|extends|implements|trait|instanceof|new)\s+)|(?:catch\s+\())[a-z0-9_\.\\]+/i,lookbehind:!0,inside:{punctuation:/(\.|\\)/}},keyword:/\b(if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/,boolean:/\b(true|false)\b/,function:/[a-z0-9_]+(?=\()/i,number:/\b-?(?:0x[\da-f]+|\d*\.?\d+(?:e[+-]?\d+)?)\b/i,operator:/--?|\+\+?|!=?=?|<=?|>=?|==?=?|&&?|\|\|?|\?|\*|\/|~|\^|%/,punctuation:/[{}[\];(),.:]/},n.languages.javascript=n.languages.extend("clike",{keyword:/\b(as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|var|void|while|with|yield)\b/,number:/\b-?(0x[\dA-Fa-f]+|0b[01]+|0o[0-7]+|\d*\.?\d+([Ee][+-]?\d+)?|NaN|Infinity)\b/,function:/[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*(?=\()/i}),n.languages.insertBefore("javascript","keyword",{regex:{pattern:/(^|[^\/])\/(?!\/)(\[.+?]|\\.|[^\/\\\r\n])+\/[gimyu]{0,5}(?=\s*($|[\r\n,.;})]))/,lookbehind:!0,greedy:!0}}),n.languages.insertBefore("javascript","string",{"template-string":{pattern:/`(?:\\\\|\\?[^\\])*?`/,greedy:!0,inside:{interpolation:{pattern:/\$\{[^}]+\}/,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:n.languages.javascript}},string:/[\s\S]+/}}}),n.languages.markup&&n.languages.insertBefore("markup","tag",{script:{pattern:/(<script[\w\W]*?>)[\w\W]*?(?=<\/script>)/i,lookbehind:!0,inside:n.languages.javascript,alias:"language-javascript"}}),n.languages.js=n.languages.javascript,function(){"undefined"!=typeof self&&self.Prism&&self.document&&document.querySelector&&(self.Prism.fileHighlight=function(){var e={js:"javascript",py:"python",rb:"ruby",ps1:"powershell",psm1:"powershell",sh:"bash",bat:"batch",h:"c",tex:"latex"};Array.prototype.forEach&&Array.prototype.slice.call(document.querySelectorAll("pre[data-src]")).forEach(function(t){for(var r,i=t.getAttribute("data-src"),s=t,a=/\blang(?:uage)?-(?!\*)(\w+)\b/i;s&&!a.test(s.className);)s=s.parentNode;if(s&&(r=(t.className.match(a)||[,""])[1]),!r){var o=(i.match(/\.(\w+)$/)||[,""])[1];r=e[o]||o}var l=document.createElement("code");l.className="language-"+r,t.textContent="",l.textContent="Loading…",t.appendChild(l);var u=new XMLHttpRequest;u.open("GET",i,!0),u.onreadystatechange=function(){4==u.readyState&&(u.status<400&&u.responseText?(l.textContent=u.responseText,n.highlightElement(l)):u.status>=400?l.textContent="✖ Error "+u.status+" while fetching file: "+u.statusText:l.textContent="✖ Error: File does not exist or is empty")},u.send(null)})},document.addEventListener("DOMContentLoaded",self.Prism.fileHighlight))}()}),a=function(e){var t=[],n={};return e.forEach(function(e){var r=e.level||1,i=r-1;n[i]?(n[i].children=n[i].children||[],n[i].children.push(e)):(t.push(e),n[r]=e)}),t},o=function(e,t){return void 0===t&&(t=""),e&&e.length?(e.forEach(function(e){t+='<li><a class="section-link" href="#'+e.slug+'">'+e.title+"</a></li>",e.children&&(t+='<li><ul class="children">'+o(e.children)+"</li>")}),t+"</ul>"):""},l=function(e){return o(a(e),"<ul>")},u=[],c=new i.Renderer;c.heading=function(e,t){var n=e.toLowerCase().replace(/[\s\n\t]+/g,"-");return u.push({level:t,slug:n,title:e}),"<h"+t+' id="'+n+'"><a href="#'+n+'" class="anchor"></a>'+e+"</h"+t+">"},i.setOptions({renderer:c,highlight:function(e,t){return s.highlight(e,s.languages[t]||s.languages.markup)}});var p=function(e){var t='<section class="content">\n <article class="markdown-section">'+i(e)+"</article>\n </section>",n='<aside class="sidebar">'+l(u)+"</aside>";return"<main>"+n+t+"</main>"},h=function(){t()},g={el:"#app",title:document.title,sep:" - "},d=function e(t){e.installed=!0,this.replace=!0,this.opts=Object.assign({},t,g),this.dom=document.querySelector(this.opts.el),this.dom||(this.dom=document.body,this.replace=!1),this.loc=document.location.pathname,/\/$/.test(this.loc)&&(this.loc+="README"),this.load()};return d.prototype.load=function(){var e=this;n(this.loc+".md").then(function(t){var n=t.target;n.status>=400?e.render("not found"):(e.render(t.target.response),h())})},d.prototype.render=function(e){document.title=this.loc.slice(1)+this.opts.sep+this.opts.title,this.dom[this.replace?"outerHTML":"innerHTML"]=p(e)},d.use=function(){var e=arguments[0];if("function"!=typeof e)throw TypeError("[docsify] Invalid plugin "+e.name);e.call(d)},window.addEventListener("load",function(){d.installed||new d}),d});
|