! function() {
var e = '/* Syntax highlighting for JSON objects */ .json-editor-blackbord { background: #1c2833; color: #fff; font-size: 13px; font-family: Menlo,Monaco,Consolas,"Courier New",monospace; } @media screen and (min-width: 1600px) { .json-editor-blackbord { font-size: 14px; } } ul.json-dict, ol.json-array { list-style-type: none; margin: 0 0 0 1px; border-left: 1px dotted #525252; padding-left: 2em; } .json-string { /*color: #0B7500;*/ /*color: #BCCB86;*/ color: #0ad161; } .json-literal { /*color: #1A01CC;*/ /*font-weight: bold;*/ color: #ff8c00; } .json-url { color: #1e90ff; } .json-property { color: #4fdee5; line-height: 160%; font-weight: 500; } /* Toggle button */ a.json-toggle { position: relative; color: inherit; text-decoration: none; cursor: pointer; } a.json-toggle:focus { outline: none; } a.json-toggle:before { color: #aaa; content: "\\25BC"; /* down arrow */ position: absolute; display: inline-block; width: 1em; left: -1em; } a.json-toggle.collapsed:before { transform: rotate(-90deg); /* Use rotated down arrow, prevents right arrow appearing smaller than down arrow in some browsers */ -ms-transform: rotate(-90deg); -webkit-transform: rotate(-90deg); } /* Collapsable placeholder links */ a.json-placeholder { color: #aaa; padding: 0 1em; text-decoration: none; cursor: pointer; } a.json-placeholder:hover { text-decoration: underline; }',
o = function(e) {
var o = document.getElementsByTagName("head")[0],
t = document.createElement("style");
if (o.appendChild(t), t.styleSheet) t.styleSheet.disabled || (t.styleSheet.cssText = e);
else try {
t.innerHTML = e
} catch (n) {
t.innerText = e
}
};
o(e)
}(),
function(e) {
function o(e) {
return e instanceof Object && Object.keys(e).length > 0
}
function t(e) {
var o = /^(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/;
return o.test(e)
}
function n(e, r) {
var s = "";
if ("string" == typeof e) e = e.replace(/&/g, "&").replace(//g, ">"), s += t(e) ? '"' + e + '"' : '"' + e + '"';
else if ("number" == typeof e) s += '' + e + "";
else if ("boolean" == typeof e) s += '' + e + "";
else if (null === e) s += 'null';
else if (e instanceof Array)
if (e.length > 0) {
s += '[
';
for (var l = 0; l < e.length; ++l) s += "- ", o(e[l]) && (s += ''), s += n(e[l], r), l < e.length - 1 && (s += ","), s += "
";
s += "
]"
} else s += "[]";
else if ("object" == typeof e) {
if (e['_type'] && (e['_type'].value === 'real' || e['_type'].value === 'int')) {
e._value = e._value.toNumber();
}
var a = Object.keys(e).length;
if (a > 0) {
s += '{';
for (var i in e)
if (e.hasOwnProperty(i)) {
s += "- ";
var c = r.withQuotes ? '"' + i + '"' : '' + i + "";
s += o(e[i]) ? '' + c : c, s += ": " + n(e[i], r), --a > 0 && (s += ","), s += "
"
}
s += "
}"
} else s += "{}"
} else if ('symbol' == typeof e) {
s += '"' + e.toString() + '"';
}
return s
}
e.fn.jsonViewer = function(t, r) {
return r = r || {}, this.each(function() {
var s = n(t, r);
o(t) && (s = '' + s), e(this).html(s), e(this).off("click"), e(this).on("click", "a.json-toggle", function() {
var o = e(this).toggleClass("collapsed").siblings("ul.json-dict, ol.json-array");
if (o.toggle(), o.is(":visible")) o.siblings(".json-placeholder").remove();
else {
var t = o.children("li").length,
n = t + (t > 1 ? " items" : " item");
o.after('' + n + "")
}
return !1
}), e(this).on("click", "a.json-placeholder", function() {
return e(this).siblings("a.json-toggle").click(), !1
}), 1 == r.collapsed && e(this).find("a.json-toggle").click()
})
}
}(jQuery),
function(e) {
function o(e) {
var o = {
'"': '\\"',
"\\": "\\\\",
"\b": "\\b",
"\f": "\\f",
"\n": "\\n",
"\r": "\\r",
" ": "\\t"
};
return e.replace(/["\\\b\f\n\r\t]/g, function(e) {
return o[e]
})
}
function t(e) {
if ("string" == typeof e) return o(e);
if ("object" == typeof e)
for (var n in e) e[n] = t(e[n]);
else if (Array.isArray(e))
for (var r = 0; r < e.length; r++) e[r] = t(e[r]);
return e
}
function n(o, t, n) {
n = n || {}, n.editable !== !1 && (n.editable = !0), this.$container = e(o), this.options = n, this.load(t)
}
n.prototype = {
constructor: n,
load: function(e) {
this.$container.jsonViewer(t(e), {
collapsed: this.options.defaultCollapsed,
withQuotes: !0
}).addClass("json-editor-blackbord").attr("contenteditable", !!this.options.editable)
},
get: function() {
try {
return this.$container.find(".collapsed").click(), JSON.parse(this.$container.text())
} catch (e) {
throw new Error(e)
}
}
}, window.JsonEditor = n
}(jQuery);