@gmod/cram 1.5.9 → 1.6.2

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 (258) hide show
  1. package/CHANGELOG.md +90 -0
  2. package/README.md +182 -172
  3. package/dist/craiIndex.d.ts +37 -0
  4. package/dist/craiIndex.js +196 -301
  5. package/dist/craiIndex.js.map +1 -0
  6. package/dist/cram-bundle.js +6 -15
  7. package/dist/cramFile/codecs/_base.d.ts +6 -0
  8. package/dist/cramFile/codecs/_base.js +44 -53
  9. package/dist/cramFile/codecs/_base.js.map +1 -0
  10. package/dist/cramFile/codecs/beta.d.ts +4 -0
  11. package/dist/cramFile/codecs/beta.js +38 -48
  12. package/dist/cramFile/codecs/beta.js.map +1 -0
  13. package/dist/cramFile/codecs/byteArrayLength.d.ts +8 -0
  14. package/dist/cramFile/codecs/byteArrayLength.js +58 -78
  15. package/dist/cramFile/codecs/byteArrayLength.js.map +1 -0
  16. package/dist/cramFile/codecs/byteArrayStop.d.ts +6 -0
  17. package/dist/cramFile/codecs/byteArrayStop.js +62 -76
  18. package/dist/cramFile/codecs/byteArrayStop.js.map +1 -0
  19. package/dist/cramFile/codecs/external.d.ts +7 -0
  20. package/dist/cramFile/codecs/external.js +63 -81
  21. package/dist/cramFile/codecs/external.js.map +1 -0
  22. package/dist/cramFile/codecs/gamma.d.ts +4 -0
  23. package/dist/cramFile/codecs/gamma.js +43 -56
  24. package/dist/cramFile/codecs/gamma.js.map +1 -0
  25. package/dist/cramFile/codecs/huffman.d.ts +17 -0
  26. package/dist/cramFile/codecs/huffman.js +126 -199
  27. package/dist/cramFile/codecs/huffman.js.map +1 -0
  28. package/dist/cramFile/codecs/index.d.ts +2 -0
  29. package/dist/cramFile/codecs/index.js +31 -38
  30. package/dist/cramFile/codecs/index.js.map +1 -0
  31. package/dist/cramFile/codecs/subexp.d.ts +4 -0
  32. package/dist/cramFile/codecs/subexp.js +51 -64
  33. package/dist/cramFile/codecs/subexp.js.map +1 -0
  34. package/dist/cramFile/constants.d.ts +36 -0
  35. package/dist/cramFile/constants.js +52 -50
  36. package/dist/cramFile/constants.js.map +1 -0
  37. package/dist/cramFile/container/compressionScheme.d.ts +23 -0
  38. package/dist/cramFile/container/compressionScheme.js +115 -153
  39. package/dist/cramFile/container/compressionScheme.js.map +1 -0
  40. package/dist/cramFile/container/index.d.ts +13 -0
  41. package/dist/cramFile/container/index.js +169 -283
  42. package/dist/cramFile/container/index.js.map +1 -0
  43. package/dist/cramFile/file.d.ts +63 -0
  44. package/dist/cramFile/file.js +440 -766
  45. package/dist/cramFile/file.js.map +1 -0
  46. package/dist/cramFile/index.d.ts +2 -0
  47. package/dist/cramFile/index.js +7 -4
  48. package/dist/cramFile/index.js.map +1 -0
  49. package/dist/cramFile/record.d.ts +79 -0
  50. package/dist/cramFile/record.js +253 -308
  51. package/dist/cramFile/record.js.map +1 -0
  52. package/dist/cramFile/sectionParsers.d.ts +18 -0
  53. package/dist/cramFile/sectionParsers.js +324 -362
  54. package/dist/cramFile/sectionParsers.js.map +1 -0
  55. package/dist/cramFile/slice/decodeRecord.d.ts +2 -0
  56. package/dist/cramFile/slice/decodeRecord.js +278 -298
  57. package/dist/cramFile/slice/decodeRecord.js.map +1 -0
  58. package/dist/cramFile/slice/index.d.ts +20 -0
  59. package/dist/cramFile/slice/index.js +488 -789
  60. package/dist/cramFile/slice/index.js.map +1 -0
  61. package/dist/cramFile/util.d.ts +5 -0
  62. package/dist/cramFile/util.js +158 -144
  63. package/dist/cramFile/util.js.map +1 -0
  64. package/dist/errors.d.ts +23 -0
  65. package/dist/errors.js +66 -103
  66. package/dist/errors.js.map +1 -0
  67. package/dist/index.d.ts +4 -0
  68. package/dist/index.js +12 -12
  69. package/dist/index.js.map +1 -0
  70. package/dist/indexedCramFile.d.ts +39 -0
  71. package/dist/indexedCramFile.js +213 -315
  72. package/dist/indexedCramFile.js.map +1 -0
  73. package/dist/io/bufferCache.d.ts +12 -0
  74. package/dist/io/bufferCache.js +108 -128
  75. package/dist/io/bufferCache.js.map +1 -0
  76. package/dist/io/index.d.ts +5 -0
  77. package/dist/io/index.js +29 -27
  78. package/dist/io/index.js.map +1 -0
  79. package/dist/io/localFile.d.ts +10 -0
  80. package/dist/io/localFile.js +105 -162
  81. package/dist/io/localFile.js.map +1 -0
  82. package/dist/io/remoteFile.d.ts +16 -0
  83. package/dist/io/remoteFile.js +137 -206
  84. package/dist/io/remoteFile.js.map +1 -0
  85. package/dist/rans/constants.d.ts +3 -0
  86. package/dist/rans/constants.js +6 -6
  87. package/dist/rans/constants.js.map +1 -0
  88. package/dist/rans/d04.d.ts +1 -0
  89. package/dist/rans/d04.js +70 -99
  90. package/dist/rans/d04.js.map +1 -0
  91. package/dist/rans/d14.d.ts +1 -0
  92. package/dist/rans/d14.js +55 -93
  93. package/dist/rans/d14.js.map +1 -0
  94. package/dist/rans/decoding.d.ts +30 -0
  95. package/dist/rans/decoding.js +112 -159
  96. package/dist/rans/decoding.js.map +1 -0
  97. package/dist/rans/frequencies.d.ts +2 -0
  98. package/dist/rans/frequencies.js +110 -119
  99. package/dist/rans/frequencies.js.map +1 -0
  100. package/dist/rans/index.d.ts +1 -0
  101. package/dist/rans/index.js +111 -174
  102. package/dist/rans/index.js.map +1 -0
  103. package/dist/sam.d.ts +1 -0
  104. package/dist/sam.js +16 -41
  105. package/dist/sam.js.map +1 -0
  106. package/dist/unzip-pako.d.ts +2 -0
  107. package/dist/unzip-pako.js +9 -0
  108. package/dist/unzip-pako.js.map +1 -0
  109. package/dist/unzip.d.ts +2 -0
  110. package/dist/unzip.js +6 -0
  111. package/dist/unzip.js.map +1 -0
  112. package/errors.js +66 -103
  113. package/esm/craiIndex.d.ts +37 -0
  114. package/esm/craiIndex.js +158 -0
  115. package/esm/craiIndex.js.map +1 -0
  116. package/esm/cramFile/codecs/_base.d.ts +6 -0
  117. package/esm/cramFile/codecs/_base.js +42 -0
  118. package/esm/cramFile/codecs/_base.js.map +1 -0
  119. package/esm/cramFile/codecs/beta.d.ts +4 -0
  120. package/esm/cramFile/codecs/beta.js +15 -0
  121. package/esm/cramFile/codecs/beta.js.map +1 -0
  122. package/esm/cramFile/codecs/byteArrayLength.d.ts +8 -0
  123. package/esm/cramFile/codecs/byteArrayLength.js +35 -0
  124. package/esm/cramFile/codecs/byteArrayLength.js.map +1 -0
  125. package/esm/cramFile/codecs/byteArrayStop.d.ts +6 -0
  126. package/esm/cramFile/codecs/byteArrayStop.js +40 -0
  127. package/esm/cramFile/codecs/byteArrayStop.js.map +1 -0
  128. package/esm/cramFile/codecs/external.d.ts +7 -0
  129. package/esm/cramFile/codecs/external.js +40 -0
  130. package/esm/cramFile/codecs/external.js.map +1 -0
  131. package/esm/cramFile/codecs/gamma.d.ts +4 -0
  132. package/esm/cramFile/codecs/gamma.js +20 -0
  133. package/esm/cramFile/codecs/gamma.js.map +1 -0
  134. package/esm/cramFile/codecs/huffman.d.ts +17 -0
  135. package/esm/cramFile/codecs/huffman.js +107 -0
  136. package/esm/cramFile/codecs/huffman.js.map +1 -0
  137. package/esm/cramFile/codecs/index.d.ts +2 -0
  138. package/esm/cramFile/codecs/index.js +30 -0
  139. package/esm/cramFile/codecs/index.js.map +1 -0
  140. package/esm/cramFile/codecs/subexp.d.ts +4 -0
  141. package/esm/cramFile/codecs/subexp.js +28 -0
  142. package/esm/cramFile/codecs/subexp.js.map +1 -0
  143. package/esm/cramFile/constants.d.ts +36 -0
  144. package/esm/cramFile/constants.js +51 -0
  145. package/esm/cramFile/constants.js.map +1 -0
  146. package/esm/cramFile/container/compressionScheme.d.ts +23 -0
  147. package/esm/cramFile/container/compressionScheme.js +123 -0
  148. package/esm/cramFile/container/compressionScheme.js.map +1 -0
  149. package/esm/cramFile/container/index.d.ts +13 -0
  150. package/esm/cramFile/container/index.js +84 -0
  151. package/esm/cramFile/container/index.js.map +1 -0
  152. package/esm/cramFile/file.d.ts +63 -0
  153. package/esm/cramFile/file.js +281 -0
  154. package/esm/cramFile/file.js.map +1 -0
  155. package/esm/cramFile/index.d.ts +2 -0
  156. package/esm/cramFile/index.js +3 -0
  157. package/esm/cramFile/index.js.map +1 -0
  158. package/esm/cramFile/record.d.ts +79 -0
  159. package/esm/cramFile/record.js +297 -0
  160. package/esm/cramFile/record.js.map +1 -0
  161. package/esm/cramFile/sectionParsers.d.ts +18 -0
  162. package/esm/cramFile/sectionParsers.js +347 -0
  163. package/esm/cramFile/sectionParsers.js.map +1 -0
  164. package/esm/cramFile/slice/decodeRecord.d.ts +2 -0
  165. package/esm/cramFile/slice/decodeRecord.js +299 -0
  166. package/esm/cramFile/slice/decodeRecord.js.map +1 -0
  167. package/esm/cramFile/slice/index.d.ts +20 -0
  168. package/esm/cramFile/slice/index.js +364 -0
  169. package/esm/cramFile/slice/index.js.map +1 -0
  170. package/esm/cramFile/util.d.ts +5 -0
  171. package/esm/cramFile/util.js +161 -0
  172. package/esm/cramFile/util.js.map +1 -0
  173. package/esm/errors.d.ts +23 -0
  174. package/esm/errors.js +24 -0
  175. package/esm/errors.js.map +1 -0
  176. package/esm/index.d.ts +4 -0
  177. package/esm/index.js +5 -0
  178. package/esm/index.js.map +1 -0
  179. package/esm/indexedCramFile.d.ts +39 -0
  180. package/esm/indexedCramFile.js +155 -0
  181. package/esm/indexedCramFile.js.map +1 -0
  182. package/esm/io/bufferCache.d.ts +12 -0
  183. package/esm/io/bufferCache.js +54 -0
  184. package/esm/io/bufferCache.js.map +1 -0
  185. package/esm/io/index.d.ts +5 -0
  186. package/esm/io/index.js +24 -0
  187. package/esm/io/index.js.map +1 -0
  188. package/esm/io/localFile.d.ts +10 -0
  189. package/esm/io/localFile.js +31 -0
  190. package/esm/io/localFile.js.map +1 -0
  191. package/esm/io/remoteFile.d.ts +16 -0
  192. package/esm/io/remoteFile.js +64 -0
  193. package/esm/io/remoteFile.js.map +1 -0
  194. package/esm/rans/constants.d.ts +3 -0
  195. package/esm/rans/constants.js +5 -0
  196. package/esm/rans/constants.js.map +1 -0
  197. package/esm/rans/d04.d.ts +1 -0
  198. package/esm/rans/d04.js +67 -0
  199. package/esm/rans/d04.js.map +1 -0
  200. package/esm/rans/d14.d.ts +1 -0
  201. package/esm/rans/d14.js +52 -0
  202. package/esm/rans/d14.js.map +1 -0
  203. package/esm/rans/decoding.d.ts +30 -0
  204. package/esm/rans/decoding.js +118 -0
  205. package/esm/rans/decoding.js.map +1 -0
  206. package/esm/rans/frequencies.d.ts +2 -0
  207. package/esm/rans/frequencies.js +110 -0
  208. package/esm/rans/frequencies.js.map +1 -0
  209. package/esm/rans/index.d.ts +1 -0
  210. package/esm/rans/index.js +195 -0
  211. package/esm/rans/index.js.map +1 -0
  212. package/esm/sam.d.ts +1 -0
  213. package/esm/sam.js +16 -0
  214. package/esm/sam.js.map +1 -0
  215. package/esm/unzip-pako.d.ts +2 -0
  216. package/esm/unzip-pako.js +5 -0
  217. package/esm/unzip-pako.js.map +1 -0
  218. package/esm/unzip.d.ts +2 -0
  219. package/esm/unzip.js +3 -0
  220. package/esm/unzip.js.map +1 -0
  221. package/package.json +38 -35
  222. package/src/craiIndex.js +180 -0
  223. package/src/cramFile/codecs/_base.js +49 -0
  224. package/src/cramFile/codecs/beta.js +23 -0
  225. package/src/cramFile/codecs/byteArrayLength.js +55 -0
  226. package/src/cramFile/codecs/byteArrayStop.js +50 -0
  227. package/src/cramFile/codecs/external.js +54 -0
  228. package/src/cramFile/codecs/gamma.js +30 -0
  229. package/src/cramFile/codecs/huffman.js +137 -0
  230. package/src/cramFile/codecs/index.js +38 -0
  231. package/src/cramFile/codecs/subexp.js +32 -0
  232. package/src/cramFile/constants.js +55 -0
  233. package/src/cramFile/container/compressionScheme.js +144 -0
  234. package/src/cramFile/container/index.js +119 -0
  235. package/src/cramFile/file.js +347 -0
  236. package/src/cramFile/index.js +3 -0
  237. package/src/cramFile/record.js +337 -0
  238. package/src/cramFile/sectionParsers.js +379 -0
  239. package/src/cramFile/slice/decodeRecord.js +362 -0
  240. package/src/cramFile/slice/index.js +497 -0
  241. package/src/cramFile/util.js +169 -0
  242. package/src/errors.js +22 -0
  243. package/src/index.js +5 -0
  244. package/src/indexedCramFile.js +191 -0
  245. package/src/io/bufferCache.js +66 -0
  246. package/src/io/index.js +26 -0
  247. package/src/io/localFile.js +35 -0
  248. package/src/io/remoteFile.js +71 -0
  249. package/src/rans/README.md +1 -0
  250. package/src/rans/constants.js +5 -0
  251. package/src/rans/d04.js +83 -0
  252. package/src/rans/d14.js +59 -0
  253. package/src/rans/decoding.js +141 -0
  254. package/src/rans/frequencies.js +121 -0
  255. package/src/rans/index.js +249 -0
  256. package/src/sam.js +15 -0
  257. package/src/unzip-pako.ts +5 -0
  258. package/src/unzip.ts +2 -0
@@ -1,127 +1,118 @@
1
1
  "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
4
-
5
- var _fill = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/fill"));
6
-
7
- var _require = require('../errors'),
8
- CramMalformedError = _require.CramMalformedError;
9
-
10
- var Constants = require('./constants');
11
-
12
- var Decoding = require('./decoding');
13
-
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.readStatsO1 = exports.readStatsO0 = void 0;
7
+ var errors_1 = require("../errors");
8
+ var constants_1 = require("./constants");
9
+ var decoding_1 = __importDefault(require("./decoding"));
14
10
  function assert(result) {
15
- if (!result) throw new CramMalformedError('assertion failed');
16
- }
17
-
18
- function readStatsO0(
19
- /* ByteBuffer */
20
- cp,
21
- /* Decoding.AriDecoder */
22
- decoder,
23
- /* Decoding.RansDecSymbol[] */
24
- syms) {
25
- // Pre-compute reverse lookup of frequency.
26
- var rle = 0;
27
- var x = 0;
28
- var j = cp.get() & 0xff;
29
-
30
- do {
31
- var _context;
32
-
33
- if (decoder.fc[j] == null) decoder.fc[j] = new Decoding.FC();
34
- decoder.fc[j].F = cp.get() & 0xff;
35
-
36
- if (decoder.fc[j].F >= 128) {
37
- decoder.fc[j].F &= ~128;
38
- decoder.fc[j].F = (decoder.fc[j].F & 127) << 8 | cp.get() & 0xff;
39
- }
40
-
41
- decoder.fc[j].C = x;
42
- Decoding.symbolInit(syms[j], decoder.fc[j].C, decoder.fc[j].F);
43
- /* Build reverse lookup table */
44
-
45
- if (!decoder.R) decoder.R = new Array(Constants.TOTFREQ);
46
- (0, _fill.default)(_context = decoder.R).call(_context, j, x, x + decoder.fc[j].F);
47
- x += decoder.fc[j].F;
48
-
49
- if (rle === 0 && j + 1 === (0xff & cp.getByteAt(cp.position()))) {
50
- j = cp.get() & 0xff;
51
- rle = cp.get() & 0xff;
52
- } else if (rle !== 0) {
53
- rle -= 1;
54
- j += 1;
55
- } else {
56
- j = cp.get() & 0xff;
11
+ if (!result) {
12
+ throw new errors_1.CramMalformedError('assertion failed');
57
13
  }
58
- } while (j !== 0);
59
-
60
- assert(x < Constants.TOTFREQ);
61
14
  }
62
-
63
- function readStatsO1(
64
- /* ByteBuffer */
65
- cp,
66
- /* Decoding.AriDecoder[] */
67
- D,
68
- /* Decoding.RansDecSymbol[][] */
69
- syms) {
70
- var rlei = 0;
71
- var i = 0xff & cp.get();
72
-
73
- do {
74
- var rlej = 0;
15
+ function readStatsO0(
16
+ /* ByteBuffer */ cp,
17
+ /* Decoding.AriDecoder */ decoder,
18
+ /* Decoding.RansDecSymbol[] */ syms) {
19
+ // Pre-compute reverse lookup of frequency.
20
+ var rle = 0;
75
21
  var x = 0;
76
- var j = 0xff & cp.get();
77
- if (D[i] == null) D[i] = new Decoding.AriDecoder();
78
-
22
+ var j = cp.get() & 0xff;
79
23
  do {
80
- var _context2;
81
-
82
- if (D[i].fc[j] == null) D[i].fc[j] = new Decoding.FC();
83
- D[i].fc[j].F = 0xff & cp.get();
84
-
85
- if (D[i].fc[j].F >= 128) {
86
- D[i].fc[j].F &= ~128;
87
- D[i].fc[j].F = (D[i].fc[j].F & 127) << 8 | 0xff & cp.get();
88
- }
89
-
90
- D[i].fc[j].C = x;
91
- if (D[i].fc[j].F === 0) D[i].fc[j].F = Constants.TOTFREQ;
92
- if (syms[i][j] == null) syms[i][j] = new Decoding.RansDecSymbol();
93
- Decoding.symbolInit(syms[i][j], D[i].fc[j].C, D[i].fc[j].F);
94
- /* Build reverse lookup table */
95
-
96
- if (D[i].R == null) D[i].R = new Array(Constants.TOTFREQ);
97
- (0, _fill.default)(_context2 = D[i].R).call(_context2, j, x, x + D[i].fc[j].F);
98
- x += D[i].fc[j].F;
99
- assert(x <= Constants.TOTFREQ);
100
-
101
- if (rlej === 0 && j + 1 === (0xff & cp.getByteAt(cp.position()))) {
102
- j = 0xff & cp.get();
103
- rlej = 0xff & cp.get();
104
- } else if (rlej !== 0) {
105
- rlej -= 1;
106
- j += 1;
107
- } else {
108
- j = 0xff & cp.get();
109
- }
24
+ if (decoder.fc[j] == null) {
25
+ decoder.fc[j] = new decoding_1.default.FC();
26
+ }
27
+ decoder.fc[j].F = cp.get() & 0xff;
28
+ if (decoder.fc[j].F >= 128) {
29
+ decoder.fc[j].F &= ~128;
30
+ decoder.fc[j].F = ((decoder.fc[j].F & 127) << 8) | (cp.get() & 0xff);
31
+ }
32
+ decoder.fc[j].C = x;
33
+ decoding_1.default.symbolInit(syms[j], decoder.fc[j].C, decoder.fc[j].F);
34
+ /* Build reverse lookup table */
35
+ if (!decoder.R) {
36
+ decoder.R = new Array(constants_1.TOTFREQ);
37
+ }
38
+ decoder.R.fill(j, x, x + decoder.fc[j].F);
39
+ x += decoder.fc[j].F;
40
+ if (rle === 0 && j + 1 === (0xff & cp.getByteAt(cp.position()))) {
41
+ j = cp.get() & 0xff;
42
+ rle = cp.get() & 0xff;
43
+ }
44
+ else if (rle !== 0) {
45
+ rle -= 1;
46
+ j += 1;
47
+ }
48
+ else {
49
+ j = cp.get() & 0xff;
50
+ }
110
51
  } while (j !== 0);
111
-
112
- if (rlei === 0 && i + 1 === (0xff & cp.getByteAt(cp.position()))) {
113
- i = 0xff & cp.get();
114
- rlei = 0xff & cp.get();
115
- } else if (rlei !== 0) {
116
- rlei -= 1;
117
- i += 1;
118
- } else {
119
- i = 0xff & cp.get();
120
- }
121
- } while (i !== 0);
52
+ assert(x < constants_1.TOTFREQ);
53
+ }
54
+ exports.readStatsO0 = readStatsO0;
55
+ function readStatsO1(
56
+ /* ByteBuffer */ cp,
57
+ /* Decoding.AriDecoder[] */ D,
58
+ /* Decoding.RansDecSymbol[][] */ syms) {
59
+ var rlei = 0;
60
+ var i = 0xff & cp.get();
61
+ do {
62
+ var rlej = 0;
63
+ var x = 0;
64
+ var j = 0xff & cp.get();
65
+ if (D[i] == null) {
66
+ D[i] = new decoding_1.default.AriDecoder();
67
+ }
68
+ do {
69
+ if (D[i].fc[j] == null) {
70
+ D[i].fc[j] = new decoding_1.default.FC();
71
+ }
72
+ D[i].fc[j].F = 0xff & cp.get();
73
+ if (D[i].fc[j].F >= 128) {
74
+ D[i].fc[j].F &= ~128;
75
+ D[i].fc[j].F = ((D[i].fc[j].F & 127) << 8) | (0xff & cp.get());
76
+ }
77
+ D[i].fc[j].C = x;
78
+ if (D[i].fc[j].F === 0) {
79
+ D[i].fc[j].F = constants_1.TOTFREQ;
80
+ }
81
+ if (syms[i][j] == null) {
82
+ syms[i][j] = new decoding_1.default.RansDecSymbol();
83
+ }
84
+ decoding_1.default.symbolInit(syms[i][j], D[i].fc[j].C, D[i].fc[j].F);
85
+ /* Build reverse lookup table */
86
+ if (D[i].R == null) {
87
+ D[i].R = new Array(constants_1.TOTFREQ);
88
+ }
89
+ D[i].R.fill(j, x, x + D[i].fc[j].F);
90
+ x += D[i].fc[j].F;
91
+ assert(x <= constants_1.TOTFREQ);
92
+ if (rlej === 0 && j + 1 === (0xff & cp.getByteAt(cp.position()))) {
93
+ j = 0xff & cp.get();
94
+ rlej = 0xff & cp.get();
95
+ }
96
+ else if (rlej !== 0) {
97
+ rlej -= 1;
98
+ j += 1;
99
+ }
100
+ else {
101
+ j = 0xff & cp.get();
102
+ }
103
+ } while (j !== 0);
104
+ if (rlei === 0 && i + 1 === (0xff & cp.getByteAt(cp.position()))) {
105
+ i = 0xff & cp.get();
106
+ rlei = 0xff & cp.get();
107
+ }
108
+ else if (rlei !== 0) {
109
+ rlei -= 1;
110
+ i += 1;
111
+ }
112
+ else {
113
+ i = 0xff & cp.get();
114
+ }
115
+ } while (i !== 0);
122
116
  }
123
-
124
- module.exports = {
125
- readStatsO0: readStatsO0,
126
- readStatsO1: readStatsO1
127
- };
117
+ exports.readStatsO1 = readStatsO1;
118
+ //# sourceMappingURL=frequencies.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"frequencies.js","sourceRoot":"","sources":["../../src/rans/frequencies.js"],"names":[],"mappings":";;;;;;AAAA,oCAA8C;AAE9C,yCAAqC;AACrC,wDAAiC;AAEjC,SAAS,MAAM,CAAC,MAAM;IACpB,IAAI,CAAC,MAAM,EAAE;QACX,MAAM,IAAI,2BAAkB,CAAC,kBAAkB,CAAC,CAAA;KACjD;AACH,CAAC;AAED,SAAgB,WAAW;AACzB,gBAAgB,CAAC,EAAE;AACnB,yBAAyB,CAAC,OAAO;AACjC,8BAA8B,CAAC,IAAI;IAEnC,2CAA2C;IAC3C,IAAI,GAAG,GAAG,CAAC,CAAA;IACX,IAAI,CAAC,GAAG,CAAC,CAAA;IACT,IAAI,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,GAAG,IAAI,CAAA;IACvB,GAAG;QACD,IAAI,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI,EAAE;YACzB,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,IAAI,kBAAQ,CAAC,EAAE,EAAE,CAAA;SAClC;QACD,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,GAAG,IAAI,CAAA;QACjC,IAAI,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC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1 @@
1
+ export default function uncompress(inputBuffer: any, outputBuffer: any, initialInputPosition?: number): any;
@@ -1,29 +1,17 @@
1
1
  "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
4
-
5
- var _fill = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/fill"));
6
-
7
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/classCallCheck"));
8
-
9
- var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/createClass"));
10
-
11
- var _require = require('../errors'),
12
- CramMalformedError = _require.CramMalformedError;
13
-
14
- var Decoding = require('./decoding');
15
-
16
- var Frequencies = require('./frequencies');
17
-
18
- var D04 = require('./d04');
19
-
20
- var D14 = require('./d14'); // const /* int */ ORDER_BYTE_LENGTH = 1
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ var errors_1 = require("../errors");
7
+ var decoding_1 = __importDefault(require("./decoding"));
8
+ var frequencies_1 = require("./frequencies");
9
+ var d04_1 = __importDefault(require("./d04"));
10
+ var d14_1 = __importDefault(require("./d14"));
11
+ // const /* int */ ORDER_BYTE_LENGTH = 1
21
12
  // const /* int */ COMPRESSED_BYTE_LENGTH = 4
22
-
23
-
24
- var
25
- /* int */
26
- RAW_BYTE_LENGTH = 4; // const /* int */ PREFIX_BYTE_LENGTH =
13
+ var /* int */ RAW_BYTE_LENGTH = 4;
14
+ // const /* int */ PREFIX_BYTE_LENGTH =
27
15
  // ORDER_BYTE_LENGTH + COMPRESSED_BYTE_LENGTH + RAW_BYTE_LENGTH
28
16
  // enum ORDER {
29
17
  // ZERO, ONE;
@@ -104,164 +92,113 @@ RAW_BYTE_LENGTH = 4; // const /* int */ PREFIX_BYTE_LENGTH =
104
92
  // out_buf.putInt(rawSizeOffset, in_size);
105
93
  // out_buf.rewind();
106
94
  // }
107
-
108
- function
109
- /* static ByteBuffer */
110
- uncompressOrder0Way4(
111
- /* const ByteBuffer */
112
- input,
113
- /* const ByteBuffer */
114
- out) {
115
- // input.order(ByteOrder.LITTLE_ENDIAN);
116
- var D = new Decoding.AriDecoder();
117
- var syms = new Array(256);
118
-
119
- for (var i = 0; i < syms.length; i += 1) {
120
- syms[i] = new Decoding.Symbol();
121
- }
122
-
123
- Frequencies.readStatsO0(input, D, syms);
124
- D04.uncompress(input, D, syms, out);
125
- return out;
126
- }
127
-
128
- function
129
- /* static ByteBuffer */
130
- uncompressOrder1Way4(
131
- /* const ByteBuffer */
132
- input,
133
- /* const ByteBuffer */
134
- output) {
135
- var D = new Array(256);
136
-
137
- for (var i = 0; i < D.length; i += 1) {
138
- D[i] = new Decoding.AriDecoder();
139
- }
140
-
141
- var
142
- /* Decoding.RansDecSymbol[][] */
143
- syms = new Array(256);
144
-
145
- for (var _i = 0; _i < syms.length; _i += 1) {
146
- syms[_i] = new Array(256);
147
-
148
- for (var j = 0; j < syms[_i].length; j += 1) {
149
- syms[_i][j] = new Decoding.Symbol();
95
+ function uncompressOrder0Way4(
96
+ /* const ByteBuffer */ input,
97
+ /* const ByteBuffer */ out) {
98
+ // input.order(ByteOrder.LITTLE_ENDIAN);
99
+ var D = new decoding_1.default.AriDecoder();
100
+ var syms = new Array(256);
101
+ for (var i = 0; i < syms.length; i += 1) {
102
+ syms[i] = new decoding_1.default.Symbol();
150
103
  }
151
- }
152
-
153
- Frequencies.readStatsO1(input, D, syms);
154
- D14.uncompress(input, output, D, syms);
155
- return output;
104
+ (0, frequencies_1.readStatsO0)(input, D, syms);
105
+ (0, d04_1.default)(input, D, syms, out);
106
+ return out;
156
107
  }
157
- /* compat layer to make a node buffer act like a java ByteBuffer */
158
-
159
-
160
- var ByteBuffer =
161
- /*#__PURE__*/
162
- function () {
163
- function ByteBuffer(nodeBuffer) {
164
- var initialInputPosition = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
165
- (0, _classCallCheck2.default)(this, ByteBuffer);
166
- this._buffer = nodeBuffer;
167
- this._position = initialInputPosition;
168
- this.length = nodeBuffer.length;
169
- }
170
-
171
- (0, _createClass2.default)(ByteBuffer, [{
172
- key: "get",
173
- value: function get() {
174
- var b = this._buffer[this._position];
175
- this._position += 1;
176
- return b;
177
- }
178
- }, {
179
- key: "getByte",
180
- value: function getByte() {
181
- return this.get();
108
+ function uncompressOrder1Way4(
109
+ /* const ByteBuffer */ input,
110
+ /* const ByteBuffer */ output) {
111
+ var D = new Array(256);
112
+ for (var i = 0; i < D.length; i += 1) {
113
+ D[i] = new decoding_1.default.AriDecoder();
182
114
  }
183
- }, {
184
- key: "getByteAt",
185
- value: function getByteAt(position) {
186
- return this._buffer[position];
115
+ var /* Decoding.RansDecSymbol[][] */ syms = new Array(256);
116
+ for (var i = 0; i < syms.length; i += 1) {
117
+ syms[i] = new Array(256);
118
+ for (var j = 0; j < syms[i].length; j += 1) {
119
+ syms[i][j] = new decoding_1.default.Symbol();
120
+ }
187
121
  }
188
- }, {
189
- key: "position",
190
- value: function position() {
191
- return this._position;
122
+ (0, frequencies_1.readStatsO1)(input, D, syms);
123
+ (0, d14_1.default)(input, output, D, syms);
124
+ return output;
125
+ }
126
+ /* compat layer to make a node buffer act like a java ByteBuffer */
127
+ var ByteBuffer = /** @class */ (function () {
128
+ function ByteBuffer(nodeBuffer, initialInputPosition) {
129
+ if (initialInputPosition === void 0) { initialInputPosition = 0; }
130
+ this._buffer = nodeBuffer;
131
+ this._position = initialInputPosition;
132
+ this.length = nodeBuffer.length;
192
133
  }
193
- }, {
194
- key: "put",
195
- value: function put(val) {
196
- this._buffer[this._position] = val;
197
- this._position += 1;
198
- return val;
134
+ ByteBuffer.prototype.get = function () {
135
+ var b = this._buffer[this._position];
136
+ this._position += 1;
137
+ return b;
138
+ };
139
+ ByteBuffer.prototype.getByte = function () {
140
+ return this.get();
141
+ };
142
+ ByteBuffer.prototype.getByteAt = function (position) {
143
+ return this._buffer[position];
144
+ };
145
+ ByteBuffer.prototype.position = function () {
146
+ return this._position;
147
+ };
148
+ ByteBuffer.prototype.put = function (val) {
149
+ this._buffer[this._position] = val;
150
+ this._position += 1;
151
+ return val;
152
+ };
153
+ ByteBuffer.prototype.putAt = function (position, val) {
154
+ this._buffer[position] = val;
155
+ return val;
156
+ };
157
+ ByteBuffer.prototype.setPosition = function (pos) {
158
+ this._position = pos;
159
+ return pos;
160
+ };
161
+ ByteBuffer.prototype.getInt = function () {
162
+ var i = this._buffer.readInt32LE(this._position);
163
+ this._position += 4;
164
+ return i;
165
+ };
166
+ ByteBuffer.prototype.remaining = function () {
167
+ return this._buffer.length - this._position;
168
+ };
169
+ return ByteBuffer;
170
+ }());
171
+ // static /* const */ ByteBuffer EMPTY_BUFFER = ByteBuffer.allocate(0);
172
+ function uncompress(inputBuffer, outputBuffer, initialInputPosition) {
173
+ if (initialInputPosition === void 0) { initialInputPosition = 0; }
174
+ if (inputBuffer.length === 0) {
175
+ outputBuffer.fill(0);
176
+ return outputBuffer;
199
177
  }
200
- }, {
201
- key: "putAt",
202
- value: function putAt(position, val) {
203
- this._buffer[position] = val;
204
- return val;
178
+ var input = new ByteBuffer(inputBuffer, initialInputPosition);
179
+ // input.order(ByteOrder.LITTLE_ENDIAN);
180
+ var order = input.get();
181
+ if (order !== 0 && order !== 1) {
182
+ throw new errors_1.CramMalformedError("Invalid rANS order ".concat(order));
205
183
  }
206
- }, {
207
- key: "setPosition",
208
- value: function setPosition(pos) {
209
- this._position = pos;
210
- return pos;
184
+ var /* int */ inputSize = input.getInt();
185
+ if (inputSize !== input.remaining() - RAW_BYTE_LENGTH) {
186
+ throw new errors_1.CramMalformedError('Incorrect input length.');
211
187
  }
212
- }, {
213
- key: "getInt",
214
- value: function getInt() {
215
- var i = this._buffer.readInt32LE(this._position);
216
-
217
- this._position += 4;
218
- return i;
188
+ var /* int */ outputSize = input.getInt();
189
+ var output = new ByteBuffer(outputBuffer || Buffer.allocUnsafe(outputSize));
190
+ // TODO output.limit(outputSize)
191
+ if (output.length < outputSize) {
192
+ throw new errors_1.CramMalformedError("Output buffer too small to fit ".concat(outputSize, " bytes."));
219
193
  }
220
- }, {
221
- key: "remaining",
222
- value: function remaining() {
223
- return this._buffer.length - this._position;
194
+ switch (order) {
195
+ case 0:
196
+ return uncompressOrder0Way4(input, output);
197
+ case 1:
198
+ return uncompressOrder1Way4(input, output);
199
+ default:
200
+ throw new errors_1.CramMalformedError("Invalid rANS order: ".concat(order));
224
201
  }
225
- }]);
226
- return ByteBuffer;
227
- }(); // static /* const */ ByteBuffer EMPTY_BUFFER = ByteBuffer.allocate(0);
228
-
229
-
230
- function uncompress(inputBuffer, outputBuffer) {
231
- var initialInputPosition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
232
-
233
- if (inputBuffer.length === 0) {
234
- (0, _fill.default)(outputBuffer).call(outputBuffer, 0);
235
- return outputBuffer;
236
- }
237
-
238
- var input = new ByteBuffer(inputBuffer, initialInputPosition); // input.order(ByteOrder.LITTLE_ENDIAN);
239
-
240
- var order = input.get();
241
- if (order !== 0 && order !== 1) throw new CramMalformedError("Invalid rANS order ".concat(order));
242
- var
243
- /* int */
244
- inputSize = input.getInt();
245
- if (inputSize !== input.remaining() - RAW_BYTE_LENGTH) throw new CramMalformedError('Incorrect input length.');
246
- var
247
- /* int */
248
- outputSize = input.getInt();
249
- var output = new ByteBuffer(outputBuffer || Buffer.allocUnsafe(outputSize)); // TODO output.limit(outputSize)
250
-
251
- if (output.length < outputSize) throw new CramMalformedError("Output buffer too small to fit ".concat(outputSize, " bytes."));
252
-
253
- switch (order) {
254
- case 0:
255
- return uncompressOrder0Way4(input, output);
256
-
257
- case 1:
258
- return uncompressOrder1Way4(input, output);
259
-
260
- default:
261
- throw new CramMalformedError("Invalid rANS order: ".concat(order));
262
- }
263
202
  }
264
-
265
- module.exports = {
266
- uncompress: uncompress
267
- };
203
+ exports.default = uncompress;
204
+ //# sourceMappingURL=index.js.map
@@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AAE,CAAA;IAC1C,IAAI,SAAS,KAAK,KAAK,CAAC,SAAS,EAAE,GAAG,eAAe,EAAE;QACrD,MAAM,IAAI,2BAAkB,CAAC,yBAAyB,CAAC,CAAA;KACxD;IAED,IAAM,SAAS,CAAC,UAAU,GAAG,KAAK,CAAC,MAAM,EAAE,CAAA;IAC3C,IAAM,MAAM,GAAG,IAAI,UAAU,CAAC,YAAY,IAAI,MAAM,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC,CAAA;IAC7E,gCAAgC;IAEhC,IAAI,MAAM,CAAC,MAAM,GAAG,UAAU,EAAE;QAC9B,MAAM,IAAI,2BAAkB,CAC1B,yCAAkC,UAAU,YAAS,CACtD,CAAA;KACF;IAED,QAAQ,KAAK,EAAE;QACb,KAAK,CAAC;YACJ,OAAO,oBAAoB,CAAC,KAAK,EAAE,MAAM,CAAC,CAAA;QAE5C,KAAK,CAAC;YACJ,OAAO,oBAAoB,CAAC,KAAK,EAAE,MAAM,CAAC,CAAA;QAE5C;YACE,MAAM,IAAI,2BAAkB,CAAC,8BAAuB,KAAK,CAAE,CAAC,CAAA;KAC/D;AACH,CAAC;AA3CD,6BA2CC"}
package/dist/sam.d.ts ADDED
@@ -0,0 +1 @@
1
+ export function parseHeaderText(text: any): any[];
package/dist/sam.js CHANGED
@@ -1,45 +1,20 @@
1
1
  "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
4
-
5
- var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/slicedToArray"));
6
-
7
- var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/map"));
8
-
9
- var _slice = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/slice"));
10
-
11
- var _toArray2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/toArray"));
12
-
13
- var _forEach = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/for-each"));
14
-
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parseHeaderText = void 0;
15
4
  function parseHeaderText(text) {
16
- var lines = text.split(/\r?\n/);
17
- var data = [];
18
- (0, _forEach.default)(lines).call(lines, function (line) {
19
- var _line$split = line.split(/\t/),
20
- _line$split2 = (0, _toArray2.default)(_line$split),
21
- tag = _line$split2[0],
22
- fields = (0, _slice.default)(_line$split2).call(_line$split2, 1);
23
-
24
- var parsedFields = (0, _map.default)(fields).call(fields, function (f) {
25
- var _f$split = f.split(':', 2),
26
- _f$split2 = (0, _slicedToArray2.default)(_f$split, 2),
27
- fieldTag = _f$split2[0],
28
- value = _f$split2[1];
29
-
30
- return {
31
- tag: fieldTag,
32
- value: value
33
- };
5
+ var lines = text.split(/\r?\n/);
6
+ var data = [];
7
+ lines.forEach(function (line) {
8
+ var _a = line.split(/\t/), tag = _a[0], fields = _a.slice(1);
9
+ var parsedFields = fields.map(function (f) {
10
+ var _a = f.split(':', 2), fieldTag = _a[0], value = _a[1];
11
+ return { tag: fieldTag, value: value };
12
+ });
13
+ if (tag) {
14
+ data.push({ tag: tag.substr(1), data: parsedFields });
15
+ }
34
16
  });
35
- if (tag) data.push({
36
- tag: tag.substr(1),
37
- data: parsedFields
38
- });
39
- });
40
- return data;
17
+ return data;
41
18
  }
42
-
43
- module.exports = {
44
- parseHeaderText: parseHeaderText
45
- };
19
+ exports.parseHeaderText = parseHeaderText;
20
+ //# sourceMappingURL=sam.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sam.js","sourceRoot":"","sources":["../src/sam.js"],"names":[],"mappings":";;;AAAA,SAAgB,eAAe,CAAC,IAAI;IAClC,IAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;IACjC,IAAM,IAAI,GAAG,EAAE,CAAA;IACf,KAAK,CAAC,OAAO,CAAC,UAAA,IAAI;QACV,IAAA,KAAmB,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAlC,GAAG,QAAA,EAAK,MAAM,cAAoB,CAAA;QACzC,IAAM,YAAY,GAAG,MAAM,CAAC,GAAG,CAAC,UAAA,CAAC;YACzB,IAAA,KAAoB,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,EAAlC,QAAQ,QAAA,EAAE,KAAK,QAAmB,CAAA;YACzC,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,KAAK,OAAA,EAAE,CAAA;QACjC,CAAC,CAAC,CAAA;QACF,IAAI,GAAG,EAAE;YACP,IAAI,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC,CAAA;SACtD;IACH,CAAC,CAAC,CAAA;IACF,OAAO,IAAI,CAAA;AACb,CAAC;AAdD,0CAcC"}
@@ -0,0 +1,2 @@
1
+ /// <reference types="node" />
2
+ export declare function unzip(input: Buffer): Buffer;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.unzip = void 0;
4
+ var pako_1 = require("pako");
5
+ function unzip(input) {
6
+ return Buffer.from((0, pako_1.inflate)(input));
7
+ }
8
+ exports.unzip = unzip;
9
+ //# sourceMappingURL=unzip-pako.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unzip-pako.js","sourceRoot":"","sources":["../src/unzip-pako.ts"],"names":[],"mappings":";;;AAAA,6BAA8B;AAE9B,SAAgB,KAAK,CAAC,KAAa;IACjC,OAAO,MAAM,CAAC,IAAI,CAAC,IAAA,cAAO,EAAC,KAAK,CAAC,CAAC,CAAA;AACpC,CAAC;AAFD,sBAEC"}