<commit_before>/* Copyright (C) 1999 <NAME> <<EMAIL>>
 * Version: 1.0.0.1
 * LastModified: Dec 25 1999
 * original: http://www.onicos.com/staff/iz/amuse/javascript/expert/inflate.txt
 */

JSROOT.define([], function() {

   "use strict";

/* Interface:
 * data = zip_inflate(src);
 */

/* constant parameters */
const zip_WSIZE = 32768;       // Sliding Window size
//    zip_STORED_BLOCK = 0,
//    zip_STATIC_TREES = 1,
//    zip_DYN_TREES    = 2,

/* for inflate */
//    zip_lbits = 9,            // bits in base literal/length lookup table
//    zip_dbits = 6,            // bits in base distance lookup table
//    zip_INBUFSIZ = 32768,     // Input buffer size
//    zip_INBUF_EXTRA = 64,     // Extra buffer

/* variables (inflate) */
let zip_slide = null,
    zip_wp,                   // current position in slide
    zip_fixed_tl = null,      // inflate static
    zip_fixed_td,             // inflate static
    zip_fixed_bl, zip_fixed_bd,   // inflate static
    zip_bit_buf,              // bit buffer
    zip_bit_len,              // bits in bit buffer
    zip_method,
    zip_eof,
    zip_copy_leng,
    zip_copy_dist,
    zip_tl, zip_td,           // literal/length and distance decoder tables
    zip_bl, zip_bd,           // number of bits decoded by tl and td
    zip_inflate_data,
    zip_inflate_datalen,
    zip_inflate_pos;

/* constant tables (inflate) */
const zip_MASK_BITS = new Array(
   0x0000,
   0x0001, 0x0003, 0x0007, 0x000f, 0x001f, 0x003f, 0x007f, 0x00ff,
   0x01ff, 0x03ff, 0x07ff, 0x0fff, 0x1fff, 0x3fff, 0x7fff, 0xffff),

// Tables for deflate from PKZIP's appnote.txt.
   zip_cplens = new Array( // Copy lengths for literal codes 257..285
   3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,
   35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0),

/* note: see note #13 above about the 258 in this list. */
   zip_cplext = new Array( // Extra bits for literal codes 257..285
   0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2,
   3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, 99, 99), // 99==invalid

   zip_cpdist = new Array( // Copy offsets for distance codes 0..29
   1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
   257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
   8193, 12289, 16385, 24577),

   zip_cpdext = new Array( // Extra bits for distance codes
   0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6,
   7, 7, 8, 8, 9, 9, 10, 10, 11, 11,
   12, 12, 13, 13),

   zip_border = new Array(  // Order of the bit length code lengths
   16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15);
/* objects (inflate) */

function zip_HuftList() {
   this.next = null;
   this.list = null;
}

function zip_HuftNode() {
   this.e = 0; // number of extra bits or operation
   this.b = 0; // number of bits in this code or subcode

   // union
   this.n = 0; // literal, length base, or distance base
   this.t = null; // (zip_HuftNode) pointer to next level of table
}

function zip_HuftBuild(b,     // code lengths in bits (all assumed <= BMAX)
                       n,     // number of codes (assumed <= N_MAX)<commit_msg>Use [] instead of new Array in rawinflate.js<commit_after>/* Copyright (C) 1999 <NAME> <<EMAIL>>
 * Version: 1.0.0.1
 * LastModified: Dec 25 1999
 * original: http://www.onicos.com/staff/iz/amuse/javascript/expert/inflate.txt
 */

JSROOT.define([], function() {

   "use strict";

/* Interface:
 * data = zip_inflate(src);
 */

/* constant parameters */
const zip_WSIZE = 32768;       // Sliding Window size
//    zip_STORED_BLOCK = 0,
//    zip_STATIC_TREES = 1,
//    zip_DYN_TREES    = 2,

/* for inflate */
//    zip_lbits = 9,            // bits in base literal/length lookup table
//    zip_dbits = 6,            // bits in base distance lookup table
//    zip_INBUFSIZ = 32768,     // Input buffer size
//    zip_INBUF_EXTRA = 64,     // Extra buffer

/* variables (inflate) */
let zip_slide = null,
    zip_wp,                   // current position in slide
    zip_fixed_tl = null,      // inflate static
    zip_fixed_td,             // inflate static
    zip_fixed_bl, zip_fixed_bd,   // inflate static
    zip_bit_buf,              // bit buffer
    zip_bit_len,              // bits in bit buffer
    zip_method,
    zip_eof,
    zip_copy_leng,
    zip_copy_dist,
    zip_tl, zip_td,           // literal/length and distance decoder tables
    zip_bl, zip_bd,           // number of bits decoded by tl and td
    zip_inflate_data,
    zip_inflate_datalen,
    zip_inflate_pos;

/* constant tables (inflate) */
const zip_MASK_BITS = [
   0x0000,
   0x0001, 0x0003, 0x0007, 0x000f, 0x001f, 0x003f, 0x007f, 0x00ff,
   0x01ff, 0x03ff, 0x07ff, 0x0fff, 0x1fff, 0x3fff, 0x7fff, 0xffff],

// Tables for deflate from PKZIP's appnote.txt.
   zip_cplens = [ // Copy lengths for literal codes 257..285
   3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,
   35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0],

/* note: see note #13 above about the 258 in this list. */
   zip_cplext = [ // Extra bits for literal codes 257..285
   0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2,
   3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, 99, 99], // 99==invalid

   zip_cpdist = [ // Copy offsets for distance codes 0..29
   1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
   257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
   8193, 12289, 16385, 24577],

   zip_cpdext = [ // Extra bits for distance codes
   0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6,
   7, 7, 8, 8, 9, 9, 10, 10, 11, 11,
   12, 12, 13, 13],

   zip_border = [  // Order of the bit length code lengths
   16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15];
/* objects (inflate) */

function zip_HuftList() {
   this.next = null;
   this.list = null;
}

function zip_HuftNode() {
   this.e = 0; // number of extra bits or operation
   this.b = 0; // number of bits in this code or subcode

   // union
   this.n = 0; // literal, length base, or distance base
   this.t = null; // (zip_HuftNode) pointer to next level of table
}

function zip_HuftBuild(b,     // code lengths in bits (all assumed <= BMAX)
                       n,     // number of codes (assumed <= N_MAX)
{'fraction_non_alphanumeric': 0.13782517369526578, 'fraction_numerical': 0.11407335595411214, 'mean_word_length': 2.2873074880509825, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 12, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3348490', 'n_tokens_mistral': 2978, 'n_tokens_neox': 2341, 'n_words': 801}