@zaes/sidc 0.0.0-stage → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/CHANGELOG.md +58 -0
  2. package/LICENSE +21 -0
  3. package/README.md +24 -3
  4. package/THIRD-PARTY-NOTICES +217 -0
  5. package/dist/cjs/2525c/data2525c.js +1965 -0
  6. package/dist/cjs/2525c/index.js +178 -0
  7. package/dist/cjs/catalog/data2525e.js +2704 -0
  8. package/dist/cjs/catalog/dataApp6e.js +85 -0
  9. package/dist/cjs/catalog/index.js +137 -0
  10. package/dist/cjs/catalog/types.js +2 -0
  11. package/dist/cjs/genc.js +298 -0
  12. package/dist/cjs/index.js +49 -0
  13. package/dist/cjs/letter.js +116 -0
  14. package/dist/cjs/numeric.js +127 -0
  15. package/dist/cjs/tables.js +151 -0
  16. package/dist/esm/2525c/data2525c.js +1962 -0
  17. package/dist/esm/2525c/index.js +174 -0
  18. package/dist/esm/catalog/data2525e.js +2701 -0
  19. package/dist/esm/catalog/dataApp6e.js +82 -0
  20. package/dist/esm/catalog/index.js +130 -0
  21. package/dist/esm/catalog/types.js +1 -0
  22. package/dist/esm/genc.js +294 -0
  23. package/dist/esm/index.js +20 -0
  24. package/dist/esm/letter.js +112 -0
  25. package/dist/esm/numeric.js +123 -0
  26. package/dist/esm/package.json +3 -0
  27. package/dist/esm/tables.js +147 -0
  28. package/dist/types/2525c/data2525c.d.ts +10 -0
  29. package/dist/types/2525c/index.d.ts +22 -0
  30. package/dist/types/catalog/data2525e.d.ts +12 -0
  31. package/dist/types/catalog/dataApp6e.d.ts +15 -0
  32. package/dist/types/catalog/index.d.ts +31 -0
  33. package/dist/types/catalog/types.d.ts +46 -0
  34. package/dist/types/genc.d.ts +12 -0
  35. package/dist/types/index.d.ts +15 -0
  36. package/dist/types/letter.d.ts +51 -0
  37. package/dist/types/numeric.d.ts +66 -0
  38. package/dist/types/tables.d.ts +56 -0
  39. package/package.json +66 -6
@@ -0,0 +1,85 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.APP6E_IN_2525D = exports.ENTITIES_APP6E = void 0;
4
+ /** 59 entities: 4 hierarchy, 53 icon, 2 multipoint. */
5
+ exports.ENTITIES_APP6E = [
6
+ ["01", "120700", "Medical Evacuation (MEDEVAC)", "icon", "", "", "Main"],
7
+ ["05", "110600", "Satellite, General", "icon", "", "", "Main"],
8
+ ["10", "110501", "Reconnaissance and Liaison Element", "icon", "", "", "Full Frame"],
9
+ ["10", "130301", "Self-Propelled Artillery", "icon", "", "", "Main"],
10
+ ["10", "140104", "Reconnaissance Armoured", "icon", "", "", "Full Frame"],
11
+ ["10", "161900", "NATO Supply Class II", "icon", "", "", "Full Frame"],
12
+ ["10", "162200", "NATO Supply Class V", "icon", "", "", "Full Frame"],
13
+ ["10", "165800", "National Support Element (NSE)", "icon", "", "", "Main"],
14
+ ["15", "112100", "Non-Lethal Grenade Launcher", "icon", "", "", "Main"],
15
+ ["20", "111901", "Displaced Persons/Refugee/Evacuees Camp", "icon", "", "", "Full Octagon"],
16
+ ["20", "111902", "Training Camp", "icon", "", "", "Full Octagon"],
17
+ ["20", "120801", "Military Armoury", "icon", "", "", "Full Octagon"],
18
+ ["20", "120802", "Military Base", "icon", "", "", "Full Octagon"],
19
+ ["25", "380000", "Paths", "hierarchy", "", "", ""],
20
+ ["25", "380100", "Data Path Segment", "multipoint", "", "", ""],
21
+ ["25", "380200", "Data Tunnel", "multipoint", "", "", ""],
22
+ ["27", "120000", "Civilian", "hierarchy", "", "", ""],
23
+ ["27", "120100", "Activity/Task", "hierarchy", "", "", ""],
24
+ ["27", "120101", "Police", "icon", "", "", "Main"],
25
+ ["27", "120102", "Non-Governmental Organization Member or Non-Governmental Organization (NGO)", "icon", "", "", "Main"],
26
+ ["27", "120103", "Government Organization (GO)", "icon", "", "", "Main"],
27
+ ["40", "110103", "Attempted Criminal Activity", "icon", "", "", "Main"],
28
+ ["40", "110105", "Drug Related", "icon", "", "", "Main"],
29
+ ["40", "131100", "Raid on House", "icon", "", "", "Full Octagon"],
30
+ ["40", "180300", "Isolated Personnel", "icon", "", "", "Full Octagon"],
31
+ ["60", "111100", "Security Operations Centre", "icon", "", "", "Main"],
32
+ ["60", "120100", "Criminal", "icon", "", "", "Main"],
33
+ ["64", "130000", "Agent", "hierarchy", "", "", ""],
34
+ ["64", "130100", "Firewall", "icon", "", "", "Main"],
35
+ ["64", "130200", "Firmware", "icon", "", "", "Main"],
36
+ ["64", "140000", "Application", "icon", "", "", "Main"],
37
+ ["64", "140100", "Banking", "icon", "", "", "Main"],
38
+ ["64", "140300", "Search Engine", "icon", "", "", "Main"],
39
+ ["64", "140400", "Social Media", "icon", "", "", "Main"],
40
+ ["64", "140500", "Database", "icon", "", "", "Main"],
41
+ ["64", "140600", "Service", "icon", "", "", "Main"],
42
+ ["64", "150000", "Threat", "icon", "", "", "Main"],
43
+ ["64", "150100", "Malware", "icon", "", "", "Main"],
44
+ ["64", "150200", "Phishing", "icon", "", "", "Main"],
45
+ ["64", "160000", "Data", "icon", "", "", "Main"],
46
+ ["64", "160100", "Digital Currency", "icon", "", "", "Main"],
47
+ ["64", "160200", "Persona", "icon", "", "", "Main"],
48
+ ["64", "170000", "End Point", "icon", "", "", "Main"],
49
+ ["64", "170100", "Server", "icon", "", "", "Main"],
50
+ ["64", "170200", "Workstation", "icon", "", "", "Main"],
51
+ ["64", "170300", "Portable Electronic Device (PED)", "icon", "", "", "Main"],
52
+ ["64", "170301", "Mobile/Smartphone", "icon", "", "", "Main"],
53
+ ["64", "170302", "Tablet", "icon", "", "", "Main"],
54
+ ["64", "170303", "Laptop", "icon", "", "", "Main"],
55
+ ["64", "170304", "Health Monitor", "icon", "", "", "Main"],
56
+ ["64", "170305", "Smartvest", "icon", "", "", "Main"],
57
+ ["64", "170306", "Smartwatch", "icon", "", "", "Main"],
58
+ ["64", "170307", "Wearable", "icon", "", "", "Main"],
59
+ ["64", "170400", "Internet of Things Device", "icon", "", "", "Main"],
60
+ ["64", "170500", "Printer", "icon", "", "", "Main"],
61
+ ["64", "170600", "Router", "icon", "", "", "Main"],
62
+ ["64", "170700", "Switch", "icon", "", "", "Main"],
63
+ ["64", "170800", "Remote Operated Relay (ROR)", "icon", "", "", "Main"],
64
+ ["64", "180000", "Network", "icon", "", "", "Main"],
65
+ ];
66
+ /**
67
+ * Those of them MIL-STD-2525D (2014) also defines (its appendices give each an entry), by set and code, with
68
+ * 2525D's own path (its entry's Entity line, then its name, last): a 2525D or APP-6(D) code names them so. Read
69
+ * from the 2525D PDF the same way.
70
+ */
71
+ exports.APP6E_IN_2525D = {
72
+ "05110600": ["Military", "Satellite, General"],
73
+ "10130301": ["Fires", "Field Artillery", "Self-Propelled"],
74
+ "10140104": ["Protection", "Chemical Biological Radiological Nuclear Defense", "Reconnaissance Armored"],
75
+ "10161900": ["Sustainment", "NATO Supply Class II"],
76
+ "10162200": ["Sustainment", "NATO Supply Class V"],
77
+ "20111901": ["Installation", "Tented Camp", "Displaced Persons/Refugee/Evacuees Camp"],
78
+ "20111902": ["Installation", "Tented Camp", "Training Camp"],
79
+ "20120801": ["Infrastructure", "Military Infrastructure", "Military Armory"],
80
+ "20120802": ["Infrastructure", "Military Infrastructure", "Military Base"],
81
+ "40110103": ["Incident", "Criminal Activity Incident", "Attempted Criminal Activity"],
82
+ "40110105": ["Incident", "Criminal Activity Incident", "Drug Related"],
83
+ "40131100": ["Operation", "Raid on House"],
84
+ "60120100": ["Infection", "Advanced Persistent Threat (APT)"],
85
+ };
@@ -0,0 +1,137 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getEntity = getEntity;
4
+ exports.listEntities = listEntities;
5
+ exports.getSectorModifier = getSectorModifier;
6
+ exports.listSectorModifiers = listSectorModifiers;
7
+ exports.describeSidc = describeSidc;
8
+ /**
9
+ * @zaes/sidc/catalog — what every 2525E Change 1 code means: entity names and hierarchy, what kind of
10
+ * drawing each is, its draw rule or icon type, and every sector modifier; and the entities APP-6(E) adds.
11
+ *
12
+ * A separate entry so that reading a code does not cost the ~175 KB of tables.
13
+ *
14
+ * @module @zaes/sidc/catalog
15
+ */
16
+ const index_js_1 = require("../index.js");
17
+ const data2525e_js_1 = require("./data2525e.js");
18
+ const dataApp6e_js_1 = require("./dataApp6e.js");
19
+ let entities;
20
+ let app6eEntities;
21
+ let modifiers;
22
+ const entityKey = (symbolSet, code) => `${symbolSet}:${code}`;
23
+ const modifierKey = (symbolSet, sector, code) => `${symbolSet}:${sector}:${code}`;
24
+ function entityIndex() {
25
+ return (entities !== null && entities !== void 0 ? entities : (entities = indexRows(data2525e_js_1.ENTITIES_2525E, new Map(data2525e_js_1.ENTITIES_2525E.map((r) => [entityKey(r[0], r[1]), r])))));
26
+ }
27
+ /** APP-6(E)'s own entities, named under their headings in either table. */
28
+ function app6eIndex() {
29
+ const all = new Map([...data2525e_js_1.ENTITIES_2525E, ...dataApp6e_js_1.ENTITIES_APP6E].map((r) => [entityKey(r[0], r[1]), r]));
30
+ return (app6eEntities !== null && app6eEntities !== void 0 ? app6eEntities : (app6eEntities = new Map([...indexRows(dataApp6e_js_1.ENTITIES_APP6E, all)].map(([k, e]) => [k, { ...e, standard: 'APP-6E' }]))));
31
+ }
32
+ function indexRows(own, rows) {
33
+ const index = new Map();
34
+ for (const [symbolSet, code, name, kind, geometry, drawRule, iconType] of own) {
35
+ const key = entityKey(symbolSet, code);
36
+ const path = [];
37
+ const entity = rows.get(entityKey(symbolSet, code.slice(0, 2) + '0000'));
38
+ const type = rows.get(entityKey(symbolSet, code.slice(0, 4) + '00'));
39
+ if (code !== '000000') {
40
+ if (entity && entity[1] !== code)
41
+ path.push(entity[2]);
42
+ if (type && type[1] !== code && type[1] !== (entity === null || entity === void 0 ? void 0 : entity[1]))
43
+ path.push(type[2]);
44
+ }
45
+ path.push(name);
46
+ index.set(key, {
47
+ symbolSet,
48
+ code,
49
+ name,
50
+ path,
51
+ kind,
52
+ ...(geometry ? { tableGeometry: geometry } : {}),
53
+ ...(drawRule ? { drawRule, drawRuleAppendix: symbolSet === '45' || symbolSet === '46' ? 'M' : 'L' } : {}),
54
+ ...(iconType ? { iconType } : {}),
55
+ });
56
+ }
57
+ return index;
58
+ }
59
+ function modifierIndex() {
60
+ if (modifiers)
61
+ return modifiers;
62
+ modifiers = new Map(data2525e_js_1.MODIFIERS_2525E.map(([symbolSet, sector, code, name, category]) => [
63
+ modifierKey(symbolSet, sector, code),
64
+ { symbolSet, sector: sector, code, name, category },
65
+ ]));
66
+ return modifiers;
67
+ }
68
+ /**
69
+ * The entity a symbol set and positions 11–16 name, or undefined if 2525E Change 1 has none. For an APP-6(E)
70
+ * code (`standard` 'APP-6E', as `parseSidc` reads versions 14 and 16), also the entities APP-6(E) adds; for a
71
+ * 2525D or APP-6(D) code ('2525D', 'APP-6D'), those of them 2525D defines as well, with 2525D's own name and path.
72
+ */
73
+ function getEntity(symbolSet, code, standard) {
74
+ const key = entityKey(symbolSet, code);
75
+ const own = entityIndex().get(key);
76
+ if (own || !standard)
77
+ return own;
78
+ if (standard === 'APP-6E')
79
+ return app6eIndex().get(key);
80
+ if (standard === '2525D' || standard === 'APP-6D')
81
+ return in2525DIndex().get(key);
82
+ return undefined;
83
+ }
84
+ let shared2525D;
85
+ /** The APP-6(E) additions 2525D defines too, with 2525D's own names and paths. */
86
+ function in2525DIndex() {
87
+ if (shared2525D)
88
+ return shared2525D;
89
+ shared2525D = new Map();
90
+ for (const [setCode, path] of Object.entries(dataApp6e_js_1.APP6E_IN_2525D)) {
91
+ const key = entityKey(setCode.slice(0, 2), setCode.slice(2));
92
+ const e = app6eIndex().get(key);
93
+ if (e)
94
+ shared2525D.set(key, { ...e, name: path[path.length - 1], path: [...path] });
95
+ }
96
+ return shared2525D;
97
+ }
98
+ /** Every entity, in the standard's order, optionally of one symbol set or kind. */
99
+ function listEntities(filter = {}) {
100
+ return [...entityIndex().values()].filter((e) => (!filter.symbolSet || e.symbolSet === filter.symbolSet) && (!filter.kind || e.kind === filter.kind));
101
+ }
102
+ /**
103
+ * The sector modifier a code names. `identifier` is SIDC position 21 (sector 1) or 22 (sector 2):
104
+ * '0' looks in the symbol set's own table, anything else in the common table (A-IX, A-X), whose
105
+ * codes are the identifier followed by the two modifier positions.
106
+ */
107
+ function getSectorModifier(symbolSet, sector, code, identifier = '0') {
108
+ return identifier === '0' ? modifierIndex().get(modifierKey(symbolSet, sector, code)) : modifierIndex().get(modifierKey('common', sector, identifier + code));
109
+ }
110
+ /** The sector modifiers of one symbol set (or `common`), in the standard's order. */
111
+ function listSectorModifiers(symbolSet, sector) {
112
+ return [...modifierIndex().values()].filter((m) => m.symbolSet === symbolSet && m.sector === sector);
113
+ }
114
+ /** What positions 11–20 of a 2525D/E code mean, by the 2525E Change 1 tables. */
115
+ function describeSidc(sidc) {
116
+ const parsed = typeof sidc === 'string' ? (0, index_js_1.parseSidc)(sidc) : { ok: true, sidc, problems: [] };
117
+ if (!parsed.ok)
118
+ return { problems: parsed.problems.map((p) => p.message) };
119
+ if (parsed.sidc.kind !== 'numeric')
120
+ return { problems: ['a 2525C letter code; convert it before describing it'] };
121
+ const s = parsed.sidc;
122
+ const problems = [];
123
+ const entity = getEntity(s.symbolSet, s.entityCode, s.standard);
124
+ if (!entity)
125
+ problems.push(`entity ${s.entityCode} is not in symbol set ${s.symbolSet}`);
126
+ const modifier = (sector, code, identifier) => {
127
+ if (code === '00')
128
+ return undefined;
129
+ const m = getSectorModifier(s.symbolSet, sector, code, identifier);
130
+ if (!m)
131
+ problems.push(`sector ${sector} modifier ${identifier === '0' ? '' : identifier}${code} is not defined for symbol set ${s.symbolSet}`);
132
+ return m;
133
+ };
134
+ const sector1 = modifier(1, s.sector1, s.sector1Identifier);
135
+ const sector2 = modifier(2, s.sector2, s.sector2Identifier);
136
+ return { ...(entity ? { entity } : {}), ...(sector1 ? { sector1 } : {}), ...(sector2 ? { sector2 } : {}), problems };
137
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,298 @@
1
+ "use strict";
2
+ /**
3
+ * GENC (Geopolitical Entities, Names, and Codes) countries and entities by numeric code: SIDC
4
+ * positions 28–30 (MIL-STD-2525E A.5.5.4). Generated; do not edit.
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.GENC_COUNTRIES = void 0;
8
+ exports.gencCountry = gencCountry;
9
+ /** [numeric, trigraph, digraph ('' where none is assigned), name]. 280 entries. */
10
+ exports.GENC_COUNTRIES = [
11
+ ["004", "AFG", "AF", "AFGHANISTAN"],
12
+ ["008", "ALB", "AL", "ALBANIA"],
13
+ ["010", "ATA", "AQ", "ANTARCTICA"],
14
+ ["012", "DZA", "DZ", "ALGERIA"],
15
+ ["016", "ASM", "AS", "AMERICAN SAMOA"],
16
+ ["020", "AND", "AD", "ANDORRA"],
17
+ ["024", "AGO", "AO", "ANGOLA"],
18
+ ["028", "ATG", "AG", "ANTIGUA AND BARBUDA"],
19
+ ["031", "AZE", "AZ", "AZERBAIJAN"],
20
+ ["032", "ARG", "AR", "ARGENTINA"],
21
+ ["036", "AUS", "AU", "AUSTRALIA"],
22
+ ["040", "AUT", "AT", "AUSTRIA"],
23
+ ["044", "BHS", "BS", "BAHAMAS, THE"],
24
+ ["048", "BHR", "BH", "BAHRAIN"],
25
+ ["050", "BGD", "BD", "BANGLADESH"],
26
+ ["051", "ARM", "AM", "ARMENIA"],
27
+ ["052", "BRB", "BB", "BARBADOS"],
28
+ ["056", "BEL", "BE", "BELGIUM"],
29
+ ["060", "BMU", "BM", "BERMUDA"],
30
+ ["064", "BTN", "BT", "BHUTAN"],
31
+ ["068", "BOL", "BO", "BOLIVIA"],
32
+ ["070", "BIH", "BA", "BOSNIA AND HERZEGOVINA"],
33
+ ["072", "BWA", "BW", "BOTSWANA"],
34
+ ["074", "BVT", "BV", "BOUVET ISLAND"],
35
+ ["076", "BRA", "BR", "BRAZIL"],
36
+ ["084", "BLZ", "BZ", "BELIZE"],
37
+ ["086", "IOT", "IO", "BRITISH INDIAN OCEAN TERRITORY"],
38
+ ["090", "SLB", "SB", "SOLOMON ISLANDS"],
39
+ ["092", "VGB", "VG", "VIRGIN ISLANDS, BRITISH"],
40
+ ["096", "BRN", "BN", "BRUNEI"],
41
+ ["100", "BGR", "BG", "BULGARIA"],
42
+ ["104", "MMR", "MM", "BURMA"],
43
+ ["108", "BDI", "BI", "BURUNDI"],
44
+ ["112", "BLR", "BY", "BELARUS"],
45
+ ["116", "KHM", "KH", "CAMBODIA"],
46
+ ["120", "CMR", "CM", "CAMEROON"],
47
+ ["124", "CAN", "CA", "CANADA"],
48
+ ["132", "CPV", "CV", "CABO VERDE"],
49
+ ["136", "CYM", "KY", "CAYMAN ISLANDS"],
50
+ ["140", "CAF", "CF", "CENTRAL AFRICAN REPUBLIC"],
51
+ ["144", "LKA", "LK", "SRI LANKA"],
52
+ ["148", "TCD", "TD", "CHAD"],
53
+ ["152", "CHL", "CL", "CHILE"],
54
+ ["156", "CHN", "CN", "CHINA"],
55
+ ["158", "TWN", "TW", "TAIWAN"],
56
+ ["162", "CXR", "CX", "CHRISTMAS ISLAND"],
57
+ ["166", "CCK", "CC", "COCOS (KEELING) ISLANDS"],
58
+ ["170", "COL", "CO", "COLOMBIA"],
59
+ ["174", "COM", "KM", "COMOROS"],
60
+ ["175", "MYT", "YT", "MAYOTTE"],
61
+ ["178", "COG", "CG", "CONGO (BRAZZAVILLE)"],
62
+ ["180", "COD", "CD", "CONGO (KINSHASA)"],
63
+ ["184", "COK", "CK", "COOK ISLANDS"],
64
+ ["188", "CRI", "CR", "COSTA RICA"],
65
+ ["191", "HRV", "HR", "CROATIA"],
66
+ ["192", "CUB", "CU", "CUBA"],
67
+ ["196", "CYP", "CY", "CYPRUS"],
68
+ ["203", "CZE", "CZ", "CZECHIA"],
69
+ ["204", "BEN", "BJ", "BENIN"],
70
+ ["208", "DNK", "DK", "DENMARK"],
71
+ ["212", "DMA", "DM", "DOMINICA"],
72
+ ["214", "DOM", "DO", "DOMINICAN REPUBLIC"],
73
+ ["218", "ECU", "EC", "ECUADOR"],
74
+ ["222", "SLV", "SV", "EL SALVADOR"],
75
+ ["226", "GNQ", "GQ", "EQUATORIAL GUINEA"],
76
+ ["231", "ETH", "ET", "ETHIOPIA"],
77
+ ["232", "ERI", "ER", "ERITREA"],
78
+ ["233", "EST", "EE", "ESTONIA"],
79
+ ["234", "FRO", "FO", "FAROE ISLANDS"],
80
+ ["238", "FLK", "FK", "FALKLAND ISLANDS (ISLAS MALVINAS)"],
81
+ ["239", "SGS", "GS", "SOUTH GEORGIA AND SOUTH SANDWICH ISLANDS"],
82
+ ["242", "FJI", "FJ", "FIJI"],
83
+ ["246", "FIN", "FI", "FINLAND"],
84
+ ["250", "FRA", "FR", "FRANCE"],
85
+ ["254", "GUF", "GF", "FRENCH GUIANA"],
86
+ ["258", "PYF", "PF", "FRENCH POLYNESIA"],
87
+ ["260", "ATF", "TF", "FRENCH SOUTHERN AND ANTARCTIC LANDS"],
88
+ ["262", "DJI", "DJ", "DJIBOUTI"],
89
+ ["266", "GAB", "GA", "GABON"],
90
+ ["268", "GEO", "GE", "GEORGIA"],
91
+ ["270", "GMB", "GM", "GAMBIA, THE"],
92
+ ["276", "DEU", "DE", "GERMANY"],
93
+ ["288", "GHA", "GH", "GHANA"],
94
+ ["292", "GIB", "GI", "GIBRALTAR"],
95
+ ["296", "KIR", "KI", "KIRIBATI"],
96
+ ["300", "GRC", "GR", "GREECE"],
97
+ ["304", "GRL", "GL", "GREENLAND"],
98
+ ["308", "GRD", "GD", "GRENADA"],
99
+ ["312", "GLP", "GP", "GUADELOUPE"],
100
+ ["316", "GUM", "GU", "GUAM"],
101
+ ["320", "GTM", "GT", "GUATEMALA"],
102
+ ["324", "GIN", "GN", "GUINEA"],
103
+ ["328", "GUY", "GY", "GUYANA"],
104
+ ["332", "HTI", "HT", "HAITI"],
105
+ ["334", "HMD", "HM", "HEARD ISLAND AND MCDONALD ISLANDS"],
106
+ ["336", "VAT", "VA", "VATICAN CITY"],
107
+ ["340", "HND", "HN", "HONDURAS"],
108
+ ["344", "HKG", "HK", "HONG KONG"],
109
+ ["348", "HUN", "HU", "HUNGARY"],
110
+ ["352", "ISL", "IS", "ICELAND"],
111
+ ["356", "IND", "IN", "INDIA"],
112
+ ["360", "IDN", "ID", "INDONESIA"],
113
+ ["364", "IRN", "IR", "IRAN"],
114
+ ["368", "IRQ", "IQ", "IRAQ"],
115
+ ["372", "IRL", "IE", "IRELAND"],
116
+ ["376", "ISR", "IL", "ISRAEL"],
117
+ ["380", "ITA", "IT", "ITALY"],
118
+ ["384", "CIV", "CI", "CÔTE D’IVOIRE"],
119
+ ["388", "JAM", "JM", "JAMAICA"],
120
+ ["392", "JPN", "JP", "JAPAN"],
121
+ ["398", "KAZ", "KZ", "KAZAKHSTAN"],
122
+ ["400", "JOR", "JO", "JORDAN"],
123
+ ["404", "KEN", "KE", "KENYA"],
124
+ ["408", "PRK", "KP", "KOREA, NORTH"],
125
+ ["410", "KOR", "KR", "KOREA, SOUTH"],
126
+ ["414", "KWT", "KW", "KUWAIT"],
127
+ ["417", "KGZ", "KG", "KYRGYZSTAN"],
128
+ ["418", "LAO", "LA", "LAOS"],
129
+ ["422", "LBN", "LB", "LEBANON"],
130
+ ["426", "LSO", "LS", "LESOTHO"],
131
+ ["428", "LVA", "LV", "LATVIA"],
132
+ ["430", "LBR", "LR", "LIBERIA"],
133
+ ["434", "LBY", "LY", "LIBYA"],
134
+ ["438", "LIE", "LI", "LIECHTENSTEIN"],
135
+ ["440", "LTU", "LT", "LITHUANIA"],
136
+ ["442", "LUX", "LU", "LUXEMBOURG"],
137
+ ["446", "MAC", "MO", "MACAU"],
138
+ ["450", "MDG", "MG", "MADAGASCAR"],
139
+ ["454", "MWI", "MW", "MALAWI"],
140
+ ["458", "MYS", "MY", "MALAYSIA"],
141
+ ["462", "MDV", "MV", "MALDIVES"],
142
+ ["466", "MLI", "ML", "MALI"],
143
+ ["470", "MLT", "MT", "MALTA"],
144
+ ["474", "MTQ", "MQ", "MARTINIQUE"],
145
+ ["478", "MRT", "MR", "MAURITANIA"],
146
+ ["480", "MUS", "MU", "MAURITIUS"],
147
+ ["484", "MEX", "MX", "MEXICO"],
148
+ ["492", "MCO", "MC", "MONACO"],
149
+ ["496", "MNG", "MN", "MONGOLIA"],
150
+ ["498", "MDA", "MD", "MOLDOVA"],
151
+ ["499", "MNE", "ME", "MONTENEGRO"],
152
+ ["500", "MSR", "MS", "MONTSERRAT"],
153
+ ["504", "MAR", "MA", "MOROCCO"],
154
+ ["508", "MOZ", "MZ", "MOZAMBIQUE"],
155
+ ["512", "OMN", "OM", "OMAN"],
156
+ ["516", "NAM", "NA", "NAMIBIA"],
157
+ ["520", "NRU", "NR", "NAURU"],
158
+ ["524", "NPL", "NP", "NEPAL"],
159
+ ["528", "NLD", "NL", "NETHERLANDS"],
160
+ ["531", "CUW", "CW", "CURAÇAO"],
161
+ ["533", "ABW", "AW", "ARUBA"],
162
+ ["534", "SXM", "SX", "SINT MAARTEN"],
163
+ ["535", "BES", "BQ", "BONAIRE, SINT EUSTATIUS, AND SABA"],
164
+ ["540", "NCL", "NC", "NEW CALEDONIA"],
165
+ ["548", "VUT", "VU", "VANUATU"],
166
+ ["554", "NZL", "NZ", "NEW ZEALAND"],
167
+ ["558", "NIC", "NI", "NICARAGUA"],
168
+ ["562", "NER", "NE", "NIGER"],
169
+ ["566", "NGA", "NG", "NIGERIA"],
170
+ ["570", "NIU", "NU", "NIUE"],
171
+ ["574", "NFK", "NF", "NORFOLK ISLAND"],
172
+ ["578", "NOR", "NO", "NORWAY"],
173
+ ["580", "MNP", "MP", "NORTHERN MARIANA ISLANDS"],
174
+ ["583", "FSM", "FM", "MICRONESIA, FEDERATED STATES OF"],
175
+ ["584", "MHL", "MH", "MARSHALL ISLANDS"],
176
+ ["585", "PLW", "PW", "PALAU"],
177
+ ["586", "PAK", "PK", "PAKISTAN"],
178
+ ["591", "PAN", "PA", "PANAMA"],
179
+ ["598", "PNG", "PG", "PAPUA NEW GUINEA"],
180
+ ["600", "PRY", "PY", "PARAGUAY"],
181
+ ["604", "PER", "PE", "PERU"],
182
+ ["608", "PHL", "PH", "PHILIPPINES"],
183
+ ["612", "PCN", "PN", "PITCAIRN ISLANDS"],
184
+ ["616", "POL", "PL", "POLAND"],
185
+ ["620", "PRT", "PT", "PORTUGAL"],
186
+ ["624", "GNB", "GW", "GUINEA-BISSAU"],
187
+ ["626", "TLS", "TL", "TIMOR-LESTE"],
188
+ ["630", "PRI", "PR", "PUERTO RICO"],
189
+ ["634", "QAT", "QA", "QATAR"],
190
+ ["638", "REU", "RE", "REUNION"],
191
+ ["642", "ROU", "RO", "ROMANIA"],
192
+ ["643", "RUS", "RU", "RUSSIA"],
193
+ ["646", "RWA", "RW", "RWANDA"],
194
+ ["652", "BLM", "BL", "SAINT BARTHELEMY"],
195
+ ["654", "SHN", "SH", "SAINT HELENA, ASCENSION, AND TRISTAN DA CUNHA"],
196
+ ["659", "KNA", "KN", "SAINT KITTS AND NEVIS"],
197
+ ["660", "AIA", "AI", "ANGUILLA"],
198
+ ["662", "LCA", "LC", "SAINT LUCIA"],
199
+ ["663", "MAF", "MF", "SAINT MARTIN"],
200
+ ["666", "SPM", "PM", "SAINT PIERRE AND MIQUELON"],
201
+ ["670", "VCT", "VC", "SAINT VINCENT AND THE GRENADINES"],
202
+ ["674", "SMR", "SM", "SAN MARINO"],
203
+ ["678", "STP", "ST", "SAO TOME AND PRINCIPE"],
204
+ ["682", "SAU", "SA", "SAUDI ARABIA"],
205
+ ["686", "SEN", "SN", "SENEGAL"],
206
+ ["688", "SRB", "RS", "SERBIA"],
207
+ ["690", "SYC", "SC", "SEYCHELLES"],
208
+ ["694", "SLE", "SL", "SIERRA LEONE"],
209
+ ["702", "SGP", "SG", "SINGAPORE"],
210
+ ["703", "SVK", "SK", "SLOVAKIA"],
211
+ ["704", "VNM", "VN", "VIETNAM"],
212
+ ["705", "SVN", "SI", "SLOVENIA"],
213
+ ["706", "SOM", "SO", "SOMALIA"],
214
+ ["710", "ZAF", "ZA", "SOUTH AFRICA"],
215
+ ["716", "ZWE", "ZW", "ZIMBABWE"],
216
+ ["724", "ESP", "ES", "SPAIN"],
217
+ ["728", "SSD", "SS", "SOUTH SUDAN"],
218
+ ["729", "SDN", "SD", "SUDAN"],
219
+ ["732", "ESH", "EH", "WESTERN SAHARA"],
220
+ ["740", "SUR", "SR", "SURINAME"],
221
+ ["748", "SWZ", "SZ", "ESWATINI"],
222
+ ["752", "SWE", "SE", "SWEDEN"],
223
+ ["756", "CHE", "CH", "SWITZERLAND"],
224
+ ["760", "SYR", "SY", "SYRIA"],
225
+ ["762", "TJK", "TJ", "TAJIKISTAN"],
226
+ ["764", "THA", "TH", "THAILAND"],
227
+ ["768", "TGO", "TG", "TOGO"],
228
+ ["772", "TKL", "TK", "TOKELAU"],
229
+ ["776", "TON", "TO", "TONGA"],
230
+ ["780", "TTO", "TT", "TRINIDAD AND TOBAGO"],
231
+ ["784", "ARE", "AE", "UNITED ARAB EMIRATES"],
232
+ ["788", "TUN", "TN", "TUNISIA"],
233
+ ["792", "TUR", "TR", "TURKEY"],
234
+ ["795", "TKM", "TM", "TURKMENISTAN"],
235
+ ["796", "TCA", "TC", "TURKS AND CAICOS ISLANDS"],
236
+ ["798", "TUV", "TV", "TUVALU"],
237
+ ["800", "UGA", "UG", "UGANDA"],
238
+ ["804", "UKR", "UA", "UKRAINE"],
239
+ ["807", "MKD", "MK", "NORTH MACEDONIA"],
240
+ ["818", "EGY", "EG", "EGYPT"],
241
+ ["826", "GBR", "GB", "UNITED KINGDOM"],
242
+ ["831", "GGY", "GG", "GUERNSEY"],
243
+ ["832", "JEY", "JE", "JERSEY"],
244
+ ["833", "IMN", "IM", "ISLE OF MAN"],
245
+ ["834", "TZA", "TZ", "TANZANIA"],
246
+ ["840", "USA", "US", "UNITED STATES"],
247
+ ["850", "VIR", "VI", "VIRGIN ISLANDS, U.S."],
248
+ ["854", "BFA", "BF", "BURKINA FASO"],
249
+ ["858", "URY", "UY", "URUGUAY"],
250
+ ["860", "UZB", "UZ", "UZBEKISTAN"],
251
+ ["862", "VEN", "VE", "VENEZUELA"],
252
+ ["876", "WLF", "WF", "WALLIS AND FUTUNA"],
253
+ ["882", "WSM", "WS", "SAMOA"],
254
+ ["887", "YEM", "YE", "YEMEN"],
255
+ ["894", "ZMB", "ZM", "ZAMBIA"],
256
+ ["900", "XQZ", "QZ", "AKROTIRI"],
257
+ ["901", "XKS", "XK", "KOSOVO"],
258
+ ["902", "XAC", "XA", "ASHMORE AND CARTIER ISLANDS"],
259
+ ["903", "XBK", "XB", "BAKER ISLAND"],
260
+ ["904", "XBI", "QS", "BASSAS DA INDIA"],
261
+ ["905", "CPT", "CP", "CLIPPERTON ISLAND"],
262
+ ["906", "XCS", "XC", "CORAL SEA ISLANDS"],
263
+ ["907", "XXD", "XD", "DHEKELIA"],
264
+ ["908", "DGA", "DG", "DIEGO GARCIA"],
265
+ ["909", "XAZ", "", "ENTITY 1"],
266
+ ["910", "XCR", "", "ENTITY 2"],
267
+ ["911", "XCY", "", "ENTITY 3"],
268
+ ["912", "XKM", "", "ENTITY 4"],
269
+ ["913", "XKN", "", "ENTITY 5"],
270
+ ["914", "AX3", "A3", "ENTITY 6"],
271
+ ["915", "XEU", "XE", "EUROPA ISLAND"],
272
+ ["916", "XGZ", "XG", "GAZA STRIP"],
273
+ ["917", "XGL", "QX", "GLORIOSO ISLANDS"],
274
+ ["918", "AX2", "A2", "GUANTANAMO BAY NAVAL BASE"],
275
+ ["919", "XHO", "XH", "HOWLAND ISLAND"],
276
+ ["920", "XJM", "XJ", "JAN MAYEN"],
277
+ ["921", "XJV", "XQ", "JARVIS ISLAND"],
278
+ ["922", "XJA", "XU", "JOHNSTON ATOLL"],
279
+ ["923", "XJN", "QU", "JUAN DE NOVA ISLAND"],
280
+ ["924", "XKR", "XM", "KINGMAN REEF"],
281
+ ["925", "XMW", "QM", "MIDWAY ISLANDS"],
282
+ ["926", "XNV", "XV", "NAVASSA ISLAND"],
283
+ ["927", "XPL", "XL", "PALMYRA ATOLL"],
284
+ ["928", "XPR", "XP", "PARACEL ISLANDS"],
285
+ ["929", "XSP", "XS", "SPRATLY ISLANDS"],
286
+ ["930", "XSV", "XR", "SVALBARD"],
287
+ ["931", "XTR", "XT", "TROMELIN ISLAND"],
288
+ ["932", "AX1", "A1", "UNKNOWN"],
289
+ ["933", "XWK", "QW", "WAKE ISLAND"],
290
+ ["934", "XWB", "XW", "WEST BANK"],
291
+ ];
292
+ let byNumeric;
293
+ /** The country a three-digit GENC numeric code names, or undefined for '000' and unknown codes. */
294
+ function gencCountry(numeric) {
295
+ byNumeric !== null && byNumeric !== void 0 ? byNumeric : (byNumeric = new Map(exports.GENC_COUNTRIES.map((r) => [r[0], r])));
296
+ const r = byNumeric.get(numeric.padStart(3, '0'));
297
+ return r ? { trigraph: r[1], digraph: r[2], name: r[3] } : undefined;
298
+ }
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.gencCountry = exports.GENC_COUNTRIES = exports.GRAPHIC_ORDERS_OF_BATTLE = exports.ORDERS_OF_BATTLE = exports.LETTER_STATUSES = exports.BATTLE_DIMENSIONS = exports.LETTER_IDENTITIES = exports.CODING_SCHEMES = exports.parseLetterSidc = exports.formatNumericSidc = exports.parseNumericSidc = void 0;
18
+ exports.parseSidc = parseSidc;
19
+ /**
20
+ * @zaes/sidc — symbol identification codes of MIL-STD-2525C, 2525D and 2525E (and APP-6 D/E):
21
+ * read, validate and write them. No dependencies, no DOM, no drawing.
22
+ *
23
+ * @module @zaes/sidc
24
+ */
25
+ const letter_js_1 = require("./letter.js");
26
+ const numeric_js_1 = require("./numeric.js");
27
+ __exportStar(require("./tables.js"), exports);
28
+ var numeric_js_2 = require("./numeric.js");
29
+ Object.defineProperty(exports, "parseNumericSidc", { enumerable: true, get: function () { return numeric_js_2.parseNumericSidc; } });
30
+ Object.defineProperty(exports, "formatNumericSidc", { enumerable: true, get: function () { return numeric_js_2.formatNumericSidc; } });
31
+ var letter_js_2 = require("./letter.js");
32
+ Object.defineProperty(exports, "parseLetterSidc", { enumerable: true, get: function () { return letter_js_2.parseLetterSidc; } });
33
+ Object.defineProperty(exports, "CODING_SCHEMES", { enumerable: true, get: function () { return letter_js_2.CODING_SCHEMES; } });
34
+ Object.defineProperty(exports, "LETTER_IDENTITIES", { enumerable: true, get: function () { return letter_js_2.LETTER_IDENTITIES; } });
35
+ Object.defineProperty(exports, "BATTLE_DIMENSIONS", { enumerable: true, get: function () { return letter_js_2.BATTLE_DIMENSIONS; } });
36
+ Object.defineProperty(exports, "LETTER_STATUSES", { enumerable: true, get: function () { return letter_js_2.LETTER_STATUSES; } });
37
+ Object.defineProperty(exports, "ORDERS_OF_BATTLE", { enumerable: true, get: function () { return letter_js_2.ORDERS_OF_BATTLE; } });
38
+ Object.defineProperty(exports, "GRAPHIC_ORDERS_OF_BATTLE", { enumerable: true, get: function () { return letter_js_2.GRAPHIC_ORDERS_OF_BATTLE; } });
39
+ /** Reads any SIDC: starting with a letter is 2525C (15 characters); 20 or 30 digits is numeric. */
40
+ function parseSidc(input) {
41
+ const code = input.trim();
42
+ // A numeric code starts with a digit; a letter code with its coding scheme's letter.
43
+ if (/^[A-Za-z]/.test(code))
44
+ return (0, letter_js_1.parseLetterSidc)(code);
45
+ return (0, numeric_js_1.parseNumericSidc)(code);
46
+ }
47
+ var genc_js_1 = require("./genc.js");
48
+ Object.defineProperty(exports, "GENC_COUNTRIES", { enumerable: true, get: function () { return genc_js_1.GENC_COUNTRIES; } });
49
+ Object.defineProperty(exports, "gencCountry", { enumerable: true, get: function () { return genc_js_1.gencCountry; } });