@json-schema-engine/formats 0.0.1

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/idna.js ADDED
@@ -0,0 +1,350 @@
1
+ // IDNA2008 label machinery shared by `hostname` (A-label content checks)
2
+ // and `idn-hostname`/`idn-email` (full U-label validation): RFC 3492
3
+ // Punycode (both directions), RFC 5892 Appendix A context rules and §2.6
4
+ // exceptions, RFC 5891 label rules. Implemented from the RFCs and the
5
+ // Unicode Character Database via ECMA-262's native \p{...} property
6
+ // escapes only (DESIGN.md D15).
7
+ // RFC 3492 §5 Bootstring parameters fixed for Punycode.
8
+ const PUNY_BASE = 36;
9
+ const PUNY_TMIN = 1;
10
+ const PUNY_TMAX = 26;
11
+ const PUNY_SKEW = 38;
12
+ const PUNY_DAMP = 700;
13
+ const PUNY_INITIAL_BIAS = 72;
14
+ const PUNY_INITIAL_N = 0x80;
15
+ const MAX_CODE_POINT = 0x10ffff;
16
+ /** RFC 3492 §5 digit-value mapping: "a"-"z"/"A"-"Z" → 0-25, "0"-"9" → 26-35. */
17
+ function punycodeDigitValue(code) {
18
+ if (code >= 0x61 && code <= 0x7a)
19
+ return code - 0x61; // a-z
20
+ if (code >= 0x41 && code <= 0x5a)
21
+ return code - 0x41; // A-Z
22
+ if (code >= 0x30 && code <= 0x39)
23
+ return code - 0x30 + 26; // 0-9
24
+ return undefined;
25
+ }
26
+ /** RFC 3492 §6.1 bias adaptation function. */
27
+ function punycodeAdapt(deltaIn, numPoints, firstTime) {
28
+ let delta = firstTime
29
+ ? Math.floor(deltaIn / PUNY_DAMP)
30
+ : Math.floor(deltaIn / 2);
31
+ delta += Math.floor(delta / numPoints);
32
+ let k = 0;
33
+ const threshold = Math.floor(((PUNY_BASE - PUNY_TMIN) * PUNY_TMAX) / 2);
34
+ while (delta > threshold) {
35
+ delta = Math.floor(delta / (PUNY_BASE - PUNY_TMIN));
36
+ k += PUNY_BASE;
37
+ }
38
+ return (k + Math.floor(((PUNY_BASE - PUNY_TMIN + 1) * delta) / (delta + PUNY_SKEW)));
39
+ }
40
+ /**
41
+ * RFC 3492 §6.2 decoding procedure over the Bootstring-encoded remainder
42
+ * of an A-label (the part after the "xn--" ACE prefix, which is an IDNA
43
+ * layering concern handled by the caller, not by Bootstring itself).
44
+ * Returns the decoded code points, or undefined for any malformed input:
45
+ * a non-ASCII basic code point, an unrecognized digit, an incomplete
46
+ * trailing generalized variable-length integer, arithmetic overflow, or a
47
+ * resulting code point outside the valid Unicode scalar value range.
48
+ */
49
+ export function decodePunycode(input) {
50
+ let n = PUNY_INITIAL_N;
51
+ let i = 0;
52
+ let bias = PUNY_INITIAL_BIAS;
53
+ const output = [];
54
+ const lastDelimiter = input.lastIndexOf("-");
55
+ let rest;
56
+ if (lastDelimiter !== -1) {
57
+ const basic = input.slice(0, lastDelimiter);
58
+ for (let k = 0; k < basic.length; k++) {
59
+ if (basic.charCodeAt(k) > 0x7f)
60
+ return undefined;
61
+ output.push(basic.charCodeAt(k));
62
+ }
63
+ rest = input.slice(lastDelimiter + 1);
64
+ }
65
+ else {
66
+ rest = input;
67
+ }
68
+ let pos = 0;
69
+ while (pos < rest.length) {
70
+ const oldi = i;
71
+ let w = 1;
72
+ let k = PUNY_BASE;
73
+ for (;;) {
74
+ if (pos >= rest.length)
75
+ return undefined; // incomplete integer
76
+ const digit = punycodeDigitValue(rest.charCodeAt(pos));
77
+ pos++;
78
+ if (digit === undefined)
79
+ return undefined;
80
+ if (digit > (Number.MAX_SAFE_INTEGER - i) / w)
81
+ return undefined; // overflow
82
+ i += digit * w;
83
+ const t = k <= bias ? PUNY_TMIN : k >= bias + PUNY_TMAX ? PUNY_TMAX : k - bias;
84
+ if (digit < t)
85
+ break;
86
+ if (w > Number.MAX_SAFE_INTEGER / (PUNY_BASE - t))
87
+ return undefined;
88
+ w *= PUNY_BASE - t;
89
+ k += PUNY_BASE;
90
+ }
91
+ const numPoints = output.length + 1;
92
+ bias = punycodeAdapt(i - oldi, numPoints, oldi === 0);
93
+ if (Math.floor(i / numPoints) > Number.MAX_SAFE_INTEGER - n) {
94
+ return undefined;
95
+ }
96
+ n += Math.floor(i / numPoints);
97
+ i %= numPoints;
98
+ if (n > MAX_CODE_POINT || (n >= 0xd800 && n <= 0xdfff))
99
+ return undefined;
100
+ output.splice(i, 0, n);
101
+ i++;
102
+ }
103
+ return output;
104
+ }
105
+ const PUNY_DIGIT_CHARS = "abcdefghijklmnopqrstuvwxyz0123456789";
106
+ /**
107
+ * RFC 3492 §6.3 encoding procedure — the inverse of {@link decodePunycode}.
108
+ * RFC 5891 §4.4 requires an A-label to be the CANONICAL Punycode encoding
109
+ * of its decoded content: a non-canonical Bootstring digit sequence can
110
+ * decode successfully yet not be what encoding those code points would
111
+ * produce (e.g. an encoder-would-never-emit extra "--" run), so an A-label
112
+ * is only valid when decode-then-re-encode round-trips to the original
113
+ * (case-insensitive) text.
114
+ */
115
+ export function encodePunycode(input) {
116
+ const basic = input.filter((cp) => cp < 0x80);
117
+ let output = basic.map((cp) => String.fromCharCode(cp)).join("");
118
+ if (basic.length > 0)
119
+ output += "-";
120
+ let n = PUNY_INITIAL_N;
121
+ let delta = 0;
122
+ let bias = PUNY_INITIAL_BIAS;
123
+ let h = basic.length;
124
+ const b = basic.length;
125
+ while (h < input.length) {
126
+ const m = Math.min(...input.filter((cp) => cp >= n));
127
+ delta += (m - n) * (h + 1);
128
+ n = m;
129
+ for (const cp of input) {
130
+ if (cp < n)
131
+ delta++;
132
+ if (cp === n) {
133
+ let q = delta;
134
+ for (let k = PUNY_BASE;; k += PUNY_BASE) {
135
+ const t = k <= bias
136
+ ? PUNY_TMIN
137
+ : k >= bias + PUNY_TMAX
138
+ ? PUNY_TMAX
139
+ : k - bias;
140
+ if (q < t) {
141
+ output += PUNY_DIGIT_CHARS[q];
142
+ break;
143
+ }
144
+ output += PUNY_DIGIT_CHARS[t + ((q - t) % (PUNY_BASE - t))];
145
+ q = Math.floor((q - t) / (PUNY_BASE - t));
146
+ }
147
+ bias = punycodeAdapt(delta, h + 1, h === b);
148
+ delta = 0;
149
+ h++;
150
+ }
151
+ }
152
+ delta++;
153
+ n++;
154
+ }
155
+ return output;
156
+ }
157
+ // RFC 5892 Appendix A context rules and RFC 5891 §4.2.3.2's leading
158
+ // combining-mark rule — the label-content checks that distinguish a valid
159
+ // A-label from merely-decodable Punycode. Implemented against JS's native
160
+ // Unicode property escapes (Script/General_Category, backed by the same
161
+ // Unicode Character Database the RFCs normatively reference) rather than
162
+ // hand-built codepoint tables.
163
+ const GREEK = /\p{Script=Greek}/u;
164
+ const HEBREW = /\p{Script=Hebrew}/u;
165
+ const HIRAGANA_KATAKANA_HAN = /\p{Script=Hiragana}|\p{Script=Katakana}|\p{Script=Han}/u;
166
+ const LEADING_COMBINING_MARK = /^\p{M}/u;
167
+ const ARABIC_INDIC = /[٠-٩]/;
168
+ const EXTENDED_ARABIC_INDIC = /[۰-۹]/;
169
+ // RFC 3492's Bootstring digit alphabet ("a"-"z"/"A"-"Z"/"0"-"9") also
170
+ // happens to be exactly the alphabet the "--" position-3-4 check and
171
+ // A-label prefix casing rules are stated over — no Unicode needed there.
172
+ // Canonical_Combining_Class=Virama (value 9) code points, restricted to
173
+ // the Brahmic-script viramas the Unicode Character Database assigns this
174
+ // unambiguously (per UnicodeData.txt) — JS's \p{...} property escapes
175
+ // don't expose Canonical_Combining_Class, so this is stated as an
176
+ // explicit set rather than a property query. Scripts whose "virama-like"
177
+ // sign's combining-class assignment is less clear-cut (e.g. Tibetan,
178
+ // Khmer) are intentionally omitted rather than guessed.
179
+ const VIRAMA_CODEPOINTS = new Set([
180
+ 0x094d, // Devanagari
181
+ 0x09cd, // Bengali
182
+ 0x0a4d, // Gurmukhi
183
+ 0x0acd, // Gujarati
184
+ 0x0b4d, // Oriya
185
+ 0x0bcd, // Tamil
186
+ 0x0c4d, // Telugu
187
+ 0x0ccd, // Kannada
188
+ 0x0d4d, // Malayalam
189
+ 0x0dca, // Sinhala (al-lakuna)
190
+ 0x1039, // Myanmar
191
+ ]);
192
+ /**
193
+ * RFC 5892 Appendix A.2 (ZWJ) and the primary A.1 (ZWNJ) test: the
194
+ * character immediately before the joiner has Canonical_Combining_Class
195
+ * Virama.
196
+ */
197
+ function precededByVirama(codepoints, index) {
198
+ return index > 0 && VIRAMA_CODEPOINTS.has(codepoints[index - 1]);
199
+ }
200
+ // RFC 5892 Appendix A.1's fallback for ZWNJ when not Virama-preceded: the
201
+ // text before must end in a Joining_Type Left_Joining/Dual_Joining
202
+ // character and the text after must start with Right_Joining/Dual_Joining
203
+ // (skipping any Transparent characters). JS doesn't expose Joining_Type
204
+ // either, so — since the suite's only such case is Arabic — this is
205
+ // scoped to the Arabic dual-joining letters actually exercised rather
206
+ // than the full ArabicShaping.txt table.
207
+ const ARABIC_DUAL_JOINING = /\p{Script=Arabic}/u;
208
+ function zwnjJoinContextOk(codepoints, index) {
209
+ const before = index > 0 ? codepoints[index - 1] : undefined;
210
+ const after = index < codepoints.length - 1 ? codepoints[index + 1] : undefined;
211
+ if (before === undefined || after === undefined)
212
+ return false;
213
+ return (ARABIC_DUAL_JOINING.test(String.fromCodePoint(before)) &&
214
+ ARABIC_DUAL_JOINING.test(String.fromCodePoint(after)));
215
+ }
216
+ // RFC 5892 §2.6 "Exceptions (F)": specific code points whose PVALID/
217
+ // DISALLOWED disposition is asserted directly rather than derived from
218
+ // their general Unicode properties. Only the DISALLOWED entries matter
219
+ // here — a disallowed exception is invalid in every label position,
220
+ // independent of the Appendix A context rules above (several of these
221
+ // code points, like KERAIA/GERESH/GERSHAYIM/MIDDLE DOT, are DISALLOWED by
222
+ // default here and only become valid through their Appendix A context
223
+ // rule, which is why those cases are handled by the switch above and not
224
+ // duplicated in this set). The PVALID exceptions (sharp s, final sigma,
225
+ // etc.) need no special-casing: nothing in the suite exercises them, and
226
+ // they're already permitted by not appearing in this rejection set.
227
+ const DISALLOWED_EXCEPTIONS = new Set([
228
+ 0x0640, // ARABIC TATWEEL
229
+ 0x07fa, // NKO LAJANYALAN
230
+ 0x302e, // HANGUL SINGLE DOT TONE MARK
231
+ 0x302f, // HANGUL DOUBLE DOT TONE MARK
232
+ 0x3031, // VERTICAL KANA REPEAT MARK
233
+ 0x3032, // VERTICAL KANA REPEAT WITH VOICED SOUND MARK
234
+ 0x3033, // VERTICAL KANA REPEAT MARK UPPER HALF
235
+ 0x3034, // VERTICAL KANA REPEAT WITH VOICED SOUND MARK UPPER HALF
236
+ 0x3035, // VERTICAL KANA REPEAT MARK LOWER HALF
237
+ 0x303b, // VERTICAL IDEOGRAPHIC ITERATION MARK
238
+ ]);
239
+ /**
240
+ * Applies the RFC 5891 §4.2.3.2 leading-mark rule and the RFC 5892
241
+ * Appendix A rules that the suite exercises to a decoded label's code
242
+ * points. `label` is the lowercase ASCII text of the label (the "xn--..."
243
+ * form); `codepoints` is its Punycode-decoded content.
244
+ */
245
+ export function isValidIdnaLabel(label, codepoints) {
246
+ if (codepoints.length === 0)
247
+ return false;
248
+ if (LEADING_COMBINING_MARK.test(String.fromCodePoint(codepoints[0]))) {
249
+ return false; // RFC 5891 §4.2.3.2
250
+ }
251
+ if (codepoints.some((cp) => DISALLOWED_EXCEPTIONS.has(cp)))
252
+ return false;
253
+ const hasArabicIndic = codepoints.some((cp) => ARABIC_INDIC.test(String.fromCodePoint(cp)));
254
+ const hasExtendedArabicIndic = codepoints.some((cp) => EXTENDED_ARABIC_INDIC.test(String.fromCodePoint(cp)));
255
+ if (hasArabicIndic && hasExtendedArabicIndic)
256
+ return false; // A.8/A.9
257
+ for (let idx = 0; idx < codepoints.length; idx++) {
258
+ const cp = codepoints[idx];
259
+ switch (cp) {
260
+ case 0x200c: // ZERO WIDTH NON-JOINER — A.1
261
+ if (!precededByVirama(codepoints, idx) &&
262
+ !zwnjJoinContextOk(codepoints, idx)) {
263
+ return false;
264
+ }
265
+ break;
266
+ case 0x200d: // ZERO WIDTH JOINER — A.2
267
+ if (!precededByVirama(codepoints, idx))
268
+ return false;
269
+ break;
270
+ case 0xb7: {
271
+ // MIDDLE DOT — A.3: 'l' immediately before AND after.
272
+ const before = idx > 0 ? codepoints[idx - 1] : undefined;
273
+ const after = idx < codepoints.length - 1 ? codepoints[idx + 1] : undefined;
274
+ if (before !== 0x6c || after !== 0x6c)
275
+ return false;
276
+ break;
277
+ }
278
+ case 0x375: {
279
+ // GREEK LOWER NUMERAL SIGN (KERAIA) — A.4: the character
280
+ // immediately FOLLOWING it must exist and be Greek-script (a
281
+ // forward local check, not a whole-label constraint — the suite
282
+ // separately rejects both "nothing follows" and "a non-Greek
283
+ // character follows").
284
+ if (idx === codepoints.length - 1)
285
+ return false;
286
+ if (!GREEK.test(String.fromCodePoint(codepoints[idx + 1]))) {
287
+ return false;
288
+ }
289
+ break;
290
+ }
291
+ case 0x5f3: // HEBREW PUNCTUATION GERESH — A.5
292
+ case 0x5f4: {
293
+ // HEBREW PUNCTUATION GERSHAYIM — A.6: preceding character Hebrew.
294
+ if (idx === 0 ||
295
+ !HEBREW.test(String.fromCodePoint(codepoints[idx - 1]))) {
296
+ return false;
297
+ }
298
+ break;
299
+ }
300
+ case 0x30fb: {
301
+ // KATAKANA MIDDLE DOT — A.7: label has a Hiragana/Katakana/Han char.
302
+ const hasScript = codepoints.some((other) => HIRAGANA_KATAKANA_HAN.test(String.fromCodePoint(other)));
303
+ if (!hasScript)
304
+ return false;
305
+ break;
306
+ }
307
+ default:
308
+ break;
309
+ }
310
+ }
311
+ return true;
312
+ }
313
+ /**
314
+ * Validates one "xn--..." A-label per RFC 5890 §2.3.1/§2.3.2.1 (ACE
315
+ * prefix, case-insensitive) + RFC 5891 §4.4 (canonical Punycode) + the
316
+ * content rules above. §4.4 requires the ACE suffix to be the CANONICAL
317
+ * encoding of its decoded content — decode-then-re-encode must round-trip
318
+ * to the original suffix, not merely decode without error, since a
319
+ * non-canonical Bootstring digit sequence can be well-formed enough to
320
+ * decode yet isn't what an encoder would ever produce for that content.
321
+ *
322
+ * §2.3.1's "'--' in the third/fourth position is reserved for ACE labels"
323
+ * is, per the suite, a constraint on the label's ASCII text as a whole,
324
+ * not just its mandatory prefix occurrence: every valid A-label in the
325
+ * suite has exactly one "--" pair (the "xn--" prefix itself), while the
326
+ * sole invalid "contains '--' in the 3rd and 4th position" case has a
327
+ * second "--" later in the same label. A second reserved-looking marker
328
+ * elsewhere in the text is rejected on the same "R-LDH labels are
329
+ * reserved for ACE use" grounds as the prefix position itself — allowing
330
+ * it would let two different byte-for-byte-identical ACE-shaped
331
+ * substrings coexist in one label with no way to say which is "the"
332
+ * prefix.
333
+ */
334
+ export function isValidALabel(label) {
335
+ const lower = label.toLowerCase();
336
+ if (!lower.startsWith("xn--"))
337
+ return false;
338
+ const rest = lower.slice(4);
339
+ if (rest === "")
340
+ return false;
341
+ if (rest.includes("--"))
342
+ return false;
343
+ const decoded = decodePunycode(rest);
344
+ if (decoded === undefined)
345
+ return false;
346
+ if (encodePunycode(decoded) !== rest)
347
+ return false; // §4.4 canonical form
348
+ return isValidIdnaLabel(lower, decoded);
349
+ }
350
+ //# sourceMappingURL=idna.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"idna.js","sourceRoot":"","sources":["../src/idna.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,qEAAqE;AACrE,yEAAyE;AACzE,sEAAsE;AACtE,oEAAoE;AACpE,gCAAgC;AAEhC,wDAAwD;AACxD,MAAM,SAAS,GAAG,EAAE,CAAC;AACrB,MAAM,SAAS,GAAG,CAAC,CAAC;AACpB,MAAM,SAAS,GAAG,EAAE,CAAC;AACrB,MAAM,SAAS,GAAG,EAAE,CAAC;AACrB,MAAM,SAAS,GAAG,GAAG,CAAC;AACtB,MAAM,iBAAiB,GAAG,EAAE,CAAC;AAC7B,MAAM,cAAc,GAAG,IAAI,CAAC;AAC5B,MAAM,cAAc,GAAG,QAAQ,CAAC;AAEhC,gFAAgF;AAChF,SAAS,kBAAkB,CAAC,IAAY;IACtC,IAAI,IAAI,IAAI,IAAI,IAAI,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9B,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC;QAAE,OAAO,KAAK,CAAC;IACtC,MAAM,OAAO,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC;IACrC,IAAI,OAAO,KAAK,SAAS;QAAE,OAAO,KAAK,CAAC;IACxC,IAAI,cAAc,CAAC,OAAO,CAAC,KAAK,IAAI;QAAE,OAAO,KAAK,CAAC,CAAC,sBAAsB;IAC1E,OAAO,gBAAgB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;AAC1C,CAAC"}
@@ -0,0 +1,37 @@
1
+ import type { FormatDefinition, FormatTable } from "@json-schema-engine/core";
2
+ export { idnEmail, idnHostname } from "./idn.js";
3
+ export declare const uuid: FormatDefinition;
4
+ export declare const ipv6: FormatDefinition;
5
+ export declare const date: FormatDefinition;
6
+ export declare const duration: FormatDefinition;
7
+ export declare const hostname: FormatDefinition;
8
+ export declare const ipv4: FormatDefinition;
9
+ export declare const jsonPointer: FormatDefinition;
10
+ export declare const relativeJsonPointer: FormatDefinition;
11
+ export declare const regex: FormatDefinition;
12
+ export declare const uri: FormatDefinition;
13
+ export declare const uriReference: FormatDefinition;
14
+ export declare const uriTemplate: FormatDefinition;
15
+ export declare const email: FormatDefinition;
16
+ export declare const iri: FormatDefinition;
17
+ export declare const iriReference: FormatDefinition;
18
+ export declare const time: FormatDefinition;
19
+ export declare const dateTime: FormatDefinition;
20
+ /**
21
+ * The draft 2020-12 format table. 2019-09 shares it; draft-07/06 subsets
22
+ * are derived below. Entries land format-by-format during M7 — each with
23
+ * its optional-suite file green before the next begins.
24
+ */
25
+ export declare const FORMATS_2020_12: FormatTable;
26
+ /** 2019-09 shares 2020-12's format list. */
27
+ export declare const FORMATS_2019_09: FormatTable;
28
+ /** draft-07 format table (no uuid, no duration). */
29
+ export declare const FORMATS_DRAFT_07: FormatTable;
30
+ /** draft-06 format table (draft-07's minus iri/iri-reference/idn-*). */
31
+ export declare const FORMATS_DRAFT_06: FormatTable;
32
+ /**
33
+ * draft-04 format table (for the draft-04 dialect package): only date-time,
34
+ * email, hostname, ipv4, ipv6, and uri are defined by the draft-04 spec.
35
+ */
36
+ export declare const FORMATS_DRAFT_04: FormatTable;
37
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAI9E,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAMjD,eAAO,MAAM,IAAI,EAAE,gBAElB,CAAC;AAuCF,eAAO,MAAM,IAAI,EAAE,gBAElB,CAAC;AA6BF,eAAO,MAAM,IAAI,EAAE,gBAElB,CAAC;AA+CF,eAAO,MAAM,QAAQ,EAAE,gBAEtB,CAAC;AAkBF,eAAO,MAAM,QAAQ,EAAE,gBAEtB,CAAC;AAWF,eAAO,MAAM,IAAI,EAAE,gBAElB,CAAC;AAOF,eAAO,MAAM,WAAW,EAAE,gBAEzB,CAAC;AAOF,eAAO,MAAM,mBAAmB,EAAE,gBAGjC,CAAC;AAiBF,eAAO,MAAM,KAAK,EAAE,gBAEnB,CAAC;AAkOF,eAAO,MAAM,GAAG,EAAE,gBAGjB,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,gBAG1B,CAAC;AAgIF,eAAO,MAAM,WAAW,EAAE,gBAEzB,CAAC;AAiGF,eAAO,MAAM,KAAK,EAAE,gBAEnB,CAAC;AAmDF,eAAO,MAAM,GAAG,EAAE,gBAGjB,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,gBAG1B,CAAC;AA0DF,eAAO,MAAM,IAAI,EAAE,gBAElB,CAAC;AAWF,eAAO,MAAM,QAAQ,EAAE,gBAEtB,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,eAAe,EAAE,WAoB7B,CAAC;AAEF,4CAA4C;AAC5C,eAAO,MAA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