entities 8.0.0 → 8.1.0

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.
Files changed (54) hide show
  1. package/dist/decode-codepoint.d.ts +23 -3
  2. package/dist/decode-codepoint.d.ts.map +1 -1
  3. package/dist/decode-codepoint.js +52 -37
  4. package/dist/decode-codepoint.js.map +1 -1
  5. package/dist/decode.d.ts +61 -28
  6. package/dist/decode.d.ts.map +1 -1
  7. package/dist/decode.js +789 -201
  8. package/dist/decode.js.map +1 -1
  9. package/dist/encode.d.ts +4 -2
  10. package/dist/encode.d.ts.map +1 -1
  11. package/dist/encode.js +249 -44
  12. package/dist/encode.js.map +1 -1
  13. package/dist/escape.d.ts +19 -7
  14. package/dist/escape.d.ts.map +1 -1
  15. package/dist/escape.js +104 -64
  16. package/dist/escape.js.map +1 -1
  17. package/dist/generated/decode-data-html.d.ts.map +1 -1
  18. package/dist/generated/decode-data-html.js +2 -2
  19. package/dist/generated/decode-data-html.js.map +1 -1
  20. package/dist/generated/decode-data-xml.d.ts.map +1 -1
  21. package/dist/generated/decode-data-xml.js +4 -2
  22. package/dist/generated/decode-data-xml.js.map +1 -1
  23. package/dist/generated/encode-html.d.ts +2 -4
  24. package/dist/generated/encode-html.d.ts.map +1 -1
  25. package/dist/generated/encode-html.js +1 -10
  26. package/dist/generated/encode-html.js.map +1 -1
  27. package/dist/index.d.ts +2 -2
  28. package/dist/index.d.ts.map +1 -1
  29. package/dist/index.js +2 -6
  30. package/dist/index.js.map +1 -1
  31. package/dist/internal/bin-trie-flags.d.ts +39 -8
  32. package/dist/internal/bin-trie-flags.d.ts.map +1 -1
  33. package/dist/internal/bin-trie-flags.js +37 -6
  34. package/dist/internal/bin-trie-flags.js.map +1 -1
  35. package/dist/internal/decode-shared.d.ts +35 -4
  36. package/dist/internal/decode-shared.d.ts.map +1 -1
  37. package/dist/internal/decode-shared.js +189 -11
  38. package/dist/internal/decode-shared.js.map +1 -1
  39. package/package.json +14 -14
  40. package/src/decode-codepoint.ts +58 -39
  41. package/src/decode.ts +942 -245
  42. package/src/encode.ts +289 -47
  43. package/src/escape.ts +110 -83
  44. package/src/generated/decode-data-html.ts +8 -3
  45. package/src/generated/decode-data-xml.ts +4 -4
  46. package/src/generated/encode-html.ts +1 -16
  47. package/src/index.ts +6 -8
  48. package/src/internal/bin-trie-flags.ts +38 -7
  49. package/src/internal/decode-shared.ts +203 -12
  50. package/dist/internal/encode-shared.d.ts +0 -33
  51. package/dist/internal/encode-shared.d.ts.map +0 -1
  52. package/dist/internal/encode-shared.js +0 -93
  53. package/dist/internal/encode-shared.js.map +0 -1
  54. package/src/internal/encode-shared.ts +0 -123
@@ -1,8 +1,28 @@
1
1
  /**
2
- * Replace the given code point with a replacement character if it is a
3
- * surrogate or is outside the valid range. Otherwise return the code
4
- * point unchanged.
2
+ * Replace the given code point with U+FFFD if it is NUL (0), a surrogate, or
3
+ * outside the valid Unicode range. Code points in the C1 controls range
4
+ * (128–159) are remapped to their Windows-1252 equivalents, following the
5
+ * HTML spec. All other code points are returned unchanged.
5
6
  * @param codePoint Unicode code point to convert.
6
7
  */
7
8
  export declare function replaceCodePoint(codePoint: number): number;
9
+ /**
10
+ * XML numeric character references are the referenced Unicode code point.
11
+ * Invalid values still become U+FFFD; the HTML Windows-1252 C1 remap is not
12
+ * applied.
13
+ * @see https://www.w3.org/TR/xml/#NT-CharRef
14
+ * @param codePoint Unicode code point to convert.
15
+ */
16
+ export declare function replaceCodePointXML(codePoint: number): number;
17
+ /**
18
+ * Convert the code point of a decoded numeric entity to a string, replacing
19
+ * invalid values.
20
+ *
21
+ * Fast path for plain BMP code points: [1..0x7F] and [0xA0..0xD7FF] pass
22
+ * `replaceCodePoint` unchanged (no NUL, C1 remap, surrogate, or out-of-range
23
+ * handling) and fit a single charCode. 0xd760 = 0xD800 (the first surrogate)
24
+ * - 0xA0.
25
+ * @param codePoint Unicode code point to convert.
26
+ */
27
+ export declare function codePointToString(codePoint: number): string;
8
28
  //# sourceMappingURL=decode-codepoint.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"decode-codepoint.d.ts","sourceRoot":"","sources":["../src/decode-codepoint.ts"],"names":[],"mappings":"AAkCA;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAS1D"}
1
+ {"version":3,"file":"decode-codepoint.d.ts","sourceRoot":"","sources":["../src/decode-codepoint.ts"],"names":[],"mappings":"AAwBA;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAU1D;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAE7D;AAED;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAI3D"}
@@ -1,46 +1,61 @@
1
1
  // Adapted from https://github.com/mathiasbynens/he/blob/36afe179392226cf1b6ccdb16ebbb7a5a844d93a/src/he.js#L106-L134
2
- const decodeMap = new Map([
3
- [0, 65_533],
4
- // C1 Unicode control character reference replacements
5
- [128, 8364],
6
- [130, 8218],
7
- [131, 402],
8
- [132, 8222],
9
- [133, 8230],
10
- [134, 8224],
11
- [135, 8225],
12
- [136, 710],
13
- [137, 8240],
14
- [138, 352],
15
- [139, 8249],
16
- [140, 338],
17
- [142, 381],
18
- [145, 8216],
19
- [146, 8217],
20
- [147, 8220],
21
- [148, 8221],
22
- [149, 8226],
23
- [150, 8211],
24
- [151, 8212],
25
- [152, 732],
26
- [153, 8482],
27
- [154, 353],
28
- [155, 8250],
29
- [156, 339],
30
- [158, 382],
31
- [159, 376],
32
- ]);
33
2
  /**
34
- * Replace the given code point with a replacement character if it is a
35
- * surrogate or is outside the valid range. Otherwise return the code
36
- * point unchanged.
3
+ * C1 Unicode control character reference replacements (code points 128–159).
4
+ * Index i gives the replacement for code point 128+i; 0 means "no replacement".
5
+ */
6
+ const c1 = [
7
+ 8364, 0, 8218, 402, 8222, 8230, 8224, 8225, 710, 8240, 352, 8249, 338, 0,
8
+ 381, 0, 0, 8216, 8217, 8220, 8221, 8226, 8211, 8212, 732, 8482, 353, 8250,
9
+ 339, 0, 382, 376,
10
+ ];
11
+ /**
12
+ * True for NUL, UTF-16 surrogates, and values past U+10FFFF.
13
+ * @param codePoint Unicode code point to check.
14
+ */
15
+ function isInvalidCodePoint(codePoint) {
16
+ return (codePoint === 0 ||
17
+ (codePoint >= 0xd8_00 && codePoint <= 0xdf_ff) ||
18
+ codePoint > 0x10_ff_ff);
19
+ }
20
+ /**
21
+ * Replace the given code point with U+FFFD if it is NUL (0), a surrogate, or
22
+ * outside the valid Unicode range. Code points in the C1 controls range
23
+ * (128–159) are remapped to their Windows-1252 equivalents, following the
24
+ * HTML spec. All other code points are returned unchanged.
37
25
  * @param codePoint Unicode code point to convert.
38
26
  */
39
27
  export function replaceCodePoint(codePoint) {
40
- if ((codePoint >= 0xd8_00 && codePoint <= 0xdf_ff) ||
41
- codePoint > 0x10_ff_ff) {
28
+ if (isInvalidCodePoint(codePoint)) {
42
29
  return 0xff_fd;
43
30
  }
44
- return decodeMap.get(codePoint) ?? codePoint;
31
+ if (codePoint >= 128 && codePoint <= 159) {
32
+ return c1[codePoint - 128] || codePoint;
33
+ }
34
+ return codePoint;
35
+ }
36
+ /**
37
+ * XML numeric character references are the referenced Unicode code point.
38
+ * Invalid values still become U+FFFD; the HTML Windows-1252 C1 remap is not
39
+ * applied.
40
+ * @see https://www.w3.org/TR/xml/#NT-CharRef
41
+ * @param codePoint Unicode code point to convert.
42
+ */
43
+ export function replaceCodePointXML(codePoint) {
44
+ return isInvalidCodePoint(codePoint) ? 0xff_fd : codePoint;
45
+ }
46
+ /**
47
+ * Convert the code point of a decoded numeric entity to a string, replacing
48
+ * invalid values.
49
+ *
50
+ * Fast path for plain BMP code points: [1..0x7F] and [0xA0..0xD7FF] pass
51
+ * `replaceCodePoint` unchanged (no NUL, C1 remap, surrogate, or out-of-range
52
+ * handling) and fit a single charCode. 0xd760 = 0xD800 (the first surrogate)
53
+ * - 0xA0.
54
+ * @param codePoint Unicode code point to convert.
55
+ */
56
+ export function codePointToString(codePoint) {
57
+ return (codePoint - 1) >>> 0 < 0x7f || (codePoint - 0xa0) >>> 0 < 0xd7_60
58
+ ? String.fromCharCode(codePoint)
59
+ : String.fromCodePoint(replaceCodePoint(codePoint));
45
60
  }
46
61
  //# sourceMappingURL=decode-codepoint.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"decode-codepoint.js","sourceRoot":"","sources":["../src/decode-codepoint.ts"],"names":[],"mappings":"AAAA,qHAAqH;AAErH,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC;IACtB,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,sDAAsD;IACtD,CAAC,GAAG,EAAE,IAAI,CAAC;IACX,CAAC,GAAG,EAAE,IAAI,CAAC;IACX,CAAC,GAAG,EAAE,GAAG,CAAC;IACV,CAAC,GAAG,EAAE,IAAI,CAAC;IACX,CAAC,GAAG,EAAE,IAAI,CAAC;IACX,CAAC,GAAG,EAAE,IAAI,CAAC;IACX,CAAC,GAAG,EAAE,IAAI,CAAC;IACX,CAAC,GAAG,EAAE,GAAG,CAAC;IACV,CAAC,GAAG,EAAE,IAAI,CAAC;IACX,CAAC,GAAG,EAAE,GAAG,CAAC;IACV,CAAC,GAAG,EAAE,IAAI,CAAC;IACX,CAAC,GAAG,EAAE,GAAG,CAAC;IACV,CAAC,GAAG,EAAE,GAAG,CAAC;IACV,CAAC,GAAG,EAAE,IAAI,CAAC;IACX,CAAC,GAAG,EAAE,IAAI,CAAC;IACX,CAAC,GAAG,EAAE,IAAI,CAAC;IACX,CAAC,GAAG,EAAE,IAAI,CAAC;IACX,CAAC,GAAG,EAAE,IAAI,CAAC;IACX,CAAC,GAAG,EAAE,IAAI,CAAC;IACX,CAAC,GAAG,EAAE,IAAI,CAAC;IACX,CAAC,GAAG,EAAE,GAAG,CAA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AACH,MAAM,UAAU,gBAAgB,CAAC,SAAiB;IAC9C,IAAI,kBAAkB,CAAC,SAAS,CAAC,EAAE,CAAC;QAChC,OAAO,OAAO,CAAC;IACnB,CAAC;IAED,IAAI,SAAS,IAAI,GAAG,IAAI,SAAS,IAAI,GAAG,EAAE,CAAC;QACvC,OAAO,EAAE,CAAC,SAAS,GAAG,GAAG,CAAC,IAAI,SAAS,CAAC;IAC5C,CAAC;IAED,OAAO,SAAS,CAAC;AACrB,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,mBAAmB,CAAC,SAAiB;IACjD,OAAO,kBAAkB,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC;AAC/D,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,iBAAiB,CAAC,SAAiB;IAC/C,OAAO,CAAC,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,GAAG,IAAI,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,OAAO;QACrE,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC,SAAS,CAAC;QAChC,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC,CAAC;AAC5D,CAAC"}
package/dist/decode.d.ts CHANGED
@@ -15,39 +15,30 @@ export declare enum DecodingMode {
15
15
  export interface EntityErrorProducer {
16
16
  missingSemicolonAfterCharacterReference(): void;
17
17
  absenceOfDigitsInNumericCharacterReference(consumedCharacters: number): void;
18
+ /**
19
+ * Validate the accumulated numeric value, before Unicode replacement.
20
+ * Values beyond the JavaScript number range are positive infinity.
21
+ */
18
22
  validateNumericCharacterReference(code: number): void;
19
23
  }
20
24
  /**
21
25
  * Token decoder with support of writing partial entities.
22
26
  */
23
27
  export declare class EntityDecoder {
24
- /** The tree used to decode entities. */
28
+ /** The predefined HTML or XML decode tree. */
25
29
  private readonly decodeTree;
26
30
  /**
27
31
  * The function that is called when a codepoint is decoded.
28
32
  *
29
- * For multi-byte named entities, this will be called multiple times,
30
- * with the second codepoint, and the same `consumed` value.
33
+ * For named entities that decode to multiple code points, this will
34
+ * be called multiple times, with the second codepoint, and the same
35
+ * `consumed` value.
31
36
  * @param codepoint The decoded codepoint.
32
- * @param consumed The number of bytes consumed by the decoder.
37
+ * @param consumed The number of characters consumed by the decoder.
33
38
  */
34
39
  private readonly emitCodePoint;
35
40
  /** An object that is used to produce errors. */
36
41
  private readonly errors?;
37
- constructor(
38
- /** The tree used to decode entities. */
39
- decodeTree: Uint16Array,
40
- /**
41
- * The function that is called when a codepoint is decoded.
42
- *
43
- * For multi-byte named entities, this will be called multiple times,
44
- * with the second codepoint, and the same `consumed` value.
45
- * @param codepoint The decoded codepoint.
46
- * @param consumed The number of bytes consumed by the decoder.
47
- */
48
- emitCodePoint: (cp: number, consumed: number) => void,
49
- /** An object that is used to produce errors. */
50
- errors?: EntityErrorProducer | undefined);
51
42
  /** The current state of the decoder. */
52
43
  private state;
53
44
  /** Characters that were consumed while parsing an entity. */
@@ -55,18 +46,37 @@ export declare class EntityDecoder {
55
46
  /**
56
47
  * The result of the entity.
57
48
  *
58
- * Either the result index of a numeric entity, or the codepoint of a
59
- * numeric entity.
49
+ * For named entities: the trie index of the best legacy match so far
50
+ * (0 = none). For numeric entities: the accumulated code point.
60
51
  */
61
52
  private result;
62
53
  /** The current index in the decode tree. */
63
54
  private treeIndex;
64
- /** The number of characters that were consumed in excess. */
55
+ /**
56
+ * Characters consumed since the last recorded legacy match, plus one.
57
+ * Invariant at the top of the `stateNamedEntity` loop: `excess` equals
58
+ * the number of unrecorded consumed characters + 1.
59
+ */
65
60
  private excess;
66
61
  /** The mode in which the decoder is operating. */
67
62
  private decodeMode;
68
63
  /** The number of characters that have been consumed in the current run. */
69
64
  private runConsumed;
65
+ constructor(
66
+ /** The predefined HTML or XML decode tree. */
67
+ decodeTree: Uint16Array,
68
+ /**
69
+ * The function that is called when a codepoint is decoded.
70
+ *
71
+ * For named entities that decode to multiple code points, this will
72
+ * be called multiple times, with the second codepoint, and the same
73
+ * `consumed` value.
74
+ * @param codepoint The decoded codepoint.
75
+ * @param consumed The number of characters consumed by the decoder.
76
+ */
77
+ emitCodePoint: (cp: number, consumed: number) => void,
78
+ /** An object that is used to produce errors. */
79
+ errors?: EntityErrorProducer | undefined);
70
80
  /**
71
81
  * Resets the instance to make it reusable.
72
82
  * @param decodeMode Entity decoding mode to use.
@@ -76,7 +86,7 @@ export declare class EntityDecoder {
76
86
  * Write an entity to the decoder. This can be called multiple times with partial entities.
77
87
  * If the entity is incomplete, the decoder will return -1.
78
88
  *
79
- * Mirrors the implementation of `getDecoder`, but with the ability to stop decoding if the
89
+ * Mirrors the non-streaming `decodeWithTrie`, but with the ability to stop decoding if the
80
90
  * entity is incomplete, and resume when the next string is written.
81
91
  * @param input The string containing the entity (or a continuation of the entity).
82
92
  * @param offset The offset at which the entity begins. Should be 0 if this is not the first call.
@@ -95,7 +105,9 @@ export declare class EntityDecoder {
95
105
  /**
96
106
  * Parses a hexadecimal numeric entity.
97
107
  *
98
- * Equivalent to the `Hexademical character reference state` in the HTML spec.
108
+ * Equivalent to the `Hexademical character reference state` in the HTML
109
+ * spec. Digit parsing matches the hex loop in `parseNumericEntity`.
110
+ * The accumulated value is preserved for numeric validation callbacks.
99
111
  * @param input The string containing the entity (or a continuation of the entity).
100
112
  * @param offset The current offset.
101
113
  * @returns The number of characters that were consumed, or -1 if the entity is incomplete.
@@ -104,7 +116,9 @@ export declare class EntityDecoder {
104
116
  /**
105
117
  * Parses a decimal numeric entity.
106
118
  *
107
- * Equivalent to the `Decimal character reference state` in the HTML spec.
119
+ * Equivalent to the `Decimal character reference state` in the HTML
120
+ * spec. Digit parsing matches the decimal loop in `parseNumericEntity`.
121
+ * The accumulated value is preserved for numeric validation callbacks.
108
122
  * @param input The string containing the entity (or a continuation of the entity).
109
123
  * @param offset The current offset.
110
124
  * @returns The number of characters that were consumed, or -1 if the entity is incomplete.
@@ -123,6 +137,19 @@ export declare class EntityDecoder {
123
137
  * @returns The number of characters that were consumed.
124
138
  */
125
139
  private emitNumericEntity;
140
+ /**
141
+ * Flush locally-tracked walk state back to the fields, then emit the
142
+ * recorded legacy match or reject (cold path — at most once per
143
+ * entity). Called after failed navigation (leaf node, branch miss, or
144
+ * compact-run mismatch). In attribute mode, reject if no legacy was
145
+ * recorded at the current node, if we descended past it, or if the
146
+ * pending input character is an invalid attribute terminator.
147
+ * @param consumed Locally-tracked consumed count.
148
+ * @param excess Locally-tracked excess count.
149
+ * @param char Pending input character (may be the mismatching char).
150
+ * @param valueLength Value length at the current trie node.
151
+ */
152
+ private flushAndEmitLegacyOrReject;
126
153
  /**
127
154
  * Parses a named entity.
128
155
  *
@@ -140,7 +167,7 @@ export declare class EntityDecoder {
140
167
  /**
141
168
  * Emit a named entity.
142
169
  * @param result The index of the entity in the decode tree.
143
- * @param valueLength The number of bytes in the entity.
170
+ * @param valueLength Encoded value length (header plus any value words).
144
171
  * @param consumed The number of characters consumed.
145
172
  * @returns The number of characters consumed.
146
173
  */
@@ -156,9 +183,12 @@ export declare class EntityDecoder {
156
183
  /**
157
184
  * Determines the branch of the current node that is taken given the current
158
185
  * character. This function is used to traverse the trie.
186
+ *
187
+ * See `BinTrieFlags` for the branch-data layouts handled here.
159
188
  * @param decodeTree The trie.
160
- * @param current The current node.
161
- * @param nodeIndex Index immediately after the current node header.
189
+ * @param current The current node's header word.
190
+ * @param nodeIndex Index of the node's first branch-data word (the header
191
+ * plus any value words have been skipped by the caller).
162
192
  * @param char The current character.
163
193
  * @returns The index of the next node, or -1 if no branch is taken.
164
194
  */
@@ -184,11 +214,14 @@ export declare function decodeHTMLAttribute(htmlAttribute: string): string;
184
214
  export declare function decodeHTMLStrict(htmlString: string): string;
185
215
  /**
186
216
  * Decodes an XML string, requiring all entities to be terminated by a semicolon.
217
+ *
218
+ * Uses a hand-coded fast path for the 5 XML named entities (amp, lt, gt,
219
+ * quot, apos) plus numeric entities, bypassing the trie entirely.
187
220
  * @param xmlString The string to decode.
188
221
  * @returns The decoded string.
189
222
  */
190
223
  export declare function decodeXML(xmlString: string): string;
191
- export { replaceCodePoint } from "./decode-codepoint.js";
224
+ export { replaceCodePoint, replaceCodePointXML, } from "./decode-codepoint.js";
192
225
  export { htmlDecodeTree } from "./generated/decode-data-html.js";
193
226
  export { xmlDecodeTree } from "./generated/decode-data-xml.js";
194
227
  //# sourceMappingURL=decode.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"decode.d.ts","sourceRoot":"","sources":["../src/decode.ts"],"names":[],"mappings":"AA6DA;;GAEG;AACH,oBAAY,YAAY;IACpB,8DAA8D;IAC9D,MAAM,IAAI;IACV,uDAAuD;IACvD,MAAM,IAAI;IACV,oEAAoE;IACpE,SAAS,IAAI;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAChC,uCAAuC,IAAI,IAAI,CAAC;IAChD,0CAA0C,CACtC,kBAAkB,EAAE,MAAM,GAC3B,IAAI,CAAC;IACR,iCAAiC,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CACzD;AAED;;GAEG;AACH,qBAAa,aAAa;IAElB,wCAAwC;IAExC,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B;;;;;;;OAOG;IACH,OAAO,CAAC,QAAQ,CAAC,aAAa;IAC9B,gDAAgD;IAChD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC;;IAbxB,wCAAwC;IAEvB,UAAU,EAAE,WAAW;IACxC;;;;;;;OAOG;IACc,aAAa,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,IAAI;IACtE,gDAAgD;IAC/B,MAAM,CAAC,EAAE,mBAAmB,GAAG,SAAS;IAG7D,wCAAwC;IACxC,OAAO,CAAC,KAAK,CAAkC;IAC/C,6DAA6D;IAC7D,OAAO,CAAC,QAAQ,CAAK;IACrB;;;;;OAKG;IACH,OAAO,CAAC,MAAM,C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