@speleotica/frcsdata 4.3.1 → 5.0.0-beta.1

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 (133) hide show
  1. package/ParseIssue.d.ts +98 -0
  2. package/ParseIssue.d.ts.map +1 -0
  3. package/ParseIssue.js +17 -0
  4. package/ParseIssue.js.map +1 -0
  5. package/SourceLoc.d.ts +67 -0
  6. package/SourceLoc.d.ts.map +1 -0
  7. package/SourceLoc.js +18 -0
  8. package/SourceLoc.js.map +1 -0
  9. package/chunksToLines.d.ts +5 -0
  10. package/chunksToLines.d.ts.map +1 -0
  11. package/chunksToLines.js +139 -0
  12. package/chunksToLines.js.map +1 -0
  13. package/cli/check-survey.d.ts +2 -0
  14. package/cli/check-survey.d.ts.map +1 -0
  15. package/cli/check-survey.js +88 -0
  16. package/cli/check-survey.js.map +1 -0
  17. package/cli/parse-survey.d.ts +2 -0
  18. package/cli/parse-survey.d.ts.map +1 -0
  19. package/cli/parse-survey.js +37 -0
  20. package/cli/parse-survey.js.map +1 -0
  21. package/cli.d.ts +2 -0
  22. package/cli.d.ts.map +1 -0
  23. package/cli.js +83 -0
  24. package/cli.js.map +1 -0
  25. package/index.d.ts +5 -7
  26. package/index.d.ts.map +1 -1
  27. package/index.js +3 -36
  28. package/index.js.map +1 -1
  29. package/node/index.d.ts +1 -1
  30. package/node/index.d.ts.map +1 -1
  31. package/node/index.js +13 -5
  32. package/node/index.js.map +1 -1
  33. package/package.json +8 -6
  34. package/src/ParseIssue.ts +19 -0
  35. package/src/SourceLoc.ts +13 -0
  36. package/src/chunksToLines.ts +26 -0
  37. package/src/cli/check-survey.ts +84 -0
  38. package/src/cli/parse-survey.ts +10 -0
  39. package/src/cli.ts +30 -0
  40. package/src/index.ts +9 -7
  41. package/src/node/index.ts +18 -5
  42. package/src/string/index.ts +18 -5
  43. package/src/survey/FrcsSurveyFile.ts +217 -0
  44. package/src/survey/FrcsSurveyFileJson.ts +46 -0
  45. package/src/survey/ZodFrcsSurveyFileJson.ts +260 -0
  46. package/src/survey/ZodFrcsSurveyFileToJson.ts +297 -0
  47. package/src/{formatFrcsShot.ts → survey/formatFrcsShot.ts} +39 -22
  48. package/src/{formatFrcsSurveyFile.ts → survey/formatFrcsSurveyFile.ts} +4 -5
  49. package/src/survey/getColumnRanges.ts +82 -0
  50. package/src/survey/normalizeTeamMemberName.ts +10 -0
  51. package/src/survey/parseFrcsSurveyFile.ts +862 -0
  52. package/src/survey/parsers.ts +128 -0
  53. package/src/survey/validators.ts +24 -0
  54. package/src/underlineSource.ts +34 -0
  55. package/src/web/index.ts +27 -21
  56. package/string/index.d.ts +1 -1
  57. package/string/index.d.ts.map +1 -1
  58. package/string/index.js +13 -5
  59. package/string/index.js.map +1 -1
  60. package/survey/FrcsSurveyFile.d.ts +172 -0
  61. package/survey/FrcsSurveyFile.d.ts.map +1 -0
  62. package/{FrcsSurveyFile.js → survey/FrcsSurveyFile.js} +2 -0
  63. package/survey/FrcsSurveyFile.js.map +1 -0
  64. package/survey/FrcsSurveyFileJson.d.ts +15 -0
  65. package/survey/FrcsSurveyFileJson.d.ts.map +1 -0
  66. package/{FrcsTrip.js → survey/FrcsSurveyFileJson.js} +1 -1
  67. package/survey/FrcsSurveyFileJson.js.map +1 -0
  68. package/survey/ZodFrcsSurveyFileJson.d.ts +60549 -0
  69. package/survey/ZodFrcsSurveyFileJson.d.ts.map +1 -0
  70. package/survey/ZodFrcsSurveyFileJson.js +188 -0
  71. package/survey/ZodFrcsSurveyFileJson.js.map +1 -0
  72. package/survey/ZodFrcsSurveyFileToJson.d.ts +60390 -0
  73. package/survey/ZodFrcsSurveyFileToJson.d.ts.map +1 -0
  74. package/survey/ZodFrcsSurveyFileToJson.js +219 -0
  75. package/survey/ZodFrcsSurveyFileToJson.js.map +1 -0
  76. package/{formatFrcsShot.d.ts → survey/formatFrcsShot.d.ts} +2 -3
  77. package/survey/formatFrcsShot.d.ts.map +1 -0
  78. package/{formatFrcsShot.js → survey/formatFrcsShot.js} +15 -6
  79. package/survey/formatFrcsShot.js.map +1 -0
  80. package/survey/formatFrcsSurveyFile.d.ts +3 -0
  81. package/survey/formatFrcsSurveyFile.d.ts.map +1 -0
  82. package/{formatFrcsSurveyFile.js → survey/formatFrcsSurveyFile.js} +4 -4
  83. package/survey/formatFrcsSurveyFile.js.map +1 -0
  84. package/survey/getColumnRanges.d.ts +24 -0
  85. package/survey/getColumnRanges.d.ts.map +1 -0
  86. package/survey/getColumnRanges.js +70 -0
  87. package/survey/getColumnRanges.js.map +1 -0
  88. package/survey/normalizeTeamMemberName.d.ts +2 -0
  89. package/survey/normalizeTeamMemberName.d.ts.map +1 -0
  90. package/survey/normalizeTeamMemberName.js +16 -0
  91. package/survey/normalizeTeamMemberName.js.map +1 -0
  92. package/{parseFrcsSurveyFile.d.ts → survey/parseFrcsSurveyFile.d.ts} +2 -5
  93. package/survey/parseFrcsSurveyFile.d.ts.map +1 -0
  94. package/survey/parseFrcsSurveyFile.js +818 -0
  95. package/survey/parseFrcsSurveyFile.js.map +1 -0
  96. package/survey/parsers.d.ts +11 -0
  97. package/survey/parsers.d.ts.map +1 -0
  98. package/survey/parsers.js +119 -0
  99. package/survey/parsers.js.map +1 -0
  100. package/survey/validators.d.ts +7 -0
  101. package/survey/validators.d.ts.map +1 -0
  102. package/survey/validators.js +36 -0
  103. package/survey/validators.js.map +1 -0
  104. package/underlineSource.d.ts +6 -0
  105. package/underlineSource.d.ts.map +1 -0
  106. package/underlineSource.js +30 -0
  107. package/underlineSource.js.map +1 -0
  108. package/web/index.d.ts +6 -6
  109. package/web/index.d.ts.map +1 -1
  110. package/web/index.js +9 -7
  111. package/web/index.js.map +1 -1
  112. package/FrcsShot.d.ts +0 -57
  113. package/FrcsShot.d.ts.map +0 -1
  114. package/FrcsShot.js +0 -13
  115. package/FrcsShot.js.map +0 -1
  116. package/FrcsSurveyFile.d.ts +0 -29
  117. package/FrcsSurveyFile.d.ts.map +0 -1
  118. package/FrcsSurveyFile.js.map +0 -1
  119. package/FrcsTrip.d.ts +0 -23
  120. package/FrcsTrip.d.ts.map +0 -1
  121. package/FrcsTrip.js.map +0 -1
  122. package/formatFrcsShot.d.ts.map +0 -1
  123. package/formatFrcsShot.js.map +0 -1
  124. package/formatFrcsSurveyFile.d.ts +0 -3
  125. package/formatFrcsSurveyFile.d.ts.map +0 -1
  126. package/formatFrcsSurveyFile.js.map +0 -1
  127. package/parseFrcsSurveyFile.d.ts.map +0 -1
  128. package/parseFrcsSurveyFile.js +0 -812
  129. package/parseFrcsSurveyFile.js.map +0 -1
  130. package/src/FrcsShot.ts +0 -56
  131. package/src/FrcsSurveyFile.ts +0 -47
  132. package/src/FrcsTrip.ts +0 -25
  133. package/src/parseFrcsSurveyFile.ts +0 -788
package/FrcsShot.d.ts.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"FrcsShot.d.ts","sourceRoot":"","sources":["src/FrcsShot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAA;AACpE,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAEtC,oBAAY,YAAY;IACtB,MAAM,MAAM;IACZ,UAAU,MAAM;IAChB,QAAQ,MAAM;CACf;AAED,MAAM,MAAM,QAAQ,GAAG;IACrB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAA;IACZ;;OAEG;IACH,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAClB,IAAI,EAAE,YAAY,CAAA;IAClB,QAAQ,EAAE,cAAc,CAAC,MAAM,CAAC,CAAA;IAChC,kBAAkB,CAAC,EAAE,cAAc,CAAC,MAAM,CAAC,GAAG,IAAI,CAAA;IAClD,gBAAgB,CAAC,EAAE,cAAc,CAAC,MAAM,CAAC,GAAG,IAAI,CAAA;IAChD,iBAAiB,CAAC,EAAE,cAAc,CAAC,KAAK,CAAC,GAAG,IAAI,CAAA;IAChD,qBAAqB,CAAC,EAAE,cAAc,CAAC,KAAK,CAAC,GAAG,IAAI,CAAA;IACpD,gBAAgB,CAAC,EAAE,cAAc,CAAC,KAAK,CAAC,GAAG,IAAI,CAAA;IAC/C,oBAAoB,CAAC,EAAE,cAAc,CAAC,KAAK,CAAC,GAAG,IAAI,CAAA;IACnD;;OAEG;IACH,SAAS,CAAC,EAAE;QACV,IAAI,CAAC,EAAE,cAAc,CAAC,MAAM,CAAC,GAAG,IAAI,CAAA;QACpC,KAAK,CAAC,EAAE,cAAc,CAAC,MAAM,CAAC,GAAG,IAAI,CAAA;QACrC,EAAE,CAAC,EAAE,cAAc,CAAC,MAAM,CAAC,GAAG,IAAI,CAAA;QAClC,IAAI,CAAC,EAAE,cAAc,CAAC,MAAM,CAAC,GAAG,IAAI,CAAA;KACrC,CAAA;IACD;;OAEG;IACH,OAAO,CAAC,EAAE;QACR,IAAI,CAAC,EAAE,cAAc,CAAC,MAAM,CAAC,GAAG,IAAI,CAAA;QACpC,KAAK,CAAC,EAAE,cAAc,CAAC,MAAM,CAAC,GAAG,IAAI,CAAA;QACrC,EAAE,CAAC,EAAE,cAAc,CAAC,MAAM,CAAC,GAAG,IAAI,CAAA;QAClC,IAAI,CAAC,EAAE,cAAc,CAAC,MAAM,CAAC,GAAG,IAAI,CAAA;KACrC,CAAA;IACD,eAAe,CAAC,EAAE,OAAO,GAAG,IAAI,CAAA;IAChC,OAAO,CAAC,EAAE,OAAO,GAAG,IAAI,CAAA;IACxB,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACvB;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,QAAQ,GAAG;QAAE,KAAK,CAAC,EAAE,SAAS,CAAA;KAAE,CAAA;CAC5C,CAAA"}
package/FrcsShot.js DELETED
@@ -1,13 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.FrcsShotKind = void 0;
7
- var FrcsShotKind = exports.FrcsShotKind = /*#__PURE__*/function (FrcsShotKind) {
8
- FrcsShotKind["Normal"] = " ";
9
- FrcsShotKind["Horizontal"] = "H";
10
- FrcsShotKind["Diagonal"] = "D";
11
- return FrcsShotKind;
12
- }({});
13
- //# sourceMappingURL=FrcsShot.js.map
package/FrcsShot.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"FrcsShot.js","names":["FrcsShotKind","exports"],"sources":["src/FrcsShot.ts"],"sourcesContent":["import { UnitizedNumber, Length, Angle } from '@speleotica/unitized'\nimport { FrcsUnits } from './FrcsTrip'\n\nexport enum FrcsShotKind {\n Normal = ' ',\n Horizontal = 'H',\n Diagonal = 'D',\n}\n\nexport type FrcsShot = {\n /**\n * Name of from station\n */\n from: string\n /**\n * Name of to station\n */\n to?: string | null\n kind: FrcsShotKind\n distance: UnitizedNumber<Length>\n horizontalDistance?: UnitizedNumber<Length> | null\n verticalDistance?: UnitizedNumber<Length> | null\n frontsightAzimuth?: UnitizedNumber<Angle> | null\n frontsightInclination?: UnitizedNumber<Angle> | null\n backsightAzimuth?: UnitizedNumber<Angle> | null\n backsightInclination?: UnitizedNumber<Angle> | null\n /**\n * LRUDs at from station\n */\n fromLruds?: {\n left?: UnitizedNumber<Length> | null\n right?: UnitizedNumber<Length> | null\n up?: UnitizedNumber<Length> | null\n down?: UnitizedNumber<Length> | null\n }\n /**\n * LRUDs at to station\n */\n toLruds?: {\n left?: UnitizedNumber<Length> | null\n right?: UnitizedNumber<Length> | null\n up?: UnitizedNumber<Length> | null\n down?: UnitizedNumber<Length> | null\n }\n excludeDistance?: boolean | null\n isSplay?: boolean | null\n comment?: string | null\n /**\n * In the edge case that the surveyors changed measurement units or\n * corrected/uncorrected backsights in the middle of a trip, the measurements\n * will be normalized to the initial trip settings, and this field will contain\n * the actual values recorded, verbatim. The first shot of the group with\n * changed units will include the changed units.\n */\n recorded?: FrcsShot & { units?: FrcsUnits }\n}\n"],"mappings":";;;;;;IAGYA,YAAY,GAAAC,OAAA,CAAAD,YAAA,0BAAZA,YAAY;EAAZA,YAAY;EAAZA,YAAY;EAAZA,YAAY;EAAA,OAAZA,YAAY;AAAA","ignoreList":[]}
@@ -1,29 +0,0 @@
1
- import { FrcsTrip } from './FrcsTrip';
2
- import { SegmentParseError } from 'parse-segment';
3
- export type FrcsSurveyFile = {
4
- cave?: string | null;
5
- columns?: FrcsShotColumnConfig;
6
- location?: string | null;
7
- comment?: string | null;
8
- trips: Array<FrcsTrip>;
9
- errors?: Array<SegmentParseError> | null;
10
- };
11
- export type FrcsShotColumnConfig = {
12
- toStation: number;
13
- fromStation: number;
14
- distance: number;
15
- distanceFeet: number;
16
- distanceInches: number;
17
- kind: number;
18
- exclude: number;
19
- frontsightAzimuth: number;
20
- backsightAzimuth: number;
21
- frontsightInclination: number;
22
- backsightInclination: number;
23
- left: number;
24
- right: number;
25
- up: number;
26
- down: number;
27
- };
28
- export declare const defaultFrcsShotColumnConfig: FrcsShotColumnConfig;
29
- //# sourceMappingURL=FrcsSurveyFile.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"FrcsSurveyFile.d.ts","sourceRoot":"","sources":["src/FrcsSurveyFile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AACrC,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AAEjD,MAAM,MAAM,cAAc,GAAG;IAC3B,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,OAAO,CAAC,EAAE,oBAAoB,CAAA;IAC9B,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACvB,KAAK,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAA;IACtB,MAAM,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC,GAAG,IAAI,CAAA;CACzC,CAAA;AAED,MAAM,MAAM,oBAAoB,GAAG;IACjC,SAAS,EAAE,MAAM,CAAA;IACjB,WAAW,EAAE,MAAM,CAAA;IACnB,QAAQ,EAAE,MAAM,CAAA;IAChB,YAAY,EAAE,MAAM,CAAA;IACpB,cAAc,EAAE,MAAM,CAAA;IACtB,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;IACf,iBAAiB,EAAE,MAAM,CAAA;IACzB,gBAAgB,EAAE,MAAM,CAAA;IACxB,qBAAqB,EAAE,MAAM,CAAA;IAC7B,oBAAoB,EAAE,MAAM,CAAA;IAC5B,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;CACb,CAAA;AAED,eAAO,MAAM,2BAA2B,EAAE,oBAgBzC,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"FrcsSurveyFile.js","names":["defaultFrcsShotColumnConfig","exports","toStation","fromStation","distance","distanceFeet","distanceInches","kind","exclude","frontsightAzimuth","backsightAzimuth","frontsightInclination","backsightInclination","left","right","up","down"],"sources":["src/FrcsSurveyFile.ts"],"sourcesContent":["import { FrcsTrip } from './FrcsTrip'\nimport { SegmentParseError } from 'parse-segment'\n\nexport type FrcsSurveyFile = {\n cave?: string | null\n columns?: FrcsShotColumnConfig\n location?: string | null\n comment?: string | null\n trips: Array<FrcsTrip>\n errors?: Array<SegmentParseError> | null\n}\n\nexport type FrcsShotColumnConfig = {\n toStation: number\n fromStation: number\n distance: number\n distanceFeet: number\n distanceInches: number\n kind: number\n exclude: number\n frontsightAzimuth: number\n backsightAzimuth: number\n frontsightInclination: number\n backsightInclination: number\n left: number\n right: number\n up: number\n down: number\n}\n\nexport const defaultFrcsShotColumnConfig: FrcsShotColumnConfig = {\n toStation: 5,\n fromStation: 5,\n distance: 6,\n distanceFeet: 4,\n distanceInches: 3,\n kind: 1,\n exclude: 1,\n frontsightAzimuth: 6,\n backsightAzimuth: 6,\n frontsightInclination: 5,\n backsightInclination: 5,\n left: 3,\n right: 3,\n up: 3,\n down: 3,\n}\n"],"mappings":";;;;;;AA8BO,IAAMA,2BAAiD,GAAAC,OAAA,CAAAD,2BAAA,GAAG;EAC/DE,SAAS,EAAE,CAAC;EACZC,WAAW,EAAE,CAAC;EACdC,QAAQ,EAAE,CAAC;EACXC,YAAY,EAAE,CAAC;EACfC,cAAc,EAAE,CAAC;EACjBC,IAAI,EAAE,CAAC;EACPC,OAAO,EAAE,CAAC;EACVC,iBAAiB,EAAE,CAAC;EACpBC,gBAAgB,EAAE,CAAC;EACnBC,qBAAqB,EAAE,CAAC;EACxBC,oBAAoB,EAAE,CAAC;EACvBC,IAAI,EAAE,CAAC;EACPC,KAAK,EAAE,CAAC;EACRC,EAAE,EAAE,CAAC;EACLC,IAAI,EAAE;AACR,CAAC","ignoreList":[]}
package/FrcsTrip.d.ts DELETED
@@ -1,23 +0,0 @@
1
- import { Unit, Length, Angle } from '@speleotica/unitized';
2
- import { FrcsShot } from './FrcsShot';
3
- export type FrcsUnits = {
4
- distanceUnit: Unit<Length>;
5
- azimuthUnit: Unit<Angle>;
6
- inclinationUnit: Unit<Angle>;
7
- backsightAzimuthCorrected?: boolean | null;
8
- backsightInclinationCorrected?: boolean | null;
9
- hasBacksightAzimuth?: boolean | null;
10
- hasBacksightInclination?: boolean | null;
11
- };
12
- export type FrcsTripHeader = FrcsUnits & {
13
- name: string;
14
- comment?: string | null;
15
- section?: string | null;
16
- date?: Date | null;
17
- team?: Array<string> | null;
18
- };
19
- export type FrcsTrip = {
20
- header: FrcsTripHeader;
21
- shots: Array<FrcsShot>;
22
- };
23
- //# sourceMappingURL=FrcsTrip.d.ts.map
package/FrcsTrip.d.ts.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"FrcsTrip.d.ts","sourceRoot":"","sources":["src/FrcsTrip.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAA;AAC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAErC,MAAM,MAAM,SAAS,GAAG;IACtB,YAAY,EAAE,IAAI,CAAC,MAAM,CAAC,CAAA;IAC1B,WAAW,EAAE,IAAI,CAAC,KAAK,CAAC,CAAA;IACxB,eAAe,EAAE,IAAI,CAAC,KAAK,CAAC,CAAA;IAC5B,yBAAyB,CAAC,EAAE,OAAO,GAAG,IAAI,CAAA;IAC1C,6BAA6B,CAAC,EAAE,OAAO,GAAG,IAAI,CAAA;IAC9C,mBAAmB,CAAC,EAAE,OAAO,GAAG,IAAI,CAAA;IACpC,uBAAuB,CAAC,EAAE,OAAO,GAAG,IAAI,CAAA;CACzC,CAAA;AAED,MAAM,MAAM,cAAc,GAAG,SAAS,GAAG;IACvC,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACvB,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACvB,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,CAAA;IAClB,IAAI,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,GAAG,IAAI,CAAA;CAC5B,CAAA;AAED,MAAM,MAAM,QAAQ,GAAG;IACrB,MAAM,EAAE,cAAc,CAAA;IACtB,KAAK,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAA;CACvB,CAAA"}
package/FrcsTrip.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"FrcsTrip.js","names":[],"sources":["src/FrcsTrip.ts"],"sourcesContent":["import { Unit, Length, Angle } from '@speleotica/unitized'\nimport { FrcsShot } from './FrcsShot'\n\nexport type FrcsUnits = {\n distanceUnit: Unit<Length>\n azimuthUnit: Unit<Angle>\n inclinationUnit: Unit<Angle>\n backsightAzimuthCorrected?: boolean | null\n backsightInclinationCorrected?: boolean | null\n hasBacksightAzimuth?: boolean | null\n hasBacksightInclination?: boolean | null\n}\n\nexport type FrcsTripHeader = FrcsUnits & {\n name: string\n comment?: string | null\n section?: string | null\n date?: Date | null\n team?: Array<string> | null\n}\n\nexport type FrcsTrip = {\n header: FrcsTripHeader\n shots: Array<FrcsShot>\n}\n"],"mappings":"","ignoreList":[]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"formatFrcsShot.d.ts","sourceRoot":"","sources":["src/formatFrcsShot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AACtC,OAAO,EAAE,QAAQ,EAAgB,MAAM,YAAY,CAAA;AAEnD,OAAO,EACL,oBAAoB,EAErB,MAAM,kBAAkB,CAAA;AAEzB,wBAAgB,kBAAkB,CAAC,EACjC,OAAqC,GACtC,GAAE;IAAE,OAAO,CAAC,EAAE,oBAAoB,CAAA;CAAO,UAuFH,QAAQ,UAAU,SAAS,KAAG,MAAM,CAoE1E;;AAED,wBAAmC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"formatFrcsShot.js","names":["_FrcsShot","require","_unitized","_FrcsSurveyFile","makeFormatFrcsShot","_ref","arguments","length","undefined","_ref$columns","columns","defaultFrcsShotColumnConfig","EMPTY_TO_STATION","repeat","toStation","formatFromStation","station","fromStation","Error","concat","padStart","formatToStation","trimZeroes","str","match","exec","formatNumber","width","formatNum","num","unit","verbatim","UnitizedNumber","get","Number","isFinite","precision","Math","max","String","trunc","formatted","toFixed","substring","formatLeft","left","formatRight","right","formatUp","up","formatDown","down","EMPTY_DISTANCE","distance","formatDistance","EMPTY_FS_AZIMUTH","frontsightAzimuth","formatFsAzimuth","EMPTY_BS_AZIMUTH","backsightAzimuth","formatBsAzimuth","EMPTY_FS_INCLINATION","frontsightInclination","formatFsInclination","EMPTY_BS_INCLINATION","backsightInclination","formatBsInclination","formatVerticalDistance","EMPTY_FEET","distanceFeet","formatFeet","Length","feet","EMPTY_INCHES","distanceInches","formatInches","round","inches","formatFrcsShot","shot","header","_shot$toLruds","_shot$toLruds2","_shot$toLruds3","_shot$toLruds4","azimuthUnit","inclinationUnit","distanceUnit","isRecorded","recorded","to","_shot$recorded","_ref2","fromLruds","from","join","distColumnValue","kind","FrcsShotKind","Horizontal","horizontalDistance","excludeDistance","Normal","verticalDistance","toLruds","_default","exports"],"sources":["src/formatFrcsShot.ts"],"sourcesContent":["import { FrcsUnits } from './FrcsTrip'\nimport { FrcsShot, FrcsShotKind } from './FrcsShot'\nimport { Length, Unit, UnitType, UnitizedNumber } from '@speleotica/unitized'\nimport {\n FrcsShotColumnConfig,\n defaultFrcsShotColumnConfig,\n} from './FrcsSurveyFile'\n\nexport function makeFormatFrcsShot({\n columns = defaultFrcsShotColumnConfig,\n}: { columns?: FrcsShotColumnConfig } = {}) {\n const EMPTY_TO_STATION = ' '.repeat(columns.toStation)\n\n function formatFromStation(station: string): string {\n if (station.length > columns.fromStation) {\n throw new Error(`station is too long: ${station}`)\n }\n return station.padStart(columns.fromStation, ' ')\n }\n function formatToStation(station: string): string {\n if (station.length > columns.toStation) {\n throw new Error(`station is too long: ${station}`)\n }\n return station.padStart(columns.toStation, ' ')\n }\n\n function trimZeroes(str: string): string {\n const match = /(-?\\d+)(\\.[1-9]*)0+$/.exec(str)\n if (!match) return str\n return match[2].length > 1 ? match[1] + match[2] : match[1]\n }\n\n const formatNumber = (width: number) => {\n function formatNum(num: number | null | undefined): string\n function formatNum<T extends UnitType<T>>(\n num: UnitizedNumber<T> | null | undefined,\n unit: Unit<T>,\n verbatim?: boolean\n ): string\n function formatNum<T extends UnitType<T>>(\n num: number | UnitizedNumber<T> | null | undefined,\n unit?: Unit<T>,\n verbatim?: boolean\n ): string {\n if (num instanceof UnitizedNumber) {\n return formatNum(num.get(verbatim ? num.unit : unit || num.unit))\n }\n if (num == null || !Number.isFinite(num)) return ' '.repeat(width)\n const precision = Math.max(0, width - String(Math.trunc(num)).length - 1)\n const formatted = trimZeroes(num.toFixed(precision))\n return formatted.length <= width\n ? formatted.padStart(width, ' ')\n : formatted.substring(0, width)\n }\n return formatNum\n }\n\n const formatLeft = formatNumber(columns.left)\n const formatRight = formatNumber(columns.right)\n const formatUp = formatNumber(columns.up)\n const formatDown = formatNumber(columns.down)\n\n const EMPTY_DISTANCE = ' '.repeat(columns.distance)\n const formatDistance = formatNumber(columns.distance)\n\n const EMPTY_FS_AZIMUTH = ' '.repeat(columns.frontsightAzimuth)\n const formatFsAzimuth = formatNumber(columns.frontsightAzimuth)\n const EMPTY_BS_AZIMUTH = ' '.repeat(columns.backsightAzimuth)\n const formatBsAzimuth = formatNumber(columns.backsightAzimuth)\n\n const EMPTY_FS_INCLINATION = ' '.repeat(columns.frontsightInclination)\n const formatFsInclination = formatNumber(columns.frontsightInclination)\n const EMPTY_BS_INCLINATION = ' '.repeat(columns.backsightInclination)\n const formatBsInclination = formatNumber(columns.backsightInclination)\n\n const formatVerticalDistance = formatNumber(columns.frontsightInclination)\n\n const EMPTY_FEET = ' '.repeat(columns.distanceFeet)\n\n function formatFeet(distance: UnitizedNumber<Length> | null | void): string {\n if (!distance) return EMPTY_FEET\n return formatNumber(columns.distanceFeet)(\n Math.trunc(distance.get(Length.feet))\n )\n }\n\n const EMPTY_INCHES = ' '.repeat(columns.distanceInches)\n\n function formatInches(\n distance: UnitizedNumber<Length> | null | void\n ): string {\n if (!distance) return EMPTY_INCHES\n return formatNumber(columns.distanceInches)(\n Math.round(distance.get(Length.inches) % 12)\n )\n }\n\n return function formatFrcsShot(shot: FrcsShot, header: FrcsUnits): string {\n const { azimuthUnit, inclinationUnit } = header\n let { distanceUnit } = header\n\n const inches = distanceUnit === Length.inches\n if (inches) distanceUnit = Length.feet\n\n const isRecorded = shot.recorded !== null\n\n if (!shot.to) {\n const { left, right, up, down } =\n shot.recorded?.fromLruds || shot.fromLruds || {}\n return [\n EMPTY_TO_STATION,\n formatFromStation(shot.from),\n EMPTY_DISTANCE,\n ' ', // kind\n ' ', // exclude\n EMPTY_FS_AZIMUTH,\n EMPTY_BS_AZIMUTH,\n EMPTY_FS_INCLINATION,\n EMPTY_BS_INCLINATION,\n formatLeft(left, distanceUnit, isRecorded),\n formatRight(right, distanceUnit, isRecorded),\n formatUp(up, distanceUnit, isRecorded),\n formatDown(down, distanceUnit, isRecorded),\n ].join('')\n }\n\n const distColumnValue =\n shot.kind === FrcsShotKind.Horizontal\n ? shot.horizontalDistance\n : shot.distance\n\n return [\n formatToStation(shot.to),\n formatFromStation(shot.from),\n inches\n ? formatFeet(distColumnValue)\n : formatDistance(distColumnValue, distanceUnit, isRecorded),\n inches ? formatInches(distColumnValue) : shot.kind,\n inches ? shot.kind : shot.excludeDistance ? '*' : ' ',\n formatFsAzimuth(shot.frontsightAzimuth, azimuthUnit, isRecorded),\n formatBsAzimuth(shot.backsightAzimuth, azimuthUnit, isRecorded),\n shot.kind === FrcsShotKind.Normal\n ? formatFsInclination(\n shot.frontsightInclination,\n inclinationUnit,\n isRecorded\n )\n : formatVerticalDistance(\n shot.verticalDistance,\n distanceUnit,\n isRecorded\n ),\n shot.kind === FrcsShotKind.Normal\n ? formatBsInclination(\n shot.backsightInclination,\n inclinationUnit,\n isRecorded\n )\n : EMPTY_BS_INCLINATION,\n formatLeft(shot.toLruds?.left, distanceUnit, isRecorded),\n formatRight(shot.toLruds?.right, distanceUnit, isRecorded),\n formatUp(shot.toLruds?.up, distanceUnit, isRecorded),\n formatDown(shot.toLruds?.down, distanceUnit, isRecorded),\n ].join('')\n }\n}\n\nexport default makeFormatFrcsShot()\n"],"mappings":";;;;;;;AACA,IAAAA,SAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,eAAA,GAAAF,OAAA;AAKO,SAASG,kBAAkBA,CAAA,EAEU;EAAA,IAAAC,IAAA,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAJ,CAAC,CAAC;IAAAG,YAAA,GAAAJ,IAAA,CADxCK,OAAO;IAAPA,OAAO,GAAAD,YAAA,cAAGE,2CAA2B,GAAAF,YAAA;EAErC,IAAMG,gBAAgB,GAAG,GAAG,CAACC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sC,YAAY,EAAEC,UAAU,CAAC,EACpDtC,UAAU,EAAAkC,cAAA,GAACL,IAAI,CAACyB,OAAO,cAAApB,cAAA,uBAAZA,cAAA,CAAcjC,IAAI,EAAEoC,YAAY,EAAEC,UAAU,CAAC,CACzD,CAACO,IAAI,CAAC,EAAE,CAAC;EACZ,CAAC;AACH;AAAC,IAAAU,QAAA,GAAAC,OAAA,cAEctG,kBAAkB,CAAC,CAAC","ignoreList":[]}
@@ -1,3 +0,0 @@
1
- import { FrcsSurveyFile } from './FrcsSurveyFile';
2
- export declare function formatFrcsSurveyFile(file: FrcsSurveyFile): AsyncIterable<string>;
3
- //# sourceMappingURL=formatFrcsSurveyFile.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"formatFrcsSurveyFile.d.ts","sourceRoot":"","sources":["src/formatFrcsSurveyFile.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAIjD,wBAAuB,oBAAoB,CACzC,IAAI,EAAE,cAAc,GACnB,aAAa,CAAC,MAAM,CAAC,CA2CvB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"formatFrcsSurveyFile.js","names":["_unitized","require","_formatFrcsShot","formatFrcsSurveyFile","_x","_formatFrcsSurveyFile","apply","arguments","_wrapAsyncGenerator2","_regenerator","mark","_callee","file","formatFrcsShot","tripIndex","trip","shots","header","name","team","date","comment","line2","alternateUnits","i","_shot$recorded","shot","lines","_i","wrap","_callee$","_context","prev","next","makeFormatFrcsShot","cave","concat","location","trips","length","replace","_toConsumableArray2","join","formatDate","formatUnits","split","recorded","units","stop","distUnit","formatLengthUnit","distanceUnit","azmMode","hasBacksightAzimuth","backsightAzimuthCorrected","incMode","hasBacksightInclination","backsightInclinationCorrected","azmUnit","formatAngleUnit","azimuthUnit","incUnit","inclinationUnit","getMonth","getDate","getFullYear","unit","Length","meters","feet","inches","Error","Angle","degrees","gradians"],"sources":["src/formatFrcsSurveyFile.ts"],"sourcesContent":["import { Angle, Length, Unit } from '@speleotica/unitized'\nimport { FrcsSurveyFile } from './FrcsSurveyFile'\nimport { FrcsUnits } from './FrcsTrip'\nimport { makeFormatFrcsShot } from './formatFrcsShot'\n\nexport async function* formatFrcsSurveyFile(\n file: FrcsSurveyFile\n): AsyncIterable<string> {\n const formatFrcsShot = makeFormatFrcsShot(file)\n if (file.cave) {\n yield ` ${file.cave}${file.location ? `, ${file.location}` : ''}\\n`\n }\n for (let tripIndex = 0; tripIndex < file.trips.length; tripIndex++) {\n const trip = file.trips[tripIndex]\n const { shots, header } = trip\n const { name, team, date, comment } = header\n if (tripIndex > 0) yield ' *\\n'\n yield name.replace(/\\n?$/, '\\n')\n const line2 = [\n ...(team?.length ? [team.join(', ')] : []),\n ...(date ? [formatDate(date)] : []),\n ].join('. ')\n if (line2) yield `${line2}\\n`\n if (comment) yield comment.replace(/\\n?$/, '\\n')\n yield ' *\\n'\n yield formatUnits(header)\n\n let alternateUnits: FrcsUnits | undefined\n\n for (let i = 0; i < shots.length; i++) {\n const shot = shots[i]\n if (shot.comment) {\n const lines = shot.comment.split(/\\n/gm)\n yield '*\\n'\n for (let i = 0; i < lines.length - 1; i++) {\n yield lines[i].replace(/\\n?$/, '\\n')\n }\n yield `* ${lines[lines.length - 1].replace(/\\n?$/, '\\n')}`\n }\n if (shot.recorded?.units) {\n alternateUnits = shot.recorded.units\n yield `* %NC\\n`\n yield formatUnits(shot.recorded.units)\n }\n yield formatFrcsShot(\n shot.recorded || shot,\n alternateUnits || header\n ).replace(/\\n?$/, '\\n')\n }\n }\n}\n\nfunction formatUnits(units: FrcsUnits): string {\n const distUnit = formatLengthUnit(units.distanceUnit)\n const azmMode = units.hasBacksightAzimuth\n ? units.backsightAzimuthCorrected\n ? 'C'\n : 'B'\n : ' '\n const incMode = units.hasBacksightInclination\n ? units.backsightInclinationCorrected\n ? 'C'\n : 'B'\n : ' '\n const azmUnit = formatAngleUnit(units.azimuthUnit)\n const incUnit = formatAngleUnit(units.inclinationUnit)\n\n return `${distUnit} ${azmMode}${incMode} ${azmUnit}${incUnit}\\n`\n}\n\nfunction formatDate(date: Date): string {\n return `${date.getMonth() + 1}/${date.getDate()}/${date.getFullYear() % 100}`\n}\n\nfunction formatLengthUnit(unit: Unit<Length>): string {\n switch (unit) {\n case Length.meters:\n return 'M '\n case Length.feet:\n return 'FT'\n case Length.inches:\n return 'FI'\n default:\n throw new Error(`invalid length unit: ${unit}`)\n }\n}\n\nfunction formatAngleUnit(unit: Unit<Angle>): string {\n switch (unit) {\n case Angle.degrees:\n return 'D'\n case Angle.gradians:\n return 'G'\n default:\n throw new Error(`invalid angle unit: ${unit}`)\n }\n}\n"],"mappings":";;;;;;;;;;;AAAA,IAAAA,SAAA,GAAAC,OAAA;AAGA,IAAAC,eAAA,GAAAD,OAAA;AAAqD,SAE9BE,oBAAoBA,CAAAC,EAAA;EAAA,OAAAC,qBAAA,CAAAC,KAAA,OAAAC,SAAA;AAAA;AAAA,SAAAF,sBAAA;EAAAA,qBAAA,OAAAG,oBAAA,2BAAAC,YAAA,YAAAC,IAAA,CAApC,SAAAC,QACLC,IAAoB;IAAA,IAAAC,cAAA,EAAAC,SAAA,EAAAC,IAAA,EAAAC,KAAA,EAAAC,MAAA,EAAAC,IAAA,EAAAC,IAAA,EAAAC,IAAA,EAAAC,OAAA,EAAAC,KAAA,EAAAC,cAAA,EAAAC,CAAA,EAAAC,cAAA,EAAAC,IAAA,EAAAC,KAAA,EAAAC,EAAA;IAAA,OAAAnB,YAAA,YAAAoB,IAAA,UAAAC,SAAAC,QAAA;MAAA,kBAAAA,QAAA,CAAAC,IAAA,GAAAD,QAAA,CAAAE,IAAA;QAAA;UAEdpB,cAAc,GAAG,IAAAqB,kCAAkB,EAACtB,IAAI,CAAC;UAAA,KAC3CA,IAAI,CAACuB,IAAI;YAAAJ,QAAA,CAAAE,IAAA;YAAA;UAAA;UAAAF,QAAA,CAAAE,IAAA;UACX,gBAAAG,MAAA,CAAexB,IAAI,CAACuB,IAA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