PageSourceSearch

https://faylib.org/js/lib/json3.min.js?v=1480

js faylib.org collected 2026-09-24 09:56:43 UTC 12,674 bytes, 409 lines download raw bytes

1/*! JSON v3.3.0 | http://bestiejs.github.io/json3 | Copyright 2012-2014, Kit Cambridge | http://kit.mit-license.org */
2(function(n) {
3	function K(p, q) {
4		function s(a) {
5			if (s[a] !== v) return s[a];
6			var c;
7			if ("bug-string-char-index" == a) c = "a" != "a" [0];
8			else if ("json" == a) c = s("json-stringify") && s("json-parse");
9			else {
10				var e;
11				if ("json-stringify" == a) {
12					c = q.stringify;
13					var b = "function" == typeof c && r;
14					if (b) {
15						(e = function() {
16							return 1
17						}).toJSON = e;
18						try {
19							b = "0" === c(0) && "0" === c(new A) && '""' == c(new B) && c(t) === v && c(v) === v && c() === v && "1" === c(e) && "[1]" == c([e]) && "[null]" == c([v]) && "null" == c(null) && "[null,null,null]" == c([v, t, null]) && '{"a":[1,true,false,null,"\\u0000\\b\\n\\f\\r\\t"]}' ==
20								c({
21									a: [e, !0, !1, null, "\x00\b\n\f\r\t"]
22								}) && "1" === c(null, e) && "[\n 1,\n 2\n]" == c([1, 2], null, 1) && '"-271821-04-20T00:00:00.000Z"' == c(new D(-864E13)) && '"+275760-09-13T00:00:00.000Z"' == c(new D(864E13)) && '"-000001-01-01T00:00:00.000Z"' == c(new D(-621987552E5)) && '"1969-12-31T23:59:59.999Z"' == c(new D(-1))
23						} catch (f) {
24							b = !1
25						}
26					}
27					c = b
28				}
29				if ("json-parse" == a) {
30					c = q.parse;
31					if ("function" == typeof c) try {
32						if (0 === c("0") && !c(!1)) {
33							e = c('{"a":[1,true,false,null,"\\u0000\\b\\n\\f\\r\\t"]}');
34							var l = 5 == e.a.length && 1 === e.a[0];
35							if (l) {
36								try {
37									l = !c('"\t"')
38								} catch (d) {}
39								if (l) try {
40									l =
41										1 !== c("01")
42								} catch (h) {}
43								if (l) try {
44									l = 1 !== c("1.")
45								} catch (m) {}
46							}
47						}
48					} catch (X) {
49						l = !1
50					}
51					c = l
52				}
53			}
54			return s[a] = !!c
55		}
56		p || (p = n.Object());
57		q || (q = n.Object());
58		var A = p.Number || n.Number,
59			B = p.String || n.String,
60			G = p.Object || n.Object,
61			D = p.Date || n.Date,
62			J = p.SyntaxError || n.SyntaxError,
63			N = p.TypeError || n.TypeError,
64			R = p.Math || n.Math,
65			H = p.JSON || n.JSON;
66		"object" == typeof H && H && (q.stringify = H.stringify, q.parse = H.parse);
67		var G = G.prototype,
68			t = G.toString,
69			u, C, v, r = new D(-0xc782b5b800cec);
70		try {
71			r = -109252 == r.getUTCFullYear() && 0 === r.getUTCMonth() && 1 === r.getUTCDate() &&
72				10 == r.getUTCHours() && 37 == r.getUTCMinutes() && 6 == r.getUTCSeconds() && 708 == r.getUTCMilliseconds()
73		} catch (Y) {}
74		if (!s("json")) {
75			var E = s("bug-string-char-index");
76			if (!r) var w = R.floor,
77				S = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334],
78				F = function(a, c) {
79					return S[c] + 365 * (a - 1970) + w((a - 1969 + (c = +(1 < c))) / 4) - w((a - 1901 + c) / 100) + w((a - 1601 + c) / 400)
80				};
81			(u = G.hasOwnProperty) || (u = function(a) {
82				var c = {},
83					e;
84				(c.__proto__ = null, c.__proto__ = {
85					toString: 1
86				}, c).toString != t ? u = function(a) {
87					var c = this.__proto__;
88					a = a in (this.__proto__ = null, this);
89					this.__proto__ =
90						c;
91					return a
92				} : (e = c.constructor, u = function(a) {
93					var c = (this.constructor || e).prototype;
94					return a in this && !(a in c && this[a] === c[a])
95				});
96				c = null;
97				return u.call(this, a)
98			});
99			var T = {
100				"boolean": 1,
101				number: 1,
102				string: 1,
103				undefined: 1
104			};
105			C = function(a, c) {
106				var e = 0,
107					b, f, l;
108				(b = function() {
109					this.valueOf = 0
110				}).prototype.valueOf = 0;
111				f = new b;
112				for (l in f) u.call(f, l) && e++;
113				b = f = null;
114				e ? C = 2 == e ? function(a, c) {
115					var e = {},
116						b = "[object Function]" == t.call(a),
117						f;
118					for (f in a) b && "prototype" == f || u.call(e, f) || !(e[f] = 1) || !u.call(a, f) || c(f)
119				} : function(a, c) {
120					var e = "[object Function]" ==
121						t.call(a),
122						b, f;
123					for (b in a) e && "prototype" == b || !u.call(a, b) || (f = "constructor" === b) || c(b);
124					(f || u.call(a, b = "constructor")) && c(b)
125				} : (f = "valueOf toString toLocaleString propertyIsEnumerable isPrototypeOf hasOwnProperty constructor".split(" "), C = function(a, c) {
126					var e = "[object Function]" == t.call(a),
127						b, g;
128					if (g = !e)
129						if (g = "function" != typeof a.constructor) g = typeof a.hasOwnProperty, g = "object" == g ? !!a.hasOwnProperty : !T[g];
130					g = g ? a.hasOwnProperty : u;
131					for (b in a) e && "prototype" == b || !g.call(a, b) || c(b);
132					for (e = f.length; b = f[--e]; g.call(a,
133						b) && c(b));
134				});
135				return C(a, c)
136			};
137			if (!s("json-stringify")) {
138				var U = {
139						92: "\\\\",
140						34: '\\"',
141						8: "\\b",
142						12: "\\f",
143						10: "\\n",
144						13: "\\r",
145						9: "\\t"
146					},
147					x = function(a, c) {
148						return ("000000" + (c || 0)).slice(-a)
149					},
150					O = function(a) {
151						for (var c = '"', b = 0, g = a.length, f = !E || 10 < g, l = f && (E ? a.split("") : a); b < g; b++) {
152							var d = a.charCodeAt(b);
153							switch (d) {
154								case 8:
155								case 9:
156								case 10:
157								case 12:
158								case 13:
159								case 34:
160								case 92:
161									c += U[d];
162									break;
163								default:
164									if (32 > d) {
165										c += "\\u00" + x(2, d.toString(16));
166										break
167									}
168									c += f ? l[b] : a.charAt(b)
169							}
170						}
171						return c + '"'
172					},
173					L = function(a, c, b, g, f, l, d) {
174						var h, m, k, n, p, q, r, s, y;
175						try {
176							h =
177								c[a]
178						} catch (z) {}
179						if ("object" == typeof h && h)
180							if (m = t.call(h), "[object Date]" != m || u.call(h, "toJSON")) "function" == typeof h.toJSON && ("[object Number]" != m && "[object String]" != m && "[object Array]" != m || u.call(h, "toJSON")) && (h = h.toJSON(a));
181							else if (h > -1 / 0 && h < 1 / 0) {
182							if (F) {
183								n = w(h / 864E5);
184								for (m = w(n / 365.2425) + 1970 - 1; F(m + 1, 0) <= n; m++);
185								for (k = w((n - F(m, 0)) / 30.42); F(m, k + 1) <= n; k++);
186								n = 1 + n - F(m, k);
187								p = (h % 864E5 + 864E5) % 864E5;
188								q = w(p / 36E5) % 24;
189								r = w(p / 6E4) % 60;
190								s = w(p / 1E3) % 60;
191								p %= 1E3
192							}
192 else m = h.getUTCFullYear(), k = h.getUTCMonth(), n = h.getUTCDate(),
193								q = h.getUTCHours(), r = h.getUTCMinutes(), s = h.getUTCSeconds(), p = h.getUTCMilliseconds();
194							h = (0 >= m || 1E4 <= m ? (0 > m ? "-" : "+") + x(6, 0 > m ? -m : m) : x(4, m)) + "-" + x(2, k + 1) + "-" + x(2, n) + "T" + x(2, q) + ":" + x(2, r) + ":" + x(2, s) + "." + x(3, p) + "Z"
195						} else h = null;
196						b && (h = b.call(c, a, h));
197						if (null === h) return "null";
198						m = t.call(h);
199						if ("[object Boolean]" == m) return "" + h;
200						if ("[object Number]" == m) return h > -1 / 0 && h < 1 / 0 ? "" + h : "null";
201						if ("[object String]" == m) return O("" + h);
202						if ("object" == typeof h) {
203							for (a = d.length; a--;)
204								if (d[a] === h) throw N();
205							d.push(h);
206							y = [];
207							c = l;
208							l += f;
209							if ("[object Array]" ==
210								m) {
211								k = 0;
212								for (a = h.length; k < a; k++) m = L(k, h, b, g, f, l, d), y.push(m === v ? "null" : m);
213								a = y.length ? f ? "[\n" + l + y.join(",\n" + l) + "\n" + c + "]" : "[" + y.join(",") + "]" : "[]"
214							} else C(g || h, function(a) {
215								var c = L(a, h, b, g, f, l, d);
216								c !== v && y.push(O(a) + ":" + (f ? " " : "") + c)
217							}), a = y.length ? f ? "{\n" + l + y.join(",\n" + l) + "\n" + c + "}" : "{" + y.join(",") + "}" : "{}";
218							d.pop();
219							return a
220						}
221					};
222				q.stringify = function(a, c, b) {
223					var g, f, l, d;
224					if ("function" == typeof c || "object" == typeof c && c)
225						if ("[object Function]" == (d = t.call(c))) f = c;
226						else if ("[object Array]" == d) {
227						l = {};
228						for (var h = 0, m = c.length,
229							k; h < m; k = c[h++], (d = t.call(k), "[object String]" == d || "[object Number]" == d) && (l[k] = 1));
230					}
231					if (b)
232						if ("[object Number]" == (d = t.call(b))) {
233							if (0 < (b -= b % 1))
234								for (g = "", 10 < b && (b = 10); g.length < b; g += " ");
235						} else "[object String]" == d && (g = 10 >= b.length ? b : b.slice(0, 10));
236					return L("", (k = {}, k[""] = a, k), f, l, g, "", [])
237				}
238			}
239			if (!s("json-parse")) {
240				var V = B.fromCharCode,
241					W = {
242						92: "\\",
243						34: '"',
244						47: "/",
245						98: "\b",
246						116: "\t",
247						110: "\n",
248						102: "\f",
249						114: "\r"
250					},
251					b, I, k = function() {
252						b = I = null;
253						throw J();
254					},
255					z = function() {
256						for (var a = I, c = a.length, e, g, f, l, d; b < c;) switch (d = a.charCodeAt(b),
257							d) {
258							case 9:
259							case 10:
260							case 13:
261							case 32:
262								b++;
263								break;
264							case 123:
265							case 125:
266							case 91:
267							case 93:
268							case 58:
269							case 44:
270								return e = E ? a.charAt(b) : a[b], b++, e;
271							case 34:
272								e = "@";
273								for (b++; b < c;)
274									if (d = a.charCodeAt(b), 32 > d) k();
275									else if (92 == d) switch (d = a.charCodeAt(++b), d) {
276									case 92:
277									case 34:
278									case 47:
279									case 98:
280									case 116:
281									case 110:
282									case 102:
283									case 114:
284										e += W[d];
285										b++;
286										break;
287									case 117:
288										g = ++b;
289										for (f = b + 4; b < f; b++) d = a.charCodeAt(b), 48 <= d && 57 >= d || 97 <= d && 102 >= d || 65 <= d && 70 >= d || k();
290										e += V("0x" + a.slice(g, b));
291										break;
292									default:
293										k()
294								} else {
295									if (34 == d) break;
296									d = a.charCodeAt(b);
297									for (g = b; 32 <=
298										d && 92 != d && 34 != d;) d = a.charCodeAt(++b);
299									e += a.slice(g, b)
300								} if (34 == a.charCodeAt(b)) return b++, e;
301								k();
302							default:
303								g = b;
304								45 == d && (l = !0, d = a.charCodeAt(++b));
305								if (48 <= d && 57 >= d) {
306									for (48 == d && (d = a.charCodeAt(b + 1), 48 <= d && 57 >= d) && k(); b < c && (d = a.charCodeAt(b), 48 <= d && 57 >= d); b++);
307									if (46 == a.charCodeAt(b)) {
308										for (f = ++b; f < c && (d = a.charCodeAt(f), 48 <= d && 57 >= d); f++);
309										f == b && k();
310										b = f
311									}
312									d = a.charCodeAt(b);
313									if (101 == d || 69 == d) {
314										d = a.charCodeAt(++b);
315										43 != d && 45 != d || b++;
316										for (f = b; f < c && (d = a.charCodeAt(f), 48 <= d && 57 >= d); f++);
317										f == b && k();
318										b = f
319									}
320									return +a.slice(g, b)
321								}
322								l &&
323									k();
324								if ("true" == a.slice(b, b + 4)) return b += 4, !0;
325								if ("false" == a.slice(b, b + 5)) return b += 5, !1;
326								if ("null" == a.slice(b, b + 4)) return b += 4, null;
327								k()
328						}
329						return "$"
330					},
331					M = function(a) {
332						var c, b;
333						"$" == a && k();
334						if ("string" == typeof a) {
335							if ("@" == (E ? a.charAt(0) : a[0])) return a.slice(1);
336							if ("[" == a) {
337								for (c = [];; b || (b = !0)) {
338									a = z();
339									if ("]" == a) break;
340									b && ("," == a ? (a = z(), "]" == a && k()) : k());
341									"," == a && k();
342									c.push(M(a))
343								}
344								return c
345							}
346							if ("{" == a) {
347								for (c = {};; b || (b = !0)) {
348									a = z();
349									if ("}" == a) break;
350									b && ("," == a ? (a = z(), "}" == a && k()) : k());
351									"," != a && "string" == typeof a && "@" == (E ? a.charAt(0) :
352										a[0]) && ":" == z() || k();
353									c[a.slice(1)] = M(z())
354								}
355								return c
356							}
357							k()
358						}
359						return a
360					},
361					Q = function(a, b, e) {
362						e = P(a, b, e);
363						e === v ? delete a[b] : a[b] = e
364					},
365					P = function(a, b, e) {
366						var g = a[b],
367							f;
368						if ("object" == typeof g && g)
369							if ("[object Array]" == t.call(g))
370								for (f = g.length; f--;) Q(g, f, e);
371							else C(g, function(a) {
372								Q(g, a, e)
373							});
374						return e.call(a, b, g)
375					};
376				q.parse = function(a, c) {
377					var e, g;
378					b = 0;
379					I = "" + a;
380					e = M(z());
381					"$" != z() && k();
382					b = I = null;
383					return c && "[object Function]" == t.call(c) ? P((g = {}, g[""] = e, g), "", c) : e
384				}
385			}
386		}
387		q.runInContext = K;
388		return q
389	}
390	var J = typeof define === "function" && define.amd,
391		A = "object" == typeof global && global;
392	!A || A.global !== A && A.window !== A || (n = A);
393	if ("object" != typeof exports || !exports || exports.nodeType || J) {
394		var N = n.JSON,
395			B = K(n, n.JSON3 = {
396				noConflict: function() {
397					n.JSON = N;
398					return B
399				}
400			});
401		n.JSON = {
402			parse: B.parse,
403			stringify: B.stringify
404		}
405	}
405 else K(n, exports);
406	J && define(function() {
407		return B
408	})
409})(this);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.