-
Notifications
You must be signed in to change notification settings - Fork 5
/
runtime.js
79 lines (70 loc) · 1.9 KB
/
runtime.js
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
/*TMODJS:{}*/
!function () {
function a(a, b) {
return (/string|function/.test(typeof b) ? h : g)(a, b)
}
function b(a, c) {
return "string" != typeof a && (c = typeof a, "number" === c ? a += "" : a = "function" === c ? b(a.call(a)) : ""), a
}
function c(a) {
return l[a]
}
function d(a) {
return b(a).replace(/&(?![\w#]+;)|[<>"']/g, c)
}
function e(a, b) {
if (m(a))for (var c = 0, d = a.length; d > c; c++)b.call(a, a[c], c, a); else for (c in a)b.call(a, a[c], c)
}
function f(a, b) {
var c = /(\/)[^\/]+\1\.\.\1/, d = ("./" + a).replace(/[^\/]+$/, ""), e = d + b;
for (e = e.replace(/\/\.\//g, "/"); e.match(c);)e = e.replace(c, "/");
return e
}
function g(b, c) {
var d = a.get(b) || i({filename: b, name: "Render Error", message: "Template not found"});
return c ? d(c) : d
}
function h(a, b) {
if ("string" == typeof b) {
var c = b;
b = function () {
return new k(c)
}
}
var d = j[a] = function (c) {
try {
return new b(c, a) + ""
} catch (d) {
return i(d)()
}
};
return d.prototype = b.prototype = n, d.toString = function () {
return b + ""
}, d
}
function i(a) {
var b = "{Template Error}", c = a.stack || "";
if (c)c = c.split("\n").slice(0, 2).join("\n"); else for (var d in a)c += "<" + d + ">\n" + a[d] + "\n\n";
return function () {
return "object" == typeof console && console.error(b + "\n\n" + c), b
}
}
var j = a.cache = {}, k = this.String, l = {
"<": "<",
">": ">",
'"': """,
"'": "'",
"&": "&"
}, m = Array.isArray || function (a) {
return "[object Array]" === {}.toString.call(a)
}, n = a.utils = {
$helpers: {}, $include: function (a, b, c) {
return a = f(c, a), g(a, b)
}, $string: b, $escape: d, $each: e
}, o = a.helpers = n.$helpers;
a.get = function (a) {
return j[a.replace(/^\.\//, "")]
}, a.helper = function (a, b) {
o[a] = b
}, module.exports = a
}();