@clef-sh/agent 0.1.23 → 0.1.24-beta.166
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/agent.cjs +1028 -749
- package/dist/agent.cjs.map +3 -3
- package/dist/initial-fetch.js +1 -1
- package/dist/initial-fetch.js.map +1 -1
- package/dist/server.js +3 -3
- package/dist/server.js.map +1 -1
- package/package.json +2 -2
package/dist/agent.cjs
CHANGED
|
@@ -11310,6 +11310,11 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
|
|
|
11310
11310
|
deref() {
|
|
11311
11311
|
return this.session;
|
|
11312
11312
|
}
|
|
11313
|
+
close() {
|
|
11314
|
+
if (!this.session.closed) {
|
|
11315
|
+
this.session.close();
|
|
11316
|
+
}
|
|
11317
|
+
}
|
|
11313
11318
|
destroy() {
|
|
11314
11319
|
this.refs = 0;
|
|
11315
11320
|
if (!this.session.destroyed) {
|
|
@@ -11393,16 +11398,18 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
|
|
|
11393
11398
|
}
|
|
11394
11399
|
});
|
|
11395
11400
|
}
|
|
11396
|
-
const
|
|
11397
|
-
|
|
11398
|
-
|
|
11401
|
+
const graceful = () => {
|
|
11402
|
+
this.removeFromPoolAndClose(url, ref);
|
|
11403
|
+
};
|
|
11404
|
+
const ensureDestroyed = () => {
|
|
11405
|
+
this.removeFromPoolAndCheckedDestroy(url, ref);
|
|
11399
11406
|
};
|
|
11400
|
-
session.on("goaway",
|
|
11401
|
-
session.on("error",
|
|
11402
|
-
session.on("frameError",
|
|
11403
|
-
session.on("close",
|
|
11407
|
+
session.on("goaway", graceful);
|
|
11408
|
+
session.on("error", ensureDestroyed);
|
|
11409
|
+
session.on("frameError", ensureDestroyed);
|
|
11410
|
+
session.on("close", ensureDestroyed);
|
|
11404
11411
|
if (connectionConfiguration.requestTimeout) {
|
|
11405
|
-
session.setTimeout(connectionConfiguration.requestTimeout,
|
|
11412
|
+
session.setTimeout(connectionConfiguration.requestTimeout, ensureDestroyed);
|
|
11406
11413
|
}
|
|
11407
11414
|
pool.offerLast(ref);
|
|
11408
11415
|
ref.retain();
|
|
@@ -11416,15 +11423,14 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
|
|
|
11416
11423
|
const ref = new ClientHttp2SessionRef(http22.connect(url));
|
|
11417
11424
|
const session = ref.deref();
|
|
11418
11425
|
session.settings({ maxConcurrentStreams: 1 });
|
|
11419
|
-
const
|
|
11420
|
-
|
|
11426
|
+
const ensureDestroyed = () => {
|
|
11427
|
+
ref.destroy();
|
|
11421
11428
|
};
|
|
11422
|
-
session.on("
|
|
11423
|
-
session.on("
|
|
11424
|
-
session.on("
|
|
11425
|
-
session.on("close", destroySession);
|
|
11429
|
+
session.on("error", ensureDestroyed);
|
|
11430
|
+
session.on("frameError", ensureDestroyed);
|
|
11431
|
+
session.on("close", ensureDestroyed);
|
|
11426
11432
|
if (connectionConfiguration.requestTimeout) {
|
|
11427
|
-
session.setTimeout(connectionConfiguration.requestTimeout,
|
|
11433
|
+
session.setTimeout(connectionConfiguration.requestTimeout, ensureDestroyed);
|
|
11428
11434
|
}
|
|
11429
11435
|
ref.retain();
|
|
11430
11436
|
return ref;
|
|
@@ -11465,8 +11471,13 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
|
|
|
11465
11471
|
}
|
|
11466
11472
|
return pools;
|
|
11467
11473
|
}
|
|
11468
|
-
|
|
11474
|
+
removeFromPoolAndClose(authority, ref) {
|
|
11469
11475
|
this.connectionPools.get(authority)?.remove(ref);
|
|
11476
|
+
ref.close();
|
|
11477
|
+
}
|
|
11478
|
+
removeFromPoolAndCheckedDestroy(authority, ref) {
|
|
11479
|
+
this.connectionPools.get(authority)?.remove(ref);
|
|
11480
|
+
ref.destroy();
|
|
11470
11481
|
}
|
|
11471
11482
|
getPool(url) {
|
|
11472
11483
|
if (!this.connectionPools.has(url)) {
|
|
@@ -16915,7 +16926,7 @@ var require_dist_cjs22 = __commonJS({
|
|
|
16915
16926
|
return errorMessages.has(error2.message);
|
|
16916
16927
|
};
|
|
16917
16928
|
var isThrottlingError = (error2) => error2.$metadata?.httpStatusCode === 429 || THROTTLING_ERROR_CODES.includes(error2.name) || error2.$retryable?.throttling == true;
|
|
16918
|
-
var isTransientError = (error2, depth = 0) => isRetryableByTrait(error2) || isClockSkewCorrectedError(error2) || TRANSIENT_ERROR_CODES.includes(error2.name) || NODEJS_TIMEOUT_ERROR_CODES.includes(error2?.code || "") || NODEJS_NETWORK_ERROR_CODES.includes(error2?.code || "") || TRANSIENT_ERROR_STATUS_CODES.includes(error2.$metadata?.httpStatusCode || 0) || isBrowserNetworkError(error2) || isNodeJsHttp2TransientError(error2) || error2.cause !== void 0 && depth <= 10 && isTransientError(error2.cause, depth + 1);
|
|
16929
|
+
var isTransientError = (error2, depth = 0) => isRetryableByTrait(error2) || isClockSkewCorrectedError(error2) || error2.name === "InvalidSignatureException" && error2.message?.includes("Signature expired") || TRANSIENT_ERROR_CODES.includes(error2.name) || NODEJS_TIMEOUT_ERROR_CODES.includes(error2?.code || "") || NODEJS_NETWORK_ERROR_CODES.includes(error2?.code || "") || TRANSIENT_ERROR_STATUS_CODES.includes(error2.$metadata?.httpStatusCode || 0) || isBrowserNetworkError(error2) || isNodeJsHttp2TransientError(error2) || error2.cause !== void 0 && depth <= 10 && isTransientError(error2.cause, depth + 1);
|
|
16919
16930
|
var isServerError = (error2) => {
|
|
16920
16931
|
if (error2.$metadata?.httpStatusCode !== void 0) {
|
|
16921
16932
|
const statusCode = error2.$metadata.httpStatusCode;
|
|
@@ -17123,6 +17134,11 @@ var require_dist_cjs23 = __commonJS({
|
|
|
17123
17134
|
return this.longPoll;
|
|
17124
17135
|
}
|
|
17125
17136
|
};
|
|
17137
|
+
var refusal = {
|
|
17138
|
+
incompatible: 1,
|
|
17139
|
+
attempts: 2,
|
|
17140
|
+
capacity: 3
|
|
17141
|
+
};
|
|
17126
17142
|
var StandardRetryStrategy = class {
|
|
17127
17143
|
mode = exports2.RETRY_MODES.STANDARD;
|
|
17128
17144
|
capacity = INITIAL_RETRY_TOKENS;
|
|
@@ -17148,8 +17164,10 @@ var require_dist_cjs23 = __commonJS({
|
|
|
17148
17164
|
}
|
|
17149
17165
|
async refreshRetryTokenForRetry(token, errorInfo) {
|
|
17150
17166
|
const maxAttempts = await this.getMaxAttempts();
|
|
17151
|
-
const
|
|
17152
|
-
|
|
17167
|
+
const retryCode = this.retryCode(token, errorInfo, maxAttempts);
|
|
17168
|
+
const shouldRetry = retryCode === 0;
|
|
17169
|
+
const isLongPoll = token.isLongPoll?.();
|
|
17170
|
+
if (shouldRetry || isLongPoll) {
|
|
17153
17171
|
const errorType = errorInfo.errorType;
|
|
17154
17172
|
this.retryBackoffStrategy.setDelayBase(errorType === "THROTTLING" ? Retry2.throttlingDelay() : this.baseDelay);
|
|
17155
17173
|
const delayFromErrorType = this.retryBackoffStrategy.computeNextBackoffDelay(token.getRetryCount());
|
|
@@ -17158,7 +17176,9 @@ var require_dist_cjs23 = __commonJS({
|
|
|
17158
17176
|
retryDelay = Math.max(delayFromErrorType, Math.min(errorInfo.retryAfterHint.getTime() - Date.now(), delayFromErrorType + 5e3));
|
|
17159
17177
|
}
|
|
17160
17178
|
if (!shouldRetry) {
|
|
17161
|
-
throw Object.assign(new Error("No retry token available"), {
|
|
17179
|
+
throw Object.assign(new Error("No retry token available"), {
|
|
17180
|
+
$backoff: Retry2.v2026 && retryCode === refusal.capacity && isLongPoll ? retryDelay : 0
|
|
17181
|
+
});
|
|
17162
17182
|
} else {
|
|
17163
17183
|
const capacityCost = this.getCapacityCost(errorType);
|
|
17164
17184
|
this.capacity -= capacityCost;
|
|
@@ -17173,6 +17193,9 @@ var require_dist_cjs23 = __commonJS({
|
|
|
17173
17193
|
getCapacity() {
|
|
17174
17194
|
return this.capacity;
|
|
17175
17195
|
}
|
|
17196
|
+
async maxAttempts() {
|
|
17197
|
+
return this.maxAttemptsProvider();
|
|
17198
|
+
}
|
|
17176
17199
|
async getMaxAttempts() {
|
|
17177
17200
|
try {
|
|
17178
17201
|
return await this.maxAttemptsProvider();
|
|
@@ -17181,9 +17204,12 @@ var require_dist_cjs23 = __commonJS({
|
|
|
17181
17204
|
return DEFAULT_MAX_ATTEMPTS;
|
|
17182
17205
|
}
|
|
17183
17206
|
}
|
|
17184
|
-
|
|
17207
|
+
retryCode(tokenToRenew, errorInfo, maxAttempts) {
|
|
17185
17208
|
const attempts = tokenToRenew.getRetryCount() + 1;
|
|
17186
|
-
|
|
17209
|
+
const retryableStatus = this.isRetryableError(errorInfo.errorType) ? 0 : refusal.incompatible;
|
|
17210
|
+
const attemptStatus = attempts < maxAttempts ? 0 : refusal.attempts;
|
|
17211
|
+
const capacityStatus = this.capacity >= this.getCapacityCost(errorInfo.errorType) ? 0 : refusal.capacity;
|
|
17212
|
+
return retryableStatus || attemptStatus || capacityStatus;
|
|
17187
17213
|
}
|
|
17188
17214
|
getCapacityCost(errorType) {
|
|
17189
17215
|
return errorType === Retry2.modifiedCostType() ? Retry2.throttlingCost() : Retry2.cost();
|
|
@@ -17191,9 +17217,6 @@ var require_dist_cjs23 = __commonJS({
|
|
|
17191
17217
|
isRetryableError(errorType) {
|
|
17192
17218
|
return errorType === "THROTTLING" || errorType === "TRANSIENT";
|
|
17193
17219
|
}
|
|
17194
|
-
async maxAttempts() {
|
|
17195
|
-
return this.maxAttemptsProvider();
|
|
17196
|
-
}
|
|
17197
17220
|
};
|
|
17198
17221
|
var AdaptiveRetryStrategy = class {
|
|
17199
17222
|
mode = exports2.RETRY_MODES.ADAPTIVE;
|
|
@@ -20843,7 +20866,7 @@ var require_package = __commonJS({
|
|
|
20843
20866
|
module2.exports = {
|
|
20844
20867
|
name: "@aws-sdk/client-kms",
|
|
20845
20868
|
description: "AWS SDK for JavaScript Kms Client for Node.js, Browser and React Native",
|
|
20846
|
-
version: "3.
|
|
20869
|
+
version: "3.1037.0",
|
|
20847
20870
|
scripts: {
|
|
20848
20871
|
build: "concurrently 'yarn:build:types' 'yarn:build:es' && yarn build:cjs",
|
|
20849
20872
|
"build:cjs": "node ../../scripts/compilation/inline client-kms",
|
|
@@ -20865,41 +20888,41 @@ var require_package = __commonJS({
|
|
|
20865
20888
|
dependencies: {
|
|
20866
20889
|
"@aws-crypto/sha256-browser": "5.2.0",
|
|
20867
20890
|
"@aws-crypto/sha256-js": "5.2.0",
|
|
20868
|
-
"@aws-sdk/core": "^3.974.
|
|
20869
|
-
"@aws-sdk/credential-provider-node": "^3.972.
|
|
20891
|
+
"@aws-sdk/core": "^3.974.5",
|
|
20892
|
+
"@aws-sdk/credential-provider-node": "^3.972.36",
|
|
20870
20893
|
"@aws-sdk/middleware-host-header": "^3.972.10",
|
|
20871
20894
|
"@aws-sdk/middleware-logger": "^3.972.10",
|
|
20872
20895
|
"@aws-sdk/middleware-recursion-detection": "^3.972.11",
|
|
20873
|
-
"@aws-sdk/middleware-user-agent": "^3.972.
|
|
20896
|
+
"@aws-sdk/middleware-user-agent": "^3.972.35",
|
|
20874
20897
|
"@aws-sdk/region-config-resolver": "^3.972.13",
|
|
20875
20898
|
"@aws-sdk/types": "^3.973.8",
|
|
20876
20899
|
"@aws-sdk/util-endpoints": "^3.996.8",
|
|
20877
20900
|
"@aws-sdk/util-user-agent-browser": "^3.972.10",
|
|
20878
|
-
"@aws-sdk/util-user-agent-node": "^3.973.
|
|
20901
|
+
"@aws-sdk/util-user-agent-node": "^3.973.21",
|
|
20879
20902
|
"@smithy/config-resolver": "^4.4.17",
|
|
20880
|
-
"@smithy/core": "^3.23.
|
|
20903
|
+
"@smithy/core": "^3.23.17",
|
|
20881
20904
|
"@smithy/fetch-http-handler": "^5.3.17",
|
|
20882
20905
|
"@smithy/hash-node": "^4.2.14",
|
|
20883
20906
|
"@smithy/invalid-dependency": "^4.2.14",
|
|
20884
20907
|
"@smithy/middleware-content-length": "^4.2.14",
|
|
20885
|
-
"@smithy/middleware-endpoint": "^4.4.
|
|
20886
|
-
"@smithy/middleware-retry": "^4.5.
|
|
20887
|
-
"@smithy/middleware-serde": "^4.2.
|
|
20908
|
+
"@smithy/middleware-endpoint": "^4.4.32",
|
|
20909
|
+
"@smithy/middleware-retry": "^4.5.5",
|
|
20910
|
+
"@smithy/middleware-serde": "^4.2.20",
|
|
20888
20911
|
"@smithy/middleware-stack": "^4.2.14",
|
|
20889
20912
|
"@smithy/node-config-provider": "^4.3.14",
|
|
20890
|
-
"@smithy/node-http-handler": "^4.6.
|
|
20913
|
+
"@smithy/node-http-handler": "^4.6.1",
|
|
20891
20914
|
"@smithy/protocol-http": "^5.3.14",
|
|
20892
|
-
"@smithy/smithy-client": "^4.12.
|
|
20915
|
+
"@smithy/smithy-client": "^4.12.13",
|
|
20893
20916
|
"@smithy/types": "^4.14.1",
|
|
20894
20917
|
"@smithy/url-parser": "^4.2.14",
|
|
20895
20918
|
"@smithy/util-base64": "^4.3.2",
|
|
20896
20919
|
"@smithy/util-body-length-browser": "^4.2.2",
|
|
20897
20920
|
"@smithy/util-body-length-node": "^4.2.3",
|
|
20898
|
-
"@smithy/util-defaults-mode-browser": "^4.3.
|
|
20899
|
-
"@smithy/util-defaults-mode-node": "^4.2.
|
|
20921
|
+
"@smithy/util-defaults-mode-browser": "^4.3.49",
|
|
20922
|
+
"@smithy/util-defaults-mode-node": "^4.2.54",
|
|
20900
20923
|
"@smithy/util-endpoints": "^3.4.2",
|
|
20901
20924
|
"@smithy/util-middleware": "^4.2.14",
|
|
20902
|
-
"@smithy/util-retry": "^4.3.
|
|
20925
|
+
"@smithy/util-retry": "^4.3.4",
|
|
20903
20926
|
"@smithy/util-utf8": "^4.2.2",
|
|
20904
20927
|
tslib: "^2.6.2"
|
|
20905
20928
|
},
|
|
@@ -21618,7 +21641,7 @@ var init_package = __esm({
|
|
|
21618
21641
|
"../../node_modules/@aws-sdk/nested-clients/package.json"() {
|
|
21619
21642
|
package_default = {
|
|
21620
21643
|
name: "@aws-sdk/nested-clients",
|
|
21621
|
-
version: "3.997.
|
|
21644
|
+
version: "3.997.3",
|
|
21622
21645
|
description: "Nested clients for AWS SDK packages.",
|
|
21623
21646
|
main: "./dist-cjs/index.js",
|
|
21624
21647
|
module: "./dist-es/index.js",
|
|
@@ -21647,41 +21670,41 @@ var init_package = __esm({
|
|
|
21647
21670
|
dependencies: {
|
|
21648
21671
|
"@aws-crypto/sha256-browser": "5.2.0",
|
|
21649
21672
|
"@aws-crypto/sha256-js": "5.2.0",
|
|
21650
|
-
"@aws-sdk/core": "^3.974.
|
|
21673
|
+
"@aws-sdk/core": "^3.974.5",
|
|
21651
21674
|
"@aws-sdk/middleware-host-header": "^3.972.10",
|
|
21652
21675
|
"@aws-sdk/middleware-logger": "^3.972.10",
|
|
21653
21676
|
"@aws-sdk/middleware-recursion-detection": "^3.972.11",
|
|
21654
|
-
"@aws-sdk/middleware-user-agent": "^3.972.
|
|
21677
|
+
"@aws-sdk/middleware-user-agent": "^3.972.35",
|
|
21655
21678
|
"@aws-sdk/region-config-resolver": "^3.972.13",
|
|
21656
|
-
"@aws-sdk/signature-v4-multi-region": "^3.996.
|
|
21679
|
+
"@aws-sdk/signature-v4-multi-region": "^3.996.22",
|
|
21657
21680
|
"@aws-sdk/types": "^3.973.8",
|
|
21658
21681
|
"@aws-sdk/util-endpoints": "^3.996.8",
|
|
21659
21682
|
"@aws-sdk/util-user-agent-browser": "^3.972.10",
|
|
21660
|
-
"@aws-sdk/util-user-agent-node": "^3.973.
|
|
21683
|
+
"@aws-sdk/util-user-agent-node": "^3.973.21",
|
|
21661
21684
|
"@smithy/config-resolver": "^4.4.17",
|
|
21662
|
-
"@smithy/core": "^3.23.
|
|
21685
|
+
"@smithy/core": "^3.23.17",
|
|
21663
21686
|
"@smithy/fetch-http-handler": "^5.3.17",
|
|
21664
21687
|
"@smithy/hash-node": "^4.2.14",
|
|
21665
21688
|
"@smithy/invalid-dependency": "^4.2.14",
|
|
21666
21689
|
"@smithy/middleware-content-length": "^4.2.14",
|
|
21667
|
-
"@smithy/middleware-endpoint": "^4.4.
|
|
21668
|
-
"@smithy/middleware-retry": "^4.5.
|
|
21669
|
-
"@smithy/middleware-serde": "^4.2.
|
|
21690
|
+
"@smithy/middleware-endpoint": "^4.4.32",
|
|
21691
|
+
"@smithy/middleware-retry": "^4.5.5",
|
|
21692
|
+
"@smithy/middleware-serde": "^4.2.20",
|
|
21670
21693
|
"@smithy/middleware-stack": "^4.2.14",
|
|
21671
21694
|
"@smithy/node-config-provider": "^4.3.14",
|
|
21672
|
-
"@smithy/node-http-handler": "^4.6.
|
|
21695
|
+
"@smithy/node-http-handler": "^4.6.1",
|
|
21673
21696
|
"@smithy/protocol-http": "^5.3.14",
|
|
21674
|
-
"@smithy/smithy-client": "^4.12.
|
|
21697
|
+
"@smithy/smithy-client": "^4.12.13",
|
|
21675
21698
|
"@smithy/types": "^4.14.1",
|
|
21676
21699
|
"@smithy/url-parser": "^4.2.14",
|
|
21677
21700
|
"@smithy/util-base64": "^4.3.2",
|
|
21678
21701
|
"@smithy/util-body-length-browser": "^4.2.2",
|
|
21679
21702
|
"@smithy/util-body-length-node": "^4.2.3",
|
|
21680
|
-
"@smithy/util-defaults-mode-browser": "^4.3.
|
|
21681
|
-
"@smithy/util-defaults-mode-node": "^4.2.
|
|
21703
|
+
"@smithy/util-defaults-mode-browser": "^4.3.49",
|
|
21704
|
+
"@smithy/util-defaults-mode-node": "^4.2.54",
|
|
21682
21705
|
"@smithy/util-endpoints": "^3.4.2",
|
|
21683
21706
|
"@smithy/util-middleware": "^4.2.14",
|
|
21684
|
-
"@smithy/util-retry": "^4.3.
|
|
21707
|
+
"@smithy/util-retry": "^4.3.4",
|
|
21685
21708
|
"@smithy/util-utf8": "^4.2.2",
|
|
21686
21709
|
tslib: "^2.6.2"
|
|
21687
21710
|
},
|
|
@@ -24199,38 +24222,38 @@ var require_fxp = __commonJS({
|
|
|
24199
24222
|
"../../node_modules/fast-xml-parser/lib/fxp.cjs"(exports2, module2) {
|
|
24200
24223
|
(() => {
|
|
24201
24224
|
"use strict";
|
|
24202
|
-
var t = { d: (e6,
|
|
24203
|
-
for (var
|
|
24225
|
+
var t = { d: (e6, n3) => {
|
|
24226
|
+
for (var i6 in n3) t.o(n3, i6) && !t.o(e6, i6) && Object.defineProperty(e6, i6, { enumerable: true, get: n3[i6] });
|
|
24204
24227
|
}, o: (t2, e6) => Object.prototype.hasOwnProperty.call(t2, e6), r: (t2) => {
|
|
24205
24228
|
"undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(t2, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(t2, "__esModule", { value: true });
|
|
24206
24229
|
} }, e5 = {};
|
|
24207
|
-
t.r(e5), t.d(e5, { XMLBuilder: () =>
|
|
24208
|
-
const
|
|
24230
|
+
t.r(e5), t.d(e5, { XMLBuilder: () => Bt, XMLParser: () => Tt, XMLValidator: () => Ut });
|
|
24231
|
+
const n2 = ":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD", i5 = new RegExp("^[" + n2 + "][" + n2 + "\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$");
|
|
24209
24232
|
function s(t2, e6) {
|
|
24210
|
-
const
|
|
24211
|
-
let
|
|
24212
|
-
for (;
|
|
24233
|
+
const n3 = [];
|
|
24234
|
+
let i6 = e6.exec(t2);
|
|
24235
|
+
for (; i6; ) {
|
|
24213
24236
|
const s2 = [];
|
|
24214
|
-
s2.startIndex = e6.lastIndex -
|
|
24215
|
-
const r6 =
|
|
24216
|
-
for (let t3 = 0; t3 < r6; t3++) s2.push(
|
|
24217
|
-
|
|
24237
|
+
s2.startIndex = e6.lastIndex - i6[0].length;
|
|
24238
|
+
const r6 = i6.length;
|
|
24239
|
+
for (let t3 = 0; t3 < r6; t3++) s2.push(i6[t3]);
|
|
24240
|
+
n3.push(s2), i6 = e6.exec(t2);
|
|
24218
24241
|
}
|
|
24219
|
-
return
|
|
24242
|
+
return n3;
|
|
24220
24243
|
}
|
|
24221
24244
|
const r5 = function(t2) {
|
|
24222
|
-
return !(null ==
|
|
24245
|
+
return !(null == i5.exec(t2));
|
|
24223
24246
|
}, o2 = ["hasOwnProperty", "toString", "valueOf", "__defineGetter__", "__defineSetter__", "__lookupGetter__", "__lookupSetter__"], a5 = ["__proto__", "constructor", "prototype"], h5 = { allowBooleanAttributes: false, unpairedTags: [] };
|
|
24224
24247
|
function l3(t2, e6) {
|
|
24225
24248
|
e6 = Object.assign({}, h5, e6);
|
|
24226
|
-
const
|
|
24227
|
-
let
|
|
24249
|
+
const n3 = [];
|
|
24250
|
+
let i6 = false, s2 = false;
|
|
24228
24251
|
"\uFEFF" === t2[0] && (t2 = t2.substr(1));
|
|
24229
24252
|
for (let r6 = 0; r6 < t2.length; r6++) if ("<" === t2[r6] && "?" === t2[r6 + 1]) {
|
|
24230
|
-
if (r6 += 2, r6 =
|
|
24253
|
+
if (r6 += 2, r6 = p2(t2, r6), r6.err) return r6;
|
|
24231
24254
|
} else {
|
|
24232
24255
|
if ("<" !== t2[r6]) {
|
|
24233
|
-
if (
|
|
24256
|
+
if (u(t2[r6])) continue;
|
|
24234
24257
|
return b5("InvalidChar", "char '" + t2[r6] + "' is not expected.", w(t2, r6));
|
|
24235
24258
|
}
|
|
24236
24259
|
{
|
|
@@ -24244,7 +24267,7 @@ var require_fxp = __commonJS({
|
|
|
24244
24267
|
"/" === t2[r6] && (a6 = true, r6++);
|
|
24245
24268
|
let h6 = "";
|
|
24246
24269
|
for (; r6 < t2.length && ">" !== t2[r6] && " " !== t2[r6] && " " !== t2[r6] && "\n" !== t2[r6] && "\r" !== t2[r6]; r6++) h6 += t2[r6];
|
|
24247
|
-
if (h6 = h6.trim(), "/" === h6[h6.length - 1] && (h6 = h6.substring(0, h6.length - 1), r6--), !
|
|
24270
|
+
if (h6 = h6.trim(), "/" === h6[h6.length - 1] && (h6 = h6.substring(0, h6.length - 1), r6--), !E(h6)) {
|
|
24248
24271
|
let e7;
|
|
24249
24272
|
return e7 = 0 === h6.trim().length ? "Invalid space after '<'." : "Tag '" + h6 + "' is an invalid name.", b5("InvalidTag", e7, w(t2, r6));
|
|
24250
24273
|
}
|
|
@@ -24252,28 +24275,28 @@ var require_fxp = __commonJS({
|
|
|
24252
24275
|
if (false === l4) return b5("InvalidAttr", "Attributes for '" + h6 + "' have open quote.", w(t2, r6));
|
|
24253
24276
|
let d6 = l4.value;
|
|
24254
24277
|
if (r6 = l4.index, "/" === d6[d6.length - 1]) {
|
|
24255
|
-
const
|
|
24278
|
+
const n4 = r6 - d6.length;
|
|
24256
24279
|
d6 = d6.substring(0, d6.length - 1);
|
|
24257
24280
|
const s3 = x(d6, e6);
|
|
24258
|
-
if (true !== s3) return b5(s3.err.code, s3.err.msg, w(t2,
|
|
24259
|
-
|
|
24281
|
+
if (true !== s3) return b5(s3.err.code, s3.err.msg, w(t2, n4 + s3.err.line));
|
|
24282
|
+
i6 = true;
|
|
24260
24283
|
} else if (a6) {
|
|
24261
24284
|
if (!l4.tagClosed) return b5("InvalidTag", "Closing tag '" + h6 + "' doesn't have proper closing.", w(t2, r6));
|
|
24262
24285
|
if (d6.trim().length > 0) return b5("InvalidTag", "Closing tag '" + h6 + "' can't have attributes or invalid starting.", w(t2, o3));
|
|
24263
|
-
if (0 ===
|
|
24286
|
+
if (0 === n3.length) return b5("InvalidTag", "Closing tag '" + h6 + "' has not been opened.", w(t2, o3));
|
|
24264
24287
|
{
|
|
24265
|
-
const e7 =
|
|
24288
|
+
const e7 = n3.pop();
|
|
24266
24289
|
if (h6 !== e7.tagName) {
|
|
24267
|
-
let
|
|
24268
|
-
return b5("InvalidTag", "Expected closing tag '" + e7.tagName + "' (opened in line " +
|
|
24290
|
+
let n4 = w(t2, e7.tagStartPos);
|
|
24291
|
+
return b5("InvalidTag", "Expected closing tag '" + e7.tagName + "' (opened in line " + n4.line + ", col " + n4.col + ") instead of closing tag '" + h6 + "'.", w(t2, o3));
|
|
24269
24292
|
}
|
|
24270
|
-
0 ==
|
|
24293
|
+
0 == n3.length && (s2 = true);
|
|
24271
24294
|
}
|
|
24272
24295
|
} else {
|
|
24273
24296
|
const a7 = x(d6, e6);
|
|
24274
24297
|
if (true !== a7) return b5(a7.err.code, a7.err.msg, w(t2, r6 - d6.length + a7.err.line));
|
|
24275
24298
|
if (true === s2) return b5("InvalidXml", "Multiple possible root nodes found.", w(t2, r6));
|
|
24276
|
-
-1 !== e6.unpairedTags.indexOf(h6) ||
|
|
24299
|
+
-1 !== e6.unpairedTags.indexOf(h6) || n3.push({ tagName: h6, tagStartPos: o3 }), i6 = true;
|
|
24277
24300
|
}
|
|
24278
24301
|
for (r6++; r6 < t2.length; r6++) if ("<" === t2[r6]) {
|
|
24279
24302
|
if ("!" === t2[r6 + 1]) {
|
|
@@ -24281,26 +24304,26 @@ var require_fxp = __commonJS({
|
|
|
24281
24304
|
continue;
|
|
24282
24305
|
}
|
|
24283
24306
|
if ("?" !== t2[r6 + 1]) break;
|
|
24284
|
-
if (r6 =
|
|
24307
|
+
if (r6 = p2(t2, ++r6), r6.err) return r6;
|
|
24285
24308
|
} else if ("&" === t2[r6]) {
|
|
24286
24309
|
const e7 = N(t2, r6);
|
|
24287
24310
|
if (-1 == e7) return b5("InvalidChar", "char '&' is not expected.", w(t2, r6));
|
|
24288
24311
|
r6 = e7;
|
|
24289
|
-
} else if (true === s2 && !
|
|
24312
|
+
} else if (true === s2 && !u(t2[r6])) return b5("InvalidXml", "Extra text at the end", w(t2, r6));
|
|
24290
24313
|
"<" === t2[r6] && r6--;
|
|
24291
24314
|
}
|
|
24292
24315
|
}
|
|
24293
24316
|
}
|
|
24294
|
-
return
|
|
24317
|
+
return i6 ? 1 == n3.length ? b5("InvalidTag", "Unclosed tag '" + n3[0].tagName + "'.", w(t2, n3[0].tagStartPos)) : !(n3.length > 0) || b5("InvalidXml", "Invalid '" + JSON.stringify(n3.map((t3) => t3.tagName), null, 4).replace(/\r?\n/g, "") + "' found.", { line: 1, col: 1 }) : b5("InvalidXml", "Start tag expected.", 1);
|
|
24295
24318
|
}
|
|
24296
|
-
function
|
|
24319
|
+
function u(t2) {
|
|
24297
24320
|
return " " === t2 || " " === t2 || "\n" === t2 || "\r" === t2;
|
|
24298
24321
|
}
|
|
24299
|
-
function
|
|
24300
|
-
const
|
|
24322
|
+
function p2(t2, e6) {
|
|
24323
|
+
const n3 = e6;
|
|
24301
24324
|
for (; e6 < t2.length; e6++) if ("?" == t2[e6] || " " == t2[e6]) {
|
|
24302
|
-
const
|
|
24303
|
-
if (e6 > 5 && "xml" ===
|
|
24325
|
+
const i6 = t2.substr(n3, e6 - n3);
|
|
24326
|
+
if (e6 > 5 && "xml" === i6) return b5("InvalidXml", "XML declaration allowed only at the start of the document.", w(t2, e6));
|
|
24304
24327
|
if ("?" == t2[e6] && ">" == t2[e6 + 1]) {
|
|
24305
24328
|
e6++;
|
|
24306
24329
|
break;
|
|
@@ -24316,9 +24339,9 @@ var require_fxp = __commonJS({
|
|
|
24316
24339
|
break;
|
|
24317
24340
|
}
|
|
24318
24341
|
} else if (t2.length > e6 + 8 && "D" === t2[e6 + 1] && "O" === t2[e6 + 2] && "C" === t2[e6 + 3] && "T" === t2[e6 + 4] && "Y" === t2[e6 + 5] && "P" === t2[e6 + 6] && "E" === t2[e6 + 7]) {
|
|
24319
|
-
let
|
|
24320
|
-
for (e6 += 8; e6 < t2.length; e6++) if ("<" === t2[e6])
|
|
24321
|
-
else if (">" === t2[e6] && (
|
|
24342
|
+
let n3 = 1;
|
|
24343
|
+
for (e6 += 8; e6 < t2.length; e6++) if ("<" === t2[e6]) n3++;
|
|
24344
|
+
else if (">" === t2[e6] && (n3--, 0 === n3)) break;
|
|
24322
24345
|
} else if (t2.length > e6 + 9 && "[" === t2[e6 + 1] && "C" === t2[e6 + 2] && "D" === t2[e6 + 3] && "A" === t2[e6 + 4] && "T" === t2[e6 + 5] && "A" === t2[e6 + 6] && "[" === t2[e6 + 7]) {
|
|
24323
24346
|
for (e6 += 8; e6 < t2.length; e6++) if ("]" === t2[e6] && "]" === t2[e6 + 1] && ">" === t2[e6 + 2]) {
|
|
24324
24347
|
e6 += 2;
|
|
@@ -24329,88 +24352,88 @@ var require_fxp = __commonJS({
|
|
|
24329
24352
|
}
|
|
24330
24353
|
const d5 = '"', f5 = "'";
|
|
24331
24354
|
function g5(t2, e6) {
|
|
24332
|
-
let
|
|
24355
|
+
let n3 = "", i6 = "", s2 = false;
|
|
24333
24356
|
for (; e6 < t2.length; e6++) {
|
|
24334
|
-
if (t2[e6] === d5 || t2[e6] === f5) "" ===
|
|
24335
|
-
else if (">" === t2[e6] && "" ===
|
|
24357
|
+
if (t2[e6] === d5 || t2[e6] === f5) "" === i6 ? i6 = t2[e6] : i6 !== t2[e6] || (i6 = "");
|
|
24358
|
+
else if (">" === t2[e6] && "" === i6) {
|
|
24336
24359
|
s2 = true;
|
|
24337
24360
|
break;
|
|
24338
24361
|
}
|
|
24339
|
-
|
|
24362
|
+
n3 += t2[e6];
|
|
24340
24363
|
}
|
|
24341
|
-
return "" ===
|
|
24364
|
+
return "" === i6 && { value: n3, index: e6, tagClosed: s2 };
|
|
24342
24365
|
}
|
|
24343
24366
|
const m3 = new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`, "g");
|
|
24344
24367
|
function x(t2, e6) {
|
|
24345
|
-
const
|
|
24346
|
-
for (let t3 = 0; t3 <
|
|
24347
|
-
if (0 ===
|
|
24348
|
-
if (void 0 !==
|
|
24349
|
-
if (void 0 ===
|
|
24350
|
-
const s2 =
|
|
24351
|
-
if (!
|
|
24352
|
-
if (Object.prototype.hasOwnProperty.call(
|
|
24353
|
-
|
|
24368
|
+
const n3 = s(t2, m3), i6 = {};
|
|
24369
|
+
for (let t3 = 0; t3 < n3.length; t3++) {
|
|
24370
|
+
if (0 === n3[t3][1].length) return b5("InvalidAttr", "Attribute '" + n3[t3][2] + "' has no space in starting.", v(n3[t3]));
|
|
24371
|
+
if (void 0 !== n3[t3][3] && void 0 === n3[t3][4]) return b5("InvalidAttr", "Attribute '" + n3[t3][2] + "' is without value.", v(n3[t3]));
|
|
24372
|
+
if (void 0 === n3[t3][3] && !e6.allowBooleanAttributes) return b5("InvalidAttr", "boolean attribute '" + n3[t3][2] + "' is not allowed.", v(n3[t3]));
|
|
24373
|
+
const s2 = n3[t3][2];
|
|
24374
|
+
if (!y(s2)) return b5("InvalidAttr", "Attribute '" + s2 + "' is an invalid name.", v(n3[t3]));
|
|
24375
|
+
if (Object.prototype.hasOwnProperty.call(i6, s2)) return b5("InvalidAttr", "Attribute '" + s2 + "' is repeated.", v(n3[t3]));
|
|
24376
|
+
i6[s2] = 1;
|
|
24354
24377
|
}
|
|
24355
24378
|
return true;
|
|
24356
24379
|
}
|
|
24357
24380
|
function N(t2, e6) {
|
|
24358
24381
|
if (";" === t2[++e6]) return -1;
|
|
24359
24382
|
if ("#" === t2[e6]) return (function(t3, e7) {
|
|
24360
|
-
let
|
|
24361
|
-
for ("x" === t3[e7] && (e7++,
|
|
24383
|
+
let n4 = /\d/;
|
|
24384
|
+
for ("x" === t3[e7] && (e7++, n4 = /[\da-fA-F]/); e7 < t3.length; e7++) {
|
|
24362
24385
|
if (";" === t3[e7]) return e7;
|
|
24363
|
-
if (!t3[e7].match(
|
|
24386
|
+
if (!t3[e7].match(n4)) break;
|
|
24364
24387
|
}
|
|
24365
24388
|
return -1;
|
|
24366
24389
|
})(t2, ++e6);
|
|
24367
|
-
let
|
|
24368
|
-
for (; e6 < t2.length; e6++,
|
|
24390
|
+
let n3 = 0;
|
|
24391
|
+
for (; e6 < t2.length; e6++, n3++) if (!(t2[e6].match(/\w/) && n3 < 20)) {
|
|
24369
24392
|
if (";" === t2[e6]) break;
|
|
24370
24393
|
return -1;
|
|
24371
24394
|
}
|
|
24372
24395
|
return e6;
|
|
24373
24396
|
}
|
|
24374
|
-
function b5(t2, e6,
|
|
24375
|
-
return { err: { code: t2, msg: e6, line:
|
|
24397
|
+
function b5(t2, e6, n3) {
|
|
24398
|
+
return { err: { code: t2, msg: e6, line: n3.line || n3, col: n3.col } };
|
|
24376
24399
|
}
|
|
24377
|
-
function
|
|
24400
|
+
function y(t2) {
|
|
24378
24401
|
return r5(t2);
|
|
24379
24402
|
}
|
|
24380
|
-
function
|
|
24403
|
+
function E(t2) {
|
|
24381
24404
|
return r5(t2);
|
|
24382
24405
|
}
|
|
24383
24406
|
function w(t2, e6) {
|
|
24384
|
-
const
|
|
24385
|
-
return { line:
|
|
24407
|
+
const n3 = t2.substring(0, e6).split(/\r?\n/);
|
|
24408
|
+
return { line: n3.length, col: n3[n3.length - 1].length + 1 };
|
|
24386
24409
|
}
|
|
24387
24410
|
function v(t2) {
|
|
24388
24411
|
return t2.startIndex + t2[1].length;
|
|
24389
24412
|
}
|
|
24390
|
-
const
|
|
24413
|
+
const S = (t2) => o2.includes(t2) ? "__" + t2 : t2, _ = { preserveOrder: false, attributeNamePrefix: "@_", attributesGroupName: false, textNodeName: "#text", ignoreAttributes: true, removeNSPrefix: false, allowBooleanAttributes: false, parseTagValue: true, parseAttributeValue: false, trimValues: true, cdataPropName: false, numberParseOptions: { hex: true, leadingZeros: true, eNotation: true }, tagValueProcessor: function(t2, e6) {
|
|
24391
24414
|
return e6;
|
|
24392
24415
|
}, attributeValueProcessor: function(t2, e6) {
|
|
24393
24416
|
return e6;
|
|
24394
|
-
}, stopNodes: [], alwaysCreateTextNode: false, isArray: () => false, commentPropName: false, unpairedTags: [], processEntities: true, htmlEntities: false, ignoreDeclaration: false, ignorePiTags: false, transformTagName: false, transformAttributeName: false, updateTag: function(t2, e6,
|
|
24417
|
+
}, stopNodes: [], alwaysCreateTextNode: false, isArray: () => false, commentPropName: false, unpairedTags: [], processEntities: true, htmlEntities: false, entityDecoder: null, ignoreDeclaration: false, ignorePiTags: false, transformTagName: false, transformAttributeName: false, updateTag: function(t2, e6, n3) {
|
|
24395
24418
|
return t2;
|
|
24396
|
-
}, captureMetaData: false, maxNestedTags: 100, strictReservedNames: true, jPath: true, onDangerousProperty:
|
|
24397
|
-
function
|
|
24419
|
+
}, captureMetaData: false, maxNestedTags: 100, strictReservedNames: true, jPath: true, onDangerousProperty: S };
|
|
24420
|
+
function A(t2, e6) {
|
|
24398
24421
|
if ("string" != typeof t2) return;
|
|
24399
|
-
const
|
|
24400
|
-
if (o2.some((t3) =>
|
|
24401
|
-
if (a5.some((t3) =>
|
|
24422
|
+
const n3 = t2.toLowerCase();
|
|
24423
|
+
if (o2.some((t3) => n3 === t3.toLowerCase())) throw new Error(`[SECURITY] Invalid ${e6}: "${t2}" is a reserved JavaScript keyword that could cause prototype pollution`);
|
|
24424
|
+
if (a5.some((t3) => n3 === t3.toLowerCase())) throw new Error(`[SECURITY] Invalid ${e6}: "${t2}" is a reserved JavaScript keyword that could cause prototype pollution`);
|
|
24402
24425
|
}
|
|
24403
|
-
function
|
|
24404
|
-
return "boolean" == typeof t2 ? { enabled: t2, maxEntitySize: 1e4, maxExpansionDepth:
|
|
24426
|
+
function T(t2, e6) {
|
|
24427
|
+
return "boolean" == typeof t2 ? { enabled: t2, maxEntitySize: 1e4, maxExpansionDepth: 1e4, maxTotalExpansions: 1 / 0, maxExpandedLength: 1e5, maxEntityCount: 1e3, allowedTags: null, tagFilter: null, appliesTo: "all" } : "object" == typeof t2 && null !== t2 ? { enabled: false !== t2.enabled, maxEntitySize: Math.max(1, t2.maxEntitySize ?? 1e4), maxExpansionDepth: Math.max(1, t2.maxExpansionDepth ?? 1e4), maxTotalExpansions: Math.max(1, t2.maxTotalExpansions ?? 1 / 0), maxExpandedLength: Math.max(1, t2.maxExpandedLength ?? 1e5), maxEntityCount: Math.max(1, t2.maxEntityCount ?? 1e3), allowedTags: t2.allowedTags ?? null, tagFilter: t2.tagFilter ?? null, appliesTo: t2.appliesTo ?? "all" } : T(true);
|
|
24405
24428
|
}
|
|
24406
|
-
const
|
|
24407
|
-
const e6 = Object.assign({},
|
|
24408
|
-
for (const { value: t3, name: e7 } of
|
|
24409
|
-
return null === e6.onDangerousProperty && (e6.onDangerousProperty =
|
|
24429
|
+
const C = function(t2) {
|
|
24430
|
+
const e6 = Object.assign({}, _, t2), n3 = [{ value: e6.attributeNamePrefix, name: "attributeNamePrefix" }, { value: e6.attributesGroupName, name: "attributesGroupName" }, { value: e6.textNodeName, name: "textNodeName" }, { value: e6.cdataPropName, name: "cdataPropName" }, { value: e6.commentPropName, name: "commentPropName" }];
|
|
24431
|
+
for (const { value: t3, name: e7 } of n3) t3 && A(t3, e7);
|
|
24432
|
+
return null === e6.onDangerousProperty && (e6.onDangerousProperty = S), e6.processEntities = T(e6.processEntities, e6.htmlEntities), e6.unpairedTagsSet = new Set(e6.unpairedTags), e6.stopNodes && Array.isArray(e6.stopNodes) && (e6.stopNodes = e6.stopNodes.map((t3) => "string" == typeof t3 && t3.startsWith("*.") ? ".." + t3.substring(2) : t3)), e6;
|
|
24410
24433
|
};
|
|
24411
|
-
let
|
|
24412
|
-
|
|
24413
|
-
class
|
|
24434
|
+
let P;
|
|
24435
|
+
P = "function" != typeof Symbol ? "@@xmlMetadata" : /* @__PURE__ */ Symbol("XML Node Metadata");
|
|
24436
|
+
class O {
|
|
24414
24437
|
constructor(t2) {
|
|
24415
24438
|
this.tagname = t2, this.child = [], this[":@"] = /* @__PURE__ */ Object.create(null);
|
|
24416
24439
|
}
|
|
@@ -24418,19 +24441,19 @@ var require_fxp = __commonJS({
|
|
|
24418
24441
|
"__proto__" === t2 && (t2 = "#__proto__"), this.child.push({ [t2]: e6 });
|
|
24419
24442
|
}
|
|
24420
24443
|
addChild(t2, e6) {
|
|
24421
|
-
"__proto__" === t2.tagname && (t2.tagname = "#__proto__"), t2[":@"] && Object.keys(t2[":@"]).length > 0 ? this.child.push({ [t2.tagname]: t2.child, ":@": t2[":@"] }) : this.child.push({ [t2.tagname]: t2.child }), void 0 !== e6 && (this.child[this.child.length - 1][
|
|
24444
|
+
"__proto__" === t2.tagname && (t2.tagname = "#__proto__"), t2[":@"] && Object.keys(t2[":@"]).length > 0 ? this.child.push({ [t2.tagname]: t2.child, ":@": t2[":@"] }) : this.child.push({ [t2.tagname]: t2.child }), void 0 !== e6 && (this.child[this.child.length - 1][P] = { startIndex: e6 });
|
|
24422
24445
|
}
|
|
24423
24446
|
static getMetaDataSymbol() {
|
|
24424
|
-
return
|
|
24447
|
+
return P;
|
|
24425
24448
|
}
|
|
24426
24449
|
}
|
|
24427
|
-
class
|
|
24450
|
+
class $ {
|
|
24428
24451
|
constructor(t2) {
|
|
24429
24452
|
this.suppressValidationErr = !t2, this.options = t2;
|
|
24430
24453
|
}
|
|
24431
24454
|
readDocType(t2, e6) {
|
|
24432
|
-
const
|
|
24433
|
-
let
|
|
24455
|
+
const n3 = /* @__PURE__ */ Object.create(null);
|
|
24456
|
+
let i6 = 0;
|
|
24434
24457
|
if ("O" !== t2[e6 + 3] || "C" !== t2[e6 + 4] || "T" !== t2[e6 + 5] || "Y" !== t2[e6 + 6] || "P" !== t2[e6 + 7] || "E" !== t2[e6 + 8]) throw new Error("Invalid Tag instead of DOCTYPE");
|
|
24435
24458
|
{
|
|
24436
24459
|
e6 += 9;
|
|
@@ -24439,146 +24462,198 @@ var require_fxp = __commonJS({
|
|
|
24439
24462
|
if (o3 ? "-" === t2[e6 - 1] && "-" === t2[e6 - 2] && (o3 = false, s2--) : s2--, 0 === s2) break;
|
|
24440
24463
|
} else "[" === t2[e6] ? r6 = true : a6 += t2[e6];
|
|
24441
24464
|
else {
|
|
24442
|
-
if (r6 &&
|
|
24465
|
+
if (r6 && D(t2, "!ENTITY", e6)) {
|
|
24443
24466
|
let s3, r7;
|
|
24444
24467
|
if (e6 += 7, [s3, r7, e6] = this.readEntityExp(t2, e6 + 1, this.suppressValidationErr), -1 === r7.indexOf("&")) {
|
|
24445
|
-
if (false !== this.options.enabled && null != this.options.maxEntityCount &&
|
|
24446
|
-
|
|
24447
|
-
i6[s3] = { regx: RegExp(`&${t3};`, "g"), val: r7 }, n3++;
|
|
24468
|
+
if (false !== this.options.enabled && null != this.options.maxEntityCount && i6 >= this.options.maxEntityCount) throw new Error(`Entity count (${i6 + 1}) exceeds maximum allowed (${this.options.maxEntityCount})`);
|
|
24469
|
+
n3[s3] = r7, i6++;
|
|
24448
24470
|
}
|
|
24449
|
-
} else if (r6 &&
|
|
24471
|
+
} else if (r6 && D(t2, "!ELEMENT", e6)) {
|
|
24450
24472
|
e6 += 8;
|
|
24451
|
-
const { index:
|
|
24452
|
-
e6 =
|
|
24453
|
-
} else if (r6 &&
|
|
24454
|
-
else if (r6 &&
|
|
24473
|
+
const { index: n4 } = this.readElementExp(t2, e6 + 1);
|
|
24474
|
+
e6 = n4;
|
|
24475
|
+
} else if (r6 && D(t2, "!ATTLIST", e6)) e6 += 8;
|
|
24476
|
+
else if (r6 && D(t2, "!NOTATION", e6)) {
|
|
24455
24477
|
e6 += 9;
|
|
24456
|
-
const { index:
|
|
24457
|
-
e6 =
|
|
24478
|
+
const { index: n4 } = this.readNotationExp(t2, e6 + 1, this.suppressValidationErr);
|
|
24479
|
+
e6 = n4;
|
|
24458
24480
|
} else {
|
|
24459
|
-
if (!
|
|
24481
|
+
if (!D(t2, "!--", e6)) throw new Error("Invalid DOCTYPE");
|
|
24460
24482
|
o3 = true;
|
|
24461
24483
|
}
|
|
24462
24484
|
s2++, a6 = "";
|
|
24463
24485
|
}
|
|
24464
24486
|
if (0 !== s2) throw new Error("Unclosed DOCTYPE");
|
|
24465
24487
|
}
|
|
24466
|
-
return { entities:
|
|
24488
|
+
return { entities: n3, i: e6 };
|
|
24467
24489
|
}
|
|
24468
24490
|
readEntityExp(t2, e6) {
|
|
24469
|
-
const
|
|
24491
|
+
const n3 = e6 = I(t2, e6);
|
|
24470
24492
|
for (; e6 < t2.length && !/\s/.test(t2[e6]) && '"' !== t2[e6] && "'" !== t2[e6]; ) e6++;
|
|
24471
|
-
let
|
|
24472
|
-
if (
|
|
24493
|
+
let i6 = t2.substring(n3, e6);
|
|
24494
|
+
if (M(i6), e6 = I(t2, e6), !this.suppressValidationErr) {
|
|
24473
24495
|
if ("SYSTEM" === t2.substring(e6, e6 + 6).toUpperCase()) throw new Error("External entities are not supported");
|
|
24474
24496
|
if ("%" === t2[e6]) throw new Error("Parameter entities are not supported");
|
|
24475
24497
|
}
|
|
24476
24498
|
let s2 = "";
|
|
24477
|
-
if ([e6, s2] = this.readIdentifierVal(t2, e6, "entity"), false !== this.options.enabled && null != this.options.maxEntitySize && s2.length > this.options.maxEntitySize) throw new Error(`Entity "${
|
|
24478
|
-
return [
|
|
24499
|
+
if ([e6, s2] = this.readIdentifierVal(t2, e6, "entity"), false !== this.options.enabled && null != this.options.maxEntitySize && s2.length > this.options.maxEntitySize) throw new Error(`Entity "${i6}" size (${s2.length}) exceeds maximum allowed size (${this.options.maxEntitySize})`);
|
|
24500
|
+
return [i6, s2, --e6];
|
|
24479
24501
|
}
|
|
24480
24502
|
readNotationExp(t2, e6) {
|
|
24481
|
-
const
|
|
24503
|
+
const n3 = e6 = I(t2, e6);
|
|
24482
24504
|
for (; e6 < t2.length && !/\s/.test(t2[e6]); ) e6++;
|
|
24483
|
-
let
|
|
24484
|
-
!this.suppressValidationErr &&
|
|
24505
|
+
let i6 = t2.substring(n3, e6);
|
|
24506
|
+
!this.suppressValidationErr && M(i6), e6 = I(t2, e6);
|
|
24485
24507
|
const s2 = t2.substring(e6, e6 + 6).toUpperCase();
|
|
24486
24508
|
if (!this.suppressValidationErr && "SYSTEM" !== s2 && "PUBLIC" !== s2) throw new Error(`Expected SYSTEM or PUBLIC, found "${s2}"`);
|
|
24487
|
-
e6 += s2.length, e6 =
|
|
24509
|
+
e6 += s2.length, e6 = I(t2, e6);
|
|
24488
24510
|
let r6 = null, o3 = null;
|
|
24489
|
-
if ("PUBLIC" === s2) [e6, r6] = this.readIdentifierVal(t2, e6, "publicIdentifier"), '"' !== t2[e6 =
|
|
24511
|
+
if ("PUBLIC" === s2) [e6, r6] = this.readIdentifierVal(t2, e6, "publicIdentifier"), '"' !== t2[e6 = I(t2, e6)] && "'" !== t2[e6] || ([e6, o3] = this.readIdentifierVal(t2, e6, "systemIdentifier"));
|
|
24490
24512
|
else if ("SYSTEM" === s2 && ([e6, o3] = this.readIdentifierVal(t2, e6, "systemIdentifier"), !this.suppressValidationErr && !o3)) throw new Error("Missing mandatory system identifier for SYSTEM notation");
|
|
24491
|
-
return { notationName:
|
|
24513
|
+
return { notationName: i6, publicIdentifier: r6, systemIdentifier: o3, index: --e6 };
|
|
24492
24514
|
}
|
|
24493
|
-
readIdentifierVal(t2, e6,
|
|
24494
|
-
let
|
|
24515
|
+
readIdentifierVal(t2, e6, n3) {
|
|
24516
|
+
let i6 = "";
|
|
24495
24517
|
const s2 = t2[e6];
|
|
24496
24518
|
if ('"' !== s2 && "'" !== s2) throw new Error(`Expected quoted string, found "${s2}"`);
|
|
24497
24519
|
const r6 = ++e6;
|
|
24498
24520
|
for (; e6 < t2.length && t2[e6] !== s2; ) e6++;
|
|
24499
|
-
if (
|
|
24500
|
-
return [++e6,
|
|
24521
|
+
if (i6 = t2.substring(r6, e6), t2[e6] !== s2) throw new Error(`Unterminated ${n3} value`);
|
|
24522
|
+
return [++e6, i6];
|
|
24501
24523
|
}
|
|
24502
24524
|
readElementExp(t2, e6) {
|
|
24503
|
-
const
|
|
24525
|
+
const n3 = e6 = I(t2, e6);
|
|
24504
24526
|
for (; e6 < t2.length && !/\s/.test(t2[e6]); ) e6++;
|
|
24505
|
-
let
|
|
24506
|
-
if (!this.suppressValidationErr && !r5(
|
|
24527
|
+
let i6 = t2.substring(n3, e6);
|
|
24528
|
+
if (!this.suppressValidationErr && !r5(i6)) throw new Error(`Invalid element name: "${i6}"`);
|
|
24507
24529
|
let s2 = "";
|
|
24508
|
-
if ("E" === t2[e6 =
|
|
24509
|
-
else if ("A" === t2[e6] &&
|
|
24530
|
+
if ("E" === t2[e6 = I(t2, e6)] && D(t2, "MPTY", e6)) e6 += 4;
|
|
24531
|
+
else if ("A" === t2[e6] && D(t2, "NY", e6)) e6 += 2;
|
|
24510
24532
|
else if ("(" === t2[e6]) {
|
|
24511
|
-
const
|
|
24533
|
+
const n4 = ++e6;
|
|
24512
24534
|
for (; e6 < t2.length && ")" !== t2[e6]; ) e6++;
|
|
24513
|
-
if (s2 = t2.substring(
|
|
24535
|
+
if (s2 = t2.substring(n4, e6), ")" !== t2[e6]) throw new Error("Unterminated content model");
|
|
24514
24536
|
} else if (!this.suppressValidationErr) throw new Error(`Invalid Element Expression, found "${t2[e6]}"`);
|
|
24515
|
-
return { elementName:
|
|
24537
|
+
return { elementName: i6, contentModel: s2.trim(), index: e6 };
|
|
24516
24538
|
}
|
|
24517
24539
|
readAttlistExp(t2, e6) {
|
|
24518
|
-
let
|
|
24540
|
+
let n3 = e6 = I(t2, e6);
|
|
24519
24541
|
for (; e6 < t2.length && !/\s/.test(t2[e6]); ) e6++;
|
|
24520
|
-
let
|
|
24521
|
-
for (
|
|
24522
|
-
let s2 = t2.substring(
|
|
24523
|
-
if (!
|
|
24524
|
-
e6 =
|
|
24542
|
+
let i6 = t2.substring(n3, e6);
|
|
24543
|
+
for (M(i6), n3 = e6 = I(t2, e6); e6 < t2.length && !/\s/.test(t2[e6]); ) e6++;
|
|
24544
|
+
let s2 = t2.substring(n3, e6);
|
|
24545
|
+
if (!M(s2)) throw new Error(`Invalid attribute name: "${s2}"`);
|
|
24546
|
+
e6 = I(t2, e6);
|
|
24525
24547
|
let r6 = "";
|
|
24526
24548
|
if ("NOTATION" === t2.substring(e6, e6 + 8).toUpperCase()) {
|
|
24527
|
-
if (r6 = "NOTATION", "(" !== t2[e6 =
|
|
24549
|
+
if (r6 = "NOTATION", "(" !== t2[e6 = I(t2, e6 += 8)]) throw new Error(`Expected '(', found "${t2[e6]}"`);
|
|
24528
24550
|
e6++;
|
|
24529
|
-
let
|
|
24551
|
+
let n4 = [];
|
|
24530
24552
|
for (; e6 < t2.length && ")" !== t2[e6]; ) {
|
|
24531
|
-
const
|
|
24553
|
+
const i7 = e6;
|
|
24532
24554
|
for (; e6 < t2.length && "|" !== t2[e6] && ")" !== t2[e6]; ) e6++;
|
|
24533
|
-
let s3 = t2.substring(
|
|
24534
|
-
if (s3 = s3.trim(), !
|
|
24535
|
-
|
|
24555
|
+
let s3 = t2.substring(i7, e6);
|
|
24556
|
+
if (s3 = s3.trim(), !M(s3)) throw new Error(`Invalid notation name: "${s3}"`);
|
|
24557
|
+
n4.push(s3), "|" === t2[e6] && (e6++, e6 = I(t2, e6));
|
|
24536
24558
|
}
|
|
24537
24559
|
if (")" !== t2[e6]) throw new Error("Unterminated list of notations");
|
|
24538
|
-
e6++, r6 += " (" +
|
|
24560
|
+
e6++, r6 += " (" + n4.join("|") + ")";
|
|
24539
24561
|
} else {
|
|
24540
|
-
const
|
|
24562
|
+
const n4 = e6;
|
|
24541
24563
|
for (; e6 < t2.length && !/\s/.test(t2[e6]); ) e6++;
|
|
24542
|
-
r6 += t2.substring(
|
|
24543
|
-
const
|
|
24544
|
-
if (!this.suppressValidationErr && !
|
|
24564
|
+
r6 += t2.substring(n4, e6);
|
|
24565
|
+
const i7 = ["CDATA", "ID", "IDREF", "IDREFS", "ENTITY", "ENTITIES", "NMTOKEN", "NMTOKENS"];
|
|
24566
|
+
if (!this.suppressValidationErr && !i7.includes(r6.toUpperCase())) throw new Error(`Invalid attribute type: "${r6}"`);
|
|
24545
24567
|
}
|
|
24546
|
-
e6 =
|
|
24568
|
+
e6 = I(t2, e6);
|
|
24547
24569
|
let o3 = "";
|
|
24548
|
-
return "#REQUIRED" === t2.substring(e6, e6 + 8).toUpperCase() ? (o3 = "#REQUIRED", e6 += 8) : "#IMPLIED" === t2.substring(e6, e6 + 7).toUpperCase() ? (o3 = "#IMPLIED", e6 += 7) : [e6, o3] = this.readIdentifierVal(t2, e6, "ATTLIST"), { elementName:
|
|
24570
|
+
return "#REQUIRED" === t2.substring(e6, e6 + 8).toUpperCase() ? (o3 = "#REQUIRED", e6 += 8) : "#IMPLIED" === t2.substring(e6, e6 + 7).toUpperCase() ? (o3 = "#IMPLIED", e6 += 7) : [e6, o3] = this.readIdentifierVal(t2, e6, "ATTLIST"), { elementName: i6, attributeName: s2, attributeType: r6, defaultValue: o3, index: e6 };
|
|
24549
24571
|
}
|
|
24550
24572
|
}
|
|
24551
|
-
const
|
|
24573
|
+
const I = (t2, e6) => {
|
|
24552
24574
|
for (; e6 < t2.length && /\s/.test(t2[e6]); ) e6++;
|
|
24553
24575
|
return e6;
|
|
24554
24576
|
};
|
|
24555
|
-
function
|
|
24556
|
-
for (let
|
|
24577
|
+
function D(t2, e6, n3) {
|
|
24578
|
+
for (let i6 = 0; i6 < e6.length; i6++) if (e6[i6] !== t2[n3 + i6 + 1]) return false;
|
|
24557
24579
|
return true;
|
|
24558
24580
|
}
|
|
24559
|
-
function
|
|
24581
|
+
function M(t2) {
|
|
24560
24582
|
if (r5(t2)) return t2;
|
|
24561
24583
|
throw new Error(`Invalid entity name ${t2}`);
|
|
24562
24584
|
}
|
|
24563
|
-
const
|
|
24564
|
-
const
|
|
24565
|
-
class
|
|
24585
|
+
const j5 = /^[-+]?0x[a-fA-F0-9]+$/, V = /^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/, L = { hex: true, leadingZeros: true, decimalPoint: ".", eNotation: true, infinity: "original" };
|
|
24586
|
+
const k5 = /^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/;
|
|
24587
|
+
class F {
|
|
24588
|
+
constructor(t2) {
|
|
24589
|
+
this._matcher = t2;
|
|
24590
|
+
}
|
|
24591
|
+
get separator() {
|
|
24592
|
+
return this._matcher.separator;
|
|
24593
|
+
}
|
|
24594
|
+
getCurrentTag() {
|
|
24595
|
+
const t2 = this._matcher.path;
|
|
24596
|
+
return t2.length > 0 ? t2[t2.length - 1].tag : void 0;
|
|
24597
|
+
}
|
|
24598
|
+
getCurrentNamespace() {
|
|
24599
|
+
const t2 = this._matcher.path;
|
|
24600
|
+
return t2.length > 0 ? t2[t2.length - 1].namespace : void 0;
|
|
24601
|
+
}
|
|
24602
|
+
getAttrValue(t2) {
|
|
24603
|
+
const e6 = this._matcher.path;
|
|
24604
|
+
if (0 !== e6.length) return e6[e6.length - 1].values?.[t2];
|
|
24605
|
+
}
|
|
24606
|
+
hasAttr(t2) {
|
|
24607
|
+
const e6 = this._matcher.path;
|
|
24608
|
+
if (0 === e6.length) return false;
|
|
24609
|
+
const n3 = e6[e6.length - 1];
|
|
24610
|
+
return void 0 !== n3.values && t2 in n3.values;
|
|
24611
|
+
}
|
|
24612
|
+
getPosition() {
|
|
24613
|
+
const t2 = this._matcher.path;
|
|
24614
|
+
return 0 === t2.length ? -1 : t2[t2.length - 1].position ?? 0;
|
|
24615
|
+
}
|
|
24616
|
+
getCounter() {
|
|
24617
|
+
const t2 = this._matcher.path;
|
|
24618
|
+
return 0 === t2.length ? -1 : t2[t2.length - 1].counter ?? 0;
|
|
24619
|
+
}
|
|
24620
|
+
getIndex() {
|
|
24621
|
+
return this.getPosition();
|
|
24622
|
+
}
|
|
24623
|
+
getDepth() {
|
|
24624
|
+
return this._matcher.path.length;
|
|
24625
|
+
}
|
|
24626
|
+
toString(t2, e6 = true) {
|
|
24627
|
+
return this._matcher.toString(t2, e6);
|
|
24628
|
+
}
|
|
24629
|
+
toArray() {
|
|
24630
|
+
return this._matcher.path.map((t2) => t2.tag);
|
|
24631
|
+
}
|
|
24632
|
+
matches(t2) {
|
|
24633
|
+
return this._matcher.matches(t2);
|
|
24634
|
+
}
|
|
24635
|
+
matchesAny(t2) {
|
|
24636
|
+
return t2.matchesAny(this._matcher);
|
|
24637
|
+
}
|
|
24638
|
+
}
|
|
24639
|
+
class R {
|
|
24566
24640
|
constructor(t2 = {}) {
|
|
24567
|
-
this.separator = t2.separator || ".", this.path = [], this.siblingStacks = [];
|
|
24641
|
+
this.separator = t2.separator || ".", this.path = [], this.siblingStacks = [], this._pathStringCache = null, this._view = new F(this);
|
|
24568
24642
|
}
|
|
24569
|
-
push(t2, e6 = null,
|
|
24570
|
-
this.path.length > 0 && (this.path[this.path.length - 1].values = void 0);
|
|
24571
|
-
const
|
|
24572
|
-
this.siblingStacks[
|
|
24573
|
-
const s2 = this.siblingStacks[
|
|
24643
|
+
push(t2, e6 = null, n3 = null) {
|
|
24644
|
+
this._pathStringCache = null, this.path.length > 0 && (this.path[this.path.length - 1].values = void 0);
|
|
24645
|
+
const i6 = this.path.length;
|
|
24646
|
+
this.siblingStacks[i6] || (this.siblingStacks[i6] = /* @__PURE__ */ new Map());
|
|
24647
|
+
const s2 = this.siblingStacks[i6], r6 = n3 ? `${n3}:${t2}` : t2, o3 = s2.get(r6) || 0;
|
|
24574
24648
|
let a6 = 0;
|
|
24575
24649
|
for (const t3 of s2.values()) a6 += t3;
|
|
24576
24650
|
s2.set(r6, o3 + 1);
|
|
24577
24651
|
const h6 = { tag: t2, position: a6, counter: o3 };
|
|
24578
|
-
null !=
|
|
24652
|
+
null != n3 && (h6.namespace = n3), null != e6 && (h6.values = e6), this.path.push(h6);
|
|
24579
24653
|
}
|
|
24580
24654
|
pop() {
|
|
24581
24655
|
if (0 === this.path.length) return;
|
|
24656
|
+
this._pathStringCache = null;
|
|
24582
24657
|
const t2 = this.path.pop();
|
|
24583
24658
|
return this.siblingStacks.length > this.path.length + 1 && (this.siblingStacks.length = this.path.length + 1), t2;
|
|
24584
24659
|
}
|
|
@@ -24595,9 +24670,7 @@ var require_fxp = __commonJS({
|
|
|
24595
24670
|
return this.path.length > 0 ? this.path[this.path.length - 1].namespace : void 0;
|
|
24596
24671
|
}
|
|
24597
24672
|
getAttrValue(t2) {
|
|
24598
|
-
if (0
|
|
24599
|
-
const e6 = this.path[this.path.length - 1];
|
|
24600
|
-
return e6.values?.[t2];
|
|
24673
|
+
if (0 !== this.path.length) return this.path[this.path.length - 1].values?.[t2];
|
|
24601
24674
|
}
|
|
24602
24675
|
hasAttr(t2) {
|
|
24603
24676
|
if (0 === this.path.length) return false;
|
|
@@ -24617,14 +24690,19 @@ var require_fxp = __commonJS({
|
|
|
24617
24690
|
return this.path.length;
|
|
24618
24691
|
}
|
|
24619
24692
|
toString(t2, e6 = true) {
|
|
24620
|
-
const
|
|
24621
|
-
|
|
24693
|
+
const n3 = t2 || this.separator;
|
|
24694
|
+
if (n3 === this.separator && true === e6) {
|
|
24695
|
+
if (null !== this._pathStringCache) return this._pathStringCache;
|
|
24696
|
+
const t3 = this.path.map((t4) => t4.namespace ? `${t4.namespace}:${t4.tag}` : t4.tag).join(n3);
|
|
24697
|
+
return this._pathStringCache = t3, t3;
|
|
24698
|
+
}
|
|
24699
|
+
return this.path.map((t3) => e6 && t3.namespace ? `${t3.namespace}:${t3.tag}` : t3.tag).join(n3);
|
|
24622
24700
|
}
|
|
24623
24701
|
toArray() {
|
|
24624
24702
|
return this.path.map((t2) => t2.tag);
|
|
24625
24703
|
}
|
|
24626
24704
|
reset() {
|
|
24627
|
-
this.path = [], this.siblingStacks = [];
|
|
24705
|
+
this._pathStringCache = null, this.path = [], this.siblingStacks = [];
|
|
24628
24706
|
}
|
|
24629
24707
|
matches(t2) {
|
|
24630
24708
|
const e6 = t2.segments;
|
|
@@ -24632,110 +24710,93 @@ var require_fxp = __commonJS({
|
|
|
24632
24710
|
}
|
|
24633
24711
|
_matchSimple(t2) {
|
|
24634
24712
|
if (this.path.length !== t2.length) return false;
|
|
24635
|
-
for (let e6 = 0; e6 < t2.length; e6++)
|
|
24636
|
-
const i6 = t2[e6], n3 = this.path[e6], s2 = e6 === this.path.length - 1;
|
|
24637
|
-
if (!this._matchSegment(i6, n3, s2)) return false;
|
|
24638
|
-
}
|
|
24713
|
+
for (let e6 = 0; e6 < t2.length; e6++) if (!this._matchSegment(t2[e6], this.path[e6], e6 === this.path.length - 1)) return false;
|
|
24639
24714
|
return true;
|
|
24640
24715
|
}
|
|
24641
24716
|
_matchWithDeepWildcard(t2) {
|
|
24642
|
-
let e6 = this.path.length - 1,
|
|
24643
|
-
for (;
|
|
24644
|
-
const
|
|
24645
|
-
if ("deep-wildcard" ===
|
|
24646
|
-
if (
|
|
24647
|
-
const
|
|
24717
|
+
let e6 = this.path.length - 1, n3 = t2.length - 1;
|
|
24718
|
+
for (; n3 >= 0 && e6 >= 0; ) {
|
|
24719
|
+
const i6 = t2[n3];
|
|
24720
|
+
if ("deep-wildcard" === i6.type) {
|
|
24721
|
+
if (n3--, n3 < 0) return true;
|
|
24722
|
+
const i7 = t2[n3];
|
|
24648
24723
|
let s2 = false;
|
|
24649
|
-
for (let t3 = e6; t3 >= 0; t3--) {
|
|
24650
|
-
|
|
24651
|
-
|
|
24652
|
-
e6 = t3 - 1, i6--, s2 = true;
|
|
24653
|
-
break;
|
|
24654
|
-
}
|
|
24724
|
+
for (let t3 = e6; t3 >= 0; t3--) if (this._matchSegment(i7, this.path[t3], t3 === this.path.length - 1)) {
|
|
24725
|
+
e6 = t3 - 1, n3--, s2 = true;
|
|
24726
|
+
break;
|
|
24655
24727
|
}
|
|
24656
24728
|
if (!s2) return false;
|
|
24657
24729
|
} else {
|
|
24658
|
-
|
|
24659
|
-
|
|
24660
|
-
e6--, i6--;
|
|
24730
|
+
if (!this._matchSegment(i6, this.path[e6], e6 === this.path.length - 1)) return false;
|
|
24731
|
+
e6--, n3--;
|
|
24661
24732
|
}
|
|
24662
24733
|
}
|
|
24663
|
-
return
|
|
24734
|
+
return n3 < 0;
|
|
24664
24735
|
}
|
|
24665
|
-
_matchSegment(t2, e6,
|
|
24736
|
+
_matchSegment(t2, e6, n3) {
|
|
24666
24737
|
if ("*" !== t2.tag && t2.tag !== e6.tag) return false;
|
|
24667
24738
|
if (void 0 !== t2.namespace && "*" !== t2.namespace && t2.namespace !== e6.namespace) return false;
|
|
24668
24739
|
if (void 0 !== t2.attrName) {
|
|
24669
|
-
if (!
|
|
24740
|
+
if (!n3) return false;
|
|
24670
24741
|
if (!e6.values || !(t2.attrName in e6.values)) return false;
|
|
24671
|
-
if (void 0 !== t2.attrValue)
|
|
24672
|
-
const i7 = e6.values[t2.attrName];
|
|
24673
|
-
if (String(i7) !== String(t2.attrValue)) return false;
|
|
24674
|
-
}
|
|
24742
|
+
if (void 0 !== t2.attrValue && String(e6.values[t2.attrName]) !== String(t2.attrValue)) return false;
|
|
24675
24743
|
}
|
|
24676
24744
|
if (void 0 !== t2.position) {
|
|
24677
|
-
if (!
|
|
24678
|
-
const
|
|
24679
|
-
if ("first" === t2.position && 0 !==
|
|
24680
|
-
if ("odd" === t2.position &&
|
|
24681
|
-
if ("even" === t2.position &&
|
|
24682
|
-
if ("nth" === t2.position &&
|
|
24745
|
+
if (!n3) return false;
|
|
24746
|
+
const i6 = e6.counter ?? 0;
|
|
24747
|
+
if ("first" === t2.position && 0 !== i6) return false;
|
|
24748
|
+
if ("odd" === t2.position && i6 % 2 != 1) return false;
|
|
24749
|
+
if ("even" === t2.position && i6 % 2 != 0) return false;
|
|
24750
|
+
if ("nth" === t2.position && i6 !== t2.positionValue) return false;
|
|
24683
24751
|
}
|
|
24684
24752
|
return true;
|
|
24685
24753
|
}
|
|
24754
|
+
matchesAny(t2) {
|
|
24755
|
+
return t2.matchesAny(this);
|
|
24756
|
+
}
|
|
24686
24757
|
snapshot() {
|
|
24687
24758
|
return { path: this.path.map((t2) => ({ ...t2 })), siblingStacks: this.siblingStacks.map((t2) => new Map(t2)) };
|
|
24688
24759
|
}
|
|
24689
24760
|
restore(t2) {
|
|
24690
|
-
this.path = t2.path.map((t3) => ({ ...t3 })), this.siblingStacks = t2.siblingStacks.map((t3) => new Map(t3));
|
|
24761
|
+
this._pathStringCache = null, this.path = t2.path.map((t3) => ({ ...t3 })), this.siblingStacks = t2.siblingStacks.map((t3) => new Map(t3));
|
|
24691
24762
|
}
|
|
24692
24763
|
readOnly() {
|
|
24693
|
-
return
|
|
24694
|
-
if (L.has(e6)) return () => {
|
|
24695
|
-
throw new TypeError(`Cannot call '${e6}' on a read-only Matcher. Obtain a writable instance to mutate state.`);
|
|
24696
|
-
};
|
|
24697
|
-
const n3 = Reflect.get(t2, e6, i6);
|
|
24698
|
-
return "path" === e6 || "siblingStacks" === e6 ? Object.freeze(Array.isArray(n3) ? n3.map((t3) => t3 instanceof Map ? Object.freeze(new Map(t3)) : Object.freeze({ ...t3 })) : n3) : "function" == typeof n3 ? n3.bind(t2) : n3;
|
|
24699
|
-
}, set(t2, e6) {
|
|
24700
|
-
throw new TypeError(`Cannot set property '${String(e6)}' on a read-only Matcher.`);
|
|
24701
|
-
}, deleteProperty(t2, e6) {
|
|
24702
|
-
throw new TypeError(`Cannot delete property '${String(e6)}' from a read-only Matcher.`);
|
|
24703
|
-
} });
|
|
24764
|
+
return this._view;
|
|
24704
24765
|
}
|
|
24705
24766
|
}
|
|
24706
|
-
class
|
|
24707
|
-
constructor(t2, e6 = {}) {
|
|
24708
|
-
this.pattern = t2, this.separator = e6.separator || ".", this.segments = this._parse(t2), this._hasDeepWildcard = this.segments.some((t3) => "deep-wildcard" === t3.type), this._hasAttributeCondition = this.segments.some((t3) => void 0 !== t3.attrName), this._hasPositionSelector = this.segments.some((t3) => void 0 !== t3.position);
|
|
24767
|
+
class G {
|
|
24768
|
+
constructor(t2, e6 = {}, n3) {
|
|
24769
|
+
this.pattern = t2, this.separator = e6.separator || ".", this.segments = this._parse(t2), this.data = n3, this._hasDeepWildcard = this.segments.some((t3) => "deep-wildcard" === t3.type), this._hasAttributeCondition = this.segments.some((t3) => void 0 !== t3.attrName), this._hasPositionSelector = this.segments.some((t3) => void 0 !== t3.position);
|
|
24709
24770
|
}
|
|
24710
24771
|
_parse(t2) {
|
|
24711
24772
|
const e6 = [];
|
|
24712
|
-
let
|
|
24713
|
-
for (;
|
|
24714
|
-
return
|
|
24773
|
+
let n3 = 0, i6 = "";
|
|
24774
|
+
for (; n3 < t2.length; ) t2[n3] === this.separator ? n3 + 1 < t2.length && t2[n3 + 1] === this.separator ? (i6.trim() && (e6.push(this._parseSegment(i6.trim())), i6 = ""), e6.push({ type: "deep-wildcard" }), n3 += 2) : (i6.trim() && e6.push(this._parseSegment(i6.trim())), i6 = "", n3++) : (i6 += t2[n3], n3++);
|
|
24775
|
+
return i6.trim() && e6.push(this._parseSegment(i6.trim())), e6;
|
|
24715
24776
|
}
|
|
24716
24777
|
_parseSegment(t2) {
|
|
24717
24778
|
const e6 = { type: "tag" };
|
|
24718
|
-
let
|
|
24779
|
+
let n3 = null, i6 = t2;
|
|
24719
24780
|
const s2 = t2.match(/^([^\[]+)(\[[^\]]*\])(.*)$/);
|
|
24720
|
-
if (s2 && (
|
|
24781
|
+
if (s2 && (i6 = s2[1] + s2[3], s2[2])) {
|
|
24721
24782
|
const t3 = s2[2].slice(1, -1);
|
|
24722
|
-
t3 && (
|
|
24783
|
+
t3 && (n3 = t3);
|
|
24723
24784
|
}
|
|
24724
|
-
let r6, o3, a6 =
|
|
24725
|
-
if (
|
|
24726
|
-
const e7 =
|
|
24727
|
-
if (r6 =
|
|
24785
|
+
let r6, o3, a6 = i6;
|
|
24786
|
+
if (i6.includes("::")) {
|
|
24787
|
+
const e7 = i6.indexOf("::");
|
|
24788
|
+
if (r6 = i6.substring(0, e7).trim(), a6 = i6.substring(e7 + 2).trim(), !r6) throw new Error(`Invalid namespace in pattern: ${t2}`);
|
|
24728
24789
|
}
|
|
24729
24790
|
let h6 = null;
|
|
24730
24791
|
if (a6.includes(":")) {
|
|
24731
|
-
const t3 = a6.lastIndexOf(":"), e7 = a6.substring(0, t3).trim(),
|
|
24732
|
-
["first", "last", "odd", "even"].includes(
|
|
24792
|
+
const t3 = a6.lastIndexOf(":"), e7 = a6.substring(0, t3).trim(), n4 = a6.substring(t3 + 1).trim();
|
|
24793
|
+
["first", "last", "odd", "even"].includes(n4) || /^nth\(\d+\)$/.test(n4) ? (o3 = e7, h6 = n4) : o3 = a6;
|
|
24733
24794
|
} else o3 = a6;
|
|
24734
24795
|
if (!o3) throw new Error(`Invalid segment pattern: ${t2}`);
|
|
24735
|
-
if (e6.tag = o3, r6 && (e6.namespace = r6),
|
|
24736
|
-
const t3 =
|
|
24737
|
-
e6.attrName =
|
|
24738
|
-
} else e6.attrName =
|
|
24796
|
+
if (e6.tag = o3, r6 && (e6.namespace = r6), n3) if (n3.includes("=")) {
|
|
24797
|
+
const t3 = n3.indexOf("=");
|
|
24798
|
+
e6.attrName = n3.substring(0, t3).trim(), e6.attrValue = n3.substring(t3 + 1).trim();
|
|
24799
|
+
} else e6.attrName = n3.trim();
|
|
24739
24800
|
if (h6) {
|
|
24740
24801
|
const t3 = h6.match(/^nth\((\d+)\)$/);
|
|
24741
24802
|
t3 ? (e6.position = "nth", e6.positionValue = parseInt(t3[1], 10)) : e6.position = h6;
|
|
@@ -24758,425 +24819,604 @@ var require_fxp = __commonJS({
|
|
|
24758
24819
|
return this.pattern;
|
|
24759
24820
|
}
|
|
24760
24821
|
}
|
|
24761
|
-
|
|
24822
|
+
class B {
|
|
24823
|
+
constructor() {
|
|
24824
|
+
this._byDepthAndTag = /* @__PURE__ */ new Map(), this._wildcardByDepth = /* @__PURE__ */ new Map(), this._deepWildcards = [], this._patterns = /* @__PURE__ */ new Set(), this._sealed = false;
|
|
24825
|
+
}
|
|
24826
|
+
add(t2) {
|
|
24827
|
+
if (this._sealed) throw new TypeError("ExpressionSet is sealed. Create a new ExpressionSet to add more expressions.");
|
|
24828
|
+
if (this._patterns.has(t2.pattern)) return this;
|
|
24829
|
+
if (this._patterns.add(t2.pattern), t2.hasDeepWildcard()) return this._deepWildcards.push(t2), this;
|
|
24830
|
+
const e6 = t2.length, n3 = t2.segments[t2.segments.length - 1], i6 = n3?.tag;
|
|
24831
|
+
if (i6 && "*" !== i6) {
|
|
24832
|
+
const n4 = `${e6}:${i6}`;
|
|
24833
|
+
this._byDepthAndTag.has(n4) || this._byDepthAndTag.set(n4, []), this._byDepthAndTag.get(n4).push(t2);
|
|
24834
|
+
} else this._wildcardByDepth.has(e6) || this._wildcardByDepth.set(e6, []), this._wildcardByDepth.get(e6).push(t2);
|
|
24835
|
+
return this;
|
|
24836
|
+
}
|
|
24837
|
+
addAll(t2) {
|
|
24838
|
+
for (const e6 of t2) this.add(e6);
|
|
24839
|
+
return this;
|
|
24840
|
+
}
|
|
24841
|
+
has(t2) {
|
|
24842
|
+
return this._patterns.has(t2.pattern);
|
|
24843
|
+
}
|
|
24844
|
+
get size() {
|
|
24845
|
+
return this._patterns.size;
|
|
24846
|
+
}
|
|
24847
|
+
seal() {
|
|
24848
|
+
return this._sealed = true, this;
|
|
24849
|
+
}
|
|
24850
|
+
get isSealed() {
|
|
24851
|
+
return this._sealed;
|
|
24852
|
+
}
|
|
24853
|
+
matchesAny(t2) {
|
|
24854
|
+
return null !== this.findMatch(t2);
|
|
24855
|
+
}
|
|
24856
|
+
findMatch(t2) {
|
|
24857
|
+
const e6 = t2.getDepth(), n3 = `${e6}:${t2.getCurrentTag()}`, i6 = this._byDepthAndTag.get(n3);
|
|
24858
|
+
if (i6) {
|
|
24859
|
+
for (let e7 = 0; e7 < i6.length; e7++) if (t2.matches(i6[e7])) return i6[e7];
|
|
24860
|
+
}
|
|
24861
|
+
const s2 = this._wildcardByDepth.get(e6);
|
|
24862
|
+
if (s2) {
|
|
24863
|
+
for (let e7 = 0; e7 < s2.length; e7++) if (t2.matches(s2[e7])) return s2[e7];
|
|
24864
|
+
}
|
|
24865
|
+
for (let e7 = 0; e7 < this._deepWildcards.length; e7++) if (t2.matches(this._deepWildcards[e7])) return this._deepWildcards[e7];
|
|
24866
|
+
return null;
|
|
24867
|
+
}
|
|
24868
|
+
}
|
|
24869
|
+
const U = { cent: "\xA2", pound: "\xA3", curren: "\xA4", yen: "\xA5", euro: "\u20AC", dollar: "$", euro: "\u20AC", fnof: "\u0192", inr: "\u20B9", af: "\u060B", birr: "\u1265\u122D", peso: "\u20B1", rub: "\u20BD", won: "\u20A9", yuan: "\xA5", cedil: "\xB8" }, W = { amp: "&", apos: "'", gt: ">", lt: "<", quot: '"' }, X = { nbsp: "\xA0", copy: "\xA9", reg: "\xAE", trade: "\u2122", mdash: "\u2014", ndash: "\u2013", hellip: "\u2026", laquo: "\xAB", raquo: "\xBB", lsquo: "\u2018", rsquo: "\u2019", ldquo: "\u201C", rdquo: "\u201D", bull: "\u2022", para: "\xB6", sect: "\xA7", deg: "\xB0", frac12: "\xBD", frac14: "\xBC", frac34: "\xBE" }, Y = new Set("!?\\\\/[]$%{}^&*()<>|+");
|
|
24870
|
+
function z(t2) {
|
|
24871
|
+
if ("#" === t2[0]) throw new Error(`[EntityReplacer] Invalid character '#' in entity name: "${t2}"`);
|
|
24872
|
+
for (const e6 of t2) if (Y.has(e6)) throw new Error(`[EntityReplacer] Invalid character '${e6}' in entity name: "${t2}"`);
|
|
24873
|
+
return t2;
|
|
24874
|
+
}
|
|
24875
|
+
function q2(...t2) {
|
|
24876
|
+
const e6 = /* @__PURE__ */ Object.create(null);
|
|
24877
|
+
for (const n3 of t2) if (n3) for (const t3 of Object.keys(n3)) {
|
|
24878
|
+
const i6 = n3[t3];
|
|
24879
|
+
if ("string" == typeof i6) e6[t3] = i6;
|
|
24880
|
+
else if (i6 && "object" == typeof i6 && void 0 !== i6.val) {
|
|
24881
|
+
const n4 = i6.val;
|
|
24882
|
+
"string" == typeof n4 && (e6[t3] = n4);
|
|
24883
|
+
}
|
|
24884
|
+
}
|
|
24885
|
+
return e6;
|
|
24886
|
+
}
|
|
24887
|
+
const Z = "external", J = "base", K = "all", Q = Object.freeze({ allow: 0, leave: 1, remove: 2, throw: 3 }), H = /* @__PURE__ */ new Set([9, 10, 13]);
|
|
24888
|
+
class tt {
|
|
24889
|
+
constructor(t2 = {}) {
|
|
24890
|
+
var e6;
|
|
24891
|
+
this._limit = t2.limit || {}, this._maxTotalExpansions = this._limit.maxTotalExpansions || 0, this._maxExpandedLength = this._limit.maxExpandedLength || 0, this._postCheck = "function" == typeof t2.postCheck ? t2.postCheck : (t3) => t3, this._limitTiers = (e6 = this._limit.applyLimitsTo ?? Z) && e6 !== Z ? e6 === K ? /* @__PURE__ */ new Set([K]) : e6 === J ? /* @__PURE__ */ new Set([J]) : Array.isArray(e6) ? new Set(e6) : /* @__PURE__ */ new Set([Z]) : /* @__PURE__ */ new Set([Z]), this._numericAllowed = t2.numericAllowed ?? true, this._baseMap = q2(W, t2.namedEntities || null), this._externalMap = /* @__PURE__ */ Object.create(null), this._inputMap = /* @__PURE__ */ Object.create(null), this._totalExpansions = 0, this._expandedLength = 0, this._removeSet = new Set(t2.remove && Array.isArray(t2.remove) ? t2.remove : []), this._leaveSet = new Set(t2.leave && Array.isArray(t2.leave) ? t2.leave : []);
|
|
24892
|
+
const n3 = (function(t3) {
|
|
24893
|
+
if (!t3) return { xmlVersion: 1, onLevel: Q.allow, nullLevel: Q.remove };
|
|
24894
|
+
const e7 = 1.1 === t3.xmlVersion ? 1.1 : 1, n4 = Q[t3.onNCR] ?? Q.allow, i6 = Q[t3.nullNCR] ?? Q.remove;
|
|
24895
|
+
return { xmlVersion: e7, onLevel: n4, nullLevel: Math.max(i6, Q.remove) };
|
|
24896
|
+
})(t2.ncr);
|
|
24897
|
+
this._ncrXmlVersion = n3.xmlVersion, this._ncrOnLevel = n3.onLevel, this._ncrNullLevel = n3.nullLevel;
|
|
24898
|
+
}
|
|
24899
|
+
setExternalEntities(t2) {
|
|
24900
|
+
if (t2) for (const e6 of Object.keys(t2)) z(e6);
|
|
24901
|
+
this._externalMap = q2(t2);
|
|
24902
|
+
}
|
|
24903
|
+
addExternalEntity(t2, e6) {
|
|
24904
|
+
z(t2), "string" == typeof e6 && -1 === e6.indexOf("&") && (this._externalMap[t2] = e6);
|
|
24905
|
+
}
|
|
24906
|
+
addInputEntities(t2) {
|
|
24907
|
+
this._totalExpansions = 0, this._expandedLength = 0, this._inputMap = q2(t2);
|
|
24908
|
+
}
|
|
24909
|
+
reset() {
|
|
24910
|
+
return this._inputMap = /* @__PURE__ */ Object.create(null), this._totalExpansions = 0, this._expandedLength = 0, this;
|
|
24911
|
+
}
|
|
24912
|
+
setXmlVersion(t2) {
|
|
24913
|
+
this._ncrXmlVersion = 1.1 === t2 ? 1.1 : 1;
|
|
24914
|
+
}
|
|
24915
|
+
decode(t2) {
|
|
24916
|
+
if ("string" != typeof t2 || 0 === t2.length) return t2;
|
|
24917
|
+
const e6 = t2, n3 = [], i6 = t2.length;
|
|
24918
|
+
let s2 = 0, r6 = 0;
|
|
24919
|
+
const o3 = this._maxTotalExpansions > 0, a6 = this._maxExpandedLength > 0, h6 = o3 || a6;
|
|
24920
|
+
for (; r6 < i6; ) {
|
|
24921
|
+
if (38 !== t2.charCodeAt(r6)) {
|
|
24922
|
+
r6++;
|
|
24923
|
+
continue;
|
|
24924
|
+
}
|
|
24925
|
+
let e7 = r6 + 1;
|
|
24926
|
+
for (; e7 < i6 && 59 !== t2.charCodeAt(e7) && e7 - r6 <= 32; ) e7++;
|
|
24927
|
+
if (e7 >= i6 || 59 !== t2.charCodeAt(e7)) {
|
|
24928
|
+
r6++;
|
|
24929
|
+
continue;
|
|
24930
|
+
}
|
|
24931
|
+
const l5 = t2.slice(r6 + 1, e7);
|
|
24932
|
+
if (0 === l5.length) {
|
|
24933
|
+
r6++;
|
|
24934
|
+
continue;
|
|
24935
|
+
}
|
|
24936
|
+
let u2, p3;
|
|
24937
|
+
if (this._removeSet.has(l5)) u2 = "", void 0 === p3 && (p3 = Z);
|
|
24938
|
+
else {
|
|
24939
|
+
if (this._leaveSet.has(l5)) {
|
|
24940
|
+
r6++;
|
|
24941
|
+
continue;
|
|
24942
|
+
}
|
|
24943
|
+
if (35 === l5.charCodeAt(0)) {
|
|
24944
|
+
const t3 = this._resolveNCR(l5);
|
|
24945
|
+
if (void 0 === t3) {
|
|
24946
|
+
r6++;
|
|
24947
|
+
continue;
|
|
24948
|
+
}
|
|
24949
|
+
u2 = t3, p3 = J;
|
|
24950
|
+
} else {
|
|
24951
|
+
const t3 = this._resolveName(l5);
|
|
24952
|
+
u2 = t3?.value, p3 = t3?.tier;
|
|
24953
|
+
}
|
|
24954
|
+
}
|
|
24955
|
+
if (void 0 !== u2) {
|
|
24956
|
+
if (r6 > s2 && n3.push(t2.slice(s2, r6)), n3.push(u2), s2 = e7 + 1, r6 = s2, h6 && this._tierCounts(p3)) {
|
|
24957
|
+
if (o3 && (this._totalExpansions++, this._totalExpansions > this._maxTotalExpansions)) throw new Error(`[EntityReplacer] Entity expansion count limit exceeded: ${this._totalExpansions} > ${this._maxTotalExpansions}`);
|
|
24958
|
+
if (a6) {
|
|
24959
|
+
const t3 = u2.length - (l5.length + 2);
|
|
24960
|
+
if (t3 > 0 && (this._expandedLength += t3, this._expandedLength > this._maxExpandedLength)) throw new Error(`[EntityReplacer] Expanded content length limit exceeded: ${this._expandedLength} > ${this._maxExpandedLength}`);
|
|
24961
|
+
}
|
|
24962
|
+
}
|
|
24963
|
+
} else r6++;
|
|
24964
|
+
}
|
|
24965
|
+
s2 < i6 && n3.push(t2.slice(s2));
|
|
24966
|
+
const l4 = 0 === n3.length ? t2 : n3.join("");
|
|
24967
|
+
return this._postCheck(l4, e6);
|
|
24968
|
+
}
|
|
24969
|
+
_tierCounts(t2) {
|
|
24970
|
+
return !!this._limitTiers.has(K) || this._limitTiers.has(t2);
|
|
24971
|
+
}
|
|
24972
|
+
_resolveName(t2) {
|
|
24973
|
+
return t2 in this._inputMap ? { value: this._inputMap[t2], tier: Z } : t2 in this._externalMap ? { value: this._externalMap[t2], tier: Z } : t2 in this._baseMap ? { value: this._baseMap[t2], tier: J } : void 0;
|
|
24974
|
+
}
|
|
24975
|
+
_classifyNCR(t2) {
|
|
24976
|
+
return 0 === t2 ? this._ncrNullLevel : t2 >= 55296 && t2 <= 57343 || 1 === this._ncrXmlVersion && t2 >= 1 && t2 <= 31 && !H.has(t2) ? Q.remove : -1;
|
|
24977
|
+
}
|
|
24978
|
+
_applyNCRAction(t2, e6, n3) {
|
|
24979
|
+
switch (t2) {
|
|
24980
|
+
case Q.allow:
|
|
24981
|
+
return String.fromCodePoint(n3);
|
|
24982
|
+
case Q.remove:
|
|
24983
|
+
return "";
|
|
24984
|
+
case Q.leave:
|
|
24985
|
+
return;
|
|
24986
|
+
case Q.throw:
|
|
24987
|
+
throw new Error(`[EntityDecoder] Prohibited numeric character reference &${e6}; (U+${n3.toString(16).toUpperCase().padStart(4, "0")})`);
|
|
24988
|
+
default:
|
|
24989
|
+
return String.fromCodePoint(n3);
|
|
24990
|
+
}
|
|
24991
|
+
}
|
|
24992
|
+
_resolveNCR(t2) {
|
|
24993
|
+
const e6 = t2.charCodeAt(1);
|
|
24994
|
+
let n3;
|
|
24995
|
+
if (n3 = 120 === e6 || 88 === e6 ? parseInt(t2.slice(2), 16) : parseInt(t2.slice(1), 10), Number.isNaN(n3) || n3 < 0 || n3 > 1114111) return;
|
|
24996
|
+
const i6 = this._classifyNCR(n3);
|
|
24997
|
+
if (!this._numericAllowed && i6 < Q.remove) return;
|
|
24998
|
+
const s2 = -1 === i6 ? this._ncrOnLevel : Math.max(this._ncrOnLevel, i6);
|
|
24999
|
+
return this._applyNCRAction(s2, t2, n3);
|
|
25000
|
+
}
|
|
25001
|
+
}
|
|
25002
|
+
function et(t2, e6) {
|
|
24762
25003
|
if (!t2) return {};
|
|
24763
|
-
const
|
|
24764
|
-
if (!
|
|
24765
|
-
const
|
|
24766
|
-
for (const t3 in
|
|
24767
|
-
return
|
|
25004
|
+
const n3 = e6.attributesGroupName ? t2[e6.attributesGroupName] : t2;
|
|
25005
|
+
if (!n3) return {};
|
|
25006
|
+
const i6 = {};
|
|
25007
|
+
for (const t3 in n3) t3.startsWith(e6.attributeNamePrefix) ? i6[t3.substring(e6.attributeNamePrefix.length)] = n3[t3] : i6[t3] = n3[t3];
|
|
25008
|
+
return i6;
|
|
24768
25009
|
}
|
|
24769
|
-
function
|
|
25010
|
+
function nt(t2) {
|
|
24770
25011
|
if (!t2 || "string" != typeof t2) return;
|
|
24771
25012
|
const e6 = t2.indexOf(":");
|
|
24772
25013
|
if (-1 !== e6 && e6 > 0) {
|
|
24773
|
-
const
|
|
24774
|
-
if ("xmlns" !==
|
|
25014
|
+
const n3 = t2.substring(0, e6);
|
|
25015
|
+
if ("xmlns" !== n3) return n3;
|
|
24775
25016
|
}
|
|
24776
25017
|
}
|
|
24777
|
-
class
|
|
25018
|
+
class it {
|
|
24778
25019
|
constructor(t2) {
|
|
24779
25020
|
var e6;
|
|
24780
|
-
|
|
24781
|
-
for (const
|
|
24782
|
-
if ("string" == typeof
|
|
24783
|
-
if (
|
|
25021
|
+
this.options = t2, this.currentNode = null, this.tagsNodeStack = [], this.parseXml = ht, this.parseTextData = st, this.resolveNameSpace = rt, this.buildAttributesMap = at, this.isItStopNode = ct, this.replaceEntitiesValue = ut, this.readStopNodeData = mt, this.saveTextToParentTag = pt, this.addChild = lt, this.ignoreAttributesFn = "function" == typeof (e6 = this.options.ignoreAttributes) ? e6 : Array.isArray(e6) ? (t3) => {
|
|
25022
|
+
for (const n4 of e6) {
|
|
25023
|
+
if ("string" == typeof n4 && t3 === n4) return true;
|
|
25024
|
+
if (n4 instanceof RegExp && n4.test(t3)) return true;
|
|
24784
25025
|
}
|
|
24785
|
-
} : () => false, this.entityExpansionCount = 0, this.currentExpandedLength = 0
|
|
24786
|
-
|
|
24787
|
-
|
|
24788
|
-
|
|
24789
|
-
|
|
25026
|
+
} : () => false, this.entityExpansionCount = 0, this.currentExpandedLength = 0;
|
|
25027
|
+
let n3 = { ...W };
|
|
25028
|
+
this.options.entityDecoder ? this.entityDecoder = this.options.entityDecoder : ("object" == typeof this.options.htmlEntities ? n3 = this.options.htmlEntities : true === this.options.htmlEntities && (n3 = { ...X, ...U }), this.entityDecoder = new tt({ namedEntities: n3, numericAllowed: this.options.htmlEntities, limit: { maxTotalExpansions: this.options.processEntities.maxTotalExpansions, maxExpandedLength: this.options.processEntities.maxExpandedLength, applyLimitsTo: this.options.processEntities.appliesTo } })), this.matcher = new R(), this.readonlyMatcher = this.matcher.readOnly(), this.isCurrentNodeStopNode = false, this.stopNodeExpressionsSet = new B();
|
|
25029
|
+
const i6 = this.options.stopNodes;
|
|
25030
|
+
if (i6 && i6.length > 0) {
|
|
25031
|
+
for (let t3 = 0; t3 < i6.length; t3++) {
|
|
25032
|
+
const e7 = i6[t3];
|
|
25033
|
+
"string" == typeof e7 ? this.stopNodeExpressionsSet.add(new G(e7)) : e7 instanceof G && this.stopNodeExpressionsSet.add(e7);
|
|
24790
25034
|
}
|
|
25035
|
+
this.stopNodeExpressionsSet.seal();
|
|
24791
25036
|
}
|
|
24792
25037
|
}
|
|
24793
25038
|
}
|
|
24794
|
-
function
|
|
24795
|
-
const
|
|
24796
|
-
|
|
24797
|
-
|
|
24798
|
-
|
|
24799
|
-
|
|
24800
|
-
}
|
|
24801
|
-
function z(t2, e6, i6, n3, s2, r6, o3) {
|
|
24802
|
-
if (void 0 !== t2 && (this.options.trimValues && !n3 && (t2 = t2.trim()), t2.length > 0)) {
|
|
24803
|
-
o3 || (t2 = this.replaceEntitiesValue(t2, e6, i6));
|
|
24804
|
-
const n4 = this.options.jPath ? i6.toString() : i6, a6 = this.options.tagValueProcessor(e6, t2, n4, s2, r6);
|
|
24805
|
-
return null == a6 ? t2 : typeof a6 != typeof t2 || a6 !== t2 ? a6 : this.options.trimValues || t2.trim() === t2 ? st(t2, this.options.parseTagValue, this.options.numberParseOptions) : t2;
|
|
25039
|
+
function st(t2, e6, n3, i6, s2, r6, o3) {
|
|
25040
|
+
const a6 = this.options;
|
|
25041
|
+
if (void 0 !== t2 && (a6.trimValues && !i6 && (t2 = t2.trim()), t2.length > 0)) {
|
|
25042
|
+
o3 || (t2 = this.replaceEntitiesValue(t2, e6, n3));
|
|
25043
|
+
const i7 = a6.jPath ? n3.toString() : n3, h6 = a6.tagValueProcessor(e6, t2, i7, s2, r6);
|
|
25044
|
+
return null == h6 ? t2 : typeof h6 != typeof t2 || h6 !== t2 ? h6 : a6.trimValues || t2.trim() === t2 ? xt(t2, a6.parseTagValue, a6.numberParseOptions) : t2;
|
|
24806
25045
|
}
|
|
24807
25046
|
}
|
|
24808
|
-
function
|
|
25047
|
+
function rt(t2) {
|
|
24809
25048
|
if (this.options.removeNSPrefix) {
|
|
24810
|
-
const e6 = t2.split(":"),
|
|
25049
|
+
const e6 = t2.split(":"), n3 = "/" === t2.charAt(0) ? "/" : "";
|
|
24811
25050
|
if ("xmlns" === e6[0]) return "";
|
|
24812
|
-
2 === e6.length && (t2 =
|
|
25051
|
+
2 === e6.length && (t2 = n3 + e6[1]);
|
|
24813
25052
|
}
|
|
24814
25053
|
return t2;
|
|
24815
25054
|
}
|
|
24816
|
-
const
|
|
24817
|
-
function
|
|
24818
|
-
|
|
24819
|
-
|
|
24820
|
-
|
|
24821
|
-
|
|
25055
|
+
const ot = new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`, "gm");
|
|
25056
|
+
function at(t2, e6, n3, i6 = false) {
|
|
25057
|
+
const r6 = this.options;
|
|
25058
|
+
if (true === i6 || true !== r6.ignoreAttributes && "string" == typeof t2) {
|
|
25059
|
+
const i7 = s(t2, ot), o3 = i7.length, a6 = {}, h6 = new Array(o3);
|
|
25060
|
+
let l4 = false;
|
|
25061
|
+
const u2 = {};
|
|
25062
|
+
for (let t3 = 0; t3 < o3; t3++) {
|
|
25063
|
+
const e7 = this.resolveNameSpace(i7[t3][1]), s2 = i7[t3][4];
|
|
24822
25064
|
if (e7.length && void 0 !== s2) {
|
|
24823
|
-
let
|
|
24824
|
-
|
|
24825
|
-
}
|
|
24826
|
-
}
|
|
24827
|
-
|
|
24828
|
-
|
|
24829
|
-
|
|
24830
|
-
|
|
24831
|
-
|
|
24832
|
-
if (
|
|
24833
|
-
|
|
24834
|
-
|
|
24835
|
-
|
|
24836
|
-
|
|
24837
|
-
|
|
24838
|
-
|
|
24839
|
-
if (
|
|
25065
|
+
let i8 = s2;
|
|
25066
|
+
r6.trimValues && (i8 = i8.trim()), i8 = this.replaceEntitiesValue(i8, n3, this.readonlyMatcher), h6[t3] = i8, u2[e7] = i8, l4 = true;
|
|
25067
|
+
}
|
|
25068
|
+
}
|
|
25069
|
+
l4 && "object" == typeof e6 && e6.updateCurrent && e6.updateCurrent(u2);
|
|
25070
|
+
const p3 = r6.jPath ? e6.toString() : this.readonlyMatcher;
|
|
25071
|
+
let c6 = false;
|
|
25072
|
+
for (let t3 = 0; t3 < o3; t3++) {
|
|
25073
|
+
const e7 = this.resolveNameSpace(i7[t3][1]);
|
|
25074
|
+
if (this.ignoreAttributesFn(e7, p3)) continue;
|
|
25075
|
+
let n4 = r6.attributeNamePrefix + e7;
|
|
25076
|
+
if (e7.length) if (r6.transformAttributeName && (n4 = r6.transformAttributeName(n4)), n4 = bt(n4, r6), void 0 !== i7[t3][4]) {
|
|
25077
|
+
const i8 = h6[t3], s2 = r6.attributeValueProcessor(e7, i8, p3);
|
|
25078
|
+
a6[n4] = null == s2 ? i8 : typeof s2 != typeof i8 || s2 !== i8 ? s2 : xt(i8, r6.parseAttributeValue, r6.numberParseOptions), c6 = true;
|
|
25079
|
+
} else r6.allowBooleanAttributes && (a6[n4] = true, c6 = true);
|
|
25080
|
+
}
|
|
25081
|
+
if (!c6) return;
|
|
25082
|
+
if (r6.attributesGroupName) {
|
|
24840
25083
|
const t3 = {};
|
|
24841
|
-
return t3[
|
|
25084
|
+
return t3[r6.attributesGroupName] = a6, t3;
|
|
24842
25085
|
}
|
|
24843
|
-
return
|
|
25086
|
+
return a6;
|
|
24844
25087
|
}
|
|
24845
25088
|
}
|
|
24846
|
-
const
|
|
25089
|
+
const ht = function(t2) {
|
|
24847
25090
|
t2 = t2.replace(/\r\n?/g, "\n");
|
|
24848
|
-
const e6 = new
|
|
24849
|
-
let
|
|
24850
|
-
this.matcher.reset(), this.entityExpansionCount = 0, this.currentExpandedLength = 0;
|
|
24851
|
-
const s2 = new
|
|
24852
|
-
for (let
|
|
24853
|
-
const
|
|
24854
|
-
|
|
24855
|
-
|
|
24856
|
-
|
|
24857
|
-
|
|
24858
|
-
|
|
24859
|
-
|
|
24860
|
-
|
|
24861
|
-
|
|
24862
|
-
|
|
24863
|
-
|
|
24864
|
-
|
|
24865
|
-
|
|
24866
|
-
|
|
24867
|
-
|
|
24868
|
-
|
|
24869
|
-
|
|
24870
|
-
|
|
24871
|
-
|
|
24872
|
-
|
|
24873
|
-
|
|
24874
|
-
|
|
24875
|
-
const s3 = t2.substring(r6 + 4, e7 - 2);
|
|
24876
|
-
n3 = this.saveTextToParentTag(n3, i6, this.readonlyMatcher), i6.add(this.options.commentPropName, [{ [this.options.textNodeName]: s3 }]);
|
|
24877
|
-
}
|
|
24878
|
-
r6 = e7;
|
|
24879
|
-
} else if ("!D" === t2.substr(r6 + 1, 2)) {
|
|
24880
|
-
const e7 = s2.readDocType(t2, r6);
|
|
24881
|
-
this.docTypeEntities = e7.entities, r6 = e7.i;
|
|
24882
|
-
} else if ("![" === t2.substr(r6 + 1, 2)) {
|
|
24883
|
-
const e7 = et(t2, "]]>", r6, "CDATA is not closed.") - 2, s3 = t2.substring(r6 + 9, e7);
|
|
24884
|
-
n3 = this.saveTextToParentTag(n3, i6, this.readonlyMatcher);
|
|
24885
|
-
let o3 = this.parseTextData(s3, i6.tagname, this.readonlyMatcher, true, false, true, true);
|
|
24886
|
-
null == o3 && (o3 = ""), this.options.cdataPropName ? i6.add(this.options.cdataPropName, [{ [this.options.textNodeName]: s3 }]) : i6.add(this.options.textNodeName, o3), r6 = e7 + 2;
|
|
24887
|
-
} else {
|
|
24888
|
-
let s3 = it(t2, r6, this.options.removeNSPrefix);
|
|
24889
|
-
if (!s3) {
|
|
24890
|
-
const e7 = t2.substring(Math.max(0, r6 - 50), Math.min(t2.length, r6 + 50));
|
|
24891
|
-
throw new Error(`readTagExp returned undefined at position ${r6}. Context: "${e7}"`);
|
|
24892
|
-
}
|
|
24893
|
-
let o3 = s3.tagName;
|
|
24894
|
-
const a6 = s3.rawTagName;
|
|
24895
|
-
let h6 = s3.tagExp, l4 = s3.attrExpPresent, p3 = s3.closeIndex;
|
|
24896
|
-
if ({ tagName: o3, tagExp: h6 } = ot(this.options.transformTagName, o3, h6, this.options), this.options.strictReservedNames && (o3 === this.options.commentPropName || o3 === this.options.cdataPropName || o3 === this.options.textNodeName || o3 === this.options.attributesGroupName)) throw new Error(`Invalid tag name: ${o3}`);
|
|
24897
|
-
i6 && n3 && "!xml" !== i6.tagname && (n3 = this.saveTextToParentTag(n3, i6, this.readonlyMatcher, false));
|
|
24898
|
-
const u2 = i6;
|
|
24899
|
-
u2 && -1 !== this.options.unpairedTags.indexOf(u2.tagname) && (i6 = this.tagsNodeStack.pop(), this.matcher.pop());
|
|
24900
|
-
let c6 = false;
|
|
24901
|
-
h6.length > 0 && h6.lastIndexOf("/") === h6.length - 1 && (c6 = true, "/" === o3[o3.length - 1] ? (o3 = o3.substr(0, o3.length - 1), h6 = o3) : h6 = h6.substr(0, h6.length - 1), l4 = o3 !== h6);
|
|
24902
|
-
let d6, f6 = null, g6 = {};
|
|
24903
|
-
d6 = B(a6), o3 !== e6.tagname && this.matcher.push(o3, {}, d6), o3 !== h6 && l4 && (f6 = this.buildAttributesMap(h6, this.matcher, o3), f6 && (g6 = U(f6, this.options))), o3 !== e6.tagname && (this.isCurrentNodeStopNode = this.isItStopNode(this.stopNodeExpressions, this.matcher));
|
|
24904
|
-
const m4 = r6;
|
|
24905
|
-
if (this.isCurrentNodeStopNode) {
|
|
24906
|
-
let e7 = "";
|
|
24907
|
-
if (c6) r6 = s3.closeIndex;
|
|
24908
|
-
else if (-1 !== this.options.unpairedTags.indexOf(o3)) r6 = s3.closeIndex;
|
|
25091
|
+
const e6 = new O("!xml");
|
|
25092
|
+
let n3 = e6, i6 = "";
|
|
25093
|
+
this.matcher.reset(), this.entityDecoder.reset(), this.entityExpansionCount = 0, this.currentExpandedLength = 0;
|
|
25094
|
+
const s2 = this.options, r6 = new $(s2.processEntities), o3 = t2.length;
|
|
25095
|
+
for (let a6 = 0; a6 < o3; a6++) if ("<" === t2[a6]) {
|
|
25096
|
+
const h6 = t2.charCodeAt(a6 + 1);
|
|
25097
|
+
if (47 === h6) {
|
|
25098
|
+
const e7 = dt(t2, ">", a6, "Closing Tag is not closed.");
|
|
25099
|
+
let r7 = t2.substring(a6 + 2, e7).trim();
|
|
25100
|
+
if (s2.removeNSPrefix) {
|
|
25101
|
+
const t3 = r7.indexOf(":");
|
|
25102
|
+
-1 !== t3 && (r7 = r7.substr(t3 + 1));
|
|
25103
|
+
}
|
|
25104
|
+
r7 = Nt(s2.transformTagName, r7, "", s2).tagName, n3 && (i6 = this.saveTextToParentTag(i6, n3, this.readonlyMatcher));
|
|
25105
|
+
const o4 = this.matcher.getCurrentTag();
|
|
25106
|
+
if (r7 && s2.unpairedTagsSet.has(r7)) throw new Error(`Unpaired tag can not be used as closing tag: </${r7}>`);
|
|
25107
|
+
o4 && s2.unpairedTagsSet.has(o4) && (this.matcher.pop(), this.tagsNodeStack.pop()), this.matcher.pop(), this.isCurrentNodeStopNode = false, n3 = this.tagsNodeStack.pop(), i6 = "", a6 = e7;
|
|
25108
|
+
} else if (63 === h6) {
|
|
25109
|
+
let e7 = gt(t2, a6, false, "?>");
|
|
25110
|
+
if (!e7) throw new Error("Pi Tag is not closed.");
|
|
25111
|
+
i6 = this.saveTextToParentTag(i6, n3, this.readonlyMatcher);
|
|
25112
|
+
const r7 = this.buildAttributesMap(e7.tagExp, this.matcher, e7.tagName, true);
|
|
25113
|
+
if (r7) {
|
|
25114
|
+
const t3 = r7[this.options.attributeNamePrefix + "version"];
|
|
25115
|
+
this.entityDecoder.setXmlVersion(Number(t3) || 1);
|
|
25116
|
+
}
|
|
25117
|
+
if (s2.ignoreDeclaration && "?xml" === e7.tagName || s2.ignorePiTags) ;
|
|
24909
25118
|
else {
|
|
24910
|
-
const
|
|
24911
|
-
|
|
24912
|
-
|
|
24913
|
-
|
|
24914
|
-
|
|
24915
|
-
|
|
25119
|
+
const t3 = new O(e7.tagName);
|
|
25120
|
+
t3.add(s2.textNodeName, ""), e7.tagName !== e7.tagExp && e7.attrExpPresent && true !== s2.ignoreAttributes && (t3[":@"] = r7), this.addChild(n3, t3, this.readonlyMatcher, a6);
|
|
25121
|
+
}
|
|
25122
|
+
a6 = e7.closeIndex + 1;
|
|
25123
|
+
} else if (33 === h6 && 45 === t2.charCodeAt(a6 + 2) && 45 === t2.charCodeAt(a6 + 3)) {
|
|
25124
|
+
const e7 = dt(t2, "-->", a6 + 4, "Comment is not closed.");
|
|
25125
|
+
if (s2.commentPropName) {
|
|
25126
|
+
const r7 = t2.substring(a6 + 4, e7 - 2);
|
|
25127
|
+
i6 = this.saveTextToParentTag(i6, n3, this.readonlyMatcher), n3.add(s2.commentPropName, [{ [s2.textNodeName]: r7 }]);
|
|
25128
|
+
}
|
|
25129
|
+
a6 = e7;
|
|
25130
|
+
} else if (33 === h6 && 68 === t2.charCodeAt(a6 + 2)) {
|
|
25131
|
+
const e7 = r6.readDocType(t2, a6);
|
|
25132
|
+
this.entityDecoder.addInputEntities(e7.entities), a6 = e7.i;
|
|
25133
|
+
} else if (33 === h6 && 91 === t2.charCodeAt(a6 + 2)) {
|
|
25134
|
+
const e7 = dt(t2, "]]>", a6, "CDATA is not closed.") - 2, r7 = t2.substring(a6 + 9, e7);
|
|
25135
|
+
i6 = this.saveTextToParentTag(i6, n3, this.readonlyMatcher);
|
|
25136
|
+
let o4 = this.parseTextData(r7, n3.tagname, this.readonlyMatcher, true, false, true, true);
|
|
25137
|
+
null == o4 && (o4 = ""), s2.cdataPropName ? n3.add(s2.cdataPropName, [{ [s2.textNodeName]: r7 }]) : n3.add(s2.textNodeName, o4), a6 = e7 + 2;
|
|
24916
25138
|
} else {
|
|
24917
|
-
|
|
24918
|
-
|
|
24919
|
-
const
|
|
24920
|
-
|
|
24921
|
-
}
|
|
24922
|
-
|
|
24923
|
-
|
|
24924
|
-
|
|
24925
|
-
|
|
25139
|
+
let r7 = gt(t2, a6, s2.removeNSPrefix);
|
|
25140
|
+
if (!r7) {
|
|
25141
|
+
const e7 = t2.substring(Math.max(0, a6 - 50), Math.min(o3, a6 + 50));
|
|
25142
|
+
throw new Error(`readTagExp returned undefined at position ${a6}. Context: "${e7}"`);
|
|
25143
|
+
}
|
|
25144
|
+
let h7 = r7.tagName;
|
|
25145
|
+
const l4 = r7.rawTagName;
|
|
25146
|
+
let u2 = r7.tagExp, p3 = r7.attrExpPresent, c6 = r7.closeIndex;
|
|
25147
|
+
if ({ tagName: h7, tagExp: u2 } = Nt(s2.transformTagName, h7, u2, s2), s2.strictReservedNames && (h7 === s2.commentPropName || h7 === s2.cdataPropName || h7 === s2.textNodeName || h7 === s2.attributesGroupName)) throw new Error(`Invalid tag name: ${h7}`);
|
|
25148
|
+
n3 && i6 && "!xml" !== n3.tagname && (i6 = this.saveTextToParentTag(i6, n3, this.readonlyMatcher, false));
|
|
25149
|
+
const d6 = n3;
|
|
25150
|
+
d6 && s2.unpairedTagsSet.has(d6.tagname) && (n3 = this.tagsNodeStack.pop(), this.matcher.pop());
|
|
25151
|
+
let f6 = false;
|
|
25152
|
+
u2.length > 0 && u2.lastIndexOf("/") === u2.length - 1 && (f6 = true, "/" === h7[h7.length - 1] ? (h7 = h7.substr(0, h7.length - 1), u2 = h7) : u2 = u2.substr(0, u2.length - 1), p3 = h7 !== u2);
|
|
25153
|
+
let g6, m4 = null, x2 = {};
|
|
25154
|
+
g6 = nt(l4), h7 !== e6.tagname && this.matcher.push(h7, {}, g6), h7 !== u2 && p3 && (m4 = this.buildAttributesMap(u2, this.matcher, h7), m4 && (x2 = et(m4, s2))), h7 !== e6.tagname && (this.isCurrentNodeStopNode = this.isItStopNode());
|
|
25155
|
+
const N2 = a6;
|
|
25156
|
+
if (this.isCurrentNodeStopNode) {
|
|
25157
|
+
let e7 = "";
|
|
25158
|
+
if (f6) a6 = r7.closeIndex;
|
|
25159
|
+
else if (s2.unpairedTagsSet.has(h7)) a6 = r7.closeIndex;
|
|
25160
|
+
else {
|
|
25161
|
+
const n4 = this.readStopNodeData(t2, l4, c6 + 1);
|
|
25162
|
+
if (!n4) throw new Error(`Unexpected end of ${l4}`);
|
|
25163
|
+
a6 = n4.i, e7 = n4.tagContent;
|
|
24926
25164
|
}
|
|
24927
|
-
|
|
24928
|
-
|
|
24929
|
-
|
|
24930
|
-
|
|
25165
|
+
const i7 = new O(h7);
|
|
25166
|
+
m4 && (i7[":@"] = m4), i7.add(s2.textNodeName, e7), this.matcher.pop(), this.isCurrentNodeStopNode = false, this.addChild(n3, i7, this.readonlyMatcher, N2);
|
|
25167
|
+
} else {
|
|
25168
|
+
if (f6) {
|
|
25169
|
+
({ tagName: h7, tagExp: u2 } = Nt(s2.transformTagName, h7, u2, s2));
|
|
25170
|
+
const t3 = new O(h7);
|
|
25171
|
+
m4 && (t3[":@"] = m4), this.addChild(n3, t3, this.readonlyMatcher, N2), this.matcher.pop(), this.isCurrentNodeStopNode = false;
|
|
25172
|
+
} else {
|
|
25173
|
+
if (s2.unpairedTagsSet.has(h7)) {
|
|
25174
|
+
const t3 = new O(h7);
|
|
25175
|
+
m4 && (t3[":@"] = m4), this.addChild(n3, t3, this.readonlyMatcher, N2), this.matcher.pop(), this.isCurrentNodeStopNode = false, a6 = r7.closeIndex;
|
|
25176
|
+
continue;
|
|
25177
|
+
}
|
|
25178
|
+
{
|
|
25179
|
+
const t3 = new O(h7);
|
|
25180
|
+
if (this.tagsNodeStack.length > s2.maxNestedTags) throw new Error("Maximum nested tags exceeded");
|
|
25181
|
+
this.tagsNodeStack.push(n3), m4 && (t3[":@"] = m4), this.addChild(n3, t3, this.readonlyMatcher, N2), n3 = t3;
|
|
25182
|
+
}
|
|
24931
25183
|
}
|
|
25184
|
+
i6 = "", a6 = c6;
|
|
24932
25185
|
}
|
|
24933
|
-
n3 = "", r6 = p3;
|
|
24934
25186
|
}
|
|
24935
|
-
}
|
|
24936
|
-
else n3 += t2[r6];
|
|
25187
|
+
} else i6 += t2[a6];
|
|
24937
25188
|
return e6.child;
|
|
24938
25189
|
};
|
|
24939
|
-
function
|
|
24940
|
-
this.options.captureMetaData || (
|
|
24941
|
-
const s2 = this.options.jPath ?
|
|
24942
|
-
false === r6 || ("string" == typeof r6 ? (e6.tagname = r6, t2.addChild(e6,
|
|
24943
|
-
}
|
|
24944
|
-
function
|
|
24945
|
-
const
|
|
24946
|
-
if (!
|
|
24947
|
-
if (
|
|
24948
|
-
const s2 = this.options.jPath ?
|
|
24949
|
-
if (!(Array.isArray(
|
|
24950
|
-
}
|
|
24951
|
-
if (n3.tagFilter) {
|
|
24952
|
-
const s2 = this.options.jPath ? i6.toString() : i6;
|
|
24953
|
-
if (!n3.tagFilter(e6, s2)) return t2;
|
|
24954
|
-
}
|
|
24955
|
-
for (const e7 of Object.keys(this.docTypeEntities)) {
|
|
24956
|
-
const i7 = this.docTypeEntities[e7], s2 = t2.match(i7.regx);
|
|
24957
|
-
if (s2) {
|
|
24958
|
-
if (this.entityExpansionCount += s2.length, n3.maxTotalExpansions && this.entityExpansionCount > n3.maxTotalExpansions) throw new Error(`Entity expansion limit exceeded: ${this.entityExpansionCount} > ${n3.maxTotalExpansions}`);
|
|
24959
|
-
const e8 = t2.length;
|
|
24960
|
-
if (t2 = t2.replace(i7.regx, i7.val), n3.maxExpandedLength && (this.currentExpandedLength += t2.length - e8, this.currentExpandedLength > n3.maxExpandedLength)) throw new Error(`Total expanded content size exceeded: ${this.currentExpandedLength} > ${n3.maxExpandedLength}`);
|
|
24961
|
-
}
|
|
24962
|
-
}
|
|
24963
|
-
for (const e7 of Object.keys(this.lastEntities)) {
|
|
24964
|
-
const i7 = this.lastEntities[e7], s2 = t2.match(i7.regex);
|
|
24965
|
-
if (s2 && (this.entityExpansionCount += s2.length, n3.maxTotalExpansions && this.entityExpansionCount > n3.maxTotalExpansions)) throw new Error(`Entity expansion limit exceeded: ${this.entityExpansionCount} > ${n3.maxTotalExpansions}`);
|
|
24966
|
-
t2 = t2.replace(i7.regex, i7.val);
|
|
25190
|
+
function lt(t2, e6, n3, i6) {
|
|
25191
|
+
this.options.captureMetaData || (i6 = void 0);
|
|
25192
|
+
const s2 = this.options.jPath ? n3.toString() : n3, r6 = this.options.updateTag(e6.tagname, s2, e6[":@"]);
|
|
25193
|
+
false === r6 || ("string" == typeof r6 ? (e6.tagname = r6, t2.addChild(e6, i6)) : t2.addChild(e6, i6));
|
|
25194
|
+
}
|
|
25195
|
+
function ut(t2, e6, n3) {
|
|
25196
|
+
const i6 = this.options.processEntities;
|
|
25197
|
+
if (!i6 || !i6.enabled) return t2;
|
|
25198
|
+
if (i6.allowedTags) {
|
|
25199
|
+
const s2 = this.options.jPath ? n3.toString() : n3;
|
|
25200
|
+
if (!(Array.isArray(i6.allowedTags) ? i6.allowedTags.includes(e6) : i6.allowedTags(e6, s2))) return t2;
|
|
24967
25201
|
}
|
|
24968
|
-
if (
|
|
24969
|
-
|
|
24970
|
-
|
|
24971
|
-
if (s2 && (this.entityExpansionCount += s2.length, n3.maxTotalExpansions && this.entityExpansionCount > n3.maxTotalExpansions)) throw new Error(`Entity expansion limit exceeded: ${this.entityExpansionCount} > ${n3.maxTotalExpansions}`);
|
|
24972
|
-
t2 = t2.replace(i7.regex, i7.val);
|
|
25202
|
+
if (i6.tagFilter) {
|
|
25203
|
+
const s2 = this.options.jPath ? n3.toString() : n3;
|
|
25204
|
+
if (!i6.tagFilter(e6, s2)) return t2;
|
|
24973
25205
|
}
|
|
24974
|
-
return
|
|
25206
|
+
return this.entityDecoder.decode(t2);
|
|
24975
25207
|
}
|
|
24976
|
-
function
|
|
24977
|
-
return t2 && (void 0 ===
|
|
25208
|
+
function pt(t2, e6, n3, i6) {
|
|
25209
|
+
return t2 && (void 0 === i6 && (i6 = 0 === e6.child.length), void 0 !== (t2 = this.parseTextData(t2, e6.tagname, n3, false, !!e6[":@"] && 0 !== Object.keys(e6[":@"]).length, i6)) && "" !== t2 && e6.add(this.options.textNodeName, t2), t2 = ""), t2;
|
|
24978
25210
|
}
|
|
24979
|
-
function
|
|
24980
|
-
|
|
24981
|
-
for (let i6 = 0; i6 < t2.length; i6++) if (e6.matches(t2[i6])) return true;
|
|
24982
|
-
return false;
|
|
25211
|
+
function ct() {
|
|
25212
|
+
return 0 !== this.stopNodeExpressionsSet.size && this.matcher.matchesAny(this.stopNodeExpressionsSet);
|
|
24983
25213
|
}
|
|
24984
|
-
function
|
|
24985
|
-
const s2 = t2.indexOf(e6,
|
|
24986
|
-
if (-1 === s2) throw new Error(
|
|
25214
|
+
function dt(t2, e6, n3, i6) {
|
|
25215
|
+
const s2 = t2.indexOf(e6, n3);
|
|
25216
|
+
if (-1 === s2) throw new Error(i6);
|
|
24987
25217
|
return s2 + e6.length - 1;
|
|
24988
25218
|
}
|
|
24989
|
-
function
|
|
24990
|
-
const s2 = (
|
|
24991
|
-
|
|
24992
|
-
|
|
24993
|
-
|
|
24994
|
-
|
|
24995
|
-
|
|
24996
|
-
|
|
24997
|
-
|
|
24998
|
-
|
|
24999
|
-
|
|
25000
|
-
|
|
25001
|
-
|
|
25002
|
-
|
|
25219
|
+
function ft(t2, e6, n3, i6) {
|
|
25220
|
+
const s2 = t2.indexOf(e6, n3);
|
|
25221
|
+
if (-1 === s2) throw new Error(i6);
|
|
25222
|
+
return s2;
|
|
25223
|
+
}
|
|
25224
|
+
function gt(t2, e6, n3, i6 = ">") {
|
|
25225
|
+
const s2 = (function(t3, e7, n4 = ">") {
|
|
25226
|
+
let i7 = 0;
|
|
25227
|
+
const s3 = [], r7 = t3.length, o4 = n4.charCodeAt(0), a7 = n4.length > 1 ? n4.charCodeAt(1) : -1;
|
|
25228
|
+
for (let n5 = e7; n5 < r7; n5++) {
|
|
25229
|
+
const e8 = t3.charCodeAt(n5);
|
|
25230
|
+
if (i7) e8 === i7 && (i7 = 0);
|
|
25231
|
+
else if (34 === e8 || 39 === e8) i7 = e8;
|
|
25232
|
+
else if (e8 === o4) {
|
|
25233
|
+
if (-1 === a7) return { data: String.fromCharCode(...s3), index: n5 };
|
|
25234
|
+
if (t3.charCodeAt(n5 + 1) === a7) return { data: String.fromCharCode(...s3), index: n5 };
|
|
25235
|
+
} else if (9 === e8) {
|
|
25236
|
+
s3.push(32);
|
|
25237
|
+
continue;
|
|
25238
|
+
}
|
|
25239
|
+
s3.push(e8);
|
|
25240
|
+
}
|
|
25241
|
+
})(t2, e6 + 1, i6);
|
|
25003
25242
|
if (!s2) return;
|
|
25004
25243
|
let r6 = s2.data;
|
|
25005
25244
|
const o3 = s2.index, a6 = r6.search(/\s/);
|
|
25006
25245
|
let h6 = r6, l4 = true;
|
|
25007
25246
|
-1 !== a6 && (h6 = r6.substring(0, a6), r6 = r6.substring(a6 + 1).trimStart());
|
|
25008
|
-
const
|
|
25009
|
-
if (
|
|
25247
|
+
const u2 = h6;
|
|
25248
|
+
if (n3) {
|
|
25010
25249
|
const t3 = h6.indexOf(":");
|
|
25011
25250
|
-1 !== t3 && (h6 = h6.substr(t3 + 1), l4 = h6 !== s2.data.substr(t3 + 1));
|
|
25012
25251
|
}
|
|
25013
|
-
return { tagName: h6, tagExp: r6, closeIndex: o3, attrExpPresent: l4, rawTagName:
|
|
25252
|
+
return { tagName: h6, tagExp: r6, closeIndex: o3, attrExpPresent: l4, rawTagName: u2 };
|
|
25014
25253
|
}
|
|
25015
|
-
function
|
|
25016
|
-
const
|
|
25254
|
+
function mt(t2, e6, n3) {
|
|
25255
|
+
const i6 = n3;
|
|
25017
25256
|
let s2 = 1;
|
|
25018
|
-
|
|
25019
|
-
|
|
25020
|
-
|
|
25021
|
-
|
|
25022
|
-
|
|
25023
|
-
|
|
25024
|
-
|
|
25025
|
-
|
|
25026
|
-
|
|
25027
|
-
|
|
25257
|
+
const r6 = t2.length;
|
|
25258
|
+
for (; n3 < r6; n3++) if ("<" === t2[n3]) {
|
|
25259
|
+
const r7 = t2.charCodeAt(n3 + 1);
|
|
25260
|
+
if (47 === r7) {
|
|
25261
|
+
const r8 = ft(t2, ">", n3, `${e6} is not closed`);
|
|
25262
|
+
if (t2.substring(n3 + 2, r8).trim() === e6 && (s2--, 0 === s2)) return { tagContent: t2.substring(i6, n3), i: r8 };
|
|
25263
|
+
n3 = r8;
|
|
25264
|
+
} else if (63 === r7) n3 = dt(t2, "?>", n3 + 1, "StopNode is not closed.");
|
|
25265
|
+
else if (33 === r7 && 45 === t2.charCodeAt(n3 + 2) && 45 === t2.charCodeAt(n3 + 3)) n3 = dt(t2, "-->", n3 + 3, "StopNode is not closed.");
|
|
25266
|
+
else if (33 === r7 && 91 === t2.charCodeAt(n3 + 2)) n3 = dt(t2, "]]>", n3, "StopNode is not closed.") - 2;
|
|
25267
|
+
else {
|
|
25268
|
+
const i7 = gt(t2, n3, ">");
|
|
25269
|
+
i7 && ((i7 && i7.tagName) === e6 && "/" !== i7.tagExp[i7.tagExp.length - 1] && s2++, n3 = i7.closeIndex);
|
|
25270
|
+
}
|
|
25028
25271
|
}
|
|
25029
25272
|
}
|
|
25030
|
-
function
|
|
25273
|
+
function xt(t2, e6, n3) {
|
|
25031
25274
|
if (e6 && "string" == typeof t2) {
|
|
25032
25275
|
const e7 = t2.trim();
|
|
25033
25276
|
return "true" === e7 || "false" !== e7 && (function(t3, e8 = {}) {
|
|
25034
|
-
if (e8 = Object.assign({},
|
|
25035
|
-
let
|
|
25036
|
-
if (
|
|
25037
|
-
if (
|
|
25038
|
-
if (
|
|
25277
|
+
if (e8 = Object.assign({}, L, e8), !t3 || "string" != typeof t3) return t3;
|
|
25278
|
+
let n4 = t3.trim();
|
|
25279
|
+
if (0 === n4.length) return t3;
|
|
25280
|
+
if (void 0 !== e8.skipLike && e8.skipLike.test(n4)) return t3;
|
|
25281
|
+
if ("0" === n4) return 0;
|
|
25282
|
+
if (e8.hex && j5.test(n4)) return (function(t4) {
|
|
25039
25283
|
if (parseInt) return parseInt(t4, 16);
|
|
25040
25284
|
if (Number.parseInt) return Number.parseInt(t4, 16);
|
|
25041
25285
|
if (window && window.parseInt) return window.parseInt(t4, 16);
|
|
25042
25286
|
throw new Error("parseInt, Number.parseInt, window.parseInt are not supported");
|
|
25043
|
-
})(
|
|
25044
|
-
if (isFinite(
|
|
25045
|
-
if (
|
|
25046
|
-
if (!
|
|
25047
|
-
const
|
|
25048
|
-
if (
|
|
25049
|
-
let s2 =
|
|
25050
|
-
const r6 = -1 ===
|
|
25051
|
-
return o3.length > 1 && a6 ? t4 : (1 !== o3.length || !
|
|
25287
|
+
})(n4);
|
|
25288
|
+
if (isFinite(n4)) {
|
|
25289
|
+
if (n4.includes("e") || n4.includes("E")) return (function(t4, e9, n5) {
|
|
25290
|
+
if (!n5.eNotation) return t4;
|
|
25291
|
+
const i7 = e9.match(k5);
|
|
25292
|
+
if (i7) {
|
|
25293
|
+
let s2 = i7[1] || "";
|
|
25294
|
+
const r6 = -1 === i7[3].indexOf("e") ? "E" : "e", o3 = i7[2], a6 = s2 ? t4[o3.length + 1] === r6 : t4[o3.length] === r6;
|
|
25295
|
+
return o3.length > 1 && a6 ? t4 : (1 !== o3.length || !i7[3].startsWith(`.${r6}`) && i7[3][0] !== r6) && o3.length > 0 ? n5.leadingZeros && !a6 ? (e9 = (i7[1] || "") + i7[3], Number(e9)) : t4 : Number(e9);
|
|
25052
25296
|
}
|
|
25053
25297
|
return t4;
|
|
25054
|
-
})(t3,
|
|
25298
|
+
})(t3, n4, e8);
|
|
25055
25299
|
{
|
|
25056
|
-
const s2 = V.exec(
|
|
25300
|
+
const s2 = V.exec(n4);
|
|
25057
25301
|
if (s2) {
|
|
25058
25302
|
const r6 = s2[1] || "", o3 = s2[2];
|
|
25059
|
-
let a6 = (
|
|
25303
|
+
let a6 = (i6 = s2[3]) && -1 !== i6.indexOf(".") ? ("." === (i6 = i6.replace(/0+$/, "")) ? i6 = "0" : "." === i6[0] ? i6 = "0" + i6 : "." === i6[i6.length - 1] && (i6 = i6.substring(0, i6.length - 1)), i6) : i6;
|
|
25060
25304
|
const h6 = r6 ? "." === t3[o3.length + 1] : "." === t3[o3.length];
|
|
25061
25305
|
if (!e8.leadingZeros && (o3.length > 1 || 1 === o3.length && !h6)) return t3;
|
|
25062
25306
|
{
|
|
25063
|
-
const
|
|
25064
|
-
if (0 ===
|
|
25065
|
-
if (-1 !== s3.search(/[eE]/)) return e8.eNotation ?
|
|
25066
|
-
if (-1 !==
|
|
25067
|
-
let h7 = o3 ? a6 :
|
|
25068
|
-
return o3 ? h7 === s3 || r6 + h7 === s3 ?
|
|
25307
|
+
const i7 = Number(n4), s3 = String(i7);
|
|
25308
|
+
if (0 === i7) return i7;
|
|
25309
|
+
if (-1 !== s3.search(/[eE]/)) return e8.eNotation ? i7 : t3;
|
|
25310
|
+
if (-1 !== n4.indexOf(".")) return "0" === s3 || s3 === a6 || s3 === `${r6}${a6}` ? i7 : t3;
|
|
25311
|
+
let h7 = o3 ? a6 : n4;
|
|
25312
|
+
return o3 ? h7 === s3 || r6 + h7 === s3 ? i7 : t3 : h7 === s3 || h7 === r6 + s3 ? i7 : t3;
|
|
25069
25313
|
}
|
|
25070
25314
|
}
|
|
25071
25315
|
return t3;
|
|
25072
25316
|
}
|
|
25073
25317
|
}
|
|
25074
|
-
var
|
|
25075
|
-
return (function(t4, e9,
|
|
25076
|
-
const
|
|
25077
|
-
switch (
|
|
25318
|
+
var i6;
|
|
25319
|
+
return (function(t4, e9, n5) {
|
|
25320
|
+
const i7 = e9 === 1 / 0;
|
|
25321
|
+
switch (n5.infinity.toLowerCase()) {
|
|
25078
25322
|
case "null":
|
|
25079
25323
|
return null;
|
|
25080
25324
|
case "infinity":
|
|
25081
25325
|
return e9;
|
|
25082
25326
|
case "string":
|
|
25083
|
-
return
|
|
25327
|
+
return i7 ? "Infinity" : "-Infinity";
|
|
25084
25328
|
default:
|
|
25085
25329
|
return t4;
|
|
25086
25330
|
}
|
|
25087
|
-
})(t3, Number(
|
|
25088
|
-
})(t2,
|
|
25331
|
+
})(t3, Number(n4), e8);
|
|
25332
|
+
})(t2, n3);
|
|
25089
25333
|
}
|
|
25090
25334
|
return void 0 !== t2 ? t2 : "";
|
|
25091
25335
|
}
|
|
25092
|
-
function
|
|
25093
|
-
const n3 = Number.parseInt(t2, e6);
|
|
25094
|
-
return n3 >= 0 && n3 <= 1114111 ? String.fromCodePoint(n3) : i6 + t2 + ";";
|
|
25095
|
-
}
|
|
25096
|
-
function ot(t2, e6, i6, n3) {
|
|
25336
|
+
function Nt(t2, e6, n3, i6) {
|
|
25097
25337
|
if (t2) {
|
|
25098
|
-
const
|
|
25099
|
-
|
|
25338
|
+
const i7 = t2(e6);
|
|
25339
|
+
n3 === e6 && (n3 = i7), e6 = i7;
|
|
25100
25340
|
}
|
|
25101
|
-
return { tagName: e6 =
|
|
25341
|
+
return { tagName: e6 = bt(e6, i6), tagExp: n3 };
|
|
25102
25342
|
}
|
|
25103
|
-
function
|
|
25343
|
+
function bt(t2, e6) {
|
|
25104
25344
|
if (a5.includes(t2)) throw new Error(`[SECURITY] Invalid name: "${t2}" is a reserved JavaScript keyword that could cause prototype pollution`);
|
|
25105
25345
|
return o2.includes(t2) ? e6.onDangerousProperty(t2) : t2;
|
|
25106
25346
|
}
|
|
25107
|
-
const
|
|
25108
|
-
function
|
|
25347
|
+
const yt = O.getMetaDataSymbol();
|
|
25348
|
+
function Et(t2, e6) {
|
|
25109
25349
|
if (!t2 || "object" != typeof t2) return {};
|
|
25110
25350
|
if (!e6) return t2;
|
|
25111
|
-
const
|
|
25112
|
-
for (const
|
|
25113
|
-
return
|
|
25351
|
+
const n3 = {};
|
|
25352
|
+
for (const i6 in t2) i6.startsWith(e6) ? n3[i6.substring(e6.length)] = t2[i6] : n3[i6] = t2[i6];
|
|
25353
|
+
return n3;
|
|
25114
25354
|
}
|
|
25115
|
-
function
|
|
25116
|
-
return
|
|
25355
|
+
function wt(t2, e6, n3, i6) {
|
|
25356
|
+
return vt(t2, e6, n3, i6);
|
|
25117
25357
|
}
|
|
25118
|
-
function
|
|
25358
|
+
function vt(t2, e6, n3, i6) {
|
|
25119
25359
|
let s2;
|
|
25120
25360
|
const r6 = {};
|
|
25121
25361
|
for (let o3 = 0; o3 < t2.length; o3++) {
|
|
25122
|
-
const a6 = t2[o3], h6 =
|
|
25362
|
+
const a6 = t2[o3], h6 = St(a6);
|
|
25123
25363
|
if (void 0 !== h6 && h6 !== e6.textNodeName) {
|
|
25124
|
-
const t3 =
|
|
25125
|
-
|
|
25364
|
+
const t3 = Et(a6[":@"] || {}, e6.attributeNamePrefix);
|
|
25365
|
+
n3.push(h6, t3);
|
|
25126
25366
|
}
|
|
25127
25367
|
if (h6 === e6.textNodeName) void 0 === s2 ? s2 = a6[h6] : s2 += "" + a6[h6];
|
|
25128
25368
|
else {
|
|
25129
25369
|
if (void 0 === h6) continue;
|
|
25130
25370
|
if (a6[h6]) {
|
|
25131
|
-
let t3 =
|
|
25132
|
-
const s3 =
|
|
25133
|
-
if (a6[":@"] ?
|
|
25371
|
+
let t3 = vt(a6[h6], e6, n3, i6);
|
|
25372
|
+
const s3 = At(t3, e6);
|
|
25373
|
+
if (a6[":@"] ? _t(t3, a6[":@"], i6, e6) : 1 !== Object.keys(t3).length || void 0 === t3[e6.textNodeName] || e6.alwaysCreateTextNode ? 0 === Object.keys(t3).length && (e6.alwaysCreateTextNode ? t3[e6.textNodeName] = "" : t3 = "") : t3 = t3[e6.textNodeName], void 0 !== a6[yt] && "object" == typeof t3 && null !== t3 && (t3[yt] = a6[yt]), void 0 !== r6[h6] && Object.prototype.hasOwnProperty.call(r6, h6)) Array.isArray(r6[h6]) || (r6[h6] = [r6[h6]]), r6[h6].push(t3);
|
|
25134
25374
|
else {
|
|
25135
|
-
const
|
|
25136
|
-
e6.isArray(h6,
|
|
25375
|
+
const n4 = e6.jPath ? i6.toString() : i6;
|
|
25376
|
+
e6.isArray(h6, n4, s3) ? r6[h6] = [t3] : r6[h6] = t3;
|
|
25137
25377
|
}
|
|
25138
|
-
void 0 !== h6 && h6 !== e6.textNodeName &&
|
|
25378
|
+
void 0 !== h6 && h6 !== e6.textNodeName && n3.pop();
|
|
25139
25379
|
}
|
|
25140
25380
|
}
|
|
25141
25381
|
}
|
|
25142
25382
|
return "string" == typeof s2 ? s2.length > 0 && (r6[e6.textNodeName] = s2) : void 0 !== s2 && (r6[e6.textNodeName] = s2), r6;
|
|
25143
25383
|
}
|
|
25144
|
-
function
|
|
25384
|
+
function St(t2) {
|
|
25145
25385
|
const e6 = Object.keys(t2);
|
|
25146
25386
|
for (let t3 = 0; t3 < e6.length; t3++) {
|
|
25147
|
-
const
|
|
25148
|
-
if (":@" !==
|
|
25387
|
+
const n3 = e6[t3];
|
|
25388
|
+
if (":@" !== n3) return n3;
|
|
25149
25389
|
}
|
|
25150
25390
|
}
|
|
25151
|
-
function
|
|
25391
|
+
function _t(t2, e6, n3, i6) {
|
|
25152
25392
|
if (e6) {
|
|
25153
25393
|
const s2 = Object.keys(e6), r6 = s2.length;
|
|
25154
25394
|
for (let o3 = 0; o3 < r6; o3++) {
|
|
25155
|
-
const r7 = s2[o3], a6 = r7.startsWith(
|
|
25156
|
-
|
|
25395
|
+
const r7 = s2[o3], a6 = r7.startsWith(i6.attributeNamePrefix) ? r7.substring(i6.attributeNamePrefix.length) : r7, h6 = i6.jPath ? n3.toString() + "." + a6 : n3;
|
|
25396
|
+
i6.isArray(r7, h6, true, true) ? t2[r7] = [e6[r7]] : t2[r7] = e6[r7];
|
|
25157
25397
|
}
|
|
25158
25398
|
}
|
|
25159
25399
|
}
|
|
25160
|
-
function
|
|
25161
|
-
const { textNodeName:
|
|
25162
|
-
return 0 ===
|
|
25400
|
+
function At(t2, e6) {
|
|
25401
|
+
const { textNodeName: n3 } = e6, i6 = Object.keys(t2).length;
|
|
25402
|
+
return 0 === i6 || !(1 !== i6 || !t2[n3] && "boolean" != typeof t2[n3] && 0 !== t2[n3]);
|
|
25163
25403
|
}
|
|
25164
|
-
class
|
|
25404
|
+
class Tt {
|
|
25165
25405
|
constructor(t2) {
|
|
25166
|
-
this.externalEntities = {}, this.options =
|
|
25406
|
+
this.externalEntities = {}, this.options = C(t2);
|
|
25167
25407
|
}
|
|
25168
25408
|
parse(t2, e6) {
|
|
25169
25409
|
if ("string" != typeof t2 && t2.toString) t2 = t2.toString();
|
|
25170
25410
|
else if ("string" != typeof t2) throw new Error("XML data is accepted in String or Bytes[] form.");
|
|
25171
25411
|
if (e6) {
|
|
25172
25412
|
true === e6 && (e6 = {});
|
|
25173
|
-
const
|
|
25174
|
-
if (true !==
|
|
25413
|
+
const n4 = l3(t2, e6);
|
|
25414
|
+
if (true !== n4) throw Error(`${n4.err.msg}:${n4.err.line}:${n4.err.col}`);
|
|
25175
25415
|
}
|
|
25176
|
-
const
|
|
25177
|
-
|
|
25178
|
-
const
|
|
25179
|
-
return this.options.preserveOrder || void 0 ===
|
|
25416
|
+
const n3 = new it(this.options);
|
|
25417
|
+
n3.entityDecoder.setExternalEntities(this.externalEntities);
|
|
25418
|
+
const i6 = n3.parseXml(t2);
|
|
25419
|
+
return this.options.preserveOrder || void 0 === i6 ? i6 : wt(i6, this.options, n3.matcher, n3.readonlyMatcher);
|
|
25180
25420
|
}
|
|
25181
25421
|
addEntity(t2, e6) {
|
|
25182
25422
|
if (-1 !== e6.indexOf("&")) throw new Error("Entity value can't have '&'");
|
|
@@ -25185,305 +25425,314 @@ var require_fxp = __commonJS({
|
|
|
25185
25425
|
this.externalEntities[t2] = e6;
|
|
25186
25426
|
}
|
|
25187
25427
|
static getMetaDataSymbol() {
|
|
25188
|
-
return
|
|
25428
|
+
return O.getMetaDataSymbol();
|
|
25189
25429
|
}
|
|
25190
25430
|
}
|
|
25191
|
-
function
|
|
25192
|
-
let
|
|
25193
|
-
e6.format && e6.indentBy.length > 0 && (
|
|
25194
|
-
const
|
|
25431
|
+
function Ct(t2, e6) {
|
|
25432
|
+
let n3 = "";
|
|
25433
|
+
e6.format && e6.indentBy.length > 0 && (n3 = "\n");
|
|
25434
|
+
const i6 = [];
|
|
25195
25435
|
if (e6.stopNodes && Array.isArray(e6.stopNodes)) for (let t3 = 0; t3 < e6.stopNodes.length; t3++) {
|
|
25196
|
-
const
|
|
25197
|
-
"string" == typeof
|
|
25436
|
+
const n4 = e6.stopNodes[t3];
|
|
25437
|
+
"string" == typeof n4 ? i6.push(new G(n4)) : n4 instanceof G && i6.push(n4);
|
|
25198
25438
|
}
|
|
25199
|
-
return
|
|
25439
|
+
return Pt(t2, e6, n3, new R(), i6);
|
|
25200
25440
|
}
|
|
25201
|
-
function
|
|
25441
|
+
function Pt(t2, e6, n3, i6, s2) {
|
|
25202
25442
|
let r6 = "", o3 = false;
|
|
25203
|
-
if (e6.maxNestedTags &&
|
|
25443
|
+
if (e6.maxNestedTags && i6.getDepth() > e6.maxNestedTags) throw new Error("Maximum nested tags exceeded");
|
|
25204
25444
|
if (!Array.isArray(t2)) {
|
|
25205
25445
|
if (null != t2) {
|
|
25206
|
-
let
|
|
25207
|
-
return
|
|
25446
|
+
let n4 = t2.toString();
|
|
25447
|
+
return n4 = Vt(n4, e6), n4;
|
|
25208
25448
|
}
|
|
25209
25449
|
return "";
|
|
25210
25450
|
}
|
|
25211
25451
|
for (let a6 = 0; a6 < t2.length; a6++) {
|
|
25212
|
-
const h6 = t2[a6], l4 =
|
|
25452
|
+
const h6 = t2[a6], l4 = Dt(h6);
|
|
25213
25453
|
if (void 0 === l4) continue;
|
|
25214
|
-
const
|
|
25215
|
-
|
|
25216
|
-
const
|
|
25454
|
+
const u2 = Ot(h6[":@"], e6);
|
|
25455
|
+
i6.push(l4, u2);
|
|
25456
|
+
const p3 = jt(i6, s2);
|
|
25217
25457
|
if (l4 === e6.textNodeName) {
|
|
25218
25458
|
let t3 = h6[l4];
|
|
25219
|
-
|
|
25459
|
+
p3 || (t3 = e6.tagValueProcessor(l4, t3), t3 = Vt(t3, e6)), o3 && (r6 += n3), r6 += t3, o3 = false, i6.pop();
|
|
25220
25460
|
continue;
|
|
25221
25461
|
}
|
|
25222
25462
|
if (l4 === e6.cdataPropName) {
|
|
25223
|
-
o3 && (r6 +=
|
|
25463
|
+
o3 && (r6 += n3);
|
|
25464
|
+
const t3 = h6[l4][0][e6.textNodeName];
|
|
25465
|
+
r6 += `<![CDATA[${String(t3).replace(/\]\]>/g, "]]]]><![CDATA[>")}]]>`, o3 = false, i6.pop();
|
|
25224
25466
|
continue;
|
|
25225
25467
|
}
|
|
25226
25468
|
if (l4 === e6.commentPropName) {
|
|
25227
|
-
|
|
25469
|
+
const t3 = h6[l4][0][e6.textNodeName];
|
|
25470
|
+
r6 += n3 + `<!--${String(t3).replace(/--/g, "- -").replace(/-$/, "- ")}-->`, o3 = true, i6.pop();
|
|
25228
25471
|
continue;
|
|
25229
25472
|
}
|
|
25230
25473
|
if ("?" === l4[0]) {
|
|
25231
|
-
const t3 =
|
|
25474
|
+
const t3 = Mt(h6[":@"], e6, p3), s3 = "?xml" === l4 ? "" : n3;
|
|
25232
25475
|
let a7 = h6[l4][0][e6.textNodeName];
|
|
25233
|
-
a7 = 0 !== a7.length ? " " + a7 : "", r6 += s3 + `<${l4}${a7}${t3}?>`, o3 = true,
|
|
25476
|
+
a7 = 0 !== a7.length ? " " + a7 : "", r6 += s3 + `<${l4}${a7}${t3}?>`, o3 = true, i6.pop();
|
|
25234
25477
|
continue;
|
|
25235
25478
|
}
|
|
25236
|
-
let c6 =
|
|
25479
|
+
let c6 = n3;
|
|
25237
25480
|
"" !== c6 && (c6 += e6.indentBy);
|
|
25238
|
-
const d6 =
|
|
25481
|
+
const d6 = n3 + `<${l4}${Mt(h6[":@"], e6, p3)}`;
|
|
25239
25482
|
let f6;
|
|
25240
|
-
f6 =
|
|
25483
|
+
f6 = p3 ? $t(h6[l4], e6) : Pt(h6[l4], e6, c6, i6, s2), -1 !== e6.unpairedTags.indexOf(l4) ? e6.suppressUnpairedNode ? r6 += d6 + ">" : r6 += d6 + "/>" : f6 && 0 !== f6.length || !e6.suppressEmptyNode ? f6 && f6.endsWith(">") ? r6 += d6 + `>${f6}${n3}</${l4}>` : (r6 += d6 + ">", f6 && "" !== n3 && (f6.includes("/>") || f6.includes("</")) ? r6 += n3 + e6.indentBy + f6 + n3 : r6 += f6, r6 += `</${l4}>`) : r6 += d6 + "/>", o3 = true, i6.pop();
|
|
25241
25484
|
}
|
|
25242
25485
|
return r6;
|
|
25243
25486
|
}
|
|
25244
|
-
function
|
|
25487
|
+
function Ot(t2, e6) {
|
|
25245
25488
|
if (!t2 || e6.ignoreAttributes) return null;
|
|
25246
|
-
const
|
|
25247
|
-
let
|
|
25248
|
-
for (let s2 in t2) Object.prototype.hasOwnProperty.call(t2, s2) && (
|
|
25249
|
-
return
|
|
25489
|
+
const n3 = {};
|
|
25490
|
+
let i6 = false;
|
|
25491
|
+
for (let s2 in t2) Object.prototype.hasOwnProperty.call(t2, s2) && (n3[s2.startsWith(e6.attributeNamePrefix) ? s2.substr(e6.attributeNamePrefix.length) : s2] = t2[s2], i6 = true);
|
|
25492
|
+
return i6 ? n3 : null;
|
|
25250
25493
|
}
|
|
25251
|
-
function
|
|
25494
|
+
function $t(t2, e6) {
|
|
25252
25495
|
if (!Array.isArray(t2)) return null != t2 ? t2.toString() : "";
|
|
25253
|
-
let
|
|
25254
|
-
for (let
|
|
25255
|
-
const s2 = t2[
|
|
25256
|
-
if (r6 === e6.textNodeName)
|
|
25257
|
-
else if (r6 === e6.cdataPropName)
|
|
25258
|
-
else if (r6 === e6.commentPropName)
|
|
25496
|
+
let n3 = "";
|
|
25497
|
+
for (let i6 = 0; i6 < t2.length; i6++) {
|
|
25498
|
+
const s2 = t2[i6], r6 = Dt(s2);
|
|
25499
|
+
if (r6 === e6.textNodeName) n3 += s2[r6];
|
|
25500
|
+
else if (r6 === e6.cdataPropName) n3 += s2[r6][0][e6.textNodeName];
|
|
25501
|
+
else if (r6 === e6.commentPropName) n3 += s2[r6][0][e6.textNodeName];
|
|
25259
25502
|
else {
|
|
25260
25503
|
if (r6 && "?" === r6[0]) continue;
|
|
25261
25504
|
if (r6) {
|
|
25262
|
-
const t3 =
|
|
25263
|
-
|
|
25505
|
+
const t3 = It(s2[":@"], e6), i7 = $t(s2[r6], e6);
|
|
25506
|
+
i7 && 0 !== i7.length ? n3 += `<${r6}${t3}>${i7}</${r6}>` : n3 += `<${r6}${t3}/>`;
|
|
25264
25507
|
}
|
|
25265
25508
|
}
|
|
25266
25509
|
}
|
|
25267
|
-
return
|
|
25510
|
+
return n3;
|
|
25268
25511
|
}
|
|
25269
|
-
function
|
|
25270
|
-
let
|
|
25271
|
-
if (t2 && !e6.ignoreAttributes) for (let
|
|
25272
|
-
if (!Object.prototype.hasOwnProperty.call(t2,
|
|
25273
|
-
let s2 = t2[
|
|
25274
|
-
true === s2 && e6.suppressBooleanAttributes ?
|
|
25512
|
+
function It(t2, e6) {
|
|
25513
|
+
let n3 = "";
|
|
25514
|
+
if (t2 && !e6.ignoreAttributes) for (let i6 in t2) {
|
|
25515
|
+
if (!Object.prototype.hasOwnProperty.call(t2, i6)) continue;
|
|
25516
|
+
let s2 = t2[i6];
|
|
25517
|
+
true === s2 && e6.suppressBooleanAttributes ? n3 += ` ${i6.substr(e6.attributeNamePrefix.length)}` : n3 += ` ${i6.substr(e6.attributeNamePrefix.length)}="${s2}"`;
|
|
25275
25518
|
}
|
|
25276
|
-
return
|
|
25519
|
+
return n3;
|
|
25277
25520
|
}
|
|
25278
|
-
function
|
|
25521
|
+
function Dt(t2) {
|
|
25279
25522
|
const e6 = Object.keys(t2);
|
|
25280
|
-
for (let
|
|
25281
|
-
const
|
|
25282
|
-
if (Object.prototype.hasOwnProperty.call(t2,
|
|
25523
|
+
for (let n3 = 0; n3 < e6.length; n3++) {
|
|
25524
|
+
const i6 = e6[n3];
|
|
25525
|
+
if (Object.prototype.hasOwnProperty.call(t2, i6) && ":@" !== i6) return i6;
|
|
25283
25526
|
}
|
|
25284
25527
|
}
|
|
25285
|
-
function
|
|
25286
|
-
let
|
|
25528
|
+
function Mt(t2, e6, n3) {
|
|
25529
|
+
let i6 = "";
|
|
25287
25530
|
if (t2 && !e6.ignoreAttributes) for (let s2 in t2) {
|
|
25288
25531
|
if (!Object.prototype.hasOwnProperty.call(t2, s2)) continue;
|
|
25289
25532
|
let r6;
|
|
25290
|
-
|
|
25533
|
+
n3 ? r6 = t2[s2] : (r6 = e6.attributeValueProcessor(s2, t2[s2]), r6 = Vt(r6, e6)), true === r6 && e6.suppressBooleanAttributes ? i6 += ` ${s2.substr(e6.attributeNamePrefix.length)}` : i6 += ` ${s2.substr(e6.attributeNamePrefix.length)}="${r6}"`;
|
|
25291
25534
|
}
|
|
25292
|
-
return
|
|
25535
|
+
return i6;
|
|
25293
25536
|
}
|
|
25294
|
-
function
|
|
25537
|
+
function jt(t2, e6) {
|
|
25295
25538
|
if (!e6 || 0 === e6.length) return false;
|
|
25296
|
-
for (let
|
|
25539
|
+
for (let n3 = 0; n3 < e6.length; n3++) if (t2.matches(e6[n3])) return true;
|
|
25297
25540
|
return false;
|
|
25298
25541
|
}
|
|
25299
|
-
function
|
|
25300
|
-
if (t2 && t2.length > 0 && e6.processEntities) for (let
|
|
25301
|
-
const
|
|
25302
|
-
t2 = t2.replace(
|
|
25542
|
+
function Vt(t2, e6) {
|
|
25543
|
+
if (t2 && t2.length > 0 && e6.processEntities) for (let n3 = 0; n3 < e6.entities.length; n3++) {
|
|
25544
|
+
const i6 = e6.entities[n3];
|
|
25545
|
+
t2 = t2.replace(i6.regex, i6.val);
|
|
25303
25546
|
}
|
|
25304
25547
|
return t2;
|
|
25305
25548
|
}
|
|
25306
|
-
const
|
|
25549
|
+
const Lt = { attributeNamePrefix: "@_", attributesGroupName: false, textNodeName: "#text", ignoreAttributes: true, cdataPropName: false, format: false, indentBy: " ", suppressEmptyNode: false, suppressUnpairedNode: true, suppressBooleanAttributes: true, tagValueProcessor: function(t2, e6) {
|
|
25307
25550
|
return e6;
|
|
25308
25551
|
}, attributeValueProcessor: function(t2, e6) {
|
|
25309
25552
|
return e6;
|
|
25310
25553
|
}, preserveOrder: false, commentPropName: false, unpairedTags: [], entities: [{ regex: new RegExp("&", "g"), val: "&" }, { regex: new RegExp(">", "g"), val: ">" }, { regex: new RegExp("<", "g"), val: "<" }, { regex: new RegExp("'", "g"), val: "'" }, { regex: new RegExp('"', "g"), val: """ }], processEntities: true, stopNodes: [], oneListGroup: false, maxNestedTags: 100, jPath: true };
|
|
25311
|
-
function
|
|
25312
|
-
if (this.options = Object.assign({},
|
|
25554
|
+
function kt(t2) {
|
|
25555
|
+
if (this.options = Object.assign({}, Lt, t2), this.options.stopNodes && Array.isArray(this.options.stopNodes) && (this.options.stopNodes = this.options.stopNodes.map((t3) => "string" == typeof t3 && t3.startsWith("*.") ? ".." + t3.substring(2) : t3)), this.stopNodeExpressions = [], this.options.stopNodes && Array.isArray(this.options.stopNodes)) for (let t3 = 0; t3 < this.options.stopNodes.length; t3++) {
|
|
25313
25556
|
const e7 = this.options.stopNodes[t3];
|
|
25314
|
-
"string" == typeof e7 ? this.stopNodeExpressions.push(new
|
|
25557
|
+
"string" == typeof e7 ? this.stopNodeExpressions.push(new G(e7)) : e7 instanceof G && this.stopNodeExpressions.push(e7);
|
|
25315
25558
|
}
|
|
25316
25559
|
var e6;
|
|
25317
25560
|
true === this.options.ignoreAttributes || this.options.attributesGroupName ? this.isAttribute = function() {
|
|
25318
25561
|
return false;
|
|
25319
25562
|
} : (this.ignoreAttributesFn = "function" == typeof (e6 = this.options.ignoreAttributes) ? e6 : Array.isArray(e6) ? (t3) => {
|
|
25320
|
-
for (const
|
|
25321
|
-
if ("string" == typeof
|
|
25322
|
-
if (
|
|
25563
|
+
for (const n3 of e6) {
|
|
25564
|
+
if ("string" == typeof n3 && t3 === n3) return true;
|
|
25565
|
+
if (n3 instanceof RegExp && n3.test(t3)) return true;
|
|
25323
25566
|
}
|
|
25324
|
-
} : () => false, this.attrPrefixLen = this.options.attributeNamePrefix.length, this.isAttribute =
|
|
25567
|
+
} : () => false, this.attrPrefixLen = this.options.attributeNamePrefix.length, this.isAttribute = Gt), this.processTextOrObjNode = Ft, this.options.format ? (this.indentate = Rt, this.tagEndChar = ">\n", this.newLine = "\n") : (this.indentate = function() {
|
|
25325
25568
|
return "";
|
|
25326
25569
|
}, this.tagEndChar = ">", this.newLine = "");
|
|
25327
25570
|
}
|
|
25328
|
-
function
|
|
25571
|
+
function Ft(t2, e6, n3, i6) {
|
|
25329
25572
|
const s2 = this.extractAttributes(t2);
|
|
25330
|
-
if (
|
|
25573
|
+
if (i6.push(e6, s2), this.checkStopNode(i6)) {
|
|
25331
25574
|
const s3 = this.buildRawContent(t2), r7 = this.buildAttributesForStopNode(t2);
|
|
25332
|
-
return
|
|
25575
|
+
return i6.pop(), this.buildObjectNode(s3, e6, r7, n3);
|
|
25333
25576
|
}
|
|
25334
|
-
const r6 = this.j2x(t2,
|
|
25335
|
-
return
|
|
25577
|
+
const r6 = this.j2x(t2, n3 + 1, i6);
|
|
25578
|
+
return i6.pop(), void 0 !== t2[this.options.textNodeName] && 1 === Object.keys(t2).length ? this.buildTextValNode(t2[this.options.textNodeName], e6, r6.attrStr, n3, i6) : this.buildObjectNode(r6.val, e6, r6.attrStr, n3);
|
|
25336
25579
|
}
|
|
25337
|
-
function
|
|
25580
|
+
function Rt(t2) {
|
|
25338
25581
|
return this.options.indentBy.repeat(t2);
|
|
25339
25582
|
}
|
|
25340
|
-
function
|
|
25583
|
+
function Gt(t2) {
|
|
25341
25584
|
return !(!t2.startsWith(this.options.attributeNamePrefix) || t2 === this.options.textNodeName) && t2.substr(this.attrPrefixLen);
|
|
25342
25585
|
}
|
|
25343
|
-
|
|
25344
|
-
if (this.options.preserveOrder) return
|
|
25586
|
+
kt.prototype.build = function(t2) {
|
|
25587
|
+
if (this.options.preserveOrder) return Ct(t2, this.options);
|
|
25345
25588
|
{
|
|
25346
25589
|
Array.isArray(t2) && this.options.arrayNodeName && this.options.arrayNodeName.length > 1 && (t2 = { [this.options.arrayNodeName]: t2 });
|
|
25347
|
-
const e6 = new
|
|
25590
|
+
const e6 = new R();
|
|
25348
25591
|
return this.j2x(t2, 0, e6).val;
|
|
25349
25592
|
}
|
|
25350
|
-
},
|
|
25351
|
-
let
|
|
25352
|
-
if (this.options.maxNestedTags &&
|
|
25353
|
-
const r6 = this.options.jPath ?
|
|
25593
|
+
}, kt.prototype.j2x = function(t2, e6, n3) {
|
|
25594
|
+
let i6 = "", s2 = "";
|
|
25595
|
+
if (this.options.maxNestedTags && n3.getDepth() >= this.options.maxNestedTags) throw new Error("Maximum nested tags exceeded");
|
|
25596
|
+
const r6 = this.options.jPath ? n3.toString() : n3, o3 = this.checkStopNode(n3);
|
|
25354
25597
|
for (let a6 in t2) if (Object.prototype.hasOwnProperty.call(t2, a6)) if (void 0 === t2[a6]) this.isAttribute(a6) && (s2 += "");
|
|
25355
25598
|
else if (null === t2[a6]) this.isAttribute(a6) || a6 === this.options.cdataPropName ? s2 += "" : "?" === a6[0] ? s2 += this.indentate(e6) + "<" + a6 + "?" + this.tagEndChar : s2 += this.indentate(e6) + "<" + a6 + "/" + this.tagEndChar;
|
|
25356
|
-
else if (t2[a6] instanceof Date) s2 += this.buildTextValNode(t2[a6], a6, "", e6,
|
|
25599
|
+
else if (t2[a6] instanceof Date) s2 += this.buildTextValNode(t2[a6], a6, "", e6, n3);
|
|
25357
25600
|
else if ("object" != typeof t2[a6]) {
|
|
25358
25601
|
const h6 = this.isAttribute(a6);
|
|
25359
|
-
if (h6 && !this.ignoreAttributesFn(h6, r6))
|
|
25602
|
+
if (h6 && !this.ignoreAttributesFn(h6, r6)) i6 += this.buildAttrPairStr(h6, "" + t2[a6], o3);
|
|
25360
25603
|
else if (!h6) if (a6 === this.options.textNodeName) {
|
|
25361
25604
|
let e7 = this.options.tagValueProcessor(a6, "" + t2[a6]);
|
|
25362
25605
|
s2 += this.replaceEntitiesValue(e7);
|
|
25363
25606
|
} else {
|
|
25364
|
-
|
|
25365
|
-
const
|
|
25366
|
-
if (
|
|
25367
|
-
const
|
|
25368
|
-
s2 += "" ===
|
|
25369
|
-
} else s2 += this.buildTextValNode(t2[a6], a6, "", e6,
|
|
25607
|
+
n3.push(a6);
|
|
25608
|
+
const i7 = this.checkStopNode(n3);
|
|
25609
|
+
if (n3.pop(), i7) {
|
|
25610
|
+
const n4 = "" + t2[a6];
|
|
25611
|
+
s2 += "" === n4 ? this.indentate(e6) + "<" + a6 + this.closeTag(a6) + this.tagEndChar : this.indentate(e6) + "<" + a6 + ">" + n4 + "</" + a6 + this.tagEndChar;
|
|
25612
|
+
} else s2 += this.buildTextValNode(t2[a6], a6, "", e6, n3);
|
|
25370
25613
|
}
|
|
25371
25614
|
} else if (Array.isArray(t2[a6])) {
|
|
25372
|
-
const
|
|
25615
|
+
const i7 = t2[a6].length;
|
|
25373
25616
|
let r7 = "", o4 = "";
|
|
25374
|
-
for (let h6 = 0; h6 <
|
|
25375
|
-
const
|
|
25376
|
-
if (void 0 ===
|
|
25377
|
-
else if (null ===
|
|
25378
|
-
else if ("object" == typeof
|
|
25379
|
-
|
|
25380
|
-
const t3 = this.j2x(
|
|
25381
|
-
|
|
25382
|
-
} else r7 += this.processTextOrObjNode(
|
|
25617
|
+
for (let h6 = 0; h6 < i7; h6++) {
|
|
25618
|
+
const i8 = t2[a6][h6];
|
|
25619
|
+
if (void 0 === i8) ;
|
|
25620
|
+
else if (null === i8) "?" === a6[0] ? s2 += this.indentate(e6) + "<" + a6 + "?" + this.tagEndChar : s2 += this.indentate(e6) + "<" + a6 + "/" + this.tagEndChar;
|
|
25621
|
+
else if ("object" == typeof i8) if (this.options.oneListGroup) {
|
|
25622
|
+
n3.push(a6);
|
|
25623
|
+
const t3 = this.j2x(i8, e6 + 1, n3);
|
|
25624
|
+
n3.pop(), r7 += t3.val, this.options.attributesGroupName && i8.hasOwnProperty(this.options.attributesGroupName) && (o4 += t3.attrStr);
|
|
25625
|
+
} else r7 += this.processTextOrObjNode(i8, a6, e6, n3);
|
|
25383
25626
|
else if (this.options.oneListGroup) {
|
|
25384
|
-
let t3 = this.options.tagValueProcessor(a6,
|
|
25627
|
+
let t3 = this.options.tagValueProcessor(a6, i8);
|
|
25385
25628
|
t3 = this.replaceEntitiesValue(t3), r7 += t3;
|
|
25386
25629
|
} else {
|
|
25387
|
-
|
|
25388
|
-
const t3 = this.checkStopNode(
|
|
25389
|
-
if (
|
|
25390
|
-
const t4 = "" +
|
|
25630
|
+
n3.push(a6);
|
|
25631
|
+
const t3 = this.checkStopNode(n3);
|
|
25632
|
+
if (n3.pop(), t3) {
|
|
25633
|
+
const t4 = "" + i8;
|
|
25391
25634
|
r7 += "" === t4 ? this.indentate(e6) + "<" + a6 + this.closeTag(a6) + this.tagEndChar : this.indentate(e6) + "<" + a6 + ">" + t4 + "</" + a6 + this.tagEndChar;
|
|
25392
|
-
} else r7 += this.buildTextValNode(
|
|
25635
|
+
} else r7 += this.buildTextValNode(i8, a6, "", e6, n3);
|
|
25393
25636
|
}
|
|
25394
25637
|
}
|
|
25395
25638
|
this.options.oneListGroup && (r7 = this.buildObjectNode(r7, a6, o4, e6)), s2 += r7;
|
|
25396
25639
|
} else if (this.options.attributesGroupName && a6 === this.options.attributesGroupName) {
|
|
25397
|
-
const e7 = Object.keys(t2[a6]),
|
|
25398
|
-
for (let s3 = 0; s3 <
|
|
25399
|
-
} else s2 += this.processTextOrObjNode(t2[a6], a6, e6,
|
|
25400
|
-
return { attrStr:
|
|
25401
|
-
},
|
|
25402
|
-
return
|
|
25403
|
-
},
|
|
25640
|
+
const e7 = Object.keys(t2[a6]), n4 = e7.length;
|
|
25641
|
+
for (let s3 = 0; s3 < n4; s3++) i6 += this.buildAttrPairStr(e7[s3], "" + t2[a6][e7[s3]], o3);
|
|
25642
|
+
} else s2 += this.processTextOrObjNode(t2[a6], a6, e6, n3);
|
|
25643
|
+
return { attrStr: i6, val: s2 };
|
|
25644
|
+
}, kt.prototype.buildAttrPairStr = function(t2, e6, n3) {
|
|
25645
|
+
return n3 || (e6 = this.options.attributeValueProcessor(t2, "" + e6), e6 = this.replaceEntitiesValue(e6)), this.options.suppressBooleanAttributes && "true" === e6 ? " " + t2 : " " + t2 + '="' + e6 + '"';
|
|
25646
|
+
}, kt.prototype.extractAttributes = function(t2) {
|
|
25404
25647
|
if (!t2 || "object" != typeof t2) return null;
|
|
25405
25648
|
const e6 = {};
|
|
25406
|
-
let
|
|
25649
|
+
let n3 = false;
|
|
25407
25650
|
if (this.options.attributesGroupName && t2[this.options.attributesGroupName]) {
|
|
25408
|
-
const
|
|
25409
|
-
for (let t3 in
|
|
25410
|
-
} else for (let
|
|
25411
|
-
if (!Object.prototype.hasOwnProperty.call(t2,
|
|
25412
|
-
const s2 = this.isAttribute(
|
|
25413
|
-
s2 && (e6[s2] = t2[
|
|
25651
|
+
const i6 = t2[this.options.attributesGroupName];
|
|
25652
|
+
for (let t3 in i6) Object.prototype.hasOwnProperty.call(i6, t3) && (e6[t3.startsWith(this.options.attributeNamePrefix) ? t3.substring(this.options.attributeNamePrefix.length) : t3] = i6[t3], n3 = true);
|
|
25653
|
+
} else for (let i6 in t2) {
|
|
25654
|
+
if (!Object.prototype.hasOwnProperty.call(t2, i6)) continue;
|
|
25655
|
+
const s2 = this.isAttribute(i6);
|
|
25656
|
+
s2 && (e6[s2] = t2[i6], n3 = true);
|
|
25414
25657
|
}
|
|
25415
|
-
return
|
|
25416
|
-
},
|
|
25658
|
+
return n3 ? e6 : null;
|
|
25659
|
+
}, kt.prototype.buildRawContent = function(t2) {
|
|
25417
25660
|
if ("string" == typeof t2) return t2;
|
|
25418
25661
|
if ("object" != typeof t2 || null === t2) return String(t2);
|
|
25419
25662
|
if (void 0 !== t2[this.options.textNodeName]) return t2[this.options.textNodeName];
|
|
25420
25663
|
let e6 = "";
|
|
25421
|
-
for (let
|
|
25422
|
-
if (!Object.prototype.hasOwnProperty.call(t2,
|
|
25423
|
-
if (this.isAttribute(
|
|
25424
|
-
if (this.options.attributesGroupName &&
|
|
25425
|
-
const
|
|
25426
|
-
if (
|
|
25427
|
-
else if (Array.isArray(
|
|
25428
|
-
for (let t3 of
|
|
25664
|
+
for (let n3 in t2) {
|
|
25665
|
+
if (!Object.prototype.hasOwnProperty.call(t2, n3)) continue;
|
|
25666
|
+
if (this.isAttribute(n3)) continue;
|
|
25667
|
+
if (this.options.attributesGroupName && n3 === this.options.attributesGroupName) continue;
|
|
25668
|
+
const i6 = t2[n3];
|
|
25669
|
+
if (n3 === this.options.textNodeName) e6 += i6;
|
|
25670
|
+
else if (Array.isArray(i6)) {
|
|
25671
|
+
for (let t3 of i6) if ("string" == typeof t3 || "number" == typeof t3) e6 += `<${n3}>${t3}</${n3}>`;
|
|
25429
25672
|
else if ("object" == typeof t3 && null !== t3) {
|
|
25430
|
-
const
|
|
25431
|
-
e6 += "" ===
|
|
25673
|
+
const i7 = this.buildRawContent(t3), s2 = this.buildAttributesForStopNode(t3);
|
|
25674
|
+
e6 += "" === i7 ? `<${n3}${s2}/>` : `<${n3}${s2}>${i7}</${n3}>`;
|
|
25432
25675
|
}
|
|
25433
|
-
} else if ("object" == typeof
|
|
25434
|
-
const t3 = this.buildRawContent(
|
|
25435
|
-
e6 += "" === t3 ? `<${
|
|
25436
|
-
} else e6 += `<${
|
|
25676
|
+
} else if ("object" == typeof i6 && null !== i6) {
|
|
25677
|
+
const t3 = this.buildRawContent(i6), s2 = this.buildAttributesForStopNode(i6);
|
|
25678
|
+
e6 += "" === t3 ? `<${n3}${s2}/>` : `<${n3}${s2}>${t3}</${n3}>`;
|
|
25679
|
+
} else e6 += `<${n3}>${i6}</${n3}>`;
|
|
25437
25680
|
}
|
|
25438
25681
|
return e6;
|
|
25439
|
-
},
|
|
25682
|
+
}, kt.prototype.buildAttributesForStopNode = function(t2) {
|
|
25440
25683
|
if (!t2 || "object" != typeof t2) return "";
|
|
25441
25684
|
let e6 = "";
|
|
25442
25685
|
if (this.options.attributesGroupName && t2[this.options.attributesGroupName]) {
|
|
25443
|
-
const
|
|
25444
|
-
for (let t3 in
|
|
25445
|
-
if (!Object.prototype.hasOwnProperty.call(
|
|
25446
|
-
const
|
|
25447
|
-
true === s2 && this.options.suppressBooleanAttributes ? e6 += " " +
|
|
25686
|
+
const n3 = t2[this.options.attributesGroupName];
|
|
25687
|
+
for (let t3 in n3) {
|
|
25688
|
+
if (!Object.prototype.hasOwnProperty.call(n3, t3)) continue;
|
|
25689
|
+
const i6 = t3.startsWith(this.options.attributeNamePrefix) ? t3.substring(this.options.attributeNamePrefix.length) : t3, s2 = n3[t3];
|
|
25690
|
+
true === s2 && this.options.suppressBooleanAttributes ? e6 += " " + i6 : e6 += " " + i6 + '="' + s2 + '"';
|
|
25448
25691
|
}
|
|
25449
|
-
} else for (let
|
|
25450
|
-
if (!Object.prototype.hasOwnProperty.call(t2,
|
|
25451
|
-
const
|
|
25452
|
-
if (
|
|
25453
|
-
const s2 = t2[
|
|
25454
|
-
true === s2 && this.options.suppressBooleanAttributes ? e6 += " " +
|
|
25692
|
+
} else for (let n3 in t2) {
|
|
25693
|
+
if (!Object.prototype.hasOwnProperty.call(t2, n3)) continue;
|
|
25694
|
+
const i6 = this.isAttribute(n3);
|
|
25695
|
+
if (i6) {
|
|
25696
|
+
const s2 = t2[n3];
|
|
25697
|
+
true === s2 && this.options.suppressBooleanAttributes ? e6 += " " + i6 : e6 += " " + i6 + '="' + s2 + '"';
|
|
25455
25698
|
}
|
|
25456
25699
|
}
|
|
25457
25700
|
return e6;
|
|
25458
|
-
},
|
|
25459
|
-
if ("" === t2) return "?" === e6[0] ? this.indentate(
|
|
25701
|
+
}, kt.prototype.buildObjectNode = function(t2, e6, n3, i6) {
|
|
25702
|
+
if ("" === t2) return "?" === e6[0] ? this.indentate(i6) + "<" + e6 + n3 + "?" + this.tagEndChar : this.indentate(i6) + "<" + e6 + n3 + this.closeTag(e6) + this.tagEndChar;
|
|
25460
25703
|
{
|
|
25461
25704
|
let s2 = "</" + e6 + this.tagEndChar, r6 = "";
|
|
25462
|
-
return "?" === e6[0] && (r6 = "?", s2 = ""), !
|
|
25705
|
+
return "?" === e6[0] && (r6 = "?", s2 = ""), !n3 && "" !== n3 || -1 !== t2.indexOf("<") ? false !== this.options.commentPropName && e6 === this.options.commentPropName && 0 === r6.length ? this.indentate(i6) + `<!--${t2}-->` + this.newLine : this.indentate(i6) + "<" + e6 + n3 + r6 + this.tagEndChar + t2 + this.indentate(i6) + s2 : this.indentate(i6) + "<" + e6 + n3 + r6 + ">" + t2 + s2;
|
|
25463
25706
|
}
|
|
25464
|
-
},
|
|
25707
|
+
}, kt.prototype.closeTag = function(t2) {
|
|
25465
25708
|
let e6 = "";
|
|
25466
25709
|
return -1 !== this.options.unpairedTags.indexOf(t2) ? this.options.suppressUnpairedNode || (e6 = "/") : e6 = this.options.suppressEmptyNode ? "/" : `></${t2}`, e6;
|
|
25467
|
-
},
|
|
25710
|
+
}, kt.prototype.checkStopNode = function(t2) {
|
|
25468
25711
|
if (!this.stopNodeExpressions || 0 === this.stopNodeExpressions.length) return false;
|
|
25469
25712
|
for (let e6 = 0; e6 < this.stopNodeExpressions.length; e6++) if (t2.matches(this.stopNodeExpressions[e6])) return true;
|
|
25470
25713
|
return false;
|
|
25471
|
-
},
|
|
25472
|
-
if (false !== this.options.cdataPropName && e6 === this.options.cdataPropName)
|
|
25473
|
-
|
|
25474
|
-
|
|
25714
|
+
}, kt.prototype.buildTextValNode = function(t2, e6, n3, i6, s2) {
|
|
25715
|
+
if (false !== this.options.cdataPropName && e6 === this.options.cdataPropName) {
|
|
25716
|
+
const e7 = String(t2).replace(/\]\]>/g, "]]]]><![CDATA[>");
|
|
25717
|
+
return this.indentate(i6) + `<![CDATA[${e7}]]>` + this.newLine;
|
|
25718
|
+
}
|
|
25719
|
+
if (false !== this.options.commentPropName && e6 === this.options.commentPropName) {
|
|
25720
|
+
const e7 = String(t2).replace(/--/g, "- -").replace(/-$/, "- ");
|
|
25721
|
+
return this.indentate(i6) + `<!--${e7}-->` + this.newLine;
|
|
25722
|
+
}
|
|
25723
|
+
if ("?" === e6[0]) return this.indentate(i6) + "<" + e6 + n3 + "?" + this.tagEndChar;
|
|
25475
25724
|
{
|
|
25476
25725
|
let s3 = this.options.tagValueProcessor(e6, t2);
|
|
25477
|
-
return s3 = this.replaceEntitiesValue(s3), "" === s3 ? this.indentate(
|
|
25726
|
+
return s3 = this.replaceEntitiesValue(s3), "" === s3 ? this.indentate(i6) + "<" + e6 + n3 + this.closeTag(e6) + this.tagEndChar : this.indentate(i6) + "<" + e6 + n3 + ">" + s3 + "</" + e6 + this.tagEndChar;
|
|
25478
25727
|
}
|
|
25479
|
-
},
|
|
25728
|
+
}, kt.prototype.replaceEntitiesValue = function(t2) {
|
|
25480
25729
|
if (t2 && t2.length > 0 && this.options.processEntities) for (let e6 = 0; e6 < this.options.entities.length; e6++) {
|
|
25481
|
-
const
|
|
25482
|
-
t2 = t2.replace(
|
|
25730
|
+
const n3 = this.options.entities[e6];
|
|
25731
|
+
t2 = t2.replace(n3.regex, n3.val);
|
|
25483
25732
|
}
|
|
25484
25733
|
return t2;
|
|
25485
25734
|
};
|
|
25486
|
-
const
|
|
25735
|
+
const Bt = kt, Ut = { validate: l3 };
|
|
25487
25736
|
module2.exports = e5;
|
|
25488
25737
|
})();
|
|
25489
25738
|
}
|
|
@@ -25510,8 +25759,6 @@ var require_xml_parser = __commonJS({
|
|
|
25510
25759
|
tagValueProcessor: (_, val) => val.trim() === "" && val.includes("\n") ? "" : void 0,
|
|
25511
25760
|
maxNestedTags: Infinity
|
|
25512
25761
|
});
|
|
25513
|
-
parser.addEntity("#xD", "\r");
|
|
25514
|
-
parser.addEntity("#10", "\n");
|
|
25515
25762
|
function parseXML3(xmlString) {
|
|
25516
25763
|
return parser.parse(xmlString, true);
|
|
25517
25764
|
}
|
|
@@ -190591,13 +190838,17 @@ function resolveConfig(env = process.env) {
|
|
|
190591
190838
|
var SecretsCache = class {
|
|
190592
190839
|
snapshot = null;
|
|
190593
190840
|
/** Replace the cached secrets in a single reference assignment. */
|
|
190594
|
-
swap(values,
|
|
190841
|
+
swap(values, revision) {
|
|
190595
190842
|
if (this.snapshot) {
|
|
190596
|
-
for (const
|
|
190597
|
-
|
|
190843
|
+
for (const bucket of Object.values(this.snapshot.values)) {
|
|
190844
|
+
for (const k5 of Object.keys(bucket)) bucket[k5] = "";
|
|
190598
190845
|
}
|
|
190599
190846
|
}
|
|
190600
|
-
|
|
190847
|
+
const cloned = {};
|
|
190848
|
+
for (const [ns, bucket] of Object.entries(values)) {
|
|
190849
|
+
cloned[ns] = { ...bucket };
|
|
190850
|
+
}
|
|
190851
|
+
this.snapshot = { values: cloned, revision, swappedAt: Date.now() };
|
|
190601
190852
|
}
|
|
190602
190853
|
/** Whether the cache has exceeded the given TTL (seconds). */
|
|
190603
190854
|
isExpired(ttlSeconds) {
|
|
@@ -190607,8 +190858,8 @@ var SecretsCache = class {
|
|
|
190607
190858
|
/** Clear the cached snapshot, zeroing values first (best-effort). */
|
|
190608
190859
|
wipe() {
|
|
190609
190860
|
if (this.snapshot) {
|
|
190610
|
-
for (const
|
|
190611
|
-
|
|
190861
|
+
for (const bucket of Object.values(this.snapshot.values)) {
|
|
190862
|
+
for (const k5 of Object.keys(bucket)) bucket[k5] = "";
|
|
190612
190863
|
}
|
|
190613
190864
|
}
|
|
190614
190865
|
this.snapshot = null;
|
|
@@ -190617,20 +190868,43 @@ var SecretsCache = class {
|
|
|
190617
190868
|
getSwappedAt() {
|
|
190618
190869
|
return this.snapshot?.swappedAt ?? null;
|
|
190619
190870
|
}
|
|
190620
|
-
/**
|
|
190621
|
-
|
|
190622
|
-
|
|
190871
|
+
/**
|
|
190872
|
+
* Get a single secret value.
|
|
190873
|
+
*
|
|
190874
|
+
* - With `namespace`: scoped lookup (`values[namespace]?.[key]`).
|
|
190875
|
+
* - Without `namespace`: searches every namespace, returns the first match.
|
|
190876
|
+
* This loose form exists for **internal callers only** (the agent's
|
|
190877
|
+
* telemetry-config bootstrap) where the namespace isn't known a priori.
|
|
190878
|
+
* Public APIs (`runtime.get`, `client.get`) require the namespace.
|
|
190879
|
+
*/
|
|
190880
|
+
get(key, namespace) {
|
|
190881
|
+
const values = this.snapshot?.values;
|
|
190882
|
+
if (!values) return void 0;
|
|
190883
|
+
if (namespace !== void 0) return values[namespace]?.[key];
|
|
190884
|
+
for (const bucket of Object.values(values)) {
|
|
190885
|
+
if (key in bucket) return bucket[key];
|
|
190886
|
+
}
|
|
190887
|
+
return void 0;
|
|
190623
190888
|
}
|
|
190624
|
-
/** Get all cached
|
|
190889
|
+
/** Get all cached secrets as nested namespace → key → value. Null if not yet loaded. */
|
|
190625
190890
|
getAll() {
|
|
190626
190891
|
const s = this.snapshot;
|
|
190627
190892
|
if (!s) return null;
|
|
190628
|
-
|
|
190893
|
+
const out = {};
|
|
190894
|
+
for (const [ns, bucket] of Object.entries(s.values)) {
|
|
190895
|
+
out[ns] = { ...bucket };
|
|
190896
|
+
}
|
|
190897
|
+
return out;
|
|
190629
190898
|
}
|
|
190630
|
-
/** Get the list of available secret key names. */
|
|
190899
|
+
/** Get the list of available secret key names in flat `<namespace>__<key>` form. */
|
|
190631
190900
|
getKeys() {
|
|
190632
190901
|
const s = this.snapshot;
|
|
190633
|
-
|
|
190902
|
+
if (!s) return [];
|
|
190903
|
+
const out = [];
|
|
190904
|
+
for (const [ns, bucket] of Object.entries(s.values)) {
|
|
190905
|
+
for (const k5 of Object.keys(bucket)) out.push(`${ns}__${k5}`);
|
|
190906
|
+
}
|
|
190907
|
+
return out;
|
|
190634
190908
|
}
|
|
190635
190909
|
/** Get the current artifact revision, or null if not loaded. */
|
|
190636
190910
|
getRevision() {
|
|
@@ -190947,7 +191221,13 @@ var ArtifactDecryptor = class {
|
|
|
190947
191221
|
} finally {
|
|
190948
191222
|
plaintext = "";
|
|
190949
191223
|
}
|
|
190950
|
-
|
|
191224
|
+
const keys = [];
|
|
191225
|
+
for (const [ns, bucket] of Object.entries(values)) {
|
|
191226
|
+
for (const k5 of Object.keys(bucket)) {
|
|
191227
|
+
keys.push(`${ns}__${k5}`);
|
|
191228
|
+
}
|
|
191229
|
+
}
|
|
191230
|
+
return { values, keys, revision: artifact.revision };
|
|
190951
191231
|
}
|
|
190952
191232
|
/** KMS envelope: unwrap DEK via KMS, then AES-256-GCM decrypt. */
|
|
190953
191233
|
async decryptKmsEnvelope(artifact) {
|
|
@@ -193446,9 +193726,8 @@ var ArtifactPoller = class {
|
|
|
193446
193726
|
async validateDecryptAndCache(parsed, contentHash) {
|
|
193447
193727
|
const artifact = this.validateArtifact(parsed);
|
|
193448
193728
|
if (artifact.revision === this.lastRevision) return;
|
|
193449
|
-
const { values } = await this.decryptor.decrypt(artifact);
|
|
193450
|
-
|
|
193451
|
-
this.options.cache.swap(values, keys, artifact.revision);
|
|
193729
|
+
const { values, keys } = await this.decryptor.decrypt(artifact);
|
|
193730
|
+
this.options.cache.swap(values, artifact.revision);
|
|
193452
193731
|
this.lastRevision = artifact.revision;
|
|
193453
193732
|
this.lastContentHash = contentHash ?? null;
|
|
193454
193733
|
this.lastExpiresAt = artifact.expiresAt ?? null;
|
|
@@ -194264,8 +194543,8 @@ function startAgentServer(options) {
|
|
|
194264
194543
|
return;
|
|
194265
194544
|
}
|
|
194266
194545
|
try {
|
|
194267
|
-
const {
|
|
194268
|
-
res.json(
|
|
194546
|
+
const { keys } = await decryptor.decrypt(artifact);
|
|
194547
|
+
res.json(keys);
|
|
194269
194548
|
} catch (err) {
|
|
194270
194549
|
const message = err instanceof Error ? err.message : String(err);
|
|
194271
194550
|
res.status(503).json({ error: "Decryption failed", detail: message });
|
|
@@ -194481,7 +194760,7 @@ async function initialFetch(poller, jitMode, encryptedStore, cache5, sourceDesc)
|
|
|
194481
194760
|
await poller.fetchAndValidate();
|
|
194482
194761
|
const artifact = encryptedStore.get();
|
|
194483
194762
|
const { values } = await poller.getDecryptor().decrypt(artifact);
|
|
194484
|
-
cache5.swap(values,
|
|
194763
|
+
cache5.swap(values, artifact.revision);
|
|
194485
194764
|
} else {
|
|
194486
194765
|
await poller.fetchAndDecrypt();
|
|
194487
194766
|
}
|
|
@@ -194504,7 +194783,7 @@ async function initialFetch(poller, jitMode, encryptedStore, cache5, sourceDesc)
|
|
|
194504
194783
|
}
|
|
194505
194784
|
|
|
194506
194785
|
// package.json
|
|
194507
|
-
var version5 = "0.1.
|
|
194786
|
+
var version5 = "0.1.24-beta.166";
|
|
194508
194787
|
|
|
194509
194788
|
// src/main.ts
|
|
194510
194789
|
var isLambda = !!process.env.AWS_LAMBDA_RUNTIME_API;
|