dynamodb-admin-vperi-fork
Version:
GUI for DynamoDB. Useful for local development.
418 lines • 31 kB
JavaScript
window.JSONFormatter = function(modules) {
function __webpack_require__(moduleId) {
if (installedModules[moduleId]) return installedModules[moduleId].exports;
var module = installedModules[moduleId] = {
i: moduleId,
l: !1,
exports: {}
};
return modules[moduleId].call(module.exports, module, module.exports, __webpack_require__),
module.l = !0, module.exports;
}
var installedModules = {};
return __webpack_require__.m = modules, __webpack_require__.c = installedModules,
__webpack_require__.i = function(value) {
return value;
}, __webpack_require__.d = function(exports, name, getter) {
__webpack_require__.o(exports, name) || Object.defineProperty(exports, name, {
configurable: !1,
enumerable: !0,
get: getter
});
}, __webpack_require__.n = function(module) {
var getter = module && module.__esModule ? function() {
return module.default;
} : function() {
return module;
};
return __webpack_require__.d(getter, "a", getter), getter;
}, __webpack_require__.o = function(object, property) {
return Object.prototype.hasOwnProperty.call(object, property);
}, __webpack_require__.p = "dist", __webpack_require__(__webpack_require__.s = 6);
}([ function(module, __webpack_exports__, __webpack_require__) {
"use strict";
Object.defineProperty(__webpack_exports__, "__esModule", {
value: !0
});
var __WEBPACK_IMPORTED_MODULE_0__helpers__ = __webpack_require__(5), __WEBPACK_IMPORTED_MODULE_1__style_less__ = __webpack_require__(4), DATE_STRING_REGEX = (__webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1__style_less__),
/(^\d{1,4}[\.|\\\/|-]\d{1,2}[\.|\\\/|-]\d{1,4})(\s*(?:0?[1-9]:[0-5]|1(?=[012])\d:[0-5])\d\s*[ap]m)?$/), PARTIAL_DATE_REGEX = /\d{2}:\d{2}:\d{2} GMT-\d{4}/, JSON_DATE_REGEX = /\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}Z/, requestAnimationFrame = window.requestAnimationFrame || function(cb) {
return cb(), 0;
}, _defaultConfig = {
hoverPreviewEnabled: !1,
hoverPreviewArrayCount: 100,
hoverPreviewFieldCount: 5,
animateOpen: !0,
animateClose: !0,
theme: null,
useToJSON: !0,
sortPropertiesBy: null
}, JSONFormatter = function() {
function JSONFormatter(json, open, config, key) {
void 0 === open && (open = 1), void 0 === config && (config = _defaultConfig), this.json = json,
this.open = open, this.config = config, this.key = key, this._isOpen = null, void 0 === this.config.hoverPreviewEnabled && (this.config.hoverPreviewEnabled = _defaultConfig.hoverPreviewEnabled),
void 0 === this.config.hoverPreviewArrayCount && (this.config.hoverPreviewArrayCount = _defaultConfig.hoverPreviewArrayCount),
void 0 === this.config.hoverPreviewFieldCount && (this.config.hoverPreviewFieldCount = _defaultConfig.hoverPreviewFieldCount),
void 0 === this.config.useToJSON && (this.config.useToJSON = _defaultConfig.useToJSON);
}
return Object.defineProperty(JSONFormatter.prototype, "isOpen", {
get: function() {
return null !== this._isOpen ? this._isOpen : this.open > 0;
},
set: function(value) {
this._isOpen = value;
},
enumerable: !0,
configurable: !0
}), Object.defineProperty(JSONFormatter.prototype, "isDate", {
get: function() {
return this.json instanceof Date || "string" === this.type && (DATE_STRING_REGEX.test(this.json) || JSON_DATE_REGEX.test(this.json) || PARTIAL_DATE_REGEX.test(this.json));
},
enumerable: !0,
configurable: !0
}), Object.defineProperty(JSONFormatter.prototype, "isUrl", {
get: function() {
return "string" === this.type && 0 === this.json.indexOf("http");
},
enumerable: !0,
configurable: !0
}), Object.defineProperty(JSONFormatter.prototype, "isArray", {
get: function() {
return Array.isArray(this.json);
},
enumerable: !0,
configurable: !0
}), Object.defineProperty(JSONFormatter.prototype, "isObject", {
get: function() {
return __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__helpers__.a)(this.json);
},
enumerable: !0,
configurable: !0
}), Object.defineProperty(JSONFormatter.prototype, "isEmptyObject", {
get: function() {
return !this.keys.length && !this.isArray;
},
enumerable: !0,
configurable: !0
}), Object.defineProperty(JSONFormatter.prototype, "isEmpty", {
get: function() {
return this.isEmptyObject || this.keys && !this.keys.length && this.isArray;
},
enumerable: !0,
configurable: !0
}), Object.defineProperty(JSONFormatter.prototype, "useToJSON", {
get: function() {
return this.config.useToJSON && "stringifiable" === this.type;
},
enumerable: !0,
configurable: !0
}), Object.defineProperty(JSONFormatter.prototype, "hasKey", {
get: function() {
return void 0 !== this.key;
},
enumerable: !0,
configurable: !0
}), Object.defineProperty(JSONFormatter.prototype, "constructorName", {
get: function() {
return __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__helpers__.b)(this.json);
},
enumerable: !0,
configurable: !0
}), Object.defineProperty(JSONFormatter.prototype, "type", {
get: function() {
return null === this.json ? "null" : this.config.useToJSON && this.json && this.json.toJSON ? "stringifiable" : typeof this.json;
},
enumerable: !0,
configurable: !0
}), Object.defineProperty(JSONFormatter.prototype, "keys", {
get: function() {
if (this.isObject) {
var keys = Object.keys(this.json).map(function(key) {
return key || '""';
});
return !this.isArray && this.config.sortPropertiesBy ? keys.sort(this.config.sortPropertiesBy) : keys;
}
return [];
},
enumerable: !0,
configurable: !0
}), JSONFormatter.prototype.toggleOpen = function() {
this.isOpen = !this.isOpen, this.element && (this.isOpen ? this.appendChildren(this.config.animateOpen) : this.removeChildren(this.config.animateClose),
this.element.classList.toggle(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__helpers__.c)("open")));
}, JSONFormatter.prototype.openAtDepth = function(depth) {
void 0 === depth && (depth = 1), depth < 0 || (this.open = depth, this.isOpen = 0 !== depth,
this.element && (this.removeChildren(!1), 0 === depth ? this.element.classList.remove(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__helpers__.c)("open")) : (this.appendChildren(this.config.animateOpen),
this.element.classList.add(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__helpers__.c)("open")))));
}, JSONFormatter.prototype.getInlinepreview = function() {
var _this = this;
if (this.isArray) return this.json.length > this.config.hoverPreviewArrayCount ? "Array[" + this.json.length + "]" : "[" + this.json.map(__WEBPACK_IMPORTED_MODULE_0__helpers__.d).join(", ") + "]";
var keys = this.keys, narrowKeys = keys.slice(0, this.config.hoverPreviewFieldCount), kvs = narrowKeys.map(function(key) {
return key + ":" + __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__helpers__.d)(_this.type, _this.json[key]);
}), ellipsis = keys.length >= this.config.hoverPreviewFieldCount ? "…" : "";
return "{" + kvs.join(", ") + ellipsis + "}";
}, JSONFormatter.prototype.render = function() {
this.element = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__helpers__.e)("div", "row");
var togglerLink = this.isObject ? __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__helpers__.e)("a", "toggler-link") : __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__helpers__.e)("span");
if (this.isObject && !this.useToJSON && togglerLink.appendChild(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__helpers__.e)("span", "toggler")),
this.hasKey && togglerLink.appendChild(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__helpers__.e)("span", "key", this.key + ":")),
this.isObject && !this.useToJSON) {
var value = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__helpers__.e)("span", "value"), objectWrapperSpan = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__helpers__.e)("span"), constructorName = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__helpers__.e)("span", "constructor-name", this.constructorName);
if (objectWrapperSpan.appendChild(constructorName), this.isArray) {
var arrayWrapperSpan = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__helpers__.e)("span");
arrayWrapperSpan.appendChild(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__helpers__.e)("span", "bracket", "[")),
arrayWrapperSpan.appendChild(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__helpers__.e)("span", "number", this.json.length)),
arrayWrapperSpan.appendChild(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__helpers__.e)("span", "bracket", "]")),
objectWrapperSpan.appendChild(arrayWrapperSpan);
}
value.appendChild(objectWrapperSpan), togglerLink.appendChild(value);
} else {
var value = this.isUrl ? __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__helpers__.e)("a") : __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__helpers__.e)("span");
value.classList.add(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__helpers__.c)(this.type)),
this.isDate && value.classList.add(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__helpers__.c)("date")),
this.isUrl && (value.classList.add(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__helpers__.c)("url")),
value.setAttribute("href", this.json));
var valuePreview = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__helpers__.f)(this.type, this.json, this.useToJSON ? this.json.toJSON() : this.json);
value.appendChild(document.createTextNode(valuePreview)), togglerLink.appendChild(value);
}
if (this.isObject && this.config.hoverPreviewEnabled) {
var preview = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__helpers__.e)("span", "preview-text");
preview.appendChild(document.createTextNode(this.getInlinepreview())), togglerLink.appendChild(preview);
}
var children = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__helpers__.e)("div", "children");
return this.isObject && children.classList.add(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__helpers__.c)("object")),
this.isArray && children.classList.add(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__helpers__.c)("array")),
this.isEmpty && children.classList.add(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__helpers__.c)("empty")),
this.config && this.config.theme && this.element.classList.add(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__helpers__.c)(this.config.theme)),
this.isOpen && this.element.classList.add(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__helpers__.c)("open")),
this.element.appendChild(togglerLink), this.element.appendChild(children), this.isObject && this.isOpen && this.appendChildren(),
this.isObject && !this.useToJSON && togglerLink.addEventListener("click", this.toggleOpen.bind(this)),
this.element;
}, JSONFormatter.prototype.appendChildren = function(animated) {
var _this = this;
void 0 === animated && (animated = !1);
var children = this.element.querySelector("div." + __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__helpers__.c)("children"));
if (children && !this.isEmpty) if (animated) {
var index_1 = 0, addAChild_1 = function() {
var key = _this.keys[index_1], formatter = new JSONFormatter(_this.json[key], _this.open - 1, _this.config, key);
children.appendChild(formatter.render()), (index_1 += 1) < _this.keys.length && (index_1 > 10 ? addAChild_1() : requestAnimationFrame(addAChild_1));
};
requestAnimationFrame(addAChild_1);
} else this.keys.forEach(function(key) {
var formatter = new JSONFormatter(_this.json[key], _this.open - 1, _this.config, key);
children.appendChild(formatter.render());
});
}, JSONFormatter.prototype.removeChildren = function(animated) {
void 0 === animated && (animated = !1);
var childrenElement = this.element.querySelector("div." + __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__helpers__.c)("children"));
if (animated) {
var childrenRemoved_1 = 0, removeAChild_1 = function() {
childrenElement && childrenElement.children.length && (childrenElement.removeChild(childrenElement.children[0]),
childrenRemoved_1 += 1, childrenRemoved_1 > 10 ? removeAChild_1() : requestAnimationFrame(removeAChild_1));
};
requestAnimationFrame(removeAChild_1);
} else childrenElement && (childrenElement.innerHTML = "");
}, JSONFormatter;
}();
__webpack_exports__.default = JSONFormatter;
}, function(module, exports, __webpack_require__) {
exports = module.exports = __webpack_require__(2)(), exports.push([ module.i, '.json-formatter-row {\n font-family: monospace;\n}\n.json-formatter-row,\n.json-formatter-row a,\n.json-formatter-row a:hover {\n color: black;\n text-decoration: none;\n}\n.json-formatter-row .json-formatter-row {\n margin-left: 1rem;\n}\n.json-formatter-row .json-formatter-children.json-formatter-empty {\n opacity: 0.5;\n margin-left: 1rem;\n}\n.json-formatter-row .json-formatter-children.json-formatter-empty:after {\n display: none;\n}\n.json-formatter-row .json-formatter-children.json-formatter-empty.json-formatter-object:after {\n content: "No properties";\n}\n.json-formatter-row .json-formatter-children.json-formatter-empty.json-formatter-array:after {\n content: "[]";\n}\n.json-formatter-row .json-formatter-string,\n.json-formatter-row .json-formatter-stringifiable {\n color: green;\n white-space: pre;\n word-wrap: break-word;\n}\n.json-formatter-row .json-formatter-number {\n color: blue;\n}\n.json-formatter-row .json-formatter-boolean {\n color: red;\n}\n.json-formatter-row .json-formatter-null {\n color: #855A00;\n}\n.json-formatter-row .json-formatter-undefined {\n color: #ca0b69;\n}\n.json-formatter-row .json-formatter-function {\n color: #FF20ED;\n}\n.json-formatter-row .json-formatter-date {\n background-color: rgba(0, 0, 0, 0.05);\n}\n.json-formatter-row .json-formatter-url {\n text-decoration: underline;\n color: blue;\n cursor: pointer;\n}\n.json-formatter-row .json-formatter-bracket {\n color: blue;\n}\n.json-formatter-row .json-formatter-key {\n padding-right: 0.2rem;\n}\n.json-formatter-row .json-formatter-toggler-link {\n cursor: pointer;\n}\n.json-formatter-row .json-formatter-toggler {\n line-height: 1.2rem;\n font-size: 0.7rem;\n vertical-align: middle;\n opacity: 0.6;\n cursor: pointer;\n padding-right: 0.2rem;\n}\n.json-formatter-row .json-formatter-toggler:after {\n display: inline-block;\n transition: transform 100ms ease-in;\n content: "\\25BA";\n}\n.json-formatter-row > a > .json-formatter-preview-text {\n opacity: 0;\n transition: opacity 0.15s ease-in;\n font-style: italic;\n}\n.json-formatter-row:hover > a > .json-formatter-preview-text {\n opacity: 0.6;\n}\n.json-formatter-row.json-formatter-open > .json-formatter-toggler-link .json-formatter-toggler:after {\n transform: rotate(90deg);\n}\n.json-formatter-row.json-formatter-open > .json-formatter-children:after {\n display: inline-block;\n}\n.json-formatter-row.json-formatter-open > a > .json-formatter-preview-text {\n display: none;\n}\n.json-formatter-row.json-formatter-open.json-formatter-empty:after {\n display: block;\n}\n.json-formatter-dark.json-formatter-row {\n font-family: monospace;\n}\n.json-formatter-dark.json-formatter-row,\n.json-formatter-dark.json-formatter-row a,\n.json-formatter-dark.json-formatter-row a:hover {\n color: white;\n text-decoration: none;\n}\n.json-formatter-dark.json-formatter-row .json-formatter-row {\n margin-left: 1rem;\n}\n.json-formatter-dark.json-formatter-row .json-formatter-children.json-formatter-empty {\n opacity: 0.5;\n margin-left: 1rem;\n}\n.json-formatter-dark.json-formatter-row .json-formatter-children.json-formatter-empty:after {\n display: none;\n}\n.json-formatter-dark.json-formatter-row .json-formatter-children.json-formatter-empty.json-formatter-object:after {\n content: "No properties";\n}\n.json-formatter-dark.json-formatter-row .json-formatter-children.json-formatter-empty.json-formatter-array:after {\n content: "[]";\n}\n.json-formatter-dark.json-formatter-row .json-formatter-string,\n.json-formatter-dark.json-formatter-row .json-formatter-stringifiable {\n color: #31F031;\n white-space: pre;\n word-wrap: break-word;\n}\n.json-formatter-dark.json-formatter-row .json-formatter-number {\n color: #66C2FF;\n}\n.json-formatter-dark.json-formatter-row .json-formatter-boolean {\n color: #EC4242;\n}\n.json-formatter-dark.json-formatter-row .json-formatter-null {\n color: #EEC97D;\n}\n.json-formatter-dark.json-formatter-row .json-formatter-undefined {\n color: #ef8fbe;\n}\n.json-formatter-dark.json-formatter-row .json-formatter-function {\n color: #FD48CB;\n}\n.json-formatter-dark.json-formatter-row .json-formatter-date {\n background-color: rgba(255, 255, 255, 0.05);\n}\n.json-formatter-dark.json-formatter-row .json-formatter-url {\n text-decoration: underline;\n color: #027BFF;\n cursor: pointer;\n}\n.json-formatter-dark.json-formatter-row .json-formatter-bracket {\n color: #9494FF;\n}\n.json-formatter-dark.json-formatter-row .json-formatter-key {\n color: #23A0DB;\n padding-right: 0.2rem;\n}\n.json-formatter-dark.json-formatter-row .json-formatter-toggler-link {\n cursor: pointer;\n}\n.json-formatter-dark.json-formatter-row .json-formatter-toggler {\n line-height: 1.2rem;\n font-size: 0.7rem;\n vertical-align: middle;\n opacity: 0.6;\n cursor: pointer;\n padding-right: 0.2rem;\n}\n.json-formatter-dark.json-formatter-row .json-formatter-toggler:after {\n display: inline-block;\n transition: transform 100ms ease-in;\n content: "\\25BA";\n}\n.json-formatter-dark.json-formatter-row > a > .json-formatter-preview-text {\n opacity: 0;\n transition: opacity 0.15s ease-in;\n font-style: italic;\n}\n.json-formatter-dark.json-formatter-row:hover > a > .json-formatter-preview-text {\n opacity: 0.6;\n}\n.json-formatter-dark.json-formatter-row.json-formatter-open > .json-formatter-toggler-link .json-formatter-toggler:after {\n transform: rotate(90deg);\n}\n.json-formatter-dark.json-formatter-row.json-formatter-open > .json-formatter-children:after {\n display: inline-block;\n}\n.json-formatter-dark.json-formatter-row.json-formatter-open > a > .json-formatter-preview-text {\n display: none;\n}\n.json-formatter-dark.json-formatter-row.json-formatter-open.json-formatter-empty:after {\n display: block;\n}\n', "" ]);
}, function(module, exports) {
module.exports = function() {
var list = [];
return list.toString = function() {
for (var result = [], i = 0; i < this.length; i++) {
var item = this[i];
item[2] ? result.push("@media " + item[2] + "{" + item[1] + "}") : result.push(item[1]);
}
return result.join("");
}, list.i = function(modules, mediaQuery) {
"string" == typeof modules && (modules = [ [ null, modules, "" ] ]);
for (var alreadyImportedModules = {}, i = 0; i < this.length; i++) {
var id = this[i][0];
"number" == typeof id && (alreadyImportedModules[id] = !0);
}
for (i = 0; i < modules.length; i++) {
var item = modules[i];
"number" == typeof item[0] && alreadyImportedModules[item[0]] || (mediaQuery && !item[2] ? item[2] = mediaQuery : mediaQuery && (item[2] = "(" + item[2] + ") and (" + mediaQuery + ")"),
list.push(item));
}
}, list;
};
}, function(module, exports) {
function addStylesToDom(styles, options) {
for (var i = 0; i < styles.length; i++) {
var item = styles[i], domStyle = stylesInDom[item.id];
if (domStyle) {
domStyle.refs++;
for (var j = 0; j < domStyle.parts.length; j++) domStyle.parts[j](item.parts[j]);
for (;j < item.parts.length; j++) domStyle.parts.push(addStyle(item.parts[j], options));
} else {
for (var parts = [], j = 0; j < item.parts.length; j++) parts.push(addStyle(item.parts[j], options));
stylesInDom[item.id] = {
id: item.id,
refs: 1,
parts: parts
};
}
}
}
function listToStyles(list) {
for (var styles = [], newStyles = {}, i = 0; i < list.length; i++) {
var item = list[i], id = item[0], css = item[1], media = item[2], sourceMap = item[3], part = {
css: css,
media: media,
sourceMap: sourceMap
};
newStyles[id] ? newStyles[id].parts.push(part) : styles.push(newStyles[id] = {
id: id,
parts: [ part ]
});
}
return styles;
}
function insertStyleElement(options, styleElement) {
var head = getHeadElement(), lastStyleElementInsertedAtTop = styleElementsInsertedAtTop[styleElementsInsertedAtTop.length - 1];
if ("top" === options.insertAt) lastStyleElementInsertedAtTop ? lastStyleElementInsertedAtTop.nextSibling ? head.insertBefore(styleElement, lastStyleElementInsertedAtTop.nextSibling) : head.appendChild(styleElement) : head.insertBefore(styleElement, head.firstChild),
styleElementsInsertedAtTop.push(styleElement); else {
if ("bottom" !== options.insertAt) throw new Error("Invalid value for parameter 'insertAt'. Must be 'top' or 'bottom'.");
head.appendChild(styleElement);
}
}
function removeStyleElement(styleElement) {
styleElement.parentNode.removeChild(styleElement);
var idx = styleElementsInsertedAtTop.indexOf(styleElement);
idx >= 0 && styleElementsInsertedAtTop.splice(idx, 1);
}
function createStyleElement(options) {
var styleElement = document.createElement("style");
return styleElement.type = "text/css", insertStyleElement(options, styleElement),
styleElement;
}
function createLinkElement(options) {
var linkElement = document.createElement("link");
return linkElement.rel = "stylesheet", insertStyleElement(options, linkElement),
linkElement;
}
function addStyle(obj, options) {
var styleElement, update, remove;
if (options.singleton) {
var styleIndex = singletonCounter++;
styleElement = singletonElement || (singletonElement = createStyleElement(options)),
update = applyToSingletonTag.bind(null, styleElement, styleIndex, !1), remove = applyToSingletonTag.bind(null, styleElement, styleIndex, !0);
} else obj.sourceMap && "function" == typeof URL && "function" == typeof URL.createObjectURL && "function" == typeof URL.revokeObjectURL && "function" == typeof Blob && "function" == typeof btoa ? (styleElement = createLinkElement(options),
update = updateLink.bind(null, styleElement), remove = function() {
removeStyleElement(styleElement), styleElement.href && URL.revokeObjectURL(styleElement.href);
}) : (styleElement = createStyleElement(options), update = applyToTag.bind(null, styleElement),
remove = function() {
removeStyleElement(styleElement);
});
return update(obj), function(newObj) {
if (newObj) {
if (newObj.css === obj.css && newObj.media === obj.media && newObj.sourceMap === obj.sourceMap) return;
update(obj = newObj);
} else remove();
};
}
function applyToSingletonTag(styleElement, index, remove, obj) {
var css = remove ? "" : obj.css;
if (styleElement.styleSheet) styleElement.styleSheet.cssText = replaceText(index, css); else {
var cssNode = document.createTextNode(css), childNodes = styleElement.childNodes;
childNodes[index] && styleElement.removeChild(childNodes[index]), childNodes.length ? styleElement.insertBefore(cssNode, childNodes[index]) : styleElement.appendChild(cssNode);
}
}
function applyToTag(styleElement, obj) {
var css = obj.css, media = obj.media;
if (media && styleElement.setAttribute("media", media), styleElement.styleSheet) styleElement.styleSheet.cssText = css; else {
for (;styleElement.firstChild; ) styleElement.removeChild(styleElement.firstChild);
styleElement.appendChild(document.createTextNode(css));
}
}
function updateLink(linkElement, obj) {
var css = obj.css, sourceMap = obj.sourceMap;
sourceMap && (css += "\n/*# sourceMappingURL=data:application/json;base64," + btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))) + " */");
var blob = new Blob([ css ], {
type: "text/css"
}), oldSrc = linkElement.href;
linkElement.href = URL.createObjectURL(blob), oldSrc && URL.revokeObjectURL(oldSrc);
}
var stylesInDom = {}, memoize = function(fn) {
var memo;
return function() {
return void 0 === memo && (memo = fn.apply(this, arguments)), memo;
};
}, isOldIE = memoize(function() {
return /msie [6-9]\b/.test(self.navigator.userAgent.toLowerCase());
}), getHeadElement = memoize(function() {
return document.head || document.getElementsByTagName("head")[0];
}), singletonElement = null, singletonCounter = 0, styleElementsInsertedAtTop = [];
module.exports = function(list, options) {
if ("undefined" != typeof DEBUG && DEBUG && "object" != typeof document) throw new Error("The style-loader cannot be used in a non-browser environment");
options = options || {}, void 0 === options.singleton && (options.singleton = isOldIE()),
void 0 === options.insertAt && (options.insertAt = "bottom");
var styles = listToStyles(list);
return addStylesToDom(styles, options), function(newList) {
for (var mayRemove = [], i = 0; i < styles.length; i++) {
var item = styles[i], domStyle = stylesInDom[item.id];
domStyle.refs--, mayRemove.push(domStyle);
}
if (newList) {
addStylesToDom(listToStyles(newList), options);
}
for (var i = 0; i < mayRemove.length; i++) {
var domStyle = mayRemove[i];
if (0 === domStyle.refs) {
for (var j = 0; j < domStyle.parts.length; j++) domStyle.parts[j]();
delete stylesInDom[domStyle.id];
}
}
};
};
var replaceText = function() {
var textStore = [];
return function(index, replacement) {
return textStore[index] = replacement, textStore.filter(Boolean).join("\n");
};
}();
}, function(module, exports, __webpack_require__) {
var content = __webpack_require__(1);
"string" == typeof content && (content = [ [ module.i, content, "" ] ]);
__webpack_require__(3)(content, {});
content.locals && (module.exports = content.locals);
}, function(module, __webpack_exports__, __webpack_require__) {
"use strict";
function escapeString(str) {
return str.replace('"', '"');
}
function isObject(value) {
var type = typeof value;
return !!value && "object" == type;
}
function getObjectName(object) {
if (void 0 === object) return "";
if (null === object) return "Object";
if ("object" == typeof object && !object.constructor) return "Object";
var funcNameRegex = /function ([^(]*)/, results = funcNameRegex.exec(object.constructor.toString());
return results && results.length > 1 ? results[1] : "";
}
function getValuePreview(type, object, value) {
return "null" === type || "undefined" === type ? type : ("string" !== type && "stringifiable" !== type || (value = '"' + escapeString(value) + '"'),
"function" === type ? object.toString().replace(/[\r\n]/g, "").replace(/\{.*\}/, "") + "{…}" : value);
}
function getPreview(type, object) {
var value = "";
return isObject(object) ? (value = getObjectName(object), Array.isArray(object) && (value += "[" + object.length + "]")) : value = getValuePreview(type, object, object),
value;
}
function cssClass(className) {
return "json-formatter-" + className;
}
function createElement(type, className, content) {
var el = document.createElement(type);
return className && el.classList.add(cssClass(className)), void 0 !== content && (content instanceof Node ? el.appendChild(content) : el.appendChild(document.createTextNode(String(content)))),
el;
}
__webpack_exports__.a = isObject, __webpack_exports__.b = getObjectName, __webpack_exports__.f = getValuePreview,
__webpack_exports__.d = getPreview, __webpack_exports__.c = cssClass, __webpack_exports__.e = createElement;
}, function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(0);
} ]);
//# sourceMappingURL=json-formatter.js.map