deck.gl 9.3.0-beta.1 → 9.3.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dist.dev.js +1292 -264
- package/dist.min.js +260 -260
- package/package.json +15 -15
package/dist/dist.dev.js
CHANGED
|
@@ -60861,6 +60861,19 @@ void main(void) {
|
|
|
60861
60861
|
function isExist(v4) {
|
|
60862
60862
|
return typeof v4 !== "undefined";
|
|
60863
60863
|
}
|
|
60864
|
+
var DANGEROUS_PROPERTY_NAMES = [
|
|
60865
|
+
// '__proto__',
|
|
60866
|
+
// 'constructor',
|
|
60867
|
+
// 'prototype',
|
|
60868
|
+
"hasOwnProperty",
|
|
60869
|
+
"toString",
|
|
60870
|
+
"valueOf",
|
|
60871
|
+
"__defineGetter__",
|
|
60872
|
+
"__defineSetter__",
|
|
60873
|
+
"__lookupGetter__",
|
|
60874
|
+
"__lookupSetter__"
|
|
60875
|
+
];
|
|
60876
|
+
var criticalProperties = ["__proto__", "constructor", "prototype"];
|
|
60864
60877
|
|
|
60865
60878
|
// ../../node_modules/fast-xml-parser/src/validator.js
|
|
60866
60879
|
var defaultOptions2 = {
|
|
@@ -61102,7 +61115,7 @@ void main(void) {
|
|
|
61102
61115
|
if (!validateAttrName(attrName)) {
|
|
61103
61116
|
return getErrorObject("InvalidAttr", "Attribute '" + attrName + "' is an invalid name.", getPositionFromMatch(matches3[i4]));
|
|
61104
61117
|
}
|
|
61105
|
-
if (!
|
|
61118
|
+
if (!Object.prototype.hasOwnProperty.call(attrNames, attrName)) {
|
|
61106
61119
|
attrNames[attrName] = 1;
|
|
61107
61120
|
} else {
|
|
61108
61121
|
return getErrorObject("InvalidAttr", "Attribute '" + attrName + "' is repeated.", getPositionFromMatch(matches3[i4]));
|
|
@@ -61171,6 +61184,12 @@ void main(void) {
|
|
|
61171
61184
|
}
|
|
61172
61185
|
|
|
61173
61186
|
// ../../node_modules/fast-xml-parser/src/xmlparser/OptionsBuilder.js
|
|
61187
|
+
var defaultOnDangerousProperty = (name13) => {
|
|
61188
|
+
if (DANGEROUS_PROPERTY_NAMES.includes(name13)) {
|
|
61189
|
+
return "__" + name13;
|
|
61190
|
+
}
|
|
61191
|
+
return name13;
|
|
61192
|
+
};
|
|
61174
61193
|
var defaultOptions3 = {
|
|
61175
61194
|
preserveOrder: false,
|
|
61176
61195
|
attributeNamePrefix: "@_",
|
|
@@ -61214,8 +61233,29 @@ void main(void) {
|
|
|
61214
61233
|
return tagName;
|
|
61215
61234
|
},
|
|
61216
61235
|
// skipEmptyListItem: false
|
|
61217
|
-
captureMetaData: false
|
|
61218
|
-
|
|
61236
|
+
captureMetaData: false,
|
|
61237
|
+
maxNestedTags: 100,
|
|
61238
|
+
strictReservedNames: true,
|
|
61239
|
+
jPath: true,
|
|
61240
|
+
// if true, pass jPath string to callbacks; if false, pass matcher instance
|
|
61241
|
+
onDangerousProperty: defaultOnDangerousProperty
|
|
61242
|
+
};
|
|
61243
|
+
function validatePropertyName(propertyName, optionName) {
|
|
61244
|
+
if (typeof propertyName !== "string") {
|
|
61245
|
+
return;
|
|
61246
|
+
}
|
|
61247
|
+
const normalized = propertyName.toLowerCase();
|
|
61248
|
+
if (DANGEROUS_PROPERTY_NAMES.some((dangerous) => normalized === dangerous.toLowerCase())) {
|
|
61249
|
+
throw new Error(
|
|
61250
|
+
`[SECURITY] Invalid ${optionName}: "${propertyName}" is a reserved JavaScript keyword that could cause prototype pollution`
|
|
61251
|
+
);
|
|
61252
|
+
}
|
|
61253
|
+
if (criticalProperties.some((dangerous) => normalized === dangerous.toLowerCase())) {
|
|
61254
|
+
throw new Error(
|
|
61255
|
+
`[SECURITY] Invalid ${optionName}: "${propertyName}" is a reserved JavaScript keyword that could cause prototype pollution`
|
|
61256
|
+
);
|
|
61257
|
+
}
|
|
61258
|
+
}
|
|
61219
61259
|
function normalizeProcessEntities(value) {
|
|
61220
61260
|
if (typeof value === "boolean") {
|
|
61221
61261
|
return {
|
|
@@ -61225,6 +61265,7 @@ void main(void) {
|
|
|
61225
61265
|
maxExpansionDepth: 10,
|
|
61226
61266
|
maxTotalExpansions: 1e3,
|
|
61227
61267
|
maxExpandedLength: 1e5,
|
|
61268
|
+
maxEntityCount: 100,
|
|
61228
61269
|
allowedTags: null,
|
|
61229
61270
|
tagFilter: null
|
|
61230
61271
|
};
|
|
@@ -61232,11 +61273,11 @@ void main(void) {
|
|
|
61232
61273
|
if (typeof value === "object" && value !== null) {
|
|
61233
61274
|
return {
|
|
61234
61275
|
enabled: value.enabled !== false,
|
|
61235
|
-
|
|
61236
|
-
|
|
61237
|
-
|
|
61238
|
-
|
|
61239
|
-
|
|
61276
|
+
maxEntitySize: Math.max(1, value.maxEntitySize ?? 1e4),
|
|
61277
|
+
maxExpansionDepth: Math.max(1, value.maxExpansionDepth ?? 1e4),
|
|
61278
|
+
maxTotalExpansions: Math.max(1, value.maxTotalExpansions ?? Infinity),
|
|
61279
|
+
maxExpandedLength: Math.max(1, value.maxExpandedLength ?? 1e5),
|
|
61280
|
+
maxEntityCount: Math.max(1, value.maxEntityCount ?? 1e3),
|
|
61240
61281
|
allowedTags: value.allowedTags ?? null,
|
|
61241
61282
|
tagFilter: value.tagFilter ?? null
|
|
61242
61283
|
};
|
|
@@ -61245,7 +61286,31 @@ void main(void) {
|
|
|
61245
61286
|
}
|
|
61246
61287
|
var buildOptions = function(options) {
|
|
61247
61288
|
const built = Object.assign({}, defaultOptions3, options);
|
|
61289
|
+
const propertyNameOptions = [
|
|
61290
|
+
{ value: built.attributeNamePrefix, name: "attributeNamePrefix" },
|
|
61291
|
+
{ value: built.attributesGroupName, name: "attributesGroupName" },
|
|
61292
|
+
{ value: built.textNodeName, name: "textNodeName" },
|
|
61293
|
+
{ value: built.cdataPropName, name: "cdataPropName" },
|
|
61294
|
+
{ value: built.commentPropName, name: "commentPropName" }
|
|
61295
|
+
];
|
|
61296
|
+
for (const { value, name: name13 } of propertyNameOptions) {
|
|
61297
|
+
if (value) {
|
|
61298
|
+
validatePropertyName(value, name13);
|
|
61299
|
+
}
|
|
61300
|
+
}
|
|
61301
|
+
if (built.onDangerousProperty === null) {
|
|
61302
|
+
built.onDangerousProperty = defaultOnDangerousProperty;
|
|
61303
|
+
}
|
|
61248
61304
|
built.processEntities = normalizeProcessEntities(built.processEntities);
|
|
61305
|
+
built.unpairedTagsSet = new Set(built.unpairedTags);
|
|
61306
|
+
if (built.stopNodes && Array.isArray(built.stopNodes)) {
|
|
61307
|
+
built.stopNodes = built.stopNodes.map((node) => {
|
|
61308
|
+
if (typeof node === "string" && node.startsWith("*.")) {
|
|
61309
|
+
return ".." + node.substring(2);
|
|
61310
|
+
}
|
|
61311
|
+
return node;
|
|
61312
|
+
});
|
|
61313
|
+
}
|
|
61249
61314
|
return built;
|
|
61250
61315
|
};
|
|
61251
61316
|
|
|
@@ -61260,7 +61325,7 @@ void main(void) {
|
|
|
61260
61325
|
constructor(tagname) {
|
|
61261
61326
|
this.tagname = tagname;
|
|
61262
61327
|
this.child = [];
|
|
61263
|
-
this[":@"] =
|
|
61328
|
+
this[":@"] = /* @__PURE__ */ Object.create(null);
|
|
61264
61329
|
}
|
|
61265
61330
|
add(key, val) {
|
|
61266
61331
|
if (key === "__proto__")
|
|
@@ -61292,7 +61357,8 @@ void main(void) {
|
|
|
61292
61357
|
this.options = options;
|
|
61293
61358
|
}
|
|
61294
61359
|
readDocType(xmlData, i4) {
|
|
61295
|
-
const entities =
|
|
61360
|
+
const entities = /* @__PURE__ */ Object.create(null);
|
|
61361
|
+
let entityCount = 0;
|
|
61296
61362
|
if (xmlData[i4 + 3] === "O" && xmlData[i4 + 4] === "C" && xmlData[i4 + 5] === "T" && xmlData[i4 + 6] === "Y" && xmlData[i4 + 7] === "P" && xmlData[i4 + 8] === "E") {
|
|
61297
61363
|
i4 = i4 + 9;
|
|
61298
61364
|
let angleBracketsCount = 1;
|
|
@@ -61305,11 +61371,17 @@ void main(void) {
|
|
|
61305
61371
|
let entityName, val;
|
|
61306
61372
|
[entityName, val, i4] = this.readEntityExp(xmlData, i4 + 1, this.suppressValidationErr);
|
|
61307
61373
|
if (val.indexOf("&") === -1) {
|
|
61308
|
-
|
|
61374
|
+
if (this.options.enabled !== false && this.options.maxEntityCount != null && entityCount >= this.options.maxEntityCount) {
|
|
61375
|
+
throw new Error(
|
|
61376
|
+
`Entity count (${entityCount + 1}) exceeds maximum allowed (${this.options.maxEntityCount})`
|
|
61377
|
+
);
|
|
61378
|
+
}
|
|
61379
|
+
const escaped = entityName.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
61309
61380
|
entities[entityName] = {
|
|
61310
61381
|
regx: RegExp(`&${escaped};`, "g"),
|
|
61311
61382
|
val
|
|
61312
61383
|
};
|
|
61384
|
+
entityCount++;
|
|
61313
61385
|
}
|
|
61314
61386
|
} else if (hasBody && hasSeq(xmlData, "!ELEMENT", i4)) {
|
|
61315
61387
|
i4 += 8;
|
|
@@ -61355,11 +61427,11 @@ void main(void) {
|
|
|
61355
61427
|
}
|
|
61356
61428
|
readEntityExp(xmlData, i4) {
|
|
61357
61429
|
i4 = skipWhitespace(xmlData, i4);
|
|
61358
|
-
|
|
61430
|
+
const startIndex = i4;
|
|
61359
61431
|
while (i4 < xmlData.length && !/\s/.test(xmlData[i4]) && xmlData[i4] !== '"' && xmlData[i4] !== "'") {
|
|
61360
|
-
entityName += xmlData[i4];
|
|
61361
61432
|
i4++;
|
|
61362
61433
|
}
|
|
61434
|
+
let entityName = xmlData.substring(startIndex, i4);
|
|
61363
61435
|
validateEntityName(entityName);
|
|
61364
61436
|
i4 = skipWhitespace(xmlData, i4);
|
|
61365
61437
|
if (!this.suppressValidationErr) {
|
|
@@ -61371,7 +61443,7 @@ void main(void) {
|
|
|
61371
61443
|
}
|
|
61372
61444
|
let entityValue = "";
|
|
61373
61445
|
[i4, entityValue] = this.readIdentifierVal(xmlData, i4, "entity");
|
|
61374
|
-
if (this.options.enabled !== false && this.options.maxEntitySize && entityValue.length > this.options.maxEntitySize) {
|
|
61446
|
+
if (this.options.enabled !== false && this.options.maxEntitySize != null && entityValue.length > this.options.maxEntitySize) {
|
|
61375
61447
|
throw new Error(
|
|
61376
61448
|
`Entity "${entityName}" size (${entityValue.length}) exceeds maximum allowed size (${this.options.maxEntitySize})`
|
|
61377
61449
|
);
|
|
@@ -61381,11 +61453,11 @@ void main(void) {
|
|
|
61381
61453
|
}
|
|
61382
61454
|
readNotationExp(xmlData, i4) {
|
|
61383
61455
|
i4 = skipWhitespace(xmlData, i4);
|
|
61384
|
-
|
|
61456
|
+
const startIndex = i4;
|
|
61385
61457
|
while (i4 < xmlData.length && !/\s/.test(xmlData[i4])) {
|
|
61386
|
-
notationName += xmlData[i4];
|
|
61387
61458
|
i4++;
|
|
61388
61459
|
}
|
|
61460
|
+
let notationName = xmlData.substring(startIndex, i4);
|
|
61389
61461
|
!this.suppressValidationErr && validateEntityName(notationName);
|
|
61390
61462
|
i4 = skipWhitespace(xmlData, i4);
|
|
61391
61463
|
const identifierType = xmlData.substring(i4, i4 + 6).toUpperCase();
|
|
@@ -61417,10 +61489,11 @@ void main(void) {
|
|
|
61417
61489
|
throw new Error(`Expected quoted string, found "${startChar}"`);
|
|
61418
61490
|
}
|
|
61419
61491
|
i4++;
|
|
61492
|
+
const startIndex = i4;
|
|
61420
61493
|
while (i4 < xmlData.length && xmlData[i4] !== startChar) {
|
|
61421
|
-
identifierVal += xmlData[i4];
|
|
61422
61494
|
i4++;
|
|
61423
61495
|
}
|
|
61496
|
+
identifierVal = xmlData.substring(startIndex, i4);
|
|
61424
61497
|
if (xmlData[i4] !== startChar) {
|
|
61425
61498
|
throw new Error(`Unterminated ${type} value`);
|
|
61426
61499
|
}
|
|
@@ -61429,11 +61502,11 @@ void main(void) {
|
|
|
61429
61502
|
}
|
|
61430
61503
|
readElementExp(xmlData, i4) {
|
|
61431
61504
|
i4 = skipWhitespace(xmlData, i4);
|
|
61432
|
-
|
|
61505
|
+
const startIndex = i4;
|
|
61433
61506
|
while (i4 < xmlData.length && !/\s/.test(xmlData[i4])) {
|
|
61434
|
-
elementName += xmlData[i4];
|
|
61435
61507
|
i4++;
|
|
61436
61508
|
}
|
|
61509
|
+
let elementName = xmlData.substring(startIndex, i4);
|
|
61437
61510
|
if (!this.suppressValidationErr && !isName(elementName)) {
|
|
61438
61511
|
throw new Error(`Invalid element name: "${elementName}"`);
|
|
61439
61512
|
}
|
|
@@ -61445,10 +61518,11 @@ void main(void) {
|
|
|
61445
61518
|
i4 += 2;
|
|
61446
61519
|
else if (xmlData[i4] === "(") {
|
|
61447
61520
|
i4++;
|
|
61521
|
+
const startIndex2 = i4;
|
|
61448
61522
|
while (i4 < xmlData.length && xmlData[i4] !== ")") {
|
|
61449
|
-
contentModel += xmlData[i4];
|
|
61450
61523
|
i4++;
|
|
61451
61524
|
}
|
|
61525
|
+
contentModel = xmlData.substring(startIndex2, i4);
|
|
61452
61526
|
if (xmlData[i4] !== ")") {
|
|
61453
61527
|
throw new Error("Unterminated content model");
|
|
61454
61528
|
}
|
|
@@ -61463,18 +61537,18 @@ void main(void) {
|
|
|
61463
61537
|
}
|
|
61464
61538
|
readAttlistExp(xmlData, i4) {
|
|
61465
61539
|
i4 = skipWhitespace(xmlData, i4);
|
|
61466
|
-
let
|
|
61540
|
+
let startIndex = i4;
|
|
61467
61541
|
while (i4 < xmlData.length && !/\s/.test(xmlData[i4])) {
|
|
61468
|
-
elementName += xmlData[i4];
|
|
61469
61542
|
i4++;
|
|
61470
61543
|
}
|
|
61544
|
+
let elementName = xmlData.substring(startIndex, i4);
|
|
61471
61545
|
validateEntityName(elementName);
|
|
61472
61546
|
i4 = skipWhitespace(xmlData, i4);
|
|
61473
|
-
|
|
61547
|
+
startIndex = i4;
|
|
61474
61548
|
while (i4 < xmlData.length && !/\s/.test(xmlData[i4])) {
|
|
61475
|
-
attributeName += xmlData[i4];
|
|
61476
61549
|
i4++;
|
|
61477
61550
|
}
|
|
61551
|
+
let attributeName = xmlData.substring(startIndex, i4);
|
|
61478
61552
|
if (!validateEntityName(attributeName)) {
|
|
61479
61553
|
throw new Error(`Invalid attribute name: "${attributeName}"`);
|
|
61480
61554
|
}
|
|
@@ -61490,11 +61564,11 @@ void main(void) {
|
|
|
61490
61564
|
i4++;
|
|
61491
61565
|
let allowedNotations = [];
|
|
61492
61566
|
while (i4 < xmlData.length && xmlData[i4] !== ")") {
|
|
61493
|
-
|
|
61567
|
+
const startIndex2 = i4;
|
|
61494
61568
|
while (i4 < xmlData.length && xmlData[i4] !== "|" && xmlData[i4] !== ")") {
|
|
61495
|
-
notation += xmlData[i4];
|
|
61496
61569
|
i4++;
|
|
61497
61570
|
}
|
|
61571
|
+
let notation = xmlData.substring(startIndex2, i4);
|
|
61498
61572
|
notation = notation.trim();
|
|
61499
61573
|
if (!validateEntityName(notation)) {
|
|
61500
61574
|
throw new Error(`Invalid notation name: "${notation}"`);
|
|
@@ -61511,10 +61585,11 @@ void main(void) {
|
|
|
61511
61585
|
i4++;
|
|
61512
61586
|
attributeType += " (" + allowedNotations.join("|") + ")";
|
|
61513
61587
|
} else {
|
|
61588
|
+
const startIndex2 = i4;
|
|
61514
61589
|
while (i4 < xmlData.length && !/\s/.test(xmlData[i4])) {
|
|
61515
|
-
attributeType += xmlData[i4];
|
|
61516
61590
|
i4++;
|
|
61517
61591
|
}
|
|
61592
|
+
attributeType += xmlData.substring(startIndex2, i4);
|
|
61518
61593
|
const validTypes = ["CDATA", "ID", "IDREF", "IDREFS", "ENTITY", "ENTITIES", "NMTOKEN", "NMTOKENS"];
|
|
61519
61594
|
if (!this.suppressValidationErr && !validTypes.includes(attributeType.toUpperCase())) {
|
|
61520
61595
|
throw new Error(`Invalid attribute type: "${attributeType}"`);
|
|
@@ -61568,20 +61643,26 @@ void main(void) {
|
|
|
61568
61643
|
// oct: false,
|
|
61569
61644
|
leadingZeros: true,
|
|
61570
61645
|
decimalPoint: ".",
|
|
61571
|
-
eNotation: true
|
|
61572
|
-
//skipLike: /regex
|
|
61646
|
+
eNotation: true,
|
|
61647
|
+
//skipLike: /regex/,
|
|
61648
|
+
infinity: "original"
|
|
61649
|
+
// "null", "infinity" (Infinity type), "string" ("Infinity" (the string literal))
|
|
61573
61650
|
};
|
|
61574
61651
|
function toNumber(str6, options = {}) {
|
|
61575
61652
|
options = Object.assign({}, consider, options);
|
|
61576
61653
|
if (!str6 || typeof str6 !== "string")
|
|
61577
61654
|
return str6;
|
|
61578
61655
|
let trimmedStr = str6.trim();
|
|
61579
|
-
if (
|
|
61656
|
+
if (trimmedStr.length === 0)
|
|
61580
61657
|
return str6;
|
|
61581
|
-
else if (
|
|
61658
|
+
else if (options.skipLike !== void 0 && options.skipLike.test(trimmedStr))
|
|
61659
|
+
return str6;
|
|
61660
|
+
else if (trimmedStr === "0")
|
|
61582
61661
|
return 0;
|
|
61583
61662
|
else if (options.hex && hexRegex.test(trimmedStr)) {
|
|
61584
61663
|
return parse_int(trimmedStr, 16);
|
|
61664
|
+
} else if (!isFinite(trimmedStr)) {
|
|
61665
|
+
return handleInfinity(str6, Number(trimmedStr), options);
|
|
61585
61666
|
} else if (trimmedStr.includes("e") || trimmedStr.includes("E")) {
|
|
61586
61667
|
return resolveEnotation(str6, trimmedStr, options);
|
|
61587
61668
|
} else {
|
|
@@ -61645,11 +61726,15 @@ void main(void) {
|
|
|
61645
61726
|
return str6;
|
|
61646
61727
|
else if (leadingZeros.length === 1 && (notation[3].startsWith(`.${eChar}`) || notation[3][0] === eChar)) {
|
|
61647
61728
|
return Number(trimmedStr);
|
|
61648
|
-
} else if (
|
|
61649
|
-
|
|
61729
|
+
} else if (leadingZeros.length > 0) {
|
|
61730
|
+
if (options.leadingZeros && !eAdjacentToLeadingZeros) {
|
|
61731
|
+
trimmedStr = (notation[1] || "") + notation[3];
|
|
61732
|
+
return Number(trimmedStr);
|
|
61733
|
+
} else
|
|
61734
|
+
return str6;
|
|
61735
|
+
} else {
|
|
61650
61736
|
return Number(trimmedStr);
|
|
61651
|
-
}
|
|
61652
|
-
return str6;
|
|
61737
|
+
}
|
|
61653
61738
|
} else {
|
|
61654
61739
|
return str6;
|
|
61655
61740
|
}
|
|
@@ -61677,6 +61762,20 @@ void main(void) {
|
|
|
61677
61762
|
else
|
|
61678
61763
|
throw new Error("parseInt, Number.parseInt, window.parseInt are not supported");
|
|
61679
61764
|
}
|
|
61765
|
+
function handleInfinity(str6, num, options) {
|
|
61766
|
+
const isPositive2 = num === Infinity;
|
|
61767
|
+
switch (options.infinity.toLowerCase()) {
|
|
61768
|
+
case "null":
|
|
61769
|
+
return null;
|
|
61770
|
+
case "infinity":
|
|
61771
|
+
return num;
|
|
61772
|
+
case "string":
|
|
61773
|
+
return isPositive2 ? "Infinity" : "-Infinity";
|
|
61774
|
+
case "original":
|
|
61775
|
+
default:
|
|
61776
|
+
return str6;
|
|
61777
|
+
}
|
|
61778
|
+
}
|
|
61680
61779
|
|
|
61681
61780
|
// ../../node_modules/fast-xml-parser/src/ignoreAttributes.js
|
|
61682
61781
|
function getIgnoreAttributesFn(ignoreAttributes) {
|
|
@@ -61698,7 +61797,776 @@ void main(void) {
|
|
|
61698
61797
|
return () => false;
|
|
61699
61798
|
}
|
|
61700
61799
|
|
|
61800
|
+
// ../../node_modules/path-expression-matcher/src/Expression.js
|
|
61801
|
+
var Expression = class {
|
|
61802
|
+
/**
|
|
61803
|
+
* Create a new Expression
|
|
61804
|
+
* @param {string} pattern - Pattern string (e.g., "root.users.user", "..user[id]")
|
|
61805
|
+
* @param {Object} options - Configuration options
|
|
61806
|
+
* @param {string} options.separator - Path separator (default: '.')
|
|
61807
|
+
*/
|
|
61808
|
+
constructor(pattern, options = {}, data) {
|
|
61809
|
+
this.pattern = pattern;
|
|
61810
|
+
this.separator = options.separator || ".";
|
|
61811
|
+
this.segments = this._parse(pattern);
|
|
61812
|
+
this.data = data;
|
|
61813
|
+
this._hasDeepWildcard = this.segments.some((seg) => seg.type === "deep-wildcard");
|
|
61814
|
+
this._hasAttributeCondition = this.segments.some((seg) => seg.attrName !== void 0);
|
|
61815
|
+
this._hasPositionSelector = this.segments.some((seg) => seg.position !== void 0);
|
|
61816
|
+
}
|
|
61817
|
+
/**
|
|
61818
|
+
* Parse pattern string into segments
|
|
61819
|
+
* @private
|
|
61820
|
+
* @param {string} pattern - Pattern to parse
|
|
61821
|
+
* @returns {Array} Array of segment objects
|
|
61822
|
+
*/
|
|
61823
|
+
_parse(pattern) {
|
|
61824
|
+
const segments = [];
|
|
61825
|
+
let i4 = 0;
|
|
61826
|
+
let currentPart = "";
|
|
61827
|
+
while (i4 < pattern.length) {
|
|
61828
|
+
if (pattern[i4] === this.separator) {
|
|
61829
|
+
if (i4 + 1 < pattern.length && pattern[i4 + 1] === this.separator) {
|
|
61830
|
+
if (currentPart.trim()) {
|
|
61831
|
+
segments.push(this._parseSegment(currentPart.trim()));
|
|
61832
|
+
currentPart = "";
|
|
61833
|
+
}
|
|
61834
|
+
segments.push({ type: "deep-wildcard" });
|
|
61835
|
+
i4 += 2;
|
|
61836
|
+
} else {
|
|
61837
|
+
if (currentPart.trim()) {
|
|
61838
|
+
segments.push(this._parseSegment(currentPart.trim()));
|
|
61839
|
+
}
|
|
61840
|
+
currentPart = "";
|
|
61841
|
+
i4++;
|
|
61842
|
+
}
|
|
61843
|
+
} else {
|
|
61844
|
+
currentPart += pattern[i4];
|
|
61845
|
+
i4++;
|
|
61846
|
+
}
|
|
61847
|
+
}
|
|
61848
|
+
if (currentPart.trim()) {
|
|
61849
|
+
segments.push(this._parseSegment(currentPart.trim()));
|
|
61850
|
+
}
|
|
61851
|
+
return segments;
|
|
61852
|
+
}
|
|
61853
|
+
/**
|
|
61854
|
+
* Parse a single segment
|
|
61855
|
+
* @private
|
|
61856
|
+
* @param {string} part - Segment string (e.g., "user", "ns::user", "user[id]", "ns::user:first")
|
|
61857
|
+
* @returns {Object} Segment object
|
|
61858
|
+
*/
|
|
61859
|
+
_parseSegment(part) {
|
|
61860
|
+
const segment = { type: "tag" };
|
|
61861
|
+
let bracketContent = null;
|
|
61862
|
+
let withoutBrackets = part;
|
|
61863
|
+
const bracketMatch = part.match(/^([^\[]+)(\[[^\]]*\])(.*)$/);
|
|
61864
|
+
if (bracketMatch) {
|
|
61865
|
+
withoutBrackets = bracketMatch[1] + bracketMatch[3];
|
|
61866
|
+
if (bracketMatch[2]) {
|
|
61867
|
+
const content = bracketMatch[2].slice(1, -1);
|
|
61868
|
+
if (content) {
|
|
61869
|
+
bracketContent = content;
|
|
61870
|
+
}
|
|
61871
|
+
}
|
|
61872
|
+
}
|
|
61873
|
+
let namespace = void 0;
|
|
61874
|
+
let tagAndPosition = withoutBrackets;
|
|
61875
|
+
if (withoutBrackets.includes("::")) {
|
|
61876
|
+
const nsIndex = withoutBrackets.indexOf("::");
|
|
61877
|
+
namespace = withoutBrackets.substring(0, nsIndex).trim();
|
|
61878
|
+
tagAndPosition = withoutBrackets.substring(nsIndex + 2).trim();
|
|
61879
|
+
if (!namespace) {
|
|
61880
|
+
throw new Error(`Invalid namespace in pattern: ${part}`);
|
|
61881
|
+
}
|
|
61882
|
+
}
|
|
61883
|
+
let tag = void 0;
|
|
61884
|
+
let positionMatch = null;
|
|
61885
|
+
if (tagAndPosition.includes(":")) {
|
|
61886
|
+
const colonIndex = tagAndPosition.lastIndexOf(":");
|
|
61887
|
+
const tagPart = tagAndPosition.substring(0, colonIndex).trim();
|
|
61888
|
+
const posPart = tagAndPosition.substring(colonIndex + 1).trim();
|
|
61889
|
+
const isPositionKeyword = ["first", "last", "odd", "even"].includes(posPart) || /^nth\(\d+\)$/.test(posPart);
|
|
61890
|
+
if (isPositionKeyword) {
|
|
61891
|
+
tag = tagPart;
|
|
61892
|
+
positionMatch = posPart;
|
|
61893
|
+
} else {
|
|
61894
|
+
tag = tagAndPosition;
|
|
61895
|
+
}
|
|
61896
|
+
} else {
|
|
61897
|
+
tag = tagAndPosition;
|
|
61898
|
+
}
|
|
61899
|
+
if (!tag) {
|
|
61900
|
+
throw new Error(`Invalid segment pattern: ${part}`);
|
|
61901
|
+
}
|
|
61902
|
+
segment.tag = tag;
|
|
61903
|
+
if (namespace) {
|
|
61904
|
+
segment.namespace = namespace;
|
|
61905
|
+
}
|
|
61906
|
+
if (bracketContent) {
|
|
61907
|
+
if (bracketContent.includes("=")) {
|
|
61908
|
+
const eqIndex = bracketContent.indexOf("=");
|
|
61909
|
+
segment.attrName = bracketContent.substring(0, eqIndex).trim();
|
|
61910
|
+
segment.attrValue = bracketContent.substring(eqIndex + 1).trim();
|
|
61911
|
+
} else {
|
|
61912
|
+
segment.attrName = bracketContent.trim();
|
|
61913
|
+
}
|
|
61914
|
+
}
|
|
61915
|
+
if (positionMatch) {
|
|
61916
|
+
const nthMatch = positionMatch.match(/^nth\((\d+)\)$/);
|
|
61917
|
+
if (nthMatch) {
|
|
61918
|
+
segment.position = "nth";
|
|
61919
|
+
segment.positionValue = parseInt(nthMatch[1], 10);
|
|
61920
|
+
} else {
|
|
61921
|
+
segment.position = positionMatch;
|
|
61922
|
+
}
|
|
61923
|
+
}
|
|
61924
|
+
return segment;
|
|
61925
|
+
}
|
|
61926
|
+
/**
|
|
61927
|
+
* Get the number of segments
|
|
61928
|
+
* @returns {number}
|
|
61929
|
+
*/
|
|
61930
|
+
get length() {
|
|
61931
|
+
return this.segments.length;
|
|
61932
|
+
}
|
|
61933
|
+
/**
|
|
61934
|
+
* Check if expression contains deep wildcard
|
|
61935
|
+
* @returns {boolean}
|
|
61936
|
+
*/
|
|
61937
|
+
hasDeepWildcard() {
|
|
61938
|
+
return this._hasDeepWildcard;
|
|
61939
|
+
}
|
|
61940
|
+
/**
|
|
61941
|
+
* Check if expression has attribute conditions
|
|
61942
|
+
* @returns {boolean}
|
|
61943
|
+
*/
|
|
61944
|
+
hasAttributeCondition() {
|
|
61945
|
+
return this._hasAttributeCondition;
|
|
61946
|
+
}
|
|
61947
|
+
/**
|
|
61948
|
+
* Check if expression has position selectors
|
|
61949
|
+
* @returns {boolean}
|
|
61950
|
+
*/
|
|
61951
|
+
hasPositionSelector() {
|
|
61952
|
+
return this._hasPositionSelector;
|
|
61953
|
+
}
|
|
61954
|
+
/**
|
|
61955
|
+
* Get string representation
|
|
61956
|
+
* @returns {string}
|
|
61957
|
+
*/
|
|
61958
|
+
toString() {
|
|
61959
|
+
return this.pattern;
|
|
61960
|
+
}
|
|
61961
|
+
};
|
|
61962
|
+
|
|
61963
|
+
// ../../node_modules/path-expression-matcher/src/ExpressionSet.js
|
|
61964
|
+
var ExpressionSet = class {
|
|
61965
|
+
constructor() {
|
|
61966
|
+
this._byDepthAndTag = /* @__PURE__ */ new Map();
|
|
61967
|
+
this._wildcardByDepth = /* @__PURE__ */ new Map();
|
|
61968
|
+
this._deepWildcards = [];
|
|
61969
|
+
this._patterns = /* @__PURE__ */ new Set();
|
|
61970
|
+
this._sealed = false;
|
|
61971
|
+
}
|
|
61972
|
+
/**
|
|
61973
|
+
* Add an Expression to the set.
|
|
61974
|
+
* Duplicate patterns (same pattern string) are silently ignored.
|
|
61975
|
+
*
|
|
61976
|
+
* @param {import('./Expression.js').default} expression - A pre-constructed Expression instance
|
|
61977
|
+
* @returns {this} for chaining
|
|
61978
|
+
* @throws {TypeError} if called after seal()
|
|
61979
|
+
*
|
|
61980
|
+
* @example
|
|
61981
|
+
* set.add(new Expression('root.users.user'));
|
|
61982
|
+
* set.add(new Expression('..script'));
|
|
61983
|
+
*/
|
|
61984
|
+
add(expression) {
|
|
61985
|
+
if (this._sealed) {
|
|
61986
|
+
throw new TypeError(
|
|
61987
|
+
"ExpressionSet is sealed. Create a new ExpressionSet to add more expressions."
|
|
61988
|
+
);
|
|
61989
|
+
}
|
|
61990
|
+
if (this._patterns.has(expression.pattern))
|
|
61991
|
+
return this;
|
|
61992
|
+
this._patterns.add(expression.pattern);
|
|
61993
|
+
if (expression.hasDeepWildcard()) {
|
|
61994
|
+
this._deepWildcards.push(expression);
|
|
61995
|
+
return this;
|
|
61996
|
+
}
|
|
61997
|
+
const depth = expression.length;
|
|
61998
|
+
const lastSeg = expression.segments[expression.segments.length - 1];
|
|
61999
|
+
const tag = lastSeg?.tag;
|
|
62000
|
+
if (!tag || tag === "*") {
|
|
62001
|
+
if (!this._wildcardByDepth.has(depth))
|
|
62002
|
+
this._wildcardByDepth.set(depth, []);
|
|
62003
|
+
this._wildcardByDepth.get(depth).push(expression);
|
|
62004
|
+
} else {
|
|
62005
|
+
const key = `${depth}:${tag}`;
|
|
62006
|
+
if (!this._byDepthAndTag.has(key))
|
|
62007
|
+
this._byDepthAndTag.set(key, []);
|
|
62008
|
+
this._byDepthAndTag.get(key).push(expression);
|
|
62009
|
+
}
|
|
62010
|
+
return this;
|
|
62011
|
+
}
|
|
62012
|
+
/**
|
|
62013
|
+
* Add multiple expressions at once.
|
|
62014
|
+
*
|
|
62015
|
+
* @param {import('./Expression.js').default[]} expressions - Array of Expression instances
|
|
62016
|
+
* @returns {this} for chaining
|
|
62017
|
+
*
|
|
62018
|
+
* @example
|
|
62019
|
+
* set.addAll([
|
|
62020
|
+
* new Expression('root.users.user'),
|
|
62021
|
+
* new Expression('root.config.setting'),
|
|
62022
|
+
* ]);
|
|
62023
|
+
*/
|
|
62024
|
+
addAll(expressions) {
|
|
62025
|
+
for (const expr of expressions)
|
|
62026
|
+
this.add(expr);
|
|
62027
|
+
return this;
|
|
62028
|
+
}
|
|
62029
|
+
/**
|
|
62030
|
+
* Check whether a pattern string is already present in the set.
|
|
62031
|
+
*
|
|
62032
|
+
* @param {import('./Expression.js').default} expression
|
|
62033
|
+
* @returns {boolean}
|
|
62034
|
+
*/
|
|
62035
|
+
has(expression) {
|
|
62036
|
+
return this._patterns.has(expression.pattern);
|
|
62037
|
+
}
|
|
62038
|
+
/**
|
|
62039
|
+
* Number of expressions in the set.
|
|
62040
|
+
* @type {number}
|
|
62041
|
+
*/
|
|
62042
|
+
get size() {
|
|
62043
|
+
return this._patterns.size;
|
|
62044
|
+
}
|
|
62045
|
+
/**
|
|
62046
|
+
* Seal the set against further modifications.
|
|
62047
|
+
* Useful to prevent accidental mutations after config is built.
|
|
62048
|
+
* Calling add() or addAll() on a sealed set throws a TypeError.
|
|
62049
|
+
*
|
|
62050
|
+
* @returns {this}
|
|
62051
|
+
*/
|
|
62052
|
+
seal() {
|
|
62053
|
+
this._sealed = true;
|
|
62054
|
+
return this;
|
|
62055
|
+
}
|
|
62056
|
+
/**
|
|
62057
|
+
* Whether the set has been sealed.
|
|
62058
|
+
* @type {boolean}
|
|
62059
|
+
*/
|
|
62060
|
+
get isSealed() {
|
|
62061
|
+
return this._sealed;
|
|
62062
|
+
}
|
|
62063
|
+
/**
|
|
62064
|
+
* Test whether the matcher's current path matches any expression in the set.
|
|
62065
|
+
*
|
|
62066
|
+
* Evaluation order (cheapest → most expensive):
|
|
62067
|
+
* 1. Exact depth + tag bucket — O(1) lookup, typically 0–2 expressions
|
|
62068
|
+
* 2. Depth-only wildcard bucket — O(1) lookup, rare
|
|
62069
|
+
* 3. Deep-wildcard list — always checked, but usually small
|
|
62070
|
+
*
|
|
62071
|
+
* @param {import('./Matcher.js').default} matcher - Matcher instance (or readOnly view)
|
|
62072
|
+
* @returns {boolean} true if any expression matches the current path
|
|
62073
|
+
*
|
|
62074
|
+
* @example
|
|
62075
|
+
* if (stopNodes.matchesAny(matcher)) {
|
|
62076
|
+
* // handle stop node
|
|
62077
|
+
* }
|
|
62078
|
+
*/
|
|
62079
|
+
matchesAny(matcher) {
|
|
62080
|
+
return this.findMatch(matcher) !== null;
|
|
62081
|
+
}
|
|
62082
|
+
/**
|
|
62083
|
+
* Find and return the first Expression that matches the matcher's current path.
|
|
62084
|
+
*
|
|
62085
|
+
* Uses the same evaluation order as matchesAny (cheapest → most expensive):
|
|
62086
|
+
* 1. Exact depth + tag bucket
|
|
62087
|
+
* 2. Depth-only wildcard bucket
|
|
62088
|
+
* 3. Deep-wildcard list
|
|
62089
|
+
*
|
|
62090
|
+
* @param {import('./Matcher.js').default} matcher - Matcher instance (or readOnly view)
|
|
62091
|
+
* @returns {import('./Expression.js').default | null} the first matching Expression, or null
|
|
62092
|
+
*
|
|
62093
|
+
* @example
|
|
62094
|
+
* const expr = stopNodes.findMatch(matcher);
|
|
62095
|
+
* if (expr) {
|
|
62096
|
+
* // access expr.config, expr.pattern, etc.
|
|
62097
|
+
* }
|
|
62098
|
+
*/
|
|
62099
|
+
findMatch(matcher) {
|
|
62100
|
+
const depth = matcher.getDepth();
|
|
62101
|
+
const tag = matcher.getCurrentTag();
|
|
62102
|
+
const exactKey = `${depth}:${tag}`;
|
|
62103
|
+
const exactBucket = this._byDepthAndTag.get(exactKey);
|
|
62104
|
+
if (exactBucket) {
|
|
62105
|
+
for (let i4 = 0; i4 < exactBucket.length; i4++) {
|
|
62106
|
+
if (matcher.matches(exactBucket[i4]))
|
|
62107
|
+
return exactBucket[i4];
|
|
62108
|
+
}
|
|
62109
|
+
}
|
|
62110
|
+
const wildcardBucket = this._wildcardByDepth.get(depth);
|
|
62111
|
+
if (wildcardBucket) {
|
|
62112
|
+
for (let i4 = 0; i4 < wildcardBucket.length; i4++) {
|
|
62113
|
+
if (matcher.matches(wildcardBucket[i4]))
|
|
62114
|
+
return wildcardBucket[i4];
|
|
62115
|
+
}
|
|
62116
|
+
}
|
|
62117
|
+
for (let i4 = 0; i4 < this._deepWildcards.length; i4++) {
|
|
62118
|
+
if (matcher.matches(this._deepWildcards[i4]))
|
|
62119
|
+
return this._deepWildcards[i4];
|
|
62120
|
+
}
|
|
62121
|
+
return null;
|
|
62122
|
+
}
|
|
62123
|
+
};
|
|
62124
|
+
|
|
62125
|
+
// ../../node_modules/path-expression-matcher/src/Matcher.js
|
|
62126
|
+
var MUTATING_METHODS = /* @__PURE__ */ new Set(["push", "pop", "reset", "updateCurrent", "restore"]);
|
|
62127
|
+
var Matcher = class {
|
|
62128
|
+
/**
|
|
62129
|
+
* Create a new Matcher
|
|
62130
|
+
* @param {Object} options - Configuration options
|
|
62131
|
+
* @param {string} options.separator - Default path separator (default: '.')
|
|
62132
|
+
*/
|
|
62133
|
+
constructor(options = {}) {
|
|
62134
|
+
this.separator = options.separator || ".";
|
|
62135
|
+
this.path = [];
|
|
62136
|
+
this.siblingStacks = [];
|
|
62137
|
+
this._pathStringCache = null;
|
|
62138
|
+
this._frozenPathCache = null;
|
|
62139
|
+
this._frozenSiblingsCache = null;
|
|
62140
|
+
}
|
|
62141
|
+
/**
|
|
62142
|
+
* Push a new tag onto the path
|
|
62143
|
+
* @param {string} tagName - Name of the tag
|
|
62144
|
+
* @param {Object} attrValues - Attribute key-value pairs for current node (optional)
|
|
62145
|
+
* @param {string} namespace - Namespace for the tag (optional)
|
|
62146
|
+
*/
|
|
62147
|
+
push(tagName, attrValues = null, namespace = null) {
|
|
62148
|
+
this._pathStringCache = null;
|
|
62149
|
+
this._frozenPathCache = null;
|
|
62150
|
+
this._frozenSiblingsCache = null;
|
|
62151
|
+
if (this.path.length > 0) {
|
|
62152
|
+
const prev = this.path[this.path.length - 1];
|
|
62153
|
+
prev.values = void 0;
|
|
62154
|
+
}
|
|
62155
|
+
const currentLevel = this.path.length;
|
|
62156
|
+
if (!this.siblingStacks[currentLevel]) {
|
|
62157
|
+
this.siblingStacks[currentLevel] = /* @__PURE__ */ new Map();
|
|
62158
|
+
}
|
|
62159
|
+
const siblings = this.siblingStacks[currentLevel];
|
|
62160
|
+
const siblingKey = namespace ? `${namespace}:${tagName}` : tagName;
|
|
62161
|
+
const counter2 = siblings.get(siblingKey) || 0;
|
|
62162
|
+
let position = 0;
|
|
62163
|
+
for (const count3 of siblings.values()) {
|
|
62164
|
+
position += count3;
|
|
62165
|
+
}
|
|
62166
|
+
siblings.set(siblingKey, counter2 + 1);
|
|
62167
|
+
const node = {
|
|
62168
|
+
tag: tagName,
|
|
62169
|
+
position,
|
|
62170
|
+
counter: counter2
|
|
62171
|
+
};
|
|
62172
|
+
if (namespace !== null && namespace !== void 0) {
|
|
62173
|
+
node.namespace = namespace;
|
|
62174
|
+
}
|
|
62175
|
+
if (attrValues !== null && attrValues !== void 0) {
|
|
62176
|
+
node.values = attrValues;
|
|
62177
|
+
}
|
|
62178
|
+
this.path.push(node);
|
|
62179
|
+
}
|
|
62180
|
+
/**
|
|
62181
|
+
* Pop the last tag from the path
|
|
62182
|
+
* @returns {Object|undefined} The popped node
|
|
62183
|
+
*/
|
|
62184
|
+
pop() {
|
|
62185
|
+
if (this.path.length === 0)
|
|
62186
|
+
return void 0;
|
|
62187
|
+
this._pathStringCache = null;
|
|
62188
|
+
this._frozenPathCache = null;
|
|
62189
|
+
this._frozenSiblingsCache = null;
|
|
62190
|
+
const node = this.path.pop();
|
|
62191
|
+
if (this.siblingStacks.length > this.path.length + 1) {
|
|
62192
|
+
this.siblingStacks.length = this.path.length + 1;
|
|
62193
|
+
}
|
|
62194
|
+
return node;
|
|
62195
|
+
}
|
|
62196
|
+
/**
|
|
62197
|
+
* Update current node's attribute values
|
|
62198
|
+
* Useful when attributes are parsed after push
|
|
62199
|
+
* @param {Object} attrValues - Attribute values
|
|
62200
|
+
*/
|
|
62201
|
+
updateCurrent(attrValues) {
|
|
62202
|
+
if (this.path.length > 0) {
|
|
62203
|
+
const current = this.path[this.path.length - 1];
|
|
62204
|
+
if (attrValues !== null && attrValues !== void 0) {
|
|
62205
|
+
current.values = attrValues;
|
|
62206
|
+
this._frozenPathCache = null;
|
|
62207
|
+
}
|
|
62208
|
+
}
|
|
62209
|
+
}
|
|
62210
|
+
/**
|
|
62211
|
+
* Get current tag name
|
|
62212
|
+
* @returns {string|undefined}
|
|
62213
|
+
*/
|
|
62214
|
+
getCurrentTag() {
|
|
62215
|
+
return this.path.length > 0 ? this.path[this.path.length - 1].tag : void 0;
|
|
62216
|
+
}
|
|
62217
|
+
/**
|
|
62218
|
+
* Get current namespace
|
|
62219
|
+
* @returns {string|undefined}
|
|
62220
|
+
*/
|
|
62221
|
+
getCurrentNamespace() {
|
|
62222
|
+
return this.path.length > 0 ? this.path[this.path.length - 1].namespace : void 0;
|
|
62223
|
+
}
|
|
62224
|
+
/**
|
|
62225
|
+
* Get current node's attribute value
|
|
62226
|
+
* @param {string} attrName - Attribute name
|
|
62227
|
+
* @returns {*} Attribute value or undefined
|
|
62228
|
+
*/
|
|
62229
|
+
getAttrValue(attrName) {
|
|
62230
|
+
if (this.path.length === 0)
|
|
62231
|
+
return void 0;
|
|
62232
|
+
const current = this.path[this.path.length - 1];
|
|
62233
|
+
return current.values?.[attrName];
|
|
62234
|
+
}
|
|
62235
|
+
/**
|
|
62236
|
+
* Check if current node has an attribute
|
|
62237
|
+
* @param {string} attrName - Attribute name
|
|
62238
|
+
* @returns {boolean}
|
|
62239
|
+
*/
|
|
62240
|
+
hasAttr(attrName) {
|
|
62241
|
+
if (this.path.length === 0)
|
|
62242
|
+
return false;
|
|
62243
|
+
const current = this.path[this.path.length - 1];
|
|
62244
|
+
return current.values !== void 0 && attrName in current.values;
|
|
62245
|
+
}
|
|
62246
|
+
/**
|
|
62247
|
+
* Get current node's sibling position (child index in parent)
|
|
62248
|
+
* @returns {number}
|
|
62249
|
+
*/
|
|
62250
|
+
getPosition() {
|
|
62251
|
+
if (this.path.length === 0)
|
|
62252
|
+
return -1;
|
|
62253
|
+
return this.path[this.path.length - 1].position ?? 0;
|
|
62254
|
+
}
|
|
62255
|
+
/**
|
|
62256
|
+
* Get current node's repeat counter (occurrence count of this tag name)
|
|
62257
|
+
* @returns {number}
|
|
62258
|
+
*/
|
|
62259
|
+
getCounter() {
|
|
62260
|
+
if (this.path.length === 0)
|
|
62261
|
+
return -1;
|
|
62262
|
+
return this.path[this.path.length - 1].counter ?? 0;
|
|
62263
|
+
}
|
|
62264
|
+
/**
|
|
62265
|
+
* Get current node's sibling index (alias for getPosition for backward compatibility)
|
|
62266
|
+
* @returns {number}
|
|
62267
|
+
* @deprecated Use getPosition() or getCounter() instead
|
|
62268
|
+
*/
|
|
62269
|
+
getIndex() {
|
|
62270
|
+
return this.getPosition();
|
|
62271
|
+
}
|
|
62272
|
+
/**
|
|
62273
|
+
* Get current path depth
|
|
62274
|
+
* @returns {number}
|
|
62275
|
+
*/
|
|
62276
|
+
getDepth() {
|
|
62277
|
+
return this.path.length;
|
|
62278
|
+
}
|
|
62279
|
+
/**
|
|
62280
|
+
* Get path as string
|
|
62281
|
+
* @param {string} separator - Optional separator (uses default if not provided)
|
|
62282
|
+
* @param {boolean} includeNamespace - Whether to include namespace in output (default: true)
|
|
62283
|
+
* @returns {string}
|
|
62284
|
+
*/
|
|
62285
|
+
toString(separator, includeNamespace = true) {
|
|
62286
|
+
const sep = separator || this.separator;
|
|
62287
|
+
const isDefault = sep === this.separator && includeNamespace === true;
|
|
62288
|
+
if (isDefault) {
|
|
62289
|
+
if (this._pathStringCache !== null && this._pathStringCache !== void 0) {
|
|
62290
|
+
return this._pathStringCache;
|
|
62291
|
+
}
|
|
62292
|
+
const result = this.path.map(
|
|
62293
|
+
(n2) => includeNamespace && n2.namespace ? `${n2.namespace}:${n2.tag}` : n2.tag
|
|
62294
|
+
).join(sep);
|
|
62295
|
+
this._pathStringCache = result;
|
|
62296
|
+
return result;
|
|
62297
|
+
}
|
|
62298
|
+
return this.path.map(
|
|
62299
|
+
(n2) => includeNamespace && n2.namespace ? `${n2.namespace}:${n2.tag}` : n2.tag
|
|
62300
|
+
).join(sep);
|
|
62301
|
+
}
|
|
62302
|
+
/**
|
|
62303
|
+
* Get path as array of tag names
|
|
62304
|
+
* @returns {string[]}
|
|
62305
|
+
*/
|
|
62306
|
+
toArray() {
|
|
62307
|
+
return this.path.map((n2) => n2.tag);
|
|
62308
|
+
}
|
|
62309
|
+
/**
|
|
62310
|
+
* Reset the path to empty
|
|
62311
|
+
*/
|
|
62312
|
+
reset() {
|
|
62313
|
+
this._pathStringCache = null;
|
|
62314
|
+
this._frozenPathCache = null;
|
|
62315
|
+
this._frozenSiblingsCache = null;
|
|
62316
|
+
this.path = [];
|
|
62317
|
+
this.siblingStacks = [];
|
|
62318
|
+
}
|
|
62319
|
+
/**
|
|
62320
|
+
* Match current path against an Expression
|
|
62321
|
+
* @param {Expression} expression - The expression to match against
|
|
62322
|
+
* @returns {boolean} True if current path matches the expression
|
|
62323
|
+
*/
|
|
62324
|
+
matches(expression) {
|
|
62325
|
+
const segments = expression.segments;
|
|
62326
|
+
if (segments.length === 0) {
|
|
62327
|
+
return false;
|
|
62328
|
+
}
|
|
62329
|
+
if (expression.hasDeepWildcard()) {
|
|
62330
|
+
return this._matchWithDeepWildcard(segments);
|
|
62331
|
+
}
|
|
62332
|
+
return this._matchSimple(segments);
|
|
62333
|
+
}
|
|
62334
|
+
/**
|
|
62335
|
+
* Match simple path (no deep wildcards)
|
|
62336
|
+
* @private
|
|
62337
|
+
*/
|
|
62338
|
+
_matchSimple(segments) {
|
|
62339
|
+
if (this.path.length !== segments.length) {
|
|
62340
|
+
return false;
|
|
62341
|
+
}
|
|
62342
|
+
for (let i4 = 0; i4 < segments.length; i4++) {
|
|
62343
|
+
const segment = segments[i4];
|
|
62344
|
+
const node = this.path[i4];
|
|
62345
|
+
const isCurrentNode = i4 === this.path.length - 1;
|
|
62346
|
+
if (!this._matchSegment(segment, node, isCurrentNode)) {
|
|
62347
|
+
return false;
|
|
62348
|
+
}
|
|
62349
|
+
}
|
|
62350
|
+
return true;
|
|
62351
|
+
}
|
|
62352
|
+
/**
|
|
62353
|
+
* Match path with deep wildcards
|
|
62354
|
+
* @private
|
|
62355
|
+
*/
|
|
62356
|
+
_matchWithDeepWildcard(segments) {
|
|
62357
|
+
let pathIdx = this.path.length - 1;
|
|
62358
|
+
let segIdx = segments.length - 1;
|
|
62359
|
+
while (segIdx >= 0 && pathIdx >= 0) {
|
|
62360
|
+
const segment = segments[segIdx];
|
|
62361
|
+
if (segment.type === "deep-wildcard") {
|
|
62362
|
+
segIdx--;
|
|
62363
|
+
if (segIdx < 0) {
|
|
62364
|
+
return true;
|
|
62365
|
+
}
|
|
62366
|
+
const nextSeg = segments[segIdx];
|
|
62367
|
+
let found = false;
|
|
62368
|
+
for (let i4 = pathIdx; i4 >= 0; i4--) {
|
|
62369
|
+
const isCurrentNode = i4 === this.path.length - 1;
|
|
62370
|
+
if (this._matchSegment(nextSeg, this.path[i4], isCurrentNode)) {
|
|
62371
|
+
pathIdx = i4 - 1;
|
|
62372
|
+
segIdx--;
|
|
62373
|
+
found = true;
|
|
62374
|
+
break;
|
|
62375
|
+
}
|
|
62376
|
+
}
|
|
62377
|
+
if (!found) {
|
|
62378
|
+
return false;
|
|
62379
|
+
}
|
|
62380
|
+
} else {
|
|
62381
|
+
const isCurrentNode = pathIdx === this.path.length - 1;
|
|
62382
|
+
if (!this._matchSegment(segment, this.path[pathIdx], isCurrentNode)) {
|
|
62383
|
+
return false;
|
|
62384
|
+
}
|
|
62385
|
+
pathIdx--;
|
|
62386
|
+
segIdx--;
|
|
62387
|
+
}
|
|
62388
|
+
}
|
|
62389
|
+
return segIdx < 0;
|
|
62390
|
+
}
|
|
62391
|
+
/**
|
|
62392
|
+
* Match a single segment against a node
|
|
62393
|
+
* @private
|
|
62394
|
+
* @param {Object} segment - Segment from Expression
|
|
62395
|
+
* @param {Object} node - Node from path
|
|
62396
|
+
* @param {boolean} isCurrentNode - Whether this is the current (last) node
|
|
62397
|
+
* @returns {boolean}
|
|
62398
|
+
*/
|
|
62399
|
+
_matchSegment(segment, node, isCurrentNode) {
|
|
62400
|
+
if (segment.tag !== "*" && segment.tag !== node.tag) {
|
|
62401
|
+
return false;
|
|
62402
|
+
}
|
|
62403
|
+
if (segment.namespace !== void 0) {
|
|
62404
|
+
if (segment.namespace !== "*" && segment.namespace !== node.namespace) {
|
|
62405
|
+
return false;
|
|
62406
|
+
}
|
|
62407
|
+
}
|
|
62408
|
+
if (segment.attrName !== void 0) {
|
|
62409
|
+
if (!isCurrentNode) {
|
|
62410
|
+
return false;
|
|
62411
|
+
}
|
|
62412
|
+
if (!node.values || !(segment.attrName in node.values)) {
|
|
62413
|
+
return false;
|
|
62414
|
+
}
|
|
62415
|
+
if (segment.attrValue !== void 0) {
|
|
62416
|
+
const actualValue = node.values[segment.attrName];
|
|
62417
|
+
if (String(actualValue) !== String(segment.attrValue)) {
|
|
62418
|
+
return false;
|
|
62419
|
+
}
|
|
62420
|
+
}
|
|
62421
|
+
}
|
|
62422
|
+
if (segment.position !== void 0) {
|
|
62423
|
+
if (!isCurrentNode) {
|
|
62424
|
+
return false;
|
|
62425
|
+
}
|
|
62426
|
+
const counter2 = node.counter ?? 0;
|
|
62427
|
+
if (segment.position === "first" && counter2 !== 0) {
|
|
62428
|
+
return false;
|
|
62429
|
+
} else if (segment.position === "odd" && counter2 % 2 !== 1) {
|
|
62430
|
+
return false;
|
|
62431
|
+
} else if (segment.position === "even" && counter2 % 2 !== 0) {
|
|
62432
|
+
return false;
|
|
62433
|
+
} else if (segment.position === "nth") {
|
|
62434
|
+
if (counter2 !== segment.positionValue) {
|
|
62435
|
+
return false;
|
|
62436
|
+
}
|
|
62437
|
+
}
|
|
62438
|
+
}
|
|
62439
|
+
return true;
|
|
62440
|
+
}
|
|
62441
|
+
/**
|
|
62442
|
+
* Match any expression in the given set against the current path.
|
|
62443
|
+
* @param {ExpressionSet} exprSet - The set of expressions to match against.
|
|
62444
|
+
* @returns {boolean} - True if any expression in the set matches the current path, false otherwise.
|
|
62445
|
+
*/
|
|
62446
|
+
matchesAny(exprSet) {
|
|
62447
|
+
return exprSet.matchesAny(this);
|
|
62448
|
+
}
|
|
62449
|
+
/**
|
|
62450
|
+
* Create a snapshot of current state
|
|
62451
|
+
* @returns {Object} State snapshot
|
|
62452
|
+
*/
|
|
62453
|
+
snapshot() {
|
|
62454
|
+
return {
|
|
62455
|
+
path: this.path.map((node) => ({ ...node })),
|
|
62456
|
+
siblingStacks: this.siblingStacks.map((map3) => new Map(map3))
|
|
62457
|
+
};
|
|
62458
|
+
}
|
|
62459
|
+
/**
|
|
62460
|
+
* Restore state from snapshot
|
|
62461
|
+
* @param {Object} snapshot - State snapshot
|
|
62462
|
+
*/
|
|
62463
|
+
restore(snapshot) {
|
|
62464
|
+
this._pathStringCache = null;
|
|
62465
|
+
this._frozenPathCache = null;
|
|
62466
|
+
this._frozenSiblingsCache = null;
|
|
62467
|
+
this.path = snapshot.path.map((node) => ({ ...node }));
|
|
62468
|
+
this.siblingStacks = snapshot.siblingStacks.map((map3) => new Map(map3));
|
|
62469
|
+
}
|
|
62470
|
+
/**
|
|
62471
|
+
* Return a read-only view of this matcher.
|
|
62472
|
+
*
|
|
62473
|
+
* The returned object exposes all query/inspection methods but throws a
|
|
62474
|
+
* TypeError if any state-mutating method is called (`push`, `pop`, `reset`,
|
|
62475
|
+
* `updateCurrent`, `restore`). Property reads (e.g. `.path`, `.separator`)
|
|
62476
|
+
* are allowed but the returned arrays/objects are frozen so callers cannot
|
|
62477
|
+
* mutate internal state through them either.
|
|
62478
|
+
*
|
|
62479
|
+
* @returns {ReadOnlyMatcher} A proxy that forwards read operations and blocks writes.
|
|
62480
|
+
*
|
|
62481
|
+
* @example
|
|
62482
|
+
* const matcher = new Matcher();
|
|
62483
|
+
* matcher.push("root", {});
|
|
62484
|
+
*
|
|
62485
|
+
* const ro = matcher.readOnly();
|
|
62486
|
+
* ro.matches(expr); // ✓ works
|
|
62487
|
+
* ro.getCurrentTag(); // ✓ works
|
|
62488
|
+
* ro.push("child", {}); // ✗ throws TypeError
|
|
62489
|
+
* ro.reset(); // ✗ throws TypeError
|
|
62490
|
+
*/
|
|
62491
|
+
readOnly() {
|
|
62492
|
+
const self2 = this;
|
|
62493
|
+
return new Proxy(self2, {
|
|
62494
|
+
get(target2, prop, receiver) {
|
|
62495
|
+
if (MUTATING_METHODS.has(prop)) {
|
|
62496
|
+
return () => {
|
|
62497
|
+
throw new TypeError(
|
|
62498
|
+
`Cannot call '${prop}' on a read-only Matcher. Obtain a writable instance to mutate state.`
|
|
62499
|
+
);
|
|
62500
|
+
};
|
|
62501
|
+
}
|
|
62502
|
+
if (prop === "path") {
|
|
62503
|
+
if (target2._frozenPathCache === null) {
|
|
62504
|
+
target2._frozenPathCache = Object.freeze(
|
|
62505
|
+
target2.path.map((node) => Object.freeze({ ...node }))
|
|
62506
|
+
);
|
|
62507
|
+
}
|
|
62508
|
+
return target2._frozenPathCache;
|
|
62509
|
+
}
|
|
62510
|
+
if (prop === "siblingStacks") {
|
|
62511
|
+
if (target2._frozenSiblingsCache === null) {
|
|
62512
|
+
target2._frozenSiblingsCache = Object.freeze(
|
|
62513
|
+
target2.siblingStacks.map((map3) => Object.freeze(new Map(map3)))
|
|
62514
|
+
);
|
|
62515
|
+
}
|
|
62516
|
+
return target2._frozenSiblingsCache;
|
|
62517
|
+
}
|
|
62518
|
+
const value = Reflect.get(target2, prop, receiver);
|
|
62519
|
+
if (typeof value === "function") {
|
|
62520
|
+
return value.bind(target2);
|
|
62521
|
+
}
|
|
62522
|
+
return value;
|
|
62523
|
+
},
|
|
62524
|
+
// Prevent any property assignment on the read-only view
|
|
62525
|
+
set(_target, prop) {
|
|
62526
|
+
throw new TypeError(
|
|
62527
|
+
`Cannot set property '${String(prop)}' on a read-only Matcher.`
|
|
62528
|
+
);
|
|
62529
|
+
},
|
|
62530
|
+
// Prevent property deletion
|
|
62531
|
+
deleteProperty(_target, prop) {
|
|
62532
|
+
throw new TypeError(
|
|
62533
|
+
`Cannot delete property '${String(prop)}' from a read-only Matcher.`
|
|
62534
|
+
);
|
|
62535
|
+
}
|
|
62536
|
+
});
|
|
62537
|
+
}
|
|
62538
|
+
};
|
|
62539
|
+
|
|
61701
62540
|
// ../../node_modules/fast-xml-parser/src/xmlparser/OrderedObjParser.js
|
|
62541
|
+
function extractRawAttributes(prefixedAttrs, options) {
|
|
62542
|
+
if (!prefixedAttrs)
|
|
62543
|
+
return {};
|
|
62544
|
+
const attrs = options.attributesGroupName ? prefixedAttrs[options.attributesGroupName] : prefixedAttrs;
|
|
62545
|
+
if (!attrs)
|
|
62546
|
+
return {};
|
|
62547
|
+
const rawAttrs = {};
|
|
62548
|
+
for (const key in attrs) {
|
|
62549
|
+
if (key.startsWith(options.attributeNamePrefix)) {
|
|
62550
|
+
const rawName = key.substring(options.attributeNamePrefix.length);
|
|
62551
|
+
rawAttrs[rawName] = attrs[key];
|
|
62552
|
+
} else {
|
|
62553
|
+
rawAttrs[key] = attrs[key];
|
|
62554
|
+
}
|
|
62555
|
+
}
|
|
62556
|
+
return rawAttrs;
|
|
62557
|
+
}
|
|
62558
|
+
function extractNamespace(rawTagName) {
|
|
62559
|
+
if (!rawTagName || typeof rawTagName !== "string")
|
|
62560
|
+
return void 0;
|
|
62561
|
+
const colonIndex = rawTagName.indexOf(":");
|
|
62562
|
+
if (colonIndex !== -1 && colonIndex > 0) {
|
|
62563
|
+
const ns = rawTagName.substring(0, colonIndex);
|
|
62564
|
+
if (ns !== "xmlns") {
|
|
62565
|
+
return ns;
|
|
62566
|
+
}
|
|
62567
|
+
}
|
|
62568
|
+
return void 0;
|
|
62569
|
+
}
|
|
61702
62570
|
var OrderedObjParser = class {
|
|
61703
62571
|
constructor(options) {
|
|
61704
62572
|
this.options = options;
|
|
@@ -61742,19 +62610,21 @@ void main(void) {
|
|
|
61742
62610
|
this.ignoreAttributesFn = getIgnoreAttributesFn(this.options.ignoreAttributes);
|
|
61743
62611
|
this.entityExpansionCount = 0;
|
|
61744
62612
|
this.currentExpandedLength = 0;
|
|
61745
|
-
|
|
61746
|
-
|
|
61747
|
-
|
|
61748
|
-
|
|
61749
|
-
|
|
61750
|
-
|
|
61751
|
-
|
|
61752
|
-
|
|
61753
|
-
|
|
61754
|
-
|
|
61755
|
-
|
|
62613
|
+
this.matcher = new Matcher();
|
|
62614
|
+
this.readonlyMatcher = this.matcher.readOnly();
|
|
62615
|
+
this.isCurrentNodeStopNode = false;
|
|
62616
|
+
this.stopNodeExpressionsSet = new ExpressionSet();
|
|
62617
|
+
const stopNodesOpts = this.options.stopNodes;
|
|
62618
|
+
if (stopNodesOpts && stopNodesOpts.length > 0) {
|
|
62619
|
+
for (let i4 = 0; i4 < stopNodesOpts.length; i4++) {
|
|
62620
|
+
const stopNodeExp = stopNodesOpts[i4];
|
|
62621
|
+
if (typeof stopNodeExp === "string") {
|
|
62622
|
+
this.stopNodeExpressionsSet.add(new Expression(stopNodeExp));
|
|
62623
|
+
} else if (stopNodeExp instanceof Expression) {
|
|
62624
|
+
this.stopNodeExpressionsSet.add(stopNodeExp);
|
|
61756
62625
|
}
|
|
61757
62626
|
}
|
|
62627
|
+
this.stopNodeExpressionsSet.seal();
|
|
61758
62628
|
}
|
|
61759
62629
|
}
|
|
61760
62630
|
};
|
|
@@ -61770,24 +62640,26 @@ void main(void) {
|
|
|
61770
62640
|
}
|
|
61771
62641
|
}
|
|
61772
62642
|
function parseTextData(val, tagName, jPath, dontTrim, hasAttributes, isLeafNode, escapeEntities) {
|
|
62643
|
+
const options = this.options;
|
|
61773
62644
|
if (val !== void 0) {
|
|
61774
|
-
if (
|
|
62645
|
+
if (options.trimValues && !dontTrim) {
|
|
61775
62646
|
val = val.trim();
|
|
61776
62647
|
}
|
|
61777
62648
|
if (val.length > 0) {
|
|
61778
62649
|
if (!escapeEntities)
|
|
61779
62650
|
val = this.replaceEntitiesValue(val, tagName, jPath);
|
|
61780
|
-
const
|
|
62651
|
+
const jPathOrMatcher = options.jPath ? jPath.toString() : jPath;
|
|
62652
|
+
const newval = options.tagValueProcessor(tagName, val, jPathOrMatcher, hasAttributes, isLeafNode);
|
|
61781
62653
|
if (newval === null || newval === void 0) {
|
|
61782
62654
|
return val;
|
|
61783
62655
|
} else if (typeof newval !== typeof val || newval !== val) {
|
|
61784
62656
|
return newval;
|
|
61785
|
-
} else if (
|
|
61786
|
-
return parseValue(val,
|
|
62657
|
+
} else if (options.trimValues) {
|
|
62658
|
+
return parseValue(val, options.parseTagValue, options.numberParseOptions);
|
|
61787
62659
|
} else {
|
|
61788
62660
|
const trimmedVal = val.trim();
|
|
61789
62661
|
if (trimmedVal === val) {
|
|
61790
|
-
return parseValue(val,
|
|
62662
|
+
return parseValue(val, options.parseTagValue, options.numberParseOptions);
|
|
61791
62663
|
} else {
|
|
61792
62664
|
return val;
|
|
61793
62665
|
}
|
|
@@ -61810,51 +62682,64 @@ void main(void) {
|
|
|
61810
62682
|
}
|
|
61811
62683
|
var attrsRegx = new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`, "gm");
|
|
61812
62684
|
function buildAttributesMap(attrStr, jPath, tagName) {
|
|
61813
|
-
|
|
62685
|
+
const options = this.options;
|
|
62686
|
+
if (options.ignoreAttributes !== true && typeof attrStr === "string") {
|
|
61814
62687
|
const matches3 = getAllMatches(attrStr, attrsRegx);
|
|
61815
62688
|
const len5 = matches3.length;
|
|
61816
62689
|
const attrs = {};
|
|
62690
|
+
const processedVals = new Array(len5);
|
|
62691
|
+
let hasRawAttrs = false;
|
|
62692
|
+
const rawAttrsForMatcher = {};
|
|
61817
62693
|
for (let i4 = 0; i4 < len5; i4++) {
|
|
61818
62694
|
const attrName = this.resolveNameSpace(matches3[i4][1]);
|
|
61819
|
-
|
|
62695
|
+
const oldVal = matches3[i4][4];
|
|
62696
|
+
if (attrName.length && oldVal !== void 0) {
|
|
62697
|
+
let val = oldVal;
|
|
62698
|
+
if (options.trimValues)
|
|
62699
|
+
val = val.trim();
|
|
62700
|
+
val = this.replaceEntitiesValue(val, tagName, this.readonlyMatcher);
|
|
62701
|
+
processedVals[i4] = val;
|
|
62702
|
+
rawAttrsForMatcher[attrName] = val;
|
|
62703
|
+
hasRawAttrs = true;
|
|
62704
|
+
}
|
|
62705
|
+
}
|
|
62706
|
+
if (hasRawAttrs && typeof jPath === "object" && jPath.updateCurrent) {
|
|
62707
|
+
jPath.updateCurrent(rawAttrsForMatcher);
|
|
62708
|
+
}
|
|
62709
|
+
const jPathStr = options.jPath ? jPath.toString() : this.readonlyMatcher;
|
|
62710
|
+
let hasAttrs = false;
|
|
62711
|
+
for (let i4 = 0; i4 < len5; i4++) {
|
|
62712
|
+
const attrName = this.resolveNameSpace(matches3[i4][1]);
|
|
62713
|
+
if (this.ignoreAttributesFn(attrName, jPathStr))
|
|
61820
62714
|
continue;
|
|
61821
|
-
|
|
61822
|
-
let oldVal = matches3[i4][4];
|
|
61823
|
-
let aName = this.options.attributeNamePrefix + attrName;
|
|
62715
|
+
let aName = options.attributeNamePrefix + attrName;
|
|
61824
62716
|
if (attrName.length) {
|
|
61825
|
-
if (
|
|
61826
|
-
aName =
|
|
61827
|
-
}
|
|
61828
|
-
|
|
61829
|
-
|
|
61830
|
-
|
|
61831
|
-
|
|
61832
|
-
oldVal = oldVal.trim();
|
|
61833
|
-
}
|
|
61834
|
-
oldVal = this.replaceEntitiesValue(oldVal, tagName, jPath);
|
|
61835
|
-
const newVal = this.options.attributeValueProcessor(attrName, oldVal, jPath);
|
|
62717
|
+
if (options.transformAttributeName) {
|
|
62718
|
+
aName = options.transformAttributeName(aName);
|
|
62719
|
+
}
|
|
62720
|
+
aName = sanitizeName(aName, options);
|
|
62721
|
+
if (matches3[i4][4] !== void 0) {
|
|
62722
|
+
const oldVal = processedVals[i4];
|
|
62723
|
+
const newVal = options.attributeValueProcessor(attrName, oldVal, jPathStr);
|
|
61836
62724
|
if (newVal === null || newVal === void 0) {
|
|
61837
62725
|
attrs[aName] = oldVal;
|
|
61838
62726
|
} else if (typeof newVal !== typeof oldVal || newVal !== oldVal) {
|
|
61839
62727
|
attrs[aName] = newVal;
|
|
61840
62728
|
} else {
|
|
61841
|
-
attrs[aName] = parseValue(
|
|
61842
|
-
oldVal,
|
|
61843
|
-
this.options.parseAttributeValue,
|
|
61844
|
-
this.options.numberParseOptions
|
|
61845
|
-
);
|
|
62729
|
+
attrs[aName] = parseValue(oldVal, options.parseAttributeValue, options.numberParseOptions);
|
|
61846
62730
|
}
|
|
61847
|
-
|
|
62731
|
+
hasAttrs = true;
|
|
62732
|
+
} else if (options.allowBooleanAttributes) {
|
|
61848
62733
|
attrs[aName] = true;
|
|
62734
|
+
hasAttrs = true;
|
|
61849
62735
|
}
|
|
61850
62736
|
}
|
|
61851
62737
|
}
|
|
61852
|
-
if (!
|
|
62738
|
+
if (!hasAttrs)
|
|
61853
62739
|
return;
|
|
61854
|
-
|
|
61855
|
-
if (this.options.attributesGroupName) {
|
|
62740
|
+
if (options.attributesGroupName) {
|
|
61856
62741
|
const attrCollection = {};
|
|
61857
|
-
attrCollection[
|
|
62742
|
+
attrCollection[options.attributesGroupName] = attrs;
|
|
61858
62743
|
return attrCollection;
|
|
61859
62744
|
}
|
|
61860
62745
|
return attrs;
|
|
@@ -61865,123 +62750,144 @@ void main(void) {
|
|
|
61865
62750
|
const xmlObj = new XmlNode("!xml");
|
|
61866
62751
|
let currentNode = xmlObj;
|
|
61867
62752
|
let textData = "";
|
|
61868
|
-
|
|
62753
|
+
this.matcher.reset();
|
|
61869
62754
|
this.entityExpansionCount = 0;
|
|
61870
62755
|
this.currentExpandedLength = 0;
|
|
61871
|
-
|
|
61872
|
-
|
|
62756
|
+
this.docTypeEntitiesKeys = [];
|
|
62757
|
+
this.lastEntitiesKeys = Object.keys(this.lastEntities);
|
|
62758
|
+
this.htmlEntitiesKeys = this.options.htmlEntities ? Object.keys(this.htmlEntities) : [];
|
|
62759
|
+
const options = this.options;
|
|
62760
|
+
const docTypeReader = new DocTypeReader(options.processEntities);
|
|
62761
|
+
const xmlLen = xmlData.length;
|
|
62762
|
+
for (let i4 = 0; i4 < xmlLen; i4++) {
|
|
61873
62763
|
const ch = xmlData[i4];
|
|
61874
62764
|
if (ch === "<") {
|
|
61875
|
-
|
|
62765
|
+
const c1 = xmlData.charCodeAt(i4 + 1);
|
|
62766
|
+
if (c1 === 47) {
|
|
61876
62767
|
const closeIndex = findClosingIndex(xmlData, ">", i4, "Closing Tag is not closed.");
|
|
61877
62768
|
let tagName = xmlData.substring(i4 + 2, closeIndex).trim();
|
|
61878
|
-
if (
|
|
62769
|
+
if (options.removeNSPrefix) {
|
|
61879
62770
|
const colonIndex = tagName.indexOf(":");
|
|
61880
62771
|
if (colonIndex !== -1) {
|
|
61881
62772
|
tagName = tagName.substr(colonIndex + 1);
|
|
61882
62773
|
}
|
|
61883
62774
|
}
|
|
61884
|
-
|
|
61885
|
-
tagName = this.options.transformTagName(tagName);
|
|
61886
|
-
}
|
|
62775
|
+
tagName = transformTagName(options.transformTagName, tagName, "", options).tagName;
|
|
61887
62776
|
if (currentNode) {
|
|
61888
|
-
textData = this.saveTextToParentTag(textData, currentNode,
|
|
62777
|
+
textData = this.saveTextToParentTag(textData, currentNode, this.readonlyMatcher);
|
|
61889
62778
|
}
|
|
61890
|
-
const lastTagName =
|
|
61891
|
-
if (tagName &&
|
|
62779
|
+
const lastTagName = this.matcher.getCurrentTag();
|
|
62780
|
+
if (tagName && options.unpairedTagsSet.has(tagName)) {
|
|
61892
62781
|
throw new Error(`Unpaired tag can not be used as closing tag: </${tagName}>`);
|
|
61893
62782
|
}
|
|
61894
|
-
|
|
61895
|
-
|
|
61896
|
-
propIndex = jPath.lastIndexOf(".", jPath.lastIndexOf(".") - 1);
|
|
62783
|
+
if (lastTagName && options.unpairedTagsSet.has(lastTagName)) {
|
|
62784
|
+
this.matcher.pop();
|
|
61897
62785
|
this.tagsNodeStack.pop();
|
|
61898
|
-
} else {
|
|
61899
|
-
propIndex = jPath.lastIndexOf(".");
|
|
61900
62786
|
}
|
|
61901
|
-
|
|
62787
|
+
this.matcher.pop();
|
|
62788
|
+
this.isCurrentNodeStopNode = false;
|
|
61902
62789
|
currentNode = this.tagsNodeStack.pop();
|
|
61903
62790
|
textData = "";
|
|
61904
62791
|
i4 = closeIndex;
|
|
61905
|
-
} else if (
|
|
62792
|
+
} else if (c1 === 63) {
|
|
61906
62793
|
let tagData = readTagExp(xmlData, i4, false, "?>");
|
|
61907
62794
|
if (!tagData)
|
|
61908
62795
|
throw new Error("Pi Tag is not closed.");
|
|
61909
|
-
textData = this.saveTextToParentTag(textData, currentNode,
|
|
61910
|
-
if (
|
|
62796
|
+
textData = this.saveTextToParentTag(textData, currentNode, this.readonlyMatcher);
|
|
62797
|
+
if (options.ignoreDeclaration && tagData.tagName === "?xml" || options.ignorePiTags) {
|
|
61911
62798
|
} else {
|
|
61912
62799
|
const childNode = new XmlNode(tagData.tagName);
|
|
61913
|
-
childNode.add(
|
|
62800
|
+
childNode.add(options.textNodeName, "");
|
|
61914
62801
|
if (tagData.tagName !== tagData.tagExp && tagData.attrExpPresent) {
|
|
61915
|
-
childNode[":@"] = this.buildAttributesMap(tagData.tagExp,
|
|
62802
|
+
childNode[":@"] = this.buildAttributesMap(tagData.tagExp, this.matcher, tagData.tagName);
|
|
61916
62803
|
}
|
|
61917
|
-
this.addChild(currentNode, childNode,
|
|
62804
|
+
this.addChild(currentNode, childNode, this.readonlyMatcher, i4);
|
|
61918
62805
|
}
|
|
61919
62806
|
i4 = tagData.closeIndex + 1;
|
|
61920
|
-
} else if (xmlData.
|
|
62807
|
+
} else if (c1 === 33 && xmlData.charCodeAt(i4 + 2) === 45 && xmlData.charCodeAt(i4 + 3) === 45) {
|
|
61921
62808
|
const endIndex = findClosingIndex(xmlData, "-->", i4 + 4, "Comment is not closed.");
|
|
61922
|
-
if (
|
|
62809
|
+
if (options.commentPropName) {
|
|
61923
62810
|
const comment = xmlData.substring(i4 + 4, endIndex - 2);
|
|
61924
|
-
textData = this.saveTextToParentTag(textData, currentNode,
|
|
61925
|
-
currentNode.add(
|
|
62811
|
+
textData = this.saveTextToParentTag(textData, currentNode, this.readonlyMatcher);
|
|
62812
|
+
currentNode.add(options.commentPropName, [{ [options.textNodeName]: comment }]);
|
|
61926
62813
|
}
|
|
61927
62814
|
i4 = endIndex;
|
|
61928
|
-
} else if (xmlData.
|
|
62815
|
+
} else if (c1 === 33 && xmlData.charCodeAt(i4 + 2) === 68) {
|
|
61929
62816
|
const result = docTypeReader.readDocType(xmlData, i4);
|
|
61930
62817
|
this.docTypeEntities = result.entities;
|
|
62818
|
+
this.docTypeEntitiesKeys = Object.keys(this.docTypeEntities) || [];
|
|
61931
62819
|
i4 = result.i;
|
|
61932
|
-
} else if (xmlData.
|
|
62820
|
+
} else if (c1 === 33 && xmlData.charCodeAt(i4 + 2) === 91) {
|
|
61933
62821
|
const closeIndex = findClosingIndex(xmlData, "]]>", i4, "CDATA is not closed.") - 2;
|
|
61934
62822
|
const tagExp = xmlData.substring(i4 + 9, closeIndex);
|
|
61935
|
-
textData = this.saveTextToParentTag(textData, currentNode,
|
|
61936
|
-
let val = this.parseTextData(tagExp, currentNode.tagname,
|
|
62823
|
+
textData = this.saveTextToParentTag(textData, currentNode, this.readonlyMatcher);
|
|
62824
|
+
let val = this.parseTextData(tagExp, currentNode.tagname, this.readonlyMatcher, true, false, true, true);
|
|
61937
62825
|
if (val == void 0)
|
|
61938
62826
|
val = "";
|
|
61939
|
-
if (
|
|
61940
|
-
currentNode.add(
|
|
62827
|
+
if (options.cdataPropName) {
|
|
62828
|
+
currentNode.add(options.cdataPropName, [{ [options.textNodeName]: tagExp }]);
|
|
61941
62829
|
} else {
|
|
61942
|
-
currentNode.add(
|
|
62830
|
+
currentNode.add(options.textNodeName, val);
|
|
61943
62831
|
}
|
|
61944
62832
|
i4 = closeIndex + 2;
|
|
61945
62833
|
} else {
|
|
61946
|
-
let result = readTagExp(xmlData, i4,
|
|
62834
|
+
let result = readTagExp(xmlData, i4, options.removeNSPrefix);
|
|
62835
|
+
if (!result) {
|
|
62836
|
+
const context = xmlData.substring(Math.max(0, i4 - 50), Math.min(xmlLen, i4 + 50));
|
|
62837
|
+
throw new Error(`readTagExp returned undefined at position ${i4}. Context: "${context}"`);
|
|
62838
|
+
}
|
|
61947
62839
|
let tagName = result.tagName;
|
|
61948
62840
|
const rawTagName = result.rawTagName;
|
|
61949
62841
|
let tagExp = result.tagExp;
|
|
61950
62842
|
let attrExpPresent = result.attrExpPresent;
|
|
61951
62843
|
let closeIndex = result.closeIndex;
|
|
61952
|
-
|
|
61953
|
-
|
|
61954
|
-
|
|
61955
|
-
tagExp = newTagName;
|
|
61956
|
-
}
|
|
61957
|
-
tagName = newTagName;
|
|
62844
|
+
({ tagName, tagExp } = transformTagName(options.transformTagName, tagName, tagExp, options));
|
|
62845
|
+
if (options.strictReservedNames && (tagName === options.commentPropName || tagName === options.cdataPropName || tagName === options.textNodeName || tagName === options.attributesGroupName)) {
|
|
62846
|
+
throw new Error(`Invalid tag name: ${tagName}`);
|
|
61958
62847
|
}
|
|
61959
62848
|
if (currentNode && textData) {
|
|
61960
62849
|
if (currentNode.tagname !== "!xml") {
|
|
61961
|
-
textData = this.saveTextToParentTag(textData, currentNode,
|
|
62850
|
+
textData = this.saveTextToParentTag(textData, currentNode, this.readonlyMatcher, false);
|
|
61962
62851
|
}
|
|
61963
62852
|
}
|
|
61964
62853
|
const lastTag = currentNode;
|
|
61965
|
-
if (lastTag &&
|
|
62854
|
+
if (lastTag && options.unpairedTagsSet.has(lastTag.tagname)) {
|
|
61966
62855
|
currentNode = this.tagsNodeStack.pop();
|
|
61967
|
-
|
|
62856
|
+
this.matcher.pop();
|
|
62857
|
+
}
|
|
62858
|
+
let isSelfClosing = false;
|
|
62859
|
+
if (tagExp.length > 0 && tagExp.lastIndexOf("/") === tagExp.length - 1) {
|
|
62860
|
+
isSelfClosing = true;
|
|
62861
|
+
if (tagName[tagName.length - 1] === "/") {
|
|
62862
|
+
tagName = tagName.substr(0, tagName.length - 1);
|
|
62863
|
+
tagExp = tagName;
|
|
62864
|
+
} else {
|
|
62865
|
+
tagExp = tagExp.substr(0, tagExp.length - 1);
|
|
62866
|
+
}
|
|
62867
|
+
attrExpPresent = tagName !== tagExp;
|
|
61968
62868
|
}
|
|
62869
|
+
let prefixedAttrs = null;
|
|
62870
|
+
let rawAttrs = {};
|
|
62871
|
+
let namespace = void 0;
|
|
62872
|
+
namespace = extractNamespace(rawTagName);
|
|
61969
62873
|
if (tagName !== xmlObj.tagname) {
|
|
61970
|
-
|
|
62874
|
+
this.matcher.push(tagName, {}, namespace);
|
|
62875
|
+
}
|
|
62876
|
+
if (tagName !== tagExp && attrExpPresent) {
|
|
62877
|
+
prefixedAttrs = this.buildAttributesMap(tagExp, this.matcher, tagName);
|
|
62878
|
+
if (prefixedAttrs) {
|
|
62879
|
+
rawAttrs = extractRawAttributes(prefixedAttrs, options);
|
|
62880
|
+
}
|
|
62881
|
+
}
|
|
62882
|
+
if (tagName !== xmlObj.tagname) {
|
|
62883
|
+
this.isCurrentNodeStopNode = this.isItStopNode();
|
|
61971
62884
|
}
|
|
61972
62885
|
const startIndex = i4;
|
|
61973
|
-
if (this.
|
|
62886
|
+
if (this.isCurrentNodeStopNode) {
|
|
61974
62887
|
let tagContent = "";
|
|
61975
|
-
if (
|
|
61976
|
-
if (tagName[tagName.length - 1] === "/") {
|
|
61977
|
-
tagName = tagName.substr(0, tagName.length - 1);
|
|
61978
|
-
jPath = jPath.substr(0, jPath.length - 1);
|
|
61979
|
-
tagExp = tagName;
|
|
61980
|
-
} else {
|
|
61981
|
-
tagExp = tagExp.substr(0, tagExp.length - 1);
|
|
61982
|
-
}
|
|
62888
|
+
if (isSelfClosing) {
|
|
61983
62889
|
i4 = result.closeIndex;
|
|
61984
|
-
} else if (
|
|
62890
|
+
} else if (options.unpairedTagsSet.has(tagName)) {
|
|
61985
62891
|
i4 = result.closeIndex;
|
|
61986
62892
|
} else {
|
|
61987
62893
|
const result2 = this.readStopNodeData(xmlData, rawTagName, closeIndex + 1);
|
|
@@ -61991,44 +62897,43 @@ void main(void) {
|
|
|
61991
62897
|
tagContent = result2.tagContent;
|
|
61992
62898
|
}
|
|
61993
62899
|
const childNode = new XmlNode(tagName);
|
|
61994
|
-
if (
|
|
61995
|
-
childNode[":@"] =
|
|
61996
|
-
}
|
|
61997
|
-
if (tagContent) {
|
|
61998
|
-
tagContent = this.parseTextData(tagContent, tagName, jPath, true, attrExpPresent, true, true);
|
|
62900
|
+
if (prefixedAttrs) {
|
|
62901
|
+
childNode[":@"] = prefixedAttrs;
|
|
61999
62902
|
}
|
|
62000
|
-
|
|
62001
|
-
|
|
62002
|
-
this.
|
|
62903
|
+
childNode.add(options.textNodeName, tagContent);
|
|
62904
|
+
this.matcher.pop();
|
|
62905
|
+
this.isCurrentNodeStopNode = false;
|
|
62906
|
+
this.addChild(currentNode, childNode, this.readonlyMatcher, startIndex);
|
|
62003
62907
|
} else {
|
|
62004
|
-
if (
|
|
62005
|
-
|
|
62006
|
-
|
|
62007
|
-
|
|
62008
|
-
|
|
62009
|
-
} else {
|
|
62010
|
-
tagExp = tagExp.substr(0, tagExp.length - 1);
|
|
62011
|
-
}
|
|
62012
|
-
if (this.options.transformTagName) {
|
|
62013
|
-
const newTagName = this.options.transformTagName(tagName);
|
|
62014
|
-
if (tagExp === tagName) {
|
|
62015
|
-
tagExp = newTagName;
|
|
62016
|
-
}
|
|
62017
|
-
tagName = newTagName;
|
|
62908
|
+
if (isSelfClosing) {
|
|
62909
|
+
({ tagName, tagExp } = transformTagName(options.transformTagName, tagName, tagExp, options));
|
|
62910
|
+
const childNode = new XmlNode(tagName);
|
|
62911
|
+
if (prefixedAttrs) {
|
|
62912
|
+
childNode[":@"] = prefixedAttrs;
|
|
62018
62913
|
}
|
|
62914
|
+
this.addChild(currentNode, childNode, this.readonlyMatcher, startIndex);
|
|
62915
|
+
this.matcher.pop();
|
|
62916
|
+
this.isCurrentNodeStopNode = false;
|
|
62917
|
+
} else if (options.unpairedTagsSet.has(tagName)) {
|
|
62019
62918
|
const childNode = new XmlNode(tagName);
|
|
62020
|
-
if (
|
|
62021
|
-
childNode[":@"] =
|
|
62919
|
+
if (prefixedAttrs) {
|
|
62920
|
+
childNode[":@"] = prefixedAttrs;
|
|
62022
62921
|
}
|
|
62023
|
-
this.addChild(currentNode, childNode,
|
|
62024
|
-
|
|
62922
|
+
this.addChild(currentNode, childNode, this.readonlyMatcher, startIndex);
|
|
62923
|
+
this.matcher.pop();
|
|
62924
|
+
this.isCurrentNodeStopNode = false;
|
|
62925
|
+
i4 = result.closeIndex;
|
|
62926
|
+
continue;
|
|
62025
62927
|
} else {
|
|
62026
62928
|
const childNode = new XmlNode(tagName);
|
|
62929
|
+
if (this.tagsNodeStack.length > options.maxNestedTags) {
|
|
62930
|
+
throw new Error("Maximum nested tags exceeded");
|
|
62931
|
+
}
|
|
62027
62932
|
this.tagsNodeStack.push(currentNode);
|
|
62028
|
-
if (
|
|
62029
|
-
childNode[":@"] =
|
|
62933
|
+
if (prefixedAttrs) {
|
|
62934
|
+
childNode[":@"] = prefixedAttrs;
|
|
62030
62935
|
}
|
|
62031
|
-
this.addChild(currentNode, childNode,
|
|
62936
|
+
this.addChild(currentNode, childNode, this.readonlyMatcher, startIndex);
|
|
62032
62937
|
currentNode = childNode;
|
|
62033
62938
|
}
|
|
62034
62939
|
textData = "";
|
|
@@ -62041,10 +62946,11 @@ void main(void) {
|
|
|
62041
62946
|
}
|
|
62042
62947
|
return xmlObj.child;
|
|
62043
62948
|
};
|
|
62044
|
-
function addChild(currentNode, childNode,
|
|
62949
|
+
function addChild(currentNode, childNode, matcher, startIndex) {
|
|
62045
62950
|
if (!this.options.captureMetaData)
|
|
62046
62951
|
startIndex = void 0;
|
|
62047
|
-
const
|
|
62952
|
+
const jPathOrMatcher = this.options.jPath ? matcher.toString() : matcher;
|
|
62953
|
+
const result = this.options.updateTag(childNode.tagname, jPathOrMatcher, childNode[":@"]);
|
|
62048
62954
|
if (result === false) {
|
|
62049
62955
|
} else if (typeof result === "string") {
|
|
62050
62956
|
childNode.tagname = result;
|
|
@@ -62053,25 +62959,25 @@ void main(void) {
|
|
|
62053
62959
|
currentNode.addChild(childNode, startIndex);
|
|
62054
62960
|
}
|
|
62055
62961
|
}
|
|
62056
|
-
|
|
62057
|
-
if (val.indexOf("&") === -1) {
|
|
62058
|
-
return val;
|
|
62059
|
-
}
|
|
62962
|
+
function replaceEntitiesValue(val, tagName, jPath) {
|
|
62060
62963
|
const entityConfig = this.options.processEntities;
|
|
62061
|
-
if (!entityConfig.enabled) {
|
|
62964
|
+
if (!entityConfig || !entityConfig.enabled) {
|
|
62062
62965
|
return val;
|
|
62063
62966
|
}
|
|
62064
62967
|
if (entityConfig.allowedTags) {
|
|
62065
|
-
|
|
62968
|
+
const jPathOrMatcher = this.options.jPath ? jPath.toString() : jPath;
|
|
62969
|
+
const allowed = Array.isArray(entityConfig.allowedTags) ? entityConfig.allowedTags.includes(tagName) : entityConfig.allowedTags(tagName, jPathOrMatcher);
|
|
62970
|
+
if (!allowed) {
|
|
62066
62971
|
return val;
|
|
62067
62972
|
}
|
|
62068
62973
|
}
|
|
62069
62974
|
if (entityConfig.tagFilter) {
|
|
62070
|
-
|
|
62975
|
+
const jPathOrMatcher = this.options.jPath ? jPath.toString() : jPath;
|
|
62976
|
+
if (!entityConfig.tagFilter(tagName, jPathOrMatcher)) {
|
|
62071
62977
|
return val;
|
|
62072
62978
|
}
|
|
62073
62979
|
}
|
|
62074
|
-
for (
|
|
62980
|
+
for (const entityName of this.docTypeEntitiesKeys) {
|
|
62075
62981
|
const entity = this.docTypeEntities[entityName];
|
|
62076
62982
|
const matches3 = val.match(entity.regx);
|
|
62077
62983
|
if (matches3) {
|
|
@@ -62095,74 +63001,86 @@ void main(void) {
|
|
|
62095
63001
|
}
|
|
62096
63002
|
if (val.indexOf("&") === -1)
|
|
62097
63003
|
return val;
|
|
62098
|
-
for (
|
|
63004
|
+
for (const entityName of this.lastEntitiesKeys) {
|
|
62099
63005
|
const entity = this.lastEntities[entityName];
|
|
63006
|
+
const matches3 = val.match(entity.regex);
|
|
63007
|
+
if (matches3) {
|
|
63008
|
+
this.entityExpansionCount += matches3.length;
|
|
63009
|
+
if (entityConfig.maxTotalExpansions && this.entityExpansionCount > entityConfig.maxTotalExpansions) {
|
|
63010
|
+
throw new Error(
|
|
63011
|
+
`Entity expansion limit exceeded: ${this.entityExpansionCount} > ${entityConfig.maxTotalExpansions}`
|
|
63012
|
+
);
|
|
63013
|
+
}
|
|
63014
|
+
}
|
|
62100
63015
|
val = val.replace(entity.regex, entity.val);
|
|
62101
63016
|
}
|
|
62102
63017
|
if (val.indexOf("&") === -1)
|
|
62103
63018
|
return val;
|
|
62104
|
-
|
|
62105
|
-
|
|
62106
|
-
|
|
62107
|
-
|
|
63019
|
+
for (const entityName of this.htmlEntitiesKeys) {
|
|
63020
|
+
const entity = this.htmlEntities[entityName];
|
|
63021
|
+
const matches3 = val.match(entity.regex);
|
|
63022
|
+
if (matches3) {
|
|
63023
|
+
this.entityExpansionCount += matches3.length;
|
|
63024
|
+
if (entityConfig.maxTotalExpansions && this.entityExpansionCount > entityConfig.maxTotalExpansions) {
|
|
63025
|
+
throw new Error(
|
|
63026
|
+
`Entity expansion limit exceeded: ${this.entityExpansionCount} > ${entityConfig.maxTotalExpansions}`
|
|
63027
|
+
);
|
|
63028
|
+
}
|
|
62108
63029
|
}
|
|
63030
|
+
val = val.replace(entity.regex, entity.val);
|
|
62109
63031
|
}
|
|
62110
63032
|
val = val.replace(this.ampEntity.regex, this.ampEntity.val);
|
|
62111
63033
|
return val;
|
|
62112
|
-
}
|
|
62113
|
-
function saveTextToParentTag(textData,
|
|
63034
|
+
}
|
|
63035
|
+
function saveTextToParentTag(textData, parentNode, matcher, isLeafNode) {
|
|
62114
63036
|
if (textData) {
|
|
62115
63037
|
if (isLeafNode === void 0)
|
|
62116
|
-
isLeafNode =
|
|
63038
|
+
isLeafNode = parentNode.child.length === 0;
|
|
62117
63039
|
textData = this.parseTextData(
|
|
62118
63040
|
textData,
|
|
62119
|
-
|
|
62120
|
-
|
|
63041
|
+
parentNode.tagname,
|
|
63042
|
+
matcher,
|
|
62121
63043
|
false,
|
|
62122
|
-
|
|
63044
|
+
parentNode[":@"] ? Object.keys(parentNode[":@"]).length !== 0 : false,
|
|
62123
63045
|
isLeafNode
|
|
62124
63046
|
);
|
|
62125
63047
|
if (textData !== void 0 && textData !== "")
|
|
62126
|
-
|
|
63048
|
+
parentNode.add(this.options.textNodeName, textData);
|
|
62127
63049
|
textData = "";
|
|
62128
63050
|
}
|
|
62129
63051
|
return textData;
|
|
62130
63052
|
}
|
|
62131
|
-
function isItStopNode(
|
|
62132
|
-
if (
|
|
62133
|
-
return
|
|
62134
|
-
|
|
62135
|
-
return true;
|
|
62136
|
-
return false;
|
|
63053
|
+
function isItStopNode() {
|
|
63054
|
+
if (this.stopNodeExpressionsSet.size === 0)
|
|
63055
|
+
return false;
|
|
63056
|
+
return this.matcher.matchesAny(this.stopNodeExpressionsSet);
|
|
62137
63057
|
}
|
|
62138
63058
|
function tagExpWithClosingIndex(xmlData, i4, closingChar = ">") {
|
|
62139
|
-
let attrBoundary;
|
|
62140
|
-
|
|
62141
|
-
|
|
62142
|
-
|
|
63059
|
+
let attrBoundary = 0;
|
|
63060
|
+
const chars = [];
|
|
63061
|
+
const len5 = xmlData.length;
|
|
63062
|
+
const closeCode0 = closingChar.charCodeAt(0);
|
|
63063
|
+
const closeCode1 = closingChar.length > 1 ? closingChar.charCodeAt(1) : -1;
|
|
63064
|
+
for (let index = i4; index < len5; index++) {
|
|
63065
|
+
const code = xmlData.charCodeAt(index);
|
|
62143
63066
|
if (attrBoundary) {
|
|
62144
|
-
if (
|
|
62145
|
-
attrBoundary =
|
|
62146
|
-
} else if (
|
|
62147
|
-
attrBoundary =
|
|
62148
|
-
} else if (
|
|
62149
|
-
if (
|
|
62150
|
-
if (xmlData
|
|
62151
|
-
return {
|
|
62152
|
-
data: tagExp,
|
|
62153
|
-
index
|
|
62154
|
-
};
|
|
63067
|
+
if (code === attrBoundary)
|
|
63068
|
+
attrBoundary = 0;
|
|
63069
|
+
} else if (code === 34 || code === 39) {
|
|
63070
|
+
attrBoundary = code;
|
|
63071
|
+
} else if (code === closeCode0) {
|
|
63072
|
+
if (closeCode1 !== -1) {
|
|
63073
|
+
if (xmlData.charCodeAt(index + 1) === closeCode1) {
|
|
63074
|
+
return { data: String.fromCharCode(...chars), index };
|
|
62155
63075
|
}
|
|
62156
63076
|
} else {
|
|
62157
|
-
return {
|
|
62158
|
-
data: tagExp,
|
|
62159
|
-
index
|
|
62160
|
-
};
|
|
63077
|
+
return { data: String.fromCharCode(...chars), index };
|
|
62161
63078
|
}
|
|
62162
|
-
} else if (
|
|
62163
|
-
|
|
63079
|
+
} else if (code === 9) {
|
|
63080
|
+
chars.push(32);
|
|
63081
|
+
continue;
|
|
62164
63082
|
}
|
|
62165
|
-
|
|
63083
|
+
chars.push(code);
|
|
62166
63084
|
}
|
|
62167
63085
|
}
|
|
62168
63086
|
function findClosingIndex(xmlData, str6, i4, errMsg) {
|
|
@@ -62173,6 +63091,12 @@ void main(void) {
|
|
|
62173
63091
|
return closingIndex + str6.length - 1;
|
|
62174
63092
|
}
|
|
62175
63093
|
}
|
|
63094
|
+
function findClosingChar(xmlData, char, i4, errMsg) {
|
|
63095
|
+
const closingIndex = xmlData.indexOf(char, i4);
|
|
63096
|
+
if (closingIndex === -1)
|
|
63097
|
+
throw new Error(errMsg);
|
|
63098
|
+
return closingIndex;
|
|
63099
|
+
}
|
|
62176
63100
|
function readTagExp(xmlData, i4, removeNSPrefix, closingChar = ">") {
|
|
62177
63101
|
const result = tagExpWithClosingIndex(xmlData, i4 + 1, closingChar);
|
|
62178
63102
|
if (!result)
|
|
@@ -62205,10 +63129,12 @@ void main(void) {
|
|
|
62205
63129
|
function readStopNodeData(xmlData, tagName, i4) {
|
|
62206
63130
|
const startIndex = i4;
|
|
62207
63131
|
let openTagCount = 1;
|
|
62208
|
-
|
|
63132
|
+
const xmllen = xmlData.length;
|
|
63133
|
+
for (; i4 < xmllen; i4++) {
|
|
62209
63134
|
if (xmlData[i4] === "<") {
|
|
62210
|
-
|
|
62211
|
-
|
|
63135
|
+
const c1 = xmlData.charCodeAt(i4 + 1);
|
|
63136
|
+
if (c1 === 47) {
|
|
63137
|
+
const closeIndex = findClosingChar(xmlData, ">", i4, `${tagName} is not closed`);
|
|
62212
63138
|
let closeTagName = xmlData.substring(i4 + 2, closeIndex).trim();
|
|
62213
63139
|
if (closeTagName === tagName) {
|
|
62214
63140
|
openTagCount--;
|
|
@@ -62220,13 +63146,13 @@ void main(void) {
|
|
|
62220
63146
|
}
|
|
62221
63147
|
}
|
|
62222
63148
|
i4 = closeIndex;
|
|
62223
|
-
} else if (
|
|
63149
|
+
} else if (c1 === 63) {
|
|
62224
63150
|
const closeIndex = findClosingIndex(xmlData, "?>", i4 + 1, "StopNode is not closed.");
|
|
62225
63151
|
i4 = closeIndex;
|
|
62226
|
-
} else if (xmlData.
|
|
63152
|
+
} else if (c1 === 33 && xmlData.charCodeAt(i4 + 2) === 45 && xmlData.charCodeAt(i4 + 3) === 45) {
|
|
62227
63153
|
const closeIndex = findClosingIndex(xmlData, "-->", i4 + 3, "StopNode is not closed.");
|
|
62228
63154
|
i4 = closeIndex;
|
|
62229
|
-
} else if (xmlData.
|
|
63155
|
+
} else if (c1 === 33 && xmlData.charCodeAt(i4 + 2) === 91) {
|
|
62230
63156
|
const closeIndex = findClosingIndex(xmlData, "]]>", i4, "StopNode is not closed.") - 2;
|
|
62231
63157
|
i4 = closeIndex;
|
|
62232
63158
|
} else {
|
|
@@ -62267,23 +63193,60 @@ void main(void) {
|
|
|
62267
63193
|
return prefix + str6 + ";";
|
|
62268
63194
|
}
|
|
62269
63195
|
}
|
|
63196
|
+
function transformTagName(fn, tagName, tagExp, options) {
|
|
63197
|
+
if (fn) {
|
|
63198
|
+
const newTagName = fn(tagName);
|
|
63199
|
+
if (tagExp === tagName) {
|
|
63200
|
+
tagExp = newTagName;
|
|
63201
|
+
}
|
|
63202
|
+
tagName = newTagName;
|
|
63203
|
+
}
|
|
63204
|
+
tagName = sanitizeName(tagName, options);
|
|
63205
|
+
return { tagName, tagExp };
|
|
63206
|
+
}
|
|
63207
|
+
function sanitizeName(name13, options) {
|
|
63208
|
+
if (criticalProperties.includes(name13)) {
|
|
63209
|
+
throw new Error(`[SECURITY] Invalid name: "${name13}" is a reserved JavaScript keyword that could cause prototype pollution`);
|
|
63210
|
+
} else if (DANGEROUS_PROPERTY_NAMES.includes(name13)) {
|
|
63211
|
+
return options.onDangerousProperty(name13);
|
|
63212
|
+
}
|
|
63213
|
+
return name13;
|
|
63214
|
+
}
|
|
62270
63215
|
|
|
62271
63216
|
// ../../node_modules/fast-xml-parser/src/xmlparser/node2json.js
|
|
62272
63217
|
var METADATA_SYMBOL2 = XmlNode.getMetaDataSymbol();
|
|
62273
|
-
function
|
|
62274
|
-
|
|
63218
|
+
function stripAttributePrefix(attrs, prefix) {
|
|
63219
|
+
if (!attrs || typeof attrs !== "object")
|
|
63220
|
+
return {};
|
|
63221
|
+
if (!prefix)
|
|
63222
|
+
return attrs;
|
|
63223
|
+
const rawAttrs = {};
|
|
63224
|
+
for (const key in attrs) {
|
|
63225
|
+
if (key.startsWith(prefix)) {
|
|
63226
|
+
const rawName = key.substring(prefix.length);
|
|
63227
|
+
rawAttrs[rawName] = attrs[key];
|
|
63228
|
+
} else {
|
|
63229
|
+
rawAttrs[key] = attrs[key];
|
|
63230
|
+
}
|
|
63231
|
+
}
|
|
63232
|
+
return rawAttrs;
|
|
63233
|
+
}
|
|
63234
|
+
function prettify(node, options, matcher, readonlyMatcher) {
|
|
63235
|
+
return compress(node, options, matcher, readonlyMatcher);
|
|
62275
63236
|
}
|
|
62276
|
-
function compress(arr, options,
|
|
63237
|
+
function compress(arr, options, matcher, readonlyMatcher) {
|
|
62277
63238
|
let text;
|
|
62278
63239
|
const compressedObj = {};
|
|
62279
63240
|
for (let i4 = 0; i4 < arr.length; i4++) {
|
|
62280
63241
|
const tagObj = arr[i4];
|
|
62281
63242
|
const property = propName(tagObj);
|
|
62282
|
-
|
|
62283
|
-
|
|
62284
|
-
|
|
62285
|
-
|
|
62286
|
-
|
|
63243
|
+
if (property !== void 0 && property !== options.textNodeName) {
|
|
63244
|
+
const rawAttrs = stripAttributePrefix(
|
|
63245
|
+
tagObj[":@"] || {},
|
|
63246
|
+
options.attributeNamePrefix
|
|
63247
|
+
);
|
|
63248
|
+
matcher.push(property, rawAttrs);
|
|
63249
|
+
}
|
|
62287
63250
|
if (property === options.textNodeName) {
|
|
62288
63251
|
if (text === void 0)
|
|
62289
63252
|
text = tagObj[property];
|
|
@@ -62292,13 +63255,10 @@ void main(void) {
|
|
|
62292
63255
|
} else if (property === void 0) {
|
|
62293
63256
|
continue;
|
|
62294
63257
|
} else if (tagObj[property]) {
|
|
62295
|
-
let val = compress(tagObj[property], options,
|
|
63258
|
+
let val = compress(tagObj[property], options, matcher, readonlyMatcher);
|
|
62296
63259
|
const isLeaf = isLeafTag(val, options);
|
|
62297
|
-
if (tagObj[METADATA_SYMBOL2] !== void 0) {
|
|
62298
|
-
val[METADATA_SYMBOL2] = tagObj[METADATA_SYMBOL2];
|
|
62299
|
-
}
|
|
62300
63260
|
if (tagObj[":@"]) {
|
|
62301
|
-
assignAttributes(val, tagObj[":@"],
|
|
63261
|
+
assignAttributes(val, tagObj[":@"], readonlyMatcher, options);
|
|
62302
63262
|
} else if (Object.keys(val).length === 1 && val[options.textNodeName] !== void 0 && !options.alwaysCreateTextNode) {
|
|
62303
63263
|
val = val[options.textNodeName];
|
|
62304
63264
|
} else if (Object.keys(val).length === 0) {
|
|
@@ -62307,18 +63267,25 @@ void main(void) {
|
|
|
62307
63267
|
else
|
|
62308
63268
|
val = "";
|
|
62309
63269
|
}
|
|
62310
|
-
if (
|
|
63270
|
+
if (tagObj[METADATA_SYMBOL2] !== void 0 && typeof val === "object" && val !== null) {
|
|
63271
|
+
val[METADATA_SYMBOL2] = tagObj[METADATA_SYMBOL2];
|
|
63272
|
+
}
|
|
63273
|
+
if (compressedObj[property] !== void 0 && Object.prototype.hasOwnProperty.call(compressedObj, property)) {
|
|
62311
63274
|
if (!Array.isArray(compressedObj[property])) {
|
|
62312
63275
|
compressedObj[property] = [compressedObj[property]];
|
|
62313
63276
|
}
|
|
62314
63277
|
compressedObj[property].push(val);
|
|
62315
63278
|
} else {
|
|
62316
|
-
|
|
63279
|
+
const jPathOrMatcher = options.jPath ? readonlyMatcher.toString() : readonlyMatcher;
|
|
63280
|
+
if (options.isArray(property, jPathOrMatcher, isLeaf)) {
|
|
62317
63281
|
compressedObj[property] = [val];
|
|
62318
63282
|
} else {
|
|
62319
63283
|
compressedObj[property] = val;
|
|
62320
63284
|
}
|
|
62321
63285
|
}
|
|
63286
|
+
if (property !== void 0 && property !== options.textNodeName) {
|
|
63287
|
+
matcher.pop();
|
|
63288
|
+
}
|
|
62322
63289
|
}
|
|
62323
63290
|
}
|
|
62324
63291
|
if (typeof text === "string") {
|
|
@@ -62336,13 +63303,15 @@ void main(void) {
|
|
|
62336
63303
|
return key;
|
|
62337
63304
|
}
|
|
62338
63305
|
}
|
|
62339
|
-
function assignAttributes(obj, attrMap,
|
|
63306
|
+
function assignAttributes(obj, attrMap, readonlyMatcher, options) {
|
|
62340
63307
|
if (attrMap) {
|
|
62341
63308
|
const keys = Object.keys(attrMap);
|
|
62342
63309
|
const len5 = keys.length;
|
|
62343
63310
|
for (let i4 = 0; i4 < len5; i4++) {
|
|
62344
63311
|
const atrrName = keys[i4];
|
|
62345
|
-
|
|
63312
|
+
const rawAttrName = atrrName.startsWith(options.attributeNamePrefix) ? atrrName.substring(options.attributeNamePrefix.length) : atrrName;
|
|
63313
|
+
const jPathOrMatcher = options.jPath ? readonlyMatcher.toString() + "." + rawAttrName : readonlyMatcher;
|
|
63314
|
+
if (options.isArray(atrrName, jPathOrMatcher, true, true)) {
|
|
62346
63315
|
obj[atrrName] = [attrMap[atrrName]];
|
|
62347
63316
|
} else {
|
|
62348
63317
|
obj[atrrName] = attrMap[atrrName];
|
|
@@ -62393,7 +63362,7 @@ void main(void) {
|
|
|
62393
63362
|
if (this.options.preserveOrder || orderedResult === void 0)
|
|
62394
63363
|
return orderedResult;
|
|
62395
63364
|
else
|
|
62396
|
-
return prettify(orderedResult, this.options);
|
|
63365
|
+
return prettify(orderedResult, this.options, orderedObjParser.matcher, orderedObjParser.readonlyMatcher);
|
|
62397
63366
|
}
|
|
62398
63367
|
/**
|
|
62399
63368
|
* Add Entity which is not by default supported by this library
|
|
@@ -87510,6 +88479,9 @@ void main() {
|
|
|
87510
88479
|
}
|
|
87511
88480
|
`
|
|
87512
88481
|
);
|
|
88482
|
+
if (device.type === "webgl") {
|
|
88483
|
+
device.getExtension("GL_ARB_shader_bit_encoding");
|
|
88484
|
+
}
|
|
87513
88485
|
return new BufferTransform(device, {
|
|
87514
88486
|
vs: vs15,
|
|
87515
88487
|
fs: fs12,
|
|
@@ -92863,26 +93835,65 @@ void main() {
|
|
|
92863
93835
|
] });
|
|
92864
93836
|
B2(ui, rootElement);
|
|
92865
93837
|
}
|
|
92866
|
-
|
|
93838
|
+
isOrthographicView(viewId) {
|
|
93839
|
+
const deck = this.deck;
|
|
93840
|
+
const view = deck?.isInitialized && deck.getView(viewId);
|
|
93841
|
+
return view instanceof OrthographicView;
|
|
93842
|
+
}
|
|
93843
|
+
handleZoom(viewId, delta) {
|
|
92867
93844
|
const viewState = this.getViewState(viewId);
|
|
92868
|
-
|
|
92869
|
-
|
|
92870
|
-
|
|
92871
|
-
|
|
92872
|
-
|
|
92873
|
-
|
|
92874
|
-
|
|
92875
|
-
|
|
93845
|
+
const newViewState = {};
|
|
93846
|
+
if (this.isOrthographicView(viewId)) {
|
|
93847
|
+
const { zoomAxis } = this.props;
|
|
93848
|
+
const { zoomX, minZoomX, maxZoomX, zoomY, minZoomY, maxZoomY } = normalizeOrthographicViewState(
|
|
93849
|
+
viewState
|
|
93850
|
+
);
|
|
93851
|
+
let nextZoom;
|
|
93852
|
+
let nextZoomY;
|
|
93853
|
+
if (zoomAxis === "X") {
|
|
93854
|
+
nextZoom = clamp3(zoomX + delta, minZoomX, maxZoomX);
|
|
93855
|
+
nextZoomY = zoomY;
|
|
93856
|
+
} else if (zoomAxis === "Y") {
|
|
93857
|
+
nextZoom = zoomX;
|
|
93858
|
+
nextZoomY = clamp3(zoomY + delta, minZoomY, maxZoomY);
|
|
93859
|
+
} else {
|
|
93860
|
+
const clampedDelta = clamp3(
|
|
93861
|
+
delta,
|
|
93862
|
+
Math.max(minZoomX - zoomX, minZoomY - zoomY),
|
|
93863
|
+
Math.min(maxZoomX - zoomX, maxZoomY - zoomY)
|
|
93864
|
+
);
|
|
93865
|
+
nextZoom = zoomX + clampedDelta;
|
|
93866
|
+
nextZoomY = zoomY + clampedDelta;
|
|
93867
|
+
}
|
|
93868
|
+
newViewState.zoom = [nextZoom, nextZoomY];
|
|
93869
|
+
newViewState.zoomX = nextZoom;
|
|
93870
|
+
newViewState.zoomY = nextZoomY;
|
|
93871
|
+
this.props.onZoom?.({
|
|
93872
|
+
viewId,
|
|
93873
|
+
delta,
|
|
93874
|
+
// `zoom` will not match the new state if using 2D zoom. Deprecated behavior for backward compatibility.
|
|
93875
|
+
zoom: zoomAxis === "Y" ? nextZoomY : nextZoom,
|
|
93876
|
+
zoomX: nextZoom,
|
|
93877
|
+
zoomY: nextZoomY
|
|
93878
|
+
});
|
|
93879
|
+
} else {
|
|
93880
|
+
const { zoom = 0, minZoom, maxZoom } = viewState;
|
|
93881
|
+
const nextZoom = clamp3(zoom + delta, minZoom, maxZoom);
|
|
93882
|
+
newViewState.zoom = nextZoom;
|
|
93883
|
+
this.props.onZoom?.({
|
|
93884
|
+
viewId,
|
|
93885
|
+
delta,
|
|
93886
|
+
zoom: nextZoom
|
|
93887
|
+
});
|
|
92876
93888
|
}
|
|
92877
|
-
this.props.onZoom?.({ viewId, delta, zoom: nextZoom });
|
|
92878
93889
|
const nextViewState = {
|
|
92879
93890
|
...viewState,
|
|
92880
|
-
|
|
93891
|
+
...newViewState
|
|
92881
93892
|
};
|
|
92882
93893
|
if (this.props.transitionDuration > 0) {
|
|
92883
93894
|
nextViewState.transitionDuration = this.props.transitionDuration;
|
|
92884
93895
|
nextViewState.transitionInterpolator = "latitude" in nextViewState ? new FlyToInterpolator() : new LinearInterpolator({
|
|
92885
|
-
transitionProps: ["zoom"]
|
|
93896
|
+
transitionProps: "zoomX" in newViewState ? ["zoomX", "zoomY"] : ["zoom"]
|
|
92886
93897
|
});
|
|
92887
93898
|
}
|
|
92888
93899
|
this.setViewState(viewId, nextViewState);
|
|
@@ -92890,15 +93901,13 @@ void main() {
|
|
|
92890
93901
|
handleZoomIn() {
|
|
92891
93902
|
const viewIds = this.viewId ? [this.viewId] : this.deck?.getViews().map((v4) => v4.id) ?? [];
|
|
92892
93903
|
for (const viewId of viewIds) {
|
|
92893
|
-
|
|
92894
|
-
this.handleZoom(viewId, viewState.zoom + 1, 1);
|
|
93904
|
+
this.handleZoom(viewId, 1);
|
|
92895
93905
|
}
|
|
92896
93906
|
}
|
|
92897
93907
|
handleZoomOut() {
|
|
92898
93908
|
const viewIds = this.viewId ? [this.viewId] : this.deck?.getViews().map((v4) => v4.id) ?? [];
|
|
92899
93909
|
for (const viewId of viewIds) {
|
|
92900
|
-
|
|
92901
|
-
this.handleZoom(viewId, viewState.zoom - 1, -1);
|
|
93910
|
+
this.handleZoom(viewId, -1);
|
|
92902
93911
|
}
|
|
92903
93912
|
}
|
|
92904
93913
|
};
|
|
@@ -92910,10 +93919,29 @@ void main() {
|
|
|
92910
93919
|
transitionDuration: 200,
|
|
92911
93920
|
zoomInLabel: "Zoom In",
|
|
92912
93921
|
zoomOutLabel: "Zoom Out",
|
|
93922
|
+
zoomAxis: "all",
|
|
92913
93923
|
viewId: null,
|
|
92914
93924
|
onZoom: () => {
|
|
92915
93925
|
}
|
|
92916
93926
|
};
|
|
93927
|
+
function clamp3(zoom, minZoom, maxZoom) {
|
|
93928
|
+
return zoom < minZoom ? minZoom : zoom > maxZoom ? maxZoom : zoom;
|
|
93929
|
+
}
|
|
93930
|
+
function normalizeOrthographicViewState({
|
|
93931
|
+
zoom = 0,
|
|
93932
|
+
zoomX,
|
|
93933
|
+
zoomY,
|
|
93934
|
+
minZoom = -Infinity,
|
|
93935
|
+
maxZoom = Infinity,
|
|
93936
|
+
minZoomX = minZoom,
|
|
93937
|
+
maxZoomX = maxZoom,
|
|
93938
|
+
minZoomY = minZoom,
|
|
93939
|
+
maxZoomY = maxZoom
|
|
93940
|
+
}) {
|
|
93941
|
+
zoomX = zoomX ?? (Array.isArray(zoom) ? zoom[0] : zoom);
|
|
93942
|
+
zoomY = zoomY ?? (Array.isArray(zoom) ? zoom[1] : zoom);
|
|
93943
|
+
return { zoomX, zoomY, minZoomX, minZoomY, maxZoomX, maxZoomY };
|
|
93944
|
+
}
|
|
92917
93945
|
|
|
92918
93946
|
// ../widgets/src/reset-view-widget.tsx
|
|
92919
93947
|
var ResetViewWidget = class extends Widget {
|
|
@@ -94112,7 +95140,7 @@ void main() {
|
|
|
94112
95140
|
bottom: "top",
|
|
94113
95141
|
top: "bottom"
|
|
94114
95142
|
};
|
|
94115
|
-
function
|
|
95143
|
+
function clamp4(start, value, end) {
|
|
94116
95144
|
return max6(start, min6(value, end));
|
|
94117
95145
|
}
|
|
94118
95146
|
function evaluate(value, param) {
|
|
@@ -94472,7 +95500,7 @@ void main() {
|
|
|
94472
95500
|
const min$1 = minPadding;
|
|
94473
95501
|
const max7 = clientSize - arrowDimensions[length6] - maxPadding;
|
|
94474
95502
|
const center2 = clientSize / 2 - arrowDimensions[length6] / 2 + centerToReference;
|
|
94475
|
-
const offset3 =
|
|
95503
|
+
const offset3 = clamp4(min$1, center2, max7);
|
|
94476
95504
|
const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center2 !== offset3 && rects.reference[length6] / 2 - (center2 < min$1 ? minPadding : maxPadding) - arrowDimensions[length6] / 2 < 0;
|
|
94477
95505
|
const alignmentOffset = shouldAddOffset ? center2 < min$1 ? center2 - min$1 : center2 - max7 : 0;
|
|
94478
95506
|
return {
|
|
@@ -94710,14 +95738,14 @@ void main() {
|
|
|
94710
95738
|
const maxSide = mainAxis === "y" ? "bottom" : "right";
|
|
94711
95739
|
const min7 = mainAxisCoord + overflow[minSide];
|
|
94712
95740
|
const max7 = mainAxisCoord - overflow[maxSide];
|
|
94713
|
-
mainAxisCoord =
|
|
95741
|
+
mainAxisCoord = clamp4(min7, mainAxisCoord, max7);
|
|
94714
95742
|
}
|
|
94715
95743
|
if (checkCrossAxis) {
|
|
94716
95744
|
const minSide = crossAxis === "y" ? "top" : "left";
|
|
94717
95745
|
const maxSide = crossAxis === "y" ? "bottom" : "right";
|
|
94718
95746
|
const min7 = crossAxisCoord + overflow[minSide];
|
|
94719
95747
|
const max7 = crossAxisCoord - overflow[maxSide];
|
|
94720
|
-
crossAxisCoord =
|
|
95748
|
+
crossAxisCoord = clamp4(min7, crossAxisCoord, max7);
|
|
94721
95749
|
}
|
|
94722
95750
|
const limitedCoords = limiter.fn({
|
|
94723
95751
|
...state,
|
|
@@ -95930,7 +96958,7 @@ void main() {
|
|
|
95930
96958
|
|
|
95931
96959
|
// ../widgets/src/lib/components/range-input.tsx
|
|
95932
96960
|
var wheelListenerOptions = { passive: false };
|
|
95933
|
-
var
|
|
96961
|
+
var clamp5 = (value, min7, max7) => {
|
|
95934
96962
|
if (value < min7) {
|
|
95935
96963
|
return min7;
|
|
95936
96964
|
}
|
|
@@ -95986,7 +97014,7 @@ void main() {
|
|
|
95986
97014
|
const range = max7 - min7;
|
|
95987
97015
|
const rangeSize = Math.max(0, value[1] - value[0]);
|
|
95988
97016
|
const maxStart = Math.max(0, range - rangeSize);
|
|
95989
|
-
const clampedStart =
|
|
97017
|
+
const clampedStart = clamp5(value[0], min7, min7 + maxStart);
|
|
95990
97018
|
const { thumbLength, thumbOffset } = T2(() => {
|
|
95991
97019
|
if (trackLength <= 0 || range <= 0) {
|
|
95992
97020
|
return { thumbLength: 0, thumbOffset: 0 };
|
|
@@ -95996,7 +97024,7 @@ void main() {
|
|
|
95996
97024
|
}
|
|
95997
97025
|
const nextThumbLength = rangeSize / range;
|
|
95998
97026
|
const travel = Math.max(0, 1 - nextThumbLength);
|
|
95999
|
-
const ratio = maxStart <= 0 ? 0 :
|
|
97027
|
+
const ratio = maxStart <= 0 ? 0 : clamp5((clampedStart - min7) / maxStart, 0, 1);
|
|
96000
97028
|
return {
|
|
96001
97029
|
thumbLength: Math.max(0, Math.min(nextThumbLength, 1)),
|
|
96002
97030
|
thumbOffset: travel * ratio
|
|
@@ -96007,7 +97035,7 @@ void main() {
|
|
|
96007
97035
|
if (!onChange) {
|
|
96008
97036
|
return;
|
|
96009
97037
|
}
|
|
96010
|
-
const clamped =
|
|
97038
|
+
const clamped = clamp5(nextStart, min7, min7 + maxStart);
|
|
96011
97039
|
onChange([clamped, clamped + rangeSize]);
|
|
96012
97040
|
},
|
|
96013
97041
|
[onChange, min7, maxStart, rangeSize]
|
|
@@ -96045,7 +97073,7 @@ void main() {
|
|
|
96045
97073
|
const coordinate = vertical ? event.clientY - trackStart : event.clientX - trackStart;
|
|
96046
97074
|
const span = Math.max(1, 1 - thumbLength) * trackLength;
|
|
96047
97075
|
const thumbCenter = thumbLength / 2 * trackLength;
|
|
96048
|
-
const ratio = span <= 0 ? 0 :
|
|
97076
|
+
const ratio = span <= 0 ? 0 : clamp5((coordinate - thumbCenter) / span, 0, 1);
|
|
96049
97077
|
emitRange(min7 + ratio * maxStart);
|
|
96050
97078
|
},
|
|
96051
97079
|
[vertical, trackLength, thumbLength, emitRange, min7, maxStart]
|
|
@@ -96080,7 +97108,7 @@ void main() {
|
|
|
96080
97108
|
const coordinate = vertical ? event.clientY : event.clientX;
|
|
96081
97109
|
const delta = coordinate - state.startCoord;
|
|
96082
97110
|
const ratio = state.startRatio + delta / trackLength2;
|
|
96083
|
-
const nextStart =
|
|
97111
|
+
const nextStart = clamp5(ratio * (state.max - state.min), 0, state.maxStart) + state.min;
|
|
96084
97112
|
emitRange(nextStart);
|
|
96085
97113
|
event.preventDefault();
|
|
96086
97114
|
},
|
|
@@ -96270,7 +97298,7 @@ void main() {
|
|
|
96270
97298
|
}
|
|
96271
97299
|
|
|
96272
97300
|
// ../widgets/src/scrollbar-widget.tsx
|
|
96273
|
-
var
|
|
97301
|
+
var clamp6 = (value, min7, max7) => {
|
|
96274
97302
|
if (value < min7) {
|
|
96275
97303
|
return min7;
|
|
96276
97304
|
}
|
|
@@ -96399,7 +97427,7 @@ void main() {
|
|
|
96399
97427
|
}
|
|
96400
97428
|
getClampedOffset() {
|
|
96401
97429
|
const maxScroll = this.getMaxScroll();
|
|
96402
|
-
return
|
|
97430
|
+
return clamp6(this.scrollOffset, 0, maxScroll);
|
|
96403
97431
|
}
|
|
96404
97432
|
isVertical() {
|
|
96405
97433
|
return this.props.orientation !== "horizontal";
|
|
@@ -96418,7 +97446,7 @@ void main() {
|
|
|
96418
97446
|
}
|
|
96419
97447
|
emitScroll(next) {
|
|
96420
97448
|
const maxScroll = this.getMaxScroll();
|
|
96421
|
-
const target2 =
|
|
97449
|
+
const target2 = clamp6(Math.round(next), 0, maxScroll);
|
|
96422
97450
|
const viewport = this.viewport;
|
|
96423
97451
|
if (viewport && target2 !== this.getClampedOffset()) {
|
|
96424
97452
|
const pixel = viewport.project(viewport.position);
|