{“ast”:null,“code”:“'use strict'; // (C) 1995-2013 Jean-loup Gailly and Mark Adlern// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsinn//n// This software is provided 'as-is', without any express or impliedn// warranty. In no event will the authors be held liable for any damagesn// arising from the use of this software.n//n// Permission is granted to anyone to use this software for any purpose,n// including commercial applications, and to alter it and redistribute itn// freely, subject to the following restrictions:n//n// 1. The origin of this software must not be misrepresented; you must notn// claim that you wrote the original software. If you use this softwaren// in a product, an acknowledgment in the product documentation would ben// appreciated but is not required.n// 2. Altered source versions must be plainly marked as such, and must not ben// misrepresented as being the original software.n// 3. This notice may not be removed or altered from any source distribution.nnvar utils = require('../utils/common');nnvar adler32 = require('./adler32');nnvar crc32 = require('./crc32');nnvar inflate_fast = require('./inffast');nnvar inflate_table = require('./inftrees');nnvar CODES = 0;nvar LENS = 1;nvar DISTS = 2;n/* Public constants ==========================================================*/nn/* ===========================================================================*/nn/* Allowed flush values; see deflate() and inflate() below for details */n//var Z_NO_FLUSH = 0;n//var Z_PARTIAL_FLUSH = 1;n//var Z_SYNC_FLUSH = 2;n//var Z_FULL_FLUSH = 3;nnvar Z_FINISH = 4;nvar Z_BLOCK = 5;nvar Z_TREES = 6;n/* Return codes for the compression/decompression functions. Negative valuesn * are errors, positive values are used for special but normal events.n */nnvar Z_OK = 0;nvar Z_STREAM_END = 1;nvar Z_NEED_DICT = 2; //var Z_ERRNO = -1;nnvar Z_STREAM_ERROR = -2;nvar Z_DATA_ERROR = -3;nvar Z_MEM_ERROR = -4;nvar Z_BUF_ERROR = -5; //var Z_VERSION_ERROR = -6;nn/* The deflate compression method */nnvar Z_DEFLATED = 8;n/* STATES ====================================================================*/nn/* ===========================================================================*/nnvar HEAD = 1;n/* i: waiting for magic header */nnvar FLAGS = 2;n/* i: waiting for method and flags (gzip) */nnvar TIME = 3;n/* i: waiting for modification time (gzip) */nnvar OS = 4;n/* i: waiting for extra flags and operating system (gzip) */nnvar EXLEN = 5;n/* i: waiting for extra length (gzip) */nnvar EXTRA = 6;n/* i: waiting for extra bytes (gzip) */nnvar NAME = 7;n/* i: waiting for end of file name (gzip) */nnvar COMMENT = 8;n/* i: waiting for end of comment (gzip) */nnvar HCRC = 9;n/* i: waiting for header crc (gzip) */nnvar DICTID = 10;n/* i: waiting for dictionary check value */nnvar DICT = 11;n/* waiting for inflateSetDictionary() call */nnvar TYPE = 12;n/* i: waiting for type bits, including last-flag bit */nnvar TYPEDO = 13;n/* i: same, but skip check to exit inflate on new block */nnvar STORED = 14;n/* i: waiting for stored size (length and complement) */nnvar COPY_ = 15;n/* i/o: same as COPY below, but only first time in */nnvar COPY = 16;n/* i/o: waiting for input or output to copy stored block */nnvar TABLE = 17;n/* i: waiting for dynamic block table lengths */nnvar LENLENS = 18;n/* i: waiting for code length code lengths */nnvar CODELENS = 19;n/* i: waiting for length/lit and distance code lengths */nnvar LEN_ = 20;n/* i: same as LEN below, but only first time in */nnvar LEN = 21;n/* i: waiting for length/lit/eob code */nnvar LENEXT = 22;n/* i: waiting for length extra bits */nnvar DIST = 23;n/* i: waiting for distance code */nnvar DISTEXT = 24;n/* i: waiting for distance extra bits */nnvar MATCH = 25;n/* o: waiting for output space to copy string */nnvar LIT = 26;n/* o: waiting for output space to write literal */nnvar CHECK = 27;n/* i: waiting for 32-bit check value */nnvar LENGTH = 28;n/* i: waiting for 32-bit length (gzip) */nnvar DONE = 29;n/* finished check, done – remain here until reset */nnvar BAD = 30;n/* got a data error – remain here until reset */nnvar MEM = 31;n/* got an inflate() memory error – remain here until reset */nnvar SYNC = 32;n/* looking for synchronization bytes to restart inflate() */nn/* ===========================================================================*/nnvar ENOUGH_LENS = 852;nvar ENOUGH_DISTS = 592; //var ENOUGH = (ENOUGH_LENS+ENOUGH_DISTS);nnvar MAX_WBITS = 15;n/* 32K LZ77 window */nnvar DEF_WBITS = MAX_WBITS;nnfunction zswap32(q) {n return (q >>> 24 & 0xff) + (q >>> 8 & 0xff00) + ((q & 0xff00) << 8) + ((q & 0xff) << 24);n}nnfunction InflateState() {n this.mode = 0;n /* current inflate mode */nn this.last = false;n /* true if processing last block */nn this.wrap = 0;n /* bit 0 true for zlib, bit 1 true for gzip */nn this.havedict = false;n /* true if dictionary provided */nn this.flags = 0;n /* gzip header method and flags (0 if zlib) */nn this.dmax = 0;n /* zlib header max distance (INFLATE_STRICT) */nn this.check = 0;n /* protected copy of check value */nn this.total = 0;n /* protected copy of output count */n // TODO: may be {}nn this.head = null;n /* where to save gzip header information */nn /* sliding window */nn this.wbits = 0;n /* log base 2 of requested window size */nn this.wsize = 0;n /* window size or zero if not using window */nn this.whave = 0;n /* valid bytes in the window */nn this.wnext = 0;n /* window write index */nn this.window = null;n /* allocated sliding window, if needed */nn /* bit accumulator */nn this.hold = 0;n /* input bit accumulator */nn this.bits = 0;n /* number of bits in "in" */nn /* for string and stored block copying */nn this.length = 0;n /* literal or length of data to copy */nn this.offset = 0;n /* distance back to copy string from */nn /* for table and code decoding */nn this.extra = 0;n /* extra bits needed */nn /* fixed and dynamic code tables */nn this.lencode = null;n /* starting table for length/literal codes */nn this.distcode = null;n /* starting table for distance codes */nn this.lenbits = 0;n /* index bits for lencode */nn this.distbits = 0;n /* index bits for distcode */nn /* dynamic table building */nn this.ncode = 0;n /* number of code length code lengths */nn this.nlen = 0;n /* number of length code lengths */nn this.ndist = 0;n /* number of distance code lengths */nn this.have = 0;n /* number of code lengths in lens[] */nn this.next = null;n /* next available space in codes[] */nn this.lens = new utils.Buf16(320);n /* temporary storage for code lengths */nn this.work = new utils.Buf16(288);n /* work area for code table building */nn /*n because we don't have pointers in js, we use lencode and distcode directlyn as buffers so we don't need codesn */n //this.codes = new utils.Buf32(ENOUGH); /* space for code tables */nn this.lendyn = null;n /* dynamic table for length/literal codes (JS specific) */nn this.distdyn = null;n /* dynamic table for distance codes (JS specific) */nn this.sane = 0;n /* if false, allow invalid distance too far */nn this.back = 0;n /* bits back of last unprocessed length/lit */nn this.was = 0;n /* initial length of match */n}nnfunction inflateResetKeep(strm) {n var state;nn if (!strm || !strm.state) {n return Z_STREAM_ERROR;n }nn state = strm.state;n strm.total_in = strm.total_out = state.total = 0;n strm.msg = '';n /Z_NULL/nn if (state.wrap) {n /* to support ill-conceived Java test suite */n strm.adler = state.wrap & 1;n }nn state.mode = HEAD;n state.last = 0;n state.havedict = 0;n state.dmax = 32768;n state.head = nulln /Z_NULL/n ;n state.hold = 0;n state.bits = 0; //state.lencode = state.distcode = state.next = state.codes;nn state.lencode = state.lendyn = new utils.Buf32(ENOUGH_LENS);n state.distcode = state.distdyn = new utils.Buf32(ENOUGH_DISTS);n state.sane = 1;n state.back = -1; //Tracev((stderr, "inflate: reset\n"));nn return Z_OK;n}nnfunction inflateReset(strm) {n var state;nn if (!strm || !strm.state) {n return Z_STREAM_ERROR;n }nn state = strm.state;n state.wsize = 0;n state.whave = 0;n state.wnext = 0;n return inflateResetKeep(strm);n}nnfunction inflateReset2(strm, windowBits) {n var wrap;n var state;n /* get the state */nn if (!strm || !strm.state) {n return Z_STREAM_ERROR;n }nn state = strm.state;n /* extract wrap request from windowBits parameter */nn if (windowBits < 0) {n wrap = 0;n windowBits = -windowBits;n } else {n wrap = (windowBits >> 4) + 1;nn if (windowBits < 48) {n windowBits &= 15;n }n }n /* set number of window bits, free window if different */nnn if (windowBits && (windowBits < 8 || windowBits > 15)) {n return Z_STREAM_ERROR;n }nn if (state.window !== null && state.wbits !== windowBits) {n state.window = null;n }n /* update state and reset the rest of it */nnn state.wrap = wrap;n state.wbits = windowBits;n return inflateReset(strm);n}nnfunction inflateInit2(strm, windowBits) {n var ret;n var state;nn if (!strm) {n return Z_STREAM_ERROR;n } //strm.msg = Z_NULL; /* in case we return an error */nnn state = new InflateState(); //if (state === Z_NULL) return Z_MEM_ERROR;n //Tracev((stderr, "inflate: allocated\n"));nn strm.state = state;n state.window = nulln /Z_NULL/n ;n ret = inflateReset2(strm, windowBits);nn if (ret !== Z_OK) {n strm.state = nulln /Z_NULL/n ;n }nn return ret;n}nnfunction inflateInit(strm) {n return inflateInit2(strm, DEF_WBITS);n}n/*n Return state with length and distance decoding tables and index sizes set ton fixed code decoding. Normally this returns fixed tables from inffixed.h.n If BUILDFIXED is defined, then instead this routine builds the tables then first time it's called, and returns those tables the first time andn thereafter. This reduces the size of the code by about 2K bytes, inn exchange for a little execution time. However, BUILDFIXED should not ben used for threaded applications, since the rewriting of the tables and virginn may not be thread-safe.n */nnnvar virgin = true;nvar lenfix, distfix; // We have no pointers in JS, so keep tables separatennfunction fixedtables(state) {n /* build fixed huffman tables if first call (may not be thread safe) */n if (virgin) {n var sym;n lenfix = new utils.Buf32(512);n distfix = new utils.Buf32(32);n /* literal/length table */nn sym = 0;nn while (sym < 144) {n state.lens = 8;n }nn while (sym < 256) {n state.lens = 9;n }nn while (sym < 280) {n state.lens = 7;n }nn while (sym < 288) {n state.lens = 8;n }nn inflate_table(LENS, state.lens, 0, 288, lenfix, 0, state.work, {n bits: 9n });n /* distance table */nn sym = 0;nn while (sym < 32) {n state.lens = 5;n }nn inflate_table(DISTS, state.lens, 0, 32, distfix, 0, state.work, {n bits: 5n });n /* do this just once */nn virgin = false;n }nn state.lencode = lenfix;n state.lenbits = 9;n state.distcode = distfix;n state.distbits = 5;n}n/*n Update the window with the last wsize (normally 32K) bytes written beforen returning. If window does not exist yet, create it. This is only calledn when a window is already in use, or when output has been written during thisn inflate call, but the end of the deflate stream has not been reached yet.n It is also called to create a window for dictionary data when a dictionaryn is loaded.nn Providing output buffers larger than 32K to inflate() should provide a speedn advantage, since only the last 32K of output is copied to the sliding windown upon return from inflate(), and since all distances after the first 32K ofn output will fall in the output data, making match copies simpler and faster.n The advantage may be dependent on the size of the processor's data caches.n */nnnfunction updatewindow(strm, src, end, copy) {n var dist;n var state = strm.state;n /* if it hasn't been done already, allocate space for the window */nn if (state.window === null) {n state.wsize = 1 << state.wbits;n state.wnext = 0;n state.whave = 0;n state.window = new utils.Buf8(state.wsize);n }n /* copy state->wsize or less output bytes into the circular window */nnn if (copy >= state.wsize) {n utils.arraySet(state.window, src, end - state.wsize, state.wsize, 0);n state.wnext = 0;n state.whave = state.wsize;n } else {n dist = state.wsize - state.wnext;nn if (dist > copy) {n dist = copy;n } //zmemcpy(state->window + state->wnext, end - copy, dist);nnn utils.arraySet(state.window, src, end - copy, dist, state.wnext);n copy -= dist;nn if (copy) {n //zmemcpy(state->window, end - copy, copy);n utils.arraySet(state.window, src, end - copy, copy, 0);n state.wnext = copy;n state.whave = state.wsize;n } else {n state.wnext += dist;nn if (state.wnext === state.wsize) {n state.wnext = 0;n }nn if (state.whave < state.wsize) {n state.whave += dist;n }n }n }nn return 0;n}nnfunction inflate(strm, flush) {n var state;n var input, output; // input/output buffersnn var next;n /* next input INDEX */nn var put;n /* next output INDEX */nn var have, left;n /* available input and output */nn var hold;n /* bit buffer */nn var bits;n /* bits in bit buffer */nn var _in, _out;n /* save starting available input and output */nnn var copy;n /* number of stored or match bytes to copy */nn var from;n /* where to copy match bytes from */nn var from_source;n var here = 0;n /* current decoding table entry */nn var here_bits, here_op, here_val; // paked "here" denormalized (JS specific)n //var last; /* parent table entry */nn var last_bits, last_op, last_val; // paked "last" denormalized (JS specific)nn var len;n /* length to copy for repeats, bits to drop */nn var ret;n /* return code */nn var hbuf = new utils.Buf8(4);n /* buffer for gzip header crc calculation */nn var opts;n var n; // temporary var for NEED_BITSnn var order =n /* permutation of code lengths */n [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15];nn if (!strm || !strm.state || !strm.output || !strm.input && strm.avail_in !== 0) {n return Z_STREAM_ERROR;n }nn state = strm.state;nn if (state.mode === TYPE) {n state.mode = TYPEDO;n }n /* skip check */n //— LOAD() —nnn put = strm.next_out;n output = strm.output;n left = strm.avail_out;n next = strm.next_in;n input = strm.input;n have = strm.avail_in;n hold = state.hold;n bits = state.bits; //—nn _in = have;n _out = left;n ret = Z_OK;nn inf_leave: // goto emulationn for (;;) {n switch (state.mode) {n case HEAD:n if (state.wrap === 0) {n state.mode = TYPEDO;n break;n } //=== NEEDBITS(16);nnn while (bits < 16) {n if (have === 0) {n break inf_leave;n }nn have–;n hold += input << bits;n bits += 8;n } //===//nnn if (state.wrap & 2 && hold === 0x8b1f) {n /* gzip header */n state.check = 0n /*crc32(0L, Z_NULL, 0)*/n ; //=== CRC2(state.check, hold);nn hbuf = hold & 0xff;n hbuf = hold >>> 8 & 0xff;n state.check = crc32(state.check, hbuf, 2, 0); //===//n //=== INITBITS();nn hold = 0;n bits = 0; //===//nn state.mode = FLAGS;n break;n }nn state.flags = 0;n /* expect zlib header */nn if (state.head) {n state.head.done = false;n }nn if (!(state.wrap & 1) ||n /* check if zlib header allowed */n (((hold & 0xff) <<n /*BITS(8)*/n 8) + (hold >> 8)) % 31) {n strm.msg = 'incorrect header check';n state.mode = BAD;n break;n }nn if ((hold & 0x0f) !==n /*BITS(4)*/n Z_DEFLATED) {n strm.msg = 'unknown compression method';n state.mode = BAD;n break;n } //— DROPBITS(4) —//nnn hold >>>= 4;n bits -= 4; //—//nn len = (hold & 0x0f) +n /*BITS(4)*/n 8;nn if (state.wbits === 0) {n state.wbits = len;n } else if (len > state.wbits) {n strm.msg = 'invalid window size';n state.mode = BAD;n break;n }nn state.dmax = 1 << len; //Tracev((stderr, "inflate: zlib header ok\n"));nn strm.adler = state.check = 1n /*adler32(0L, Z_NULL, 0)*/n ;n state.mode = hold & 0x200 ? DICTID : TYPE; //=== INITBITS();nn hold = 0;n bits = 0; //===//nn break;nn case FLAGS:n //=== NEEDBITS(16); */n while (bits < 16) {n if (have === 0) {n break inf_leave;n }nn have–;n hold += input << bits;n bits += 8;n } //===//nnn state.flags = hold;nn if ((state.flags & 0xff) !== Z_DEFLATED) {n strm.msg = 'unknown compression method';n state.mode = BAD;n break;n }nn if (state.flags & 0xe000) {n strm.msg = 'unknown header flags set';n state.mode = BAD;n break;n }nn if (state.head) {n state.head.text = hold >> 8 & 1;n }nn if (state.flags & 0x0200) {n //=== CRC2(state.check, hold);n hbuf = hold & 0xff;n hbuf = hold >>> 8 & 0xff;n state.check = crc32(state.check, hbuf, 2, 0); //===//n } //=== INITBITS();nnn hold = 0;n bits = 0; //===//nn state.mode = TIME;nn /* falls through */nn case TIME:n //=== NEEDBITS(32); */n while (bits < 32) {n if (have === 0) {n break inf_leave;n }nn have–;n hold += input << bits;n bits += 8;n } //===//nnn if (state.head) {n state.head.time = hold;n }nn if (state.flags & 0x0200) {n //=== CRC4(state.check, hold)n hbuf = hold & 0xff;n hbuf = hold >>> 8 & 0xff;n hbuf = hold >>> 16 & 0xff;n hbuf = hold >>> 24 & 0xff;n state.check = crc32(state.check, hbuf, 4, 0); //===n } //=== INITBITS();nnn hold = 0;n bits = 0; //===//nn state.mode = OS;nn /* falls through */nn case OS:n //=== NEEDBITS(16); */n while (bits < 16) {n if (have === 0) {n break inf_leave;n }nn have–;n hold += input << bits;n bits += 8;n } //===//nnn if (state.head) {n state.head.xflags = hold & 0xff;n state.head.os = hold >> 8;n }nn if (state.flags & 0x0200) {n //=== CRC2(state.check, hold);n hbuf = hold & 0xff;n hbuf = hold >>> 8 & 0xff;n state.check = crc32(state.check, hbuf, 2, 0); //===//n } //=== INITBITS();nnn hold = 0;n bits = 0; //===//nn state.mode = EXLEN;nn /* falls through */nn case EXLEN:n if (state.flags & 0x0400) {n //=== NEEDBITS(16); */n while (bits < 16) {n if (have === 0) {n break inf_leave;n }nn have–;n hold += input << bits;n bits += 8;n } //===//nnn state.length = hold;nn if (state.head) {n state.head.extra_len = hold;n }nn if (state.flags & 0x0200) {n //=== CRC2(state.check, hold);n hbuf = hold & 0xff;n hbuf = hold >>> 8 & 0xff;n state.check = crc32(state.check, hbuf, 2, 0); //===//n } //=== INITBITS();nnn hold = 0;n bits = 0; //===//n } else if (state.head) {n state.head.extra = nulln /Z_NULL/n ;n }nn state.mode = EXTRA;nn /* falls through */nn case EXTRA:n if (state.flags & 0x0400) {n copy = state.length;nn if (copy > have) {n copy = have;n }nn if (copy) {n if (state.head) {n len = state.head.extra_len - state.length;nn if (!state.head.extra) {n // Use untyped array for more convenient processing latern state.head.extra = new Array(state.head.extra_len);n }nn utils.arraySet(state.head.extra, input, next, // extra field is limited to 65536 bytesn // - no need for additional size checkn copy,n /*len + copy > state.head.extra_max - len ? state.head.extra_max : copy,*/n len); //zmemcpy(state.head.extra + len, next,n // len + copy > state.head.extra_max ?n // state.head.extra_max - len : copy);n }nn if (state.flags & 0x0200) {n state.check = crc32(state.check, input, copy, next);n }nn have -= copy;n next += copy;n state.length -= copy;n }nn if (state.length) {n break inf_leave;n }n }nn state.length = 0;n state.mode = NAME;nn /* falls through */nn case NAME:n if (state.flags & 0x0800) {n if (have === 0) {n break inf_leave;n }nn copy = 0;nn do {n // TODO: 2 or 1 bytes?n len = input[next + copy++];n /* use constant limit because in js we should not preallocate memory */nn if (state.head && len && state.length < 65536n /state.head.name_max/n ) {n state.head.name += String.fromCharCode(len);n }n } while (len && copy < have);nn if (state.flags & 0x0200) {n state.check = crc32(state.check, input, copy, next);n }nn have -= copy;n next += copy;nn if (len) {n break inf_leave;n }n } else if (state.head) {n state.head.name = null;n }nn state.length = 0;n state.mode = COMMENT;nn /* falls through */nn case COMMENT:n if (state.flags & 0x1000) {n if (have === 0) {n break inf_leave;n }nn copy = 0;nn do {n len = input[next + copy++];n /* use constant limit because in js we should not preallocate memory */nn if (state.head && len && state.length < 65536n /state.head.comm_max/n ) {n state.head.comment += String.fromCharCode(len);n }n } while (len && copy < have);nn if (state.flags & 0x0200) {n state.check = crc32(state.check, input, copy, next);n }nn have -= copy;n next += copy;nn if (len) {n break inf_leave;n }n } else if (state.head) {n state.head.comment = null;n }nn state.mode = HCRC;nn /* falls through */nn case HCRC:n if (state.flags & 0x0200) {n //=== NEEDBITS(16); */n while (bits < 16) {n if (have === 0) {n break inf_leave;n }nn have–;n hold += input << bits;n bits += 8;n } //===//nnn if (hold !== (state.check & 0xffff)) {n strm.msg = 'header crc mismatch';n state.mode = BAD;n break;n } //=== INITBITS();nnn hold = 0;n bits = 0; //===//n }nn if (state.head) {n state.head.hcrc = state.flags >> 9 & 1;n state.head.done = true;n }nn strm.adler = state.check = 0;n state.mode = TYPE;n break;nn case DICTID:n //=== NEEDBITS(32); */n while (bits < 32) {n if (have === 0) {n break inf_leave;n }nn have–;n hold += input << bits;n bits += 8;n } //===//nnn strm.adler = state.check = zswap32(hold); //=== INITBITS();nn hold = 0;n bits = 0; //===//nn state.mode = DICT;nn /* falls through */nn case DICT:n if (state.havedict === 0) {n //— RESTORE() —n strm.next_out = put;n strm.avail_out = left;n strm.next_in = next;n strm.avail_in = have;n state.hold = hold;n state.bits = bits; //—nn return Z_NEED_DICT;n }nn strm.adler = state.check = 1n /*adler32(0L, Z_NULL, 0)*/n ;n state.mode = TYPE;nn /* falls through */nn case TYPE:n if (flush === Z_BLOCK || flush === Z_TREES) {n break inf_leave;n }nn /* falls through */nn case TYPEDO:n if (state.last) {n //— BYTEBITS() —//n hold >>>= bits & 7;n bits -= bits & 7; //—//nn state.mode = CHECK;n break;n } //=== NEEDBITS(3); */nnn while (bits < 3) {n if (have === 0) {n break inf_leave;n }nn have–;n hold += input << bits;n bits += 8;n } //===//nnn state.last = hold & 0x01n /*BITS(1)*/n ; //— DROPBITS(1) —//nn hold >>>= 1;n bits -= 1; //—//nn switch (hold & 0x03) {n /*BITS(2)*/n case 0:n /* stored block */n //Tracev((stderr, "inflate: stored block%s\n",n // state.last ? " (last)" : ""));n state.mode = STORED;n break;nn case 1:n /* fixed block */n fixedtables(state); //Tracev((stderr, "inflate: fixed codes block%s\n",n // state.last ? " (last)" : ""));nn state.mode = LEN_;n /* decode codes */nn if (flush === Z_TREES) {n //— DROPBITS(2) —//n hold >>>= 2;n bits -= 2; //—//nn break inf_leave;n }nn break;nn case 2:n /* dynamic block */n //Tracev((stderr, "inflate: dynamic codes block%s\n",n // state.last ? " (last)" : ""));n state.mode = TABLE;n break;nn case 3:n strm.msg = 'invalid block type';n state.mode = BAD;n } //— DROPBITS(2) —//nnn hold >>>= 2;n bits -= 2; //—//nn break;nn case STORED:n //— BYTEBITS() —// /* go to byte boundary */n hold >>>= bits & 7;n bits -= bits & 7; //—//n //=== NEEDBITS(32); */nn while (bits < 32) {n if (have === 0) {n break inf_leave;n }nn have–;n hold += input << bits;n bits += 8;n } //===//nnn if ((hold & 0xffff) !== (hold >>> 16 ^ 0xffff)) {n strm.msg = 'invalid stored block lengths';n state.mode = BAD;n break;n }nn state.length = hold & 0xffff; //Tracev((stderr, "inflate: stored length %u\n",n // state.length));n //=== INITBITS();nn hold = 0;n bits = 0; //===//nn state.mode = COPY_;nn if (flush === Z_TREES) {n break inf_leave;n }nn /* falls through */nn case COPY_:n state.mode = COPY;nn /* falls through */nn case COPY:n copy = state.length;nn if (copy) {n if (copy > have) {n copy = have;n }nn if (copy > left) {n copy = left;n }nn if (copy === 0) {n break inf_leave;n } //— zmemcpy(put, next, copy); —nnn utils.arraySet(output, input, next, copy, put); //—//nn have -= copy;n next += copy;n left -= copy;n put += copy;n state.length -= copy;n break;n } //Tracev((stderr, "inflate: stored end\n"));nnn state.mode = TYPE;n break;nn case TABLE:n //=== NEEDBITS(14); */n while (bits < 14) {n if (have === 0) {n break inf_leave;n }nn have–;n hold += input << bits;n bits += 8;n } //===//nnn state.nlen = (hold & 0x1f) +n /*BITS(5)*/n 257; //— DROPBITS(5) —//nn hold >>>= 5;n bits -= 5; //—//nn state.ndist = (hold & 0x1f) +n /*BITS(5)*/n 1; //— DROPBITS(5) —//nn hold >>>= 5;n bits -= 5; //—//nn state.ncode = (hold & 0x0f) +n /*BITS(4)*/n 4; //— DROPBITS(4) —//nn hold >>>= 4;n bits -= 4; //—//n //#ifndef PKZIP_BUG_WORKAROUNDnn if (state.nlen > 286 || state.ndist > 30) {n strm.msg = 'too many length or distance symbols';n state.mode = BAD;n break;n } //#endifn //Tracev((stderr, "inflate: table sizes ok\n"));nnn state.have = 0;n state.mode = LENLENS;nn /* falls through */nn case LENLENS:n while (state.have < state.ncode) {n //=== NEEDBITS(3);n while (bits < 3) {n if (have === 0) {n break inf_leave;n }nn have–;n hold += input << bits;n bits += 8;n } //===//nnn state.lens[order] = hold & 0x07; //BITS(3);n //— DROPBITS(3) —//nn hold >>>= 3;n bits -= 3; //—//n }nn while (state.have < 19) {n state.lens[order] = 0;n } // We have separate tables & no pointers. 2 commented lines below not needed.n //state.next = state.codes;n //state.lencode = state.next;n // Switch to use dynamic tablennn state.lencode = state.lendyn;n state.lenbits = 7;n opts = {n bits: state.lenbitsn };n ret = inflate_table(CODES, state.lens, 0, 19, state.lencode, 0, state.work, opts);n state.lenbits = opts.bits;nn if (ret) {n strm.msg = 'invalid code lengths set';n state.mode = BAD;n break;n } //Tracev((stderr, "inflate: code lengths ok\n"));nnn state.have = 0;n state.mode = CODELENS;nn /* falls through */nn case CODELENS:n while (state.have < state.nlen + state.ndist) {n for (;;) {n here = state.lencode[hold & (1 << state.lenbits) - 1];n /*BITS(state.lenbits)*/nn here_bits = here >>> 24;n here_op = here >>> 16 & 0xff;n here_val = here & 0xffff;nn if (here_bits <= bits) {n break;n } //— PULLBYTE() —//nnn if (have === 0) {n break inf_leave;n }nn have–;n hold += input << bits;n bits += 8; //—//n }nn if (here_val < 16) {n //— DROPBITS(here.bits) —//n hold >>>= here_bits;n bits -= here_bits; //—//nn state.lens = here_val;n } else {n if (here_val === 16) {n //=== NEEDBITS(here.bits + 2);n n = here_bits + 2;nn while (bits < n) {n if (have === 0) {n break inf_leave;n }nn have–;n hold += input << bits;n bits += 8;n } //===//n //— DROPBITS(here.bits) —//nnn hold >>>= here_bits;n bits -= here_bits; //—//nn if (state.have === 0) {n strm.msg = 'invalid bit length repeat';n state.mode = BAD;n break;n }nn len = state.lens[state.have - 1];n copy = 3 + (hold & 0x03); //BITS(2);n //— DROPBITS(2) —//nn hold >>>= 2;n bits -= 2; //—//n } else if (here_val === 17) {n //=== NEEDBITS(here.bits + 3);n n = here_bits + 3;nn while (bits < n) {n if (have === 0) {n break inf_leave;n }nn have–;n hold += input << bits;n bits += 8;n } //===//n //— DROPBITS(here.bits) —//nnn hold >>>= here_bits;n bits -= here_bits; //—//nn len = 0;n copy = 3 + (hold & 0x07); //BITS(3);n //— DROPBITS(3) —//nn hold >>>= 3;n bits -= 3; //—//n } else {n //=== NEEDBITS(here.bits + 7);n n = here_bits + 7;nn while (bits < n) {n if (have === 0) {n break inf_leave;n }nn have–;n hold += input << bits;n bits += 8;n } //===//n //— DROPBITS(here.bits) —//nnn hold >>>= here_bits;n bits -= here_bits; //—//nn len = 0;n copy = 11 + (hold & 0x7f); //BITS(7);n //— DROPBITS(7) —//nn hold >>>= 7;n bits -= 7; //—//n }nn if (state.have + copy > state.nlen + state.ndist) {n strm.msg = 'invalid bit length repeat';n state.mode = BAD;n break;n }nn while (copy–) {n state.lens = len;n }n }n }n /* handle error breaks in while */nnn if (state.mode === BAD) {n break;n }n /* check for end-of-block code (better have one) */nnn if (state.lens === 0) {n strm.msg = 'invalid code – missing end-of-block';n state.mode = BAD;n break;n }n /* build code tables – note: do not change the lenbits or distbitsn values here (9 and 6) without reading the comments in inftrees.hn concerning the ENOUGH constants, which depend on those values */nnn state.lenbits = 9;n opts = {n bits: state.lenbitsn };n ret = inflate_table(LENS, state.lens, 0, state.nlen, state.lencode, 0, state.work, opts); // We have separate tables & no pointers. 2 commented lines below not needed.n // state.next_index = opts.table_index;nn state.lenbits = opts.bits; // state.lencode = state.next;nn if (ret) {n strm.msg = 'invalid literal/lengths set';n state.mode = BAD;n break;n }nn state.distbits = 6; //state.distcode.copy(state.codes);n // Switch to use dynamic tablenn state.distcode = state.distdyn;n opts = {n bits: state.distbitsn };n ret = inflate_table(DISTS, state.lens, state.nlen, state.ndist, state.distcode, 0, state.work, opts); // We have separate tables & no pointers. 2 commented lines below not needed.n // state.next_index = opts.table_index;nn state.distbits = opts.bits; // state.distcode = state.next;nn if (ret) {n strm.msg = 'invalid distances set';n state.mode = BAD;n break;n } //Tracev((stderr, 'inflate: codes ok\n'));nnn state.mode = LEN_;nn if (flush === Z_TREES) {n break inf_leave;n }nn /* falls through */nn case LEN_:n state.mode = LEN;nn /* falls through */nn case LEN:n if (have >= 6 && left >= 258) {n //— RESTORE() —n strm.next_out = put;n strm.avail_out = left;n strm.next_in = next;n strm.avail_in = have;n state.hold = hold;n state.bits = bits; //—nn inflate_fast(strm, _out); //— LOAD() —nn put = strm.next_out;n output = strm.output;n left = strm.avail_out;n next = strm.next_in;n input = strm.input;n have = strm.avail_in;n hold = state.hold;n bits = state.bits; //—nn if (state.mode === TYPE) {n state.back = -1;n }nn break;n }nn state.back = 0;nn for (;;) {n here = state.lencode[hold & (1 << state.lenbits) - 1];n /*BITS(state.lenbits)*/nn here_bits = here >>> 24;n here_op = here >>> 16 & 0xff;n here_val = here & 0xffff;nn if (here_bits <= bits) {n break;n } //— PULLBYTE() —//nnn if (have === 0) {n break inf_leave;n }nn have–;n hold += input << bits;n bits += 8; //—//n }nn if (here_op && (here_op & 0xf0) === 0) {n last_bits = here_bits;n last_op = here_op;n last_val = here_val;nn for (;;) {n here = state.lencode[last_val + ((hold & (1 << last_bits + last_op) - 1) >>n /*BITS(last.bits + last.op)*/n last_bits)];n here_bits = here >>> 24;n here_op = here >>> 16 & 0xff;n here_val = here & 0xffff;nn if (last_bits + here_bits <= bits) {n break;n } //— PULLBYTE() —//nnn if (have === 0) {n break inf_leave;n }nn have–;n hold += input << bits;n bits += 8; //—//n } //— DROPBITS(last.bits) —//nnn hold >>>= last_bits;n bits -= last_bits; //—//nn state.back += last_bits;n } //— DROPBITS(here.bits) —//nnn hold >>>= here_bits;n bits -= here_bits; //—//nn state.back += here_bits;n state.length = here_val;nn if (here_op === 0) {n //Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?n // "inflate: literal '%c'\n" :n // "inflate: literal 0x%02x\n", here.val));n state.mode = LIT;n break;n }nn if (here_op & 32) {n //Tracevv((stderr, "inflate: end of block\n"));n state.back = -1;n state.mode = TYPE;n break;n }nn if (here_op & 64) {n strm.msg = 'invalid literal/length code';n state.mode = BAD;n break;n }nn state.extra = here_op & 15;n state.mode = LENEXT;nn /* falls through */nn case LENEXT:n if (state.extra) {n //=== NEEDBITS(state.extra);n n = state.extra;nn while (bits < n) {n if (have === 0) {n break inf_leave;n }nn have–;n hold += input << bits;n bits += 8;n } //===//nnn state.length += hold & (1 << state.extra) - 1n /*BITS(state.extra)*/n ; //— DROPBITS(state.extra) —//nn hold >>>= state.extra;n bits -= state.extra; //—//nn state.back += state.extra;n } //Tracevv((stderr, "inflate: length %u\n", state.length));nnn state.was = state.length;n state.mode = DIST;nn /* falls through */nn case DIST:n for (;;) {n here = state.distcode[hold & (1 << state.distbits) - 1];n /*BITS(state.distbits)*/nn here_bits = here >>> 24;n here_op = here >>> 16 & 0xff;n here_val = here & 0xffff;nn if (here_bits <= bits) {n break;n } //— PULLBYTE() —//nnn if (have === 0) {n break inf_leave;n }nn have–;n hold += input << bits;n bits += 8; //—//n }nn if ((here_op & 0xf0) === 0) {n last_bits = here_bits;n last_op = here_op;n last_val = here_val;nn for (;;) {n here = state.distcode[last_val + ((hold & (1 << last_bits + last_op) - 1) >>n /*BITS(last.bits + last.op)*/n last_bits)];n here_bits = here >>> 24;n here_op = here >>> 16 & 0xff;n here_val = here & 0xffff;nn if (last_bits + here_bits <= bits) {n break;n } //— PULLBYTE() —//nnn if (have === 0) {n break inf_leave;n }nn have–;n hold += input << bits;n bits += 8; //—//n } //— DROPBITS(last.bits) —//nnn hold >>>= last_bits;n bits -= last_bits; //—//nn state.back += last_bits;n } //— DROPBITS(here.bits) —//nnn hold >>>= here_bits;n bits -= here_bits; //—//nn state.back += here_bits;nn if (here_op & 64) {n strm.msg = 'invalid distance code';n state.mode = BAD;n break;n }nn state.offset = here_val;n state.extra = here_op & 15;n state.mode = DISTEXT;nn /* falls through */nn case DISTEXT:n if (state.extra) {n //=== NEEDBITS(state.extra);n n = state.extra;nn while (bits < n) {n if (have === 0) {n break inf_leave;n }nn have–;n hold += input << bits;n bits += 8;n } //===//nnn state.offset += hold & (1 << state.extra) - 1n /*BITS(state.extra)*/n ; //— DROPBITS(state.extra) —//nn hold >>>= state.extra;n bits -= state.extra; //—//nn state.back += state.extra;n } //#ifdef INFLATE_STRICTnnn if (state.offset > state.dmax) {n strm.msg = 'invalid distance too far back';n state.mode = BAD;n break;n } //#endifn //Tracevv((stderr, "inflate: distance %u\n", state.offset));nnn state.mode = MATCH;nn /* falls through */nn case MATCH:n if (left === 0) {n break inf_leave;n }nn copy = _out - left;nn if (state.offset > copy) {n /* copy from window */n copy = state.offset - copy;nn if (copy > state.whave) {n if (state.sane) {n strm.msg = 'invalid distance too far back';n state.mode = BAD;n break;n } // (!) This block is disabled in zlib defaults,n // don't enable it for binary compatibilityn //#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRRn // Trace((stderr, "inflate.c too far\n"));n // copy -= state.whave;n // if (copy > state.length) { copy = state.length; }n // if (copy > left) { copy = left; }n // left -= copy;n // state.length -= copy;n // do {n // output = 0;n // } while (–copy);n // if (state.length === 0) { state.mode = LEN; }n // break;n //#endifnn }nn if (copy > state.wnext) {n copy -= state.wnext;n from = state.wsize - copy;n } else {n from = state.wnext - copy;n }nn if (copy > state.length) {n copy = state.length;n }nn from_source = state.window;n } else {n /* copy from output */n from_source = output;n from = put - state.offset;n copy = state.length;n }nn if (copy > left) {n copy = left;n }nn left -= copy;n state.length -= copy;nn do {n output = from_source;n } while (–copy);nn if (state.length === 0) {n state.mode = LEN;n }nn break;nn case LIT:n if (left === 0) {n break inf_leave;n }nn output = state.length;n left–;n state.mode = LEN;n break;nn case CHECK:n if (state.wrap) {n //=== NEEDBITS(32);n while (bits < 32) {n if (have === 0) {n break inf_leave;n }nn have–; // Use '|' instead of '+' to make sure that result is signednn hold |= input << bits;n bits += 8;n } //===//nnn _out -= left;n strm.total_out += _out;n state.total += _out;nn if (_out) {n strm.adler = state.check =n /*UPDATE(state.check, put - _out, _out);*/n state.flags ? crc32(state.check, output, _out, put - _out) : adler32(state.check, output, _out, put - _out);n }nn _out = left; // NB: crc32 stored as signed 32-bit int, zswap32 returns signed toonn if ((state.flags ? hold : zswap32(hold)) !== state.check) {n strm.msg = 'incorrect data check';n state.mode = BAD;n break;n } //=== INITBITS();nnn hold = 0;n bits = 0; //===//n //Tracev((stderr, "inflate: check matches trailer\n"));n }nn state.mode = LENGTH;nn /* falls through */nn case LENGTH:n if (state.wrap && state.flags) {n //=== NEEDBITS(32);n while (bits < 32) {n if (have === 0) {n break inf_leave;n }nn have–;n hold += input << bits;n bits += 8;n } //===//nnn if (hold !== (state.total & 0xffffffff)) {n strm.msg = 'incorrect length check';n state.mode = BAD;n break;n } //=== INITBITS();nnn hold = 0;n bits = 0; //===//n //Tracev((stderr, "inflate: length matches trailer\n"));n }nn state.mode = DONE;nn /* falls through */nn case DONE:n ret = Z_STREAM_END;n break inf_leave;nn case BAD:n ret = Z_DATA_ERROR;n break inf_leave;nn case MEM:n return Z_MEM_ERROR;nn case SYNC:n /* falls through */nn default:n return Z_STREAM_ERROR;n }n } // inf_leave <- here is real place for "goto inf_leave", emulated via "break inf_leave"nn /*n Return from inflate(), updating the total counts and the check value.n If there was no progress during the inflate() call, return a buffern error. Call updatewindow() to create and/or update the window state.n Note: a memory error from inflate() is non-recoverable.n */n //— RESTORE() —nnn strm.next_out = put;n strm.avail_out = left;n strm.next_in = next;n strm.avail_in = have;n state.hold = hold;n state.bits = bits; //—nn if (state.wsize || _out !== strm.avail_out && state.mode < BAD && (state.mode < CHECK || flush !== Z_FINISH)) {n if (updatewindow(strm, strm.output, strm.next_out, _out - strm.avail_out)) {n state.mode = MEM;n return Z_MEM_ERROR;n }n }nn _in -= strm.avail_in;n _out -= strm.avail_out;n strm.total_in += _in;n strm.total_out += _out;n state.total += _out;nn if (state.wrap && _out) {n strm.adler = state.check =n /*UPDATE(state.check, strm.next_out - _out, _out);*/n state.flags ? crc32(state.check, output, _out, strm.next_out - _out) : adler32(state.check, output, _out, strm.next_out - _out);n }nn strm.data_type = state.bits + (state.last ? 64 : 0) + (state.mode === TYPE ? 128 : 0) + (state.mode === LEN_ || state.mode === COPY_ ? 256 : 0);nn if ((_in === 0 && _out === 0 || flush === Z_FINISH) && ret === Z_OK) {n ret = Z_BUF_ERROR;n }nn return ret;n}nnfunction inflateEnd(strm) {n if (!strm || !strm.staten /*|| strm->zfree == (free_func)0*/n ) {n return Z_STREAM_ERROR;n }nn var state = strm.state;nn if (state.window) {n state.window = null;n }nn strm.state = null;n return Z_OK;n}nnfunction inflateGetHeader(strm, head) {n var state;n /* check state */nn if (!strm || !strm.state) {n return Z_STREAM_ERROR;n }nn state = strm.state;nn if ((state.wrap & 2) === 0) {n return Z_STREAM_ERROR;n }n /* save header structure */nnn state.head = head;n head.done = false;n return Z_OK;n}nnfunction inflateSetDictionary(strm, dictionary) {n var dictLength = dictionary.length;n var state;n var dictid;n var ret;n /* check state */nn if (!strmn /* == Z_NULL */n || !strm.staten /* == Z_NULL */n ) {n return Z_STREAM_ERROR;n }nn state = strm.state;nn if (state.wrap !== 0 && state.mode !== DICT) {n return Z_STREAM_ERROR;n }n /* check for correct dictionary identifier */nnn if (state.mode === DICT) {n dictid = 1;n /* adler32(0, null, 0)*/nn /* dictid = adler32(dictid, dictionary, dictLength); */nn dictid = adler32(dictid, dictionary, dictLength, 0);nn if (dictid !== state.check) {n return Z_DATA_ERROR;n }n }n /* copy dictionary to window using updatewindow(), which will amend then existing dictionary if appropriate */nnn ret = updatewindow(strm, dictionary, dictLength, dictLength);nn if (ret) {n state.mode = MEM;n return Z_MEM_ERROR;n }nn state.havedict = 1; // Tracev((stderr, "inflate: dictionary set\n"));nn return Z_OK;n}nnexports.inflateReset = inflateReset;nexports.inflateReset2 = inflateReset2;nexports.inflateResetKeep = inflateResetKeep;nexports.inflateInit = inflateInit;nexports.inflateInit2 = inflateInit2;nexports.inflate = inflate;nexports.inflateEnd = inflateEnd;nexports.inflateGetHeader = inflateGetHeader;nexports.inflateSetDictionary = inflateSetDictionary;nexports.inflateInfo = 'pako inflate (from Nodeca project)';n/* Not implementednexports.inflateCopy = inflateCopy;nexports.inflateGetDictionary = inflateGetDictionary;nexports.inflateMark = inflateMark;nexports.inflatePrime = inflatePrime;nexports.inflateSync = inflateSync;nexports.inflateSyncPoint = inflateSyncPoint;nexports.inflateUndermine = inflateUndermine;n*/”,“map”:null,“metadata”:{},“sourceType”:“module”}