| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
|
|
| import iso2ToRegionData from './iso2-to-region.json' with { type: 'json' }; |
|
|
| |
| export const REGION_IDS = [ |
| 'mena', |
| 'east-asia', |
| 'europe', |
| 'north-america', |
| 'south-asia', |
| 'latam', |
| 'sub-saharan-africa', |
| 'global', |
| ]; |
|
|
| export const GEOGRAPHY_VERSION = '1.0.0'; |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| export const REGIONS = [ |
| { |
| id: 'mena', |
| label: 'Middle East & North Africa', |
| forecastLabel: 'Middle East', |
| wbCode: 'MEA', |
| theaters: ['levant', 'persian-gulf', 'red-sea', 'north-africa'], |
| signalAliases: ['middle east', 'mena'], |
| feedRegion: 'middleeast', |
| mapView: 'mena', |
| keyCountries: ['SA', 'IR', 'IL', 'AE', 'EG', 'IQ', 'TR'], |
| }, |
| { |
| id: 'east-asia', |
| label: 'East Asia & Pacific', |
| forecastLabel: 'East Asia', |
| wbCode: 'EAS', |
| theaters: ['east-asia', 'southeast-asia'], |
| signalAliases: ['asia pacific', 'apac'], |
| feedRegion: 'asia', |
| mapView: 'asia', |
| keyCountries: ['CN', 'JP', 'KR', 'TW', 'AU', 'SG', 'ID'], |
| }, |
| { |
| id: 'europe', |
| label: 'Europe & Central Asia', |
| forecastLabel: 'Europe', |
| wbCode: 'ECS', |
| theaters: ['eastern-europe', 'western-europe', 'baltic', 'arctic'], |
| |
| |
| |
| signalAliases: ['europe', 'european union'], |
| feedRegion: 'europe', |
| mapView: 'eu', |
| keyCountries: ['DE', 'FR', 'GB', 'UA', 'RU', 'PL', 'IT'], |
| }, |
| { |
| id: 'north-america', |
| label: 'North America', |
| forecastLabel: 'North America', |
| wbCode: 'NAC', |
| theaters: ['north-america'], |
| signalAliases: [], |
| feedRegion: 'us', |
| mapView: 'america', |
| keyCountries: ['US', 'CA', 'MX'], |
| }, |
| { |
| id: 'south-asia', |
| label: 'South Asia', |
| forecastLabel: 'South Asia', |
| wbCode: 'SAS', |
| theaters: ['south-asia'], |
| signalAliases: [], |
| feedRegion: 'asia', |
| mapView: 'asia', |
| keyCountries: ['IN', 'PK', 'BD', 'LK', 'AF'], |
| }, |
| { |
| id: 'latam', |
| label: 'Latin America & Caribbean', |
| forecastLabel: 'Latin America', |
| wbCode: 'LCN', |
| theaters: ['latin-america', 'caribbean'], |
| signalAliases: ['latam'], |
| feedRegion: 'latam', |
| mapView: 'latam', |
| keyCountries: ['BR', 'AR', 'CO', 'CL', 'VE', 'PE'], |
| }, |
| { |
| id: 'sub-saharan-africa', |
| label: 'Sub-Saharan Africa', |
| forecastLabel: 'Africa', |
| wbCode: 'SSF', |
| theaters: ['horn-of-africa', 'sahel', 'southern-africa', 'central-africa'], |
| signalAliases: ['sub-saharan africa', 'subsaharan africa'], |
| feedRegion: 'africa', |
| mapView: 'africa', |
| keyCountries: ['NG', 'ZA', 'KE', 'ET', 'SD', 'CD'], |
| }, |
| { |
| id: 'global', |
| label: 'Global', |
| forecastLabel: '', |
| wbCode: '1W', |
| theaters: ['global-markets'], |
| signalAliases: ['global'], |
| feedRegion: 'worldwide', |
| mapView: 'global', |
| keyCountries: ['US', 'CN', 'RU', 'DE', 'JP', 'IN', 'GB', 'SA'], |
| }, |
| ]; |
|
|
| |
| |
| |
| |
| |
| export const THEATERS = [ |
| |
| { id: 'levant', label: 'Levant', regionId: 'mena', corridorIds: [] }, |
| { id: 'persian-gulf', label: 'Persian Gulf', regionId: 'mena', corridorIds: ['hormuz'] }, |
| { id: 'red-sea', label: 'Red Sea', regionId: 'mena', corridorIds: ['babelm', 'suez'] }, |
| { id: 'north-africa', label: 'North Africa', regionId: 'mena', corridorIds: [] }, |
| |
| { id: 'east-asia', label: 'East Asia', regionId: 'east-asia', corridorIds: ['taiwan-strait'] }, |
| { id: 'southeast-asia', label: 'Southeast Asia', regionId: 'east-asia', corridorIds: ['malacca', 'south-china-sea'] }, |
| |
| { id: 'eastern-europe', label: 'Eastern Europe', regionId: 'europe', corridorIds: ['bosphorus'] }, |
| { id: 'western-europe', label: 'Western Europe', regionId: 'europe', corridorIds: ['english-channel'] }, |
| { id: 'baltic', label: 'Baltic', regionId: 'europe', corridorIds: ['danish'] }, |
| { id: 'arctic', label: 'Arctic', regionId: 'europe', corridorIds: [] }, |
| |
| { id: 'north-america', label: 'North America', regionId: 'north-america', corridorIds: ['panama'] }, |
| |
| { id: 'south-asia', label: 'South Asia', regionId: 'south-asia', corridorIds: [] }, |
| |
| { id: 'latin-america', label: 'Latin America', regionId: 'latam', corridorIds: [] }, |
| { id: 'caribbean', label: 'Caribbean', regionId: 'latam', corridorIds: ['panama'] }, |
| |
| { id: 'horn-of-africa', label: 'Horn of Africa', regionId: 'sub-saharan-africa', corridorIds: ['babelm'] }, |
| { id: 'sahel', label: 'Sahel', regionId: 'sub-saharan-africa', corridorIds: [] }, |
| { id: 'southern-africa', label: 'Southern Africa', regionId: 'sub-saharan-africa', corridorIds: ['cape-of-good-hope'] }, |
| { id: 'central-africa', label: 'Central Africa', regionId: 'sub-saharan-africa', corridorIds: [] }, |
| |
| { id: 'global-markets', label: 'Global Markets', regionId: 'global', corridorIds: [] }, |
| ]; |
|
|
| |
| |
| |
| |
| |
| |
| |
| export const CORRIDORS = [ |
| |
| { id: 'hormuz', label: 'Strait of Hormuz', theaterId: 'persian-gulf', chokepointId: 'hormuz', tier: 1, weight: 1.0 }, |
| { id: 'suez', label: 'Suez Canal', theaterId: 'red-sea', chokepointId: 'suez', tier: 1, weight: 1.0 }, |
| { id: 'babelm', label: 'Bab el-Mandeb', theaterId: 'red-sea', chokepointId: 'babelm', tier: 1, weight: 0.9 }, |
| { id: 'taiwan-strait', label: 'Taiwan Strait', theaterId: 'east-asia', chokepointId: 'taiwan_strait',tier: 1, weight: 0.9 }, |
| { id: 'bosphorus', label: 'Bosphorus', theaterId: 'eastern-europe', chokepointId: 'bosphorus', tier: 1, weight: 0.7 }, |
| |
| { id: 'malacca', label: 'Strait of Malacca', theaterId: 'southeast-asia', chokepointId: 'malacca', tier: 2, weight: 0.8 }, |
| { id: 'panama', label: 'Panama Canal', theaterId: 'north-america', chokepointId: 'panama', tier: 2, weight: 0.6 }, |
| { id: 'danish', label: 'Danish Straits', theaterId: 'baltic', chokepointId: 'danish', tier: 2, weight: 0.5 }, |
| |
| { id: 'cape-of-good-hope', label: 'Cape of Good Hope', theaterId: 'southern-africa', chokepointId: null, tier: 3, weight: 0.4 }, |
| { id: 'south-china-sea', label: 'South China Sea', theaterId: 'southeast-asia', chokepointId: null, tier: 3, weight: 0.6 }, |
| { id: 'english-channel', label: 'English Channel', theaterId: 'western-europe', chokepointId: null, tier: 3, weight: 0.4 }, |
| ]; |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| export const COUNTRY_CRITICALITY = { |
| |
| IR: 1.0, |
| OM: 1.0, |
| AE: 1.0, |
| SA: 1.0, |
| EG: 1.0, |
| YE: 1.0, |
| CN: 1.0, |
| TW: 1.0, |
| TR: 1.0, |
| US: 1.0, |
| RU: 1.0, |
| CA: 1.0, |
| |
| MY: 0.6, |
| SG: 0.6, |
| ID: 0.6, |
| PA: 0.6, |
| DK: 0.6, |
| DE: 0.6, |
| FR: 0.6, |
| GB: 0.6, |
| JP: 0.6, |
| IN: 0.6, |
| BR: 0.6, |
| MX: 0.6, |
| KR: 0.6, |
| IL: 0.6, |
| IQ: 0.6, |
| KW: 0.6, |
| QA: 0.6, |
| NG: 0.6, |
| AU: 0.6, |
| |
| }; |
|
|
| export const DEFAULT_COUNTRY_CRITICALITY = 0.3; |
|
|
| |
| |
| |
|
|
| |
| const ISO2_TO_REGION = iso2ToRegionData; |
|
|
| |
| export function getRegion(regionId) { |
| return REGIONS.find((r) => r.id === regionId) ?? null; |
| } |
|
|
| |
| export function getRegionCountries(regionId) { |
| const out = []; |
| for (const [iso, rid] of Object.entries(ISO2_TO_REGION)) { |
| if (rid === regionId) out.push(iso); |
| } |
| return out; |
| } |
|
|
| |
| export function regionForCountry(iso2) { |
| return ISO2_TO_REGION[iso2] ?? null; |
| } |
|
|
| |
| export function getRegionTheaters(regionId) { |
| return THEATERS.filter((t) => t.regionId === regionId); |
| } |
|
|
| |
| export function getTheaterCorridors(theaterId) { |
| return CORRIDORS.filter((c) => c.theaterId === theaterId); |
| } |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| export function getRegionCorridors(regionId) { |
| const theaters = getRegionTheaters(regionId); |
| const theaterIds = new Set(theaters.map((t) => t.id)); |
| const indirectIds = new Set(theaters.flatMap((t) => t.corridorIds ?? [])); |
| const seen = new Map(); |
| for (const c of CORRIDORS) { |
| if (theaterIds.has(c.theaterId) || indirectIds.has(c.id)) { |
| seen.set(c.id, c); |
| } |
| } |
| return [...seen.values()]; |
| } |
|
|
| |
| export function countryCriticality(iso2) { |
| return COUNTRY_CRITICALITY[iso2] ?? DEFAULT_COUNTRY_CRITICALITY; |
| } |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| export function isSignalInRegion(theater, regionOrId) { |
| const region = typeof regionOrId === 'string' ? getRegion(regionOrId) : regionOrId; |
| if (!region) return false; |
| |
| |
| const t = String(theater ?? '').toLowerCase().trim().replace(/-/g, ' '); |
| if (!t) return false; |
| const theaters = Array.isArray(region.theaters) ? region.theaters : []; |
| for (const label of theaters) { |
| if (t.includes(String(label).toLowerCase().replace(/-/g, ' '))) return true; |
| } |
| const aliases = Array.isArray(region.signalAliases) ? region.signalAliases : []; |
| for (const alias of aliases) { |
| if (t.includes(String(alias).toLowerCase().replace(/-/g, ' '))) return true; |
| } |
| return false; |
| } |
|
|