@tak-ps/node-cot 12.17.0 → 12.18.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 (123) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/lib/data-package.js +64 -16
  3. package/dist/lib/data-package.js.map +1 -1
  4. package/dist/lib/types/feature.js +1 -1
  5. package/dist/lib/types/feature.js.map +1 -1
  6. package/dist/lib/types/iconset.js +12 -4
  7. package/dist/lib/types/iconset.js.map +1 -1
  8. package/dist/lib/xml/basemap.js +1 -1
  9. package/dist/lib/xml/basemap.js.map +1 -1
  10. package/dist/lib/xml/iconset.js +29 -2
  11. package/dist/lib/xml/iconset.js.map +1 -1
  12. package/dist/package.json +1 -1
  13. package/dist/tsconfig.tsbuildinfo +1 -1
  14. package/lib/data-package.ts +70 -17
  15. package/lib/types/feature.ts +1 -1
  16. package/lib/types/iconset.ts +14 -4
  17. package/lib/xml/basemap.ts +2 -2
  18. package/lib/xml/iconset.ts +36 -3
  19. package/lib/xml-document.ts +1 -1
  20. package/package.json +1 -1
  21. package/tsconfig.json +1 -0
  22. package/dist/test/basemaps.test.js +0 -16
  23. package/dist/test/basemaps.test.js.map +0 -1
  24. package/dist/test/chat.test.js +0 -97
  25. package/dist/test/chat.test.js.map +0 -1
  26. package/dist/test/cot-fileshare.test.js +0 -89
  27. package/dist/test/cot-fileshare.test.js.map +0 -1
  28. package/dist/test/cot-itak.test.js +0 -95
  29. package/dist/test/cot-itak.test.js.map +0 -1
  30. package/dist/test/cot-mma.test.js +0 -108
  31. package/dist/test/cot-mma.test.js.map +0 -1
  32. package/dist/test/cot-polyline.test.js +0 -98
  33. package/dist/test/cot-polyline.test.js.map +0 -1
  34. package/dist/test/cot-range-and-bearing.test.js +0 -98
  35. package/dist/test/cot-range-and-bearing.test.js.map +0 -1
  36. package/dist/test/cot-routes.test.js +0 -466
  37. package/dist/test/cot-routes.test.js.map +0 -1
  38. package/dist/test/cot-types.test.js +0 -7
  39. package/dist/test/cot-types.test.js.map +0 -1
  40. package/dist/test/cot-uas-tool.test.js +0 -286
  41. package/dist/test/cot-uas-tool.test.js.map +0 -1
  42. package/dist/test/cot-video.test.js +0 -196
  43. package/dist/test/cot-video.test.js.map +0 -1
  44. package/dist/test/cot_is.test.js +0 -353
  45. package/dist/test/cot_is.test.js.map +0 -1
  46. package/dist/test/data-package.test.js +0 -234
  47. package/dist/test/data-package.test.js.map +0 -1
  48. package/dist/test/diff.test.js +0 -73
  49. package/dist/test/diff.test.js.map +0 -1
  50. package/dist/test/flow-tags.test.js +0 -19
  51. package/dist/test/flow-tags.test.js.map +0 -1
  52. package/dist/test/force-delete.js +0 -46
  53. package/dist/test/force-delete.js.map +0 -1
  54. package/dist/test/from_geojson.test.js +0 -287
  55. package/dist/test/from_geojson.test.js.map +0 -1
  56. package/dist/test/newlines.test.js +0 -79
  57. package/dist/test/newlines.test.js.map +0 -1
  58. package/dist/test/reversal-geojson.test.js +0 -15
  59. package/dist/test/reversal-geojson.test.js.map +0 -1
  60. package/dist/test/reversal-proto.test.js +0 -54
  61. package/dist/test/reversal-proto.test.js.map +0 -1
  62. package/dist/test/stream.js +0 -10
  63. package/dist/test/stream.js.map +0 -1
  64. package/dist/test/taskings-mission.test.js +0 -140
  65. package/dist/test/taskings-mission.test.js.map +0 -1
  66. package/dist/test/util.test.js +0 -25
  67. package/dist/test/util.test.js.map +0 -1
  68. package/dist/test/validation.test.js +0 -13
  69. package/dist/test/validation.test.js.map +0 -1
  70. package/test/basemaps/Bing_Hybrid.xml +0 -12
  71. package/test/basemaps/Bing_Maps.xml +0 -10
  72. package/test/basemaps/USGSBasemap.xml +0 -10
  73. package/test/basemaps/USGSImageryOnly.xml +0 -10
  74. package/test/basemaps/USGSImageryTopo.xml +0 -10
  75. package/test/basemaps/USGSShadedRelief.xml +0 -10
  76. package/test/basemaps/opentopomap.xml +0 -10
  77. package/test/basemaps.test.ts +0 -19
  78. package/test/chat.test.ts +0 -103
  79. package/test/cot-fileshare.test.ts +0 -92
  80. package/test/cot-itak.test.ts +0 -100
  81. package/test/cot-mma.test.ts +0 -111
  82. package/test/cot-polyline.test.ts +0 -103
  83. package/test/cot-range-and-bearing.test.ts +0 -100
  84. package/test/cot-routes.test.ts +0 -468
  85. package/test/cot-types.test.ts +0 -8
  86. package/test/cot-uas-tool.test.ts +0 -295
  87. package/test/cot-video.test.ts +0 -204
  88. package/test/cot_is.test.ts +0 -431
  89. package/test/data-package.test.ts +0 -314
  90. package/test/diff.test.ts +0 -80
  91. package/test/fixtures/archived.geojson +0 -20
  92. package/test/fixtures/attachments.geojson +0 -20
  93. package/test/fixtures/basic.geojson +0 -19
  94. package/test/fixtures/circle.geojson +0 -30
  95. package/test/fixtures/color.geojson +0 -21
  96. package/test/fixtures/fileshare.geojson +0 -28
  97. package/test/fixtures/geofence.geojson +0 -25
  98. package/test/fixtures/hae.geojson +0 -19
  99. package/test/fixtures/icon.geojson +0 -20
  100. package/test/fixtures/linestring.geojson +0 -28
  101. package/test/fixtures/marti-mission.geojson +0 -22
  102. package/test/fixtures/metadata.geojson +0 -24
  103. package/test/fixtures/mission-layer.geojson +0 -31
  104. package/test/fixtures/mission.geojson +0 -25
  105. package/test/fixtures/polygon.geojson +0 -33
  106. package/test/fixtures/props.geojson +0 -22
  107. package/test/fixtures/sensor.geojson +0 -31
  108. package/test/fixtures/video-connection.geojson +0 -27
  109. package/test/fixtures/video.geojson +0 -24
  110. package/test/flow-tags.test.ts +0 -21
  111. package/test/force-delete.ts +0 -50
  112. package/test/from_geojson.test.ts +0 -323
  113. package/test/newlines.test.ts +0 -83
  114. package/test/packages/AttachmentInManifest.zip +0 -0
  115. package/test/packages/COMilePosts.zip +0 -0
  116. package/test/packages/CameraCOTs.zip +0 -0
  117. package/test/packages/QuickPic.zip +0 -0
  118. package/test/reversal-geojson.test.ts +0 -19
  119. package/test/reversal-proto.test.ts +0 -60
  120. package/test/stream.ts +0 -10
  121. package/test/taskings-mission.test.ts +0 -148
  122. package/test/util.test.ts +0 -34
  123. package/test/validation.test.ts +0 -13
@@ -1,6 +1,6 @@
1
1
  import XMLDocument from '../xml-document.js';
2
2
  import type { Static } from '@sinclair/typebox'
3
- import IconsetSchema from '../types/iconset.js';
3
+ import IconsetSchema, { IconsetAttributes, IconAttributes } from '../types/iconset.js';
4
4
  import AJV from 'ajv';
5
5
 
6
6
  const checkIconset = (new AJV({
@@ -19,8 +19,41 @@ export class Iconset extends XMLDocument<IconsetType> {
19
19
  /**
20
20
  * Return an Iconset from a string XML representation
21
21
  */
22
- static parse(input: string): Iconset {
23
- const basemap = super.check<IconsetType>(input, checkIconset);
22
+ static parse(input: string | Buffer): Iconset {
23
+ const basemap = super.check<IconsetType>(String(input), checkIconset);
24
24
  return new Iconset(basemap);
25
25
  }
26
+
27
+ get uid() {
28
+ return this.raw.iconset._attributes.uid;
29
+ }
30
+
31
+ get name() {
32
+ return this.raw.iconset._attributes.name;
33
+ }
34
+
35
+ icons(): Set<Static<typeof IconAttributes>> {
36
+ const icons = new Set<Static<typeof IconAttributes>>();
37
+ for (const icon of Array.isArray(this.raw.iconset.icon) ? this.raw.iconset.icon : [ this.raw.iconset.icon ]) {
38
+ icons.add(icon._attributes);
39
+ }
40
+
41
+ return icons;
42
+ }
43
+
44
+ to_json(): Static<typeof IconsetAttributes> {
45
+ const iconset: Static<typeof IconsetAttributes> = {
46
+ uid: this.raw.iconset._attributes.uid,
47
+ version: this.raw.iconset._attributes.version,
48
+ name: this.raw.iconset._attributes.name,
49
+ skip_resize: this.raw.iconset._attributes.skip_resize === undefined ? false : this.raw.iconset._attributes.skip_resize,
50
+ default_group: this.raw.iconset._attributes.default_group,
51
+ default_friendly: this.raw.iconset._attributes.default_friendly,
52
+ default_hostile: this.raw.iconset._attributes.default_hostile,
53
+ default_neutral: this.raw.iconset._attributes.default_neutral,
54
+ default_unknown: this.raw.iconset._attributes.default_unknown
55
+ };
56
+
57
+ return iconset;
58
+ }
26
59
  }
@@ -12,7 +12,7 @@ export default class XMLDocument<T> {
12
12
  constructor(raw: T) {
13
13
  this.raw = raw;
14
14
  }
15
-
15
+
16
16
  static check<U>(input: string, check: ValidateFunction<unknown>): U {
17
17
  const xml = xmljs.xml2js(input, { compact: true })
18
18
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tak-ps/node-cot",
3
3
  "type": "module",
4
- "version": "12.17.0",
4
+ "version": "12.18.0",
5
5
  "description": "Lightweight JavaScript library for parsing and manipulating TAK messages",
6
6
  "author": "Nick Ingalls <nick@ingalls.ca>",
7
7
  "main": "dist/index.js",
package/tsconfig.json CHANGED
@@ -27,6 +27,7 @@
27
27
  "index.ts",
28
28
  "test/**/*",
29
29
  "lib/*.ts",
30
+ "lib/xml/*.ts",
30
31
  "lib/schema.json"
31
32
  ]
32
33
  }
@@ -1,16 +0,0 @@
1
- import fs from 'node:fs/promises';
2
- import path from 'node:path';
3
- import test from 'tape';
4
- import { Basemap } from '../index.js';
5
- import { fileURLToPath } from 'node:url';
6
- for (const fixturename of await fs.readdir(new URL('./basemaps/', import.meta.url))) {
7
- test(`Basemap Test: ${fixturename}`, async (t) => {
8
- const fixture = String(await fs.readFile(path.join(path.parse(fileURLToPath(import.meta.url)).dir, 'basemaps/', fixturename)));
9
- const container = await Basemap.parse(fixture);
10
- t.ok(container.raw.customMapSource.name._text.length);
11
- const json = container.to_json();
12
- t.ok(json.name && json.name.length);
13
- t.end();
14
- });
15
- }
16
- //# sourceMappingURL=basemaps.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"basemaps.test.js","sourceRoot":"","sources":["../../test/basemaps.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,KAAK,MAAM,WAAW,IAAI,MAAM,EAAE,CAAC,OAAO,CAAC,IAAI,GAAG,CAAC,aAAa,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;IAClF,IAAI,CAAC,iBAAiB,WAAW,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE;QAC7C,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,WAAW,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC;QAC/H,MAAM,SAAS,GAAG,MAAM,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAE/C,CAAC,CAAC,EAAE,CAAC,SAAS,CAAC,GAAG,CAAC,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAA;QAErD,MAAM,IAAI,GAAG,SAAS,CAAC,OAAO,EAAE,CAAC;QACjC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAEpC,CAAC,CAAC,GAAG,EAAE,CAAC;IACZ,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -1,97 +0,0 @@
1
- import test from 'tape';
2
- import { DirectChat } from '../index.js';
3
- test('DirectChat - Basic', (t) => {
4
- const cot = new DirectChat({
5
- to: {
6
- uid: '123456',
7
- callsign: 'Alpha Operator'
8
- },
9
- from: {
10
- uid: '654321',
11
- callsign: 'Bravo Operator'
12
- },
13
- message: 'Direct Message Test'
14
- });
15
- t.equals(cot.is_chat(), true);
16
- t.ok(cot.raw.event._attributes.uid);
17
- cot.raw.event._attributes.uid = '123';
18
- if (!cot.raw.event.detail) {
19
- t.fail('No Detail Section');
20
- }
21
- else {
22
- t.ok(cot.raw.event.detail['_flow-tags_']);
23
- delete cot.raw.event.detail['_flow-tags_'];
24
- t.equals(typeof cot.raw.event._attributes.time, 'string');
25
- cot.raw.event._attributes.time = '2024-04-01';
26
- t.equals(typeof cot.raw.event._attributes.start, 'string');
27
- cot.raw.event._attributes.start = '2024-04-01';
28
- t.equals(typeof cot.raw.event._attributes.stale, 'string');
29
- cot.raw.event._attributes.stale = '2024-04-01';
30
- if (!cot.raw.event.detail.__chat) {
31
- t.fail('No Chat Section');
32
- }
33
- else {
34
- t.equals(typeof cot.raw.event.detail.__chat._attributes.messageId, 'string');
35
- cot.raw.event.detail.__chat._attributes.messageId = '123';
36
- }
37
- if (!cot.raw.event.detail.remarks || !cot.raw.event.detail.remarks._attributes) {
38
- t.fail('No Remarks Section');
39
- }
40
- else {
41
- t.equals(typeof cot.raw.event.detail.remarks._attributes.time, 'string');
42
- cot.raw.event.detail.remarks._attributes.time = '123';
43
- }
44
- t.deepEquals(cot.raw, {
45
- event: {
46
- _attributes: {
47
- uid: '123',
48
- version: '2.0',
49
- type: 'b-t-f',
50
- how: 'h-g-i-g-o',
51
- time: '2024-04-01',
52
- stale: '2024-04-01',
53
- start: '2024-04-01'
54
- },
55
- point: {
56
- _attributes: { lat: '0.000000', lon: '0.000000', hae: '0.0', ce: '9999999.0', le: '9999999.0' }
57
- },
58
- detail: {
59
- __chat: {
60
- _attributes: {
61
- parent: 'RootContactGroup',
62
- groupOwner: 'false',
63
- messageId: '123',
64
- chatroom: 'Alpha Operator',
65
- id: '123456',
66
- senderCallsign: 'Bravo Operator'
67
- },
68
- chatgrp: {
69
- _attributes: {
70
- uid0: "654321",
71
- uid1: "123456",
72
- id: "123456"
73
- }
74
- }
75
- },
76
- link: {
77
- _attributes: {
78
- uid: '654321',
79
- type: 'a-f-G',
80
- relation: 'p-p'
81
- }
82
- },
83
- remarks: {
84
- _attributes: {
85
- source: '654321',
86
- to: '123456',
87
- time: '123'
88
- },
89
- _text: 'Direct Message Test'
90
- }
91
- }
92
- }
93
- });
94
- }
95
- t.end();
96
- });
97
- //# sourceMappingURL=chat.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"chat.test.js","sourceRoot":"","sources":["../../test/chat.test.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,IAAI,CAAC,oBAAoB,EAAE,CAAC,CAAC,EAAE,EAAE;IAC7B,MAAM,GAAG,GAAG,IAAI,UAAU,CAAC;QACvB,EAAE,EAAE;YACA,GAAG,EAAE,QAAQ;YACb,QAAQ,EAAE,gBAAgB;SAC7B;QACD,IAAI,EAAE;YACF,GAAG,EAAE,QAAQ;YACb,QAAQ,EAAE,gBAAgB;SAC7B;QACD,OAAO,EAAE,qBAAqB;KACjC,CAAC,CAAC;IAEH,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,EAAE,EAAE,IAAI,CAAC,CAAC;IAE9B,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IACpC,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,GAAG,KAAK,CAAC;IAEtC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;QACxB,CAAC,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAA;IAC/B,CAAC;SAAM,CAAC;QACJ,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC;QAC1C,OAAO,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;QAE3C,CAAC,CAAC,MAAM,CAAC,OAAO,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,WAAW,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;QAC1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J;SACJ,CAAC,CAAC;IACP,CAAC;IAED,CAAC,CAAC,GAAG,EAAE,CAAC;AACZ,CAAC,CAAC,CAAC"}
@@ -1,89 +0,0 @@
1
- import test from 'tape';
2
- import CoT from '../index.js';
3
- test('Decode MultiMissionAircraft CoTs', (t) => {
4
- const cot = new CoT({ "event": { "_attributes": { "version": "2.0", "uid": "d60e38c2-6c51-4f69-bff9-c5cbc6b44a76", "type": "b-f-t-r", "how": "h-e", "time": "2024-07-02T17:13:20Z", "start": "2024-07-02T17:13:19Z", "stale": "2024-07-02T17:13:29Z" }, "point": { "_attributes": { "lat": "39.07853", "lon": "-108.537397", "hae": "1400.49561947", "ce": "9.9350462", "le": "NaN" } }, "detail": { "fileshare": { "_attributes": { "filename": "20240615_144641.jpg.zip", "senderUrl": "https://18.254.242.65:8443/Marti/sync/content?hash=c18e00d123057a8e33107e91ab02f999ecc6f849aed2a41b84e237ff36106a4e", "sizeInBytes": "4233884", "sha256": "c18e00d123057a8e33107e91ab02f999ecc6f849aed2a41b84e237ff36106a4e", "senderUid": "ANDROID-0ca41830e11d2ef3", "senderCallsign": "DFPC Ingalls", "name": "20240615_144641.jpg" } }, "ackrequest": { "_attributes": { "uid": "814d0d4a-3339-4fd2-8e09-0556444112f3", "ackrequested": "true", "tag": "20240615_144641.jpg" } }, "_flow-tags_": { "_attributes": { "TAK-Server-e87a0e02420b44a08f6032bcf1877745": "2024-07-02T17:13:20Z" } } } } });
5
- if (!cot.raw.event.detail) {
6
- t.fail('No Detail Section');
7
- }
8
- else {
9
- t.ok(cot.raw.event.detail['_flow-tags_']);
10
- delete cot.raw.event.detail['_flow-tags_'];
11
- t.deepEquals({
12
- "event": {
13
- "_attributes": {
14
- "version": "2.0",
15
- "uid": "d60e38c2-6c51-4f69-bff9-c5cbc6b44a76",
16
- "time": "2024-07-02T17:13:20Z",
17
- "start": "2024-07-02T17:13:19Z",
18
- "stale": "2024-07-02T17:13:29Z",
19
- "type": "b-f-t-r",
20
- "how": "h-e"
21
- },
22
- "point": {
23
- "_attributes": {
24
- "lat": "39.07853",
25
- "lon": "-108.537397",
26
- "hae": "1400.49561947",
27
- "ce": "9.9350462",
28
- "le": "NaN"
29
- }
30
- },
31
- "detail": {
32
- ackrequest: {
33
- "_attributes": {
34
- "uid": "814d0d4a-3339-4fd2-8e09-0556444112f3",
35
- "ackrequested": true,
36
- "tag": "20240615_144641.jpg"
37
- }
38
- },
39
- fileshare: {
40
- "_attributes": {
41
- "filename": "20240615_144641.jpg.zip",
42
- "senderUrl": "https://18.254.242.65:8443/Marti/sync/content?hash=c18e00d123057a8e33107e91ab02f999ecc6f849aed2a41b84e237ff36106a4e",
43
- "sizeInBytes": 4233884,
44
- "sha256": "c18e00d123057a8e33107e91ab02f999ecc6f849aed2a41b84e237ff36106a4e",
45
- "senderUid": "ANDROID-0ca41830e11d2ef3",
46
- "senderCallsign": "DFPC Ingalls",
47
- "name": "20240615_144641.jpg"
48
- }
49
- }
50
- }
51
- }
52
- }, cot.raw);
53
- t.deepEquals({
54
- id: 'd60e38c2-6c51-4f69-bff9-c5cbc6b44a76',
55
- type: 'Feature',
56
- path: '/',
57
- properties: {
58
- callsign: 'UNKNOWN',
59
- type: 'b-f-t-r',
60
- how: 'h-e',
61
- center: [-108.537397, 39.07853, 1400.49561947],
62
- time: '2024-07-02T17:13:20Z',
63
- start: '2024-07-02T17:13:19Z',
64
- stale: '2024-07-02T17:13:29Z',
65
- ackrequest: {
66
- "uid": "814d0d4a-3339-4fd2-8e09-0556444112f3",
67
- "ackrequested": true,
68
- "tag": "20240615_144641.jpg"
69
- },
70
- fileshare: {
71
- "filename": "20240615_144641.jpg.zip",
72
- "senderUrl": "https://18.254.242.65:8443/Marti/sync/content?hash=c18e00d123057a8e33107e91ab02f999ecc6f849aed2a41b84e237ff36106a4e",
73
- "sizeInBytes": 4233884,
74
- "sha256": "c18e00d123057a8e33107e91ab02f999ecc6f849aed2a41b84e237ff36106a4e",
75
- "senderUid": "ANDROID-0ca41830e11d2ef3",
76
- "senderCallsign": "DFPC Ingalls",
77
- "name": "20240615_144641.jpg"
78
- },
79
- metadata: {},
80
- },
81
- geometry: {
82
- type: 'Point',
83
- coordinates: [-108.537397, 39.07853, 1400.49561947]
84
- }
85
- }, cot.to_geojson());
86
- }
87
- t.end();
88
- });
89
- //# sourceMappingURL=cot-fileshare.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cot-fileshare.test.js","sourceRoot":"","sources":["../../test/cot-fileshare.test.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,GAAG,MAAM,aAAa,CAAC;AAE9B,IAAI,CAAC,kCAAkC,EAAE,CAAC,CAAC,EAAE,EAAE;IAC3C,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,EAAC,OAAO,EAAC,EAAC,aAAa,EAAC,EAAC,SAAS,EAAC,KAAK,EAAC,KAAK,EAAC,sCAAsC,EAAC,MAAM,EAAC,SAAS,EAAC,KAAK,EAAC,KAAK,EAAC,MAAM,EAAC,sBAAsB,EAAC,OAAO,EAAC,sBAAsB,EAAC,OAAO,EAAC,sBAAsB,EAAC,EAAC,OAAO,EAAC,EAAC,aAAa,EAAC,EAAC,KAAK,EAAC,UAAU,EAAC,KAAK,EAAC,aAAa,EAAC,KAAK,EAAC,eAAe,EAAC,IAAI,EAAC,WAAW,EAAC,IAAI,EAAC,KAAK,EAAC,EAAC,EAAC,QAAQ,EAAC,EAAC,WAAW,EAAC,EAAC,aAAa,EAAC,EAAC,UAAU,EAAC,yBAAyB,EAAC,WAAW,EAAC,qHAAqH,EAAC,aAAa,EAAC,SAAS,EAAC,QAAQ,EAAC,kEAAkE,EAAC,WAAW,EAAC,0BAA0B,EAAC,gBAAgB,EAAC,cAAc,EAAC,MAAM,EAAC,qBAAqB,EAAC,EAAC,EAAC,YAAY,EAAC,EAAC,aAAa,EAAC,EAAC,KAAK,EAAC,sCAAsC,EAAC,cAAc,EAAC,MAAM,EAAC,KAAK,EAA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gBAAgB,EAAE,cAAc;4BAChC,MAAM,EAAE,qBAAqB;yBAChC;qBACJ;iBACJ;aACJ;SACJ,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC;QAEZ,CAAC,CAAC,UAAU,CAAC;YACT,EAAE,EAAE,sCAAsC;YAC1C,IAAI,EAAE,SAAS;YACf,IAAI,EAAE,GAAG;YACT,UAAU,EAAE;gBACR,QAAQ,EAAE,SAAS;gBACnB,IAAI,EAAE,SAAS;gBACf,GAAG,EAAE,KAAK;gBACV,MAAM,EAAE,CAAC,CAAC,UAAU,EAAE,QAAQ,EAAE,aAAa,CAAC;gBAC9C,IAAI,EAAE,sBAAsB;gBAC5B,KAAK,EAAE,sBAAsB;gBAC7B,KAAK,EAAE,sBAAsB;gBAC7B,UAAU,EAAE;oBACR,KAAK,EAAE,sCAAsC;oBAC7C,cAAc,EAAE,IAAI;oBACpB,KAAK,EAAE,qBAAqB;iBAC/B;gBACD,SAAS,EAAE;oBACP,UAAU,EAAE,yBAAyB;oBACrC,WAAW,EAAE,qHAAqH;oBAClI,aAAa,EAAE,OAAO;oBACtB,QAAQ,EAAE,kEAAkE;oBAC5E,WAAW,EAAE,0BAA0B;oBACvC,gBAAgB,EAAE,cAAc;oBAChC,MAAM,EAAE,qBAAqB;iBAChC;gBACD,QAAQ,EAAE,EAAE;aACf;YACD,QAAQ,EAAE;gBACN,IAAI,EAAE,OAAO;gBACb,WAAW,EAAE,CAAC,CAAC,UAAU,EAAE,QAAQ,EAAE,aAAa,CAAC;aACtD;SACJ,EAAE,GAAG,CAAC,UAAU,EAAE,CAAC,CAAC;IACzB,CAAC;IAED,CAAC,CAAC,GAAG,EAAE,CAAC;AACZ,CAAC,CAAC,CAAC"}
@@ -1,95 +0,0 @@
1
- import test from 'tape';
2
- import CoT from '../index.js';
3
- test('Decode iTAK COT message', (t) => {
4
- const packet = '<event version="2.0" uid="C94B9215-9BD4-4DBE-BDE1-83625F09153F" type="a-f-G-E-V-C" time="2023-07-18T15:23:09.00Z" start="2023-07-18T15:23:09.00Z" stale="2023-07-18T15:25:09.00Z" how="m-g"><point lat="41.52309645" lon="-107.72376567" hae="1681.23725821" ce="9999999" le="9999999" /><detail><contact callsign="DFPC-iSchmidt" phone="7204258729" endpoint="*:-1:stcp" /><uid Droid="DFPC-iSchmidt" /><__group name="Yellow" role="Team Member" /><precisionlocation geopointsrc="GPS" altsrc="???" /><status battery="100" /><takv device="iPhone" platform="iTAK" os="16.5.1" version="2.7.0.609" /><track speed="0.00000000" course="137.23542786" /></detail></event>';
5
- const cot = new CoT(packet);
6
- if (!cot.raw.event.detail) {
7
- t.fail('No Detail Section');
8
- }
9
- else {
10
- t.ok(cot.raw.event.detail['_flow-tags_']);
11
- delete cot.raw.event.detail['_flow-tags_'];
12
- t.deepEquals({
13
- 'event': {
14
- '_attributes': {
15
- 'version': '2.0',
16
- 'uid': 'C94B9215-9BD4-4DBE-BDE1-83625F09153F',
17
- 'type': 'a-f-G-E-V-C',
18
- 'time': '2023-07-18T15:23:09.00Z',
19
- 'start': '2023-07-18T15:23:09.00Z',
20
- 'stale': '2023-07-18T15:25:09.00Z',
21
- 'how': 'm-g',
22
- },
23
- 'point': {
24
- '_attributes': {
25
- 'lat': '41.52309645',
26
- 'lon': '-107.72376567',
27
- 'hae': '1681.23725821',
28
- 'ce': '9999999',
29
- 'le': '9999999'
30
- }
31
- },
32
- detail: {
33
- contact: {
34
- _attributes: {
35
- callsign: 'DFPC-iSchmidt',
36
- phone: '7204258729',
37
- endpoint: '*:-1:stcp'
38
- }
39
- },
40
- uid: { _attributes: { Droid: 'DFPC-iSchmidt' } },
41
- __group: { _attributes: { name: 'Yellow', role: 'Team Member' } },
42
- precisionlocation: { _attributes: { geopointsrc: 'GPS', altsrc: '???' } },
43
- status: { _attributes: { battery: '100' } },
44
- takv: { _attributes: { device: 'iPhone', platform: 'iTAK', os: '16.5.1', version: '2.7.0.609' } },
45
- track: { _attributes: { speed: '0.00000000', course: '137.23542786' } }
46
- }
47
- }
48
- }, cot.raw);
49
- t.deepEquals({
50
- id: 'C94B9215-9BD4-4DBE-BDE1-83625F09153F',
51
- type: 'Feature',
52
- path: '/',
53
- properties: {
54
- callsign: 'DFPC-iSchmidt',
55
- droid: "DFPC-iSchmidt",
56
- type: 'a-f-G-E-V-C',
57
- how: 'm-g',
58
- center: [-107.72376567, 41.52309645, 1681.23725821],
59
- time: '2023-07-18T15:23:09.00Z',
60
- start: '2023-07-18T15:23:09.00Z',
61
- stale: '2023-07-18T15:25:09.00Z',
62
- course: 137.23542786,
63
- speed: 0,
64
- contact: {
65
- "phone": "7204258729",
66
- "endpoint": "*:-1:stcp"
67
- },
68
- metadata: {},
69
- group: {
70
- name: 'Yellow',
71
- role: 'Team Member'
72
- },
73
- precisionlocation: {
74
- "geopointsrc": "GPS",
75
- "altsrc": "???"
76
- },
77
- status: {
78
- "battery": "100"
79
- },
80
- takv: {
81
- "device": "iPhone",
82
- "platform": "iTAK",
83
- "os": "16.5.1",
84
- "version": "2.7.0.609"
85
- }
86
- },
87
- geometry: {
88
- type: 'Point',
89
- coordinates: [-107.72376567, 41.52309645, 1681.23725821]
90
- }
91
- }, cot.to_geojson());
92
- }
93
- t.end();
94
- });
95
- //# sourceMappingURL=cot-itak.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cot-itak.test.js","sourceRoot":"","sources":["../../test/cot-itak.test.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,GAAG,MAAM,aAAa,CAAC;AAE9B,IAAI,CAAC,yBAAyB,EAAE,CAAC,CAAC,EAAE,EAAE;IAClC,MAAM,MAAM,GAAG,+oBAA+oB,CAAC;IAE/pB,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC;IAE5B,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;QACxB,CAAC,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAA;IAC/B,C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C;IAED,CAAC,CAAC,GAAG,EAAE,CAAC;AACZ,CAAC,CAAC,CAAC"}
@@ -1,108 +0,0 @@
1
- import test from 'tape';
2
- import CoT from '../index.js';
3
- test('Decode MultiMissionAircraft CoTs', (t) => {
4
- const cot = new CoT({ "event": { "_attributes": { "version": "2.0", "uid": "CO-DFPC-WLD27_CO-DFPC-WLD27-SPI", "time": "2024-07-01T22:06:41Z", "start": "2024-07-01T22:06:38Z", "stale": "2024-07-01T22:06:58Z", "type": "b-m-p-s-p-i", "how": "m-g-n" }, "point": { "_attributes": { "lat": "40.066418", "lon": "-108.322413", "hae": "1899.427151", "ce": "9999999", "le": "9999999" } }, "detail": { "precisionlocation": { "_attributes": { "geopointsrc": "CALC", "altsrc": "CALC" } }, "contact": { "_attributes": { "name": "CO-DFPC-WLD27-SPI", "callsign": "CO-DFPC-WLD27-SPI" } }, "link": { "_attributes": { "uid": "CO-DFPC-WLD27_CO-DFPC-WLD27", "relation": "p-p" } }, "shape": { "polyline": { "_attributes": { "closed": "true", "fillColor": "0", "color": "-1" }, "vertex": [{ "_attributes": { "lat": "40.059445", "lon": "-108.328368" } }, { "_attributes": { "lat": "40.061846", "lon": "-108.314776" } }, { "_attributes": { "lat": "40.075499", "lon": "-108.315566" } }, { "_attributes": { "lat": "40.071252", "lon": "-108.330782" } }] } }, "__group": {}, "_flow-tags_": { "_attributes": { "TAK-Server-e87a0e02420b44a08f6032bcf1877745": "2024-07-01T22:06:41Z" } } } } });
5
- if (!cot.raw.event.detail) {
6
- t.fail('No Detail Section');
7
- }
8
- else {
9
- t.ok(cot.raw.event.detail['_flow-tags_']);
10
- delete cot.raw.event.detail['_flow-tags_'];
11
- t.deepEquals({
12
- "event": {
13
- "_attributes": {
14
- "version": "2.0",
15
- "uid": "CO-DFPC-WLD27_CO-DFPC-WLD27-SPI",
16
- "time": "2024-07-01T22:06:41Z",
17
- "start": "2024-07-01T22:06:38Z",
18
- "stale": "2024-07-01T22:06:58Z",
19
- "type": "b-m-p-s-p-i",
20
- "how": "m-g-n"
21
- },
22
- "point": {
23
- "_attributes": {
24
- "lat": "40.066418",
25
- "lon": "-108.322413",
26
- "hae": "1899.427151",
27
- "ce": "9999999",
28
- "le": "9999999"
29
- }
30
- },
31
- "detail": {
32
- "precisionlocation": {
33
- "_attributes": {
34
- "geopointsrc": "CALC",
35
- "altsrc": "CALC"
36
- }
37
- },
38
- "contact": {
39
- "_attributes": {
40
- "name": "CO-DFPC-WLD27-SPI",
41
- "callsign": "CO-DFPC-WLD27-SPI"
42
- }
43
- },
44
- "link": {
45
- "_attributes": {
46
- "uid": "CO-DFPC-WLD27_CO-DFPC-WLD27",
47
- "relation": "p-p"
48
- }
49
- },
50
- "shape": {
51
- "polyline": {
52
- "_attributes": {
53
- "closed": true,
54
- "fillColor": "0",
55
- "color": "-1"
56
- },
57
- "vertex": [
58
- { "_attributes": { "lat": 40.059445, "lon": -108.328368 } },
59
- { "_attributes": { "lat": 40.061846, "lon": -108.314776 } },
60
- { "_attributes": { "lat": 40.075499, "lon": -108.315566 } },
61
- { "_attributes": { "lat": 40.071252, "lon": -108.330782 } }
62
- ]
63
- }
64
- },
65
- "__group": {},
66
- }
67
- }
68
- }, cot.raw);
69
- t.deepEquals({
70
- id: 'CO-DFPC-WLD27_CO-DFPC-WLD27-SPI',
71
- type: 'Feature',
72
- path: '/',
73
- properties: {
74
- callsign: 'CO-DFPC-WLD27-SPI',
75
- type: 'b-m-p-s-p-i',
76
- how: 'm-g-n',
77
- center: [-108.322413, 40.066418, 1899.427151],
78
- fill: "#000000",
79
- "fill-opacity": 0,
80
- stroke: "#FFFFFF",
81
- "stroke-opacity": 1,
82
- time: '2024-07-01T22:06:41Z',
83
- start: '2024-07-01T22:06:38Z',
84
- stale: '2024-07-01T22:06:58Z',
85
- contact: {
86
- name: "CO-DFPC-WLD27-SPI"
87
- },
88
- metadata: {},
89
- precisionlocation: {
90
- "geopointsrc": "CALC",
91
- "altsrc": "CALC"
92
- },
93
- },
94
- geometry: {
95
- type: 'Polygon',
96
- coordinates: [[
97
- [-108.328368, 40.059445],
98
- [-108.314776, 40.061846],
99
- [-108.315566, 40.075499],
100
- [-108.330782, 40.071252],
101
- [-108.328368, 40.059445],
102
- ]]
103
- }
104
- }, cot.to_geojson());
105
- }
106
- t.end();
107
- });
108
- //# sourceMappingURL=cot-mma.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cot-mma.test.js","sourceRoot":"","sources":["../../test/cot-mma.test.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,GAAG,MAAM,aAAa,CAAC;AAE9B,IAAI,CAAC,kCAAkC,EAAE,CAAC,CAAC,EAAE,EAAE;IAC3C,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,EAAC,OAAO,EAAC,EAAC,aAAa,EAAC,EAAC,SAAS,EAAC,KAAK,EAAC,KAAK,EAAC,iCAAiC,EAAC,MAAM,EAAC,sBAAsB,EAAC,OAAO,EAAC,sBAAsB,EAAC,OAAO,EAAC,sBAAsB,EAAC,MAAM,EAAC,aAAa,EAAC,KAAK,EAAC,OAAO,EAAC,EAAC,OAAO,EAAC,EAAC,aAAa,EAAC,EAAC,KAAK,EAAC,WAAW,EAAC,KAAK,EAAC,aAAa,EAAC,KAAK,EAAC,aAAa,EAAC,IAAI,EAAC,SAAS,EAAC,IAAI,EAAC,SAAS,EAAC,EAAC,EAAC,QAAQ,EAAC,EAAC,mBAAmB,EAAC,EAAC,aAAa,EAAC,EAAC,aAAa,EAAC,MAAM,EAAC,QAAQ,EAAC,MAAM,EAAC,EAAC,EAAC,SAAS,EAAC,EAAC,aAAa,EAAC,EAAC,MAAM,EAAC,mBAAmB,EAAC,UAAU,EAAC,mBAAmB,EAAC,EAAC,EAAC,MAAM,EAAC,EAAC,aAAa,EAAC,EAAC,KAAK,EAAC,6BAA6B,EAAC,UAAU,EAAC,KAAK,EAAC,EAAC,EAAC,OAAO,EAAC,EAAC,UAAU,EAAC,EAAC,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gBAC7B,IAAI,EAAE,aAAa;gBACnB,GAAG,EAAE,OAAO;gBACZ,MAAM,EAAE,CAAE,CAAC,UAAU,EAAE,SAAS,EAAE,WAAW,CAAE;gBAC/C,IAAI,EAAE,SAAS;gBACf,cAAc,EAAE,CAAC;gBACjB,MAAM,EAAE,SAAS;gBACjB,gBAAgB,EAAE,CAAC;gBACnB,IAAI,EAAE,sBAAsB;gBAC5B,KAAK,EAAE,sBAAsB;gBAC7B,KAAK,EAAE,sBAAsB;gBAC7B,OAAO,EAAE;oBACL,IAAI,EAAE,mBAAmB;iBAC5B;gBACD,QAAQ,EAAE,EAAE;gBACZ,iBAAiB,EAAE;oBACjB,aAAa,EAAE,MAAM;oBACrB,QAAQ,EAAE,MAAM;iBACjB;aACJ;YACD,QAAQ,EAAE;gBACN,IAAI,EAAE,SAAS;gBACf,WAAW,EAAE,CAAE;wBACX,CAAE,CAAC,UAAU,EAAE,SAAS,CAAE;wBAC1B,CAAE,CAAC,UAAU,EAAE,SAAS,CAAE;wBAC1B,CAAE,CAAC,UAAU,EAAE,SAAS,CAAE;wBAC1B,CAAE,CAAC,UAAU,EAAE,SAAS,CAAE;wBAC1B,CAAE,CAAC,UAAU,EAAE,SAAS,CAAE;qBAC7B,CAAE;aACN;SACJ,EAAE,GAAG,CAAC,UAAU,EAAE,CAAC,CAAC;IACzB,CAAC;IAED,CAAC,CAAC,GAAG,EAAE,CAAC;AACZ,CAAC,CAAC,CAAC"}
@@ -1,98 +0,0 @@
1
- import test from 'tape';
2
- import CoT from '../index.js';
3
- test('En-decode polyline', (t) => {
4
- const cot = new CoT({
5
- "event": {
6
- "_attributes": {
7
- "version": "2.0",
8
- "uid": "ebbf42a7-ea71-43a1-baf6-e259c3d115bf",
9
- "type": "u-rb-a",
10
- "how": "h-e",
11
- "time": "2024-08-30T22:28:02Z",
12
- "start": "2024-08-30T22:28:02Z",
13
- "stale": "2024-08-31T22:28:02Z",
14
- "access": "Undefined"
15
- },
16
- "point": {
17
- "_attributes": {
18
- "lat": "39.0981196",
19
- "lon": "-108.7395013",
20
- "hae": "0.0",
21
- "ce": "9999999.0",
22
- "le": "9999999.0"
23
- }
24
- },
25
- "detail": {
26
- "contact": {
27
- "_attributes": {
28
- "callsign": "c"
29
- }
30
- },
31
- "shape": {
32
- "polyline": {
33
- "vertex": [
34
- { "_attributes": { "lat": 47.7047674, "lon": -122.17861 } },
35
- {
36
- "_attributes": { "lat": 47.71376061012636, "lon": -122.17861 }
37
- },
38
- {
39
- "_attributes": { "lat": 47.7047674, "lon": -122.16524615319642 }
40
- },
41
- {
42
- "_attributes": { "lat": 47.695774189873646, "lon": -122.17861 }
43
- },
44
- { "_attributes": { "lat": 47.7047674, "lon": -122.17861 } }
45
- ],
46
- "_attributes": { "closed": true }
47
- }
48
- }
49
- }
50
- }
51
- });
52
- const cot2 = CoT.from_proto(cot.to_proto());
53
- const vertex = cot2.raw.event.detail?.shape?.polyline?.vertex;
54
- t.ok(Array.isArray(vertex) && vertex.length === 5);
55
- t.end();
56
- });
57
- test('En-decode 0-length polyline', (t) => {
58
- const cot3 = new CoT({
59
- "event": {
60
- "_attributes": {
61
- "version": "2.0",
62
- "uid": "ebbf42a7-ea71-43a1-baf6-e259c3d115bf",
63
- "type": "u-rb-a",
64
- "how": "h-e",
65
- "time": "2024-08-30T22:28:02Z",
66
- "start": "2024-08-30T22:28:02Z",
67
- "stale": "2024-08-31T22:28:02Z",
68
- "access": "Undefined"
69
- },
70
- "point": {
71
- "_attributes": {
72
- "lat": "39.0981196",
73
- "lon": "-108.7395013",
74
- "hae": "0.0",
75
- "ce": "9999999.0",
76
- "le": "9999999.0"
77
- }
78
- },
79
- "detail": {
80
- "contact": {
81
- "_attributes": {
82
- "callsign": "c"
83
- }
84
- },
85
- "shape": {
86
- "polyline": {
87
- "vertex": [],
88
- }
89
- }
90
- }
91
- }
92
- });
93
- // xml en-decoding looses empty array, but should work.
94
- const cot4 = CoT.from_proto(cot3.to_proto());
95
- t.ok(cot4.raw.event.detail?.shape?.polyline);
96
- t.end();
97
- });
98
- //# sourceMappingURL=cot-polyline.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cot-polyline.test.js","sourceRoot":"","sources":["../../test/cot-polyline.test.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,GAAG,MAAM,aAAa,CAAC;AAE9B,IAAI,CAAC,oBAAoB,EAAE,CAAC,CAAC,EAAE,EAAE;IAC7B,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC;QAChB,OAAO,EAAE;YACL,aAAa,EAAE;gBACX,SAAS,EAAE,KAAK;gBAChB,KAAK,EAAE,sCAAsC;gBAC7C,MAAM,EAAE,QAAQ;gBAChB,KAAK,EAAE,KAAK;gBACZ,MAAM,EAAE,sBAAsB;gBAC9B,OAAO,EAAE,sBAAsB;gBAC/B,OAAO,EAAE,sBAAsB;gBAC/B,QAAQ,EAAE,WAAW;aACxB;YACD,OAAO,EAAE;gBACL,aAAa,EAAE;oBACX,KAAK,EAAE,YAAY;oBACnB,KAAK,EAAE,cAAc;oBACrB,KAAK,EAAE,KAAK;oBACZ,IAAI,EAAE,WAAW;oBACjB,IAAI,EAAE,WAAW;iBACpB;aACJ;YACD,QAAQ,EAAE;gBACN,SAAS,EAAE;oBACP,aAAa,EAAE;wBACX,UAAU,EAAE,GAAG;qBAClB;iBACJ;gBACD,OAAO,EAAE;oBACL,UAAU,EAAE;wBACV,QAAQ,EAAE;4BACR,EAAE,aAAa,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,SAAS,EAAE,EAAE;4BAC3D;gCACE,aAAa,EAAE,EAAE,KAAK,EAAE,iBAAiB,EAAE,KAAK,EAAE,CAAC,SAAS,EAAE;6BAC/D;4BACD;gCACE,aAAa,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,kBAAkB,EAAE;6BACjE;4BACD;gCACE,aAAa,EAAE,EAAE,KAAK,EAA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