@mailwoman/codex 5.9.0 → 5.10.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.
- package/out/address-system-conventions.d.ts +1 -1
- package/out/au/index.d.ts +4 -4
- package/out/ca/index.d.ts +3 -3
- package/out/ca/postal-code.d.ts +1 -1
- package/out/country/codes.d.ts +252 -251
- package/out/country/codes.d.ts.map +1 -1
- package/out/country/codes.js +251 -252
- package/out/country/codes.js.map +1 -1
- package/out/country/country.d.ts +2 -2
- package/out/country/index.d.ts +6 -6
- package/out/country/official-languages.d.ts +1 -1
- package/out/country/official-languages.js +1 -1
- package/out/country/reference-data.d.ts +1 -1
- package/out/country/reference-data.js +1 -1
- package/out/de/index.d.ts +3 -3
- package/out/fr/code-postal.d.ts +2 -2
- package/out/fr/departement.d.ts +1 -1
- package/out/fr/index.d.ts +5 -5
- package/out/gb/index.d.ts +4 -4
- package/out/gb/postcode-area.d.ts +1 -1
- package/out/index.d.ts +10 -10
- package/out/jp/index.d.ts +3 -3
- package/out/nz/index.d.ts +2 -2
- package/out/tools/generate-country-reference.d.ts +28 -0
- package/out/tools/generate-country-reference.d.ts.map +1 -0
- package/out/tools/generate-country-reference.js +105 -0
- package/out/tools/generate-country-reference.js.map +1 -0
- package/out/tools/generate-official-languages.d.ts +38 -0
- package/out/tools/generate-official-languages.d.ts.map +1 -0
- package/out/tools/generate-official-languages.js +142 -0
- package/out/tools/generate-official-languages.js.map +1 -0
- package/out/tools/index.d.ts +12 -0
- package/out/tools/index.d.ts.map +1 -0
- package/out/tools/index.js +12 -0
- package/out/tools/index.js.map +1 -0
- package/out/us/index.d.ts +8 -8
- package/out/us/street-directional.d.ts +23 -22
- package/out/us/street-directional.d.ts.map +1 -1
- package/out/us/street-directional.js +10 -11
- package/out/us/street-directional.js.map +1 -1
- package/out/us/zipcode.d.ts +1 -1
- package/package.json +93 -12
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* the #936 probe showed it pulls in cross-border quirks like Korean-in-CN, so consumers opt in).
|
|
10
10
|
* Every language appears under each ISO-639 spelling CLDR aliases to it (fi AND fin) so WOF
|
|
11
11
|
* 639-3 tags, Overture BCP-47 keys, and GeoNames codes all match without mapping.
|
|
12
|
-
* Regenerate with
|
|
12
|
+
* Regenerate with: mailwoman dev generate official-languages
|
|
13
13
|
*/
|
|
14
14
|
/** Official-language spellings for one territory. */
|
|
15
15
|
export interface OfficialLanguageEntry {
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* the #936 probe showed it pulls in cross-border quirks like Korean-in-CN, so consumers opt in).
|
|
10
10
|
* Every language appears under each ISO-639 spelling CLDR aliases to it (fi AND fin) so WOF
|
|
11
11
|
* 639-3 tags, Overture BCP-47 keys, and GeoNames codes all match without mapping.
|
|
12
|
-
* Regenerate with
|
|
12
|
+
* Regenerate with: mailwoman dev generate official-languages
|
|
13
13
|
*/
|
|
14
14
|
/** ISO 3166-1 alpha-2 → official languages. */
|
|
15
15
|
export const OFFICIAL_LANGUAGES = {
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*
|
|
6
6
|
* GENERATED — do not edit by hand. Country calling codes (E.164) + currencies (ISO 4217), derived
|
|
7
7
|
* from mledoze/countries (https://github.com/mledoze/countries, ODbL). NANP members map to 1.
|
|
8
|
-
* Regenerate with
|
|
8
|
+
* Regenerate with: mailwoman dev generate country-reference
|
|
9
9
|
*/
|
|
10
10
|
/** Static per-country reference: calling code + currency. */
|
|
11
11
|
export interface CountryReference {
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*
|
|
6
6
|
* GENERATED — do not edit by hand. Country calling codes (E.164) + currencies (ISO 4217), derived
|
|
7
7
|
* from mledoze/countries (https://github.com/mledoze/countries, ODbL). NANP members map to 1.
|
|
8
|
-
* Regenerate with
|
|
8
|
+
* Regenerate with: mailwoman dev generate country-reference
|
|
9
9
|
*/
|
|
10
10
|
/** ISO 3166-1 alpha-2 → reference. */
|
|
11
11
|
export const COUNTRY_REFERENCE = {
|
package/out/de/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* The German address system (Deutsche Post / ISO 3166-2:DE): street types, postal codes
|
|
7
7
|
* (Postleitzahl), and the federal states (Bundesländer).
|
|
8
8
|
*/
|
|
9
|
-
export * from "./bundesland.
|
|
10
|
-
export * from "./postleitzahl.
|
|
11
|
-
export * from "./street-type.
|
|
9
|
+
export * from "./bundesland.ts";
|
|
10
|
+
export * from "./postleitzahl.ts";
|
|
11
|
+
export * from "./street-type.ts";
|
|
12
12
|
//# sourceMappingURL=index.d.ts.map
|
package/out/fr/code-postal.d.ts
CHANGED
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
* the gazetteer.
|
|
25
25
|
*/
|
|
26
26
|
import type { Tagged } from "type-fest";
|
|
27
|
-
import { type DepartementCode, type DepartementInfo } from "./departement.
|
|
28
|
-
import { type FrenchRegionInfo } from "./region.
|
|
27
|
+
import { type DepartementCode, type DepartementInfo } from "./departement.ts";
|
|
28
|
+
import { type FrenchRegionInfo } from "./region.ts";
|
|
29
29
|
/**
|
|
30
30
|
* A French postal code: five digits (`75008`). Same shape as a US ZIP or a German PLZ — the shape alone does not
|
|
31
31
|
* disambiguate the country.
|
package/out/fr/departement.d.ts
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* digits ARE the département number (see `code-postal.ts`), and the région is derived from the
|
|
11
11
|
* département. This table is therefore the hinge between `code-postal.ts` and `region.ts`.
|
|
12
12
|
*/
|
|
13
|
-
import type { FrenchRegionCode } from "./region.
|
|
13
|
+
import type { FrenchRegionCode } from "./region.ts";
|
|
14
14
|
/** Per-département record: code (2-digit, or `2A`/`2B`, or 3-digit DOM) + name + its région. */
|
|
15
15
|
export interface DepartementInfo {
|
|
16
16
|
/** Département code: `01`–`95` (metropolitan), `2A`/`2B` (Corsica), or `971`–`976` (overseas). */
|
package/out/fr/index.d.ts
CHANGED
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
* The French address system (La Poste / ISO 3166-2:FR): street types (voie), postal codes (code
|
|
7
7
|
* postal), and the admin hierarchy of départements and régions.
|
|
8
8
|
*/
|
|
9
|
-
export * from "./cedex.
|
|
10
|
-
export * from "./code-postal.
|
|
11
|
-
export * from "./departement.
|
|
12
|
-
export * from "./region.
|
|
13
|
-
export * from "./voie.
|
|
9
|
+
export * from "./cedex.ts";
|
|
10
|
+
export * from "./code-postal.ts";
|
|
11
|
+
export * from "./departement.ts";
|
|
12
|
+
export * from "./region.ts";
|
|
13
|
+
export * from "./voie.ts";
|
|
14
14
|
//# sourceMappingURL=index.d.ts.map
|
package/out/gb/index.d.ts
CHANGED
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
* postcode and its Royal-Mail postcode areas, the four constituent countries, and British street
|
|
8
8
|
* vocabulary.
|
|
9
9
|
*/
|
|
10
|
-
export * from "./country.
|
|
11
|
-
export * from "./postcode-area.
|
|
12
|
-
export * from "./postcode.
|
|
13
|
-
export * from "./street-type.
|
|
10
|
+
export * from "./country.ts";
|
|
11
|
+
export * from "./postcode-area.ts";
|
|
12
|
+
export * from "./postcode.ts";
|
|
13
|
+
export * from "./street-type.ts";
|
|
14
14
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
* non-England set with documented border fudges — rather than a tidy prefix rule — is exactly why
|
|
22
22
|
* a UK postcode is not a county.
|
|
23
23
|
*/
|
|
24
|
-
import type { UkCountryCode } from "./country.
|
|
24
|
+
import type { UkCountryCode } from "./country.ts";
|
|
25
25
|
/**
|
|
26
26
|
* The explicit non-England postcode areas, area → constituent country. England is intentionally absent: it is the
|
|
27
27
|
* DEFAULT (the great majority of UK areas are English), so listing it would be both enormous and a maintenance trap.
|
package/out/index.d.ts
CHANGED
|
@@ -17,14 +17,14 @@
|
|
|
17
17
|
* `candidateSystemsForPostcode` (the inverse of the per-slice postcode patterns) is a top-level
|
|
18
18
|
* export.
|
|
19
19
|
*/
|
|
20
|
-
export { ADDRESS_SYSTEM_CONVENTIONS, conventionsForSystem, type AddressSystemConventions, } from "./address-system-conventions.
|
|
21
|
-
export * as au from "./au/index.
|
|
22
|
-
export * as ca from "./ca/index.
|
|
23
|
-
export * as de from "./de/index.
|
|
24
|
-
export * as fr from "./fr/index.
|
|
25
|
-
export * as gb from "./gb/index.
|
|
26
|
-
export * as jp from "./jp/index.
|
|
27
|
-
export * as nz from "./nz/index.
|
|
28
|
-
export { candidateSystemsForPostcode, type SystemCode } from "./postcode-systems.
|
|
29
|
-
export * as us from "./us/index.
|
|
20
|
+
export { ADDRESS_SYSTEM_CONVENTIONS, conventionsForSystem, type AddressSystemConventions, } from "./address-system-conventions.ts";
|
|
21
|
+
export * as au from "./au/index.ts";
|
|
22
|
+
export * as ca from "./ca/index.ts";
|
|
23
|
+
export * as de from "./de/index.ts";
|
|
24
|
+
export * as fr from "./fr/index.ts";
|
|
25
|
+
export * as gb from "./gb/index.ts";
|
|
26
|
+
export * as jp from "./jp/index.ts";
|
|
27
|
+
export * as nz from "./nz/index.ts";
|
|
28
|
+
export { candidateSystemsForPostcode, type SystemCode } from "./postcode-systems.ts";
|
|
29
|
+
export * as us from "./us/index.ts";
|
|
30
30
|
//# sourceMappingURL=index.d.ts.map
|
package/out/jp/index.d.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* that is the country's most reliable geographic anchor, and the address-unit markers that stand
|
|
8
8
|
* in for the street names Japan does not use.
|
|
9
9
|
*/
|
|
10
|
-
export * from "./address-unit.
|
|
11
|
-
export * from "./postal-code.
|
|
12
|
-
export * from "./prefecture.
|
|
10
|
+
export * from "./address-unit.ts";
|
|
11
|
+
export * from "./postal-code.ts";
|
|
12
|
+
export * from "./prefecture.ts";
|
|
13
13
|
//# sourceMappingURL=index.d.ts.map
|
package/out/nz/index.d.ts
CHANGED
|
@@ -7,6 +7,6 @@
|
|
|
7
7
|
* delivery-service types (PO Box, Private Bag, CMB, Response Bag, Counter Delivery, Poste
|
|
8
8
|
* Restante) and the 4-digit postcode. NZ addresses carry no state/region line.
|
|
9
9
|
*/
|
|
10
|
-
export * from "./delivery-service.
|
|
11
|
-
export * from "./postcode.
|
|
10
|
+
export * from "./delivery-service.ts";
|
|
11
|
+
export * from "./postcode.ts";
|
|
12
12
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
*
|
|
6
|
+
* Regenerate `codex/country/reference-data.ts` — the per-country calling code (E.164) + currency
|
|
7
|
+
* (ISO 4217) table — from mledoze/countries (https://github.com/mledoze/countries, ODbL). The
|
|
8
|
+
* output is committed; this tool makes it reproducible (provenance), not a hand-typed dictionary.
|
|
9
|
+
*
|
|
10
|
+
* Calling-code rule: mledoze splits the code as `idd.root` + `idd.suffixes`. For most countries a
|
|
11
|
+
* single suffix completes the code (GB `+4` + `4` = 44); NANP members share root `+1` with their
|
|
12
|
+
* area code as the suffix, so they map to 1.
|
|
13
|
+
*
|
|
14
|
+
* Usage: mailwoman dev generate country-reference
|
|
15
|
+
*/
|
|
16
|
+
/** Options for {@linkcode generateCountryReference}. */
|
|
17
|
+
export interface GenerateCountryReferenceOptions {
|
|
18
|
+
/** Output path override. Default: `codex/country/reference-data.ts` (the committed table). */
|
|
19
|
+
out?: string;
|
|
20
|
+
}
|
|
21
|
+
/** Summary returned by {@linkcode generateCountryReference}. */
|
|
22
|
+
export interface GenerateCountryReferenceSummary {
|
|
23
|
+
countries: number;
|
|
24
|
+
outPath: string;
|
|
25
|
+
}
|
|
26
|
+
/** Fetch mledoze/countries and regenerate the committed `COUNTRY_REFERENCE` table. */
|
|
27
|
+
export declare function generateCountryReference(options?: GenerateCountryReferenceOptions, report?: (line: string) => void): Promise<GenerateCountryReferenceSummary>;
|
|
28
|
+
//# sourceMappingURL=generate-country-reference.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-country-reference.d.ts","sourceRoot":"","sources":["../../tools/generate-country-reference.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AA4BH,wDAAwD;AACxD,MAAM,WAAW,+BAA+B;IAC/C,8FAA8F;IAC9F,GAAG,CAAC,EAAE,MAAM,CAAA;CACZ;AAED,gEAAgE;AAChE,MAAM,WAAW,+BAA+B;IAC/C,SAAS,EAAE,MAAM,CAAA;IACjB,OAAO,EAAE,MAAM,CAAA;CACf;AA4BD,sFAAsF;AACtF,wBAAsB,wBAAwB,CAC7C,OAAO,GAAE,+BAAoC,EAC7C,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,GAC7B,OAAO,CAAC,+BAA+B,CAAC,CAoE1C"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
*
|
|
6
|
+
* Regenerate `codex/country/reference-data.ts` — the per-country calling code (E.164) + currency
|
|
7
|
+
* (ISO 4217) table — from mledoze/countries (https://github.com/mledoze/countries, ODbL). The
|
|
8
|
+
* output is committed; this tool makes it reproducible (provenance), not a hand-typed dictionary.
|
|
9
|
+
*
|
|
10
|
+
* Calling-code rule: mledoze splits the code as `idd.root` + `idd.suffixes`. For most countries a
|
|
11
|
+
* single suffix completes the code (GB `+4` + `4` = 44); NANP members share root `+1` with their
|
|
12
|
+
* area code as the suffix, so they map to 1.
|
|
13
|
+
*
|
|
14
|
+
* Usage: mailwoman dev generate country-reference
|
|
15
|
+
*/
|
|
16
|
+
import { writeFileSync } from "node:fs";
|
|
17
|
+
import { fileURLToPath } from "node:url";
|
|
18
|
+
const SOURCE = "https://raw.githubusercontent.com/mledoze/countries/master/countries.json";
|
|
19
|
+
/**
|
|
20
|
+
* The committed output path, resolved relative to this module (codex/tools/ → codex/country/). The codegen is
|
|
21
|
+
* repo-only, and in the repo `@mailwoman/codex/tools` always loads from source via the `node` exports condition, so
|
|
22
|
+
* `import.meta.url` points at the source tree. (`@mailwoman/core`'s `repoRootPath` would also work, but codex is
|
|
23
|
+
* zero-runtime-dep and `core` already references `codex` — importing core here would cycle the project graph.)
|
|
24
|
+
*/
|
|
25
|
+
const DEFAULT_OUT = fileURLToPath(new URL("../country/reference-data.ts", import.meta.url));
|
|
26
|
+
function callingCode(country) {
|
|
27
|
+
const root = (country.idd?.root ?? "").replace("+", "");
|
|
28
|
+
const suffixes = country.idd?.suffixes ?? [];
|
|
29
|
+
if (!root)
|
|
30
|
+
return undefined;
|
|
31
|
+
if (root === "1")
|
|
32
|
+
return 1;
|
|
33
|
+
if (suffixes.length === 1) {
|
|
34
|
+
const n = Number(root + suffixes[0]);
|
|
35
|
+
return Number.isFinite(n) ? n : undefined;
|
|
36
|
+
}
|
|
37
|
+
const n = Number(root);
|
|
38
|
+
return Number.isFinite(n) ? n : undefined;
|
|
39
|
+
}
|
|
40
|
+
const serialize = (o) => JSON.stringify(o, null, 0)
|
|
41
|
+
.replace(/"isoCode"/g, "isoCode")
|
|
42
|
+
.replace(/"callingCode"/g, "callingCode")
|
|
43
|
+
.replace(/"currency"/g, "currency")
|
|
44
|
+
.replace(/"name"/g, "name")
|
|
45
|
+
.replace(/"symbol"/g, "symbol");
|
|
46
|
+
/** Fetch mledoze/countries and regenerate the committed `COUNTRY_REFERENCE` table. */
|
|
47
|
+
export async function generateCountryReference(options = {}, report) {
|
|
48
|
+
const outPath = options.out ?? DEFAULT_OUT;
|
|
49
|
+
const response = await fetch(SOURCE);
|
|
50
|
+
if (!response.ok)
|
|
51
|
+
throw new Error(`fetch ${SOURCE} failed: ${response.status}`);
|
|
52
|
+
const countries = (await response.json());
|
|
53
|
+
const rows = {};
|
|
54
|
+
for (const country of countries) {
|
|
55
|
+
const alpha2 = country.cca2;
|
|
56
|
+
if (!alpha2)
|
|
57
|
+
continue;
|
|
58
|
+
const entry = {};
|
|
59
|
+
const cc = callingCode(country);
|
|
60
|
+
if (cc != null) {
|
|
61
|
+
entry.callingCode = cc;
|
|
62
|
+
}
|
|
63
|
+
const currencyCodes = Object.keys(country.currencies ?? {}).sort();
|
|
64
|
+
if (currencyCodes.length) {
|
|
65
|
+
const code = currencyCodes[0];
|
|
66
|
+
const info = country.currencies[code] ?? {};
|
|
67
|
+
entry.currency = { isoCode: code };
|
|
68
|
+
if (info.name) {
|
|
69
|
+
entry.currency.name = info.name;
|
|
70
|
+
}
|
|
71
|
+
if (info.symbol) {
|
|
72
|
+
entry.currency.symbol = info.symbol;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
if (Object.keys(entry).length) {
|
|
76
|
+
rows[alpha2] = entry;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
const body = Object.keys(rows)
|
|
80
|
+
.sort()
|
|
81
|
+
.map((k) => `\t${k}: ${serialize(rows[k])},`)
|
|
82
|
+
.join("\n");
|
|
83
|
+
const header = `/**
|
|
84
|
+
* @copyright Sister Software
|
|
85
|
+
* @license AGPL-3.0
|
|
86
|
+
* @author Teffen Ellis, et al.
|
|
87
|
+
*
|
|
88
|
+
* GENERATED — do not edit by hand. Country calling codes (E.164) + currencies (ISO 4217), derived
|
|
89
|
+
* from mledoze/countries (https://github.com/mledoze/countries, ODbL). NANP members map to 1.
|
|
90
|
+
* Regenerate with: mailwoman dev generate country-reference
|
|
91
|
+
*/
|
|
92
|
+
|
|
93
|
+
/** Static per-country reference: calling code + currency. */
|
|
94
|
+
export interface CountryReference {
|
|
95
|
+
callingCode?: number
|
|
96
|
+
currency?: { isoCode: string; name?: string; symbol?: string }
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/** ISO 3166-1 alpha-2 → reference. */
|
|
100
|
+
export const COUNTRY_REFERENCE: Record<string, CountryReference> = {`;
|
|
101
|
+
writeFileSync(outPath, `${header}\n${body}\n}\n`);
|
|
102
|
+
report?.(`wrote ${outPath} (${Object.keys(rows).length} countries)`);
|
|
103
|
+
return { countries: Object.keys(rows).length, outPath };
|
|
104
|
+
}
|
|
105
|
+
//# sourceMappingURL=generate-country-reference.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-country-reference.js","sourceRoot":"","sources":["../../tools/generate-country-reference.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAExC,MAAM,MAAM,GAAG,2EAA2E,CAAA;AAE1F;;;;;GAKG;AACH,MAAM,WAAW,GAAG,aAAa,CAAC,IAAI,GAAG,CAAC,8BAA8B,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAA;AA2B3F,SAAS,WAAW,CAAC,OAAuB;IAC3C,MAAM,IAAI,GAAG,CAAC,OAAO,CAAC,GAAG,EAAE,IAAI,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAA;IACvD,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,EAAE,QAAQ,IAAI,EAAE,CAAA;IAE5C,IAAI,CAAC,IAAI;QAAE,OAAO,SAAS,CAAA;IAE3B,IAAI,IAAI,KAAK,GAAG;QAAE,OAAO,CAAC,CAAA;IAE1B,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC3B,MAAM,CAAC,GAAG,MAAM,CAAC,IAAI,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAA;QAEpC,OAAO,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;IAC1C,CAAC;IACD,MAAM,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,CAAA;IAEtB,OAAO,MAAM,CAAC,QAAQ,CAAC,CAAC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AC,IAAI,CAAC,CAAC,MAAM,EAAE,OAAO,EAAE,CAAA;AACxD,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
*
|
|
6
|
+
* Regenerates `codex/country/official-languages.ts` from Unicode CLDR supplemental data
|
|
7
|
+
* (territoryInfo `_officialStatus` + languageAlias). The emitted table is the #936 ingest bit's
|
|
8
|
+
* authority for "is this name row in an official language of its country?" — consumed by the
|
|
9
|
+
* gazetteer builders (`mailwoman gazetteer build`, `@mailwoman/resolver-wof-sqlite`'s GeoNames
|
|
10
|
+
* fold), never at query time.
|
|
11
|
+
*
|
|
12
|
+
* Each language is emitted under EVERY ISO-639 spelling CLDR aliases to it (fi + fin, sv + swe)
|
|
13
|
+
* so consumers can test WOF's 639-3 tags, Overture's BCP-47 keys, and GeoNames' mixed 2/3-letter
|
|
14
|
+
* codes without a mapping step.
|
|
15
|
+
*
|
|
16
|
+
* Usage: mailwoman dev generate official-languages [--cldr-dir <dir>] [--cldr-version 47.0.0]
|
|
17
|
+
*
|
|
18
|
+
* With `cldrDir`, reads cldr-territoryInfo.json + cldr-aliases.json from disk; otherwise fetches
|
|
19
|
+
* the pinned cldr-core release from jsdelivr.
|
|
20
|
+
*/
|
|
21
|
+
/** Options for {@linkcode generateOfficialLanguages}. */
|
|
22
|
+
export interface GenerateOfficialLanguagesOptions {
|
|
23
|
+
/** Read cldr-territoryInfo.json + cldr-aliases.json from this directory instead of fetching. */
|
|
24
|
+
cldrDir?: string;
|
|
25
|
+
/** Pinned cldr-core release fetched from jsdelivr when {@linkcode GenerateOfficialLanguagesOptions.cldrDir} is absent. */
|
|
26
|
+
cldrVersion?: string;
|
|
27
|
+
/** Output path override. Default: `codex/country/official-languages.ts` (the committed table). */
|
|
28
|
+
out?: string;
|
|
29
|
+
}
|
|
30
|
+
/** Summary returned by {@linkcode generateOfficialLanguages}. */
|
|
31
|
+
export interface GenerateOfficialLanguagesSummary {
|
|
32
|
+
territories: number;
|
|
33
|
+
cldrVersion: string;
|
|
34
|
+
outPath: string;
|
|
35
|
+
}
|
|
36
|
+
/** Regenerate the committed `OFFICIAL_LANGUAGES` table from CLDR supplemental data. */
|
|
37
|
+
export declare function generateOfficialLanguages(options?: GenerateOfficialLanguagesOptions, report?: (line: string) => void): Promise<GenerateOfficialLanguagesSummary>;
|
|
38
|
+
//# sourceMappingURL=generate-official-languages.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-official-languages.d.ts","sourceRoot":"","sources":["../../tools/generate-official-languages.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAaH,yDAAyD;AACzD,MAAM,WAAW,gCAAgC;IAChD,gGAAgG;IAChG,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,0HAA0H;IAC1H,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,kGAAkG;IAClG,GAAG,CAAC,EAAE,MAAM,CAAA;CACZ;AAED,iEAAiE;AACjE,MAAM,WAAW,gCAAgC;IAChD,WAAW,EAAE,MAAM,CAAA;IACnB,WAAW,EAAE,MAAM,CAAA;IACnB,OAAO,EAAE,MAAM,CAAA;CACf;AAgBD,uFAAuF;AACvF,wBAAsB,yBAAyB,CAC9C,OAAO,GAAE,gCAAqC,EAC9C,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,GAC7B,OAAO,CAAC,gCAAgC,CAAC,CAwH3C"}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
*
|
|
6
|
+
* Regenerates `codex/country/official-languages.ts` from Unicode CLDR supplemental data
|
|
7
|
+
* (territoryInfo `_officialStatus` + languageAlias). The emitted table is the #936 ingest bit's
|
|
8
|
+
* authority for "is this name row in an official language of its country?" — consumed by the
|
|
9
|
+
* gazetteer builders (`mailwoman gazetteer build`, `@mailwoman/resolver-wof-sqlite`'s GeoNames
|
|
10
|
+
* fold), never at query time.
|
|
11
|
+
*
|
|
12
|
+
* Each language is emitted under EVERY ISO-639 spelling CLDR aliases to it (fi + fin, sv + swe)
|
|
13
|
+
* so consumers can test WOF's 639-3 tags, Overture's BCP-47 keys, and GeoNames' mixed 2/3-letter
|
|
14
|
+
* codes without a mapping step.
|
|
15
|
+
*
|
|
16
|
+
* Usage: mailwoman dev generate official-languages [--cldr-dir <dir>] [--cldr-version 47.0.0]
|
|
17
|
+
*
|
|
18
|
+
* With `cldrDir`, reads cldr-territoryInfo.json + cldr-aliases.json from disk; otherwise fetches
|
|
19
|
+
* the pinned cldr-core release from jsdelivr.
|
|
20
|
+
*/
|
|
21
|
+
import { readFileSync, writeFileSync } from "node:fs";
|
|
22
|
+
import { join } from "node:path";
|
|
23
|
+
import { fileURLToPath } from "node:url";
|
|
24
|
+
/**
|
|
25
|
+
* The committed output path, resolved relative to this module (codex/tools/ → codex/country/). The codegen is
|
|
26
|
+
* repo-only, and in the repo `@mailwoman/codex/tools` always loads from source via the `node` exports condition, so
|
|
27
|
+
* `import.meta.url` points at the source tree.
|
|
28
|
+
*/
|
|
29
|
+
const DEFAULT_OUT = fileURLToPath(new URL("../country/official-languages.ts", import.meta.url));
|
|
30
|
+
async function loadCLDR(file, cldrDir, cldrVersion) {
|
|
31
|
+
if (cldrDir)
|
|
32
|
+
return JSON.parse(readFileSync(join(cldrDir, `cldr-${file}.json`), "utf8"));
|
|
33
|
+
const url = `https://cdn.jsdelivr.net/npm/cldr-core@${cldrVersion}/supplemental/${file}.json`;
|
|
34
|
+
const res = await fetch(url);
|
|
35
|
+
if (!res.ok)
|
|
36
|
+
throw new Error(`${url}: HTTP ${res.status}`);
|
|
37
|
+
return res.json();
|
|
38
|
+
}
|
|
39
|
+
/** Regenerate the committed `OFFICIAL_LANGUAGES` table from CLDR supplemental data. */
|
|
40
|
+
export async function generateOfficialLanguages(options = {}, report) {
|
|
41
|
+
const cldrVersion = options.cldrVersion ?? "47.0.0";
|
|
42
|
+
const outPath = options.out ?? DEFAULT_OUT;
|
|
43
|
+
const territoryInfo = (await loadCLDR("territoryInfo", options.cldrDir, cldrVersion)).supplemental.territoryInfo;
|
|
44
|
+
const aliasesDoc = (await loadCLDR("aliases", options.cldrDir, cldrVersion));
|
|
45
|
+
const languageAlias = aliasesDoc.supplemental.metadata.alias.languageAlias;
|
|
46
|
+
// canonical code → every plain 2-3 letter alias spelling that maps to it (fi gains "fin")
|
|
47
|
+
const spellingsOf = new Map();
|
|
48
|
+
for (const [alias, entry] of Object.entries(languageAlias)) {
|
|
49
|
+
const canon = entry._replacement;
|
|
50
|
+
if (!canon || !/^[a-z]{2,3}$/.test(alias))
|
|
51
|
+
continue;
|
|
52
|
+
let set = spellingsOf.get(canon);
|
|
53
|
+
if (!set) {
|
|
54
|
+
spellingsOf.set(canon, (set = new Set()));
|
|
55
|
+
}
|
|
56
|
+
set.add(alias);
|
|
57
|
+
}
|
|
58
|
+
const table = {};
|
|
59
|
+
for (const territory of Object.keys(territoryInfo).sort()) {
|
|
60
|
+
if (!/^[A-Z]{2}$/.test(territory))
|
|
61
|
+
continue;
|
|
62
|
+
const pops = territoryInfo[territory].languagePopulation;
|
|
63
|
+
if (!pops)
|
|
64
|
+
continue;
|
|
65
|
+
const official = new Set();
|
|
66
|
+
const regional = new Set();
|
|
67
|
+
for (const [lang, data] of Object.entries(pops)) {
|
|
68
|
+
const status = data._officialStatus;
|
|
69
|
+
if (!status)
|
|
70
|
+
continue;
|
|
71
|
+
// CLDR keys can carry script subtags ("zh_Hant") — name tags use the base language.
|
|
72
|
+
const base = lang.split("_")[0];
|
|
73
|
+
const spellings = [base, ...(spellingsOf.get(base) ?? [])].sort();
|
|
74
|
+
if (status === "official" || status === "de_facto_official") {
|
|
75
|
+
for (const s of spellings) {
|
|
76
|
+
official.add(s);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
else if (status === "official_regional") {
|
|
80
|
+
for (const s of spellings) {
|
|
81
|
+
regional.add(s);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
if (official.size === 0 && regional.size === 0)
|
|
86
|
+
continue;
|
|
87
|
+
table[territory] = { official: [...official].sort() };
|
|
88
|
+
if (regional.size > 0) {
|
|
89
|
+
table[territory].regional = [...regional].sort();
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
const entries = Object.entries(table)
|
|
93
|
+
.map(([cc, v]) => {
|
|
94
|
+
const reg = v.regional ? `, regional: [${v.regional.map((l) => `"${l}"`).join(", ")}]` : "";
|
|
95
|
+
return `\t${cc}: { official: [${v.official.map((l) => `"${l}"`).join(", ")}]${reg} },`;
|
|
96
|
+
})
|
|
97
|
+
.join("\n");
|
|
98
|
+
const header = `/**
|
|
99
|
+
* @copyright Sister Software
|
|
100
|
+
* @license AGPL-3.0
|
|
101
|
+
* @author Teffen Ellis, et al.
|
|
102
|
+
*
|
|
103
|
+
* GENERATED — do not edit by hand. Official languages per ISO 3166-1 territory, derived from
|
|
104
|
+
* Unicode CLDR ${cldrVersion} supplemental territoryInfo (\`_officialStatus\`). \`official\` merges
|
|
105
|
+
* CLDR's \`official\` + \`de_facto_official\`; \`regional\` is \`official_regional\` (kept separate —
|
|
106
|
+
* the #936 probe showed it pulls in cross-border quirks like Korean-in-CN, so consumers opt in).
|
|
107
|
+
* Every language appears under each ISO-639 spelling CLDR aliases to it (fi AND fin) so WOF
|
|
108
|
+
* 639-3 tags, Overture BCP-47 keys, and GeoNames codes all match without mapping.
|
|
109
|
+
* Regenerate with: mailwoman dev generate official-languages
|
|
110
|
+
*/
|
|
111
|
+
|
|
112
|
+
/** Official-language spellings for one territory. */
|
|
113
|
+
export interface OfficialLanguageEntry {
|
|
114
|
+
/** CLDR \`official\` + \`de_facto_official\`, in every ISO-639 spelling. */
|
|
115
|
+
official: readonly string[]
|
|
116
|
+
/** CLDR \`official_regional\` (e.g. Catalan in ES) — opt-in for consumers. */
|
|
117
|
+
regional?: readonly string[]
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/** ISO 3166-1 alpha-2 → official languages. */
|
|
121
|
+
export const OFFICIAL_LANGUAGES: Record<string, OfficialLanguageEntry> = {
|
|
122
|
+
${entries}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Is \`language\` (any ISO-639 spelling: "sv", "swe", …) an official language of \`country\` (ISO
|
|
127
|
+
* 3166-1 alpha-2)? Regional-official languages count only with \`includeRegional\`.
|
|
128
|
+
*/
|
|
129
|
+
export function isOfficialLanguage(country: string, language: string, includeRegional = false): boolean {
|
|
130
|
+
const entry = OFFICIAL_LANGUAGES[country.toUpperCase()]
|
|
131
|
+
|
|
132
|
+
if (!entry) return false
|
|
133
|
+
const lang = language.toLowerCase()
|
|
134
|
+
|
|
135
|
+
return entry.official.includes(lang) || (includeRegional && (entry.regional?.includes(lang) ?? false))
|
|
136
|
+
}
|
|
137
|
+
`;
|
|
138
|
+
writeFileSync(outPath, header);
|
|
139
|
+
report?.(`Wrote ${outPath}: ${Object.keys(table).length} territories (CLDR ${cldrVersion})`);
|
|
140
|
+
return { territories: Object.keys(table).length, cldrVersion, outPath };
|
|
141
|
+
}
|
|
142
|
+
//# sourceMappingURL=generate-official-languages.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-official-languages.js","sourceRoot":"","sources":["../../tools/generate-official-languages.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AACrD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAExC;;;;GAIG;AACH,MAAM,WAAW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K,EAAE,kBAAkB,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,GAAG,KAAK,CAAA;IACvF,CAAC,CAAC;SACD,IAAI,CAAC,IAAI,CAAC,CAAA;IAEZ,MAAM,MAAM,GAAG;;;;;;oBAMI,WAAW;;;;;;;;;;;;;;;;;;EAkB7B,OAAO;;;;;;;;;;;;;;;CAeR,CAAA;IAEA,aAAa,CAAC,OAAO,EAAE,MAAM,CAAC,CAAA;IAC9B,MAAM,EAAE,CAAC,SAAS,OAAO,KAAK,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,sBAAsB,WAAW,GAAG,CAAC,CAAA;IAE5F,OAAO,EAAE,WAAW,EAAE,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,CAAA;AACxE,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
*
|
|
6
|
+
* Codex operator tools — the `run()`-style modules behind `mailwoman dev generate …` commands. No
|
|
7
|
+
* argv, no `process.exit`: commands own parsing, rendering, and exit codes (see the 2026-07-09
|
|
8
|
+
* scripts→Pastel spec).
|
|
9
|
+
*/
|
|
10
|
+
export * from "./generate-country-reference.ts";
|
|
11
|
+
export * from "./generate-official-languages.ts";
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../tools/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,cAAc,iCAAiC,CAAA;AAC/C,cAAc,kCAAkC,CAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
*
|
|
6
|
+
* Codex operator tools — the `run()`-style modules behind `mailwoman dev generate …` commands. No
|
|
7
|
+
* argv, no `process.exit`: commands own parsing, rendering, and exit codes (see the 2026-07-09
|
|
8
|
+
* scripts→Pastel spec).
|
|
9
|
+
*/
|
|
10
|
+
export * from "./generate-country-reference.js";
|
|
11
|
+
export * from "./generate-official-languages.js";
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../tools/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,cAAc,iCAAiC,CAAA;AAC/C,cAAc,kCAAkC,CAAA"}
|
package/out/us/index.d.ts
CHANGED
|
@@ -8,12 +8,12 @@
|
|
|
8
8
|
* (USPS Pub 28 Chapter 7: APO/FPO/DPO + PSC/CMR/UNIT), ZIP codes, and the state abbreviations
|
|
9
9
|
* they hang off of.
|
|
10
10
|
*/
|
|
11
|
-
export * from "./floor-designator.
|
|
12
|
-
export * from "./military-address.
|
|
13
|
-
export * from "./po-box.
|
|
14
|
-
export * from "./state.
|
|
15
|
-
export * from "./street-directional.
|
|
16
|
-
export * from "./street-suffix.
|
|
17
|
-
export * from "./unit-designator.
|
|
18
|
-
export * from "./zipcode.
|
|
11
|
+
export * from "./floor-designator.ts";
|
|
12
|
+
export * from "./military-address.ts";
|
|
13
|
+
export * from "./po-box.ts";
|
|
14
|
+
export * from "./state.ts";
|
|
15
|
+
export * from "./street-directional.ts";
|
|
16
|
+
export * from "./street-suffix.ts";
|
|
17
|
+
export * from "./unit-designator.ts";
|
|
18
|
+
export * from "./zipcode.ts";
|
|
19
19
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -13,16 +13,17 @@
|
|
|
13
13
|
* The 8 directional abbreviations accepted by the USPS. The USPS prefers the abbreviation over the fully-spelled-out
|
|
14
14
|
* name.
|
|
15
15
|
*/
|
|
16
|
-
export declare
|
|
17
|
-
NORTH
|
|
18
|
-
EAST
|
|
19
|
-
SOUTH
|
|
20
|
-
WEST
|
|
21
|
-
NORTHEAST
|
|
22
|
-
NORTHWEST
|
|
23
|
-
SOUTHEAST
|
|
24
|
-
SOUTHWEST
|
|
25
|
-
}
|
|
16
|
+
export declare const DirectionalAbbreviation: {
|
|
17
|
+
readonly NORTH: "N";
|
|
18
|
+
readonly EAST: "E";
|
|
19
|
+
readonly SOUTH: "S";
|
|
20
|
+
readonly WEST: "W";
|
|
21
|
+
readonly NORTHEAST: "NE";
|
|
22
|
+
readonly NORTHWEST: "NW";
|
|
23
|
+
readonly SOUTHEAST: "SE";
|
|
24
|
+
readonly SOUTHWEST: "SW";
|
|
25
|
+
};
|
|
26
|
+
export type DirectionalAbbreviation = (typeof DirectionalAbbreviation)[keyof typeof DirectionalAbbreviation];
|
|
26
27
|
/** The 8 directional names accepted by the USPS (intercardinals spaced, per the publication). */
|
|
27
28
|
export declare const DirectionalNames: readonly ["NORTH", "EAST", "SOUTH", "WEST", "NORTH EAST", "NORTH WEST", "SOUTH EAST", "SOUTH WEST"];
|
|
28
29
|
export type DirectionalName = (typeof DirectionalNames)[number];
|
|
@@ -46,18 +47,18 @@ export type DirectionalAbbreviationRecord = typeof DirectionalAbbreviationRecord
|
|
|
46
47
|
* Name (and its variations) → abbreviation.
|
|
47
48
|
*/
|
|
48
49
|
export declare const DirectionAbbreviationRecord: {
|
|
49
|
-
readonly NORTH:
|
|
50
|
-
readonly EAST:
|
|
51
|
-
readonly SOUTH:
|
|
52
|
-
readonly WEST:
|
|
53
|
-
readonly NORTHEAST:
|
|
54
|
-
readonly NORTHWEST:
|
|
55
|
-
readonly SOUTHEAST:
|
|
56
|
-
readonly SOUTHWEST:
|
|
57
|
-
readonly "NORTH EAST":
|
|
58
|
-
readonly "NORTH WEST":
|
|
59
|
-
readonly "SOUTH EAST":
|
|
60
|
-
readonly "SOUTH WEST":
|
|
50
|
+
readonly NORTH: "N";
|
|
51
|
+
readonly EAST: "E";
|
|
52
|
+
readonly SOUTH: "S";
|
|
53
|
+
readonly WEST: "W";
|
|
54
|
+
readonly NORTHEAST: "NE";
|
|
55
|
+
readonly NORTHWEST: "NW";
|
|
56
|
+
readonly SOUTHEAST: "SE";
|
|
57
|
+
readonly SOUTHWEST: "SW";
|
|
58
|
+
readonly "NORTH EAST": "NE";
|
|
59
|
+
readonly "NORTH WEST": "NW";
|
|
60
|
+
readonly "SOUTH EAST": "SE";
|
|
61
|
+
readonly "SOUTH WEST": "SW";
|
|
61
62
|
};
|
|
62
63
|
export type DirectionAbbreviationRecord = typeof DirectionAbbreviationRecord;
|
|
63
64
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"street-directional.d.ts","sourceRoot":"","sources":["../../us/street-directional.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH;;;GAGG;AACH,
|
|
1
|
+
{"version":3,"file":"street-directional.d.ts","sourceRoot":"","sources":["../../us/street-directional.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH;;;GAGG;AACH,eAAO,MAAM,uBAAuB;;;;;;;;;CAS1B,CAAA;AAEV,MAAM,MAAM,uBAAuB,GAAG,CAAC,OAAO,uBAAuB,CAAC,CAAC,MAAM,OAAO,uBAAuB,CAAC,CAAA;AAE5G,iGAAiG;AACjG,eAAO,MAAM,gBAAgB,qGASS,CAAA;AAEtC,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAA;AAE/D,eAAO,MAAM,yBAAyB,mZA6BA,CAAA;AAEtC,MAAM,MAAM,wBAAwB,GAAG,CAAC,OAAO,yBAAyB,CAAC,CAAC,MAAM,CAAC,CAAA;AAEjF;;GAEG;AACH,eAAO,MAAM,6BAA6B;;;;;;;;;CAS2B,CAAA;AAErE,MAAM,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