inflate.js 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /**
  2. * Cesium - https://github.com/AnalyticalGraphicsInc/cesium
  3. *
  4. * Copyright 2011-2016 Cesium Contributors
  5. *
  6. * Licensed under the Apache License, Version 2.0 (the "License");
  7. * you may not use this file except in compliance with the License.
  8. * You may obtain a copy of the License at
  9. *
  10. * http://www.apache.org/licenses/LICENSE-2.0
  11. *
  12. * Unless required by applicable law or agreed to in writing, software
  13. * distributed under the License is distributed on an "AS IS" BASIS,
  14. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. * See the License for the specific language governing permissions and
  16. * limitations under the License.
  17. *
  18. * Columbus View (Pat. Pend.)
  19. *
  20. * Portions licensed separately.
  21. * See https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md for full licensing details.
  22. */
  23. /*
  24. Copyright (c) 2013 Gildas Lormeau. All rights reserved.
  25. Redistribution and use in source and binary forms, with or without
  26. modification, are permitted provided that the following conditions are met:
  27. 1. Redistributions of source code must retain the above copyright notice,
  28. this list of conditions and the following disclaimer.
  29. 2. Redistributions in binary form must reproduce the above copyright
  30. notice, this list of conditions and the following disclaimer in
  31. the documentation and/or other materials provided with the distribution.
  32. 3. The names of the authors may not be used to endorse or promote products
  33. derived from this software without specific prior written permission.
  34. THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
  35. INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  36. FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT,
  37. INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
  38. INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  39. LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
  40. OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
  41. LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  42. NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
  43. EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  44. */
  45. !function(i){function e(){function i(i,e,t,n,s,o,f,u,w,v,h){var k,m,y,g,p,A,I,E,U,z,D,M,L,P,j;z=0,p=t;do a[i[e+z]]++,z++,p--;while(0!==p);if(a[0]==t)return f[0]=-1,u[0]=0,d;for(E=u[0],A=1;A<=S&&0===a[A];A++);for(I=A,E<A&&(E=A),p=S;0!==p&&0===a[p];p--);for(y=p,E>p&&(E=p),u[0]=E,P=1<<A;A<p;A++,P<<=1)if((P-=a[A])<0)return b;if((P-=a[p])<0)return b;for(a[p]+=P,l[1]=A=0,z=1,L=2;0!==--p;)l[L]=A+=a[z],L++,z++;p=0,z=0;do 0!==(A=i[e+z])&&(h[l[A]++]=p),z++;while(++p<t);for(t=l[y],l[0]=p=0,z=0,g=-1,M=-E,_[0]=0,D=0,j=0;I<=y;I++)for(k=a[I];0!==k--;){for(;I>M+E;){if(g++,M+=E,j=y-M,j=j>E?E:j,(m=1<<(A=I-M))>k+1&&(m-=k+1,L=I,A<j))for(;++A<j&&!((m<<=1)<=a[++L]);)m-=a[L];if(j=1<<A,v[0]+j>c)return b;_[g]=D=v[0],v[0]+=j,0!==g?(l[g]=p,r[0]=A,r[1]=E,A=p>>>M-E,r[2]=D-_[g-1]-A,w.set(r,3*(_[g-1]+A))):f[0]=D}for(r[1]=I-M,z>=t?r[0]=192:h[z]<n?(r[0]=h[z]<256?0:96,r[2]=h[z++]):(r[0]=o[h[z]-n]+16+64,r[2]=s[h[z++]-n]),m=1<<I-M,A=p>>>M;A<j;A+=m)w.set(r,3*(D+A));for(A=1<<I-1;0!==(p&A);A>>>=1)p^=A;for(p^=A,U=(1<<M)-1;(p&U)!=l[g];)g--,M-=E,U=(1<<M)-1}return 0!==P&&1!=y?x:d}function e(i){var e;for(t||(t=[],n=[],a=new Int32Array(S+1),r=[],_=new Int32Array(S),l=new Int32Array(S+1)),n.length<i&&(n=[]),e=0;e<i;e++)n[e]=0;for(e=0;e<S+1;e++)a[e]=0;for(e=0;e<3;e++)r[e]=0;_.set(a.subarray(0,S),0),l.set(a.subarray(0,S+1),0)}var t,n,a,r,_,l,s=this;s.inflate_trees_bits=function(a,r,_,l,d){var s;return e(19),t[0]=0,s=i(a,0,19,19,null,null,_,r,l,t,n),s==b?d.msg="oversubscribed dynamic bit lengths tree":s!=x&&0!==r[0]||(d.msg="incomplete dynamic bit lengths tree",s=b),s},s.inflate_trees_dynamic=function(a,r,_,l,s,o,f,w,c){var v;return e(288),t[0]=0,v=i(_,0,a,257,p,A,o,l,w,t,n),v!=d||0===l[0]?(v==b?c.msg="oversubscribed literal/length tree":v!=u&&(c.msg="incomplete literal/length tree",v=b),v):(e(288),v=i(_,a,r,0,I,E,f,s,w,t,n),v!=d||0===s[0]&&a>257?(v==b?c.msg="oversubscribed distance tree":v==x?(c.msg="incomplete distance tree",v=b):v!=u&&(c.msg="empty distance tree with lengths",v=b),v):d)}}function t(){function i(i,e,t,n,a,r,_,l){var o,f,u,x,c,v,h,k,m,y,g,p,A,I,E,S;h=l.next_in_index,k=l.avail_in,c=_.bitb,v=_.bitk,m=_.write,y=m<_.read?_.read-m-1:_.end-m,g=w[i],p=w[e];do{for(;v<20;)k--,c|=(255&l.read_byte(h++))<<v,v+=8;if(o=c&g,f=t,u=n,S=3*(u+o),0!==(x=f[S]))for(;;){if(c>>=f[S+1],v-=f[S+1],0!==(16&x)){for(x&=15,A=f[S+2]+(c&w[x]),c>>=x,v-=x;v<15;)k--,c|=(255&l.read_byte(h++))<<v,v+=8;for(o=c&p,f=a,u=r,S=3*(u+o),x=f[S];;){if(c>>=f[S+1],v-=f[S+1],0!==(16&x)){for(x&=15;v<x;)k--,c|=(255&l.read_byte(h++))<<v,v+=8;if(I=f[S+2]+(c&w[x]),c>>=x,v-=x,y-=A,m>=I)E=m-I,m-E>0&&2>m-E?(_.window[m++]=_.window[E++],_.window[m++]=_.window[E++],A-=2):(_.window.set(_.window.subarray(E,E+2),m),m+=2,E+=2,A-=2);else{E=m-I;do E+=_.end;while(E<0);if(x=_.end-E,A>x){if(A-=x,m-E>0&&x>m-E){do _.window[m++]=_.window[E++];while(0!==--x)}else _.window.set(_.window.subarray(E,E+x),m),m+=x,E+=x,x=0;E=0}}if(m-E>0&&A>m-E){do _.window[m++]=_.window[E++];while(0!==--A)}else _.window.set(_.window.subarray(E,E+A),m),m+=A,E+=A,A=0;break}if(0!==(64&x))return l.msg="invalid distance code",A=l.avail_in-k,A=v>>3<A?v>>3:A,k+=A,h-=A,v-=A<<3,_.bitb=c,_.bitk=v,l.avail_in=k,l.total_in+=h-l.next_in_index,l.next_in_index=h,_.write=m,b;o+=f[S+2],o+=c&w[x],S=3*(u+o),x=f[S]}break}if(0!==(64&x))return 0!==(32&x)?(A=l.avail_in-k,A=v>>3<A?v>>3:A,k+=A,h-=A,v-=A<<3,_.bitb=c,_.bitk=v,l.avail_in=k,l.total_in+=h-l.next_in_index,l.next_in_index=h,_.write=m,s):(l.msg="invalid literal/length code",A=l.avail_in-k,A=v>>3<A?v>>3:A,k+=A,h-=A,v-=A<<3,_.bitb=c,_.bitk=v,l.avail_in=k,l.total_in+=h-l.next_in_index,l.next_in_index=h,_.write=m,b);if(o+=f[S+2],o+=c&w[x],S=3*(u+o),0===(x=f[S])){c>>=f[S+1],v-=f[S+1],_.window[m++]=f[S+2],y--;break}}else c>>=f[S+1],v-=f[S+1],_.window[m++]=f[S+2],y--}while(y>=258&&k>=10);return A=l.avail_in-k,A=v>>3<A?v>>3:A,k+=A,h-=A,v-=A<<3,_.bitb=c,_.bitk=v,l.avail_in=k,l.total_in+=h-l.next_in_index,l.next_in_index=h,_.write=m,d}var e,t,n,a,r=this,_=0,l=0,o=0,u=0,x=0,c=0,v=0,h=0,k=0,m=0;r.init=function(i,r,_,l,d,s){e=U,v=i,h=r,n=_,k=l,a=d,m=s,t=null},r.proc=function(r,y,g){var p,A,I,E,S,F,G,H=0,J=0,K=0;for(K=y.next_in_index,E=y.avail_in,H=r.bitb,J=r.bitk,S=r.write,F=S<r.read?r.read-S-1:r.end-S;;)switch(e){case U:if(F>=258&&E>=10&&(r.bitb=H,r.bitk=J,y.avail_in=E,y.total_in+=K-y.next_in_index,y.next_in_index=K,r.write=S,g=i(v,h,n,k,a,m,r,y),K=y.next_in_index,E=y.avail_in,H=r.bitb,J=r.bitk,S=r.write,F=S<r.read?r.read-S-1:r.end-S,g!=d)){e=g==s?q:C;break}o=v,t=n,l=k,e=z;case z:for(p=o;J<p;){if(0===E)return r.bitb=H,r.bitk=J,y.avail_in=E,y.total_in+=K-y.next_in_index,y.next_in_index=K,r.write=S,r.inflate_flush(y,g);g=d,E--,H|=(255&y.read_byte(K++))<<J,J+=8}if(A=3*(l+(H&w[p])),H>>>=t[A+1],J-=t[A+1],I=t[A],0===I){u=t[A+2],e=j;break}if(0!==(16&I)){x=15&I,_=t[A+2],e=D;break}if(0===(64&I)){o=I,l=A/3+t[A+2];break}if(0!==(32&I)){e=q;break}return e=C,y.msg="invalid literal/length code",g=b,r.bitb=H,r.bitk=J,y.avail_in=E,y.total_in+=K-y.next_in_index,y.next_in_index=K,r.write=S,r.inflate_flush(y,g);case D:for(p=x;J<p;){if(0===E)return r.bitb=H,r.bitk=J,y.avail_in=E,y.total_in+=K-y.next_in_index,y.next_in_index=K,r.write=S,r.inflate_flush(y,g);g=d,E--,H|=(255&y.read_byte(K++))<<J,J+=8}_+=H&w[p],H>>=p,J-=p,o=h,t=a,l=m,e=M;case M:for(p=o;J<p;){if(0===E)return r.bitb=H,r.bitk=J,y.avail_in=E,y.total_in+=K-y.next_in_index,y.next_in_index=K,r.write=S,r.inflate_flush(y,g);g=d,E--,H|=(255&y.read_byte(K++))<<J,J+=8}if(A=3*(l+(H&w[p])),H>>=t[A+1],J-=t[A+1],I=t[A],0!==(16&I)){x=15&I,c=t[A+2],e=L;break}if(0===(64&I)){o=I,l=A/3+t[A+2];break}return e=C,y.msg="invalid distance code",g=b,r.bitb=H,r.bitk=J,y.avail_in=E,y.total_in+=K-y.next_in_index,y.next_in_index=K,r.write=S,r.inflate_flush(y,g);case L:for(p=x;J<p;){if(0===E)return r.bitb=H,r.bitk=J,y.avail_in=E,y.total_in+=K-y.next_in_index,y.next_in_index=K,r.write=S,r.inflate_flush(y,g);g=d,E--,H|=(255&y.read_byte(K++))<<J,J+=8}c+=H&w[p],H>>=p,J-=p,e=P;case P:for(G=S-c;G<0;)G+=r.end;for(;0!==_;){if(0===F&&(S==r.end&&0!==r.read&&(S=0,F=S<r.read?r.read-S-1:r.end-S),0===F&&(r.write=S,g=r.inflate_flush(y,g),S=r.write,F=S<r.read?r.read-S-1:r.end-S,S==r.end&&0!==r.read&&(S=0,F=S<r.read?r.read-S-1:r.end-S),0===F)))return r.bitb=H,r.bitk=J,y.avail_in=E,y.total_in+=K-y.next_in_index,y.next_in_index=K,r.write=S,r.inflate_flush(y,g);r.window[S++]=r.window[G++],F--,G==r.end&&(G=0),_--}e=U;break;case j:if(0===F&&(S==r.end&&0!==r.read&&(S=0,F=S<r.read?r.read-S-1:r.end-S),0===F&&(r.write=S,g=r.inflate_flush(y,g),S=r.write,F=S<r.read?r.read-S-1:r.end-S,S==r.end&&0!==r.read&&(S=0,F=S<r.read?r.read-S-1:r.end-S),0===F)))return r.bitb=H,r.bitk=J,y.avail_in=E,y.total_in+=K-y.next_in_index,y.next_in_index=K,r.write=S,r.inflate_flush(y,g);g=d,r.window[S++]=u,F--,e=U;break;case q:if(J>7&&(J-=8,E++,K--),r.write=S,g=r.inflate_flush(y,g),S=r.write,F=S<r.read?r.read-S-1:r.end-S,r.read!=r.write)return r.bitb=H,r.bitk=J,y.avail_in=E,y.total_in+=K-y.next_in_index,y.next_in_index=K,r.write=S,r.inflate_flush(y,g);e=B;case B:return g=s,r.bitb=H,r.bitk=J,y.avail_in=E,y.total_in+=K-y.next_in_index,y.next_in_index=K,r.write=S,r.inflate_flush(y,g);case C:return g=b,r.bitb=H,r.bitk=J,y.avail_in=E,y.total_in+=K-y.next_in_index,y.next_in_index=K,r.write=S,r.inflate_flush(y,g);default:return g=f,r.bitb=H,r.bitk=J,y.avail_in=E,y.total_in+=K-y.next_in_index,y.next_in_index=K,r.write=S,r.inflate_flush(y,g)}},r.free=function(){}}function n(i,n){var a,r=this,_=G,l=0,o=0,u=0,v=[0],h=[0],k=new t,m=0,y=new Int32Array(3*c),g=0,p=new e;r.bitk=0,r.bitb=0,r.window=new Uint8Array(n),r.end=n,r.read=0,r.write=0,r.reset=function(i,e){e&&(e[0]=g),_==Q&&k.free(i),_=G,r.bitk=0,r.bitb=0,r.read=r.write=0},r.reset(i,null),r.inflate_flush=function(i,e){var t,n,a;return n=i.next_out_index,a=r.read,t=(a<=r.write?r.write:r.end)-a,t>i.avail_out&&(t=i.avail_out),0!==t&&e==x&&(e=d),i.avail_out-=t,i.total_out+=t,i.next_out.set(r.window.subarray(a,a+t),n),n+=t,a+=t,a==r.end&&(a=0,r.write==r.end&&(r.write=0),t=r.write-a,t>i.avail_out&&(t=i.avail_out),0!==t&&e==x&&(e=d),i.avail_out-=t,i.total_out+=t,i.next_out.set(r.window.subarray(a,a+t),n),n+=t,a+=t),i.next_out_index=n,r.read=a,e},r.proc=function(i,t){var n,x,c,g,A,I,E,S;for(g=i.next_in_index,A=i.avail_in,x=r.bitb,c=r.bitk,I=r.write,E=I<r.read?r.read-I-1:r.end-I;;)switch(_){case G:for(;c<3;){if(0===A)return r.bitb=x,r.bitk=c,i.avail_in=A,i.total_in+=g-i.next_in_index,i.next_in_index=g,r.write=I,r.inflate_flush(i,t);t=d,A--,x|=(255&i.read_byte(g++))<<c,c+=8}switch(n=7&x,m=1&n,n>>>1){case 0:x>>>=3,c-=3,n=7&c,x>>>=n,c-=n,_=H;break;case 1:var U=[],z=[],D=[[]],M=[[]];e.inflate_trees_fixed(U,z,D,M),k.init(U[0],z[0],D[0],0,M[0],0),x>>>=3,c-=3,_=Q;break;case 2:x>>>=3,c-=3,_=K;break;case 3:return x>>>=3,c-=3,_=V,i.msg="invalid block type",t=b,r.bitb=x,r.bitk=c,i.avail_in=A,i.total_in+=g-i.next_in_index,i.next_in_index=g,r.write=I,r.inflate_flush(i,t)}break;case H:for(;c<32;){if(0===A)return r.bitb=x,r.bitk=c,i.avail_in=A,i.total_in+=g-i.next_in_index,i.next_in_index=g,r.write=I,r.inflate_flush(i,t);t=d,A--,x|=(255&i.read_byte(g++))<<c,c+=8}if((~x>>>16&65535)!=(65535&x))return _=V,i.msg="invalid stored block lengths",t=b,r.bitb=x,r.bitk=c,i.avail_in=A,i.total_in+=g-i.next_in_index,i.next_in_index=g,r.write=I,r.inflate_flush(i,t);l=65535&x,x=c=0,_=0!==l?J:0!==m?R:G;break;case J:if(0===A)return r.bitb=x,r.bitk=c,i.avail_in=A,i.total_in+=g-i.next_in_index,i.next_in_index=g,r.write=I,r.inflate_flush(i,t);if(0===E&&(I==r.end&&0!==r.read&&(I=0,E=I<r.read?r.read-I-1:r.end-I),0===E&&(r.write=I,t=r.inflate_flush(i,t),I=r.write,E=I<r.read?r.read-I-1:r.end-I,I==r.end&&0!==r.read&&(I=0,E=I<r.read?r.read-I-1:r.end-I),0===E)))return r.bitb=x,r.bitk=c,i.avail_in=A,i.total_in+=g-i.next_in_index,i.next_in_index=g,r.write=I,r.inflate_flush(i,t);if(t=d,n=l,n>A&&(n=A),n>E&&(n=E),r.window.set(i.read_buf(g,n),I),g+=n,A-=n,I+=n,E-=n,0!==(l-=n))break;_=0!==m?R:G;break;case K:for(;c<14;){if(0===A)return r.bitb=x,r.bitk=c,i.avail_in=A,i.total_in+=g-i.next_in_index,i.next_in_index=g,r.write=I,r.inflate_flush(i,t);t=d,A--,x|=(255&i.read_byte(g++))<<c,c+=8}if(o=n=16383&x,(31&n)>29||(n>>5&31)>29)return _=V,i.msg="too many length or distance symbols",t=b,r.bitb=x,r.bitk=c,i.avail_in=A,i.total_in+=g-i.next_in_index,i.next_in_index=g,r.write=I,r.inflate_flush(i,t);if(n=258+(31&n)+(n>>5&31),!a||a.length<n)a=[];else for(S=0;S<n;S++)a[S]=0;x>>>=14,c-=14,u=0,_=N;case N:for(;u<4+(o>>>10);){for(;c<3;){if(0===A)return r.bitb=x,r.bitk=c,i.avail_in=A,i.total_in+=g-i.next_in_index,i.next_in_index=g,r.write=I,r.inflate_flush(i,t);t=d,A--,x|=(255&i.read_byte(g++))<<c,c+=8}a[F[u++]]=7&x,x>>>=3,c-=3}for(;u<19;)a[F[u++]]=0;if(v[0]=7,n=p.inflate_trees_bits(a,v,h,y,i),n!=d)return t=n,t==b&&(a=null,_=V),r.bitb=x,r.bitk=c,i.avail_in=A,i.total_in+=g-i.next_in_index,i.next_in_index=g,r.write=I,r.inflate_flush(i,t);u=0,_=O;case O:for(;;){if(n=o,!(u<258+(31&n)+(n>>5&31)))break;var L,P;for(n=v[0];c<n;){if(0===A)return r.bitb=x,r.bitk=c,i.avail_in=A,i.total_in+=g-i.next_in_index,i.next_in_index=g,r.write=I,r.inflate_flush(i,t);t=d,A--,x|=(255&i.read_byte(g++))<<c,c+=8}if(n=y[3*(h[0]+(x&w[n]))+1],P=y[3*(h[0]+(x&w[n]))+2],P<16)x>>>=n,c-=n,a[u++]=P;else{for(S=18==P?7:P-14,L=18==P?11:3;c<n+S;){if(0===A)return r.bitb=x,r.bitk=c,i.avail_in=A,i.total_in+=g-i.next_in_index,i.next_in_index=g,r.write=I,r.inflate_flush(i,t);t=d,A--,x|=(255&i.read_byte(g++))<<c,c+=8}if(x>>>=n,c-=n,L+=x&w[S],x>>>=S,c-=S,S=u,n=o,S+L>258+(31&n)+(n>>5&31)||16==P&&S<1)return a=null,_=V,i.msg="invalid bit length repeat",t=b,r.bitb=x,r.bitk=c,i.avail_in=A,i.total_in+=g-i.next_in_index,i.next_in_index=g,r.write=I,r.inflate_flush(i,t);P=16==P?a[S-1]:0;do a[S++]=P;while(0!==--L);u=S}}h[0]=-1;var j=[],q=[],B=[],C=[];if(j[0]=9,q[0]=6,n=o,n=p.inflate_trees_dynamic(257+(31&n),1+(n>>5&31),a,j,q,B,C,y,i),n!=d)return n==b&&(a=null,_=V),t=n,r.bitb=x,r.bitk=c,i.avail_in=A,i.total_in+=g-i.next_in_index,i.next_in_index=g,r.write=I,r.inflate_flush(i,t);k.init(j[0],q[0],y,B[0],y,C[0]),_=Q;case Q:if(r.bitb=x,r.bitk=c,i.avail_in=A,i.total_in+=g-i.next_in_index,i.next_in_index=g,r.write=I,(t=k.proc(r,i,t))!=s)return r.inflate_flush(i,t);if(t=d,k.free(i),g=i.next_in_index,A=i.avail_in,x=r.bitb,c=r.bitk,I=r.write,E=I<r.read?r.read-I-1:r.end-I,0===m){_=G;break}_=R;case R:if(r.write=I,t=r.inflate_flush(i,t),I=r.write,E=I<r.read?r.read-I-1:r.end-I,r.read!=r.write)return r.bitb=x,r.bitk=c,i.avail_in=A,i.total_in+=g-i.next_in_index,i.next_in_index=g,r.write=I,r.inflate_flush(i,t);_=T;case T:return t=s,r.bitb=x,r.bitk=c,i.avail_in=A,i.total_in+=g-i.next_in_index,i.next_in_index=g,r.write=I,r.inflate_flush(i,t);case V:return t=b,r.bitb=x,r.bitk=c,i.avail_in=A,i.total_in+=g-i.next_in_index,i.next_in_index=g,r.write=I,r.inflate_flush(i,t);default:return t=f,r.bitb=x,r.bitk=c,i.avail_in=A,i.total_in+=g-i.next_in_index,i.next_in_index=g,r.write=I,r.inflate_flush(i,t)}},r.free=function(i){r.reset(i,null),r.window=null,y=null},r.set_dictionary=function(i,e,t){r.window.set(i.subarray(e,e+t),0),r.read=r.write=t},r.sync_point=function(){return _==H?1:0}}function a(){function i(i){return i&&i.istate?(i.total_in=i.total_out=0,i.msg=null,i.istate.mode=ai,i.istate.blocks.reset(i,null),d):f}var e=this;e.mode=0,e.method=0,e.was=[0],e.need=0,e.marker=0,e.wbits=0,e.inflateEnd=function(i){return e.blocks&&e.blocks.free(i),e.blocks=null,d},e.inflateInit=function(t,a){return t.msg=null,e.blocks=null,a<8||a>15?(e.inflateEnd(t),f):(e.wbits=a,t.istate.blocks=new n(t,1<<a),i(t),d)},e.inflate=function(i,e){var t,n;if(!i||!i.istate||!i.next_in)return f;for(e=e==h?x:d,t=x;;)switch(i.istate.mode){case Y:if(0===i.avail_in)return t;if(t=e,i.avail_in--,i.total_in++,(15&(i.istate.method=i.read_byte(i.next_in_index++)))!=X){i.istate.mode=_i,i.msg="unknown compression method",i.istate.marker=5;break}if((i.istate.method>>4)+8>i.istate.wbits){i.istate.mode=_i,i.msg="invalid window size",i.istate.marker=5;break}i.istate.mode=Z;case Z:if(0===i.avail_in)return t;if(t=e,i.avail_in--,i.total_in++,n=255&i.read_byte(i.next_in_index++),((i.istate.method<<8)+n)%31!==0){i.istate.mode=_i,i.msg="incorrect header check",i.istate.marker=5;break}if(0===(n&W)){i.istate.mode=ai;break}i.istate.mode=$;case $:if(0===i.avail_in)return t;t=e,i.avail_in--,i.total_in++,i.istate.need=(255&i.read_byte(i.next_in_index++))<<24&4278190080,i.istate.mode=ii;case ii:if(0===i.avail_in)return t;t=e,i.avail_in--,i.total_in++,i.istate.need+=(255&i.read_byte(i.next_in_index++))<<16&16711680,i.istate.mode=ei;case ei:if(0===i.avail_in)return t;t=e,i.avail_in--,i.total_in++,i.istate.need+=(255&i.read_byte(i.next_in_index++))<<8&65280,i.istate.mode=ti;case ti:return 0===i.avail_in?t:(t=e,i.avail_in--,i.total_in++,i.istate.need+=255&i.read_byte(i.next_in_index++),i.istate.mode=ni,o);case ni:return i.istate.mode=_i,i.msg="need dictionary",i.istate.marker=0,f;case ai:if(t=i.istate.blocks.proc(i,t),t==b){i.istate.mode=_i,i.istate.marker=0;break}if(t==d&&(t=e),t!=s)return t;t=e,i.istate.blocks.reset(i,i.istate.was),i.istate.mode=ri;case ri:return s;case _i:return b;default:return f}},e.inflateSetDictionary=function(i,e,t){var n=0,a=t;return i&&i.istate&&i.istate.mode==ni?(a>=1<<i.istate.wbits&&(a=(1<<i.istate.wbits)-1,n=t-a),i.istate.blocks.set_dictionary(e,n,a),i.istate.mode=ai,d):f},e.inflateSync=function(e){var t,n,a,r,_;if(!e||!e.istate)return f;if(e.istate.mode!=_i&&(e.istate.mode=_i,e.istate.marker=0),0===(t=e.avail_in))return x;for(n=e.next_in_index,a=e.istate.marker;0!==t&&a<4;)e.read_byte(n)==li[a]?a++:a=0!==e.read_byte(n)?0:4-a,n++,t--;return e.total_in+=n-e.next_in_index,e.next_in_index=n,e.avail_in=t,e.istate.marker=a,4!=a?b:(r=e.total_in,_=e.total_out,i(e),e.total_in=r,e.total_out=_,e.istate.mode=ai,d)},e.inflateSyncPoint=function(i){return i&&i.istate&&i.istate.blocks?i.istate.blocks.sync_point():f}}function r(){}function _(){var i=this,e=new r,t=512,n=v,a=new Uint8Array(t),_=!1;e.inflateInit(),e.next_out=a,i.append=function(i,r){var l,o,f=[],b=0,u=0,w=0;if(0!==i.length){e.next_in_index=0,e.next_in=i,e.avail_in=i.length;do{if(e.next_out_index=0,e.avail_out=t,0!==e.avail_in||_||(e.next_in_index=0,_=!0),l=e.inflate(n),_&&l==x)return-1;if(l!=d&&l!=s)throw"inflating: "+e.msg;if((_||l==s)&&e.avail_in==i.length)return-1;e.next_out_index&&(e.next_out_index==t?f.push(new Uint8Array(a)):f.push(new Uint8Array(a.subarray(0,e.next_out_index)))),w+=e.next_out_index,r&&e.next_in_index>0&&e.next_in_index!=b&&(r(e.next_in_index),b=e.next_in_index)}while(e.avail_in>0||0===e.avail_out);return o=new Uint8Array(w),f.forEach(function(i){o.set(i,u),u+=i.length}),o}},i.flush=function(){e.inflateEnd()}}var l=15,d=0,s=1,o=2,f=-2,b=-3,u=-4,x=-5,w=[0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535],c=1440,v=0,h=4,k=9,m=5,y=[96,7,256,0,8,80,0,8,16,84,8,115,82,7,31,0,8,112,0,8,48,0,9,192,80,7,10,0,8,96,0,8,32,0,9,160,0,8,0,0,8,128,0,8,64,0,9,224,80,7,6,0,8,88,0,8,24,0,9,144,83,7,59,0,8,120,0,8,56,0,9,208,81,7,17,0,8,104,0,8,40,0,9,176,0,8,8,0,8,136,0,8,72,0,9,240,80,7,4,0,8,84,0,8,20,85,8,227,83,7,43,0,8,116,0,8,52,0,9,200,81,7,13,0,8,100,0,8,36,0,9,168,0,8,4,0,8,132,0,8,68,0,9,232,80,7,8,0,8,92,0,8,28,0,9,152,84,7,83,0,8,124,0,8,60,0,9,216,82,7,23,0,8,108,0,8,44,0,9,184,0,8,12,0,8,140,0,8,76,0,9,248,80,7,3,0,8,82,0,8,18,85,8,163,83,7,35,0,8,114,0,8,50,0,9,196,81,7,11,0,8,98,0,8,34,0,9,164,0,8,2,0,8,130,0,8,66,0,9,228,80,7,7,0,8,90,0,8,26,0,9,148,84,7,67,0,8,122,0,8,58,0,9,212,82,7,19,0,8,106,0,8,42,0,9,180,0,8,10,0,8,138,0,8,74,0,9,244,80,7,5,0,8,86,0,8,22,192,8,0,83,7,51,0,8,118,0,8,54,0,9,204,81,7,15,0,8,102,0,8,38,0,9,172,0,8,6,0,8,134,0,8,70,0,9,236,80,7,9,0,8,94,0,8,30,0,9,156,84,7,99,0,8,126,0,8,62,0,9,220,82,7,27,0,8,110,0,8,46,0,9,188,0,8,14,0,8,142,0,8,78,0,9,252,96,7,256,0,8,81,0,8,17,85,8,131,82,7,31,0,8,113,0,8,49,0,9,194,80,7,10,0,8,97,0,8,33,0,9,162,0,8,1,0,8,129,0,8,65,0,9,226,80,7,6,0,8,89,0,8,25,0,9,146,83,7,59,0,8,121,0,8,57,0,9,210,81,7,17,0,8,105,0,8,41,0,9,178,0,8,9,0,8,137,0,8,73,0,9,242,80,7,4,0,8,85,0,8,21,80,8,258,83,7,43,0,8,117,0,8,53,0,9,202,81,7,13,0,8,101,0,8,37,0,9,170,0,8,5,0,8,133,0,8,69,0,9,234,80,7,8,0,8,93,0,8,29,0,9,154,84,7,83,0,8,125,0,8,61,0,9,218,82,7,23,0,8,109,0,8,45,0,9,186,0,8,13,0,8,141,0,8,77,0,9,250,80,7,3,0,8,83,0,8,19,85,8,195,83,7,35,0,8,115,0,8,51,0,9,198,81,7,11,0,8,99,0,8,35,0,9,166,0,8,3,0,8,131,0,8,67,0,9,230,80,7,7,0,8,91,0,8,27,0,9,150,84,7,67,0,8,123,0,8,59,0,9,214,82,7,19,0,8,107,0,8,43,0,9,182,0,8,11,0,8,139,0,8,75,0,9,246,80,7,5,0,8,87,0,8,23,192,8,0,83,7,51,0,8,119,0,8,55,0,9,206,81,7,15,0,8,103,0,8,39,0,9,174,0,8,7,0,8,135,0,8,71,0,9,238,80,7,9,0,8,95,0,8,31,0,9,158,84,7,99,0,8,127,0,8,63,0,9,222,82,7,27,0,8,111,0,8,47,0,9,190,0,8,15,0,8,143,0,8,79,0,9,254,96,7,256,0,8,80,0,8,16,84,8,115,82,7,31,0,8,112,0,8,48,0,9,193,80,7,10,0,8,96,0,8,32,0,9,161,0,8,0,0,8,128,0,8,64,0,9,225,80,7,6,0,8,88,0,8,24,0,9,145,83,7,59,0,8,120,0,8,56,0,9,209,81,7,17,0,8,104,0,8,40,0,9,177,0,8,8,0,8,136,0,8,72,0,9,241,80,7,4,0,8,84,0,8,20,85,8,227,83,7,43,0,8,116,0,8,52,0,9,201,81,7,13,0,8,100,0,8,36,0,9,169,0,8,4,0,8,132,0,8,68,0,9,233,80,7,8,0,8,92,0,8,28,0,9,153,84,7,83,0,8,124,0,8,60,0,9,217,82,7,23,0,8,108,0,8,44,0,9,185,0,8,12,0,8,140,0,8,76,0,9,249,80,7,3,0,8,82,0,8,18,85,8,163,83,7,35,0,8,114,0,8,50,0,9,197,81,7,11,0,8,98,0,8,34,0,9,165,0,8,2,0,8,130,0,8,66,0,9,229,80,7,7,0,8,90,0,8,26,0,9,149,84,7,67,0,8,122,0,8,58,0,9,213,82,7,19,0,8,106,0,8,42,0,9,181,0,8,10,0,8,138,0,8,74,0,9,245,80,7,5,0,8,86,0,8,22,192,8,0,83,7,51,0,8,118,0,8,54,0,9,205,81,7,15,0,8,102,0,8,38,0,9,173,0,8,6,0,8,134,0,8,70,0,9,237,80,7,9,0,8,94,0,8,30,0,9,157,84,7,99,0,8,126,0,8,62,0,9,221,82,7,27,0,8,110,0,8,46,0,9,189,0,8,14,0,8,142,0,8,78,0,9,253,96,7,256,0,8,81,0,8,17,85,8,131,82,7,31,0,8,113,0,8,49,0,9,195,80,7,10,0,8,97,0,8,33,0,9,163,0,8,1,0,8,129,0,8,65,0,9,227,80,7,6,0,8,89,0,8,25,0,9,147,83,7,59,0,8,121,0,8,57,0,9,211,81,7,17,0,8,105,0,8,41,0,9,179,0,8,9,0,8,137,0,8,73,0,9,243,80,7,4,0,8,85,0,8,21,80,8,258,83,7,43,0,8,117,0,8,53,0,9,203,81,7,13,0,8,101,0,8,37,0,9,171,0,8,5,0,8,133,0,8,69,0,9,235,80,7,8,0,8,93,0,8,29,0,9,155,84,7,83,0,8,125,0,8,61,0,9,219,82,7,23,0,8,109,0,8,45,0,9,187,0,8,13,0,8,141,0,8,77,0,9,251,80,7,3,0,8,83,0,8,19,85,8,195,83,7,35,0,8,115,0,8,51,0,9,199,81,7,11,0,8,99,0,8,35,0,9,167,0,8,3,0,8,131,0,8,67,0,9,231,80,7,7,0,8,91,0,8,27,0,9,151,84,7,67,0,8,123,0,8,59,0,9,215,82,7,19,0,8,107,0,8,43,0,9,183,0,8,11,0,8,139,0,8,75,0,9,247,80,7,5,0,8,87,0,8,23,192,8,0,83,7,51,0,8,119,0,8,55,0,9,207,81,7,15,0,8,103,0,8,39,0,9,175,0,8,7,0,8,135,0,8,71,0,9,239,80,7,9,0,8,95,0,8,31,0,9,159,84,7,99,0,8,127,0,8,63,0,9,223,82,7,27,0,8,111,0,8,47,0,9,191,0,8,15,0,8,143,0,8,79,0,9,255],g=[80,5,1,87,5,257,83,5,17,91,5,4097,81,5,5,89,5,1025,85,5,65,93,5,16385,80,5,3,88,5,513,84,5,33,92,5,8193,82,5,9,90,5,2049,86,5,129,192,5,24577,80,5,2,87,5,385,83,5,25,91,5,6145,81,5,7,89,5,1537,85,5,97,93,5,24577,80,5,4,88,5,769,84,5,49,92,5,12289,82,5,13,90,5,3073,86,5,193,192,5,24577],p=[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],A=[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,112,112],I=[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],E=[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],S=15;e.inflate_trees_fixed=function(i,e,t,n){return i[0]=k,e[0]=m,t[0]=y,n[0]=g,d};var U=0,z=1,D=2,M=3,L=4,P=5,j=6,q=7,B=8,C=9,F=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],G=0,H=1,J=2,K=3,N=4,O=5,Q=6,R=7,T=8,V=9,W=32,X=8,Y=0,Z=1,$=2,ii=3,ei=4,ti=5,ni=6,ai=7,ri=12,_i=13,li=[0,0,255,255];r.prototype={inflateInit:function(i){var e=this;return e.istate=new a,i||(i=l),e.istate.inflateInit(e,i)},inflate:function(i){var e=this;return e.istate?e.istate.inflate(e,i):f},inflateEnd:function(){var i=this;if(!i.istate)return f;var e=i.istate.inflateEnd(i);return i.istate=null,e},inflateSync:function(){var i=this;return i.istate?i.istate.inflateSync(i):f},inflateSetDictionary:function(i,e){var t=this;return t.istate?t.istate.inflateSetDictionary(t,i,e):f},read_byte:function(i){var e=this;return e.next_in.subarray(i,i+1)[0]},read_buf:function(i,e){var t=this;return t.next_in.subarray(i,i+e)}};var di;i.zip?i.zip.Inflater=_:(di=new _,i.addEventListener("message",function(e){var t=e.data;t.append&&i.postMessage({onappend:!0,data:di.append(t.data,function(e){i.postMessage({progress:!0,current:e})})}),t.flush&&(di.flush(),i.postMessage({onflush:!0}))},!1))}(this);