@abaplint/transpiler-cli 2.14.18 → 2.14.20
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/README.md +2 -1
- package/build/bundle.js +1545 -80
- package/package.json +6 -6
package/build/bundle.js
CHANGED
|
@@ -1091,6 +1091,8 @@ exports.collectObjectFiles = collectObjectFiles;
|
|
|
1091
1091
|
const path = __importStar(__webpack_require__(/*! path */ "path"));
|
|
1092
1092
|
const url_1 = __webpack_require__(/*! url */ "url");
|
|
1093
1093
|
const transpiler_1 = __webpack_require__(/*! @abaplint/transpiler */ "./node_modules/@abaplint/transpiler/build/src/index.js");
|
|
1094
|
+
/** the exported function of a program module running the program, see HandleABAP in the transpiler */
|
|
1095
|
+
const PROGRAM_MAIN = "$main";
|
|
1094
1096
|
function collectObjectFiles(outputFiles, config, files) {
|
|
1095
1097
|
const root = path.resolve(config.output_folder);
|
|
1096
1098
|
const filesToWrite = [];
|
|
@@ -1105,6 +1107,11 @@ function collectObjectFiles(outputFiles, config, files) {
|
|
|
1105
1107
|
if (type === "PROG") {
|
|
1106
1108
|
contents = 'if (!globalThis.abap) await import("' + (0, transpiler_1.importPath)(output.filename, "_init.mjs") + '");\n' + contents;
|
|
1107
1109
|
generatedLineOffset = 1;
|
|
1110
|
+
if (output.exports.includes(PROGRAM_MAIN)) {
|
|
1111
|
+
// run the program when executed directly, "node zapp.prog.mjs", not when imported eg. for unit testing
|
|
1112
|
+
contents += "\nif (process.argv[1] !== undefined"
|
|
1113
|
+
+ ` && import.meta.url === (await import("url")).pathToFileURL(process.argv[1]).href) await ${PROGRAM_MAIN}();`;
|
|
1114
|
+
}
|
|
1108
1115
|
}
|
|
1109
1116
|
if (config.write_source_map === true && (type === "PROG" || type === "FUGR" || type === "CLAS")) {
|
|
1110
1117
|
const name = output.filename + ".map";
|
|
@@ -9921,7 +9928,7 @@ class SQLFromSource extends combi_1.Expression {
|
|
|
9921
9928
|
const privileged = (0, combi_1.ver)(version_1.Release.v752, (0, combi_1.seq)("WITH", _1.SQLPrivilegedAccess));
|
|
9922
9929
|
const providedBy = (0, combi_1.optPrio)((0, combi_1.ver)(version_1.Release.v796, _1.SQLProvidedBy));
|
|
9923
9930
|
const exposeClient = (0, combi_1.optPrio)((0, combi_1.ver)(version_1.Release.v913, _1.SQLExposeClientAs));
|
|
9924
|
-
const pathForEntity = (0, combi_1.optPrio)((0, combi_1.verNotLang)(version_1.LanguageVersion.KeyUser, new sql_path_for_entity_1.SQLPathForEntity()));
|
|
9931
|
+
const pathForEntity = (0, combi_1.optPrio)((0, combi_1.verNotLang)(version_1.LanguageVersion.KeyUser, new sql_path_for_entity_1.SQLPathForEntity(false)));
|
|
9925
9932
|
return (0, combi_1.seq)((0, combi_1.altPrio)(new sql_hierarchy_aggregate_1.SQLHierarchyAggregate(), new sql_hierarchy_accessor_1.SQLHierarchyAccessor(), new sql_hierarchy_source_1.SQLHierarchySource(), (0, combi_1.seq)(with_name_1.WithName, pathForEntity), (0, combi_1.seq)(new _1.DatabaseTable(true), (0, combi_1.optPrio)(_1.SQLCDSParameters), pathForEntity), tab), providedBy, (0, combi_1.optPrio)(privileged), (0, combi_1.optPrio)(aas), exposeClient);
|
|
9926
9933
|
}
|
|
9927
9934
|
}
|
|
@@ -11067,9 +11074,19 @@ const database_table_1 = __webpack_require__(/*! ./database_table */ "./node_mod
|
|
|
11067
11074
|
const sql_cte_path_prefix_1 = __webpack_require__(/*! ./sql_cte_path_prefix */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/sql_cte_path_prefix.js");
|
|
11068
11075
|
const version_1 = __webpack_require__(/*! ../../../version */ "./node_modules/@abaplint/core/build/src/version.js");
|
|
11069
11076
|
class SQLPathForEntity extends combi_1.Expression {
|
|
11077
|
+
/** withPrefix = false when the entity name is already parsed by the caller, eg. in SQLFromSource,
|
|
11078
|
+
* otherwise the prefix would match a following keyword */
|
|
11079
|
+
constructor(withPrefix = true) {
|
|
11080
|
+
super();
|
|
11081
|
+
this.withPrefix = withPrefix;
|
|
11082
|
+
}
|
|
11070
11083
|
getRunnable() {
|
|
11084
|
+
const segments = (0, combi_1.plus)(new sql_path_segment_1.SQLPathSegment());
|
|
11085
|
+
if (this.withPrefix === false) {
|
|
11086
|
+
return (0, combi_1.ver)(version_1.Release.v740sp05, segments);
|
|
11087
|
+
}
|
|
11071
11088
|
const prefix = (0, combi_1.altPrio)(new sql_cte_path_prefix_1.SQLCTEPathPrefix(), new database_table_1.DatabaseTable());
|
|
11072
|
-
return (0, combi_1.ver)(version_1.Release.v740sp05, (0, combi_1.seq)((0, combi_1.optPrio)(prefix),
|
|
11089
|
+
return (0, combi_1.ver)(version_1.Release.v740sp05, (0, combi_1.seq)((0, combi_1.optPrio)(prefix), segments));
|
|
11073
11090
|
}
|
|
11074
11091
|
}
|
|
11075
11092
|
exports.SQLPathForEntity = SQLPathForEntity;
|
|
@@ -11661,7 +11678,8 @@ class StringTemplateFormatting extends combi_1.Expression {
|
|
|
11661
11678
|
const alpha = (0, combi_1.ver)(version_1.Release.v740sp02, (0, combi_1.seq)("ALPHA =", alphaOptions), { also: combi_1.AlsoIn.OpenABAP });
|
|
11662
11679
|
const xsd = (0, combi_1.ver)(version_1.Release.v740sp02, (0, combi_1.seq)("XSD =", zeroXSDOptions));
|
|
11663
11680
|
const country = (0, combi_1.seq)("COUNTRY =", _1.Source);
|
|
11664
|
-
const
|
|
11681
|
+
const currency = (0, combi_1.seq)("CURRENCY =", _1.Source);
|
|
11682
|
+
const formatting = (0, combi_1.altPrio)((0, combi_1.seq)("TIME =", dateTimeOptions), (0, combi_1.seq)("DATE =", dateTimeOptions), (0, combi_1.seq)("CASE =", caseOptions), (0, combi_1.seq)("ZERO =", zeroXSDOptions), xsd, (0, combi_1.seq)("STYLE =", styleOptions), (0, combi_1.per)(sign, number, decimals, width, pad, alpha, align, country, currency, (0, combi_1.seq)("EXPONENT =", _1.Source)), (0, combi_1.per)(timezone, timestamp));
|
|
11665
11683
|
return formatting;
|
|
11666
11684
|
}
|
|
11667
11685
|
}
|
|
@@ -12156,7 +12174,7 @@ const _derived_types_1 = __webpack_require__(/*! ./_derived_types */ "./node_mod
|
|
|
12156
12174
|
class TypeStructure extends combi_1.Expression {
|
|
12157
12175
|
getRunnable() {
|
|
12158
12176
|
const entity = (0, combi_1.alt)(_1.TypeName, _1.EntityAssociation);
|
|
12159
|
-
const derivedTypes = (0, _derived_types_1.derivedTypesAlt)((0, combi_1.ver)(version_1.Release.v779, (0, combi_1.seq)("FUNCTION REQUEST", entity), { also: combi_1.AlsoIn.OpenABAP }), (0, combi_1.ver)(version_1.Release.v779, (0, combi_1.seq)("ACTION REQUEST", entity), { also: combi_1.AlsoIn.OpenABAP }), (0, combi_1.seq)("ACTION IMPORT", _1.Source), (0, combi_1.ver)(version_1.Release.v781, (0, combi_1.seq)("GLOBAL AUTHORIZATION REQUEST", entity), { also: combi_1.AlsoIn.OpenABAP }), (0, combi_1.ver)(version_1.Release.v781, (0, combi_1.seq)("GLOBAL AUTHORIZATION RESULT", entity), { also: combi_1.AlsoIn.OpenABAP }), (0, combi_1.ver)(version_1.Release.v781, (0, combi_1.seq)("GLOBAL FEATURES REQUEST", entity), { also: combi_1.AlsoIn.OpenABAP }), (0, combi_1.ver)(version_1.Release.v781, (0, combi_1.seq)("GLOBAL FEATURES RESULT", entity), { also: combi_1.AlsoIn.OpenABAP }), (0, combi_1.ver)(version_1.Release.v780, (0, combi_1.seq)("AUTHORIZATION REQUEST", entity), { also: combi_1.AlsoIn.OpenABAP }), (0, combi_1.ver)(version_1.Release.v776, (0, combi_1.seq)("FEATURES REQUEST", entity), { also: combi_1.AlsoIn.OpenABAP }), (0, combi_1.seq)("PERMISSIONS REQUEST",
|
|
12177
|
+
const derivedTypes = (0, _derived_types_1.derivedTypesAlt)((0, combi_1.ver)(version_1.Release.v779, (0, combi_1.seq)("FUNCTION REQUEST", entity), { also: combi_1.AlsoIn.OpenABAP }), (0, combi_1.ver)(version_1.Release.v779, (0, combi_1.seq)("ACTION REQUEST", entity), { also: combi_1.AlsoIn.OpenABAP }), (0, combi_1.seq)("ACTION IMPORT", _1.Source), (0, combi_1.ver)(version_1.Release.v781, (0, combi_1.seq)("GLOBAL AUTHORIZATION REQUEST", entity), { also: combi_1.AlsoIn.OpenABAP }), (0, combi_1.ver)(version_1.Release.v781, (0, combi_1.seq)("GLOBAL AUTHORIZATION RESULT", entity), { also: combi_1.AlsoIn.OpenABAP }), (0, combi_1.ver)(version_1.Release.v781, (0, combi_1.seq)("GLOBAL FEATURES REQUEST", entity), { also: combi_1.AlsoIn.OpenABAP }), (0, combi_1.ver)(version_1.Release.v781, (0, combi_1.seq)("GLOBAL FEATURES RESULT", entity), { also: combi_1.AlsoIn.OpenABAP }), (0, combi_1.ver)(version_1.Release.v780, (0, combi_1.seq)("AUTHORIZATION REQUEST", entity), { also: combi_1.AlsoIn.OpenABAP }), (0, combi_1.ver)(version_1.Release.v776, (0, combi_1.seq)("FEATURES REQUEST", entity), { also: combi_1.AlsoIn.OpenABAP }), (0, combi_1.seq)("PERMISSIONS REQUEST", entity), (0, combi_1.ver)(version_1.Release.v780, (0, combi_1.seq)("PERMISSIONS RESULT", entity), { also: combi_1.AlsoIn.OpenABAP }), (0, combi_1.seq)("READ LINK", _1.EntityAssociation), (0, combi_1.seq)("HIERARCHY", _1.NamespaceSimpleName), (0, combi_1.seq)("EVENT", _1.EventName));
|
|
12160
12178
|
const structure = (0, combi_1.ver)(version_1.Release.v774, (0, combi_1.seq)("STRUCTURE FOR", derivedTypes), { also: combi_1.AlsoIn.OpenABAP });
|
|
12161
12179
|
const response = (0, combi_1.ver)(version_1.Release.v776, (0, combi_1.seq)("RESPONSE FOR", (0, combi_1.altPrio)((0, combi_1.seq)("FAILED EARLY", _1.NamespaceSimpleName), (0, combi_1.seq)("FAILED LATE", _1.NamespaceSimpleName), (0, combi_1.seq)("FAILED", _1.NamespaceSimpleName), (0, combi_1.seq)("MAPPED EARLY", _1.NamespaceSimpleName), (0, combi_1.seq)("MAPPED LATE", _1.NamespaceSimpleName), (0, combi_1.seq)("MAPPED", _1.NamespaceSimpleName), (0, combi_1.seq)("REPORTED EARLY", _1.NamespaceSimpleName), (0, combi_1.seq)("REPORTED LATE", _1.NamespaceSimpleName), (0, combi_1.seq)("REPORTED", _1.NamespaceSimpleName))), { also: combi_1.AlsoIn.OpenABAP });
|
|
12162
12180
|
const request = (0, combi_1.ver)(version_1.Release.v778, (0, combi_1.seq)("REQUEST FOR", (0, combi_1.alt)("CHANGE", "DELETE"), _1.NamespaceSimpleName), { also: combi_1.AlsoIn.OpenABAP });
|
|
@@ -16685,9 +16703,13 @@ const expressions_1 = __webpack_require__(/*! ../expressions */ "./node_modules/
|
|
|
16685
16703
|
const version_1 = __webpack_require__(/*! ../../../version */ "./node_modules/@abaplint/core/build/src/version.js");
|
|
16686
16704
|
class GetPermissions {
|
|
16687
16705
|
getMatcher() {
|
|
16688
|
-
const
|
|
16689
|
-
const
|
|
16690
|
-
const
|
|
16706
|
+
const aspect = (0, combi_1.altPrio)("FEATURES", "AUTHORIZATION");
|
|
16707
|
+
const only = (0, combi_1.seq)("ONLY", (0, combi_1.altPrio)((0, combi_1.seq)("GLOBAL", (0, combi_1.optPrio)(aspect)), (0, combi_1.seq)("INSTANCE", (0, combi_1.optPrio)(aspect)), aspect, expressions_1.Dynamic));
|
|
16708
|
+
const query = (0, combi_1.seq)("ENTITY", (0, combi_1.alt)(expressions_1.NamespaceSimpleName, expressions_1.EntityAssociation), (0, combi_1.optPrio)((0, combi_1.seq)("FROM", expressions_1.Source)), "REQUEST", expressions_1.Source, "RESULT", expressions_1.Target);
|
|
16709
|
+
const long = (0, combi_1.seq)("OF", expressions_1.NamespaceSimpleName, (0, combi_1.plus)(query));
|
|
16710
|
+
const operations = (0, combi_1.seq)("OPERATIONS", expressions_1.Source);
|
|
16711
|
+
const response = (0, combi_1.optPrio)((0, combi_1.per)((0, combi_1.seq)("FAILED", expressions_1.Target), (0, combi_1.seq)("REPORTED", expressions_1.Target)));
|
|
16712
|
+
const s = (0, combi_1.seq)("GET PERMISSIONS", (0, combi_1.optPrio)((0, combi_1.seq)((0, combi_1.opt)("FORWARDING"), "PRIVILEGED")), (0, combi_1.optPrio)(only), (0, combi_1.altPrio)(long, operations, query), response);
|
|
16691
16713
|
return (0, combi_1.ver)(version_1.Release.v754, s, { also: combi_1.AlsoIn.OpenABAP });
|
|
16692
16714
|
}
|
|
16693
16715
|
}
|
|
@@ -26248,14 +26270,14 @@ class BuiltIn {
|
|
|
26248
26270
|
BuiltIn.getCache.push(this.buildConstant("abap_undefined", new basic_1.CharacterType(1, { qualifiedName: "ABAP_BOOL", ddicName: "ABAP_BOOL" }), "'-'"));
|
|
26249
26271
|
BuiltIn.getCache.push(this.buildConstant("abap_off", new basic_1.CharacterType(1, { qualifiedName: "ABAP_BOOL", ddicName: "ABAP_BOOL" }), "' '"));
|
|
26250
26272
|
BuiltIn.getCache.push(this.buildConstant("abap_on", new basic_1.CharacterType(1, { qualifiedName: "ABAP_BOOL", ddicName: "ABAP_BOOL" }), "'X'"));
|
|
26251
|
-
BuiltIn.getCache.push(this.buildConstant("col_background", basic_1.
|
|
26252
|
-
BuiltIn.getCache.push(this.buildConstant("col_heading", basic_1.
|
|
26253
|
-
BuiltIn.getCache.push(this.buildConstant("col_key", basic_1.
|
|
26254
|
-
BuiltIn.getCache.push(this.buildConstant("col_negative", basic_1.
|
|
26255
|
-
BuiltIn.getCache.push(this.buildConstant("col_group", basic_1.
|
|
26256
|
-
BuiltIn.getCache.push(this.buildConstant("col_normal", basic_1.
|
|
26257
|
-
BuiltIn.getCache.push(this.buildConstant("col_positive", basic_1.
|
|
26258
|
-
BuiltIn.getCache.push(this.buildConstant("col_total", basic_1.
|
|
26273
|
+
BuiltIn.getCache.push(this.buildConstant("col_background", new basic_1.CharacterType(1), "'0'"));
|
|
26274
|
+
BuiltIn.getCache.push(this.buildConstant("col_heading", new basic_1.CharacterType(1), "'1'"));
|
|
26275
|
+
BuiltIn.getCache.push(this.buildConstant("col_key", new basic_1.CharacterType(1), "'4'"));
|
|
26276
|
+
BuiltIn.getCache.push(this.buildConstant("col_negative", new basic_1.CharacterType(1), "'6'"));
|
|
26277
|
+
BuiltIn.getCache.push(this.buildConstant("col_group", new basic_1.CharacterType(1), "'7'"));
|
|
26278
|
+
BuiltIn.getCache.push(this.buildConstant("col_normal", new basic_1.CharacterType(1), "'2'"));
|
|
26279
|
+
BuiltIn.getCache.push(this.buildConstant("col_positive", new basic_1.CharacterType(1), "'5'"));
|
|
26280
|
+
BuiltIn.getCache.push(this.buildConstant("col_total", new basic_1.CharacterType(1), "'3'"));
|
|
26259
26281
|
BuiltIn.getCache.push(this.buildConstant("space", new basic_1.CharacterType(1, { derivedFromConstant: true }), "' '"));
|
|
26260
26282
|
}
|
|
26261
26283
|
ret.push(...BuiltIn.getCache);
|
|
@@ -29028,6 +29050,280 @@ var ScopeType;
|
|
|
29028
29050
|
|
|
29029
29051
|
/***/ },
|
|
29030
29052
|
|
|
29053
|
+
/***/ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_sorted_key_write.js"
|
|
29054
|
+
/*!**********************************************************************************!*\
|
|
29055
|
+
!*** ./node_modules/@abaplint/core/build/src/abap/5_syntax/_sorted_key_write.js ***!
|
|
29056
|
+
\**********************************************************************************/
|
|
29057
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
29058
|
+
|
|
29059
|
+
"use strict";
|
|
29060
|
+
|
|
29061
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
29062
|
+
if (k2 === undefined) k2 = k;
|
|
29063
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
29064
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
29065
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
29066
|
+
}
|
|
29067
|
+
Object.defineProperty(o, k2, desc);
|
|
29068
|
+
}) : (function(o, m, k, k2) {
|
|
29069
|
+
if (k2 === undefined) k2 = k;
|
|
29070
|
+
o[k2] = m[k];
|
|
29071
|
+
}));
|
|
29072
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
29073
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
29074
|
+
}) : function(o, v) {
|
|
29075
|
+
o["default"] = v;
|
|
29076
|
+
});
|
|
29077
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
29078
|
+
var ownKeys = function(o) {
|
|
29079
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
29080
|
+
var ar = [];
|
|
29081
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
29082
|
+
return ar;
|
|
29083
|
+
};
|
|
29084
|
+
return ownKeys(o);
|
|
29085
|
+
};
|
|
29086
|
+
return function (mod) {
|
|
29087
|
+
if (mod && mod.__esModule) return mod;
|
|
29088
|
+
var result = {};
|
|
29089
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
29090
|
+
__setModuleDefault(result, mod);
|
|
29091
|
+
return result;
|
|
29092
|
+
};
|
|
29093
|
+
})();
|
|
29094
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
29095
|
+
exports.SortedKeyWrite = void 0;
|
|
29096
|
+
const Expressions = __importStar(__webpack_require__(/*! ../2_statements/expressions */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js"));
|
|
29097
|
+
const Statements = __importStar(__webpack_require__(/*! ../2_statements/statements */ "./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js"));
|
|
29098
|
+
const Structures = __importStar(__webpack_require__(/*! ../3_structures/structures */ "./node_modules/@abaplint/core/build/src/abap/3_structures/structures/index.js"));
|
|
29099
|
+
const tokens_1 = __webpack_require__(/*! ../1_lexer/tokens */ "./node_modules/@abaplint/core/build/src/abap/1_lexer/tokens/index.js");
|
|
29100
|
+
const basic_1 = __webpack_require__(/*! ../types/basic */ "./node_modules/@abaplint/core/build/src/abap/types/basic/index.js");
|
|
29101
|
+
const _object_oriented_1 = __webpack_require__(/*! ./_object_oriented */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_object_oriented.js");
|
|
29102
|
+
const _syntax_input_1 = __webpack_require__(/*! ./_syntax_input */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_syntax_input.js");
|
|
29103
|
+
/** The key components of the primary key of a sorted or hashed table line are write-protected,
|
|
29104
|
+
* "write accesses to key fields using a field symbol or a data reference produce a syntax error if
|
|
29105
|
+
* this is known statically, otherwise a runtime error", see the ABAP keyword documentation for LOOP AT itab
|
|
29106
|
+
* and READ TABLE, result.
|
|
29107
|
+
* Only conservative cases are handled: a field symbol or data reference local to the method, form or function
|
|
29108
|
+
* module, bound by LOOP AT or READ TABLE ... ASSIGNING / REFERENCE INTO a table named by a plain chain of
|
|
29109
|
+
* names, components and attributes, and written by an assignment or CLEAR. The binding of a LOOP ends with the LOOP,
|
|
29110
|
+
* any other assignment of the field symbol or reference ends it as well. */
|
|
29111
|
+
class SortedKeyWrite {
|
|
29112
|
+
constructor() {
|
|
29113
|
+
this.bindings = new Map();
|
|
29114
|
+
this.procedure = undefined;
|
|
29115
|
+
}
|
|
29116
|
+
enter(node, filename) {
|
|
29117
|
+
if (SortedKeyWrite.isProcedure(node)) {
|
|
29118
|
+
this.bindings.clear();
|
|
29119
|
+
this.procedure = { filename, start: node.getFirstToken().getStart() };
|
|
29120
|
+
}
|
|
29121
|
+
}
|
|
29122
|
+
leave(node) {
|
|
29123
|
+
if (SortedKeyWrite.isProcedure(node)) {
|
|
29124
|
+
this.bindings.clear();
|
|
29125
|
+
this.procedure = undefined;
|
|
29126
|
+
}
|
|
29127
|
+
else if (node.get() instanceof Structures.Loop) {
|
|
29128
|
+
const loop = node.findDirectStatement(Statements.Loop);
|
|
29129
|
+
for (const [identifier, binding] of this.bindings) {
|
|
29130
|
+
if (binding.loop === loop) {
|
|
29131
|
+
this.bindings.delete(identifier);
|
|
29132
|
+
}
|
|
29133
|
+
}
|
|
29134
|
+
}
|
|
29135
|
+
}
|
|
29136
|
+
/** call before the statement is checked */
|
|
29137
|
+
check(node, input) {
|
|
29138
|
+
if (this.bindings.size === 0) {
|
|
29139
|
+
return;
|
|
29140
|
+
}
|
|
29141
|
+
const s = node.get();
|
|
29142
|
+
if (!(s instanceof Statements.Move) && !(s instanceof Statements.Clear)) {
|
|
29143
|
+
return;
|
|
29144
|
+
}
|
|
29145
|
+
for (const target of node.findDirectExpressions(Expressions.Target)) {
|
|
29146
|
+
const message = this.checkTarget(target, input.scope);
|
|
29147
|
+
if (message !== undefined) {
|
|
29148
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, target.getFirstToken(), message));
|
|
29149
|
+
return;
|
|
29150
|
+
}
|
|
29151
|
+
}
|
|
29152
|
+
}
|
|
29153
|
+
/** call after the statement is checked, the inline declarations are then known */
|
|
29154
|
+
update(node, input) {
|
|
29155
|
+
var _a, _b, _c, _d;
|
|
29156
|
+
var _e, _f, _g;
|
|
29157
|
+
if (this.procedure === undefined) {
|
|
29158
|
+
return;
|
|
29159
|
+
}
|
|
29160
|
+
// any assignment of a field symbol or reference ends its binding
|
|
29161
|
+
for (const fs of node.findAllExpressions(Expressions.FSTarget)) {
|
|
29162
|
+
this.unbind(fs.findFirstExpression(Expressions.TargetFieldSymbol), input.scope);
|
|
29163
|
+
}
|
|
29164
|
+
if (node.get() instanceof Statements.Unassign) {
|
|
29165
|
+
this.unbind(node.findDirectExpression(Expressions.TargetFieldSymbol), input.scope);
|
|
29166
|
+
}
|
|
29167
|
+
for (const target of node.findAllExpressions(Expressions.Target)) {
|
|
29168
|
+
if (target.getChildren().length === 1) {
|
|
29169
|
+
this.unbind(target.findDirectExpression(Expressions.TargetField), input.scope);
|
|
29170
|
+
}
|
|
29171
|
+
}
|
|
29172
|
+
const s = node.get();
|
|
29173
|
+
let table = undefined;
|
|
29174
|
+
let result = undefined;
|
|
29175
|
+
if (s instanceof Statements.Loop && node.findDirectExpression(Expressions.LoopGroupBy) === undefined) {
|
|
29176
|
+
table = (_e = (_a = node.findDirectExpression(Expressions.LoopSource)) === null || _a === void 0 ? void 0 : _a.findDirectExpression(Expressions.SimpleSource2)) !== null && _e !== void 0 ? _e : (_b = node.findDirectExpression(Expressions.LoopSource)) === null || _b === void 0 ? void 0 : _b.findDirectExpression(Expressions.Source);
|
|
29177
|
+
result = node.findDirectExpression(Expressions.LoopTarget);
|
|
29178
|
+
}
|
|
29179
|
+
else if (s instanceof Statements.ReadTable) {
|
|
29180
|
+
table = (_f = node.findDirectExpression(Expressions.SimpleSource2)) !== null && _f !== void 0 ? _f : node.findDirectExpression(Expressions.Source);
|
|
29181
|
+
result = node.findDirectExpression(Expressions.ReadTableTarget);
|
|
29182
|
+
}
|
|
29183
|
+
if (table === undefined || result === undefined
|
|
29184
|
+
|| result.findDirectTokenByText("CASTING") !== undefined
|
|
29185
|
+
|| node.findDirectTokenByText("CASTING") !== undefined) {
|
|
29186
|
+
return;
|
|
29187
|
+
}
|
|
29188
|
+
let name = undefined;
|
|
29189
|
+
let reference = false;
|
|
29190
|
+
if (result.findDirectTokenByText("ASSIGNING") !== undefined) {
|
|
29191
|
+
name = (_c = result.findDirectExpression(Expressions.FSTarget)) === null || _c === void 0 ? void 0 : _c.findFirstExpression(Expressions.TargetFieldSymbol);
|
|
29192
|
+
}
|
|
29193
|
+
else if (result.findDirectTokenByText("REFERENCE") !== undefined) {
|
|
29194
|
+
const target = result.findDirectExpression(Expressions.Target);
|
|
29195
|
+
if ((target === null || target === void 0 ? void 0 : target.getChildren().length) === 1) {
|
|
29196
|
+
name = (_g = target.findDirectExpression(Expressions.TargetField)) !== null && _g !== void 0 ? _g : (_d = target.findDirectExpression(Expressions.InlineData)) === null || _d === void 0 ? void 0 : _d.findDirectExpression(Expressions.TargetField);
|
|
29197
|
+
}
|
|
29198
|
+
reference = true;
|
|
29199
|
+
}
|
|
29200
|
+
const identifier = input.scope.findVariable(name === null || name === void 0 ? void 0 : name.concatTokens());
|
|
29201
|
+
if (identifier === undefined
|
|
29202
|
+
|| identifier.getFilename() !== this.procedure.filename
|
|
29203
|
+
|| identifier.getStart().isBefore(this.procedure.start)) {
|
|
29204
|
+
return;
|
|
29205
|
+
}
|
|
29206
|
+
const key = SortedKeyWrite.findKey(SortedKeyWrite.findType(table, input.scope));
|
|
29207
|
+
if (key !== undefined) {
|
|
29208
|
+
this.bindings.set(identifier, { key, reference, loop: s instanceof Statements.Loop ? node : undefined });
|
|
29209
|
+
}
|
|
29210
|
+
}
|
|
29211
|
+
////////////////
|
|
29212
|
+
unbind(node, scope) {
|
|
29213
|
+
const found = node ? scope.findVariable(node.concatTokens()) : undefined;
|
|
29214
|
+
if (found !== undefined) {
|
|
29215
|
+
this.bindings.delete(found);
|
|
29216
|
+
}
|
|
29217
|
+
}
|
|
29218
|
+
checkTarget(target, scope) {
|
|
29219
|
+
var _a, _b, _c, _d;
|
|
29220
|
+
const children = target.getChildren();
|
|
29221
|
+
const first = children[0];
|
|
29222
|
+
if (!((first === null || first === void 0 ? void 0 : first.get()) instanceof Expressions.TargetFieldSymbol) && !((first === null || first === void 0 ? void 0 : first.get()) instanceof Expressions.TargetField)) {
|
|
29223
|
+
return undefined;
|
|
29224
|
+
}
|
|
29225
|
+
const found = scope.findVariable(first.concatTokens());
|
|
29226
|
+
const binding = found ? this.bindings.get(found) : undefined;
|
|
29227
|
+
if (binding === undefined) {
|
|
29228
|
+
return undefined;
|
|
29229
|
+
}
|
|
29230
|
+
let i = 1;
|
|
29231
|
+
const path = [];
|
|
29232
|
+
if (binding.reference === true) {
|
|
29233
|
+
if (((_a = children[i]) === null || _a === void 0 ? void 0 : _a.get()) instanceof tokens_1.InstanceArrow && ((_b = children[i + 1]) === null || _b === void 0 ? void 0 : _b.get()) instanceof Expressions.AttributeName) {
|
|
29234
|
+
path.push(children[i + 1].concatTokens().toUpperCase());
|
|
29235
|
+
i = i + 2;
|
|
29236
|
+
}
|
|
29237
|
+
else if (((_c = children[i]) === null || _c === void 0 ? void 0 : _c.get()) instanceof Expressions.Dereference) {
|
|
29238
|
+
i = i + 1;
|
|
29239
|
+
}
|
|
29240
|
+
else {
|
|
29241
|
+
// the reference itself
|
|
29242
|
+
return undefined;
|
|
29243
|
+
}
|
|
29244
|
+
}
|
|
29245
|
+
for (; i < children.length; i++) {
|
|
29246
|
+
const get = children[i].get();
|
|
29247
|
+
if (get instanceof tokens_1.Dash && ((_d = children[i + 1]) === null || _d === void 0 ? void 0 : _d.get()) instanceof Expressions.ComponentName) {
|
|
29248
|
+
path.push(children[i + 1].concatTokens().toUpperCase());
|
|
29249
|
+
i++;
|
|
29250
|
+
}
|
|
29251
|
+
else if (!(get instanceof Expressions.FieldOffset) && !(get instanceof Expressions.FieldLength)) {
|
|
29252
|
+
return undefined;
|
|
29253
|
+
}
|
|
29254
|
+
}
|
|
29255
|
+
if (binding.key === "line") {
|
|
29256
|
+
return "The line of a sorted or hashed table cannot be changed, it is the table key";
|
|
29257
|
+
}
|
|
29258
|
+
const name = path.join("-");
|
|
29259
|
+
if (name !== "" && binding.key.some(k => k === name || k.startsWith(name + "-") || name.startsWith(k + "-"))) {
|
|
29260
|
+
return `Key component "${name}" of a sorted or hashed table line cannot be changed`;
|
|
29261
|
+
}
|
|
29262
|
+
return undefined;
|
|
29263
|
+
}
|
|
29264
|
+
/** the primary key components of a sorted or hashed table, "line" when it is the whole line, else undefined */
|
|
29265
|
+
static findKey(type) {
|
|
29266
|
+
var _a;
|
|
29267
|
+
if (!(type instanceof basic_1.TableType)
|
|
29268
|
+
|| (type.getAccessType() !== basic_1.TableAccessType.sorted && type.getAccessType() !== basic_1.TableAccessType.hashed)) {
|
|
29269
|
+
return undefined;
|
|
29270
|
+
}
|
|
29271
|
+
const row = type.getRowType();
|
|
29272
|
+
if (row instanceof basic_1.VoidType || row instanceof basic_1.UnknownType || row.isGeneric()) {
|
|
29273
|
+
return undefined;
|
|
29274
|
+
}
|
|
29275
|
+
const keyType = type.getOptions().keyType;
|
|
29276
|
+
const fields = ((_a = type.getOptions().primaryKey) === null || _a === void 0 ? void 0 : _a.keyFields) || [];
|
|
29277
|
+
if (keyType === basic_1.TableKeyType.default) {
|
|
29278
|
+
// the default key of a structured line is not resolved
|
|
29279
|
+
return row instanceof basic_1.StructureType ? undefined : "line";
|
|
29280
|
+
}
|
|
29281
|
+
else if (keyType !== basic_1.TableKeyType.user || fields.length === 0) {
|
|
29282
|
+
return undefined;
|
|
29283
|
+
}
|
|
29284
|
+
else if (fields.includes("TABLE_LINE")) {
|
|
29285
|
+
return "line";
|
|
29286
|
+
}
|
|
29287
|
+
return fields;
|
|
29288
|
+
}
|
|
29289
|
+
/** the type of a table given by a plain chain of names, components and attributes, else undefined */
|
|
29290
|
+
static findType(node, scope) {
|
|
29291
|
+
var _a, _b;
|
|
29292
|
+
const chain = node.getChildren().length === 1 ? node.findDirectExpression(Expressions.FieldChain) : undefined;
|
|
29293
|
+
const children = (chain === null || chain === void 0 ? void 0 : chain.getChildren()) || [];
|
|
29294
|
+
const first = children[0];
|
|
29295
|
+
if (!((first === null || first === void 0 ? void 0 : first.get()) instanceof Expressions.SourceField) && !((first === null || first === void 0 ? void 0 : first.get()) instanceof Expressions.SourceFieldSymbol)) {
|
|
29296
|
+
return undefined;
|
|
29297
|
+
}
|
|
29298
|
+
let type = (_a = scope.findVariable(first.concatTokens())) === null || _a === void 0 ? void 0 : _a.getType();
|
|
29299
|
+
for (let i = 1; i < children.length && type !== undefined; i++) {
|
|
29300
|
+
const get = children[i].get();
|
|
29301
|
+
const next = children[i + 1];
|
|
29302
|
+
if (get instanceof tokens_1.Dash && (next === null || next === void 0 ? void 0 : next.get()) instanceof Expressions.ComponentName) {
|
|
29303
|
+
type = type instanceof basic_1.StructureType ? type.getComponentByName(next.concatTokens()) : undefined;
|
|
29304
|
+
i++;
|
|
29305
|
+
}
|
|
29306
|
+
else if (get instanceof tokens_1.InstanceArrow && (next === null || next === void 0 ? void 0 : next.get()) instanceof Expressions.AttributeName) {
|
|
29307
|
+
const def = type instanceof basic_1.ObjectReferenceType ? scope.findObjectDefinition(type.getIdentifierName()) : undefined;
|
|
29308
|
+
type = (_b = new _object_oriented_1.ObjectOriented(scope).searchAttributeName(def, next.concatTokens())) === null || _b === void 0 ? void 0 : _b.getType();
|
|
29309
|
+
i++;
|
|
29310
|
+
}
|
|
29311
|
+
else if (!(get instanceof Expressions.TableBody) || i !== children.length - 1) {
|
|
29312
|
+
return undefined;
|
|
29313
|
+
}
|
|
29314
|
+
}
|
|
29315
|
+
return type;
|
|
29316
|
+
}
|
|
29317
|
+
static isProcedure(node) {
|
|
29318
|
+
const get = node.get();
|
|
29319
|
+
return get instanceof Structures.Method || get instanceof Structures.Form || get instanceof Structures.FunctionModule;
|
|
29320
|
+
}
|
|
29321
|
+
}
|
|
29322
|
+
exports.SortedKeyWrite = SortedKeyWrite;
|
|
29323
|
+
//# sourceMappingURL=_sorted_key_write.js.map
|
|
29324
|
+
|
|
29325
|
+
/***/ },
|
|
29326
|
+
|
|
29031
29327
|
/***/ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_syntax_input.js"
|
|
29032
29328
|
/*!******************************************************************************!*\
|
|
29033
29329
|
!*** ./node_modules/@abaplint/core/build/src/abap/5_syntax/_syntax_input.js ***!
|
|
@@ -51155,6 +51451,7 @@ const assert_error_1 = __webpack_require__(/*! ./assert_error */ "./node_modules
|
|
|
51155
51451
|
const field_group_1 = __webpack_require__(/*! ./statements/field_group */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/statements/field_group.js");
|
|
51156
51452
|
const stuff_1 = __webpack_require__(/*! ../../stuff */ "./node_modules/@abaplint/core/build/src/stuff.js");
|
|
51157
51453
|
const _loop_table_change_1 = __webpack_require__(/*! ./_loop_table_change */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_loop_table_change.js");
|
|
51454
|
+
const _sorted_key_write_1 = __webpack_require__(/*! ./_sorted_key_write */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_sorted_key_write.js");
|
|
51158
51455
|
// -----------------------------------
|
|
51159
51456
|
const map = {};
|
|
51160
51457
|
function addToMap(handler) {
|
|
@@ -51319,6 +51616,7 @@ class SyntaxLogic {
|
|
|
51319
51616
|
this.issues = [];
|
|
51320
51617
|
this.deferred = [];
|
|
51321
51618
|
this.loopTables = new _loop_table_change_1.LoopTableChange();
|
|
51619
|
+
this.sortedLines = new _sorted_key_write_1.SortedKeyWrite();
|
|
51322
51620
|
this.reg.getDDICReferences().clear(this.object);
|
|
51323
51621
|
this.reg.getMSAGReferences().clear(this.object);
|
|
51324
51622
|
if (this.object instanceof objects_1.Program && this.object.isInclude()) {
|
|
@@ -51387,6 +51685,9 @@ class SyntaxLogic {
|
|
|
51387
51685
|
const loop = node instanceof nodes_1.StructureNode
|
|
51388
51686
|
&& node.get() instanceof Structures.Loop
|
|
51389
51687
|
&& this.loopTables.push(node, this.scope);
|
|
51688
|
+
if (node instanceof nodes_1.StructureNode) {
|
|
51689
|
+
this.sortedLines.enter(node, this.currentFile.getFilename());
|
|
51690
|
+
}
|
|
51390
51691
|
for (const child of node.getChildren()) {
|
|
51391
51692
|
const isStructure = child instanceof nodes_1.StructureNode;
|
|
51392
51693
|
const isStatement = child instanceof nodes_1.StatementNode;
|
|
@@ -51431,6 +51732,9 @@ class SyntaxLogic {
|
|
|
51431
51732
|
if (loop === true) {
|
|
51432
51733
|
this.loopTables.pop();
|
|
51433
51734
|
}
|
|
51735
|
+
if (node instanceof nodes_1.StructureNode) {
|
|
51736
|
+
this.sortedLines.leave(node);
|
|
51737
|
+
}
|
|
51434
51738
|
}
|
|
51435
51739
|
/**
|
|
51436
51740
|
* if this returns true, then the traversal should continue with next child
|
|
@@ -51520,9 +51824,11 @@ class SyntaxLogic {
|
|
|
51520
51824
|
return;
|
|
51521
51825
|
}
|
|
51522
51826
|
this.loopTables.check(node, input);
|
|
51827
|
+
this.sortedLines.check(node, input);
|
|
51523
51828
|
const name = s.constructor.name;
|
|
51524
51829
|
if (map[name]) {
|
|
51525
51830
|
map[name].runSyntax(node, input);
|
|
51831
|
+
this.sortedLines.update(node, input);
|
|
51526
51832
|
return;
|
|
51527
51833
|
}
|
|
51528
51834
|
if (s instanceof Statements.FunctionModule) {
|
|
@@ -56715,6 +57021,8 @@ class MethodParameters {
|
|
|
56715
57021
|
|| concat.includes(" FOR FEATURES ")
|
|
56716
57022
|
|| concat.includes(" FOR INSTANCE FEATURES ")
|
|
56717
57023
|
|| concat.includes(" FOR GLOBAL AUTHORIZATION ")
|
|
57024
|
+
|| concat.includes(" FOR INSTANCE AUTHORIZATION ")
|
|
57025
|
+
|| concat.includes(" FOR AUTHORIZATION ")
|
|
56718
57026
|
|| concat.includes(" FOR PRECHECK ")
|
|
56719
57027
|
|| concat.includes(" FOR NUMBERING ")
|
|
56720
57028
|
|| concat.includes(" FOR READ ")
|
|
@@ -71811,7 +72119,7 @@ class ServiceBinding extends _abstract_object_1.AbstractObject {
|
|
|
71811
72119
|
}
|
|
71812
72120
|
getAllowedNaming() {
|
|
71813
72121
|
return {
|
|
71814
|
-
maxLength:
|
|
72122
|
+
maxLength: 30,
|
|
71815
72123
|
allowNamespace: true,
|
|
71816
72124
|
};
|
|
71817
72125
|
}
|
|
@@ -73933,7 +74241,7 @@ class Registry {
|
|
|
73933
74241
|
}
|
|
73934
74242
|
static abaplintVersion() {
|
|
73935
74243
|
// magic, see build script "version.js"
|
|
73936
|
-
return "2.120.
|
|
74244
|
+
return "2.120.95";
|
|
73937
74245
|
}
|
|
73938
74246
|
getDDICReferences() {
|
|
73939
74247
|
return this.ddicReferences;
|
|
@@ -85709,6 +86017,7 @@ Current rules:
|
|
|
85709
86017
|
* SELECT INTO @DATA definitions are outlined
|
|
85710
86018
|
* Some occurrences of string template formatting option ALPHA changed to function module call
|
|
85711
86019
|
* SELECT/INSERT/MODIFY/DELETE/UPDATE "," in field list removed, "@" in source/targets removed
|
|
86020
|
+
* OPEN CURSOR/FETCH NEXT CURSOR/CLOSE CURSOR "@" in source/targets removed
|
|
85712
86021
|
* PARTIALLY IMPLEMENTED removed, it can be quick fixed via rule implement_methods
|
|
85713
86022
|
* RAISE EXCEPTION ... MESSAGE
|
|
85714
86023
|
* Moving with +=, -=, /=, *=, &&= is expanded
|
|
@@ -85814,6 +86123,7 @@ Make sure to test the downported code, it might not always be completely correct
|
|
|
85814
86123
|
highSyntax = new syntax_1.SyntaxLogic(this.highReg, highSyntaxObj).run();
|
|
85815
86124
|
}
|
|
85816
86125
|
let containsUnknown = false;
|
|
86126
|
+
const notDownported = [];
|
|
85817
86127
|
for (let i = 0; i < lowStatements.length; i++) {
|
|
85818
86128
|
const low = lowStatements[i];
|
|
85819
86129
|
const high = highStatements[i];
|
|
@@ -85825,6 +86135,12 @@ Make sure to test the downported code, it might not always be completely correct
|
|
|
85825
86135
|
if (issue) {
|
|
85826
86136
|
ret.push(issue);
|
|
85827
86137
|
}
|
|
86138
|
+
else {
|
|
86139
|
+
const nope = this.notDownported(low, high, lowFile, highSyntax);
|
|
86140
|
+
if (nope) {
|
|
86141
|
+
notDownported.push(nope);
|
|
86142
|
+
}
|
|
86143
|
+
}
|
|
85828
86144
|
}
|
|
85829
86145
|
catch (e) {
|
|
85830
86146
|
if (e instanceof SkipToNextFile) {
|
|
@@ -85881,6 +86197,20 @@ Make sure to test the downported code, it might not always be completely correct
|
|
|
85881
86197
|
}
|
|
85882
86198
|
}
|
|
85883
86199
|
}
|
|
86200
|
+
// MOVE-CORRESPONDING between tables parses in the low version, but is only allowed from
|
|
86201
|
+
// v740sp05, "MOVE-CORRESPONDING with tables possible from v740sp05"
|
|
86202
|
+
if (ret.length === 0) {
|
|
86203
|
+
for (let i = 0; i < lowStatements.length; i++) {
|
|
86204
|
+
if (lowStatements[i].getFirstToken().getStart() instanceof virtual_position_1.VirtualPosition) {
|
|
86205
|
+
continue;
|
|
86206
|
+
}
|
|
86207
|
+
const issue = this.downportMoveCorrespondingTables(highStatements[i], lowFile, highSyntax);
|
|
86208
|
+
if (issue) {
|
|
86209
|
+
ret.push(issue);
|
|
86210
|
+
break;
|
|
86211
|
+
}
|
|
86212
|
+
}
|
|
86213
|
+
}
|
|
85884
86214
|
// INTO after WHERE parses as a valid SELECT in the low version, but is only allowed in
|
|
85885
86215
|
// strict SQL syntax, so move it also when the statement is no longer Unknown
|
|
85886
86216
|
if (ret.length === 0) {
|
|
@@ -85893,10 +86223,53 @@ Make sure to test the downported code, it might not always be completely correct
|
|
|
85893
86223
|
}
|
|
85894
86224
|
}
|
|
85895
86225
|
}
|
|
86226
|
+
// nothing could be rewritten, name the statements which stay invalid in the low version
|
|
86227
|
+
if (ret.length === 0) {
|
|
86228
|
+
ret.push(...notDownported);
|
|
86229
|
+
}
|
|
85896
86230
|
}
|
|
85897
86231
|
return ret;
|
|
85898
86232
|
}
|
|
85899
86233
|
////////////////////
|
|
86234
|
+
/** for a statement no downport applies to, an issue without fix if it stays invalid in the low version */
|
|
86235
|
+
notDownported(low, high, lowFile, highSyntax) {
|
|
86236
|
+
var _a, _b;
|
|
86237
|
+
if (this.lowReg.getConfig().isOpenABAP()) {
|
|
86238
|
+
return undefined;
|
|
86239
|
+
}
|
|
86240
|
+
// a constructor expression with #, where the type cannot be inferred as it is void
|
|
86241
|
+
if (low.get() instanceof _statement_1.Unknown) {
|
|
86242
|
+
for (const infer of high.findAllExpressionsRecursive(Expressions.TypeNameOrInfer)) {
|
|
86243
|
+
if (infer.concatTokens() !== "#") {
|
|
86244
|
+
continue;
|
|
86245
|
+
}
|
|
86246
|
+
const token = infer.getFirstToken();
|
|
86247
|
+
const spag = highSyntax.spaghetti.lookupPosition(token.getStart(), lowFile.getFilename());
|
|
86248
|
+
const voided = spag === null || spag === void 0 ? void 0 : spag.getData().references.some(r => r.referenceType === _reference_1.ReferenceType.InferredType
|
|
86249
|
+
&& r.position.getStart().equals(token.getStart())
|
|
86250
|
+
&& r.resolved instanceof _typed_identifier_1.TypedIdentifier
|
|
86251
|
+
&& r.resolved.getType() instanceof basic_1.VoidType
|
|
86252
|
+
&& r.resolved.getType().getQualifiedName() === undefined);
|
|
86253
|
+
if (voided === true) {
|
|
86254
|
+
return issue_1.Issue.atToken(lowFile, token, "Cannot downport, inferred type is void", this.getMetadata().key, this.conf.severity);
|
|
86255
|
+
}
|
|
86256
|
+
}
|
|
86257
|
+
return undefined;
|
|
86258
|
+
}
|
|
86259
|
+
// the statement might still parse in the low version, eg. DATA(name) as offset/length access
|
|
86260
|
+
for (const i of high.findAllExpressionsRecursive(Expressions.InlineData)) {
|
|
86261
|
+
const nameToken = (_a = i.findDirectExpression(Expressions.TargetField)) === null || _a === void 0 ? void 0 : _a.getFirstToken();
|
|
86262
|
+
if (nameToken === undefined) {
|
|
86263
|
+
continue;
|
|
86264
|
+
}
|
|
86265
|
+
const name = nameToken.getStr();
|
|
86266
|
+
const found = (_b = highSyntax.spaghetti.lookupPosition(nameToken.getStart(), lowFile.getFilename())) === null || _b === void 0 ? void 0 : _b.findVariable(name);
|
|
86267
|
+
if ((found === null || found === void 0 ? void 0 : found.getType()) instanceof basic_1.VoidType && found.getType().getQualifiedName() === undefined) {
|
|
86268
|
+
return issue_1.Issue.atToken(lowFile, i.getFirstToken(), `Cannot downport, type of ${name} is void`, this.getMetadata().key, this.conf.severity);
|
|
86269
|
+
}
|
|
86270
|
+
}
|
|
86271
|
+
return undefined;
|
|
86272
|
+
}
|
|
85900
86273
|
/** clones the orginal repository into highReg, and parses it with higher language version */
|
|
85901
86274
|
initHighReg() {
|
|
85902
86275
|
// use default configuration, ie. default target version
|
|
@@ -85983,6 +86356,10 @@ Make sure to test the downported code, it might not always be completely correct
|
|
|
85983
86356
|
if (found) {
|
|
85984
86357
|
return found;
|
|
85985
86358
|
}
|
|
86359
|
+
found = this.downportMoveCorrespondingTables(high, lowFile, highSyntax);
|
|
86360
|
+
if (found) {
|
|
86361
|
+
return found;
|
|
86362
|
+
}
|
|
85986
86363
|
found = this.downportRef(low, high, lowFile, highSyntax);
|
|
85987
86364
|
if (found) {
|
|
85988
86365
|
return found;
|
|
@@ -86007,6 +86384,10 @@ Make sure to test the downported code, it might not always be completely correct
|
|
|
86007
86384
|
if (found) {
|
|
86008
86385
|
return found;
|
|
86009
86386
|
}
|
|
86387
|
+
found = this.downportOpenCursorInline(low, high, lowFile);
|
|
86388
|
+
if (found) {
|
|
86389
|
+
return found;
|
|
86390
|
+
}
|
|
86010
86391
|
found = this.downportSQLMoveInto(low, high, lowFile, highSyntax);
|
|
86011
86392
|
if (found) {
|
|
86012
86393
|
return found;
|
|
@@ -86089,6 +86470,10 @@ Make sure to test the downported code, it might not always be completely correct
|
|
|
86089
86470
|
if (found) {
|
|
86090
86471
|
return found;
|
|
86091
86472
|
}
|
|
86473
|
+
found = this.outlineReadTableVoidTarget(high, lowFile, highSyntax);
|
|
86474
|
+
if (found) {
|
|
86475
|
+
return found;
|
|
86476
|
+
}
|
|
86092
86477
|
found = this.outlineData(high, lowFile, highSyntax);
|
|
86093
86478
|
if (found) {
|
|
86094
86479
|
return found;
|
|
@@ -86101,6 +86486,10 @@ Make sure to test the downported code, it might not always be completely correct
|
|
|
86101
86486
|
if (found) {
|
|
86102
86487
|
return found;
|
|
86103
86488
|
}
|
|
86489
|
+
found = this.replaceInstanceOf(low, high, lowFile, highSyntax, highFile);
|
|
86490
|
+
if (found) {
|
|
86491
|
+
return found;
|
|
86492
|
+
}
|
|
86104
86493
|
found = this.replaceLineFunctions(high, lowFile, highSyntax, highFile);
|
|
86105
86494
|
if (found) {
|
|
86106
86495
|
return found;
|
|
@@ -86180,13 +86569,48 @@ Make sure to test the downported code, it might not always be completely correct
|
|
|
86180
86569
|
if (from === undefined) {
|
|
86181
86570
|
return undefined;
|
|
86182
86571
|
}
|
|
86183
|
-
|
|
86184
|
-
|
|
86185
|
-
const
|
|
86572
|
+
// UP TO after INTO is only valid behind WHERE when it follows an ORDER BY, else move it along in front of INTO
|
|
86573
|
+
let move = into.concatTokens();
|
|
86574
|
+
const fixes = [];
|
|
86575
|
+
const upTo = high.findFirstExpression(Expressions.SQLUpTo);
|
|
86576
|
+
const orderBy = high.findFirstExpression(Expressions.SQLOrderBy);
|
|
86577
|
+
if (upTo !== undefined
|
|
86578
|
+
&& into.getLastToken().getEnd().isBefore(upTo.getFirstToken().getStart())
|
|
86579
|
+
&& (orderBy === undefined || upTo.getFirstToken().getStart().isBefore(orderBy.getFirstToken().getStart()))) {
|
|
86580
|
+
move = upTo.concatTokens() + ` ` + move;
|
|
86581
|
+
fixes.push(edit_helper_1.EditHelper.deleteRange(lowFile, upTo.getFirstToken().getStart(), upTo.getLastToken().getEnd()));
|
|
86582
|
+
}
|
|
86583
|
+
// edits are applied in sequence, so work from the end of the statement towards the start
|
|
86584
|
+
fixes.push(edit_helper_1.EditHelper.deleteRange(lowFile, into.getFirstToken().getStart(), into.getLastToken().getEnd()));
|
|
86585
|
+
fixes.push(edit_helper_1.EditHelper.insertAt(lowFile, from.getLastToken().getEnd(), ` ` + move));
|
|
86586
|
+
const fix = edit_helper_1.EditHelper.mergeList(fixes);
|
|
86186
86587
|
return issue_1.Issue.atToken(lowFile, low.getFirstToken(), "SQL, move INTO", this.getMetadata().key, this.conf.severity, fix);
|
|
86187
86588
|
}
|
|
86589
|
+
/** the work area of INSERT/MODIFY/UPDATE/DELETE dbtab FROM @( ... ) takes its type from the
|
|
86590
|
+
* database table, a "#" constructor cannot be outlined with DATA( ) as there is nothing to infer from */
|
|
86591
|
+
sqlWorkAreaType(high, sqlSource) {
|
|
86592
|
+
if (!(high.get() instanceof Statements.InsertDatabase)
|
|
86593
|
+
&& !(high.get() instanceof Statements.ModifyDatabase)
|
|
86594
|
+
&& !(high.get() instanceof Statements.UpdateDatabase)
|
|
86595
|
+
&& !(high.get() instanceof Statements.DeleteDatabase)) {
|
|
86596
|
+
return undefined;
|
|
86597
|
+
}
|
|
86598
|
+
else if (high.getChildren().includes(sqlSource) === false) {
|
|
86599
|
+
return undefined;
|
|
86600
|
+
}
|
|
86601
|
+
const table = high.findDirectExpression(Expressions.DatabaseTable);
|
|
86602
|
+
if (table === undefined || table.findDirectExpression(Expressions.Dynamic) !== undefined) {
|
|
86603
|
+
return undefined;
|
|
86604
|
+
}
|
|
86605
|
+
const name = table.concatTokens();
|
|
86606
|
+
if (high.findDirectTokenByText("TABLE") !== undefined) {
|
|
86607
|
+
return `STANDARD TABLE OF ${name} WITH DEFAULT KEY`;
|
|
86608
|
+
}
|
|
86609
|
+
return name;
|
|
86610
|
+
}
|
|
86188
86611
|
/** removes @'s and commas */
|
|
86189
86612
|
downportSQLExtras(low, high, lowFile, highSyntax) {
|
|
86613
|
+
var _a;
|
|
86190
86614
|
if (!(low.get() instanceof _statement_1.Unknown)) {
|
|
86191
86615
|
return undefined;
|
|
86192
86616
|
}
|
|
@@ -86195,7 +86619,10 @@ Make sure to test the downported code, it might not always be completely correct
|
|
|
86195
86619
|
&& !(high.get() instanceof Statements.UpdateDatabase)
|
|
86196
86620
|
&& !(high.get() instanceof Statements.ModifyDatabase)
|
|
86197
86621
|
&& !(high.get() instanceof Statements.DeleteDatabase)
|
|
86198
|
-
&& !(high.get() instanceof Statements.InsertDatabase)
|
|
86622
|
+
&& !(high.get() instanceof Statements.InsertDatabase)
|
|
86623
|
+
&& !(high.get() instanceof Statements.OpenCursor)
|
|
86624
|
+
&& !(high.get() instanceof Statements.FetchNextCursor)
|
|
86625
|
+
&& !(high.get() instanceof Statements.CloseCursor)) {
|
|
86199
86626
|
return undefined;
|
|
86200
86627
|
}
|
|
86201
86628
|
let fix = undefined;
|
|
@@ -86212,12 +86639,28 @@ Make sure to test the downported code, it might not always be completely correct
|
|
|
86212
86639
|
high.findAllExpressionsRecursive(Expressions.SQLSource),
|
|
86213
86640
|
high.findAllExpressionsRecursive(Expressions.SQLSourceNoSpace),
|
|
86214
86641
|
high.findAllExpressionsRecursive(Expressions.SQLSourceSimple)].flat();
|
|
86215
|
-
|
|
86642
|
+
// the deletions are applied one after the other, so handle the candidates from the end of the statement,
|
|
86643
|
+
// in FETCH NEXT CURSOR and OPEN CURSOR a source or target comes before the others
|
|
86644
|
+
candidates.sort((a, b) => a.getFirstToken().getStart().isAfter(b.getFirstToken().getStart()) ? -1 : 1);
|
|
86645
|
+
for (const c of candidates) {
|
|
86216
86646
|
if (c.getFirstToken() instanceof tokens_1.WAt
|
|
86217
86647
|
|| c.getFirstToken() instanceof tokens_1.At) {
|
|
86218
86648
|
const tokens = c.getAllTokens();
|
|
86219
86649
|
if (tokens[1] instanceof tokens_1.ParenLeftW && tokens[tokens.length - 1] instanceof tokens_1.WParenRightW) {
|
|
86220
86650
|
const source = c.findDirectExpression(Expressions.Source);
|
|
86651
|
+
if (((_a = source === null || source === void 0 ? void 0 : source.findDirectExpression(Expressions.TypeNameOrInfer)) === null || _a === void 0 ? void 0 : _a.concatTokens()) === "#") {
|
|
86652
|
+
const workAreaType = this.sqlWorkAreaType(high, c);
|
|
86653
|
+
if (workAreaType === undefined) {
|
|
86654
|
+
return issue_1.Issue.atToken(lowFile, low.getFirstToken(), "SQL, outline complex @, type of # not known", this.getMetadata().key, this.conf.severity);
|
|
86655
|
+
}
|
|
86656
|
+
const uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
|
|
86657
|
+
const indentation = " ".repeat(high.getFirstToken().getStart().getCol() - 1);
|
|
86658
|
+
const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getFirstToken().getStart(), `DATA ${uniqueName} TYPE ${workAreaType}.
|
|
86659
|
+
${indentation}${uniqueName} = ${source === null || source === void 0 ? void 0 : source.concatTokens()}.\n${indentation}`);
|
|
86660
|
+
const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, c.getFirstToken().getStart(), c.getLastToken().getEnd(), "@" + uniqueName);
|
|
86661
|
+
const fix = edit_helper_1.EditHelper.merge(fix2, fix1);
|
|
86662
|
+
return issue_1.Issue.atToken(lowFile, low.getFirstToken(), "SQL, outline complex @", this.getMetadata().key, this.conf.severity, fix);
|
|
86663
|
+
}
|
|
86221
86664
|
const uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
|
|
86222
86665
|
const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getStart(), `DATA(${uniqueName}) = ${source === null || source === void 0 ? void 0 : source.concatTokens()}.\n`);
|
|
86223
86666
|
const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, c.getFirstToken().getStart(), c.getLastToken().getEnd(), "@" + uniqueName);
|
|
@@ -86259,6 +86702,26 @@ Make sure to test the downported code, it might not always be completely correct
|
|
|
86259
86702
|
}
|
|
86260
86703
|
return undefined;
|
|
86261
86704
|
}
|
|
86705
|
+
/** OPEN CURSOR @DATA(name), the cursor is always of type cursor */
|
|
86706
|
+
downportOpenCursorInline(low, high, lowFile) {
|
|
86707
|
+
var _a, _b, _c;
|
|
86708
|
+
if (!(low.get() instanceof _statement_1.Unknown)) {
|
|
86709
|
+
return undefined;
|
|
86710
|
+
}
|
|
86711
|
+
else if (!(high.get() instanceof Statements.OpenCursor)) {
|
|
86712
|
+
return undefined;
|
|
86713
|
+
}
|
|
86714
|
+
const inlineData = (_b = (_a = high.findDirectExpression(Expressions.SQLTarget)) === null || _a === void 0 ? void 0 : _a.findDirectExpression(Expressions.Target)) === null || _b === void 0 ? void 0 : _b.findDirectExpression(Expressions.InlineData);
|
|
86715
|
+
const name = (_c = inlineData === null || inlineData === void 0 ? void 0 : inlineData.findFirstExpression(Expressions.TargetField)) === null || _c === void 0 ? void 0 : _c.concatTokens();
|
|
86716
|
+
if (inlineData === undefined || name === undefined) {
|
|
86717
|
+
return undefined;
|
|
86718
|
+
}
|
|
86719
|
+
const indentation = " ".repeat(high.getFirstToken().getStart().getCol() - 1);
|
|
86720
|
+
const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getStart(), `DATA ${name} TYPE cursor.\n${indentation}`);
|
|
86721
|
+
const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, inlineData.getFirstToken().getStart(), inlineData.getLastToken().getEnd(), name);
|
|
86722
|
+
const fix = edit_helper_1.EditHelper.merge(fix2, fix1);
|
|
86723
|
+
return issue_1.Issue.atToken(lowFile, inlineData.getFirstToken(), "Outline OPEN CURSOR @DATA", this.getMetadata().key, this.conf.severity, fix);
|
|
86724
|
+
}
|
|
86262
86725
|
downportSelectExistence(low, high, lowFile, highSyntax) {
|
|
86263
86726
|
var _a, _b, _c, _d;
|
|
86264
86727
|
if (!(low.get() instanceof _statement_1.Unknown)) {
|
|
@@ -86307,7 +86770,7 @@ Make sure to test the downported code, it might not always be completely correct
|
|
|
86307
86770
|
return undefined;
|
|
86308
86771
|
}
|
|
86309
86772
|
downportSelectFields(low, high, lowFile, _highSyntax) {
|
|
86310
|
-
var _a;
|
|
86773
|
+
var _a, _b, _c;
|
|
86311
86774
|
if (!(low.get() instanceof _statement_1.Unknown)) {
|
|
86312
86775
|
return undefined;
|
|
86313
86776
|
}
|
|
@@ -86318,12 +86781,19 @@ Make sure to test the downported code, it might not always be completely correct
|
|
|
86318
86781
|
if (fields === undefined) {
|
|
86319
86782
|
return undefined;
|
|
86320
86783
|
}
|
|
86321
|
-
|
|
86322
|
-
|
|
86323
|
-
|
|
86784
|
+
// everything behind the FIELDS keyword, including DISTINCT
|
|
86785
|
+
const code = fields.concatTokens().replace(/^FIELDS\s+/i, "");
|
|
86786
|
+
// the field list goes behind SELECT, or behind SINGLE [FOR UPDATE], which must stay in front of it
|
|
86787
|
+
const tokens = high.getTokens();
|
|
86788
|
+
let insertAfter = tokens[0];
|
|
86789
|
+
if (((_a = tokens[1]) === null || _a === void 0 ? void 0 : _a.getStr().toUpperCase()) === "SINGLE") {
|
|
86790
|
+
insertAfter = tokens[1];
|
|
86791
|
+
if (((_b = tokens[2]) === null || _b === void 0 ? void 0 : _b.getStr().toUpperCase()) === "FOR" && ((_c = tokens[3]) === null || _c === void 0 ? void 0 : _c.getStr().toUpperCase()) === "UPDATE") {
|
|
86792
|
+
insertAfter = tokens[3];
|
|
86793
|
+
}
|
|
86324
86794
|
}
|
|
86325
86795
|
const fix1 = edit_helper_1.EditHelper.deleteRange(lowFile, fields.getFirstToken().getStart(), fields.getLastToken().getEnd());
|
|
86326
|
-
const fix2 = edit_helper_1.EditHelper.insertAt(lowFile,
|
|
86796
|
+
const fix2 = edit_helper_1.EditHelper.insertAt(lowFile, insertAfter.getEnd(), " " + code);
|
|
86327
86797
|
const fix = edit_helper_1.EditHelper.merge(fix1, fix2);
|
|
86328
86798
|
return issue_1.Issue.atToken(lowFile, fields.getFirstToken(), "Replace FIELDS", this.getMetadata().key, this.conf.severity, fix);
|
|
86329
86799
|
}
|
|
@@ -86612,6 +87082,14 @@ ${indentation}${uniqueName} = ${source.concatTokens()}.\n${indentation}`);
|
|
|
86612
87082
|
continue;
|
|
86613
87083
|
}
|
|
86614
87084
|
const condition = this.tableCondition(tableExpression);
|
|
87085
|
+
let guard = [];
|
|
87086
|
+
if (high.get() instanceof Statements.If) {
|
|
87087
|
+
const found = this.shortCircuitGuard(high.findDirectExpression(Expressions.Cond), fieldChain);
|
|
87088
|
+
if (found === "later") {
|
|
87089
|
+
continue;
|
|
87090
|
+
}
|
|
87091
|
+
guard = found;
|
|
87092
|
+
}
|
|
86615
87093
|
// ASSIGNING, not INTO: from v740 a table expression in a read position addresses the
|
|
86616
87094
|
// row rather than copying it, so "REF #( tab[ i ]-comp )" and "ASSIGN tab[ i ]-comp"
|
|
86617
87095
|
// hand back an address INTO a work area would not preserve. The write path
|
|
@@ -86621,14 +87099,22 @@ ${indentation}${uniqueName} = ${source.concatTokens()}.\n${indentation}`);
|
|
|
86621
87099
|
const indentation = " ".repeat(high.getFirstToken().getStart().getCol() - 1);
|
|
86622
87100
|
const firstToken = high.getFirstToken();
|
|
86623
87101
|
// note that the tabix restore should be done before throwing the exception
|
|
87102
|
+
let read = `${tabixBackup} = sy-tabix.
|
|
87103
|
+
READ TABLE ${pre} ${condition}ASSIGNING ${uniqueName}.
|
|
87104
|
+
sy-tabix = ${tabixBackup}.
|
|
87105
|
+
IF sy-subrc <> 0.
|
|
87106
|
+
RAISE EXCEPTION TYPE cx_sy_itab_line_not_found.
|
|
87107
|
+
ENDIF.`;
|
|
87108
|
+
if (guard.length > 0) {
|
|
87109
|
+
// the operands in front of the table expression are evaluated first and can stop the
|
|
87110
|
+
// evaluation, so the row is only read when they let the evaluation reach it
|
|
87111
|
+
read = `IF ${guard.join(" AND ")}.
|
|
87112
|
+
${read.replace(/^/gm, " ")}
|
|
87113
|
+
ENDIF.`;
|
|
87114
|
+
}
|
|
86624
87115
|
const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, firstToken.getStart(), `FIELD-SYMBOLS ${uniqueName} LIKE LINE OF ${pre}.
|
|
86625
87116
|
${indentation}DATA ${tabixBackup} LIKE sy-tabix.
|
|
86626
|
-
${
|
|
86627
|
-
${indentation}READ TABLE ${pre} ${condition}ASSIGNING ${uniqueName}.
|
|
86628
|
-
${indentation}sy-tabix = ${tabixBackup}.
|
|
86629
|
-
${indentation}IF sy-subrc <> 0.
|
|
86630
|
-
${indentation} RAISE EXCEPTION TYPE cx_sy_itab_line_not_found.
|
|
86631
|
-
${indentation}ENDIF.
|
|
87117
|
+
${read.replace(/\n/g, "\n" + indentation).replace(/^/, indentation)}
|
|
86632
87118
|
${indentation}`);
|
|
86633
87119
|
const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, startToken.getStart(), tableExpression.getLastToken().getEnd(), uniqueName);
|
|
86634
87120
|
const fix = edit_helper_1.EditHelper.merge(fix2, fix1);
|
|
@@ -86639,6 +87125,73 @@ ${indentation}`);
|
|
|
86639
87125
|
}
|
|
86640
87126
|
return undefined;
|
|
86641
87127
|
}
|
|
87128
|
+
/** ABAP evaluates the operands of AND and OR left to right and stops as soon as the result
|
|
87129
|
+
* is known, so in "IF lv_last > 0 AND tab[ lv_last ] = x." the table expression is only read
|
|
87130
|
+
* when lv_last > 0. Outlined in front of the IF, the read and its CX_SY_ITAB_LINE_NOT_FOUND
|
|
87131
|
+
* raise would run unconditionally. Returns the operands that must hold for the evaluation to
|
|
87132
|
+
* reach the target, empty when it is always reached (or the shape is not handled, which keeps
|
|
87133
|
+
* the unconditional outline), and "later" when an operand in front of it holds a table
|
|
87134
|
+
* expression itself, which must be outlined first. Operands with method calls or NEW are not
|
|
87135
|
+
* repeated in a guard, as that would evaluate them twice. */
|
|
87136
|
+
shortCircuitGuard(cond, target) {
|
|
87137
|
+
var _a;
|
|
87138
|
+
if (cond === undefined) {
|
|
87139
|
+
return [];
|
|
87140
|
+
}
|
|
87141
|
+
const guard = [];
|
|
87142
|
+
const negated = [];
|
|
87143
|
+
let term = [];
|
|
87144
|
+
for (const child of cond.getChildren()) {
|
|
87145
|
+
if (child instanceof nodes_1.TokenNode) {
|
|
87146
|
+
const operator = child.getFirstToken().getStr().toUpperCase();
|
|
87147
|
+
if (operator === "EQUIV") {
|
|
87148
|
+
return [];
|
|
87149
|
+
}
|
|
87150
|
+
else if (operator === "OR") {
|
|
87151
|
+
negated.push(term);
|
|
87152
|
+
term = [];
|
|
87153
|
+
}
|
|
87154
|
+
continue;
|
|
87155
|
+
}
|
|
87156
|
+
else if (!(child instanceof nodes_1.ExpressionNode)) {
|
|
87157
|
+
return [];
|
|
87158
|
+
}
|
|
87159
|
+
if (child.findAllExpressionsRecursive(Expressions.FieldChain).includes(target) === false) {
|
|
87160
|
+
term.push(child);
|
|
87161
|
+
continue;
|
|
87162
|
+
}
|
|
87163
|
+
guard.push(...term);
|
|
87164
|
+
let inner = [];
|
|
87165
|
+
if (child.get() instanceof Expressions.CondSub) {
|
|
87166
|
+
const found = this.shortCircuitGuard(child.findDirectExpression(Expressions.Cond), target);
|
|
87167
|
+
if (found === "later") {
|
|
87168
|
+
return found;
|
|
87169
|
+
}
|
|
87170
|
+
inner = found;
|
|
87171
|
+
}
|
|
87172
|
+
const operands = [...negated.flat(), ...guard];
|
|
87173
|
+
if (operands.some(o => o.findFirstExpression(Expressions.TableExpression) !== undefined)) {
|
|
87174
|
+
return "later";
|
|
87175
|
+
}
|
|
87176
|
+
for (const o of operands) {
|
|
87177
|
+
if (o.findFirstExpression(Expressions.NewObject) !== undefined) {
|
|
87178
|
+
return [];
|
|
87179
|
+
}
|
|
87180
|
+
for (const m of o.findAllExpressionsRecursive(Expressions.MethodCall)) {
|
|
87181
|
+
const name = (_a = m.findDirectExpression(Expressions.MethodName)) === null || _a === void 0 ? void 0 : _a.concatTokens().toUpperCase();
|
|
87182
|
+
if (_builtin_1.BuiltIn.searchBuiltin(name) === undefined) {
|
|
87183
|
+
return [];
|
|
87184
|
+
}
|
|
87185
|
+
}
|
|
87186
|
+
}
|
|
87187
|
+
return [
|
|
87188
|
+
...negated.map(t => "NOT ( " + t.map(o => o.concatTokens()).join(" AND ") + " )"),
|
|
87189
|
+
...guard.map(o => o.concatTokens()),
|
|
87190
|
+
...inner
|
|
87191
|
+
];
|
|
87192
|
+
}
|
|
87193
|
+
return [];
|
|
87194
|
+
}
|
|
86642
87195
|
tableCondition(tableExpression) {
|
|
86643
87196
|
let condition = "";
|
|
86644
87197
|
let keyName = "";
|
|
@@ -86747,6 +87300,72 @@ ${indentation}`);
|
|
|
86747
87300
|
const fix = edit_helper_1.EditHelper.merge(fix2, fix1);
|
|
86748
87301
|
return issue_1.Issue.atToken(lowFile, source.getFirstToken(), "Outline built-in function in INSERT", this.getMetadata().key, this.conf.severity, fix);
|
|
86749
87302
|
}
|
|
87303
|
+
/** MOVE-CORRESPONDING between internal tables is possible from v740sp05, in 702 move row by row;
|
|
87304
|
+
* a typed target must be a standard table, as a row is added before its fields are filled, and a
|
|
87305
|
+
* fully generic target carries no table kind, so its row is added with INSERT INTO TABLE */
|
|
87306
|
+
downportMoveCorrespondingTables(high, lowFile, highSyntax) {
|
|
87307
|
+
var _a, _b;
|
|
87308
|
+
if (!(high.get() instanceof Statements.MoveCorresponding)) {
|
|
87309
|
+
return undefined;
|
|
87310
|
+
}
|
|
87311
|
+
else if (this.lowReg.getConfig().isOpenABAP()) {
|
|
87312
|
+
return undefined;
|
|
87313
|
+
}
|
|
87314
|
+
const concat = high.concatTokens().toUpperCase();
|
|
87315
|
+
if (concat.includes(" EXPANDING NESTED TABLES") || concat.startsWith("MOVE-CORRESPONDING EXACT ")) {
|
|
87316
|
+
return undefined;
|
|
87317
|
+
}
|
|
87318
|
+
const keeping = concat.includes(" KEEPING TARGET LINES");
|
|
87319
|
+
// only plain variables and field symbols, their types are known from the scope
|
|
87320
|
+
const source = high.findDirectExpression(Expressions.Source);
|
|
87321
|
+
const sourceField = source === null || source === void 0 ? void 0 : source.getFirstChild();
|
|
87322
|
+
const target = high.findDirectExpression(Expressions.SimpleTarget);
|
|
87323
|
+
if (source === undefined
|
|
87324
|
+
|| target === undefined
|
|
87325
|
+
|| source.getChildren().length !== 1
|
|
87326
|
+
|| !((sourceField === null || sourceField === void 0 ? void 0 : sourceField.get()) instanceof Expressions.FieldChain)
|
|
87327
|
+
|| sourceField.getChildren().length !== 1
|
|
87328
|
+
|| target.getChildren().length !== 1) {
|
|
87329
|
+
return undefined;
|
|
87330
|
+
}
|
|
87331
|
+
const sourceName = source.concatTokens();
|
|
87332
|
+
const targetName = target.concatTokens();
|
|
87333
|
+
if (sourceName.toUpperCase() === targetName.toUpperCase()) {
|
|
87334
|
+
return undefined;
|
|
87335
|
+
}
|
|
87336
|
+
const spag = highSyntax.spaghetti.lookupPosition(high.getFirstToken().getStart(), lowFile.getFilename());
|
|
87337
|
+
const sourceType = (_a = spag === null || spag === void 0 ? void 0 : spag.findVariable(sourceName)) === null || _a === void 0 ? void 0 : _a.getType();
|
|
87338
|
+
const targetType = (_b = spag === null || spag === void 0 ? void 0 : spag.findVariable(targetName)) === null || _b === void 0 ? void 0 : _b.getType();
|
|
87339
|
+
if (!(sourceType instanceof basic_1.TableType)
|
|
87340
|
+
|| !(targetType instanceof basic_1.TableType)
|
|
87341
|
+
|| sourceType.isWithHeader() === true
|
|
87342
|
+
|| targetType.isWithHeader() === true
|
|
87343
|
+
|| (targetType.getAccessType() !== basic_1.TableAccessType.standard && targetType.getAccessType() !== undefined)) {
|
|
87344
|
+
return undefined;
|
|
87345
|
+
}
|
|
87346
|
+
for (const t of [sourceType, targetType]) {
|
|
87347
|
+
const row = t.getRowType();
|
|
87348
|
+
if (!(row instanceof basic_1.StructureType || row instanceof basic_1.AnyType || row instanceof basic_1.VoidType)) {
|
|
87349
|
+
return undefined;
|
|
87350
|
+
}
|
|
87351
|
+
}
|
|
87352
|
+
const fsType = (name, type) => type.isGeneric() ? "TYPE any" : "LIKE LINE OF " + name;
|
|
87353
|
+
const sourceFS = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax, true);
|
|
87354
|
+
const targetFS = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax, true);
|
|
87355
|
+
const addRow = targetType.getAccessType() === undefined
|
|
87356
|
+
? `INSERT INITIAL LINE INTO TABLE ${targetName}`
|
|
87357
|
+
: `APPEND INITIAL LINE TO ${targetName}`;
|
|
87358
|
+
const indentation = " ".repeat(high.getFirstToken().getStart().getCol() - 1);
|
|
87359
|
+
const code = `FIELD-SYMBOLS ${sourceFS} ${fsType(sourceName, sourceType)}.\n` +
|
|
87360
|
+
indentation + `FIELD-SYMBOLS ${targetFS} ${fsType(targetName, targetType)}.\n` +
|
|
87361
|
+
(keeping ? "" : indentation + `CLEAR ${targetName}.\n`) +
|
|
87362
|
+
indentation + `LOOP AT ${sourceName} ASSIGNING ${sourceFS}.\n` +
|
|
87363
|
+
indentation + ` ${addRow} ASSIGNING ${targetFS}.\n` +
|
|
87364
|
+
indentation + ` MOVE-CORRESPONDING ${sourceFS} TO ${targetFS}.\n` +
|
|
87365
|
+
indentation + `ENDLOOP.`;
|
|
87366
|
+
const fix = edit_helper_1.EditHelper.replaceRange(lowFile, high.getFirstToken().getStart(), high.getLastToken().getEnd(), code);
|
|
87367
|
+
return issue_1.Issue.atToken(lowFile, high.getFirstToken(), "Downport MOVE-CORRESPONDING with tables", this.getMetadata().key, this.conf.severity, fix);
|
|
87368
|
+
}
|
|
86750
87369
|
/** the ABAP type returned by the built-in function this Source starts with, or undefined
|
|
86751
87370
|
* if it does not start with one, or with one that predates 702 */
|
|
86752
87371
|
builtinReturnType(source, lowFile, highSyntax) {
|
|
@@ -87009,6 +87628,16 @@ ${indentation}${uniqueName2}->if_t100_message~t100key = ${uniqueName1}.\n`;
|
|
|
87009
87628
|
const fix = edit_helper_1.EditHelper.replaceToken(lowFile, token, "DEFAULT");
|
|
87010
87629
|
return issue_1.Issue.atToken(lowFile, i.getFirstToken(), "Downport EMPTY KEY", this.getMetadata().key, this.conf.severity, fix);
|
|
87011
87630
|
}
|
|
87631
|
+
if (node.get() instanceof Statements.CreateData) {
|
|
87632
|
+
// the key of CREATE DATA is not a TypeTableKey expression, its keywords are direct tokens
|
|
87633
|
+
const tokens = node.getChildren().filter(c => c instanceof nodes_1.TokenNode).map(c => c.getFirstToken());
|
|
87634
|
+
for (let j = 0; j < tokens.length - 1; j++) {
|
|
87635
|
+
if (tokens[j].getStr().toUpperCase() === "EMPTY" && tokens[j + 1].getStr().toUpperCase() === "KEY") {
|
|
87636
|
+
const fix = edit_helper_1.EditHelper.replaceToken(lowFile, tokens[j], "DEFAULT");
|
|
87637
|
+
return issue_1.Issue.atToken(lowFile, tokens[j], "Downport EMPTY KEY", this.getMetadata().key, this.conf.severity, fix);
|
|
87638
|
+
}
|
|
87639
|
+
}
|
|
87640
|
+
}
|
|
87012
87641
|
return undefined;
|
|
87013
87642
|
}
|
|
87014
87643
|
callFunctionParameterSimple(high, lowFile, highSyntax) {
|
|
@@ -87408,10 +88037,18 @@ CONSTANTS: BEGIN OF ${structureName},\n`;
|
|
|
87408
88037
|
if (!(low.get() instanceof _statement_1.Unknown)) {
|
|
87409
88038
|
return undefined;
|
|
87410
88039
|
}
|
|
87411
|
-
|
|
87412
|
-
|
|
88040
|
+
let target = undefined;
|
|
88041
|
+
if (high.get() instanceof Statements.Move) {
|
|
88042
|
+
target = high.findDirectExpression(Expressions.Target);
|
|
88043
|
+
}
|
|
88044
|
+
else if (high.get() instanceof Statements.Clear
|
|
88045
|
+
|| high.get() instanceof Statements.Free
|
|
88046
|
+
|| high.get() instanceof Statements.Append
|
|
88047
|
+
|| high.get() instanceof Statements.InsertInternal) {
|
|
88048
|
+
// the writable operand, eg. "CLEAR tab[ 1 ]-comp" or "APPEND 1 TO tab[ 1 ]-sub", is a Target
|
|
88049
|
+
// just like the left-hand side of an assignment, so it is lowered the same way
|
|
88050
|
+
target = high.findDirectExpressions(Expressions.Target).find(t => t.findDirectExpression(Expressions.TableExpression) !== undefined);
|
|
87413
88051
|
}
|
|
87414
|
-
const target = high.findDirectExpression(Expressions.Target);
|
|
87415
88052
|
if (target === undefined) {
|
|
87416
88053
|
return undefined;
|
|
87417
88054
|
}
|
|
@@ -87437,13 +88074,16 @@ ${indentation}sy-tabix = ${tabixBackup}.
|
|
|
87437
88074
|
${indentation}IF sy-subrc <> 0.
|
|
87438
88075
|
${indentation} RAISE EXCEPTION TYPE cx_sy_itab_line_not_found.
|
|
87439
88076
|
${indentation}ENDIF.
|
|
87440
|
-
${indentation}
|
|
88077
|
+
${indentation}`;
|
|
87441
88078
|
const start = target.getFirstToken().getStart();
|
|
87442
88079
|
const end = (_a = tableExpression.findDirectTokenByText("]")) === null || _a === void 0 ? void 0 : _a.getEnd();
|
|
87443
88080
|
if (end === undefined) {
|
|
87444
88081
|
return undefined;
|
|
87445
88082
|
}
|
|
87446
|
-
|
|
88083
|
+
// the READ TABLE goes in front of the statement, the target need not be its first operand
|
|
88084
|
+
const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getFirstToken().getStart(), code);
|
|
88085
|
+
const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, start, end, uniqueName);
|
|
88086
|
+
const fix = edit_helper_1.EditHelper.merge(fix2, fix1);
|
|
87447
88087
|
return issue_1.Issue.atToken(lowFile, high.getFirstToken(), "Downport, move with table target", this.getMetadata().key, this.conf.severity, fix);
|
|
87448
88088
|
}
|
|
87449
88089
|
moveWithOperator(low, high, lowFile) {
|
|
@@ -87960,9 +88600,31 @@ ${indentation} output = ${uniqueName}.\n`;
|
|
|
87960
88600
|
else {
|
|
87961
88601
|
type = "TYPE " + type;
|
|
87962
88602
|
}
|
|
88603
|
+
let move = indentation + `MOVE-CORRESPONDING ${correspondingBody === null || correspondingBody === void 0 ? void 0 : correspondingBody.concatTokens()} TO ${uniqueName}.\n`;
|
|
88604
|
+
if ((correspondingBody === null || correspondingBody === void 0 ? void 0 : correspondingBody.findDirectTokenByText("EXCEPT")) !== undefined) {
|
|
88605
|
+
// MOVE-CORRESPONDING has no EXCEPT, move everything and clear the excepted components afterwards
|
|
88606
|
+
if (correspondingBody.findDirectExpression(Expressions.CorrespondingBodyMapping) !== undefined
|
|
88607
|
+
|| !(this.findCorrespondingType(s, high, lowFile, highSyntax) instanceof basic_1.StructureType)) {
|
|
88608
|
+
continue;
|
|
88609
|
+
}
|
|
88610
|
+
const children = correspondingBody.getChildren();
|
|
88611
|
+
const exceptIndex = children.findIndex(c => c instanceof nodes_1.TokenNode && c.getFirstToken().getStr().toUpperCase() === "EXCEPT");
|
|
88612
|
+
const fields = correspondingBody.findDirectExpressions(Expressions.Field);
|
|
88613
|
+
if (fields.length === 0) {
|
|
88614
|
+
// EXCEPT *, without MAPPING nothing is moved
|
|
88615
|
+
move = "";
|
|
88616
|
+
}
|
|
88617
|
+
else {
|
|
88618
|
+
const body = children.slice(0, exceptIndex).map(c => c.concatTokens()).join(" ");
|
|
88619
|
+
move = indentation + `MOVE-CORRESPONDING ${body} TO ${uniqueName}.\n`;
|
|
88620
|
+
for (const f of fields) {
|
|
88621
|
+
move += indentation + `CLEAR ${uniqueName}-${f.concatTokens()}.\n`;
|
|
88622
|
+
}
|
|
88623
|
+
}
|
|
88624
|
+
}
|
|
87963
88625
|
const abap = `DATA ${uniqueName} ${type}.\n` +
|
|
87964
88626
|
indentation + `CLEAR ${uniqueName}.\n` + // might be called inside a loop
|
|
87965
|
-
|
|
88627
|
+
move +
|
|
87966
88628
|
indentation;
|
|
87967
88629
|
const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getFirstToken().getStart(), abap);
|
|
87968
88630
|
const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, firstToken.getStart(), s.getLastToken().getEnd(), uniqueName);
|
|
@@ -88206,6 +88868,33 @@ ${indentation} output = ${uniqueName}.\n`;
|
|
|
88206
88868
|
const issue = issue_1.Issue.atPosition(lowFile, pos, "Rename before outline", this.getMetadata().key, this.conf.severity, fix);
|
|
88207
88869
|
throw new SkipToNextFile(issue);
|
|
88208
88870
|
}
|
|
88871
|
+
/** the type of the value a CORRESPONDING operator returns, if it can be determined */
|
|
88872
|
+
findCorrespondingType(s, high, lowFile, highSyntax) {
|
|
88873
|
+
var _a, _b;
|
|
88874
|
+
const expr = s.findDirectExpression(Expressions.TypeNameOrInfer);
|
|
88875
|
+
if (expr === undefined) {
|
|
88876
|
+
return undefined;
|
|
88877
|
+
}
|
|
88878
|
+
const spag = highSyntax.spaghetti.lookupPosition(expr.getFirstToken().getStart(), lowFile.getFilename());
|
|
88879
|
+
if (spag === undefined) {
|
|
88880
|
+
return undefined;
|
|
88881
|
+
}
|
|
88882
|
+
if (expr.concatTokens() !== "#") {
|
|
88883
|
+
return (_a = spag.findType(expr.concatTokens())) === null || _a === void 0 ? void 0 : _a.getType();
|
|
88884
|
+
}
|
|
88885
|
+
for (const r of spag.getData().references) {
|
|
88886
|
+
if (r.referenceType === _reference_1.ReferenceType.InferredType
|
|
88887
|
+
&& r.resolved instanceof _typed_identifier_1.TypedIdentifier
|
|
88888
|
+
&& r.position.getStart().equals(expr.getFirstToken().getStart())) {
|
|
88889
|
+
return r.resolved.getType();
|
|
88890
|
+
}
|
|
88891
|
+
}
|
|
88892
|
+
const target = high.findDirectExpression(Expressions.Target);
|
|
88893
|
+
if (high.get() instanceof Statements.Move && high.findDirectExpression(Expressions.Source) === s && target !== undefined) {
|
|
88894
|
+
return (_b = spag.findVariable(target.concatTokens())) === null || _b === void 0 ? void 0 : _b.getType();
|
|
88895
|
+
}
|
|
88896
|
+
return undefined;
|
|
88897
|
+
}
|
|
88209
88898
|
findType(i, lowFile, highSyntax, ref = false) {
|
|
88210
88899
|
var _a, _b;
|
|
88211
88900
|
const expr = i.findDirectExpression(Expressions.TypeNameOrInfer);
|
|
@@ -88282,6 +88971,48 @@ ${indentation} output = ${uniqueName}.\n`;
|
|
|
88282
88971
|
}
|
|
88283
88972
|
return undefined;
|
|
88284
88973
|
}
|
|
88974
|
+
/** READ TABLE [REFERENCE] INTO DATA( ) where the row type is void, no TYPE can be written, use LIKE LINE OF like LOOP does */
|
|
88975
|
+
outlineReadTableVoidTarget(node, lowFile, highSyntax) {
|
|
88976
|
+
var _a, _b;
|
|
88977
|
+
if (!(node.get() instanceof Statements.ReadTable)) {
|
|
88978
|
+
return undefined;
|
|
88979
|
+
}
|
|
88980
|
+
if (this.lowReg.getConfig().isOpenABAP()) {
|
|
88981
|
+
return undefined;
|
|
88982
|
+
}
|
|
88983
|
+
const source = node.findDirectExpression(Expressions.SimpleSource2);
|
|
88984
|
+
const target = node.findDirectExpression(Expressions.ReadTableTarget);
|
|
88985
|
+
const inline = (_a = target === null || target === void 0 ? void 0 : target.findDirectExpression(Expressions.Target)) === null || _a === void 0 ? void 0 : _a.findDirectExpression(Expressions.InlineData);
|
|
88986
|
+
if (source === undefined || target === undefined || inline === undefined) {
|
|
88987
|
+
return undefined;
|
|
88988
|
+
}
|
|
88989
|
+
const nameToken = (_b = inline.findDirectExpression(Expressions.TargetField)) === null || _b === void 0 ? void 0 : _b.getFirstToken();
|
|
88990
|
+
if (nameToken === undefined) {
|
|
88991
|
+
return undefined;
|
|
88992
|
+
}
|
|
88993
|
+
const name = nameToken.getStr();
|
|
88994
|
+
const spag = highSyntax.spaghetti.lookupPosition(nameToken.getStart(), lowFile.getFilename());
|
|
88995
|
+
const found = spag === null || spag === void 0 ? void 0 : spag.findVariable(name);
|
|
88996
|
+
const table = spag === null || spag === void 0 ? void 0 : spag.findVariable(source.concatTokens());
|
|
88997
|
+
const isReference = target.findDirectTokenByText("REFERENCE") !== undefined;
|
|
88998
|
+
if (isReference === true && !((table === null || table === void 0 ? void 0 : table.getType()) instanceof basic_1.VoidType)) {
|
|
88999
|
+
return undefined;
|
|
89000
|
+
}
|
|
89001
|
+
else if (isReference === false
|
|
89002
|
+
&& (!((found === null || found === void 0 ? void 0 : found.getType()) instanceof basic_1.VoidType) || found.getType().getQualifiedName() !== undefined)) {
|
|
89003
|
+
return undefined;
|
|
89004
|
+
}
|
|
89005
|
+
const indentation = " ".repeat(node.getFirstToken().getStart().getCol() - 1);
|
|
89006
|
+
let code = `DATA ${name} LIKE LINE OF ${source.concatTokens()}.\n${indentation}`;
|
|
89007
|
+
if (isReference === true) {
|
|
89008
|
+
const likeName = this.uniqueName(node.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
|
|
89009
|
+
code = `DATA ${likeName} LIKE LINE OF ${source.concatTokens()}.\n${indentation}DATA ${name} LIKE REF TO ${likeName}.\n${indentation}`;
|
|
89010
|
+
}
|
|
89011
|
+
const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, node.getFirstToken().getStart(), code);
|
|
89012
|
+
const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, inline.getFirstToken().getStart(), inline.getLastToken().getEnd(), name);
|
|
89013
|
+
const fix = edit_helper_1.EditHelper.merge(fix2, fix1);
|
|
89014
|
+
return issue_1.Issue.atToken(lowFile, inline.getFirstToken(), "Outline DATA", this.getMetadata().key, this.conf.severity, fix);
|
|
89015
|
+
}
|
|
88285
89016
|
outlineData(node, lowFile, highSyntax) {
|
|
88286
89017
|
// hmm, no guard here, as DATA(SDF) is valid in 702
|
|
88287
89018
|
var _a, _b;
|
|
@@ -88806,6 +89537,54 @@ ${indentation} output = ${uniqueName}.\n`;
|
|
|
88806
89537
|
}
|
|
88807
89538
|
return undefined;
|
|
88808
89539
|
}
|
|
89540
|
+
/** IS [NOT] INSTANCE OF is 750, outline it as a cast in a TRY before the statement,
|
|
89541
|
+
* the cast of an initial reference succeeds, while IS INSTANCE OF is false, hence the IS BOUND */
|
|
89542
|
+
replaceInstanceOf(low, high, lowFile, highSyntax, highFile) {
|
|
89543
|
+
if (!(low.get() instanceof _statement_1.Unknown)) {
|
|
89544
|
+
return undefined;
|
|
89545
|
+
}
|
|
89546
|
+
else if (!(high.get() instanceof Statements.If)
|
|
89547
|
+
&& !(high.get() instanceof Statements.ElseIf)
|
|
89548
|
+
&& !(high.get() instanceof Statements.Check)) {
|
|
89549
|
+
// the condition of eg. WHILE is evaluated more than once
|
|
89550
|
+
return undefined;
|
|
89551
|
+
}
|
|
89552
|
+
for (const c of high.findAllExpressionsRecursive(Expressions.Compare)) {
|
|
89553
|
+
const className = c.findDirectExpression(Expressions.ClassName);
|
|
89554
|
+
const source = c.findDirectExpression(Expressions.Source);
|
|
89555
|
+
if (className === undefined || source === undefined) {
|
|
89556
|
+
continue;
|
|
89557
|
+
}
|
|
89558
|
+
const children = c.getChildren();
|
|
89559
|
+
const operator = children.slice(children.indexOf(source) + 1).map(n => n.concatTokens().toUpperCase()).join(" ");
|
|
89560
|
+
const negated = operator.startsWith("IS NOT INSTANCE OF");
|
|
89561
|
+
let insertAt = high.getFirstToken().getStart();
|
|
89562
|
+
if (high.get() instanceof Statements.ElseIf) {
|
|
89563
|
+
// assumption: no side effects in IF conditions
|
|
89564
|
+
insertAt = this.findStartOfIf(high, highFile);
|
|
89565
|
+
if (insertAt === undefined) {
|
|
89566
|
+
return undefined;
|
|
89567
|
+
}
|
|
89568
|
+
}
|
|
89569
|
+
const castName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
|
|
89570
|
+
const boolName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
|
|
89571
|
+
const indentation = " ".repeat(insertAt.getCol() - 1);
|
|
89572
|
+
const code = `DATA ${castName} TYPE REF TO ${className.concatTokens()}.
|
|
89573
|
+
${indentation}DATA ${boolName} TYPE abap_bool.
|
|
89574
|
+
${indentation}TRY.
|
|
89575
|
+
${indentation} ${castName} ?= ${source.concatTokens()}.
|
|
89576
|
+
${indentation} ${boolName} = boolc( ${castName} IS BOUND ).
|
|
89577
|
+
${indentation} CATCH cx_sy_move_cast_error.
|
|
89578
|
+
${indentation} ${boolName} = abap_false.
|
|
89579
|
+
${indentation}ENDTRY.
|
|
89580
|
+
${indentation}`;
|
|
89581
|
+
const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, insertAt, code);
|
|
89582
|
+
const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, source.getFirstToken().getStart(), className.getLastToken().getEnd(), boolName + (negated ? " = abap_false" : " = abap_true"));
|
|
89583
|
+
const fix = edit_helper_1.EditHelper.merge(fix2, fix1);
|
|
89584
|
+
return issue_1.Issue.atToken(lowFile, source.getFirstToken(), "Downport IS INSTANCE OF", this.getMetadata().key, this.conf.severity, fix);
|
|
89585
|
+
}
|
|
89586
|
+
return undefined;
|
|
89587
|
+
}
|
|
88809
89588
|
/** sy-subrc and sy-tabix, when read from the position on, in the procedure around it or the file outside of one;
|
|
88810
89589
|
* inside a loop from the start of the outermost loop, as the next pass reads what this one left */
|
|
88811
89590
|
readSyFields(position, highFile) {
|
|
@@ -115704,9 +116483,14 @@ class CDSDatabaseView {
|
|
|
115704
116483
|
reg;
|
|
115705
116484
|
viewName = "";
|
|
115706
116485
|
sources = [];
|
|
116486
|
+
dependencies = new Set();
|
|
115707
116487
|
constructor(reg) {
|
|
115708
116488
|
this.reg = reg;
|
|
115709
116489
|
}
|
|
116490
|
+
/** Names of the CDS views selected from, valid after build() */
|
|
116491
|
+
getDependencies() {
|
|
116492
|
+
return Array.from(this.dependencies);
|
|
116493
|
+
}
|
|
115710
116494
|
build(obj) {
|
|
115711
116495
|
this.viewName = obj.getName();
|
|
115712
116496
|
const tree = new abaplint.CDSParser().parse(obj.findSourceFile());
|
|
@@ -115762,8 +116546,11 @@ class CDSDatabaseView {
|
|
|
115762
116546
|
return this.unsupported("expected a table source");
|
|
115763
116547
|
}
|
|
115764
116548
|
const name = this.name(nameNode);
|
|
115765
|
-
if (this.reg.getObject("
|
|
115766
|
-
|
|
116549
|
+
if (this.reg.getObject("DDLS", name) instanceof abaplint.Objects.DataDefinition) {
|
|
116550
|
+
this.dependencies.add(name);
|
|
116551
|
+
}
|
|
116552
|
+
else if (this.reg.getObject("TABL", name) === undefined && this.reg.getObject("VIEW", name) === undefined) {
|
|
116553
|
+
return this.unsupported(`source ${name} does not resolve to a TABL, VIEW or DDLS`);
|
|
115767
116554
|
}
|
|
115768
116555
|
const as = node.findDirectExpression(cds.CDSAs);
|
|
115769
116556
|
const alias = as?.findDirectExpression(cds.CDSName) || node.findDirectExpression(cds.CDSName);
|
|
@@ -115960,16 +116747,40 @@ class DatabaseSetup {
|
|
|
115960
116747
|
}
|
|
115961
116748
|
////////////////////
|
|
115962
116749
|
buildCDSViews() {
|
|
115963
|
-
const views =
|
|
116750
|
+
const views = new Map();
|
|
115964
116751
|
for (const obj of this.reg.getObjects()) {
|
|
115965
116752
|
if (obj instanceof abaplint.Objects.DataDefinition) {
|
|
115966
|
-
const
|
|
115967
|
-
|
|
115968
|
-
|
|
116753
|
+
const builder = new cds_database_view_1.CDSDatabaseView(this.reg);
|
|
116754
|
+
const sql = builder.build(obj);
|
|
116755
|
+
if (sql !== undefined) {
|
|
116756
|
+
views.set(obj.getName().toLowerCase(), { sql, dependencies: builder.getDependencies() });
|
|
115969
116757
|
}
|
|
115970
116758
|
}
|
|
115971
116759
|
}
|
|
115972
|
-
|
|
116760
|
+
// CDS views selecting from other CDS views must be created after their sources
|
|
116761
|
+
const result = [];
|
|
116762
|
+
const done = new Set();
|
|
116763
|
+
const visiting = new Set();
|
|
116764
|
+
const visit = (name) => {
|
|
116765
|
+
const view = views.get(name);
|
|
116766
|
+
if (view === undefined || done.has(name)) {
|
|
116767
|
+
return;
|
|
116768
|
+
}
|
|
116769
|
+
else if (visiting.has(name)) {
|
|
116770
|
+
throw new Error(`CDS view ${name}: cyclic dependency`);
|
|
116771
|
+
}
|
|
116772
|
+
visiting.add(name);
|
|
116773
|
+
for (const dependency of view.dependencies) {
|
|
116774
|
+
visit(dependency);
|
|
116775
|
+
}
|
|
116776
|
+
visiting.delete(name);
|
|
116777
|
+
done.add(name);
|
|
116778
|
+
result.push(view.sql);
|
|
116779
|
+
};
|
|
116780
|
+
for (const name of views.keys()) {
|
|
116781
|
+
visit(name);
|
|
116782
|
+
}
|
|
116783
|
+
return result;
|
|
115973
116784
|
}
|
|
115974
116785
|
driver(schemaGenerator) {
|
|
115975
116786
|
const statements = [];
|
|
@@ -120947,7 +121758,7 @@ class SQLCondTranspiler {
|
|
|
120947
121758
|
if (found) {
|
|
120948
121759
|
let name = traversal.prefixAndName(alias.getFirstToken(), filename).replace("~", "$");
|
|
120949
121760
|
name = traversal_1.Traversal.escapeNamespace(name);
|
|
120950
|
-
ret += "'\" + " + name + ".get() + \"'";
|
|
121761
|
+
ret += "'\" + abap.sqlEscape(" + name + ".get()) + \"'";
|
|
120951
121762
|
}
|
|
120952
121763
|
else {
|
|
120953
121764
|
let concat = source.concatTokens();
|
|
@@ -120962,10 +121773,10 @@ class SQLCondTranspiler {
|
|
|
120962
121773
|
const conversionField = traversal.isSQLConversion(source.getFirstToken());
|
|
120963
121774
|
if (conversionField) {
|
|
120964
121775
|
const field = (table?.parseType(traversal.reg)).getComponentByName(conversionField);
|
|
120965
|
-
ret += "'\" + " + traversal.toType(field) + ".set(" + concat + ").get() + \"'";
|
|
121776
|
+
ret += "'\" + abap.sqlEscape(" + traversal.toType(field) + ".set(" + concat + ").get()) + \"'";
|
|
120966
121777
|
}
|
|
120967
121778
|
else if (concat.startsWith("`")) {
|
|
120968
|
-
ret += "'" + concat.substring(1, concat.length - 1) + "'";
|
|
121779
|
+
ret += "'" + concat.substring(1, concat.length - 1).replace(/'/g, "''") + "'";
|
|
120969
121780
|
}
|
|
120970
121781
|
else {
|
|
120971
121782
|
ret += concat;
|
|
@@ -120975,9 +121786,10 @@ class SQLCondTranspiler {
|
|
|
120975
121786
|
}
|
|
120976
121787
|
sqlHost(code, numericHost) {
|
|
120977
121788
|
if (numericHost) {
|
|
120978
|
-
return `" + ((value) => typeof value === "number" || typeof value === "bigint" ? value
|
|
121789
|
+
return `" + ((value) => typeof value === "number" || typeof value === "bigint" ? value `
|
|
121790
|
+
+ `: "'" + abap.sqlEscape(value) + "'")(${code}) + "`;
|
|
120979
121791
|
}
|
|
120980
|
-
return "'\" + " + code + " + \"'";
|
|
121792
|
+
return "'\" + abap.sqlEscape(" + code + ") + \"'";
|
|
120981
121793
|
}
|
|
120982
121794
|
basicConditionNew(node, traversal, filename, table) {
|
|
120983
121795
|
const sourceWithComponents = this.sourceWithComponents(node, traversal);
|
|
@@ -120998,7 +121810,7 @@ class SQLCondTranspiler {
|
|
|
120998
121810
|
&& child instanceof abaplint.Nodes.ExpressionNode
|
|
120999
121811
|
&& child.get() instanceof abaplint.Expressions.SimpleSource3) {
|
|
121000
121812
|
const code = new simple_source3_1.SimpleSource3Transpiler(true).transpile(child, traversal).getCode();
|
|
121001
|
-
ret += `'" + ${code} + "'`;
|
|
121813
|
+
ret += `'" + abap.sqlEscape(${code}) + "'`;
|
|
121002
121814
|
hostExpression = false;
|
|
121003
121815
|
}
|
|
121004
121816
|
else if ((child.get() instanceof abaplint.Expressions.SQLFieldName
|
|
@@ -121007,7 +121819,7 @@ class SQLCondTranspiler {
|
|
|
121007
121819
|
if (hostExpression) {
|
|
121008
121820
|
let name = traversal.prefixAndName(child.getFirstToken(), filename).replace("~", "$");
|
|
121009
121821
|
name = traversal_1.Traversal.prefixVariable(traversal_1.Traversal.escapeNamespace(name));
|
|
121010
|
-
ret += `'" + ${name}.get() + "'`;
|
|
121822
|
+
ret += `'" + abap.sqlEscape(${name}.get()) + "'`;
|
|
121011
121823
|
hostExpression = false;
|
|
121012
121824
|
}
|
|
121013
121825
|
else {
|
|
@@ -121070,7 +121882,7 @@ class SQLCondTranspiler {
|
|
|
121070
121882
|
}
|
|
121071
121883
|
code += ".get()";
|
|
121072
121884
|
const field = new sql_field_name_1.SQLFieldNameTranspiler().transpile(fieldName, traversal).getCode();
|
|
121073
|
-
return `${field} ${this.sqlOperator(operator.concatTokens())} '" + ${code} + "'`;
|
|
121885
|
+
return `${field} ${this.sqlOperator(operator.concatTokens())} '" + abap.sqlEscape(${code}) + "'`;
|
|
121074
121886
|
}
|
|
121075
121887
|
sqlOperator(op) {
|
|
121076
121888
|
if (op.toUpperCase() === "EQ") {
|
|
@@ -121150,7 +121962,7 @@ class SQLFieldTranspiler {
|
|
|
121150
121962
|
chunk.appendChunk(new sql_field_name_1.SQLFieldNameTranspiler().transpile(c, traversal));
|
|
121151
121963
|
}
|
|
121152
121964
|
else if (c.get() instanceof abaplint.Expressions.SimpleFieldChain2) {
|
|
121153
|
-
chunk.appendString(`'" + ` + new field_chain_1.FieldChainTranspiler().transpile(c, traversal).getCode() + `.get() + "' `);
|
|
121965
|
+
chunk.appendString(`'" + abap.sqlEscape(` + new field_chain_1.FieldChainTranspiler().transpile(c, traversal).getCode() + `.get()) + "' `);
|
|
121154
121966
|
}
|
|
121155
121967
|
else {
|
|
121156
121968
|
chunk.appendString(c.concatTokens() + " ");
|
|
@@ -121226,7 +122038,7 @@ class SQLFieldAndValueTranspiler {
|
|
|
121226
122038
|
const source = traversal.traverse(n);
|
|
121227
122039
|
// todo: value conversion? abap vs db, traversal.isSQLConversion
|
|
121228
122040
|
// todo: integers?
|
|
121229
|
-
chunk.appendString("'\" + " + source.getCode() + ".get() + \"'");
|
|
122041
|
+
chunk.appendString("'\" + abap.sqlEscape(" + source.getCode() + ".get()) + \"'");
|
|
121230
122042
|
}
|
|
121231
122043
|
else if (n instanceof abaplint.Nodes.TokenNode) {
|
|
121232
122044
|
// operators/keywords, eg. the "+" in "field = field + value"
|
|
@@ -122987,9 +123799,18 @@ const rearranger_1 = __webpack_require__(/*! ../rearranger */ "./node_modules/@a
|
|
|
122987
123799
|
const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/transpiler/build/src/chunk.js");
|
|
122988
123800
|
const output_layout_1 = __webpack_require__(/*! ../output_layout */ "./node_modules/@abaplint/transpiler/build/src/output_layout.js");
|
|
122989
123801
|
const type_factory_registry_1 = __webpack_require__(/*! ../type_factory_registry */ "./node_modules/@abaplint/transpiler/build/src/type_factory_registry.js");
|
|
123802
|
+
const program_includes_1 = __webpack_require__(/*! ../program_includes */ "./node_modules/@abaplint/transpiler/build/src/program_includes.js");
|
|
122990
123803
|
class HandleABAP {
|
|
122991
123804
|
layout;
|
|
123805
|
+
/** the function running the program, not a name a FORM or variable can be transpiled to */
|
|
123806
|
+
static PROGRAM_MAIN = "$main";
|
|
122992
123807
|
options;
|
|
123808
|
+
/** executable programs as modules, their event blocks and other executable code are wrapped in a function */
|
|
123809
|
+
static wrapsMain(obj, options) {
|
|
123810
|
+
return options?.addCommonJS === true
|
|
123811
|
+
&& obj instanceof abaplint.Objects.Program
|
|
123812
|
+
&& obj.isInclude() === false;
|
|
123813
|
+
}
|
|
122993
123814
|
constructor(options, layout = new output_layout_1.OutputLayout()) {
|
|
122994
123815
|
this.layout = layout;
|
|
122995
123816
|
this.options = options;
|
|
@@ -123029,13 +123850,33 @@ class HandleABAP {
|
|
|
123029
123850
|
throw new Error("HandleABAP, file has no structure, probably a syntax error: " + file.getFilename());
|
|
123030
123851
|
}
|
|
123031
123852
|
const rearranged = new rearranger_1.Rearranger().run(obj.getType(), file.getStructure());
|
|
123032
|
-
const
|
|
123853
|
+
const traversal = new traversal_1.Traversal(spaghetti, file, obj, reg, this.options, typeFactory);
|
|
123854
|
+
const wrapMain = HandleABAP.wrapsMain(obj, this.options);
|
|
123855
|
+
if (wrapMain) {
|
|
123856
|
+
traversal.programMain = new chunk_1.Chunk();
|
|
123857
|
+
}
|
|
123858
|
+
const contents = traversal.traverse(rearranged);
|
|
123033
123859
|
chunk.appendChunk(contents);
|
|
123860
|
+
if (wrapMain) {
|
|
123861
|
+
// the program runs when main is called, importing the module eg. for unit testing does not run it
|
|
123862
|
+
chunk.appendString(`async function ${HandleABAP.PROGRAM_MAIN}() {\n`);
|
|
123863
|
+
chunk.appendChunk(traversal.programMain);
|
|
123864
|
+
chunk.appendString("}\n");
|
|
123865
|
+
}
|
|
123034
123866
|
chunk.stripLastNewline();
|
|
123035
123867
|
if (this.options?.sharedTypeFactories !== true) {
|
|
123036
123868
|
chunk.runIndentationLogic(this.options?.ignoreSourceMap);
|
|
123037
123869
|
}
|
|
123038
123870
|
const exports = this.findExports(file.getStructure());
|
|
123871
|
+
if (obj instanceof abaplint.Objects.Program) {
|
|
123872
|
+
// INCLUDEs are expanded into the program, so export their contents too
|
|
123873
|
+
for (const include of (0, program_includes_1.findProgramIncludes)(file, reg)) {
|
|
123874
|
+
exports.push(...this.findExports(include.getStructure()).filter(e => exports.includes(e) === false));
|
|
123875
|
+
}
|
|
123876
|
+
}
|
|
123877
|
+
if (wrapMain) {
|
|
123878
|
+
exports.push(HandleABAP.PROGRAM_MAIN);
|
|
123879
|
+
}
|
|
123039
123880
|
const output = {
|
|
123040
123881
|
object: {
|
|
123041
123882
|
name: obj.getName(),
|
|
@@ -124433,6 +125274,84 @@ function importPath(from, to) {
|
|
|
124433
125274
|
|
|
124434
125275
|
/***/ },
|
|
124435
125276
|
|
|
125277
|
+
/***/ "./node_modules/@abaplint/transpiler/build/src/program_includes.js"
|
|
125278
|
+
/*!*************************************************************************!*\
|
|
125279
|
+
!*** ./node_modules/@abaplint/transpiler/build/src/program_includes.js ***!
|
|
125280
|
+
\*************************************************************************/
|
|
125281
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
125282
|
+
|
|
125283
|
+
"use strict";
|
|
125284
|
+
|
|
125285
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
125286
|
+
if (k2 === undefined) k2 = k;
|
|
125287
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
125288
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
125289
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
125290
|
+
}
|
|
125291
|
+
Object.defineProperty(o, k2, desc);
|
|
125292
|
+
}) : (function(o, m, k, k2) {
|
|
125293
|
+
if (k2 === undefined) k2 = k;
|
|
125294
|
+
o[k2] = m[k];
|
|
125295
|
+
}));
|
|
125296
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
125297
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
125298
|
+
}) : function(o, v) {
|
|
125299
|
+
o["default"] = v;
|
|
125300
|
+
});
|
|
125301
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
125302
|
+
var ownKeys = function(o) {
|
|
125303
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
125304
|
+
var ar = [];
|
|
125305
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
125306
|
+
return ar;
|
|
125307
|
+
};
|
|
125308
|
+
return ownKeys(o);
|
|
125309
|
+
};
|
|
125310
|
+
return function (mod) {
|
|
125311
|
+
if (mod && mod.__esModule) return mod;
|
|
125312
|
+
var result = {};
|
|
125313
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
125314
|
+
__setModuleDefault(result, mod);
|
|
125315
|
+
return result;
|
|
125316
|
+
};
|
|
125317
|
+
})();
|
|
125318
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
125319
|
+
exports.filesWithProgramIncludes = filesWithProgramIncludes;
|
|
125320
|
+
exports.findProgramIncludes = findProgramIncludes;
|
|
125321
|
+
const abaplint = __importStar(__webpack_require__(/*! @abaplint/core */ "./node_modules/@abaplint/core/build/src/index.js"));
|
|
125322
|
+
/** the files of the object, for programs also the files of the include programs expanded into it */
|
|
125323
|
+
function filesWithProgramIncludes(obj, reg) {
|
|
125324
|
+
const files = obj.getSequencedFiles();
|
|
125325
|
+
if (!(obj instanceof abaplint.Objects.Program) || obj.isInclude() === true) {
|
|
125326
|
+
return files;
|
|
125327
|
+
}
|
|
125328
|
+
const ret = [...files];
|
|
125329
|
+
const visited = new Set();
|
|
125330
|
+
for (const file of files) {
|
|
125331
|
+
ret.push(...findProgramIncludes(file, reg, visited));
|
|
125332
|
+
}
|
|
125333
|
+
return ret;
|
|
125334
|
+
}
|
|
125335
|
+
/** include programs referenced by INCLUDE statements in the file, recursively, each returned once */
|
|
125336
|
+
function findProgramIncludes(file, reg, visited = new Set()) {
|
|
125337
|
+
const ret = [];
|
|
125338
|
+
for (const statement of file.getStructure()?.findAllStatements(abaplint.Statements.Include) || []) {
|
|
125339
|
+
const name = statement.findDirectExpression(abaplint.Expressions.IncludeName)?.concatTokens().toUpperCase();
|
|
125340
|
+
if (name === undefined || visited.has(name)) {
|
|
125341
|
+
continue;
|
|
125342
|
+
}
|
|
125343
|
+
visited.add(name);
|
|
125344
|
+
const include = reg.getObject("PROG", name)?.getMainABAPFile();
|
|
125345
|
+
if (include !== undefined) {
|
|
125346
|
+
ret.push(include, ...findProgramIncludes(include, reg, visited));
|
|
125347
|
+
}
|
|
125348
|
+
}
|
|
125349
|
+
return ret;
|
|
125350
|
+
}
|
|
125351
|
+
//# sourceMappingURL=program_includes.js.map
|
|
125352
|
+
|
|
125353
|
+
/***/ },
|
|
125354
|
+
|
|
124436
125355
|
/***/ "./node_modules/@abaplint/transpiler/build/src/rearranger.js"
|
|
124437
125356
|
/*!*******************************************************************!*\
|
|
124438
125357
|
!*** ./node_modules/@abaplint/transpiler/build/src/rearranger.js ***!
|
|
@@ -124701,6 +125620,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
124701
125620
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
124702
125621
|
exports.Requires = void 0;
|
|
124703
125622
|
const abaplint = __importStar(__webpack_require__(/*! @abaplint/core */ "./node_modules/@abaplint/core/build/src/index.js"));
|
|
125623
|
+
const program_includes_1 = __webpack_require__(/*! ./program_includes */ "./node_modules/@abaplint/transpiler/build/src/program_includes.js");
|
|
124704
125624
|
class Requires {
|
|
124705
125625
|
reg;
|
|
124706
125626
|
constructor(reg) {
|
|
@@ -124783,7 +125703,7 @@ class Requires {
|
|
|
124783
125703
|
}
|
|
124784
125704
|
}
|
|
124785
125705
|
// include global super classes for local class definitions
|
|
124786
|
-
for (const f of obj.
|
|
125706
|
+
for (const f of (0, program_includes_1.filesWithProgramIncludes)(obj, this.reg)) {
|
|
124787
125707
|
for (const c of f.getInfo().listClassDefinitions()) {
|
|
124788
125708
|
if (c.superClassName === undefined) {
|
|
124789
125709
|
continue;
|
|
@@ -124901,6 +125821,150 @@ exports.DatasetOperands = DatasetOperands;
|
|
|
124901
125821
|
|
|
124902
125822
|
/***/ },
|
|
124903
125823
|
|
|
125824
|
+
/***/ "./node_modules/@abaplint/transpiler/build/src/statements/_eml.js"
|
|
125825
|
+
/*!************************************************************************!*\
|
|
125826
|
+
!*** ./node_modules/@abaplint/transpiler/build/src/statements/_eml.js ***!
|
|
125827
|
+
\************************************************************************/
|
|
125828
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
125829
|
+
|
|
125830
|
+
"use strict";
|
|
125831
|
+
|
|
125832
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
125833
|
+
if (k2 === undefined) k2 = k;
|
|
125834
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
125835
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
125836
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
125837
|
+
}
|
|
125838
|
+
Object.defineProperty(o, k2, desc);
|
|
125839
|
+
}) : (function(o, m, k, k2) {
|
|
125840
|
+
if (k2 === undefined) k2 = k;
|
|
125841
|
+
o[k2] = m[k];
|
|
125842
|
+
}));
|
|
125843
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
125844
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
125845
|
+
}) : function(o, v) {
|
|
125846
|
+
o["default"] = v;
|
|
125847
|
+
});
|
|
125848
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
125849
|
+
var ownKeys = function(o) {
|
|
125850
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
125851
|
+
var ar = [];
|
|
125852
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
125853
|
+
return ar;
|
|
125854
|
+
};
|
|
125855
|
+
return ownKeys(o);
|
|
125856
|
+
};
|
|
125857
|
+
return function (mod) {
|
|
125858
|
+
if (mod && mod.__esModule) return mod;
|
|
125859
|
+
var result = {};
|
|
125860
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
125861
|
+
__setModuleDefault(result, mod);
|
|
125862
|
+
return result;
|
|
125863
|
+
};
|
|
125864
|
+
})();
|
|
125865
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
125866
|
+
exports.EMLWalker = exports.KERNEL_RAP_EML = void 0;
|
|
125867
|
+
exports.abapString = abapString;
|
|
125868
|
+
exports.abapFlag = abapFlag;
|
|
125869
|
+
exports.unsupportedAddition = unsupportedAddition;
|
|
125870
|
+
exports.emitCalls = emitCalls;
|
|
125871
|
+
const abaplint = __importStar(__webpack_require__(/*! @abaplint/core */ "./node_modules/@abaplint/core/build/src/index.js"));
|
|
125872
|
+
const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/transpiler/build/src/chunk.js");
|
|
125873
|
+
/** The kernel class the EML statements are lowered to. One call per
|
|
125874
|
+
* operation of a statement; the names travel as strings, the FROM / WITH
|
|
125875
|
+
* table and the MAPPED, FAILED, REPORTED and RESULT targets as they are,
|
|
125876
|
+
* and only the targets the statement names are passed, the kernel binds
|
|
125877
|
+
* the rest. */
|
|
125878
|
+
exports.KERNEL_RAP_EML = "KERNEL_RAP_EML";
|
|
125879
|
+
function abapString(value) {
|
|
125880
|
+
return `new abap.types.String().set(${JSON.stringify(value)})`;
|
|
125881
|
+
}
|
|
125882
|
+
function abapFlag() {
|
|
125883
|
+
return `abap.CharacterFactory.get(1, 'X')`;
|
|
125884
|
+
}
|
|
125885
|
+
/** the EML forms this lowering does not handle, named in the statement */
|
|
125886
|
+
function unsupportedAddition(node, additions) {
|
|
125887
|
+
const tokens = node.getChildren().filter(c => c instanceof abaplint.Nodes.TokenNode).map(c => c.getFirstToken().getStr().toUpperCase());
|
|
125888
|
+
const text = " " + tokens.join(" ") + " ";
|
|
125889
|
+
for (const addition of additions) {
|
|
125890
|
+
if (text.includes(" " + addition + " ")) {
|
|
125891
|
+
return addition;
|
|
125892
|
+
}
|
|
125893
|
+
}
|
|
125894
|
+
if (node.findAllExpressions(abaplint.Expressions.EMLEntityPath).length > 0
|
|
125895
|
+
|| node.findAllExpressions(abaplint.Expressions.EntityAssociation).length > 0) {
|
|
125896
|
+
return "BY";
|
|
125897
|
+
}
|
|
125898
|
+
return undefined;
|
|
125899
|
+
}
|
|
125900
|
+
function emitCalls(name, lookup, calls, node, traversal) {
|
|
125901
|
+
const ret = `if (${lookup} === undefined) throw new Error("${name}, kernel class missing");\n` + calls.join("\n");
|
|
125902
|
+
return new chunk_1.Chunk().append(ret, node, traversal);
|
|
125903
|
+
}
|
|
125904
|
+
/** a walker over the flat token and expression sequence of an EML statement */
|
|
125905
|
+
class EMLWalker {
|
|
125906
|
+
children;
|
|
125907
|
+
index = 0;
|
|
125908
|
+
constructor(node) {
|
|
125909
|
+
this.children = node.getChildren();
|
|
125910
|
+
}
|
|
125911
|
+
done() {
|
|
125912
|
+
return this.index >= this.children.length;
|
|
125913
|
+
}
|
|
125914
|
+
/** the next child as an upper case keyword, or undefined for an expression */
|
|
125915
|
+
peekKeyword() {
|
|
125916
|
+
const child = this.children[this.index];
|
|
125917
|
+
if (child instanceof abaplint.Nodes.TokenNode) {
|
|
125918
|
+
return child.getFirstToken().getStr().toUpperCase();
|
|
125919
|
+
}
|
|
125920
|
+
return undefined;
|
|
125921
|
+
}
|
|
125922
|
+
takeKeyword() {
|
|
125923
|
+
const keyword = this.peekKeyword();
|
|
125924
|
+
if (keyword !== undefined) {
|
|
125925
|
+
this.index++;
|
|
125926
|
+
}
|
|
125927
|
+
return keyword;
|
|
125928
|
+
}
|
|
125929
|
+
/** consume the keywords in order, or nothing when they are not next */
|
|
125930
|
+
accept(...keywords) {
|
|
125931
|
+
for (let i = 0; i < keywords.length; i++) {
|
|
125932
|
+
const child = this.children[this.index + i];
|
|
125933
|
+
if (!(child instanceof abaplint.Nodes.TokenNode) || child.getFirstToken().getStr().toUpperCase() !== keywords[i]) {
|
|
125934
|
+
return false;
|
|
125935
|
+
}
|
|
125936
|
+
}
|
|
125937
|
+
this.index += keywords.length;
|
|
125938
|
+
return true;
|
|
125939
|
+
}
|
|
125940
|
+
takeExpression() {
|
|
125941
|
+
const child = this.children[this.index];
|
|
125942
|
+
if (!(child instanceof abaplint.Nodes.ExpressionNode)) {
|
|
125943
|
+
throw new Error("EML: expected an expression, got " + (child?.concatTokens() ?? "the end of the statement"));
|
|
125944
|
+
}
|
|
125945
|
+
this.index++;
|
|
125946
|
+
return child;
|
|
125947
|
+
}
|
|
125948
|
+
/** an entity, action or behavior definition name, upper case */
|
|
125949
|
+
takeName() {
|
|
125950
|
+
return this.takeExpression().concatTokens().toUpperCase();
|
|
125951
|
+
}
|
|
125952
|
+
/** the SimpleNames of FIELDS ( a b ) up to the closing parenthesis, upper case */
|
|
125953
|
+
takeFieldList() {
|
|
125954
|
+
const names = [];
|
|
125955
|
+
this.accept("(");
|
|
125956
|
+
while (!this.done() && this.peekKeyword() !== ")") {
|
|
125957
|
+
names.push(this.takeName());
|
|
125958
|
+
}
|
|
125959
|
+
this.accept(")");
|
|
125960
|
+
return names;
|
|
125961
|
+
}
|
|
125962
|
+
}
|
|
125963
|
+
exports.EMLWalker = EMLWalker;
|
|
125964
|
+
//# sourceMappingURL=_eml.js.map
|
|
125965
|
+
|
|
125966
|
+
/***/ },
|
|
125967
|
+
|
|
124904
125968
|
/***/ "./node_modules/@abaplint/transpiler/build/src/statements/_selection.js"
|
|
124905
125969
|
/*!******************************************************************************!*\
|
|
124906
125970
|
!*** ./node_modules/@abaplint/transpiler/build/src/statements/_selection.js ***!
|
|
@@ -126759,6 +127823,54 @@ exports.CommitTranspiler = CommitTranspiler;
|
|
|
126759
127823
|
|
|
126760
127824
|
/***/ },
|
|
126761
127825
|
|
|
127826
|
+
/***/ "./node_modules/@abaplint/transpiler/build/src/statements/commit_entities.js"
|
|
127827
|
+
/*!***********************************************************************************!*\
|
|
127828
|
+
!*** ./node_modules/@abaplint/transpiler/build/src/statements/commit_entities.js ***!
|
|
127829
|
+
\***********************************************************************************/
|
|
127830
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
127831
|
+
|
|
127832
|
+
"use strict";
|
|
127833
|
+
|
|
127834
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
127835
|
+
exports.CommitEntitiesTranspiler = void 0;
|
|
127836
|
+
const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/transpiler/build/src/chunk.js");
|
|
127837
|
+
const _eml_1 = __webpack_require__(/*! ./_eml */ "./node_modules/@abaplint/transpiler/build/src/statements/_eml.js");
|
|
127838
|
+
/** COMMIT ENTITIES [RESPONSE OF bdef FAILED f REPORTED r] [RESPONSES FAILED f REPORTED r]
|
|
127839
|
+
*
|
|
127840
|
+
* lowered to KERNEL_RAP_EML.commit with the behavior definition of
|
|
127841
|
+
* RESPONSE OF and the targets named; the kernel sets sy-subrc. Not
|
|
127842
|
+
* lowered: IN SIMULATION MODE. */
|
|
127843
|
+
class CommitEntitiesTranspiler {
|
|
127844
|
+
transpile(node, traversal) {
|
|
127845
|
+
const unsupported = (0, _eml_1.unsupportedAddition)(node, ["SIMULATION"]);
|
|
127846
|
+
if (unsupported !== undefined) {
|
|
127847
|
+
return new chunk_1.Chunk(`throw new Error("CommitEntities ${unsupported}, not supported, transpiler");`);
|
|
127848
|
+
}
|
|
127849
|
+
const lookup = traversal.lookupClassOrInterface(_eml_1.KERNEL_RAP_EML, node.getFirstToken());
|
|
127850
|
+
const walker = new _eml_1.EMLWalker(node);
|
|
127851
|
+
const options = [];
|
|
127852
|
+
while (!walker.done()) {
|
|
127853
|
+
const keyword = walker.takeKeyword();
|
|
127854
|
+
switch (keyword) {
|
|
127855
|
+
case "OF":
|
|
127856
|
+
options.push(`bdef: ${(0, _eml_1.abapString)(walker.takeName())}`);
|
|
127857
|
+
break;
|
|
127858
|
+
case "FAILED":
|
|
127859
|
+
case "REPORTED":
|
|
127860
|
+
options.push(`${keyword.toLowerCase()}: ${traversal.traverse(walker.takeExpression()).getCode()}`);
|
|
127861
|
+
break;
|
|
127862
|
+
default:
|
|
127863
|
+
break;
|
|
127864
|
+
}
|
|
127865
|
+
}
|
|
127866
|
+
return (0, _eml_1.emitCalls)("CommitEntities", lookup, [`await ${lookup}.commit({${options.join(", ")}});`], node, traversal);
|
|
127867
|
+
}
|
|
127868
|
+
}
|
|
127869
|
+
exports.CommitEntitiesTranspiler = CommitEntitiesTranspiler;
|
|
127870
|
+
//# sourceMappingURL=commit_entities.js.map
|
|
127871
|
+
|
|
127872
|
+
/***/ },
|
|
127873
|
+
|
|
126762
127874
|
/***/ "./node_modules/@abaplint/transpiler/build/src/statements/compute.js"
|
|
126763
127875
|
/*!***************************************************************************!*\
|
|
126764
127876
|
!*** ./node_modules/@abaplint/transpiler/build/src/statements/compute.js ***!
|
|
@@ -129781,6 +130893,21 @@ class IncludeTranspiler {
|
|
|
129781
130893
|
return chunk;
|
|
129782
130894
|
}
|
|
129783
130895
|
}
|
|
130896
|
+
if (obj instanceof abaplint.Objects.Program) {
|
|
130897
|
+
const prog = traversal.reg.getObject("PROG", includeName);
|
|
130898
|
+
const file = prog?.getMainABAPFile();
|
|
130899
|
+
if (file !== undefined) {
|
|
130900
|
+
// traversed with the spaghetti of the main program, the include can use its types and data
|
|
130901
|
+
const sub = new traversal_1.Traversal(traversal.getSpaghetti(), file, obj, traversal.reg, traversal.options, traversal.typeFactories);
|
|
130902
|
+
sub.programMain = traversal.programMain;
|
|
130903
|
+
const rearranged = new rearranger_1.Rearranger().run(obj.getType(), file.getStructure());
|
|
130904
|
+
const chunk = new chunk_1.Chunk();
|
|
130905
|
+
if (traversal.options?.addFilenames === true) {
|
|
130906
|
+
chunk.appendString("// " + file.getFilename() + "\n");
|
|
130907
|
+
}
|
|
130908
|
+
return chunk.appendChunk(sub.traverse(rearranged));
|
|
130909
|
+
}
|
|
130910
|
+
}
|
|
129784
130911
|
// todo, this will not work
|
|
129785
130912
|
return new chunk_1.Chunk("// transpiler TODO: INCLUDE " + includeName + "\n");
|
|
129786
130913
|
}
|
|
@@ -129843,6 +130970,7 @@ __exportStar(__webpack_require__(/*! ./close_cursor */ "./node_modules/@abaplint
|
|
|
129843
130970
|
__exportStar(__webpack_require__(/*! ./close_dataset */ "./node_modules/@abaplint/transpiler/build/src/statements/close_dataset.js"), exports);
|
|
129844
130971
|
__exportStar(__webpack_require__(/*! ./collect */ "./node_modules/@abaplint/transpiler/build/src/statements/collect.js"), exports);
|
|
129845
130972
|
__exportStar(__webpack_require__(/*! ./commit */ "./node_modules/@abaplint/transpiler/build/src/statements/commit.js"), exports);
|
|
130973
|
+
__exportStar(__webpack_require__(/*! ./commit_entities */ "./node_modules/@abaplint/transpiler/build/src/statements/commit_entities.js"), exports);
|
|
129846
130974
|
__exportStar(__webpack_require__(/*! ./compute */ "./node_modules/@abaplint/transpiler/build/src/statements/compute.js"), exports);
|
|
129847
130975
|
__exportStar(__webpack_require__(/*! ./concatenate */ "./node_modules/@abaplint/transpiler/build/src/statements/concatenate.js"), exports);
|
|
129848
130976
|
__exportStar(__webpack_require__(/*! ./end_of_selection */ "./node_modules/@abaplint/transpiler/build/src/statements/end_of_selection.js"), exports);
|
|
@@ -129945,6 +131073,7 @@ __exportStar(__webpack_require__(/*! ./reserve */ "./node_modules/@abaplint/tran
|
|
|
129945
131073
|
__exportStar(__webpack_require__(/*! ./retry */ "./node_modules/@abaplint/transpiler/build/src/statements/retry.js"), exports);
|
|
129946
131074
|
__exportStar(__webpack_require__(/*! ./return */ "./node_modules/@abaplint/transpiler/build/src/statements/return.js"), exports);
|
|
129947
131075
|
__exportStar(__webpack_require__(/*! ./rollback */ "./node_modules/@abaplint/transpiler/build/src/statements/rollback.js"), exports);
|
|
131076
|
+
__exportStar(__webpack_require__(/*! ./rollback_entities */ "./node_modules/@abaplint/transpiler/build/src/statements/rollback_entities.js"), exports);
|
|
129948
131077
|
__exportStar(__webpack_require__(/*! ./scan */ "./node_modules/@abaplint/transpiler/build/src/statements/scan.js"), exports);
|
|
129949
131078
|
__exportStar(__webpack_require__(/*! ./search */ "./node_modules/@abaplint/transpiler/build/src/statements/search.js"), exports);
|
|
129950
131079
|
__exportStar(__webpack_require__(/*! ./select_option */ "./node_modules/@abaplint/transpiler/build/src/statements/select_option.js"), exports);
|
|
@@ -131076,9 +132205,125 @@ exports.ModifyDatabaseTranspiler = ModifyDatabaseTranspiler;
|
|
|
131076
132205
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
131077
132206
|
exports.ModifyEntitiesTranspiler = void 0;
|
|
131078
132207
|
const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/transpiler/build/src/chunk.js");
|
|
132208
|
+
const _eml_1 = __webpack_require__(/*! ./_eml */ "./node_modules/@abaplint/transpiler/build/src/statements/_eml.js");
|
|
132209
|
+
/** MODIFY ENTITIES OF bdef ENTITY e CREATE|UPDATE|DELETE|EXECUTE ... MAPPED m FAILED f REPORTED r
|
|
132210
|
+
*
|
|
132211
|
+
* lowered to KERNEL_RAP_EML.begin with the MAPPED / FAILED / REPORTED
|
|
132212
|
+
* targets the statement names (the statement boundary: the kernel clears
|
|
132213
|
+
* them and binds scratch for the rest), then one modify / execute call per
|
|
132214
|
+
* operation in the order of the statement. Not lowered: the dynamic form (OPERATIONS), create by association (BY),
|
|
132215
|
+
* RELATING TO, AUGMENTING, and the deep forms. */
|
|
131079
132216
|
class ModifyEntitiesTranspiler {
|
|
131080
|
-
transpile(
|
|
131081
|
-
|
|
132217
|
+
transpile(node, traversal) {
|
|
132218
|
+
const unsupported = (0, _eml_1.unsupportedAddition)(node, ["OPERATIONS", "RELATING", "AUGMENTING"]);
|
|
132219
|
+
if (unsupported !== undefined) {
|
|
132220
|
+
return new chunk_1.Chunk(`throw new Error("ModifyEntities ${unsupported}, not supported, transpiler");`);
|
|
132221
|
+
}
|
|
132222
|
+
const lookup = traversal.lookupClassOrInterface(_eml_1.KERNEL_RAP_EML, node.getFirstToken());
|
|
132223
|
+
const walker = new _eml_1.EMLWalker(node);
|
|
132224
|
+
const operations = [];
|
|
132225
|
+
const targets = {};
|
|
132226
|
+
let bdef = "";
|
|
132227
|
+
let entity = "";
|
|
132228
|
+
let current = undefined;
|
|
132229
|
+
walker.accept("MODIFY");
|
|
132230
|
+
if (walker.accept("ENTITIES", "OF")) {
|
|
132231
|
+
bdef = walker.takeName();
|
|
132232
|
+
}
|
|
132233
|
+
else if (walker.accept("ENTITY")) {
|
|
132234
|
+
// the short form names the root entity by its behavior definition
|
|
132235
|
+
walker.accept("IN", "LOCAL", "MODE");
|
|
132236
|
+
bdef = walker.takeName();
|
|
132237
|
+
entity = bdef;
|
|
132238
|
+
}
|
|
132239
|
+
while (!walker.done()) {
|
|
132240
|
+
const keyword = walker.takeKeyword();
|
|
132241
|
+
switch (keyword) {
|
|
132242
|
+
case "ENTITY":
|
|
132243
|
+
entity = walker.takeName();
|
|
132244
|
+
break;
|
|
132245
|
+
case "CREATE":
|
|
132246
|
+
case "UPDATE":
|
|
132247
|
+
case "DELETE":
|
|
132248
|
+
current = { kind: keyword, entity };
|
|
132249
|
+
operations.push(current);
|
|
132250
|
+
break;
|
|
132251
|
+
case "EXECUTE":
|
|
132252
|
+
current = { kind: "EXECUTE", entity, action: walker.takeName() };
|
|
132253
|
+
operations.push(current);
|
|
132254
|
+
break;
|
|
132255
|
+
case "FROM":
|
|
132256
|
+
if (current) {
|
|
132257
|
+
current.rows = traversal.traverse(walker.takeExpression()).getCode();
|
|
132258
|
+
}
|
|
132259
|
+
break;
|
|
132260
|
+
case "FIELDS":
|
|
132261
|
+
if (current) {
|
|
132262
|
+
current.fields = walker.takeFieldList();
|
|
132263
|
+
}
|
|
132264
|
+
break;
|
|
132265
|
+
case "SET":
|
|
132266
|
+
// SET FIELDS WITH
|
|
132267
|
+
walker.accept("FIELDS");
|
|
132268
|
+
if (current) {
|
|
132269
|
+
current.setFields = true;
|
|
132270
|
+
}
|
|
132271
|
+
break;
|
|
132272
|
+
case "WITH":
|
|
132273
|
+
if (current) {
|
|
132274
|
+
current.rows = traversal.traverse(walker.takeExpression()).getCode();
|
|
132275
|
+
}
|
|
132276
|
+
break;
|
|
132277
|
+
case "AUTO":
|
|
132278
|
+
walker.accept("FILL", "CID");
|
|
132279
|
+
if (current) {
|
|
132280
|
+
current.autoFillCid = true;
|
|
132281
|
+
}
|
|
132282
|
+
break;
|
|
132283
|
+
case "MAPPED":
|
|
132284
|
+
case "FAILED":
|
|
132285
|
+
case "REPORTED":
|
|
132286
|
+
case "RESULT":
|
|
132287
|
+
targets[keyword.toLowerCase()] = traversal.traverse(walker.takeExpression()).getCode();
|
|
132288
|
+
break;
|
|
132289
|
+
default:
|
|
132290
|
+
// IN LOCAL MODE, PRIVILEGED, FORWARDING, the final period
|
|
132291
|
+
break;
|
|
132292
|
+
}
|
|
132293
|
+
}
|
|
132294
|
+
const calls = [];
|
|
132295
|
+
const statement = [`bdef: ${(0, _eml_1.abapString)(bdef)}`];
|
|
132296
|
+
for (const name of ["mapped", "failed", "reported"]) {
|
|
132297
|
+
if (targets[name] !== undefined) {
|
|
132298
|
+
statement.push(`${name}: ${targets[name]}`);
|
|
132299
|
+
}
|
|
132300
|
+
}
|
|
132301
|
+
calls.push(`await ${lookup}.begin({${statement.join(", ")}});`);
|
|
132302
|
+
for (const op of operations) {
|
|
132303
|
+
const options = [`bdef: ${(0, _eml_1.abapString)(bdef)}`, `entity: ${(0, _eml_1.abapString)(op.entity)}`];
|
|
132304
|
+
if (op.kind === "EXECUTE") {
|
|
132305
|
+
options.push(`action: ${(0, _eml_1.abapString)(op.action ?? "")}`);
|
|
132306
|
+
}
|
|
132307
|
+
else {
|
|
132308
|
+
options.push(`operation: ${(0, _eml_1.abapString)(op.kind)}`);
|
|
132309
|
+
}
|
|
132310
|
+
options.push(`rows: ${op.rows ?? "undefined"}`);
|
|
132311
|
+
if (op.fields !== undefined) {
|
|
132312
|
+
options.push(`fields: ${(0, _eml_1.abapString)(op.fields.join(","))}`);
|
|
132313
|
+
}
|
|
132314
|
+
if (op.setFields === true) {
|
|
132315
|
+
options.push(`set_fields: ${(0, _eml_1.abapFlag)()}`);
|
|
132316
|
+
}
|
|
132317
|
+
if (op.autoFillCid === true) {
|
|
132318
|
+
options.push(`auto_fill_cid: ${(0, _eml_1.abapFlag)()}`);
|
|
132319
|
+
}
|
|
132320
|
+
if (op.kind === "EXECUTE" && targets["result"] !== undefined) {
|
|
132321
|
+
options.push(`result: ${targets["result"]}`);
|
|
132322
|
+
}
|
|
132323
|
+
const method = op.kind === "EXECUTE" ? "execute" : "modify";
|
|
132324
|
+
calls.push(`await ${lookup}.${method}({${options.join(", ")}});`);
|
|
132325
|
+
}
|
|
132326
|
+
return (0, _eml_1.emitCalls)("ModifyEntities", lookup, calls, node, traversal);
|
|
131082
132327
|
}
|
|
131083
132328
|
}
|
|
131084
132329
|
exports.ModifyEntitiesTranspiler = ModifyEntitiesTranspiler;
|
|
@@ -132309,9 +133554,89 @@ exports.ReadDatasetTranspiler = ReadDatasetTranspiler;
|
|
|
132309
133554
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
132310
133555
|
exports.ReadEntitiesTranspiler = void 0;
|
|
132311
133556
|
const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/transpiler/build/src/chunk.js");
|
|
133557
|
+
const _eml_1 = __webpack_require__(/*! ./_eml */ "./node_modules/@abaplint/transpiler/build/src/statements/_eml.js");
|
|
133558
|
+
/** READ ENTITIES OF bdef ENTITY e FROM|ALL FIELDS WITH|FIELDS ( ) WITH keys RESULT r FAILED f REPORTED r
|
|
133559
|
+
*
|
|
133560
|
+
* lowered to KERNEL_RAP_EML.begin with the FAILED / REPORTED targets the
|
|
133561
|
+
* statement names (the statement boundary), then one read call per read in
|
|
133562
|
+
* the order of the statement. Not lowered: read by association (BY), LINK, and EXECUTE
|
|
133563
|
+
* (functions). */
|
|
132312
133564
|
class ReadEntitiesTranspiler {
|
|
132313
|
-
transpile(
|
|
132314
|
-
|
|
133565
|
+
transpile(node, traversal) {
|
|
133566
|
+
const unsupported = (0, _eml_1.unsupportedAddition)(node, ["LINK", "EXECUTE"]);
|
|
133567
|
+
if (unsupported !== undefined) {
|
|
133568
|
+
return new chunk_1.Chunk(`throw new Error("ReadEntities ${unsupported}, not supported, transpiler");`);
|
|
133569
|
+
}
|
|
133570
|
+
const lookup = traversal.lookupClassOrInterface(_eml_1.KERNEL_RAP_EML, node.getFirstToken());
|
|
133571
|
+
const walker = new _eml_1.EMLWalker(node);
|
|
133572
|
+
const reads = [];
|
|
133573
|
+
const targets = {};
|
|
133574
|
+
let bdef = "";
|
|
133575
|
+
let entity = "";
|
|
133576
|
+
let current = undefined;
|
|
133577
|
+
walker.accept("READ");
|
|
133578
|
+
if (walker.accept("ENTITIES", "OF")) {
|
|
133579
|
+
bdef = walker.takeName();
|
|
133580
|
+
}
|
|
133581
|
+
else if (walker.accept("ENTITY")) {
|
|
133582
|
+
walker.accept("IN", "LOCAL", "MODE");
|
|
133583
|
+
bdef = walker.takeName();
|
|
133584
|
+
entity = bdef;
|
|
133585
|
+
}
|
|
133586
|
+
while (!walker.done()) {
|
|
133587
|
+
const keyword = walker.takeKeyword();
|
|
133588
|
+
switch (keyword) {
|
|
133589
|
+
case "ENTITY":
|
|
133590
|
+
entity = walker.takeName();
|
|
133591
|
+
break;
|
|
133592
|
+
case "FROM":
|
|
133593
|
+
current = { entity, keys: traversal.traverse(walker.takeExpression()).getCode() };
|
|
133594
|
+
reads.push(current);
|
|
133595
|
+
break;
|
|
133596
|
+
case "ALL":
|
|
133597
|
+
walker.accept("FIELDS", "WITH");
|
|
133598
|
+
current = { entity, fields: "*", keys: traversal.traverse(walker.takeExpression()).getCode() };
|
|
133599
|
+
reads.push(current);
|
|
133600
|
+
break;
|
|
133601
|
+
case "FIELDS":
|
|
133602
|
+
current = { entity, fields: walker.takeFieldList().join(",") };
|
|
133603
|
+
walker.accept("WITH");
|
|
133604
|
+
current.keys = traversal.traverse(walker.takeExpression()).getCode();
|
|
133605
|
+
reads.push(current);
|
|
133606
|
+
break;
|
|
133607
|
+
case "RESULT":
|
|
133608
|
+
if (current) {
|
|
133609
|
+
current.result = traversal.traverse(walker.takeExpression()).getCode();
|
|
133610
|
+
}
|
|
133611
|
+
break;
|
|
133612
|
+
case "FAILED":
|
|
133613
|
+
case "REPORTED":
|
|
133614
|
+
targets[keyword.toLowerCase()] = traversal.traverse(walker.takeExpression()).getCode();
|
|
133615
|
+
break;
|
|
133616
|
+
default:
|
|
133617
|
+
// IN LOCAL MODE, the final period
|
|
133618
|
+
break;
|
|
133619
|
+
}
|
|
133620
|
+
}
|
|
133621
|
+
const calls = [];
|
|
133622
|
+
const statement = [`bdef: ${(0, _eml_1.abapString)(bdef)}`];
|
|
133623
|
+
for (const name of ["failed", "reported"]) {
|
|
133624
|
+
if (targets[name] !== undefined) {
|
|
133625
|
+
statement.push(`${name}: ${targets[name]}`);
|
|
133626
|
+
}
|
|
133627
|
+
}
|
|
133628
|
+
calls.push(`await ${lookup}.begin({${statement.join(", ")}});`);
|
|
133629
|
+
for (const read of reads) {
|
|
133630
|
+
const options = [`bdef: ${(0, _eml_1.abapString)(bdef)}`, `entity: ${(0, _eml_1.abapString)(read.entity)}`, `keys: ${read.keys ?? "undefined"}`];
|
|
133631
|
+
if (read.fields !== undefined) {
|
|
133632
|
+
options.push(`fields: ${(0, _eml_1.abapString)(read.fields)}`);
|
|
133633
|
+
}
|
|
133634
|
+
if (read.result !== undefined) {
|
|
133635
|
+
options.push(`result: ${read.result}`);
|
|
133636
|
+
}
|
|
133637
|
+
calls.push(`await ${lookup}.read({${options.join(", ")}});`);
|
|
133638
|
+
}
|
|
133639
|
+
return (0, _eml_1.emitCalls)("ReadEntities", lookup, calls, node, traversal);
|
|
132315
133640
|
}
|
|
132316
133641
|
}
|
|
132317
133642
|
exports.ReadEntitiesTranspiler = ReadEntitiesTranspiler;
|
|
@@ -132965,6 +134290,29 @@ exports.RollbackTranspiler = RollbackTranspiler;
|
|
|
132965
134290
|
|
|
132966
134291
|
/***/ },
|
|
132967
134292
|
|
|
134293
|
+
/***/ "./node_modules/@abaplint/transpiler/build/src/statements/rollback_entities.js"
|
|
134294
|
+
/*!*************************************************************************************!*\
|
|
134295
|
+
!*** ./node_modules/@abaplint/transpiler/build/src/statements/rollback_entities.js ***!
|
|
134296
|
+
\*************************************************************************************/
|
|
134297
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
134298
|
+
|
|
134299
|
+
"use strict";
|
|
134300
|
+
|
|
134301
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
134302
|
+
exports.RollbackEntitiesTranspiler = void 0;
|
|
134303
|
+
const _eml_1 = __webpack_require__(/*! ./_eml */ "./node_modules/@abaplint/transpiler/build/src/statements/_eml.js");
|
|
134304
|
+
/** ROLLBACK ENTITIES, lowered to KERNEL_RAP_EML.rollback */
|
|
134305
|
+
class RollbackEntitiesTranspiler {
|
|
134306
|
+
transpile(node, traversal) {
|
|
134307
|
+
const lookup = traversal.lookupClassOrInterface(_eml_1.KERNEL_RAP_EML, node.getFirstToken());
|
|
134308
|
+
return (0, _eml_1.emitCalls)("RollbackEntities", lookup, [`await ${lookup}.rollback();`], node, traversal);
|
|
134309
|
+
}
|
|
134310
|
+
}
|
|
134311
|
+
exports.RollbackEntitiesTranspiler = RollbackEntitiesTranspiler;
|
|
134312
|
+
//# sourceMappingURL=rollback_entities.js.map
|
|
134313
|
+
|
|
134314
|
+
/***/ },
|
|
134315
|
+
|
|
132968
134316
|
/***/ "./node_modules/@abaplint/transpiler/build/src/statements/scan.js"
|
|
132969
134317
|
/*!************************************************************************!*\
|
|
132970
134318
|
!*** ./node_modules/@abaplint/transpiler/build/src/statements/scan.js ***!
|
|
@@ -133261,7 +134609,8 @@ class SelectTranspiler {
|
|
|
133261
134609
|
// ABAP semantics: with an empty driving table the whole WHERE condition is ignored
|
|
133262
134610
|
const selectEmpty = select.replace(whereClause, "");
|
|
133263
134611
|
const bindRow = (text) => text
|
|
133264
|
-
|
|
134612
|
+
// the row reference follows a blank, or the parenthesis of abap.sqlEscape(
|
|
134613
|
+
.replace(new RegExp("([ (])" + escapeRegExp(faeTranspiled), "g"), "$1" + unique)
|
|
133265
134614
|
.replace(unique + ".get().table_line.get()", unique + ".get()"); // there can be only one?
|
|
133266
134615
|
select = bindRow(select);
|
|
133267
134616
|
const where = bindRow(whereClause);
|
|
@@ -135002,7 +136351,7 @@ class UpdateDatabaseTranspiler {
|
|
|
135002
136351
|
const where = [];
|
|
135003
136352
|
const set = [];
|
|
135004
136353
|
for (const fieldName of allFields) {
|
|
135005
|
-
const cond = `\\"${fieldName}\\" = '\" + ${sqlSource}.${fieldName}.get() + \"'`;
|
|
136354
|
+
const cond = `\\"${fieldName}\\" = '\" + abap.sqlEscape(${sqlSource}.${fieldName}.get()) + \"'`;
|
|
135006
136355
|
if (keys.includes(fieldName) === true) {
|
|
135007
136356
|
where.push(cond);
|
|
135008
136357
|
}
|
|
@@ -135804,12 +137153,13 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
135804
137153
|
exports.ClassDefinitionTranspiler = void 0;
|
|
135805
137154
|
const abaplint = __importStar(__webpack_require__(/*! @abaplint/core */ "./node_modules/@abaplint/core/build/src/index.js"));
|
|
135806
137155
|
const chunk_1 = __webpack_require__(/*! ../chunk */ "./node_modules/@abaplint/transpiler/build/src/chunk.js");
|
|
137156
|
+
const program_includes_1 = __webpack_require__(/*! ../program_includes */ "./node_modules/@abaplint/transpiler/build/src/program_includes.js");
|
|
135807
137157
|
class ClassDefinitionTranspiler {
|
|
135808
137158
|
transpile(node, traversal) {
|
|
135809
137159
|
const className = node.findFirstExpression(abaplint.Expressions.ClassName)?.concatTokens().toUpperCase();
|
|
135810
137160
|
let found = false;
|
|
135811
137161
|
if (className !== undefined) {
|
|
135812
|
-
for (const a of traversal.getCurrentObject().
|
|
137162
|
+
for (const a of (0, program_includes_1.filesWithProgramIncludes)(traversal.getCurrentObject(), traversal.reg)) {
|
|
135813
137163
|
if (a.getInfo().getClassImplementationByName(className) !== undefined) {
|
|
135814
137164
|
found = true;
|
|
135815
137165
|
}
|
|
@@ -137942,6 +139292,9 @@ class Traversal {
|
|
|
137942
139292
|
reg;
|
|
137943
139293
|
options;
|
|
137944
139294
|
typeFactories;
|
|
139295
|
+
/** set when the executable program level code is collected into the program's main function,
|
|
139296
|
+
* shared with the traversals of its INCLUDEs, see traverseProgramLevel */
|
|
139297
|
+
programMain = undefined;
|
|
137945
139298
|
constructor(spaghetti, file, obj, reg, options, typeFactories) {
|
|
137946
139299
|
this.spaghetti = spaghetti;
|
|
137947
139300
|
this.file = file;
|
|
@@ -138017,6 +139370,15 @@ class Traversal {
|
|
|
138017
139370
|
getCurrentObject() {
|
|
138018
139371
|
return this.obj;
|
|
138019
139372
|
}
|
|
139373
|
+
/** true if the file is part of the current object, include programs are inlined into the object using them */
|
|
139374
|
+
isCurrentObjectFile(filename) {
|
|
139375
|
+
if (this.getCurrentObject().getABAPFileByName(filename) !== undefined) {
|
|
139376
|
+
return true;
|
|
139377
|
+
}
|
|
139378
|
+
const file = this.reg.getFileByName(filename);
|
|
139379
|
+
const found = file ? this.reg.findObjectForFile(file) : undefined;
|
|
139380
|
+
return found instanceof abaplint.Objects.Program && found.isInclude();
|
|
139381
|
+
}
|
|
138020
139382
|
traverse(node) {
|
|
138021
139383
|
if (node instanceof abaplint.Nodes.StructureNode) {
|
|
138022
139384
|
return this.traverseStructure(node);
|
|
@@ -138086,6 +139448,13 @@ class Traversal {
|
|
|
138086
139448
|
// workaround for INCLUDEs in function groups
|
|
138087
139449
|
return this.fuctionGroupWorkaround(token);
|
|
138088
139450
|
}
|
|
139451
|
+
if (node === undefined
|
|
139452
|
+
&& this.obj instanceof abaplint.Objects.Program
|
|
139453
|
+
&& this.obj.getABAPFileByName(filename) === undefined
|
|
139454
|
+
&& this.isCurrentObjectFile(filename)) {
|
|
139455
|
+
// INCLUDE in program, the program level scope only covers the main file
|
|
139456
|
+
return this.spaghetti.getFirstChild()?.getFirstChild();
|
|
139457
|
+
}
|
|
138089
139458
|
return node;
|
|
138090
139459
|
}
|
|
138091
139460
|
fuctionGroupWorkaround(token) {
|
|
@@ -138162,7 +139531,7 @@ class Traversal {
|
|
|
138162
139531
|
}
|
|
138163
139532
|
prefixAndName(t, filename) {
|
|
138164
139533
|
let name = t.getStr().toLowerCase().replace(/^!/, "");
|
|
138165
|
-
if (filename && this.
|
|
139534
|
+
if (filename && this.isCurrentObjectFile(filename) === false) {
|
|
138166
139535
|
// the prefix is from a different object
|
|
138167
139536
|
const file = this.reg.getFileByName(filename);
|
|
138168
139537
|
if (file) {
|
|
@@ -138499,7 +139868,7 @@ class Traversal {
|
|
|
138499
139868
|
return scope?.getIdentifier().sname;
|
|
138500
139869
|
}
|
|
138501
139870
|
}
|
|
138502
|
-
else if (this.
|
|
139871
|
+
else if (this.isCurrentObjectFile(ref.getFilename())) {
|
|
138503
139872
|
const scope = this.spaghetti.lookupPosition(ref.getStart(), ref.getFilename());
|
|
138504
139873
|
if (scope?.getIdentifier().stype === abaplint.ScopeType.Interface) {
|
|
138505
139874
|
return scope?.getIdentifier().sname;
|
|
@@ -139043,10 +140412,76 @@ this.INTERNAL_ID = abap.internalIdCounter++;\n`;
|
|
|
139043
140412
|
}
|
|
139044
140413
|
}
|
|
139045
140414
|
}
|
|
140415
|
+
static PROGRAM_LEVEL_DECLARATIONS = [
|
|
140416
|
+
abaplint.Statements.Data, abaplint.Statements.DataBegin, abaplint.Statements.DataEnd,
|
|
140417
|
+
abaplint.Statements.Constant, abaplint.Statements.ConstantBegin,
|
|
140418
|
+
abaplint.Statements.Type, abaplint.Statements.TypeBegin, abaplint.Statements.TypeEnum,
|
|
140419
|
+
abaplint.Statements.FieldSymbol, abaplint.Statements.Static, abaplint.Statements.StaticBegin,
|
|
140420
|
+
abaplint.Statements.Tables, abaplint.Statements.TypePools, abaplint.Statements.Ranges, abaplint.Statements.Nodes,
|
|
140421
|
+
abaplint.Statements.Parameter, abaplint.Statements.SelectOption, abaplint.Statements.SelectionScreen,
|
|
140422
|
+
abaplint.Statements.ClassDeferred, abaplint.Statements.InterfaceDeferred,
|
|
140423
|
+
abaplint.Statements.ClassDefinitionLoad, abaplint.Statements.InterfaceLoad,
|
|
140424
|
+
abaplint.Statements.Define, abaplint.Statements.Include, abaplint.Statements.Report, abaplint.Statements.Program,
|
|
140425
|
+
];
|
|
140426
|
+
static isProgramLevelDeclaration(node) {
|
|
140427
|
+
const get = node.get();
|
|
140428
|
+
if (node instanceof abaplint.Nodes.StatementNode) {
|
|
140429
|
+
return Traversal.PROGRAM_LEVEL_DECLARATIONS.some(d => get instanceof d);
|
|
140430
|
+
}
|
|
140431
|
+
else if (node instanceof abaplint.Nodes.StructureNode) {
|
|
140432
|
+
return get instanceof abaplint.Structures.Data
|
|
140433
|
+
|| get instanceof abaplint.Structures.Constants
|
|
140434
|
+
|| get instanceof abaplint.Structures.Types
|
|
140435
|
+
|| get instanceof abaplint.Structures.TypeEnum
|
|
140436
|
+
|| get instanceof abaplint.Structures.Statics
|
|
140437
|
+
|| get instanceof abaplint.Structures.Define;
|
|
140438
|
+
}
|
|
140439
|
+
return false;
|
|
140440
|
+
}
|
|
140441
|
+
/** Splits the top level of a program, or of an INCLUDE expanded into it: declarations, classes and FORMs
|
|
140442
|
+
* stay on module level and are returned, the executable statements and event blocks are appended to
|
|
140443
|
+
* programMain. Declarations nested in executable blocks are global in ABAP, they stay on module level */
|
|
140444
|
+
traverseProgramLevel(node, main) {
|
|
140445
|
+
const ret = new chunk_1.Chunk();
|
|
140446
|
+
for (const c of node.getChildren()) {
|
|
140447
|
+
if (c instanceof abaplint.Nodes.StatementNode) {
|
|
140448
|
+
// event statements like INITIALIZATION are executable, REPORT, PARAMETERS etc. are declarations
|
|
140449
|
+
(Traversal.isProgramLevelDeclaration(c) ? ret : main).appendChunk(this.traverse(c));
|
|
140450
|
+
continue;
|
|
140451
|
+
}
|
|
140452
|
+
else if (!(c.get() instanceof abaplint.Structures.Normal)) {
|
|
140453
|
+
// classes, interfaces, FORMs
|
|
140454
|
+
ret.appendChunk(this.traverse(c));
|
|
140455
|
+
continue;
|
|
140456
|
+
}
|
|
140457
|
+
for (const n of c.getChildren()) {
|
|
140458
|
+
if (Traversal.isProgramLevelDeclaration(n)) {
|
|
140459
|
+
ret.appendChunk(this.traverse(n));
|
|
140460
|
+
}
|
|
140461
|
+
else if (n instanceof abaplint.Nodes.StructureNode) {
|
|
140462
|
+
ret.appendChunk(this.declareNestedEarly(n));
|
|
140463
|
+
this.blockDepth++;
|
|
140464
|
+
try {
|
|
140465
|
+
main.appendChunk(this.traverseStructure(n));
|
|
140466
|
+
}
|
|
140467
|
+
finally {
|
|
140468
|
+
this.blockDepth--;
|
|
140469
|
+
}
|
|
140470
|
+
}
|
|
140471
|
+
else {
|
|
140472
|
+
main.appendChunk(this.traverse(n));
|
|
140473
|
+
}
|
|
140474
|
+
}
|
|
140475
|
+
}
|
|
140476
|
+
return ret;
|
|
140477
|
+
}
|
|
139046
140478
|
traverseStructure(node) {
|
|
139047
140479
|
if (this.declaredEarly.has(node) && this.emittingEarly === false) {
|
|
139048
140480
|
return new chunk_1.Chunk();
|
|
139049
140481
|
}
|
|
140482
|
+
else if (this.programMain !== undefined && node.get() instanceof abaplint.Structures.Any) {
|
|
140483
|
+
return this.traverseProgramLevel(node, this.programMain);
|
|
140484
|
+
}
|
|
139050
140485
|
else if (this.blockDepth === 0 && node.get() instanceof abaplint.Structures.Normal) {
|
|
139051
140486
|
return this.traverseProcedureLevel(node);
|
|
139052
140487
|
}
|
|
@@ -139367,6 +140802,7 @@ exports.UnitTest = void 0;
|
|
|
139367
140802
|
/* eslint-disable max-len */
|
|
139368
140803
|
const abaplint = __importStar(__webpack_require__(/*! @abaplint/core */ "./node_modules/@abaplint/core/build/src/index.js"));
|
|
139369
140804
|
const output_layout_1 = __webpack_require__(/*! ./output_layout */ "./node_modules/@abaplint/transpiler/build/src/output_layout.js");
|
|
140805
|
+
const program_includes_1 = __webpack_require__(/*! ./program_includes */ "./node_modules/@abaplint/transpiler/build/src/program_includes.js");
|
|
139370
140806
|
class UnitTest {
|
|
139371
140807
|
layout;
|
|
139372
140808
|
constructor(layout = new output_layout_1.OutputLayout()) {
|
|
@@ -139388,14 +140824,29 @@ async function run() {
|
|
|
139388
140824
|
let ls_result = new abap.types.Structure({list: new abap.types.Table(new abap.types.Structure({class_name: new abap.types.Character(30), testclass_name: new abap.types.Character(30), method_name: new abap.types.Character(30), expected: new abap.types.String(), actual: new abap.types.String(), status: new abap.types.String(), runtime: new abap.types.Integer(), message: new abap.types.String(), js_location: new abap.types.String(), console: new abap.types.String()}), {"withHeader":false,"type":"STANDARD","isUnique":false,"keyFields":[]}), json: new abap.types.String()});
|
|
139389
140825
|
`;
|
|
139390
140826
|
for (const obj of reg.getObjects()) {
|
|
139391
|
-
if (reg.isDependency(obj)
|
|
140827
|
+
if (reg.isDependency(obj)) {
|
|
139392
140828
|
continue;
|
|
139393
140829
|
}
|
|
139394
|
-
|
|
139395
|
-
if (
|
|
139396
|
-
|
|
140830
|
+
let files = [];
|
|
140831
|
+
if (obj instanceof abaplint.Objects.Class) {
|
|
140832
|
+
const hasTestFile = obj.getFiles().some(f => { return f.getFilename().includes(".testclasses."); });
|
|
140833
|
+
if (hasTestFile === true) {
|
|
140834
|
+
ret += ` await import("${(0, output_layout_1.importPath)("index.mjs", this.layout.objectModule(obj, ".testclasses"))}");\n`;
|
|
140835
|
+
}
|
|
140836
|
+
files = obj.getABAPFiles();
|
|
140837
|
+
}
|
|
140838
|
+
else if (obj instanceof abaplint.Objects.Program && obj.isInclude() === false) {
|
|
140839
|
+
// KERNEL_UNIT_RUNNER finds local classes of programs as "PROG-<program>-<class>",
|
|
140840
|
+
// importing the program module registers them, its main function is not run
|
|
140841
|
+
files = (0, program_includes_1.filesWithProgramIncludes)(obj, reg);
|
|
140842
|
+
if (files.some(f => f.getInfo().listClassDefinitions().some(d => d.isForTesting === true && d.isGlobal === false))) {
|
|
140843
|
+
ret += ` await import("${(0, output_layout_1.importPath)("index.mjs", this.layout.objectModule(obj))}");\n`;
|
|
140844
|
+
}
|
|
139397
140845
|
}
|
|
139398
|
-
|
|
140846
|
+
else {
|
|
140847
|
+
continue;
|
|
140848
|
+
}
|
|
140849
|
+
for (const file of files) {
|
|
139399
140850
|
for (const def of file.getInfo().listClassDefinitions()) {
|
|
139400
140851
|
if (def.isForTesting === false || def.isGlobal === true || def.methods.length === 0) {
|
|
139401
140852
|
// todo, fix, there might be global test methods
|
|
@@ -139430,14 +140881,28 @@ run().then(() => {
|
|
|
139430
140881
|
getSortedTests(reg) {
|
|
139431
140882
|
const tests = [];
|
|
139432
140883
|
for (const obj of reg.getObjects()) {
|
|
139433
|
-
if (reg.isDependency(obj)
|
|
140884
|
+
if (reg.isDependency(obj)) {
|
|
139434
140885
|
continue;
|
|
139435
140886
|
}
|
|
139436
|
-
|
|
139437
|
-
|
|
140887
|
+
let files = [];
|
|
140888
|
+
let filename = "";
|
|
140889
|
+
if (obj instanceof abaplint.Objects.Class) {
|
|
140890
|
+
const hasTestFile = obj.getFiles().some(f => { return f.getFilename().includes(".testclasses."); });
|
|
140891
|
+
if (hasTestFile === false) {
|
|
140892
|
+
continue;
|
|
140893
|
+
}
|
|
140894
|
+
files = obj.getABAPFiles();
|
|
140895
|
+
filename = (0, output_layout_1.importPath)("index.mjs", this.layout.objectModule(obj, ".testclasses"));
|
|
140896
|
+
}
|
|
140897
|
+
else if (obj instanceof abaplint.Objects.Program && obj.isInclude() === false) {
|
|
140898
|
+
// local test classes are in the program or its includes, the includes are expanded into the program module
|
|
140899
|
+
files = (0, program_includes_1.filesWithProgramIncludes)(obj, reg);
|
|
140900
|
+
filename = (0, output_layout_1.importPath)("index.mjs", this.layout.objectModule(obj));
|
|
140901
|
+
}
|
|
140902
|
+
else {
|
|
139438
140903
|
continue;
|
|
139439
140904
|
}
|
|
139440
|
-
for (const file of
|
|
140905
|
+
for (const file of files) {
|
|
139441
140906
|
for (const def of file.getInfo().listClassDefinitions()) {
|
|
139442
140907
|
if (def.isForTesting === false
|
|
139443
140908
|
|| def.isGlobal === true
|
|
@@ -139460,7 +140925,7 @@ run().then(() => {
|
|
|
139460
140925
|
}
|
|
139461
140926
|
tests.push({
|
|
139462
140927
|
obj,
|
|
139463
|
-
filename:
|
|
140928
|
+
filename: filename,
|
|
139464
140929
|
localClass: def.name.toLowerCase(),
|
|
139465
140930
|
riskLevel: def.riskLevel,
|
|
139466
140931
|
duration: def.duration,
|
|
@@ -143362,7 +144827,7 @@ module.exports = require("url");
|
|
|
143362
144827
|
\**************************************************/
|
|
143363
144828
|
(module) {
|
|
143364
144829
|
|
|
143365
|
-
(()=>{"use strict";var t={d:(e,i)=>{for(var n in i)t.o(i,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:i[n]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{XMLBuilder:()=>Oe,XMLParser:()=>re,XMLValidator:()=>je});const i=":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",n=new RegExp("^["+i+"]["+i+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$");function r(t,e){const i=[];let n=e.exec(t);for(;n;){const r=[];r.startIndex=e.lastIndex-n[0].length;const s=n.length;for(let t=0;t<s;t++)r.push(n[t]);i.push(r),n=e.exec(t)}return i}const s=function(t){return!(null==n.exec(t))},o=["hasOwnProperty","toString","valueOf","__defineGetter__","__defineSetter__","__lookupGetter__","__lookupSetter__"],a=["__proto__","constructor","prototype"],l={allowBooleanAttributes:!1,unpairedTags:[]};function p(t,e){e=Object.assign({},l,e);const i=[];let n=!1,r=!1;"\ufeff"===t[0]&&(t=t.substr(1));for(let s=0;s<t.length;s++)if("<"===t[s]&&"?"===t[s+1]){if(s+=2,s=h(t,s),s.err)return s}else{if("<"!==t[s]){if(c(t[s]))continue;return y("InvalidChar","char '"+t[s]+"' is not expected.",w(t,s))}{let o=s;if(s++,"!"===t[s]){s=d(t,s);continue}{let a=!1;"/"===t[s]&&(a=!0,s++);let l="";for(;s<t.length&&">"!==t[s]&&" "!==t[s]&&"\t"!==t[s]&&"\n"!==t[s]&&"\r"!==t[s];s++)l+=t[s];if(l=l.trim(),"/"===l[l.length-1]&&(l=l.substring(0,l.length-1),s--),!E(l)){let e;return e=0===l.trim().length?"Invalid space after '<'.":"Tag '"+l+"' is an invalid name.",y("InvalidTag",e,w(t,s))}const p=g(t,s);if(!1===p)return y("InvalidAttr","Attributes for '"+l+"' have open quote.",w(t,s));let u=p.value;if(s=p.index,"/"===u[u.length-1]){const i=s-u.length;u=u.substring(0,u.length-1);const r=x(u,e);if(!0!==r)return y(r.err.code,r.err.msg,w(t,i+r.err.line));n=!0}else if(a){if(!p.tagClosed)return y("InvalidTag","Closing tag '"+l+"' doesn't have proper closing.",w(t,s));if(u.trim().length>0)return y("InvalidTag","Closing tag '"+l+"' can't have attributes or invalid starting.",w(t,o));if(0===i.length)return y("InvalidTag","Closing tag '"+l+"' has not been opened.",w(t,o));{const e=i.pop();if(l!==e.tagName){let i=w(t,e.tagStartPos);return y("InvalidTag","Expected closing tag '"+e.tagName+"' (opened in line "+i.line+", col "+i.col+") instead of closing tag '"+l+"'.",w(t,o))}0==i.length&&(r=!0)}}else{const a=x(u,e);if(!0!==a)return y(a.err.code,a.err.msg,w(t,s-u.length+a.err.line));if(!0===r)return y("InvalidXml","Multiple possible root nodes found.",w(t,s));-1!==e.unpairedTags.indexOf(l)||i.push({tagName:l,tagStartPos:o}),n=!0}for(s++;s<t.length;s++)if("<"===t[s]){if("!"===t[s+1]){s++,s=d(t,s);continue}if("?"!==t[s+1])break;if(s=h(t,++s),s.err)return s}else if("&"===t[s]){const e=b(t,s);if(-1==e)return y("InvalidChar","char '&' is not expected.",w(t,s));s=e}else if(!0===r&&!c(t[s]))return y("InvalidXml","Extra text at the end",w(t,s));"<"===t[s]&&s--}}}return n?1==i.length?y("InvalidTag","Unclosed tag '"+i[0].tagName+"'.",w(t,i[0].tagStartPos)):!(i.length>0)||y("InvalidXml","Invalid '"+JSON.stringify(i.map(t=>t.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1}):y("InvalidXml","Start tag expected.",1)}function c(t){return" "===t||"\t"===t||"\n"===t||"\r"===t}function h(t,e){const i=e;for(;e<t.length;e++)if("?"==t[e]||" "==t[e]){const n=t.substr(i,e-i);if(e>5&&"xml"===n)return y("InvalidXml","XML declaration allowed only at the start of the document.",w(t,e));if("?"==t[e]&&">"==t[e+1]){e++;break}continue}return e}function d(t,e){if(t.length>e+5&&"-"===t[e+1]&&"-"===t[e+2]){for(e+=3;e<t.length;e++)if("-"===t[e]&&"-"===t[e+1]&&">"===t[e+2]){e+=2;break}}else if(t.length>e+8&&"D"===t[e+1]&&"O"===t[e+2]&&"C"===t[e+3]&&"T"===t[e+4]&&"Y"===t[e+5]&&"P"===t[e+6]&&"E"===t[e+7]){let i=1;for(e+=8;e<t.length;e++)if("<"===t[e])i++;else if(">"===t[e]&&(i--,0===i))break}else if(t.length>e+9&&"["===t[e+1]&&"C"===t[e+2]&&"D"===t[e+3]&&"A"===t[e+4]&&"T"===t[e+5]&&"A"===t[e+6]&&"["===t[e+7])for(e+=8;e<t.length;e++)if("]"===t[e]&&"]"===t[e+1]&&">"===t[e+2]){e+=2;break}return e}const u='"',f="'";function g(t,e){let i="",n="",r=!1;for(;e<t.length;e++){if(t[e]===u||t[e]===f)""===n?n=t[e]:n!==t[e]||(n="");else if(">"===t[e]&&""===n){r=!0;break}i+=t[e]}return""===n&&{value:i,index:e,tagClosed:r}}const m=new RegExp("(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['\"])(([\\s\\S])*?)\\5)?","g");function x(t,e){const i=r(t,m),n={};for(let t=0;t<i.length;t++){if(0===i[t][1].length)return y("InvalidAttr","Attribute '"+i[t][2]+"' has no space in starting.",v(i[t]));if(void 0!==i[t][3]&&void 0===i[t][4])return y("InvalidAttr","Attribute '"+i[t][2]+"' is without value.",v(i[t]));if(void 0===i[t][3]&&!e.allowBooleanAttributes)return y("InvalidAttr","boolean attribute '"+i[t][2]+"' is not allowed.",v(i[t]));const r=i[t][2];if(!N(r))return y("InvalidAttr","Attribute '"+r+"' is an invalid name.",v(i[t]));if(Object.prototype.hasOwnProperty.call(n,r))return y("InvalidAttr","Attribute '"+r+"' is repeated.",v(i[t]));n[r]=1}return!0}function b(t,e){if(";"===t[++e])return-1;if("#"===t[e])return function(t,e){let i=/\d/;for("x"===t[e]&&(e++,i=/[\da-fA-F]/);e<t.length;e++){if(";"===t[e])return e;if(!t[e].match(i))break}return-1}(t,++e);let i=0;for(;e<t.length;e++,i++)if(!(t[e].match(/\w/)&&i<20)){if(";"===t[e])break;return-1}return e}function y(t,e,i){return{err:{code:t,msg:e,line:i.line||i,col:i.col}}}function N(t){return s(t)}function E(t){return s(t)}function w(t,e){const i=t.substring(0,e).split(/\r?\n/);return{line:i.length,col:i[i.length-1].length+1}}function v(t){return t.startIndex+t[1].length}const S=t=>o.includes(t)?"__"+t:t,A={preserveOrder:!1,attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,removeNSPrefix:!1,allowBooleanAttributes:!1,parseTagValue:!0,parseAttributeValue:!1,trimValues:!0,cdataPropName:!1,numberParseOptions:{hex:!0,leadingZeros:!0,eNotation:!0,unicode:!1},tagValueProcessor:function(t,e){return e},attributeValueProcessor:function(t,e){return e},stopNodes:[],alwaysCreateTextNode:!1,isArray:()=>!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,entityDecoder:null,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(t,e,i){return t},captureMetaData:!1,maxNestedTags:100,strictReservedNames:!0,jPath:!0,onDangerousProperty:S};function T(t,e){if("string"!=typeof t)return;const i=t.toLowerCase();if(o.some(t=>i===t.toLowerCase()))throw new Error(`[SECURITY] Invalid ${e}: "${t}" is a reserved JavaScript keyword that could cause prototype pollution`);if(a.some(t=>i===t.toLowerCase()))throw new Error(`[SECURITY] Invalid ${e}: "${t}" is a reserved JavaScript keyword that could cause prototype pollution`)}function _(t,e){return"boolean"==typeof t?{enabled:t,maxEntitySize:1e4,maxExpansionDepth:1e4,maxTotalExpansions:1/0,maxExpandedLength:1e5,maxEntityCount:1e3,allowedTags:null,tagFilter:null,appliesTo:"all"}:"object"==typeof t&&null!==t?{enabled:!1!==t.enabled,maxEntitySize:Math.max(1,t.maxEntitySize??1e4),maxExpansionDepth:Math.max(1,t.maxExpansionDepth??1e4),maxTotalExpansions:Math.max(1,t.maxTotalExpansions??1/0),maxExpandedLength:Math.max(1,t.maxExpandedLength??1e5),maxEntityCount:Math.max(1,t.maxEntityCount??1e3),allowedTags:t.allowedTags??null,tagFilter:t.tagFilter??null,appliesTo:t.appliesTo??"all"}:_(!0)}const C=function(t){const e=Object.assign({},A,t),i=[{value:e.attributeNamePrefix,name:"attributeNamePrefix"},{value:e.attributesGroupName,name:"attributesGroupName"},{value:e.textNodeName,name:"textNodeName"},{value:e.cdataPropName,name:"cdataPropName"},{value:e.commentPropName,name:"commentPropName"}];for(const{value:t,name:e}of i)t&&T(t,e);return null===e.onDangerousProperty&&(e.onDangerousProperty=S),e.processEntities=_(e.processEntities,e.htmlEntities),e.unpairedTagsSet=new Set(e.unpairedTags),e.stopNodes&&Array.isArray(e.stopNodes)&&(e.stopNodes=e.stopNodes.map(t=>"string"==typeof t&&t.startsWith("*.")?".."+t.substring(2):t)),e};let $;$="function"!=typeof Symbol?"@@xmlMetadata":Symbol("XML Node Metadata");class P{constructor(t){this.tagname=t,this.child=[],this[":@"]=Object.create(null)}add(t,e){"__proto__"===t&&(t="#__proto__"),this.child.push({[t]:e})}addChild(t,e){"__proto__"===t.tagname&&(t.tagname="#__proto__"),t[":@"]&&Object.keys(t[":@"]).length>0?this.child.push({[t.tagname]:t.child,":@":t[":@"]}):this.child.push({[t.tagname]:t.child}),void 0!==e&&(this.child[this.child.length-1][$]={startIndex:e})}static getMetaDataSymbol(){return $}}const O=":A-Za-z_À-ÖØ-öø-˿Ͱ-ͽͿ-҆҈--⁰-Ⰰ-、-豈-﷏ﷰ-�",j=":A-Za-z_À-˿Ͱ-ͽͿ-҆҈--⁰-Ⰰ-、-豈-﷏ﷰ-�𐀀-",I=j+"\\-\\.\\d·̀-ͯ҇‿-⁀",k=(t,e,i="")=>{const n=`[${t.replace(":","")}][${e.replace(":","")}]*`;return{name:new RegExp(`^[${t}][${e}]*$`,i),ncName:new RegExp(`^${n}$`,i),qName:new RegExp(`^${n}(?::${n})?$`,i),nmToken:new RegExp(`^[${e}]+$`,i),nmTokens:new RegExp(`^[${e}]+(?:\\s+[${e}]+)*$`,i)}},L=k(O,O+"\\-\\.\\d·̀-ͯ‿-⁀"),D=k(j,I,"u"),R=":A-Za-z_",M=k(R,R+"\\-\\.\\d"),V=(t,{xmlVersion:e="1.0",asciiOnly:i=!1}={})=>((t="1.0",e=!1)=>e?M:"1.1"===t?D:L)(e,i).qName.test(t);class q{constructor(t,e){this.suppressValidationErr=!t,this.options=t,this.xmlVersion=e||1}setXmlVersion(t=1){this.xmlVersion=t}readDocType(t,e){const i=Object.create(null);let n=0;if("O"!==t[e+3]||"C"!==t[e+4]||"T"!==t[e+5]||"Y"!==t[e+6]||"P"!==t[e+7]||"E"!==t[e+8])throw new Error("Invalid Tag instead of DOCTYPE");{e+=9;let r=1,s=!1,o=!1,a="";for(;e<t.length;e++)if("<"!==t[e]||o)if(">"===t[e]){if(o?"-"===t[e-1]&&"-"===t[e-2]&&(o=!1,r--):r--,0===r)break}else"["===t[e]?s=!0:a+=t[e];else{if(s&&U(t,"!ENTITY",e)){let r,s;if(e+=7,[r,s,e]=this.readEntityExp(t,e+1,this.suppressValidationErr),-1===s.indexOf("&")){if(!1!==this.options.enabled&&null!=this.options.maxEntityCount&&n>=this.options.maxEntityCount)throw new Error(`Entity count (${n+1}) exceeds maximum allowed (${this.options.maxEntityCount})`);i[r]=s,n++}}else if(s&&U(t,"!ELEMENT",e)){e+=8;const{index:i}=this.readElementExp(t,e+1);e=i}else if(s&&U(t,"!ATTLIST",e))e+=8;else if(s&&U(t,"!NOTATION",e)){e+=9;const{index:i}=this.readNotationExp(t,e+1,this.suppressValidationErr);e=i}else{if(!U(t,"!--",e))throw new Error("Invalid DOCTYPE");o=!0}r++,a=""}if(0!==r)throw new Error("Unclosed DOCTYPE")}return{entities:i,i:e}}readEntityExp(t,e){const i=e=F(t,e);for(;e<t.length&&!/\s/.test(t[e])&&'"'!==t[e]&&"'"!==t[e];)e++;let n=t.substring(i,e);if(B(n,{xmlVersion:this.xmlVersion}),e=F(t,e),!this.suppressValidationErr){if("SYSTEM"===t.substring(e,e+6).toUpperCase())throw new Error("External entities are not supported");if("%"===t[e])throw new Error("Parameter entities are not supported")}let r="";if([e,r]=this.readIdentifierVal(t,e,"entity"),!1!==this.options.enabled&&null!=this.options.maxEntitySize&&r.length>this.options.maxEntitySize)throw new Error(`Entity "${n}" size (${r.length}) exceeds maximum allowed size (${this.options.maxEntitySize})`);return[n,r,--e]}readNotationExp(t,e){const i=e=F(t,e);for(;e<t.length&&!/\s/.test(t[e]);)e++;let n=t.substring(i,e);!this.suppressValidationErr&&B(n,{xmlVersion:this.xmlVersion}),e=F(t,e);const r=t.substring(e,e+6).toUpperCase();if(!this.suppressValidationErr&&"SYSTEM"!==r&&"PUBLIC"!==r)throw new Error(`Expected SYSTEM or PUBLIC, found "${r}"`);e+=r.length,e=F(t,e);let s=null,o=null;if("PUBLIC"===r)[e,s]=this.readIdentifierVal(t,e,"publicIdentifier"),'"'!==t[e=F(t,e)]&&"'"!==t[e]||([e,o]=this.readIdentifierVal(t,e,"systemIdentifier"));else if("SYSTEM"===r&&([e,o]=this.readIdentifierVal(t,e,"systemIdentifier"),!this.suppressValidationErr&&!o))throw new Error("Missing mandatory system identifier for SYSTEM notation");return{notationName:n,publicIdentifier:s,systemIdentifier:o,index:--e}}readIdentifierVal(t,e,i){let n="";const r=t[e];if('"'!==r&&"'"!==r)throw new Error(`Expected quoted string, found "${r}"`);const s=++e;for(;e<t.length&&t[e]!==r;)e++;if(n=t.substring(s,e),t[e]!==r)throw new Error(`Unterminated ${i} value`);return[++e,n]}readElementExp(t,e){const i=e=F(t,e);for(;e<t.length&&!/\s/.test(t[e]);)e++;let n=t.substring(i,e);if(!this.suppressValidationErr&&!V(n,{xmlVersion:this.xmlVersion}))throw new Error(`Invalid element name: "${n}"`);let r="";if("E"===t[e=F(t,e)]&&U(t,"MPTY",e))e+=4;else if("A"===t[e]&&U(t,"NY",e))e+=2;else if("("===t[e]){const i=++e;for(;e<t.length&&")"!==t[e];)e++;if(r=t.substring(i,e),")"!==t[e])throw new Error("Unterminated content model")}else if(!this.suppressValidationErr)throw new Error(`Invalid Element Expression, found "${t[e]}"`);return{elementName:n,contentModel:r.trim(),index:e}}readAttlistExp(t,e){let i=e=F(t,e);for(;e<t.length&&!/\s/.test(t[e]);)e++;let n=t.substring(i,e);for(B(n,{xmlVersion:this.xmlVersion}),i=e=F(t,e);e<t.length&&!/\s/.test(t[e]);)e++;let r=t.substring(i,e);if(!B(r,{xmlVersion:this.xmlVersion}))throw new Error(`Invalid attribute name: "${r}"`);e=F(t,e);let s="";if("NOTATION"===t.substring(e,e+8).toUpperCase()){if(s="NOTATION","("!==t[e=F(t,e+=8)])throw new Error(`Expected '(', found "${t[e]}"`);e++;let i=[];for(;e<t.length&&")"!==t[e];){const n=e;for(;e<t.length&&"|"!==t[e]&&")"!==t[e];)e++;let r=t.substring(n,e);if(r=r.trim(),!B(r,{xmlVersion:this.xmlVersion}))throw new Error(`Invalid notation name: "${r}"`);i.push(r),"|"===t[e]&&(e++,e=F(t,e))}if(")"!==t[e])throw new Error("Unterminated list of notations");e++,s+=" ("+i.join("|")+")"}else{const i=e;for(;e<t.length&&!/\s/.test(t[e]);)e++;s+=t.substring(i,e);const n=["CDATA","ID","IDREF","IDREFS","ENTITY","ENTITIES","NMTOKEN","NMTOKENS"];if(!this.suppressValidationErr&&!n.includes(s.toUpperCase()))throw new Error(`Invalid attribute type: "${s}"`)}e=F(t,e);let o="";return"#REQUIRED"===t.substring(e,e+8).toUpperCase()?(o="#REQUIRED",e+=8):"#IMPLIED"===t.substring(e,e+7).toUpperCase()?(o="#IMPLIED",e+=7):[e,o]=this.readIdentifierVal(t,e,"ATTLIST"),{elementName:n,attributeName:r,attributeType:s,defaultValue:o,index:e}}}const F=(t,e)=>{for(;e<t.length&&/\s/.test(t[e]);)e++;return e};function U(t,e,i){for(let n=0;n<e.length;n++)if(e[n]!==t[i+n+1])return!1;return!0}function B(t,e){if(V(t,{xmlVersion:e}))return t;throw new Error(`Invalid entity name ${t}`)}const G=[48,1632,1776,2406,2534,2662,2790,2918,3046,3174,3302,3430,3558,3664,3792,3872,4160,4240,6112,6160,6470,6608,6784,6800,6992,7088,7232,7248,65296,120782,120792,120802,120812,120822,66720,68912,69734,69872,69942,70096,70384,70736,70864,71248,71360,71472,71904,72016,72688,72784,73040,73120,73552,92768,92864,93008,123200,123632,124144,125264,130032],X=new Map,W=1632,z=new Uint8Array(63904).fill(255);for(const t of G)for(let e=0;e<10;e++){const i=t+e;i<=65535?z[i-W]=e:X.set(i,e)}const Y=new Set([8722,65293,65123]),H=/^[-+]?0x[a-fA-F0-9]+$/,Q=/^0b[01]+$/,J=/^0o[0-7]+$/,Z=/^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/,K={hex:!0,binary:!1,octal:!1,leadingZeros:!0,decimalPoint:".",eNotation:!0,infinity:"original",unicode:!1};function tt(t,e={}){if(e=Object.assign({},K,e),!t||"string"!=typeof t)return t;let i=t.trim();if(0===i.length)return t;if(void 0!==e.skipLike&&e.skipLike.test(i))return t;if("0"===i)return 0;if(e.unicode&&(i=function(t){if("string"!=typeof t)return t;const e=t.length;if(0===e)return t;let i=-1;for(let n=0;n<e;n++){const r=t.charCodeAt(n);if(!(r>=48&&r<=57||45===r))if(r<W){if(Y.has(r)){i=n;break}}else if(r>=55296&&r<=56319){if(n+1<e){const e=t.charCodeAt(n+1);if(e>=56320&&e<=57343){const t=65536+(r-55296<<10)+(e-56320);if(X.has(t)){i=n;break}}}}else if(255!==z[r-W]||Y.has(r)){i=n;break}}if(-1===i)return t;const n=[];i>0&&n.push(t.slice(0,i));for(let r=i;r<e;r++){const i=t.charCodeAt(r);if(i>=48&&i<=57||45===i){n.push(t[r]);continue}if(i<W){n.push(Y.has(i)?"-":t[r]);continue}if(i>=55296&&i<=56319){if(r+1<e){const e=t.charCodeAt(r+1);if(e>=56320&&e<=57343){const t=65536+(i-55296<<10)+(e-56320),s=X.get(t);if(void 0!==s){n.push(String.fromCharCode(s+48)),r++;continue}}}n.push(t[r]);continue}if(Y.has(i)){n.push("-");continue}const s=z[i-W];n.push(255!==s?String.fromCharCode(s+48):t[r])}return n.join("")}(i),"0"===i))return 0;if(e.hex&&H.test(i))return it(i,16);if(e.binary&&Q.test(i))return it(i,2);if(e.octal&&J.test(i))return it(i,8);if(isFinite(i)){if(i.includes("e")||i.includes("E"))return function(t,e,i){if(!i.eNotation)return t;const n=e.match(et);if(n){let r=n[1]||"";const s=-1===n[3].indexOf("e")?"E":"e",o=n[2],a=r?t[o.length+1]===s:t[o.length]===s;return o.length>1&&a?t:(1!==o.length||!n[3].startsWith(`.${s}`)&&n[3][0]!==s)&&o.length>0?i.leadingZeros&&!a?(e=(n[1]||"")+n[3],Number(e)):t:Number(e)}return t}(t,i,e);{const r=Z.exec(i);if(r){const s=r[1]||"",o=r[2];let a=(n=r[3])&&-1!==n.indexOf(".")?("."===(n=n.replace(/0+$/,""))?n="0":"."===n[0]?n="0"+n:"."===n[n.length-1]&&(n=n.substring(0,n.length-1)),n):n;const l=s?"."===t[o.length+1]:"."===t[o.length];if(!e.leadingZeros&&(o.length>1||1===o.length&&!l))return t;{const n=Number(i),r=String(n);if(0===n)return n;if(-1!==r.search(/[eE]/))return e.eNotation?n:t;if(-1!==i.indexOf("."))return"0"===r||r===a||r===`${s}${a}`?n:t;let l=o?a:i;return o?l===r||s+l===r?n:t:l===r||l===s+r?n:t}}return t}}var n;return function(t,e,i){const n=e===1/0;switch(i.infinity.toLowerCase()){case"null":return null;case"infinity":return e;case"string":return n?"Infinity":"-Infinity";default:return t}}(t,Number(i),e)}const et=/^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/;function it(t,e){const i=t.trim();if(2!==e&&8!==e||(t=i.substring(2)),parseInt)return parseInt(t,e);if(Number.parseInt)return Number.parseInt(t,e);if(window&&window.parseInt)return window.parseInt(t,e);throw new Error("parseInt, Number.parseInt, window.parseInt are not supported")}class nt{constructor(t){this._matcher=t}get separator(){return this._matcher.separator}getCurrentTag(){const t=this._matcher.path;return t.length>0?t[t.length-1].tag:void 0}getCurrentNamespace(){const t=this._matcher.path;return t.length>0?t[t.length-1].namespace:void 0}getAttrValue(t){const e=this._matcher.path;if(0!==e.length)return e[e.length-1].values?.[t]}hasAttr(t){const e=this._matcher.path;if(0===e.length)return!1;const i=e[e.length-1];return void 0!==i.values&&t in i.values}getAnyParentAttr(t){return this._matcher.getAnyParentAttr(t)}hasAnyParentAttr(t){return this._matcher.hasAnyParentAttr(t)}getPosition(){const t=this._matcher.path;return 0===t.length?-1:t[t.length-1].position??0}getCounter(){const t=this._matcher.path;return 0===t.length?-1:t[t.length-1].counter??0}getIndex(){return this.getPosition()}getDepth(){return this._matcher.path.length}toString(t,e=!0){return this._matcher.toString(t,e)}toArray(){return this._matcher.path.map(t=>t.tag)}matches(t){return this._matcher.matches(t)}matchesAny(t){return t.matchesAny(this._matcher)}}class rt{constructor(t={}){this.separator=t.separator||".",this.path=[],this.siblingStacks=[],this._pathStringCache=null,this._view=new nt(this),this._keptAttrs=[]}push(t,e=null,i=null,n=null){this._pathStringCache=null,this.path.length>0&&(this.path[this.path.length-1].values=void 0);const r=this.path.length;let s=this.siblingStacks[r];s||(s={counts:new Map,total:0},this.siblingStacks[r]=s);const o=i?`${i}:${t}`:t,a=s.counts.get(o)||0,l=s.total;s.counts.set(o,a+1),s.total++;const p={tag:t,position:l,counter:a};null!=i&&(p.namespace=i),null!=e&&(p.values=e),this.path.push(p);const c=this.path.length,h=null!==n?n.keep:null;if(null!=h&&h.length>0&&e)for(let t=0;t<h.length;t++){const i=h[t];void 0!==e[i]&&this._keptAttrs.push({depth:c,name:i,value:e[i]})}}pop(){if(0===this.path.length)return;this._pathStringCache=null;const t=this.path.pop();this.siblingStacks.length>this.path.length+1&&(this.siblingStacks.length=this.path.length+1);const e=this.path.length+1;for(;this._keptAttrs.length>0&&this._keptAttrs[this._keptAttrs.length-1].depth>=e;)this._keptAttrs.pop();return t}updateCurrent(t){if(this.path.length>0){const e=this.path[this.path.length-1];null!=t&&(e.values=t)}}getCurrentTag(){return this.path.length>0?this.path[this.path.length-1].tag:void 0}getCurrentNamespace(){return this.path.length>0?this.path[this.path.length-1].namespace:void 0}getAttrValue(t){if(0!==this.path.length)return this.path[this.path.length-1].values?.[t]}hasAttr(t){if(0===this.path.length)return!1;const e=this.path[this.path.length-1];return void 0!==e.values&&t in e.values}getAnyParentAttr(t){const e=this._keptAttrs;for(let i=e.length-1;i>=0;i--)if(e[i].name===t)return e[i].value}hasAnyParentAttr(t){const e=this._keptAttrs;for(let i=e.length-1;i>=0;i--)if(e[i].name===t)return!0;return!1}getPosition(){return 0===this.path.length?-1:this.path[this.path.length-1].position??0}getCounter(){return 0===this.path.length?-1:this.path[this.path.length-1].counter??0}getIndex(){return this.getPosition()}getDepth(){return this.path.length}toString(t,e=!0){const i=t||this.separator;if(i===this.separator&&!0===e){if(null!==this._pathStringCache)return this._pathStringCache;const t=this.path.map(t=>t.namespace?`${t.namespace}:${t.tag}`:t.tag).join(i);return this._pathStringCache=t,t}return this.path.map(t=>e&&t.namespace?`${t.namespace}:${t.tag}`:t.tag).join(i)}toArray(){return this.path.map(t=>t.tag)}reset(){this._pathStringCache=null,this.path=[],this.siblingStacks=[],this._keptAttrs=[]}matches(t){const e=t.segments;return 0!==e.length&&(t.hasDeepWildcard()?this._matchWithDeepWildcard(e):this._matchSimple(e))}_matchSimple(t){if(this.path.length!==t.length)return!1;for(let e=0;e<t.length;e++)if(!this._matchSegment(t[e],this.path[e],e===this.path.length-1))return!1;return!0}_matchWithDeepWildcard(t){let e=this.path.length-1,i=t.length-1;for(;i>=0&&e>=0;){const n=t[i];if("deep-wildcard"===n.type){if(i--,i<0)return!0;const n=t[i];let r=!1;for(let t=e;t>=0;t--)if(this._matchSegment(n,this.path[t],t===this.path.length-1)){e=t-1,i--,r=!0;break}if(!r)return!1}else{if(!this._matchSegment(n,this.path[e],e===this.path.length-1))return!1;e--,i--}}return i<0}_matchSegment(t,e,i){if("*"!==t.tag&&t.tag!==e.tag)return!1;if(void 0!==t.namespace&&"*"!==t.namespace&&t.namespace!==e.namespace)return!1;if(void 0!==t.attrName){if(!i)return!1;if(!e.values||!(t.attrName in e.values))return!1;if(void 0!==t.attrValue&&String(e.values[t.attrName])!==String(t.attrValue))return!1}if(void 0!==t.position){if(!i)return!1;const n=e.counter??0;if("first"===t.position&&0!==n)return!1;if("odd"===t.position&&n%2!=1)return!1;if("even"===t.position&&n%2!=0)return!1;if("nth"===t.position&&n!==t.positionValue)return!1}return!0}matchesAny(t){return t.matchesAny(this)}snapshot(){return{path:this.path.map(t=>({...t})),siblingStacks:this.siblingStacks.map(t=>t?{counts:new Map(t.counts),total:t.total}:t),keptAttrs:this._keptAttrs.map(t=>({...t}))}}restore(t){this._pathStringCache=null,this.path=t.path.map(t=>({...t})),this.siblingStacks=t.siblingStacks.map(t=>t?{counts:new Map(t.counts),total:t.total}:t),this._keptAttrs=(t.keptAttrs||[]).map(t=>({...t}))}readOnly(){return this._view}}class st{constructor(t,e={},i){this.pattern=t,this.separator=e.separator||".",this.segments=this._parse(t),this.data=i,this._hasDeepWildcard=this.segments.some(t=>"deep-wildcard"===t.type),this._hasAttributeCondition=this.segments.some(t=>void 0!==t.attrName),this._hasPositionSelector=this.segments.some(t=>void 0!==t.position)}_parse(t){const e=[];let i=0,n="";for(;i<t.length;)t[i]===this.separator?i+1<t.length&&t[i+1]===this.separator?(n.trim()&&(e.push(this._parseSegment(n.trim())),n=""),e.push({type:"deep-wildcard"}),i+=2):(n.trim()&&e.push(this._parseSegment(n.trim())),n="",i++):(n+=t[i],i++);return n.trim()&&e.push(this._parseSegment(n.trim())),e}_parseSegment(t){const e={type:"tag"};let i=null,n=t;const r=t.match(/^([^\[]+)(\[[^\]]*\])(.*)$/);if(r&&(n=r[1]+r[3],r[2])){const t=r[2].slice(1,-1);t&&(i=t)}let s,o,a=n;if(n.includes("::")){const e=n.indexOf("::");if(s=n.substring(0,e).trim(),a=n.substring(e+2).trim(),!s)throw new Error(`Invalid namespace in pattern: ${t}`)}let l=null;if(a.includes(":")){const t=a.lastIndexOf(":"),e=a.substring(0,t).trim(),i=a.substring(t+1).trim();["first","last","odd","even"].includes(i)||/^nth\(\d+\)$/.test(i)?(o=e,l=i):o=a}else o=a;if(!o)throw new Error(`Invalid segment pattern: ${t}`);if(e.tag=o,s&&(e.namespace=s),i)if(i.includes("=")){const t=i.indexOf("=");e.attrName=i.substring(0,t).trim(),e.attrValue=i.substring(t+1).trim()}else e.attrName=i.trim();if(l){const t=l.match(/^nth\((\d+)\)$/);t?(e.position="nth",e.positionValue=parseInt(t[1],10)):e.position=l}return e}get length(){return this.segments.length}hasDeepWildcard(){return this._hasDeepWildcard}hasAttributeCondition(){return this._hasAttributeCondition}hasPositionSelector(){return this._hasPositionSelector}toString(){return this.pattern}}class ot{constructor(){this._byDepthAndTag=new Map,this._wildcardByDepth=new Map,this._deepWildcards=[],this._deepByTerminalTag=new Map,this._patterns=new Set,this._sealed=!1}add(t){if(this._sealed)throw new TypeError("ExpressionSet is sealed. Create a new ExpressionSet to add more expressions.");if(this._patterns.has(t.pattern))return this;if(this._patterns.add(t.pattern),t.hasDeepWildcard()){const e=t.segments[t.segments.length-1];if(e&&"deep-wildcard"!==e.type&&"*"!==e.tag){const i=e.tag;this._deepByTerminalTag.has(i)||this._deepByTerminalTag.set(i,[]),this._deepByTerminalTag.get(i).push(t)}else this._deepWildcards.push(t);return this}const e=t.length,i=t.segments[t.segments.length-1],n=i?.tag;if(n&&"*"!==n){const i=`${e}:${n}`;this._byDepthAndTag.has(i)||this._byDepthAndTag.set(i,[]),this._byDepthAndTag.get(i).push(t)}else this._wildcardByDepth.has(e)||this._wildcardByDepth.set(e,[]),this._wildcardByDepth.get(e).push(t);return this}addAll(t){for(const e of t)this.add(e);return this}has(t){return this._patterns.has(t.pattern)}get size(){return this._patterns.size}seal(){return this._sealed=!0,this}get isSealed(){return this._sealed}matchesAny(t){return null!==this.findMatch(t)}findMatch(t){const e=t.getDepth(),i=t.getCurrentTag(),n=`${e}:${i}`,r=this._byDepthAndTag.get(n);if(r)for(let e=0;e<r.length;e++)if(t.matches(r[e]))return r[e];const s=this._wildcardByDepth.get(e);if(s)for(let e=0;e<s.length;e++)if(t.matches(s[e]))return s[e];const o=this._deepByTerminalTag.get(i);if(o)for(let e=0;e<o.length;e++)if(t.matches(o[e]))return o[e];for(let e=0;e<this._deepWildcards.length;e++)if(t.matches(this._deepWildcards[e]))return this._deepWildcards[e];return null}}const at={cent:"¢",pound:"£",curren:"¤",yen:"¥",euro:"€",dollar:"$",fnof:"ƒ",inr:"₹",af:"؋",birr:"ብር",peso:"₱",rub:"₽",won:"₩",yuan:"¥",cedil:"¸"},lt={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'},pt={nbsp:" ",copy:"©",reg:"®",trade:"™",mdash:"—",ndash:"–",hellip:"…",laquo:"«",raquo:"»",lsquo:"‘",rsquo:"’",ldquo:"“",rdquo:"”",bull:"•",para:"¶",sect:"§",deg:"°",frac12:"½",frac14:"¼",frac34:"¾"},ct=Object.freeze({ALLOW:"allow",BLOCK:"block",THROW:"throw"}),ht=new Set("!?\\\\/[]$%{}^&*()<>|+");function dt(t){if("#"===t[0])throw new Error(`[EntityReplacer] Invalid character '#' in entity name: "${t}"`);for(const e of t)if(ht.has(e))throw new Error(`[EntityReplacer] Invalid character '${e}' in entity name: "${t}"`);return t}function ut(...t){const e=Object.create(null);for(const i of t)if(i)for(const t of Object.keys(i)){const n=i[t];if("string"==typeof n)e[t]=n;else if(n&&"object"==typeof n&&void 0!==n.val){const i=n.val;"string"==typeof i&&(e[t]=i)}}return e}const ft="external",gt="base",mt="all",xt=Object.freeze({allow:0,leave:1,remove:2,throw:3}),bt=new Set([9,10,13]);class yt{constructor(t={}){var e;this._limit=t.limit||{},this._maxTotalExpansions=this._limit.maxTotalExpansions||0,this._maxExpandedLength=this._limit.maxExpandedLength||0,this._postCheck="function"==typeof t.postCheck?t.postCheck:t=>t,this._limitTiers=(e=this._limit.applyLimitsTo??ft)&&e!==ft?e===mt?new Set([mt]):e===gt?new Set([gt]):Array.isArray(e)?new Set(e):new Set([ft]):new Set([ft]),this._numericAllowed=t.numericAllowed??!0,this._baseMap=ut(lt,t.namedEntities||null),this._externalMap=Object.create(null),this._inputMap=Object.create(null),this._totalExpansions=0,this._expandedLength=0,this._removeSet=new Set(t.remove&&Array.isArray(t.remove)?t.remove:[]),this._leaveSet=new Set(t.leave&&Array.isArray(t.leave)?t.leave:[]);const i=function(t){if(!t)return{xmlVersion:1,onLevel:xt.allow,nullLevel:xt.remove};const e=1.1===t.xmlVersion?1.1:1,i=xt[t.onNCR]??xt.allow,n=xt[t.nullNCR]??xt.remove;return{xmlVersion:e,onLevel:i,nullLevel:Math.max(n,xt.remove)}}(t.ncr);this._ncrXmlVersion=i.xmlVersion,this._ncrOnLevel=i.onLevel,this._ncrNullLevel=i.nullLevel,this._onExternalEntity="function"==typeof t.onExternalEntity?t.onExternalEntity:null,this._onInputEntity="function"==typeof t.onInputEntity?t.onInputEntity:null}_applyRegistrationHook(t,e,i,n){if(!t)return!0;const r=t(e,i);if(r===ct.BLOCK)return!1;if(r===ct.THROW)throw new Error(`[EntityDecoder] Registration of ${n} entity "&${e};" was rejected by hook`);return!0}setExternalEntities(t){if(t)for(const e of Object.keys(t))dt(e);if(!this._onExternalEntity)return void(this._externalMap=ut(t));const e=ut(t),i=Object.create(null);for(const[t,n]of Object.entries(e))this._applyRegistrationHook(this._onExternalEntity,t,n,"external")&&(i[t]=n);this._externalMap=i}addExternalEntity(t,e){dt(t),"string"==typeof e&&-1===e.indexOf("&")&&this._applyRegistrationHook(this._onExternalEntity,t,e,"external")&&(this._externalMap[t]=e)}addInputEntities(t){if(this._totalExpansions=0,this._expandedLength=0,!this._onInputEntity)return void(this._inputMap=ut(t));const e=ut(t),i=Object.create(null);for(const[t,n]of Object.entries(e))this._applyRegistrationHook(this._onInputEntity,t,n,"input")&&(i[t]=n);this._inputMap=i}reset(){return this._inputMap=Object.create(null),this._totalExpansions=0,this._expandedLength=0,this}setXmlVersion(t){this._ncrXmlVersion=1.1===t?1.1:1}decode(t){if("string"!=typeof t||0===t.length)return t;if(-1===t.indexOf("&"))return t;const e=t,i=[],n=t.length;let r=0,s=0;const o=this._maxTotalExpansions>0,a=this._maxExpandedLength>0,l=o||a;for(;s<n;){if(38!==t.charCodeAt(s)){s++;continue}let e=s+1;for(;e<n&&59!==t.charCodeAt(e)&&e-s<=32;)e++;if(e>=n||59!==t.charCodeAt(e)){s++;continue}const p=t.slice(s+1,e);if(0===p.length){s++;continue}let c,h;if(this._removeSet.has(p))c="",void 0===h&&(h=ft);else{if(this._leaveSet.has(p)){s++;continue}if(35===p.charCodeAt(0)){const t=this._resolveNCR(p);if(void 0===t){s++;continue}c=t,h=gt}else{const t=this._resolveName(p);c=t?.value,h=t?.tier}}if(void 0!==c){if(s>r&&i.push(t.slice(r,s)),i.push(c),r=e+1,s=r,l&&this._tierCounts(h)){if(o&&(this._totalExpansions++,this._totalExpansions>this._maxTotalExpansions))throw new Error(`[EntityReplacer] Entity expansion count limit exceeded: ${this._totalExpansions} > ${this._maxTotalExpansions}`);if(a){const t=c.length-(p.length+2);if(t>0&&(this._expandedLength+=t,this._expandedLength>this._maxExpandedLength))throw new Error(`[EntityReplacer] Expanded content length limit exceeded: ${this._expandedLength} > ${this._maxExpandedLength}`)}}}else s++}r<n&&i.push(t.slice(r));const p=0===i.length?t:i.join("");return this._postCheck(p,e)}_tierCounts(t){return!!this._limitTiers.has(mt)||this._limitTiers.has(t)}_resolveName(t){return t in this._inputMap?{value:this._inputMap[t],tier:ft}:t in this._externalMap?{value:this._externalMap[t],tier:ft}:t in this._baseMap?{value:this._baseMap[t],tier:gt}:void 0}_classifyNCR(t){return 0===t?this._ncrNullLevel:t>=55296&&t<=57343||1===this._ncrXmlVersion&&t>=1&&t<=31&&!bt.has(t)?xt.remove:-1}_applyNCRAction(t,e,i){switch(t){case xt.allow:return String.fromCodePoint(i);case xt.remove:return"";case xt.leave:return;case xt.throw:throw new Error(`[EntityDecoder] Prohibited numeric character reference &${e}; (U+${i.toString(16).toUpperCase().padStart(4,"0")})`);default:return String.fromCodePoint(i)}}_resolveNCR(t){const e=t.charCodeAt(1);let i;if(i=120===e||88===e?parseInt(t.slice(2),16):parseInt(t.slice(1),10),Number.isNaN(i)||i<0||i>1114111)return;const n=this._classifyNCR(i);if(!this._numericAllowed&&n<xt.remove)return;const r=-1===n?this._ncrOnLevel:Math.max(this._ncrOnLevel,n);return this._applyNCRAction(r,t,i)}}const Nt=[{id:"sql-block-comment-open",description:"SQL block comment open: /* ... */ — unusual in legitimate user text",pattern:/\/\*/},{id:"sql-union-select",description:"UNION SELECT — most common SQL injection aggregation attack",pattern:/\bUNION\s{1,20}(?:ALL\s{1,20})?SELECT\b/i},{id:"sql-drop-table",description:"DROP TABLE — destructive DDL injection",pattern:/\bDROP\s{1,20}TABLE\b/i},{id:"sql-drop-database",description:"DROP DATABASE — destructive DDL injection",pattern:/\bDROP\s{1,20}DATABASE\b/i},{id:"sql-insert-into",description:"INSERT INTO — data injection",pattern:/\bINSERT\s{1,20}INTO\b/i},{id:"sql-delete-from",description:"DELETE FROM — data deletion injection",pattern:/\bDELETE\s{1,20}FROM\b/i},{id:"sql-update-set",description:"UPDATE ... SET — data modification injection",pattern:/\bUPDATE\b[\s\S]{1,60}\bSET\b/i},{id:"sql-exec-xp",description:"EXEC xp_ — MSSQL extended stored procedure execution",pattern:/\bEXEC(?:UTE)?\s{1,20}xp_/i},{id:"sql-tautology-string",description:'Classic string tautology: \' OR \'1\'=\'1 or " OR "1"="1"',pattern:/'\s{0,10}OR\s{0,10}'[^']{0,20}'\s*=\s*'[^']{0,20}/i},{id:"sql-tautology-numeric",description:"Numeric tautology: OR 1=1",pattern:/\bOR\s{1,10}1\s*=\s*1\b/i},{id:"sql-always-true-zero",description:"Numeric tautology: OR 0=0",pattern:/\bOR\s{1,10}0\s*=\s*0\b/i},{id:"sql-sleep-benchmark",description:"Time-based blind injection: SLEEP() or BENCHMARK()",pattern:/\b(?:SLEEP|BENCHMARK)\s*\(/i},{id:"sql-waitfor-delay",description:"MSSQL time-based blind injection: WAITFOR DELAY",pattern:/\bWAITFOR\s{1,20}DELAY\b/i},{id:"sql-char-function",description:"CHAR() function — used to obfuscate injected strings",pattern:/\bCHAR\s*\(\s*\d{1,3}/i},{id:"sql-information-schema",description:"INFORMATION_SCHEMA — reconnaissance query for table/column enumeration",pattern:/\bINFORMATION_SCHEMA\b/i}],Et=[...Nt,{id:"sql-line-comment",description:"SQL line comment: -- followed by whitespace or end of string",pattern:/--(?:\s|$)/},{id:"sql-stacked-query",description:"Stacked queries: semicolon immediately followed by a SQL keyword",pattern:/;\s{0,10}(?:SELECT|INSERT|UPDATE|DELETE|DROP|CREATE|ALTER|EXEC)\b/i},{id:"sql-hex-encoding",description:"Hex-encoded string injection: 0x41414141 style (MySQL)",pattern:/\b0x[0-9a-f]{4,}/i}],wt=[{id:"html-script-open",description:"<script opening tag",pattern:/<script[\s>/]/i},{id:"html-script-close",description:"<\/script closing tag",pattern:/<\/script[\s>]/i},{id:"html-javascript-protocol",description:"javascript: URI scheme (with optional whitespace/encoding)",pattern:/j[\t\n\r ]*a[\t\n\r ]*v[\t\n\r ]*a[\t\n\r ]*s[\t\n\r ]*c[\t\n\r ]*r[\t\n\r ]*i[\t\n\r ]*p[\t\n\r ]*t[\t\n\r ]*:/i},{id:"html-vbscript-protocol",description:"vbscript: URI scheme",pattern:/vbscript[\t\n\r ]*:/i},{id:"html-data-html",description:"data:text/html URI — can execute scripts in browsers",pattern:/data[\t\n\r ]*:[\t\n\r ]*text\/html/i},{id:"html-data-xhtml",description:"data:application/xhtml+xml URI",pattern:/data[\t\n\r ]*:[\t\n\r ]*application\/xhtml/i},{id:"html-data-svg",description:"data:image/svg+xml URI — can execute scripts",pattern:/data[\t\n\r ]*:[\t\n\r ]*image\/svg\+xml/i},{id:"html-inline-event-handler",description:"Inline event handler attributes: onclick=, onerror=, onload=, etc.",pattern:/\bon\w{1,30}\s*=/i},{id:"html-entity-obfuscated-script",description:"HTML-entity-encoded <script (e.g. <script or <script)",pattern:/(?:�*3[Cc];?|�*60;?|<)\s*script/i},{id:"html-entity-obfuscated-javascript",description:'HTML-entity-encoded javascript: (partial — catches common j or j for "j")',pattern:/(?:�*6[Aa];?|�*106;?)\s*(?:�*61;?|a)[\s\S]{0,80}script\s*:/i},{id:"html-style-expression",description:"CSS expression() — IE-era code execution in style attributes",pattern:/style[\s\S]{0,20}expression\s*\(/i},{id:"html-object-embed",description:"<object or <embed tags that can load active content",pattern:/<(?:object|embed)[\s>/]/i},{id:"html-base-tag",description:"<base href= — can hijack all relative URLs on a page",pattern:/<base[\s>]/i},{id:"html-meta-refresh",description:'<meta http-equiv="refresh" — can redirect users',pattern:/<meta[\s\S]{0,40}http-equiv[\s\S]{0,20}refresh/i},{id:"html-srcdoc",description:"srcdoc= attribute on iframes — embeds HTML that can run scripts",pattern:/srcdoc\s*=/i},{id:"html-iframe",description:"<iframe tag",pattern:/<iframe[\s>/]/i},{id:"html-form",description:"<form tag — can be used for phishing / credential harvesting injection",pattern:/<form[\s>/]/i}],vt=[{id:"xml-cdata-injection",description:"CDATA section injection: <![CDATA[ breaks out of text node context",pattern:/<!\[CDATA\[/i},{id:"xml-cdata-close",description:"CDATA close sequence: ]]> can terminate an enclosing CDATA section",pattern:/\]\]>/},{id:"xml-processing-instruction",description:"XML processing instruction: <?xml-stylesheet or <?php etc.",pattern:/<\?(?:xml[\- ]|php|asp)/i},{id:"xml-doctype-injection",description:"DOCTYPE declaration embedded in content — can define entities",pattern:/<!DOCTYPE(?:[\s[]|$)/i},{id:"xml-entity-system",description:"SYSTEM keyword — used in external entity declarations (XXE)",pattern:/\bSYSTEM\s+["']/i},{id:"xml-entity-public",description:"PUBLIC keyword — used in external entity declarations (XXE)",pattern:/\bPUBLIC\s+["']/i},{id:"xml-entity-declaration",description:"<!ENTITY declaration — defines entities, potential XXE or entity expansion",pattern:/<!ENTITY[\s%]/i},{id:"xml-billion-laughs",description:"Entity reference chaining / billion laughs: repeated &eX; style references",pattern:/(?:&\w{1,20};){3,}/},{id:"xml-namespace-confusion",description:"xmlns: attribute injection — can redefine namespaces to confuse parsers",pattern:/\bxmlns\s*(?::\w{1,40})?\s*=/i},{id:"xml-comment-injection",description:"\x3c!-- comment injection — can hide content from some parsers",pattern:/<!--/},{id:"xml-comment-close",description:"--\x3e closes an enclosing XML comment",pattern:/-->/},{id:"xml-pi-close",description:"?> closes an enclosing processing instruction",pattern:/\?>/}],St=[{id:"svg-script-element",description:"<script element inside SVG executes JavaScript",pattern:/<script[\s>/]/i},{id:"svg-xlink-href-javascript",description:"xlink:href with javascript: — classic SVG XSS via <a> or <use>",pattern:/xlink\s*:\s*href\s*=\s*["']?\s*javascript\s*:/i},{id:"svg-href-javascript",description:"href= with javascript: in SVG context (<a>, <animate>, etc.)",pattern:/href\s*=\s*["']?\s*javascript\s*:/i},{id:"svg-foreignobject",description:"<foreignObject embeds HTML inside SVG — can execute scripts",pattern:/<foreignObject[\s>/]/i},{id:"svg-use-external",description:"<use xlink:href or href pointing to external resource (non-fragment URL)",pattern:/<use[\s\S]{0,60}(?:xlink\s*:\s*)?href\s*=\s*(?:["'][^#]|[^"'#\s>])/i},{id:"svg-animate-href",description:'<animate attributeName="href" — can dynamically change href to javascript:',pattern:/<animate[\s\S]{0,80}attributeName\s*=\s*["'][\s]*href["']/i},{id:"svg-animate-xlinkhref",description:'<animate attributeName="xlink:href"',pattern:/<animate[\s\S]{0,80}attributeName\s*=\s*["'][\s]*xlink\s*:\s*href["']/i},{id:"svg-set-javascript",description:'<set to="javascript:..." — sets an attribute to a javascript: URI',pattern:/<set[\s\S]{0,80}to\s*=\s*["']?\s*javascript\s*:/i},{id:"svg-event-handler",description:"SVG-specific event handler attributes: onload=, onerror=, onactivate=, etc.",pattern:/\bon(?:load|error|activate|begin|end|repeat|focus|blur|click|mouse\w{1,20}|key\w{1,20})\s*=/i},{id:"svg-handler-generic",description:"Generic on* handler catch-all for SVG attributes",pattern:/\bon\w{1,30}\s*=/i},{id:"svg-filter-feimage",description:"<feImage href= — filter primitive that can load external resources",pattern:/<feImage[\s\S]{0,80}(?:xlink\s*:\s*)?href\s*=/i},{id:"svg-image-external",description:"<image xlink:href with http/https or javascript protocol",pattern:/<image[\s\S]{0,80}(?:xlink\s*:\s*)?href\s*=\s*["']?\s*(?:https?|javascript)\s*:/i},{id:"svg-style-javascript",description:"style= attribute containing javascript: (e.g. background:url(javascript:...))",pattern:/style\s*=[\s\S]{0,60}javascript\s*:/i}],At=[{id:"shell-path-traversal-unix",description:"Unix path traversal: ../ — climbing the directory tree",pattern:/\.\.\//},{id:"shell-path-traversal-windows",description:"Windows path traversal: ..\\ — climbing the directory tree",pattern:/\.\.\\/},{id:"shell-path-traversal-encoded",description:"URL-encoded path traversal: %2e%2e or %2f variants",pattern:/%2e%2e|%2f\.\.|\.\.%2f/i},{id:"shell-null-byte",description:"Null byte injection: \\x00 or %00 — truncates strings in C-backed functions",pattern:/\x00|%00/},{id:"shell-semicolon",description:"Semicolon command separator: cmd1; cmd2",pattern:/;/},{id:"shell-pipe",description:"Pipe operator: cmd1 | cmd2",pattern:/\|/},{id:"shell-and-operator",description:"AND operator: cmd1 && cmd2",pattern:/&&/},{id:"shell-or-operator",description:"OR operator: cmd1 || cmd2",pattern:/\|\|/},{id:"shell-backtick",description:"Backtick command substitution: `cmd`",pattern:/`/},{id:"shell-dollar-paren",description:"Dollar-paren command substitution: $(cmd)",pattern:/\$\(/},{id:"shell-dollar-brace",description:"Dollar-brace variable expansion: ${var} — can be abused for injection",pattern:/\$\{/},{id:"shell-redirect-out",description:"Output redirection: cmd > file or cmd >> file",pattern:/>{1,2}/},{id:"shell-redirect-in",description:"Input redirection: cmd < file",pattern:/</},{id:"shell-newline-injection",description:"Newline injection: \\n or \\r — can inject new shell commands",pattern:/[\n\r]/},{id:"shell-glob-star",description:"Glob expansion: * or ? — can expand to unintended files",pattern:/[/\\][*?]/},{id:"shell-absolute-root",description:"Absolute root path injection: string starting with / or \\ (Windows UNC)",pattern:/^(?:\/|\\\\)/},{id:"shell-windows-drive",description:"Windows drive letter path injection: C:\\ or D:/",pattern:/^[a-zA-Z]:[/\\]/},{id:"shell-curl-wget",description:"curl/wget with URL or flags — can exfiltrate data or download payloads",pattern:/\b(?:curl|wget)\s+(?:https?:\/\/|ftp:\/\/|-)/i}],Tt=[{id:"redos-nested-quantifier-plus",description:"Nested + quantifier inside a group with outer quantifier: (a+)+, (.+b)*, etc.",pattern:/\([^)]*\+[^)]*\)[+*]/},{id:"redos-nested-quantifier-star",description:"Nested * quantifier: (a*)* or (a*)+ — catastrophic backtracking",pattern:/\([^)]*\*[^)]*\)[*+]/},{id:"redos-nested-groups",description:"Doubly nested quantified groups: ((a+)+) — guaranteed catastrophic",pattern:/\(\([^)]{0,40}\)[+*]\)[+*]/},{id:"redos-alternation-overlap",description:"Overlapping alternation under quantifier: (a|a)+ — ambiguous NFA paths",pattern:/\(([^|()]{1,20})\|(?:\1)(?:\|[^|()]{1,20}){0,5}\)[+*?]{1,2}/},{id:"redos-star-plus-concat",description:"(x*x)+ pattern — triggers super-linear backtracking",pattern:/\([^)]{0,10}\*[^)]{0,10}\)[+*]/},{id:"redos-dot-star-greedy",description:"(.*){n,} or (.+){n,} — repeated greedy dot quantifiers",pattern:/\(\.[*+]\)\{?\d/},{id:"redos-large-repetition",description:"Very large fixed or range repetition count {1000,} or {1000,n} — denial of service via backtracking",pattern:/\{\d{4,}(?:,\d*)?\}/},{id:"redos-catastrophic-alternation",description:"Long alternation with many similar branches — polynomial backtracking risk",pattern:/\([^)]{0,200}(?:\|[^|)]{0,50}){9,}\)/}],_t="[\"'\\s]*:",Ct=[{id:"nosql-where-operator",description:"$where — executes arbitrary JavaScript server-side in MongoDB",pattern:new RegExp(`\\$where${_t}`,"i")},{id:"nosql-ne-operator",description:'$ne — "not equal" operator used to bypass equality checks',pattern:new RegExp(`\\$ne${_t}`,"i")},{id:"nosql-gt-operator",description:'$gt — "greater than" used to bypass password/value checks',pattern:new RegExp(`\\$gte?${_t}`,"i")},{id:"nosql-lt-operator",description:'$lt / $lte — "less than" bypass variants',pattern:new RegExp(`\\$lte?${_t}`,"i")},{id:"nosql-regex-operator",description:"$regex — can be used to extract data character by character (blind injection)",pattern:new RegExp(`\\$regex${_t}`,"i")},{id:"nosql-or-operator",description:"$or — logical OR; used to create always-true conditions",pattern:new RegExp(`\\$or${_t}\\s*\\[`,"i")},{id:"nosql-and-operator",description:"$and — logical AND operator injection",pattern:new RegExp(`\\$and${_t}\\s*\\[`,"i")},{id:"nosql-nor-operator",description:"$nor — logical NOR operator injection",pattern:new RegExp(`\\$nor${_t}\\s*\\[`,"i")},{id:"nosql-exists-operator",description:"$exists — can enumerate fields to determine schema",pattern:new RegExp(`\\$exists${_t}`,"i")},{id:"nosql-in-operator",description:"$in — matches any value in a list; can enumerate values",pattern:new RegExp(`\\$in${_t}\\s*\\[`,"i")},{id:"nosql-expr-operator",description:"$expr — allows aggregation expressions in queries (MongoDB 3.6+)",pattern:new RegExp(`\\$expr${_t}`,"i")},{id:"nosql-function-operator",description:"$function — executes arbitrary JavaScript in MongoDB 4.4+",pattern:new RegExp(`\\$function${_t}`,"i")},{id:"nosql-accumulator-operator",description:"$accumulator — custom aggregation with arbitrary JS execution",pattern:new RegExp(`\\$accumulator${_t}`,"i")},{id:"nosql-proto-pollution",description:"__proto__ — prototype pollution via object key injection",pattern:/__proto__/},{id:"nosql-constructor-prototype",description:"constructor.prototype — alternative prototype pollution vector (dot notation or JSON key)",pattern:/constructor[\s"':.,{\[]*prototype/i},{id:"nosql-proto-bracket",description:'["__proto__"] — bracket-notation prototype pollution',pattern:/\[["']__proto__["']\]/}],$t=[{id:"log-crlf-injection",description:"CRLF injection: literal \\r or \\n embeds fake log lines",pattern:/[\r\n]/},{id:"log-url-encoded-crlf",description:"URL-encoded CRLF: %0d, %0a, %0D, %0A — decoded by some log parsers",pattern:/%0[dDaA]/},{id:"log-unicode-newline",description:"Unicode newline variants: U+2028 (line separator), U+2029 (paragraph separator)",pattern:/[\u2028\u2029]/},{id:"log-log4shell-jndi",description:"Log4Shell: ${jndi:...} triggers remote code execution in Apache Log4j",pattern:/\$\{jndi\s*:/i},{id:"log-log4shell-obfuscated",description:"Obfuscated Log4Shell: ${::-j}... lookup-bypass prefix used to evade WAF detection",pattern:/\$\{::-/},{id:"log-log4j-lookup",description:"Log4j lookup syntax: ${env:...}, ${sys:...}, ${ctx:...} — data exfiltration",pattern:/\$\{(?:env|sys|ctx|main|map|sd|web|docker|k8s|spring)\s*:/i},{id:"log-ssti-double-brace",description:"SSTI double-brace: {{expression}} — Jinja2, Twig, Handlebars, etc.",pattern:/\{\{[\s\S]{0,80}\}\}/},{id:"log-ssti-hash-brace",description:"SSTI hash-brace: #{expression} — Thymeleaf, Velocity, Ruby ERB",pattern:/#\{[\s\S]{0,80}\}/},{id:"log-ssti-dollar-brace",description:"SSTI/EL injection: ${expression with operators or method calls} — JSP EL, Freemarker, SpEL",pattern:/\$\{[^}]*(?:\.|\(|\*|\+|\bclass\b|\bruntime\b|\bprocess\b|\bexec\b)[^}]{0,80}\}/i},{id:"log-ssti-percent-tag",description:"SSTI ERB/ASP tag: <%= expression %> — Ruby ERB, ASP",pattern:/<%=[\s\S]{0,80}%>/},{id:"log-null-byte",description:"Null byte: \\x00 or %00 — can truncate log entries in C-backed loggers",pattern:/\x00|%00/},{id:"log-ansi-escape",description:"ANSI escape sequence: ESC[ — can manipulate terminal output when logs are tailed",pattern:/\x1b\[/}];function Pt(t,e){const i=e.label??"CUSTOM";for(const n of e)if(n.pattern.test(t))return{context:i,id:n.id,description:n.description,pattern:n.pattern};return null}function Ot(t,e){(function(t){if("string"!=typeof t)throw new TypeError("is-unsafe: first argument must be a string, got "+typeof t)})(t),function(t){if(!(t instanceof RegExp)){if(!Array.isArray(t))throw new TypeError("is-unsafe: second argument must be a PatternList (e.g. HTML), an array of PatternLists (e.g. [HTML, XML]), or a RegExp. Got: "+typeof t);if(0===t.length)throw new TypeError("is-unsafe: context must not be an empty array");if(Array.isArray(t[0]))for(const e of t)if(!Array.isArray(e)||0===e.length)throw new TypeError("is-unsafe: each context in the array must be a non-empty pattern array (PatternList)")}}(e);const{lists:i,regex:n}=function(t){return t instanceof RegExp?{lists:null,regex:t}:Array.isArray(t[0])?{lists:t,regex:null}:{lists:[t],regex:null}}(e);if(n)return n.test(t);for(const e of i)if(null!==Pt(t,e))return!0;return!1}function jt(t,e){if(!t)return{};const i=e.attributesGroupName?t[e.attributesGroupName]:t;if(!i)return{};const n={};for(const t in i)t.startsWith(e.attributeNamePrefix)?n[t.substring(e.attributeNamePrefix.length)]=i[t]:n[t]=i[t];return n}function It(t){if(!t||"string"!=typeof t)return;const e=t.indexOf(":");if(-1!==e&&e>0){const i=t.substring(0,e);if("xmlns"!==i)return i}}wt.label="HTML",vt.label="XML",St.label="SVG",Nt.label="SQL",Et.label="SQL-STRICT",At.label="SHELL",Tt.label="REDOS",Ct.label="NOSQL",$t.label="LOG",Object.freeze({HTML:wt,XML:vt,SVG:St,SQL:Nt,"SQL-STRICT":Et,SHELL:At,REDOS:Tt,NOSQL:Ct,LOG:$t});class kt{constructor(t,e){var i;this.options=t,this.currentNode=null,this.tagsNodeStack=[],this.parseXml=Vt,this.parseTextData=Lt,this.resolveNameSpace=Dt,this.buildAttributesMap=Mt,this.isItStopNode=Bt,this.replaceEntitiesValue=Ft,this.readStopNodeData=zt,this.saveTextToParentTag=Ut,this.addChild=qt,this.ignoreAttributesFn="function"==typeof(i=this.options.ignoreAttributes)?i:Array.isArray(i)?t=>{for(const e of i){if("string"==typeof e&&t===e)return!0;if(e instanceof RegExp&&e.test(t))return!0}}:()=>!1,this.entityExpansionCount=0,this.currentExpandedLength=0,this.doctypefound=!1;let n={...lt};this.options.entityDecoder?this.entityDecoder=this.options.entityDecoder:("object"==typeof this.options.htmlEntities?n=this.options.htmlEntities:!0===this.options.htmlEntities&&(n={...pt,...at}),this.entityDecoder=new yt({namedEntities:{...n,...e},numericAllowed:this.options.htmlEntities,limit:{maxTotalExpansions:this.options.processEntities.maxTotalExpansions,maxExpandedLength:this.options.processEntities.maxExpandedLength,applyLimitsTo:this.options.processEntities.appliesTo},onInputEntity:(t,e)=>Ot(e,[wt,vt])?ct.BLOCK:ct.ALLOW})),this.matcher=new rt,this.readonlyMatcher=this.matcher.readOnly(),this.isCurrentNodeStopNode=!1,this.stopNodeExpressionsSet=new ot;const r=this.options.stopNodes;if(r&&r.length>0){for(let t=0;t<r.length;t++){const e=r[t];"string"==typeof e?this.stopNodeExpressionsSet.add(new st(e)):e instanceof st&&this.stopNodeExpressionsSet.add(e)}this.stopNodeExpressionsSet.seal()}}}function Lt(t,e,i,n,r,s,o){const a=this.options;if(void 0!==t&&(a.trimValues&&!n&&(t=t.trim()),t.length>0)){o||(t=this.replaceEntitiesValue(t,e,i));const n=a.jPath?i.toString():i,l=a.tagValueProcessor(e,t,n,r,s);return null==l?t:typeof l!=typeof t||l!==t?l:a.trimValues||t.trim()===t?Yt(t,a.parseTagValue,a.numberParseOptions):t}}function Dt(t){if(this.options.removeNSPrefix){const e=t.split(":"),i="/"===t.charAt(0)?"/":"";if("xmlns"===e[0])return"";2===e.length&&(t=i+e[1])}return t}const Rt=new RegExp("([^\\s=]+)\\s*(=\\s*(['\"])([\\s\\S]*?)\\3)?","gm");function Mt(t,e,i,n=!1){const s=this.options;if(!0===n||!0!==s.ignoreAttributes&&"string"==typeof t){const n=r(t,Rt),o=n.length,a={},l=new Array(o);let p=!1;const c={};for(let t=0;t<o;t++){const e=this.resolveNameSpace(n[t][1]),r=n[t][4];if(e.length&&void 0!==r){let n=r;s.trimValues&&(n=n.trim()),n=this.replaceEntitiesValue(n,i,this.readonlyMatcher),l[t]=n,c[e]=n,p=!0}}p&&"object"==typeof e&&e.updateCurrent&&e.updateCurrent(c);const h=s.jPath?e.toString():this.readonlyMatcher;let d=!1;for(let t=0;t<o;t++){const e=this.resolveNameSpace(n[t][1]);if(this.ignoreAttributesFn(e,h))continue;let i=s.attributeNamePrefix+e;if(e.length)if(s.transformAttributeName&&(i=s.transformAttributeName(i)),i=Qt(i,s),void 0!==n[t][4]){const n=l[t],r=s.attributeValueProcessor(e,n,h);a[i]=null==r?n:typeof r!=typeof n||r!==n?r:Yt(n,s.parseAttributeValue,s.numberParseOptions),d=!0}else s.allowBooleanAttributes&&(a[i]=!0,d=!0)}if(!d)return;if(s.attributesGroupName&&!s.preserveOrder){const t={};return t[s.attributesGroupName]=a,t}return a}}const Vt=function(t){t=t.replace(/\r\n?/g,"\n");const e=new P("!xml");let i=e,n="";this.matcher.reset(),this.entityDecoder.reset(),this.entityExpansionCount=0,this.currentExpandedLength=0,this.doctypefound=!1;const r=this.options,s=new q(r.processEntities),o=t.length;for(let a=0;a<o;a++)if("<"===t[a]){const l=t.charCodeAt(a+1);if(47===l){const e=Gt(t,">",a,"Closing Tag is not closed.");let s=t.substring(a+2,e).trim();if(r.removeNSPrefix){const t=s.indexOf(":");-1!==t&&(s=s.substr(t+1))}s=Ht(r.transformTagName,s,"",r).tagName,i&&(n=this.saveTextToParentTag(n,i,this.readonlyMatcher));const o=this.matcher.getCurrentTag();if(s&&r.unpairedTagsSet.has(s))throw new Error(`Unpaired tag can not be used as closing tag: </${s}>`);o&&r.unpairedTagsSet.has(o)&&(this.matcher.pop(),this.tagsNodeStack.pop()),this.matcher.pop(),this.isCurrentNodeStopNode=!1,i=this.tagsNodeStack.pop(),n="",a=e}else if(63===l){let e=Wt(t,a,!1,"?>");if(!e)throw new Error("Pi Tag is not closed.");n=this.saveTextToParentTag(n,i,this.readonlyMatcher);const o=this.buildAttributesMap(e.tagExp,this.matcher,e.tagName,!0);if(o){const t=o[this.options.attributeNamePrefix+"version"];this.entityDecoder.setXmlVersion(Number(t)||1),s.setXmlVersion(Number(t)||1)}if(r.ignoreDeclaration&&"?xml"===e.tagName||r.ignorePiTags);else{const t=new P(e.tagName);t.add(r.textNodeName,""),e.tagName!==e.tagExp&&e.attrExpPresent&&!0!==r.ignoreAttributes&&(t[":@"]=o),this.addChild(i,t,this.readonlyMatcher,a)}a=e.closeIndex+1}else if(33===l&&45===t.charCodeAt(a+2)&&45===t.charCodeAt(a+3)){const e=Gt(t,"--\x3e",a+4,"Comment is not closed.");if(r.commentPropName){const s=t.substring(a+4,e-2);n=this.saveTextToParentTag(n,i,this.readonlyMatcher),i.add(r.commentPropName,[{[r.textNodeName]:s}])}a=e}else if(33===l&&68===t.charCodeAt(a+2)){if(this.doctypefound)throw new Error("Multiple DOCTYPE declarations found.");this.doctypefound=!0;const e=s.readDocType(t,a);this.entityDecoder.addInputEntities(e.entities),a=e.i}else if(33===l&&91===t.charCodeAt(a+2)){const e=Gt(t,"]]>",a,"CDATA is not closed.")-2,s=t.substring(a+9,e);n=this.saveTextToParentTag(n,i,this.readonlyMatcher);let o=this.parseTextData(s,i.tagname,this.readonlyMatcher,!0,!1,!0,!0);null==o&&(o=""),r.cdataPropName?i.add(r.cdataPropName,[{[r.textNodeName]:s}]):i.add(r.textNodeName,o),a=e+2}else{let s=Wt(t,a,r.removeNSPrefix);if(!s){const e=t.substring(Math.max(0,a-50),Math.min(o,a+50));throw new Error(`readTagExp returned undefined at position ${a}. Context: "${e}"`)}let l=s.tagName;const p=s.rawTagName;let c=s.tagExp,h=s.attrExpPresent,d=s.closeIndex;if(({tagName:l,tagExp:c}=Ht(r.transformTagName,l,c,r)),r.strictReservedNames&&(l===r.commentPropName||l===r.cdataPropName||l===r.textNodeName||l===r.attributesGroupName))throw new Error(`Invalid tag name: ${l}`);i&&n&&"!xml"!==i.tagname&&(n=this.saveTextToParentTag(n,i,this.readonlyMatcher,!1));const u=i;u&&r.unpairedTagsSet.has(u.tagname)&&(i=this.tagsNodeStack.pop(),this.matcher.pop());let f=!1;c.length>0&&c.lastIndexOf("/")===c.length-1&&(f=!0,"/"===l[l.length-1]?(l=l.substr(0,l.length-1),c=l):c=c.substr(0,c.length-1),h=l!==c);let g,m=null,x={};g=It(p),l!==e.tagname&&this.matcher.push(l,{},g),l!==c&&h&&(m=this.buildAttributesMap(c,this.matcher,l),m&&(x=jt(m,r))),l!==e.tagname&&(this.isCurrentNodeStopNode=this.isItStopNode());const b=a;if(this.isCurrentNodeStopNode){let e="";if(f)a=s.closeIndex;else if(r.unpairedTagsSet.has(l))a=s.closeIndex;else{const i=this.readStopNodeData(t,p,d+1);if(!i)throw new Error(`Unexpected end of ${p}`);a=i.i,e=i.tagContent}const n=new P(l);m&&(n[":@"]=m),n.add(r.textNodeName,e),this.matcher.pop(),this.isCurrentNodeStopNode=!1,this.addChild(i,n,this.readonlyMatcher,b)}else{if(f){({tagName:l,tagExp:c}=Ht(r.transformTagName,l,c,r));const t=new P(l);m&&(t[":@"]=m),this.addChild(i,t,this.readonlyMatcher,b),this.matcher.pop(),this.isCurrentNodeStopNode=!1}else{if(r.unpairedTagsSet.has(l)){const t=new P(l);m&&(t[":@"]=m),this.addChild(i,t,this.readonlyMatcher,b),this.matcher.pop(),this.isCurrentNodeStopNode=!1,a=s.closeIndex;continue}{const t=new P(l);if(this.tagsNodeStack.length>r.maxNestedTags)throw new Error("Maximum nested tags exceeded");this.tagsNodeStack.push(i),m&&(t[":@"]=m),this.addChild(i,t,this.readonlyMatcher,b),i=t}}n="",a=d}}}else n+=t[a];return e.child};function qt(t,e,i,n){this.options.captureMetaData||(n=void 0);const r=this.options.jPath?i.toString():i,s=this.options.updateTag(e.tagname,r,e[":@"]);!1===s||("string"==typeof s?(e.tagname=s,t.addChild(e,n)):t.addChild(e,n))}function Ft(t,e,i){const n=this.options.processEntities;if(!n||!n.enabled)return t;if(n.allowedTags){const r=this.options.jPath?i.toString():i;if(!(Array.isArray(n.allowedTags)?n.allowedTags.includes(e):n.allowedTags(e,r)))return t}if(n.tagFilter){const r=this.options.jPath?i.toString():i;if(!n.tagFilter(e,r))return t}return this.entityDecoder.decode(t)}function Ut(t,e,i,n){return t&&(void 0===n&&(n=0===e.child.length),void 0!==(t=this.parseTextData(t,e.tagname,i,!1,!!e[":@"]&&0!==Object.keys(e[":@"]).length,n))&&""!==t&&e.add(this.options.textNodeName,t),t=""),t}function Bt(){return 0!==this.stopNodeExpressionsSet.size&&this.matcher.matchesAny(this.stopNodeExpressionsSet)}function Gt(t,e,i,n){const r=t.indexOf(e,i);if(-1===r)throw new Error(n);return r+e.length-1}function Xt(t,e,i,n){const r=t.indexOf(e,i);if(-1===r)throw new Error(n);return r}function Wt(t,e,i,n=">"){const r=function(t,e,i=">"){let n=0;const r=t.length,s=i.charCodeAt(0),o=i.length>1?i.charCodeAt(1):-1;let a="",l=e;for(let i=e;i<r;i++){const e=t.charCodeAt(i);if(n)e===n&&(n=0);else if(34===e||39===e)n=e;else if(e===s){if(-1===o)return a+=t.substring(l,i),{data:a,index:i};if(t.charCodeAt(i+1)===o)return a+=t.substring(l,i),{data:a,index:i}}else 9!==e||n||(a+=t.substring(l,i)+" ",l=i+1)}}(t,e+1,n);if(!r)return;let s=r.data;const o=r.index,a=s.search(/\s/);let l=s,p=!0;-1!==a&&(l=s.substring(0,a),s=s.substring(a+1).trimStart());const c=l;if(i){const t=l.indexOf(":");-1!==t&&(l=l.substr(t+1),p=l!==r.data.substr(t+1))}return{tagName:l,tagExp:s,closeIndex:o,attrExpPresent:p,rawTagName:c}}function zt(t,e,i){const n=i;let r=1;const s=t.length;for(;i<s;i++)if("<"===t[i]){const s=t.charCodeAt(i+1);if(47===s){const s=Xt(t,">",i,`${e} is not closed`);if(t.substring(i+2,s).trim()===e&&(r--,0===r))return{tagContent:t.substring(n,i),i:s};i=s}else if(63===s)i=Gt(t,"?>",i+1,"StopNode is not closed.");else if(33===s&&45===t.charCodeAt(i+2)&&45===t.charCodeAt(i+3))i=Gt(t,"--\x3e",i+3,"StopNode is not closed.");else if(33===s&&91===t.charCodeAt(i+2))i=Gt(t,"]]>",i,"StopNode is not closed.")-2;else{const n=Wt(t,i,!1);n&&((n&&n.tagName)===e&&"/"!==n.tagExp[n.tagExp.length-1]&&r++,i=n.closeIndex)}}}function Yt(t,e,i){if(e&&"string"==typeof t){const e=t.trim();return"true"===e||"false"!==e&&tt(t,i)}return void 0!==t?t:""}function Ht(t,e,i,n){if(t){const n=t(e);i===e&&(i=n),e=n}return{tagName:e=Qt(e,n),tagExp:i}}function Qt(t,e){if(a.includes(t))throw new Error(`[SECURITY] Invalid name: "${t}" is a reserved JavaScript keyword that could cause prototype pollution`);return o.includes(t)?e.onDangerousProperty(t):t}const Jt=P.getMetaDataSymbol();function Zt(t,e){if(!t||"object"!=typeof t)return{};if(!e)return t;const i={};for(const n in t)n.startsWith(e)?i[n.substring(e.length)]=t[n]:i[n]=t[n];return i}function Kt(t,e,i,n){return te(t,e,i,n)}function te(t,e,i,n){let r;const s={};for(let o=0;o<t.length;o++){const a=t[o],l=ee(a);if(void 0!==l&&l!==e.textNodeName){const t=Zt(a[":@"]||{},e.attributeNamePrefix);i.push(l,t)}if(l===e.textNodeName)void 0===r?r=a[l]:r+=""+a[l];else{if(void 0===l)continue;if(a[l]){let t=te(a[l],e,i,n);const r=ne(t,e);if(0===Object.keys(t).length&&e.alwaysCreateTextNode&&(t[e.textNodeName]=""),a[":@"]?ie(t,a[":@"],n,e):1!==Object.keys(t).length||void 0===t[e.textNodeName]||e.alwaysCreateTextNode?0===Object.keys(t).length&&(e.alwaysCreateTextNode?t[e.textNodeName]="":t=""):t=t[e.textNodeName],void 0!==a[Jt]&&"object"==typeof t&&null!==t&&(t[Jt]=a[Jt]),void 0!==s[l]&&Object.prototype.hasOwnProperty.call(s,l))Array.isArray(s[l])||(s[l]=[s[l]]),s[l].push(t);else{const i=e.jPath?n.toString():n;e.isArray(l,i,r)?s[l]=[t]:s[l]=t}void 0!==l&&l!==e.textNodeName&&i.pop()}}}return"string"==typeof r?r.length>0&&(s[e.textNodeName]=r):void 0!==r&&(s[e.textNodeName]=r),s}function ee(t){const e=Object.keys(t);for(let t=0;t<e.length;t++){const i=e[t];if(":@"!==i)return i}}function ie(t,e,i,n){if(e){const r=Object.keys(e),s=r.length;for(let o=0;o<s;o++){const s=r[o],a=s.startsWith(n.attributeNamePrefix)?s.substring(n.attributeNamePrefix.length):s,l=n.jPath?i.toString()+"."+a:i;n.isArray(s,l,!0,!0)?t[s]=[e[s]]:t[s]=e[s]}}}function ne(t,e){const{textNodeName:i}=e,n=Object.keys(t).length;return 0===n||!(1!==n||!t[i]&&"boolean"!=typeof t[i]&&0!==t[i])}class re{constructor(t){this.externalEntities={},this.options=C(t)}parse(t,e){if("string"!=typeof t&&t.toString)t=t.toString();else if("string"!=typeof t)throw new Error("XML data is accepted in String or Bytes[] form.");if(e){!0===e&&(e={});const i=p(t,e);if(!0!==i)throw Error(`${i.err.msg}:${i.err.line}:${i.err.col}`)}const i=new kt(this.options,this.externalEntities),n=i.parseXml(t);return this.options.preserveOrder||void 0===n?n:Kt(n,this.options,i.matcher,i.readonlyMatcher)}addEntity(t,e){if(-1!==e.indexOf("&"))throw new Error("Entity value can't have '&'");if(-1!==t.indexOf("&")||-1!==t.indexOf(";"))throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '
'");if("&"===e)throw new Error("An entity with value '&' is not permitted");this.externalEntities[t]=e}static getMetaDataSymbol(){return P.getMetaDataSymbol()}}function se(t){return String(t).replace(/--/g,"- -").replace(/--/g,"- -").replace(/-$/,"- ")}function oe(t){return String(t).replace(/\]\]>/g,"]]]]><![CDATA[>")}function ae(t){return String(t).replace(/"/g,""").replace(/'/g,"'")}const le=":A-Za-z_À-ÖØ-öø-˿Ͱ-ͽͿ-҆҈--⁰-Ⰰ-、-豈-﷏ﷰ-�",pe=":A-Za-z_À-˿Ͱ-ͽͿ-҆҈--⁰-Ⰰ-、-豈-﷏ﷰ-�𐀀-",ce=pe+"\\-\\.\\d·̀-ͯ҇‿-⁀",he=(t,e,i="")=>{const n=`[${t.replace(":","")}][${e.replace(":","")}]*`;return{name:new RegExp(`^[${t}][${e}]*$`,i),ncName:new RegExp(`^${n}$`,i),qName:new RegExp(`^${n}(?::${n})?$`,i),nmToken:new RegExp(`^[${e}]+$`,i),nmTokens:new RegExp(`^[${e}]+(?:\\s+[${e}]+)*$`,i)}},de=he(le,le+"\\-\\.\\d·̀-ͯ‿-⁀"),ue=he(pe,ce,"u"),fe=(t,{xmlVersion:e="1.0"}={})=>((t="1.0")=>"1.1"===t?ue:de)(e).qName.test(t);function ge(t,e,i,n,r){return i.sanitizeName?fe(t,{xmlVersion:r})?t:i.sanitizeName(t,{isAttribute:e,matcher:n.readOnly()}):t}function me(t,e){let i="";e.format&&(i="\n");const n=[];if(e.stopNodes&&Array.isArray(e.stopNodes))for(let t=0;t<e.stopNodes.length;t++){const i=e.stopNodes[t];"string"==typeof i?n.push(new st(i)):i instanceof st&&n.push(i)}const r=function(t,e){if(!Array.isArray(t)||0===t.length)return"1.0";const i=t[0];if("?xml"===Ee(i)){const t=i[":@"];if(t){const i=e.attributeNamePrefix+"version";if(t[i])return t[i]}}return"1.0"}(t,e);return xe(t,e,i,new rt,n,r)}function xe(t,e,i,n,r,s){let o="",a=!1;if(e.maxNestedTags&&n.getDepth()>e.maxNestedTags)throw new Error("Maximum nested tags exceeded");if(!Array.isArray(t)){if(null!=t){let i=t.toString();return i=Se(i,e),i}return""}for(let l=0;l<t.length;l++){const p=t[l],c=Ee(p);if(void 0===c)continue;const h=c===e.textNodeName||c===e.cdataPropName||c===e.commentPropName||"?"===c[0]?c:ge(c,!1,e,n,s),d=be(p[":@"],e);n.push(h,d);const u=ve(n,r);if(h===e.textNodeName){let t=p[c];u||(t=e.tagValueProcessor(h,t),t=Se(t,e)),a&&(o+=i),o+=t,a=!1,n.pop();continue}if(h===e.cdataPropName){a&&(o+=i),o+=`<![CDATA[${oe(p[c][0][e.textNodeName])}]]>`,a=!1,n.pop();continue}if(h===e.commentPropName){o+=i+`\x3c!--${se(p[c][0][e.textNodeName])}--\x3e`,a=!0,n.pop();continue}if("?"===h[0]){o+=("?xml"===h?"":i)+`<${h}${we(p[":@"],e,u,n,s)}?>`,a=!0,n.pop();continue}let f=i;""!==f&&(f+=e.indentBy);const g=i+`<${h}${we(p[":@"],e,u,n,s)}`;let m;m=u?ye(p[c],e):xe(p[c],e,f,n,r,s),-1!==e.unpairedTags.indexOf(h)?e.suppressUnpairedNode?o+=g+">":o+=g+"/>":m&&0!==m.length||!e.suppressEmptyNode?m&&m.endsWith(">")?o+=g+`>${m}${i}</${h}>`:(o+=g+">",m&&""!==i&&(m.includes("/>")||m.includes("</"))?o+=i+e.indentBy+m+i:o+=m,o+=`</${h}>`):o+=g+"/>",a=!0,n.pop()}return o}function be(t,e){if(!t||e.ignoreAttributes)return null;const i={};let n=!1;for(let r in t)Object.prototype.hasOwnProperty.call(t,r)&&(i[r.startsWith(e.attributeNamePrefix)?r.substr(e.attributeNamePrefix.length):r]=ae(t[r]),n=!0);return n?i:null}function ye(t,e){if(!Array.isArray(t))return null!=t?t.toString():"";let i="";for(let n=0;n<t.length;n++){const r=t[n],s=Ee(r);if(s===e.textNodeName)i+=r[s];else if(s===e.cdataPropName)i+=r[s][0][e.textNodeName];else if(s===e.commentPropName)i+=r[s][0][e.textNodeName];else{if(s&&"?"===s[0])continue;if(s){const t=Ne(r[":@"],e),n=ye(r[s],e);n&&0!==n.length?i+=`<${s}${t}>${n}</${s}>`:i+=`<${s}${t}/>`}}}return i}function Ne(t,e){let i="";if(t&&!e.ignoreAttributes)for(let n in t){if(!Object.prototype.hasOwnProperty.call(t,n))continue;let r=t[n];!0===r&&e.suppressBooleanAttributes?i+=` ${n.substr(e.attributeNamePrefix.length)}`:i+=` ${n.substr(e.attributeNamePrefix.length)}="${ae(r)}"`}return i}function Ee(t){const e=Object.keys(t);for(let i=0;i<e.length;i++){const n=e[i];if(Object.prototype.hasOwnProperty.call(t,n)&&":@"!==n)return n}}function we(t,e,i,n,r){let s="";if(t&&!e.ignoreAttributes)for(let o in t){if(!Object.prototype.hasOwnProperty.call(t,o))continue;const a=o.substr(e.attributeNamePrefix.length),l=i?a:ge(a,!0,e,n,r);let p;i?p=t[o]:(p=e.attributeValueProcessor(o,t[o]),p=Se(p,e)),!0===p&&e.suppressBooleanAttributes?s+=` ${l}`:s+=` ${l}="${ae(p)}"`}return s}function ve(t,e){if(!e||0===e.length)return!1;for(let i=0;i<e.length;i++)if(t.matches(e[i]))return!0;return!1}function Se(t,e){if(t&&t.length>0&&e.processEntities)for(let i=0;i<e.entities.length;i++){const n=e.entities[i];t=t.replace(n.regex,n.val)}return t}const Ae={attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,cdataPropName:!1,format:!1,indentBy:" ",suppressEmptyNode:!1,suppressUnpairedNode:!0,suppressBooleanAttributes:!0,tagValueProcessor:function(t,e){return e},attributeValueProcessor:function(t,e){return e},preserveOrder:!1,commentPropName:!1,unpairedTags:[],entities:[{regex:new RegExp("&","g"),val:"&"},{regex:new RegExp(">","g"),val:">"},{regex:new RegExp("<","g"),val:"<"},{regex:new RegExp("'","g"),val:"'"},{regex:new RegExp('"',"g"),val:"""}],processEntities:!0,stopNodes:[],oneListGroup:!1,maxNestedTags:100,jPath:!0,sanitizeName:!1};function Te(t){if(this.options=Object.assign({},Ae,t),this.options.stopNodes&&Array.isArray(this.options.stopNodes)&&(this.options.stopNodes=this.options.stopNodes.map(t=>"string"==typeof t&&t.startsWith("*.")?".."+t.substring(2):t)),this.stopNodeExpressions=[],this.options.stopNodes&&Array.isArray(this.options.stopNodes))for(let t=0;t<this.options.stopNodes.length;t++){const e=this.options.stopNodes[t];"string"==typeof e?this.stopNodeExpressions.push(new st(e)):e instanceof st&&this.stopNodeExpressions.push(e)}var e;!0===this.options.ignoreAttributes||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.ignoreAttributesFn="function"==typeof(e=this.options.ignoreAttributes)?e:Array.isArray(e)?t=>{for(const i of e){if("string"==typeof i&&t===i)return!0;if(i instanceof RegExp&&i.test(t))return!0}}:()=>!1,this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=Pe),this.processTextOrObjNode=Ce,this.options.format?(this.indentate=$e,this.tagEndChar=">\n",this.newLine="\n"):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}function _e(t,e,i,n,r){return i.sanitizeName?fe(t,{xmlVersion:r})?t:i.sanitizeName(t,{isAttribute:e,matcher:n.readOnly()}):t}function Ce(t,e,i,n,r){const s=this.extractAttributes(t);if(n.push(e,s),this.checkStopNode(n)){const r=this.buildRawContent(t),s=this.buildAttributesForStopNode(t);return n.pop(),this.buildObjectNode(r,e,s,i)}const o=this.j2x(t,i+1,n,r);return n.pop(),"?"===e[0]?this.buildTextValNode("",e,o.attrStr,i,n):void 0!==t[this.options.textNodeName]&&1===Object.keys(t).length?this.buildTextValNode(t[this.options.textNodeName],e,o.attrStr,i,n):this.buildObjectNode(o.val,e,o.attrStr,i)}function $e(t){return this.options.indentBy.repeat(t)}function Pe(t){return!(!t.startsWith(this.options.attributeNamePrefix)||t===this.options.textNodeName)&&t.substr(this.attrPrefixLen)}Te.prototype.build=function(t){if(this.options.preserveOrder)return me(t,this.options);{Array.isArray(t)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(t={[this.options.arrayNodeName]:t});const e=new rt,i=function(t,e){const i=t["?xml"];if(i&&"object"==typeof i){if(e.attributesGroupName&&i[e.attributesGroupName]){const t=i[e.attributesGroupName][e.attributeNamePrefix+"version"];if(t)return t}const t=i[e.attributeNamePrefix+"version"];if(t)return t}return"1.0"}(t,this.options);return this.j2x(t,0,e,i).val}},Te.prototype.j2x=function(t,e,i,n){let r="",s="";if(this.options.maxNestedTags&&i.getDepth()>=this.options.maxNestedTags)throw new Error("Maximum nested tags exceeded");const o=this.options.jPath?i.toString():i,a=this.checkStopNode(i);for(let l in t){if(!Object.prototype.hasOwnProperty.call(t,l))continue;const p=l===this.options.textNodeName||l===this.options.cdataPropName||l===this.options.commentPropName||this.options.attributesGroupName&&l===this.options.attributesGroupName||this.isAttribute(l)||"?"===l[0]?l:_e(l,!1,this.options,i,n);if(void 0===t[l])this.isAttribute(l)&&(s+="");else if(null===t[l])this.isAttribute(l)||p===this.options.cdataPropName||p===this.options.commentPropName?s+="":"?"===p[0]?s+=this.indentate(e)+"<"+p+"?"+this.tagEndChar:s+=this.indentate(e)+"<"+p+"/"+this.tagEndChar;else if(t[l]instanceof Date)s+=this.buildTextValNode(t[l],p,"",e,i);else if("object"!=typeof t[l]){const c=this.isAttribute(l);if(c&&!this.ignoreAttributesFn(c,o)){const e=_e(c,!0,this.options,i,n);r+=this.buildAttrPairStr(e,""+t[l],a)}else if(!c)if(l===this.options.textNodeName){let e=this.options.tagValueProcessor(l,""+t[l]);s+=this.replaceEntitiesValue(e)}else{i.push(p);const n=this.checkStopNode(i);if(i.pop(),n){const i=""+t[l];s+=""===i?this.indentate(e)+"<"+p+this.closeTag(p)+this.tagEndChar:this.indentate(e)+"<"+p+">"+i+"</"+p+this.tagEndChar}else s+=this.buildTextValNode(t[l],p,"",e,i)}}else if(Array.isArray(t[l])){const r=t[l].length;let o="",a="";for(let c=0;c<r;c++){const r=t[l][c];if(void 0===r);else if(null===r)"?"===p[0]?s+=this.indentate(e)+"<"+p+"?"+this.tagEndChar:s+=this.indentate(e)+"<"+p+"/"+this.tagEndChar;else if("object"==typeof r)if(this.options.oneListGroup){i.push(p);const t=this.j2x(r,e+1,i,n);i.pop(),o+=t.val,this.options.attributesGroupName&&r.hasOwnProperty(this.options.attributesGroupName)&&(a+=t.attrStr)}else o+=this.processTextOrObjNode(r,p,e,i,n);else if(this.options.oneListGroup){let t=this.options.tagValueProcessor(p,r);t=this.replaceEntitiesValue(t),o+=t}else{i.push(p);const t=this.checkStopNode(i);if(i.pop(),t){const t=""+r;o+=""===t?this.indentate(e)+"<"+p+this.closeTag(p)+this.tagEndChar:this.indentate(e)+"<"+p+">"+t+"</"+p+this.tagEndChar}else o+=this.buildTextValNode(r,p,"",e,i)}}this.options.oneListGroup&&(o=this.buildObjectNode(o,p,a,e)),s+=o}else if(this.options.attributesGroupName&&l===this.options.attributesGroupName){const e=Object.keys(t[l]),s=e.length;for(let o=0;o<s;o++){const s=_e(e[o],!0,this.options,i,n);r+=this.buildAttrPairStr(s,""+t[l][e[o]],a)}}else s+=this.processTextOrObjNode(t[l],p,e,i,n)}return{attrStr:r,val:s}},Te.prototype.buildAttrPairStr=function(t,e,i){return i||(e=this.options.attributeValueProcessor(t,""+e),e=this.replaceEntitiesValue(e)),this.options.suppressBooleanAttributes&&"true"===e?" "+t:" "+t+'="'+ae(e)+'"'},Te.prototype.extractAttributes=function(t){if(!t||"object"!=typeof t)return null;const e={};let i=!1;if(this.options.attributesGroupName&&t[this.options.attributesGroupName]){const n=t[this.options.attributesGroupName];for(let t in n)Object.prototype.hasOwnProperty.call(n,t)&&(e[t.startsWith(this.options.attributeNamePrefix)?t.substring(this.options.attributeNamePrefix.length):t]=ae(n[t]),i=!0)}else for(let n in t){if(!Object.prototype.hasOwnProperty.call(t,n))continue;const r=this.isAttribute(n);r&&(e[r]=ae(t[n]),i=!0)}return i?e:null},Te.prototype.buildRawContent=function(t){if("string"==typeof t)return t;if("object"!=typeof t||null===t)return String(t);if(void 0!==t[this.options.textNodeName])return t[this.options.textNodeName];let e="";for(let i in t){if(!Object.prototype.hasOwnProperty.call(t,i))continue;if(this.isAttribute(i))continue;if(this.options.attributesGroupName&&i===this.options.attributesGroupName)continue;const n=t[i];if(i===this.options.textNodeName)e+=n;else if(Array.isArray(n)){for(let t of n)if("string"==typeof t||"number"==typeof t)e+=`<${i}>${t}</${i}>`;else if("object"==typeof t&&null!==t){const n=this.buildRawContent(t),r=this.buildAttributesForStopNode(t);e+=""===n?`<${i}${r}/>`:`<${i}${r}>${n}</${i}>`}}else if("object"==typeof n&&null!==n){const t=this.buildRawContent(n),r=this.buildAttributesForStopNode(n);e+=""===t?`<${i}${r}/>`:`<${i}${r}>${t}</${i}>`}else e+=`<${i}>${n}</${i}>`}return e},Te.prototype.buildAttributesForStopNode=function(t){if(!t||"object"!=typeof t)return"";let e="";if(this.options.attributesGroupName&&t[this.options.attributesGroupName]){const i=t[this.options.attributesGroupName];for(let t in i){if(!Object.prototype.hasOwnProperty.call(i,t))continue;const n=t.startsWith(this.options.attributeNamePrefix)?t.substring(this.options.attributeNamePrefix.length):t,r=i[t];!0===r&&this.options.suppressBooleanAttributes?e+=" "+n:e+=" "+n+'="'+r+'"'}}else for(let i in t){if(!Object.prototype.hasOwnProperty.call(t,i))continue;const n=this.isAttribute(i);if(n){const r=t[i];!0===r&&this.options.suppressBooleanAttributes?e+=" "+n:e+=" "+n+'="'+r+'"'}}return e},Te.prototype.buildObjectNode=function(t,e,i,n){if(""===t)return"?"===e[0]?this.indentate(n)+"<"+e+i+"?"+this.tagEndChar:this.indentate(n)+"<"+e+i+this.closeTag(e)+this.tagEndChar;if("?"===e[0])return this.indentate(n)+"<"+e+i+"?"+this.tagEndChar;{let r="</"+e+this.tagEndChar,s="";return"?"===e[0]&&(s="?",r=""),!i&&""!==i||-1!==t.indexOf("<")?!1!==this.options.commentPropName&&e===this.options.commentPropName&&0===s.length?this.indentate(n)+`\x3c!--${t}--\x3e`+this.newLine:this.indentate(n)+"<"+e+i+s+this.tagEndChar+t+this.indentate(n)+r:this.indentate(n)+"<"+e+i+s+">"+t+r}},Te.prototype.closeTag=function(t){let e="";return-1!==this.options.unpairedTags.indexOf(t)?this.options.suppressUnpairedNode||(e="/"):e=this.options.suppressEmptyNode?"/":`></${t}`,e},Te.prototype.checkStopNode=function(t){if(!this.stopNodeExpressions||0===this.stopNodeExpressions.length)return!1;for(let e=0;e<this.stopNodeExpressions.length;e++)if(t.matches(this.stopNodeExpressions[e]))return!0;return!1},Te.prototype.buildTextValNode=function(t,e,i,n,r){if(!1!==this.options.cdataPropName&&e===this.options.cdataPropName){const e=oe(t);return this.indentate(n)+`<![CDATA[${e}]]>`+this.newLine}if(!1!==this.options.commentPropName&&e===this.options.commentPropName){const e=se(t);return this.indentate(n)+`\x3c!--${e}--\x3e`+this.newLine}if("?"===e[0])return this.indentate(n)+"<"+e+i+"?"+this.tagEndChar;{let r=this.options.tagValueProcessor(e,t);return r=this.replaceEntitiesValue(r),""===r?this.indentate(n)+"<"+e+i+this.closeTag(e)+this.tagEndChar:this.indentate(n)+"<"+e+i+">"+r+"</"+e+this.tagEndChar}},Te.prototype.replaceEntitiesValue=function(t){if(t&&t.length>0&&this.options.processEntities)for(let e=0;e<this.options.entities.length;e++){const i=this.options.entities[e];t=t.replace(i.regex,i.val)}return t};const Oe=Te,je={validate:p};module.exports=e})();
|
|
144830
|
+
(()=>{"use strict";var t={d:(e,i)=>{for(var n in i)t.o(i,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:i[n]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{XMLBuilder:()=>Oe,XMLParser:()=>le,XMLValidator:()=>$e});const i=":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",n=new RegExp("^["+i+"]["+i+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),r=function(t){return!(null==n.exec(t))},s=["hasOwnProperty","toString","valueOf","__defineGetter__","__defineSetter__","__lookupGetter__","__lookupSetter__"],o=["__proto__","constructor","prototype"],a={allowBooleanAttributes:!1,unpairedTags:[]};function l(t,e){e=Object.assign({},a,e);const i=[];let n=!1,r=!1;"\ufeff"===t[0]&&(t=t.substr(1));for(let s=0;s<t.length;s++)if("<"===t[s]&&"?"===t[s+1]){if(s+=2,s=p(t,s),s.err)return s}else{if("<"!==t[s]){if(c(t[s]))continue;return x("InvalidChar","char '"+t[s]+"' is not expected.",N(t,s))}{let o=s;if(s++,"!"===t[s]){s=h(t,s);continue}{let a=!1;"/"===t[s]&&(a=!0,s++);let l="";for(;s<t.length&&">"!==t[s]&&" "!==t[s]&&"\t"!==t[s]&&"\n"!==t[s]&&"\r"!==t[s];s++)l+=t[s];if(l=l.trim(),"/"===l[l.length-1]&&(l=l.substring(0,l.length-1),s--),!y(l)){let e;return e=0===l.trim().length?"Invalid space after '<'.":"Tag '"+l+"' is an invalid name.",x("InvalidTag",e,N(t,s))}const d=f(t,s);if(!1===d)return x("InvalidAttr","Attributes for '"+l+"' have open quote.",N(t,s));let u=d.value;if(s=d.index,"/"===u[u.length-1]){const i=s-u.length;u=u.substring(0,u.length-1);const r=g(u,e);if(!0!==r)return x(r.err.code,r.err.msg,N(t,i+r.err.line));n=!0}else if(a){if(!d.tagClosed)return x("InvalidTag","Closing tag '"+l+"' doesn't have proper closing.",N(t,s));if(u.trim().length>0)return x("InvalidTag","Closing tag '"+l+"' can't have attributes or invalid starting.",N(t,o));if(0===i.length)return x("InvalidTag","Closing tag '"+l+"' has not been opened.",N(t,o));{const e=i.pop();if(l!==e.tagName){let i=N(t,e.tagStartPos);return x("InvalidTag","Expected closing tag '"+e.tagName+"' (opened in line "+i.line+", col "+i.col+") instead of closing tag '"+l+"'.",N(t,o))}0==i.length&&(r=!0)}}else{const a=g(u,e);if(!0!==a)return x(a.err.code,a.err.msg,N(t,s-u.length+a.err.line));if(!0===r)return x("InvalidXml","Multiple possible root nodes found.",N(t,s));-1!==e.unpairedTags.indexOf(l)||i.push({tagName:l,tagStartPos:o}),n=!0}for(s++;s<t.length;s++)if("<"===t[s]){if("!"===t[s+1]){s++,s=h(t,s);continue}if("?"!==t[s+1])break;if(s=p(t,++s),s.err)return s}else if("&"===t[s]){const e=m(t,s);if(-1==e)return x("InvalidChar","char '&' is not expected.",N(t,s));s=e}else if(!0===r&&!c(t[s]))return x("InvalidXml","Extra text at the end",N(t,s));"<"===t[s]&&s--}}}return n?1==i.length?x("InvalidTag","Unclosed tag '"+i[0].tagName+"'.",N(t,i[0].tagStartPos)):!(i.length>0)||x("InvalidXml","Invalid '"+JSON.stringify(i.map(t=>t.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1}):x("InvalidXml","Start tag expected.",1)}function c(t){return" "===t||"\t"===t||"\n"===t||"\r"===t}function p(t,e){const i=e;for(;e<t.length;e++)if("?"==t[e]||" "==t[e]){const n=t.substr(i,e-i);if(e>5&&"xml"===n)return x("InvalidXml","XML declaration allowed only at the start of the document.",N(t,e));if("?"==t[e]&&">"==t[e+1]){e++;break}continue}return e}function h(t,e){if(t.length>e+5&&"-"===t[e+1]&&"-"===t[e+2]){for(e+=3;e<t.length;e++)if("-"===t[e]&&"-"===t[e+1]&&">"===t[e+2]){e+=2;break}}else if(t.length>e+8&&"D"===t[e+1]&&"O"===t[e+2]&&"C"===t[e+3]&&"T"===t[e+4]&&"Y"===t[e+5]&&"P"===t[e+6]&&"E"===t[e+7]){let i=1;for(e+=8;e<t.length;e++)if("<"===t[e])i++;else if(">"===t[e]&&(i--,0===i))break}else if(t.length>e+9&&"["===t[e+1]&&"C"===t[e+2]&&"D"===t[e+3]&&"A"===t[e+4]&&"T"===t[e+5]&&"A"===t[e+6]&&"["===t[e+7])for(e+=8;e<t.length;e++)if("]"===t[e]&&"]"===t[e+1]&&">"===t[e+2]){e+=2;break}return e}const d='"',u="'";function f(t,e){let i="",n="",r=!1;for(;e<t.length;e++){if(t[e]===d||t[e]===u)""===n?n=t[e]:n!==t[e]||(n="");else if(">"===t[e]&&""===n){r=!0;break}i+=t[e]}return""===n&&{value:i,index:e,tagClosed:r}}function g(t,e){const i=function(t){const e=[],i=t.length;let n=0;for(;n<i;){const r=n;for(;n<i&&c(t[n]);)n++;if(n>=i)break;if("="===t[n]){n=r+1;continue}const s=t.slice(r,n),o=n;for(;n<i&&!c(t[n])&&"="!==t[n];)n++;const a=t.slice(o,n);let l,p,h,d=n;for(;d<i&&c(t[d]);)d++;d<i&&"="===t[d]&&(l=t.slice(n,d+1),n=d+1);let u=n;for(;u<i&&c(t[u]);)u++;if(u<i&&('"'===t[u]||"'"===t[u])){const e=u+1,i=t.indexOf(t[u],e);-1!==i&&(p=t[u],h=t.slice(e,i),n=i+1)}const f={startIndex:r};f[1]=s,f[2]=a,f[3]=l,f[4]=void 0!==p||void 0,f[5]=p,f[6]=h,e.push(f)}return e}(t),n={};for(let t=0;t<i.length;t++){if(0===i[t][1].length)return x("InvalidAttr","Attribute '"+i[t][2]+"' has no space in starting.",E(i[t]));if(void 0!==i[t][3]&&void 0===i[t][4])return x("InvalidAttr","Attribute '"+i[t][2]+"' is without value.",E(i[t]));if(void 0===i[t][3]&&!e.allowBooleanAttributes)return x("InvalidAttr","boolean attribute '"+i[t][2]+"' is not allowed.",E(i[t]));const r=i[t][2];if(!b(r))return x("InvalidAttr","Attribute '"+r+"' is an invalid name.",E(i[t]));if(Object.prototype.hasOwnProperty.call(n,r))return x("InvalidAttr","Attribute '"+r+"' is repeated.",E(i[t]));n[r]=1}return!0}function m(t,e){if(";"===t[++e])return-1;if("#"===t[e])return function(t,e){let i=/\d/;for("x"===t[e]&&(e++,i=/[\da-fA-F]/);e<t.length;e++){if(";"===t[e])return e;if(!t[e].match(i))break}return-1}(t,++e);let i=0;for(;e<t.length;e++,i++)if(!(t[e].match(/\w/)&&i<20)){if(";"===t[e])break;return-1}return e}function x(t,e,i){return{err:{code:t,msg:e,line:i.line||i,col:i.col}}}function b(t){return r(t)}function y(t){return r(t)}function N(t,e){const i=t.substring(0,e).split(/\r?\n/);return{line:i.length,col:i[i.length-1].length+1}}function E(t){return t.startIndex+t[1].length}const w=t=>s.includes(t)?"__"+t:t,v={preserveOrder:!1,attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,removeNSPrefix:!1,allowBooleanAttributes:!1,parseTagValue:!0,parseAttributeValue:!1,trimValues:!0,cdataPropName:!1,numberParseOptions:{hex:!0,leadingZeros:!0,eNotation:!0,unicode:!1},tagValueProcessor:function(t,e){return e},attributeValueProcessor:function(t,e){return e},stopNodes:[],alwaysCreateTextNode:!1,isArray:()=>!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,entityDecoder:null,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(t,e,i){return t},captureMetaData:!1,maxNestedTags:100,strictReservedNames:!0,jPath:!0,onDangerousProperty:w};function S(t,e){if("string"!=typeof t)return;const i=t.toLowerCase();if(s.some(t=>i===t.toLowerCase()))throw new Error(`[SECURITY] Invalid ${e}: "${t}" is a reserved JavaScript keyword that could cause prototype pollution`);if(o.some(t=>i===t.toLowerCase()))throw new Error(`[SECURITY] Invalid ${e}: "${t}" is a reserved JavaScript keyword that could cause prototype pollution`)}function A(t,e){return"boolean"==typeof t?{enabled:t,maxEntitySize:1e4,maxExpansionDepth:1e4,maxTotalExpansions:1/0,maxExpandedLength:1e5,maxEntityCount:1e3,allowedTags:null,tagFilter:null,appliesTo:"all"}:"object"==typeof t&&null!==t?{enabled:!1!==t.enabled,maxEntitySize:Math.max(1,t.maxEntitySize??1e4),maxExpansionDepth:Math.max(1,t.maxExpansionDepth??1e4),maxTotalExpansions:Math.max(1,t.maxTotalExpansions??1/0),maxExpandedLength:Math.max(1,t.maxExpandedLength??1e5),maxEntityCount:Math.max(1,t.maxEntityCount??1e3),allowedTags:t.allowedTags??null,tagFilter:t.tagFilter??null,appliesTo:t.appliesTo??"all"}:A(!0)}const T=function(t){const e=Object.assign({},v,t),i=[{value:e.attributeNamePrefix,name:"attributeNamePrefix"},{value:e.attributesGroupName,name:"attributesGroupName"},{value:e.textNodeName,name:"textNodeName"},{value:e.cdataPropName,name:"cdataPropName"},{value:e.commentPropName,name:"commentPropName"}];for(const{value:t,name:e}of i)t&&S(t,e);return null===e.onDangerousProperty&&(e.onDangerousProperty=w),e.processEntities=A(e.processEntities,e.htmlEntities),e.unpairedTagsSet=new Set(e.unpairedTags),e.stopNodes&&Array.isArray(e.stopNodes)&&(e.stopNodes=e.stopNodes.map(t=>"string"==typeof t&&t.startsWith("*.")?".."+t.substring(2):t)),e};let _;_="function"!=typeof Symbol?"@@xmlMetadata":Symbol("XML Node Metadata");class C{constructor(t){this.tagname=t,this.child=[],this[":@"]=Object.create(null)}add(t,e){"__proto__"===t&&(t="#__proto__"),this.child.push({[t]:e})}addChild(t,e){"__proto__"===t.tagname&&(t.tagname="#__proto__"),t[":@"]&&Object.keys(t[":@"]).length>0?this.child.push({[t.tagname]:t.child,":@":t[":@"]}):this.child.push({[t.tagname]:t.child}),this.addStartIndex(e)}addStartIndex(t){void 0!==t&&(this.child[this.child.length-1][_]={startIndex:t})}addEndIndex(t){const e=this.child[this.child.length-1];void 0!==e&&void 0!==e[_]&&void 0===e[_].endIndex&&(e[_].endIndex=t)}static getMetaDataSymbol(){return _}}const O=":A-Za-z_À-ÖØ-öø-˿Ͱ-ͽͿ-҆҈--⁰-Ⰰ-、-豈-﷏ﷰ-�",$=":A-Za-z_À-˿Ͱ-ͽͿ-҆҈--⁰-Ⰰ-、-豈-﷏ﷰ-�𐀀-",P=$+"\\-\\.\\d·̀-ͯ҇‿-⁀",j=(t,e,i="")=>{const n=`[${t.replace(":","")}][${e.replace(":","")}]*`;return{name:new RegExp(`^[${t}][${e}]*$`,i),ncName:new RegExp(`^${n}$`,i),qName:new RegExp(`^${n}(?::${n})?$`,i),nmToken:new RegExp(`^[${e}]+$`,i),nmTokens:new RegExp(`^[${e}]+(?:\\s+[${e}]+)*$`,i)}},I=j(O,O+"\\-\\.\\d·̀-ͯ‿-⁀"),k=j($,P,"u"),L=":A-Za-z_",D=j(L,L+"\\-\\.\\d"),M=(t="1.0",e=!1)=>e?D:"1.1"===t?k:I,R=(t,{xmlVersion:e="1.0",asciiOnly:i=!1}={})=>M(e,i).qName.test(t),V=["name","ncName","qName","nmToken","nmTokens"],q=(t,{xmlVersion:e="1.0",asciiOnly:i=!1,maxCacheSize:n=2048}={})=>{if(!V.includes(t))throw new TypeError(`Unknown production "${t}". Must be one of: ${V.join(", ")}`);const r=M(e,i)[t];let s=new Map;const o=t=>{const e=s.get(t);if(void 0!==e)return e;const i=r.test(t);return s.size<n&&s.set(t,i),i};return o.reset=()=>{s=new Map},o};class F{constructor(t,e){this.suppressValidationErr=!t,this.options=t,this.xmlVersion=e||1}setXmlVersion(t=1){this.xmlVersion=t}readDocType(t,e){const i=Object.create(null);let n=0;if("O"!==t[e+3]||"C"!==t[e+4]||"T"!==t[e+5]||"Y"!==t[e+6]||"P"!==t[e+7]||"E"!==t[e+8])throw new Error("Invalid Tag instead of DOCTYPE");{e+=9;let r=1,s=!1,o=!1,a=null,l="";for(;e<t.length;e++)if(null===a)if(s||o||'"'!==t[e]&&"'"!==t[e])if("<"!==t[e]||o)if(">"===t[e]){if(o?"-"===t[e-1]&&"-"===t[e-2]&&(o=!1,r--):r--,0===r)break}else"["===t[e]?s=!0:l+=t[e];else{if(s&&B(t,"!ENTITY",e)){let r,s;if(e+=7,[r,s,e]=this.readEntityExp(t,e+1,this.suppressValidationErr),-1===s.indexOf("&")){if(!1!==this.options.enabled&&null!=this.options.maxEntityCount&&n>=this.options.maxEntityCount)throw new Error(`Entity count (${n+1}) exceeds maximum allowed (${this.options.maxEntityCount})`);i[r]=s,n++}}else if(s&&B(t,"!ELEMENT",e)){e+=8;const{index:i}=this.readElementExp(t,e+1);e=i}else if(s&&B(t,"!ATTLIST",e))e+=8;else if(s&&B(t,"!NOTATION",e)){e+=9;const{index:i}=this.readNotationExp(t,e+1,this.suppressValidationErr);e=i}else{if(!B(t,"!--",e))throw new Error("Invalid DOCTYPE");o=!0}r++,l=""}else a=t[e],l+=t[e];else t[e]===a&&(a=null),l+=t[e];if(null!==a||0!==r)throw new Error("Unclosed DOCTYPE")}return{entities:i,i:e}}readEntityExp(t,e){const i=e=U(t,e);for(;e<t.length&&!/\s/.test(t[e])&&'"'!==t[e]&&"'"!==t[e];)e++;let n=t.substring(i,e);if(G(n,{xmlVersion:this.xmlVersion}),e=U(t,e),!this.suppressValidationErr){if("SYSTEM"===t.substring(e,e+6).toUpperCase())throw new Error("External entities are not supported");if("%"===t[e])throw new Error("Parameter entities are not supported")}let r="";if([e,r]=this.readIdentifierVal(t,e,"entity"),!1!==this.options.enabled&&null!=this.options.maxEntitySize&&r.length>this.options.maxEntitySize)throw new Error(`Entity "${n}" size (${r.length}) exceeds maximum allowed size (${this.options.maxEntitySize})`);return[n,r,--e]}readNotationExp(t,e){const i=e=U(t,e);for(;e<t.length&&!/\s/.test(t[e]);)e++;let n=t.substring(i,e);!this.suppressValidationErr&&G(n,{xmlVersion:this.xmlVersion}),e=U(t,e);const r=t.substring(e,e+6).toUpperCase();if(!this.suppressValidationErr&&"SYSTEM"!==r&&"PUBLIC"!==r)throw new Error(`Expected SYSTEM or PUBLIC, found "${r}"`);e+=r.length,e=U(t,e);let s=null,o=null;if("PUBLIC"===r)[e,s]=this.readIdentifierVal(t,e,"publicIdentifier"),'"'!==t[e=U(t,e)]&&"'"!==t[e]||([e,o]=this.readIdentifierVal(t,e,"systemIdentifier"));else if("SYSTEM"===r&&([e,o]=this.readIdentifierVal(t,e,"systemIdentifier"),!this.suppressValidationErr&&!o))throw new Error("Missing mandatory system identifier for SYSTEM notation");return{notationName:n,publicIdentifier:s,systemIdentifier:o,index:--e}}readIdentifierVal(t,e,i){let n="";const r=t[e];if('"'!==r&&"'"!==r)throw new Error(`Expected quoted string, found "${r}"`);const s=++e;for(;e<t.length&&t[e]!==r;)e++;if(n=t.substring(s,e),t[e]!==r)throw new Error(`Unterminated ${i} value`);return[++e,n]}readElementExp(t,e){const i=e=U(t,e);for(;e<t.length&&!/\s/.test(t[e]);)e++;let n=t.substring(i,e);if(!this.suppressValidationErr&&!R(n,{xmlVersion:this.xmlVersion}))throw new Error(`Invalid element name: "${n}"`);let r="";if("E"===t[e=U(t,e)]&&B(t,"MPTY",e))e+=4;else if("A"===t[e]&&B(t,"NY",e))e+=2;else if("("===t[e]){const i=++e;for(;e<t.length&&")"!==t[e];)e++;if(r=t.substring(i,e),")"!==t[e])throw new Error("Unterminated content model")}else if(!this.suppressValidationErr)throw new Error(`Invalid Element Expression, found "${t[e]}"`);return{elementName:n,contentModel:r.trim(),index:e}}readAttlistExp(t,e){let i=e=U(t,e);for(;e<t.length&&!/\s/.test(t[e]);)e++;let n=t.substring(i,e);for(G(n,{xmlVersion:this.xmlVersion}),i=e=U(t,e);e<t.length&&!/\s/.test(t[e]);)e++;let r=t.substring(i,e);if(!G(r,{xmlVersion:this.xmlVersion}))throw new Error(`Invalid attribute name: "${r}"`);e=U(t,e);let s="";if("NOTATION"===t.substring(e,e+8).toUpperCase()){if(s="NOTATION","("!==t[e=U(t,e+=8)])throw new Error(`Expected '(', found "${t[e]}"`);e++;let i=[];for(;e<t.length&&")"!==t[e];){const n=e;for(;e<t.length&&"|"!==t[e]&&")"!==t[e];)e++;let r=t.substring(n,e);if(r=r.trim(),!G(r,{xmlVersion:this.xmlVersion}))throw new Error(`Invalid notation name: "${r}"`);i.push(r),"|"===t[e]&&(e++,e=U(t,e))}if(")"!==t[e])throw new Error("Unterminated list of notations");e++,s+=" ("+i.join("|")+")"}else{const i=e;for(;e<t.length&&!/\s/.test(t[e]);)e++;s+=t.substring(i,e);const n=["CDATA","ID","IDREF","IDREFS","ENTITY","ENTITIES","NMTOKEN","NMTOKENS"];if(!this.suppressValidationErr&&!n.includes(s.toUpperCase()))throw new Error(`Invalid attribute type: "${s}"`)}e=U(t,e);let o="";return"#REQUIRED"===t.substring(e,e+8).toUpperCase()?(o="#REQUIRED",e+=8):"#IMPLIED"===t.substring(e,e+7).toUpperCase()?(o="#IMPLIED",e+=7):[e,o]=this.readIdentifierVal(t,e,"ATTLIST"),{elementName:n,attributeName:r,attributeType:s,defaultValue:o,index:e}}}const U=(t,e)=>{for(;e<t.length&&/\s/.test(t[e]);)e++;return e};function B(t,e,i){for(let n=0;n<e.length;n++)if(e[n]!==t[i+n+1])return!1;return!0}function G(t,e){if(R(t,{xmlVersion:e}))return t;throw new Error(`Invalid entity name ${t}`)}const X=[48,1632,1776,2406,2534,2662,2790,2918,3046,3174,3302,3430,3558,3664,3792,3872,4160,4240,6112,6160,6470,6608,6784,6800,6992,7088,7232,7248,65296,120782,120792,120802,120812,120822,66720,68912,69734,69872,69942,70096,70384,70736,70864,71248,71360,71472,71904,72016,72688,72784,73040,73120,73552,92768,92864,93008,123200,123632,124144,125264,130032],W=new Map,z=1632,Y=new Uint8Array(63904).fill(255);for(const t of X)for(let e=0;e<10;e++){const i=t+e;i<=65535?Y[i-z]=e:W.set(i,e)}const H=new Set([8722,65293,65123]),Q=/^[-+]?0x[a-fA-F0-9]+$/,J=/^0b[01]+$/,Z=/^0o[0-7]+$/,K=/^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/,tt={hex:!0,binary:!1,octal:!1,leadingZeros:!0,decimalPoint:".",eNotation:!0,infinity:"original",unicode:!1};function et(t,e={}){if(e=Object.assign({},tt,e),!t||"string"!=typeof t)return t;let i=t.trim();if(0===i.length)return t;if(void 0!==e.skipLike&&e.skipLike.test(i))return t;if("0"===i)return 0;if(e.unicode&&(i=function(t){if("string"!=typeof t)return t;const e=t.length;if(0===e)return t;let i=-1;for(let n=0;n<e;n++){const r=t.charCodeAt(n);if(!(r>=48&&r<=57||45===r))if(r<z){if(H.has(r)){i=n;break}}else if(r>=55296&&r<=56319){if(n+1<e){const e=t.charCodeAt(n+1);if(e>=56320&&e<=57343){const t=65536+(r-55296<<10)+(e-56320);if(W.has(t)){i=n;break}}}}else if(255!==Y[r-z]||H.has(r)){i=n;break}}if(-1===i)return t;const n=[];i>0&&n.push(t.slice(0,i));for(let r=i;r<e;r++){const i=t.charCodeAt(r);if(i>=48&&i<=57||45===i){n.push(t[r]);continue}if(i<z){n.push(H.has(i)?"-":t[r]);continue}if(i>=55296&&i<=56319){if(r+1<e){const e=t.charCodeAt(r+1);if(e>=56320&&e<=57343){const t=65536+(i-55296<<10)+(e-56320),s=W.get(t);if(void 0!==s){n.push(String.fromCharCode(s+48)),r++;continue}}}n.push(t[r]);continue}if(H.has(i)){n.push("-");continue}const s=Y[i-z];n.push(255!==s?String.fromCharCode(s+48):t[r])}return n.join("")}(i),"0"===i))return 0;if(e.hex&&Q.test(i))return nt(i,16);if(e.binary&&J.test(i))return nt(i,2);if(e.octal&&Z.test(i))return nt(i,8);if(isFinite(i)){if(i.includes("e")||i.includes("E"))return function(t,e,i){if(!i.eNotation)return t;const n=e.match(it);if(n){let r=n[1]||"";const s=-1===n[3].indexOf("e")?"E":"e",o=n[2],a=r?e[o.length+1]===s:e[o.length]===s;return o.length>1&&a?t:(1!==o.length||!n[3].startsWith(`.${s}`)&&n[3][0]!==s)&&o.length>0?i.leadingZeros&&!a?Number(e):t:Number(e)}return t}(t,i,e);{const n=K.exec(i);if(n){const r=n[1]||"",s=n[2];let o=function(t){if(t&&-1!==t.indexOf(".")){let e=t.length;for(;e>0&&48===t.charCodeAt(e-1);)e--;return"."===(t=t.slice(0,e))?t="0":"."===t[0]?t="0"+t:"."===t[t.length-1]&&(t=t.substring(0,t.length-1)),t}return t}(n[3]);const a=r?"."===i[s.length+1]:"."===i[s.length];if(!e.leadingZeros&&(s.length>1||1===s.length&&!a))return t;{const n=Number(i),a=String(n);if(0===n)return n;if(-1!==a.search(/[eE]/))return e.eNotation?n:t;if(-1!==i.indexOf("."))return"0"===a||a===o||a===`${r}${o}`?n:t;let l=s?o:i;return s?l===a||r+l===a?n:t:l===a||l===r+a?n:t}}return t}}{const n=Number(i);return Number.isNaN(n)?t:function(t,e,i){const n=e===1/0;switch(i.infinity.toLowerCase()){case"null":return null;case"infinity":return e;case"string":return n?"Infinity":"-Infinity";default:return t}}(t,n,e)}}const it=/^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/;function nt(t,e){const i=t.trim();if(2!==e&&8!==e||(t=i.substring(2)),parseInt)return parseInt(t,e);if(Number.parseInt)return Number.parseInt(t,e);if(window&&window.parseInt)return window.parseInt(t,e);throw new Error("parseInt, Number.parseInt, window.parseInt are not supported")}class rt{constructor(t){this._matcher=t}get separator(){return this._matcher.separator}getCurrentTag(){const t=this._matcher.path;return t.length>0?t[t.length-1].tag:void 0}getCurrentNamespace(){const t=this._matcher.path;return t.length>0?t[t.length-1].namespace:void 0}getAttrValue(t){const e=this._matcher.path;if(0!==e.length)return e[e.length-1].values?.[t]}hasAttr(t){const e=this._matcher.path;if(0===e.length)return!1;const i=e[e.length-1];return void 0!==i.values&&t in i.values}getAnyParentAttr(t){return this._matcher.getAnyParentAttr(t)}hasAnyParentAttr(t){return this._matcher.hasAnyParentAttr(t)}getPosition(){const t=this._matcher.path;return 0===t.length?-1:t[t.length-1].position??0}getCounter(){const t=this._matcher.path;return 0===t.length?-1:t[t.length-1].counter??0}getIndex(){return this.getPosition()}getDepth(){return this._matcher.path.length}toString(t,e=!0){return this._matcher.toString(t,e)}toArray(){return this._matcher.path.map(t=>t.tag)}matches(t){return this._matcher.matches(t)}matchesAny(t){return t.matchesAny(this._matcher)}}class st{constructor(t={}){this.separator=t.separator||".",this.path=[],this.siblingStacks=[],this._pathStringCache=null,this._view=new rt(this),this._keptAttrs=[]}push(t,e=null,i=null,n=null){this._pathStringCache=null,this.path.length>0&&(this.path[this.path.length-1].values=void 0);const r=this.path.length;let s=this.siblingStacks[r];s||(s={counts:new Map,total:0},this.siblingStacks[r]=s);const o=i?`${i}:${t}`:t,a=s.counts.get(o)||0,l=s.total;s.counts.set(o,a+1),s.total++;const c={tag:t,position:l,counter:a};null!=i&&(c.namespace=i),null!=e&&(c.values=e),this.path.push(c);const p=this.path.length,h=null!==n?n.keep:null;if(null!=h&&h.length>0&&e)for(let t=0;t<h.length;t++){const i=h[t];void 0!==e[i]&&this._keptAttrs.push({depth:p,name:i,value:e[i]})}}pop(){if(0===this.path.length)return;this._pathStringCache=null;const t=this.path.pop();this.siblingStacks.length>this.path.length+1&&(this.siblingStacks.length=this.path.length+1);const e=this.path.length+1;for(;this._keptAttrs.length>0&&this._keptAttrs[this._keptAttrs.length-1].depth>=e;)this._keptAttrs.pop();return t}updateCurrent(t){if(this.path.length>0){const e=this.path[this.path.length-1];null!=t&&(e.values=t)}}getCurrentTag(){return this.path.length>0?this.path[this.path.length-1].tag:void 0}getCurrentNamespace(){return this.path.length>0?this.path[this.path.length-1].namespace:void 0}getAttrValue(t){if(0!==this.path.length)return this.path[this.path.length-1].values?.[t]}hasAttr(t){if(0===this.path.length)return!1;const e=this.path[this.path.length-1];return void 0!==e.values&&t in e.values}getAnyParentAttr(t){const e=this._keptAttrs;for(let i=e.length-1;i>=0;i--)if(e[i].name===t)return e[i].value}hasAnyParentAttr(t){const e=this._keptAttrs;for(let i=e.length-1;i>=0;i--)if(e[i].name===t)return!0;return!1}getPosition(){return 0===this.path.length?-1:this.path[this.path.length-1].position??0}getCounter(){return 0===this.path.length?-1:this.path[this.path.length-1].counter??0}getIndex(){return this.getPosition()}getDepth(){return this.path.length}toString(t,e=!0){const i=t||this.separator;if(i===this.separator&&!0===e){if(null!==this._pathStringCache)return this._pathStringCache;const t=this.path.map(t=>t.namespace?`${t.namespace}:${t.tag}`:t.tag).join(i);return this._pathStringCache=t,t}return this.path.map(t=>e&&t.namespace?`${t.namespace}:${t.tag}`:t.tag).join(i)}toArray(){return this.path.map(t=>t.tag)}reset(){this._pathStringCache=null,this.path=[],this.siblingStacks=[],this._keptAttrs=[]}matches(t){const e=t.segments;return 0!==e.length&&(t.hasDeepWildcard()?this._matchWithDeepWildcard(e):this._matchSimple(e))}_matchSimple(t){if(this.path.length!==t.length)return!1;for(let e=0;e<t.length;e++)if(!this._matchSegment(t[e],this.path[e],e===this.path.length-1))return!1;return!0}_matchWithDeepWildcard(t){let e=this.path.length-1,i=t.length-1;for(;i>=0&&e>=0;){const n=t[i];if("deep-wildcard"===n.type){if(i--,i<0)return!0;const n=t[i];let r=!1;for(let t=e;t>=0;t--)if(this._matchSegment(n,this.path[t],t===this.path.length-1)){e=t-1,i--,r=!0;break}if(!r)return!1}else{if(!this._matchSegment(n,this.path[e],e===this.path.length-1))return!1;e--,i--}}return i<0}_matchSegment(t,e,i){if("*"!==t.tag&&t.tag!==e.tag)return!1;if(void 0!==t.namespace&&"*"!==t.namespace&&t.namespace!==e.namespace)return!1;if(void 0!==t.attrName){if(!i)return!1;if(!e.values||!(t.attrName in e.values))return!1;if(void 0!==t.attrValue&&String(e.values[t.attrName])!==String(t.attrValue))return!1}if(void 0!==t.position){if(!i)return!1;const n=e.counter??0;if("first"===t.position&&0!==n)return!1;if("odd"===t.position&&n%2!=1)return!1;if("even"===t.position&&n%2!=0)return!1;if("nth"===t.position&&n!==t.positionValue)return!1}return!0}matchesAny(t){return t.matchesAny(this)}snapshot(){return{path:this.path.map(t=>({...t})),siblingStacks:this.siblingStacks.map(t=>t?{counts:new Map(t.counts),total:t.total}:t),keptAttrs:this._keptAttrs.map(t=>({...t}))}}restore(t){this._pathStringCache=null,this.path=t.path.map(t=>({...t})),this.siblingStacks=t.siblingStacks.map(t=>t?{counts:new Map(t.counts),total:t.total}:t),this._keptAttrs=(t.keptAttrs||[]).map(t=>({...t}))}readOnly(){return this._view}}class ot{constructor(t,e={},i){this.pattern=t,this.separator=e.separator||".",this.segments=this._parse(t),this.data=i,this._hasDeepWildcard=this.segments.some(t=>"deep-wildcard"===t.type),this._hasAttributeCondition=this.segments.some(t=>void 0!==t.attrName),this._hasPositionSelector=this.segments.some(t=>void 0!==t.position)}_parse(t){const e=[];let i=0,n="";for(;i<t.length;)t[i]===this.separator?i+1<t.length&&t[i+1]===this.separator?(n.trim()&&(e.push(this._parseSegment(n.trim())),n=""),e.push({type:"deep-wildcard"}),i+=2):(n.trim()&&e.push(this._parseSegment(n.trim())),n="",i++):(n+=t[i],i++);return n.trim()&&e.push(this._parseSegment(n.trim())),e}_parseSegment(t){const e={type:"tag"};let i=null,n=t;const r=t.match(/^([^\[]+)(\[[^\]]*\])(.*)$/);if(r&&(n=r[1]+r[3],r[2])){const t=r[2].slice(1,-1);t&&(i=t)}let s,o,a=n;if(n.includes("::")){const e=n.indexOf("::");if(s=n.substring(0,e).trim(),a=n.substring(e+2).trim(),!s)throw new Error(`Invalid namespace in pattern: ${t}`)}let l=null;if(a.includes(":")){const t=a.lastIndexOf(":"),e=a.substring(0,t).trim(),i=a.substring(t+1).trim();["first","last","odd","even"].includes(i)||/^nth\(\d+\)$/.test(i)?(o=e,l=i):o=a}else o=a;if(!o)throw new Error(`Invalid segment pattern: ${t}`);if(e.tag=o,s&&(e.namespace=s),i)if(i.includes("=")){const t=i.indexOf("=");e.attrName=i.substring(0,t).trim(),e.attrValue=i.substring(t+1).trim()}else e.attrName=i.trim();if(l){const t=l.match(/^nth\((\d+)\)$/);t?(e.position="nth",e.positionValue=parseInt(t[1],10)):e.position=l}return e}get length(){return this.segments.length}hasDeepWildcard(){return this._hasDeepWildcard}hasAttributeCondition(){return this._hasAttributeCondition}hasPositionSelector(){return this._hasPositionSelector}toString(){return this.pattern}}class at{constructor(){this._byDepthAndTag=new Map,this._wildcardByDepth=new Map,this._deepWildcards=[],this._deepByTerminalTag=new Map,this._patterns=new Set,this._sealed=!1}add(t){if(this._sealed)throw new TypeError("ExpressionSet is sealed. Create a new ExpressionSet to add more expressions.");if(this._patterns.has(t.pattern))return this;if(this._patterns.add(t.pattern),t.hasDeepWildcard()){const e=t.segments[t.segments.length-1];if(e&&"deep-wildcard"!==e.type&&"*"!==e.tag){const i=e.tag;this._deepByTerminalTag.has(i)||this._deepByTerminalTag.set(i,[]),this._deepByTerminalTag.get(i).push(t)}else this._deepWildcards.push(t);return this}const e=t.length,i=t.segments[t.segments.length-1],n=i?.tag;if(n&&"*"!==n){const i=`${e}:${n}`;this._byDepthAndTag.has(i)||this._byDepthAndTag.set(i,[]),this._byDepthAndTag.get(i).push(t)}else this._wildcardByDepth.has(e)||this._wildcardByDepth.set(e,[]),this._wildcardByDepth.get(e).push(t);return this}addAll(t){for(const e of t)this.add(e);return this}has(t){return this._patterns.has(t.pattern)}get size(){return this._patterns.size}seal(){return this._sealed=!0,this}get isSealed(){return this._sealed}matchesAny(t){return null!==this.findMatch(t)}findMatch(t){const e=t.getDepth(),i=t.getCurrentTag(),n=`${e}:${i}`,r=this._byDepthAndTag.get(n);if(r)for(let e=0;e<r.length;e++)if(t.matches(r[e]))return r[e];const s=this._wildcardByDepth.get(e);if(s)for(let e=0;e<s.length;e++)if(t.matches(s[e]))return s[e];const o=this._deepByTerminalTag.get(i);if(o)for(let e=0;e<o.length;e++)if(t.matches(o[e]))return o[e];for(let e=0;e<this._deepWildcards.length;e++)if(t.matches(this._deepWildcards[e]))return this._deepWildcards[e];return null}}const lt={cent:"¢",pound:"£",curren:"¤",yen:"¥",euro:"€",dollar:"$",fnof:"ƒ",inr:"₹",af:"؋",birr:"ብር",peso:"₱",rub:"₽",won:"₩",yuan:"¥",cedil:"¸"},ct={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'},pt={nbsp:" ",copy:"©",reg:"®",trade:"™",mdash:"—",ndash:"–",hellip:"…",laquo:"«",raquo:"»",lsquo:"‘",rsquo:"’",ldquo:"“",rdquo:"”",bull:"•",para:"¶",sect:"§",deg:"°",frac12:"½",frac14:"¼",frac34:"¾"},ht=Object.freeze({ALLOW:"allow",BLOCK:"block",THROW:"throw"}),dt=new Set("!?\\\\/[]$%{}^&*()<>|+");function ut(t){if("#"===t[0])throw new Error(`[EntityReplacer] Invalid character '#' in entity name: "${t}"`);for(const e of t)if(dt.has(e))throw new Error(`[EntityReplacer] Invalid character '${e}' in entity name: "${t}"`);return t}function ft(...t){const e=Object.create(null);for(const i of t)if(i)for(const t of Object.keys(i)){const n=i[t];if("string"==typeof n)e[t]=n;else if(n&&"object"==typeof n&&void 0!==n.val){const i=n.val;"string"==typeof i&&(e[t]=i)}}return e}const gt="external",mt="base",xt="all",bt=Object.freeze({allow:0,leave:1,remove:2,throw:3}),yt=new Set([9,10,13]);class Nt{constructor(t={}){var e;this._limit=t.limit||{},this._maxTotalExpansions=this._limit.maxTotalExpansions||0,this._maxExpandedLength=this._limit.maxExpandedLength||0,this._postCheck="function"==typeof t.postCheck?t.postCheck:t=>t,this._limitTiers=(e=this._limit.applyLimitsTo??gt)&&e!==gt?e===xt?new Set([xt]):e===mt?new Set([mt]):Array.isArray(e)?new Set(e):new Set([gt]):new Set([gt]),this._numericAllowed=t.numericAllowed??!0,this._baseMap=ft(ct,t.namedEntities||null),this._externalMap=Object.create(null),this._inputMap=Object.create(null),this._totalExpansions=0,this._expandedLength=0,this._removeSet=new Set(t.remove&&Array.isArray(t.remove)?t.remove:[]),this._leaveSet=new Set(t.leave&&Array.isArray(t.leave)?t.leave:[]);const i=function(t){if(!t)return{xmlVersion:1,onLevel:bt.allow,nullLevel:bt.remove};const e=1.1===t.xmlVersion?1.1:1,i=bt[t.onNCR]??bt.allow,n=bt[t.nullNCR]??bt.remove;return{xmlVersion:e,onLevel:i,nullLevel:Math.max(n,bt.remove)}}(t.ncr);this._ncrXmlVersion=i.xmlVersion,this._ncrOnLevel=i.onLevel,this._ncrNullLevel=i.nullLevel,this._onExternalEntity="function"==typeof t.onExternalEntity?t.onExternalEntity:null,this._onInputEntity="function"==typeof t.onInputEntity?t.onInputEntity:null}_applyRegistrationHook(t,e,i,n){if(!t)return!0;const r=t(e,i);if(r===ht.BLOCK)return!1;if(r===ht.THROW)throw new Error(`[EntityDecoder] Registration of ${n} entity "&${e};" was rejected by hook`);return!0}setExternalEntities(t){if(t)for(const e of Object.keys(t))ut(e);if(!this._onExternalEntity)return void(this._externalMap=ft(t));const e=ft(t),i=Object.create(null);for(const[t,n]of Object.entries(e))this._applyRegistrationHook(this._onExternalEntity,t,n,"external")&&(i[t]=n);this._externalMap=i}addExternalEntity(t,e){ut(t),"string"==typeof e&&-1===e.indexOf("&")&&this._applyRegistrationHook(this._onExternalEntity,t,e,"external")&&(this._externalMap[t]=e)}addInputEntities(t){if(this._totalExpansions=0,this._expandedLength=0,!this._onInputEntity)return void(this._inputMap=ft(t));const e=ft(t),i=Object.create(null);for(const[t,n]of Object.entries(e))this._applyRegistrationHook(this._onInputEntity,t,n,"input")&&(i[t]=n);this._inputMap=i}reset(){return this._inputMap=Object.create(null),this._totalExpansions=0,this._expandedLength=0,this}setXmlVersion(t){this._ncrXmlVersion=1.1===t?1.1:1}decode(t){if("string"!=typeof t||0===t.length)return t;if(-1===t.indexOf("&"))return t;const e=t,i=[],n=t.length;let r=0,s=0;const o=this._maxTotalExpansions>0,a=this._maxExpandedLength>0,l=o||a;for(;s<n;){if(38!==t.charCodeAt(s)){s++;continue}let e=s+1;for(;e<n&&59!==t.charCodeAt(e)&&e-s<=32;)e++;if(e>=n||59!==t.charCodeAt(e)){s++;continue}const c=t.slice(s+1,e);if(0===c.length){s++;continue}let p,h;if(this._removeSet.has(c))p="",void 0===h&&(h=gt);else{if(this._leaveSet.has(c)){s++;continue}if(35===c.charCodeAt(0)){const t=this._resolveNCR(c);if(void 0===t){s++;continue}p=t,h=mt}else{const t=this._resolveName(c);p=t?.value,h=t?.tier}}if(void 0!==p){if(s>r&&i.push(t.slice(r,s)),i.push(p),r=e+1,s=r,l&&this._tierCounts(h)){if(o&&(this._totalExpansions++,this._totalExpansions>this._maxTotalExpansions))throw new Error(`[EntityReplacer] Entity expansion count limit exceeded: ${this._totalExpansions} > ${this._maxTotalExpansions}`);if(a){const t=p.length-(c.length+2);if(t>0&&(this._expandedLength+=t,this._expandedLength>this._maxExpandedLength))throw new Error(`[EntityReplacer] Expanded content length limit exceeded: ${this._expandedLength} > ${this._maxExpandedLength}`)}}}else s++}r<n&&i.push(t.slice(r));const c=0===i.length?t:i.join("");return this._postCheck(c,e)}_tierCounts(t){return!!this._limitTiers.has(xt)||this._limitTiers.has(t)}_resolveName(t){return t in this._inputMap?{value:this._inputMap[t],tier:gt}:t in this._externalMap?{value:this._externalMap[t],tier:gt}:t in this._baseMap?{value:this._baseMap[t],tier:mt}:void 0}_classifyNCR(t){return 0===t?this._ncrNullLevel:t>=55296&&t<=57343||1===this._ncrXmlVersion&&t>=1&&t<=31&&!yt.has(t)?bt.remove:-1}_applyNCRAction(t,e,i){switch(t){case bt.allow:return String.fromCodePoint(i);case bt.remove:return"";case bt.leave:return;case bt.throw:throw new Error(`[EntityDecoder] Prohibited numeric character reference &${e}; (U+${i.toString(16).toUpperCase().padStart(4,"0")})`);default:return String.fromCodePoint(i)}}_resolveNCR(t){const e=t.charCodeAt(1);let i;if(i=120===e||88===e?parseInt(t.slice(2),16):parseInt(t.slice(1),10),Number.isNaN(i)||i<0||i>1114111)return;const n=this._classifyNCR(i);if(!this._numericAllowed&&n<bt.remove)return;const r=-1===n?this._ncrOnLevel:Math.max(this._ncrOnLevel,n);return this._applyNCRAction(r,t,i)}}const Et=[{id:"sql-block-comment-open",description:"SQL block comment open: /* ... */ — unusual in legitimate user text",pattern:/\/\*/},{id:"sql-union-select",description:"UNION SELECT — most common SQL injection aggregation attack",pattern:/\bUNION\s{1,20}(?:ALL\s{1,20})?SELECT\b/i},{id:"sql-drop-table",description:"DROP TABLE — destructive DDL injection",pattern:/\bDROP\s{1,20}TABLE\b/i},{id:"sql-drop-database",description:"DROP DATABASE — destructive DDL injection",pattern:/\bDROP\s{1,20}DATABASE\b/i},{id:"sql-insert-into",description:"INSERT INTO — data injection",pattern:/\bINSERT\s{1,20}INTO\b/i},{id:"sql-delete-from",description:"DELETE FROM — data deletion injection",pattern:/\bDELETE\s{1,20}FROM\b/i},{id:"sql-update-set",description:"UPDATE ... SET — data modification injection",pattern:/\bUPDATE\b[\s\S]{1,60}\bSET\b/i},{id:"sql-exec-xp",description:"EXEC xp_ — MSSQL extended stored procedure execution",pattern:/\bEXEC(?:UTE)?\s{1,20}xp_/i},{id:"sql-tautology-string",description:'Classic string tautology: \' OR \'1\'=\'1 or " OR "1"="1"',pattern:/'\s{0,10}OR\s{0,10}'[^']{0,20}'\s*=\s*'[^']{0,20}/i},{id:"sql-tautology-numeric",description:"Numeric tautology: OR 1=1",pattern:/\bOR\s{1,10}1\s*=\s*1\b/i},{id:"sql-always-true-zero",description:"Numeric tautology: OR 0=0",pattern:/\bOR\s{1,10}0\s*=\s*0\b/i},{id:"sql-sleep-benchmark",description:"Time-based blind injection: SLEEP() or BENCHMARK()",pattern:/\b(?:SLEEP|BENCHMARK)\s*\(/i},{id:"sql-waitfor-delay",description:"MSSQL time-based blind injection: WAITFOR DELAY",pattern:/\bWAITFOR\s{1,20}DELAY\b/i},{id:"sql-char-function",description:"CHAR() function — used to obfuscate injected strings",pattern:/\bCHAR\s*\(\s*\d{1,3}/i},{id:"sql-information-schema",description:"INFORMATION_SCHEMA — reconnaissance query for table/column enumeration",pattern:/\bINFORMATION_SCHEMA\b/i}],wt=[...Et,{id:"sql-line-comment",description:"SQL line comment: -- followed by whitespace or end of string",pattern:/--(?:\s|$)/},{id:"sql-stacked-query",description:"Stacked queries: semicolon immediately followed by a SQL keyword",pattern:/;\s{0,10}(?:SELECT|INSERT|UPDATE|DELETE|DROP|CREATE|ALTER|EXEC)\b/i},{id:"sql-hex-encoding",description:"Hex-encoded string injection: 0x41414141 style (MySQL)",pattern:/\b0x[0-9a-f]{4,}/i}],vt=Object.freeze({colon:":",Tab:"\t",NewLine:"\n"}),St=/&(?:#[xX]0*([0-9a-fA-F]{1,6});?|#0*([0-9]{1,7});?|([a-zA-Z][a-zA-Z0-9]{1,15});)/g,At=[{id:"html-script-open",description:"<script opening tag",pattern:/<script[\s>/]/i},{id:"html-script-close",description:"<\/script closing tag",pattern:/<\/script[\s>]/i},{id:"html-javascript-protocol",description:"javascript: URI scheme (with optional whitespace/encoding)",pattern:/j[\t\n\r ]*a[\t\n\r ]*v[\t\n\r ]*a[\t\n\r ]*s[\t\n\r ]*c[\t\n\r ]*r[\t\n\r ]*i[\t\n\r ]*p[\t\n\r ]*t[\t\n\r ]*:/i},{id:"html-vbscript-protocol",description:"vbscript: URI scheme",pattern:/vbscript[\t\n\r ]*:/i},{id:"html-data-html",description:"data:text/html URI — can execute scripts in browsers",pattern:/data[\t\n\r ]*:[\t\n\r ]*text\/html/i},{id:"html-data-xhtml",description:"data:application/xhtml+xml URI",pattern:/data[\t\n\r ]*:[\t\n\r ]*application\/xhtml/i},{id:"html-data-svg",description:"data:image/svg+xml URI — can execute scripts",pattern:/data[\t\n\r ]*:[\t\n\r ]*image\/svg\+xml/i},{id:"html-inline-event-handler",description:"Inline event handler attributes: onclick=, onerror=, onload=, etc.",pattern:/\bon\w{1,30}\s*=/i},{id:"html-entity-obfuscated-script",description:"HTML-entity-encoded <script (e.g. <script or <script)",pattern:/(?:�*3[Cc];?|�*60;?|<)\s*script/i},{id:"html-entity-obfuscated-javascript",description:'HTML-entity-encoded javascript: (partial — catches common j or j for "j")',pattern:/(?:�*6[Aa];?|�*106;?)\s*(?:�*61;?|a)[\s\S]{0,80}script\s*:/i},{id:"html-style-expression",description:"CSS expression() — IE-era code execution in style attributes",pattern:/style[\s\S]{0,20}expression\s*\(/i},{id:"html-object-embed",description:"<object or <embed tags that can load active content",pattern:/<(?:object|embed)[\s>/]/i},{id:"html-base-tag",description:"<base href= — can hijack all relative URLs on a page",pattern:/<base[\s>]/i},{id:"html-meta-refresh",description:'<meta http-equiv="refresh" — can redirect users',pattern:/<meta[\s\S]{0,40}http-equiv[\s\S]{0,20}refresh/i},{id:"html-srcdoc",description:"srcdoc= attribute on iframes — embeds HTML that can run scripts",pattern:/srcdoc\s*=/i},{id:"html-iframe",description:"<iframe tag",pattern:/<iframe[\s>/]/i},{id:"html-form",description:"<form tag — can be used for phishing / credential harvesting injection",pattern:/<form[\s>/]/i}],Tt=[{id:"xml-cdata-injection",description:"CDATA section injection: <![CDATA[ breaks out of text node context",pattern:/<!\[CDATA\[/i},{id:"xml-cdata-close",description:"CDATA close sequence: ]]> can terminate an enclosing CDATA section",pattern:/\]\]>/},{id:"xml-processing-instruction",description:"XML processing instruction: <?xml-stylesheet or <?php etc.",pattern:/<\?(?:xml[\- ]|php|asp)/i},{id:"xml-doctype-injection",description:"DOCTYPE declaration embedded in content — can define entities",pattern:/<!DOCTYPE(?:[\s[]|$)/i},{id:"xml-entity-system",description:"SYSTEM keyword — used in external entity declarations (XXE)",pattern:/\bSYSTEM\s+["']/i},{id:"xml-entity-public",description:"PUBLIC keyword — used in external entity declarations (XXE)",pattern:/\bPUBLIC\s+["']/i},{id:"xml-entity-declaration",description:"<!ENTITY declaration — defines entities, potential XXE or entity expansion",pattern:/<!ENTITY[\s%]/i},{id:"xml-billion-laughs",description:"Entity reference chaining / billion laughs: repeated &eX; style references",pattern:/(?:&\w{1,20};){3,}/},{id:"xml-namespace-confusion",description:"xmlns: attribute injection — can redefine namespaces to confuse parsers",pattern:/\bxmlns(?::\w{1,40})?\s*=/i},{id:"xml-comment-injection",description:"\x3c!-- comment injection — can hide content from some parsers",pattern:/<!--/},{id:"xml-comment-close",description:"--\x3e closes an enclosing XML comment",pattern:/-->/},{id:"xml-pi-close",description:"?> closes an enclosing processing instruction",pattern:/\?>/}],_t=[{id:"svg-script-element",description:"<script element inside SVG executes JavaScript",pattern:/<script[\s>/]/i},{id:"svg-xlink-href-javascript",description:"xlink:href with javascript: — classic SVG XSS via <a> or <use>",pattern:/xlink\s*:\s*href\s*=\s*["']?\s*javascript\s*:/i},{id:"svg-href-javascript",description:"href= with javascript: in SVG context (<a>, <animate>, etc.)",pattern:/href\s*=\s*["']?\s*javascript\s*:/i},{id:"svg-foreignobject",description:"<foreignObject embeds HTML inside SVG — can execute scripts",pattern:/<foreignObject[\s>/]/i},{id:"svg-use-external",description:"<use xlink:href or href pointing to external resource (non-fragment URL)",pattern:/<use[\s\S]{0,60}(?:xlink\s*:\s*)?href\s*=\s*(?:["'][^#]|[^"'#\s>])/i},{id:"svg-animate-href",description:'<animate attributeName="href" — can dynamically change href to javascript:',pattern:/<animate[\s\S]{0,80}attributeName\s*=\s*["'][\s]*href["']/i},{id:"svg-animate-xlinkhref",description:'<animate attributeName="xlink:href"',pattern:/<animate[\s\S]{0,80}attributeName\s*=\s*["'][\s]*xlink\s*:\s*href["']/i},{id:"svg-set-javascript",description:'<set to="javascript:..." — sets an attribute to a javascript: URI',pattern:/<set[\s\S]{0,80}to\s*=\s*["']?\s*javascript\s*:/i},{id:"svg-event-handler",description:"SVG-specific event handler attributes: onload=, onerror=, onactivate=, etc.",pattern:/\bon(?:load|error|activate|begin|end|repeat|focus|blur|click|mouse\w{1,20}|key\w{1,20})\s*=/i},{id:"svg-handler-generic",description:"Generic on* handler catch-all for SVG attributes",pattern:/\bon\w{1,30}\s*=/i},{id:"svg-filter-feimage",description:"<feImage href= — filter primitive that can load external resources",pattern:/<feImage[\s\S]{0,80}(?:xlink\s*:\s*)?href\s*=/i},{id:"svg-image-external",description:"<image xlink:href with http/https or javascript protocol",pattern:/<image[\s\S]{0,80}(?:xlink\s*:\s*)?href\s*=\s*["']?\s*(?:https?|javascript)\s*:/i},{id:"svg-style-javascript",description:"style= attribute containing javascript: (e.g. background:url(javascript:...))",pattern:/style\s*=[\s\S]{0,60}javascript\s*:/i}],Ct=[{id:"shell-path-traversal-unix",description:"Unix path traversal: ../ — climbing the directory tree",pattern:/\.\.\//},{id:"shell-path-traversal-windows",description:"Windows path traversal: ..\\ — climbing the directory tree",pattern:/\.\.\\/},{id:"shell-path-traversal-encoded",description:"URL-encoded path traversal: %2e%2e or %2f variants",pattern:/%2e%2e|%2f\.\.|\.\.%2f/i},{id:"shell-null-byte",description:"Null byte injection: \\x00 or %00 — truncates strings in C-backed functions",pattern:/\x00|%00/},{id:"shell-semicolon",description:"Semicolon command separator: cmd1; cmd2",pattern:/;/},{id:"shell-pipe",description:"Pipe operator: cmd1 | cmd2",pattern:/\|/},{id:"shell-and-operator",description:"AND operator: cmd1 && cmd2",pattern:/&&/},{id:"shell-or-operator",description:"OR operator: cmd1 || cmd2",pattern:/\|\|/},{id:"shell-backtick",description:"Backtick command substitution: `cmd`",pattern:/`/},{id:"shell-dollar-paren",description:"Dollar-paren command substitution: $(cmd)",pattern:/\$\(/},{id:"shell-dollar-brace",description:"Dollar-brace variable expansion: ${var} — can be abused for injection",pattern:/\$\{/},{id:"shell-redirect-out",description:"Output redirection: cmd > file or cmd >> file",pattern:/>{1,2}/},{id:"shell-redirect-in",description:"Input redirection: cmd < file",pattern:/</},{id:"shell-newline-injection",description:"Newline injection: \\n or \\r — can inject new shell commands",pattern:/[\n\r]/},{id:"shell-glob-star",description:"Glob expansion: * or ? — can expand to unintended files",pattern:/[/\\][*?]/},{id:"shell-absolute-root",description:"Absolute root path injection: string starting with / or \\ (Windows UNC)",pattern:/^(?:\/|\\\\)/},{id:"shell-windows-drive",description:"Windows drive letter path injection: C:\\ or D:/",pattern:/^[a-zA-Z]:[/\\]/},{id:"shell-curl-wget",description:"curl/wget with URL or flags — can exfiltrate data or download payloads",pattern:/\b(?:curl|wget)\s+(?:https?:\/\/|ftp:\/\/|-)/i}],Ot=[{id:"redos-nested-quantifier-plus",description:"Nested + quantifier inside a group with outer quantifier: (a+)+, (.+b)*, etc.",pattern:/\([^)]*\+[^)]*\)[+*]/},{id:"redos-nested-quantifier-star",description:"Nested * quantifier: (a*)* or (a*)+ — catastrophic backtracking",pattern:/\([^)]*\*[^)]*\)[*+]/},{id:"redos-nested-groups",description:"Doubly nested quantified groups: ((a+)+) — guaranteed catastrophic",pattern:/\(\([^)]{0,40}\)[+*]\)[+*]/},{id:"redos-alternation-overlap",description:"Overlapping alternation under quantifier: (a|a)+ — ambiguous NFA paths",pattern:/\(([^|()]{1,20})\|(?:\1)(?:\|[^|()]{1,20}){0,5}\)[+*?]{1,2}/},{id:"redos-star-plus-concat",description:"(x*x)+ pattern — triggers super-linear backtracking",pattern:/\([^)]{0,10}\*[^)]{0,10}\)[+*]/},{id:"redos-dot-star-greedy",description:"(.*){n,} or (.+){n,} — repeated greedy dot quantifiers",pattern:/\(\.[*+]\)\{?\d/},{id:"redos-large-repetition",description:"Very large fixed or range repetition count {1000,} or {1000,n} — denial of service via backtracking",pattern:/\{\d{4,}(?:,\d*)?\}/},{id:"redos-catastrophic-alternation",description:"Long alternation with many similar branches — polynomial backtracking risk",pattern:/\([^)]{0,200}(?:\|[^|)]{0,50}){9,}\)/}],$t="[\"'\\s]*:",Pt=[{id:"nosql-where-operator",description:"$where — executes arbitrary JavaScript server-side in MongoDB",pattern:new RegExp(`\\$where${$t}`,"i")},{id:"nosql-ne-operator",description:'$ne — "not equal" operator used to bypass equality checks',pattern:new RegExp(`\\$ne${$t}`,"i")},{id:"nosql-gt-operator",description:'$gt — "greater than" used to bypass password/value checks',pattern:new RegExp(`\\$gte?${$t}`,"i")},{id:"nosql-lt-operator",description:'$lt / $lte — "less than" bypass variants',pattern:new RegExp(`\\$lte?${$t}`,"i")},{id:"nosql-regex-operator",description:"$regex — can be used to extract data character by character (blind injection)",pattern:new RegExp(`\\$regex${$t}`,"i")},{id:"nosql-or-operator",description:"$or — logical OR; used to create always-true conditions",pattern:new RegExp(`\\$or${$t}\\s*\\[`,"i")},{id:"nosql-and-operator",description:"$and — logical AND operator injection",pattern:new RegExp(`\\$and${$t}\\s*\\[`,"i")},{id:"nosql-nor-operator",description:"$nor — logical NOR operator injection",pattern:new RegExp(`\\$nor${$t}\\s*\\[`,"i")},{id:"nosql-exists-operator",description:"$exists — can enumerate fields to determine schema",pattern:new RegExp(`\\$exists${$t}`,"i")},{id:"nosql-in-operator",description:"$in — matches any value in a list; can enumerate values",pattern:new RegExp(`\\$in${$t}\\s*\\[`,"i")},{id:"nosql-expr-operator",description:"$expr — allows aggregation expressions in queries (MongoDB 3.6+)",pattern:new RegExp(`\\$expr${$t}`,"i")},{id:"nosql-function-operator",description:"$function — executes arbitrary JavaScript in MongoDB 4.4+",pattern:new RegExp(`\\$function${$t}`,"i")},{id:"nosql-accumulator-operator",description:"$accumulator — custom aggregation with arbitrary JS execution",pattern:new RegExp(`\\$accumulator${$t}`,"i")},{id:"nosql-proto-pollution",description:"__proto__ — prototype pollution via object key injection",pattern:/__proto__/},{id:"nosql-constructor-prototype",description:"constructor.prototype — alternative prototype pollution vector (dot notation or JSON key)",pattern:/constructor[\s"':.,{\[]*prototype/i},{id:"nosql-proto-bracket",description:'["__proto__"] — bracket-notation prototype pollution',pattern:/\[["']__proto__["']\]/}],jt=[{id:"log-crlf-injection",description:"CRLF injection: literal \\r or \\n embeds fake log lines",pattern:/[\r\n]/},{id:"log-url-encoded-crlf",description:"URL-encoded CRLF: %0d, %0a, %0D, %0A — decoded by some log parsers",pattern:/%0[dDaA]/},{id:"log-unicode-newline",description:"Unicode newline variants: U+2028 (line separator), U+2029 (paragraph separator)",pattern:/[\u2028\u2029]/},{id:"log-log4shell-jndi",description:"Log4Shell: ${jndi:...} triggers remote code execution in Apache Log4j",pattern:/\$\{jndi\s*:/i},{id:"log-log4shell-obfuscated",description:"Obfuscated Log4Shell: ${::-j}... lookup-bypass prefix used to evade WAF detection",pattern:/\$\{::-/},{id:"log-log4j-lookup",description:"Log4j lookup syntax: ${env:...}, ${sys:...}, ${ctx:...} — data exfiltration",pattern:/\$\{(?:env|sys|ctx|main|map|sd|web|docker|k8s|spring)\s*:/i},{id:"log-ssti-double-brace",description:"SSTI double-brace: {{expression}} — Jinja2, Twig, Handlebars, etc.",pattern:/\{\{[\s\S]{0,80}\}\}/},{id:"log-ssti-hash-brace",description:"SSTI hash-brace: #{expression} — Thymeleaf, Velocity, Ruby ERB",pattern:/#\{[\s\S]{0,80}\}/},{id:"log-ssti-dollar-brace",description:"SSTI/EL injection: ${expression with operators or method calls} — JSP EL, Freemarker, SpEL",pattern:/\$\{[^}]*(?:\.|\(|\*|\+|\bclass\b|\bruntime\b|\bprocess\b|\bexec\b)[^}]{0,80}\}/i},{id:"log-ssti-percent-tag",description:"SSTI ERB/ASP tag: <%= expression %> — Ruby ERB, ASP",pattern:/<%=[\s\S]{0,80}%>/},{id:"log-null-byte",description:"Null byte: \\x00 or %00 — can truncate log entries in C-backed loggers",pattern:/\x00|%00/},{id:"log-ansi-escape",description:"ANSI escape sequence: ESC[ — can manipulate terminal output when logs are tailed",pattern:/\x1b\[/}];function It(t,e){const i=e.label??"CUSTOM",n=function(t,e){if(!e.decodeEntities)return null;const i=-1===(n=t).indexOf("&")?n:n.replace(St,(t,e,i,n)=>{if(void 0!==n)return Object.prototype.hasOwnProperty.call(vt,n)?vt[n]:t;const r=void 0!==e?parseInt(e,16):parseInt(i,10);return!Number.isFinite(r)||r>1114111?t:String.fromCodePoint(r)});var n;return i===t?null:i}(t,e);for(const r of e)if(r.pattern.test(t)||null!==n&&r.pattern.test(n))return{context:i,id:r.id,description:r.description,pattern:r.pattern};return null}function kt(t,e){(function(t){if("string"!=typeof t)throw new TypeError("is-unsafe: first argument must be a string, got "+typeof t)})(t),function(t){if(!(t instanceof RegExp)){if(!Array.isArray(t))throw new TypeError("is-unsafe: second argument must be a PatternList (e.g. HTML), an array of PatternLists (e.g. [HTML, XML]), or a RegExp. Got: "+typeof t);if(0===t.length)throw new TypeError("is-unsafe: context must not be an empty array");if(Array.isArray(t[0]))for(const e of t)if(!Array.isArray(e)||0===e.length)throw new TypeError("is-unsafe: each context in the array must be a non-empty pattern array (PatternList)")}}(e);const{lists:i,regex:n}=function(t){return t instanceof RegExp?{lists:null,regex:t}:Array.isArray(t[0])?{lists:t,regex:null}:{lists:[t],regex:null}}(e);if(n)return n.test(t);for(const e of i)if(null!==It(t,e))return!0;return!1}function Lt(t,e){if(!t)return{};const i=e.attributesGroupName?t[e.attributesGroupName]:t;if(!i)return{};const n={};for(const t in i)t.startsWith(e.attributeNamePrefix)?n[t.substring(e.attributeNamePrefix.length)]=i[t]:n[t]=i[t];return n}function Dt(t){if(!t||"string"!=typeof t)return;const e=t.indexOf(":");if(-1!==e&&e>0){const i=t.substring(0,e);if("xmlns"!==i)return i}}At.label="HTML",Tt.label="XML",_t.label="SVG",At.decodeEntities=!0,Tt.decodeEntities=!0,_t.decodeEntities=!0,Et.label="SQL",wt.label="SQL-STRICT",Ct.label="SHELL",Ot.label="REDOS",Pt.label="NOSQL",jt.label="LOG",Object.freeze({HTML:At,XML:Tt,SVG:_t,SQL:Et,"SQL-STRICT":wt,SHELL:Ct,REDOS:Ot,NOSQL:Pt,LOG:jt});class Mt{constructor(t,e){var i;this.options=t,this.currentNode=null,this.tagsNodeStack=[],this.parseXml=Ut,this.parseTextData=Rt,this.resolveNameSpace=Vt,this.buildAttributesMap=Ft,this.isItStopNode=zt,this.replaceEntitiesValue=Xt,this.readStopNodeData=Jt,this.saveTextToParentTag=Wt,this.addChild=Gt,this.ignoreAttributesFn="function"==typeof(i=this.options.ignoreAttributes)?i:Array.isArray(i)?t=>{for(const e of i){if("string"==typeof e&&t===e)return!0;if(e instanceof RegExp&&e.test(t))return!0}}:()=>!1,this.entityExpansionCount=0,this.currentExpandedLength=0,this.doctypefound=!1;let n={...ct};this.options.entityDecoder?this.entityDecoder=this.options.entityDecoder:("object"==typeof this.options.htmlEntities?n=this.options.htmlEntities:!0===this.options.htmlEntities&&(n={...pt,...lt}),this.entityDecoder=new Nt({namedEntities:{...n,...e},numericAllowed:this.options.htmlEntities,limit:{maxTotalExpansions:this.options.processEntities.maxTotalExpansions,maxExpandedLength:this.options.processEntities.maxExpandedLength,applyLimitsTo:this.options.processEntities.appliesTo},onInputEntity:(t,e)=>kt(e,[At,Tt])?ht.BLOCK:ht.ALLOW})),this.matcher=new st,this.readonlyMatcher=this.matcher.readOnly(),this.isCurrentNodeStopNode=!1,this.stopNodeExpressionsSet=new at;const r=this.options.stopNodes;if(r&&r.length>0){for(let t=0;t<r.length;t++){const e=r[t];"string"==typeof e?this.stopNodeExpressionsSet.add(new ot(e)):e instanceof ot&&this.stopNodeExpressionsSet.add(e)}this.stopNodeExpressionsSet.seal()}}}function Rt(t,e,i,n,r,s,o){const a=this.options;if(void 0!==t&&(a.trimValues&&!n&&(t=t.trim()),t.length>0)){o||(t=this.replaceEntitiesValue(t,e,i));const n=a.jPath?i.toString():i,l=a.tagValueProcessor(e,t,n,r,s);return null==l?t:typeof l!=typeof t||l!==t?l:a.trimValues||t.trim()===t?Zt(t,a.parseTagValue,a.numberParseOptions):t}}function Vt(t){if(this.options.removeNSPrefix){const e=t.split(":"),i="/"===t.charAt(0)?"/":"";if("xmlns"===e[0])return"";2===e.length&&(t=i+e[1])}return t}const qt=new RegExp("([^\\s=]+)\\s*(=\\s*(['\"])([\\s\\S]*?)\\3)?","gm");function Ft(t,e,i,n=!1){const r=this.options;if(!0===n||!0!==r.ignoreAttributes&&"string"==typeof t){const n=function(t,e){const i=[];let n=e.exec(t);for(;n;){const r=[];r.startIndex=e.lastIndex-n[0].length;const s=n.length;for(let t=0;t<s;t++)r.push(n[t]);i.push(r),n=e.exec(t)}return i}(t,qt),s=n.length,o={},a=new Array(s);let l=!1;const c={};for(let t=0;t<s;t++){const e=this.resolveNameSpace(n[t][1]),s=n[t][4];if(e.length&&void 0!==s){let n=s;r.trimValues&&(n=n.trim()),n=this.replaceEntitiesValue(n,i,this.readonlyMatcher),a[t]=n,c[e]=n,l=!0}}l&&"object"==typeof e&&e.updateCurrent&&e.updateCurrent(c);const p=r.jPath?e.toString():this.readonlyMatcher;let h=!1;for(let t=0;t<s;t++){const e=this.resolveNameSpace(n[t][1]);if(this.ignoreAttributesFn(e,p))continue;let i=r.attributeNamePrefix+e;if(e.length)if(r.transformAttributeName&&(i=r.transformAttributeName(i)),i=te(i,r),void 0!==n[t][4]){const n=a[t],s=r.attributeValueProcessor(e,n,p);o[i]=null==s?n:typeof s!=typeof n||s!==n?s:Zt(n,r.parseAttributeValue,r.numberParseOptions),h=!0}else r.allowBooleanAttributes&&(o[i]=!0,h=!0)}if(!h)return;if(r.attributesGroupName&&!r.preserveOrder){const t={};return t[r.attributesGroupName]=o,t}return o}}const Ut=function(t){const e=this.options,i=e.captureMetaData?[]:void 0;t=t.replace(/\r\n?/g,e.captureMetaData?(t,e)=>(2===t.length&&i.push(e-i.length),"\n"):"\n");const n=new C("!xml");let r=n,s="";this.matcher.reset(),this.entityDecoder.reset(),this.entityExpansionCount=0,this.currentExpandedLength=0,this.doctypefound=!1;const o=new F(e.processEntities),a=t.length;for(let l=0;l<a;l++)if("<"===t[l]){const c=t.charCodeAt(l+1);if(47===c){const o=Yt(t,">",l,"Closing Tag is not closed.");let a=t.substring(l+2,o).trim();if(e.removeNSPrefix){const t=a.indexOf(":");-1!==t&&(a=a.substr(t+1))}a=Kt(e.transformTagName,a,"",e).tagName,r&&(s=this.saveTextToParentTag(s,r,this.readonlyMatcher));const c=this.matcher.getCurrentTag();if(a&&e.unpairedTagsSet.has(a))throw new Error(`Unpaired tag can not be used as closing tag: </${a}>`);c&&e.unpairedTagsSet.has(c)&&(this.matcher.pop(),this.tagsNodeStack.pop()),this.matcher.pop(),this.isCurrentNodeStopNode=!1,r=this.tagsNodeStack.pop()||n,e.captureMetaData&&r&&r.addEndIndex(Bt(o+1,i)),s="",l=o}else if(63===c){let n=Qt(t,l,!1,"?>");if(!n)throw new Error("Pi Tag is not closed.");s=this.saveTextToParentTag(s,r,this.readonlyMatcher);const a=this.buildAttributesMap(n.tagExp,this.matcher,n.tagName,!0);if(a){const t=a[this.options.attributeNamePrefix+"version"];this.entityDecoder.setXmlVersion(Number(t)||1),o.setXmlVersion(Number(t)||1)}if(e.ignoreDeclaration&&"?xml"===n.tagName||e.ignorePiTags);else{const t=new C(n.tagName);t.add(e.textNodeName,""),n.tagName!==n.tagExp&&n.attrExpPresent&&!0!==e.ignoreAttributes&&(t[":@"]=a);const s=e.captureMetaData?Bt(l,i):l;this.addChild(r,t,this.readonlyMatcher,s),e.captureMetaData&&r.addEndIndex(Bt(n.closeIndex+2,i))}l=n.closeIndex+1}else if(33===c&&45===t.charCodeAt(l+2)&&45===t.charCodeAt(l+3)){const i=Yt(t,"--\x3e",l+4,"Comment is not closed.");if(e.commentPropName){const n=t.substring(l+4,i-2);s=this.saveTextToParentTag(s,r,this.readonlyMatcher),r.add(e.commentPropName,[{[e.textNodeName]:n}])}l=i}else if(33===c&&68===t.charCodeAt(l+2)){if(this.doctypefound)throw new Error("Multiple DOCTYPE declarations found.");this.doctypefound=!0;const e=o.readDocType(t,l);this.entityDecoder.addInputEntities(e.entities),l=e.i}else if(33===c&&91===t.charCodeAt(l+2)){const i=Yt(t,"]]>",l,"CDATA is not closed.")-2,n=t.substring(l+9,i);s=this.saveTextToParentTag(s,r,this.readonlyMatcher);let o=this.parseTextData(n,r.tagname,this.readonlyMatcher,!0,!1,!0,!0);null==o&&(o=""),e.cdataPropName?r.add(e.cdataPropName,[{[e.textNodeName]:n}]):r.add(e.textNodeName,o),l=i+2}else{let o=Qt(t,l,e.removeNSPrefix);if(!o){const e=t.substring(Math.max(0,l-50),Math.min(a,l+50));throw new Error(`readTagExp returned undefined at position ${l}. Context: "${e}"`)}let c=o.tagName;const p=o.rawTagName;let h=o.tagExp,d=o.attrExpPresent,u=o.closeIndex;if(({tagName:c,tagExp:h}=Kt(e.transformTagName,c,h,e)),e.strictReservedNames&&(c===e.commentPropName||c===e.cdataPropName||c===e.textNodeName||c===e.attributesGroupName))throw new Error(`Invalid tag name: ${c}`);r&&s&&"!xml"!==r.tagname&&(s=this.saveTextToParentTag(s,r,this.readonlyMatcher,!1));const f=r;f&&e.unpairedTagsSet.has(f.tagname)&&(r=this.tagsNodeStack.pop(),this.matcher.pop());let g=!1;h.length>0&&h.lastIndexOf("/")===h.length-1&&(g=!0,"/"===c[c.length-1]?(c=c.substr(0,c.length-1),h=c):h=h.substr(0,h.length-1),d=c!==h);let m,x=null,b={};m=Dt(p),c!==n.tagname&&this.matcher.push(c,{},m),c!==h&&d&&(x=this.buildAttributesMap(h,this.matcher,c),x&&(b=Lt(x,e))),c!==n.tagname&&(this.isCurrentNodeStopNode=this.isItStopNode());const y=e.captureMetaData?Bt(l,i):l;if(this.isCurrentNodeStopNode){let n="";if(g)l=o.closeIndex;else if(e.unpairedTagsSet.has(c))l=o.closeIndex;else{const e=this.readStopNodeData(t,p,u+1);if(!e)throw new Error(`Unexpected end of ${p}`);l=e.i,n=e.tagContent}const s=new C(c);x&&(s[":@"]=x),s.add(e.textNodeName,n),this.matcher.pop(),this.isCurrentNodeStopNode=!1,this.addChild(r,s,this.readonlyMatcher,y),e.captureMetaData&&r.addEndIndex(Bt(l+1,i))}else{if(g){({tagName:c,tagExp:h}=Kt(e.transformTagName,c,h,e));const t=new C(c);x&&(t[":@"]=x),this.addChild(r,t,this.readonlyMatcher,y),e.captureMetaData&&r.addEndIndex(Bt(u+1,i)),this.matcher.pop(),this.isCurrentNodeStopNode=!1}else{if(e.unpairedTagsSet.has(c)){const t=new C(c);x&&(t[":@"]=x),this.addChild(r,t,this.readonlyMatcher,y),e.captureMetaData&&r.addEndIndex(Bt(o.closeIndex+1,i)),this.matcher.pop(),this.isCurrentNodeStopNode=!1,l=o.closeIndex;continue}{const t=new C(c);if(this.tagsNodeStack.length>e.maxNestedTags)throw new Error("Maximum nested tags exceeded");this.tagsNodeStack.push(r),x&&(t[":@"]=x),this.addChild(r,t,this.readonlyMatcher,y),r=t}}s="",l=u}}}else s+=t[l];return n.child};function Bt(t,e){let i=0,n=e.length;for(;i<n;){const r=Math.floor((i+n)/2);e[r]<t?i=r+1:n=r}return t+i}function Gt(t,e,i,n){this.options.captureMetaData||(n=void 0);const r=this.options.jPath?i.toString():i,s=this.options.updateTag(e.tagname,r,e[":@"]);!1===s||("string"==typeof s?(e.tagname=s,t.addChild(e,n)):t.addChild(e,n))}function Xt(t,e,i){const n=this.options.processEntities;if(!n||!n.enabled)return t;if(n.allowedTags){const r=this.options.jPath?i.toString():i;if(!(Array.isArray(n.allowedTags)?n.allowedTags.includes(e):n.allowedTags(e,r)))return t}if(n.tagFilter){const r=this.options.jPath?i.toString():i;if(!n.tagFilter(e,r))return t}return this.entityDecoder.decode(t)}function Wt(t,e,i,n){return t&&(void 0===n&&(n=0===e.child.length),void 0!==(t=this.parseTextData(t,e.tagname,i,!1,!!e[":@"]&&0!==Object.keys(e[":@"]).length,n))&&""!==t&&e.add(this.options.textNodeName,t),t=""),t}function zt(){return 0!==this.stopNodeExpressionsSet.size&&this.matcher.matchesAny(this.stopNodeExpressionsSet)}function Yt(t,e,i,n){const r=t.indexOf(e,i);if(-1===r)throw new Error(n);return r+e.length-1}function Ht(t,e,i,n){const r=t.indexOf(e,i);if(-1===r)throw new Error(n);return r}function Qt(t,e,i,n=">"){const r=function(t,e,i=">"){let n=0;const r=t.length,s=i.charCodeAt(0),o=i.length>1?i.charCodeAt(1):-1;let a="",l=e;for(let i=e;i<r;i++){const e=t.charCodeAt(i);if(n)e===n&&(n=0);else if(34===e||39===e)n=e;else if(e===s){if(-1===o)return a+=t.substring(l,i),{data:a,index:i};if(t.charCodeAt(i+1)===o)return a+=t.substring(l,i),{data:a,index:i}}else 9!==e||n||(a+=t.substring(l,i)+" ",l=i+1)}}(t,e+1,n);if(!r)return;let s=r.data;const o=r.index,a=s.search(/\s/);let l=s,c=!0;-1!==a&&(l=s.substring(0,a),s=s.substring(a+1).trimStart());const p=l;if(i){const t=l.indexOf(":");-1!==t&&(l=l.substr(t+1),c=l!==r.data.substr(t+1))}return{tagName:l,tagExp:s,closeIndex:o,attrExpPresent:c,rawTagName:p}}function Jt(t,e,i){const n=i;let r=1,s=!1,o=-1;const a=t.length;for(;i<a;i++)if("<"===t[i]){const a=t.charCodeAt(i+1);if(47===a){const s=Ht(t,">",i,`${e} is not closed`);if(t.substring(i+2,s).trim()===e&&(r--,0===r))return{tagContent:t.substring(n,i),i:s};i=s}else if(63===a)i=Yt(t,"?>",i+1,"StopNode is not closed.");else if(33===a&&45===t.charCodeAt(i+2)&&45===t.charCodeAt(i+3))i=Yt(t,"--\x3e",i+3,"StopNode is not closed.");else if(33===a&&91===t.charCodeAt(i+2))i=Yt(t,"]]>",i,"StopNode is not closed.")-2;else{const n=s?void 0:Qt(t,i,!1);if(n)n.tagName===e&&"/"!==n.tagExp[n.tagExp.length-1]&&r++,i=n.closeIndex;else{if(s=!0,o<i&&(o=t.indexOf(">",i),-1===o))return;const n=t.indexOf("<",i+1);if(-1===n||n>o){const n=t.substring(i+1,o),s=n.search(/\s/);(-1===s?n:n.substring(0,s))===e&&"/"!==n[n.length-1]&&r++,i=o}}}}}function Zt(t,e,i){if(e&&"string"==typeof t){const e=t.trim();return"true"===e||"false"!==e&&et(t,i)}return void 0!==t?t:""}function Kt(t,e,i,n){if(t){const n=t(e);i===e&&(i=n),e=n}return{tagName:e=te(e,n),tagExp:i}}function te(t,e){if(o.includes(t))throw new Error(`[SECURITY] Invalid name: "${t}" is a reserved JavaScript keyword that could cause prototype pollution`);return s.includes(t)?e.onDangerousProperty(t):t}const ee=C.getMetaDataSymbol();function ie(t,e){if(!t||"object"!=typeof t)return{};if(!e)return t;const i={};for(const n in t)n.startsWith(e)?i[n.substring(e.length)]=t[n]:i[n]=t[n];return i}function ne(t,e,i,n){return re(t,e,i,n)}function re(t,e,i,n){let r;const s={};for(let o=0;o<t.length;o++){const a=t[o],l=se(a);if(void 0!==l&&l!==e.textNodeName){const t=ie(a[":@"]||{},e.attributeNamePrefix);i.push(l,t)}if(l===e.textNodeName)void 0===r?r=a[l]:r+=""+a[l];else{if(void 0===l)continue;if(a[l]){let t=re(a[l],e,i,n);const r=ae(t,e);if(0===Object.keys(t).length&&e.alwaysCreateTextNode&&(t[e.textNodeName]=""),a[":@"]?oe(t,a[":@"],n,e):1!==Object.keys(t).length||void 0===t[e.textNodeName]||e.alwaysCreateTextNode?0===Object.keys(t).length&&(e.alwaysCreateTextNode?t[e.textNodeName]="":t=""):t=t[e.textNodeName],void 0!==a[ee]&&"object"==typeof t&&null!==t&&(t[ee]=a[ee]),void 0!==s[l]&&Object.prototype.hasOwnProperty.call(s,l))Array.isArray(s[l])||(s[l]=[s[l]]),s[l].push(t);else{const i=e.jPath?n.toString():n;e.isArray(l,i,r)?s[l]=[t]:s[l]=t}void 0!==l&&l!==e.textNodeName&&i.pop()}}}return"string"==typeof r?r.length>0&&(s[e.textNodeName]=r):void 0!==r&&(s[e.textNodeName]=r),s}function se(t){const e=Object.keys(t);for(let t=0;t<e.length;t++){const i=e[t];if(":@"!==i)return i}}function oe(t,e,i,n){if(e){const r=Object.keys(e),s=r.length;for(let o=0;o<s;o++){const s=r[o],a=s.startsWith(n.attributeNamePrefix)?s.substring(n.attributeNamePrefix.length):s,l=n.jPath?i.toString()+"."+a:i;n.isArray(s,l,!0,!0)?t[s]=[e[s]]:t[s]=e[s]}}}function ae(t,e){const{textNodeName:i}=e,n=Object.keys(t).length;return 0===n||!(1!==n||!t[i]&&"boolean"!=typeof t[i]&&0!==t[i])}class le{constructor(t){this.externalEntities={},this.options=T(t)}parse(t,e){if("string"!=typeof t&&t.toString)t=t instanceof Uint8Array&&("undefined"==typeof Buffer||!Buffer.isBuffer(t))?new TextDecoder("utf-8",{ignoreBOM:!0}).decode(t):t.toString();else if("string"!=typeof t)throw new Error("XML data is accepted in String or Bytes[] form.");if(e){!0===e&&(e={});const i=l(t,e);if(!0!==i)throw Error(`${i.err.msg}:${i.err.line}:${i.err.col}`)}const i=new Mt(this.options,this.externalEntities),n=i.parseXml(t);return this.options.preserveOrder||void 0===n?n:ne(n,this.options,i.matcher,i.readonlyMatcher)}addEntity(t,e){if(-1!==e.indexOf("&"))throw new Error("Entity value can't have '&'");if(-1!==t.indexOf("&")||-1!==t.indexOf(";"))throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '
'");if("&"===e)throw new Error("An entity with value '&' is not permitted");this.externalEntities[t]=e}static getMetaDataSymbol(){return C.getMetaDataSymbol()}}function ce(t){return"number"==typeof t&&Object.is(t,-0)?"-0":String(t)}function pe(t){return ce(t).replace(/--/g,"- -").replace(/--/g,"- -").replace(/-$/,"- ")}function he(t){return ce(t).replace(/\]\]>/g,"]]]]><![CDATA[>")}function de(t){return ce(t).replace(/"/g,""").replace(/'/g,"'")}function ue(t,e,i,n,r){return i.sanitizeName?r(t)?t:i.sanitizeName(t,{isAttribute:e,matcher:n.readOnly()}):t}function fe(t,e){let i="";e.format&&(i="\n");const n=[];if(e.stopNodes&&Array.isArray(e.stopNodes))for(let t=0;t<e.stopNodes.length;t++){const i=e.stopNodes[t];"string"==typeof i?n.push(new ot(i)):i instanceof ot&&n.push(i)}const r=function(t,e){if(!Array.isArray(t)||0===t.length)return"1.0";const i=t[0];if("?xml"===ye(i)){const t=i[":@"];if(t){const i=e.attributeNamePrefix+"version";if(t[i])return t[i]}}return"1.0"}(t,e),s=q("qName",{xmlVersion:r});return ge(t,e,i,new st,n,s)}function ge(t,e,i,n,r,s){let o="",a=!1;if(e.maxNestedTags&&n.getDepth()>e.maxNestedTags)throw new Error("Maximum nested tags exceeded");if(!Array.isArray(t)){if(null!=t){let i=ce(t);return i=we(i,e),i}return""}for(let l=0;l<t.length;l++){const c=t[l],p=ye(c);if(void 0===p)continue;const h=p===e.textNodeName||p===e.cdataPropName||p===e.commentPropName||"?"===p[0]?p:ue(p,!1,e,n,s),d=me(c[":@"],e);n.push(h,d);const u=Ee(n,r);if(h===e.textNodeName){let t=c[p];u||(t=e.tagValueProcessor(h,t),t=we(t,e)),t=ce(t),a&&(o+=i),o+=t,a=!1,n.pop();continue}if(h===e.cdataPropName){a&&(o+=i),o+=`<![CDATA[${he(c[p][0][e.textNodeName])}]]>`,a=!1,n.pop();continue}if(h===e.commentPropName){o+=i+`\x3c!--${pe(c[p][0][e.textNodeName])}--\x3e`,a=!0,n.pop();continue}if("?"===h[0]){o+=("?xml"===h?"":i)+`<${h}${Ne(c[":@"],e,u,n,s)}?>`,a=!0,n.pop();continue}let f=i;""!==f&&(f+=e.indentBy);const g=i+`<${h}${Ne(c[":@"],e,u,n,s)}`;let m;m=u?xe(c[p],e):ge(c[p],e,f,n,r,s),-1!==e.unpairedTags.indexOf(h)?e.suppressUnpairedNode?o+=g+">":o+=g+"/>":m&&0!==m.length||!e.suppressEmptyNode?m&&m.endsWith(">")?o+=g+`>${m}${i}</${h}>`:(o+=g+">",m&&""!==i&&(m.includes("/>")||m.includes("</"))?o+=i+e.indentBy+m+i:o+=m,o+=`</${h}>`):o+=g+"/>",a=!0,n.pop()}return o}function me(t,e){if(!t||e.ignoreAttributes)return null;const i={};let n=!1;for(let r in t)Object.prototype.hasOwnProperty.call(t,r)&&(i[r.startsWith(e.attributeNamePrefix)?r.substr(e.attributeNamePrefix.length):r]=de(t[r]),n=!0);return n?i:null}function xe(t,e){if(!Array.isArray(t))return null!=t?ce(t):"";let i="";for(let n=0;n<t.length;n++){const r=t[n],s=ye(r);if(s===e.textNodeName)i+=ce(r[s]);else if(s===e.cdataPropName)i+=r[s][0][e.textNodeName];else if(s===e.commentPropName)i+=r[s][0][e.textNodeName];else{if(s&&"?"===s[0])continue;if(s){const t=be(r[":@"],e),n=xe(r[s],e);n&&0!==n.length?i+=`<${s}${t}>${n}</${s}>`:i+=`<${s}${t}/>`}}}return i}function be(t,e){let i="";if(t&&!e.ignoreAttributes)for(let n in t){if(!Object.prototype.hasOwnProperty.call(t,n))continue;let r=t[n];!0===r&&e.suppressBooleanAttributes?i+=` ${n.substr(e.attributeNamePrefix.length)}`:i+=` ${n.substr(e.attributeNamePrefix.length)}="${de(r)}"`}return i}function ye(t){const e=Object.keys(t);for(let i=0;i<e.length;i++){const n=e[i];if(Object.prototype.hasOwnProperty.call(t,n)&&":@"!==n)return n}}function Ne(t,e,i,n,r){let s="";if(t&&!e.ignoreAttributes)for(let o in t){if(!Object.prototype.hasOwnProperty.call(t,o))continue;const a=o.substr(e.attributeNamePrefix.length),l=i?a:ue(a,!0,e,n,r);let c;i?c=t[o]:(c=e.attributeValueProcessor(o,t[o]),c=we(c,e)),!0===c&&e.suppressBooleanAttributes?s+=` ${l}`:s+=` ${l}="${de(c)}"`}return s}function Ee(t,e){if(!e||0===e.length)return!1;for(let i=0;i<e.length;i++)if(t.matches(e[i]))return!0;return!1}function we(t,e){if(t&&t.length>0&&e.processEntities)for(let i=0;i<e.entities.length;i++){const n=e.entities[i];t=t.replace(n.regex,n.val)}return t}const ve={attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,cdataPropName:!1,format:!1,indentBy:" ",suppressEmptyNode:!1,suppressUnpairedNode:!0,suppressBooleanAttributes:!0,tagValueProcessor:function(t,e){return e},attributeValueProcessor:function(t,e){return e},preserveOrder:!1,commentPropName:!1,unpairedTags:[],entities:[{regex:new RegExp("&","g"),val:"&"},{regex:new RegExp(">","g"),val:">"},{regex:new RegExp("<","g"),val:"<"},{regex:new RegExp("'","g"),val:"'"},{regex:new RegExp('"',"g"),val:"""}],processEntities:!0,stopNodes:[],oneListGroup:!1,maxNestedTags:100,jPath:!0,sanitizeName:!1};function Se(t){if(this.options=Object.assign({},ve,t),this.options.stopNodes&&Array.isArray(this.options.stopNodes)&&(this.options.stopNodes=this.options.stopNodes.map(t=>"string"==typeof t&&t.startsWith("*.")?".."+t.substring(2):t)),this.stopNodeExpressions=[],this.options.stopNodes&&Array.isArray(this.options.stopNodes))for(let t=0;t<this.options.stopNodes.length;t++){const e=this.options.stopNodes[t];"string"==typeof e?this.stopNodeExpressions.push(new ot(e)):e instanceof ot&&this.stopNodeExpressions.push(e)}var e;!0===this.options.ignoreAttributes||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.ignoreAttributesFn="function"==typeof(e=this.options.ignoreAttributes)?e:Array.isArray(e)?t=>{for(const i of e){if("string"==typeof i&&t===i)return!0;if(i instanceof RegExp&&i.test(t))return!0}}:()=>!1,this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=Ce),this.processTextOrObjNode=Te,this.options.format?(this.indentate=_e,this.tagEndChar=">\n",this.newLine="\n"):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}function Ae(t,e,i,n,r){return i.sanitizeName?r(t)?t:i.sanitizeName(t,{isAttribute:e,matcher:n.readOnly()}):t}function Te(t,e,i,n,r){const s=this.extractAttributes(t);if(n.push(e,s),this.checkStopNode(n)){const r=this.buildRawContent(t),s=this.buildAttributesForStopNode(t);return n.pop(),this.buildObjectNode(r,e,s,i)}const o=this.j2x(t,i+1,n,r);return n.pop(),"?"===e[0]?this.buildTextValNode("",e,o.attrStr,i,n):void 0!==t[this.options.textNodeName]&&1===Object.keys(t).length?this.buildTextValNode(t[this.options.textNodeName],e,o.attrStr,i,n):this.buildObjectNode(o.val,e,o.attrStr,i)}function _e(t){return this.options.indentBy.repeat(t)}function Ce(t){return!(!t.startsWith(this.options.attributeNamePrefix)||t===this.options.textNodeName)&&t.substr(this.attrPrefixLen)}Se.prototype.build=function(t){if(this.options.preserveOrder)return fe(t,this.options);{Array.isArray(t)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(t={[this.options.arrayNodeName]:t});const e=new st,i=function(t,e){const i=t["?xml"];if(i&&"object"==typeof i){if(e.attributesGroupName&&i[e.attributesGroupName]){const t=i[e.attributesGroupName][e.attributeNamePrefix+"version"];if(t)return t}const t=i[e.attributeNamePrefix+"version"];if(t)return t}return"1.0"}(t,this.options),n=q("qName",{xmlVersion:i});return this.j2x(t,0,e,n).val}},Se.prototype.j2x=function(t,e,i,n){let r="",s="";if(this.options.maxNestedTags&&i.getDepth()>=this.options.maxNestedTags)throw new Error("Maximum nested tags exceeded");const o=this.options.jPath?i.toString():i,a=this.checkStopNode(i);for(let l in t){if(!Object.prototype.hasOwnProperty.call(t,l))continue;const c=l===this.options.textNodeName||l===this.options.cdataPropName||l===this.options.commentPropName||this.options.attributesGroupName&&l===this.options.attributesGroupName||this.isAttribute(l)||"?"===l[0]?l:Ae(l,!1,this.options,i,n);if(void 0===t[l])this.isAttribute(l)&&(s+="");else if(null===t[l])this.isAttribute(l)||c===this.options.cdataPropName||c===this.options.commentPropName?s+="":"?"===c[0]?s+=this.indentate(e)+"<"+c+"?"+this.tagEndChar:s+=this.indentate(e)+"<"+c+"/"+this.tagEndChar;else if(t[l]instanceof Date)s+=this.buildTextValNode(t[l],c,"",e,i);else if("object"!=typeof t[l]){const p=this.isAttribute(l);if(p&&!this.ignoreAttributesFn(p,o)){const e=Ae(p,!0,this.options,i,n);r+=this.buildAttrPairStr(e,ce(t[l]),a)}else if(!p)if(l===this.options.textNodeName){let e=this.options.tagValueProcessor(l,ce(t[l]));s+=this.replaceEntitiesValue(e)}else{i.push(c);const n=this.checkStopNode(i);if(i.pop(),n){const i=ce(t[l]);s+=""===i?this.indentate(e)+"<"+c+this.closeTag(c)+this.tagEndChar:this.indentate(e)+"<"+c+">"+i+"</"+c+this.tagEndChar}else s+=this.buildTextValNode(t[l],c,"",e,i)}}else if(Array.isArray(t[l])){const r=t[l].length;let o="",a="";for(let p=0;p<r;p++){const r=t[l][p];if(void 0===r);else if(null===r)"?"===c[0]?s+=this.indentate(e)+"<"+c+"?"+this.tagEndChar:s+=this.indentate(e)+"<"+c+"/"+this.tagEndChar;else if("object"==typeof r)if(this.options.oneListGroup){i.push(c);const t=this.j2x(r,e+1,i,n);i.pop(),o+=t.val,this.options.attributesGroupName&&r.hasOwnProperty(this.options.attributesGroupName)&&(a+=t.attrStr)}else o+=this.processTextOrObjNode(r,c,e,i,n);else if(this.options.oneListGroup){let t=this.options.tagValueProcessor(c,r);t=this.replaceEntitiesValue(t),t=ce(t),o+=t}else{i.push(c);const t=this.checkStopNode(i);if(i.pop(),t){const t=ce(r);o+=""===t?this.indentate(e)+"<"+c+this.closeTag(c)+this.tagEndChar:this.indentate(e)+"<"+c+">"+t+"</"+c+this.tagEndChar}else o+=this.buildTextValNode(r,c,"",e,i)}}this.options.oneListGroup&&(o=this.buildObjectNode(o,c,a,e)),s+=o}else if(this.options.attributesGroupName&&l===this.options.attributesGroupName){const e=Object.keys(t[l]),s=e.length;for(let o=0;o<s;o++){const s=Ae(e[o],!0,this.options,i,n);r+=this.buildAttrPairStr(s,ce(t[l][e[o]]),a)}}else s+=this.processTextOrObjNode(t[l],c,e,i,n)}return{attrStr:r,val:s}},Se.prototype.buildAttrPairStr=function(t,e,i){return i||(e=this.options.attributeValueProcessor(t,ce(e)),e=this.replaceEntitiesValue(e)),this.options.suppressBooleanAttributes&&"true"===e?" "+t:" "+t+'="'+de(e)+'"'},Se.prototype.extractAttributes=function(t){if(!t||"object"!=typeof t)return null;const e={};let i=!1;if(this.options.attributesGroupName&&t[this.options.attributesGroupName]){const n=t[this.options.attributesGroupName];for(let t in n)Object.prototype.hasOwnProperty.call(n,t)&&(e[t.startsWith(this.options.attributeNamePrefix)?t.substring(this.options.attributeNamePrefix.length):t]=de(n[t]),i=!0)}else for(let n in t){if(!Object.prototype.hasOwnProperty.call(t,n))continue;const r=this.isAttribute(n);r&&(e[r]=de(t[n]),i=!0)}return i?e:null},Se.prototype.buildRawContent=function(t){if("string"==typeof t)return t;if("object"!=typeof t||null===t)return String(t);if(void 0!==t[this.options.textNodeName])return t[this.options.textNodeName];let e="";for(let i in t){if(!Object.prototype.hasOwnProperty.call(t,i))continue;if(this.isAttribute(i))continue;if(this.options.attributesGroupName&&i===this.options.attributesGroupName)continue;const n=t[i];if(i===this.options.textNodeName)e+=n;else if(Array.isArray(n)){for(let t of n)if("string"==typeof t||"number"==typeof t)e+=`<${i}>${t}</${i}>`;else if("object"==typeof t&&null!==t){const n=this.buildRawContent(t),r=this.buildAttributesForStopNode(t);e+=""===n?`<${i}${r}/>`:`<${i}${r}>${n}</${i}>`}}else if("object"==typeof n&&null!==n){const t=this.buildRawContent(n),r=this.buildAttributesForStopNode(n);e+=""===t?`<${i}${r}/>`:`<${i}${r}>${t}</${i}>`}else e+=`<${i}>${n}</${i}>`}return e},Se.prototype.buildAttributesForStopNode=function(t){if(!t||"object"!=typeof t)return"";let e="";if(this.options.attributesGroupName&&t[this.options.attributesGroupName]){const i=t[this.options.attributesGroupName];for(let t in i){if(!Object.prototype.hasOwnProperty.call(i,t))continue;const n=t.startsWith(this.options.attributeNamePrefix)?t.substring(this.options.attributeNamePrefix.length):t,r=i[t];!0===r&&this.options.suppressBooleanAttributes?e+=" "+n:e+=" "+n+'="'+de(r)+'"'}}else for(let i in t){if(!Object.prototype.hasOwnProperty.call(t,i))continue;const n=this.isAttribute(i);if(n){const r=t[i];!0===r&&this.options.suppressBooleanAttributes?e+=" "+n:e+=" "+n+'="'+de(r)+'"'}}return e},Se.prototype.buildObjectNode=function(t,e,i,n){if(""===t)return"?"===e[0]?this.indentate(n)+"<"+e+i+"?"+this.tagEndChar:this.indentate(n)+"<"+e+i+this.closeTag(e)+this.tagEndChar;if("?"===e[0])return this.indentate(n)+"<"+e+i+"?"+this.tagEndChar;{let r="</"+e+this.tagEndChar,s="";return"?"===e[0]&&(s="?",r=""),!i&&""!==i||-1!==t.indexOf("<")?!1!==this.options.commentPropName&&e===this.options.commentPropName&&0===s.length?this.indentate(n)+`\x3c!--${pe(t)}--\x3e`+this.newLine:this.indentate(n)+"<"+e+i+s+this.tagEndChar+t+this.indentate(n)+r:this.indentate(n)+"<"+e+i+s+">"+t+r}},Se.prototype.closeTag=function(t){let e="";return-1!==this.options.unpairedTags.indexOf(t)?this.options.suppressUnpairedNode||(e="/"):e=this.options.suppressEmptyNode?"/":`></${t}`,e},Se.prototype.checkStopNode=function(t){if(!this.stopNodeExpressions||0===this.stopNodeExpressions.length)return!1;for(let e=0;e<this.stopNodeExpressions.length;e++)if(t.matches(this.stopNodeExpressions[e]))return!0;return!1},Se.prototype.buildTextValNode=function(t,e,i,n,r){if(!1!==this.options.cdataPropName&&e===this.options.cdataPropName){const e=he(t);return this.indentate(n)+`<![CDATA[${e}]]>`+this.newLine}if(!1!==this.options.commentPropName&&e===this.options.commentPropName){const e=pe(t);return this.indentate(n)+`\x3c!--${e}--\x3e`+this.newLine}if("?"===e[0])return this.indentate(n)+"<"+e+i+"?"+this.tagEndChar;{let r=this.options.tagValueProcessor(e,t);return r=this.replaceEntitiesValue(r),r=ce(r),""===r?this.indentate(n)+"<"+e+i+this.closeTag(e)+this.tagEndChar:this.indentate(n)+"<"+e+i+">"+r+"</"+e+this.tagEndChar}},Se.prototype.replaceEntitiesValue=function(t){if(t&&t.length>0&&this.options.processEntities)for(let e=0;e<this.options.entities.length;e++){const i=this.options.entities[e];t=t.replace(i.regex,i.val)}return t};const Oe=Se,$e={validate:l};module.exports=e})();
|
|
143366
144831
|
|
|
143367
144832
|
/***/ },
|
|
143368
144833
|
|
|
@@ -143373,8 +144838,8 @@ module.exports = require("url");
|
|
|
143373
144838
|
(__unused_webpack_module, exports, __webpack_require__) {
|
|
143374
144839
|
|
|
143375
144840
|
"use strict";
|
|
143376
|
-
var x=(n,t)=>()=>{try{return t||n((t={exports:{}}).exports,t),t.exports}catch(e){throw t=0,e}};var ls=x(tt=>{"use strict";Object.defineProperty(tt,"__esModule",{value:!0});tt.range=tt.balanced=void 0;var di=(n,t,e)=>{let s=n instanceof RegExp?as(n,e):n,i=t instanceof RegExp?as(t,e):t,r=s!==null&&i!=null&&(0,tt.range)(s,i,e);return r&&{start:r[0],end:r[1],pre:e.slice(0,r[0]),body:e.slice(r[0]+s.length,r[1]),post:e.slice(r[1]+i.length)}};tt.balanced=di;var as=(n,t)=>{let e=t.match(n);return e?e[0]:null},pi=(n,t,e)=>{let s,i,r,h,a,o=e.indexOf(n),l=e.indexOf(t,o+1),c=o;if(o>=0&&l>0){if(n===t)return[o,l];for(s=[],r=e.length;c>=0&&!a;){if(c===o)s.push(c),o=e.indexOf(n,c+1);else if(s.length===1){let u=s.pop();u!==void 0&&(a=[u,l])}else i=s.pop(),i!==void 0&&i<r&&(r=i,h=l),l=e.indexOf(t,c+1);c=o<l&&o>=0?o:l}s.length&&h!==void 0&&(a=[r,h])}return a};tt.range=pi});var ms=x(T=>{"use strict";Object.defineProperty(T,"__esModule",{value:!0});T.EXPANSION_MAX_REWRITES=T.EXPANSION_MAX_DEPTH=T.EXPANSION_MAX_LENGTH=T.EXPANSION_MAX=void 0;T.expand=Mi;var cs=ls(),us="\0SLASH"+Math.random()+"\0",fs="\0OPEN"+Math.random()+"\0",ve="\0CLOSE"+Math.random()+"\0",ds="\0COMMA"+Math.random()+"\0",ps="\0PERIOD"+Math.random()+"\0",mi=new RegExp(us,"g"),gi=new RegExp(fs,"g"),wi=new RegExp(ve,"g"),bi=new RegExp(ds,"g"),yi=new RegExp(ps,"g"),Si=/\\\\/g,vi=/\\{/g,_i=/\\}/g,Ei=/\\,/g,Oi=/\\\./g;T.EXPANSION_MAX=1e5;T.EXPANSION_MAX_LENGTH=4e6;T.EXPANSION_MAX_DEPTH=1e3;T.EXPANSION_MAX_REWRITES=1e3;function be(n){return isNaN(n)?n.charCodeAt(0):parseInt(n,10)}function Ci(n){return n.replace(Si,us).replace(vi,fs).replace(_i,ve).replace(Ei,ds).replace(Oi,ps)}function Ai(n){return n.replace(mi,"\\").replace(gi,"{").replace(wi,"}").replace(bi,",").replace(yi,".")}function ye(n,t){for(let e=0;e<t.length;e++)n.push(t[e])}function ki(n){let t=[],e="";for(;;){let s=(0,cs.balanced)("{","}",n);if(!s){let o=n.split(",");return o[0]=e+o[0],ye(t,o),t}let{pre:i,body:r,post:h}=s,a=i.split(",");if(a[0]=e+a[0],a[a.length-1]+="{"+r+"}",!h.length)return ye(t,a),t;e=a.pop(),ye(t,a),n=h}}function Mi(n,t={}){if(!n)return[];let{max:e=T.EXPANSION_MAX,maxLength:s=T.EXPANSION_MAX_LENGTH,maxDepth:i=T.EXPANSION_MAX_DEPTH,maxRewrites:r=T.EXPANSION_MAX_REWRITES}=t;return n.slice(0,2)==="{}"&&(n="\\{\\}"+n.slice(2)),Se(Ci(n),e,s,i,0,r,!0).map(Ai)}function xi(n){return"{"+n+"}"}function Ri(n){return/^-?0\d/.test(n)}function Pi(n,t){return n<=t}function Ti(n,t){return n>=t}function lt(n,t,e,s,i,r){let h=[],a=0;for(let o=0;o<n.length;o++)for(let l=0;l<e.length;l++){if(h.length>=s)return h;let c=n[o]+t+e[l];if(!(r&&!c)){if(a+c.length>i)return h;h.push(c),a+=c.length}}return h}function Fi(n,t,e,s){let i=n.split(/\.\./),r=[];if(i[0]===void 0||i[1]===void 0)return r;let h=be(i[0]),a=be(i[1]),o=Math.max(i[0].length,i[1].length),l=i.length===3&&i[2]!==void 0?Math.max(Math.abs(be(i[2])),1):1,c=Pi;a<h&&(l*=-1,c=Ti);let p=i.some(Ri),d=0;for(let g=h;c(g,a)&&r.length<e;g+=l){let f;if(t)f=String.fromCharCode(g),f==="\\"&&(f="");else if(f=String(g),p){let b=o-f.length;if(b>0){let m=new Array(b+1).join("0");g<0?f="-"+m+f.slice(1):f=m+f}}if(d+f.length>s)break;r.push(f),d+=f.length}return r}function Se(n,t,e,s,i,r,h){if(i>s)return[n];let a=[""],o=0,l=!1,c=!0;for(;;){let u=(0,cs.balanced)("{","}",n);if(!u)return lt(a,n,[""],t,e,l);let p=u.pre;if(/\$$/.test(p)){if(a=lt(a,p+"{"+u.body+"}",[""],t,e,l&&!u.post.length),c=!1,!u.post.length)break;n=u.post;continue}let d=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(u.body),g=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(u.body),f=d||g,b=u.body.indexOf(",")>=0;if(!f&&!b){if(o<r&&u.post.match(/,(?!,).*\}/)){o++,n=u.pre+"{"+u.body+ve+u.post,h=!0;continue}return lt(a,p+"{"+u.body+"}"+u.post,[""],t,e,l)}c&&(l=h&&!f,c=!1);let m;if(f)m=Fi(u.body,g,t,e);else{let y=ki(u.body);if(y.length===1&&y[0]!==void 0&&(y=Se(y[0],t,e,s,i+1,r,!1).map(xi),y.length===1)){if(a=lt(a,p+y[0],[""],t,e,l&&!u.post.length),!u.post.length)break;n=u.post;continue}let _=l&&!u.post.length&&!p;for(let S=0;_&&S<a.length;S++)a[S]&&(_=!1);m=[];let v=0;t:for(let S=0;S<y.length;S++){let K=Se(y[S],t,e,s,i+1,r,!1);for(let z=0;z<K.length;z++){let $=K[z];if(!(_&&!$)){if(m.length>=t||v+$.length>e)break t;m.push($),v+=$.length}}}}if(a=lt(a,p,m,t,e,l&&!u.post.length),!u.post.length)break;n=u.post}return a}});var gs=x(Tt=>{"use strict";Object.defineProperty(Tt,"__esModule",{value:!0});Tt.parseClass=void 0;var ji={"[:alnum:]":["\\p{L}\\p{Nl}\\p{Nd}"],"[:alpha:]":["\\p{L}\\p{Nl}"],"[:ascii:]":["\\x00-\\x7f"],"[:blank:]":["\\p{Zs}\\t"],"[:cntrl:]":["\\p{Cc}"],"[:digit:]":["\\p{Nd}"],"[:graph:]":["\\p{Z}\\p{C}",!0],"[:lower:]":["\\p{Ll}"],"[:print:]":["\\p{C}",!0],"[:punct:]":["\\p{P}\\p{S}"],"[:space:]":["\\p{Z}\\t\\r\\n\\v\\f"],"[:upper:]":["\\p{Lu}"],"[:word:]":["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}"],"[:xdigit:]":["A-Fa-f0-9"]},ct=n=>n.replace(/[[\]\\-]/g,"\\$&"),_e=/$./,Di=(n,t,e=!1,s)=>{let i=m=>{let y=s?m.normalize(s):m;return[...y].length===1?y:m},r=t;if(n.charAt(r)!=="[")throw new Error("not in a brace expression");let h=[],a=[],o=r+1,l=!1,c=!1,u=!1,p=r,d="";t:for(;o<n.length;){let m=String.fromCodePoint(n.codePointAt(o));if((m==="!"||m==="^")&&o===r+1){u=!0,o++;continue}if(m==="]"&&l&&!c){p=o+1;break}if(l=!0,m==="\\"&&!c){c=!0,o++;continue}if(m==="["&&!c){for(let[_,[v,S]]of Object.entries(ji))if(n.startsWith(_,o)){if(d)return[_e,n.length-r];o+=_.length,S?a.push(v):h.push(v);continue t}}c=!1;let y=i(m);if(d){y.codePointAt(0)>d.codePointAt(0)?h.push(ct(d)+"-"+ct(y)):y===d&&h.push(ct(y)),d="",o+=m.length;continue}if(n.startsWith("-]",o+m.length)){h.push(ct(y+"-")),o+=m.length+1;continue}if(n.startsWith("-",o+m.length)){d=y,o+=m.length+1;continue}h.push(ct(y)),o+=m.length}if(p<o)return[_e,0];if(!h.length&&!a.length)return[_e,n.length-r];let g="["+(u?"^":"")+h.join("")+"]",f="["+(u?"":"^")+a.join("")+"]",b="^"+(h.length&&a.length?"("+g+"|"+f+")":h.length?g:f);return[new RegExp(b,e?"iu":"u"),p-r]};Tt.parseClass=Di});var Cs=x(jt=>{"use strict";Object.defineProperty(jt,"__esModule",{value:!0});jt.Matcher=void 0;var Ni=gs(),Ee={t:"match",id:0},Li="!?+*@",et=n=>({t:"lit",ch:n}),Wi=n=>n.replace(/[\\^$.*+?()[\]{}|/]/g,"\\$&"),Oe=n=>new RegExp(`^${Wi(n)}$`,"iu"),Me=(n,t)=>{if(t===n.ch)return!0;if(!n.re)return!1;let e=t.charCodeAt(0);if(e>=128)return n.re.test(t);let s=n.ascii??=new Uint8Array(128);return s[e]||=n.re.test(t)?1:2,s[e]===1},Bi=(n,t,e,s)=>{let i=[];for(let r=0;r<n.length;){let h=String.fromCodePoint(n.codePointAt(r));if(h==="\\"){let a=n.codePointAt(r+1),o=a===void 0?h:String.fromCodePoint(a);i.push(et(o)),r+=1+o.length;continue}if(h==="["){let[a,o]=(0,Ni.parseClass)(n,r,t,s);if(o){i.push({t:"class",re:a}),r+=o;continue}}if(!e&&Li.includes(h)&&n[r+1]==="("){i.push({t:"open",type:h}),r+=2;continue}i.push(!e&&h==="|"?{t:"bar"}:!e&&h===")"?{t:"close"}:h==="*"?{t:"star"}:h==="?"?{t:"any"}:et(h)),r+=h.length}return i},zi=n=>{let t=new Map,e=[];return n.forEach((s,i)=>{s.t==="open"?e.push(i):s.t==="close"&&e.length&&t.set(e.pop(),i)}),t},Ss=(n,t,e,s,i)=>{let r=[],h=[r];for(let a=e;a<s;a++){let o=n[a],l=t.get(a);if(o.t==="open"&&l!==void 0){let c=Ss(n,t,a+1,l,!1);r.push({t:"ext",type:o.type,alts:c}),a=l}else o.t==="bar"&&!i?h.push(r=[]):o.t==="open"?r.push(et(o.type),et("(")):o.t==="bar"?r.push(et("|")):o.t==="close"?r.push(et(")")):r.push(o)}return h},vs=(n,t)=>{let e=[],s="",i=()=>{for(let r of s.normalize(t))e.push(et(r));s=""};for(let r of n){if(r.t==="lit"){s+=r.ch;continue}i(),e.push(r.t==="ext"?{...r,alts:r.alts.map(h=>vs(h,t))}:r)}return i(),e},Gi=(n,t)=>{let e=1,s=a=>({t:"split",id:e++,out:a}),i=(a,o)=>a.reduceRight((l,c)=>r(c,l),o),r=(a,o)=>{switch(a.t){case"lit":let p=t?Oe(a.ch):void 0;return{t:"lit",id:e++,ch:a.ch,re:p,next:o};case"any":case"star":return{t:a.t,id:e++,next:o};case"class":return{t:"class",id:e++,re:a.re,next:o}}let l=p=>a.alts.map(d=>i(d,p));switch(a.type){case"@":return s(l(o));case"?":return s([o,...l(o)]);case"!":return{t:"neg",id:e++,sub:s(l(Ee)),next:o}}let c=s([]),u=s(l(c));return c.out.push(o,u),a.type==="*"?c:u};return[i(n,Ee),e]},Ii=n=>{let t=[],e=new Set,s=r=>r.t==="match"?"match":String(r.id),i=(r,h)=>{if(r.t==="match"||e.has(r))return;e.add(r);let a=o=>t.push(`${h}${r.id}: ${o}`);switch(r.t){case"split":a(`split -> ${r.out.map(s).join(", ")}`);for(let o of r.out)i(o,h);return;case"neg":return a(`!(${s(r.sub)}) -> ${s(r.next)}`),i(r.sub,h+" "),i(r.next,h);case"lit":a(`${JSON.stringify(r.ch)} -> ${s(r.next)}`);break;case"class":a(`${r.re} -> ${s(r.next)}`);break;default:a(`${r.t==="any"?"?":"*"} -> ${s(r.next)}`)}i(r.next,h)};return i(n,""),[`start -> ${s(n)}`,...t].join(`
|
|
143377
|
-
`)},Ce=class{gen;threads=[];match=!1;runs=[];ids=[];constructor(t){this.gen=t}get dead(){return!this.threads.length&&!this.match&&!this.runs.length}},_s=(n,t)=>n.ids.length!==t.ids.length||n.runs.length!==t.runs.length||n.ids.some((e,s)=>e!==t.ids[s])?!1:n.runs.every(e=>t.runs.some(s=>s.neg===e.neg&&_s(s.state,e.state))),ws=n=>({has:new Float64Array(n),seen:new Float64Array(n),gen:0}),ut=class{dots;dotStart;#t;constructor(t,e,s){this.dots=t,this.dotStart=e,this.#t=s}state(){return new Ce(++this.#t.gen)}done(t){return t.ids=t.threads.map(e=>e.id).sort((e,s)=>e-s),t.match&&t.ids.unshift(Ee.id),t}#i(t,e){let{seen:s}=this.#t;return s[e.id]===t.gen?!1:(s[e.id]=t.gen,!0)}#e(t,e){let{has:s}=this.#t;return s[e.id]===t.gen?!1:(s[e.id]=t.gen,t.threads.push(e),!0)}restricted(t,e){return e&&(this.dots||this.dotStart&&t===0)}add(t,e,s,i){switch(e.t){case"split":if(!this.#i(t,e))return;for(let h of e.out)this.add(t,h,s,i);return;case"neg":if(!this.#i(t,e))return;let r=this.state();return this.add(r,e.sub,s,!1),this.done(r),this.addRun(t,{t:"run",neg:e,state:r},s,i);case"star":if(this.restricted(s,i))return;this.#e(t,e)&&this.add(t,e.next,s,i);return;case"match":t.match=!0;return;default:this.#e(t,e)}}addRun(t,e,s,i){for(let r of t.runs)if(r.neg===e.neg&&_s(r.state,e.state))return;t.runs.push(e),e.state.match||this.add(t,e.neg.next,s,i)}step(t,e,s,i){let r=this.state();for(let h of t.threads)switch(h.t){case"lit":Me(h,e)&&this.add(r,h.next,s+1,i);break;case"any":this.restricted(s,i)||this.add(r,h.next,s+1,i);break;case"class":!this.restricted(s,i)&&h.re.test(e)&&this.add(r,h.next,s+1,i);break;case"star":this.restricted(s,i)||this.add(r,h,s+1,i)}if(!this.restricted(s,i))for(let h of t.runs){if(h.state.dead){this.addRun(r,h,s+1,i);continue}let a=this.step(h.state,e,s,!1);this.addRun(r,{t:"run",neg:h.neg,state:a},s+1,i)}return this.done(r)}},Es=n=>{let t=n.ids.join();if(!n.runs.length)return t;let e=n.runs.map(s=>`${s.neg.id}(${Es(s.state)})`);return`${t}|${e.sort().join("|")}`},Ui=1<<18,Ae=class{#t;#i=new Map;#e=0;#h;#n;#d;#c;constructor(t,e){this.#t=t,this.#d=new ut(!1,!1,e),this.#c=new ut(!1,!0,e)}#p(t){return{state:t,match:t.match,dead:t.dead,next:new Map}}#o(t){let e=Es(t),s=this.#i.get(e);if(s)return s;this.#e>Ui&&this.#m();let i=this.#p(t);return this.#i.set(e,i),this.#e+=e.length+1,i}#m(){this.#i.clear(),this.#e=0,this.#h=void 0,this.#n=void 0}start(t){if(t){if(this.#n)return this.#n;let s=this.#c.state();return this.#c.add(s,this.#t,0,!0),this.#n=this.#p(this.#c.done(s))}if(this.#h)return this.#h;let e=this.#d.state();return this.#d.add(e,this.#t,0,!0),this.#h=this.#o(this.#d.done(e))}next(t,e){let s=e.charCodeAt(0),i=s<128?void 0:t.next.get(e);if(i)return i;let r=t===this.#n?this.#o(this.#c.step(t.state,e,0,!0)):this.#o(this.#d.step(t.state,e,1,!0));return s<128?(t.ascii||(t.ascii=new Array(128),this.#e+=128),t.ascii[s]=r):t.next.set(e,r),this.#e++,r}},$i=n=>{let t=[];for(let e=n;e.t!=="match";e=e.next){if(e.t==="split"||e.t==="neg")return;t.push(e)}return t},qi=(n,t,e,s)=>{let i=0,r=e,h=-1,a=0;for(;r<s;){let o=n[i];if(o?.t==="star"){h=i++,a=r;continue}let l=t[r];if(o&&(o.t==="any"||o.t==="lit"&&Me(o,l)||o.t==="class"&&o.re.test(l))){i++,r++;continue}if(h===-1)return!1;i=h+1,r=++a}for(;n[i]?.t==="star";)i++;return i===n.length},Os=n=>{let t=0,e=0;for(let s of n){let[i,r]=Hi(s);t+=i,e+=r}return[t,e]},Hi=n=>{if(n.t==="star")return[0,1/0];if(n.t!=="ext")return[1,1];if(n.type==="!")return[0,1/0];let t=n.alts.map(Os),e=Math.min(...t.map(r=>r[0])),s=Math.max(...t.map(r=>r[1])),i=s===0?0:1/0;return n.type==="@"?[e,s]:n.type==="?"?[0,s]:n.type==="*"?[0,i]:[e,i]},bs=(n,t,e)=>{for(let s=0;s<n.length;s++)if(!Me(n[s],t[e+s]))return!1;return!0},Xi=/[/\ud800-\udfff]/,Ki=/[\ud800-\udfff]/,Ft=n=>Ki.test(n)?[...n]:n,ys=n=>{if(n.includes("/"))throw new Error("can only match a single path portion, got: "+n)},ke=class{pattern;options;#t;#i;#e;#h;#n;#d;#c;#p=!1;#o=0;#m=1/0;#a=[];#l=[];#r;#w;#_=!1;#b;#u;constructor(t,e={}){if(t.includes("/"))throw new Error("can only match a single path portion, got pattern: "+t);this.pattern=t,this.options=e;let{nocase:s=!1,noext:i=!1,normalize:r}=e;this.#u=r===!0?"NFC":r||void 0;let h=/^[?*+@]\(\)$/.test(t),a=Bi(t,s,i||h,this.#u),[o]=Ss(a,zi(a),0,a.length,!0);this.#u&&(o=vs(o,this.#u));let[l,c]=Gi(o,s);if(this.#t=l,this.#i=c,o.every(u=>u.t==="lit"))this.#n=o.map(u=>u.ch).join(""),s&&(this.#d=Oe(this.#n));else{let u=g=>g.t!=="lit"?void 0:s?{ch:g.ch,re:Oe(g.ch)}:{ch:g.ch};for(let g of o){let f=u(g);if(!f)break;this.#a.push(f)}for(let g=o.length-1;g>=0;g--){let f=u(o[g]);if(!f)break;this.#l.unshift(f)}this.#_=!!(this.#a.length||this.#l.length),s||(this.#r=this.#a.map(g=>g.ch).join(""),this.#w=this.#l.map(g=>g.ch).join("")),this.#c=$i(this.#t)?.slice(this.#a.length,-this.#l.length||void 0),this.#p=!!this.#c?.every(g=>g.t==="star"||g.t==="any");let[p,d]=Os(o);this.#o=p,this.#m=d}}test(t){return this.#u?(ys(t),this.#v(t.normalize(this.#u))):Xi.test(t)?(ys(t),this.#v(t,[...t])):this.#v(t,t)}testUnchecked(t){return this.#v(this.#u?t.normalize(this.#u):t)}#v(t,e){if(this.#n!==void 0)return this.#d?this.#d.test(t):t===this.#n;let s=this.#o,i=this.#m;if(e===void 0){let c=t.length,u=c+1>>1;if(c<s||u>i)return!1;(u<s||c>i)&&(e=Ft(t))}if(e!==void 0&&(e.length<s||e.length>i))return!1;let r=this.#a.length;if(this.#_)if(this.#r!==void 0&&this.#w!==void 0){if(!t.startsWith(this.#r)||!t.endsWith(this.#w))return!1}else{e??=Ft(t);let c=e.length-this.#l.length;if(!bs(this.#a,e,0)||!bs(this.#l,e,c))return!1}let h=!this.options.dot&&t.startsWith(".");if(this.#c){if(t==="."||t===".."||h&&!r)return!1;if(this.#p)return!0;e??=Ft(t);let c=e.length-this.#l.length;return qi(this.#c,e,r,c)}if(e??=Ft(t),t==="."||t===".."){this.#e??=ws(this.#i);let c=this.#h??=new ut(!0,!1,this.#e),u=c.state();c.add(u,this.#t,0,!0);let p=c.done(u);for(let d=0;d<e.length;d++)p=c.step(p,e[d],d,!0);return p.match}this.#e??=ws(this.#i);let a=this.#b??=new Ae(this.#t,this.#e),o=a.start(h),l=e===t;for(let c=0;c<e.length;c++){if(o.dead)return!1;let u=l?t.charCodeAt(c):e[c].charCodeAt(0);o=o.ascii?.[u]??a.next(o,e[c])}return o.match}toString(){return Ii(this.#t)}};jt.Matcher=ke});var As=x(Dt=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:!0});Dt.assertValidPattern=void 0;var Vi=1024*64,Yi=n=>{if(typeof n!="string")throw new TypeError("invalid pattern");if(n.length>Vi)throw new TypeError("pattern is too long")};Dt.assertValidPattern=Yi});var xe=x(Nt=>{"use strict";Object.defineProperty(Nt,"__esModule",{value:!0});Nt.escape=void 0;var Zi=(n,{windowsPathsNoEscape:t=!1,magicalBraces:e=!1}={})=>e?t?n.replace(/[?*()[\]{}]/g,"[$&]"):n.replace(/[?*()[\]\\{}]/g,"\\$&"):t?n.replace(/[?*()[\]]/g,"[$&]"):n.replace(/[?*()[\]\\]/g,"\\$&");Nt.escape=Zi});var Re=x(Lt=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:!0});Lt.unescape=void 0;var Ji=(n,{windowsPathsNoEscape:t=!1,magicalBraces:e=!0}={})=>e?t?n.replace(/\[([^/\\])\]/g,"$1"):n.replace(/((?!\\).|^)\[([^/\\])\]/g,"$1$2").replace(/\\([^/])/g,"$1"):t?n.replace(/\[([^/\\{}])\]/g,"$1"):n.replace(/((?!\\).|^)\[([^/\\{}])\]/g,"$1$2").replace(/\\([^/{}])/g,"$1");Lt.unescape=Ji});var Y=x(w=>{"use strict";Object.defineProperty(w,"__esModule",{value:!0});w.unescape=w.escape=w.Minimatch=w.match=w.braceExpand=w.defaults=w.filter=w.GLOBSTAR=w.sep=w.minimatch=void 0;var Qi=ms(),ks=Cs(),zt=As(),tr=xe(),er=Re(),sr=(n,t,e={})=>((0,zt.assertValidPattern)(t),!e.nocomment&&t.charAt(0)==="#"?!1:new ht(t,e).match(n));w.minimatch=sr;var Fs=typeof process=="object"&&process?process.env?.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",Ms={win32:{sep:"\\"},posix:{sep:"/"}};w.sep=Fs==="win32"?Ms.win32.sep:Ms.posix.sep;w.minimatch.sep=w.sep;w.GLOBSTAR=Symbol("globstar **");w.minimatch.GLOBSTAR=w.GLOBSTAR;var ir=(n,t={})=>e=>(0,w.minimatch)(e,n,t);w.filter=ir;w.minimatch.filter=w.filter;var q=(n,t={})=>Object.assign({},n,t),rr=n=>{if(!n||typeof n!="object"||!Object.keys(n).length)return w.minimatch;let t=w.minimatch;return Object.assign((s,i,r={})=>t(s,i,q(n,r)),{Minimatch:class extends t.Minimatch{constructor(i,r={}){super(i,q(n,r))}static defaults(i){return t.defaults(q(n,i)).Minimatch}},unescape:(s,i={})=>t.unescape(s,q(n,i)),escape:(s,i={})=>t.escape(s,q(n,i)),filter:(s,i={})=>t.filter(s,q(n,i)),defaults:s=>t.defaults(q(n,s)),braceExpand:(s,i={})=>t.braceExpand(s,q(n,i)),match:(s,i,r={})=>t.match(s,i,q(n,r)),sep:t.sep,GLOBSTAR:w.GLOBSTAR})};w.defaults=rr;w.minimatch.defaults=w.defaults;var nr=(n,t={})=>((0,zt.assertValidPattern)(n),t.nobrace||!/\{(?:(?!\{).)*\}/.test(n)?[n]:(0,Qi.expand)(n,{max:t.braceExpandMax}));w.braceExpand=nr;w.minimatch.braceExpand=w.braceExpand;var hr=(n,t,e={})=>{let s=new ht(t,e);return n=n.filter(i=>s.match(i)),s.options.nonull&&!n.length&&n.push(t),n};w.match=hr;w.minimatch.match=w.match;var xs=/[?*]|[+@!]\(.*?\)|\[|\]/,js=(n,t)=>{let e=t+1;(n.charAt(e)==="!"||n.charAt(e)==="^")&&e++;let s=!1;for(;e<n.length;e++){let i=n.charAt(e);if(i==="]"&&s)return e;s=!0,i==="\\"&&e++}return-1},or=(n,t)=>{if(!t&&(n==="+()"||n==="@()"))return n;let e="";for(let s=0;s<n.length;s++){let i=n.charAt(s);if(i==="\\")e+=n.charAt(++s)||i;else{if(i==="*"||i==="?")return;if(i==="["){let r=js(n,s);if(r===-1){e+=i;continue}let h=n.slice(s+1,r);if(h.startsWith("\\")&&(h=h.slice(1)),[...h].length!==1||"!^".includes(n.charAt(s+1)))return;e+=h,s=r}else{if(!t&&"+@!".includes(i)&&n.charAt(s+1)==="("&&n.includes(")",s+2))return;e+=i}}}return e},ar=n=>{if(/^[?*+@]\(\)$/.test(n)||n.includes("[:"))return!1;let t=0;for(let e=0;e<n.length;e++){let s=n.charAt(e);if(s==="\\"){if(++e===n.length)return!1}else if(s==="["){let i=js(n,e);i!==-1&&(e=i)}else if("+@!?*".includes(s)&&n.charAt(e+1)==="(")t++,e++;else if(s===")"){if(!t--)return!1}else if(s==="|"&&!t)return!1}return!t},Pe,Rs,V=(n,t)=>typeof n=="string"?t===n:t!==""&&n.testUnchecked(t),Ps=(n,t,e,s,i)=>V(n,t)?e:s!==void 0&&V(n,s)?i:-1,je=n=>n==="."||n==="..",Te=n=>typeof n=="string"&&/^[a-z]:$/i.test(n),Bt=n=>typeof n=="string"&&/^unc$/i.test(n),Fe=n=>{if(n[0]!==""||n[1]!=="")return-1;let t=n[2]!=="?"?2:Bt(n[3])?4:-1,e=n[t],s=n[t+1];return t!==-1&&e!==void 0&&e!==""&&e!==w.GLOBSTAR&&s!==void 0&&s!==""&&s!==w.GLOBSTAR?t:-1},Wt=(n,t)=>!je(n)&&(t||!n.startsWith(".")),ft=(n,t,e,s,i)=>{for(let r=t;r<e;){if(n.charCodeAt(r)===46){if(!s)return!0;let a=n.charCodeAt(r+1)===46?r+2:r+1;if(a>=e||Gt(n.charCodeAt(a),i))return!0}let h=De(n,r,i);if(h===-1)return!1;for(r=h+1;r<e&&Gt(n.charCodeAt(r),i);)r++}return!1},Gt=(n,t)=>t==="/"?n===47:t==="\\"?n===92:n===47||n===92,De=(n,t,e)=>{if(e!=="both")return n.indexOf(e,t);let s=n.indexOf("/",t),i=n.indexOf("\\",t);return s===-1?i:i===-1?s:Math.min(s,i)},Ts=(n,t,e)=>e!=="both"?n.lastIndexOf(e,t):Math.max(n.lastIndexOf("/",t),n.lastIndexOf("\\",t)),ht=class{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;maxGlobstarRecursion;#t;#i;#e;#h;#n=[];#d=[];#c=[];#p=new Map;#o=new WeakMap;constructor(t,e={}){(0,zt.assertValidPattern)(t),e=e||{},this.options=e,this.maxGlobstarRecursion=e.maxGlobstarRecursion??200,this.pattern=t,this.platform=e.platform||Fs,this.isWindows=this.platform==="win32";let s="allowWindowsEscape";this.windowsPathsNoEscape=!!e.windowsPathsNoEscape||e[s]===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!e.preserveMultipleSlashes,this.negate=!1,this.nonegate=!!e.nonegate,this.comment=!1,this.empty=!1,this.partial=!!e.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=e.windowsNoMagicRoot!==void 0?e.windowsNoMagicRoot:!!(this.isWindows&&this.nocase),this.globSet=[],this.globParts=[],this.set=[],this.#t=!this.preserveMultipleSlashes,this.#e=(e.optimizationLevel??1)>=2;let i=e.normalize;this.#h=i===!0?"NFC":i||void 0,this.make();let r=this.set.map(h=>this.#a(h));this.#c=this.set.map((h,a)=>this.#t&&h.length-1>r[a]),this.#n=this.set.map((h,a)=>{let o=this.#c[a]?h.length-1:h.length,l=h.slice(r[a]+1,o).filter(c=>typeof c=="string"&&!!c);return[...new Set(l)]}),this.#i=this.#n.some(h=>h.length),this.#d=this.set.map((h,a)=>{let[o,l,c]=h;if(this.#c[a]&&h.length===2&&o===w.GLOBSTAR&&l!==w.GLOBSTAR)return"tail";if(this.#c[a]&&e.matchBase&&h.length===1&&o!==w.GLOBSTAR&&o!=="")return"base";if(!(!this.#t||r[a]!==-1)){if(h.length===3&&o===w.GLOBSTAR&&c===w.GLOBSTAR&&l!==w.GLOBSTAR&&l!==""&&this.maxGlobstarRecursion>0)return"mid";if(h.length===2&&l===w.GLOBSTAR&&o!==w.GLOBSTAR&&o!=="")return"head"}})}#m(t){return this.#h?t.normalize(this.#h):t}#a(t){if(!this.isWindows)return-1;if(Te(t[0]))return 0;if(t[0]===""&&t[1]===""&&t[2]==="?"&&Te(t[3]))return 3;let s=Fe(t);return s===-1?-1:s+1}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let t of this.set)for(let e of t)if(typeof e!="string")return!0;return!1}make(){let t=this.pattern,e=this.options;if(!e.nocomment&&t.charAt(0)==="#"){this.comment=!0;return}if(!t){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())];let s=this.globSet.map(r=>this.#S(r));this.globParts=this.preprocess(s);let i=this.globParts.map((r,h,a)=>{if(this.isWindows&&this.windowsNoMagicRoot){let o=r[2]==="?"&&Bt(r[3])?6:4,l=r[0]===""&&r[1]===""&&(r[2]==="?"||!xs.test(r[2]))&&r.slice(3,o).every(u=>!xs.test(u)),c=/^[a-z]:/i.test(r[0]);if(l)return[...r.slice(0,o).map(u=>this.#m(u)),...r.slice(o).map(u=>this.parse(u))];if(c)return[this.#m(r[0]),...r.slice(1).map(u=>this.parse(u))]}return r.map(o=>this.parse(o))});if(this.set=i.filter(r=>r.indexOf(!1)===-1),this.isWindows)for(let r=0;r<this.set.length;r++){let h=this.set[r];h[0]===""&&h[1]===""&&this.globParts[r][2]==="?"&&(Te(h[3])||Bt(this.globParts[r][3]))&&(Bt(this.globParts[r][3])&&(h[3]="UNC"),h[2]="?")}e.noext||this.mergeRows()}mergeRows(){let t=!0;for(;t;){t=!1;let e=Math.max(0,...this.set.map(s=>s.length));for(let s=0;s<e;s++){let i=new Map;this.set.forEach((h,a)=>{if(!(h[s]instanceof ks.Matcher)||!ar(this.globParts[a][s]))return;let o=[...this.globParts[a]];o[s]="";let l=`${h.length}/${o.join("/")}`,c=i.get(l);c?c.push(a):i.set(l,[a])});let r=new Set;for(let h of i.values()){if(h.length<2)continue;let[a,...o]=h,c=`@(${h.map(u=>this.globParts[u][s]).join("|")})`;this.globParts[a][s]=c,this.set[a][s]=this.parse(c);for(let u of o)r.add(u)}r.size&&(t=!0,this.set=this.set.filter((h,a)=>!r.has(a)),this.globParts=this.globParts.filter((h,a)=>!r.has(a)))}}}preprocess(t){if(this.options.noglobstar)for(let s of t)for(let i=0;i<s.length;i++)s[i]==="**"&&(s[i]="*");let{optimizationLevel:e=1}=this.options;return e>=2?(t=this.firstPhasePreProcess(t),t=this.secondPhasePreProcess(t)):e>=1?t=this.levelOneOptimize(t):t=this.adjascentGlobstarOptimize(t),t}adjascentGlobstarOptimize(t){return t.map(e=>{let s=-1;for(;(s=e.indexOf("**",s+1))!==-1;){let i=s;for(;e[i+1]==="**";)i++;i!==s&&e.splice(s,i-s)}return e})}levelOneOptimize(t){return t.map(e=>{let s=this.#a(e)+1;return e=e.reduce((i,r)=>{let h=i[i.length-1];return r==="**"&&h==="**"?i:r===".."&&i.length>s&&h&&h!==".."&&h!=="."&&h!=="**"?(i.pop(),i):(i.push(r),i)},[]),e.length===0?[""]:e})}#l(t){let e=!this.isWindows||!t.includes("\\")?"/":t.includes("/")?"both":"\\",s=this.#t?0:-1,i="",r=0,h,a=0,o=!!this.options.dot;t:for(let l=0;l<this.set.length;l++){let c=this.set[l],u=c[c.length-1],p=s!==-1&&this.#c[l]&&u!==w.GLOBSTAR;if(p&&s===0){let f=Ts(t,t.length,e);if(r=f+1,i=t.slice(r),i===""&&f>=0){let m=f;for(;m>0&&Gt(t.charCodeAt(m-1),e);)m--;a=m===0?0:Ts(t,m-1,e)+1,h=t.slice(a,m)}let b=this.#e&&(je(i)||i===""&&h!==void 0&&je(h));s=b?-1:1,p=!b}let d=-1;if(p&&typeof u=="string"&&(d=Ps(u,i,r,h,a),d===-1))continue;if(this.#i){for(let f of this.#n[l])if(!t.includes(f))continue t}if(p&&typeof u=="object"&&(d=Ps(u,i,r,h,a),d===-1))continue;let g=this.#d[l];if(g==="base"&&p)return"yes";if(g==="tail"&&p){if(this.#e&&ft(t,0,d,!0,e))return"maybe";if(!ft(t,0,d,o,e))return"yes";continue}if(g==="mid"||g==="head"){let f=this.#w(t,c,g==="head",o,e);if(f!=="no")return f;continue}return"maybe"}return"no"}#r(t,e,s){let i=!!this.options.dot,r=t.length;if(s==="head"){if(r<2||!V(e[0],t[0]))return!1;for(let a=1;a<r;a++)if(!Wt(t[a],i))return!1;return!0}let h=e[1];if(s==="tail"){let a=r-1;if(!V(h,t[a])&&(t[a]!==""||r===1||!V(h,t[--a])))return!1;for(let o=0;o<a;o++)if(!Wt(t[o],i))return!1;return!0}for(let a=0;a<r;a++){if(V(h,t[a])&&a+1<r){let o=a+1;for(;o<r&&Wt(t[o],i);)o++;if(o===r)return!0}if(!Wt(t[a],i))return!1}return!1}#w(t,e,s,i,r){if(this.#e&&ft(t,0,t.length,!0,r))return"maybe";let h=e[s?0:1],a=0;for(let o=De(t,a,r);o!==-1;o=De(t,a,r)){let l=o+1;for(;l<t.length&&Gt(t.charCodeAt(l),r);)l++;if((typeof h=="string"?o-a===h.length&&t.startsWith(h,a):o>a&&h.testUnchecked(t.slice(a,o)))&&!ft(t,l,t.length,i,r))return"yes";if(s||ft(t,a,l,i,r))return"no";a=l}return"no"}#_(t){let e=Pe;return e?.f===t&&e.isWindows===this.isWindows&&e.preserveMultipleSlashes===this.preserveMultipleSlashes&&e.normalize===this.#h?e:void 0}#b(t){let{isWindows:e,preserveMultipleSlashes:s}=this,i=this.#S(e?t.split("\\").join("/"):t),r=this.#h;return r&&(i=i.map(h=>h.normalize(r))),Pe={f:t,isWindows:e,preserveMultipleSlashes:s,normalize:r,parts:i},Pe}#u(t){let e=[...t],s=!1;do{if(s=!1,!this.preserveMultipleSlashes){for(let h=1;h<e.length-1;h++){let a=e[h];h===1&&a===""&&e[0]===""||(a==="."||a==="")&&(s=!0,e.splice(h,1),h--)}e[0]==="."&&e.length===2&&(e[1]==="."||e[1]==="")&&(s=!0,e.pop())}let i=this.#a(e)+1,r=i;for(;(r=e.indexOf("..",r+1))!==-1;){let h=e[r-1];h&&h!=="."&&h!==".."&&h!=="**"&&(s=!0,e.splice(r-1,2),r=Math.max(r-2,i))}}while(s);return e.length===0?[""]:e}firstPhasePreProcess(t){let{braceExpandMax:e=1e5}=this.options,s=!1;do{s=!1;for(let i of t){let r=-1;for(;(r=i.indexOf("**",r+1))!==-1;){let o=r;for(;i[o+1]==="**";)o++;o>r&&i.splice(r+1,o-r);let l=i[r+1],c=i[r+2],u=i[r+3];if(l!==".."||!c||c==="."||c===".."||!u||u==="."||u===".."||t.length>=e)continue;s=!0,i.splice(r,1);let p=i.slice(0);p[r]="**",t.push(p),r--}if(!this.preserveMultipleSlashes){for(let o=1;o<i.length-1;o++){let l=i[o];o===1&&l===""&&i[0]===""||(l==="."||l==="")&&(s=!0,i.splice(o,1),o--)}i[0]==="."&&i.length===2&&(i[1]==="."||i[1]==="")&&(s=!0,i.pop())}let h=this.#a(i)+1,a=h;for(;(a=i.indexOf("..",a+1))!==-1;){let o=i[a-1];if(o&&o!=="."&&o!==".."&&o!=="**"){s=!0;let c=a===1&&i[a+1]==="**"?["."]:[];i.splice(a-1,2,...c),i.length===0&&i.push(""),a=Math.max(a-2,h)}}}}while(s);return t}secondPhasePreProcess(t){if(t.length>1e3)return t;for(let e=0;e<t.length-1;e++)for(let s=e+1;s<t.length;s++){let i=this.partsMatch(t[e],t[s],!this.preserveMultipleSlashes);if(i){t[e]=[],t[s]=i;break}}return t.filter(e=>e.length)}partsMatch(t,e,s=!1){let i=0,r=0,h=[],a="";for(;i<t.length&&r<e.length;)if(t[i]===e[r])h.push(a==="b"?e[r]:t[i]),i++,r++;else if(s&&t[i]==="**"&&e[r]===t[i+1])h.push(t[i]),i++;else if(s&&e[r]==="**"&&t[i]===e[r+1])h.push(e[r]),r++;else if(t[i]==="*"&&e[r]&&(this.options.dot||!e[r].startsWith("."))&&e[r]!=="**"){if(a==="b")return!1;a="a",h.push(t[i]),i++,r++}else if(e[r]==="*"&&t[i]&&(this.options.dot||!t[i].startsWith("."))&&t[i]!=="**"){if(a==="a")return!1;a="b",h.push(e[r]),i++,r++}else return!1;return t.length===e.length&&h}parseNegate(){if(this.nonegate)return;let t=this.pattern,e=!1,s=0;for(let i=0;i<t.length&&t.charAt(i)==="!";i++)e=!e,s++;s&&(this.pattern=t.slice(s)),this.negate=e}#v(t,e,s,i){let r=0,h=0,a=this.isWindows?Fe(e):-1,o=a===-1?-1:Fe(s);if(o!==-1){let l=s[o],c=s[o+1];typeof l!="string"||typeof c!="string"?(r=a,h=o):e[a].toLowerCase()===l.toLowerCase()&&e[a+1].toLowerCase()===c.toLowerCase()&&(r=a+2,h=o+2)}else if(this.isWindows){let l=typeof t[0]=="string"&&/^[a-z]:$/i.test(t[0]),c=!l&&t[0]===""&&t[1]===""&&t[2]==="?"&&/^[a-z]:$/i.test(t[3]),u=typeof s[0]=="string"&&/^[a-z]:$/i.test(s[0]),p=!u&&s[0]===""&&s[1]===""&&s[2]==="?"&&typeof s[3]=="string"&&/^[a-z]:$/i.test(s[3]),d=c?3:l?0:void 0,g=p?3:u?0:void 0;if(typeof d=="number"&&typeof g=="number"){let[f,b]=[t[d],s[g]];f.toLowerCase()===b.toLowerCase()&&(h=g+1,r=d+1)}}return t=e,s.includes(w.GLOBSTAR)?this.#y(t,s,i,r,h):this.#g(t,s,i,r,h)}#y(t,e,s,i,r){let{head:h,body:a,tail:o,segments:l}=this.#E(e,s,r);if(h.length){let u=i+h.length;if(!this.#g(t,h,s,i,0,u))return!1;i+=h.length,r+=h.length}let c=0;if(o.length){if(o.length+i>t.length)return!1;let u=t.length-o.length;if(this.#g(t,o,s,u,0))c=o.length;else{if(t[t.length-1]!==""||i+o.length===t.length||(u--,!this.#g(t,o,s,u,0)))return!1;c=o.length+1}}if(!a.length){let u=!!c;for(let p=i;p<t.length-c;p++){let d=String(t[p]);if(u=!0,d==="."||d===".."||!this.options.dot&&d.startsWith("."))return!1}return s||u}return!!this.#O(t,l,t.length-c,i,0,s,0,!!c,new Set)}#E(t,e,s){let i=this.#o.get(t);i||(i=[],this.#o.set(t,i));let r=s*2+(e?1:0),h=i[r];if(h)return h;let a=t.indexOf(w.GLOBSTAR,s),o=t.lastIndexOf(w.GLOBSTAR),l=t.slice(s,a),c=t.slice(a+1,e?void 0:o),u=e?[]:t.slice(o+1),p=[[[],0]],d=p[0],g=0,f=[0];for(let m of c)m===w.GLOBSTAR?(f.push(g),d=[[],0],p.push(d)):(d[0].push(m),g++);p.forEach((m,y)=>{m[1]=g-f[y]});let b={head:l,body:c,tail:u,segments:p};return i[r]=b,b}#O(t,e,s,i,r,h,a,o,l){let c=e[r];if(!c){if(h)return i>=s||i===s-1&&t[i]==="";for(let g=i;g<s;g++){o=!0;let f=t[g];if(f==="."||f===".."||!this.options.dot&&f.startsWith("."))return!1}return o}let[u,p]=c,d=h?s:s-p;for(;i<=d;){let g=r*(t.length+1)+i;if(l.has(g))return!1;if(l.add(g),this.#g(t,u,h,i,0,i+u.length)&&a<this.maxGlobstarRecursion){let m=this.#O(t,e,s,i+u.length,r+1,h,a+1,o,l);if(m!==!1)return m}if(i===d)break;let b=t[i];if(b==="."||b===".."||!this.options.dot&&b.startsWith("."))return!1;i++}return h||null}#g(t,e,s,i,r,h=t.length){let a,o,l,c;for(a=i,o=r,c=Math.min(h,t.length),l=e.length;a<c&&o<l;a++,o++){let u=e[o],p=t[a];if(u===!1||u===w.GLOBSTAR||!V(u,p))return!1}if(a===c&&o===l)return!0;if(a===c)return s;if(o===l)return a===c-1&&t[a]==="";throw new Error("wtf?")}braceExpand(){return(0,w.braceExpand)(this.pattern,this.options)}parse(t){(0,zt.assertValidPattern)(t);let e=this.options;if(t==="**")return w.GLOBSTAR;if(t==="")return"";let{nocase:s,nocaseMagicOnly:i,noext:r=!1,dot:h,normalize:a}=e,o=or(t,r);if(o!==void 0&&!(s&&!i&&t.toUpperCase()!==t.toLowerCase()))return this.#m(o);let l=this.#p.get(t);return l||(l=new ks.Matcher(t,{nocase:s,noext:r,dot:h,normalize:a}),this.#p.set(t,l)),l}#S(t){return this.preserveMultipleSlashes?t.split("/"):this.isWindows&&/^\/\/[^/]+/.test(t)?["",...t.split(/\/+/)]:t.split(/\/+/)}match(t,e=this.partial){if(this.comment)return!1;if(this.empty)return t==="";if(t==="/"&&e)return!0;let s=this.options,i=this.#_(t);if(!i){if(!e&&!this.#h&&(this.#t||this.#i)&&Rs!==t){Rs=t;let l=this.#l(t);if(l==="no")return s.flipNegate?!1:this.negate;if(l==="yes")return s.flipNegate?!0:!this.negate}i=this.#b(t)}let r=i.parts,h=this.#e?i.resolved??=this.#u(r):r,a=this.set,o=r[r.length-1];if(!o)for(let l=r.length-2;!o&&l>=0;l--)o=r[l];for(let l=0;l<a.length;l++){let c=a[l],u=e?void 0:this.#d[l];if(u==="base"?V(c[0],o):u?this.#r(h,c,u):s.matchBase&&c.length===1?this.#v([o],[o],c,e):this.#v(r,h,c,e))return s.flipNegate?!0:!this.negate}return s.flipNegate?!1:this.negate}static defaults(t){return w.minimatch.defaults(t).Minimatch}};w.Minimatch=ht;var lr=xe();Object.defineProperty(w,"escape",{enumerable:!0,get:function(){return lr.escape}});var cr=Re();Object.defineProperty(w,"unescape",{enumerable:!0,get:function(){return cr.unescape}});w.minimatch.Minimatch=ht;w.minimatch.escape=tr.escape;w.minimatch.unescape=er.unescape});var zs=x(Ut=>{"use strict";var Ns=(n,t)=>()=>(t||n((t={exports:{}}).exports,t),t.exports),ur=Ns(n=>{"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.tracing=n.metrics=void 0;var t=__webpack_require__(/*! node:diagnostics_channel */ "node:diagnostics_channel");n.metrics=(0,t.channel)("lru-cache:metrics"),n.tracing=(0,t.tracingChannel)("lru-cache")}),fr=Ns(n=>{"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.defaultPerf=void 0,n.defaultPerf=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date});Object.defineProperty(Ut,"__esModule",{value:!0});Ut.LRUCache=void 0;var O=ur(),dr=fr(),Ne=()=>O.metrics.hasSubscribers||O.tracing.hasSubscribers,Ls=new Set,Ds=typeof process=="object"&&process?process:{},pr=(n,t,e,s)=>{typeof Ds.emitWarning=="function"?Ds.emitWarning(n,t,e,s):console.error(`[${e}] ${t}: ${n}`)},mr=n=>!Ls.has(n),Z=n=>!!n&&n===Math.floor(n)&&n>0&&isFinite(n),Ws=n=>Z(n)?n<=Math.pow(2,8)?Uint8Array:n<=Math.pow(2,16)?Uint16Array:n<=Math.pow(2,32)?Uint32Array:n<=Number.MAX_SAFE_INTEGER?It:null:null,It=class extends Array{constructor(n){super(n),this.fill(0)}},gr=class dt{heap;length;static#t=!1;static create(t){let e=Ws(t);if(!e)return[];dt.#t=!0;let s=new dt(t,e);return dt.#t=!1,s}constructor(t,e){if(!dt.#t)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new e(t),this.length=0}push(t){this.heap[this.length++]=t}pop(){return this.heap[--this.length]}},wr=class Bs{#t;#i;#e;#h;#n;#d;#c;#p;get perf(){return this.#p}ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;backgroundFetchSize;#o;#m;#a;#l;#r;#w;#_;#b;#u;#v;#y;#E;#O;#g;#S;#C;#M;#s;#P;static unsafeExposeInternals(t){return{starts:t.#O,ttls:t.#g,autopurgeTimers:t.#S,sizes:t.#E,keyMap:t.#a,keyList:t.#l,valList:t.#r,next:t.#w,prev:t.#_,get head(){return t.#b},get tail(){return t.#u},free:t.#v,isBackgroundFetch:e=>t.#f(e),backgroundFetch:(e,s,i,r)=>t.#L(e,s,i,r),moveToTail:e=>t.#K(e),indexes:e=>t.#x(e),rindexes:e=>t.#R(e),isStale:e=>t.#A(e)}}get max(){return this.#t}get maxSize(){return this.#i}get calculatedSize(){return this.#m}get size(){return this.#o}get fetchMethod(){return this.#d}get memoMethod(){return this.#c}get dispose(){return this.#e}get onInsert(){return this.#h}get disposeAfter(){return this.#n}constructor(t){let{max:e=0,ttl:s,ttlResolution:i=1,ttlAutopurge:r,updateAgeOnGet:h,updateAgeOnHas:a,allowStale:o,dispose:l,onInsert:c,disposeAfter:u,noDisposeOnSet:p,noUpdateTTL:d,maxSize:g=0,maxEntrySize:f=0,sizeCalculation:b,fetchMethod:m,memoMethod:y,noDeleteOnFetchRejection:_,noDeleteOnStaleGet:v,allowStaleOnFetchRejection:S,allowStaleOnFetchAbort:K,ignoreFetchAbort:z,backgroundFetchSize:$=1,perf:nt}=t;if(this.backgroundFetchSize=$,nt!==void 0&&typeof nt?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(this.#p=nt??dr.defaultPerf,e!==0&&!Z(e))throw new TypeError("max option must be a nonnegative integer");let ge=e?Ws(e):Array;if(!ge)throw new Error("invalid max value: "+e);if(this.#t=e,this.#i=g,this.maxEntrySize=f||this.#i,this.sizeCalculation=b,this.sizeCalculation){if(!this.#i&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(y!==void 0&&typeof y!="function")throw new TypeError("memoMethod must be a function if defined");if(this.#c=y,m!==void 0&&typeof m!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#d=m,this.#M=!!m,this.#a=new Map,this.#l=Array.from({length:e}).fill(void 0),this.#r=Array.from({length:e}).fill(void 0),this.#w=new ge(e),this.#_=new ge(e),this.#b=0,this.#u=0,this.#v=gr.create(e),this.#o=0,this.#m=0,typeof l=="function"&&(this.#e=l),typeof c=="function"&&(this.#h=c),typeof u=="function"?(this.#n=u,this.#y=[]):(this.#n=void 0,this.#y=void 0),this.#C=!!this.#e,this.#P=!!this.#h,this.#s=!!this.#n,this.noDisposeOnSet=!!p,this.noUpdateTTL=!!d,this.noDeleteOnFetchRejection=!!_,this.allowStaleOnFetchRejection=!!S,this.allowStaleOnFetchAbort=!!K,this.ignoreFetchAbort=!!z,this.maxEntrySize!==0){if(this.#i!==0&&!Z(this.#i))throw new TypeError("maxSize must be a positive integer if specified");if(!Z(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#$()}if(this.allowStale=!!o,this.noDeleteOnStaleGet=!!v,this.updateAgeOnGet=!!h,this.updateAgeOnHas=!!a,this.ttlResolution=Z(i)||i===0?i:1,this.ttlAutopurge=!!r,this.ttl=s||0,this.ttl){if(!Z(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#T()}if(this.#t===0&&this.ttl===0&&this.#i===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#t&&!this.#i){let we="LRU_CACHE_UNBOUNDED";mr(we)&&(Ls.add(we),pr("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",we,Bs))}}getRemainingTTL(t){return this.#a.has(t)?1/0:0}#T(){let t=new It(this.#t),e=new It(this.#t);this.#g=t,this.#O=e;let s=this.ttlAutopurge?Array.from({length:this.#t}):void 0;this.#S=s,this.#B=(o,l,c=this.#p.now())=>{e[o]=l!==0?c:0,t[o]=l,i(o,l)},this.#k=o=>{e[o]=t[o]!==0?this.#p.now():0,i(o,t[o])};let i=this.ttlAutopurge?(o,l)=>{if(s?.[o]&&(clearTimeout(s[o]),s[o]=void 0),l&&l!==0&&s){let c=setTimeout(()=>{this.#A(o)?(this.#W(this.#l[o],"expire"),s[o]=void 0):i(o,a(o))},l+1);c.unref&&c.unref(),s[o]=c}}:()=>{};this.#F=(o,l)=>{if(t[l]){let c=t[l],u=e[l];if(!c||!u)return;o.ttl=c,o.start=u,o.now=r||h();let p=o.now-u;o.remainingTTL=c-p}};let r=0,h=()=>{let o=this.#p.now();if(this.ttlResolution>0){r=o;let l=setTimeout(()=>r=0,this.ttlResolution);l.unref&&l.unref()}return o};this.getRemainingTTL=o=>{let l=this.#a.get(o);return l===void 0?0:a(l)};let a=o=>{let l=t[o],c=e[o];if(!l||!c)return 1/0;let u=(r||h())-c;return l-u};this.#A=o=>{let l=e[o],c=t[o];return!!c&&!!l&&(r||h())-l>c}}#k=()=>{};#F=()=>{};#B=()=>{};#A=()=>!1;#$(){let t=new It(this.#t);this.#m=0,this.#E=t,this.#D=e=>{this.#m-=t[e],t[e]=0},this.#z=(e,s,i,r)=>{if(!Z(i)){if(this.#f(s))return this.backgroundFetchSize;if(r){if(typeof r!="function")throw new TypeError("sizeCalculation must be a function");if(i=r(s,e),!Z(i))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.")}return i},this.#j=(e,s,i)=>{if(t[e]=s,this.#i){let r=this.#i-t[e];for(;this.#m>r;)this.#U(!0)}this.#m+=t[e],i&&(i.entrySize=s,i.totalCalculatedSize=this.#m)}}#D=t=>{};#j=(t,e,s)=>{};#z=(t,e,s,i)=>{if(s||i)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#x({allowStale:t=this.allowStale}={}){if(this.#o)for(let e=this.#u;this.#G(e)&&((t||!this.#A(e))&&(yield e),e!==this.#b);)e=this.#_[e]}*#R({allowStale:t=this.allowStale}={}){if(this.#o)for(let e=this.#b;this.#G(e)&&((t||!this.#A(e))&&(yield e),e!==this.#u);)e=this.#w[e]}#G(t){return t!==void 0&&this.#a.get(this.#l[t])===t}*entries(){for(let t of this.#x())this.#r[t]!==void 0&&this.#l[t]!==void 0&&!this.#f(this.#r[t])&&(yield[this.#l[t],this.#r[t]])}*rentries(){for(let t of this.#R())this.#r[t]!==void 0&&this.#l[t]!==void 0&&!this.#f(this.#r[t])&&(yield[this.#l[t],this.#r[t]])}*keys(){for(let t of this.#x()){let e=this.#l[t];e!==void 0&&!this.#f(this.#r[t])&&(yield e)}}*rkeys(){for(let t of this.#R()){let e=this.#l[t];e!==void 0&&!this.#f(this.#r[t])&&(yield e)}}*values(){for(let t of this.#x())this.#r[t]!==void 0&&!this.#f(this.#r[t])&&(yield this.#r[t])}*rvalues(){for(let t of this.#R())this.#r[t]!==void 0&&!this.#f(this.#r[t])&&(yield this.#r[t])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(t,e={}){for(let s of this.#x()){let i=this.#r[s],r=this.#f(i)?i.__staleWhileFetching:i;if(r!==void 0&&t(r,this.#l[s],this))return this.#X(this.#l[s],e)}}forEach(t,e=this){for(let s of this.#x()){let i=this.#r[s],r=this.#f(i)?i.__staleWhileFetching:i;r!==void 0&&t.call(e,r,this.#l[s],this)}}rforEach(t,e=this){for(let s of this.#R()){let i=this.#r[s],r=this.#f(i)?i.__staleWhileFetching:i;r!==void 0&&t.call(e,r,this.#l[s],this)}}purgeStale(){let t=!1;for(let e of this.#R({allowStale:!0}))this.#A(e)&&(this.#W(this.#l[e],"expire"),t=!0);return t}info(t){let e=this.#a.get(t);if(e===void 0)return;let s=this.#r[e],i=this.#f(s)?s.__staleWhileFetching:s;if(i===void 0)return;let r={value:i};if(this.#g&&this.#O){let h=this.#g[e],a=this.#O[e];if(h&&a){let o=h-(this.#p.now()-a);r.ttl=o,r.start=Date.now()}}return this.#E&&(r.size=this.#E[e]),r}dump(){let t=[];for(let e of this.#x({allowStale:!0})){let s=this.#l[e],i=this.#r[e],r=this.#f(i)?i.__staleWhileFetching:i;if(r===void 0||s===void 0)continue;let h={value:r};if(this.#g&&this.#O){h.ttl=this.#g[e];let a=this.#p.now()-this.#O[e];h.start=Math.floor(Date.now()-a)}this.#E&&(h.size=this.#E[e]),t.unshift([s,h])}return t}load(t){this.clear();for(let[e,s]of t){if(s.start){let i=Date.now()-s.start;s.start=this.#p.now()-i}this.#N(e,s.value,s)}}set(t,e,s={}){let{status:i=O.metrics.hasSubscribers?{}:void 0}=s;s.status=i,i&&(i.op="set",i.key=t,e!==void 0&&(i.value=e),i.cache=this);let r=this.#N(t,e,s);return i&&O.metrics.hasSubscribers&&O.metrics.publish(i),r}#N(t,e,s,i){let{ttl:r=this.ttl,start:h,noDisposeOnSet:a=this.noDisposeOnSet,sizeCalculation:o=this.sizeCalculation,status:l}=s,c=this.#f(e);if(e===void 0)return l&&(l.set="deleted"),this.delete(t),this;let{noUpdateTTL:u=this.noUpdateTTL}=s;l&&!c&&(l.value=e);let p=this.#z(t,e,s.size||0,o,l);if(this.maxEntrySize&&p>this.maxEntrySize)return this.#W(t,"set"),l&&(l.set="miss",l.maxEntrySizeExceeded=!0),this;let d=this.#o===0?void 0:this.#a.get(t);if(d===void 0)d=this.#o===0?this.#u:this.#v.length!==0?this.#v.pop():this.#o===this.#t?this.#U(!1):this.#o,this.#l[d]=t,this.#r[d]=e,this.#a.set(t,d),this.#w[this.#u]=d,this.#_[d]=this.#u,this.#u=d,this.#o++,this.#j(d,p,l),l&&(l.set="add"),u=!1,this.#P&&!c&&this.#h?.(e,t,"add");else{this.#K(d);let g=this.#r[d];if(e!==g){if(!a)if(this.#f(g)){g!==i&&g.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:f}=g;f!==void 0&&f!==e&&(this.#C&&this.#e?.(f,t,"set"),this.#s&&this.#y?.push([f,t,"set"]))}else this.#C&&this.#e?.(g,t,"set"),this.#s&&this.#y?.push([g,t,"set"]);if(this.#D(d),this.#j(d,p,l),this.#r[d]=e,!c){let f=g&&this.#f(g)?g.__staleWhileFetching:g,b=f===void 0?"add":e!==f?"replace":"update";l&&(l.set=b,f!==void 0&&(l.oldValue=f)),this.#P&&this.onInsert?.(e,t,b)}}else c||(l&&(l.set="update"),this.#P&&this.onInsert?.(e,t,"update"))}if(r!==0&&!this.#g&&this.#T(),this.#g&&(u||this.#B(d,r,h),l&&this.#F(l,d)),!a&&this.#s&&this.#y){let g=this.#y,f;for(;f=g?.shift();)this.#n?.(...f)}return this}pop(){try{for(;this.#o;){let t=this.#r[this.#b];if(this.#U(!0),this.#f(t)){if(t.__staleWhileFetching)return t.__staleWhileFetching}else if(t!==void 0)return t}}finally{if(this.#s&&this.#y){let t=this.#y,e;for(;e=t?.shift();)this.#n?.(...e)}}}#U(t){let e=this.#b,s=this.#l[e],i=this.#r[e],r=this.#f(i);r&&i.__abortController.abort(new Error("evicted"));let h=r?i.__staleWhileFetching:i;return(this.#C||this.#s)&&h!==void 0&&(this.#C&&this.#e?.(h,s,"evict"),this.#s&&this.#y?.push([h,s,"evict"])),this.#D(e),this.#S?.[e]&&(clearTimeout(this.#S[e]),this.#S[e]=void 0),t&&(this.#l[e]=void 0,this.#r[e]=void 0,this.#v.push(e)),this.#o===1?(this.#b=this.#u=0,this.#v.length=0):this.#b=this.#w[e],this.#a.delete(s),this.#o--,e}has(t,e={}){let{status:s=O.metrics.hasSubscribers?{}:void 0}=e;e.status=s,s&&(s.op="has",s.key=t,s.cache=this);let i=this.#V(t,e);return O.metrics.hasSubscribers&&O.metrics.publish(s),i}#V(t,e={}){let{updateAgeOnHas:s=this.updateAgeOnHas,status:i}=e,r=this.#a.get(t);if(r!==void 0){let h=this.#r[r];if(this.#f(h)&&h.__staleWhileFetching===void 0)return!1;if(this.#A(r))i&&(i.has="stale",this.#F(i,r));else return s&&this.#k(r),i&&(i.has="hit",this.#F(i,r)),!0}else i&&(i.has="miss");return!1}peek(t,e={}){let{status:s=Ne()?{}:void 0}=e;s&&(s.op="peek",s.key=t,s.cache=this),e.status=s;let i=this.#q(t,e);return O.metrics.hasSubscribers&&O.metrics.publish(s),i}#q(t,e){let{status:s,allowStale:i=this.allowStale}=e,r=this.#a.get(t);if(r===void 0||!i&&this.#A(r)){s&&(s.peek=r===void 0?"miss":"stale");return}let h=this.#r[r],a=this.#f(h)?h.__staleWhileFetching:h;return s&&(a!==void 0?(s.peek="hit",s.value=a):s.peek="miss"),a}#L(t,e,s,i){let r=e===void 0?void 0:this.#r[e];if(this.#f(r))return r;let h=new AbortController,{signal:a}=s;a?.addEventListener("abort",()=>h.abort(a.reason),{signal:h.signal});let o={signal:h.signal,options:s,context:i},l=(f,b=!1)=>{let{aborted:m}=h.signal,y=s.ignoreFetchAbort&&f!==void 0,_=s.ignoreFetchAbort||!!(s.allowStaleOnFetchAbort&&f!==void 0);if(s.status&&(m&&!b?(s.status.fetchAborted=!0,s.status.fetchError=h.signal.reason,y&&(s.status.fetchAbortIgnored=!0)):s.status.fetchResolved=!0),m&&!y&&!b)return u(h.signal.reason,_);let v=d,S=this.#r[e];return(S===d||S===void 0&&y&&b)&&(f===void 0?v.__staleWhileFetching!==void 0?this.#r[e]=v.__staleWhileFetching:this.#W(t,"fetch"):(s.status&&(s.status.fetchUpdated=!0),this.#N(t,f,o.options,v))),f},c=f=>(s.status&&(s.status.fetchRejected=!0,s.status.fetchError=f),u(f,!1)),u=(f,b)=>{let{aborted:m}=h.signal,y=m&&s.allowStaleOnFetchAbort,_=y||s.allowStaleOnFetchRejection,v=_||s.noDeleteOnFetchRejection,S=d;if(this.#r[e]===d&&(!v||!b&&S.__staleWhileFetching===void 0?this.#W(t,"fetch"):y||(this.#r[e]=S.__staleWhileFetching)),_)return s.status&&S.__staleWhileFetching!==void 0&&(s.status.returnedStale=!0),S.__staleWhileFetching;if(S.__returned===S)throw f},p=(f,b)=>{let m=this.#d?.(t,r,o);h.signal.addEventListener("abort",()=>{(!s.ignoreFetchAbort||s.allowStaleOnFetchAbort)&&(f(void 0),s.allowStaleOnFetchAbort&&(f=y=>l(y,!0)))}),m&&m instanceof Promise?m.then(y=>f(y===void 0?void 0:y),b):m!==void 0&&f(m)};s.status&&(s.status.fetchDispatched=!0);let d=new Promise(p).then(l,c),g=Object.assign(d,{__abortController:h,__staleWhileFetching:r,__returned:void 0});return e===void 0?(this.#N(t,g,{...o.options,status:void 0}),e=this.#a.get(t)):this.#r[e]=g,g}#f(t){if(!this.#M)return!1;let e=t;return!!e&&e instanceof Promise&&e.hasOwnProperty("__staleWhileFetching")&&e.__abortController instanceof AbortController}fetch(t,e={}){let s=O.tracing.hasSubscribers,{status:i=Ne()?{}:void 0}=e;e.status=i,i&&e.context&&(i.context=e.context);let r=this.#H(t,e);return i&&s&&(i.trace=!0,O.tracing.tracePromise(()=>r,i).catch(()=>{})),r}async#H(t,e={}){let{allowStale:s=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:r=this.noDeleteOnStaleGet,ttl:h=this.ttl,noDisposeOnSet:a=this.noDisposeOnSet,size:o=0,sizeCalculation:l=this.sizeCalculation,noUpdateTTL:c=this.noUpdateTTL,noDeleteOnFetchRejection:u=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:p=this.allowStaleOnFetchRejection,ignoreFetchAbort:d=this.ignoreFetchAbort,allowStaleOnFetchAbort:g=this.allowStaleOnFetchAbort,context:f,forceRefresh:b=!1,status:m,signal:y}=e;if(m&&(m.op="fetch",m.key=t,b&&(m.forceRefresh=!0),m.cache=this),!this.#M)return m&&(m.fetch="get"),this.#X(t,{allowStale:s,updateAgeOnGet:i,noDeleteOnStaleGet:r,status:m});let _={allowStale:s,updateAgeOnGet:i,noDeleteOnStaleGet:r,ttl:h,noDisposeOnSet:a,size:o,sizeCalculation:l,noUpdateTTL:c,noDeleteOnFetchRejection:u,allowStaleOnFetchRejection:p,allowStaleOnFetchAbort:g,ignoreFetchAbort:d,status:m,signal:y},v=this.#a.get(t);if(v===void 0){m&&(m.fetch="miss");let S=this.#L(t,v,_,f);return S.__returned=S}else{let S=this.#r[v];if(this.#f(S)){let nt=s&&S.__staleWhileFetching!==void 0;return m&&(m.fetch="inflight",nt&&(m.returnedStale=!0)),nt?S.__staleWhileFetching:S.__returned=S}let K=this.#A(v);if(!b&&!K)return m&&(m.fetch="hit"),this.#K(v),i&&this.#k(v),m&&this.#F(m,v),S;let z=this.#L(t,v,_,f),$=z.__staleWhileFetching!==void 0&&s;return m&&(m.fetch=K?"stale":"refresh",$&&K&&(m.returnedStale=!0)),$?z.__staleWhileFetching:z.__returned=z}}forceFetch(t,e={}){let s=O.tracing.hasSubscribers,{status:i=Ne()?{}:void 0}=e;e.status=i,i&&e.context&&(i.context=e.context);let r=this.#I(t,e);return i&&s&&(i.trace=!0,O.tracing.tracePromise(()=>r,i).catch(()=>{})),r}async#I(t,e={}){let s=await this.#H(t,e);if(s===void 0)throw new Error("fetch() returned undefined");return s}memo(t,e={}){let{status:s=O.metrics.hasSubscribers?{}:void 0}=e;e.status=s,s&&(s.op="memo",s.key=t,e.context&&(s.context=e.context),s.cache=this);let i=this.#J(t,e);return s&&(s.value=i),O.metrics.hasSubscribers&&O.metrics.publish(s),i}#J(t,e={}){let s=this.#c;if(!s)throw new Error("no memoMethod provided to constructor");let{context:i,status:r,forceRefresh:h,...a}=e;r&&h&&(r.forceRefresh=!0);let o=this.#X(t,a),l=h||o===void 0;if(r&&(r.memo=l?"miss":"hit",l||(r.value=o)),!l)return o;let c=s(t,o,{options:a,context:i});return r&&(r.value=c),this.#N(t,c,a),c}get(t,e={}){let{status:s=O.metrics.hasSubscribers?{}:void 0}=e;e.status=s,s&&(s.op="get",s.key=t,s.cache=this);let i=this.#X(t,e);return s&&(i!==void 0&&(s.value=i),O.metrics.hasSubscribers&&O.metrics.publish(s)),i}#X(t,e={}){let{allowStale:s=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:r=this.noDeleteOnStaleGet,status:h}=e,a=this.#a.get(t);if(a===void 0){h&&(h.get="miss");return}let o=this.#r[a],l=this.#f(o);return h&&this.#F(h,a),this.#A(a)?l?(h&&(h.get="stale-fetching"),s&&o.__staleWhileFetching!==void 0?(h&&(h.returnedStale=!0),o.__staleWhileFetching):void 0):(r||this.#W(t,"expire"),h&&(h.get="stale"),s?(h&&(h.returnedStale=!0),o):void 0):(h&&(h.get=l?"fetching":"hit"),this.#K(a),i&&this.#k(a),l?o.__staleWhileFetching:o)}#Y(t,e){this.#_[e]=t,this.#w[t]=e}#K(t){t!==this.#u&&(t===this.#b?this.#b=this.#w[t]:this.#Y(this.#_[t],this.#w[t]),this.#Y(this.#u,t),this.#u=t)}delete(t){return this.#W(t,"delete")}#W(t,e){O.metrics.hasSubscribers&&O.metrics.publish({op:"delete",delete:e,key:t,cache:this});let s=!1;if(this.#o!==0){let i=this.#a.get(t);if(i!==void 0)if(this.#S?.[i]&&(clearTimeout(this.#S[i]),this.#S[i]=void 0),s=!0,this.#o===1)this.#Z(e);else{this.#D(i);let r=this.#r[i];if(this.#f(r)?r.__abortController.abort(new Error("deleted")):(this.#C||this.#s)&&(this.#C&&this.#e?.(r,t,e),this.#s&&this.#y?.push([r,t,e])),this.#a.delete(t),this.#l[i]=void 0,this.#r[i]=void 0,i===this.#u)this.#u=this.#_[i];else if(i===this.#b)this.#b=this.#w[i];else{let h=this.#_[i];this.#w[h]=this.#w[i];let a=this.#w[i];this.#_[a]=this.#_[i]}this.#o--,this.#v.push(i)}}if(this.#s&&this.#y?.length){let i=this.#y,r;for(;r=i?.shift();)this.#n?.(...r)}return s}clear(){return this.#Z("delete")}#Z(t){for(let e of this.#R({allowStale:!0})){let s=this.#r[e];if(this.#f(s))s.__abortController.abort(new Error("deleted"));else{let i=this.#l[e];this.#C&&this.#e?.(s,i,t),this.#s&&this.#y?.push([s,i,t])}}if(this.#a.clear(),this.#r.fill(void 0),this.#l.fill(void 0),this.#g&&this.#O){this.#g.fill(0),this.#O.fill(0);for(let e of this.#S??[])e!==void 0&&clearTimeout(e);this.#S?.fill(void 0)}if(this.#E&&this.#E.fill(0),this.#b=0,this.#u=0,this.#v.length=0,this.#m=0,this.#o=0,this.#s&&this.#y){let e=this.#y,s;for(;s=e?.shift();)this.#n?.(...s)}}};Ut.LRUCache=wr});var $e=x(j=>{"use strict";var br=j&&j.__importDefault||function(n){return n&&n.__esModule?n:{default:n}};Object.defineProperty(j,"__esModule",{value:!0});j.Minipass=j.isWritable=j.isReadable=j.isStream=void 0;var Gs=typeof process=="object"&&process?process:{stdout:null,stderr:null},Ue=__webpack_require__(/*! node:events */ "node:events"),qs=br(__webpack_require__(/*! node:stream */ "node:stream")),yr=__webpack_require__(/*! node:string_decoder */ "node:string_decoder"),Sr=n=>!!n&&typeof n=="object"&&(n instanceof Yt||n instanceof qs.default||(0,j.isReadable)(n)||(0,j.isWritable)(n));j.isStream=Sr;var vr=n=>!!n&&typeof n=="object"&&n instanceof Ue.EventEmitter&&typeof n.pipe=="function"&&n.pipe!==qs.default.Writable.prototype.pipe;j.isReadable=vr;var _r=n=>!!n&&typeof n=="object"&&n instanceof Ue.EventEmitter&&typeof n.write=="function"&&typeof n.end=="function";j.isWritable=_r;var H=Symbol("EOF"),X=Symbol("maybeEmitEnd"),J=Symbol("emittedEnd"),$t=Symbol("emittingEnd"),pt=Symbol("emittedError"),qt=Symbol("closed"),Is=Symbol("read"),Ht=Symbol("flush"),Us=Symbol("flushChunk"),W=Symbol("encoding"),ot=Symbol("decoder"),A=Symbol("flowing"),mt=Symbol("paused"),at=Symbol("resume"),k=Symbol("buffer"),F=Symbol("pipes"),M=Symbol("bufferLength"),Le=Symbol("bufferPush"),Xt=Symbol("bufferShift"),P=Symbol("objectMode"),C=Symbol("destroyed"),We=Symbol("error"),Be=Symbol("emitData"),$s=Symbol("emitEnd"),ze=Symbol("emitEnd2"),G=Symbol("async"),Ge=Symbol("abort"),Kt=Symbol("aborted"),gt=Symbol("signal"),st=Symbol("dataListeners"),D=Symbol("discarded"),wt=n=>Promise.resolve().then(n),Er=n=>n(),Or=n=>n==="end"||n==="finish"||n==="prefinish",Cr=n=>n instanceof ArrayBuffer||!!n&&typeof n=="object"&&n.constructor&&n.constructor.name==="ArrayBuffer"&&n.byteLength>=0,Ar=n=>!Buffer.isBuffer(n)&&ArrayBuffer.isView(n),Vt=class{src;dest;opts;ondrain;constructor(t,e,s){this.src=t,this.dest=e,this.opts=s,this.ondrain=()=>t[at](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(t){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},Ie=class extends Vt{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(t,e,s){super(t,e,s),this.proxyErrors=i=>this.dest.emit("error",i),t.on("error",this.proxyErrors)}},kr=n=>!!n.objectMode,Mr=n=>!n.objectMode&&!!n.encoding&&n.encoding!=="buffer",Yt=class extends Ue.EventEmitter{[A]=!1;[mt]=!1;[F]=[];[k]=[];[P];[W];[G];[ot];[H]=!1;[J]=!1;[$t]=!1;[qt]=!1;[pt]=null;[M]=0;[C]=!1;[gt];[Kt]=!1;[st]=0;[D]=!1;writable=!0;readable=!0;constructor(...t){let e=t[0]||{};if(super(),e.objectMode&&typeof e.encoding=="string")throw new TypeError("Encoding and objectMode may not be used together");kr(e)?(this[P]=!0,this[W]=null):Mr(e)?(this[W]=e.encoding,this[P]=!1):(this[P]=!1,this[W]=null),this[G]=!!e.async,this[ot]=this[W]?new yr.StringDecoder(this[W]):null,e&&e.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:()=>this[k]}),e&&e.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:()=>this[F]});let{signal:s}=e;s&&(this[gt]=s,s.aborted?this[Ge]():s.addEventListener("abort",()=>this[Ge]()))}get bufferLength(){return this[M]}get encoding(){return this[W]}set encoding(t){throw new Error("Encoding must be set at instantiation time")}setEncoding(t){throw new Error("Encoding must be set at instantiation time")}get objectMode(){return this[P]}set objectMode(t){throw new Error("objectMode must be set at instantiation time")}get async(){return this[G]}set async(t){this[G]=this[G]||!!t}[Ge](){this[Kt]=!0,this.emit("abort",this[gt]?.reason),this.destroy(this[gt]?.reason)}get aborted(){return this[Kt]}set aborted(t){}write(t,e,s){if(this[Kt])return!1;if(this[H])throw new Error("write after end");if(this[C])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;typeof e=="function"&&(s=e,e="utf8"),e||(e="utf8");let i=this[G]?wt:Er;if(!this[P]&&!Buffer.isBuffer(t)){if(Ar(t))t=Buffer.from(t.buffer,t.byteOffset,t.byteLength);else if(Cr(t))t=Buffer.from(t);else if(typeof t!="string")throw new Error("Non-contiguous data written to non-objectMode stream")}return this[P]?(this[A]&&this[M]!==0&&this[Ht](!0),this[A]?this.emit("data",t):this[Le](t),this[M]!==0&&this.emit("readable"),s&&i(s),this[A]):t.length?(typeof t=="string"&&!(e===this[W]&&!this[ot]?.lastNeed)&&(t=Buffer.from(t,e)),Buffer.isBuffer(t)&&this[W]&&(t=this[ot].write(t)),this[A]&&this[M]!==0&&this[Ht](!0),this[A]?this.emit("data",t):this[Le](t),this[M]!==0&&this.emit("readable"),s&&i(s),this[A]):(this[M]!==0&&this.emit("readable"),s&&i(s),this[A])}read(t){if(this[C])return null;if(this[D]=!1,this[M]===0||t===0||t&&t>this[M])return this[X](),null;this[P]&&(t=null),this[k].length>1&&!this[P]&&(this[k]=[this[W]?this[k].join(""):Buffer.concat(this[k],this[M])]);let e=this[Is](t||null,this[k][0]);return this[X](),e}[Is](t,e){if(this[P])this[Xt]();else{let s=e;t===s.length||t===null?this[Xt]():typeof s=="string"?(this[k][0]=s.slice(t),e=s.slice(0,t),this[M]-=t):(this[k][0]=s.subarray(t),e=s.subarray(0,t),this[M]-=t)}return this.emit("data",e),!this[k].length&&!this[H]&&this.emit("drain"),e}end(t,e,s){return typeof t=="function"&&(s=t,t=void 0),typeof e=="function"&&(s=e,e="utf8"),t!==void 0&&this.write(t,e),s&&this.once("end",s),this[H]=!0,this.writable=!1,(this[A]||!this[mt])&&this[X](),this}[at](){this[C]||(!this[st]&&!this[F].length&&(this[D]=!0),this[mt]=!1,this[A]=!0,this.emit("resume"),this[k].length?this[Ht]():this[H]?this[X]():this.emit("drain"))}resume(){return this[at]()}pause(){this[A]=!1,this[mt]=!0,this[D]=!1}get destroyed(){return this[C]}get flowing(){return this[A]}get paused(){return this[mt]}[Le](t){this[P]?this[M]+=1:this[M]+=t.length,this[k].push(t)}[Xt](){return this[P]?this[M]-=1:this[M]-=this[k][0].length,this[k].shift()}[Ht](t=!1){do;while(this[Us](this[Xt]())&&this[k].length);!t&&!this[k].length&&!this[H]&&this.emit("drain")}[Us](t){return this.emit("data",t),this[A]}pipe(t,e){if(this[C])return t;this[D]=!1;let s=this[J];return e=e||{},t===Gs.stdout||t===Gs.stderr?e.end=!1:e.end=e.end!==!1,e.proxyErrors=!!e.proxyErrors,s?e.end&&t.end():(this[F].push(e.proxyErrors?new Ie(this,t,e):new Vt(this,t,e)),this[G]?wt(()=>this[at]()):this[at]()),t}unpipe(t){let e=this[F].find(s=>s.dest===t);e&&(this[F].length===1?(this[A]&&this[st]===0&&(this[A]=!1),this[F]=[]):this[F].splice(this[F].indexOf(e),1),e.unpipe())}addListener(t,e){return this.on(t,e)}on(t,e){let s=super.on(t,e);if(t==="data")this[D]=!1,this[st]++,!this[F].length&&!this[A]&&this[at]();else if(t==="readable"&&this[M]!==0)super.emit("readable");else if(Or(t)&&this[J])super.emit(t),this.removeAllListeners(t);else if(t==="error"&&this[pt]){let i=e;this[G]?wt(()=>i.call(this,this[pt])):i.call(this,this[pt])}return s}removeListener(t,e){return this.off(t,e)}off(t,e){let s=super.off(t,e);return t==="data"&&(this[st]=this.listeners("data").length,this[st]===0&&!this[D]&&!this[F].length&&(this[A]=!1)),s}removeAllListeners(t){let e=super.removeAllListeners(t);return(t==="data"||t===void 0)&&(this[st]=0,!this[D]&&!this[F].length&&(this[A]=!1)),e}get emittedEnd(){return this[J]}[X](){!this[$t]&&!this[J]&&!this[C]&&this[k].length===0&&this[H]&&(this[$t]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[qt]&&this.emit("close"),this[$t]=!1)}emit(t,...e){let s=e[0];if(t!=="error"&&t!=="close"&&t!==C&&this[C])return!1;if(t==="data")return!this[P]&&!s?!1:this[G]?(wt(()=>this[Be](s)),!0):this[Be](s);if(t==="end")return this[$s]();if(t==="close"){if(this[qt]=!0,!this[J]&&!this[C])return!1;let r=super.emit("close");return this.removeAllListeners("close"),r}else if(t==="error"){this[pt]=s,super.emit(We,s);let r=!this[gt]||this.listeners("error").length?super.emit("error",s):!1;return this[X](),r}else if(t==="resume"){let r=super.emit("resume");return this[X](),r}else if(t==="finish"||t==="prefinish"){let r=super.emit(t);return this.removeAllListeners(t),r}let i=super.emit(t,...e);return this[X](),i}[Be](t){for(let s of this[F])s.dest.write(t)===!1&&this.pause();let e=this[D]?!1:super.emit("data",t);return this[X](),e}[$s](){return this[J]?!1:(this[J]=!0,this.readable=!1,this[G]?(wt(()=>this[ze]()),!0):this[ze]())}[ze](){if(this[ot]){let e=this[ot].end();if(e){for(let s of this[F])s.dest.write(e);this[D]||super.emit("data",e)}}for(let e of this[F])e.end();let t=super.emit("end");return this.removeAllListeners("end"),t}async collect(){let t=Object.assign([],{dataLength:0});this[P]||(t.dataLength=0);let e=this.promise();return this.on("data",s=>{t.push(s),this[P]||(t.dataLength+=s.length)}),await e,t}async concat(){if(this[P])throw new Error("cannot concat in objectMode");let t=await this.collect();return this[W]?t.join(""):Buffer.concat(t,t.dataLength)}async promise(){return new Promise((t,e)=>{this.on(C,()=>e(new Error("stream destroyed"))),this.on("error",s=>e(s)),this.on("end",()=>t())})}[Symbol.asyncIterator](){this[D]=!1;let t=!1,e=async()=>(this.pause(),t=!0,{value:void 0,done:!0});return{next:()=>{if(t)return e();let i=this.read();if(i!==null)return Promise.resolve({done:!1,value:i});if(this[H])return e();let r,h,a=u=>{this.off("data",o),this.off("end",l),this.off(C,c),e(),h(u)},o=u=>{this.off("error",a),this.off("end",l),this.off(C,c),this.pause(),r({value:u,done:!!this[H]})},l=()=>{this.off("error",a),this.off("data",o),this.off(C,c),e(),r({done:!0,value:void 0})},c=()=>a(new Error("stream destroyed"));return new Promise((u,p)=>{h=p,r=u,this.once(C,c),this.once("error",a),this.once("end",l),this.once("data",o)})},throw:e,return:e,[Symbol.asyncIterator](){return this},[Symbol.asyncDispose]:async()=>{}}}[Symbol.iterator](){this[D]=!1;let t=!1,e=()=>(this.pause(),this.off(We,e),this.off(C,e),this.off("end",e),t=!0,{done:!0,value:void 0}),s=()=>{if(t)return e();let i=this.read();return i===null?e():{done:!1,value:i}};return this.once("end",e),this.once(We,e),this.once(C,e),{next:s,throw:e,return:e,[Symbol.iterator](){return this},[Symbol.dispose]:()=>{}}}destroy(t){if(this[C])return t?this.emit("error",t):this.emit(C),this;this[C]=!0,this[D]=!0,this[k].length=0,this[M]=0;let e=this;return typeof e.close=="function"&&!this[qt]&&e.close(),t?this.emit("error",t):this.emit(C),this}static get isStream(){return j.isStream}};j.Minipass=Yt});var ni=x(E=>{"use strict";var xr=E&&E.__createBinding||(Object.create?(function(n,t,e,s){s===void 0&&(s=e);var i=Object.getOwnPropertyDescriptor(t,e);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[e]}}),Object.defineProperty(n,s,i)}):(function(n,t,e,s){s===void 0&&(s=e),n[s]=t[e]})),Rr=E&&E.__setModuleDefault||(Object.create?(function(n,t){Object.defineProperty(n,"default",{enumerable:!0,value:t})}):function(n,t){n.default=t}),Pr=E&&E.__importStar||(function(){var n=function(t){return n=Object.getOwnPropertyNames||function(e){var s=[];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(s[s.length]=i);return s},n(t)};return function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var s=n(t),i=0;i<s.length;i++)s[i]!=="default"&&xr(e,t,s[i]);return Rr(e,t),e}})();Object.defineProperty(E,"__esModule",{value:!0});E.PathScurry=E.Path=E.PathScurryDarwin=E.PathScurryPosix=E.PathScurryWin32=E.PathScurryBase=E.PathPosix=E.PathWin32=E.PathBase=E.ChildrenCache=E.ResolveCache=void 0;var re=zs(),ee=__webpack_require__(/*! node:path */ "node:path"),Tr=__webpack_require__(/*! node:url */ "node:url"),yt=__webpack_require__(/*! fs */ "fs"),Fr=Pr(__webpack_require__(/*! node:fs */ "node:fs")),jr=yt.realpathSync.native,Zt=__webpack_require__(/*! node:fs/promises */ "node:fs/promises"),Hs=$e(),St={lstatSync:yt.lstatSync,readdir:yt.readdir,readdirSync:yt.readdirSync,readlinkSync:yt.readlinkSync,realpathSync:jr,promises:{lstat:Zt.lstat,readdir:Zt.readdir,readlink:Zt.readlink,realpath:Zt.realpath}},Js=n=>!n||n===St||n===Fr?St:{...St,...n,promises:{...St.promises,...n.promises}},Dr=/^\\\\\?\\([a-z]:)\\?$/i,Nr=/^\\\\\?\\UNC\\([^\\]+\\[^\\]+)\\?$/i,Lr=/^\\\\[^\\?]+\\[^\\]+$/,Xs=n=>n.replace(/\//g,"\\").replace(Dr,"$1\\").replace(Nr,"\\\\$1\\").replace(Lr,"$&\\"),Wr=/^[\\/]{2}\?[\\/]unc[\\/][^\\/]+[\\/][^\\/]+(?:[\\/]|$)/i,Br=/^[\\/]{2}\?[\\/](?=[a-z]:)/i,zr=/^[\\/]{2}\?[\\/]unc(?=[\\/][^\\/]+[\\/][^\\/])/i,Gr=/[\\/]/,L=0,Qs=1,ti=2,I=4,ei=6,si=8,it=10,ii=12,N=15,bt=~N,qe=16,Ks=32,vt=64,B=128,Jt=256,te=512,Vs=vt|B|te,Ir=1023,He=n=>n.isFile()?si:n.isDirectory()?I:n.isSymbolicLink()?it:n.isCharacterDevice()?ti:n.isBlockDevice()?ei:n.isSocket()?ii:n.isFIFO()?Qs:L,Ys=new re.LRUCache({max:2**12}),_t=n=>{let t=Ys.get(n);if(t)return t;let e=n.normalize("NFKD");return Ys.set(n,e),e},Zs=new re.LRUCache({max:2**12}),Qt=n=>{let t=Zs.get(n);if(t)return t;let e=_t(n.toLowerCase());return Zs.set(n,e),e},Et=class extends re.LRUCache{constructor(){super({max:256})}};E.ResolveCache=Et;var se=class extends re.LRUCache{constructor(t=16*1024){super({maxSize:t,sizeCalculation:e=>e.length+1})}};E.ChildrenCache=se;var ri=Symbol("PathScurry setAsCwd"),R=class{name;root;roots;parent;nocase;isCWD=!1;#t;#i;get dev(){return this.#i}#e;get mode(){return this.#e}#h;get nlink(){return this.#h}#n;get uid(){return this.#n}#d;get gid(){return this.#d}#c;get rdev(){return this.#c}#p;get blksize(){return this.#p}#o;get ino(){return this.#o}#m;get size(){return this.#m}#a;get blocks(){return this.#a}#l;get atimeMs(){return this.#l}#r;get mtimeMs(){return this.#r}#w;get ctimeMs(){return this.#w}#_;get birthtimeMs(){return this.#_}#b;get atime(){return this.#b}#u;get mtime(){return this.#u}#v;get ctime(){return this.#v}#y;get birthtime(){return this.#y}#E;#O;#g;#S;#C;#M;#s;#P;#T;#k;get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}constructor(t,e=L,s,i,r,h,a){this.name=t,this.#E=r?Qt(t):_t(t),this.#s=e&Ir,this.nocase=r,this.roots=i,this.root=s||this,this.#P=h,this.#g=a.fullpath,this.#C=a.relative,this.#M=a.relativePosix,this.parent=a.parent,this.parent?this.#t=this.parent.#t:this.#t=Js(a.fs)}get fs(){return this.#t}depth(){return this.#O!==void 0?this.#O:this.parent?this.#O=this.parent.depth()+1:this.#O=0}childrenCache(){return this.#P}resolve(t){if(!t)return this;let e=this.getRootString(t),i=t.substring(e.length).split(this.splitSep);return e?this.getRoot(e).#F(i):this.#F(i)}#F(t){let e=this;for(let s of t)e=e.child(s);return e}children(){let t=this.#P.get(this);if(t)return t;let e=Object.assign([],{provisional:0});return this.#P.set(this,e),this.#s&=~qe,e}child(t,e){if(t===""||t===".")return this;if(t==="..")return this.parent||this;let s=this.children(),i=this.nocase?Qt(t):_t(t);for(let o of s)if(o.#E===i)return o;let r=this.parent?this.sep:"",h=this.#g?this.#g+r+t:void 0,a=this.newChild(t,L,{...e,parent:this,fullpath:h});return this.canReaddir()||(a.#s|=B),s.push(a),a}relative(){if(this.isCWD)return"";if(this.#C!==void 0)return this.#C;let t=this.name,e=this.parent;if(!e)return this.#C=this.name;let s=e.relative();return s+(!s||!e.parent?"":this.sep)+t}relativePosix(){if(this.sep==="/")return this.relative();if(this.isCWD)return"";if(this.#M!==void 0)return this.#M;let t=this.name,e=this.parent;if(!e)return this.#M=this.fullpathPosix();let s=e.relativePosix();return s+(!s||!e.parent?"":"/")+t}fullpath(){if(this.#g!==void 0)return this.#g;let t=this.name,e=this.parent;if(!e)return this.#g=this.name;let i=e.fullpath()+(e.parent?this.sep:"")+t;return this.#g=i}fullpathPosix(){if(this.#S!==void 0)return this.#S;if(this.sep==="/")return this.#S=this.fullpath();if(!this.parent){let i=this.fullpath().replace(/\\/g,"/");return/^[a-z]:\//i.test(i)?this.#S=`//?/${i}`:this.#S=i}let t=this.parent,e=t.fullpathPosix(),s=e+(!e||!t.parent?"":"/")+this.name;return this.#S=s}isUnknown(){return(this.#s&N)===L}isType(t){return this[`is${t}`]()}getType(){return this.isUnknown()?"Unknown":this.isDirectory()?"Directory":this.isFile()?"File":this.isSymbolicLink()?"SymbolicLink":this.isFIFO()?"FIFO":this.isCharacterDevice()?"CharacterDevice":this.isBlockDevice()?"BlockDevice":this.isSocket()?"Socket":"Unknown"}isFile(){return(this.#s&N)===si}isDirectory(){return(this.#s&N)===I}isCharacterDevice(){return(this.#s&N)===ti}isBlockDevice(){return(this.#s&N)===ei}isFIFO(){return(this.#s&N)===Qs}isSocket(){return(this.#s&N)===ii}isSymbolicLink(){return(this.#s&it)===it}lstatCached(){return this.#s&Ks?this:void 0}readlinkCached(){return this.#T}realpathCached(){return this.#k}readdirCached(){let t=this.children();return t.slice(0,t.provisional)}canReadlink(){if(this.#T)return!0;if(!this.parent)return!1;let t=this.#s&N;return!(t!==L&&t!==it||this.#s&Jt||this.#s&B)}calledReaddir(){return!!(this.#s&qe)}isENOENT(){return!!(this.#s&B)}isNamed(t){return this.nocase?this.#E===Qt(t):this.#E===_t(t)}async readlink(){let t=this.#T;if(t)return t;if(this.canReadlink()&&this.parent)try{let e=await this.#t.promises.readlink(this.fullpath()),s=(await this.parent.realpath())?.resolve(e);if(s)return this.#T=s}catch(e){this.#R(e.code);return}}readlinkSync(){let t=this.#T;if(t)return t;if(this.canReadlink()&&this.parent)try{let e=this.#t.readlinkSync(this.fullpath()),s=this.parent.realpathSync()?.resolve(e);if(s)return this.#T=s}catch(e){this.#R(e.code);return}}#B(t){this.#s|=qe;for(let e=t.provisional;e<t.length;e++){let s=t[e];s&&s.#A()}}#A(){this.#s&B||(this.#s=(this.#s|B)&bt,this.#$())}#$(){let t=this.children();t.provisional=0;for(let e of t)e.#A()}#D(){this.#s|=te,this.#j()}#j(){if(this.#s&vt)return;let t=this.#s;(t&N)===I&&(t&=bt),this.#s=t|vt,this.#$()}#z(t=""){t==="ENOTDIR"||t==="EPERM"?this.#j():t==="ENOENT"?this.#A():this.children().provisional=0}#x(t=""){t==="ENOTDIR"?this.parent.#j():t==="ENOENT"&&this.#A()}#R(t=""){let e=this.#s;e|=Jt,t==="ENOENT"&&(e|=B),(t==="EINVAL"||t==="UNKNOWN")&&(e&=bt),this.#s=e,t==="ENOTDIR"&&this.parent&&this.parent.#j()}#G(t,e){return this.#U(t,e)||this.#N(t,e)}#N(t,e){let s=He(t),i=this.newChild(t.name,s,{parent:this}),r=i.#s&N;return r!==I&&r!==it&&r!==L&&(i.#s|=vt),e.unshift(i),e.provisional++,i}#U(t,e){for(let s=e.provisional;s<e.length;s++){let i=e[s];if((this.nocase?Qt(t.name):_t(t.name))===i.#E)return this.#V(t,i,s,e)}}#V(t,e,s,i){let r=e.name;return e.#s=e.#s&bt|He(t),r!==t.name&&(e.name=t.name),s!==i.provisional&&(s===i.length-1?i.pop():i.splice(s,1),i.unshift(e)),i.provisional++,e}async lstat(){if((this.#s&B)===0)try{return this.#q(await this.#t.promises.lstat(this.fullpath())),this}catch(t){this.#x(t.code)}}lstatSync(){if((this.#s&B)===0)try{return this.#q(this.#t.lstatSync(this.fullpath())),this}catch(t){this.#x(t.code)}}#q(t){let{atime:e,atimeMs:s,birthtime:i,birthtimeMs:r,blksize:h,blocks:a,ctime:o,ctimeMs:l,dev:c,gid:u,ino:p,mode:d,mtime:g,mtimeMs:f,nlink:b,rdev:m,size:y,uid:_}=t;this.#b=e,this.#l=s,this.#y=i,this.#_=r,this.#p=h,this.#a=a,this.#v=o,this.#w=l,this.#i=c,this.#d=u,this.#o=p,this.#e=d,this.#u=g,this.#r=f,this.#h=b,this.#c=m,this.#m=y,this.#n=_;let v=He(t);this.#s=this.#s&bt|v|Ks,v!==L&&v!==I&&v!==it&&(this.#s|=vt)}#L=[];#f=!1;#H(t){this.#f=!1;let e=this.#L.slice();this.#L.length=0,e.forEach(s=>s(null,t))}readdirCB(t,e=!1){if(!this.canReaddir()){e?t(null,[]):queueMicrotask(()=>t(null,[]));return}let s=this.children();if(this.calledReaddir()){let r=s.slice(0,s.provisional);e?t(null,r):queueMicrotask(()=>t(null,r));return}if(this.#L.push(t),this.#f)return;this.#f=!0;let i=this.fullpath();this.#t.readdir(i,{withFileTypes:!0},(r,h)=>{if(r)this.#z(r.code),s.provisional=0;else{for(let a of h)this.#G(a,s);this.#B(s)}this.#H(s.slice(0,s.provisional))})}#I;async readdir(){if(!this.canReaddir())return[];let t=this.children();if(this.calledReaddir())return t.slice(0,t.provisional);let e=this.fullpath();if(this.#I)await this.#I;else{let s=()=>{};this.#I=new Promise(i=>s=i);try{for(let i of await this.#t.promises.readdir(e,{withFileTypes:!0}))this.#G(i,t);this.#B(t)}catch(i){this.#z(i.code),t.provisional=0}this.#I=void 0,s()}return t.slice(0,t.provisional)}readdirSync(){if(!this.canReaddir())return[];let t=this.children();if(this.calledReaddir())return t.slice(0,t.provisional);let e=this.fullpath();try{for(let s of this.#t.readdirSync(e,{withFileTypes:!0}))this.#G(s,t);this.#B(t)}catch(s){this.#z(s.code),t.provisional=0}return t.slice(0,t.provisional)}canReaddir(){if(this.#s&Vs)return!1;let t=N&this.#s;return t===L||t===I||t===it}shouldWalk(t,e){return(this.#s&I)===I&&!(this.#s&Vs)&&!t.has(this)&&(!e||e(this))}async realpath(){if(this.#k)return this.#k;if(!((te|Jt|B)&this.#s))try{let t=await this.#t.promises.realpath(this.fullpath());return this.#k=this.resolve(t)}catch{this.#D()}}realpathSync(){if(this.#k)return this.#k;if(!((te|Jt|B)&this.#s))try{let t=this.#t.realpathSync(this.fullpath());return this.#k=this.resolve(t)}catch{this.#D()}}[ri](t){if(t===this)return;t.isCWD=!1,this.isCWD=!0;let e=new Set([]),s=[],i=this;for(;i&&i.parent;)e.add(i),i.#C=s.join(this.sep),i.#M=s.join("/"),i=i.parent,s.push("..");for(i=t;i&&i.parent&&!e.has(i);)i.#C=void 0,i.#M=void 0,i=i.parent}};E.PathBase=R;var Ot=class n extends R{sep="\\";splitSep=Gr;constructor(t,e=L,s,i,r,h,a){super(t,e,s,i,r,h,a)}newChild(t,e=L,s={}){return new n(t,e,this.root,this.roots,this.nocase,this.childrenCache(),s)}getRootString(t){return Wr.exec(t)?.[0]??ee.win32.parse(t).root}getRoot(t){if(t=Xs(t.toUpperCase()),t===this.root.name||/^[\\/]$/.test(t))return this.root;for(let[e,s]of Object.entries(this.roots))if(this.sameRoot(t,e))return this.roots[t]=s;return this.roots[t]=new kt(t,{nocase:this.nocase,fs:this.fs}).root}sameRoot(t,e=this.root.name){return Xs(t.toUpperCase())===e}};E.PathWin32=Ot;var Ct=class n extends R{splitSep="/";sep="/";constructor(t,e=L,s,i,r,h,a){super(t,e,s,i,r,h,a)}getRootString(t){return t.startsWith("/")?"/":""}getRoot(t){return this.root}newChild(t,e=L,s={}){return new n(t,e,this.root,this.roots,this.nocase,this.childrenCache(),s)}};E.PathPosix=Ct;var At=class{root;rootPath;roots;cwd;#t;#i;#e;nocase;#h;constructor(t=process.cwd(),e,s,{nocase:i,childrenCacheSize:r=16*1024,fs:h=St}={}){this.#h=Js(h),(t instanceof URL||t.startsWith("file://"))&&(t=(0,Tr.fileURLToPath)(t));let a=e.resolve(t);this.roots=Object.create(null),this.rootPath=this.parseRootPath(a),this.#t=new Et,this.#i=new Et,this.#e=new se(r);let o=a.substring(this.rootPath.length).split(s);if(o.length===1&&!o[0]&&o.pop(),i===void 0)throw new TypeError("must provide nocase setting to PathScurryBase ctor");this.nocase=i,this.root=this.newRoot(this.#h),this.roots[this.rootPath]=this.root;let l=this.root,c=o.length-1,u=e.sep,p=this.rootPath,d=!1;for(let g of o){let f=c--;l=l.child(g,{relative:new Array(f).fill("..").join(u),relativePosix:new Array(f).fill("..").join("/"),fullpath:p+=(d?"":u)+g}),d=!0}this.cwd=l}depth(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.depth()}childrenCache(){return this.#e}resolve(...t){let e="";for(let r=t.length-1;r>=0;r--){let h=t[r];if(!(!h||h===".")&&(e=e?`${h}/${e}`:h,this.isAbsolute(h)))break}let s=this.#t.get(e);if(s!==void 0)return s;let i=this.cwd.resolve(e).fullpath();return this.#t.set(e,i),i}resolvePosix(...t){let e="";for(let r=t.length-1;r>=0;r--){let h=t[r];if(!(!h||h===".")&&(e=e?`${h}/${e}`:h,this.isAbsolute(h)))break}let s=this.#i.get(e);if(s!==void 0)return s;let i=this.cwd.resolve(e).fullpathPosix();return this.#i.set(e,i),i}relative(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.relative()}relativePosix(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.relativePosix()}basename(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.name}dirname(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),(t.parent||t).fullpath()}async readdir(t=this.cwd,e={withFileTypes:!0}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof R||(e=t,t=this.cwd);let{withFileTypes:s}=e;if(t.canReaddir()){let i=await t.readdir();return s?i:i.map(r=>r.name)}else return[]}readdirSync(t=this.cwd,e={withFileTypes:!0}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof R||(e=t,t=this.cwd);let{withFileTypes:s=!0}=e;return t.canReaddir()?s?t.readdirSync():t.readdirSync().map(i=>i.name):[]}async lstat(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.lstat()}lstatSync(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.lstatSync()}async readlink(t=this.cwd,{withFileTypes:e}={withFileTypes:!1}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof R||(e=t.withFileTypes,t=this.cwd);let s=await t.readlink();return e?s:s?.fullpath()}readlinkSync(t=this.cwd,{withFileTypes:e}={withFileTypes:!1}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof R||(e=t.withFileTypes,t=this.cwd);let s=t.readlinkSync();return e?s:s?.fullpath()}async realpath(t=this.cwd,{withFileTypes:e}={withFileTypes:!1}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof R||(e=t.withFileTypes,t=this.cwd);let s=await t.realpath();return e?s:s?.fullpath()}realpathSync(t=this.cwd,{withFileTypes:e}={withFileTypes:!1}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof R||(e=t.withFileTypes,t=this.cwd);let s=t.realpathSync();return e?s:s?.fullpath()}async walk(t=this.cwd,e={}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof R||(e=t,t=this.cwd);let{withFileTypes:s=!0,follow:i=!1,filter:r,walkFilter:h}=e,a=[];(!r||r(t))&&a.push(s?t:t.fullpath());let o=new Set,l=(u,p)=>{o.add(u),u.readdirCB((d,g)=>{if(d)return p(d);let f=g.length;if(!f)return p();let b=()=>{--f===0&&p()};for(let m of g)(!r||r(m))&&a.push(s?m:m.fullpath()),i&&m.isSymbolicLink()?m.realpath().then(y=>y?.isUnknown()?y.lstat():y).then(y=>y?.shouldWalk(o,h)?l(y,b):b()):m.shouldWalk(o,h)?l(m,b):b()},!0)},c=t;return new Promise((u,p)=>{l(c,d=>{if(d)return p(d);u(a)})})}walkSync(t=this.cwd,e={}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof R||(e=t,t=this.cwd);let{withFileTypes:s=!0,follow:i=!1,filter:r,walkFilter:h}=e,a=[];(!r||r(t))&&a.push(s?t:t.fullpath());let o=new Set([t]);for(let l of o){let c=l.readdirSync();for(let u of c){(!r||r(u))&&a.push(s?u:u.fullpath());let p=u;if(u.isSymbolicLink()){if(!(i&&(p=u.realpathSync())))continue;p.isUnknown()&&p.lstatSync()}p.shouldWalk(o,h)&&o.add(p)}}return a}[Symbol.asyncIterator](){return this.iterate()}iterate(t=this.cwd,e={}){return typeof t=="string"?t=this.cwd.resolve(t):t instanceof R||(e=t,t=this.cwd),this.stream(t,e)[Symbol.asyncIterator]()}[Symbol.iterator](){return this.iterateSync()}*iterateSync(t=this.cwd,e={}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof R||(e=t,t=this.cwd);let{withFileTypes:s=!0,follow:i=!1,filter:r,walkFilter:h}=e;(!r||r(t))&&(yield s?t:t.fullpath());let a=new Set([t]);for(let o of a){let l=o.readdirSync();for(let c of l){(!r||r(c))&&(yield s?c:c.fullpath());let u=c;if(c.isSymbolicLink()){if(!(i&&(u=c.realpathSync())))continue;u.isUnknown()&&u.lstatSync()}u.shouldWalk(a,h)&&a.add(u)}}}stream(t=this.cwd,e={}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof R||(e=t,t=this.cwd);let{withFileTypes:s=!0,follow:i=!1,filter:r,walkFilter:h}=e,a=new Hs.Minipass({objectMode:!0});(!r||r(t))&&a.write(s?t:t.fullpath());let o=new Set,l=[t],c=0,u=()=>{let p=!1;for(;!p;){let d=l.shift();if(!d){c===0&&a.end();return}c++,o.add(d);let g=(b,m,y=!1)=>{if(b)return a.emit("error",b);if(i&&!y){let _=[];for(let v of m)v.isSymbolicLink()&&_.push(v.realpath().then(S=>S?.isUnknown()?S.lstat():S));if(_.length){Promise.all(_).then(()=>g(null,m,!0));return}}for(let _ of m)_&&(!r||r(_))&&(a.write(s?_:_.fullpath())||(p=!0));c--;for(let _ of m){let v=_.realpathCached()||_;v.shouldWalk(o,h)&&l.push(v)}p&&!a.flowing?a.once("drain",u):f||u()},f=!0;d.readdirCB(g,!0),f=!1}};return u(),a}streamSync(t=this.cwd,e={}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof R||(e=t,t=this.cwd);let{withFileTypes:s=!0,follow:i=!1,filter:r,walkFilter:h}=e,a=new Hs.Minipass({objectMode:!0}),o=new Set;(!r||r(t))&&a.write(s?t:t.fullpath());let l=[t],c=0,u=()=>{let p=!1;for(;!p;){let d=l.shift();if(!d){c===0&&a.end();return}c++,o.add(d);let g=d.readdirSync();for(let f of g)(!r||r(f))&&(a.write(s?f:f.fullpath())||(p=!0));c--;for(let f of g){let b=f;if(f.isSymbolicLink()){if(!(i&&(b=f.realpathSync())))continue;b.isUnknown()&&b.lstatSync()}b.shouldWalk(o,h)&&l.push(b)}}p&&!a.flowing&&a.once("drain",u)};return u(),a}chdir(t=this.cwd){let e=this.cwd;this.cwd=typeof t=="string"?this.cwd.resolve(t):t,this.cwd[ri](e)}};E.PathScurryBase=At;var kt=class extends At{sep="\\";constructor(t=process.cwd(),e={}){let{nocase:s=!0}=e;typeof t=="string"&&!t.startsWith("file://")&&(t=t.replace(Br,"").replace(zr,"\\")),super(t,ee.win32,"\\",{...e,nocase:s}),this.nocase=s;for(let i=this.cwd;i;i=i.parent)i.nocase=this.nocase}parseRootPath(t){return ee.win32.parse(t).root.toUpperCase()}newRoot(t){return new Ot(this.rootPath,I,void 0,this.roots,this.nocase,this.childrenCache(),{fs:t})}isAbsolute(t){return t.startsWith("/")||t.startsWith("\\")||/^[a-z]:(\/|\\)/i.test(t)}};E.PathScurryWin32=kt;var Mt=class extends At{sep="/";constructor(t=process.cwd(),e={}){let{nocase:s=!1}=e;super(t,ee.posix,"/",{...e,nocase:s}),this.nocase=s}parseRootPath(t){return"/"}newRoot(t){return new Ct(this.rootPath,I,void 0,this.roots,this.nocase,this.childrenCache(),{fs:t})}isAbsolute(t){return t.startsWith("/")}};E.PathScurryPosix=Mt;var ie=class extends Mt{constructor(t=process.cwd(),e={}){let{nocase:s=!0}=e;super(t,{...e,nocase:s})}};E.PathScurryDarwin=ie;E.Path=process.platform==="win32"?Ot:Ct;E.PathScurry=process.platform==="win32"?kt:process.platform==="darwin"?ie:Mt});var Ke=x(ne=>{"use strict";Object.defineProperty(ne,"__esModule",{value:!0});ne.Pattern=void 0;var Ur=Y(),$r=n=>n.length>=1,qr=n=>n.length>=1,Hr=Symbol.for("nodejs.util.inspect.custom"),Xe=class n{#t;#i;#e;length;#h;#n;#d;#c;#p;#o;#m=!0;constructor(t,e,s,i){if(!$r(t))throw new TypeError("empty pattern list");if(!qr(e))throw new TypeError("empty glob list");if(e.length!==t.length)throw new TypeError("mismatched pattern list and glob list lengths");if(this.length=t.length,s<0||s>=this.length)throw new TypeError("index out of range");if(this.#t=t,this.#i=e,this.#e=s,this.#h=i,this.#e===0){if(this.isUNC()){let r=this.#a()?6:4,h=this.#t.slice(0,r),a=this.#i.slice(0,r),o=this.#t.slice(r),l=this.#i.slice(r);o[0]===""&&(o.shift(),l.shift());let c=[...h,""].join("/"),u=[...a,""].join("/");this.#t=[c,...o],this.#i=[u,...l],this.length=this.#t.length}else if(this.isDrive()||this.isAbsolute()){let[r,...h]=this.#t,[a,...o]=this.#i;h[0]===""&&(h.shift(),o.shift());let l=`${r}/`,c=`${a}/`;this.#t=[l,...h],this.#i=[c,...o],this.length=this.#t.length}}}[Hr](){return`Pattern <${this.#i.slice(this.#e).join("/")}>`}pattern(){return this.#t[this.#e]}isString(){return typeof this.#t[this.#e]=="string"}isGlobstar(){return this.#t[this.#e]===Ur.GLOBSTAR}isMatcher(){return typeof this.#t[this.#e]=="object"}globString(){return this.#d=this.#d||(this.#e===0?this.isAbsolute()?this.#i[0]+this.#i.slice(1).join("/"):this.#i.join("/"):this.#i.slice(this.#e).join("/"))}hasMore(){return this.length>this.#e+1}rest(){return this.#n!==void 0?this.#n:this.hasMore()?(this.#n=new n(this.#t,this.#i,this.#e+1,this.#h),this.#n.#o=this.#o,this.#n.#p=this.#p,this.#n.#c=this.#c,this.#n):this.#n=null}#a(){let t=this.#t;return t[2]==="?"&&typeof t[3]=="string"&&/^unc$/i.test(t[3])}isUNC(){let t=this.#t,e=this.#a()?4:2;return this.#p!==void 0?this.#p:this.#p=this.#h==="win32"&&this.#e===0&&t[0]===""&&t[1]===""&&typeof t[e]=="string"&&!!t[e]&&typeof t[e+1]=="string"&&!!t[e+1]}isDrive(){let t=this.#t;return this.#c!==void 0?this.#c:this.#c=this.#h==="win32"&&this.#e===0&&this.length>1&&typeof t[0]=="string"&&/^[a-z]:$/i.test(t[0])}isAbsolute(){let t=this.#t;return this.#o!==void 0?this.#o:this.#o=t[0]===""&&t.length>1||this.isDrive()||this.isUNC()}root(){let t=this.#t[0];return typeof t=="string"&&this.isAbsolute()&&this.#e===0?t:""}checkFollowGlobstar(){return!(this.#e===0||!this.isGlobstar()||!this.#m)}markFollowGlobstar(){return this.#e===0||!this.isGlobstar()||!this.#m?!1:(this.#m=!1,!0)}};ne.Pattern=Xe});var Ze=x(he=>{"use strict";Object.defineProperty(he,"__esModule",{value:!0});he.Ignore=void 0;var Ve=Y(),Xr=Ke(),Kr=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",Ye=class{relative;relativeChildren;absolute;absoluteChildren;platform;mmopts;slashRoot;constructor(t,{nobrace:e,nocase:s,noext:i,noglobstar:r,normalize:h,platform:a=Kr,root:o,windowsPathsNoEscape:l,allowWindowsEscape:c},u){this.relative=[],this.absolute=[],this.relativeChildren=[],this.absoluteChildren=[],this.platform=a,l=!!l||c===!1,this.mmopts={dot:!0,nobrace:e,nocase:s,noext:i,noglobstar:r,normalize:h,optimizationLevel:2,platform:a,nocomment:!0,nonegate:!0,windowsPathsNoEscape:l};let p=u?.resolve(o??"/").fullpath()??"/";this.slashRoot=(0,Ve.escape)(p.replace(/\\/g,"/").replace(/\/$/,""),{windowsPathsNoEscape:l});for(let d of t)this.add(d)}add(t){let e=new Ve.Minimatch(t,this.mmopts);for(let s=0;s<e.set.length;s++){let i=e.set[s],r=e.globParts[s];if(!i||!r)throw new Error("invalid pattern object");for(;i[0]==="."&&r[0]===".";)i.shift(),r.shift();let h=new Xr.Pattern(i,r,0,this.platform),a=h.root()==="/"?`${this.slashRoot}/${h.rest()?.globString()??""}`:h.globString(),o=new Ve.Minimatch(a,this.mmopts),l=r[r.length-1]==="**",c=h.isAbsolute();c?this.absolute.push(o):this.relative.push(o),l&&(c?this.absoluteChildren.push(o):this.relativeChildren.push(o))}}ignored(t){let e=t.fullpath(),s=`${e}/`,i=t.relative()||".",r=`${i}/`;for(let h of this.relative)if(h.match(i)||h.match(r))return!0;for(let h of this.absolute)if(h.match(e)||h.match(s))return!0;return!1}childrenIgnored(t){let e=`${t.fullpath()}/`,s=`${t.relative()||"."}/`;for(let i of this.relativeChildren)if(i.match(s))return!0;for(let i of this.absoluteChildren)if(i.match(e))return!0;return!1}};he.Ignore=Ye});var oi=x(U=>{"use strict";Object.defineProperty(U,"__esModule",{value:!0});U.Processor=U.SubWalks=U.MatchRecord=U.HasWalkedCache=void 0;var hi=Y(),oe=class n{parent;store;constructor(t){this.parent=t}copy(){return new n(this)}#t(t){let e=this.store?.get(t);return e||!this.parent?e:this.parent.#t(t)}hasWalked(t,e){return!!this.#t(t.fullpath())?.has(e.globString())}storeWalked(t,e){let s=t.fullpath(),i=this.#t(s);i?i.add(e.globString()):(this.store??=new Map).set(s,new Set([e.globString()]))}};U.HasWalkedCache=oe;var ae=class n{static ABSOLUTE=2;static IF_DIR=1;store=new Map;add(t,e,s){let i=(e?n.ABSOLUTE:0)|(s?n.IF_DIR:0),r=this.store.get(t);this.store.set(t,r===void 0?i:i&r)}};U.MatchRecord=ae;var le=class{store=new Map;add(t,e){if(!t.canReaddir())return;let s=this.store.get(t);s?s.find(i=>i.globString()===e.globString())||s.push(e):this.store.set(t,[e])}get(t){let e=this.store.get(t);if(!e)throw new Error("attempting to walk unknown path");return e}entries(){return this.keys().map(t=>[t,this.store.get(t)])}keys(){return[...this.store.keys()].filter(t=>t.canReaddir())}};U.SubWalks=le;var Je=class n{hasWalkedCache;matches=new ae;subwalks=new le;patterns;follow;dot;opts;constructor(t,e){this.opts=t,this.follow=!!t.follow,this.dot=!!t.dot,this.hasWalkedCache=e?e.copy():new oe}processPatterns(t,e){this.patterns=e;let s=e.map(i=>[t,i]);for(let[i,r]of s){this.hasWalkedCache.storeWalked(i,r);let h=r.root(),a=r.isAbsolute()&&this.opts.absolute!==!1;if(h){i=i.resolve(h==="/"&&this.opts.root!==void 0?this.opts.root:h);let u=r.rest();if(u)r=u;else{this.matches.add(i,!0,!1);continue}}if(i.isENOENT())continue;let o,l,c=!1;for(;typeof(o=r.pattern())=="string"&&(l=r.rest());)i=i.resolve(o),r=l,c=!0;if(o=r.pattern(),l=r.rest(),c){if(this.hasWalkedCache.hasWalked(i,r))continue;this.hasWalkedCache.storeWalked(i,r)}if(typeof o=="string"){let u=o===".."||o===""||o===".";this.matches.add(i.resolve(o),a,u);continue}else if(o===hi.GLOBSTAR){(!i.isSymbolicLink()||this.follow||r.checkFollowGlobstar())&&this.subwalks.add(i,r);let u=l?.pattern(),p=l?.rest();if(!l||(u===""||u===".")&&!p)this.matches.add(i,a,u===""||u===".");else if(u===".."){let d=i.parent||i;p?this.hasWalkedCache.hasWalked(d,p)||this.subwalks.add(d,p):this.matches.add(d,a,!0)}}else typeof o=="object"&&this.subwalks.add(i,r)}return this}subwalkTargets(){return this.subwalks.keys()}child(){return new n(this.opts,this.hasWalkedCache)}filterEntries(t,e){let s=this.subwalks.get(t),i=this.child();for(let r of e)for(let h of s){let a=h.isAbsolute(),o=h.pattern(),l=h.rest();o===hi.GLOBSTAR?i.testGlobstar(r,h,l,a):typeof o=="object"?i.testMatcher(r,o,l,a):i.testString(r,o,l,a)}return i}testGlobstar(t,e,s,i){if((this.dot||!t.name.startsWith("."))&&(e.hasMore()||this.matches.add(t,i,!1),t.canReaddir()&&(this.follow||!t.isSymbolicLink()?this.subwalks.add(t,e):t.isSymbolicLink()&&(s&&e.checkFollowGlobstar()?this.subwalks.add(t,s):e.markFollowGlobstar()&&this.subwalks.add(t,e)))),s){let r=s.pattern();if(typeof r=="string"&&r!==".."&&r!==""&&r!==".")this.testString(t,r,s.rest(),i);else if(r===".."){let h=t.parent||t;this.subwalks.add(h,s)}else typeof r=="object"&&this.testMatcher(t,r,s.rest(),i)}}testMatcher(t,e,s,i){e.testUnchecked(t.name)&&(s?this.subwalks.add(t,s):this.matches.add(t,i,!1))}testString(t,e,s,i){t.isNamed(e)&&(s?this.subwalks.add(t,s):this.matches.add(t,i,!1))}};U.Processor=Je});var li=x(Q=>{"use strict";Object.defineProperty(Q,"__esModule",{value:!0});Q.GlobStream=Q.GlobWalker=Q.GlobUtil=void 0;var Vr=$e(),ai=Ze(),Qe=oi(),{ABSOLUTE:ce,IF_DIR:ue}=Qe.MatchRecord,Yr=(n,t,e)=>typeof n=="string"?new ai.Ignore([n],t,e):Array.isArray(n)?new ai.Ignore(n,t,e):n,xt=class{path;patterns;opts;seen=new Set;paused=!1;aborted=!1;#t=[];#i;#e;signal;maxDepth;includeChildMatches;constructor(t,e,s){if(this.patterns=t,this.path=e,this.opts=s,this.#e=!s.posix&&s.platform==="win32"?"\\":"/",this.includeChildMatches=s.includeChildMatches!==!1,(s.ignore||!this.includeChildMatches)&&(this.#i=Yr(s.ignore??[],s,e),!this.includeChildMatches&&typeof this.#i.add!="function")){let i="cannot ignore child matches, ignore lacks add() method.";throw new Error(i)}this.maxDepth=s.maxDepth||1/0,s.signal&&(this.signal=s.signal,this.signal.addEventListener("abort",()=>{this.#t.length=0}))}#h(t){return this.seen.has(t)||!!this.#i?.ignored?.(t)}#n(t){return!!this.#i?.childrenIgnored?.(t)}pause(){this.paused=!0}resume(){if(this.signal?.aborted)return;this.paused=!1;let t;for(;!this.paused&&(t=this.#t.shift());)t()}onResume(t){this.paused?this.#t.push(t):t()}async matchCheck(t,e){if(e&&this.opts.nodir)return;let s,i;if(this.opts.realpath){if(s=t.realpathCached()||await t.realpath(),!s)return;i=s}else i=t;let h=i.isUnknown()||this.opts.stat?await i.lstat():i;if(this.opts.follow&&this.opts.nodir&&h?.isSymbolicLink()){let a=await h.realpath();a&&(a.isUnknown()||this.opts.stat)&&await a.lstat()}return this.matchCheckTest(h,e)}matchCheckTest(t,e){return t&&(this.maxDepth===1/0||t.depth()<=this.maxDepth)&&(!e||t.canReaddir())&&(!this.opts.nodir||!t.isDirectory())&&(!this.opts.nodir||!this.opts.follow||!t.isSymbolicLink()||!t.realpathCached()?.isDirectory())&&!this.#h(t)?t:void 0}matchCheckSync(t,e){if(e&&this.opts.nodir)return;let s,i;if(this.opts.realpath){if(s=t.realpathCached()||t.realpathSync(),!s)return;i=s}else i=t;let h=i.isUnknown()||this.opts.stat?i.lstatSync():i;if(this.opts.follow&&this.opts.nodir&&h?.isSymbolicLink()){let a=h.realpathSync();a&&(a?.isUnknown()||this.opts.stat)&&a.lstatSync()}return this.matchCheckTest(h,e)}matchFinish(t,e){this.#h(t)||this.#d(t,e)}#d(t,e){if(!this.includeChildMatches&&this.#i?.add){let r=`${t.relativePosix()}/**`;this.#i.add(r)}let s=this.opts.absolute===void 0?e:this.opts.absolute;this.seen.add(t);let i=this.opts.mark&&t.isDirectory()?this.#e:"";if(this.opts.withFileTypes)this.matchEmit(t);else if(s){let r=this.opts.posix?t.fullpathPosix():t.fullpath();this.matchEmit(r+i)}else{let r=this.opts.posix?t.relativePosix():t.relative(),h=this.opts.dotRelative&&!r.startsWith(`..${this.#e}`)?`.${this.#e}`:"";this.matchEmit(r?h+r+i:`.${i}`)}}async match(t,e,s){let i=await this.matchCheck(t,s);i&&this.matchFinish(i,e)}matchSync(t,e,s){let i=this.matchCheckSync(t,s);i&&this.#d(i,e)}walkCB(t,e,s){if(this.signal?.aborted)return s();this.walkCB2(t,e,new Qe.Processor(this.opts),s)}walkCB2(t,e,s,i){if(this.#n(t)||this.signal?.aborted)return i();if(this.paused){this.onResume(()=>this.walkCB2(t,e,s,i));return}s.processPatterns(t,e);let r=1,h=()=>{--r===0&&i()};for(let[a,o]of s.matches.store)this.#h(a)||(r++,this.match(a,!!(o&ce),!!(o&ue)).then(()=>h()));for(let a of s.subwalkTargets()){if(this.maxDepth!==1/0&&a.depth()>=this.maxDepth)continue;r++;let o=a.readdirCached();a.calledReaddir()?this.walkCB3(a,o,s,h):a.readdirCB((l,c)=>this.walkCB3(a,c,s,h),!0)}h()}walkCB3(t,e,s,i){let r=s.filterEntries(t,e),h=1,a=()=>{--h===0&&i()};for(let[o,l]of r.matches.store)this.#h(o)||(h++,this.match(o,!!(l&ce),!!(l&ue)).then(()=>a()));for(let[o,l]of r.subwalks.entries())h++,this.walkCB2(o,l,r.child(),a);a()}walkCBSync(t,e,s){if(this.signal?.aborted)return s();this.walkCB2Sync(t,e,new Qe.Processor(this.opts),s)}walkCB2Sync(t,e,s,i){if(this.#n(t)||this.signal?.aborted)return i();if(this.paused){this.onResume(()=>this.walkCB2Sync(t,e,s,i));return}s.processPatterns(t,e);let r=1,h=()=>{--r===0&&i()};for(let[a,o]of s.matches.store)this.#h(a)||this.matchSync(a,!!(o&ce),!!(o&ue));for(let a of s.subwalkTargets()){if(this.maxDepth!==1/0&&a.depth()>=this.maxDepth)continue;r++;let o=a.readdirSync();this.walkCB3Sync(a,o,s,h)}h()}walkCB3Sync(t,e,s,i){let r=s.filterEntries(t,e),h=1,a=()=>{--h===0&&i()};for(let[o,l]of r.matches.store)this.#h(o)||this.matchSync(o,!!(l&ce),!!(l&ue));for(let[o,l]of r.subwalks.entries())h++,this.walkCB2Sync(o,l,r.child(),a);a()}};Q.GlobUtil=xt;var ts=class extends xt{matches=[];constructor(t,e,s){super(t,e,s)}matchEmit(t){this.matches.push(t)}async walk(){if(this.signal?.aborted)throw this.signal.reason;return this.path.isUnknown()&&await this.path.lstat(),await new Promise((t,e)=>{this.walkCB(this.path,this.patterns,()=>{this.signal?.aborted?e(this.signal.reason):t(this.matches)})}),this.matches}walkSync(){if(this.signal?.aborted)throw this.signal.reason;return this.path.isUnknown()&&this.path.lstatSync(),this.walkCBSync(this.path,this.patterns,()=>{if(this.signal?.aborted)throw this.signal.reason}),this.matches}};Q.GlobWalker=ts;var es=class extends xt{results;constructor(t,e,s){super(t,e,s),this.results=new Vr.Minipass({signal:this.signal,objectMode:!0}),this.results.on("drain",()=>this.resume()),this.results.on("resume",()=>this.resume())}matchEmit(t){this.results.write(t),this.results.flowing||this.pause()}stream(){let t=this.path;return t.isUnknown()?t.lstat().then(()=>{this.walkCB(t,this.patterns,()=>this.results.end())}):this.walkCB(t,this.patterns,()=>this.results.end()),this.results}streamSync(){return this.path.isUnknown()&&this.path.lstatSync(),this.walkCBSync(this.path,this.patterns,()=>this.results.end()),this.results}};Q.GlobStream=es});var is=x(pe=>{"use strict";Object.defineProperty(pe,"__esModule",{value:!0});pe.Glob=void 0;var Zr=Y(),Jr=__webpack_require__(/*! node:url */ "node:url"),fe=ni(),Qr=Ke(),de=li(),tn=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",ss=class{absolute;cwd;root;dot;dotRelative;follow;ignore;magicalBraces;mark;matchBase;maxDepth;nobrace;nocase;nodir;noext;noglobstar;pattern;platform;realpath;scurry;stat;signal;windowsPathsNoEscape;withFileTypes;includeChildMatches;opts;patterns;constructor(t,e){if(!e)throw new TypeError("glob options required");if(this.withFileTypes=!!e.withFileTypes,this.signal=e.signal,this.follow=!!e.follow,this.dot=!!e.dot,this.dotRelative=!!e.dotRelative,this.nodir=!!e.nodir,this.mark=!!e.mark,e.cwd?(e.cwd instanceof URL||e.cwd.startsWith("file://"))&&(e.cwd=(0,Jr.fileURLToPath)(e.cwd)):this.cwd="",this.cwd=e.cwd||"",this.root=e.root,this.magicalBraces=!!e.magicalBraces,this.nobrace=!!e.nobrace,this.noext=!!e.noext,this.realpath=!!e.realpath,this.absolute=e.absolute,this.includeChildMatches=e.includeChildMatches!==!1,this.noglobstar=!!e.noglobstar,this.matchBase=!!e.matchBase,this.maxDepth=typeof e.maxDepth=="number"?e.maxDepth:1/0,this.stat=!!e.stat,this.ignore=e.ignore,this.withFileTypes&&this.absolute!==void 0)throw new Error("cannot set absolute and withFileTypes:true");let s=typeof t=="string"?[t]:t;if(this.windowsPathsNoEscape=!!e.windowsPathsNoEscape||e.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(s=s.map(l=>l.replace(/\\/g,"/"))),this.matchBase){if(e.noglobstar)throw new TypeError("base matching requires globstar");s=s.map(l=>l.includes("/")?l:`./**/${l}`)}if(this.pattern=s,this.platform=e.platform||tn,this.opts={...e,platform:this.platform},e.scurry){if(this.scurry=e.scurry,e.nocase!==void 0&&e.nocase!==e.scurry.nocase)throw new Error("nocase option contradicts provided scurry option")}else{let l=e.platform==="win32"?fe.PathScurryWin32:e.platform==="darwin"?fe.PathScurryDarwin:e.platform?fe.PathScurryPosix:fe.PathScurry;this.scurry=new l(this.cwd,{nocase:e.nocase,fs:e.fs})}this.nocase=this.scurry.nocase;let i=this.platform==="darwin"||this.platform==="win32",r={braceExpandMax:1e4,...e,dot:this.dot,matchBase:this.matchBase,nobrace:this.nobrace,nocase:this.nocase,nocaseMagicOnly:i,nocomment:!0,noext:this.noext,nonegate:!0,optimizationLevel:2,platform:this.platform,windowsPathsNoEscape:this.windowsPathsNoEscape},h=this.pattern.map(l=>new Zr.Minimatch(l,r)),[a,o]=h.reduce((l,c)=>(l[0].push(...c.set),l[1].push(...c.globParts),l),[[],[]]);this.patterns=a.map((l,c)=>{let u=o[c];if(!u)throw new Error("invalid pattern object");return new Qr.Pattern(l,u,0,this.platform)})}async walk(){return await new de.GlobWalker(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).walk()}walkSync(){return new de.GlobWalker(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).walkSync()}stream(){return new de.GlobStream(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).stream()}streamSync(){return new de.GlobStream(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).streamSync()}iterateSync(){return this.streamSync()[Symbol.iterator]()}[Symbol.iterator](){return this.iterateSync()}iterate(){return this.stream()[Symbol.asyncIterator]()}[Symbol.asyncIterator](){return this.iterate()}};pe.Glob=ss});var rs=x(me=>{"use strict";Object.defineProperty(me,"__esModule",{value:!0});me.hasMagic=void 0;var en=Y(),sn=(n,t={})=>{for(let e of Array.isArray(n)?n:[n])if(new en.Minimatch(e,t).hasMagic())return!0;return!1};me.hasMagic=sn});Object.defineProperty(exports, "__esModule", ({value:!0}));exports.glob=exports.sync=exports.iterate=exports.iterateSync=exports.stream=exports.streamSync=exports.Ignore=exports.hasMagic=exports.Glob=exports.unescape=exports.escape=void 0;exports.globStreamSync=Rt;exports.globStream=ns;exports.globSync=hs;exports.globIterateSync=Pt;exports.globIterate=os;var ci=Y(),rt=is(),rn=rs(),fi=Y();Object.defineProperty(exports, "escape", ({enumerable:!0,get:function(){return fi.escape}}));Object.defineProperty(exports, "unescape", ({enumerable:!0,get:function(){return fi.unescape}}));var nn=is();Object.defineProperty(exports, "Glob", ({enumerable:!0,get:function(){return nn.Glob}}));var hn=rs();Object.defineProperty(exports, "hasMagic", ({enumerable:!0,get:function(){return hn.hasMagic}}));var on=Ze();Object.defineProperty(exports, "Ignore", ({enumerable:!0,get:function(){return on.Ignore}}));function Rt(n,t={}){return new rt.Glob(n,t).streamSync()}function ns(n,t={}){return new rt.Glob(n,t).stream()}function hs(n,t={}){return new rt.Glob(n,t).walkSync()}async function ui(n,t={}){return new rt.Glob(n,t).walk()}function Pt(n,t={}){return new rt.Glob(n,t).iterateSync()}function os(n,t={}){return new rt.Glob(n,t).iterate()}exports.streamSync=Rt;exports.stream=Object.assign(ns,{sync:Rt});exports.iterateSync=Pt;exports.iterate=Object.assign(os,{sync:Pt});exports.sync=Object.assign(hs,{stream:Rt,iterate:Pt});exports.glob=Object.assign(ui,{glob:ui,globSync:hs,sync:exports.sync,globStream:ns,stream:exports.stream,globStreamSync:Rt,streamSync:exports.streamSync,globIterate:os,iterate:exports.iterate,globIterateSync:Pt,iterateSync:exports.iterateSync,Glob:rt.Glob,hasMagic:rn.hasMagic,escape:ci.escape,unescape:ci.unescape});exports.glob.glob=exports.glob;
|
|
144841
|
+
var C=(r,t)=>()=>{try{return t||r((t={exports:{}}).exports,t),t.exports}catch(e){throw t=0,e}};var ms=C(tt=>{"use strict";Object.defineProperty(tt,"__esModule",{value:!0});tt.range=tt.balanced=void 0;var Ei=(r,t,e)=>{let s=r instanceof RegExp?ps(r,e):r,i=t instanceof RegExp?ps(t,e):t,n=s!==null&&i!=null&&(0,tt.range)(s,i,e);return n&&{start:n[0],end:n[1],pre:e.slice(0,n[0]),body:e.slice(n[0]+s.length,n[1]),post:e.slice(n[1]+i.length)}};tt.balanced=Ei;var ps=(r,t)=>{let e=t.match(r);return e?e[0]:null},Oi=(r,t,e)=>{let s,i,n,o,h,a=e.indexOf(r),l=e.indexOf(t,a+1),c=a;if(a>=0&&l>0){if(r===t)return[a,l];for(s=[],n=e.length;c>=0&&!h;){if(c===a)s.push(c),a=e.indexOf(r,c+1);else if(s.length===1){let u=s.pop();u!==void 0&&(h=[u,l])}else i=s.pop(),i!==void 0&&i<n&&(n=i,o=l),l=e.indexOf(t,c+1);c=a<l&&a>=0?a:l}s.length&&o!==void 0&&(h=[n,o])}return h};tt.range=Oi});var vs=C(T=>{"use strict";Object.defineProperty(T,"__esModule",{value:!0});T.EXPANSION_MAX_REWRITES=T.EXPANSION_MAX_DEPTH=T.EXPANSION_MAX_LENGTH=T.EXPANSION_MAX=void 0;T.expand=Wi;var gs=ms(),ws="\0SLASH"+Math.random()+"\0",bs="\0OPEN"+Math.random()+"\0",xe="\0CLOSE"+Math.random()+"\0",ys="\0COMMA"+Math.random()+"\0",Ss="\0PERIOD"+Math.random()+"\0",xi=new RegExp(ws,"g"),Ci=new RegExp(bs,"g"),Mi=new RegExp(xe,"g"),ki=new RegExp(ys,"g"),Ai=new RegExp(Ss,"g"),Ri=/\\\\/g,Pi=/\\{/g,Ti=/\\}/g,Fi=/\\,/g,ji=/\\\./g;T.EXPANSION_MAX=1e5;T.EXPANSION_MAX_LENGTH=4e6;T.EXPANSION_MAX_DEPTH=1e3;T.EXPANSION_MAX_REWRITES=1e3;function _e(r){return isNaN(r)?r.charCodeAt(0):parseInt(r,10)}function Ni(r){return r.replace(Ri,ws).replace(Pi,bs).replace(Ti,xe).replace(Fi,ys).replace(ji,Ss)}function Di(r){return r.replace(xi,"\\").replace(Ci,"{").replace(Mi,"}").replace(ki,",").replace(Ai,".")}function Ee(r,t){for(let e=0;e<t.length;e++)r.push(t[e])}function Li(r){let t=[],e="";for(;;){let s=(0,gs.balanced)("{","}",r);if(!s){let a=r.split(",");return a[0]=e+a[0],Ee(t,a),t}let{pre:i,body:n,post:o}=s,h=i.split(",");if(h[0]=e+h[0],h[h.length-1]+="{"+n+"}",!o.length)return Ee(t,h),t;e=h.pop(),Ee(t,h),r=o}}function Wi(r,t={}){if(!r)return[];let{max:e=T.EXPANSION_MAX,maxLength:s=T.EXPANSION_MAX_LENGTH,maxDepth:i=T.EXPANSION_MAX_DEPTH,maxRewrites:n=T.EXPANSION_MAX_REWRITES}=t;return r.slice(0,2)==="{}"&&(r="\\{\\}"+r.slice(2)),Oe(Ni(r),e,s,i,0,n,!0).map(Di)}function zi(r){return"{"+r+"}"}function Bi(r){return/^-?0\d/.test(r)}function Gi(r,t){return r<=t}function Ii(r,t){return r>=t}function ct(r,t,e,s,i,n){let o=[],h=0;for(let a=0;a<r.length;a++)for(let l=0;l<e.length;l++){if(o.length>=s)return o;let c=r[a]+t+e[l];if(!(n&&!c)){if(h+c.length>i)return o;o.push(c),h+=c.length}}return o}function $i(r,t,e,s){let i=r.split(/\.\./),n=[];if(i[0]===void 0||i[1]===void 0)return n;let o=_e(i[0]),h=_e(i[1]),a=Math.max(i[0].length,i[1].length),l=i.length===3&&i[2]!==void 0?Math.max(Math.abs(_e(i[2])),1):1,c=Gi;h<o&&(l*=-1,c=Ii);let f=i.some(Bi),p=0;for(let g=o;c(g,h)&&n.length<e;g+=l){let d;if(t)d=String.fromCharCode(g),d==="\\"&&(d="");else if(d=String(g),f){let b=a-d.length;if(b>0){let m=new Array(b+1).join("0");g<0?d="-"+m+d.slice(1):d=m+d}}if(p+d.length>s)break;n.push(d),p+=d.length}return n}function Oe(r,t,e,s,i,n,o){if(i>s)return[r];let h=[""],a=0,l=!1,c=!0;for(;;){let u=(0,gs.balanced)("{","}",r);if(!u)return ct(h,r,[""],t,e,l);let f=u.pre;if(/\$$/.test(f)){if(h=ct(h,f+"{"+u.body+"}",[""],t,e,l&&!u.post.length),c=!1,!u.post.length)break;r=u.post;continue}let p=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(u.body),g=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(u.body),d=p||g,b=u.body.indexOf(",")>=0;if(!d&&!b){if(a<n&&u.post.match(/,(?!,).*\}/)){a++,r=u.pre+"{"+u.body+xe+u.post,o=!0;continue}return ct(h,f+"{"+u.body+"}"+u.post,[""],t,e,l)}c&&(l=o&&!d,c=!1);let m;if(d)m=$i(u.body,g,t,e);else{let y=Li(u.body);if(y.length===1&&y[0]!==void 0&&(y=Oe(y[0],t,e,s,i+1,n,!1).map(zi),y.length===1)){if(h=ct(h,f+y[0],[""],t,e,l&&!u.post.length),!u.post.length)break;r=u.post;continue}let _=l&&!u.post.length&&!f;for(let S=0;_&&S<h.length;S++)h[S]&&(_=!1);m=[];let v=0;t:for(let S=0;S<y.length;S++){let K=Oe(y[S],t,e,s,i+1,n,!1);for(let B=0;B<K.length;B++){let U=K[B];if(!(_&&!U)){if(m.length>=t||v+U.length>e)break t;m.push(U),v+=U.length}}}}if(h=ct(h,f,m,t,e,l&&!u.post.length),!u.post.length)break;r=u.post}return h}});var Es=C(jt=>{"use strict";Object.defineProperty(jt,"__esModule",{value:!0});jt.numericRange=void 0;var Me=(r,t)=>r===t?{t:"lit",ch:String(r)}:{t:"class",re:new RegExp(`^[${r}-${t}]$`)},Ce=(r,t)=>t.map(e=>[Me(r,r),...e]),ut=(r,t)=>{if(!r)return[[]];let e=+r[0],s=+t[0],i=r.slice(1),n=t.slice(1);if(e===s)return Ce(e,ut(i,n));let o="0".repeat(i.length),h="9".repeat(i.length),a=[];i!==o&&a.push(...Ce(e++,ut(i,h)));let l=n===h?[]:Ce(s--,ut(o,n));return e<=s&&a.push([Me(e,s),...Array.from(i,()=>Me(0,9))]),a.push(...l),a},_s=(r,t,e)=>{if(e)return ut(String(r).padStart(e,"0"),String(t).padStart(e,"0"));let s=[];for(let i=String(r).length;i<=String(t).length;i++){let n=Math.max(r,i===1?0:10**(i-1)),o=Math.min(t,10**i-1);s.push(...ut(String(n),String(o)))}return s},Ui=(r,t)=>{let e=Number(r),s=Number(t);if(!Number.isSafeInteger(e)||!Number.isSafeInteger(s))return;e>s&&([e,s]=[s,e]);let n=/^-?0\d/.test(r)||/^-?0\d/.test(t)?Math.max(r.length,t.length):0,o=[];if(e<0){let h=_s(Math.max(-s,1),-e,n&&n-1);o.push(...h.map(a=>[{t:"lit",ch:"-"},...a]))}return s>=0&&o.push(..._s(Math.max(e,0),s,n)),o};jt.numericRange=Ui});var Os=C(Nt=>{"use strict";Object.defineProperty(Nt,"__esModule",{value:!0});Nt.parseClass=void 0;var qi={"[:alnum:]":["\\p{L}\\p{Nl}\\p{Nd}"],"[:alpha:]":["\\p{L}\\p{Nl}"],"[:ascii:]":["\\x00-\\x7f"],"[:blank:]":["\\p{Zs}\\t"],"[:cntrl:]":["\\p{Cc}"],"[:digit:]":["\\p{Nd}"],"[:graph:]":["\\p{Z}\\p{C}",!0],"[:lower:]":["\\p{Ll}"],"[:print:]":["\\p{C}",!0],"[:punct:]":["\\p{P}\\p{S}"],"[:space:]":["\\p{Z}\\t\\r\\n\\v\\f"],"[:upper:]":["\\p{Lu}"],"[:word:]":["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}"],"[:xdigit:]":["A-Fa-f0-9"]},ft=r=>r.replace(/[[\]\\-]/g,"\\$&"),ke=/$./,Hi=(r,t,e=!1,s)=>{let i=m=>{let y=s?m.normalize(s):m;return[...y].length===1?y:m},n=t;if(r.charAt(n)!=="[")throw new Error("not in a brace expression");let o=[],h=[],a=n+1,l=!1,c=!1,u=!1,f=n,p="";t:for(;a<r.length;){let m=String.fromCodePoint(r.codePointAt(a));if((m==="!"||m==="^")&&a===n+1){u=!0,a++;continue}if(m==="]"&&l&&!c){f=a+1;break}if(l=!0,m==="\\"&&!c){c=!0,a++;continue}if(m==="["&&!c){for(let[_,[v,S]]of Object.entries(qi))if(r.startsWith(_,a)){if(p)return[ke,r.length-n];a+=_.length,S?h.push(v):o.push(v);continue t}}c=!1;let y=i(m);if(p){y.codePointAt(0)>p.codePointAt(0)?o.push(ft(p)+"-"+ft(y)):y===p&&o.push(ft(y)),p="",a+=m.length;continue}if(r.startsWith("-]",a+m.length)){o.push(ft(y+"-")),a+=m.length+1;continue}if(r.startsWith("-",a+m.length)){p=y,a+=m.length+1;continue}o.push(ft(y)),a+=m.length}if(f<a)return[ke,0];if(!o.length&&!h.length)return[ke,r.length-n];let g="["+(u?"^":"")+o.join("")+"]",d="["+(u?"":"^")+h.join("")+"]",b="^"+(o.length&&h.length?"("+g+"|"+d+")":o.length?g:d);return[new RegExp(b,e?"iu":"u"),f-n]};Nt.parseClass=Hi});var Ns=C(Wt=>{"use strict";Object.defineProperty(Wt,"__esModule",{value:!0});Wt.Matcher=void 0;var Xi=Es(),Ki=Os(),Ae={t:"match",id:0},Vi="!?+*@",et=r=>({t:"lit",ch:r}),Yi=r=>r.replace(/[\\^$.*+?()[\]{}|/]/g,"\\$&"),ks=r=>new RegExp(`^${Yi(r)}$`,"iu"),Dt=new Map,As=r=>{let t=Dt.get(r);return t||(t=ks(r),Dt.size>=1e3&&Dt.clear(),Dt.set(r,t)),t},Fe=(r,t)=>{if(t===r.ch)return!0;if(!r.re)return!1;let e=t.charCodeAt(0);if(e>=128)return r.re.test(t);let s=r.ascii??=new Uint8Array(128);return s[e]||=r.re.test(t)?1:2,s[e]===1},Ji=(r,t,e,s,i)=>{let n=[];for(let o=0;o<r.length;){let h=String.fromCodePoint(r.codePointAt(o));if(i){let a=h==="\\"&&r.startsWith(i,o+1)?1:0;if(a||h===i){let l=o+a+i.length,c=r.indexOf(i,l),u=/^(-?\d+)\.\.(-?\d+)$/.exec(r.slice(l,c)),f=c!==-1&&u&&(0,Xi.numericRange)(u[1],u[2]);if(f){n.push({t:"ext",type:"@",alts:f}),o=c+i.length;continue}}}if(h==="\\"){let a=r.codePointAt(o+1),l=a===void 0?h:String.fromCodePoint(a);n.push(et(l)),o+=1+l.length;continue}if(h==="["){let[a,l]=(0,Ki.parseClass)(r,o,t,s);if(l){n.push({t:"class",re:a}),o+=l;continue}}if(!e&&Vi.includes(h)&&r[o+1]==="("){n.push({t:"open",type:h}),o+=2;continue}n.push(!e&&h==="|"?{t:"bar"}:!e&&h===")"?{t:"close"}:h==="*"?{t:"star"}:h==="?"?{t:"any"}:et(h)),o+=h.length}return n},Zi=r=>{let t=new Map,e=[];return r.forEach((s,i)=>{s.t==="open"?e.push(i):s.t==="close"&&e.length&&t.set(e.pop(),i)}),t},Rs=(r,t,e,s,i)=>{let n=[],o=[n];for(let h=e;h<s;h++){let a=r[h],l=t.get(h);if(a.t==="open"&&l!==void 0){let c=Rs(r,t,h+1,l,!1);n.push({t:"ext",type:a.type,alts:c}),h=l}else a.t==="bar"&&!i?o.push(n=[]):a.t==="open"?n.push(et(a.type),et("(")):a.t==="bar"?n.push(et("|")):a.t==="close"?n.push(et(")")):n.push(a)}return o},Ps=(r,t)=>{let e=[],s="",i=()=>{for(let n of s.normalize(t))e.push(et(n));s=""};for(let n of r){if(n.t==="lit"){s+=n.ch;continue}i(),e.push(n.t==="ext"?{...n,alts:n.alts.map(o=>Ps(o,t))}:n)}return i(),e},Qi=(r,t)=>{let e=1,s=h=>({t:"split",id:e++,out:h}),i=(h,a)=>h.reduceRight((l,c)=>n(c,l),a),n=(h,a)=>{switch(h.t){case"lit":let f=t?As(h.ch):void 0;return{t:"lit",id:e++,ch:h.ch,re:f,next:a};case"any":case"star":return{t:h.t,id:e++,next:a};case"class":return{t:"class",id:e++,re:h.re,next:a}}let l=f=>h.alts.map(p=>i(p,f));switch(h.type){case"@":return s(l(a));case"?":return s([a,...l(a)]);case"!":return{t:"neg",id:e++,sub:s(l(Ae)),next:a}}let c=s([]),u=s(l(c));return c.out.push(a,u),h.type==="*"?c:u};return[i(r,Ae),e]},tn=r=>{let t=[],e=new Set,s=n=>n.t==="match"?"match":String(n.id),i=(n,o)=>{if(n.t==="match"||e.has(n))return;e.add(n);let h=a=>t.push(`${o}${n.id}: ${a}`);switch(n.t){case"split":h(`split -> ${n.out.map(s).join(", ")}`);for(let a of n.out)i(a,o);return;case"neg":return h(`!(${s(n.sub)}) -> ${s(n.next)}`),i(n.sub,o+" "),i(n.next,o);case"lit":h(`${JSON.stringify(n.ch)} -> ${s(n.next)}`);break;case"class":h(`${n.re} -> ${s(n.next)}`);break;default:h(`${n.t==="any"?"?":"*"} -> ${s(n.next)}`)}i(n.next,o)};return i(r,""),[`start -> ${s(r)}`,...t].join(`
|
|
144842
|
+
`)},Re=class{gen;threads=[];match=!1;runs=[];ids=[];constructor(t){this.gen=t}get dead(){return!this.threads.length&&!this.match&&!this.runs.length}},Ts=(r,t)=>r.ids.length!==t.ids.length||r.runs.length!==t.runs.length||r.ids.some((e,s)=>e!==t.ids[s])?!1:r.runs.every(e=>t.runs.some(s=>s.neg===e.neg&&Ts(s.state,e.state))),xs=r=>({has:new Float64Array(r),seen:new Float64Array(r),gen:0}),dt=class{dots;dotStart;#t;constructor(t,e,s){this.dots=t,this.dotStart=e,this.#t=s}state(){return new Re(++this.#t.gen)}done(t){return t.ids=t.threads.map(e=>e.id).sort((e,s)=>e-s),t.match&&t.ids.unshift(Ae.id),t}#n(t,e){let{seen:s}=this.#t;return s[e.id]===t.gen?!1:(s[e.id]=t.gen,!0)}#i(t,e){let{has:s}=this.#t;return s[e.id]===t.gen?!1:(s[e.id]=t.gen,t.threads.push(e),!0)}restricted(t,e){return e&&(this.dots||this.dotStart&&t===0)}add(t,e,s,i){switch(e.t){case"split":if(!this.#n(t,e))return;for(let o of e.out)this.add(t,o,s,i);return;case"neg":if(!this.#n(t,e))return;let n=this.state();return this.add(n,e.sub,s,!1),this.done(n),this.addRun(t,{t:"run",neg:e,state:n},s,i);case"star":if(this.restricted(s,i))return;this.#i(t,e)&&this.add(t,e.next,s,i);return;case"match":t.match=!0;return;default:this.#i(t,e)}}addRun(t,e,s,i){for(let n of t.runs)if(n.neg===e.neg&&Ts(n.state,e.state))return;t.runs.push(e),e.state.match||this.add(t,e.neg.next,s,i)}step(t,e,s,i){let n=this.state();for(let o of t.threads)switch(o.t){case"lit":Fe(o,e)&&this.add(n,o.next,s+1,i);break;case"any":this.restricted(s,i)||this.add(n,o.next,s+1,i);break;case"class":!this.restricted(s,i)&&o.re.test(e)&&this.add(n,o.next,s+1,i);break;case"star":this.restricted(s,i)||this.add(n,o,s+1,i)}if(!this.restricted(s,i))for(let o of t.runs){if(o.state.dead){this.addRun(n,o,s+1,i);continue}let h=this.step(o.state,e,s,!1);this.addRun(n,{t:"run",neg:o.neg,state:h},s+1,i)}return this.done(n)}},Fs=r=>{let t=r.ids.join();if(!r.runs.length)return t;let e=r.runs.map(s=>`${s.neg.id}(${Fs(s.state)})`);return`${t}|${e.sort().join("|")}`},en=1<<18,Pe=class{#t;#n=new Map;#i=0;#o;#r;#d;#f;constructor(t,e){this.#t=t,this.#d=new dt(!1,!1,e),this.#f=new dt(!1,!0,e)}#u(t){return{state:t,match:t.match,dead:t.dead,next:new Map}}#h(t){let e=Fs(t),s=this.#n.get(e);if(s)return s;this.#i>en&&this.#m();let i=this.#u(t);return this.#n.set(e,i),this.#i+=e.length+1,i}#m(){this.#n.clear(),this.#i=0,this.#o=void 0,this.#r=void 0}start(t){if(t){if(this.#r)return this.#r;let s=this.#f.state();return this.#f.add(s,this.#t,0,!0),this.#r=this.#u(this.#f.done(s))}if(this.#o)return this.#o;let e=this.#d.state();return this.#d.add(e,this.#t,0,!0),this.#o=this.#h(this.#d.done(e))}next(t,e){let s=e.charCodeAt(0),i=s<128?void 0:t.next.get(e);if(i)return i;let n=t===this.#r?this.#h(this.#f.step(t.state,e,0,!0)):this.#h(this.#d.step(t.state,e,1,!0));return s<128?(t.ascii||(t.ascii=new Array(128),this.#i+=128),t.ascii[s]=n):t.next.set(e,n),this.#i++,n}},sn=r=>{let t=[];for(let e=r;e.t!=="match";e=e.next){if(e.t==="split"||e.t==="neg")return;t.push(e)}return t},nn=(r,t,e,s)=>{let i=0,n=e,o=-1,h=0;for(;n<s;){let a=r[i];if(a?.t==="star"){o=i++,h=n;continue}let l=t[n];if(a&&(a.t==="any"||a.t==="lit"&&Fe(a,l)||a.t==="class"&&a.re.test(l))){i++,n++;continue}if(o===-1)return!1;i=o+1,n=++h}for(;r[i]?.t==="star";)i++;return i===r.length},js=r=>{let t=0,e=0;for(let s of r){let[i,n]=rn(s);t+=i,e+=n}return[t,e]},rn=r=>{if(r.t==="star")return[0,1/0];if(r.t!=="ext")return[1,1];if(r.type==="!")return[0,1/0];let t=r.alts.map(js),e=Math.min(...t.map(n=>n[0])),s=Math.max(...t.map(n=>n[1])),i=s===0?0:1/0;return r.type==="@"?[e,s]:r.type==="?"?[0,s]:r.type==="*"?[0,i]:[e,i]},Cs=(r,t,e)=>{for(let s=0;s<r.length;s++)if(!Fe(r[s],t[e+s]))return!1;return!0},on=/[/\ud800-\udfff]/,hn=/[\ud800-\udfff]/,Lt=r=>hn.test(r)?[...r]:r,Ms=r=>{if(r.includes("/"))throw new Error("can only match a single path portion, got: "+r)},Te=class{pattern;options;#t;#n;#i;#o;#r;#d=!1;#f;#u;#h=!1;#m=0;#l=1/0;#a=[];#s=[];#b;#E;#y=!1;#g;#w;constructor(t,e={}){if(t.includes("/"))throw new Error("can only match a single path portion, got pattern: "+t);this.pattern=t,this.options=e;let{nocase:s=!1,noext:i=!1,normalize:n}=e;this.#w=n===!0?"NFC":n||void 0;let o=/^[?*+@]\(\)$/.test(t),h=Ji(t,s,i||o,this.#w,e.rangeMark),[a]=Rs(h,Zi(h),0,h.length,!0);this.#w&&(a=Ps(a,this.#w));let[l,c]=Qi(a,s);if(this.#t=l,this.#n=c,a.every(u=>u.t==="lit"))this.#r=a.map(u=>u.ch).join(""),this.#d=s;else{let u=g=>g.t!=="lit"?void 0:s?{ch:g.ch,re:As(g.ch)}:{ch:g.ch};for(let g of a){let d=u(g);if(!d)break;this.#a.push(d)}for(let g=a.length-1;g>=0;g--){let d=u(a[g]);if(!d)break;this.#s.unshift(d)}this.#y=!!(this.#a.length||this.#s.length),s||(this.#b=this.#a.map(g=>g.ch).join(""),this.#E=this.#s.map(g=>g.ch).join("")),this.#u=sn(this.#t)?.slice(this.#a.length,-this.#s.length||void 0),this.#h=!!this.#u?.every(g=>g.t==="star"||g.t==="any");let[f,p]=js(a);this.#m=f,this.#l=p}}test(t){return this.#w?(Ms(t),this.#p(t.normalize(this.#w))):on.test(t)?(Ms(t),this.#p(t,[...t])):this.#p(t,t)}testUnchecked(t){return this.#p(this.#w?t.normalize(this.#w):t)}#p(t,e){if(this.#r!==void 0)return this.#d?(this.#f??=ks(this.#r)).test(t):t===this.#r;let s=this.#m,i=this.#l;if(e===void 0){let c=t.length,u=c+1>>1;if(c<s||u>i)return!1;(u<s||c>i)&&(e=Lt(t))}if(e!==void 0&&(e.length<s||e.length>i))return!1;let n=this.#a.length;if(this.#y)if(this.#b!==void 0&&this.#E!==void 0){if(!t.startsWith(this.#b)||!t.endsWith(this.#E))return!1}else{e??=Lt(t);let c=e.length-this.#s.length;if(!Cs(this.#a,e,0)||!Cs(this.#s,e,c))return!1}let o=!this.options.dot&&t.startsWith(".");if(this.#u){if(t==="."||t===".."||o&&!n)return!1;if(this.#h)return!0;e??=Lt(t);let c=e.length-this.#s.length;return nn(this.#u,e,n,c)}if(e??=Lt(t),t==="."||t===".."){this.#i??=xs(this.#n);let c=this.#o??=new dt(!0,!1,this.#i),u=c.state();c.add(u,this.#t,0,!0);let f=c.done(u);for(let p=0;p<e.length;p++)f=c.step(f,e[p],p,!0);return f.match}this.#i??=xs(this.#n);let h=this.#g??=new Pe(this.#t,this.#i),a=h.start(o),l=e===t;for(let c=0;c<e.length;c++){if(a.dead)return!1;let u=l?t.charCodeAt(c):e[c].charCodeAt(0);a=a.ascii?.[u]??h.next(a,e[c])}return a.match}toString(){return tn(this.#t)}};Wt.Matcher=Te});var Ds=C(zt=>{"use strict";Object.defineProperty(zt,"__esModule",{value:!0});zt.assertValidPattern=void 0;var an=1024*64,ln=r=>{if(typeof r!="string")throw new TypeError("invalid pattern");if(r.length>an)throw new TypeError("pattern is too long")};zt.assertValidPattern=ln});var je=C(Bt=>{"use strict";Object.defineProperty(Bt,"__esModule",{value:!0});Bt.escape=void 0;var cn=(r,{windowsPathsNoEscape:t=!1,magicalBraces:e=!1}={})=>e?t?r.replace(/[?*()[\]{}]/g,"[$&]"):r.replace(/[?*()[\]\\{}]/g,"\\$&"):t?r.replace(/[?*()[\]]/g,"[$&]"):r.replace(/[?*()[\]\\]/g,"\\$&");Bt.escape=cn});var Ne=C(Gt=>{"use strict";Object.defineProperty(Gt,"__esModule",{value:!0});Gt.unescape=void 0;var un=(r,{windowsPathsNoEscape:t=!1,magicalBraces:e=!0}={})=>e?t?r.replace(/\[([^/\\])\]/g,"$1"):r.replace(/((?!\\).|^)\[([^/\\])\]/g,"$1$2").replace(/\\([^/])/g,"$1"):t?r.replace(/\[([^/\\{}])\]/g,"$1"):r.replace(/((?!\\).|^)\[([^/\\{}])\]/g,"$1$2").replace(/\\([^/{}])/g,"$1");Gt.unescape=un});var Y=C(w=>{"use strict";Object.defineProperty(w,"__esModule",{value:!0});w.unescape=w.escape=w.Minimatch=w.match=w.braceExpand=w.defaults=w.filter=w.GLOBSTAR=w.sep=w.minimatch=void 0;var fn=vs(),Ls=Ns(),Ut=Ds(),dn=je(),pn=Ne(),mn=(r,t,e={})=>((0,Ut.assertValidPattern)(t),!e.nocomment&&t.charAt(0)==="#"?!1:wn(t,e).match(r));w.minimatch=mn;var ot=new Map,gn=256,wn=(r,t)=>{let e=r+"\0"+JSON.stringify(t),s=ot.get(e);return s?ot.delete(e):(s=new ht(r,{...t}),ot.size>=gn&&ot.delete(ot.keys().next().value)),ot.set(e,s),s},$s=typeof process=="object"&&process?process.env?.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",Ws={win32:{sep:"\\"},posix:{sep:"/"}};w.sep=$s==="win32"?Ws.win32.sep:Ws.posix.sep;w.minimatch.sep=w.sep;w.GLOBSTAR=Symbol("globstar **");w.minimatch.GLOBSTAR=w.GLOBSTAR;var bn=(r,t={})=>e=>(0,w.minimatch)(e,r,t);w.filter=bn;w.minimatch.filter=w.filter;var q=(r,t={})=>Object.assign({},r,t),yn=r=>{if(!r||typeof r!="object"||!Object.keys(r).length)return w.minimatch;let t=w.minimatch;return Object.assign((s,i,n={})=>t(s,i,q(r,n)),{Minimatch:class extends t.Minimatch{constructor(i,n={}){super(i,q(r,n))}static defaults(i){return t.defaults(q(r,i)).Minimatch}},unescape:(s,i={})=>t.unescape(s,q(r,i)),escape:(s,i={})=>t.escape(s,q(r,i)),filter:(s,i={})=>t.filter(s,q(r,i)),defaults:s=>t.defaults(q(r,s)),braceExpand:(s,i={})=>t.braceExpand(s,q(r,i)),match:(s,i,n={})=>t.match(s,i,q(r,n)),sep:t.sep,GLOBSTAR:w.GLOBSTAR})};w.defaults=yn;w.minimatch.defaults=w.defaults;var Sn=(r,t={})=>((0,Ut.assertValidPattern)(r),t.nobrace||!/\{(?:(?!\{).)*\}/.test(r)?[r]:(0,fn.expand)(r,{max:t.braceExpandMax}));w.braceExpand=Sn;w.minimatch.braceExpand=w.braceExpand;var vn=100,_n=/(?<![\\$])\{(-?\d+)\.\.(-?\d+)\}/g,En=(r,t,e={})=>{let s=new ht(t,e);return r=r.filter(i=>s.match(i)),s.options.nonull&&!r.length&&r.push(t),r};w.match=En;w.minimatch.match=w.match;var zs=/[?*]|[+@!]\(.*?\)|\[|\]/,Us=(r,t)=>{let e=t+1;(r.charAt(e)==="!"||r.charAt(e)==="^")&&e++;let s=!1;for(;e<r.length;e++){let i=r.charAt(e);if(i==="]"&&s)return e;s=!0,i==="\\"&&e++}return-1},On=(r,t)=>{if(!t&&(r==="+()"||r==="@()"))return r;let e="";for(let s=0;s<r.length;s++){let i=r.charAt(s);if(i==="\\")e+=r.charAt(++s)||i;else{if(i==="*"||i==="?")return;if(i==="["){let n=Us(r,s);if(n===-1){e+=i;continue}let o=r.slice(s+1,n);if(o.startsWith("\\")&&(o=o.slice(1)),[...o].length!==1||"!^".includes(r.charAt(s+1)))return;e+=o,s=n}else{if(!t&&"+@!".includes(i)&&r.charAt(s+1)==="("&&r.includes(")",s+2))return;e+=i}}}return e},xn=r=>{if(/^[?*+@]\(\)$/.test(r)||r.includes("[:"))return!1;let t=0;for(let e=0;e<r.length;e++){let s=r.charAt(e);if(s==="\\"){if(++e===r.length)return!1}else if(s==="["){let i=Us(r,e);i!==-1&&(e=i)}else if("+@!?*".includes(s)&&r.charAt(e+1)==="(")t++,e++;else if(s===")"){if(!t--)return!1}else if(s==="|"&&!t)return!1}return!t},De,Bs,V=(r,t)=>typeof r=="string"?t===r:t!==""&&r.testUnchecked(t),Gs=(r,t,e,s,i)=>V(r,t)?e:s!==void 0&&V(r,s)?i:-1,Be=r=>r==="."||r==="..",Le=r=>typeof r=="string"&&/^[a-z]:$/i.test(r),$t=r=>typeof r=="string"&&/^unc$/i.test(r),We=r=>{if(r[0]!==""||r[1]!=="")return-1;let t=r[2]!=="?"?2:$t(r[3])?4:-1,e=r[t],s=r[t+1];return t!==-1&&e!==void 0&&e!==""&&e!==w.GLOBSTAR&&s!==void 0&&s!==""&&s!==w.GLOBSTAR?t:-1},It=(r,t)=>!Be(r)&&(t||!r.startsWith(".")),pt=(r,t,e,s,i)=>{for(let n=t;n<e;){if(r.charCodeAt(n)===46){if(!s)return!0;let h=r.charCodeAt(n+1)===46?n+2:n+1;if(h>=e||qt(r.charCodeAt(h),i))return!0}let o=Ge(r,n,i);if(o===-1)return!1;for(n=o+1;n<e&&qt(r.charCodeAt(n),i);)n++}return!1},qt=(r,t)=>t==="/"?r===47:t==="\\"?r===92:r===47||r===92,Ge=(r,t,e)=>{if(e!=="both")return r.indexOf(e,t);let s=r.indexOf("/",t),i=r.indexOf("\\",t);return s===-1?i:i===-1?s:Math.min(s,i)},Is=(r,t,e)=>e!=="both"?r.lastIndexOf(e,t):Math.max(r.lastIndexOf("/",t),r.lastIndexOf("\\",t)),ze={},ht=class{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;maxGlobstarRecursion;#t;#n;#i;#o;#r=[];#d=[];#f=[];#u=new Map;#h=!1;#m;#l=new WeakMap;constructor(t,e={}){(0,Ut.assertValidPattern)(t),e=e||{},this.options=e,this.maxGlobstarRecursion=e.maxGlobstarRecursion??200,this.pattern=t,this.platform=e.platform||$s,this.isWindows=this.platform==="win32";let s="allowWindowsEscape";this.windowsPathsNoEscape=!!e.windowsPathsNoEscape||e[s]===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!e.preserveMultipleSlashes,this.negate=!1,this.nonegate=!!e.nonegate,this.comment=!1,this.empty=!1,this.partial=!!e.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=e.windowsNoMagicRoot!==void 0?e.windowsNoMagicRoot:!!(this.isWindows&&this.nocase),this.globSet=[],this.globParts=[],this.set=[],this.#t=!this.preserveMultipleSlashes,this.#i=(e.optimizationLevel??1)>=2;let i=e.normalize;this.#o=i===!0?"NFC":i||void 0,this.make();let n=this.set.map(o=>this.#s(o));this.#f=this.set.map((o,h)=>this.#t&&o.length-1>n[h]),this.#r=this.set.map((o,h)=>{let a=this.#f[h]?o.length-1:o.length,l=o.slice(n[h]+1,a).filter(c=>typeof c=="string"&&!!c);return[...new Set(l)]}),this.#n=this.#r.some(o=>o.length),this.#d=this.set.map((o,h)=>{let[a,l,c]=o;if(this.#f[h]&&o.length===2&&a===w.GLOBSTAR&&l!==w.GLOBSTAR)return"tail";if(this.#f[h]&&e.matchBase&&o.length===1&&a!==w.GLOBSTAR&&a!=="")return"base";if(!(!this.#t||n[h]!==-1)){if(o.length===3&&a===w.GLOBSTAR&&c===w.GLOBSTAR&&l!==w.GLOBSTAR&&l!==""&&this.maxGlobstarRecursion>0)return"mid";if(o.length===2&&l===w.GLOBSTAR&&a!==w.GLOBSTAR&&a!=="")return"head"}})}#a(t){return this.#o?t.normalize(this.#o):t}#s(t){if(!this.isWindows)return-1;if(Le(t[0]))return 0;if(t[0]===""&&t[1]===""&&t[2]==="?"&&Le(t[3]))return 3;let s=We(t);return s===-1?-1:s+1}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let t of this.set)for(let e of t)if(typeof e!="string")return!0;return!1}make(){let t=this.pattern,e=this.options;if(!e.nocomment&&t.charAt(0)==="#"){this.comment=!0;return}if(!t){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.#M())];let s=this.globSet.map(n=>this.#e(n));this.globParts=this.preprocess(s),this.#h=!0;let i=this.globParts.map((n,o,h)=>{if(this.isWindows&&this.windowsNoMagicRoot){let a=n[2]==="?"&&$t(n[3])?6:4,l=n[0]===""&&n[1]===""&&(n[2]==="?"||!zs.test(n[2]))&&n.slice(3,a).every(u=>!zs.test(u)),c=/^[a-z]:/i.test(n[0]);if(l)return[...n.slice(0,a).map(u=>this.#a(u)),...n.slice(a).map(u=>this.parse(u))];if(c)return[this.#a(n[0]),...n.slice(1).map(u=>this.parse(u))]}return n.map(a=>this.parse(a))});if(this.set=i.filter(n=>n.indexOf(!1)===-1),this.isWindows)for(let n=0;n<this.set.length;n++){let o=this.set[n];o[0]===""&&o[1]===""&&this.globParts[n][2]==="?"&&(Le(o[3])||$t(this.globParts[n][3]))&&($t(this.globParts[n][3])&&(o[3]="UNC"),o[2]="?")}e.noext||this.mergeRows(),this.#h=!1,this.set.forEach((n,o)=>{for(let h=0;h<n.length;h++)n[h]===ze&&(n[h]=this.parse(this.globParts[o][h]))})}mergeRows(){let t=!0;for(;t;){t=!1;let e=Math.max(0,...this.set.map(s=>s.length));for(let s=0;s<e;s++){let i=new Map;this.set.forEach((o,h)=>{if(!(o[s]instanceof Ls.Matcher||o[s]===ze)||!xn(this.globParts[h][s]))return;let a=[...this.globParts[h]];a[s]="";let l=`${o.length}/${a.join("/")}`,c=i.get(l);c?c.push(h):i.set(l,[h])});let n=new Set;for(let o of i.values()){if(o.length<2)continue;let[h,...a]=o,c=`@(${o.map(u=>this.globParts[u][s]).join("|")})`;this.globParts[h][s]=c,this.set[h][s]=this.parse(c);for(let u of a)n.add(u)}n.size&&(t=!0,this.set=this.set.filter((o,h)=>!n.has(h)),this.globParts=this.globParts.filter((o,h)=>!n.has(h)))}}}preprocess(t){if(this.options.noglobstar)for(let s of t)for(let i=0;i<s.length;i++)s[i]==="**"&&(s[i]="*");let{optimizationLevel:e=1}=this.options;return e>=2?(t=this.firstPhasePreProcess(t),t=this.secondPhasePreProcess(t)):e>=1?t=this.levelOneOptimize(t):t=this.adjascentGlobstarOptimize(t),t}adjascentGlobstarOptimize(t){return t.map(e=>{let s=-1;for(;(s=e.indexOf("**",s+1))!==-1;){let i=s;for(;e[i+1]==="**";)i++;i!==s&&e.splice(s,i-s)}return e})}levelOneOptimize(t){return t.map(e=>{let s=this.#s(e)+1;return e=e.reduce((i,n)=>{let o=i[i.length-1];return n==="**"&&o==="**"?i:n===".."&&i.length>s&&o&&o!==".."&&o!=="."&&o!=="**"?(i.pop(),i):(i.push(n),i)},[]),e.length===0?[""]:e})}#b(t){let e=!this.isWindows||!t.includes("\\")?"/":t.includes("/")?"both":"\\",s=this.#t?0:-1,i="",n=0,o,h=0,a=!!this.options.dot;t:for(let l=0;l<this.set.length;l++){let c=this.set[l],u=c[c.length-1],f=s!==-1&&this.#f[l]&&u!==w.GLOBSTAR;if(f&&s===0){let d=Is(t,t.length,e);if(n=d+1,i=t.slice(n),i===""&&d>=0){let m=d;for(;m>0&&qt(t.charCodeAt(m-1),e);)m--;h=m===0?0:Is(t,m-1,e)+1,o=t.slice(h,m)}let b=this.#i&&(Be(i)||i===""&&o!==void 0&&Be(o));s=b?-1:1,f=!b}let p=-1;if(f&&typeof u=="string"&&(p=Gs(u,i,n,o,h),p===-1))continue;if(this.#n){for(let d of this.#r[l])if(!t.includes(d))continue t}if(f&&typeof u=="object"&&(p=Gs(u,i,n,o,h),p===-1))continue;let g=this.#d[l];if(g==="base"&&f)return"yes";if(g==="tail"&&f){if(this.#i&&pt(t,0,p,!0,e))return"maybe";if(!pt(t,0,p,a,e))return"yes";continue}if(g==="mid"||g==="head"){let d=this.#y(t,c,g==="head",a,e);if(d!=="no")return d;continue}return"maybe"}return"no"}#E(t,e,s){let i=!!this.options.dot,n=t.length;if(s==="head"){if(n<2||!V(e[0],t[0]))return!1;for(let h=1;h<n;h++)if(!It(t[h],i))return!1;return!0}let o=e[1];if(s==="tail"){let h=n-1;if(!V(o,t[h])&&(t[h]!==""||n===1||!V(o,t[--h])))return!1;for(let a=0;a<h;a++)if(!It(t[a],i))return!1;return!0}for(let h=0;h<n;h++){if(V(o,t[h])&&h+1<n){let a=h+1;for(;a<n&&It(t[a],i);)a++;if(a===n)return!0}if(!It(t[h],i))return!1}return!1}#y(t,e,s,i,n){if(this.#i&&pt(t,0,t.length,!0,n))return"maybe";let o=e[s?0:1],h=0;for(let a=Ge(t,h,n);a!==-1;a=Ge(t,h,n)){let l=a+1;for(;l<t.length&&qt(t.charCodeAt(l),n);)l++;if((typeof o=="string"?a-h===o.length&&t.startsWith(o,h):a>h&&o.testUnchecked(t.slice(h,a)))&&!pt(t,l,t.length,i,n))return"yes";if(s||pt(t,h,l,i,n))return"no";h=l}return"no"}#g(t){let e=De;return e?.f===t&&e.isWindows===this.isWindows&&e.preserveMultipleSlashes===this.preserveMultipleSlashes&&e.normalize===this.#o?e:void 0}#w(t){let{isWindows:e,preserveMultipleSlashes:s}=this,i=this.#e(e?t.split("\\").join("/"):t),n=this.#o;return n&&(i=i.map(o=>o.normalize(n))),De={f:t,isWindows:e,preserveMultipleSlashes:s,normalize:n,parts:i},De}#p(t){let e=[...t],s=!1;do{if(s=!1,!this.preserveMultipleSlashes){for(let o=1;o<e.length-1;o++){let h=e[o];o===1&&h===""&&e[0]===""||(h==="."||h==="")&&(s=!0,e.splice(o,1),o--)}e[0]==="."&&e.length===2&&(e[1]==="."||e[1]==="")&&(s=!0,e.pop())}let i=this.#s(e)+1,n=i;for(;(n=e.indexOf("..",n+1))!==-1;){let o=e[n-1];o&&o!=="."&&o!==".."&&o!=="**"&&(s=!0,e.splice(n-1,2),n=Math.max(n-2,i))}}while(s);return e.length===0?[""]:e}firstPhasePreProcess(t){let{braceExpandMax:e=1e5}=this.options,s=0,i=1e6,n=!1;do{n=!1;for(let o of t){let h=-1;for(;(h=o.indexOf("**",h+1))!==-1;){let c=h;for(;o[c+1]==="**";)c++;c>h&&o.splice(h+1,c-h);let u=o[h+1],f=o[h+2],p=o[h+3];if(u!==".."||!f||f==="."||f===".."||!p||p==="."||p==="..")continue;let g=o.length-1;if(t.length>=e||s+g>i)throw new RangeError("optimizationLevel 2: too many patterns from '**/..'");n=!0,o.splice(h,1);let d=o.slice(0);d[h]="**",s+=g,t.push(d),h--}if(!this.preserveMultipleSlashes){for(let c=1;c<o.length-1;c++){let u=o[c];c===1&&u===""&&o[0]===""||(u==="."||u==="")&&(n=!0,o.splice(c,1),c--)}o[0]==="."&&o.length===2&&(o[1]==="."||o[1]==="")&&(n=!0,o.pop())}let a=this.#s(o)+1,l=a;for(;(l=o.indexOf("..",l+1))!==-1;){let c=o[l-1];if(c&&c!=="."&&c!==".."&&c!=="**"){n=!0;let f=l===1&&o[l+1]==="**"?["."]:[];o.splice(l-1,2,...f),o.length===0&&o.push(""),l=Math.max(l-2,a)}}}}while(n);return t}secondPhasePreProcess(t){let e=new Set,s=t.filter(o=>{let h=o.join("/");return e.has(h)?!1:(e.add(h),!0)}),i=new Map;for(let o of s){let h=[];for(let a=0;a<o.length;a++)o[a]==="*"&&h.push(a);h.length&&i.set(h.join(","),h)}if(!i.size||s.length*i.size>1e5)return s;let{dot:n}=this.options;return s.filter(o=>{for(let h of i.values()){if(h[h.length-1]>=o.length)continue;let a=[...o],l=!0,c=!1;for(let u of h){let f=o[u];if(f!=="*"){if(!f||f==="**"||!n&&f.startsWith(".")){l=!1;break}a[u]="*",c=!0}}if(l&&c&&e.has(a.join("/")))return!1}return!0})}parseNegate(){if(this.nonegate)return;let t=this.pattern,e=!1,s=0;for(let i=0;i<t.length&&t.charAt(i)==="!";i++)e=!e,s++;s&&(this.pattern=t.slice(s)),this.negate=e}#O(t,e,s,i){let n=0,o=0,h=this.isWindows?We(e):-1,a=h===-1?-1:We(s);if(a!==-1){let l=s[a],c=s[a+1];typeof l!="string"||typeof c!="string"?(n=h,o=a):e[h].toLowerCase()===l.toLowerCase()&&e[h+1].toLowerCase()===c.toLowerCase()&&(n=h+2,o=a+2)}else if(this.isWindows){let l=typeof t[0]=="string"&&/^[a-z]:$/i.test(t[0]),c=!l&&t[0]===""&&t[1]===""&&t[2]==="?"&&/^[a-z]:$/i.test(t[3]),u=typeof s[0]=="string"&&/^[a-z]:$/i.test(s[0]),f=!u&&s[0]===""&&s[1]===""&&s[2]==="?"&&typeof s[3]=="string"&&/^[a-z]:$/i.test(s[3]),p=c?3:l?0:void 0,g=f?3:u?0:void 0;if(typeof p=="number"&&typeof g=="number"){let[d,b]=[t[p],s[g]];d.toLowerCase()===b.toLowerCase()&&(o=g+1,n=p+1)}}return t=e,s.includes(w.GLOBSTAR)?this.#x(t,s,i,n,o):this.#S(t,s,i,n,o)}#x(t,e,s,i,n){let{head:o,body:h,tail:a,segments:l}=this.#v(e,s,n);if(o.length){let u=i+o.length;if(!this.#S(t,o,s,i,0,u))return!1;i+=o.length,n+=o.length}let c=0;if(a.length){if(a.length+i>t.length)return!1;let u=t.length-a.length;if(this.#S(t,a,s,u,0))c=a.length;else{if(t[t.length-1]!==""||i+a.length===t.length||(u--,!this.#S(t,a,s,u,0)))return!1;c=a.length+1}}if(!h.length){let u=!!c;for(let f=i;f<t.length-c;f++){let p=String(t[f]);if(u=!0,p==="."||p===".."||!this.options.dot&&p.startsWith("."))return!1}return s||u}return!!this.#_(t,l,t.length-c,i,0,s,0,!!c,new Set)}#v(t,e,s){let i=this.#l.get(t);i||(i=[],this.#l.set(t,i));let n=s*2+(e?1:0),o=i[n];if(o)return o;let h=t.indexOf(w.GLOBSTAR,s),a=t.lastIndexOf(w.GLOBSTAR),l=t.slice(s,h),c=t.slice(h+1,e?void 0:a),u=e?[]:t.slice(a+1),f=[[[],0]],p=f[0],g=0,d=[0];for(let m of c)m===w.GLOBSTAR?(d.push(g),p=[[],0],f.push(p)):(p[0].push(m),g++);f.forEach((m,y)=>{m[1]=g-d[y]});let b={head:l,body:c,tail:u,segments:f};return i[n]=b,b}#_(t,e,s,i,n,o,h,a,l){let c=e[n];if(!c){if(o)return i>=s||i===s-1&&t[i]==="";for(let g=i;g<s;g++){a=!0;let d=t[g];if(d==="."||d===".."||!this.options.dot&&d.startsWith("."))return!1}return a}let[u,f]=c,p=o?s:s-f;for(;i<=p;){let g=n*(t.length+1)+i;if(l.has(g))return!1;if(l.add(g),this.#S(t,u,o,i,0,i+u.length)&&h<this.maxGlobstarRecursion){let m=this.#_(t,e,s,i+u.length,n+1,o,h+1,a,l);if(m!==!1)return m}if(i===p)break;let b=t[i];if(b==="."||b===".."||!this.options.dot&&b.startsWith("."))return!1;i++}return o||null}#S(t,e,s,i,n,o=t.length){let h,a,l,c;for(h=i,a=n,c=Math.min(o,t.length),l=e.length;h<c&&a<l;h++,a++){let u=e[a],f=t[h];if(u===!1||u===w.GLOBSTAR||!V(u,f))return!1}if(h===c&&a===l)return!0;if(h===c)return s;if(a===l)return h===c-1&&t[h]==="";throw new Error("wtf?")}braceExpand(){return(0,w.braceExpand)(this.pattern,this.options)}#M(){let{pattern:t}=this;if(this.options.nobrace)return this.braceExpand();let e=57344;for(;t.includes(String.fromCharCode(e));)if(++e>63743)return this.braceExpand();let s=String.fromCharCode(e),i=!1,n=t.replace(_n,(h,a,l)=>{let c=Number(a),u=Number(l);return!Number.isSafeInteger(c)||!Number.isSafeInteger(u)||Math.abs(c-u)+1<vn?h:(i=!0,`${s}${a}..${l}${s}`)});if(!i)return this.braceExpand();let o=(0,w.braceExpand)(n,this.options);for(let h of o)for(let a of h.split("/")){let l=a.indexOf("[");if(l!==-1&&l<a.lastIndexOf(s))return this.braceExpand()}return this.#m=s,o}parse(t){(0,Ut.assertValidPattern)(t);let e=this.options;if(t==="**")return w.GLOBSTAR;if(t==="")return"";let{nocase:s,nocaseMagicOnly:i,noext:n=!1,dot:o,normalize:h}=e,a=this.#m,l=a&&t.includes(a)?void 0:On(t,n);if(l!==void 0&&!(s&&!i&&t.toUpperCase()!==t.toLowerCase()))return this.#a(l);if(this.#h)return ze;let c=this.#u.get(t);return c||(c=new Ls.Matcher(t,{nocase:s,noext:n,dot:o,normalize:h,...a&&{rangeMark:a}}),this.#u.set(t,c)),c}#e(t){return this.preserveMultipleSlashes?t.split("/"):this.isWindows&&/^\/\/[^/]+/.test(t)?["",...t.split(/\/+/)]:t.split(/\/+/)}match(t,e=this.partial){if(this.comment)return!1;if(this.empty)return t==="";if(t==="/"&&e)return!0;let s=this.options,i=this.#g(t);if(!i){if(!e&&!this.#o&&(this.#t||this.#n)&&Bs!==t){Bs=t;let l=this.#b(t);if(l==="no")return s.flipNegate?!1:this.negate;if(l==="yes")return s.flipNegate?!0:!this.negate}i=this.#w(t)}let n=i.parts,o=this.#i?i.resolved??=this.#p(n):n,h=this.set,a=n[n.length-1];if(!a)for(let l=n.length-2;!a&&l>=0;l--)a=n[l];for(let l=0;l<h.length;l++){let c=h[l],u=e?void 0:this.#d[l];if(u==="base"?V(c[0],a):u?this.#E(o,c,u):s.matchBase&&c.length===1?this.#O([a],[a],c,e):this.#O(n,o,c,e))return s.flipNegate?!0:!this.negate}return s.flipNegate?!1:this.negate}static defaults(t){return w.minimatch.defaults(t).Minimatch}};w.Minimatch=ht;var Cn=je();Object.defineProperty(w,"escape",{enumerable:!0,get:function(){return Cn.escape}});var Mn=Ne();Object.defineProperty(w,"unescape",{enumerable:!0,get:function(){return Mn.unescape}});w.minimatch.Minimatch=ht;w.minimatch.escape=dn.escape;w.minimatch.unescape=pn.unescape});var Ys=C(Xt=>{"use strict";var Hs=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports),kn=Hs(r=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.tracing=r.metrics=void 0;var t=__webpack_require__(/*! node:diagnostics_channel */ "node:diagnostics_channel");r.metrics=(0,t.channel)("lru-cache:metrics"),r.tracing=(0,t.tracingChannel)("lru-cache")}),An=Hs(r=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.defaultPerf=void 0,r.defaultPerf=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date});Object.defineProperty(Xt,"__esModule",{value:!0});Xt.LRUCache=void 0;var O=kn(),Rn=An(),Ie=()=>O.metrics.hasSubscribers||O.tracing.hasSubscribers,Xs=new Set,qs=typeof process=="object"&&process?process:{},Pn=(r,t,e,s)=>{typeof qs.emitWarning=="function"?qs.emitWarning(r,t,e,s):console.error(`[${e}] ${t}: ${r}`)},Tn=r=>!Xs.has(r),J=r=>!!r&&r===Math.floor(r)&&r>0&&isFinite(r),Ks=r=>J(r)?r<=Math.pow(2,8)?Uint8Array:r<=Math.pow(2,16)?Uint16Array:r<=Math.pow(2,32)?Uint32Array:r<=Number.MAX_SAFE_INTEGER?Ht:null:null,Ht=class extends Array{constructor(r){super(r),this.fill(0)}},Fn=class mt{heap;length;static#t=!1;static create(t){let e=Ks(t);if(!e)return[];mt.#t=!0;let s=new mt(t,e);return mt.#t=!1,s}constructor(t,e){if(!mt.#t)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new e(t),this.length=0}push(t){this.heap[this.length++]=t}pop(){return this.heap[--this.length]}},jn=class Vs{#t;#n;#i;#o;#r;#d;#f;#u;get perf(){return this.#u}ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;backgroundFetchSize;#h;#m;#l;#a;#s;#b;#E;#y;#g;#w;#p;#O;#x;#v;#_;#S;#M;#e;#P;static unsafeExposeInternals(t){return{starts:t.#x,ttls:t.#v,autopurgeTimers:t.#_,sizes:t.#O,keyMap:t.#l,keyList:t.#a,valList:t.#s,next:t.#b,prev:t.#E,get head(){return t.#y},get tail(){return t.#g},free:t.#w,isBackgroundFetch:e=>t.#c(e),backgroundFetch:(e,s,i,n)=>t.#L(e,s,i,n),moveToTail:e=>t.#K(e),indexes:e=>t.#A(e),rindexes:e=>t.#R(e),isStale:e=>t.#C(e)}}get max(){return this.#t}get maxSize(){return this.#n}get calculatedSize(){return this.#m}get size(){return this.#h}get fetchMethod(){return this.#d}get memoMethod(){return this.#f}get dispose(){return this.#i}get onInsert(){return this.#o}get disposeAfter(){return this.#r}constructor(t){let{max:e=0,ttl:s,ttlResolution:i=1,ttlAutopurge:n,updateAgeOnGet:o,updateAgeOnHas:h,allowStale:a,dispose:l,onInsert:c,disposeAfter:u,noDisposeOnSet:f,noUpdateTTL:p,maxSize:g=0,maxEntrySize:d=0,sizeCalculation:b,fetchMethod:m,memoMethod:y,noDeleteOnFetchRejection:_,noDeleteOnStaleGet:v,allowStaleOnFetchRejection:S,allowStaleOnFetchAbort:K,ignoreFetchAbort:B,backgroundFetchSize:U=1,perf:rt}=t;if(this.backgroundFetchSize=U,rt!==void 0&&typeof rt?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(this.#u=rt??Rn.defaultPerf,e!==0&&!J(e))throw new TypeError("max option must be a nonnegative integer");let Se=e?Ks(e):Array;if(!Se)throw new Error("invalid max value: "+e);if(this.#t=e,this.#n=g,this.maxEntrySize=d||this.#n,this.sizeCalculation=b,this.sizeCalculation){if(!this.#n&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(y!==void 0&&typeof y!="function")throw new TypeError("memoMethod must be a function if defined");if(this.#f=y,m!==void 0&&typeof m!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#d=m,this.#M=!!m,this.#l=new Map,this.#a=Array.from({length:e}).fill(void 0),this.#s=Array.from({length:e}).fill(void 0),this.#b=new Se(e),this.#E=new Se(e),this.#y=0,this.#g=0,this.#w=Fn.create(e),this.#h=0,this.#m=0,typeof l=="function"&&(this.#i=l),typeof c=="function"&&(this.#o=c),typeof u=="function"?(this.#r=u,this.#p=[]):(this.#r=void 0,this.#p=void 0),this.#S=!!this.#i,this.#P=!!this.#o,this.#e=!!this.#r,this.noDisposeOnSet=!!f,this.noUpdateTTL=!!p,this.noDeleteOnFetchRejection=!!_,this.allowStaleOnFetchRejection=!!S,this.allowStaleOnFetchAbort=!!K,this.ignoreFetchAbort=!!B,this.maxEntrySize!==0){if(this.#n!==0&&!J(this.#n))throw new TypeError("maxSize must be a positive integer if specified");if(!J(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#U()}if(this.allowStale=!!a,this.noDeleteOnStaleGet=!!v,this.updateAgeOnGet=!!o,this.updateAgeOnHas=!!h,this.ttlResolution=J(i)||i===0?i:1,this.ttlAutopurge=!!n,this.ttl=s||0,this.ttl){if(!J(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#T()}if(this.#t===0&&this.ttl===0&&this.#n===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#t&&!this.#n){let ve="LRU_CACHE_UNBOUNDED";Tn(ve)&&(Xs.add(ve),Pn("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",ve,Vs))}}getRemainingTTL(t){return this.#l.has(t)?1/0:0}#T(){let t=new Ht(this.#t),e=new Ht(this.#t);this.#v=t,this.#x=e;let s=this.ttlAutopurge?Array.from({length:this.#t}):void 0;this.#_=s,this.#z=(a,l,c=this.#u.now())=>{e[a]=l!==0?c:0,t[a]=l,i(a,l)},this.#k=a=>{e[a]=t[a]!==0?this.#u.now():0,i(a,t[a])};let i=this.ttlAutopurge?(a,l)=>{if(s?.[a]&&(clearTimeout(s[a]),s[a]=void 0),l&&l!==0&&s){let c=setTimeout(()=>{this.#C(a)?(this.#W(this.#a[a],"expire"),s[a]=void 0):i(a,h(a))},l+1);c.unref&&c.unref(),s[a]=c}}:()=>{};this.#F=(a,l)=>{if(t[l]){let c=t[l],u=e[l];if(!c||!u)return;a.ttl=c,a.start=u,a.now=n||o();let f=a.now-u;a.remainingTTL=c-f}};let n=0,o=()=>{let a=this.#u.now();if(this.ttlResolution>0){n=a;let l=setTimeout(()=>n=0,this.ttlResolution);l.unref&&l.unref()}return a};this.getRemainingTTL=a=>{let l=this.#l.get(a);return l===void 0?0:h(l)};let h=a=>{let l=t[a],c=e[a];if(!l||!c)return 1/0;let u=(n||o())-c;return l-u};this.#C=a=>{let l=e[a],c=t[a];return!!c&&!!l&&(n||o())-l>c}}#k=()=>{};#F=()=>{};#z=()=>{};#C=()=>!1;#U(){let t=new Ht(this.#t);this.#m=0,this.#O=t,this.#N=e=>{this.#m-=t[e],t[e]=0},this.#B=(e,s,i,n)=>{if(!J(i)){if(this.#c(s))return this.backgroundFetchSize;if(n){if(typeof n!="function")throw new TypeError("sizeCalculation must be a function");if(i=n(s,e),!J(i))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.")}return i},this.#j=(e,s,i)=>{if(t[e]=s,this.#n){let n=this.#n-t[e];for(;this.#m>n;)this.#$(!0)}this.#m+=t[e],i&&(i.entrySize=s,i.totalCalculatedSize=this.#m)}}#N=t=>{};#j=(t,e,s)=>{};#B=(t,e,s,i)=>{if(s||i)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#A({allowStale:t=this.allowStale}={}){if(this.#h)for(let e=this.#g;this.#G(e)&&((t||!this.#C(e))&&(yield e),e!==this.#y);)e=this.#E[e]}*#R({allowStale:t=this.allowStale}={}){if(this.#h)for(let e=this.#y;this.#G(e)&&((t||!this.#C(e))&&(yield e),e!==this.#g);)e=this.#b[e]}#G(t){return t!==void 0&&this.#l.get(this.#a[t])===t}*entries(){for(let t of this.#A())this.#s[t]!==void 0&&this.#a[t]!==void 0&&!this.#c(this.#s[t])&&(yield[this.#a[t],this.#s[t]])}*rentries(){for(let t of this.#R())this.#s[t]!==void 0&&this.#a[t]!==void 0&&!this.#c(this.#s[t])&&(yield[this.#a[t],this.#s[t]])}*keys(){for(let t of this.#A()){let e=this.#a[t];e!==void 0&&!this.#c(this.#s[t])&&(yield e)}}*rkeys(){for(let t of this.#R()){let e=this.#a[t];e!==void 0&&!this.#c(this.#s[t])&&(yield e)}}*values(){for(let t of this.#A())this.#s[t]!==void 0&&!this.#c(this.#s[t])&&(yield this.#s[t])}*rvalues(){for(let t of this.#R())this.#s[t]!==void 0&&!this.#c(this.#s[t])&&(yield this.#s[t])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(t,e={}){for(let s of this.#A()){let i=this.#s[s],n=this.#c(i)?i.__staleWhileFetching:i;if(n!==void 0&&t(n,this.#a[s],this))return this.#X(this.#a[s],e)}}forEach(t,e=this){for(let s of this.#A()){let i=this.#s[s],n=this.#c(i)?i.__staleWhileFetching:i;n!==void 0&&t.call(e,n,this.#a[s],this)}}rforEach(t,e=this){for(let s of this.#R()){let i=this.#s[s],n=this.#c(i)?i.__staleWhileFetching:i;n!==void 0&&t.call(e,n,this.#a[s],this)}}purgeStale(){let t=!1;for(let e of this.#R({allowStale:!0}))this.#C(e)&&(this.#W(this.#a[e],"expire"),t=!0);return t}info(t){let e=this.#l.get(t);if(e===void 0)return;let s=this.#s[e],i=this.#c(s)?s.__staleWhileFetching:s;if(i===void 0)return;let n={value:i};if(this.#v&&this.#x){let o=this.#v[e],h=this.#x[e];if(o&&h){let a=o-(this.#u.now()-h);n.ttl=a,n.start=Date.now()}}return this.#O&&(n.size=this.#O[e]),n}dump(){let t=[];for(let e of this.#A({allowStale:!0})){let s=this.#a[e],i=this.#s[e],n=this.#c(i)?i.__staleWhileFetching:i;if(n===void 0||s===void 0)continue;let o={value:n};if(this.#v&&this.#x){o.ttl=this.#v[e];let h=this.#u.now()-this.#x[e];o.start=Math.floor(Date.now()-h)}this.#O&&(o.size=this.#O[e]),t.unshift([s,o])}return t}load(t){this.clear();for(let[e,s]of t){if(s.start){let i=Date.now()-s.start;s.start=this.#u.now()-i}this.#D(e,s.value,s)}}set(t,e,s={}){let{status:i=O.metrics.hasSubscribers?{}:void 0}=s;s.status=i,i&&(i.op="set",i.key=t,e!==void 0&&(i.value=e),i.cache=this);let n=this.#D(t,e,s);return i&&O.metrics.hasSubscribers&&O.metrics.publish(i),n}#D(t,e,s,i){let{ttl:n=this.ttl,start:o,noDisposeOnSet:h=this.noDisposeOnSet,sizeCalculation:a=this.sizeCalculation,status:l}=s,c=this.#c(e);if(e===void 0)return l&&(l.set="deleted"),this.delete(t),this;let{noUpdateTTL:u=this.noUpdateTTL}=s;l&&!c&&(l.value=e);let f=this.#B(t,e,s.size||0,a,l);if(this.maxEntrySize&&f>this.maxEntrySize)return this.#W(t,"set"),l&&(l.set="miss",l.maxEntrySizeExceeded=!0),this;let p=this.#h===0?void 0:this.#l.get(t);if(p===void 0)p=this.#h===0?this.#g:this.#w.length!==0?this.#w.pop():this.#h===this.#t?this.#$(!1):this.#h,this.#a[p]=t,this.#s[p]=e,this.#l.set(t,p),this.#b[this.#g]=p,this.#E[p]=this.#g,this.#g=p,this.#h++,this.#j(p,f,l),l&&(l.set="add"),u=!1,this.#P&&!c&&this.#o?.(e,t,"add");else{this.#K(p);let g=this.#s[p];if(e!==g){if(!h)if(this.#c(g)){g!==i&&g.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:d}=g;d!==void 0&&d!==e&&(this.#S&&this.#i?.(d,t,"set"),this.#e&&this.#p?.push([d,t,"set"]))}else this.#S&&this.#i?.(g,t,"set"),this.#e&&this.#p?.push([g,t,"set"]);if(this.#N(p),this.#j(p,f,l),this.#s[p]=e,!c){let d=g&&this.#c(g)?g.__staleWhileFetching:g,b=d===void 0?"add":e!==d?"replace":"update";l&&(l.set=b,d!==void 0&&(l.oldValue=d)),this.#P&&this.onInsert?.(e,t,b)}}else c||(l&&(l.set="update"),this.#P&&this.onInsert?.(e,t,"update"))}if(n!==0&&!this.#v&&this.#T(),this.#v&&(u||this.#z(p,n,o),l&&this.#F(l,p)),!h&&this.#e&&this.#p){let g=this.#p,d;for(;d=g?.shift();)this.#r?.(...d)}return this}pop(){try{for(;this.#h;){let t=this.#s[this.#y];if(this.#$(!0),this.#c(t)){if(t.__staleWhileFetching)return t.__staleWhileFetching}else if(t!==void 0)return t}}finally{if(this.#e&&this.#p){let t=this.#p,e;for(;e=t?.shift();)this.#r?.(...e)}}}#$(t){let e=this.#y,s=this.#a[e],i=this.#s[e],n=this.#c(i);n&&i.__abortController.abort(new Error("evicted"));let o=n?i.__staleWhileFetching:i;return(this.#S||this.#e)&&o!==void 0&&(this.#S&&this.#i?.(o,s,"evict"),this.#e&&this.#p?.push([o,s,"evict"])),this.#N(e),this.#_?.[e]&&(clearTimeout(this.#_[e]),this.#_[e]=void 0),t&&(this.#a[e]=void 0,this.#s[e]=void 0,this.#w.push(e)),this.#h===1?(this.#y=this.#g=0,this.#w.length=0):this.#y=this.#b[e],this.#l.delete(s),this.#h--,e}has(t,e={}){let{status:s=O.metrics.hasSubscribers?{}:void 0}=e;e.status=s,s&&(s.op="has",s.key=t,s.cache=this);let i=this.#V(t,e);return O.metrics.hasSubscribers&&O.metrics.publish(s),i}#V(t,e={}){let{updateAgeOnHas:s=this.updateAgeOnHas,status:i}=e,n=this.#l.get(t);if(n!==void 0){let o=this.#s[n];if(this.#c(o)&&o.__staleWhileFetching===void 0)return!1;if(this.#C(n))i&&(i.has="stale",this.#F(i,n));else return s&&this.#k(n),i&&(i.has="hit",this.#F(i,n)),!0}else i&&(i.has="miss");return!1}peek(t,e={}){let{status:s=Ie()?{}:void 0}=e;s&&(s.op="peek",s.key=t,s.cache=this),e.status=s;let i=this.#q(t,e);return O.metrics.hasSubscribers&&O.metrics.publish(s),i}#q(t,e){let{status:s,allowStale:i=this.allowStale}=e,n=this.#l.get(t);if(n===void 0||!i&&this.#C(n)){s&&(s.peek=n===void 0?"miss":"stale");return}let o=this.#s[n],h=this.#c(o)?o.__staleWhileFetching:o;return s&&(h!==void 0?(s.peek="hit",s.value=h):s.peek="miss"),h}#L(t,e,s,i){let n=e===void 0?void 0:this.#s[e];if(this.#c(n))return n;let o=new AbortController,{signal:h}=s;h?.addEventListener("abort",()=>o.abort(h.reason),{signal:o.signal});let a={signal:o.signal,options:s,context:i},l=(d,b=!1)=>{let{aborted:m}=o.signal,y=s.ignoreFetchAbort&&d!==void 0,_=s.ignoreFetchAbort||!!(s.allowStaleOnFetchAbort&&d!==void 0);if(s.status&&(m&&!b?(s.status.fetchAborted=!0,s.status.fetchError=o.signal.reason,y&&(s.status.fetchAbortIgnored=!0)):s.status.fetchResolved=!0),m&&!y&&!b)return u(o.signal.reason,_);let v=p,S=this.#s[e];return(S===p||S===void 0&&y&&b)&&(d===void 0?v.__staleWhileFetching!==void 0?this.#s[e]=v.__staleWhileFetching:this.#W(t,"fetch"):(s.status&&(s.status.fetchUpdated=!0),this.#D(t,d,a.options,v))),d},c=d=>(s.status&&(s.status.fetchRejected=!0,s.status.fetchError=d),u(d,!1)),u=(d,b)=>{let{aborted:m}=o.signal,y=m&&s.allowStaleOnFetchAbort,_=y||s.allowStaleOnFetchRejection,v=_||s.noDeleteOnFetchRejection,S=p;if(this.#s[e]===p&&(!v||!b&&S.__staleWhileFetching===void 0?this.#W(t,"fetch"):y||(this.#s[e]=S.__staleWhileFetching)),_)return s.status&&S.__staleWhileFetching!==void 0&&(s.status.returnedStale=!0),S.__staleWhileFetching;if(S.__returned===S)throw d},f=(d,b)=>{let m=this.#d?.(t,n,a);o.signal.addEventListener("abort",()=>{(!s.ignoreFetchAbort||s.allowStaleOnFetchAbort)&&(d(void 0),s.allowStaleOnFetchAbort&&(d=y=>l(y,!0)))}),m&&m instanceof Promise?m.then(y=>d(y===void 0?void 0:y),b):m!==void 0&&d(m)};s.status&&(s.status.fetchDispatched=!0);let p=new Promise(f).then(l,c),g=Object.assign(p,{__abortController:o,__staleWhileFetching:n,__returned:void 0});return e===void 0?(this.#D(t,g,{...a.options,status:void 0}),e=this.#l.get(t)):this.#s[e]=g,g}#c(t){if(!this.#M)return!1;let e=t;return!!e&&e instanceof Promise&&e.hasOwnProperty("__staleWhileFetching")&&e.__abortController instanceof AbortController}fetch(t,e={}){let s=O.tracing.hasSubscribers,{status:i=Ie()?{}:void 0}=e;e.status=i,i&&e.context&&(i.context=e.context);let n=this.#H(t,e);return i&&s&&(i.trace=!0,O.tracing.tracePromise(()=>n,i).catch(()=>{})),n}async#H(t,e={}){let{allowStale:s=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,ttl:o=this.ttl,noDisposeOnSet:h=this.noDisposeOnSet,size:a=0,sizeCalculation:l=this.sizeCalculation,noUpdateTTL:c=this.noUpdateTTL,noDeleteOnFetchRejection:u=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:f=this.allowStaleOnFetchRejection,ignoreFetchAbort:p=this.ignoreFetchAbort,allowStaleOnFetchAbort:g=this.allowStaleOnFetchAbort,context:d,forceRefresh:b=!1,status:m,signal:y}=e;if(m&&(m.op="fetch",m.key=t,b&&(m.forceRefresh=!0),m.cache=this),!this.#M)return m&&(m.fetch="get"),this.#X(t,{allowStale:s,updateAgeOnGet:i,noDeleteOnStaleGet:n,status:m});let _={allowStale:s,updateAgeOnGet:i,noDeleteOnStaleGet:n,ttl:o,noDisposeOnSet:h,size:a,sizeCalculation:l,noUpdateTTL:c,noDeleteOnFetchRejection:u,allowStaleOnFetchRejection:f,allowStaleOnFetchAbort:g,ignoreFetchAbort:p,status:m,signal:y},v=this.#l.get(t);if(v===void 0){m&&(m.fetch="miss");let S=this.#L(t,v,_,d);return S.__returned=S}else{let S=this.#s[v];if(this.#c(S)){let rt=s&&S.__staleWhileFetching!==void 0;return m&&(m.fetch="inflight",rt&&(m.returnedStale=!0)),rt?S.__staleWhileFetching:S.__returned=S}let K=this.#C(v);if(!b&&!K)return m&&(m.fetch="hit"),this.#K(v),i&&this.#k(v),m&&this.#F(m,v),S;let B=this.#L(t,v,_,d),U=B.__staleWhileFetching!==void 0&&s;return m&&(m.fetch=K?"stale":"refresh",U&&K&&(m.returnedStale=!0)),U?B.__staleWhileFetching:B.__returned=B}}forceFetch(t,e={}){let s=O.tracing.hasSubscribers,{status:i=Ie()?{}:void 0}=e;e.status=i,i&&e.context&&(i.context=e.context);let n=this.#I(t,e);return i&&s&&(i.trace=!0,O.tracing.tracePromise(()=>n,i).catch(()=>{})),n}async#I(t,e={}){let s=await this.#H(t,e);if(s===void 0)throw new Error("fetch() returned undefined");return s}memo(t,e={}){let{status:s=O.metrics.hasSubscribers?{}:void 0}=e;e.status=s,s&&(s.op="memo",s.key=t,e.context&&(s.context=e.context),s.cache=this);let i=this.#Z(t,e);return s&&(s.value=i),O.metrics.hasSubscribers&&O.metrics.publish(s),i}#Z(t,e={}){let s=this.#f;if(!s)throw new Error("no memoMethod provided to constructor");let{context:i,status:n,forceRefresh:o,...h}=e;n&&o&&(n.forceRefresh=!0);let a=this.#X(t,h),l=o||a===void 0;if(n&&(n.memo=l?"miss":"hit",l||(n.value=a)),!l)return a;let c=s(t,a,{options:h,context:i});return n&&(n.value=c),this.#D(t,c,h),c}get(t,e={}){let{status:s=O.metrics.hasSubscribers?{}:void 0}=e;e.status=s,s&&(s.op="get",s.key=t,s.cache=this);let i=this.#X(t,e);return s&&(i!==void 0&&(s.value=i),O.metrics.hasSubscribers&&O.metrics.publish(s)),i}#X(t,e={}){let{allowStale:s=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,status:o}=e,h=this.#l.get(t);if(h===void 0){o&&(o.get="miss");return}let a=this.#s[h],l=this.#c(a);return o&&this.#F(o,h),this.#C(h)?l?(o&&(o.get="stale-fetching"),s&&a.__staleWhileFetching!==void 0?(o&&(o.returnedStale=!0),a.__staleWhileFetching):void 0):(n||this.#W(t,"expire"),o&&(o.get="stale"),s?(o&&(o.returnedStale=!0),a):void 0):(o&&(o.get=l?"fetching":"hit"),this.#K(h),i&&this.#k(h),l?a.__staleWhileFetching:a)}#Y(t,e){this.#E[e]=t,this.#b[t]=e}#K(t){t!==this.#g&&(t===this.#y?this.#y=this.#b[t]:this.#Y(this.#E[t],this.#b[t]),this.#Y(this.#g,t),this.#g=t)}delete(t){return this.#W(t,"delete")}#W(t,e){O.metrics.hasSubscribers&&O.metrics.publish({op:"delete",delete:e,key:t,cache:this});let s=!1;if(this.#h!==0){let i=this.#l.get(t);if(i!==void 0)if(this.#_?.[i]&&(clearTimeout(this.#_[i]),this.#_[i]=void 0),s=!0,this.#h===1)this.#J(e);else{this.#N(i);let n=this.#s[i];if(this.#c(n)?n.__abortController.abort(new Error("deleted")):(this.#S||this.#e)&&(this.#S&&this.#i?.(n,t,e),this.#e&&this.#p?.push([n,t,e])),this.#l.delete(t),this.#a[i]=void 0,this.#s[i]=void 0,i===this.#g)this.#g=this.#E[i];else if(i===this.#y)this.#y=this.#b[i];else{let o=this.#E[i];this.#b[o]=this.#b[i];let h=this.#b[i];this.#E[h]=this.#E[i]}this.#h--,this.#w.push(i)}}if(this.#e&&this.#p?.length){let i=this.#p,n;for(;n=i?.shift();)this.#r?.(...n)}return s}clear(){return this.#J("delete")}#J(t){for(let e of this.#R({allowStale:!0})){let s=this.#s[e];if(this.#c(s))s.__abortController.abort(new Error("deleted"));else{let i=this.#a[e];this.#S&&this.#i?.(s,i,t),this.#e&&this.#p?.push([s,i,t])}}if(this.#l.clear(),this.#s.fill(void 0),this.#a.fill(void 0),this.#v&&this.#x){this.#v.fill(0),this.#x.fill(0);for(let e of this.#_??[])e!==void 0&&clearTimeout(e);this.#_?.fill(void 0)}if(this.#O&&this.#O.fill(0),this.#y=0,this.#g=0,this.#w.length=0,this.#m=0,this.#h=0,this.#e&&this.#p){let e=this.#p,s;for(;s=e?.shift();)this.#r?.(...s)}}};Xt.LRUCache=jn});var Ye=C(j=>{"use strict";var Nn=j&&j.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(j,"__esModule",{value:!0});j.Minipass=j.isWritable=j.isReadable=j.isStream=void 0;var Js=typeof process=="object"&&process?process:{stdout:null,stderr:null},Ve=__webpack_require__(/*! node:events */ "node:events"),ei=Nn(__webpack_require__(/*! node:stream */ "node:stream")),Dn=__webpack_require__(/*! node:string_decoder */ "node:string_decoder"),Ln=r=>!!r&&typeof r=="object"&&(r instanceof te||r instanceof ei.default||(0,j.isReadable)(r)||(0,j.isWritable)(r));j.isStream=Ln;var Wn=r=>!!r&&typeof r=="object"&&r instanceof Ve.EventEmitter&&typeof r.pipe=="function"&&r.pipe!==ei.default.Writable.prototype.pipe;j.isReadable=Wn;var zn=r=>!!r&&typeof r=="object"&&r instanceof Ve.EventEmitter&&typeof r.write=="function"&&typeof r.end=="function";j.isWritable=zn;var H=Symbol("EOF"),X=Symbol("maybeEmitEnd"),Z=Symbol("emittedEnd"),Kt=Symbol("emittingEnd"),gt=Symbol("emittedError"),Vt=Symbol("closed"),Zs=Symbol("read"),Yt=Symbol("flush"),Qs=Symbol("flushChunk"),W=Symbol("encoding"),at=Symbol("decoder"),M=Symbol("flowing"),wt=Symbol("paused"),lt=Symbol("resume"),k=Symbol("buffer"),F=Symbol("pipes"),A=Symbol("bufferLength"),$e=Symbol("bufferPush"),Jt=Symbol("bufferShift"),P=Symbol("objectMode"),x=Symbol("destroyed"),Ue=Symbol("error"),qe=Symbol("emitData"),ti=Symbol("emitEnd"),He=Symbol("emitEnd2"),G=Symbol("async"),Xe=Symbol("abort"),Zt=Symbol("aborted"),bt=Symbol("signal"),st=Symbol("dataListeners"),N=Symbol("discarded"),yt=r=>Promise.resolve().then(r),Bn=r=>r(),Gn=r=>r==="end"||r==="finish"||r==="prefinish",In=r=>r instanceof ArrayBuffer||!!r&&typeof r=="object"&&r.constructor&&r.constructor.name==="ArrayBuffer"&&r.byteLength>=0,$n=r=>!Buffer.isBuffer(r)&&ArrayBuffer.isView(r),Qt=class{src;dest;opts;ondrain;constructor(t,e,s){this.src=t,this.dest=e,this.opts=s,this.ondrain=()=>t[lt](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(t){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},Ke=class extends Qt{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(t,e,s){super(t,e,s),this.proxyErrors=i=>this.dest.emit("error",i),t.on("error",this.proxyErrors)}},Un=r=>!!r.objectMode,qn=r=>!r.objectMode&&!!r.encoding&&r.encoding!=="buffer",te=class extends Ve.EventEmitter{[M]=!1;[wt]=!1;[F]=[];[k]=[];[P];[W];[G];[at];[H]=!1;[Z]=!1;[Kt]=!1;[Vt]=!1;[gt]=null;[A]=0;[x]=!1;[bt];[Zt]=!1;[st]=0;[N]=!1;writable=!0;readable=!0;constructor(...t){let e=t[0]||{};if(super(),e.objectMode&&typeof e.encoding=="string")throw new TypeError("Encoding and objectMode may not be used together");Un(e)?(this[P]=!0,this[W]=null):qn(e)?(this[W]=e.encoding,this[P]=!1):(this[P]=!1,this[W]=null),this[G]=!!e.async,this[at]=this[W]?new Dn.StringDecoder(this[W]):null,e&&e.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:()=>this[k]}),e&&e.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:()=>this[F]});let{signal:s}=e;s&&(this[bt]=s,s.aborted?this[Xe]():s.addEventListener("abort",()=>this[Xe]()))}get bufferLength(){return this[A]}get encoding(){return this[W]}set encoding(t){throw new Error("Encoding must be set at instantiation time")}setEncoding(t){throw new Error("Encoding must be set at instantiation time")}get objectMode(){return this[P]}set objectMode(t){throw new Error("objectMode must be set at instantiation time")}get async(){return this[G]}set async(t){this[G]=this[G]||!!t}[Xe](){this[Zt]=!0,this.emit("abort",this[bt]?.reason),this.destroy(this[bt]?.reason)}get aborted(){return this[Zt]}set aborted(t){}write(t,e,s){if(this[Zt])return!1;if(this[H])throw new Error("write after end");if(this[x])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;typeof e=="function"&&(s=e,e="utf8"),e||(e="utf8");let i=this[G]?yt:Bn;if(!this[P]&&!Buffer.isBuffer(t)){if($n(t))t=Buffer.from(t.buffer,t.byteOffset,t.byteLength);else if(In(t))t=Buffer.from(t);else if(typeof t!="string")throw new Error("Non-contiguous data written to non-objectMode stream")}return this[P]?(this[M]&&this[A]!==0&&this[Yt](!0),this[M]?this.emit("data",t):this[$e](t),this[A]!==0&&this.emit("readable"),s&&i(s),this[M]):t.length?(typeof t=="string"&&!(e===this[W]&&!this[at]?.lastNeed)&&(t=Buffer.from(t,e)),Buffer.isBuffer(t)&&this[W]&&(t=this[at].write(t)),this[M]&&this[A]!==0&&this[Yt](!0),this[M]?this.emit("data",t):this[$e](t),this[A]!==0&&this.emit("readable"),s&&i(s),this[M]):(this[A]!==0&&this.emit("readable"),s&&i(s),this[M])}read(t){if(this[x])return null;if(this[N]=!1,this[A]===0||t===0||t&&t>this[A])return this[X](),null;this[P]&&(t=null),this[k].length>1&&!this[P]&&(this[k]=[this[W]?this[k].join(""):Buffer.concat(this[k],this[A])]);let e=this[Zs](t||null,this[k][0]);return this[X](),e}[Zs](t,e){if(this[P])this[Jt]();else{let s=e;t===s.length||t===null?this[Jt]():typeof s=="string"?(this[k][0]=s.slice(t),e=s.slice(0,t),this[A]-=t):(this[k][0]=s.subarray(t),e=s.subarray(0,t),this[A]-=t)}return this.emit("data",e),!this[k].length&&!this[H]&&this.emit("drain"),e}end(t,e,s){return typeof t=="function"&&(s=t,t=void 0),typeof e=="function"&&(s=e,e="utf8"),t!==void 0&&this.write(t,e),s&&this.once("end",s),this[H]=!0,this.writable=!1,(this[M]||!this[wt])&&this[X](),this}[lt](){this[x]||(!this[st]&&!this[F].length&&(this[N]=!0),this[wt]=!1,this[M]=!0,this.emit("resume"),this[k].length?this[Yt]():this[H]?this[X]():this.emit("drain"))}resume(){return this[lt]()}pause(){this[M]=!1,this[wt]=!0,this[N]=!1}get destroyed(){return this[x]}get flowing(){return this[M]}get paused(){return this[wt]}[$e](t){this[P]?this[A]+=1:this[A]+=t.length,this[k].push(t)}[Jt](){return this[P]?this[A]-=1:this[A]-=this[k][0].length,this[k].shift()}[Yt](t=!1){do;while(this[Qs](this[Jt]())&&this[k].length);!t&&!this[k].length&&!this[H]&&this.emit("drain")}[Qs](t){return this.emit("data",t),this[M]}pipe(t,e){if(this[x])return t;this[N]=!1;let s=this[Z];return e=e||{},t===Js.stdout||t===Js.stderr?e.end=!1:e.end=e.end!==!1,e.proxyErrors=!!e.proxyErrors,s?e.end&&t.end():(this[F].push(e.proxyErrors?new Ke(this,t,e):new Qt(this,t,e)),this[G]?yt(()=>this[lt]()):this[lt]()),t}unpipe(t){let e=this[F].find(s=>s.dest===t);e&&(this[F].length===1?(this[M]&&this[st]===0&&(this[M]=!1),this[F]=[]):this[F].splice(this[F].indexOf(e),1),e.unpipe())}addListener(t,e){return this.on(t,e)}on(t,e){let s=super.on(t,e);if(t==="data")this[N]=!1,this[st]++,!this[F].length&&!this[M]&&this[lt]();else if(t==="readable"&&this[A]!==0)super.emit("readable");else if(Gn(t)&&this[Z])super.emit(t),this.removeAllListeners(t);else if(t==="error"&&this[gt]){let i=e;this[G]?yt(()=>i.call(this,this[gt])):i.call(this,this[gt])}return s}removeListener(t,e){return this.off(t,e)}off(t,e){let s=super.off(t,e);return t==="data"&&(this[st]=this.listeners("data").length,this[st]===0&&!this[N]&&!this[F].length&&(this[M]=!1)),s}removeAllListeners(t){let e=super.removeAllListeners(t);return(t==="data"||t===void 0)&&(this[st]=0,!this[N]&&!this[F].length&&(this[M]=!1)),e}get emittedEnd(){return this[Z]}[X](){!this[Kt]&&!this[Z]&&!this[x]&&this[k].length===0&&this[H]&&(this[Kt]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[Vt]&&this.emit("close"),this[Kt]=!1)}emit(t,...e){let s=e[0];if(t!=="error"&&t!=="close"&&t!==x&&this[x])return!1;if(t==="data")return!this[P]&&!s?!1:this[G]?(yt(()=>this[qe](s)),!0):this[qe](s);if(t==="end")return this[ti]();if(t==="close"){if(this[Vt]=!0,!this[Z]&&!this[x])return!1;let n=super.emit("close");return this.removeAllListeners("close"),n}else if(t==="error"){this[gt]=s,super.emit(Ue,s);let n=!this[bt]||this.listeners("error").length?super.emit("error",s):!1;return this[X](),n}else if(t==="resume"){let n=super.emit("resume");return this[X](),n}else if(t==="finish"||t==="prefinish"){let n=super.emit(t);return this.removeAllListeners(t),n}let i=super.emit(t,...e);return this[X](),i}[qe](t){for(let s of this[F])s.dest.write(t)===!1&&this.pause();let e=this[N]?!1:super.emit("data",t);return this[X](),e}[ti](){return this[Z]?!1:(this[Z]=!0,this.readable=!1,this[G]?(yt(()=>this[He]()),!0):this[He]())}[He](){if(this[at]){let e=this[at].end();if(e){for(let s of this[F])s.dest.write(e);this[N]||super.emit("data",e)}}for(let e of this[F])e.end();let t=super.emit("end");return this.removeAllListeners("end"),t}async collect(){let t=Object.assign([],{dataLength:0});this[P]||(t.dataLength=0);let e=this.promise();return this.on("data",s=>{t.push(s),this[P]||(t.dataLength+=s.length)}),await e,t}async concat(){if(this[P])throw new Error("cannot concat in objectMode");let t=await this.collect();return this[W]?t.join(""):Buffer.concat(t,t.dataLength)}async promise(){return new Promise((t,e)=>{this.on(x,()=>e(new Error("stream destroyed"))),this.on("error",s=>e(s)),this.on("end",()=>t())})}[Symbol.asyncIterator](){this[N]=!1;let t=!1,e=async()=>(this.pause(),t=!0,{value:void 0,done:!0});return{next:()=>{if(t)return e();let i=this.read();if(i!==null)return Promise.resolve({done:!1,value:i});if(this[H])return e();let n,o,h=u=>{this.off("data",a),this.off("end",l),this.off(x,c),e(),o(u)},a=u=>{this.off("error",h),this.off("end",l),this.off(x,c),this.pause(),n({value:u,done:!!this[H]})},l=()=>{this.off("error",h),this.off("data",a),this.off(x,c),e(),n({done:!0,value:void 0})},c=()=>h(new Error("stream destroyed"));return new Promise((u,f)=>{o=f,n=u,this.once(x,c),this.once("error",h),this.once("end",l),this.once("data",a)})},throw:e,return:e,[Symbol.asyncIterator](){return this},[Symbol.asyncDispose]:async()=>{}}}[Symbol.iterator](){this[N]=!1;let t=!1,e=()=>(this.pause(),this.off(Ue,e),this.off(x,e),this.off("end",e),t=!0,{done:!0,value:void 0}),s=()=>{if(t)return e();let i=this.read();return i===null?e():{done:!1,value:i}};return this.once("end",e),this.once(Ue,e),this.once(x,e),{next:s,throw:e,return:e,[Symbol.iterator](){return this},[Symbol.dispose]:()=>{}}}destroy(t){if(this[x])return t?this.emit("error",t):this.emit(x),this;this[x]=!0,this[N]=!0,this[k].length=0,this[A]=0;let e=this;return typeof e.close=="function"&&!this[Vt]&&e.close(),t?this.emit("error",t):this.emit(x),this}static get isStream(){return j.isStream}};j.Minipass=te});var mi=C(E=>{"use strict";var Hn=E&&E.__createBinding||(Object.create?(function(r,t,e,s){s===void 0&&(s=e);var i=Object.getOwnPropertyDescriptor(t,e);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[e]}}),Object.defineProperty(r,s,i)}):(function(r,t,e,s){s===void 0&&(s=e),r[s]=t[e]})),Xn=E&&E.__setModuleDefault||(Object.create?(function(r,t){Object.defineProperty(r,"default",{enumerable:!0,value:t})}):function(r,t){r.default=t}),Kn=E&&E.__importStar||(function(){var r=function(t){return r=Object.getOwnPropertyNames||function(e){var s=[];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(s[s.length]=i);return s},r(t)};return function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var s=r(t),i=0;i<s.length;i++)s[i]!=="default"&&Hn(e,t,s[i]);return Xn(e,t),e}})();Object.defineProperty(E,"__esModule",{value:!0});E.PathScurry=E.Path=E.PathScurryDarwin=E.PathScurryPosix=E.PathScurryWin32=E.PathScurryBase=E.PathPosix=E.PathWin32=E.PathBase=E.ChildrenCache=E.ResolveCache=void 0;var ae=Ys(),re=__webpack_require__(/*! node:path */ "node:path"),Vn=__webpack_require__(/*! node:url */ "node:url"),vt=__webpack_require__(/*! fs */ "fs"),Yn=Kn(__webpack_require__(/*! node:fs */ "node:fs")),Jn=vt.realpathSync.native,ee=__webpack_require__(/*! node:fs/promises */ "node:fs/promises"),si=Ye(),_t={lstatSync:vt.lstatSync,readdir:vt.readdir,readdirSync:vt.readdirSync,readlinkSync:vt.readlinkSync,realpathSync:Jn,promises:{lstat:ee.lstat,readdir:ee.readdir,readlink:ee.readlink,realpath:ee.realpath}},ai=r=>!r||r===_t||r===Yn?_t:{..._t,...r,promises:{..._t.promises,...r.promises}},Zn=/^\\\\\?\\([a-z]:)\\?$/i,Qn=/^\\\\\?\\UNC\\([^\\]+\\[^\\]+)\\?$/i,tr=/^\\\\[^\\?]+\\[^\\]+$/,ii=r=>r.replace(/\//g,"\\").replace(Zn,"$1\\").replace(Qn,"\\\\$1\\").replace(tr,"$&\\"),er=/^[\\/]{2}\?[\\/]unc[\\/][^\\/]+[\\/][^\\/]+(?:[\\/]|$)/i,sr=/^[\\/]{2}\?[\\/](?=[a-z]:)/i,ir=/^[\\/]{2}\?[\\/]unc(?=[\\/][^\\/]+[\\/][^\\/])/i,nr=/[\\/]/,L=0,li=1,ci=2,I=4,ui=6,fi=8,it=10,di=12,D=15,St=~D,Je=16,ni=32,Et=64,z=128,se=256,ne=512,ri=Et|z|ne,rr=1023,Ze=r=>r.isFile()?fi:r.isDirectory()?I:r.isSymbolicLink()?it:r.isCharacterDevice()?ci:r.isBlockDevice()?ui:r.isSocket()?di:r.isFIFO()?li:L,oi=new ae.LRUCache({max:2**12}),Ot=r=>{let t=oi.get(r);if(t)return t;let e=r.normalize("NFKD");return oi.set(r,e),e},hi=new ae.LRUCache({max:2**12}),ie=r=>{let t=hi.get(r);if(t)return t;let e=Ot(r.toLowerCase());return hi.set(r,e),e},xt=class extends ae.LRUCache{constructor(){super({max:256})}};E.ResolveCache=xt;var oe=class extends ae.LRUCache{constructor(t=16*1024){super({maxSize:t,sizeCalculation:e=>e.length+1})}};E.ChildrenCache=oe;var pi=Symbol("PathScurry setAsCwd"),R=class{name;root;roots;parent;nocase;isCWD=!1;#t;#n;get dev(){return this.#n}#i;get mode(){return this.#i}#o;get nlink(){return this.#o}#r;get uid(){return this.#r}#d;get gid(){return this.#d}#f;get rdev(){return this.#f}#u;get blksize(){return this.#u}#h;get ino(){return this.#h}#m;get size(){return this.#m}#l;get blocks(){return this.#l}#a;get atimeMs(){return this.#a}#s;get mtimeMs(){return this.#s}#b;get ctimeMs(){return this.#b}#E;get birthtimeMs(){return this.#E}#y;get atime(){return this.#y}#g;get mtime(){return this.#g}#w;get ctime(){return this.#w}#p;get birthtime(){return this.#p}#O;#x;#v;#_;#S;#M;#e;#P;#T;#k;get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}constructor(t,e=L,s,i,n,o,h){this.name=t,this.#O=n?ie(t):Ot(t),this.#e=e&rr,this.nocase=n,this.roots=i,this.root=s||this,this.#P=o,this.#v=h.fullpath,this.#S=h.relative,this.#M=h.relativePosix,this.parent=h.parent,this.parent?this.#t=this.parent.#t:this.#t=ai(h.fs)}get fs(){return this.#t}depth(){return this.#x!==void 0?this.#x:this.parent?this.#x=this.parent.depth()+1:this.#x=0}childrenCache(){return this.#P}resolve(t){if(!t)return this;let e=this.getRootString(t),i=t.substring(e.length).split(this.splitSep);return e?this.getRoot(e).#F(i):this.#F(i)}#F(t){let e=this;for(let s of t)e=e.child(s);return e}children(){let t=this.#P.get(this);if(t)return t;let e=Object.assign([],{provisional:0});return this.#P.set(this,e),this.#e&=~Je,e}child(t,e){if(t===""||t===".")return this;if(t==="..")return this.parent||this;let s=this.children(),i=this.nocase?ie(t):Ot(t);for(let a of s)if(a.#O===i)return a;let n=this.parent?this.sep:"",o=this.#v?this.#v+n+t:void 0,h=this.newChild(t,L,{...e,parent:this,fullpath:o});return this.canReaddir()||(h.#e|=z),s.push(h),h}relative(){if(this.isCWD)return"";if(this.#S!==void 0)return this.#S;let t=this.name,e=this.parent;if(!e)return this.#S=this.name;let s=e.relative();return s+(!s||!e.parent?"":this.sep)+t}relativePosix(){if(this.sep==="/")return this.relative();if(this.isCWD)return"";if(this.#M!==void 0)return this.#M;let t=this.name,e=this.parent;if(!e)return this.#M=this.fullpathPosix();let s=e.relativePosix();return s+(!s||!e.parent?"":"/")+t}fullpath(){if(this.#v!==void 0)return this.#v;let t=this.name,e=this.parent;if(!e)return this.#v=this.name;let i=e.fullpath()+(e.parent?this.sep:"")+t;return this.#v=i}fullpathPosix(){if(this.#_!==void 0)return this.#_;if(this.sep==="/")return this.#_=this.fullpath();if(!this.parent){let i=this.fullpath().replace(/\\/g,"/");return/^[a-z]:\//i.test(i)?this.#_=`//?/${i}`:this.#_=i}let t=this.parent,e=t.fullpathPosix(),s=e+(!e||!t.parent?"":"/")+this.name;return this.#_=s}isUnknown(){return(this.#e&D)===L}isType(t){return this[`is${t}`]()}getType(){return this.isUnknown()?"Unknown":this.isDirectory()?"Directory":this.isFile()?"File":this.isSymbolicLink()?"SymbolicLink":this.isFIFO()?"FIFO":this.isCharacterDevice()?"CharacterDevice":this.isBlockDevice()?"BlockDevice":this.isSocket()?"Socket":"Unknown"}isFile(){return(this.#e&D)===fi}isDirectory(){return(this.#e&D)===I}isCharacterDevice(){return(this.#e&D)===ci}isBlockDevice(){return(this.#e&D)===ui}isFIFO(){return(this.#e&D)===li}isSocket(){return(this.#e&D)===di}isSymbolicLink(){return(this.#e&it)===it}lstatCached(){return this.#e&ni?this:void 0}readlinkCached(){return this.#T}realpathCached(){return this.#k}readdirCached(){let t=this.children();return t.slice(0,t.provisional)}canReadlink(){if(this.#T)return!0;if(!this.parent)return!1;let t=this.#e&D;return!(t!==L&&t!==it||this.#e&se||this.#e&z)}calledReaddir(){return!!(this.#e&Je)}isENOENT(){return!!(this.#e&z)}isNamed(t){return this.nocase?this.#O===ie(t):this.#O===Ot(t)}async readlink(){let t=this.#T;if(t)return t;if(this.canReadlink()&&this.parent)try{let e=await this.#t.promises.readlink(this.fullpath()),s=(await this.parent.realpath())?.resolve(e);if(s)return this.#T=s}catch(e){this.#R(e.code);return}}readlinkSync(){let t=this.#T;if(t)return t;if(this.canReadlink()&&this.parent)try{let e=this.#t.readlinkSync(this.fullpath()),s=this.parent.realpathSync()?.resolve(e);if(s)return this.#T=s}catch(e){this.#R(e.code);return}}#z(t){this.#e|=Je;for(let e=t.provisional;e<t.length;e++){let s=t[e];s&&s.#C()}}#C(){this.#e&z||(this.#e=(this.#e|z)&St,this.#U())}#U(){let t=this.children();t.provisional=0;for(let e of t)e.#C()}#N(){this.#e|=ne,this.#j()}#j(){if(this.#e&Et)return;let t=this.#e;(t&D)===I&&(t&=St),this.#e=t|Et,this.#U()}#B(t=""){t==="ENOTDIR"||t==="EPERM"?this.#j():t==="ENOENT"?this.#C():this.children().provisional=0}#A(t=""){t==="ENOTDIR"?this.parent.#j():t==="ENOENT"&&this.#C()}#R(t=""){let e=this.#e;e|=se,t==="ENOENT"&&(e|=z),(t==="EINVAL"||t==="UNKNOWN")&&(e&=St),this.#e=e,t==="ENOTDIR"&&this.parent&&this.parent.#j()}#G(t,e){return this.#$(t,e)||this.#D(t,e)}#D(t,e){let s=Ze(t),i=this.newChild(t.name,s,{parent:this}),n=i.#e&D;return n!==I&&n!==it&&n!==L&&(i.#e|=Et),e.unshift(i),e.provisional++,i}#$(t,e){for(let s=e.provisional;s<e.length;s++){let i=e[s];if((this.nocase?ie(t.name):Ot(t.name))===i.#O)return this.#V(t,i,s,e)}}#V(t,e,s,i){let n=e.name;return e.#e=e.#e&St|Ze(t),n!==t.name&&(e.name=t.name),s!==i.provisional&&(s===i.length-1?i.pop():i.splice(s,1),i.unshift(e)),i.provisional++,e}async lstat(){if((this.#e&z)===0)try{return this.#q(await this.#t.promises.lstat(this.fullpath())),this}catch(t){this.#A(t.code)}}lstatSync(){if((this.#e&z)===0)try{return this.#q(this.#t.lstatSync(this.fullpath())),this}catch(t){this.#A(t.code)}}#q(t){let{atime:e,atimeMs:s,birthtime:i,birthtimeMs:n,blksize:o,blocks:h,ctime:a,ctimeMs:l,dev:c,gid:u,ino:f,mode:p,mtime:g,mtimeMs:d,nlink:b,rdev:m,size:y,uid:_}=t;this.#y=e,this.#a=s,this.#p=i,this.#E=n,this.#u=o,this.#l=h,this.#w=a,this.#b=l,this.#n=c,this.#d=u,this.#h=f,this.#i=p,this.#g=g,this.#s=d,this.#o=b,this.#f=m,this.#m=y,this.#r=_;let v=Ze(t);this.#e=this.#e&St|v|ni,v!==L&&v!==I&&v!==it&&(this.#e|=Et)}#L=[];#c=!1;#H(t){this.#c=!1;let e=this.#L.slice();this.#L.length=0,e.forEach(s=>s(null,t))}readdirCB(t,e=!1){if(!this.canReaddir()){e?t(null,[]):queueMicrotask(()=>t(null,[]));return}let s=this.children();if(this.calledReaddir()){let n=s.slice(0,s.provisional);e?t(null,n):queueMicrotask(()=>t(null,n));return}if(this.#L.push(t),this.#c)return;this.#c=!0;let i=this.fullpath();this.#t.readdir(i,{withFileTypes:!0},(n,o)=>{if(n)this.#B(n.code),s.provisional=0;else{for(let h of o)this.#G(h,s);this.#z(s)}this.#H(s.slice(0,s.provisional))})}#I;async readdir(){if(!this.canReaddir())return[];let t=this.children();if(this.calledReaddir())return t.slice(0,t.provisional);let e=this.fullpath();if(this.#I)await this.#I;else{let s=()=>{};this.#I=new Promise(i=>s=i);try{for(let i of await this.#t.promises.readdir(e,{withFileTypes:!0}))this.#G(i,t);this.#z(t)}catch(i){this.#B(i.code),t.provisional=0}this.#I=void 0,s()}return t.slice(0,t.provisional)}readdirSync(){if(!this.canReaddir())return[];let t=this.children();if(this.calledReaddir())return t.slice(0,t.provisional);let e=this.fullpath();try{for(let s of this.#t.readdirSync(e,{withFileTypes:!0}))this.#G(s,t);this.#z(t)}catch(s){this.#B(s.code),t.provisional=0}return t.slice(0,t.provisional)}canReaddir(){if(this.#e&ri)return!1;let t=D&this.#e;return t===L||t===I||t===it}shouldWalk(t,e){return(this.#e&I)===I&&!(this.#e&ri)&&!t.has(this)&&(!e||e(this))}async realpath(){if(this.#k)return this.#k;if(!((ne|se|z)&this.#e))try{let t=await this.#t.promises.realpath(this.fullpath());return this.#k=this.resolve(t)}catch{this.#N()}}realpathSync(){if(this.#k)return this.#k;if(!((ne|se|z)&this.#e))try{let t=this.#t.realpathSync(this.fullpath());return this.#k=this.resolve(t)}catch{this.#N()}}[pi](t){if(t===this)return;t.isCWD=!1,this.isCWD=!0;let e=new Set([]),s=[],i=this;for(;i&&i.parent;)e.add(i),i.#S=s.join(this.sep),i.#M=s.join("/"),i=i.parent,s.push("..");for(i=t;i&&i.parent&&!e.has(i);)i.#S=void 0,i.#M=void 0,i=i.parent}};E.PathBase=R;var Ct=class r extends R{sep="\\";splitSep=nr;constructor(t,e=L,s,i,n,o,h){super(t,e,s,i,n,o,h)}newChild(t,e=L,s={}){return new r(t,e,this.root,this.roots,this.nocase,this.childrenCache(),s)}getRootString(t){return er.exec(t)?.[0]??re.win32.parse(t).root}getRoot(t){if(t=ii(t.toUpperCase()),t===this.root.name||/^[\\/]$/.test(t))return this.root;for(let[e,s]of Object.entries(this.roots))if(this.sameRoot(t,e))return this.roots[t]=s;return this.roots[t]=new At(t,{nocase:this.nocase,fs:this.fs}).root}sameRoot(t,e=this.root.name){return ii(t.toUpperCase())===e}};E.PathWin32=Ct;var Mt=class r extends R{splitSep="/";sep="/";constructor(t,e=L,s,i,n,o,h){super(t,e,s,i,n,o,h)}getRootString(t){return t.startsWith("/")?"/":""}getRoot(t){return this.root}newChild(t,e=L,s={}){return new r(t,e,this.root,this.roots,this.nocase,this.childrenCache(),s)}};E.PathPosix=Mt;var kt=class{root;rootPath;roots;cwd;#t;#n;#i;nocase;#o;constructor(t=process.cwd(),e,s,{nocase:i,childrenCacheSize:n=16*1024,fs:o=_t}={}){this.#o=ai(o),(t instanceof URL||t.startsWith("file://"))&&(t=(0,Vn.fileURLToPath)(t));let h=e.resolve(t);this.roots=Object.create(null),this.rootPath=this.parseRootPath(h),this.#t=new xt,this.#n=new xt,this.#i=new oe(n);let a=h.substring(this.rootPath.length).split(s);if(a.length===1&&!a[0]&&a.pop(),i===void 0)throw new TypeError("must provide nocase setting to PathScurryBase ctor");this.nocase=i,this.root=this.newRoot(this.#o),this.roots[this.rootPath]=this.root;let l=this.root,c=a.length-1,u=e.sep,f=this.rootPath,p=!1;for(let g of a){let d=c--;l=l.child(g,{relative:new Array(d).fill("..").join(u),relativePosix:new Array(d).fill("..").join("/"),fullpath:f+=(p?"":u)+g}),p=!0}this.cwd=l}depth(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.depth()}childrenCache(){return this.#i}resolve(...t){let e="";for(let n=t.length-1;n>=0;n--){let o=t[n];if(!(!o||o===".")&&(e=e?`${o}/${e}`:o,this.isAbsolute(o)))break}let s=this.#t.get(e);if(s!==void 0)return s;let i=this.cwd.resolve(e).fullpath();return this.#t.set(e,i),i}resolvePosix(...t){let e="";for(let n=t.length-1;n>=0;n--){let o=t[n];if(!(!o||o===".")&&(e=e?`${o}/${e}`:o,this.isAbsolute(o)))break}let s=this.#n.get(e);if(s!==void 0)return s;let i=this.cwd.resolve(e).fullpathPosix();return this.#n.set(e,i),i}relative(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.relative()}relativePosix(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.relativePosix()}basename(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.name}dirname(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),(t.parent||t).fullpath()}async readdir(t=this.cwd,e={withFileTypes:!0}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof R||(e=t,t=this.cwd);let{withFileTypes:s}=e;if(t.canReaddir()){let i=await t.readdir();return s?i:i.map(n=>n.name)}else return[]}readdirSync(t=this.cwd,e={withFileTypes:!0}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof R||(e=t,t=this.cwd);let{withFileTypes:s=!0}=e;return t.canReaddir()?s?t.readdirSync():t.readdirSync().map(i=>i.name):[]}async lstat(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.lstat()}lstatSync(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.lstatSync()}async readlink(t=this.cwd,{withFileTypes:e}={withFileTypes:!1}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof R||(e=t.withFileTypes,t=this.cwd);let s=await t.readlink();return e?s:s?.fullpath()}readlinkSync(t=this.cwd,{withFileTypes:e}={withFileTypes:!1}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof R||(e=t.withFileTypes,t=this.cwd);let s=t.readlinkSync();return e?s:s?.fullpath()}async realpath(t=this.cwd,{withFileTypes:e}={withFileTypes:!1}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof R||(e=t.withFileTypes,t=this.cwd);let s=await t.realpath();return e?s:s?.fullpath()}realpathSync(t=this.cwd,{withFileTypes:e}={withFileTypes:!1}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof R||(e=t.withFileTypes,t=this.cwd);let s=t.realpathSync();return e?s:s?.fullpath()}async walk(t=this.cwd,e={}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof R||(e=t,t=this.cwd);let{withFileTypes:s=!0,follow:i=!1,filter:n,walkFilter:o}=e,h=[];(!n||n(t))&&h.push(s?t:t.fullpath());let a=new Set,l=(u,f)=>{a.add(u),u.readdirCB((p,g)=>{if(p)return f(p);let d=g.length;if(!d)return f();let b=()=>{--d===0&&f()};for(let m of g)(!n||n(m))&&h.push(s?m:m.fullpath()),i&&m.isSymbolicLink()?m.realpath().then(y=>y?.isUnknown()?y.lstat():y).then(y=>y?.shouldWalk(a,o)?l(y,b):b()):m.shouldWalk(a,o)?l(m,b):b()},!0)},c=t;return new Promise((u,f)=>{l(c,p=>{if(p)return f(p);u(h)})})}walkSync(t=this.cwd,e={}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof R||(e=t,t=this.cwd);let{withFileTypes:s=!0,follow:i=!1,filter:n,walkFilter:o}=e,h=[];(!n||n(t))&&h.push(s?t:t.fullpath());let a=new Set([t]);for(let l of a){let c=l.readdirSync();for(let u of c){(!n||n(u))&&h.push(s?u:u.fullpath());let f=u;if(u.isSymbolicLink()){if(!(i&&(f=u.realpathSync())))continue;f.isUnknown()&&f.lstatSync()}f.shouldWalk(a,o)&&a.add(f)}}return h}[Symbol.asyncIterator](){return this.iterate()}iterate(t=this.cwd,e={}){return typeof t=="string"?t=this.cwd.resolve(t):t instanceof R||(e=t,t=this.cwd),this.stream(t,e)[Symbol.asyncIterator]()}[Symbol.iterator](){return this.iterateSync()}*iterateSync(t=this.cwd,e={}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof R||(e=t,t=this.cwd);let{withFileTypes:s=!0,follow:i=!1,filter:n,walkFilter:o}=e;(!n||n(t))&&(yield s?t:t.fullpath());let h=new Set([t]);for(let a of h){let l=a.readdirSync();for(let c of l){(!n||n(c))&&(yield s?c:c.fullpath());let u=c;if(c.isSymbolicLink()){if(!(i&&(u=c.realpathSync())))continue;u.isUnknown()&&u.lstatSync()}u.shouldWalk(h,o)&&h.add(u)}}}stream(t=this.cwd,e={}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof R||(e=t,t=this.cwd);let{withFileTypes:s=!0,follow:i=!1,filter:n,walkFilter:o}=e,h=new si.Minipass({objectMode:!0});(!n||n(t))&&h.write(s?t:t.fullpath());let a=new Set,l=[t],c=0,u=()=>{let f=!1;for(;!f;){let p=l.shift();if(!p){c===0&&h.end();return}c++,a.add(p);let g=(b,m,y=!1)=>{if(b)return h.emit("error",b);if(i&&!y){let _=[];for(let v of m)v.isSymbolicLink()&&_.push(v.realpath().then(S=>S?.isUnknown()?S.lstat():S));if(_.length){Promise.all(_).then(()=>g(null,m,!0));return}}for(let _ of m)_&&(!n||n(_))&&(h.write(s?_:_.fullpath())||(f=!0));c--;for(let _ of m){let v=_.realpathCached()||_;v.shouldWalk(a,o)&&l.push(v)}f&&!h.flowing?h.once("drain",u):d||u()},d=!0;p.readdirCB(g,!0),d=!1}};return u(),h}streamSync(t=this.cwd,e={}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof R||(e=t,t=this.cwd);let{withFileTypes:s=!0,follow:i=!1,filter:n,walkFilter:o}=e,h=new si.Minipass({objectMode:!0}),a=new Set;(!n||n(t))&&h.write(s?t:t.fullpath());let l=[t],c=0,u=()=>{let f=!1;for(;!f;){let p=l.shift();if(!p){c===0&&h.end();return}c++,a.add(p);let g=p.readdirSync();for(let d of g)(!n||n(d))&&(h.write(s?d:d.fullpath())||(f=!0));c--;for(let d of g){let b=d;if(d.isSymbolicLink()){if(!(i&&(b=d.realpathSync())))continue;b.isUnknown()&&b.lstatSync()}b.shouldWalk(a,o)&&l.push(b)}}f&&!h.flowing&&h.once("drain",u)};return u(),h}chdir(t=this.cwd){let e=this.cwd;this.cwd=typeof t=="string"?this.cwd.resolve(t):t,this.cwd[pi](e)}};E.PathScurryBase=kt;var At=class extends kt{sep="\\";constructor(t=process.cwd(),e={}){let{nocase:s=!0}=e;typeof t=="string"&&!t.startsWith("file://")&&(t=t.replace(sr,"").replace(ir,"\\")),super(t,re.win32,"\\",{...e,nocase:s}),this.nocase=s;for(let i=this.cwd;i;i=i.parent)i.nocase=this.nocase}parseRootPath(t){return re.win32.parse(t).root.toUpperCase()}newRoot(t){return new Ct(this.rootPath,I,void 0,this.roots,this.nocase,this.childrenCache(),{fs:t})}isAbsolute(t){return t.startsWith("/")||t.startsWith("\\")||/^[a-z]:(\/|\\)/i.test(t)}};E.PathScurryWin32=At;var Rt=class extends kt{sep="/";constructor(t=process.cwd(),e={}){let{nocase:s=!1}=e;super(t,re.posix,"/",{...e,nocase:s}),this.nocase=s}parseRootPath(t){return"/"}newRoot(t){return new Mt(this.rootPath,I,void 0,this.roots,this.nocase,this.childrenCache(),{fs:t})}isAbsolute(t){return t.startsWith("/")}};E.PathScurryPosix=Rt;var he=class extends Rt{constructor(t=process.cwd(),e={}){let{nocase:s=!0}=e;super(t,{...e,nocase:s})}};E.PathScurryDarwin=he;E.Path=process.platform==="win32"?Ct:Mt;E.PathScurry=process.platform==="win32"?At:process.platform==="darwin"?he:Rt});var ts=C(le=>{"use strict";Object.defineProperty(le,"__esModule",{value:!0});le.Pattern=void 0;var or=Y(),hr=r=>r.length>=1,ar=r=>r.length>=1,lr=Symbol.for("nodejs.util.inspect.custom"),Qe=class r{#t;#n;#i;length;#o;#r;#d;#f;#u;#h;#m=!0;constructor(t,e,s,i){if(!hr(t))throw new TypeError("empty pattern list");if(!ar(e))throw new TypeError("empty glob list");if(e.length!==t.length)throw new TypeError("mismatched pattern list and glob list lengths");if(this.length=t.length,s<0||s>=this.length)throw new TypeError("index out of range");if(this.#t=t,this.#n=e,this.#i=s,this.#o=i,this.#i===0){if(this.isUNC()){let n=this.#l()?6:4,o=this.#t.slice(0,n),h=this.#n.slice(0,n),a=this.#t.slice(n),l=this.#n.slice(n);a[0]===""&&(a.shift(),l.shift());let c=[...o,""].join("/"),u=[...h,""].join("/");this.#t=[c,...a],this.#n=[u,...l],this.length=this.#t.length}else if(this.isDrive()||this.isAbsolute()){let[n,...o]=this.#t,[h,...a]=this.#n;o[0]===""&&(o.shift(),a.shift());let l=`${n}/`,c=`${h}/`;this.#t=[l,...o],this.#n=[c,...a],this.length=this.#t.length}}}[lr](){return`Pattern <${this.#n.slice(this.#i).join("/")}>`}pattern(){return this.#t[this.#i]}isString(){return typeof this.#t[this.#i]=="string"}isGlobstar(){return this.#t[this.#i]===or.GLOBSTAR}isMatcher(){return typeof this.#t[this.#i]=="object"}globString(){return this.#d=this.#d||(this.#i===0?this.isAbsolute()?this.#n[0]+this.#n.slice(1).join("/"):this.#n.join("/"):this.#n.slice(this.#i).join("/"))}hasMore(){return this.length>this.#i+1}rest(){return this.#r!==void 0?this.#r:this.hasMore()?(this.#r=new r(this.#t,this.#n,this.#i+1,this.#o),this.#r.#h=this.#h,this.#r.#u=this.#u,this.#r.#f=this.#f,this.#r):this.#r=null}#l(){let t=this.#t;return t[2]==="?"&&typeof t[3]=="string"&&/^unc$/i.test(t[3])}isUNC(){let t=this.#t,e=this.#l()?4:2;return this.#u!==void 0?this.#u:this.#u=this.#o==="win32"&&this.#i===0&&t[0]===""&&t[1]===""&&typeof t[e]=="string"&&!!t[e]&&typeof t[e+1]=="string"&&!!t[e+1]}isDrive(){let t=this.#t;return this.#f!==void 0?this.#f:this.#f=this.#o==="win32"&&this.#i===0&&this.length>1&&typeof t[0]=="string"&&/^[a-z]:$/i.test(t[0])}isAbsolute(){let t=this.#t;return this.#h!==void 0?this.#h:this.#h=t[0]===""&&t.length>1||this.isDrive()||this.isUNC()}root(){let t=this.#t[0];return typeof t=="string"&&this.isAbsolute()&&this.#i===0?t:""}checkFollowGlobstar(){return!(this.#i===0||!this.isGlobstar()||!this.#m)}markFollowGlobstar(){return this.#i===0||!this.isGlobstar()||!this.#m?!1:(this.#m=!1,!0)}};le.Pattern=Qe});var is=C(ce=>{"use strict";Object.defineProperty(ce,"__esModule",{value:!0});ce.Ignore=void 0;var es=Y(),cr=ts(),ur=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",ss=class{relative;relativeChildren;absolute;absoluteChildren;platform;mmopts;slashRoot;constructor(t,{nobrace:e,nocase:s,noext:i,noglobstar:n,normalize:o,platform:h=ur,root:a,windowsPathsNoEscape:l,allowWindowsEscape:c},u){this.relative=[],this.absolute=[],this.relativeChildren=[],this.absoluteChildren=[],this.platform=h,l=!!l||c===!1,this.mmopts={dot:!0,nobrace:e,nocase:s,noext:i,noglobstar:n,normalize:o,optimizationLevel:2,platform:h,nocomment:!0,nonegate:!0,windowsPathsNoEscape:l};let f=u?.resolve(a??"/").fullpath()??"/";this.slashRoot=(0,es.escape)(f.replace(/\\/g,"/").replace(/\/$/,""),{windowsPathsNoEscape:l});for(let p of t)this.add(p)}add(t){let e=new es.Minimatch(t,this.mmopts);for(let s=0;s<e.set.length;s++){let i=e.set[s],n=e.globParts[s];if(!i||!n)throw new Error("invalid pattern object");for(;i[0]==="."&&n[0]===".";)i.shift(),n.shift();let o=new cr.Pattern(i,n,0,this.platform),h=o.root()==="/"?`${this.slashRoot}/${o.rest()?.globString()??""}`:o.globString(),a=new es.Minimatch(h,this.mmopts),l=n[n.length-1]==="**",c=o.isAbsolute();c?this.absolute.push(a):this.relative.push(a),l&&(c?this.absoluteChildren.push(a):this.relativeChildren.push(a))}}ignored(t){let e=t.fullpath(),s=`${e}/`,i=t.relative()||".",n=`${i}/`;for(let o of this.relative)if(o.match(i)||o.match(n))return!0;for(let o of this.absolute)if(o.match(e)||o.match(s))return!0;return!1}childrenIgnored(t){let e=`${t.fullpath()}/`,s=`${t.relative()||"."}/`;for(let i of this.relativeChildren)if(i.match(s))return!0;for(let i of this.absoluteChildren)if(i.match(e))return!0;return!1}};ce.Ignore=ss});var wi=C($=>{"use strict";Object.defineProperty($,"__esModule",{value:!0});$.Processor=$.SubWalks=$.MatchRecord=$.HasWalkedCache=void 0;var gi=Y(),ue=class r{parent;store;constructor(t){this.parent=t}copy(){return new r(this)}#t(t){let e=this.store?.get(t);return e||!this.parent?e:this.parent.#t(t)}hasWalked(t,e){return!!this.#t(t.fullpath())?.has(e.globString())}storeWalked(t,e){let s=t.fullpath(),i=this.#t(s);i?i.add(e.globString()):(this.store??=new Map).set(s,new Set([e.globString()]))}};$.HasWalkedCache=ue;var fe=class r{static ABSOLUTE=2;static IF_DIR=1;store=new Map;add(t,e,s){let i=(e?r.ABSOLUTE:0)|(s?r.IF_DIR:0),n=this.store.get(t);this.store.set(t,n===void 0?i:i&n)}};$.MatchRecord=fe;var de=class{store=new Map;add(t,e){if(!t.canReaddir())return;let s=this.store.get(t);s?s.find(i=>i.globString()===e.globString())||s.push(e):this.store.set(t,[e])}get(t){let e=this.store.get(t);if(!e)throw new Error("attempting to walk unknown path");return e}entries(){return this.keys().map(t=>[t,this.store.get(t)])}keys(){return[...this.store.keys()].filter(t=>t.canReaddir())}};$.SubWalks=de;var ns=class r{hasWalkedCache;matches=new fe;subwalks=new de;patterns;follow;dot;opts;constructor(t,e){this.opts=t,this.follow=!!t.follow,this.dot=!!t.dot,this.hasWalkedCache=e?e.copy():new ue}processPatterns(t,e){this.patterns=e;let s=e.map(i=>[t,i]);for(let[i,n]of s){this.hasWalkedCache.storeWalked(i,n);let o=n.root(),h=n.isAbsolute()&&this.opts.absolute!==!1;if(o){i=i.resolve(o==="/"&&this.opts.root!==void 0?this.opts.root:o);let u=n.rest();if(u)n=u;else{this.matches.add(i,!0,!1);continue}}if(i.isENOENT())continue;let a,l,c=!1;for(;typeof(a=n.pattern())=="string"&&(l=n.rest());)i=i.resolve(a),n=l,c=!0;if(a=n.pattern(),l=n.rest(),c){if(this.hasWalkedCache.hasWalked(i,n))continue;this.hasWalkedCache.storeWalked(i,n)}if(typeof a=="string"){let u=a===".."||a===""||a===".";this.matches.add(i.resolve(a),h,u);continue}else if(a===gi.GLOBSTAR){(!i.isSymbolicLink()||this.follow||n.checkFollowGlobstar())&&this.subwalks.add(i,n);let u=l?.pattern(),f=l?.rest();if(!l||(u===""||u===".")&&!f)this.matches.add(i,h,u===""||u===".");else if(u===".."){let p=i.parent||i;f?this.hasWalkedCache.hasWalked(p,f)||this.subwalks.add(p,f):this.matches.add(p,h,!0)}}else typeof a=="object"&&this.subwalks.add(i,n)}return this}subwalkTargets(){return this.subwalks.keys()}child(){return new r(this.opts,this.hasWalkedCache)}filterEntries(t,e){let s=this.subwalks.get(t),i=this.child();for(let n of e)for(let o of s){let h=o.isAbsolute(),a=o.pattern(),l=o.rest();a===gi.GLOBSTAR?i.testGlobstar(n,o,l,h):typeof a=="object"?i.testMatcher(n,a,l,h):i.testString(n,a,l,h)}return i}testGlobstar(t,e,s,i){if((this.dot||!t.name.startsWith("."))&&(e.hasMore()||this.matches.add(t,i,!1),t.canReaddir()&&(this.follow||!t.isSymbolicLink()?this.subwalks.add(t,e):t.isSymbolicLink()&&(s&&e.checkFollowGlobstar()?this.subwalks.add(t,s):e.markFollowGlobstar()&&this.subwalks.add(t,e)))),s){let n=s.pattern();if(typeof n=="string"&&n!==".."&&n!==""&&n!==".")this.testString(t,n,s.rest(),i);else if(n===".."){let o=t.parent||t;this.subwalks.add(o,s)}else typeof n=="object"&&this.testMatcher(t,n,s.rest(),i)}}testMatcher(t,e,s,i){e.testUnchecked(t.name)&&(s?this.subwalks.add(t,s):this.matches.add(t,i,!1))}testString(t,e,s,i){t.isNamed(e)&&(s?this.subwalks.add(t,s):this.matches.add(t,i,!1))}};$.Processor=ns});var yi=C(Q=>{"use strict";Object.defineProperty(Q,"__esModule",{value:!0});Q.GlobStream=Q.GlobWalker=Q.GlobUtil=void 0;var fr=Ye(),bi=is(),rs=wi(),{ABSOLUTE:pe,IF_DIR:me}=rs.MatchRecord,dr=(r,t,e)=>typeof r=="string"?new bi.Ignore([r],t,e):Array.isArray(r)?new bi.Ignore(r,t,e):r,Pt=class{path;patterns;opts;seen=new Set;paused=!1;aborted=!1;#t=[];#n;#i;signal;maxDepth;includeChildMatches;constructor(t,e,s){if(this.patterns=t,this.path=e,this.opts=s,this.#i=!s.posix&&s.platform==="win32"?"\\":"/",this.includeChildMatches=s.includeChildMatches!==!1,(s.ignore||!this.includeChildMatches)&&(this.#n=dr(s.ignore??[],s,e),!this.includeChildMatches&&typeof this.#n.add!="function")){let i="cannot ignore child matches, ignore lacks add() method.";throw new Error(i)}this.maxDepth=s.maxDepth||1/0,s.signal&&(this.signal=s.signal,this.signal.addEventListener("abort",()=>{this.#t.length=0}))}#o(t){return this.seen.has(t)||!!this.#n?.ignored?.(t)}#r(t){return!!this.#n?.childrenIgnored?.(t)}pause(){this.paused=!0}resume(){if(this.signal?.aborted)return;this.paused=!1;let t;for(;!this.paused&&(t=this.#t.shift());)t()}onResume(t){this.paused?this.#t.push(t):t()}async matchCheck(t,e){if(e&&this.opts.nodir)return;let s,i;if(this.opts.realpath){if(s=t.realpathCached()||await t.realpath(),!s)return;i=s}else i=t;let o=i.isUnknown()||this.opts.stat?await i.lstat():i;if(this.opts.follow&&this.opts.nodir&&o?.isSymbolicLink()){let h=await o.realpath();h&&(h.isUnknown()||this.opts.stat)&&await h.lstat()}return this.matchCheckTest(o,e)}matchCheckTest(t,e){return t&&(this.maxDepth===1/0||t.depth()<=this.maxDepth)&&(!e||t.canReaddir())&&(!this.opts.nodir||!t.isDirectory())&&(!this.opts.nodir||!this.opts.follow||!t.isSymbolicLink()||!t.realpathCached()?.isDirectory())&&!this.#o(t)?t:void 0}matchCheckSync(t,e){if(e&&this.opts.nodir)return;let s,i;if(this.opts.realpath){if(s=t.realpathCached()||t.realpathSync(),!s)return;i=s}else i=t;let o=i.isUnknown()||this.opts.stat?i.lstatSync():i;if(this.opts.follow&&this.opts.nodir&&o?.isSymbolicLink()){let h=o.realpathSync();h&&(h?.isUnknown()||this.opts.stat)&&h.lstatSync()}return this.matchCheckTest(o,e)}matchFinish(t,e){this.#o(t)||this.#d(t,e)}#d(t,e){if(!this.includeChildMatches&&this.#n?.add){let n=`${t.relativePosix()}/**`;this.#n.add(n)}let s=this.opts.absolute===void 0?e:this.opts.absolute;this.seen.add(t);let i=this.opts.mark&&t.isDirectory()?this.#i:"";if(this.opts.withFileTypes)this.matchEmit(t);else if(s){let n=this.opts.posix?t.fullpathPosix():t.fullpath();this.matchEmit(n+i)}else{let n=this.opts.posix?t.relativePosix():t.relative(),o=this.opts.dotRelative&&!n.startsWith(`..${this.#i}`)?`.${this.#i}`:"";this.matchEmit(n?o+n+i:`.${i}`)}}async match(t,e,s){let i=await this.matchCheck(t,s);i&&this.matchFinish(i,e)}matchSync(t,e,s){let i=this.matchCheckSync(t,s);i&&this.#d(i,e)}walkCB(t,e,s){if(this.signal?.aborted)return s();this.walkCB2(t,e,new rs.Processor(this.opts),s)}walkCB2(t,e,s,i){if(this.#r(t)||this.signal?.aborted)return i();if(this.paused){this.onResume(()=>this.walkCB2(t,e,s,i));return}s.processPatterns(t,e);let n=1,o=()=>{--n===0&&i()};for(let[h,a]of s.matches.store)this.#o(h)||(n++,this.match(h,!!(a&pe),!!(a&me)).then(()=>o()));for(let h of s.subwalkTargets()){if(this.maxDepth!==1/0&&h.depth()>=this.maxDepth)continue;n++;let a=h.readdirCached();h.calledReaddir()?this.walkCB3(h,a,s,o):h.readdirCB((l,c)=>this.walkCB3(h,c,s,o),!0)}o()}walkCB3(t,e,s,i){let n=s.filterEntries(t,e),o=1,h=()=>{--o===0&&i()};for(let[a,l]of n.matches.store)this.#o(a)||(o++,this.match(a,!!(l&pe),!!(l&me)).then(()=>h()));for(let[a,l]of n.subwalks.entries())o++,this.walkCB2(a,l,n.child(),h);h()}walkCBSync(t,e,s){if(this.signal?.aborted)return s();this.walkCB2Sync(t,e,new rs.Processor(this.opts),s)}walkCB2Sync(t,e,s,i){if(this.#r(t)||this.signal?.aborted)return i();if(this.paused){this.onResume(()=>this.walkCB2Sync(t,e,s,i));return}s.processPatterns(t,e);let n=1,o=()=>{--n===0&&i()};for(let[h,a]of s.matches.store)this.#o(h)||this.matchSync(h,!!(a&pe),!!(a&me));for(let h of s.subwalkTargets()){if(this.maxDepth!==1/0&&h.depth()>=this.maxDepth)continue;n++;let a=h.readdirSync();this.walkCB3Sync(h,a,s,o)}o()}walkCB3Sync(t,e,s,i){let n=s.filterEntries(t,e),o=1,h=()=>{--o===0&&i()};for(let[a,l]of n.matches.store)this.#o(a)||this.matchSync(a,!!(l&pe),!!(l&me));for(let[a,l]of n.subwalks.entries())o++,this.walkCB2Sync(a,l,n.child(),h);h()}};Q.GlobUtil=Pt;var os=class extends Pt{matches=[];constructor(t,e,s){super(t,e,s)}matchEmit(t){this.matches.push(t)}async walk(){if(this.signal?.aborted)throw this.signal.reason;return this.path.isUnknown()&&await this.path.lstat(),await new Promise((t,e)=>{this.walkCB(this.path,this.patterns,()=>{this.signal?.aborted?e(this.signal.reason):t(this.matches)})}),this.matches}walkSync(){if(this.signal?.aborted)throw this.signal.reason;return this.path.isUnknown()&&this.path.lstatSync(),this.walkCBSync(this.path,this.patterns,()=>{if(this.signal?.aborted)throw this.signal.reason}),this.matches}};Q.GlobWalker=os;var hs=class extends Pt{results;constructor(t,e,s){super(t,e,s),this.results=new fr.Minipass({signal:this.signal,objectMode:!0}),this.results.on("drain",()=>this.resume()),this.results.on("resume",()=>this.resume())}matchEmit(t){this.results.write(t),this.results.flowing||this.pause()}stream(){let t=this.path;return t.isUnknown()?t.lstat().then(()=>{this.walkCB(t,this.patterns,()=>this.results.end())}):this.walkCB(t,this.patterns,()=>this.results.end()),this.results}streamSync(){return this.path.isUnknown()&&this.path.lstatSync(),this.walkCBSync(this.path,this.patterns,()=>this.results.end()),this.results}};Q.GlobStream=hs});var ls=C(be=>{"use strict";Object.defineProperty(be,"__esModule",{value:!0});be.Glob=void 0;var pr=Y(),mr=__webpack_require__(/*! node:url */ "node:url"),ge=mi(),gr=ts(),we=yi(),wr=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",as=class{absolute;cwd;root;dot;dotRelative;follow;ignore;magicalBraces;mark;matchBase;maxDepth;nobrace;nocase;nodir;noext;noglobstar;pattern;platform;realpath;scurry;stat;signal;windowsPathsNoEscape;withFileTypes;includeChildMatches;opts;patterns;constructor(t,e){if(!e)throw new TypeError("glob options required");if(this.withFileTypes=!!e.withFileTypes,this.signal=e.signal,this.follow=!!e.follow,this.dot=!!e.dot,this.dotRelative=!!e.dotRelative,this.nodir=!!e.nodir,this.mark=!!e.mark,e.cwd?(e.cwd instanceof URL||e.cwd.startsWith("file://"))&&(e.cwd=(0,mr.fileURLToPath)(e.cwd)):this.cwd="",this.cwd=e.cwd||"",this.root=e.root,this.magicalBraces=!!e.magicalBraces,this.nobrace=!!e.nobrace,this.noext=!!e.noext,this.realpath=!!e.realpath,this.absolute=e.absolute,this.includeChildMatches=e.includeChildMatches!==!1,this.noglobstar=!!e.noglobstar,this.matchBase=!!e.matchBase,this.maxDepth=typeof e.maxDepth=="number"?e.maxDepth:1/0,this.stat=!!e.stat,this.ignore=e.ignore,this.withFileTypes&&this.absolute!==void 0)throw new Error("cannot set absolute and withFileTypes:true");let s=typeof t=="string"?[t]:t;if(this.windowsPathsNoEscape=!!e.windowsPathsNoEscape||e.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(s=s.map(l=>l.replace(/\\/g,"/"))),this.matchBase){if(e.noglobstar)throw new TypeError("base matching requires globstar");s=s.map(l=>l.includes("/")?l:`./**/${l}`)}if(this.pattern=s,this.platform=e.platform||wr,this.opts={...e,platform:this.platform},e.scurry){if(this.scurry=e.scurry,e.nocase!==void 0&&e.nocase!==e.scurry.nocase)throw new Error("nocase option contradicts provided scurry option")}else{let l=e.platform==="win32"?ge.PathScurryWin32:e.platform==="darwin"?ge.PathScurryDarwin:e.platform?ge.PathScurryPosix:ge.PathScurry;this.scurry=new l(this.cwd,{nocase:e.nocase,fs:e.fs})}this.nocase=this.scurry.nocase;let i=this.platform==="darwin"||this.platform==="win32",n={braceExpandMax:1e4,...e,dot:this.dot,matchBase:this.matchBase,nobrace:this.nobrace,nocase:this.nocase,nocaseMagicOnly:i,nocomment:!0,noext:this.noext,nonegate:!0,optimizationLevel:2,platform:this.platform,windowsPathsNoEscape:this.windowsPathsNoEscape},o=this.pattern.map(l=>new pr.Minimatch(l,n)),[h,a]=o.reduce((l,c)=>(l[0].push(...c.set),l[1].push(...c.globParts),l),[[],[]]);this.patterns=h.map((l,c)=>{let u=a[c];if(!u)throw new Error("invalid pattern object");return new gr.Pattern(l,u,0,this.platform)})}async walk(){return await new we.GlobWalker(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).walk()}walkSync(){return new we.GlobWalker(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).walkSync()}stream(){return new we.GlobStream(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).stream()}streamSync(){return new we.GlobStream(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).streamSync()}iterateSync(){return this.streamSync()[Symbol.iterator]()}[Symbol.iterator](){return this.iterateSync()}iterate(){return this.stream()[Symbol.asyncIterator]()}[Symbol.asyncIterator](){return this.iterate()}};be.Glob=as});var cs=C(ye=>{"use strict";Object.defineProperty(ye,"__esModule",{value:!0});ye.hasMagic=void 0;var br=Y(),yr=(r,t={})=>{for(let e of Array.isArray(r)?r:[r])if(new br.Minimatch(e,t).hasMagic())return!0;return!1};ye.hasMagic=yr});Object.defineProperty(exports, "__esModule", ({value:!0}));exports.glob=exports.sync=exports.iterate=exports.iterateSync=exports.stream=exports.streamSync=exports.Ignore=exports.hasMagic=exports.Glob=exports.unescape=exports.escape=void 0;exports.globStreamSync=Tt;exports.globStream=us;exports.globSync=fs;exports.globIterateSync=Ft;exports.globIterate=ds;var Si=Y(),nt=ls(),Sr=cs(),_i=Y();Object.defineProperty(exports, "escape", ({enumerable:!0,get:function(){return _i.escape}}));Object.defineProperty(exports, "unescape", ({enumerable:!0,get:function(){return _i.unescape}}));var vr=ls();Object.defineProperty(exports, "Glob", ({enumerable:!0,get:function(){return vr.Glob}}));var _r=cs();Object.defineProperty(exports, "hasMagic", ({enumerable:!0,get:function(){return _r.hasMagic}}));var Er=is();Object.defineProperty(exports, "Ignore", ({enumerable:!0,get:function(){return Er.Ignore}}));function Tt(r,t={}){return new nt.Glob(r,t).streamSync()}function us(r,t={}){return new nt.Glob(r,t).stream()}function fs(r,t={}){return new nt.Glob(r,t).walkSync()}async function vi(r,t={}){return new nt.Glob(r,t).walk()}function Ft(r,t={}){return new nt.Glob(r,t).iterateSync()}function ds(r,t={}){return new nt.Glob(r,t).iterate()}exports.streamSync=Tt;exports.stream=Object.assign(us,{sync:Tt});exports.iterateSync=Ft;exports.iterate=Object.assign(ds,{sync:Ft});exports.sync=Object.assign(fs,{stream:Tt,iterate:Ft});exports.glob=Object.assign(vi,{glob:vi,globSync:fs,sync:exports.sync,globStream:us,stream:exports.stream,globStreamSync:Tt,streamSync:exports.streamSync,globIterate:ds,iterate:exports.iterate,globIterateSync:Ft,iterateSync:exports.iterateSync,Glob:nt.Glob,hasMagic:Sr.hasMagic,escape:Si.escape,unescape:Si.unescape});exports.glob.glob=exports.glob;
|
|
143378
144843
|
//# sourceMappingURL=index.min.js.map
|
|
143379
144844
|
|
|
143380
144845
|
|