single-file-core 1.5.129 → 1.5.130
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/core/index.js +31 -18
- package/core/infobar.js +7 -7
- package/core/lib/processor-helper-inline.js +1 -1
- package/core/lib/processor-helper.js +1 -1
- package/package.json +1 -1
- package/processors/compression/compression.js +2 -1
- package/single-file.js +1 -1
- package/test/capture/canonical-link.js +50 -0
- package/test/capture/dom.js +13 -1
- package/test/capture/maff-metadata.js +205 -0
- package/test/capture/script-uri-sanitization.js +82 -0
- package/test/sfz-harness/pages-archive.js +5 -2
- package/vendor/zip/z-worker.js +1 -1
- package/vendor/zip/zip.js +706 -950
- package/vendor/zip/zip.min.js +1 -1
- package/zip-build/package-lock.json +4 -4
- package/zip-build/package.json +1 -1
- package/zip-build/reserved-property-names.json +4 -0
package/vendor/zip/z-worker.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(){"use strict";const{Array:t,Object:e,Number:n,Math:r,Error:s,Uint8Array:o,Uint16Array:c,Uint32Array:a,Int32Array:i,Map:u,DataView:f,Promise:l,TextEncoder:w,crypto:h,postMessage:p,TransformStream:d,ReadableStream:y,WritableStream:m,CompressionStream:S,DecompressionStream:g}=self,v=void 0,k="undefined",z="function",C=new o,b=[[],[],[],[],[],[],[],[]];for(let t=0;256>t;t++){let e=t;for(let t=0;8>t;t++)e=1&e?e>>>1^3988292384:e>>>1;b[0][t]=e}for(let t=0;256>t;t++)for(let e=1;8>e;e++){const n=b[e-1][t];b[e][t]=n>>>8^b[0][255&n]}const[I,A,x,P,M,B,D,F]=b;class R{constructor(t){this.o=t||-1}append(t){let e=0|this.o;const n=0|t.length;let r=0;if(n>=8&&t.buffer){const s=new f(t.buffer,t.byteOffset,n),o=n-8;for(;o>=r;r+=8){const t=e^s.getInt32(r,!0),n=s.getInt32(r+4,!0);e=F[255&t]^D[t>>>8&255]^B[t>>>16&255]^M[t>>>24&255]^P[255&n]^x[n>>>8&255]^A[n>>>16&255]^I[n>>>24&255]}}for(;n>r;r++)e=e>>>8^I[255&(e^t[r])];this.o=e}get(){return~this.o}}class V extends d{constructor(){let t;const e=new R;super({transform(t,n){e.append(t),n.enqueue(t)},flush(){const n=new o(4);new f(n.buffer).setUint32(0,e.get()),t.value=n}}),t=this}}function _(t,e){const n=new o(t.length+e.length);return n.set(t),n.set(e,t.length),n}function T(t){return new f(t.buffer,t.byteOffset,t.byteLength)}const U={concat(t,e){if(0===t.length||0===e.length)return t.concat(e);const n=t[t.length-1],r=U.l(n);return 32===r?t.concat(e):U.h(e,r,0|n,t.slice(0,t.length-1))},bitLength(t){const e=t.length;if(0===e)return 0;const n=t[e-1];return 32*(e-1)+U.l(n)},m(t,e){if(32*t.length<e)return t;const n=(t=t.slice(0,r.ceil(e/32))).length;return e&=31,n>0&&e&&(t[n-1]=U.S(e,t[n-1]&2147483648>>e-1,1)),t},S:(t,e,n)=>32===t?e:(n?0|e:e<<32-t)+1099511627776*t,l:t=>r.round(t/1099511627776)||32,h(t,e,n,r){for(void 0===r&&(r=[]);e>=32;e-=32)r.push(n),n=0;if(0===e)return r.concat(t);for(let s=0;s<t.length;s++)r.push(n|t[s]>>>e),n=t[s]<<32-e;const s=t.length?t[t.length-1]:0,o=U.l(s);return r.push(U.S(e+o&31,e+o>32?n:r.pop(),1)),r}},K={bytes:{v(t){const e=U.bitLength(t)/8,n=new o(e);let r;for(let s=0;e>s;s++)3&s||(r=t[s/4]),n[s]=r>>>24,r<<=8;return n},C(t){const e=[];let n,r=0;for(n=0;n<t.length;n++)r=r<<8|t[n],3&~n||(e.push(r),r=0);return 3&n&&e.push(U.S(8*(3&n),r)),e}}},j=class{constructor(t){const e=this;e.blockSize=512,e.I=[1732584193,4023233417,2562383102,271733878,3285377520],e.A=[1518500249,1859775393,2400959708,3395469782],t?(e.P=t.P.slice(0),e.M=t.M.slice(0),e.B=t.B):e.reset()}reset(){const t=this;return t.P=t.I.slice(0),t.M=[],t.B=0,t}update(t){const e=this;"string"==typeof t&&(t=K.D.C(t));const n=e.M=U.concat(e.M,t),r=e.B,o=e.B=r+U.bitLength(t);if(o>9007199254740991)throw new s("Cannot hash more than 2^53 - 1 bits");const c=new a(n);let i=0;for(let t=e.blockSize+r-(e.blockSize+r&e.blockSize-1);o>=t;t+=e.blockSize)e.F(c.subarray(16*i,16*(i+1))),i+=1;return n.splice(0,16*i),e}R(){const t=this;let e=t.M;const n=t.P;e=U.concat(e,[U.S(1,1)]);for(let t=e.length+2;15&t;t++)e.push(0);for(e.push(r.floor(t.B/4294967296)),e.push(0|t.B);e.length;)t.F(e.splice(0,16));return t.reset(),n}V(t,e,n,r){return t>19?t>39?t>59?t>79?void 0:e^n^r:e&n|e&r|n&r:e^n^r:e&n|~e&r}_(t,e){return e<<t|e>>>32-t}F(e){const n=this,s=n.P,o=t(80);for(let t=0;16>t;t++)o[t]=e[t];let c=s[0],a=s[1],i=s[2],u=s[3],f=s[4];for(let t=0;79>=t;t++){16>t||(o[t]=n._(1,o[t-3]^o[t-8]^o[t-14]^o[t-16]));const e=n._(5,c)+n.V(t,a,i,u)+f+o[t]+n.A[r.floor(t/20)]|0;f=u,u=i,i=n._(30,a),a=c,c=e}s[0]=s[0]+c|0,s[1]=s[1]+a|0,s[2]=s[2]+i|0,s[3]=s[3]+u|0,s[4]=s[4]+f|0}},E={importKey:t=>new E.T(K.bytes.C(t)),U(t,e,n,r){if(n=n||1e4,0>r||0>n)throw new s("invalid params to pbkdf2");const o=1+(r>>5)<<2;let c,a,i,u,l;const w=new ArrayBuffer(o),h=new f(w);let p=0;const d=U;for(e=K.bytes.C(e),l=1;(o||1)>p;l++){for(c=a=t.encrypt(d.concat(e,[l])),i=1;n>i;i++)for(a=t.encrypt(a),u=0;u<a.length;u++)c[u]^=a[u];for(i=0;(o||1)>p&&i<c.length;i++)h.setInt32(p,c[i]),p+=4}return w.slice(0,r/8)},T:class{constructor(t){const e=this,n=e.K=j,r=[[],[]];e.j=[new n,new n];const s=e.j[0].blockSize/32;t.length>s&&(t=(new n).update(t).R());for(let e=0;s>e;e++)r[0][e]=909522486^t[e],r[1][e]=1549556828^t[e];e.j[0].update(r[0]),e.j[1].update(r[1]),e.O=new n(e.j[0])}reset(){const t=this;t.O=new t.K(t.j[0]),t.W=!1}update(t){this.W=!0,this.O.update(t)}digest(){const t=this,e=t.O.R(),n=new t.K(t.j[1]).update(e).R();return t.reset(),n}encrypt(t){if(this.W)throw new s("encrypt on already updated hmac called!");return this.update(t),this.digest(t)}}},O=typeof h!=k&&typeof h.getRandomValues==z,W="Invalid password",H="zipjs-abort-check-password";function L(t){if(O)return h.getRandomValues(t);throw new s("Crypto API not supported")}const N=16,q={name:"PBKDF2"},G=e.assign({hash:{name:"HMAC"}},q),J=e.assign({iterations:1e3,hash:{name:"SHA-1"}},q),Q=["deriveBits"],X=[8,12,16],Y=[16,24,32],Z=10,$=[0,0,0,0],tt=typeof h!=k,et=tt&&h.subtle,nt=tt&&typeof et!=k,rt=K.bytes,st=class{constructor(t){const e=this;e.H=[[[],[],[],[],[]],[[],[],[],[],[]]],e.H[0][0][0]||e.L();const n=e.H[0][4],r=e.H[1],o=t.length;let c,a,i,u=1;if(4!==o&&6!==o&&8!==o)throw new s("invalid aes key size");for(e.A=[a=t.slice(0),i=[]],c=o;4*o+28>c;c++){let t=a[c-1];(c%o===0||8===o&&c%o===4)&&(t=n[t>>>24]<<24^n[t>>16&255]<<16^n[t>>8&255]<<8^n[255&t],c%o===0&&(t=t<<8^t>>>24^u<<24,u=u<<1^283*(u>>7))),a[c]=a[c-o]^t}for(let t=0;c;t++,c--){const e=a[3&t?c:c-4];i[t]=4>=c||4>t?e:r[0][n[e>>>24]]^r[1][n[e>>16&255]]^r[2][n[e>>8&255]]^r[3][n[255&e]]}}encrypt(t){return this.N(t,0)}decrypt(t){return this.N(t,1)}L(){const t=this.H[0],e=this.H[1],n=t[4],r=e[4],s=[],o=[];let c,a,i,u;for(let t=0;256>t;t++)o[(s[t]=t<<1^283*(t>>7))^t]=t;for(let f=c=0;!n[f];f^=a||1,c=o[c]||1){let o=c^c<<1^c<<2^c<<3^c<<4;o=o>>8^255&o^99,n[f]=o,r[o]=f,u=s[i=s[a=s[f]]];let l=16843009*u^65537*i^257*a^16843008*f,w=257*s[o]^16843008*o;for(let n=0;4>n;n++)t[n][f]=w=w<<24^w>>>8,e[n][o]=l=l<<24^l>>>8}for(let n=0;5>n;n++)t[n]=t[n].slice(0),e[n]=e[n].slice(0)}N(t,e){if(4!==t.length)throw new s("invalid aes block size");const n=this.A[e],r=n.length/4-2,o=[0,0,0,0],c=this.H[e],a=c[0],i=c[1],u=c[2],f=c[3],l=c[4];let w,h,p,d=t[0]^n[0],y=t[e?3:1]^n[1],m=t[2]^n[2],S=t[e?1:3]^n[3],g=4;for(let t=0;r>t;t++)w=a[d>>>24]^i[y>>16&255]^u[m>>8&255]^f[255&S]^n[g],h=a[y>>>24]^i[m>>16&255]^u[S>>8&255]^f[255&d]^n[g+1],p=a[m>>>24]^i[S>>16&255]^u[d>>8&255]^f[255&y]^n[g+2],S=a[S>>>24]^i[d>>16&255]^u[y>>8&255]^f[255&m]^n[g+3],g+=4,d=w,y=h,m=p;for(let t=0;4>t;t++)o[e?3&-t:t]=l[d>>>24]<<24^l[y>>16&255]<<16^l[m>>8&255]<<8^l[255&S]^n[g++],w=d,d=y,y=m,m=S,S=w;return o}},ot=class{constructor(t,e){this.G=t,this.J=e,this.X=e}reset(){this.X=this.J}update(t){return this.Y(this.G,t,this.X)}Z(t){if(255&~(t>>24))t+=1<<24;else{let e=t>>16&255,n=t>>8&255,r=255&t;255===e?(e=0,255===n?(n=0,255===r?r=0:++r):++n):++e,t=0,t+=e<<16,t+=n<<8,t+=r}return t}$(t){0===(t[0]=this.Z(t[0]))&&(t[1]=this.Z(t[1]))}Y(t,e,n){let r;if(!(r=e.length))return[];const s=U.bitLength(e);for(let s=0;r>s;s+=4){this.$(n);const r=t.encrypt(n);e[s]^=r[0],e[s+1]^=r[1],e[s+2]^=r[2],e[s+3]^=r[3]}return U.m(e,s)}},ct=E.T;let at=tt&&nt&&typeof et.importKey==z,it=tt&&nt&&typeof et.deriveBits==z;class ut extends d{constructor({password:t,rawPassword:e,encryptionStrength:n,checkPasswordOnly:r,checkAuthenticationCode:c=!0}){super({start(){lt(this,t,e,n)},async transform(t,e){const n=this,{password:c,strength:a,et:i,ready:u}=n;c?(await(async(t,e,n,r)=>{const o=await ht(t,e,n,dt(r,0,X[e])),c=dt(r,X[e]);if(o[0]!=c[0]||o[1]!=c[1])throw new s(W)})(n,a,c,dt(t,0,X[a]+2)),t=dt(t,X[a]+2),r?e.error(new s(H)):i()):await u;const f=new o(t.length-Z-(t.length-Z)%N);e.enqueue(wt(n,t,f,0,Z,!0))},async flush(t){const{nt:e,st:n,ot:r,ready:o}=this;if(n&&e){await o;const a=dt(r,0,r.length-Z),i=dt(r,r.length-Z);let u=C;if(a.length){const t=mt(rt,a);n.update(t);const r=e.update(t);u=yt(rt,r)}const f=dt(yt(rt,n.digest()),0,Z);let l=r.length<Z?1:0;for(let t=0;Z>t;t++)l|=f[t]^i[t];if(l&&c)throw new s("Invalid authentication code");t.enqueue(u)}}})}}class ft extends d{constructor({password:t,rawPassword:e,encryptionStrength:n}){super({start(){lt(this,t,e,n)},async transform(t,e){const n=this,{password:r,strength:s,et:c,ready:a}=n;let i=C;r?(i=await(async(t,e,n)=>{const r=L(new o(X[e]));return _(r,await ht(t,e,n,r))})(n,s,r),c()):await a;const u=new o(i.length+t.length-t.length%N);u.set(i,0),e.enqueue(wt(n,t,u,i.length,0))},async flush(t){const{nt:e,st:n,ot:r,ready:s}=this;if(n&&e){await s;let o=C;if(r.length){const t=e.update(mt(rt,r));n.update(t),o=yt(rt,t)}const c=yt(rt,n.digest()).slice(0,Z);t.enqueue(_(o,c))}}})}}function lt(t,n,r,s){e.assign(t,{ready:new l(e=>t.et=e),password:pt(n,r),strength:s-1,ot:C})}function wt(t,e,n,r,s,c){const{nt:a,st:i,ot:u}=t;u.length&&(e=_(u,e));const f=e.length-s;let l;for(n=((t,e)=>{if(e&&e>t.length){const n=t;(t=new o(e)).set(n,0)}return t})(n,r+(f-f%N)),l=0;f-N>=l;l+=N){const t=mt(rt,dt(e,l,l+N));c&&i.update(t);const s=a.update(t);c||i.update(s),n.set(yt(rt,s),l+r)}return t.ot=dt(e,l),n}async function ht(n,r,s,c){n.password=null;const a=await(async(t,e,n,r,s)=>{if(!at)return E.importKey(e);try{return await et.importKey("raw",e,n,!1,s)}catch{return at=!1,E.importKey(e)}})(0,s,G,0,Q),i=await(async(t,e,n)=>{if(!it)return E.U(e,t.salt,J.iterations,n);try{return await et.deriveBits(t,e,n)}catch{return it=!1,E.U(e,t.salt,J.iterations,n)}})(e.assign({salt:c},J),a,8*(2*Y[r]+2)),u=new o(i),f=mt(rt,dt(u,0,Y[r])),l=mt(rt,dt(u,Y[r],2*Y[r])),w=dt(u,2*Y[r]);return e.assign(n,{keys:{key:f,ct:l,passwordVerification:w},nt:new ot(new st(f),t.from($)),st:new ct(l)}),w}function pt(t,e){return e===v?(t=>{if(typeof w==k){const e=new o((t=unescape(encodeURIComponent(t))).length);for(let n=0;n<e.length;n++)e[n]=t.charCodeAt(n);return e}return(new w).encode(t)})(t):e}function dt(t,e,n){return t.subarray(e,n)}function yt(t,e){return t.v(e)}function mt(t,e){return t.C(e)}class St extends d{constructor({password:t,rawPassword:e,passwordVerification:n,checkPasswordOnly:r}){super({start(){vt(this,t,e,n)},transform(t,e){const n=this;if(n.password||n.rawPassword){const e=kt(n,t.subarray(0,12));if(n.password=n.rawPassword=null,0!=(e[11]^n.passwordVerification))throw new s(W);t=t.subarray(12)}r?e.error(new s(H)):e.enqueue(kt(n,t))}})}}class gt extends d{constructor({password:t,rawPassword:e,passwordVerification:n}){super({start(){vt(this,t,e,n)},transform(t,e){const n=this;let r,s;if(n.password||n.rawPassword){n.password=n.rawPassword=null;const e=L(new o(12));e[11]=n.passwordVerification,r=new o(t.length+e.length),r.set(zt(n,e),0),s=12}else r=new o(t.length),s=0;r.set(zt(n,t),s),e.enqueue(r)}})}}function vt(t,n,r,s){e.assign(t,{password:n,rawPassword:r,passwordVerification:s}),((t,n,r)=>{const s=[305419896,591751049,878082192];if(e.assign(t,{keys:s,it:new R(s[0]),ut:new R(s[2])}),r)for(let e=0;e<r.length;e++)Ct(t,r[e]);else for(let e=0;e<n.length;e++)Ct(t,n.charCodeAt(e))})(t,n,r)}function kt(t,e){const n=new o(e.length);for(let r=0;r<e.length;r++)n[r]=bt(t)^e[r],Ct(t,n[r]);return n}function zt(t,e){const n=new o(e.length);for(let r=0;r<e.length;r++)n[r]=bt(t)^e[r],Ct(t,e[r]);return n}function Ct(t,e){let[,n]=t.keys;t.it.append([e]);const s=~t.it.get();n=At(r.imul(At(n+It(s)),134775813)+1),t.ut.append([n>>>24]);const o=~t.ut.get();t.keys=[s,n,o]}function bt(t){const e=2|t.keys[2];return It(r.imul(e,1^e)>>>8)}function It(t){return 255&t}function At(t){return 4294967295&t}function xt(t){if(t instanceof y)return t;const e=t.getReader();return new y({async pull(t){const{value:n,done:r}=await e.read();r?t.close():t.enqueue(n)},cancel:t=>e.cancel(t)})}const Pt=new u;function Mt(t){return Pt.get(t)}const Bt="Invalid uncompressed size",Dt="deflate-raw",Ft="gzip",Rt=[31,139,8];class Vt extends d{constructor(t,{chunkSize:e,CompressionStreamFallback:n,CompressionStream:r}){super({});const{compressed:s,encrypted:o,useCompressionStream:c,zipCrypto:a,computeCrc32:i,level:u,deflate64:l,format:w,compressionMethod:h,inputSize:p}=t,d=this;let y,m,S,g=super.readable;const v=w&&Mt(w),k=i&&s&&!l&&!v&&(!o||a)&&!(!c||!r);if(o&&!a||!i||k||(y=new V,g=Ot(g,y)),s)if(v)g=Wt(g,jt(v.CompressionStream,w,{level:u,chunkSize:e,compressionMethod:h,uncompressedSize:p}));else if(k)S=new _t,g=Wt(g,new r(Ft)),g=Ot(g,S);else try{g=Et(g,c,{level:u,chunkSize:e},r,n)}catch(t){let e;try{e=new r(Ft)}catch{throw t}g=Wt(g,e),g=Ot(g,new _t)}o&&(a?g=Ot(g,new gt(t)):(m=new ft(t),g=Ot(g,m))),Kt(d,g,()=>{o&&!a||!i||(d.crc32=k?S.crc32:new f(y.value.buffer).getUint32(0))})}}class _t extends d{constructor(){let t,e=10,n=new o(0);super({transform(t,s){if(e){const n=r.min(e,t.length);if(e-=n,!(t=t.subarray(n)).length)return}const o=n.length+t.length;if(8>=o)return void(n=_(n,t));const c=o-8,a=r.min(c,n.length);s.enqueue(_(n.subarray(0,a),t.subarray(0,c-a))),n=_(n.subarray(a),t.subarray(c-a))},flush(){const e=T(n);t.crc32=e.getUint32(0,!0),t.uncompressedSize=e.getUint32(4,!0)}}),t=this}}class Tt extends d{constructor(t,{chunkSize:e,DecompressionStreamFallback:n,DecompressionStream:r}){super({});const{zipCrypto:c,encrypted:a,checkCrc32:i,crc32:u,compressed:w,useCompressionStream:h,deflate64:p,format:m,compressionMethod:S,rawBitFlag:g,outputSize:k}=t;let z,C,b=super.readable;if(a&&(c?b=Ot(b,new St(t)):(C=new ut(t),b=Ot(b,C))),w){const t=m&&Mt(m);if(t)b=Wt(b,jt(t.DecompressionStream,m,{chunkSize:e,compressionMethod:S,rawBitFlag:g,uncompressedSize:k}));else try{b=Et(b,h,{chunkSize:e,deflate64:p},r,n)}catch(t){if(p||k===v)throw t;let e;try{e=new r(Ft)}catch{throw t}b=((t,e,n)=>{const r=new R;let c,a,i,u=0,f=!1;const w=new l((t,e)=>{a=t,i=e});w.catch(()=>{}),n||a();const h=new d({start(t){const e=new o(10);e.set(Rt),t.enqueue(e)},transform(t,e){e.enqueue(t)},async flush(t){f=!0,y();try{await w}finally{m()}const e=new o(8),s=T(e);s.setUint32(0,r.get(),!0),s.setUint32(4,n,!0),t.enqueue(e)},cancel(t){i(t)}}),p=new d({transform(t,e){r.append(t),u+=t.length,n>u?f&&y():a(),e.enqueue(t)},cancel(t){i(t)}});return t=Ot(t,h),Ot(t=Wt(t,e),p);function y(){m(),c=setTimeout(()=>i(new s(Bt)),5e3)}function m(){clearTimeout(c)}})(b,e,k)}b=(t=>{const e=t.getReader();return new y({async pull(t){let n;try{n=await e.read()}catch(t){if(t&&t.message)throw t;const e=new s("Invalid compressed data");throw e.cause=t,e}const{value:r,done:o}=n;o?t.close():t.enqueue(r)},cancel:t=>e.cancel(t)})})(b)}i&&(z=new V,b=Ot(b,z)),Kt(this,b,()=>{if(i){const t=new f(z.value.buffer);if(u!=t.getUint32(0,!1))throw new s("Invalid CRC32")}})}}const Ut=new u;function Kt(t,n,r){n=Ot(n,new d({flush:r})),e.defineProperty(t,"readable",{get:()=>n})}function jt(t,e,n){if(!t)throw new s("Compression method not supported");return new t(e,n)}function Et(t,e,n,r,s){const o=e&&r?r:s||r,c=n.deflate64?"deflate64-raw":Dt;let a;try{a=new o(c,n)}catch(t){if(!e||!s||o==s)throw t;a=new s(c,n)}return Wt(t,a)}function Ot(t,e){return xt(t).pipeThrough(e)}function Wt(t,e){const n=e.writable.getWriter(),r=t.getReader();return(async()=>{try{for(;;){await n.ready;const t=await r.read();if(t.done){await n.close();break}await n.write(t.value)}}catch(t){await(async(t,e)=>{try{await t.abort(e)}catch{}})(n,t),await(async(t,e)=>{try{await t.cancel(e)}catch{}})(r,t)}})(),e.readable}const Ht="data",Lt="close",Nt="deflate";class qt extends d{constructor(t,n){super({});const r=this,{codecType:o}=t;let c;o.startsWith(Nt)?c=Vt:o.startsWith("inflate")&&(c=Tt),r.outputSize=0;let a=0;const i=new c(t,n),u=super.readable,f=new d({transform(t,e){t&&t.length&&(a+=t.length,e.enqueue(t))},flush(){e.assign(r,{inputSize:a})}}),l=new d({transform(e,n){if(e&&e.length&&(n.enqueue(e),r.outputSize+=e.length,t.outputSize!==v&&r.outputSize>t.outputSize))throw new s(Bt)},flush(){const{crc32:t}=i;e.assign(r,{crc32:t,inputSize:a})}});e.defineProperty(r,"readable",{get:()=>u.pipeThrough(f).pipeThrough(i).pipeThrough(l)})}}class Gt extends d{constructor(t){const r=[];let s=0,c=0;function a(){const e=new o(t);let n=0;for(;t>n;){const s=r[0],o=t-n;s.length>o?(e.set(s.subarray(0,o),n),r[0]=s.subarray(o),n+=o):(e.set(s,n),n+=s.length,r.shift())}return s-=t,e}n.isFinite(t)&&t>=1||(t=65536),super({transform(e,n){for(r.push(e),s+=e.length;s>t;)c+=t,n.enqueue(a())},flush(t){s&&(c+=s,t.enqueue(((t,e)=>{const n=new o(e);let r=0;for(const e of t)n.set(e,r),r+=e.length;return n})(r,s)))}}),e.defineProperty(this,"outputSize",{get:()=>c})}}let Jt=2;try{typeof navigator!=k&&navigator.hardwareConcurrency&&(Jt=navigator.hardwareConcurrency)}catch{}function Qt(t){return!!t&&"object"==typeof t}const Xt=new u,Yt=new u,Zt=(()=>{try{return structuredClone(new s)instanceof s}catch{return!1}})();let $t,te=0;async function ee(t){let e,o,c;try{const{options:a,config:i}=t;if(a.format)try{await(async(t,e)=>{!Pt.has(t)&&e&&((t,e)=>{const{CompressionStream:n,DecompressionStream:r}=e;if(typeof n!=z&&typeof r!=z)throw new s("Invalid codec module");Pt.set(t,{CompressionStream:n,DecompressionStream:r})})(t,await(import(e)))})(a.format,a.codecURI)}catch(t){if(Qt(t))try{t.codecImportFailed=!0}catch{}throw t}if(i.CompressionStream=self.CompressionStream,i.DecompressionStream=self.DecompressionStream,a.compressed&&!a.format)if(a.useCompressionStream){if(!((t,e)=>{if(!t)return!1;let n=Ut.get(t);n||(n=new u,Ut.set(t,n));let r=n.get(e);if(r===v){try{new t(e),r=!0}catch{r=!1}n.set(e,r)}return r})(a.codecType.startsWith(Nt)?i.CompressionStream:i.DecompressionStream,Dt))try{await self.initModule(t.config)}catch{}}else try{await self.initModule(t.config)}catch{a.useCompressionStream=!0}!i.CompressionStreamFallback&&i.CompressionStreamZlib&&(i.CompressionStreamFallback=i.CompressionStreamZlib),!i.DecompressionStreamFallback&&i.DecompressionStreamZlib&&(i.DecompressionStreamFallback=i.DecompressionStreamZlib);const f={highWaterMark:1},w=t.readable?xt(t.readable):new y({async pull(t){const e=new l(t=>Xt.set(te,t));ne({type:"pull",messageId:te}),te=(te+1)%n.MAX_SAFE_INTEGER;const{value:r,done:s}=await e;t.enqueue(r),s&&t.close()}},f);c=t.writable?(t=>{if(t instanceof m)return t;const e=t.getWriter();return new m({write:t=>e.write(t),close:()=>e.close(),abort:t=>e.abort(t)})})(t.writable):new m({async write(t){let e;const r=new l(t=>e=t);Yt.set(te,e),ne({type:Ht,value:t,messageId:te}),te=(te+1)%n.MAX_SAFE_INTEGER,await r}},f),e=new qt(a,i),o=new Gt((t=>{return s="string"==typeof(e=s=t.chunkSize)&&e.trim()?n(e):e,n.isInteger(s)&&s>=1?r.max(s,64):65536;var e,s})(i)),$t=new AbortController;const{signal:h}=$t;await w.pipeThrough(e).pipeThrough(o).pipeTo(c,{signal:h,preventClose:!0,preventAbort:!0}),await c.getWriter().close();const{crc32:p,inputSize:d,outputSize:S}=e;ne({type:Lt,result:{crc32:p,inputSize:d,outputSize:S}})}catch(t){const e=o?o.outputSize:0;if(Qt(t))try{t.outputSize=e}catch{}if(c&&!c.locked)try{await c.getWriter().close()}catch{}re(t,e)}}function ne(t){const{value:e}=t;if(e)if(e.length)try{t.value=(n=e,n.byteOffset||n.byteLength!=n.buffer.byteLength?new o(n):n).buffer,p(t,[t.value])}catch{p(t)}else p(t);else p(t);var n}function re(t,e){const{message:n,stack:r,code:o,name:c,outputSize:a,cause:i,codecImportFailed:u}=((t=new s("Unknown error"))=>Qt(t)?t:new s(t+""))(t),f={message:n,stack:r,code:o,name:c,outputSize:a===v?e:a};if(i&&(f.cause={name:i.name,message:i.message}),u&&(f.codecImportFailed=!0),Zt)try{return void p({error:f,errorValue:{value:t}})}catch{}p({error:f})}addEventListener("message",({data:t})=>{const{type:e,messageId:n,value:r,done:s}=t;try{if("start"==e&&ee(t),e==Ht){const t=Xt.get(n);Xt.delete(n),t({value:r||new o,done:s})}if("ack"==e){const t=Yt.get(n);Yt.delete(n),t()}e==Lt&&$t.abort()}catch(t){re(t)}}),p({type:"ready"}),((t={})=>{const{init:e}=t,n=t.CompressionStreamFallback||t.CompressionStreamZlib,r=t.DecompressionStreamFallback||t.DecompressionStreamZlib;self.initModule=async t=>{e&&await e(t),n&&(t.CompressionStreamFallback=n),r&&(t.DecompressionStreamFallback=r)}})()}();
|
|
1
|
+
!function(){"use strict";const{Array:t,Object:e,Number:n,Math:r,Error:s,Uint8Array:o,Uint16Array:c,Uint32Array:a,Int32Array:i,Map:w,DataView:u,Promise:f,TextEncoder:l,crypto:p,postMessage:d,TransformStream:h,ReadableStream:y,WritableStream:m,CompressionStream:S,DecompressionStream:g}=self,v=void 0,z="undefined",k="function",C=new o,I=[[],[],[],[],[],[],[],[]];for(let t=0;256>t;t++){let e=t;for(let t=0;8>t;t++)e=1&e?e>>>1^3988292384:e>>>1;I[0][t]=e}for(let t=0;256>t;t++)for(let e=1;8>e;e++){const n=I[e-1][t];I[e][t]=n>>>8^I[0][255&n]}const[b,x,A,P,M,D,F,E]=I;class R{constructor(t){this.o=t||-1}append(t){let e=0|this.o;const n=0|t.length;let r=0;if(n>=8&&t.buffer){const s=new u(t.buffer,t.byteOffset,n),o=n-8;for(;o>=r;r+=8){const t=e^s.getInt32(r,!0),n=s.getInt32(r+4,!0);e=E[255&t]^F[t>>>8&255]^D[t>>>16&255]^M[t>>>24&255]^P[255&n]^A[n>>>8&255]^x[n>>>16&255]^b[n>>>24&255]}}for(;n>r;r++)e=e>>>8^b[255&(e^t[r])];this.o=e}get(){return~this.o}}class T extends h{constructor(){let t;const e=new R;super({transform(t,n){e.append(t),n.enqueue(t)},flush(){const n=new o(4);new u(n.buffer).setUint32(0,e.get()),t.value=n}}),t=this}}function U(t,e){const n=new o(t.length+e.length);return n.set(t),n.set(e,t.length),n}function V(t){return new u(t.buffer,t.byteOffset,t.byteLength)}const B=64,j=20,K=new o([128]),O=new o(1),H=new i([1732584193,4023233417,2562383102,271733878,3285377520]),W=new o(256),L=new i(256),N=new i(256),q=new i(256),G=new i(256);let J=!1;function Q(t,e){(()=>{if(!J){let t=1,e=1;do{t=255&(t^t<<1^(128&t?27:0)),e=255&(e^e<<1),e=255&(e^e<<2),e=255&(e^e<<4),128&e&&(e^=9),W[t]=255&(e^(e<<1|e>>7)^(e<<2|e>>6)^(e<<3|e>>5)^(e<<4|e>>4)^99)}while(1!=t);W[0]=99;for(let t=0;256>t;t++){const e=W[t],n=$(e),r=n<<24|e<<16|e<<8|n^e;L[t]=r,N[t]=r>>>8|r<<24,q[t]=r>>>16|r<<16,G[t]=r>>>24|r<<8}J=!0}})();const n=new i(60),r=((t,e)=>{const n=t.length>>2,r=n+6,s=4*(r+1);let o=1;for(let r=0;n>r;r++)e[r]=t[4*r]<<24|t[4*r+1]<<16|t[4*r+2]<<8|t[4*r+3];for(let t=n;s>t;t++){let r=e[t-1];t%n==0?(r=Y(r<<8|r>>>24)^o<<24,o=$(o)):n>6&&t%n==4&&(r=Y(r)),e[t]=e[t-n]^r}return r})(t,n),s=new i(4),o=X(e);let c=0,a=0,w=0,f=0;return{process(t,e){e&&o.update(t,0,t.length),(t=>{const e=new u(t.buffer,t.byteOffset,t.byteLength),n=t.length;let r=0;for(;n>=r+16;r+=16)l(),e.setInt32(r,e.getInt32(r)^s[0]),e.setInt32(r+4,e.getInt32(r+4)^s[1]),e.setInt32(r+8,e.getInt32(r+8)^s[2]),e.setInt32(r+12,e.getInt32(r+12)^s[3]);if(n>r){l();for(let e=0;n>r;r++,e++)t[r]^=s[e>>2]>>>24-8*(3&e)}})(t),e||o.update(t,0,t.length)},digest:()=>o.digest()};function l(){c=c+1|0,c||(a=a+1|0,a||(w=w+1|0,w||(f=f+1|0)));let t=Z(c)^n[0],e=Z(a)^n[1],o=Z(w)^n[2],i=Z(f)^n[3],u=L[t>>>24]^N[e>>>16&255]^q[o>>>8&255]^G[255&i]^n[4],l=L[e>>>24]^N[o>>>16&255]^q[i>>>8&255]^G[255&t]^n[5],p=L[o>>>24]^N[i>>>16&255]^q[t>>>8&255]^G[255&e]^n[6],d=L[i>>>24]^N[t>>>16&255]^q[e>>>8&255]^G[255&o]^n[7];t=L[u>>>24]^N[l>>>16&255]^q[p>>>8&255]^G[255&d]^n[8],e=L[l>>>24]^N[p>>>16&255]^q[d>>>8&255]^G[255&u]^n[9],o=L[p>>>24]^N[d>>>16&255]^q[u>>>8&255]^G[255&l]^n[10],i=L[d>>>24]^N[u>>>16&255]^q[l>>>8&255]^G[255&p]^n[11],u=L[t>>>24]^N[e>>>16&255]^q[o>>>8&255]^G[255&i]^n[12],l=L[e>>>24]^N[o>>>16&255]^q[i>>>8&255]^G[255&t]^n[13],p=L[o>>>24]^N[i>>>16&255]^q[t>>>8&255]^G[255&e]^n[14],d=L[i>>>24]^N[t>>>16&255]^q[e>>>8&255]^G[255&o]^n[15],t=L[u>>>24]^N[l>>>16&255]^q[p>>>8&255]^G[255&d]^n[16],e=L[l>>>24]^N[p>>>16&255]^q[d>>>8&255]^G[255&u]^n[17],o=L[p>>>24]^N[d>>>16&255]^q[u>>>8&255]^G[255&l]^n[18],i=L[d>>>24]^N[u>>>16&255]^q[l>>>8&255]^G[255&p]^n[19],u=L[t>>>24]^N[e>>>16&255]^q[o>>>8&255]^G[255&i]^n[20],l=L[e>>>24]^N[o>>>16&255]^q[i>>>8&255]^G[255&t]^n[21],p=L[o>>>24]^N[i>>>16&255]^q[t>>>8&255]^G[255&e]^n[22],d=L[i>>>24]^N[t>>>16&255]^q[e>>>8&255]^G[255&o]^n[23],t=L[u>>>24]^N[l>>>16&255]^q[p>>>8&255]^G[255&d]^n[24],e=L[l>>>24]^N[p>>>16&255]^q[d>>>8&255]^G[255&u]^n[25],o=L[p>>>24]^N[d>>>16&255]^q[u>>>8&255]^G[255&l]^n[26],i=L[d>>>24]^N[u>>>16&255]^q[l>>>8&255]^G[255&p]^n[27],u=L[t>>>24]^N[e>>>16&255]^q[o>>>8&255]^G[255&i]^n[28],l=L[e>>>24]^N[o>>>16&255]^q[i>>>8&255]^G[255&t]^n[29],p=L[o>>>24]^N[i>>>16&255]^q[t>>>8&255]^G[255&e]^n[30],d=L[i>>>24]^N[t>>>16&255]^q[e>>>8&255]^G[255&o]^n[31],t=L[u>>>24]^N[l>>>16&255]^q[p>>>8&255]^G[255&d]^n[32],e=L[l>>>24]^N[p>>>16&255]^q[d>>>8&255]^G[255&u]^n[33],o=L[p>>>24]^N[d>>>16&255]^q[u>>>8&255]^G[255&l]^n[34],i=L[d>>>24]^N[u>>>16&255]^q[l>>>8&255]^G[255&p]^n[35],u=L[t>>>24]^N[e>>>16&255]^q[o>>>8&255]^G[255&i]^n[36],l=L[e>>>24]^N[o>>>16&255]^q[i>>>8&255]^G[255&t]^n[37],p=L[o>>>24]^N[i>>>16&255]^q[t>>>8&255]^G[255&e]^n[38],d=L[i>>>24]^N[t>>>16&255]^q[e>>>8&255]^G[255&o]^n[39];let h=40;r>10&&(t=L[u>>>24]^N[l>>>16&255]^q[p>>>8&255]^G[255&d]^n[40],e=L[l>>>24]^N[p>>>16&255]^q[d>>>8&255]^G[255&u]^n[41],o=L[p>>>24]^N[d>>>16&255]^q[u>>>8&255]^G[255&l]^n[42],i=L[d>>>24]^N[u>>>16&255]^q[l>>>8&255]^G[255&p]^n[43],u=L[t>>>24]^N[e>>>16&255]^q[o>>>8&255]^G[255&i]^n[44],l=L[e>>>24]^N[o>>>16&255]^q[i>>>8&255]^G[255&t]^n[45],p=L[o>>>24]^N[i>>>16&255]^q[t>>>8&255]^G[255&e]^n[46],d=L[i>>>24]^N[t>>>16&255]^q[e>>>8&255]^G[255&o]^n[47],h=48),r>12&&(t=L[u>>>24]^N[l>>>16&255]^q[p>>>8&255]^G[255&d]^n[48],e=L[l>>>24]^N[p>>>16&255]^q[d>>>8&255]^G[255&u]^n[49],o=L[p>>>24]^N[d>>>16&255]^q[u>>>8&255]^G[255&l]^n[50],i=L[d>>>24]^N[u>>>16&255]^q[l>>>8&255]^G[255&p]^n[51],u=L[t>>>24]^N[e>>>16&255]^q[o>>>8&255]^G[255&i]^n[52],l=L[e>>>24]^N[o>>>16&255]^q[i>>>8&255]^G[255&t]^n[53],p=L[o>>>24]^N[i>>>16&255]^q[t>>>8&255]^G[255&e]^n[54],d=L[i>>>24]^N[t>>>16&255]^q[e>>>8&255]^G[255&o]^n[55],h=56),s[0]=(W[u>>>24]<<24|W[l>>>16&255]<<16|W[p>>>8&255]<<8|W[255&d])^n[h],s[1]=(W[l>>>24]<<24|W[p>>>16&255]<<16|W[d>>>8&255]<<8|W[255&u])^n[h+1],s[2]=(W[p>>>24]<<24|W[d>>>16&255]<<16|W[u>>>8&255]<<8|W[255&l])^n[h+2],s[3]=(W[d>>>24]<<24|W[u>>>16&255]<<16|W[l>>>8&255]<<8|W[255&p])^n[h+3]}}function X(t){const e=(()=>{const t=new i(H),e=new i(16),n=new o(B),s=new u(n.buffer),c=new o(8);let a=0,w=0;return{update:f,digest:()=>{const e=8*w,n=r.floor(e/4294967296),s=e>>>0;for(f(K,0,1);56!=a;)f(O,0,1);c[0]=n>>>24,c[1]=n>>>16,c[2]=n>>>8,c[3]=n,c[4]=s>>>24,c[5]=s>>>16,c[6]=s>>>8,c[7]=s,f(c,0,8);const i=new o(j),l=new u(i.buffer);for(let e=0;e<t.length;e++)l.setInt32(4*e,t[e]);return t.set(H),a=0,w=0,i}};function f(t,e,r){const o=e+r;if(w+=r,a){for(;o>e&&B>a;)n[a++]=t[e++];a==B&&(l(s,0),a=0)}if(o>=e+B){const n=new u(t.buffer,t.byteOffset,t.byteLength);for(;o>=e+B;e+=B)l(n,e)}for(;o>e;)n[a++]=t[e++]}function l(n,r){for(let t=0;16>t;t++)e[t]=n.getInt32(r+4*t);let s,o=t[0],c=t[1],a=t[2],i=t[3],w=t[4];for(let t=0;15>t;t+=5)w=(o<<5|o>>>27)+((a^i)&c^i)+w+1518500249+e[t]|0,c=c<<30|c>>>2,i=(w<<5|w>>>27)+((c^a)&o^a)+i+1518500249+e[t+1]|0,o=o<<30|o>>>2,a=(i<<5|i>>>27)+((o^c)&w^c)+a+1518500249+e[t+2]|0,w=w<<30|w>>>2,c=(a<<5|a>>>27)+((w^o)&i^o)+c+1518500249+e[t+3]|0,i=i<<30|i>>>2,o=(c<<5|c>>>27)+((i^w)&a^w)+o+1518500249+e[t+4]|0,a=a<<30|a>>>2;w=(o<<5|o>>>27)+((a^i)&c^i)+w+1518500249+e[15]|0,c=c<<30|c>>>2,s=e[13]^e[8]^e[2]^e[0],s=s<<1|s>>>31,e[0]=s,i=(w<<5|w>>>27)+((c^a)&o^a)+i+1518500249+s|0,o=o<<30|o>>>2,s=e[14]^e[9]^e[3]^e[1],s=s<<1|s>>>31,e[1]=s,a=(i<<5|i>>>27)+((o^c)&w^c)+a+1518500249+s|0,w=w<<30|w>>>2,s=e[15]^e[10]^e[4]^e[2],s=s<<1|s>>>31,e[2]=s,c=(a<<5|a>>>27)+((w^o)&i^o)+c+1518500249+s|0,i=i<<30|i>>>2,s=e[0]^e[11]^e[5]^e[3],s=s<<1|s>>>31,e[3]=s,o=(c<<5|c>>>27)+((i^w)&a^w)+o+1518500249+s|0,a=a<<30|a>>>2;for(let t=20;40>t;t+=5)s=e[t-3&15]^e[t-8&15]^e[t-14&15]^e[15&t],s=s<<1|s>>>31,e[15&t]=s,w=(o<<5|o>>>27)+(c^a^i)+w+1859775393+s|0,c=c<<30|c>>>2,s=e[t-2&15]^e[t-7&15]^e[t-13&15]^e[t+1&15],s=s<<1|s>>>31,e[t+1&15]=s,i=(w<<5|w>>>27)+(o^c^a)+i+1859775393+s|0,o=o<<30|o>>>2,s=e[t-1&15]^e[t-6&15]^e[t-12&15]^e[t+2&15],s=s<<1|s>>>31,e[t+2&15]=s,a=(i<<5|i>>>27)+(w^o^c)+a+1859775393+s|0,w=w<<30|w>>>2,s=e[15&t]^e[t-5&15]^e[t-11&15]^e[t+3&15],s=s<<1|s>>>31,e[t+3&15]=s,c=(a<<5|a>>>27)+(i^w^o)+c+1859775393+s|0,i=i<<30|i>>>2,s=e[t+1&15]^e[t-4&15]^e[t-10&15]^e[t+4&15],s=s<<1|s>>>31,e[t+4&15]=s,o=(c<<5|c>>>27)+(a^i^w)+o+1859775393+s|0,a=a<<30|a>>>2;for(let t=40;60>t;t+=5)s=e[t-3&15]^e[t-8&15]^e[t-14&15]^e[15&t],s=s<<1|s>>>31,e[15&t]=s,w=(o<<5|o>>>27)+(c&a|(c|a)&i)+w+2400959708+s|0,c=c<<30|c>>>2,s=e[t-2&15]^e[t-7&15]^e[t-13&15]^e[t+1&15],s=s<<1|s>>>31,e[t+1&15]=s,i=(w<<5|w>>>27)+(o&c|(o|c)&a)+i+2400959708+s|0,o=o<<30|o>>>2,s=e[t-1&15]^e[t-6&15]^e[t-12&15]^e[t+2&15],s=s<<1|s>>>31,e[t+2&15]=s,a=(i<<5|i>>>27)+(w&o|(w|o)&c)+a+2400959708+s|0,w=w<<30|w>>>2,s=e[15&t]^e[t-5&15]^e[t-11&15]^e[t+3&15],s=s<<1|s>>>31,e[t+3&15]=s,c=(a<<5|a>>>27)+(i&w|(i|w)&o)+c+2400959708+s|0,i=i<<30|i>>>2,s=e[t+1&15]^e[t-4&15]^e[t-10&15]^e[t+4&15],s=s<<1|s>>>31,e[t+4&15]=s,o=(c<<5|c>>>27)+(a&i|(a|i)&w)+o+2400959708+s|0,a=a<<30|a>>>2;for(let t=60;80>t;t+=5)s=e[t-3&15]^e[t-8&15]^e[t-14&15]^e[15&t],s=s<<1|s>>>31,e[15&t]=s,w=(o<<5|o>>>27)+(c^a^i)+w+3395469782+s|0,c=c<<30|c>>>2,s=e[t-2&15]^e[t-7&15]^e[t-13&15]^e[t+1&15],s=s<<1|s>>>31,e[t+1&15]=s,i=(w<<5|w>>>27)+(o^c^a)+i+3395469782+s|0,o=o<<30|o>>>2,s=e[t-1&15]^e[t-6&15]^e[t-12&15]^e[t+2&15],s=s<<1|s>>>31,e[t+2&15]=s,a=(i<<5|i>>>27)+(w^o^c)+a+3395469782+s|0,w=w<<30|w>>>2,s=e[15&t]^e[t-5&15]^e[t-11&15]^e[t+3&15],s=s<<1|s>>>31,e[t+3&15]=s,c=(a<<5|a>>>27)+(i^w^o)+c+3395469782+s|0,i=i<<30|i>>>2,s=e[t+1&15]^e[t-4&15]^e[t-10&15]^e[t+4&15],s=s<<1|s>>>31,e[t+4&15]=s,o=(c<<5|c>>>27)+(a^i^w)+o+3395469782+s|0,a=a<<30|a>>>2;t[0]=t[0]+o|0,t[1]=t[1]+c|0,t[2]=t[2]+a|0,t[3]=t[3]+i|0,t[4]=t[4]+w|0}})(),n=new o(B),s=new o(B);t.length>B&&(e.update(t,0,t.length),t=e.digest());for(let e=0;B>e;e++){const r=e<t.length?t[e]:0;n[e]=54^r,s[e]=92^r}return e.update(n,0,B),{update(t,n,r){e.update(t,n,r)},digest(){const t=e.digest();e.update(s,0,B),e.update(t,0,j);const r=e.digest();return e.update(n,0,B),r}}}function Y(t){return W[t>>>24]<<24|W[t>>>16&255]<<16|W[t>>>8&255]<<8|W[255&t]}function Z(t){return t<<24|(65280&t)<<8|t>>>8&65280|t>>>24}function $(t){return 255&(t<<1^27*(t>>7))}const _=typeof p!=z&&typeof p.getRandomValues==k,tt="Invalid password",et="zipjs-abort-check-password";function nt(t){if(_)return p.getRandomValues(t);throw new s("Crypto API not supported")}const rt={name:"PBKDF2"},st=e.assign({hash:{name:"HMAC"}},rt),ot=e.assign({iterations:1e3,hash:{name:"SHA-1"}},rt),ct=["deriveBits"],at=[8,12,16],it=[16,24,32],wt=10,ut=typeof p!=z,ft=ut&&p.subtle;let lt=ut&&typeof ft!=z&&typeof ft.importKey==k&&typeof ft.deriveBits==k,pt=Q;class dt extends h{constructor({password:t,rawPassword:e,encryptionStrength:n,checkPasswordOnly:r,checkAuthenticationCode:c=!0}){super({start(){yt(this,t,e,n)},async transform(t,e){const n=this,{password:c,strength:a,l:i,ready:w}=n;c?(await(async(t,e,n,r)=>{const o=await gt(t,e,n,zt(r,0,at[e])),c=zt(r,at[e]);if(o[0]!=c[0]||o[1]!=c[1])throw St(t),new s(tt)})(n,a,c,zt(t,0,at[a]+2)),t=zt(t,at[a]+2),r?(St(n),e.error(new s(et))):i()):await w;const u=new o(t.length-wt-(t.length-wt)%16);e.enqueue(mt(n,t,u,0,wt,!0))},async flush(t){const{h:e,m:n,ready:r}=this;if(e){await r;const a=zt(n,n.length-wt),i=new o(zt(n,0,n.length-wt));e.process(i,!0);const w=e.digest();let u=n.length<wt?1:0;for(let t=0;wt>t;t++)u|=w[t]^a[t];if(u&&c)throw new s("Invalid authentication code");t.enqueue(i)}},cancel(){St(this)}})}}class ht extends h{constructor({password:t,rawPassword:e,encryptionStrength:n}){super({start(){yt(this,t,e,n)},async transform(t,e){const n=this,{password:r,strength:s,l:c,ready:a}=n;let i=C;r?(i=await(async(t,e,n)=>{const r=nt(new o(at[e]));return U(r,await gt(t,e,n,r))})(n,s,r),c()):await a;const w=new o(i.length+t.length-t.length%16);w.set(i,0),e.enqueue(mt(n,t,w,i.length,0,!1))},async flush(t){const{h:e,m:n,ready:r}=this;if(e){await r;const s=new o(n);e.process(s,!1);const c=zt(e.digest(),0,wt);t.enqueue(U(s,c))}},cancel(){St(this)}})}}function yt(t,n,r,s){e.assign(t,{ready:new f(e=>t.l=e),password:vt(n,r),strength:s-1,m:C})}function mt(t,e,n,r,s,c){const{h:a,m:i}=t;i.length&&(e=U(i,e));const w=e.length-s,u=w-w%16;if(n=((t,e)=>{if(e&&e>t.length){const n=t;(t=new o(e)).set(n,0)}return t})(n,r+u),u){const t=zt(n,r,r+u);t.set(zt(e,0,u)),a.process(t,c)}return t.m=zt(e,u),n}function St({h:t}){t&&t.dispose&&t.dispose()}async function gt(t,n,s,c){t.password=null;const a=it[n],i=await(async(t,n,s)=>{if(lt)try{const r=await ft.importKey("raw",t,st,!1,ct);return new o(await ft.deriveBits(e.assign({salt:n},ot),r,8*s))}catch{lt=!1}return((t,e,n,s)=>{const c=X(t),a=new o(s),i=new o(e.length+4),w=new u(i.buffer);i.set(e);for(let t=1,n=0;s>n;t++,n+=j){w.setUint32(e.length,t),c.update(i,0,i.length);let o=c.digest();const u=o.slice();for(let t=1;1e3>t;t++){c.update(o,0,j),o=c.digest();for(let t=0;j>t;t++)u[t]^=o[t]}a.set(u.subarray(0,r.min(j,s-n)),n)}return a})(t,n,0,s)})(s,c,2*a+2);return t.h=pt(zt(i,0,a),zt(i,a,2*a)),zt(i,2*a)}function vt(t,e){return e===v?(t=>{if(typeof l==z){const e=new o((t=unescape(encodeURIComponent(t))).length);for(let n=0;n<e.length;n++)e[n]=t.charCodeAt(n);return e}return(new l).encode(t)})(t):e}function zt(t,e,n){return t.subarray(e,n)}class kt extends h{constructor({password:t,rawPassword:e,passwordVerification:n,checkPasswordOnly:r}){super({start(){It(this,t,e,n)},transform(t,e){const n=this;if(n.password||n.rawPassword){const e=bt(n,t.subarray(0,12));if(n.password=n.rawPassword=null,0!=(e[11]^n.passwordVerification))throw new s(tt);t=t.subarray(12)}r?e.error(new s(et)):e.enqueue(bt(n,t))}})}}class Ct extends h{constructor({password:t,rawPassword:e,passwordVerification:n}){super({start(){It(this,t,e,n)},transform(t,e){const n=this;let r,s;if(n.password||n.rawPassword){n.password=n.rawPassword=null;const e=nt(new o(12));e[11]=n.passwordVerification,r=new o(t.length+e.length),r.set(xt(n,e),0),s=12}else r=new o(t.length),s=0;r.set(xt(n,t),s),e.enqueue(r)}})}}function It(t,n,r,s){e.assign(t,{password:n,rawPassword:r,passwordVerification:s}),((t,n,r)=>{const s=[305419896,591751049,878082192];if(e.assign(t,{keys:s,S:new R(s[0]),v:new R(s[2])}),r)for(let e=0;e<r.length;e++)At(t,r[e]);else for(let e=0;e<n.length;e++)At(t,n.charCodeAt(e))})(t,n,r)}function bt(t,e){const n=new o(e.length);for(let r=0;r<e.length;r++)n[r]=Pt(t)^e[r],At(t,n[r]);return n}function xt(t,e){const n=new o(e.length);for(let r=0;r<e.length;r++)n[r]=Pt(t)^e[r],At(t,e[r]);return n}function At(t,e){let[,n]=t.keys;t.S.append([e]);const s=~t.S.get();n=Dt(r.imul(Dt(n+Mt(s)),134775813)+1),t.v.append([n>>>24]);const o=~t.v.get();t.keys=[s,n,o]}function Pt(t){const e=2|t.keys[2];return Mt(r.imul(e,1^e)>>>8)}function Mt(t){return 255&t}function Dt(t){return 4294967295&t}function Ft(t){if(t instanceof y)return t;const e=t.getReader();return new y({async pull(t){const{value:n,done:r}=await e.read();r?t.close():t.enqueue(n)},cancel:t=>e.cancel(t)})}const Et=new w;function Rt(t){return Et.get(t)}const Tt="Invalid uncompressed size",Ut="deflate-raw",Vt="gzip",Bt=[31,139,8];class jt extends h{constructor(t,{chunkSize:e,CompressionStreamFallback:n,CompressionStream:r}){super({});const{compressed:s,encrypted:o,useCompressionStream:c,zipCrypto:a,computeCrc32:i,level:w,deflate64:f,format:l,compressionMethod:p,inputSize:d}=t,h=this;let y,m,S,g=super.readable;const v=l&&Rt(l),z=((t,e,n)=>t&&e?e:n&&n.C?n:void 0)(c,r,n),k=i&&s&&!f&&!v&&(!o||a)&&!!z;if(o&&!a||!i||k||(y=new T,g=qt(g,y)),s)if(v)g=Gt(g,Lt(v.CompressionStream,l,{level:w,chunkSize:e,compressionMethod:p,uncompressedSize:d}));else if(k)S=new Kt,g=Gt(g,new z(Vt,{level:w,chunkSize:e})),g=qt(g,S);else try{g=Nt(g,c,{level:w,chunkSize:e},r,n)}catch(t){let e;try{e=new r(Vt)}catch{throw t}g=Gt(g,e),g=qt(g,new Kt)}o&&(a?g=qt(g,new Ct(t)):(m=new ht(t),g=qt(g,m))),Wt(h,g,()=>{o&&!a||!i||(h.crc32=k?S.crc32:new u(y.value.buffer).getUint32(0))})}}class Kt extends h{constructor(){let t,e=10,n=new o(0);super({transform(t,s){if(e){const n=r.min(e,t.length);if(e-=n,!(t=t.subarray(n)).length)return}const o=n.length+t.length;if(8>=o)return void(n=U(n,t));const c=o-8,a=r.min(c,n.length);s.enqueue(U(n.subarray(0,a),t.subarray(0,c-a))),n=U(n.subarray(a),t.subarray(c-a))},flush(){const e=V(n);t.crc32=e.getUint32(0,!0),t.uncompressedSize=e.getUint32(4,!0)}}),t=this}}class Ot extends h{constructor(t,{chunkSize:e,DecompressionStreamFallback:n,DecompressionStream:r}){super({});const{zipCrypto:c,encrypted:a,checkCrc32:i,crc32:w,compressed:l,useCompressionStream:p,deflate64:d,format:m,compressionMethod:S,rawBitFlag:g,outputSize:z}=t;let k,C,I,b=super.readable;if(a&&(c?b=qt(b,new kt(t)):(C=new dt(t),b=qt(b,C))),l){const t=m&&Rt(m);if(t)b=Gt(b,Lt(t.DecompressionStream,m,{chunkSize:e,compressionMethod:S,rawBitFlag:g,uncompressedSize:z}));else try{b=Nt(b,p,{chunkSize:e,deflate64:d},r,n)}catch(t){if(d||z===v)throw t;let e;try{e=new r(Vt)}catch{throw t}I=new R,b=((t,e,n,r)=>{let c,a,i,w=0,u=!1;const l=new f((t,e)=>{a=t,i=e});l.catch(()=>{}),n||a();const p=new h({start(t){const e=new o(10);e.set(Bt),t.enqueue(e)},transform(t,e){e.enqueue(t)},async flush(t){u=!0,y();try{await l}finally{m()}const e=new o(8),s=V(e);s.setUint32(0,r.get(),!0),s.setUint32(4,n,!0),t.enqueue(e)},cancel(t){i(t)}}),d=new h({transform(t,e){r.append(t),w+=t.length,n>w?u&&y():a(),e.enqueue(t)},cancel(t){i(t)}});return t=qt(t,p),qt(t=Gt(t,e),d);function y(){m(),c=setTimeout(()=>i(new s(Tt)),5e3)}function m(){clearTimeout(c)}})(b,e,z,I)}b=(t=>{const e=t.getReader();return new y({async pull(t){let n;try{n=await e.read()}catch(t){if(t&&t.message)throw t;const e=new s("Invalid compressed data");throw e.cause=t,e}const{value:r,done:o}=n;o?t.close():t.enqueue(r)},cancel:t=>e.cancel(t)})})(b)}i&&!I&&(k=new T,b=qt(b,k)),Wt(this,b,()=>{if(i){const t=I?I.get()>>>0:new u(k.value.buffer).getUint32(0,!1);if(w!=t)throw new s("Invalid CRC32")}})}}const Ht=new w;function Wt(t,n,r){n=qt(n,new h({flush:r})),e.defineProperty(t,"readable",{get:()=>n})}function Lt(t,e,n){if(!t)throw new s("Compression method not supported");return new t(e,n)}function Nt(t,e,n,r,s){const o=e&&r?r:s||r,c=n.deflate64?"deflate64-raw":Ut;let a;try{a=new o(c,n)}catch(t){if(!e||!s||o==s)throw t;a=new s(c,n)}return Gt(t,a)}function qt(t,e){return Ft(t).pipeThrough(e)}function Gt(t,e){const n=e.writable.getWriter(),r=t.getReader();return(async()=>{try{for(;;){await n.ready;const t=await r.read();if(t.done){await n.close();break}await n.write(t.value)}}catch(t){await(async(t,e)=>{try{await t.abort(e)}catch{}})(n,t),await(async(t,e)=>{try{await t.cancel(e)}catch{}})(r,t)}})(),e.readable}const Jt="data",Qt="deflate";class Xt extends h{constructor(t,n){super({});const r=this,{codecType:o}=t;let c;o.startsWith(Qt)?c=jt:o.startsWith("inflate")&&(c=Ot),r.outputSize=0;let a=0;const i=new c(t,n),w=super.readable,u=new h({transform(t,e){t&&t.length&&(a+=t.length,e.enqueue(t))},flush(){e.assign(r,{inputSize:a})}}),f=new h({transform(e,n){if(e&&e.length&&(n.enqueue(e),r.outputSize+=e.length,t.outputSize!==v&&r.outputSize>t.outputSize))throw new s(Tt)},flush(){const{crc32:t}=i;e.assign(r,{crc32:t,inputSize:a})}});e.defineProperty(r,"readable",{get:()=>w.pipeThrough(u).pipeThrough(i).pipeThrough(f)})}}class Yt extends h{constructor(t){const r=[];let s=0,c=0;function a(){const e=new o(t);let n=0;for(;t>n;){const s=r[0],o=t-n;s.length>o?(e.set(s.subarray(0,o),n),r[0]=s.subarray(o),n+=o):(e.set(s,n),n+=s.length,r.shift())}return s-=t,e}n.isFinite(t)&&t>=1||(t=65536),super({transform(e,n){for(r.push(e),s+=e.length;s>t;)c+=t,n.enqueue(a())},flush(t){s&&(c+=s,t.enqueue(((t,e)=>{const n=new o(e);let r=0;for(const e of t)n.set(e,r),r+=e.length;return n})(r,s)))}}),e.defineProperty(this,"outputSize",{get:()=>c})}}let Zt=2;try{typeof navigator!=z&&navigator.hardwareConcurrency&&(Zt=navigator.hardwareConcurrency)}catch{}function $t(t){return!!t&&"object"==typeof t}const _t=new w,te=new w,ee=(()=>{try{return structuredClone(new s)instanceof s}catch{return!1}})();let ne=0;async function re(t){let e,o,c;try{const{options:a,config:i}=t;if(a.format)try{await(async(t,e)=>{!Et.has(t)&&e&&((t,e)=>{const{CompressionStream:n,DecompressionStream:r}=e;if(typeof n!=k&&typeof r!=k)throw new s("Invalid codec module");Et.set(t,{CompressionStream:n,DecompressionStream:r})})(t,await(import(e)))})(a.format,a.codecURI)}catch(t){if($t(t))try{t.codecImportFailed=!0}catch{}throw t}if(i.CompressionStream=self.CompressionStream,i.DecompressionStream=self.DecompressionStream,a.compressed&&!a.format)if(a.useCompressionStream){if(!((t,e)=>{if(!t)return!1;let n=Ht.get(t);n||(n=new w,Ht.set(t,n));let r=n.get(e);if(r===v){try{new t(e),r=!0}catch{r=!1}n.set(e,r)}return r})(a.codecType.startsWith(Qt)?i.CompressionStream:i.DecompressionStream,Ut))try{await self.initModule(t.config)}catch{}}else try{await self.initModule(t.config)}catch{a.useCompressionStream=!0}if(a.encrypted&&!a.zipCrypto)try{await self.initModule(t.config)}catch{}!i.CompressionStreamFallback&&i.CompressionStreamZlib&&(i.CompressionStreamFallback=i.CompressionStreamZlib),!i.DecompressionStreamFallback&&i.DecompressionStreamZlib&&(i.DecompressionStreamFallback=i.DecompressionStreamZlib);const u={highWaterMark:1},l=t.readable?Ft(t.readable):new y({async pull(t){const e=new f(t=>_t.set(ne,t));se({type:"pull",messageId:ne}),ne=(ne+1)%n.MAX_SAFE_INTEGER;const{value:r,done:s}=await e;t.enqueue(r),s&&t.close()}},u);c=t.writable?(t=>{if(t instanceof m)return t;const e=t.getWriter();return new m({write:t=>e.write(t),close:()=>e.close(),abort:t=>e.abort(t)})})(t.writable):new m({async write(t){let e;const r=new f(t=>e=t);te.set(ne,e),se({type:Jt,value:t,messageId:ne}),ne=(ne+1)%n.MAX_SAFE_INTEGER,await r}},u),e=new Xt(a,i),o=new Yt((t=>{return s="string"==typeof(e=s=t.chunkSize)&&e.trim()?n(e):e,n.isInteger(s)&&s>=1?r.max(s,64):65536;var e,s})(i)),await l.pipeThrough(e).pipeThrough(o).pipeTo(c,{preventClose:!0,preventAbort:!0}),await c.getWriter().close();const{crc32:p,inputSize:d,outputSize:h}=e;se({type:"close",result:{crc32:p,inputSize:d,outputSize:h}})}catch(t){const e=o?o.outputSize:0;if($t(t))try{t.outputSize=e}catch{}if(c&&!c.locked)try{await c.getWriter().close()}catch{}oe(t,e)}}function se(t){const{value:e}=t;if(e)if(e.length)try{t.value=(n=e,n.byteOffset||n.byteLength!=n.buffer.byteLength?new o(n):n).buffer,d(t,[t.value])}catch{d(t)}else d(t);else d(t);var n}function oe(t,e){const{message:n,stack:r,code:o,name:c,outputSize:a,cause:i,codecImportFailed:w}=((t=new s("Unknown error"))=>$t(t)?t:new s(t+""))(t),u={message:n,stack:r,code:o,name:c,outputSize:a===v?e:a};if(i&&(u.cause={name:i.name,message:i.message}),w&&(u.codecImportFailed=!0),ee)try{return void d({error:u,errorValue:{value:t}})}catch{}d({error:u})}addEventListener("message",({data:t})=>{const{type:e,messageId:n,value:r,done:s}=t;try{if("start"==e&&re(t),e==Jt){const t=_t.get(n);_t.delete(n),t({value:r||new o,done:s})}if("ack"==e){const t=te.get(n);te.delete(n),t()}}catch(t){oe(t)}}),d({type:"ready"}),((t={})=>{const{init:e,I:n}=t,r=t.CompressionStreamFallback||t.CompressionStreamZlib,s=t.DecompressionStreamFallback||t.DecompressionStreamZlib;n&&(pt=n||Q),self.initModule=async t=>{e&&await e(t),r&&(t.CompressionStreamFallback=r),s&&(t.DecompressionStreamFallback=s)}})()}();
|