ccman 3.0.12 → 3.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +4640 -6
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2021,6 +2021,3150 @@ var require_toml = __commonJS({
|
|
|
2021
2021
|
}
|
|
2022
2022
|
});
|
|
2023
2023
|
|
|
2024
|
+
// ../../node_modules/.pnpm/requires-port@1.0.0/node_modules/requires-port/index.js
|
|
2025
|
+
var require_requires_port = __commonJS({
|
|
2026
|
+
"../../node_modules/.pnpm/requires-port@1.0.0/node_modules/requires-port/index.js"(exports2, module2) {
|
|
2027
|
+
"use strict";
|
|
2028
|
+
module2.exports = function required(port, protocol) {
|
|
2029
|
+
protocol = protocol.split(":")[0];
|
|
2030
|
+
port = +port;
|
|
2031
|
+
if (!port) return false;
|
|
2032
|
+
switch (protocol) {
|
|
2033
|
+
case "http":
|
|
2034
|
+
case "ws":
|
|
2035
|
+
return port !== 80;
|
|
2036
|
+
case "https":
|
|
2037
|
+
case "wss":
|
|
2038
|
+
return port !== 443;
|
|
2039
|
+
case "ftp":
|
|
2040
|
+
return port !== 21;
|
|
2041
|
+
case "gopher":
|
|
2042
|
+
return port !== 70;
|
|
2043
|
+
case "file":
|
|
2044
|
+
return false;
|
|
2045
|
+
}
|
|
2046
|
+
return port !== 0;
|
|
2047
|
+
};
|
|
2048
|
+
}
|
|
2049
|
+
});
|
|
2050
|
+
|
|
2051
|
+
// ../../node_modules/.pnpm/querystringify@2.2.0/node_modules/querystringify/index.js
|
|
2052
|
+
var require_querystringify = __commonJS({
|
|
2053
|
+
"../../node_modules/.pnpm/querystringify@2.2.0/node_modules/querystringify/index.js"(exports2) {
|
|
2054
|
+
"use strict";
|
|
2055
|
+
var has = Object.prototype.hasOwnProperty;
|
|
2056
|
+
var undef;
|
|
2057
|
+
function decode(input) {
|
|
2058
|
+
try {
|
|
2059
|
+
return decodeURIComponent(input.replace(/\+/g, " "));
|
|
2060
|
+
} catch (e) {
|
|
2061
|
+
return null;
|
|
2062
|
+
}
|
|
2063
|
+
}
|
|
2064
|
+
function encode(input) {
|
|
2065
|
+
try {
|
|
2066
|
+
return encodeURIComponent(input);
|
|
2067
|
+
} catch (e) {
|
|
2068
|
+
return null;
|
|
2069
|
+
}
|
|
2070
|
+
}
|
|
2071
|
+
function querystring(query) {
|
|
2072
|
+
var parser = /([^=?#&]+)=?([^&]*)/g, result = {}, part;
|
|
2073
|
+
while (part = parser.exec(query)) {
|
|
2074
|
+
var key = decode(part[1]), value = decode(part[2]);
|
|
2075
|
+
if (key === null || value === null || key in result) continue;
|
|
2076
|
+
result[key] = value;
|
|
2077
|
+
}
|
|
2078
|
+
return result;
|
|
2079
|
+
}
|
|
2080
|
+
function querystringify(obj, prefix) {
|
|
2081
|
+
prefix = prefix || "";
|
|
2082
|
+
var pairs = [], value, key;
|
|
2083
|
+
if ("string" !== typeof prefix) prefix = "?";
|
|
2084
|
+
for (key in obj) {
|
|
2085
|
+
if (has.call(obj, key)) {
|
|
2086
|
+
value = obj[key];
|
|
2087
|
+
if (!value && (value === null || value === undef || isNaN(value))) {
|
|
2088
|
+
value = "";
|
|
2089
|
+
}
|
|
2090
|
+
key = encode(key);
|
|
2091
|
+
value = encode(value);
|
|
2092
|
+
if (key === null || value === null) continue;
|
|
2093
|
+
pairs.push(key + "=" + value);
|
|
2094
|
+
}
|
|
2095
|
+
}
|
|
2096
|
+
return pairs.length ? prefix + pairs.join("&") : "";
|
|
2097
|
+
}
|
|
2098
|
+
exports2.stringify = querystringify;
|
|
2099
|
+
exports2.parse = querystring;
|
|
2100
|
+
}
|
|
2101
|
+
});
|
|
2102
|
+
|
|
2103
|
+
// ../../node_modules/.pnpm/url-parse@1.5.10/node_modules/url-parse/index.js
|
|
2104
|
+
var require_url_parse = __commonJS({
|
|
2105
|
+
"../../node_modules/.pnpm/url-parse@1.5.10/node_modules/url-parse/index.js"(exports2, module2) {
|
|
2106
|
+
"use strict";
|
|
2107
|
+
var required = require_requires_port();
|
|
2108
|
+
var qs = require_querystringify();
|
|
2109
|
+
var controlOrWhitespace = /^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/;
|
|
2110
|
+
var CRHTLF = /[\n\r\t]/g;
|
|
2111
|
+
var slashes = /^[A-Za-z][A-Za-z0-9+-.]*:\/\//;
|
|
2112
|
+
var port = /:\d+$/;
|
|
2113
|
+
var protocolre = /^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i;
|
|
2114
|
+
var windowsDriveLetter = /^[a-zA-Z]:/;
|
|
2115
|
+
function trimLeft(str) {
|
|
2116
|
+
return (str ? str : "").toString().replace(controlOrWhitespace, "");
|
|
2117
|
+
}
|
|
2118
|
+
var rules = [
|
|
2119
|
+
["#", "hash"],
|
|
2120
|
+
// Extract from the back.
|
|
2121
|
+
["?", "query"],
|
|
2122
|
+
// Extract from the back.
|
|
2123
|
+
function sanitize(address, url) {
|
|
2124
|
+
return isSpecial(url.protocol) ? address.replace(/\\/g, "/") : address;
|
|
2125
|
+
},
|
|
2126
|
+
["/", "pathname"],
|
|
2127
|
+
// Extract from the back.
|
|
2128
|
+
["@", "auth", 1],
|
|
2129
|
+
// Extract from the front.
|
|
2130
|
+
[NaN, "host", void 0, 1, 1],
|
|
2131
|
+
// Set left over value.
|
|
2132
|
+
[/:(\d*)$/, "port", void 0, 1],
|
|
2133
|
+
// RegExp the back.
|
|
2134
|
+
[NaN, "hostname", void 0, 1, 1]
|
|
2135
|
+
// Set left over.
|
|
2136
|
+
];
|
|
2137
|
+
var ignore = { hash: 1, query: 1 };
|
|
2138
|
+
function lolcation(loc) {
|
|
2139
|
+
var globalVar;
|
|
2140
|
+
if (typeof window !== "undefined") globalVar = window;
|
|
2141
|
+
else if (typeof global !== "undefined") globalVar = global;
|
|
2142
|
+
else if (typeof self !== "undefined") globalVar = self;
|
|
2143
|
+
else globalVar = {};
|
|
2144
|
+
var location = globalVar.location || {};
|
|
2145
|
+
loc = loc || location;
|
|
2146
|
+
var finaldestination = {}, type = typeof loc, key;
|
|
2147
|
+
if ("blob:" === loc.protocol) {
|
|
2148
|
+
finaldestination = new Url(unescape(loc.pathname), {});
|
|
2149
|
+
} else if ("string" === type) {
|
|
2150
|
+
finaldestination = new Url(loc, {});
|
|
2151
|
+
for (key in ignore) delete finaldestination[key];
|
|
2152
|
+
} else if ("object" === type) {
|
|
2153
|
+
for (key in loc) {
|
|
2154
|
+
if (key in ignore) continue;
|
|
2155
|
+
finaldestination[key] = loc[key];
|
|
2156
|
+
}
|
|
2157
|
+
if (finaldestination.slashes === void 0) {
|
|
2158
|
+
finaldestination.slashes = slashes.test(loc.href);
|
|
2159
|
+
}
|
|
2160
|
+
}
|
|
2161
|
+
return finaldestination;
|
|
2162
|
+
}
|
|
2163
|
+
function isSpecial(scheme) {
|
|
2164
|
+
return scheme === "file:" || scheme === "ftp:" || scheme === "http:" || scheme === "https:" || scheme === "ws:" || scheme === "wss:";
|
|
2165
|
+
}
|
|
2166
|
+
function extractProtocol(address, location) {
|
|
2167
|
+
address = trimLeft(address);
|
|
2168
|
+
address = address.replace(CRHTLF, "");
|
|
2169
|
+
location = location || {};
|
|
2170
|
+
var match2 = protocolre.exec(address);
|
|
2171
|
+
var protocol = match2[1] ? match2[1].toLowerCase() : "";
|
|
2172
|
+
var forwardSlashes = !!match2[2];
|
|
2173
|
+
var otherSlashes = !!match2[3];
|
|
2174
|
+
var slashesCount = 0;
|
|
2175
|
+
var rest;
|
|
2176
|
+
if (forwardSlashes) {
|
|
2177
|
+
if (otherSlashes) {
|
|
2178
|
+
rest = match2[2] + match2[3] + match2[4];
|
|
2179
|
+
slashesCount = match2[2].length + match2[3].length;
|
|
2180
|
+
} else {
|
|
2181
|
+
rest = match2[2] + match2[4];
|
|
2182
|
+
slashesCount = match2[2].length;
|
|
2183
|
+
}
|
|
2184
|
+
} else {
|
|
2185
|
+
if (otherSlashes) {
|
|
2186
|
+
rest = match2[3] + match2[4];
|
|
2187
|
+
slashesCount = match2[3].length;
|
|
2188
|
+
} else {
|
|
2189
|
+
rest = match2[4];
|
|
2190
|
+
}
|
|
2191
|
+
}
|
|
2192
|
+
if (protocol === "file:") {
|
|
2193
|
+
if (slashesCount >= 2) {
|
|
2194
|
+
rest = rest.slice(2);
|
|
2195
|
+
}
|
|
2196
|
+
} else if (isSpecial(protocol)) {
|
|
2197
|
+
rest = match2[4];
|
|
2198
|
+
} else if (protocol) {
|
|
2199
|
+
if (forwardSlashes) {
|
|
2200
|
+
rest = rest.slice(2);
|
|
2201
|
+
}
|
|
2202
|
+
} else if (slashesCount >= 2 && isSpecial(location.protocol)) {
|
|
2203
|
+
rest = match2[4];
|
|
2204
|
+
}
|
|
2205
|
+
return {
|
|
2206
|
+
protocol,
|
|
2207
|
+
slashes: forwardSlashes || isSpecial(protocol),
|
|
2208
|
+
slashesCount,
|
|
2209
|
+
rest
|
|
2210
|
+
};
|
|
2211
|
+
}
|
|
2212
|
+
function resolve(relative, base) {
|
|
2213
|
+
if (relative === "") return base;
|
|
2214
|
+
var path7 = (base || "/").split("/").slice(0, -1).concat(relative.split("/")), i = path7.length, last = path7[i - 1], unshift = false, up = 0;
|
|
2215
|
+
while (i--) {
|
|
2216
|
+
if (path7[i] === ".") {
|
|
2217
|
+
path7.splice(i, 1);
|
|
2218
|
+
} else if (path7[i] === "..") {
|
|
2219
|
+
path7.splice(i, 1);
|
|
2220
|
+
up++;
|
|
2221
|
+
} else if (up) {
|
|
2222
|
+
if (i === 0) unshift = true;
|
|
2223
|
+
path7.splice(i, 1);
|
|
2224
|
+
up--;
|
|
2225
|
+
}
|
|
2226
|
+
}
|
|
2227
|
+
if (unshift) path7.unshift("");
|
|
2228
|
+
if (last === "." || last === "..") path7.push("");
|
|
2229
|
+
return path7.join("/");
|
|
2230
|
+
}
|
|
2231
|
+
function Url(address, location, parser) {
|
|
2232
|
+
address = trimLeft(address);
|
|
2233
|
+
address = address.replace(CRHTLF, "");
|
|
2234
|
+
if (!(this instanceof Url)) {
|
|
2235
|
+
return new Url(address, location, parser);
|
|
2236
|
+
}
|
|
2237
|
+
var relative, extracted, parse, instruction, index, key, instructions = rules.slice(), type = typeof location, url = this, i = 0;
|
|
2238
|
+
if ("object" !== type && "string" !== type) {
|
|
2239
|
+
parser = location;
|
|
2240
|
+
location = null;
|
|
2241
|
+
}
|
|
2242
|
+
if (parser && "function" !== typeof parser) parser = qs.parse;
|
|
2243
|
+
location = lolcation(location);
|
|
2244
|
+
extracted = extractProtocol(address || "", location);
|
|
2245
|
+
relative = !extracted.protocol && !extracted.slashes;
|
|
2246
|
+
url.slashes = extracted.slashes || relative && location.slashes;
|
|
2247
|
+
url.protocol = extracted.protocol || location.protocol || "";
|
|
2248
|
+
address = extracted.rest;
|
|
2249
|
+
if (extracted.protocol === "file:" && (extracted.slashesCount !== 2 || windowsDriveLetter.test(address)) || !extracted.slashes && (extracted.protocol || extracted.slashesCount < 2 || !isSpecial(url.protocol))) {
|
|
2250
|
+
instructions[3] = [/(.*)/, "pathname"];
|
|
2251
|
+
}
|
|
2252
|
+
for (; i < instructions.length; i++) {
|
|
2253
|
+
instruction = instructions[i];
|
|
2254
|
+
if (typeof instruction === "function") {
|
|
2255
|
+
address = instruction(address, url);
|
|
2256
|
+
continue;
|
|
2257
|
+
}
|
|
2258
|
+
parse = instruction[0];
|
|
2259
|
+
key = instruction[1];
|
|
2260
|
+
if (parse !== parse) {
|
|
2261
|
+
url[key] = address;
|
|
2262
|
+
} else if ("string" === typeof parse) {
|
|
2263
|
+
index = parse === "@" ? address.lastIndexOf(parse) : address.indexOf(parse);
|
|
2264
|
+
if (~index) {
|
|
2265
|
+
if ("number" === typeof instruction[2]) {
|
|
2266
|
+
url[key] = address.slice(0, index);
|
|
2267
|
+
address = address.slice(index + instruction[2]);
|
|
2268
|
+
} else {
|
|
2269
|
+
url[key] = address.slice(index);
|
|
2270
|
+
address = address.slice(0, index);
|
|
2271
|
+
}
|
|
2272
|
+
}
|
|
2273
|
+
} else if (index = parse.exec(address)) {
|
|
2274
|
+
url[key] = index[1];
|
|
2275
|
+
address = address.slice(0, index.index);
|
|
2276
|
+
}
|
|
2277
|
+
url[key] = url[key] || (relative && instruction[3] ? location[key] || "" : "");
|
|
2278
|
+
if (instruction[4]) url[key] = url[key].toLowerCase();
|
|
2279
|
+
}
|
|
2280
|
+
if (parser) url.query = parser(url.query);
|
|
2281
|
+
if (relative && location.slashes && url.pathname.charAt(0) !== "/" && (url.pathname !== "" || location.pathname !== "")) {
|
|
2282
|
+
url.pathname = resolve(url.pathname, location.pathname);
|
|
2283
|
+
}
|
|
2284
|
+
if (url.pathname.charAt(0) !== "/" && isSpecial(url.protocol)) {
|
|
2285
|
+
url.pathname = "/" + url.pathname;
|
|
2286
|
+
}
|
|
2287
|
+
if (!required(url.port, url.protocol)) {
|
|
2288
|
+
url.host = url.hostname;
|
|
2289
|
+
url.port = "";
|
|
2290
|
+
}
|
|
2291
|
+
url.username = url.password = "";
|
|
2292
|
+
if (url.auth) {
|
|
2293
|
+
index = url.auth.indexOf(":");
|
|
2294
|
+
if (~index) {
|
|
2295
|
+
url.username = url.auth.slice(0, index);
|
|
2296
|
+
url.username = encodeURIComponent(decodeURIComponent(url.username));
|
|
2297
|
+
url.password = url.auth.slice(index + 1);
|
|
2298
|
+
url.password = encodeURIComponent(decodeURIComponent(url.password));
|
|
2299
|
+
} else {
|
|
2300
|
+
url.username = encodeURIComponent(decodeURIComponent(url.auth));
|
|
2301
|
+
}
|
|
2302
|
+
url.auth = url.password ? url.username + ":" + url.password : url.username;
|
|
2303
|
+
}
|
|
2304
|
+
url.origin = url.protocol !== "file:" && isSpecial(url.protocol) && url.host ? url.protocol + "//" + url.host : "null";
|
|
2305
|
+
url.href = url.toString();
|
|
2306
|
+
}
|
|
2307
|
+
function set(part, value, fn) {
|
|
2308
|
+
var url = this;
|
|
2309
|
+
switch (part) {
|
|
2310
|
+
case "query":
|
|
2311
|
+
if ("string" === typeof value && value.length) {
|
|
2312
|
+
value = (fn || qs.parse)(value);
|
|
2313
|
+
}
|
|
2314
|
+
url[part] = value;
|
|
2315
|
+
break;
|
|
2316
|
+
case "port":
|
|
2317
|
+
url[part] = value;
|
|
2318
|
+
if (!required(value, url.protocol)) {
|
|
2319
|
+
url.host = url.hostname;
|
|
2320
|
+
url[part] = "";
|
|
2321
|
+
} else if (value) {
|
|
2322
|
+
url.host = url.hostname + ":" + value;
|
|
2323
|
+
}
|
|
2324
|
+
break;
|
|
2325
|
+
case "hostname":
|
|
2326
|
+
url[part] = value;
|
|
2327
|
+
if (url.port) value += ":" + url.port;
|
|
2328
|
+
url.host = value;
|
|
2329
|
+
break;
|
|
2330
|
+
case "host":
|
|
2331
|
+
url[part] = value;
|
|
2332
|
+
if (port.test(value)) {
|
|
2333
|
+
value = value.split(":");
|
|
2334
|
+
url.port = value.pop();
|
|
2335
|
+
url.hostname = value.join(":");
|
|
2336
|
+
} else {
|
|
2337
|
+
url.hostname = value;
|
|
2338
|
+
url.port = "";
|
|
2339
|
+
}
|
|
2340
|
+
break;
|
|
2341
|
+
case "protocol":
|
|
2342
|
+
url.protocol = value.toLowerCase();
|
|
2343
|
+
url.slashes = !fn;
|
|
2344
|
+
break;
|
|
2345
|
+
case "pathname":
|
|
2346
|
+
case "hash":
|
|
2347
|
+
if (value) {
|
|
2348
|
+
var char = part === "pathname" ? "/" : "#";
|
|
2349
|
+
url[part] = value.charAt(0) !== char ? char + value : value;
|
|
2350
|
+
} else {
|
|
2351
|
+
url[part] = value;
|
|
2352
|
+
}
|
|
2353
|
+
break;
|
|
2354
|
+
case "username":
|
|
2355
|
+
case "password":
|
|
2356
|
+
url[part] = encodeURIComponent(value);
|
|
2357
|
+
break;
|
|
2358
|
+
case "auth":
|
|
2359
|
+
var index = value.indexOf(":");
|
|
2360
|
+
if (~index) {
|
|
2361
|
+
url.username = value.slice(0, index);
|
|
2362
|
+
url.username = encodeURIComponent(decodeURIComponent(url.username));
|
|
2363
|
+
url.password = value.slice(index + 1);
|
|
2364
|
+
url.password = encodeURIComponent(decodeURIComponent(url.password));
|
|
2365
|
+
} else {
|
|
2366
|
+
url.username = encodeURIComponent(decodeURIComponent(value));
|
|
2367
|
+
}
|
|
2368
|
+
}
|
|
2369
|
+
for (var i = 0; i < rules.length; i++) {
|
|
2370
|
+
var ins = rules[i];
|
|
2371
|
+
if (ins[4]) url[ins[1]] = url[ins[1]].toLowerCase();
|
|
2372
|
+
}
|
|
2373
|
+
url.auth = url.password ? url.username + ":" + url.password : url.username;
|
|
2374
|
+
url.origin = url.protocol !== "file:" && isSpecial(url.protocol) && url.host ? url.protocol + "//" + url.host : "null";
|
|
2375
|
+
url.href = url.toString();
|
|
2376
|
+
return url;
|
|
2377
|
+
}
|
|
2378
|
+
function toString(stringify) {
|
|
2379
|
+
if (!stringify || "function" !== typeof stringify) stringify = qs.stringify;
|
|
2380
|
+
var query, url = this, host = url.host, protocol = url.protocol;
|
|
2381
|
+
if (protocol && protocol.charAt(protocol.length - 1) !== ":") protocol += ":";
|
|
2382
|
+
var result = protocol + (url.protocol && url.slashes || isSpecial(url.protocol) ? "//" : "");
|
|
2383
|
+
if (url.username) {
|
|
2384
|
+
result += url.username;
|
|
2385
|
+
if (url.password) result += ":" + url.password;
|
|
2386
|
+
result += "@";
|
|
2387
|
+
} else if (url.password) {
|
|
2388
|
+
result += ":" + url.password;
|
|
2389
|
+
result += "@";
|
|
2390
|
+
} else if (url.protocol !== "file:" && isSpecial(url.protocol) && !host && url.pathname !== "/") {
|
|
2391
|
+
result += "@";
|
|
2392
|
+
}
|
|
2393
|
+
if (host[host.length - 1] === ":" || port.test(url.hostname) && !url.port) {
|
|
2394
|
+
host += ":";
|
|
2395
|
+
}
|
|
2396
|
+
result += host + url.pathname;
|
|
2397
|
+
query = "object" === typeof url.query ? stringify(url.query) : url.query;
|
|
2398
|
+
if (query) result += "?" !== query.charAt(0) ? "?" + query : query;
|
|
2399
|
+
if (url.hash) result += url.hash;
|
|
2400
|
+
return result;
|
|
2401
|
+
}
|
|
2402
|
+
Url.prototype = { set, toString };
|
|
2403
|
+
Url.extractProtocol = extractProtocol;
|
|
2404
|
+
Url.location = lolcation;
|
|
2405
|
+
Url.trimLeft = trimLeft;
|
|
2406
|
+
Url.qs = qs;
|
|
2407
|
+
module2.exports = Url;
|
|
2408
|
+
}
|
|
2409
|
+
});
|
|
2410
|
+
|
|
2411
|
+
// ../../node_modules/.pnpm/path-posix@1.0.0/node_modules/path-posix/index.js
|
|
2412
|
+
var require_path_posix = __commonJS({
|
|
2413
|
+
"../../node_modules/.pnpm/path-posix@1.0.0/node_modules/path-posix/index.js"(exports2, module2) {
|
|
2414
|
+
"use strict";
|
|
2415
|
+
var util = require("util");
|
|
2416
|
+
var isString = function(x) {
|
|
2417
|
+
return typeof x === "string";
|
|
2418
|
+
};
|
|
2419
|
+
function normalizeArray(parts, allowAboveRoot) {
|
|
2420
|
+
var res = [];
|
|
2421
|
+
for (var i = 0; i < parts.length; i++) {
|
|
2422
|
+
var p = parts[i];
|
|
2423
|
+
if (!p || p === ".")
|
|
2424
|
+
continue;
|
|
2425
|
+
if (p === "..") {
|
|
2426
|
+
if (res.length && res[res.length - 1] !== "..") {
|
|
2427
|
+
res.pop();
|
|
2428
|
+
} else if (allowAboveRoot) {
|
|
2429
|
+
res.push("..");
|
|
2430
|
+
}
|
|
2431
|
+
} else {
|
|
2432
|
+
res.push(p);
|
|
2433
|
+
}
|
|
2434
|
+
}
|
|
2435
|
+
return res;
|
|
2436
|
+
}
|
|
2437
|
+
var splitPathRe = /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;
|
|
2438
|
+
var posix = {};
|
|
2439
|
+
function posixSplitPath(filename) {
|
|
2440
|
+
return splitPathRe.exec(filename).slice(1);
|
|
2441
|
+
}
|
|
2442
|
+
posix.resolve = function() {
|
|
2443
|
+
var resolvedPath = "", resolvedAbsolute = false;
|
|
2444
|
+
for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {
|
|
2445
|
+
var path7 = i >= 0 ? arguments[i] : process.cwd();
|
|
2446
|
+
if (!isString(path7)) {
|
|
2447
|
+
throw new TypeError("Arguments to path.resolve must be strings");
|
|
2448
|
+
} else if (!path7) {
|
|
2449
|
+
continue;
|
|
2450
|
+
}
|
|
2451
|
+
resolvedPath = path7 + "/" + resolvedPath;
|
|
2452
|
+
resolvedAbsolute = path7.charAt(0) === "/";
|
|
2453
|
+
}
|
|
2454
|
+
resolvedPath = normalizeArray(
|
|
2455
|
+
resolvedPath.split("/"),
|
|
2456
|
+
!resolvedAbsolute
|
|
2457
|
+
).join("/");
|
|
2458
|
+
return (resolvedAbsolute ? "/" : "") + resolvedPath || ".";
|
|
2459
|
+
};
|
|
2460
|
+
posix.normalize = function(path7) {
|
|
2461
|
+
var isAbsolute = posix.isAbsolute(path7), trailingSlash = path7.substr(-1) === "/";
|
|
2462
|
+
path7 = normalizeArray(path7.split("/"), !isAbsolute).join("/");
|
|
2463
|
+
if (!path7 && !isAbsolute) {
|
|
2464
|
+
path7 = ".";
|
|
2465
|
+
}
|
|
2466
|
+
if (path7 && trailingSlash) {
|
|
2467
|
+
path7 += "/";
|
|
2468
|
+
}
|
|
2469
|
+
return (isAbsolute ? "/" : "") + path7;
|
|
2470
|
+
};
|
|
2471
|
+
posix.isAbsolute = function(path7) {
|
|
2472
|
+
return path7.charAt(0) === "/";
|
|
2473
|
+
};
|
|
2474
|
+
posix.join = function() {
|
|
2475
|
+
var path7 = "";
|
|
2476
|
+
for (var i = 0; i < arguments.length; i++) {
|
|
2477
|
+
var segment = arguments[i];
|
|
2478
|
+
if (!isString(segment)) {
|
|
2479
|
+
throw new TypeError("Arguments to path.join must be strings");
|
|
2480
|
+
}
|
|
2481
|
+
if (segment) {
|
|
2482
|
+
if (!path7) {
|
|
2483
|
+
path7 += segment;
|
|
2484
|
+
} else {
|
|
2485
|
+
path7 += "/" + segment;
|
|
2486
|
+
}
|
|
2487
|
+
}
|
|
2488
|
+
}
|
|
2489
|
+
return posix.normalize(path7);
|
|
2490
|
+
};
|
|
2491
|
+
posix.relative = function(from, to) {
|
|
2492
|
+
from = posix.resolve(from).substr(1);
|
|
2493
|
+
to = posix.resolve(to).substr(1);
|
|
2494
|
+
function trim(arr) {
|
|
2495
|
+
var start = 0;
|
|
2496
|
+
for (; start < arr.length; start++) {
|
|
2497
|
+
if (arr[start] !== "") break;
|
|
2498
|
+
}
|
|
2499
|
+
var end = arr.length - 1;
|
|
2500
|
+
for (; end >= 0; end--) {
|
|
2501
|
+
if (arr[end] !== "") break;
|
|
2502
|
+
}
|
|
2503
|
+
if (start > end) return [];
|
|
2504
|
+
return arr.slice(start, end + 1);
|
|
2505
|
+
}
|
|
2506
|
+
var fromParts = trim(from.split("/"));
|
|
2507
|
+
var toParts = trim(to.split("/"));
|
|
2508
|
+
var length = Math.min(fromParts.length, toParts.length);
|
|
2509
|
+
var samePartsLength = length;
|
|
2510
|
+
for (var i = 0; i < length; i++) {
|
|
2511
|
+
if (fromParts[i] !== toParts[i]) {
|
|
2512
|
+
samePartsLength = i;
|
|
2513
|
+
break;
|
|
2514
|
+
}
|
|
2515
|
+
}
|
|
2516
|
+
var outputParts = [];
|
|
2517
|
+
for (var i = samePartsLength; i < fromParts.length; i++) {
|
|
2518
|
+
outputParts.push("..");
|
|
2519
|
+
}
|
|
2520
|
+
outputParts = outputParts.concat(toParts.slice(samePartsLength));
|
|
2521
|
+
return outputParts.join("/");
|
|
2522
|
+
};
|
|
2523
|
+
posix._makeLong = function(path7) {
|
|
2524
|
+
return path7;
|
|
2525
|
+
};
|
|
2526
|
+
posix.dirname = function(path7) {
|
|
2527
|
+
var result = posixSplitPath(path7), root = result[0], dir = result[1];
|
|
2528
|
+
if (!root && !dir) {
|
|
2529
|
+
return ".";
|
|
2530
|
+
}
|
|
2531
|
+
if (dir) {
|
|
2532
|
+
dir = dir.substr(0, dir.length - 1);
|
|
2533
|
+
}
|
|
2534
|
+
return root + dir;
|
|
2535
|
+
};
|
|
2536
|
+
posix.basename = function(path7, ext2) {
|
|
2537
|
+
var f = posixSplitPath(path7)[2];
|
|
2538
|
+
if (ext2 && f.substr(-1 * ext2.length) === ext2) {
|
|
2539
|
+
f = f.substr(0, f.length - ext2.length);
|
|
2540
|
+
}
|
|
2541
|
+
return f;
|
|
2542
|
+
};
|
|
2543
|
+
posix.extname = function(path7) {
|
|
2544
|
+
return posixSplitPath(path7)[3];
|
|
2545
|
+
};
|
|
2546
|
+
posix.format = function(pathObject) {
|
|
2547
|
+
if (!util.isObject(pathObject)) {
|
|
2548
|
+
throw new TypeError(
|
|
2549
|
+
"Parameter 'pathObject' must be an object, not " + typeof pathObject
|
|
2550
|
+
);
|
|
2551
|
+
}
|
|
2552
|
+
var root = pathObject.root || "";
|
|
2553
|
+
if (!isString(root)) {
|
|
2554
|
+
throw new TypeError(
|
|
2555
|
+
"'pathObject.root' must be a string or undefined, not " + typeof pathObject.root
|
|
2556
|
+
);
|
|
2557
|
+
}
|
|
2558
|
+
var dir = pathObject.dir ? pathObject.dir + posix.sep : "";
|
|
2559
|
+
var base = pathObject.base || "";
|
|
2560
|
+
return dir + base;
|
|
2561
|
+
};
|
|
2562
|
+
posix.parse = function(pathString) {
|
|
2563
|
+
if (!isString(pathString)) {
|
|
2564
|
+
throw new TypeError(
|
|
2565
|
+
"Parameter 'pathString' must be a string, not " + typeof pathString
|
|
2566
|
+
);
|
|
2567
|
+
}
|
|
2568
|
+
var allParts = posixSplitPath(pathString);
|
|
2569
|
+
if (!allParts || allParts.length !== 4) {
|
|
2570
|
+
throw new TypeError("Invalid path '" + pathString + "'");
|
|
2571
|
+
}
|
|
2572
|
+
allParts[1] = allParts[1] || "";
|
|
2573
|
+
allParts[2] = allParts[2] || "";
|
|
2574
|
+
allParts[3] = allParts[3] || "";
|
|
2575
|
+
return {
|
|
2576
|
+
root: allParts[0],
|
|
2577
|
+
dir: allParts[0] + allParts[1].slice(0, allParts[1].length - 1),
|
|
2578
|
+
base: allParts[2],
|
|
2579
|
+
ext: allParts[3],
|
|
2580
|
+
name: allParts[2].slice(0, allParts[2].length - allParts[3].length)
|
|
2581
|
+
};
|
|
2582
|
+
};
|
|
2583
|
+
posix.sep = "/";
|
|
2584
|
+
posix.delimiter = ":";
|
|
2585
|
+
module2.exports = posix;
|
|
2586
|
+
}
|
|
2587
|
+
});
|
|
2588
|
+
|
|
2589
|
+
// ../../node_modules/.pnpm/crypt@0.0.2/node_modules/crypt/crypt.js
|
|
2590
|
+
var require_crypt = __commonJS({
|
|
2591
|
+
"../../node_modules/.pnpm/crypt@0.0.2/node_modules/crypt/crypt.js"(exports2, module2) {
|
|
2592
|
+
"use strict";
|
|
2593
|
+
(function() {
|
|
2594
|
+
var base64map = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", crypt = {
|
|
2595
|
+
// Bit-wise rotation left
|
|
2596
|
+
rotl: function(n, b) {
|
|
2597
|
+
return n << b | n >>> 32 - b;
|
|
2598
|
+
},
|
|
2599
|
+
// Bit-wise rotation right
|
|
2600
|
+
rotr: function(n, b) {
|
|
2601
|
+
return n << 32 - b | n >>> b;
|
|
2602
|
+
},
|
|
2603
|
+
// Swap big-endian to little-endian and vice versa
|
|
2604
|
+
endian: function(n) {
|
|
2605
|
+
if (n.constructor == Number) {
|
|
2606
|
+
return crypt.rotl(n, 8) & 16711935 | crypt.rotl(n, 24) & 4278255360;
|
|
2607
|
+
}
|
|
2608
|
+
for (var i = 0; i < n.length; i++)
|
|
2609
|
+
n[i] = crypt.endian(n[i]);
|
|
2610
|
+
return n;
|
|
2611
|
+
},
|
|
2612
|
+
// Generate an array of any length of random bytes
|
|
2613
|
+
randomBytes: function(n) {
|
|
2614
|
+
for (var bytes = []; n > 0; n--)
|
|
2615
|
+
bytes.push(Math.floor(Math.random() * 256));
|
|
2616
|
+
return bytes;
|
|
2617
|
+
},
|
|
2618
|
+
// Convert a byte array to big-endian 32-bit words
|
|
2619
|
+
bytesToWords: function(bytes) {
|
|
2620
|
+
for (var words = [], i = 0, b = 0; i < bytes.length; i++, b += 8)
|
|
2621
|
+
words[b >>> 5] |= bytes[i] << 24 - b % 32;
|
|
2622
|
+
return words;
|
|
2623
|
+
},
|
|
2624
|
+
// Convert big-endian 32-bit words to a byte array
|
|
2625
|
+
wordsToBytes: function(words) {
|
|
2626
|
+
for (var bytes = [], b = 0; b < words.length * 32; b += 8)
|
|
2627
|
+
bytes.push(words[b >>> 5] >>> 24 - b % 32 & 255);
|
|
2628
|
+
return bytes;
|
|
2629
|
+
},
|
|
2630
|
+
// Convert a byte array to a hex string
|
|
2631
|
+
bytesToHex: function(bytes) {
|
|
2632
|
+
for (var hex = [], i = 0; i < bytes.length; i++) {
|
|
2633
|
+
hex.push((bytes[i] >>> 4).toString(16));
|
|
2634
|
+
hex.push((bytes[i] & 15).toString(16));
|
|
2635
|
+
}
|
|
2636
|
+
return hex.join("");
|
|
2637
|
+
},
|
|
2638
|
+
// Convert a hex string to a byte array
|
|
2639
|
+
hexToBytes: function(hex) {
|
|
2640
|
+
for (var bytes = [], c = 0; c < hex.length; c += 2)
|
|
2641
|
+
bytes.push(parseInt(hex.substr(c, 2), 16));
|
|
2642
|
+
return bytes;
|
|
2643
|
+
},
|
|
2644
|
+
// Convert a byte array to a base-64 string
|
|
2645
|
+
bytesToBase64: function(bytes) {
|
|
2646
|
+
for (var base642 = [], i = 0; i < bytes.length; i += 3) {
|
|
2647
|
+
var triplet = bytes[i] << 16 | bytes[i + 1] << 8 | bytes[i + 2];
|
|
2648
|
+
for (var j = 0; j < 4; j++)
|
|
2649
|
+
if (i * 8 + j * 6 <= bytes.length * 8)
|
|
2650
|
+
base642.push(base64map.charAt(triplet >>> 6 * (3 - j) & 63));
|
|
2651
|
+
else
|
|
2652
|
+
base642.push("=");
|
|
2653
|
+
}
|
|
2654
|
+
return base642.join("");
|
|
2655
|
+
},
|
|
2656
|
+
// Convert a base-64 string to a byte array
|
|
2657
|
+
base64ToBytes: function(base642) {
|
|
2658
|
+
base642 = base642.replace(/[^A-Z0-9+\/]/ig, "");
|
|
2659
|
+
for (var bytes = [], i = 0, imod4 = 0; i < base642.length; imod4 = ++i % 4) {
|
|
2660
|
+
if (imod4 == 0) continue;
|
|
2661
|
+
bytes.push((base64map.indexOf(base642.charAt(i - 1)) & Math.pow(2, -2 * imod4 + 8) - 1) << imod4 * 2 | base64map.indexOf(base642.charAt(i)) >>> 6 - imod4 * 2);
|
|
2662
|
+
}
|
|
2663
|
+
return bytes;
|
|
2664
|
+
}
|
|
2665
|
+
};
|
|
2666
|
+
module2.exports = crypt;
|
|
2667
|
+
})();
|
|
2668
|
+
}
|
|
2669
|
+
});
|
|
2670
|
+
|
|
2671
|
+
// ../../node_modules/.pnpm/charenc@0.0.2/node_modules/charenc/charenc.js
|
|
2672
|
+
var require_charenc = __commonJS({
|
|
2673
|
+
"../../node_modules/.pnpm/charenc@0.0.2/node_modules/charenc/charenc.js"(exports2, module2) {
|
|
2674
|
+
"use strict";
|
|
2675
|
+
var charenc = {
|
|
2676
|
+
// UTF-8 encoding
|
|
2677
|
+
utf8: {
|
|
2678
|
+
// Convert a string to a byte array
|
|
2679
|
+
stringToBytes: function(str) {
|
|
2680
|
+
return charenc.bin.stringToBytes(unescape(encodeURIComponent(str)));
|
|
2681
|
+
},
|
|
2682
|
+
// Convert a byte array to a string
|
|
2683
|
+
bytesToString: function(bytes) {
|
|
2684
|
+
return decodeURIComponent(escape(charenc.bin.bytesToString(bytes)));
|
|
2685
|
+
}
|
|
2686
|
+
},
|
|
2687
|
+
// Binary encoding
|
|
2688
|
+
bin: {
|
|
2689
|
+
// Convert a string to a byte array
|
|
2690
|
+
stringToBytes: function(str) {
|
|
2691
|
+
for (var bytes = [], i = 0; i < str.length; i++)
|
|
2692
|
+
bytes.push(str.charCodeAt(i) & 255);
|
|
2693
|
+
return bytes;
|
|
2694
|
+
},
|
|
2695
|
+
// Convert a byte array to a string
|
|
2696
|
+
bytesToString: function(bytes) {
|
|
2697
|
+
for (var str = [], i = 0; i < bytes.length; i++)
|
|
2698
|
+
str.push(String.fromCharCode(bytes[i]));
|
|
2699
|
+
return str.join("");
|
|
2700
|
+
}
|
|
2701
|
+
}
|
|
2702
|
+
};
|
|
2703
|
+
module2.exports = charenc;
|
|
2704
|
+
}
|
|
2705
|
+
});
|
|
2706
|
+
|
|
2707
|
+
// ../../node_modules/.pnpm/is-buffer@1.1.6/node_modules/is-buffer/index.js
|
|
2708
|
+
var require_is_buffer = __commonJS({
|
|
2709
|
+
"../../node_modules/.pnpm/is-buffer@1.1.6/node_modules/is-buffer/index.js"(exports2, module2) {
|
|
2710
|
+
"use strict";
|
|
2711
|
+
module2.exports = function(obj) {
|
|
2712
|
+
return obj != null && (isBuffer2(obj) || isSlowBuffer(obj) || !!obj._isBuffer);
|
|
2713
|
+
};
|
|
2714
|
+
function isBuffer2(obj) {
|
|
2715
|
+
return !!obj.constructor && typeof obj.constructor.isBuffer === "function" && obj.constructor.isBuffer(obj);
|
|
2716
|
+
}
|
|
2717
|
+
function isSlowBuffer(obj) {
|
|
2718
|
+
return typeof obj.readFloatLE === "function" && typeof obj.slice === "function" && isBuffer2(obj.slice(0, 0));
|
|
2719
|
+
}
|
|
2720
|
+
}
|
|
2721
|
+
});
|
|
2722
|
+
|
|
2723
|
+
// ../../node_modules/.pnpm/md5@2.3.0/node_modules/md5/md5.js
|
|
2724
|
+
var require_md5 = __commonJS({
|
|
2725
|
+
"../../node_modules/.pnpm/md5@2.3.0/node_modules/md5/md5.js"(exports2, module2) {
|
|
2726
|
+
"use strict";
|
|
2727
|
+
(function() {
|
|
2728
|
+
var crypt = require_crypt(), utf8 = require_charenc().utf8, isBuffer2 = require_is_buffer(), bin = require_charenc().bin, md53 = function(message, options) {
|
|
2729
|
+
if (message.constructor == String)
|
|
2730
|
+
if (options && options.encoding === "binary")
|
|
2731
|
+
message = bin.stringToBytes(message);
|
|
2732
|
+
else
|
|
2733
|
+
message = utf8.stringToBytes(message);
|
|
2734
|
+
else if (isBuffer2(message))
|
|
2735
|
+
message = Array.prototype.slice.call(message, 0);
|
|
2736
|
+
else if (!Array.isArray(message) && message.constructor !== Uint8Array)
|
|
2737
|
+
message = message.toString();
|
|
2738
|
+
var m = crypt.bytesToWords(message), l = message.length * 8, a = 1732584193, b = -271733879, c = -1732584194, d = 271733878;
|
|
2739
|
+
for (var i = 0; i < m.length; i++) {
|
|
2740
|
+
m[i] = (m[i] << 8 | m[i] >>> 24) & 16711935 | (m[i] << 24 | m[i] >>> 8) & 4278255360;
|
|
2741
|
+
}
|
|
2742
|
+
m[l >>> 5] |= 128 << l % 32;
|
|
2743
|
+
m[(l + 64 >>> 9 << 4) + 14] = l;
|
|
2744
|
+
var FF = md53._ff, GG = md53._gg, HH = md53._hh, II = md53._ii;
|
|
2745
|
+
for (var i = 0; i < m.length; i += 16) {
|
|
2746
|
+
var aa = a, bb = b, cc2 = c, dd = d;
|
|
2747
|
+
a = FF(a, b, c, d, m[i + 0], 7, -680876936);
|
|
2748
|
+
d = FF(d, a, b, c, m[i + 1], 12, -389564586);
|
|
2749
|
+
c = FF(c, d, a, b, m[i + 2], 17, 606105819);
|
|
2750
|
+
b = FF(b, c, d, a, m[i + 3], 22, -1044525330);
|
|
2751
|
+
a = FF(a, b, c, d, m[i + 4], 7, -176418897);
|
|
2752
|
+
d = FF(d, a, b, c, m[i + 5], 12, 1200080426);
|
|
2753
|
+
c = FF(c, d, a, b, m[i + 6], 17, -1473231341);
|
|
2754
|
+
b = FF(b, c, d, a, m[i + 7], 22, -45705983);
|
|
2755
|
+
a = FF(a, b, c, d, m[i + 8], 7, 1770035416);
|
|
2756
|
+
d = FF(d, a, b, c, m[i + 9], 12, -1958414417);
|
|
2757
|
+
c = FF(c, d, a, b, m[i + 10], 17, -42063);
|
|
2758
|
+
b = FF(b, c, d, a, m[i + 11], 22, -1990404162);
|
|
2759
|
+
a = FF(a, b, c, d, m[i + 12], 7, 1804603682);
|
|
2760
|
+
d = FF(d, a, b, c, m[i + 13], 12, -40341101);
|
|
2761
|
+
c = FF(c, d, a, b, m[i + 14], 17, -1502002290);
|
|
2762
|
+
b = FF(b, c, d, a, m[i + 15], 22, 1236535329);
|
|
2763
|
+
a = GG(a, b, c, d, m[i + 1], 5, -165796510);
|
|
2764
|
+
d = GG(d, a, b, c, m[i + 6], 9, -1069501632);
|
|
2765
|
+
c = GG(c, d, a, b, m[i + 11], 14, 643717713);
|
|
2766
|
+
b = GG(b, c, d, a, m[i + 0], 20, -373897302);
|
|
2767
|
+
a = GG(a, b, c, d, m[i + 5], 5, -701558691);
|
|
2768
|
+
d = GG(d, a, b, c, m[i + 10], 9, 38016083);
|
|
2769
|
+
c = GG(c, d, a, b, m[i + 15], 14, -660478335);
|
|
2770
|
+
b = GG(b, c, d, a, m[i + 4], 20, -405537848);
|
|
2771
|
+
a = GG(a, b, c, d, m[i + 9], 5, 568446438);
|
|
2772
|
+
d = GG(d, a, b, c, m[i + 14], 9, -1019803690);
|
|
2773
|
+
c = GG(c, d, a, b, m[i + 3], 14, -187363961);
|
|
2774
|
+
b = GG(b, c, d, a, m[i + 8], 20, 1163531501);
|
|
2775
|
+
a = GG(a, b, c, d, m[i + 13], 5, -1444681467);
|
|
2776
|
+
d = GG(d, a, b, c, m[i + 2], 9, -51403784);
|
|
2777
|
+
c = GG(c, d, a, b, m[i + 7], 14, 1735328473);
|
|
2778
|
+
b = GG(b, c, d, a, m[i + 12], 20, -1926607734);
|
|
2779
|
+
a = HH(a, b, c, d, m[i + 5], 4, -378558);
|
|
2780
|
+
d = HH(d, a, b, c, m[i + 8], 11, -2022574463);
|
|
2781
|
+
c = HH(c, d, a, b, m[i + 11], 16, 1839030562);
|
|
2782
|
+
b = HH(b, c, d, a, m[i + 14], 23, -35309556);
|
|
2783
|
+
a = HH(a, b, c, d, m[i + 1], 4, -1530992060);
|
|
2784
|
+
d = HH(d, a, b, c, m[i + 4], 11, 1272893353);
|
|
2785
|
+
c = HH(c, d, a, b, m[i + 7], 16, -155497632);
|
|
2786
|
+
b = HH(b, c, d, a, m[i + 10], 23, -1094730640);
|
|
2787
|
+
a = HH(a, b, c, d, m[i + 13], 4, 681279174);
|
|
2788
|
+
d = HH(d, a, b, c, m[i + 0], 11, -358537222);
|
|
2789
|
+
c = HH(c, d, a, b, m[i + 3], 16, -722521979);
|
|
2790
|
+
b = HH(b, c, d, a, m[i + 6], 23, 76029189);
|
|
2791
|
+
a = HH(a, b, c, d, m[i + 9], 4, -640364487);
|
|
2792
|
+
d = HH(d, a, b, c, m[i + 12], 11, -421815835);
|
|
2793
|
+
c = HH(c, d, a, b, m[i + 15], 16, 530742520);
|
|
2794
|
+
b = HH(b, c, d, a, m[i + 2], 23, -995338651);
|
|
2795
|
+
a = II(a, b, c, d, m[i + 0], 6, -198630844);
|
|
2796
|
+
d = II(d, a, b, c, m[i + 7], 10, 1126891415);
|
|
2797
|
+
c = II(c, d, a, b, m[i + 14], 15, -1416354905);
|
|
2798
|
+
b = II(b, c, d, a, m[i + 5], 21, -57434055);
|
|
2799
|
+
a = II(a, b, c, d, m[i + 12], 6, 1700485571);
|
|
2800
|
+
d = II(d, a, b, c, m[i + 3], 10, -1894986606);
|
|
2801
|
+
c = II(c, d, a, b, m[i + 10], 15, -1051523);
|
|
2802
|
+
b = II(b, c, d, a, m[i + 1], 21, -2054922799);
|
|
2803
|
+
a = II(a, b, c, d, m[i + 8], 6, 1873313359);
|
|
2804
|
+
d = II(d, a, b, c, m[i + 15], 10, -30611744);
|
|
2805
|
+
c = II(c, d, a, b, m[i + 6], 15, -1560198380);
|
|
2806
|
+
b = II(b, c, d, a, m[i + 13], 21, 1309151649);
|
|
2807
|
+
a = II(a, b, c, d, m[i + 4], 6, -145523070);
|
|
2808
|
+
d = II(d, a, b, c, m[i + 11], 10, -1120210379);
|
|
2809
|
+
c = II(c, d, a, b, m[i + 2], 15, 718787259);
|
|
2810
|
+
b = II(b, c, d, a, m[i + 9], 21, -343485551);
|
|
2811
|
+
a = a + aa >>> 0;
|
|
2812
|
+
b = b + bb >>> 0;
|
|
2813
|
+
c = c + cc2 >>> 0;
|
|
2814
|
+
d = d + dd >>> 0;
|
|
2815
|
+
}
|
|
2816
|
+
return crypt.endian([a, b, c, d]);
|
|
2817
|
+
};
|
|
2818
|
+
md53._ff = function(a, b, c, d, x, s, t) {
|
|
2819
|
+
var n = a + (b & c | ~b & d) + (x >>> 0) + t;
|
|
2820
|
+
return (n << s | n >>> 32 - s) + b;
|
|
2821
|
+
};
|
|
2822
|
+
md53._gg = function(a, b, c, d, x, s, t) {
|
|
2823
|
+
var n = a + (b & d | c & ~d) + (x >>> 0) + t;
|
|
2824
|
+
return (n << s | n >>> 32 - s) + b;
|
|
2825
|
+
};
|
|
2826
|
+
md53._hh = function(a, b, c, d, x, s, t) {
|
|
2827
|
+
var n = a + (b ^ c ^ d) + (x >>> 0) + t;
|
|
2828
|
+
return (n << s | n >>> 32 - s) + b;
|
|
2829
|
+
};
|
|
2830
|
+
md53._ii = function(a, b, c, d, x, s, t) {
|
|
2831
|
+
var n = a + (c ^ (b | ~d)) + (x >>> 0) + t;
|
|
2832
|
+
return (n << s | n >>> 32 - s) + b;
|
|
2833
|
+
};
|
|
2834
|
+
md53._blocksize = 16;
|
|
2835
|
+
md53._digestsize = 16;
|
|
2836
|
+
module2.exports = function(message, options) {
|
|
2837
|
+
if (message === void 0 || message === null)
|
|
2838
|
+
throw new Error("Illegal argument " + message);
|
|
2839
|
+
var digestbytes = crypt.wordsToBytes(md53(message, options));
|
|
2840
|
+
return options && options.asBytes ? digestbytes : options && options.asString ? bin.bytesToString(digestbytes) : crypt.bytesToHex(digestbytes);
|
|
2841
|
+
};
|
|
2842
|
+
})();
|
|
2843
|
+
}
|
|
2844
|
+
});
|
|
2845
|
+
|
|
2846
|
+
// ../../node_modules/.pnpm/base-64@1.0.0/node_modules/base-64/base64.js
|
|
2847
|
+
var require_base64 = __commonJS({
|
|
2848
|
+
"../../node_modules/.pnpm/base-64@1.0.0/node_modules/base-64/base64.js"(exports2, module2) {
|
|
2849
|
+
"use strict";
|
|
2850
|
+
(function(root) {
|
|
2851
|
+
var freeExports = typeof exports2 == "object" && exports2;
|
|
2852
|
+
var freeModule = typeof module2 == "object" && module2 && module2.exports == freeExports && module2;
|
|
2853
|
+
var freeGlobal = typeof global == "object" && global;
|
|
2854
|
+
if (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal) {
|
|
2855
|
+
root = freeGlobal;
|
|
2856
|
+
}
|
|
2857
|
+
var InvalidCharacterError = function(message) {
|
|
2858
|
+
this.message = message;
|
|
2859
|
+
};
|
|
2860
|
+
InvalidCharacterError.prototype = new Error();
|
|
2861
|
+
InvalidCharacterError.prototype.name = "InvalidCharacterError";
|
|
2862
|
+
var error = function(message) {
|
|
2863
|
+
throw new InvalidCharacterError(message);
|
|
2864
|
+
};
|
|
2865
|
+
var TABLE2 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
2866
|
+
var REGEX_SPACE_CHARACTERS = /[\t\n\f\r ]/g;
|
|
2867
|
+
var decode = function(input) {
|
|
2868
|
+
input = String(input).replace(REGEX_SPACE_CHARACTERS, "");
|
|
2869
|
+
var length = input.length;
|
|
2870
|
+
if (length % 4 == 0) {
|
|
2871
|
+
input = input.replace(/==?$/, "");
|
|
2872
|
+
length = input.length;
|
|
2873
|
+
}
|
|
2874
|
+
if (length % 4 == 1 || // http://whatwg.org/C#alphanumeric-ascii-characters
|
|
2875
|
+
/[^+a-zA-Z0-9/]/.test(input)) {
|
|
2876
|
+
error(
|
|
2877
|
+
"Invalid character: the string to be decoded is not correctly encoded."
|
|
2878
|
+
);
|
|
2879
|
+
}
|
|
2880
|
+
var bitCounter = 0;
|
|
2881
|
+
var bitStorage;
|
|
2882
|
+
var buffer;
|
|
2883
|
+
var output = "";
|
|
2884
|
+
var position = -1;
|
|
2885
|
+
while (++position < length) {
|
|
2886
|
+
buffer = TABLE2.indexOf(input.charAt(position));
|
|
2887
|
+
bitStorage = bitCounter % 4 ? bitStorage * 64 + buffer : buffer;
|
|
2888
|
+
if (bitCounter++ % 4) {
|
|
2889
|
+
output += String.fromCharCode(
|
|
2890
|
+
255 & bitStorage >> (-2 * bitCounter & 6)
|
|
2891
|
+
);
|
|
2892
|
+
}
|
|
2893
|
+
}
|
|
2894
|
+
return output;
|
|
2895
|
+
};
|
|
2896
|
+
var encode = function(input) {
|
|
2897
|
+
input = String(input);
|
|
2898
|
+
if (/[^\0-\xFF]/.test(input)) {
|
|
2899
|
+
error(
|
|
2900
|
+
"The string to be encoded contains characters outside of the Latin1 range."
|
|
2901
|
+
);
|
|
2902
|
+
}
|
|
2903
|
+
var padding = input.length % 3;
|
|
2904
|
+
var output = "";
|
|
2905
|
+
var position = -1;
|
|
2906
|
+
var a;
|
|
2907
|
+
var b;
|
|
2908
|
+
var c;
|
|
2909
|
+
var buffer;
|
|
2910
|
+
var length = input.length - padding;
|
|
2911
|
+
while (++position < length) {
|
|
2912
|
+
a = input.charCodeAt(position) << 16;
|
|
2913
|
+
b = input.charCodeAt(++position) << 8;
|
|
2914
|
+
c = input.charCodeAt(++position);
|
|
2915
|
+
buffer = a + b + c;
|
|
2916
|
+
output += TABLE2.charAt(buffer >> 18 & 63) + TABLE2.charAt(buffer >> 12 & 63) + TABLE2.charAt(buffer >> 6 & 63) + TABLE2.charAt(buffer & 63);
|
|
2917
|
+
}
|
|
2918
|
+
if (padding == 2) {
|
|
2919
|
+
a = input.charCodeAt(position) << 8;
|
|
2920
|
+
b = input.charCodeAt(++position);
|
|
2921
|
+
buffer = a + b;
|
|
2922
|
+
output += TABLE2.charAt(buffer >> 10) + TABLE2.charAt(buffer >> 4 & 63) + TABLE2.charAt(buffer << 2 & 63) + "=";
|
|
2923
|
+
} else if (padding == 1) {
|
|
2924
|
+
buffer = input.charCodeAt(position);
|
|
2925
|
+
output += TABLE2.charAt(buffer >> 2) + TABLE2.charAt(buffer << 4 & 63) + "==";
|
|
2926
|
+
}
|
|
2927
|
+
return output;
|
|
2928
|
+
};
|
|
2929
|
+
var base642 = {
|
|
2930
|
+
"encode": encode,
|
|
2931
|
+
"decode": decode,
|
|
2932
|
+
"version": "1.0.0"
|
|
2933
|
+
};
|
|
2934
|
+
if (typeof define == "function" && typeof define.amd == "object" && define.amd) {
|
|
2935
|
+
define(function() {
|
|
2936
|
+
return base642;
|
|
2937
|
+
});
|
|
2938
|
+
} else if (freeExports && !freeExports.nodeType) {
|
|
2939
|
+
if (freeModule) {
|
|
2940
|
+
freeModule.exports = base642;
|
|
2941
|
+
} else {
|
|
2942
|
+
for (var key in base642) {
|
|
2943
|
+
base642.hasOwnProperty(key) && (freeExports[key] = base642[key]);
|
|
2944
|
+
}
|
|
2945
|
+
}
|
|
2946
|
+
} else {
|
|
2947
|
+
root.base64 = base642;
|
|
2948
|
+
}
|
|
2949
|
+
})(exports2);
|
|
2950
|
+
}
|
|
2951
|
+
});
|
|
2952
|
+
|
|
2953
|
+
// ../../node_modules/.pnpm/balanced-match@1.0.2/node_modules/balanced-match/index.js
|
|
2954
|
+
var require_balanced_match = __commonJS({
|
|
2955
|
+
"../../node_modules/.pnpm/balanced-match@1.0.2/node_modules/balanced-match/index.js"(exports2, module2) {
|
|
2956
|
+
"use strict";
|
|
2957
|
+
module2.exports = balanced;
|
|
2958
|
+
function balanced(a, b, str) {
|
|
2959
|
+
if (a instanceof RegExp) a = maybeMatch(a, str);
|
|
2960
|
+
if (b instanceof RegExp) b = maybeMatch(b, str);
|
|
2961
|
+
var r = range(a, b, str);
|
|
2962
|
+
return r && {
|
|
2963
|
+
start: r[0],
|
|
2964
|
+
end: r[1],
|
|
2965
|
+
pre: str.slice(0, r[0]),
|
|
2966
|
+
body: str.slice(r[0] + a.length, r[1]),
|
|
2967
|
+
post: str.slice(r[1] + b.length)
|
|
2968
|
+
};
|
|
2969
|
+
}
|
|
2970
|
+
function maybeMatch(reg, str) {
|
|
2971
|
+
var m = str.match(reg);
|
|
2972
|
+
return m ? m[0] : null;
|
|
2973
|
+
}
|
|
2974
|
+
balanced.range = range;
|
|
2975
|
+
function range(a, b, str) {
|
|
2976
|
+
var begs, beg, left, right, result;
|
|
2977
|
+
var ai = str.indexOf(a);
|
|
2978
|
+
var bi = str.indexOf(b, ai + 1);
|
|
2979
|
+
var i = ai;
|
|
2980
|
+
if (ai >= 0 && bi > 0) {
|
|
2981
|
+
if (a === b) {
|
|
2982
|
+
return [ai, bi];
|
|
2983
|
+
}
|
|
2984
|
+
begs = [];
|
|
2985
|
+
left = str.length;
|
|
2986
|
+
while (i >= 0 && !result) {
|
|
2987
|
+
if (i == ai) {
|
|
2988
|
+
begs.push(i);
|
|
2989
|
+
ai = str.indexOf(a, i + 1);
|
|
2990
|
+
} else if (begs.length == 1) {
|
|
2991
|
+
result = [begs.pop(), bi];
|
|
2992
|
+
} else {
|
|
2993
|
+
beg = begs.pop();
|
|
2994
|
+
if (beg < left) {
|
|
2995
|
+
left = beg;
|
|
2996
|
+
right = bi;
|
|
2997
|
+
}
|
|
2998
|
+
bi = str.indexOf(b, i + 1);
|
|
2999
|
+
}
|
|
3000
|
+
i = ai < bi && ai >= 0 ? ai : bi;
|
|
3001
|
+
}
|
|
3002
|
+
if (begs.length) {
|
|
3003
|
+
result = [left, right];
|
|
3004
|
+
}
|
|
3005
|
+
}
|
|
3006
|
+
return result;
|
|
3007
|
+
}
|
|
3008
|
+
}
|
|
3009
|
+
});
|
|
3010
|
+
|
|
3011
|
+
// ../../node_modules/.pnpm/brace-expansion@2.0.2/node_modules/brace-expansion/index.js
|
|
3012
|
+
var require_brace_expansion = __commonJS({
|
|
3013
|
+
"../../node_modules/.pnpm/brace-expansion@2.0.2/node_modules/brace-expansion/index.js"(exports2, module2) {
|
|
3014
|
+
"use strict";
|
|
3015
|
+
var balanced = require_balanced_match();
|
|
3016
|
+
module2.exports = expandTop;
|
|
3017
|
+
var escSlash = "\0SLASH" + Math.random() + "\0";
|
|
3018
|
+
var escOpen = "\0OPEN" + Math.random() + "\0";
|
|
3019
|
+
var escClose = "\0CLOSE" + Math.random() + "\0";
|
|
3020
|
+
var escComma = "\0COMMA" + Math.random() + "\0";
|
|
3021
|
+
var escPeriod = "\0PERIOD" + Math.random() + "\0";
|
|
3022
|
+
function numeric(str) {
|
|
3023
|
+
return parseInt(str, 10) == str ? parseInt(str, 10) : str.charCodeAt(0);
|
|
3024
|
+
}
|
|
3025
|
+
function escapeBraces(str) {
|
|
3026
|
+
return str.split("\\\\").join(escSlash).split("\\{").join(escOpen).split("\\}").join(escClose).split("\\,").join(escComma).split("\\.").join(escPeriod);
|
|
3027
|
+
}
|
|
3028
|
+
function unescapeBraces(str) {
|
|
3029
|
+
return str.split(escSlash).join("\\").split(escOpen).join("{").split(escClose).join("}").split(escComma).join(",").split(escPeriod).join(".");
|
|
3030
|
+
}
|
|
3031
|
+
function parseCommaParts(str) {
|
|
3032
|
+
if (!str)
|
|
3033
|
+
return [""];
|
|
3034
|
+
var parts = [];
|
|
3035
|
+
var m = balanced("{", "}", str);
|
|
3036
|
+
if (!m)
|
|
3037
|
+
return str.split(",");
|
|
3038
|
+
var pre = m.pre;
|
|
3039
|
+
var body = m.body;
|
|
3040
|
+
var post = m.post;
|
|
3041
|
+
var p = pre.split(",");
|
|
3042
|
+
p[p.length - 1] += "{" + body + "}";
|
|
3043
|
+
var postParts = parseCommaParts(post);
|
|
3044
|
+
if (post.length) {
|
|
3045
|
+
p[p.length - 1] += postParts.shift();
|
|
3046
|
+
p.push.apply(p, postParts);
|
|
3047
|
+
}
|
|
3048
|
+
parts.push.apply(parts, p);
|
|
3049
|
+
return parts;
|
|
3050
|
+
}
|
|
3051
|
+
function expandTop(str) {
|
|
3052
|
+
if (!str)
|
|
3053
|
+
return [];
|
|
3054
|
+
if (str.substr(0, 2) === "{}") {
|
|
3055
|
+
str = "\\{\\}" + str.substr(2);
|
|
3056
|
+
}
|
|
3057
|
+
return expand2(escapeBraces(str), true).map(unescapeBraces);
|
|
3058
|
+
}
|
|
3059
|
+
function embrace(str) {
|
|
3060
|
+
return "{" + str + "}";
|
|
3061
|
+
}
|
|
3062
|
+
function isPadded(el) {
|
|
3063
|
+
return /^-?0\d/.test(el);
|
|
3064
|
+
}
|
|
3065
|
+
function lte(i, y) {
|
|
3066
|
+
return i <= y;
|
|
3067
|
+
}
|
|
3068
|
+
function gte(i, y) {
|
|
3069
|
+
return i >= y;
|
|
3070
|
+
}
|
|
3071
|
+
function expand2(str, isTop) {
|
|
3072
|
+
var expansions = [];
|
|
3073
|
+
var m = balanced("{", "}", str);
|
|
3074
|
+
if (!m) return [str];
|
|
3075
|
+
var pre = m.pre;
|
|
3076
|
+
var post = m.post.length ? expand2(m.post, false) : [""];
|
|
3077
|
+
if (/\$$/.test(m.pre)) {
|
|
3078
|
+
for (var k = 0; k < post.length; k++) {
|
|
3079
|
+
var expansion = pre + "{" + m.body + "}" + post[k];
|
|
3080
|
+
expansions.push(expansion);
|
|
3081
|
+
}
|
|
3082
|
+
} else {
|
|
3083
|
+
var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
|
|
3084
|
+
var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
|
|
3085
|
+
var isSequence = isNumericSequence || isAlphaSequence;
|
|
3086
|
+
var isOptions = m.body.indexOf(",") >= 0;
|
|
3087
|
+
if (!isSequence && !isOptions) {
|
|
3088
|
+
if (m.post.match(/,(?!,).*\}/)) {
|
|
3089
|
+
str = m.pre + "{" + m.body + escClose + m.post;
|
|
3090
|
+
return expand2(str);
|
|
3091
|
+
}
|
|
3092
|
+
return [str];
|
|
3093
|
+
}
|
|
3094
|
+
var n;
|
|
3095
|
+
if (isSequence) {
|
|
3096
|
+
n = m.body.split(/\.\./);
|
|
3097
|
+
} else {
|
|
3098
|
+
n = parseCommaParts(m.body);
|
|
3099
|
+
if (n.length === 1) {
|
|
3100
|
+
n = expand2(n[0], false).map(embrace);
|
|
3101
|
+
if (n.length === 1) {
|
|
3102
|
+
return post.map(function(p) {
|
|
3103
|
+
return m.pre + n[0] + p;
|
|
3104
|
+
});
|
|
3105
|
+
}
|
|
3106
|
+
}
|
|
3107
|
+
}
|
|
3108
|
+
var N;
|
|
3109
|
+
if (isSequence) {
|
|
3110
|
+
var x = numeric(n[0]);
|
|
3111
|
+
var y = numeric(n[1]);
|
|
3112
|
+
var width = Math.max(n[0].length, n[1].length);
|
|
3113
|
+
var incr = n.length == 3 ? Math.abs(numeric(n[2])) : 1;
|
|
3114
|
+
var test = lte;
|
|
3115
|
+
var reverse = y < x;
|
|
3116
|
+
if (reverse) {
|
|
3117
|
+
incr *= -1;
|
|
3118
|
+
test = gte;
|
|
3119
|
+
}
|
|
3120
|
+
var pad = n.some(isPadded);
|
|
3121
|
+
N = [];
|
|
3122
|
+
for (var i = x; test(i, y); i += incr) {
|
|
3123
|
+
var c;
|
|
3124
|
+
if (isAlphaSequence) {
|
|
3125
|
+
c = String.fromCharCode(i);
|
|
3126
|
+
if (c === "\\")
|
|
3127
|
+
c = "";
|
|
3128
|
+
} else {
|
|
3129
|
+
c = String(i);
|
|
3130
|
+
if (pad) {
|
|
3131
|
+
var need = width - c.length;
|
|
3132
|
+
if (need > 0) {
|
|
3133
|
+
var z = new Array(need + 1).join("0");
|
|
3134
|
+
if (i < 0)
|
|
3135
|
+
c = "-" + z + c.slice(1);
|
|
3136
|
+
else
|
|
3137
|
+
c = z + c;
|
|
3138
|
+
}
|
|
3139
|
+
}
|
|
3140
|
+
}
|
|
3141
|
+
N.push(c);
|
|
3142
|
+
}
|
|
3143
|
+
} else {
|
|
3144
|
+
N = [];
|
|
3145
|
+
for (var j = 0; j < n.length; j++) {
|
|
3146
|
+
N.push.apply(N, expand2(n[j], false));
|
|
3147
|
+
}
|
|
3148
|
+
}
|
|
3149
|
+
for (var j = 0; j < N.length; j++) {
|
|
3150
|
+
for (var k = 0; k < post.length; k++) {
|
|
3151
|
+
var expansion = pre + N[j] + post[k];
|
|
3152
|
+
if (!isTop || isSequence || expansion)
|
|
3153
|
+
expansions.push(expansion);
|
|
3154
|
+
}
|
|
3155
|
+
}
|
|
3156
|
+
}
|
|
3157
|
+
return expansions;
|
|
3158
|
+
}
|
|
3159
|
+
}
|
|
3160
|
+
});
|
|
3161
|
+
|
|
3162
|
+
// ../../node_modules/.pnpm/fast-xml-parser@4.5.3/node_modules/fast-xml-parser/src/util.js
|
|
3163
|
+
var require_util = __commonJS({
|
|
3164
|
+
"../../node_modules/.pnpm/fast-xml-parser@4.5.3/node_modules/fast-xml-parser/src/util.js"(exports2) {
|
|
3165
|
+
"use strict";
|
|
3166
|
+
var nameStartChar = ":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD";
|
|
3167
|
+
var nameChar = nameStartChar + "\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040";
|
|
3168
|
+
var nameRegexp = "[" + nameStartChar + "][" + nameChar + "]*";
|
|
3169
|
+
var regexName = new RegExp("^" + nameRegexp + "$");
|
|
3170
|
+
var getAllMatches = function(string, regex) {
|
|
3171
|
+
const matches = [];
|
|
3172
|
+
let match2 = regex.exec(string);
|
|
3173
|
+
while (match2) {
|
|
3174
|
+
const allmatches = [];
|
|
3175
|
+
allmatches.startIndex = regex.lastIndex - match2[0].length;
|
|
3176
|
+
const len = match2.length;
|
|
3177
|
+
for (let index = 0; index < len; index++) {
|
|
3178
|
+
allmatches.push(match2[index]);
|
|
3179
|
+
}
|
|
3180
|
+
matches.push(allmatches);
|
|
3181
|
+
match2 = regex.exec(string);
|
|
3182
|
+
}
|
|
3183
|
+
return matches;
|
|
3184
|
+
};
|
|
3185
|
+
var isName = function(string) {
|
|
3186
|
+
const match2 = regexName.exec(string);
|
|
3187
|
+
return !(match2 === null || typeof match2 === "undefined");
|
|
3188
|
+
};
|
|
3189
|
+
exports2.isExist = function(v) {
|
|
3190
|
+
return typeof v !== "undefined";
|
|
3191
|
+
};
|
|
3192
|
+
exports2.isEmptyObject = function(obj) {
|
|
3193
|
+
return Object.keys(obj).length === 0;
|
|
3194
|
+
};
|
|
3195
|
+
exports2.merge = function(target, a, arrayMode) {
|
|
3196
|
+
if (a) {
|
|
3197
|
+
const keys = Object.keys(a);
|
|
3198
|
+
const len = keys.length;
|
|
3199
|
+
for (let i = 0; i < len; i++) {
|
|
3200
|
+
if (arrayMode === "strict") {
|
|
3201
|
+
target[keys[i]] = [a[keys[i]]];
|
|
3202
|
+
} else {
|
|
3203
|
+
target[keys[i]] = a[keys[i]];
|
|
3204
|
+
}
|
|
3205
|
+
}
|
|
3206
|
+
}
|
|
3207
|
+
};
|
|
3208
|
+
exports2.getValue = function(v) {
|
|
3209
|
+
if (exports2.isExist(v)) {
|
|
3210
|
+
return v;
|
|
3211
|
+
} else {
|
|
3212
|
+
return "";
|
|
3213
|
+
}
|
|
3214
|
+
};
|
|
3215
|
+
exports2.isName = isName;
|
|
3216
|
+
exports2.getAllMatches = getAllMatches;
|
|
3217
|
+
exports2.nameRegexp = nameRegexp;
|
|
3218
|
+
}
|
|
3219
|
+
});
|
|
3220
|
+
|
|
3221
|
+
// ../../node_modules/.pnpm/fast-xml-parser@4.5.3/node_modules/fast-xml-parser/src/validator.js
|
|
3222
|
+
var require_validator = __commonJS({
|
|
3223
|
+
"../../node_modules/.pnpm/fast-xml-parser@4.5.3/node_modules/fast-xml-parser/src/validator.js"(exports2) {
|
|
3224
|
+
"use strict";
|
|
3225
|
+
var util = require_util();
|
|
3226
|
+
var defaultOptions = {
|
|
3227
|
+
allowBooleanAttributes: false,
|
|
3228
|
+
//A tag can have attributes without any value
|
|
3229
|
+
unpairedTags: []
|
|
3230
|
+
};
|
|
3231
|
+
exports2.validate = function(xmlData, options) {
|
|
3232
|
+
options = Object.assign({}, defaultOptions, options);
|
|
3233
|
+
const tags = [];
|
|
3234
|
+
let tagFound = false;
|
|
3235
|
+
let reachedRoot = false;
|
|
3236
|
+
if (xmlData[0] === "\uFEFF") {
|
|
3237
|
+
xmlData = xmlData.substr(1);
|
|
3238
|
+
}
|
|
3239
|
+
for (let i = 0; i < xmlData.length; i++) {
|
|
3240
|
+
if (xmlData[i] === "<" && xmlData[i + 1] === "?") {
|
|
3241
|
+
i += 2;
|
|
3242
|
+
i = readPI(xmlData, i);
|
|
3243
|
+
if (i.err) return i;
|
|
3244
|
+
} else if (xmlData[i] === "<") {
|
|
3245
|
+
let tagStartPos = i;
|
|
3246
|
+
i++;
|
|
3247
|
+
if (xmlData[i] === "!") {
|
|
3248
|
+
i = readCommentAndCDATA(xmlData, i);
|
|
3249
|
+
continue;
|
|
3250
|
+
} else {
|
|
3251
|
+
let closingTag = false;
|
|
3252
|
+
if (xmlData[i] === "/") {
|
|
3253
|
+
closingTag = true;
|
|
3254
|
+
i++;
|
|
3255
|
+
}
|
|
3256
|
+
let tagName = "";
|
|
3257
|
+
for (; i < xmlData.length && xmlData[i] !== ">" && xmlData[i] !== " " && xmlData[i] !== " " && xmlData[i] !== "\n" && xmlData[i] !== "\r"; i++) {
|
|
3258
|
+
tagName += xmlData[i];
|
|
3259
|
+
}
|
|
3260
|
+
tagName = tagName.trim();
|
|
3261
|
+
if (tagName[tagName.length - 1] === "/") {
|
|
3262
|
+
tagName = tagName.substring(0, tagName.length - 1);
|
|
3263
|
+
i--;
|
|
3264
|
+
}
|
|
3265
|
+
if (!validateTagName(tagName)) {
|
|
3266
|
+
let msg;
|
|
3267
|
+
if (tagName.trim().length === 0) {
|
|
3268
|
+
msg = "Invalid space after '<'.";
|
|
3269
|
+
} else {
|
|
3270
|
+
msg = "Tag '" + tagName + "' is an invalid name.";
|
|
3271
|
+
}
|
|
3272
|
+
return getErrorObject("InvalidTag", msg, getLineNumberForPosition(xmlData, i));
|
|
3273
|
+
}
|
|
3274
|
+
const result = readAttributeStr(xmlData, i);
|
|
3275
|
+
if (result === false) {
|
|
3276
|
+
return getErrorObject("InvalidAttr", "Attributes for '" + tagName + "' have open quote.", getLineNumberForPosition(xmlData, i));
|
|
3277
|
+
}
|
|
3278
|
+
let attrStr = result.value;
|
|
3279
|
+
i = result.index;
|
|
3280
|
+
if (attrStr[attrStr.length - 1] === "/") {
|
|
3281
|
+
const attrStrStart = i - attrStr.length;
|
|
3282
|
+
attrStr = attrStr.substring(0, attrStr.length - 1);
|
|
3283
|
+
const isValid = validateAttributeString(attrStr, options);
|
|
3284
|
+
if (isValid === true) {
|
|
3285
|
+
tagFound = true;
|
|
3286
|
+
} else {
|
|
3287
|
+
return getErrorObject(isValid.err.code, isValid.err.msg, getLineNumberForPosition(xmlData, attrStrStart + isValid.err.line));
|
|
3288
|
+
}
|
|
3289
|
+
} else if (closingTag) {
|
|
3290
|
+
if (!result.tagClosed) {
|
|
3291
|
+
return getErrorObject("InvalidTag", "Closing tag '" + tagName + "' doesn't have proper closing.", getLineNumberForPosition(xmlData, i));
|
|
3292
|
+
} else if (attrStr.trim().length > 0) {
|
|
3293
|
+
return getErrorObject("InvalidTag", "Closing tag '" + tagName + "' can't have attributes or invalid starting.", getLineNumberForPosition(xmlData, tagStartPos));
|
|
3294
|
+
} else if (tags.length === 0) {
|
|
3295
|
+
return getErrorObject("InvalidTag", "Closing tag '" + tagName + "' has not been opened.", getLineNumberForPosition(xmlData, tagStartPos));
|
|
3296
|
+
} else {
|
|
3297
|
+
const otg = tags.pop();
|
|
3298
|
+
if (tagName !== otg.tagName) {
|
|
3299
|
+
let openPos = getLineNumberForPosition(xmlData, otg.tagStartPos);
|
|
3300
|
+
return getErrorObject(
|
|
3301
|
+
"InvalidTag",
|
|
3302
|
+
"Expected closing tag '" + otg.tagName + "' (opened in line " + openPos.line + ", col " + openPos.col + ") instead of closing tag '" + tagName + "'.",
|
|
3303
|
+
getLineNumberForPosition(xmlData, tagStartPos)
|
|
3304
|
+
);
|
|
3305
|
+
}
|
|
3306
|
+
if (tags.length == 0) {
|
|
3307
|
+
reachedRoot = true;
|
|
3308
|
+
}
|
|
3309
|
+
}
|
|
3310
|
+
} else {
|
|
3311
|
+
const isValid = validateAttributeString(attrStr, options);
|
|
3312
|
+
if (isValid !== true) {
|
|
3313
|
+
return getErrorObject(isValid.err.code, isValid.err.msg, getLineNumberForPosition(xmlData, i - attrStr.length + isValid.err.line));
|
|
3314
|
+
}
|
|
3315
|
+
if (reachedRoot === true) {
|
|
3316
|
+
return getErrorObject("InvalidXml", "Multiple possible root nodes found.", getLineNumberForPosition(xmlData, i));
|
|
3317
|
+
} else if (options.unpairedTags.indexOf(tagName) !== -1) {
|
|
3318
|
+
} else {
|
|
3319
|
+
tags.push({ tagName, tagStartPos });
|
|
3320
|
+
}
|
|
3321
|
+
tagFound = true;
|
|
3322
|
+
}
|
|
3323
|
+
for (i++; i < xmlData.length; i++) {
|
|
3324
|
+
if (xmlData[i] === "<") {
|
|
3325
|
+
if (xmlData[i + 1] === "!") {
|
|
3326
|
+
i++;
|
|
3327
|
+
i = readCommentAndCDATA(xmlData, i);
|
|
3328
|
+
continue;
|
|
3329
|
+
} else if (xmlData[i + 1] === "?") {
|
|
3330
|
+
i = readPI(xmlData, ++i);
|
|
3331
|
+
if (i.err) return i;
|
|
3332
|
+
} else {
|
|
3333
|
+
break;
|
|
3334
|
+
}
|
|
3335
|
+
} else if (xmlData[i] === "&") {
|
|
3336
|
+
const afterAmp = validateAmpersand(xmlData, i);
|
|
3337
|
+
if (afterAmp == -1)
|
|
3338
|
+
return getErrorObject("InvalidChar", "char '&' is not expected.", getLineNumberForPosition(xmlData, i));
|
|
3339
|
+
i = afterAmp;
|
|
3340
|
+
} else {
|
|
3341
|
+
if (reachedRoot === true && !isWhiteSpace(xmlData[i])) {
|
|
3342
|
+
return getErrorObject("InvalidXml", "Extra text at the end", getLineNumberForPosition(xmlData, i));
|
|
3343
|
+
}
|
|
3344
|
+
}
|
|
3345
|
+
}
|
|
3346
|
+
if (xmlData[i] === "<") {
|
|
3347
|
+
i--;
|
|
3348
|
+
}
|
|
3349
|
+
}
|
|
3350
|
+
} else {
|
|
3351
|
+
if (isWhiteSpace(xmlData[i])) {
|
|
3352
|
+
continue;
|
|
3353
|
+
}
|
|
3354
|
+
return getErrorObject("InvalidChar", "char '" + xmlData[i] + "' is not expected.", getLineNumberForPosition(xmlData, i));
|
|
3355
|
+
}
|
|
3356
|
+
}
|
|
3357
|
+
if (!tagFound) {
|
|
3358
|
+
return getErrorObject("InvalidXml", "Start tag expected.", 1);
|
|
3359
|
+
} else if (tags.length == 1) {
|
|
3360
|
+
return getErrorObject("InvalidTag", "Unclosed tag '" + tags[0].tagName + "'.", getLineNumberForPosition(xmlData, tags[0].tagStartPos));
|
|
3361
|
+
} else if (tags.length > 0) {
|
|
3362
|
+
return getErrorObject("InvalidXml", "Invalid '" + JSON.stringify(tags.map((t) => t.tagName), null, 4).replace(/\r?\n/g, "") + "' found.", { line: 1, col: 1 });
|
|
3363
|
+
}
|
|
3364
|
+
return true;
|
|
3365
|
+
};
|
|
3366
|
+
function isWhiteSpace(char) {
|
|
3367
|
+
return char === " " || char === " " || char === "\n" || char === "\r";
|
|
3368
|
+
}
|
|
3369
|
+
function readPI(xmlData, i) {
|
|
3370
|
+
const start = i;
|
|
3371
|
+
for (; i < xmlData.length; i++) {
|
|
3372
|
+
if (xmlData[i] == "?" || xmlData[i] == " ") {
|
|
3373
|
+
const tagname = xmlData.substr(start, i - start);
|
|
3374
|
+
if (i > 5 && tagname === "xml") {
|
|
3375
|
+
return getErrorObject("InvalidXml", "XML declaration allowed only at the start of the document.", getLineNumberForPosition(xmlData, i));
|
|
3376
|
+
} else if (xmlData[i] == "?" && xmlData[i + 1] == ">") {
|
|
3377
|
+
i++;
|
|
3378
|
+
break;
|
|
3379
|
+
} else {
|
|
3380
|
+
continue;
|
|
3381
|
+
}
|
|
3382
|
+
}
|
|
3383
|
+
}
|
|
3384
|
+
return i;
|
|
3385
|
+
}
|
|
3386
|
+
function readCommentAndCDATA(xmlData, i) {
|
|
3387
|
+
if (xmlData.length > i + 5 && xmlData[i + 1] === "-" && xmlData[i + 2] === "-") {
|
|
3388
|
+
for (i += 3; i < xmlData.length; i++) {
|
|
3389
|
+
if (xmlData[i] === "-" && xmlData[i + 1] === "-" && xmlData[i + 2] === ">") {
|
|
3390
|
+
i += 2;
|
|
3391
|
+
break;
|
|
3392
|
+
}
|
|
3393
|
+
}
|
|
3394
|
+
} else if (xmlData.length > i + 8 && xmlData[i + 1] === "D" && xmlData[i + 2] === "O" && xmlData[i + 3] === "C" && xmlData[i + 4] === "T" && xmlData[i + 5] === "Y" && xmlData[i + 6] === "P" && xmlData[i + 7] === "E") {
|
|
3395
|
+
let angleBracketsCount = 1;
|
|
3396
|
+
for (i += 8; i < xmlData.length; i++) {
|
|
3397
|
+
if (xmlData[i] === "<") {
|
|
3398
|
+
angleBracketsCount++;
|
|
3399
|
+
} else if (xmlData[i] === ">") {
|
|
3400
|
+
angleBracketsCount--;
|
|
3401
|
+
if (angleBracketsCount === 0) {
|
|
3402
|
+
break;
|
|
3403
|
+
}
|
|
3404
|
+
}
|
|
3405
|
+
}
|
|
3406
|
+
} else if (xmlData.length > i + 9 && xmlData[i + 1] === "[" && xmlData[i + 2] === "C" && xmlData[i + 3] === "D" && xmlData[i + 4] === "A" && xmlData[i + 5] === "T" && xmlData[i + 6] === "A" && xmlData[i + 7] === "[") {
|
|
3407
|
+
for (i += 8; i < xmlData.length; i++) {
|
|
3408
|
+
if (xmlData[i] === "]" && xmlData[i + 1] === "]" && xmlData[i + 2] === ">") {
|
|
3409
|
+
i += 2;
|
|
3410
|
+
break;
|
|
3411
|
+
}
|
|
3412
|
+
}
|
|
3413
|
+
}
|
|
3414
|
+
return i;
|
|
3415
|
+
}
|
|
3416
|
+
var doubleQuote = '"';
|
|
3417
|
+
var singleQuote = "'";
|
|
3418
|
+
function readAttributeStr(xmlData, i) {
|
|
3419
|
+
let attrStr = "";
|
|
3420
|
+
let startChar = "";
|
|
3421
|
+
let tagClosed = false;
|
|
3422
|
+
for (; i < xmlData.length; i++) {
|
|
3423
|
+
if (xmlData[i] === doubleQuote || xmlData[i] === singleQuote) {
|
|
3424
|
+
if (startChar === "") {
|
|
3425
|
+
startChar = xmlData[i];
|
|
3426
|
+
} else if (startChar !== xmlData[i]) {
|
|
3427
|
+
} else {
|
|
3428
|
+
startChar = "";
|
|
3429
|
+
}
|
|
3430
|
+
} else if (xmlData[i] === ">") {
|
|
3431
|
+
if (startChar === "") {
|
|
3432
|
+
tagClosed = true;
|
|
3433
|
+
break;
|
|
3434
|
+
}
|
|
3435
|
+
}
|
|
3436
|
+
attrStr += xmlData[i];
|
|
3437
|
+
}
|
|
3438
|
+
if (startChar !== "") {
|
|
3439
|
+
return false;
|
|
3440
|
+
}
|
|
3441
|
+
return {
|
|
3442
|
+
value: attrStr,
|
|
3443
|
+
index: i,
|
|
3444
|
+
tagClosed
|
|
3445
|
+
};
|
|
3446
|
+
}
|
|
3447
|
+
var validAttrStrRegxp = new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`, "g");
|
|
3448
|
+
function validateAttributeString(attrStr, options) {
|
|
3449
|
+
const matches = util.getAllMatches(attrStr, validAttrStrRegxp);
|
|
3450
|
+
const attrNames = {};
|
|
3451
|
+
for (let i = 0; i < matches.length; i++) {
|
|
3452
|
+
if (matches[i][1].length === 0) {
|
|
3453
|
+
return getErrorObject("InvalidAttr", "Attribute '" + matches[i][2] + "' has no space in starting.", getPositionFromMatch(matches[i]));
|
|
3454
|
+
} else if (matches[i][3] !== void 0 && matches[i][4] === void 0) {
|
|
3455
|
+
return getErrorObject("InvalidAttr", "Attribute '" + matches[i][2] + "' is without value.", getPositionFromMatch(matches[i]));
|
|
3456
|
+
} else if (matches[i][3] === void 0 && !options.allowBooleanAttributes) {
|
|
3457
|
+
return getErrorObject("InvalidAttr", "boolean attribute '" + matches[i][2] + "' is not allowed.", getPositionFromMatch(matches[i]));
|
|
3458
|
+
}
|
|
3459
|
+
const attrName = matches[i][2];
|
|
3460
|
+
if (!validateAttrName(attrName)) {
|
|
3461
|
+
return getErrorObject("InvalidAttr", "Attribute '" + attrName + "' is an invalid name.", getPositionFromMatch(matches[i]));
|
|
3462
|
+
}
|
|
3463
|
+
if (!attrNames.hasOwnProperty(attrName)) {
|
|
3464
|
+
attrNames[attrName] = 1;
|
|
3465
|
+
} else {
|
|
3466
|
+
return getErrorObject("InvalidAttr", "Attribute '" + attrName + "' is repeated.", getPositionFromMatch(matches[i]));
|
|
3467
|
+
}
|
|
3468
|
+
}
|
|
3469
|
+
return true;
|
|
3470
|
+
}
|
|
3471
|
+
function validateNumberAmpersand(xmlData, i) {
|
|
3472
|
+
let re = /\d/;
|
|
3473
|
+
if (xmlData[i] === "x") {
|
|
3474
|
+
i++;
|
|
3475
|
+
re = /[\da-fA-F]/;
|
|
3476
|
+
}
|
|
3477
|
+
for (; i < xmlData.length; i++) {
|
|
3478
|
+
if (xmlData[i] === ";")
|
|
3479
|
+
return i;
|
|
3480
|
+
if (!xmlData[i].match(re))
|
|
3481
|
+
break;
|
|
3482
|
+
}
|
|
3483
|
+
return -1;
|
|
3484
|
+
}
|
|
3485
|
+
function validateAmpersand(xmlData, i) {
|
|
3486
|
+
i++;
|
|
3487
|
+
if (xmlData[i] === ";")
|
|
3488
|
+
return -1;
|
|
3489
|
+
if (xmlData[i] === "#") {
|
|
3490
|
+
i++;
|
|
3491
|
+
return validateNumberAmpersand(xmlData, i);
|
|
3492
|
+
}
|
|
3493
|
+
let count = 0;
|
|
3494
|
+
for (; i < xmlData.length; i++, count++) {
|
|
3495
|
+
if (xmlData[i].match(/\w/) && count < 20)
|
|
3496
|
+
continue;
|
|
3497
|
+
if (xmlData[i] === ";")
|
|
3498
|
+
break;
|
|
3499
|
+
return -1;
|
|
3500
|
+
}
|
|
3501
|
+
return i;
|
|
3502
|
+
}
|
|
3503
|
+
function getErrorObject(code, message, lineNumber) {
|
|
3504
|
+
return {
|
|
3505
|
+
err: {
|
|
3506
|
+
code,
|
|
3507
|
+
msg: message,
|
|
3508
|
+
line: lineNumber.line || lineNumber,
|
|
3509
|
+
col: lineNumber.col
|
|
3510
|
+
}
|
|
3511
|
+
};
|
|
3512
|
+
}
|
|
3513
|
+
function validateAttrName(attrName) {
|
|
3514
|
+
return util.isName(attrName);
|
|
3515
|
+
}
|
|
3516
|
+
function validateTagName(tagname) {
|
|
3517
|
+
return util.isName(tagname);
|
|
3518
|
+
}
|
|
3519
|
+
function getLineNumberForPosition(xmlData, index) {
|
|
3520
|
+
const lines = xmlData.substring(0, index).split(/\r?\n/);
|
|
3521
|
+
return {
|
|
3522
|
+
line: lines.length,
|
|
3523
|
+
// column number is last line's length + 1, because column numbering starts at 1:
|
|
3524
|
+
col: lines[lines.length - 1].length + 1
|
|
3525
|
+
};
|
|
3526
|
+
}
|
|
3527
|
+
function getPositionFromMatch(match2) {
|
|
3528
|
+
return match2.startIndex + match2[1].length;
|
|
3529
|
+
}
|
|
3530
|
+
}
|
|
3531
|
+
});
|
|
3532
|
+
|
|
3533
|
+
// ../../node_modules/.pnpm/fast-xml-parser@4.5.3/node_modules/fast-xml-parser/src/xmlparser/OptionsBuilder.js
|
|
3534
|
+
var require_OptionsBuilder = __commonJS({
|
|
3535
|
+
"../../node_modules/.pnpm/fast-xml-parser@4.5.3/node_modules/fast-xml-parser/src/xmlparser/OptionsBuilder.js"(exports2) {
|
|
3536
|
+
"use strict";
|
|
3537
|
+
var defaultOptions = {
|
|
3538
|
+
preserveOrder: false,
|
|
3539
|
+
attributeNamePrefix: "@_",
|
|
3540
|
+
attributesGroupName: false,
|
|
3541
|
+
textNodeName: "#text",
|
|
3542
|
+
ignoreAttributes: true,
|
|
3543
|
+
removeNSPrefix: false,
|
|
3544
|
+
// remove NS from tag name or attribute name if true
|
|
3545
|
+
allowBooleanAttributes: false,
|
|
3546
|
+
//a tag can have attributes without any value
|
|
3547
|
+
//ignoreRootElement : false,
|
|
3548
|
+
parseTagValue: true,
|
|
3549
|
+
parseAttributeValue: false,
|
|
3550
|
+
trimValues: true,
|
|
3551
|
+
//Trim string values of tag and attributes
|
|
3552
|
+
cdataPropName: false,
|
|
3553
|
+
numberParseOptions: {
|
|
3554
|
+
hex: true,
|
|
3555
|
+
leadingZeros: true,
|
|
3556
|
+
eNotation: true
|
|
3557
|
+
},
|
|
3558
|
+
tagValueProcessor: function(tagName, val) {
|
|
3559
|
+
return val;
|
|
3560
|
+
},
|
|
3561
|
+
attributeValueProcessor: function(attrName, val) {
|
|
3562
|
+
return val;
|
|
3563
|
+
},
|
|
3564
|
+
stopNodes: [],
|
|
3565
|
+
//nested tags will not be parsed even for errors
|
|
3566
|
+
alwaysCreateTextNode: false,
|
|
3567
|
+
isArray: () => false,
|
|
3568
|
+
commentPropName: false,
|
|
3569
|
+
unpairedTags: [],
|
|
3570
|
+
processEntities: true,
|
|
3571
|
+
htmlEntities: false,
|
|
3572
|
+
ignoreDeclaration: false,
|
|
3573
|
+
ignorePiTags: false,
|
|
3574
|
+
transformTagName: false,
|
|
3575
|
+
transformAttributeName: false,
|
|
3576
|
+
updateTag: function(tagName, jPath, attrs) {
|
|
3577
|
+
return tagName;
|
|
3578
|
+
}
|
|
3579
|
+
// skipEmptyListItem: false
|
|
3580
|
+
};
|
|
3581
|
+
var buildOptions = function(options) {
|
|
3582
|
+
return Object.assign({}, defaultOptions, options);
|
|
3583
|
+
};
|
|
3584
|
+
exports2.buildOptions = buildOptions;
|
|
3585
|
+
exports2.defaultOptions = defaultOptions;
|
|
3586
|
+
}
|
|
3587
|
+
});
|
|
3588
|
+
|
|
3589
|
+
// ../../node_modules/.pnpm/fast-xml-parser@4.5.3/node_modules/fast-xml-parser/src/xmlparser/xmlNode.js
|
|
3590
|
+
var require_xmlNode = __commonJS({
|
|
3591
|
+
"../../node_modules/.pnpm/fast-xml-parser@4.5.3/node_modules/fast-xml-parser/src/xmlparser/xmlNode.js"(exports2, module2) {
|
|
3592
|
+
"use strict";
|
|
3593
|
+
var XmlNode = class {
|
|
3594
|
+
constructor(tagname) {
|
|
3595
|
+
this.tagname = tagname;
|
|
3596
|
+
this.child = [];
|
|
3597
|
+
this[":@"] = {};
|
|
3598
|
+
}
|
|
3599
|
+
add(key, val) {
|
|
3600
|
+
if (key === "__proto__") key = "#__proto__";
|
|
3601
|
+
this.child.push({ [key]: val });
|
|
3602
|
+
}
|
|
3603
|
+
addChild(node) {
|
|
3604
|
+
if (node.tagname === "__proto__") node.tagname = "#__proto__";
|
|
3605
|
+
if (node[":@"] && Object.keys(node[":@"]).length > 0) {
|
|
3606
|
+
this.child.push({ [node.tagname]: node.child, [":@"]: node[":@"] });
|
|
3607
|
+
} else {
|
|
3608
|
+
this.child.push({ [node.tagname]: node.child });
|
|
3609
|
+
}
|
|
3610
|
+
}
|
|
3611
|
+
};
|
|
3612
|
+
module2.exports = XmlNode;
|
|
3613
|
+
}
|
|
3614
|
+
});
|
|
3615
|
+
|
|
3616
|
+
// ../../node_modules/.pnpm/fast-xml-parser@4.5.3/node_modules/fast-xml-parser/src/xmlparser/DocTypeReader.js
|
|
3617
|
+
var require_DocTypeReader = __commonJS({
|
|
3618
|
+
"../../node_modules/.pnpm/fast-xml-parser@4.5.3/node_modules/fast-xml-parser/src/xmlparser/DocTypeReader.js"(exports2, module2) {
|
|
3619
|
+
"use strict";
|
|
3620
|
+
var util = require_util();
|
|
3621
|
+
function readDocType(xmlData, i) {
|
|
3622
|
+
const entities = {};
|
|
3623
|
+
if (xmlData[i + 3] === "O" && xmlData[i + 4] === "C" && xmlData[i + 5] === "T" && xmlData[i + 6] === "Y" && xmlData[i + 7] === "P" && xmlData[i + 8] === "E") {
|
|
3624
|
+
i = i + 9;
|
|
3625
|
+
let angleBracketsCount = 1;
|
|
3626
|
+
let hasBody = false, comment = false;
|
|
3627
|
+
let exp = "";
|
|
3628
|
+
for (; i < xmlData.length; i++) {
|
|
3629
|
+
if (xmlData[i] === "<" && !comment) {
|
|
3630
|
+
if (hasBody && isEntity(xmlData, i)) {
|
|
3631
|
+
i += 7;
|
|
3632
|
+
let entityName, val;
|
|
3633
|
+
[entityName, val, i] = readEntityExp(xmlData, i + 1);
|
|
3634
|
+
if (val.indexOf("&") === -1)
|
|
3635
|
+
entities[validateEntityName(entityName)] = {
|
|
3636
|
+
regx: RegExp(`&${entityName};`, "g"),
|
|
3637
|
+
val
|
|
3638
|
+
};
|
|
3639
|
+
} else if (hasBody && isElement(xmlData, i)) i += 8;
|
|
3640
|
+
else if (hasBody && isAttlist(xmlData, i)) i += 8;
|
|
3641
|
+
else if (hasBody && isNotation(xmlData, i)) i += 9;
|
|
3642
|
+
else if (isComment) comment = true;
|
|
3643
|
+
else throw new Error("Invalid DOCTYPE");
|
|
3644
|
+
angleBracketsCount++;
|
|
3645
|
+
exp = "";
|
|
3646
|
+
} else if (xmlData[i] === ">") {
|
|
3647
|
+
if (comment) {
|
|
3648
|
+
if (xmlData[i - 1] === "-" && xmlData[i - 2] === "-") {
|
|
3649
|
+
comment = false;
|
|
3650
|
+
angleBracketsCount--;
|
|
3651
|
+
}
|
|
3652
|
+
} else {
|
|
3653
|
+
angleBracketsCount--;
|
|
3654
|
+
}
|
|
3655
|
+
if (angleBracketsCount === 0) {
|
|
3656
|
+
break;
|
|
3657
|
+
}
|
|
3658
|
+
} else if (xmlData[i] === "[") {
|
|
3659
|
+
hasBody = true;
|
|
3660
|
+
} else {
|
|
3661
|
+
exp += xmlData[i];
|
|
3662
|
+
}
|
|
3663
|
+
}
|
|
3664
|
+
if (angleBracketsCount !== 0) {
|
|
3665
|
+
throw new Error(`Unclosed DOCTYPE`);
|
|
3666
|
+
}
|
|
3667
|
+
} else {
|
|
3668
|
+
throw new Error(`Invalid Tag instead of DOCTYPE`);
|
|
3669
|
+
}
|
|
3670
|
+
return { entities, i };
|
|
3671
|
+
}
|
|
3672
|
+
function readEntityExp(xmlData, i) {
|
|
3673
|
+
let entityName = "";
|
|
3674
|
+
for (; i < xmlData.length && (xmlData[i] !== "'" && xmlData[i] !== '"'); i++) {
|
|
3675
|
+
entityName += xmlData[i];
|
|
3676
|
+
}
|
|
3677
|
+
entityName = entityName.trim();
|
|
3678
|
+
if (entityName.indexOf(" ") !== -1) throw new Error("External entites are not supported");
|
|
3679
|
+
const startChar = xmlData[i++];
|
|
3680
|
+
let val = "";
|
|
3681
|
+
for (; i < xmlData.length && xmlData[i] !== startChar; i++) {
|
|
3682
|
+
val += xmlData[i];
|
|
3683
|
+
}
|
|
3684
|
+
return [entityName, val, i];
|
|
3685
|
+
}
|
|
3686
|
+
function isComment(xmlData, i) {
|
|
3687
|
+
if (xmlData[i + 1] === "!" && xmlData[i + 2] === "-" && xmlData[i + 3] === "-") return true;
|
|
3688
|
+
return false;
|
|
3689
|
+
}
|
|
3690
|
+
function isEntity(xmlData, i) {
|
|
3691
|
+
if (xmlData[i + 1] === "!" && xmlData[i + 2] === "E" && xmlData[i + 3] === "N" && xmlData[i + 4] === "T" && xmlData[i + 5] === "I" && xmlData[i + 6] === "T" && xmlData[i + 7] === "Y") return true;
|
|
3692
|
+
return false;
|
|
3693
|
+
}
|
|
3694
|
+
function isElement(xmlData, i) {
|
|
3695
|
+
if (xmlData[i + 1] === "!" && xmlData[i + 2] === "E" && xmlData[i + 3] === "L" && xmlData[i + 4] === "E" && xmlData[i + 5] === "M" && xmlData[i + 6] === "E" && xmlData[i + 7] === "N" && xmlData[i + 8] === "T") return true;
|
|
3696
|
+
return false;
|
|
3697
|
+
}
|
|
3698
|
+
function isAttlist(xmlData, i) {
|
|
3699
|
+
if (xmlData[i + 1] === "!" && xmlData[i + 2] === "A" && xmlData[i + 3] === "T" && xmlData[i + 4] === "T" && xmlData[i + 5] === "L" && xmlData[i + 6] === "I" && xmlData[i + 7] === "S" && xmlData[i + 8] === "T") return true;
|
|
3700
|
+
return false;
|
|
3701
|
+
}
|
|
3702
|
+
function isNotation(xmlData, i) {
|
|
3703
|
+
if (xmlData[i + 1] === "!" && xmlData[i + 2] === "N" && xmlData[i + 3] === "O" && xmlData[i + 4] === "T" && xmlData[i + 5] === "A" && xmlData[i + 6] === "T" && xmlData[i + 7] === "I" && xmlData[i + 8] === "O" && xmlData[i + 9] === "N") return true;
|
|
3704
|
+
return false;
|
|
3705
|
+
}
|
|
3706
|
+
function validateEntityName(name) {
|
|
3707
|
+
if (util.isName(name))
|
|
3708
|
+
return name;
|
|
3709
|
+
else
|
|
3710
|
+
throw new Error(`Invalid entity name ${name}`);
|
|
3711
|
+
}
|
|
3712
|
+
module2.exports = readDocType;
|
|
3713
|
+
}
|
|
3714
|
+
});
|
|
3715
|
+
|
|
3716
|
+
// ../../node_modules/.pnpm/strnum@1.1.2/node_modules/strnum/strnum.js
|
|
3717
|
+
var require_strnum = __commonJS({
|
|
3718
|
+
"../../node_modules/.pnpm/strnum@1.1.2/node_modules/strnum/strnum.js"(exports2, module2) {
|
|
3719
|
+
"use strict";
|
|
3720
|
+
var hexRegex = /^[-+]?0x[a-fA-F0-9]+$/;
|
|
3721
|
+
var numRegex = /^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/;
|
|
3722
|
+
var consider = {
|
|
3723
|
+
hex: true,
|
|
3724
|
+
// oct: false,
|
|
3725
|
+
leadingZeros: true,
|
|
3726
|
+
decimalPoint: ".",
|
|
3727
|
+
eNotation: true
|
|
3728
|
+
//skipLike: /regex/
|
|
3729
|
+
};
|
|
3730
|
+
function toNumber(str, options = {}) {
|
|
3731
|
+
options = Object.assign({}, consider, options);
|
|
3732
|
+
if (!str || typeof str !== "string") return str;
|
|
3733
|
+
let trimmedStr = str.trim();
|
|
3734
|
+
if (options.skipLike !== void 0 && options.skipLike.test(trimmedStr)) return str;
|
|
3735
|
+
else if (str === "0") return 0;
|
|
3736
|
+
else if (options.hex && hexRegex.test(trimmedStr)) {
|
|
3737
|
+
return parse_int(trimmedStr, 16);
|
|
3738
|
+
} else if (trimmedStr.search(/[eE]/) !== -1) {
|
|
3739
|
+
const notation = trimmedStr.match(/^([-\+])?(0*)([0-9]*(\.[0-9]*)?[eE][-\+]?[0-9]+)$/);
|
|
3740
|
+
if (notation) {
|
|
3741
|
+
if (options.leadingZeros) {
|
|
3742
|
+
trimmedStr = (notation[1] || "") + notation[3];
|
|
3743
|
+
} else {
|
|
3744
|
+
if (notation[2] === "0" && notation[3][0] === ".") {
|
|
3745
|
+
} else {
|
|
3746
|
+
return str;
|
|
3747
|
+
}
|
|
3748
|
+
}
|
|
3749
|
+
return options.eNotation ? Number(trimmedStr) : str;
|
|
3750
|
+
} else {
|
|
3751
|
+
return str;
|
|
3752
|
+
}
|
|
3753
|
+
} else {
|
|
3754
|
+
const match2 = numRegex.exec(trimmedStr);
|
|
3755
|
+
if (match2) {
|
|
3756
|
+
const sign = match2[1];
|
|
3757
|
+
const leadingZeros = match2[2];
|
|
3758
|
+
let numTrimmedByZeros = trimZeros(match2[3]);
|
|
3759
|
+
if (!options.leadingZeros && leadingZeros.length > 0 && sign && trimmedStr[2] !== ".") return str;
|
|
3760
|
+
else if (!options.leadingZeros && leadingZeros.length > 0 && !sign && trimmedStr[1] !== ".") return str;
|
|
3761
|
+
else if (options.leadingZeros && leadingZeros === str) return 0;
|
|
3762
|
+
else {
|
|
3763
|
+
const num = Number(trimmedStr);
|
|
3764
|
+
const numStr = "" + num;
|
|
3765
|
+
if (numStr.search(/[eE]/) !== -1) {
|
|
3766
|
+
if (options.eNotation) return num;
|
|
3767
|
+
else return str;
|
|
3768
|
+
} else if (trimmedStr.indexOf(".") !== -1) {
|
|
3769
|
+
if (numStr === "0" && numTrimmedByZeros === "") return num;
|
|
3770
|
+
else if (numStr === numTrimmedByZeros) return num;
|
|
3771
|
+
else if (sign && numStr === "-" + numTrimmedByZeros) return num;
|
|
3772
|
+
else return str;
|
|
3773
|
+
}
|
|
3774
|
+
if (leadingZeros) {
|
|
3775
|
+
return numTrimmedByZeros === numStr || sign + numTrimmedByZeros === numStr ? num : str;
|
|
3776
|
+
} else {
|
|
3777
|
+
return trimmedStr === numStr || trimmedStr === sign + numStr ? num : str;
|
|
3778
|
+
}
|
|
3779
|
+
}
|
|
3780
|
+
} else {
|
|
3781
|
+
return str;
|
|
3782
|
+
}
|
|
3783
|
+
}
|
|
3784
|
+
}
|
|
3785
|
+
function trimZeros(numStr) {
|
|
3786
|
+
if (numStr && numStr.indexOf(".") !== -1) {
|
|
3787
|
+
numStr = numStr.replace(/0+$/, "");
|
|
3788
|
+
if (numStr === ".") numStr = "0";
|
|
3789
|
+
else if (numStr[0] === ".") numStr = "0" + numStr;
|
|
3790
|
+
else if (numStr[numStr.length - 1] === ".") numStr = numStr.substr(0, numStr.length - 1);
|
|
3791
|
+
return numStr;
|
|
3792
|
+
}
|
|
3793
|
+
return numStr;
|
|
3794
|
+
}
|
|
3795
|
+
function parse_int(numStr, base) {
|
|
3796
|
+
if (parseInt) return parseInt(numStr, base);
|
|
3797
|
+
else if (Number.parseInt) return Number.parseInt(numStr, base);
|
|
3798
|
+
else if (window && window.parseInt) return window.parseInt(numStr, base);
|
|
3799
|
+
else throw new Error("parseInt, Number.parseInt, window.parseInt are not supported");
|
|
3800
|
+
}
|
|
3801
|
+
module2.exports = toNumber;
|
|
3802
|
+
}
|
|
3803
|
+
});
|
|
3804
|
+
|
|
3805
|
+
// ../../node_modules/.pnpm/fast-xml-parser@4.5.3/node_modules/fast-xml-parser/src/ignoreAttributes.js
|
|
3806
|
+
var require_ignoreAttributes = __commonJS({
|
|
3807
|
+
"../../node_modules/.pnpm/fast-xml-parser@4.5.3/node_modules/fast-xml-parser/src/ignoreAttributes.js"(exports2, module2) {
|
|
3808
|
+
"use strict";
|
|
3809
|
+
function getIgnoreAttributesFn(ignoreAttributes) {
|
|
3810
|
+
if (typeof ignoreAttributes === "function") {
|
|
3811
|
+
return ignoreAttributes;
|
|
3812
|
+
}
|
|
3813
|
+
if (Array.isArray(ignoreAttributes)) {
|
|
3814
|
+
return (attrName) => {
|
|
3815
|
+
for (const pattern of ignoreAttributes) {
|
|
3816
|
+
if (typeof pattern === "string" && attrName === pattern) {
|
|
3817
|
+
return true;
|
|
3818
|
+
}
|
|
3819
|
+
if (pattern instanceof RegExp && pattern.test(attrName)) {
|
|
3820
|
+
return true;
|
|
3821
|
+
}
|
|
3822
|
+
}
|
|
3823
|
+
};
|
|
3824
|
+
}
|
|
3825
|
+
return () => false;
|
|
3826
|
+
}
|
|
3827
|
+
module2.exports = getIgnoreAttributesFn;
|
|
3828
|
+
}
|
|
3829
|
+
});
|
|
3830
|
+
|
|
3831
|
+
// ../../node_modules/.pnpm/fast-xml-parser@4.5.3/node_modules/fast-xml-parser/src/xmlparser/OrderedObjParser.js
|
|
3832
|
+
var require_OrderedObjParser = __commonJS({
|
|
3833
|
+
"../../node_modules/.pnpm/fast-xml-parser@4.5.3/node_modules/fast-xml-parser/src/xmlparser/OrderedObjParser.js"(exports2, module2) {
|
|
3834
|
+
"use strict";
|
|
3835
|
+
var util = require_util();
|
|
3836
|
+
var xmlNode = require_xmlNode();
|
|
3837
|
+
var readDocType = require_DocTypeReader();
|
|
3838
|
+
var toNumber = require_strnum();
|
|
3839
|
+
var getIgnoreAttributesFn = require_ignoreAttributes();
|
|
3840
|
+
var OrderedObjParser = class {
|
|
3841
|
+
constructor(options) {
|
|
3842
|
+
this.options = options;
|
|
3843
|
+
this.currentNode = null;
|
|
3844
|
+
this.tagsNodeStack = [];
|
|
3845
|
+
this.docTypeEntities = {};
|
|
3846
|
+
this.lastEntities = {
|
|
3847
|
+
"apos": { regex: /&(apos|#39|#x27);/g, val: "'" },
|
|
3848
|
+
"gt": { regex: /&(gt|#62|#x3E);/g, val: ">" },
|
|
3849
|
+
"lt": { regex: /&(lt|#60|#x3C);/g, val: "<" },
|
|
3850
|
+
"quot": { regex: /&(quot|#34|#x22);/g, val: '"' }
|
|
3851
|
+
};
|
|
3852
|
+
this.ampEntity = { regex: /&(amp|#38|#x26);/g, val: "&" };
|
|
3853
|
+
this.htmlEntities = {
|
|
3854
|
+
"space": { regex: /&(nbsp|#160);/g, val: " " },
|
|
3855
|
+
// "lt" : { regex: /&(lt|#60);/g, val: "<" },
|
|
3856
|
+
// "gt" : { regex: /&(gt|#62);/g, val: ">" },
|
|
3857
|
+
// "amp" : { regex: /&(amp|#38);/g, val: "&" },
|
|
3858
|
+
// "quot" : { regex: /&(quot|#34);/g, val: "\"" },
|
|
3859
|
+
// "apos" : { regex: /&(apos|#39);/g, val: "'" },
|
|
3860
|
+
"cent": { regex: /&(cent|#162);/g, val: "\xA2" },
|
|
3861
|
+
"pound": { regex: /&(pound|#163);/g, val: "\xA3" },
|
|
3862
|
+
"yen": { regex: /&(yen|#165);/g, val: "\xA5" },
|
|
3863
|
+
"euro": { regex: /&(euro|#8364);/g, val: "\u20AC" },
|
|
3864
|
+
"copyright": { regex: /&(copy|#169);/g, val: "\xA9" },
|
|
3865
|
+
"reg": { regex: /&(reg|#174);/g, val: "\xAE" },
|
|
3866
|
+
"inr": { regex: /&(inr|#8377);/g, val: "\u20B9" },
|
|
3867
|
+
"num_dec": { regex: /&#([0-9]{1,7});/g, val: (_, str) => String.fromCharCode(Number.parseInt(str, 10)) },
|
|
3868
|
+
"num_hex": { regex: /&#x([0-9a-fA-F]{1,6});/g, val: (_, str) => String.fromCharCode(Number.parseInt(str, 16)) }
|
|
3869
|
+
};
|
|
3870
|
+
this.addExternalEntities = addExternalEntities;
|
|
3871
|
+
this.parseXml = parseXml;
|
|
3872
|
+
this.parseTextData = parseTextData;
|
|
3873
|
+
this.resolveNameSpace = resolveNameSpace;
|
|
3874
|
+
this.buildAttributesMap = buildAttributesMap;
|
|
3875
|
+
this.isItStopNode = isItStopNode;
|
|
3876
|
+
this.replaceEntitiesValue = replaceEntitiesValue;
|
|
3877
|
+
this.readStopNodeData = readStopNodeData;
|
|
3878
|
+
this.saveTextToParentTag = saveTextToParentTag;
|
|
3879
|
+
this.addChild = addChild;
|
|
3880
|
+
this.ignoreAttributesFn = getIgnoreAttributesFn(this.options.ignoreAttributes);
|
|
3881
|
+
}
|
|
3882
|
+
};
|
|
3883
|
+
function addExternalEntities(externalEntities) {
|
|
3884
|
+
const entKeys = Object.keys(externalEntities);
|
|
3885
|
+
for (let i = 0; i < entKeys.length; i++) {
|
|
3886
|
+
const ent = entKeys[i];
|
|
3887
|
+
this.lastEntities[ent] = {
|
|
3888
|
+
regex: new RegExp("&" + ent + ";", "g"),
|
|
3889
|
+
val: externalEntities[ent]
|
|
3890
|
+
};
|
|
3891
|
+
}
|
|
3892
|
+
}
|
|
3893
|
+
function parseTextData(val, tagName, jPath, dontTrim, hasAttributes, isLeafNode, escapeEntities) {
|
|
3894
|
+
if (val !== void 0) {
|
|
3895
|
+
if (this.options.trimValues && !dontTrim) {
|
|
3896
|
+
val = val.trim();
|
|
3897
|
+
}
|
|
3898
|
+
if (val.length > 0) {
|
|
3899
|
+
if (!escapeEntities) val = this.replaceEntitiesValue(val);
|
|
3900
|
+
const newval = this.options.tagValueProcessor(tagName, val, jPath, hasAttributes, isLeafNode);
|
|
3901
|
+
if (newval === null || newval === void 0) {
|
|
3902
|
+
return val;
|
|
3903
|
+
} else if (typeof newval !== typeof val || newval !== val) {
|
|
3904
|
+
return newval;
|
|
3905
|
+
} else if (this.options.trimValues) {
|
|
3906
|
+
return parseValue(val, this.options.parseTagValue, this.options.numberParseOptions);
|
|
3907
|
+
} else {
|
|
3908
|
+
const trimmedVal = val.trim();
|
|
3909
|
+
if (trimmedVal === val) {
|
|
3910
|
+
return parseValue(val, this.options.parseTagValue, this.options.numberParseOptions);
|
|
3911
|
+
} else {
|
|
3912
|
+
return val;
|
|
3913
|
+
}
|
|
3914
|
+
}
|
|
3915
|
+
}
|
|
3916
|
+
}
|
|
3917
|
+
}
|
|
3918
|
+
function resolveNameSpace(tagname) {
|
|
3919
|
+
if (this.options.removeNSPrefix) {
|
|
3920
|
+
const tags = tagname.split(":");
|
|
3921
|
+
const prefix = tagname.charAt(0) === "/" ? "/" : "";
|
|
3922
|
+
if (tags[0] === "xmlns") {
|
|
3923
|
+
return "";
|
|
3924
|
+
}
|
|
3925
|
+
if (tags.length === 2) {
|
|
3926
|
+
tagname = prefix + tags[1];
|
|
3927
|
+
}
|
|
3928
|
+
}
|
|
3929
|
+
return tagname;
|
|
3930
|
+
}
|
|
3931
|
+
var attrsRegx = new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`, "gm");
|
|
3932
|
+
function buildAttributesMap(attrStr, jPath, tagName) {
|
|
3933
|
+
if (this.options.ignoreAttributes !== true && typeof attrStr === "string") {
|
|
3934
|
+
const matches = util.getAllMatches(attrStr, attrsRegx);
|
|
3935
|
+
const len = matches.length;
|
|
3936
|
+
const attrs = {};
|
|
3937
|
+
for (let i = 0; i < len; i++) {
|
|
3938
|
+
const attrName = this.resolveNameSpace(matches[i][1]);
|
|
3939
|
+
if (this.ignoreAttributesFn(attrName, jPath)) {
|
|
3940
|
+
continue;
|
|
3941
|
+
}
|
|
3942
|
+
let oldVal = matches[i][4];
|
|
3943
|
+
let aName = this.options.attributeNamePrefix + attrName;
|
|
3944
|
+
if (attrName.length) {
|
|
3945
|
+
if (this.options.transformAttributeName) {
|
|
3946
|
+
aName = this.options.transformAttributeName(aName);
|
|
3947
|
+
}
|
|
3948
|
+
if (aName === "__proto__") aName = "#__proto__";
|
|
3949
|
+
if (oldVal !== void 0) {
|
|
3950
|
+
if (this.options.trimValues) {
|
|
3951
|
+
oldVal = oldVal.trim();
|
|
3952
|
+
}
|
|
3953
|
+
oldVal = this.replaceEntitiesValue(oldVal);
|
|
3954
|
+
const newVal = this.options.attributeValueProcessor(attrName, oldVal, jPath);
|
|
3955
|
+
if (newVal === null || newVal === void 0) {
|
|
3956
|
+
attrs[aName] = oldVal;
|
|
3957
|
+
} else if (typeof newVal !== typeof oldVal || newVal !== oldVal) {
|
|
3958
|
+
attrs[aName] = newVal;
|
|
3959
|
+
} else {
|
|
3960
|
+
attrs[aName] = parseValue(
|
|
3961
|
+
oldVal,
|
|
3962
|
+
this.options.parseAttributeValue,
|
|
3963
|
+
this.options.numberParseOptions
|
|
3964
|
+
);
|
|
3965
|
+
}
|
|
3966
|
+
} else if (this.options.allowBooleanAttributes) {
|
|
3967
|
+
attrs[aName] = true;
|
|
3968
|
+
}
|
|
3969
|
+
}
|
|
3970
|
+
}
|
|
3971
|
+
if (!Object.keys(attrs).length) {
|
|
3972
|
+
return;
|
|
3973
|
+
}
|
|
3974
|
+
if (this.options.attributesGroupName) {
|
|
3975
|
+
const attrCollection = {};
|
|
3976
|
+
attrCollection[this.options.attributesGroupName] = attrs;
|
|
3977
|
+
return attrCollection;
|
|
3978
|
+
}
|
|
3979
|
+
return attrs;
|
|
3980
|
+
}
|
|
3981
|
+
}
|
|
3982
|
+
var parseXml = function(xmlData) {
|
|
3983
|
+
xmlData = xmlData.replace(/\r\n?/g, "\n");
|
|
3984
|
+
const xmlObj = new xmlNode("!xml");
|
|
3985
|
+
let currentNode = xmlObj;
|
|
3986
|
+
let textData = "";
|
|
3987
|
+
let jPath = "";
|
|
3988
|
+
for (let i = 0; i < xmlData.length; i++) {
|
|
3989
|
+
const ch = xmlData[i];
|
|
3990
|
+
if (ch === "<") {
|
|
3991
|
+
if (xmlData[i + 1] === "/") {
|
|
3992
|
+
const closeIndex = findClosingIndex(xmlData, ">", i, "Closing Tag is not closed.");
|
|
3993
|
+
let tagName = xmlData.substring(i + 2, closeIndex).trim();
|
|
3994
|
+
if (this.options.removeNSPrefix) {
|
|
3995
|
+
const colonIndex = tagName.indexOf(":");
|
|
3996
|
+
if (colonIndex !== -1) {
|
|
3997
|
+
tagName = tagName.substr(colonIndex + 1);
|
|
3998
|
+
}
|
|
3999
|
+
}
|
|
4000
|
+
if (this.options.transformTagName) {
|
|
4001
|
+
tagName = this.options.transformTagName(tagName);
|
|
4002
|
+
}
|
|
4003
|
+
if (currentNode) {
|
|
4004
|
+
textData = this.saveTextToParentTag(textData, currentNode, jPath);
|
|
4005
|
+
}
|
|
4006
|
+
const lastTagName = jPath.substring(jPath.lastIndexOf(".") + 1);
|
|
4007
|
+
if (tagName && this.options.unpairedTags.indexOf(tagName) !== -1) {
|
|
4008
|
+
throw new Error(`Unpaired tag can not be used as closing tag: </${tagName}>`);
|
|
4009
|
+
}
|
|
4010
|
+
let propIndex = 0;
|
|
4011
|
+
if (lastTagName && this.options.unpairedTags.indexOf(lastTagName) !== -1) {
|
|
4012
|
+
propIndex = jPath.lastIndexOf(".", jPath.lastIndexOf(".") - 1);
|
|
4013
|
+
this.tagsNodeStack.pop();
|
|
4014
|
+
} else {
|
|
4015
|
+
propIndex = jPath.lastIndexOf(".");
|
|
4016
|
+
}
|
|
4017
|
+
jPath = jPath.substring(0, propIndex);
|
|
4018
|
+
currentNode = this.tagsNodeStack.pop();
|
|
4019
|
+
textData = "";
|
|
4020
|
+
i = closeIndex;
|
|
4021
|
+
} else if (xmlData[i + 1] === "?") {
|
|
4022
|
+
let tagData = readTagExp(xmlData, i, false, "?>");
|
|
4023
|
+
if (!tagData) throw new Error("Pi Tag is not closed.");
|
|
4024
|
+
textData = this.saveTextToParentTag(textData, currentNode, jPath);
|
|
4025
|
+
if (this.options.ignoreDeclaration && tagData.tagName === "?xml" || this.options.ignorePiTags) {
|
|
4026
|
+
} else {
|
|
4027
|
+
const childNode = new xmlNode(tagData.tagName);
|
|
4028
|
+
childNode.add(this.options.textNodeName, "");
|
|
4029
|
+
if (tagData.tagName !== tagData.tagExp && tagData.attrExpPresent) {
|
|
4030
|
+
childNode[":@"] = this.buildAttributesMap(tagData.tagExp, jPath, tagData.tagName);
|
|
4031
|
+
}
|
|
4032
|
+
this.addChild(currentNode, childNode, jPath);
|
|
4033
|
+
}
|
|
4034
|
+
i = tagData.closeIndex + 1;
|
|
4035
|
+
} else if (xmlData.substr(i + 1, 3) === "!--") {
|
|
4036
|
+
const endIndex = findClosingIndex(xmlData, "-->", i + 4, "Comment is not closed.");
|
|
4037
|
+
if (this.options.commentPropName) {
|
|
4038
|
+
const comment = xmlData.substring(i + 4, endIndex - 2);
|
|
4039
|
+
textData = this.saveTextToParentTag(textData, currentNode, jPath);
|
|
4040
|
+
currentNode.add(this.options.commentPropName, [{ [this.options.textNodeName]: comment }]);
|
|
4041
|
+
}
|
|
4042
|
+
i = endIndex;
|
|
4043
|
+
} else if (xmlData.substr(i + 1, 2) === "!D") {
|
|
4044
|
+
const result = readDocType(xmlData, i);
|
|
4045
|
+
this.docTypeEntities = result.entities;
|
|
4046
|
+
i = result.i;
|
|
4047
|
+
} else if (xmlData.substr(i + 1, 2) === "![") {
|
|
4048
|
+
const closeIndex = findClosingIndex(xmlData, "]]>", i, "CDATA is not closed.") - 2;
|
|
4049
|
+
const tagExp = xmlData.substring(i + 9, closeIndex);
|
|
4050
|
+
textData = this.saveTextToParentTag(textData, currentNode, jPath);
|
|
4051
|
+
let val = this.parseTextData(tagExp, currentNode.tagname, jPath, true, false, true, true);
|
|
4052
|
+
if (val == void 0) val = "";
|
|
4053
|
+
if (this.options.cdataPropName) {
|
|
4054
|
+
currentNode.add(this.options.cdataPropName, [{ [this.options.textNodeName]: tagExp }]);
|
|
4055
|
+
} else {
|
|
4056
|
+
currentNode.add(this.options.textNodeName, val);
|
|
4057
|
+
}
|
|
4058
|
+
i = closeIndex + 2;
|
|
4059
|
+
} else {
|
|
4060
|
+
let result = readTagExp(xmlData, i, this.options.removeNSPrefix);
|
|
4061
|
+
let tagName = result.tagName;
|
|
4062
|
+
const rawTagName = result.rawTagName;
|
|
4063
|
+
let tagExp = result.tagExp;
|
|
4064
|
+
let attrExpPresent = result.attrExpPresent;
|
|
4065
|
+
let closeIndex = result.closeIndex;
|
|
4066
|
+
if (this.options.transformTagName) {
|
|
4067
|
+
tagName = this.options.transformTagName(tagName);
|
|
4068
|
+
}
|
|
4069
|
+
if (currentNode && textData) {
|
|
4070
|
+
if (currentNode.tagname !== "!xml") {
|
|
4071
|
+
textData = this.saveTextToParentTag(textData, currentNode, jPath, false);
|
|
4072
|
+
}
|
|
4073
|
+
}
|
|
4074
|
+
const lastTag = currentNode;
|
|
4075
|
+
if (lastTag && this.options.unpairedTags.indexOf(lastTag.tagname) !== -1) {
|
|
4076
|
+
currentNode = this.tagsNodeStack.pop();
|
|
4077
|
+
jPath = jPath.substring(0, jPath.lastIndexOf("."));
|
|
4078
|
+
}
|
|
4079
|
+
if (tagName !== xmlObj.tagname) {
|
|
4080
|
+
jPath += jPath ? "." + tagName : tagName;
|
|
4081
|
+
}
|
|
4082
|
+
if (this.isItStopNode(this.options.stopNodes, jPath, tagName)) {
|
|
4083
|
+
let tagContent = "";
|
|
4084
|
+
if (tagExp.length > 0 && tagExp.lastIndexOf("/") === tagExp.length - 1) {
|
|
4085
|
+
if (tagName[tagName.length - 1] === "/") {
|
|
4086
|
+
tagName = tagName.substr(0, tagName.length - 1);
|
|
4087
|
+
jPath = jPath.substr(0, jPath.length - 1);
|
|
4088
|
+
tagExp = tagName;
|
|
4089
|
+
} else {
|
|
4090
|
+
tagExp = tagExp.substr(0, tagExp.length - 1);
|
|
4091
|
+
}
|
|
4092
|
+
i = result.closeIndex;
|
|
4093
|
+
} else if (this.options.unpairedTags.indexOf(tagName) !== -1) {
|
|
4094
|
+
i = result.closeIndex;
|
|
4095
|
+
} else {
|
|
4096
|
+
const result2 = this.readStopNodeData(xmlData, rawTagName, closeIndex + 1);
|
|
4097
|
+
if (!result2) throw new Error(`Unexpected end of ${rawTagName}`);
|
|
4098
|
+
i = result2.i;
|
|
4099
|
+
tagContent = result2.tagContent;
|
|
4100
|
+
}
|
|
4101
|
+
const childNode = new xmlNode(tagName);
|
|
4102
|
+
if (tagName !== tagExp && attrExpPresent) {
|
|
4103
|
+
childNode[":@"] = this.buildAttributesMap(tagExp, jPath, tagName);
|
|
4104
|
+
}
|
|
4105
|
+
if (tagContent) {
|
|
4106
|
+
tagContent = this.parseTextData(tagContent, tagName, jPath, true, attrExpPresent, true, true);
|
|
4107
|
+
}
|
|
4108
|
+
jPath = jPath.substr(0, jPath.lastIndexOf("."));
|
|
4109
|
+
childNode.add(this.options.textNodeName, tagContent);
|
|
4110
|
+
this.addChild(currentNode, childNode, jPath);
|
|
4111
|
+
} else {
|
|
4112
|
+
if (tagExp.length > 0 && tagExp.lastIndexOf("/") === tagExp.length - 1) {
|
|
4113
|
+
if (tagName[tagName.length - 1] === "/") {
|
|
4114
|
+
tagName = tagName.substr(0, tagName.length - 1);
|
|
4115
|
+
jPath = jPath.substr(0, jPath.length - 1);
|
|
4116
|
+
tagExp = tagName;
|
|
4117
|
+
} else {
|
|
4118
|
+
tagExp = tagExp.substr(0, tagExp.length - 1);
|
|
4119
|
+
}
|
|
4120
|
+
if (this.options.transformTagName) {
|
|
4121
|
+
tagName = this.options.transformTagName(tagName);
|
|
4122
|
+
}
|
|
4123
|
+
const childNode = new xmlNode(tagName);
|
|
4124
|
+
if (tagName !== tagExp && attrExpPresent) {
|
|
4125
|
+
childNode[":@"] = this.buildAttributesMap(tagExp, jPath, tagName);
|
|
4126
|
+
}
|
|
4127
|
+
this.addChild(currentNode, childNode, jPath);
|
|
4128
|
+
jPath = jPath.substr(0, jPath.lastIndexOf("."));
|
|
4129
|
+
} else {
|
|
4130
|
+
const childNode = new xmlNode(tagName);
|
|
4131
|
+
this.tagsNodeStack.push(currentNode);
|
|
4132
|
+
if (tagName !== tagExp && attrExpPresent) {
|
|
4133
|
+
childNode[":@"] = this.buildAttributesMap(tagExp, jPath, tagName);
|
|
4134
|
+
}
|
|
4135
|
+
this.addChild(currentNode, childNode, jPath);
|
|
4136
|
+
currentNode = childNode;
|
|
4137
|
+
}
|
|
4138
|
+
textData = "";
|
|
4139
|
+
i = closeIndex;
|
|
4140
|
+
}
|
|
4141
|
+
}
|
|
4142
|
+
} else {
|
|
4143
|
+
textData += xmlData[i];
|
|
4144
|
+
}
|
|
4145
|
+
}
|
|
4146
|
+
return xmlObj.child;
|
|
4147
|
+
};
|
|
4148
|
+
function addChild(currentNode, childNode, jPath) {
|
|
4149
|
+
const result = this.options.updateTag(childNode.tagname, jPath, childNode[":@"]);
|
|
4150
|
+
if (result === false) {
|
|
4151
|
+
} else if (typeof result === "string") {
|
|
4152
|
+
childNode.tagname = result;
|
|
4153
|
+
currentNode.addChild(childNode);
|
|
4154
|
+
} else {
|
|
4155
|
+
currentNode.addChild(childNode);
|
|
4156
|
+
}
|
|
4157
|
+
}
|
|
4158
|
+
var replaceEntitiesValue = function(val) {
|
|
4159
|
+
if (this.options.processEntities) {
|
|
4160
|
+
for (let entityName in this.docTypeEntities) {
|
|
4161
|
+
const entity = this.docTypeEntities[entityName];
|
|
4162
|
+
val = val.replace(entity.regx, entity.val);
|
|
4163
|
+
}
|
|
4164
|
+
for (let entityName in this.lastEntities) {
|
|
4165
|
+
const entity = this.lastEntities[entityName];
|
|
4166
|
+
val = val.replace(entity.regex, entity.val);
|
|
4167
|
+
}
|
|
4168
|
+
if (this.options.htmlEntities) {
|
|
4169
|
+
for (let entityName in this.htmlEntities) {
|
|
4170
|
+
const entity = this.htmlEntities[entityName];
|
|
4171
|
+
val = val.replace(entity.regex, entity.val);
|
|
4172
|
+
}
|
|
4173
|
+
}
|
|
4174
|
+
val = val.replace(this.ampEntity.regex, this.ampEntity.val);
|
|
4175
|
+
}
|
|
4176
|
+
return val;
|
|
4177
|
+
};
|
|
4178
|
+
function saveTextToParentTag(textData, currentNode, jPath, isLeafNode) {
|
|
4179
|
+
if (textData) {
|
|
4180
|
+
if (isLeafNode === void 0) isLeafNode = currentNode.child.length === 0;
|
|
4181
|
+
textData = this.parseTextData(
|
|
4182
|
+
textData,
|
|
4183
|
+
currentNode.tagname,
|
|
4184
|
+
jPath,
|
|
4185
|
+
false,
|
|
4186
|
+
currentNode[":@"] ? Object.keys(currentNode[":@"]).length !== 0 : false,
|
|
4187
|
+
isLeafNode
|
|
4188
|
+
);
|
|
4189
|
+
if (textData !== void 0 && textData !== "")
|
|
4190
|
+
currentNode.add(this.options.textNodeName, textData);
|
|
4191
|
+
textData = "";
|
|
4192
|
+
}
|
|
4193
|
+
return textData;
|
|
4194
|
+
}
|
|
4195
|
+
function isItStopNode(stopNodes, jPath, currentTagName) {
|
|
4196
|
+
const allNodesExp = "*." + currentTagName;
|
|
4197
|
+
for (const stopNodePath in stopNodes) {
|
|
4198
|
+
const stopNodeExp = stopNodes[stopNodePath];
|
|
4199
|
+
if (allNodesExp === stopNodeExp || jPath === stopNodeExp) return true;
|
|
4200
|
+
}
|
|
4201
|
+
return false;
|
|
4202
|
+
}
|
|
4203
|
+
function tagExpWithClosingIndex(xmlData, i, closingChar = ">") {
|
|
4204
|
+
let attrBoundary;
|
|
4205
|
+
let tagExp = "";
|
|
4206
|
+
for (let index = i; index < xmlData.length; index++) {
|
|
4207
|
+
let ch = xmlData[index];
|
|
4208
|
+
if (attrBoundary) {
|
|
4209
|
+
if (ch === attrBoundary) attrBoundary = "";
|
|
4210
|
+
} else if (ch === '"' || ch === "'") {
|
|
4211
|
+
attrBoundary = ch;
|
|
4212
|
+
} else if (ch === closingChar[0]) {
|
|
4213
|
+
if (closingChar[1]) {
|
|
4214
|
+
if (xmlData[index + 1] === closingChar[1]) {
|
|
4215
|
+
return {
|
|
4216
|
+
data: tagExp,
|
|
4217
|
+
index
|
|
4218
|
+
};
|
|
4219
|
+
}
|
|
4220
|
+
} else {
|
|
4221
|
+
return {
|
|
4222
|
+
data: tagExp,
|
|
4223
|
+
index
|
|
4224
|
+
};
|
|
4225
|
+
}
|
|
4226
|
+
} else if (ch === " ") {
|
|
4227
|
+
ch = " ";
|
|
4228
|
+
}
|
|
4229
|
+
tagExp += ch;
|
|
4230
|
+
}
|
|
4231
|
+
}
|
|
4232
|
+
function findClosingIndex(xmlData, str, i, errMsg) {
|
|
4233
|
+
const closingIndex = xmlData.indexOf(str, i);
|
|
4234
|
+
if (closingIndex === -1) {
|
|
4235
|
+
throw new Error(errMsg);
|
|
4236
|
+
} else {
|
|
4237
|
+
return closingIndex + str.length - 1;
|
|
4238
|
+
}
|
|
4239
|
+
}
|
|
4240
|
+
function readTagExp(xmlData, i, removeNSPrefix, closingChar = ">") {
|
|
4241
|
+
const result = tagExpWithClosingIndex(xmlData, i + 1, closingChar);
|
|
4242
|
+
if (!result) return;
|
|
4243
|
+
let tagExp = result.data;
|
|
4244
|
+
const closeIndex = result.index;
|
|
4245
|
+
const separatorIndex = tagExp.search(/\s/);
|
|
4246
|
+
let tagName = tagExp;
|
|
4247
|
+
let attrExpPresent = true;
|
|
4248
|
+
if (separatorIndex !== -1) {
|
|
4249
|
+
tagName = tagExp.substring(0, separatorIndex);
|
|
4250
|
+
tagExp = tagExp.substring(separatorIndex + 1).trimStart();
|
|
4251
|
+
}
|
|
4252
|
+
const rawTagName = tagName;
|
|
4253
|
+
if (removeNSPrefix) {
|
|
4254
|
+
const colonIndex = tagName.indexOf(":");
|
|
4255
|
+
if (colonIndex !== -1) {
|
|
4256
|
+
tagName = tagName.substr(colonIndex + 1);
|
|
4257
|
+
attrExpPresent = tagName !== result.data.substr(colonIndex + 1);
|
|
4258
|
+
}
|
|
4259
|
+
}
|
|
4260
|
+
return {
|
|
4261
|
+
tagName,
|
|
4262
|
+
tagExp,
|
|
4263
|
+
closeIndex,
|
|
4264
|
+
attrExpPresent,
|
|
4265
|
+
rawTagName
|
|
4266
|
+
};
|
|
4267
|
+
}
|
|
4268
|
+
function readStopNodeData(xmlData, tagName, i) {
|
|
4269
|
+
const startIndex = i;
|
|
4270
|
+
let openTagCount = 1;
|
|
4271
|
+
for (; i < xmlData.length; i++) {
|
|
4272
|
+
if (xmlData[i] === "<") {
|
|
4273
|
+
if (xmlData[i + 1] === "/") {
|
|
4274
|
+
const closeIndex = findClosingIndex(xmlData, ">", i, `${tagName} is not closed`);
|
|
4275
|
+
let closeTagName = xmlData.substring(i + 2, closeIndex).trim();
|
|
4276
|
+
if (closeTagName === tagName) {
|
|
4277
|
+
openTagCount--;
|
|
4278
|
+
if (openTagCount === 0) {
|
|
4279
|
+
return {
|
|
4280
|
+
tagContent: xmlData.substring(startIndex, i),
|
|
4281
|
+
i: closeIndex
|
|
4282
|
+
};
|
|
4283
|
+
}
|
|
4284
|
+
}
|
|
4285
|
+
i = closeIndex;
|
|
4286
|
+
} else if (xmlData[i + 1] === "?") {
|
|
4287
|
+
const closeIndex = findClosingIndex(xmlData, "?>", i + 1, "StopNode is not closed.");
|
|
4288
|
+
i = closeIndex;
|
|
4289
|
+
} else if (xmlData.substr(i + 1, 3) === "!--") {
|
|
4290
|
+
const closeIndex = findClosingIndex(xmlData, "-->", i + 3, "StopNode is not closed.");
|
|
4291
|
+
i = closeIndex;
|
|
4292
|
+
} else if (xmlData.substr(i + 1, 2) === "![") {
|
|
4293
|
+
const closeIndex = findClosingIndex(xmlData, "]]>", i, "StopNode is not closed.") - 2;
|
|
4294
|
+
i = closeIndex;
|
|
4295
|
+
} else {
|
|
4296
|
+
const tagData = readTagExp(xmlData, i, ">");
|
|
4297
|
+
if (tagData) {
|
|
4298
|
+
const openTagName = tagData && tagData.tagName;
|
|
4299
|
+
if (openTagName === tagName && tagData.tagExp[tagData.tagExp.length - 1] !== "/") {
|
|
4300
|
+
openTagCount++;
|
|
4301
|
+
}
|
|
4302
|
+
i = tagData.closeIndex;
|
|
4303
|
+
}
|
|
4304
|
+
}
|
|
4305
|
+
}
|
|
4306
|
+
}
|
|
4307
|
+
}
|
|
4308
|
+
function parseValue(val, shouldParse, options) {
|
|
4309
|
+
if (shouldParse && typeof val === "string") {
|
|
4310
|
+
const newval = val.trim();
|
|
4311
|
+
if (newval === "true") return true;
|
|
4312
|
+
else if (newval === "false") return false;
|
|
4313
|
+
else return toNumber(val, options);
|
|
4314
|
+
} else {
|
|
4315
|
+
if (util.isExist(val)) {
|
|
4316
|
+
return val;
|
|
4317
|
+
} else {
|
|
4318
|
+
return "";
|
|
4319
|
+
}
|
|
4320
|
+
}
|
|
4321
|
+
}
|
|
4322
|
+
module2.exports = OrderedObjParser;
|
|
4323
|
+
}
|
|
4324
|
+
});
|
|
4325
|
+
|
|
4326
|
+
// ../../node_modules/.pnpm/fast-xml-parser@4.5.3/node_modules/fast-xml-parser/src/xmlparser/node2json.js
|
|
4327
|
+
var require_node2json = __commonJS({
|
|
4328
|
+
"../../node_modules/.pnpm/fast-xml-parser@4.5.3/node_modules/fast-xml-parser/src/xmlparser/node2json.js"(exports2) {
|
|
4329
|
+
"use strict";
|
|
4330
|
+
function prettify(node, options) {
|
|
4331
|
+
return compress(node, options);
|
|
4332
|
+
}
|
|
4333
|
+
function compress(arr, options, jPath) {
|
|
4334
|
+
let text;
|
|
4335
|
+
const compressedObj = {};
|
|
4336
|
+
for (let i = 0; i < arr.length; i++) {
|
|
4337
|
+
const tagObj = arr[i];
|
|
4338
|
+
const property = propName(tagObj);
|
|
4339
|
+
let newJpath = "";
|
|
4340
|
+
if (jPath === void 0) newJpath = property;
|
|
4341
|
+
else newJpath = jPath + "." + property;
|
|
4342
|
+
if (property === options.textNodeName) {
|
|
4343
|
+
if (text === void 0) text = tagObj[property];
|
|
4344
|
+
else text += "" + tagObj[property];
|
|
4345
|
+
} else if (property === void 0) {
|
|
4346
|
+
continue;
|
|
4347
|
+
} else if (tagObj[property]) {
|
|
4348
|
+
let val = compress(tagObj[property], options, newJpath);
|
|
4349
|
+
const isLeaf = isLeafTag(val, options);
|
|
4350
|
+
if (tagObj[":@"]) {
|
|
4351
|
+
assignAttributes(val, tagObj[":@"], newJpath, options);
|
|
4352
|
+
} else if (Object.keys(val).length === 1 && val[options.textNodeName] !== void 0 && !options.alwaysCreateTextNode) {
|
|
4353
|
+
val = val[options.textNodeName];
|
|
4354
|
+
} else if (Object.keys(val).length === 0) {
|
|
4355
|
+
if (options.alwaysCreateTextNode) val[options.textNodeName] = "";
|
|
4356
|
+
else val = "";
|
|
4357
|
+
}
|
|
4358
|
+
if (compressedObj[property] !== void 0 && compressedObj.hasOwnProperty(property)) {
|
|
4359
|
+
if (!Array.isArray(compressedObj[property])) {
|
|
4360
|
+
compressedObj[property] = [compressedObj[property]];
|
|
4361
|
+
}
|
|
4362
|
+
compressedObj[property].push(val);
|
|
4363
|
+
} else {
|
|
4364
|
+
if (options.isArray(property, newJpath, isLeaf)) {
|
|
4365
|
+
compressedObj[property] = [val];
|
|
4366
|
+
} else {
|
|
4367
|
+
compressedObj[property] = val;
|
|
4368
|
+
}
|
|
4369
|
+
}
|
|
4370
|
+
}
|
|
4371
|
+
}
|
|
4372
|
+
if (typeof text === "string") {
|
|
4373
|
+
if (text.length > 0) compressedObj[options.textNodeName] = text;
|
|
4374
|
+
} else if (text !== void 0) compressedObj[options.textNodeName] = text;
|
|
4375
|
+
return compressedObj;
|
|
4376
|
+
}
|
|
4377
|
+
function propName(obj) {
|
|
4378
|
+
const keys = Object.keys(obj);
|
|
4379
|
+
for (let i = 0; i < keys.length; i++) {
|
|
4380
|
+
const key = keys[i];
|
|
4381
|
+
if (key !== ":@") return key;
|
|
4382
|
+
}
|
|
4383
|
+
}
|
|
4384
|
+
function assignAttributes(obj, attrMap, jpath, options) {
|
|
4385
|
+
if (attrMap) {
|
|
4386
|
+
const keys = Object.keys(attrMap);
|
|
4387
|
+
const len = keys.length;
|
|
4388
|
+
for (let i = 0; i < len; i++) {
|
|
4389
|
+
const atrrName = keys[i];
|
|
4390
|
+
if (options.isArray(atrrName, jpath + "." + atrrName, true, true)) {
|
|
4391
|
+
obj[atrrName] = [attrMap[atrrName]];
|
|
4392
|
+
} else {
|
|
4393
|
+
obj[atrrName] = attrMap[atrrName];
|
|
4394
|
+
}
|
|
4395
|
+
}
|
|
4396
|
+
}
|
|
4397
|
+
}
|
|
4398
|
+
function isLeafTag(obj, options) {
|
|
4399
|
+
const { textNodeName } = options;
|
|
4400
|
+
const propCount = Object.keys(obj).length;
|
|
4401
|
+
if (propCount === 0) {
|
|
4402
|
+
return true;
|
|
4403
|
+
}
|
|
4404
|
+
if (propCount === 1 && (obj[textNodeName] || typeof obj[textNodeName] === "boolean" || obj[textNodeName] === 0)) {
|
|
4405
|
+
return true;
|
|
4406
|
+
}
|
|
4407
|
+
return false;
|
|
4408
|
+
}
|
|
4409
|
+
exports2.prettify = prettify;
|
|
4410
|
+
}
|
|
4411
|
+
});
|
|
4412
|
+
|
|
4413
|
+
// ../../node_modules/.pnpm/fast-xml-parser@4.5.3/node_modules/fast-xml-parser/src/xmlparser/XMLParser.js
|
|
4414
|
+
var require_XMLParser = __commonJS({
|
|
4415
|
+
"../../node_modules/.pnpm/fast-xml-parser@4.5.3/node_modules/fast-xml-parser/src/xmlparser/XMLParser.js"(exports2, module2) {
|
|
4416
|
+
"use strict";
|
|
4417
|
+
var { buildOptions } = require_OptionsBuilder();
|
|
4418
|
+
var OrderedObjParser = require_OrderedObjParser();
|
|
4419
|
+
var { prettify } = require_node2json();
|
|
4420
|
+
var validator = require_validator();
|
|
4421
|
+
var XMLParser3 = class {
|
|
4422
|
+
constructor(options) {
|
|
4423
|
+
this.externalEntities = {};
|
|
4424
|
+
this.options = buildOptions(options);
|
|
4425
|
+
}
|
|
4426
|
+
/**
|
|
4427
|
+
* Parse XML dats to JS object
|
|
4428
|
+
* @param {string|Buffer} xmlData
|
|
4429
|
+
* @param {boolean|Object} validationOption
|
|
4430
|
+
*/
|
|
4431
|
+
parse(xmlData, validationOption) {
|
|
4432
|
+
if (typeof xmlData === "string") {
|
|
4433
|
+
} else if (xmlData.toString) {
|
|
4434
|
+
xmlData = xmlData.toString();
|
|
4435
|
+
} else {
|
|
4436
|
+
throw new Error("XML data is accepted in String or Bytes[] form.");
|
|
4437
|
+
}
|
|
4438
|
+
if (validationOption) {
|
|
4439
|
+
if (validationOption === true) validationOption = {};
|
|
4440
|
+
const result = validator.validate(xmlData, validationOption);
|
|
4441
|
+
if (result !== true) {
|
|
4442
|
+
throw Error(`${result.err.msg}:${result.err.line}:${result.err.col}`);
|
|
4443
|
+
}
|
|
4444
|
+
}
|
|
4445
|
+
const orderedObjParser = new OrderedObjParser(this.options);
|
|
4446
|
+
orderedObjParser.addExternalEntities(this.externalEntities);
|
|
4447
|
+
const orderedResult = orderedObjParser.parseXml(xmlData);
|
|
4448
|
+
if (this.options.preserveOrder || orderedResult === void 0) return orderedResult;
|
|
4449
|
+
else return prettify(orderedResult, this.options);
|
|
4450
|
+
}
|
|
4451
|
+
/**
|
|
4452
|
+
* Add Entity which is not by default supported by this library
|
|
4453
|
+
* @param {string} key
|
|
4454
|
+
* @param {string} value
|
|
4455
|
+
*/
|
|
4456
|
+
addEntity(key, value) {
|
|
4457
|
+
if (value.indexOf("&") !== -1) {
|
|
4458
|
+
throw new Error("Entity value can't have '&'");
|
|
4459
|
+
} else if (key.indexOf("&") !== -1 || key.indexOf(";") !== -1) {
|
|
4460
|
+
throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '
'");
|
|
4461
|
+
} else if (value === "&") {
|
|
4462
|
+
throw new Error("An entity with value '&' is not permitted");
|
|
4463
|
+
} else {
|
|
4464
|
+
this.externalEntities[key] = value;
|
|
4465
|
+
}
|
|
4466
|
+
}
|
|
4467
|
+
};
|
|
4468
|
+
module2.exports = XMLParser3;
|
|
4469
|
+
}
|
|
4470
|
+
});
|
|
4471
|
+
|
|
4472
|
+
// ../../node_modules/.pnpm/fast-xml-parser@4.5.3/node_modules/fast-xml-parser/src/xmlbuilder/orderedJs2Xml.js
|
|
4473
|
+
var require_orderedJs2Xml = __commonJS({
|
|
4474
|
+
"../../node_modules/.pnpm/fast-xml-parser@4.5.3/node_modules/fast-xml-parser/src/xmlbuilder/orderedJs2Xml.js"(exports2, module2) {
|
|
4475
|
+
"use strict";
|
|
4476
|
+
var EOL = "\n";
|
|
4477
|
+
function toXml(jArray, options) {
|
|
4478
|
+
let indentation = "";
|
|
4479
|
+
if (options.format && options.indentBy.length > 0) {
|
|
4480
|
+
indentation = EOL;
|
|
4481
|
+
}
|
|
4482
|
+
return arrToStr(jArray, options, "", indentation);
|
|
4483
|
+
}
|
|
4484
|
+
function arrToStr(arr, options, jPath, indentation) {
|
|
4485
|
+
let xmlStr = "";
|
|
4486
|
+
let isPreviousElementTag = false;
|
|
4487
|
+
for (let i = 0; i < arr.length; i++) {
|
|
4488
|
+
const tagObj = arr[i];
|
|
4489
|
+
const tagName = propName(tagObj);
|
|
4490
|
+
if (tagName === void 0) continue;
|
|
4491
|
+
let newJPath = "";
|
|
4492
|
+
if (jPath.length === 0) newJPath = tagName;
|
|
4493
|
+
else newJPath = `${jPath}.${tagName}`;
|
|
4494
|
+
if (tagName === options.textNodeName) {
|
|
4495
|
+
let tagText = tagObj[tagName];
|
|
4496
|
+
if (!isStopNode(newJPath, options)) {
|
|
4497
|
+
tagText = options.tagValueProcessor(tagName, tagText);
|
|
4498
|
+
tagText = replaceEntitiesValue(tagText, options);
|
|
4499
|
+
}
|
|
4500
|
+
if (isPreviousElementTag) {
|
|
4501
|
+
xmlStr += indentation;
|
|
4502
|
+
}
|
|
4503
|
+
xmlStr += tagText;
|
|
4504
|
+
isPreviousElementTag = false;
|
|
4505
|
+
continue;
|
|
4506
|
+
} else if (tagName === options.cdataPropName) {
|
|
4507
|
+
if (isPreviousElementTag) {
|
|
4508
|
+
xmlStr += indentation;
|
|
4509
|
+
}
|
|
4510
|
+
xmlStr += `<![CDATA[${tagObj[tagName][0][options.textNodeName]}]]>`;
|
|
4511
|
+
isPreviousElementTag = false;
|
|
4512
|
+
continue;
|
|
4513
|
+
} else if (tagName === options.commentPropName) {
|
|
4514
|
+
xmlStr += indentation + `<!--${tagObj[tagName][0][options.textNodeName]}-->`;
|
|
4515
|
+
isPreviousElementTag = true;
|
|
4516
|
+
continue;
|
|
4517
|
+
} else if (tagName[0] === "?") {
|
|
4518
|
+
const attStr2 = attr_to_str(tagObj[":@"], options);
|
|
4519
|
+
const tempInd = tagName === "?xml" ? "" : indentation;
|
|
4520
|
+
let piTextNodeName = tagObj[tagName][0][options.textNodeName];
|
|
4521
|
+
piTextNodeName = piTextNodeName.length !== 0 ? " " + piTextNodeName : "";
|
|
4522
|
+
xmlStr += tempInd + `<${tagName}${piTextNodeName}${attStr2}?>`;
|
|
4523
|
+
isPreviousElementTag = true;
|
|
4524
|
+
continue;
|
|
4525
|
+
}
|
|
4526
|
+
let newIdentation = indentation;
|
|
4527
|
+
if (newIdentation !== "") {
|
|
4528
|
+
newIdentation += options.indentBy;
|
|
4529
|
+
}
|
|
4530
|
+
const attStr = attr_to_str(tagObj[":@"], options);
|
|
4531
|
+
const tagStart = indentation + `<${tagName}${attStr}`;
|
|
4532
|
+
const tagValue = arrToStr(tagObj[tagName], options, newJPath, newIdentation);
|
|
4533
|
+
if (options.unpairedTags.indexOf(tagName) !== -1) {
|
|
4534
|
+
if (options.suppressUnpairedNode) xmlStr += tagStart + ">";
|
|
4535
|
+
else xmlStr += tagStart + "/>";
|
|
4536
|
+
} else if ((!tagValue || tagValue.length === 0) && options.suppressEmptyNode) {
|
|
4537
|
+
xmlStr += tagStart + "/>";
|
|
4538
|
+
} else if (tagValue && tagValue.endsWith(">")) {
|
|
4539
|
+
xmlStr += tagStart + `>${tagValue}${indentation}</${tagName}>`;
|
|
4540
|
+
} else {
|
|
4541
|
+
xmlStr += tagStart + ">";
|
|
4542
|
+
if (tagValue && indentation !== "" && (tagValue.includes("/>") || tagValue.includes("</"))) {
|
|
4543
|
+
xmlStr += indentation + options.indentBy + tagValue + indentation;
|
|
4544
|
+
} else {
|
|
4545
|
+
xmlStr += tagValue;
|
|
4546
|
+
}
|
|
4547
|
+
xmlStr += `</${tagName}>`;
|
|
4548
|
+
}
|
|
4549
|
+
isPreviousElementTag = true;
|
|
4550
|
+
}
|
|
4551
|
+
return xmlStr;
|
|
4552
|
+
}
|
|
4553
|
+
function propName(obj) {
|
|
4554
|
+
const keys = Object.keys(obj);
|
|
4555
|
+
for (let i = 0; i < keys.length; i++) {
|
|
4556
|
+
const key = keys[i];
|
|
4557
|
+
if (!obj.hasOwnProperty(key)) continue;
|
|
4558
|
+
if (key !== ":@") return key;
|
|
4559
|
+
}
|
|
4560
|
+
}
|
|
4561
|
+
function attr_to_str(attrMap, options) {
|
|
4562
|
+
let attrStr = "";
|
|
4563
|
+
if (attrMap && !options.ignoreAttributes) {
|
|
4564
|
+
for (let attr in attrMap) {
|
|
4565
|
+
if (!attrMap.hasOwnProperty(attr)) continue;
|
|
4566
|
+
let attrVal = options.attributeValueProcessor(attr, attrMap[attr]);
|
|
4567
|
+
attrVal = replaceEntitiesValue(attrVal, options);
|
|
4568
|
+
if (attrVal === true && options.suppressBooleanAttributes) {
|
|
4569
|
+
attrStr += ` ${attr.substr(options.attributeNamePrefix.length)}`;
|
|
4570
|
+
} else {
|
|
4571
|
+
attrStr += ` ${attr.substr(options.attributeNamePrefix.length)}="${attrVal}"`;
|
|
4572
|
+
}
|
|
4573
|
+
}
|
|
4574
|
+
}
|
|
4575
|
+
return attrStr;
|
|
4576
|
+
}
|
|
4577
|
+
function isStopNode(jPath, options) {
|
|
4578
|
+
jPath = jPath.substr(0, jPath.length - options.textNodeName.length - 1);
|
|
4579
|
+
let tagName = jPath.substr(jPath.lastIndexOf(".") + 1);
|
|
4580
|
+
for (let index in options.stopNodes) {
|
|
4581
|
+
if (options.stopNodes[index] === jPath || options.stopNodes[index] === "*." + tagName) return true;
|
|
4582
|
+
}
|
|
4583
|
+
return false;
|
|
4584
|
+
}
|
|
4585
|
+
function replaceEntitiesValue(textValue, options) {
|
|
4586
|
+
if (textValue && textValue.length > 0 && options.processEntities) {
|
|
4587
|
+
for (let i = 0; i < options.entities.length; i++) {
|
|
4588
|
+
const entity = options.entities[i];
|
|
4589
|
+
textValue = textValue.replace(entity.regex, entity.val);
|
|
4590
|
+
}
|
|
4591
|
+
}
|
|
4592
|
+
return textValue;
|
|
4593
|
+
}
|
|
4594
|
+
module2.exports = toXml;
|
|
4595
|
+
}
|
|
4596
|
+
});
|
|
4597
|
+
|
|
4598
|
+
// ../../node_modules/.pnpm/fast-xml-parser@4.5.3/node_modules/fast-xml-parser/src/xmlbuilder/json2xml.js
|
|
4599
|
+
var require_json2xml = __commonJS({
|
|
4600
|
+
"../../node_modules/.pnpm/fast-xml-parser@4.5.3/node_modules/fast-xml-parser/src/xmlbuilder/json2xml.js"(exports2, module2) {
|
|
4601
|
+
"use strict";
|
|
4602
|
+
var buildFromOrderedJs = require_orderedJs2Xml();
|
|
4603
|
+
var getIgnoreAttributesFn = require_ignoreAttributes();
|
|
4604
|
+
var defaultOptions = {
|
|
4605
|
+
attributeNamePrefix: "@_",
|
|
4606
|
+
attributesGroupName: false,
|
|
4607
|
+
textNodeName: "#text",
|
|
4608
|
+
ignoreAttributes: true,
|
|
4609
|
+
cdataPropName: false,
|
|
4610
|
+
format: false,
|
|
4611
|
+
indentBy: " ",
|
|
4612
|
+
suppressEmptyNode: false,
|
|
4613
|
+
suppressUnpairedNode: true,
|
|
4614
|
+
suppressBooleanAttributes: true,
|
|
4615
|
+
tagValueProcessor: function(key, a) {
|
|
4616
|
+
return a;
|
|
4617
|
+
},
|
|
4618
|
+
attributeValueProcessor: function(attrName, a) {
|
|
4619
|
+
return a;
|
|
4620
|
+
},
|
|
4621
|
+
preserveOrder: false,
|
|
4622
|
+
commentPropName: false,
|
|
4623
|
+
unpairedTags: [],
|
|
4624
|
+
entities: [
|
|
4625
|
+
{ regex: new RegExp("&", "g"), val: "&" },
|
|
4626
|
+
//it must be on top
|
|
4627
|
+
{ regex: new RegExp(">", "g"), val: ">" },
|
|
4628
|
+
{ regex: new RegExp("<", "g"), val: "<" },
|
|
4629
|
+
{ regex: new RegExp("'", "g"), val: "'" },
|
|
4630
|
+
{ regex: new RegExp('"', "g"), val: """ }
|
|
4631
|
+
],
|
|
4632
|
+
processEntities: true,
|
|
4633
|
+
stopNodes: [],
|
|
4634
|
+
// transformTagName: false,
|
|
4635
|
+
// transformAttributeName: false,
|
|
4636
|
+
oneListGroup: false
|
|
4637
|
+
};
|
|
4638
|
+
function Builder(options) {
|
|
4639
|
+
this.options = Object.assign({}, defaultOptions, options);
|
|
4640
|
+
if (this.options.ignoreAttributes === true || this.options.attributesGroupName) {
|
|
4641
|
+
this.isAttribute = function() {
|
|
4642
|
+
return false;
|
|
4643
|
+
};
|
|
4644
|
+
} else {
|
|
4645
|
+
this.ignoreAttributesFn = getIgnoreAttributesFn(this.options.ignoreAttributes);
|
|
4646
|
+
this.attrPrefixLen = this.options.attributeNamePrefix.length;
|
|
4647
|
+
this.isAttribute = isAttribute;
|
|
4648
|
+
}
|
|
4649
|
+
this.processTextOrObjNode = processTextOrObjNode;
|
|
4650
|
+
if (this.options.format) {
|
|
4651
|
+
this.indentate = indentate;
|
|
4652
|
+
this.tagEndChar = ">\n";
|
|
4653
|
+
this.newLine = "\n";
|
|
4654
|
+
} else {
|
|
4655
|
+
this.indentate = function() {
|
|
4656
|
+
return "";
|
|
4657
|
+
};
|
|
4658
|
+
this.tagEndChar = ">";
|
|
4659
|
+
this.newLine = "";
|
|
4660
|
+
}
|
|
4661
|
+
}
|
|
4662
|
+
Builder.prototype.build = function(jObj) {
|
|
4663
|
+
if (this.options.preserveOrder) {
|
|
4664
|
+
return buildFromOrderedJs(jObj, this.options);
|
|
4665
|
+
} else {
|
|
4666
|
+
if (Array.isArray(jObj) && this.options.arrayNodeName && this.options.arrayNodeName.length > 1) {
|
|
4667
|
+
jObj = {
|
|
4668
|
+
[this.options.arrayNodeName]: jObj
|
|
4669
|
+
};
|
|
4670
|
+
}
|
|
4671
|
+
return this.j2x(jObj, 0, []).val;
|
|
4672
|
+
}
|
|
4673
|
+
};
|
|
4674
|
+
Builder.prototype.j2x = function(jObj, level, ajPath) {
|
|
4675
|
+
let attrStr = "";
|
|
4676
|
+
let val = "";
|
|
4677
|
+
const jPath = ajPath.join(".");
|
|
4678
|
+
for (let key in jObj) {
|
|
4679
|
+
if (!Object.prototype.hasOwnProperty.call(jObj, key)) continue;
|
|
4680
|
+
if (typeof jObj[key] === "undefined") {
|
|
4681
|
+
if (this.isAttribute(key)) {
|
|
4682
|
+
val += "";
|
|
4683
|
+
}
|
|
4684
|
+
} else if (jObj[key] === null) {
|
|
4685
|
+
if (this.isAttribute(key)) {
|
|
4686
|
+
val += "";
|
|
4687
|
+
} else if (key === this.options.cdataPropName) {
|
|
4688
|
+
val += "";
|
|
4689
|
+
} else if (key[0] === "?") {
|
|
4690
|
+
val += this.indentate(level) + "<" + key + "?" + this.tagEndChar;
|
|
4691
|
+
} else {
|
|
4692
|
+
val += this.indentate(level) + "<" + key + "/" + this.tagEndChar;
|
|
4693
|
+
}
|
|
4694
|
+
} else if (jObj[key] instanceof Date) {
|
|
4695
|
+
val += this.buildTextValNode(jObj[key], key, "", level);
|
|
4696
|
+
} else if (typeof jObj[key] !== "object") {
|
|
4697
|
+
const attr = this.isAttribute(key);
|
|
4698
|
+
if (attr && !this.ignoreAttributesFn(attr, jPath)) {
|
|
4699
|
+
attrStr += this.buildAttrPairStr(attr, "" + jObj[key]);
|
|
4700
|
+
} else if (!attr) {
|
|
4701
|
+
if (key === this.options.textNodeName) {
|
|
4702
|
+
let newval = this.options.tagValueProcessor(key, "" + jObj[key]);
|
|
4703
|
+
val += this.replaceEntitiesValue(newval);
|
|
4704
|
+
} else {
|
|
4705
|
+
val += this.buildTextValNode(jObj[key], key, "", level);
|
|
4706
|
+
}
|
|
4707
|
+
}
|
|
4708
|
+
} else if (Array.isArray(jObj[key])) {
|
|
4709
|
+
const arrLen = jObj[key].length;
|
|
4710
|
+
let listTagVal = "";
|
|
4711
|
+
let listTagAttr = "";
|
|
4712
|
+
for (let j = 0; j < arrLen; j++) {
|
|
4713
|
+
const item = jObj[key][j];
|
|
4714
|
+
if (typeof item === "undefined") {
|
|
4715
|
+
} else if (item === null) {
|
|
4716
|
+
if (key[0] === "?") val += this.indentate(level) + "<" + key + "?" + this.tagEndChar;
|
|
4717
|
+
else val += this.indentate(level) + "<" + key + "/" + this.tagEndChar;
|
|
4718
|
+
} else if (typeof item === "object") {
|
|
4719
|
+
if (this.options.oneListGroup) {
|
|
4720
|
+
const result = this.j2x(item, level + 1, ajPath.concat(key));
|
|
4721
|
+
listTagVal += result.val;
|
|
4722
|
+
if (this.options.attributesGroupName && item.hasOwnProperty(this.options.attributesGroupName)) {
|
|
4723
|
+
listTagAttr += result.attrStr;
|
|
4724
|
+
}
|
|
4725
|
+
} else {
|
|
4726
|
+
listTagVal += this.processTextOrObjNode(item, key, level, ajPath);
|
|
4727
|
+
}
|
|
4728
|
+
} else {
|
|
4729
|
+
if (this.options.oneListGroup) {
|
|
4730
|
+
let textValue = this.options.tagValueProcessor(key, item);
|
|
4731
|
+
textValue = this.replaceEntitiesValue(textValue);
|
|
4732
|
+
listTagVal += textValue;
|
|
4733
|
+
} else {
|
|
4734
|
+
listTagVal += this.buildTextValNode(item, key, "", level);
|
|
4735
|
+
}
|
|
4736
|
+
}
|
|
4737
|
+
}
|
|
4738
|
+
if (this.options.oneListGroup) {
|
|
4739
|
+
listTagVal = this.buildObjectNode(listTagVal, key, listTagAttr, level);
|
|
4740
|
+
}
|
|
4741
|
+
val += listTagVal;
|
|
4742
|
+
} else {
|
|
4743
|
+
if (this.options.attributesGroupName && key === this.options.attributesGroupName) {
|
|
4744
|
+
const Ks = Object.keys(jObj[key]);
|
|
4745
|
+
const L = Ks.length;
|
|
4746
|
+
for (let j = 0; j < L; j++) {
|
|
4747
|
+
attrStr += this.buildAttrPairStr(Ks[j], "" + jObj[key][Ks[j]]);
|
|
4748
|
+
}
|
|
4749
|
+
} else {
|
|
4750
|
+
val += this.processTextOrObjNode(jObj[key], key, level, ajPath);
|
|
4751
|
+
}
|
|
4752
|
+
}
|
|
4753
|
+
}
|
|
4754
|
+
return { attrStr, val };
|
|
4755
|
+
};
|
|
4756
|
+
Builder.prototype.buildAttrPairStr = function(attrName, val) {
|
|
4757
|
+
val = this.options.attributeValueProcessor(attrName, "" + val);
|
|
4758
|
+
val = this.replaceEntitiesValue(val);
|
|
4759
|
+
if (this.options.suppressBooleanAttributes && val === "true") {
|
|
4760
|
+
return " " + attrName;
|
|
4761
|
+
} else return " " + attrName + '="' + val + '"';
|
|
4762
|
+
};
|
|
4763
|
+
function processTextOrObjNode(object, key, level, ajPath) {
|
|
4764
|
+
const result = this.j2x(object, level + 1, ajPath.concat(key));
|
|
4765
|
+
if (object[this.options.textNodeName] !== void 0 && Object.keys(object).length === 1) {
|
|
4766
|
+
return this.buildTextValNode(object[this.options.textNodeName], key, result.attrStr, level);
|
|
4767
|
+
} else {
|
|
4768
|
+
return this.buildObjectNode(result.val, key, result.attrStr, level);
|
|
4769
|
+
}
|
|
4770
|
+
}
|
|
4771
|
+
Builder.prototype.buildObjectNode = function(val, key, attrStr, level) {
|
|
4772
|
+
if (val === "") {
|
|
4773
|
+
if (key[0] === "?") return this.indentate(level) + "<" + key + attrStr + "?" + this.tagEndChar;
|
|
4774
|
+
else {
|
|
4775
|
+
return this.indentate(level) + "<" + key + attrStr + this.closeTag(key) + this.tagEndChar;
|
|
4776
|
+
}
|
|
4777
|
+
} else {
|
|
4778
|
+
let tagEndExp = "</" + key + this.tagEndChar;
|
|
4779
|
+
let piClosingChar = "";
|
|
4780
|
+
if (key[0] === "?") {
|
|
4781
|
+
piClosingChar = "?";
|
|
4782
|
+
tagEndExp = "";
|
|
4783
|
+
}
|
|
4784
|
+
if ((attrStr || attrStr === "") && val.indexOf("<") === -1) {
|
|
4785
|
+
return this.indentate(level) + "<" + key + attrStr + piClosingChar + ">" + val + tagEndExp;
|
|
4786
|
+
} else if (this.options.commentPropName !== false && key === this.options.commentPropName && piClosingChar.length === 0) {
|
|
4787
|
+
return this.indentate(level) + `<!--${val}-->` + this.newLine;
|
|
4788
|
+
} else {
|
|
4789
|
+
return this.indentate(level) + "<" + key + attrStr + piClosingChar + this.tagEndChar + val + this.indentate(level) + tagEndExp;
|
|
4790
|
+
}
|
|
4791
|
+
}
|
|
4792
|
+
};
|
|
4793
|
+
Builder.prototype.closeTag = function(key) {
|
|
4794
|
+
let closeTag = "";
|
|
4795
|
+
if (this.options.unpairedTags.indexOf(key) !== -1) {
|
|
4796
|
+
if (!this.options.suppressUnpairedNode) closeTag = "/";
|
|
4797
|
+
} else if (this.options.suppressEmptyNode) {
|
|
4798
|
+
closeTag = "/";
|
|
4799
|
+
} else {
|
|
4800
|
+
closeTag = `></${key}`;
|
|
4801
|
+
}
|
|
4802
|
+
return closeTag;
|
|
4803
|
+
};
|
|
4804
|
+
Builder.prototype.buildTextValNode = function(val, key, attrStr, level) {
|
|
4805
|
+
if (this.options.cdataPropName !== false && key === this.options.cdataPropName) {
|
|
4806
|
+
return this.indentate(level) + `<![CDATA[${val}]]>` + this.newLine;
|
|
4807
|
+
} else if (this.options.commentPropName !== false && key === this.options.commentPropName) {
|
|
4808
|
+
return this.indentate(level) + `<!--${val}-->` + this.newLine;
|
|
4809
|
+
} else if (key[0] === "?") {
|
|
4810
|
+
return this.indentate(level) + "<" + key + attrStr + "?" + this.tagEndChar;
|
|
4811
|
+
} else {
|
|
4812
|
+
let textValue = this.options.tagValueProcessor(key, val);
|
|
4813
|
+
textValue = this.replaceEntitiesValue(textValue);
|
|
4814
|
+
if (textValue === "") {
|
|
4815
|
+
return this.indentate(level) + "<" + key + attrStr + this.closeTag(key) + this.tagEndChar;
|
|
4816
|
+
} else {
|
|
4817
|
+
return this.indentate(level) + "<" + key + attrStr + ">" + textValue + "</" + key + this.tagEndChar;
|
|
4818
|
+
}
|
|
4819
|
+
}
|
|
4820
|
+
};
|
|
4821
|
+
Builder.prototype.replaceEntitiesValue = function(textValue) {
|
|
4822
|
+
if (textValue && textValue.length > 0 && this.options.processEntities) {
|
|
4823
|
+
for (let i = 0; i < this.options.entities.length; i++) {
|
|
4824
|
+
const entity = this.options.entities[i];
|
|
4825
|
+
textValue = textValue.replace(entity.regex, entity.val);
|
|
4826
|
+
}
|
|
4827
|
+
}
|
|
4828
|
+
return textValue;
|
|
4829
|
+
};
|
|
4830
|
+
function indentate(level) {
|
|
4831
|
+
return this.options.indentBy.repeat(level);
|
|
4832
|
+
}
|
|
4833
|
+
function isAttribute(name) {
|
|
4834
|
+
if (name.startsWith(this.options.attributeNamePrefix) && name !== this.options.textNodeName) {
|
|
4835
|
+
return name.substr(this.attrPrefixLen);
|
|
4836
|
+
} else {
|
|
4837
|
+
return false;
|
|
4838
|
+
}
|
|
4839
|
+
}
|
|
4840
|
+
module2.exports = Builder;
|
|
4841
|
+
}
|
|
4842
|
+
});
|
|
4843
|
+
|
|
4844
|
+
// ../../node_modules/.pnpm/fast-xml-parser@4.5.3/node_modules/fast-xml-parser/src/fxp.js
|
|
4845
|
+
var require_fxp = __commonJS({
|
|
4846
|
+
"../../node_modules/.pnpm/fast-xml-parser@4.5.3/node_modules/fast-xml-parser/src/fxp.js"(exports2, module2) {
|
|
4847
|
+
"use strict";
|
|
4848
|
+
var validator = require_validator();
|
|
4849
|
+
var XMLParser3 = require_XMLParser();
|
|
4850
|
+
var XMLBuilder2 = require_json2xml();
|
|
4851
|
+
module2.exports = {
|
|
4852
|
+
XMLParser: XMLParser3,
|
|
4853
|
+
XMLValidator: validator,
|
|
4854
|
+
XMLBuilder: XMLBuilder2
|
|
4855
|
+
};
|
|
4856
|
+
}
|
|
4857
|
+
});
|
|
4858
|
+
|
|
4859
|
+
// ../../node_modules/.pnpm/nested-property@4.0.0/node_modules/nested-property/dist/nested-property.js
|
|
4860
|
+
var require_nested_property = __commonJS({
|
|
4861
|
+
"../../node_modules/.pnpm/nested-property@4.0.0/node_modules/nested-property/dist/nested-property.js"(exports2, module2) {
|
|
4862
|
+
"use strict";
|
|
4863
|
+
function _typeof(obj) {
|
|
4864
|
+
"@babel/helpers - typeof";
|
|
4865
|
+
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
|
|
4866
|
+
_typeof = function _typeof2(obj2) {
|
|
4867
|
+
return typeof obj2;
|
|
4868
|
+
};
|
|
4869
|
+
} else {
|
|
4870
|
+
_typeof = function _typeof2(obj2) {
|
|
4871
|
+
return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
|
|
4872
|
+
};
|
|
4873
|
+
}
|
|
4874
|
+
return _typeof(obj);
|
|
4875
|
+
}
|
|
4876
|
+
function _classCallCheck(instance, Constructor) {
|
|
4877
|
+
if (!(instance instanceof Constructor)) {
|
|
4878
|
+
throw new TypeError("Cannot call a class as a function");
|
|
4879
|
+
}
|
|
4880
|
+
}
|
|
4881
|
+
function _possibleConstructorReturn(self2, call) {
|
|
4882
|
+
if (call && (_typeof(call) === "object" || typeof call === "function")) {
|
|
4883
|
+
return call;
|
|
4884
|
+
}
|
|
4885
|
+
return _assertThisInitialized(self2);
|
|
4886
|
+
}
|
|
4887
|
+
function _assertThisInitialized(self2) {
|
|
4888
|
+
if (self2 === void 0) {
|
|
4889
|
+
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
4890
|
+
}
|
|
4891
|
+
return self2;
|
|
4892
|
+
}
|
|
4893
|
+
function _inherits(subClass, superClass) {
|
|
4894
|
+
if (typeof superClass !== "function" && superClass !== null) {
|
|
4895
|
+
throw new TypeError("Super expression must either be null or a function");
|
|
4896
|
+
}
|
|
4897
|
+
subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } });
|
|
4898
|
+
if (superClass) _setPrototypeOf(subClass, superClass);
|
|
4899
|
+
}
|
|
4900
|
+
function _wrapNativeSuper(Class) {
|
|
4901
|
+
var _cache = typeof Map === "function" ? /* @__PURE__ */ new Map() : void 0;
|
|
4902
|
+
_wrapNativeSuper = function _wrapNativeSuper2(Class2) {
|
|
4903
|
+
if (Class2 === null || !_isNativeFunction(Class2)) return Class2;
|
|
4904
|
+
if (typeof Class2 !== "function") {
|
|
4905
|
+
throw new TypeError("Super expression must either be null or a function");
|
|
4906
|
+
}
|
|
4907
|
+
if (typeof _cache !== "undefined") {
|
|
4908
|
+
if (_cache.has(Class2)) return _cache.get(Class2);
|
|
4909
|
+
_cache.set(Class2, Wrapper);
|
|
4910
|
+
}
|
|
4911
|
+
function Wrapper() {
|
|
4912
|
+
return _construct(Class2, arguments, _getPrototypeOf(this).constructor);
|
|
4913
|
+
}
|
|
4914
|
+
Wrapper.prototype = Object.create(Class2.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } });
|
|
4915
|
+
return _setPrototypeOf(Wrapper, Class2);
|
|
4916
|
+
};
|
|
4917
|
+
return _wrapNativeSuper(Class);
|
|
4918
|
+
}
|
|
4919
|
+
function _construct(Parent, args, Class) {
|
|
4920
|
+
if (_isNativeReflectConstruct()) {
|
|
4921
|
+
_construct = Reflect.construct;
|
|
4922
|
+
} else {
|
|
4923
|
+
_construct = function _construct2(Parent2, args2, Class2) {
|
|
4924
|
+
var a = [null];
|
|
4925
|
+
a.push.apply(a, args2);
|
|
4926
|
+
var Constructor = Function.bind.apply(Parent2, a);
|
|
4927
|
+
var instance = new Constructor();
|
|
4928
|
+
if (Class2) _setPrototypeOf(instance, Class2.prototype);
|
|
4929
|
+
return instance;
|
|
4930
|
+
};
|
|
4931
|
+
}
|
|
4932
|
+
return _construct.apply(null, arguments);
|
|
4933
|
+
}
|
|
4934
|
+
function _isNativeReflectConstruct() {
|
|
4935
|
+
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
4936
|
+
if (Reflect.construct.sham) return false;
|
|
4937
|
+
if (typeof Proxy === "function") return true;
|
|
4938
|
+
try {
|
|
4939
|
+
Date.prototype.toString.call(Reflect.construct(Date, [], function() {
|
|
4940
|
+
}));
|
|
4941
|
+
return true;
|
|
4942
|
+
} catch (e) {
|
|
4943
|
+
return false;
|
|
4944
|
+
}
|
|
4945
|
+
}
|
|
4946
|
+
function _isNativeFunction(fn) {
|
|
4947
|
+
return Function.toString.call(fn).indexOf("[native code]") !== -1;
|
|
4948
|
+
}
|
|
4949
|
+
function _setPrototypeOf(o, p) {
|
|
4950
|
+
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf2(o2, p2) {
|
|
4951
|
+
o2.__proto__ = p2;
|
|
4952
|
+
return o2;
|
|
4953
|
+
};
|
|
4954
|
+
return _setPrototypeOf(o, p);
|
|
4955
|
+
}
|
|
4956
|
+
function _getPrototypeOf(o) {
|
|
4957
|
+
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf2(o2) {
|
|
4958
|
+
return o2.__proto__ || Object.getPrototypeOf(o2);
|
|
4959
|
+
};
|
|
4960
|
+
return _getPrototypeOf(o);
|
|
4961
|
+
}
|
|
4962
|
+
var ARRAY_WILDCARD = "+";
|
|
4963
|
+
var PATH_DELIMITER = ".";
|
|
4964
|
+
var ObjectPrototypeMutationError = /* @__PURE__ */ (function(_Error) {
|
|
4965
|
+
_inherits(ObjectPrototypeMutationError2, _Error);
|
|
4966
|
+
function ObjectPrototypeMutationError2(params) {
|
|
4967
|
+
var _this;
|
|
4968
|
+
_classCallCheck(this, ObjectPrototypeMutationError2);
|
|
4969
|
+
_this = _possibleConstructorReturn(this, _getPrototypeOf(ObjectPrototypeMutationError2).call(this, params));
|
|
4970
|
+
_this.name = "ObjectPrototypeMutationError";
|
|
4971
|
+
return _this;
|
|
4972
|
+
}
|
|
4973
|
+
return ObjectPrototypeMutationError2;
|
|
4974
|
+
})(_wrapNativeSuper(Error));
|
|
4975
|
+
module2.exports = {
|
|
4976
|
+
set: setNestedProperty,
|
|
4977
|
+
get: getNestedProperty,
|
|
4978
|
+
has: hasNestedProperty,
|
|
4979
|
+
hasOwn: function hasOwn(object, property, options) {
|
|
4980
|
+
return this.has(object, property, options || {
|
|
4981
|
+
own: true
|
|
4982
|
+
});
|
|
4983
|
+
},
|
|
4984
|
+
isIn: isInNestedProperty,
|
|
4985
|
+
ObjectPrototypeMutationError
|
|
4986
|
+
};
|
|
4987
|
+
function getNestedProperty(object, property) {
|
|
4988
|
+
if (_typeof(object) != "object" || object === null) {
|
|
4989
|
+
return object;
|
|
4990
|
+
}
|
|
4991
|
+
if (typeof property == "undefined") {
|
|
4992
|
+
return object;
|
|
4993
|
+
}
|
|
4994
|
+
if (typeof property == "number") {
|
|
4995
|
+
return object[property];
|
|
4996
|
+
}
|
|
4997
|
+
try {
|
|
4998
|
+
return traverse(object, property, function _getNestedProperty(currentObject, currentProperty) {
|
|
4999
|
+
return currentObject[currentProperty];
|
|
5000
|
+
});
|
|
5001
|
+
} catch (err) {
|
|
5002
|
+
return object;
|
|
5003
|
+
}
|
|
5004
|
+
}
|
|
5005
|
+
function hasNestedProperty(object, property) {
|
|
5006
|
+
var options = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
|
|
5007
|
+
if (_typeof(object) != "object" || object === null) {
|
|
5008
|
+
return false;
|
|
5009
|
+
}
|
|
5010
|
+
if (typeof property == "undefined") {
|
|
5011
|
+
return false;
|
|
5012
|
+
}
|
|
5013
|
+
if (typeof property == "number") {
|
|
5014
|
+
return property in object;
|
|
5015
|
+
}
|
|
5016
|
+
try {
|
|
5017
|
+
var has = false;
|
|
5018
|
+
traverse(object, property, function _hasNestedProperty(currentObject, currentProperty, segments, index) {
|
|
5019
|
+
if (isLastSegment(segments, index)) {
|
|
5020
|
+
if (options.own) {
|
|
5021
|
+
has = currentObject.hasOwnProperty(currentProperty);
|
|
5022
|
+
} else {
|
|
5023
|
+
has = currentProperty in currentObject;
|
|
5024
|
+
}
|
|
5025
|
+
} else {
|
|
5026
|
+
return currentObject && currentObject[currentProperty];
|
|
5027
|
+
}
|
|
5028
|
+
});
|
|
5029
|
+
return has;
|
|
5030
|
+
} catch (err) {
|
|
5031
|
+
return false;
|
|
5032
|
+
}
|
|
5033
|
+
}
|
|
5034
|
+
function setNestedProperty(object, property, value) {
|
|
5035
|
+
if (_typeof(object) != "object" || object === null) {
|
|
5036
|
+
return object;
|
|
5037
|
+
}
|
|
5038
|
+
if (typeof property == "undefined") {
|
|
5039
|
+
return object;
|
|
5040
|
+
}
|
|
5041
|
+
if (typeof property == "number") {
|
|
5042
|
+
object[property] = value;
|
|
5043
|
+
return object[property];
|
|
5044
|
+
}
|
|
5045
|
+
try {
|
|
5046
|
+
return traverse(object, property, function _setNestedProperty(currentObject, currentProperty, segments, index) {
|
|
5047
|
+
if (currentObject === Reflect.getPrototypeOf({})) {
|
|
5048
|
+
throw new ObjectPrototypeMutationError("Attempting to mutate Object.prototype");
|
|
5049
|
+
}
|
|
5050
|
+
if (!currentObject[currentProperty]) {
|
|
5051
|
+
var nextPropIsNumber = Number.isInteger(Number(segments[index + 1]));
|
|
5052
|
+
var nextPropIsArrayWildcard = segments[index + 1] === ARRAY_WILDCARD;
|
|
5053
|
+
if (nextPropIsNumber || nextPropIsArrayWildcard) {
|
|
5054
|
+
currentObject[currentProperty] = [];
|
|
5055
|
+
} else {
|
|
5056
|
+
currentObject[currentProperty] = {};
|
|
5057
|
+
}
|
|
5058
|
+
}
|
|
5059
|
+
if (isLastSegment(segments, index)) {
|
|
5060
|
+
currentObject[currentProperty] = value;
|
|
5061
|
+
}
|
|
5062
|
+
return currentObject[currentProperty];
|
|
5063
|
+
});
|
|
5064
|
+
} catch (err) {
|
|
5065
|
+
if (err instanceof ObjectPrototypeMutationError) {
|
|
5066
|
+
throw err;
|
|
5067
|
+
} else {
|
|
5068
|
+
return object;
|
|
5069
|
+
}
|
|
5070
|
+
}
|
|
5071
|
+
}
|
|
5072
|
+
function isInNestedProperty(object, property, objectInPath) {
|
|
5073
|
+
var options = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};
|
|
5074
|
+
if (_typeof(object) != "object" || object === null) {
|
|
5075
|
+
return false;
|
|
5076
|
+
}
|
|
5077
|
+
if (typeof property == "undefined") {
|
|
5078
|
+
return false;
|
|
5079
|
+
}
|
|
5080
|
+
try {
|
|
5081
|
+
var isIn = false, pathExists = false;
|
|
5082
|
+
traverse(object, property, function _isInNestedProperty(currentObject, currentProperty, segments, index) {
|
|
5083
|
+
isIn = isIn || currentObject === objectInPath || !!currentObject && currentObject[currentProperty] === objectInPath;
|
|
5084
|
+
pathExists = isLastSegment(segments, index) && _typeof(currentObject) === "object" && currentProperty in currentObject;
|
|
5085
|
+
return currentObject && currentObject[currentProperty];
|
|
5086
|
+
});
|
|
5087
|
+
if (options.validPath) {
|
|
5088
|
+
return isIn && pathExists;
|
|
5089
|
+
} else {
|
|
5090
|
+
return isIn;
|
|
5091
|
+
}
|
|
5092
|
+
} catch (err) {
|
|
5093
|
+
return false;
|
|
5094
|
+
}
|
|
5095
|
+
}
|
|
5096
|
+
function traverse(object, path7) {
|
|
5097
|
+
var callback = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : function() {
|
|
5098
|
+
};
|
|
5099
|
+
var segments = path7.split(PATH_DELIMITER);
|
|
5100
|
+
var length = segments.length;
|
|
5101
|
+
var _loop = function _loop2(idx2) {
|
|
5102
|
+
var currentSegment = segments[idx2];
|
|
5103
|
+
if (!object) {
|
|
5104
|
+
return {
|
|
5105
|
+
v: void 0
|
|
5106
|
+
};
|
|
5107
|
+
}
|
|
5108
|
+
if (currentSegment === ARRAY_WILDCARD) {
|
|
5109
|
+
if (Array.isArray(object)) {
|
|
5110
|
+
return {
|
|
5111
|
+
v: object.map(function(value, index) {
|
|
5112
|
+
var remainingSegments = segments.slice(idx2 + 1);
|
|
5113
|
+
if (remainingSegments.length > 0) {
|
|
5114
|
+
return traverse(value, remainingSegments.join(PATH_DELIMITER), callback);
|
|
5115
|
+
} else {
|
|
5116
|
+
return callback(object, index, segments, idx2);
|
|
5117
|
+
}
|
|
5118
|
+
})
|
|
5119
|
+
};
|
|
5120
|
+
} else {
|
|
5121
|
+
var pathToHere = segments.slice(0, idx2).join(PATH_DELIMITER);
|
|
5122
|
+
throw new Error("Object at wildcard (".concat(pathToHere, ") is not an array"));
|
|
5123
|
+
}
|
|
5124
|
+
} else {
|
|
5125
|
+
object = callback(object, currentSegment, segments, idx2);
|
|
5126
|
+
}
|
|
5127
|
+
};
|
|
5128
|
+
for (var idx = 0; idx < length; idx++) {
|
|
5129
|
+
var _ret = _loop(idx);
|
|
5130
|
+
if (_typeof(_ret) === "object") return _ret.v;
|
|
5131
|
+
}
|
|
5132
|
+
return object;
|
|
5133
|
+
}
|
|
5134
|
+
function isLastSegment(segments, index) {
|
|
5135
|
+
return segments.length === index + 1;
|
|
5136
|
+
}
|
|
5137
|
+
}
|
|
5138
|
+
});
|
|
5139
|
+
|
|
5140
|
+
// ../../node_modules/.pnpm/byte-length@1.0.2/node_modules/byte-length/dist/index.js
|
|
5141
|
+
var require_dist = __commonJS({
|
|
5142
|
+
"../../node_modules/.pnpm/byte-length@1.0.2/node_modules/byte-length/dist/index.js"(exports2) {
|
|
5143
|
+
"use strict";
|
|
5144
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
5145
|
+
function byteLength2(str) {
|
|
5146
|
+
if (!str) {
|
|
5147
|
+
return 0;
|
|
5148
|
+
}
|
|
5149
|
+
str = str.toString();
|
|
5150
|
+
var len = str.length;
|
|
5151
|
+
for (var i = str.length; i--; ) {
|
|
5152
|
+
var code = str.charCodeAt(i);
|
|
5153
|
+
if (56320 <= code && code <= 57343) {
|
|
5154
|
+
i--;
|
|
5155
|
+
}
|
|
5156
|
+
if (127 < code && code <= 2047) {
|
|
5157
|
+
len++;
|
|
5158
|
+
} else if (2047 < code && code <= 65535) {
|
|
5159
|
+
len += 2;
|
|
5160
|
+
}
|
|
5161
|
+
}
|
|
5162
|
+
return len;
|
|
5163
|
+
}
|
|
5164
|
+
exports2.byteLength = byteLength2;
|
|
5165
|
+
}
|
|
5166
|
+
});
|
|
5167
|
+
|
|
2024
5168
|
// src/index.ts
|
|
2025
5169
|
var import_commander = require("commander");
|
|
2026
5170
|
var import_chalk18 = __toESM(require("chalk"));
|
|
@@ -2050,7 +5194,7 @@ var import_inquirer2 = __toESM(require("inquirer"));
|
|
|
2050
5194
|
// ../core/package.json
|
|
2051
5195
|
var package_default = {
|
|
2052
5196
|
name: "@ccman/core",
|
|
2053
|
-
version: "3.0.
|
|
5197
|
+
version: "3.0.13",
|
|
2054
5198
|
type: "module",
|
|
2055
5199
|
description: "Core business logic for ccman",
|
|
2056
5200
|
main: "./dist/index.js",
|
|
@@ -2086,7 +5230,8 @@ var package_default = {
|
|
|
2086
5230
|
},
|
|
2087
5231
|
dependencies: {
|
|
2088
5232
|
"@iarna/toml": "^2.2.5",
|
|
2089
|
-
"proper-lockfile": "^4.1.2"
|
|
5233
|
+
"proper-lockfile": "^4.1.2",
|
|
5234
|
+
webdav: "^5.8.0"
|
|
2090
5235
|
},
|
|
2091
5236
|
devDependencies: {
|
|
2092
5237
|
vitest: "^1.0.0"
|
|
@@ -2706,6 +5851,1473 @@ function createClaudeManager() {
|
|
|
2706
5851
|
};
|
|
2707
5852
|
}
|
|
2708
5853
|
|
|
5854
|
+
// ../../node_modules/.pnpm/webdav@5.8.0/node_modules/webdav/dist/node/tools/url.js
|
|
5855
|
+
var import_url_parse = __toESM(require_url_parse(), 1);
|
|
5856
|
+
|
|
5857
|
+
// ../../node_modules/.pnpm/webdav@5.8.0/node_modules/webdav/dist/node/tools/path.js
|
|
5858
|
+
var import_path_posix = __toESM(require_path_posix(), 1);
|
|
5859
|
+
|
|
5860
|
+
// ../../node_modules/.pnpm/webdav@5.8.0/node_modules/webdav/dist/node/auth/digest.js
|
|
5861
|
+
var import_md52 = __toESM(require_md5(), 1);
|
|
5862
|
+
|
|
5863
|
+
// ../../node_modules/.pnpm/webdav@5.8.0/node_modules/webdav/dist/node/tools/crypto.js
|
|
5864
|
+
var import_md5 = __toESM(require_md5(), 1);
|
|
5865
|
+
|
|
5866
|
+
// ../../node_modules/.pnpm/webdav@5.8.0/node_modules/webdav/dist/node/tools/encode.js
|
|
5867
|
+
var import_base_64 = __toESM(require_base64(), 1);
|
|
5868
|
+
|
|
5869
|
+
// ../../node_modules/.pnpm/entities@6.0.1/node_modules/entities/dist/esm/decode-codepoint.js
|
|
5870
|
+
var _a;
|
|
5871
|
+
var fromCodePoint = (
|
|
5872
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition, n/no-unsupported-features/es-builtins
|
|
5873
|
+
(_a = String.fromCodePoint) !== null && _a !== void 0 ? _a : function(codePoint) {
|
|
5874
|
+
let output = "";
|
|
5875
|
+
if (codePoint > 65535) {
|
|
5876
|
+
codePoint -= 65536;
|
|
5877
|
+
output += String.fromCharCode(codePoint >>> 10 & 1023 | 55296);
|
|
5878
|
+
codePoint = 56320 | codePoint & 1023;
|
|
5879
|
+
}
|
|
5880
|
+
output += String.fromCharCode(codePoint);
|
|
5881
|
+
return output;
|
|
5882
|
+
}
|
|
5883
|
+
);
|
|
5884
|
+
|
|
5885
|
+
// ../../node_modules/.pnpm/entities@6.0.1/node_modules/entities/dist/esm/decode.js
|
|
5886
|
+
var CharCodes;
|
|
5887
|
+
(function(CharCodes2) {
|
|
5888
|
+
CharCodes2[CharCodes2["NUM"] = 35] = "NUM";
|
|
5889
|
+
CharCodes2[CharCodes2["SEMI"] = 59] = "SEMI";
|
|
5890
|
+
CharCodes2[CharCodes2["EQUALS"] = 61] = "EQUALS";
|
|
5891
|
+
CharCodes2[CharCodes2["ZERO"] = 48] = "ZERO";
|
|
5892
|
+
CharCodes2[CharCodes2["NINE"] = 57] = "NINE";
|
|
5893
|
+
CharCodes2[CharCodes2["LOWER_A"] = 97] = "LOWER_A";
|
|
5894
|
+
CharCodes2[CharCodes2["LOWER_F"] = 102] = "LOWER_F";
|
|
5895
|
+
CharCodes2[CharCodes2["LOWER_X"] = 120] = "LOWER_X";
|
|
5896
|
+
CharCodes2[CharCodes2["LOWER_Z"] = 122] = "LOWER_Z";
|
|
5897
|
+
CharCodes2[CharCodes2["UPPER_A"] = 65] = "UPPER_A";
|
|
5898
|
+
CharCodes2[CharCodes2["UPPER_F"] = 70] = "UPPER_F";
|
|
5899
|
+
CharCodes2[CharCodes2["UPPER_Z"] = 90] = "UPPER_Z";
|
|
5900
|
+
})(CharCodes || (CharCodes = {}));
|
|
5901
|
+
var BinTrieFlags;
|
|
5902
|
+
(function(BinTrieFlags2) {
|
|
5903
|
+
BinTrieFlags2[BinTrieFlags2["VALUE_LENGTH"] = 49152] = "VALUE_LENGTH";
|
|
5904
|
+
BinTrieFlags2[BinTrieFlags2["BRANCH_LENGTH"] = 16256] = "BRANCH_LENGTH";
|
|
5905
|
+
BinTrieFlags2[BinTrieFlags2["JUMP_TABLE"] = 127] = "JUMP_TABLE";
|
|
5906
|
+
})(BinTrieFlags || (BinTrieFlags = {}));
|
|
5907
|
+
var EntityDecoderState;
|
|
5908
|
+
(function(EntityDecoderState2) {
|
|
5909
|
+
EntityDecoderState2[EntityDecoderState2["EntityStart"] = 0] = "EntityStart";
|
|
5910
|
+
EntityDecoderState2[EntityDecoderState2["NumericStart"] = 1] = "NumericStart";
|
|
5911
|
+
EntityDecoderState2[EntityDecoderState2["NumericDecimal"] = 2] = "NumericDecimal";
|
|
5912
|
+
EntityDecoderState2[EntityDecoderState2["NumericHex"] = 3] = "NumericHex";
|
|
5913
|
+
EntityDecoderState2[EntityDecoderState2["NamedEntity"] = 4] = "NamedEntity";
|
|
5914
|
+
})(EntityDecoderState || (EntityDecoderState = {}));
|
|
5915
|
+
var DecodingMode;
|
|
5916
|
+
(function(DecodingMode2) {
|
|
5917
|
+
DecodingMode2[DecodingMode2["Legacy"] = 0] = "Legacy";
|
|
5918
|
+
DecodingMode2[DecodingMode2["Strict"] = 1] = "Strict";
|
|
5919
|
+
DecodingMode2[DecodingMode2["Attribute"] = 2] = "Attribute";
|
|
5920
|
+
})(DecodingMode || (DecodingMode = {}));
|
|
5921
|
+
|
|
5922
|
+
// ../../node_modules/.pnpm/entities@6.0.1/node_modules/entities/dist/esm/escape.js
|
|
5923
|
+
var getCodePoint = (
|
|
5924
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
5925
|
+
String.prototype.codePointAt == null ? (c, index) => (c.charCodeAt(index) & 64512) === 55296 ? (c.charCodeAt(index) - 55296) * 1024 + c.charCodeAt(index + 1) - 56320 + 65536 : c.charCodeAt(index) : (
|
|
5926
|
+
// http://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
|
|
5927
|
+
(input, index) => input.codePointAt(index)
|
|
5928
|
+
)
|
|
5929
|
+
);
|
|
5930
|
+
|
|
5931
|
+
// ../../node_modules/.pnpm/entities@6.0.1/node_modules/entities/dist/esm/index.js
|
|
5932
|
+
var EntityLevel;
|
|
5933
|
+
(function(EntityLevel2) {
|
|
5934
|
+
EntityLevel2[EntityLevel2["XML"] = 0] = "XML";
|
|
5935
|
+
EntityLevel2[EntityLevel2["HTML"] = 1] = "HTML";
|
|
5936
|
+
})(EntityLevel || (EntityLevel = {}));
|
|
5937
|
+
var EncodingMode;
|
|
5938
|
+
(function(EncodingMode2) {
|
|
5939
|
+
EncodingMode2[EncodingMode2["UTF8"] = 0] = "UTF8";
|
|
5940
|
+
EncodingMode2[EncodingMode2["ASCII"] = 1] = "ASCII";
|
|
5941
|
+
EncodingMode2[EncodingMode2["Extensive"] = 2] = "Extensive";
|
|
5942
|
+
EncodingMode2[EncodingMode2["Attribute"] = 3] = "Attribute";
|
|
5943
|
+
EncodingMode2[EncodingMode2["Text"] = 4] = "Text";
|
|
5944
|
+
})(EncodingMode || (EncodingMode = {}));
|
|
5945
|
+
|
|
5946
|
+
// ../../node_modules/.pnpm/webdav@5.8.0/node_modules/webdav/dist/node/types.js
|
|
5947
|
+
var AuthType;
|
|
5948
|
+
(function(AuthType2) {
|
|
5949
|
+
AuthType2["Auto"] = "auto";
|
|
5950
|
+
AuthType2["Digest"] = "digest";
|
|
5951
|
+
AuthType2["None"] = "none";
|
|
5952
|
+
AuthType2["Password"] = "password";
|
|
5953
|
+
AuthType2["Token"] = "token";
|
|
5954
|
+
})(AuthType || (AuthType = {}));
|
|
5955
|
+
var ErrorCode;
|
|
5956
|
+
(function(ErrorCode2) {
|
|
5957
|
+
ErrorCode2["DataTypeNoLength"] = "data-type-no-length";
|
|
5958
|
+
ErrorCode2["InvalidAuthType"] = "invalid-auth-type";
|
|
5959
|
+
ErrorCode2["InvalidOutputFormat"] = "invalid-output-format";
|
|
5960
|
+
ErrorCode2["LinkUnsupportedAuthType"] = "link-unsupported-auth";
|
|
5961
|
+
ErrorCode2["InvalidUpdateRange"] = "invalid-update-range";
|
|
5962
|
+
ErrorCode2["NotSupported"] = "not-supported";
|
|
5963
|
+
})(ErrorCode || (ErrorCode = {}));
|
|
5964
|
+
|
|
5965
|
+
// ../../node_modules/.pnpm/webdav@5.8.0/node_modules/webdav/dist/node/compat/arrayBuffer.js
|
|
5966
|
+
var { toString: objToString } = Object.prototype;
|
|
5967
|
+
|
|
5968
|
+
// ../../node_modules/.pnpm/minimatch@9.0.5/node_modules/minimatch/dist/esm/index.js
|
|
5969
|
+
var import_brace_expansion = __toESM(require_brace_expansion(), 1);
|
|
5970
|
+
|
|
5971
|
+
// ../../node_modules/.pnpm/minimatch@9.0.5/node_modules/minimatch/dist/esm/assert-valid-pattern.js
|
|
5972
|
+
var MAX_PATTERN_LENGTH = 1024 * 64;
|
|
5973
|
+
var assertValidPattern = (pattern) => {
|
|
5974
|
+
if (typeof pattern !== "string") {
|
|
5975
|
+
throw new TypeError("invalid pattern");
|
|
5976
|
+
}
|
|
5977
|
+
if (pattern.length > MAX_PATTERN_LENGTH) {
|
|
5978
|
+
throw new TypeError("pattern is too long");
|
|
5979
|
+
}
|
|
5980
|
+
};
|
|
5981
|
+
|
|
5982
|
+
// ../../node_modules/.pnpm/minimatch@9.0.5/node_modules/minimatch/dist/esm/brace-expressions.js
|
|
5983
|
+
var posixClasses = {
|
|
5984
|
+
"[:alnum:]": ["\\p{L}\\p{Nl}\\p{Nd}", true],
|
|
5985
|
+
"[:alpha:]": ["\\p{L}\\p{Nl}", true],
|
|
5986
|
+
"[:ascii:]": ["\\x00-\\x7f", false],
|
|
5987
|
+
"[:blank:]": ["\\p{Zs}\\t", true],
|
|
5988
|
+
"[:cntrl:]": ["\\p{Cc}", true],
|
|
5989
|
+
"[:digit:]": ["\\p{Nd}", true],
|
|
5990
|
+
"[:graph:]": ["\\p{Z}\\p{C}", true, true],
|
|
5991
|
+
"[:lower:]": ["\\p{Ll}", true],
|
|
5992
|
+
"[:print:]": ["\\p{C}", true],
|
|
5993
|
+
"[:punct:]": ["\\p{P}", true],
|
|
5994
|
+
"[:space:]": ["\\p{Z}\\t\\r\\n\\v\\f", true],
|
|
5995
|
+
"[:upper:]": ["\\p{Lu}", true],
|
|
5996
|
+
"[:word:]": ["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}", true],
|
|
5997
|
+
"[:xdigit:]": ["A-Fa-f0-9", false]
|
|
5998
|
+
};
|
|
5999
|
+
var braceEscape = (s) => s.replace(/[[\]\\-]/g, "\\$&");
|
|
6000
|
+
var regexpEscape = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
|
6001
|
+
var rangesToString = (ranges) => ranges.join("");
|
|
6002
|
+
var parseClass = (glob, position) => {
|
|
6003
|
+
const pos = position;
|
|
6004
|
+
if (glob.charAt(pos) !== "[") {
|
|
6005
|
+
throw new Error("not in a brace expression");
|
|
6006
|
+
}
|
|
6007
|
+
const ranges = [];
|
|
6008
|
+
const negs = [];
|
|
6009
|
+
let i = pos + 1;
|
|
6010
|
+
let sawStart = false;
|
|
6011
|
+
let uflag = false;
|
|
6012
|
+
let escaping = false;
|
|
6013
|
+
let negate = false;
|
|
6014
|
+
let endPos = pos;
|
|
6015
|
+
let rangeStart = "";
|
|
6016
|
+
WHILE: while (i < glob.length) {
|
|
6017
|
+
const c = glob.charAt(i);
|
|
6018
|
+
if ((c === "!" || c === "^") && i === pos + 1) {
|
|
6019
|
+
negate = true;
|
|
6020
|
+
i++;
|
|
6021
|
+
continue;
|
|
6022
|
+
}
|
|
6023
|
+
if (c === "]" && sawStart && !escaping) {
|
|
6024
|
+
endPos = i + 1;
|
|
6025
|
+
break;
|
|
6026
|
+
}
|
|
6027
|
+
sawStart = true;
|
|
6028
|
+
if (c === "\\") {
|
|
6029
|
+
if (!escaping) {
|
|
6030
|
+
escaping = true;
|
|
6031
|
+
i++;
|
|
6032
|
+
continue;
|
|
6033
|
+
}
|
|
6034
|
+
}
|
|
6035
|
+
if (c === "[" && !escaping) {
|
|
6036
|
+
for (const [cls, [unip, u, neg]] of Object.entries(posixClasses)) {
|
|
6037
|
+
if (glob.startsWith(cls, i)) {
|
|
6038
|
+
if (rangeStart) {
|
|
6039
|
+
return ["$.", false, glob.length - pos, true];
|
|
6040
|
+
}
|
|
6041
|
+
i += cls.length;
|
|
6042
|
+
if (neg)
|
|
6043
|
+
negs.push(unip);
|
|
6044
|
+
else
|
|
6045
|
+
ranges.push(unip);
|
|
6046
|
+
uflag = uflag || u;
|
|
6047
|
+
continue WHILE;
|
|
6048
|
+
}
|
|
6049
|
+
}
|
|
6050
|
+
}
|
|
6051
|
+
escaping = false;
|
|
6052
|
+
if (rangeStart) {
|
|
6053
|
+
if (c > rangeStart) {
|
|
6054
|
+
ranges.push(braceEscape(rangeStart) + "-" + braceEscape(c));
|
|
6055
|
+
} else if (c === rangeStart) {
|
|
6056
|
+
ranges.push(braceEscape(c));
|
|
6057
|
+
}
|
|
6058
|
+
rangeStart = "";
|
|
6059
|
+
i++;
|
|
6060
|
+
continue;
|
|
6061
|
+
}
|
|
6062
|
+
if (glob.startsWith("-]", i + 1)) {
|
|
6063
|
+
ranges.push(braceEscape(c + "-"));
|
|
6064
|
+
i += 2;
|
|
6065
|
+
continue;
|
|
6066
|
+
}
|
|
6067
|
+
if (glob.startsWith("-", i + 1)) {
|
|
6068
|
+
rangeStart = c;
|
|
6069
|
+
i += 2;
|
|
6070
|
+
continue;
|
|
6071
|
+
}
|
|
6072
|
+
ranges.push(braceEscape(c));
|
|
6073
|
+
i++;
|
|
6074
|
+
}
|
|
6075
|
+
if (endPos < i) {
|
|
6076
|
+
return ["", false, 0, false];
|
|
6077
|
+
}
|
|
6078
|
+
if (!ranges.length && !negs.length) {
|
|
6079
|
+
return ["$.", false, glob.length - pos, true];
|
|
6080
|
+
}
|
|
6081
|
+
if (negs.length === 0 && ranges.length === 1 && /^\\?.$/.test(ranges[0]) && !negate) {
|
|
6082
|
+
const r = ranges[0].length === 2 ? ranges[0].slice(-1) : ranges[0];
|
|
6083
|
+
return [regexpEscape(r), false, endPos - pos, false];
|
|
6084
|
+
}
|
|
6085
|
+
const sranges = "[" + (negate ? "^" : "") + rangesToString(ranges) + "]";
|
|
6086
|
+
const snegs = "[" + (negate ? "" : "^") + rangesToString(negs) + "]";
|
|
6087
|
+
const comb = ranges.length && negs.length ? "(" + sranges + "|" + snegs + ")" : ranges.length ? sranges : snegs;
|
|
6088
|
+
return [comb, uflag, endPos - pos, true];
|
|
6089
|
+
};
|
|
6090
|
+
|
|
6091
|
+
// ../../node_modules/.pnpm/minimatch@9.0.5/node_modules/minimatch/dist/esm/unescape.js
|
|
6092
|
+
var unescape2 = (s, { windowsPathsNoEscape = false } = {}) => {
|
|
6093
|
+
return windowsPathsNoEscape ? s.replace(/\[([^\/\\])\]/g, "$1") : s.replace(/((?!\\).|^)\[([^\/\\])\]/g, "$1$2").replace(/\\([^\/])/g, "$1");
|
|
6094
|
+
};
|
|
6095
|
+
|
|
6096
|
+
// ../../node_modules/.pnpm/minimatch@9.0.5/node_modules/minimatch/dist/esm/ast.js
|
|
6097
|
+
var types = /* @__PURE__ */ new Set(["!", "?", "+", "*", "@"]);
|
|
6098
|
+
var isExtglobType = (c) => types.has(c);
|
|
6099
|
+
var startNoTraversal = "(?!(?:^|/)\\.\\.?(?:$|/))";
|
|
6100
|
+
var startNoDot = "(?!\\.)";
|
|
6101
|
+
var addPatternStart = /* @__PURE__ */ new Set(["[", "."]);
|
|
6102
|
+
var justDots = /* @__PURE__ */ new Set(["..", "."]);
|
|
6103
|
+
var reSpecials = new Set("().*{}+?[]^$\\!");
|
|
6104
|
+
var regExpEscape = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
|
6105
|
+
var qmark = "[^/]";
|
|
6106
|
+
var star = qmark + "*?";
|
|
6107
|
+
var starNoEmpty = qmark + "+?";
|
|
6108
|
+
var AST = class _AST {
|
|
6109
|
+
type;
|
|
6110
|
+
#root;
|
|
6111
|
+
#hasMagic;
|
|
6112
|
+
#uflag = false;
|
|
6113
|
+
#parts = [];
|
|
6114
|
+
#parent;
|
|
6115
|
+
#parentIndex;
|
|
6116
|
+
#negs;
|
|
6117
|
+
#filledNegs = false;
|
|
6118
|
+
#options;
|
|
6119
|
+
#toString;
|
|
6120
|
+
// set to true if it's an extglob with no children
|
|
6121
|
+
// (which really means one child of '')
|
|
6122
|
+
#emptyExt = false;
|
|
6123
|
+
constructor(type, parent, options = {}) {
|
|
6124
|
+
this.type = type;
|
|
6125
|
+
if (type)
|
|
6126
|
+
this.#hasMagic = true;
|
|
6127
|
+
this.#parent = parent;
|
|
6128
|
+
this.#root = this.#parent ? this.#parent.#root : this;
|
|
6129
|
+
this.#options = this.#root === this ? options : this.#root.#options;
|
|
6130
|
+
this.#negs = this.#root === this ? [] : this.#root.#negs;
|
|
6131
|
+
if (type === "!" && !this.#root.#filledNegs)
|
|
6132
|
+
this.#negs.push(this);
|
|
6133
|
+
this.#parentIndex = this.#parent ? this.#parent.#parts.length : 0;
|
|
6134
|
+
}
|
|
6135
|
+
get hasMagic() {
|
|
6136
|
+
if (this.#hasMagic !== void 0)
|
|
6137
|
+
return this.#hasMagic;
|
|
6138
|
+
for (const p of this.#parts) {
|
|
6139
|
+
if (typeof p === "string")
|
|
6140
|
+
continue;
|
|
6141
|
+
if (p.type || p.hasMagic)
|
|
6142
|
+
return this.#hasMagic = true;
|
|
6143
|
+
}
|
|
6144
|
+
return this.#hasMagic;
|
|
6145
|
+
}
|
|
6146
|
+
// reconstructs the pattern
|
|
6147
|
+
toString() {
|
|
6148
|
+
if (this.#toString !== void 0)
|
|
6149
|
+
return this.#toString;
|
|
6150
|
+
if (!this.type) {
|
|
6151
|
+
return this.#toString = this.#parts.map((p) => String(p)).join("");
|
|
6152
|
+
} else {
|
|
6153
|
+
return this.#toString = this.type + "(" + this.#parts.map((p) => String(p)).join("|") + ")";
|
|
6154
|
+
}
|
|
6155
|
+
}
|
|
6156
|
+
#fillNegs() {
|
|
6157
|
+
if (this !== this.#root)
|
|
6158
|
+
throw new Error("should only call on root");
|
|
6159
|
+
if (this.#filledNegs)
|
|
6160
|
+
return this;
|
|
6161
|
+
this.toString();
|
|
6162
|
+
this.#filledNegs = true;
|
|
6163
|
+
let n;
|
|
6164
|
+
while (n = this.#negs.pop()) {
|
|
6165
|
+
if (n.type !== "!")
|
|
6166
|
+
continue;
|
|
6167
|
+
let p = n;
|
|
6168
|
+
let pp = p.#parent;
|
|
6169
|
+
while (pp) {
|
|
6170
|
+
for (let i = p.#parentIndex + 1; !pp.type && i < pp.#parts.length; i++) {
|
|
6171
|
+
for (const part of n.#parts) {
|
|
6172
|
+
if (typeof part === "string") {
|
|
6173
|
+
throw new Error("string part in extglob AST??");
|
|
6174
|
+
}
|
|
6175
|
+
part.copyIn(pp.#parts[i]);
|
|
6176
|
+
}
|
|
6177
|
+
}
|
|
6178
|
+
p = pp;
|
|
6179
|
+
pp = p.#parent;
|
|
6180
|
+
}
|
|
6181
|
+
}
|
|
6182
|
+
return this;
|
|
6183
|
+
}
|
|
6184
|
+
push(...parts) {
|
|
6185
|
+
for (const p of parts) {
|
|
6186
|
+
if (p === "")
|
|
6187
|
+
continue;
|
|
6188
|
+
if (typeof p !== "string" && !(p instanceof _AST && p.#parent === this)) {
|
|
6189
|
+
throw new Error("invalid part: " + p);
|
|
6190
|
+
}
|
|
6191
|
+
this.#parts.push(p);
|
|
6192
|
+
}
|
|
6193
|
+
}
|
|
6194
|
+
toJSON() {
|
|
6195
|
+
const ret = this.type === null ? this.#parts.slice().map((p) => typeof p === "string" ? p : p.toJSON()) : [this.type, ...this.#parts.map((p) => p.toJSON())];
|
|
6196
|
+
if (this.isStart() && !this.type)
|
|
6197
|
+
ret.unshift([]);
|
|
6198
|
+
if (this.isEnd() && (this === this.#root || this.#root.#filledNegs && this.#parent?.type === "!")) {
|
|
6199
|
+
ret.push({});
|
|
6200
|
+
}
|
|
6201
|
+
return ret;
|
|
6202
|
+
}
|
|
6203
|
+
isStart() {
|
|
6204
|
+
if (this.#root === this)
|
|
6205
|
+
return true;
|
|
6206
|
+
if (!this.#parent?.isStart())
|
|
6207
|
+
return false;
|
|
6208
|
+
if (this.#parentIndex === 0)
|
|
6209
|
+
return true;
|
|
6210
|
+
const p = this.#parent;
|
|
6211
|
+
for (let i = 0; i < this.#parentIndex; i++) {
|
|
6212
|
+
const pp = p.#parts[i];
|
|
6213
|
+
if (!(pp instanceof _AST && pp.type === "!")) {
|
|
6214
|
+
return false;
|
|
6215
|
+
}
|
|
6216
|
+
}
|
|
6217
|
+
return true;
|
|
6218
|
+
}
|
|
6219
|
+
isEnd() {
|
|
6220
|
+
if (this.#root === this)
|
|
6221
|
+
return true;
|
|
6222
|
+
if (this.#parent?.type === "!")
|
|
6223
|
+
return true;
|
|
6224
|
+
if (!this.#parent?.isEnd())
|
|
6225
|
+
return false;
|
|
6226
|
+
if (!this.type)
|
|
6227
|
+
return this.#parent?.isEnd();
|
|
6228
|
+
const pl = this.#parent ? this.#parent.#parts.length : 0;
|
|
6229
|
+
return this.#parentIndex === pl - 1;
|
|
6230
|
+
}
|
|
6231
|
+
copyIn(part) {
|
|
6232
|
+
if (typeof part === "string")
|
|
6233
|
+
this.push(part);
|
|
6234
|
+
else
|
|
6235
|
+
this.push(part.clone(this));
|
|
6236
|
+
}
|
|
6237
|
+
clone(parent) {
|
|
6238
|
+
const c = new _AST(this.type, parent);
|
|
6239
|
+
for (const p of this.#parts) {
|
|
6240
|
+
c.copyIn(p);
|
|
6241
|
+
}
|
|
6242
|
+
return c;
|
|
6243
|
+
}
|
|
6244
|
+
static #parseAST(str, ast, pos, opt) {
|
|
6245
|
+
let escaping = false;
|
|
6246
|
+
let inBrace = false;
|
|
6247
|
+
let braceStart = -1;
|
|
6248
|
+
let braceNeg = false;
|
|
6249
|
+
if (ast.type === null) {
|
|
6250
|
+
let i2 = pos;
|
|
6251
|
+
let acc2 = "";
|
|
6252
|
+
while (i2 < str.length) {
|
|
6253
|
+
const c = str.charAt(i2++);
|
|
6254
|
+
if (escaping || c === "\\") {
|
|
6255
|
+
escaping = !escaping;
|
|
6256
|
+
acc2 += c;
|
|
6257
|
+
continue;
|
|
6258
|
+
}
|
|
6259
|
+
if (inBrace) {
|
|
6260
|
+
if (i2 === braceStart + 1) {
|
|
6261
|
+
if (c === "^" || c === "!") {
|
|
6262
|
+
braceNeg = true;
|
|
6263
|
+
}
|
|
6264
|
+
} else if (c === "]" && !(i2 === braceStart + 2 && braceNeg)) {
|
|
6265
|
+
inBrace = false;
|
|
6266
|
+
}
|
|
6267
|
+
acc2 += c;
|
|
6268
|
+
continue;
|
|
6269
|
+
} else if (c === "[") {
|
|
6270
|
+
inBrace = true;
|
|
6271
|
+
braceStart = i2;
|
|
6272
|
+
braceNeg = false;
|
|
6273
|
+
acc2 += c;
|
|
6274
|
+
continue;
|
|
6275
|
+
}
|
|
6276
|
+
if (!opt.noext && isExtglobType(c) && str.charAt(i2) === "(") {
|
|
6277
|
+
ast.push(acc2);
|
|
6278
|
+
acc2 = "";
|
|
6279
|
+
const ext2 = new _AST(c, ast);
|
|
6280
|
+
i2 = _AST.#parseAST(str, ext2, i2, opt);
|
|
6281
|
+
ast.push(ext2);
|
|
6282
|
+
continue;
|
|
6283
|
+
}
|
|
6284
|
+
acc2 += c;
|
|
6285
|
+
}
|
|
6286
|
+
ast.push(acc2);
|
|
6287
|
+
return i2;
|
|
6288
|
+
}
|
|
6289
|
+
let i = pos + 1;
|
|
6290
|
+
let part = new _AST(null, ast);
|
|
6291
|
+
const parts = [];
|
|
6292
|
+
let acc = "";
|
|
6293
|
+
while (i < str.length) {
|
|
6294
|
+
const c = str.charAt(i++);
|
|
6295
|
+
if (escaping || c === "\\") {
|
|
6296
|
+
escaping = !escaping;
|
|
6297
|
+
acc += c;
|
|
6298
|
+
continue;
|
|
6299
|
+
}
|
|
6300
|
+
if (inBrace) {
|
|
6301
|
+
if (i === braceStart + 1) {
|
|
6302
|
+
if (c === "^" || c === "!") {
|
|
6303
|
+
braceNeg = true;
|
|
6304
|
+
}
|
|
6305
|
+
} else if (c === "]" && !(i === braceStart + 2 && braceNeg)) {
|
|
6306
|
+
inBrace = false;
|
|
6307
|
+
}
|
|
6308
|
+
acc += c;
|
|
6309
|
+
continue;
|
|
6310
|
+
} else if (c === "[") {
|
|
6311
|
+
inBrace = true;
|
|
6312
|
+
braceStart = i;
|
|
6313
|
+
braceNeg = false;
|
|
6314
|
+
acc += c;
|
|
6315
|
+
continue;
|
|
6316
|
+
}
|
|
6317
|
+
if (isExtglobType(c) && str.charAt(i) === "(") {
|
|
6318
|
+
part.push(acc);
|
|
6319
|
+
acc = "";
|
|
6320
|
+
const ext2 = new _AST(c, part);
|
|
6321
|
+
part.push(ext2);
|
|
6322
|
+
i = _AST.#parseAST(str, ext2, i, opt);
|
|
6323
|
+
continue;
|
|
6324
|
+
}
|
|
6325
|
+
if (c === "|") {
|
|
6326
|
+
part.push(acc);
|
|
6327
|
+
acc = "";
|
|
6328
|
+
parts.push(part);
|
|
6329
|
+
part = new _AST(null, ast);
|
|
6330
|
+
continue;
|
|
6331
|
+
}
|
|
6332
|
+
if (c === ")") {
|
|
6333
|
+
if (acc === "" && ast.#parts.length === 0) {
|
|
6334
|
+
ast.#emptyExt = true;
|
|
6335
|
+
}
|
|
6336
|
+
part.push(acc);
|
|
6337
|
+
acc = "";
|
|
6338
|
+
ast.push(...parts, part);
|
|
6339
|
+
return i;
|
|
6340
|
+
}
|
|
6341
|
+
acc += c;
|
|
6342
|
+
}
|
|
6343
|
+
ast.type = null;
|
|
6344
|
+
ast.#hasMagic = void 0;
|
|
6345
|
+
ast.#parts = [str.substring(pos - 1)];
|
|
6346
|
+
return i;
|
|
6347
|
+
}
|
|
6348
|
+
static fromGlob(pattern, options = {}) {
|
|
6349
|
+
const ast = new _AST(null, void 0, options);
|
|
6350
|
+
_AST.#parseAST(pattern, ast, 0, options);
|
|
6351
|
+
return ast;
|
|
6352
|
+
}
|
|
6353
|
+
// returns the regular expression if there's magic, or the unescaped
|
|
6354
|
+
// string if not.
|
|
6355
|
+
toMMPattern() {
|
|
6356
|
+
if (this !== this.#root)
|
|
6357
|
+
return this.#root.toMMPattern();
|
|
6358
|
+
const glob = this.toString();
|
|
6359
|
+
const [re, body, hasMagic, uflag] = this.toRegExpSource();
|
|
6360
|
+
const anyMagic = hasMagic || this.#hasMagic || this.#options.nocase && !this.#options.nocaseMagicOnly && glob.toUpperCase() !== glob.toLowerCase();
|
|
6361
|
+
if (!anyMagic) {
|
|
6362
|
+
return body;
|
|
6363
|
+
}
|
|
6364
|
+
const flags = (this.#options.nocase ? "i" : "") + (uflag ? "u" : "");
|
|
6365
|
+
return Object.assign(new RegExp(`^${re}$`, flags), {
|
|
6366
|
+
_src: re,
|
|
6367
|
+
_glob: glob
|
|
6368
|
+
});
|
|
6369
|
+
}
|
|
6370
|
+
get options() {
|
|
6371
|
+
return this.#options;
|
|
6372
|
+
}
|
|
6373
|
+
// returns the string match, the regexp source, whether there's magic
|
|
6374
|
+
// in the regexp (so a regular expression is required) and whether or
|
|
6375
|
+
// not the uflag is needed for the regular expression (for posix classes)
|
|
6376
|
+
// TODO: instead of injecting the start/end at this point, just return
|
|
6377
|
+
// the BODY of the regexp, along with the start/end portions suitable
|
|
6378
|
+
// for binding the start/end in either a joined full-path makeRe context
|
|
6379
|
+
// (where we bind to (^|/), or a standalone matchPart context (where
|
|
6380
|
+
// we bind to ^, and not /). Otherwise slashes get duped!
|
|
6381
|
+
//
|
|
6382
|
+
// In part-matching mode, the start is:
|
|
6383
|
+
// - if not isStart: nothing
|
|
6384
|
+
// - if traversal possible, but not allowed: ^(?!\.\.?$)
|
|
6385
|
+
// - if dots allowed or not possible: ^
|
|
6386
|
+
// - if dots possible and not allowed: ^(?!\.)
|
|
6387
|
+
// end is:
|
|
6388
|
+
// - if not isEnd(): nothing
|
|
6389
|
+
// - else: $
|
|
6390
|
+
//
|
|
6391
|
+
// In full-path matching mode, we put the slash at the START of the
|
|
6392
|
+
// pattern, so start is:
|
|
6393
|
+
// - if first pattern: same as part-matching mode
|
|
6394
|
+
// - if not isStart(): nothing
|
|
6395
|
+
// - if traversal possible, but not allowed: /(?!\.\.?(?:$|/))
|
|
6396
|
+
// - if dots allowed or not possible: /
|
|
6397
|
+
// - if dots possible and not allowed: /(?!\.)
|
|
6398
|
+
// end is:
|
|
6399
|
+
// - if last pattern, same as part-matching mode
|
|
6400
|
+
// - else nothing
|
|
6401
|
+
//
|
|
6402
|
+
// Always put the (?:$|/) on negated tails, though, because that has to be
|
|
6403
|
+
// there to bind the end of the negated pattern portion, and it's easier to
|
|
6404
|
+
// just stick it in now rather than try to inject it later in the middle of
|
|
6405
|
+
// the pattern.
|
|
6406
|
+
//
|
|
6407
|
+
// We can just always return the same end, and leave it up to the caller
|
|
6408
|
+
// to know whether it's going to be used joined or in parts.
|
|
6409
|
+
// And, if the start is adjusted slightly, can do the same there:
|
|
6410
|
+
// - if not isStart: nothing
|
|
6411
|
+
// - if traversal possible, but not allowed: (?:/|^)(?!\.\.?$)
|
|
6412
|
+
// - if dots allowed or not possible: (?:/|^)
|
|
6413
|
+
// - if dots possible and not allowed: (?:/|^)(?!\.)
|
|
6414
|
+
//
|
|
6415
|
+
// But it's better to have a simpler binding without a conditional, for
|
|
6416
|
+
// performance, so probably better to return both start options.
|
|
6417
|
+
//
|
|
6418
|
+
// Then the caller just ignores the end if it's not the first pattern,
|
|
6419
|
+
// and the start always gets applied.
|
|
6420
|
+
//
|
|
6421
|
+
// But that's always going to be $ if it's the ending pattern, or nothing,
|
|
6422
|
+
// so the caller can just attach $ at the end of the pattern when building.
|
|
6423
|
+
//
|
|
6424
|
+
// So the todo is:
|
|
6425
|
+
// - better detect what kind of start is needed
|
|
6426
|
+
// - return both flavors of starting pattern
|
|
6427
|
+
// - attach $ at the end of the pattern when creating the actual RegExp
|
|
6428
|
+
//
|
|
6429
|
+
// Ah, but wait, no, that all only applies to the root when the first pattern
|
|
6430
|
+
// is not an extglob. If the first pattern IS an extglob, then we need all
|
|
6431
|
+
// that dot prevention biz to live in the extglob portions, because eg
|
|
6432
|
+
// +(*|.x*) can match .xy but not .yx.
|
|
6433
|
+
//
|
|
6434
|
+
// So, return the two flavors if it's #root and the first child is not an
|
|
6435
|
+
// AST, otherwise leave it to the child AST to handle it, and there,
|
|
6436
|
+
// use the (?:^|/) style of start binding.
|
|
6437
|
+
//
|
|
6438
|
+
// Even simplified further:
|
|
6439
|
+
// - Since the start for a join is eg /(?!\.) and the start for a part
|
|
6440
|
+
// is ^(?!\.), we can just prepend (?!\.) to the pattern (either root
|
|
6441
|
+
// or start or whatever) and prepend ^ or / at the Regexp construction.
|
|
6442
|
+
toRegExpSource(allowDot) {
|
|
6443
|
+
const dot = allowDot ?? !!this.#options.dot;
|
|
6444
|
+
if (this.#root === this)
|
|
6445
|
+
this.#fillNegs();
|
|
6446
|
+
if (!this.type) {
|
|
6447
|
+
const noEmpty = this.isStart() && this.isEnd();
|
|
6448
|
+
const src = this.#parts.map((p) => {
|
|
6449
|
+
const [re, _, hasMagic, uflag] = typeof p === "string" ? _AST.#parseGlob(p, this.#hasMagic, noEmpty) : p.toRegExpSource(allowDot);
|
|
6450
|
+
this.#hasMagic = this.#hasMagic || hasMagic;
|
|
6451
|
+
this.#uflag = this.#uflag || uflag;
|
|
6452
|
+
return re;
|
|
6453
|
+
}).join("");
|
|
6454
|
+
let start2 = "";
|
|
6455
|
+
if (this.isStart()) {
|
|
6456
|
+
if (typeof this.#parts[0] === "string") {
|
|
6457
|
+
const dotTravAllowed = this.#parts.length === 1 && justDots.has(this.#parts[0]);
|
|
6458
|
+
if (!dotTravAllowed) {
|
|
6459
|
+
const aps = addPatternStart;
|
|
6460
|
+
const needNoTrav = (
|
|
6461
|
+
// dots are allowed, and the pattern starts with [ or .
|
|
6462
|
+
dot && aps.has(src.charAt(0)) || // the pattern starts with \., and then [ or .
|
|
6463
|
+
src.startsWith("\\.") && aps.has(src.charAt(2)) || // the pattern starts with \.\., and then [ or .
|
|
6464
|
+
src.startsWith("\\.\\.") && aps.has(src.charAt(4))
|
|
6465
|
+
);
|
|
6466
|
+
const needNoDot = !dot && !allowDot && aps.has(src.charAt(0));
|
|
6467
|
+
start2 = needNoTrav ? startNoTraversal : needNoDot ? startNoDot : "";
|
|
6468
|
+
}
|
|
6469
|
+
}
|
|
6470
|
+
}
|
|
6471
|
+
let end = "";
|
|
6472
|
+
if (this.isEnd() && this.#root.#filledNegs && this.#parent?.type === "!") {
|
|
6473
|
+
end = "(?:$|\\/)";
|
|
6474
|
+
}
|
|
6475
|
+
const final2 = start2 + src + end;
|
|
6476
|
+
return [
|
|
6477
|
+
final2,
|
|
6478
|
+
unescape2(src),
|
|
6479
|
+
this.#hasMagic = !!this.#hasMagic,
|
|
6480
|
+
this.#uflag
|
|
6481
|
+
];
|
|
6482
|
+
}
|
|
6483
|
+
const repeated = this.type === "*" || this.type === "+";
|
|
6484
|
+
const start = this.type === "!" ? "(?:(?!(?:" : "(?:";
|
|
6485
|
+
let body = this.#partsToRegExp(dot);
|
|
6486
|
+
if (this.isStart() && this.isEnd() && !body && this.type !== "!") {
|
|
6487
|
+
const s = this.toString();
|
|
6488
|
+
this.#parts = [s];
|
|
6489
|
+
this.type = null;
|
|
6490
|
+
this.#hasMagic = void 0;
|
|
6491
|
+
return [s, unescape2(this.toString()), false, false];
|
|
6492
|
+
}
|
|
6493
|
+
let bodyDotAllowed = !repeated || allowDot || dot || !startNoDot ? "" : this.#partsToRegExp(true);
|
|
6494
|
+
if (bodyDotAllowed === body) {
|
|
6495
|
+
bodyDotAllowed = "";
|
|
6496
|
+
}
|
|
6497
|
+
if (bodyDotAllowed) {
|
|
6498
|
+
body = `(?:${body})(?:${bodyDotAllowed})*?`;
|
|
6499
|
+
}
|
|
6500
|
+
let final = "";
|
|
6501
|
+
if (this.type === "!" && this.#emptyExt) {
|
|
6502
|
+
final = (this.isStart() && !dot ? startNoDot : "") + starNoEmpty;
|
|
6503
|
+
} else {
|
|
6504
|
+
const close = this.type === "!" ? (
|
|
6505
|
+
// !() must match something,but !(x) can match ''
|
|
6506
|
+
"))" + (this.isStart() && !dot && !allowDot ? startNoDot : "") + star + ")"
|
|
6507
|
+
) : this.type === "@" ? ")" : this.type === "?" ? ")?" : this.type === "+" && bodyDotAllowed ? ")" : this.type === "*" && bodyDotAllowed ? `)?` : `)${this.type}`;
|
|
6508
|
+
final = start + body + close;
|
|
6509
|
+
}
|
|
6510
|
+
return [
|
|
6511
|
+
final,
|
|
6512
|
+
unescape2(body),
|
|
6513
|
+
this.#hasMagic = !!this.#hasMagic,
|
|
6514
|
+
this.#uflag
|
|
6515
|
+
];
|
|
6516
|
+
}
|
|
6517
|
+
#partsToRegExp(dot) {
|
|
6518
|
+
return this.#parts.map((p) => {
|
|
6519
|
+
if (typeof p === "string") {
|
|
6520
|
+
throw new Error("string type in extglob ast??");
|
|
6521
|
+
}
|
|
6522
|
+
const [re, _, _hasMagic, uflag] = p.toRegExpSource(dot);
|
|
6523
|
+
this.#uflag = this.#uflag || uflag;
|
|
6524
|
+
return re;
|
|
6525
|
+
}).filter((p) => !(this.isStart() && this.isEnd()) || !!p).join("|");
|
|
6526
|
+
}
|
|
6527
|
+
static #parseGlob(glob, hasMagic, noEmpty = false) {
|
|
6528
|
+
let escaping = false;
|
|
6529
|
+
let re = "";
|
|
6530
|
+
let uflag = false;
|
|
6531
|
+
for (let i = 0; i < glob.length; i++) {
|
|
6532
|
+
const c = glob.charAt(i);
|
|
6533
|
+
if (escaping) {
|
|
6534
|
+
escaping = false;
|
|
6535
|
+
re += (reSpecials.has(c) ? "\\" : "") + c;
|
|
6536
|
+
continue;
|
|
6537
|
+
}
|
|
6538
|
+
if (c === "\\") {
|
|
6539
|
+
if (i === glob.length - 1) {
|
|
6540
|
+
re += "\\\\";
|
|
6541
|
+
} else {
|
|
6542
|
+
escaping = true;
|
|
6543
|
+
}
|
|
6544
|
+
continue;
|
|
6545
|
+
}
|
|
6546
|
+
if (c === "[") {
|
|
6547
|
+
const [src, needUflag, consumed, magic] = parseClass(glob, i);
|
|
6548
|
+
if (consumed) {
|
|
6549
|
+
re += src;
|
|
6550
|
+
uflag = uflag || needUflag;
|
|
6551
|
+
i += consumed - 1;
|
|
6552
|
+
hasMagic = hasMagic || magic;
|
|
6553
|
+
continue;
|
|
6554
|
+
}
|
|
6555
|
+
}
|
|
6556
|
+
if (c === "*") {
|
|
6557
|
+
if (noEmpty && glob === "*")
|
|
6558
|
+
re += starNoEmpty;
|
|
6559
|
+
else
|
|
6560
|
+
re += star;
|
|
6561
|
+
hasMagic = true;
|
|
6562
|
+
continue;
|
|
6563
|
+
}
|
|
6564
|
+
if (c === "?") {
|
|
6565
|
+
re += qmark;
|
|
6566
|
+
hasMagic = true;
|
|
6567
|
+
continue;
|
|
6568
|
+
}
|
|
6569
|
+
re += regExpEscape(c);
|
|
6570
|
+
}
|
|
6571
|
+
return [re, unescape2(glob), !!hasMagic, uflag];
|
|
6572
|
+
}
|
|
6573
|
+
};
|
|
6574
|
+
|
|
6575
|
+
// ../../node_modules/.pnpm/minimatch@9.0.5/node_modules/minimatch/dist/esm/escape.js
|
|
6576
|
+
var escape3 = (s, { windowsPathsNoEscape = false } = {}) => {
|
|
6577
|
+
return windowsPathsNoEscape ? s.replace(/[?*()[\]]/g, "[$&]") : s.replace(/[?*()[\]\\]/g, "\\$&");
|
|
6578
|
+
};
|
|
6579
|
+
|
|
6580
|
+
// ../../node_modules/.pnpm/minimatch@9.0.5/node_modules/minimatch/dist/esm/index.js
|
|
6581
|
+
var minimatch = (p, pattern, options = {}) => {
|
|
6582
|
+
assertValidPattern(pattern);
|
|
6583
|
+
if (!options.nocomment && pattern.charAt(0) === "#") {
|
|
6584
|
+
return false;
|
|
6585
|
+
}
|
|
6586
|
+
return new Minimatch(pattern, options).match(p);
|
|
6587
|
+
};
|
|
6588
|
+
var starDotExtRE = /^\*+([^+@!?\*\[\(]*)$/;
|
|
6589
|
+
var starDotExtTest = (ext2) => (f) => !f.startsWith(".") && f.endsWith(ext2);
|
|
6590
|
+
var starDotExtTestDot = (ext2) => (f) => f.endsWith(ext2);
|
|
6591
|
+
var starDotExtTestNocase = (ext2) => {
|
|
6592
|
+
ext2 = ext2.toLowerCase();
|
|
6593
|
+
return (f) => !f.startsWith(".") && f.toLowerCase().endsWith(ext2);
|
|
6594
|
+
};
|
|
6595
|
+
var starDotExtTestNocaseDot = (ext2) => {
|
|
6596
|
+
ext2 = ext2.toLowerCase();
|
|
6597
|
+
return (f) => f.toLowerCase().endsWith(ext2);
|
|
6598
|
+
};
|
|
6599
|
+
var starDotStarRE = /^\*+\.\*+$/;
|
|
6600
|
+
var starDotStarTest = (f) => !f.startsWith(".") && f.includes(".");
|
|
6601
|
+
var starDotStarTestDot = (f) => f !== "." && f !== ".." && f.includes(".");
|
|
6602
|
+
var dotStarRE = /^\.\*+$/;
|
|
6603
|
+
var dotStarTest = (f) => f !== "." && f !== ".." && f.startsWith(".");
|
|
6604
|
+
var starRE = /^\*+$/;
|
|
6605
|
+
var starTest = (f) => f.length !== 0 && !f.startsWith(".");
|
|
6606
|
+
var starTestDot = (f) => f.length !== 0 && f !== "." && f !== "..";
|
|
6607
|
+
var qmarksRE = /^\?+([^+@!?\*\[\(]*)?$/;
|
|
6608
|
+
var qmarksTestNocase = ([$0, ext2 = ""]) => {
|
|
6609
|
+
const noext = qmarksTestNoExt([$0]);
|
|
6610
|
+
if (!ext2)
|
|
6611
|
+
return noext;
|
|
6612
|
+
ext2 = ext2.toLowerCase();
|
|
6613
|
+
return (f) => noext(f) && f.toLowerCase().endsWith(ext2);
|
|
6614
|
+
};
|
|
6615
|
+
var qmarksTestNocaseDot = ([$0, ext2 = ""]) => {
|
|
6616
|
+
const noext = qmarksTestNoExtDot([$0]);
|
|
6617
|
+
if (!ext2)
|
|
6618
|
+
return noext;
|
|
6619
|
+
ext2 = ext2.toLowerCase();
|
|
6620
|
+
return (f) => noext(f) && f.toLowerCase().endsWith(ext2);
|
|
6621
|
+
};
|
|
6622
|
+
var qmarksTestDot = ([$0, ext2 = ""]) => {
|
|
6623
|
+
const noext = qmarksTestNoExtDot([$0]);
|
|
6624
|
+
return !ext2 ? noext : (f) => noext(f) && f.endsWith(ext2);
|
|
6625
|
+
};
|
|
6626
|
+
var qmarksTest = ([$0, ext2 = ""]) => {
|
|
6627
|
+
const noext = qmarksTestNoExt([$0]);
|
|
6628
|
+
return !ext2 ? noext : (f) => noext(f) && f.endsWith(ext2);
|
|
6629
|
+
};
|
|
6630
|
+
var qmarksTestNoExt = ([$0]) => {
|
|
6631
|
+
const len = $0.length;
|
|
6632
|
+
return (f) => f.length === len && !f.startsWith(".");
|
|
6633
|
+
};
|
|
6634
|
+
var qmarksTestNoExtDot = ([$0]) => {
|
|
6635
|
+
const len = $0.length;
|
|
6636
|
+
return (f) => f.length === len && f !== "." && f !== "..";
|
|
6637
|
+
};
|
|
6638
|
+
var defaultPlatform = typeof process === "object" && process ? typeof process.env === "object" && process.env && process.env.__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix";
|
|
6639
|
+
var path5 = {
|
|
6640
|
+
win32: { sep: "\\" },
|
|
6641
|
+
posix: { sep: "/" }
|
|
6642
|
+
};
|
|
6643
|
+
var sep = defaultPlatform === "win32" ? path5.win32.sep : path5.posix.sep;
|
|
6644
|
+
minimatch.sep = sep;
|
|
6645
|
+
var GLOBSTAR = Symbol("globstar **");
|
|
6646
|
+
minimatch.GLOBSTAR = GLOBSTAR;
|
|
6647
|
+
var qmark2 = "[^/]";
|
|
6648
|
+
var star2 = qmark2 + "*?";
|
|
6649
|
+
var twoStarDot = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?";
|
|
6650
|
+
var twoStarNoDot = "(?:(?!(?:\\/|^)\\.).)*?";
|
|
6651
|
+
var filter = (pattern, options = {}) => (p) => minimatch(p, pattern, options);
|
|
6652
|
+
minimatch.filter = filter;
|
|
6653
|
+
var ext = (a, b = {}) => Object.assign({}, a, b);
|
|
6654
|
+
var defaults = (def) => {
|
|
6655
|
+
if (!def || typeof def !== "object" || !Object.keys(def).length) {
|
|
6656
|
+
return minimatch;
|
|
6657
|
+
}
|
|
6658
|
+
const orig = minimatch;
|
|
6659
|
+
const m = (p, pattern, options = {}) => orig(p, pattern, ext(def, options));
|
|
6660
|
+
return Object.assign(m, {
|
|
6661
|
+
Minimatch: class Minimatch extends orig.Minimatch {
|
|
6662
|
+
constructor(pattern, options = {}) {
|
|
6663
|
+
super(pattern, ext(def, options));
|
|
6664
|
+
}
|
|
6665
|
+
static defaults(options) {
|
|
6666
|
+
return orig.defaults(ext(def, options)).Minimatch;
|
|
6667
|
+
}
|
|
6668
|
+
},
|
|
6669
|
+
AST: class AST extends orig.AST {
|
|
6670
|
+
/* c8 ignore start */
|
|
6671
|
+
constructor(type, parent, options = {}) {
|
|
6672
|
+
super(type, parent, ext(def, options));
|
|
6673
|
+
}
|
|
6674
|
+
/* c8 ignore stop */
|
|
6675
|
+
static fromGlob(pattern, options = {}) {
|
|
6676
|
+
return orig.AST.fromGlob(pattern, ext(def, options));
|
|
6677
|
+
}
|
|
6678
|
+
},
|
|
6679
|
+
unescape: (s, options = {}) => orig.unescape(s, ext(def, options)),
|
|
6680
|
+
escape: (s, options = {}) => orig.escape(s, ext(def, options)),
|
|
6681
|
+
filter: (pattern, options = {}) => orig.filter(pattern, ext(def, options)),
|
|
6682
|
+
defaults: (options) => orig.defaults(ext(def, options)),
|
|
6683
|
+
makeRe: (pattern, options = {}) => orig.makeRe(pattern, ext(def, options)),
|
|
6684
|
+
braceExpand: (pattern, options = {}) => orig.braceExpand(pattern, ext(def, options)),
|
|
6685
|
+
match: (list, pattern, options = {}) => orig.match(list, pattern, ext(def, options)),
|
|
6686
|
+
sep: orig.sep,
|
|
6687
|
+
GLOBSTAR
|
|
6688
|
+
});
|
|
6689
|
+
};
|
|
6690
|
+
minimatch.defaults = defaults;
|
|
6691
|
+
var braceExpand = (pattern, options = {}) => {
|
|
6692
|
+
assertValidPattern(pattern);
|
|
6693
|
+
if (options.nobrace || !/\{(?:(?!\{).)*\}/.test(pattern)) {
|
|
6694
|
+
return [pattern];
|
|
6695
|
+
}
|
|
6696
|
+
return (0, import_brace_expansion.default)(pattern);
|
|
6697
|
+
};
|
|
6698
|
+
minimatch.braceExpand = braceExpand;
|
|
6699
|
+
var makeRe = (pattern, options = {}) => new Minimatch(pattern, options).makeRe();
|
|
6700
|
+
minimatch.makeRe = makeRe;
|
|
6701
|
+
var match = (list, pattern, options = {}) => {
|
|
6702
|
+
const mm = new Minimatch(pattern, options);
|
|
6703
|
+
list = list.filter((f) => mm.match(f));
|
|
6704
|
+
if (mm.options.nonull && !list.length) {
|
|
6705
|
+
list.push(pattern);
|
|
6706
|
+
}
|
|
6707
|
+
return list;
|
|
6708
|
+
};
|
|
6709
|
+
minimatch.match = match;
|
|
6710
|
+
var globMagic = /[?*]|[+@!]\(.*?\)|\[|\]/;
|
|
6711
|
+
var regExpEscape2 = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
|
6712
|
+
var Minimatch = class {
|
|
6713
|
+
options;
|
|
6714
|
+
set;
|
|
6715
|
+
pattern;
|
|
6716
|
+
windowsPathsNoEscape;
|
|
6717
|
+
nonegate;
|
|
6718
|
+
negate;
|
|
6719
|
+
comment;
|
|
6720
|
+
empty;
|
|
6721
|
+
preserveMultipleSlashes;
|
|
6722
|
+
partial;
|
|
6723
|
+
globSet;
|
|
6724
|
+
globParts;
|
|
6725
|
+
nocase;
|
|
6726
|
+
isWindows;
|
|
6727
|
+
platform;
|
|
6728
|
+
windowsNoMagicRoot;
|
|
6729
|
+
regexp;
|
|
6730
|
+
constructor(pattern, options = {}) {
|
|
6731
|
+
assertValidPattern(pattern);
|
|
6732
|
+
options = options || {};
|
|
6733
|
+
this.options = options;
|
|
6734
|
+
this.pattern = pattern;
|
|
6735
|
+
this.platform = options.platform || defaultPlatform;
|
|
6736
|
+
this.isWindows = this.platform === "win32";
|
|
6737
|
+
this.windowsPathsNoEscape = !!options.windowsPathsNoEscape || options.allowWindowsEscape === false;
|
|
6738
|
+
if (this.windowsPathsNoEscape) {
|
|
6739
|
+
this.pattern = this.pattern.replace(/\\/g, "/");
|
|
6740
|
+
}
|
|
6741
|
+
this.preserveMultipleSlashes = !!options.preserveMultipleSlashes;
|
|
6742
|
+
this.regexp = null;
|
|
6743
|
+
this.negate = false;
|
|
6744
|
+
this.nonegate = !!options.nonegate;
|
|
6745
|
+
this.comment = false;
|
|
6746
|
+
this.empty = false;
|
|
6747
|
+
this.partial = !!options.partial;
|
|
6748
|
+
this.nocase = !!this.options.nocase;
|
|
6749
|
+
this.windowsNoMagicRoot = options.windowsNoMagicRoot !== void 0 ? options.windowsNoMagicRoot : !!(this.isWindows && this.nocase);
|
|
6750
|
+
this.globSet = [];
|
|
6751
|
+
this.globParts = [];
|
|
6752
|
+
this.set = [];
|
|
6753
|
+
this.make();
|
|
6754
|
+
}
|
|
6755
|
+
hasMagic() {
|
|
6756
|
+
if (this.options.magicalBraces && this.set.length > 1) {
|
|
6757
|
+
return true;
|
|
6758
|
+
}
|
|
6759
|
+
for (const pattern of this.set) {
|
|
6760
|
+
for (const part of pattern) {
|
|
6761
|
+
if (typeof part !== "string")
|
|
6762
|
+
return true;
|
|
6763
|
+
}
|
|
6764
|
+
}
|
|
6765
|
+
return false;
|
|
6766
|
+
}
|
|
6767
|
+
debug(..._) {
|
|
6768
|
+
}
|
|
6769
|
+
make() {
|
|
6770
|
+
const pattern = this.pattern;
|
|
6771
|
+
const options = this.options;
|
|
6772
|
+
if (!options.nocomment && pattern.charAt(0) === "#") {
|
|
6773
|
+
this.comment = true;
|
|
6774
|
+
return;
|
|
6775
|
+
}
|
|
6776
|
+
if (!pattern) {
|
|
6777
|
+
this.empty = true;
|
|
6778
|
+
return;
|
|
6779
|
+
}
|
|
6780
|
+
this.parseNegate();
|
|
6781
|
+
this.globSet = [...new Set(this.braceExpand())];
|
|
6782
|
+
if (options.debug) {
|
|
6783
|
+
this.debug = (...args) => console.error(...args);
|
|
6784
|
+
}
|
|
6785
|
+
this.debug(this.pattern, this.globSet);
|
|
6786
|
+
const rawGlobParts = this.globSet.map((s) => this.slashSplit(s));
|
|
6787
|
+
this.globParts = this.preprocess(rawGlobParts);
|
|
6788
|
+
this.debug(this.pattern, this.globParts);
|
|
6789
|
+
let set = this.globParts.map((s, _, __) => {
|
|
6790
|
+
if (this.isWindows && this.windowsNoMagicRoot) {
|
|
6791
|
+
const isUNC = s[0] === "" && s[1] === "" && (s[2] === "?" || !globMagic.test(s[2])) && !globMagic.test(s[3]);
|
|
6792
|
+
const isDrive = /^[a-z]:/i.test(s[0]);
|
|
6793
|
+
if (isUNC) {
|
|
6794
|
+
return [...s.slice(0, 4), ...s.slice(4).map((ss) => this.parse(ss))];
|
|
6795
|
+
} else if (isDrive) {
|
|
6796
|
+
return [s[0], ...s.slice(1).map((ss) => this.parse(ss))];
|
|
6797
|
+
}
|
|
6798
|
+
}
|
|
6799
|
+
return s.map((ss) => this.parse(ss));
|
|
6800
|
+
});
|
|
6801
|
+
this.debug(this.pattern, set);
|
|
6802
|
+
this.set = set.filter((s) => s.indexOf(false) === -1);
|
|
6803
|
+
if (this.isWindows) {
|
|
6804
|
+
for (let i = 0; i < this.set.length; i++) {
|
|
6805
|
+
const p = this.set[i];
|
|
6806
|
+
if (p[0] === "" && p[1] === "" && this.globParts[i][2] === "?" && typeof p[3] === "string" && /^[a-z]:$/i.test(p[3])) {
|
|
6807
|
+
p[2] = "?";
|
|
6808
|
+
}
|
|
6809
|
+
}
|
|
6810
|
+
}
|
|
6811
|
+
this.debug(this.pattern, this.set);
|
|
6812
|
+
}
|
|
6813
|
+
// various transforms to equivalent pattern sets that are
|
|
6814
|
+
// faster to process in a filesystem walk. The goal is to
|
|
6815
|
+
// eliminate what we can, and push all ** patterns as far
|
|
6816
|
+
// to the right as possible, even if it increases the number
|
|
6817
|
+
// of patterns that we have to process.
|
|
6818
|
+
preprocess(globParts) {
|
|
6819
|
+
if (this.options.noglobstar) {
|
|
6820
|
+
for (let i = 0; i < globParts.length; i++) {
|
|
6821
|
+
for (let j = 0; j < globParts[i].length; j++) {
|
|
6822
|
+
if (globParts[i][j] === "**") {
|
|
6823
|
+
globParts[i][j] = "*";
|
|
6824
|
+
}
|
|
6825
|
+
}
|
|
6826
|
+
}
|
|
6827
|
+
}
|
|
6828
|
+
const { optimizationLevel = 1 } = this.options;
|
|
6829
|
+
if (optimizationLevel >= 2) {
|
|
6830
|
+
globParts = this.firstPhasePreProcess(globParts);
|
|
6831
|
+
globParts = this.secondPhasePreProcess(globParts);
|
|
6832
|
+
} else if (optimizationLevel >= 1) {
|
|
6833
|
+
globParts = this.levelOneOptimize(globParts);
|
|
6834
|
+
} else {
|
|
6835
|
+
globParts = this.adjascentGlobstarOptimize(globParts);
|
|
6836
|
+
}
|
|
6837
|
+
return globParts;
|
|
6838
|
+
}
|
|
6839
|
+
// just get rid of adjascent ** portions
|
|
6840
|
+
adjascentGlobstarOptimize(globParts) {
|
|
6841
|
+
return globParts.map((parts) => {
|
|
6842
|
+
let gs = -1;
|
|
6843
|
+
while (-1 !== (gs = parts.indexOf("**", gs + 1))) {
|
|
6844
|
+
let i = gs;
|
|
6845
|
+
while (parts[i + 1] === "**") {
|
|
6846
|
+
i++;
|
|
6847
|
+
}
|
|
6848
|
+
if (i !== gs) {
|
|
6849
|
+
parts.splice(gs, i - gs);
|
|
6850
|
+
}
|
|
6851
|
+
}
|
|
6852
|
+
return parts;
|
|
6853
|
+
});
|
|
6854
|
+
}
|
|
6855
|
+
// get rid of adjascent ** and resolve .. portions
|
|
6856
|
+
levelOneOptimize(globParts) {
|
|
6857
|
+
return globParts.map((parts) => {
|
|
6858
|
+
parts = parts.reduce((set, part) => {
|
|
6859
|
+
const prev = set[set.length - 1];
|
|
6860
|
+
if (part === "**" && prev === "**") {
|
|
6861
|
+
return set;
|
|
6862
|
+
}
|
|
6863
|
+
if (part === "..") {
|
|
6864
|
+
if (prev && prev !== ".." && prev !== "." && prev !== "**") {
|
|
6865
|
+
set.pop();
|
|
6866
|
+
return set;
|
|
6867
|
+
}
|
|
6868
|
+
}
|
|
6869
|
+
set.push(part);
|
|
6870
|
+
return set;
|
|
6871
|
+
}, []);
|
|
6872
|
+
return parts.length === 0 ? [""] : parts;
|
|
6873
|
+
});
|
|
6874
|
+
}
|
|
6875
|
+
levelTwoFileOptimize(parts) {
|
|
6876
|
+
if (!Array.isArray(parts)) {
|
|
6877
|
+
parts = this.slashSplit(parts);
|
|
6878
|
+
}
|
|
6879
|
+
let didSomething = false;
|
|
6880
|
+
do {
|
|
6881
|
+
didSomething = false;
|
|
6882
|
+
if (!this.preserveMultipleSlashes) {
|
|
6883
|
+
for (let i = 1; i < parts.length - 1; i++) {
|
|
6884
|
+
const p = parts[i];
|
|
6885
|
+
if (i === 1 && p === "" && parts[0] === "")
|
|
6886
|
+
continue;
|
|
6887
|
+
if (p === "." || p === "") {
|
|
6888
|
+
didSomething = true;
|
|
6889
|
+
parts.splice(i, 1);
|
|
6890
|
+
i--;
|
|
6891
|
+
}
|
|
6892
|
+
}
|
|
6893
|
+
if (parts[0] === "." && parts.length === 2 && (parts[1] === "." || parts[1] === "")) {
|
|
6894
|
+
didSomething = true;
|
|
6895
|
+
parts.pop();
|
|
6896
|
+
}
|
|
6897
|
+
}
|
|
6898
|
+
let dd = 0;
|
|
6899
|
+
while (-1 !== (dd = parts.indexOf("..", dd + 1))) {
|
|
6900
|
+
const p = parts[dd - 1];
|
|
6901
|
+
if (p && p !== "." && p !== ".." && p !== "**") {
|
|
6902
|
+
didSomething = true;
|
|
6903
|
+
parts.splice(dd - 1, 2);
|
|
6904
|
+
dd -= 2;
|
|
6905
|
+
}
|
|
6906
|
+
}
|
|
6907
|
+
} while (didSomething);
|
|
6908
|
+
return parts.length === 0 ? [""] : parts;
|
|
6909
|
+
}
|
|
6910
|
+
// First phase: single-pattern processing
|
|
6911
|
+
// <pre> is 1 or more portions
|
|
6912
|
+
// <rest> is 1 or more portions
|
|
6913
|
+
// <p> is any portion other than ., .., '', or **
|
|
6914
|
+
// <e> is . or ''
|
|
6915
|
+
//
|
|
6916
|
+
// **/.. is *brutal* for filesystem walking performance, because
|
|
6917
|
+
// it effectively resets the recursive walk each time it occurs,
|
|
6918
|
+
// and ** cannot be reduced out by a .. pattern part like a regexp
|
|
6919
|
+
// or most strings (other than .., ., and '') can be.
|
|
6920
|
+
//
|
|
6921
|
+
// <pre>/**/../<p>/<p>/<rest> -> {<pre>/../<p>/<p>/<rest>,<pre>/**/<p>/<p>/<rest>}
|
|
6922
|
+
// <pre>/<e>/<rest> -> <pre>/<rest>
|
|
6923
|
+
// <pre>/<p>/../<rest> -> <pre>/<rest>
|
|
6924
|
+
// **/**/<rest> -> **/<rest>
|
|
6925
|
+
//
|
|
6926
|
+
// **/*/<rest> -> */**/<rest> <== not valid because ** doesn't follow
|
|
6927
|
+
// this WOULD be allowed if ** did follow symlinks, or * didn't
|
|
6928
|
+
firstPhasePreProcess(globParts) {
|
|
6929
|
+
let didSomething = false;
|
|
6930
|
+
do {
|
|
6931
|
+
didSomething = false;
|
|
6932
|
+
for (let parts of globParts) {
|
|
6933
|
+
let gs = -1;
|
|
6934
|
+
while (-1 !== (gs = parts.indexOf("**", gs + 1))) {
|
|
6935
|
+
let gss = gs;
|
|
6936
|
+
while (parts[gss + 1] === "**") {
|
|
6937
|
+
gss++;
|
|
6938
|
+
}
|
|
6939
|
+
if (gss > gs) {
|
|
6940
|
+
parts.splice(gs + 1, gss - gs);
|
|
6941
|
+
}
|
|
6942
|
+
let next = parts[gs + 1];
|
|
6943
|
+
const p = parts[gs + 2];
|
|
6944
|
+
const p2 = parts[gs + 3];
|
|
6945
|
+
if (next !== "..")
|
|
6946
|
+
continue;
|
|
6947
|
+
if (!p || p === "." || p === ".." || !p2 || p2 === "." || p2 === "..") {
|
|
6948
|
+
continue;
|
|
6949
|
+
}
|
|
6950
|
+
didSomething = true;
|
|
6951
|
+
parts.splice(gs, 1);
|
|
6952
|
+
const other = parts.slice(0);
|
|
6953
|
+
other[gs] = "**";
|
|
6954
|
+
globParts.push(other);
|
|
6955
|
+
gs--;
|
|
6956
|
+
}
|
|
6957
|
+
if (!this.preserveMultipleSlashes) {
|
|
6958
|
+
for (let i = 1; i < parts.length - 1; i++) {
|
|
6959
|
+
const p = parts[i];
|
|
6960
|
+
if (i === 1 && p === "" && parts[0] === "")
|
|
6961
|
+
continue;
|
|
6962
|
+
if (p === "." || p === "") {
|
|
6963
|
+
didSomething = true;
|
|
6964
|
+
parts.splice(i, 1);
|
|
6965
|
+
i--;
|
|
6966
|
+
}
|
|
6967
|
+
}
|
|
6968
|
+
if (parts[0] === "." && parts.length === 2 && (parts[1] === "." || parts[1] === "")) {
|
|
6969
|
+
didSomething = true;
|
|
6970
|
+
parts.pop();
|
|
6971
|
+
}
|
|
6972
|
+
}
|
|
6973
|
+
let dd = 0;
|
|
6974
|
+
while (-1 !== (dd = parts.indexOf("..", dd + 1))) {
|
|
6975
|
+
const p = parts[dd - 1];
|
|
6976
|
+
if (p && p !== "." && p !== ".." && p !== "**") {
|
|
6977
|
+
didSomething = true;
|
|
6978
|
+
const needDot = dd === 1 && parts[dd + 1] === "**";
|
|
6979
|
+
const splin = needDot ? ["."] : [];
|
|
6980
|
+
parts.splice(dd - 1, 2, ...splin);
|
|
6981
|
+
if (parts.length === 0)
|
|
6982
|
+
parts.push("");
|
|
6983
|
+
dd -= 2;
|
|
6984
|
+
}
|
|
6985
|
+
}
|
|
6986
|
+
}
|
|
6987
|
+
} while (didSomething);
|
|
6988
|
+
return globParts;
|
|
6989
|
+
}
|
|
6990
|
+
// second phase: multi-pattern dedupes
|
|
6991
|
+
// {<pre>/*/<rest>,<pre>/<p>/<rest>} -> <pre>/*/<rest>
|
|
6992
|
+
// {<pre>/<rest>,<pre>/<rest>} -> <pre>/<rest>
|
|
6993
|
+
// {<pre>/**/<rest>,<pre>/<rest>} -> <pre>/**/<rest>
|
|
6994
|
+
//
|
|
6995
|
+
// {<pre>/**/<rest>,<pre>/**/<p>/<rest>} -> <pre>/**/<rest>
|
|
6996
|
+
// ^-- not valid because ** doens't follow symlinks
|
|
6997
|
+
secondPhasePreProcess(globParts) {
|
|
6998
|
+
for (let i = 0; i < globParts.length - 1; i++) {
|
|
6999
|
+
for (let j = i + 1; j < globParts.length; j++) {
|
|
7000
|
+
const matched = this.partsMatch(globParts[i], globParts[j], !this.preserveMultipleSlashes);
|
|
7001
|
+
if (matched) {
|
|
7002
|
+
globParts[i] = [];
|
|
7003
|
+
globParts[j] = matched;
|
|
7004
|
+
break;
|
|
7005
|
+
}
|
|
7006
|
+
}
|
|
7007
|
+
}
|
|
7008
|
+
return globParts.filter((gs) => gs.length);
|
|
7009
|
+
}
|
|
7010
|
+
partsMatch(a, b, emptyGSMatch = false) {
|
|
7011
|
+
let ai = 0;
|
|
7012
|
+
let bi = 0;
|
|
7013
|
+
let result = [];
|
|
7014
|
+
let which = "";
|
|
7015
|
+
while (ai < a.length && bi < b.length) {
|
|
7016
|
+
if (a[ai] === b[bi]) {
|
|
7017
|
+
result.push(which === "b" ? b[bi] : a[ai]);
|
|
7018
|
+
ai++;
|
|
7019
|
+
bi++;
|
|
7020
|
+
} else if (emptyGSMatch && a[ai] === "**" && b[bi] === a[ai + 1]) {
|
|
7021
|
+
result.push(a[ai]);
|
|
7022
|
+
ai++;
|
|
7023
|
+
} else if (emptyGSMatch && b[bi] === "**" && a[ai] === b[bi + 1]) {
|
|
7024
|
+
result.push(b[bi]);
|
|
7025
|
+
bi++;
|
|
7026
|
+
} else if (a[ai] === "*" && b[bi] && (this.options.dot || !b[bi].startsWith(".")) && b[bi] !== "**") {
|
|
7027
|
+
if (which === "b")
|
|
7028
|
+
return false;
|
|
7029
|
+
which = "a";
|
|
7030
|
+
result.push(a[ai]);
|
|
7031
|
+
ai++;
|
|
7032
|
+
bi++;
|
|
7033
|
+
} else if (b[bi] === "*" && a[ai] && (this.options.dot || !a[ai].startsWith(".")) && a[ai] !== "**") {
|
|
7034
|
+
if (which === "a")
|
|
7035
|
+
return false;
|
|
7036
|
+
which = "b";
|
|
7037
|
+
result.push(b[bi]);
|
|
7038
|
+
ai++;
|
|
7039
|
+
bi++;
|
|
7040
|
+
} else {
|
|
7041
|
+
return false;
|
|
7042
|
+
}
|
|
7043
|
+
}
|
|
7044
|
+
return a.length === b.length && result;
|
|
7045
|
+
}
|
|
7046
|
+
parseNegate() {
|
|
7047
|
+
if (this.nonegate)
|
|
7048
|
+
return;
|
|
7049
|
+
const pattern = this.pattern;
|
|
7050
|
+
let negate = false;
|
|
7051
|
+
let negateOffset = 0;
|
|
7052
|
+
for (let i = 0; i < pattern.length && pattern.charAt(i) === "!"; i++) {
|
|
7053
|
+
negate = !negate;
|
|
7054
|
+
negateOffset++;
|
|
7055
|
+
}
|
|
7056
|
+
if (negateOffset)
|
|
7057
|
+
this.pattern = pattern.slice(negateOffset);
|
|
7058
|
+
this.negate = negate;
|
|
7059
|
+
}
|
|
7060
|
+
// set partial to true to test if, for example,
|
|
7061
|
+
// "/a/b" matches the start of "/*/b/*/d"
|
|
7062
|
+
// Partial means, if you run out of file before you run
|
|
7063
|
+
// out of pattern, then that's fine, as long as all
|
|
7064
|
+
// the parts match.
|
|
7065
|
+
matchOne(file, pattern, partial = false) {
|
|
7066
|
+
const options = this.options;
|
|
7067
|
+
if (this.isWindows) {
|
|
7068
|
+
const fileDrive = typeof file[0] === "string" && /^[a-z]:$/i.test(file[0]);
|
|
7069
|
+
const fileUNC = !fileDrive && file[0] === "" && file[1] === "" && file[2] === "?" && /^[a-z]:$/i.test(file[3]);
|
|
7070
|
+
const patternDrive = typeof pattern[0] === "string" && /^[a-z]:$/i.test(pattern[0]);
|
|
7071
|
+
const patternUNC = !patternDrive && pattern[0] === "" && pattern[1] === "" && pattern[2] === "?" && typeof pattern[3] === "string" && /^[a-z]:$/i.test(pattern[3]);
|
|
7072
|
+
const fdi = fileUNC ? 3 : fileDrive ? 0 : void 0;
|
|
7073
|
+
const pdi = patternUNC ? 3 : patternDrive ? 0 : void 0;
|
|
7074
|
+
if (typeof fdi === "number" && typeof pdi === "number") {
|
|
7075
|
+
const [fd, pd] = [file[fdi], pattern[pdi]];
|
|
7076
|
+
if (fd.toLowerCase() === pd.toLowerCase()) {
|
|
7077
|
+
pattern[pdi] = fd;
|
|
7078
|
+
if (pdi > fdi) {
|
|
7079
|
+
pattern = pattern.slice(pdi);
|
|
7080
|
+
} else if (fdi > pdi) {
|
|
7081
|
+
file = file.slice(fdi);
|
|
7082
|
+
}
|
|
7083
|
+
}
|
|
7084
|
+
}
|
|
7085
|
+
}
|
|
7086
|
+
const { optimizationLevel = 1 } = this.options;
|
|
7087
|
+
if (optimizationLevel >= 2) {
|
|
7088
|
+
file = this.levelTwoFileOptimize(file);
|
|
7089
|
+
}
|
|
7090
|
+
this.debug("matchOne", this, { file, pattern });
|
|
7091
|
+
this.debug("matchOne", file.length, pattern.length);
|
|
7092
|
+
for (var fi = 0, pi = 0, fl = file.length, pl = pattern.length; fi < fl && pi < pl; fi++, pi++) {
|
|
7093
|
+
this.debug("matchOne loop");
|
|
7094
|
+
var p = pattern[pi];
|
|
7095
|
+
var f = file[fi];
|
|
7096
|
+
this.debug(pattern, p, f);
|
|
7097
|
+
if (p === false) {
|
|
7098
|
+
return false;
|
|
7099
|
+
}
|
|
7100
|
+
if (p === GLOBSTAR) {
|
|
7101
|
+
this.debug("GLOBSTAR", [pattern, p, f]);
|
|
7102
|
+
var fr = fi;
|
|
7103
|
+
var pr = pi + 1;
|
|
7104
|
+
if (pr === pl) {
|
|
7105
|
+
this.debug("** at the end");
|
|
7106
|
+
for (; fi < fl; fi++) {
|
|
7107
|
+
if (file[fi] === "." || file[fi] === ".." || !options.dot && file[fi].charAt(0) === ".")
|
|
7108
|
+
return false;
|
|
7109
|
+
}
|
|
7110
|
+
return true;
|
|
7111
|
+
}
|
|
7112
|
+
while (fr < fl) {
|
|
7113
|
+
var swallowee = file[fr];
|
|
7114
|
+
this.debug("\nglobstar while", file, fr, pattern, pr, swallowee);
|
|
7115
|
+
if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) {
|
|
7116
|
+
this.debug("globstar found match!", fr, fl, swallowee);
|
|
7117
|
+
return true;
|
|
7118
|
+
} else {
|
|
7119
|
+
if (swallowee === "." || swallowee === ".." || !options.dot && swallowee.charAt(0) === ".") {
|
|
7120
|
+
this.debug("dot detected!", file, fr, pattern, pr);
|
|
7121
|
+
break;
|
|
7122
|
+
}
|
|
7123
|
+
this.debug("globstar swallow a segment, and continue");
|
|
7124
|
+
fr++;
|
|
7125
|
+
}
|
|
7126
|
+
}
|
|
7127
|
+
if (partial) {
|
|
7128
|
+
this.debug("\n>>> no match, partial?", file, fr, pattern, pr);
|
|
7129
|
+
if (fr === fl) {
|
|
7130
|
+
return true;
|
|
7131
|
+
}
|
|
7132
|
+
}
|
|
7133
|
+
return false;
|
|
7134
|
+
}
|
|
7135
|
+
let hit;
|
|
7136
|
+
if (typeof p === "string") {
|
|
7137
|
+
hit = f === p;
|
|
7138
|
+
this.debug("string match", p, f, hit);
|
|
7139
|
+
} else {
|
|
7140
|
+
hit = p.test(f);
|
|
7141
|
+
this.debug("pattern match", p, f, hit);
|
|
7142
|
+
}
|
|
7143
|
+
if (!hit)
|
|
7144
|
+
return false;
|
|
7145
|
+
}
|
|
7146
|
+
if (fi === fl && pi === pl) {
|
|
7147
|
+
return true;
|
|
7148
|
+
} else if (fi === fl) {
|
|
7149
|
+
return partial;
|
|
7150
|
+
} else if (pi === pl) {
|
|
7151
|
+
return fi === fl - 1 && file[fi] === "";
|
|
7152
|
+
} else {
|
|
7153
|
+
throw new Error("wtf?");
|
|
7154
|
+
}
|
|
7155
|
+
}
|
|
7156
|
+
braceExpand() {
|
|
7157
|
+
return braceExpand(this.pattern, this.options);
|
|
7158
|
+
}
|
|
7159
|
+
parse(pattern) {
|
|
7160
|
+
assertValidPattern(pattern);
|
|
7161
|
+
const options = this.options;
|
|
7162
|
+
if (pattern === "**")
|
|
7163
|
+
return GLOBSTAR;
|
|
7164
|
+
if (pattern === "")
|
|
7165
|
+
return "";
|
|
7166
|
+
let m;
|
|
7167
|
+
let fastTest = null;
|
|
7168
|
+
if (m = pattern.match(starRE)) {
|
|
7169
|
+
fastTest = options.dot ? starTestDot : starTest;
|
|
7170
|
+
} else if (m = pattern.match(starDotExtRE)) {
|
|
7171
|
+
fastTest = (options.nocase ? options.dot ? starDotExtTestNocaseDot : starDotExtTestNocase : options.dot ? starDotExtTestDot : starDotExtTest)(m[1]);
|
|
7172
|
+
} else if (m = pattern.match(qmarksRE)) {
|
|
7173
|
+
fastTest = (options.nocase ? options.dot ? qmarksTestNocaseDot : qmarksTestNocase : options.dot ? qmarksTestDot : qmarksTest)(m);
|
|
7174
|
+
} else if (m = pattern.match(starDotStarRE)) {
|
|
7175
|
+
fastTest = options.dot ? starDotStarTestDot : starDotStarTest;
|
|
7176
|
+
} else if (m = pattern.match(dotStarRE)) {
|
|
7177
|
+
fastTest = dotStarTest;
|
|
7178
|
+
}
|
|
7179
|
+
const re = AST.fromGlob(pattern, this.options).toMMPattern();
|
|
7180
|
+
if (fastTest && typeof re === "object") {
|
|
7181
|
+
Reflect.defineProperty(re, "test", { value: fastTest });
|
|
7182
|
+
}
|
|
7183
|
+
return re;
|
|
7184
|
+
}
|
|
7185
|
+
makeRe() {
|
|
7186
|
+
if (this.regexp || this.regexp === false)
|
|
7187
|
+
return this.regexp;
|
|
7188
|
+
const set = this.set;
|
|
7189
|
+
if (!set.length) {
|
|
7190
|
+
this.regexp = false;
|
|
7191
|
+
return this.regexp;
|
|
7192
|
+
}
|
|
7193
|
+
const options = this.options;
|
|
7194
|
+
const twoStar = options.noglobstar ? star2 : options.dot ? twoStarDot : twoStarNoDot;
|
|
7195
|
+
const flags = new Set(options.nocase ? ["i"] : []);
|
|
7196
|
+
let re = set.map((pattern) => {
|
|
7197
|
+
const pp = pattern.map((p) => {
|
|
7198
|
+
if (p instanceof RegExp) {
|
|
7199
|
+
for (const f of p.flags.split(""))
|
|
7200
|
+
flags.add(f);
|
|
7201
|
+
}
|
|
7202
|
+
return typeof p === "string" ? regExpEscape2(p) : p === GLOBSTAR ? GLOBSTAR : p._src;
|
|
7203
|
+
});
|
|
7204
|
+
pp.forEach((p, i) => {
|
|
7205
|
+
const next = pp[i + 1];
|
|
7206
|
+
const prev = pp[i - 1];
|
|
7207
|
+
if (p !== GLOBSTAR || prev === GLOBSTAR) {
|
|
7208
|
+
return;
|
|
7209
|
+
}
|
|
7210
|
+
if (prev === void 0) {
|
|
7211
|
+
if (next !== void 0 && next !== GLOBSTAR) {
|
|
7212
|
+
pp[i + 1] = "(?:\\/|" + twoStar + "\\/)?" + next;
|
|
7213
|
+
} else {
|
|
7214
|
+
pp[i] = twoStar;
|
|
7215
|
+
}
|
|
7216
|
+
} else if (next === void 0) {
|
|
7217
|
+
pp[i - 1] = prev + "(?:\\/|" + twoStar + ")?";
|
|
7218
|
+
} else if (next !== GLOBSTAR) {
|
|
7219
|
+
pp[i - 1] = prev + "(?:\\/|\\/" + twoStar + "\\/)" + next;
|
|
7220
|
+
pp[i + 1] = GLOBSTAR;
|
|
7221
|
+
}
|
|
7222
|
+
});
|
|
7223
|
+
return pp.filter((p) => p !== GLOBSTAR).join("/");
|
|
7224
|
+
}).join("|");
|
|
7225
|
+
const [open, close] = set.length > 1 ? ["(?:", ")"] : ["", ""];
|
|
7226
|
+
re = "^" + open + re + close + "$";
|
|
7227
|
+
if (this.negate)
|
|
7228
|
+
re = "^(?!" + re + ").+$";
|
|
7229
|
+
try {
|
|
7230
|
+
this.regexp = new RegExp(re, [...flags].join(""));
|
|
7231
|
+
} catch (ex) {
|
|
7232
|
+
this.regexp = false;
|
|
7233
|
+
}
|
|
7234
|
+
return this.regexp;
|
|
7235
|
+
}
|
|
7236
|
+
slashSplit(p) {
|
|
7237
|
+
if (this.preserveMultipleSlashes) {
|
|
7238
|
+
return p.split("/");
|
|
7239
|
+
} else if (this.isWindows && /^\/\/[^\/]+/.test(p)) {
|
|
7240
|
+
return ["", ...p.split(/\/+/)];
|
|
7241
|
+
} else {
|
|
7242
|
+
return p.split(/\/+/);
|
|
7243
|
+
}
|
|
7244
|
+
}
|
|
7245
|
+
match(f, partial = this.partial) {
|
|
7246
|
+
this.debug("match", f, this.pattern);
|
|
7247
|
+
if (this.comment) {
|
|
7248
|
+
return false;
|
|
7249
|
+
}
|
|
7250
|
+
if (this.empty) {
|
|
7251
|
+
return f === "";
|
|
7252
|
+
}
|
|
7253
|
+
if (f === "/" && partial) {
|
|
7254
|
+
return true;
|
|
7255
|
+
}
|
|
7256
|
+
const options = this.options;
|
|
7257
|
+
if (this.isWindows) {
|
|
7258
|
+
f = f.split("\\").join("/");
|
|
7259
|
+
}
|
|
7260
|
+
const ff = this.slashSplit(f);
|
|
7261
|
+
this.debug(this.pattern, "split", ff);
|
|
7262
|
+
const set = this.set;
|
|
7263
|
+
this.debug(this.pattern, "set", set);
|
|
7264
|
+
let filename = ff[ff.length - 1];
|
|
7265
|
+
if (!filename) {
|
|
7266
|
+
for (let i = ff.length - 2; !filename && i >= 0; i--) {
|
|
7267
|
+
filename = ff[i];
|
|
7268
|
+
}
|
|
7269
|
+
}
|
|
7270
|
+
for (let i = 0; i < set.length; i++) {
|
|
7271
|
+
const pattern = set[i];
|
|
7272
|
+
let file = ff;
|
|
7273
|
+
if (options.matchBase && pattern.length === 1) {
|
|
7274
|
+
file = [filename];
|
|
7275
|
+
}
|
|
7276
|
+
const hit = this.matchOne(file, pattern, partial);
|
|
7277
|
+
if (hit) {
|
|
7278
|
+
if (options.flipNegate) {
|
|
7279
|
+
return true;
|
|
7280
|
+
}
|
|
7281
|
+
return !this.negate;
|
|
7282
|
+
}
|
|
7283
|
+
}
|
|
7284
|
+
if (options.flipNegate) {
|
|
7285
|
+
return false;
|
|
7286
|
+
}
|
|
7287
|
+
return this.negate;
|
|
7288
|
+
}
|
|
7289
|
+
static defaults(def) {
|
|
7290
|
+
return minimatch.defaults(def).Minimatch;
|
|
7291
|
+
}
|
|
7292
|
+
};
|
|
7293
|
+
minimatch.AST = AST;
|
|
7294
|
+
minimatch.Minimatch = Minimatch;
|
|
7295
|
+
minimatch.escape = escape3;
|
|
7296
|
+
minimatch.unescape = unescape2;
|
|
7297
|
+
|
|
7298
|
+
// ../../node_modules/.pnpm/webdav@5.8.0/node_modules/webdav/dist/node/tools/dav.js
|
|
7299
|
+
var import_path_posix2 = __toESM(require_path_posix(), 1);
|
|
7300
|
+
var import_fast_xml_parser = __toESM(require_fxp(), 1);
|
|
7301
|
+
var import_nested_property = __toESM(require_nested_property(), 1);
|
|
7302
|
+
var PropertyType;
|
|
7303
|
+
(function(PropertyType2) {
|
|
7304
|
+
PropertyType2["Array"] = "array";
|
|
7305
|
+
PropertyType2["Object"] = "object";
|
|
7306
|
+
PropertyType2["Original"] = "original";
|
|
7307
|
+
})(PropertyType || (PropertyType = {}));
|
|
7308
|
+
|
|
7309
|
+
// ../../node_modules/.pnpm/webdav@5.8.0/node_modules/webdav/dist/node/operations/directoryContents.js
|
|
7310
|
+
var import_path_posix3 = __toESM(require_path_posix(), 1);
|
|
7311
|
+
|
|
7312
|
+
// ../../node_modules/.pnpm/webdav@5.8.0/node_modules/webdav/dist/node/operations/lock.js
|
|
7313
|
+
var import_nested_property2 = __toESM(require_nested_property(), 1);
|
|
7314
|
+
|
|
7315
|
+
// ../../node_modules/.pnpm/webdav@5.8.0/node_modules/webdav/dist/node/tools/xml.js
|
|
7316
|
+
var import_fast_xml_parser2 = __toESM(require_fxp(), 1);
|
|
7317
|
+
|
|
7318
|
+
// ../../node_modules/.pnpm/webdav@5.8.0/node_modules/webdav/dist/node/tools/size.js
|
|
7319
|
+
var import_byte_length = __toESM(require_dist(), 1);
|
|
7320
|
+
|
|
2709
7321
|
// ../core/dist/index.js
|
|
2710
7322
|
var VERSION = package_default.version;
|
|
2711
7323
|
|
|
@@ -2735,13 +7347,13 @@ function formatProviderTable(providers, currentId) {
|
|
|
2735
7347
|
}
|
|
2736
7348
|
|
|
2737
7349
|
// src/interactive.ts
|
|
2738
|
-
async function promptProviderForm(
|
|
7350
|
+
async function promptProviderForm(defaults2) {
|
|
2739
7351
|
const answers = await import_inquirer.default.prompt([
|
|
2740
7352
|
{
|
|
2741
7353
|
type: "input",
|
|
2742
7354
|
name: "name",
|
|
2743
7355
|
message: "\u670D\u52A1\u5546\u540D\u79F0:",
|
|
2744
|
-
default:
|
|
7356
|
+
default: defaults2?.name || void 0,
|
|
2745
7357
|
validate: (value) => {
|
|
2746
7358
|
if (!value) return "\u540D\u79F0\u4E0D\u80FD\u4E3A\u7A7A";
|
|
2747
7359
|
return true;
|
|
@@ -2751,7 +7363,7 @@ async function promptProviderForm(defaults) {
|
|
|
2751
7363
|
type: "input",
|
|
2752
7364
|
name: "baseUrl",
|
|
2753
7365
|
message: "API \u5730\u5740:",
|
|
2754
|
-
default:
|
|
7366
|
+
default: defaults2?.baseUrl || void 0,
|
|
2755
7367
|
validate: (value) => {
|
|
2756
7368
|
if (!value) return "API \u5730\u5740\u4E0D\u80FD\u4E3A\u7A7A";
|
|
2757
7369
|
if (!value.startsWith("http://") && !value.startsWith("https://")) {
|
|
@@ -2764,7 +7376,7 @@ async function promptProviderForm(defaults) {
|
|
|
2764
7376
|
type: "password",
|
|
2765
7377
|
name: "apiKey",
|
|
2766
7378
|
message: "API \u5BC6\u94A5:",
|
|
2767
|
-
default:
|
|
7379
|
+
default: defaults2?.apiKey || void 0,
|
|
2768
7380
|
mask: "*",
|
|
2769
7381
|
validate: (value) => {
|
|
2770
7382
|
if (!value) return "API \u5BC6\u94A5\u4E0D\u80FD\u4E3A\u7A7A";
|
|
@@ -4139,3 +8751,25 @@ cc.action(async () => {
|
|
|
4139
8751
|
program.parse(process.argv);
|
|
4140
8752
|
}
|
|
4141
8753
|
})();
|
|
8754
|
+
/*! Bundled license information:
|
|
8755
|
+
|
|
8756
|
+
is-buffer/index.js:
|
|
8757
|
+
(*!
|
|
8758
|
+
* Determine if an object is a Buffer
|
|
8759
|
+
*
|
|
8760
|
+
* @author Feross Aboukhadijeh <https://feross.org>
|
|
8761
|
+
* @license MIT
|
|
8762
|
+
*)
|
|
8763
|
+
|
|
8764
|
+
base-64/base64.js:
|
|
8765
|
+
(*! https://mths.be/base64 v1.0.0 by @mathias | MIT license *)
|
|
8766
|
+
|
|
8767
|
+
nested-property/dist/nested-property.js:
|
|
8768
|
+
(**
|
|
8769
|
+
* @license nested-property https://github.com/cosmosio/nested-property
|
|
8770
|
+
*
|
|
8771
|
+
* The MIT License (MIT)
|
|
8772
|
+
*
|
|
8773
|
+
* Copyright (c) 2014-2020 Olivier Scherrer <pode.fr@gmail.com>
|
|
8774
|
+
*)
|
|
8775
|
+
*/
|