@budiauktioner/buildi-primitives 0.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.
- package/CHANGELOG.md +51 -0
- package/LICENSE +21 -0
- package/README.md +253 -0
- package/THIRD_PARTY_NOTICES.md +52 -0
- package/dist/banking/index.cjs +6491 -0
- package/dist/banking/index.cjs.map +1 -0
- package/dist/banking/index.d.cts +58 -0
- package/dist/banking/index.d.ts +58 -0
- package/dist/banking/index.js +6464 -0
- package/dist/banking/index.js.map +1 -0
- package/dist/contact/index.cjs +6678 -0
- package/dist/contact/index.cjs.map +1 -0
- package/dist/contact/index.d.cts +709 -0
- package/dist/contact/index.d.ts +709 -0
- package/dist/contact/index.js +6586 -0
- package/dist/contact/index.js.map +1 -0
- package/dist/country-BhD51LDL.d.cts +433 -0
- package/dist/country-p0n0EVQ9.d.ts +433 -0
- package/dist/finance/index.cjs +3592 -0
- package/dist/finance/index.cjs.map +1 -0
- package/dist/finance/index.d.cts +83 -0
- package/dist/finance/index.d.ts +83 -0
- package/dist/finance/index.js +3584 -0
- package/dist/finance/index.js.map +1 -0
- package/dist/geography/index.cjs +4227 -0
- package/dist/geography/index.cjs.map +1 -0
- package/dist/geography/index.d.cts +34 -0
- package/dist/geography/index.d.ts +34 -0
- package/dist/geography/index.js +4202 -0
- package/dist/geography/index.js.map +1 -0
- package/dist/index.cjs +14087 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +75 -0
- package/dist/index.d.ts +75 -0
- package/dist/index.js +13868 -0
- package/dist/index.js.map +1 -0
- package/dist/isin-EeVPpNWu.d.ts +39 -0
- package/dist/isin-ZlQLBVm8.d.cts +39 -0
- package/dist/organization/index.cjs +2376 -0
- package/dist/organization/index.cjs.map +1 -0
- package/dist/organization/index.d.cts +117 -0
- package/dist/organization/index.d.ts +117 -0
- package/dist/organization/index.js +2346 -0
- package/dist/organization/index.js.map +1 -0
- package/dist/person/index.cjs +1144 -0
- package/dist/person/index.cjs.map +1 -0
- package/dist/person/index.d.cts +60 -0
- package/dist/person/index.d.ts +60 -0
- package/dist/person/index.js +1125 -0
- package/dist/person/index.js.map +1 -0
- package/dist/person-full-name-Cmc9Ynuc.d.cts +82 -0
- package/dist/person-full-name-D6Hbsab6.d.ts +82 -0
- package/dist/phone-number-C24--ggy.d.ts +139 -0
- package/dist/phone-number-DZ-YxCQQ.d.cts +139 -0
- package/dist/property/index.cjs +487 -0
- package/dist/property/index.cjs.map +1 -0
- package/dist/property/index.d.cts +56 -0
- package/dist/property/index.d.ts +56 -0
- package/dist/property/index.js +480 -0
- package/dist/property/index.js.map +1 -0
- package/dist/sample-data/index.cjs +12310 -0
- package/dist/sample-data/index.cjs.map +1 -0
- package/dist/sample-data/index.d.cts +260 -0
- package/dist/sample-data/index.d.ts +260 -0
- package/dist/sample-data/index.js +12302 -0
- package/dist/sample-data/index.js.map +1 -0
- package/dist/swedish-address-DNC3ftRF.d.cts +297 -0
- package/dist/swedish-address-GMzjqgxb.d.ts +297 -0
- package/dist/swedish-bank-account-holder-name-BFJ8h1aO.d.cts +45 -0
- package/dist/swedish-bank-account-holder-name-CAAru07F.d.ts +45 -0
- package/dist/swedish-municipality-DlUS7g7h.d.cts +87 -0
- package/dist/swedish-municipality-nDRHYRAd.d.ts +87 -0
- package/dist/swedish-organization-name-D7NvERxA.d.cts +33 -0
- package/dist/swedish-organization-name-rR0Q836C.d.ts +33 -0
- package/dist/swedish-organization-number-Bcj7V_lh.d.cts +130 -0
- package/dist/swedish-organization-number-DM8dpXwR.d.ts +130 -0
- package/dist/swedish-organization-type-CZOdETwG.d.cts +29 -0
- package/dist/swedish-organization-type-CZOdETwG.d.ts +29 -0
- package/dist/swedish-personal-identity-number-BiIg4io3.d.ts +149 -0
- package/dist/swedish-personal-identity-number-Cp9Coz55.d.cts +149 -0
- package/dist/swedish-property-designation-BM-gdd9x.d.ts +46 -0
- package/dist/swedish-property-designation-BaHXufqV.d.cts +46 -0
- package/dist/swedish-sni-code-Ccsswpni.d.ts +53 -0
- package/dist/swedish-sni-code-CuJFyM6l.d.cts +53 -0
- package/dist/swedish-swish-number-CL6Gx_h3.d.cts +397 -0
- package/dist/swedish-swish-number-DDG3mNDg.d.ts +397 -0
- package/dist/text-candidate-qg2bD9PY.d.cts +110 -0
- package/dist/text-candidate-qg2bD9PY.d.ts +110 -0
- package/dist/text-scanning/index.cjs +10414 -0
- package/dist/text-scanning/index.cjs.map +1 -0
- package/dist/text-scanning/index.d.cts +153 -0
- package/dist/text-scanning/index.d.ts +153 -0
- package/dist/text-scanning/index.js +10406 -0
- package/dist/text-scanning/index.js.map +1 -0
- package/dist/validation/index.cjs +83 -0
- package/dist/validation/index.cjs.map +1 -0
- package/dist/validation/index.d.cts +63 -0
- package/dist/validation/index.d.ts +63 -0
- package/dist/validation/index.js +79 -0
- package/dist/validation/index.js.map +1 -0
- package/dist/web/index.cjs +3994 -0
- package/dist/web/index.cjs.map +1 -0
- package/dist/web/index.d.cts +203 -0
- package/dist/web/index.d.ts +203 -0
- package/dist/web/index.js +3987 -0
- package/dist/web/index.js.map +1 -0
- package/package.json +211 -0
|
@@ -0,0 +1,3584 @@
|
|
|
1
|
+
// src/primitives-defaults.ts
|
|
2
|
+
var DEFAULT_CULTURE = "sv-SE";
|
|
3
|
+
var DEFAULT_UI_CULTURE = "sv-SE";
|
|
4
|
+
var state = {
|
|
5
|
+
culture: DEFAULT_CULTURE,
|
|
6
|
+
uiCulture: DEFAULT_UI_CULTURE};
|
|
7
|
+
var PrimitivesDefaults = {
|
|
8
|
+
/**
|
|
9
|
+
* BCP-47 locale tag used for casing and number formatting.
|
|
10
|
+
* Defaults to `'sv-SE'`.
|
|
11
|
+
*/
|
|
12
|
+
get culture() {
|
|
13
|
+
return state.culture;
|
|
14
|
+
},
|
|
15
|
+
set culture(value) {
|
|
16
|
+
state.culture = value;
|
|
17
|
+
},
|
|
18
|
+
/**
|
|
19
|
+
* `true` when {@link uiCulture} is Swedish (`sv` or `sv-*`).
|
|
20
|
+
* Types use this to select between localized and English display names.
|
|
21
|
+
*/
|
|
22
|
+
get useLocalizedDisplayNames() {
|
|
23
|
+
const lang = state.uiCulture.toLowerCase().split("-")[0];
|
|
24
|
+
return lang === "sv";
|
|
25
|
+
}};
|
|
26
|
+
|
|
27
|
+
// src/internal/input-sanitization.ts
|
|
28
|
+
var FORMAT_OR_NOT_ASSIGNED = /[\p{Cf}\p{Cn}]/u;
|
|
29
|
+
var SPACE_SEPARATOR = /[\p{Zs}\p{Zl}\p{Zp}]/u;
|
|
30
|
+
var CONTROL = /\p{Cc}/u;
|
|
31
|
+
function sanitizeInput(input) {
|
|
32
|
+
let out = "";
|
|
33
|
+
for (const c of input) {
|
|
34
|
+
if (c === "\u2018" || c === "\u2019" || c === "\u201A" || c === "\u201B") {
|
|
35
|
+
out += "'";
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
38
|
+
if (c === "\u201C" || c === "\u201D" || c === "\u201E" || c === "\u201F" || c === "\xAB" || c === "\xBB") {
|
|
39
|
+
out += '"';
|
|
40
|
+
continue;
|
|
41
|
+
}
|
|
42
|
+
if (FORMAT_OR_NOT_ASSIGNED.test(c)) {
|
|
43
|
+
continue;
|
|
44
|
+
}
|
|
45
|
+
if (CONTROL.test(c)) {
|
|
46
|
+
if (c === " " || c === "\n" || c === "\r") out += " ";
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
if (SPACE_SEPARATOR.test(c)) {
|
|
50
|
+
out += " ";
|
|
51
|
+
continue;
|
|
52
|
+
}
|
|
53
|
+
out += c;
|
|
54
|
+
}
|
|
55
|
+
return out;
|
|
56
|
+
}
|
|
57
|
+
function keepAsciiAlphanumericUppercase(input) {
|
|
58
|
+
let out = "";
|
|
59
|
+
for (let i = 0; i < input.length; i++) {
|
|
60
|
+
const c = input.charCodeAt(i);
|
|
61
|
+
if (c >= 48 && c <= 57) out += input[i];
|
|
62
|
+
else if (c >= 65 && c <= 90) out += input[i];
|
|
63
|
+
else if (c >= 97 && c <= 122) out += String.fromCharCode(c - 32);
|
|
64
|
+
}
|
|
65
|
+
return out;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// src/text-scanning/text-candidate-category.ts
|
|
69
|
+
var TextCandidateCategory = {
|
|
70
|
+
Financial: "Financial",
|
|
71
|
+
Geography: "Geography"};
|
|
72
|
+
|
|
73
|
+
// src/text-scanning/text-candidate.ts
|
|
74
|
+
var TextCandidate = class {
|
|
75
|
+
/** Zero-based start position in the scanned text. */
|
|
76
|
+
startIndex;
|
|
77
|
+
/** Number of characters in the original matched span. */
|
|
78
|
+
length;
|
|
79
|
+
/** The raw substring from the input text that was matched. */
|
|
80
|
+
originalText;
|
|
81
|
+
/**
|
|
82
|
+
* Short type name, e.g. `EmailAddress` or `SwedishPersonalIdentityNumber`.
|
|
83
|
+
*/
|
|
84
|
+
typeName;
|
|
85
|
+
/** Broad category of the matched type. */
|
|
86
|
+
category;
|
|
87
|
+
/** Machine-comparable canonical form of the matched value. */
|
|
88
|
+
normalizedForm;
|
|
89
|
+
/** Human-readable display form of the matched value. */
|
|
90
|
+
formattedForm;
|
|
91
|
+
/**
|
|
92
|
+
* Display form with sensitive content masked (e.g. `990807-****`).
|
|
93
|
+
* Produced by the type's `toMaskedString()` helper.
|
|
94
|
+
*/
|
|
95
|
+
maskedForm;
|
|
96
|
+
/** Heuristic confidence level. */
|
|
97
|
+
confidence;
|
|
98
|
+
/** The successfully parsed instance of the matched type. */
|
|
99
|
+
value;
|
|
100
|
+
constructor(opts) {
|
|
101
|
+
this.startIndex = opts.startIndex;
|
|
102
|
+
this.length = opts.length;
|
|
103
|
+
this.originalText = opts.originalText;
|
|
104
|
+
this.typeName = opts.typeName;
|
|
105
|
+
this.category = opts.category;
|
|
106
|
+
this.normalizedForm = opts.normalizedForm;
|
|
107
|
+
this.formattedForm = opts.formattedForm;
|
|
108
|
+
this.maskedForm = opts.maskedForm;
|
|
109
|
+
this.confidence = opts.confidence;
|
|
110
|
+
this.value = opts.value;
|
|
111
|
+
}
|
|
112
|
+
/** Exclusive end position (`startIndex + length`). */
|
|
113
|
+
get endIndex() {
|
|
114
|
+
return this.startIndex + this.length;
|
|
115
|
+
}
|
|
116
|
+
/** Returns `true` if this candidate's span overlaps with `other`. */
|
|
117
|
+
overlaps(other) {
|
|
118
|
+
return this.startIndex < other.endIndex && other.startIndex < this.endIndex;
|
|
119
|
+
}
|
|
120
|
+
/** Returns `true` if this candidate's span fully contains `other`. */
|
|
121
|
+
contains(other) {
|
|
122
|
+
return this.startIndex <= other.startIndex && this.endIndex >= other.endIndex;
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
// src/text-scanning/text-match-confidence.ts
|
|
127
|
+
var TextMatchConfidence = {
|
|
128
|
+
/**
|
|
129
|
+
* Pattern match only. High false-positive risk — the matched text merely
|
|
130
|
+
* fits a syntactic pattern (e.g. a run of digits that happens to be the
|
|
131
|
+
* right length).
|
|
132
|
+
*/
|
|
133
|
+
Low: 0,
|
|
134
|
+
/**
|
|
135
|
+
* Strong match with checksum or format-specific validation (e.g. a personal
|
|
136
|
+
* identity number with a valid Luhn check digit and plausible date, or an
|
|
137
|
+
* IBAN with valid MOD-97).
|
|
138
|
+
*/
|
|
139
|
+
High: 2
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
// src/geography/geo-coordinate.ts
|
|
143
|
+
var GeoCoordinate = class _GeoCoordinate {
|
|
144
|
+
static typeInfo = Object.freeze({
|
|
145
|
+
englishName: "Geographic Coordinate",
|
|
146
|
+
localizedName: "Geografisk koordinat",
|
|
147
|
+
emoji: "\u{1F4CD}",
|
|
148
|
+
sources: Object.freeze([
|
|
149
|
+
"https://en.wikipedia.org/wiki/Geographic_coordinate_system",
|
|
150
|
+
"https://epsg.io/4326"
|
|
151
|
+
])
|
|
152
|
+
});
|
|
153
|
+
latitude;
|
|
154
|
+
longitude;
|
|
155
|
+
constructor(latitude, longitude) {
|
|
156
|
+
this.latitude = latitude;
|
|
157
|
+
this.longitude = longitude;
|
|
158
|
+
}
|
|
159
|
+
/** @internal */
|
|
160
|
+
static _unsafe(latitude, longitude) {
|
|
161
|
+
return new _GeoCoordinate(latitude, longitude);
|
|
162
|
+
}
|
|
163
|
+
get latitudeDirection() {
|
|
164
|
+
return this.latitude >= 0 ? "N" : "S";
|
|
165
|
+
}
|
|
166
|
+
get longitudeDirection() {
|
|
167
|
+
return this.longitude >= 0 ? "E" : "W";
|
|
168
|
+
}
|
|
169
|
+
/** Creates a coordinate from explicit latitude and longitude values. */
|
|
170
|
+
static create(latitude, longitude) {
|
|
171
|
+
if (!Number.isFinite(latitude) || latitude < -90 || latitude > 90) {
|
|
172
|
+
throw new RangeError("Latitude must be between -90 and 90.");
|
|
173
|
+
}
|
|
174
|
+
if (!Number.isFinite(longitude) || longitude < -180 || longitude > 180) {
|
|
175
|
+
throw new RangeError("Longitude must be between -180 and 180.");
|
|
176
|
+
}
|
|
177
|
+
return _GeoCoordinate._unsafe(latitude, longitude);
|
|
178
|
+
}
|
|
179
|
+
static tryParse(input) {
|
|
180
|
+
if (input == null || input.trim() === "") return null;
|
|
181
|
+
const sanitized = sanitizeInput(input).trim();
|
|
182
|
+
if (sanitized.length === 0 || sanitized.length > 200) return null;
|
|
183
|
+
let m;
|
|
184
|
+
m = sanitized.match(DECIMAL_DEGREES);
|
|
185
|
+
if (m) return tryDecimal(m.groups.lat, m.groups.lon);
|
|
186
|
+
m = sanitized.match(SPACE_SEPARATED);
|
|
187
|
+
if (m) return tryDecimal(m.groups.lat, m.groups.lon);
|
|
188
|
+
m = sanitized.match(DECIMAL_CARDINAL_SUFFIX);
|
|
189
|
+
if (m) {
|
|
190
|
+
return tryDecimalCardinal(
|
|
191
|
+
m.groups.lat,
|
|
192
|
+
m.groups.latDir,
|
|
193
|
+
m.groups.lon,
|
|
194
|
+
m.groups.lonDir
|
|
195
|
+
);
|
|
196
|
+
}
|
|
197
|
+
m = sanitized.match(CARDINAL_PREFIX);
|
|
198
|
+
if (m) {
|
|
199
|
+
return tryDecimalCardinal(
|
|
200
|
+
m.groups.lat,
|
|
201
|
+
m.groups.latDir,
|
|
202
|
+
m.groups.lon,
|
|
203
|
+
m.groups.lonDir
|
|
204
|
+
);
|
|
205
|
+
}
|
|
206
|
+
m = sanitized.match(DMS);
|
|
207
|
+
if (m) return tryDms(m.groups);
|
|
208
|
+
m = sanitized.match(DDM);
|
|
209
|
+
if (m) return tryDdm(m.groups);
|
|
210
|
+
return null;
|
|
211
|
+
}
|
|
212
|
+
static parse(input) {
|
|
213
|
+
const r = _GeoCoordinate.tryParse(input);
|
|
214
|
+
if (r === null) throw new Error("Invalid geographic coordinate.");
|
|
215
|
+
return r;
|
|
216
|
+
}
|
|
217
|
+
static isValid(input) {
|
|
218
|
+
return _GeoCoordinate.tryParse(input) !== null;
|
|
219
|
+
}
|
|
220
|
+
static format(input, options) {
|
|
221
|
+
const r = _GeoCoordinate.tryParse(input);
|
|
222
|
+
if (r) return r.toString();
|
|
223
|
+
if (options?.fallbackToTrimmedInputWhenInvalid && input != null && input.trim() !== "") {
|
|
224
|
+
return input.trim();
|
|
225
|
+
}
|
|
226
|
+
return null;
|
|
227
|
+
}
|
|
228
|
+
static normalize(input, options) {
|
|
229
|
+
const r = _GeoCoordinate.tryParse(input);
|
|
230
|
+
if (r) return r.toNormalizedString();
|
|
231
|
+
if (options?.fallbackToTrimmedInputWhenInvalid && input != null) {
|
|
232
|
+
const trimmed = input.trim();
|
|
233
|
+
return trimmed.length > 0 ? trimmed : null;
|
|
234
|
+
}
|
|
235
|
+
return null;
|
|
236
|
+
}
|
|
237
|
+
static isNormalized(input) {
|
|
238
|
+
return input != null && _GeoCoordinate.normalize(input) === input;
|
|
239
|
+
}
|
|
240
|
+
toNormalizedString() {
|
|
241
|
+
return `${formatNumber(this.latitude)}, ${formatNumber(this.longitude)}`;
|
|
242
|
+
}
|
|
243
|
+
toString() {
|
|
244
|
+
return `${formatNumber(Math.abs(this.latitude))}\xB0${this.latitudeDirection}, ${formatNumber(Math.abs(this.longitude))}\xB0${this.longitudeDirection}`;
|
|
245
|
+
}
|
|
246
|
+
/** Returns the coordinate in degrees, minutes, and seconds, e.g. `59°19'45.5"N, 18°4'7"E`. */
|
|
247
|
+
toDmsString() {
|
|
248
|
+
const [latDeg, latMin, latSec] = toDmsParts(Math.abs(this.latitude));
|
|
249
|
+
const [lonDeg, lonMin, lonSec] = toDmsParts(Math.abs(this.longitude));
|
|
250
|
+
return `${latDeg}\xB0${latMin}'${formatSeconds(latSec)}"${this.latitudeDirection}, ${lonDeg}\xB0${lonMin}'${formatSeconds(lonSec)}"${this.longitudeDirection}`;
|
|
251
|
+
}
|
|
252
|
+
/** Distance in kilometers (Haversine) between two coordinates. */
|
|
253
|
+
static distanceKilometers(a, b) {
|
|
254
|
+
return haversineKm(a, b);
|
|
255
|
+
}
|
|
256
|
+
/** Returns true if coordinates `a` and `b` are within `radiusKm` kilometers of each other. */
|
|
257
|
+
static isWithinKilometers(a, b, radiusKm) {
|
|
258
|
+
return _GeoCoordinate.distanceKilometers(a, b) <= radiusKm;
|
|
259
|
+
}
|
|
260
|
+
/** Distance in kilometers from this coordinate to `other`. */
|
|
261
|
+
distanceKilometersTo(other) {
|
|
262
|
+
return haversineKm(this, other);
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* Returns true if `other` is within `radiusKm` kilometers of this
|
|
266
|
+
* coordinate (inclusive).
|
|
267
|
+
*/
|
|
268
|
+
isWithinKilometers(other, radiusKm) {
|
|
269
|
+
return this.distanceKilometersTo(other) <= radiusKm;
|
|
270
|
+
}
|
|
271
|
+
equals(other) {
|
|
272
|
+
return other != null && this.latitude === other.latitude && this.longitude === other.longitude;
|
|
273
|
+
}
|
|
274
|
+
};
|
|
275
|
+
var DECIMAL_DEGREES = /^\s*\(?\s*(?<lat>[+-]?\d+(?:\.\d+)?)\s*[,;]\s*(?<lon>[+-]?\d+(?:\.\d+)?)\s*\)?\s*$/;
|
|
276
|
+
var SPACE_SEPARATED = /^\s*\(?\s*(?<lat>[+-]?\d+(?:\.\d+)?)\s+(?<lon>[+-]?\d+(?:\.\d+)?)\s*\)?\s*$/;
|
|
277
|
+
var DECIMAL_CARDINAL_SUFFIX = /^\s*\(?\s*(?<lat>\d+(?:\.\d+)?)\s*°?\s*(?<latDir>[NSns])\s*[,;\s]\s*(?<lon>\d+(?:\.\d+)?)\s*°?\s*(?<lonDir>[EWewÖöVv])\s*\)?\s*$/u;
|
|
278
|
+
var CARDINAL_PREFIX = /^\s*\(?\s*(?<latDir>[NSns])\s*(?<lat>\d+(?:\.\d+)?)\s*°?\s*[,;\s]\s*(?<lonDir>[EWewÖöVv])\s*(?<lon>\d+(?:\.\d+)?)\s*°?\s*\)?\s*$/u;
|
|
279
|
+
var DMS = /^\s*\(?\s*(?<latDeg>\d+)\s*°\s*(?<latMin>\d+)\s*[′']\s*(?<latSec>\d+(?:\.\d+)?)\s*[″"]\s*(?<latDir>[NSns])\s*[,;\s]\s*(?<lonDeg>\d+)\s*°\s*(?<lonMin>\d+)\s*[′']\s*(?<lonSec>\d+(?:\.\d+)?)\s*[″"]\s*(?<lonDir>[EWewÖöVv])\s*\)?\s*$/u;
|
|
280
|
+
var DDM = /^\s*\(?\s*(?<latDeg>\d+)\s*°\s*(?<latDecMin>\d+(?:\.\d+)?)\s*[′']\s*(?<latDir>[NSns])\s*[,;\s]\s*(?<lonDeg>\d+)\s*°\s*(?<lonDecMin>\d+(?:\.\d+)?)\s*[′']\s*(?<lonDir>[EWewÖöVv])\s*\)?\s*$/u;
|
|
281
|
+
function tryDecimal(latStr, lonStr) {
|
|
282
|
+
const lat = parseFloat(latStr);
|
|
283
|
+
const lon = parseFloat(lonStr);
|
|
284
|
+
if (!Number.isFinite(lat) || !Number.isFinite(lon)) return null;
|
|
285
|
+
if (!isInRange(lat, lon)) return null;
|
|
286
|
+
return GeoCoordinate._unsafe(lat, lon);
|
|
287
|
+
}
|
|
288
|
+
function tryDecimalCardinal(latStr, latDir, lonStr, lonDir) {
|
|
289
|
+
const lat = applyLatDirection(parseFloat(latStr), latDir);
|
|
290
|
+
const lon = applyLonDirection(parseFloat(lonStr), lonDir);
|
|
291
|
+
if (!Number.isFinite(lat) || !Number.isFinite(lon)) return null;
|
|
292
|
+
if (!isInRange(lat, lon)) return null;
|
|
293
|
+
return GeoCoordinate._unsafe(lat, lon);
|
|
294
|
+
}
|
|
295
|
+
function tryDms(g) {
|
|
296
|
+
const latDeg = parseFloat(g.latDeg);
|
|
297
|
+
const latMin = parseFloat(g.latMin);
|
|
298
|
+
const latSec = parseFloat(g.latSec);
|
|
299
|
+
const lonDeg = parseFloat(g.lonDeg);
|
|
300
|
+
const lonMin = parseFloat(g.lonMin);
|
|
301
|
+
const lonSec = parseFloat(g.lonSec);
|
|
302
|
+
if (latMin >= 60 || latSec >= 60 || lonMin >= 60 || lonSec >= 60) return null;
|
|
303
|
+
let lat = round8(latDeg + latMin / 60 + latSec / 3600);
|
|
304
|
+
let lon = round8(lonDeg + lonMin / 60 + lonSec / 3600);
|
|
305
|
+
lat = applyLatDirection(lat, g.latDir);
|
|
306
|
+
lon = applyLonDirection(lon, g.lonDir);
|
|
307
|
+
if (!isInRange(lat, lon)) return null;
|
|
308
|
+
return GeoCoordinate._unsafe(lat, lon);
|
|
309
|
+
}
|
|
310
|
+
function tryDdm(g) {
|
|
311
|
+
const latDeg = parseFloat(g.latDeg);
|
|
312
|
+
const latDecMin = parseFloat(g.latDecMin);
|
|
313
|
+
const lonDeg = parseFloat(g.lonDeg);
|
|
314
|
+
const lonDecMin = parseFloat(g.lonDecMin);
|
|
315
|
+
if (latDecMin >= 60 || lonDecMin >= 60) return null;
|
|
316
|
+
let lat = round8(latDeg + latDecMin / 60);
|
|
317
|
+
let lon = round8(lonDeg + lonDecMin / 60);
|
|
318
|
+
lat = applyLatDirection(lat, g.latDir);
|
|
319
|
+
lon = applyLonDirection(lon, g.lonDir);
|
|
320
|
+
if (!isInRange(lat, lon)) return null;
|
|
321
|
+
return GeoCoordinate._unsafe(lat, lon);
|
|
322
|
+
}
|
|
323
|
+
function applyLatDirection(lat, dir) {
|
|
324
|
+
return dir.toUpperCase() === "S" ? -lat : lat;
|
|
325
|
+
}
|
|
326
|
+
function applyLonDirection(lon, dir) {
|
|
327
|
+
const u = dir.toUpperCase();
|
|
328
|
+
return u === "W" || u === "V" ? -lon : lon;
|
|
329
|
+
}
|
|
330
|
+
function isInRange(lat, lon) {
|
|
331
|
+
return lat >= -90 && lat <= 90 && lon >= -180 && lon <= 180;
|
|
332
|
+
}
|
|
333
|
+
function round8(v) {
|
|
334
|
+
return Math.round(v * 1e8) / 1e8;
|
|
335
|
+
}
|
|
336
|
+
function toDmsParts(dd) {
|
|
337
|
+
const degrees = Math.trunc(dd);
|
|
338
|
+
const fracMinutes = (dd - degrees) * 60;
|
|
339
|
+
const minutes = Math.trunc(fracMinutes);
|
|
340
|
+
const seconds = Math.round((fracMinutes - minutes) * 600) / 10;
|
|
341
|
+
return [degrees, minutes, seconds];
|
|
342
|
+
}
|
|
343
|
+
function formatNumber(value) {
|
|
344
|
+
return value.toString();
|
|
345
|
+
}
|
|
346
|
+
function formatSeconds(seconds) {
|
|
347
|
+
if (Number.isInteger(seconds)) return seconds.toString();
|
|
348
|
+
return seconds.toString().replace(/(\.\d*?)0+$/, "$1");
|
|
349
|
+
}
|
|
350
|
+
function haversineKm(a, b) {
|
|
351
|
+
const R = 6371;
|
|
352
|
+
const dLat = toRadians(b.latitude - a.latitude);
|
|
353
|
+
const dLon = toRadians(b.longitude - a.longitude);
|
|
354
|
+
const lat1 = toRadians(a.latitude);
|
|
355
|
+
const lat2 = toRadians(b.latitude);
|
|
356
|
+
const h = Math.sin(dLat / 2) ** 2 + Math.cos(lat1) * Math.cos(lat2) * Math.sin(dLon / 2) ** 2;
|
|
357
|
+
return R * 2 * Math.atan2(Math.sqrt(h), Math.sqrt(1 - h));
|
|
358
|
+
}
|
|
359
|
+
function toRadians(degrees) {
|
|
360
|
+
return degrees * (Math.PI / 180);
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
// src/geography/language.ts
|
|
364
|
+
var TextDirection = {
|
|
365
|
+
LeftToRight: "LeftToRight",
|
|
366
|
+
RightToLeft: "RightToLeft"
|
|
367
|
+
};
|
|
368
|
+
var WritingScript = {
|
|
369
|
+
Unknown: "Unknown",
|
|
370
|
+
Latin: "Latin",
|
|
371
|
+
Cyrillic: "Cyrillic",
|
|
372
|
+
Arabic: "Arabic",
|
|
373
|
+
Greek: "Greek",
|
|
374
|
+
Hebrew: "Hebrew",
|
|
375
|
+
Devanagari: "Devanagari",
|
|
376
|
+
Bengali: "Bengali",
|
|
377
|
+
Gurmukhi: "Gurmukhi",
|
|
378
|
+
Gujarati: "Gujarati",
|
|
379
|
+
Oriya: "Oriya",
|
|
380
|
+
Tamil: "Tamil",
|
|
381
|
+
Telugu: "Telugu",
|
|
382
|
+
Kannada: "Kannada",
|
|
383
|
+
Malayalam: "Malayalam",
|
|
384
|
+
Sinhala: "Sinhala",
|
|
385
|
+
Thai: "Thai",
|
|
386
|
+
Lao: "Lao",
|
|
387
|
+
Tibetan: "Tibetan",
|
|
388
|
+
Myanmar: "Myanmar",
|
|
389
|
+
Georgian: "Georgian",
|
|
390
|
+
Hangul: "Hangul",
|
|
391
|
+
Ethiopic: "Ethiopic",
|
|
392
|
+
Canadian: "Canadian",
|
|
393
|
+
Khmer: "Khmer",
|
|
394
|
+
Han: "Han",
|
|
395
|
+
Armenian: "Armenian",
|
|
396
|
+
Thaana: "Thaana"
|
|
397
|
+
};
|
|
398
|
+
var MAX_INPUT_LENGTH = 100;
|
|
399
|
+
var Language = class _Language {
|
|
400
|
+
static typeInfo = Object.freeze({
|
|
401
|
+
englishName: "Language",
|
|
402
|
+
localizedName: "Spr\xE5k",
|
|
403
|
+
emoji: "\u{1F5E3}\uFE0F",
|
|
404
|
+
sources: Object.freeze([
|
|
405
|
+
"https://www.loc.gov/standards/iso639-2/php/code_list.php",
|
|
406
|
+
"https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes",
|
|
407
|
+
"https://iso639-3.sil.org/"
|
|
408
|
+
])
|
|
409
|
+
});
|
|
410
|
+
alpha2Code;
|
|
411
|
+
alpha3Code;
|
|
412
|
+
englishName;
|
|
413
|
+
localizedName;
|
|
414
|
+
nativeName;
|
|
415
|
+
script;
|
|
416
|
+
direction;
|
|
417
|
+
constructor(alpha2, alpha3, en, sv, native, script, direction) {
|
|
418
|
+
this.alpha2Code = alpha2;
|
|
419
|
+
this.alpha3Code = alpha3;
|
|
420
|
+
this.englishName = en;
|
|
421
|
+
this.localizedName = sv;
|
|
422
|
+
this.nativeName = native;
|
|
423
|
+
this.script = script;
|
|
424
|
+
this.direction = direction;
|
|
425
|
+
}
|
|
426
|
+
get displayName() {
|
|
427
|
+
return PrimitivesDefaults.useLocalizedDisplayNames ? this.localizedName : this.englishName;
|
|
428
|
+
}
|
|
429
|
+
get value() {
|
|
430
|
+
return this.alpha2Code;
|
|
431
|
+
}
|
|
432
|
+
/** @internal Used by Country and other types. */
|
|
433
|
+
static _create(alpha2, alpha3, en, sv, native, script, direction = TextDirection.LeftToRight) {
|
|
434
|
+
return new _Language(alpha2, alpha3, en, sv, native, script, direction);
|
|
435
|
+
}
|
|
436
|
+
static tryParse(input) {
|
|
437
|
+
if (input == null || input.trim() === "") return null;
|
|
438
|
+
const trimmed = sanitizeInput(input).trim();
|
|
439
|
+
if (trimmed.length === 0 || trimmed.length > MAX_INPUT_LENGTH) return null;
|
|
440
|
+
const lower = trimmed.toLowerCase();
|
|
441
|
+
return BY_KEY.get(lower) ?? null;
|
|
442
|
+
}
|
|
443
|
+
static parse(input) {
|
|
444
|
+
const r = _Language.tryParse(input);
|
|
445
|
+
if (r === null) throw new Error("Unknown language.");
|
|
446
|
+
return r;
|
|
447
|
+
}
|
|
448
|
+
static isValid(input) {
|
|
449
|
+
return _Language.tryParse(input) !== null;
|
|
450
|
+
}
|
|
451
|
+
static format(input, options) {
|
|
452
|
+
const r = _Language.tryParse(input);
|
|
453
|
+
if (r) return r.displayName;
|
|
454
|
+
if (options?.fallbackToTrimmedInputWhenInvalid && input != null && input.trim() !== "") {
|
|
455
|
+
return input.trim();
|
|
456
|
+
}
|
|
457
|
+
return null;
|
|
458
|
+
}
|
|
459
|
+
static normalize(input, options) {
|
|
460
|
+
const r = _Language.tryParse(input);
|
|
461
|
+
if (r) return r.alpha2Code;
|
|
462
|
+
if (options?.fallbackToTrimmedInputWhenInvalid && input != null) {
|
|
463
|
+
const trimmed = input.trim();
|
|
464
|
+
return trimmed.length > 0 ? trimmed : null;
|
|
465
|
+
}
|
|
466
|
+
return null;
|
|
467
|
+
}
|
|
468
|
+
static isNormalized(input) {
|
|
469
|
+
return input != null && _Language.normalize(input) === input;
|
|
470
|
+
}
|
|
471
|
+
toNormalizedString() {
|
|
472
|
+
return this.alpha2Code;
|
|
473
|
+
}
|
|
474
|
+
toDisplayString() {
|
|
475
|
+
return this.displayName;
|
|
476
|
+
}
|
|
477
|
+
toEnglishString() {
|
|
478
|
+
return this.englishName;
|
|
479
|
+
}
|
|
480
|
+
toNativeString() {
|
|
481
|
+
return this.nativeName;
|
|
482
|
+
}
|
|
483
|
+
toString() {
|
|
484
|
+
return this.displayName;
|
|
485
|
+
}
|
|
486
|
+
equals(other) {
|
|
487
|
+
return other != null && this.alpha2Code === other.alpha2Code;
|
|
488
|
+
}
|
|
489
|
+
compareTo(other) {
|
|
490
|
+
if (other == null) return 1;
|
|
491
|
+
return this.alpha2Code < other.alpha2Code ? -1 : this.alpha2Code > other.alpha2Code ? 1 : 0;
|
|
492
|
+
}
|
|
493
|
+
/** All recognized ISO 639-1 languages. */
|
|
494
|
+
static get all() {
|
|
495
|
+
return ALL;
|
|
496
|
+
}
|
|
497
|
+
// Frequently used language constants — populated below ALL.
|
|
498
|
+
static Afrikaans;
|
|
499
|
+
static Albanian;
|
|
500
|
+
static Arabic;
|
|
501
|
+
static Bulgarian;
|
|
502
|
+
static Catalan;
|
|
503
|
+
static Chinese;
|
|
504
|
+
static Croatian;
|
|
505
|
+
static Czech;
|
|
506
|
+
static Danish;
|
|
507
|
+
static Dutch;
|
|
508
|
+
static English;
|
|
509
|
+
static Estonian;
|
|
510
|
+
static Faroese;
|
|
511
|
+
static Finnish;
|
|
512
|
+
static French;
|
|
513
|
+
static German;
|
|
514
|
+
static Greek;
|
|
515
|
+
static Hindi;
|
|
516
|
+
static Hungarian;
|
|
517
|
+
static Icelandic;
|
|
518
|
+
static Italian;
|
|
519
|
+
static Japanese;
|
|
520
|
+
static Korean;
|
|
521
|
+
static Latvian;
|
|
522
|
+
static Lithuanian;
|
|
523
|
+
static NorthernSami;
|
|
524
|
+
static Norwegian;
|
|
525
|
+
static NorwegianBokmal;
|
|
526
|
+
static NorwegianNynorsk;
|
|
527
|
+
static Polish;
|
|
528
|
+
static Portuguese;
|
|
529
|
+
static Romanian;
|
|
530
|
+
static Russian;
|
|
531
|
+
static Slovak;
|
|
532
|
+
static Slovenian;
|
|
533
|
+
static Spanish;
|
|
534
|
+
static Swahili;
|
|
535
|
+
static Swedish;
|
|
536
|
+
static Turkish;
|
|
537
|
+
static Ukrainian;
|
|
538
|
+
};
|
|
539
|
+
var L = Language._create;
|
|
540
|
+
var ALL = Object.freeze([
|
|
541
|
+
L("aa", "aar", "Afar", "Afar", "Afaraf", WritingScript.Latin),
|
|
542
|
+
L("ab", "abk", "Abkhazian", "Abchaziska", "\u0410\u04A7\u0441\u0443\u0430", WritingScript.Cyrillic),
|
|
543
|
+
L("af", "afr", "Afrikaans", "Afrikaans", "Afrikaans", WritingScript.Latin),
|
|
544
|
+
L("ak", "aka", "Akan", "Akan", "Akan", WritingScript.Latin),
|
|
545
|
+
L("am", "amh", "Amharic", "Amhariska", "\u12A0\u121B\u122D\u129B", WritingScript.Ethiopic),
|
|
546
|
+
L("an", "arg", "Aragonese", "Aragonesiska", "Aragon\xE9s", WritingScript.Latin),
|
|
547
|
+
L("ar", "ara", "Arabic", "Arabiska", "\u0627\u0644\u0639\u0631\u0628\u064A\u0629", WritingScript.Arabic, TextDirection.RightToLeft),
|
|
548
|
+
L("as", "asm", "Assamese", "Assamesiska", "\u0985\u09B8\u09AE\u09C0\u09AF\u09BC\u09BE", WritingScript.Bengali),
|
|
549
|
+
L("av", "ava", "Avaric", "Avariska", "\u0410\u0432\u0430\u0440", WritingScript.Cyrillic),
|
|
550
|
+
L("ay", "aym", "Aymara", "Aymara", "Aymar", WritingScript.Latin),
|
|
551
|
+
L("az", "aze", "Azerbaijani", "Azerbajdzjanska", "Az\u0259rbaycan", WritingScript.Latin),
|
|
552
|
+
L("ba", "bak", "Bashkir", "Basjkiriska", "\u0411\u0430\u0448\u04A1\u043E\u0440\u0442", WritingScript.Cyrillic),
|
|
553
|
+
L("be", "bel", "Belarusian", "Vitryska", "\u0411\u0435\u043B\u0430\u0440\u0443\u0441\u043A\u0430\u044F", WritingScript.Cyrillic),
|
|
554
|
+
L("bg", "bul", "Bulgarian", "Bulgariska", "\u0411\u044A\u043B\u0433\u0430\u0440\u0441\u043A\u0438", WritingScript.Cyrillic),
|
|
555
|
+
L("bh", "bih", "Bihari", "Bihari", "\u092D\u094B\u091C\u092A\u0941\u0930\u0940", WritingScript.Devanagari),
|
|
556
|
+
L("bi", "bis", "Bislama", "Bislama", "Bislama", WritingScript.Latin),
|
|
557
|
+
L("bm", "bam", "Bambara", "Bambara", "Bamanankan", WritingScript.Latin),
|
|
558
|
+
L("bn", "ben", "Bengali", "Bengali", "\u09AC\u09BE\u0982\u09B2\u09BE", WritingScript.Bengali),
|
|
559
|
+
L("bo", "bod", "Tibetan", "Tibetanska", "\u0F56\u0F7C\u0F51\u0F0B\u0F61\u0F72\u0F42", WritingScript.Tibetan),
|
|
560
|
+
L("br", "bre", "Breton", "Bretonska", "Brezhoneg", WritingScript.Latin),
|
|
561
|
+
L("bs", "bos", "Bosnian", "Bosniska", "Bosanski", WritingScript.Latin),
|
|
562
|
+
L("ca", "cat", "Catalan", "Katalanska", "Catal\xE0", WritingScript.Latin),
|
|
563
|
+
L("ce", "che", "Chechen", "Tjetjenska", "\u041D\u043E\u0445\u0447\u0438\u0439\u043D", WritingScript.Cyrillic),
|
|
564
|
+
L("ch", "cha", "Chamorro", "Chamorro", "Chamoru", WritingScript.Latin),
|
|
565
|
+
L("co", "cos", "Corsican", "Korsikanska", "Corsu", WritingScript.Latin),
|
|
566
|
+
L("cr", "cre", "Cree", "Cree", "\u14C0\u1426\u1403\u152D\u140D\u140F\u1423", WritingScript.Canadian),
|
|
567
|
+
L("cs", "ces", "Czech", "Tjeckiska", "\u010Ce\u0161tina", WritingScript.Latin),
|
|
568
|
+
L("cu", "chu", "Church Slavonic", "Kyrkoslaviska", "\u0421\u043B\u043E\u0432\u0463\u043D\u044C\u0441\u043A\u044A", WritingScript.Cyrillic),
|
|
569
|
+
L("cv", "chv", "Chuvash", "Tjuvasjiska", "\u0427\u04D1\u0432\u0430\u0448", WritingScript.Cyrillic),
|
|
570
|
+
L("cy", "cym", "Welsh", "Walesiska", "Cymraeg", WritingScript.Latin),
|
|
571
|
+
L("da", "dan", "Danish", "Danska", "Dansk", WritingScript.Latin),
|
|
572
|
+
L("de", "deu", "German", "Tyska", "Deutsch", WritingScript.Latin),
|
|
573
|
+
L("dv", "div", "Divehi", "Divehi", "\u078B\u07A8\u0788\u07AC\u0780\u07A8", WritingScript.Thaana, TextDirection.RightToLeft),
|
|
574
|
+
L("dz", "dzo", "Dzongkha", "Dzongkha", "\u0F62\u0FAB\u0F7C\u0F44\u0F0B\u0F41", WritingScript.Tibetan),
|
|
575
|
+
L("ee", "ewe", "Ewe", "Ewe", "E\u028Begbe", WritingScript.Latin),
|
|
576
|
+
L("el", "ell", "Greek", "Grekiska", "\u0395\u03BB\u03BB\u03B7\u03BD\u03B9\u03BA\u03AC", WritingScript.Greek),
|
|
577
|
+
L("en", "eng", "English", "Engelska", "English", WritingScript.Latin),
|
|
578
|
+
L("eo", "epo", "Esperanto", "Esperanto", "Esperanto", WritingScript.Latin),
|
|
579
|
+
L("es", "spa", "Spanish", "Spanska", "Espa\xF1ol", WritingScript.Latin),
|
|
580
|
+
L("et", "est", "Estonian", "Estniska", "Eesti", WritingScript.Latin),
|
|
581
|
+
L("eu", "eus", "Basque", "Baskiska", "Euskara", WritingScript.Latin),
|
|
582
|
+
L("fa", "fas", "Persian", "Persiska", "\u0641\u0627\u0631\u0633\u06CC", WritingScript.Arabic, TextDirection.RightToLeft),
|
|
583
|
+
L("ff", "ful", "Fulah", "Fulani", "Fulfulde", WritingScript.Latin),
|
|
584
|
+
L("fi", "fin", "Finnish", "Finska", "Suomi", WritingScript.Latin),
|
|
585
|
+
L("fj", "fij", "Fijian", "Fijianska", "Vosa Vakaviti", WritingScript.Latin),
|
|
586
|
+
L("fo", "fao", "Faroese", "F\xE4r\xF6iska", "F\xF8royskt", WritingScript.Latin),
|
|
587
|
+
L("fr", "fra", "French", "Franska", "Fran\xE7ais", WritingScript.Latin),
|
|
588
|
+
L("fy", "fry", "Western Frisian", "Frisiska", "Frysk", WritingScript.Latin),
|
|
589
|
+
L("ga", "gle", "Irish", "Iriska", "Gaeilge", WritingScript.Latin),
|
|
590
|
+
L("gd", "gla", "Scottish Gaelic", "Skotsk gaeliska", "G\xE0idhlig", WritingScript.Latin),
|
|
591
|
+
L("gl", "glg", "Galician", "Galiciska", "Galego", WritingScript.Latin),
|
|
592
|
+
L("gn", "grn", "Guarani", "Guaran\xED", "Ava\xF1e'\u1EBD", WritingScript.Latin),
|
|
593
|
+
L("gu", "guj", "Gujarati", "Gujarati", "\u0A97\u0AC1\u0A9C\u0AB0\u0ABE\u0AA4\u0AC0", WritingScript.Gujarati),
|
|
594
|
+
L("gv", "glv", "Manx", "Manx", "Gaelg", WritingScript.Latin),
|
|
595
|
+
L("ha", "hau", "Hausa", "Hausa", "Hausa", WritingScript.Latin),
|
|
596
|
+
L("he", "heb", "Hebrew", "Hebreiska", "\u05E2\u05D1\u05E8\u05D9\u05EA", WritingScript.Hebrew, TextDirection.RightToLeft),
|
|
597
|
+
L("hi", "hin", "Hindi", "Hindi", "\u0939\u093F\u0928\u094D\u0926\u0940", WritingScript.Devanagari),
|
|
598
|
+
L("ho", "hmo", "Hiri Motu", "Hiri Motu", "Hiri Motu", WritingScript.Latin),
|
|
599
|
+
L("hr", "hrv", "Croatian", "Kroatiska", "Hrvatski", WritingScript.Latin),
|
|
600
|
+
L("ht", "hat", "Haitian Creole", "Haitisk kreol", "Krey\xF2l Ayisyen", WritingScript.Latin),
|
|
601
|
+
L("hu", "hun", "Hungarian", "Ungerska", "Magyar", WritingScript.Latin),
|
|
602
|
+
L("hy", "hye", "Armenian", "Armeniska", "\u0540\u0561\u0575\u0565\u0580\u0565\u0576", WritingScript.Armenian),
|
|
603
|
+
L("ia", "ina", "Interlingua", "Interlingua", "Interlingua", WritingScript.Latin),
|
|
604
|
+
L("id", "ind", "Indonesian", "Indonesiska", "Bahasa Indonesia", WritingScript.Latin),
|
|
605
|
+
L("ie", "ile", "Interlingue", "Interlingue", "Interlingue", WritingScript.Latin),
|
|
606
|
+
L("ig", "ibo", "Igbo", "Igbo", "Igbo", WritingScript.Latin),
|
|
607
|
+
L("ii", "iii", "Sichuan Yi", "Yi", "\uA188\uA320\uA4A1", WritingScript.Unknown),
|
|
608
|
+
L("ik", "ipk", "Inupiaq", "Inupiaq", "I\xF1upiaq", WritingScript.Latin),
|
|
609
|
+
L("io", "ido", "Ido", "Ido", "Ido", WritingScript.Latin),
|
|
610
|
+
L("is", "isl", "Icelandic", "Isl\xE4ndska", "\xCDslenska", WritingScript.Latin),
|
|
611
|
+
L("it", "ita", "Italian", "Italienska", "Italiano", WritingScript.Latin),
|
|
612
|
+
L("iu", "iku", "Inuktitut", "Inuktitut", "\u1403\u14C4\u1483\u144E\u1450\u1466", WritingScript.Canadian),
|
|
613
|
+
L("ja", "jpn", "Japanese", "Japanska", "\u65E5\u672C\u8A9E", WritingScript.Han),
|
|
614
|
+
L("jv", "jav", "Javanese", "Javanesiska", "Basa Jawa", WritingScript.Latin),
|
|
615
|
+
L("ka", "kat", "Georgian", "Georgiska", "\u10E5\u10D0\u10E0\u10D7\u10E3\u10DA\u10D8", WritingScript.Georgian),
|
|
616
|
+
L("kg", "kon", "Kongo", "Kikongo", "KiKongo", WritingScript.Latin),
|
|
617
|
+
L("ki", "kik", "Kikuyu", "Kikuyu", "G\u0129k\u0169y\u0169", WritingScript.Latin),
|
|
618
|
+
L("kj", "kua", "Kuanyama", "Kuanyama", "Kuanyama", WritingScript.Latin),
|
|
619
|
+
L("kk", "kaz", "Kazakh", "Kazakiska", "\u049A\u0430\u0437\u0430\u049B\u0448\u0430", WritingScript.Cyrillic),
|
|
620
|
+
L("kl", "kal", "Kalaallisut", "Gr\xF6nl\xE4ndska", "Kalaallisut", WritingScript.Latin),
|
|
621
|
+
L("km", "khm", "Khmer", "Khmer", "\u1797\u17B6\u179F\u17B6\u1781\u17D2\u1798\u17C2\u179A", WritingScript.Khmer),
|
|
622
|
+
L("kn", "kan", "Kannada", "Kannada", "\u0C95\u0CA8\u0CCD\u0CA8\u0CA1", WritingScript.Kannada),
|
|
623
|
+
L("ko", "kor", "Korean", "Koreanska", "\uD55C\uAD6D\uC5B4", WritingScript.Hangul),
|
|
624
|
+
L("kr", "kau", "Kanuri", "Kanuri", "Kanuri", WritingScript.Latin),
|
|
625
|
+
L(
|
|
626
|
+
"ks",
|
|
627
|
+
"kas",
|
|
628
|
+
"Kashmiri",
|
|
629
|
+
"Kashmiri",
|
|
630
|
+
"\u0915\u0936\u094D\u092E\u0940\u0930\u0940",
|
|
631
|
+
WritingScript.Arabic,
|
|
632
|
+
TextDirection.RightToLeft
|
|
633
|
+
),
|
|
634
|
+
L("ku", "kur", "Kurdish", "Kurdiska", "Kurd\xEE", WritingScript.Latin),
|
|
635
|
+
L("kv", "kom", "Komi", "Komi", "\u041A\u043E\u043C\u0438", WritingScript.Cyrillic),
|
|
636
|
+
L("kw", "cor", "Cornish", "Korniska", "Kernewek", WritingScript.Latin),
|
|
637
|
+
L("ky", "kir", "Kyrgyz", "Kirgiziska", "\u041A\u044B\u0440\u0433\u044B\u0437\u0447\u0430", WritingScript.Cyrillic),
|
|
638
|
+
L("la", "lat", "Latin", "Latin", "Latina", WritingScript.Latin),
|
|
639
|
+
L("lb", "ltz", "Luxembourgish", "Luxemburgiska", "L\xEBtzebuergesch", WritingScript.Latin),
|
|
640
|
+
L("lg", "lug", "Ganda", "Luganda", "Luganda", WritingScript.Latin),
|
|
641
|
+
L("li", "lim", "Limburgish", "Limburgiska", "Limburgs", WritingScript.Latin),
|
|
642
|
+
L("ln", "lin", "Lingala", "Lingala", "Ling\xE1la", WritingScript.Latin),
|
|
643
|
+
L("lo", "lao", "Lao", "Laotiska", "\u0E9E\u0EB2\u0EAA\u0EB2\u0EA5\u0EB2\u0EA7", WritingScript.Lao),
|
|
644
|
+
L("lt", "lit", "Lithuanian", "Litauiska", "Lietuvi\u0173", WritingScript.Latin),
|
|
645
|
+
L("lu", "lub", "Luba-Katanga", "Luba-Katanga", "Kiluba", WritingScript.Latin),
|
|
646
|
+
L("lv", "lav", "Latvian", "Lettiska", "Latvie\u0161u", WritingScript.Latin),
|
|
647
|
+
L("mg", "mlg", "Malagasy", "Malagassiska", "Malagasy", WritingScript.Latin),
|
|
648
|
+
L("mh", "mah", "Marshallese", "Marshallesiska", "Kajin M\u0327aje\u013C", WritingScript.Latin),
|
|
649
|
+
L("mi", "mri", "Maori", "Maori", "Te Reo M\u0101ori", WritingScript.Latin),
|
|
650
|
+
L("mk", "mkd", "Macedonian", "Makedonska", "\u041C\u0430\u043A\u0435\u0434\u043E\u043D\u0441\u043A\u0438", WritingScript.Cyrillic),
|
|
651
|
+
L("ml", "mal", "Malayalam", "Malayalam", "\u0D2E\u0D32\u0D2F\u0D3E\u0D33\u0D02", WritingScript.Malayalam),
|
|
652
|
+
L("mn", "mon", "Mongolian", "Mongoliska", "\u041C\u043E\u043D\u0433\u043E\u043B", WritingScript.Cyrillic),
|
|
653
|
+
L("mr", "mar", "Marathi", "Marathi", "\u092E\u0930\u093E\u0920\u0940", WritingScript.Devanagari),
|
|
654
|
+
L("ms", "msa", "Malay", "Malajiska", "Bahasa Melayu", WritingScript.Latin),
|
|
655
|
+
L("mt", "mlt", "Maltese", "Maltesiska", "Malti", WritingScript.Latin),
|
|
656
|
+
L("my", "mya", "Burmese", "Burmesiska", "\u1019\u103C\u1014\u103A\u1019\u102C\u1005\u102C", WritingScript.Myanmar),
|
|
657
|
+
L("na", "nau", "Nauru", "Nauru", "Dorerin Naoero", WritingScript.Latin),
|
|
658
|
+
L("nb", "nob", "Norwegian Bokm\xE5l", "Norska (bokm\xE5l)", "Norsk bokm\xE5l", WritingScript.Latin),
|
|
659
|
+
L("nd", "nde", "Northern Ndebele", "Nordndebele", "isiNdebele", WritingScript.Latin),
|
|
660
|
+
L("ne", "nep", "Nepali", "Nepalesiska", "\u0928\u0947\u092A\u093E\u0932\u0940", WritingScript.Devanagari),
|
|
661
|
+
L("ng", "ndo", "Ndonga", "Ndonga", "Owambo", WritingScript.Latin),
|
|
662
|
+
L("nl", "nld", "Dutch", "Nederl\xE4ndska", "Nederlands", WritingScript.Latin),
|
|
663
|
+
L("nn", "nno", "Norwegian Nynorsk", "Norska (nynorsk)", "Norsk nynorsk", WritingScript.Latin),
|
|
664
|
+
L("no", "nor", "Norwegian", "Norska", "Norsk", WritingScript.Latin),
|
|
665
|
+
L("nr", "nbl", "Southern Ndebele", "Sydndebele", "isiNdebele", WritingScript.Latin),
|
|
666
|
+
L("nv", "nav", "Navajo", "Navajo", "Din\xE9 Bizaad", WritingScript.Latin),
|
|
667
|
+
L("ny", "nya", "Chichewa", "Chichewa", "Chichewa", WritingScript.Latin),
|
|
668
|
+
L("oc", "oci", "Occitan", "Occitanska", "Occitan", WritingScript.Latin),
|
|
669
|
+
L("oj", "oji", "Ojibwa", "Ojibwa", "\u140A\u14C2\u1511\u14C8\u142F\u14A7\u140E\u14D0", WritingScript.Canadian),
|
|
670
|
+
L("om", "orm", "Oromo", "Oromo", "Afaan Oromoo", WritingScript.Latin),
|
|
671
|
+
L("or", "ori", "Oriya", "Oriya", "\u0B13\u0B21\u0B3C\u0B3F\u0B06", WritingScript.Oriya),
|
|
672
|
+
L("os", "oss", "Ossetian", "Ossetiska", "\u0418\u0440\u043E\u043D", WritingScript.Cyrillic),
|
|
673
|
+
L("pa", "pan", "Punjabi", "Punjabi", "\u0A2A\u0A70\u0A1C\u0A3E\u0A2C\u0A40", WritingScript.Gurmukhi),
|
|
674
|
+
L("pi", "pli", "Pali", "Pali", "\u092A\u093E\u0932\u093F", WritingScript.Devanagari),
|
|
675
|
+
L("pl", "pol", "Polish", "Polska", "Polski", WritingScript.Latin),
|
|
676
|
+
L("ps", "pus", "Pashto", "Pashto", "\u067E\u069A\u062A\u0648", WritingScript.Arabic, TextDirection.RightToLeft),
|
|
677
|
+
L("pt", "por", "Portuguese", "Portugisiska", "Portugu\xEAs", WritingScript.Latin),
|
|
678
|
+
L("qu", "que", "Quechua", "Quechua", "Runa Simi", WritingScript.Latin),
|
|
679
|
+
L("rm", "roh", "Romansh", "R\xE4toromanska", "Rumantsch", WritingScript.Latin),
|
|
680
|
+
L("rn", "run", "Rundi", "Kirundi", "Ikirundi", WritingScript.Latin),
|
|
681
|
+
L("ro", "ron", "Romanian", "Rum\xE4nska", "Rom\xE2n\u0103", WritingScript.Latin),
|
|
682
|
+
L("ru", "rus", "Russian", "Ryska", "\u0420\u0443\u0441\u0441\u043A\u0438\u0439", WritingScript.Cyrillic),
|
|
683
|
+
L("rw", "kin", "Kinyarwanda", "Kinyarwanda", "Ikinyarwanda", WritingScript.Latin),
|
|
684
|
+
L("sa", "san", "Sanskrit", "Sanskrit", "\u0938\u0902\u0938\u094D\u0915\u0943\u0924\u092E\u094D", WritingScript.Devanagari),
|
|
685
|
+
L("sc", "srd", "Sardinian", "Sardiska", "Sardu", WritingScript.Latin),
|
|
686
|
+
L("sd", "snd", "Sindhi", "Sindhi", "\u0633\u0646\u068C\u064A", WritingScript.Arabic, TextDirection.RightToLeft),
|
|
687
|
+
L("se", "sme", "Northern Sami", "Nordsamiska", "Davvis\xE1megiella", WritingScript.Latin),
|
|
688
|
+
L("sg", "sag", "Sango", "Sango", "Y\xE2ng\xE2 t\xEE S\xE4ng\xF6", WritingScript.Latin),
|
|
689
|
+
L("si", "sin", "Sinhala", "Singalesiska", "\u0DC3\u0DD2\u0D82\u0DC4\u0DBD", WritingScript.Sinhala),
|
|
690
|
+
L("sk", "slk", "Slovak", "Slovakiska", "Sloven\u010Dina", WritingScript.Latin),
|
|
691
|
+
L("sl", "slv", "Slovenian", "Slovenska", "Sloven\u0161\u010Dina", WritingScript.Latin),
|
|
692
|
+
L("sm", "smo", "Samoan", "Samoanska", "Gagana S\u0101moa", WritingScript.Latin),
|
|
693
|
+
L("sn", "sna", "Shona", "Shona", "ChiShona", WritingScript.Latin),
|
|
694
|
+
L("so", "som", "Somali", "Somaliska", "Soomaali", WritingScript.Latin),
|
|
695
|
+
L("sq", "sqi", "Albanian", "Albanska", "Shqip", WritingScript.Latin),
|
|
696
|
+
L("sr", "srp", "Serbian", "Serbiska", "\u0421\u0440\u043F\u0441\u043A\u0438", WritingScript.Cyrillic),
|
|
697
|
+
L("ss", "ssw", "Swati", "Swati", "SiSwati", WritingScript.Latin),
|
|
698
|
+
L("st", "sot", "Southern Sotho", "Sotho", "Sesotho", WritingScript.Latin),
|
|
699
|
+
L("su", "sun", "Sundanese", "Sundanesiska", "Basa Sunda", WritingScript.Latin),
|
|
700
|
+
L("sv", "swe", "Swedish", "Svenska", "Svenska", WritingScript.Latin),
|
|
701
|
+
L("sw", "swa", "Swahili", "Swahili", "Kiswahili", WritingScript.Latin),
|
|
702
|
+
L("ta", "tam", "Tamil", "Tamil", "\u0BA4\u0BAE\u0BBF\u0BB4\u0BCD", WritingScript.Tamil),
|
|
703
|
+
L("te", "tel", "Telugu", "Telugu", "\u0C24\u0C46\u0C32\u0C41\u0C17\u0C41", WritingScript.Telugu),
|
|
704
|
+
L("tg", "tgk", "Tajik", "Tadzjikiska", "\u0422\u043E\u04B7\u0438\u043A\u04E3", WritingScript.Cyrillic),
|
|
705
|
+
L("th", "tha", "Thai", "Thail\xE4ndska", "\u0E44\u0E17\u0E22", WritingScript.Thai),
|
|
706
|
+
L("ti", "tir", "Tigrinya", "Tigrinja", "\u1275\u130D\u122D\u129B", WritingScript.Ethiopic),
|
|
707
|
+
L("tk", "tuk", "Turkmen", "Turkmeniska", "T\xFCrkmen", WritingScript.Latin),
|
|
708
|
+
L("tl", "tgl", "Tagalog", "Tagalog", "Tagalog", WritingScript.Latin),
|
|
709
|
+
L("tn", "tsn", "Tswana", "Tswana", "Setswana", WritingScript.Latin),
|
|
710
|
+
L("to", "ton", "Tongan", "Tonganska", "Lea Faka-Tonga", WritingScript.Latin),
|
|
711
|
+
L("tr", "tur", "Turkish", "Turkiska", "T\xFCrk\xE7e", WritingScript.Latin),
|
|
712
|
+
L("ts", "tso", "Tsonga", "Tsonga", "Xitsonga", WritingScript.Latin),
|
|
713
|
+
L("tt", "tat", "Tatar", "Tatariska", "\u0422\u0430\u0442\u0430\u0440", WritingScript.Cyrillic),
|
|
714
|
+
L("tw", "twi", "Twi", "Twi", "Twi", WritingScript.Latin),
|
|
715
|
+
L("ty", "tah", "Tahitian", "Tahitiska", "Reo Tahiti", WritingScript.Latin),
|
|
716
|
+
L(
|
|
717
|
+
"ug",
|
|
718
|
+
"uig",
|
|
719
|
+
"Uyghur",
|
|
720
|
+
"Uiguriska",
|
|
721
|
+
"\u0626\u06C7\u064A\u063A\u06C7\u0631\u0686\u06D5",
|
|
722
|
+
WritingScript.Arabic,
|
|
723
|
+
TextDirection.RightToLeft
|
|
724
|
+
),
|
|
725
|
+
L("uk", "ukr", "Ukrainian", "Ukrainska", "\u0423\u043A\u0440\u0430\u0457\u043D\u0441\u044C\u043A\u0430", WritingScript.Cyrillic),
|
|
726
|
+
L("ur", "urd", "Urdu", "Urdu", "\u0627\u0631\u062F\u0648", WritingScript.Arabic, TextDirection.RightToLeft),
|
|
727
|
+
L("uz", "uzb", "Uzbek", "Uzbekiska", "O\u02BBzbek", WritingScript.Latin),
|
|
728
|
+
L("ve", "ven", "Venda", "Venda", "Tshiven\u1E13a", WritingScript.Latin),
|
|
729
|
+
L("vi", "vie", "Vietnamese", "Vietnamesiska", "Ti\u1EBFng Vi\u1EC7t", WritingScript.Latin),
|
|
730
|
+
L("vo", "vol", "Volap\xFCk", "Volap\xFCk", "Volap\xFCk", WritingScript.Latin),
|
|
731
|
+
L("wa", "wln", "Walloon", "Vallonska", "Walon", WritingScript.Latin),
|
|
732
|
+
L("wo", "wol", "Wolof", "Wolof", "Wollof", WritingScript.Latin),
|
|
733
|
+
L("xh", "xho", "Xhosa", "Xhosa", "isiXhosa", WritingScript.Latin),
|
|
734
|
+
L("yi", "yid", "Yiddish", "Jiddisch", "\u05D9\u05D9\u05B4\u05D3\u05D9\u05E9", WritingScript.Hebrew, TextDirection.RightToLeft),
|
|
735
|
+
L("yo", "yor", "Yoruba", "Yoruba", "Yor\xF9b\xE1", WritingScript.Latin),
|
|
736
|
+
L("za", "zha", "Zhuang", "Zhuang", "Sa\u026F cue\u014B\u0185", WritingScript.Latin),
|
|
737
|
+
L("zh", "zho", "Chinese", "Kinesiska", "\u4E2D\u6587", WritingScript.Han),
|
|
738
|
+
L("zu", "zul", "Zulu", "Zulu", "isiZulu", WritingScript.Latin)
|
|
739
|
+
]);
|
|
740
|
+
var BY_KEY = (() => {
|
|
741
|
+
const m = /* @__PURE__ */ new Map();
|
|
742
|
+
for (const lang of ALL) {
|
|
743
|
+
m.set(lang.alpha2Code, lang);
|
|
744
|
+
m.set(lang.alpha3Code, lang);
|
|
745
|
+
m.set(lang.englishName.toLowerCase(), lang);
|
|
746
|
+
if (!m.has(lang.localizedName.toLowerCase())) {
|
|
747
|
+
m.set(lang.localizedName.toLowerCase(), lang);
|
|
748
|
+
}
|
|
749
|
+
if (lang.nativeName.toLowerCase() !== lang.englishName.toLowerCase() && !m.has(lang.nativeName.toLowerCase())) {
|
|
750
|
+
m.set(lang.nativeName.toLowerCase(), lang);
|
|
751
|
+
}
|
|
752
|
+
}
|
|
753
|
+
return m;
|
|
754
|
+
})();
|
|
755
|
+
var byA2 = (a2) => BY_KEY.get(a2);
|
|
756
|
+
Language.Afrikaans = byA2("af");
|
|
757
|
+
Language.Albanian = byA2("sq");
|
|
758
|
+
Language.Arabic = byA2("ar");
|
|
759
|
+
Language.Bulgarian = byA2("bg");
|
|
760
|
+
Language.Catalan = byA2("ca");
|
|
761
|
+
Language.Chinese = byA2("zh");
|
|
762
|
+
Language.Croatian = byA2("hr");
|
|
763
|
+
Language.Czech = byA2("cs");
|
|
764
|
+
Language.Danish = byA2("da");
|
|
765
|
+
Language.Dutch = byA2("nl");
|
|
766
|
+
Language.English = byA2("en");
|
|
767
|
+
Language.Estonian = byA2("et");
|
|
768
|
+
Language.Faroese = byA2("fo");
|
|
769
|
+
Language.Finnish = byA2("fi");
|
|
770
|
+
Language.French = byA2("fr");
|
|
771
|
+
Language.German = byA2("de");
|
|
772
|
+
Language.Greek = byA2("el");
|
|
773
|
+
Language.Hindi = byA2("hi");
|
|
774
|
+
Language.Hungarian = byA2("hu");
|
|
775
|
+
Language.Icelandic = byA2("is");
|
|
776
|
+
Language.Italian = byA2("it");
|
|
777
|
+
Language.Japanese = byA2("ja");
|
|
778
|
+
Language.Korean = byA2("ko");
|
|
779
|
+
Language.Latvian = byA2("lv");
|
|
780
|
+
Language.Lithuanian = byA2("lt");
|
|
781
|
+
Language.NorthernSami = byA2("se");
|
|
782
|
+
Language.Norwegian = byA2("no");
|
|
783
|
+
Language.NorwegianBokmal = byA2("nb");
|
|
784
|
+
Language.NorwegianNynorsk = byA2("nn");
|
|
785
|
+
Language.Polish = byA2("pl");
|
|
786
|
+
Language.Portuguese = byA2("pt");
|
|
787
|
+
Language.Romanian = byA2("ro");
|
|
788
|
+
Language.Russian = byA2("ru");
|
|
789
|
+
Language.Slovak = byA2("sk");
|
|
790
|
+
Language.Slovenian = byA2("sl");
|
|
791
|
+
Language.Spanish = byA2("es");
|
|
792
|
+
Language.Swahili = byA2("sw");
|
|
793
|
+
Language.Swedish = byA2("sv");
|
|
794
|
+
Language.Turkish = byA2("tr");
|
|
795
|
+
Language.Ukrainian = byA2("uk");
|
|
796
|
+
|
|
797
|
+
// src/geography/continent.ts
|
|
798
|
+
var MAX_INPUT_LENGTH2 = 50;
|
|
799
|
+
var Continent = class _Continent {
|
|
800
|
+
static typeInfo = Object.freeze({
|
|
801
|
+
englishName: "Continent",
|
|
802
|
+
localizedName: "Kontinent",
|
|
803
|
+
emoji: "\u{1F5FA}\uFE0F",
|
|
804
|
+
sources: Object.freeze([
|
|
805
|
+
"https://unstats.un.org/unsd/methodology/m49/",
|
|
806
|
+
"https://datahub.io/core/continent-codes"
|
|
807
|
+
])
|
|
808
|
+
});
|
|
809
|
+
static Africa = new _Continent("AF", "Africa", "Afrika");
|
|
810
|
+
static Antarctica = new _Continent("AN", "Antarctica", "Antarktis");
|
|
811
|
+
static Asia = new _Continent("AS", "Asia", "Asien");
|
|
812
|
+
static Europe = new _Continent("EU", "Europe", "Europa");
|
|
813
|
+
static NorthAmerica = new _Continent("NA", "North America", "Nordamerika");
|
|
814
|
+
static Oceania = new _Continent("OC", "Oceania", "Oceanien");
|
|
815
|
+
static SouthAmerica = new _Continent("SA", "South America", "Sydamerika");
|
|
816
|
+
/** All seven continents. */
|
|
817
|
+
static all = Object.freeze([
|
|
818
|
+
_Continent.Africa,
|
|
819
|
+
_Continent.Antarctica,
|
|
820
|
+
_Continent.Asia,
|
|
821
|
+
_Continent.Europe,
|
|
822
|
+
_Continent.NorthAmerica,
|
|
823
|
+
_Continent.Oceania,
|
|
824
|
+
_Continent.SouthAmerica
|
|
825
|
+
]);
|
|
826
|
+
code;
|
|
827
|
+
englishName;
|
|
828
|
+
localizedName;
|
|
829
|
+
constructor(code, englishName, localizedName) {
|
|
830
|
+
this.code = code;
|
|
831
|
+
this.englishName = englishName;
|
|
832
|
+
this.localizedName = localizedName;
|
|
833
|
+
}
|
|
834
|
+
get displayName() {
|
|
835
|
+
return PrimitivesDefaults.useLocalizedDisplayNames ? this.localizedName : this.englishName;
|
|
836
|
+
}
|
|
837
|
+
get value() {
|
|
838
|
+
return this.code;
|
|
839
|
+
}
|
|
840
|
+
static tryParse(input) {
|
|
841
|
+
if (input == null) return null;
|
|
842
|
+
const trimmed = input.trim();
|
|
843
|
+
if (trimmed.length === 0 || trimmed.length > MAX_INPUT_LENGTH2) return null;
|
|
844
|
+
const lower = trimmed.toLowerCase();
|
|
845
|
+
return BY_KEY2.get(lower) ?? null;
|
|
846
|
+
}
|
|
847
|
+
static parse(input) {
|
|
848
|
+
const r = _Continent.tryParse(input);
|
|
849
|
+
if (r === null) throw new Error("Unknown continent.");
|
|
850
|
+
return r;
|
|
851
|
+
}
|
|
852
|
+
static isValid(input) {
|
|
853
|
+
return _Continent.tryParse(input) !== null;
|
|
854
|
+
}
|
|
855
|
+
static format(input, options) {
|
|
856
|
+
const r = _Continent.tryParse(input);
|
|
857
|
+
if (r) return r.displayName;
|
|
858
|
+
if (options?.fallbackToTrimmedInputWhenInvalid && input != null && input.trim() !== "") {
|
|
859
|
+
return input.trim();
|
|
860
|
+
}
|
|
861
|
+
return null;
|
|
862
|
+
}
|
|
863
|
+
static normalize(input, options) {
|
|
864
|
+
const r = _Continent.tryParse(input);
|
|
865
|
+
if (r) return r.code;
|
|
866
|
+
if (options?.fallbackToTrimmedInputWhenInvalid && input != null) {
|
|
867
|
+
const trimmed = input.trim();
|
|
868
|
+
return trimmed.length > 0 ? trimmed : null;
|
|
869
|
+
}
|
|
870
|
+
return null;
|
|
871
|
+
}
|
|
872
|
+
static isNormalized(input) {
|
|
873
|
+
return input != null && _Continent.normalize(input) === input;
|
|
874
|
+
}
|
|
875
|
+
toNormalizedString() {
|
|
876
|
+
return this.code;
|
|
877
|
+
}
|
|
878
|
+
toString() {
|
|
879
|
+
return this.displayName;
|
|
880
|
+
}
|
|
881
|
+
equals(other) {
|
|
882
|
+
return other != null && this.code === other.code;
|
|
883
|
+
}
|
|
884
|
+
compareTo(other) {
|
|
885
|
+
if (other == null) return 1;
|
|
886
|
+
return this.code < other.code ? -1 : this.code > other.code ? 1 : 0;
|
|
887
|
+
}
|
|
888
|
+
};
|
|
889
|
+
var BY_KEY2 = (() => {
|
|
890
|
+
const m = /* @__PURE__ */ new Map();
|
|
891
|
+
for (const c of Continent.all) {
|
|
892
|
+
m.set(c.code.toLowerCase(), c);
|
|
893
|
+
m.set(c.englishName.toLowerCase(), c);
|
|
894
|
+
m.set(c.localizedName.toLowerCase(), c);
|
|
895
|
+
}
|
|
896
|
+
return m;
|
|
897
|
+
})();
|
|
898
|
+
|
|
899
|
+
// src/geography/country-data.ts
|
|
900
|
+
var C = (alpha2, alpha3, numeric, en, sv, native, callingCode, tld, continent) => ({ alpha2, alpha3, numeric, en, sv, native, callingCode, tld, continent });
|
|
901
|
+
var COUNTRY_ROWS = [
|
|
902
|
+
C("AF", "AFG", 4, "Afghanistan", "Afghanistan", "\u0627\u0641\u063A\u0627\u0646\u0633\u062A\u0627\u0646", "93", ".af", Continent.Asia),
|
|
903
|
+
C("AL", "ALB", 8, "Albania", "Albanien", "Shqip\xEBria", "355", ".al", Continent.Europe),
|
|
904
|
+
C("DZ", "DZA", 12, "Algeria", "Algeriet", "\u0627\u0644\u062C\u0632\u0627\u0626\u0631", "213", ".dz", Continent.Africa),
|
|
905
|
+
C(
|
|
906
|
+
"AS",
|
|
907
|
+
"ASM",
|
|
908
|
+
16,
|
|
909
|
+
"American Samoa",
|
|
910
|
+
"Amerikanska Samoa",
|
|
911
|
+
"American Samoa",
|
|
912
|
+
"1",
|
|
913
|
+
".as",
|
|
914
|
+
Continent.Oceania
|
|
915
|
+
),
|
|
916
|
+
C("AD", "AND", 20, "Andorra", "Andorra", "Andorra", "376", ".ad", Continent.Europe),
|
|
917
|
+
C("AO", "AGO", 24, "Angola", "Angola", "Angola", "244", ".ao", Continent.Africa),
|
|
918
|
+
C(
|
|
919
|
+
"AG",
|
|
920
|
+
"ATG",
|
|
921
|
+
28,
|
|
922
|
+
"Antigua and Barbuda",
|
|
923
|
+
"Antigua och Barbuda",
|
|
924
|
+
"Antigua and Barbuda",
|
|
925
|
+
"1",
|
|
926
|
+
".ag",
|
|
927
|
+
Continent.NorthAmerica
|
|
928
|
+
),
|
|
929
|
+
C("AR", "ARG", 32, "Argentina", "Argentina", "Argentina", "54", ".ar", Continent.SouthAmerica),
|
|
930
|
+
C("AM", "ARM", 51, "Armenia", "Armenien", "\u0540\u0561\u0575\u0561\u057D\u057F\u0561\u0576", "374", ".am", Continent.Asia),
|
|
931
|
+
C("AW", "ABW", 533, "Aruba", "Aruba", "Aruba", "297", ".aw", Continent.NorthAmerica),
|
|
932
|
+
C("AU", "AUS", 36, "Australia", "Australien", "Australia", "61", ".au", Continent.Oceania),
|
|
933
|
+
C("AT", "AUT", 40, "Austria", "\xD6sterrike", "\xD6sterreich", "43", ".at", Continent.Europe),
|
|
934
|
+
C("AZ", "AZE", 31, "Azerbaijan", "Azerbajdzjan", "Az\u0259rbaycan", "994", ".az", Continent.Asia),
|
|
935
|
+
C("BS", "BHS", 44, "Bahamas", "Bahamas", "Bahamas", "1", ".bs", Continent.NorthAmerica),
|
|
936
|
+
C("BH", "BHR", 48, "Bahrain", "Bahrain", "\u0627\u0644\u0628\u062D\u0631\u064A\u0646", "973", ".bh", Continent.Asia),
|
|
937
|
+
C("BD", "BGD", 50, "Bangladesh", "Bangladesh", "\u09AC\u09BE\u0982\u09B2\u09BE\u09A6\u09C7\u09B6", "880", ".bd", Continent.Asia),
|
|
938
|
+
C("BB", "BRB", 52, "Barbados", "Barbados", "Barbados", "1", ".bb", Continent.NorthAmerica),
|
|
939
|
+
C("BY", "BLR", 112, "Belarus", "Belarus", "\u0411\u0435\u043B\u0430\u0440\u0443\u0441\u044C", "375", ".by", Continent.Europe),
|
|
940
|
+
C("BE", "BEL", 56, "Belgium", "Belgien", "Belgi\xEB", "32", ".be", Continent.Europe),
|
|
941
|
+
C("BZ", "BLZ", 84, "Belize", "Belize", "Belize", "501", ".bz", Continent.NorthAmerica),
|
|
942
|
+
C("BJ", "BEN", 204, "Benin", "Benin", "B\xE9nin", "229", ".bj", Continent.Africa),
|
|
943
|
+
C("BM", "BMU", 60, "Bermuda", "Bermuda", "Bermuda", "1", ".bm", Continent.NorthAmerica),
|
|
944
|
+
C("BT", "BTN", 64, "Bhutan", "Bhutan", "\u0F60\u0F56\u0FB2\u0F74\u0F42", "975", ".bt", Continent.Asia),
|
|
945
|
+
C("BO", "BOL", 68, "Bolivia", "Bolivia", "Bolivia", "591", ".bo", Continent.SouthAmerica),
|
|
946
|
+
C(
|
|
947
|
+
"BA",
|
|
948
|
+
"BIH",
|
|
949
|
+
70,
|
|
950
|
+
"Bosnia and Herzegovina",
|
|
951
|
+
"Bosnien och Hercegovina",
|
|
952
|
+
"Bosna i Hercegovina",
|
|
953
|
+
"387",
|
|
954
|
+
".ba",
|
|
955
|
+
Continent.Europe
|
|
956
|
+
),
|
|
957
|
+
C("BW", "BWA", 72, "Botswana", "Botswana", "Botswana", "267", ".bw", Continent.Africa),
|
|
958
|
+
C("BR", "BRA", 76, "Brazil", "Brasilien", "Brasil", "55", ".br", Continent.SouthAmerica),
|
|
959
|
+
C("BN", "BRN", 96, "Brunei", "Brunei", "Brunei", "673", ".bn", Continent.Asia),
|
|
960
|
+
C("BG", "BGR", 100, "Bulgaria", "Bulgarien", "\u0411\u044A\u043B\u0433\u0430\u0440\u0438\u044F", "359", ".bg", Continent.Europe),
|
|
961
|
+
C(
|
|
962
|
+
"BF",
|
|
963
|
+
"BFA",
|
|
964
|
+
854,
|
|
965
|
+
"Burkina Faso",
|
|
966
|
+
"Burkina Faso",
|
|
967
|
+
"Burkina Faso",
|
|
968
|
+
"226",
|
|
969
|
+
".bf",
|
|
970
|
+
Continent.Africa
|
|
971
|
+
),
|
|
972
|
+
C("BI", "BDI", 108, "Burundi", "Burundi", "Burundi", "257", ".bi", Continent.Africa),
|
|
973
|
+
C("CV", "CPV", 132, "Cabo Verde", "Kap Verde", "Cabo Verde", "238", ".cv", Continent.Africa),
|
|
974
|
+
C("KH", "KHM", 116, "Cambodia", "Kambodja", "\u1780\u1798\u17D2\u1796\u17BB\u1787\u17B6", "855", ".kh", Continent.Asia),
|
|
975
|
+
C("CM", "CMR", 120, "Cameroon", "Kamerun", "Cameroun", "237", ".cm", Continent.Africa),
|
|
976
|
+
C("CA", "CAN", 124, "Canada", "Kanada", "Canada", "1", ".ca", Continent.NorthAmerica),
|
|
977
|
+
C(
|
|
978
|
+
"CF",
|
|
979
|
+
"CAF",
|
|
980
|
+
140,
|
|
981
|
+
"Central African Republic",
|
|
982
|
+
"Centralafrikanska republiken",
|
|
983
|
+
"R\xE9publique centrafricaine",
|
|
984
|
+
"236",
|
|
985
|
+
".cf",
|
|
986
|
+
Continent.Africa
|
|
987
|
+
),
|
|
988
|
+
C("TD", "TCD", 148, "Chad", "Tchad", "Tchad", "235", ".td", Continent.Africa),
|
|
989
|
+
C("CL", "CHL", 152, "Chile", "Chile", "Chile", "56", ".cl", Continent.SouthAmerica),
|
|
990
|
+
C("CN", "CHN", 156, "China", "Kina", "\u4E2D\u56FD", "86", ".cn", Continent.Asia),
|
|
991
|
+
C("CO", "COL", 170, "Colombia", "Colombia", "Colombia", "57", ".co", Continent.SouthAmerica),
|
|
992
|
+
C("KM", "COM", 174, "Comoros", "Komorerna", "Komori", "269", ".km", Continent.Africa),
|
|
993
|
+
C("CG", "COG", 178, "Congo", "Kongo", "Congo", "242", ".cg", Continent.Africa),
|
|
994
|
+
C(
|
|
995
|
+
"CD",
|
|
996
|
+
"COD",
|
|
997
|
+
180,
|
|
998
|
+
"Congo (Democratic Republic)",
|
|
999
|
+
"Demokratiska republiken Kongo",
|
|
1000
|
+
"R\xE9publique d\xE9mocratique du Congo",
|
|
1001
|
+
"243",
|
|
1002
|
+
".cd",
|
|
1003
|
+
Continent.Africa
|
|
1004
|
+
),
|
|
1005
|
+
C(
|
|
1006
|
+
"CR",
|
|
1007
|
+
"CRI",
|
|
1008
|
+
188,
|
|
1009
|
+
"Costa Rica",
|
|
1010
|
+
"Costa Rica",
|
|
1011
|
+
"Costa Rica",
|
|
1012
|
+
"506",
|
|
1013
|
+
".cr",
|
|
1014
|
+
Continent.NorthAmerica
|
|
1015
|
+
),
|
|
1016
|
+
C(
|
|
1017
|
+
"CI",
|
|
1018
|
+
"CIV",
|
|
1019
|
+
384,
|
|
1020
|
+
"C\xF4te d'Ivoire",
|
|
1021
|
+
"Elfenbenskusten",
|
|
1022
|
+
"C\xF4te d'Ivoire",
|
|
1023
|
+
"225",
|
|
1024
|
+
".ci",
|
|
1025
|
+
Continent.Africa
|
|
1026
|
+
),
|
|
1027
|
+
C("HR", "HRV", 191, "Croatia", "Kroatien", "Hrvatska", "385", ".hr", Continent.Europe),
|
|
1028
|
+
C("CU", "CUB", 192, "Cuba", "Kuba", "Cuba", "53", ".cu", Continent.NorthAmerica),
|
|
1029
|
+
C("CW", "CUW", 531, "Cura\xE7ao", "Cura\xE7ao", "Cura\xE7ao", "599", ".cw", Continent.NorthAmerica),
|
|
1030
|
+
C("CY", "CYP", 196, "Cyprus", "Cypern", "\u039A\u03CD\u03C0\u03C1\u03BF\u03C2", "357", ".cy", Continent.Europe),
|
|
1031
|
+
C("CZ", "CZE", 203, "Czechia", "Tjeckien", "\u010Cesko", "420", ".cz", Continent.Europe),
|
|
1032
|
+
C("DK", "DNK", 208, "Denmark", "Danmark", "Danmark", "45", ".dk", Continent.Europe),
|
|
1033
|
+
C("DJ", "DJI", 262, "Djibouti", "Djibouti", "Djibouti", "253", ".dj", Continent.Africa),
|
|
1034
|
+
C("DM", "DMA", 212, "Dominica", "Dominica", "Dominica", "1", ".dm", Continent.NorthAmerica),
|
|
1035
|
+
C(
|
|
1036
|
+
"DO",
|
|
1037
|
+
"DOM",
|
|
1038
|
+
214,
|
|
1039
|
+
"Dominican Republic",
|
|
1040
|
+
"Dominikanska republiken",
|
|
1041
|
+
"Rep\xFAblica Dominicana",
|
|
1042
|
+
"1",
|
|
1043
|
+
".do",
|
|
1044
|
+
Continent.NorthAmerica
|
|
1045
|
+
),
|
|
1046
|
+
C("EC", "ECU", 218, "Ecuador", "Ecuador", "Ecuador", "593", ".ec", Continent.SouthAmerica),
|
|
1047
|
+
C("EG", "EGY", 818, "Egypt", "Egypten", "\u0645\u0635\u0631", "20", ".eg", Continent.Africa),
|
|
1048
|
+
C(
|
|
1049
|
+
"SV",
|
|
1050
|
+
"SLV",
|
|
1051
|
+
222,
|
|
1052
|
+
"El Salvador",
|
|
1053
|
+
"El Salvador",
|
|
1054
|
+
"El Salvador",
|
|
1055
|
+
"503",
|
|
1056
|
+
".sv",
|
|
1057
|
+
Continent.NorthAmerica
|
|
1058
|
+
),
|
|
1059
|
+
C(
|
|
1060
|
+
"GQ",
|
|
1061
|
+
"GNQ",
|
|
1062
|
+
226,
|
|
1063
|
+
"Equatorial Guinea",
|
|
1064
|
+
"Ekvatorialguinea",
|
|
1065
|
+
"Guinea Ecuatorial",
|
|
1066
|
+
"240",
|
|
1067
|
+
".gq",
|
|
1068
|
+
Continent.Africa
|
|
1069
|
+
),
|
|
1070
|
+
C("ER", "ERI", 232, "Eritrea", "Eritrea", "\u12A4\u122D\u1275\u122B", "291", ".er", Continent.Africa),
|
|
1071
|
+
C("EE", "EST", 233, "Estonia", "Estland", "Eesti", "372", ".ee", Continent.Europe),
|
|
1072
|
+
C("SZ", "SWZ", 748, "Eswatini", "Eswatini", "eSwatini", "268", ".sz", Continent.Africa),
|
|
1073
|
+
C("ET", "ETH", 231, "Ethiopia", "Etiopien", "\u12A2\u1275\u12EE\u1335\u12EB", "251", ".et", Continent.Africa),
|
|
1074
|
+
C("FJ", "FJI", 242, "Fiji", "Fiji", "Fiji", "679", ".fj", Continent.Oceania),
|
|
1075
|
+
C("FI", "FIN", 246, "Finland", "Finland", "Suomi", "358", ".fi", Continent.Europe),
|
|
1076
|
+
C("FR", "FRA", 250, "France", "Frankrike", "France", "33", ".fr", Continent.Europe),
|
|
1077
|
+
C("GA", "GAB", 266, "Gabon", "Gabon", "Gabon", "241", ".ga", Continent.Africa),
|
|
1078
|
+
C("GM", "GMB", 270, "Gambia", "Gambia", "Gambia", "220", ".gm", Continent.Africa),
|
|
1079
|
+
C("GE", "GEO", 268, "Georgia", "Georgien", "\u10E1\u10D0\u10E5\u10D0\u10E0\u10D7\u10D5\u10D4\u10DA\u10DD", "995", ".ge", Continent.Asia),
|
|
1080
|
+
C("DE", "DEU", 276, "Germany", "Tyskland", "Deutschland", "49", ".de", Continent.Europe),
|
|
1081
|
+
C("GH", "GHA", 288, "Ghana", "Ghana", "Ghana", "233", ".gh", Continent.Africa),
|
|
1082
|
+
C("GI", "GIB", 292, "Gibraltar", "Gibraltar", "Gibraltar", "350", ".gi", Continent.Europe),
|
|
1083
|
+
C("GR", "GRC", 300, "Greece", "Grekland", "\u0395\u03BB\u03BB\u03AC\u03B4\u03B1", "30", ".gr", Continent.Europe),
|
|
1084
|
+
C(
|
|
1085
|
+
"GL",
|
|
1086
|
+
"GRL",
|
|
1087
|
+
304,
|
|
1088
|
+
"Greenland",
|
|
1089
|
+
"Gr\xF6nland",
|
|
1090
|
+
"Kalaallit Nunaat",
|
|
1091
|
+
"299",
|
|
1092
|
+
".gl",
|
|
1093
|
+
Continent.NorthAmerica
|
|
1094
|
+
),
|
|
1095
|
+
C("GD", "GRD", 308, "Grenada", "Grenada", "Grenada", "1", ".gd", Continent.NorthAmerica),
|
|
1096
|
+
C("GU", "GUM", 316, "Guam", "Guam", "Guam", "1", ".gu", Continent.Oceania),
|
|
1097
|
+
C("GT", "GTM", 320, "Guatemala", "Guatemala", "Guatemala", "502", ".gt", Continent.NorthAmerica),
|
|
1098
|
+
C("GG", "GGY", 831, "Guernsey", "Guernsey", "Guernsey", "44", ".gg", Continent.Europe),
|
|
1099
|
+
C("GN", "GIN", 324, "Guinea", "Guinea", "Guin\xE9e", "224", ".gn", Continent.Africa),
|
|
1100
|
+
C(
|
|
1101
|
+
"GW",
|
|
1102
|
+
"GNB",
|
|
1103
|
+
624,
|
|
1104
|
+
"Guinea-Bissau",
|
|
1105
|
+
"Guinea-Bissau",
|
|
1106
|
+
"Guin\xE9-Bissau",
|
|
1107
|
+
"245",
|
|
1108
|
+
".gw",
|
|
1109
|
+
Continent.Africa
|
|
1110
|
+
),
|
|
1111
|
+
C("GY", "GUY", 328, "Guyana", "Guyana", "Guyana", "592", ".gy", Continent.SouthAmerica),
|
|
1112
|
+
C("HT", "HTI", 332, "Haiti", "Haiti", "Ha\xEFti", "509", ".ht", Continent.NorthAmerica),
|
|
1113
|
+
C("HN", "HND", 340, "Honduras", "Honduras", "Honduras", "504", ".hn", Continent.NorthAmerica),
|
|
1114
|
+
C("HK", "HKG", 344, "Hong Kong", "Hongkong", "\u9999\u6E2F", "852", ".hk", Continent.Asia),
|
|
1115
|
+
C("HU", "HUN", 348, "Hungary", "Ungern", "Magyarorsz\xE1g", "36", ".hu", Continent.Europe),
|
|
1116
|
+
C("IS", "ISL", 352, "Iceland", "Island", "\xCDsland", "354", ".is", Continent.Europe),
|
|
1117
|
+
C("IN", "IND", 356, "India", "Indien", "\u092D\u093E\u0930\u0924", "91", ".in", Continent.Asia),
|
|
1118
|
+
C("ID", "IDN", 360, "Indonesia", "Indonesien", "Indonesia", "62", ".id", Continent.Asia),
|
|
1119
|
+
C("IR", "IRN", 364, "Iran", "Iran", "\u0627\u06CC\u0631\u0627\u0646", "98", ".ir", Continent.Asia),
|
|
1120
|
+
C("IQ", "IRQ", 368, "Iraq", "Irak", "\u0627\u0644\u0639\u0631\u0627\u0642", "964", ".iq", Continent.Asia),
|
|
1121
|
+
C("IE", "IRL", 372, "Ireland", "Irland", "\xC9ire", "353", ".ie", Continent.Europe),
|
|
1122
|
+
C("IM", "IMN", 833, "Isle of Man", "Isle of Man", "Isle of Man", "44", ".im", Continent.Europe),
|
|
1123
|
+
C("IL", "ISR", 376, "Israel", "Israel", "\u05D9\u05E9\u05E8\u05D0\u05DC", "972", ".il", Continent.Asia),
|
|
1124
|
+
C("IT", "ITA", 380, "Italy", "Italien", "Italia", "39", ".it", Continent.Europe),
|
|
1125
|
+
C("JM", "JAM", 388, "Jamaica", "Jamaica", "Jamaica", "1", ".jm", Continent.NorthAmerica),
|
|
1126
|
+
C("JP", "JPN", 392, "Japan", "Japan", "\u65E5\u672C", "81", ".jp", Continent.Asia),
|
|
1127
|
+
C("JE", "JEY", 832, "Jersey", "Jersey", "Jersey", "44", ".je", Continent.Europe),
|
|
1128
|
+
C("JO", "JOR", 400, "Jordan", "Jordanien", "\u0627\u0644\u0623\u0631\u062F\u0646", "962", ".jo", Continent.Asia),
|
|
1129
|
+
C("KZ", "KAZ", 398, "Kazakhstan", "Kazakstan", "\u049A\u0430\u0437\u0430\u049B\u0441\u0442\u0430\u043D", "7", ".kz", Continent.Asia),
|
|
1130
|
+
C("KE", "KEN", 404, "Kenya", "Kenya", "Kenya", "254", ".ke", Continent.Africa),
|
|
1131
|
+
C("KI", "KIR", 296, "Kiribati", "Kiribati", "Kiribati", "686", ".ki", Continent.Oceania),
|
|
1132
|
+
C("KP", "PRK", 408, "North Korea", "Nordkorea", "\uC870\uC120", "850", ".kp", Continent.Asia),
|
|
1133
|
+
C("KR", "KOR", 410, "South Korea", "Sydkorea", "\uB300\uD55C\uBBFC\uAD6D", "82", ".kr", Continent.Asia),
|
|
1134
|
+
C("KW", "KWT", 414, "Kuwait", "Kuwait", "\u0627\u0644\u0643\u0648\u064A\u062A", "965", ".kw", Continent.Asia),
|
|
1135
|
+
C("KG", "KGZ", 417, "Kyrgyzstan", "Kirgizistan", "\u041A\u044B\u0440\u0433\u044B\u0437\u0441\u0442\u0430\u043D", "996", ".kg", Continent.Asia),
|
|
1136
|
+
C("LA", "LAO", 418, "Laos", "Laos", "\u0EA5\u0EB2\u0EA7", "856", ".la", Continent.Asia),
|
|
1137
|
+
C("LV", "LVA", 428, "Latvia", "Lettland", "Latvija", "371", ".lv", Continent.Europe),
|
|
1138
|
+
C("LB", "LBN", 422, "Lebanon", "Libanon", "\u0644\u0628\u0646\u0627\u0646", "961", ".lb", Continent.Asia),
|
|
1139
|
+
C("LS", "LSO", 426, "Lesotho", "Lesotho", "Lesotho", "266", ".ls", Continent.Africa),
|
|
1140
|
+
C("LR", "LBR", 430, "Liberia", "Liberia", "Liberia", "231", ".lr", Continent.Africa),
|
|
1141
|
+
C("LY", "LBY", 434, "Libya", "Libyen", "\u0644\u064A\u0628\u064A\u0627", "218", ".ly", Continent.Africa),
|
|
1142
|
+
C(
|
|
1143
|
+
"LI",
|
|
1144
|
+
"LIE",
|
|
1145
|
+
438,
|
|
1146
|
+
"Liechtenstein",
|
|
1147
|
+
"Liechtenstein",
|
|
1148
|
+
"Liechtenstein",
|
|
1149
|
+
"423",
|
|
1150
|
+
".li",
|
|
1151
|
+
Continent.Europe
|
|
1152
|
+
),
|
|
1153
|
+
C("LT", "LTU", 440, "Lithuania", "Litauen", "Lietuva", "370", ".lt", Continent.Europe),
|
|
1154
|
+
C("LU", "LUX", 442, "Luxembourg", "Luxemburg", "L\xEBtzebuerg", "352", ".lu", Continent.Europe),
|
|
1155
|
+
C("MO", "MAC", 446, "Macao", "Macao", "\u6FB3\u9580", "853", ".mo", Continent.Asia),
|
|
1156
|
+
C("MG", "MDG", 450, "Madagascar", "Madagaskar", "Madagasikara", "261", ".mg", Continent.Africa),
|
|
1157
|
+
C("MW", "MWI", 454, "Malawi", "Malawi", "Malawi", "265", ".mw", Continent.Africa),
|
|
1158
|
+
C("MY", "MYS", 458, "Malaysia", "Malaysia", "Malaysia", "60", ".my", Continent.Asia),
|
|
1159
|
+
C("MV", "MDV", 462, "Maldives", "Maldiverna", "\u078B\u07A8\u0788\u07AC\u0780\u07A8\u0783\u07A7\u0787\u07B0\u0796\u07AC", "960", ".mv", Continent.Asia),
|
|
1160
|
+
C("ML", "MLI", 466, "Mali", "Mali", "Mali", "223", ".ml", Continent.Africa),
|
|
1161
|
+
C("MT", "MLT", 470, "Malta", "Malta", "Malta", "356", ".mt", Continent.Europe),
|
|
1162
|
+
C(
|
|
1163
|
+
"MH",
|
|
1164
|
+
"MHL",
|
|
1165
|
+
584,
|
|
1166
|
+
"Marshall Islands",
|
|
1167
|
+
"Marshall\xF6arna",
|
|
1168
|
+
"Marshall Islands",
|
|
1169
|
+
"692",
|
|
1170
|
+
".mh",
|
|
1171
|
+
Continent.Oceania
|
|
1172
|
+
),
|
|
1173
|
+
C("MR", "MRT", 478, "Mauritania", "Mauretanien", "\u0645\u0648\u0631\u064A\u062A\u0627\u0646\u064A\u0627", "222", ".mr", Continent.Africa),
|
|
1174
|
+
C("MU", "MUS", 480, "Mauritius", "Mauritius", "Maurice", "230", ".mu", Continent.Africa),
|
|
1175
|
+
C("MX", "MEX", 484, "Mexico", "Mexiko", "M\xE9xico", "52", ".mx", Continent.NorthAmerica),
|
|
1176
|
+
C("FM", "FSM", 583, "Micronesia", "Mikronesien", "Micronesia", "691", ".fm", Continent.Oceania),
|
|
1177
|
+
C("MD", "MDA", 498, "Moldova", "Moldavien", "Moldova", "373", ".md", Continent.Europe),
|
|
1178
|
+
C("MC", "MCO", 492, "Monaco", "Monaco", "Monaco", "377", ".mc", Continent.Europe),
|
|
1179
|
+
C("MN", "MNG", 496, "Mongolia", "Mongoliet", "\u041C\u043E\u043D\u0433\u043E\u043B", "976", ".mn", Continent.Asia),
|
|
1180
|
+
C("ME", "MNE", 499, "Montenegro", "Montenegro", "Crna Gora", "382", ".me", Continent.Europe),
|
|
1181
|
+
C("MA", "MAR", 504, "Morocco", "Marocko", "\u0627\u0644\u0645\u063A\u0631\u0628", "212", ".ma", Continent.Africa),
|
|
1182
|
+
C("MZ", "MOZ", 508, "Mozambique", "Mo\xE7ambique", "Mo\xE7ambique", "258", ".mz", Continent.Africa),
|
|
1183
|
+
C("MM", "MMR", 104, "Myanmar", "Myanmar", "\u1019\u103C\u1014\u103A\u1019\u102C", "95", ".mm", Continent.Asia),
|
|
1184
|
+
C("NA", "NAM", 516, "Namibia", "Namibia", "Namibia", "264", ".na", Continent.Africa),
|
|
1185
|
+
C("NR", "NRU", 520, "Nauru", "Nauru", "Nauru", "674", ".nr", Continent.Oceania),
|
|
1186
|
+
C("NP", "NPL", 524, "Nepal", "Nepal", "\u0928\u0947\u092A\u093E\u0932", "977", ".np", Continent.Asia),
|
|
1187
|
+
C("NL", "NLD", 528, "Netherlands", "Nederl\xE4nderna", "Nederland", "31", ".nl", Continent.Europe),
|
|
1188
|
+
C("NZ", "NZL", 554, "New Zealand", "Nya Zeeland", "Aotearoa", "64", ".nz", Continent.Oceania),
|
|
1189
|
+
C("NI", "NIC", 558, "Nicaragua", "Nicaragua", "Nicaragua", "505", ".ni", Continent.NorthAmerica),
|
|
1190
|
+
C("NE", "NER", 562, "Niger", "Niger", "Niger", "227", ".ne", Continent.Africa),
|
|
1191
|
+
C("NG", "NGA", 566, "Nigeria", "Nigeria", "Nigeria", "234", ".ng", Continent.Africa),
|
|
1192
|
+
C(
|
|
1193
|
+
"MK",
|
|
1194
|
+
"MKD",
|
|
1195
|
+
807,
|
|
1196
|
+
"North Macedonia",
|
|
1197
|
+
"Nordmakedonien",
|
|
1198
|
+
"\u0421\u0435\u0432\u0435\u0440\u043D\u0430 \u041C\u0430\u043A\u0435\u0434\u043E\u043D\u0438\u0458\u0430",
|
|
1199
|
+
"389",
|
|
1200
|
+
".mk",
|
|
1201
|
+
Continent.Europe
|
|
1202
|
+
),
|
|
1203
|
+
C("NO", "NOR", 578, "Norway", "Norge", "Norge", "47", ".no", Continent.Europe),
|
|
1204
|
+
C("OM", "OMN", 512, "Oman", "Oman", "\u0639\u0645\u0627\u0646", "968", ".om", Continent.Asia),
|
|
1205
|
+
C("PK", "PAK", 586, "Pakistan", "Pakistan", "\u067E\u0627\u06A9\u0633\u062A\u0627\u0646", "92", ".pk", Continent.Asia),
|
|
1206
|
+
C("PW", "PLW", 585, "Palau", "Palau", "Palau", "680", ".pw", Continent.Oceania),
|
|
1207
|
+
C("PS", "PSE", 275, "Palestine", "Palestina", "\u0641\u0644\u0633\u0637\u064A\u0646", "970", ".ps", Continent.Asia),
|
|
1208
|
+
C("PA", "PAN", 591, "Panama", "Panama", "Panam\xE1", "507", ".pa", Continent.NorthAmerica),
|
|
1209
|
+
C(
|
|
1210
|
+
"PG",
|
|
1211
|
+
"PNG",
|
|
1212
|
+
598,
|
|
1213
|
+
"Papua New Guinea",
|
|
1214
|
+
"Papua Nya Guinea",
|
|
1215
|
+
"Papua Niugini",
|
|
1216
|
+
"675",
|
|
1217
|
+
".pg",
|
|
1218
|
+
Continent.Oceania
|
|
1219
|
+
),
|
|
1220
|
+
C("PY", "PRY", 600, "Paraguay", "Paraguay", "Paraguay", "595", ".py", Continent.SouthAmerica),
|
|
1221
|
+
C("PE", "PER", 604, "Peru", "Peru", "Per\xFA", "51", ".pe", Continent.SouthAmerica),
|
|
1222
|
+
C("PH", "PHL", 608, "Philippines", "Filippinerna", "Pilipinas", "63", ".ph", Continent.Asia),
|
|
1223
|
+
C("PL", "POL", 616, "Poland", "Polen", "Polska", "48", ".pl", Continent.Europe),
|
|
1224
|
+
C("PT", "PRT", 620, "Portugal", "Portugal", "Portugal", "351", ".pt", Continent.Europe),
|
|
1225
|
+
C(
|
|
1226
|
+
"PR",
|
|
1227
|
+
"PRI",
|
|
1228
|
+
630,
|
|
1229
|
+
"Puerto Rico",
|
|
1230
|
+
"Puerto Rico",
|
|
1231
|
+
"Puerto Rico",
|
|
1232
|
+
"1",
|
|
1233
|
+
".pr",
|
|
1234
|
+
Continent.NorthAmerica
|
|
1235
|
+
),
|
|
1236
|
+
C("QA", "QAT", 634, "Qatar", "Qatar", "\u0642\u0637\u0631", "974", ".qa", Continent.Asia),
|
|
1237
|
+
C("RO", "ROU", 642, "Romania", "Rum\xE4nien", "Rom\xE2nia", "40", ".ro", Continent.Europe),
|
|
1238
|
+
C("RU", "RUS", 643, "Russia", "Ryssland", "\u0420\u043E\u0441\u0441\u0438\u044F", "7", ".ru", Continent.Europe),
|
|
1239
|
+
C("RW", "RWA", 646, "Rwanda", "Rwanda", "Rwanda", "250", ".rw", Continent.Africa),
|
|
1240
|
+
C(
|
|
1241
|
+
"KN",
|
|
1242
|
+
"KNA",
|
|
1243
|
+
659,
|
|
1244
|
+
"Saint Kitts and Nevis",
|
|
1245
|
+
"Saint Kitts och Nevis",
|
|
1246
|
+
"Saint Kitts and Nevis",
|
|
1247
|
+
"1",
|
|
1248
|
+
".kn",
|
|
1249
|
+
Continent.NorthAmerica
|
|
1250
|
+
),
|
|
1251
|
+
C(
|
|
1252
|
+
"LC",
|
|
1253
|
+
"LCA",
|
|
1254
|
+
662,
|
|
1255
|
+
"Saint Lucia",
|
|
1256
|
+
"Saint Lucia",
|
|
1257
|
+
"Saint Lucia",
|
|
1258
|
+
"1",
|
|
1259
|
+
".lc",
|
|
1260
|
+
Continent.NorthAmerica
|
|
1261
|
+
),
|
|
1262
|
+
C(
|
|
1263
|
+
"VC",
|
|
1264
|
+
"VCT",
|
|
1265
|
+
670,
|
|
1266
|
+
"Saint Vincent and the Grenadines",
|
|
1267
|
+
"Saint Vincent och Grenadinerna",
|
|
1268
|
+
"Saint Vincent and the Grenadines",
|
|
1269
|
+
"1",
|
|
1270
|
+
".vc",
|
|
1271
|
+
Continent.NorthAmerica
|
|
1272
|
+
),
|
|
1273
|
+
C("WS", "WSM", 882, "Samoa", "Samoa", "S\u0101moa", "685", ".ws", Continent.Oceania),
|
|
1274
|
+
C("SM", "SMR", 674, "San Marino", "San Marino", "San Marino", "378", ".sm", Continent.Europe),
|
|
1275
|
+
C(
|
|
1276
|
+
"ST",
|
|
1277
|
+
"STP",
|
|
1278
|
+
678,
|
|
1279
|
+
"S\xE3o Tom\xE9 and Pr\xEDncipe",
|
|
1280
|
+
"S\xE3o Tom\xE9 och Pr\xEDncipe",
|
|
1281
|
+
"S\xE3o Tom\xE9 e Pr\xEDncipe",
|
|
1282
|
+
"239",
|
|
1283
|
+
".st",
|
|
1284
|
+
Continent.Africa
|
|
1285
|
+
),
|
|
1286
|
+
C("SA", "SAU", 682, "Saudi Arabia", "Saudiarabien", "\u0627\u0644\u0633\u0639\u0648\u062F\u064A\u0629", "966", ".sa", Continent.Asia),
|
|
1287
|
+
C("SN", "SEN", 686, "Senegal", "Senegal", "S\xE9n\xE9gal", "221", ".sn", Continent.Africa),
|
|
1288
|
+
C("RS", "SRB", 688, "Serbia", "Serbien", "\u0421\u0440\u0431\u0438\u0458\u0430", "381", ".rs", Continent.Europe),
|
|
1289
|
+
C("SC", "SYC", 690, "Seychelles", "Seychellerna", "Seychelles", "248", ".sc", Continent.Africa),
|
|
1290
|
+
C(
|
|
1291
|
+
"SL",
|
|
1292
|
+
"SLE",
|
|
1293
|
+
694,
|
|
1294
|
+
"Sierra Leone",
|
|
1295
|
+
"Sierra Leone",
|
|
1296
|
+
"Sierra Leone",
|
|
1297
|
+
"232",
|
|
1298
|
+
".sl",
|
|
1299
|
+
Continent.Africa
|
|
1300
|
+
),
|
|
1301
|
+
C("SG", "SGP", 702, "Singapore", "Singapore", "Singapore", "65", ".sg", Continent.Asia),
|
|
1302
|
+
C("SK", "SVK", 703, "Slovakia", "Slovakien", "Slovensko", "421", ".sk", Continent.Europe),
|
|
1303
|
+
C("SI", "SVN", 705, "Slovenia", "Slovenien", "Slovenija", "386", ".si", Continent.Europe),
|
|
1304
|
+
C(
|
|
1305
|
+
"SB",
|
|
1306
|
+
"SLB",
|
|
1307
|
+
90,
|
|
1308
|
+
"Solomon Islands",
|
|
1309
|
+
"Salomon\xF6arna",
|
|
1310
|
+
"Solomon Islands",
|
|
1311
|
+
"677",
|
|
1312
|
+
".sb",
|
|
1313
|
+
Continent.Oceania
|
|
1314
|
+
),
|
|
1315
|
+
C("SO", "SOM", 706, "Somalia", "Somalia", "Soomaaliya", "252", ".so", Continent.Africa),
|
|
1316
|
+
C("ZA", "ZAF", 710, "South Africa", "Sydafrika", "Suid-Afrika", "27", ".za", Continent.Africa),
|
|
1317
|
+
C("SS", "SSD", 728, "South Sudan", "Sydsudan", "South Sudan", "211", ".ss", Continent.Africa),
|
|
1318
|
+
C("ES", "ESP", 724, "Spain", "Spanien", "Espa\xF1a", "34", ".es", Continent.Europe),
|
|
1319
|
+
C("LK", "LKA", 144, "Sri Lanka", "Sri Lanka", "\u0DC1\u0DCA\u200D\u0DBB\u0DD3 \u0DBD\u0D82\u0D9A\u0DCF\u0DC0", "94", ".lk", Continent.Asia),
|
|
1320
|
+
C("SD", "SDN", 729, "Sudan", "Sudan", "\u0627\u0644\u0633\u0648\u062F\u0627\u0646", "249", ".sd", Continent.Africa),
|
|
1321
|
+
C("SR", "SUR", 740, "Suriname", "Surinam", "Suriname", "597", ".sr", Continent.SouthAmerica),
|
|
1322
|
+
C("SE", "SWE", 752, "Sweden", "Sverige", "Sverige", "46", ".se", Continent.Europe),
|
|
1323
|
+
C("CH", "CHE", 756, "Switzerland", "Schweiz", "Schweiz", "41", ".ch", Continent.Europe),
|
|
1324
|
+
C("SY", "SYR", 760, "Syria", "Syrien", "\u0633\u0648\u0631\u064A\u0627", "963", ".sy", Continent.Asia),
|
|
1325
|
+
C("TW", "TWN", 158, "Taiwan", "Taiwan", "\u81FA\u7063", "886", ".tw", Continent.Asia),
|
|
1326
|
+
C("TJ", "TJK", 762, "Tajikistan", "Tadzjikistan", "\u0422\u043E\u04B7\u0438\u043A\u0438\u0441\u0442\u043E\u043D", "992", ".tj", Continent.Asia),
|
|
1327
|
+
C("TZ", "TZA", 834, "Tanzania", "Tanzania", "Tanzania", "255", ".tz", Continent.Africa),
|
|
1328
|
+
C("TH", "THA", 764, "Thailand", "Thailand", "\u0E1B\u0E23\u0E30\u0E40\u0E17\u0E28\u0E44\u0E17\u0E22", "66", ".th", Continent.Asia),
|
|
1329
|
+
C("TL", "TLS", 626, "Timor-Leste", "\xD6sttimor", "Timor-Leste", "670", ".tl", Continent.Asia),
|
|
1330
|
+
C("TG", "TGO", 768, "Togo", "Togo", "Togo", "228", ".tg", Continent.Africa),
|
|
1331
|
+
C("TO", "TON", 776, "Tonga", "Tonga", "Tonga", "676", ".to", Continent.Oceania),
|
|
1332
|
+
C(
|
|
1333
|
+
"TT",
|
|
1334
|
+
"TTO",
|
|
1335
|
+
780,
|
|
1336
|
+
"Trinidad and Tobago",
|
|
1337
|
+
"Trinidad och Tobago",
|
|
1338
|
+
"Trinidad and Tobago",
|
|
1339
|
+
"1",
|
|
1340
|
+
".tt",
|
|
1341
|
+
Continent.NorthAmerica
|
|
1342
|
+
),
|
|
1343
|
+
C("TN", "TUN", 788, "Tunisia", "Tunisien", "\u062A\u0648\u0646\u0633", "216", ".tn", Continent.Africa),
|
|
1344
|
+
C("TR", "TUR", 792, "Turkey", "Turkiet", "T\xFCrkiye", "90", ".tr", Continent.Asia),
|
|
1345
|
+
C("TM", "TKM", 795, "Turkmenistan", "Turkmenistan", "T\xFCrkmenistan", "993", ".tm", Continent.Asia),
|
|
1346
|
+
C("TV", "TUV", 798, "Tuvalu", "Tuvalu", "Tuvalu", "688", ".tv", Continent.Oceania),
|
|
1347
|
+
C("UG", "UGA", 800, "Uganda", "Uganda", "Uganda", "256", ".ug", Continent.Africa),
|
|
1348
|
+
C("UA", "UKR", 804, "Ukraine", "Ukraina", "\u0423\u043A\u0440\u0430\u0457\u043D\u0430", "380", ".ua", Continent.Europe),
|
|
1349
|
+
C(
|
|
1350
|
+
"AE",
|
|
1351
|
+
"ARE",
|
|
1352
|
+
784,
|
|
1353
|
+
"United Arab Emirates",
|
|
1354
|
+
"F\xF6renade Arabemiraten",
|
|
1355
|
+
"\u0627\u0644\u0625\u0645\u0627\u0631\u0627\u062A",
|
|
1356
|
+
"971",
|
|
1357
|
+
".ae",
|
|
1358
|
+
Continent.Asia
|
|
1359
|
+
),
|
|
1360
|
+
C(
|
|
1361
|
+
"GB",
|
|
1362
|
+
"GBR",
|
|
1363
|
+
826,
|
|
1364
|
+
"United Kingdom",
|
|
1365
|
+
"Storbritannien",
|
|
1366
|
+
"United Kingdom",
|
|
1367
|
+
"44",
|
|
1368
|
+
".uk",
|
|
1369
|
+
Continent.Europe
|
|
1370
|
+
),
|
|
1371
|
+
C(
|
|
1372
|
+
"US",
|
|
1373
|
+
"USA",
|
|
1374
|
+
840,
|
|
1375
|
+
"United States",
|
|
1376
|
+
"F\xF6renta staterna",
|
|
1377
|
+
"United States",
|
|
1378
|
+
"1",
|
|
1379
|
+
".us",
|
|
1380
|
+
Continent.NorthAmerica
|
|
1381
|
+
),
|
|
1382
|
+
C("UY", "URY", 858, "Uruguay", "Uruguay", "Uruguay", "598", ".uy", Continent.SouthAmerica),
|
|
1383
|
+
C("UZ", "UZB", 860, "Uzbekistan", "Uzbekistan", "O\u02BBzbekiston", "998", ".uz", Continent.Asia),
|
|
1384
|
+
C("VU", "VUT", 548, "Vanuatu", "Vanuatu", "Vanuatu", "678", ".vu", Continent.Oceania),
|
|
1385
|
+
C(
|
|
1386
|
+
"VA",
|
|
1387
|
+
"VAT",
|
|
1388
|
+
336,
|
|
1389
|
+
"Vatican City",
|
|
1390
|
+
"Vatikanstaten",
|
|
1391
|
+
"Citt\xE0 del Vaticano",
|
|
1392
|
+
"379",
|
|
1393
|
+
".va",
|
|
1394
|
+
Continent.Europe
|
|
1395
|
+
),
|
|
1396
|
+
C("VE", "VEN", 862, "Venezuela", "Venezuela", "Venezuela", "58", ".ve", Continent.SouthAmerica),
|
|
1397
|
+
C("VN", "VNM", 704, "Vietnam", "Vietnam", "Vi\u1EC7t Nam", "84", ".vn", Continent.Asia),
|
|
1398
|
+
C("YE", "YEM", 887, "Yemen", "Jemen", "\u0627\u0644\u064A\u0645\u0646", "967", ".ye", Continent.Asia),
|
|
1399
|
+
C("ZM", "ZMB", 894, "Zambia", "Zambia", "Zambia", "260", ".zm", Continent.Africa),
|
|
1400
|
+
C("ZW", "ZWE", 716, "Zimbabwe", "Zimbabwe", "Zimbabwe", "263", ".zw", Continent.Africa),
|
|
1401
|
+
C("AX", "ALA", 248, "\xC5land Islands", "\xC5land", "\xC5land", "358", ".ax", Continent.Europe),
|
|
1402
|
+
C("FO", "FRO", 234, "Faroe Islands", "F\xE4r\xF6arna", "F\xF8royar", "298", ".fo", Continent.Europe),
|
|
1403
|
+
C("XK", "XKX", 0, "Kosovo", "Kosovo", "Kosova", "383", ".xk", Continent.Europe)
|
|
1404
|
+
];
|
|
1405
|
+
|
|
1406
|
+
// src/geography/country-coordinates.ts
|
|
1407
|
+
var COUNTRY_COORDINATES = Object.freeze({
|
|
1408
|
+
AF: [33, 65],
|
|
1409
|
+
AL: [41, 20],
|
|
1410
|
+
DZ: [28, 3],
|
|
1411
|
+
AS: [-14.27, -170.7],
|
|
1412
|
+
AD: [42.5, 1.5],
|
|
1413
|
+
AO: [-12.5, 18.5],
|
|
1414
|
+
AG: [17.05, -61.8],
|
|
1415
|
+
AR: [-34, -64],
|
|
1416
|
+
AM: [40, 45],
|
|
1417
|
+
AW: [12.5, -69.97],
|
|
1418
|
+
AU: [-27, 133],
|
|
1419
|
+
AT: [47.33, 13.33],
|
|
1420
|
+
AZ: [40.5, 47.5],
|
|
1421
|
+
BS: [24.25, -76],
|
|
1422
|
+
BH: [26, 50.55],
|
|
1423
|
+
BD: [24, 90],
|
|
1424
|
+
BB: [13.17, -59.53],
|
|
1425
|
+
BY: [53, 28],
|
|
1426
|
+
BE: [50.83, 4],
|
|
1427
|
+
BZ: [17.25, -88.75],
|
|
1428
|
+
BJ: [9.5, 2.25],
|
|
1429
|
+
BM: [32.33, -64.75],
|
|
1430
|
+
BT: [27.5, 90.5],
|
|
1431
|
+
BO: [-17, -65],
|
|
1432
|
+
BA: [44, 18],
|
|
1433
|
+
BW: [-22, 24],
|
|
1434
|
+
BR: [-10, -55],
|
|
1435
|
+
BN: [4.5, 114.67],
|
|
1436
|
+
BG: [43, 25],
|
|
1437
|
+
BF: [13, -2],
|
|
1438
|
+
BI: [-3.5, 30],
|
|
1439
|
+
CV: [16, -24],
|
|
1440
|
+
KH: [13, 105],
|
|
1441
|
+
CM: [6, 12],
|
|
1442
|
+
CA: [60, -95],
|
|
1443
|
+
CF: [7, 21],
|
|
1444
|
+
TD: [15, 19],
|
|
1445
|
+
CL: [-30, -71],
|
|
1446
|
+
CN: [35, 105],
|
|
1447
|
+
CO: [4, -72],
|
|
1448
|
+
KM: [-12.17, 44.25],
|
|
1449
|
+
CG: [-1, 15],
|
|
1450
|
+
CD: [0, 25],
|
|
1451
|
+
CR: [10, -84],
|
|
1452
|
+
CI: [8, -5],
|
|
1453
|
+
HR: [45.17, 15.5],
|
|
1454
|
+
CU: [21.5, -80],
|
|
1455
|
+
CW: [12.17, -68.98],
|
|
1456
|
+
CY: [35, 33],
|
|
1457
|
+
CZ: [49.75, 15.5],
|
|
1458
|
+
DK: [56, 10],
|
|
1459
|
+
DJ: [11.5, 43],
|
|
1460
|
+
DM: [15.42, -61.33],
|
|
1461
|
+
DO: [19, -70.67],
|
|
1462
|
+
EC: [-2, -77.5],
|
|
1463
|
+
EG: [27, 30],
|
|
1464
|
+
SV: [13.83, -88.92],
|
|
1465
|
+
GQ: [2, 10],
|
|
1466
|
+
ER: [15, 39],
|
|
1467
|
+
EE: [59, 26],
|
|
1468
|
+
SZ: [-26.5, 31.5],
|
|
1469
|
+
ET: [8, 38],
|
|
1470
|
+
FJ: [-18, 175],
|
|
1471
|
+
FI: [64, 26],
|
|
1472
|
+
FR: [46, 2],
|
|
1473
|
+
GA: [-1, 11.75],
|
|
1474
|
+
GM: [13.47, -16.57],
|
|
1475
|
+
GE: [42, 43.5],
|
|
1476
|
+
DE: [51, 9],
|
|
1477
|
+
GH: [8, -2],
|
|
1478
|
+
GI: [36.13, -5.35],
|
|
1479
|
+
GR: [39, 22],
|
|
1480
|
+
GL: [72, -40],
|
|
1481
|
+
GD: [12.12, -61.67],
|
|
1482
|
+
GU: [13.47, 144.78],
|
|
1483
|
+
GT: [15.5, -90.25],
|
|
1484
|
+
GG: [49.45, -2.54],
|
|
1485
|
+
GN: [11, -10],
|
|
1486
|
+
GW: [12, -15],
|
|
1487
|
+
GY: [5, -59],
|
|
1488
|
+
HT: [19, -72.42],
|
|
1489
|
+
HN: [15, -86.5],
|
|
1490
|
+
HK: [22.25, 114.17],
|
|
1491
|
+
HU: [47, 20],
|
|
1492
|
+
IS: [65, -18],
|
|
1493
|
+
IN: [20, 77],
|
|
1494
|
+
ID: [-5, 120],
|
|
1495
|
+
IR: [32, 53],
|
|
1496
|
+
IQ: [33, 44],
|
|
1497
|
+
IE: [53, -8],
|
|
1498
|
+
IM: [54.23, -4.55],
|
|
1499
|
+
IL: [31.5, 34.75],
|
|
1500
|
+
IT: [42.83, 12.83],
|
|
1501
|
+
JM: [18.25, -77.5],
|
|
1502
|
+
JP: [36, 138],
|
|
1503
|
+
JE: [49.21, -2.13],
|
|
1504
|
+
JO: [31, 36],
|
|
1505
|
+
KZ: [48, 68],
|
|
1506
|
+
KE: [1, 38],
|
|
1507
|
+
KI: [1.42, 173],
|
|
1508
|
+
KP: [40, 127],
|
|
1509
|
+
KR: [37, 127.5],
|
|
1510
|
+
KW: [29.34, 47.66],
|
|
1511
|
+
KG: [41, 75],
|
|
1512
|
+
LA: [18, 105],
|
|
1513
|
+
LV: [57, 25],
|
|
1514
|
+
LB: [33.83, 35.83],
|
|
1515
|
+
LS: [-29.5, 28.5],
|
|
1516
|
+
LR: [6.5, -9.5],
|
|
1517
|
+
LY: [25, 17],
|
|
1518
|
+
LI: [47.17, 9.53],
|
|
1519
|
+
LT: [56, 24],
|
|
1520
|
+
LU: [49.75, 6.17],
|
|
1521
|
+
MO: [22.17, 113.55],
|
|
1522
|
+
MG: [-20, 47],
|
|
1523
|
+
MW: [-13.5, 34],
|
|
1524
|
+
MY: [2.5, 112.5],
|
|
1525
|
+
MV: [3.25, 73],
|
|
1526
|
+
ML: [17, -4],
|
|
1527
|
+
MT: [35.83, 14.58],
|
|
1528
|
+
MH: [9, 168],
|
|
1529
|
+
MR: [20, -12],
|
|
1530
|
+
MU: [-20.28, 57.55],
|
|
1531
|
+
MX: [23, -102],
|
|
1532
|
+
FM: [6.92, 158.25],
|
|
1533
|
+
MD: [47, 29],
|
|
1534
|
+
MC: [43.73, 7.42],
|
|
1535
|
+
MN: [46, 105],
|
|
1536
|
+
ME: [42, 19],
|
|
1537
|
+
MA: [32, -5],
|
|
1538
|
+
MZ: [-18.25, 35],
|
|
1539
|
+
MM: [22, 98],
|
|
1540
|
+
NA: [-22, 17],
|
|
1541
|
+
NR: [-0.53, 166.92],
|
|
1542
|
+
NP: [28, 84],
|
|
1543
|
+
NL: [52.5, 5.75],
|
|
1544
|
+
NZ: [-41, 174],
|
|
1545
|
+
NI: [13, -85],
|
|
1546
|
+
NE: [16, 8],
|
|
1547
|
+
NG: [10, 8],
|
|
1548
|
+
MK: [41.83, 22],
|
|
1549
|
+
NO: [62, 10],
|
|
1550
|
+
OM: [21, 57],
|
|
1551
|
+
PK: [30, 70],
|
|
1552
|
+
PW: [7.5, 134.5],
|
|
1553
|
+
PS: [32, 35.25],
|
|
1554
|
+
PA: [9, -80],
|
|
1555
|
+
PG: [-6, 147],
|
|
1556
|
+
PY: [-23, -58],
|
|
1557
|
+
PE: [-10, -76],
|
|
1558
|
+
PH: [13, 122],
|
|
1559
|
+
PL: [52, 20],
|
|
1560
|
+
PT: [39.5, -8],
|
|
1561
|
+
PR: [18.25, -66.5],
|
|
1562
|
+
QA: [25.5, 51.25],
|
|
1563
|
+
RO: [46, 25],
|
|
1564
|
+
RU: [60, 100],
|
|
1565
|
+
RW: [-2, 30],
|
|
1566
|
+
KN: [17.33, -62.75],
|
|
1567
|
+
LC: [13.88, -61.13],
|
|
1568
|
+
VC: [13.25, -61.2],
|
|
1569
|
+
WS: [-13.58, -172.33],
|
|
1570
|
+
SM: [43.77, 12.42],
|
|
1571
|
+
ST: [1, 7],
|
|
1572
|
+
SA: [25, 45],
|
|
1573
|
+
SN: [14, -14],
|
|
1574
|
+
RS: [44, 21],
|
|
1575
|
+
SC: [-4.58, 55.67],
|
|
1576
|
+
SL: [8.5, -11.5],
|
|
1577
|
+
SG: [1.37, 103.8],
|
|
1578
|
+
SK: [48.67, 19.5],
|
|
1579
|
+
SI: [46.12, 14.82],
|
|
1580
|
+
SB: [-8, 159],
|
|
1581
|
+
SO: [10, 49],
|
|
1582
|
+
ZA: [-29, 24],
|
|
1583
|
+
SS: [8, 30],
|
|
1584
|
+
ES: [40, -4],
|
|
1585
|
+
LK: [7, 81],
|
|
1586
|
+
SD: [15, 30],
|
|
1587
|
+
SR: [4, -56],
|
|
1588
|
+
SE: [62, 15],
|
|
1589
|
+
CH: [47, 8],
|
|
1590
|
+
SY: [35, 38],
|
|
1591
|
+
TW: [23.5, 121],
|
|
1592
|
+
TJ: [39, 71],
|
|
1593
|
+
TZ: [-6, 35],
|
|
1594
|
+
TH: [15, 100],
|
|
1595
|
+
TL: [-8.55, 125.73],
|
|
1596
|
+
TG: [8, 1.17],
|
|
1597
|
+
TO: [-20, -175],
|
|
1598
|
+
TT: [11, -61],
|
|
1599
|
+
TN: [34, 9],
|
|
1600
|
+
TR: [39, 35],
|
|
1601
|
+
TM: [40, 60],
|
|
1602
|
+
TV: [-8, 178],
|
|
1603
|
+
UG: [1, 32],
|
|
1604
|
+
UA: [49, 32],
|
|
1605
|
+
AE: [24, 54],
|
|
1606
|
+
GB: [54, -2],
|
|
1607
|
+
US: [38, -97],
|
|
1608
|
+
UY: [-33, -56],
|
|
1609
|
+
UZ: [41, 64],
|
|
1610
|
+
VU: [-16, 167],
|
|
1611
|
+
VA: [41.9, 12.45],
|
|
1612
|
+
VE: [8, -66],
|
|
1613
|
+
VN: [16, 106],
|
|
1614
|
+
YE: [15, 48],
|
|
1615
|
+
ZM: [-15, 30],
|
|
1616
|
+
ZW: [-20, 30],
|
|
1617
|
+
AX: [60.12, 19.9],
|
|
1618
|
+
FO: [62, -7],
|
|
1619
|
+
XK: [42.67, 21.17]
|
|
1620
|
+
});
|
|
1621
|
+
|
|
1622
|
+
// src/geography/country-capital.ts
|
|
1623
|
+
var CountryCapital = class {
|
|
1624
|
+
englishName;
|
|
1625
|
+
localizedName;
|
|
1626
|
+
nativeName;
|
|
1627
|
+
coordinate;
|
|
1628
|
+
/** @internal */
|
|
1629
|
+
constructor(englishName, localizedName, nativeName, coordinate) {
|
|
1630
|
+
this.englishName = englishName;
|
|
1631
|
+
this.localizedName = localizedName;
|
|
1632
|
+
this.nativeName = nativeName;
|
|
1633
|
+
this.coordinate = coordinate;
|
|
1634
|
+
}
|
|
1635
|
+
/** Capital city name in the current display language. */
|
|
1636
|
+
get displayName() {
|
|
1637
|
+
return PrimitivesDefaults.useLocalizedDisplayNames ? this.localizedName : this.englishName;
|
|
1638
|
+
}
|
|
1639
|
+
toString() {
|
|
1640
|
+
return this.displayName;
|
|
1641
|
+
}
|
|
1642
|
+
};
|
|
1643
|
+
|
|
1644
|
+
// src/geography/country-capitals.ts
|
|
1645
|
+
var RAW = {
|
|
1646
|
+
AF: { en: "Kabul", sv: "Kabul", native: "\u06A9\u0627\u0628\u0644", lat: 34.53, lon: 69.17 },
|
|
1647
|
+
AL: { en: "Tirana", sv: "Tirana", native: "Tiran\xEB", lat: 41.33, lon: 19.82 },
|
|
1648
|
+
DZ: { en: "Algiers", sv: "Alger", native: "\u0627\u0644\u062C\u0632\u0627\u0626\u0631", lat: 36.75, lon: 3.04 },
|
|
1649
|
+
AD: {
|
|
1650
|
+
en: "Andorra la Vella",
|
|
1651
|
+
sv: "Andorra la Vella",
|
|
1652
|
+
native: "Andorra la Vella",
|
|
1653
|
+
lat: 42.51,
|
|
1654
|
+
lon: 1.52
|
|
1655
|
+
},
|
|
1656
|
+
AO: { en: "Luanda", sv: "Luanda", native: "Luanda", lat: -8.84, lon: 13.23 },
|
|
1657
|
+
AG: { en: "St. John's", sv: "Saint John's", native: "St. John's", lat: 17.12, lon: -61.85 },
|
|
1658
|
+
AR: { en: "Buenos Aires", sv: "Buenos Aires", native: "Buenos Aires", lat: -34.61, lon: -58.38 },
|
|
1659
|
+
AM: { en: "Yerevan", sv: "Jerevan", native: "\u0535\u0580\u0587\u0561\u0576", lat: 40.18, lon: 44.51 },
|
|
1660
|
+
AU: { en: "Canberra", sv: "Canberra", native: "Canberra", lat: -35.28, lon: 149.13 },
|
|
1661
|
+
AT: { en: "Vienna", sv: "Wien", native: "Wien", lat: 48.21, lon: 16.37 },
|
|
1662
|
+
AZ: { en: "Baku", sv: "Baku", native: "Bak\u0131", lat: 40.41, lon: 49.87 },
|
|
1663
|
+
BS: { en: "Nassau", sv: "Nassau", native: "Nassau", lat: 25.06, lon: -77.34 },
|
|
1664
|
+
BH: { en: "Manama", sv: "Manama", native: "\u0627\u0644\u0645\u0646\u0627\u0645\u0629", lat: 26.23, lon: 50.59 },
|
|
1665
|
+
BD: { en: "Dhaka", sv: "Dhaka", native: "\u09A2\u09BE\u0995\u09BE", lat: 23.71, lon: 90.41 },
|
|
1666
|
+
BB: { en: "Bridgetown", sv: "Bridgetown", native: "Bridgetown", lat: 13.1, lon: -59.62 },
|
|
1667
|
+
BY: { en: "Minsk", sv: "Minsk", native: "\u041C\u0456\u043D\u0441\u043A", lat: 53.9, lon: 27.57 },
|
|
1668
|
+
BE: { en: "Brussels", sv: "Bryssel", native: "Bruxelles", lat: 50.85, lon: 4.35 },
|
|
1669
|
+
BZ: { en: "Belmopan", sv: "Belmopan", native: "Belmopan", lat: 17.25, lon: -88.77 },
|
|
1670
|
+
BJ: { en: "Porto-Novo", sv: "Porto-Novo", native: "Porto-Novo", lat: 6.5, lon: 2.6 },
|
|
1671
|
+
BT: { en: "Thimphu", sv: "Thimphu", native: "\u0F50\u0F72\u0F58\u0F0B\u0F55\u0F74", lat: 27.47, lon: 89.64 },
|
|
1672
|
+
BO: { en: "Sucre", sv: "Sucre", native: "Sucre", lat: -19.04, lon: -65.26 },
|
|
1673
|
+
BA: { en: "Sarajevo", sv: "Sarajevo", native: "Sarajevo", lat: 43.86, lon: 18.41 },
|
|
1674
|
+
BW: { en: "Gaborone", sv: "Gaborone", native: "Gaborone", lat: -24.65, lon: 25.91 },
|
|
1675
|
+
BR: { en: "Bras\xEDlia", sv: "Bras\xEDlia", native: "Bras\xEDlia", lat: -15.79, lon: -47.88 },
|
|
1676
|
+
BN: {
|
|
1677
|
+
en: "Bandar Seri Begawan",
|
|
1678
|
+
sv: "Bandar Seri Begawan",
|
|
1679
|
+
native: "Bandar Seri Begawan",
|
|
1680
|
+
lat: 4.94,
|
|
1681
|
+
lon: 114.95
|
|
1682
|
+
},
|
|
1683
|
+
BG: { en: "Sofia", sv: "Sofia", native: "\u0421\u043E\u0444\u0438\u044F", lat: 42.7, lon: 23.32 },
|
|
1684
|
+
BF: { en: "Ouagadougou", sv: "Ouagadougou", native: "Ouagadougou", lat: 12.37, lon: -1.52 },
|
|
1685
|
+
BI: { en: "Gitega", sv: "Gitega", native: "Gitega", lat: -3.43, lon: 29.93 },
|
|
1686
|
+
CV: { en: "Praia", sv: "Praia", native: "Praia", lat: 14.92, lon: -23.51 },
|
|
1687
|
+
KH: { en: "Phnom Penh", sv: "Phnom Penh", native: "\u1797\u17D2\u1793\u17C6\u1796\u17C1\u1789", lat: 11.56, lon: 104.93 },
|
|
1688
|
+
CM: { en: "Yaound\xE9", sv: "Yaound\xE9", native: "Yaound\xE9", lat: 3.87, lon: 11.52 },
|
|
1689
|
+
CA: { en: "Ottawa", sv: "Ottawa", native: "Ottawa", lat: 45.42, lon: -75.7 },
|
|
1690
|
+
CF: { en: "Bangui", sv: "Bangui", native: "Bangui", lat: 4.37, lon: 18.59 },
|
|
1691
|
+
TD: { en: "N'Djamena", sv: "N'Djamena", native: "N'Djamena", lat: 12.11, lon: 15.05 },
|
|
1692
|
+
CL: { en: "Santiago", sv: "Santiago", native: "Santiago", lat: -33.45, lon: -70.67 },
|
|
1693
|
+
CN: { en: "Beijing", sv: "Peking", native: "\u5317\u4EAC", lat: 39.91, lon: 116.39 },
|
|
1694
|
+
CO: { en: "Bogot\xE1", sv: "Bogot\xE1", native: "Bogot\xE1", lat: 4.71, lon: -74.07 },
|
|
1695
|
+
KM: { en: "Moroni", sv: "Moroni", native: "Moroni", lat: -11.7, lon: 43.26 },
|
|
1696
|
+
CG: { en: "Brazzaville", sv: "Brazzaville", native: "Brazzaville", lat: -4.27, lon: 15.28 },
|
|
1697
|
+
CD: { en: "Kinshasa", sv: "Kinshasa", native: "Kinshasa", lat: -4.32, lon: 15.31 },
|
|
1698
|
+
CR: { en: "San Jos\xE9", sv: "San Jos\xE9", native: "San Jos\xE9", lat: 9.93, lon: -84.08 },
|
|
1699
|
+
CI: { en: "Yamoussoukro", sv: "Yamoussoukro", native: "Yamoussoukro", lat: 6.82, lon: -5.28 },
|
|
1700
|
+
HR: { en: "Zagreb", sv: "Zagreb", native: "Zagreb", lat: 45.81, lon: 15.98 },
|
|
1701
|
+
CU: { en: "Havana", sv: "Havanna", native: "La Habana", lat: 23.13, lon: -82.38 },
|
|
1702
|
+
CY: { en: "Nicosia", sv: "Nicosia", native: "\u039B\u03B5\u03C5\u03BA\u03C9\u03C3\u03AF\u03B1", lat: 35.17, lon: 33.37 },
|
|
1703
|
+
CZ: { en: "Prague", sv: "Prag", native: "Praha", lat: 50.09, lon: 14.42 },
|
|
1704
|
+
DK: { en: "Copenhagen", sv: "K\xF6penhamn", native: "K\xF8benhavn", lat: 55.68, lon: 12.57 },
|
|
1705
|
+
DJ: { en: "Djibouti", sv: "Djibouti", native: "Djibouti", lat: 11.59, lon: 43.15 },
|
|
1706
|
+
DM: { en: "Roseau", sv: "Roseau", native: "Roseau", lat: 15.3, lon: -61.39 },
|
|
1707
|
+
DO: { en: "Santo Domingo", sv: "Santo Domingo", native: "Santo Domingo", lat: 18.47, lon: -69.9 },
|
|
1708
|
+
EC: { en: "Quito", sv: "Quito", native: "Quito", lat: -0.18, lon: -78.47 },
|
|
1709
|
+
EG: { en: "Cairo", sv: "Kairo", native: "\u0627\u0644\u0642\u0627\u0647\u0631\u0629", lat: 30.04, lon: 31.24 },
|
|
1710
|
+
SV: { en: "San Salvador", sv: "San Salvador", native: "San Salvador", lat: 13.69, lon: -89.19 },
|
|
1711
|
+
GQ: { en: "Malabo", sv: "Malabo", native: "Malabo", lat: 3.75, lon: 8.78 },
|
|
1712
|
+
ER: { en: "Asmara", sv: "Asmara", native: "\u12A3\u1235\u1218\u122B", lat: 15.33, lon: 38.93 },
|
|
1713
|
+
EE: { en: "Tallinn", sv: "Tallinn", native: "Tallinn", lat: 59.44, lon: 24.75 },
|
|
1714
|
+
SZ: { en: "Mbabane", sv: "Mbabane", native: "Mbabane", lat: -26.32, lon: 31.13 },
|
|
1715
|
+
ET: { en: "Addis Ababa", sv: "Addis Abeba", native: "\u12A0\u12F2\u1235 \u12A0\u1260\u1263", lat: 9.02, lon: 38.75 },
|
|
1716
|
+
FJ: { en: "Suva", sv: "Suva", native: "Suva", lat: -18.14, lon: 178.44 },
|
|
1717
|
+
FI: { en: "Helsinki", sv: "Helsingfors", native: "Helsinki", lat: 60.17, lon: 24.94 },
|
|
1718
|
+
FR: { en: "Paris", sv: "Paris", native: "Paris", lat: 48.86, lon: 2.35 },
|
|
1719
|
+
GA: { en: "Libreville", sv: "Libreville", native: "Libreville", lat: 0.39, lon: 9.45 },
|
|
1720
|
+
GM: { en: "Banjul", sv: "Banjul", native: "Banjul", lat: 13.45, lon: -16.58 },
|
|
1721
|
+
GE: { en: "Tbilisi", sv: "Tbilisi", native: "\u10D7\u10D1\u10D8\u10DA\u10D8\u10E1\u10D8", lat: 41.69, lon: 44.8 },
|
|
1722
|
+
DE: { en: "Berlin", sv: "Berlin", native: "Berlin", lat: 52.52, lon: 13.41 },
|
|
1723
|
+
GH: { en: "Accra", sv: "Accra", native: "Accra", lat: 5.56, lon: -0.19 },
|
|
1724
|
+
GR: { en: "Athens", sv: "Aten", native: "\u0391\u03B8\u03AE\u03BD\u03B1", lat: 37.98, lon: 23.73 },
|
|
1725
|
+
GD: { en: "St. George's", sv: "Saint George's", native: "St. George's", lat: 12.05, lon: -61.75 },
|
|
1726
|
+
GT: {
|
|
1727
|
+
en: "Guatemala City",
|
|
1728
|
+
sv: "Guatemala City",
|
|
1729
|
+
native: "Ciudad de Guatemala",
|
|
1730
|
+
lat: 14.63,
|
|
1731
|
+
lon: -90.51
|
|
1732
|
+
},
|
|
1733
|
+
GN: { en: "Conakry", sv: "Conakry", native: "Conakry", lat: 9.54, lon: -13.68 },
|
|
1734
|
+
GW: { en: "Bissau", sv: "Bissau", native: "Bissau", lat: 11.86, lon: -15.6 },
|
|
1735
|
+
GY: { en: "Georgetown", sv: "Georgetown", native: "Georgetown", lat: 6.8, lon: -58.16 },
|
|
1736
|
+
HT: { en: "Port-au-Prince", sv: "Port-au-Prince", native: "P\xF2toprens", lat: 18.54, lon: -72.34 },
|
|
1737
|
+
HN: { en: "Tegucigalpa", sv: "Tegucigalpa", native: "Tegucigalpa", lat: 14.1, lon: -87.22 },
|
|
1738
|
+
HK: { en: "Hong Kong", sv: "Hongkong", native: "\u9999\u6E2F", lat: 22.28, lon: 114.16 },
|
|
1739
|
+
HU: { en: "Budapest", sv: "Budapest", native: "Budapest", lat: 47.5, lon: 19.04 },
|
|
1740
|
+
IS: { en: "Reykjavik", sv: "Reykjavik", native: "Reykjav\xEDk", lat: 64.14, lon: -21.9 },
|
|
1741
|
+
IN: { en: "New Delhi", sv: "New Delhi", native: "\u0928\u0908 \u0926\u093F\u0932\u094D\u0932\u0940", lat: 28.61, lon: 77.21 },
|
|
1742
|
+
ID: { en: "Jakarta", sv: "Jakarta", native: "Jakarta", lat: -6.21, lon: 106.85 },
|
|
1743
|
+
IR: { en: "Tehran", sv: "Teheran", native: "\u062A\u0647\u0631\u0627\u0646", lat: 35.69, lon: 51.39 },
|
|
1744
|
+
IQ: { en: "Baghdad", sv: "Bagdad", native: "\u0628\u063A\u062F\u0627\u062F", lat: 33.34, lon: 44.4 },
|
|
1745
|
+
IE: { en: "Dublin", sv: "Dublin", native: "Baile \xC1tha Cliath", lat: 53.35, lon: -6.26 },
|
|
1746
|
+
IL: { en: "Jerusalem", sv: "Jerusalem", native: "\u05D9\u05E8\u05D5\u05E9\u05DC\u05D9\u05DD", lat: 31.77, lon: 35.23 },
|
|
1747
|
+
IT: { en: "Rome", sv: "Rom", native: "Roma", lat: 41.9, lon: 12.5 },
|
|
1748
|
+
JM: { en: "Kingston", sv: "Kingston", native: "Kingston", lat: 18, lon: -76.79 },
|
|
1749
|
+
JP: { en: "Tokyo", sv: "Tokyo", native: "\u6771\u4EAC", lat: 35.68, lon: 139.69 },
|
|
1750
|
+
JO: { en: "Amman", sv: "Amman", native: "\u0639\u0645\u0651\u0627\u0646", lat: 31.95, lon: 35.93 },
|
|
1751
|
+
KZ: { en: "Astana", sv: "Astana", native: "\u0410\u0441\u0442\u0430\u043D\u0430", lat: 51.17, lon: 71.43 },
|
|
1752
|
+
KE: { en: "Nairobi", sv: "Nairobi", native: "Nairobi", lat: -1.29, lon: 36.82 },
|
|
1753
|
+
KI: { en: "Tarawa", sv: "Tarawa", native: "Tarawa", lat: 1.45, lon: 173 },
|
|
1754
|
+
KP: { en: "Pyongyang", sv: "Pyongyang", native: "\uD3C9\uC591", lat: 39.02, lon: 125.75 },
|
|
1755
|
+
KR: { en: "Seoul", sv: "Seoul", native: "\uC11C\uC6B8", lat: 37.57, lon: 126.98 },
|
|
1756
|
+
KW: { en: "Kuwait City", sv: "Kuwait City", native: "\u0645\u062F\u064A\u0646\u0629 \u0627\u0644\u0643\u0648\u064A\u062A", lat: 29.37, lon: 47.98 },
|
|
1757
|
+
KG: { en: "Bishkek", sv: "Bisjkek", native: "\u0411\u0438\u0448\u043A\u0435\u043A", lat: 42.87, lon: 74.59 },
|
|
1758
|
+
LA: { en: "Vientiane", sv: "Vientiane", native: "\u0EA7\u0EBD\u0E87\u0E88\u0EB1\u0E99", lat: 17.97, lon: 102.63 },
|
|
1759
|
+
LV: { en: "Riga", sv: "Riga", native: "R\u012Bga", lat: 56.95, lon: 24.11 },
|
|
1760
|
+
LB: { en: "Beirut", sv: "Beirut", native: "\u0628\u064A\u0631\u0648\u062A", lat: 33.89, lon: 35.5 },
|
|
1761
|
+
LS: { en: "Maseru", sv: "Maseru", native: "Maseru", lat: -29.31, lon: 27.48 },
|
|
1762
|
+
LR: { en: "Monrovia", sv: "Monrovia", native: "Monrovia", lat: 6.3, lon: -10.8 },
|
|
1763
|
+
LY: { en: "Tripoli", sv: "Tripoli", native: "\u0637\u0631\u0627\u0628\u0644\u0633", lat: 32.9, lon: 13.18 },
|
|
1764
|
+
LI: { en: "Vaduz", sv: "Vaduz", native: "Vaduz", lat: 47.14, lon: 9.52 },
|
|
1765
|
+
LT: { en: "Vilnius", sv: "Vilnius", native: "Vilnius", lat: 54.69, lon: 25.28 },
|
|
1766
|
+
LU: { en: "Luxembourg City", sv: "Luxemburg", native: "L\xEBtzebuerg", lat: 49.61, lon: 6.13 },
|
|
1767
|
+
MO: { en: "Macao", sv: "Macao", native: "\u6FB3\u9580", lat: 22.2, lon: 113.54 },
|
|
1768
|
+
MG: { en: "Antananarivo", sv: "Antananarivo", native: "Antananarivo", lat: -18.91, lon: 47.53 },
|
|
1769
|
+
MW: { en: "Lilongwe", sv: "Lilongwe", native: "Lilongwe", lat: -13.97, lon: 33.79 },
|
|
1770
|
+
MY: { en: "Kuala Lumpur", sv: "Kuala Lumpur", native: "Kuala Lumpur", lat: 3.14, lon: 101.69 },
|
|
1771
|
+
MV: { en: "Mal\xE9", sv: "Mal\xE9", native: "\u0789\u07A7\u078D\u07AC", lat: 4.18, lon: 73.51 },
|
|
1772
|
+
ML: { en: "Bamako", sv: "Bamako", native: "Bamako", lat: 12.65, lon: -8 },
|
|
1773
|
+
MT: { en: "Valletta", sv: "Valletta", native: "Valletta", lat: 35.9, lon: 14.51 },
|
|
1774
|
+
MH: { en: "Majuro", sv: "Majuro", native: "Majuro", lat: 7.09, lon: 171.38 },
|
|
1775
|
+
MR: { en: "Nouakchott", sv: "Nouakchott", native: "\u0646\u0648\u0627\u0643\u0634\u0648\u0637", lat: 18.09, lon: -15.98 },
|
|
1776
|
+
MU: { en: "Port Louis", sv: "Port Louis", native: "Port Louis", lat: -20.16, lon: 57.5 },
|
|
1777
|
+
MX: { en: "Mexico City", sv: "Mexico City", native: "Ciudad de M\xE9xico", lat: 19.43, lon: -99.13 },
|
|
1778
|
+
FM: { en: "Palikir", sv: "Palikir", native: "Palikir", lat: 6.92, lon: 158.16 },
|
|
1779
|
+
MD: { en: "Chi\u0219in\u0103u", sv: "Chi\u0219in\u0103u", native: "Chi\u0219in\u0103u", lat: 47.01, lon: 28.86 },
|
|
1780
|
+
MC: { en: "Monaco", sv: "Monaco", native: "Monaco", lat: 43.73, lon: 7.42 },
|
|
1781
|
+
MN: { en: "Ulaanbaatar", sv: "Ulaanbaatar", native: "\u0423\u043B\u0430\u0430\u043D\u0431\u0430\u0430\u0442\u0430\u0440", lat: 47.91, lon: 106.91 },
|
|
1782
|
+
ME: { en: "Podgorica", sv: "Podgorica", native: "Podgorica", lat: 42.44, lon: 19.26 },
|
|
1783
|
+
MA: { en: "Rabat", sv: "Rabat", native: "\u0627\u0644\u0631\u0628\u0627\u0637", lat: 34.01, lon: -6.84 },
|
|
1784
|
+
MZ: { en: "Maputo", sv: "Maputo", native: "Maputo", lat: -25.97, lon: 32.57 },
|
|
1785
|
+
MM: { en: "Naypyidaw", sv: "Naypyidaw", native: "\u1014\u1031\u1015\u103C\u100A\u103A\u1010\u1031\u102C\u103A", lat: 19.76, lon: 96.07 },
|
|
1786
|
+
NA: { en: "Windhoek", sv: "Windhoek", native: "Windhoek", lat: -22.57, lon: 17.08 },
|
|
1787
|
+
NR: { en: "Yaren", sv: "Yaren", native: "Yaren", lat: -0.55, lon: 166.93 },
|
|
1788
|
+
NP: { en: "Kathmandu", sv: "Kathmandu", native: "\u0915\u093E\u0920\u092E\u093E\u0921\u094C\u0902", lat: 27.7, lon: 85.32 },
|
|
1789
|
+
NL: { en: "Amsterdam", sv: "Amsterdam", native: "Amsterdam", lat: 52.37, lon: 4.9 },
|
|
1790
|
+
NZ: { en: "Wellington", sv: "Wellington", native: "Wellington", lat: -41.29, lon: 174.78 },
|
|
1791
|
+
NI: { en: "Managua", sv: "Managua", native: "Managua", lat: 12.15, lon: -86.27 },
|
|
1792
|
+
NE: { en: "Niamey", sv: "Niamey", native: "Niamey", lat: 13.51, lon: 2.11 },
|
|
1793
|
+
NG: { en: "Abuja", sv: "Abuja", native: "Abuja", lat: 9.06, lon: 7.49 },
|
|
1794
|
+
MK: { en: "Skopje", sv: "Skopje", native: "\u0421\u043A\u043E\u043F\u0458\u0435", lat: 42, lon: 21.43 },
|
|
1795
|
+
NO: { en: "Oslo", sv: "Oslo", native: "Oslo", lat: 59.91, lon: 10.75 },
|
|
1796
|
+
OM: { en: "Muscat", sv: "Muskat", native: "\u0645\u0633\u0642\u0637", lat: 23.59, lon: 58.54 },
|
|
1797
|
+
PK: { en: "Islamabad", sv: "Islamabad", native: "\u0627\u0633\u0644\u0627\u0645 \u0622\u0628\u0627\u062F", lat: 33.69, lon: 73.04 },
|
|
1798
|
+
PW: { en: "Ngerulmud", sv: "Ngerulmud", native: "Ngerulmud", lat: 7.5, lon: 134.62 },
|
|
1799
|
+
PS: { en: "Ramallah", sv: "Ramallah", native: "\u0631\u0627\u0645 \u0627\u0644\u0644\u0647", lat: 31.9, lon: 35.2 },
|
|
1800
|
+
PA: { en: "Panama City", sv: "Panama City", native: "Ciudad de Panam\xE1", lat: 8.98, lon: -79.52 },
|
|
1801
|
+
PG: { en: "Port Moresby", sv: "Port Moresby", native: "Port Moresby", lat: -9.48, lon: 147.15 },
|
|
1802
|
+
PY: { en: "Asunci\xF3n", sv: "Asunci\xF3n", native: "Asunci\xF3n", lat: -25.26, lon: -57.58 },
|
|
1803
|
+
PE: { en: "Lima", sv: "Lima", native: "Lima", lat: -12.05, lon: -77.04 },
|
|
1804
|
+
PH: { en: "Manila", sv: "Manila", native: "Maynila", lat: 14.6, lon: 120.98 },
|
|
1805
|
+
PL: { en: "Warsaw", sv: "Warszawa", native: "Warszawa", lat: 52.23, lon: 21.01 },
|
|
1806
|
+
PT: { en: "Lisbon", sv: "Lissabon", native: "Lisboa", lat: 38.72, lon: -9.14 },
|
|
1807
|
+
PR: { en: "San Juan", sv: "San Juan", native: "San Juan", lat: 18.47, lon: -66.11 },
|
|
1808
|
+
QA: { en: "Doha", sv: "Doha", native: "\u0627\u0644\u062F\u0648\u062D\u0629", lat: 25.29, lon: 51.53 },
|
|
1809
|
+
RO: { en: "Bucharest", sv: "Bukarest", native: "Bucure\u0219ti", lat: 44.43, lon: 26.1 },
|
|
1810
|
+
RU: { en: "Moscow", sv: "Moskva", native: "\u041C\u043E\u0441\u043A\u0432\u0430", lat: 55.76, lon: 37.62 },
|
|
1811
|
+
RW: { en: "Kigali", sv: "Kigali", native: "Kigali", lat: -1.94, lon: 30.06 },
|
|
1812
|
+
KN: { en: "Basseterre", sv: "Basseterre", native: "Basseterre", lat: 17.3, lon: -62.72 },
|
|
1813
|
+
LC: { en: "Castries", sv: "Castries", native: "Castries", lat: 14.01, lon: -61 },
|
|
1814
|
+
VC: { en: "Kingstown", sv: "Kingstown", native: "Kingstown", lat: 13.15, lon: -61.22 },
|
|
1815
|
+
WS: { en: "Apia", sv: "Apia", native: "Apia", lat: -13.83, lon: -171.76 },
|
|
1816
|
+
SM: { en: "San Marino", sv: "San Marino", native: "San Marino", lat: 43.94, lon: 12.45 },
|
|
1817
|
+
ST: { en: "S\xE3o Tom\xE9", sv: "S\xE3o Tom\xE9", native: "S\xE3o Tom\xE9", lat: 0.34, lon: 6.73 },
|
|
1818
|
+
SA: { en: "Riyadh", sv: "Riyadh", native: "\u0627\u0644\u0631\u064A\u0627\u0636", lat: 24.69, lon: 46.72 },
|
|
1819
|
+
SN: { en: "Dakar", sv: "Dakar", native: "Dakar", lat: 14.69, lon: -17.44 },
|
|
1820
|
+
RS: { en: "Belgrade", sv: "Belgrad", native: "\u0411\u0435\u043E\u0433\u0440\u0430\u0434", lat: 44.82, lon: 20.46 },
|
|
1821
|
+
SC: { en: "Victoria", sv: "Victoria", native: "Victoria", lat: -4.62, lon: 55.45 },
|
|
1822
|
+
SL: { en: "Freetown", sv: "Freetown", native: "Freetown", lat: 8.48, lon: -13.23 },
|
|
1823
|
+
SG: { en: "Singapore", sv: "Singapore", native: "Singapore", lat: 1.29, lon: 103.85 },
|
|
1824
|
+
SK: { en: "Bratislava", sv: "Bratislava", native: "Bratislava", lat: 48.14, lon: 17.11 },
|
|
1825
|
+
SI: { en: "Ljubljana", sv: "Ljubljana", native: "Ljubljana", lat: 46.05, lon: 14.51 },
|
|
1826
|
+
SB: { en: "Honiara", sv: "Honiara", native: "Honiara", lat: -9.43, lon: 159.96 },
|
|
1827
|
+
SO: { en: "Mogadishu", sv: "Mogadishu", native: "Muqdisho", lat: 2.05, lon: 45.32 },
|
|
1828
|
+
ZA: { en: "Pretoria", sv: "Pretoria", native: "Pretoria", lat: -25.75, lon: 28.19 },
|
|
1829
|
+
SS: { en: "Juba", sv: "Juba", native: "Juba", lat: 4.85, lon: 31.58 },
|
|
1830
|
+
ES: { en: "Madrid", sv: "Madrid", native: "Madrid", lat: 40.42, lon: -3.7 },
|
|
1831
|
+
LK: {
|
|
1832
|
+
en: "Sri Jayawardenepura Kotte",
|
|
1833
|
+
sv: "Sri Jayawardenepura Kotte",
|
|
1834
|
+
native: "\u0DC1\u0DCA\u200D\u0DBB\u0DD3 \u0DA2\u0DBA\u0DC0\u0DBB\u0DCA\u0DB0\u0DB1\u0DB4\u0DD4\u0DBB \u0D9A\u0DDD\u0DA7\u0DCA\u0DA7\u0DDA",
|
|
1835
|
+
lat: 6.89,
|
|
1836
|
+
lon: 79.92
|
|
1837
|
+
},
|
|
1838
|
+
SD: { en: "Khartoum", sv: "Khartoum", native: "\u0627\u0644\u062E\u0631\u0637\u0648\u0645", lat: 15.59, lon: 32.53 },
|
|
1839
|
+
SR: { en: "Paramaribo", sv: "Paramaribo", native: "Paramaribo", lat: 5.83, lon: -55.17 },
|
|
1840
|
+
SE: { en: "Stockholm", sv: "Stockholm", native: "Stockholm", lat: 59.33, lon: 18.07 },
|
|
1841
|
+
CH: { en: "Bern", sv: "Bern", native: "Bern", lat: 46.95, lon: 7.45 },
|
|
1842
|
+
SY: { en: "Damascus", sv: "Damaskus", native: "\u062F\u0645\u0634\u0642", lat: 33.51, lon: 36.29 },
|
|
1843
|
+
TW: { en: "Taipei", sv: "Taipei", native: "\u81FA\u5317", lat: 25.03, lon: 121.57 },
|
|
1844
|
+
TJ: { en: "Dushanbe", sv: "Dusjanbe", native: "\u0414\u0443\u0448\u0430\u043D\u0431\u0435", lat: 38.56, lon: 68.77 },
|
|
1845
|
+
TZ: { en: "Dodoma", sv: "Dodoma", native: "Dodoma", lat: -6.16, lon: 35.75 },
|
|
1846
|
+
TH: { en: "Bangkok", sv: "Bangkok", native: "\u0E01\u0E23\u0E38\u0E07\u0E40\u0E17\u0E1E\u0E21\u0E2B\u0E32\u0E19\u0E04\u0E23", lat: 13.76, lon: 100.5 },
|
|
1847
|
+
TL: { en: "Dili", sv: "Dili", native: "Dili", lat: -8.56, lon: 125.57 },
|
|
1848
|
+
TG: { en: "Lom\xE9", sv: "Lom\xE9", native: "Lom\xE9", lat: 6.14, lon: 1.21 },
|
|
1849
|
+
TO: { en: "Nuku\u02BBalofa", sv: "Nuku\u02BBalofa", native: "Nuku\u02BBalofa", lat: -21.21, lon: -175.2 },
|
|
1850
|
+
TT: {
|
|
1851
|
+
en: "Port of Spain",
|
|
1852
|
+
sv: "Port of Spain",
|
|
1853
|
+
native: "Port of Spain",
|
|
1854
|
+
lat: 10.66,
|
|
1855
|
+
lon: -61.51
|
|
1856
|
+
},
|
|
1857
|
+
TN: { en: "Tunis", sv: "Tunis", native: "\u062A\u0648\u0646\u0633", lat: 36.81, lon: 10.17 },
|
|
1858
|
+
TR: { en: "Ankara", sv: "Ankara", native: "Ankara", lat: 39.93, lon: 32.86 },
|
|
1859
|
+
TM: { en: "Ashgabat", sv: "Asjchabad", native: "A\u015Fgabat", lat: 37.95, lon: 58.38 },
|
|
1860
|
+
TV: { en: "Funafuti", sv: "Funafuti", native: "Funafuti", lat: -8.52, lon: 179.2 },
|
|
1861
|
+
UG: { en: "Kampala", sv: "Kampala", native: "Kampala", lat: 0.31, lon: 32.58 },
|
|
1862
|
+
UA: { en: "Kyiv", sv: "Kiev", native: "\u041A\u0438\u0457\u0432", lat: 50.45, lon: 30.52 },
|
|
1863
|
+
AE: { en: "Abu Dhabi", sv: "Abu Dhabi", native: "\u0623\u0628\u0648 \u0638\u0628\u064A", lat: 24.45, lon: 54.65 },
|
|
1864
|
+
GB: { en: "London", sv: "London", native: "London", lat: 51.51, lon: -0.13 },
|
|
1865
|
+
US: {
|
|
1866
|
+
en: "Washington, D.C.",
|
|
1867
|
+
sv: "Washington, D.C.",
|
|
1868
|
+
native: "Washington, D.C.",
|
|
1869
|
+
lat: 38.9,
|
|
1870
|
+
lon: -77.04
|
|
1871
|
+
},
|
|
1872
|
+
UY: { en: "Montevideo", sv: "Montevideo", native: "Montevideo", lat: -34.88, lon: -56.19 },
|
|
1873
|
+
UZ: { en: "Tashkent", sv: "Tasjkent", native: "Toshkent", lat: 41.3, lon: 69.28 },
|
|
1874
|
+
VU: { en: "Port Vila", sv: "Port Vila", native: "Port Vila", lat: -17.74, lon: 168.31 },
|
|
1875
|
+
VA: {
|
|
1876
|
+
en: "Vatican City",
|
|
1877
|
+
sv: "Vatikanstaden",
|
|
1878
|
+
native: "Citt\xE0 del Vaticano",
|
|
1879
|
+
lat: 41.9,
|
|
1880
|
+
lon: 12.45
|
|
1881
|
+
},
|
|
1882
|
+
VE: { en: "Caracas", sv: "Caracas", native: "Caracas", lat: 10.49, lon: -66.9 },
|
|
1883
|
+
VN: { en: "Hanoi", sv: "Hanoi", native: "H\xE0 N\u1ED9i", lat: 21.03, lon: 105.85 },
|
|
1884
|
+
YE: { en: "Sana'a", sv: "Sana'a", native: "\u0635\u0646\u0639\u0627\u0621", lat: 15.35, lon: 44.21 },
|
|
1885
|
+
ZM: { en: "Lusaka", sv: "Lusaka", native: "Lusaka", lat: -15.39, lon: 28.32 },
|
|
1886
|
+
ZW: { en: "Harare", sv: "Harare", native: "Harare", lat: -17.83, lon: 31.05 },
|
|
1887
|
+
AX: { en: "Mariehamn", sv: "Mariehamn", native: "Mariehamn", lat: 60.1, lon: 19.94 },
|
|
1888
|
+
FO: { en: "T\xF3rshavn", sv: "Torshamn", native: "T\xF3rshavn", lat: 62.01, lon: -6.77 },
|
|
1889
|
+
XK: { en: "Pristina", sv: "Pristina", native: "Prishtin\xEB", lat: 42.66, lon: 21.17 },
|
|
1890
|
+
GI: { en: "Gibraltar", sv: "Gibraltar", native: "Gibraltar", lat: 36.14, lon: -5.35 },
|
|
1891
|
+
GL: { en: "Nuuk", sv: "Nuuk", native: "Nuuk", lat: 64.17, lon: -51.74 },
|
|
1892
|
+
GG: {
|
|
1893
|
+
en: "St. Peter Port",
|
|
1894
|
+
sv: "Saint Peter Port",
|
|
1895
|
+
native: "St. Peter Port",
|
|
1896
|
+
lat: 49.46,
|
|
1897
|
+
lon: -2.54
|
|
1898
|
+
},
|
|
1899
|
+
IM: { en: "Douglas", sv: "Douglas", native: "Douglas", lat: 54.15, lon: -4.48 },
|
|
1900
|
+
JE: { en: "St. Helier", sv: "Saint Helier", native: "St. Helier", lat: 49.19, lon: -2.1 }
|
|
1901
|
+
};
|
|
1902
|
+
function getCountryCapital(alpha2) {
|
|
1903
|
+
const r = RAW[alpha2];
|
|
1904
|
+
if (!r) return null;
|
|
1905
|
+
return new CountryCapital(r.en, r.sv, r.native, GeoCoordinate.create(r.lat, r.lon));
|
|
1906
|
+
}
|
|
1907
|
+
|
|
1908
|
+
// src/geography/country-metadata.ts
|
|
1909
|
+
var set = (codes) => {
|
|
1910
|
+
const s = /* @__PURE__ */ new Set();
|
|
1911
|
+
for (const c of codes) s.add(c.toUpperCase());
|
|
1912
|
+
return s;
|
|
1913
|
+
};
|
|
1914
|
+
var EU_COUNTRIES = set([
|
|
1915
|
+
"AT",
|
|
1916
|
+
"BE",
|
|
1917
|
+
"BG",
|
|
1918
|
+
"HR",
|
|
1919
|
+
"CY",
|
|
1920
|
+
"CZ",
|
|
1921
|
+
"DK",
|
|
1922
|
+
"EE",
|
|
1923
|
+
"FI",
|
|
1924
|
+
"FR",
|
|
1925
|
+
"DE",
|
|
1926
|
+
"GR",
|
|
1927
|
+
"HU",
|
|
1928
|
+
"IE",
|
|
1929
|
+
"IT",
|
|
1930
|
+
"LV",
|
|
1931
|
+
"LT",
|
|
1932
|
+
"LU",
|
|
1933
|
+
"MT",
|
|
1934
|
+
"NL",
|
|
1935
|
+
"PL",
|
|
1936
|
+
"PT",
|
|
1937
|
+
"RO",
|
|
1938
|
+
"SK",
|
|
1939
|
+
"SI",
|
|
1940
|
+
"ES",
|
|
1941
|
+
"SE"
|
|
1942
|
+
]);
|
|
1943
|
+
var EEA_COUNTRIES = set([
|
|
1944
|
+
"AT",
|
|
1945
|
+
"BE",
|
|
1946
|
+
"BG",
|
|
1947
|
+
"HR",
|
|
1948
|
+
"CY",
|
|
1949
|
+
"CZ",
|
|
1950
|
+
"DK",
|
|
1951
|
+
"EE",
|
|
1952
|
+
"FI",
|
|
1953
|
+
"FR",
|
|
1954
|
+
"DE",
|
|
1955
|
+
"GR",
|
|
1956
|
+
"HU",
|
|
1957
|
+
"IE",
|
|
1958
|
+
"IT",
|
|
1959
|
+
"LV",
|
|
1960
|
+
"LT",
|
|
1961
|
+
"LU",
|
|
1962
|
+
"MT",
|
|
1963
|
+
"NL",
|
|
1964
|
+
"PL",
|
|
1965
|
+
"PT",
|
|
1966
|
+
"RO",
|
|
1967
|
+
"SK",
|
|
1968
|
+
"SI",
|
|
1969
|
+
"ES",
|
|
1970
|
+
"SE",
|
|
1971
|
+
"IS",
|
|
1972
|
+
"LI",
|
|
1973
|
+
"NO"
|
|
1974
|
+
]);
|
|
1975
|
+
var SCHENGEN_COUNTRIES = set([
|
|
1976
|
+
"AT",
|
|
1977
|
+
"BE",
|
|
1978
|
+
"BG",
|
|
1979
|
+
"HR",
|
|
1980
|
+
"CZ",
|
|
1981
|
+
"DK",
|
|
1982
|
+
"EE",
|
|
1983
|
+
"FI",
|
|
1984
|
+
"FR",
|
|
1985
|
+
"DE",
|
|
1986
|
+
"GR",
|
|
1987
|
+
"HU",
|
|
1988
|
+
"IT",
|
|
1989
|
+
"LV",
|
|
1990
|
+
"LT",
|
|
1991
|
+
"LU",
|
|
1992
|
+
"MT",
|
|
1993
|
+
"NL",
|
|
1994
|
+
"PL",
|
|
1995
|
+
"PT",
|
|
1996
|
+
"RO",
|
|
1997
|
+
"SK",
|
|
1998
|
+
"SI",
|
|
1999
|
+
"ES",
|
|
2000
|
+
"SE",
|
|
2001
|
+
"IS",
|
|
2002
|
+
"LI",
|
|
2003
|
+
"NO",
|
|
2004
|
+
"CH"
|
|
2005
|
+
]);
|
|
2006
|
+
var NORDIC_COUNTRIES = set(["DK", "FI", "IS", "NO", "SE"]);
|
|
2007
|
+
var SEPA_COUNTRIES = set([
|
|
2008
|
+
"AT",
|
|
2009
|
+
"BE",
|
|
2010
|
+
"BG",
|
|
2011
|
+
"HR",
|
|
2012
|
+
"CY",
|
|
2013
|
+
"CZ",
|
|
2014
|
+
"DK",
|
|
2015
|
+
"EE",
|
|
2016
|
+
"FI",
|
|
2017
|
+
"FR",
|
|
2018
|
+
"DE",
|
|
2019
|
+
"GR",
|
|
2020
|
+
"HU",
|
|
2021
|
+
"IE",
|
|
2022
|
+
"IT",
|
|
2023
|
+
"LV",
|
|
2024
|
+
"LT",
|
|
2025
|
+
"LU",
|
|
2026
|
+
"MT",
|
|
2027
|
+
"NL",
|
|
2028
|
+
"PL",
|
|
2029
|
+
"PT",
|
|
2030
|
+
"RO",
|
|
2031
|
+
"SK",
|
|
2032
|
+
"SI",
|
|
2033
|
+
"ES",
|
|
2034
|
+
"SE",
|
|
2035
|
+
"IS",
|
|
2036
|
+
"LI",
|
|
2037
|
+
"NO",
|
|
2038
|
+
"AL",
|
|
2039
|
+
"AD",
|
|
2040
|
+
"MD",
|
|
2041
|
+
"MC",
|
|
2042
|
+
"ME",
|
|
2043
|
+
"MK",
|
|
2044
|
+
"SM",
|
|
2045
|
+
"RS",
|
|
2046
|
+
"CH",
|
|
2047
|
+
"GB",
|
|
2048
|
+
"VA",
|
|
2049
|
+
"GG",
|
|
2050
|
+
"IM",
|
|
2051
|
+
"JE"
|
|
2052
|
+
]);
|
|
2053
|
+
var COUNTRY_CURRENCIES = Object.freeze({
|
|
2054
|
+
AF: ["AFN"],
|
|
2055
|
+
AL: ["ALL"],
|
|
2056
|
+
DZ: ["DZD"],
|
|
2057
|
+
AS: ["USD"],
|
|
2058
|
+
AD: ["EUR"],
|
|
2059
|
+
AO: ["AOA"],
|
|
2060
|
+
AG: ["XCD"],
|
|
2061
|
+
AR: ["ARS"],
|
|
2062
|
+
AM: ["AMD"],
|
|
2063
|
+
AW: ["AWG"],
|
|
2064
|
+
AU: ["AUD"],
|
|
2065
|
+
AT: ["EUR"],
|
|
2066
|
+
AZ: ["AZN"],
|
|
2067
|
+
BS: ["BSD"],
|
|
2068
|
+
BH: ["BHD"],
|
|
2069
|
+
BD: ["BDT"],
|
|
2070
|
+
BB: ["BBD"],
|
|
2071
|
+
BY: ["BYN"],
|
|
2072
|
+
BE: ["EUR"],
|
|
2073
|
+
BZ: ["BZD"],
|
|
2074
|
+
BJ: ["XOF"],
|
|
2075
|
+
BM: ["BMD"],
|
|
2076
|
+
BT: ["BTN"],
|
|
2077
|
+
BO: ["BOB"],
|
|
2078
|
+
BA: ["BAM"],
|
|
2079
|
+
BW: ["BWP"],
|
|
2080
|
+
BR: ["BRL"],
|
|
2081
|
+
BN: ["BND"],
|
|
2082
|
+
BG: ["BGN"],
|
|
2083
|
+
BF: ["XOF"],
|
|
2084
|
+
BI: ["BIF"],
|
|
2085
|
+
CV: ["CVE"],
|
|
2086
|
+
KH: ["KHR"],
|
|
2087
|
+
CM: ["XAF"],
|
|
2088
|
+
CA: ["CAD"],
|
|
2089
|
+
CF: ["XAF"],
|
|
2090
|
+
TD: ["XAF"],
|
|
2091
|
+
CL: ["CLP"],
|
|
2092
|
+
CN: ["CNY"],
|
|
2093
|
+
CO: ["COP"],
|
|
2094
|
+
KM: ["KMF"],
|
|
2095
|
+
CG: ["XAF"],
|
|
2096
|
+
CD: ["CDF"],
|
|
2097
|
+
CR: ["CRC"],
|
|
2098
|
+
CI: ["XOF"],
|
|
2099
|
+
HR: ["EUR"],
|
|
2100
|
+
CU: ["CUP"],
|
|
2101
|
+
CW: ["ANG"],
|
|
2102
|
+
CY: ["EUR"],
|
|
2103
|
+
CZ: ["CZK"],
|
|
2104
|
+
DK: ["DKK"],
|
|
2105
|
+
DJ: ["DJF"],
|
|
2106
|
+
DM: ["XCD"],
|
|
2107
|
+
DO: ["DOP"],
|
|
2108
|
+
EC: ["USD"],
|
|
2109
|
+
EG: ["EGP"],
|
|
2110
|
+
SV: ["USD"],
|
|
2111
|
+
GQ: ["XAF"],
|
|
2112
|
+
ER: ["ERN"],
|
|
2113
|
+
EE: ["EUR"],
|
|
2114
|
+
SZ: ["SZL"],
|
|
2115
|
+
ET: ["ETB"],
|
|
2116
|
+
FJ: ["FJD"],
|
|
2117
|
+
FI: ["EUR"],
|
|
2118
|
+
FR: ["EUR"],
|
|
2119
|
+
GA: ["XAF"],
|
|
2120
|
+
GM: ["GMD"],
|
|
2121
|
+
GE: ["GEL"],
|
|
2122
|
+
DE: ["EUR"],
|
|
2123
|
+
GH: ["GHS"],
|
|
2124
|
+
GI: ["GIP"],
|
|
2125
|
+
GR: ["EUR"],
|
|
2126
|
+
GL: ["DKK"],
|
|
2127
|
+
GD: ["XCD"],
|
|
2128
|
+
GU: ["USD"],
|
|
2129
|
+
GT: ["GTQ"],
|
|
2130
|
+
GG: ["GBP"],
|
|
2131
|
+
GN: ["GNF"],
|
|
2132
|
+
GW: ["XOF"],
|
|
2133
|
+
GY: ["GYD"],
|
|
2134
|
+
HT: ["HTG"],
|
|
2135
|
+
HN: ["HNL"],
|
|
2136
|
+
HK: ["HKD"],
|
|
2137
|
+
HU: ["HUF"],
|
|
2138
|
+
IS: ["ISK"],
|
|
2139
|
+
IN: ["INR"],
|
|
2140
|
+
ID: ["IDR"],
|
|
2141
|
+
IR: ["IRR"],
|
|
2142
|
+
IQ: ["IQD"],
|
|
2143
|
+
IE: ["EUR"],
|
|
2144
|
+
IM: ["GBP"],
|
|
2145
|
+
IL: ["ILS"],
|
|
2146
|
+
IT: ["EUR"],
|
|
2147
|
+
JM: ["JMD"],
|
|
2148
|
+
JP: ["JPY"],
|
|
2149
|
+
JE: ["GBP"],
|
|
2150
|
+
JO: ["JOD"],
|
|
2151
|
+
KZ: ["KZT"],
|
|
2152
|
+
KE: ["KES"],
|
|
2153
|
+
KI: ["AUD"],
|
|
2154
|
+
KP: ["KPW"],
|
|
2155
|
+
KR: ["KRW"],
|
|
2156
|
+
KW: ["KWD"],
|
|
2157
|
+
KG: ["KGS"],
|
|
2158
|
+
LA: ["LAK"],
|
|
2159
|
+
LV: ["EUR"],
|
|
2160
|
+
LB: ["LBP"],
|
|
2161
|
+
LS: ["LSL"],
|
|
2162
|
+
LR: ["LRD"],
|
|
2163
|
+
LY: ["LYD"],
|
|
2164
|
+
LI: ["CHF"],
|
|
2165
|
+
LT: ["EUR"],
|
|
2166
|
+
LU: ["EUR"],
|
|
2167
|
+
MO: ["MOP"],
|
|
2168
|
+
MG: ["MGA"],
|
|
2169
|
+
MW: ["MWK"],
|
|
2170
|
+
MY: ["MYR"],
|
|
2171
|
+
MV: ["MVR"],
|
|
2172
|
+
ML: ["XOF"],
|
|
2173
|
+
MT: ["EUR"],
|
|
2174
|
+
MH: ["USD"],
|
|
2175
|
+
MR: ["MRU"],
|
|
2176
|
+
MU: ["MUR"],
|
|
2177
|
+
MX: ["MXN"],
|
|
2178
|
+
FM: ["USD"],
|
|
2179
|
+
MD: ["MDL"],
|
|
2180
|
+
MC: ["EUR"],
|
|
2181
|
+
MN: ["MNT"],
|
|
2182
|
+
ME: ["EUR"],
|
|
2183
|
+
MA: ["MAD"],
|
|
2184
|
+
MZ: ["MZN"],
|
|
2185
|
+
MM: ["MMK"],
|
|
2186
|
+
NA: ["NAD"],
|
|
2187
|
+
NR: ["AUD"],
|
|
2188
|
+
NP: ["NPR"],
|
|
2189
|
+
NL: ["EUR"],
|
|
2190
|
+
NZ: ["NZD"],
|
|
2191
|
+
NI: ["NIO"],
|
|
2192
|
+
NE: ["XOF"],
|
|
2193
|
+
NG: ["NGN"],
|
|
2194
|
+
MK: ["MKD"],
|
|
2195
|
+
NO: ["NOK"],
|
|
2196
|
+
OM: ["OMR"],
|
|
2197
|
+
PK: ["PKR"],
|
|
2198
|
+
PW: ["USD"],
|
|
2199
|
+
PS: ["ILS"],
|
|
2200
|
+
PA: ["PAB"],
|
|
2201
|
+
PG: ["PGK"],
|
|
2202
|
+
PY: ["PYG"],
|
|
2203
|
+
PE: ["PEN"],
|
|
2204
|
+
PH: ["PHP"],
|
|
2205
|
+
PL: ["PLN"],
|
|
2206
|
+
PT: ["EUR"],
|
|
2207
|
+
PR: ["USD"],
|
|
2208
|
+
QA: ["QAR"],
|
|
2209
|
+
RO: ["RON"],
|
|
2210
|
+
RU: ["RUB"],
|
|
2211
|
+
RW: ["RWF"],
|
|
2212
|
+
KN: ["XCD"],
|
|
2213
|
+
LC: ["XCD"],
|
|
2214
|
+
VC: ["XCD"],
|
|
2215
|
+
WS: ["WST"],
|
|
2216
|
+
SM: ["EUR"],
|
|
2217
|
+
ST: ["STN"],
|
|
2218
|
+
SA: ["SAR"],
|
|
2219
|
+
SN: ["XOF"],
|
|
2220
|
+
RS: ["RSD"],
|
|
2221
|
+
SC: ["SCR"],
|
|
2222
|
+
SL: ["SLE"],
|
|
2223
|
+
SG: ["SGD"],
|
|
2224
|
+
SK: ["EUR"],
|
|
2225
|
+
SI: ["EUR"],
|
|
2226
|
+
SB: ["SBD"],
|
|
2227
|
+
SO: ["SOS"],
|
|
2228
|
+
ZA: ["ZAR"],
|
|
2229
|
+
SS: ["SSP"],
|
|
2230
|
+
ES: ["EUR"],
|
|
2231
|
+
LK: ["LKR"],
|
|
2232
|
+
SD: ["SDG"],
|
|
2233
|
+
SR: ["SRD"],
|
|
2234
|
+
SE: ["SEK"],
|
|
2235
|
+
CH: ["CHF"],
|
|
2236
|
+
SY: ["SYP"],
|
|
2237
|
+
TW: ["TWD"],
|
|
2238
|
+
TJ: ["TJS"],
|
|
2239
|
+
TZ: ["TZS"],
|
|
2240
|
+
TH: ["THB"],
|
|
2241
|
+
TL: ["USD"],
|
|
2242
|
+
TG: ["XOF"],
|
|
2243
|
+
TO: ["TOP"],
|
|
2244
|
+
TT: ["TTD"],
|
|
2245
|
+
TN: ["TND"],
|
|
2246
|
+
TR: ["TRY"],
|
|
2247
|
+
TM: ["TMT"],
|
|
2248
|
+
TV: ["AUD"],
|
|
2249
|
+
UG: ["UGX"],
|
|
2250
|
+
UA: ["UAH"],
|
|
2251
|
+
AE: ["AED"],
|
|
2252
|
+
GB: ["GBP"],
|
|
2253
|
+
US: ["USD"],
|
|
2254
|
+
UY: ["UYU"],
|
|
2255
|
+
UZ: ["UZS"],
|
|
2256
|
+
VU: ["VUV"],
|
|
2257
|
+
VA: ["EUR"],
|
|
2258
|
+
VE: ["VES"],
|
|
2259
|
+
VN: ["VND"],
|
|
2260
|
+
YE: ["YER"],
|
|
2261
|
+
ZM: ["ZMW"],
|
|
2262
|
+
ZW: ["ZWG"],
|
|
2263
|
+
AX: ["EUR"],
|
|
2264
|
+
FO: ["DKK"],
|
|
2265
|
+
XK: ["EUR"]
|
|
2266
|
+
});
|
|
2267
|
+
var COUNTRY_LANGUAGES = Object.freeze({
|
|
2268
|
+
AF: ["ps", "fa"],
|
|
2269
|
+
AL: ["sq"],
|
|
2270
|
+
DZ: ["ar"],
|
|
2271
|
+
AD: ["ca"],
|
|
2272
|
+
AO: ["pt"],
|
|
2273
|
+
AG: ["en"],
|
|
2274
|
+
AR: ["es"],
|
|
2275
|
+
AM: ["hy"],
|
|
2276
|
+
AU: ["en"],
|
|
2277
|
+
AT: ["de"],
|
|
2278
|
+
AZ: ["az"],
|
|
2279
|
+
BS: ["en"],
|
|
2280
|
+
BH: ["ar"],
|
|
2281
|
+
BD: ["bn"],
|
|
2282
|
+
BB: ["en"],
|
|
2283
|
+
BY: ["be", "ru"],
|
|
2284
|
+
BE: ["nl", "fr", "de"],
|
|
2285
|
+
BZ: ["en"],
|
|
2286
|
+
BJ: ["fr"],
|
|
2287
|
+
BT: ["dz"],
|
|
2288
|
+
BO: ["es", "qu", "ay"],
|
|
2289
|
+
BA: ["bs", "hr", "sr"],
|
|
2290
|
+
BW: ["en", "tn"],
|
|
2291
|
+
BR: ["pt"],
|
|
2292
|
+
BN: ["ms"],
|
|
2293
|
+
BG: ["bg"],
|
|
2294
|
+
BF: ["fr"],
|
|
2295
|
+
BI: ["rn", "fr"],
|
|
2296
|
+
CV: ["pt"],
|
|
2297
|
+
KH: ["km"],
|
|
2298
|
+
CM: ["fr", "en"],
|
|
2299
|
+
CA: ["en", "fr"],
|
|
2300
|
+
CF: ["fr", "sg"],
|
|
2301
|
+
TD: ["fr", "ar"],
|
|
2302
|
+
CL: ["es"],
|
|
2303
|
+
CN: ["zh"],
|
|
2304
|
+
CO: ["es"],
|
|
2305
|
+
KM: ["ar", "fr"],
|
|
2306
|
+
CG: ["fr"],
|
|
2307
|
+
CD: ["fr"],
|
|
2308
|
+
CR: ["es"],
|
|
2309
|
+
CI: ["fr"],
|
|
2310
|
+
HR: ["hr"],
|
|
2311
|
+
CU: ["es"],
|
|
2312
|
+
CY: ["el", "tr"],
|
|
2313
|
+
CZ: ["cs"],
|
|
2314
|
+
DK: ["da"],
|
|
2315
|
+
DJ: ["fr", "ar"],
|
|
2316
|
+
DM: ["en"],
|
|
2317
|
+
DO: ["es"],
|
|
2318
|
+
EC: ["es"],
|
|
2319
|
+
EG: ["ar"],
|
|
2320
|
+
SV: ["es"],
|
|
2321
|
+
GQ: ["es", "fr", "pt"],
|
|
2322
|
+
ER: ["ti", "ar", "en"],
|
|
2323
|
+
EE: ["et"],
|
|
2324
|
+
SZ: ["en", "ss"],
|
|
2325
|
+
ET: ["am"],
|
|
2326
|
+
FJ: ["en", "fj"],
|
|
2327
|
+
FI: ["fi", "sv"],
|
|
2328
|
+
FR: ["fr"],
|
|
2329
|
+
GA: ["fr"],
|
|
2330
|
+
GM: ["en"],
|
|
2331
|
+
GE: ["ka"],
|
|
2332
|
+
DE: ["de"],
|
|
2333
|
+
GH: ["en"],
|
|
2334
|
+
GR: ["el"],
|
|
2335
|
+
GD: ["en"],
|
|
2336
|
+
GT: ["es"],
|
|
2337
|
+
GN: ["fr"],
|
|
2338
|
+
GW: ["pt"],
|
|
2339
|
+
GY: ["en"],
|
|
2340
|
+
HT: ["ht", "fr"],
|
|
2341
|
+
HN: ["es"],
|
|
2342
|
+
HU: ["hu"],
|
|
2343
|
+
IS: ["is"],
|
|
2344
|
+
IN: ["hi", "en"],
|
|
2345
|
+
ID: ["id"],
|
|
2346
|
+
IR: ["fa"],
|
|
2347
|
+
IQ: ["ar", "ku"],
|
|
2348
|
+
IE: ["en", "ga"],
|
|
2349
|
+
IL: ["he", "ar"],
|
|
2350
|
+
IT: ["it"],
|
|
2351
|
+
JM: ["en"],
|
|
2352
|
+
JP: ["ja"],
|
|
2353
|
+
JO: ["ar"],
|
|
2354
|
+
KZ: ["kk", "ru"],
|
|
2355
|
+
KE: ["en", "sw"],
|
|
2356
|
+
KI: ["en"],
|
|
2357
|
+
KP: ["ko"],
|
|
2358
|
+
KR: ["ko"],
|
|
2359
|
+
KW: ["ar"],
|
|
2360
|
+
KG: ["ky", "ru"],
|
|
2361
|
+
LA: ["lo"],
|
|
2362
|
+
LV: ["lv"],
|
|
2363
|
+
LB: ["ar", "fr"],
|
|
2364
|
+
LS: ["en", "st"],
|
|
2365
|
+
LR: ["en"],
|
|
2366
|
+
LY: ["ar"],
|
|
2367
|
+
LI: ["de"],
|
|
2368
|
+
LT: ["lt"],
|
|
2369
|
+
LU: ["lb", "fr", "de"],
|
|
2370
|
+
MG: ["mg", "fr"],
|
|
2371
|
+
MW: ["en", "ny"],
|
|
2372
|
+
MY: ["ms"],
|
|
2373
|
+
MV: ["dv"],
|
|
2374
|
+
ML: ["fr"],
|
|
2375
|
+
MT: ["mt", "en"],
|
|
2376
|
+
MH: ["en", "mh"],
|
|
2377
|
+
MR: ["ar"],
|
|
2378
|
+
MU: ["en"],
|
|
2379
|
+
MX: ["es"],
|
|
2380
|
+
MD: ["ro"],
|
|
2381
|
+
MC: ["fr"],
|
|
2382
|
+
MN: ["mn"],
|
|
2383
|
+
ME: ["sr"],
|
|
2384
|
+
MA: ["ar"],
|
|
2385
|
+
MZ: ["pt"],
|
|
2386
|
+
MM: ["my"],
|
|
2387
|
+
NA: ["en"],
|
|
2388
|
+
NR: ["en", "na"],
|
|
2389
|
+
NP: ["ne"],
|
|
2390
|
+
NL: ["nl"],
|
|
2391
|
+
NZ: ["en", "mi"],
|
|
2392
|
+
NI: ["es"],
|
|
2393
|
+
NE: ["fr"],
|
|
2394
|
+
NG: ["en"],
|
|
2395
|
+
MK: ["mk"],
|
|
2396
|
+
NO: ["no", "nb", "nn"],
|
|
2397
|
+
OM: ["ar"],
|
|
2398
|
+
PK: ["ur", "en"],
|
|
2399
|
+
PW: ["en"],
|
|
2400
|
+
PA: ["es"],
|
|
2401
|
+
PG: ["en"],
|
|
2402
|
+
PY: ["es", "gn"],
|
|
2403
|
+
PE: ["es", "qu"],
|
|
2404
|
+
PH: ["tl", "en"],
|
|
2405
|
+
PL: ["pl"],
|
|
2406
|
+
PT: ["pt"],
|
|
2407
|
+
QA: ["ar"],
|
|
2408
|
+
RO: ["ro"],
|
|
2409
|
+
RU: ["ru"],
|
|
2410
|
+
RW: ["rw", "fr", "en"],
|
|
2411
|
+
KN: ["en"],
|
|
2412
|
+
LC: ["en"],
|
|
2413
|
+
VC: ["en"],
|
|
2414
|
+
WS: ["sm", "en"],
|
|
2415
|
+
SM: ["it"],
|
|
2416
|
+
ST: ["pt"],
|
|
2417
|
+
SA: ["ar"],
|
|
2418
|
+
SN: ["fr"],
|
|
2419
|
+
RS: ["sr"],
|
|
2420
|
+
SC: ["en", "fr"],
|
|
2421
|
+
SL: ["en"],
|
|
2422
|
+
SG: ["en", "ms", "zh", "ta"],
|
|
2423
|
+
SK: ["sk"],
|
|
2424
|
+
SI: ["sl"],
|
|
2425
|
+
SB: ["en"],
|
|
2426
|
+
SO: ["so", "ar"],
|
|
2427
|
+
ZA: ["en", "af", "zu"],
|
|
2428
|
+
SS: ["en"],
|
|
2429
|
+
ES: ["es"],
|
|
2430
|
+
LK: ["si", "ta"],
|
|
2431
|
+
SD: ["ar", "en"],
|
|
2432
|
+
SR: ["nl"],
|
|
2433
|
+
SE: ["sv"],
|
|
2434
|
+
CH: ["de", "fr", "it", "rm"],
|
|
2435
|
+
SY: ["ar"],
|
|
2436
|
+
TW: ["zh"],
|
|
2437
|
+
TJ: ["tg"],
|
|
2438
|
+
TZ: ["sw", "en"],
|
|
2439
|
+
TH: ["th"],
|
|
2440
|
+
TL: ["pt"],
|
|
2441
|
+
TG: ["fr"],
|
|
2442
|
+
TO: ["en", "to"],
|
|
2443
|
+
TT: ["en"],
|
|
2444
|
+
TN: ["ar"],
|
|
2445
|
+
TR: ["tr"],
|
|
2446
|
+
TM: ["tk"],
|
|
2447
|
+
TV: ["en"],
|
|
2448
|
+
UG: ["en", "sw"],
|
|
2449
|
+
UA: ["uk"],
|
|
2450
|
+
AE: ["ar"],
|
|
2451
|
+
GB: ["en"],
|
|
2452
|
+
US: ["en"],
|
|
2453
|
+
UY: ["es"],
|
|
2454
|
+
UZ: ["uz"],
|
|
2455
|
+
VU: ["en", "fr", "bi"],
|
|
2456
|
+
VA: ["it", "la"],
|
|
2457
|
+
VE: ["es"],
|
|
2458
|
+
VN: ["vi"],
|
|
2459
|
+
YE: ["ar"],
|
|
2460
|
+
ZM: ["en"],
|
|
2461
|
+
ZW: ["en", "sn", "nd"],
|
|
2462
|
+
AS: ["en", "sm"],
|
|
2463
|
+
AW: ["nl"],
|
|
2464
|
+
BM: ["en"],
|
|
2465
|
+
CW: ["nl"],
|
|
2466
|
+
FO: ["fo", "da"],
|
|
2467
|
+
GI: ["en"],
|
|
2468
|
+
GL: ["kl", "da"],
|
|
2469
|
+
GG: ["en"],
|
|
2470
|
+
GU: ["en"],
|
|
2471
|
+
HK: ["zh", "en"],
|
|
2472
|
+
IM: ["en"],
|
|
2473
|
+
JE: ["en"],
|
|
2474
|
+
XK: ["sq", "sr"],
|
|
2475
|
+
MO: ["zh", "pt"],
|
|
2476
|
+
PR: ["es", "en"]
|
|
2477
|
+
});
|
|
2478
|
+
var COUNTRY_ALIASES = Object.freeze({
|
|
2479
|
+
USA: "US",
|
|
2480
|
+
UK: "GB",
|
|
2481
|
+
Holland: "NL",
|
|
2482
|
+
"Czech Republic": "CZ",
|
|
2483
|
+
"Ivory Coast": "CI",
|
|
2484
|
+
Burma: "MM",
|
|
2485
|
+
Swaziland: "SZ",
|
|
2486
|
+
Persia: "IR",
|
|
2487
|
+
"Great Britain": "GB",
|
|
2488
|
+
England: "GB",
|
|
2489
|
+
UAE: "AE",
|
|
2490
|
+
"South Korea": "KR",
|
|
2491
|
+
"North Korea": "KP",
|
|
2492
|
+
"Republic of Ireland": "IE",
|
|
2493
|
+
Suisse: "CH",
|
|
2494
|
+
Svizzera: "CH",
|
|
2495
|
+
Belgique: "BE",
|
|
2496
|
+
Noreg: "NO",
|
|
2497
|
+
Vitryssland: "BY"
|
|
2498
|
+
});
|
|
2499
|
+
var PRIMARY_BY_CALLING_CODE = Object.freeze({
|
|
2500
|
+
"1": "US",
|
|
2501
|
+
"44": "GB",
|
|
2502
|
+
"7": "RU"
|
|
2503
|
+
});
|
|
2504
|
+
|
|
2505
|
+
// src/geography/country.ts
|
|
2506
|
+
var MAX_INPUT_LENGTH3 = 100;
|
|
2507
|
+
var Country = class _Country {
|
|
2508
|
+
static typeInfo = Object.freeze({
|
|
2509
|
+
englishName: "Country",
|
|
2510
|
+
localizedName: "Land",
|
|
2511
|
+
emoji: "\u{1F30D}",
|
|
2512
|
+
sources: Object.freeze([
|
|
2513
|
+
"https://www.iso.org/iso-3166-country-codes.html",
|
|
2514
|
+
"https://en.wikipedia.org/wiki/ISO_3166-1",
|
|
2515
|
+
"https://www.itu.int/rec/T-REC-E.164/",
|
|
2516
|
+
"https://www.iana.org/domains/root/db",
|
|
2517
|
+
"https://www.wikidata.org/wiki/Property:P625",
|
|
2518
|
+
"https://www.wikidata.org/wiki/Property:P36",
|
|
2519
|
+
"https://www.wikidata.org/wiki/Property:P47"
|
|
2520
|
+
])
|
|
2521
|
+
});
|
|
2522
|
+
alpha2Code;
|
|
2523
|
+
alpha3Code;
|
|
2524
|
+
numericCode;
|
|
2525
|
+
englishName;
|
|
2526
|
+
localizedName;
|
|
2527
|
+
nativeName;
|
|
2528
|
+
callingCode;
|
|
2529
|
+
topLevelDomain;
|
|
2530
|
+
continent;
|
|
2531
|
+
currencyCodes;
|
|
2532
|
+
languageCodes;
|
|
2533
|
+
constructor(row) {
|
|
2534
|
+
this.alpha2Code = row.alpha2;
|
|
2535
|
+
this.alpha3Code = row.alpha3;
|
|
2536
|
+
this.numericCode = row.numeric;
|
|
2537
|
+
this.englishName = row.en;
|
|
2538
|
+
this.localizedName = row.sv;
|
|
2539
|
+
this.nativeName = row.native;
|
|
2540
|
+
this.callingCode = row.callingCode;
|
|
2541
|
+
this.topLevelDomain = row.tld;
|
|
2542
|
+
this.continent = row.continent;
|
|
2543
|
+
this.currencyCodes = COUNTRY_CURRENCIES[row.alpha2] ?? [];
|
|
2544
|
+
this.languageCodes = COUNTRY_LANGUAGES[row.alpha2] ?? [];
|
|
2545
|
+
}
|
|
2546
|
+
/** The canonical value of this country: its ISO 3166-1 alpha-2 code. */
|
|
2547
|
+
get value() {
|
|
2548
|
+
return this.alpha2Code;
|
|
2549
|
+
}
|
|
2550
|
+
/** Display name in the current culture (Swedish or English). */
|
|
2551
|
+
get displayName() {
|
|
2552
|
+
return PrimitivesDefaults.useLocalizedDisplayNames ? this.localizedName : this.englishName;
|
|
2553
|
+
}
|
|
2554
|
+
/** Culture-independent display form. Always the English name. */
|
|
2555
|
+
get formatted() {
|
|
2556
|
+
return this.englishName;
|
|
2557
|
+
}
|
|
2558
|
+
/** Geographic coordinate of the country (centroid, from Wikidata P625). */
|
|
2559
|
+
get coordinate() {
|
|
2560
|
+
const c = COUNTRY_COORDINATES[this.alpha2Code];
|
|
2561
|
+
if (!c) throw new Error(`No coordinate for country ${this.alpha2Code}.`);
|
|
2562
|
+
return GeoCoordinate.create(c[0], c[1]);
|
|
2563
|
+
}
|
|
2564
|
+
/** Approximate latitude (WGS 84) of the country centroid. */
|
|
2565
|
+
get latitude() {
|
|
2566
|
+
return this.coordinate.latitude;
|
|
2567
|
+
}
|
|
2568
|
+
/** Approximate longitude (WGS 84) of the country centroid. */
|
|
2569
|
+
get longitude() {
|
|
2570
|
+
return this.coordinate.longitude;
|
|
2571
|
+
}
|
|
2572
|
+
/** Capital city, or `null` for entries without a capital (e.g. Antarctica). */
|
|
2573
|
+
get capital() {
|
|
2574
|
+
return getCountryCapital(this.alpha2Code);
|
|
2575
|
+
}
|
|
2576
|
+
get isInEuropeanUnion() {
|
|
2577
|
+
return EU_COUNTRIES.has(this.alpha2Code);
|
|
2578
|
+
}
|
|
2579
|
+
get isInEea() {
|
|
2580
|
+
return EEA_COUNTRIES.has(this.alpha2Code);
|
|
2581
|
+
}
|
|
2582
|
+
get isInSchengen() {
|
|
2583
|
+
return SCHENGEN_COUNTRIES.has(this.alpha2Code);
|
|
2584
|
+
}
|
|
2585
|
+
get isInNordics() {
|
|
2586
|
+
return NORDIC_COUNTRIES.has(this.alpha2Code);
|
|
2587
|
+
}
|
|
2588
|
+
get isInSepa() {
|
|
2589
|
+
return SEPA_COUNTRIES.has(this.alpha2Code);
|
|
2590
|
+
}
|
|
2591
|
+
/** True when the euro is among the country's legal tenders. */
|
|
2592
|
+
get usesEuro() {
|
|
2593
|
+
return this.currencyCodes.includes("EUR");
|
|
2594
|
+
}
|
|
2595
|
+
/** Primary ISO 4217 currency code, or `null` when unknown. */
|
|
2596
|
+
get currencyCode() {
|
|
2597
|
+
return this.currencyCodes[0] ?? null;
|
|
2598
|
+
}
|
|
2599
|
+
/**
|
|
2600
|
+
* Primary legal-tender currency, or `null` when unknown. Countries with
|
|
2601
|
+
* several legal tenders (Cuba, Panama, Namibia) return the first; use
|
|
2602
|
+
* {@link currencies} for the full list.
|
|
2603
|
+
*/
|
|
2604
|
+
get currency() {
|
|
2605
|
+
const code = this.currencyCode;
|
|
2606
|
+
return code == null ? null : Currency.tryParse(code);
|
|
2607
|
+
}
|
|
2608
|
+
/** All recognized currencies for this country, in priority order. */
|
|
2609
|
+
get currencies() {
|
|
2610
|
+
return Object.freeze(
|
|
2611
|
+
this.currencyCodes.map((code) => Currency.tryParse(code)).filter((c) => c !== null)
|
|
2612
|
+
);
|
|
2613
|
+
}
|
|
2614
|
+
/**
|
|
2615
|
+
* Primary official language, or `null` when unknown. Countries with several
|
|
2616
|
+
* official languages (Belgium, Switzerland) return the most widely spoken;
|
|
2617
|
+
* use {@link officialLanguages} for the full list.
|
|
2618
|
+
*/
|
|
2619
|
+
get primaryLanguage() {
|
|
2620
|
+
const code = this.languageCodes[0];
|
|
2621
|
+
return code == null ? null : Language.tryParse(code);
|
|
2622
|
+
}
|
|
2623
|
+
/** All official languages of the country, in priority order. */
|
|
2624
|
+
get officialLanguages() {
|
|
2625
|
+
return Object.freeze(
|
|
2626
|
+
this.languageCodes.map((code) => Language.tryParse(code)).filter((l) => l !== null)
|
|
2627
|
+
);
|
|
2628
|
+
}
|
|
2629
|
+
static tryParse(input) {
|
|
2630
|
+
if (input == null) return null;
|
|
2631
|
+
const sanitized = sanitizeInput(input).trim();
|
|
2632
|
+
if (sanitized.length === 0 || sanitized.length > MAX_INPUT_LENGTH3) return null;
|
|
2633
|
+
const direct = lookupCi(sanitized);
|
|
2634
|
+
if (direct) return direct;
|
|
2635
|
+
if (sanitized.length > 4 && sanitized.slice(0, 4).toLowerCase() === "the ") {
|
|
2636
|
+
const without = sanitized.slice(4);
|
|
2637
|
+
const stripped = lookupCi(without);
|
|
2638
|
+
if (stripped) return stripped;
|
|
2639
|
+
}
|
|
2640
|
+
return null;
|
|
2641
|
+
}
|
|
2642
|
+
static parse(input) {
|
|
2643
|
+
const r = _Country.tryParse(input);
|
|
2644
|
+
if (r === null) throw new Error("Unknown country.");
|
|
2645
|
+
return r;
|
|
2646
|
+
}
|
|
2647
|
+
static isValid(input) {
|
|
2648
|
+
return _Country.tryParse(input) !== null;
|
|
2649
|
+
}
|
|
2650
|
+
static format(input, options) {
|
|
2651
|
+
const r = _Country.tryParse(input);
|
|
2652
|
+
if (r) return r.displayName;
|
|
2653
|
+
if (options?.fallbackToTrimmedInputWhenInvalid && input != null && input.trim() !== "") {
|
|
2654
|
+
return input.trim();
|
|
2655
|
+
}
|
|
2656
|
+
return null;
|
|
2657
|
+
}
|
|
2658
|
+
static normalize(input, options) {
|
|
2659
|
+
const r = _Country.tryParse(input);
|
|
2660
|
+
if (r) return r.alpha2Code;
|
|
2661
|
+
if (options?.fallbackToTrimmedInputWhenInvalid && input != null) {
|
|
2662
|
+
const trimmed = input.trim();
|
|
2663
|
+
return trimmed.length > 0 ? trimmed : null;
|
|
2664
|
+
}
|
|
2665
|
+
return null;
|
|
2666
|
+
}
|
|
2667
|
+
static isNormalized(input) {
|
|
2668
|
+
return input != null && _Country.normalize(input) === input;
|
|
2669
|
+
}
|
|
2670
|
+
/** Look up a country by its phone calling code. Primary owner wins for shared codes. */
|
|
2671
|
+
static tryFindByCallingCode(callingCode) {
|
|
2672
|
+
if (callingCode == null) return null;
|
|
2673
|
+
const trimmed = callingCode.trim();
|
|
2674
|
+
if (trimmed.length === 0) return null;
|
|
2675
|
+
return BY_CALLING_CODE.get(trimmed) ?? null;
|
|
2676
|
+
}
|
|
2677
|
+
/** All known countries. */
|
|
2678
|
+
static get all() {
|
|
2679
|
+
return ALL_COUNTRIES;
|
|
2680
|
+
}
|
|
2681
|
+
/**
|
|
2682
|
+
* Returns countries within `radiusKm` of this country, ordered by distance.
|
|
2683
|
+
*/
|
|
2684
|
+
findNeighbors(radiusKm) {
|
|
2685
|
+
if (!Number.isFinite(radiusKm) || radiusKm <= 0) {
|
|
2686
|
+
throw new RangeError("radiusKm must be a positive finite number.");
|
|
2687
|
+
}
|
|
2688
|
+
return _Country.findNeighbors(this.coordinate, radiusKm).filter((d) => d.country !== this);
|
|
2689
|
+
}
|
|
2690
|
+
/** Returns countries within `radiusKm` of `coordinate`, ordered by distance. */
|
|
2691
|
+
static findNeighbors(coordinate, radiusKm) {
|
|
2692
|
+
if (!Number.isFinite(radiusKm) || radiusKm <= 0) {
|
|
2693
|
+
throw new RangeError("radiusKm must be a positive finite number.");
|
|
2694
|
+
}
|
|
2695
|
+
const out = [];
|
|
2696
|
+
for (const c of ALL_COUNTRIES) {
|
|
2697
|
+
const dist = GeoCoordinate.distanceKilometers(coordinate, c.coordinate);
|
|
2698
|
+
if (dist <= radiusKm) out.push({ country: c, distanceKilometers: dist });
|
|
2699
|
+
}
|
|
2700
|
+
out.sort((a, b) => a.distanceKilometers - b.distanceKilometers);
|
|
2701
|
+
return out;
|
|
2702
|
+
}
|
|
2703
|
+
/**
|
|
2704
|
+
* Scans unstructured text for country names (4+ chars, word-bounded). Low confidence
|
|
2705
|
+
* because country names can occur in non-geographic contexts.
|
|
2706
|
+
*/
|
|
2707
|
+
static findCandidatesInText(text) {
|
|
2708
|
+
if (!text) return [];
|
|
2709
|
+
const out = [];
|
|
2710
|
+
SCAN_PATTERN.lastIndex = 0;
|
|
2711
|
+
let m;
|
|
2712
|
+
while ((m = SCAN_PATTERN.exec(text)) !== null) {
|
|
2713
|
+
const country = _Country.tryParse(m[0]);
|
|
2714
|
+
if (!country) continue;
|
|
2715
|
+
out.push(
|
|
2716
|
+
new TextCandidate({
|
|
2717
|
+
startIndex: m.index,
|
|
2718
|
+
length: m[0].length,
|
|
2719
|
+
originalText: m[0],
|
|
2720
|
+
typeName: "Country",
|
|
2721
|
+
category: TextCandidateCategory.Geography,
|
|
2722
|
+
normalizedForm: country.toNormalizedString(),
|
|
2723
|
+
formattedForm: country.toString(),
|
|
2724
|
+
maskedForm: country.localizedName,
|
|
2725
|
+
confidence: TextMatchConfidence.Low,
|
|
2726
|
+
value: country
|
|
2727
|
+
})
|
|
2728
|
+
);
|
|
2729
|
+
}
|
|
2730
|
+
return out;
|
|
2731
|
+
}
|
|
2732
|
+
toNormalizedString() {
|
|
2733
|
+
return this.alpha2Code;
|
|
2734
|
+
}
|
|
2735
|
+
toString() {
|
|
2736
|
+
return this.displayName;
|
|
2737
|
+
}
|
|
2738
|
+
toDisplayString() {
|
|
2739
|
+
return this.displayName;
|
|
2740
|
+
}
|
|
2741
|
+
toEnglishString() {
|
|
2742
|
+
return this.englishName;
|
|
2743
|
+
}
|
|
2744
|
+
toNativeString() {
|
|
2745
|
+
return this.nativeName;
|
|
2746
|
+
}
|
|
2747
|
+
equals(other) {
|
|
2748
|
+
return other != null && this.alpha2Code === other.alpha2Code;
|
|
2749
|
+
}
|
|
2750
|
+
compareTo(other) {
|
|
2751
|
+
if (other == null) return 1;
|
|
2752
|
+
return this.alpha2Code < other.alpha2Code ? -1 : this.alpha2Code > other.alpha2Code ? 1 : 0;
|
|
2753
|
+
}
|
|
2754
|
+
static get Sweden() {
|
|
2755
|
+
return getByAlpha2("SE");
|
|
2756
|
+
}
|
|
2757
|
+
static get Norway() {
|
|
2758
|
+
return getByAlpha2("NO");
|
|
2759
|
+
}
|
|
2760
|
+
static get Finland() {
|
|
2761
|
+
return getByAlpha2("FI");
|
|
2762
|
+
}
|
|
2763
|
+
static get Denmark() {
|
|
2764
|
+
return getByAlpha2("DK");
|
|
2765
|
+
}
|
|
2766
|
+
static get Iceland() {
|
|
2767
|
+
return getByAlpha2("IS");
|
|
2768
|
+
}
|
|
2769
|
+
static get Germany() {
|
|
2770
|
+
return getByAlpha2("DE");
|
|
2771
|
+
}
|
|
2772
|
+
static get Poland() {
|
|
2773
|
+
return getByAlpha2("PL");
|
|
2774
|
+
}
|
|
2775
|
+
static get Estonia() {
|
|
2776
|
+
return getByAlpha2("EE");
|
|
2777
|
+
}
|
|
2778
|
+
static get Lithuania() {
|
|
2779
|
+
return getByAlpha2("LT");
|
|
2780
|
+
}
|
|
2781
|
+
static get Latvia() {
|
|
2782
|
+
return getByAlpha2("LV");
|
|
2783
|
+
}
|
|
2784
|
+
static get Romania() {
|
|
2785
|
+
return getByAlpha2("RO");
|
|
2786
|
+
}
|
|
2787
|
+
static get Bulgaria() {
|
|
2788
|
+
return getByAlpha2("BG");
|
|
2789
|
+
}
|
|
2790
|
+
static get CzechRepublic() {
|
|
2791
|
+
return getByAlpha2("CZ");
|
|
2792
|
+
}
|
|
2793
|
+
static get Spain() {
|
|
2794
|
+
return getByAlpha2("ES");
|
|
2795
|
+
}
|
|
2796
|
+
static get Netherlands() {
|
|
2797
|
+
return getByAlpha2("NL");
|
|
2798
|
+
}
|
|
2799
|
+
static get Greece() {
|
|
2800
|
+
return getByAlpha2("GR");
|
|
2801
|
+
}
|
|
2802
|
+
static get Italy() {
|
|
2803
|
+
return getByAlpha2("IT");
|
|
2804
|
+
}
|
|
2805
|
+
static get Slovenia() {
|
|
2806
|
+
return getByAlpha2("SI");
|
|
2807
|
+
}
|
|
2808
|
+
static get Croatia() {
|
|
2809
|
+
return getByAlpha2("HR");
|
|
2810
|
+
}
|
|
2811
|
+
static get Portugal() {
|
|
2812
|
+
return getByAlpha2("PT");
|
|
2813
|
+
}
|
|
2814
|
+
static get Hungary() {
|
|
2815
|
+
return getByAlpha2("HU");
|
|
2816
|
+
}
|
|
2817
|
+
static get France() {
|
|
2818
|
+
return getByAlpha2("FR");
|
|
2819
|
+
}
|
|
2820
|
+
static get Slovakia() {
|
|
2821
|
+
return getByAlpha2("SK");
|
|
2822
|
+
}
|
|
2823
|
+
static get Belgium() {
|
|
2824
|
+
return getByAlpha2("BE");
|
|
2825
|
+
}
|
|
2826
|
+
static get UnitedKingdom() {
|
|
2827
|
+
return getByAlpha2("GB");
|
|
2828
|
+
}
|
|
2829
|
+
static get Austria() {
|
|
2830
|
+
return getByAlpha2("AT");
|
|
2831
|
+
}
|
|
2832
|
+
static get Cyprus() {
|
|
2833
|
+
return getByAlpha2("CY");
|
|
2834
|
+
}
|
|
2835
|
+
static get Switzerland() {
|
|
2836
|
+
return getByAlpha2("CH");
|
|
2837
|
+
}
|
|
2838
|
+
static get Ireland() {
|
|
2839
|
+
return getByAlpha2("IE");
|
|
2840
|
+
}
|
|
2841
|
+
static get Luxembourg() {
|
|
2842
|
+
return getByAlpha2("LU");
|
|
2843
|
+
}
|
|
2844
|
+
static get Malta() {
|
|
2845
|
+
return getByAlpha2("MT");
|
|
2846
|
+
}
|
|
2847
|
+
static get Liechtenstein() {
|
|
2848
|
+
return getByAlpha2("LI");
|
|
2849
|
+
}
|
|
2850
|
+
/** @internal */
|
|
2851
|
+
static _fromRow(row) {
|
|
2852
|
+
return new _Country(row);
|
|
2853
|
+
}
|
|
2854
|
+
};
|
|
2855
|
+
var ALL_COUNTRIES = COUNTRY_ROWS.map((r) => Country._fromRow(r));
|
|
2856
|
+
var BY_ALPHA2 = /* @__PURE__ */ new Map();
|
|
2857
|
+
var BY_NAME = /* @__PURE__ */ new Map();
|
|
2858
|
+
var BY_CALLING_CODE = /* @__PURE__ */ new Map();
|
|
2859
|
+
for (const c of ALL_COUNTRIES) {
|
|
2860
|
+
BY_ALPHA2.set(c.alpha2Code.toUpperCase(), c);
|
|
2861
|
+
BY_NAME.set(c.alpha2Code.toUpperCase(), c);
|
|
2862
|
+
BY_NAME.set(c.alpha3Code.toUpperCase(), c);
|
|
2863
|
+
BY_NAME.set(c.englishName.toLowerCase(), c);
|
|
2864
|
+
if (!BY_NAME.has(c.localizedName.toLowerCase())) BY_NAME.set(c.localizedName.toLowerCase(), c);
|
|
2865
|
+
if (c.nativeName.toLowerCase() !== c.englishName.toLowerCase() && !BY_NAME.has(c.nativeName.toLowerCase())) {
|
|
2866
|
+
BY_NAME.set(c.nativeName.toLowerCase(), c);
|
|
2867
|
+
}
|
|
2868
|
+
if (!BY_CALLING_CODE.has(c.callingCode)) BY_CALLING_CODE.set(c.callingCode, c);
|
|
2869
|
+
}
|
|
2870
|
+
for (const [aliasOrCode, alpha2] of Object.entries(COUNTRY_ALIASES)) {
|
|
2871
|
+
const target = BY_ALPHA2.get(alpha2.toUpperCase());
|
|
2872
|
+
if (target) BY_NAME.set(aliasOrCode.toLowerCase(), target);
|
|
2873
|
+
}
|
|
2874
|
+
for (const [code, alpha2] of Object.entries(PRIMARY_BY_CALLING_CODE)) {
|
|
2875
|
+
const target = BY_ALPHA2.get(alpha2.toUpperCase());
|
|
2876
|
+
if (target) BY_CALLING_CODE.set(code, target);
|
|
2877
|
+
}
|
|
2878
|
+
var SCAN_PATTERN = (() => {
|
|
2879
|
+
const names = [...BY_NAME.keys()].filter((n) => n.length >= 4).sort((a, b) => b.length - a.length).map(escapeRegex);
|
|
2880
|
+
return new RegExp(`(?<![\\p{L}\\p{N}_])(?:${names.join("|")})(?![\\p{L}\\p{N}_])`, "giu");
|
|
2881
|
+
})();
|
|
2882
|
+
function getByAlpha2(code) {
|
|
2883
|
+
const c = BY_ALPHA2.get(code.toUpperCase());
|
|
2884
|
+
if (!c) throw new Error(`Unknown country code ${code}.`);
|
|
2885
|
+
return c;
|
|
2886
|
+
}
|
|
2887
|
+
function lookupCi(input) {
|
|
2888
|
+
const upper = input.toUpperCase();
|
|
2889
|
+
const a2 = BY_ALPHA2.get(upper);
|
|
2890
|
+
if (a2) return a2;
|
|
2891
|
+
const lower = input.toLowerCase();
|
|
2892
|
+
return BY_NAME.get(lower) ?? BY_NAME.get(upper) ?? null;
|
|
2893
|
+
}
|
|
2894
|
+
function escapeRegex(s) {
|
|
2895
|
+
return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
2896
|
+
}
|
|
2897
|
+
|
|
2898
|
+
// src/finance/currency.ts
|
|
2899
|
+
var KNOWN_CURRENCIES = [
|
|
2900
|
+
{ code: "SEK", en: "Swedish krona", sv: "Svensk krona", symbol: "kr", decimalPlaces: 2 },
|
|
2901
|
+
{ code: "NOK", en: "Norwegian krone", sv: "Norsk krona", symbol: "kr", decimalPlaces: 2 },
|
|
2902
|
+
{ code: "DKK", en: "Danish krone", sv: "Dansk krona", symbol: "kr", decimalPlaces: 2 },
|
|
2903
|
+
{ code: "ISK", en: "Icelandic kr\xF3na", sv: "Isl\xE4ndsk krona", symbol: "kr", decimalPlaces: 0 },
|
|
2904
|
+
{ code: "EUR", en: "Euro", sv: "Euro", symbol: "\u20AC", decimalPlaces: 2 },
|
|
2905
|
+
{
|
|
2906
|
+
code: "USD",
|
|
2907
|
+
en: "United States dollar",
|
|
2908
|
+
sv: "Amerikansk dollar",
|
|
2909
|
+
symbol: "$",
|
|
2910
|
+
decimalPlaces: 2
|
|
2911
|
+
},
|
|
2912
|
+
{ code: "GBP", en: "Pound sterling", sv: "Brittiskt pund", symbol: "\xA3", decimalPlaces: 2 },
|
|
2913
|
+
{ code: "CHF", en: "Swiss franc", sv: "Schweizisk franc", symbol: "CHF", decimalPlaces: 2 },
|
|
2914
|
+
{ code: "JPY", en: "Japanese yen", sv: "Japansk yen", symbol: "\xA5", decimalPlaces: 0 },
|
|
2915
|
+
{ code: "CNY", en: "Chinese yuan", sv: "Kinesisk yuan", symbol: "\xA5", decimalPlaces: 2 },
|
|
2916
|
+
{ code: "CAD", en: "Canadian dollar", sv: "Kanadensisk dollar", symbol: "CA$", decimalPlaces: 2 },
|
|
2917
|
+
{ code: "AUD", en: "Australian dollar", sv: "Australisk dollar", symbol: "A$", decimalPlaces: 2 },
|
|
2918
|
+
{
|
|
2919
|
+
code: "NZD",
|
|
2920
|
+
en: "New Zealand dollar",
|
|
2921
|
+
sv: "Nyzeel\xE4ndsk dollar",
|
|
2922
|
+
symbol: "NZ$",
|
|
2923
|
+
decimalPlaces: 2
|
|
2924
|
+
},
|
|
2925
|
+
{ code: "PLN", en: "Polish z\u0142oty", sv: "Polsk zloty", symbol: "z\u0142", decimalPlaces: 2 },
|
|
2926
|
+
{ code: "CZK", en: "Czech koruna", sv: "Tjeckisk koruna", symbol: "K\u010D", decimalPlaces: 2 },
|
|
2927
|
+
{ code: "HUF", en: "Hungarian forint", sv: "Ungersk forint", symbol: "Ft", decimalPlaces: 2 },
|
|
2928
|
+
{ code: "RON", en: "Romanian leu", sv: "Rum\xE4nsk leu", symbol: "lei", decimalPlaces: 2 },
|
|
2929
|
+
{ code: "BGN", en: "Bulgarian lev", sv: "Bulgarisk lev", symbol: "\u043B\u0432", decimalPlaces: 2 },
|
|
2930
|
+
{ code: "HRK", en: "Croatian kuna", sv: "Kroatisk kuna", symbol: "kn", decimalPlaces: 2 },
|
|
2931
|
+
{ code: "TRY", en: "Turkish lira", sv: "Turkisk lira", symbol: "\u20BA", decimalPlaces: 2 },
|
|
2932
|
+
{ code: "RUB", en: "Russian ruble", sv: "Rysk rubel", symbol: "\u20BD", decimalPlaces: 2 },
|
|
2933
|
+
{ code: "INR", en: "Indian rupee", sv: "Indisk rupie", symbol: "\u20B9", decimalPlaces: 2 },
|
|
2934
|
+
{ code: "BRL", en: "Brazilian real", sv: "Brasiliansk real", symbol: "R$", decimalPlaces: 2 },
|
|
2935
|
+
{ code: "ZAR", en: "South African rand", sv: "Sydafrikansk rand", symbol: "R", decimalPlaces: 2 },
|
|
2936
|
+
{ code: "MXN", en: "Mexican peso", sv: "Mexikansk peso", symbol: "MX$", decimalPlaces: 2 },
|
|
2937
|
+
{
|
|
2938
|
+
code: "SGD",
|
|
2939
|
+
en: "Singapore dollar",
|
|
2940
|
+
sv: "Singaporiansk dollar",
|
|
2941
|
+
symbol: "S$",
|
|
2942
|
+
decimalPlaces: 2
|
|
2943
|
+
},
|
|
2944
|
+
{ code: "HKD", en: "Hong Kong dollar", sv: "Hongkongdollar", symbol: "HK$", decimalPlaces: 2 },
|
|
2945
|
+
{ code: "KRW", en: "South Korean won", sv: "Sydkoreansk won", symbol: "\u20A9", decimalPlaces: 0 },
|
|
2946
|
+
{ code: "THB", en: "Thai baht", sv: "Thail\xE4ndsk baht", symbol: "\u0E3F", decimalPlaces: 2 },
|
|
2947
|
+
{
|
|
2948
|
+
code: "TWD",
|
|
2949
|
+
en: "New Taiwan dollar",
|
|
2950
|
+
sv: "Taiwanesisk dollar",
|
|
2951
|
+
symbol: "NT$",
|
|
2952
|
+
decimalPlaces: 2
|
|
2953
|
+
},
|
|
2954
|
+
{ code: "ILS", en: "Israeli new shekel", sv: "Israelisk shekel", symbol: "\u20AA", decimalPlaces: 2 },
|
|
2955
|
+
{
|
|
2956
|
+
code: "AED",
|
|
2957
|
+
en: "United Arab Emirates dirham",
|
|
2958
|
+
sv: "Emiratisk dirham",
|
|
2959
|
+
symbol: "\u062F.\u0625",
|
|
2960
|
+
decimalPlaces: 2
|
|
2961
|
+
},
|
|
2962
|
+
{ code: "SAR", en: "Saudi riyal", sv: "Saudisk riyal", symbol: "\uFDFC", decimalPlaces: 2 },
|
|
2963
|
+
{ code: "PHP", en: "Philippine peso", sv: "Filippinsk peso", symbol: "\u20B1", decimalPlaces: 2 },
|
|
2964
|
+
{ code: "IDR", en: "Indonesian rupiah", sv: "Indonesisk rupiah", symbol: "Rp", decimalPlaces: 2 },
|
|
2965
|
+
{ code: "MYR", en: "Malaysian ringgit", sv: "Malaysisk ringgit", symbol: "RM", decimalPlaces: 2 },
|
|
2966
|
+
{ code: "VND", en: "Vietnamese \u0111\u1ED3ng", sv: "Vietnamesisk dong", symbol: "\u20AB", decimalPlaces: 0 },
|
|
2967
|
+
{ code: "UAH", en: "Ukrainian hryvnia", sv: "Ukrainsk hryvnia", symbol: "\u20B4", decimalPlaces: 2 },
|
|
2968
|
+
{ code: "EGP", en: "Egyptian pound", sv: "Egyptiskt pund", symbol: "E\xA3", decimalPlaces: 2 },
|
|
2969
|
+
{ code: "NGN", en: "Nigerian naira", sv: "Nigeriansk naira", symbol: "\u20A6", decimalPlaces: 2 },
|
|
2970
|
+
{ code: "KES", en: "Kenyan shilling", sv: "Kenyansk shilling", symbol: "KSh", decimalPlaces: 2 },
|
|
2971
|
+
{ code: "COP", en: "Colombian peso", sv: "Colombiansk peso", symbol: "CO$", decimalPlaces: 2 },
|
|
2972
|
+
{ code: "ARS", en: "Argentine peso", sv: "Argentinsk peso", symbol: "AR$", decimalPlaces: 2 },
|
|
2973
|
+
{ code: "CLP", en: "Chilean peso", sv: "Chilensk peso", symbol: "CL$", decimalPlaces: 0 },
|
|
2974
|
+
{ code: "PEN", en: "Peruvian sol", sv: "Peruansk sol", symbol: "S/.", decimalPlaces: 2 }
|
|
2975
|
+
];
|
|
2976
|
+
var Currency = class _Currency {
|
|
2977
|
+
static typeInfo = Object.freeze({
|
|
2978
|
+
englishName: "Currency",
|
|
2979
|
+
localizedName: "Valuta",
|
|
2980
|
+
emoji: "\u{1F4B1}",
|
|
2981
|
+
sources: Object.freeze([
|
|
2982
|
+
"https://www.iso.org/iso-4217-currency-codes.html",
|
|
2983
|
+
"https://en.wikipedia.org/wiki/ISO_4217"
|
|
2984
|
+
])
|
|
2985
|
+
});
|
|
2986
|
+
code;
|
|
2987
|
+
englishName;
|
|
2988
|
+
localizedName;
|
|
2989
|
+
symbol;
|
|
2990
|
+
decimalPlaces;
|
|
2991
|
+
constructor(row) {
|
|
2992
|
+
this.code = row.code;
|
|
2993
|
+
this.englishName = row.en;
|
|
2994
|
+
this.localizedName = row.sv;
|
|
2995
|
+
this.symbol = row.symbol;
|
|
2996
|
+
this.decimalPlaces = row.decimalPlaces;
|
|
2997
|
+
}
|
|
2998
|
+
/** @internal */
|
|
2999
|
+
static _fromRow(row) {
|
|
3000
|
+
return new _Currency(row);
|
|
3001
|
+
}
|
|
3002
|
+
/** Display name in current UI culture (Swedish or English). */
|
|
3003
|
+
/**
|
|
3004
|
+
* The currency name as used in its issuing country. Falls back to
|
|
3005
|
+
* {@link englishName} when no issuing country is known.
|
|
3006
|
+
*/
|
|
3007
|
+
get nativeName() {
|
|
3008
|
+
const country = Country.all.find(
|
|
3009
|
+
(c) => c.currencyCode != null && c.currencyCode.toUpperCase() === this.code.toUpperCase()
|
|
3010
|
+
);
|
|
3011
|
+
if (country === void 0) return this.englishName;
|
|
3012
|
+
return country.nativeName === country.englishName ? this.englishName : this.localizedName;
|
|
3013
|
+
}
|
|
3014
|
+
get displayName() {
|
|
3015
|
+
return PrimitivesDefaults.useLocalizedDisplayNames ? this.localizedName : this.englishName;
|
|
3016
|
+
}
|
|
3017
|
+
static tryParse(input) {
|
|
3018
|
+
if (input == null || input.trim() === "") return null;
|
|
3019
|
+
const trimmed = sanitizeInput(input).trim();
|
|
3020
|
+
const byCode = BY_CODE.get(trimmed.toUpperCase());
|
|
3021
|
+
if (byCode) return byCode;
|
|
3022
|
+
const byName = BY_NAME2.get(trimmed.toLowerCase());
|
|
3023
|
+
if (byName) return byName;
|
|
3024
|
+
return null;
|
|
3025
|
+
}
|
|
3026
|
+
static parse(input) {
|
|
3027
|
+
const r = _Currency.tryParse(input);
|
|
3028
|
+
if (r === null) throw new Error("Unknown currency.");
|
|
3029
|
+
return r;
|
|
3030
|
+
}
|
|
3031
|
+
static isValid(input) {
|
|
3032
|
+
return _Currency.tryParse(input) !== null;
|
|
3033
|
+
}
|
|
3034
|
+
static format(input, options) {
|
|
3035
|
+
const r = _Currency.tryParse(input);
|
|
3036
|
+
if (r) return r.displayName;
|
|
3037
|
+
if (options?.fallbackToTrimmedInputWhenInvalid && input != null && input.trim() !== "") {
|
|
3038
|
+
return input.trim();
|
|
3039
|
+
}
|
|
3040
|
+
return null;
|
|
3041
|
+
}
|
|
3042
|
+
static normalize(input, options) {
|
|
3043
|
+
const r = _Currency.tryParse(input);
|
|
3044
|
+
if (r) return r.code;
|
|
3045
|
+
if (options?.fallbackToTrimmedInputWhenInvalid && input != null && input.trim() !== "") {
|
|
3046
|
+
return input.trim();
|
|
3047
|
+
}
|
|
3048
|
+
return null;
|
|
3049
|
+
}
|
|
3050
|
+
static isNormalized(input) {
|
|
3051
|
+
return input != null && _Currency.normalize(input) === input;
|
|
3052
|
+
}
|
|
3053
|
+
/** All known currencies. */
|
|
3054
|
+
static get all() {
|
|
3055
|
+
return ALL_CURRENCIES;
|
|
3056
|
+
}
|
|
3057
|
+
/** @internal Lookup by symbol. */
|
|
3058
|
+
static tryParseSymbol(symbol) {
|
|
3059
|
+
if (symbol == null || symbol.trim() === "") return null;
|
|
3060
|
+
return BY_SYMBOL.get(symbol.trim().toLowerCase()) ?? null;
|
|
3061
|
+
}
|
|
3062
|
+
toNormalizedString() {
|
|
3063
|
+
return this.code;
|
|
3064
|
+
}
|
|
3065
|
+
toString() {
|
|
3066
|
+
return this.displayName;
|
|
3067
|
+
}
|
|
3068
|
+
toDisplayString() {
|
|
3069
|
+
return this.displayName;
|
|
3070
|
+
}
|
|
3071
|
+
toEnglishString() {
|
|
3072
|
+
return this.englishName;
|
|
3073
|
+
}
|
|
3074
|
+
toNativeString() {
|
|
3075
|
+
return this.nativeName;
|
|
3076
|
+
}
|
|
3077
|
+
equals(other) {
|
|
3078
|
+
return other != null && this.code === other.code;
|
|
3079
|
+
}
|
|
3080
|
+
compareTo(other) {
|
|
3081
|
+
if (other == null) return 1;
|
|
3082
|
+
return this.code < other.code ? -1 : this.code > other.code ? 1 : 0;
|
|
3083
|
+
}
|
|
3084
|
+
static get SEK() {
|
|
3085
|
+
return BY_CODE.get("SEK");
|
|
3086
|
+
}
|
|
3087
|
+
static get EUR() {
|
|
3088
|
+
return BY_CODE.get("EUR");
|
|
3089
|
+
}
|
|
3090
|
+
static get USD() {
|
|
3091
|
+
return BY_CODE.get("USD");
|
|
3092
|
+
}
|
|
3093
|
+
static get NOK() {
|
|
3094
|
+
return BY_CODE.get("NOK");
|
|
3095
|
+
}
|
|
3096
|
+
static get DKK() {
|
|
3097
|
+
return BY_CODE.get("DKK");
|
|
3098
|
+
}
|
|
3099
|
+
static get GBP() {
|
|
3100
|
+
return BY_CODE.get("GBP");
|
|
3101
|
+
}
|
|
3102
|
+
};
|
|
3103
|
+
var ALL_CURRENCIES = KNOWN_CURRENCIES.map((r) => Currency._fromRow(r));
|
|
3104
|
+
var BY_CODE = /* @__PURE__ */ new Map();
|
|
3105
|
+
for (const c of ALL_CURRENCIES) BY_CODE.set(c.code.toUpperCase(), c);
|
|
3106
|
+
var BY_NAME2 = /* @__PURE__ */ new Map();
|
|
3107
|
+
for (const c of ALL_CURRENCIES) {
|
|
3108
|
+
BY_NAME2.set(c.englishName.toLowerCase(), c);
|
|
3109
|
+
BY_NAME2.set(c.localizedName.toLowerCase(), c);
|
|
3110
|
+
}
|
|
3111
|
+
var BY_SYMBOL = /* @__PURE__ */ new Map();
|
|
3112
|
+
for (const c of ALL_CURRENCIES) {
|
|
3113
|
+
if (!BY_SYMBOL.has(c.symbol.toLowerCase())) BY_SYMBOL.set(c.symbol.toLowerCase(), c);
|
|
3114
|
+
}
|
|
3115
|
+
function getCurrencyForCountry(country) {
|
|
3116
|
+
const codes = country.currencyCodes;
|
|
3117
|
+
if (codes.length === 0) return null;
|
|
3118
|
+
const first = codes[0];
|
|
3119
|
+
if (first == null) return null;
|
|
3120
|
+
return Currency.tryParse(first);
|
|
3121
|
+
}
|
|
3122
|
+
|
|
3123
|
+
// src/internal/luhn.ts
|
|
3124
|
+
function luhnIsValid(digits) {
|
|
3125
|
+
if (!digits) return false;
|
|
3126
|
+
let sum = 0;
|
|
3127
|
+
const len = digits.length;
|
|
3128
|
+
for (let i = 0; i < len; i++) {
|
|
3129
|
+
const code = digits.charCodeAt(i);
|
|
3130
|
+
if (code < 48 || code > 57) return false;
|
|
3131
|
+
let d = code - 48;
|
|
3132
|
+
if ((len - i) % 2 === 0) {
|
|
3133
|
+
d *= 2;
|
|
3134
|
+
if (d > 9) d -= 9;
|
|
3135
|
+
}
|
|
3136
|
+
sum += d;
|
|
3137
|
+
}
|
|
3138
|
+
return sum % 10 === 0;
|
|
3139
|
+
}
|
|
3140
|
+
|
|
3141
|
+
// src/finance/isin.ts
|
|
3142
|
+
var ISIN_LENGTH = 12;
|
|
3143
|
+
var MAX_INPUT_LENGTH4 = 30;
|
|
3144
|
+
var Isin = class _Isin {
|
|
3145
|
+
static typeInfo = Object.freeze({
|
|
3146
|
+
englishName: "ISIN",
|
|
3147
|
+
localizedName: "ISIN",
|
|
3148
|
+
emoji: "\u{1F4C8}",
|
|
3149
|
+
sources: Object.freeze([
|
|
3150
|
+
"https://www.iso.org/standard/78502.html",
|
|
3151
|
+
"https://en.wikipedia.org/wiki/International_Securities_Identification_Number",
|
|
3152
|
+
"https://www.anna-web.org/"
|
|
3153
|
+
])
|
|
3154
|
+
});
|
|
3155
|
+
/** The 12-character ISIN in uppercase, e.g. `SE0000108656`. */
|
|
3156
|
+
value;
|
|
3157
|
+
/** ISO 3166-1 alpha-2 country code (chars 1-2), e.g. `SE`. */
|
|
3158
|
+
get countryCode() {
|
|
3159
|
+
return this.value.slice(0, 2);
|
|
3160
|
+
}
|
|
3161
|
+
/** National Securities Identifying Number (chars 3-11), e.g. `000010865`. */
|
|
3162
|
+
get nsin() {
|
|
3163
|
+
return this.value.slice(2, 11);
|
|
3164
|
+
}
|
|
3165
|
+
/** Luhn check digit (last char), e.g. `6`. */
|
|
3166
|
+
get checkDigit() {
|
|
3167
|
+
return this.value.slice(11, 12);
|
|
3168
|
+
}
|
|
3169
|
+
constructor(value) {
|
|
3170
|
+
this.value = value;
|
|
3171
|
+
}
|
|
3172
|
+
static tryParse(input) {
|
|
3173
|
+
if (input == null || input.trim() === "") return null;
|
|
3174
|
+
const cleaned = keepAsciiAlphanumericUppercase(input);
|
|
3175
|
+
if (cleaned.length > MAX_INPUT_LENGTH4) return null;
|
|
3176
|
+
if (cleaned.length !== ISIN_LENGTH) return null;
|
|
3177
|
+
const c0 = cleaned.charCodeAt(0);
|
|
3178
|
+
const c1 = cleaned.charCodeAt(1);
|
|
3179
|
+
if (c0 < 65 || c0 > 90) return null;
|
|
3180
|
+
if (c1 < 65 || c1 > 90) return null;
|
|
3181
|
+
const c11 = cleaned.charCodeAt(11);
|
|
3182
|
+
if (c11 < 48 || c11 > 57) return null;
|
|
3183
|
+
for (let i = 2; i < 11; i++) {
|
|
3184
|
+
const c = cleaned.charCodeAt(i);
|
|
3185
|
+
if (!(c >= 48 && c <= 57 || c >= 65 && c <= 90)) return null;
|
|
3186
|
+
}
|
|
3187
|
+
if (!isValidLuhnCheckDigit(cleaned)) return null;
|
|
3188
|
+
return new _Isin(cleaned);
|
|
3189
|
+
}
|
|
3190
|
+
static parse(input) {
|
|
3191
|
+
const r = _Isin.tryParse(input);
|
|
3192
|
+
if (r === null) throw new Error("Invalid ISIN (length, format, or check digit invalid).");
|
|
3193
|
+
return r;
|
|
3194
|
+
}
|
|
3195
|
+
static isValid(input) {
|
|
3196
|
+
return _Isin.tryParse(input) !== null;
|
|
3197
|
+
}
|
|
3198
|
+
static format(input, options) {
|
|
3199
|
+
const r = _Isin.tryParse(input);
|
|
3200
|
+
if (r) return r.value;
|
|
3201
|
+
if (options?.fallbackToTrimmedInputWhenInvalid && input != null && input.trim() !== "") {
|
|
3202
|
+
return input.trim();
|
|
3203
|
+
}
|
|
3204
|
+
return null;
|
|
3205
|
+
}
|
|
3206
|
+
static normalize(input, options) {
|
|
3207
|
+
const r = _Isin.tryParse(input);
|
|
3208
|
+
if (r) return r.value;
|
|
3209
|
+
if (options?.fallbackToTrimmedInputWhenInvalid && input != null && input.trim() !== "") {
|
|
3210
|
+
return input.trim();
|
|
3211
|
+
}
|
|
3212
|
+
return null;
|
|
3213
|
+
}
|
|
3214
|
+
static isNormalized(input) {
|
|
3215
|
+
return input != null && _Isin.normalize(input) === input;
|
|
3216
|
+
}
|
|
3217
|
+
toNormalizedString() {
|
|
3218
|
+
return this.value;
|
|
3219
|
+
}
|
|
3220
|
+
toString() {
|
|
3221
|
+
return this.value;
|
|
3222
|
+
}
|
|
3223
|
+
static findCandidatesInText(text) {
|
|
3224
|
+
if (!text) return [];
|
|
3225
|
+
const out = [];
|
|
3226
|
+
const re = /(?<![A-Z0-9])[A-Z]{2}[A-Z0-9]{9}\d(?![A-Z0-9])/gu;
|
|
3227
|
+
let m;
|
|
3228
|
+
while ((m = re.exec(text)) !== null) {
|
|
3229
|
+
const r = _Isin.tryParse(m[0]);
|
|
3230
|
+
if (!r) continue;
|
|
3231
|
+
out.push(
|
|
3232
|
+
new TextCandidate({
|
|
3233
|
+
startIndex: m.index,
|
|
3234
|
+
length: m[0].length,
|
|
3235
|
+
originalText: m[0],
|
|
3236
|
+
typeName: "Isin",
|
|
3237
|
+
category: TextCandidateCategory.Financial,
|
|
3238
|
+
normalizedForm: r.toNormalizedString(),
|
|
3239
|
+
formattedForm: r.toString(),
|
|
3240
|
+
maskedForm: maskIsin(r),
|
|
3241
|
+
confidence: TextMatchConfidence.High,
|
|
3242
|
+
value: r
|
|
3243
|
+
})
|
|
3244
|
+
);
|
|
3245
|
+
}
|
|
3246
|
+
return out;
|
|
3247
|
+
}
|
|
3248
|
+
equals(other) {
|
|
3249
|
+
return other != null && this.value === other.value;
|
|
3250
|
+
}
|
|
3251
|
+
compareTo(other) {
|
|
3252
|
+
if (other == null) return 1;
|
|
3253
|
+
return this.value < other.value ? -1 : this.value > other.value ? 1 : 0;
|
|
3254
|
+
}
|
|
3255
|
+
};
|
|
3256
|
+
function isValidLuhnCheckDigit(isin) {
|
|
3257
|
+
let digits = "";
|
|
3258
|
+
for (let i = 0; i < isin.length; i++) {
|
|
3259
|
+
const c = isin.charCodeAt(i);
|
|
3260
|
+
if (c >= 48 && c <= 57) {
|
|
3261
|
+
digits += isin[i];
|
|
3262
|
+
} else if (c >= 65 && c <= 90) {
|
|
3263
|
+
digits += String(c - 65 + 10);
|
|
3264
|
+
} else {
|
|
3265
|
+
return false;
|
|
3266
|
+
}
|
|
3267
|
+
}
|
|
3268
|
+
return luhnIsValid(digits);
|
|
3269
|
+
}
|
|
3270
|
+
function maskIsin(isin) {
|
|
3271
|
+
return isin.countryCode + "*".repeat(isin.value.length - 2);
|
|
3272
|
+
}
|
|
3273
|
+
|
|
3274
|
+
// src/finance/exchange-rates.ts
|
|
3275
|
+
var ExchangeRates = class {
|
|
3276
|
+
#rates = /* @__PURE__ */ new Map();
|
|
3277
|
+
/**
|
|
3278
|
+
* Adds a rate from `from` to `to`. A rate of `0.095` from SEK to USD means
|
|
3279
|
+
* `1 SEK = 0.095 USD`. Returns `this` for fluent chaining.
|
|
3280
|
+
*/
|
|
3281
|
+
addRate(from, to, rate) {
|
|
3282
|
+
if (!(rate > 0)) throw new Error("Exchange rate must be positive.");
|
|
3283
|
+
this.#rates.set(`${from.code}|${to.code}`, rate);
|
|
3284
|
+
const inverseKey = `${to.code}|${from.code}`;
|
|
3285
|
+
if (!this.#rates.has(inverseKey)) {
|
|
3286
|
+
this.#rates.set(inverseKey, 1 / rate);
|
|
3287
|
+
}
|
|
3288
|
+
return this;
|
|
3289
|
+
}
|
|
3290
|
+
getRate(from, to) {
|
|
3291
|
+
if (from.code === to.code) return 1;
|
|
3292
|
+
const r = this.#rates.get(`${from.code}|${to.code}`);
|
|
3293
|
+
if (r === void 0)
|
|
3294
|
+
throw new Error(`No exchange rate available from ${from.code} to ${to.code}.`);
|
|
3295
|
+
return r;
|
|
3296
|
+
}
|
|
3297
|
+
tryGetRate(from, to) {
|
|
3298
|
+
if (from.code === to.code) return 1;
|
|
3299
|
+
return this.#rates.get(`${from.code}|${to.code}`) ?? null;
|
|
3300
|
+
}
|
|
3301
|
+
};
|
|
3302
|
+
|
|
3303
|
+
// src/finance/money-amount.ts
|
|
3304
|
+
var MAX_INPUT_LENGTH5 = 100;
|
|
3305
|
+
var PRECISION_EPSILON = 1e-9;
|
|
3306
|
+
var MoneyAmount = class _MoneyAmount {
|
|
3307
|
+
static typeInfo = Object.freeze({
|
|
3308
|
+
englishName: "Money Amount",
|
|
3309
|
+
localizedName: "Belopp",
|
|
3310
|
+
emoji: "\u{1F4B0}",
|
|
3311
|
+
sources: Object.freeze(["https://www.iso.org/iso-4217-currency-codes.html"])
|
|
3312
|
+
});
|
|
3313
|
+
amount;
|
|
3314
|
+
currency;
|
|
3315
|
+
constructor(amount, currency) {
|
|
3316
|
+
this.amount = amount;
|
|
3317
|
+
this.currency = currency;
|
|
3318
|
+
}
|
|
3319
|
+
/** Creates a {@link MoneyAmount} from an explicit amount and currency. */
|
|
3320
|
+
static create(amount, currency) {
|
|
3321
|
+
if (!hasSupportedPrecision(amount, currency.decimalPlaces)) {
|
|
3322
|
+
throw new Error(
|
|
3323
|
+
`Currency ${currency.code} supports at most ${currency.decimalPlaces} decimal places.`
|
|
3324
|
+
);
|
|
3325
|
+
}
|
|
3326
|
+
return new _MoneyAmount(amount, currency);
|
|
3327
|
+
}
|
|
3328
|
+
static tryParse(input, options) {
|
|
3329
|
+
if (input == null || input.trim() === "") return null;
|
|
3330
|
+
const trimmed = sanitizeInput(input).trim();
|
|
3331
|
+
if (trimmed.length > MAX_INPUT_LENGTH5) return null;
|
|
3332
|
+
const fallback = options?.fallbackCurrency ?? null;
|
|
3333
|
+
const split = splitCurrencyAndNumber(trimmed, fallback);
|
|
3334
|
+
if (split === null) return null;
|
|
3335
|
+
const amount = tryParseNumber(split.numberPart, split.currency);
|
|
3336
|
+
if (amount === null) return null;
|
|
3337
|
+
return new _MoneyAmount(amount, split.currency);
|
|
3338
|
+
}
|
|
3339
|
+
static parse(input, options) {
|
|
3340
|
+
const r = _MoneyAmount.tryParse(input, options);
|
|
3341
|
+
if (r === null) throw new Error("Invalid money amount.");
|
|
3342
|
+
return r;
|
|
3343
|
+
}
|
|
3344
|
+
static isValid(input, options) {
|
|
3345
|
+
return _MoneyAmount.tryParse(input, options) !== null;
|
|
3346
|
+
}
|
|
3347
|
+
/** Returns the amount formatted using the default culture's numeric conventions, e.g. `1 000,00 SEK`. */
|
|
3348
|
+
static format(input, options) {
|
|
3349
|
+
const r = _MoneyAmount.tryParse(input, options);
|
|
3350
|
+
if (r) return r.toString();
|
|
3351
|
+
if (options?.fallbackToTrimmedInputWhenInvalid && input != null && input.trim() !== "") {
|
|
3352
|
+
return input.trim();
|
|
3353
|
+
}
|
|
3354
|
+
return null;
|
|
3355
|
+
}
|
|
3356
|
+
/** Returns the amount as a plain decimal string with the ISO code, e.g. `1000.50 SEK`. */
|
|
3357
|
+
static normalize(input, options) {
|
|
3358
|
+
const r = _MoneyAmount.tryParse(input, options);
|
|
3359
|
+
if (r) return r.toNormalizedString();
|
|
3360
|
+
if (options?.fallbackToTrimmedInputWhenInvalid && input != null && input.trim() !== "") {
|
|
3361
|
+
return input.trim();
|
|
3362
|
+
}
|
|
3363
|
+
return null;
|
|
3364
|
+
}
|
|
3365
|
+
static isNormalized(input) {
|
|
3366
|
+
return input != null && _MoneyAmount.normalize(input) === input;
|
|
3367
|
+
}
|
|
3368
|
+
/** `1000.50 SEK` (invariant culture). */
|
|
3369
|
+
toNormalizedString() {
|
|
3370
|
+
return `${formatInvariant(this.amount, this.currency.decimalPlaces)} ${this.currency.code}`;
|
|
3371
|
+
}
|
|
3372
|
+
/** `1 000,00 SEK` (current culture). */
|
|
3373
|
+
toString() {
|
|
3374
|
+
const formatted = new Intl.NumberFormat(PrimitivesDefaults.culture, {
|
|
3375
|
+
minimumFractionDigits: this.currency.decimalPlaces,
|
|
3376
|
+
maximumFractionDigits: this.currency.decimalPlaces,
|
|
3377
|
+
useGrouping: true
|
|
3378
|
+
}).format(this.amount);
|
|
3379
|
+
return `${formatted} ${this.currency.code}`;
|
|
3380
|
+
}
|
|
3381
|
+
// --- Arithmetic ---
|
|
3382
|
+
add(other) {
|
|
3383
|
+
if (this.currency.code !== other.currency.code) {
|
|
3384
|
+
throw new Error(`Cannot add ${this.currency.code} and ${other.currency.code}.`);
|
|
3385
|
+
}
|
|
3386
|
+
return new _MoneyAmount(
|
|
3387
|
+
roundTo(this.amount + other.amount, this.currency.decimalPlaces),
|
|
3388
|
+
this.currency
|
|
3389
|
+
);
|
|
3390
|
+
}
|
|
3391
|
+
subtract(other) {
|
|
3392
|
+
if (this.currency.code !== other.currency.code) {
|
|
3393
|
+
throw new Error(`Cannot subtract ${other.currency.code} from ${this.currency.code}.`);
|
|
3394
|
+
}
|
|
3395
|
+
return new _MoneyAmount(
|
|
3396
|
+
roundTo(this.amount - other.amount, this.currency.decimalPlaces),
|
|
3397
|
+
this.currency
|
|
3398
|
+
);
|
|
3399
|
+
}
|
|
3400
|
+
multiply(factor) {
|
|
3401
|
+
return new _MoneyAmount(
|
|
3402
|
+
roundTo(this.amount * factor, this.currency.decimalPlaces),
|
|
3403
|
+
this.currency
|
|
3404
|
+
);
|
|
3405
|
+
}
|
|
3406
|
+
divide(divisor) {
|
|
3407
|
+
if (divisor === 0) throw new Error("Division by zero.");
|
|
3408
|
+
return new _MoneyAmount(
|
|
3409
|
+
roundTo(this.amount / divisor, this.currency.decimalPlaces),
|
|
3410
|
+
this.currency
|
|
3411
|
+
);
|
|
3412
|
+
}
|
|
3413
|
+
negate() {
|
|
3414
|
+
return new _MoneyAmount(-this.amount, this.currency);
|
|
3415
|
+
}
|
|
3416
|
+
/**
|
|
3417
|
+
* Converts this amount to `target` using either an explicit rate or an
|
|
3418
|
+
* {@link IExchangeRates} provider. The result is rounded to the target
|
|
3419
|
+
* currency's decimal places using half-up rounding.
|
|
3420
|
+
*/
|
|
3421
|
+
convertTo(target, rateOrRates) {
|
|
3422
|
+
let rate;
|
|
3423
|
+
if (typeof rateOrRates === "number") {
|
|
3424
|
+
rate = rateOrRates;
|
|
3425
|
+
} else {
|
|
3426
|
+
rate = rateOrRates.getRate(this.currency, target);
|
|
3427
|
+
}
|
|
3428
|
+
if (!(rate > 0)) throw new Error("Exchange rate must be positive.");
|
|
3429
|
+
const converted = roundTo(this.amount * rate, target.decimalPlaces);
|
|
3430
|
+
return new _MoneyAmount(converted, target);
|
|
3431
|
+
}
|
|
3432
|
+
// --- Equality / ordering ---
|
|
3433
|
+
equals(other) {
|
|
3434
|
+
return other != null && this.amount === other.amount && this.currency.code === other.currency.code;
|
|
3435
|
+
}
|
|
3436
|
+
compareTo(other) {
|
|
3437
|
+
if (other == null) return 1;
|
|
3438
|
+
const c = this.currency.code < other.currency.code ? -1 : this.currency.code > other.currency.code ? 1 : 0;
|
|
3439
|
+
if (c !== 0) return c;
|
|
3440
|
+
return this.amount < other.amount ? -1 : this.amount > other.amount ? 1 : 0;
|
|
3441
|
+
}
|
|
3442
|
+
};
|
|
3443
|
+
function hasSupportedPrecision(amount, decimalPlaces) {
|
|
3444
|
+
if (!Number.isFinite(amount)) return false;
|
|
3445
|
+
const factor = Math.pow(10, decimalPlaces);
|
|
3446
|
+
const rounded = Math.round(amount * factor) / factor;
|
|
3447
|
+
if (Math.abs(amount - rounded) > Math.max(Math.abs(amount), 1) * PRECISION_EPSILON) {
|
|
3448
|
+
return false;
|
|
3449
|
+
}
|
|
3450
|
+
return true;
|
|
3451
|
+
}
|
|
3452
|
+
function roundTo(amount, decimalPlaces) {
|
|
3453
|
+
const factor = Math.pow(10, decimalPlaces);
|
|
3454
|
+
return Math.round(amount * factor) / factor;
|
|
3455
|
+
}
|
|
3456
|
+
function formatInvariant(amount, decimalPlaces) {
|
|
3457
|
+
if (decimalPlaces === 0 || Number.isInteger(amount)) {
|
|
3458
|
+
return Math.round(amount).toString();
|
|
3459
|
+
}
|
|
3460
|
+
return amount.toFixed(decimalPlaces);
|
|
3461
|
+
}
|
|
3462
|
+
function splitCurrencyAndNumber(input, fallback) {
|
|
3463
|
+
const prefix = tryMatchPrefix(input, fallback);
|
|
3464
|
+
if (prefix) return prefix;
|
|
3465
|
+
const suffix = tryMatchSuffix(input, fallback);
|
|
3466
|
+
if (suffix) return suffix;
|
|
3467
|
+
if (fallback === null) return null;
|
|
3468
|
+
return { currency: fallback, numberPart: input };
|
|
3469
|
+
}
|
|
3470
|
+
function isLatinLetter(ch) {
|
|
3471
|
+
if (!ch) return false;
|
|
3472
|
+
const c = ch.charCodeAt(0);
|
|
3473
|
+
return c >= 65 && c <= 90 || c >= 97 && c <= 122;
|
|
3474
|
+
}
|
|
3475
|
+
function tryMatchPrefix(input, fallback) {
|
|
3476
|
+
if (input.length >= 4 && isLatinLetter(input[0]) && isLatinLetter(input[1]) && isLatinLetter(input[2])) {
|
|
3477
|
+
const code = input.slice(0, 3);
|
|
3478
|
+
const rest = input.slice(3).replace(/^\s+/, "");
|
|
3479
|
+
if (rest.length > 0) {
|
|
3480
|
+
const c = Currency.tryParse(code);
|
|
3481
|
+
if (c) return { currency: c, numberPart: rest };
|
|
3482
|
+
}
|
|
3483
|
+
}
|
|
3484
|
+
return tryResolveSymbolPrefix(input, fallback);
|
|
3485
|
+
}
|
|
3486
|
+
function tryMatchSuffix(input, fallback) {
|
|
3487
|
+
if (input.length >= 4 && isLatinLetter(input[input.length - 1]) && isLatinLetter(input[input.length - 2]) && isLatinLetter(input[input.length - 3])) {
|
|
3488
|
+
const code = input.slice(-3);
|
|
3489
|
+
const rest = input.slice(0, -3).replace(/\s+$/, "");
|
|
3490
|
+
if (rest.length > 0) {
|
|
3491
|
+
const c = Currency.tryParse(code);
|
|
3492
|
+
if (c) return { currency: c, numberPart: rest };
|
|
3493
|
+
}
|
|
3494
|
+
}
|
|
3495
|
+
return tryResolveSymbolSuffix(input, fallback);
|
|
3496
|
+
}
|
|
3497
|
+
function getDistinctSymbols() {
|
|
3498
|
+
const seen = /* @__PURE__ */ new Set();
|
|
3499
|
+
for (const c of Currency.all) {
|
|
3500
|
+
seen.add(c.symbol.toLowerCase());
|
|
3501
|
+
}
|
|
3502
|
+
return Array.from(seen).sort((a, b) => b.length - a.length);
|
|
3503
|
+
}
|
|
3504
|
+
function tryResolveSymbolPrefix(input, fallback) {
|
|
3505
|
+
const inputLower = input.toLowerCase();
|
|
3506
|
+
for (const symbol of getDistinctSymbols()) {
|
|
3507
|
+
if (!inputLower.startsWith(symbol)) continue;
|
|
3508
|
+
const rest = input.slice(symbol.length).replace(/^\s+/, "");
|
|
3509
|
+
if (rest.length === 0) return null;
|
|
3510
|
+
const currency = resolveCurrencyForSymbol(symbol, fallback);
|
|
3511
|
+
if (!currency) continue;
|
|
3512
|
+
return { currency, numberPart: rest };
|
|
3513
|
+
}
|
|
3514
|
+
return null;
|
|
3515
|
+
}
|
|
3516
|
+
function tryResolveSymbolSuffix(input, fallback) {
|
|
3517
|
+
const inputLower = input.toLowerCase();
|
|
3518
|
+
for (const symbol of getDistinctSymbols()) {
|
|
3519
|
+
if (!inputLower.endsWith(symbol)) continue;
|
|
3520
|
+
const rest = input.slice(0, input.length - symbol.length).replace(/\s+$/, "");
|
|
3521
|
+
if (rest.length === 0) return null;
|
|
3522
|
+
const currency = resolveCurrencyForSymbol(symbol, fallback);
|
|
3523
|
+
if (!currency) continue;
|
|
3524
|
+
return { currency, numberPart: rest };
|
|
3525
|
+
}
|
|
3526
|
+
return null;
|
|
3527
|
+
}
|
|
3528
|
+
function resolveCurrencyForSymbol(symbol, fallback) {
|
|
3529
|
+
if (fallback && fallback.symbol.toLowerCase() === symbol) return fallback;
|
|
3530
|
+
for (const c of Currency.all) {
|
|
3531
|
+
if (c.symbol.toLowerCase() === symbol) return c;
|
|
3532
|
+
}
|
|
3533
|
+
return null;
|
|
3534
|
+
}
|
|
3535
|
+
function tryParseNumber(raw, currency) {
|
|
3536
|
+
let s = raw.trim();
|
|
3537
|
+
if (s.length === 0) return null;
|
|
3538
|
+
let negative = false;
|
|
3539
|
+
if (s[0] === "-") {
|
|
3540
|
+
negative = true;
|
|
3541
|
+
s = s.slice(1).replace(/^\s+/, "");
|
|
3542
|
+
} else if (s[0] === "+") {
|
|
3543
|
+
s = s.slice(1).replace(/^\s+/, "");
|
|
3544
|
+
}
|
|
3545
|
+
if (s.length === 0) return null;
|
|
3546
|
+
const lastComma = s.lastIndexOf(",");
|
|
3547
|
+
const lastPeriod = s.lastIndexOf(".");
|
|
3548
|
+
let integerPart;
|
|
3549
|
+
let fracPart = "";
|
|
3550
|
+
if (lastComma > lastPeriod) {
|
|
3551
|
+
const afterComma = s.slice(lastComma + 1);
|
|
3552
|
+
if (afterComma.length <= 2 && /^\d+$/.test(afterComma)) {
|
|
3553
|
+
fracPart = afterComma;
|
|
3554
|
+
integerPart = s.slice(0, lastComma);
|
|
3555
|
+
} else {
|
|
3556
|
+
integerPart = s;
|
|
3557
|
+
}
|
|
3558
|
+
} else if (lastPeriod > lastComma) {
|
|
3559
|
+
const afterPeriod = s.slice(lastPeriod + 1);
|
|
3560
|
+
if (afterPeriod.length <= 2 && /^\d+$/.test(afterPeriod)) {
|
|
3561
|
+
fracPart = afterPeriod;
|
|
3562
|
+
integerPart = s.slice(0, lastPeriod);
|
|
3563
|
+
} else {
|
|
3564
|
+
integerPart = s;
|
|
3565
|
+
}
|
|
3566
|
+
} else {
|
|
3567
|
+
integerPart = s;
|
|
3568
|
+
}
|
|
3569
|
+
const cleanInteger = integerPart.replace(/[\s\u00A0.,]/g, "");
|
|
3570
|
+
if (cleanInteger.length === 0 || !/^\d+$/.test(cleanInteger)) return null;
|
|
3571
|
+
if (fracPart.length > currency.decimalPlaces) return null;
|
|
3572
|
+
const combined = fracPart.length > 0 ? `${cleanInteger}.${fracPart}` : cleanInteger;
|
|
3573
|
+
const parsed = Number(combined);
|
|
3574
|
+
if (!Number.isFinite(parsed)) return null;
|
|
3575
|
+
if (!hasSupportedPrecision(parsed, currency.decimalPlaces)) return null;
|
|
3576
|
+
return negative ? -parsed : parsed;
|
|
3577
|
+
}
|
|
3578
|
+
function maskMoneyAmount(amount) {
|
|
3579
|
+
return `*** ${amount.currency.code}`;
|
|
3580
|
+
}
|
|
3581
|
+
|
|
3582
|
+
export { Currency, ExchangeRates, Isin, MoneyAmount, getCurrencyForCountry, maskIsin, maskMoneyAmount };
|
|
3583
|
+
//# sourceMappingURL=index.js.map
|
|
3584
|
+
//# sourceMappingURL=index.js.map
|