fa23-si/dist/plugin/highlight.js

5 lines
722 KiB
JavaScript
Raw Normal View History

!function(e){var t={};function r(a){if(t[a])return t[a].exports;var i=t[a]={i:a,l:!1,exports:{}};return e[a].call(i.exports,i,i.exports,r),i.l=!0,i.exports}r.m=e,r.c=t,r.d=function(e,t,a){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:a})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var a=Object.create(null);if(r.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(a,i,function(t){return e[t]}.bind(null,i));return a},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=2)}([function(e,t){(function(t){e.exports=t}).call(this,{})},function(e,t){function r(e){return(r="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})(e)}!function(e,t){"use strict";function a(r){try{var a=t.querySelectorAll("code.hljs,code.nohighlight");for(var n in a)a.hasOwnProperty(n)&&i(a[n],r)}catch(t){e.console.error("LineNumbers error: ",t)}}function i(e,t){"object"==r(e)&&function(e){e()}((function(){e.innerHTML=n(e,t)}))}function n(e,t){var r=(t=t||{singleLine:!1}).singleLine?0:1;return function e(t){var r=t.childNodes;for(var a in r)if(r.hasOwnProperty(a)){var i=r[a];l(i.textContent)>0&&(i.childNodes.length>0?e(i):o(i.parentNode))}}(e),function(e,t){var r=s(e);if(""===r[r.length-1].trim()&&r.pop(),r.length>t){for(var a="",i=0,n=r.length;i<n;i++)a+=c('<tr><td class="{0}"><div class="{1} {2}" {3}="{5}"></div></td><td class="{4}"><div class="{1}">{6}</div></td></tr>',[u,d,m,S,p,i+1,r[i].length>0?r[i]:" "]);return c('<table class="{0}">{1}</table>',[_,a])}return e}(e.innerHTML,r)}function o(e){var t=e.className;if(/hljs-/.test(t)){for(var r=s(e.innerHTML),a=0,i="";a<r.length;a++){i+=c('<span class="{0}">{1}</span>\n',[t,r[a].length>0?r[a]:" "])}e.innerHTML=i.trim()}}function s(e){return 0===e.length?[]:e.split(E)}function l(e){return(e.trim().match(E)||[]).length}function c(e,t){return e.replace(/\{(\d+)\}/g,(function(e,r){return t[r]?t[r]:e}))}var _="hljs-ln",d="hljs-ln-line",p="hljs-ln-code",u="hljs-ln-numbers",m="hljs-ln-n",S="data-line-number",E=/\r\n|\r|\n/g;e.hljs?(e.hljs.initLineNumbersOnLoad=function(r){"interactive"===t.readyState||"complete"===t.readyState?a(r):e.addEventListener("DOMContentLoaded",(function(){a(r)}))},e.hljs.lineNumbersBlock=i,e.hljs.lineNumbersValue=function(e,t){if("string"==typeof e){var r=document.createElement("code");return r.innerHTML=e,n(r,t)}},function(){var e=t.createElement("style");e.type="text/css",e.innerHTML=c(".{0}{border-collapse:collapse}.{0} td{padding:0}.{1}:before{content:attr({2})}",[_,m,S]),t.getElementsByTagName("head")[0].appendChild(e)}()):e.console.error("highlight.js not detected!")}(window,document)},function(e,t,r){"use strict";function a(e){return(a="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})(e)}/*! highlight.js v9.18.0 | BSD3 License | git.io/hljslicense */r.r(t),function(e){var t="object"==("undefined"==typeof window?"undefined":a(window))&&window||"object"==("undefined"==typeof self?"undefined":a(self))&&self;"undefined"==typeof exports||exports.nodeType?t&&(t.hljs=e({}),"function"==typeof define&&r(0)&&define([],(function(){return t.hljs}))):e(exports)}((function(e){var t=[],r=Object.keys,i={},n={},o=!0,s=/^(no-?highlight|plain|text)$/i,l=/\blang(?:uage)?-([\w-]+)\b/i,c=/((^(<[^>]+>|\t|)+|(?:\n)))/gm,_={case_insensitive:"cI",lexemes:"l",contains:"c",keywords:"k",subLanguage:"sL",className:"cN",begin:"b",beginKeywords:"bK",end:"e",endsWithParent:"eW",illegal:"
/*!
* reveal.js plugin that adds syntax highlight support.
*/
function(e){function t(e){return e.replace(/^[\s\uFEFF\xA0]+/g,"")}return function(e){var r=function(e){for(var t=e.split("\n"),r=0;r<t.length&&""===t[r].trim();r++)t.splice(r--,1);for(r=t.length-1;r>=0&&""===t[r].trim();r--)t.splice(r,1);return t.join("\n")}(e.innerHTML).split("\n"),a=r.reduce((function(e,r){return r.length>0&&t(r).length>0&&e>r.length-t(r).length?r.length-t(r).length:e}),Number.POSITIVE_INFINITY);return r.map((function(e,t){return e.slice(a)})).join("\n")}(e)}(e)),t.escapeHTML&&!e.hasAttribute("data-noescape")&&(e.innerHTML=e.innerHTML.replace(/</g,"&lt;").replace(/>/g,"&gt;")),e.addEventListener("focusout",(function(e){i.highlightBlock(e.currentTarget)}),!1),t.highlightOnLoad&&n.highlightBlock(e)})),e.on("pdf-ready",(function(){[].slice.call(document.querySelectorAll(".reveal pre code[data-line-numbers].current-fragment")).forEach((function(e){n.scrollHighlightedLineIntoView(e,{},!0)}))}))},highlightBlock:function(e){if(i.highlightBlock(e),0!==e.innerHTML.trim().length&&e.hasAttribute("data-line-numbers")){i.lineNumbersBlock(e,{singleLine:!0});var t={currentBlock:e},r=n.deserializeHighlightSteps(e.getAttribute("data-line-numbers"));if(r.length>1){var a=parseInt(e.getAttribute("data-fragment-index"),10);("number"!=typeof a||isNaN(a))&&(a=null),r.slice(1).forEach((function(r){var i=e.cloneNode(!0);i.setAttribute("data-line-numbers",n.serializeHighlightSteps([r])),i.classList.add("fragment"),e.parentNode.appendChild(i),n.highlightLines(i),"number"==typeof a?(i.setAttribute("data-fragment-index",a),a+=1):i.removeAttribute("data-fragment-index"),i.addEventListener("visible",n.scrollHighlightedLineIntoView.bind(n,i,t)),i.addEventListener("hidden",n.scrollHighlightedLineIntoView.bind(n,i.previousSibling,t))})),e.removeAttribute("data-fragment-index"),e.setAttribute("data-line-numbers",n.serializeHighlightSteps([r[0]]))}var o="function"==typeof e.closest?e.closest("section:not(.stack)"):null;if(o){o.addEventListener("visible",(function r(){n.scrollHighlightedLineIntoView(e,t,!0),o.removeEventListener("visible",r)}))}n.highlightLines(e)}},scrollHighlightedLineIntoView:function(e,t,r){cancelAnimationFrame(t.animationFrameID),t.currentBlock&&(e.scrollTop=t.currentBlock.scrollTop),t.currentBlock=e;var a=this.getHighlightedLineBounds(e),i=e.offsetHeight,o=getComputedStyle(e);i-=parseInt(o.paddingTop)+parseInt(o.paddingBottom);var s=e.scrollTop,l=a.top+(Math.min(a.bottom-a.top,i)-i)/2,c=e.querySelector(".hljs-ln");if(c&&(l+=c.offsetTop-parseInt(o.paddingTop)),l=Math.max(Math.min(l,e.scrollHeight-i),0),!0===r||s===l)e.scrollTop=l;else{if(e.scrollHeight<=i)return;var _=0;!function r(){_=Math.min(_+.02,1),e.scrollTop=s+(l-s)*n.easeInOutQuart(_),_<1&&(t.animationFrameID=requestAnimationFrame(r))}()}},easeInOutQuart:function(e){return e<.5?8*e*e*e*e:1-8*--e*e*e*e},getHighlightedLineBounds:function(e){var t=e.querySelectorAll(".highlight-line");if(0===t.length)return{top:0,bottom:0};var r=t[0],a=t[t.length-1];return{top:r.offsetTop,bottom:a.offsetTop+a.offsetHeight}},highlightLines:function(e,t){var r=n.deserializeHighlightSteps(t||e.getAttribute("data-line-numbers"));r.length&&r[0].forEach((function(t){var r=[];"number"==typeof t.end?r=[].slice.call(e.querySelectorAll("table tr:nth-child(n+"+t.start+"):nth-child(-n+"+t.end+")")):"number"==typeof t.start&&(r=[].slice.call(e.querySelectorAll("table tr:nth-child("+t.start+")"))),r.length&&(r.forEach((function(e){e.classList.add("highlight-line")})),e.classList.add("has-highlights"))}))},deserializeHighlightSteps:function(e){return(e=(e=e.replace(/\s/g,"")).split(n.HIGHLIGHT_STEP_DELIMITER)).map((function(e){return e.split(n.HIGHLIGHT_LINE_DELIMITER).map((function(e){if(/^[\d-]+$/.test(e)){e=e.split(n.HIGHLIGHT_LINE_RANGE_DELIMITER);var t=parseInt(e[0],10),r=parseInt(e[1],10);return isNaN(r)?{start:t}:{start:t,end:r}}return{}}))}))},serializeHighlightSteps:function(e){return e.map((function(e){return e.map((function(e){return"number"==typeof e.end?e.start+n.HIGHLIGHT_LINE_RANGE_DELIMITER+e.end:"number"==typeof e.start?e.start:""})).join(n.HIGHLIGHT_LINE_DELIMITER)})).join(