@cdk8s/awscdk-resolver 0.0.609 → 0.0.610
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/.jsii +3 -3
- package/lib/resolve.js +1 -1
- package/node_modules/@aws-sdk/client-cloudformation/package.json +3 -3
- package/node_modules/@aws-sdk/core/package.json +2 -2
- package/node_modules/@aws-sdk/credential-provider-env/package.json +2 -2
- package/node_modules/@aws-sdk/credential-provider-http/package.json +2 -2
- package/node_modules/@aws-sdk/credential-provider-ini/package.json +9 -9
- package/node_modules/@aws-sdk/credential-provider-login/package.json +3 -3
- package/node_modules/@aws-sdk/credential-provider-node/package.json +7 -7
- package/node_modules/@aws-sdk/credential-provider-process/package.json +2 -2
- package/node_modules/@aws-sdk/credential-provider-sso/package.json +4 -4
- package/node_modules/@aws-sdk/credential-provider-web-identity/package.json +3 -3
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/cognito-identity/index.js +1 -1
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/signin/index.js +1 -1
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso/index.js +1 -1
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso-oidc/index.js +1 -1
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sts/index.js +1 -1
- package/node_modules/@aws-sdk/nested-clients/package.json +2 -2
- package/node_modules/@aws-sdk/token-providers/package.json +3 -3
- package/node_modules/@aws-sdk/xml-builder/dist-cjs/xml-parser.browser.js +1 -1
- package/node_modules/@aws-sdk/xml-builder/dist-cjs/xml-parser.js +233 -43
- package/node_modules/@aws-sdk/xml-builder/dist-es/xml-parser.browser.js +1 -1
- package/node_modules/@aws-sdk/xml-builder/dist-es/xml-parser.js +233 -43
- package/node_modules/@aws-sdk/xml-builder/dist-types/ts3.4/xml-parser.d.ts +1 -1
- package/node_modules/@aws-sdk/xml-builder/dist-types/xml-parser.d.ts +2 -1
- package/node_modules/@aws-sdk/xml-builder/package.json +4 -4
- package/node_modules/@smithy/core/dist-cjs/submodules/cbor/index.js +518 -371
- package/node_modules/@smithy/core/dist-cjs/submodules/client/index.js +1 -1
- package/node_modules/@smithy/core/dist-es/submodules/cbor/cbor-decode.js +326 -269
- package/node_modules/@smithy/core/dist-es/submodules/cbor/cbor-encode.js +192 -103
- package/node_modules/@smithy/core/dist-es/submodules/cbor/cbor.js +4 -2
- package/node_modules/@smithy/core/dist-es/submodules/client/smithy-client/get-value-from-text-node.js +1 -1
- package/node_modules/@smithy/core/dist-types/submodules/cbor/cbor-decode.d.ts +4 -0
- package/node_modules/@smithy/core/dist-types/submodules/cbor/cbor-encode.d.ts +8 -4
- package/node_modules/@smithy/core/package.json +1 -1
- package/node_modules/@smithy/credential-provider-imds/package.json +2 -2
- package/node_modules/@smithy/fetch-http-handler/package.json +2 -2
- package/node_modules/@smithy/node-http-handler/package.json +2 -2
- package/node_modules/@smithy/signature-v4/package.json +2 -2
- package/package.json +6 -6
- package/node_modules/@aws-sdk/xml-builder/dist-cjs/xml-external/nodable_entities.js +0 -333
- package/node_modules/@aws-sdk/xml-builder/dist-es/xml-external/nodable_entities.js +0 -332
- package/node_modules/@aws-sdk/xml-builder/dist-types/ts3.4/xml-external/nodable_entities.d.ts +0 -66
- package/node_modules/@aws-sdk/xml-builder/dist-types/xml-external/nodable_entities.d.ts +0 -65
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/CHANGELOG.md +0 -827
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/LICENSE +0 -21
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/README.md +0 -202
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/lib/fxbuilder.min.js +0 -2
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/lib/fxbuilder.min.js.map +0 -1
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/lib/fxp.cjs +0 -1
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/lib/fxp.d.cts +0 -770
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/lib/fxp.min.js +0 -2
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/lib/fxp.min.js.map +0 -1
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/lib/fxparser.min.js +0 -2
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/lib/fxparser.min.js.map +0 -1
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/lib/fxvalidator.min.js +0 -2
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/lib/fxvalidator.min.js.map +0 -1
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/package.json +0 -93
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/src/cli/cli.js +0 -97
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/src/cli/man.js +0 -17
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/src/cli/read.js +0 -43
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/src/fxp.d.ts +0 -739
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/src/fxp.js +0 -14
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/src/ignoreAttributes.js +0 -18
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/src/util.js +0 -61
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/src/v6/CharsSymbol.js +0 -16
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/src/v6/EntitiesParser.js +0 -106
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/src/v6/OptionsBuilder.js +0 -61
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/src/v6/OutputBuilders/BaseOutputBuilder.js +0 -69
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/src/v6/OutputBuilders/JsArrBuilder.js +0 -103
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/src/v6/OutputBuilders/JsMinArrBuilder.js +0 -100
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/src/v6/OutputBuilders/JsObjBuilder.js +0 -154
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/src/v6/OutputBuilders/ParserOptionsBuilder.js +0 -94
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/src/v6/Report.js +0 -0
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/src/v6/TagPath.js +0 -81
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/src/v6/TagPathMatcher.js +0 -13
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/src/v6/XMLParser.js +0 -83
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/src/v6/Xml2JsParser.js +0 -235
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/src/v6/XmlPartReader.js +0 -210
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/src/v6/XmlSpecialTagsReader.js +0 -111
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/src/v6/inputSource/BufferSource.js +0 -116
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/src/v6/inputSource/StringSource.js +0 -121
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/src/v6/valueParsers/EntitiesParser.js +0 -105
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/src/v6/valueParsers/booleanParser.js +0 -22
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/src/v6/valueParsers/booleanParserExt.js +0 -19
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/src/v6/valueParsers/currency.js +0 -38
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/src/v6/valueParsers/join.js +0 -13
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/src/v6/valueParsers/number.js +0 -14
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/src/v6/valueParsers/trim.js +0 -6
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/src/validator.js +0 -425
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/src/xmlbuilder/json2xml.js +0 -6
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/src/xmlparser/DocTypeReader.js +0 -407
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/src/xmlparser/OptionsBuilder.js +0 -163
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/src/xmlparser/OrderedObjParser.js +0 -840
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/src/xmlparser/XMLParser.js +0 -71
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/src/xmlparser/node2json.js +0 -177
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/src/xmlparser/xmlNode.js +0 -40
- package/node_modules/@nodable/entities/README.md +0 -41
- package/node_modules/@nodable/entities/package.json +0 -57
- package/node_modules/@nodable/entities/src/EntityDecoder.js +0 -644
- package/node_modules/@nodable/entities/src/EntityEncoder.js +0 -194
- package/node_modules/@nodable/entities/src/entities.js +0 -1159
- package/node_modules/@nodable/entities/src/entityTries.js +0 -49
- package/node_modules/@nodable/entities/src/index.d.ts +0 -341
- package/node_modules/@nodable/entities/src/index.js +0 -29
- package/node_modules/anynum/LICENSE +0 -21
- package/node_modules/anynum/README.md +0 -142
- package/node_modules/anynum/anynum.js +0 -135
- package/node_modules/anynum/digitTable.js +0 -116
- package/node_modules/anynum/package.json +0 -42
- package/node_modules/fast-xml-builder/CHANGELOG.md +0 -40
- package/node_modules/fast-xml-builder/LICENSE +0 -21
- package/node_modules/fast-xml-builder/README.md +0 -74
- package/node_modules/fast-xml-builder/lib/fxb.cjs +0 -1
- package/node_modules/fast-xml-builder/lib/fxb.d.cts +0 -270
- package/node_modules/fast-xml-builder/lib/fxb.min.js +0 -2
- package/node_modules/fast-xml-builder/lib/fxb.min.js.map +0 -1
- package/node_modules/fast-xml-builder/package.json +0 -81
- package/node_modules/fast-xml-builder/src/fxb.d.ts +0 -270
- package/node_modules/fast-xml-builder/src/fxb.js +0 -599
- package/node_modules/fast-xml-builder/src/ignoreAttributes.js +0 -18
- package/node_modules/fast-xml-builder/src/orderedJs2Xml.js +0 -359
- package/node_modules/fast-xml-builder/src/prettifyJs2Xml.js +0 -0
- package/node_modules/fast-xml-builder/src/util.js +0 -16
- package/node_modules/path-expression-matcher/LICENSE +0 -21
- package/node_modules/path-expression-matcher/README.md +0 -947
- package/node_modules/path-expression-matcher/lib/pem.cjs +0 -1
- package/node_modules/path-expression-matcher/lib/pem.d.cts +0 -715
- package/node_modules/path-expression-matcher/lib/pem.min.js +0 -2
- package/node_modules/path-expression-matcher/lib/pem.min.js.map +0 -1
- package/node_modules/path-expression-matcher/package.json +0 -79
- package/node_modules/path-expression-matcher/src/Expression.js +0 -232
- package/node_modules/path-expression-matcher/src/ExpressionSet.js +0 -225
- package/node_modules/path-expression-matcher/src/Matcher.js +0 -660
- package/node_modules/path-expression-matcher/src/index.d.ts +0 -589
- package/node_modules/path-expression-matcher/src/index.js +0 -29
- package/node_modules/strnum/CHANGELOG.md +0 -51
- package/node_modules/strnum/LICENSE +0 -21
- package/node_modules/strnum/README.md +0 -113
- package/node_modules/strnum/package.json +0 -36
- package/node_modules/strnum/strnum.js +0 -171
- package/node_modules/xml-naming/README.md +0 -189
- package/node_modules/xml-naming/package.json +0 -54
- package/node_modules/xml-naming/src/index.d.ts +0 -74
- package/node_modules/xml-naming/src/index.js +0 -270
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
import { TABLE, TABLE_OFFSET, HIGH_MAP, NOT_DIGIT } from './digitTable.js';
|
|
4
|
-
|
|
5
|
-
const CHAR_0 = 48; // '0'.charCodeAt(0)
|
|
6
|
-
const CHAR_9 = 57; // '9'.charCodeAt(0)
|
|
7
|
-
const CHAR_MINUS = 45; // '-'.charCodeAt(0)
|
|
8
|
-
|
|
9
|
-
// Unicode minus/hyphen variants worth normalizing to ASCII '-' in numeric context:
|
|
10
|
-
// U+2212 MINUS SIGN − (mathematically correct minus)
|
|
11
|
-
// U+FF0D FULLWIDTH HYPHEN-MINUS - (Japanese fullwidth context)
|
|
12
|
-
// U+FE63 SMALL HYPHEN-MINUS ﹣ (small form variant)
|
|
13
|
-
//
|
|
14
|
-
// NOT normalized (deliberate):
|
|
15
|
-
// U+2013 EN DASH – (punctuation, not a numeric sign)
|
|
16
|
-
// U+2014 EM DASH — (punctuation)
|
|
17
|
-
// U+2010 HYPHEN ‐ (typographic hyphen)
|
|
18
|
-
//
|
|
19
|
-
// Rationale: only characters a human or locale formatter would plausibly use
|
|
20
|
-
// as a numeric minus sign are normalized. Dashes used for punctuation are left
|
|
21
|
-
// alone to avoid mangling non-numeric strings.
|
|
22
|
-
const MINUS_SET = new Set([0x2212, 0xFF0D, 0xFE63]);
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Normalize all Unicode decimal digit characters in a string to ASCII (0-9),
|
|
26
|
-
* and normalize Unicode minus variants to ASCII '-' (U+002D).
|
|
27
|
-
*
|
|
28
|
-
* Non-digit, non-minus characters are passed through unchanged.
|
|
29
|
-
*
|
|
30
|
-
* Performance design:
|
|
31
|
-
* - Fast path: if the string has no convertible characters, return it unchanged
|
|
32
|
-
* (zero allocation).
|
|
33
|
-
* - BMP digits (0x0660..0xFFFF excl. surrogates): flat Uint8Array lookup (O(1)).
|
|
34
|
-
* - Supplementary plane digits (> 0xFFFF, encoded as surrogate pairs): Map lookup.
|
|
35
|
-
* - Minus variants: checked inline with a small fixed Set.
|
|
36
|
-
*
|
|
37
|
-
* @param {string} str
|
|
38
|
-
* @returns {string}
|
|
39
|
-
*/
|
|
40
|
-
function anynum(str) {
|
|
41
|
-
if (typeof str !== 'string') return str;
|
|
42
|
-
|
|
43
|
-
const len = str.length;
|
|
44
|
-
if (len === 0) return str;
|
|
45
|
-
|
|
46
|
-
// Scan for first character needing conversion.
|
|
47
|
-
// If none found, return original string (zero allocation).
|
|
48
|
-
let firstHit = -1;
|
|
49
|
-
|
|
50
|
-
for (let i = 0; i < len; i++) {
|
|
51
|
-
const cc = str.charCodeAt(i);
|
|
52
|
-
|
|
53
|
-
// ASCII digit or ASCII minus — already normalized, skip fast
|
|
54
|
-
if ((cc >= CHAR_0 && cc <= CHAR_9) || cc === CHAR_MINUS) continue;
|
|
55
|
-
|
|
56
|
-
// Below first unicode digit script — check minus variants only
|
|
57
|
-
if (cc < TABLE_OFFSET) {
|
|
58
|
-
if (MINUS_SET.has(cc)) { firstHit = i; break; }
|
|
59
|
-
continue;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
// Surrogate pairs live in BMP range 0xD800-0xDFFF — check before TABLE
|
|
63
|
-
if (cc >= 0xD800 && cc <= 0xDBFF) {
|
|
64
|
-
if (i + 1 < len) {
|
|
65
|
-
const low = str.charCodeAt(i + 1);
|
|
66
|
-
if (low >= 0xDC00 && low <= 0xDFFF) {
|
|
67
|
-
const cp = 0x10000 + ((cc - 0xD800) << 10) + (low - 0xDC00);
|
|
68
|
-
if (HIGH_MAP.has(cp)) { firstHit = i; break; }
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
continue;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
// BMP non-surrogate: flat table lookup; also check minus variants in this range
|
|
75
|
-
if (TABLE[cc - TABLE_OFFSET] !== NOT_DIGIT || MINUS_SET.has(cc)) {
|
|
76
|
-
firstHit = i;
|
|
77
|
-
break;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
// Nothing to replace — return original, zero allocation
|
|
82
|
-
if (firstHit === -1) return str;
|
|
83
|
-
|
|
84
|
-
// Build result: copy unchanged prefix, then convert from firstHit onward
|
|
85
|
-
const chars = [];
|
|
86
|
-
|
|
87
|
-
if (firstHit > 0) chars.push(str.slice(0, firstHit));
|
|
88
|
-
|
|
89
|
-
for (let i = firstHit; i < len; i++) {
|
|
90
|
-
const cc = str.charCodeAt(i);
|
|
91
|
-
|
|
92
|
-
// ASCII digit or ASCII minus — pass through
|
|
93
|
-
if ((cc >= CHAR_0 && cc <= CHAR_9) || cc === CHAR_MINUS) {
|
|
94
|
-
chars.push(str[i]);
|
|
95
|
-
continue;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
// Below TABLE_OFFSET — check minus variants, else pass through
|
|
99
|
-
if (cc < TABLE_OFFSET) {
|
|
100
|
-
chars.push(MINUS_SET.has(cc) ? '-' : str[i]);
|
|
101
|
-
continue;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
// Surrogate pairs
|
|
105
|
-
if (cc >= 0xD800 && cc <= 0xDBFF) {
|
|
106
|
-
if (i + 1 < len) {
|
|
107
|
-
const low = str.charCodeAt(i + 1);
|
|
108
|
-
if (low >= 0xDC00 && low <= 0xDFFF) {
|
|
109
|
-
const cp = 0x10000 + ((cc - 0xD800) << 10) + (low - 0xDC00);
|
|
110
|
-
const d = HIGH_MAP.get(cp);
|
|
111
|
-
if (d !== undefined) {
|
|
112
|
-
chars.push(String.fromCharCode(d + 48));
|
|
113
|
-
i++; // consume low surrogate
|
|
114
|
-
continue;
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
chars.push(str[i]);
|
|
119
|
-
continue;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
// BMP non-surrogate: flat table lookup + minus variants
|
|
123
|
-
if (MINUS_SET.has(cc)) {
|
|
124
|
-
chars.push('-');
|
|
125
|
-
continue;
|
|
126
|
-
}
|
|
127
|
-
const d = TABLE[cc - TABLE_OFFSET];
|
|
128
|
-
chars.push(d !== NOT_DIGIT ? String.fromCharCode(d + 48) : str[i]);
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
return chars.join('');
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
export { anynum };
|
|
135
|
-
export default anynum;
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Flat lookup table: maps Unicode code point → ASCII digit (0-9).
|
|
3
|
-
* Only decimal digit characters (Unicode category Nd) are included.
|
|
4
|
-
*
|
|
5
|
-
* Strategy: Int32Array of size (maxCodePoint - minCodePoint + 1).
|
|
6
|
-
* Value 0xFF means "not a digit". Value 0-9 is the ASCII digit value.
|
|
7
|
-
* This gives O(1) lookup with no branching, no bisect, no loop.
|
|
8
|
-
*
|
|
9
|
-
* Memory: range is 0x0660 to 0x1FBF0 → ~129,936 entries × 1 byte = ~127 KB.
|
|
10
|
-
* Acceptable for a one-time init; lookup is a single array index.
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
// All known Unicode Nd (decimal digit) script zero code points.
|
|
14
|
-
// Each script has exactly 10 consecutive digits: zero+0 .. zero+9.
|
|
15
|
-
const SCRIPT_ZEROS = [
|
|
16
|
-
// Basic Latin (ASCII) — included for completeness / pass-through
|
|
17
|
-
0x0030, // 0-9
|
|
18
|
-
|
|
19
|
-
// Arabic scripts
|
|
20
|
-
0x0660, // Arabic-Indic ٠١٢٣٤٥٦٧٨٩
|
|
21
|
-
0x06F0, // Extended Arabic-Indic (Urdu/Persian/Sindhi) ۰۱۲۳
|
|
22
|
-
|
|
23
|
-
// Indic scripts
|
|
24
|
-
0x0966, // Devanagari ०१२३४५६७८९
|
|
25
|
-
0x09E6, // Bengali ০১২৩৪৫৬৭৮৯
|
|
26
|
-
0x0A66, // Gurmukhi ੦੧੨੩੪੫੬੭੮੯
|
|
27
|
-
0x0AE6, // Gujarati ૦૧૨૩૪૫૬૭૮૯
|
|
28
|
-
0x0B66, // Odia ୦୧୨୩୪୫୬୭୮୯
|
|
29
|
-
0x0BE6, // Tamil ௦௧௨௩௪௫௬௭௮௯
|
|
30
|
-
0x0C66, // Telugu ౦౧౨౩౪౫౬౭౮౯
|
|
31
|
-
0x0CE6, // Kannada ೦೧೨೩೪೫೬೭೮೯
|
|
32
|
-
0x0D66, // Malayalam ൦൧൨൩൪൫൬൭൮൯
|
|
33
|
-
0x0DE6, // Sinhala Archaic ෦෧෨෩෪෫෬෭෮෯
|
|
34
|
-
|
|
35
|
-
// Southeast Asian scripts
|
|
36
|
-
0x0E50, // Thai ๐๑๒๓๔๕๖๗๘๙
|
|
37
|
-
0x0ED0, // Lao ໐໑໒໓໔໕໖໗໘໙
|
|
38
|
-
0x0F20, // Tibetan ༠༡༢༣༤༥༦༧༨༩
|
|
39
|
-
0x1040, // Myanmar ၀၁၂၃၄၅၆၇၈၉
|
|
40
|
-
0x1090, // Myanmar Shan ႐႑႒႓႔႕႖႗႘႙
|
|
41
|
-
0x17E0, // Khmer ០១២៣៤៥៦៧៨៩
|
|
42
|
-
0x1810, // Mongolian ᠐᠑᠒᠓᠔᠕᠖᠗᠘᠙
|
|
43
|
-
0x1946, // Limbu ᥆᥇᥈᥉᥊᥋᥌᥍᥎᥏
|
|
44
|
-
0x19D0, // New Tai Lue ᧐᧑᧒᧓᧔᧕᧖᧗᧘᧙
|
|
45
|
-
0x1A80, // Tai Tham Hora ᪀᪁᪂᪃᪄᪅᪆᪇᪈᪉
|
|
46
|
-
0x1A90, // Tai Tham Tham ᪐᪑᪒᪓᪔᪕᪖᪗᪘᪙
|
|
47
|
-
0x1B50, // Balinese ᭐᭑᭒᭓᭔᭕᭖᭗᭘᭙
|
|
48
|
-
0x1BB0, // Sundanese ᮰᮱᮲᮳᮴᮵᮶᮷᮸᮹
|
|
49
|
-
0x1C40, // Lepcha ᱀᱁᱂᱃᱄᱅᱆᱇᱈᱉
|
|
50
|
-
0x1C50, // Ol Chiki ᱐᱑᱒᱓᱔᱕᱖᱗᱘᱙
|
|
51
|
-
|
|
52
|
-
// Fullwidth (CJK context)
|
|
53
|
-
0xFF10, // Fullwidth 0123456789
|
|
54
|
-
|
|
55
|
-
// Mathematical digit variants (Unicode math block)
|
|
56
|
-
0x1D7CE, // Mathematical Bold
|
|
57
|
-
0x1D7D8, // Mathematical Double-Struck
|
|
58
|
-
0x1D7E2, // Mathematical Sans-Serif
|
|
59
|
-
0x1D7EC, // Mathematical Sans-Serif Bold
|
|
60
|
-
0x1D7F6, // Mathematical Monospace
|
|
61
|
-
|
|
62
|
-
// Other scripts
|
|
63
|
-
0x104A0, // Osmanya 𐒠𐒡𐒢𐒣𐒤𐒥𐒦𐒧𐒨𐒩
|
|
64
|
-
0x10D30, // Hanifi Rohingya 𐴰𐴱𐴲𐴳𐴴𐴵𐴶𐴷𐴸𐴹
|
|
65
|
-
0x11066, // Brahmi 𑁦𑁧𑁨𑁩𑁪𑁫𑁬𑁭𑁮𑁯
|
|
66
|
-
0x110F0, // Sora Sompeng 𑃰𑃱𑃲𑃳𑃴𑃵𑃶𑃷𑃸𑃹
|
|
67
|
-
0x11136, // Chakma 𑄶𑄷𑄸𑄹𑄺𑄻𑄼𑄽𑄾𑄿
|
|
68
|
-
0x111D0, // Sharada 𑇐𑇑𑇒𑇓𑇔𑇕𑇖𑇗𑇘𑇙
|
|
69
|
-
0x112F0, // Khudawadi 𑋰𑋱𑋲𑋳𑋴𑋵𑋶𑋷𑋸𑋹
|
|
70
|
-
0x11450, // Newa 𑑐𑑑𑑒𑑓𑑔𑑕𑑖𑑗𑑘𑑙
|
|
71
|
-
0x114D0, // Tirhuta 𑓐𑓑𑓒𑓓𑓔𑓕𑓖𑓗𑓘𑓙
|
|
72
|
-
0x11650, // Modi 𑙐𑙑𑙒𑙓𑙔𑙕𑙖𑙗𑙘𑙙
|
|
73
|
-
0x116C0, // Takri 𑛀𑛁𑛂𑛃𑛄𑛅𑛆𑛇𑛈𑛉
|
|
74
|
-
0x11730, // Ahom 𑜰𑜱𑜲𑜳𑜴𑜵𑜶𑜷𑜸𑜹
|
|
75
|
-
0x118E0, // Warang Citi 𑣠𑣡𑣢𑣣𑣤𑣥𑣦𑣧𑣨𑣩
|
|
76
|
-
0x11950, // Dives Akuru 𑥐𑥑𑥒𑥓𑥔𑥕𑥖𑥗𑥘𑥙
|
|
77
|
-
0x11BF0, // Khitan Small Script
|
|
78
|
-
0x11C50, // Bhaiksuki 𑱐𑱑𑱒𑱓𑱔𑱕𑱖𑱗𑱘𑱙
|
|
79
|
-
0x11D50, // Masaram Gondi 𑵐𑵑𑵒𑵓𑵔𑵕𑵖𑵗𑵘𑵙
|
|
80
|
-
0x11DA0, // Gunjala Gondi 𑶠𑶡𑶢𑶣𑶤𑶥𑶦𑶧𑶨𑶩
|
|
81
|
-
0x11F50, // Kawi 𑽐𑽑𑽒𑽓𑽔𑽕𑽖𑽗𑽘𑽙
|
|
82
|
-
0x16A60, // Mro 𖩠𖩡𖩢𖩣𖩤𖩥𖩦𖩧𖩨𖩩
|
|
83
|
-
0x16AC0, // Tangsa 𖫀𖫁𖫂𖫃𖫄𖫅𖫆𖫇𖫈𖫉
|
|
84
|
-
0x16B50, // Pahawh Hmong 𖭐𖭑𖭒𖭓𖭔𖭕𖭖𖭗𖭘𖭙
|
|
85
|
-
0x1E140, // Nyiakeng Puachue Hmong 𞅀𞅁𞅂𞅃𞅄𞅅𞅆𞅇𞅈𞅉
|
|
86
|
-
0x1E2F0, // Wancho 𞋰𞋱𞋲𞋳𞋴𞋵𞋶𞋷𞋸𞋹
|
|
87
|
-
0x1E4F0, // Nag Mundari 𞓰𞓱𞓲𞓳𞓴𞓵𞓶𞓷𞓸𞓹
|
|
88
|
-
0x1E950, // Adlam 𞥐𞥑𞥒𞥓𞥔𞥕𞥖𞥗𞥘𞥙
|
|
89
|
-
0x1FBF0, // Segmented digit symbols 🯰🯱🯲🯳🯴🯵🯶🯷🯸🯹
|
|
90
|
-
];
|
|
91
|
-
|
|
92
|
-
// Build a sparse Map for scripts above 0xFFFF (surrogate-pair range).
|
|
93
|
-
// These can't go into a flat Uint8Array indexed by code point efficiently.
|
|
94
|
-
const NOT_DIGIT = 0xFF;
|
|
95
|
-
const HIGH_MAP = new Map(); // codePoint → digit value (0-9)
|
|
96
|
-
|
|
97
|
-
const LOW_MAX = 0xFFFF;
|
|
98
|
-
const LOW_MIN = 0x0660; // first non-ASCII digit script
|
|
99
|
-
|
|
100
|
-
// Flat Uint8Array covering 0x0660 .. 0xFFFF
|
|
101
|
-
const TABLE_OFFSET = LOW_MIN;
|
|
102
|
-
const TABLE_SIZE = LOW_MAX - LOW_MIN + 1;
|
|
103
|
-
const TABLE = new Uint8Array(TABLE_SIZE).fill(NOT_DIGIT);
|
|
104
|
-
|
|
105
|
-
for (const zero of SCRIPT_ZEROS) {
|
|
106
|
-
for (let d = 0; d < 10; d++) {
|
|
107
|
-
const cp = zero + d;
|
|
108
|
-
if (cp <= LOW_MAX) {
|
|
109
|
-
TABLE[cp - TABLE_OFFSET] = d;
|
|
110
|
-
} else {
|
|
111
|
-
HIGH_MAP.set(cp, d);
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
export { TABLE, TABLE_OFFSET, HIGH_MAP, NOT_DIGIT };
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "anynum",
|
|
3
|
-
"version": "1.0.1",
|
|
4
|
-
"description": "Normalize all Unicode decimal digits (Devanagari, Arabic, Thai, etc.) to ASCII numerals. Zero dependencies, performance-first.",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"main": "./anynum.js",
|
|
7
|
-
"files": [
|
|
8
|
-
"anynum.js",
|
|
9
|
-
"digitTable.js",
|
|
10
|
-
"README.md"
|
|
11
|
-
],
|
|
12
|
-
"scripts": {
|
|
13
|
-
"test": "jasmine tests/anynum.test.js",
|
|
14
|
-
"bench": "node test/bench.js"
|
|
15
|
-
},
|
|
16
|
-
"keywords": [
|
|
17
|
-
"unicode",
|
|
18
|
-
"digits",
|
|
19
|
-
"normalize",
|
|
20
|
-
"devanagari",
|
|
21
|
-
"arabic",
|
|
22
|
-
"hindi",
|
|
23
|
-
"japanese",
|
|
24
|
-
"indic",
|
|
25
|
-
"asian",
|
|
26
|
-
"math",
|
|
27
|
-
"numerals",
|
|
28
|
-
"strnum"
|
|
29
|
-
],
|
|
30
|
-
"repository": {
|
|
31
|
-
"type": "git",
|
|
32
|
-
"url": "https://github.com/NaturalIntelligence/anynum"
|
|
33
|
-
},
|
|
34
|
-
"author": "Amit Gupta (https://solothought.work/)",
|
|
35
|
-
"license": "MIT",
|
|
36
|
-
"funding": [
|
|
37
|
-
{
|
|
38
|
-
"type": "github",
|
|
39
|
-
"url": "https://github.com/sponsors/NaturalIntelligence"
|
|
40
|
-
}
|
|
41
|
-
]
|
|
42
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
**1.2.0** (2026-05-08)
|
|
5
|
-
- Add support for `sanitizeName` option
|
|
6
|
-
- Support xml-naming for validating and sanitizing tag and attribute names
|
|
7
|
-
|
|
8
|
-
**1.1.9** (2026-05-06)
|
|
9
|
-
- fix: format output for preserve order when indent by is set to empty string
|
|
10
|
-
|
|
11
|
-
**1.1.8** (2026-05-05)
|
|
12
|
-
- fix: skip text property for PI tags
|
|
13
|
-
- improve typings
|
|
14
|
-
|
|
15
|
-
**1.1.7** (2026--05-04)
|
|
16
|
-
- fix security issues when attribute value contains quotes
|
|
17
|
-
|
|
18
|
-
**1.1.6** (2026--05-04)
|
|
19
|
-
- fix security issues related to comment
|
|
20
|
-
- skip comment with null value
|
|
21
|
-
|
|
22
|
-
**1.1.5** (2026-04-17)
|
|
23
|
-
- fix security issues related to comment and cdata
|
|
24
|
-
|
|
25
|
-
**1.1.4** (2026-03-16)
|
|
26
|
-
- support maxNestedTags option
|
|
27
|
-
|
|
28
|
-
**1.1.3** (2026-03-13)
|
|
29
|
-
- declare Matcher & Expression as unknown so user is not forced to install path-expression-matcher
|
|
30
|
-
|
|
31
|
-
**1.1.2** (2026-03-11)
|
|
32
|
-
- fix typings
|
|
33
|
-
|
|
34
|
-
**1.1.1** (2026-03-11)
|
|
35
|
-
- upgrade path-expression-matcher to 1.1.3
|
|
36
|
-
|
|
37
|
-
**1.1.0** (2026-03-10)
|
|
38
|
-
|
|
39
|
-
- Integrate [path-expression-matcher](https://github.com/NaturalIntelligence/path-expression-matcher)
|
|
40
|
-
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2026 Natural Intelligence
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
# fast-xml-builder
|
|
2
|
-
Build XML from JSON
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
XML Builder was part of [fast-xml-parser](https://github.com/NaturalIntelligence/fast-xml-parser) for years. But considering that any bug in the parser may false-alarm users who are only using the builder, we have decided to split it into a separate package.
|
|
6
|
-
|
|
7
|
-
## Installation
|
|
8
|
-
|
|
9
|
-
```bash
|
|
10
|
-
npm install fast-xml-builder
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
## Usage
|
|
14
|
-
|
|
15
|
-
```javascript
|
|
16
|
-
import XMLBuilder from 'fast-xml-builder';
|
|
17
|
-
|
|
18
|
-
const builder = new XMLBuilder();
|
|
19
|
-
const xml = builder.build({ name: 'value' });
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
fast-xml-builder fully supports the response generated by fast-xml-parser. You can use options like `preserveOrder`, `ignoreAttributes`, `attributeNamePrefix`, `textNodeName`, `cdataPropName`, `commentPropName`, `format`, `indentBy`, `suppressEmptyNode`, `suppressUnpairedNode`, `stopNodes`, `oneListGroup`, `maxNestedTags`, and many more.
|
|
23
|
-
|
|
24
|
-
## Default Options
|
|
25
|
-
|
|
26
|
-
```js
|
|
27
|
-
{
|
|
28
|
-
attributeNamePrefix: '@_',
|
|
29
|
-
attributesGroupName: false,
|
|
30
|
-
textNodeName: '#text',
|
|
31
|
-
ignoreAttributes: true,
|
|
32
|
-
cdataPropName: false,
|
|
33
|
-
commentPropName: false,
|
|
34
|
-
format: false,
|
|
35
|
-
indentBy: ' ',
|
|
36
|
-
suppressEmptyNode: false,
|
|
37
|
-
suppressUnpairedNode: true,
|
|
38
|
-
suppressBooleanAttributes: true,
|
|
39
|
-
preserveOrder: false,
|
|
40
|
-
processEntities: true,
|
|
41
|
-
unpairedTags: [],
|
|
42
|
-
stopNodes: [],
|
|
43
|
-
oneListGroup: false,
|
|
44
|
-
maxNestedTags: 100,
|
|
45
|
-
jPath: true,
|
|
46
|
-
tagValueProcessor: (key, val) => val,
|
|
47
|
-
attributeValueProcessor: (attrName, val) => val,
|
|
48
|
-
}
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
## Options Reference
|
|
52
|
-
|
|
53
|
-
Check [Options reference](docs/Builder_v1.md) for more detail and examples.
|
|
54
|
-
|
|
55
|
-
- **arrayNodeName**: When building XML from an array, set `arrayNodeName` to wrap each element in a tag name.
|
|
56
|
-
- **attributeNamePrefix**: Prefix used to identify attribute properties in the JS object. Default: `'@_'`.
|
|
57
|
-
- **attributesGroupName**: Group name for attributes in the JS object. When set, all attributes are expected to be nested under this key. Not supported with `preserveOrder: true`.
|
|
58
|
-
- **attributeValueProcessor**: Customize how attribute values are serialized. Receives the attribute name and value.
|
|
59
|
-
- **cdataPropName**: Property name that identifies CDATA content. Values under this key are wrapped in `<![CDATA[...]]>`.
|
|
60
|
-
- **commentPropName**: Property name that identifies comment content. Values under this key are rendered as `<!-- ... -->`.
|
|
61
|
-
- **format**: By default, output is a single-line XML string. Set `format: true` for human-readable, indented output.
|
|
62
|
-
- **ignoreAttributes**: By default (`true`), attributes are skipped. Set to `false` to include them. Also supports selective ignoring via an array of strings, array of regular expressions, or a callback function.
|
|
63
|
-
- **indentBy**: String used for each level of indentation. Default: `' '` (two spaces). Only applies when `format: true`.
|
|
64
|
-
- **maxNestedTags**: Limits the maximum depth of nested tags. An error is thrown if this depth is exceeded. Default: `100`.
|
|
65
|
-
- **oneListGroup**: Groups all repeated child tags under a single parent tag.
|
|
66
|
-
- **preserveOrder**: When a JS object was produced by XMLParser with `preserveOrder: true`, pass the same option to XMLBuilder to reconstruct the original XML correctly.
|
|
67
|
-
- **processEntities**: When `true` (default), special characters in text and attribute values are replaced with XML entities (`&`, `<`, etc.). Set to `false` for a performance boost when you know your content has no entities. Note: quotes in attribute values are always escaped regardless of this setting.
|
|
68
|
-
- **stopNodes**: Tags listed here are treated as raw content containers — their text content is written as-is without entity encoding. Accepts an array of tag name strings or `Expression` instances from `path-expression-matcher`. The old `*.tagName` wildcard syntax is still accepted and automatically converted to the equivalent `..tagName` deep-wildcard syntax.
|
|
69
|
-
- **suppressBooleanAttributes**: When `true` (default), attributes with the value `true` are rendered without the value (e.g. `<tag attr>` instead of `<tag attr="true">`).
|
|
70
|
-
- **suppressEmptyNode**: When `true`, tags with no text value are rendered as self-closing (`<tag/>`).
|
|
71
|
-
- **suppressUnpairedNode**: When `true` (default), unpaired tags are rendered without a closing slash (`<br>`). When `false`, they are rendered as `<br/>`.
|
|
72
|
-
- **tagValueProcessor**: Customize how tag text values are serialized. Receives the tag name and value.
|
|
73
|
-
- **textNodeName**: Property name representing the text content of a tag in the JS object. Default: `'#text'`.
|
|
74
|
-
- **unpairedTags**: List of tag names that have no matching closing tag (e.g. `<br>` in HTML).
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(()=>{"use strict";var t={d:(e,i)=>{for(var s in i)t.o(i,s)&&!t.o(e,s)&&Object.defineProperty(e,s,{enumerable:!0,get:i[s]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{default:()=>w});class i{constructor(t,e={},i){this.pattern=t,this.separator=e.separator||".",this.segments=this._parse(t),this.data=i,this._hasDeepWildcard=this.segments.some(t=>"deep-wildcard"===t.type),this._hasAttributeCondition=this.segments.some(t=>void 0!==t.attrName),this._hasPositionSelector=this.segments.some(t=>void 0!==t.position)}_parse(t){const e=[];let i=0,s="";for(;i<t.length;)t[i]===this.separator?i+1<t.length&&t[i+1]===this.separator?(s.trim()&&(e.push(this._parseSegment(s.trim())),s=""),e.push({type:"deep-wildcard"}),i+=2):(s.trim()&&e.push(this._parseSegment(s.trim())),s="",i++):(s+=t[i],i++);return s.trim()&&e.push(this._parseSegment(s.trim())),e}_parseSegment(t){const e={type:"tag"};let i=null,s=t;const n=t.match(/^([^\[]+)(\[[^\]]*\])(.*)$/);if(n&&(s=n[1]+n[3],n[2])){const t=n[2].slice(1,-1);t&&(i=t)}let r,o,a=s;if(s.includes("::")){const e=s.indexOf("::");if(r=s.substring(0,e).trim(),a=s.substring(e+2).trim(),!r)throw new Error(`Invalid namespace in pattern: ${t}`)}let h=null;if(a.includes(":")){const t=a.lastIndexOf(":"),e=a.substring(0,t).trim(),i=a.substring(t+1).trim();["first","last","odd","even"].includes(i)||/^nth\(\d+\)$/.test(i)?(o=e,h=i):o=a}else o=a;if(!o)throw new Error(`Invalid segment pattern: ${t}`);if(e.tag=o,r&&(e.namespace=r),i)if(i.includes("=")){const t=i.indexOf("=");e.attrName=i.substring(0,t).trim(),e.attrValue=i.substring(t+1).trim()}else e.attrName=i.trim();if(h){const t=h.match(/^nth\((\d+)\)$/);t?(e.position="nth",e.positionValue=parseInt(t[1],10)):e.position=h}return e}get length(){return this.segments.length}hasDeepWildcard(){return this._hasDeepWildcard}hasAttributeCondition(){return this._hasAttributeCondition}hasPositionSelector(){return this._hasPositionSelector}toString(){return this.pattern}}class s{constructor(t){this._matcher=t}get separator(){return this._matcher.separator}getCurrentTag(){const t=this._matcher.path;return t.length>0?t[t.length-1].tag:void 0}getCurrentNamespace(){const t=this._matcher.path;return t.length>0?t[t.length-1].namespace:void 0}getAttrValue(t){const e=this._matcher.path;if(0!==e.length)return e[e.length-1].values?.[t]}hasAttr(t){const e=this._matcher.path;if(0===e.length)return!1;const i=e[e.length-1];return void 0!==i.values&&t in i.values}getPosition(){const t=this._matcher.path;return 0===t.length?-1:t[t.length-1].position??0}getCounter(){const t=this._matcher.path;return 0===t.length?-1:t[t.length-1].counter??0}getIndex(){return this.getPosition()}getDepth(){return this._matcher.path.length}toString(t,e=!0){return this._matcher.toString(t,e)}toArray(){return this._matcher.path.map(t=>t.tag)}matches(t){return this._matcher.matches(t)}matchesAny(t){return t.matchesAny(this._matcher)}}class n{constructor(t={}){this.separator=t.separator||".",this.path=[],this.siblingStacks=[],this._pathStringCache=null,this._view=new s(this)}push(t,e=null,i=null){this._pathStringCache=null,this.path.length>0&&(this.path[this.path.length-1].values=void 0);const s=this.path.length;this.siblingStacks[s]||(this.siblingStacks[s]=new Map);const n=this.siblingStacks[s],r=i?`${i}:${t}`:t,o=n.get(r)||0;let a=0;for(const t of n.values())a+=t;n.set(r,o+1);const h={tag:t,position:a,counter:o};null!=i&&(h.namespace=i),null!=e&&(h.values=e),this.path.push(h)}pop(){if(0===this.path.length)return;this._pathStringCache=null;const t=this.path.pop();return this.siblingStacks.length>this.path.length+1&&(this.siblingStacks.length=this.path.length+1),t}updateCurrent(t){if(this.path.length>0){const e=this.path[this.path.length-1];null!=t&&(e.values=t)}}getCurrentTag(){return this.path.length>0?this.path[this.path.length-1].tag:void 0}getCurrentNamespace(){return this.path.length>0?this.path[this.path.length-1].namespace:void 0}getAttrValue(t){if(0!==this.path.length)return this.path[this.path.length-1].values?.[t]}hasAttr(t){if(0===this.path.length)return!1;const e=this.path[this.path.length-1];return void 0!==e.values&&t in e.values}getPosition(){return 0===this.path.length?-1:this.path[this.path.length-1].position??0}getCounter(){return 0===this.path.length?-1:this.path[this.path.length-1].counter??0}getIndex(){return this.getPosition()}getDepth(){return this.path.length}toString(t,e=!0){const i=t||this.separator;if(i===this.separator&&!0===e){if(null!==this._pathStringCache)return this._pathStringCache;const t=this.path.map(t=>t.namespace?`${t.namespace}:${t.tag}`:t.tag).join(i);return this._pathStringCache=t,t}return this.path.map(t=>e&&t.namespace?`${t.namespace}:${t.tag}`:t.tag).join(i)}toArray(){return this.path.map(t=>t.tag)}reset(){this._pathStringCache=null,this.path=[],this.siblingStacks=[]}matches(t){const e=t.segments;return 0!==e.length&&(t.hasDeepWildcard()?this._matchWithDeepWildcard(e):this._matchSimple(e))}_matchSimple(t){if(this.path.length!==t.length)return!1;for(let e=0;e<t.length;e++)if(!this._matchSegment(t[e],this.path[e],e===this.path.length-1))return!1;return!0}_matchWithDeepWildcard(t){let e=this.path.length-1,i=t.length-1;for(;i>=0&&e>=0;){const s=t[i];if("deep-wildcard"===s.type){if(i--,i<0)return!0;const s=t[i];let n=!1;for(let t=e;t>=0;t--)if(this._matchSegment(s,this.path[t],t===this.path.length-1)){e=t-1,i--,n=!0;break}if(!n)return!1}else{if(!this._matchSegment(s,this.path[e],e===this.path.length-1))return!1;e--,i--}}return i<0}_matchSegment(t,e,i){if("*"!==t.tag&&t.tag!==e.tag)return!1;if(void 0!==t.namespace&&"*"!==t.namespace&&t.namespace!==e.namespace)return!1;if(void 0!==t.attrName){if(!i)return!1;if(!e.values||!(t.attrName in e.values))return!1;if(void 0!==t.attrValue&&String(e.values[t.attrName])!==String(t.attrValue))return!1}if(void 0!==t.position){if(!i)return!1;const s=e.counter??0;if("first"===t.position&&0!==s)return!1;if("odd"===t.position&&s%2!=1)return!1;if("even"===t.position&&s%2!=0)return!1;if("nth"===t.position&&s!==t.positionValue)return!1}return!0}matchesAny(t){return t.matchesAny(this)}snapshot(){return{path:this.path.map(t=>({...t})),siblingStacks:this.siblingStacks.map(t=>new Map(t))}}restore(t){this._pathStringCache=null,this.path=t.path.map(t=>({...t})),this.siblingStacks=t.siblingStacks.map(t=>new Map(t))}readOnly(){return this._view}}function r(t){return String(t).replace(/--/g,"- -").replace(/--/g,"- -").replace(/-$/,"- ")}function o(t){return String(t).replace(/\]\]>/g,"]]]]><![CDATA[>")}function a(t){return String(t).replace(/"/g,""").replace(/'/g,"'")}const h=":A-Za-z_À-ÖØ-öø-˿Ͱ-ͽͿ-҆҈--⁰-Ⰰ-、-豈-﷏ﷰ-�",p=":A-Za-z_À-˿Ͱ-ͽͿ-҆҈--⁰-Ⰰ-、-豈-﷏ﷰ-�𐀀-",u=p+"\\-\\.\\d·̀-ͯ҇‿-⁀",l=(t,e,i="")=>{const s=`[${t.replace(":","")}][${e.replace(":","")}]*`;return{name:new RegExp(`^[${t}][${e}]*$`,i),ncName:new RegExp(`^${s}$`,i),qName:new RegExp(`^${s}(?::${s})?$`,i),nmToken:new RegExp(`^[${e}]+$`,i),nmTokens:new RegExp(`^[${e}]+(?:\\s+[${e}]+)*$`,i)}},c=l(h,h+"\\-\\.\\d·̀-ͯ‿-⁀"),g=l(p,u,"u"),d=(t,{xmlVersion:e="1.0"}={})=>((t="1.0")=>"1.1"===t?g:c)(e).qName.test(t);function f(t,e,i,s,n){return i.sanitizeName?d(t,{xmlVersion:n})?t:i.sanitizeName(t,{isAttribute:e,matcher:s.readOnly()}):t}function m(t,e){let s="";e.format&&(s="\n");const r=[];if(e.stopNodes&&Array.isArray(e.stopNodes))for(let t=0;t<e.stopNodes.length;t++){const s=e.stopNodes[t];"string"==typeof s?r.push(new i(s)):s instanceof i&&r.push(s)}const o=function(t,e){if(!Array.isArray(t)||0===t.length)return"1.0";const i=t[0];if("?xml"===A(i)){const t=i[":@"];if(t){const i=e.attributeNamePrefix+"version";if(t[i])return t[i]}}return"1.0"}(t,e);return N(t,e,s,new n,r,o)}function N(t,e,i,s,n,a){let h="",p=!1;if(e.maxNestedTags&&s.getDepth()>e.maxNestedTags)throw new Error("Maximum nested tags exceeded");if(!Array.isArray(t)){if(null!=t){let i=t.toString();return i=S(i,e),i}return""}for(let u=0;u<t.length;u++){const l=t[u],c=A(l);if(void 0===c)continue;const g=c===e.textNodeName||c===e.cdataPropName||c===e.commentPropName||"?"===c[0]?c:f(c,!1,e,s,a),d=b(l[":@"],e);s.push(g,d);const m=P(s,n);if(g===e.textNodeName){let t=l[c];m||(t=e.tagValueProcessor(g,t),t=S(t,e)),p&&(h+=i),h+=t,p=!1,s.pop();continue}if(g===e.cdataPropName){p&&(h+=i),h+=`<![CDATA[${o(l[c][0][e.textNodeName])}]]>`,p=!1,s.pop();continue}if(g===e.commentPropName){h+=i+`\x3c!--${r(l[c][0][e.textNodeName])}--\x3e`,p=!0,s.pop();continue}if("?"===g[0]){h+=("?xml"===g?"":i)+`<${g}${$(l[":@"],e,m,s,a)}?>`,p=!0,s.pop();continue}let y=i;""!==y&&(y+=e.indentBy);const v=i+`<${g}${$(l[":@"],e,m,s,a)}`;let w;w=m?x(l[c],e):N(l[c],e,y,s,n,a),-1!==e.unpairedTags.indexOf(g)?e.suppressUnpairedNode?h+=v+">":h+=v+"/>":w&&0!==w.length||!e.suppressEmptyNode?w&&w.endsWith(">")?h+=v+`>${w}${i}</${g}>`:(h+=v+">",w&&""!==i&&(w.includes("/>")||w.includes("</"))?h+=i+e.indentBy+w+i:h+=w,h+=`</${g}>`):h+=v+"/>",p=!0,s.pop()}return h}function b(t,e){if(!t||e.ignoreAttributes)return null;const i={};let s=!1;for(let n in t)Object.prototype.hasOwnProperty.call(t,n)&&(i[n.startsWith(e.attributeNamePrefix)?n.substr(e.attributeNamePrefix.length):n]=a(t[n]),s=!0);return s?i:null}function x(t,e){if(!Array.isArray(t))return null!=t?t.toString():"";let i="";for(let s=0;s<t.length;s++){const n=t[s],r=A(n);if(r===e.textNodeName)i+=n[r];else if(r===e.cdataPropName)i+=n[r][0][e.textNodeName];else if(r===e.commentPropName)i+=n[r][0][e.textNodeName];else{if(r&&"?"===r[0])continue;if(r){const t=y(n[":@"],e),s=x(n[r],e);s&&0!==s.length?i+=`<${r}${t}>${s}</${r}>`:i+=`<${r}${t}/>`}}}return i}function y(t,e){let i="";if(t&&!e.ignoreAttributes)for(let s in t){if(!Object.prototype.hasOwnProperty.call(t,s))continue;let n=t[s];!0===n&&e.suppressBooleanAttributes?i+=` ${s.substr(e.attributeNamePrefix.length)}`:i+=` ${s.substr(e.attributeNamePrefix.length)}="${a(n)}"`}return i}function A(t){const e=Object.keys(t);for(let i=0;i<e.length;i++){const s=e[i];if(Object.prototype.hasOwnProperty.call(t,s)&&":@"!==s)return s}}function $(t,e,i,s,n){let r="";if(t&&!e.ignoreAttributes)for(let o in t){if(!Object.prototype.hasOwnProperty.call(t,o))continue;const h=o.substr(e.attributeNamePrefix.length),p=i?h:f(h,!0,e,s,n);let u;i?u=t[o]:(u=e.attributeValueProcessor(o,t[o]),u=S(u,e)),!0===u&&e.suppressBooleanAttributes?r+=` ${p}`:r+=` ${p}="${a(u)}"`}return r}function P(t,e){if(!e||0===e.length)return!1;for(let i=0;i<e.length;i++)if(t.matches(e[i]))return!0;return!1}function S(t,e){if(t&&t.length>0&&e.processEntities)for(let i=0;i<e.entities.length;i++){const s=e.entities[i];t=t.replace(s.regex,s.val)}return t}const v={attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,cdataPropName:!1,format:!1,indentBy:" ",suppressEmptyNode:!1,suppressUnpairedNode:!0,suppressBooleanAttributes:!0,tagValueProcessor:function(t,e){return e},attributeValueProcessor:function(t,e){return e},preserveOrder:!1,commentPropName:!1,unpairedTags:[],entities:[{regex:new RegExp("&","g"),val:"&"},{regex:new RegExp(">","g"),val:">"},{regex:new RegExp("<","g"),val:"<"},{regex:new RegExp("'","g"),val:"'"},{regex:new RegExp('"',"g"),val:"""}],processEntities:!0,stopNodes:[],oneListGroup:!1,maxNestedTags:100,jPath:!0,sanitizeName:!1};function w(t){if(this.options=Object.assign({},v,t),this.options.stopNodes&&Array.isArray(this.options.stopNodes)&&(this.options.stopNodes=this.options.stopNodes.map(t=>"string"==typeof t&&t.startsWith("*.")?".."+t.substring(2):t)),this.stopNodeExpressions=[],this.options.stopNodes&&Array.isArray(this.options.stopNodes))for(let t=0;t<this.options.stopNodes.length;t++){const e=this.options.stopNodes[t];"string"==typeof e?this.stopNodeExpressions.push(new i(e)):e instanceof i&&this.stopNodeExpressions.push(e)}var e;!0===this.options.ignoreAttributes||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.ignoreAttributesFn="function"==typeof(e=this.options.ignoreAttributes)?e:Array.isArray(e)?t=>{for(const i of e){if("string"==typeof i&&t===i)return!0;if(i instanceof RegExp&&i.test(t))return!0}}:()=>!1,this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=C),this.processTextOrObjNode=O,this.options.format?(this.indentate=_,this.tagEndChar=">\n",this.newLine="\n"):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}function E(t,e,i,s,n){return i.sanitizeName?d(t,{xmlVersion:n})?t:i.sanitizeName(t,{isAttribute:e,matcher:s.readOnly()}):t}function O(t,e,i,s,n){const r=this.extractAttributes(t);if(s.push(e,r),this.checkStopNode(s)){const n=this.buildRawContent(t),r=this.buildAttributesForStopNode(t);return s.pop(),this.buildObjectNode(n,e,r,i)}const o=this.j2x(t,i+1,s,n);return s.pop(),"?"===e[0]?this.buildTextValNode("",e,o.attrStr,i,s):void 0!==t[this.options.textNodeName]&&1===Object.keys(t).length?this.buildTextValNode(t[this.options.textNodeName],e,o.attrStr,i,s):this.buildObjectNode(o.val,e,o.attrStr,i)}function _(t){return this.options.indentBy.repeat(t)}function C(t){return!(!t.startsWith(this.options.attributeNamePrefix)||t===this.options.textNodeName)&&t.substr(this.attrPrefixLen)}w.prototype.build=function(t){if(this.options.preserveOrder)return m(t,this.options);{Array.isArray(t)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(t={[this.options.arrayNodeName]:t});const e=new n,i=function(t,e){const i=t["?xml"];if(i&&"object"==typeof i){if(e.attributesGroupName&&i[e.attributesGroupName]){const t=i[e.attributesGroupName][e.attributeNamePrefix+"version"];if(t)return t}const t=i[e.attributeNamePrefix+"version"];if(t)return t}return"1.0"}(t,this.options);return this.j2x(t,0,e,i).val}},w.prototype.j2x=function(t,e,i,s){let n="",r="";if(this.options.maxNestedTags&&i.getDepth()>=this.options.maxNestedTags)throw new Error("Maximum nested tags exceeded");const o=this.options.jPath?i.toString():i,a=this.checkStopNode(i);for(let h in t){if(!Object.prototype.hasOwnProperty.call(t,h))continue;const p=h===this.options.textNodeName||h===this.options.cdataPropName||h===this.options.commentPropName||this.options.attributesGroupName&&h===this.options.attributesGroupName||this.isAttribute(h)||"?"===h[0]?h:E(h,!1,this.options,i,s);if(void 0===t[h])this.isAttribute(h)&&(r+="");else if(null===t[h])this.isAttribute(h)||p===this.options.cdataPropName||p===this.options.commentPropName?r+="":"?"===p[0]?r+=this.indentate(e)+"<"+p+"?"+this.tagEndChar:r+=this.indentate(e)+"<"+p+"/"+this.tagEndChar;else if(t[h]instanceof Date)r+=this.buildTextValNode(t[h],p,"",e,i);else if("object"!=typeof t[h]){const u=this.isAttribute(h);if(u&&!this.ignoreAttributesFn(u,o)){const e=E(u,!0,this.options,i,s);n+=this.buildAttrPairStr(e,""+t[h],a)}else if(!u)if(h===this.options.textNodeName){let e=this.options.tagValueProcessor(h,""+t[h]);r+=this.replaceEntitiesValue(e)}else{i.push(p);const s=this.checkStopNode(i);if(i.pop(),s){const i=""+t[h];r+=""===i?this.indentate(e)+"<"+p+this.closeTag(p)+this.tagEndChar:this.indentate(e)+"<"+p+">"+i+"</"+p+this.tagEndChar}else r+=this.buildTextValNode(t[h],p,"",e,i)}}else if(Array.isArray(t[h])){const n=t[h].length;let o="",a="";for(let u=0;u<n;u++){const n=t[h][u];if(void 0===n);else if(null===n)"?"===p[0]?r+=this.indentate(e)+"<"+p+"?"+this.tagEndChar:r+=this.indentate(e)+"<"+p+"/"+this.tagEndChar;else if("object"==typeof n)if(this.options.oneListGroup){i.push(p);const t=this.j2x(n,e+1,i,s);i.pop(),o+=t.val,this.options.attributesGroupName&&n.hasOwnProperty(this.options.attributesGroupName)&&(a+=t.attrStr)}else o+=this.processTextOrObjNode(n,p,e,i,s);else if(this.options.oneListGroup){let t=this.options.tagValueProcessor(p,n);t=this.replaceEntitiesValue(t),o+=t}else{i.push(p);const t=this.checkStopNode(i);if(i.pop(),t){const t=""+n;o+=""===t?this.indentate(e)+"<"+p+this.closeTag(p)+this.tagEndChar:this.indentate(e)+"<"+p+">"+t+"</"+p+this.tagEndChar}else o+=this.buildTextValNode(n,p,"",e,i)}}this.options.oneListGroup&&(o=this.buildObjectNode(o,p,a,e)),r+=o}else if(this.options.attributesGroupName&&h===this.options.attributesGroupName){const e=Object.keys(t[h]),r=e.length;for(let o=0;o<r;o++){const r=E(e[o],!0,this.options,i,s);n+=this.buildAttrPairStr(r,""+t[h][e[o]],a)}}else r+=this.processTextOrObjNode(t[h],p,e,i,s)}return{attrStr:n,val:r}},w.prototype.buildAttrPairStr=function(t,e,i){return i||(e=this.options.attributeValueProcessor(t,""+e),e=this.replaceEntitiesValue(e)),this.options.suppressBooleanAttributes&&"true"===e?" "+t:" "+t+'="'+a(e)+'"'},w.prototype.extractAttributes=function(t){if(!t||"object"!=typeof t)return null;const e={};let i=!1;if(this.options.attributesGroupName&&t[this.options.attributesGroupName]){const s=t[this.options.attributesGroupName];for(let t in s)Object.prototype.hasOwnProperty.call(s,t)&&(e[t.startsWith(this.options.attributeNamePrefix)?t.substring(this.options.attributeNamePrefix.length):t]=a(s[t]),i=!0)}else for(let s in t){if(!Object.prototype.hasOwnProperty.call(t,s))continue;const n=this.isAttribute(s);n&&(e[n]=a(t[s]),i=!0)}return i?e:null},w.prototype.buildRawContent=function(t){if("string"==typeof t)return t;if("object"!=typeof t||null===t)return String(t);if(void 0!==t[this.options.textNodeName])return t[this.options.textNodeName];let e="";for(let i in t){if(!Object.prototype.hasOwnProperty.call(t,i))continue;if(this.isAttribute(i))continue;if(this.options.attributesGroupName&&i===this.options.attributesGroupName)continue;const s=t[i];if(i===this.options.textNodeName)e+=s;else if(Array.isArray(s)){for(let t of s)if("string"==typeof t||"number"==typeof t)e+=`<${i}>${t}</${i}>`;else if("object"==typeof t&&null!==t){const s=this.buildRawContent(t),n=this.buildAttributesForStopNode(t);e+=""===s?`<${i}${n}/>`:`<${i}${n}>${s}</${i}>`}}else if("object"==typeof s&&null!==s){const t=this.buildRawContent(s),n=this.buildAttributesForStopNode(s);e+=""===t?`<${i}${n}/>`:`<${i}${n}>${t}</${i}>`}else e+=`<${i}>${s}</${i}>`}return e},w.prototype.buildAttributesForStopNode=function(t){if(!t||"object"!=typeof t)return"";let e="";if(this.options.attributesGroupName&&t[this.options.attributesGroupName]){const i=t[this.options.attributesGroupName];for(let t in i){if(!Object.prototype.hasOwnProperty.call(i,t))continue;const s=t.startsWith(this.options.attributeNamePrefix)?t.substring(this.options.attributeNamePrefix.length):t,n=i[t];!0===n&&this.options.suppressBooleanAttributes?e+=" "+s:e+=" "+s+'="'+n+'"'}}else for(let i in t){if(!Object.prototype.hasOwnProperty.call(t,i))continue;const s=this.isAttribute(i);if(s){const n=t[i];!0===n&&this.options.suppressBooleanAttributes?e+=" "+s:e+=" "+s+'="'+n+'"'}}return e},w.prototype.buildObjectNode=function(t,e,i,s){if(""===t)return"?"===e[0]?this.indentate(s)+"<"+e+i+"?"+this.tagEndChar:this.indentate(s)+"<"+e+i+this.closeTag(e)+this.tagEndChar;if("?"===e[0])return this.indentate(s)+"<"+e+i+"?"+this.tagEndChar;{let n="</"+e+this.tagEndChar,r="";return"?"===e[0]&&(r="?",n=""),!i&&""!==i||-1!==t.indexOf("<")?!1!==this.options.commentPropName&&e===this.options.commentPropName&&0===r.length?this.indentate(s)+`\x3c!--${t}--\x3e`+this.newLine:this.indentate(s)+"<"+e+i+r+this.tagEndChar+t+this.indentate(s)+n:this.indentate(s)+"<"+e+i+r+">"+t+n}},w.prototype.closeTag=function(t){let e="";return-1!==this.options.unpairedTags.indexOf(t)?this.options.suppressUnpairedNode||(e="/"):e=this.options.suppressEmptyNode?"/":`></${t}`,e},w.prototype.checkStopNode=function(t){if(!this.stopNodeExpressions||0===this.stopNodeExpressions.length)return!1;for(let e=0;e<this.stopNodeExpressions.length;e++)if(t.matches(this.stopNodeExpressions[e]))return!0;return!1},w.prototype.buildTextValNode=function(t,e,i,s,n){if(!1!==this.options.cdataPropName&&e===this.options.cdataPropName){const e=o(t);return this.indentate(s)+`<![CDATA[${e}]]>`+this.newLine}if(!1!==this.options.commentPropName&&e===this.options.commentPropName){const e=r(t);return this.indentate(s)+`\x3c!--${e}--\x3e`+this.newLine}if("?"===e[0])return this.indentate(s)+"<"+e+i+"?"+this.tagEndChar;{let n=this.options.tagValueProcessor(e,t);return n=this.replaceEntitiesValue(n),""===n?this.indentate(s)+"<"+e+i+this.closeTag(e)+this.tagEndChar:this.indentate(s)+"<"+e+i+">"+n+"</"+e+this.tagEndChar}},w.prototype.replaceEntitiesValue=function(t){if(t&&t.length>0&&this.options.processEntities)for(let e=0;e<this.options.entities.length;e++){const i=this.options.entities[e];t=t.replace(i.regex,i.val)}return t},module.exports=e})();
|