1212// present.
1313
1414// This file expects to be invoked as a Worker (see onmessage below).
15- importScripts ( '../io/bitstream-worker .js' ) ;
16- importScripts ( '../io/bytestream-worker .js' ) ;
17- importScripts ( '../io/bytebuffer-worker .js' ) ;
18- importScripts ( ' rarvm.js') ;
15+ import { BitStream } from '../io/bitstream.js' ;
16+ import { ByteStream } from '../io/bytestream.js' ;
17+ import { ByteBuffer } from '../io/bytebuffer.js' ;
18+ import { VM_GLOBALMEMADDR , VM_GLOBALMEMSIZE , VM_FIXEDGLOBALSIZE , MAXWINMASK } from './ rarvm.js';
1919
2020const UnarchiveState = {
2121 NOT_STARTED : 0 ,
@@ -86,7 +86,7 @@ const ENDARC_HEAD = 0x7b;
8686 */
8787class RarVolumeHeader {
8888 /**
89- * @param {bitjs.io. ByteStream } bstream
89+ * @param {ByteStream } bstream
9090 */
9191 constructor ( bstream ) {
9292 let headBytesRead = 0 ;
@@ -316,19 +316,19 @@ const RD = { //rep decode
316316} ;
317317
318318/**
319- * @type {Array<bitjs.io. ByteBuffer> }
319+ * @type {Array<ByteBuffer> }
320320 */
321321const rOldBuffers = [ ] ;
322322
323323/**
324324 * The current buffer we are unpacking to.
325- * @type {bitjs.io. ByteBuffer }
325+ * @type {ByteBuffer }
326326 */
327327let rBuffer ;
328328
329329/**
330330 * The buffer of the final bytes after filtering (only used in Unpack29).
331- * @type {bitjs.io. ByteBuffer }
331+ * @type {ByteBuffer }
332332 */
333333let wBuffer ;
334334
@@ -346,7 +346,7 @@ let wBuffer;
346346
347347/**
348348 * Read in Huffman tables for RAR
349- * @param {bitjs.io. BitStream } bstream
349+ * @param {BitStream } bstream
350350 */
351351function RarReadTables ( bstream ) {
352352 const BitLength = new Array ( rBC ) ;
@@ -491,7 +491,7 @@ function RarMakeDecodeTables(BitLength, offset, dec, size) {
491491
492492// TODO: implement
493493/**
494- * @param {bitjs.io. BitStream } bstream
494+ * @param {BitStream } bstream
495495 * @param {boolean } Solid
496496 */
497497function Unpack15 ( bstream , Solid ) {
@@ -500,7 +500,7 @@ function Unpack15(bstream, Solid) {
500500
501501/**
502502 * Unpacks the bit stream into rBuffer using the Unpack20 algorithm.
503- * @param {bitjs.io. BitStream } bstream
503+ * @param {BitStream } bstream
504504 * @param {boolean } Solid
505505 */
506506function Unpack20 ( bstream , Solid ) {
@@ -694,7 +694,7 @@ function InitFilters() {
694694 */
695695function RarAddVMCode ( firstByte , vmCode ) {
696696 VM . init ( ) ;
697- const bstream = new bitjs . io . BitStream ( vmCode . buffer , true /* rtl */ ) ;
697+ const bstream = new BitStream ( vmCode . buffer , true /* rtl */ ) ;
698698
699699 let filtPos ;
700700 if ( firstByte & 0x80 ) {
@@ -864,7 +864,7 @@ function RarAddVMCode(firstByte, vmCode) {
864864
865865
866866/**
867- * @param {!bitjs.io. BitStream } bstream
867+ * @param {!BitStream } bstream
868868 */
869869function RarReadVMCode ( bstream ) {
870870 const firstByte = bstream . readBits ( 8 ) ;
@@ -886,7 +886,7 @@ function RarReadVMCode(bstream) {
886886
887887/**
888888 * Unpacks the bit stream into rBuffer using the Unpack29 algorithm.
889- * @param {bitjs.io. BitStream } bstream
889+ * @param {BitStream } bstream
890890 * @param {boolean } Solid
891891 */
892892function Unpack29 ( bstream , Solid ) {
@@ -1258,9 +1258,9 @@ function unpack(v) {
12581258 // TODO: implement what happens when unpVer is < 15
12591259 const Ver = v . header . unpVer <= 15 ? 15 : v . header . unpVer ;
12601260 const Solid = v . header . flags . LHD_SOLID ;
1261- const bstream = new bitjs . io . BitStream ( v . fileData . buffer , true /* rtl */ , v . fileData . byteOffset , v . fileData . byteLength ) ;
1261+ const bstream = new BitStream ( v . fileData . buffer , true /* rtl */ , v . fileData . byteOffset , v . fileData . byteLength ) ;
12621262
1263- rBuffer = new bitjs . io . ByteBuffer ( v . header . unpackedSize ) ;
1263+ rBuffer = new ByteBuffer ( v . header . unpackedSize ) ;
12641264
12651265 if ( logToConsole ) {
12661266 info ( 'Unpacking ' + v . filename + ' RAR v' + Ver ) ;
@@ -1276,7 +1276,7 @@ function unpack(v) {
12761276 break ;
12771277 case 29 : // rar 3.x compression
12781278 case 36 : // alternative hash
1279- wBuffer = new bitjs . io . ByteBuffer ( rBuffer . data . length ) ;
1279+ wBuffer = new ByteBuffer ( rBuffer . data . length ) ;
12801280 Unpack29 ( bstream , Solid ) ;
12811281 break ;
12821282 } // switch(method)
@@ -1290,7 +1290,7 @@ function unpack(v) {
12901290 */
12911291class RarLocalFile {
12921292 /**
1293- * @param {bitjs.io. ByteStream } bstream
1293+ * @param {ByteStream } bstream
12941294 */
12951295 constructor ( bstream ) {
12961296 this . header = new RarVolumeHeader ( bstream ) ;
@@ -1325,7 +1325,7 @@ class RarLocalFile {
13251325
13261326 // Create a new buffer and copy it over.
13271327 const len = this . header . packSize ;
1328- const newBuffer = new bitjs . io . ByteBuffer ( len ) ;
1328+ const newBuffer = new ByteBuffer ( len ) ;
13291329 newBuffer . insertBytes ( this . fileData ) ;
13301330 this . fileData = newBuffer . data ;
13311331 } else {
@@ -1402,7 +1402,7 @@ onmessage = function (event) {
14021402
14031403 // This is the very first time we have been called. Initialize the bytestream.
14041404 if ( ! bytestream ) {
1405- bytestream = new bitjs . io . ByteStream ( bytes ) ;
1405+ bytestream = new ByteStream ( bytes ) ;
14061406
14071407 currentFilename = '' ;
14081408 currentFileNumber = 0 ;
0 commit comments