mirror of
https://github.com/ViViDboarder/Vivid-Casper.git
synced 2024-11-15 01:36:33 +00:00
2 lines
38 KiB
JavaScript
2 lines
38 KiB
JavaScript
|
var _self="undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?self:{},Prism=function(){var l=/\blang(?:uage)?-(\w+)\b/i,n=0,E=_self.Prism={manual:_self.Prism&&_self.Prism.manual,disableWorkerMessageHandler:_self.Prism&&_self.Prism.disableWorkerMessageHandler,util:{encode:function(e){return e instanceof s?new s(e.type,E.util.encode(e.content),e.alias):"Array"===E.util.type(e)?e.map(E.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,t){var n=E.util.type(e);switch(t=t||{},n){case"Object":if(t[E.util.objId(e)])return t[E.util.objId(e)];var i={};for(var a in t[E.util.objId(e)]=i,e)e.hasOwnProperty(a)&&(i[a]=E.util.clone(e[a],t));return i;case"Array":if(t[E.util.objId(e)])return t[E.util.objId(e)];i=[];return t[E.util.objId(e)]=i,e.forEach(function(e,n){i[n]=E.util.clone(e,t)}),i}return e}},languages:{extend:function(e,n){var t=E.util.clone(E.languages[e]);for(var i in n)t[i]=n[i];return t},insertBefore:function(t,e,n,i){var a=(i=i||E.languages)[t];if(2==arguments.length){for(var r in n=e)n.hasOwnProperty(r)&&(a[r]=n[r]);return a}var s={};for(var o in a)if(a.hasOwnProperty(o)){if(o==e)for(var r in n)n.hasOwnProperty(r)&&(s[r]=n[r]);s[o]=a[o]}return E.languages.DFS(E.languages,function(e,n){n===i[t]&&e!=t&&(this[e]=s)}),i[t]=s},DFS:function(e,n,t,i){for(var a in i=i||{},e)e.hasOwnProperty(a)&&(n.call(e,a,e[a],t||a),"Object"!==E.util.type(e[a])||i[E.util.objId(e[a])]?"Array"!==E.util.type(e[a])||i[E.util.objId(e[a])]||(i[E.util.objId(e[a])]=!0,E.languages.DFS(e[a],n,a,i)):(i[E.util.objId(e[a])]=!0,E.languages.DFS(e[a],n,null,i)))}},plugins:{},highlightAll:function(e,n){E.highlightAllUnder(document,e,n)},highlightAllUnder:function(e,n,t){var i={callback:t,selector:'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'};E.hooks.run("before-highlightall",i);for(var a,r=i.elements||e.querySelectorAll(i.selector),s=0;a=r[s++];)E.highlightElement(a,!0===n,i.callback)},highlightElement:function(e,n,t){for(var i,a,r=e;r&&!l.test(r.className);)r=r.parentNode;r&&(i=(r.className.match(l)||[,""])[1].toLowerCase(),a=E.languages[i]),e.className=e.className.replace(l,"").replace(/\s+/g," ")+" language-"+i,e.parentNode&&(r=e.parentNode,/pre/i.test(r.nodeName)&&(r.className=r.className.replace(l,"").replace(/\s+/g," ")+" language-"+i));var s={element:e,language:i,grammar:a,code:e.textContent};if(E.hooks.run("before-sanity-check",s),!s.code||!s.grammar)return s.code&&(E.hooks.run("before-highlight",s),s.element.textContent=s.code,E.hooks.run("after-highlight",s)),void E.hooks.run("complete",s);if(E.hooks.run("before-highlight",s),n&&_self.Worker){var o=new Worker(E.filename);o.onmessage=function(e){s.highlightedCode=e.data,E.hooks.run("before-insert",s),s.element.innerHTML=s.highlightedCode,t&&t.call(s.element),E.hooks.run("after-highlight",s),E.hooks.run("complete",s)},o.postMessage(JSON.stringify({language:s.language,code:s.code,immediateClose:!0}))}else s.highlightedCode=E.highlight(s.code,s.grammar,s.language),E.hooks.run("before-insert",s),s.element.innerHTML=s.highlightedCode,t&&t.call(e),E.hooks.run("after-highlight",s),E.hooks.run("complete",s)},highlight:function(e,n,t){var i=E.tokenize(e,n);return s.stringify(E.util.encode(i),t)},matchGrammar:function(e,n,t,i,a,r,s){var o=E.Token;for(var l in t)if(t.hasOwnProperty(l)&&t[l]){if(l==s)return;var d=t[l];d="Array"===E.util.type(d)?d:[d];for(var c=0;c<d.length;++c){var p=d[c],u=p.inside,m=!!p.lookbehind,f=!!p.greedy,g=0,b=p.alias;if(f&&!p.pattern.global){var h=p.pattern.toString().match(/[imuy]*$/)[0];p.pattern=RegExp(p.pattern.source,h+"g")}p=p.pattern||p;for(var v=i,w=a;v<n.length;w+=n[v].length,++v){var k=n[v];if(n.length>e.length)return;if(!(k instanceof o)){p.lastIndex=0;var y=1;if(!(N=p.exec(k))&&f&&v!=n.length-1){if(p.lastIndex=w,!(N=p.exec(e)))break;for(var _=N.index+
|
||
|
//# sourceMappingURL=prism.js.map
|