pwaLUPMIS2/dist/assets/pako-n3Pgozwg.js
ekke 8d1d874ad7 Shapefile export: write the format ourselves instead of shp-write
Choosing Shapefile in the Export GIS modal produced no file. shp-write@0.3.2
cannot run in this build, in three separate ways: its dbf dependency assigns an
undeclared variable, which was fine in the browserify bundle it was written for
but is a ReferenceError under the strict mode ES modules always use; its zip.js
branches on process.browser, which does not exist in a browser; and its
download.js delivers the archive by navigating to a data:application/zip URL,
which Chromium blocks in the top frame.

- src/shapefile-write.js writes .shp/.shx/.dbf/.prj/.cpg itself: geometries
  split by type into up to three layers, polygon rings re-wound clockwise as
  the format requires, DBF column types inferred per column, names sanitised
  to DBF's 10 characters and de-duplicated, UTF-8 declared via .cpg.
- src/zip-store.js holds the STORED-ZIP writer that was inside analysis/xlsx.js,
  so both writers share it. Pure-ASCII archives are byte-for-byte as before.
- shp-write, and with it dbf and JSZip 2.5.0, leave the dependency tree; the
  build no longer warns that node's "assert" was externalised.
- Service Worker v26 for the new bundle.

Verified in a browser: the Export GIS modal, driven through its own controls
with Web Mercator features, produced area_analysis.zip holding both layers with
WGS84 coordinates, file code 9994 and the right shape types. The archive reads
back through the application's own shpjs importer with geometries, numeric,
text and boolean attributes intact. The zonal-statistics .xlsx export, which now
shares the zip writer, still opens and reads correctly.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-23 13:40:00 +02:00

3 lines
21 KiB
JavaScript

function $(t){let i=t.length;for(;--i>=0;)t[i]=0}const tt=3,it=258,Le=29,nt=256,at=nt+1+Le,ze=30,ft=512,ot=new Array((at+2)*2);$(ot);const lt=new Array(ze*2);$(lt);const st=new Array(ft);$(st);const rt=new Array(it-tt+1);$(rt);const ct=new Array(Le);$(ct);const dt=new Array(ze);$(dt);const ht=(t,i,e,o)=>{let r=t&65535|0,n=t>>>16&65535|0,d=0;for(;e!==0;){d=e>2e3?2e3:e,e-=d;do r=r+i[o++]|0,n=n+r|0;while(--d);r%=65521,n%=65521}return r|n<<16|0};var ae=ht;const ut=()=>{let t,i=[];for(var e=0;e<256;e++){t=e;for(var o=0;o<8;o++)t=t&1?3988292384^t>>>1:t>>>1;i[e]=t}return i},wt=new Uint32Array(ut()),xt=(t,i,e,o)=>{const r=wt,n=o+e;t^=-1;for(let d=o;d<n;d++)t=t>>>8^r[(t^i[d])&255];return t^-1};var I=xt,fe={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"},He={Z_NO_FLUSH:0,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_DEFLATED:8};const _t=(t,i)=>Object.prototype.hasOwnProperty.call(t,i);var bt=function(t){const i=Array.prototype.slice.call(arguments,1);for(;i.length;){const e=i.shift();if(e){if(typeof e!="object")throw new TypeError(e+"must be non-object");for(const o in e)_t(e,o)&&(t[o]=e[o])}}return t},kt=t=>{let i=0;for(let o=0,r=t.length;o<r;o++)i+=t[o].length;const e=new Uint8Array(i);for(let o=0,r=0,n=t.length;o<n;o++){let d=t[o];e.set(d,r),r+=d.length}return e},Be={assign:bt,flattenChunks:kt};let Fe=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{Fe=!1}const z=new Uint8Array(256);for(let t=0;t<256;t++)z[t]=t>=252?6:t>=248?5:t>=240?4:t>=224?3:t>=192?2:1;z[254]=z[254]=1;var gt=t=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(t);let i,e,o,r,n,d=t.length,l=0;for(r=0;r<d;r++)e=t.charCodeAt(r),(e&64512)===55296&&r+1<d&&(o=t.charCodeAt(r+1),(o&64512)===56320&&(e=65536+(e-55296<<10)+(o-56320),r++)),l+=e<128?1:e<2048?2:e<65536?3:4;for(i=new Uint8Array(l),n=0,r=0;n<l;r++)e=t.charCodeAt(r),(e&64512)===55296&&r+1<d&&(o=t.charCodeAt(r+1),(o&64512)===56320&&(e=65536+(e-55296<<10)+(o-56320),r++)),e<128?i[n++]=e:e<2048?(i[n++]=192|e>>>6,i[n++]=128|e&63):e<65536?(i[n++]=224|e>>>12,i[n++]=128|e>>>6&63,i[n++]=128|e&63):(i[n++]=240|e>>>18,i[n++]=128|e>>>12&63,i[n++]=128|e>>>6&63,i[n++]=128|e&63);return i};const vt=(t,i)=>{if(i<65534&&t.subarray&&Fe)return String.fromCharCode.apply(null,t.length===i?t:t.subarray(0,i));let e="";for(let o=0;o<i;o++)e+=String.fromCharCode(t[o]);return e};var Et=(t,i)=>{const e=i||t.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(t.subarray(0,i));let o,r;const n=new Array(e*2);for(r=0,o=0;o<e;){let d=t[o++];if(d<128){n[r++]=d;continue}let l=z[d];if(l>4){n[r++]=65533,o+=l-1;continue}for(d&=l===2?31:l===3?15:7;l>1&&o<e;)d=d<<6|t[o++]&63,l--;if(l>1){n[r++]=65533;continue}d<65536?n[r++]=d:(d-=65536,n[r++]=55296|d>>10&1023,n[r++]=56320|d&1023)}return vt(n,r)},pt=(t,i)=>{i=i||t.length,i>t.length&&(i=t.length);let e=i-1;for(;e>=0&&(t[e]&192)===128;)e--;return e<0||e===0?i:e+z[t[e]]>i?e:i},oe={string2buf:gt,buf2string:Et,utf8border:pt};function yt(){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 At=yt;const K=16209,Rt=16191;var St=function(i,e){let o,r,n,d,l,y,a,f,S,x,s,u,m,g,_,p,b,c,E,T,h,A,v,w;const k=i.state;o=i.next_in,v=i.input,r=o+(i.avail_in-5),n=i.next_out,w=i.output,d=n-(e-i.avail_out),l=n+(i.avail_out-257),y=k.dmax,a=k.wsize,f=k.whave,S=k.wnext,x=k.window,s=k.hold,u=k.bits,m=k.lencode,g=k.distcode,_=(1<<k.lenbits)-1,p=(1<<k.distbits)-1;e:do{u<15&&(s+=v[o++]<<u,u+=8,s+=v[o++]<<u,u+=8),b=m[s&_];t:for(;;){if(c=b>>>24,s>>>=c,u-=c,c=b>>>16&255,c===0)w[n++]=b&65535;else if(c&16){E=b&65535,c&=15,c&&(u<c&&(s+=v[o++]<<u,u+=8),E+=s&(1<<c)-1,s>>>=c,u-=c),u<15&&(s+=v[o++]<<u,u+=8,s+=v[o++]<<u,u+=8),b=g[s&p];i:for(;;){if(c=b>>>24,s>>>=c,u-=c,c=b>>>16&255,c&16){if(T=b&65535,c&=15,u<c&&(s+=v[o++]<<u,u+=8,u<c&&(s+=v[o++]<<u,u+=8)),T+=s&(1<<c)-1,T>y){i.msg="invalid distance too far back",k.mode=K;break e}if(s>>>=c,u-=c,c=n-d,T>c){if(c=T-c,c>f&&k.sane){i.msg="invalid distance too far back",k.mode=K;break e}if(h=0,A=x,S===0){if(h+=a-c,c<E){E-=c;do w[n++]=x[h++];while(--c);h=n-T,A=w}}else if(S<c){if(h+=a+S-c,c-=S,c<E){E-=c;do w[n++]=x[h++];while(--c);if(h=0,S<E){c=S,E-=c;do w[n++]=x[h++];while(--c);h=n-T,A=w}}}else if(h+=S-c,c<E){E-=c;do w[n++]=x[h++];while(--c);h=n-T,A=w}for(;E>2;)w[n++]=A[h++],w[n++]=A[h++],w[n++]=A[h++],E-=3;E&&(w[n++]=A[h++],E>1&&(w[n++]=A[h++]))}else{h=n-T;do w[n++]=w[h++],w[n++]=w[h++],w[n++]=w[h++],E-=3;while(E>2);E&&(w[n++]=w[h++],E>1&&(w[n++]=w[h++]))}}else if((c&64)===0){b=g[(b&65535)+(s&(1<<c)-1)];continue i}else{i.msg="invalid distance code",k.mode=K;break e}break}}else if((c&64)===0){b=m[(b&65535)+(s&(1<<c)-1)];continue t}else if(c&32){k.mode=Rt;break e}else{i.msg="invalid literal/length code",k.mode=K;break e}break}}while(o<r&&n<l);E=u>>3,o-=E,u-=E<<3,s&=(1<<u)-1,i.next_in=o,i.next_out=n,i.avail_in=o<r?5+(r-o):5-(o-r),i.avail_out=n<l?257+(l-n):257-(n-l),k.hold=s,k.bits=u};const U=15,se=852,re=592,ce=0,J=1,de=2,mt=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]),Tt=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]),Dt=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]),It=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]),Ct=(t,i,e,o,r,n,d,l)=>{const y=l.bits;let a=0,f=0,S=0,x=0,s=0,u=0,m=0,g=0,_=0,p=0,b,c,E,T,h,A=null,v;const w=new Uint16Array(U+1),k=new Uint16Array(U+1);let Z=null,le,F,G;for(a=0;a<=U;a++)w[a]=0;for(f=0;f<o;f++)w[i[e+f]]++;for(s=y,x=U;x>=1&&w[x]===0;x--);if(s>x&&(s=x),x===0)return r[n++]=1<<24|64<<16|0,r[n++]=1<<24|64<<16|0,l.bits=1,0;for(S=1;S<x&&w[S]===0;S++);for(s<S&&(s=S),g=1,a=1;a<=U;a++)if(g<<=1,g-=w[a],g<0)return-1;if(g>0&&(t===ce||x!==1))return-1;for(k[1]=0,a=1;a<U;a++)k[a+1]=k[a]+w[a];for(f=0;f<o;f++)i[e+f]!==0&&(d[k[i[e+f]]++]=f);if(t===ce?(A=Z=d,v=20):t===J?(A=mt,Z=Tt,v=257):(A=Dt,Z=It,v=0),p=0,f=0,a=S,h=n,u=s,m=0,E=-1,_=1<<s,T=_-1,t===J&&_>se||t===de&&_>re)return 1;for(;;){le=a-m,d[f]+1<v?(F=0,G=d[f]):d[f]>=v?(F=Z[d[f]-v],G=A[d[f]-v]):(F=96,G=0),b=1<<a-m,c=1<<u,S=c;do c-=b,r[h+(p>>m)+c]=le<<24|F<<16|G|0;while(c!==0);for(b=1<<a-1;p&b;)b>>=1;if(b!==0?(p&=b-1,p+=b):p=0,f++,--w[a]===0){if(a===x)break;a=i[e+d[f]]}if(a>s&&(p&T)!==E){for(m===0&&(m=s),h+=S,u=a-m,g=1<<u;u+m<x&&(g-=w[u+m],!(g<=0));)u++,g<<=1;if(_+=1<<u,t===J&&_>se||t===de&&_>re)return 1;E=p&T,r[E]=s<<24|u<<16|h-n|0}}return p!==0&&(r[h+p]=a-m<<24|64<<16|0),l.bits=s,0};var L=Ct;const Ot=0,Ge=1,Ke=2,{Z_FINISH:he,Z_BLOCK:Zt,Z_TREES:P,Z_OK:N,Z_STREAM_END:Nt,Z_NEED_DICT:Mt,Z_STREAM_ERROR:D,Z_DATA_ERROR:Pe,Z_MEM_ERROR:je,Z_BUF_ERROR:Ut,Z_DEFLATED:ue}=He,W=16180,we=16181,xe=16182,_e=16183,be=16184,ke=16185,ge=16186,ve=16187,Ee=16188,pe=16189,Y=16190,C=16191,Q=16192,ye=16193,V=16194,Ae=16195,Re=16196,Se=16197,me=16198,j=16199,X=16200,Te=16201,De=16202,Ie=16203,Ce=16204,Oe=16205,q=16206,Ze=16207,Ne=16208,R=16209,Xe=16210,Ye=16211,$t=852,Lt=592,zt=15,Ht=zt,Me=t=>(t>>>24&255)+(t>>>8&65280)+((t&65280)<<8)+((t&255)<<24);function Bt(){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}const M=t=>{if(!t)return 1;const i=t.state;return!i||i.strm!==t||i.mode<W||i.mode>Ye?1:0},We=t=>{if(M(t))return D;const i=t.state;return t.total_in=t.total_out=i.total=0,t.msg="",i.wrap&&(t.adler=i.wrap&1),i.mode=W,i.last=0,i.havedict=0,i.flags=-1,i.dmax=32768,i.head=null,i.hold=0,i.bits=0,i.lencode=i.lendyn=new Int32Array($t),i.distcode=i.distdyn=new Int32Array(Lt),i.sane=1,i.back=-1,N},Je=t=>{if(M(t))return D;const i=t.state;return i.wsize=0,i.whave=0,i.wnext=0,We(t)},Qe=(t,i)=>{let e;if(M(t))return D;const o=t.state;return i<0?(e=0,i=-i):(e=(i>>4)+5,i<48&&(i&=15)),i&&(i<8||i>15)?D:(o.window!==null&&o.wbits!==i&&(o.window=null),o.wrap=e,o.wbits=i,Je(t))},Ve=(t,i)=>{if(!t)return D;const e=new Bt;t.state=e,e.strm=t,e.window=null,e.mode=W;const o=Qe(t,i);return o!==N&&(t.state=null),o},Ft=t=>Ve(t,Ht);let Ue=!0,ee,te;const Gt=t=>{if(Ue){ee=new Int32Array(512),te=new Int32Array(32);let i=0;for(;i<144;)t.lens[i++]=8;for(;i<256;)t.lens[i++]=9;for(;i<280;)t.lens[i++]=7;for(;i<288;)t.lens[i++]=8;for(L(Ge,t.lens,0,288,ee,0,t.work,{bits:9}),i=0;i<32;)t.lens[i++]=5;L(Ke,t.lens,0,32,te,0,t.work,{bits:5}),Ue=!1}t.lencode=ee,t.lenbits=9,t.distcode=te,t.distbits=5},qe=(t,i,e,o)=>{let r;const n=t.state;return n.window===null&&(n.wsize=1<<n.wbits,n.wnext=0,n.whave=0,n.window=new Uint8Array(n.wsize)),o>=n.wsize?(n.window.set(i.subarray(e-n.wsize,e),0),n.wnext=0,n.whave=n.wsize):(r=n.wsize-n.wnext,r>o&&(r=o),n.window.set(i.subarray(e-o,e-o+r),n.wnext),o-=r,o?(n.window.set(i.subarray(e-o,e),0),n.wnext=o,n.whave=n.wsize):(n.wnext+=r,n.wnext===n.wsize&&(n.wnext=0),n.whave<n.wsize&&(n.whave+=r))),0},Kt=(t,i)=>{let e,o,r,n,d,l,y,a,f,S,x,s,u,m,g=0,_,p,b,c,E,T,h,A;const v=new Uint8Array(4);let w,k;const Z=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(M(t)||!t.output||!t.input&&t.avail_in!==0)return D;e=t.state,e.mode===C&&(e.mode=Q),d=t.next_out,r=t.output,y=t.avail_out,n=t.next_in,o=t.input,l=t.avail_in,a=e.hold,f=e.bits,S=l,x=y,A=N;e:for(;;)switch(e.mode){case W:if(e.wrap===0){e.mode=Q;break}for(;f<16;){if(l===0)break e;l--,a+=o[n++]<<f,f+=8}if(e.wrap&2&&a===35615){e.wbits===0&&(e.wbits=15),e.check=0,v[0]=a&255,v[1]=a>>>8&255,e.check=I(e.check,v,2,0),a=0,f=0,e.mode=we;break}if(e.head&&(e.head.done=!1),!(e.wrap&1)||(((a&255)<<8)+(a>>8))%31){t.msg="incorrect header check",e.mode=R;break}if((a&15)!==ue){t.msg="unknown compression method",e.mode=R;break}if(a>>>=4,f-=4,h=(a&15)+8,e.wbits===0&&(e.wbits=h),h>15||h>e.wbits){t.msg="invalid window size",e.mode=R;break}e.dmax=1<<e.wbits,e.flags=0,t.adler=e.check=1,e.mode=a&512?pe:C,a=0,f=0;break;case we:for(;f<16;){if(l===0)break e;l--,a+=o[n++]<<f,f+=8}if(e.flags=a,(e.flags&255)!==ue){t.msg="unknown compression method",e.mode=R;break}if(e.flags&57344){t.msg="unknown header flags set",e.mode=R;break}e.head&&(e.head.text=a>>8&1),e.flags&512&&e.wrap&4&&(v[0]=a&255,v[1]=a>>>8&255,e.check=I(e.check,v,2,0)),a=0,f=0,e.mode=xe;case xe:for(;f<32;){if(l===0)break e;l--,a+=o[n++]<<f,f+=8}e.head&&(e.head.time=a),e.flags&512&&e.wrap&4&&(v[0]=a&255,v[1]=a>>>8&255,v[2]=a>>>16&255,v[3]=a>>>24&255,e.check=I(e.check,v,4,0)),a=0,f=0,e.mode=_e;case _e:for(;f<16;){if(l===0)break e;l--,a+=o[n++]<<f,f+=8}e.head&&(e.head.xflags=a&255,e.head.os=a>>8),e.flags&512&&e.wrap&4&&(v[0]=a&255,v[1]=a>>>8&255,e.check=I(e.check,v,2,0)),a=0,f=0,e.mode=be;case be:if(e.flags&1024){for(;f<16;){if(l===0)break e;l--,a+=o[n++]<<f,f+=8}e.length=a,e.head&&(e.head.extra_len=a),e.flags&512&&e.wrap&4&&(v[0]=a&255,v[1]=a>>>8&255,e.check=I(e.check,v,2,0)),a=0,f=0}else e.head&&(e.head.extra=null);e.mode=ke;case ke:if(e.flags&1024&&(s=e.length,s>l&&(s=l),s&&(e.head&&(h=e.head.extra_len-e.length,e.head.extra||(e.head.extra=new Uint8Array(e.head.extra_len)),e.head.extra.set(o.subarray(n,n+s),h)),e.flags&512&&e.wrap&4&&(e.check=I(e.check,o,s,n)),l-=s,n+=s,e.length-=s),e.length))break e;e.length=0,e.mode=ge;case ge:if(e.flags&2048){if(l===0)break e;s=0;do h=o[n+s++],e.head&&h&&e.length<65536&&(e.head.name+=String.fromCharCode(h));while(h&&s<l);if(e.flags&512&&e.wrap&4&&(e.check=I(e.check,o,s,n)),l-=s,n+=s,h)break e}else e.head&&(e.head.name=null);e.length=0,e.mode=ve;case ve:if(e.flags&4096){if(l===0)break e;s=0;do h=o[n+s++],e.head&&h&&e.length<65536&&(e.head.comment+=String.fromCharCode(h));while(h&&s<l);if(e.flags&512&&e.wrap&4&&(e.check=I(e.check,o,s,n)),l-=s,n+=s,h)break e}else e.head&&(e.head.comment=null);e.mode=Ee;case Ee:if(e.flags&512){for(;f<16;){if(l===0)break e;l--,a+=o[n++]<<f,f+=8}if(e.wrap&4&&a!==(e.check&65535)){t.msg="header crc mismatch",e.mode=R;break}a=0,f=0}e.head&&(e.head.hcrc=e.flags>>9&1,e.head.done=!0),t.adler=e.check=0,e.mode=C;break;case pe:for(;f<32;){if(l===0)break e;l--,a+=o[n++]<<f,f+=8}t.adler=e.check=Me(a),a=0,f=0,e.mode=Y;case Y:if(e.havedict===0)return t.next_out=d,t.avail_out=y,t.next_in=n,t.avail_in=l,e.hold=a,e.bits=f,Mt;t.adler=e.check=1,e.mode=C;case C:if(i===Zt||i===P)break e;case Q:if(e.last){a>>>=f&7,f-=f&7,e.mode=q;break}for(;f<3;){if(l===0)break e;l--,a+=o[n++]<<f,f+=8}switch(e.last=a&1,a>>>=1,f-=1,a&3){case 0:e.mode=ye;break;case 1:if(Gt(e),e.mode=j,i===P){a>>>=2,f-=2;break e}break;case 2:e.mode=Re;break;case 3:t.msg="invalid block type",e.mode=R}a>>>=2,f-=2;break;case ye:for(a>>>=f&7,f-=f&7;f<32;){if(l===0)break e;l--,a+=o[n++]<<f,f+=8}if((a&65535)!==(a>>>16^65535)){t.msg="invalid stored block lengths",e.mode=R;break}if(e.length=a&65535,a=0,f=0,e.mode=V,i===P)break e;case V:e.mode=Ae;case Ae:if(s=e.length,s){if(s>l&&(s=l),s>y&&(s=y),s===0)break e;r.set(o.subarray(n,n+s),d),l-=s,n+=s,y-=s,d+=s,e.length-=s;break}e.mode=C;break;case Re:for(;f<14;){if(l===0)break e;l--,a+=o[n++]<<f,f+=8}if(e.nlen=(a&31)+257,a>>>=5,f-=5,e.ndist=(a&31)+1,a>>>=5,f-=5,e.ncode=(a&15)+4,a>>>=4,f-=4,e.nlen>286||e.ndist>30){t.msg="too many length or distance symbols",e.mode=R;break}e.have=0,e.mode=Se;case Se:for(;e.have<e.ncode;){for(;f<3;){if(l===0)break e;l--,a+=o[n++]<<f,f+=8}e.lens[Z[e.have++]]=a&7,a>>>=3,f-=3}for(;e.have<19;)e.lens[Z[e.have++]]=0;if(e.lencode=e.lendyn,e.lenbits=7,w={bits:e.lenbits},A=L(Ot,e.lens,0,19,e.lencode,0,e.work,w),e.lenbits=w.bits,A){t.msg="invalid code lengths set",e.mode=R;break}e.have=0,e.mode=me;case me:for(;e.have<e.nlen+e.ndist;){for(;g=e.lencode[a&(1<<e.lenbits)-1],_=g>>>24,p=g>>>16&255,b=g&65535,!(_<=f);){if(l===0)break e;l--,a+=o[n++]<<f,f+=8}if(b<16)a>>>=_,f-=_,e.lens[e.have++]=b;else{if(b===16){for(k=_+2;f<k;){if(l===0)break e;l--,a+=o[n++]<<f,f+=8}if(a>>>=_,f-=_,e.have===0){t.msg="invalid bit length repeat",e.mode=R;break}h=e.lens[e.have-1],s=3+(a&3),a>>>=2,f-=2}else if(b===17){for(k=_+3;f<k;){if(l===0)break e;l--,a+=o[n++]<<f,f+=8}a>>>=_,f-=_,h=0,s=3+(a&7),a>>>=3,f-=3}else{for(k=_+7;f<k;){if(l===0)break e;l--,a+=o[n++]<<f,f+=8}a>>>=_,f-=_,h=0,s=11+(a&127),a>>>=7,f-=7}if(e.have+s>e.nlen+e.ndist){t.msg="invalid bit length repeat",e.mode=R;break}for(;s--;)e.lens[e.have++]=h}}if(e.mode===R)break;if(e.lens[256]===0){t.msg="invalid code -- missing end-of-block",e.mode=R;break}if(e.lenbits=9,w={bits:e.lenbits},A=L(Ge,e.lens,0,e.nlen,e.lencode,0,e.work,w),e.lenbits=w.bits,A){t.msg="invalid literal/lengths set",e.mode=R;break}if(e.distbits=6,e.distcode=e.distdyn,w={bits:e.distbits},A=L(Ke,e.lens,e.nlen,e.ndist,e.distcode,0,e.work,w),e.distbits=w.bits,A){t.msg="invalid distances set",e.mode=R;break}if(e.mode=j,i===P)break e;case j:e.mode=X;case X:if(l>=6&&y>=258){t.next_out=d,t.avail_out=y,t.next_in=n,t.avail_in=l,e.hold=a,e.bits=f,St(t,x),d=t.next_out,r=t.output,y=t.avail_out,n=t.next_in,o=t.input,l=t.avail_in,a=e.hold,f=e.bits,e.mode===C&&(e.back=-1);break}for(e.back=0;g=e.lencode[a&(1<<e.lenbits)-1],_=g>>>24,p=g>>>16&255,b=g&65535,!(_<=f);){if(l===0)break e;l--,a+=o[n++]<<f,f+=8}if(p&&(p&240)===0){for(c=_,E=p,T=b;g=e.lencode[T+((a&(1<<c+E)-1)>>c)],_=g>>>24,p=g>>>16&255,b=g&65535,!(c+_<=f);){if(l===0)break e;l--,a+=o[n++]<<f,f+=8}a>>>=c,f-=c,e.back+=c}if(a>>>=_,f-=_,e.back+=_,e.length=b,p===0){e.mode=Oe;break}if(p&32){e.back=-1,e.mode=C;break}if(p&64){t.msg="invalid literal/length code",e.mode=R;break}e.extra=p&15,e.mode=Te;case Te:if(e.extra){for(k=e.extra;f<k;){if(l===0)break e;l--,a+=o[n++]<<f,f+=8}e.length+=a&(1<<e.extra)-1,a>>>=e.extra,f-=e.extra,e.back+=e.extra}e.was=e.length,e.mode=De;case De:for(;g=e.distcode[a&(1<<e.distbits)-1],_=g>>>24,p=g>>>16&255,b=g&65535,!(_<=f);){if(l===0)break e;l--,a+=o[n++]<<f,f+=8}if((p&240)===0){for(c=_,E=p,T=b;g=e.distcode[T+((a&(1<<c+E)-1)>>c)],_=g>>>24,p=g>>>16&255,b=g&65535,!(c+_<=f);){if(l===0)break e;l--,a+=o[n++]<<f,f+=8}a>>>=c,f-=c,e.back+=c}if(a>>>=_,f-=_,e.back+=_,p&64){t.msg="invalid distance code",e.mode=R;break}e.offset=b,e.extra=p&15,e.mode=Ie;case Ie:if(e.extra){for(k=e.extra;f<k;){if(l===0)break e;l--,a+=o[n++]<<f,f+=8}e.offset+=a&(1<<e.extra)-1,a>>>=e.extra,f-=e.extra,e.back+=e.extra}if(e.offset>e.dmax){t.msg="invalid distance too far back",e.mode=R;break}e.mode=Ce;case Ce:if(y===0)break e;if(s=x-y,e.offset>s){if(s=e.offset-s,s>e.whave&&e.sane){t.msg="invalid distance too far back",e.mode=R;break}s>e.wnext?(s-=e.wnext,u=e.wsize-s):u=e.wnext-s,s>e.length&&(s=e.length),m=e.window}else m=r,u=d-e.offset,s=e.length;s>y&&(s=y),y-=s,e.length-=s;do r[d++]=m[u++];while(--s);e.length===0&&(e.mode=X);break;case Oe:if(y===0)break e;r[d++]=e.length,y--,e.mode=X;break;case q:if(e.wrap){for(;f<32;){if(l===0)break e;l--,a|=o[n++]<<f,f+=8}if(x-=y,t.total_out+=x,e.total+=x,e.wrap&4&&x&&(t.adler=e.check=e.flags?I(e.check,r,x,d-x):ae(e.check,r,x,d-x)),x=y,e.wrap&4&&(e.flags?a:Me(a))!==e.check){t.msg="incorrect data check",e.mode=R;break}a=0,f=0}e.mode=Ze;case Ze:if(e.wrap&&e.flags){for(;f<32;){if(l===0)break e;l--,a+=o[n++]<<f,f+=8}if(e.wrap&4&&a!==(e.total&4294967295)){t.msg="incorrect length check",e.mode=R;break}a=0,f=0}e.mode=Ne;case Ne:A=Nt;break e;case R:A=Pe;break e;case Xe:return je;case Ye:default:return D}return t.next_out=d,t.avail_out=y,t.next_in=n,t.avail_in=l,e.hold=a,e.bits=f,(e.wsize||x!==t.avail_out&&e.mode<R&&(e.mode<q||i!==he))&&qe(t,t.output,t.next_out,x-t.avail_out),S-=t.avail_in,x-=t.avail_out,t.total_in+=S,t.total_out+=x,e.total+=x,e.wrap&4&&x&&(t.adler=e.check=e.flags?I(e.check,r,x,t.next_out-x):ae(e.check,r,x,t.next_out-x)),t.data_type=e.bits+(e.last?64:0)+(e.mode===C?128:0)+(e.mode===j||e.mode===V?256:0),(S===0&&x===0||i===he)&&A===N&&(A=Ut),A},Pt=t=>{if(M(t))return D;let i=t.state;return i.window&&(i.window=null),t.state=null,N},jt=(t,i)=>{if(M(t))return D;const e=t.state;return(e.wrap&2)===0?D:(e.head=i,i.done=!1,N)},Xt=(t,i)=>{const e=i.length;let o,r,n;return M(t)||(o=t.state,o.wrap!==0&&o.mode!==Y)?D:o.mode===Y&&(r=1,r=ae(r,i,e,0),r!==o.check)?Pe:(n=qe(t,i,e,e),n?(o.mode=Xe,je):(o.havedict=1,N))};var Yt=Je,Wt=Qe,Jt=We,Qt=Ft,Vt=Ve,qt=Kt,ei=Pt,ti=jt,ii=Xt,ni="pako inflate (from Nodeca project)",O={inflateReset:Yt,inflateReset2:Wt,inflateResetKeep:Jt,inflateInit:Qt,inflateInit2:Vt,inflate:qt,inflateEnd:ei,inflateGetHeader:ti,inflateSetDictionary:ii,inflateInfo:ni};function ai(){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 fi=ai;const et=Object.prototype.toString,{Z_NO_FLUSH:oi,Z_FINISH:li,Z_OK:H,Z_STREAM_END:ie,Z_NEED_DICT:ne,Z_STREAM_ERROR:si,Z_DATA_ERROR:$e,Z_MEM_ERROR:ri}=He;function B(t){this.options=Be.assign({chunkSize:1024*64,windowBits:15,to:""},t||{});const i=this.options;i.raw&&i.windowBits>=0&&i.windowBits<16&&(i.windowBits=-i.windowBits,i.windowBits===0&&(i.windowBits=-15)),i.windowBits>=0&&i.windowBits<16&&!(t&&t.windowBits)&&(i.windowBits+=32),i.windowBits>15&&i.windowBits<48&&(i.windowBits&15)===0&&(i.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new At,this.strm.avail_out=0;let e=O.inflateInit2(this.strm,i.windowBits);if(e!==H)throw new Error(fe[e]);if(this.header=new fi,O.inflateGetHeader(this.strm,this.header),i.dictionary&&(typeof i.dictionary=="string"?i.dictionary=oe.string2buf(i.dictionary):et.call(i.dictionary)==="[object ArrayBuffer]"&&(i.dictionary=new Uint8Array(i.dictionary)),i.raw&&(e=O.inflateSetDictionary(this.strm,i.dictionary),e!==H)))throw new Error(fe[e])}B.prototype.push=function(t,i){const e=this.strm,o=this.options.chunkSize,r=this.options.dictionary;let n,d,l;if(this.ended)return!1;for(i===~~i?d=i:d=i===!0?li:oi,et.call(t)==="[object ArrayBuffer]"?e.input=new Uint8Array(t):e.input=t,e.next_in=0,e.avail_in=e.input.length;;){for(e.avail_out===0&&(e.output=new Uint8Array(o),e.next_out=0,e.avail_out=o),n=O.inflate(e,d),n===ne&&r&&(n=O.inflateSetDictionary(e,r),n===H?n=O.inflate(e,d):n===$e&&(n=ne));e.avail_in>0&&n===ie&&e.state.wrap>0&&t[e.next_in]!==0;)O.inflateReset(e),n=O.inflate(e,d);switch(n){case si:case $e:case ne:case ri:return this.onEnd(n),this.ended=!0,!1}if(l=e.avail_out,e.next_out&&(e.avail_out===0||n===ie))if(this.options.to==="string"){let y=oe.utf8border(e.output,e.next_out),a=e.next_out-y,f=oe.buf2string(e.output,y);e.next_out=a,e.avail_out=o-a,a&&e.output.set(e.output.subarray(y,y+a),0),this.onData(f)}else this.onData(e.output.length===e.next_out?e.output:e.output.subarray(0,e.next_out));if(!(n===H&&l===0)){if(n===ie)return n=O.inflateEnd(this.strm),this.onEnd(n),this.ended=!0,!0;if(e.avail_in===0)break}}return!0};B.prototype.onData=function(t){this.chunks.push(t)};B.prototype.onEnd=function(t){t===H&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Be.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};function ci(t,i){const e=new B(i);if(e.push(t),e.err)throw e.msg||fe[e.err];return e.result}var di=B,hi=ci,ui={Inflate:di,inflate:hi};const{Inflate:wi,inflate:xi}=ui;var _i=wi,bi=xi;export{_i as I,bi as i};
//# sourceMappingURL=pako-n3Pgozwg.js.map