1 |
- {"version":3,"file":"ext-static_highlight-45029d67.js","sources":["../../node_modules/ace-builds/src-noconflict/ext-static_highlight.js"],"sourcesContent":["ace.define(\"ace/ext/static.css\",[\"require\",\"exports\",\"module\"], function(require, exports, module){module.exports = \".ace_static_highlight {\\n font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'Source Code Pro', 'source-code-pro', 'Droid Sans Mono', monospace;\\n font-size: 12px;\\n white-space: pre-wrap\\n}\\n\\n.ace_static_highlight .ace_gutter {\\n width: 2em;\\n text-align: right;\\n padding: 0 3px 0 0;\\n margin-right: 3px;\\n contain: none;\\n}\\n\\n.ace_static_highlight.ace_show_gutter .ace_line {\\n padding-left: 2.6em;\\n}\\n\\n.ace_static_highlight .ace_line { position: relative; }\\n\\n.ace_static_highlight .ace_gutter-cell {\\n -moz-user-select: -moz-none;\\n -khtml-user-select: none;\\n -webkit-user-select: none;\\n user-select: none;\\n top: 0;\\n bottom: 0;\\n left: 0;\\n position: absolute;\\n}\\n\\n\\n.ace_static_highlight .ace_gutter-cell:before {\\n content: counter(ace_line, decimal);\\n counter-increment: ace_line;\\n}\\n.ace_static_highlight {\\n counter-reset: ace_line;\\n}\\n\";\n\n});\n\nace.define(\"ace/ext/static_highlight\",[\"require\",\"exports\",\"module\",\"ace/edit_session\",\"ace/layer/text\",\"ace/ext/static.css\",\"ace/config\",\"ace/lib/dom\",\"ace/lib/lang\"], function(require, exports, module){\"use strict\";\nvar EditSession = require(\"../edit_session\").EditSession;\nvar TextLayer = require(\"../layer/text\").Text;\nvar baseStyles = require(\"./static.css\");\nvar config = require(\"../config\");\nvar dom = require(\"../lib/dom\");\nvar escapeHTML = require(\"../lib/lang\").escapeHTML;\nvar Element = /** @class */ (function () {\n function Element(type) {\n this.type = type;\n this.style = {};\n this.textContent = \"\";\n }\n Element.prototype.cloneNode = function () {\n return this;\n };\n Element.prototype.appendChild = function (child) {\n this.textContent += child.toString();\n };\n Element.prototype.toString = function () {\n var stringBuilder = [];\n if (this.type != \"fragment\") {\n stringBuilder.push(\"<\", this.type);\n if (this.className)\n stringBuilder.push(\" class='\", this.className, \"'\");\n var styleStr = [];\n for (var key in this.style) {\n styleStr.push(key, \":\", this.style[key]);\n }\n if (styleStr.length)\n stringBuilder.push(\" style='\", styleStr.join(\"\"), \"'\");\n stringBuilder.push(\">\");\n }\n if (this.textContent) {\n stringBuilder.push(this.textContent);\n }\n if (this.type != \"fragment\") {\n stringBuilder.push(\"</\", this.type, \">\");\n }\n return stringBuilder.join(\"\");\n };\n return Element;\n}());\nvar simpleDom = {\n createTextNode: function (textContent, element) {\n return escapeHTML(textContent);\n },\n createElement: function (type) {\n return new Element(type);\n },\n createFragment: function () {\n return new Element(\"fragment\");\n }\n};\nvar SimpleTextLayer = function () {\n this.config = {};\n this.dom = simpleDom;\n};\nSimpleTextLayer.prototype = TextLayer.prototype;\nvar highlight = function (el, opts, callback) {\n var m = el.className.match(/lang-(\\w+)/);\n var mode = opts.mode || m && (\"ace/mode/\" + m[1]);\n if (!mode)\n return false;\n var theme = opts.theme || \"ace/theme/textmate\";\n var data = \"\";\n var nodes = [];\n if (el.firstElementChild) {\n var textLen = 0;\n for (var i = 0; i < el.childNodes.length; i++) {\n var ch = el.childNodes[i];\n if (ch.nodeType == 3) {\n textLen += ch.data.length;\n data += ch.data;\n }\n else {\n nodes.push(textLen, ch);\n }\n }\n }\n else {\n data = el.textContent;\n if (opts.trim)\n data = data.trim();\n }\n highlight.render(data, mode, theme, opts.firstLineNumber, !opts.showGutter, function (highlighted) {\n dom.importCssString(highlighted.css, \"ace_highlight\");\n el.innerHTML = highlighted.html;\n var container = el.firstChild.firstChild;\n for (var i = 0; i < nodes.length; i += 2) {\n var pos = highlighted.session.doc.indexToPosition(nodes[i]);\n var node = nodes[i + 1];\n var lineEl = container.children[pos.row];\n lineEl && lineEl.appendChild(node);\n }\n callback && callback();\n });\n};\nhighlight.render = function (input, mode, theme, lineStart, disableGutter, callback) {\n var waiting = 1;\n var modeCache = EditSession.prototype.$modes;\n if (typeof theme == \"string\") {\n waiting++;\n config.loadModule(['theme', theme], function (m) {\n theme = m;\n --waiting || done();\n });\n }\n var modeOptions;\n if (mode && typeof mode === \"object\" && !mode.getTokenizer) {\n modeOptions = mode;\n mode = modeOptions.path;\n }\n if (typeof mode == \"string\") {\n waiting++;\n config.loadModule(['mode', mode], function (m) {\n if (!modeCache[mode] || modeOptions)\n modeCache[mode] = new m.Mode(modeOptions);\n mode = modeCache[mode];\n --waiting || done();\n });\n }\n function done() {\n var result = highlight.renderSync(input, mode, theme, lineStart, disableGutter);\n return callback ? callback(result) : result;\n }\n return --waiting || done();\n};\nhighlight.renderSync = function (input, mode, theme, lineStart, disableGutter) {\n lineStart = parseInt(lineStart || 1, 10);\n var session = new EditSession(\"\");\n session.setUseWorker(false);\n session.setMode(mode);\n var textLayer = new SimpleTextLayer();\n textLayer.setSession(session);\n Object.keys(textLayer.$tabStrings).forEach(function (k) {\n if (typeof textLayer.$tabStrings[k] == \"string\") {\n var el = simpleDom.createFragment();\n el.textContent = textLayer.$tabStrings[k];\n textLayer.$tabStrings[k] = el;\n }\n });\n session.setValue(input);\n var length = session.getLength();\n var outerEl = simpleDom.createElement(\"div\");\n outerEl.className = theme.cssClass;\n var innerEl = simpleDom.createElement(\"div\");\n innerEl.className = \"ace_static_highlight\" + (disableGutter ? \"\" : \" ace_show_gutter\");\n innerEl.style[\"counter-reset\"] = \"ace_line \" + (lineStart - 1);\n for (var ix = 0; ix < length; ix++) {\n var lineEl = simpleDom.createElement(\"div\");\n lineEl.className = \"ace_line\";\n if (!disableGutter) {\n var gutterEl = simpleDom.createElement(\"span\");\n gutterEl.className = \"ace_gutter ace_gutter-cell\";\n gutterEl.textContent = \"\";\n lineEl.appendChild(gutterEl);\n }\n textLayer.$renderLine(lineEl, ix, false);\n lineEl.textContent += \"\\n\";\n innerEl.appendChild(lineEl);\n }\n outerEl.appendChild(innerEl);\n return {\n css: baseStyles + theme.cssText,\n html: outerEl.toString(),\n session: session\n };\n};\nmodule.exports = highlight;\nmodule.exports.highlight = highlight;\n\n}); (function() {\n ace.require([\"ace/ext/static_highlight\"], function(m) {\n if (typeof module == \"object\" && typeof exports == \"object\" && module) {\n module.exports = m;\n }\n });\n })();\n "],"names":["require","exports","module","EditSession","TextLayer","baseStyles","config","dom","escapeHTML","Element","type","child","stringBuilder","styleStr","key","simpleDom","textContent","element","SimpleTextLayer","highlight","el","opts","callback","m","mode","theme","data","nodes","textLen","i","ch","highlighted","container","pos","node","lineEl","input","lineStart","disableGutter","waiting","modeCache","done","modeOptions","result","session","textLayer","k","length","outerEl","innerEl","ix","gutterEl"],"mappings":"gaAAA,IAAI,OAAO,qBAAqB,CAAC,UAAU,UAAU,QAAQ,EAAG,SAASA,EAASC,EAASC,EAAO,CAACA,EAAO,QAAU;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAEpH,CAAC,EAED,IAAI,OAAO,2BAA2B,CAAC,UAAU,UAAU,SAAS,mBAAmB,iBAAiB,qBAAqB,aAAa,cAAc,cAAc,EAAG,SAASF,EAASC,EAASC,EAAO,CAC3M,IAAIC,EAAcH,EAAQ,iBAAiB,EAAE,YACzCI,EAAYJ,EAAQ,eAAe,EAAE,KACrCK,EAAaL,EAAQ,cAAc,EACnCM,EAASN,EAAQ,WAAW,EAC5BO,EAAMP,EAAQ,YAAY,EAC1BQ,EAAaR,EAAQ,aAAa,EAAE,WACpCS,EAAyB,UAAY,CACrC,SAASA,EAAQC,EAAM,CACnB,KAAK,KAAOA,EACZ,KAAK,MAAQ,GACb,KAAK,YAAc,EACtB,CACD,OAAAD,EAAQ,UAAU,UAAY,UAAY,CACtC,OAAO,IACf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