File size: 4,944 Bytes
08c964e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
ace.define(
	'ace/ext/static_highlight',
	[
		'require',
		'exports',
		'module',
		'ace/edit_session',
		'ace/layer/text',
		'ace/config',
		'ace/lib/dom',
		'ace/lib/lang',
	],
	function (e, t, n) {
		'use strict'
		function f(e) {
			;(this.type = e), (this.style = {}), (this.textContent = '')
		}
		var r = e('../edit_session').EditSession,
			i = e('../layer/text').Text,
			s =
				".ace_static_highlight {font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', 'Droid Sans Mono', monospace;font-size: var(--el-font-size-small);white-space: pre-wrap}.ace_static_highlight .ace_gutter {width: 2em;text-align: right;padding: 0 3px 0 0;margin-right: 3px;contain: none;}.ace_static_highlight.ace_show_gutter .ace_line {padding-left: 2.6em;}.ace_static_highlight .ace_line { position: relative; }.ace_static_highlight .ace_gutter-cell {-moz-user-select: -moz-none;-khtml-user-select: none;-webkit-user-select: none;user-select: none;top: 0;bottom: 0;left: 0;position: absolute;}.ace_static_highlight .ace_gutter-cell:before {content: counter(ace_line, decimal);counter-increment: ace_line;}.ace_static_highlight {counter-reset: ace_line;}",
			o = e('../config'),
			u = e('../lib/dom'),
			a = e('../lib/lang').escapeHTML
		;(f.prototype.cloneNode = function () {
			return this
		}),
			(f.prototype.appendChild = function (e) {
				this.textContent += e.toString()
			}),
			(f.prototype.toString = function () {
				var e = []
				if (this.type != 'fragment') {
					e.push('<', this.type), this.className && e.push(" class='", this.className, "'")
					var t = []
					for (var n in this.style) t.push(n, ':', this.style[n])
					t.length && e.push(" style='", t.join(''), "'"), e.push('>')
				}
				return (
					this.textContent && e.push(this.textContent),
					this.type != 'fragment' && e.push('</', this.type, '>'),
					e.join('')
				)
			})
		var l = {
				createTextNode: function (e, t) {
					return a(e)
				},
				createElement: function (e) {
					return new f(e)
				},
				createFragment: function () {
					return new f('fragment')
				},
			},
			c = function () {
				;(this.config = {}), (this.dom = l)
			}
		c.prototype = i.prototype
		var h = function (e, t, n) {
			var r = e.className.match(/lang-(\w+)/),
				i = t.mode || (r && 'ace/mode/' + r[1])
			if (!i) return !1
			var s = t.theme || 'ace/theme/textmate',
				o = '',
				a = []
			if (e.firstElementChild) {
				var f = 0
				for (var l = 0; l < e.childNodes.length; l++) {
					var c = e.childNodes[l]
					c.nodeType == 3 ? ((f += c.data.length), (o += c.data)) : a.push(f, c)
				}
			} else (o = e.textContent), t.trim && (o = o.trim())
			h.render(o, i, s, t.firstLineNumber, !t.showGutter, function (t) {
				u.importCssString(t.css, 'ace_highlight'), (e.innerHTML = t.html)
				var r = e.firstChild.firstChild
				for (var i = 0; i < a.length; i += 2) {
					var s = t.session.doc.indexToPosition(a[i]),
						o = a[i + 1],
						f = r.children[s.row]
					f && f.appendChild(o)
				}
				n && n()
			})
		}
		;(h.render = function (e, t, n, i, s, u) {
			function c() {
				var r = h.renderSync(e, t, n, i, s)
				return u ? u(r) : r
			}
			var a = 1,
				f = r.prototype.$modes
			typeof n == 'string' &&
				(a++,
				o.loadModule(['theme', n], function (e) {
					;(n = e), --a || c()
				}))
			var l
			return (
				t && typeof t == 'object' && !t.getTokenizer && ((l = t), (t = l.path)),
				typeof t == 'string' &&
					(a++,
					o.loadModule(['mode', t], function (e) {
						if (!f[t] || l) f[t] = new e.Mode(l)
						;(t = f[t]), --a || c()
					})),
				--a || c()
			)
		}),
			(h.renderSync = function (e, t, n, i, o) {
				i = parseInt(i || 1, 10)
				var u = new r('')
				u.setUseWorker(!1), u.setMode(t)
				var a = new c()
				a.setSession(u),
					Object.keys(a.$tabStrings).forEach(function (e) {
						if (typeof a.$tabStrings[e] == 'string') {
							var t = l.createFragment()
							;(t.textContent = a.$tabStrings[e]), (a.$tabStrings[e] = t)
						}
					}),
					u.setValue(e)
				var f = u.getLength(),
					h = l.createElement('div')
				h.className = n.cssClass
				var p = l.createElement('div')
				;(p.className = 'ace_static_highlight' + (o ? '' : ' ace_show_gutter')),
					(p.style['counter-reset'] = 'ace_line ' + (i - 1))
				for (var d = 0; d < f; d++) {
					var v = l.createElement('div')
					v.className = 'ace_line'
					if (!o) {
						var m = l.createElement('span')
						;(m.className = 'ace_gutter ace_gutter-cell'), (m.textContent = ''), v.appendChild(m)
					}
					a.$renderLine(v, d, !1), (v.textContent += '\n'), p.appendChild(v)
				}
				return h.appendChild(p), { css: s + n.cssText, html: h.toString(), session: u }
			}),
			(n.exports = h),
			(n.exports.highlight = h)
	}
)
;(function () {
	ace.require(['ace/ext/static_highlight'], function (m) {
		if (typeof module == 'object' && typeof exports == 'object' && module) {
			module.exports = m
		}
	})
})()