PairDrop/public/scripts/zip.min.js

2 lines
92 KiB
JavaScript
Raw Normal View History

((e,t)=>{"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).zip={})})(this,(function(e){"use strict";const{Array:t,Object:n,String:r,Number:s,BigInt:i,Math:a,Date:o,Map:c,Set:l,Response:u,URL:f,Error:d,Uint8Array:w,Uint16Array:h,Uint32Array:p,DataView:g,Blob:m,Promise:y,TextEncoder:b,TextDecoder:S,document:k,crypto:z,btoa:x,TransformStream:v,ReadableStream:C,WritableStream:_,CompressionStream:D,DecompressionStream:R,navigator:F,Worker:E}="undefined"!=typeof globalThis?globalThis:this||self,I=4294967295,A=65535,T=67324752,H=134695760,O=33639248,U=101075792,N=117853008,W=21589,q=2048,L="/",M=new o(2107,11,31),P=new o(1980,0,1),V=void 0,B="undefined",K="function";class Y{constructor(e){return class extends v{constructor(t,n){const r=new e(n);super({transform(e,t){t.enqueue(r.append(e))},flush(e){const t=r.flush();t&&e.enqueue(t)}})}}}}let Z=2;try{typeof F!=B&&F.hardwareConcurrency&&(Z=F.hardwareConcurrency)}catch(e){}const X={chunkSize:524288,maxWorkers:Z,terminateWorkerTimeout:5e3,useWebWorkers:!0,useCompressionStream:!0,workerScripts:V,CompressionStreamNative:typeof D!=B&&D,DecompressionStreamNative:typeof R!=B&&R},G=n.assign({},X);function j(){return G}function J(e){return a.max(e.chunkSize,64)}function Q(e){const{baseURL:n,chunkSize:r,maxWorkers:s,terminateWorkerTimeout:i,useCompressionStream:a,useWebWorkers:o,Deflate:c,Inflate:l,CompressionStream:u,DecompressionStream:f,workerScripts:w}=e;if($("baseURL",n),$("chunkSize",r),$("maxWorkers",s),$("terminateWorkerTimeout",i),$("useCompressionStream",a),$("useWebWorkers",o),c&&(G.CompressionStream=new Y(c)),l&&(G.DecompressionStream=new Y(l)),$("CompressionStream",u),$("DecompressionStream",f),w!==V){const{deflate:e,inflate:n}=w;if((e||n)&&(G.workerScripts||(G.workerScripts={})),e){if(!t.isArray(e))throw new d("workerScripts.deflate must be an array");G.workerScripts.deflate=e}if(n){if(!t.isArray(n))throw new d("workerScripts.inflate must be an array");G.workerScripts.inflate=n}}}function $(e,t){t!==V&&(G[e]=t)}function ee(e,t,r){return class{constructor(s){const i=this;n.hasOwn(s,"level")&&void 0===s.level&&delete s.level,i.codec=new e(n.assign({},t,s)),r(i.codec,(e=>{if(i.pendingData){const t=i.pendingData;i.pendingData=new w(t.length+e.length);const{pendingData:n}=i;n.set(t,0),n.set(e,t.length)}else i.pendingData=new w(e)}))}append(e){return this.codec.push(e),s(this)}flush(){return this.codec.push(new w,!0),s(this)}};function s(e){if(e.pendingData){const t=e.pendingData;return e.pendingData=null,t}return new w}}const te=[];for(let e=0;256>e;e++){let t=e;for(let e=0;8>e;e++)1&t?t=t>>>1^3988292384:t>>>=1;te[e]=t}class ne{constructor(e){this.crc=e||-1}append(e){let t=0|this.crc;for(let n=0,r=0|e.length;r>n;n++)t=t>>>8^te[255&(t^e[n])];this.crc=t}get(){return~this.crc}}class re extends v{constructor(){const e=new ne;super({transform(t){e.append(t)},flush(t){const n=new w(4);new g(n.buffer).setUint32(0,e.get()),t.enqueue(n)}})}}function se(e){if(void 0===b){const t=new w((e=unescape(encodeURIComponent(e))).length);for(let n=0;n<t.length;n++)t[n]=e.charCodeAt(n);return t}return(new b).encode(e)}const ie={concat(e,t){if(0===e.length||0===t.length)return e.concat(t);const n=e[e.length-1],r=ie.getPartial(n);return 32===r?e.concat(t):ie._shiftRight(t,r,0|n,e.slice(0,e.length-1))},bitLength(e){const t=e.length;if(0===t)return 0;const n=e[t-1];return 32*(t-1)+ie.getPartial(n)},clamp(e,t){if(32*e.length<t)return e;const n=(e=e.slice(0,a.ceil(t/32))).length;return t&=31,n>0&&t&&(e[n-1]=ie.partial(t,e[n-1]&2147483648>>t-1,1)),e},partial:(e,t,n)=>32===e?t:(n?0|t:t<<32-e)+1099511627776*e,getPartial:e=>a.round(e/1099511627776)||32,_shiftRight(e,t,n,r){for(void 0===r&&(r=[]);t>=32;t-=32)r.push(n),n=0;if(0===t)return r.concat(e);for(let s=0;s<e.length;s++)r.push(n|e[s]>>>t),n=e[s]<<32-t;const s=e.length?e[e.length-1]:0,i=ie.getPartial(s);return r.push(ie.partial(t+i&31,t+i>32?n:r.pop(),1)),r}},ae={bytes:{fromBits(e){const t=ie.bitLength(e)/8,n=new w(t);let r;for(