mirror of
https://github.com/CharaChorder/DeviceManager.git
synced 2026-01-20 08:52:59 +00:00
706 lines
25 KiB
JavaScript
706 lines
25 KiB
JavaScript
import {
|
|
require_side_channel
|
|
} from "./chunk-5PC7D4E4.js";
|
|
import {
|
|
__commonJS
|
|
} from "./chunk-USJHI7ER.js";
|
|
|
|
// node_modules/qs/lib/formats.js
|
|
var require_formats = __commonJS({
|
|
"node_modules/qs/lib/formats.js"(exports, module) {
|
|
"use strict";
|
|
var replace = String.prototype.replace;
|
|
var percentTwenties = /%20/g;
|
|
var Format = {
|
|
RFC1738: "RFC1738",
|
|
RFC3986: "RFC3986"
|
|
};
|
|
module.exports = {
|
|
"default": Format.RFC3986,
|
|
formatters: {
|
|
RFC1738: function(value) {
|
|
return replace.call(value, percentTwenties, "+");
|
|
},
|
|
RFC3986: function(value) {
|
|
return String(value);
|
|
}
|
|
},
|
|
RFC1738: Format.RFC1738,
|
|
RFC3986: Format.RFC3986
|
|
};
|
|
}
|
|
});
|
|
|
|
// node_modules/qs/lib/utils.js
|
|
var require_utils = __commonJS({
|
|
"node_modules/qs/lib/utils.js"(exports, module) {
|
|
"use strict";
|
|
var formats = require_formats();
|
|
var has = Object.prototype.hasOwnProperty;
|
|
var isArray = Array.isArray;
|
|
var hexTable = function() {
|
|
var array = [];
|
|
for (var i = 0; i < 256; ++i) {
|
|
array.push("%" + ((i < 16 ? "0" : "") + i.toString(16)).toUpperCase());
|
|
}
|
|
return array;
|
|
}();
|
|
var compactQueue = function compactQueue2(queue) {
|
|
while (queue.length > 1) {
|
|
var item = queue.pop();
|
|
var obj = item.obj[item.prop];
|
|
if (isArray(obj)) {
|
|
var compacted = [];
|
|
for (var j = 0; j < obj.length; ++j) {
|
|
if (typeof obj[j] !== "undefined") {
|
|
compacted.push(obj[j]);
|
|
}
|
|
}
|
|
item.obj[item.prop] = compacted;
|
|
}
|
|
}
|
|
};
|
|
var arrayToObject = function arrayToObject2(source, options) {
|
|
var obj = options && options.plainObjects ? /* @__PURE__ */ Object.create(null) : {};
|
|
for (var i = 0; i < source.length; ++i) {
|
|
if (typeof source[i] !== "undefined") {
|
|
obj[i] = source[i];
|
|
}
|
|
}
|
|
return obj;
|
|
};
|
|
var merge = function merge2(target, source, options) {
|
|
if (!source) {
|
|
return target;
|
|
}
|
|
if (typeof source !== "object") {
|
|
if (isArray(target)) {
|
|
target.push(source);
|
|
} else if (target && typeof target === "object") {
|
|
if (options && (options.plainObjects || options.allowPrototypes) || !has.call(Object.prototype, source)) {
|
|
target[source] = true;
|
|
}
|
|
} else {
|
|
return [target, source];
|
|
}
|
|
return target;
|
|
}
|
|
if (!target || typeof target !== "object") {
|
|
return [target].concat(source);
|
|
}
|
|
var mergeTarget = target;
|
|
if (isArray(target) && !isArray(source)) {
|
|
mergeTarget = arrayToObject(target, options);
|
|
}
|
|
if (isArray(target) && isArray(source)) {
|
|
source.forEach(function(item, i) {
|
|
if (has.call(target, i)) {
|
|
var targetItem = target[i];
|
|
if (targetItem && typeof targetItem === "object" && item && typeof item === "object") {
|
|
target[i] = merge2(targetItem, item, options);
|
|
} else {
|
|
target.push(item);
|
|
}
|
|
} else {
|
|
target[i] = item;
|
|
}
|
|
});
|
|
return target;
|
|
}
|
|
return Object.keys(source).reduce(function(acc, key) {
|
|
var value = source[key];
|
|
if (has.call(acc, key)) {
|
|
acc[key] = merge2(acc[key], value, options);
|
|
} else {
|
|
acc[key] = value;
|
|
}
|
|
return acc;
|
|
}, mergeTarget);
|
|
};
|
|
var assign = function assignSingleSource(target, source) {
|
|
return Object.keys(source).reduce(function(acc, key) {
|
|
acc[key] = source[key];
|
|
return acc;
|
|
}, target);
|
|
};
|
|
var decode = function(str, decoder, charset) {
|
|
var strWithoutPlus = str.replace(/\+/g, " ");
|
|
if (charset === "iso-8859-1") {
|
|
return strWithoutPlus.replace(/%[0-9a-f]{2}/gi, unescape);
|
|
}
|
|
try {
|
|
return decodeURIComponent(strWithoutPlus);
|
|
} catch (e) {
|
|
return strWithoutPlus;
|
|
}
|
|
};
|
|
var encode = function encode2(str, defaultEncoder, charset, kind, format) {
|
|
if (str.length === 0) {
|
|
return str;
|
|
}
|
|
var string = str;
|
|
if (typeof str === "symbol") {
|
|
string = Symbol.prototype.toString.call(str);
|
|
} else if (typeof str !== "string") {
|
|
string = String(str);
|
|
}
|
|
if (charset === "iso-8859-1") {
|
|
return escape(string).replace(/%u[0-9a-f]{4}/gi, function($0) {
|
|
return "%26%23" + parseInt($0.slice(2), 16) + "%3B";
|
|
});
|
|
}
|
|
var out = "";
|
|
for (var i = 0; i < string.length; ++i) {
|
|
var c = string.charCodeAt(i);
|
|
if (c === 45 || c === 46 || c === 95 || c === 126 || c >= 48 && c <= 57 || c >= 65 && c <= 90 || c >= 97 && c <= 122 || format === formats.RFC1738 && (c === 40 || c === 41)) {
|
|
out += string.charAt(i);
|
|
continue;
|
|
}
|
|
if (c < 128) {
|
|
out = out + hexTable[c];
|
|
continue;
|
|
}
|
|
if (c < 2048) {
|
|
out = out + (hexTable[192 | c >> 6] + hexTable[128 | c & 63]);
|
|
continue;
|
|
}
|
|
if (c < 55296 || c >= 57344) {
|
|
out = out + (hexTable[224 | c >> 12] + hexTable[128 | c >> 6 & 63] + hexTable[128 | c & 63]);
|
|
continue;
|
|
}
|
|
i += 1;
|
|
c = 65536 + ((c & 1023) << 10 | string.charCodeAt(i) & 1023);
|
|
out += hexTable[240 | c >> 18] + hexTable[128 | c >> 12 & 63] + hexTable[128 | c >> 6 & 63] + hexTable[128 | c & 63];
|
|
}
|
|
return out;
|
|
};
|
|
var compact = function compact2(value) {
|
|
var queue = [{ obj: { o: value }, prop: "o" }];
|
|
var refs = [];
|
|
for (var i = 0; i < queue.length; ++i) {
|
|
var item = queue[i];
|
|
var obj = item.obj[item.prop];
|
|
var keys = Object.keys(obj);
|
|
for (var j = 0; j < keys.length; ++j) {
|
|
var key = keys[j];
|
|
var val = obj[key];
|
|
if (typeof val === "object" && val !== null && refs.indexOf(val) === -1) {
|
|
queue.push({ obj, prop: key });
|
|
refs.push(val);
|
|
}
|
|
}
|
|
}
|
|
compactQueue(queue);
|
|
return value;
|
|
};
|
|
var isRegExp = function isRegExp2(obj) {
|
|
return Object.prototype.toString.call(obj) === "[object RegExp]";
|
|
};
|
|
var isBuffer = function isBuffer2(obj) {
|
|
if (!obj || typeof obj !== "object") {
|
|
return false;
|
|
}
|
|
return !!(obj.constructor && obj.constructor.isBuffer && obj.constructor.isBuffer(obj));
|
|
};
|
|
var combine = function combine2(a, b) {
|
|
return [].concat(a, b);
|
|
};
|
|
var maybeMap = function maybeMap2(val, fn) {
|
|
if (isArray(val)) {
|
|
var mapped = [];
|
|
for (var i = 0; i < val.length; i += 1) {
|
|
mapped.push(fn(val[i]));
|
|
}
|
|
return mapped;
|
|
}
|
|
return fn(val);
|
|
};
|
|
module.exports = {
|
|
arrayToObject,
|
|
assign,
|
|
combine,
|
|
compact,
|
|
decode,
|
|
encode,
|
|
isBuffer,
|
|
isRegExp,
|
|
maybeMap,
|
|
merge
|
|
};
|
|
}
|
|
});
|
|
|
|
// node_modules/qs/lib/stringify.js
|
|
var require_stringify = __commonJS({
|
|
"node_modules/qs/lib/stringify.js"(exports, module) {
|
|
"use strict";
|
|
var getSideChannel = require_side_channel();
|
|
var utils = require_utils();
|
|
var formats = require_formats();
|
|
var has = Object.prototype.hasOwnProperty;
|
|
var arrayPrefixGenerators = {
|
|
brackets: function brackets(prefix) {
|
|
return prefix + "[]";
|
|
},
|
|
comma: "comma",
|
|
indices: function indices(prefix, key) {
|
|
return prefix + "[" + key + "]";
|
|
},
|
|
repeat: function repeat(prefix) {
|
|
return prefix;
|
|
}
|
|
};
|
|
var isArray = Array.isArray;
|
|
var split = String.prototype.split;
|
|
var push = Array.prototype.push;
|
|
var pushToArray = function(arr, valueOrArray) {
|
|
push.apply(arr, isArray(valueOrArray) ? valueOrArray : [valueOrArray]);
|
|
};
|
|
var toISO = Date.prototype.toISOString;
|
|
var defaultFormat = formats["default"];
|
|
var defaults = {
|
|
addQueryPrefix: false,
|
|
allowDots: false,
|
|
charset: "utf-8",
|
|
charsetSentinel: false,
|
|
delimiter: "&",
|
|
encode: true,
|
|
encoder: utils.encode,
|
|
encodeValuesOnly: false,
|
|
format: defaultFormat,
|
|
formatter: formats.formatters[defaultFormat],
|
|
// deprecated
|
|
indices: false,
|
|
serializeDate: function serializeDate(date) {
|
|
return toISO.call(date);
|
|
},
|
|
skipNulls: false,
|
|
strictNullHandling: false
|
|
};
|
|
var isNonNullishPrimitive = function isNonNullishPrimitive2(v) {
|
|
return typeof v === "string" || typeof v === "number" || typeof v === "boolean" || typeof v === "symbol" || typeof v === "bigint";
|
|
};
|
|
var sentinel = {};
|
|
var stringify = function stringify2(object, prefix, generateArrayPrefix, strictNullHandling, skipNulls, encoder, filter, sort, allowDots, serializeDate, format, formatter, encodeValuesOnly, charset, sideChannel) {
|
|
var obj = object;
|
|
var tmpSc = sideChannel;
|
|
var step = 0;
|
|
var findFlag = false;
|
|
while ((tmpSc = tmpSc.get(sentinel)) !== void 0 && !findFlag) {
|
|
var pos = tmpSc.get(object);
|
|
step += 1;
|
|
if (typeof pos !== "undefined") {
|
|
if (pos === step) {
|
|
throw new RangeError("Cyclic object value");
|
|
} else {
|
|
findFlag = true;
|
|
}
|
|
}
|
|
if (typeof tmpSc.get(sentinel) === "undefined") {
|
|
step = 0;
|
|
}
|
|
}
|
|
if (typeof filter === "function") {
|
|
obj = filter(prefix, obj);
|
|
} else if (obj instanceof Date) {
|
|
obj = serializeDate(obj);
|
|
} else if (generateArrayPrefix === "comma" && isArray(obj)) {
|
|
obj = utils.maybeMap(obj, function(value2) {
|
|
if (value2 instanceof Date) {
|
|
return serializeDate(value2);
|
|
}
|
|
return value2;
|
|
});
|
|
}
|
|
if (obj === null) {
|
|
if (strictNullHandling) {
|
|
return encoder && !encodeValuesOnly ? encoder(prefix, defaults.encoder, charset, "key", format) : prefix;
|
|
}
|
|
obj = "";
|
|
}
|
|
if (isNonNullishPrimitive(obj) || utils.isBuffer(obj)) {
|
|
if (encoder) {
|
|
var keyValue = encodeValuesOnly ? prefix : encoder(prefix, defaults.encoder, charset, "key", format);
|
|
if (generateArrayPrefix === "comma" && encodeValuesOnly) {
|
|
var valuesArray = split.call(String(obj), ",");
|
|
var valuesJoined = "";
|
|
for (var i = 0; i < valuesArray.length; ++i) {
|
|
valuesJoined += (i === 0 ? "" : ",") + formatter(encoder(valuesArray[i], defaults.encoder, charset, "value", format));
|
|
}
|
|
return [formatter(keyValue) + (i === 1 ? "[]" : "") + "=" + valuesJoined];
|
|
}
|
|
return [formatter(keyValue) + "=" + formatter(encoder(obj, defaults.encoder, charset, "value", format))];
|
|
}
|
|
return [formatter(prefix) + "=" + formatter(String(obj))];
|
|
}
|
|
var values = [];
|
|
if (typeof obj === "undefined") {
|
|
return values;
|
|
}
|
|
var objKeys;
|
|
if (generateArrayPrefix === "comma" && isArray(obj)) {
|
|
objKeys = [{ value: obj.length > 0 ? obj.join(",") || null : void 0 }];
|
|
} else if (isArray(filter)) {
|
|
objKeys = filter;
|
|
} else {
|
|
var keys = Object.keys(obj);
|
|
objKeys = sort ? keys.sort(sort) : keys;
|
|
}
|
|
for (var j = 0; j < objKeys.length; ++j) {
|
|
var key = objKeys[j];
|
|
var value = typeof key === "object" && typeof key.value !== "undefined" ? key.value : obj[key];
|
|
if (skipNulls && value === null) {
|
|
continue;
|
|
}
|
|
var keyPrefix = isArray(obj) ? typeof generateArrayPrefix === "function" ? generateArrayPrefix(prefix, key) : prefix : prefix + (allowDots ? "." + key : "[" + key + "]");
|
|
sideChannel.set(object, step);
|
|
var valueSideChannel = getSideChannel();
|
|
valueSideChannel.set(sentinel, sideChannel);
|
|
pushToArray(values, stringify2(
|
|
value,
|
|
keyPrefix,
|
|
generateArrayPrefix,
|
|
strictNullHandling,
|
|
skipNulls,
|
|
encoder,
|
|
filter,
|
|
sort,
|
|
allowDots,
|
|
serializeDate,
|
|
format,
|
|
formatter,
|
|
encodeValuesOnly,
|
|
charset,
|
|
valueSideChannel
|
|
));
|
|
}
|
|
return values;
|
|
};
|
|
var normalizeStringifyOptions = function normalizeStringifyOptions2(opts) {
|
|
if (!opts) {
|
|
return defaults;
|
|
}
|
|
if (opts.encoder !== null && typeof opts.encoder !== "undefined" && typeof opts.encoder !== "function") {
|
|
throw new TypeError("Encoder has to be a function.");
|
|
}
|
|
var charset = opts.charset || defaults.charset;
|
|
if (typeof opts.charset !== "undefined" && opts.charset !== "utf-8" && opts.charset !== "iso-8859-1") {
|
|
throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");
|
|
}
|
|
var format = formats["default"];
|
|
if (typeof opts.format !== "undefined") {
|
|
if (!has.call(formats.formatters, opts.format)) {
|
|
throw new TypeError("Unknown format option provided.");
|
|
}
|
|
format = opts.format;
|
|
}
|
|
var formatter = formats.formatters[format];
|
|
var filter = defaults.filter;
|
|
if (typeof opts.filter === "function" || isArray(opts.filter)) {
|
|
filter = opts.filter;
|
|
}
|
|
return {
|
|
addQueryPrefix: typeof opts.addQueryPrefix === "boolean" ? opts.addQueryPrefix : defaults.addQueryPrefix,
|
|
allowDots: typeof opts.allowDots === "undefined" ? defaults.allowDots : !!opts.allowDots,
|
|
charset,
|
|
charsetSentinel: typeof opts.charsetSentinel === "boolean" ? opts.charsetSentinel : defaults.charsetSentinel,
|
|
delimiter: typeof opts.delimiter === "undefined" ? defaults.delimiter : opts.delimiter,
|
|
encode: typeof opts.encode === "boolean" ? opts.encode : defaults.encode,
|
|
encoder: typeof opts.encoder === "function" ? opts.encoder : defaults.encoder,
|
|
encodeValuesOnly: typeof opts.encodeValuesOnly === "boolean" ? opts.encodeValuesOnly : defaults.encodeValuesOnly,
|
|
filter,
|
|
format,
|
|
formatter,
|
|
serializeDate: typeof opts.serializeDate === "function" ? opts.serializeDate : defaults.serializeDate,
|
|
skipNulls: typeof opts.skipNulls === "boolean" ? opts.skipNulls : defaults.skipNulls,
|
|
sort: typeof opts.sort === "function" ? opts.sort : null,
|
|
strictNullHandling: typeof opts.strictNullHandling === "boolean" ? opts.strictNullHandling : defaults.strictNullHandling
|
|
};
|
|
};
|
|
module.exports = function(object, opts) {
|
|
var obj = object;
|
|
var options = normalizeStringifyOptions(opts);
|
|
var objKeys;
|
|
var filter;
|
|
if (typeof options.filter === "function") {
|
|
filter = options.filter;
|
|
obj = filter("", obj);
|
|
} else if (isArray(options.filter)) {
|
|
filter = options.filter;
|
|
objKeys = filter;
|
|
}
|
|
var keys = [];
|
|
if (typeof obj !== "object" || obj === null) {
|
|
return "";
|
|
}
|
|
var arrayFormat;
|
|
if (opts && opts.arrayFormat in arrayPrefixGenerators) {
|
|
arrayFormat = opts.arrayFormat;
|
|
} else if (opts && "indices" in opts) {
|
|
arrayFormat = opts.indices ? "indices" : "repeat";
|
|
} else {
|
|
arrayFormat = "indices";
|
|
}
|
|
var generateArrayPrefix = arrayPrefixGenerators[arrayFormat];
|
|
if (!objKeys) {
|
|
objKeys = Object.keys(obj);
|
|
}
|
|
if (options.sort) {
|
|
objKeys.sort(options.sort);
|
|
}
|
|
var sideChannel = getSideChannel();
|
|
for (var i = 0; i < objKeys.length; ++i) {
|
|
var key = objKeys[i];
|
|
if (options.skipNulls && obj[key] === null) {
|
|
continue;
|
|
}
|
|
pushToArray(keys, stringify(
|
|
obj[key],
|
|
key,
|
|
generateArrayPrefix,
|
|
options.strictNullHandling,
|
|
options.skipNulls,
|
|
options.encode ? options.encoder : null,
|
|
options.filter,
|
|
options.sort,
|
|
options.allowDots,
|
|
options.serializeDate,
|
|
options.format,
|
|
options.formatter,
|
|
options.encodeValuesOnly,
|
|
options.charset,
|
|
sideChannel
|
|
));
|
|
}
|
|
var joined = keys.join(options.delimiter);
|
|
var prefix = options.addQueryPrefix === true ? "?" : "";
|
|
if (options.charsetSentinel) {
|
|
if (options.charset === "iso-8859-1") {
|
|
prefix += "utf8=%26%2310003%3B&";
|
|
} else {
|
|
prefix += "utf8=%E2%9C%93&";
|
|
}
|
|
}
|
|
return joined.length > 0 ? prefix + joined : "";
|
|
};
|
|
}
|
|
});
|
|
|
|
// node_modules/qs/lib/parse.js
|
|
var require_parse = __commonJS({
|
|
"node_modules/qs/lib/parse.js"(exports, module) {
|
|
"use strict";
|
|
var utils = require_utils();
|
|
var has = Object.prototype.hasOwnProperty;
|
|
var isArray = Array.isArray;
|
|
var defaults = {
|
|
allowDots: false,
|
|
allowPrototypes: false,
|
|
allowSparse: false,
|
|
arrayLimit: 20,
|
|
charset: "utf-8",
|
|
charsetSentinel: false,
|
|
comma: false,
|
|
decoder: utils.decode,
|
|
delimiter: "&",
|
|
depth: 5,
|
|
ignoreQueryPrefix: false,
|
|
interpretNumericEntities: false,
|
|
parameterLimit: 1e3,
|
|
parseArrays: true,
|
|
plainObjects: false,
|
|
strictNullHandling: false
|
|
};
|
|
var interpretNumericEntities = function(str) {
|
|
return str.replace(/&#(\d+);/g, function($0, numberStr) {
|
|
return String.fromCharCode(parseInt(numberStr, 10));
|
|
});
|
|
};
|
|
var parseArrayValue = function(val, options) {
|
|
if (val && typeof val === "string" && options.comma && val.indexOf(",") > -1) {
|
|
return val.split(",");
|
|
}
|
|
return val;
|
|
};
|
|
var isoSentinel = "utf8=%26%2310003%3B";
|
|
var charsetSentinel = "utf8=%E2%9C%93";
|
|
var parseValues = function parseQueryStringValues(str, options) {
|
|
var obj = {};
|
|
var cleanStr = options.ignoreQueryPrefix ? str.replace(/^\?/, "") : str;
|
|
var limit = options.parameterLimit === Infinity ? void 0 : options.parameterLimit;
|
|
var parts = cleanStr.split(options.delimiter, limit);
|
|
var skipIndex = -1;
|
|
var i;
|
|
var charset = options.charset;
|
|
if (options.charsetSentinel) {
|
|
for (i = 0; i < parts.length; ++i) {
|
|
if (parts[i].indexOf("utf8=") === 0) {
|
|
if (parts[i] === charsetSentinel) {
|
|
charset = "utf-8";
|
|
} else if (parts[i] === isoSentinel) {
|
|
charset = "iso-8859-1";
|
|
}
|
|
skipIndex = i;
|
|
i = parts.length;
|
|
}
|
|
}
|
|
}
|
|
for (i = 0; i < parts.length; ++i) {
|
|
if (i === skipIndex) {
|
|
continue;
|
|
}
|
|
var part = parts[i];
|
|
var bracketEqualsPos = part.indexOf("]=");
|
|
var pos = bracketEqualsPos === -1 ? part.indexOf("=") : bracketEqualsPos + 1;
|
|
var key, val;
|
|
if (pos === -1) {
|
|
key = options.decoder(part, defaults.decoder, charset, "key");
|
|
val = options.strictNullHandling ? null : "";
|
|
} else {
|
|
key = options.decoder(part.slice(0, pos), defaults.decoder, charset, "key");
|
|
val = utils.maybeMap(
|
|
parseArrayValue(part.slice(pos + 1), options),
|
|
function(encodedVal) {
|
|
return options.decoder(encodedVal, defaults.decoder, charset, "value");
|
|
}
|
|
);
|
|
}
|
|
if (val && options.interpretNumericEntities && charset === "iso-8859-1") {
|
|
val = interpretNumericEntities(val);
|
|
}
|
|
if (part.indexOf("[]=") > -1) {
|
|
val = isArray(val) ? [val] : val;
|
|
}
|
|
if (has.call(obj, key)) {
|
|
obj[key] = utils.combine(obj[key], val);
|
|
} else {
|
|
obj[key] = val;
|
|
}
|
|
}
|
|
return obj;
|
|
};
|
|
var parseObject = function(chain, val, options, valuesParsed) {
|
|
var leaf = valuesParsed ? val : parseArrayValue(val, options);
|
|
for (var i = chain.length - 1; i >= 0; --i) {
|
|
var obj;
|
|
var root = chain[i];
|
|
if (root === "[]" && options.parseArrays) {
|
|
obj = [].concat(leaf);
|
|
} else {
|
|
obj = options.plainObjects ? /* @__PURE__ */ Object.create(null) : {};
|
|
var cleanRoot = root.charAt(0) === "[" && root.charAt(root.length - 1) === "]" ? root.slice(1, -1) : root;
|
|
var index = parseInt(cleanRoot, 10);
|
|
if (!options.parseArrays && cleanRoot === "") {
|
|
obj = { 0: leaf };
|
|
} else if (!isNaN(index) && root !== cleanRoot && String(index) === cleanRoot && index >= 0 && (options.parseArrays && index <= options.arrayLimit)) {
|
|
obj = [];
|
|
obj[index] = leaf;
|
|
} else if (cleanRoot !== "__proto__") {
|
|
obj[cleanRoot] = leaf;
|
|
}
|
|
}
|
|
leaf = obj;
|
|
}
|
|
return leaf;
|
|
};
|
|
var parseKeys = function parseQueryStringKeys(givenKey, val, options, valuesParsed) {
|
|
if (!givenKey) {
|
|
return;
|
|
}
|
|
var key = options.allowDots ? givenKey.replace(/\.([^.[]+)/g, "[$1]") : givenKey;
|
|
var brackets = /(\[[^[\]]*])/;
|
|
var child = /(\[[^[\]]*])/g;
|
|
var segment = options.depth > 0 && brackets.exec(key);
|
|
var parent = segment ? key.slice(0, segment.index) : key;
|
|
var keys = [];
|
|
if (parent) {
|
|
if (!options.plainObjects && has.call(Object.prototype, parent)) {
|
|
if (!options.allowPrototypes) {
|
|
return;
|
|
}
|
|
}
|
|
keys.push(parent);
|
|
}
|
|
var i = 0;
|
|
while (options.depth > 0 && (segment = child.exec(key)) !== null && i < options.depth) {
|
|
i += 1;
|
|
if (!options.plainObjects && has.call(Object.prototype, segment[1].slice(1, -1))) {
|
|
if (!options.allowPrototypes) {
|
|
return;
|
|
}
|
|
}
|
|
keys.push(segment[1]);
|
|
}
|
|
if (segment) {
|
|
keys.push("[" + key.slice(segment.index) + "]");
|
|
}
|
|
return parseObject(keys, val, options, valuesParsed);
|
|
};
|
|
var normalizeParseOptions = function normalizeParseOptions2(opts) {
|
|
if (!opts) {
|
|
return defaults;
|
|
}
|
|
if (opts.decoder !== null && opts.decoder !== void 0 && typeof opts.decoder !== "function") {
|
|
throw new TypeError("Decoder has to be a function.");
|
|
}
|
|
if (typeof opts.charset !== "undefined" && opts.charset !== "utf-8" && opts.charset !== "iso-8859-1") {
|
|
throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");
|
|
}
|
|
var charset = typeof opts.charset === "undefined" ? defaults.charset : opts.charset;
|
|
return {
|
|
allowDots: typeof opts.allowDots === "undefined" ? defaults.allowDots : !!opts.allowDots,
|
|
allowPrototypes: typeof opts.allowPrototypes === "boolean" ? opts.allowPrototypes : defaults.allowPrototypes,
|
|
allowSparse: typeof opts.allowSparse === "boolean" ? opts.allowSparse : defaults.allowSparse,
|
|
arrayLimit: typeof opts.arrayLimit === "number" ? opts.arrayLimit : defaults.arrayLimit,
|
|
charset,
|
|
charsetSentinel: typeof opts.charsetSentinel === "boolean" ? opts.charsetSentinel : defaults.charsetSentinel,
|
|
comma: typeof opts.comma === "boolean" ? opts.comma : defaults.comma,
|
|
decoder: typeof opts.decoder === "function" ? opts.decoder : defaults.decoder,
|
|
delimiter: typeof opts.delimiter === "string" || utils.isRegExp(opts.delimiter) ? opts.delimiter : defaults.delimiter,
|
|
// eslint-disable-next-line no-implicit-coercion, no-extra-parens
|
|
depth: typeof opts.depth === "number" || opts.depth === false ? +opts.depth : defaults.depth,
|
|
ignoreQueryPrefix: opts.ignoreQueryPrefix === true,
|
|
interpretNumericEntities: typeof opts.interpretNumericEntities === "boolean" ? opts.interpretNumericEntities : defaults.interpretNumericEntities,
|
|
parameterLimit: typeof opts.parameterLimit === "number" ? opts.parameterLimit : defaults.parameterLimit,
|
|
parseArrays: opts.parseArrays !== false,
|
|
plainObjects: typeof opts.plainObjects === "boolean" ? opts.plainObjects : defaults.plainObjects,
|
|
strictNullHandling: typeof opts.strictNullHandling === "boolean" ? opts.strictNullHandling : defaults.strictNullHandling
|
|
};
|
|
};
|
|
module.exports = function(str, opts) {
|
|
var options = normalizeParseOptions(opts);
|
|
if (str === "" || str === null || typeof str === "undefined") {
|
|
return options.plainObjects ? /* @__PURE__ */ Object.create(null) : {};
|
|
}
|
|
var tempObj = typeof str === "string" ? parseValues(str, options) : str;
|
|
var obj = options.plainObjects ? /* @__PURE__ */ Object.create(null) : {};
|
|
var keys = Object.keys(tempObj);
|
|
for (var i = 0; i < keys.length; ++i) {
|
|
var key = keys[i];
|
|
var newObj = parseKeys(key, tempObj[key], options, typeof str === "string");
|
|
obj = utils.merge(obj, newObj, options);
|
|
}
|
|
if (options.allowSparse === true) {
|
|
return obj;
|
|
}
|
|
return utils.compact(obj);
|
|
};
|
|
}
|
|
});
|
|
|
|
// node_modules/qs/lib/index.js
|
|
var require_lib = __commonJS({
|
|
"node_modules/qs/lib/index.js"(exports, module) {
|
|
var stringify = require_stringify();
|
|
var parse = require_parse();
|
|
var formats = require_formats();
|
|
module.exports = {
|
|
formats,
|
|
parse,
|
|
stringify
|
|
};
|
|
}
|
|
});
|
|
export default require_lib();
|
|
//# sourceMappingURL=qs.js.map
|