@gyng/remote-zip 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -20
- package/lib/cjs/index.js +1 -6
- package/lib/cjs/index.js.map +4 -4
- package/lib/esm/index.mjs +1 -6
- package/lib/esm/index.mjs.map +4 -4
- package/lib/types/crypto.d.mts +39 -0
- package/lib/types/zip.d.mts +12 -6
- package/lib/types/zip.d.ts +11 -5
- package/package.json +47 -55
package/lib/esm/index.mjs
CHANGED
|
@@ -1,7 +1,2 @@
|
|
|
1
|
-
function ge(e){let n=e.length;for(;--n>=0;)e[n]=0}var pi=0,kn=1,xi=2,mi=3,yi=258,vt=29,Ce=256,ve=Ce+1+vt,_e=30,St=19,vn=2*ve+1,te=15,nt=16,Ei=7,Dt=256,Sn=16,Dn=17,Rn=18,bt=new Uint8Array([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]),Ye=new Uint8Array([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]),Ai=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),Un=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),ki=512,q=new Array((ve+2)*2);ge(q);var Ee=new Array(_e*2);ge(Ee);var Se=new Array(ki);ge(Se);var De=new Array(yi-mi+1);ge(De);var Rt=new Array(vt);ge(Rt);var We=new Array(_e);ge(We);function it(e,n,t,i,r){this.static_tree=e,this.extra_bits=n,this.extra_base=t,this.elems=i,this.max_length=r,this.has_stree=e&&e.length}var On,In,zn;function rt(e,n){this.dyn_tree=e,this.max_code=0,this.stat_desc=n}var Cn=e=>e<256?Se[e]:Se[256+(e>>>7)],Re=(e,n)=>{e.pending_buf[e.pending++]=n&255,e.pending_buf[e.pending++]=n>>>8&255},N=(e,n,t)=>{e.bi_valid>nt-t?(e.bi_buf|=n<<e.bi_valid&65535,Re(e,e.bi_buf),e.bi_buf=n>>nt-e.bi_valid,e.bi_valid+=t-nt):(e.bi_buf|=n<<e.bi_valid&65535,e.bi_valid+=t)},P=(e,n,t)=>{N(e,t[n*2],t[n*2+1])},Tn=(e,n)=>{let t=0;do t|=e&1,e>>>=1,t<<=1;while(--n>0);return t>>>1},vi=e=>{e.bi_valid===16?(Re(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=e.bi_buf&255,e.bi_buf>>=8,e.bi_valid-=8)},Si=(e,n)=>{let t=n.dyn_tree,i=n.max_code,r=n.stat_desc.static_tree,a=n.stat_desc.has_stree,l=n.stat_desc.extra_bits,s=n.stat_desc.extra_base,c=n.stat_desc.max_length,o,f,g,_,d,u,E=0;for(_=0;_<=te;_++)e.bl_count[_]=0;for(t[e.heap[e.heap_max]*2+1]=0,o=e.heap_max+1;o<vn;o++)f=e.heap[o],_=t[t[f*2+1]*2+1]+1,_>c&&(_=c,E++),t[f*2+1]=_,!(f>i)&&(e.bl_count[_]++,d=0,f>=s&&(d=l[f-s]),u=t[f*2],e.opt_len+=u*(_+d),a&&(e.static_len+=u*(r[f*2+1]+d)));if(E!==0){do{for(_=c-1;e.bl_count[_]===0;)_--;e.bl_count[_]--,e.bl_count[_+1]+=2,e.bl_count[c]--,E-=2}while(E>0);for(_=c;_!==0;_--)for(f=e.bl_count[_];f!==0;)g=e.heap[--o],!(g>i)&&(t[g*2+1]!==_&&(e.opt_len+=(_-t[g*2+1])*t[g*2],t[g*2+1]=_),f--)}},Nn=(e,n,t)=>{let i=new Array(te+1),r=0,a,l;for(a=1;a<=te;a++)r=r+t[a-1]<<1,i[a]=r;for(l=0;l<=n;l++){let s=e[l*2+1];s!==0&&(e[l*2]=Tn(i[s]++,s))}},Di=()=>{let e,n,t,i,r,a=new Array(te+1);for(t=0,i=0;i<vt-1;i++)for(Rt[i]=t,e=0;e<1<<bt[i];e++)De[t++]=i;for(De[t-1]=i,r=0,i=0;i<16;i++)for(We[i]=r,e=0;e<1<<Ye[i];e++)Se[r++]=i;for(r>>=7;i<_e;i++)for(We[i]=r<<7,e=0;e<1<<Ye[i]-7;e++)Se[256+r++]=i;for(n=0;n<=te;n++)a[n]=0;for(e=0;e<=143;)q[e*2+1]=8,e++,a[8]++;for(;e<=255;)q[e*2+1]=9,e++,a[9]++;for(;e<=279;)q[e*2+1]=7,e++,a[7]++;for(;e<=287;)q[e*2+1]=8,e++,a[8]++;for(Nn(q,ve+1,a),e=0;e<_e;e++)Ee[e*2+1]=5,Ee[e*2]=Tn(e,5);On=new it(q,bt,Ce+1,ve,te),In=new it(Ee,Ye,0,_e,te),zn=new it(new Array(0),Ai,0,St,Ei)},Ln=e=>{let n;for(n=0;n<ve;n++)e.dyn_ltree[n*2]=0;for(n=0;n<_e;n++)e.dyn_dtree[n*2]=0;for(n=0;n<St;n++)e.bl_tree[n*2]=0;e.dyn_ltree[Dt*2]=1,e.opt_len=e.static_len=0,e.sym_next=e.matches=0},Zn=e=>{e.bi_valid>8?Re(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0},Ft=(e,n,t,i)=>{let r=n*2,a=t*2;return e[r]<e[a]||e[r]===e[a]&&i[n]<=i[t]},at=(e,n,t)=>{let i=e.heap[t],r=t<<1;for(;r<=e.heap_len&&(r<e.heap_len&&Ft(n,e.heap[r+1],e.heap[r],e.depth)&&r++,!Ft(n,i,e.heap[r],e.depth));)e.heap[t]=e.heap[r],t=r,r<<=1;e.heap[t]=i},Ht=(e,n,t)=>{let i,r,a=0,l,s;if(e.sym_next!==0)do i=e.pending_buf[e.sym_buf+a++]&255,i+=(e.pending_buf[e.sym_buf+a++]&255)<<8,r=e.pending_buf[e.sym_buf+a++],i===0?P(e,r,n):(l=De[r],P(e,l+Ce+1,n),s=bt[l],s!==0&&(r-=Rt[l],N(e,r,s)),i--,l=Cn(i),P(e,l,t),s=Ye[l],s!==0&&(i-=We[l],N(e,i,s)));while(a<e.sym_next);P(e,Dt,n)},wt=(e,n)=>{let t=n.dyn_tree,i=n.stat_desc.static_tree,r=n.stat_desc.has_stree,a=n.stat_desc.elems,l,s,c=-1,o;for(e.heap_len=0,e.heap_max=vn,l=0;l<a;l++)t[l*2]!==0?(e.heap[++e.heap_len]=c=l,e.depth[l]=0):t[l*2+1]=0;for(;e.heap_len<2;)o=e.heap[++e.heap_len]=c<2?++c:0,t[o*2]=1,e.depth[o]=0,e.opt_len--,r&&(e.static_len-=i[o*2+1]);for(n.max_code=c,l=e.heap_len>>1;l>=1;l--)at(e,t,l);o=a;do l=e.heap[1],e.heap[1]=e.heap[e.heap_len--],at(e,t,1),s=e.heap[1],e.heap[--e.heap_max]=l,e.heap[--e.heap_max]=s,t[o*2]=t[l*2]+t[s*2],e.depth[o]=(e.depth[l]>=e.depth[s]?e.depth[l]:e.depth[s])+1,t[l*2+1]=t[s*2+1]=o,e.heap[1]=o++,at(e,t,1);while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],Si(e,n),Nn(t,c,e.bl_count)},Pt=(e,n,t)=>{let i,r=-1,a,l=n[1],s=0,c=7,o=4;for(l===0&&(c=138,o=3),n[(t+1)*2+1]=65535,i=0;i<=t;i++)a=l,l=n[(i+1)*2+1],!(++s<c&&a===l)&&(s<o?e.bl_tree[a*2]+=s:a!==0?(a!==r&&e.bl_tree[a*2]++,e.bl_tree[Sn*2]++):s<=10?e.bl_tree[Dn*2]++:e.bl_tree[Rn*2]++,s=0,r=a,l===0?(c=138,o=3):a===l?(c=6,o=3):(c=7,o=4))},Bt=(e,n,t)=>{let i,r=-1,a,l=n[1],s=0,c=7,o=4;for(l===0&&(c=138,o=3),i=0;i<=t;i++)if(a=l,l=n[(i+1)*2+1],!(++s<c&&a===l)){if(s<o)do P(e,a,e.bl_tree);while(--s!==0);else a!==0?(a!==r&&(P(e,a,e.bl_tree),s--),P(e,Sn,e.bl_tree),N(e,s-3,2)):s<=10?(P(e,Dn,e.bl_tree),N(e,s-3,3)):(P(e,Rn,e.bl_tree),N(e,s-11,7));s=0,r=a,l===0?(c=138,o=3):a===l?(c=6,o=3):(c=7,o=4)}},Ri=e=>{let n;for(Pt(e,e.dyn_ltree,e.l_desc.max_code),Pt(e,e.dyn_dtree,e.d_desc.max_code),wt(e,e.bl_desc),n=St-1;n>=3&&e.bl_tree[Un[n]*2+1]===0;n--);return e.opt_len+=3*(n+1)+5+5+4,n},Ui=(e,n,t,i)=>{let r;for(N(e,n-257,5),N(e,t-1,5),N(e,i-4,4),r=0;r<i;r++)N(e,e.bl_tree[Un[r]*2+1],3);Bt(e,e.dyn_ltree,n-1),Bt(e,e.dyn_dtree,t-1)},Oi=e=>{let n=4093624447,t;for(t=0;t<=31;t++,n>>>=1)if(n&1&&e.dyn_ltree[t*2]!==0)return 0;if(e.dyn_ltree[18]!==0||e.dyn_ltree[20]!==0||e.dyn_ltree[26]!==0)return 1;for(t=32;t<Ce;t++)if(e.dyn_ltree[t*2]!==0)return 1;return 0},$t=!1,Ii=e=>{$t||(Di(),$t=!0),e.l_desc=new rt(e.dyn_ltree,On),e.d_desc=new rt(e.dyn_dtree,In),e.bl_desc=new rt(e.bl_tree,zn),e.bi_buf=0,e.bi_valid=0,Ln(e)},Mn=(e,n,t,i)=>{N(e,(pi<<1)+(i?1:0),3),Zn(e),Re(e,t),Re(e,~t),t&&e.pending_buf.set(e.window.subarray(n,n+t),e.pending),e.pending+=t},zi=e=>{N(e,kn<<1,3),P(e,Dt,q),vi(e)},Ci=(e,n,t,i)=>{let r,a,l=0;e.level>0?(e.strm.data_type===2&&(e.strm.data_type=Oi(e)),wt(e,e.l_desc),wt(e,e.d_desc),l=Ri(e),r=e.opt_len+3+7>>>3,a=e.static_len+3+7>>>3,a<=r&&(r=a)):r=a=t+5,t+4<=r&&n!==-1?Mn(e,n,t,i):e.strategy===4||a===r?(N(e,(kn<<1)+(i?1:0),3),Ht(e,q,Ee)):(N(e,(xi<<1)+(i?1:0),3),Ui(e,e.l_desc.max_code+1,e.d_desc.max_code+1,l+1),Ht(e,e.dyn_ltree,e.dyn_dtree)),Ln(e),i&&Zn(e)},Ti=(e,n,t)=>(e.pending_buf[e.sym_buf+e.sym_next++]=n,e.pending_buf[e.sym_buf+e.sym_next++]=n>>8,e.pending_buf[e.sym_buf+e.sym_next++]=t,n===0?e.dyn_ltree[t*2]++:(e.matches++,n--,e.dyn_ltree[(De[t]+Ce+1)*2]++,e.dyn_dtree[Cn(n)*2]++),e.sym_next===e.sym_end),Ni=Ii,Li=Mn,Zi=Ci,Mi=Ti,Fi=zi,Hi={_tr_init:Ni,_tr_stored_block:Li,_tr_flush_block:Zi,_tr_tally:Mi,_tr_align:Fi},Pi=(e,n,t,i)=>{let r=e&65535|0,a=e>>>16&65535|0,l=0;for(;t!==0;){l=t>2e3?2e3:t,t-=l;do r=r+n[i++]|0,a=a+r|0;while(--l);r%=65521,a%=65521}return r|a<<16|0},Ue=Pi,Bi=()=>{let e,n=[];for(var t=0;t<256;t++){e=t;for(var i=0;i<8;i++)e=e&1?3988292384^e>>>1:e>>>1;n[t]=e}return n},$i=new Uint32Array(Bi()),Ki=(e,n,t,i)=>{let r=$i,a=i+t;e^=-1;for(let l=i;l<a;l++)e=e>>>8^r[(e^n[l])&255];return e^-1},z=Ki,re={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},be={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8},{_tr_init:Gi,_tr_stored_block:pt,_tr_flush_block:qi,_tr_tally:j,_tr_align:Xi}=Hi,{Z_NO_FLUSH:J,Z_PARTIAL_FLUSH:Yi,Z_FULL_FLUSH:Wi,Z_FINISH:M,Z_BLOCK:Kt,Z_OK:C,Z_STREAM_END:Gt,Z_STREAM_ERROR:B,Z_DATA_ERROR:Vi,Z_BUF_ERROR:ot,Z_DEFAULT_COMPRESSION:ji,Z_FILTERED:Ji,Z_HUFFMAN_ONLY:$e,Z_RLE:Qi,Z_FIXED:er,Z_DEFAULT_STRATEGY:tr,Z_UNKNOWN:nr,Z_DEFLATED:Je}=be,ir=9,rr=15,ar=8,or=29,sr=256,xt=sr+1+or,lr=30,fr=19,cr=2*xt+1,dr=15,k=3,V=258,$=V+k+1,_r=32,he=42,Ut=57,mt=69,yt=73,Et=91,At=103,ne=113,me=666,T=1,we=2,ae=3,pe=4,hr=3,ie=(e,n)=>(e.msg=re[n],n),qt=e=>e*2-(e>4?9:0),W=e=>{let n=e.length;for(;--n>=0;)e[n]=0},ur=e=>{let n,t,i,r=e.w_size;n=e.hash_size,i=n;do t=e.head[--i],e.head[i]=t>=r?t-r:0;while(--n);n=r,i=n;do t=e.prev[--i],e.prev[i]=t>=r?t-r:0;while(--n)},gr=(e,n,t)=>(n<<e.hash_shift^t)&e.hash_mask,Q=gr,L=e=>{let n=e.state,t=n.pending;t>e.avail_out&&(t=e.avail_out),t!==0&&(e.output.set(n.pending_buf.subarray(n.pending_out,n.pending_out+t),e.next_out),e.next_out+=t,n.pending_out+=t,e.total_out+=t,e.avail_out-=t,n.pending-=t,n.pending===0&&(n.pending_out=0))},Z=(e,n)=>{qi(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,n),e.block_start=e.strstart,L(e.strm)},D=(e,n)=>{e.pending_buf[e.pending++]=n},xe=(e,n)=>{e.pending_buf[e.pending++]=n>>>8&255,e.pending_buf[e.pending++]=n&255},kt=(e,n,t,i)=>{let r=e.avail_in;return r>i&&(r=i),r===0?0:(e.avail_in-=r,n.set(e.input.subarray(e.next_in,e.next_in+r),t),e.state.wrap===1?e.adler=Ue(e.adler,n,r,t):e.state.wrap===2&&(e.adler=z(e.adler,n,r,t)),e.next_in+=r,e.total_in+=r,r)},Fn=(e,n)=>{let t=e.max_chain_length,i=e.strstart,r,a,l=e.prev_length,s=e.nice_match,c=e.strstart>e.w_size-$?e.strstart-(e.w_size-$):0,o=e.window,f=e.w_mask,g=e.prev,_=e.strstart+V,d=o[i+l-1],u=o[i+l];e.prev_length>=e.good_match&&(t>>=2),s>e.lookahead&&(s=e.lookahead);do if(r=n,!(o[r+l]!==u||o[r+l-1]!==d||o[r]!==o[i]||o[++r]!==o[i+1])){i+=2,r++;do;while(o[++i]===o[++r]&&o[++i]===o[++r]&&o[++i]===o[++r]&&o[++i]===o[++r]&&o[++i]===o[++r]&&o[++i]===o[++r]&&o[++i]===o[++r]&&o[++i]===o[++r]&&i<_);if(a=V-(_-i),i=_-V,a>l){if(e.match_start=n,l=a,a>=s)break;d=o[i+l-1],u=o[i+l]}}while((n=g[n&f])>c&&--t!==0);return l<=e.lookahead?l:e.lookahead},ue=e=>{let n=e.w_size,t,i,r;do{if(i=e.window_size-e.lookahead-e.strstart,e.strstart>=n+(n-$)&&(e.window.set(e.window.subarray(n,n+n-i),0),e.match_start-=n,e.strstart-=n,e.block_start-=n,e.insert>e.strstart&&(e.insert=e.strstart),ur(e),i+=n),e.strm.avail_in===0)break;if(t=kt(e.strm,e.window,e.strstart+e.lookahead,i),e.lookahead+=t,e.lookahead+e.insert>=k)for(r=e.strstart-e.insert,e.ins_h=e.window[r],e.ins_h=Q(e,e.ins_h,e.window[r+1]);e.insert&&(e.ins_h=Q(e,e.ins_h,e.window[r+k-1]),e.prev[r&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=r,r++,e.insert--,!(e.lookahead+e.insert<k)););}while(e.lookahead<$&&e.strm.avail_in!==0)},Hn=(e,n)=>{let t=e.pending_buf_size-5>e.w_size?e.w_size:e.pending_buf_size-5,i,r,a,l=0,s=e.strm.avail_in;do{if(i=65535,a=e.bi_valid+42>>3,e.strm.avail_out<a||(a=e.strm.avail_out-a,r=e.strstart-e.block_start,i>r+e.strm.avail_in&&(i=r+e.strm.avail_in),i>a&&(i=a),i<t&&(i===0&&n!==M||n===J||i!==r+e.strm.avail_in)))break;l=n===M&&i===r+e.strm.avail_in?1:0,pt(e,0,0,l),e.pending_buf[e.pending-4]=i,e.pending_buf[e.pending-3]=i>>8,e.pending_buf[e.pending-2]=~i,e.pending_buf[e.pending-1]=~i>>8,L(e.strm),r&&(r>i&&(r=i),e.strm.output.set(e.window.subarray(e.block_start,e.block_start+r),e.strm.next_out),e.strm.next_out+=r,e.strm.avail_out-=r,e.strm.total_out+=r,e.block_start+=r,i-=r),i&&(kt(e.strm,e.strm.output,e.strm.next_out,i),e.strm.next_out+=i,e.strm.avail_out-=i,e.strm.total_out+=i)}while(l===0);return s-=e.strm.avail_in,s&&(s>=e.w_size?(e.matches=2,e.window.set(e.strm.input.subarray(e.strm.next_in-e.w_size,e.strm.next_in),0),e.strstart=e.w_size,e.insert=e.strstart):(e.window_size-e.strstart<=s&&(e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,e.insert>e.strstart&&(e.insert=e.strstart)),e.window.set(e.strm.input.subarray(e.strm.next_in-s,e.strm.next_in),e.strstart),e.strstart+=s,e.insert+=s>e.w_size-e.insert?e.w_size-e.insert:s),e.block_start=e.strstart),e.high_water<e.strstart&&(e.high_water=e.strstart),l?pe:n!==J&&n!==M&&e.strm.avail_in===0&&e.strstart===e.block_start?we:(a=e.window_size-e.strstart,e.strm.avail_in>a&&e.block_start>=e.w_size&&(e.block_start-=e.w_size,e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,a+=e.w_size,e.insert>e.strstart&&(e.insert=e.strstart)),a>e.strm.avail_in&&(a=e.strm.avail_in),a&&(kt(e.strm,e.window,e.strstart,a),e.strstart+=a,e.insert+=a>e.w_size-e.insert?e.w_size-e.insert:a),e.high_water<e.strstart&&(e.high_water=e.strstart),a=e.bi_valid+42>>3,a=e.pending_buf_size-a>65535?65535:e.pending_buf_size-a,t=a>e.w_size?e.w_size:a,r=e.strstart-e.block_start,(r>=t||(r||n===M)&&n!==J&&e.strm.avail_in===0&&r<=a)&&(i=r>a?a:r,l=n===M&&e.strm.avail_in===0&&i===r?1:0,pt(e,e.block_start,i,l),e.block_start+=i,L(e.strm)),l?ae:T)},st=(e,n)=>{let t,i;for(;;){if(e.lookahead<$){if(ue(e),e.lookahead<$&&n===J)return T;if(e.lookahead===0)break}if(t=0,e.lookahead>=k&&(e.ins_h=Q(e,e.ins_h,e.window[e.strstart+k-1]),t=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),t!==0&&e.strstart-t<=e.w_size-$&&(e.match_length=Fn(e,t)),e.match_length>=k)if(i=j(e,e.strstart-e.match_start,e.match_length-k),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=k){e.match_length--;do e.strstart++,e.ins_h=Q(e,e.ins_h,e.window[e.strstart+k-1]),t=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart;while(--e.match_length!==0);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=Q(e,e.ins_h,e.window[e.strstart+1]);else i=j(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(i&&(Z(e,!1),e.strm.avail_out===0))return T}return e.insert=e.strstart<k-1?e.strstart:k-1,n===M?(Z(e,!0),e.strm.avail_out===0?ae:pe):e.sym_next&&(Z(e,!1),e.strm.avail_out===0)?T:we},ce=(e,n)=>{let t,i,r;for(;;){if(e.lookahead<$){if(ue(e),e.lookahead<$&&n===J)return T;if(e.lookahead===0)break}if(t=0,e.lookahead>=k&&(e.ins_h=Q(e,e.ins_h,e.window[e.strstart+k-1]),t=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=k-1,t!==0&&e.prev_length<e.max_lazy_match&&e.strstart-t<=e.w_size-$&&(e.match_length=Fn(e,t),e.match_length<=5&&(e.strategy===Ji||e.match_length===k&&e.strstart-e.match_start>4096)&&(e.match_length=k-1)),e.prev_length>=k&&e.match_length<=e.prev_length){r=e.strstart+e.lookahead-k,i=j(e,e.strstart-1-e.prev_match,e.prev_length-k),e.lookahead-=e.prev_length-1,e.prev_length-=2;do++e.strstart<=r&&(e.ins_h=Q(e,e.ins_h,e.window[e.strstart+k-1]),t=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart);while(--e.prev_length!==0);if(e.match_available=0,e.match_length=k-1,e.strstart++,i&&(Z(e,!1),e.strm.avail_out===0))return T}else if(e.match_available){if(i=j(e,0,e.window[e.strstart-1]),i&&Z(e,!1),e.strstart++,e.lookahead--,e.strm.avail_out===0)return T}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(i=j(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<k-1?e.strstart:k-1,n===M?(Z(e,!0),e.strm.avail_out===0?ae:pe):e.sym_next&&(Z(e,!1),e.strm.avail_out===0)?T:we},br=(e,n)=>{let t,i,r,a,l=e.window;for(;;){if(e.lookahead<=V){if(ue(e),e.lookahead<=V&&n===J)return T;if(e.lookahead===0)break}if(e.match_length=0,e.lookahead>=k&&e.strstart>0&&(r=e.strstart-1,i=l[r],i===l[++r]&&i===l[++r]&&i===l[++r])){a=e.strstart+V;do;while(i===l[++r]&&i===l[++r]&&i===l[++r]&&i===l[++r]&&i===l[++r]&&i===l[++r]&&i===l[++r]&&i===l[++r]&&r<a);e.match_length=V-(a-r),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=k?(t=j(e,1,e.match_length-k),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(t=j(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),t&&(Z(e,!1),e.strm.avail_out===0))return T}return e.insert=0,n===M?(Z(e,!0),e.strm.avail_out===0?ae:pe):e.sym_next&&(Z(e,!1),e.strm.avail_out===0)?T:we},wr=(e,n)=>{let t;for(;;){if(e.lookahead===0&&(ue(e),e.lookahead===0)){if(n===J)return T;break}if(e.match_length=0,t=j(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,t&&(Z(e,!1),e.strm.avail_out===0))return T}return e.insert=0,n===M?(Z(e,!0),e.strm.avail_out===0?ae:pe):e.sym_next&&(Z(e,!1),e.strm.avail_out===0)?T:we};function H(e,n,t,i,r){this.good_length=e,this.max_lazy=n,this.nice_length=t,this.max_chain=i,this.func=r}var ye=[new H(0,0,0,0,Hn),new H(4,4,8,4,st),new H(4,5,16,8,st),new H(4,6,32,32,st),new H(4,4,16,16,ce),new H(8,16,32,32,ce),new H(8,16,128,128,ce),new H(8,32,128,256,ce),new H(32,128,258,1024,ce),new H(32,258,258,4096,ce)],pr=e=>{e.window_size=2*e.w_size,W(e.head),e.max_lazy_match=ye[e.level].max_lazy,e.good_match=ye[e.level].good_length,e.nice_match=ye[e.level].nice_length,e.max_chain_length=ye[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=k-1,e.match_available=0,e.ins_h=0};function xr(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=Je,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(cr*2),this.dyn_dtree=new Uint16Array((2*lr+1)*2),this.bl_tree=new Uint16Array((2*fr+1)*2),W(this.dyn_ltree),W(this.dyn_dtree),W(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(dr+1),this.heap=new Uint16Array(2*xt+1),W(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*xt+1),W(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}var Te=e=>{if(!e)return 1;let n=e.state;return!n||n.strm!==e||n.status!==he&&n.status!==Ut&&n.status!==mt&&n.status!==yt&&n.status!==Et&&n.status!==At&&n.status!==ne&&n.status!==me?1:0},Pn=e=>{if(Te(e))return ie(e,B);e.total_in=e.total_out=0,e.data_type=nr;let n=e.state;return n.pending=0,n.pending_out=0,n.wrap<0&&(n.wrap=-n.wrap),n.status=n.wrap===2?Ut:n.wrap?he:ne,e.adler=n.wrap===2?0:1,n.last_flush=-2,Gi(n),C},Bn=e=>{let n=Pn(e);return n===C&&pr(e.state),n},mr=(e,n)=>Te(e)||e.state.wrap!==2?B:(e.state.gzhead=n,C),$n=(e,n,t,i,r,a)=>{if(!e)return B;let l=1;if(n===ji&&(n=6),i<0?(l=0,i=-i):i>15&&(l=2,i-=16),r<1||r>ir||t!==Je||i<8||i>15||n<0||n>9||a<0||a>er||i===8&&l!==1)return ie(e,B);i===8&&(i=9);let s=new xr;return e.state=s,s.strm=e,s.status=he,s.wrap=l,s.gzhead=null,s.w_bits=i,s.w_size=1<<s.w_bits,s.w_mask=s.w_size-1,s.hash_bits=r+7,s.hash_size=1<<s.hash_bits,s.hash_mask=s.hash_size-1,s.hash_shift=~~((s.hash_bits+k-1)/k),s.window=new Uint8Array(s.w_size*2),s.head=new Uint16Array(s.hash_size),s.prev=new Uint16Array(s.w_size),s.lit_bufsize=1<<r+6,s.pending_buf_size=s.lit_bufsize*4,s.pending_buf=new Uint8Array(s.pending_buf_size),s.sym_buf=s.lit_bufsize,s.sym_end=(s.lit_bufsize-1)*3,s.level=n,s.strategy=a,s.method=t,Bn(e)},yr=(e,n)=>$n(e,n,Je,rr,ar,tr),Er=(e,n)=>{if(Te(e)||n>Kt||n<0)return e?ie(e,B):B;let t=e.state;if(!e.output||e.avail_in!==0&&!e.input||t.status===me&&n!==M)return ie(e,e.avail_out===0?ot:B);let i=t.last_flush;if(t.last_flush=n,t.pending!==0){if(L(e),e.avail_out===0)return t.last_flush=-1,C}else if(e.avail_in===0&&qt(n)<=qt(i)&&n!==M)return ie(e,ot);if(t.status===me&&e.avail_in!==0)return ie(e,ot);if(t.status===he&&t.wrap===0&&(t.status=ne),t.status===he){let r=Je+(t.w_bits-8<<4)<<8,a=-1;if(t.strategy>=$e||t.level<2?a=0:t.level<6?a=1:t.level===6?a=2:a=3,r|=a<<6,t.strstart!==0&&(r|=_r),r+=31-r%31,xe(t,r),t.strstart!==0&&(xe(t,e.adler>>>16),xe(t,e.adler&65535)),e.adler=1,t.status=ne,L(e),t.pending!==0)return t.last_flush=-1,C}if(t.status===Ut){if(e.adler=0,D(t,31),D(t,139),D(t,8),t.gzhead)D(t,(t.gzhead.text?1:0)+(t.gzhead.hcrc?2:0)+(t.gzhead.extra?4:0)+(t.gzhead.name?8:0)+(t.gzhead.comment?16:0)),D(t,t.gzhead.time&255),D(t,t.gzhead.time>>8&255),D(t,t.gzhead.time>>16&255),D(t,t.gzhead.time>>24&255),D(t,t.level===9?2:t.strategy>=$e||t.level<2?4:0),D(t,t.gzhead.os&255),t.gzhead.extra&&t.gzhead.extra.length&&(D(t,t.gzhead.extra.length&255),D(t,t.gzhead.extra.length>>8&255)),t.gzhead.hcrc&&(e.adler=z(e.adler,t.pending_buf,t.pending,0)),t.gzindex=0,t.status=mt;else if(D(t,0),D(t,0),D(t,0),D(t,0),D(t,0),D(t,t.level===9?2:t.strategy>=$e||t.level<2?4:0),D(t,hr),t.status=ne,L(e),t.pending!==0)return t.last_flush=-1,C}if(t.status===mt){if(t.gzhead.extra){let r=t.pending,a=(t.gzhead.extra.length&65535)-t.gzindex;for(;t.pending+a>t.pending_buf_size;){let s=t.pending_buf_size-t.pending;if(t.pending_buf.set(t.gzhead.extra.subarray(t.gzindex,t.gzindex+s),t.pending),t.pending=t.pending_buf_size,t.gzhead.hcrc&&t.pending>r&&(e.adler=z(e.adler,t.pending_buf,t.pending-r,r)),t.gzindex+=s,L(e),t.pending!==0)return t.last_flush=-1,C;r=0,a-=s}let l=new Uint8Array(t.gzhead.extra);t.pending_buf.set(l.subarray(t.gzindex,t.gzindex+a),t.pending),t.pending+=a,t.gzhead.hcrc&&t.pending>r&&(e.adler=z(e.adler,t.pending_buf,t.pending-r,r)),t.gzindex=0}t.status=yt}if(t.status===yt){if(t.gzhead.name){let r=t.pending,a;do{if(t.pending===t.pending_buf_size){if(t.gzhead.hcrc&&t.pending>r&&(e.adler=z(e.adler,t.pending_buf,t.pending-r,r)),L(e),t.pending!==0)return t.last_flush=-1,C;r=0}t.gzindex<t.gzhead.name.length?a=t.gzhead.name.charCodeAt(t.gzindex++)&255:a=0,D(t,a)}while(a!==0);t.gzhead.hcrc&&t.pending>r&&(e.adler=z(e.adler,t.pending_buf,t.pending-r,r)),t.gzindex=0}t.status=Et}if(t.status===Et){if(t.gzhead.comment){let r=t.pending,a;do{if(t.pending===t.pending_buf_size){if(t.gzhead.hcrc&&t.pending>r&&(e.adler=z(e.adler,t.pending_buf,t.pending-r,r)),L(e),t.pending!==0)return t.last_flush=-1,C;r=0}t.gzindex<t.gzhead.comment.length?a=t.gzhead.comment.charCodeAt(t.gzindex++)&255:a=0,D(t,a)}while(a!==0);t.gzhead.hcrc&&t.pending>r&&(e.adler=z(e.adler,t.pending_buf,t.pending-r,r))}t.status=At}if(t.status===At){if(t.gzhead.hcrc){if(t.pending+2>t.pending_buf_size&&(L(e),t.pending!==0))return t.last_flush=-1,C;D(t,e.adler&255),D(t,e.adler>>8&255),e.adler=0}if(t.status=ne,L(e),t.pending!==0)return t.last_flush=-1,C}if(e.avail_in!==0||t.lookahead!==0||n!==J&&t.status!==me){let r=t.level===0?Hn(t,n):t.strategy===$e?wr(t,n):t.strategy===Qi?br(t,n):ye[t.level].func(t,n);if((r===ae||r===pe)&&(t.status=me),r===T||r===ae)return e.avail_out===0&&(t.last_flush=-1),C;if(r===we&&(n===Yi?Xi(t):n!==Kt&&(pt(t,0,0,!1),n===Wi&&(W(t.head),t.lookahead===0&&(t.strstart=0,t.block_start=0,t.insert=0))),L(e),e.avail_out===0))return t.last_flush=-1,C}return n!==M?C:t.wrap<=0?Gt:(t.wrap===2?(D(t,e.adler&255),D(t,e.adler>>8&255),D(t,e.adler>>16&255),D(t,e.adler>>24&255),D(t,e.total_in&255),D(t,e.total_in>>8&255),D(t,e.total_in>>16&255),D(t,e.total_in>>24&255)):(xe(t,e.adler>>>16),xe(t,e.adler&65535)),L(e),t.wrap>0&&(t.wrap=-t.wrap),t.pending!==0?C:Gt)},Ar=e=>{if(Te(e))return B;let n=e.state.status;return e.state=null,n===ne?ie(e,Vi):C},kr=(e,n)=>{let t=n.length;if(Te(e))return B;let i=e.state,r=i.wrap;if(r===2||r===1&&i.status!==he||i.lookahead)return B;if(r===1&&(e.adler=Ue(e.adler,n,t,0)),i.wrap=0,t>=i.w_size){r===0&&(W(i.head),i.strstart=0,i.block_start=0,i.insert=0);let c=new Uint8Array(i.w_size);c.set(n.subarray(t-i.w_size,t),0),n=c,t=i.w_size}let a=e.avail_in,l=e.next_in,s=e.input;for(e.avail_in=t,e.next_in=0,e.input=n,ue(i);i.lookahead>=k;){let c=i.strstart,o=i.lookahead-(k-1);do i.ins_h=Q(i,i.ins_h,i.window[c+k-1]),i.prev[c&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=c,c++;while(--o);i.strstart=c,i.lookahead=k-1,ue(i)}return i.strstart+=i.lookahead,i.block_start=i.strstart,i.insert=i.lookahead,i.lookahead=0,i.match_length=i.prev_length=k-1,i.match_available=0,e.next_in=l,e.input=s,e.avail_in=a,i.wrap=r,C},vr=yr,Sr=$n,Dr=Bn,Rr=Pn,Ur=mr,Or=Er,Ir=Ar,zr=kr,Cr="pako deflate (from Nodeca project)",Ae={deflateInit:vr,deflateInit2:Sr,deflateReset:Dr,deflateResetKeep:Rr,deflateSetHeader:Ur,deflate:Or,deflateEnd:Ir,deflateSetDictionary:zr,deflateInfo:Cr},Tr=(e,n)=>Object.prototype.hasOwnProperty.call(e,n),Nr=function(e){let n=Array.prototype.slice.call(arguments,1);for(;n.length;){let t=n.shift();if(t){if(typeof t!="object")throw new TypeError(t+"must be non-object");for(let i in t)Tr(t,i)&&(e[i]=t[i])}}return e},Lr=e=>{let n=0;for(let i=0,r=e.length;i<r;i++)n+=e[i].length;let t=new Uint8Array(n);for(let i=0,r=0,a=e.length;i<a;i++){let l=e[i];t.set(l,r),r+=l.length}return t},Qe={assign:Nr,flattenChunks:Lr},Kn=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{Kn=!1}var Oe=new Uint8Array(256);for(let e=0;e<256;e++)Oe[e]=e>=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;Oe[254]=Oe[254]=1;var Zr=e=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(e);let n,t,i,r,a,l=e.length,s=0;for(r=0;r<l;r++)t=e.charCodeAt(r),(t&64512)===55296&&r+1<l&&(i=e.charCodeAt(r+1),(i&64512)===56320&&(t=65536+(t-55296<<10)+(i-56320),r++)),s+=t<128?1:t<2048?2:t<65536?3:4;for(n=new Uint8Array(s),a=0,r=0;a<s;r++)t=e.charCodeAt(r),(t&64512)===55296&&r+1<l&&(i=e.charCodeAt(r+1),(i&64512)===56320&&(t=65536+(t-55296<<10)+(i-56320),r++)),t<128?n[a++]=t:t<2048?(n[a++]=192|t>>>6,n[a++]=128|t&63):t<65536?(n[a++]=224|t>>>12,n[a++]=128|t>>>6&63,n[a++]=128|t&63):(n[a++]=240|t>>>18,n[a++]=128|t>>>12&63,n[a++]=128|t>>>6&63,n[a++]=128|t&63);return n},Mr=(e,n)=>{if(n<65534&&e.subarray&&Kn)return String.fromCharCode.apply(null,e.length===n?e:e.subarray(0,n));let t="";for(let i=0;i<n;i++)t+=String.fromCharCode(e[i]);return t},Fr=(e,n)=>{let t=n||e.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(e.subarray(0,n));let i,r,a=new Array(t*2);for(r=0,i=0;i<t;){let l=e[i++];if(l<128){a[r++]=l;continue}let s=Oe[l];if(s>4){a[r++]=65533,i+=s-1;continue}for(l&=s===2?31:s===3?15:7;s>1&&i<t;)l=l<<6|e[i++]&63,s--;if(s>1){a[r++]=65533;continue}l<65536?a[r++]=l:(l-=65536,a[r++]=55296|l>>10&1023,a[r++]=56320|l&1023)}return Mr(a,r)},Hr=(e,n)=>{n=n||e.length,n>e.length&&(n=e.length);let t=n-1;for(;t>=0&&(e[t]&192)===128;)t--;return t<0||t===0?n:t+Oe[e[t]]>n?t:n},Ie={string2buf:Zr,buf2string:Fr,utf8border:Hr};function Pr(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}var Gn=Pr,qn=Object.prototype.toString,{Z_NO_FLUSH:Br,Z_SYNC_FLUSH:$r,Z_FULL_FLUSH:Kr,Z_FINISH:Gr,Z_OK:Ve,Z_STREAM_END:qr,Z_DEFAULT_COMPRESSION:Xr,Z_DEFAULT_STRATEGY:Yr,Z_DEFLATED:Wr}=be;function Ne(e){this.options=Qe.assign({level:Xr,method:Wr,chunkSize:16384,windowBits:15,memLevel:8,strategy:Yr},e||{});let n=this.options;n.raw&&n.windowBits>0?n.windowBits=-n.windowBits:n.gzip&&n.windowBits>0&&n.windowBits<16&&(n.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Gn,this.strm.avail_out=0;let t=Ae.deflateInit2(this.strm,n.level,n.method,n.windowBits,n.memLevel,n.strategy);if(t!==Ve)throw new Error(re[t]);if(n.header&&Ae.deflateSetHeader(this.strm,n.header),n.dictionary){let i;if(typeof n.dictionary=="string"?i=Ie.string2buf(n.dictionary):qn.call(n.dictionary)==="[object ArrayBuffer]"?i=new Uint8Array(n.dictionary):i=n.dictionary,t=Ae.deflateSetDictionary(this.strm,i),t!==Ve)throw new Error(re[t]);this._dict_set=!0}}Ne.prototype.push=function(e,n){let t=this.strm,i=this.options.chunkSize,r,a;if(this.ended)return!1;for(n===~~n?a=n:a=n===!0?Gr:Br,typeof e=="string"?t.input=Ie.string2buf(e):qn.call(e)==="[object ArrayBuffer]"?t.input=new Uint8Array(e):t.input=e,t.next_in=0,t.avail_in=t.input.length;;){if(t.avail_out===0&&(t.output=new Uint8Array(i),t.next_out=0,t.avail_out=i),(a===$r||a===Kr)&&t.avail_out<=6){this.onData(t.output.subarray(0,t.next_out)),t.avail_out=0;continue}if(r=Ae.deflate(t,a),r===qr)return t.next_out>0&&this.onData(t.output.subarray(0,t.next_out)),r=Ae.deflateEnd(this.strm),this.onEnd(r),this.ended=!0,r===Ve;if(t.avail_out===0){this.onData(t.output);continue}if(a>0&&t.next_out>0){this.onData(t.output.subarray(0,t.next_out)),t.avail_out=0;continue}if(t.avail_in===0)break}return!0};Ne.prototype.onData=function(e){this.chunks.push(e)};Ne.prototype.onEnd=function(e){e===Ve&&(this.result=Qe.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function Ot(e,n){let t=new Ne(n);if(t.push(e,!0),t.err)throw t.msg||re[t.err];return t.result}function Vr(e,n){return n=n||{},n.raw=!0,Ot(e,n)}function jr(e,n){return n=n||{},n.gzip=!0,Ot(e,n)}var Jr=Ne,Qr=Ot,ea=Vr,ta=jr,na=be,ia={Deflate:Jr,deflate:Qr,deflateRaw:ea,gzip:ta,constants:na},Ke=16209,ra=16191,aa=function(n,t){let i,r,a,l,s,c,o,f,g,_,d,u,E,y,x,b,p,h,S,I,w,U,v,m,A=n.state;i=n.next_in,v=n.input,r=i+(n.avail_in-5),a=n.next_out,m=n.output,l=a-(t-n.avail_out),s=a+(n.avail_out-257),c=A.dmax,o=A.wsize,f=A.whave,g=A.wnext,_=A.window,d=A.hold,u=A.bits,E=A.lencode,y=A.distcode,x=(1<<A.lenbits)-1,b=(1<<A.distbits)-1;e:do{u<15&&(d+=v[i++]<<u,u+=8,d+=v[i++]<<u,u+=8),p=E[d&x];t:for(;;){if(h=p>>>24,d>>>=h,u-=h,h=p>>>16&255,h===0)m[a++]=p&65535;else if(h&16){S=p&65535,h&=15,h&&(u<h&&(d+=v[i++]<<u,u+=8),S+=d&(1<<h)-1,d>>>=h,u-=h),u<15&&(d+=v[i++]<<u,u+=8,d+=v[i++]<<u,u+=8),p=y[d&b];n:for(;;){if(h=p>>>24,d>>>=h,u-=h,h=p>>>16&255,h&16){if(I=p&65535,h&=15,u<h&&(d+=v[i++]<<u,u+=8,u<h&&(d+=v[i++]<<u,u+=8)),I+=d&(1<<h)-1,I>c){n.msg="invalid distance too far back",A.mode=Ke;break e}if(d>>>=h,u-=h,h=a-l,I>h){if(h=I-h,h>f&&A.sane){n.msg="invalid distance too far back",A.mode=Ke;break e}if(w=0,U=_,g===0){if(w+=o-h,h<S){S-=h;do m[a++]=_[w++];while(--h);w=a-I,U=m}}else if(g<h){if(w+=o+g-h,h-=g,h<S){S-=h;do m[a++]=_[w++];while(--h);if(w=0,g<S){h=g,S-=h;do m[a++]=_[w++];while(--h);w=a-I,U=m}}}else if(w+=g-h,h<S){S-=h;do m[a++]=_[w++];while(--h);w=a-I,U=m}for(;S>2;)m[a++]=U[w++],m[a++]=U[w++],m[a++]=U[w++],S-=3;S&&(m[a++]=U[w++],S>1&&(m[a++]=U[w++]))}else{w=a-I;do m[a++]=m[w++],m[a++]=m[w++],m[a++]=m[w++],S-=3;while(S>2);S&&(m[a++]=m[w++],S>1&&(m[a++]=m[w++]))}}else if((h&64)===0){p=y[(p&65535)+(d&(1<<h)-1)];continue n}else{n.msg="invalid distance code",A.mode=Ke;break e}break}}else if((h&64)===0){p=E[(p&65535)+(d&(1<<h)-1)];continue t}else if(h&32){A.mode=ra;break e}else{n.msg="invalid literal/length code",A.mode=Ke;break e}break}}while(i<r&&a<s);S=u>>3,i-=S,u-=S<<3,d&=(1<<u)-1,n.next_in=i,n.next_out=a,n.avail_in=i<r?5+(r-i):5-(i-r),n.avail_out=a<s?257+(s-a):257-(a-s),A.hold=d,A.bits=u},de=15,Xt=852,Yt=592,Wt=0,lt=1,Vt=2,oa=new Uint16Array([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]),sa=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),la=new Uint16Array([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,0,0]),fa=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]),ca=(e,n,t,i,r,a,l,s)=>{let c=s.bits,o=0,f=0,g=0,_=0,d=0,u=0,E=0,y=0,x=0,b=0,p,h,S,I,w,U=null,v,m=new Uint16Array(de+1),A=new Uint16Array(de+1),ee=null,Mt,Pe,Be;for(o=0;o<=de;o++)m[o]=0;for(f=0;f<i;f++)m[n[t+f]]++;for(d=c,_=de;_>=1&&m[_]===0;_--);if(d>_&&(d=_),_===0)return r[a++]=1<<24|64<<16|0,r[a++]=1<<24|64<<16|0,s.bits=1,0;for(g=1;g<_&&m[g]===0;g++);for(d<g&&(d=g),y=1,o=1;o<=de;o++)if(y<<=1,y-=m[o],y<0)return-1;if(y>0&&(e===Wt||_!==1))return-1;for(A[1]=0,o=1;o<de;o++)A[o+1]=A[o]+m[o];for(f=0;f<i;f++)n[t+f]!==0&&(l[A[n[t+f]]++]=f);if(e===Wt?(U=ee=l,v=20):e===lt?(U=oa,ee=sa,v=257):(U=la,ee=fa,v=0),b=0,f=0,o=g,w=a,u=d,E=0,S=-1,x=1<<d,I=x-1,e===lt&&x>Xt||e===Vt&&x>Yt)return 1;for(;;){Mt=o-E,l[f]+1<v?(Pe=0,Be=l[f]):l[f]>=v?(Pe=ee[l[f]-v],Be=U[l[f]-v]):(Pe=96,Be=0),p=1<<o-E,h=1<<u,g=h;do h-=p,r[w+(b>>E)+h]=Mt<<24|Pe<<16|Be|0;while(h!==0);for(p=1<<o-1;b&p;)p>>=1;if(p!==0?(b&=p-1,b+=p):b=0,f++,--m[o]===0){if(o===_)break;o=n[t+l[f]]}if(o>d&&(b&I)!==S){for(E===0&&(E=d),w+=g,u=o-E,y=1<<u;u+E<_&&(y-=m[u+E],!(y<=0));)u++,y<<=1;if(x+=1<<u,e===lt&&x>Xt||e===Vt&&x>Yt)return 1;S=b&I,r[S]=d<<24|u<<16|w-a|0}}return b!==0&&(r[w+b]=o-E<<24|64<<16|0),s.bits=d,0},ke=ca,da=0,Xn=1,Yn=2,{Z_FINISH:jt,Z_BLOCK:_a,Z_TREES:Ge,Z_OK:oe,Z_STREAM_END:ha,Z_NEED_DICT:ua,Z_STREAM_ERROR:F,Z_DATA_ERROR:Wn,Z_MEM_ERROR:Vn,Z_BUF_ERROR:ga,Z_DEFLATED:Jt}=be,et=16180,Qt=16181,en=16182,tn=16183,nn=16184,rn=16185,an=16186,on=16187,sn=16188,ln=16189,je=16190,G=16191,ft=16192,fn=16193,ct=16194,cn=16195,dn=16196,_n=16197,hn=16198,qe=16199,Xe=16200,un=16201,gn=16202,bn=16203,wn=16204,pn=16205,dt=16206,xn=16207,mn=16208,O=16209,jn=16210,Jn=16211,ba=852,wa=592,pa=15,xa=pa,yn=e=>(e>>>24&255)+(e>>>8&65280)+((e&65280)<<8)+((e&255)<<24);function ma(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}var se=e=>{if(!e)return 1;let n=e.state;return!n||n.strm!==e||n.mode<et||n.mode>Jn?1:0},Qn=e=>{if(se(e))return F;let n=e.state;return e.total_in=e.total_out=n.total=0,e.msg="",n.wrap&&(e.adler=n.wrap&1),n.mode=et,n.last=0,n.havedict=0,n.flags=-1,n.dmax=32768,n.head=null,n.hold=0,n.bits=0,n.lencode=n.lendyn=new Int32Array(ba),n.distcode=n.distdyn=new Int32Array(wa),n.sane=1,n.back=-1,oe},ei=e=>{if(se(e))return F;let n=e.state;return n.wsize=0,n.whave=0,n.wnext=0,Qn(e)},ti=(e,n)=>{let t;if(se(e))return F;let i=e.state;return n<0?(t=0,n=-n):(t=(n>>4)+5,n<48&&(n&=15)),n&&(n<8||n>15)?F:(i.window!==null&&i.wbits!==n&&(i.window=null),i.wrap=t,i.wbits=n,ei(e))},ni=(e,n)=>{if(!e)return F;let t=new ma;e.state=t,t.strm=e,t.window=null,t.mode=et;let i=ti(e,n);return i!==oe&&(e.state=null),i},ya=e=>ni(e,xa),En=!0,_t,ht,Ea=e=>{if(En){_t=new Int32Array(512),ht=new Int32Array(32);let n=0;for(;n<144;)e.lens[n++]=8;for(;n<256;)e.lens[n++]=9;for(;n<280;)e.lens[n++]=7;for(;n<288;)e.lens[n++]=8;for(ke(Xn,e.lens,0,288,_t,0,e.work,{bits:9}),n=0;n<32;)e.lens[n++]=5;ke(Yn,e.lens,0,32,ht,0,e.work,{bits:5}),En=!1}e.lencode=_t,e.lenbits=9,e.distcode=ht,e.distbits=5},ii=(e,n,t,i)=>{let r,a=e.state;return a.window===null&&(a.wsize=1<<a.wbits,a.wnext=0,a.whave=0,a.window=new Uint8Array(a.wsize)),i>=a.wsize?(a.window.set(n.subarray(t-a.wsize,t),0),a.wnext=0,a.whave=a.wsize):(r=a.wsize-a.wnext,r>i&&(r=i),a.window.set(n.subarray(t-i,t-i+r),a.wnext),i-=r,i?(a.window.set(n.subarray(t-i,t),0),a.wnext=i,a.whave=a.wsize):(a.wnext+=r,a.wnext===a.wsize&&(a.wnext=0),a.whave<a.wsize&&(a.whave+=r))),0},Aa=(e,n)=>{let t,i,r,a,l,s,c,o,f,g,_,d,u,E,y=0,x,b,p,h,S,I,w,U,v=new Uint8Array(4),m,A,ee=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(se(e)||!e.output||!e.input&&e.avail_in!==0)return F;t=e.state,t.mode===G&&(t.mode=ft),l=e.next_out,r=e.output,c=e.avail_out,a=e.next_in,i=e.input,s=e.avail_in,o=t.hold,f=t.bits,g=s,_=c,U=oe;e:for(;;)switch(t.mode){case et:if(t.wrap===0){t.mode=ft;break}for(;f<16;){if(s===0)break e;s--,o+=i[a++]<<f,f+=8}if(t.wrap&2&&o===35615){t.wbits===0&&(t.wbits=15),t.check=0,v[0]=o&255,v[1]=o>>>8&255,t.check=z(t.check,v,2,0),o=0,f=0,t.mode=Qt;break}if(t.head&&(t.head.done=!1),!(t.wrap&1)||(((o&255)<<8)+(o>>8))%31){e.msg="incorrect header check",t.mode=O;break}if((o&15)!==Jt){e.msg="unknown compression method",t.mode=O;break}if(o>>>=4,f-=4,w=(o&15)+8,t.wbits===0&&(t.wbits=w),w>15||w>t.wbits){e.msg="invalid window size",t.mode=O;break}t.dmax=1<<t.wbits,t.flags=0,e.adler=t.check=1,t.mode=o&512?ln:G,o=0,f=0;break;case Qt:for(;f<16;){if(s===0)break e;s--,o+=i[a++]<<f,f+=8}if(t.flags=o,(t.flags&255)!==Jt){e.msg="unknown compression method",t.mode=O;break}if(t.flags&57344){e.msg="unknown header flags set",t.mode=O;break}t.head&&(t.head.text=o>>8&1),t.flags&512&&t.wrap&4&&(v[0]=o&255,v[1]=o>>>8&255,t.check=z(t.check,v,2,0)),o=0,f=0,t.mode=en;case en:for(;f<32;){if(s===0)break e;s--,o+=i[a++]<<f,f+=8}t.head&&(t.head.time=o),t.flags&512&&t.wrap&4&&(v[0]=o&255,v[1]=o>>>8&255,v[2]=o>>>16&255,v[3]=o>>>24&255,t.check=z(t.check,v,4,0)),o=0,f=0,t.mode=tn;case tn:for(;f<16;){if(s===0)break e;s--,o+=i[a++]<<f,f+=8}t.head&&(t.head.xflags=o&255,t.head.os=o>>8),t.flags&512&&t.wrap&4&&(v[0]=o&255,v[1]=o>>>8&255,t.check=z(t.check,v,2,0)),o=0,f=0,t.mode=nn;case nn:if(t.flags&1024){for(;f<16;){if(s===0)break e;s--,o+=i[a++]<<f,f+=8}t.length=o,t.head&&(t.head.extra_len=o),t.flags&512&&t.wrap&4&&(v[0]=o&255,v[1]=o>>>8&255,t.check=z(t.check,v,2,0)),o=0,f=0}else t.head&&(t.head.extra=null);t.mode=rn;case rn:if(t.flags&1024&&(d=t.length,d>s&&(d=s),d&&(t.head&&(w=t.head.extra_len-t.length,t.head.extra||(t.head.extra=new Uint8Array(t.head.extra_len)),t.head.extra.set(i.subarray(a,a+d),w)),t.flags&512&&t.wrap&4&&(t.check=z(t.check,i,d,a)),s-=d,a+=d,t.length-=d),t.length))break e;t.length=0,t.mode=an;case an:if(t.flags&2048){if(s===0)break e;d=0;do w=i[a+d++],t.head&&w&&t.length<65536&&(t.head.name+=String.fromCharCode(w));while(w&&d<s);if(t.flags&512&&t.wrap&4&&(t.check=z(t.check,i,d,a)),s-=d,a+=d,w)break e}else t.head&&(t.head.name=null);t.length=0,t.mode=on;case on:if(t.flags&4096){if(s===0)break e;d=0;do w=i[a+d++],t.head&&w&&t.length<65536&&(t.head.comment+=String.fromCharCode(w));while(w&&d<s);if(t.flags&512&&t.wrap&4&&(t.check=z(t.check,i,d,a)),s-=d,a+=d,w)break e}else t.head&&(t.head.comment=null);t.mode=sn;case sn:if(t.flags&512){for(;f<16;){if(s===0)break e;s--,o+=i[a++]<<f,f+=8}if(t.wrap&4&&o!==(t.check&65535)){e.msg="header crc mismatch",t.mode=O;break}o=0,f=0}t.head&&(t.head.hcrc=t.flags>>9&1,t.head.done=!0),e.adler=t.check=0,t.mode=G;break;case ln:for(;f<32;){if(s===0)break e;s--,o+=i[a++]<<f,f+=8}e.adler=t.check=yn(o),o=0,f=0,t.mode=je;case je:if(t.havedict===0)return e.next_out=l,e.avail_out=c,e.next_in=a,e.avail_in=s,t.hold=o,t.bits=f,ua;e.adler=t.check=1,t.mode=G;case G:if(n===_a||n===Ge)break e;case ft:if(t.last){o>>>=f&7,f-=f&7,t.mode=dt;break}for(;f<3;){if(s===0)break e;s--,o+=i[a++]<<f,f+=8}switch(t.last=o&1,o>>>=1,f-=1,o&3){case 0:t.mode=fn;break;case 1:if(Ea(t),t.mode=qe,n===Ge){o>>>=2,f-=2;break e}break;case 2:t.mode=dn;break;case 3:e.msg="invalid block type",t.mode=O}o>>>=2,f-=2;break;case fn:for(o>>>=f&7,f-=f&7;f<32;){if(s===0)break e;s--,o+=i[a++]<<f,f+=8}if((o&65535)!==(o>>>16^65535)){e.msg="invalid stored block lengths",t.mode=O;break}if(t.length=o&65535,o=0,f=0,t.mode=ct,n===Ge)break e;case ct:t.mode=cn;case cn:if(d=t.length,d){if(d>s&&(d=s),d>c&&(d=c),d===0)break e;r.set(i.subarray(a,a+d),l),s-=d,a+=d,c-=d,l+=d,t.length-=d;break}t.mode=G;break;case dn:for(;f<14;){if(s===0)break e;s--,o+=i[a++]<<f,f+=8}if(t.nlen=(o&31)+257,o>>>=5,f-=5,t.ndist=(o&31)+1,o>>>=5,f-=5,t.ncode=(o&15)+4,o>>>=4,f-=4,t.nlen>286||t.ndist>30){e.msg="too many length or distance symbols",t.mode=O;break}t.have=0,t.mode=_n;case _n:for(;t.have<t.ncode;){for(;f<3;){if(s===0)break e;s--,o+=i[a++]<<f,f+=8}t.lens[ee[t.have++]]=o&7,o>>>=3,f-=3}for(;t.have<19;)t.lens[ee[t.have++]]=0;if(t.lencode=t.lendyn,t.lenbits=7,m={bits:t.lenbits},U=ke(da,t.lens,0,19,t.lencode,0,t.work,m),t.lenbits=m.bits,U){e.msg="invalid code lengths set",t.mode=O;break}t.have=0,t.mode=hn;case hn:for(;t.have<t.nlen+t.ndist;){for(;y=t.lencode[o&(1<<t.lenbits)-1],x=y>>>24,b=y>>>16&255,p=y&65535,!(x<=f);){if(s===0)break e;s--,o+=i[a++]<<f,f+=8}if(p<16)o>>>=x,f-=x,t.lens[t.have++]=p;else{if(p===16){for(A=x+2;f<A;){if(s===0)break e;s--,o+=i[a++]<<f,f+=8}if(o>>>=x,f-=x,t.have===0){e.msg="invalid bit length repeat",t.mode=O;break}w=t.lens[t.have-1],d=3+(o&3),o>>>=2,f-=2}else if(p===17){for(A=x+3;f<A;){if(s===0)break e;s--,o+=i[a++]<<f,f+=8}o>>>=x,f-=x,w=0,d=3+(o&7),o>>>=3,f-=3}else{for(A=x+7;f<A;){if(s===0)break e;s--,o+=i[a++]<<f,f+=8}o>>>=x,f-=x,w=0,d=11+(o&127),o>>>=7,f-=7}if(t.have+d>t.nlen+t.ndist){e.msg="invalid bit length repeat",t.mode=O;break}for(;d--;)t.lens[t.have++]=w}}if(t.mode===O)break;if(t.lens[256]===0){e.msg="invalid code -- missing end-of-block",t.mode=O;break}if(t.lenbits=9,m={bits:t.lenbits},U=ke(Xn,t.lens,0,t.nlen,t.lencode,0,t.work,m),t.lenbits=m.bits,U){e.msg="invalid literal/lengths set",t.mode=O;break}if(t.distbits=6,t.distcode=t.distdyn,m={bits:t.distbits},U=ke(Yn,t.lens,t.nlen,t.ndist,t.distcode,0,t.work,m),t.distbits=m.bits,U){e.msg="invalid distances set",t.mode=O;break}if(t.mode=qe,n===Ge)break e;case qe:t.mode=Xe;case Xe:if(s>=6&&c>=258){e.next_out=l,e.avail_out=c,e.next_in=a,e.avail_in=s,t.hold=o,t.bits=f,aa(e,_),l=e.next_out,r=e.output,c=e.avail_out,a=e.next_in,i=e.input,s=e.avail_in,o=t.hold,f=t.bits,t.mode===G&&(t.back=-1);break}for(t.back=0;y=t.lencode[o&(1<<t.lenbits)-1],x=y>>>24,b=y>>>16&255,p=y&65535,!(x<=f);){if(s===0)break e;s--,o+=i[a++]<<f,f+=8}if(b&&(b&240)===0){for(h=x,S=b,I=p;y=t.lencode[I+((o&(1<<h+S)-1)>>h)],x=y>>>24,b=y>>>16&255,p=y&65535,!(h+x<=f);){if(s===0)break e;s--,o+=i[a++]<<f,f+=8}o>>>=h,f-=h,t.back+=h}if(o>>>=x,f-=x,t.back+=x,t.length=p,b===0){t.mode=pn;break}if(b&32){t.back=-1,t.mode=G;break}if(b&64){e.msg="invalid literal/length code",t.mode=O;break}t.extra=b&15,t.mode=un;case un:if(t.extra){for(A=t.extra;f<A;){if(s===0)break e;s--,o+=i[a++]<<f,f+=8}t.length+=o&(1<<t.extra)-1,o>>>=t.extra,f-=t.extra,t.back+=t.extra}t.was=t.length,t.mode=gn;case gn:for(;y=t.distcode[o&(1<<t.distbits)-1],x=y>>>24,b=y>>>16&255,p=y&65535,!(x<=f);){if(s===0)break e;s--,o+=i[a++]<<f,f+=8}if((b&240)===0){for(h=x,S=b,I=p;y=t.distcode[I+((o&(1<<h+S)-1)>>h)],x=y>>>24,b=y>>>16&255,p=y&65535,!(h+x<=f);){if(s===0)break e;s--,o+=i[a++]<<f,f+=8}o>>>=h,f-=h,t.back+=h}if(o>>>=x,f-=x,t.back+=x,b&64){e.msg="invalid distance code",t.mode=O;break}t.offset=p,t.extra=b&15,t.mode=bn;case bn:if(t.extra){for(A=t.extra;f<A;){if(s===0)break e;s--,o+=i[a++]<<f,f+=8}t.offset+=o&(1<<t.extra)-1,o>>>=t.extra,f-=t.extra,t.back+=t.extra}if(t.offset>t.dmax){e.msg="invalid distance too far back",t.mode=O;break}t.mode=wn;case wn:if(c===0)break e;if(d=_-c,t.offset>d){if(d=t.offset-d,d>t.whave&&t.sane){e.msg="invalid distance too far back",t.mode=O;break}d>t.wnext?(d-=t.wnext,u=t.wsize-d):u=t.wnext-d,d>t.length&&(d=t.length),E=t.window}else E=r,u=l-t.offset,d=t.length;d>c&&(d=c),c-=d,t.length-=d;do r[l++]=E[u++];while(--d);t.length===0&&(t.mode=Xe);break;case pn:if(c===0)break e;r[l++]=t.length,c--,t.mode=Xe;break;case dt:if(t.wrap){for(;f<32;){if(s===0)break e;s--,o|=i[a++]<<f,f+=8}if(_-=c,e.total_out+=_,t.total+=_,t.wrap&4&&_&&(e.adler=t.check=t.flags?z(t.check,r,_,l-_):Ue(t.check,r,_,l-_)),_=c,t.wrap&4&&(t.flags?o:yn(o))!==t.check){e.msg="incorrect data check",t.mode=O;break}o=0,f=0}t.mode=xn;case xn:if(t.wrap&&t.flags){for(;f<32;){if(s===0)break e;s--,o+=i[a++]<<f,f+=8}if(t.wrap&4&&o!==(t.total&4294967295)){e.msg="incorrect length check",t.mode=O;break}o=0,f=0}t.mode=mn;case mn:U=ha;break e;case O:U=Wn;break e;case jn:return Vn;case Jn:default:return F}return e.next_out=l,e.avail_out=c,e.next_in=a,e.avail_in=s,t.hold=o,t.bits=f,(t.wsize||_!==e.avail_out&&t.mode<O&&(t.mode<dt||n!==jt))&&ii(e,e.output,e.next_out,_-e.avail_out),g-=e.avail_in,_-=e.avail_out,e.total_in+=g,e.total_out+=_,t.total+=_,t.wrap&4&&_&&(e.adler=t.check=t.flags?z(t.check,r,_,e.next_out-_):Ue(t.check,r,_,e.next_out-_)),e.data_type=t.bits+(t.last?64:0)+(t.mode===G?128:0)+(t.mode===qe||t.mode===ct?256:0),(g===0&&_===0||n===jt)&&U===oe&&(U=ga),U},ka=e=>{if(se(e))return F;let n=e.state;return n.window&&(n.window=null),e.state=null,oe},va=(e,n)=>{if(se(e))return F;let t=e.state;return(t.wrap&2)===0?F:(t.head=n,n.done=!1,oe)},Sa=(e,n)=>{let t=n.length,i,r,a;return se(e)||(i=e.state,i.wrap!==0&&i.mode!==je)?F:i.mode===je&&(r=1,r=Ue(r,n,t,0),r!==i.check)?Wn:(a=ii(e,n,t,t),a?(i.mode=jn,Vn):(i.havedict=1,oe))},Da=ei,Ra=ti,Ua=Qn,Oa=ya,Ia=ni,za=Aa,Ca=ka,Ta=va,Na=Sa,La="pako inflate (from Nodeca project)",X={inflateReset:Da,inflateReset2:Ra,inflateResetKeep:Ua,inflateInit:Oa,inflateInit2:Ia,inflate:za,inflateEnd:Ca,inflateGetHeader:Ta,inflateSetDictionary:Na,inflateInfo:La};function Za(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}var Ma=Za,ri=Object.prototype.toString,{Z_NO_FLUSH:Fa,Z_FINISH:Ha,Z_OK:ze,Z_STREAM_END:ut,Z_NEED_DICT:gt,Z_STREAM_ERROR:Pa,Z_DATA_ERROR:An,Z_MEM_ERROR:Ba}=be;function Le(e){this.options=Qe.assign({chunkSize:1024*64,windowBits:15,to:""},e||{});let n=this.options;n.raw&&n.windowBits>=0&&n.windowBits<16&&(n.windowBits=-n.windowBits,n.windowBits===0&&(n.windowBits=-15)),n.windowBits>=0&&n.windowBits<16&&!(e&&e.windowBits)&&(n.windowBits+=32),n.windowBits>15&&n.windowBits<48&&(n.windowBits&15)===0&&(n.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Gn,this.strm.avail_out=0;let t=X.inflateInit2(this.strm,n.windowBits);if(t!==ze)throw new Error(re[t]);if(this.header=new Ma,X.inflateGetHeader(this.strm,this.header),n.dictionary&&(typeof n.dictionary=="string"?n.dictionary=Ie.string2buf(n.dictionary):ri.call(n.dictionary)==="[object ArrayBuffer]"&&(n.dictionary=new Uint8Array(n.dictionary)),n.raw&&(t=X.inflateSetDictionary(this.strm,n.dictionary),t!==ze)))throw new Error(re[t])}Le.prototype.push=function(e,n){let t=this.strm,i=this.options.chunkSize,r=this.options.dictionary,a,l,s;if(this.ended)return!1;for(n===~~n?l=n:l=n===!0?Ha:Fa,ri.call(e)==="[object ArrayBuffer]"?t.input=new Uint8Array(e):t.input=e,t.next_in=0,t.avail_in=t.input.length;;){for(t.avail_out===0&&(t.output=new Uint8Array(i),t.next_out=0,t.avail_out=i),a=X.inflate(t,l),a===gt&&r&&(a=X.inflateSetDictionary(t,r),a===ze?a=X.inflate(t,l):a===An&&(a=gt));t.avail_in>0&&a===ut&&t.state.wrap>0&&e[t.next_in]!==0;)X.inflateReset(t),a=X.inflate(t,l);switch(a){case Pa:case An:case gt:case Ba:return this.onEnd(a),this.ended=!0,!1}if(s=t.avail_out,t.next_out&&(t.avail_out===0||a===ut))if(this.options.to==="string"){let c=Ie.utf8border(t.output,t.next_out),o=t.next_out-c,f=Ie.buf2string(t.output,c);t.next_out=o,t.avail_out=i-o,o&&t.output.set(t.output.subarray(c,c+o),0),this.onData(f)}else this.onData(t.output.length===t.next_out?t.output:t.output.subarray(0,t.next_out));if(!(a===ze&&s===0)){if(a===ut)return a=X.inflateEnd(this.strm),this.onEnd(a),this.ended=!0,!0;if(t.avail_in===0)break}}return!0};Le.prototype.onData=function(e){this.chunks.push(e)};Le.prototype.onEnd=function(e){e===ze&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Qe.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function It(e,n){let t=new Le(n);if(t.push(e),t.err)throw t.msg||re[t.err];return t.result}function $a(e,n){return n=n||{},n.raw=!0,It(e,n)}var Ka=Le,Ga=It,qa=$a,Xa=It,Ya=be,Wa={Inflate:Ka,inflate:Ga,inflateRaw:qa,ungzip:Xa,constants:Ya},{Deflate:yo,deflate:Eo,deflateRaw:Ao,gzip:ko}=ia,{Inflate:Va,inflate:vo,inflateRaw:ja,ungzip:So}=Wa;var zt=Va;var ai=ja;var Ja=(()=>{let e=new Uint32Array(256);for(let n=0;n<256;n+=1){let t=n;for(let i=0;i<8;i+=1)t=t&1?3988292384^t>>>1:t>>>1;e[n]=t>>>0}return e})(),Ct=(e,n)=>(Ja[(e^n)&255]^e>>>8)>>>0,Me=class{state=4294967295;update(n){let t=this.state;for(let i=0;i<n.length;i+=1)t=Ct(t,n[i]);this.state=t}digest(){return(this.state^4294967295)>>>0}},Nt=e=>{let n=new Me;return n.update(e),n.digest()},K=e=>(e<<1^(e&128?27:0))&255,Y=(()=>{let e=new Uint8Array(256),n=new Uint8Array(256),t=new Uint8Array(256),i=1;for(let a=0;a<255;a+=1)n[a]=i,t[i]=a,i=(i^K(i))&255;let r=a=>a===0?0:n[(255-t[a])%255];for(let a=0;a<256;a+=1){let l=r(a),s=l;for(let c=0;c<4;c+=1)l=(l<<1|l>>7)&255,s^=l;e[a]=(s^99)&255}return e})(),Qa=(()=>{let e=new Uint8Array(11),n=1;for(let t=1;t<=10;t+=1)e[t]=n,n=K(n);return e})(),eo=e=>{let n=e.length/4,t=n+6,i=4*(t+1),r=new Uint8Array(i*4);r.set(e);for(let a=n;a<i;a+=1){let l=r[(a-1)*4],s=r[(a-1)*4+1],c=r[(a-1)*4+2],o=r[(a-1)*4+3];if(a%n===0){let f=l;l=Y[s]^Qa[a/n],s=Y[c],c=Y[o],o=Y[f]}else n>6&&a%n===4&&(l=Y[l],s=Y[s],c=Y[c],o=Y[o]);r[a*4]=r[(a-n)*4]^l,r[a*4+1]=r[(a-n)*4+1]^s,r[a*4+2]=r[(a-n)*4+2]^c,r[a*4+3]=r[(a-n)*4+3]^o}return{w:r,rounds:t}},to=({w:e,rounds:n},t)=>{let i=t.slice(0,16),r=a=>{for(let l=0;l<16;l+=1)i[l]^=e[a*16+l]};r(0);for(let a=1;a<=n;a+=1){for(let s=0;s<16;s+=1)i[s]=Y[i[s]];let l=i[1];if(i[1]=i[5],i[5]=i[9],i[9]=i[13],i[13]=l,l=i[2],i[2]=i[10],i[10]=l,l=i[6],i[6]=i[14],i[14]=l,l=i[3],i[3]=i[15],i[15]=i[11],i[11]=i[7],i[7]=l,a!==n)for(let s=0;s<4;s+=1){let c=s*4,o=i[c],f=i[c+1],g=i[c+2],_=i[c+3];i[c]=K(o)^(K(f)^f)^g^_,i[c+1]=o^K(f)^(K(g)^g)^_,i[c+2]=o^f^K(g)^(K(_)^_),i[c+3]=K(o)^o^f^g^K(_)}r(a)}return i};var no=(e,n)=>{let t=eo(n),i=new Uint8Array(e.length),r=new Uint8Array(16);for(let a=0,l=1;a<e.length;a+=16,l+=1){r.fill(0);for(let o=l,f=0;o>0&&f<16;o=Math.floor(o/256),f+=1)r[f]=o&255;let s=to(t,r),c=Math.min(16,e.length-a);for(let o=0;o<c;o+=1)i[a+o]=e[a+o]^s[o]}return i},Tt=class{k0=305419896;k1=591751049;k2=878082192;constructor(n){for(let t of n)this.update(t)}update(n){this.k0=Ct(this.k0,n),this.k1=this.k1+(this.k0&255)>>>0,this.k1=Math.imul(this.k1,134775813)+1>>>0,this.k2=Ct(this.k2,this.k1>>>24)}streamByte(){let n=(this.k2|2)&65535;return n*(n^1)>>>8&255}},oi=(e,n)=>{let t=new Tt(n),i=new Uint8Array(e.length);for(let r=0;r<e.length;r+=1){let a=(e[r]^t.streamByte())&255;t.update(a),i[r]=a}return{plaintext:i.subarray(12),checkByte:i[11]}};var io={1:{saltLength:8,keyLength:16},2:{saltLength:12,keyLength:24},3:{saltLength:16,keyLength:32}},si=e=>{let n=new DataView(e);for(let t=0;t+4<=e.byteLength;){let i=n.getUint16(t,!0),r=n.getUint16(t+2,!0);if(i===39169)return{strength:n.getUint8(t+4+4),actualMethod:n.getUint16(t+4+5,!0)};t=t+4+r}return null},tt=e=>e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength),ro=async(e,n,t)=>{let i=globalThis.crypto.subtle,r=await i.importKey("raw",tt(e),"PBKDF2",!1,["deriveBits"]),a=new Uint8Array(await i.deriveBits({name:"PBKDF2",salt:tt(n),iterations:1e3,hash:"SHA-1"},r,(t*2+2)*8));return{encKey:a.subarray(0,t),authKey:a.subarray(t,t*2),verify:a.subarray(t*2,t*2+2)}},ao=async(e,n)=>{let t=globalThis.crypto.subtle,i=await t.importKey("raw",tt(e),{name:"HMAC",hash:"SHA-1"},!1,["sign"]);return new Uint8Array(await t.sign("HMAC",i,tt(n)))},Ze=class extends Error{constructor(t){super(t);this.reason=t}reason},li=async(e,n,t)=>{let i=io[t];if(!i)throw new Ze("UNSUPPORTED");let{saltLength:r,keyLength:a}=i,l=e.subarray(0,r),s=e.subarray(r,r+2),c=e.subarray(e.length-10),o=e.subarray(r+2,e.length-10),{encKey:f,authKey:g,verify:_}=await ro(n,l,a);if(_[0]!==s[0]||_[1]!==s[1])throw new Ze("WRONG_PASSWORD");let d=await ao(g,o),u=c.length===10;for(let E=0;E<10;E+=1)d[E]!==c[E]&&(u=!1);if(!u)throw new Ze("BAD_MAC");return no(o,f)};var di=1347092738,_i=1347093252,hi=1347093766,oo=1347094280,so=1347094022,lo=1347094023,le=4294967295,Fe=65535,R=class extends Error{code;constructor(n,t="UNKNOWN"){super(n),this.name=this.constructor.name,this.code=t}},fo=e=>{switch(e.reason){case"WRONG_PASSWORD":return new R("Incorrect password (AES)","WRONG_PASSWORD");case"UNSUPPORTED":return new R("Unsupported AES key strength","UNSUPPORTED_ENCRYPTION");default:return new R("AES authentication failed (corrupt data or wrong password)","DECRYPTION_FAILED")}},He=(e,n)=>{if(e<200||e>=400)throw new R(`Could not fetch remote ZIP at ${n}: HTTP status ${e}`,"HTTP_ERROR")},Lt=class{contentLength;url;centralDirectoryRecords;endOfCentralDirectory;method;credentials;redirect;signal;timeoutMs;requestInit;constructor({contentLength:n,url:t,centralDirectoryRecords:i,endOfCentralDirectory:r,method:a,credentials:l="same-origin",redirect:s,signal:c,timeoutMs:o,requestInit:f}){this.contentLength=n,this.url=t,this.method=a,this.centralDirectoryRecords=i,this.endOfCentralDirectory=r,this.credentials=l,this.redirect=s,this.signal=c,this.timeoutMs=o,this.requestInit=f}requestInitFor(n,t,i){let r=[this.signal,i?.signal].filter(Boolean);return ui({credentials:this.credentials,redirect:this.redirect,signal:r.length<=1?r[0]:AbortSignal.any(r),timeoutMs:i?.timeoutMs??this.timeoutMs,requestInit:this.requestInit},n,t)}files(){return this.centralDirectoryRecords.map(n=>({filename:n.data.filename,size:n.data.uncompressedSize,modified:gi(n.data.lastModifiedDate,n.data.lastModifiedTime),attributes:n.data.externalFileAttributes}))}async fetch(n,t,i){let{file:r,response:a}=await this.fetchEntryResponse(n,t,i),l=ci(await a.arrayBuffer(),r.data.compressedSize);if(!l)throw new R("cannot parse local file header in remote ZIP","LOCAL_HEADER_PARSE_FAILED");return this.decodeEntry(r,new Uint8Array(l.meta.compressedData),l.data.compressionMethod,i)}async decodeEntry(n,t,i,r){let a=t,l=i,s=n.data.generalPurposeBitFlag;if(s&1){if(s&64)throw new R("Strong-encrypted ZIP entries are not supported","UNSUPPORTED_ENCRYPTION");if(!r?.password)throw new R(`Password required for encrypted entry: ${n.data.filename}`,"UNSUPPORTED_ENCRYPTION");let f=new TextEncoder().encode(r.password),g=l===99?si(n.data.extraField):null;if(g){try{a=await li(a,f,g.strength)}catch(_){throw fo(_)}l=g.actualMethod}else{let{plaintext:_,checkByte:d}=oi(a,f),u=s&8?n.data.lastModifiedTime>>8&255:n.data.crc32>>>24&255;if(d!==u)throw new R(`Incorrect password for entry: ${n.data.filename}`,"WRONG_PASSWORD");a=_}}let c=r?.maxUncompressedSize,o;if(l===0){if(c!==void 0&&a.byteLength>c)throw new R(`Uncompressed size exceeds maxUncompressedSize (${c} bytes)`,"DECOMPRESSION_LIMIT_EXCEEDED");o=a}else o=co(a,c);if(r?.verifyCrc){let f=Nt(o);if(f!==n.data.crc32)throw new R(`CRC-32 mismatch for ${n.data.filename}: expected ${n.data.crc32}, got ${f}`,"CRC_MISMATCH")}return o}async fetchStream(n,t,i){let{file:r,response:a}=await this.fetchEntryResponse(n,t,i);if(!a.body)throw new R("Remote ZIP response has no body to stream","LOCAL_HEADER_PARSE_FAILED");if(r.data.generalPurposeBitFlag&1){let c=ci(await a.arrayBuffer(),r.data.compressedSize);if(!c)throw new R("cannot parse local file header in remote ZIP","LOCAL_HEADER_PARSE_FAILED");let o=await this.decodeEntry(r,new Uint8Array(c.meta.compressedData),c.data.compressionMethod,i);return new ReadableStream({start(f){f.enqueue(o),f.close()}})}let l=a.body.getReader(),s=_o(l,{compressedSize:r.data.compressedSize,compressionMethod:r.data.compressionMethod,maxBytes:i?.maxUncompressedSize,expectedCrc:i?.verifyCrc?r.data.crc32:void 0});return new ReadableStream({async pull(c){try{let{done:o,value:f}=await s.next();o?c.close():c.enqueue(f)}catch(o){await l.cancel(o),c.error(o)}},async cancel(c){await l.cancel(c)}})}async fetchEntryResponse(n,t,i){let r=this.centralDirectoryRecords.find(c=>c.data.filename===n);if(!r)throw new R(`File not found in remote ZIP: ${n}`,"FILE_NOT_FOUND");let a=new Headers(t);a.append("Range",`bytes=${r.data.localFileHeaderRelativeOffset}-${r.data.localFileHeaderRelativeOffset+r.data.compressedSize+418}`);let s=await fetch(this.url.toString(),this.requestInitFor(this.method,a,{signal:i?.signal,timeoutMs:i?.timeoutMs}));return He(s.status,this.url),{file:r,response:s}}},co=(e,n)=>{if(n===void 0)try{return ai(e)}catch(c){throw new R(`Failed to inflate remote ZIP entry: ${String(c)}`,"UNKNOWN")}let t=new zt({raw:!0}),i=[],r=0,a=!1;if(t.onData=c=>{if(a)return;let o=c;if(r+=o.length,r>n){a=!0;return}i.push(o)},t.push(e,!0),a)throw new R(`Decompressed size exceeds maxUncompressedSize (${n} bytes)`,"DECOMPRESSION_LIMIT_EXCEEDED");if(t.err)throw new R(`Failed to inflate remote ZIP entry: ${t.msg}`,"UNKNOWN");let l=new Uint8Array(r),s=0;for(let c of i)l.set(c,s),s+=c.length;return l};async function*_o(e,n){let{compressedSize:t,compressionMethod:i,maxBytes:r,expectedCrc:a}=n,l=a!==void 0?new Me:void 0,s=new Uint8Array(0),c=b=>{let p=new Uint8Array(s.length+b.length);p.set(s),p.set(b,s.length),s=p},o=async b=>{for(;s.length<b;){let{done:p,value:h}=await e.read();if(p)throw new R("Truncated local file header in remote ZIP","LOCAL_HEADER_PARSE_FAILED");c(h)}};await o(30);let f=new DataView(s.buffer,s.byteOffset,s.byteLength);if(f.getUint32(0)!==_i)throw new R("cannot parse local file header in remote ZIP","LOCAL_HEADER_PARSE_FAILED");let g=30+f.getUint16(26,!0)+f.getUint16(28,!0);await o(g);let _=0,d=[],u=b=>{if(_+=b.length,r!==void 0&&_>r)throw new R(`Decompressed size exceeds maxUncompressedSize (${r} bytes)`,"DECOMPRESSION_LIMIT_EXCEEDED");l?.update(b),d.push(b)},E=i===0?void 0:new zt({raw:!0});E&&(E.onData=b=>u(b));let y=t,x=b=>{let p=b.length>y?b.subarray(0,y):b;if(y-=p.length,E){if(E.push(p,y===0),E.err)throw new R(`Failed to inflate remote ZIP entry: ${E.msg}`,"UNKNOWN")}else u(p)};for(x(s.subarray(g)),yield*d.splice(0);y>0;){let{done:b,value:p}=await e.read();if(b)break;x(p),yield*d.splice(0)}if(l&&l.digest()!==a)throw new R(`CRC-32 mismatch: expected ${a}, got ${l.digest()}`,"CRC_MISMATCH")}var ho=(e,n)=>{let t=[];if(e&&t.push(e),n!==void 0&&t.push(AbortSignal.timeout(n)),t.length!==0)return t.length===1?t[0]:AbortSignal.any(t)},ui=(e,n,t)=>{let i=new Headers(e.requestInit?.headers);return t&&t.forEach((r,a)=>i.set(a,r)),{...e.requestInit,method:n,headers:i,redirect:e.redirect??e.requestInit?.redirect??"follow",credentials:e.credentials,signal:ho(e.signal,e.timeoutMs)}},fi=class{url;headUrl;additionalHeaders;method;credentials;redirect;signal;timeoutMs;requestInit;constructor({url:n,headUrl:t,additionalHeaders:i,method:r="GET",credentials:a="same-origin",redirect:l,signal:s,timeoutMs:c,requestInit:o}){this.url=n,this.headUrl=t??n,this.additionalHeaders=i,this.method=r,this.credentials=a,this.redirect=l,this.signal=s,this.timeoutMs=c,this.requestInit=o}requestInitFor(n,t){return ui({credentials:this.credentials,redirect:this.redirect,signal:this.signal,timeoutMs:this.timeoutMs,requestInit:this.requestInit},n,t)}async populate(){let n=await fetch(this.headUrl.toString(),this.requestInitFor("HEAD",this.additionalHeaders));He(n.status,this.headUrl);let t=n.headers.get("content-length");if(!t)throw new R("Could not get Content-Length of URL","CONTENT_LENGTH_MISSING");let i=Number.parseInt(t,10),{eocd:r,cdOffset:a,cdSize:l}=await this.fetchEndOfCentralDirectory(i,this.additionalHeaders),s=await this.fetchCentralDirectoryRecords(a,l,this.additionalHeaders);return new Lt({url:this.url,contentLength:i,endOfCentralDirectory:r,centralDirectoryRecords:s,method:this.method,credentials:this.credentials,redirect:this.redirect,signal:this.signal,timeoutMs:this.timeoutMs,requestInit:this.requestInit})}async fetchEndOfCentralDirectory(n,t){let r=[128,65577];for(let a of r){let l=Math.max(0,n-a),s=new Headers(t);s.append("Range",`bytes=${l}-${n}`);let c=await fetch(this.url.toString(),this.requestInitFor(this.method,s));He(c.status,this.url);let o=await c.arrayBuffer(),f=mo(o);if(f){let g=f.data.centralDirectoryByteOffset,_=f.data.centralDirectoryByteSize;if(uo(f)){let d=go(o);if(!d){if(a!==r[r.length-1]&&l>0)continue;throw new R("ZIP64 EOCD locator not found","UNSUPPORTED_ZIP64")}let u=await this.fetchZip64EOCD(d.zip64EOCDOffset,t);g=u.centralDirectoryByteOffset,_=u.centralDirectoryByteSize}if(g<0||_<0||g+_>n)throw new R(`Central directory is out of bounds (offset ${g}, size ${_}, archive ${n} bytes)`,"CENTRAL_DIRECTORY_OUT_OF_BOUNDS");return{eocd:f,cdOffset:g,cdSize:_}}if(l===0)break}throw new R("Could not get EOCD record of remote ZIP","EOCD_NOT_FOUND")}async fetchZip64EOCD(n,t){let i=new Headers(t);i.append("Range",`bytes=${n}-${n+56}`);let r=await fetch(this.url.toString(),this.requestInitFor(this.method,i));He(r.status,this.url);let a=bo(await r.arrayBuffer());if(!a)throw new R("ZIP64 EOCD record not found","UNSUPPORTED_ZIP64");return a}async fetchCentralDirectoryRecords(n,t,i){let r=new Headers(i);r.append("Range",`bytes=${n}-${n+t}`);let a=await fetch(this.url.toString(),this.requestInitFor(this.method,r));He(a.status,this.url);let l=await a.arrayBuffer();return po(l)}},gi=(e,n)=>{let t=e&31||1,i=e>>5&15||1,r=(e>>9&127)+1980,a=n>>11&31,l=n>>5&63,s=(n&31)<<1,c=f=>f.toString().padStart(2,"0"),o=`${r}-${c(i)}-${c(t)}T${c(a)}:${c(l)}:${c(s)}`;return Number.isNaN(Date.parse(o))?gi(0,0):o},uo=e=>e.data.diskNumber===Fe||e.data.cdDisk===Fe||e.data.centralDirectoryDiskNumber===Fe||e.data.centralDirectoryRecordCount===Fe||e.data.centralDirectoryByteSize===le||e.data.centralDirectoryByteOffset===le,fe=(e,n)=>{let t=e.getBigUint64(n,!0);if(t>BigInt(Number.MAX_SAFE_INTEGER))throw new R(`ZIP64 value ${t} exceeds Number.MAX_SAFE_INTEGER`,"UNSUPPORTED_ZIP64");return Number(t)},bi=(e,n)=>{let t=new DataView(e);for(let i=0;i+4<=e.byteLength;){let r=t.getUint16(i,!0),a=t.getUint16(i+2,!0),l=i+4;if(r===1){let s={},c=l;return n.uncompressed&&(s.uncompressedSize=fe(t,c),c+=8),n.compressed&&(s.compressedSize=fe(t,c),c+=8),n.offset&&(s.localHeaderOffset=fe(t,c),c+=8),n.disk&&(s.diskStart=t.getUint32(c,!0)),s}i=l+a}return{}},go=e=>{let n=new DataView(e);for(let t=e.byteLength-20;t>=0;t-=1)if(n.getUint32(t)===lo)return{zip64EOCDOffset:fe(n,t+8)};return null},bo=e=>{let n=new DataView(e);for(let t=0;t<=e.byteLength-56;t+=1)if(n.getUint32(t)===so)return{centralDirectoryRecordCount:fe(n,t+32),centralDirectoryByteSize:fe(n,t+40),centralDirectoryByteOffset:fe(n,t+48)};return null},wo="\xC7\xFC\xE9\xE2\xE4\xE0\xE5\xE7\xEA\xEB\xE8\xEF\xEE\xEC\xC4\xC5\xC9\xE6\xC6\xF4\xF6\xF2\xFB\xF9\xFF\xD6\xDC\xA2\xA3\xA5\u20A7\u0192\xE1\xED\xF3\xFA\xF1\xD1\xAA\xBA\xBF\u2310\xAC\xBD\xBC\xA1\xAB\xBB\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556\u2555\u2563\u2551\u2557\u255D\u255C\u255B\u2510\u2514\u2534\u252C\u251C\u2500\u253C\u255E\u255F\u255A\u2554\u2569\u2566\u2560\u2550\u256C\u2567\u2568\u2564\u2565\u2559\u2558\u2552\u2553\u256B\u256A\u2518\u250C\u2588\u2584\u258C\u2590\u2580\u03B1\xDF\u0393\u03C0\u03A3\u03C3\xB5\u03C4\u03A6\u0398\u03A9\u03B4\u221E\u03C6\u03B5\u2229\u2261\xB1\u2265\u2264\u2320\u2321\xF7\u2248\xB0\u2219\xB7\u221A\u207F\xB2\u25A0\xA0",Zt=(e,n)=>{if(n)return new TextDecoder().decode(e);let t="";for(let i of new Uint8Array(e))t+=i<128?String.fromCharCode(i):wo[i-128];return t},wi=e=>!!(e>>11&1),po=e=>{let n=[],t=new DataView(e);for(let i=0;i<=e.byteLength-4;i+=1)if(t.getUint32(i)===di){let r=xo(e.slice(i));if(r){n.push(r),i+=r.meta.length-1;continue}}else if(t.getUint32(i)===hi)break;return n},xo=e=>{let t=new DataView(e);for(let i=0;i<e.byteLength-46;i+=1)if(t.getInt32(i)===di){let r=t.getUint16(i+28,!0),a=t.getUint16(i+30,!0),l=t.getUint16(i+32,!0),s=t.getUint32(i+20,!0),c=t.getUint32(i+24,!0),o=t.getUint16(i+34,!0),f=t.getUint32(i+42,!0),g=e.slice(i+46+r,i+46+r+a),_={uncompressed:c===le,compressed:s===le,offset:f===le,disk:o===Fe},d=_.uncompressed||_.compressed||_.offset||_.disk?bi(g,_):{},u=wi(t.getUint16(i+8,!0));return{meta:{length:46+r+a+l},data:{signature:e.slice(i,i+4),versionMadeBy:t.getUint16(i+4,!0),versionToExtract:t.getUint16(i+6,!0),generalPurposeBitFlag:t.getUint16(i+8,!0),compressionMethod:t.getUint16(i+10,!0),lastModifiedTime:t.getUint16(i+12,!0),lastModifiedDate:t.getUint16(i+14,!0),crc32:t.getUint32(i+16,!0),compressedSize:d.compressedSize??s,uncompressedSize:d.uncompressedSize??c,filenameLength:r,extraFieldLength:a,fileCommentLength:l,startingDiskNumber:d.diskStart??o,internalFileAttributes:t.getUint16(i+36,!0),externalFileAttributes:t.getUint32(i+38,!0),localFileHeaderRelativeOffset:d.localHeaderOffset??f,filename:Zt(e.slice(i+46,i+46+r),u),extraField:g,fileComment:Zt(e.slice(i+46+r+a,i+46+r+a+l),u)}}}return null},mo=e=>{let t=new DataView(e),i=new TextDecoder;for(let r=e.byteLength-22;r>=0;r-=1)if(t.getUint32(r)===hi){let a=t.getUint16(r+20,!0);return{meta:{},data:{signature:e.slice(r,r+4),diskNumber:t.getUint16(r+4,!0),cdDisk:t.getUint16(r+6,!0),centralDirectoryDiskNumber:t.getUint16(r+8,!0),centralDirectoryRecordCount:t.getUint16(r+10,!0),centralDirectoryByteSize:t.getUint32(r+12,!0),centralDirectoryByteOffset:t.getUint32(r+16,!0),commentLength:a,comment:i.decode(e.slice(r+22,r+22+a))}}}return null},ci=(e,n=0)=>{let i=new DataView(e);for(let r=0;r<=e.byteLength-30;r+=1)if(i.getUint32(r)===_i){let a=i.getUint16(r+26,!0),l=i.getUint16(r+28,!0),s=i.getUint16(r+6,!0),c=!!(s>>3&1),o=r+30+a+l,f=i.getUint32(r+18,!0),g=i.getUint32(r+22,!0),_=e.slice(r+30+a,o),d={uncompressed:g===le,compressed:f===le,offset:!1,disk:!1},u=d.uncompressed||d.compressed?bi(_,d):{},E=u.compressedSize??f,y=u.uncompressedSize??g,x=i.getUint32(o+n)===oo,b=x?4:0;return{meta:{dataDescriptor:c?{optionalSignature:x?e.slice(o+n,o+n+b):void 0,crc32:i.getUint32(o+n+b,!0),compressedSize:i.getUint32(o+n+b+4,!0),uncompressedSize:i.getUint32(o+n+b+8,!0)}:void 0,compressedData:c?e.slice(o,o+n):e.slice(o,o+E)},data:{signature:e.slice(r,r+4),versionToExtract:i.getUint16(r+4,!0),generalPurposeBitFlag:i.getUint16(r+6,!0),compressionMethod:i.getUint16(r+8,!0),lastModifiedTime:i.getUint16(r+10,!0),lastModifiedDate:i.getUint16(r+12,!0),crc32:i.getUint32(r+14,!0),compressedSize:E,uncompressedSize:y,filenameLength:a,extraFieldLength:l,filename:Zt(e.slice(r+30,r+30+a),wi(s)),extraField:_}}}return null};export{Lt as RemoteZip,R as RemoteZipError,fi as RemoteZipPointer,Nt as crc32,Zt as decodeZipString,uo as isZip64,po as parseAllCDs,xo as parseOneCD,mo as parseOneEOCD,ci as parseOneLocalFile,bo as parseZip64EOCD,go as parseZip64EOCDLocator,gi as parseZipDatetime};
|
|
2
|
-
/*! Bundled license information:
|
|
3
|
-
|
|
4
|
-
pako/dist/pako.esm.mjs:
|
|
5
|
-
(*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) *)
|
|
6
|
-
*/
|
|
1
|
+
var or=4,Ke=0,We=1,sr=2;function W(e){let r=e.length;for(;--r>=0;)e[r]=0}var lr=0,cr=1,dr=2,hr=29,Ce=256,fr=286,Oe=30,Rt=19,It=573,Ct=15,ue=16;var Ot=256,zt=16,Nt=17,Tt=18,ur=new Uint8Array([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]),_r=new Uint8Array([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]),ga=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),Lt=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),wr=512,Pt=new Array(288*2);W(Pt);var Mt=new Array(Oe*2);W(Mt);var ke=new Array(wr);W(ke);var ze=new Array(256);W(ze);var Ht=new Array(hr);W(Ht);var Bt=new Array(Oe);W(Bt);var Ft=e=>e<256?ke[e]:ke[256+(e>>>7)],ne=(e,r)=>{e.pending_buf[e.pending++]=r&255,e.pending_buf[e.pending++]=r>>>8&255},C=(e,r,t)=>{e.bi_valid>ue-t?(e.bi_buf|=r<<e.bi_valid&65535,ne(e,e.bi_buf),e.bi_buf=r>>ue-e.bi_valid,e.bi_valid+=t-ue):(e.bi_buf|=r<<e.bi_valid&65535,e.bi_valid+=t)},P=(e,r,t)=>{C(e,t[r*2],t[r*2+1])},gr=(e,r)=>{let t=0;do t|=e&1,e>>>=1,t<<=1;while(--r>0);return t>>>1};var br=(e,r)=>{let t=r.dyn_tree,a=r.max_code,i=r.stat_desc.static_tree,n=r.stat_desc.has_stree,l=r.stat_desc.extra_bits,c=r.stat_desc.extra_base,d=r.stat_desc.max_length,o,s,w,f,h,v,x=0;for(f=0;f<=Ct;f++)e.bl_count[f]=0;for(t[e.heap[e.heap_max]*2+1]=0,o=e.heap_max+1;o<It;o++)s=e.heap[o],f=t[t[s*2+1]*2+1]+1,f>d&&(f=d,x++),t[s*2+1]=f,!(s>a)&&(e.bl_count[f]++,h=0,s>=c&&(h=l[s-c]),v=t[s*2],e.opt_len+=v*(f+h),n&&(e.static_len+=v*(i[s*2+1]+h)));if(x!==0){do{for(f=d-1;e.bl_count[f]===0;)f--;e.bl_count[f]--,e.bl_count[f+1]+=2,e.bl_count[d]--,x-=2}while(x>0);for(f=d;f!==0;f--)for(s=e.bl_count[f];s!==0;)w=e.heap[--o],!(w>a)&&(t[w*2+1]!==f&&(e.opt_len+=(f-t[w*2+1])*t[w*2],t[w*2+1]=f),s--)}},mr=(e,r,t)=>{let a=new Array(16),i=0,n,l;for(n=1;n<=Ct;n++)i=i+t[n-1]<<1,a[n]=i;for(l=0;l<=r;l++){let c=e[l*2+1];c!==0&&(e[l*2]=gr(a[c]++,c))}};var pr=e=>{let r;for(r=0;r<fr;r++)e.dyn_ltree[r*2]=0;for(r=0;r<Oe;r++)e.dyn_dtree[r*2]=0;for(r=0;r<Rt;r++)e.bl_tree[r*2]=0;e.dyn_ltree[Ot*2]=1,e.opt_len=e.static_len=0,e.sym_next=e.matches=0},Zt=e=>{e.bi_valid>8?ne(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0},Ye=(e,r,t,a)=>{let i=r*2,n=t*2;return e[i]<e[n]||e[i]===e[n]&&a[r]<=a[t]},_e=(e,r,t)=>{let a=e.heap[t],i=t<<1;for(;i<=e.heap_len&&(i<e.heap_len&&Ye(r,e.heap[i+1],e.heap[i],e.depth)&&i++,!Ye(r,a,e.heap[i],e.depth));)e.heap[t]=e.heap[i],t=i,i<<=1;e.heap[t]=a},Xe=(e,r,t)=>{let a,i,n=0,l,c;if(e.sym_next!==0)do a=e.pending_buf[e.sym_buf+n++]&255,a+=(e.pending_buf[e.sym_buf+n++]&255)<<8,i=e.pending_buf[e.sym_buf+n++],a===0?P(e,i,r):(l=ze[i],P(e,l+Ce+1,r),c=ur[l],c!==0&&(i-=Ht[l],C(e,i,c)),a--,l=Ft(a),P(e,l,t),c=_r[l],c!==0&&(a-=Bt[l],C(e,a,c)));while(n<e.sym_next);P(e,Ot,r)},De=(e,r)=>{let t=r.dyn_tree,a=r.stat_desc.static_tree,i=r.stat_desc.has_stree,n=r.stat_desc.elems,l,c,d=-1,o;for(e.heap_len=0,e.heap_max=It,l=0;l<n;l++)t[l*2]!==0?(e.heap[++e.heap_len]=d=l,e.depth[l]=0):t[l*2+1]=0;for(;e.heap_len<2;)o=e.heap[++e.heap_len]=d<2?++d:0,t[o*2]=1,e.depth[o]=0,e.opt_len--,i&&(e.static_len-=a[o*2+1]);for(r.max_code=d,l=e.heap_len>>1;l>=1;l--)_e(e,t,l);o=n;do l=e.heap[1],e.heap[1]=e.heap[e.heap_len--],_e(e,t,1),c=e.heap[1],e.heap[--e.heap_max]=l,e.heap[--e.heap_max]=c,t[o*2]=t[l*2]+t[c*2],e.depth[o]=(e.depth[l]>=e.depth[c]?e.depth[l]:e.depth[c])+1,t[l*2+1]=t[c*2+1]=o,e.heap[1]=o++,_e(e,t,1);while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],br(e,r),mr(t,d,e.bl_count)},je=(e,r,t)=>{let a,i=-1,n,l=r[1],c=0,d=7,o=4;for(l===0&&(d=138,o=3),r[(t+1)*2+1]=65535,a=0;a<=t;a++)n=l,l=r[(a+1)*2+1],!(++c<d&&n===l)&&(c<o?e.bl_tree[n*2]+=c:n!==0?(n!==i&&e.bl_tree[n*2]++,e.bl_tree[zt*2]++):c<=10?e.bl_tree[Nt*2]++:e.bl_tree[Tt*2]++,c=0,i=n,l===0?(d=138,o=3):n===l?(d=6,o=3):(d=7,o=4))},Je=(e,r,t)=>{let a,i=-1,n,l=r[1],c=0,d=7,o=4;for(l===0&&(d=138,o=3),a=0;a<=t;a++)if(n=l,l=r[(a+1)*2+1],!(++c<d&&n===l)){if(c<o)do P(e,n,e.bl_tree);while(--c!==0);else n!==0?(n!==i&&(P(e,n,e.bl_tree),c--),P(e,zt,e.bl_tree),C(e,c-3,2)):c<=10?(P(e,Nt,e.bl_tree),C(e,c-3,3)):(P(e,Tt,e.bl_tree),C(e,c-11,7));c=0,i=n,l===0?(d=138,o=3):n===l?(d=6,o=3):(d=7,o=4)}},yr=e=>{let r;for(je(e,e.dyn_ltree,e.l_desc.max_code),je(e,e.dyn_dtree,e.d_desc.max_code),De(e,e.bl_desc),r=Rt-1;r>=3&&e.bl_tree[Lt[r]*2+1]===0;r--);return e.opt_len+=3*(r+1)+5+5+4,r},vr=(e,r,t,a)=>{let i;for(C(e,r-257,5),C(e,t-1,5),C(e,a-4,4),i=0;i<a;i++)C(e,e.bl_tree[Lt[i]*2+1],3);Je(e,e.dyn_ltree,r-1),Je(e,e.dyn_dtree,t-1)},xr=e=>{let r=4093624447,t;for(t=0;t<=31;t++,r>>>=1)if(r&1&&e.dyn_ltree[t*2]!==0)return Ke;if(e.dyn_ltree[18]!==0||e.dyn_ltree[20]!==0||e.dyn_ltree[26]!==0)return We;for(t=32;t<Ce;t++)if(e.dyn_ltree[t*2]!==0)return We;return Ke};var Se=(e,r,t,a)=>{C(e,(lr<<1)+(a?1:0),3),Zt(e),ne(e,t),ne(e,~t),t&&e.pending_buf.set(e.window.subarray(r,r+t),e.pending),e.pending+=t};var Er=(e,r,t,a)=>{let i,n,l=0;e.level>0?(e.strm.data_type===sr&&(e.strm.data_type=xr(e)),De(e,e.l_desc),De(e,e.d_desc),l=yr(e),i=e.opt_len+3+7>>>3,n=e.static_len+3+7>>>3,n<=i&&(i=n)):i=n=t+5,t+4<=i&&r!==-1?Se(e,r,t,a):e.strategy===or||n===i?(C(e,(cr<<1)+(a?1:0),3),Xe(e,Pt,Mt)):(C(e,(dr<<1)+(a?1:0),3),vr(e,e.l_desc.max_code+1,e.d_desc.max_code+1,l+1),Xe(e,e.dyn_ltree,e.dyn_dtree)),pr(e),a&&Zt(e)},X=(e,r,t)=>(e.pending_buf[e.sym_buf+e.sym_next++]=r,e.pending_buf[e.sym_buf+e.sym_next++]=r>>8,e.pending_buf[e.sym_buf+e.sym_next++]=t,r===0?e.dyn_ltree[t*2]++:(e.matches++,r--,e.dyn_ltree[(ze[t]+Ce+1)*2]++,e.dyn_dtree[Ft(r)*2]++),e.sym_next===e.sym_end),oe=(e,r,t,a)=>{let i=e&65535|0,n=e>>>16&65535|0,l=0;for(;t!==0;){l=t>2e3?2e3:t,t-=l;do i=i+r[a++]|0,n=n+i|0;while(--l);i%=65521,n%=65521}return i|n<<16|0},Ar=()=>{let e,r=[];for(var t=0;t<256;t++){e=t;for(var a=0;a<8;a++)e=e&1?3988292384^e>>>1:e>>>1;r[t]=e}return r},kr=new Uint32Array(Ar()),O=(e,r,t,a)=>{let i=kr,n=a+t;e^=-1;for(let l=a;l<n;l++)e=e>>>8^i[(e^r[l])&255];return e^-1},we={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"};var R=3,ge=258,N=262;var B=1,Ne=2,Te=3,Le=4;var Dr=e=>{let r,t,a,i=e.w_size;r=e.hash_size,a=r;do t=e.head[--a],e.head[a]=t>=i?t-i:0;while(--r);r=i,a=r;do t=e.prev[--a],e.prev[a]=t>=i?t-i:0;while(--r)},Pe=(e,r,t)=>(r<<e.hash_shift^t)&e.hash_mask,K=(e,r)=>{let t;if(e.legacy_hash)t=e.ins_h=Pe(e,e.ins_h,e.window[r+R-1]);else{let i=e.window,n=i[r]|i[r+1]<<8|i[r+2]<<16|i[r+3]<<24;t=e.ins_h=Math.imul(n,66521)+66521>>>16&e.hash_mask}let a=e.prev[r&e.w_mask]=e.head[t];return e.head[t]=r,a},Ue=e=>{let r=e.state,t=r.pending;t>e.avail_out&&(t=e.avail_out),t!==0&&(e.output.set(r.pending_buf.subarray(r.pending_out,r.pending_out+t),e.next_out),e.next_out+=t,r.pending_out+=t,e.total_out+=t,e.avail_out-=t,r.pending-=t,r.pending===0&&(r.pending_out=0))},V=(e,r)=>{Er(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,r),e.block_start=e.strstart,Ue(e.strm)};var Re=(e,r,t,a)=>{let i=e.avail_in;return i>a&&(i=a),i===0?0:(e.avail_in-=i,r.set(e.input.subarray(e.next_in,e.next_in+i),t),e.state.wrap===1?e.adler=oe(e.adler,r,i,t):e.state.wrap===2&&(e.adler=O(e.adler,r,i,t)),e.next_in+=i,e.total_in+=i,i)},$t=(e,r)=>{let t=e.max_chain_length,a=e.strstart,i,n,l=e.prev_length,c=e.nice_match,d=e.strstart>e.w_size-N?e.strstart-(e.w_size-N):0,o=e.window,s=e.w_mask,w=e.prev,f=e.strstart+ge,h=o[a+l-1],v=o[a+l];e.prev_length>=e.good_match&&(t>>=2),c>e.lookahead&&(c=e.lookahead);do if(i=r,!(o[i+l]!==v||o[i+l-1]!==h||o[i]!==o[a]||o[++i]!==o[a+1])){a+=2,i++;do;while(o[++a]===o[++i]&&o[++a]===o[++i]&&o[++a]===o[++i]&&o[++a]===o[++i]&&o[++a]===o[++i]&&o[++a]===o[++i]&&o[++a]===o[++i]&&o[++a]===o[++i]&&a<f);if(n=ge-(f-a),a=f-ge,n>l){if(e.match_start=r,l=n,n>=c)break;h=o[a+l-1],v=o[a+l]}}while((r=w[r&s])>d&&--t!==0);return l<=e.lookahead?l:e.lookahead},Vt=e=>{let r=e.w_size,t,a,i;do{if(a=e.window_size-e.lookahead-e.strstart,e.strstart>=r+(r-N)&&(e.window.set(e.window.subarray(r,r+r-a),0),e.match_start-=r,e.strstart-=r,e.block_start-=r,e.insert>e.strstart&&(e.insert=e.strstart),Dr(e),a+=r),e.strm.avail_in===0)break;if(t=Re(e.strm,e.window,e.strstart+e.lookahead,a),e.lookahead+=t,e.legacy_hash){if(e.lookahead+e.insert>=R)for(i=e.strstart-e.insert,e.ins_h=e.window[i],e.ins_h=Pe(e,e.ins_h,e.window[i+1]);e.insert&&(K(e,i),i++,e.insert--,!(e.lookahead+e.insert<R)););}else if(e.lookahead+e.insert>R)for(i=e.strstart-e.insert;e.insert&&(K(e,i),i++,e.insert--,!(e.lookahead+e.insert<=R)););}while(e.lookahead<N&&e.strm.avail_in!==0)},Sr=(e,r)=>{let t=e.pending_buf_size-5>e.w_size?e.w_size:e.pending_buf_size-5,a,i,n,l=0,c=e.strm.avail_in;do{if(a=65535,n=e.bi_valid+42>>3,e.strm.avail_out<n||(n=e.strm.avail_out-n,i=e.strstart-e.block_start,a>i+e.strm.avail_in&&(a=i+e.strm.avail_in),a>n&&(a=n),a<t&&(a===0&&r!==4||r===0||a!==i+e.strm.avail_in)))break;l=r===4&&a===i+e.strm.avail_in?1:0,Se(e,0,0,l),e.pending_buf[e.pending-4]=a,e.pending_buf[e.pending-3]=a>>8,e.pending_buf[e.pending-2]=~a,e.pending_buf[e.pending-1]=~a>>8,Ue(e.strm),i&&(i>a&&(i=a),e.strm.output.set(e.window.subarray(e.block_start,e.block_start+i),e.strm.next_out),e.strm.next_out+=i,e.strm.avail_out-=i,e.strm.total_out+=i,e.block_start+=i,a-=i),a&&(Re(e.strm,e.strm.output,e.strm.next_out,a),e.strm.next_out+=a,e.strm.avail_out-=a,e.strm.total_out+=a)}while(l===0);return c-=e.strm.avail_in,c&&(c>=e.w_size?(e.matches=2,e.window.set(e.strm.input.subarray(e.strm.next_in-e.w_size,e.strm.next_in),0),e.strstart=e.w_size,e.insert=e.strstart):(e.window_size-e.strstart<=c&&(e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,e.insert>e.strstart&&(e.insert=e.strstart)),e.window.set(e.strm.input.subarray(e.strm.next_in-c,e.strm.next_in),e.strstart),e.strstart+=c,e.insert+=c>e.w_size-e.insert?e.w_size-e.insert:c),e.block_start=e.strstart),e.high_water<e.strstart&&(e.high_water=e.strstart),l?Le:r!==0&&r!==4&&e.strm.avail_in===0&&e.strstart===e.block_start?Ne:(n=e.window_size-e.strstart,e.strm.avail_in>n&&e.block_start>=e.w_size&&(e.block_start-=e.w_size,e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,n+=e.w_size,e.insert>e.strstart&&(e.insert=e.strstart)),n>e.strm.avail_in&&(n=e.strm.avail_in),n&&(Re(e.strm,e.window,e.strstart,n),e.strstart+=n,e.insert+=n>e.w_size-e.insert?e.w_size-e.insert:n),e.high_water<e.strstart&&(e.high_water=e.strstart),n=e.bi_valid+42>>3,n=e.pending_buf_size-n>65535?65535:e.pending_buf_size-n,t=n>e.w_size?e.w_size:n,i=e.strstart-e.block_start,(i>=t||(i||r===4)&&r!==0&&e.strm.avail_in===0&&i<=n)&&(a=i>n?n:i,l=r===4&&e.strm.avail_in===0&&a===i?1:0,Se(e,e.block_start,a,l),e.block_start+=a,Ue(e.strm)),l?Te:B)},be=(e,r)=>{let t,a;for(;;){if(e.lookahead<N){if(Vt(e),e.lookahead<N&&r===0)return B;if(e.lookahead===0)break}if(t=0,e.lookahead>=R&&(t=K(e,e.strstart)),t!==0&&e.strstart-t<=e.w_size-N&&(e.match_length=$t(e,t)),e.match_length>=R)if(a=X(e,e.strstart-e.match_start,e.match_length-R),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=R){e.match_length--;do e.strstart++,t=K(e,e.strstart);while(--e.match_length!==0);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.legacy_hash&&(e.ins_h=e.window[e.strstart],e.ins_h=Pe(e,e.ins_h,e.window[e.strstart+1]));else a=X(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(a&&(V(e,!1),e.strm.avail_out===0))return B}return e.insert=e.strstart<R-1?e.strstart:R-1,r===4?(V(e,!0),e.strm.avail_out===0?Te:Le):e.sym_next&&(V(e,!1),e.strm.avail_out===0)?B:Ne},q=(e,r)=>{let t,a,i;for(;;){if(e.lookahead<N){if(Vt(e),e.lookahead<N&&r===0)return B;if(e.lookahead===0)break}if(t=0,e.lookahead>=R&&(t=K(e,e.strstart)),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=R-1,t!==0&&e.prev_length<e.max_lazy_match&&e.strstart-t<=e.w_size-N&&(e.match_length=$t(e,t),e.match_length<=5&&(e.strategy===1||e.match_length===R&&e.strstart-e.match_start>4096)&&(e.match_length=R-1)),e.prev_length>=R&&e.match_length<=e.prev_length){i=e.strstart+e.lookahead-R,a=X(e,e.strstart-1-e.prev_match,e.prev_length-R),e.lookahead-=e.prev_length-1,e.prev_length-=2;do++e.strstart<=i&&(t=K(e,e.strstart));while(--e.prev_length!==0);if(e.match_available=0,e.match_length=R-1,e.strstart++,a&&(V(e,!1),e.strm.avail_out===0))return B}else if(e.match_available){if(a=X(e,0,e.window[e.strstart-1]),a&&V(e,!1),e.strstart++,e.lookahead--,e.strm.avail_out===0)return B}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(a=X(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<R-1?e.strstart:R-1,r===4?(V(e,!0),e.strm.avail_out===0?Te:Le):e.sym_next&&(V(e,!1),e.strm.avail_out===0)?B:Ne};var z=class{constructor(e,r,t,a,i){this.good_length=e,this.max_lazy=r,this.nice_length=t,this.max_chain=a,this.func=i}},ba=[new z(0,0,0,0,Sr),new z(4,4,8,4,be),new z(4,5,16,8,be),new z(4,6,32,32,be),new z(4,4,16,16,q),new z(8,16,32,32,q),new z(8,16,128,128,q),new z(8,32,128,256,q),new z(32,128,258,1024,q),new z(32,258,258,4096,q)];var te=16209,Ur=16191;function Rr(e,r){let t,a,i,n,l,c,d,o,s,w,f,h,v,x,A,E,g,u,b,S,m,y,D,p,k=e.state;t=e.next_in,D=e.input,a=t+(e.avail_in-5),i=e.next_out,p=e.output,n=i-(r-e.avail_out),l=i+(e.avail_out-257),c=k.dmax,d=k.wsize,o=k.whave,s=k.wnext,w=k.window,f=k.hold,h=k.bits,v=k.lencode,x=k.distcode,A=(1<<k.lenbits)-1,E=(1<<k.distbits)-1;e:do{h<15&&(f+=D[t++]<<h,h+=8,f+=D[t++]<<h,h+=8),g=v[f&A];t:for(;;){if(u=g>>>24,f>>>=u,h-=u,u=g>>>16&255,u===0)p[i++]=g&65535;else if(u&16){b=g&65535,u&=15,u&&(h<u&&(f+=D[t++]<<h,h+=8),b+=f&(1<<u)-1,f>>>=u,h-=u),h<15&&(f+=D[t++]<<h,h+=8,f+=D[t++]<<h,h+=8),g=x[f&E];r:for(;;){if(u=g>>>24,f>>>=u,h-=u,u=g>>>16&255,u&16){if(S=g&65535,u&=15,h<u&&(f+=D[t++]<<h,h+=8,h<u&&(f+=D[t++]<<h,h+=8)),S+=f&(1<<u)-1,S>c){e.msg="invalid distance too far back",k.mode=te;break e}if(f>>>=u,h-=u,u=i-n,S>u){if(u=S-u,u>o&&k.sane){e.msg="invalid distance too far back",k.mode=te;break e}if(m=0,y=w,s===0){if(m+=d-u,u<b){b-=u;do p[i++]=w[m++];while(--u);m=i-S,y=p}}else if(s<u){if(m+=d+s-u,u-=s,u<b){b-=u;do p[i++]=w[m++];while(--u);if(m=0,s<b){u=s,b-=u;do p[i++]=w[m++];while(--u);m=i-S,y=p}}}else if(m+=s-u,u<b){b-=u;do p[i++]=w[m++];while(--u);m=i-S,y=p}for(;b>2;)p[i++]=y[m++],p[i++]=y[m++],p[i++]=y[m++],b-=3;b&&(p[i++]=y[m++],b>1&&(p[i++]=y[m++]))}else{m=i-S;do p[i++]=p[m++],p[i++]=p[m++],p[i++]=p[m++],b-=3;while(b>2);b&&(p[i++]=p[m++],b>1&&(p[i++]=p[m++]))}}else if((u&64)===0){g=x[(g&65535)+(f&(1<<u)-1)];continue r}else{e.msg="invalid distance code",k.mode=te;break e}break}}else if((u&64)===0){g=v[(g&65535)+(f&(1<<u)-1)];continue t}else if(u&32){k.mode=Ur;break e}else{e.msg="invalid literal/length code",k.mode=te;break e}break}}while(t<a&&i<l);b=h>>3,t-=b,h-=b<<3,f&=(1<<h)-1,e.next_in=t,e.next_out=i,e.avail_in=t<a?5+(a-t):5-(t-a),e.avail_out=i<l?257+(l-i):257-(i-l),k.hold=f,k.bits=h}var re=15,Qe=852,et=592,tt=0,me=1,rt=2,Ir=new Uint16Array([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]),Cr=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,199,75]),Or=new Uint16Array([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,0,0]),zr=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]),j=(e,r,t,a,i,n,l,c)=>{let d=c.bits,o=0,s=0,w=0,f=0,h=0,v=0,x=0,A=0,E=0,g=0,u,b,S,m,y,D=null,p,k=new Uint16Array(16),I=new Uint16Array(16),$=null,qe,Q,ee;for(o=0;o<=re;o++)k[o]=0;for(s=0;s<a;s++)k[r[t+s]]++;for(h=d,f=re;f>=1&&k[f]===0;f--);if(h>f&&(h=f),f===0)return i[n++]=20971520,i[n++]=20971520,c.bits=1,0;for(w=1;w<f&&k[w]===0;w++);for(h<w&&(h=w),A=1,o=1;o<=re;o++)if(A<<=1,A-=k[o],A<0)return-1;if(A>0&&(e===tt||f!==1))return-1;for(I[1]=0,o=1;o<re;o++)I[o+1]=I[o]+k[o];for(s=0;s<a;s++)r[t+s]!==0&&(l[I[r[t+s]]++]=s);if(e===tt?(D=$=l,p=20):e===me?(D=Ir,$=Cr,p=257):(D=Or,$=zr,p=0),g=0,s=0,o=w,y=n,v=h,x=0,S=-1,E=1<<h,m=E-1,e===me&&E>Qe||e===rt&&E>et)return 1;for(;;){qe=o-x,l[s]+1<p?(Q=0,ee=l[s]):l[s]>=p?(Q=$[l[s]-p],ee=D[l[s]-p]):(Q=96,ee=0),u=1<<o-x,b=1<<v,w=b;do b-=u,i[y+(g>>x)+b]=qe<<24|Q<<16|ee|0;while(b!==0);for(u=1<<o-1;g&u;)u>>=1;if(u!==0?(g&=u-1,g+=u):g=0,s++,--k[o]===0){if(o===f)break;o=r[t+l[s]]}if(o>h&&(g&m)!==S){for(x===0&&(x=h),y+=w,v=o-x,A=1<<v;v+x<f&&(A-=k[v+x],!(A<=0));)v++,A<<=1;if(E+=1<<v,e===me&&E>Qe||e===rt&&E>et)return 1;S=g&m,i[S]=h<<24|v<<16|y-n|0}}return g!==0&&(i[y+g]=o-x<<24|4194304),c.bits=h,0},Nr=0,Gt=1,qt=2,le=16180,at=16181,it=16182,nt=16183,ot=16184,st=16185,lt=16186,ct=16187,dt=16188,ht=16189,se=16190,L=16191,pe=16192,ft=16193,ye=16194,ut=16195,_t=16196,wt=16197,gt=16198,ae=16199,ie=16200,bt=16201,mt=16202,pt=16203,yt=16204,vt=16205,ve=16206,xt=16207,Et=16208,U=16209,Ie=16210,Kt=16211,Tr=852,Lr=592;var At=e=>(e>>>24&255)+(e>>>8&65280)+((e&65280)<<8)+((e&255)<<24),Pr=class{constructor(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}},Y=e=>{if(!e)return 1;let r=e.state;return!r||r.strm!==e||r.mode<le||r.mode>Kt?1:0},Mr=e=>{if(Y(e))return-2;let r=e.state;return e.total_in=e.total_out=r.total=0,e.msg="",r.wrap&&(e.adler=r.wrap&1),r.mode=le,r.last=0,r.havedict=0,r.flags=-1,r.dmax=32768,r.head=null,r.hold=0,r.bits=0,r.lencode=r.lendyn=new Int32Array(Tr),r.distcode=r.distdyn=new Int32Array(Lr),r.sane=1,r.back=-1,0},Wt=e=>{if(Y(e))return-2;let r=e.state;return r.wsize=0,r.whave=0,r.wnext=0,Mr(e)},Hr=(e,r)=>{let t;if(Y(e))return-2;let a=e.state;return r<0?(t=0,r=-r):(t=(r>>4)+5,r<48&&(r&=15)),r&&(r<8||r>15)?-2:(a.window!==null&&a.wbits!==r&&(a.window=null),a.wrap=t,a.wbits=r,Wt(e))},Br=(e,r)=>{if(!e)return-2;let t=new Pr;e.state=t,t.strm=e,t.window=null,t.mode=le;let a=Hr(e,r);return a!==0&&(e.state=null),a};var kt=!0,xe,Ee,Fr=e=>{if(kt){xe=new Int32Array(512),Ee=new Int32Array(32);let r=0;for(;r<144;)e.lens[r++]=8;for(;r<256;)e.lens[r++]=9;for(;r<280;)e.lens[r++]=7;for(;r<288;)e.lens[r++]=8;for(j(Gt,e.lens,0,288,xe,0,e.work,{bits:9}),r=0;r<32;)e.lens[r++]=5;j(qt,e.lens,0,32,Ee,0,e.work,{bits:5}),kt=!1}e.lencode=xe,e.lenbits=9,e.distcode=Ee,e.distbits=5},Yt=(e,r,t,a)=>{let i,n=e.state;return n.window===null&&(n.window=new Uint8Array(1<<n.wbits)),n.wsize===0&&(n.wsize=1<<n.wbits,n.wnext=0,n.whave=0),a>=n.wsize?(n.window.set(r.subarray(t-n.wsize,t),0),n.wnext=0,n.whave=n.wsize):(i=n.wsize-n.wnext,i>a&&(i=a),n.window.set(r.subarray(t-a,t-a+i),n.wnext),a-=i,a?(n.window.set(r.subarray(t-a,t),0),n.wnext=a,n.whave=n.wsize):(n.wnext+=i,n.wnext===n.wsize&&(n.wnext=0),n.whave<n.wsize&&(n.whave+=i))),0},Ae=(e,r)=>{let t,a,i,n,l,c,d,o,s,w,f,h,v,x,A=0,E,g,u,b,S,m,y,D,p=new Uint8Array(4),k,I,$=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(Y(e)||!e.output||!e.input&&e.avail_in!==0)return-2;t=e.state,t.mode===L&&(t.mode=pe),l=e.next_out,i=e.output,d=e.avail_out,n=e.next_in,a=e.input,c=e.avail_in,o=t.hold,s=t.bits,w=c,f=d,D=0;e:for(;;)switch(t.mode){case le:if(t.wrap===0){t.mode=pe;break}for(;s<16;){if(c===0)break e;c--,o+=a[n++]<<s,s+=8}if(t.wrap&2&&o===35615){t.wbits===0&&(t.wbits=15),t.check=0,p[0]=o&255,p[1]=o>>>8&255,t.check=O(t.check,p,2,0),o=0,s=0,t.mode=at;break}if(t.head&&(t.head.done=!1),!(t.wrap&1)||(((o&255)<<8)+(o>>8))%31){e.msg="incorrect header check",t.mode=U;break}if((o&15)!==8){e.msg="unknown compression method",t.mode=U;break}if(o>>>=4,s-=4,y=(o&15)+8,t.wbits===0&&(t.wbits=y),y>15||y>t.wbits){e.msg="invalid window size",t.mode=U;break}t.dmax=1<<t.wbits,t.flags=0,e.adler=t.check=1,t.mode=o&512?ht:L,o=0,s=0;break;case at:for(;s<16;){if(c===0)break e;c--,o+=a[n++]<<s,s+=8}if(t.flags=o,(t.flags&255)!==8){e.msg="unknown compression method",t.mode=U;break}if(t.flags&57344){e.msg="unknown header flags set",t.mode=U;break}t.head&&(t.head.text=o>>8&1),t.flags&512&&t.wrap&4&&(p[0]=o&255,p[1]=o>>>8&255,t.check=O(t.check,p,2,0)),o=0,s=0,t.mode=it;case it:for(;s<32;){if(c===0)break e;c--,o+=a[n++]<<s,s+=8}t.head&&(t.head.time=o),t.flags&512&&t.wrap&4&&(p[0]=o&255,p[1]=o>>>8&255,p[2]=o>>>16&255,p[3]=o>>>24&255,t.check=O(t.check,p,4,0)),o=0,s=0,t.mode=nt;case nt:for(;s<16;){if(c===0)break e;c--,o+=a[n++]<<s,s+=8}t.head&&(t.head.xflags=o&255,t.head.os=o>>8),t.flags&512&&t.wrap&4&&(p[0]=o&255,p[1]=o>>>8&255,t.check=O(t.check,p,2,0)),o=0,s=0,t.mode=ot;case ot:if(t.flags&1024){for(;s<16;){if(c===0)break e;c--,o+=a[n++]<<s,s+=8}t.length=o,t.head&&(t.head.extra_len=o),t.flags&512&&t.wrap&4&&(p[0]=o&255,p[1]=o>>>8&255,t.check=O(t.check,p,2,0)),o=0,s=0}else t.head&&(t.head.extra=null);t.mode=st;case st:if(t.flags&1024&&(h=t.length,h>c&&(h=c),h&&(t.head&&(y=t.head.extra_len-t.length,t.head.extra||(t.head.extra=new Uint8Array(t.head.extra_len)),t.head.extra.set(a.subarray(n,n+h),y)),t.flags&512&&t.wrap&4&&(t.check=O(t.check,a,h,n)),c-=h,n+=h,t.length-=h),t.length))break e;t.length=0,t.mode=lt;case lt:if(t.flags&2048){if(c===0)break e;h=0;do y=a[n+h++],t.head&&y&&t.length<65536&&(t.head.name+=String.fromCharCode(y));while(y&&h<c);if(t.flags&512&&t.wrap&4&&(t.check=O(t.check,a,h,n)),c-=h,n+=h,y)break e}else t.head&&(t.head.name=null);t.length=0,t.mode=ct;case ct:if(t.flags&4096){if(c===0)break e;h=0;do y=a[n+h++],t.head&&y&&t.length<65536&&(t.head.comment+=String.fromCharCode(y));while(y&&h<c);if(t.flags&512&&t.wrap&4&&(t.check=O(t.check,a,h,n)),c-=h,n+=h,y)break e}else t.head&&(t.head.comment=null);t.mode=dt;case dt:if(t.flags&512){for(;s<16;){if(c===0)break e;c--,o+=a[n++]<<s,s+=8}if(t.wrap&4&&o!==(t.check&65535)){e.msg="header crc mismatch",t.mode=U;break}o=0,s=0}t.head&&(t.head.hcrc=t.flags>>9&1,t.head.done=!0),e.adler=t.check=0,t.mode=L;break;case ht:for(;s<32;){if(c===0)break e;c--,o+=a[n++]<<s,s+=8}e.adler=t.check=At(o),o=0,s=0,t.mode=se;case se:if(t.havedict===0)return e.next_out=l,e.avail_out=d,e.next_in=n,e.avail_in=c,t.hold=o,t.bits=s,2;e.adler=t.check=1,t.mode=L;case L:if(r===5||r===6)break e;case pe:if(t.last){o>>>=s&7,s-=s&7,t.mode=ve;break}for(;s<3;){if(c===0)break e;c--,o+=a[n++]<<s,s+=8}switch(t.last=o&1,o>>>=1,s-=1,o&3){case 0:t.mode=ft;break;case 1:if(Fr(t),t.mode=ae,r===6){o>>>=2,s-=2;break e}break;case 2:t.mode=_t;break;case 3:e.msg="invalid block type",t.mode=U}o>>>=2,s-=2;break;case ft:for(o>>>=s&7,s-=s&7;s<32;){if(c===0)break e;c--,o+=a[n++]<<s,s+=8}if((o&65535)!==(o>>>16^65535)){e.msg="invalid stored block lengths",t.mode=U;break}if(t.length=o&65535,o=0,s=0,t.mode=ye,r===6)break e;case ye:t.mode=ut;case ut:if(h=t.length,h){if(h>c&&(h=c),h>d&&(h=d),h===0)break e;i.set(a.subarray(n,n+h),l),c-=h,n+=h,d-=h,l+=h,t.length-=h;break}t.mode=L;break;case _t:for(;s<14;){if(c===0)break e;c--,o+=a[n++]<<s,s+=8}if(t.nlen=(o&31)+257,o>>>=5,s-=5,t.ndist=(o&31)+1,o>>>=5,s-=5,t.ncode=(o&15)+4,o>>>=4,s-=4,t.nlen>286||t.ndist>30){e.msg="too many length or distance symbols",t.mode=U;break}t.have=0,t.mode=wt;case wt:for(;t.have<t.ncode;){for(;s<3;){if(c===0)break e;c--,o+=a[n++]<<s,s+=8}t.lens[$[t.have++]]=o&7,o>>>=3,s-=3}for(;t.have<19;)t.lens[$[t.have++]]=0;if(t.lencode=t.lendyn,t.lenbits=7,k={bits:t.lenbits},D=j(Nr,t.lens,0,19,t.lencode,0,t.work,k),t.lenbits=k.bits,D){e.msg="invalid code lengths set",t.mode=U;break}t.have=0,t.mode=gt;case gt:for(;t.have<t.nlen+t.ndist;){for(;A=t.lencode[o&(1<<t.lenbits)-1],E=A>>>24,g=A>>>16&255,u=A&65535,!(E<=s);){if(c===0)break e;c--,o+=a[n++]<<s,s+=8}if(u<16)o>>>=E,s-=E,t.lens[t.have++]=u;else{if(u===16){for(I=E+2;s<I;){if(c===0)break e;c--,o+=a[n++]<<s,s+=8}if(o>>>=E,s-=E,t.have===0){e.msg="invalid bit length repeat",t.mode=U;break}y=t.lens[t.have-1],h=3+(o&3),o>>>=2,s-=2}else if(u===17){for(I=E+3;s<I;){if(c===0)break e;c--,o+=a[n++]<<s,s+=8}o>>>=E,s-=E,y=0,h=3+(o&7),o>>>=3,s-=3}else{for(I=E+7;s<I;){if(c===0)break e;c--,o+=a[n++]<<s,s+=8}o>>>=E,s-=E,y=0,h=11+(o&127),o>>>=7,s-=7}if(t.have+h>t.nlen+t.ndist){e.msg="invalid bit length repeat",t.mode=U;break}for(;h--;)t.lens[t.have++]=y}}if(t.mode===U)break;if(t.lens[256]===0){e.msg="invalid code -- missing end-of-block",t.mode=U;break}if(t.lenbits=9,k={bits:t.lenbits},D=j(Gt,t.lens,0,t.nlen,t.lencode,0,t.work,k),t.lenbits=k.bits,D){e.msg="invalid literal/lengths set",t.mode=U;break}if(t.distbits=6,t.distcode=t.distdyn,k={bits:t.distbits},D=j(qt,t.lens,t.nlen,t.ndist,t.distcode,0,t.work,k),t.distbits=k.bits,D){e.msg="invalid distances set",t.mode=U;break}if(t.mode=ae,r===6)break e;case ae:t.mode=ie;case ie:if(c>=6&&d>=258){e.next_out=l,e.avail_out=d,e.next_in=n,e.avail_in=c,t.hold=o,t.bits=s,Rr(e,f),l=e.next_out,i=e.output,d=e.avail_out,n=e.next_in,a=e.input,c=e.avail_in,o=t.hold,s=t.bits,t.mode===L&&(t.back=-1);break}for(t.back=0;A=t.lencode[o&(1<<t.lenbits)-1],E=A>>>24,g=A>>>16&255,u=A&65535,!(E<=s);){if(c===0)break e;c--,o+=a[n++]<<s,s+=8}if(g&&(g&240)===0){for(b=E,S=g,m=u;A=t.lencode[m+((o&(1<<b+S)-1)>>b)],E=A>>>24,g=A>>>16&255,u=A&65535,!(b+E<=s);){if(c===0)break e;c--,o+=a[n++]<<s,s+=8}o>>>=b,s-=b,t.back+=b}if(o>>>=E,s-=E,t.back+=E,t.length=u,g===0){t.mode=vt;break}if(g&32){t.back=-1,t.mode=L;break}if(g&64){e.msg="invalid literal/length code",t.mode=U;break}t.extra=g&15,t.mode=bt;case bt:if(t.extra){for(I=t.extra;s<I;){if(c===0)break e;c--,o+=a[n++]<<s,s+=8}t.length+=o&(1<<t.extra)-1,o>>>=t.extra,s-=t.extra,t.back+=t.extra}t.was=t.length,t.mode=mt;case mt:for(;A=t.distcode[o&(1<<t.distbits)-1],E=A>>>24,g=A>>>16&255,u=A&65535,!(E<=s);){if(c===0)break e;c--,o+=a[n++]<<s,s+=8}if((g&240)===0){for(b=E,S=g,m=u;A=t.distcode[m+((o&(1<<b+S)-1)>>b)],E=A>>>24,g=A>>>16&255,u=A&65535,!(b+E<=s);){if(c===0)break e;c--,o+=a[n++]<<s,s+=8}o>>>=b,s-=b,t.back+=b}if(o>>>=E,s-=E,t.back+=E,g&64){e.msg="invalid distance code",t.mode=U;break}t.offset=u,t.extra=g&15,t.mode=pt;case pt:if(t.extra){for(I=t.extra;s<I;){if(c===0)break e;c--,o+=a[n++]<<s,s+=8}t.offset+=o&(1<<t.extra)-1,o>>>=t.extra,s-=t.extra,t.back+=t.extra}if(t.offset>t.dmax){e.msg="invalid distance too far back",t.mode=U;break}t.mode=yt;case yt:if(d===0)break e;if(h=f-d,t.offset>h){if(h=t.offset-h,h>t.whave&&t.sane){e.msg="invalid distance too far back",t.mode=U;break}h>t.wnext?(h-=t.wnext,v=t.wsize-h):v=t.wnext-h,h>t.length&&(h=t.length),x=t.window}else x=i,v=l-t.offset,h=t.length;h>d&&(h=d),d-=h,t.length-=h;do i[l++]=x[v++];while(--h);t.length===0&&(t.mode=ie);break;case vt:if(d===0)break e;i[l++]=t.length,d--,t.mode=ie;break;case ve:if(t.wrap){for(;s<32;){if(c===0)break e;c--,o|=a[n++]<<s,s+=8}if(f-=d,e.total_out+=f,t.total+=f,t.wrap&4&&f&&(e.adler=t.check=t.flags?O(t.check,i,f,l-f):oe(t.check,i,f,l-f)),f=d,t.wrap&4&&(t.flags?o:At(o))!==t.check){e.msg="incorrect data check",t.mode=U;break}o=0,s=0}t.mode=xt;case xt:if(t.wrap&&t.flags){for(;s<32;){if(c===0)break e;c--,o+=a[n++]<<s,s+=8}if(t.wrap&4&&o!==(t.total&4294967295)){e.msg="incorrect length check",t.mode=U;break}o=0,s=0}t.mode=Et;case Et:D=1;break e;case U:D=-3;break e;case Ie:return-4;case Kt:default:return-2}return e.next_out=l,e.avail_out=d,e.next_in=n,e.avail_in=c,t.hold=o,t.bits=s,(t.wsize||f!==e.avail_out&&t.mode<U&&(t.mode<ve||r!==4))&&Yt(e,e.output,e.next_out,f-e.avail_out)?(t.mode=Ie,-4):(w-=e.avail_in,f-=e.avail_out,e.total_in+=w,e.total_out+=f,t.total+=f,t.wrap&4&&f&&(e.adler=t.check=t.flags?O(t.check,i,f,e.next_out-f):oe(t.check,i,f,e.next_out-f)),e.data_type=t.bits+(t.last?64:0)+(t.mode===L?128:0)+(t.mode===ae||t.mode===ye?256:0),(w===0&&f===0||r===4)&&D===0&&(D=-5),D)},Dt=e=>{if(Y(e))return-2;let r=e.state;return r.window&&(r.window=null),e.state=null,0};var St=(e,r)=>{let t=r.length,a,i,n;return Y(e)||(a=e.state,a.wrap!==0&&a.mode!==se)?-2:a.mode===se&&(i=1,i=oe(i,r,t,0),i!==a.check)?-3:(n=Yt(e,r,t,t),n?(a.mode=Ie,-4):(a.havedict=1,0))},Zr=class{constructor(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}};var $r=e=>{let r=new Uint8Array(e.reduce((a,i)=>a+i.length,0)),t=0;for(let a of e)r.set(a,t),t+=a.length;return r};var Ut=Object.prototype.toString,Vr={chunkSize:1024*64,windowBits:15,raw:!1,dictionary:new Uint8Array(0)},ce=class{options;err;msg;ended;started;chunks;strm;result;constructor(e={}){this.options=Object.assign({},Vr,e);let r=this.options;r.raw&&r.windowBits>=0&&r.windowBits<16&&(r.windowBits=-r.windowBits,r.windowBits===0&&(r.windowBits=-15)),r.windowBits>=0&&r.windowBits<16&&!e.windowBits&&(r.windowBits+=32),r.windowBits>15&&r.windowBits<48&&(r.windowBits&15)===0&&(r.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.started=!1,this.chunks=[],this.result=new Uint8Array(0),this.strm=new Zr,this.strm.avail_out=0;let t=Br(this.strm,r.windowBits);if(t!==0)throw new Error(we[t]);Ut.call(r.dictionary)==="[object ArrayBuffer]"&&(r.dictionary=new Uint8Array(r.dictionary));let a=r.dictionary;if(r.raw&&a.length&&(t=St(this.strm,a),t!==0))throw new Error(we[t])}push(e,r=!1){let t=this.strm,a=this.options.chunkSize,i,n,l;if(this.ended)return this.err===0;for(typeof r=="number"?n=r:n=r===!0?4:0,Ut.call(e)==="[object ArrayBuffer]"?t.input=new Uint8Array(e):t.input=e,t.next_in=0,t.avail_in=t.input.length,this.started||(this.started=!0,this.onStart(t));;){if(t.avail_out===0&&(t.output=new Uint8Array(a),t.next_out=0,t.avail_out=a),i=Ae(t,n),i===2){let c=this.options.dictionary;c.length&&(i=St(t,c),i===0?i=Ae(t,n):i===-3&&(i=2))}for(;t.avail_in>0&&i===1&&t.state.wrap&2&&t.state.flags!==0&&t.input[t.next_in]!==0;)Wt(t),i=Ae(t,n);if(i===-2||i===-3||i===2||i===-4)break;if(l=t.avail_out,t.next_out&&(t.avail_out===0||i===1||n>0)&&(this.onData(t.output.length===t.next_out?t.output:t.output.subarray(0,t.next_out)),t.avail_out=0,t.next_out=0),!((i===0||i===-5)&&l===0)){if(i===1){i=Dt(this.strm);break}if(t.avail_in===0){if(n===4){i=Dt(this.strm),i===0&&(i=-5);break}return!0}}}return this.err=i,this.msg=t.msg||we[i],this.ended=!0,this.onEnd(i),i===0}onStart(e){}onData(e){this.chunks.push(e)}onEnd(e){e===0&&(this.result=$r(this.chunks)),this.chunks=[]}};function Gr(e,r={}){let t=new ce(r);if(t.push(e,!0),t.err)throw new Error(t.msg);let a=t.result;return r.toText?new TextDecoder().decode(a):a}function Xt(e,r={}){return Gr(e,{...r,raw:!0})}var qr=(()=>{let e=new Uint32Array(256);for(let r=0;r<256;r+=1){let t=r;for(let a=0;a<8;a+=1)t=t&1?3988292384^t>>>1:t>>>1;e[r]=t>>>0}return e})(),Me=(e,r)=>(qr[(e^r)&255]^e>>>8)>>>0,J=class{state=4294967295;update(r){let t=this.state;for(let a=0;a<r.length;a+=1)t=Me(t,r[a]);this.state=t}digest(){return(this.state^4294967295)>>>0}},Be=e=>{let r=new J;return r.update(e),r.digest()},T=e=>(e<<1^(e&128?27:0))&255,M=(()=>{let e=new Uint8Array(256),r=new Uint8Array(256),t=new Uint8Array(256),a=1;for(let n=0;n<255;n+=1)r[n]=a,t[a]=n,a=(a^T(a))&255;let i=n=>n===0?0:r[(255-t[n])%255];for(let n=0;n<256;n+=1){let l=i(n),c=l;for(let d=0;d<4;d+=1)l=(l<<1|l>>7)&255,c^=l;e[n]=(c^99)&255}return e})(),Kr=(()=>{let e=new Uint8Array(11),r=1;for(let t=1;t<=10;t+=1)e[t]=r,r=T(r);return e})(),Wr=e=>{let r=e.length/4,t=r+6,a=4*(t+1),i=new Uint8Array(a*4);i.set(e);for(let n=r;n<a;n+=1){let l=i[(n-1)*4],c=i[(n-1)*4+1],d=i[(n-1)*4+2],o=i[(n-1)*4+3];if(n%r===0){let s=l;l=M[c]^Kr[n/r],c=M[d],d=M[o],o=M[s]}else r>6&&n%r===4&&(l=M[l],c=M[c],d=M[d],o=M[o]);i[n*4]=i[(n-r)*4]^l,i[n*4+1]=i[(n-r)*4+1]^c,i[n*4+2]=i[(n-r)*4+2]^d,i[n*4+3]=i[(n-r)*4+3]^o}return{w:i,rounds:t}},Yr=({w:e,rounds:r},t)=>{let a=t.slice(0,16),i=n=>{for(let l=0;l<16;l+=1)a[l]^=e[n*16+l]};i(0);for(let n=1;n<=r;n+=1){for(let c=0;c<16;c+=1)a[c]=M[a[c]];let l=a[1];if(a[1]=a[5],a[5]=a[9],a[9]=a[13],a[13]=l,l=a[2],a[2]=a[10],a[10]=l,l=a[6],a[6]=a[14],a[14]=l,l=a[3],a[3]=a[15],a[15]=a[11],a[11]=a[7],a[7]=l,n!==r)for(let c=0;c<4;c+=1){let d=c*4,o=a[d],s=a[d+1],w=a[d+2],f=a[d+3];a[d]=T(o)^(T(s)^s)^w^f,a[d+1]=o^T(s)^(T(w)^w)^f,a[d+2]=o^s^T(w)^(T(f)^f),a[d+3]=T(o)^o^s^w^T(f)}i(n)}return a};var Xr=(e,r)=>{let t=Wr(r),a=new Uint8Array(e.length),i=new Uint8Array(16);for(let n=0,l=1;n<e.length;n+=16,l+=1){i.fill(0);for(let o=l,s=0;o>0&&s<16;o=Math.floor(o/256),s+=1)i[s]=o&255;let c=Yr(t,i),d=Math.min(16,e.length-n);for(let o=0;o<d;o+=1)a[n+o]=e[n+o]^c[o]}return a},He=class{k0=305419896;k1=591751049;k2=878082192;constructor(r){for(let t of r)this.update(t)}update(r){this.k0=Me(this.k0,r),this.k1=this.k1+(this.k0&255)>>>0,this.k1=Math.imul(this.k1,134775813)+1>>>0,this.k2=Me(this.k2,this.k1>>>24)}streamByte(){let r=(this.k2|2)&65535;return r*(r^1)>>>8&255}},jt=(e,r)=>{let t=new He(r),a=new Uint8Array(e.length);for(let i=0;i<e.length;i+=1){let n=(e[i]^t.streamByte())&255;t.update(n),a[i]=n}return{plaintext:a.subarray(12),checkByte:a[11]}};var jr={1:{saltLength:8,keyLength:16},2:{saltLength:12,keyLength:24},3:{saltLength:16,keyLength:32}},Fe=e=>{let r=new DataView(e);for(let t=0;t+4<=e.byteLength;){let a=r.getUint16(t,!0),i=r.getUint16(t+2,!0),n=t+4+i;if(n>e.byteLength)return null;if(a===39169)return i<7?null:{strength:r.getUint8(t+4+4),actualMethod:r.getUint16(t+4+5,!0)};t=n}return null},de=e=>{let r=new Uint8Array(e.byteLength);return r.set(e),r.buffer},Jr=async(e,r,t)=>{let a=globalThis.crypto.subtle,i=await a.importKey("raw",de(e),"PBKDF2",!1,["deriveBits"]),n=new Uint8Array(await a.deriveBits({name:"PBKDF2",salt:de(r),iterations:1e3,hash:"SHA-1"},i,(t*2+2)*8));return{encKey:n.subarray(0,t),authKey:n.subarray(t,t*2),verify:n.subarray(t*2,t*2+2)}},Qr=async(e,r)=>{let t=globalThis.crypto.subtle,a=await t.importKey("raw",de(e),{name:"HMAC",hash:"SHA-1"},!1,["sign"]);return new Uint8Array(await t.sign("HMAC",a,de(r)))},F=class extends Error{constructor(t){super(t);this.reason=t}reason},Jt=async(e,r,t)=>{let a=jr[t];if(!a)throw new F("UNSUPPORTED");let{saltLength:i,keyLength:n}=a;if(e.length<i+12)throw new F("BAD_MAC");let l=e.subarray(0,i),c=e.subarray(i,i+2),d=e.subarray(e.length-10),o=e.subarray(i+2,e.length-10),{encKey:s,authKey:w,verify:f}=await Jr(r,l,n);if(f[0]!==c[0]||f[1]!==c[1])throw new F("WRONG_PASSWORD");let h=await Qr(w,o),v=d.length===10;for(let x=0;x<10;x+=1)h[x]!==d[x]&&(v=!1);if(!v)throw new F("BAD_MAC");return Xr(o,s)};var tr=1347092738,Ve=1347093252,Ze=1347093766,ea=1347094280,ta=1347094022,ra=1347094023,G=4294967295,H=65535,_=class extends Error{code;constructor(r,t="UNKNOWN"){super(r),this.name=this.constructor.name,this.code=t}},aa=e=>{switch(e.reason){case"WRONG_PASSWORD":return new _("Incorrect password (AES)","WRONG_PASSWORD");case"UNSUPPORTED":return new _("Unsupported AES key strength","UNSUPPORTED_ENCRYPTION");default:return new _("AES authentication failed (corrupt data or wrong password)","DECRYPTION_FAILED")}},rr=(e,r)=>{if(e<200||e>=300)throw new _(`Could not fetch remote ZIP at ${r}: HTTP status ${e}`,"HTTP_ERROR")},he=(e,r,t,a,i,n="RANGE_RESPONSE_MISMATCH")=>{if(rr(e.status,r),e.status!==206)throw new _(`Server did not honour Range request for ${r}: HTTP status ${e.status}`,"RANGE_NOT_SUPPORTED");let l=e.headers.get("content-range"),c=l?.match(/^bytes (\d+)-(\d+)\/(\d+)$/);if(!c)throw new _(`Invalid or missing Content-Range from ${r}: ${l??"missing"}`,"RANGE_RESPONSE_MISMATCH");let d=Number(c[1]),o=Number(c[2]),s=Number(c[3]);if(d!==t||s!==i)throw new _(`Unexpected Content-Range from ${r}: ${l}`,"RANGE_RESPONSE_MISMATCH");if(o!==a)throw new _(`Truncated Range response from ${r}: expected ${t}-${a}, got ${l}`,o<a?n:"RANGE_RESPONSE_MISMATCH")},$e=class{contentLength;url;centralDirectoryRecords;endOfCentralDirectory;method;credentials;redirect;signal;timeoutMs;requestInit;constructor({contentLength:r,url:t,centralDirectoryRecords:a,endOfCentralDirectory:i,method:n,credentials:l="same-origin",redirect:c,signal:d,timeoutMs:o,requestInit:s}){this.contentLength=r,this.url=t,this.method=n,this.centralDirectoryRecords=a,this.endOfCentralDirectory=i,this.credentials=l,this.redirect=c,this.signal=d,this.timeoutMs=o,this.requestInit=s}requestInitFor(r,t,a){let i=[];return this.signal&&i.push(this.signal),a?.signal&&i.push(a.signal),ar({credentials:this.credentials,redirect:this.redirect,signal:i.length<=1?i[0]:AbortSignal.any(i),timeoutMs:a?.timeoutMs??this.timeoutMs,requestInit:this.requestInit},r,t)}files(){return this.centralDirectoryRecords.map(r=>({filename:r.data.filename,size:r.data.uncompressedSize,modified:ir(r.data.lastModifiedDate,r.data.lastModifiedTime),attributes:r.data.externalFileAttributes}))}async fetch(r,t,a){let{file:i,response:n}=await this.fetchEntryResponse(r,t,a),l=er(await n.arrayBuffer(),i.data.compressedSize);if(!l)throw new _("cannot parse local file header in remote ZIP","LOCAL_HEADER_PARSE_FAILED");return na(i,l),this.decodeEntry(i,new Uint8Array(l.meta.compressedData),l.data.compressionMethod,a)}async decodeEntry(r,t,a,i){let n=t,l=a,c=r.data.generalPurposeBitFlag;if(c&1){if(c&64)throw new _("Strong-encrypted ZIP entries are not supported","UNSUPPORTED_ENCRYPTION");if(!i?.password)throw new _(`Password required for encrypted entry: ${r.data.filename}`,"UNSUPPORTED_ENCRYPTION");let s=new TextEncoder().encode(i.password),w=l===99?Fe(r.data.extraField):null;if(w){try{n=await Jt(n,s,w.strength)}catch(f){throw f instanceof F?aa(f):new _(`AES decryption failed: ${String(f)}`,"DECRYPTION_FAILED")}l=w.actualMethod}else{let{plaintext:f,checkByte:h}=jt(n,s),v=c&8?r.data.lastModifiedTime>>8&255:r.data.crc32>>>24&255;if(h!==v)throw new _(`Incorrect password for entry: ${r.data.filename}`,"WRONG_PASSWORD");n=f}}let d=i?.maxUncompressedSize,o;if(l===0){if(d!==void 0&&n.byteLength>d)throw new _(`Uncompressed size exceeds maxUncompressedSize (${d} bytes)`,"DECOMPRESSION_LIMIT_EXCEEDED");o=n}else o=oa(n,d);if(i?.verifyCrc){let s=Be(o);if(s!==r.data.crc32)throw new _(`CRC-32 mismatch for ${r.data.filename}: expected ${r.data.crc32}, got ${s}`,"CRC_MISMATCH")}return o}async fetchStream(r,t,a){let{file:i,response:n}=await this.fetchEntryResponse(r,t,a);if(!n.body)throw new _("Remote ZIP response has no body to stream","LOCAL_HEADER_PARSE_FAILED");if(i.data.generalPurposeBitFlag&1){let d=er(await n.arrayBuffer(),i.data.compressedSize);if(!d)throw new _("cannot parse local file header in remote ZIP","LOCAL_HEADER_PARSE_FAILED");let o=await this.decodeEntry(i,new Uint8Array(d.meta.compressedData),d.data.compressionMethod,a);return new ReadableStream({start(s){s.enqueue(o),s.close()}})}let l=n.body.getReader(),c=sa(l,{compressedSize:i.data.compressedSize,compressionMethod:i.data.compressionMethod,expectedFilename:i.data.filename,expectedFlags:i.data.generalPurposeBitFlag,maxBytes:a?.maxUncompressedSize,expectedCrc:a?.verifyCrc?i.data.crc32:void 0});return new ReadableStream({async pull(d){try{let{done:o,value:s}=await c.next();o?d.close():d.enqueue(s)}catch(o){await l.cancel(o),d.error(o)}},async cancel(d){await l.cancel(d)}})}async fetchEntryResponse(r,t,a){let i=this.centralDirectoryRecords.find(v=>v.data.filename===r);if(!i)throw new _(`File not found in remote ZIP: ${r}`,"FILE_NOT_FOUND");ia(i);let n=i.data.localFileHeaderRelativeOffset;if(n+30>this.contentLength)throw new _(`Local file header is out of bounds for ${i.data.filename}`,"INVALID_ARCHIVE");let c=await(await this.fetchRange(n,n+29,t,a,"LOCAL_HEADER_PARSE_FAILED")).arrayBuffer(),d=new DataView(c);if(d.getUint32(0)!==Ve)throw new _("cannot parse local file header in remote ZIP","LOCAL_HEADER_PARSE_FAILED");let o=d.getUint16(6,!0),s=d.getUint16(8,!0);if(o!==i.data.generalPurposeBitFlag||s!==i.data.compressionMethod)throw new _(`Local header disagrees with central directory for ${i.data.filename}`,"INVALID_ARCHIVE");let w=30+d.getUint16(26,!0)+d.getUint16(28,!0),f=n+w+i.data.compressedSize;if(f>this.contentLength)throw new _(`Entry data is out of bounds for ${i.data.filename}`,"INVALID_ARCHIVE");let h=await this.fetchRange(n,f-1,t,a,"TRUNCATED_ENTRY");return{file:i,response:h}}async fetchRange(r,t,a,i,n){let l=new Headers(a);l.set("Range",`bytes=${r}-${t}`);let c=await fetch(this.url.toString(),this.requestInitFor(this.method,l,i));return he(c,this.url,r,t,this.contentLength,n),c}},ia=e=>{let{compressionMethod:r,generalPurposeBitFlag:t}=e.data;if(r===99){let a=Fe(e.data.extraField);if(!(t&1)||!a)throw new _(`Invalid WinZip AES metadata for ${e.data.filename}`,"INVALID_ARCHIVE");if(a.actualMethod!==0&&a.actualMethod!==8)throw new _(`Unsupported compression method ${a.actualMethod} for ${e.data.filename}`,"UNSUPPORTED_COMPRESSION");return}if(r!==0&&r!==8)throw new _(`Unsupported compression method ${r} for ${e.data.filename}`,"UNSUPPORTED_COMPRESSION")},na=(e,r)=>{if(r.data.filename!==e.data.filename||r.data.generalPurposeBitFlag!==e.data.generalPurposeBitFlag||r.data.compressionMethod!==e.data.compressionMethod)throw new _(`Local header disagrees with central directory for ${e.data.filename}`,"INVALID_ARCHIVE")},oa=(e,r)=>{if(r===void 0)try{return Xt(e)}catch(d){throw new _(`Failed to inflate remote ZIP entry: ${String(d)}`,"UNKNOWN")}let t=new ce({raw:!0}),a=[],i=0,n=!1;if(t.onData=d=>{if(n)return;let o=d;if(i+=o.length,i>r){n=!0;return}a.push(o)},t.push(e,!0),n)throw new _(`Decompressed size exceeds maxUncompressedSize (${r} bytes)`,"DECOMPRESSION_LIMIT_EXCEEDED");if(t.err)throw new _(`Failed to inflate remote ZIP entry: ${t.msg}`,"UNKNOWN");let l=new Uint8Array(i),c=0;for(let d of a)l.set(d,c),c+=d.length;return l};async function*sa(e,r){let{compressedSize:t,compressionMethod:a,expectedFilename:i,expectedFlags:n,maxBytes:l,expectedCrc:c}=r,d=c!==void 0?new J:void 0,o=new Uint8Array(0),s=m=>{let y=new Uint8Array(o.length+m.length);y.set(o),y.set(m,o.length),o=y},w=async m=>{for(;o.length<m;){let{done:y,value:D}=await e.read();if(y)throw new _("Truncated local file header in remote ZIP","LOCAL_HEADER_PARSE_FAILED");s(D)}};await w(30);let f=new DataView(o.buffer,o.byteOffset,o.byteLength);if(f.getUint32(0)!==Ve)throw new _("cannot parse local file header in remote ZIP","LOCAL_HEADER_PARSE_FAILED");let h=30+f.getUint16(26,!0)+f.getUint16(28,!0);await w(h);let v=f.getUint16(26,!0),x=fe(o.buffer.slice(o.byteOffset+30,o.byteOffset+30+v),Ge(n));if(f.getUint16(6,!0)!==n||f.getUint16(8,!0)!==a||x!==i)throw new _(`Local header disagrees with central directory for ${i}`,"INVALID_ARCHIVE");let A=0,E=[],g=m=>{if(A+=m.length,l!==void 0&&A>l)throw new _(`Decompressed size exceeds maxUncompressedSize (${l} bytes)`,"DECOMPRESSION_LIMIT_EXCEEDED");d?.update(m),E.push(m)},u=a===0?void 0:new ce({raw:!0});u&&(u.onData=m=>g(m));let b=t,S=m=>{let y=m.length>b?m.subarray(0,b):m;if(b-=y.length,u){if(u.push(y,b===0),u.err)throw new _(`Failed to inflate remote ZIP entry: ${u.msg}`,"UNKNOWN")}else g(y)};for(S(o.subarray(h)),yield*E.splice(0);b>0;){let{done:m,value:y}=await e.read();if(m)break;S(y),yield*E.splice(0)}if(b!==0)throw new _(`Truncated compressed data for ${i}`,"TRUNCATED_ENTRY");if(d&&d.digest()!==c)throw new _(`CRC-32 mismatch: expected ${c}, got ${d.digest()}`,"CRC_MISMATCH")}var la=(e,r)=>{let t=[];if(e&&t.push(e),r!==void 0&&t.push(AbortSignal.timeout(r)),t.length!==0)return t.length===1?t[0]:AbortSignal.any(t)},ar=(e,r,t)=>{let a=new Headers(e.requestInit?.headers);return t&&t.forEach((i,n)=>a.set(n,i)),{...e.requestInit,method:r,headers:a,redirect:e.redirect??e.requestInit?.redirect??"follow",credentials:e.credentials,signal:la(e.signal,e.timeoutMs)}},Qt=class{url;headUrl;additionalHeaders;method;credentials;redirect;signal;timeoutMs;requestInit;constructor({url:r,headUrl:t,additionalHeaders:a,method:i="GET",credentials:n="same-origin",redirect:l,signal:c,timeoutMs:d,requestInit:o}){this.url=r,this.headUrl=t??r,this.additionalHeaders=a,this.method=i,this.credentials=n,this.redirect=l,this.signal=c,this.timeoutMs=d,this.requestInit=o}requestInitFor(r,t){return ar({credentials:this.credentials,redirect:this.redirect,signal:this.signal,timeoutMs:this.timeoutMs,requestInit:this.requestInit},r,t)}async populate(){let r=await fetch(this.headUrl.toString(),this.requestInitFor("HEAD",this.additionalHeaders));rr(r.status,this.headUrl);let t=r.headers.get("content-length");if(!t)throw new _("Could not get Content-Length of URL","CONTENT_LENGTH_MISSING");if(!/^\d+$/.test(t))throw new _(`Invalid Content-Length: ${t}`,"INVALID_CONTENT_LENGTH");let a=Number(t);if(!Number.isSafeInteger(a)||a<22)throw new _(`Invalid Content-Length: ${t}`,"INVALID_CONTENT_LENGTH");let{eocd:i,cdOffset:n,cdSize:l,cdCount:c}=await this.fetchEndOfCentralDirectory(a,this.additionalHeaders),d=await this.fetchCentralDirectoryRecords(n,l,c,a,this.additionalHeaders);return new $e({url:this.url,contentLength:a,endOfCentralDirectory:i,centralDirectoryRecords:d,method:this.method,credentials:this.credentials,redirect:this.redirect,signal:this.signal,timeoutMs:this.timeoutMs,requestInit:this.requestInit})}async fetchEndOfCentralDirectory(r,t){let i=[128,65577];for(let n of i){let l=Math.max(0,r-n),c=new Headers(t);c.set("Range",`bytes=${l}-${r-1}`);let d=await fetch(this.url.toString(),this.requestInitFor(this.method,c));he(d,this.url,l,r-1,r);let o=await d.arrayBuffer(),s=wa(o);if(s){let w=s.data.centralDirectoryByteOffset,f=s.data.centralDirectoryByteSize,h=s.data.centralDirectoryRecordCount;if(s.data.diskNumber!==0&&s.data.diskNumber!==H||s.data.cdDisk!==0&&s.data.cdDisk!==H||s.data.centralDirectoryDiskNumber!==h&&s.data.centralDirectoryDiskNumber!==H&&h!==H)throw new _("Multi-disk ZIP archives are not supported","UNSUPPORTED_MULTI_DISK");if(ca(s)){let v=da(o);if(!v){if(n!==i[i.length-1]&&l>0)continue;throw new _("ZIP64 EOCD locator not found","UNSUPPORTED_ZIP64")}if(v.diskWithZip64EOCD!==0||v.totalDisks!==1)throw new _("Multi-disk ZIP archives are not supported","UNSUPPORTED_MULTI_DISK");let x=await this.fetchZip64EOCD(v.zip64EOCDOffset,r,t);if(x.diskNumber!==0||x.cdDisk!==0||x.centralDirectoryDiskRecordCount!==x.centralDirectoryRecordCount)throw new _("Multi-disk ZIP archives are not supported","UNSUPPORTED_MULTI_DISK");w=x.centralDirectoryByteOffset,f=x.centralDirectoryByteSize,h=x.centralDirectoryRecordCount}if(w+f>r)throw new _(`Central directory is out of bounds (offset ${w}, size ${f}, archive ${r} bytes)`,"CENTRAL_DIRECTORY_OUT_OF_BOUNDS");return{eocd:s,cdOffset:w,cdSize:f,cdCount:h}}if(l===0)break}throw new _("Could not get EOCD record of remote ZIP","EOCD_NOT_FOUND")}async fetchZip64EOCD(r,t,a){if(r+56>t)throw new _("ZIP64 EOCD offset is out of bounds","INVALID_ARCHIVE");let i=new Headers(a);i.set("Range",`bytes=${r}-${r+55}`);let n=await fetch(this.url.toString(),this.requestInitFor(this.method,i));he(n,this.url,r,r+55,t);let l=ha(await n.arrayBuffer());if(!l)throw new _("ZIP64 EOCD record not found","UNSUPPORTED_ZIP64");return l}async fetchCentralDirectoryRecords(r,t,a,i,n){if(t===0){if(a!==0)throw new _("Central directory record count does not match its size","INVALID_ARCHIVE");return[]}let l=new Headers(n);l.set("Range",`bytes=${r}-${r+t-1}`);let c=await fetch(this.url.toString(),this.requestInitFor(this.method,l));he(c,this.url,r,r+t-1,i);let d=await c.arrayBuffer(),o=ua(d);if(o.length!==a)throw new _(`Central directory contains ${o.length} records; expected ${a}`,"INVALID_ARCHIVE");if(o.some(s=>s.data.startingDiskNumber!==0))throw new _("Multi-disk ZIP archives are not supported","UNSUPPORTED_MULTI_DISK");return o}},ir=(e,r)=>{let t=e&31||1,a=e>>5&15||1,i=(e>>9&127)+1980,n=r>>11&31,l=r>>5&63,c=(r&31)<<1,d=s=>s.toString().padStart(2,"0"),o=`${i}-${d(a)}-${d(t)}T${d(n)}:${d(l)}:${d(c)}`;return Number.isNaN(Date.parse(o))?ir(0,0):o},ca=e=>e.data.diskNumber===H||e.data.cdDisk===H||e.data.centralDirectoryDiskNumber===H||e.data.centralDirectoryRecordCount===H||e.data.centralDirectoryByteSize===G||e.data.centralDirectoryByteOffset===G,Z=(e,r)=>{let t=e.getBigUint64(r,!0);if(t>BigInt(Number.MAX_SAFE_INTEGER))throw new _(`ZIP64 value ${t} exceeds Number.MAX_SAFE_INTEGER`,"UNSUPPORTED_ZIP64");return Number(t)},nr=(e,r)=>{let t=new DataView(e);for(let a=0;a+4<=e.byteLength;){let i=t.getUint16(a,!0),n=t.getUint16(a+2,!0),l=a+4,c=l+n;if(c>e.byteLength)throw new _("Truncated ZIP extra field","INVALID_ARCHIVE");if(i===1){let d={},o=l,s=(r.uncompressed?8:0)+(r.compressed?8:0)+(r.offset?8:0)+(r.disk?4:0);if(n<s)throw new _("ZIP64 extra field is missing required values","INVALID_ARCHIVE");return r.uncompressed&&(d.uncompressedSize=Z(t,o),o+=8),r.compressed&&(d.compressedSize=Z(t,o),o+=8),r.offset&&(d.localHeaderOffset=Z(t,o),o+=8),r.disk&&(d.diskStart=t.getUint32(o,!0)),d}a=c}throw new _("ZIP64 sentinel has no ZIP64 extra field","INVALID_ARCHIVE")},da=e=>{let r=new DataView(e);for(let t=e.byteLength-20;t>=0;t-=1)if(r.getUint32(t)===ra)return{diskWithZip64EOCD:r.getUint32(t+4,!0),zip64EOCDOffset:Z(r,t+8),totalDisks:r.getUint32(t+16,!0)};return null},ha=e=>{let r=new DataView(e);for(let t=0;t<=e.byteLength-56;t+=1)if(r.getUint32(t)===ta)return{diskNumber:r.getUint32(t+16,!0),cdDisk:r.getUint32(t+20,!0),centralDirectoryDiskRecordCount:Z(r,t+24),centralDirectoryRecordCount:Z(r,t+32),centralDirectoryByteSize:Z(r,t+40),centralDirectoryByteOffset:Z(r,t+48)};return null},fa="\xC7\xFC\xE9\xE2\xE4\xE0\xE5\xE7\xEA\xEB\xE8\xEF\xEE\xEC\xC4\xC5\xC9\xE6\xC6\xF4\xF6\xF2\xFB\xF9\xFF\xD6\xDC\xA2\xA3\xA5\u20A7\u0192\xE1\xED\xF3\xFA\xF1\xD1\xAA\xBA\xBF\u2310\xAC\xBD\xBC\xA1\xAB\xBB\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556\u2555\u2563\u2551\u2557\u255D\u255C\u255B\u2510\u2514\u2534\u252C\u251C\u2500\u253C\u255E\u255F\u255A\u2554\u2569\u2566\u2560\u2550\u256C\u2567\u2568\u2564\u2565\u2559\u2558\u2552\u2553\u256B\u256A\u2518\u250C\u2588\u2584\u258C\u2590\u2580\u03B1\xDF\u0393\u03C0\u03A3\u03C3\xB5\u03C4\u03A6\u0398\u03A9\u03B4\u221E\u03C6\u03B5\u2229\u2261\xB1\u2265\u2264\u2320\u2321\xF7\u2248\xB0\u2219\xB7\u221A\u207F\xB2\u25A0\xA0",fe=(e,r)=>{if(r)return new TextDecoder().decode(e);let t="";for(let a of new Uint8Array(e))t+=a<128?String.fromCharCode(a):fa[a-128];return t},Ge=e=>!!(e>>11&1),ua=e=>{let r=[],t=new DataView(e),a=0;for(;a+4<=e.byteLength;){let i=t.getUint32(a);if(i===Ze)break;if(i!==tr)throw new _(`Unexpected data in central directory at offset ${a}`,"INVALID_ARCHIVE");let n=_a(e.slice(a));if(!n)throw new _(`Truncated central directory record at offset ${a}`,"INVALID_ARCHIVE");r.push(n),a+=n.meta.length}if(a!==e.byteLength&&(a+4>e.byteLength||t.getUint32(a)!==Ze))throw new _("Truncated central directory","INVALID_ARCHIVE");return r},_a=e=>{let t=new DataView(e);for(let a=0;a<=e.byteLength-46;a+=1)if(t.getInt32(a)===tr){let i=t.getUint16(a+28,!0),n=t.getUint16(a+30,!0),l=t.getUint16(a+32,!0),c=46+i+n+l;if(a+c>e.byteLength)throw new _("Truncated central directory record","INVALID_ARCHIVE");let d=t.getUint32(a+20,!0),o=t.getUint32(a+24,!0),s=t.getUint16(a+34,!0),w=t.getUint32(a+42,!0),f=e.slice(a+46+i,a+46+i+n),h={uncompressed:o===G,compressed:d===G,offset:w===G,disk:s===H},v=h.uncompressed||h.compressed||h.offset||h.disk?nr(f,h):{},x=Ge(t.getUint16(a+8,!0));return{meta:{length:c},data:{signature:e.slice(a,a+4),versionMadeBy:t.getUint16(a+4,!0),versionToExtract:t.getUint16(a+6,!0),generalPurposeBitFlag:t.getUint16(a+8,!0),compressionMethod:t.getUint16(a+10,!0),lastModifiedTime:t.getUint16(a+12,!0),lastModifiedDate:t.getUint16(a+14,!0),crc32:t.getUint32(a+16,!0),compressedSize:v.compressedSize??d,uncompressedSize:v.uncompressedSize??o,filenameLength:i,extraFieldLength:n,fileCommentLength:l,startingDiskNumber:v.diskStart??s,internalFileAttributes:t.getUint16(a+36,!0),externalFileAttributes:t.getUint32(a+38,!0),localFileHeaderRelativeOffset:v.localHeaderOffset??w,filename:fe(e.slice(a+46,a+46+i),x),extraField:f,fileComment:fe(e.slice(a+46+i+n,a+46+i+n+l),x)}}}return null},wa=e=>{let t=new DataView(e),a=new TextDecoder;for(let i=e.byteLength-22;i>=0;i-=1)if(t.getUint32(i)===Ze){let n=t.getUint16(i+20,!0);if(i+22+n!==e.byteLength)continue;return{meta:{},data:{signature:e.slice(i,i+4),diskNumber:t.getUint16(i+4,!0),cdDisk:t.getUint16(i+6,!0),centralDirectoryDiskNumber:t.getUint16(i+8,!0),centralDirectoryRecordCount:t.getUint16(i+10,!0),centralDirectoryByteSize:t.getUint32(i+12,!0),centralDirectoryByteOffset:t.getUint32(i+16,!0),commentLength:n,comment:a.decode(e.slice(i+22,i+22+n))}}}return null},er=(e,r=0)=>{let a=new DataView(e);for(let i=0;i<=e.byteLength-30;i+=1)if(a.getUint32(i)===Ve){let n=a.getUint16(i+26,!0),l=a.getUint16(i+28,!0),c=a.getUint16(i+6,!0),d=!!(c>>3&1),o=i+30+n+l;if(o>e.byteLength)throw new _("Truncated local file header","INVALID_ARCHIVE");let s=a.getUint32(i+18,!0),w=a.getUint32(i+22,!0),f=e.slice(i+30+n,o),h={uncompressed:w===G,compressed:s===G,offset:!1,disk:!1},v=h.uncompressed||h.compressed?nr(f,h):{},x=v.compressedSize??s,A=v.uncompressedSize??w,g=o+(d?r:x);if(g>e.byteLength)throw new _("Truncated local file data","TRUNCATED_ENTRY");let u=d&&g+4<=e.byteLength&&a.getUint32(g)===ea,b=u?4:0,S=g+b;return{meta:{dataDescriptor:d&&S+12<=e.byteLength?{optionalSignature:u?e.slice(g,g+b):void 0,crc32:a.getUint32(S,!0),compressedSize:a.getUint32(S+4,!0),uncompressedSize:a.getUint32(S+8,!0)}:void 0,compressedData:d?e.slice(o,g):e.slice(o,o+x)},data:{signature:e.slice(i,i+4),versionToExtract:a.getUint16(i+4,!0),generalPurposeBitFlag:a.getUint16(i+6,!0),compressionMethod:a.getUint16(i+8,!0),lastModifiedTime:a.getUint16(i+10,!0),lastModifiedDate:a.getUint16(i+12,!0),crc32:a.getUint32(i+14,!0),compressedSize:x,uncompressedSize:A,filenameLength:n,extraFieldLength:l,filename:fe(e.slice(i+30,i+30+n),Ge(c)),extraField:f}}}return null};export{$e as RemoteZip,_ as RemoteZipError,Qt as RemoteZipPointer,Be as crc32,fe as decodeZipString,ca as isZip64,ua as parseAllCDs,_a as parseOneCD,wa as parseOneEOCD,er as parseOneLocalFile,ha as parseZip64EOCD,da as parseZip64EOCDLocator,ir as parseZipDatetime};
|
|
7
2
|
//# sourceMappingURL=index.mjs.map
|