inflate_stream.dev.min.js
135 KB
/** @license zlib.js 2012 - imaya [ https://github.com/imaya/zlib.js ] The MIT License */(function() {'use strict';var k=void 0,l=!0,aa=this;function s(a,d){var b=a.split("."),c=aa;!(b[0]in c)&&c.execScript&&c.execScript("var "+b[0]);for(var e;b.length&&(e=b.shift());)!b.length&&d!==k?c[e]=d:c=c[e]?c[e]:c[e]={}};var x="undefined"!==typeof Uint8Array&&"undefined"!==typeof Uint16Array&&"undefined"!==typeof Uint32Array&&"undefined"!==typeof DataView;function y(a){var d=a.length,b=0,c=Number.POSITIVE_INFINITY,e,g,f,p,h,q,m,n,r,B;for(n=0;n<d;++n)a[n]>b&&(b=a[n]),a[n]<c&&(c=a[n]);e=1<<b;g=new (x?Uint32Array:Array)(e);f=1;p=0;for(h=2;f<=b;){for(n=0;n<d;++n)if(a[n]===f){q=0;m=p;for(r=0;r<f;++r)q=q<<1|m&1,m>>=1;B=f<<16|n;for(r=q;r<e;r+=h)g[r]=B;++p}++f;p<<=1;h<<=1}return[g,b,c]};function z(a,d,b){this.u=[];this.i=b?b:32768;this.v=0;this.a=d===k?0:d;this.d=this.e=0;this.input=x?new Uint8Array(a):a;this.b=new (x?Uint8Array:Array)(this.i);this.c=0;this.t=this.l=!1;this.f=0;this.status=A}var A=0;
z.prototype.j=function(a,d){var b=!1;a!==k&&(this.input=a);d!==k&&(this.a=d);for(;!b;)switch(this.status){case A:case 1:var c;var e=k;this.status=1;H(this);if(0>(e=I(this,3)))J(this),c=-1;else{e&1&&(this.l=l);e>>>=1;switch(e){case 0:this.h=0;break;case 1:this.h=1;break;case 2:this.h=2;break;default:throw Error("unknown BTYPE: "+e);}this.status=2;c=k}0>c&&(b=l);break;case 2:case 3:switch(this.h){case 0:var g;var f=k,p=k,h=this.input,q=this.a;this.status=3;if(q+4>=h.length)g=-1;else{f=h[q++]|h[q++]<<
8;p=h[q++]|h[q++]<<8;if(f===~p)throw Error("invalid uncompressed block header: length verify");this.d=this.e=0;this.a=q;this.m=f;this.status=4;g=k}0>g&&(b=l);break;case 1:this.status=3;this.k=ba;this.n=ca;this.status=4;break;case 2:var m;a:{var n=k,r=k,B=k,V=new (x?Uint8Array:Array)(K.length),W=k;this.status=3;H(this);n=I(this,5)+257;r=I(this,5)+1;B=I(this,4)+4;if(0>n||0>r||0>B)J(this),m=-1;else{try{for(var w=k,D=k,E=0,C=k,u=k,t=k,X=k,t=0;t<B;++t){if(0>(w=I(this,3)))throw Error("not enough input");
V[K[t]]=w}W=y(V);u=new (x?Uint8Array:Array)(n+r);t=0;for(X=n+r;t<X;){D=O(this,W);if(0>D)throw Error("not enough input");switch(D){case 16:if(0>(w=I(this,2)))throw Error("not enough input");for(C=3+w;C--;)u[t++]=E;break;case 17:if(0>(w=I(this,3)))throw Error("not enough input");for(C=3+w;C--;)u[t++]=0;E=0;break;case 18:if(0>(w=I(this,7)))throw Error("not enough input");for(C=11+w;C--;)u[t++]=0;E=0;break;default:E=u[t++]=D}}new (x?Uint8Array:Array)(n);new (x?Uint8Array:Array)(r);this.k=x?y(u.subarray(0,
n)):y(u.slice(0,n));this.n=x?y(u.subarray(n)):y(u.slice(n))}catch(pa){J(this);m=-1;break a}this.status=4;m=0}}0>m&&(b=l)}break;case 4:case 5:switch(this.h){case 0:var L;a:{var Y=this.input,F=this.a,M=this.b,G=this.c,N=this.m;for(this.status=5;N--;){G===M.length&&(M=P(this,{o:2}));if(F>=Y.length){this.a=F;this.c=G;this.m=N+1;L=-1;break a}M[G++]=Y[F++]}0>N&&(this.status=6);this.a=F;this.c=G;L=0}0>L&&(b=l);break;case 1:case 2:0>da(this)&&(b=l)}break;case 6:this.l?b=l:this.status=A}var Z,v=this.c,$;Z=
this.t?x?new Uint8Array(this.b.subarray(this.f,v)):this.b.slice(this.f,v):x?this.b.subarray(this.f,v):this.b.slice(this.f,v);this.f=v;v>32768+this.i&&(this.c=this.f=32768,x?($=this.b,this.b=new Uint8Array(this.i+32768),this.b.set($.subarray(v-32768,v))):this.b=this.b.slice(v-32768));return Z};
var ea=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],K=x?new Uint16Array(ea):ea,fa=[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,258,258],ga=x?new Uint16Array(fa):fa,ha=[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,0,0],ia=x?new Uint8Array(ha):ha,ja=[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],ka=x?new Uint16Array(ja):ja,la=[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],ma=x?new Uint8Array(la):la,Q=new (x?Uint8Array:Array)(288),R,na;R=0;for(na=Q.length;R<na;++R)Q[R]=143>=R?8:255>=R?9:279>=R?7:8;var ba=y(Q),S=new (x?Uint8Array:Array)(30),T,oa;T=0;for(oa=S.length;T<oa;++T)S[T]=5;var ca=y(S);function I(a,d){for(var b=a.e,c=a.d,e=a.input,g=a.a,f;c<d;){if(e.length<=g)return-1;f=e[g++];b|=f<<c;c+=8}f=b&(1<<d)-1;a.e=b>>>d;a.d=c-d;a.a=g;return f}
function O(a,d){for(var b=a.e,c=a.d,e=a.input,g=a.a,f=d[0],p=d[1],h,q,m;c<p;){if(e.length<=g)return-1;h=e[g++];b|=h<<c;c+=8}q=f[b&(1<<p)-1];m=q>>>16;if(m>c)throw Error("invalid code length: "+m);a.e=b>>m;a.d=c-m;a.a=g;return q&65535}function H(a){a.s=a.a;a.r=a.d;a.q=a.e}function J(a){a.a=a.s;a.d=a.r;a.e=a.q}
function da(a){var d=a.b,b=a.c,c,e,g,f,p=a.k,h=a.n,q=d.length,m;for(a.status=5;;){H(a);c=O(a,p);if(0>c)return a.c=b,J(a),-1;if(256===c)break;if(256>c)b===q&&(d=P(a),q=d.length),d[b++]=c;else{e=c-257;f=ga[e];if(0<ia[e]){m=I(a,ia[e]);if(0>m)return a.c=b,J(a),-1;f+=m}c=O(a,h);if(0>c)return a.c=b,J(a),-1;g=ka[c];if(0<ma[c]){m=I(a,ma[c]);if(0>m)return a.c=b,J(a),-1;g+=m}b+f>=q&&(d=P(a),q=d.length);for(;f--;)d[b]=d[b++-g];if(a.a===a.input.length)return a.c=b,-1}}for(;8<=a.d;)a.d-=8,a.a--;a.c=b;a.status=
6}function P(a,d){var b,c=a.input.length/a.a+1|0,e,g,f,p=a.input,h=a.b;d&&("number"===typeof d.o&&(c=d.o),"number"===typeof d.p&&(c+=d.p));2>c?(e=(p.length-a.a)/a.k[2],f=258*(e/2)|0,g=f<h.length?h.length+f:h.length<<1):g=h.length*c;x?(b=new Uint8Array(g),b.set(h)):b=h;a.b=b;return a.b};function U(a){this.input=a===k?new (x?Uint8Array:Array):a;this.a=0;this.g=new z(this.input,this.a);this.b=this.g.b}
U.prototype.j=function(a){var d;if(a!==k)if(x){var b=new Uint8Array(this.input.length+a.length);b.set(this.input,0);b.set(a,this.input.length);this.input=b}else this.input=this.input.concat(a);var c;if(c=this.method===k){var e;var g=this.a,f=this.input,p=f[g++],h=f[g++];if(p===k||h===k)e=-1;else{switch(p&15){case 8:this.method=8;break;default:throw Error("unsupported compression method");}if(0!==((p<<8)+h)%31)throw Error("invalid fcheck flag:"+((p<<8)+h)%31);if(h&32)throw Error("fdict flag is not supported");
this.a=g;e=k}c=0>e}if(c)return new (x?Uint8Array:Array);d=this.g.j(this.input,this.a);0!==this.g.a&&(this.input=x?this.input.subarray(this.g.a):this.input.slice(this.g.a),this.a=0);return d};s("Zlib.InflateStream",U);s("Zlib.InflateStream.prototype.decompress",U.prototype.j);}).call(this);
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYmluL2luZmxhdGVfc3RyZWFtLm1pbi5qcyIsImxpbmVDb3VudCI6MTMsIm1hcHBpbmdzIjoiQSxtSEF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ZWN0LnNjcmlwdC5cbiAgICogQHJldHVybiB7P3N0cmluZ30gVXJsIGNvcnJlc3BvbmRpbmcgdG8gdGhlIHJ1bGUsIG9yIG51bGwuXG4gICAqIEBwcml2YXRlXG4gICAqL1xuICBnb29nLmdldFBhdGhGcm9tRGVwc18gPSBmdW5jdGlvbihydWxlKSB7XG4gICAgaWYgKHJ1bGUgaW4gZ29vZy5kZXBlbmRlbmNpZXNfLm5hbWVUb1BhdGgpIHtcbiAgICAgIHJldHVybiBnb29nLmRlcGVuZGVuY2llc18ubmFtZVRvUGF0aFtydWxlXTtcbiAgICB9IGVsc2Uge1xuICAgICAgcmV0dXJuIG51bGw7XG4gICAgfVxuICB9O1xuXG4gIGdvb2cuZmluZEJhc2VQYXRoXygpO1xuXG4gIC8vIEFsbG93IHByb2plY3RzIHRvIG1hbmFnZSB0aGUgZGVwcyBmaWxlcyB0aGVtc2VsdmVzLlxuICBpZiAoIWdvb2cuZ2xvYmFsLkNMT1NVUkVfTk9fREVQUykge1xuICAgIGdvb2cuaW1wb3J0U2NyaXB0Xyhnb29nLmJhc2VQYXRoICsgJ2RlcHMuanMnKTtcbiAgfVxufVxuXG5cblxuLy89PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT1cbi8vIExhbmd1YWdlIEVuaGFuY2VtZW50c1xuLy89PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT1cblxuXG4vKipcbiAqIFRoaXMgaXMgYSBcImZpeGVkXCIgdmVyc2lvbiBvZiB0aGUgdHlwZW9mIG9wZXJhdG9yLiAgSXQgZGlmZmVycyBmcm9tIHRoZSB0eXBlb2ZcbiAqIG9wZXJhdG9yIGluIHN1Y2ggYSB3YXkgdGhhdCBudWxsIHJldHVybnMgJ251bGwnIGFuZCBhcnJheXMgcmV0dXJuICdhcnJheScuXG4g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roc1RhYmxlKTtcbiAgICAgIGlmIChjb2RlIDwgMCkge1xuICAgICAgICB0aHJvdyBuZXcgRXJyb3IoJ25vdCBlbm91Z2ggaW5wdXQnKTtcbiAgICAgIH1cbiAgICAgIHN3aXRjaCAoY29kZSkge1xuICAgICAgICBjYXNlIDE2OlxuICAgICAgICAgIGlmICgoYml0cyA9IHRoaXMucmVhZEJpdHMoMikpIDwgMCkge1xuICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKCdub3QgZW5vdWdoIGlucHV0Jyk7XG4gICAgICAgICAgfVxuICAgICAgICAgIHJlcGVhdCA9IDMgKyBiaXRzO1xuICAgICAgICAgIHdoaWxlIChyZXBlYXQtLSkgeyBsZW5ndGhUYWJsZVtpKytdID0gcHJldjsgfVxuICAgICAgICAgIGJyZWFrO1xuICAgICAgICBjYXNlIDE3OlxuICAgICAgICAgIGlmICgoYml0cyA9IHRoaXMucmVhZEJpdHMoMykpIDwgMCkge1xuICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKCdub3QgZW5vdWdoIGlucHV0Jyk7XG4gICAgICAgICAgfVxuICAgICAgICAgIHJlcGVhdCA9IDMgKyBiaXRzO1xuICAgICAgICAgIHdoaWxlIChyZXBlYXQtLSkgeyBsZW5ndGhUYWJsZVtpKytdID0gMDsgfVxuICAgICAgICAgIHByZXYgPSAwO1xuICAgICAgICAgIGJyZWFrO1xuICAgICAgICBjYXNlIDE4OlxuICAgICAgICAgIGlmICgoYml0cyA9IHRoaXMucmVhZEJpdHMoNykpIDwgMCkge1xuICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKCdub3QgZW5vdWdoIGlucHV0Jyk7XG4gICAgICAgICAgfVxuICAgICAgICAgIHJlcGVhdCA9IDExICsgYml0cztcbiAgICAgICAgICB3aGlsZSAocmVwZWF0LS0pIHsgbGVuZ3RoVGFibGVbaSsrXSA9IDA7IH1cbiAgICAgICAgICBwcmV2ID0gMDtcbiAgICAgICAgICBicmVhaztcbiAgICAgICA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