@zip.js/zip.js 2.8.50 → 2.8.52

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.
@@ -1 +1 @@
1
- ((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:r,String:n,Number:s,BigInt:i,Math:a,Date:o,Map:c,Set:d,Response:l,URL:u,Error:w,Uint8Array:f,Uint16Array:p,Uint32Array:h,DataView:m,Blob:y,Promise:g,TextEncoder:x,TextDecoder:S,document:b,crypto:z,btoa:F,TransformStream:E,ReadableStream:R,WritableStream:D,CompressionStream:A,DecompressionStream:C,navigator:T,Worker:v,Symbol:k,setTimeout:U,clearTimeout:I,structuredClone:M}="undefined"!=typeof globalThis?globalThis:this||self,O=4294967295,_=65535,N=255,L=67324752,P=134695760,W=P,V=84233040,B=33639248,Z=101010256,H=101075792,q=117853008,j=22,K=20,Y=56,G=39169,X=21589,J=6534,Q=30837,$=30805,ee=2048,te=16384,re=2048,ne=1024,se="/",ie=30,ae=new o(2107,11,31,23,59,58),oe=new o(1980,0,1),ce=void 0,de=1/0,le="undefined",ue="function",we="string",fe=new f;let pe=2;try{typeof T!=le&&T.hardwareConcurrency&&(pe=T.hardwareConcurrency)}catch{}const he={workerURI:"./core/web-worker-wasm.js",wasmURI:"./core/streams/zlib-wasm/zlib-streams.wasm",chunkSize:65536,maxWorkers:pe,terminateWorkerTimeout:5e3,workerStarvationTimeout:5e3,workerStartupTimeout:5e3,useWebWorkers:!0,useCompressionStream:!0,transferStreams:!0,CompressionStream:typeof A!=le&&A,DecompressionStream:typeof C!=le&&C};function me(){return he}function ye(e){return a.max(e.chunkSize,64)}function ge(e,t){const r=new f(e.length+t.length);return r.set(e),r.set(t,e.length),r}function xe(e){return e.byteOffset||e.byteLength!=e.buffer.byteLength?new f(e):e}function Se(e){return new m(e.buffer,e.byteOffset,e.byteLength)}function be(e){if(e instanceof R)return e;const t=e.getReader();return new R({async pull(e){const{value:r,done:n}=await t.read();n?e.close():e.enqueue(r)},cancel:e=>t.cancel(e)})}function ze(e,t){if(e=be(e),typeof y.prototype.stream!=ue||new y([]).stream()instanceof R){const r={};return t&&(r.headers=[["Content-Type",t]]),new l(e,r).blob()}const r=[];return e.pipeTo(new D({write(e){r.push(e)}})).then(()=>new y(r,t?{type:t}:{}))}function Fe(e){if(e instanceof D)return e;const t=e.getWriter();return new D({write:e=>t.write(e),close:()=>t.close(),abort:e=>t.abort(e)})}const Ee="HTTP error ",Re="HTTP Range not supported",De="HTTP resource changed",Ae="Content-Range",Ce="Range",Te="GET",ve="bytes",ke=16777216,Ue="writable",Ie=k();class Me{constructor(){this.size=0}init(){this.initialized=!0}}class Oe extends Me{get readable(){return this.createReadable()}createReadable({offset:e=0,size:t,chunkSize:r=ye(me())}={}){const n=this;let s=0;return new R({async pull(i){const o=t===ce?r:a.min(r,t-s),c=await mt(n,e+s,o);i.enqueue(c),s+r>t||t===ce&&!c.length&&o?i.close():s+=r}})}}class _e extends Me{constructor(){super();const e=this,t=new D({write(t){if(!e.initialized)throw new w("Writer not initialized");return e.writeUint8Array(xe(t))}});r.defineProperty(e,Ue,{get:()=>t})}writeUint8Array(){}}class Ne extends Oe{constructor(e){super();let t=e.length;for(;"="==e.charAt(t-1);)t--;const n=e.indexOf(",")+1;r.assign(this,{dataURI:e,o:n,size:a.floor(.75*(t-n))})}readUint8Array(e,t){const{o:r,dataURI:n}=this,s=new f(t),i=4*a.floor(e/3),o=atob(n.substring(i+r,4*a.ceil((e+t)/3)+r)),c=e-3*a.floor(i/4);let d=0;for(let e=c;c+t>e&&e<o.length;e++)s[e-c]=o.charCodeAt(e),d++;return d<s.length?s.subarray(0,d):s}}class Le extends _e{constructor(e){super(),r.assign(this,{data:"data:"+(e||"")+";base64,",pending:[]})}writeUint8Array(e){const t=this;let r,s=t.pending;const i=t.pending.length;for(t.pending="",r=0;r<3*a.floor((i+e.length)/3)-i;r++)s+=n.fromCharCode(e[r]);for(;r<e.length;r++)t.pending+=n.fromCharCode(e[r]);s.length>2?t.data+=F(s):t.pending=s+t.pending}getData(){return this.data+F(this.pending)}}let Pe,We;class Ve extends Oe{constructor(e){super(),r.assign(this,{blob:e,size:e.size}),We||(We=(async()=>{try{const e=new y([new f(3)]).slice(1,2).stream().getReader();let t=0,r=await e.read();for(;!r.done;)t+=r.value.length,r=await e.read();Pe=1==t}catch{Pe=!1}})())}createReadable(e){const{blob:t,size:r}=this,{offset:n=0,size:s=r-n}=e||{};return n||r>s?Pe?be(t.slice(n,n+s).stream()):super.createReadable(e):be(t.stream())}async readUint8Array(e,t){const r=this,n=e+t,s=e||n<r.size?r.blob.slice(e,n):r.blob;let i=await s.arrayBuffer();return i.byteLength>t&&(i=i.slice(e,n)),new f(i)}}class Be extends Me{constructor(e){super();const t=this,n=new E;r.defineProperty(t,Ue,{get:()=>n.writable}),t.blob=ze(n.readable,e),t.blob.catch(()=>{})}getData(){return this.blob}}class Ze extends Ve{constructor(e){super(new y([e],{type:"text/plain"}))}}class He extends Be{constructor(e){super(e),r.assign(this,{encoding:e,l:!e||"utf-8"==e.toLowerCase()})}async getData(){const{encoding:e,l:t}=this,n=await super.getData();if(n.text&&t)return n.text();{const t=new FileReader;return new g((s,i)=>{r.assign(t,{onload:({target:e})=>s(e.result),onerror:()=>i(t.error)}),t.readAsText(n,e)})}}}class qe extends Oe{constructor(e,t){super(),Ke(this,e,t)}async init(){await Ye(this,at,rt),super.init()}createReadable(e){const t=this,{useRangeHeader:r,forceRangeRequests:n,size:i}=t;if((r||n)&&i!==ce){const{offset:r=0,size:n=i-r}=e||{};if(n>0&&i>r)return((e,t,r)=>{let n,i=t,o=0,c=r;return new R({start:()=>d(),async pull(e){n||await d();const{value:t,done:r}=await n.read();if(r)throw new w(Re);const s=t.length>o?t.subarray(0,o):t;o-=s.length,c-=s.length,s.length&&e.enqueue(s),o||(await(async()=>{const e=n;n=ce,await e.cancel()})(),c||e.close())},cancel:e=>n&&n.cancel(e)});async function d(){const t=a.min(e.maximumRangeSize,c),r=await at(Te,e,et(e,i,t));if(206!=r.status)throw new w(Re);const d=r.headers.get(Ae);if(d){const e=s(d.trim().split(/[\s-]+/)[1]);if(!s.isNaN(e)&&e!=i)throw new w(Re)}$e(e,r),Qe(e,r),i+=t,o=t,n=r.body.getReader()}})(t,r,a.min(n,i-r))}return super.createReadable(e)}readUint8Array(e,t){return Ge(this,e,t,at,rt)}}class je extends Oe{constructor(e,t){super(),Ke(this,e,t)}async init(){await Ye(this,ot,nt),super.init()}readUint8Array(e,t){return Ge(this,e,t,ot,nt)}}function Ke(e,t,n){const{preventHeadRequest:s,useRangeHeader:i,forceRangeRequests:a,combineSizeEocd:o,checkResourceChanges:c=!0,maximumRangeSize:d=ke,fetch:l}=n;delete(n=r.assign({},n)).preventHeadRequest,delete n.useRangeHeader,delete n.forceRangeRequests,delete n.combineSizeEocd,delete n.checkResourceChanges,delete n.maximumRangeSize,delete n.useXHR,delete n.fetch,r.assign(e,{url:t,options:n,preventHeadRequest:s,useRangeHeader:i,forceRangeRequests:a,combineSizeEocd:o,checkResourceChanges:c,maximumRangeSize:d,fetch:l})}async function Ye(e,t,r){const{url:n,preventHeadRequest:s,useRangeHeader:i,forceRangeRequests:a,combineSizeEocd:o}=e;if((e=>{const{baseURI:t}=me(),{protocol:r}=new u(e,t);return"http:"==r||"https:"==r})(n)&&(i||a)&&(typeof s==le||s)){const n=await t(Te,e,et(e,o?-22:void 0)),s=n.headers.get("Accept-Ranges");if(!(a||s&&s.toLowerCase()==ve))throw new w(Re);{if(o){const t=new f(await n.arrayBuffer());206==n.status&&t.length==j&&(e.h=t)}Qe(e,n);const s=Xe(n);s===ce?await it(e,t,r):e.size=s}}else await it(e,t,r)}async function Ge(e,t,r,n,i){const{useRangeHeader:a,forceRangeRequests:o,h:c,size:d,options:l}=e;if(a||o){if(c&&t==d-j&&r==j)return c;if(d>t&&0!==r){t+r>d&&(r=d-t);const i=await n(Te,e,et(e,t,r));if(206!=i.status)throw new w(Re);const a=i.headers.get(Ae);if(a){const e=s(a.trim().split(/[\s-]+/)[1]);if(!s.isNaN(e)&&e!=t)throw new w(Re)}$e(e,i),Qe(e,i);const o=new f(await i.arrayBuffer());if(o.length!=r)throw new w(Re);return o}return fe}{const{data:n}=e;return n||await i(e,l),e.data.subarray(t,t+r)}}function Xe(e){const t=e.headers.get(Ae);if(t){const e=t.trim().split(/\s*\/\s*/)[1];if(e&&"*"!=e){const t=s(e);if(!s.isNaN(t))return t}}}function Je({headers:e}){return{m:e.get("Etag")||ce,lastModified:e.get("Last-Modified")||ce}}function Qe(e,t){const{checkResourceChanges:r,S:n}=e;r&&!n&&206==t.status&&(e.S=Je(t))}function $e(e,t){const{checkResourceChanges:n,S:s,size:i}=e;if(n){const e=Xe(t);if(e!==ce&&i!==ce&&e!=i)throw new w(De);if(s){const e=Je(t);if(r.entries(s).some(([t,r])=>r!==ce&&e[t]!==ce&&r!=e[t]))throw new w(De)}}}function et(e,t=0,n=1){return r.assign({},tt(e),{[Ce]:ve+"="+(0>t?t:t+"-"+(t+n-1))})}function tt({options:e}){const{headers:t}=e;if(t)return k.iterator in t?r.fromEntries(t):t}async function rt(e){await st(e,at)}async function nt(e){await st(e,ot)}async function st(e,t){const r=await t(Te,e,tt(e));e.data=new f(await r.arrayBuffer()),e.size=e.data.length}async function it(e,t,r){if(e.preventHeadRequest)await r(e,e.options);else{const n=await t("HEAD",e,tt(e)),i=n.headers.get("Content-Length");i&&!n.headers.get("Content-Encoding")?e.size=s(i):await r(e,e.options)}}async function at(e,{fetch:t=fetch,options:n,url:s},i){const a=await t(s,r.assign({},n,{method:e,headers:i}));if(400>a.status)return a;throw 416==a.status?new w(Re):new w(Ee+(a.statusText||a.status))}function ot(e,{url:t},n){return new g((s,i)=>{const a=new XMLHttpRequest;if(a.addEventListener("load",()=>{if(400>a.status){const e=[];a.getAllResponseHeaders().trim().split(/[\r\n]+/).forEach(t=>{const r=t.trim().split(/\s*:\s*/);r[0]=r[0].trim().replace(/^[a-z]|-[a-z]/g,e=>e.toUpperCase()),e.push(r)}),s({status:a.status,arrayBuffer:()=>a.response,headers:new c(e)})}else i(416==a.status?new w(Re):new w(Ee+(a.statusText||a.status)))},!1),a.addEventListener("error",e=>i(e.detail?e.detail.error:new w("Network error")),!1),a.open(e,t),n)for(const e of r.entries(n))a.setRequestHeader(e[0],e[1]);a.responseType="arraybuffer",a.send()})}class ct extends Oe{constructor(e,t={}){super(),r.assign(this,{url:e,reader:t.useXHR&&!t.fetch?new je(e,t):new qe(e,t)})}set size(e){}get size(){return this.reader.size}async init(){await this.reader.init(),super.init()}createReadable(e){return this.reader.createReadable(e)}readUint8Array(e,t){return this.reader.readUint8Array(e,t)}}class dt extends Oe{constructor(e){super(),e=new f(e.buffer,e.byteOffset,e.byteLength),r.assign(this,{array:e,size:e.length})}readUint8Array(e,t){return this.array.slice(e,e+t)}}class lt extends _e{constructor(e){super(),this.defaultBufferSize=e||262144}init(e=0){r.assign(this,{offset:0,array:new f(e>0?e:this.defaultBufferSize)}),super.init()}writeUint8Array(e){const t=this,r=t.offset+e.length;if(r>t.array.length){let e=t.array.length?2*t.array.length:t.defaultBufferSize;for(;r>e;)e*=2;const n=t.array;t.array=new f(e),t.array.set(n)}t.array.set(e,t.offset),t.offset+=e.length}getData(){return this.offset===this.array.length?this.array:this.array.slice(0,this.offset)}}class ut extends Oe{constructor(e){super(),this.F=e}async init(){const e=this,{F:t}=e;e.R=0,await g.all(t.map(e=>ht(e))),e.D=t.map(t=>{const r=e.size;return e.size+=t.size,r}),super.init()}A(e){const{D:t,size:r}=this,n=t[e];return n===ce?r:n}async readUint8Array(e,t){const r=this,{F:n}=this;let s,i=0,o=e;for(;n[i]&&o>=n[i].size;)o-=n[i].size,i++;const c=n[i];if(c){const n=c.size;if(o+t>n){const i=n-o;s=ge(await mt(c,o,i),await r.readUint8Array(e+i,t-i))}else s=await mt(c,o,t)}else s=fe;return r.R=a.max(i,r.R),s}}class wt extends Me{constructor(e,t=4294967295){super();const n=this;let s,i,a;r.assign(n,{diskNumber:0,diskOffset:0,size:0,maxSize:t,availableSize:t});const o=new D({async write(t){if(t===Ie)return void(a&&await d());const{availableSize:r}=n;if(a)t.length<r?await c(t):(await c(t.subarray(0,r)),await d(),t.length>r&&await this.write(t.subarray(r)));else{const{value:r,done:o}=await e.next();if(o&&!r)throw new w("Writer iterator completed too soon");s=r,s.size=0,s.maxSize&&(n.maxSize=s.maxSize),n.availableSize=n.maxSize,await ht(s),i=r.writable,a=i.getWriter(),await this.write(t)}},async close(){a&&(await a.ready,await l())},async abort(e){a&&await a.abort(e)}});async function c(e){const t=e.length;t&&(await a.ready,await a.write(e),s.size+=t,n.availableSize-=t)}async function d(){await l(),n.diskOffset+=s.size,n.diskNumber++,a=null,n.availableSize=n.maxSize}async function l(){await a.close()}r.defineProperty(n,Ue,{get:()=>o})}async closeDisk(){const e=this.writable.getWriter();try{await e.ready,await e.write(Ie)}finally{e.releaseLock()}}}class ft{constructor(e){return t.isArray(e)&&(e=new ut(e)),(e instanceof R||typeof e.getReader==ue)&&(e={readable:be(e)}),e}}class pt{constructor(e){return e.writable===ce&&typeof e.next==ue&&(e=new wt(e)),(e instanceof D||typeof e.getWriter==ue)&&(e={writable:Fe(e)}),e.size===ce&&(e.size=0),e}}async function ht(e,t){if(!e.init||e.initialized)return g.resolve();await e.init(t)}function mt(e,t,r){return e.readUint8Array(t,r)}const yt=new c,gt=new c;function xt(e){return yt.get(e)}function St(e){return gt.get(e)}const bt=[[],[],[],[],[],[],[],[]];for(let e=0;256>e;e++){let t=e;for(let e=0;8>e;e++)t=1&t?t>>>1^3988292384:t>>>1;bt[0][e]=t}for(let e=0;256>e;e++)for(let t=1;8>t;t++){const r=bt[t-1][e];bt[t][e]=r>>>8^bt[0][255&r]}const[zt,Ft,Et,Rt,Dt,At,Ct,Tt]=bt;class vt{constructor(e){this.C=e||-1}append(e){let t=0|this.C;const r=0|e.length;let n=0;if(r>=8&&e.buffer){const s=new m(e.buffer,e.byteOffset,r),i=r-8;for(;i>=n;n+=8){const e=t^s.getInt32(n,!0),r=s.getInt32(n+4,!0);t=Tt[255&e]^Ct[e>>>8&255]^At[e>>>16&255]^Dt[e>>>24&255]^Rt[255&r]^Et[r>>>8&255]^Ft[r>>>16&255]^zt[r>>>24&255]}}for(;r>n;n++)t=t>>>8^zt[255&(t^e[n])];this.C=t}get(){return~this.C}}class kt extends E{constructor(){let e;const t=new vt;super({transform(e,r){t.append(e),r.enqueue(e)},flush(){const r=new f(4);new m(r.buffer).setUint32(0,t.get()),e.value=r}}),e=this}}function Ut(e){if(typeof x==le){const t=new f((e=unescape(encodeURIComponent(e))).length);for(let r=0;r<t.length;r++)t[r]=e.charCodeAt(r);return t}return(new x).encode(e)}const It={concat(e,t){if(0===e.length||0===t.length)return e.concat(t);const r=e[e.length-1],n=It.T(r);return 32===n?e.concat(t):It.v(t,n,0|r,e.slice(0,e.length-1))},bitLength(e){const t=e.length;if(0===t)return 0;const r=e[t-1];return 32*(t-1)+It.T(r)},U(e,t){if(32*e.length<t)return e;const r=(e=e.slice(0,a.ceil(t/32))).length;return t&=31,r>0&&t&&(e[r-1]=It.I(t,e[r-1]&2147483648>>t-1,1)),e},I:(e,t,r)=>32===e?t:(r?0|t:t<<32-e)+1099511627776*e,T:e=>a.round(e/1099511627776)||32,v(e,t,r,n){for(void 0===n&&(n=[]);t>=32;t-=32)n.push(r),r=0;if(0===t)return n.concat(e);for(let s=0;s<e.length;s++)n.push(r|e[s]>>>t),r=e[s]<<32-t;const s=e.length?e[e.length-1]:0,i=It.T(s);return n.push(It.I(t+i&31,t+i>32?r:n.pop(),1)),n}},Mt={bytes:{M(e){const t=It.bitLength(e)/8,r=new f(t);let n;for(let s=0;t>s;s++)3&s||(n=e[s/4]),r[s]=n>>>24,n<<=8;return r},O(e){const t=[];let r,n=0;for(r=0;r<e.length;r++)n=n<<8|e[r],3&~r||(t.push(n),n=0);return 3&r&&t.push(It.I(8*(3&r),n)),t}}},Ot=class{constructor(e){const t=this;t.blockSize=512,t._=[1732584193,4023233417,2562383102,271733878,3285377520],t.N=[1518500249,1859775393,2400959708,3395469782],e?(t.L=e.L.slice(0),t.P=e.P.slice(0),t.W=e.W):t.reset()}reset(){const e=this;return e.L=e._.slice(0),e.P=[],e.W=0,e}update(e){const t=this;"string"==typeof e&&(e=Mt.V.O(e));const r=t.P=It.concat(t.P,e),n=t.W,s=t.W=n+It.bitLength(e);if(s>9007199254740991)throw new w("Cannot hash more than 2^53 - 1 bits");const i=new h(r);let a=0;for(let e=t.blockSize+n-(t.blockSize+n&t.blockSize-1);s>=e;e+=t.blockSize)t.B(i.subarray(16*a,16*(a+1))),a+=1;return r.splice(0,16*a),t}Z(){const e=this;let t=e.P;const r=e.L;t=It.concat(t,[It.I(1,1)]);for(let e=t.length+2;15&e;e++)t.push(0);for(t.push(a.floor(e.W/4294967296)),t.push(0|e.W);t.length;)e.B(t.splice(0,16));return e.reset(),r}H(e,t,r,n){return e>19?e>39?e>59?e>79?void 0:t^r^n:t&r|t&n|r&n:t^r^n:t&r|~t&n}j(e,t){return t<<e|t>>>32-e}B(e){const r=this,n=r.L,s=t(80);for(let t=0;16>t;t++)s[t]=e[t];let i=n[0],o=n[1],c=n[2],d=n[3],l=n[4];for(let e=0;79>=e;e++){16>e||(s[e]=r.j(1,s[e-3]^s[e-8]^s[e-14]^s[e-16]));const t=r.j(5,i)+r.H(e,o,c,d)+l+s[e]+r.N[a.floor(e/20)]|0;l=d,d=c,c=r.j(30,o),o=i,i=t}n[0]=n[0]+i|0,n[1]=n[1]+o|0,n[2]=n[2]+c|0,n[3]=n[3]+d|0,n[4]=n[4]+l|0}},_t={importKey:e=>new _t.K(Mt.bytes.O(e)),Y(e,t,r,n){if(r=r||1e4,0>n||0>r)throw new w("invalid params to pbkdf2");const s=1+(n>>5)<<2;let i,a,o,c,d;const l=new ArrayBuffer(s),u=new m(l);let f=0;const p=It;for(t=Mt.bytes.O(t),d=1;(s||1)>f;d++){for(i=a=e.encrypt(p.concat(t,[d])),o=1;r>o;o++)for(a=e.encrypt(a),c=0;c<a.length;c++)i[c]^=a[c];for(o=0;(s||1)>f&&o<i.length;o++)u.setInt32(f,i[o]),f+=4}return l.slice(0,n/8)},K:class{constructor(e){const t=this,r=t.G=Ot,n=[[],[]];t.X=[new r,new r];const s=t.X[0].blockSize/32;e.length>s&&(e=(new r).update(e).Z());for(let t=0;s>t;t++)n[0][t]=909522486^e[t],n[1][t]=1549556828^e[t];t.X[0].update(n[0]),t.X[1].update(n[1]),t.J=new r(t.X[0])}reset(){const e=this;e.J=new e.G(e.X[0]),e.$=!1}update(e){this.$=!0,this.J.update(e)}digest(){const e=this,t=e.J.Z(),r=new e.G(e.X[1]).update(t).Z();return e.reset(),r}encrypt(e){if(this.$)throw new w("encrypt on already updated hmac called!");return this.update(e),this.digest(e)}}},Nt=typeof z!=le&&typeof z.getRandomValues==ue,Lt="Invalid password",Pt="Invalid signature",Wt=Pt,Vt="zipjs-abort-check-password";function Bt(e){if(Nt)return z.getRandomValues(e);throw new w("Crypto API not supported")}const Zt=16,Ht={name:"PBKDF2"},qt=r.assign({hash:{name:"HMAC"}},Ht),jt=r.assign({iterations:1e3,hash:{name:"SHA-1"}},Ht),Kt=["deriveBits"],Yt=[8,12,16],Gt=[16,24,32],Xt=10,Jt=[0,0,0,0],Qt=typeof z!=le,$t=Qt&&z.subtle,er=Qt&&typeof $t!=le,tr=Mt.bytes,rr=class{constructor(e){const t=this;t.ee=[[[],[],[],[],[]],[[],[],[],[],[]]],t.ee[0][0][0]||t.te();const r=t.ee[0][4],n=t.ee[1],s=e.length;let i,a,o,c=1;if(4!==s&&6!==s&&8!==s)throw new w("invalid aes key size");for(t.N=[a=e.slice(0),o=[]],i=s;4*s+28>i;i++){let e=a[i-1];(i%s===0||8===s&&i%s===4)&&(e=r[e>>>24]<<24^r[e>>16&255]<<16^r[e>>8&255]<<8^r[255&e],i%s===0&&(e=e<<8^e>>>24^c<<24,c=c<<1^283*(c>>7))),a[i]=a[i-s]^e}for(let e=0;i;e++,i--){const t=a[3&e?i:i-4];o[e]=4>=i||4>e?t:n[0][r[t>>>24]]^n[1][r[t>>16&255]]^n[2][r[t>>8&255]]^n[3][r[255&t]]}}encrypt(e){return this.re(e,0)}decrypt(e){return this.re(e,1)}te(){const e=this.ee[0],t=this.ee[1],r=e[4],n=t[4],s=[],i=[];let a,o,c,d;for(let e=0;256>e;e++)i[(s[e]=e<<1^283*(e>>7))^e]=e;for(let l=a=0;!r[l];l^=o||1,a=i[a]||1){let i=a^a<<1^a<<2^a<<3^a<<4;i=i>>8^255&i^99,r[l]=i,n[i]=l,d=s[c=s[o=s[l]]];let u=16843009*d^65537*c^257*o^16843008*l,w=257*s[i]^16843008*i;for(let r=0;4>r;r++)e[r][l]=w=w<<24^w>>>8,t[r][i]=u=u<<24^u>>>8}for(let r=0;5>r;r++)e[r]=e[r].slice(0),t[r]=t[r].slice(0)}re(e,t){if(4!==e.length)throw new w("invalid aes block size");const r=this.N[t],n=r.length/4-2,s=[0,0,0,0],i=this.ee[t],a=i[0],o=i[1],c=i[2],d=i[3],l=i[4];let u,f,p,h=e[0]^r[0],m=e[t?3:1]^r[1],y=e[2]^r[2],g=e[t?1:3]^r[3],x=4;for(let e=0;n>e;e++)u=a[h>>>24]^o[m>>16&255]^c[y>>8&255]^d[255&g]^r[x],f=a[m>>>24]^o[y>>16&255]^c[g>>8&255]^d[255&h]^r[x+1],p=a[y>>>24]^o[g>>16&255]^c[h>>8&255]^d[255&m]^r[x+2],g=a[g>>>24]^o[h>>16&255]^c[m>>8&255]^d[255&y]^r[x+3],x+=4,h=u,m=f,y=p;for(let e=0;4>e;e++)s[t?3&-e:e]=l[h>>>24]<<24^l[m>>16&255]<<16^l[y>>8&255]<<8^l[255&g]^r[x++],u=h,h=m,m=y,y=g,g=u;return s}},nr=class{constructor(e,t){this.ne=e,this.se=t,this.ie=t}reset(){this.ie=this.se}update(e){return this.ae(this.ne,e,this.ie)}oe(e){if(255&~(e>>24))e+=1<<24;else{let t=e>>16&255,r=e>>8&255,n=255&e;255===t?(t=0,255===r?(r=0,255===n?n=0:++n):++r):++t,e=0,e+=t<<16,e+=r<<8,e+=n}return e}ce(e){0===(e[0]=this.oe(e[0]))&&(e[1]=this.oe(e[1]))}ae(e,t,r){let n;if(!(n=t.length))return[];const s=It.bitLength(t);for(let s=0;n>s;s+=4){this.ce(r);const n=e.encrypt(r);t[s]^=n[0],t[s+1]^=n[1],t[s+2]^=n[2],t[s+3]^=n[3]}return It.U(t,s)}},sr=_t.K;let ir=Qt&&er&&typeof $t.importKey==ue,ar=Qt&&er&&typeof $t.deriveBits==ue;class or extends E{constructor({password:e,rawPassword:t,encryptionStrength:r,checkPasswordOnly:n,checkAuthenticationCode:s=!0}){super({start(){dr(this,e,t,r)},async transform(e,t){const r=this,{password:s,strength:i,de:a,ready:o}=r;s?(await(async(e,t,r,n)=>{const s=await ur(e,t,r,fr(n,0,Yt[t])),i=fr(n,Yt[t]);if(s[0]!=i[0]||s[1]!=i[1])throw new w(Lt)})(r,i,s,fr(e,0,Yt[i]+2)),e=fr(e,Yt[i]+2),n?t.error(new w(Vt)):a()):await o;const c=new f(e.length-Xt-(e.length-Xt)%Zt);t.enqueue(lr(r,e,c,0,Xt,!0))},async flush(e){const{le:t,ue:r,pending:n,ready:i}=this;if(r&&t){await i;const a=fr(n,0,n.length-Xt),o=fr(n,n.length-Xt);let c=fe;if(a.length){const e=hr(tr,a);r.update(e);const n=t.update(e);c=pr(tr,n)}const d=fr(pr(tr,r.digest()),0,Xt);let l=n.length<Xt?1:0;for(let e=0;Xt>e;e++)l|=d[e]^o[e];if(l&&s)throw new w(Wt);e.enqueue(c)}}})}}class cr extends E{constructor({password:e,rawPassword:t,encryptionStrength:r}){super({start(){dr(this,e,t,r)},async transform(e,t){const r=this,{password:n,strength:s,de:i,ready:a}=r;let o=fe;n?(o=await(async(e,t,r)=>{const n=Bt(new f(Yt[t]));return ge(n,await ur(e,t,r,n))})(r,s,n),i()):await a;const c=new f(o.length+e.length-e.length%Zt);c.set(o,0),t.enqueue(lr(r,e,c,o.length,0))},async flush(e){const{le:t,ue:r,pending:n,ready:s}=this;if(r&&t){await s;let i=fe;if(n.length){const e=t.update(hr(tr,n));r.update(e),i=pr(tr,e)}const a=pr(tr,r.digest()).slice(0,Xt);e.enqueue(ge(i,a))}}})}}function dr(e,t,n,s){r.assign(e,{ready:new g(t=>e.de=t),password:wr(t,n),strength:s-1,pending:fe})}function lr(e,t,r,n,s,i){const{le:a,ue:o,pending:c}=e;c.length&&(t=ge(c,t));const d=t.length-s;let l;for(r=((e,t)=>{if(t&&t>e.length){const r=e;(e=new f(t)).set(r,0)}return e})(r,n+(d-d%Zt)),l=0;d-Zt>=l;l+=Zt){const e=hr(tr,fr(t,l,l+Zt));i&&o.update(e);const s=a.update(e);i||o.update(s),r.set(pr(tr,s),l+n)}return e.pending=fr(t,l),r}async function ur(e,n,s,i){e.password=null;const a=await(async(e,t,r,n,s)=>{if(!ir)return _t.importKey(t);try{return await $t.importKey("raw",t,r,!1,s)}catch{return ir=!1,_t.importKey(t)}})(0,s,qt,0,Kt),o=await(async(e,t,r)=>{if(!ar)return _t.Y(t,e.salt,jt.iterations,r);try{return await $t.deriveBits(e,t,r)}catch{return ar=!1,_t.Y(t,e.salt,jt.iterations,r)}})(r.assign({salt:i},jt),a,8*(2*Gt[n]+2)),c=new f(o),d=hr(tr,fr(c,0,Gt[n])),l=hr(tr,fr(c,Gt[n],2*Gt[n])),u=fr(c,2*Gt[n]);return r.assign(e,{keys:{key:d,we:l,passwordVerification:u},le:new nr(new rr(d),t.from(Jt)),ue:new sr(l)}),u}function wr(e,t){return t===ce?Ut(e):t}function fr(e,t,r){return e.subarray(t,r)}function pr(e,t){return e.M(t)}function hr(e,t){return e.O(t)}class mr extends E{constructor({password:e,rawPassword:t,passwordVerification:r,checkPasswordOnly:n}){super({start(){gr(this,e,t,r)},transform(e,t){const r=this;if(r.password||r.rawPassword){const t=xr(r,e.subarray(0,12));if(r.password=r.rawPassword=null,0!=(t[11]^r.passwordVerification))throw new w(Lt);e=e.subarray(12)}n?t.error(new w(Vt)):t.enqueue(xr(r,e))}})}}class yr extends E{constructor({password:e,rawPassword:t,passwordVerification:r}){super({start(){gr(this,e,t,r)},transform(e,t){const r=this;let n,s;if(r.password||r.rawPassword){r.password=r.rawPassword=null;const t=Bt(new f(12));t[11]=r.passwordVerification,n=new f(e.length+t.length),n.set(Sr(r,t),0),s=12}else n=new f(e.length),s=0;n.set(Sr(r,e),s),t.enqueue(n)}})}}function gr(e,t,n,s){r.assign(e,{password:t,rawPassword:n,passwordVerification:s}),((e,t,n)=>{const s=[305419896,591751049,878082192];if(r.assign(e,{keys:s,fe:new vt(s[0]),pe:new vt(s[2])}),n)for(let t=0;t<n.length;t++)br(e,n[t]);else for(let r=0;r<t.length;r++)br(e,t.charCodeAt(r))})(e,t,n)}function xr(e,t){const r=new f(t.length);for(let n=0;n<t.length;n++)r[n]=zr(e)^t[n],br(e,r[n]);return r}function Sr(e,t){const r=new f(t.length);for(let n=0;n<t.length;n++)r[n]=zr(e)^t[n],br(e,t[n]);return r}function br(e,t){let[,r]=e.keys;e.fe.append([t]);const n=~e.fe.get();r=Er(a.imul(Er(r+Fr(n)),134775813)+1),e.pe.append([r>>>24]);const s=~e.pe.get();e.keys=[n,r,s]}function zr(e){const t=2|e.keys[2];return Fr(a.imul(t,1^t)>>>8)}function Fr(e){return 255&e}function Er(e){return 4294967295&e}const Rr="Invalid uncompressed size",Dr="Invalid compressed data",Ar=Pt,Cr="deflate-raw",Tr="gzip",vr=[31,139,8];class kr extends E{constructor(e,{chunkSize:t,CompressionStreamFallback:r,CompressionStream:n}){super({});const{compressed:s,encrypted:i,useCompressionStream:a,zipCrypto:o,computeCrc32:c,level:d,deflate64:l,format:u,compressionMethod:w}=e,f=this;let p,h,y,g=super.readable;const x=u&&St(u),S=c&&s&&!l&&!x&&(!i||o)&&!(!a||!n);if(i&&!o||!c||S||(p=new kt,g=Wr(g,p)),s)if(x)g=Vr(g,Lr(x.CompressionStream,u,{level:d,chunkSize:t,compressionMethod:w}));else if(S)y=new Ur,g=Vr(g,new n(Tr)),g=Wr(g,y);else try{g=Pr(g,a,{level:d,chunkSize:t},n,r)}catch(e){let t;try{t=new n(Tr)}catch{throw e}g=Vr(g,t),g=Wr(g,new Ur)}i&&(o?g=Wr(g,new yr(e)):(h=new cr(e),g=Wr(g,h))),Nr(f,g,()=>{i&&!o||!c||(f.crc32=S?y.crc32:new m(p.value.buffer).getUint32(0))})}}class Ur extends E{constructor(){let e,t=10,r=new f(0);super({transform(e,n){if(t){const r=a.min(t,e.length);if(t-=r,!(e=e.subarray(r)).length)return}const s=r.length+e.length;if(8>=s)return void(r=ge(r,e));const i=s-8,o=a.min(i,r.length);n.enqueue(ge(r.subarray(0,o),e.subarray(0,i-o))),r=ge(r.subarray(o),e.subarray(i-o))},flush(){const t=Se(r);e.crc32=t.getUint32(0,!0),e.uncompressedSize=t.getUint32(4,!0)}}),e=this}}class Ir extends E{constructor(e,{chunkSize:t,DecompressionStreamFallback:r,DecompressionStream:n}){super({});const{zipCrypto:s,encrypted:i,checkCrc32:a,crc32:o,compressed:c,useCompressionStream:d,deflate64:l,format:u,compressionMethod:p,rawBitFlag:h,outputSize:y}=e;let x,S,b=super.readable;if(i&&(s?b=Wr(b,new mr(e)):(S=new or(e),b=Wr(b,S))),c){const e=u&&St(u);if(e)b=Vr(b,Lr(e.DecompressionStream,u,{chunkSize:t,compressionMethod:p,rawBitFlag:h,uncompressedSize:y}));else try{b=Pr(b,d,{chunkSize:t,deflate64:l},n,r)}catch(e){if(l||y===ce)throw e;let t;try{t=new n(Tr)}catch{throw e}b=((e,t,r)=>{const n=new vt;let s,i,a,o=0,c=!1;const d=new g((e,t)=>{i=e,a=t});d.catch(()=>{}),r||i();const l=new E({start(e){const t=new f(10);t.set(vr),e.enqueue(t)},transform(e,t){t.enqueue(e)},async flush(e){c=!0,p();try{await d}finally{h()}const t=new f(8),s=Se(t);s.setUint32(0,n.get(),!0),s.setUint32(4,r,!0),e.enqueue(t)},cancel(e){a(e)}}),u=new E({transform(e,t){n.append(e),o+=e.length,r>o?c&&p():i(),t.enqueue(e)},cancel(e){a(e)}});return e=Wr(e,l),Wr(e=Vr(e,t),u);function p(){h(),s=U(()=>a(new w(Rr)),5e3)}function h(){I(s)}})(b,t,y)}b=(e=>{const t=e.getReader();return new R({async pull(e){let r;try{r=await t.read()}catch(e){if(e&&e.message)throw e;const t=new w(Dr);throw t.cause=e,t}const{value:n,done:s}=r;s?e.close():e.enqueue(n)},cancel:e=>t.cancel(e)})})(b)}a&&(x=new kt,b=Wr(b,x)),Nr(this,b,()=>{if(a){const e=new m(x.value.buffer);if(o!=e.getUint32(0,!1))throw new w(Ar)}})}}const Mr=new c;function Or(e,t){if(!e)return!1;let r=Mr.get(e);r||(r=new c,Mr.set(e,r));let n=r.get(t);if(n===ce){try{new e(t),n=!0}catch{n=!1}r.set(t,n)}return n}function _r(e){return Or(e,Cr)}function Nr(e,t,n){t=Wr(t,new E({flush:n})),r.defineProperty(e,"readable",{get:()=>t})}function Lr(e,t,r){if(!e)throw new w("Compression method not supported");return new e(t,r)}function Pr(e,t,r,n,s){const i=t&&n?n:s||n,a=r.deflate64?"deflate64-raw":Cr;let o;try{o=new i(a,r)}catch(e){if(!t||!s||i==s)throw e;o=new s(a,r)}return Vr(e,o)}function Wr(e,t){return be(e).pipeThrough(t)}function Vr(e,t){const r=t.writable.getWriter(),n=e.getReader();return(async()=>{try{for(;;){await r.ready;const e=await n.read();if(e.done){await r.close();break}await r.write(e.value)}}catch(e){await(async(e,t)=>{try{await e.abort(t)}catch{}})(r,e),await(async(e,t)=>{try{await e.cancel(t)}catch{}})(n,e)}})(),t.readable}const Br="deflate",Zr="inflate";class Hr extends E{constructor(e,t){super({});const n=this,{codecType:s}=e;let i;s.startsWith(Br)?i=kr:s.startsWith(Zr)&&(i=Ir),n.outputSize=0;let a=0;const o=new i(e,t),c=super.readable,d=new E({transform(e,t){e&&e.length&&(a+=e.length,t.enqueue(e))},flush(){r.assign(n,{inputSize:a})}}),l=new E({transform(t,r){if(t&&t.length&&(r.enqueue(t),n.outputSize+=t.length,e.outputSize!==ce&&n.outputSize>e.outputSize))throw new w(Rr)},flush(){const{crc32:e}=o;r.assign(n,{crc32:e,inputSize:a})}});r.defineProperty(n,"readable",{get:()=>c.pipeThrough(d).pipeThrough(o).pipeThrough(l)})}}class qr extends E{constructor(e){const t=[];let r=0;function n(){const n=new f(e);let s=0;for(;e>s;){const r=t[0],i=e-s;r.length>i?(n.set(r.subarray(0,i),s),t[0]=r.subarray(i),s+=i):(n.set(r,s),s+=r.length,t.shift())}return r-=e,n}s.isFinite(e)&&e>=1||(e=65536),super({transform(s,i){for(t.push(s),r+=s.length;r>e;)i.enqueue(n())},flush(e){r&&e.enqueue(((e,t)=>{const r=new f(t);let n=0;for(const t of e)r.set(t,n),n+=t.length;return r})(t,r))}})}}class jr{constructor(e,{readable:t,writable:n},{options:s,config:i,he:a,useWebWorkers:o,transferStreams:c,workerURI:d,createWorker:l},u){const{signal:w}=a;return r.assign(e,{me:!0,ye:(e.ye||0)+1,readable:t.pipeThrough(new qr(ye(i))).pipeThrough(new Kr(a),{signal:w}),writable:n,options:r.assign({},s),workerURI:d,createWorker:l,transferStreams:c,terminate:()=>new g(t=>{const{ge:r,me:n}=e;r?(n?e.xe=t:(r.terminate(),t()),e.Se=null):t()}),be(){if(e.me){const{xe:t}=e;t&&(e.xe=null,e.ze=!0,e.ge.terminate(),t()),e.me=!1,u(e)}}}),((e,t)=>({run:()=>(async({options:e,readable:t,writable:r,be:n},s)=>{let i;try{if(e.compressed&&!e.format){const t=e.codecType.startsWith(Br),r=t?s.CompressionStreamFallback:s.DecompressionStreamFallback,n=t?s.CompressionStream:s.DecompressionStream;if(e.useCompressionStream){if(r&&r.Fe&&!_r(n))try{await void 0}catch{}}else try{await void 0}catch{r&&!r.Fe||(e.useCompressionStream=!0)}}i=new Hr(e,s),await t.pipeThrough(i).pipeThrough(new qr(ye(s))).pipeTo(r,{preventClose:!0,preventAbort:!0});const{crc32:n,inputSize:a,outputSize:o}=i;return{crc32:n,inputSize:a,outputSize:o}}catch(e){throw i&&(e.outputSize=i.outputSize),e}finally{n()}})(e,t)}))(e,i)}}class Kr extends E{constructor({onstart:e,onprogress:t,size:r,onend:n}){let s=0;super({async start(){e&&await Yr(e,r)},async transform(e,n){s+=e.length,t&&await Yr(t,s,r),n.enqueue(e)},async flush(){n&&await Yr(n,s)}})}}async function Yr(e,...t){try{await e(...t)}catch{}}let Gr=[];const Xr=[];let Jr,Qr,$r=0;async function en(e,t){const{options:r,config:n}=t,{transferStreams:i,useWebWorkers:a,useCompressionStream:o,compressed:c,checkCrc32:d,computeCrc32:l,encrypted:f,format:p,codecURI:h}=r,{workerURI:m,createWorker:y,maxWorkers:x}=n;p&&(h&&(r.codecURI=((e,t)=>{try{return new u(e,t).toString()}catch{return e}})(h,n.baseURI)),await(async(e,t)=>{!gt.has(e)&&t&&((e,t)=>{const{CompressionStream:r,DecompressionStream:n}=t;if(typeof r!=ue&&typeof n!=ue)throw new w("Invalid codec module");gt.set(e,{CompressionStream:r,DecompressionStream:n})})(e,await(import(/* webpackIgnore: true */ /* @vite-ignore */t)))})(p,r.codecURI)),t.transferStreams=!p&&(i||i===ce&&n.transferStreams);const S=!(c||d||l||f),b=p===ce||!!r.codecURI;return t.useWebWorkers=!S&&b&&(a||a===ce&&n.useWebWorkers),t.workerURI=t.useWebWorkers&&m?m:ce,t.createWorker=t.useWebWorkers&&y?y:ce,r.useCompressionStream=o||o===ce&&n.useCompressionStream,(await(async()=>{const r=Gr.find(e=>!e.me);if(r)return an(r),new jr(r,e,t,z);if(Gr.length<x){const r={Ee:$r};return $r++,Gr.push(r),new jr(r,e,t,z)}return new g(r=>{Xr.push({resolve:r,stream:e,Re:t}),Qr=n.workerStarvationTimeout,tn()})})()).run();function z(e){if(rn(),Xr.length){const[{resolve:t,stream:r,Re:n}]=Xr.splice(0,1);t(new jr(e,r,n,z)),tn()}else e.ge?(an(e),((e,t)=>{const{config:r}=t,{terminateWorkerTimeout:n}=r;s.isFinite(n)&&n>=0&&(e.ze?e.ze=!1:e.De=U(async()=>{Gr=Gr.filter(t=>t!=e);try{await e.terminate()}catch{}},n))})(e,t)):Gr=Gr.filter(t=>t!=e)}}function tn(){!Jr&&Xr.length&&s.isFinite(Qr)&&Qr>=0&&(Jr=U(nn,Qr))}function rn(){Jr&&(I(Jr),Jr=null)}function nn(){if(Jr=null,Xr.length){const[{resolve:e,stream:t,Re:n}]=Xr.splice(0,1),s=r.assign({},n,{useWebWorkers:!1,workerURI:ce,createWorker:ce});e(new jr({},t,s,sn)),tn()}}function sn(){rn(),tn()}function an(e){const{De:t}=e;t&&(I(t),e.De=null)}const on="\0☺☻♥♦♣♠•◘○◙♂♀♪♫☼►◄↕‼¶§▬↨↑↓→←∟↔▲▼ !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~⌂ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜ¢£¥₧ƒáíóúñѪº¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ ".split("");function cn(e,t){return t&&"cp437"==t.trim().toLowerCase()?(e=>{{let t="";for(let r=0;r<e.length;r++)t+=on[e[r]];return t}})(e):new S(t,{ignoreBOM:!0}).decode(e)}const dn="filename",ln="rawFilename",un="comment",wn="rawComment",fn="uncompressedSize",pn="compressedSize",hn="offset",mn="diskNumberStart",yn="lastModDate",gn="rawLastModDate",xn="lastAccessDate",Sn="rawLastAccessDate",bn="creationDate",zn="rawCreationDate",Fn="internalFileAttributes",En="externalFileAttributes",Rn="msdosAttributesRaw",Dn="msdosAttributes",An="msDosCompatible",Cn="zip64",Tn="encrypted",vn="version",kn="versionMadeBy",Un="zipCrypto",In="directory",Mn="executable",On="compressionMethod",_n="signature",Nn="extraField",Ln="unixMode",Pn="setuid",Wn="setgid",Vn="sticky",Bn=[dn,ln,fn,pn,yn,gn,un,wn,xn,Sn,bn,zn,hn,mn,Fn,En,Rn,Dn,An,Cn,Tn,vn,kn,Un,In,Mn,On,_n,"crc32",Nn,"extraFieldUnix","extraFieldInfoZip","extraFieldUnixType1","extraFieldPkwareUnix","uid","gid",Ln,Pn,Wn,Vn,"bitFlag","filenameUTF8","commentUTF8","rawExtraField","extraFieldZip64","extraFieldUnicodePath","extraFieldUnicodeComment","extraFieldAES","extraFieldNTFS","extraFieldExtendedTimestamp","extraFieldUSDZ"];class Zn{constructor(e){Bn.forEach(t=>this[t]=e[t])}}const Hn="password",qn="rawPassword",jn="passThrough",Kn="signal",Yn="checkAmbiguity",Gn="useWebWorkers",Xn="useCompressionStream",Jn="transferStreams",Qn="preventClose",$n="offset",es="usdz",ts="strictness",rs="filename",ns="comment",ss="strict",is="balanced",as="tolerant",os="File format is not recognized",cs="End of central directory not found",ds="End of Zip64 central directory locator not found",ls="Central directory header not found",us="Local file header not found",ws="Zip64 extra field not found",fs="File contains encrypted entry",ps="Encryption method not supported",hs="Compression method not supported",ms="Split zip file",ys="Overlapping entry found",gs="Ambiguous archive",xs="Encrypted central directory is not supported",Ss="Unsafe filename",bs="Invalid strictness (must be 'strict', 'balanced' or 'tolerant')",zs="Invalid filenameValidation (must be 'strict', 'balanced' or 'tolerant')",Fs="Invalid maxAppendedDataSize (must be a number greater than or equal to 0)",Es=/^[a-zA-Z]:/,Rs="utf-8",Ds="cp437",As=[[fn,O],[pn,O],[hn,O],[mn,_]],Cs={[_]:{Ae:Qs,bytes:4},[O]:{Ae:$s,bytes:8}};class Ts{constructor(e,t={}){r.assign(this,{reader:new ft(e),options:t,config:me(),Ce:new c})}async*getEntriesGenerator(e={}){const t=this;let{reader:n}=t;const{config:i}=t;if(await ht(n),n.size!==ce&&n.readUint8Array||(n=new Ve(await ze(n.readable)),await ht(n)),n.size<j)throw new w(os);const o=Ws(Ks(t,e,ts),Ks(t,e,Yn)),c=o==ss,l=o!=as,u=((e,t)=>{if(e!==ce){const t=typeof(r=e)==we&&r.trim()?s(r):r;if("number"!=typeof t||s.isNaN(t)||0>t)throw new w(Fs);return t}var r;return t==ss?0:t==as?1/0:_})(Ks(t,e,"maxAppendedDataSize"),o),f=((e,t)=>{if(e===ce)return t;if(!Ps(e))throw new w(zs);return e})(Ks(t,e,"filenameValidation"),o),p=Ks(t,e,"normalizeFilename"),{Te:h,ve:m}=await(async(e,t,r)=>{const{size:n}=e,s=a.min(n,65557),i={count:64};let o,c,d=0;for await(const[r,a,l,u,w]of Bs(e,s)){const s=Js(r,u+20);if(w+j+s==n){const s=await Hs(e,r,a,u,w,n,i);if(2==s){if(o||(o=Zs(l,u,w)),d++,!t||d>1)break}else 1!=s||c||(c=Zs(l,u,w))}}return o||(o=c),o||(o=await(async(e,t,r)=>{const{size:n}=e,s=a.min(n,t==1/0?n:65557+t);let i,o;for await(const[t,a,c,d,l]of Bs(e,s)){const s=Zs(c,d,l);i||(i=s);const u=await Hs(e,t,a,d,l,n,r);if(2==u)return s;1!=u||o||(o=s)}return o||i})(e,r,i)),{Te:o,ve:d}})(n,l,u);if(!h)throw Qs(Se(await mt(n,0,4)))==P?new w(ms):new w(cs);l&&m>1&&js("multiple end of central directory records");const y=Se(h);let g=Qs(y,12),x=Qs(y,16);const S=h.offset,b=Js(y,20),z=S+j+b;n.size-z>u&&js("appended data");let F=Js(y,4);const R=n.R||0;let D,A,C,T,v=Js(y,6),k=Js(y,10),U=0;const I=x==O||g==O||k==_||v==_;if(x!=O&&v!=_&&(x+=Ls(n,v)),I){const e=h.offset<K?fe:await mt(n,h.offset-K,K),t=Se(e);if(e.length==K&&Qs(t,0)==q){x=Ls(n,Qs(t,4))+$s(t,8);let e=await mt(n,x,Y),i=Se(e);const o=h.offset-K-Y;if((e.length<Y||Qs(i,0)!=H)&&x!=o&&o>=0){const t=x;x=o,x>t&&(U=x-t),e=await mt(n,x,Y),i=Se(e)}if(e.length<Y||Qs(i,0)!=H)throw new w(ds);if(A=!0,C=$s(i,4)>44,C){const e=a.min(s($s(i,4))-44,n.size-x-Y);e>0&&(T=(e=>{const t={rawExtensibleData:e};if(e.length>=28){const n=Se(e),i=Js(n,26);r.assign(t,{compressionMethod:Js(n,0),compressedSize:s($s(n,2)),uncompressedSize:s($s(n,10)),encryptionAlgorithm:Js(n,18),bitLength:Js(n,20),flags:Js(n,22),hashAlgorithm:Js(n,24),hashData:e.subarray(28,28+i)})}return t})(await mt(n,x+Y,e)))}F==_?F=Qs(i,16):c&&F!=Qs(i,16)&&js("mismatched zip64 end of central directory record"),v==_?v=Qs(i,20):c&&v!=Qs(i,20)&&js("mismatched zip64 end of central directory record"),k==_?k=$s(i,32):c&&k!=$s(i,32)&&js("mismatched zip64 end of central directory record"),g==O?g=$s(i,40):c&&g!=$s(i,40)&&js("mismatched zip64 end of central directory record"),x=Ls(n,v)+$s(i,48)+U}}let M=g;const L=h.offset-(A?76:0);if(x<n.size||(U=n.size-x-g-j,x=n.size-g-j),R!=F)throw new w(ms);if(0>x)throw new w(os);let W=0,Z=await mt(n,x,g),G=Se(Z);if(g){if(4>Z.length)throw new w(os);const e=L-g;if(x!=e&&v==F){let t=!(Qs(G,W)==B);if(t||0>e||e+4>n.size||(t=Qs(Se(await mt(n,e,4)),0)==B),t){const t=x;x=e,x>t&&(U+=x-t),Z=await mt(n,x,g),G=Se(Z)}}}const X=L-x;if(g==X||0>X||v!=F||(g=X,Z=await mt(n,x,g),G=Se(Z)),0>x||x>=n.size)throw new w(os);t.directoryOffset=x,t.directoryLength=M;const J=Ks(t,e,"decryptCentralDirectory");let Q;J&&k&&Z.length>=4&&Qs(G,0)!=B&&(C||ks(G))&&(Z=await J(Z,T),G=Se(Z),M=Z.length,Q=!0),D=x;const $=Ks(t,e,"filenameEncoding"),ee=Ks(t,e,"commentEncoding"),ie=c?new d:ce;let ae;for(let s=0;k>s;s++){const o=new vs(n,i,t.options);if(W+46>Z.length||Qs(G,W)!=B){if(0==s&&!Q&&(C||ks(G)))throw new w(xs);throw new w(ls)}Us(o,G,W+6);const d=!!o.bitFlag.languageEncodingFlag,l=W+46,u=l+o.filenameLength,h=u+o.extraFieldLength,m=Js(G,W+4),y=!(m>>8),g=m>>8==3,x=Z.subarray(l,u),S=Js(G,W+32),b=h+S,z=Z.subarray(h,b),F=d,R=d,A=Qs(G,W+38),T=A&N,v={readOnly:!!(1&T),hidden:!!(2&T),system:!!(4&T),directory:!!(16&T),archive:!!(32&T)},I=Qs(G,W+42),M=Ks(t,e,"decodeText")||cn,O=F?Rs:$||Ds,L=R?Rs:ee||Ds;let P=M(x,O,rs);if(P===ce&&(P=cn(x,O)),p){const e=p(P);e!==ce&&(P=e)}if(Vs(P,f)){const e=new w(Ss);throw e.filename=P,e}let V=M(z,L,ns);V===ce&&(V=cn(z,L)),r.assign(o,{index:s,versionMadeBy:m,msDosCompatible:y,compressedSize:0,uncompressedSize:0,ke:S,offset:I,diskNumberStart:Js(G,W+34),internalFileAttributes:Js(G,W+36),externalFileAttributes:A,msdosAttributesRaw:T,msdosAttributes:v,rawFilename:x,filenameUTF8:F,commentUTF8:R,rawExtraField:Z.subarray(u,h),rawComment:z,filename:P,comment:V}),Is(o,o,G,W+6),o.offset+=U,D=a.min(Ls(n,o.diskNumberStart)+o.offset,D),c&&(ie.has(o.filename)&&(ae=!0),ie.add(o.filename));const H=o.externalFileAttributes>>16&_;o.unixMode===ce&&16877&H&&(o.unixMode=H);const q=!!(o.unixMode&re),j=!!(o.unixMode&ne),K=!!(512&o.unixMode),Y=o.unixMode!==ce?!!(73&o.unixMode):g&&!!(73&H),X=o.unixMode!==ce&&(61440&o.unixMode)==te,J=(61440&H)==te;r.assign(o,{setuid:q,setgid:j,sticky:K,unixExternalUpper:H,internalFileAttribute:o.internalFileAttributes,externalFileAttribute:o.externalFileAttributes,executable:Y,directory:X||J||y&&v.directory||o.filename.endsWith(se)&&!o.uncompressedSize,zipCrypto:o.encrypted&&!o.extraFieldAES});const oe=new Zn(o);oe.getData=(e,r)=>o.getData(e,oe,t.Ce,r),oe.arrayBuffer=async e=>{const r=new E,n=ze(r.readable).then(e=>e.arrayBuffer());return n.catch(()=>{}),await o.getData(r,oe,t.Ce,e),n},W=b;const{onprogress:de}=e;if(de)try{await de(s+1,k,new Zn(o))}catch{}yield oe}let oe=W;if(W+6<=Z.length&&Qs(G,W)==V){const e=Js(G,W+4);W+6+e>Z.length||(t.digitalSignature=Z.subarray(W+6,W+6+e),oe=W+6+e)}c&&W!=M&&oe!=M&&js("trailing central directory data"),ae&&js("duplicate filename"),c&&(U||k&&D>0)&&js("prepended data");const de=Ks(t,e,"extractPrependedData"),le=Ks(t,e,"extractAppendedData");return de&&(t.prependedData=D>0?await mt(n,0,D):fe),t.comment=b?await mt(n,S+j,b):fe,le&&(t.appendedData=z<n.size?await mt(n,z,n.size-z):fe),!0}async getEntries(e={}){const t=[];for await(const r of this.getEntriesGenerator(e))t.push(r);return t}async close(){}}let vs=class{constructor(e,t,n){r.assign(this,{reader:e,config:t,options:n})}async getData(e,t,r,n={}){const s=this,{reader:i,index:a,offset:o,diskNumberStart:c,extraFieldAES:d,extraFieldZip64:l,compressionMethod:u,config:f,bitFlag:p,rawBitFlag:h,crc32:m,rawLastModDate:y,uncompressedSize:g,compressedSize:x}=s,{dataDescriptor:S}=p,b=t.localDirectory={},z=Ls(i,c)+o,F=await mt(i,z,ie),E=Se(F);let R=Ks(s,n,Hn),A=Ks(s,n,qn);const C=Ks(s,n,jn);if(R=R&&R.length&&R,A=A&&A.length&&A,d&&99!=d.originalCompressionMethod)throw new w(hs);if(F.length<ie||Qs(E,0)!=L)throw new w(us);Us(b,E,4);const{extraFieldLength:T,filenameLength:v}=b,k=Ws(Ks(s,n,ts),Ks(s,n,Yn))==ss;let U=fe;if(k&&(v||T)){const e=await mt(i,z+ie,v+T);U=e.subarray(0,v),b.rawExtraField=e.subarray(v)}else b.rawExtraField=T?await mt(i,z+ie+v,T):fe;Is(s,b,E,4,!0),k&&((e,t,r)=>{const{rawFilename:n}=e;(r.length!=n.length||r.some((e,t)=>e!=n[t]))&&js("mismatched local file header (filename)"),(2057&t.rawBitFlag)!=(2057&e.rawBitFlag)&&js("mismatched local file header (general purpose bit flag)"),t.compressionMethod!=e.compressionMethod&&js("mismatched local file header (compression method)"),t.bitFlag.dataDescriptor||!(t.crc32||t.compressedSize||t.uncompressedSize)||t.crc32==e.crc32&&t.compressedSize==e.compressedSize&&t.uncompressedSize==e.uncompressedSize||js("mismatched local file header (crc32 or sizes)")})(s,b,U);const{lastAccessDate:I,creationDate:M}=b;I&&(t.lastAccessDate=I),M&&(t.creationDate=M);const O=s.encrypted&&b.encrypted&&!C,_=O&&!d;if(C||(t.zipCrypto=_),O&&!(64&~b.rawBitFlag))throw new w(ps);const P=C?ce:xt(u);if(0!=u&&8!=u&&9!=u&&!P&&!C)throw new w(hs);if(O){if(!_&&(1>d.strength||d.strength>3))throw new w(ps);if(!R&&!A)throw new w(fs)}const V=z+ie+v+T,B=x,Z=be(i.createReadable({offset:V,size:B})),H=Ks(s,n,Kn),q=Ks(s,n,"checkPasswordOnly");let j=Ks(s,n,"checkOverlappingEntry");const K=Ks(s,n,"checkOverlappingEntryOnly");K&&(j=!0);const{onstart:Y,onprogress:G,onend:X}=n,J=9==u;let Q=Ks(s,n,Xn);J&&(Q=!1);const $=Ks(s,n,"checkCrc32"),ee=($===ce?Ks(s,n,"checkSignature"):$)&&!C&&(!O||_||d&&1==d.vendorVersion),te={options:{codecType:Zr,password:R,rawPassword:A,zipCrypto:_,encryptionStrength:d&&d.strength,checkCrc32:ee,checkAuthenticationCode:Ks(s,n,"checkAuthenticationCode"),passwordVerification:_&&(S?y>>>8&N:m>>>24&N),outputSize:C?x:g,crc32:m,compressed:0!=u&&!C,encrypted:O,useWebWorkers:Ks(s,n,Gn),useCompressionStream:Q,transferStreams:Ks(s,n,Jn),deflate64:J,format:P?P.format:ce,codecURI:P?P.codecURI:ce,compressionMethod:u,rawBitFlag:h,checkPasswordOnly:q},config:f,he:{signal:H,size:B,onstart:Y,onprogress:G,onend:X}};let re,ne;j&&await(async({reader:e,Ue:t,index:r,offset:n,crc32:s,compressedSize:i,uncompressedSize:a,Ie:o,dataDescriptor:c,extraFieldZip64:d,Ce:l})=>{let u=0;if(c&&(u=d?20:12),u){const r=await mt(e,o+i,u+4);if(r.length==u+4&&Qs(Se(r),0)==W){const e=Qs(Se(r),4);let n,o;d?(n=$s(Se(r),8),o=$s(Se(r),16)):(n=Qs(Se(r),8),o=Qs(Se(r),12)),(t.encrypted&&!t.zipCrypto||e==s)&&n==i&&o==a&&(u+=4)}}const f={start:n,end:o+i+u,Ue:t};for(const[e,t]of l)if(e!=r&&f.start<t.end&&t.start<f.end){const e=new w(ys);throw e.Me=t.Ue,e}l.set(r,f)})({reader:i,Ue:t,index:a,offset:z,crc32:m,compressedSize:x,uncompressedSize:g,Ie:V,dataDescriptor:S||b.bitFlag.dataDescriptor,extraFieldZip64:l||b.extraFieldZip64,Ce:r});try{if(!K){q&&(e=new D),e=new pt(e),await ht(e,C?x:g),({writable:re}=e);const{outputSize:t}=await en({readable:Z,writable:re},te);if(e.size+=t,t!=(C?x:g))throw new w(Rr)}}catch(t){if(t.outputSize!==ce&&(e.size+=t.outputSize),!q||t.message!=Vt)throw ne=t,t}finally{if(!Ks(s,n,Qn)&&re&&!re.locked){const e=re.getWriter();if(ne)try{await e.abort(ne)}catch{}else await e.close()}}return q||K?ce:e.getData?e.getData():re}};function ks(e){const t=a.min(e.byteLength,1024)-3;for(let r=0;t>r;r++)if(134630224==Qs(e,r))return!0;return!1}function Us(e,t,n){const s=e.rawBitFlag=Js(t,n+2),i=!(1&~s),a=Qs(t,n+6);r.assign(e,{encrypted:i,version:Js(t,n),bitFlag:{level:(6&s)>>1,dataDescriptor:!(8&~s),languageEncodingFlag:(s&ee)==ee},rawLastModDate:a,lastModDate:Ys(a),filenameLength:Js(t,n+22),extraFieldLength:Js(t,n+24)})}function Is(e,t,n,s,i){const{rawExtraField:a}=t,d=t.extraField=new c,l=Se(a);let u=0;try{for(;u<a.length;){const e=Js(l,u),t=Js(l,u+2);d.set(e,{type:e,data:a.slice(u+4,u+4+t)}),u+=4+t}}catch{}const f=Js(n,s+4);r.assign(t,{signature:Qs(n,s+10),crc32:Qs(n,s+10),compressedSize:Qs(n,s+14),uncompressedSize:Qs(n,s+18)});const p=d.get(1);p&&(((e,t)=>{t.zip64=!0;const r=Se(e.data),n=As.filter(([e,r])=>t[e]==r),s=n.reduce((e,[,t])=>e+Cs[t].bytes,0);if(e.data.length<s)throw new w(ws);for(let s=0,i=0;s<n.length;s++){const[a,o]=n[s],c=Cs[o];t[a]=e[a]=c.Ae(r,i),i+=c.bytes}})(p,t),t.extraFieldZip64=p);const h=d.get(28789);h&&(Ms(h,dn,ln,t,e),t.extraFieldUnicodePath=h);const m=d.get(25461);m&&(Ms(m,un,wn,t,e),t.extraFieldUnicodeComment=m);const y=d.get(G);y&&y.data.length>=7?(((e,t,n)=>{const s=Se(e.data),i=Xs(s,4);r.assign(e,{vendorVersion:Xs(s,0),vendorId:Xs(s,2),strength:i,originalCompressionMethod:n,compressionMethod:Js(s,5)}),t.compressionMethod=e.compressionMethod,1!=e.vendorVersion&&(t.crc32=ce)})(y,t,f),t.extraFieldAES=y):t.compressionMethod=f;const g=d.get(13);g&&(Os(g,t),t.extraFieldPkwareUnix=g);const x=d.get(22613);x&&(Os(x,t),t.extraFieldUnixType1=x);const S=d.get(10);S&&(((e,t)=>{const n=Se(e.data);let s,i=4;try{for(;i<e.data.length&&!s;){const t=Js(n,i),r=Js(n,i+2);1==t&&(s=e.data.slice(i+4,i+4+r)),i+=4+r}}catch{}if(s&&24==s.length){const n=Se(s),i=n.getBigUint64(0,!0),a=n.getBigUint64(8,!0),o=n.getBigUint64(16,!0);r.assign(e,{rawLastModDate:i,rawLastAccessDate:a,rawCreationDate:o});const c={lastModDate:Gs(i),lastAccessDate:Gs(a),creationDate:Gs(o)};r.assign(e,c),r.assign(t,c)}})(S,t),t.extraFieldNTFS=S);const b=d.get($);if(b)_s(b,t,!1),t.extraFieldUnix=b;else{const e=d.get(Q);e&&(_s(e,t,!0),t.extraFieldInfoZip=e)}const z=d.get(X);z&&(((e,t,r)=>{if(!e.data.length)return;const n=Se(e.data),s=Xs(n,0),i=[],a=[];r?(1&~s||(i.push(yn),a.push(gn)),2&~s||(i.push(xn),a.push(Sn)),4&~s||(i.push(bn),a.push(zn))):5>e.data.length||(i.push(yn),a.push(gn));let c=1;i.forEach((r,s)=>{if(e.data.length>=c+4){const i=Qs(n,c);t[r]=e[r]=new o(1e3*(0|i));const d=a[s];e[d]=i}c+=4})})(z,t,i),t.extraFieldExtendedTimestamp=z);const F=d.get(J);F&&(t.extraFieldUSDZ=F)}function Ms(e,t,n,s,i){if(5>e.data.length)return void(e.valid=!1);const a=Se(e.data),o=new vt;o.append(i[n]);const c=Se(new f(4));c.setUint32(0,o.get(),!0);const d=Qs(a,1);r.assign(e,{version:Xs(a,0),[t]:cn(e.data.subarray(5)),valid:!i.bitFlag.languageEncodingFlag&&d==Qs(c,0)}),e.valid&&(s[t]=e[t],s[t+"UTF8"]=!0)}function Os(e,t){if(8>e.data.length)return;const n=Se(e.data),s={lastAccessDate:new o(1e3*Qs(n,0)),lastModDate:new o(1e3*Qs(n,4))};12>e.data.length||(s.uid=Js(n,8),s.gid=Js(n,10)),r.assign(e,s),r.assign(t,s)}function _s(e,t,n){try{const s=Se(e.data);let i,a;if(n){let t=0;const n=Xs(s,t++),o=Xs(s,t++);i=Ns(e.data.subarray(t,t+o)),t+=o;const c=Xs(s,t++);a=Ns(e.data.subarray(t,t+c)),r.assign(e,{version:n,uid:i,gid:a})}else 4>e.data.length||(i=Js(s,0),a=Js(s,2),r.assign(e,{uid:i,gid:a}));i!==ce&&(t.uid=i),a!==ce&&(t.gid=a)}catch{}}function Ns(e){const t=new f(4);return t.set(e,0),new m(t.buffer,t.byteOffset,4).getUint32(0,!0)}function Ls(e,t){return e.A?e.A(t):0}function Ps(e){return e===ss||e===is||e===as}function Ws(e,t){if(e===ce)return t?ss:is;if(!Ps(e))throw new w(bs);return e}function Vs(e,t){if(t==as)return!1;const r=e.split("/");return r.length>1&&""===r[r.length-1]&&r.pop(),!!(r.includes("..")||e.startsWith("/")||e.startsWith("\\\\")||Es.test(e))||t==ss&&(r.includes(".")||r.includes(""))}async function*Bs(e,t){const r=e.size-t,n=await mt(e,r,t),s=Se(n);for(let e=n.length-j;e>=0;e--)Qs(s,e)==Z&&(yield[s,r,n,e,r+e])}function Zs(e,t,r){return{offset:r,buffer:e.slice(t,t+j).buffer}}async function Hs(e,t,r,n,s,i,a){const o=Js(t,n+10),c=Qs(t,n+12),d=Qs(t,n+16);if(o==_||c==O||d==O)return await qs(e,t,r,s-K,i,a)==q?2:0;if(!o&&!c)return 1;const l=Js(t,n+6);for(const n of[s-c,Ls(e,l)+d])if(await qs(e,t,r,n,i,a)==B)return 2;return 0}async function qs(e,t,r,n,s,i){return 0>n||n+4>s?ce:r>n?i.count>0?(i.count--,Qs(Se(await mt(e,n,4)),0)):ce:Qs(t,n-r)}function js(e){const t=new w(gs);throw t.reason=e,t}function Ks(e,t,r){return t[r]===ce?e.options[r]:t[r]}function Ys(e){const t=(4294901760&e)>>16,r=e&_;return new o(1980+((65024&t)>>9),((480&t)>>5)-1,31&t,(63488&r)>>11,(2016&r)>>5,2*(31&r),0)}function Gs(e){return new o(s(e/i(1e4)-i(116444736e5)))}function Xs(e,t){return e.getUint8(t)}function Js(e,t){return e.getUint16(t,!0)}function Qs(e,t){return e.getUint32(t,!0)}function $s(e,t){return s(e.getBigUint64(t,!0))}var ei=r.freeze({__proto__:null,ERR_AMBIGUOUS_ARCHIVE:gs,ERR_BAD_FORMAT:os,ERR_CENTRAL_DIRECTORY_NOT_FOUND:ls,ERR_ENCRYPTED:fs,ERR_ENCRYPTED_CENTRAL_DIRECTORY:xs,ERR_EOCDR_LOCATOR_ZIP64_NOT_FOUND:ds,ERR_EOCDR_NOT_FOUND:cs,ERR_EXTRAFIELD_ZIP64_NOT_FOUND:ws,ERR_INVALID_AUTHENTICATION_CODE:Wt,ERR_INVALID_COMPRESSED_DATA:Dr,ERR_INVALID_CRC32:Ar,ERR_INVALID_FILENAME_VALIDATION:zs,ERR_INVALID_MAX_APPENDED_DATA_SIZE:Fs,ERR_INVALID_PASSWORD:Lt,ERR_INVALID_SIGNATURE:Pt,ERR_INVALID_STRICTNESS:bs,ERR_INVALID_UNCOMPRESSED_SIZE:Rr,ERR_LOCAL_FILE_HEADER_NOT_FOUND:us,ERR_OVERLAPPING_ENTRY:ys,ERR_SPLIT_ZIP_FILE:ms,ERR_UNSAFE_FILENAME:Ss,ERR_UNSUPPORTED_COMPRESSION:hs,ERR_UNSUPPORTED_ENCRYPTION:ps,ZipReader:Ts});const ti="Zip file comment exceeds 64KB",ri="Version exceeds 65535",ni="Extra field data exceeds 64KB",si=-2147483648,ii=2147483647,ai=i(0),oi=i("0x7fffffffffffffff"),ci="Zip64 is not supported (set the 'zip64' option to 'true')",di=new f([7,0,2,0,65,69,3,0,0]),li="infozip",ui="unix";let wi=0;const fi=[];class pi{constructor(e,t={}){e=new pt(e);const{availableSize:n=de,maxSize:s=de}=e,i=n>0&&n!==de&&s>0&&s!==de;r.assign(this,{writer:e,Oe:i,options:t,config:me(),files:new c,_e:new d,offset:t[$n]===ce?e.size||e.writable.size||0:t[$n],Ne:t[$n]===ce?0:t[$n]-(e.size||e.writable.size||0),Le:new d,Pe:0,We:ce})}async prependZip(e){if(this._e.size)throw new w("Zip file not empty");e=new ft(e),await ht(e);const{ZipReader:t}=await g.resolve().then(()=>ei),n=new t(e.readable),s=await n.getEntries();await n.close(),await ht(this.writer),await e.readable.pipeTo(this.writer.writable,{preventClose:!0,preventAbort:!0}),this.writer.size=this.offset=e.size,this._e=new d(s.map(e=>e.filename)),this.files=new c(s.map(e=>{const{version:t,rawLastModDate:n,lastAccessDate:s,creationDate:i,rawFilename:a,bitFlag:o,encrypted:c,uncompressedSize:d,compressedSize:l,zip64:u}=e;let{compressionMethod:w,Ve:f,Be:p,Ze:h,He:m,qe:y,rawExtraField:g}=e;const{level:x,languageEncodingFlag:S,dataDescriptor:b}=o;f=f||fe,p=p||fe,h=h||fe,m=m||fe,y=y||fe,g=g||fe,e.extraFieldAES&&(w=99);const z=Oi(f,p,h,m,y,g),F=u&&d>=O,E=u&&l>=O,R=-7&Ni(x,S,b,c,w)|x<<1,{je:D,Ke:A}=_i({version:t,bitFlag:R,compressionMethod:w,uncompressedSize:d,compressedSize:l,rawLastModDate:n,rawFilename:a,Ye:E,Ge:F,extraFieldLength:z}),{crc32:C}=e;return C!==ce&&Ui(A,10,C),r.assign(e,{Ge:F,Ye:E,Xe:u&&e.offset>=O,diskNumberStart:0,Je:!1,Ve:f,Be:p,Ze:h,He:m,qe:y,rawExtraField:g,extendedTimestamp:h.length>0||m.length>0,Qe:1+(s?2:0)+(i?4:0),je:D,Ke:A}),[e.filename,e]}))}async add(e="",t,n={}){const c=this;n=r.assign({},n);const{Le:d,config:l}=c;let u,p;wi<l.maxWorkers?wi++:await new g(e=>fi.push(e));try{if(e=e.trim(),Ci(c,n,In)&&!e.endsWith(se)&&(e+=se),c._e.has(e))throw new w("File already exists");return c._e.add(e),p=!0,u=(async(e,t,n,c)=>{const d=((e,t,r)=>{t=t.trim();let n=Ci(e,r,An),i=Ci(e,r,kn,n?20:768);const a=Ci(e,r,Mn),o=Ti(e,r,"uid"),c=Ti(e,r,"gid");let d=Ti(e,r,Ln),l=Ci(e,r,"unixExtraFieldType"),u=Ci(e,r,Pn),f=Ci(e,r,Wn),p=Ci(e,r,Vn);if(o!==ce&&(!s.isInteger(o)||0>o||o>O))throw new w("Invalid uid (must be integer 0..2^32-1)");if(c!==ce&&(!s.isInteger(c)||0>c||c>O))throw new w("Invalid gid (must be integer 0..2^32-1)");if(d!==ce&&(!s.isInteger(d)||0>d||d>_))throw new w("Invalid UNIX mode (must be integer 0..65535)");if(l!==ce&&l!==li&&l!==ui)throw new w("Invalid unixExtraFieldType (must be 'infozip' or 'unix')");if(l===ui&&(o!==ce&&o>_||c!==ce&&c>_))throw new w("uid/gid must be 0..65535 for unixExtraFieldType 'unix' (use 'infozip' for larger ids)");l!==ce||o===ce&&c===ce||(l=li);let h=Ci(e,r,Rn),m=Ci(e,r,Dn);const y=h!==ce||m!==ce;if(o!==ce||c!==ce||d!==ce||l?(n=!1,i=i&_|768):y&&(n=!0,i&=N),h!==ce&&(0>h||h>N))throw new w("Invalid msdosAttributesRaw (must be integer 0..255)");if(m&&"object"!=typeof m)throw new w("Invalid msdosAttributes (must be an object with boolean flags)");if(i>_)throw new w(ri);let g=Ci(e,r,En);const x=g!==ce;x||(g=0),!r[In]&&t.endsWith(se)&&(r[In]=!0);const S=Ci(e,r,In);let b;if(S?(t.endsWith(se)||(t+=se),x||(g=16,n||(g|=16877<<16))):n||x||(g=a?493<<16:27525120),!n){const e=d!==ce||!!(u||f||p);b=g>>16&_,d=d===ce?b:d&_,u?d|=re:u=!!(d&re),f?d|=ne:f=!!(d&ne),p?d|=512:p=!!(512&d),x&&!e||(S&&(d|=te),g=(d&_)<<16|g&_)}return({msdosAttributesRaw:h,msdosAttributes:m}=((e,t)=>{if(e!==ce)e&=N;else if(t!==ce){const{readOnly:r,hidden:n,system:s,directory:i,archive:a}=t;let o=0;r&&(o|=1),n&&(o|=2),s&&(o|=4),i&&(o|=16),a&&(o|=32),e=o&N}return t===ce&&(t={readOnly:!!(1&e),hidden:!!(2&e),system:!!(4&e),directory:!!(16&e),archive:!!(32&e)}),{msdosAttributesRaw:e,msdosAttributes:t}})(h,m)),y&&(g=g&O|h&N),{name:t,$e:{versionMadeBy:i,msDosCompatible:n,externalFileAttributes:g,unixExternalUpper:b,uid:o,gid:c,unixMode:d,unixExtraFieldType:l,setuid:u,setgid:f,sticky:p,msdosAttributesRaw:h,msdosAttributes:m}}})(e,t,c);({name:t}=d);const l=((e,t,r)=>{const n=Ci(e,r,"encodeText",Ut);let i=n(t,rs);if(i===ce&&(i=Ut(t)),Oi(i)>_)throw new w("File entry name exceeds 64KB");const a=r[un]||"";let c=n(a,ns);if(c===ce&&(c=Ut(a)),Oi(c)>_)throw new w("File entry comment exceeds 64KB");const d=Ci(e,r,vn,20);if(d>_)throw new w(ri);const l=Ci(e,r,yn,new o),u=Ci(e,r,xn),p=Ci(e,r,bn),h=Ci(e,r,Fn,0),m=Ci(e,r,jn);let y,g;if(!m&&(y=Ci(e,r,Hn),g=Ci(e,r,qn),y&&typeof y!=we||g&&!(g instanceof f)))throw new w("Invalid password (password must be a string, rawPassword must be a Uint8Array)");const x=Ti(e,r,"encryptionStrength",3),S=Ci(e,r,Un),b=Ci(e,r,"extendedTimestamp",!0),z=Ci(e,r,"ntfsTimestamp"),F=Ci(e,r,"keepOrder",!0),E=Ci(e,r,Gn),R=Ci(e,r,Jn),D=Ci(e,r,"bufferedWrite"),A=Ci(e,r,"createTempStream"),C=Ci(e,r,"dataDescriptorSignature",!0),T=Ci(e,r,Kn),v=Ci(e,r,"useUnicodeFileNames",!0),k=Ci(e,r,On),U=m||k===ce?ce:xt(k);if(!m&&k!==ce&&0!==k&&8!==k&&!U)throw new w("Compression method not supported");let I=Ti(e,r,"level");if(I!==ce&&(!s.isInteger(I)||0>I||I>9))throw new w("Invalid level (must be integer 0..9)");if(e.options[es]){if(y!==ce||g!==ce)throw new w("Encryption is not supported in USDZ files");I===ce&&k===ce&&(I=0)}let M=Ci(e,r,Xn),O=Ci(e,r,"dataDescriptor");D&&O===ce&&(O=!1),(O===ce||S)&&(O=!0),I!==ce&&6!=I&&(M=!1);const N=Ci(e,r,Cn);if(!(S||y===ce&&g===ce||s.isInteger(x)&&x>=1&&3>=x))throw new w("The strength must equal 1, 2, or 3");const L=hi(r[Nn]),P=hi(r.localExtraField);return{comment:a,$e:{rawFilename:i,rawComment:c,version:d,lastModDate:l,lastAccessDate:u,creationDate:p,internalFileAttributes:h,passThrough:m,password:y,rawPassword:g,encryptionStrength:x,zipCrypto:S,extendedTimestamp:b,ntfsTimestamp:z,keepOrder:F,useWebWorkers:E,transferStreams:R,bufferedWrite:D,createTempStream:A,dataDescriptorSignature:C,signal:T,useUnicodeFileNames:v,compressionMethod:k,format:U?U.format:ce,codecURI:U?U.codecURI:ce,et:U?U.versionNeeded:ce,level:I,useCompressionStream:M,dataDescriptor:O,zip64:N,rawExtraField:L,nt:P}}})(e,t,c),{comment:u}=l,p=c[Nn];let h;e.files.set(t,ce);try{const{$e:s}=l;0==s.level||s.compressionMethod!==ce||s.passThrough||await(async e=>{const{CompressionStream:t,CompressionStreamFallback:r}=e;if(r&&!r.Fe)return!0;if(_r(t)||Or(t,Tr))return!0;if(r)try{return await void 0,!0}catch{return!1}return!1})(e.config)||(s.level=0);const u=await(async(e,t,{$e:r},n)=>{const{passThrough:s,zipCrypto:i,password:a,rawPassword:o,encryptionStrength:c}=r;let{dataDescriptor:d,zip64:l,level:u,compressionMethod:f}=r,p=0,h=0;if(s){if(!t)throw new w("Undefined reader");if(h=n[fn],h===ce)throw new w("Undefined uncompressed size")}const m=!0===l,y=Ci(e,n,Tn),g=!!t&&(!!(a&&Oi(a)||o&&Oi(o))||s&&y);t||(u=0,f=0);const x=g?i?12:16+4*c:0;t&&(t=new ft(t),await ht(t),s?(n.uncompressedSize=h,p=vi(h)+x):t.size===ce?(d=!0,(l||l===ce)&&(l=!0,h=p=4294967296)):(n.uncompressedSize=h=t.size,p=vi(h)+x));const S=m||h>=O,b=m||p>=O;if(S||b){if(!1===l)throw new w(ci);l=!0}return l=l||!1,{reader:t,$e:{dataDescriptor:d,zip64:l,Ge:S,Ye:b,uncompressedSize:h,level:u,compressionMethod:f,encrypted:g}}})(e,n,l,c);({reader:n}=u);const p=Si(e.writer),m=xi(e.writer),y=(e=>{const{rawFilename:t,lastModDate:r,lastAccessDate:n,creationDate:s,level:i,zip64:c,zipCrypto:d,useUnicodeFileNames:l,dataDescriptor:u,directory:f,rawExtraField:p,nt:h,encryptionStrength:m,extendedTimestamp:y,ntfsTimestamp:g,passThrough:x,encrypted:S,Ge:b,Ye:z,uncompressedSize:F,crc32:E}=e;let{version:R,compressionMethod:D}=e;const A=!f&&(D===ce?i===ce||i>0:0!==D);let C;const T=x||!A,v=c&&(e.bufferedWrite||!u||!b&&!z||T),k=v||c&&u&&(b||z);if(c&&(b||z)){const e=20,t=gi(e);if(t.uint16(1),t.uint16(e-4),C=t.array,v&&(t.st(F),T)){const e=S?d?12:16+4*m:0;t.st(x?0:F+e)}}else C=fe;let U,I,M,O,N;if(S&&!d){const e=gi(Oi(di)+2);e.uint16(G),e.bytes(di),U=e.array,U[8]=m}else U=fe;if(y){const e=Ri(r),t=Di(e);if(t){const t=9+(n?4:0)+(s?4:0),r=gi(t);O=1+(n?2:0)+(s?4:0),r.uint16(X),r.uint16(t-4),r.uint8(O),r.uint32(e),n&&r.uint32(Ai(Ri(n))),s&&r.uint32(Ai(Ri(s))),M=r.array}else M=fe;if(g===ce?!t||n||s:g)try{const e=Ei(r),t=gi(36);t.uint16(10),t.uint16(32),t.it(4),t.uint16(1),t.uint16(24),t.st(e),t.st(n?Ei(n):e),t.st(s?Ei(s):e),I=t.array}catch{I=fe}else I=fe}else I=M=fe;try{const{uid:t,gid:r,unixExtraFieldType:n}=e;if(n!=li||t===ce&&r===ce)if(n!=ui||t===ce&&r===ce)N=fe;else{const e=gi(8);e.uint16($),e.uint16(4),e.uint16((t===ce?0:t)&_),e.uint16((r===ce?0:r)&_),N=e.array}else{const e=yi(t),n=yi(r),s=3+e.length+n.length,i=gi(4+s);i.uint16(Q),i.uint16(s),i.uint8(1),i.uint8(e.length),i.bytes(e),i.uint8(n.length),i.bytes(n),N=i.array}}catch{N=fe}D===ce&&(D=A?8:0);const{et:P}=e;A&&P!==ce&&(R=R>P?R:P),c&&(R=R>45?R:45),S&&!d&&(R=R>51?R:51,x&&E!==ce&&(U[4]=1),U[9]=D,D=99);const W=k?Oi(C):0,V=W+Oi(U,M,I,N,p,h);if(V>_)throw new w(ni);const B=new o(2e3*a.ceil(a.floor(r.getTime()/1e3)/2)),{je:Z,Ke:H,rawLastModDate:q}=_i({version:R,bitFlag:Ni(i,l,u,S,D),compressionMethod:D,uncompressedSize:F,lastModDate:oe>B?oe:B>ae?ae:B,rawFilename:t,Ye:z,Ge:b,extraFieldLength:V}),j=gi(ie+Oi(t)+V),K=j.array,Y=Se(K);return j.uint32(L),j.bytes(Z),j.bytes(t),k&&j.bytes(C),j.bytes(U),j.bytes(M),j.bytes(I),j.bytes(N),j.bytes(p),j.bytes(h),u&&(z||Ui(Y,18,0),b||Ui(Y,22,0)),{ot:K,ct:Y,je:Z,Ke:H,lastModDate:r,rawLastModDate:q,encrypted:S,compressed:A,version:R,compressionMethod:D,Qe:O,Ve:fe,lt:W,Ze:M,He:I,qe:N,Be:U,extraFieldLength:V}})(c=r.assign({},c,d.$e,l.$e,u.$e,{internalFileAttribute:l.$e.internalFileAttributes,externalFileAttribute:d.$e.externalFileAttributes,signature:c[_n],crc32:c.crc32===ce?c[_n]:c.crc32,offset:e.offset-p,diskNumberStart:m})),x=(({zip64:e,dataDescriptor:t,dataDescriptorSignature:r})=>{let n,s=fe,i=0,a=e?20:12;return r&&(a+=4),t&&(s=new f(a),n=Se(s),r&&(i=4,Ui(n,0,W))),{ut:s,wt:n,ft:i}})(c),S=Oi(y.ot,x.ut);h=await(async(e,t,n,s,a)=>{const{files:o,writer:c}=e,{keepOrder:d,dataDescriptor:l,signal:u}=a,{ht:p}=s,h=e.options[es],m=e.We;let y,x,S,b,z,F,R,A={},C=0;o.set(t,A),e.We=A;try{let x;d&&(x=m&&m.lock,A.lock=new g(e=>S=e)),a.bufferedWrite||!d||e.yt||e.Pe||!l?(y=!0,e.Pe++,R=a.createTempStream?await a.createTempStream():new E(ce,ce,{highWaterMark:de}),R.size=0,await ht(c)):(R=c,await T()),await ht(R);const k=Si(c);if(e.Oe){delete e.Oe;const t=new f(4);Ui(Se(t),0,P),await Fi(c,t),e.offset+=4}h&&!y&&mi(s,e.offset-k);const{ot:U}=p;y||(await x,await v());const I=xi(c),M=zi(e,c);if(A.diskNumberStart=I,y||(z=!0,F=c.size,await Fi(R,U)),A=await(async(e,t,{diskNumberStart:n,lock:s},a,o,c)=>{const{ht:d,gt:l,xt:u}=a,{je:f,Ke:p,lastModDate:h,rawLastModDate:m,encrypted:y,compressed:g,version:x,compressionMethod:S,Ve:b,lt:z,Ze:F,Qe:E,He:R,qe:D,Be:A}=d,{ut:C}=l,{rawFilename:T,lastAccessDate:v,creationDate:k,password:U,rawPassword:I,level:M,zip64:_,Ge:L,Ye:P,zipCrypto:W,dataDescriptor:V,directory:B,executable:Z,versionMadeBy:H,rawComment:q,rawExtraField:j,useWebWorkers:K,transferStreams:Y,onstart:G,onprogress:X,onend:J,signal:Q,encryptionStrength:$,extendedTimestamp:ee,msDosCompatible:te,internalFileAttributes:re,externalFileAttributes:ne,uid:se,gid:ie,unixMode:ae,setuid:oe,setgid:de,sticky:le,unixExternalUpper:ue,msdosAttributesRaw:we,msdosAttributes:fe,useCompressionStream:pe,passThrough:he,format:me,codecURI:ye}=c,ge={lock:s,versionMadeBy:H,zip64:_,directory:!!B,executable:!!Z,filenameUTF8:!0,rawFilename:T,commentUTF8:!0,rawComment:q,Ve:b,lt:z,Ze:F,He:R,qe:D,Be:A,rawExtraField:j,extendedTimestamp:ee,msDosCompatible:te,internalFileAttributes:re,externalFileAttributes:ne,diskNumberStart:n,uid:se,gid:ie,unixMode:ae,setuid:oe,setgid:de,sticky:le,unixExternalUpper:ue,msdosAttributesRaw:we,msdosAttributes:fe};let{crc32:xe,uncompressedSize:Se}=c,ze=0;he||(Se=0);const{writable:Fe}=t;if(e){const r=be(e.createReadable?e.createReadable():e.readable),n=e.size,s={options:{codecType:Br,level:M,rawPassword:I,password:U,encryptionStrength:$,zipCrypto:y&&W,passwordVerification:y&&W&&m>>8&N,computeCrc32:!he,compressed:g&&!he,encrypted:y&&!he,useWebWorkers:K,useCompressionStream:pe,transferStreams:Y,format:me,codecURI:ye,compressionMethod:S},config:o,he:{signal:Q,size:n,onstart:G,onprogress:X,onend:J}};try{const e=await en({readable:r,writable:Fe},s);if(ze=e.outputSize,t.size+=ze,he||(Se=e.inputSize,y&&!W||(xe=e.crc32)),!P&&ze>=O||!L&&Se>=O)throw new w(ci)}catch(e){throw e.outputSize!==ce&&(t.size+=e.outputSize),e}}return(({crc32:e,compressedSize:t,uncompressedSize:r,ht:n,gt:s},{zip64:a,zipCrypto:o,passThrough:c,dataDescriptor:d})=>{const{Ke:l,encrypted:u}=n,{wt:w,ft:f}=s;u&&!o&&!c||e===ce||(Ui(l,10,e),d&&Ui(w,f,e)),a?d&&(Ii(w,f+4,i(t)),Ii(w,f+12,i(r))):(Ui(l,14,t),Ui(l,18,r),d&&(Ui(w,f+4,t),Ui(w,f+8,r)))})({crc32:xe,compressedSize:ze,uncompressedSize:Se,ht:d,gt:l},c),V&&await Fi(t,C),r.assign(ge,{uncompressedSize:Se,compressedSize:ze,lastModDate:h,rawLastModDate:m,creationDate:k,lastAccessDate:v,encrypted:y,zipCrypto:W,size:u+ze,compressionMethod:S,version:x,je:f,Ke:p,signature:xe,crc32:!y||W||he?xe:ce,Qe:E,Ge:L,Ye:P}),ge})(n,R,A,s,e.config,a),y||(z=!1),o.set(t,A),A.filename=t,y){if(await g.all([R.writable.getWriter().close(),x]),await T(),b=!0,F=c.size,await v(),A.diskNumberStart=xi(c),A.offset=zi(e,c),h){const t=s.xt;mi(s,e.offset-Si(c)),A.size+=s.xt-t}(({rawFilename:e,encrypted:t,zip64:r,lt:n,crc32:s,compressedSize:a,uncompressedSize:o,Ge:c,Ye:d},l,{dataDescriptor:u,passThrough:w})=>{if(u||((!t||w&&s!==ce)&&Ui(l,14,s),d||Ui(l,18,a),c||Ui(l,22,o)),r&&n){const t=ie+Oi(e)+4;Ii(l,t,i(o)),Ii(l,t+8,i(a))}})(A,p.ct,a),await Fi(c,p.ot),await(async(e,t,r)=>{const n=t.writable.getWriter();try{await e.pipeTo(new D({async write(e){var t;await n.ready,await n.write(e),t=Oi(e),C+=t}}),{preventClose:!0,preventAbort:!0,signal:r})}finally{n.releaseLock()}})(R.readable,c,u),c.size+=R.size,b=!1}else A.diskNumberStart=I,A.offset=M;return e.offset+=A.size,A}catch(r){if(b||z){if(e.hasCorruptedEntries=!0,r)try{r.corruptedEntry=!0}catch{}e.offset+=c.size-F,y&&(e.offset+=C)}throw o.delete(t),r}finally{if(y&&e.Pe--,S&&S(),x&&x(),y&&R&&R.dispose)try{await R.dispose()}catch{}}async function T(){e.yt=!0;const{St:t}=e;e.St=new g(t=>x=()=>{e.yt=!1,t()}),await t}async function v(){bi(c,Oi(p.ot))&&await c.closeDisk()}})(e,t,n,{ht:y,gt:x,xt:S},c)}catch(r){throw e.files.delete(t),r}return r.assign(h,{name:t,comment:u,extraField:p}),new Zn(h)})(c,e,t,n),d.add(u),await u}catch(t){throw p&&c._e.delete(e),t}finally{d.delete(u);const e=fi.shift();e?e():wi--}}remove(e){const{_e:t,files:r}=this;if(typeof e==we&&(e=r.get(e)),e&&e.filename!==ce){const{filename:n}=e;if(t.has(n)&&r.has(n))return t.delete(n),r.delete(n),!0}return!1}async close(e=fe,r={}){const{Le:n,writer:s}=this,{writable:a}=s;if(Oi(e)>_)throw new w(ti);for(;n.size;)await g.allSettled(t.from(n));return await(async(e,r,n)=>{const s=(e=>{let t=0;for(const[,r]of e){const{rawFilename:e,Be:n,rawComment:s,He:i,qe:a,rawExtraField:o,extendedTimestamp:c,Qe:d,lastModDate:l,Ge:u,Ye:f,uncompressedSize:p,compressedSize:h}=r,m=r.offset>=O,y=r.diskNumberStart>=_;let g,x;if(m||y||u||f){const e=4+(u?8:0)+(f?8:0)+(m?8:0)+(y?4:0),t=gi(e);t.uint16(1),t.uint16(e-4),u&&t.st(p),f&&t.st(h),m&&t.st(r.offset),y&&t.uint32(r.diskNumberStart),g=t.array}else g=fe;r.Ve=g,r.Xe=m,r.Je=y;const S=Ri(l);if(c&&Di(S)){const e=gi(9);e.uint16(X),e.uint16(5),e.uint8(d),e.uint32(S),x=e.array}else x=fe;r.Ze=x;const b=Oi(g,n,i,a,x,o);if(b>_)throw new w(ni);t+=46+Oi(e,s)+b}return t})(e.files),{bt:a,zt:o}=await(async(e,r,n)=>{const{files:s,writer:i}=e,a=new f(r);await ht(i);let o=0,c=0,d=xi(i),l=Si(i);for(const[e,r]of t.from(s.values()).entries()){const{offset:t,rawFilename:u,Ve:w,Be:f,Ze:p,He:h,qe:m,rawExtraField:y,rawComment:g,versionMadeBy:x,je:S,Ke:b,Ge:z,Ye:F,Je:E,Xe:R,internalFileAttributes:D,externalFileAttributes:A,diskNumberStart:C,uncompressedSize:T,compressedSize:v}=r,k=Oi(w,f,p,h,m,y),U=46+Oi(u,g)+k;bi(i,o+U-c)&&(await Fi(i,a.slice(c,o)),c=o,await i.closeDisk()),0==e&&(d=xi(i),l=Si(i)),z||Ui(b,18,T),F||Ui(b,14,v),(R||E)&&45>r.version&&ki(b,0,45);const I=gi(U);if(I.uint32(B),I.uint16(x),I.bytes(S.subarray(0,24)),I.uint16(k),I.uint16(Oi(g)),I.uint16(E?_:C),I.uint16(D),I.uint32(A),I.uint32(R?O:t),I.bytes(u),I.bytes(w),I.bytes(f),I.bytes(p),I.bytes(h),I.bytes(m),I.bytes(y),I.bytes(g),Mi(a,I.array,o),o+=U,n.onprogress)try{await n.onprogress(e+1,s.size,new Zn(r))}catch{}}return await Fi(i,c?a.slice(c):a),{bt:{diskNumber:d,diskOffset:l},zt:a}})(e,s,n),c=await(async(e,t,r)=>{const n=Ci(e,r,"signCentralDirectory");if(n){const r=await n(t),s=Oi(r);if(s>_)throw new w("Signature data exceeds 64KB");const i=gi(6+s);return i.uint32(V),i.uint16(s),i.bytes(r),await Fi(e.writer,i.array),6+s}return 0})(e,o,n);await(async(e,t,r,n)=>{const{writer:s}=e,{bt:a,Ft:o}=n;let{Et:c}=n,d=e.files.size,l=a.diskNumber,u=zi(e,a),f=xi(s);bi(s,j)&&f++;let p=Ci(e,r,Cn);if(!(O>u&&O>c&&_>d&&_>f)){if(!1===p)throw new w(ci);p=!0}const h=Oi(t);if(h>_)throw new w(ti);const m=gi(p?98:j);bi(s,Oi(m.array)+h)&&await s.closeDisk(),f=xi(s),p&&(m.uint32(H),m.st(44),m.uint16(45),m.uint16(45),m.uint32(f),m.uint32(l),m.st(d),m.st(d),m.st(c),m.st(u),m.uint32(q),m.uint32(f),m.st(i(zi(e,s))+i(c)+i(o)),m.uint32(f+1),Ci(e,r,"supportZip64SplitFile",!0)&&(f=_,l=_),d=_,u=O,c=O),m.uint32(Z),m.uint16(f),m.uint16(l),m.uint16(d),m.uint16(d),m.uint32(c),m.uint32(u),m.uint16(h),await Fi(s,m.array),h&&await Fi(s,t)})(e,r,n,{bt:a,Et:s,Ft:c})})(this,e,r),Ci(this,r,Qn)||await a.getWriter().close(),s.getData?s.getData():a}}function hi(e){if(!e)return fe;let t=0,r=0;e.forEach(e=>t+=4+Oi(e));const n=new f(t),s=Se(n);return e.forEach((e,t)=>{if(t>_)throw new w("Extra field type exceeds 65535");if(Oi(e)>_)throw new w(ni);ki(s,r,t),ki(s,r+2,Oi(e)),Mi(n,e,r+4),r+=4+Oi(e)}),n}function mi(e,t){const{ht:r}=e;let{ot:n,extraFieldLength:s}=r,i=64-(t+Oi(n))%64;4>i&&(i+=64);const a=new f(i),o=Se(a);ki(o,0,J),ki(o,2,i-4);const c=n;r.ot=n=new f(Oi(c)+i),Mi(n,c),Mi(n,a,Oi(c));const d=Se(n);ki(d,28,s+i),r.ct=d,e.xt+=i}function yi(e){if(e===ce)return fe;{const t=new f(4);Se(t).setUint32(0,e,!0);let r=4;for(;r>1&&0===t[r-1];)r--;return t.subarray(0,r)}}function gi(e){const t=new f(e),r=Se(t);let n=0;return{array:t,uint8:e=>{((e,t,r)=>{e.setUint8(t,r)})(r,n,e),n+=1},uint16:e=>{ki(r,n,e),n+=2},uint32:e=>{Ui(r,n,e),n+=4},st:e=>{Ii(r,n,i(e)),n+=8},bytes:e=>{Mi(t,e,n),n+=Oi(e)},it:e=>n+=e}}function xi(e){const{diskNumber:t=0}=e;return t}function Si(e){const{diskOffset:t=0}=e;return t}function bi(e,t){const{availableSize:r=de}=e;return t>r}function zi(e,{diskNumber:t=0,diskOffset:r=0}){return e.offset-r-(t?e.Ne:0)}async function Fi(e,t){const{writable:r}=e,n=r.getWriter();try{await n.ready,e.size+=Oi(t),await n.write(t)}finally{n.releaseLock()}}function Ei(e){if(e){const t=(i(e.getTime())+i(116444736e5))*i(1e4);return ai>t?ai:t>oi?oi:t}}function Ri(e){return a.floor(e.getTime()/1e3)}function Di(e){return e>=si&&ii>=e}function Ai(e){return a.min(ii,a.max(si,e))}function Ci(e,t,r,n){const s=t[r]===ce?e.options[r]:t[r];return s===ce?n:s}function Ti(e,t,r,n){return typeof(i=Ci(e,t,r,n))==we&&i.trim()?s(i):i;var i}function vi(e){return e+5*(a.floor(e/16383)+1)}function ki(e,t,r){e.setUint16(t,r,!0)}function Ui(e,t,r){e.setUint32(t,r,!0)}function Ii(e,t,r){e.setBigUint64(t,r,!0)}function Mi(e,t,r){e.set(t,r)}function Oi(...e){let t=0;return e.forEach(e=>e&&(t+=e.length)),t}function _i({version:e,bitFlag:t,compressionMethod:r,uncompressedSize:n,compressedSize:s,lastModDate:i,rawLastModDate:a,rawFilename:o,Ye:c,Ge:d,extraFieldLength:l}){const u=gi(26),w=u.array,f=Se(w);if(u.uint16(e),u.uint16(t),u.uint16(r),a===ce){const e=new h(1),t=Se(e);ki(t,0,(i.getHours()<<6|i.getMinutes())<<5|i.getSeconds()/2),ki(t,2,(i.getFullYear()-1980<<4|i.getMonth()+1)<<5|i.getDate()),a=e[0]}return u.uint32(a),u.it(4),c||s!==ce?u.uint32(c?O:s):u.it(4),d||n!==ce?u.uint32(d?O:n):u.it(4),u.uint16(Oi(o)),u.uint16(l),{je:w,Ke:f,rawLastModDate:a}}function Ni(e,t,r,n,s){let i=0;return t&&(i|=ee),r&&(i|=8),8!=s&&9!=s||(0>e||e>3||(i|=6),e>3&&5>=e&&(i|=4),9==e&&(i|=2)),n&&(i|=1),i}const Li="Entry filename already exists",Pi="Readable stream already consumed",Wi="zipjs-abort-export",Vi=new d([1,G,10,X,28789,25461,J,Q,$,22613,13]);class Bi{constructor(e,t,n,s){const i=this;if(e.root&&s&&s.getChildByName(t))throw new w(Li);n||(n={}),r.assign(i,{fs:e,name:t,data:n.data,options:n.options,id:e.Rt++,parent:s,children:[],uncompressedSize:n.uncompressedSize||0,passThrough:n.passThrough}),!s&&e.root||(e.entries[i.id]=i),s&&i.parent.children.push(i)}moveTo(e){this.fs.move(this,e)}getFullname(){return this.getRelativeName()}getRelativeName(e=this.fs.root){let t=this.name,r=this.parent;for(;r&&r!=e;)t=(r.name?r.name+"/":"")+t,r=r.parent;return t}isDescendantOf(e){let t=this.parent;for(;t&&t.id!=e.id;)t=t.parent;return!!t}rename(e){const t=this.parent;if(t&&t.getChildByName(e))throw new w(Li);this.name=e}}class Zi extends Bi{constructor(e,t,r,n){super(e,t,r,n);const s=this;s.Reader=r.Reader,s.Writer=r.Writer,r.getData&&(s.getData=r.getData)}clone(){return new Zi(this.fs,this.name,this)}async getData(e,t={}){const r=this;if(!e||e.constructor==r.Writer&&r.data)return r.data;{const n=r.reader=Gi(r.Reader,r.data,t),s=r.data?r.data.uncompressedSize:n.size;await g.all([ht(n),ht(e,s)]);const{readable:i}=n,{signal:a}=t;return r.uncompressedSize=n.size,await be(i).pipeTo(Fe(e.writable),{signal:a}),e.getData?e.getData():e.writable}}isPasswordProtected(){return!(!this.data||!this.data.encrypted)}async checkPassword(e,t={}){const n=this;if(!n.isPasswordProtected())return!0;try{return await n.data.getData(null,r.assign({},t,{password:e,checkPasswordOnly:!0})),!0}catch(e){if(e.message==Lt)return!1;throw e}}getText(e,t){return this.getData(new He(e),t)}getBlob(e,t){return this.getData(new Be(e),t)}getData64URI(e,t){return this.getData(new Le(e),t)}getUint8Array(e){return this.getData(new lt,e)}getWritable(e=new D,t){return this.getData({writable:e},t)}async getArrayBuffer(e){return xe(await this.getUint8Array(e)).buffer}replaceBlob(e){r.assign(this,{data:e,Reader:Ve,Writer:Be,reader:null})}replaceText(e){r.assign(this,{data:e,Reader:Ze,Writer:He,reader:null})}replaceData64URI(e){r.assign(this,{data:e,Reader:Ne,Writer:Le,reader:null})}replaceUint8Array(e){r.assign(this,{data:e,Reader:dt,Writer:lt,reader:null})}replaceReadable(e){r.assign(this,{data:null,Reader:Ki(e),Writer:null,reader:null})}}class Hi extends Bi{constructor(e,t,r,n){super(e,t,r,n),this.directory=!0}clone(e){const t=this,r=new Hi(t.fs,t.name,t);return e&&(r.children=t.children.map(t=>{const n=t.clone(e);return n.parent=r,n})),r}addDirectory(e,t){return ra(this,e,{options:t},!0)}addText(e,t,r={}){return ra(this,e,{data:t,Reader:Ze,Writer:He,options:r,uncompressedSize:t.length})}addBlob(e,t,r={}){return ra(this,e,{data:t,Reader:Ve,Writer:Be,options:r,uncompressedSize:t.size})}addData64URI(e,t,r={}){let n=t.length;for(;"="==t.charAt(n-1);)n--;const s=t.indexOf(",")+1;return ra(this,e,{data:t,Reader:Ne,Writer:Le,options:r,uncompressedSize:a.floor(.75*(n-s))})}addUint8Array(e,t,r={}){return ra(this,e,{data:t,Reader:dt,Writer:lt,options:r,uncompressedSize:t.length})}addHttpContent(e,t,r={}){return ra(this,e,{data:t,Reader:class extends ct{constructor(e){super(e,r)}},options:r})}addReadable(e,t,r={}){return ra(this,e,{Reader:Ki(t),options:r})}addFileSystemEntry(e,t={}){return $i(this,e,t)}addFileSystemHandle(e,t={}){return $i(this,e,t)}addFile(e,t={}){return(t=r.assign({},t)).lastModDate||(t.lastModDate=new o(e.lastModified)),ra(this,e.name,{data:e,Reader:()=>({readable:e.stream(),size:e.size}),options:t,uncompressedSize:e.size})}Dt(e,t){return ra(this,e,t)}importBlob(e,t){return this.importZip(new Ve(e),t)}importData64URI(e,t){return this.importZip(new Ne(e),t)}importUint8Array(e,t){return this.importZip(new dt(e),t)}importHttpContent(e,t){return this.importZip(new ct(e,t),t)}importReadable(e,t){return this.importZip({readable:e},t)}exportBlob(e={}){return this.exportZip(new Be(e.mimeType||"application/zip"),e)}exportData64URI(e={}){return this.exportZip(new Le(e.mimeType||"application/zip"),e)}exportUint8Array(e={}){return this.exportZip(new lt,e)}async exportWritable(e=new D,t={}){return await this.exportZip({writable:e},t),e}exportFileSystemHandle(e,n={}){return(async(e,n,s)=>{const i=ji([e],"uncompressedSize"),a=new c,o=new AbortController,{signal:d}=o,l=((e,t)=>{if(!e)return()=>{};if(e.aborted)return t.abort(e.reason),()=>{};const r=()=>t.abort(e.reason);return e.addEventListener("abort",r,{once:!0}),()=>e.removeEventListener("abort",r)})(s.signal,o),u=[];try{await f(e,n)}catch(e){try{e.exportedEntryNames=u}catch{}throw e}finally{l()}return n;async function f(e,t){if(s.concurrent){const r=(await g.allSettled(e.children.map(e=>p(e,t)))).filter(e=>"rejected"==e.status);if(r.length){const e=r.filter(e=>!Qi(e.reason));throw(e=>{const[t]=e,r=e.slice(1).flatMap(e=>[e,...e&&e.entryErrors||[]]).filter(e=>e!==t);if(r.length)try{t.entryErrors=[...t.entryErrors||[],...r]}catch{}return t})((e.length?e:r).map(e=>e.reason))}}else for(const r of e.children)await p(r,t)}async function p(n,c){if(d.aborted){if(Qi(d.reason))return;throw d.reason}try{if(n.directory){const e=await c.getDirectoryHandle(n.name,{create:!0});await f(n,e)}else{const o=await c.getFileHandle(n.name,{create:!0}),l=await o.createWritable();await n.getData({writable:l},r.assign({},s,{signal:d,onprogress:async e=>{if(s.onprogress){a.set(n.id,e);try{await s.onprogress(t.from(a.values()).reduce((e,t)=>e+t,0),i)}catch{}}}})),u.push(n.getRelativeName(e))}}catch(t){o.abort(new w(Wi));try{t.entryName===ce&&(t.entryName=n.getRelativeName(e),t.entryId=n.id)}catch{}throw t}}})(this,e,n)}async importZip(e,t={}){await ht(e);const n=new Ts(e,t),s=[],i=await n.getEntries();for(const e of i){let n=this;try{const i=e.filename.split("/").filter(e=>""!=e&&"."!=e),a=i.pop();if(i.forEach(e=>{const t=n;if(n=n.getChildByName(e),n){if(!n.directory)throw new w(Li)}else n=new Hi(this.fs,e,{data:null},t),s.push(n)}),e.directory){let t=n;if(a)if(t=n.getChildByName(a),t){if(!t.directory)throw new w(Li)}else t=new Hi(this.fs,a,{data:null},n),s.push(t);t==this||t.data||(t.data=e)}else s.push(ra(n,a,{data:e,Reader:Yi(r.assign({},t)),uncompressedSize:e.uncompressedSize,passThrough:t.passThrough}))}catch(t){try{t.cause={entry:e}}catch{}throw t}}return s}async exportZip(e,n={}){const s=this;(n=r.assign({},n)).bufferedWrite===ce&&(n.bufferedWrite=!0);const[i]=await g.all([Xi(s,n.readerOptions),ht(e)]),a=new pi(e,n);return await(async(e,n,s,i,a)=>{const o=n,d=new c;await async function e(n,l){async function u(l){const u=i.relativePath?l.getRelativeName(o):l.getFullname(),w=l.options||{};let f={};if(l.data instanceof Zn){const{externalFileAttributes:e,versionMadeBy:t,comment:n,lastModDate:s,creationDate:a,lastAccessDate:o,uncompressedSize:d,encrypted:u,zipCrypto:w,crc32:p,compressionMethod:h,extraFieldAES:m,internalFileAttributes:y,extraField:g,uid:x,gid:S}=l.data;f={externalFileAttributes:e,versionMadeBy:t,comment:n,lastModDate:s,creationDate:a,lastAccessDate:o,internalFileAttributes:y};const b=(e=>{if(e){const t=new c;if(e.forEach((e,r)=>{Vi.has(r)||t.set(r,e.data)}),t.size)return t}})(g);if(b&&(f.extraField=b),x===ce&&S===ce||r.assign(f,{uid:x,gid:S,unixExtraFieldType:i.unixExtraFieldType||"infozip"}),l.passThrough){let e,t;0===h&&(e=0),m&&(t=m.strength),f=r.assign(f,{passThrough:!0,encrypted:u,zipCrypto:w,crc32:p,uncompressedSize:d,level:e,encryptionStrength:t,compressionMethod:h})}}await n.add(u,a.get(l),r.assign({},i,f,w,{directory:l.directory,onprogress:async e=>{if(i.onprogress){d.set(u,e);try{await i.onprogress(t.from(d.values()).reduce((e,t)=>e+t),s)}catch{}}}})),await e(n,l)}await(async()=>{if(i.bufferedWrite){const e=(await g.allSettled(l.children.map(u))).find(e=>"rejected"==e.status);if(e)throw e.reason}else for(const e of l.children)await u(e)})()}(e,n)})(a,s,ji([s],"uncompressedSize"),n,i),await a.close(),e.getData?e.getData():e.writable}getChildByName(e){const t=this.children;for(let r=0;r<t.length;r++){const n=t[r];if(n.name==e)return n}}isPasswordProtected(){const e=this.children;for(let t=0;t<e.length;t++)if(e[t].isPasswordProtected())return!0;return!1}async checkPassword(e,t={}){const r=this.children;return!(await g.all(r.map(r=>r.checkPassword(e,t)))).includes(!1)}}const qi={FS:class{constructor(){ta(this)}get children(){return this.root.children}remove(e){Ji(e);const t=[e];for(;t.length;){const e=t.pop();this.entries[e.id]=null;for(const r of e.children)t.push(r)}e.parent=ce}move(e,t){if(e==this.root)throw new w("Root directory cannot be moved");if(!t.directory)throw new w("Target entry is not a directory");if(t.isDescendantOf(e))throw new w("Entry is a ancestor of target entry");if(e!=t){const r=t.getChildByName(e.name);if(r){if(r!=e)throw new w(Li)}else Ji(e),e.parent=t,t.children.push(e),((e,t)=>{const r=[t];for(;r.length;){const t=r.pop();e.entries[t.id]=t;for(const e of t.children)r.push(e)}})(this,e)}}find(e){const t=e.split("/");let r=this.root;for(let e=0;r&&e<t.length;e++)r=r.getChildByName(t[e]);return r||(r=this.entries.find(t=>t&&(t==this.root||t.isDescendantOf(this.root))&&t.getRelativeName()==e)),r}getById(e){return this.entries[e]}getChildByName(e){return this.root.getChildByName(e)}addDirectory(e,t){return this.root.addDirectory(e,t)}addText(e,t,r){return this.root.addText(e,t,r)}addBlob(e,t,r){return this.root.addBlob(e,t,r)}addData64URI(e,t,r){return this.root.addData64URI(e,t,r)}addUint8Array(e,t,r){return this.root.addUint8Array(e,t,r)}addHttpContent(e,t,r){return this.root.addHttpContent(e,t,r)}addReadable(e,t,r){return this.root.addReadable(e,t,r)}addFileSystemEntry(e,t){return this.root.addFileSystemEntry(e,t)}addFileSystemHandle(e,t){return this.root.addFileSystemHandle(e,t)}addFile(e,t){return this.root.addFile(e,t)}Dt(e,t){return this.root.Dt(e,t)}importBlob(e,t){return ta(this),this.root.importBlob(e,t)}importData64URI(e,t){return ta(this),this.root.importData64URI(e,t)}importUint8Array(e,t){return ta(this),this.root.importUint8Array(e,t)}importHttpContent(e,t){return ta(this),this.root.importHttpContent(e,t)}importReadable(e,t){return ta(this),this.root.importReadable(e,t)}importZip(e,t){return ta(this),this.root.importZip(e,t)}exportBlob(e){return this.root.exportBlob(e)}exportData64URI(e){return this.root.exportData64URI(e)}exportUint8Array(e){return this.root.exportUint8Array(e)}exportWritable(e,t){return this.root.exportWritable(e,t)}exportFileSystemHandle(e,t){return this.root.exportFileSystemHandle(e,t)}exportZip(e,t){return this.root.exportZip(e,t)}isPasswordProtected(){return this.root.isPasswordProtected()}checkPassword(e,t){return this.root.checkPassword(e,t)}},ZipDirectoryEntry:Hi,ZipFileEntry:Zi};function ji(e,r){let n=0;const s=t.from(e);for(;s.length;){const e=s.pop();n+=e[r]||0;for(const t of e.children)s.push(t)}return n}function Ki(e){let t;return()=>{if(t)throw new w(Pi);return t=!0,{readable:e}}}function Yi(e){return class extends Oe{constructor(e,t={}){super(),this.entry=e,this.options=t}async init(){const t=this;t.size=t.entry.uncompressedSize;const n=await t.entry.getData(new Be,r.assign({},e,t.options));t.data=n,t.At=new Ve(n),super.init()}readUint8Array(e,t){return this.At.readUint8Array(e,t)}}}function Gi(e,t,r){return e.prototype?new e(t,r):e(t,r)}async function Xi(e,t){const r=[],n=[e],s=new c;for(;n.length;){const e=n.pop();for(const t of e.children)t.directory?n.push(t):r.push(t)}return await g.all(r.map(async e=>{const r=e.reader=Gi(e.Reader,e.data,t);s.set(e,r);try{await ht(r)}catch(t){try{t.entryId=e.id,t.cause={entry:e}}catch{}throw t}r.size!==ce&&(e.uncompressedSize=r.size)})),s}function Ji(e){if(e.parent){const t=e.parent.children;t.forEach((r,n)=>{r.id==e.id&&t.splice(n,1)})}}function Qi(e){return!!e&&e.message==Wi}function $i(e,t,n){return async function e(t,s,i,a=""){if(s){const c=a?a+"/"+s.name:s.name;try{if((s.isFile||s.isDirectory)&&(s=await ea(s)),"file"==s.kind){const e=await s.getFile();i.push(t.Dt(e.name,{Reader:()=>({readable:e.stream(),size:e.size}),options:r.assign({},{lastModDate:new o(e.lastModified)},n),uncompressedSize:e.size}))}else if("directory"==s.kind){const r=t.addDirectory(s.name);i.push(r);for await(const t of s.values())await e(r,t,i,c)}}catch(e){try{e.entryName===ce&&(e.entryName=c)}catch{}throw e}}return i}(e,t,[])}async function ea(e){const t={name:e.name};if(e.isFile&&(t.kind="file",t.getFile=()=>new g((t,r)=>e.file(t,r))),e.isDirectory){t.kind="directory";const r=await(async e=>{const t=[];function r(e,n,s){e.readEntries(async i=>{if(i.length){for(const e of i)t.push(await ea(e));r(e,n,s)}else n(t)},s)}return await new g((t,n)=>r(e.createReader(),t,n)),{[k.iterator](){let e=0;return{next(){const r={value:t[e],done:e==t.length};return e++,r}}}}})(e);t.values=()=>r}return t}function ta(e){e.entries=[],e.Rt=0,e.root=new Hi(e)}function ra(e,t,r,n){if(e.directory)return n?new Hi(e.fs,t,r,e):new Zi(e.fs,t,r,e);throw new w("Parent entry is not a directory")}e.ERR_ENTRY_EXISTS=Li,e.ERR_READABLE_CONSUMED=Pi,e.fs=qi});
1
+ ((t,e)=>{"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).zip={})})(this,function(t){"use strict";const{Array:e,Object:r,String:n,Number:s,BigInt:i,Math:o,Date:a,Map:c,Set:d,Response:l,URL:u,Error:w,Uint8Array:f,Uint16Array:p,Uint32Array:h,DataView:m,Blob:y,Promise:g,TextEncoder:x,TextDecoder:S,document:b,crypto:z,btoa:F,TransformStream:E,ReadableStream:R,WritableStream:D,CompressionStream:A,DecompressionStream:C,navigator:v,Worker:T,Symbol:k,setTimeout:U,clearTimeout:I,structuredClone:O}="undefined"!=typeof globalThis?globalThis:this||self,M=4294967295,_=65535,N=255,L=67324752,P=134695760,W=P,V=84233040,B=33639248,Z=101010256,H=101075792,q=117853008,j=22,K=20,Y=56,G=39169,X=21589,J=6534,Q=30837,$=30805,tt=2048,et=61440,rt=16384,nt=2048,st=1024,it="/",ot=30,at=new a(2107,11,31,23,59,58),ct=new a(1980,0,1),dt=void 0,lt=1/0,ut="undefined",wt="function",ft="string",pt=new f;let ht=2;try{typeof v!=ut&&v.hardwareConcurrency&&(ht=v.hardwareConcurrency)}catch{}const mt={workerURI:"./core/web-worker-wasm.js",wasmURI:"./core/streams/zlib-wasm/zlib-streams.wasm",chunkSize:65536,maxWorkers:ht,terminateWorkerTimeout:5e3,workerStarvationTimeout:5e3,workerStartupTimeout:5e3,useWebWorkers:!0,useCompressionStream:!0,transferStreams:!0,CompressionStream:typeof A!=ut&&A,DecompressionStream:typeof C!=ut&&C};function yt(){return mt}function gt(t){return o.max(t.chunkSize,64)}function xt(t,e){const r=new f(t.length+e.length);return r.set(t),r.set(e,t.length),r}function St(t){return t.byteOffset||t.byteLength!=t.buffer.byteLength?new f(t):t}function bt(t){return new m(t.buffer,t.byteOffset,t.byteLength)}function zt(t){if(t instanceof R)return t;const e=t.getReader();return new R({async pull(t){const{value:r,done:n}=await e.read();n?t.close():t.enqueue(r)},cancel:t=>e.cancel(t)})}function Ft(t,e){t=zt(t);const r=e?{type:e}:{};if(typeof y.prototype.stream!=wt||new y([]).stream()instanceof R)return new l(t).blob().then(t=>e?new y([t],r):t);const n=[];return t.pipeTo(new D({write(t){n.push(t)}})).then(()=>new y(n,r))}function Et(t){if(t instanceof D)return t;const e=t.getWriter();return new D({write:t=>e.write(t),close:()=>e.close(),abort:t=>e.abort(t)})}const Rt="HTTP error ",Dt="HTTP Range not supported",At="HTTP resource changed",Ct="Content-Range",vt="Range",Tt="GET",kt="bytes",Ut=16777216,It="writable",Ot=k();class Mt{constructor(){this.size=0}init(){this.initialized=!0}}class _t extends Mt{get readable(){return this.createReadable()}createReadable({offset:t=0,size:e,chunkSize:r=gt(yt())}={}){const n=this;let s=0;return new R({async pull(i){const a=e===dt?r:o.min(r,e-s),c=await xe(n,t+s,a);c.length&&i.enqueue(c),s+r>=e||e===dt&&!c.length&&a?i.close():s+=r}})}}class Nt extends Mt{constructor(){super();const t=this,e=new D({write(e){if(!t.initialized)throw new w("Writer not initialized");return t.writeUint8Array(St(e))}});r.defineProperty(t,It,{get:()=>e})}writeUint8Array(){}}class Lt extends _t{constructor(t){super();let e=t.length;for(;"="==t.charAt(e-1);)e--;const n=t.indexOf(",")+1;r.assign(this,{dataURI:t,o:n,size:o.floor(.75*(e-n))})}readUint8Array(t,e){const{o:r,dataURI:n}=this,s=new f(e),i=4*o.floor(t/3),a=atob(n.substring(i+r,4*o.ceil((t+e)/3)+r)),c=t-3*o.floor(i/4);let d=0;for(let t=c;c+e>t&&t<a.length;t++)s[t-c]=a.charCodeAt(t),d++;return d<s.length?s.subarray(0,d):s}}class Pt extends Nt{constructor(t){super(),r.assign(this,{contentType:t,data:"data:"+(t||"")+";base64,",pending:[]})}writeUint8Array(t){const e=this;let r,s=e.pending;const i=e.pending.length;for(e.pending="",r=0;r<3*o.floor((i+t.length)/3)-i;r++)s+=n.fromCharCode(t[r]);for(;r<t.length;r++)e.pending+=n.fromCharCode(t[r]);s.length>2?e.data+=F(s):e.pending=s+e.pending}getData(){return this.data+F(this.pending)}}let Wt,Vt;class Bt extends _t{constructor(t){super(),r.assign(this,{blob:t,size:t.size}),Vt||(Vt=(async()=>{try{const t=new y([new f(3)]).slice(1,2).stream().getReader();let e=0,r=await t.read();for(;!r.done;)e+=r.value.length,r=await t.read();Wt=1==e}catch{Wt=!1}})())}createReadable(t){const{blob:e,size:r}=this,{offset:n=0,size:s=r-n}=t||{};return n||r>s?Wt?zt(e.slice(n,n+s).stream()):super.createReadable(t):zt(e.stream())}async readUint8Array(t,e){const r=this,n=t+e,s=t||n<r.size?r.blob.slice(t,n):r.blob;let i=await s.arrayBuffer();return i.byteLength>e&&(i=i.slice(t,n)),new f(i)}}class Zt extends Mt{constructor(t){super();const e=this,n=new E;r.defineProperty(e,It,{get:()=>n.writable}),e.contentType=t,e.blob=Ft(n.readable,t),e.blob.catch(()=>{})}getData(){return this.blob}}class Ht extends Bt{constructor(t){super(new y([t],{type:"text/plain"}))}}function qt(t){let e=0;for(let r=0;r<t.length;r++){const n=t.charCodeAt(r);128>n?e+=1:2048>n?e+=2:55296>n||n>=57344?e+=3:56320>n&&56320==(64512&t.charCodeAt(r+1))?(e+=4,r++):e+=3}return e}class jt extends Zt{constructor(t){super(t),r.assign(this,{encoding:t,l:!t||"utf-8"==t.toLowerCase()})}async getData(){const{encoding:t,l:e}=this,n=await super.getData();if(n.text&&e)return n.text();{const e=new FileReader;return new g((s,i)=>{r.assign(e,{onload:({target:t})=>s(t.result),onerror:()=>i(e.error)}),e.readAsText(n,t)})}}}class Kt extends _t{constructor(t,e){super(),Gt(this,t,e)}async init(){await Xt(this,ce,se),super.init()}createReadable(t){const e=this,{useRangeHeader:r,forceRangeRequests:n,size:i}=e;if((r||n)&&i!==dt){const{offset:r=0,size:n=i-r}=t||{};if(n>0&&i>r)return((t,e,r)=>{let n,i=e,a=0,c=r;return new R({start:()=>d(),async pull(t){n||await d();const{value:e,done:r}=await n.read();if(r)throw new w(Dt);const s=e.length>a?e.subarray(0,a):e;a-=s.length,c-=s.length,s.length&&t.enqueue(s),a||(await(async()=>{const t=n;n=dt,await t.cancel()})(),c||t.close())},cancel:t=>n&&n.cancel(t)});async function d(){const e=o.min(t.maximumRangeSize,c),r=await ce(Tt,t,re(t,i,e));if(206!=r.status)throw new w(Dt);const d=r.headers.get(Ct);if(d){const t=s(d.trim().split(/[\s-]+/)[1]);if(!s.isNaN(t)&&t!=i)throw new w(Dt)}ee(t,r),te(t,r),i+=e,a=e,n=r.body.getReader()}})(e,r,o.min(n,i-r))}return super.createReadable(t)}readUint8Array(t,e){return Jt(this,t,e,ce,se)}}class Yt extends _t{constructor(t,e){super(),Gt(this,t,e)}async init(){await Xt(this,de,ie),super.init()}readUint8Array(t,e){return Jt(this,t,e,de,ie)}}function Gt(t,e,n){const{preventHeadRequest:s,useRangeHeader:i,forceRangeRequests:o,combineSizeEocd:a,checkResourceChanges:c=!0,maximumRangeSize:d=Ut,fetch:l}=n;delete(n=r.assign({},n)).preventHeadRequest,delete n.useRangeHeader,delete n.forceRangeRequests,delete n.combineSizeEocd,delete n.checkResourceChanges,delete n.maximumRangeSize,delete n.useXHR,delete n.fetch,r.assign(t,{url:e,options:n,preventHeadRequest:s,useRangeHeader:i,forceRangeRequests:o,combineSizeEocd:a,checkResourceChanges:c,maximumRangeSize:d,fetch:l})}async function Xt(t,e,r){const{url:n,preventHeadRequest:s,useRangeHeader:i,forceRangeRequests:o,combineSizeEocd:a}=t;if((t=>{const{baseURI:e}=yt(),{protocol:r}=new u(t,e);return"http:"==r||"https:"==r})(n)&&(i||o)&&(typeof s==ut||s)){const n=await e(Tt,t,re(t,a?-22:void 0)),s=n.headers.get("Accept-Ranges");if(!(o||s&&s.toLowerCase()==kt))throw new w(Dt);{if(a){const e=new f(await n.arrayBuffer());206==n.status&&e.length==j&&(t.h=e)}te(t,n);const s=Qt(n);s===dt?await ae(t,e,r):t.size=s}}else await ae(t,e,r)}async function Jt(t,e,r,n,i){const{useRangeHeader:o,forceRangeRequests:a,h:c,size:d,options:l}=t;if(o||a){if(c&&e==d-j&&r==j)return c;if(d>e&&0!==r){e+r>d&&(r=d-e);const i=await n(Tt,t,re(t,e,r));if(206!=i.status)throw new w(Dt);const o=i.headers.get(Ct);if(o){const t=s(o.trim().split(/[\s-]+/)[1]);if(!s.isNaN(t)&&t!=e)throw new w(Dt)}ee(t,i),te(t,i);const a=new f(await i.arrayBuffer());if(a.length!=r)throw new w(Dt);return a}return pt}{const{data:n}=t;return n||await i(t,l),t.data.subarray(e,e+r)}}function Qt(t){const e=t.headers.get(Ct);if(e){const t=e.trim().split(/\s*\/\s*/)[1];if(t&&"*"!=t){const e=s(t);if(!s.isNaN(e))return e}}}function $t({headers:t}){return{m:t.get("Etag")||dt,lastModified:t.get("Last-Modified")||dt}}function te(t,e){const{checkResourceChanges:r,S:n}=t;r&&!n&&206==e.status&&(t.S=$t(e))}function ee(t,e){const{checkResourceChanges:n,S:s,size:i}=t;if(n){const t=Qt(e);if(t!==dt&&i!==dt&&t!=i)throw new w(At);if(s){const t=$t(e);if(r.entries(s).some(([e,r])=>r!==dt&&t[e]!==dt&&r!=t[e]))throw new w(At)}}}function re(t,e=0,n=1){return r.assign({},ne(t),{[vt]:kt+"="+(0>e?e:e+"-"+(e+n-1))})}function ne({options:t}){const{headers:e}=t;if(e)return k.iterator in e?r.fromEntries(e):e}async function se(t){await oe(t,ce)}async function ie(t){await oe(t,de)}async function oe(t,e){const r=await e(Tt,t,ne(t));t.data=new f(await r.arrayBuffer()),t.size=t.data.length}async function ae(t,e,r){if(t.preventHeadRequest)await r(t,t.options);else{const n=await e("HEAD",t,ne(t)),i=n.headers.get("Content-Length");i&&!n.headers.get("Content-Encoding")?t.size=s(i):await r(t,t.options)}}async function ce(t,{fetch:e=fetch,options:n,url:s},i){const o=await e(s,r.assign({},n,{method:t,headers:i}));if(400>o.status)return o;throw 416==o.status?new w(Dt):new w(Rt+(o.statusText||o.status))}function de(t,{url:e},n){return new g((s,i)=>{const o=new XMLHttpRequest;if(o.addEventListener("load",()=>{if(400>o.status){const t=[];o.getAllResponseHeaders().trim().split(/[\r\n]+/).forEach(e=>{const r=e.trim().split(/\s*:\s*/);r[0]=r[0].trim().replace(/^[a-z]|-[a-z]/g,t=>t.toUpperCase()),t.push(r)}),s({status:o.status,arrayBuffer:()=>o.response,headers:new c(t)})}else i(416==o.status?new w(Dt):new w(Rt+(o.statusText||o.status)))},!1),o.addEventListener("error",t=>i(t.detail?t.detail.error:new w("Network error")),!1),o.open(t,e),n)for(const t of r.entries(n))o.setRequestHeader(t[0],t[1]);o.responseType="arraybuffer",o.send()})}class le extends _t{constructor(t,e={}){super(),r.assign(this,{url:t,reader:e.useXHR&&!e.fetch?new Yt(t,e):new Kt(t,e)})}set size(t){}get size(){return this.reader.size}async init(){await this.reader.init(),super.init()}createReadable(t){return this.reader.createReadable(t)}readUint8Array(t,e){return this.reader.readUint8Array(t,e)}}class ue extends _t{constructor(t){super(),t=new f(t.buffer,t.byteOffset,t.byteLength),r.assign(this,{array:t,size:t.length})}readUint8Array(t,e){return this.array.slice(t,t+e)}}class we extends Nt{constructor(t){super(),this.defaultBufferSize=t||262144}init(t=0){r.assign(this,{offset:0,array:new f(t>0?t:this.defaultBufferSize)}),super.init()}writeUint8Array(t){const e=this,r=e.offset+t.length;if(r>e.array.length){let t=e.array.length?2*e.array.length:e.defaultBufferSize;for(;r>t;)t*=2;const n=e.array;e.array=new f(t),e.array.set(n)}e.array.set(t,e.offset),e.offset+=t.length}getData(){return this.offset===this.array.length?this.array:this.array.slice(0,this.offset)}}class fe extends _t{constructor(t){super(),this.F=t}async init(){const t=this,{F:e}=t;t.R=0,await g.all(e.map(t=>ge(t))),t.D=e.map(e=>{const r=t.size;return t.size+=e.size,r}),super.init()}A(t){const{D:e,size:r}=this,n=e[t];return n===dt?r:n}async readUint8Array(t,e){const r=this,{F:n}=this;let s,i=0,a=t;for(;n[i]&&a>=n[i].size;)a-=n[i].size,i++;const c=n[i];if(c){const n=c.size;if(a+e>n){const i=n-a;s=xt(await xe(c,a,i),await r.readUint8Array(t+i,e-i))}else s=await xe(c,a,e)}else s=pt;return r.R=o.max(i,r.R),s}}class pe extends Mt{constructor(t,e=4294967295){super();const n=this;let s,i,o;r.assign(n,{diskNumber:0,diskOffset:0,size:0,maxSize:e,availableSize:e});const a=new D({async write(e){if(e===Ot)return void(o&&await d());const{availableSize:r}=n;if(o)e.length<r?await c(e):(await c(e.subarray(0,r)),await d(),e.length>r&&await this.write(e.subarray(r)));else{const{value:r,done:a}=await t.next();if(a&&!r)throw new w("Writer iterator completed too soon");s=r,s.size=0,s.maxSize&&(n.maxSize=s.maxSize),n.availableSize=n.maxSize,await ge(s),i=r.writable,o=i.getWriter(),await this.write(e)}},async close(){o&&(await o.ready,await l())},async abort(t){o&&await o.abort(t)}});async function c(t){const e=t.length;e&&(await o.ready,await o.write(t),s.size+=e,n.availableSize-=e)}async function d(){await l(),n.diskOffset+=s.size,n.diskNumber++,o=null,n.availableSize=n.maxSize}async function l(){await o.close()}r.defineProperty(n,It,{get:()=>a})}async closeDisk(){const t=this.writable.getWriter();try{await t.ready,await t.write(Ot)}finally{t.releaseLock()}}}class he{constructor(t){return e.isArray(t)&&(t=new fe(t)),(t instanceof R||typeof t.getReader==wt)&&(t={readable:zt(t)}),t}}class me{constructor(t){return t.writable===dt&&typeof t.next==wt&&(t=new pe(t)),(t instanceof D||typeof t.getWriter==wt)&&(t={writable:Et(t)}),t.size===dt&&(t.size=0),t}}function ye(t){return!(!t||!t.getData)}async function ge(t,e){if(!t.init||t.initialized)return g.resolve();await t.init(e)}function xe(t,e,r){return t.readUint8Array(e,r)}const Se=new c,be=new c;function ze(t){return Se.get(t)}function Fe(t){return be.get(t)}const Ee=[[],[],[],[],[],[],[],[]];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;Ee[0][t]=e}for(let t=0;256>t;t++)for(let e=1;8>e;e++){const r=Ee[e-1][t];Ee[e][t]=r>>>8^Ee[0][255&r]}const[Re,De,Ae,Ce,ve,Te,ke,Ue]=Ee;class Ie{constructor(t){this.C=t||-1}append(t){let e=0|this.C;const r=0|t.length;let n=0;if(r>=8&&t.buffer){const s=new m(t.buffer,t.byteOffset,r),i=r-8;for(;i>=n;n+=8){const t=e^s.getInt32(n,!0),r=s.getInt32(n+4,!0);e=Ue[255&t]^ke[t>>>8&255]^Te[t>>>16&255]^ve[t>>>24&255]^Ce[255&r]^Ae[r>>>8&255]^De[r>>>16&255]^Re[r>>>24&255]}}for(;r>n;n++)e=e>>>8^Re[255&(e^t[n])];this.C=e}get(){return~this.C}}class Oe extends E{constructor(){let t;const e=new Ie;super({transform(t,r){e.append(t),r.enqueue(t)},flush(){const r=new f(4);new m(r.buffer).setUint32(0,e.get()),t.value=r}}),t=this}}function Me(t){if(typeof x==ut){const e=new f((t=unescape(encodeURIComponent(t))).length);for(let r=0;r<e.length;r++)e[r]=t.charCodeAt(r);return e}return(new x).encode(t)}const _e={concat(t,e){if(0===t.length||0===e.length)return t.concat(e);const r=t[t.length-1],n=_e.v(r);return 32===n?t.concat(e):_e.T(e,n,0|r,t.slice(0,t.length-1))},bitLength(t){const e=t.length;if(0===e)return 0;const r=t[e-1];return 32*(e-1)+_e.v(r)},U(t,e){if(32*t.length<e)return t;const r=(t=t.slice(0,o.ceil(e/32))).length;return e&=31,r>0&&e&&(t[r-1]=_e.I(e,t[r-1]&2147483648>>e-1,1)),t},I:(t,e,r)=>32===t?e:(r?0|e:e<<32-t)+1099511627776*t,v:t=>o.round(t/1099511627776)||32,T(t,e,r,n){for(void 0===n&&(n=[]);e>=32;e-=32)n.push(r),r=0;if(0===e)return n.concat(t);for(let s=0;s<t.length;s++)n.push(r|t[s]>>>e),r=t[s]<<32-e;const s=t.length?t[t.length-1]:0,i=_e.v(s);return n.push(_e.I(e+i&31,e+i>32?r:n.pop(),1)),n}},Ne={bytes:{O(t){const e=_e.bitLength(t)/8,r=new f(e);let n;for(let s=0;e>s;s++)3&s||(n=t[s/4]),r[s]=n>>>24,n<<=8;return r},M(t){const e=[];let r,n=0;for(r=0;r<t.length;r++)n=n<<8|t[r],3&~r||(e.push(n),n=0);return 3&r&&e.push(_e.I(8*(3&r),n)),e}}},Le=class{constructor(t){const e=this;e.blockSize=512,e._=[1732584193,4023233417,2562383102,271733878,3285377520],e.N=[1518500249,1859775393,2400959708,3395469782],t?(e.L=t.L.slice(0),e.P=t.P.slice(0),e.W=t.W):e.reset()}reset(){const t=this;return t.L=t._.slice(0),t.P=[],t.W=0,t}update(t){const e=this;"string"==typeof t&&(t=Ne.V.M(t));const r=e.P=_e.concat(e.P,t),n=e.W,s=e.W=n+_e.bitLength(t);if(s>9007199254740991)throw new w("Cannot hash more than 2^53 - 1 bits");const i=new h(r);let o=0;for(let t=e.blockSize+n-(e.blockSize+n&e.blockSize-1);s>=t;t+=e.blockSize)e.B(i.subarray(16*o,16*(o+1))),o+=1;return r.splice(0,16*o),e}Z(){const t=this;let e=t.P;const r=t.L;e=_e.concat(e,[_e.I(1,1)]);for(let t=e.length+2;15&t;t++)e.push(0);for(e.push(o.floor(t.W/4294967296)),e.push(0|t.W);e.length;)t.B(e.splice(0,16));return t.reset(),r}H(t,e,r,n){return t>19?t>39?t>59?t>79?void 0:e^r^n:e&r|e&n|r&n:e^r^n:e&r|~e&n}j(t,e){return e<<t|e>>>32-t}B(t){const r=this,n=r.L,s=e(80);for(let e=0;16>e;e++)s[e]=t[e];let i=n[0],a=n[1],c=n[2],d=n[3],l=n[4];for(let t=0;79>=t;t++){16>t||(s[t]=r.j(1,s[t-3]^s[t-8]^s[t-14]^s[t-16]));const e=r.j(5,i)+r.H(t,a,c,d)+l+s[t]+r.N[o.floor(t/20)]|0;l=d,d=c,c=r.j(30,a),a=i,i=e}n[0]=n[0]+i|0,n[1]=n[1]+a|0,n[2]=n[2]+c|0,n[3]=n[3]+d|0,n[4]=n[4]+l|0}},Pe={importKey:t=>new Pe.K(Ne.bytes.M(t)),Y(t,e,r,n){if(r=r||1e4,0>n||0>r)throw new w("invalid params to pbkdf2");const s=1+(n>>5)<<2;let i,o,a,c,d;const l=new ArrayBuffer(s),u=new m(l);let f=0;const p=_e;for(e=Ne.bytes.M(e),d=1;(s||1)>f;d++){for(i=o=t.encrypt(p.concat(e,[d])),a=1;r>a;a++)for(o=t.encrypt(o),c=0;c<o.length;c++)i[c]^=o[c];for(a=0;(s||1)>f&&a<i.length;a++)u.setInt32(f,i[a]),f+=4}return l.slice(0,n/8)},K:class{constructor(t){const e=this,r=e.G=Le,n=[[],[]];e.X=[new r,new r];const s=e.X[0].blockSize/32;t.length>s&&(t=(new r).update(t).Z());for(let e=0;s>e;e++)n[0][e]=909522486^t[e],n[1][e]=1549556828^t[e];e.X[0].update(n[0]),e.X[1].update(n[1]),e.J=new r(e.X[0])}reset(){const t=this;t.J=new t.G(t.X[0]),t.$=!1}update(t){this.$=!0,this.J.update(t)}digest(){const t=this,e=t.J.Z(),r=new t.G(t.X[1]).update(e).Z();return t.reset(),r}encrypt(t){if(this.$)throw new w("encrypt on already updated hmac called!");return this.update(t),this.digest(t)}}},We=typeof z!=ut&&typeof z.getRandomValues==wt,Ve="Invalid password",Be="Invalid signature",Ze=Be,He="zipjs-abort-check-password";function qe(t){if(We)return z.getRandomValues(t);throw new w("Crypto API not supported")}const je=16,Ke={name:"PBKDF2"},Ye=r.assign({hash:{name:"HMAC"}},Ke),Ge=r.assign({iterations:1e3,hash:{name:"SHA-1"}},Ke),Xe=["deriveBits"],Je=[8,12,16],Qe=[16,24,32],$e=10,tr=[0,0,0,0],er=typeof z!=ut,rr=er&&z.subtle,nr=er&&typeof rr!=ut,sr=Ne.bytes,ir=class{constructor(t){const e=this;e.et=[[[],[],[],[],[]],[[],[],[],[],[]]],e.et[0][0][0]||e.nt();const r=e.et[0][4],n=e.et[1],s=t.length;let i,o,a,c=1;if(4!==s&&6!==s&&8!==s)throw new w("invalid aes key size");for(e.N=[o=t.slice(0),a=[]],i=s;4*s+28>i;i++){let t=o[i-1];(i%s===0||8===s&&i%s===4)&&(t=r[t>>>24]<<24^r[t>>16&255]<<16^r[t>>8&255]<<8^r[255&t],i%s===0&&(t=t<<8^t>>>24^c<<24,c=c<<1^283*(c>>7))),o[i]=o[i-s]^t}for(let t=0;i;t++,i--){const e=o[3&t?i:i-4];a[t]=4>=i||4>t?e:n[0][r[e>>>24]]^n[1][r[e>>16&255]]^n[2][r[e>>8&255]]^n[3][r[255&e]]}}encrypt(t){return this.st(t,0)}decrypt(t){return this.st(t,1)}nt(){const t=this.et[0],e=this.et[1],r=t[4],n=e[4],s=[],i=[];let o,a,c,d;for(let t=0;256>t;t++)i[(s[t]=t<<1^283*(t>>7))^t]=t;for(let l=o=0;!r[l];l^=a||1,o=i[o]||1){let i=o^o<<1^o<<2^o<<3^o<<4;i=i>>8^255&i^99,r[l]=i,n[i]=l,d=s[c=s[a=s[l]]];let u=16843009*d^65537*c^257*a^16843008*l,w=257*s[i]^16843008*i;for(let r=0;4>r;r++)t[r][l]=w=w<<24^w>>>8,e[r][i]=u=u<<24^u>>>8}for(let r=0;5>r;r++)t[r]=t[r].slice(0),e[r]=e[r].slice(0)}st(t,e){if(4!==t.length)throw new w("invalid aes block size");const r=this.N[e],n=r.length/4-2,s=[0,0,0,0],i=this.et[e],o=i[0],a=i[1],c=i[2],d=i[3],l=i[4];let u,f,p,h=t[0]^r[0],m=t[e?3:1]^r[1],y=t[2]^r[2],g=t[e?1:3]^r[3],x=4;for(let t=0;n>t;t++)u=o[h>>>24]^a[m>>16&255]^c[y>>8&255]^d[255&g]^r[x],f=o[m>>>24]^a[y>>16&255]^c[g>>8&255]^d[255&h]^r[x+1],p=o[y>>>24]^a[g>>16&255]^c[h>>8&255]^d[255&m]^r[x+2],g=o[g>>>24]^a[h>>16&255]^c[m>>8&255]^d[255&y]^r[x+3],x+=4,h=u,m=f,y=p;for(let t=0;4>t;t++)s[e?3&-t:t]=l[h>>>24]<<24^l[m>>16&255]<<16^l[y>>8&255]<<8^l[255&g]^r[x++],u=h,h=m,m=y,y=g,g=u;return s}},or=class{constructor(t,e){this.it=t,this.ot=e,this.ct=e}reset(){this.ct=this.ot}update(t){return this.lt(this.it,t,this.ct)}ut(t){if(255&~(t>>24))t+=1<<24;else{let e=t>>16&255,r=t>>8&255,n=255&t;255===e?(e=0,255===r?(r=0,255===n?n=0:++n):++r):++e,t=0,t+=e<<16,t+=r<<8,t+=n}return t}wt(t){0===(t[0]=this.ut(t[0]))&&(t[1]=this.ut(t[1]))}lt(t,e,r){let n;if(!(n=e.length))return[];const s=_e.bitLength(e);for(let s=0;n>s;s+=4){this.wt(r);const n=t.encrypt(r);e[s]^=n[0],e[s+1]^=n[1],e[s+2]^=n[2],e[s+3]^=n[3]}return _e.U(e,s)}},ar=Pe.K;let cr=er&&nr&&typeof rr.importKey==wt,dr=er&&nr&&typeof rr.deriveBits==wt;class lr extends E{constructor({password:t,rawPassword:e,encryptionStrength:r,checkPasswordOnly:n,checkAuthenticationCode:s=!0}){super({start(){wr(this,t,e,r)},async transform(t,e){const r=this,{password:s,strength:i,ft:o,ready:a}=r;s?(await(async(t,e,r,n)=>{const s=await pr(t,e,r,mr(n,0,Je[e])),i=mr(n,Je[e]);if(s[0]!=i[0]||s[1]!=i[1])throw new w(Ve)})(r,i,s,mr(t,0,Je[i]+2)),t=mr(t,Je[i]+2),n?e.error(new w(He)):o()):await a;const c=new f(t.length-$e-(t.length-$e)%je);e.enqueue(fr(r,t,c,0,$e,!0))},async flush(t){const{ht:e,yt:r,pending:n,ready:i}=this;if(r&&e){await i;const o=mr(n,0,n.length-$e),a=mr(n,n.length-$e);let c=pt;if(o.length){const t=gr(sr,o);r.update(t);const n=e.update(t);c=yr(sr,n)}const d=mr(yr(sr,r.digest()),0,$e);let l=n.length<$e?1:0;for(let t=0;$e>t;t++)l|=d[t]^a[t];if(l&&s)throw new w(Ze);t.enqueue(c)}}})}}class ur extends E{constructor({password:t,rawPassword:e,encryptionStrength:r}){super({start(){wr(this,t,e,r)},async transform(t,e){const r=this,{password:n,strength:s,ft:i,ready:o}=r;let a=pt;n?(a=await(async(t,e,r)=>{const n=qe(new f(Je[e]));return xt(n,await pr(t,e,r,n))})(r,s,n),i()):await o;const c=new f(a.length+t.length-t.length%je);c.set(a,0),e.enqueue(fr(r,t,c,a.length,0))},async flush(t){const{ht:e,yt:r,pending:n,ready:s}=this;if(r&&e){await s;let i=pt;if(n.length){const t=e.update(gr(sr,n));r.update(t),i=yr(sr,t)}const o=yr(sr,r.digest()).slice(0,$e);t.enqueue(xt(i,o))}}})}}function wr(t,e,n,s){r.assign(t,{ready:new g(e=>t.ft=e),password:hr(e,n),strength:s-1,pending:pt})}function fr(t,e,r,n,s,i){const{ht:o,yt:a,pending:c}=t;c.length&&(e=xt(c,e));const d=e.length-s;let l;for(r=((t,e)=>{if(e&&e>t.length){const r=t;(t=new f(e)).set(r,0)}return t})(r,n+(d-d%je)),l=0;d-je>=l;l+=je){const t=gr(sr,mr(e,l,l+je));i&&a.update(t);const s=o.update(t);i||a.update(s),r.set(yr(sr,s),l+n)}return t.pending=mr(e,l),r}async function pr(t,n,s,i){t.password=null;const o=await(async(t,e,r,n,s)=>{if(!cr)return Pe.importKey(e);try{return await rr.importKey("raw",e,r,!1,s)}catch{return cr=!1,Pe.importKey(e)}})(0,s,Ye,0,Xe),a=await(async(t,e,r)=>{if(!dr)return Pe.Y(e,t.salt,Ge.iterations,r);try{return await rr.deriveBits(t,e,r)}catch{return dr=!1,Pe.Y(e,t.salt,Ge.iterations,r)}})(r.assign({salt:i},Ge),o,8*(2*Qe[n]+2)),c=new f(a),d=gr(sr,mr(c,0,Qe[n])),l=gr(sr,mr(c,Qe[n],2*Qe[n])),u=mr(c,2*Qe[n]);return r.assign(t,{keys:{key:d,gt:l,passwordVerification:u},ht:new or(new ir(d),e.from(tr)),yt:new ar(l)}),u}function hr(t,e){return e===dt?Me(t):e}function mr(t,e,r){return t.subarray(e,r)}function yr(t,e){return t.O(e)}function gr(t,e){return t.M(e)}class xr extends E{constructor({password:t,rawPassword:e,passwordVerification:r,checkPasswordOnly:n}){super({start(){br(this,t,e,r)},transform(t,e){const r=this;if(r.password||r.rawPassword){const e=zr(r,t.subarray(0,12));if(r.password=r.rawPassword=null,0!=(e[11]^r.passwordVerification))throw new w(Ve);t=t.subarray(12)}n?e.error(new w(He)):e.enqueue(zr(r,t))}})}}class Sr extends E{constructor({password:t,rawPassword:e,passwordVerification:r}){super({start(){br(this,t,e,r)},transform(t,e){const r=this;let n,s;if(r.password||r.rawPassword){r.password=r.rawPassword=null;const e=qe(new f(12));e[11]=r.passwordVerification,n=new f(t.length+e.length),n.set(Fr(r,e),0),s=12}else n=new f(t.length),s=0;n.set(Fr(r,t),s),e.enqueue(n)}})}}function br(t,e,n,s){r.assign(t,{password:e,rawPassword:n,passwordVerification:s}),((t,e,n)=>{const s=[305419896,591751049,878082192];if(r.assign(t,{keys:s,xt:new Ie(s[0]),St:new Ie(s[2])}),n)for(let e=0;e<n.length;e++)Er(t,n[e]);else for(let r=0;r<e.length;r++)Er(t,e.charCodeAt(r))})(t,e,n)}function zr(t,e){const r=new f(e.length);for(let n=0;n<e.length;n++)r[n]=Rr(t)^e[n],Er(t,r[n]);return r}function Fr(t,e){const r=new f(e.length);for(let n=0;n<e.length;n++)r[n]=Rr(t)^e[n],Er(t,e[n]);return r}function Er(t,e){let[,r]=t.keys;t.xt.append([e]);const n=~t.xt.get();r=Ar(o.imul(Ar(r+Dr(n)),134775813)+1),t.St.append([r>>>24]);const s=~t.St.get();t.keys=[n,r,s]}function Rr(t){const e=2|t.keys[2];return Dr(o.imul(e,1^e)>>>8)}function Dr(t){return 255&t}function Ar(t){return 4294967295&t}const Cr="Invalid uncompressed size",vr="Invalid compressed data",Tr=Be,kr="deflate-raw",Ur="gzip",Ir=[31,139,8];class Or extends E{constructor(t,{chunkSize:e,CompressionStreamFallback:r,CompressionStream:n}){super({});const{compressed:s,encrypted:i,useCompressionStream:o,zipCrypto:a,computeCrc32:c,level:d,deflate64:l,format:u,compressionMethod:w}=t,f=this;let p,h,y,g=super.readable;const x=u&&Fe(u),S=c&&s&&!l&&!x&&(!i||a)&&!(!o||!n);if(i&&!a||!c||S||(p=new Oe,g=Zr(g,p)),s)if(x)g=Hr(g,Vr(x.CompressionStream,u,{level:d,chunkSize:e,compressionMethod:w}));else if(S)y=new Mr,g=Hr(g,new n(Ur)),g=Zr(g,y);else try{g=Br(g,o,{level:d,chunkSize:e},n,r)}catch(t){let e;try{e=new n(Ur)}catch{throw t}g=Hr(g,e),g=Zr(g,new Mr)}i&&(a?g=Zr(g,new Sr(t)):(h=new ur(t),g=Zr(g,h))),Wr(f,g,()=>{i&&!a||!c||(f.crc32=S?y.crc32:new m(p.value.buffer).getUint32(0))})}}class Mr extends E{constructor(){let t,e=10,r=new f(0);super({transform(t,n){if(e){const r=o.min(e,t.length);if(e-=r,!(t=t.subarray(r)).length)return}const s=r.length+t.length;if(8>=s)return void(r=xt(r,t));const i=s-8,a=o.min(i,r.length);n.enqueue(xt(r.subarray(0,a),t.subarray(0,i-a))),r=xt(r.subarray(a),t.subarray(i-a))},flush(){const e=bt(r);t.crc32=e.getUint32(0,!0),t.uncompressedSize=e.getUint32(4,!0)}}),t=this}}class _r extends E{constructor(t,{chunkSize:e,DecompressionStreamFallback:r,DecompressionStream:n}){super({});const{zipCrypto:s,encrypted:i,checkCrc32:o,crc32:a,compressed:c,useCompressionStream:d,deflate64:l,format:u,compressionMethod:p,rawBitFlag:h,outputSize:y}=t;let x,S,b=super.readable;if(i&&(s?b=Zr(b,new xr(t)):(S=new lr(t),b=Zr(b,S))),c){const t=u&&Fe(u);if(t)b=Hr(b,Vr(t.DecompressionStream,u,{chunkSize:e,compressionMethod:p,rawBitFlag:h,uncompressedSize:y}));else try{b=Br(b,d,{chunkSize:e,deflate64:l},n,r)}catch(t){if(l||y===dt)throw t;let e;try{e=new n(Ur)}catch{throw t}b=((t,e,r)=>{const n=new Ie;let s,i,o,a=0,c=!1;const d=new g((t,e)=>{i=t,o=e});d.catch(()=>{}),r||i();const l=new E({start(t){const e=new f(10);e.set(Ir),t.enqueue(e)},transform(t,e){e.enqueue(t)},async flush(t){c=!0,p();try{await d}finally{h()}const e=new f(8),s=bt(e);s.setUint32(0,n.get(),!0),s.setUint32(4,r,!0),t.enqueue(e)},cancel(t){o(t)}}),u=new E({transform(t,e){n.append(t),a+=t.length,r>a?c&&p():i(),e.enqueue(t)},cancel(t){o(t)}});return t=Zr(t,l),Zr(t=Hr(t,e),u);function p(){h(),s=U(()=>o(new w(Cr)),5e3)}function h(){I(s)}})(b,e,y)}b=(t=>{const e=t.getReader();return new R({async pull(t){let r;try{r=await e.read()}catch(t){if(t&&t.message)throw t;const e=new w(vr);throw e.cause=t,e}const{value:n,done:s}=r;s?t.close():t.enqueue(n)},cancel:t=>e.cancel(t)})})(b)}o&&(x=new Oe,b=Zr(b,x)),Wr(this,b,()=>{if(o){const t=new m(x.value.buffer);if(a!=t.getUint32(0,!1))throw new w(Tr)}})}}const Nr=new c;function Lr(t,e){if(!t)return!1;let r=Nr.get(t);r||(r=new c,Nr.set(t,r));let n=r.get(e);if(n===dt){try{new t(e),n=!0}catch{n=!1}r.set(e,n)}return n}function Pr(t){return Lr(t,kr)}function Wr(t,e,n){e=Zr(e,new E({flush:n})),r.defineProperty(t,"readable",{get:()=>e})}function Vr(t,e,r){if(!t)throw new w("Compression method not supported");return new t(e,r)}function Br(t,e,r,n,s){const i=e&&n?n:s||n,o=r.deflate64?"deflate64-raw":kr;let a;try{a=new i(o,r)}catch(t){if(!e||!s||i==s)throw t;a=new s(o,r)}return Hr(t,a)}function Zr(t,e){return zt(t).pipeThrough(e)}function Hr(t,e){const r=e.writable.getWriter(),n=t.getReader();return(async()=>{try{for(;;){await r.ready;const t=await n.read();if(t.done){await r.close();break}await r.write(t.value)}}catch(t){await(async(t,e)=>{try{await t.abort(e)}catch{}})(r,t),await(async(t,e)=>{try{await t.cancel(e)}catch{}})(n,t)}})(),e.readable}const qr="deflate",jr="inflate";class Kr extends E{constructor(t,e){super({});const n=this,{codecType:s}=t;let i;s.startsWith(qr)?i=Or:s.startsWith(jr)&&(i=_r),n.outputSize=0;let o=0;const a=new i(t,e),c=super.readable,d=new E({transform(t,e){t&&t.length&&(o+=t.length,e.enqueue(t))},flush(){r.assign(n,{inputSize:o})}}),l=new E({transform(e,r){if(e&&e.length&&(r.enqueue(e),n.outputSize+=e.length,t.outputSize!==dt&&n.outputSize>t.outputSize))throw new w(Cr)},flush(){const{crc32:t}=a;r.assign(n,{crc32:t,inputSize:o})}});r.defineProperty(n,"readable",{get:()=>c.pipeThrough(d).pipeThrough(a).pipeThrough(l)})}}class Yr extends E{constructor(t){const e=[];let r=0;function n(){const n=new f(t);let s=0;for(;t>s;){const r=e[0],i=t-s;r.length>i?(n.set(r.subarray(0,i),s),e[0]=r.subarray(i),s+=i):(n.set(r,s),s+=r.length,e.shift())}return r-=t,n}s.isFinite(t)&&t>=1||(t=65536),super({transform(s,i){for(e.push(s),r+=s.length;r>t;)i.enqueue(n())},flush(t){r&&t.enqueue(((t,e)=>{const r=new f(e);let n=0;for(const e of t)r.set(e,n),n+=e.length;return r})(e,r))}})}}async function Gr(t){const{CompressionStream:e,CompressionStreamFallback:r}=t;if(r&&!r.bt)return!0;if(Pr(e)||Lr(e,Ur))return!0;if(r)try{return await void 0,!0}catch{return!1}return!1}class Xr{constructor(t,{readable:e,writable:n},{options:s,config:i,zt:o,useWebWorkers:a,transferStreams:c,workerURI:d,createWorker:l},u){const{signal:w}=o;return r.assign(t,{Ft:!0,Et:(t.Et||0)+1,readable:e.pipeThrough(new Yr(gt(i))).pipeThrough(new Jr(o),{signal:w}),writable:n,options:r.assign({},s),workerURI:d,createWorker:l,transferStreams:c,terminate:()=>new g(e=>{const{Rt:r,Ft:n}=t;r?(n?t.Dt=e:(r.terminate(),e()),t.At=null):e()}),Ct(){if(t.Ft){const{Dt:e}=t;e&&(t.Dt=null,t.vt=!0,t.Rt.terminate(),e()),t.Ft=!1,u(t)}}}),((t,e)=>({run:()=>(async({options:t,readable:e,writable:r,Ct:n},s)=>{let i;try{if(t.compressed&&!t.format){const e=t.codecType.startsWith(qr),r=e?s.CompressionStreamFallback:s.DecompressionStreamFallback,n=e?s.CompressionStream:s.DecompressionStream;if(t.useCompressionStream){if(r&&r.bt&&!Pr(n))try{await void 0}catch{}}else try{await void 0}catch{r&&!r.bt||(t.useCompressionStream=!0)}}i=new Kr(t,s),await e.pipeThrough(i).pipeThrough(new Yr(gt(s))).pipeTo(r,{preventClose:!0,preventAbort:!0});const{crc32:n,inputSize:o,outputSize:a}=i;return{crc32:n,inputSize:o,outputSize:a}}catch(t){throw i&&(t.outputSize=i.outputSize),t}finally{n()}})(t,e)}))(t,i)}}class Jr extends E{constructor({onstart:t,onprogress:e,size:r,onend:n}){let s=0;super({async start(){t&&await Qr(t,r)},async transform(t,n){s+=t.length,e&&await Qr(e,s,r),n.enqueue(t)},async flush(){n&&await Qr(n,s)}})}}async function Qr(t,...e){try{await t(...e)}catch{}}let $r=[];const tn=[];let en,rn,nn=0;async function sn(t,e){const{options:r,config:n}=e,{transferStreams:i,useWebWorkers:o,useCompressionStream:a,compressed:c,checkCrc32:d,computeCrc32:l,encrypted:f,format:p,codecURI:h}=r,{workerURI:m,createWorker:y,maxWorkers:x}=n;p&&(h&&(r.codecURI=((t,e)=>{try{return new u(t,e).toString()}catch{return t}})(h,n.baseURI)),await(async(t,e)=>{!be.has(t)&&e&&((t,e)=>{const{CompressionStream:r,DecompressionStream:n}=e;if(typeof r!=wt&&typeof n!=wt)throw new w("Invalid codec module");be.set(t,{CompressionStream:r,DecompressionStream:n})})(t,await(import(/* webpackIgnore: true */ /* @vite-ignore */e)))})(p,r.codecURI)),e.transferStreams=!p&&(i||i===dt&&n.transferStreams);const S=!(c||d||l||f),b=p===dt||!!r.codecURI;return e.useWebWorkers=!S&&b&&(o||o===dt&&n.useWebWorkers),e.workerURI=e.useWebWorkers&&m?m:dt,e.createWorker=e.useWebWorkers&&y?y:dt,r.useCompressionStream=a||a===dt&&n.useCompressionStream,(await(async()=>{const r=$r.find(t=>!t.Ft);if(r)return ln(r),new Xr(r,t,e,z);if($r.length<x){const r={Tt:nn};return nn++,$r.push(r),new Xr(r,t,e,z)}return new g(r=>{tn.push({resolve:r,stream:t,kt:e}),rn=n.workerStarvationTimeout,on()})})()).run();function z(t){if(an(),tn.length){const[{resolve:e,stream:r,kt:n}]=tn.splice(0,1);e(new Xr(t,r,n,z)),on()}else t.Rt?(ln(t),((t,e)=>{const{config:r}=e,{terminateWorkerTimeout:n}=r;s.isFinite(n)&&n>=0&&(t.vt?t.vt=!1:t.Ut=U(async()=>{$r=$r.filter(e=>e!=t);try{await t.terminate()}catch{}},n))})(t,e)):$r=$r.filter(e=>e!=t)}}function on(){!en&&tn.length&&s.isFinite(rn)&&rn>=0&&(en=U(cn,rn))}function an(){en&&(I(en),en=null)}function cn(){if(en=null,tn.length){const[{resolve:t,stream:e,kt:n}]=tn.splice(0,1),s=r.assign({},n,{useWebWorkers:!1,workerURI:dt,createWorker:dt});t(new Xr({},e,s,dn)),on()}}function dn(){an(),on()}function ln(t){const{Ut:e}=t;e&&(I(e),t.Ut=null)}const un="\0☺☻♥♦♣♠•◘○◙♂♀♪♫☼►◄↕‼¶§▬↨↑↓→←∟↔▲▼ !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~⌂ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜ¢£¥₧ƒáíóúñѪº¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ ".split("");function wn(t,e){return e&&"cp437"==e.trim().toLowerCase()?(t=>{{let e="";for(let r=0;r<t.length;r++)e+=un[t[r]];return e}})(t):new S(e,{ignoreBOM:!0}).decode(t)}const fn="filename",pn="rawFilename",hn="comment",mn="rawComment",yn="uncompressedSize",gn="compressedSize",xn="offset",Sn="diskNumberStart",bn="lastModDate",zn="rawLastModDate",Fn="lastAccessDate",En="rawLastAccessDate",Rn="creationDate",Dn="rawCreationDate",An="internalFileAttributes",Cn="externalFileAttributes",vn="internalFileAttribute",Tn="externalFileAttribute",kn="msdosAttributesRaw",Un="msdosAttributes",In="msDosCompatible",On="zip64",Mn="encrypted",_n="version",Nn="versionMadeBy",Ln="zipCrypto",Pn="directory",Wn="executable",Vn="compressionMethod",Bn="signature",Zn="extraField",Hn="unixMode",qn="setuid",jn="setgid",Kn="sticky",Yn=[fn,pn,yn,gn,bn,zn,hn,mn,Fn,En,Rn,Dn,xn,Sn,An,Cn,vn,Tn,kn,Un,In,On,Mn,_n,Nn,Ln,Pn,Wn,"symlink",Vn,Bn,"crc32",Zn,"extraFieldUnix","extraFieldInfoZip","extraFieldUnixType1","extraFieldPkwareUnix","uid","gid",Hn,qn,jn,Kn,"bitFlag","filenameUTF8","commentUTF8","rawExtraField","extraFieldZip64","extraFieldUnicodePath","extraFieldUnicodeComment","extraFieldAES","extraFieldNTFS","extraFieldExtendedTimestamp","extraFieldUSDZ"];class Gn{constructor(t){Yn.forEach(e=>this[e]=t[e])}}const Xn="password",Jn="rawPassword",Qn="passThrough",$n="signal",ts="checkAmbiguity",es="useWebWorkers",rs="useCompressionStream",ns="transferStreams",ss="preventClose",is="offset",os="usdz",as="strictness",cs="signCentralDirectory",ds="filename",ls="comment",us="strict",ws="balanced",fs="tolerant",ps="File format is not recognized",hs="End of central directory not found",ms="End of Zip64 central directory locator not found",ys="Central directory header not found",gs="Local file header not found",xs="Zip64 extra field not found",Ss="File contains encrypted entry",bs="Encryption method not supported",zs="Compression method not supported",Fs="Split zip file",Es="Overlapping entry found",Rs="Ambiguous archive",Ds="Encrypted central directory is not supported",As="Unsafe filename",Cs="Invalid strictness (must be 'strict', 'balanced' or 'tolerant')",vs="Invalid filenameValidation (must be 'strict', 'balanced' or 'tolerant')",Ts="Invalid maxAppendedDataSize (must be a number greater than or equal to 0)",ks=/^[a-zA-Z]:/,Us="utf-8",Is="cp437",Os=[[yn,M],[gn,M],[xn,M],[Sn,_]],Ms={[_]:{It:ii,bytes:4},[M]:{It:oi,bytes:8}};class _s{constructor(t,e={}){r.assign(this,{reader:new he(t),options:e,config:yt(),Ot:new c})}async*getEntriesGenerator(t={}){const e=this;let{reader:n}=e;const{config:i}=e;if(await ge(n),n.size!==dt&&n.readUint8Array||(n=new Bt(await Ft(n.readable)),await ge(n)),n.size<j)throw new w(ps);const a=Ks(ti(e,t,as),ti(e,t,ts)),c=a==us,l=a!=fs,u=((t,e)=>{if(t!==dt){const e=typeof(r=t)==ft&&r.trim()?s(r):r;if("number"!=typeof e||s.isNaN(e)||0>e)throw new w(Ts);return e}var r;return e==us?0:e==fs?1/0:_})(ti(e,t,"maxAppendedDataSize"),a),f=((t,e)=>{if(t===dt)return e;if(!js(t))throw new w(vs);return t})(ti(e,t,"filenameValidation"),a),p=ti(e,t,"normalizeFilename"),{Mt:h,_t:m}=await(async(t,e,r)=>{const{size:n}=t,s=o.min(n,65557),i={count:64};let a,c,d=0;for await(const[r,o,l,u,w]of Gs(t,s)){const s=si(r,u+20);if(w+j+s==n){const s=await Js(t,r,o,u,w,n,i);if(2==s){if(a||(a=Xs(l,u,w)),d++,!e||d>1)break}else 1!=s||c||(c=Xs(l,u,w))}}return a||(a=c),a||(a=await(async(t,e,r)=>{const{size:n}=t,s=o.min(n,e==1/0?n:65557+e);let i,a;for await(const[e,o,c,d,l]of Gs(t,s)){const s=Xs(c,d,l);i||(i=s);const u=await Js(t,e,o,d,l,n,r);if(2==u)return s;1!=u||a||(a=s)}return a||i})(t,r,i)),{Mt:a,_t:d}})(n,l,u);if(!h)throw ii(bt(await xe(n,0,4)))==P?new w(Fs):new w(hs);l&&m>1&&$s("multiple end of central directory records");const y=bt(h);let g=ii(y,12),x=ii(y,16);const S=h.offset,b=si(y,20),z=S+j+b;n.size-z>u&&$s("appended data");let F=si(y,4);const R=n.R||0;let D,A,C,v,T=si(y,6),k=si(y,10),U=0;const I=x==M||g==M||k==_||T==_;if(x!=M&&T!=_&&(x+=qs(n,T)),I){const t=h.offset<K?pt:await xe(n,h.offset-K,K),e=bt(t);if(t.length==K&&ii(e,0)==q){x=qs(n,ii(e,4))+oi(e,8);let t=await xe(n,x,Y),i=bt(t);const a=h.offset-K-Y;if((t.length<Y||ii(i,0)!=H)&&x!=a&&a>=0){const e=x;x=a,x>e&&(U=x-e),t=await xe(n,x,Y),i=bt(t)}if(t.length<Y||ii(i,0)!=H)throw new w(ms);if(A=!0,C=oi(i,4)>44,C){const t=o.min(s(oi(i,4))-44,n.size-x-Y);t>0&&(v=(t=>{const e={rawExtensibleData:t};if(t.length>=28){const n=bt(t),i=si(n,26);r.assign(e,{compressionMethod:si(n,0),compressedSize:s(oi(n,2)),uncompressedSize:s(oi(n,10)),encryptionAlgorithm:si(n,18),bitLength:si(n,20),flags:si(n,22),hashAlgorithm:si(n,24),hashData:t.subarray(28,28+i)})}return e})(await xe(n,x+Y,t)))}F==_?F=ii(i,16):c&&F!=ii(i,16)&&$s("mismatched zip64 end of central directory record"),T==_?T=ii(i,20):c&&T!=ii(i,20)&&$s("mismatched zip64 end of central directory record"),k==_?k=oi(i,32):c&&k!=oi(i,32)&&$s("mismatched zip64 end of central directory record"),g==M?g=oi(i,40):c&&g!=oi(i,40)&&$s("mismatched zip64 end of central directory record"),x=qs(n,T)+oi(i,48)+U}}let O=g;const L=h.offset-(A?76:0);if(x<n.size||(U=n.size-x-g-j,x=n.size-g-j),R!=F)throw new w(Fs);if(0>x)throw new w(ps);let W=0,Z=await xe(n,x,g),G=bt(Z);if(g){if(4>Z.length)throw new w(ps);const t=L-g;if(x!=t&&T==F){let e=!(ii(G,W)==B);if(e||0>t||t+4>n.size||(e=ii(bt(await xe(n,t,4)),0)==B),e){const e=x;x=t,x>e&&(U+=x-e),Z=await xe(n,x,g),G=bt(Z)}}}const X=L-x;if(g==X||0>X||T!=F||(g=X,Z=await xe(n,x,g),G=bt(Z)),0>x||x>=n.size)throw new w(ps);e.directoryOffset=x,e.directoryLength=O;const J=ti(e,t,"decryptCentralDirectory");let Q;J&&k&&Z.length>=4&&ii(G,0)!=B&&(C||Ls(G))&&(Z=await J(Z,v),G=bt(Z),O=Z.length,Q=!0),D=x;const $=ti(e,t,"filenameEncoding"),tt=ti(e,t,"commentEncoding"),ot=c?new d:dt;let at;for(let s=0;k>s;s++){const a=new Ns(n,i,e.options);if(W+46>Z.length||ii(G,W)!=B){if(0==s&&!Q&&(C||Ls(G)))throw new w(Ds);throw new w(ys)}Ps(a,G,W+6);const d=!!a.bitFlag.languageEncodingFlag,l=W+46,u=l+a.filenameLength,h=u+a.extraFieldLength,m=si(G,W+4),y=!(m>>8),g=m>>8==3,x=Z.subarray(l,u),S=si(G,W+32),b=h+S,z=Z.subarray(h,b),F=d,R=d,A=ii(G,W+38),v=A&N,T={readOnly:!!(1&v),hidden:!!(2&v),system:!!(4&v),directory:!!(16&v),archive:!!(32&v)},I=ii(G,W+42),O=ti(e,t,"decodeText")||wn,M=F?Us:$||Is,L=R?Us:tt||Is;let P=O(x,M,ds);if(P===dt&&(P=wn(x,M)),p){const t=p(P);t!==dt&&(P=t)}if(Ys(P,f)){const t=new w(As);throw t.filename=P,t}let V=O(z,L,ls);V===dt&&(V=wn(z,L)),r.assign(a,{index:s,versionMadeBy:m,msDosCompatible:y,compressedSize:0,uncompressedSize:0,Nt:S,offset:I,diskNumberStart:si(G,W+34),internalFileAttributes:si(G,W+36),externalFileAttributes:A,msdosAttributesRaw:v,msdosAttributes:T,rawFilename:x,filenameUTF8:F,commentUTF8:R,rawExtraField:Z.subarray(u,h),rawComment:z,filename:P,comment:V}),Ws(a,a,G,W+6),a.offset+=U,D=o.min(qs(n,a.diskNumberStart)+a.offset,D),c&&(ot.has(a.filename)&&(at=!0),ot.add(a.filename));const H=a.externalFileAttributes>>16&_;a.unixMode===dt&&16877&H&&(a.unixMode=H);const q=!!(a.unixMode&nt),j=!!(a.unixMode&st),K=!!(512&a.unixMode),Y=40960==((a.unixMode===dt?H:a.unixMode)&et),X=!Y&&(a.unixMode!==dt?!!(73&a.unixMode):g&&!!(73&H)),J=a.unixMode!==dt&&(a.unixMode&et)==rt,ct=(H&et)==rt;r.assign(a,{setuid:q,setgid:j,sticky:K,symlink:Y,unixExternalUpper:H,internalFileAttribute:a.internalFileAttributes,externalFileAttribute:a.externalFileAttributes,executable:X,directory:J||ct||y&&T.directory||a.filename.endsWith(it)&&!a.uncompressedSize,zipCrypto:a.encrypted&&!a.extraFieldAES});const lt=new Gn(a);lt.getData=(t,r)=>a.getData(t,lt,e.Ot,r),lt.arrayBuffer=async t=>{const r=new E,n=Ft(r.readable).then(t=>t.arrayBuffer());return n.catch(()=>{}),await a.getData(r,lt,e.Ot,t),n},W=b;const{onprogress:ut}=t;if(ut)try{await ut(s+1,k,new Gn(a))}catch{}yield lt}let ct=W;if(W+6<=Z.length&&ii(G,W)==V){const t=si(G,W+4);W+6+t>Z.length||(e.digitalSignature=Z.subarray(W+6,W+6+t),ct=W+6+t)}c&&W!=O&&ct!=O&&$s("trailing central directory data"),at&&$s("duplicate filename"),c&&(U||k&&D>0)&&$s("prepended data");const lt=ti(e,t,"extractPrependedData"),ut=ti(e,t,"extractAppendedData");return lt&&(e.prependedData=D>0?await xe(n,0,D):pt),e.comment=b?await xe(n,S+j,b):pt,ut&&(e.appendedData=z<n.size?await xe(n,z,n.size-z):pt),!0}async getEntries(t={}){const e=[];for await(const r of this.getEntriesGenerator(t))e.push(r);return e}async close(){const{reader:t}=this;t.readUint8Array||!t.readable||t.readable.locked||await t.readable.cancel()}}let Ns=class{constructor(t,e,n){r.assign(this,{reader:t,config:e,options:n})}async getData(t,e,r,n={}){const s=this,{reader:i,index:o,offset:a,diskNumberStart:c,extraFieldAES:d,extraFieldZip64:l,compressionMethod:u,config:f,bitFlag:p,rawBitFlag:h,crc32:m,rawLastModDate:y,uncompressedSize:g,compressedSize:x}=s,{dataDescriptor:S}=p,b=e.localDirectory={},z=qs(i,c)+a,F=await xe(i,z,ot),E=bt(F);let R=ti(s,n,Xn),A=ti(s,n,Jn);const C=ti(s,n,Qn);if(R=R&&R.length&&R,A=A&&A.length&&A,d&&99!=d.originalCompressionMethod)throw new w(zs);if(F.length<ot||ii(E,0)!=L)throw new w(gs);Ps(b,E,4);const{extraFieldLength:v,filenameLength:T}=b,k=Ks(ti(s,n,as),ti(s,n,ts))==us;let U=pt;if(k&&(T||v)){const t=await xe(i,z+ot,T+v);U=t.subarray(0,T),b.rawExtraField=t.subarray(T)}else b.rawExtraField=v?await xe(i,z+ot+T,v):pt;Ws(s,b,E,4,!0),k&&((t,e,r)=>{const{rawFilename:n}=t;(r.length!=n.length||r.some((t,e)=>t!=n[e]))&&$s("mismatched local file header (filename)"),(2057&e.rawBitFlag)!=(2057&t.rawBitFlag)&&$s("mismatched local file header (general purpose bit flag)"),e.compressionMethod!=t.compressionMethod&&$s("mismatched local file header (compression method)"),e.bitFlag.dataDescriptor||!(e.crc32||e.compressedSize||e.uncompressedSize)||e.crc32==t.crc32&&e.compressedSize==t.compressedSize&&e.uncompressedSize==t.uncompressedSize||$s("mismatched local file header (crc32 or sizes)")})(s,b,U);const{lastAccessDate:I,creationDate:O}=b;I&&(e.lastAccessDate=I),O&&(e.creationDate=O);const M=s.encrypted&&b.encrypted&&!C,_=M&&!d;if(C||(e.zipCrypto=_),M&&!(64&~b.rawBitFlag))throw new w(bs);const P=C?dt:ze(u);if(0!=u&&8!=u&&9!=u&&!P&&!C)throw new w(zs);if(M){if(!_&&(1>d.strength||d.strength>3))throw new w(bs);if(!R&&!A)throw new w(Ss)}const V=z+ot+T+v,B=x,Z=zt(i.createReadable({offset:V,size:B})),H=ti(s,n,$n),q=ti(s,n,"checkPasswordOnly");let j=ti(s,n,"checkOverlappingEntry");const K=ti(s,n,"checkOverlappingEntryOnly");K&&(j=!0);const{onstart:Y,onprogress:G,onend:X}=n,J=9==u;let Q=ti(s,n,rs);J&&(Q=!1);const $=ti(s,n,"checkCrc32"),tt=($===dt?ti(s,n,"checkSignature"):$)&&!C&&(!M||_||d&&1==d.vendorVersion),et={options:{codecType:jr,password:R,rawPassword:A,zipCrypto:_,encryptionStrength:d&&d.strength,checkCrc32:tt,checkAuthenticationCode:ti(s,n,"checkAuthenticationCode"),passwordVerification:_&&(S?y>>>8&N:m>>>24&N),outputSize:C?x:g,crc32:m,compressed:0!=u&&!C,encrypted:M,useWebWorkers:ti(s,n,es),useCompressionStream:Q,transferStreams:ti(s,n,ns),deflate64:J,format:P?P.format:dt,codecURI:P?P.codecURI:dt,compressionMethod:u,rawBitFlag:h,checkPasswordOnly:q},config:f,zt:{signal:H,size:B,onstart:Y,onprogress:G,onend:X}};let rt,nt;j&&await(async({reader:t,Lt:e,index:r,offset:n,crc32:s,compressedSize:i,uncompressedSize:o,Pt:a,dataDescriptor:c,extraFieldZip64:d,Ot:l})=>{let u=0;if(c&&(u=d?20:12),u){const r=await xe(t,a+i,u+4);if(r.length==u+4&&ii(bt(r),0)==W){const t=ii(bt(r),4);let n,a;d?(n=oi(bt(r),8),a=oi(bt(r),16)):(n=ii(bt(r),8),a=ii(bt(r),12)),(e.encrypted&&!e.zipCrypto||t==s)&&n==i&&a==o&&(u+=4)}}const f={start:n,end:a+i+u,Lt:e};for(const[t,e]of l)if(t!=r&&f.start<e.end&&e.start<f.end){const t=new w(Es);throw t.Wt=e.Lt,t}l.set(r,f)})({reader:i,Lt:e,index:o,offset:z,crc32:m,compressedSize:x,uncompressedSize:g,Pt:V,dataDescriptor:S||b.bitFlag.dataDescriptor,extraFieldZip64:l||b.extraFieldZip64,Ot:r});try{if(!K){q&&(t=new D),t=new me(t),await ge(t,C?x:g),({writable:rt}=t);const{outputSize:e}=await sn({readable:Z,writable:rt},et);if(t.size+=e,e!=(C?x:g))throw new w(Cr)}}catch(e){if(e.outputSize!==dt&&(t.size+=e.outputSize),!q||e.message!=He)throw nt=e,e}finally{if((ye(t)||!ti(s,n,ss))&&rt&&!rt.locked){const t=rt.getWriter();if(nt)try{await t.abort(nt)}catch{}else await t.close()}}return q||K?dt:t.getData?t.getData():rt}};function Ls(t){const e=o.min(t.byteLength,1024)-3;for(let r=0;e>r;r++)if(134630224==ii(t,r))return!0;return!1}function Ps(t,e,n){const s=t.rawBitFlag=si(e,n+2),i=!(1&~s),o=ii(e,n+6);r.assign(t,{encrypted:i,version:si(e,n),bitFlag:{level:(6&s)>>1,dataDescriptor:!(8&~s),languageEncodingFlag:(s&tt)==tt},rawLastModDate:o,lastModDate:ei(o),filenameLength:si(e,n+22),extraFieldLength:si(e,n+24)})}function Ws(t,e,n,s,i){const{rawExtraField:o}=e,d=e.extraField=new c,l=bt(o);let u=0;try{for(;u<o.length;){const t=si(l,u),e=si(l,u+2);d.set(t,{type:t,data:o.slice(u+4,u+4+e)}),u+=4+e}}catch{}const f=si(n,s+4);r.assign(e,{signature:ii(n,s+10),crc32:ii(n,s+10),compressedSize:ii(n,s+14),uncompressedSize:ii(n,s+18)});const p=d.get(1);p&&(((t,e)=>{e.zip64=!0;const r=bt(t.data),n=Os.filter(([t,r])=>e[t]==r),s=n.reduce((t,[,e])=>t+Ms[e].bytes,0);if(t.data.length<s)throw new w(xs);for(let s=0,i=0;s<n.length;s++){const[o,a]=n[s],c=Ms[a];e[o]=t[o]=c.It(r,i),i+=c.bytes}})(p,e),e.extraFieldZip64=p);const h=d.get(28789);h&&(Vs(h,fn,pn,e,t),e.extraFieldUnicodePath=h);const m=d.get(25461);m&&(Vs(m,hn,mn,e,t),e.extraFieldUnicodeComment=m);const y=d.get(G);y&&y.data.length>=7?(((t,e,n)=>{const s=bt(t.data),i=ni(s,4);r.assign(t,{vendorVersion:ni(s,0),vendorId:ni(s,2),strength:i,originalCompressionMethod:n,compressionMethod:si(s,5)}),e.compressionMethod=t.compressionMethod,1!=t.vendorVersion&&(e.crc32=dt)})(y,e,f),e.extraFieldAES=y):e.compressionMethod=f;const g=d.get(13);g&&(Bs(g,e),e.extraFieldPkwareUnix=g);const x=d.get(22613);x&&(Bs(x,e),e.extraFieldUnixType1=x);const S=d.get(10);S&&(((t,e)=>{const n=bt(t.data);let s,i=4;try{for(;i<t.data.length&&!s;){const e=si(n,i),r=si(n,i+2);1==e&&(s=t.data.slice(i+4,i+4+r)),i+=4+r}}catch{}if(s&&24==s.length){const n=bt(s),i=n.getBigUint64(0,!0),o=n.getBigUint64(8,!0),a=n.getBigUint64(16,!0);r.assign(t,{rawLastModDate:i,rawLastAccessDate:o,rawCreationDate:a});const c={lastModDate:ri(i),lastAccessDate:ri(o),creationDate:ri(a)};r.assign(t,c),r.assign(e,c)}})(S,e),e.extraFieldNTFS=S);const b=d.get($);if(b)Zs(b,e,!1),e.extraFieldUnix=b;else{const t=d.get(Q);t&&(Zs(t,e,!0),e.extraFieldInfoZip=t)}const z=d.get(X);z&&(((t,e,r)=>{if(!t.data.length)return;const n=bt(t.data),s=ni(n,0),i=[],o=[];r?(1&~s||(i.push(bn),o.push(zn)),2&~s||(i.push(Fn),o.push(En)),4&~s||(i.push(Rn),o.push(Dn))):5>t.data.length||(i.push(bn),o.push(zn));let c=1;i.forEach((r,s)=>{if(t.data.length>=c+4){const i=ii(n,c);e[r]=t[r]=new a(1e3*(0|i));const d=o[s];t[d]=i}c+=4})})(z,e,i),e.extraFieldExtendedTimestamp=z);const F=d.get(J);F&&(e.extraFieldUSDZ=F)}function Vs(t,e,n,s,i){if(5>t.data.length)return void(t.valid=!1);const o=bt(t.data),a=new Ie;a.append(i[n]);const c=bt(new f(4));c.setUint32(0,a.get(),!0);const d=ii(o,1);r.assign(t,{version:ni(o,0),[e]:wn(t.data.subarray(5)),valid:!i.bitFlag.languageEncodingFlag&&d==ii(c,0)}),t.valid&&(s[e]=t[e],s[e+"UTF8"]=!0)}function Bs(t,e){if(8>t.data.length)return;const n=bt(t.data),s={lastAccessDate:new a(1e3*(0|ii(n,0))),lastModDate:new a(1e3*(0|ii(n,4)))};12>t.data.length||(s.uid=si(n,8),s.gid=si(n,10)),r.assign(t,s),r.assign(e,s)}function Zs(t,e,n){try{const s=bt(t.data);let i,o;if(n){let e=0;const n=ni(s,e++),a=ni(s,e++);i=Hs(t.data.subarray(e,e+a)),e+=a;const c=ni(s,e++);o=Hs(t.data.subarray(e,e+c)),r.assign(t,{version:n,uid:i,gid:o})}else 4>t.data.length||(i=si(s,0),o=si(s,2),r.assign(t,{uid:i,gid:o}));i!==dt&&(e.uid=i),o!==dt&&(e.gid=o)}catch{}}function Hs(t){const e=new f(4);return e.set(t,0),new m(e.buffer,e.byteOffset,4).getUint32(0,!0)}function qs(t,e){return t.A?t.A(e):0}function js(t){return t===us||t===ws||t===fs}function Ks(t,e){if(t===dt)return e?us:ws;if(!js(t))throw new w(Cs);return t}function Ys(t,e){if(e==fs)return!1;const r=t.split("/");return r.length>1&&""===r[r.length-1]&&r.pop(),!!(r.includes("..")||t.startsWith("/")||t.startsWith("\\\\")||ks.test(t))||e==us&&(r.includes(".")||r.includes(""))}async function*Gs(t,e){const r=t.size-e,n=await xe(t,r,e),s=bt(n);for(let t=n.length-j;t>=0;t--)ii(s,t)==Z&&(yield[s,r,n,t,r+t])}function Xs(t,e,r){return{offset:r,buffer:t.slice(e,e+j).buffer}}async function Js(t,e,r,n,s,i,o){const a=si(e,n+10),c=ii(e,n+12),d=ii(e,n+16);if(a==_||c==M||d==M)return await Qs(t,e,r,s-K,i,o)==q?2:0;if(!a&&!c)return 1;const l=si(e,n+6);for(const n of[s-c,qs(t,l)+d])if(await Qs(t,e,r,n,i,o)==B)return 2;return 0}async function Qs(t,e,r,n,s,i){return 0>n||n+4>s?dt:r>n?i.count>0?(i.count--,ii(bt(await xe(t,n,4)),0)):dt:ii(e,n-r)}function $s(t){const e=new w(Rs);throw e.reason=t,e}function ti(t,e,r){return e[r]===dt?t.options[r]:e[r]}function ei(t){const e=(4294901760&t)>>16,r=t&_;return new a(1980+((65024&e)>>9),((480&e)>>5)-1,31&e,(63488&r)>>11,(2016&r)>>5,2*(31&r),0)}function ri(t){return new a(s(t/i(1e4)-i(116444736e5)))}function ni(t,e){return t.getUint8(e)}function si(t,e){return t.getUint16(e,!0)}function ii(t,e){return t.getUint32(e,!0)}function oi(t,e){return s(t.getBigUint64(e,!0))}var ai=r.freeze({__proto__:null,ERR_AMBIGUOUS_ARCHIVE:Rs,ERR_BAD_FORMAT:ps,ERR_CENTRAL_DIRECTORY_NOT_FOUND:ys,ERR_ENCRYPTED:Ss,ERR_ENCRYPTED_CENTRAL_DIRECTORY:Ds,ERR_EOCDR_LOCATOR_ZIP64_NOT_FOUND:ms,ERR_EOCDR_NOT_FOUND:hs,ERR_EXTRAFIELD_ZIP64_NOT_FOUND:xs,ERR_INVALID_AUTHENTICATION_CODE:Ze,ERR_INVALID_COMPRESSED_DATA:vr,ERR_INVALID_CRC32:Tr,ERR_INVALID_FILENAME_VALIDATION:vs,ERR_INVALID_MAX_APPENDED_DATA_SIZE:Ts,ERR_INVALID_PASSWORD:Ve,ERR_INVALID_SIGNATURE:Be,ERR_INVALID_STRICTNESS:Cs,ERR_INVALID_UNCOMPRESSED_SIZE:Cr,ERR_LOCAL_FILE_HEADER_NOT_FOUND:gs,ERR_OVERLAPPING_ENTRY:Es,ERR_SPLIT_ZIP_FILE:Fs,ERR_UNSAFE_FILENAME:As,ERR_UNSUPPORTED_COMPRESSION:zs,ERR_UNSUPPORTED_ENCRYPTION:bs,ZipReader:_s});const ci="Zip file comment exceeds 64KB",di="Version exceeds 65535",li="Extra field data exceeds 64KB",ui=-2147483648,wi=2147483647,fi=i(0),pi=i("0x7fffffffffffffff"),hi="Zip64 is not supported (set the 'zip64' option to 'true')",mi="Undetermined size",yi=new f([7,0,2,0,65,69,3,0,0]),gi="infozip",xi="unix";let Si=0;const bi=[];class zi{constructor(t,e={}){t=new me(t);const{availableSize:n=lt,maxSize:s=lt}=t,i=n>0&&n!==lt&&s>0&&s!==lt;r.assign(this,{writer:t,Vt:i,options:e,config:yt(),files:new c,Bt:new d,offset:e[is]===dt?t.size||t.writable.size||0:e[is],Zt:e[is]===dt?0:e[is]-(t.size||t.writable.size||0),Ht:new d,qt:0,jt:dt})}async prependZip(t){if(this.Bt.size)throw new w("Zip file not empty");t=new he(t),await ge(t);const{ZipReader:e}=await g.resolve().then(()=>ai),n=new e(t.readable),s=await n.getEntries();await n.close(),await ge(this.writer),await t.readable.pipeTo(this.writer.writable,{preventClose:!0,preventAbort:!0}),this.writer.size=this.offset=t.size,this.Bt=new d(s.map(t=>t.filename)),this.files=new c(s.map(t=>{const{version:e,rawLastModDate:n,lastAccessDate:s,creationDate:i,rawFilename:o,bitFlag:a,encrypted:c,uncompressedSize:d,compressedSize:l,zip64:u}=t;let{compressionMethod:w,Kt:f,Yt:p,Gt:h,Xt:m,Jt:y,rawExtraField:g}=t;const{level:x,languageEncodingFlag:S,dataDescriptor:b}=a;f=f||pt,p=p||pt,h=h||pt,m=m||pt,y=y||pt,g=g||pt,t.extraFieldAES&&(w=99);const z=Qi(f,p,h,m,y,g),F=u&&d>=M,E=u&&l>=M,R=-7&to(x,S,b,c,w)|x<<1,{Qt:D,$t:A}=$i({version:e,bitFlag:R,compressionMethod:w,uncompressedSize:d,compressedSize:l,rawLastModDate:n,rawFilename:o,te:E,ee:F,extraFieldLength:z}),{crc32:C}=t;return C!==dt&&Gi(A,10,C),r.assign(t,{ee:F,te:E,re:u&&t.offset>=M,diskNumberStart:0,ne:!1,Kt:f,Yt:p,Gt:h,Xt:m,Jt:y,rawExtraField:g,extendedTimestamp:h.length>0||m.length>0,se:1+(s?2:0)+(i?4:0),Qt:D,$t:A}),[t.filename,t]}))}async add(t="",e,n={}){const s=this;n=r.assign({},n);const{Ht:o,config:a}=s;let c,d;Si<a.maxWorkers?Si++:await new g(t=>bi.push(t));try{if(t=t.trim(),Bi(s,n,Pn)&&!t.endsWith(it)&&(t+=it),s.Bt.has(t))throw new w("File already exists");return s.Bt.add(t),d=!0,c=(async(t,e,n,s)=>{const o=Fi(t,e,s);({name:e}=o);const a=Ei(t,e,s),{comment:c}=a,d=s[Zn];let l;t.files.set(e,dt);try{const{ie:c}=a;0==c.level||c.compressionMethod!==dt||c.passThrough||await Gr(t.config)||(c.level=0);const d=await(async(t,e,{ie:n},s)=>{if(n.passThrough&&!e&&!Bi(t,s,Pn))throw new w("Undefined reader");let i;return e&&(e=new he(e),await ge(e),({size:i}=e)),r.assign({reader:e},Di(t,!!e,i,n,s))})(t,n,a,s);({reader:n}=d);const u=Oi(t.writer),p=Ii(t.writer),h=Ai(s=r.assign({},s,o.ie,a.ie,d.ie,{internalFileAttribute:a.ie.internalFileAttributes,externalFileAttribute:o.ie.externalFileAttributes,signature:s[Bn],crc32:s.crc32===dt?s[Bn]:s.crc32,offset:t.offset-u,diskNumberStart:p})),m=Ti(s),y=Qi(h.oe,m.ae);l=await(async(t,e,n,s,o)=>{const{files:a,writer:c}=t,{keepOrder:d,dataDescriptor:l,signal:u}=o,{ce:p}=s,h=t.options[os],m=t.jt;let y,x,S,b,z,F,R,A={},C=0;a.set(e,A),t.jt=A;try{let x;d&&(x=m&&m.lock,A.lock=new g(t=>S=t)),o.bufferedWrite||!d||t.de||t.qt||!l?(y=!0,t.qt++,R=o.createTempStream?await o.createTempStream():new E(dt,dt,{highWaterMark:lt}),R.size=0,await ge(c)):(R=c,await v()),await ge(R);const k=Oi(c);if(t.Vt){delete t.Vt;const e=new f(4);Gi(bt(e),0,P),await Ni(c,e),t.offset+=4}h&&!y&&Ci(s,t.offset-k);const{oe:U}=p;y||(await x,await T());const I=Ii(c),O=_i(t,c);if(A.diskNumberStart=I,y||(z=!0,F=c.size,await Ni(R,U)),A=await(async(t,e,{diskNumberStart:n,lock:s},o,a,c)=>{const{ce:d,le:l,ue:u}=o,{Qt:f,$t:p,lastModDate:h,rawLastModDate:m,encrypted:y,compressed:g,version:x,compressionMethod:S,Kt:b,we:z,Gt:F,se:E,Xt:R,Jt:D,Yt:A}=d,{ae:C}=l,{rawFilename:v,lastAccessDate:T,creationDate:k,password:U,rawPassword:I,level:O,zip64:_,ee:L,te:P,zipCrypto:W,dataDescriptor:V,directory:B,executable:Z,versionMadeBy:H,rawComment:q,rawExtraField:j,useWebWorkers:K,transferStreams:Y,onstart:G,onprogress:X,onend:J,signal:Q,encryptionStrength:$,extendedTimestamp:tt,msDosCompatible:et,internalFileAttributes:rt,externalFileAttributes:nt,uid:st,gid:it,unixMode:ot,setuid:at,setgid:ct,sticky:lt,unixExternalUpper:ut,msdosAttributesRaw:wt,msdosAttributes:ft,useCompressionStream:pt,passThrough:ht,format:mt,codecURI:yt}=c,gt={lock:s,versionMadeBy:H,zip64:_,directory:!!B,executable:!!Z,filenameUTF8:!0,rawFilename:v,commentUTF8:!0,rawComment:q,Kt:b,we:z,Gt:F,Xt:R,Jt:D,Yt:A,rawExtraField:j,extendedTimestamp:tt,msDosCompatible:et,internalFileAttributes:rt,externalFileAttributes:nt,diskNumberStart:n,uid:st,gid:it,unixMode:ot,setuid:at,setgid:ct,sticky:lt,unixExternalUpper:ut,msdosAttributesRaw:wt,msdosAttributes:ft};let{crc32:xt,uncompressedSize:St}=c,bt=0;ht||(St=0);const{writable:Ft}=e;if(t){const r=zt(t.createReadable?t.createReadable():t.readable),n=t.size,s={options:{codecType:qr,level:O,rawPassword:I,password:U,encryptionStrength:$,zipCrypto:y&&W,passwordVerification:y&&W&&m>>8&N,computeCrc32:!ht,compressed:g&&!ht,encrypted:y&&!ht,useWebWorkers:K,useCompressionStream:pt,transferStreams:Y,format:mt,codecURI:yt,compressionMethod:S},config:a,zt:{signal:Q,size:n,onstart:G,onprogress:X,onend:J}};try{const t=await sn({readable:r,writable:Ft},s);if(bt=t.outputSize,e.size+=bt,ht||(St=t.inputSize,y&&!W||(xt=t.crc32)),!P&&bt>=M||!L&&St>=M)throw new w(hi)}catch(t){throw t.outputSize!==dt&&(e.size+=t.outputSize),t}}return(({crc32:t,compressedSize:e,uncompressedSize:r,ce:n,le:s},{zip64:o,zipCrypto:a,passThrough:c,dataDescriptor:d})=>{const{$t:l,encrypted:u}=n,{fe:w,pe:f}=s;u&&!a&&!c||t===dt||(Gi(l,10,t),d&&Gi(w,f,t)),o?d&&(Xi(w,f+4,i(e)),Xi(w,f+12,i(r))):(Gi(l,14,e),Gi(l,18,r),d&&(Gi(w,f+4,e),Gi(w,f+8,r)))})({crc32:xt,compressedSize:bt,uncompressedSize:St,ce:d,le:l},c),V&&await Ni(e,C),r.assign(gt,{uncompressedSize:St,compressedSize:bt,lastModDate:h,rawLastModDate:m,creationDate:k,lastAccessDate:T,encrypted:y,zipCrypto:W,size:u+bt,compressionMethod:S,version:x,Qt:f,$t:p,signature:xt,crc32:!y||W||ht?xt:dt,se:E,ee:L,te:P}),gt})(n,R,A,s,t.config,o),y||(z=!1),a.set(e,A),A.filename=e,y){if(await g.all([R.writable.getWriter().close(),x]),await v(),b=!0,F=c.size,await T(),A.diskNumberStart=Ii(c),A.offset=_i(t,c),h){const e=s.ue;Ci(s,t.offset-Oi(c)),A.size+=s.ue-e}(({rawFilename:t,encrypted:e,zip64:r,we:n,crc32:s,compressedSize:o,uncompressedSize:a,ee:c,te:d},l,{dataDescriptor:u,passThrough:w})=>{if(u||((!e||w&&s!==dt)&&Gi(l,14,s),d||Gi(l,18,o),c||Gi(l,22,a)),r&&n){const e=ot+Qi(t)+4;Xi(l,e,i(a)),Xi(l,e+8,i(o))}})(A,p.he,o),await Ni(c,p.oe),await(async(t,e,r)=>{const n=e.writable.getWriter();try{await t.pipeTo(new D({async write(t){var e;await n.ready,await n.write(t),e=Qi(t),C+=e}}),{preventClose:!0,preventAbort:!0,signal:r})}finally{n.releaseLock()}})(R.readable,c,u),c.size+=R.size,b=!1}else A.diskNumberStart=I,A.offset=O;return t.offset+=A.size,A}catch(r){if(b||z){if(t.hasCorruptedEntries=!0,r)try{r.corruptedEntry=!0}catch{}t.offset+=c.size-F,y&&(t.offset+=C)}throw a.delete(e),r}finally{if(y&&t.qt--,S&&S(),x&&x(),y&&R&&R.dispose)try{await R.dispose()}catch{}}async function v(){t.de=!0;const{me:e}=t;t.me=new g(e=>x=()=>{t.de=!1,e()}),await e}async function T(){Mi(c,Qi(p.oe))&&await c.closeDisk()}})(t,e,n,{ce:h,le:m,ue:y},s)}catch(r){throw t.files.delete(e),r}return r.assign(l,{name:e,comment:c,extraField:d}),new Gn(l)})(s,t,e,n),o.add(c),await c}catch(e){throw d&&s.Bt.delete(t),e}finally{o.delete(c);const t=bi.shift();t?t():Si--}}remove(t){const{Bt:e,files:r}=this;if(typeof t==ft&&(t=r.get(t)),t&&t.filename!==dt){const{filename:n}=t;if(e.has(n)&&r.has(n))return e.delete(n),r.delete(n),!0}return!1}async close(t=pt,r={}){const{Ht:n,writer:s}=this,{writable:o}=s;if(Qi(t)>_)throw new w(ci);for(;n.size;)await g.allSettled(e.from(n));return await(async(t,r,n)=>{const s=ki(t.files),{ye:o,ge:a}=await(async(t,r,n)=>{const{files:s,writer:i}=t,o=new f(r);await ge(i);let a=0,c=0,d=Ii(i),l=Oi(i);for(const[t,r]of e.from(s.values()).entries()){const{offset:e,rawFilename:u,Kt:w,Yt:f,Gt:p,Xt:h,Jt:m,rawExtraField:y,rawComment:g,versionMadeBy:x,Qt:S,$t:b,ee:z,te:F,ne:E,re:R,internalFileAttributes:D,externalFileAttributes:A,diskNumberStart:C,uncompressedSize:v,compressedSize:T}=r,k=Qi(w,f,p,h,m,y),U=46+Qi(u,g)+k;Mi(i,a+U-c)&&(await Ni(i,o.slice(c,a)),c=a,await i.closeDisk()),0==t&&(d=Ii(i),l=Oi(i)),z||Gi(b,18,v),F||Gi(b,14,T),(R||E)&&45>r.version&&Yi(b,0,45);const I=Ui(U);if(I.uint32(B),I.uint16(x),I.bytes(S.subarray(0,24)),I.uint16(k),I.uint16(Qi(g)),I.uint16(E?_:C),I.uint16(D),I.uint32(A),I.uint32(R?M:e),I.bytes(u),I.bytes(w),I.bytes(f),I.bytes(p),I.bytes(h),I.bytes(m),I.bytes(y),I.bytes(g),Ji(o,I.array,a),a+=U,n.onprogress)try{await n.onprogress(t+1,s.size,new Gn(r))}catch{}}return await Ni(i,c?o.slice(c):o),{ye:{diskNumber:d,diskOffset:l},ge:o}})(t,s,n),c=await(async(t,e,r)=>{const n=Bi(t,r,cs);if(n){const r=await n(e),s=Qi(r);if(s>_)throw new w("Signature data exceeds 64KB");const i=Ui(6+s);return i.uint32(V),i.uint16(s),i.bytes(r),await Ni(t.writer,i.array),6+s}return 0})(t,a,n);await(async(t,e,r,n)=>{const{writer:s}=t,{ye:o,xe:a}=n;let{Se:c}=n,d=t.files.size,l=o.diskNumber,u=_i(t,o),f=Ii(s);Mi(s,j)&&f++;let p=Bi(t,r,On);if(!(M>u&&M>c&&_>d&&_>f)){if(!1===p)throw new w(hi);p=!0}const h=Qi(e);if(h>_)throw new w(ci);const m=Ui(p?98:j);Mi(s,Qi(m.array)+h)&&await s.closeDisk(),f=Ii(s),p&&(m.uint32(H),m.be(44),m.uint16(45),m.uint16(45),m.uint32(f),m.uint32(l),m.be(d),m.be(d),m.be(c),m.be(u),m.uint32(q),m.uint32(f),m.be(i(_i(t,s))+i(c)+i(a)),m.uint32(f+1),Bi(t,r,"supportZip64SplitFile",!0)&&(f=_,l=_),d=_,u=M,c=M),m.uint32(Z),m.uint16(f),m.uint16(l),m.uint16(d),m.uint16(d),m.uint32(c),m.uint32(u),m.uint16(h),await Ni(s,m.array),h&&await Ni(s,e)})(t,r,n,{ye:o,Se:s,xe:c})})(this,t,r),!ye(s)&&Bi(this,r,ss)||await o.getWriter().close(),s.getData?s.getData():o}}function Fi(t,e,r){e=e.trim();let n=Bi(t,r,In),i=Bi(t,r,Nn,n?20:768);const o=Bi(t,r,Wn),a=qi(t,r,"uid"),c=qi(t,r,"gid");let d=qi(t,r,Hn),l=Bi(t,r,"unixExtraFieldType"),u=Bi(t,r,qn),f=Bi(t,r,jn),p=Bi(t,r,Kn);if(a!==dt&&(!s.isInteger(a)||0>a||a>M))throw new w("Invalid uid (must be integer 0..2^32-1)");if(c!==dt&&(!s.isInteger(c)||0>c||c>M))throw new w("Invalid gid (must be integer 0..2^32-1)");if(d!==dt&&(!s.isInteger(d)||0>d||d>_))throw new w("Invalid UNIX mode (must be integer 0..65535)");if(l!==dt&&l!==gi&&l!==xi)throw new w("Invalid unixExtraFieldType (must be 'infozip' or 'unix')");if(l===xi&&(a!==dt&&a>_||c!==dt&&c>_))throw new w("uid/gid must be 0..65535 for unixExtraFieldType 'unix' (use 'infozip' for larger ids)");l!==dt||a===dt&&c===dt||(l=gi);let h=Bi(t,r,kn),m=Bi(t,r,Un);const y=h!==dt||m!==dt;if(a!==dt||c!==dt||d!==dt||l?(n=!1,i=i&_|768):y&&(n=!0,i&=N),h!==dt&&(0>h||h>N))throw new w("Invalid msdosAttributesRaw (must be integer 0..255)");if(m&&"object"!=typeof m)throw new w("Invalid msdosAttributes (must be an object with boolean flags)");if(i>_)throw new w(di);let g=Zi(t,r,Cn,Tn);const x=g!==dt;x||(g=0),!r[Pn]&&e.endsWith(it)&&(r[Pn]=!0);const S=Bi(t,r,Pn);let b;if(S?(e.endsWith(it)||(e+=it),x||(g=16,n||(g|=16877<<16))):n||x||(g=o?493<<16:27525120),!n){const t=d!==dt||!!(u||f||p);b=g>>16&_,d=d===dt?b:d&_,u?d|=nt:u=!!(d&nt),f?d|=st:f=!!(d&st),p?d|=512:p=!!(512&d),x&&!t||(S?d=-61441&d|rt:d&et||(d|=32768),g=(d&_)<<16|g&_)}return({msdosAttributesRaw:h,msdosAttributes:m}=((t,e)=>{if(t!==dt)t&=N;else if(e!==dt){const{readOnly:r,hidden:n,system:s,directory:i,archive:o}=e;let a=0;r&&(a|=1),n&&(a|=2),s&&(a|=4),i&&(a|=16),o&&(a|=32),t=a&N}return e===dt&&(e={readOnly:!!(1&t),hidden:!!(2&t),system:!!(4&t),directory:!!(16&t),archive:!!(32&t)}),{msdosAttributesRaw:t,msdosAttributes:e}})(h,m)),y&&(g=g&M|h&N),{name:e,ie:{versionMadeBy:i,msDosCompatible:n,externalFileAttributes:g,unixExternalUpper:b,uid:a,gid:c,unixMode:d,unixExtraFieldType:l,setuid:u,setgid:f,sticky:p,msdosAttributesRaw:h,msdosAttributes:m}}}function Ei(t,e,r){const n=Bi(t,r,"encodeText",Me);let i=n(e,ds);if(i===dt&&(i=Me(e)),Qi(i)>_)throw new w("File entry name exceeds 64KB");const o=r[hn]||"";let c=n(o,ls);if(c===dt&&(c=Me(o)),Qi(c)>_)throw new w("File entry comment exceeds 64KB");const d=Bi(t,r,_n,20);if(d>_)throw new w(di);const l=Bi(t,r,bn,new a),u=Bi(t,r,Fn),p=Bi(t,r,Rn),h=Zi(t,r,An,vn,0),m=Bi(t,r,Qn),y=Bi(t,r,Xn),g=Bi(t,r,Jn);if(y&&typeof y!=ft||g&&!(g instanceof f))throw new w("Invalid password (password must be a string, rawPassword must be a Uint8Array)");const x=qi(t,r,"encryptionStrength",3),S=Bi(t,r,Ln),b=Bi(t,r,"extendedTimestamp",!0),z=Bi(t,r,"ntfsTimestamp"),F=Bi(t,r,"keepOrder",!0),E=Bi(t,r,es),R=Bi(t,r,ns),D=Bi(t,r,"bufferedWrite"),A=Bi(t,r,"createTempStream"),C=Bi(t,r,"dataDescriptorSignature",!0),v=Bi(t,r,$n),T=Bi(t,r,"useUnicodeFileNames",!0),k=Bi(t,r,Vn),U=m||k===dt?dt:ze(k);if(!m&&k!==dt&&0!==k&&8!==k&&!U)throw new w("Compression method not supported");let I=qi(t,r,"level");if(I!==dt&&(!s.isInteger(I)||0>I||I>9))throw new w("Invalid level (must be integer 0..9)");if(t.options[os]){if(y!==dt||g!==dt)throw new w("Encryption is not supported in USDZ files");I===dt&&k===dt&&(I=0)}let O=Bi(t,r,rs),M=Bi(t,r,"dataDescriptor");D&&M===dt&&(M=!1),(M===dt||S)&&(M=!0),I!==dt&&6!=I&&(O=!1);const N=Bi(t,r,On);if(!(S||y===dt&&g===dt||s.isInteger(x)&&x>=1&&3>=x))throw new w("The strength must equal 1, 2, or 3");const L=Ri(r[Zn]),P=Ri(r.localExtraField);return{comment:o,ie:{rawFilename:i,rawComment:c,version:d,lastModDate:l,lastAccessDate:u,creationDate:p,internalFileAttributes:h,passThrough:m,password:y,rawPassword:g,encryptionStrength:x,zipCrypto:S,extendedTimestamp:b,ntfsTimestamp:z,keepOrder:F,useWebWorkers:E,transferStreams:R,bufferedWrite:D,createTempStream:A,dataDescriptorSignature:C,signal:v,useUnicodeFileNames:T,compressionMethod:k,format:U?U.format:dt,codecURI:U?U.codecURI:dt,ze:U?U.versionNeeded:dt,level:I,useCompressionStream:O,dataDescriptor:M,zip64:N,rawExtraField:L,Fe:P}}}function Ri(t){if(!t)return pt;let e=0,r=0;t.forEach(t=>e+=4+Qi(t));const n=new f(e),s=bt(n);return t.forEach((t,e)=>{if(e>_)throw new w("Extra field type exceeds 65535");if(Qi(t)>_)throw new w(li);Yi(s,r,e),Yi(s,r+2,Qi(t)),Ji(n,t,r+4),r+=4+Qi(t)}),n}function Di(t,e,r,n,s){const{passThrough:i,zipCrypto:o,password:a,rawPassword:c,encryptionStrength:d}=n;let{dataDescriptor:l,zip64:u,level:f,compressionMethod:p}=n,h=0,m=0;if(i&&e&&(m=s[yn],m===dt))throw new w("Undefined uncompressed size");const y=!0===u,g=Bi(t,s,Mn);if(e&&i&&!g&&Qi(a,c))throw new w("Encryption is not supported when the 'passThrough' option is set");const x=e&&(!!(a&&Qi(a)||c&&Qi(c))||i&&g);e||(f=0,p=0);const S=x?o?12:16+4*d:0;e&&(i?(s.uncompressedSize=m,h=r===dt?ji(m)+S:r):r===dt?(l=!0,(u||u===dt)&&(u=!0,m=h=4294967296)):(s.uncompressedSize=m=r,h=(Ki(p,f)?ji(m):m)+S));const b=y||m>=M,z=y||h>=M;if(b||z){if(!1===u)throw new w(hi);u=!0}return u=u||!1,{Ee:h,ie:{dataDescriptor:l,zip64:u,ee:b,te:z,uncompressedSize:m,level:f,compressionMethod:p,encrypted:x}}}function Ai(t){const{rawFilename:e,lastModDate:r,lastAccessDate:n,creationDate:s,level:i,zip64:c,zipCrypto:d,useUnicodeFileNames:l,dataDescriptor:u,directory:f,rawExtraField:p,Fe:h,encryptionStrength:m,extendedTimestamp:y,ntfsTimestamp:g,passThrough:x,encrypted:S,ee:b,te:z,uncompressedSize:F,crc32:E}=t;let{version:R,compressionMethod:D}=t;const A=!f&&Ki(D,i);let C;const v=x||!A,T=c&&(t.bufferedWrite||!u||!b&&!z||v),k=T||c&&u&&(b||z);if(c&&(b||z)){const t=20,e=Ui(t);if(e.uint16(1),e.uint16(t-4),C=e.array,T&&(e.be(F),v)){const t=S?d?12:16+4*m:0;e.be(x?0:F+t)}}else C=pt;let U,I,O,M,N;if(S&&!d){const t=Ui(Qi(yi)+2);t.uint16(G),t.bytes(yi),U=t.array,U[8]=m}else U=pt;if(y){const t=Pi(r),e=Wi(t);if(e){const e=9+(n?4:0)+(s?4:0),r=Ui(e);M=1+(n?2:0)+(s?4:0),r.uint16(X),r.uint16(e-4),r.uint8(M),r.uint32(t),n&&r.uint32(Vi(Pi(n))),s&&r.uint32(Vi(Pi(s))),O=r.array}else O=pt;if(g===dt?!e||n||s:g)try{const t=Li(r),e=Ui(36);e.uint16(10),e.uint16(32),e.Re(4),e.uint16(1),e.uint16(24),e.be(t),e.be(n?Li(n):t),e.be(s?Li(s):t),I=e.array}catch{I=pt}else I=pt}else I=O=pt;try{const{uid:e,gid:r,unixExtraFieldType:n}=t;if(n!=gi||e===dt&&r===dt)if(n!=xi||e===dt&&r===dt)N=pt;else{const t=Ui(8);t.uint16($),t.uint16(4),t.uint16((e===dt?0:e)&_),t.uint16((r===dt?0:r)&_),N=t.array}else{const t=vi(e),n=vi(r),s=3+t.length+n.length,i=Ui(4+s);i.uint16(Q),i.uint16(s),i.uint8(1),i.uint8(t.length),i.bytes(t),i.uint8(n.length),i.bytes(n),N=i.array}}catch{N=pt}D===dt&&(D=A?8:0);const{ze:P}=t;A&&P!==dt&&(R=R>P?R:P),c&&(R=R>45?R:45),S&&!d&&(R=R>51?R:51,x&&E!==dt&&(U[4]=1),U[9]=D,D=99);const W=k?Qi(C):0,V=W+Qi(U,O,I,N,p,h);if(V>_)throw new w(li);const B=new a(2e3*o.ceil(o.floor(r.getTime()/1e3)/2)),{Qt:Z,$t:H,rawLastModDate:q}=$i({version:R,bitFlag:to(i,l,u,S,D),compressionMethod:D,uncompressedSize:F,lastModDate:ct>B?ct:B>at?at:B,rawFilename:e,te:z,ee:b,extraFieldLength:V}),j=Ui(ot+Qi(e)+V),K=j.array,Y=bt(K);return j.uint32(L),j.bytes(Z),j.bytes(e),k&&j.bytes(C),j.bytes(U),j.bytes(O),j.bytes(I),j.bytes(N),j.bytes(p),j.bytes(h),u&&(z||Gi(Y,18,0),b||Gi(Y,22,0)),{oe:K,he:Y,Qt:Z,$t:H,lastModDate:r,rawLastModDate:q,encrypted:S,compressed:A,version:R,compressionMethod:D,se:M,Kt:pt,we:W,Gt:O,Xt:I,Jt:N,Yt:U,extraFieldLength:V}}function Ci(t,e){const{ce:r}=t;let{oe:n,extraFieldLength:s}=r,i=64-(e+Qi(n))%64;4>i&&(i+=64);const o=new f(i),a=bt(o);Yi(a,0,J),Yi(a,2,i-4);const c=n;r.oe=n=new f(Qi(c)+i),Ji(n,c),Ji(n,o,Qi(c));const d=bt(n);Yi(d,28,s+i),r.he=d,t.ue+=i}function vi(t){if(t===dt)return pt;{const e=new f(4);bt(e).setUint32(0,t,!0);let r=4;for(;r>1&&0===e[r-1];)r--;return e.subarray(0,r)}}function Ti({zip64:t,dataDescriptor:e,dataDescriptorSignature:r}){let n,s=pt,i=0,o=t?20:12;return r&&(o+=4),e&&(s=new f(o),n=bt(s),r&&(i=4,Gi(n,0,W))),{ae:s,fe:n,pe:i}}function ki(t){let e=0;for(const[,r]of t){const{rawFilename:t,Yt:n,rawComment:s,Xt:i,Jt:o,rawExtraField:a,extendedTimestamp:c,se:d,lastModDate:l,ee:u,te:f,uncompressedSize:p,compressedSize:h}=r,m=r.offset>=M,y=r.diskNumberStart>=_;let g,x;if(m||y||u||f){const t=4+(u?8:0)+(f?8:0)+(m?8:0)+(y?4:0),e=Ui(t);e.uint16(1),e.uint16(t-4),u&&e.be(p),f&&e.be(h),m&&e.be(r.offset),y&&e.uint32(r.diskNumberStart),g=e.array}else g=pt;r.Kt=g,r.re=m,r.ne=y;const S=Pi(l);if(c&&Wi(S)){const t=Ui(9);t.uint16(X),t.uint16(5),t.uint8(d),t.uint32(S),x=t.array}else x=pt;r.Gt=x;const b=Qi(g,n,i,o,x,a);if(b>_)throw new w(li);e+=46+Qi(t,s)+b}return e}function Ui(t){const e=new f(t),r=bt(e);let n=0;return{array:e,uint8:t=>{((t,e,r)=>{t.setUint8(e,r)})(r,n,t),n+=1},uint16:t=>{Yi(r,n,t),n+=2},uint32:t=>{Gi(r,n,t),n+=4},be:t=>{Xi(r,n,i(t)),n+=8},bytes:t=>{Ji(e,t,n),n+=Qi(t)},Re:t=>n+=t}}function Ii(t){const{diskNumber:e=0}=t;return e}function Oi(t){const{diskOffset:e=0}=t;return e}function Mi(t,e){const{availableSize:r=lt}=t;return e>r}function _i(t,{diskNumber:e=0,diskOffset:r=0}){return t.offset-r-(e?t.Zt:0)}async function Ni(t,e){const{writable:r}=t,n=r.getWriter();try{await n.ready,t.size+=Qi(e),await n.write(e)}finally{n.releaseLock()}}function Li(t){if(t){const e=(i(t.getTime())+i(116444736e5))*i(1e4);return fi>e?fi:e>pi?pi:e}}function Pi(t){return o.floor(t.getTime()/1e3)}function Wi(t){return t>=ui&&wi>=t}function Vi(t){return o.min(wi,o.max(ui,t))}function Bi(t,e,r,n){const s=e[r]===dt?t.options[r]:e[r];return s===dt?n:s}function Zi(t,e,r,n,s){const i=Hi(e,r,n),o=i===dt?Hi(t.options,r,n):i;return o===dt?s:o}function Hi(t,e,r){return t[e]===dt?t[r]:t[e]}function qi(t,e,r,n){return typeof(i=Bi(t,e,r,n))==ft&&i.trim()?s(i):i;var i}function ji(t){return t+5*(o.floor(t/16383)+1)}function Ki(t,e){return t===dt?e===dt||e>0:0!==t}function Yi(t,e,r){t.setUint16(e,r,!0)}function Gi(t,e,r){t.setUint32(e,r,!0)}function Xi(t,e,r){t.setBigUint64(e,r,!0)}function Ji(t,e,r){t.set(e,r)}function Qi(...t){let e=0;return t.forEach(t=>t&&(e+=t.length)),e}function $i({version:t,bitFlag:e,compressionMethod:r,uncompressedSize:n,compressedSize:s,lastModDate:i,rawLastModDate:o,rawFilename:a,te:c,ee:d,extraFieldLength:l}){const u=Ui(26),w=u.array,f=bt(w);if(u.uint16(t),u.uint16(e),u.uint16(r),o===dt){const t=new h(1),e=bt(t);Yi(e,0,(i.getHours()<<6|i.getMinutes())<<5|i.getSeconds()/2),Yi(e,2,(i.getFullYear()-1980<<4|i.getMonth()+1)<<5|i.getDate()),o=t[0]}return u.uint32(o),u.Re(4),c||s!==dt?u.uint32(c?M:s):u.Re(4),d||n!==dt?u.uint32(d?M:n):u.Re(4),u.uint16(Qi(a)),u.uint16(l),{Qt:w,$t:f,rawLastModDate:o}}function to(t,e,r,n,s){let i=0;return e&&(i|=tt),r&&(i|=8),8!=s&&9!=s||(0>t||t>3||(i|=6),t>3&&5>=t&&(i|=4),9==t&&(i|=2)),n&&(i|=1),i}const eo="Entry filename already exists",ro="Readable stream already consumed",no="Invalid passThrough option (use readerOptions.passThrough or set uncompressedSize for each entry)",so="zipjs-abort-export",io="The operation was aborted",oo=new d([1,G,10,X,28789,25461,J,Q,$,22613,13]);class ao{constructor(t,e,n,s){const i=this;if(t.root&&s&&s.getChildByName(e))throw new w(eo);n||(n={}),r.assign(i,{fs:t,name:e,data:n.data,options:n.options,id:t.De++,parent:s,children:[],uncompressedSize:n.uncompressedSize||0,Ae:n.Ae||n.uncompressedSize===dt,passThrough:n.passThrough}),!s&&t.root||(t.entries[i.id]=i),s&&i.parent.children.push(i)}moveTo(t){this.fs.move(this,t)}getFullname(){return this.getRelativeName()}getRelativeName(t=this.fs.root){let e=this.name,r=this.parent;for(;r&&r!=t;)e=(r.name?r.name+"/":"")+e,r=r.parent;return e}isDescendantOf(t){let e=this.parent;for(;e&&e.id!=t.id;)e=e.parent;return!!e}rename(t){const e=this.parent;if(e&&e.getChildByName(t))throw new w(eo);this.name=t}}class co extends ao{constructor(t,e,r,n){super(t,e,r,n);const s=this;s.Reader=r.Reader,s.Writer=r.Writer,r.getData&&(s.getData=r.getData)}clone(){return new co(this.fs,this.name,this)}async getData(t,e={}){const r=this;if(!t||t.constructor==r.Writer&&r.data&&((t,e)=>{const{contentType:r}=t;return r===dt||(t.constructor==Zt?e.type==r:t.constructor!=Pt||e.startsWith(t.data))})(t,r.data))return r.data;{const n=r.reader=yo(r.Reader,r.data,e),s=r.uncompressedSize||n.size;await g.all([ge(n),ge(t,s)]);const{signal:i}=e,o=((t,e,r,n)=>{const{onstart:s,onprogress:i,onend:o}=r,{readable:a}=e;return t.data instanceof Gn||!s&&!i&&!o?a:zt(a).pipeThrough(new Jr({onstart:s,onprogress:i,onend:o,size:e.size}),{signal:n})})(r,n,e,i),a=!ye(t)&&!!e.preventClose;return r.uncompressedSize=n.size,await zt(o).pipeTo(Et(t.writable),{signal:i,preventClose:a,preventAbort:a}),t.getData?t.getData():t.writable}}isPasswordProtected(){return!(!this.data||!this.data.encrypted)}async checkPassword(t,e={}){const n=this;if(!n.isPasswordProtected())return!0;try{return await n.data.getData(null,r.assign({},e,{password:t,checkPasswordOnly:!0})),!0}catch(t){if(t.message==Ve)return!1;throw t}}getText(t,e){return this.getData(new jt(t),e)}getBlob(t,e){return this.getData(new Zt(t),e)}getData64URI(t,e){return this.getData(new Pt(t),e)}getUint8Array(t){return this.getData(new we,t)}getWritable(t=new D,e){return this.getData({writable:t},e)}async getArrayBuffer(t){return St(await this.getUint8Array(t)).buffer}replaceBlob(t){r.assign(this,{data:t,Reader:Bt,Writer:Zt,reader:null})}replaceText(t){r.assign(this,{data:t,Reader:Ht,Writer:jt,reader:null})}replaceData64URI(t){r.assign(this,{data:t,Reader:Lt,Writer:Pt,reader:null})}replaceUint8Array(t){r.assign(this,{data:t,Reader:ue,Writer:we,reader:null})}replaceReadable(t){r.assign(this,{data:null,Reader:ho(t),Writer:null,reader:null})}}class lo extends ao{constructor(t,e,r,n){super(t,e,r,n),this.directory=!0}clone(t){const e=this,r=new lo(e.fs,e.name,e);return t&&(r.children=e.children.map(e=>{const n=e.clone(t);return n.parent=r,n})),r}addDirectory(t,e){return Ao(this,t,{options:e},!0)}addText(t,e,r={}){return Ao(this,t,{data:e,Reader:Ht,Writer:jt,options:r,uncompressedSize:qt(e)})}addBlob(t,e,r={}){return Ao(this,t,{data:e,Reader:Bt,Writer:Zt,options:r,uncompressedSize:e.size})}addData64URI(t,e,r={}){let n=e.length;for(;"="==e.charAt(n-1);)n--;const s=e.indexOf(",")+1;return Ao(this,t,{data:e,Reader:Lt,Writer:Pt,options:r,uncompressedSize:o.floor(.75*(n-s))})}addUint8Array(t,e,r={}){return Ao(this,t,{data:e,Reader:ue,Writer:we,options:r,uncompressedSize:e.length})}addHttpContent(t,e,r={}){return Ao(this,t,{data:e,Reader:class extends le{constructor(t){super(t,r)}},options:r})}addReadable(t,e,r={}){return Ao(this,t,{Reader:ho(e),options:r})}addFileSystemEntry(t,e={}){return Eo(this,t,e)}addFileSystemHandle(t,e={}){return Eo(this,t,e)}addFile(t,e={}){return(e=r.assign({},e)).lastModDate||(e.lastModDate=new a(t.lastModified)),Ao(this,t.name,{data:t,Reader:()=>({readable:t.stream(),size:t.size}),options:e,uncompressedSize:t.size})}Ce(t,e){return Ao(this,t,e)}importBlob(t,e){return this.importZip(new Bt(t),e)}importData64URI(t,e){return this.importZip(new Lt(t),e)}importUint8Array(t,e){return this.importZip(new ue(t),e)}importHttpContent(t,e){return this.importZip(new le(t,e),e)}importReadable(t,e){return this.importZip({readable:t},e)}exportBlob(t={}){return this.exportZip(new Zt(t.mimeType||"application/zip"),t)}exportData64URI(t={}){return this.exportZip(new Pt(t.mimeType||"application/zip"),t)}exportUint8Array(t={}){return this.exportZip(new we,t)}async exportWritable(t=new D,e={}){return await this.exportZip({writable:t},e),t}exportFileSystemHandle(t,e={}){return(async(t,e,n)=>{const{onstart:s,onprogress:i,onend:o}=n,a=new AbortController,{signal:c}=a,d=((t,e)=>{if(!t)return()=>{};if(t.aborted)return e.abort(t.reason),()=>{};const r=()=>e.abort(t.reason);return t.addEventListener("abort",r,{once:!0}),()=>t.removeEventListener("abort",r)})(n.signal,a),l=r.assign({},n,n.readerOptions,{signal:c,onstart:dt,onprogress:dt,onend:dt,preventClose:!1}),u=wo([t],t=>po(t,l.passThrough)),f=[];let p=!1,h=0;try{s&&await Qr(s,u),await y(t,e),o&&await Qr(o,h)}catch(t){try{t.exportedEntryNames=f}catch{}throw t}finally{d()}return e;function m(t){const e=t.getWriter();return new D({async write(t){await e.write(t),h+=t.length,i&&await Qr(i,h,u)},close:()=>e.close(),abort:t=>e.abort(t)})}async function y(t,e){if(n.concurrent){const r=(await g.allSettled(t.children.map(t=>x(t,e)))).filter(t=>"rejected"==t.status);if(r.length){const t=r.filter(t=>!So(t.reason));throw(t=>{const[e]=t,r=t.slice(1).flatMap(t=>[t,...t&&t.entryErrors||[]]).filter(t=>t!==e);if(r.length)try{e.entryErrors=[...e.entryErrors||[],...r]}catch{}return e})((t.length?t:r).map(t=>t.reason))}}else for(const r of t.children)await x(r,e)}async function x(e,r){if(c.aborted){if(p||So(c.reason))return;throw c.reason===dt?new DOMException(io,"AbortError"):c.reason}try{if(e.directory){const t=await r.getDirectoryHandle(e.name,{create:!0});await y(e,t)}else{const n=await r.getFileHandle(e.name,{create:!0}),s=await n.createWritable();try{await e.getData({writable:m(s)},l)}catch(t){throw p?new w(so):t}f.push(e.getRelativeName(t))}}catch(r){p=!0,a.abort(new w(so));try{r.entryName===dt&&(r.entryName=e.getRelativeName(t),r.entryId=e.id)}catch{}throw r}}})(this,t,e)}async importZip(t,e={}){let n;t&&typeof t.getEntries==wt?(n=t,e=r.assign({},n.options,e)):(await ge(t),n=new _s(t,e));const s=[],i=await n.getEntries(e);for(const t of i){let n=this;try{const i=t.filename.split("/").filter(t=>""!=t&&"."!=t),o=i.pop();if(i.forEach(t=>{const e=n;if(n=n.getChildByName(t),n){if(!n.directory)throw new w(eo)}else n=new lo(this.fs,t,{data:null},e),s.push(n)}),t.directory){let e=n;if(o)if(e=n.getChildByName(o),e){if(!e.directory)throw new w(eo)}else e=new lo(this.fs,o,{data:null},n),s.push(e);e==this||e.data||(e.data=t)}else s.push(Ao(n,o,{data:t,Reader:mo(r.assign({},e)),uncompressedSize:e.passThrough?t.compressedSize:t.uncompressedSize,passThrough:e.passThrough}))}catch(e){try{e.cause={entry:t}}catch{}throw e}}return s}async exportZip(t,e={}){const n=this;(e=r.assign({},e)).bufferedWrite===dt&&(e.bufferedWrite=!0);const[s]=await g.all([go(n,e.readerOptions),ge(t)]),i=new zi(t,e);return await(async(t,e,n,s,i)=>{const{onstart:o,onprogress:a,onend:c,onentryprogress:d}=s,l=e,u=wo(e.children,()=>1);let w=0,f=0;if(o&&await Qr(o,n),s.bufferedWrite)await async function t(e){const r=(await g.allSettled(e.children.map(async e=>{await p(e),await t(e)}))).find(t=>"rejected"==t.status);if(r)throw r.reason}(e);else for(const t of e.getChildren({recursive:!0}))await p(t);async function p(e){const{name:o,ve:c}=bo(e,l,s);let p=0;const h=await t.add(o,i.get(e),r.assign(c,{onstart:dt,onend:dt,onprogress:async t=>{w+=t-p,p=t,a&&await Qr(a,w,n)}}));f++,d&&await Qr(d,f,u,h)}c&&await Qr(c,w)})(i,n,wo([n],fo),e,s),await i.close(e.globalComment),t.getData?t.getData():t.writable}getExportedSize(t={}){const n=this;(t=r.assign({},t)).bufferedWrite===dt&&(t.bufferedWrite=!0);const s=!t.bufferedWrite||!1!==t.keepOrder&&n.children.every(t=>!t.children.length);return(async(t,e,n,s)=>{const i={options:t,config:yt()};if(t[cs])throw new w(mi);const o=Qi(s);if(o>_)throw new w(ci);const a=t[os],d=new c;let l=!!a,u=0;for(const t of e){let{name:e}=t;const{size:n}=t,s=r.assign({},t.options);e=e.trim(),Bi(i,s,Pn)&&!e.endsWith(it)&&(e+=it);const o=Fi(i,e,s);({name:e}=o);const{ie:c}=Ei(i,e,s);0==c.level||c.compressionMethod!==dt||c.passThrough||await Gr(i.config)||(c.level=0);const f=!Bi(i,s,Pn);if(f&&n===dt)throw new w(mi);const{Ee:p,ie:h}=Di(i,f,n,c,s);if(f&&!c.passThrough&&Ki(h.compressionMethod,h.level))throw new w(mi);const m=r.assign({},s,o.ie,c,h),y=Ai(m),g=Ti(m),x={ce:y,ue:Qi(y.oe,g.ae)};a&&Ci(x,u);const S=f?p:0;M>u||(l=!0),d.set(e,r.assign({},m,y,{offset:u,diskNumberStart:0,compressedSize:S})),u+=x.ue+S}if(l&&!n)throw new w(mi);const f=ki(d);let p=Bi(i,t,On);if(u>=M||f>=M||d.size>=_){if(!1===p)throw new w(hi);p=!0}return u+f+o+(p?98:j)})(t,e.from(n.getChildren({recursive:!0}),e=>{const{name:r,ve:s}=bo(e,n,t);return{name:r,size:e.directory?0:zo(e,Fo(e,t)),options:s}}),s,t.globalComment)}getChildByName(t){const e=this.children;for(let r=0;r<e.length;r++){const n=e[r];if(n.name==t)return n}}getChildren(t={}){return((t,e)=>{const r=[],n=[t];let s=0;for(;s<n.length;)for(const t of n[s++].children)r.push(t),e&&n.push(t);return r})(this,t.recursive)}isPasswordProtected(){const t=this.children;for(let e=0;e<t.length;e++)if(t[e].isPasswordProtected())return!0;return!1}async checkPassword(t,e={}){const r=this.children;return!(await g.all(r.map(r=>r.checkPassword(t,e)))).includes(!1)}}const uo={FS:class{constructor(){Do(this)}get children(){return this.root.children}remove(t){xo(t);const e=[t];for(;e.length;){const t=e.pop();this.entries[t.id]=null;for(const r of t.children)e.push(r)}t.parent=dt}move(t,e){if(t==this.root)throw new w("Root directory cannot be moved");if(!e.directory)throw new w("Target entry is not a directory");if(e.isDescendantOf(t))throw new w("Entry is a ancestor of target entry");if(t!=e){const r=e.getChildByName(t.name);if(r){if(r!=t)throw new w(eo)}else xo(t),t.parent=e,e.children.push(t),((t,e)=>{const r=[e];for(;r.length;){const e=r.pop();t.entries[e.id]=e;for(const t of e.children)r.push(t)}})(this,t)}}find(t){const e=t.split("/");let r=this.root;for(let t=0;r&&t<e.length;t++)r=r.getChildByName(e[t]);return r||(r=this.entries.find(e=>e&&(e==this.root||e.isDescendantOf(this.root))&&e.getRelativeName()==t)),r}getById(t){return this.entries[t]}getChildByName(t){return this.root.getChildByName(t)}getChildren(t){return this.root.getChildren(t)}addDirectory(t,e){return this.root.addDirectory(t,e)}addText(t,e,r){return this.root.addText(t,e,r)}addBlob(t,e,r){return this.root.addBlob(t,e,r)}addData64URI(t,e,r){return this.root.addData64URI(t,e,r)}addUint8Array(t,e,r){return this.root.addUint8Array(t,e,r)}addHttpContent(t,e,r){return this.root.addHttpContent(t,e,r)}addReadable(t,e,r){return this.root.addReadable(t,e,r)}addFileSystemEntry(t,e){return this.root.addFileSystemEntry(t,e)}addFileSystemHandle(t,e){return this.root.addFileSystemHandle(t,e)}addFile(t,e){return this.root.addFile(t,e)}Ce(t,e){return this.root.Ce(t,e)}importBlob(t,e){return Do(this),this.root.importBlob(t,e)}importData64URI(t,e){return Do(this),this.root.importData64URI(t,e)}importUint8Array(t,e){return Do(this),this.root.importUint8Array(t,e)}importHttpContent(t,e){return Do(this),this.root.importHttpContent(t,e)}importReadable(t,e){return Do(this),this.root.importReadable(t,e)}importZip(t,e){return Do(this),this.root.importZip(t,e)}exportBlob(t){return this.root.exportBlob(t)}exportData64URI(t){return this.root.exportData64URI(t)}exportUint8Array(t){return this.root.exportUint8Array(t)}exportWritable(t,e){return this.root.exportWritable(t,e)}exportFileSystemHandle(t,e){return this.root.exportFileSystemHandle(t,e)}exportZip(t,e){return this.root.exportZip(t,e)}getExportedSize(t){return this.root.getExportedSize(t)}isPasswordProtected(){return this.root.isPasswordProtected()}checkPassword(t,e){return this.root.checkPassword(t,e)}},ZipDirectoryEntry:lo,ZipFileEntry:co};function wo(t,r){let n=0;const s=e.from(t);for(;s.length;){const t=s.pop();n+=r(t)||0;for(const e of t.children)s.push(e)}return n}function fo(t){return t.uncompressedSize}function po(t,e){const{data:r}=t;return e&&r instanceof Gn?r.compressedSize:t.uncompressedSize}function ho(t){let e;return()=>{if(e)throw new w(ro);return e=!0,{readable:t}}}function mo(t){return class extends _t{constructor(t,e={}){super(),this.entry=t,this.options=e}async init(){const e=this,n=r.assign({},t,e.options),{checkOverlappingEntry:s,checkOverlappingEntryOnly:i}=n,o=await e.entry.getData(new Zt,r.assign(n,{checkPasswordOnly:!1,checkOverlappingEntry:i||s,checkOverlappingEntryOnly:!1,preventClose:!1}));e.data=o,e.Te=new Bt(o),e.size=o.size,super.init()}readUint8Array(t,e){return this.Te.readUint8Array(t,e)}}}function yo(t,e,r){return t.prototype?new t(e,r):t(e,r)}async function go(t,e){const r=[],n=[t],s=new c;for(;n.length;){const t=n.pop();for(const e of t.children)e.directory?n.push(e):r.push(e)}return await g.all(r.map(async t=>{const r=t.reader=yo(t.Reader,t.data,e);s.set(t,r);try{await ge(r)}catch(e){try{e.entryId=t.id,e.cause={entry:t}}catch{}throw e}r.size!==dt&&(t.uncompressedSize=r.size,t.Ae=!1)})),s}function xo(t){if(t.parent){const e=t.parent.children;e.forEach((r,n)=>{r.id==t.id&&e.splice(n,1)})}}function So(t){return!!t&&t.message==so}function bo(t,e,n){const s=n.relativePath?t.getRelativeName(e):t.getFullname(),i=t.options||{};let o={},a={};if(t.data instanceof Gn){const{externalFileAttributes:e,versionMadeBy:s,comment:i,lastModDate:d,creationDate:l,lastAccessDate:u,uncompressedSize:w,encrypted:f,zipCrypto:p,crc32:h,compressionMethod:m,extraFieldAES:y,internalFileAttributes:g,extraField:x,uid:S,gid:b}=t.data;o={externalFileAttributes:e,versionMadeBy:s,comment:i,lastModDate:d,creationDate:l,lastAccessDate:u,internalFileAttributes:g};const z=(t=>{if(t){const e=new c;if(t.forEach((t,r)=>{oo.has(r)||e.set(r,t.data)}),e.size)return e}})(x);if(z&&(o.extraField=z),S===dt&&b===dt||r.assign(o,{uid:S,gid:b,unixExtraFieldType:"infozip"}),Fo(t,n)){let t,e;0===m&&(t=0),y&&(e=y.strength),a={passThrough:!0,encrypted:f,zipCrypto:p,crc32:h,uncompressedSize:w,level:t,encryptionStrength:e,compressionMethod:m}}}const d=r.assign({},o,n,a,i,{directory:t.directory});if(!t.directory&&d.passThrough&&d.uncompressedSize===dt)throw new w(no);return{name:s,ve:d}}function zo(t,e){const{reader:r}=t;return r&&r.size!==dt?r.size:t.Ae?dt:po(t,e)}function Fo(t,e){const{readerOptions:r}=e;return!(t.directory||!(t.passThrough||r&&r.passThrough))}function Eo(t,e,n){return async function t(e,s,i,o=""){if(s){const c=o?o+"/"+s.name:s.name;try{if((s.isFile||s.isDirectory)&&(s=await Ro(s)),"file"==s.kind){const t=await s.getFile();i.push(e.Ce(t.name,{Reader:()=>({readable:t.stream(),size:t.size}),options:r.assign({},{lastModDate:new a(t.lastModified)},n),uncompressedSize:t.size}))}else if("directory"==s.kind){const r=e.addDirectory(s.name,n);i.push(r);for await(const e of s.values())await t(r,e,i,c)}}catch(t){try{t.entryName===dt&&(t.entryName=c)}catch{}throw t}}return i}(t,e,[])}async function Ro(t){const e={name:t.name};if(t.isFile&&(e.kind="file",e.getFile=()=>new g((e,r)=>t.file(e,r))),t.isDirectory){e.kind="directory";const r=await(async t=>{const e=[];function r(t,n,s){t.readEntries(async i=>{if(i.length){for(const t of i)e.push(await Ro(t));r(t,n,s)}else n(e)},s)}return await new g((e,n)=>r(t.createReader(),e,n)),{[k.iterator](){let t=0;return{next(){const r={value:e[t],done:t==e.length};return t++,r}}}}})(t);e.values=()=>r}return e}function Do(t){t.entries=[],t.De=0,t.root=new lo(t)}function Ao(t,e,r,n){if(t.directory)return n?new lo(t.fs,e,r,t):new co(t.fs,e,r,t);throw new w("Parent entry is not a directory")}t.ERR_ABORTED=io,t.ERR_ENTRY_EXISTS=eo,t.ERR_INVALID_PASS_THROUGH=no,t.ERR_READABLE_CONSUMED=ro,t.fs=uo});