1 line
42 KiB
JavaScript
1 line
42 KiB
JavaScript
|
var hljs=function(){"use strict";var e={exports:{}};function t(n){return n instanceof Map?n.clear=n.delete=n.set=function(){throw new Error("map is read-only")}:n instanceof Set&&(n.add=n.clear=n.delete=function(){throw new Error("set is read-only")}),Object.freeze(n),Object.getOwnPropertyNames(n).forEach(function(e){e=n[e];"object"!=typeof e||Object.isFrozen(e)||t(e)}),n}e.exports=t,e.exports.default=t;var z=e.exports;class D{constructor(e){void 0===e.data&&(e.data={}),this.data=e.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function n(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function l(e,...n){const t=Object.create(null);for(const a in e)t[a]=e[a];return n.forEach(function(e){for(const n in e)t[n]=e[n]}),t}const a=e=>!!e.kind;class T{constructor(e,n){this.buffer="",this.classPrefix=n.classPrefix,e.walk(this)}addText(e){this.buffer+=n(e)}openNode(n){if(a(n)){let e=n.kind;e=n.sublanguage?"language-"+e:((e,{prefix:n})=>{if(e.includes(".")){const t=e.split(".");return[""+n+t.shift(),...t.map((e,n)=>""+e+"_".repeat(n+1))].join(" ")}return""+n+e})(e,{prefix:this.classPrefix}),this.span(e)}}closeNode(e){a(e)&&(this.buffer+="</span>")}value(){return this.buffer}span(e){this.buffer+=`<span class="${e}">`}}class i{constructor(){this.rootNode={children:[]},this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(e){this.top.children.push(e)}openNode(e){e={kind:e,children:[]};this.add(e),this.stack.push(e)}closeNode(){if(1<this.stack.length)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(e){return this.constructor._walk(e,this.rootNode)}static _walk(n,e){return"string"==typeof e?n.addText(e):e.children&&(n.openNode(e),e.children.forEach(e=>this._walk(n,e)),n.closeNode(e)),n}static _collapse(e){"string"!=typeof e&&e.children&&(e.children.every(e=>"string"==typeof e)?e.children=[e.children.join("")]:e.children.forEach(e=>{i._collapse(e)}))}}class L extends i{constructor(e){super(),this.options=e}addKeyword(e,n){""!==e&&(this.openNode(n),this.addText(e),this.closeNode())}addText(e){""!==e&&this.add(e)}addSublanguage(e,n){const t=e.root;t.kind=n,t.sublanguage=!0,this.add(t)}toHTML(){const e=new T(this,this.options);return e.value()}finalize(){return!0}}function c(e){return e?"string"==typeof e?e:e.source:null}function k(e){return O("(?=",e,")")}function O(...e){return e.map(e=>c(e)).join("")}function d(...e){var n,t="object"==typeof(n=(t=e)[t.length-1])&&n.constructor===Object?(t.splice(t.length-1,1),n):{};return"("+(t.capture?"":"?:")+e.map(e=>c(e)).join("|")+")"}function u(e){return new RegExp(e.toString()+"|").exec("").length-1}const I=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function g(e,{joinWith:n}){let r=0;return e.map(e=>{var n=r+=1;let t=c(e),a="";for(;0<t.length;){var i=I.exec(t);if(!i){a+=t;break}a+=t.substring(0,i.index),t=t.substring(i.index+i[0].length),"\\"===i[0][0]&&i[1]?a+="\\"+String(Number(i[1])+n):(a+=i[0],"("===i[0]&&r++)}return a}).map(e=>`(${e})`).join(n)}function r(e,n,t={}){const a=l({scope:"comment",begin:e,end:n,contains:[]},t);return a.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0}),e=d("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/),a.contains.push({begin:O(/[ ]+/,"(",e,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),a}var e="[a-zA-Z]\\w*",s="[a-zA-Z_]\\w*",o="\\b\\d+(\\.\\d+)?",b="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",h="\\b(0b[01]+)",p={begin:"\\\\[\\s\\S]",relevance:0},m={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[p]},f={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[p]},E=r("//","$"),v=r("/\\*","\\*/"),w=r("#","$"),y=Object.freeze({__proto__:null,MATCH_NOTHING_RE:/\b\B/,IDENT_RE:e,UNDERSCORE_IDENT_RE:s,NUMBER_RE:o,C_NUMBER_RE:b,BI
|