@accelint/geo 0.2.8 → 0.2.10

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 (29) hide show
  1. package/CHANGELOG.md +133 -0
  2. package/catalog-info.yaml +39 -0
  3. package/dist/coordinates/coordinate.js.map +1 -1
  4. package/dist/coordinates/latlon/decimal-degrees/parser.js.map +1 -1
  5. package/dist/coordinates/latlon/decimal-degrees/system.js.map +1 -1
  6. package/dist/coordinates/latlon/degrees-decimal-minutes/parser.js.map +1 -1
  7. package/dist/coordinates/latlon/degrees-decimal-minutes/system.js.map +1 -1
  8. package/dist/coordinates/latlon/degrees-minutes-seconds/parser.js.map +1 -1
  9. package/dist/coordinates/latlon/degrees-minutes-seconds/system.js.map +1 -1
  10. package/dist/coordinates/latlon/internal/lexer.js +1 -1
  11. package/dist/coordinates/latlon/internal/lexer.js.map +1 -1
  12. package/dist/coordinates/latlon/internal/parse-format.js.map +1 -1
  13. package/dist/coordinates/latlon/internal/parse.d.ts +1 -1
  14. package/dist/coordinates/latlon/internal/parse.js.map +1 -1
  15. package/dist/coordinates/latlon/internal/pipes/check-ambiguous.js.map +1 -1
  16. package/dist/coordinates/latlon/internal/pipes/check-numbers.js.map +1 -1
  17. package/dist/coordinates/latlon/internal/pipes/fix-bearings.js.map +1 -1
  18. package/dist/coordinates/latlon/internal/pipes/fix-dividers.js.map +1 -1
  19. package/dist/coordinates/latlon/internal/pipes/genome.js +1 -1
  20. package/dist/coordinates/latlon/internal/pipes/genome.js.map +1 -1
  21. package/dist/coordinates/latlon/internal/pipes/index.js.map +1 -1
  22. package/dist/coordinates/mgrs/parser.d.ts +1 -1
  23. package/dist/coordinates/mgrs/parser.js.map +1 -1
  24. package/dist/coordinates/mgrs/system.js.map +1 -1
  25. package/dist/coordinates/utm/parser.d.ts +1 -1
  26. package/dist/coordinates/utm/parser.js.map +1 -1
  27. package/dist/coordinates/utm/system.js.map +1 -1
  28. package/dist/metafile-esm.json +1 -1
  29. package/package.json +20 -6
package/CHANGELOG.md ADDED
@@ -0,0 +1,133 @@
1
+ # @accelint/geo
2
+
3
+ ## 0.2.10
4
+
5
+ ### Patch Changes
6
+
7
+ - 64280a7: - Released `@accelint/constellation-tracker` - A tool that helps maintain catalog-info.yaml files for Constellation integration
8
+ - Ensures all packages include catalog-info.yaml in their published files for better discoverability and integration with Constellation
9
+ - Provides automated tracking and updating of component metadata across the project
10
+ - Enhanced package metadata to support better integration with internal tooling
11
+ - Updated dependencies [64280a7]
12
+ - @accelint/math@0.1.6
13
+ - @accelint/predicates@0.4.2
14
+
15
+ ## 0.2.9
16
+
17
+ ### Patch Changes
18
+
19
+ - 5206880: Linting fixes only.
20
+ - Updated dependencies [5206880]
21
+ - @accelint/predicates@0.4.1
22
+
23
+ ## 0.2.8
24
+
25
+ ### Patch Changes
26
+
27
+ - Updated dependencies [383c42a]
28
+ - @accelint/predicates@0.4.0
29
+
30
+ ## 0.2.7
31
+
32
+ ### Patch Changes
33
+
34
+ - @accelint/predicates@0.3.4
35
+
36
+ ## 0.2.6
37
+
38
+ ### Patch Changes
39
+
40
+ - 83104ea: Refactored ViewStack to be event driven, allowing for triggers anywhere in the app
41
+ - Updated dependencies [83104ea]
42
+ - @accelint/predicates@0.3.3
43
+ - @accelint/math@0.1.5
44
+
45
+ ## 0.2.5
46
+
47
+ ### Patch Changes
48
+
49
+ - Updated dependencies [ca3922a]
50
+ - @accelint/math@0.1.4
51
+ - @accelint/predicates@0.3.2
52
+
53
+ ## 0.2.4
54
+
55
+ ### Patch Changes
56
+
57
+ - Updated dependencies [938c74e]
58
+ - @accelint/predicates@0.3.1
59
+
60
+ ## 0.2.3
61
+
62
+ ### Patch Changes
63
+
64
+ - Updated dependencies [b77d30e]
65
+ - Updated dependencies [0fafa9f]
66
+ - @accelint/predicates@0.3.0
67
+
68
+ ## 0.2.2
69
+
70
+ ### Patch Changes
71
+
72
+ - @accelint/predicates@0.2.2
73
+
74
+ ## 0.2.1
75
+
76
+ ### Patch Changes
77
+
78
+ - @accelint/predicates@0.2.1
79
+
80
+ ## 0.2.0
81
+
82
+ ### Minor Changes
83
+
84
+ - 6c23f31: Add coordinate parsing capability; parse string into object with conversion
85
+ options: MGRS, UTM, and lat/lon DD, DDM, DMS. Some error messaging is included
86
+ to be helpful for users and debuggers.
87
+
88
+ ### Patch Changes
89
+
90
+ - Updated dependencies [4ceec7e]
91
+ - Updated dependencies [13f0d6c]
92
+ - @accelint/predicates@0.2.0
93
+
94
+ ## 0.1.3
95
+
96
+ ### Patch Changes
97
+
98
+ - f117ea6: Converted build step to use `tsup`.
99
+ - d39c5d8: Added explicit file extensions to relative path imports via esbuild plugin for tsup.
100
+ - Updated dependencies [f117ea6]
101
+ - Updated dependencies [d39c5d8]
102
+ - @accelint/converters@0.1.3
103
+ - @accelint/predicates@0.1.3
104
+
105
+ ## 0.1.2
106
+
107
+ ### Patch Changes
108
+
109
+ - 2c661d3: Standardized package.json "exports" field
110
+ - Updated dependencies [2c661d3]
111
+ - @accelint/converters@0.1.2
112
+ - @accelint/predicates@0.1.2
113
+
114
+ ## 0.1.1
115
+
116
+ ### Patch Changes
117
+
118
+ - 017c16e: Fixed publishing artifacts.
119
+ - Updated dependencies [017c16e]
120
+ - @accelint/converters@0.1.1
121
+ - @accelint/predicates@0.1.1
122
+
123
+ ## 0.1.0
124
+
125
+ ### Minor Changes
126
+
127
+ - eba7ce9: Initial release.
128
+
129
+ ### Patch Changes
130
+
131
+ - Updated dependencies [eba7ce9]
132
+ - @accelint/converters@0.1.0
133
+ - @accelint/predicates@0.1.0
@@ -0,0 +1,39 @@
1
+ ---
2
+ apiVersion: backstage.io/v1alpha1
3
+ kind: Component
4
+ metadata:
5
+ name: "@accelint/geo"
6
+ title: Accelint Geo
7
+ description: >-
8
+ A collection of JavaScript functions for working with coordinates and
9
+ geospatial data.
10
+
11
+
12
+ Dependencies:
13
+
14
+ @accelint/math@0.1.5, @accelint/predicates@0.4.0,
15
+ @accelint/constellation-tracker@0.0.0, @accelint/typescript-config@0.1.2,
16
+ @accelint/vitest-config@0.1.3
17
+ annotations:
18
+ backstage.io/edit-url: https://github.com/gohypergiant/standard-toolkit/blob/main/packages/geo/catalog-info.yaml
19
+ backstage.io/techdocs-ref: dir:.
20
+ package/version: 0.2.8
21
+ github.com/project-slug: gohypergiant/standard-toolkit
22
+ links:
23
+ - url: https://github.com/gohypergiant/standard-toolkit/tree/main/packages/geo
24
+ title: Documentation
25
+ icon: docs
26
+ type: documentation
27
+ tags:
28
+ - dev-tk
29
+ - tooling
30
+ spec:
31
+ type: library
32
+ lifecycle: production
33
+ owner: group:default/pathfinder
34
+ dependsOn:
35
+ - component:@accelint/math
36
+ - component:@accelint/predicates
37
+ - component:@accelint/constellation-tracker
38
+ - component:@accelint/typescript-config
39
+ - component:@accelint/vitest-config
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/coordinates/coordinate.ts"],"names":["errors","key"],"mappings":";;;;;;;;AAgFO,MAAM,iBAAA,GAAoB,OAAO,MAAA,CAAO;AAAA,EAC7C,EAAA,EAAI,oBAAA;AAAA,EACJ,GAAA,EAAK,2BAAA;AAAA,EACL,GAAA,EAAK,2BAAA;AAAA,EACL,IAAA,EAAM,UAAA;AAAA,EACN,GAAA,EAAK;AACP,CAAU;AAEV,MAAM,mBAAmB,CACvB,MAAA,EACA,IACA,GAAA,EACA,KAAA,KAEA,OAAO,MAAA,CAAO;AAAA,EACZ,EAAA,EAAI,CAAC,MAAA,KAAoB,EAAA,CAAG,sBAAsB,MAAM,CAAA;AAAA,EACxD,GAAA,EAAK,CAAC,MAAA,KAAoB,EAAA,CAAG,6BAA6B,MAAM,CAAA;AAAA,EAChE,GAAA,EAAK,CAAC,MAAA,KAAoB,EAAA,CAAG,6BAA6B,MAAM,CAAA;AAAA,EAChE,IAAA,EAAM,CAAC,MAAA,KAAoB,EAAA,CAAG,YAAY,MAAM,CAAA;AAAA,EAChD,MAAA;AAAA,EACA,GAAA;AAAA,EACA;AACF,CAA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AACA,MAAA,MAAM,MAAM,MAAA,CAAO,IAAA;AAEnB,MAAA,IAAI,CAAC,YAAA,CAAa,GAAG,CAAA,GAAI,MAAM,CAAA,EAAG;AAIhC,QAAA,YAAA,CAAa,GAAG,CAAA,GAAI;AAAA,UAClB,GAAG,aAAa,GAAG,CAAA;AAAA;AAAA;AAAA,UAGnB,CAAC,MAAM,GAAG,MAAA,CAAO,QAAA;AAAA,YACf,MAAA;AAAA,YACC,CAAC,MAAA,CAAO,KAAA,CAAM,CAAA,EAAG,CAAC,GAAG,MAAA,CAAO,KAAA,CAAM,CAAC,CAAC,CAAA,CAAa,GAAA;AAAA,cAChD,CAACC,IAAAA,KAAQ,GAAA,CAAIA,IAAG;AAAA;AAClB;AACF,SACF;AAAA,MACF;AAEA,MAAA,OAAO,YAAA,CAAa,GAAG,CAAA,CAAE,MAAM,CAAA;AAAA,IACjC;AAEA,IAAA,OAAO,gBAAA,CAAiB,EAAC,EAA2B,EAAA,EAAI,KAAK,IAAI,CAAA;AAAA,EACnE,CAAA;AACF","file":"coordinate.js","sourcesContent":["/*\n * Copyright 2024 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport { systemDecimalDegrees } from './latlon/decimal-degrees/system';\nimport { systemDegreesDecimalMinutes } from './latlon/degrees-decimal-minutes/system';\nimport { systemDegreesMinutesSeconds } from './latlon/degrees-minutes-seconds/system';\nimport {\n type Axes,\n type Errors,\n FORMATS_DEFAULT,\n type Format,\n SYMBOLS,\n} from './latlon/internal';\nimport type { CoordinateSystem } from './latlon/internal/coordinate-system';\nimport {\n type CoordinateCache,\n createCache,\n} from './latlon/internal/create-cache';\nimport type { Tokens } from './latlon/internal/lexer';\nimport { systemMGRS } from './mgrs/system';\nimport { systemUTM } from './utm/system';\n\ntype Coordinate = {\n /** {@interitDoc Formatter} */\n dd: Formatter;\n /** {@interitDoc Formatter} */\n ddm: Formatter;\n /** {@interitDoc Formatter} */\n dms: Formatter;\n /** {@interitDoc Formatter} */\n mgrs: Formatter;\n /** {@interitDoc Formatter} */\n utm: Formatter;\n errors: string[];\n raw: CoordinateInternalValue;\n valid: boolean;\n};\n\n// biome-ignore lint/style/useNamingConvention: consistency with Axes type\ntype CoordinateInternalValue = { LAT: number; LON: number };\n\n/**\n * Output a string value of a coordinate using an available system. The\n * original value is preserved without conversion to an internal\n * representation - Decimal Degrees - to prevent the possibility of\n * rounding errors. All alternative values are computed from a common\n * internal value to reduce complexity.\n *\n * @link https://en.wikipedia.org/wiki/Coordinate_system\n *\n * @remarks\n * pure function\n *\n * @example\n * const create = createCoordinate(coordinateSystems.dd, 'LATLON')\n * const coord = create('89.765432109 / 123.456789012')\n *\n * // honors the instantiation format 'LATLON'\n * coord.dd() === '89.765432109 N / 123.456789012 E'\n * coord.ddm() === '89 45.92592654 N / 123 27.40734072 E'\n * coord.dms() === '89 45 55.5555924 N / 123 27 24.4404432 E'\n *\n * // change format to 'LONLAT'\n * coord.dms('LONLAT') === '123 27 24.4404432 E / 89 45 55.5555924 N'\n */\ntype Formatter = (f?: Format) => string;\n\ntype ToFloatArg = Parameters<CoordinateSystem['toFloat']>[0];\n\ntype OutputCache = Record<keyof typeof coordinateSystems, CoordinateCache>;\n\nexport const coordinateSystems = Object.freeze({\n dd: systemDecimalDegrees,\n ddm: systemDegreesDecimalMinutes,\n dms: systemDegreesMinutesSeconds,\n mgrs: systemMGRS,\n utm: systemUTM,\n} as const);\n\nconst freezeCoordinate = (\n errors: Coordinate['errors'],\n to: (s?: CoordinateSystem, f?: Format) => string,\n raw: CoordinateInternalValue,\n valid: Coordinate['valid'],\n) =>\n Object.freeze({\n dd: (format?: Format) => to(systemDecimalDegrees, format),\n ddm: (format?: Format) => to(systemDegreesDecimalMinutes, format),\n dms: (format?: Format) => to(systemDegreesMinutesSeconds, format),\n mgrs: (format?: Format) => to(systemMGRS, format),\n errors,\n raw,\n valid,\n } as Coordinate);\n\n/**\n * Create a coordinate object enabling: lexing, parsing, validation, and\n * formatting in alternative systems and formats. The system and format will be\n * used for validation and eventually for output as defaults if no alternatives\n * are provided.\n *\n * @param initSystem dd, ddm, dms, mgrs, or utm of coordinateSystems\n *\n * @remarks\n * pure function\n *\n * @example\n * const create = createCoordinate(coordinateSystems.dd, 'LATLON')\n * const create = createCoordinate(coordinateSystems.ddm, 'LONLAT')\n */\nexport function createCoordinate(\n initSystem: CoordinateSystem = coordinateSystems.dd,\n initFormat: Format = FORMATS_DEFAULT,\n) {\n return (input: string) => {\n let tokens: Tokens;\n let errors: Errors;\n\n try {\n [tokens, errors] = initSystem.parse(initFormat, input);\n\n if (errors.length) {\n throw errors;\n }\n } catch (errors) {\n return freezeCoordinate(\n errors as Coordinate['errors'],\n () => '',\n {} as CoordinateInternalValue,\n false,\n );\n }\n\n // start with the original value for the original system in the original format\n // other values will be computed as needed and cached per request\n const cachedValues = {\n [initSystem.name]: createCache(\n initFormat,\n // because mgrs doesn't have two formats: LATLON v LONLAT\n initSystem.name === systemMGRS.name ? input : tokens.join(' '),\n ),\n } as OutputCache;\n\n // Create the \"internal\" representation - Decimal Degrees - for\n // consistency and ease of computation; all systems expect to\n // start from a common starting point to reduce complexity.\n const raw = Object.fromEntries([\n [\n initFormat.slice(0, 3),\n initSystem.toFloat(\n tokens.slice(0, tokens.indexOf(SYMBOLS.DIVIDER)) as ToFloatArg,\n ),\n ],\n [\n initFormat.slice(3),\n initSystem.toFloat(\n tokens.slice(1 + tokens.indexOf(SYMBOLS.DIVIDER)) as ToFloatArg,\n ),\n ],\n ]) as CoordinateInternalValue;\n\n function to(\n system: CoordinateSystem = initSystem,\n format: Format = initFormat,\n ) {\n const key = system.name as keyof typeof coordinateSystems;\n\n if (!cachedValues[key]?.[format]) {\n // cache \"miss\" - fill the missing value in the cache before returning it\n\n // update the cache to include the newly computed value\n cachedValues[key] = {\n ...cachedValues[key],\n // use the Format to build the object, correctly pairing the halves of\n // the coordinate value with their labels\n [format]: system.toFormat(\n format,\n ([format.slice(0, 3), format.slice(3)] as Axes[]).map(\n (key) => raw[key],\n ) as [number, number],\n ),\n };\n }\n\n return cachedValues[key][format];\n }\n\n return freezeCoordinate([] as Coordinate['errors'], to, raw, true);\n };\n}\n"]}
1
+ {"version":3,"sources":["../../src/coordinates/coordinate.ts"],"names":["errors","key"],"mappings":";;;;;;;;AAgFO,MAAM,iBAAA,GAAoB,OAAO,MAAA,CAAO;AAAA,EAC7C,EAAA,EAAI,oBAAA;AAAA,EACJ,GAAA,EAAK,2BAAA;AAAA,EACL,GAAA,EAAK,2BAAA;AAAA,EACL,IAAA,EAAM,UAAA;AAAA,EACN,GAAA,EAAK;AACP,CAAU;AAEV,MAAM,mBAAmB,CACvB,MAAA,EACA,IACA,GAAA,EACA,KAAA,KAEA,OAAO,MAAA,CAAO;AAAA,EACZ,EAAA,EAAI,CAAC,MAAA,KAAoB,EAAA,CAAG,sBAAsB,MAAM,CAAA;AAAA,EACxD,GAAA,EAAK,CAAC,MAAA,KAAoB,EAAA,CAAG,6BAA6B,MAAM,CAAA;AAAA,EAChE,GAAA,EAAK,CAAC,MAAA,KAAoB,EAAA,CAAG,6BAA6B,MAAM,CAAA;AAAA,EAChE,IAAA,EAAM,CAAC,MAAA,KAAoB,EAAA,CAAG,YAAY,MAAM,CAAA;AAAA,EAChD,MAAA;AAAA,EACA,GAAA;AAAA,EACA;AACF,CAAe,CAAA;AAiBV,SAAS,gBAAA,CACd,UAAA,GAA+B,iBAAA,CAAkB,EAAA,EACjD,aAAqB,eAAA,EACrB;AACA,EAAA,OAAO,CAAC,KAAA,KAAkB;AACxB,IAAA,IAAI,MAAA;AACJ,IAAA,IAAI,MAA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,aAAa,GAAG,CAAA;AAAA;AAAA;AAAA,UAGnB,CAAC,MAAM,GAAG,MAAA,CAAO,QAAA;AAAA,YACf,MAAA;AAAA,YACC,CAAC,MAAA,CAAO,KAAA,CAAM,CAAA,EAAG,CAAC,GAAG,MAAA,CAAO,KAAA,CAAM,CAAC,CAAC,CAAA,CAAa,GAAA;AAAA,cAChD,CAACC,IAAAA,KAAQ,GAAA,CAAIA,IAAG;AAAA;AAClB;AACF,SACF;AAAA,MACF;AAEA,MAAA,OAAO,YAAA,CAAa,GAAG,CAAA,CAAE,MAAM,CAAA;AAAA,IACjC;AAEA,IAAA,OAAO,gBAAA,CAAiB,EAAC,EAA2B,EAAA,EAAI,KAAK,IAAI,CAAA;AAAA,EACnE,CAAA;AACF","file":"coordinate.js","sourcesContent":["/*\n * Copyright 2024 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport { systemDecimalDegrees } from './latlon/decimal-degrees/system';\nimport { systemDegreesDecimalMinutes } from './latlon/degrees-decimal-minutes/system';\nimport { systemDegreesMinutesSeconds } from './latlon/degrees-minutes-seconds/system';\nimport {\n type Axes,\n type Errors,\n FORMATS_DEFAULT,\n type Format,\n SYMBOLS,\n} from './latlon/internal';\nimport {\n type CoordinateCache,\n createCache,\n} from './latlon/internal/create-cache';\nimport { systemMGRS } from './mgrs/system';\nimport { systemUTM } from './utm/system';\nimport type { CoordinateSystem } from './latlon/internal/coordinate-system';\nimport type { Tokens } from './latlon/internal/lexer';\n\ntype Coordinate = {\n /** {@interitDoc Formatter} */\n dd: Formatter;\n /** {@interitDoc Formatter} */\n ddm: Formatter;\n /** {@interitDoc Formatter} */\n dms: Formatter;\n /** {@interitDoc Formatter} */\n mgrs: Formatter;\n /** {@interitDoc Formatter} */\n utm: Formatter;\n errors: string[];\n raw: CoordinateInternalValue;\n valid: boolean;\n};\n\n// biome-ignore lint/style/useNamingConvention: consistency with Axes type\ntype CoordinateInternalValue = { LAT: number; LON: number };\n\n/**\n * Output a string value of a coordinate using an available system. The\n * original value is preserved without conversion to an internal\n * representation - Decimal Degrees - to prevent the possibility of\n * rounding errors. All alternative values are computed from a common\n * internal value to reduce complexity.\n *\n * @link https://en.wikipedia.org/wiki/Coordinate_system\n *\n * @remarks\n * pure function\n *\n * @example\n * const create = createCoordinate(coordinateSystems.dd, 'LATLON')\n * const coord = create('89.765432109 / 123.456789012')\n *\n * // honors the instantiation format 'LATLON'\n * coord.dd() === '89.765432109 N / 123.456789012 E'\n * coord.ddm() === '89 45.92592654 N / 123 27.40734072 E'\n * coord.dms() === '89 45 55.5555924 N / 123 27 24.4404432 E'\n *\n * // change format to 'LONLAT'\n * coord.dms('LONLAT') === '123 27 24.4404432 E / 89 45 55.5555924 N'\n */\ntype Formatter = (f?: Format) => string;\n\ntype ToFloatArg = Parameters<CoordinateSystem['toFloat']>[0];\n\ntype OutputCache = Record<keyof typeof coordinateSystems, CoordinateCache>;\n\nexport const coordinateSystems = Object.freeze({\n dd: systemDecimalDegrees,\n ddm: systemDegreesDecimalMinutes,\n dms: systemDegreesMinutesSeconds,\n mgrs: systemMGRS,\n utm: systemUTM,\n} as const);\n\nconst freezeCoordinate = (\n errors: Coordinate['errors'],\n to: (s?: CoordinateSystem, f?: Format) => string,\n raw: CoordinateInternalValue,\n valid: Coordinate['valid'],\n) =>\n Object.freeze({\n dd: (format?: Format) => to(systemDecimalDegrees, format),\n ddm: (format?: Format) => to(systemDegreesDecimalMinutes, format),\n dms: (format?: Format) => to(systemDegreesMinutesSeconds, format),\n mgrs: (format?: Format) => to(systemMGRS, format),\n errors,\n raw,\n valid,\n } as Coordinate);\n\n/**\n * Create a coordinate object enabling: lexing, parsing, validation, and\n * formatting in alternative systems and formats. The system and format will be\n * used for validation and eventually for output as defaults if no alternatives\n * are provided.\n *\n * @param initSystem dd, ddm, dms, mgrs, or utm of coordinateSystems\n *\n * @remarks\n * pure function\n *\n * @example\n * const create = createCoordinate(coordinateSystems.dd, 'LATLON')\n * const create = createCoordinate(coordinateSystems.ddm, 'LONLAT')\n */\nexport function createCoordinate(\n initSystem: CoordinateSystem = coordinateSystems.dd,\n initFormat: Format = FORMATS_DEFAULT,\n) {\n return (input: string) => {\n let tokens: Tokens;\n let errors: Errors;\n\n try {\n [tokens, errors] = initSystem.parse(initFormat, input);\n\n if (errors.length) {\n throw errors;\n }\n } catch (errors) {\n return freezeCoordinate(\n errors as Coordinate['errors'],\n () => '',\n {} as CoordinateInternalValue,\n false,\n );\n }\n\n // start with the original value for the original system in the original format\n // other values will be computed as needed and cached per request\n const cachedValues = {\n [initSystem.name]: createCache(\n initFormat,\n // because mgrs doesn't have two formats: LATLON v LONLAT\n initSystem.name === systemMGRS.name ? input : tokens.join(' '),\n ),\n } as OutputCache;\n\n // Create the \"internal\" representation - Decimal Degrees - for\n // consistency and ease of computation; all systems expect to\n // start from a common starting point to reduce complexity.\n const raw = Object.fromEntries([\n [\n initFormat.slice(0, 3),\n initSystem.toFloat(\n tokens.slice(0, tokens.indexOf(SYMBOLS.DIVIDER)) as ToFloatArg,\n ),\n ],\n [\n initFormat.slice(3),\n initSystem.toFloat(\n tokens.slice(1 + tokens.indexOf(SYMBOLS.DIVIDER)) as ToFloatArg,\n ),\n ],\n ]) as CoordinateInternalValue;\n\n function to(\n system: CoordinateSystem = initSystem,\n format: Format = initFormat,\n ) {\n const key = system.name as keyof typeof coordinateSystems;\n\n if (!cachedValues[key]?.[format]) {\n // cache \"miss\" - fill the missing value in the cache before returning it\n\n // update the cache to include the newly computed value\n cachedValues[key] = {\n ...cachedValues[key],\n // use the Format to build the object, correctly pairing the halves of\n // the coordinate value with their labels\n [format]: system.toFormat(\n format,\n ([format.slice(0, 3), format.slice(3)] as Axes[]).map(\n (key) => raw[key],\n ) as [number, number],\n ),\n };\n }\n\n return cachedValues[key][format];\n }\n\n return freezeCoordinate([] as Coordinate['errors'], to, raw, true);\n };\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/coordinates/latlon/decimal-degrees/parser.ts"],"names":[],"mappings":";;;;AA8BA,MAAM,MAAA,GAAS;AAAA,EACb,GAAA,EAAK,CAAC,GAAA,EAAa,KAAA,KAAkB;AACnC,IAAA,IAAI,MAAA,CAAO,UAAA,CAAW,GAAG,CAAA,GAAI,KAAA,EAAO;AAClC,MAAA,OAAO,CAAA,eAAA,EAAkB,GAAG,CAAA,qBAAA,EAAwB,KAAK,CAAA,EAAA,CAAA;AAAA,IAC3D;AAAA,EACF,CAAA;AAAA,EACA,GAAA,EAAK,CAAC,GAAA,KAAgB;AACpB,IAAA,IAAI,GAAA,CAAI,QAAA,CAAS,OAAA,CAAQ,OAAO,CAAA,EAAG;AACjC,MAAA,OAAO,CAAA,mBAAA,EAAsB,QAAQ,OAAO,CAAA,+BAAA,CAAA;AAAA,IAC9C;AAAA,EACF,CAAA;AAAA,EACA,GAAA,EAAK,CAAC,GAAA,KAAgB;AACpB,IAAA,IAAI,GAAA,CAAI,QAAA,CAAS,OAAA,CAAQ,OAAO,CAAA,EAAG;AACjC,MAAA,OAAO,CAAA,mBAAA,EAAsB,QAAQ,OAAO,CAAA,+BAAA,CAAA;AAAA,IAC9C;AAAA,EACF;AACF,CAAA;AAEA,MAAM,OAAA,GAAU;AAAA,EACd,QAAQ,UAAA,CAAW,YAAA;AAAA,IACjB,gBAAA;AAAA,IACA,CAAA,aAAA,EAAgB,QAAQ,OAAO,CAAA,aAAA;AAAA,GACjC;AAAA,EACA,QAAQ,UAAA,CAAW,YAAA;AAAA,IACjB,gBAAA;AAAA,IACA,CAAA,aAAA,EAAgB,QAAQ,OAAO,CAAA,aAAA;AAAA;A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A;AAAA,EACzD,CAAA;AACF;AAEA,SAAS,eAAe,IAAA,EAAgB;AACtC,EAAA,IAAI,IAAA,CAAK,MAAA,GAAS,CAAA,IAAK,IAAA,CAAK,SAAS,CAAA,EAAG;AACtC,IAAA;AAAA,EACF;AAEA,EAAA,MAAM,MAAA,GAAS,EAAE,IAAA,EAAM,EAAA,EAAI,KAAK,EAAA,EAAG;AAEnC,EAAA,OAAO,IAAA,CAAK,MAAA,CAAO,CAAC,GAAA,EAAK,KAAA,KAAU;AACjC,IAAA,IAAI,gBAAgB,IAAA,CAAK,IAAA,CAAK,KAAK,CAAA,IAAK,CAAC,IAAI,IAAA,EAAM;AACjD,MAAA,GAAA,CAAI,IAAA,KAAS,KAAA;AAAA,IACf,CAAA,MAAO;AACL,MAAA,GAAA,CAAI,GAAA,KAAQ,KAAA;AAAA,IACd;AAEA,IAAA,OAAO,GAAA;AAAA,EACT,GAAG,MAAM,CAAA;AACX;AAGO,MAAM,sBAAsB,YAAA,CAA6B;AAAA,EAC9D,OAAA;AAAA,EACA,cAAA;AAAA,EACA;AACF,CAAC","file":"parser.js","sourcesContent":["/*\n * Copyright 2024 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport * as Patterning from '@/patterning';\n\nimport {\n BEARINGS,\n type Format,\n LIMITS,\n PARTIAL_PATTERNS,\n SYMBOLS,\n SYMBOL_PATTERNS,\n} from '../internal';\nimport type { ParseResults } from '../internal/parse';\nimport { createParser } from '../internal/parse-format';\n\ntype DecimalDegrees = {\n bear: string;\n deg: string;\n};\n\nconst checks = {\n deg: (deg: string, limit: number) => {\n if (Number.parseFloat(deg) > limit) {\n return `Degrees value (${deg}) exceeds max value (${limit}).`;\n }\n },\n min: (val: string) => {\n if (val.includes(SYMBOLS.MINUTES)) {\n return `Seconds indicator (${SYMBOLS.MINUTES}) not valid in Decimal Degrees.`;\n }\n },\n sec: (val: string) => {\n if (val.includes(SYMBOLS.SECONDS)) {\n return `Seconds indicator (${SYMBOLS.SECONDS}) not valid in Decimal Degrees.`;\n }\n },\n};\n\nconst formats = {\n LATLON: Patterning.fromTemplate(\n PARTIAL_PATTERNS,\n `degLatDec NS ${SYMBOLS.DIVIDER} degLonDec EW`,\n ),\n LONLAT: Patterning.fromTemplate(\n PARTIAL_PATTERNS,\n `degLonDec EW ${SYMBOLS.DIVIDER} degLatDec NS`,\n ),\n};\n\nfunction identifyErrors(format: Format) {\n return (arg: DecimalDegrees | undefined, i: number) => {\n if (!arg) {\n return [[], ['Invalid coordinate value.']] as ParseResults;\n }\n\n let { bear, deg } = arg;\n\n deg ??= '0';\n\n let isNegative: 0 | 1 = SYMBOL_PATTERNS.NEGATIVE_SIGN.test(deg) ? 1 : 0;\n const bearingOptions = BEARINGS[format][i] as [string, string];\n\n if (!bear || isNegative) {\n bear = bearingOptions[isNegative];\n deg = Math.abs(Number.parseFloat(deg)).toString();\n isNegative = 0;\n }\n\n const errors = [\n ...[checks.deg(deg, LIMITS[format][i] ?? 0)],\n ...[checks.min([bear, deg].join(''))],\n ...[checks.sec([bear, deg].join(''))],\n ].filter(Boolean);\n\n return (errors.length ? [[], errors] : [[deg, bear], []]) as ParseResults;\n };\n}\n\nfunction identifyPieces(half: string[]) {\n if (half.length > 2 || half.length < 1) {\n return;\n }\n\n const places = { bear: '', deg: '' };\n\n return half.reduce((acc, token) => {\n if (SYMBOL_PATTERNS.NSEW.test(token) && !acc.bear) {\n acc.bear ||= token;\n } else {\n acc.deg ||= token;\n }\n\n return acc;\n }, places);\n}\n\n/** Parse a Decimal Degrees coordinate. */\nexport const parseDecimalDegrees = createParser<DecimalDegrees>({\n formats,\n identifyErrors,\n identifyPieces,\n});\n"]}
1
+ {"version":3,"sources":["../../../../src/coordinates/latlon/decimal-degrees/parser.ts"],"names":[],"mappings":";;;;AA6BA,MAAM,MAAA,GAAS;AAAA,EACb,GAAA,EAAK,CAAC,GAAA,EAAa,KAAA,KAAkB;AACnC,IAAA,IAAI,MAAA,CAAO,UAAA,CAAW,GAAG,CAAA,GAAI,KAAA,EAAO;AAClC,MAAA,OAAO,CAAA,eAAA,EAAkB,GAAG,CAAA,qBAAA,EAAwB,KAAK,CAAA,EAAA,CAAA;AAAA,IAC3D;AAAA,EACF,CAAA;AAAA,EACA,GAAA,EAAK,CAAC,GAAA,KAAgB;AACpB,IAAA,IAAI,GAAA,CAAI,QAAA,CAAS,OAAA,CAAQ,OAAO,CAAA,EAAG;AACjC,MAAA,OAAO,CAAA,mBAAA,EAAsB,QAAQ,OAAO,CAAA,+BAAA,CAAA;AAAA,IAC9C;AAAA,EACF,CAAA;AAAA,EACA,GAAA,EAAK,CAAC,GAAA,KAAgB;AACpB,IAAA,IAAI,GAAA,CAAI,QAAA,CAAS,OAAA,CAAQ,OAAO,CAAA,EAAG;AACjC,MAAA,OAAO,CAAA,mBAAA,EAAsB,QAAQ,OAAO,CAAA,+BAAA,CAAA;AAAA,IAC9C;AAAA,EACF;AACF,CAAA;AAEA,MAAM,OAAA,GAAU;AAAA,EACd,QAAQ,UAAA,CAAW,YAAA;AAAA,IACjB,gBAAA;AAAA,IACA,CAAA,aAAA,EAAgB,QAAQ,OAAO,CAAA,aAAA;AAAA,GACjC;AAAA,EACA,QAAQ,UAAA,CAAW,YAAA;AAAA,IACjB,gBAAA;AAAA,IACA,CAAA,aAAA,EAAgB,QAAQ,OAAO,CAAA,aAAA;AAAA;AAEnC,CAAA;AAEA,SAAS,eAAe,MAAA,EAAgB;AACtC,EAAA,OAAO,CAAC,KAAiC,CAAA,KAAc;AACrD,IAAA,IAAI,CAAC,GAAA,EAAK;AACR,MAAA,OAAO,CA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ACtC,IAAA;AAAA,EACF;AAEA,EAAA,MAAM,MAAA,GAAS,EAAE,IAAA,EAAM,EAAA,EAAI,KAAK,EAAA,EAAG;AAEnC,EAAA,OAAO,IAAA,CAAK,MAAA,CAAO,CAAC,GAAA,EAAK,KAAA,KAAU;AACjC,IAAA,IAAI,gBAAgB,IAAA,CAAK,IAAA,CAAK,KAAK,CAAA,IAAK,CAAC,IAAI,IAAA,EAAM;AACjD,MAAA,GAAA,CAAI,IAAA,KAAS,KAAA;AAAA,IACf,CAAA,MAAO;AACL,MAAA,GAAA,CAAI,GAAA,KAAQ,KAAA;AAAA,IACd;AAEA,IAAA,OAAO,GAAA;AAAA,EACT,GAAG,MAAM,CAAA;AACX;AAGO,MAAM,sBAAsB,YAAA,CAA6B;AAAA,EAC9D,OAAA;AAAA,EACA,cAAA;AAAA,EACA;AACF,CAAC","file":"parser.js","sourcesContent":["/*\n * Copyright 2024 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport * as Patterning from '@/patterning';\nimport {\n BEARINGS,\n type Format,\n LIMITS,\n PARTIAL_PATTERNS,\n SYMBOL_PATTERNS,\n SYMBOLS,\n} from '../internal';\nimport { createParser } from '../internal/parse-format';\nimport type { ParseResults } from '../internal/parse';\n\ntype DecimalDegrees = {\n bear: string;\n deg: string;\n};\n\nconst checks = {\n deg: (deg: string, limit: number) => {\n if (Number.parseFloat(deg) > limit) {\n return `Degrees value (${deg}) exceeds max value (${limit}).`;\n }\n },\n min: (val: string) => {\n if (val.includes(SYMBOLS.MINUTES)) {\n return `Seconds indicator (${SYMBOLS.MINUTES}) not valid in Decimal Degrees.`;\n }\n },\n sec: (val: string) => {\n if (val.includes(SYMBOLS.SECONDS)) {\n return `Seconds indicator (${SYMBOLS.SECONDS}) not valid in Decimal Degrees.`;\n }\n },\n};\n\nconst formats = {\n LATLON: Patterning.fromTemplate(\n PARTIAL_PATTERNS,\n `degLatDec NS ${SYMBOLS.DIVIDER} degLonDec EW`,\n ),\n LONLAT: Patterning.fromTemplate(\n PARTIAL_PATTERNS,\n `degLonDec EW ${SYMBOLS.DIVIDER} degLatDec NS`,\n ),\n};\n\nfunction identifyErrors(format: Format) {\n return (arg: DecimalDegrees | undefined, i: number) => {\n if (!arg) {\n return [[], ['Invalid coordinate value.']] as ParseResults;\n }\n\n let { bear, deg } = arg;\n\n deg ??= '0';\n\n let isNegative: 0 | 1 = SYMBOL_PATTERNS.NEGATIVE_SIGN.test(deg) ? 1 : 0;\n const bearingOptions = BEARINGS[format][i] as [string, string];\n\n if (!bear || isNegative) {\n bear = bearingOptions[isNegative];\n deg = Math.abs(Number.parseFloat(deg)).toString();\n isNegative = 0;\n }\n\n const errors = [\n ...[checks.deg(deg, LIMITS[format][i] ?? 0)],\n ...[checks.min([bear, deg].join(''))],\n ...[checks.sec([bear, deg].join(''))],\n ].filter(Boolean);\n\n return (errors.length ? [[], errors] : [[deg, bear], []]) as ParseResults;\n };\n}\n\nfunction identifyPieces(half: string[]) {\n if (half.length > 2 || half.length < 1) {\n return;\n }\n\n const places = { bear: '', deg: '' };\n\n return half.reduce((acc, token) => {\n if (SYMBOL_PATTERNS.NSEW.test(token) && !acc.bear) {\n acc.bear ||= token;\n } else {\n acc.deg ||= token;\n }\n\n return acc;\n }, places);\n}\n\n/** Parse a Decimal Degrees coordinate. */\nexport const parseDecimalDegrees = createParser<DecimalDegrees>({\n formats,\n identifyErrors,\n identifyPieces,\n});\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/coordinates/latlon/decimal-degrees/system.ts"],"names":[],"mappings":";;;AAwBO,MAAM,oBAAA,GAAyC;AAAA,EACpD,IAAA,EAAM,iBAAA;AAAA,EAEN,KAAA,EAAO,mBAAA;AAAA,EAEP,QAAQ,GAAA,EAAK;AACX,IAAA,MAAM,CAAC,GAAA,EAAK,IAAI,CAAA,GAAI,GAAA;AAEpB,IAAA,OACE,MAAA,CAAO,WAAW,GAAG,CAAA,IACpB,gBAAgB,iBAAA,CAAkB,IAAA,CAAK,IAAI,CAAA,GAAI,EAAA,GAAK,CAAA,CAAA;AAAA,EAEzD,CAAA;AAAA,EAEA,QAAA,CAAS,MAAA,EAAgB,CAAC,IAAA,EAAM,KAAK,CAAA,EAAqB;AACxD,IAAA,OAAO,CAAC,IAAA,EAAM,KAAK,CAAA,CAChB,GAAA;AAAA,MACC,CAAC,GAAA,EAAK,KAAA,KACJ,CAAA,EAAG,IAAA,CAAK,IAAI,GAAG,CAAC,CAAA,CAAA,EAAI,QAAA,CAAS,MAAM,CAAA,CAAE,KAAc,EAAE,EAAE,GAAA,GAAM,EAAE,CAAC,CAAA;AAAA,KACpE,CACC,IAAA,CAAK,CAAA,CAAA,EAAI,OAAA,CAAQ,OAAO,CAAA,CAAA,CAAG,CAAA;AAAA,EAChC;AACF","file":"system.js","sourcesContent":["// __private-exports\n/*\n * Copyright 2024 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {\n BEARINGS,\n type Compass,\n type Format,\n SYMBOLS,\n SYMBOL_PATTERNS,\n} from '../internal';\nimport type { CoordinateSystem } from '../internal/coordinate-system';\n\nimport { parseDecimalDegrees } from './parser';\n\nexport const systemDecimalDegrees: CoordinateSystem = {\n name: 'Decimal Degrees',\n\n parse: parseDecimalDegrees,\n\n toFloat(arg) {\n const [num, bear] = arg as [string, Compass];\n\n return (\n Number.parseFloat(num) *\n (SYMBOL_PATTERNS.NEGATIVE_BEARINGS.test(bear) ? -1 : 1)\n );\n },\n\n toFormat(format: Format, [left, right]: [number, number]) {\n return [left, right]\n .map(\n (num, index) =>\n `${Math.abs(num)} ${BEARINGS[format][index as 0 | 1][+(num < 0)]}`,\n )\n .join(` ${SYMBOLS.DIVIDER} `);\n },\n};\n"]}
1
+ {"version":3,"sources":["../../../../src/coordinates/latlon/decimal-degrees/system.ts"],"names":[],"mappings":";;;AAuBO,MAAM,oBAAA,GAAyC;AAAA,EACpD,IAAA,EAAM,iBAAA;AAAA,EAEN,KAAA,EAAO,mBAAA;AAAA,EAEP,QAAQ,GAAA,EAAK;AACX,IAAA,MAAM,CAAC,GAAA,EAAK,IAAI,CAAA,GAAI,GAAA;AAEpB,IAAA,OACE,MAAA,CAAO,WAAW,GAAG,CAAA,IACpB,gBAAgB,iBAAA,CAAkB,IAAA,CAAK,IAAI,CAAA,GAAI,EAAA,GAAK,CAAA,CAAA;AAAA,EAEzD,CAAA;AAAA,EAEA,QAAA,CAAS,MAAA,EAAgB,CAAC,IAAA,EAAM,KAAK,CAAA,EAAqB;AACxD,IAAA,OAAO,CAAC,IAAA,EAAM,KAAK,CAAA,CAChB,GAAA;AAAA,MACC,CAAC,GAAA,EAAK,KAAA,KACJ,CAAA,EAAG,IAAA,CAAK,IAAI,GAAG,CAAC,CAAA,CAAA,EAAI,QAAA,CAAS,MAAM,CAAA,CAAE,KAAc,EAAE,EAAE,GAAA,GAAM,EAAE,CAAC,CAAA;AAAA,KACpE,CACC,IAAA,CAAK,CAAA,CAAA,EAAI,OAAA,CAAQ,OAAO,CAAA,CAAA,CAAG,CAAA;AAAA,EAChC;AACF","file":"system.js","sourcesContent":["// __private-exports\n/*\n * Copyright 2024 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {\n BEARINGS,\n type Compass,\n type Format,\n SYMBOL_PATTERNS,\n SYMBOLS,\n} from '../internal';\nimport { parseDecimalDegrees } from './parser';\nimport type { CoordinateSystem } from '../internal/coordinate-system';\n\nexport const systemDecimalDegrees: CoordinateSystem = {\n name: 'Decimal Degrees',\n\n parse: parseDecimalDegrees,\n\n toFloat(arg) {\n const [num, bear] = arg as [string, Compass];\n\n return (\n Number.parseFloat(num) *\n (SYMBOL_PATTERNS.NEGATIVE_BEARINGS.test(bear) ? -1 : 1)\n );\n },\n\n toFormat(format: Format, [left, right]: [number, number]) {\n return [left, right]\n .map(\n (num, index) =>\n `${Math.abs(num)} ${BEARINGS[format][index as 0 | 1][+(num < 0)]}`,\n )\n .join(` ${SYMBOLS.DIVIDER} `);\n },\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/coordinates/latlon/degrees-decimal-minutes/parser.ts"],"names":[],"mappings":";;;;;AAgCA,MAAM,MAAA,GAAS;AAAA,EACb,GAAA,EAAK,CAAC,GAAA,EAAa,KAAA,KAAkB;AACnC,IAAA,IAAI,MAAA,CAAO,UAAA,CAAW,GAAG,CAAA,GAAI,KAAA,EAAO;AAClC,MAAA,OAAO,CAAA,eAAA,EAAkB,GAAG,CAAA,qBAAA,EAAwB,KAAK,CAAA,EAAA,CAAA;AAAA,IAC3D;AAEA,IAAA,IAAI,IAAA,CAAK,IAAA,CAAK,GAAG,CAAA,EAAG;AAClB,MAAA,OAAO,kBAAkB,GAAG,CAAA,iCAAA,CAAA;AAAA,IAC9B;AAAA,EACF,CAAA;AAAA,EACA,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AAA,CAAgB,IAAA,EAAM,MAAM,MAAA,GAAS,CAAA,EAAG,KAAK,CAAA,EAAG;AACvD,MAAA,GAAA,CAAI,IAAA,KAAS,KAAA;AAAA,IACf,WAAW,IAAA,CAAK,eAAA,CAAgB,SAAS,CAAA,KAAM,CAAA,EAAG,KAAK,CAAA,EAAG;AACxD,MAAA,GAAA,CAAI,GAAA,KAAQ,KAAA;AAAA,IACd,WAAW,IAAA,CAAK,eAAA,CAAgB,SAAS,CAAA,KAAM,CAAA,EAAG,KAAK,CAAA,EAAG;AACxD,MAAA,GAAA,CAAI,GAAA,KAAQ,KAAA;AAAA,IACd,CAAA,MAAO;AACL,MAAA,MAAM,GAAA,GAAM,KAAK,IAAA,CAAK,CAAC,MAAM,CAAC,GAAA,CAAI,CAAC,CAAC,CAAA;AAEpC,MAAA,GAAA,CAAI,GAAuB,CAAA,GAAI,KAAA;AAAA,IACjC;AAEA,IAAA,OAAO,GAAA;AAAA,EACT,GAAG,MAAM,CAAA;AACX;AAGO,MAAM,6BAA6B,YAAA,CAAoC;AAAA,EAC5E,OAAA;AAAA,EACA,cAAA;AAAA,EACA;AACF,CAAC","file":"parser.js","sourcesContent":["/*\n * Copyright 2024 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport * as Patterning from '@/patterning';\n\nimport {\n BEARINGS,\n type Format,\n LIMITS,\n PARTIAL_PATTERNS,\n SYMBOLS,\n SYMBOL_PATTERNS,\n} from '../internal';\nimport { inRange } from '../internal/in-range';\nimport type { ParseResults } from '../internal/parse';\nimport { createParser } from '../internal/parse-format';\n\ntype DegreesDecimalMinutes = {\n bear: string;\n deg: string;\n min: string;\n};\n\nconst checks = {\n deg: (deg: string, limit: number) => {\n if (Number.parseFloat(deg) > limit) {\n return `Degrees value (${deg}) exceeds max value (${limit}).`;\n }\n\n if (/\\./.test(deg)) {\n return `Degrees value (${deg}) must not include decimal value.`;\n }\n },\n min: (min: string) => inRange('Minutes', min, 59.999999999),\n sec: (val: string) => {\n if (val.includes(SYMBOLS.SECONDS)) {\n return `Seconds indicator (${SYMBOLS.SECONDS}) not valid in Degree Decimal Minutes.`;\n }\n },\n};\n\nconst formats = {\n LATLON: Patterning.fromTemplate(\n PARTIAL_PATTERNS,\n `degLat minDec NS ${SYMBOLS.DIVIDER} degLon minDec EW`,\n ),\n LONLAT: Patterning.fromTemplate(\n PARTIAL_PATTERNS,\n `degLon minDec EW ${SYMBOLS.DIVIDER} degLat minDec NS`,\n ),\n};\n\nfunction identifyErrors(format: Format) {\n return (arg: DegreesDecimalMinutes | undefined, i: number) => {\n if (!arg) {\n return [[], ['Invalid coordinate value.']] as ParseResults;\n }\n\n let { bear, deg, min } = arg;\n\n deg ??= '0';\n min ??= '0';\n\n let isNegative: 0 | 1 = SYMBOL_PATTERNS.NEGATIVE_SIGN.test(deg) ? 1 : 0;\n const bearingOptions = BEARINGS[format][i] as [string, string];\n\n if (!bear || isNegative) {\n bear = bearingOptions[isNegative];\n deg = Math.abs(Number.parseFloat(deg)).toString();\n isNegative = 0;\n }\n\n const errors = [\n ...[checks.deg(deg, LIMITS[format][i] ?? 0)],\n ...[checks.min(min)],\n ...[checks.sec([bear, deg, min].join(''))],\n ].filter(Boolean);\n\n return (\n errors.length ? [[], errors] : [[deg, min, bear], []]\n ) as ParseResults;\n };\n}\n\nfunction identifyPieces(half: string[]) {\n if (half.length < 1 || half.length > 3) {\n return;\n }\n\n const asString = half.join(' ');\n const places = { bear: '', deg: '', min: '' };\n const keys = ['deg', 'min'] as (keyof typeof places)[];\n const test = (r: RegExp, b: boolean, v: string) =>\n r.test(v) || (r.test(asString) && b);\n\n return half.reduce((acc, token, i, { length }) => {\n if (test(SYMBOL_PATTERNS.NSEW, i === length - 1, token)) {\n acc.bear ||= token;\n } else if (test(SYMBOL_PATTERNS.DEGREES, i === 0, token)) {\n acc.deg ||= token;\n } else if (test(SYMBOL_PATTERNS.MINUTES, i === 1, token)) {\n acc.min ||= token;\n } else {\n const key = keys.find((k) => !acc[k]);\n\n acc[key as keyof typeof acc] = token;\n }\n\n return acc;\n }, places);\n}\n\n/** Parse a Degrees Decimal Minutes coordinate. */\nexport const parseDegreesDecimalMinutes = createParser<DegreesDecimalMinutes>({\n formats,\n identifyErrors,\n identifyPieces,\n});\n"]}
1
+ {"version":3,"sources":["../../../../src/coordinates/latlon/degrees-decimal-minutes/parser.ts"],"names":[],"mappings":";;;;;AA+BA,MAAM,MAAA,GAAS;AAAA,EACb,GAAA,EAAK,CAAC,GAAA,EAAa,KAAA,KAAkB;AACnC,IAAA,IAAI,MAAA,CAAO,UAAA,CAAW,GAAG,CAAA,GAAI,KAAA,EAAO;AAClC,MAAA,OAAO,CAAA,eAAA,EAAkB,GAAG,CAAA,qBAAA,EAAwB,KAAK,CAAA,EAAA,CAAA;AAAA,IAC3D;AAEA,IAAA,IAAI,IAAA,CAAK,IAAA,CAAK,GAAG,CAAA,EAAG;AAClB,MAAA,OAAO,kBAAkB,GAAG,CAAA,iCAAA,CAAA;AAAA,IAC9B;AAAA,EACF,CAAA;AAAA,EACA,KAAK,CAAC,GAAA,KAAgB,OAAA,CAAQ,SAAA,EAAW,KAAK,YAAY,CAAA;AAAA,EAC1D,GAAA,EAAK,CAAC,GAAA,KAAgB;AACpB,IAAA,IAAI,GAAA,CAAI,QAAA,CAAS,OAAA,CAAQ,OAAO,CAAA,EAAG;AACjC,MAAA,OAAO,CAAA,mBAAA,EAAsB,QAAQ,OAAO,CAAA,sCAAA,CAAA;AAAA,IAC9C;AAAA,EACF;AACF,CAAA;AAEA,MAAM,OAAA,GAAU;AAAA,EACd,QAAQ,U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G;AACxD,MAAA,GAAA,CAAI,GAAA,KAAQ,KAAA;AAAA,IACd,CAAA,MAAO;AACL,MAAA,MAAM,GAAA,GAAM,KAAK,IAAA,CAAK,CAAC,MAAM,CAAC,GAAA,CAAI,CAAC,CAAC,CAAA;AAEpC,MAAA,GAAA,CAAI,GAAuB,CAAA,GAAI,KAAA;AAAA,IACjC;AAEA,IAAA,OAAO,GAAA;AAAA,EACT,GAAG,MAAM,CAAA;AACX;AAGO,MAAM,6BAA6B,YAAA,CAAoC;AAAA,EAC5E,OAAA;AAAA,EACA,cAAA;AAAA,EACA;AACF,CAAC","file":"parser.js","sourcesContent":["/*\n * Copyright 2024 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport * as Patterning from '@/patterning';\nimport {\n BEARINGS,\n type Format,\n LIMITS,\n PARTIAL_PATTERNS,\n SYMBOL_PATTERNS,\n SYMBOLS,\n} from '../internal';\nimport { inRange } from '../internal/in-range';\nimport { createParser } from '../internal/parse-format';\nimport type { ParseResults } from '../internal/parse';\n\ntype DegreesDecimalMinutes = {\n bear: string;\n deg: string;\n min: string;\n};\n\nconst checks = {\n deg: (deg: string, limit: number) => {\n if (Number.parseFloat(deg) > limit) {\n return `Degrees value (${deg}) exceeds max value (${limit}).`;\n }\n\n if (/\\./.test(deg)) {\n return `Degrees value (${deg}) must not include decimal value.`;\n }\n },\n min: (min: string) => inRange('Minutes', min, 59.999999999),\n sec: (val: string) => {\n if (val.includes(SYMBOLS.SECONDS)) {\n return `Seconds indicator (${SYMBOLS.SECONDS}) not valid in Degree Decimal Minutes.`;\n }\n },\n};\n\nconst formats = {\n LATLON: Patterning.fromTemplate(\n PARTIAL_PATTERNS,\n `degLat minDec NS ${SYMBOLS.DIVIDER} degLon minDec EW`,\n ),\n LONLAT: Patterning.fromTemplate(\n PARTIAL_PATTERNS,\n `degLon minDec EW ${SYMBOLS.DIVIDER} degLat minDec NS`,\n ),\n};\n\nfunction identifyErrors(format: Format) {\n return (arg: DegreesDecimalMinutes | undefined, i: number) => {\n if (!arg) {\n return [[], ['Invalid coordinate value.']] as ParseResults;\n }\n\n let { bear, deg, min } = arg;\n\n deg ??= '0';\n min ??= '0';\n\n let isNegative: 0 | 1 = SYMBOL_PATTERNS.NEGATIVE_SIGN.test(deg) ? 1 : 0;\n const bearingOptions = BEARINGS[format][i] as [string, string];\n\n if (!bear || isNegative) {\n bear = bearingOptions[isNegative];\n deg = Math.abs(Number.parseFloat(deg)).toString();\n isNegative = 0;\n }\n\n const errors = [\n ...[checks.deg(deg, LIMITS[format][i] ?? 0)],\n ...[checks.min(min)],\n ...[checks.sec([bear, deg, min].join(''))],\n ].filter(Boolean);\n\n return (\n errors.length ? [[], errors] : [[deg, min, bear], []]\n ) as ParseResults;\n };\n}\n\nfunction identifyPieces(half: string[]) {\n if (half.length < 1 || half.length > 3) {\n return;\n }\n\n const asString = half.join(' ');\n const places = { bear: '', deg: '', min: '' };\n const keys = ['deg', 'min'] as (keyof typeof places)[];\n const test = (r: RegExp, b: boolean, v: string) =>\n r.test(v) || (r.test(asString) && b);\n\n return half.reduce((acc, token, i, { length }) => {\n if (test(SYMBOL_PATTERNS.NSEW, i === length - 1, token)) {\n acc.bear ||= token;\n } else if (test(SYMBOL_PATTERNS.DEGREES, i === 0, token)) {\n acc.deg ||= token;\n } else if (test(SYMBOL_PATTERNS.MINUTES, i === 1, token)) {\n acc.min ||= token;\n } else {\n const key = keys.find((k) => !acc[k]);\n\n acc[key as keyof typeof acc] = token;\n }\n\n return acc;\n }, places);\n}\n\n/** Parse a Degrees Decimal Minutes coordinate. */\nexport const parseDegreesDecimalMinutes = createParser<DegreesDecimalMinutes>({\n formats,\n identifyErrors,\n identifyPieces,\n});\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/coordinates/latlon/degrees-decimal-minutes/system.ts"],"names":[],"mappings":";;;AAwBO,MAAM,2BAAA,GAAgD;AAAA,EAC3D,IAAA,EAAM,yBAAA;AAAA,EAEN,KAAA,EAAO,0BAAA;AAAA,EAEP,QAAQ,GAAA,EAAK;AACX,IAAA,MAAM,CAAC,OAAA,EAAS,OAAA,EAAS,IAAI,CAAA,GAAI,GAAA;AAEjC,IAAA,OAAO,MAAA,CAAO,UAAA;AAAA,MAAA,CAAA,CAET,OAAO,UAAA,CAAW,OAAO,CAAA,GAAI,MAAA,CAAO,WAAW,OAAO,CAAA,GAAI,EAAA,KAC1D,eAAA,CAAgB,kBAAkB,IAAA,CAAK,IAAI,IAAI,EAAA,GAAK,CAAA,CAAA,EACrD,QAAQ,CAAC;AAAA,KACb;AAAA,EACF,CAAA;AAAA,EAEA,QAAA,CAAS,MAAA,EAAgB,CAAC,IAAA,EAAM,KAAK,CAAA,EAAqB;AACxD,IAAA,OAAO,CAAC,IAAA,EAAM,KAAK,EAChB,GAAA,CAAI,CAAC,KAAK,KAAA,KAAU;AACnB,MAAA,MAAM,GAAA,GAAM,IAAA,CAAK,GAAA,CAAI,GAAG,CAAA;AACxB,MAAA,MAAM,GAAA,GAAM,IAAA,CAAK,KAAA,CAAM,GAAG,CAAA;AAC1B,MAAA,MAAM,GAAA,GAAM,OAAO,UAAA,CAAA,CAAA,CAAa,GAAA,GAAM,OAAO,EAAA,EAAI,OAAA,CAAQ,CAAC,CAAC,CAAA;AAE3D,MAAA,OAAO,CAAA,EAAG,GAAG,CAAA,CAAA,EAAI,GAAG,CAAA,CAAA,EAAI,QAAA,CAAS,MAAM,CAAA,CAAE,KAAc,CAAA,CAAE,EAAE,GAAA,GAAM,EAAE,CAAC,CAAA,CAAA;AAAA,IACtE,CAAC,CAAA,CACA,IAAA,CAAK,CAAA,CAAA,EAAI,OAAA,CAAQ,OAAO,CAAA,CAAA,CAAG,CAAA;AAAA,EAChC;AACF","file":"system.js","sourcesContent":["// __private-exports\n/*\n * Copyright 2024 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {\n BEARINGS,\n type Compass,\n type Format,\n SYMBOLS,\n SYMBOL_PATTERNS,\n} from '../internal';\nimport type { CoordinateSystem } from '../internal/coordinate-system';\n\nimport { parseDegreesDecimalMinutes } from './parser';\n\nexport const systemDegreesDecimalMinutes: CoordinateSystem = {\n name: 'Degrees Decimal Minutes',\n\n parse: parseDegreesDecimalMinutes,\n\n toFloat(arg) {\n const [degrees, minutes, bear] = arg as [string, string, Compass];\n\n return Number.parseFloat(\n (\n (Number.parseFloat(degrees) + Number.parseFloat(minutes) / 60) *\n (SYMBOL_PATTERNS.NEGATIVE_BEARINGS.test(bear) ? -1 : 1)\n ).toFixed(9),\n );\n },\n\n toFormat(format: Format, [left, right]: [number, number]) {\n return [left, right]\n .map((num, index) => {\n const abs = Math.abs(num);\n const deg = Math.floor(abs);\n const min = Number.parseFloat(((abs - deg) * 60).toFixed(9));\n\n return `${deg} ${min} ${BEARINGS[format][index as 0 | 1][+(num < 0)]}`;\n })\n .join(` ${SYMBOLS.DIVIDER} `);\n },\n};\n"]}
1
+ {"version":3,"sources":["../../../../src/coordinates/latlon/degrees-decimal-minutes/system.ts"],"names":[],"mappings":";;;AAuBO,MAAM,2BAAA,GAAgD;AAAA,EAC3D,IAAA,EAAM,yBAAA;AAAA,EAEN,KAAA,EAAO,0BAAA;AAAA,EAEP,QAAQ,GAAA,EAAK;AACX,IAAA,MAAM,CAAC,OAAA,EAAS,OAAA,EAAS,IAAI,CAAA,GAAI,GAAA;AAEjC,IAAA,OAAO,MAAA,CAAO,UAAA;AAAA,MAAA,CAAA,CAET,OAAO,UAAA,CAAW,OAAO,CAAA,GAAI,MAAA,CAAO,WAAW,OAAO,CAAA,GAAI,EAAA,KAC1D,eAAA,CAAgB,kBAAkB,IAAA,CAAK,IAAI,IAAI,EAAA,GAAK,CAAA,CAAA,EACrD,QAAQ,CAAC;AAAA,KACb;AAAA,EACF,CAAA;AAAA,EAEA,QAAA,CAAS,MAAA,EAAgB,CAAC,IAAA,EAAM,KAAK,CAAA,EAAqB;AACxD,IAAA,OAAO,CAAC,IAAA,EAAM,KAAK,EAChB,GAAA,CAAI,CAAC,KAAK,KAAA,KAAU;AACnB,MAAA,MAAM,GAAA,GAAM,IAAA,CAAK,GAAA,CAAI,GAAG,CAAA;AACxB,MAAA,MAAM,GAAA,GAAM,IAAA,CAAK,KAAA,CAAM,GAAG,CAAA;AAC1B,MAAA,MAAM,GAAA,GAAM,OAAO,UAAA,CAAA,CAAA,CAAa,GAAA,GAAM,OAAO,EAAA,EAAI,OAAA,CAAQ,CAAC,CAAC,CAAA;AAE3D,MAAA,OAAO,CAAA,EAAG,GAAG,CAAA,CAAA,EAAI,GAAG,CAAA,CAAA,EAAI,QAAA,CAAS,MAAM,CAAA,CAAE,KAAc,CAAA,CAAE,EAAE,GAAA,GAAM,EAAE,CAAC,CAAA,CAAA;AAAA,IACtE,CAAC,CAAA,CACA,IAAA,CAAK,CAAA,CAAA,EAAI,OAAA,CAAQ,OAAO,CAAA,CAAA,CAAG,CAAA;AAAA,EAChC;AACF","file":"system.js","sourcesContent":["// __private-exports\n/*\n * Copyright 2024 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {\n BEARINGS,\n type Compass,\n type Format,\n SYMBOL_PATTERNS,\n SYMBOLS,\n} from '../internal';\nimport { parseDegreesDecimalMinutes } from './parser';\nimport type { CoordinateSystem } from '../internal/coordinate-system';\n\nexport const systemDegreesDecimalMinutes: CoordinateSystem = {\n name: 'Degrees Decimal Minutes',\n\n parse: parseDegreesDecimalMinutes,\n\n toFloat(arg) {\n const [degrees, minutes, bear] = arg as [string, string, Compass];\n\n return Number.parseFloat(\n (\n (Number.parseFloat(degrees) + Number.parseFloat(minutes) / 60) *\n (SYMBOL_PATTERNS.NEGATIVE_BEARINGS.test(bear) ? -1 : 1)\n ).toFixed(9),\n );\n },\n\n toFormat(format: Format, [left, right]: [number, number]) {\n return [left, right]\n .map((num, index) => {\n const abs = Math.abs(num);\n const deg = Math.floor(abs);\n const min = Number.parseFloat(((abs - deg) * 60).toFixed(9));\n\n return `${deg} ${min} ${BEARINGS[format][index as 0 | 1][+(num < 0)]}`;\n })\n .join(` ${SYMBOLS.DIVIDER} `);\n },\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/coordinates/latlon/degrees-minutes-seconds/parser.ts"],"names":[],"mappings":";;;;;AAiCA,MAAM,MAAA,GAAS;AAAA,EACb,GAAA,EAAK,CAAC,GAAA,EAAa,KAAA,KAAkB;AACnC,IAAA,IAAI,MAAA,CAAO,UAAA,CAAW,GAAG,CAAA,GAAI,KAAA,EAAO;AAClC,MAAA,OAAO,CAAA,eAAA,EAAkB,GAAG,CAAA,qBAAA,EAAwB,KAAK,CAAA,EAAA,CAAA;AAAA,IAC3D;AAEA,IAAA,IAAI,IAAA,CAAK,IAAA,CAAK,GAAG,CAAA,EAAG;AAClB,MAAA,OAAO,kBAAkB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,EAAG,KAAK,CAAA,EAAG;AACvD,MAAA,GAAA,CAAI,IAAA,KAAS,KAAA;AAAA,IACf,WAAW,IAAA,CAAK,eAAA,CAAgB,SAAS,CAAA,KAAM,CAAA,EAAG,KAAK,CAAA,EAAG;AACxD,MAAA,GAAA,CAAI,GAAA,KAAQ,KAAA;AAAA,IACd,WAAW,IAAA,CAAK,eAAA,CAAgB,SAAS,CAAA,KAAM,CAAA,EAAG,KAAK,CAAA,EAAG;AACxD,MAAA,GAAA,CAAI,GAAA,KAAQ,KAAA;AAAA,IACd,WAAW,IAAA,CAAK,eAAA,CAAgB,SAAS,CAAA,KAAM,CAAA,EAAG,KAAK,CAAA,EAAG;AACxD,MAAA,GAAA,CAAI,GAAA,KAAQ,KAAA;AAAA,IACd,CAAA,MAAO;AACL,MAAA,MAAM,GAAA,GAAM,KAAK,IAAA,CAAK,CAAC,MAAM,CAAC,GAAA,CAAI,CAAC,CAAC,CAAA;AAEpC,MAAA,GAAA,CAAI,GAAuB,CAAA,GAAI,KAAA;AAAA,IACjC;AAEA,IAAA,OAAO,GAAA;AAAA,EACT,GAAG,MAAM,CAAA;AACX;AAGO,MAAM,6BAA6B,YAAA,CAAoC;AAAA,EAC5E,OAAA;AAAA,EACA,cAAA;AAAA,EACA;AACF,CAAC","file":"parser.js","sourcesContent":["/*\n * Copyright 2024 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport * as Patterning from '@/patterning';\n\nimport {\n BEARINGS,\n type Format,\n LIMITS,\n PARTIAL_PATTERNS,\n SYMBOLS,\n SYMBOL_PATTERNS,\n} from '../internal';\nimport { inRange } from '../internal/in-range';\nimport type { ParseResults } from '../internal/parse';\nimport { createParser } from '../internal/parse-format';\n\ntype DegreesMinutesSeconds = {\n bear: string;\n deg: string;\n min: string;\n sec: string;\n};\n\nconst checks = {\n deg: (deg: string, limit: number) => {\n if (Number.parseFloat(deg) > limit) {\n return `Degrees value (${deg}) exceeds max value (${limit}).`;\n }\n\n if (/\\./.test(deg)) {\n return `Degrees value (${deg}) must not include decimal value.`;\n }\n },\n min: (min: string) => inRange('Minutes', min, 59),\n sec: (sec: string) => inRange('Seconds', sec, 59.999999999),\n};\n\nconst formats = {\n LATLON: Patterning.fromTemplate(\n PARTIAL_PATTERNS,\n `degLat min secDec NS ${SYMBOLS.DIVIDER} degLon min secDec EW`,\n ),\n LONLAT: Patterning.fromTemplate(\n PARTIAL_PATTERNS,\n `degLon min secDec EW ${SYMBOLS.DIVIDER} degLat min secDec NS`,\n ),\n};\n\nfunction identifyErrors(format: Format) {\n return (arg: DegreesMinutesSeconds | undefined, i: number) => {\n if (!arg) {\n return [[], ['Invalid coordinate value.']] as ParseResults;\n }\n\n let { bear, deg, min, sec } = arg;\n\n deg ??= '0';\n // NOTE: need `||=` not `??=` because empty-string is not nullish\n min ||= '0';\n sec ||= '0';\n\n let isNegative: 0 | 1 = SYMBOL_PATTERNS.NEGATIVE_SIGN.test(deg) ? 1 : 0;\n const bearingOptions = BEARINGS[format][i] as [string, string];\n\n if (!bear || isNegative) {\n bear = bearingOptions[isNegative];\n deg = Math.abs(Number.parseFloat(deg)).toString();\n isNegative = 0;\n }\n\n const errors = [\n ...[checks.deg(deg, LIMITS[format][i] ?? 0)],\n ...[checks.min(min)],\n ...[checks.sec(sec)],\n ].filter(Boolean);\n\n return (\n errors.length ? [[], errors] : [[deg, min, sec, bear], []]\n ) as ParseResults;\n };\n}\n\nfunction identifyPieces(half: string[]) {\n if (half.length < 1 || half.length > 4) {\n return;\n }\n\n const asString = half.join(' ');\n const places = { bear: '', deg: '', min: '', sec: '' };\n const keys = ['deg', 'min', 'sec'] as (keyof typeof places)[];\n const test = (r: RegExp, b: boolean, v: string) =>\n r.test(v) || (r.test(asString) && b);\n\n return half.reduce((acc, token, i, { length }) => {\n if (test(SYMBOL_PATTERNS.NSEW, i === length - 1, token)) {\n acc.bear ||= token;\n } else if (test(SYMBOL_PATTERNS.DEGREES, i === 0, token)) {\n acc.deg ||= token;\n } else if (test(SYMBOL_PATTERNS.MINUTES, i === 1, token)) {\n acc.min ||= token;\n } else if (test(SYMBOL_PATTERNS.SECONDS, i === 2, token)) {\n acc.sec ||= token;\n } else {\n const key = keys.find((k) => !acc[k]);\n\n acc[key as keyof typeof acc] = token;\n }\n\n return acc;\n }, places);\n}\n\n/** Parse a Degrees Minutes Seconds coordinate. */\nexport const parseDegreesMinutesSeconds = createParser<DegreesMinutesSeconds>({\n formats,\n identifyErrors,\n identifyPieces,\n});\n"]}
1
+ {"version":3,"sources":["../../../../src/coordinates/latlon/degrees-minutes-seconds/parser.ts"],"names":[],"mappings":";;;;;AAgCA,MAAM,MAAA,GAAS;AAAA,EACb,GAAA,EAAK,CAAC,GAAA,EAAa,KAAA,KAAkB;AACnC,IAAA,IAAI,MAAA,CAAO,UAAA,CAAW,GAAG,CAAA,GAAI,KAAA,EAAO;AAClC,MAAA,OAAO,CAAA,eAAA,EAAkB,GAAG,CAAA,qBAAA,EAAwB,KAAK,CAAA,EAAA,CAAA;AAAA,IAC3D;AAEA,IAAA,IAAI,IAAA,CAAK,IAAA,CAAK,GAAG,CAAA,EAAG;AAClB,MAAA,OAAO,kBAAkB,GAAG,CAAA,iCAAA,CAAA;AAAA,IAC9B;AAAA,EACF,CAAA;AAAA,EACA,KAAK,CAAC,GAAA,KAAgB,OAAA,CAAQ,SAAA,EAAW,KAAK,EAAE,CAAA;AAAA,EAChD,KAAK,CAAC,GAAA,KAAgB,OAAA,CAAQ,SAAA,EAAW,KAAK,YAAY;AAC5D,CAAA;AAEA,MAAM,OAAA,GAAU;AAAA,EACd,QAAQ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A,EAAG,KAAK,CAAA,EAAG;AACxD,MAAA,GAAA,CAAI,GAAA,KAAQ,KAAA;AAAA,IACd,WAAW,IAAA,CAAK,eAAA,CAAgB,SAAS,CAAA,KAAM,CAAA,EAAG,KAAK,CAAA,EAAG;AACxD,MAAA,GAAA,CAAI,GAAA,KAAQ,KAAA;AAAA,IACd,CAAA,MAAO;AACL,MAAA,MAAM,GAAA,GAAM,KAAK,IAAA,CAAK,CAAC,MAAM,CAAC,GAAA,CAAI,CAAC,CAAC,CAAA;AAEpC,MAAA,GAAA,CAAI,GAAuB,CAAA,GAAI,KAAA;AAAA,IACjC;AAEA,IAAA,OAAO,GAAA;AAAA,EACT,GAAG,MAAM,CAAA;AACX;AAGO,MAAM,6BAA6B,YAAA,CAAoC;AAAA,EAC5E,OAAA;AAAA,EACA,cAAA;AAAA,EACA;AACF,CAAC","file":"parser.js","sourcesContent":["/*\n * Copyright 2024 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport * as Patterning from '@/patterning';\nimport {\n BEARINGS,\n type Format,\n LIMITS,\n PARTIAL_PATTERNS,\n SYMBOL_PATTERNS,\n SYMBOLS,\n} from '../internal';\nimport { inRange } from '../internal/in-range';\nimport { createParser } from '../internal/parse-format';\nimport type { ParseResults } from '../internal/parse';\n\ntype DegreesMinutesSeconds = {\n bear: string;\n deg: string;\n min: string;\n sec: string;\n};\n\nconst checks = {\n deg: (deg: string, limit: number) => {\n if (Number.parseFloat(deg) > limit) {\n return `Degrees value (${deg}) exceeds max value (${limit}).`;\n }\n\n if (/\\./.test(deg)) {\n return `Degrees value (${deg}) must not include decimal value.`;\n }\n },\n min: (min: string) => inRange('Minutes', min, 59),\n sec: (sec: string) => inRange('Seconds', sec, 59.999999999),\n};\n\nconst formats = {\n LATLON: Patterning.fromTemplate(\n PARTIAL_PATTERNS,\n `degLat min secDec NS ${SYMBOLS.DIVIDER} degLon min secDec EW`,\n ),\n LONLAT: Patterning.fromTemplate(\n PARTIAL_PATTERNS,\n `degLon min secDec EW ${SYMBOLS.DIVIDER} degLat min secDec NS`,\n ),\n};\n\nfunction identifyErrors(format: Format) {\n return (arg: DegreesMinutesSeconds | undefined, i: number) => {\n if (!arg) {\n return [[], ['Invalid coordinate value.']] as ParseResults;\n }\n\n let { bear, deg, min, sec } = arg;\n\n deg ??= '0';\n // NOTE: need `||=` not `??=` because empty-string is not nullish\n min ||= '0';\n sec ||= '0';\n\n let isNegative: 0 | 1 = SYMBOL_PATTERNS.NEGATIVE_SIGN.test(deg) ? 1 : 0;\n const bearingOptions = BEARINGS[format][i] as [string, string];\n\n if (!bear || isNegative) {\n bear = bearingOptions[isNegative];\n deg = Math.abs(Number.parseFloat(deg)).toString();\n isNegative = 0;\n }\n\n const errors = [\n ...[checks.deg(deg, LIMITS[format][i] ?? 0)],\n ...[checks.min(min)],\n ...[checks.sec(sec)],\n ].filter(Boolean);\n\n return (\n errors.length ? [[], errors] : [[deg, min, sec, bear], []]\n ) as ParseResults;\n };\n}\n\nfunction identifyPieces(half: string[]) {\n if (half.length < 1 || half.length > 4) {\n return;\n }\n\n const asString = half.join(' ');\n const places = { bear: '', deg: '', min: '', sec: '' };\n const keys = ['deg', 'min', 'sec'] as (keyof typeof places)[];\n const test = (r: RegExp, b: boolean, v: string) =>\n r.test(v) || (r.test(asString) && b);\n\n return half.reduce((acc, token, i, { length }) => {\n if (test(SYMBOL_PATTERNS.NSEW, i === length - 1, token)) {\n acc.bear ||= token;\n } else if (test(SYMBOL_PATTERNS.DEGREES, i === 0, token)) {\n acc.deg ||= token;\n } else if (test(SYMBOL_PATTERNS.MINUTES, i === 1, token)) {\n acc.min ||= token;\n } else if (test(SYMBOL_PATTERNS.SECONDS, i === 2, token)) {\n acc.sec ||= token;\n } else {\n const key = keys.find((k) => !acc[k]);\n\n acc[key as keyof typeof acc] = token;\n }\n\n return acc;\n }, places);\n}\n\n/** Parse a Degrees Minutes Seconds coordinate. */\nexport const parseDegreesMinutesSeconds = createParser<DegreesMinutesSeconds>({\n formats,\n identifyErrors,\n identifyPieces,\n});\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/coordinates/latlon/degrees-minutes-seconds/system.ts"],"names":[],"mappings":";;;AAwBO,MAAM,2BAAA,GAAgD;AAAA,EAC3D,IAAA,EAAM,yBAAA;AAAA,EAEN,KAAA,EAAO,0BAAA;AAAA,EAEP,QAAQ,GAAA,EAAK;AACX,IAAA,MAAM,CAAC,OAAA,EAAS,OAAA,EAAS,OAAA,EAAS,IAAI,CAAA,GAAI,GAAA;AAO1C,IAAA,OAAO,MAAA,CAAO,UAAA;AAAA,MAAA,CAAA,CAET,MAAA,CAAO,WAAW,OAAO,CAAA,GACxB,OAAO,UAAA,CAAW,OAAO,CAAA,GAAI,EAAA,GAC7B,MAAA,CAAO,UAAA,CAAW,OAAO,CAAA,GAAI,IAAA,KAC9B,gBAAgB,iBAAA,CAAkB,IAAA,CAAK,IAAI,CAAA,GAAI,EAAA,GAAK,CAAA,CAAA,EACrD,OAAA,CAAQ,CAAC;AAAA,KACb;AAAA,EACF,CAAA;AAAA,EAEA,QAAA,CAAS,MAAA,EAAgB,CAAC,IAAA,EAAM,KAAK,CAAA,EAAqB;AACxD,IAAA,OAAO,CAAC,IAAA,EAAM,KAAK,EAChB,GAAA,CAAI,CAAC,KAAK,KAAA,KAAU;AACnB,MAAA,MAAM,GAAA,GAAM,IAAA,CAAK,GAAA,CAAI,GAAG,CAAA;AACxB,MAAA,MAAM,GAAA,GAAM,IAAA,CAAK,KAAA,CAAM,GAAG,CAAA;AAC1B,MAAA,MAAM,GAAA,GAAA,CAAO,MAAM,GAAA,IAAO,EAAA;AAC1B,MAAA,MAAM,GAAA,GAAM,IAAA,CAAK,KAAA,CAAM,GAAG,CAAA;AAC1B,MAAA,MAAM,GAAA,GAAM,OAAO,UAAA,CAAA,CAAA,CAAa,GAAA,GAAM,OAAO,EAAA,EAAI,OAAA,CAAQ,CAAC,CAAC,CAAA;AAE3D,MAAA,OAAO,CAAA,EAAG,GAAG,CAAA,CAAA,EAAI,GAAG,IAAI,GAAG,CAAA,CAAA,EAAI,QAAA,CAAS,MAAM,EAAE,KAAc,CAAA,CAAE,EAAE,GAAA,GAAM,EAAE,CAAC,CAAA,CAAA;AAAA,IAC7E,CAAC,CAAA,CACA,IAAA,CAAK,CAAA,CAAA,EAAI,OAAA,CAAQ,OAAO,CAAA,CAAA,CAAG,CAAA;AAAA,EAChC;AACF","file":"system.js","sourcesContent":["// __private-exports\n/*\n * Copyright 2024 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {\n BEARINGS,\n type Compass,\n type Format,\n SYMBOLS,\n SYMBOL_PATTERNS,\n} from '../internal';\nimport type { CoordinateSystem } from '../internal/coordinate-system';\n\nimport { parseDegreesMinutesSeconds } from './parser';\n\nexport const systemDegreesMinutesSeconds: CoordinateSystem = {\n name: 'Degrees Minutes Seconds',\n\n parse: parseDegreesMinutesSeconds,\n\n toFloat(arg) {\n const [degrees, minutes, seconds, bear] = arg as [\n string,\n string,\n string,\n Compass,\n ];\n\n return Number.parseFloat(\n (\n (Number.parseFloat(degrees) +\n Number.parseFloat(minutes) / 60 +\n Number.parseFloat(seconds) / 3600) *\n (SYMBOL_PATTERNS.NEGATIVE_BEARINGS.test(bear) ? -1 : 1)\n ).toFixed(9),\n );\n },\n\n toFormat(format: Format, [left, right]: [number, number]) {\n return [left, right]\n .map((num, index) => {\n const abs = Math.abs(num);\n const deg = Math.floor(abs);\n const rem = (abs - deg) * 60;\n const min = Math.floor(rem);\n const sec = Number.parseFloat(((rem - min) * 60).toFixed(9));\n\n return `${deg} ${min} ${sec} ${BEARINGS[format][index as 0 | 1][+(num < 0)]}`;\n })\n .join(` ${SYMBOLS.DIVIDER} `);\n },\n};\n"]}
1
+ {"version":3,"sources":["../../../../src/coordinates/latlon/degrees-minutes-seconds/system.ts"],"names":[],"mappings":";;;AAuBO,MAAM,2BAAA,GAAgD;AAAA,EAC3D,IAAA,EAAM,yBAAA;AAAA,EAEN,KAAA,EAAO,0BAAA;AAAA,EAEP,QAAQ,GAAA,EAAK;AACX,IAAA,MAAM,CAAC,OAAA,EAAS,OAAA,EAAS,OAAA,EAAS,IAAI,CAAA,GAAI,GAAA;AAO1C,IAAA,OAAO,MAAA,CAAO,UAAA;AAAA,MAAA,CAAA,CAET,MAAA,CAAO,WAAW,OAAO,CAAA,GACxB,OAAO,UAAA,CAAW,OAAO,CAAA,GAAI,EAAA,GAC7B,MAAA,CAAO,UAAA,CAAW,OAAO,CAAA,GAAI,IAAA,KAC9B,gBAAgB,iBAAA,CAAkB,IAAA,CAAK,IAAI,CAAA,GAAI,EAAA,GAAK,CAAA,CAAA,EACrD,OAAA,CAAQ,CAAC;AAAA,KACb;AAAA,EACF,CAAA;AAAA,EAEA,QAAA,CAAS,MAAA,EAAgB,CAAC,IAAA,EAAM,KAAK,CAAA,EAAqB;AACxD,IAAA,OAAO,CAAC,IAAA,EAAM,KAAK,EAChB,GAAA,CAAI,CAAC,KAAK,KAAA,KAAU;AACnB,MAAA,MAAM,GAAA,GAAM,IAAA,CAAK,GAAA,CAAI,GAAG,CAAA;AACxB,MAAA,MAAM,GAAA,GAAM,IAAA,CAAK,KAAA,CAAM,GAAG,CAAA;AAC1B,MAAA,MAAM,GAAA,GAAA,CAAO,MAAM,GAAA,IAAO,EAAA;AAC1B,MAAA,MAAM,GAAA,GAAM,IAAA,CAAK,KAAA,CAAM,GAAG,CAAA;AAC1B,MAAA,MAAM,GAAA,GAAM,OAAO,UAAA,CAAA,CAAA,CAAa,GAAA,GAAM,OAAO,EAAA,EAAI,OAAA,CAAQ,CAAC,CAAC,CAAA;AAE3D,MAAA,OAAO,CAAA,EAAG,GAAG,CAAA,CAAA,EAAI,GAAG,IAAI,GAAG,CAAA,CAAA,EAAI,QAAA,CAAS,MAAM,EAAE,KAAc,CAAA,CAAE,EAAE,GAAA,GAAM,EAAE,CAAC,CAAA,CAAA;AAAA,IAC7E,CAAC,CAAA,CACA,IAAA,CAAK,CAAA,CAAA,EAAI,OAAA,CAAQ,OAAO,CAAA,CAAA,CAAG,CAAA;AAAA,EAChC;AACF","file":"system.js","sourcesContent":["// __private-exports\n/*\n * Copyright 2024 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {\n BEARINGS,\n type Compass,\n type Format,\n SYMBOL_PATTERNS,\n SYMBOLS,\n} from '../internal';\nimport { parseDegreesMinutesSeconds } from './parser';\nimport type { CoordinateSystem } from '../internal/coordinate-system';\n\nexport const systemDegreesMinutesSeconds: CoordinateSystem = {\n name: 'Degrees Minutes Seconds',\n\n parse: parseDegreesMinutesSeconds,\n\n toFloat(arg) {\n const [degrees, minutes, seconds, bear] = arg as [\n string,\n string,\n string,\n Compass,\n ];\n\n return Number.parseFloat(\n (\n (Number.parseFloat(degrees) +\n Number.parseFloat(minutes) / 60 +\n Number.parseFloat(seconds) / 3600) *\n (SYMBOL_PATTERNS.NEGATIVE_BEARINGS.test(bear) ? -1 : 1)\n ).toFixed(9),\n );\n },\n\n toFormat(format: Format, [left, right]: [number, number]) {\n return [left, right]\n .map((num, index) => {\n const abs = Math.abs(num);\n const deg = Math.floor(abs);\n const rem = (abs - deg) * 60;\n const min = Math.floor(rem);\n const sec = Number.parseFloat(((rem - min) * 60).toFixed(9));\n\n return `${deg} ${min} ${sec} ${BEARINGS[format][index as 0 | 1][+(num < 0)]}`;\n })\n .join(` ${SYMBOLS.DIVIDER} `);\n },\n};\n"]}
@@ -2,7 +2,7 @@ import * as Patterning from './../../../patterning.js';
2
2
  import { SYMBOL_PATTERNS, SYMBOLS } from '.';
3
3
 
4
4
  const DIVIDERS = /[,/]/g;
5
- const FLOATS = /^(-?)([\d\.]+)([^.\d]?)$/;
5
+ const FLOATS = /^(-?)([\d.]+)([^.\d]?)$/;
6
6
  const POSITIONAL = new RegExp(
7
7
  Patterning.merge(/\s*/, Patterning.capture(SYMBOL_PATTERNS.DMS), /\s*/),
8
8
  "g"
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/coordinates/latlon/internal/lexer.ts"],"names":[],"mappings":";;;AA0BA,MAAM,QAAA,GAAW,OAAA;AACjB,MAAM,MAAA,GAAS,0BAAA;AAEf,MAAM,aAAa,IAAI,MAAA;AAAA,EACrB,UAAA,CAAW,MAAM,KAAA,EAAO,UAAA,CAAW,QAAQ,eAAA,CAAgB,GAAG,GAAG,KAAK,CAAA;AAAA,EACtE;AACF,CAAA;AACA,MAAM,QAAA,GAAW,KAAA;AACjB,MAAM,KAAA,GAAQ,YAAA;AASd,MAAM,SAAS,IAAI,MAAA;AAAA,EACjB,UAAA,CAAW,KAAA;AAAA,IACT,QAAA;AAAA,IACA,GAAA;AAAA,IACA,eAAA,CAAgB,IAAA;AAAA,IAChB,GAAA;AAAA,IACA,UAAA,CAAW,KAAA;AAAA,MACT,OAAA;AAAA,MACA,UAAA,CAAW,KAAA;AAAA;AAAA,QAET,oBAAA;AAAA;AAAA,QAEA;AAAA,OACF;AAAA,MACA,UAAA,CAAW,QAAA,CAAS,eAAA,CAAgB,GAAG;AAAA;AACzC,GACF;AAAA,EACA;AACF,CAAA;AAGA,SAAS,sBAAsB,CAAA,EAAW;AACxC,EAAA,MAAM,CAAC,IAAA,EAAM,GAAA,EAAK,GAAG,CAAA,GAAA,CAAK,MAAA,CAAO,IAAA,CAAK,CAAC,CAAA,IAAK,EAAC,EAAG,KAAA,CAAM,CAAC,CAAA;AAEvD,EAAA,IAAI,GAAA,EAAK;AACP,IAAA,OAAO,CAAA,EAAG,IAAI,CAAA,EAAG,MAAA,CAAO,WAAW,GAAG,CAAC,GAAG,GAAG,CAAA,CAAA;AAAA,EAC/C;AAEA,EAAA,OAAO,CAAA;AACT;AAkBO,SAAS,MAAM,KAAA,EAAe;AACnC,EAAA,MAAM,MAAA,GACJ,KAAA,CACG,IAAA,EAAK,CACL,WAAA,EAAY,CACZ,OAAA,CAAQ,QAAA,EAAU,EAAE,CAAA,CACpB,OAAA,CAAQ,UAAA,EAAY,KAAK,CAAA,CACzB,OAAA,CAAQ,KAAA,EAAO,IAAI,CAAA,CACnB,OAAA,CAAQ,QAAA,EAAU,OAAA,CAAQ,OAAO,CAAA,CACjC,KAAA,CAAM,MAAM,CAAA,EACX,GAAA,CAAI,qBAAqB,CAAA,EACzB,KAAA,MAAW,EAAC;AAElB,EAAA,OAAO,MAAA;AACT","file":"lexer.js","sourcesContent":["// __private-exports\n/*\n * Copyright 2024 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport * as Patterning from '@/patterning';\n\nimport { SYMBOLS, SYMBOL_PATTERNS } from '.';\n\nexport type Tokens = ReturnType<typeof lexer>;\n\n/**\n * Separating latitude from longitude portions of a coordinate. At this level\n * of pattern matching this list can not include the \"space\" character since\n * that is valid between components of either side of a divider; higher level\n * parsers will be able to make up for this shortcoming and be more intelligent\n * about deducing where a divider could be added or would not be valid.\n */\nconst DIVIDERS = /[,/]/g;\nconst FLOATS = /^(-?)([\\d\\.]+)([^.\\d]?)$/;\n/** Positional indicators for: degrees, minutes, and seconds */\nconst POSITIONAL = new RegExp(\n Patterning.merge(/\\s*/, Patterning.capture(SYMBOL_PATTERNS.DMS), /\\s*/),\n 'g',\n);\nconst POSITIVE = /\\+/g;\nconst SIGNS = /([-+])\\s*/g;\n/**\n * Any recognizably significant tokens anywhere (non-positional-y) within a\n * string; because at this level (lexing) actual position is not important.\n *\n * - [Regex Vis](https://regex-vis.com/?r=%2F%5B%2C%2F%5D%7C%5BNSEW%5D%7C%28%3F%3A%5B-%2B%5D%3F%28%3F%3A%28%3F%3A%5Cd%2B%28%3F%3A%5C.%5Cd*%29%3F%29%7C%28%3F%3A%5C.%5Cd%2B%29%29%28%3F%3A%5B%C2%B0%27%22%5D%29%3F%29%2Fgi)\n * - [Nodexr](https://www.nodexr.net/?parse=%2F%5B,%2F%5D%7C%5BNSEW%5D%7C(%3F%3A%5B-%2B%5D%3F(%3F%3A(%3F%3A%5Cd%2B(%3F%3A%5C.%5Cd*)%3F)%7C(%3F%3A%5C.%5Cd%2B))%5B%C2%B0%27%22%5D%3F)%2Fgi)\n */\n// NOTE: the links (above) for \"Regex Vis\" and \"Nodexr\" would need to be updated if/when the pattern is changed.\nconst TOKENS = new RegExp(\n Patterning.merge(\n DIVIDERS,\n /|/,\n SYMBOL_PATTERNS.NSEW,\n /|/,\n Patterning.group(\n /[-+]?/,\n Patterning.group(\n // left of decimal REQUIRED, right of decimal optional\n /(?:\\d+(?:\\.\\d*)?)|/,\n // left of decimal omitted, right of decimal REQUIRED\n /(?:\\.\\d+)/,\n ),\n Patterning.optional(SYMBOL_PATTERNS.DMS),\n ),\n ),\n 'gi',\n);\n\n// remove trailing zeros '?.0' and ensure leading zero '0.?' in numbers\nfunction fixLeadingAndTrailing(t: string) {\n const [sign, num, pos] = (FLOATS.exec(t) ?? []).slice(1);\n\n if (num) {\n return `${sign}${Number.parseFloat(num)}${pos}`;\n }\n\n return t;\n}\n\n/**\n * Take an input string - possibly from user input - and clean it up enough to\n * be something to work with at a higher level of processing (with more\n * information) than is available at this level. Generating a list of \"tokens\"\n * that are potentially valid parts of a coordinate. The values being looked\n * for are: numbers (with positional indicators) and axes (NSEW).\n *\n * NOTE: No validation is done at this level to keep it simple as agnostic.\n *\n * @remarks\n * pure function\n *\n * @example\n * lexer('N 55,E 44') === ['N' '55', '/', 'E', '44']\n * lexer(` + 89 ° 59 59.999 \" N, 179° 59 59.999\" `) === ['89', '59', '59.999', 'N', '/', '179', '59', '59.999', 'E']\n */\nexport function lexer(input: string) {\n const tokens =\n input\n .trim()\n .toUpperCase()\n .replace(POSITIVE, '') // positive signs are redundant\n .replace(POSITIONAL, '$1 ') // group positional indicators with numbers\n .replace(SIGNS, '$1') // group signs with numbers\n .replace(DIVIDERS, SYMBOLS.DIVIDER) // standardize the divider\n .match(TOKENS)\n ?.map(fixLeadingAndTrailing)\n ?.slice() ?? [];\n\n return tokens;\n}\n"]}
1
+ {"version":3,"sources":["../../../../src/coordinates/latlon/internal/lexer.ts"],"names":[],"mappings":";;;AAyBA,MAAM,QAAA,GAAW,OAAA;AACjB,MAAM,MAAA,GAAS,yBAAA;AAEf,MAAM,aAAa,IAAI,MAAA;AAAA,EACrB,UAAA,CAAW,MAAM,KAAA,EAAO,UAAA,CAAW,QAAQ,eAAA,CAAgB,GAAG,GAAG,KAAK,CAAA;AAAA,EACtE;AACF,CAAA;AACA,MAAM,QAAA,GAAW,KAAA;AACjB,MAAM,KAAA,GAAQ,YAAA;AASd,MAAM,SAAS,IAAI,MAAA;AAAA,EACjB,UAAA,CAAW,KAAA;AAAA,IACT,QAAA;AAAA,IACA,GAAA;AAAA,IACA,eAAA,CAAgB,IAAA;AAAA,IAChB,GAAA;AAAA,IACA,UAAA,CAAW,KAAA;AAAA,MACT,OAAA;AAAA,MACA,UAAA,CAAW,KAAA;AAAA;AAAA,QAET,oBAAA;AAAA;AAAA,QAEA;AAAA,OACF;AAAA,MACA,UAAA,CAAW,QAAA,CAAS,eAAA,CAAgB,GAAG;AAAA;AACzC,GACF;AAAA,EACA;AACF,CAAA;AAGA,SAAS,sBAAsB,CAAA,EAAW;AACxC,EAAA,MAAM,CAAC,IAAA,EAAM,GAAA,EAAK,GAAG,CAAA,GAAA,CAAK,MAAA,CAAO,IAAA,CAAK,CAAC,CAAA,IAAK,EAAC,EAAG,KAAA,CAAM,CAAC,CAAA;AAEvD,EAAA,IAAI,GAAA,EAAK;AACP,IAAA,OAAO,CAAA,EAAG,IAAI,CAAA,EAAG,MAAA,CAAO,WAAW,GAAG,CAAC,GAAG,GAAG,CAAA,CAAA;AAAA,EAC/C;AAEA,EAAA,OAAO,CAAA;AACT;AAkBO,SAAS,MAAM,KAAA,EAAe;AACnC,EAAA,MAAM,MAAA,GACJ,KAAA,CACG,IAAA,EAAK,CACL,WAAA,EAAY,CACZ,OAAA,CAAQ,QAAA,EAAU,EAAE,CAAA,CACpB,OAAA,CAAQ,UAAA,EAAY,KAAK,CAAA,CACzB,OAAA,CAAQ,KAAA,EAAO,IAAI,CAAA,CACnB,OAAA,CAAQ,QAAA,EAAU,OAAA,CAAQ,OAAO,CAAA,CACjC,KAAA,CAAM,MAAM,CAAA,EACX,GAAA,CAAI,qBAAqB,CAAA,EACzB,KAAA,MAAW,EAAC;AAElB,EAAA,OAAO,MAAA;AACT","file":"lexer.js","sourcesContent":["// __private-exports\n/*\n * Copyright 2024 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport * as Patterning from '@/patterning';\nimport { SYMBOL_PATTERNS, SYMBOLS } from '.';\n\nexport type Tokens = ReturnType<typeof lexer>;\n\n/**\n * Separating latitude from longitude portions of a coordinate. At this level\n * of pattern matching this list can not include the \"space\" character since\n * that is valid between components of either side of a divider; higher level\n * parsers will be able to make up for this shortcoming and be more intelligent\n * about deducing where a divider could be added or would not be valid.\n */\nconst DIVIDERS = /[,/]/g;\nconst FLOATS = /^(-?)([\\d.]+)([^.\\d]?)$/;\n/** Positional indicators for: degrees, minutes, and seconds */\nconst POSITIONAL = new RegExp(\n Patterning.merge(/\\s*/, Patterning.capture(SYMBOL_PATTERNS.DMS), /\\s*/),\n 'g',\n);\nconst POSITIVE = /\\+/g;\nconst SIGNS = /([-+])\\s*/g;\n/**\n * Any recognizably significant tokens anywhere (non-positional-y) within a\n * string; because at this level (lexing) actual position is not important.\n *\n * - [Regex Vis](https://regex-vis.com/?r=%2F%5B%2C%2F%5D%7C%5BNSEW%5D%7C%28%3F%3A%5B-%2B%5D%3F%28%3F%3A%28%3F%3A%5Cd%2B%28%3F%3A%5C.%5Cd*%29%3F%29%7C%28%3F%3A%5C.%5Cd%2B%29%29%28%3F%3A%5B%C2%B0%27%22%5D%29%3F%29%2Fgi)\n * - [Nodexr](https://www.nodexr.net/?parse=%2F%5B,%2F%5D%7C%5BNSEW%5D%7C(%3F%3A%5B-%2B%5D%3F(%3F%3A(%3F%3A%5Cd%2B(%3F%3A%5C.%5Cd*)%3F)%7C(%3F%3A%5C.%5Cd%2B))%5B%C2%B0%27%22%5D%3F)%2Fgi)\n */\n// NOTE: the links (above) for \"Regex Vis\" and \"Nodexr\" would need to be updated if/when the pattern is changed.\nconst TOKENS = new RegExp(\n Patterning.merge(\n DIVIDERS,\n /|/,\n SYMBOL_PATTERNS.NSEW,\n /|/,\n Patterning.group(\n /[-+]?/,\n Patterning.group(\n // left of decimal REQUIRED, right of decimal optional\n /(?:\\d+(?:\\.\\d*)?)|/,\n // left of decimal omitted, right of decimal REQUIRED\n /(?:\\.\\d+)/,\n ),\n Patterning.optional(SYMBOL_PATTERNS.DMS),\n ),\n ),\n 'gi',\n);\n\n// remove trailing zeros '?.0' and ensure leading zero '0.?' in numbers\nfunction fixLeadingAndTrailing(t: string) {\n const [sign, num, pos] = (FLOATS.exec(t) ?? []).slice(1);\n\n if (num) {\n return `${sign}${Number.parseFloat(num)}${pos}`;\n }\n\n return t;\n}\n\n/**\n * Take an input string - possibly from user input - and clean it up enough to\n * be something to work with at a higher level of processing (with more\n * information) than is available at this level. Generating a list of \"tokens\"\n * that are potentially valid parts of a coordinate. The values being looked\n * for are: numbers (with positional indicators) and axes (NSEW).\n *\n * NOTE: No validation is done at this level to keep it simple as agnostic.\n *\n * @remarks\n * pure function\n *\n * @example\n * lexer('N 55,E 44') === ['N' '55', '/', 'E', '44']\n * lexer(` + 89 ° 59 59.999 \" N, 179° 59 59.999\" `) === ['89', '59', '59.999', 'N', '/', '179', '59', '59.999', 'E']\n */\nexport function lexer(input: string) {\n const tokens =\n input\n .trim()\n .toUpperCase()\n .replace(POSITIVE, '') // positive signs are redundant\n .replace(POSITIONAL, '$1 ') // group positional indicators with numbers\n .replace(SIGNS, '$1') // group signs with numbers\n .replace(DIVIDERS, SYMBOLS.DIVIDER) // standardize the divider\n .match(TOKENS)\n ?.map(fixLeadingAndTrailing)\n ?.slice() ?? [];\n\n return tokens;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/coordinates/latlon/internal/parse-format.ts"],"names":[],"mappings":";;;;AA4BA,MAAM,YAAA,GAAe,CAAC,CAAA,EAA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,GAAA,CAAI,MAAA,CAAO,cAAc,EACzB,GAAA,CAAI,MAAA,CAAO,cAAA,CAAe,MAAM,CAAC,CAAA,CACjC,MAAA,CAAO,CAAC,GAAG,CAAA,KAAM;AAAA,IAChB,CAAC,GAAG,CAAA,CAAE,CAAC,CAAA,EAAG,QAAQ,OAAA,EAAS,GAAG,CAAA,CAAE,CAAC,CAAC,CAAA;AAAA,IAClC,CAAC,GAAG,CAAA,CAAE,CAAC,CAAA,EAAG,GAAG,CAAA,CAAE,CAAC,CAAC,CAAA,CAAE,GAAA,CAAI,SAAS;AAAA,GACjC,CAAA;AAEH,EAAA,IAAI,OAAO,MAAA,EAAQ;AACjB,IAAA,OAAO;AAAA,MACL,EAAC;AAAA;AAAA,MAED,KAAA,CAAM,IAAA,CAAK,IAAI,GAAA,CAAI,MAAM,CAAC;AAAA,KAC5B;AAAA,EACF;AAEA,EAAA,MAAM,OAAA,GAAA,CAAW,MAAA,CAAO,OAAA,CAAQ,MAAM,CAAA,CAAE,IAAA,CAAK,MAAA,CAAO,IAAA,CAAK,GAAG,CAAC,CAAA,IAAK,EAAC,EAAG,KAAA;AAAA,IACpE;AAAA,GACF;AAEA,EAAA,IAAI,CAAC,SAAS,MAAA,EAAQ;AACpB,IAAA,MAAM,IAAI,KAAA;AAAA,MACR;AAAA,QACE,yFAAA;AAAA,QACA,MAAA,CAAO,KAAK,GAAG,CAAA;AAAA,QACf,iCAAA;AAAA,QACA,MAAA,CAAO,QAAQ,MAAM,CAAA;AAAA,QACrB;AAAA,OACF,CAAE,KAAK,EAAE;AAAA,KACX;AAAA,EACF;AAEA,EAAA,OAAO,CAAC,OAAA,EAAS,EAAE,CAAA;AACrB","file":"parse-format.js","sourcesContent":["// __private-exports\n/*\n * Copyright 2024 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport { type Format, SYMBOLS, SYMBOL_PATTERNS } from '.';\nimport { type ParseResults, parse } from './parse';\nimport { violation } from './violation';\n\ntype FormatParserConfig<T> = {\n formats: {\n // biome-ignore lint/style/useNamingConvention: <explanation>\n LATLON: RegExp;\n // biome-ignore lint/style/useNamingConvention: <explanation>\n LONLAT: RegExp;\n };\n identifyErrors: (format: Format) => (arg: T, i: number) => ParseResults;\n identifyPieces: (half: string[]) => T;\n};\n\nconst axisTypeTest = (k: keyof typeof SYMBOL_PATTERNS, t: string) =>\n SYMBOL_PATTERNS[k].test(t) && k;\n\nexport const createParser =\n <T>(config: FormatParserConfig<T | undefined>) =>\n (format: Format, input: string) =>\n parseWithConfig(config, format, input);\n\nfunction parseWithConfig<T>(\n config: FormatParserConfig<T>,\n format: Format,\n input: string,\n): ParseResults {\n const [parseTokens, violations] = parse(input, format);\n\n const foundFormat = parseTokens.reduce(\n (acc, t) => acc + (axisTypeTest('LAT', t) || axisTypeTest('LON', t) || ''),\n '',\n );\n\n if (!violations.length && foundFormat && foundFormat !== format) {\n return [\n [],\n [\n violation(\n `Mismatched formats: \"${format}\" expected, \"${foundFormat}\" found.`,\n ),\n ],\n ];\n }\n\n const hasErrors = !parseTokens.length && violations.length;\n\n if (hasErrors) {\n return [[], violations];\n }\n\n const [tokens, errors] = [\n parseTokens.slice(0, parseTokens.indexOf(SYMBOLS.DIVIDER)), // left of divider\n parseTokens.slice(1 + parseTokens.indexOf(SYMBOLS.DIVIDER)), // right of divider\n ]\n .map(config.identifyPieces)\n .map(config.identifyErrors(format))\n .reduce((a, b) => [\n [...a[0], SYMBOLS.DIVIDER, ...b[0]],\n [...a[1], ...b[1]].map(violation),\n ]);\n\n if (errors.length) {\n return [\n [],\n // dedupe errors\n Array.from(new Set(errors)),\n ];\n }\n\n const matches = (config.formats[format].exec(tokens.join(' ')) || []).slice(\n 1,\n );\n\n if (!matches?.length) {\n throw new Error(\n [\n 'A validation check seems to be missing because the cleaned and normalized input value (',\n tokens.join(' '),\n ') is not matching the pattern (',\n config.formats[format],\n ').',\n ].join(''),\n );\n }\n\n return [matches, []];\n}\n"]}
1
+ {"version":3,"sources":["../../../../src/coordinates/latlon/internal/parse-format.ts"],"names":[],"mappings":";;;;AA4BA,MAAM,YAAA,GAAe,CAAC,CAAA,EAAiC,CAAA,KACrD,gBAAgB,CAAC,CAAA,CAAE,IAAA,CAAK,CAAC,CAAA,IAAK,CAAA;AAEzB,MAAM,YAAA,GACX,CAAI,MAAA,KACJ,CAAC,QAAgB,KAAA,KACf,eAAA,CAAgB,MAAA,EAAQ,MAAA,EAAQ,KAAK;AAEzC,SAAS,eAAA,CACP,MAAA,EACA,MAAA,EACA,KAAA,EACc;AACd,EAAA,MAAM,CAAC,WAAA,EAAa,UAAU,CAAA,GAAI,KAAA,CAAM,OAAO,MAAM,CAAA;AAErD,EAAA,MAAM,cAAc,WAAA,CAAY,MAAA;AAAA,IAC9B,CAAC,GAAA,EAAK,CAAA,KAAM,GAAA,IAAO,YAAA,CAAa,KAAA,EAAO,CAAC,CAAA,IAAK,YAAA,CAAa,KAAA,EAAO,CAAC,CAAA,IAAK,EAAA,CAAA;AAAA,IACvE;AAAA,GACF;AAEA,EAAA,IAAI,CAAC,UAAA,CAAW,MAAA,IAAU,WAAA,IAAe,gBAAgB,MAAA,EAAQ;AAC/D,IAAA,OAAO;AAAA,MACL,EAAC;AAAA,MACD;AAAA,QACE,SAAA;AAAA,UACE,CAAA,qBAAA,EAAwB,MAAM,CAAA,aAAA,EAAgB,WAAW,CAAA,QAAA;AAAA;AAC3D;AACF,KACF;AAAA,EACF;AAEA,EAAA,MAAM,SAAA,GAAY,CAAC,WAAA,CAAY,MAAA,IAAU,UAAA,CAAW,MAAA;AAEpD,EAAA,IAAI,SAAA,E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O,QAAQ,MAAM,CAAA;AAAA,QACrB;AAAA,OACF,CAAE,KAAK,EAAE;AAAA,KACX;AAAA,EACF;AAEA,EAAA,OAAO,CAAC,OAAA,EAAS,EAAE,CAAA;AACrB","file":"parse-format.js","sourcesContent":["// __private-exports\n/*\n * Copyright 2024 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport { type Format, SYMBOL_PATTERNS, SYMBOLS } from '.';\nimport { type ParseResults, parse } from './parse';\nimport { violation } from './violation';\n\ntype FormatParserConfig<T> = {\n formats: {\n // biome-ignore lint/style/useNamingConvention: Name is chosen to stand out amongst other formats\n LATLON: RegExp;\n // biome-ignore lint/style/useNamingConvention: Name is chosen to stand out amongst other formats\n LONLAT: RegExp;\n };\n identifyErrors: (format: Format) => (arg: T, i: number) => ParseResults;\n identifyPieces: (half: string[]) => T;\n};\n\nconst axisTypeTest = (k: keyof typeof SYMBOL_PATTERNS, t: string) =>\n SYMBOL_PATTERNS[k].test(t) && k;\n\nexport const createParser =\n <T>(config: FormatParserConfig<T | undefined>) =>\n (format: Format, input: string) =>\n parseWithConfig(config, format, input);\n\nfunction parseWithConfig<T>(\n config: FormatParserConfig<T>,\n format: Format,\n input: string,\n): ParseResults {\n const [parseTokens, violations] = parse(input, format);\n\n const foundFormat = parseTokens.reduce(\n (acc, t) => acc + (axisTypeTest('LAT', t) || axisTypeTest('LON', t) || ''),\n '',\n );\n\n if (!violations.length && foundFormat && foundFormat !== format) {\n return [\n [],\n [\n violation(\n `Mismatched formats: \"${format}\" expected, \"${foundFormat}\" found.`,\n ),\n ],\n ];\n }\n\n const hasErrors = !parseTokens.length && violations.length;\n\n if (hasErrors) {\n return [[], violations];\n }\n\n const [tokens, errors] = [\n parseTokens.slice(0, parseTokens.indexOf(SYMBOLS.DIVIDER)), // left of divider\n parseTokens.slice(1 + parseTokens.indexOf(SYMBOLS.DIVIDER)), // right of divider\n ]\n .map(config.identifyPieces)\n .map(config.identifyErrors(format))\n .reduce((a, b) => [\n [...a[0], SYMBOLS.DIVIDER, ...b[0]],\n [...a[1], ...b[1]].map(violation),\n ]);\n\n if (errors.length) {\n return [\n [],\n // dedupe errors\n Array.from(new Set(errors)),\n ];\n }\n\n const matches = (config.formats[format].exec(tokens.join(' ')) || []).slice(\n 1,\n );\n\n if (!matches?.length) {\n throw new Error(\n [\n 'A validation check seems to be missing because the cleaned and normalized input value (',\n tokens.join(' '),\n ') is not matching the pattern (',\n config.formats[format],\n ').',\n ].join(''),\n );\n }\n\n return [matches, []];\n}\n"]}
@@ -1,5 +1,5 @@
1
- import { Errors, Format } from './index.js';
2
1
  import { Tokens } from './lexer.js';
2
+ import { Errors, Format } from './index.js';
3
3
 
4
4
  type ParseResults = [Tokens, Errors];
5
5
  /**
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/coordinates/latlon/internal/parse.ts"],"names":[],"mappings":";;;;AAsDO,SAAS,KAAA,CAAM,OAAe,MAAA,EAA+B;AAClE,EAAA,IAAI,CAAC,OAAO,MAAA,EAAQ;AAClB,IAAA,OAAO,CAAC,EAAC,EAAG,CAAC,SAAA,CAAU,WAAW,CAAC,CAAC,CAAA;AAAA,EACtC;AAEA,EAAA,MAAM,CAAC,QAAQ,MAAM,CAAA,GAAI,YAAY,KAAA,CAAM,KAAK,GAAG,MAAM,CAAA;AAEzD,EAAA,OAAO,CAAC,QAAQ,MAAA,EAAQ,MAAA,GAAS,OAAO,GAAA,CAAI,SAAS,CAAA,GAAI,EAAE,CAAA;AAC7D","file":"parse.js","sourcesContent":["// __private-exports\n/*\n * Copyright 2024 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport type { Errors, Format } from '.';\nimport { type Tokens, lexer } from './lexer';\nimport { pipesRunner } from './pipes';\nimport { violation } from './violation';\n\nexport type ParseResults = [Tokens, Errors];\n\n/**\n * Parse a raw input string into a validated and normalized coordinate\n * primitive ready for further refinement/validation by a more specific parser.\n *\n * @param input\n * raw input, from a user or external system, of unknown validity\n *\n * @param format\n * the expected format - LATLON or LONLAT - the coordinate should conform to\n *\n * @returns\n * tuple with two values: tokens, and errors\n *\n * @remarks\n * pure function\n *\n * @example\n * const input = '1 2 3 / 4 5 6'\n * parse(input); // [['1', '2', '3', '/', '4', '5', '6'], []]\n *\n * @description\n * __Assumptions/Specification__\n * 1. Decimals are indicated by a \".\" and not \",\"\n * 2. A degrees indicator is \"°\"\n * 3. A minutes indicator is \"'\"\n * 4. A seconds indicator is '\"'\n * 5. Each indicator is expected to follow the number it is annotating\n * 6. Numeric parts - degrees, minutes, and seconds - are positional and can\n * not be arranged in alternative orders and be considered valid\n * 7. Output will have explicit bearings characters (NSEW) and not rely on\n * positive and negative values; when bearings are available. Negative\n * values will only be replaced with absolute values if bearings are available.\n *\n */\nexport function parse(input: string, format?: Format): ParseResults {\n if (!input?.length) {\n return [[], [violation('No input.')]];\n }\n\n const [tokens, errors] = pipesRunner(lexer(input), format);\n\n return [tokens, errors?.length ? errors.map(violation) : []];\n}\n"]}
1
+ {"version":3,"sources":["../../../../src/coordinates/latlon/internal/parse.ts"],"names":[],"mappings":";;;;AAsDO,SAAS,KAAA,CAAM,OAAe,MAAA,EAA+B;AAClE,EAAA,IAAI,CAAC,OAAO,MAAA,EAAQ;AAClB,IAAA,OAAO,CAAC,EAAC,EAAG,CAAC,SAAA,CAAU,WAAW,CAAC,CAAC,CAAA;AAAA,EACtC;AAEA,EAAA,MAAM,CAAC,QAAQ,MAAM,CAAA,GAAI,YAAY,KAAA,CAAM,KAAK,GAAG,MAAM,CAAA;AAEzD,EAAA,OAAO,CAAC,QAAQ,MAAA,EAAQ,MAAA,GAAS,OAAO,GAAA,CAAI,SAAS,CAAA,GAAI,EAAE,CAAA;AAC7D","file":"parse.js","sourcesContent":["// __private-exports\n/*\n * Copyright 2024 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport { lexer, type Tokens } from './lexer';\nimport { pipesRunner } from './pipes';\nimport { violation } from './violation';\nimport type { Errors, Format } from '.';\n\nexport type ParseResults = [Tokens, Errors];\n\n/**\n * Parse a raw input string into a validated and normalized coordinate\n * primitive ready for further refinement/validation by a more specific parser.\n *\n * @param input\n * raw input, from a user or external system, of unknown validity\n *\n * @param format\n * the expected format - LATLON or LONLAT - the coordinate should conform to\n *\n * @returns\n * tuple with two values: tokens, and errors\n *\n * @remarks\n * pure function\n *\n * @example\n * const input = '1 2 3 / 4 5 6'\n * parse(input); // [['1', '2', '3', '/', '4', '5', '6'], []]\n *\n * @description\n * __Assumptions/Specification__\n * 1. Decimals are indicated by a \".\" and not \",\"\n * 2. A degrees indicator is \"°\"\n * 3. A minutes indicator is \"'\"\n * 4. A seconds indicator is '\"'\n * 5. Each indicator is expected to follow the number it is annotating\n * 6. Numeric parts - degrees, minutes, and seconds - are positional and can\n * not be arranged in alternative orders and be considered valid\n * 7. Output will have explicit bearings characters (NSEW) and not rely on\n * positive and negative values; when bearings are available. Negative\n * values will only be replaced with absolute values if bearings are available.\n *\n */\nexport function parse(input: string, format?: Format): ParseResults {\n if (!input?.length) {\n return [[], [violation('No input.')]];\n }\n\n const [tokens, errors] = pipesRunner(lexer(input), format);\n\n return [tokens, errors?.length ? errors.map(violation) : []];\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/coordinates/latlon/internal/pipes/check-ambiguous.ts"],"names":[],"mappings":";;;;AAuBO,SAAS,sBAAA,CAAuB,QAAgB,OAAA,EAAkB;AACvE,EAAA,IAAI,MAAA,CAAO,QAAA,CAAS,OAAA,CAAQ,OAAO,CAAA,EAAG;AACpC,IAAA,OAAO,WAAA,CAAY,QAAQ,KAAK,CAAA;AAAA,EAClC;AAEA,EAAA,MAAM,MAAA,GAAS,QAAQ,MAAM,CAAA;AAG7B,EAAA,MAAM,SAAA,GAAY,+BAAA,CAAgC,IAAA,CAAK,MAAM,CAAA;AAE7D,EAAA,MAAM,QAAA,GAAW,YAAA,CAAa,IAAA,CAAK,MAAM,CAAA;AAMzC,EAAA,MAAM,OAAA,GAAU,OAGb,KAAA,CAAM,CAAA,EAAG,EAAE,CAAA,CACX,MAAA,CAAO,CAAC,GAAA,EAAK,CAAA,KAAM;AAClB,IAAA,MAAM,KAAA,GACJ,CAAA,CAAE,QAAA,CAAS,OAAA,CAAQ,OAAO,CAAA,IAC1B,CAAA,CAAE,QAAA,CAAS,OAAA,CAAQ,OAAO,CAAA,IAC1B,eAAA,CAAgB,IAAA,CAAK,KAAK,CAAC,CAAA;AAE7B,IAAA,OAAO,CAAA,EAAG,GAAG,CAAA,EAAG,KAAA,GAAQ,MAAM,GAAG,CAAA,CAAA;AAAA,EACnC,CAAA,EAAG,EAAE,CAAA,CACJ,QAAA,CAAS,GAAG,CAAA;AAEf,EAAA,MAAM,QAAA,GAAW,UAAA,CAAW,IAAA,CAAK,MAAM,KAAK,CAAC,OAAA;AAE7C,EAAA,OAAO,WAAA,CAAY,MAAA,EAAQ,SAAA,IAAa,QAAA,IAAY,QAAQ,CAAA;AAC9D","file":"check-ambiguous.js","sourcesContent":["// __private-exports\n/*\n * Copyright 2024 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport { type Format, SYMBOLS, SYMBOL_PATTERNS } from '..';\nimport type { Tokens } from '../lexer';\nimport { pipesResult } from '../pipes';\n\nimport { simpler } from './simpler';\n\n/**\n * Look for groupings of numbers that are ambiguous; no indicators, or no\n * dividers and not possibility of deducing where a divider should be inserted.\n */\nexport function checkAmbiguousGrouping(tokens: Tokens, _format?: Format) {\n if (tokens.includes(SYMBOLS.DIVIDER)) {\n return pipesResult(tokens, false);\n }\n\n const simple = simpler(tokens);\n\n // 3-5 numbers after or before a single bearing indicator BNNN, NNNB\n const ambiguous = /^(?:(?:BN{3,5})|(?:N{3,5}B))$/.test(simple);\n // 3-5 numbers between 2 bearings indicators BNNNB\n const bookends = /^BN{3,5}B$/.test(simple);\n // \"helpful\" indicators:\n // 1. degrees number in the right-of-divider position e.g. # #°\n // 2. seconds number in the left-of-divider position e.g. # #\" #\n // 3. trailing bearings in the left-of-divider position e.g. # N #\n // 4. leading bearings in the right-of-divider position e.g. N # E #\n const helpful = tokens\n // helpful tokens are only helpful in the middle of the token list\n // not the beginning or end of the list\n .slice(1, -1)\n .reduce((acc, t) => {\n const helps =\n t.includes(SYMBOLS.DEGREES) ||\n t.includes(SYMBOLS.SECONDS) ||\n SYMBOL_PATTERNS.NSEW.test(t);\n\n return `${acc}${helps ? 'H' : '_'}`;\n }, '')\n .includes('H');\n // 3-5 numbers with no bearings indicators, and no helpful indicators\n const hopeless = /^N{3,5}$/.test(simple) && !helpful;\n\n return pipesResult(tokens, ambiguous || bookends || hopeless);\n}\n"]}
1
+ {"version":3,"sources":["../../../../../src/coordinates/latlon/internal/pipes/check-ambiguous.ts"],"names":[],"mappings":";;;;AAsBO,SAAS,sBAAA,CAAuB,QAAgB,OAAA,EAAkB;AACvE,EAAA,IAAI,MAAA,CAAO,QAAA,CAAS,OAAA,CAAQ,OAAO,CAAA,EAAG;AACpC,IAAA,OAAO,WAAA,CAAY,QAAQ,KAAK,CAAA;AAAA,EAClC;AAEA,EAAA,MAAM,MAAA,GAAS,QAAQ,MAAM,CAAA;AAG7B,EAAA,MAAM,SAAA,GAAY,+BAAA,CAAgC,IAAA,CAAK,MAAM,CAAA;AAE7D,EAAA,MAAM,QAAA,GAAW,YAAA,CAAa,IAAA,CAAK,MAAM,CAAA;AAMzC,EAAA,MAAM,OAAA,GAAU,OAGb,KAAA,CAAM,CAAA,EAAG,EAAE,CAAA,CACX,MAAA,CAAO,CAAC,GAAA,EAAK,CAAA,KAAM;AAClB,IAAA,MAAM,KAAA,GACJ,CAAA,CAAE,QAAA,CAAS,OAAA,CAAQ,OAAO,CAAA,IAC1B,CAAA,CAAE,QAAA,CAAS,OAAA,CAAQ,OAAO,CAAA,IAC1B,eAAA,CAAgB,IAAA,CAAK,KAAK,CAAC,CAAA;AAE7B,IAAA,OAAO,CAAA,EAAG,GAAG,CAAA,EAAG,KAAA,GAAQ,MAAM,GAAG,CAAA,CAAA;AAAA,EACnC,CAAA,EAAG,EAAE,CAAA,CACJ,QAAA,CAAS,GAAG,CAAA;AAEf,EAAA,MAAM,QAAA,GAAW,UAAA,CAAW,IAAA,CAAK,MAAM,KAAK,CAAC,OAAA;AAE7C,EAAA,OAAO,WAAA,CAAY,MAAA,EAAQ,SAAA,IAAa,QAAA,IAAY,QAAQ,CAAA;AAC9D","file":"check-ambiguous.js","sourcesContent":["// __private-exports\n/*\n * Copyright 2024 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport { type Format, SYMBOL_PATTERNS, SYMBOLS } from '..';\nimport { pipesResult } from '../pipes';\nimport { simpler } from './simpler';\nimport type { Tokens } from '../lexer';\n\n/**\n * Look for groupings of numbers that are ambiguous; no indicators, or no\n * dividers and not possibility of deducing where a divider should be inserted.\n */\nexport function checkAmbiguousGrouping(tokens: Tokens, _format?: Format) {\n if (tokens.includes(SYMBOLS.DIVIDER)) {\n return pipesResult(tokens, false);\n }\n\n const simple = simpler(tokens);\n\n // 3-5 numbers after or before a single bearing indicator BNNN, NNNB\n const ambiguous = /^(?:(?:BN{3,5})|(?:N{3,5}B))$/.test(simple);\n // 3-5 numbers between 2 bearings indicators BNNNB\n const bookends = /^BN{3,5}B$/.test(simple);\n // \"helpful\" indicators:\n // 1. degrees number in the right-of-divider position e.g. # #°\n // 2. seconds number in the left-of-divider position e.g. # #\" #\n // 3. trailing bearings in the left-of-divider position e.g. # N #\n // 4. leading bearings in the right-of-divider position e.g. N # E #\n const helpful = tokens\n // helpful tokens are only helpful in the middle of the token list\n // not the beginning or end of the list\n .slice(1, -1)\n .reduce((acc, t) => {\n const helps =\n t.includes(SYMBOLS.DEGREES) ||\n t.includes(SYMBOLS.SECONDS) ||\n SYMBOL_PATTERNS.NSEW.test(t);\n\n return `${acc}${helps ? 'H' : '_'}`;\n }, '')\n .includes('H');\n // 3-5 numbers with no bearings indicators, and no helpful indicators\n const hopeless = /^N{3,5}$/.test(simple) && !helpful;\n\n return pipesResult(tokens, ambi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QAAQ,KAAK,CAAA;AAClC","file":"check-numbers.js","sourcesContent":["// __private-exports\n/*\n * Copyright 2024 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport type { Tokens } from '../lexer';\nimport { pipesResult } from '../pipes';\n\nimport { simpler } from './simpler';\n\n/**\n * Check for problems in the numeric values.\n */\nexport function checkNumberValues(tokens: Tokens) {\n const simple = simpler(tokens);\n\n if ((simple.match(/N/g) ?? []).length < 2) {\n return pipesResult(tokens, 'Too few numbers.');\n }\n\n const error =\n // 4 consecutive numbers in specific formation is not going to be valid\n /(?:N{4,}BN+)|(?:N+BN{4,})/.test(simple) ||\n // more than 6 numbers total\n (simple.match(/N/g) ?? []).length > 6;\n\n if (error) {\n return pipesResult(tokens, 'Too many numbers.');\n }\n\n const pattern = tokens\n .reduce((acc, t) => {\n if (/\\d/.test(t)) {\n acc.push(Number.parseFloat(t) < 0 ? '-' : '+');\n } else {\n acc.push('_');\n }\n\n return acc;\n }, [] as string[])\n .join('');\n\n const matches = pattern.match(/[^_]-./);\n\n // special case '_--_' when the input is something like 'S -1 -1 W'\n // which is invalid for other reasons and will be caught elsewhere\n if (!!matches && pattern !== '_--_') {\n return pipesResult(tokens, 'Negative value for non-degrees value found.');\n }\n\n return pipesResult(tokens, false);\n}\n"]}
1
+ {"version":3,"sources":["../../../../../src/coordinates/latlon/internal/pipes/check-numbers.ts"],"names":[],"mappings":";;;AAoBO,SAAS,kBAAkB,MAAA,EAAgB;AAChD,EAAA,MAAM,MAAA,GAAS,QAAQ,MAAM,CAAA;AAE7B,EAAA,IAAA,CAAK,OAAO,KAAA,CAAM,IAAI,KAAK,EAAC,EAAG,SAAS,CAAA,EAAG;AACzC,IAAA,OAAO,WAAA,CAAY,QAAQ,kBAAkB,CAAA;AAAA,EAC/C;AAEA,EAAA,MAAM,KAAA;AAAA;AAAA,IAEJ,2BAAA,CAA4B,KAAK,MAAM,CAAA;AAAA,IAAA,CAEtC,OAAO,KAAA,CAAM,IAAI,CAAA,IAAK,IAAI,MAAA,GAAS;AAAA,GAAA;AAEtC,EAAA,IAAI,KAAA,EAAO;AACT,IAAA,OAAO,WAAA,CAAY,QAAQ,mBAAmB,CAAA;AAAA,EAChD;AAEA,EAAA,MAAM,OAAA,GAAU,MAAA,CACb,MAAA,CAAO,CAAC,KAAK,CAAA,KAAM;AAClB,IAAA,IAAI,IAAA,CAAK,IAAA,CAAK,CAAC,CAAA,EAAG;AAChB,MAAA,GAAA,CAAI,KAAK,MAAA,CAAO,UAAA,CAAW,CAAC,CAAA,GAAI,CAAA,GAAI,MAAM,GAAG,CAAA;AAAA,IAC/C,CAAA,MAAO;AACL,MAAA,GAAA,CAAI,KAAK,GAAG,CAAA;AAAA,IACd;AAEA,IAAA,OAAO,GAAA;AAAA,EACT,CAAA,EAAG,EAAc,CAAA,CAChB,KAAK,EAAE,CAAA;AAEV,EAAA,MAAM,OAAA,GAAU,OAAA,CAAQ,KAAA,CAAM,QAAQ,CAAA;AAItC,EAAA,IAAI,CAAC,CAAC,OAAA,IAAW,OAAA,KAAY,MAAA,EAAQ;AACnC,IAAA,OAAO,WAAA,CAAY,QAAQ,6CAA6C,CAAA;AAAA,EAC1E;AAEA,EAAA,OAAO,WAAA,CAAY,QAAQ,KAAK,CAAA;AAClC","file":"check-numbers.js","sourcesContent":["// __private-exports\n/*\n * Copyright 2024 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport { pipesResult } from '../pipes';\nimport { simpler } from './simpler';\nimport type { Tokens } from '../lexer';\n\n/**\n * Check for problems in the numeric values.\n */\nexport function checkNumberValues(tokens: Tokens) {\n const simple = simpler(tokens);\n\n if ((simple.match(/N/g) ?? []).length < 2) {\n return pipesResult(tokens, 'Too few numbers.');\n }\n\n const error =\n // 4 consecutive numbers in specific formation is not going to be valid\n /(?:N{4,}BN+)|(?:N+BN{4,})/.test(simple) ||\n // more than 6 numbers total\n (simple.match(/N/g) ?? []).length > 6;\n\n if (error) {\n return pipesResult(tokens, 'Too many numbers.');\n }\n\n const pattern = tokens\n .reduce((acc, t) => {\n if (/\\d/.test(t)) {\n acc.push(Number.parseFloat(t) < 0 ? '-' : '+');\n } else {\n acc.push('_');\n }\n\n return acc;\n }, [] as string[])\n .join('');\n\n const matches = pattern.match(/[^_]-./);\n\n // special case '_--_' when the input is something like 'S -1 -1 W'\n // which is invalid for other reasons and will be caught elsewhere\n if (!!matches && pattern !== '_--_') {\n return pipesResult(tokens, 'Negative value for non-degrees value found.');\n }\n\n return pipesResult(tokens, false);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/coordinates/latlon/internal/pipes/fix-bearings.ts"],"names":[],"mappings":";;AAiBA,MAAM,UAAA,GAAa;AAAA,EACjB,GAAG,QAAA,CAAS,GAAA;AAAA,EACZ,GAAG,QAAA,CAAS,GAAA;AAAA,EACZ,GAAG,QAAA,CAAS,GAAA;AAAA,EACZ,GAAG,QAAA,CAAS;AACd,CAAA;AAEA,MAAM,0BAAA,GAA6B,CAAC,MAAA,KAClC,MAAA,CAAO,CAAC,CAAA,IACR,MAAA,CAAO,CAAC,CAAA,IACR,eAAA,CAAgB,aAAA,CAAc,IAAA,CAAK,MAAA,CAAO,C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AA,IACL;AAAA,MACE,GAAG,IAAA,CAAK,GAAA,CAAI,UAAU,CAAA;AAAA,MACtB,WAAA;AAAA,MACA,OAAA,CAAQ,OAAA;AAAA,MACR,GAAG,KAAA,CAAM,GAAA,CAAI,UAAU,CAAA;AAAA,MACvB;AAAA,KACF;AAAA,IACA;AAAA,GACF;AACF;AAQA,SAAS,mBAAmB,KAAA,EAAe;AACzC,EAAA,OAAO,KAAA,CAAM,MAAA,CAAO,CAAC,GAAA,EAAK,CAAA,KAAM;AAC9B,IAAA,IAAI,IAAA,CAAK,IAAA,CAAK,CAAC,CAAA,EAAG;AAChB,MAAA,GAAA,CAAI,KAAK,CAAC,CAAA;AAAA,IACZ,CAAA,MAAO;AACL,MAAA,GAAA,CAAI,QAAQ,CAAC,CAAA;AAAA,IACf;AAEA,IAAA,OAAO,GAAA;AAAA,EACT,CAAA,EAAG,EAAY,CAAA;AACjB","file":"fix-bearings.js","sourcesContent":["// __private-exports\n/*\n * Copyright 2024 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport { BEARINGS, type Format, SYMBOLS, SYMBOL_PATTERNS } from '..';\nimport type { Tokens } from '../lexer';\nimport type { PipeResult } from '../pipes';\n\nconst orthogonal = {\n N: BEARINGS.LON,\n S: BEARINGS.LON,\n E: BEARINGS.LAT,\n W: BEARINGS.LAT,\n};\n\nconst bearingConflictsWithNumber = (tokens: Tokens) =>\n tokens[0] &&\n tokens[1] &&\n SYMBOL_PATTERNS.NEGATIVE_SIGN.test(tokens[1]) &&\n SYMBOL_PATTERNS.NSEW.test(tokens[0]) &&\n !SYMBOL_PATTERNS.NEGATIVE_BEARINGS.test(tokens[0]);\n\nconst bePositive = (n: string) => n.replace(SYMBOL_PATTERNS.NEGATIVE_SIGN, '');\n\nconst conflict = ([a, b]: Tokens) =>\n `Bearing (${a}) conflicts with negative number (${b}).`;\n\n/**\n * Normalize bearings - negative and positive numeric values to NSEW - and\n * positioning of bearings - after the numeric values - and fill in any missing\n * bearings if only one is provided.\n */\nexport function fixBearings(tokens: Tokens, format?: Format): PipeResult {\n const [left, right] = [\n tokens.slice(0, tokens.indexOf(SYMBOLS.DIVIDER)),\n tokens.slice(1 + tokens.indexOf(SYMBOLS.DIVIDER)),\n ].map(moveBearingsToHead) as [Tokens, Tokens];\n\n if (bearingConflictsWithNumber(left)) {\n return [[], conflict(left)];\n }\n\n if (bearingConflictsWithNumber(right)) {\n return [[], conflict(right)];\n }\n\n const [leftHasBearing, rightHasBearing] = [left, right].map(\n (list) => !!(list?.[0] && SYMBOL_PATTERNS.NSEW.test(list[0])),\n );\n\n let leftBearing = '';\n let rightBearing = '';\n\n if (leftHasBearing && rightHasBearing) {\n leftBearing = left.shift() ?? '';\n rightBearing = right.shift() ?? '';\n } else if (leftHasBearing) {\n leftBearing = left.shift() ?? '';\n rightBearing =\n orthogonal[leftBearing as keyof typeof orthogonal][\n +SYMBOL_PATTERNS.NEGATIVE_SIGN.test(right[0] ?? '') as 0 | 1\n ];\n } else if (rightHasBearing) {\n rightBearing = right.shift() ?? '';\n leftBearing =\n orthogonal[rightBearing as keyof typeof orthogonal][\n +SYMBOL_PATTERNS.NEGATIVE_SIGN.test(right[0] ?? '') as 0 | 1\n ];\n } else if (format) {\n leftBearing = `${BEARINGS[format][0][+SYMBOL_PATTERNS.NEGATIVE_SIGN.test(`${left[0]}`)]}`;\n rightBearing = `${BEARINGS[format][1][+SYMBOL_PATTERNS.NEGATIVE_SIGN.test(`${right[0]}`)]}`;\n } else {\n // neither exist\n return [[...left, SYMBOLS.DIVIDER, ...right], false];\n }\n\n return [\n [\n ...left.map(bePositive),\n leftBearing,\n SYMBOLS.DIVIDER,\n ...right.map(bePositive),\n rightBearing,\n ],\n false,\n ];\n}\n\n/**\n * Move the bearings indicators to the first element in the list - in this\n * module only - so that it is easier to work with; moving a bearing to the\n * \"head\" allows for `push()` of subsequent number processing will keep the\n * order of the numeric values intact.\n */\nfunction moveBearingsToHead(coord: Tokens) {\n return coord.reduce((acc, t) => {\n if (/\\d/.test(t)) {\n acc.push(t);\n } else {\n acc.unshift(t);\n }\n\n return acc;\n }, [] as Tokens);\n}\n"]}
1
+ {"version":3,"sources":["../../../../../src/coordinates/latlon/internal/pipes/fix-bearings.ts"],"names":[],"mappings":";;AAiBA,MAAM,UAAA,GAAa;AAAA,EACjB,GAAG,QAAA,CAAS,GAAA;AAAA,EACZ,GAAG,QAAA,CAAS,GAAA;AAAA,EACZ,GAAG,QAAA,CAAS,GAAA;AAAA,EACZ,GAAG,QAAA,CAAS;AACd,CAAA;AAEA,MAAM,0BAAA,GAA6B,CAAC,MAAA,KAClC,MAAA,CAAO,CAAC,CAAA,IACR,MAAA,CAAO,CAAC,CAAA,IACR,eAAA,CAAgB,aAAA,CAAc,IAAA,CAAK,MAAA,CAAO,CAAC,CAAC,CAAA,IAC5C,eAAA,CAAgB,IAAA,CAAK,IAAA,CAAK,MAAA,CAAO,CAAC,CAAC,CAAA,IACnC,CAAC,eAAA,CAAgB,iBAAA,CAAkB,IAAA,CAAK,MAAA,CAAO,CAAC,CAAC,CAAA;AAEnD,MAAM,aAAa,CAAC,CAAA,KAAc,EAAE,OAAA,CAAQ,eAAA,CAAgB,eAAe,EAAE,CAAA;AAE7E,MAAM,QAAA,GAAW,CAAC,CAAC,CAAA,EAAG,CAAC,CAAA,KACrB,CAAA,SAAA,EAAY,CAAC,CAAA,kCAAA,EAAqC,CAAC,CAAA,EAAA,CAAA;AAO9C,SAAS,WAAA,CAAY,QAAgB,MAAA,EAA6B;AACvE,EAAA,MAAM,CAAC,IAAA,EAAM,KAAK,CAAA,GAAI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;AAEA,IAAA,OAAO,GAAA;AAAA,EACT,CAAA,EAAG,EAAY,CAAA;AACjB","file":"fix-bearings.js","sourcesContent":["// __private-exports\n/*\n * Copyright 2024 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport { BEARINGS, type Format, SYMBOL_PATTERNS, SYMBOLS } from '..';\nimport type { Tokens } from '../lexer';\nimport type { PipeResult } from '../pipes';\n\nconst orthogonal = {\n N: BEARINGS.LON,\n S: BEARINGS.LON,\n E: BEARINGS.LAT,\n W: BEARINGS.LAT,\n};\n\nconst bearingConflictsWithNumber = (tokens: Tokens) =>\n tokens[0] &&\n tokens[1] &&\n SYMBOL_PATTERNS.NEGATIVE_SIGN.test(tokens[1]) &&\n SYMBOL_PATTERNS.NSEW.test(tokens[0]) &&\n !SYMBOL_PATTERNS.NEGATIVE_BEARINGS.test(tokens[0]);\n\nconst bePositive = (n: string) => n.replace(SYMBOL_PATTERNS.NEGATIVE_SIGN, '');\n\nconst conflict = ([a, b]: Tokens) =>\n `Bearing (${a}) conflicts with negative number (${b}).`;\n\n/**\n * Normalize bearings - negative and positive numeric values to NSEW - and\n * positioning of bearings - after the numeric values - and fill in any missing\n * bearings if only one is provided.\n */\nexport function fixBearings(tokens: Tokens, format?: Format): PipeResult {\n const [left, right] = [\n tokens.slice(0, tokens.indexOf(SYMBOLS.DIVIDER)),\n tokens.slice(1 + tokens.indexOf(SYMBOLS.DIVIDER)),\n ].map(moveBearingsToHead) as [Tokens, Tokens];\n\n if (bearingConflictsWithNumber(left)) {\n return [[], conflict(left)];\n }\n\n if (bearingConflictsWithNumber(right)) {\n return [[], conflict(right)];\n }\n\n const [leftHasBearing, rightHasBearing] = [left, right].map(\n (list) => !!(list?.[0] && SYMBOL_PATTERNS.NSEW.test(list[0])),\n );\n\n let leftBearing = '';\n let rightBearing = '';\n\n if (leftHasBearing && rightHasBearing) {\n leftBearing = left.shift() ?? '';\n rightBearing = right.shift() ?? '';\n } else if (leftHasBearing) {\n leftBearing = left.shift() ?? '';\n rightBearing =\n orthogonal[leftBearing as keyof typeof orthogonal][\n +SYMBOL_PATTERNS.NEGATIVE_SIGN.test(right[0] ?? '') as 0 | 1\n ];\n } else if (rightHasBearing) {\n rightBearing = right.shift() ?? '';\n leftBearing =\n orthogonal[rightBearing as keyof typeof orthogonal][\n +SYMBOL_PATTERNS.NEGATIVE_SIGN.test(right[0] ?? '') as 0 | 1\n ];\n } else if (format) {\n leftBearing = `${BEARINGS[format][0][+SYMBOL_PATTERNS.NEGATIVE_SIGN.test(`${left[0]}`)]}`;\n rightBearing = `${BEARINGS[format][1][+SYMBOL_PATTERNS.NEGATIVE_SIGN.test(`${right[0]}`)]}`;\n } else {\n // neither exist\n return [[...left, SYMBOLS.DIVIDER, ...right], false];\n }\n\n return [\n [\n ...left.map(bePositive),\n leftBearing,\n SYMBOLS.DIVIDER,\n ...right.map(bePositive),\n rightBearing,\n ],\n false,\n ];\n}\n\n/**\n * Move the bearings indicators to the first element in the list - in this\n * module only - so that it is easier to work with; moving a bearing to the\n * \"head\" allows for `push()` of subsequent number processing will keep the\n * order of the numeric values intact.\n */\nfunction moveBearingsToHead(coord: Tokens) {\n return coord.reduce((acc, t) => {\n if (/\\d/.test(t)) {\n acc.push(t);\n } else {\n acc.unshift(t);\n }\n\n return acc;\n }, [] as Tokens);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/coordinates/latlon/internal/pipes/fix-dividers.ts"],"names":[],"mappings":";;;;AAqBA,MAAM,gBAAA,GAAmB;AAAA,EACvB,EAAA,EAAI,CAAA;AAAA,EACJ,GAAA,EAAK,CAAA;AAAA,EACL,IAAA,EAAM,CAAA;AAAA,EACN,GAAA,EAAK;AACP,CAAA;AAEA,MAAM,aAAA,GAAgB,CAAC,MAAA,EAAgB,KAAA,KAA8B;AAAA,EACnE,CAAC,GAAG,MAAA,CAAO,KAAA,CAAM,CAAA,EAAG,KAAK,CAAA,EAAG,OAAA,CAAQ,OAAA,EAAS,GAAG,MAAA,CAAO,KAAA,CAAM,KAAK,CAAC,CAAA;AAAA,EACnE;AACF,CAAA;AAUO,SAAS,UAAA,CAAW,UAAkB,OAAA,EAA8B;AAEzE,EAAA,IAAI,QAAA,CAAS,QAAA,CAAS,OAAA,CAAQ,OAAO,CAAA,EAAG;AACtC,IAAA,OAAO,CAAC,UAAU,KAAK,CAAA;AAAA,EACzB;AAGA,EAAA,MAAM,MAAA,GAAS,QAAA,CAAS,KAAA,CAAM,CAAC,CAAA;AAE/B,EAAA,MAAM,WAAA,GAAc,eAAe,MAAM,CAAA;AAEzC,EAAA,IAAI,WAAA,EAAa;AACf,IAAA,OAAO,aAAA,CAAc,QAAQ,WAAW,CAAA;AAAA,EAC1C;AAEA,EAAA,MAAM,MAAA,GAAS,QAAQ,MAAM,CAAA;AAE7B,EAAA,IAAI,gBAAA,CAAiB,MAAM,CAAA,EAAG;AAC5B,IAAA,OAAO,aAAA,CAAc,MAAA,EAAQ,gBAAA,CAAiB,MAAM,CAAC,CAAA;AAAA,EACvD;AAIA,EAAA,OAAO,CAAC,EAAC,EAAG,IAAI,CAAA;AAClB","file":"fix-dividers.js","sourcesContent":["// __private-exports\n/*\n * Copyright 2024 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport { type Format, SYMBOLS } from '..';\nimport type { Tokens } from '../lexer';\nimport type { PipeResult } from '../pipes';\nimport { getGenomeIndex } from './genome';\nimport { simpler } from './simpler';\n\n// N = number\n// B = bearing\nconst SIMPLER_PATTERNS = {\n NN: 1,\n NNB: 1,\n BNNB: 2,\n BNN: 2,\n};\n\nconst insertDivider = (tokens: Tokens, index: number): PipeResult => [\n [...tokens.slice(0, index), SYMBOLS.DIVIDER, ...tokens.slice(index)],\n false,\n];\n\n/**\n * For tokens lists without a divider, `fixDivider` attempts to determine the\n * __safe__ location to add a divider based on the existing formatting of the\n * coordinate: numbers, number positions, and number indicators.\n *\n * @remarks\n * pure function\n */\nexport function fixDivider(original: Tokens, _format?: Format): PipeResult {\n // if there is already a divider then there is nothing to do\n if (original.includes(SYMBOLS.DIVIDER)) {\n return [original, false];\n }\n\n // disconnect from argument memory space so we aren't working on shared memory\n const tokens = original.slice(0);\n\n const genomeIndex = getGenomeIndex(tokens);\n\n if (genomeIndex) {\n return insertDivider(tokens, genomeIndex);\n }\n\n const simple = simpler(tokens) as keyof typeof SIMPLER_PATTERNS;\n\n if (SIMPLER_PATTERNS[simple]) {\n return insertDivider(tokens, SIMPLER_PATTERNS[simple]);\n }\n\n // no position is found to be a safe location to insert a divider; any placement\n // would be a guess and therefor only has a 50% chance of being wrong or right\n return [[], true];\n}\n"]}
1
+ {"version":3,"sources":["../../../../../src/coordinates/latlon/internal/pipes/fix-dividers.ts"],"names":[],"mappings":";;;;AAqBA,MAAM,gBAAA,GAAmB;AAAA,EACvB,EAAA,EAAI,CAAA;AAAA,EACJ,GAAA,EAAK,CAAA;AAAA,EACL,IAAA,EAAM,CAAA;AAAA,EACN,GAAA,EAAK;AACP,CAAA;AAEA,MAAM,aAAA,GAAgB,CAAC,MAAA,EAAgB,KAAA,KAA8B;AAAA,EACnE,CAAC,GAAG,MAAA,CAAO,KAAA,CAAM,CAAA,EAAG,KAAK,CAAA,EAAG,OAAA,CAAQ,OAAA,EAAS,GAAG,MAAA,CAAO,KAAA,CAAM,KAAK,CAAC,CAAA;AAAA,EACnE;AACF,CAAA;AAUO,SAAS,UAAA,CAAW,UAAkB,OAAA,EAA8B;AAEzE,EAAA,IAAI,QAAA,CAAS,QAAA,CAAS,OAAA,CAAQ,OAAO,CAAA,EAAG;AACtC,IAAA,OAAO,CAAC,UAAU,KAAK,CAAA;AAAA,EACzB;AAGA,EAAA,MAAM,MAAA,GAAS,QAAA,CAAS,KAAA,CAAM,CAAC,CAAA;AAE/B,EAAA,MAAM,WAAA,GAAc,eAAe,MAAM,CAAA;AAEzC,EAAA,IAAI,WAAA,EAAa;AACf,IAAA,OAAO,aAAA,CAAc,QAAQ,WAAW,CAAA;AAAA,EAC1C;AAEA,EAAA,MAAM,MAAA,GAAS,QAAQ,MAAM,CAAA;AAE7B,EAAA,IAAI,gBAAA,CAAiB,MAAM,CAAA,EAAG;AAC5B,IAAA,OAAO,aAAA,CAAc,MAAA,EAAQ,gBAAA,CAAiB,MAAM,CAAC,CAAA;AAAA,EACvD;AAIA,EAAA,OAAO,CAAC,EAAC,EAAG,IAAI,CAAA;AAClB","file":"fix-dividers.js","sourcesContent":["// __private-exports\n/*\n * Copyright 2024 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport { type Format, SYMBOLS } from '..';\nimport { getGenomeIndex } from './genome';\nimport { simpler } from './simpler';\nimport type { Tokens } from '../lexer';\nimport type { PipeResult } from '../pipes';\n\n// N = number\n// B = bearing\nconst SIMPLER_PATTERNS = {\n NN: 1,\n NNB: 1,\n BNNB: 2,\n BNN: 2,\n};\n\nconst insertDivider = (tokens: Tokens, index: number): PipeResult => [\n [...tokens.slice(0, index), SYMBOLS.DIVIDER, ...tokens.slice(index)],\n false,\n];\n\n/**\n * For tokens lists without a divider, `fixDivider` attempts to determine the\n * __safe__ location to add a divider based on the existing formatting of the\n * coordinate: numbers, number positions, and number indicators.\n *\n * @remarks\n * pure function\n */\nexport function fixDivider(original: Tokens, _format?: Format): PipeResult {\n // if there is already a divider then there is nothing to do\n if (original.includes(SYMBOLS.DIVIDER)) {\n return [original, false];\n }\n\n // disconnect from argument memory space so we aren't working on shared memory\n const tokens = original.slice(0);\n\n const genomeIndex = getGenomeIndex(tokens);\n\n if (genomeIndex) {\n return insertDivider(tokens, genomeIndex);\n }\n\n const simple = simpler(tokens) as keyof typeof SIMPLER_PATTERNS;\n\n if (SIMPLER_PATTERNS[simple]) {\n return insertDivider(tokens, SIMPLER_PATTERNS[simple]);\n }\n\n // no position is found to be a safe location to insert a divider; any placement\n // would be a guess and therefor only has a 50% chance of being wrong or right\n return [[], true];\n}\n"]}
@@ -28,7 +28,7 @@ function genomeSequencer(acc, t) {
28
28
  }
29
29
  function getGenomeIndex(tokens) {
30
30
  const seq = tokens.reduce(genomeSequencer, "");
31
- return GENOME_PATTERN.test(seq) ? Number.parseInt(seq.replace(GENOME_PATTERN, dividerIndexer)) : 0;
31
+ return GENOME_PATTERN.test(seq) ? Number.parseInt(seq.replace(GENOME_PATTERN, dividerIndexer), 10) : 0;
32
32
  }
33
33
 
34
34
  export { getGenomeIndex };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/coordinates/latlon/internal/pipes/genome.ts"],"names":[],"mappings":";;AAgBA,MAAM,cAAA,GACJ,0DAAA;AAOF,SAAS,cAAA,CAAe,UAAkB,IAAA,EAAgB;AACxD,EAAA,MAAM,CAAC,QAAA,GAAW,EAAA,EAAI,SAAS,QAAA,GAAW,EAAA,EAAI,OAAO,CAAA,GAAI,IAAA;AA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,CAAA;AACN","file":"genome.js","sourcesContent":["// __private-exports\n/*\n * Copyright 2024 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport { SYMBOLS, SYMBOL_PATTERNS } from '..';\nimport type { Tokens } from '../lexer';\n\nconst GENOME_PATTERN =\n /^(B?)([DN]?[MN]?[SN]?)(B?)(?:B?)([DN]?[MN]?[SN]?)(?:B?)$/;\n\n/**\n * Get the position (index) of where to insert a divider into the token list;\n * basically, the count of numeric components (left-of-divider position) plus\n * 1 if there is a bearing identifier (left-of-divider).\n */\nfunction dividerIndexer(_full: string, ...args: string[]) {\n const [bearing1 = '', number1, bearing2 = '', number2] = args;\n\n // if no numeric values exist there no way to infer a location to insert a divider\n if (!(number1?.length && number2?.length)) {\n return '0';\n }\n\n return `${number1.length + (bearing1.length || bearing2.length)}`;\n}\n\n/**\n * The genome sequence is a simplification of the tokens list:\n *\n * - B = bearings (NSEW)\n * - D = degrees (number with degree character following)\n * - M = minutes (number with minutes character following)\n * - S = seconds (number with seconds character following)\n * - N = number (no identifying character following)\n * - X = for unmatched token types\n */\nfunction genomeSequencer(acc: string, t: string) {\n if (t.includes(SYMBOLS.DEGREES)) {\n return `${acc}D`;\n }\n\n if (t.includes(SYMBOLS.MINUTES)) {\n return `${acc}M`;\n }\n\n if (t.includes(SYMBOLS.SECONDS)) {\n return `${acc}S`;\n }\n\n if (SYMBOL_PATTERNS.NSEW.test(t)) {\n return `${acc}B`;\n }\n\n if (/\\d/.test(t)) {\n return `${acc}N`;\n }\n\n return `${acc}X`;\n}\n\n/**\n * Use the \"genome\" sequence of the token list to find the index for inserting\n * a missing divider token.\n */\nexport function getGenomeIndex(tokens: Tokens) {\n const seq = tokens.reduce(genomeSequencer, '');\n\n return GENOME_PATTERN.test(seq)\n ? Number.parseInt(seq.replace(GENOME_PATTERN, dividerIndexer))\n : 0;\n}\n"]}
1
+ {"version":3,"sources":["../../../../../src/coordinates/latlon/internal/pipes/genome.ts"],"names":[],"mappings":";;AAgBA,MAAM,cAAA,GACJ,0DAAA;AAOF,SAAS,cAAA,CAAe,UAAkB,IAAA,EAAgB;AACxD,EAAA,MAAM,CAAC,QAAA,GAAW,EAAA,EAAI,SAAS,QAAA,GAAW,EAAA,EAAI,OAAO,CAAA,GAAI,IAAA;AAGzD,EAAA,IAAI,EAAE,OAAA,EAAS,MAAA,IAAU,OAAA,EAAS,MAAA,CAAA,EAAS;AACzC,IAAA,OAAO,GAAA;AAAA,EACT;AAEA,EAAA,OAAO,GAAG,OAAA,CAAQ,MAAA,IAAU,QAAA,CAAS,MAAA,IAAU,SAAS,MAAA,CAAO,CAAA,CAAA;AACjE;AAYA,SAAS,eAAA,CAAgB,KAAa,CAAA,EAAW;AAC/C,EAAA,IAAI,CAAA,CAAE,QAAA,CAAS,OAAA,CAAQ,OAAO,CAAA,EAAG;AAC/B,IAAA,OAAO,GAAG,GAAG,CAAA,CAAA,CAAA;AAAA,EACf;AAEA,EAAA,IAAI,CAAA,CAAE,QAAA,CAAS,OAAA,CAAQ,OAAO,CAAA,EAAG;AAC/B,IAAA,OAAO,GAAG,GAAG,CAAA,CAAA,CAAA;AAAA,EACf;AAEA,EAAA,IAAI,CAAA,CAAE,QAAA,CAAS,OAAA,CAAQ,OAAO,CAAA,EAAG;AAC/B,IAAA,OAAO,GAAG,GAAG,CAAA,CAAA,CAAA;AAAA,EACf;AAEA,EAAA,IAAI,eAAA,CAAgB,IAAA,CAAK,IAAA,CAAK,CAAC,CAAA,EAAG;AAChC,IAAA,OAAO,GAAG,GAAG,CAAA,CAAA,CAAA;AAAA,EACf;AAEA,EAAA,IAAI,IAAA,CAAK,IAAA,CAAK,CAAC,CAAA,EAAG;AAChB,IAAA,OAAO,GAAG,GAAG,CAAA,CAAA,CAAA;AAAA,EACf;AAEA,EAAA,OAAO,GAAG,GAAG,CAAA,CAAA,CAAA;AACf;AAMO,SAAS,eAAe,MAAA,EAAgB;AAC7C,EAAA,MAAM,GAAA,GAAM,MAAA,CAAO,MAAA,CAAO,eAAA,EAAiB,EAAE,CAAA;AAE7C,EAAA,OAAO,cAAA,CAAe,IAAA,CAAK,GAAG,CAAA,GAC1B,MAAA,CAAO,QAAA,CAAS,GAAA,CAAI,OAAA,CAAQ,cAAA,EAAgB,cAAc,CAAA,EAAG,EAAE,CAAA,GAC/D,CAAA;AACN","file":"genome.js","sourcesContent":["// __private-exports\n/*\n * Copyright 2024 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport { SYMBOL_PATTERNS, SYMBOLS } from '..';\nimport type { Tokens } from '../lexer';\n\nconst GENOME_PATTERN =\n /^(B?)([DN]?[MN]?[SN]?)(B?)(?:B?)([DN]?[MN]?[SN]?)(?:B?)$/;\n\n/**\n * Get the position (index) of where to insert a divider into the token list;\n * basically, the count of numeric components (left-of-divider position) plus\n * 1 if there is a bearing identifier (left-of-divider).\n */\nfunction dividerIndexer(_full: string, ...args: string[]) {\n const [bearing1 = '', number1, bearing2 = '', number2] = args;\n\n // if no numeric values exist there no way to infer a location to insert a divider\n if (!(number1?.length && number2?.length)) {\n return '0';\n }\n\n return `${number1.length + (bearing1.length || bearing2.length)}`;\n}\n\n/**\n * The genome sequence is a simplification of the tokens list:\n *\n * - B = bearings (NSEW)\n * - D = degrees (number with degree character following)\n * - M = minutes (number with minutes character following)\n * - S = seconds (number with seconds character following)\n * - N = number (no identifying character following)\n * - X = for unmatched token types\n */\nfunction genomeSequencer(acc: string, t: string) {\n if (t.includes(SYMBOLS.DEGREES)) {\n return `${acc}D`;\n }\n\n if (t.includes(SYMBOLS.MINUTES)) {\n return `${acc}M`;\n }\n\n if (t.includes(SYMBOLS.SECONDS)) {\n return `${acc}S`;\n }\n\n if (SYMBOL_PATTERNS.NSEW.test(t)) {\n return `${acc}B`;\n }\n\n if (/\\d/.test(t)) {\n return `${acc}N`;\n }\n\n return `${acc}X`;\n}\n\n/**\n * Use the \"genome\" sequence of the token list to find the index for inserting\n * a missing divider token.\n */\nexport function getGenomeIndex(tokens: Tokens) {\n const seq = tokens.reduce(genomeSequencer, '');\n\n return GENOME_PATTERN.test(seq)\n ? Number.parseInt(seq.replace(GENOME_PATTERN, dividerIndexer), 10)\n : 0;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/coordinates/latlon/internal/pipes/index.ts"],"names":[],"mappings":";;;;;;AA0BA,MAAM,UAAA,GAAa,CAAC,CAAA,KAClB,IAAI,OAAO,eAAA,CAAgB,CAAC,GAAG,GAAG,CAAA;AAW7B,MAAM,WAAA,GAAc,CAAC,CAAA,EAAW,CAAA,KAAoC;AAAA;AAAA,EAEzE,CAAA,GAAI,EAAC,GAAI,CAAA;AAAA,EACT;AACF;AAGA,MAAM,UAAU,CAAC,CAAA,KAAc,CAAC,CAAA,KAC9B,YAAY,CAAA,EAAA,CAAI,CAAA,CAAE,IAAA,CAAK,EAAE,EAAE,KAAA,CAAM,CAAC,KAAK,EAAC,EAAG,SAAS,CAAC,CAAA;AAEvD,MAAM,KAAA,GAA0B;AAAA;AAAA,EAE9B,CAAC,oBAAA,EAAsB,OAAA,CAAQ,UAAA,CAAW,MAAM,CAAC,CAAC,CAAA;AAAA,EAClD,CAAC,yBAAA,EAA2B,OAAA,CAAQ,OAAO,CAAC,CAAA;AAAA,EAC5C,CAAC,8BAAA,EAAgC,OAAA,CAAQ,UAAA,CAAW,SAAS,CAAC,CAAC,CAAA;AAAA,EAC/D,CAAC,8BAAA,EAAgC,OAAA,CAAQ,UAAA,CAAW,SAAS,CAAC,CAAC,CAAA;AAAA,EAC/D,CAAC,8BAAA,EAAgC,OAAA,CAAQ,UAAA,CAAW,SAAS,CAAC,CAAC,CAAA;AAAA,EAC/D,CAAC,yBAAyB,iBAAiB,CAAA;AAAA,EAC3C,CAAC,kDAAkD,sBAAsB,CAAA;AAAA;AAAA,EAGzE,CAAC,+CAA+C,UAAU,CAAA;AAAA,EAC1D,CAAC,gCAAgC,WAAW;AAC9C,CAAA;AAQO,SAAS,WAAA,CACd,QACA,MAAA,EACoB;AACpB,EAAA,IAAI,IAAA,GAAO,MAAA,CAAO,KAAA,CAAM,CAAC,CAAA;AACzB,EAAA,IAAI,KAAA,GAAuB,KAAA;AAC3B,EAAA,MAAM,SAAS,EAAC;AAEhB,EAAA,KAAA,MAAW,CAAC,OAAA,EAAS,EAAE,CAAA,IAAK,KAAA,EAAO;AACjC,IAAA,CAAC,IAAA,EAAM,KAAK,CAAA,GAAI,EAAA,CAAG,MAAM,MAAM,CAAA;AAE/B,IAAA,IAAI,KAAA,EAAO;AAGT,MAAA,MAAA,CAAO,IAAA,CAAK,KAAA,KAAU,IAAA,GAAO,OAAA,GAAU,KAAK,CAAA;AAE5C,MAAA,IAAI,CAAC,KAAK,MAAA,EAAQ;AAChB,QAAA,OAAO,CAAC,IAAA,EAAM,CAAC,UAAU,IAAA,GAAO,OAAA,GAAU,KAAK,CAAC,CAAA;AAAA,MAClD;AAAA,IACF;AAAA,EACF;AAEA,EAAA,OAAO,CAAC,MAAM,MAAM,CAAA;AACtB","file":"index.js","sourcesContent":["// __private-exports\n/*\n * Copyright 2024 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport { type Format, SYMBOL_PATTERNS } from '..';\nimport type { Tokens } from '../lexer';\n\nimport { checkAmbiguousGrouping } from './check-ambiguous';\nimport { checkNumberValues } from './check-numbers';\nimport { fixBearings } from './fix-bearings';\nimport { fixDivider } from './fix-dividers';\n\ntype Pipe = (t: Tokens, f?: Format) => [Tokens, boolean | string];\n\nexport type PipeResult = ReturnType<Pipe>;\n\n/** Make a RegExp global. */\nconst makeGlobal = (k: keyof typeof SYMBOL_PATTERNS) =>\n new RegExp(SYMBOL_PATTERNS[k], 'g');\n\n/**\n * Consistently create a PipesResult array to return. Use this instead of\n * casting to PipesResult everywhere.\n *\n * @param e true = has error, false = no error\n *\n * @remarks\n * pure function\n */\nexport const pipesResult = (t: Tokens, e: boolean | string): PipeResult => [\n // if there are errors do NOT return the tokens\n e ? [] : t,\n e,\n];\n\n/** Check if there are more than 2 of something. */\nconst tooMany = (p: RegExp) => (t: Tokens) =>\n pipesResult(t, (t.join('').match(p) ?? []).length > 2);\n\nconst pipes: [string, Pipe][] = [\n // Unrecoverable violations\n ['Too many bearings.', tooMany(makeGlobal('NSEW'))],\n ['Too many numeric signs.', tooMany(/[-+]/g)],\n ['Too many degrees indicators.', tooMany(makeGlobal('DEGREES'))],\n ['Too many minutes indicators.', tooMany(makeGlobal('MINUTES'))],\n ['Too many seconds indicators.', tooMany(makeGlobal('SECONDS'))],\n ['Number values checks.', checkNumberValues],\n ['Ambiguous grouping of numbers with no divider.', checkAmbiguousGrouping],\n\n // fix values and formatting to be consistent\n ['Unable to identify latitude from longitude.', fixDivider],\n ['Unable to identify bearings.', fixBearings],\n];\n\n/**\n * Run the tokens through a preset pipeline of violations checks exiting the\n * process as early as possible when violations are found because violations\n * will make further violations checks less accurate and could return inaccurate\n * violations that could be misleading or hide the most important violation\n */\nexport function pipesRunner(\n tokens: Tokens,\n format?: Format,\n): [Tokens, string[]] {\n let copy = tokens.slice(0);\n let error: PipeResult[1] = false;\n const errors = [] as string[];\n\n for (const [message, op] of pipes) {\n [copy, error] = op(copy, format);\n\n if (error) {\n // accumulate the \"errors\" because if tokens are returned\n // the errors are only warnings and are recoverable\n errors.push(error === true ? message : error);\n\n if (!copy.length) {\n return [copy, [error === true ? message : error]];\n }\n }\n }\n\n return [copy, errors];\n}\n"]}
1
+ {"version":3,"sources":["../../../../../src/coordinates/latlon/internal/pipes/index.ts"],"names":[],"mappings":";;;;;;AAyBA,MAAM,UAAA,GAAa,CAAC,CAAA,KAClB,IAAI,OAAO,eAAA,CAAgB,CAAC,GAAG,GAAG,CAAA;AAW7B,MAAM,WAAA,GAAc,CAAC,CAAA,EAAW,CAAA,KAAoC;AAAA;AAAA,EAEzE,CAAA,GAAI,EAAC,GAAI,CAAA;AAAA,EACT;AACF;AAGA,MAAM,UAAU,CAAC,CAAA,KAAc,CAAC,CAAA,KAC9B,YAAY,CAAA,EAAA,CAAI,CAAA,CAAE,IAAA,CAAK,EAAE,EAAE,KAAA,CAAM,CAAC,KAAK,EAAC,EAAG,SAAS,CAAC,CAAA;AAEvD,MAAM,KAAA,GAA0B;AAAA;AAAA,EAE9B,CAAC,oBAAA,EAAsB,OAAA,CAAQ,UAAA,CAAW,MAAM,CAAC,CAAC,CAAA;AAAA,EAClD,CAAC,yBAAA,EAA2B,OAAA,CAAQ,OAAO,CAAC,CAAA;AAAA,EAC5C,CAAC,8BAAA,EAAgC,OAAA,CAAQ,UAAA,CAAW,SAAS,CAAC,CAAC,CAAA;AAAA,EAC/D,CAAC,8BAAA,EAAgC,OAAA,CAAQ,UAAA,CAAW,SAAS,CAAC,CAAC,CAAA;AAAA,EAC/D,CAAC,8BAAA,EAAgC,OAAA,CAAQ,UAAA,CAAW,SAAS,CAAC,CAAC,CAAA;AAAA,EAC/D,CAAC,yBAAyB,iBAAiB,CAAA;AAAA,EAC3C,CAAC,kDAAkD,sBAAsB,CAAA;AAAA;AAAA,EAGzE,CAAC,+CAA+C,UAAU,CAAA;AAAA,EAC1D,CAAC,gCAAgC,WAAW;AAC9C,CAAA;AAQO,SAAS,WAAA,CACd,QACA,MAAA,EACoB;AACpB,EAAA,IAAI,IAAA,GAAO,MAAA,CAAO,KAAA,CAAM,CAAC,CAAA;AACzB,EAAA,IAAI,KAAA,GAAuB,KAAA;AAC3B,EAAA,MAAM,SAAS,EAAC;AAEhB,EAAA,KAAA,MAAW,CAAC,OAAA,EAAS,EAAE,CAAA,IAAK,KAAA,EAAO;AACjC,IAAA,CAAC,IAAA,EAAM,KAAK,CAAA,GAAI,EAAA,CAAG,MAAM,MAAM,CAAA;AAE/B,IAAA,IAAI,KAAA,EAAO;AAGT,MAAA,MAAA,CAAO,IAAA,CAAK,KAAA,KAAU,IAAA,GAAO,OAAA,GAAU,KAAK,CAAA;AAE5C,MAAA,IAAI,CAAC,KAAK,MAAA,EAAQ;AAChB,QAAA,OAAO,CAAC,IAAA,EAAM,CAAC,UAAU,IAAA,GAAO,OAAA,GAAU,KAAK,CAAC,CAAA;AAAA,MAClD;AAAA,IACF;AAAA,EACF;AAEA,EAAA,OAAO,CAAC,MAAM,MAAM,CAAA;AACtB","file":"index.js","sourcesContent":["// __private-exports\n/*\n * Copyright 2024 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport { type Format, SYMBOL_PATTERNS } from '..';\nimport { checkAmbiguousGrouping } from './check-ambiguous';\nimport { checkNumberValues } from './check-numbers';\nimport { fixBearings } from './fix-bearings';\nimport { fixDivider } from './fix-dividers';\nimport type { Tokens } from '../lexer';\n\ntype Pipe = (t: Tokens, f?: Format) => [Tokens, boolean | string];\n\nexport type PipeResult = ReturnType<Pipe>;\n\n/** Make a RegExp global. */\nconst makeGlobal = (k: keyof typeof SYMBOL_PATTERNS) =>\n new RegExp(SYMBOL_PATTERNS[k], 'g');\n\n/**\n * Consistently create a PipesResult array to return. Use this instead of\n * casting to PipesResult everywhere.\n *\n * @param e true = has error, false = no error\n *\n * @remarks\n * pure function\n */\nexport const pipesResult = (t: Tokens, e: boolean | string): PipeResult => [\n // if there are errors do NOT return the tokens\n e ? [] : t,\n e,\n];\n\n/** Check if there are more than 2 of something. */\nconst tooMany = (p: RegExp) => (t: Tokens) =>\n pipesResult(t, (t.join('').match(p) ?? []).length > 2);\n\nconst pipes: [string, Pipe][] = [\n // Unrecoverable violations\n ['Too many bearings.', tooMany(makeGlobal('NSEW'))],\n ['Too many numeric signs.', tooMany(/[-+]/g)],\n ['Too many degrees indicators.', tooMany(makeGlobal('DEGREES'))],\n ['Too many minutes indicators.', tooMany(makeGlobal('MINUTES'))],\n ['Too many seconds indicators.', tooMany(makeGlobal('SECONDS'))],\n ['Number values checks.', checkNumberValues],\n ['Ambiguous grouping of numbers with no divider.', checkAmbiguousGrouping],\n\n // fix values and formatting to be consistent\n ['Unable to identify latitude from longitude.', fixDivider],\n ['Unable to identify bearings.', fixBearings],\n];\n\n/**\n * Run the tokens through a preset pipeline of violations checks exiting the\n * process as early as possible when violations are found because violations\n * will make further violations checks less accurate and could return inaccurate\n * violations that could be misleading or hide the most important violation\n */\nexport function pipesRunner(\n tokens: Tokens,\n format?: Format,\n): [Tokens, string[]] {\n let copy = tokens.slice(0);\n let error: PipeResult[1] = false;\n const errors = [] as string[];\n\n for (const [message, op] of pipes) {\n [copy, error] = op(copy, format);\n\n if (error) {\n // accumulate the \"errors\" because if tokens are returned\n // the errors are only warnings and are recoverable\n errors.push(error === true ? message : error);\n\n if (!copy.length) {\n return [copy, [error === true ? message : error]];\n }\n }\n }\n\n return [copy, errors];\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  import { ParseResults } from '../latlon/internal/parse.js';
2
- import '../latlon/internal/index.js';
3
2
  import '../latlon/internal/lexer.js';
3
+ import '../latlon/internal/index.js';
4
4
 
5
5
  declare function parseMGRS(_format: any, input: string): ParseResults;
6
6
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/coordinates/mgrs/parser.ts"],"names":[],"mappings":";;;;AAmBA,MAAM,aAAA,GACJ,iFAAA;AAEF,MAAM,KAAA,GAAQ,CAAC,OAAA,KACb;AAAA,EACE,EAAC;AAAA,EACD,CAAC,CAAA,EAAG,SAAA,CAAU,OAAO,CAAC,CAAA,iCAAA,CAAmC;AAC3D,CAAA;AAEF,SAAS,eAAe,KAAA,EAAe;AACrC,EAAA,IAAI,CAAC,KAAA,EAAO;AACV,IAAA,OAAO,MAAM,mBAAmB,CAAA;AAAA,EAClC;AAEA,EAAA,MAAM,CAAC,KAAK,GAAA,EAAK,GAAA,EAAK,MAAM,KAAK,CAAA,GAAA,CAC/B,MAAM,IAAA,EAAK,CAAE,QAAQ,MAAA,EAAQ,GAAG,EAAE,KAAA,CAAM,aAAa,KAAK,EAAC,EAC3D,MAAM,CAAC,CAAA;AAET,EAAA,IAAI,CAAC,GAAA,IAAO,CAAC,MAAM,EAAA,IAAM,CAAC,MAAM,CAAA,EAAG;AACjC,IAAA,OAAO,KAAA;AAAA,MACL,4BAA4B,GAAG,CAAA,gCAAA;AAAA,KACjC;AAAA,EACF;AAEA,EAAA,IAAI,CAAC,cAAA,CAAe,IAAA,CAAK,GAAG,CAAA,EAAG;AAC7B,IAAA,OAAO,KAAA;AAAA,MACL,iCAAiC,GAAG,CAAA,gCAAA;AAAA,KACtC;AAAA,EACF;AAEA,EAAA,IAAI,CAAC,iBAAA,CAAkB,IAAA,CAAK,GAAG,CAAA,EAAG;AAChC,IAAA,OAAO,KAAA,CAAM,CAAA,sCAAA,EAAyC,GAAG,CAAA,OAAA,CAAS,CAAA;AAAA,EACpE;AAEA,EAAA,IAAI,EAAE,QAAQ,KAAA,IAAS,CAAC,OAAO,CAAA,IAAK,CAAC,QAAQ,CAAA,CAAA,EAAI;AAC/C,IAAA,OAAO,KAAA,CAAM,+BAA+B,CAAC,IAAA,EAAM,KAAK,CAAA,CAAE,IAAA,EAAM,CAAA,OAAA,CAAS,CAAA;AAAA,EAC3E;AAEA,EAAA,OAAO,MAAM,2BAA2B,CAAA;AAC1C;AAIO,SAAS,SAAA,CAAU,SAAc,KAAA,EAAe;AACrD,EAAA,IAAI;AACF,IAAA,MAAM,KAAA,GAAQ,IAAA,CAAK,KAAA,CAAM,KAAK,EAAE,OAAA,EAAQ;AAExC,IAAA,OAAO,KAAA,CAAM,CAAA,EAAG,KAAA,CAAM,WAAA,EAAa,MAAM,KAAA,CAAM,YAAA,EAAc,CAAA,CAAA,EAAI,QAAQ,CAAA;AAAA,EAC3E,SAAS,EAAA,EAAI;AACX,IAAA,OAAO,eAAe,KAAK,CAAA;AAAA,EAC7B;AACF","file":"parser.js","sourcesContent":["/*\n * Copyright 2024 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport { MGRS } from '@ngageoint/mgrs-js';\n\nimport { type ParseResults, parse } from '../latlon/internal/parse';\nimport { violation } from '../latlon/internal/violation';\n\ntype Match = [string, string, string, string, string];\n\nconst PATTERN_PARTS =\n /^((?:..?)?)(\\w?)\\s*((?:\\w{2})?)\\s*(?:(\\d+(?:\\.\\d*)?)?)\\s*(?:(\\d+(?:\\.\\d*)?)?)$/i;\n\nconst error = (message: string) =>\n [\n [],\n [`${violation(message)}; expected format DDZ AA DDD DDD.`],\n ] as ParseResults;\n\nfunction detailedErrors(input: string) {\n if (!input) {\n return error('No input provided');\n }\n\n const [utm, bnd, hkm, east, north] = (\n input.trim().replace(/\\s+/g, ' ').match(PATTERN_PARTS) ?? []\n ).slice(1) as Match;\n\n if (!utm || +utm > 60 || +utm < 1) {\n return error(\n `Invalid UTM zone number (${utm}) found in grid zone designation`,\n );\n }\n\n if (!/[C-HJ-NP-X]/i.test(bnd)) {\n return error(\n `Invalid Latitude band letter (${bnd}) found in grid zone designation`,\n );\n }\n\n if (!/^[A-HJ-NP-Z]*$/i.test(hkm)) {\n return error(`Invalid 100K m square identification (${hkm}) found`);\n }\n\n if (!(east && north && +east > 0 && +north > 0)) {\n return error(`Invalid numerical location (${[east, north].join()}) found`);\n }\n\n return error('Uncaught error condition.');\n}\n\n// biome-ignore lint/style/useNamingConvention: <explanation>\n// biome-ignore lint/suspicious/noExplicitAny: <explanation>\nexport function parseMGRS(_format: any, input: string) {\n try {\n const point = MGRS.parse(input).toPoint();\n\n return parse(`${point.getLatitude()} / ${point.getLongitude()}`, 'LATLON');\n } catch (_e) {\n return detailedErrors(input);\n }\n}\n"]}
1
+ {"version":3,"sources":["../../../src/coordinates/mgrs/parser.ts"],"names":[],"mappings":";;;;AAkBA,MAAM,aAAA,GACJ,iFAAA;AAEF,MAAM,KAAA,GAAQ,CAAC,OAAA,KACb;AAAA,EACE,EAAC;AAAA,EACD,CAAC,CAAA,EAAG,SAAA,CAAU,OAAO,CAAC,CAAA,iCAAA,CAAmC;AAC3D,CAAA;AAEF,SAAS,eAAe,KAAA,EAAe;AACrC,EAAA,IAAI,CAAC,KAAA,EAAO;AACV,IAAA,OAAO,MAAM,mBAAmB,CAAA;AAAA,EAClC;AAEA,EAAA,MAAM,CAAC,KAAK,GAAA,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e,KAAK,CAAA;AAAA,EAC7B;AACF","file":"parser.js","sourcesContent":["/*\n * Copyright 2024 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport { MGRS } from '@ngageoint/mgrs-js';\nimport { type ParseResults, parse } from '../latlon/internal/parse';\nimport { violation } from '../latlon/internal/violation';\n\ntype Match = [string, string, string, string, string];\n\nconst PATTERN_PARTS =\n /^((?:..?)?)(\\w?)\\s*((?:\\w{2})?)\\s*(?:(\\d+(?:\\.\\d*)?)?)\\s*(?:(\\d+(?:\\.\\d*)?)?)$/i;\n\nconst error = (message: string) =>\n [\n [],\n [`${violation(message)}; expected format DDZ AA DDD DDD.`],\n ] as ParseResults;\n\nfunction detailedErrors(input: string) {\n if (!input) {\n return error('No input provided');\n }\n\n const [utm, bnd, hkm, east, north] = (\n input.trim().replace(/\\s+/g, ' ').match(PATTERN_PARTS) ?? []\n ).slice(1) as Match;\n\n if (!utm || +utm > 60 || +utm < 1) {\n return error(\n `Invalid UTM zone number (${utm}) found in grid zone designation`,\n );\n }\n\n if (!/[C-HJ-NP-X]/i.test(bnd)) {\n return error(\n `Invalid Latitude band letter (${bnd}) found in grid zone designation`,\n );\n }\n\n if (!/^[A-HJ-NP-Z]*$/i.test(hkm)) {\n return error(`Invalid 100K m square identification (${hkm}) found`);\n }\n\n if (!(east && north && +east > 0 && +north > 0)) {\n return error(`Invalid numerical location (${[east, north].join()}) found`);\n }\n\n return error('Uncaught error condition.');\n}\n\n// biome-ignore lint/suspicious/noExplicitAny: Format is unused\nexport function parseMGRS(_format: any, input: string) {\n try {\n const point = MGRS.parse(input).toPoint();\n\n return parse(`${point.getLatitude()} / ${point.getLongitude()}`, 'LATLON');\n } catch (_e) {\n return detailedErrors(input);\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/coordinates/mgrs/system.ts"],"names":[],"mappings":";;;;;AAsBO,MAAM,UAAA,GAA+B;AAAA,EAC1C,IAAA,EAAM,gCAAA;AAAA,EAEN,KAAA,EAAO,SAAA;AAAA,EAEP,QAAQ,GAAA,EAAK;AACX,IAAA,MAAM,CAAC,GAAA,EAAK,IAAI,CAAA,GAAI,GAAA;AAEpB,IAAA,OACE,MAAA,CAAO,WAAW,GAAG,CAAA,IACpB,gBAAgB,iBAAA,CAAkB,IAAA,CAAK,IAAI,CAAA,GAAI,EAAA,GAAK,CAAA,CAAA;AAAA,EAEzD,CAAA;AAAA,EAEA,QAAA,CAAS,MAAA,EAAgB,CAAC,IAAA,EAAM,KAAK,CAAA,EAAqB;AACxD,IAAA,MAAM,EAAE,GAAA,EAAK,GAAA,EAAI,GAAI,OAAO,WAAA,CAAY;AAAA,MACtC,CAAC,MAAA,CAAO,KAAA,CAAM,CAAA,EAAG,CAAC,GAAG,IAAI,CAAA;AAAA,MACzB,CAAC,MAAA,CAAO,KAAA,CAAM,CAAC,GAAG,KAAK;AAAA,KACxB,CAAA;AAED,IAAA,OAAO,IAAA,CAAK,KAAK,KAAA,CAAM,KAAA,CAAM,KAAK,GAAG,CAAC,EAAE,QAAA,EAAS;AAAA,EACnD;AACF","file":"system.js","sourcesContent":["// __private-exports\n/*\n * Copyright 2024 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport { Point } from '@ngageoint/grid-js';\nimport { MGRS } from '@ngageoint/mgrs-js';\n\nimport { type Compass, type Format, SYMBOL_PATTERNS } from '../latlon/internal';\nimport type { CoordinateSystem } from '../latlon/internal/coordinate-system';\n\nimport { parseMGRS } from './parser';\n\n// biome-ignore lint/style/useNamingConvention: acronym\nexport const systemMGRS: CoordinateSystem = {\n name: 'Military Grid Reference System',\n\n parse: parseMGRS,\n\n toFloat(arg) {\n const [num, bear] = arg as [string, Compass];\n\n return (\n Number.parseFloat(num) *\n (SYMBOL_PATTERNS.NEGATIVE_BEARINGS.test(bear) ? -1 : 1)\n );\n },\n\n toFormat(format: Format, [left, right]: [number, number]) {\n const { LAT, LON } = Object.fromEntries([\n [format.slice(0, 3), left],\n [format.slice(3), right],\n ]) as Record<'LAT' | 'LON', number>;\n\n return MGRS.from(Point.point(LON, LAT)).toString();\n },\n};\n"]}
1
+ {"version":3,"sources":["../../../src/coordinates/mgrs/system.ts"],"names":[],"mappings":";;;;;AAmBO,MAAM,UAAA,GAA+B;AAAA,EAC1C,IAAA,EAAM,gCAAA;AAAA,EAEN,KAAA,EAAO,SAAA;AAAA,EAEP,QAAQ,GAAA,EAAK;AACX,IAAA,MAAM,CAAC,GAAA,EAAK,IAAI,CAAA,GAAI,GAAA;AAEpB,IAAA,OACE,MAAA,CAAO,WAAW,GAAG,CAAA,IACpB,gBAAgB,iBAAA,CAAkB,IAAA,CAAK,IAAI,CAAA,GAAI,EAAA,GAAK,CAAA,CAAA;AAAA,EAEzD,CAAA;AAAA,EAEA,QAAA,CAAS,MAAA,EAAgB,CAAC,IAAA,EAAM,KAAK,CAAA,EAAqB;AACxD,IAAA,MAAM,EAAE,GAAA,EAAK,GAAA,EAAI,GAAI,OAAO,WAAA,CAAY;AAAA,MACtC,CAAC,MAAA,CAAO,KAAA,CAAM,CAAA,EAAG,CAAC,GAAG,IAAI,CAAA;AAAA,MACzB,CAAC,MAAA,CAAO,KAAA,CAAM,CAAC,GAAG,KAAK;AAAA,KACxB,CAAA;AAED,IAAA,OAAO,IAAA,CAAK,KAAK,KAAA,CAAM,KAAA,CAAM,KAAK,GAAG,CAAC,EAAE,QAAA,EAAS;AAAA,EACnD;AACF","file":"system.js","sourcesContent":["// __private-exports\n/*\n * Copyright 2024 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport { Point } from '@ngageoint/grid-js';\nimport { MGRS } from '@ngageoint/mgrs-js';\nimport { type Compass, type Format, SYMBOL_PATTERNS } from '../latlon/internal';\nimport { parseMGRS } from './parser';\nimport type { CoordinateSystem } from '../latlon/internal/coordinate-system';\n\nexport const systemMGRS: CoordinateSystem = {\n name: 'Military Grid Reference System',\n\n parse: parseMGRS,\n\n toFloat(arg) {\n const [num, bear] = arg as [string, Compass];\n\n return (\n Number.parseFloat(num) *\n (SYMBOL_PATTERNS.NEGATIVE_BEARINGS.test(bear) ? -1 : 1)\n );\n },\n\n toFormat(format: Format, [left, right]: [number, number]) {\n const { LAT, LON } = Object.fromEntries([\n [format.slice(0, 3), left],\n [format.slice(3), right],\n ]) as Record<'LAT' | 'LON', number>;\n\n return MGRS.from(Point.point(LON, LAT)).toString();\n },\n};\n"]}
@@ -1,6 +1,6 @@
1
1
  import { ParseResults } from '../latlon/internal/parse.js';
2
- import '../latlon/internal/index.js';
3
2
  import '../latlon/internal/lexer.js';
3
+ import '../latlon/internal/index.js';
4
4
 
5
5
  declare function parseUTM(_format: any, input: string): ParseResults;
6
6
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/coordinates/utm/parser.ts"],"names":[],"mappings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,GAAQ,GAAA,CAAI,KAAA,CAAM,KAAK,EAAE,OAAA,EAAQ;AAEvC,IAAA,OAAO,KAAA,CAAM,CAAA,EAAG,KAAA,CAAM,WAAA,EAAa,MAAM,KAAA,CAAM,YAAA,EAAc,CAAA,CAAA,EAAI,QAAQ,CAAA;AAAA,EAC3E,SAAS,CAAA,EAAG;AACV,IAAA,OAAO,eAAe,KAAK,CAAA;AAAA,EAC7B;AACF","file":"parser.js","sourcesContent":["/*\n * Copyright 2024 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport { UTM } from '@ngageoint/mgrs-js';\n\nimport { type ParseResults, parse } from '../latlon/internal/parse';\nimport { violation } from '../latlon/internal/violation';\n\ntype Match = [string, string, string, string];\n\nconst PATTERN_PARTS =\n /^((?:..)?)\\s*(\\w?)\\s*(?:(\\d+(?:\\.\\d*)?)?)\\s*(?:(\\d+(?:\\.\\d*)?)?)$/i;\n\nconst error = (message: string) =>\n [\n [],\n [`${violation(message)}; expected format ZZ N|S DDD DDD.`],\n ] as ParseResults;\n\nfunction detailedErrors(input: string) {\n const [zone, band, east, north] = (\n input.trim().replace(/\\s+/g, ' ').match(PATTERN_PARTS) ?? []\n ).slice(1) as Match;\n\n if (!zone || +zone > 60 || +zone < 1) {\n return error(`Invalid Zone number (${zone}) found`);\n }\n\n if (!/[NS]/i.test(band)) {\n return error(`Invalid Latitude band letter (${band}) found`);\n }\n\n if (!(east || +east >= 0)) {\n return error(`Invalid Easting number (${east ?? ''}) found`);\n }\n\n if (!(north || +north >= 0)) {\n return error(`Invalid Northing number (${north ?? ''}) found`);\n }\n\n return error('Uncaught error condition.');\n}\n\n// biome-ignore lint/style/useNamingConvention: <explanation>\n// biome-ignore lint/suspicious/noExplicitAny: <explanation>\nexport function parseUTM(_format: any, input: string) {\n try {\n const point = UTM.parse(input).toPoint();\n\n return parse(`${point.getLatitude()} / ${point.getLongitude()}`, 'LATLON');\n } catch (_) {\n return detailedErrors(input);\n }\n}\n"]}
1
+ {"version":3,"sources":["../../../src/coordinates/utm/parser.ts"],"names":[],"mappings":";;;;AAkBA,MAAM,aAAA,GACJ,oEAAA;AAEF,MAAM,KAAA,GAAQ,CAAC,OAAA,KACb;AAAA,EACE,EAAC;AAAA,EACD,CAAC,CAAA,EAAG,SAAA,CAAU,OAAO,CAAC,CAAA,iCAAA,CAAmC;AAC3D,CAAA;AAEF,SAAS,eAAe,KAAA,EAAe;AACrC,EAAA,MAAM,CAAC,IAAA,EAAM,IAAA,EAAM,MAAM,KAAK,CAAA,GAAA,CAC5B,MAAM,IAAA,EAAK,CAAE,QAAQ,MAAA,EAAQ,GAAG,EAAE,KAAA,CAAM,aAAa,KAAK,EAAC,EAC3D,MAAM,CAAC,CAAA;AAET,EAAA,IAAI,CAAC,IAAA,IAAQ,CAAC,OAAO,EAAA,IAAM,CAAC,OAAO,CAAA,EAAG;AACpC,IAAA,OAAO,KAAA,CAAM,CAAA,qBAAA,EAAwB,IAAI,CAAA,OAAA,CAAS,CAAA;AAAA,EACpD;AAEA,EAAA,IAAI,CAAC,OAAA,CAAQ,IAAA,CAAK,IAAI,CAAA,EAAG;AACvB,IAAA,OAAO,KAAA,CAAM,CAAA,8BAAA,EAAiC,IAAI,CAAA,OAAA,CAAS,CAAA;AAAA,EAC7D;AAEA,EAAA,IAAI,EAAE,IAAA,IAAQ,CAAC,IAAA,IAAQ,CAAA,CAAA,EAAI;AACzB,IAAA,OAAO,KAAA,CAAM,CAAA,wBAAA,EAA2B,IAAA,IAAQ,EAAE,CAAA,OAAA,CAAS,CAAA;AAAA,EAC7D;AAEA,EAAA,IAAI,EAAE,KAAA,IAAS,CAAC,KAAA,IAAS,CAAA,CAAA,EAAI;AAC3B,IAAA,OAAO,KAAA,CAAM,CAAA,yBAAA,EAA4B,KAAA,IAAS,EAAE,CAAA,OAAA,CAAS,CAAA;AAAA,EAC/D;AAEA,EAAA,OAAO,MAAM,2BAA2B,CAAA;AAC1C;AAGO,SAAS,QAAA,CAAS,SAAc,KAAA,EAAe;AACpD,EAAA,IAAI;AACF,IAAA,MAAM,KAAA,GAAQ,GAAA,CAAI,KAAA,CAAM,KAAK,EAAE,OAAA,EAAQ;AAEvC,IAAA,OAAO,KAAA,CAAM,CAAA,EAAG,KAAA,CAAM,WAAA,EAAa,MAAM,KAAA,CAAM,YAAA,EAAc,CAAA,CAAA,EAAI,QAAQ,CAAA;AAAA,EAC3E,SAAS,CAAA,EAAG;AACV,IAAA,OAAO,eAAe,KAAK,CAAA;AAAA,EAC7B;AACF","file":"parser.js","sourcesContent":["/*\n * Copyright 2024 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport { UTM } from '@ngageoint/mgrs-js';\nimport { type ParseResults, parse } from '../latlon/internal/parse';\nimport { violation } from '../latlon/internal/violation';\n\ntype Match = [string, string, string, string];\n\nconst PATTERN_PARTS =\n /^((?:..)?)\\s*(\\w?)\\s*(?:(\\d+(?:\\.\\d*)?)?)\\s*(?:(\\d+(?:\\.\\d*)?)?)$/i;\n\nconst error = (message: string) =>\n [\n [],\n [`${violation(message)}; expected format ZZ N|S DDD DDD.`],\n ] as ParseResults;\n\nfunction detailedErrors(input: string) {\n const [zone, band, east, north] = (\n input.trim().replace(/\\s+/g, ' ').match(PATTERN_PARTS) ?? []\n ).slice(1) as Match;\n\n if (!zone || +zone > 60 || +zone < 1) {\n return error(`Invalid Zone number (${zone}) found`);\n }\n\n if (!/[NS]/i.test(band)) {\n return error(`Invalid Latitude band letter (${band}) found`);\n }\n\n if (!(east || +east >= 0)) {\n return error(`Invalid Easting number (${east ?? ''}) found`);\n }\n\n if (!(north || +north >= 0)) {\n return error(`Invalid Northing number (${north ?? ''}) found`);\n }\n\n return error('Uncaught error condition.');\n}\n\n// biome-ignore lint/suspicious/noExplicitAny: Format is unused\nexport function parseUTM(_format: any, input: string) {\n try {\n const point = UTM.parse(input).toPoint();\n\n return parse(`${point.getLatitude()} / ${point.getLongitude()}`, 'LATLON');\n } catch (_) {\n return detailedErrors(input);\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/coordinates/utm/system.ts"],"names":[],"mappings":";;;;;AAsBO,MAAM,SAAA,GAA8B;AAAA,EACzC,IAAA,EAAM,gCAAA;AAAA,EAEN,KAAA,EAAO,QAAA;AAAA,EAEP,QAAQ,GAAA,EAAK;AACX,IAAA,MAAM,CAAC,GAAA,EAAK,IAAI,CAAA,GAAI,GAAA;AAEpB,IAAA,OACE,MAAA,CAAO,WAAW,GAAG,CAAA,IACpB,gBAAgB,iBAAA,CAAkB,IAAA,CAAK,IAAI,CAAA,GAAI,EAAA,GAAK,CAAA,CAAA;AAAA,EAEzD,CAAA;AAAA,EAEA,QAAA,CAAS,MAAA,EAAgB,CAAC,IAAA,EAAM,KAAK,CAAA,EAAqB;AACxD,IAAA,MAAM,EAAE,GAAA,EAAK,GAAA,EAAI,GAAI,OAAO,WAAA,CAAY;AAAA,MACtC,CAAC,MAAA,CAAO,KAAA,CAAM,CAAA,EAAG,CAAC,GAAG,IAAI,CAAA;AAAA,MACzB,CAAC,MAAA,CAAO,KAAA,CAAM,CAAC,GAAG,KAAK;AAAA,KACxB,CAAA;AAED,IAAA,OAAO,GAAA,CAAI,KAAK,KAAA,CAAM,KAAA,CAAM,KAAK,GAAG,CAAC,EAAE,QAAA,EAAS;AAAA,EAClD;AACF","file":"system.js","sourcesContent":["// __private-exports\n/*\n * Copyright 2024 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport { Point } from '@ngageoint/grid-js';\nimport { UTM } from '@ngageoint/mgrs-js';\n\nimport { type Compass, type Format, SYMBOL_PATTERNS } from '../latlon/internal';\nimport type { CoordinateSystem } from '../latlon/internal/coordinate-system';\n\nimport { parseUTM } from './parser';\n\n// biome-ignore lint/style/useNamingConvention: acronym\nexport const systemUTM: CoordinateSystem = {\n name: 'Military Grid Reference System',\n\n parse: parseUTM,\n\n toFloat(arg) {\n const [num, bear] = arg as [string, Compass];\n\n return (\n Number.parseFloat(num) *\n (SYMBOL_PATTERNS.NEGATIVE_BEARINGS.test(bear) ? -1 : 1)\n );\n },\n\n toFormat(format: Format, [left, right]: [number, number]) {\n const { LAT, LON } = Object.fromEntries([\n [format.slice(0, 3), left],\n [format.slice(3), right],\n ]) as Record<'LAT' | 'LON', number>;\n\n return UTM.from(Point.point(LON, LAT)).toString();\n },\n};\n"]}
1
+ {"version":3,"sources":["../../../src/coordinates/utm/system.ts"],"names":[],"mappings":";;;;;AAmBO,MAAM,SAAA,GAA8B;AAAA,EACzC,IAAA,EAAM,gCAAA;AAAA,EAEN,KAAA,EAAO,QAAA;AAAA,EAEP,QAAQ,GAAA,EAAK;AACX,IAAA,MAAM,CAAC,GAAA,EAAK,IAAI,CAAA,GAAI,GAAA;AAEpB,IAAA,OACE,MAAA,CAAO,WAAW,GAAG,CAAA,IACpB,gBAAgB,iBAAA,CAAkB,IAAA,CAAK,IAAI,CAAA,GAAI,EAAA,GAAK,CAAA,CAAA;AAAA,EAEzD,CAAA;AAAA,EAEA,QAAA,CAAS,MAAA,EAAgB,CAAC,IAAA,EAAM,KAAK,CAAA,EAAqB;AACxD,IAAA,MAAM,EAAE,GAAA,EAAK,GAAA,EAAI,GAAI,OAAO,WAAA,CAAY;AAAA,MACtC,CAAC,MAAA,CAAO,KAAA,CAAM,CAAA,EAAG,CAAC,GAAG,IAAI,CAAA;AAAA,MACzB,CAAC,MAAA,CAAO,KAAA,CAAM,CAAC,GAAG,KAAK;AAAA,KACxB,CAAA;AAED,IAAA,OAAO,GAAA,CAAI,KAAK,KAAA,CAAM,KAAA,CAAM,KAAK,GAAG,CAAC,EAAE,QAAA,EAAS;AAAA,EAClD;AACF","file":"system.js","sourcesContent":["// __private-exports\n/*\n * Copyright 2024 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport { Point } from '@ngageoint/grid-js';\nimport { UTM } from '@ngageoint/mgrs-js';\nimport { type Compass, type Format, SYMBOL_PATTERNS } from '../latlon/internal';\nimport { parseUTM } from './parser';\nimport type { CoordinateSystem } from '../latlon/internal/coordinate-system';\n\nexport const systemUTM: CoordinateSystem = {\n name: 'Military Grid Reference System',\n\n parse: parseUTM,\n\n toFloat(arg) {\n const [num, bear] = arg as [string, Compass];\n\n return (\n Number.parseFloat(num) *\n (SYMBOL_PATTERNS.NEGATIVE_BEARINGS.test(bear) ? -1 : 1)\n );\n },\n\n toFormat(format: Format, [left, right]: [number, number]) {\n const { LAT, LON } = Object.fromEntries([\n [format.slice(0, 3), left],\n [format.slice(3), right],\n ]) as Record<'LAT' | 'LON', number>;\n\n return UTM.from(Point.point(LON, LAT)).toString();\n },\n};\n"]}
@@ -1 +1 @@
1
- {"inputs":{"src/cartesian.ts":{"bytes":1459,"imports":[],"format":"esm"},"src/index.ts":{"bytes":1176,"imports":[],"format":"esm"},"src/patterning.ts":{"bytes":2573,"imports":[],"format":"esm"},"src/coordinates/coordinate.ts":{"bytes":6515,"imports":[],"format":"esm"},"src/coordinates/mgrs/parser.ts":{"bytes":2308,"imports":[],"format":"esm"},"src/coordinates/mgrs/system.ts":{"bytes":1589,"imports":[],"format":"esm"},"src/coordinates/utm/parser.ts":{"bytes":2093,"imports":[],"format":"esm"},"src/coordinates/utm/system.ts":{"bytes":1584,"imports":[],"format":"esm"},"src/coordinates/latlon/degrees-decimal-minutes/parser.ts":{"bytes":3677,"imports":[],"format":"esm"},"src/coordinates/latlon/degrees-decimal-minutes/system.ts":{"bytes":1728,"imports":[],"format":"esm"},"src/coordinates/latlon/degrees-minutes-seconds/parser.ts":{"bytes":3771,"imports":[],"format":"esm"},"src/coordinates/latlon/degrees-minutes-seconds/system.ts":{"bytes":1914,"imports":[],"format":"esm"},"src/coordinates/latlon/internal/coordinate-system.ts":{"bytes":1059,"imports":[],"format":"esm"},"src/coordinates/latlon/internal/create-cache.ts":{"bytes":1421,"imports":[],"format":"esm"},"src/coordinates/latlon/internal/exhaustive-errors.ts":{"bytes":3159,"imports":[],"format":"esm"},"src/coordinates/latlon/internal/in-range.ts":{"bytes":1063,"imports":[],"format":"esm"},"src/coordinates/latlon/internal/index.ts":{"bytes":4481,"imports":[],"format":"esm"},"src/coordinates/latlon/internal/lexer.ts":{"bytes":4018,"imports":[],"format":"esm"},"src/coordinates/latlon/internal/parse-format.ts":{"bytes":3009,"imports":[],"format":"esm"},"src/coordinates/latlon/internal/parse.ts":{"bytes":2350,"imports":[],"format":"esm"},"src/coordinates/latlon/internal/violation.ts":{"bytes":725,"imports":[],"format":"esm"},"src/coordinates/latlon/decimal-degrees/parser.ts":{"bytes":3063,"imports":[],"format":"esm"},"src/coordinates/latlon/decimal-degrees/system.ts":{"bytes":1450,"imports":[],"format":"esm"},"src/coordinates/latlon/internal/pipes/check-ambiguous.ts":{"bytes":2342,"imports":[],"format":"esm"},"src/coordinates/latlon/internal/pipes/check-numbers.ts":{"bytes":1906,"imports":[],"format":"esm"},"src/coordinates/latlon/internal/pipes/fix-bearings.ts":{"bytes":3672,"imports":[],"format":"esm"},"src/coordinates/latlon/internal/pipes/fix-dividers.ts":{"bytes":2205,"imports":[],"format":"esm"},"src/coordinates/latlon/internal/pipes/genome.ts":{"bytes":2497,"imports":[],"format":"esm"},"src/coordinates/latlon/internal/pipes/index.ts":{"bytes":3286,"imports":[],"format":"esm"},"src/coordinates/latlon/internal/pipes/simpler.ts":{"bytes":1026,"imports":[],"format":"esm"}},"outputs":{"dist/coordinates/latlon/internal/pipes/check-numbers.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":2812},"dist/coordinates/latlon/internal/pipes/check-numbers.js":{"imports":[{"path":"../pipes","kind":"import-statement","external":true},{"path":"./simpler","kind":"import-statement","external":true}],"exports":["checkNumberValues"],"entryPoint":"src/coordinates/latlon/internal/pipes/check-numbers.ts","inputs":{"src/coordinates/latlon/internal/pipes/check-numbers.ts":{"bytesInOutput":946}},"bytes":978},"dist/coordinates/latlon/internal/pipes/fix-bearings.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":5883},"dist/coordinates/latlon/internal/pipes/fix-bearings.js":{"imports":[{"path":"..","kind":"import-statement","external":true}],"exports":["fixBearings"],"entryPoint":"src/coordinates/latlon/internal/pipes/fix-bearings.ts","inputs":{"src/coordinates/latlon/internal/pipes/fix-bearings.ts":{"bytesInOutput":2167}},"bytes":2193},"dist/coordinates/latlon/internal/pipes/fix-dividers.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":3051},"dist/coordinates/latlon/internal/pipes/fix-dividers.js":{"imports":[{"path":"..","kind":"import-statement","external":true},{"path":"./genome","kind":"import-statement","external":true},{"path":"./simpler","kind":"import-statement","external":true}],"exports":["fixDivider"],"entryPoint":"src/coordinates/latlon/internal/pipes/fix-dividers.ts","inputs":{"src/coordinates/latlon/internal/pipes/fix-dividers.ts":{"bytesInOutput":733}},"bytes":758},"dist/coordinates/latlon/internal/pipes/genome.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":3487},"dist/coordinates/latlon/internal/pipes/genome.js":{"imports":[{"path":"..","kind":"import-statement","external":true}],"exports":["getGenomeIndex"],"entryPoint":"src/coordinates/latlon/internal/pipes/genome.ts","inputs":{"src/coordinates/latlon/internal/pipes/genome.ts":{"bytesInOutput":921}},"bytes":950},"dist/coordinates/latlon/internal/pipes/index.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":4612},"dist/coordinates/latlon/internal/pipes/index.js":{"imports":[{"path":"..","kind":"import-statement","external":true},{"path":"./check-ambiguous","kind":"import-statement","external":true},{"path":"./check-numbers","kind":"import-statement","external":true},{"path":"./fix-bearings","kind":"import-statement","external":true},{"path":"./fix-dividers","kind":"import-statement","external":true}],"exports":["pipesResult","pipesRunner"],"entryPoint":"src/coordinates/latlon/internal/pipes/index.ts","inputs":{"src/coordinates/latlon/internal/pipes/index.ts":{"bytesInOutput":1524}},"bytes":1565},"dist/coordinates/latlon/internal/pipes/simpler.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":1310},"dist/coordinates/latlon/internal/pipes/simpler.js":{"imports":[],"exports":["simpler"],"entryPoint":"src/coordinates/latlon/internal/pipes/simpler.ts","inputs":{"src/coordinates/latlon/internal/pipes/simpler.ts":{"bytesInOutput":82}},"bytes":104},"dist/coordinates/latlon/internal/index.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":6839},"dist/coordinates/latlon/internal/index.js":{"imports":[{"path":"@/patterning","kind":"import-statement","external":true}],"exports":["BEARINGS","FORMATS","FORMATS_DEFAULT","LIMITS","PARTIAL_PATTERNS","SYMBOLS","SYMBOL_PATTERNS"],"entryPoint":"src/coordinates/latlon/internal/index.ts","inputs":{"src/coordinates/latlon/internal/index.ts":{"bytesInOutput":3051}},"bytes":3164},"dist/coordinates/latlon/internal/lexer.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":5145},"dist/coordinates/latlon/internal/lexer.js":{"imports":[{"path":"@/patterning","kind":"import-statement","external":true},{"path":".","kind":"import-statement","external":true}],"exports":["lexer"],"entryPoint":"src/coordinates/latlon/internal/lexer.ts","inputs":{"src/coordinates/latlon/internal/lexer.ts":{"bytesInOutput":1174}},"bytes":1194},"dist/coordinates/latlon/internal/parse-format.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":4711},"dist/coordinates/latlon/internal/parse-format.js":{"imports":[{"path":".","kind":"import-statement","external":true},{"path":"./parse","kind":"import-statement","external":true},{"path":"./violation","kind":"import-statement","external":true}],"exports":["createParser"],"entryPoint":"src/coordinates/latlon/internal/parse-format.ts","inputs":{"src/coordinates/latlon/internal/parse-format.ts":{"bytesInOutput":1758}},"bytes":1785},"dist/coordinates/latlon/internal/parse.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":2869},"dist/coordinates/latlon/internal/parse.js":{"imports":[{"path":"./lexer","kind":"import-statement","external":true},{"path":"./pipes","kind":"import-statement","external":true},{"path":"./violation","kind":"import-statement","external":true}],"exports":["parse"],"entryPoint":"src/coordinates/latlon/internal/parse.ts","inputs":{"src/coordinates/latlon/internal/parse.ts":{"bytesInOutput":344}},"bytes":364},"dist/coordinates/latlon/internal/violation.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":931},"dist/coordinates/latlon/internal/violation.js":{"imports":[],"exports":["violation"],"entryPoint":"src/coordinates/latlon/internal/violation.ts","inputs":{"src/coordinates/latlon/internal/violation.ts":{"bytesInOutput":41}},"bytes":65},"dist/coordinates/latlon/decimal-degrees/parser.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":5041},"dist/coordinates/latlon/decimal-degrees/parser.js":{"imports":[{"path":"@/patterning","kind":"import-statement","external":true},{"path":"../internal","kind":"import-statement","external":true},{"path":"../internal/parse-format","kind":"import-statement","external":true}],"exports":["parseDecimalDegrees"],"entryPoint":"src/coordinates/latlon/decimal-degrees/parser.ts","inputs":{"src/coordinates/latlon/decimal-degrees/parser.ts":{"bytesInOutput":2051}},"bytes":2085},"dist/coordinates/latlon/decimal-degrees/system.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":2127},"dist/coordinates/latlon/decimal-degrees/system.js":{"imports":[{"path":"../internal","kind":"import-statement","external":true},{"path":"./parser","kind":"import-statement","external":true}],"exports":["systemDecimalDegrees"],"entryPoint":"src/coordinates/latlon/decimal-degrees/system.ts","inputs":{"src/coordinates/latlon/decimal-degrees/system.ts":{"bytesInOutput":541}},"bytes":576},"dist/coordinates/latlon/internal/pipes/check-ambiguous.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":3137},"dist/coordinates/latlon/internal/pipes/check-ambiguous.js":{"imports":[{"path":"..","kind":"import-statement","external":true},{"path":"../pipes","kind":"import-statement","external":true},{"path":"./simpler","kind":"import-statement","external":true}],"exports":["checkAmbiguousGrouping"],"entryPoint":"src/coordinates/latlon/internal/pipes/check-ambiguous.ts","inputs":{"src/coordinates/latlon/internal/pipes/check-ambiguous.ts":{"bytesInOutput":763}},"bytes":800},"dist/coordinates/latlon/degrees-decimal-minutes/parser.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":6058},"dist/coordinates/latlon/degrees-decimal-minutes/parser.js":{"imports":[{"path":"@/patterning","kind":"import-statement","external":true},{"path":"../internal","kind":"import-statement","external":true},{"path":"../internal/in-range","kind":"import-statement","external":true},{"path":"../internal/parse-format","kind":"import-statement","external":true}],"exports":["parseDegreesDecimalMinutes"],"entryPoint":"src/coordinates/latlon/degrees-decimal-minutes/parser.ts","inputs":{"src/coordinates/latlon/degrees-decimal-minutes/parser.ts":{"bytesInOutput":2529}},"bytes":2570},"dist/coordinates/latlon/degrees-decimal-minutes/system.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":2612},"dist/coordinates/latlon/degrees-decimal-minutes/system.js":{"imports":[{"path":"../internal","kind":"import-statement","external":true},{"path":"./parser","kind":"import-statement","external":true}],"exports":["systemDegreesDecimalMinutes"],"entryPoint":"src/coordinates/latlon/degrees-decimal-minutes/system.ts","inputs":{"src/coordinates/latlon/degrees-decimal-minutes/system.ts":{"bytesInOutput":810}},"bytes":852},"dist/coordinates/latlon/degrees-minutes-seconds/parser.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":6157},"dist/coordinates/latlon/degrees-minutes-seconds/parser.js":{"imports":[{"path":"@/patterning","kind":"import-statement","external":true},{"path":"../internal","kind":"import-statement","external":true},{"path":"../internal/in-range","kind":"import-statement","external":true},{"path":"../internal/parse-format","kind":"import-statement","external":true}],"exports":["parseDegreesMinutesSeconds"],"entryPoint":"src/coordinates/latlon/degrees-minutes-seconds/parser.ts","inputs":{"src/coordinates/latlon/degrees-minutes-seconds/parser.ts":{"bytesInOutput":2538}},"bytes":2579},"dist/coordinates/latlon/degrees-minutes-seconds/system.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":2906},"dist/coordinates/latlon/degrees-minutes-seconds/system.js":{"imports":[{"path":"../internal","kind":"import-statement","external":true},{"path":"./parser","kind":"import-statement","external":true}],"exports":["systemDegreesMinutesSeconds"],"entryPoint":"src/coordinates/latlon/degrees-minutes-seconds/system.ts","inputs":{"src/coordinates/latlon/degrees-minutes-seconds/system.ts":{"bytesInOutput":933}},"bytes":975},"dist/coordinates/latlon/internal/coordinate-system.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"dist/coordinates/latlon/internal/coordinate-system.js":{"imports":[],"exports":[],"entryPoint":"src/coordinates/latlon/internal/coordinate-system.ts","inputs":{"src/coordinates/latlon/internal/coordinate-system.ts":{"bytesInOutput":0}},"bytes":0},"dist/coordinates/latlon/internal/create-cache.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":1913},"dist/coordinates/latlon/internal/create-cache.js":{"imports":[{"path":".","kind":"import-statement","external":true}],"exports":["createCache"],"entryPoint":"src/coordinates/latlon/internal/create-cache.ts","inputs":{"src/coordinates/latlon/internal/create-cache.ts":{"bytesInOutput":325}},"bytes":351},"dist/coordinates/latlon/internal/exhaustive-errors.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":5128},"dist/coordinates/latlon/internal/exhaustive-errors.js":{"imports":[{"path":"@/cartesian","kind":"import-statement","external":true}],"exports":["EXHAUSTIVE_ERRORS"],"entryPoint":"src/coordinates/latlon/internal/exhaustive-errors.ts","inputs":{"src/coordinates/latlon/internal/exhaustive-errors.ts":{"bytesInOutput":1924}},"bytes":1956},"dist/coordinates/latlon/internal/in-range.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":1455},"dist/coordinates/latlon/internal/in-range.js":{"imports":[],"exports":["inRange"],"entryPoint":"src/coordinates/latlon/internal/in-range.ts","inputs":{"src/coordinates/latlon/internal/in-range.ts":{"bytesInOutput":260}},"bytes":282},"dist/cartesian.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":1855},"dist/cartesian.js":{"imports":[],"exports":["cartesian"],"entryPoint":"src/cartesian.ts","inputs":{"src/cartesian.ts":{"bytesInOutput":207}},"bytes":231},"dist/index.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":1429},"dist/index.js":{"imports":[{"path":"./coordinates/coordinate","kind":"import-statement","external":true},{"path":"./coordinates/latlon/decimal-degrees/parser","kind":"import-statement","external":true},{"path":"./coordinates/latlon/degrees-decimal-minutes/parser","kind":"import-statement","external":true},{"path":"./coordinates/latlon/degrees-minutes-seconds/parser","kind":"import-statement","external":true},{"path":"./coordinates/mgrs/parser","kind":"import-statement","external":true},{"path":"./coordinates/utm/parser","kind":"import-statement","external":true}],"exports":["coordinateSystems","createCoordinate","parseDecimalDegrees","parseDegreesDecimalMinutes","parseDegreesMinutesSeconds","parseMGRS","parseUTM"],"entryPoint":"src/index.ts","inputs":{"src/index.ts":{"bytesInOutput":467}},"bytes":627},"dist/patterning.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":3276},"dist/patterning.js":{"imports":[],"exports":["capture","fromTemplate","group","merge","optional"],"entryPoint":"src/patterning.ts","inputs":{"src/patterning.ts":{"bytesInOutput":465}},"bytes":533},"dist/coordinates/coordinate.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":8551},"dist/coordinates/coordinate.js":{"imports":[{"path":"./latlon/decimal-degrees/system","kind":"import-statement","external":true},{"path":"./latlon/degrees-decimal-minutes/system","kind":"import-statement","external":true},{"path":"./latlon/degrees-minutes-seconds/system","kind":"import-statement","external":true},{"path":"./latlon/internal","kind":"import-statement","external":true},{"path":"./latlon/internal/create-cache","kind":"import-statement","external":true},{"path":"./mgrs/system","kind":"import-statement","external":true},{"path":"./utm/system","kind":"import-statement","external":true}],"exports":["coordinateSystems","createCoordinate"],"entryPoint":"src/coordinates/coordinate.ts","inputs":{"src/coordinates/coordinate.ts":{"bytesInOutput":2557}},"bytes":2609},"dist/coordinates/mgrs/parser.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":3502},"dist/coordinates/mgrs/parser.js":{"imports":[{"path":"@ngageoint/mgrs-js","kind":"import-statement","external":true},{"path":"../latlon/internal/parse","kind":"import-statement","external":true},{"path":"../latlon/internal/violation","kind":"import-statement","external":true}],"exports":["parseMGRS"],"entryPoint":"src/coordinates/mgrs/parser.ts","inputs":{"src/coordinates/mgrs/parser.ts":{"bytesInOutput":1368}},"bytes":1392},"dist/coordinates/mgrs/system.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":2274},"dist/coordinates/mgrs/system.js":{"imports":[{"path":"@ngageoint/grid-js","kind":"import-statement","external":true},{"path":"@ngageoint/mgrs-js","kind":"import-statement","external":true},{"path":"../latlon/internal","kind":"import-statement","external":true},{"path":"./parser","kind":"import-statement","external":true}],"exports":["systemMGRS"],"entryPoint":"src/coordinates/mgrs/system.ts","inputs":{"src/coordinates/mgrs/system.ts":{"bytesInOutput":624}},"bytes":649},"dist/coordinates/utm/parser.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":3162},"dist/coordinates/utm/parser.js":{"imports":[{"path":"@ngageoint/mgrs-js","kind":"import-statement","external":true},{"path":"../latlon/internal/parse","kind":"import-statement","external":true},{"path":"../latlon/internal/violation","kind":"import-statement","external":true}],"exports":["parseUTM"],"entryPoint":"src/coordinates/utm/parser.ts","inputs":{"src/coordinates/utm/parser.ts":{"bytesInOutput":1164}},"bytes":1187},"dist/coordinates/utm/system.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":2268},"dist/coordinates/utm/system.js":{"imports":[{"path":"@ngageoint/grid-js","kind":"import-statement","external":true},{"path":"@ngageoint/mgrs-js","kind":"import-statement","external":true},{"path":"../latlon/internal","kind":"import-statement","external":true},{"path":"./parser","kind":"import-statement","external":true}],"exports":["systemUTM"],"entryPoint":"src/coordinates/utm/system.ts","inputs":{"src/coordinates/utm/system.ts":{"bytesInOutput":619}},"bytes":643}}}
1
+ {"inputs":{"src/cartesian.ts":{"bytes":1459,"imports":[],"format":"esm"},"src/index.ts":{"bytes":1325,"imports":[],"format":"esm"},"src/patterning.ts":{"bytes":2573,"imports":[],"format":"esm"},"src/coordinates/coordinate.ts":{"bytes":6515,"imports":[],"format":"esm"},"src/coordinates/mgrs/parser.ts":{"bytes":2248,"imports":[],"format":"esm"},"src/coordinates/mgrs/system.ts":{"bytes":1531,"imports":[],"format":"esm"},"src/coordinates/utm/parser.ts":{"bytes":2033,"imports":[],"format":"esm"},"src/coordinates/utm/system.ts":{"bytes":1526,"imports":[],"format":"esm"},"src/coordinates/latlon/decimal-degrees/parser.ts":{"bytes":3062,"imports":[],"format":"esm"},"src/coordinates/latlon/decimal-degrees/system.ts":{"bytes":1449,"imports":[],"format":"esm"},"src/coordinates/latlon/degrees-decimal-minutes/parser.ts":{"bytes":3676,"imports":[],"format":"esm"},"src/coordinates/latlon/degrees-decimal-minutes/system.ts":{"bytes":1727,"imports":[],"format":"esm"},"src/coordinates/latlon/degrees-minutes-seconds/parser.ts":{"bytes":3770,"imports":[],"format":"esm"},"src/coordinates/latlon/degrees-minutes-seconds/system.ts":{"bytes":1913,"imports":[],"format":"esm"},"src/coordinates/latlon/internal/coordinate-system.ts":{"bytes":1059,"imports":[],"format":"esm"},"src/coordinates/latlon/internal/create-cache.ts":{"bytes":1421,"imports":[],"format":"esm"},"src/coordinates/latlon/internal/exhaustive-errors.ts":{"bytes":3159,"imports":[],"format":"esm"},"src/coordinates/latlon/internal/in-range.ts":{"bytes":1063,"imports":[],"format":"esm"},"src/coordinates/latlon/internal/index.ts":{"bytes":4481,"imports":[],"format":"esm"},"src/coordinates/latlon/internal/lexer.ts":{"bytes":4016,"imports":[],"format":"esm"},"src/coordinates/latlon/internal/parse-format.ts":{"bytes":3081,"imports":[],"format":"esm"},"src/coordinates/latlon/internal/parse.ts":{"bytes":2350,"imports":[],"format":"esm"},"src/coordinates/latlon/internal/violation.ts":{"bytes":725,"imports":[],"format":"esm"},"src/coordinates/latlon/internal/pipes/check-ambiguous.ts":{"bytes":2341,"imports":[],"format":"esm"},"src/coordinates/latlon/internal/pipes/check-numbers.ts":{"bytes":1905,"imports":[],"format":"esm"},"src/coordinates/latlon/internal/pipes/fix-bearings.ts":{"bytes":3672,"imports":[],"format":"esm"},"src/coordinates/latlon/internal/pipes/fix-dividers.ts":{"bytes":2205,"imports":[],"format":"esm"},"src/coordinates/latlon/internal/pipes/genome.ts":{"bytes":2501,"imports":[],"format":"esm"},"src/coordinates/latlon/internal/pipes/index.ts":{"bytes":3285,"imports":[],"format":"esm"},"src/coordinates/latlon/internal/pipes/simpler.ts":{"bytes":1026,"imports":[],"format":"esm"}},"outputs":{"dist/coordinates/latlon/internal/pipes/check-numbers.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":2810},"dist/coordinates/latlon/internal/pipes/check-numbers.js":{"imports":[{"path":"../pipes","kind":"import-statement","external":true},{"path":"./simpler","kind":"import-statement","external":true}],"exports":["checkNumberValues"],"entryPoint":"src/coordinates/latlon/internal/pipes/check-numbers.ts","inputs":{"src/coordinates/latlon/internal/pipes/check-numbers.ts":{"bytesInOutput":946}},"bytes":978},"dist/coordinates/latlon/internal/pipes/fix-bearings.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":5883},"dist/coordinates/latlon/internal/pipes/fix-bearings.js":{"imports":[{"path":"..","kind":"import-statement","external":true}],"exports":["fixBearings"],"entryPoint":"src/coordinates/latlon/internal/pipes/fix-bearings.ts","inputs":{"src/coordinates/latlon/internal/pipes/fix-bearings.ts":{"bytesInOutput":2167}},"bytes":2193},"dist/coordinates/latlon/internal/pipes/fix-dividers.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":3051},"dist/coordinates/latlon/internal/pipes/fix-dividers.js":{"imports":[{"path":"..","kind":"import-statement","external":true},{"path":"./genome","kind":"import-statement","external":true},{"path":"./simpler","kind":"import-statement","external":true}],"exports":["fixDivider"],"entryPoint":"src/coordinates/latlon/internal/pipes/fix-dividers.ts","inputs":{"src/coordinates/latlon/internal/pipes/fix-dividers.ts":{"bytesInOutput":733}},"bytes":758},"dist/coordinates/latlon/internal/pipes/genome.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":3496},"dist/coordinates/latlon/internal/pipes/genome.js":{"imports":[{"path":"..","kind":"import-statement","external":true}],"exports":["getGenomeIndex"],"entryPoint":"src/coordinates/latlon/internal/pipes/genome.ts","inputs":{"src/coordinates/latlon/internal/pipes/genome.ts":{"bytesInOutput":925}},"bytes":954},"dist/coordinates/latlon/internal/pipes/index.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":4610},"dist/coordinates/latlon/internal/pipes/index.js":{"imports":[{"path":"..","kind":"import-statement","external":true},{"path":"./check-ambiguous","kind":"import-statement","external":true},{"path":"./check-numbers","kind":"import-statement","external":true},{"path":"./fix-bearings","kind":"import-statement","external":true},{"path":"./fix-dividers","kind":"import-statement","external":true}],"exports":["pipesResult","pipesRunner"],"entryPoint":"src/coordinates/latlon/internal/pipes/index.ts","inputs":{"src/coordinates/latlon/internal/pipes/index.ts":{"bytesInOutput":1524}},"bytes":1565},"dist/coordinates/latlon/internal/pipes/simpler.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":1310},"dist/coordinates/latlon/internal/pipes/simpler.js":{"imports":[],"exports":["simpler"],"entryPoint":"src/coordinates/latlon/internal/pipes/simpler.ts","inputs":{"src/coordinates/latlon/internal/pipes/simpler.ts":{"bytesInOutput":82}},"bytes":104},"dist/coordinates/latlon/internal/exhaustive-errors.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":5128},"dist/coordinates/latlon/internal/exhaustive-errors.js":{"imports":[{"path":"@/cartesian","kind":"import-statement","external":true}],"exports":["EXHAUSTIVE_ERRORS"],"entryPoint":"src/coordinates/latlon/internal/exhaustive-errors.ts","inputs":{"src/coordinates/latlon/internal/exhaustive-errors.ts":{"bytesInOutput":1924}},"bytes":1956},"dist/coordinates/latlon/internal/in-range.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":1455},"dist/coordinates/latlon/internal/in-range.js":{"imports":[],"exports":["inRange"],"entryPoint":"src/coordinates/latlon/internal/in-range.ts","inputs":{"src/coordinates/latlon/internal/in-range.ts":{"bytesInOutput":260}},"bytes":282},"dist/coordinates/latlon/internal/index.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":6839},"dist/coordinates/latlon/internal/index.js":{"imports":[{"path":"@/patterning","kind":"import-statement","external":true}],"exports":["BEARINGS","FORMATS","FORMATS_DEFAULT","LIMITS","PARTIAL_PATTERNS","SYMBOLS","SYMBOL_PATTERNS"],"entryPoint":"src/coordinates/latlon/internal/index.ts","inputs":{"src/coordinates/latlon/internal/index.ts":{"bytesInOutput":3051}},"bytes":3164},"dist/coordinates/latlon/internal/lexer.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":5141},"dist/coordinates/latlon/internal/lexer.js":{"imports":[{"path":"@/patterning","kind":"import-statement","external":true},{"path":".","kind":"import-statement","external":true}],"exports":["lexer"],"entryPoint":"src/coordinates/latlon/internal/lexer.ts","inputs":{"src/coordinates/latlon/internal/lexer.ts":{"bytesInOutput":1173}},"bytes":1193},"dist/coordinates/latlon/internal/parse-format.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":4783},"dist/coordinates/latlon/internal/parse-format.js":{"imports":[{"path":".","kind":"import-statement","external":true},{"path":"./parse","kind":"import-statement","external":true},{"path":"./violation","kind":"import-statement","external":true}],"exports":["createParser"],"entryPoint":"src/coordinates/latlon/internal/parse-format.ts","inputs":{"src/coordinates/latlon/internal/parse-format.ts":{"bytesInOutput":1758}},"bytes":1785},"dist/coordinates/latlon/internal/parse.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":2869},"dist/coordinates/latlon/internal/parse.js":{"imports":[{"path":"./lexer","kind":"import-statement","external":true},{"path":"./pipes","kind":"import-statement","external":true},{"path":"./violation","kind":"import-statement","external":true}],"exports":["parse"],"entryPoint":"src/coordinates/latlon/internal/parse.ts","inputs":{"src/coordinates/latlon/internal/parse.ts":{"bytesInOutput":344}},"bytes":364},"dist/coordinates/latlon/internal/violation.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":931},"dist/coordinates/latlon/internal/violation.js":{"imports":[],"exports":["violation"],"entryPoint":"src/coordinates/latlon/internal/violation.ts","inputs":{"src/coordinates/latlon/internal/violation.ts":{"bytesInOutput":41}},"bytes":65},"dist/coordinates/latlon/internal/pipes/check-ambiguous.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":3135},"dist/coordinates/latlon/internal/pipes/check-ambiguous.js":{"imports":[{"path":"..","kind":"import-statement","external":true},{"path":"../pipes","kind":"import-statement","external":true},{"path":"./simpler","kind":"import-statement","external":true}],"exports":["checkAmbiguousGrouping"],"entryPoint":"src/coordinates/latlon/internal/pipes/check-ambiguous.ts","inputs":{"src/coordinates/latlon/internal/pipes/check-ambiguous.ts":{"bytesInOutput":763}},"bytes":800},"dist/coordinates/latlon/decimal-degrees/parser.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":5039},"dist/coordinates/latlon/decimal-degrees/parser.js":{"imports":[{"path":"@/patterning","kind":"import-statement","external":true},{"path":"../internal","kind":"import-statement","external":true},{"path":"../internal/parse-format","kind":"import-statement","external":true}],"exports":["parseDecimalDegrees"],"entryPoint":"src/coordinates/latlon/decimal-degrees/parser.ts","inputs":{"src/coordinates/latlon/decimal-degrees/parser.ts":{"bytesInOutput":2051}},"bytes":2085},"dist/coordinates/latlon/decimal-degrees/system.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":2125},"dist/coordinates/latlon/decimal-degrees/system.js":{"imports":[{"path":"../internal","kind":"import-statement","external":true},{"path":"./parser","kind":"import-statement","external":true}],"exports":["systemDecimalDegrees"],"entryPoint":"src/coordinates/latlon/decimal-degrees/system.ts","inputs":{"src/coordinates/latlon/decimal-degrees/system.ts":{"bytesInOutput":541}},"bytes":576},"dist/coordinates/latlon/degrees-decimal-minutes/parser.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":6056},"dist/coordinates/latlon/degrees-decimal-minutes/parser.js":{"imports":[{"path":"@/patterning","kind":"import-statement","external":true},{"path":"../internal","kind":"import-statement","external":true},{"path":"../internal/in-range","kind":"import-statement","external":true},{"path":"../internal/parse-format","kind":"import-statement","external":true}],"exports":["parseDegreesDecimalMinutes"],"entryPoint":"src/coordinates/latlon/degrees-decimal-minutes/parser.ts","inputs":{"src/coordinates/latlon/degrees-decimal-minutes/parser.ts":{"bytesInOutput":2529}},"bytes":2570},"dist/coordinates/latlon/degrees-decimal-minutes/system.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":2610},"dist/coordinates/latlon/degrees-decimal-minutes/system.js":{"imports":[{"path":"../internal","kind":"import-statement","external":true},{"path":"./parser","kind":"import-statement","external":true}],"exports":["systemDegreesDecimalMinutes"],"entryPoint":"src/coordinates/latlon/degrees-decimal-minutes/system.ts","inputs":{"src/coordinates/latlon/degrees-decimal-minutes/system.ts":{"bytesInOutput":810}},"bytes":852},"dist/coordinates/latlon/degrees-minutes-seconds/parser.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":6155},"dist/coordinates/latlon/degrees-minutes-seconds/parser.js":{"imports":[{"path":"@/patterning","kind":"import-statement","external":true},{"path":"../internal","kind":"import-statement","external":true},{"path":"../internal/in-range","kind":"import-statement","external":true},{"path":"../internal/parse-format","kind":"import-statement","external":true}],"exports":["parseDegreesMinutesSeconds"],"entryPoint":"src/coordinates/latlon/degrees-minutes-seconds/parser.ts","inputs":{"src/coordinates/latlon/degrees-minutes-seconds/parser.ts":{"bytesInOutput":2538}},"bytes":2579},"dist/coordinates/latlon/degrees-minutes-seconds/system.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":2904},"dist/coordinates/latlon/degrees-minutes-seconds/system.js":{"imports":[{"path":"../internal","kind":"import-statement","external":true},{"path":"./parser","kind":"import-statement","external":true}],"exports":["systemDegreesMinutesSeconds"],"entryPoint":"src/coordinates/latlon/degrees-minutes-seconds/system.ts","inputs":{"src/coordinates/latlon/degrees-minutes-seconds/system.ts":{"bytesInOutput":933}},"bytes":975},"dist/coordinates/latlon/internal/coordinate-system.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"dist/coordinates/latlon/internal/coordinate-system.js":{"imports":[],"exports":[],"entryPoint":"src/coordinates/latlon/internal/coordinate-system.ts","inputs":{"src/coordinates/latlon/internal/coordinate-system.ts":{"bytesInOutput":0}},"bytes":0},"dist/coordinates/latlon/internal/create-cache.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":1913},"dist/coordinates/latlon/internal/create-cache.js":{"imports":[{"path":".","kind":"import-statement","external":true}],"exports":["createCache"],"entryPoint":"src/coordinates/latlon/internal/create-cache.ts","inputs":{"src/coordinates/latlon/internal/create-cache.ts":{"bytesInOutput":325}},"bytes":351},"dist/cartesian.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":1855},"dist/cartesian.js":{"imports":[],"exports":["cartesian"],"entryPoint":"src/cartesian.ts","inputs":{"src/cartesian.ts":{"bytesInOutput":207}},"bytes":231},"dist/index.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":1580},"dist/index.js":{"imports":[{"path":"./coordinates/coordinate","kind":"import-statement","external":true},{"path":"./coordinates/latlon/decimal-degrees/parser","kind":"import-statement","external":true},{"path":"./coordinates/latlon/degrees-decimal-minutes/parser","kind":"import-statement","external":true},{"path":"./coordinates/latlon/degrees-minutes-seconds/parser","kind":"import-statement","external":true},{"path":"./coordinates/mgrs/parser","kind":"import-statement","external":true},{"path":"./coordinates/utm/parser","kind":"import-statement","external":true}],"exports":["coordinateSystems","createCoordinate","parseDecimalDegrees","parseDegreesDecimalMinutes","parseDegreesMinutesSeconds","parseMGRS","parseUTM"],"entryPoint":"src/index.ts","inputs":{"src/index.ts":{"bytesInOutput":467}},"bytes":627},"dist/patterning.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":3276},"dist/patterning.js":{"imports":[],"exports":["capture","fromTemplate","group","merge","optional"],"entryPoint":"src/patterning.ts","inputs":{"src/patterning.ts":{"bytesInOutput":465}},"bytes":533},"dist/coordinates/coordinate.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":8551},"dist/coordinates/coordinate.js":{"imports":[{"path":"./latlon/decimal-degrees/system","kind":"import-statement","external":true},{"path":"./latlon/degrees-decimal-minutes/system","kind":"import-statement","external":true},{"path":"./latlon/degrees-minutes-seconds/system","kind":"import-statement","external":true},{"path":"./latlon/internal","kind":"import-statement","external":true},{"path":"./latlon/internal/create-cache","kind":"import-statement","external":true},{"path":"./mgrs/system","kind":"import-statement","external":true},{"path":"./utm/system","kind":"import-statement","external":true}],"exports":["coordinateSystems","createCoordinate"],"entryPoint":"src/coordinates/coordinate.ts","inputs":{"src/coordinates/coordinate.ts":{"bytesInOutput":2557}},"bytes":2609},"dist/coordinates/mgrs/parser.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":3440},"dist/coordinates/mgrs/parser.js":{"imports":[{"path":"@ngageoint/mgrs-js","kind":"import-statement","external":true},{"path":"../latlon/internal/parse","kind":"import-statement","external":true},{"path":"../latlon/internal/violation","kind":"import-statement","external":true}],"exports":["parseMGRS"],"entryPoint":"src/coordinates/mgrs/parser.ts","inputs":{"src/coordinates/mgrs/parser.ts":{"bytesInOutput":1368}},"bytes":1392},"dist/coordinates/mgrs/system.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":2213},"dist/coordinates/mgrs/system.js":{"imports":[{"path":"@ngageoint/grid-js","kind":"import-statement","external":true},{"path":"@ngageoint/mgrs-js","kind":"import-statement","external":true},{"path":"../latlon/internal","kind":"import-statement","external":true},{"path":"./parser","kind":"import-statement","external":true}],"exports":["systemMGRS"],"entryPoint":"src/coordinates/mgrs/system.ts","inputs":{"src/coordinates/mgrs/system.ts":{"bytesInOutput":624}},"bytes":649},"dist/coordinates/utm/parser.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":3100},"dist/coordinates/utm/parser.js":{"imports":[{"path":"@ngageoint/mgrs-js","kind":"import-statement","external":true},{"path":"../latlon/internal/parse","kind":"import-statement","external":true},{"path":"../latlon/internal/violation","kind":"import-statement","external":true}],"exports":["parseUTM"],"entryPoint":"src/coordinates/utm/parser.ts","inputs":{"src/coordinates/utm/parser.ts":{"bytesInOutput":1164}},"bytes":1187},"dist/coordinates/utm/system.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":2207},"dist/coordinates/utm/system.js":{"imports":[{"path":"@ngageoint/grid-js","kind":"import-statement","external":true},{"path":"@ngageoint/mgrs-js","kind":"import-statement","external":true},{"path":"../latlon/internal","kind":"import-statement","external":true},{"path":"./parser","kind":"import-statement","external":true}],"exports":["systemUTM"],"entryPoint":"src/coordinates/utm/system.ts","inputs":{"src/coordinates/utm/system.ts":{"bytesInOutput":619}},"bytes":643}}}
package/package.json CHANGED
@@ -1,15 +1,27 @@
1
1
  {
2
2
  "name": "@accelint/geo",
3
- "version": "0.2.8",
3
+ "title": "Accelint Geo",
4
+ "version": "0.2.10",
4
5
  "private": false,
5
6
  "license": "Apache-2.0",
7
+ "keywords": [
8
+ "dev-tk",
9
+ "tooling"
10
+ ],
11
+ "description": "A collection of JavaScript functions for working with coordinates and geospatial data.",
6
12
  "repository": {
7
13
  "type": "git",
8
14
  "url": "https://github.com/gohypergiant/standard-toolkit"
9
15
  },
16
+ "owner": "default/pathfinder",
17
+ "subPath": "packages/geo",
10
18
  "type": "module",
11
19
  "files": [
12
- "dist/**"
20
+ "./dist/**",
21
+ "./catalog-info.yaml",
22
+ "./CHANGELOG.md",
23
+ "./package.json",
24
+ "./README.md"
13
25
  ],
14
26
  "types": "./dist/index.d.ts",
15
27
  "exports": {
@@ -26,15 +38,16 @@
26
38
  "esbuild-fix-imports-plugin": "1.0.21",
27
39
  "tsup": "8.5.0",
28
40
  "vitest": "2.1.3",
29
- "@accelint/typescript-config": "0.1.2",
30
- "@accelint/vitest-config": "0.1.3"
41
+ "@accelint/constellation-tracker": "1.0.0",
42
+ "@accelint/typescript-config": "0.1.3",
43
+ "@accelint/vitest-config": "0.1.4"
31
44
  },
32
45
  "dependencies": {
33
46
  "@ngageoint/grid-js": "2.1.0",
34
47
  "@ngageoint/mgrs-js": "1.0.0",
35
48
  "typescript": "^5.8.3",
36
- "@accelint/math": "0.1.5",
37
- "@accelint/predicates": "0.4.0"
49
+ "@accelint/math": "0.1.6",
50
+ "@accelint/predicates": "0.4.2"
38
51
  },
39
52
  "$schema": "https://json.schemastore.org/package",
40
53
  "author": "https://hypergiant.com",
@@ -45,6 +58,7 @@
45
58
  "scripts": {
46
59
  "bench": "pnpm vitest bench --run --dir src",
47
60
  "build": "pnpm tsup",
61
+ "constellation-tracker": "constellation-tracker",
48
62
  "dev": "pnpm tsc --watch",
49
63
  "index": "pnpm zx ../../scripts/indexer.mjs packages/geo",
50
64
  "lint": "pnpm biome lint",