@kaeawc/auto-mobile 0.0.86 → 0.0.88

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,5 +1,5 @@
1
1
  // @bun
2
- var WW=Object.create;var{getPrototypeOf:JW,defineProperty:n,getOwnPropertyNames:Mq,getOwnPropertyDescriptor:QW}=Object,Zq=Object.prototype.hasOwnProperty;function Rq(q){return this[q]}var XW,YW,$W=(q,Q,J)=>{var X=q!=null&&typeof q==="object";if(X){var G=Q?XW??=new WeakMap:YW??=new WeakMap,R=G.get(q);if(R)return R}J=q!=null?WW(JW(q)):{};let Y=Q||!q||!q.__esModule?n(J,"default",{value:q,enumerable:!0}):J;for(let I of Mq(q))if(!Zq.call(Y,I))n(Y,I,{get:Rq.bind(q,I),enumerable:!0});if(X)G.set(q,Y);return Y},mW=(q)=>{var Q=(Vq??=new WeakMap).get(q),J;if(Q)return Q;if(Q=n({},"__esModule",{value:!0}),q&&typeof q==="object"||typeof q==="function"){for(var X of Mq(q))if(!Zq.call(Q,X))n(Q,X,{get:Rq.bind(q,X),enumerable:!(J=QW(q,X))||J.enumerable})}return Vq.set(q,Q),Q},Vq,_=(q,Q)=>()=>(Q||q((Q={exports:{}}).exports,Q),Q.exports);var GW=(q)=>q;function KW(q,Q){this[q]=GW.bind(null,Q)}var fW=(q,Q)=>{for(var J in Q)n(q,J,{get:Q[J],enumerable:!0,configurable:!0,set:KW.bind(Q,J)})};var Jq=(q,Q)=>()=>(q&&(Q=q(q=0)),Q);var c=import.meta.require;function MW(q){if(q instanceof Error){let Q=[q.name,q.message].filter(Boolean).join(": "),J=q.stack?.split(`
3
- `).slice(0,3).join(" \u2190 "),X="cause"in q&&q.cause!==void 0?MW(q.cause):"";return[Q||"Error",J,X?`cause=${X}`:""].filter(Boolean).join(" | ")}if(q===null||q===void 0)return String(q);if(typeof q==="object"){if(Object.keys(q).length===0)return`${Object.prototype.toString.call(q)} (no enumerable keys)`;try{return JSON.stringify(q)}catch{return Object.prototype.toString.call(q)}}return String(q)}function t(q){try{return q instanceof Error?q.message:String(q)}catch{try{return Object.prototype.toString.call(q)}catch{return"Unknown error"}}}function oW(q,Q){if(q instanceof p)return q;let J=t(q);return new p(`${Q}: ${J}`,{cause:q})}function iW(q,Q){return new p(`${Q} is not supported on platform '${q}'. Supported platforms: android, ios.`)}var p,ZW;var Tq=Jq(()=>{p=class p extends Error{constructor(q,Q){super(q,Q);let J=Q?.containerFailure??(Q?.cause instanceof p?Q.cause.containerFailure:void 0);if(J)this.containerFailure=J}};ZW=class ZW extends p{}});import*as Iq from"path";function Qq(q,Q,J={}){let X=J.paths??Iq,G=X.resolve(q),R=X.resolve(G,Q),Y=X.relative(G,R);if(Y==="")return J.allowEqual??!0;return!(Y===".."||Y.startsWith(`..${X.sep}`)||X.isAbsolute(Y))}function sW(q,Q,J,X={}){if(!Qq(q,Q,X))throw J();let G=X.paths??Iq;return G.resolve(G.resolve(q),Q)}var Aq=()=>{};import*as jq from"path";function Oq(q,Q,J="CtrlProxy bundle"){let X=jq.resolve(Q);for(let G of q.getEntries())if(!Qq(X,G.entryName))throw new p(`Refusing to extract ${J}: entry "${G.entryName}" resolves outside the extraction directory ${X} (zip-slip / path traversal).`)}var Fq=Jq(()=>{Tq();Aq()});var Xq=_((tW,Sq)=>{Sq.exports={LOCHDR:30,LOCSIG:67324752,LOCVER:4,LOCFLG:6,LOCHOW:8,LOCTIM:10,LOCCRC:14,LOCSIZ:18,LOCLEN:22,LOCNAM:26,LOCEXT:28,EXTSIG:134695760,EXTHDR:16,EXTCRC:4,EXTSIZ:8,EXTLEN:12,CENHDR:46,CENSIG:33639248,CENVEM:4,CENVER:6,CENFLG:8,CENHOW:10,CENTIM:12,CENCRC:16,CENSIZ:20,CENLEN:24,CENNAM:28,CENEXT:30,CENCOM:32,CENDSK:34,CENATT:36,CENATX:38,CENOFF:42,ENDHDR:22,ENDSIG:101010256,ENDSUB:8,ENDTOT:10,ENDSIZ:12,ENDOFF:16,ENDCOM:20,END64HDR:20,END64SIG:117853008,END64START:4,END64OFF:8,END64NUMDISKS:16,ZIP64SIG:101075792,ZIP64HDR:56,ZIP64LEAD:12,ZIP64SIZE:4,ZIP64VEM:12,ZIP64VER:14,ZIP64DSK:16,ZIP64DSKDIR:20,ZIP64SUB:24,ZIP64TOT:32,ZIP64SIZB:40,ZIP64OFF:48,ZIP64EXTRA:56,STORED:0,SHRUNK:1,REDUCED1:2,REDUCED2:3,REDUCED3:4,REDUCED4:5,IMPLODED:6,DEFLATED:8,ENHANCED_DEFLATED:9,PKWARE:10,BZIP2:12,LZMA:14,IBM_TERSE:18,IBM_LZ77:19,AES_ENCRYPT:99,FLG_ENC:1,FLG_COMP1:2,FLG_COMP2:4,FLG_DESC:8,FLG_ENH:16,FLG_PATCH:32,FLG_STR:64,FLG_EFS:2048,FLG_MSK:4096,FILE:2,BUFFER:1,NONE:0,EF_ID:0,EF_SIZE:2,ID_ZIP64:1,ID_AVINFO:7,ID_PFS:8,ID_OS2:9,ID_NTFS:10,ID_OPENVMS:12,ID_UNIX:13,ID_FORK:14,ID_PATCH:15,ID_X509_PKCS7:20,ID_X509_CERTID_F:21,ID_X509_CERTID_C:22,ID_STRONGENC:23,ID_RECORD_MGT:24,ID_X509_PKCS7_RL:25,ID_IBM1:101,ID_IBM2:102,ID_POSZIP:18064,EF_ZIP64_OR_32:4294967295,EF_ZIP64_OR_16:65535,EF_ZIP64_SUNCOMP:0,EF_ZIP64_SCOMP:8,EF_ZIP64_RHO:16,EF_ZIP64_DSN:24}});var r=_((Dq)=>{var wq={INVALID_LOC:"Invalid LOC header (bad signature)",INVALID_CEN:"Invalid CEN header (bad signature)",INVALID_END:"Invalid END header (bad signature)",DESCRIPTOR_NOT_EXIST:"No descriptor present",DESCRIPTOR_UNKNOWN:"Unknown descriptor format",DESCRIPTOR_FAULTY:"Descriptor data is malformed",NO_DATA:"Nothing to decompress",BAD_CRC:"CRC32 checksum failed {0}",MAX_OUTPUT_EXCEEDED:"Decompressed data exceeds the declared uncompressed size",FILE_IN_THE_WAY:"There is a file in the way: {0}",UNKNOWN_METHOD:"Invalid/unsupported compression method",AVAIL_DATA:"inflate::Available inflate data did not terminate",INVALID_DISTANCE:"inflate::Invalid literal/length or distance code in fixed or dynamic block",TO_MANY_CODES:"inflate::Dynamic block code description: too many length or distance codes",INVALID_REPEAT_LEN:"inflate::Dynamic block code description: repeat more than specified lengths",INVALID_REPEAT_FIRST:"inflate::Dynamic block code description: repeat lengths with no first length",INCOMPLETE_CODES:"inflate::Dynamic block code description: code lengths codes incomplete",INVALID_DYN_DISTANCE:"inflate::Dynamic block code description: invalid distance code lengths",INVALID_CODES_LEN:"inflate::Dynamic block code description: invalid literal/length code lengths",INVALID_STORE_BLOCK:"inflate::Stored block length did not match one's complement",INVALID_BLOCK_TYPE:"inflate::Invalid block type (type == 3)",CANT_EXTRACT_FILE:"Could not extract the file",CANT_OVERRIDE:"Target file already exists",DISK_ENTRY_TOO_LARGE:"Number of disk entries is too large",NO_ZIP:"No zip file was loaded",NO_ENTRY:"Entry doesn't exist",DUPLICATE_ENTRY:"Duplicate entry name {0}",DIRECTORY_CONTENT_ERROR:"A directory cannot have content",FILE_NOT_FOUND:'File not found: "{0}"',NOT_IMPLEMENTED:"Not implemented",INVALID_FILENAME:"Invalid filename",INVALID_FORMAT:"Invalid or unsupported zip format. No END header found",ZIP64_VALUE_TOO_LARGE:"Zip64 value exceeds the maximum safe integer",INVALID_PASS_PARAM:"Incompatible password parameter",WRONG_PASSWORD:"Wrong Password",COMMENT_TOO_LONG:"Comment is too long",EXTRA_FIELD_PARSE_ERROR:"Extra field parsing error"};function RW(q){return function(...Q){if(Q.length)q=q.replace(/\{(\d)\}/g,(J,X)=>Q[X]||"");return Error("ADM-ZIP: "+q)}}for(let q of Object.keys(wq))Dq[q]=RW(wq[q])});var Hq=_((W0,Uq)=>{var TW=c("fs"),C=c("path"),Bq=Xq(),Yq=r(),IW=typeof process==="object"&&process.platform==="win32",Lq=(q)=>typeof q==="object"&&q!==null,Nq=new Uint32Array(256).map((q,Q)=>{for(let J=0;J<8;J++)if((Q&1)!==0)Q=3988292384^Q>>>1;else Q>>>=1;return Q>>>0});function g(q){if(this.sep=C.sep,this.fs=TW,Lq(q)){if(Lq(q.fs)&&typeof q.fs.statSync==="function")this.fs=q.fs}}Uq.exports=g;g.prototype.makeDir=function(q){let Q=this;function J(X){let G=X.split(Q.sep)[0];X.split(Q.sep).forEach(function(R){if(!R||R.substr(-1,1)===":")return;G+=Q.sep+R;var Y;try{Y=Q.fs.statSync(G)}catch(I){if(I.message&&I.message.startsWith("ENOENT"))Q.fs.mkdirSync(G);else throw I}if(Y&&Y.isFile())throw Yq.FILE_IN_THE_WAY(`"${G}"`)})}J(q)};g.prototype.writeFileTo=function(q,Q,J,X){let G=this;if(G.fs.existsSync(q)){if(!J)return!1;var R=G.fs.statSync(q);if(R.isDirectory())return!1}var Y=C.dirname(q);if(!G.fs.existsSync(Y))G.makeDir(Y);var I;try{I=G.fs.openSync(q,"w",438)}catch(L){G.fs.chmodSync(q,438),I=G.fs.openSync(q,"w",438)}if(I)try{G.fs.writeSync(I,Q,0,Q.length,0)}finally{G.fs.closeSync(I)}return G.fs.chmodSync(q,X||438),!0};g.prototype.writeFileToAsync=function(q,Q,J,X,G){if(typeof X==="function")G=X,X=void 0;let R=this;R.fs.exists(q,function(Y){if(Y&&!J)return G(!1);R.fs.stat(q,function(I,L){if(Y&&L&&L.isDirectory())return G(!1);var N=C.dirname(q);R.fs.exists(N,function(D){if(!D)try{R.makeDir(N)}catch(U){return G(!1)}let B=function(U){R.fs.write(U,Q,0,Q.length,0,function(H){R.fs.close(U,function(){if(H)return G(!1);R.fs.chmod(q,X||438,function(){G(!0)})})})};R.fs.open(q,"w",438,function(U,H){if(U)R.fs.chmod(q,438,function(){R.fs.open(q,"w",438,function($,K){if($||!K)return G(!1);B(K)})});else if(H)B(H);else G(!1)})})})})};g.prototype.assertPathSafe=function(q,Q){let J=this;if(typeof J.fs.lstatSync!=="function")return;let X=C.resolve(q),G=C.resolve(Q);if(G===X)return;let R=C.relative(X,G);if(!R||R===".."||R.startsWith(".."+C.sep)||C.isAbsolute(R))return;let Y=X;for(let I of R.split(C.sep)){if(!I||I===".")continue;Y=C.join(Y,I);let L;try{L=J.fs.lstatSync(Y)}catch(N){break}if(L.isSymbolicLink())throw Yq.FILE_IN_THE_WAY(`"${Y}"`)}};g.prototype.findFiles=function(q){let Q=this,J=typeof Q.fs.lstatSync==="function",X=Q.fs.realpathSync(q);function G(Y){if(!J)return!1;if(!Q.fs.lstatSync(Y).isSymbolicLink())return!1;let I;try{I=Q.fs.realpathSync(Y)}catch(L){return!0}return!(I===X||I.startsWith(X+C.sep))}function R(Y,I,L,N){if(typeof I==="boolean")L=I,I=void 0;let D=[];return Q.fs.readdirSync(Y).forEach(function(B){let U=C.join(Y,B);if(G(U))return;let H=Q.fs.statSync(U);if(!I||I.test(U))D.push(C.normalize(U)+(H.isDirectory()?Q.sep:""));if(H.isDirectory()&&L){let $=Q.fs.realpathSync(U);if(!N.has($))N.add($),D=D.concat(R(U,I,L,N))}}),D}return R(q,void 0,!0,new Set([X]))};g.prototype.findFilesAsync=function(q,Q){let J=this,X=[],G=!1,R=function(D){if(G)return;G=!0,Q(D,D?void 0:X)},Y=typeof J.fs.lstat==="function",I=null,L=function(D,B){if(!Y)return B(null,!1);J.fs.lstat(D,function(U,H){if(U)return B(U);if(!H||!H.isSymbolicLink())return B(null,!1);J.fs.realpath(D,function($,K){if($)return B(null,!0);B(null,!(K===I||K.startsWith(I+C.sep)))})})},N=function(D,B,U){J.fs.readdir(D,function(H,$){if(H)return U(H);let K=$.length;if(!K)return U();$.forEach(function(V){let Z=C.join(D,V);L(Z,function(T,W){if(T)return U(T);if(W){if(!--K)U();return}J.fs.stat(Z,function(M,j){if(M)return U(M);if(!j){if(!--K)U();return}if(X.push(C.normalize(Z)+(j.isDirectory()?J.sep:"")),!j.isDirectory()){if(!--K)U();return}J.fs.realpath(Z,function(F,O){if(F)return U(F);if(B.has(O)){if(!--K)U();return}B.add(O),N(Z,B,function(S){if(S)return U(S);if(!--K)U()})})})})})})};J.fs.realpath(q,function(D,B){if(D)return R(D);I=B,N(q,new Set([B]),R)})};g.prototype.getAttributes=function(){};g.prototype.setAttributes=function(){};g.crc32update=function(q,Q){return Nq[(q^Q)&255]^q>>>8};g.crc32=function(q){if(typeof q==="string")q=Buffer.from(q,"utf8");let Q=q.length,J=-1;for(let X=0;X<Q;)J=g.crc32update(J,q[X++]);return~J>>>0};g.methodToString=function(q){switch(q){case Bq.STORED:return"STORED ("+q+")";case Bq.DEFLATED:return"DEFLATED ("+q+")";default:return"UNSUPPORTED ("+q+")"}};g.canonical=function(q){if(!q)return"";let Q=C.posix.normalize("/"+q.split("\\").join("/"));return C.join(".",Q)};g.zipnamefix=function(q){if(!q)return"";let Q=C.posix.normalize("/"+q.split("\\").join("/"));return C.posix.join(".",Q)};g.findLast=function(q,Q){if(!Array.isArray(q))throw TypeError("arr is not array");let J=q.length>>>0;for(let X=J-1;X>=0;X--)if(Q(q[X],X,q))return q[X];return};g.sanitize=function(q,Q){q=C.resolve(C.normalize(q));var J=Q.split("/");for(var X=0,G=J.length;X<G;X++){var R=C.normalize(C.join(q,J.slice(X,G).join(C.sep)));if(R===q||R.startsWith(q+C.sep))return R}return C.normalize(C.join(q,C.basename(Q)))};g.toBuffer=function(Q,J){if(Buffer.isBuffer(Q))return Q;else if(Q instanceof Uint8Array)return Buffer.from(Q);else return typeof Q==="string"?J(Q):Buffer.alloc(0)};g.readBigUInt64LE=function(q,Q){let J=q.readUInt32LE(Q),G=q.readUInt32LE(Q+4)*4294967296+J;if(G>Number.MAX_SAFE_INTEGER)throw Yq.ZIP64_VALUE_TOO_LARGE();return G};g.writeBigUInt64LE=function(q,Q,J){let X=Q>>>0,G=Math.floor(Q/4294967296)>>>0;q.writeUInt32LE(X,J),q.writeUInt32LE(G,J+4)};g.fromDOS2Date=function(q){return new Date((q>>25&127)+1980,Math.max((q>>21&15)-1,0),Math.max(q>>16&31,1),q>>11&31,q>>5&63,(q&31)<<1)};g.fromDate2DOS=function(q){let Q=0,J=0;if(q.getFullYear()>1979)Q=(q.getFullYear()-1980&127)<<9|q.getMonth()+1<<5|q.getDate(),J=q.getHours()<<11|q.getMinutes()<<5|q.getSeconds()>>1;return Q<<16|J};g.isWin=IW;g.crcTable=Nq});var Eq=_((J0,xq)=>{var AW=c("path");xq.exports=function(q,{fs:Q}){var J=q||"",X=R(),G=null;function R(){return{directory:!1,readonly:!1,hidden:!1,executable:!1,mtime:0,atime:0}}if(J&&Q.existsSync(J))G=Q.statSync(J),X.directory=G.isDirectory(),X.mtime=G.mtime,X.atime=G.atime,X.executable=(73&G.mode)!==0,X.readonly=(128&G.mode)===0,X.hidden=AW.basename(J)[0]===".";else console.warn("Invalid path: "+J);return{get directory(){return X.directory},get readOnly(){return X.readonly},get hidden(){return X.hidden},get mtime(){return X.mtime},get atime(){return X.atime},get executable(){return X.executable},decodeAttributes:function(){},encodeAttributes:function(){},toJSON:function(){return{path:J,isDirectory:X.directory,isReadOnly:X.readonly,isHidden:X.hidden,isExecutable:X.executable,mTime:X.mtime,aTime:X.atime}},toString:function(){return JSON.stringify(this.toJSON(),null,"\t")}}}});var Cq=_((Q0,zq)=>{zq.exports={efs:!0,encode:(q)=>Buffer.from(q,"utf8"),decode:(q)=>q.toString("utf8")}});var l=_((X0,i)=>{i.exports=Hq();i.exports.Constants=Xq();i.exports.Errors=r();i.exports.FileAttr=Eq();i.exports.decoder=Cq()});var gq=_((Y0,Pq)=>{var f=l(),A=f.Constants;Pq.exports=function(){var q=20,Q=10,J=0,X=0,G=0,R=0,Y=0,I=0,L=0,N=0,D=0,B=0,U=0,H=0,$=0;q|=f.isWin?2560:768,J|=A.FLG_EFS;let K={extraLen:0},V=(W)=>Math.max(0,W)>>>0,Z=(W)=>Math.max(0,W)&65535,T=(W)=>Math.max(0,W)&255;return G=f.fromDate2DOS(new Date),{get made(){return q},set made(W){q=W},get version(){return Q},set version(W){Q=W},get flags(){return J},set flags(W){J=W},get flags_efs(){return(J&A.FLG_EFS)>0},set flags_efs(W){if(W)J|=A.FLG_EFS;else J&=~A.FLG_EFS},get flags_desc(){return(J&A.FLG_DESC)>0},set flags_desc(W){if(W)J|=A.FLG_DESC;else J&=~A.FLG_DESC},get method(){return X},set method(W){switch(W){case A.STORED:this.version=10;break;case A.DEFLATED:default:this.version=20}X=W},get time(){return f.fromDOS2Date(this.timeval)},set time(W){W=new Date(W),this.timeval=f.fromDate2DOS(W)},get timeval(){return G},set timeval(W){G=V(W)},get timeHighByte(){return T(G>>>8)},get crc(){return R},set crc(W){R=V(W)},get compressedSize(){return Y},set compressedSize(W){Y=V(W)},get size(){return I},set size(W){I=V(W)},get fileNameLength(){return L},set fileNameLength(W){L=W},get extraLength(){return N},set extraLength(W){N=W},get extraLocalLength(){return K.extraLen},set extraLocalLength(W){K.extraLen=W},get commentLength(){return D},set commentLength(W){D=W},get diskNumStart(){return B},set diskNumStart(W){B=V(W)},get inAttr(){return U},set inAttr(W){U=V(W)},get attr(){return H},set attr(W){H=V(W)},get fileAttr(){return(H||0)>>16&511},get offset(){return $},set offset(W){$=V(W)},get encrypted(){return(J&A.FLG_ENC)===A.FLG_ENC},get centralHeaderSize(){return A.CENHDR+L+N+D},get realDataOffset(){return $+A.LOCHDR+K.fnameLen+K.extraLen},get localHeader(){return K},loadLocalHeaderFromBinary:function(W){if($<0||$+A.LOCHDR>W.length)throw f.Errors.INVALID_LOC();var M=W.slice($,$+A.LOCHDR);if(M.readUInt32LE(0)!==A.LOCSIG)throw f.Errors.INVALID_LOC();K.version=M.readUInt16LE(A.LOCVER),K.flags=M.readUInt16LE(A.LOCFLG),K.flags_desc=(K.flags&A.FLG_DESC)>0,K.method=M.readUInt16LE(A.LOCHOW),K.time=M.readUInt32LE(A.LOCTIM),K.crc=M.readUInt32LE(A.LOCCRC),K.compressedSize=M.readUInt32LE(A.LOCSIZ),K.size=M.readUInt32LE(A.LOCLEN),K.fnameLen=M.readUInt16LE(A.LOCNAM),K.extraLen=M.readUInt16LE(A.LOCEXT);let j=$+A.LOCHDR+K.fnameLen,F=j+K.extraLen;return W.slice(j,F)},loadFromBinary:function(W){if(W.length!==A.CENHDR||W.readUInt32LE(0)!==A.CENSIG)throw f.Errors.INVALID_CEN();q=W.readUInt16LE(A.CENVEM),Q=W.readUInt16LE(A.CENVER),J=W.readUInt16LE(A.CENFLG),X=W.readUInt16LE(A.CENHOW),G=W.readUInt32LE(A.CENTIM),R=W.readUInt32LE(A.CENCRC),Y=W.readUInt32LE(A.CENSIZ),I=W.readUInt32LE(A.CENLEN),L=W.readUInt16LE(A.CENNAM),N=W.readUInt16LE(A.CENEXT),D=W.readUInt16LE(A.CENCOM),B=W.readUInt16LE(A.CENDSK),U=W.readUInt16LE(A.CENATT),H=W.readUInt32LE(A.CENATX),$=W.readUInt32LE(A.CENOFF)},localHeaderToBinary:function(){var W=Buffer.alloc(A.LOCHDR);return W.writeUInt32LE(A.LOCSIG,0),W.writeUInt16LE(Q,A.LOCVER),W.writeUInt16LE(J&~A.FLG_DESC,A.LOCFLG),W.writeUInt16LE(X,A.LOCHOW),W.writeUInt32LE(G,A.LOCTIM),W.writeUInt32LE(R,A.LOCCRC),W.writeUInt32LE(Y,A.LOCSIZ),W.writeUInt32LE(I,A.LOCLEN),W.writeUInt16LE(L,A.LOCNAM),W.writeUInt16LE(K.extraLen,A.LOCEXT),W},centralHeaderToBinary:function(){var W=Buffer.alloc(A.CENHDR+L+N+D);return W.writeUInt32LE(A.CENSIG,0),W.writeUInt16LE(q,A.CENVEM),W.writeUInt16LE(Q,A.CENVER),W.writeUInt16LE(J&~A.FLG_DESC,A.CENFLG),W.writeUInt16LE(X,A.CENHOW),W.writeUInt32LE(G,A.CENTIM),W.writeUInt32LE(R,A.CENCRC),W.writeUInt32LE(Y,A.CENSIZ),W.writeUInt32LE(I,A.CENLEN),W.writeUInt16LE(L,A.CENNAM),W.writeUInt16LE(N,A.CENEXT),W.writeUInt16LE(D,A.CENCOM),W.writeUInt16LE(B,A.CENDSK),W.writeUInt16LE(U,A.CENATT),W.writeUInt32LE(H,A.CENATX),W.writeUInt32LE($,A.CENOFF),W},toJSON:function(){let W=function(M){return M+" bytes"};return{made:q,version:Q,flags:J,method:f.methodToString(X),time:this.time,crc:"0x"+R.toString(16).toUpperCase(),compressedSize:W(Y),size:W(I),fileNameLength:W(L),extraLength:W(N),commentLength:W(D),diskNumStart:B,inAttr:U,attr:H,offset:$,centralHeaderSize:W(A.CENHDR+L+N+D)}},toString:function(){return JSON.stringify(this.toJSON(),null,"\t")}}}});var vq=_(($0,kq)=>{var m=l(),w=m.Constants;kq.exports=function(){var q=0,Q=0,J=0,X=0,G=0;let R=()=>q>w.EF_ZIP64_OR_16||Q>w.EF_ZIP64_OR_16||J>w.EF_ZIP64_OR_32||X>w.EF_ZIP64_OR_32;return{get diskEntries(){return q},set diskEntries(Y){q=Q=Y},get totalEntries(){return Q},set totalEntries(Y){Q=q=Y},get size(){return J},set size(Y){J=Y},get offset(){return X},set offset(Y){X=Y},get commentLength(){return G},set commentLength(Y){G=Y},get mainHeaderSize(){return(R()?w.ZIP64HDR+w.END64HDR:0)+w.ENDHDR+G},loadFromBinary:function(Y){if((Y.length!==w.ENDHDR||Y.readUInt32LE(0)!==w.ENDSIG)&&(Y.length<w.ZIP64HDR||Y.readUInt32LE(0)!==w.ZIP64SIG))throw m.Errors.INVALID_END();if(Y.readUInt32LE(0)===w.ENDSIG)q=Y.readUInt16LE(w.ENDSUB),Q=Y.readUInt16LE(w.ENDTOT),J=Y.readUInt32LE(w.ENDSIZ),X=Y.readUInt32LE(w.ENDOFF),G=Y.readUInt16LE(w.ENDCOM);else q=m.readBigUInt64LE(Y,w.ZIP64SUB),Q=m.readBigUInt64LE(Y,w.ZIP64TOT),J=m.readBigUInt64LE(Y,w.ZIP64SIZB),X=m.readBigUInt64LE(Y,w.ZIP64OFF),G=0},toBinary:function(){if(!R()){var Y=Buffer.alloc(w.ENDHDR+G);return Y.writeUInt32LE(w.ENDSIG,0),Y.writeUInt32LE(0,4),Y.writeUInt16LE(q,w.ENDSUB),Y.writeUInt16LE(Q,w.ENDTOT),Y.writeUInt32LE(J,w.ENDSIZ),Y.writeUInt32LE(X,w.ENDOFF),Y.writeUInt16LE(G,w.ENDCOM),Y.fill(" ",w.ENDHDR),Y}var Y=Buffer.alloc(this.mainHeaderSize);let I=0;Y.writeUInt32LE(w.ZIP64SIG,I),m.writeBigUInt64LE(Y,w.ZIP64HDR-w.ZIP64LEAD,I+w.ZIP64SIZE),Y.writeUInt16LE(45,I+w.ZIP64VEM),Y.writeUInt16LE(45,I+w.ZIP64VER),Y.writeUInt32LE(0,I+w.ZIP64DSK),Y.writeUInt32LE(0,I+w.ZIP64DSKDIR),m.writeBigUInt64LE(Y,q,I+w.ZIP64SUB),m.writeBigUInt64LE(Y,Q,I+w.ZIP64TOT),m.writeBigUInt64LE(Y,J,I+w.ZIP64SIZB),m.writeBigUInt64LE(Y,X,I+w.ZIP64OFF);let L=X+J;return I+=w.ZIP64HDR,Y.writeUInt32LE(w.END64SIG,I),Y.writeUInt32LE(0,I+w.END64START),m.writeBigUInt64LE(Y,L,I+w.END64OFF),Y.writeUInt32LE(1,I+w.END64NUMDISKS),I+=w.END64HDR,Y.writeUInt32LE(w.ENDSIG,I),Y.writeUInt32LE(0,I+4),Y.writeUInt16LE(Math.min(q,w.EF_ZIP64_OR_16),I+w.ENDSUB),Y.writeUInt16LE(Math.min(Q,w.EF_ZIP64_OR_16),I+w.ENDTOT),Y.writeUInt32LE(Math.min(J,w.EF_ZIP64_OR_32),I+w.ENDSIZ),Y.writeUInt32LE(Math.min(X,w.EF_ZIP64_OR_32),I+w.ENDOFF),Y.writeUInt16LE(G,I+w.ENDCOM),Y.fill(" ",I+w.ENDHDR),Y},toJSON:function(){let Y=function(I,L){let N=I.toString(16).toUpperCase();while(N.length<L)N="0"+N;return"0x"+N};return{diskEntries:q,totalEntries:Q,size:J+" bytes",offset:Y(X,4),commentLength:G}},toString:function(){return JSON.stringify(this.toJSON(),null,"\t")}}}});var $q=_((jW)=>{jW.EntryHeader=gq();jW.MainHeader=vq()});var uq=_((K0,bq)=>{bq.exports=function(q){var Q=c("zlib"),J={chunkSize:(parseInt(q.length/1024)+1)*1024};return{deflate:function(){return Q.deflateRawSync(q,J)},deflateAsync:function(X){var G=Q.createDeflateRaw(J),R=[],Y=0;G.on("data",function(I){R.push(I),Y+=I.length}),G.on("end",function(){var I=Buffer.alloc(Y),L=0;I.fill(0);for(var N=0;N<R.length;N++){var D=R[N];D.copy(I,L),L+=D.length}X&&X(I)}),G.end(q)}}}});var yq=_((V0,_q)=>{var SW=+(process?.versions?.node??"").split(".")[0]||0,wW=r();_q.exports=function(q,Q){var J=c("zlib");let X=Q>0?Q:1,G=SW>=15?{maxOutputLength:X}:{};return{inflate:function(){return J.inflateRawSync(q,G)},inflateAsync:function(R){var Y=J.createInflateRaw(G),I=[],L=0,N=!1;let D=function(B){if(N)return;N=!0,Y.destroy(),R&&R(Buffer.alloc(0),B)};Y.on("error",function(B){D(B)}),Y.on("data",function(B){if(N)return;if(L+=B.length,L>X)return D(wW.MAX_OUTPUT_EXCEEDED());I.push(B)}),Y.on("end",function(){if(N)return;N=!0;var B=Buffer.alloc(L),U=0;B.fill(0);for(var H=0;H<I.length;H++){var $=I[H];$.copy(B,U),U+=$.length}R&&R(B)}),Y.end(q)}}}});var dq=_((M0,pq)=>{var{randomFillSync:hq}=c("crypto"),DW=r(),BW=new Uint32Array(256).map((q,Q)=>{for(let J=0;J<8;J++)if((Q&1)!==0)Q=Q>>>1^3988292384;else Q>>>=1;return Q>>>0}),fq=(q,Q)=>Math.imul(q,Q)>>>0,mq=(q,Q)=>{return BW[(q^Q)&255]^q>>>8},a=()=>{if(typeof hq==="function")return hq(Buffer.alloc(12));else return a.node()};a.node=()=>{let q=Buffer.alloc(12),Q=q.length;for(let J=0;J<Q;J++)q[J]=Math.random()*256&255;return q};var qq={genSalt:a};function Wq(q){let Q=Buffer.isBuffer(q)?q:Buffer.from(q);this.keys=new Uint32Array([305419896,591751049,878082192]);for(let J=0;J<Q.length;J++)this.updateKeys(Q[J])}Wq.prototype.updateKeys=function(q){let Q=this.keys;return Q[0]=mq(Q[0],q),Q[1]+=Q[0]&255,Q[1]=fq(Q[1],134775813)+1,Q[2]=mq(Q[2],Q[1]>>>24),q};Wq.prototype.next=function(){let q=(this.keys[2]|2)>>>0;return fq(q,q^1)>>8&255};function LW(q){let Q=new Wq(q);return function(J){let X=Buffer.alloc(J.length),G=0;for(let R of J)X[G++]=Q.updateKeys(R^Q.next());return X}}function NW(q){let Q=new Wq(q);return function(J,X,G=0){if(!X)X=Buffer.alloc(J.length);for(let R of J){let Y=Q.next();X[G++]=R^Y,Q.updateKeys(R)}return X}}function UW(q,Q,J){if(!q||!Buffer.isBuffer(q)||q.length<12)return Buffer.alloc(0);let X=LW(J),G=X(q.slice(0,12)),R=(Q.flags&8)===8?Q.timeHighByte:Q.crc>>>24;if(G[11]!==R)throw DW.WRONG_PASSWORD();return X(q.slice(12))}function HW(q){if(Buffer.isBuffer(q)&&q.length>=12)qq.genSalt=function(){return q.slice(0,12)};else if(q==="node")qq.genSalt=a.node;else qq.genSalt=a}function xW(q,Q,J,X=!1){if(q==null)q=Buffer.alloc(0);if(!Buffer.isBuffer(q))q=Buffer.from(q.toString());let G=NW(J),R=qq.genSalt();if(R[11]=Q.crc>>>24&255,X)R[10]=Q.crc>>>16&255;let Y=Buffer.alloc(q.length+12);return G(R,Y),G(q,Y,12)}pq.exports={decrypt:UW,encrypt:xW,_salter:HW}});var cq=_((EW)=>{EW.Deflater=uq();EW.Inflater=yq();EW.ZipCrypto=dq()});var Kq=_((R0,oq)=>{var P=l(),gW=$q(),h=P.Constants,Gq=cq();oq.exports=function(q,Q){var J=new gW.EntryHeader,X=Buffer.alloc(0),G=Buffer.alloc(0),R=!1,Y=null,I=Buffer.alloc(0),L=Buffer.alloc(0),N=!0;let D=q,B=typeof D.decoder==="object"?D.decoder:P.decoder;N=B.hasOwnProperty("efs")?B.efs:!1;function U(){if(!Q||!(Q instanceof Uint8Array))return Buffer.alloc(0);L=J.loadLocalHeaderFromBinary(Q);let W=J.realDataOffset,M=W+J.compressedSize;if(W<0||M<W||M>Q.length)throw P.Errors.INVALID_LOC();return Q.slice(W,M)}function H(W){let M=J.flags_desc||J.localHeader.flags_desc?J.crc:J.localHeader.crc;return P.crc32(W)===M}function $(W,M,j){if(typeof M>"u"&&typeof W==="string")j=W,W=void 0;if(R){if(W&&M)M(Buffer.alloc(0),P.Errors.DIRECTORY_CONTENT_ERROR());return Buffer.alloc(0)}var F;try{if(F=U(),F.length===0){if(W&&M)M(F);return F}if(J.encrypted){if(typeof j!=="string"&&!Buffer.isBuffer(j))throw P.Errors.INVALID_PASS_PARAM();F=Gq.ZipCrypto.decrypt(F,J,j)}}catch(x){if(W&&M)return M(Buffer.alloc(0),x),Buffer.alloc(0);throw x}var O;switch(J.method){case P.Constants.STORED:if(O=Buffer.alloc(F.length),F.copy(O),!H(O)){if(W&&M)M(O,P.Errors.BAD_CRC());throw P.Errors.BAD_CRC()}else{if(W&&M)M(O);return O}case P.Constants.DEFLATED:var S=new Gq.Inflater(F,J.size);if(!W){if(O=S.inflate(),!H(O))throw P.Errors.BAD_CRC(`"${B.decode(X)}"`);return O}else S.inflateAsync(function(x,E){if(!M)return;if(E)M(Buffer.alloc(0),E);else if(!H(x))M(x,P.Errors.BAD_CRC());else M(x)});break;default:if(W&&M)M(Buffer.alloc(0),P.Errors.UNKNOWN_METHOD());throw P.Errors.UNKNOWN_METHOD()}}function K(W,M){if((!Y||!Y.length)&&Buffer.isBuffer(Q)){if(W&&M)M(U());return U()}if(Y.length&&!R){var j;switch(J.method){case P.Constants.STORED:if(J.compressedSize=J.size,j=Buffer.alloc(Y.length),Y.copy(j),W&&M)M(j);return j;default:case P.Constants.DEFLATED:var F=new Gq.Deflater(Y);if(!W){var O=F.deflate();return J.compressedSize=O.length,O}else F.deflateAsync(function(S){j=Buffer.alloc(S.length),J.compressedSize=S.length,S.copy(j),M&&M(j)});F=null;break}}else if(W&&M)M(Buffer.alloc(0));else return Buffer.alloc(0)}function V(W,M){return P.readBigUInt64LE(W,M)}function Z(W){try{var M=0,j,F,O;while(M+4<W.length)if(j=W.readUInt16LE(M),M+=2,F=W.readUInt16LE(M),M+=2,O=W.slice(M,M+F),M+=F,h.ID_ZIP64===j)T(O)}catch(S){throw P.Errors.EXTRA_FIELD_PARSE_ERROR()}}function T(W){var M,j,F,O;if(W.length>=h.EF_ZIP64_SCOMP){if(M=V(W,h.EF_ZIP64_SUNCOMP),J.size===h.EF_ZIP64_OR_32)J.size=M}if(W.length>=h.EF_ZIP64_RHO){if(j=V(W,h.EF_ZIP64_SCOMP),J.compressedSize===h.EF_ZIP64_OR_32)J.compressedSize=j}if(W.length>=h.EF_ZIP64_DSN){if(F=V(W,h.EF_ZIP64_RHO),J.offset===h.EF_ZIP64_OR_32)J.offset=F}if(W.length>=h.EF_ZIP64_DSN+4){if(O=W.readUInt32LE(h.EF_ZIP64_DSN),J.diskNumStart===h.EF_ZIP64_OR_16)J.diskNumStart=O}}return{get entryName(){return B.decode(X)},get rawEntryName(){return X},set entryName(W){X=P.toBuffer(W,B.encode);var M=X[X.length-1];R=M===47||M===92,J.fileNameLength=X.length},get efs(){if(typeof N==="function")return N(this.entryName);else return N},get extra(){return I},set extra(W){I=W,J.extraLength=W.length,Z(W)},get comment(){return B.decode(G)},set comment(W){if(G=P.toBuffer(W,B.encode),J.commentLength=G.length,G.length>65535)throw P.Errors.COMMENT_TOO_LONG()},get name(){let W=B.decode(X);return R?W.replace(/[/\\]$/,"").split("/").pop():W.split("/").pop()},get isDirectory(){return R},getCompressedData:function(){return K(!1,null)},getCompressedDataAsync:function(W){K(!0,W)},setData:function(W){if(Y=P.toBuffer(W,P.decoder.encode),!R&&Y.length)J.size=Y.length,J.method=P.Constants.DEFLATED,J.crc=P.crc32(W),J.changed=!0;else J.method=P.Constants.STORED},getData:function(W){if(J.changed)return Y;else return $(!1,null,W)},getDataAsync:function(W,M){if(J.changed)W(Y);else $(!0,W,M)},set attr(W){J.attr=W},get attr(){return J.attr},set header(W){J.loadFromBinary(W)},get header(){return J},packCentralHeader:function(){J.flags_efs=this.efs,J.extraLength=I.length;var W=J.centralHeaderToBinary(),M=P.Constants.CENHDR;return X.copy(W,M),M+=X.length,I.copy(W,M),M+=J.extraLength,G.copy(W,M),W},packLocalHeader:function(){let W=0;J.flags_efs=this.efs,J.extraLocalLength=L.length;let M=J.localHeaderToBinary(),j=Buffer.alloc(M.length+X.length+J.extraLocalLength);return M.copy(j,W),W+=M.length,X.copy(j,W),W+=X.length,L.copy(j,W),W+=L.length,j},toJSON:function(){let W=function(M){return"<"+(M&&M.length+" bytes buffer"||"null")+">"};return{entryName:this.entryName,name:this.name,comment:this.comment,isDirectory:this.isDirectory,header:J.toJSON(),compressedData:W(Q),data:W(Y)}},toString:function(){return JSON.stringify(this.toJSON(),null,"\t")}}}});var sq=_((T0,lq)=>{var iq=Kq(),kW=$q(),y=l();lq.exports=function(q,Q){var J=[],X=Object.create(null),G=Buffer.alloc(0),R=new kW.MainHeader,Y=!1,I=null;let L=new Set,N=Q,{noSort:D,decoder:B}=N;if(q)$(N.readEntries);else Y=!0;function U(){let V=new Set;for(let Z of Object.keys(X)){let T=Z.split("/");if(T.pop(),!T.length)continue;for(let W=0;W<T.length;W++){let M=T.slice(0,W+1).join("/")+"/";V.add(M)}}for(let Z of V)if(!(Z in X)){let T=new iq(N);T.entryName=Z,T.attr=16,T.temporary=!0,J.push(T),X[T.entryName]=T,L.add(T)}}function H(){if(Y=!0,X=Object.create(null),R.diskEntries>(q.length-R.offset)/y.Constants.CENHDR)throw y.Errors.DISK_ENTRY_TOO_LARGE();J=Array(R.diskEntries);var V=R.offset;for(var Z=0;Z<J.length;Z++){var T=V,W=new iq(N,q);if(W.header=q.slice(T,T+=y.Constants.CENHDR),W.entryName=q.slice(T,T+=W.header.fileNameLength),W.header.extraLength)W.extra=q.slice(T,T+=W.header.extraLength);if(W.header.commentLength)W.comment=q.slice(T,T+W.header.commentLength);if(V+=W.header.centralHeaderSize,W.entryName in X)throw y.Errors.DUPLICATE_ENTRY(`"${W.entryName}"`);J[Z]=W,X[W.entryName]=W}L.clear(),U()}function $(V){var Z=q.length-y.Constants.ENDHDR,T=Math.max(0,Z-65535),W=T,M=q.length,j=-1,F=0;if(typeof N.trailingSpace==="boolean"?N.trailingSpace:!1)T=0;for(Z;Z>=W;Z--){if(q[Z]!==80)continue;if(q.readUInt32LE(Z)===y.Constants.ENDSIG){j=Z,F=Z,M=Z+y.Constants.ENDHDR,W=Z-y.Constants.END64HDR;continue}if(q.readUInt32LE(Z)===y.Constants.END64SIG){W=T;continue}if(q.readUInt32LE(Z)===y.Constants.ZIP64SIG){j=Z,M=Z+y.readBigUInt64LE(q,Z+y.Constants.ZIP64SIZE)+y.Constants.ZIP64LEAD;break}}if(j==-1)throw y.Errors.INVALID_FORMAT();if(R.loadFromBinary(q.slice(j,M)),R.commentLength)G=q.slice(F+y.Constants.ENDHDR);if(V)H()}function K(){if(J.length>1&&!D)J=J.map((V)=>({entry:V,key:V.entryName.toLowerCase()})).sort((V,Z)=>V.key.localeCompare(Z.key)).map((V)=>V.entry)}return{get entries(){if(!Y)H();return J.filter((V)=>!L.has(V))},get comment(){return B.decode(G)},set comment(V){G=y.toBuffer(V,B.encode),R.commentLength=G.length},getEntryCount:function(){if(!Y)return R.diskEntries;return J.length},forEach:function(V){this.entries.forEach(V)},getEntry:function(V){if(!Y)H();return X[V]||null},setEntry:function(V){if(!Y)H();J.push(V),X[V.entryName]=V,R.totalEntries=J.length},deleteFile:function(V,Z=!0){if(!Y)H();let T=X[V];this.getEntryChildren(T,Z).map((M)=>M.entryName).forEach(this.deleteEntry)},deleteEntry:function(V){if(!Y)H();let Z=X[V],T=J.indexOf(Z);if(T>=0)J.splice(T,1),delete X[V],R.totalEntries=J.length},getEntryChildren:function(V,Z=!0){if(!Y)H();if(typeof V==="object")if(V.isDirectory&&Z){let T=[],W=V.entryName;for(let M of J)if(M.entryName.startsWith(W))T.push(M);return T}else return[V];return[]},getChildCount:function(V){if(V&&V.isDirectory){let Z=this.getEntryChildren(V);return Z.includes(V)?Z.length-1:Z.length}return 0},compressToBuffer:function(){if(!Y)H();K();let V=[],Z=[],T=0,W=0;R.size=0,R.offset=0;let M=0;for(let O of this.entries){let S=O.getCompressedData();O.header.offset=W;let x=O.packLocalHeader(),E=x.length+S.length;W+=E,V.push(x),V.push(S);let z=O.packCentralHeader();Z.push(z),R.size+=z.length,T+=E+z.length,M++}T+=R.mainHeaderSize,R.offset=W,R.totalEntries=M,W=0;let j=Buffer.alloc(T);for(let O of V)O.copy(j,W),W+=O.length;for(let O of Z)O.copy(j,W),W+=O.length;let F=R.toBinary();if(G)G.copy(F,F.length-G.length);return F.copy(j,W),q=j,Y=!1,j},toAsyncBuffer:function(V,Z,T,W){try{if(!Y)H();K();let M=[],j=[],F=0,O=0,S=0;R.size=0,R.offset=0;let x=function(E){if(E.length>0){let z=E.shift(),b=z.entryName+z.extra.toString();if(T)T(b);z.getCompressedDataAsync(function(u){if(W)W(b);z.header.offset=O;let d=z.packLocalHeader(),e=d.length+u.length;O+=e,M.push(d),M.push(u);let s=z.packCentralHeader();j.push(s),R.size+=s.length,F+=e+s.length,S++,x(E)})}else{F+=R.mainHeaderSize,R.offset=O,R.totalEntries=S,O=0;let z=Buffer.alloc(F);M.forEach(function(u){u.copy(z,O),O+=u.length}),j.forEach(function(u){u.copy(z,O),O+=u.length});let b=R.toBinary();if(G)G.copy(b,b.length-G.length);b.copy(z,O),q=z,Y=!1,V(z)}};x(Array.from(this.entries))}catch(M){Z(M)}}}}});var aq=_((I0,rq)=>{var v=l(),k=c("path"),vW=Kq(),bW=sq(),o=(...q)=>v.findLast(q,(Q)=>typeof Q==="boolean"),nq=(...q)=>v.findLast(q,(Q)=>typeof Q==="string"),uW=(...q)=>v.findLast(q,(Q)=>typeof Q==="function"),_W={noSort:!1,readEntries:!1,method:v.Constants.NONE,fs:null};rq.exports=function(q,Q){let J=null,X=Object.assign(Object.create(null),_W);if(q&&typeof q==="object"){if(!(q instanceof Uint8Array)){if(Object.assign(X,q),q=X.input?X.input:void 0,X.input)delete X.input}if(Buffer.isBuffer(q))J=q,X.method=v.Constants.BUFFER,q=void 0}Object.assign(X,Q);let G=new v(X),R=($)=>{$.filter((K)=>K.attr).sort((K,V)=>V.path.length-K.path.length).forEach((K)=>G.fs.chmodSync(K.path,K.attr))};if(typeof X.decoder!=="object"||typeof X.decoder.encode!=="function"||typeof X.decoder.decode!=="function")X.decoder=v.decoder;if(q&&typeof q==="string")if(G.fs.existsSync(q))X.method=v.Constants.FILE,X.filename=q,J=G.fs.readFileSync(q);else throw v.Errors.INVALID_FILENAME();let Y=new bW(J,X),{canonical:I,sanitize:L,zipnamefix:N}=v;function D($){if($&&Y){var K;if(typeof $==="string")K=Y.getEntry(k.posix.normalize($));if(typeof $==="object"&&typeof $.entryName<"u"&&typeof $.header<"u")K=Y.getEntry($.entryName);if(K)return K}return null}function B($){let{join:K,normalize:V,sep:Z}=k.posix;return K(k.isAbsolute($)?"/":".",V(Z+$.split("\\").join(Z)+Z))}function U($){if($ instanceof RegExp)return function(K){return function(V){return K.test(V)}}($);else if(typeof $!=="function")return()=>!0;return $}let H=($,K)=>{let V=K.slice(-1);return V=V===G.sep?G.sep:"",k.relative($,K)+V};return{readFile:function($,K){var V=D($);return V&&V.getData(K)||null},childCount:function($){let K=D($);if(K)return Y.getChildCount(K)},readFileAsync:function($,K){var V=D($);if(V)V.getDataAsync(K);else K(null,"getEntry failed for:"+$)},readAsText:function($,K){var V=D($);if(V){var Z=V.getData();if(Z&&Z.length)return Z.toString(K||"utf8")}return""},readAsTextAsync:function($,K,V){var Z=D($);if(Z)Z.getDataAsync(function(T,W){if(W){K(T,W);return}if(T&&T.length)K(T.toString(V||"utf8"));else K("")});else K("")},deleteFile:function($,K=!0){var V=D($);if(V)Y.deleteFile(V.entryName,K)},deleteEntry:function($){var K=D($);if(K)Y.deleteEntry(K.entryName)},addZipComment:function($){Y.comment=$},getZipComment:function(){return Y.comment||""},addZipEntryComment:function($,K){var V=D($);if(V)V.comment=K},getZipEntryComment:function($){var K=D($);if(K)return K.comment||"";return""},updateFile:function($,K){var V=D($);if(V)V.setData(K)},addLocalFile:function($,K,V,Z){if(G.fs.existsSync($)){K=K?B(K):"";let T=k.win32.basename(k.win32.normalize($));K+=V?V:T;let W=G.fs.statSync($),M=W.isFile()?G.fs.readFileSync($):Buffer.alloc(0);if(W.isDirectory())K+=G.sep;this.addFile(K,M,Z,W)}else throw v.Errors.FILE_NOT_FOUND($)},addLocalFileAsync:function($,K){$=typeof $==="object"?$:{localPath:$};let V=k.resolve($.localPath),{comment:Z}=$,{zipPath:T,zipName:W}=$,M=this;G.fs.stat(V,function(j,F){if(j)return K(j,!1);T=T?B(T):"";let O=k.win32.basename(k.win32.normalize(V));if(T+=W?W:O,F.isFile())G.fs.readFile(V,function(S,x){if(S)return K(S,!1);return M.addFile(T,x,Z,F),setImmediate(K,void 0,!0)});else if(F.isDirectory())return T+=G.sep,M.addFile(T,Buffer.alloc(0),Z,F),setImmediate(K,void 0,!0)})},addLocalFolder:function($,K,V){if(V=U(V),K=K?B(K):"",$=k.normalize($),G.fs.existsSync($)){let Z=G.findFiles($),T=this;if(Z.length)for(let W of Z){let M=k.join(K,H($,W));if(V(M))T.addLocalFile(W,k.dirname(M))}}else throw v.Errors.FILE_NOT_FOUND($)},addLocalFolderAsync:function($,K,V,Z){Z=U(Z),V=V?B(V):"",$=k.normalize($);var T=this;G.fs.open($,"r",function(W){if(W&&W.code==="ENOENT")K(void 0,v.Errors.FILE_NOT_FOUND($));else if(W)K(void 0,W);else{var M=G.findFiles($),j=-1,F=function(){if(j+=1,j<M.length){var O=M[j],S=H($,O).split("\\").join("/");if(S=S.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^\x20-\x7E]/g,""),Z(S))G.fs.stat(O,function(x,E){if(x)K(void 0,x);if(E.isFile())G.fs.readFile(O,function(z,b){if(z)K(void 0,z);else T.addFile(V+S,b,"",E),F()});else T.addFile(V+S+"/",Buffer.alloc(0),"",E),F()});else process.nextTick(()=>{F()})}else K(!0,void 0)};F()}})},addLocalFolderAsync2:function($,K){let V=this;$=typeof $==="object"?$:{localPath:$};let Z=k.resolve($.localPath),{zipPath:T,filter:W,namefix:M}=$;if(W instanceof RegExp)W=function(O){return function(S){return O.test(S)}}(W);else if(typeof W!=="function")W=function(){return!0};if(T=T?B(T):"",M==="latin1")M=(O)=>O.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^\x20-\x7E]/g,"");if(typeof M!=="function")M=(O)=>O;let j=(O)=>k.join(T,M(H(Z,O))),F=(O)=>k.win32.basename(k.win32.normalize(M(O)));G.fs.open(Z,"r",function(O){if(O&&O.code==="ENOENT")K(v.Errors.FILE_NOT_FOUND(Z),!1);else if(O)K(O,!1);else G.findFilesAsync(Z,function(S,x){if(S)return K(S,!1);if(x=x.filter((E)=>W(j(E))),!x.length)return K(void 0,!0);setImmediate(x.reverse().reduce(function(E,z){return function(b,u){if(b||u===!1)return setImmediate(E,b,!1);V.addLocalFileAsync({localPath:z,zipPath:k.dirname(j(z)),zipName:F(z)},E)}},K))})})},addLocalFolderPromise:function($,K){return new Promise((V,Z)=>{this.addLocalFolderAsync2(Object.assign({localPath:$},K),(T,W)=>{if(T)return Z(T);if(W)V(this)})})},addFile:function($,K,V,Z){$=N($);let T=D($),W=T!=null;if(!W)T=new vW(X),T.entryName=$;T.comment=V||"";let M=typeof Z==="object"&&Z instanceof G.fs.Stats;if(M)T.header.time=Z.mtime;var j=T.isDirectory?16:0;let F=T.isDirectory?16384:32768;if(M)F|=4095&Z.mode;else if(typeof Z==="number")F|=4095&Z;else F|=T.isDirectory?493:420;if(j=(j|F<<16)>>>0,T.attr=j,T.setData(K),!W)Y.setEntry(T);return T},getEntries:function($){return Y.password=$,Y?Y.entries:[]},getEntry:function($){return D($)},getEntryCount:function(){return Y.getEntryCount()},forEach:function($){return Y.forEach($)},extractEntryTo:function($,K,V,Z,T,W){Z=o(!1,Z),T=o(!1,T),V=o(!0,V),W=nq(T,W);var M=D($);if(!M)throw v.Errors.NO_ENTRY();var j=I(M.entryName),F=L(K,W&&!M.isDirectory?I(W):V?j:k.basename(j));if(M.isDirectory){var O=Y.getEntryChildren(M);return O.forEach(function(E){if(E.isDirectory)return;var z=E.getData();if(!z)throw v.Errors.CANT_EXTRACT_FILE();var b=I(V?E.entryName:E.entryName.substring(M.entryName.length)),u=L(K,b);G.assertPathSafe(K,u);let d=T?E.header.fileAttr:void 0;G.writeFileTo(u,z,Z,d)}),!0}var S=M.getData(Y.password);if(!S)throw v.Errors.CANT_EXTRACT_FILE();if(G.assertPathSafe(K,F),G.fs.existsSync(F)&&!Z)throw v.Errors.CANT_OVERRIDE();let x=T?$.header.fileAttr:void 0;return G.writeFileTo(F,S,Z,x),!0},test:function($){if(!Y)return!1;for(var K of Y.entries)try{if(K.isDirectory)continue;var V=K.getData($);if(!V)return!1}catch(Z){return!1}return!0},extractAllTo:function($,K,V,Z){if(V=o(!1,V),Z=nq(V,Z),K=o(!1,K),!Y)throw v.Errors.NO_ZIP();let T=[];Y.entries.forEach(function(W){var M=L($,I(W.entryName));if(G.assertPathSafe($,M),W.isDirectory){if(G.makeDir(M),V)T.push({path:M,attr:W.header.fileAttr});return}var j=W.getData(Z);if(!j)throw v.Errors.CANT_EXTRACT_FILE();let F=V?W.header.fileAttr:void 0;G.writeFileTo(M,j,K,F);try{G.fs.utimesSync(M,W.header.time,W.header.time)}catch(O){}}),R(T)},extractAllToAsync:function($,K,V,Z){if(Z=uW(K,V,Z),V=o(!1,V),K=o(!1,K),!Z)return new Promise((S,x)=>{this.extractAllToAsync($,K,V,function(E){if(E)x(E);else S(this)})});if(!Y){Z(v.Errors.NO_ZIP());return}$=k.resolve($);let T=(S)=>L($,k.normalize(I(S.entryName))),W=(S,x)=>Error(S+': "'+x+'"'),M=[],j=[];Y.entries.forEach((S)=>{if(S.isDirectory)M.push(S);else j.push(S)});let F=[];for(let S of M){let x=T(S),E=V?S.header.fileAttr:void 0;try{G.assertPathSafe($,x),G.makeDir(x)}catch(z){Z(W("Unable to create folder",x));continue}if(E)F.push({path:x,attr:E});try{G.fs.utimesSync(x,S.header.time,S.header.time)}catch(z){}}let O=(S)=>{if(!S)try{R(F)}catch(x){return Z(W("Unable to set folder permissions",x.path||""))}Z(S)};j.reverse().reduce(function(S,x){return function(E){if(E)S(E);else{let z=k.normalize(I(x.entryName)),b=L($,z);try{G.assertPathSafe($,b)}catch(u){return S(u)}x.getDataAsync(function(u,d){if(d)S(d);else if(!u)S(v.Errors.CANT_EXTRACT_FILE());else{let e=V?x.header.fileAttr:void 0;G.writeFileToAsync(b,u,K,e,function(s){if(!s)return S(W("Unable to write file",b));G.fs.utimes(b,x.header.time,x.header.time,function(){S()})})}})}}},O)()},writeZip:function($,K){if(arguments.length===1){if(typeof $==="function")K=$,$=""}if(!$&&X.filename)$=X.filename;if(!$)return;var V=Y.compressToBuffer();if(V){var Z=G.writeFileTo($,V,!0);if(typeof K==="function")K(!Z?Error("failed"):null,"")}},writeZipPromise:function($,K){let{overwrite:V,perm:Z}=Object.assign({overwrite:!0},K);return new Promise((T,W)=>{if(!$&&X.filename)$=X.filename;if(!$)W("ADM-ZIP: ZIP File Name Missing");this.toBufferPromise().then((M)=>{let j=(F)=>F?T(F):W("ADM-ZIP: Wasn't able to write zip file");G.writeFileToAsync($,M,V,Z,j)},W)})},toBufferPromise:function(){return new Promise(($,K)=>{Y.toAsyncBuffer($,K)})},toBuffer:function($,K,V,Z){if(typeof $==="function")return Y.toAsyncBuffer($,K,V,Z),null;return Y.compressToBuffer()}}}});Fq();var qW=$W(aq(),1);import{parentPort as eq,workerData as yW}from"worker_threads";import*as tq from"path";function hW(){let{bundlePath:q,destination:Q}=yW;try{let J=new qW.default(q);Oq(J,Q),J.extractAllTo(tq.resolve(Q),!0);let X={ok:!0};eq?.postMessage(X)}catch(J){let X={ok:!1,message:t(J),stack:J instanceof Error?J.stack:void 0};eq?.postMessage(X)}}hW();
2
+ var ut=Object.create;var{getPrototypeOf:lt,defineProperty:Y,getOwnPropertyNames:he,getOwnPropertyDescriptor:Et}=Object,fe=Object.prototype.hasOwnProperty;function Ie(e){return this[e]}var dt,mt,ht=(e,r,n)=>{var o=e!=null&&typeof e==="object";if(o){var f=r?dt??=new WeakMap:mt??=new WeakMap,E=f.get(e);if(E)return E}n=e!=null?ut(lt(e)):{};let i=r||!e||!e.__esModule||!fe.call(e,"default")?Y(n,"default",{value:e,enumerable:!0}):n;if(e&&typeof e==="object"||typeof e==="function"){for(let m of he(e))if(!fe.call(i,m))Y(i,m,{get:Ie.bind(e,m),enumerable:!0})}if(o)f.set(e,i);return i},jt=(e)=>{var r=(me??=new WeakMap).get(e),n;if(r)return r;if(r=Y({},"__esModule",{value:!0}),e&&typeof e==="object"||typeof e==="function"){for(var o of he(e))if(!fe.call(r,o))Y(r,o,{get:Ie.bind(e,o),enumerable:!(n=Et(e,o))||n.enumerable})}return me.set(e,r),r},me,H=(e,r)=>()=>(r||e((r={exports:{}}).exports,r),r.exports);var It=(e)=>e;function gt(e,r){this[e]=It.bind(null,r)}var Vt=(e,r)=>{for(var n in r)Y(e,n,{get:r[n],enumerable:!0,configurable:!0,set:gt.bind(r,n)})};var J=(e,r,n)=>()=>{if(e)try{r=e(e=0)}catch(o){n=[o]}if(n)throw n[0];return r};var j=import.meta.require;function re(e,r){try{return e()}catch(n){return r(n)}}async function qt(e,r){try{return await e()}catch(n){return r(n)}}function ge(e){if(e instanceof Error){let r=[e.name,e.message].filter(Boolean).join(": "),n=e.stack?.split(`
3
+ `).slice(0,3).join(" \u2190 "),o="cause"in e&&e.cause!==void 0?ge(e.cause):"";return[r||"Error",n,o?`cause=${o}`:""].filter(Boolean).join(" | ")}if(e===null||e===void 0)return String(e);if(typeof e==="object"){if(Object.keys(e).length===0)return`${Object.prototype.toString.call(e)} (no enumerable keys)`;return re(()=>JSON.stringify(e),()=>Object.prototype.toString.call(e))}return String(e)}function Q(e){return re(()=>{if(e instanceof Error)return e.message;return String(e)},()=>re(()=>Object.prototype.toString.call(e),()=>"Unknown error"))}var ce=()=>{};function $t(e,r){if(e instanceof V)return e;let n=Q(e);return new V(`${r}: ${n}`,{cause:e})}function Jt(e,r){return new V(`${r} is not supported on platform '${e}'. Supported platforms: android, ios.`)}var V;var Le=J(()=>{ce();V=class V extends Error{constructor(e,r){super(e,r);let n=r?.containerFailure??(r?.cause instanceof V?r.cause.containerFailure:void 0);if(n)this.containerFailure=n}}});import*as pe from"path";function ae(e,r,n={}){let o=n.paths??pe,f=o.resolve(e),E=o.resolve(f,r),i=o.relative(f,E);if(i==="")return n.allowEqual??!0;return!(i===".."||i.startsWith(`..${o.sep}`)||o.isAbsolute(i))}function en(e,r,n,o={}){if(!ae(e,r,o))throw n();let f=o.paths??pe;return f.resolve(f.resolve(e),r)}var De=()=>{};import*as ye from"path";function Ne(e,r,n="CtrlProxy bundle"){let o=ye.resolve(r);for(let f of e.getEntries())if(!ae(o,f.entryName))throw new V(`Refusing to extract ${n}: entry "${f.entryName}" resolves outside the extraction directory ${o} (zip-slip / path traversal).`)}var _e=J(()=>{Le();De()});var ue=H(function(sn,Ce){Ce.exports={LOCHDR:30,LOCSIG:67324752,LOCVER:4,LOCFLG:6,LOCHOW:8,LOCTIM:10,LOCCRC:14,LOCSIZ:18,LOCLEN:22,LOCNAM:26,LOCEXT:28,EXTSIG:134695760,EXTHDR:16,EXTCRC:4,EXTSIZ:8,EXTLEN:12,CENHDR:46,CENSIG:33639248,CENVEM:4,CENVER:6,CENFLG:8,CENHOW:10,CENTIM:12,CENCRC:16,CENSIZ:20,CENLEN:24,CENNAM:28,CENEXT:30,CENCOM:32,CENDSK:34,CENATT:36,CENATX:38,CENOFF:42,ENDHDR:22,ENDSIG:101010256,ENDSUB:8,ENDTOT:10,ENDSIZ:12,ENDOFF:16,ENDCOM:20,END64HDR:20,END64SIG:117853008,END64START:4,END64OFF:8,END64NUMDISKS:16,ZIP64SIG:101075792,ZIP64HDR:56,ZIP64LEAD:12,ZIP64SIZE:4,ZIP64VEM:12,ZIP64VER:14,ZIP64DSK:16,ZIP64DSKDIR:20,ZIP64SUB:24,ZIP64TOT:32,ZIP64SIZB:40,ZIP64OFF:48,ZIP64EXTRA:56,STORED:0,SHRUNK:1,REDUCED1:2,REDUCED2:3,REDUCED3:4,REDUCED4:5,IMPLODED:6,DEFLATED:8,ENHANCED_DEFLATED:9,PKWARE:10,BZIP2:12,LZMA:14,IBM_TERSE:18,IBM_LZ77:19,AES_ENCRYPT:99,FLG_ENC:1,FLG_COMP1:2,FLG_COMP2:4,FLG_DESC:8,FLG_ENH:16,FLG_PATCH:32,FLG_STR:64,FLG_EFS:2048,FLG_MSK:4096,FILE:2,BUFFER:1,NONE:0,EF_ID:0,EF_SIZE:2,ID_ZIP64:1,ID_AVINFO:7,ID_PFS:8,ID_OS2:9,ID_NTFS:10,ID_OPENVMS:12,ID_UNIX:13,ID_FORK:14,ID_PATCH:15,ID_X509_PKCS7:20,ID_X509_CERTID_F:21,ID_X509_CERTID_C:22,ID_STRONGENC:23,ID_RECORD_MGT:24,ID_X509_PKCS7_RL:25,ID_IBM1:101,ID_IBM2:102,ID_POSZIP:18064,EF_ZIP64_OR_32:4294967295,EF_ZIP64_OR_16:65535,EF_ZIP64_SUNCOMP:0,EF_ZIP64_SCOMP:8,EF_ZIP64_RHO:16,EF_ZIP64_DSN:24}});var ee=H(function(Oe){var Se={INVALID_LOC:"Invalid LOC header (bad signature)",INVALID_CEN:"Invalid CEN header (bad signature)",INVALID_END:"Invalid END header (bad signature)",DESCRIPTOR_NOT_EXIST:"No descriptor present",DESCRIPTOR_UNKNOWN:"Unknown descriptor format",DESCRIPTOR_FAULTY:"Descriptor data is malformed",NO_DATA:"Nothing to decompress",BAD_CRC:"CRC32 checksum failed {0}",MAX_OUTPUT_EXCEEDED:"Decompressed data exceeds the declared uncompressed size",FILE_IN_THE_WAY:"There is a file in the way: {0}",UNKNOWN_METHOD:"Invalid/unsupported compression method",AVAIL_DATA:"inflate::Available inflate data did not terminate",INVALID_DISTANCE:"inflate::Invalid literal/length or distance code in fixed or dynamic block",TO_MANY_CODES:"inflate::Dynamic block code description: too many length or distance codes",INVALID_REPEAT_LEN:"inflate::Dynamic block code description: repeat more than specified lengths",INVALID_REPEAT_FIRST:"inflate::Dynamic block code description: repeat lengths with no first length",INCOMPLETE_CODES:"inflate::Dynamic block code description: code lengths codes incomplete",INVALID_DYN_DISTANCE:"inflate::Dynamic block code description: invalid distance code lengths",INVALID_CODES_LEN:"inflate::Dynamic block code description: invalid literal/length code lengths",INVALID_STORE_BLOCK:"inflate::Stored block length did not match one's complement",INVALID_BLOCK_TYPE:"inflate::Invalid block type (type == 3)",CANT_EXTRACT_FILE:"Could not extract the file",CANT_OVERRIDE:"Target file already exists",DISK_ENTRY_TOO_LARGE:"Number of disk entries is too large",NO_ZIP:"No zip file was loaded",NO_ENTRY:"Entry doesn't exist",DUPLICATE_ENTRY:"Duplicate entry name {0}",DIRECTORY_CONTENT_ERROR:"A directory cannot have content",FILE_NOT_FOUND:'File not found: "{0}"',NOT_IMPLEMENTED:"Not implemented",INVALID_FILENAME:"Invalid filename",INVALID_FORMAT:"Invalid or unsupported zip format. No END header found",ZIP64_VALUE_TOO_LARGE:"Zip64 value exceeds the maximum safe integer",INVALID_PASS_PARAM:"Incompatible password parameter",WRONG_PASSWORD:"Wrong Password",COMMENT_TOO_LONG:"Comment is too long",EXTRA_FIELD_PARSE_ERROR:"Extra field parsing error"};function pt(e){return function(...r){if(r.length)e=e.replace(/\{(\d)\}/g,(n,o)=>r[o]||"");return Error("ADM-ZIP: "+e)}}for(let e of Object.keys(Se))Oe[e]=pt(Se[e])});var Fe=H(function(cn,xe){var Dt=j("fs"),D=j("path"),oe=ue(),q=ee(),yt=typeof process==="object"&&process.platform==="win32",Te=(e)=>typeof e==="object"&&e!==null,Ae=new Uint32Array(256).map((e,r)=>{for(let n=0;n<8;n++)if((r&1)!==0)r=3988292384^r>>>1;else r>>>=1;return r>>>0});function Z(e){if(this.sep=D.sep,this.fs=Dt,Te(e)){if(Te(e.fs)&&typeof e.fs.statSync==="function")this.fs=e.fs}}xe.exports=Z;Z.prototype.makeDir=function(e){let r=this;function n(o){let f=o.split(r.sep)[0];o.split(r.sep).forEach(function(E){if(!E||E.substr(-1,1)===":")return;f+=r.sep+E;var i;try{i=r.fs.statSync(f)}catch(m){if(m.message&&m.message.startsWith("ENOENT"))r.fs.mkdirSync(f);else throw m}if(i&&i.isFile())throw q.FILE_IN_THE_WAY(`"${f}"`)})}n(e)};Z.prototype.writeFileTo=function(e,r,n,o){let f=this;if(f.fs.existsSync(e)){if(!n)return!1;var E=f.fs.statSync(e);if(E.isDirectory())return!1}var i=D.dirname(e);if(!f.fs.existsSync(i))f.makeDir(i);var m;try{m=f.fs.openSync(e,"w",438)}catch(C){f.fs.chmodSync(e,438),m=f.fs.openSync(e,"w",438)}if(m)try{f.fs.writeSync(m,r,0,r.length,0)}finally{f.fs.closeSync(m)}return f.fs.chmodSync(e,o||438),!0};Z.prototype.writeFileToAsync=function(e,r,n,o,f){if(typeof o==="function")f=o,o=void 0;let E=this;E.fs.exists(e,function(i){if(i&&!n)return f(!1);E.fs.stat(e,function(m,C){if(i&&C&&C.isDirectory())return f(!1);var S=D.dirname(e);E.fs.exists(S,function(N){if(!N)try{E.makeDir(S)}catch(O){return f(!1)}let _=function(O){E.fs.write(O,r,0,r.length,0,function(A){E.fs.close(O,function(){if(A)return f(!1);E.fs.chmod(e,o||438,function(){f(!0)})})})};E.fs.open(e,"w",438,function(O,A){if(O)E.fs.chmod(e,438,function(){E.fs.open(e,"w",438,function(s,c){if(s||!c)return f(!1);_(c)})});else if(A)_(A);else f(!1)})})})})};Z.prototype.assertPathSafe=function(e,r){let n=this;if(typeof n.fs.lstatSync!=="function")return;let o=D.resolve(e),f=D.resolve(r);if(f===o)return;let E=D.relative(o,f);if(!E||E===".."||E.startsWith(".."+D.sep)||D.isAbsolute(E))return;let i=o;for(let m of E.split(D.sep)){if(!m||m===".")continue;i=D.join(i,m);let C;try{C=n.fs.lstatSync(i)}catch(S){break}if(C.isSymbolicLink())throw q.FILE_IN_THE_WAY(`"${i}"`)}};Z.prototype.findFiles=function(e){let r=this,n=typeof r.fs.lstatSync==="function",o=r.fs.realpathSync(e);function f(i){if(!n)return!1;if(!r.fs.lstatSync(i).isSymbolicLink())return!1;let m;try{m=r.fs.realpathSync(i)}catch(C){return!0}return!(m===o||m.startsWith(o+D.sep))}function E(i,m,C,S){if(typeof m==="boolean")C=m,m=void 0;let N=[];return r.fs.readdirSync(i).forEach(function(_){let O=D.join(i,_);if(f(O))return;let A=r.fs.statSync(O);if(!m||m.test(O))N.push(D.normalize(O)+(A.isDirectory()?r.sep:""));if(A.isDirectory()&&C){let s=r.fs.realpathSync(O);if(!S.has(s))S.add(s),N=N.concat(E(O,m,C,S))}}),N}return E(e,void 0,!0,new Set([o]))};Z.prototype.findFilesAsync=function(e,r){let n=this,o=[],f=!1,E=function(N){if(f)return;f=!0,r(N,N?void 0:o)},i=typeof n.fs.lstat==="function",m=null,C=function(N,_){if(!i)return _(null,!1);n.fs.lstat(N,function(O,A){if(O)return _(O);if(!A||!A.isSymbolicLink())return _(null,!1);n.fs.realpath(N,function(s,c){if(s)return _(null,!0);_(null,!(c===m||c.startsWith(m+D.sep)))})})},S=function(N,_,O){n.fs.readdir(N,function(A,s){if(A)return O(A);let c=s.length;if(!c)return O();s.forEach(function(a){let l=D.join(N,a);C(l,function(d,t){if(d)return O(d);if(t){if(!--c)O();return}n.fs.stat(l,function(u,I){if(u)return O(u);if(!I){if(!--c)O();return}if(o.push(D.normalize(l)+(I.isDirectory()?n.sep:"")),!I.isDirectory()){if(!--c)O();return}n.fs.realpath(l,function(L,g){if(L)return O(L);if(_.has(g)){if(!--c)O();return}_.add(g),S(l,_,function(p){if(p)return O(p);if(!--c)O()})})})})})})};n.fs.realpath(e,function(N,_){if(N)return E(N);m=_,S(e,new Set([_]),E)})};Z.prototype.getAttributes=function(){};Z.prototype.setAttributes=function(){};Z.crc32update=function(e,r){return Ae[(e^r)&255]^e>>>8};Z.crc32=function(e){if(typeof e==="string")e=Buffer.from(e,"utf8");let r=e.length,n=-1;for(let o=0;o<r;)n=Z.crc32update(n,e[o++]);return~n>>>0};Z.methodToString=function(e){switch(e){case oe.STORED:return"STORED ("+e+")";case oe.DEFLATED:return"DEFLATED ("+e+")";default:return"UNSUPPORTED ("+e+")"}};Z.canonical=function(e){if(!e)return"";let r=D.posix.normalize("/"+e.split("\\").join("/"));return D.join(".",r)};Z.zipnamefix=function(e){if(!e)return"";let r=D.posix.normalize("/"+e.split("\\").join("/"));return D.posix.join(".",r)};Z.findLast=function(e,r){if(!Array.isArray(e))throw TypeError("arr is not array");let n=e.length>>>0;for(let o=n-1;o>=0;o--)if(r(e[o],o,e))return e[o];return};Z.sanitize=function(e,r){e=D.resolve(D.normalize(e));var n=r.split("/");for(var o=0,f=n.length;o<f;o++){var E=D.normalize(D.join(e,n.slice(o,f).join(D.sep)));if(E===e||E.startsWith(e+D.sep))return E}return D.normalize(D.join(e,D.basename(r)))};Z.toBuffer=function(r,n){if(Buffer.isBuffer(r))return r;else if(r instanceof Uint8Array)return Buffer.from(r);else return typeof r==="string"?n(r):Buffer.alloc(0)};Z.readBigUInt64LE=function(e,r){let n=e.readUInt32LE(r),f=e.readUInt32LE(r+4)*4294967296+n;if(f>Number.MAX_SAFE_INTEGER)throw q.ZIP64_VALUE_TOO_LARGE();return f};Z.writeBigUInt64LE=function(e,r,n){let o=r>>>0,f=Math.floor(r/4294967296)>>>0;e.writeUInt32LE(o,n),e.writeUInt32LE(f,n+4)};Z.fromDOS2Date=function(e){return new Date((e>>25&127)+1980,Math.max((e>>21&15)-1,0),Math.max(e>>16&31,1),e>>11&31,e>>5&63,(e&31)<<1)};Z.fromDate2DOS=function(e){let r=0,n=0;if(e.getFullYear()>1979)r=(e.getFullYear()-1980&127)<<9|e.getMonth()+1<<5|e.getDate(),n=e.getHours()<<11|e.getMinutes()<<5|e.getSeconds()>>1;return r<<16|n};Z.isWin=yt;Z.crcTable=Ae});var Ue=H(function(an,Re){var we=j("path");Re.exports=function(e,{fs:r}){var n=e||"",o=E(),f=null;function E(){return{directory:!1,readonly:!1,hidden:!1,executable:!1,mtime:0,atime:0}}if(n&&r.existsSync(n))f=r.statSync(n),o.directory=f.isDirectory(),o.mtime=f.mtime,o.atime=f.atime,o.executable=(73&f.mode)!==0,o.readonly=(128&f.mode)===0,o.hidden=we.basename(n)[0]===".";else console.warn("Invalid path: "+n);return{get directory(){return o.directory},get readOnly(){return o.readonly},get hidden(){return o.hidden},get mtime(){return o.mtime},get atime(){return o.atime},get executable(){return o.executable},decodeAttributes:function(){},encodeAttributes:function(){},toJSON:function(){return{path:n,isDirectory:o.directory,isReadOnly:o.readonly,isHidden:o.hidden,isExecutable:o.executable,mTime:o.mtime,aTime:o.atime}},toString:function(){return JSON.stringify(this.toJSON(),null,"\t")}}}});var Ze=H(function(un,Be){Be.exports={efs:!0,encode:(e)=>Buffer.from(e,"utf8"),decode:(e)=>e.toString("utf8")}});var K=H(function(ln,X){X.exports=Fe();X.exports.Constants=ue();X.exports.Errors=ee();X.exports.FileAttr=Ue();X.exports.decoder=Ze()});var ve=H(function(En,Pe){var G=K(),h=G.Constants;Pe.exports=function(){var e=20,r=10,n=0,o=0,f=0,E=0,i=0,m=0,C=0,S=0,N=0,_=0,O=0,A=0,s=0;e|=G.isWin?2560:768,n|=h.FLG_EFS;let c={extraLen:0},a=(t)=>Math.max(0,t)>>>0,l=(t)=>Math.max(0,t)&65535,d=(t)=>Math.max(0,t)&255;return f=G.fromDate2DOS(new Date),{get made(){return e},set made(t){e=t},get version(){return r},set version(t){r=t},get flags(){return n},set flags(t){n=t},get flags_efs(){return(n&h.FLG_EFS)>0},set flags_efs(t){if(t)n|=h.FLG_EFS;else n&=~h.FLG_EFS},get flags_desc(){return(n&h.FLG_DESC)>0},set flags_desc(t){if(t)n|=h.FLG_DESC;else n&=~h.FLG_DESC},get method(){return o},set method(t){switch(t){case h.STORED:this.version=10;break;case h.DEFLATED:default:this.version=20}o=t},get time(){return G.fromDOS2Date(this.timeval)},set time(t){t=new Date(t),this.timeval=G.fromDate2DOS(t)},get timeval(){return f},set timeval(t){f=a(t)},get timeHighByte(){return d(f>>>8)},get crc(){return E},set crc(t){E=a(t)},get compressedSize(){return i},set compressedSize(t){i=a(t)},get size(){return m},set size(t){m=a(t)},get fileNameLength(){return C},set fileNameLength(t){C=t},get extraLength(){return S},set extraLength(t){S=t},get extraLocalLength(){return c.extraLen},set extraLocalLength(t){c.extraLen=t},get commentLength(){return N},set commentLength(t){N=t},get diskNumStart(){return _},set diskNumStart(t){_=a(t)},get inAttr(){return O},set inAttr(t){O=a(t)},get attr(){return A},set attr(t){A=a(t)},get fileAttr(){return(A||0)>>16&511},get offset(){return s},set offset(t){s=a(t)},get encrypted(){return(n&h.FLG_ENC)===h.FLG_ENC},get centralHeaderSize(){return h.CENHDR+C+S+N},get realDataOffset(){return s+h.LOCHDR+c.fnameLen+c.extraLen},get localHeader(){return c},loadLocalHeaderFromBinary:function(t){if(s<0||s+h.LOCHDR>t.length)throw G.Errors.INVALID_LOC();var u=t.slice(s,s+h.LOCHDR);if(u.readUInt32LE(0)!==h.LOCSIG)throw G.Errors.INVALID_LOC();c.version=u.readUInt16LE(h.LOCVER),c.flags=u.readUInt16LE(h.LOCFLG),c.flags_desc=(c.flags&h.FLG_DESC)>0,c.method=u.readUInt16LE(h.LOCHOW),c.time=u.readUInt32LE(h.LOCTIM),c.crc=u.readUInt32LE(h.LOCCRC),c.compressedSize=u.readUInt32LE(h.LOCSIZ),c.size=u.readUInt32LE(h.LOCLEN),c.fnameLen=u.readUInt16LE(h.LOCNAM),c.extraLen=u.readUInt16LE(h.LOCEXT);let I=s+h.LOCHDR+c.fnameLen,L=I+c.extraLen;return t.slice(I,L)},loadFromBinary:function(t){if(t.length!==h.CENHDR||t.readUInt32LE(0)!==h.CENSIG)throw G.Errors.INVALID_CEN();e=t.readUInt16LE(h.CENVEM),r=t.readUInt16LE(h.CENVER),n=t.readUInt16LE(h.CENFLG),o=t.readUInt16LE(h.CENHOW),f=t.readUInt32LE(h.CENTIM),E=t.readUInt32LE(h.CENCRC),i=t.readUInt32LE(h.CENSIZ),m=t.readUInt32LE(h.CENLEN),C=t.readUInt16LE(h.CENNAM),S=t.readUInt16LE(h.CENEXT),N=t.readUInt16LE(h.CENCOM),_=t.readUInt16LE(h.CENDSK),O=t.readUInt16LE(h.CENATT),A=t.readUInt32LE(h.CENATX),s=t.readUInt32LE(h.CENOFF)},localHeaderToBinary:function(){var t=Buffer.alloc(h.LOCHDR);return t.writeUInt32LE(h.LOCSIG,0),t.writeUInt16LE(r,h.LOCVER),t.writeUInt16LE(n&~h.FLG_DESC,h.LOCFLG),t.writeUInt16LE(o,h.LOCHOW),t.writeUInt32LE(f,h.LOCTIM),t.writeUInt32LE(E,h.LOCCRC),t.writeUInt32LE(i,h.LOCSIZ),t.writeUInt32LE(m,h.LOCLEN),t.writeUInt16LE(C,h.LOCNAM),t.writeUInt16LE(c.extraLen,h.LOCEXT),t},centralHeaderToBinary:function(){var t=Buffer.alloc(h.CENHDR+C+S+N);return t.writeUInt32LE(h.CENSIG,0),t.writeUInt16LE(e,h.CENVEM),t.writeUInt16LE(r,h.CENVER),t.writeUInt16LE(n&~h.FLG_DESC,h.CENFLG),t.writeUInt16LE(o,h.CENHOW),t.writeUInt32LE(f,h.CENTIM),t.writeUInt32LE(E,h.CENCRC),t.writeUInt32LE(i,h.CENSIZ),t.writeUInt32LE(m,h.CENLEN),t.writeUInt16LE(C,h.CENNAM),t.writeUInt16LE(S,h.CENEXT),t.writeUInt16LE(N,h.CENCOM),t.writeUInt16LE(_,h.CENDSK),t.writeUInt16LE(O,h.CENATT),t.writeUInt32LE(A,h.CENATX),t.writeUInt32LE(s,h.CENOFF),t},toJSON:function(){let t=function(u){return u+" bytes"};return{made:e,version:r,flags:n,method:G.methodToString(o),time:this.time,crc:"0x"+E.toString(16).toUpperCase(),compressedSize:t(i),size:t(m),fileNameLength:t(C),extraLength:t(S),commentLength:t(N),diskNumStart:_,inAttr:O,attr:A,offset:s,centralHeaderSize:t(h.CENHDR+C+S+N)}},toString:function(){return JSON.stringify(this.toJSON(),null,"\t")}}}});var Me=H(function(dn,He){var z=K(),y=z.Constants;He.exports=function(){var e=0,r=0,n=0,o=0,f=0;let E=()=>e>y.EF_ZIP64_OR_16||r>y.EF_ZIP64_OR_16||n>y.EF_ZIP64_OR_32||o>y.EF_ZIP64_OR_32;return{get diskEntries(){return e},set diskEntries(i){e=r=i},get totalEntries(){return r},set totalEntries(i){r=e=i},get size(){return n},set size(i){n=i},get offset(){return o},set offset(i){o=i},get commentLength(){return f},set commentLength(i){f=i},get mainHeaderSize(){return(E()?y.ZIP64HDR+y.END64HDR:0)+y.ENDHDR+f},loadFromBinary:function(i){if((i.length!==y.ENDHDR||i.readUInt32LE(0)!==y.ENDSIG)&&(i.length<y.ZIP64HDR||i.readUInt32LE(0)!==y.ZIP64SIG))throw z.Errors.INVALID_END();if(i.readUInt32LE(0)===y.ENDSIG)e=i.readUInt16LE(y.ENDSUB),r=i.readUInt16LE(y.ENDTOT),n=i.readUInt32LE(y.ENDSIZ),o=i.readUInt32LE(y.ENDOFF),f=i.readUInt16LE(y.ENDCOM);else e=z.readBigUInt64LE(i,y.ZIP64SUB),r=z.readBigUInt64LE(i,y.ZIP64TOT),n=z.readBigUInt64LE(i,y.ZIP64SIZB),o=z.readBigUInt64LE(i,y.ZIP64OFF),f=0},toBinary:function(){if(!E()){var i=Buffer.alloc(y.ENDHDR+f);return i.writeUInt32LE(y.ENDSIG,0),i.writeUInt32LE(0,4),i.writeUInt16LE(e,y.ENDSUB),i.writeUInt16LE(r,y.ENDTOT),i.writeUInt32LE(n,y.ENDSIZ),i.writeUInt32LE(o,y.ENDOFF),i.writeUInt16LE(f,y.ENDCOM),i.fill(" ",y.ENDHDR),i}var i=Buffer.alloc(this.mainHeaderSize);let m=0;i.writeUInt32LE(y.ZIP64SIG,m),z.writeBigUInt64LE(i,y.ZIP64HDR-y.ZIP64LEAD,m+y.ZIP64SIZE),i.writeUInt16LE(45,m+y.ZIP64VEM),i.writeUInt16LE(45,m+y.ZIP64VER),i.writeUInt32LE(0,m+y.ZIP64DSK),i.writeUInt32LE(0,m+y.ZIP64DSKDIR),z.writeBigUInt64LE(i,e,m+y.ZIP64SUB),z.writeBigUInt64LE(i,r,m+y.ZIP64TOT),z.writeBigUInt64LE(i,n,m+y.ZIP64SIZB),z.writeBigUInt64LE(i,o,m+y.ZIP64OFF);let C=o+n;return m+=y.ZIP64HDR,i.writeUInt32LE(y.END64SIG,m),i.writeUInt32LE(0,m+y.END64START),z.writeBigUInt64LE(i,C,m+y.END64OFF),i.writeUInt32LE(1,m+y.END64NUMDISKS),m+=y.END64HDR,i.writeUInt32LE(y.ENDSIG,m),i.writeUInt32LE(0,m+4),i.writeUInt16LE(Math.min(e,y.EF_ZIP64_OR_16),m+y.ENDSUB),i.writeUInt16LE(Math.min(r,y.EF_ZIP64_OR_16),m+y.ENDTOT),i.writeUInt32LE(Math.min(n,y.EF_ZIP64_OR_32),m+y.ENDSIZ),i.writeUInt32LE(Math.min(o,y.EF_ZIP64_OR_32),m+y.ENDOFF),i.writeUInt16LE(f,m+y.ENDCOM),i.fill(" ",m+y.ENDHDR),i},toJSON:function(){let i=function(m,C){let S=m.toString(16).toUpperCase();while(S.length<C)S="0"+S;return"0x"+S};return{diskEntries:e,totalEntries:r,size:n+" bytes",offset:i(o,4),commentLength:f}},toString:function(){return JSON.stringify(this.toJSON(),null,"\t")}}}});var le=H(function(Nt){Nt.EntryHeader=ve();Nt.MainHeader=Me()});var Ge=H(function(hn,ze){ze.exports=function(e){var r=j("zlib"),n={chunkSize:(parseInt(e.length/1024)+1)*1024};return{deflate:function(){return r.deflateRawSync(e,n)},deflateAsync:function(o){var f=r.createDeflateRaw(n),E=[],i=0;f.on("data",function(m){E.push(m),i+=m.length}),f.on("end",function(){var m=Buffer.alloc(i),C=0;m.fill(0);for(var S=0;S<E.length;S++){var N=E[S];N.copy(m,C),C+=N.length}o&&o(m)}),f.end(e)}}}});var Ve=H(function(In,je){var St=+(process?.versions?.node??"").split(".")[0]||0,be=ee();je.exports=function(e,r){var n=j("zlib");let o=r>0?r:1,f=St>=15?{maxOutputLength:o}:{};return{inflate:function(){return n.inflateRawSync(e,f)},inflateAsync:function(E){var i=n.createInflateRaw(f),m=[],C=0,S=!1;let N=function(_){if(S)return;S=!0,i.destroy(),E&&E(Buffer.alloc(0),_)};i.on("error",function(_){N(_)}),i.on("data",function(_){if(S)return;if(C+=_.length,C>o)return N(be.MAX_OUTPUT_EXCEEDED());m.push(_)}),i.on("end",function(){if(S)return;S=!0;var _=Buffer.alloc(C),O=0;_.fill(0);for(var A=0;A<m.length;A++){var s=m[A];s.copy(_,O),O+=s.length}E&&E(_)}),i.end(e)}}}});var Ye=H(function(gn,ke){var{randomFillSync:We}=j("crypto"),Xe=ee(),Ot=new Uint32Array(256).map((e,r)=>{for(let n=0;n<8;n++)if((r&1)!==0)r=r>>>1^3988292384;else r>>>=1;return r>>>0}),Ke=(e,r)=>Math.imul(e,r)>>>0,qe=(e,r)=>Ot[(e^r)&255]^e>>>8,te=()=>{if(typeof We==="function")return We(Buffer.alloc(12));else return te.node()};te.node=()=>{let e=Buffer.alloc(12),r=e.length;for(let n=0;n<r;n++)e[n]=Math.random()*256&255;return e};var ie={genSalt:te};function se(e){let r=Buffer.isBuffer(e)?e:Buffer.from(e);this.keys=new Uint32Array([305419896,591751049,878082192]);for(let n=0;n<r.length;n++)this.updateKeys(r[n])}se.prototype.updateKeys=function(e){let r=this.keys;return r[0]=qe(r[0],e),r[1]+=r[0]&255,r[1]=Ke(r[1],134775813)+1,r[2]=qe(r[2],r[1]>>>24),e};se.prototype.next=function(){let e=(this.keys[2]|2)>>>0;return Ke(e,e^1)>>8&255};function Tt(e){let r=new se(e);return function(n){let o=Buffer.alloc(n.length),f=0;for(let E of n)o[f++]=r.updateKeys(E^r.next());return o}}function At(e){let r=new se(e);return function(n,o,f=0){if(!o)o=Buffer.alloc(n.length);for(let E of n){let i=r.next();o[f++]=E^i,r.updateKeys(E)}return o}}function xt(e,r,n){if(!e||!Buffer.isBuffer(e)||e.length<12)return Buffer.alloc(0);let o=Tt(n),f=o(e.slice(0,12)),E=(r.flags&8)===8?r.timeHighByte:r.crc>>>24;if(f[11]!==E)throw Xe.WRONG_PASSWORD();return o(e.slice(12))}function Ft(e){if(Buffer.isBuffer(e)&&e.length>=12)ie.genSalt=function(){return e.slice(0,12)};else if(e==="node")ie.genSalt=te.node;else ie.genSalt=te}function wt(e,r,n,o=!1){if(e==null)e=Buffer.alloc(0);if(!Buffer.isBuffer(e))e=Buffer.from(e.toString());let f=At(n),E=ie.genSalt();if(E[11]=r.crc>>>24&255,o)E[10]=r.crc>>>16&255;let i=Buffer.alloc(e.length+12);return f(E,i),f(e,i,12)}ke.exports={decrypt:xt,encrypt:wt,_salter:Ft}});var $e=H(function(Rt){Rt.Deflater=Ge();Rt.Inflater=Ve();Rt.ZipCrypto=Ye()});var de=H(function(pn,Je){var B=K(),Pt=le(),M=B.Constants,Ee=$e();Je.exports=function(e,r){var n=new Pt.EntryHeader,o=Buffer.alloc(0),f=Buffer.alloc(0),E=!1,i=null,m=Buffer.alloc(0),C=Buffer.alloc(0),S=!0;let N=e,_=typeof N.decoder==="object"?N.decoder:B.decoder;S=_.hasOwnProperty("efs")?_.efs:!1;function O(){if(!r||!(r instanceof Uint8Array))return Buffer.alloc(0);C=n.loadLocalHeaderFromBinary(r);let t=n.realDataOffset,u=t+n.compressedSize;if(t<0||u<t||u>r.length)throw B.Errors.INVALID_LOC();return r.slice(t,u)}function A(t){let u=n.flags_desc||n.localHeader.flags_desc?n.crc:n.localHeader.crc;return B.crc32(t)===u}function s(t,u,I){if(typeof u>"u"&&typeof t==="string")I=t,t=void 0;if(E){if(t&&u)u(Buffer.alloc(0),B.Errors.DIRECTORY_CONTENT_ERROR());return Buffer.alloc(0)}var L;try{if(L=O(),L.length===0){if(t&&u)u(L);return L}if(n.encrypted){if(typeof I!=="string"&&!Buffer.isBuffer(I))throw B.Errors.INVALID_PASS_PARAM();L=Ee.ZipCrypto.decrypt(L,n,I)}}catch(x){if(t&&u)return u(Buffer.alloc(0),x),Buffer.alloc(0);throw x}var g;switch(n.method){case B.Constants.STORED:if(g=Buffer.alloc(L.length),L.copy(g),!A(g)){if(t&&u)u(g,B.Errors.BAD_CRC());throw B.Errors.BAD_CRC()}else{if(t&&u)u(g);return g}case B.Constants.DEFLATED:var p=new Ee.Inflater(L,n.size);if(!t){if(g=p.inflate(),!A(g))throw B.Errors.BAD_CRC(`"${_.decode(o)}"`);return g}else p.inflateAsync(function(x,w){if(!u)return;if(w)u(Buffer.alloc(0),w);else if(!A(x))u(x,B.Errors.BAD_CRC());else u(x)});break;default:if(t&&u)u(Buffer.alloc(0),B.Errors.UNKNOWN_METHOD());throw B.Errors.UNKNOWN_METHOD()}}function c(t,u){if((!i||!i.length)&&Buffer.isBuffer(r)){if(t&&u)u(O());return O()}if(i.length&&!E){var I;switch(n.method){case B.Constants.STORED:if(n.compressedSize=n.size,I=Buffer.alloc(i.length),i.copy(I),t&&u)u(I);return I;default:case B.Constants.DEFLATED:var L=new Ee.Deflater(i);if(!t){var g=L.deflate();return n.compressedSize=g.length,g}else L.deflateAsync(function(p){I=Buffer.alloc(p.length),n.compressedSize=p.length,p.copy(I),u&&u(I)});L=null;break}}else if(t&&u)u(Buffer.alloc(0));else return Buffer.alloc(0)}function a(t,u){return B.readBigUInt64LE(t,u)}function l(t){try{var u=0,I,L,g;while(u+4<t.length)if(I=t.readUInt16LE(u),u+=2,L=t.readUInt16LE(u),u+=2,g=t.slice(u,u+L),u+=L,M.ID_ZIP64===I)d(g)}catch(p){throw B.Errors.EXTRA_FIELD_PARSE_ERROR()}}function d(t){var u,I,L,g;if(t.length>=M.EF_ZIP64_SCOMP){if(u=a(t,M.EF_ZIP64_SUNCOMP),n.size===M.EF_ZIP64_OR_32)n.size=u}if(t.length>=M.EF_ZIP64_RHO){if(I=a(t,M.EF_ZIP64_SCOMP),n.compressedSize===M.EF_ZIP64_OR_32)n.compressedSize=I}if(t.length>=M.EF_ZIP64_DSN){if(L=a(t,M.EF_ZIP64_RHO),n.offset===M.EF_ZIP64_OR_32)n.offset=L}if(t.length>=M.EF_ZIP64_DSN+4){if(g=t.readUInt32LE(M.EF_ZIP64_DSN),n.diskNumStart===M.EF_ZIP64_OR_16)n.diskNumStart=g}}return{get entryName(){return _.decode(o)},get rawEntryName(){return o},set entryName(t){o=B.toBuffer(t,_.encode);var u=o[o.length-1];E=u===47||u===92,n.fileNameLength=o.length},get efs(){if(typeof S==="function")return S(this.entryName);else return S},get extra(){return m},set extra(t){m=t,n.extraLength=t.length,l(t)},get comment(){return _.decode(f)},set comment(t){if(f=B.toBuffer(t,_.encode),n.commentLength=f.length,f.length>65535)throw B.Errors.COMMENT_TOO_LONG()},get name(){let t=_.decode(o);return E?t.replace(/[/\\]$/,"").split("/").pop():t.split("/").pop()},get isDirectory(){return E},getCompressedData:function(){return c(!1,null)},getCompressedDataAsync:function(t){c(!0,t)},setData:function(t){if(i=B.toBuffer(t,B.decoder.encode),!E&&i.length)n.size=i.length,n.method=B.Constants.DEFLATED,n.crc=B.crc32(t),n.changed=!0;else n.method=B.Constants.STORED},getData:function(t){if(n.changed)return i;else return s(!1,null,t)},getDataAsync:function(t,u){if(n.changed)t(i);else s(!0,t,u)},set attr(t){n.attr=t},get attr(){return n.attr},set header(t){n.loadFromBinary(t)},get header(){return n},packCentralHeader:function(){n.flags_efs=this.efs,n.extraLength=m.length;var t=n.centralHeaderToBinary(),u=B.Constants.CENHDR;return o.copy(t,u),u+=o.length,m.copy(t,u),u+=n.extraLength,f.copy(t,u),t},packLocalHeader:function(){let t=0;n.flags_efs=this.efs,n.extraLocalLength=C.length;let u=n.localHeaderToBinary(),I=Buffer.alloc(u.length+o.length+n.extraLocalLength);return u.copy(I,t),t+=u.length,o.copy(I,t),t+=o.length,C.copy(I,t),t+=C.length,I},toJSON:function(){let t=function(u){return"<"+(u&&u.length+" bytes buffer"||"null")+">"};return{entryName:this.entryName,name:this.name,comment:this.comment,isDirectory:this.isDirectory,header:n.toJSON(),compressedData:t(r),data:t(i)}},toString:function(){return JSON.stringify(this.toJSON(),null,"\t")}}}});var nt=H(function(Dn,tt){var Qe=de(),et=le(),R=K();tt.exports=function(e,r){var n=[],o=Object.create(null),f=Buffer.alloc(0),E=new et.MainHeader,i=!1,m=null;let C=new Set,S=r,{noSort:N,decoder:_}=S;if(e)s(S.readEntries);else i=!0;function O(){let a=new Set;for(let l of Object.keys(o)){let d=l.split("/");if(d.pop(),!d.length)continue;for(let t=0;t<d.length;t++){let u=d.slice(0,t+1).join("/")+"/";a.add(u)}}for(let l of a)if(!(l in o)){let d=new Qe(S);d.entryName=l,d.attr=16,d.temporary=!0,n.push(d),o[d.entryName]=d,C.add(d)}}function A(){if(i=!0,o=Object.create(null),E.diskEntries>(e.length-E.offset)/R.Constants.CENHDR)throw R.Errors.DISK_ENTRY_TOO_LARGE();n=Array(E.diskEntries);var a=E.offset;for(var l=0;l<n.length;l++){var d=a,t=new Qe(S,e);if(t.header=e.slice(d,d+=R.Constants.CENHDR),t.entryName=e.slice(d,d+=t.header.fileNameLength),t.header.extraLength)t.extra=e.slice(d,d+=t.header.extraLength);if(t.header.commentLength)t.comment=e.slice(d,d+t.header.commentLength);if(a+=t.header.centralHeaderSize,t.entryName in o)throw R.Errors.DUPLICATE_ENTRY(`"${t.entryName}"`);n[l]=t,o[t.entryName]=t}C.clear(),O()}function s(a){var l=e.length-R.Constants.ENDHDR,d=Math.max(0,l-65535),t=d,u=e.length,I=-1,L=0;if(typeof S.trailingSpace==="boolean"?S.trailingSpace:!1)d=0;for(l;l>=t;l--){if(e[l]!==80)continue;if(e.readUInt32LE(l)===R.Constants.ENDSIG){I=l,L=l,u=l+R.Constants.ENDHDR,t=l-R.Constants.END64HDR;continue}if(e.readUInt32LE(l)===R.Constants.END64SIG){t=d;continue}if(e.readUInt32LE(l)===R.Constants.ZIP64SIG){I=l,u=l+R.readBigUInt64LE(e,l+R.Constants.ZIP64SIZE)+R.Constants.ZIP64LEAD;break}}if(I==-1)throw R.Errors.INVALID_FORMAT();if(E.loadFromBinary(e.slice(I,u)),E.commentLength)f=e.slice(L+R.Constants.ENDHDR);if(a)A()}function c(){if(n.length>1&&!N)n=n.map((a)=>({entry:a,key:a.entryName.toLowerCase()})).sort((a,l)=>a.key.localeCompare(l.key)).map((a)=>a.entry)}return{get entries(){if(!i)A();return n.filter((a)=>!C.has(a))},get comment(){return _.decode(f)},set comment(a){f=R.toBuffer(a,_.encode),E.commentLength=f.length},getEntryCount:function(){if(!i)return E.diskEntries;return n.length},forEach:function(a){this.entries.forEach(a)},getEntry:function(a){if(!i)A();return o[a]||null},setEntry:function(a){if(!i)A();n.push(a),o[a.entryName]=a,E.totalEntries=n.length},deleteFile:function(a,l=!0){if(!i)A();let d=o[a];this.getEntryChildren(d,l).map((u)=>u.entryName).forEach(this.deleteEntry)},deleteEntry:function(a){if(!i)A();let l=o[a],d=n.indexOf(l);if(d>=0)n.splice(d,1),delete o[a],E.totalEntries=n.length},getEntryChildren:function(a,l=!0){if(!i)A();if(typeof a==="object")if(a.isDirectory&&l){let d=[],t=a.entryName;for(let u of n)if(u.entryName.startsWith(t))d.push(u);return d}else return[a];return[]},getChildCount:function(a){if(a&&a.isDirectory){let l=this.getEntryChildren(a);return l.includes(a)?l.length-1:l.length}return 0},compressToBuffer:function(){if(!i)A();c();let a=[],l=[],d=0,t=0;E.size=0,E.offset=0;let u=0;for(let g of this.entries){let p=g.getCompressedData();g.header.offset=t;let x=g.packLocalHeader(),w=x.length+p.length;t+=w,a.push(x),a.push(p);let U=g.packCentralHeader();l.push(U),E.size+=U.length,d+=w+U.length,u++}d+=E.mainHeaderSize,E.offset=t,E.totalEntries=u,t=0;let I=Buffer.alloc(d);for(let g of a)g.copy(I,t),t+=g.length;for(let g of l)g.copy(I,t),t+=g.length;let L=E.toBinary();if(f)f.copy(L,L.length-f.length);return L.copy(I,t),e=I,i=!1,I},toAsyncBuffer:function(a,l,d,t){try{if(!i)A();c();let u=[],I=[],L=0,g=0,p=0;E.size=0,E.offset=0;let x=function(w){if(w.length>0){let U=w.shift(),P=U.entryName+U.extra.toString();if(d)d(P);U.getCompressedDataAsync(function(v){if(t)t(P);U.header.offset=g;let b=U.packLocalHeader(),ne=b.length+v.length;g+=ne,u.push(b),u.push(v);let k=U.packCentralHeader();I.push(k),E.size+=k.length,L+=ne+k.length,p++,x(w)})}else{L+=E.mainHeaderSize,E.offset=g,E.totalEntries=p,g=0;let U=Buffer.alloc(L);u.forEach(function(v){v.copy(U,g),g+=v.length}),I.forEach(function(v){v.copy(U,g),g+=v.length});let P=E.toBinary();if(f)f.copy(P,P.length-f.length);P.copy(U,g),e=U,i=!1,a(U)}};x(Array.from(this.entries))}catch(u){l(u)}}}}});var it=H(function(yn,ot){var F=K(),T=j("path"),vt=de(),Ht=nt(),W=(...e)=>F.findLast(e,(r)=>typeof r==="boolean"),rt=(...e)=>F.findLast(e,(r)=>typeof r==="string"),Mt=(...e)=>F.findLast(e,(r)=>typeof r==="function"),zt={noSort:!1,readEntries:!1,method:F.Constants.NONE,fs:null};ot.exports=function(e,r){let n=null,o=Object.assign(Object.create(null),zt);if(e&&typeof e==="object"){if(!(e instanceof Uint8Array)){if(Object.assign(o,e),e=o.input?o.input:void 0,o.input)delete o.input}if(Buffer.isBuffer(e))n=e,o.method=F.Constants.BUFFER,e=void 0}Object.assign(o,r);let f=new F(o),E=(s)=>{s.filter((c)=>c.attr).sort((c,a)=>a.path.length-c.path.length).forEach((c)=>f.fs.chmodSync(c.path,c.attr))};if(typeof o.decoder!=="object"||typeof o.decoder.encode!=="function"||typeof o.decoder.decode!=="function")o.decoder=F.decoder;if(e&&typeof e==="string")if(f.fs.existsSync(e))o.method=F.Constants.FILE,o.filename=e,n=f.fs.readFileSync(e);else throw F.Errors.INVALID_FILENAME();let i=new Ht(n,o),{canonical:m,sanitize:C,zipnamefix:S}=F;function N(s){if(s&&i){var c;if(typeof s==="string")c=i.getEntry(T.posix.normalize(s));if(typeof s==="object"&&typeof s.entryName<"u"&&typeof s.header<"u")c=i.getEntry(s.entryName);if(c)return c}return null}function _(s){let{join:c,normalize:a,sep:l}=T.posix;return c(T.isAbsolute(s)?"/":".",a(l+s.split("\\").join(l)+l))}function O(s){if(s instanceof RegExp)return function(c){return function(a){return c.test(a)}}(s);else if(typeof s!=="function")return()=>!0;return s}let A=(s,c)=>{let a=c.slice(-1);return a=a===f.sep?f.sep:"",T.relative(s,c)+a};return{readFile:function(s,c){var a=N(s);return a&&a.getData(c)||null},childCount:function(s){let c=N(s);if(c)return i.getChildCount(c)},readFileAsync:function(s,c){var a=N(s);if(a)a.getDataAsync(c);else c(null,"getEntry failed for:"+s)},readAsText:function(s,c){var a=N(s);if(a){var l=a.getData();if(l&&l.length)return l.toString(c||"utf8")}return""},readAsTextAsync:function(s,c,a){var l=N(s);if(l)l.getDataAsync(function(d,t){if(t){c(d,t);return}if(d&&d.length)c(d.toString(a||"utf8"));else c("")});else c("")},deleteFile:function(s,c=!0){var a=N(s);if(a)i.deleteFile(a.entryName,c)},deleteEntry:function(s){var c=N(s);if(c)i.deleteEntry(c.entryName)},addZipComment:function(s){i.comment=s},getZipComment:function(){return i.comment||""},addZipEntryComment:function(s,c){var a=N(s);if(a)a.comment=c},getZipEntryComment:function(s){var c=N(s);if(c)return c.comment||"";return""},updateFile:function(s,c){var a=N(s);if(a)a.setData(c)},addLocalFile:function(s,c,a,l){if(f.fs.existsSync(s)){c=c?_(c):"";let d=T.win32.basename(T.win32.normalize(s));c+=a?a:d;let t=f.fs.statSync(s),u=t.isFile()?f.fs.readFileSync(s):Buffer.alloc(0);if(t.isDirectory())c+=f.sep;this.addFile(c,u,l,t)}else throw F.Errors.FILE_NOT_FOUND(s)},addLocalFileAsync:function(s,c){s=typeof s==="object"?s:{localPath:s};let a=T.resolve(s.localPath),{comment:l}=s,{zipPath:d,zipName:t}=s,u=this;f.fs.stat(a,function(I,L){if(I)return c(I,!1);d=d?_(d):"";let g=T.win32.basename(T.win32.normalize(a));if(d+=t?t:g,L.isFile())f.fs.readFile(a,function(p,x){if(p)return c(p,!1);return u.addFile(d,x,l,L),setImmediate(c,void 0,!0)});else if(L.isDirectory())return d+=f.sep,u.addFile(d,Buffer.alloc(0),l,L),setImmediate(c,void 0,!0)})},addLocalFolder:function(s,c,a){if(a=O(a),c=c?_(c):"",s=T.normalize(s),f.fs.existsSync(s)){let l=f.findFiles(s),d=this;if(l.length)for(let t of l){let u=T.join(c,A(s,t));if(a(u))d.addLocalFile(t,T.dirname(u))}}else throw F.Errors.FILE_NOT_FOUND(s)},addLocalFolderAsync:function(s,c,a,l){l=O(l),a=a?_(a):"",s=T.normalize(s);var d=this;f.fs.open(s,"r",function(t){if(t&&t.code==="ENOENT")c(void 0,F.Errors.FILE_NOT_FOUND(s));else if(t)c(void 0,t);else{var u=f.findFiles(s),I=-1,L=function(){if(I+=1,I<u.length){var g=u[I],p=A(s,g).split("\\").join("/");if(p=p.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^\x20-\x7E]/g,""),l(p))f.fs.stat(g,function(x,w){if(x)c(void 0,x);if(w.isFile())f.fs.readFile(g,function(U,P){if(U)c(void 0,U);else d.addFile(a+p,P,"",w),L()});else d.addFile(a+p+"/",Buffer.alloc(0),"",w),L()});else process.nextTick(()=>{L()})}else c(!0,void 0)};L()}})},addLocalFolderAsync2:function(s,c){let a=this;s=typeof s==="object"?s:{localPath:s};let l=T.resolve(s.localPath),{zipPath:d,filter:t,namefix:u}=s;if(t instanceof RegExp)t=function(g){return function(p){return g.test(p)}}(t);else if(typeof t!=="function")t=function(){return!0};if(d=d?_(d):"",u==="latin1")u=(g)=>g.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^\x20-\x7E]/g,"");if(typeof u!=="function")u=(g)=>g;let I=(g)=>T.join(d,u(A(l,g))),L=(g)=>T.win32.basename(T.win32.normalize(u(g)));f.fs.open(l,"r",function(g){if(g&&g.code==="ENOENT")c(F.Errors.FILE_NOT_FOUND(l),!1);else if(g)c(g,!1);else f.findFilesAsync(l,function(p,x){if(p)return c(p,!1);if(x=x.filter((w)=>t(I(w))),!x.length)return c(void 0,!0);setImmediate(x.reverse().reduce(function(w,U){return function(P,v){if(P||v===!1)return setImmediate(w,P,!1);a.addLocalFileAsync({localPath:U,zipPath:T.dirname(I(U)),zipName:L(U)},w)}},c))})})},addLocalFolderPromise:function(s,c){return new Promise((a,l)=>{this.addLocalFolderAsync2(Object.assign({localPath:s},c),(d,t)=>{if(d)return l(d);if(t)a(this)})})},addFile:function(s,c,a,l){s=S(s);let d=N(s),t=d!=null;if(!t)d=new vt(o),d.entryName=s;d.comment=a||"";let u=typeof l==="object"&&l instanceof f.fs.Stats;if(u)d.header.time=l.mtime;var I=d.isDirectory?16:0;let L=d.isDirectory?16384:32768;if(u)L|=4095&l.mode;else if(typeof l==="number")L|=4095&l;else L|=d.isDirectory?493:420;if(I=(I|L<<16)>>>0,d.attr=I,d.setData(c),!t)i.setEntry(d);return d},getEntries:function(s){return i.password=s,i?i.entries:[]},getEntry:function(s){return N(s)},getEntryCount:function(){return i.getEntryCount()},forEach:function(s){return i.forEach(s)},extractEntryTo:function(s,c,a,l,d,t){l=W(!1,l),d=W(!1,d),a=W(!0,a),t=rt(d,t);var u=N(s);if(!u)throw F.Errors.NO_ENTRY();var I=m(u.entryName),L=C(c,t&&!u.isDirectory?m(t):a?I:T.basename(I));if(u.isDirectory){var g=i.getEntryChildren(u);return g.forEach(function(w){if(w.isDirectory)return;var U=w.getData();if(!U)throw F.Errors.CANT_EXTRACT_FILE();var P=m(a?w.entryName:w.entryName.substring(u.entryName.length)),v=C(c,P);f.assertPathSafe(c,v);let b=d?w.header.fileAttr:void 0;f.writeFileTo(v,U,l,b)}),!0}var p=u.getData(i.password);if(!p)throw F.Errors.CANT_EXTRACT_FILE();if(f.assertPathSafe(c,L),f.fs.existsSync(L)&&!l)throw F.Errors.CANT_OVERRIDE();let x=d?s.header.fileAttr:void 0;return f.writeFileTo(L,p,l,x),!0},test:function(s){if(!i)return!1;for(var c of i.entries)try{if(c.isDirectory)continue;var a=c.getData(s);if(!a)return!1}catch(l){return!1}return!0},extractAllTo:function(s,c,a,l){if(a=W(!1,a),l=rt(a,l),c=W(!1,c),!i)throw F.Errors.NO_ZIP();let d=[];i.entries.forEach(function(t){var u=C(s,m(t.entryName));if(f.assertPathSafe(s,u),t.isDirectory){if(f.makeDir(u),a)d.push({path:u,attr:t.header.fileAttr});return}var I=t.getData(l);if(!I)throw F.Errors.CANT_EXTRACT_FILE();let L=a?t.header.fileAttr:void 0;f.writeFileTo(u,I,c,L);try{f.fs.utimesSync(u,t.header.time,t.header.time)}catch(g){}}),E(d)},extractAllToAsync:function(s,c,a,l){if(l=Mt(c,a,l),a=W(!1,a),c=W(!1,c),!l)return new Promise((p,x)=>{this.extractAllToAsync(s,c,a,function(w){if(w)x(w);else p(this)})});if(!i){l(F.Errors.NO_ZIP());return}s=T.resolve(s);let d=(p)=>C(s,T.normalize(m(p.entryName))),t=(p,x)=>Error(p+': "'+x+'"'),u=[],I=[];i.entries.forEach((p)=>{if(p.isDirectory)u.push(p);else I.push(p)});let L=[];for(let p of u){let x=d(p),w=a?p.header.fileAttr:void 0;try{f.assertPathSafe(s,x),f.makeDir(x)}catch(U){l(t("Unable to create folder",x));continue}if(w)L.push({path:x,attr:w});try{f.fs.utimesSync(x,p.header.time,p.header.time)}catch(U){}}let g=(p)=>{if(!p)try{E(L)}catch(x){return l(t("Unable to set folder permissions",x.path||""))}l(p)};I.reverse().reduce(function(p,x){return function(w){if(w)p(w);else{let U=T.normalize(m(x.entryName)),P=C(s,U);try{f.assertPathSafe(s,P)}catch(v){return p(v)}x.getDataAsync(function(v,b){if(b)p(b);else if(!v)p(F.Errors.CANT_EXTRACT_FILE());else{let ne=a?x.header.fileAttr:void 0;f.writeFileToAsync(P,v,c,ne,function(k){if(!k)return p(t("Unable to write file",P));f.fs.utimes(P,x.header.time,x.header.time,function(){p()})})}})}}},g)()},writeZip:function(s,c){if(arguments.length===1){if(typeof s==="function")c=s,s=""}if(!s&&o.filename)s=o.filename;if(!s)return;var a=i.compressToBuffer();if(a){var l=f.writeFileTo(s,a,!0);if(typeof c==="function")c(!l?Error("failed"):null,"")}},writeZipPromise:function(s,c){let{overwrite:a,perm:l}=Object.assign({overwrite:!0},c);return new Promise((d,t)=>{if(!s&&o.filename)s=o.filename;if(!s)t("ADM-ZIP: ZIP File Name Missing");this.toBufferPromise().then((u)=>{let I=(L)=>L?d(L):t("ADM-ZIP: Wasn't able to write zip file");f.writeFileToAsync(s,u,a,l,I)},t)})},toBufferPromise:function(){return new Promise((s,c)=>{i.toAsyncBuffer(s,c)})},toBuffer:function(s,c,a,l){if(typeof s==="function")return i.toAsyncBuffer(s,c,a,l),null;return i.compressToBuffer()}}}});var st=J(()=>{ce()});_e();st();var at=ht(it());import{parentPort as ft,workerData as Gt}from"worker_threads";import*as ct from"path";function bt(){let{bundlePath:e,destination:r}=Gt;try{let n=new at.default(e);Ne(n,r),n.extractAllTo(ct.resolve(r),!0);let o={ok:!0};ft?.postMessage(o)}catch(n){let o={ok:!1,message:Q(n),stack:n instanceof Error?n.stack:void 0};ft?.postMessage(o)}}bt();
4
4
 
5
- //# debugId=D0F991E8B7938CEB64756E2164756E21
5
+ //# debugId=5BF042EC4119BFCA64756E2164756E21
@@ -5,6 +5,7 @@
5
5
  [![DeepScan grade](https://deepscan.io/api/teams/5165/projects/8526/branches/103329/badge/grade.svg)](https://deepscan.io/dashboard#view=project&tid=5165&pid=8526&bid=103329)
6
6
  [![Known Vulnerabilities](https://snyk.io/test/github/Borewit/strtok3/badge.svg?targetFile=package.json)](https://snyk.io/test/github/Borewit/strtok3?targetFile=package.json)
7
7
  [![Codacy Badge](https://api.codacy.com/project/badge/Grade/59dd6795e61949fb97066ca52e6097ef)](https://www.codacy.com/app/Borewit/strtok3?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=Borewit/strtok3&amp;utm_campaign=Badge_Grade)
8
+ [![Codecov](https://codecov.io/gh/Borewit/strtok3/branch/master/graph/badge.svg)](https://codecov.io/gh/Borewit/strtok3)
8
9
  # strtok3
9
10
 
10
11
  A promise-based streaming [*tokenizer*](#tokenizer-object) for [Node.js](https://nodejs.org) and browsers.
@@ -45,7 +46,7 @@ For TypeScript CommonJS backward compatibility, you can use [load-esm](https://g
45
46
  Use Node.js 24 LTS to build the project and install development dependencies.
46
47
  This build requirement is separate from the Node.js ≥ 18 runtime requirement in `package.json`.
47
48
  CI builds once with Node.js 24, then runs the compiled JavaScript unit tests across the Node.js compatibility matrix and Bun 1.2.x, 1.3.x, and 1.4.x.
48
- Coverage is collected in a separate Node.js 24 job.
49
+ Coverage is collected in a separate Node.js 24 job and uploaded to Codecov.
49
50
 
50
51
  For local development, running the TypeScript tests with `tsx` requires Node.js 18.19+ (18.x) or Node.js ≥ 20.6.0.
51
52
 
@@ -65,15 +66,18 @@ If you find this project useful and would like to support its development, consi
65
66
  Use one of the methods to instantiate an [*abstract tokenizer*](#tokenizer-object):
66
67
  - [fromBlob](#fromblob-function)
67
68
  - [fromBuffer](#frombuffer-function)
68
- - [fromFile](#fromfile-function)*
69
- - [fromStream](#fromstream-function)*
69
+ - [fromFile](#fromfile-function)
70
+ - [fromStream](#fromstream-function)
70
71
  - [fromWebStream](#fromwebstream-function)
72
+ - [createTokenizerView](#createtokenizerview-function)
71
73
 
72
74
  > [!NOTE]
73
75
  > `fromFile` requires Node.js file-system APIs, and `fromStream` requires a Node.js readable stream.
74
76
  > In browsers, use `fromBlob`, `fromBuffer`, or `fromWebStream`.
75
77
 
76
78
  All methods return a [`Tokenizer`](#tokenizer-object), either directly or via a promise.
79
+ The `strtok3/core` entry point exports all factories except `fromFile` and can be used
80
+ without Node.js file-system APIs. In browsers, `strtok3` resolves to this core entry point.
77
81
 
78
82
  #### `fromBlob()` function
79
83
 
@@ -141,13 +145,13 @@ parse();
141
145
  Creates a [*tokenizer*](#tokenizer-object) from a local file.
142
146
 
143
147
  ```ts
144
- function fromFile(sourceFilePath: string, options?: ITokenizerOptions): Promise<FileTokenizer>
148
+ function fromFile(sourceFilePath: string, options?: IFromFileOptions): Promise<FileTokenizer>
145
149
  ```
146
150
 
147
151
  | Parameter | Type | Description |
148
152
  |----------------|----------|----------------------------|
149
153
  | sourceFilePath | `string` | Path to file to read from |
150
- | options | [ITokenizerOptions](#itokenizeroptions-interface) | Optional tokenizer options |
154
+ | options | [IFromFileOptions](#ifromfileoptions-interface) | Optional file tokenizer options |
151
155
 
152
156
  > [!NOTE]
153
157
  > - Only available for Node.js engines
@@ -248,6 +252,83 @@ async function parse() {
248
252
  parse();
249
253
  ```
250
254
 
255
+ #### `createTokenizerView()` function
256
+
257
+ Borrow a finite range of an existing tokenizer without buffering it or taking
258
+ ownership of its input. Available from both `strtok3` and `strtok3/core`.
259
+
260
+ ```ts
261
+ function createTokenizerView(source: ITokenizer, length: number): ITokenizerView
262
+ ```
263
+
264
+ The view starts at `source.position`, with local `position` zero and
265
+ `fileInfo.size` equal to `length`. Creation does not read or skip bytes. The size
266
+ is the declared range, so it can exceed the actual remaining input. The outer
267
+ file's MIME type, path, and URL are not copied to the view.
268
+
269
+ ```js
270
+ import { createTokenizerView, fromBuffer } from 'strtok3';
271
+ import { UINT8 } from 'token-types';
272
+
273
+ const source = fromBuffer(new Uint8Array([10, 20, 30, 40, 50]));
274
+ await source.ignore(1);
275
+ const chunk = createTokenizerView(source, 3); // source bytes [20, 30, 40]
276
+
277
+ console.log(await chunk.readToken(UINT8)); // 20; chunk.position = 1
278
+ const child = chunk.createView(1); // same as createTokenizerView(chunk, 1)
279
+ console.log(await child.readToken(UINT8)); // 30; chunk.position = 2
280
+ await child.close(); // source stays open, at position 3
281
+
282
+ console.log(chunk.remaining); // 1
283
+ await chunk.consumeRemainder(); // exactly consume 40, or throw on truncation
284
+ await chunk.close();
285
+ console.log(await source.readToken(UINT8)); // 50
286
+ await source.close();
287
+ ```
288
+
289
+ All read and peek positions, including explicit offsets and `setPosition()`, are
290
+ relative to the view's start. Nested views must fit inside their parent's
291
+ remaining range. A view exposes `setPosition()` and reports random access only
292
+ when its source supports it; a stream with a known size remains forward-only.
293
+ The overload for an `IRandomAccessTokenizer` returns an
294
+ `IRandomAccessTokenizerView`, including for nested `createView()` calls.
295
+
296
+ A request crossing the declared boundary rejects with `TokenizerBoundaryError`,
297
+ a `RangeError` with `position`, `length`, and `size` properties. This applies to
298
+ reads, peeks, tokens, and skips, even with `mayBeLess: true`. Invalid lengths,
299
+ offsets, and unsafe offset arithmetic reject before allocating token buffers or
300
+ consuming input. The source's token allocation and stream lookahead limits still
301
+ apply through nested views.
302
+
303
+ A request inside the view that encounters truncated underlying input rejects
304
+ with `EndOfStreamError`. Buffer reads and peeks with `mayBeLess: true` may return
305
+ fewer bytes within the requested range; token reads and peeks always require a
306
+ complete token. A failed exact read may have consumed part of the input; the
307
+ shared cursor reflects the bytes consumed. Peeks do not advance that cursor.
308
+
309
+ `ignore()` preserves the source's skip behavior, which may return a shorter
310
+ count or reject at EOF. Use `consumeRemainder()` when the entire declared
311
+ remainder must exist: it returns the number consumed, or rejects with
312
+ `EndOfStreamError`. On random-access sources it verifies the final byte and
313
+ advances the cursor without reading the whole remainder. On streams it drains
314
+ the remainder using the source's bounded skip buffers.
315
+
316
+ The source, parent, child, and sibling views share one cursor. Use them
317
+ sequentially, and close a child before resuming its parent. `close()` is
318
+ idempotent, does not drain the remainder, and never closes or aborts the source.
319
+ After a partially consumed child closes, the parent resumes at that same byte,
320
+ not at the child's declared end. Call `child.consumeRemainder()` before closing
321
+ when the parent should resume after the entire child range. Closed views reject
322
+ further operations and keep their last local position; closing a parent view
323
+ also prevents its children from being used.
324
+
325
+ Overlapping operations through a view or its parent/child chain are rejected;
326
+ `close()` also rejects while that view has an active operation. Direct operations
327
+ on the original source, or separate views created from it, cannot be coordinated
328
+ by a view, so callers must keep those sequential too. Explicit `abort()`
329
+ propagates to the shared source to cancel pending input and affects its other
330
+ users; it also closes the view.
331
+
251
332
  ### `Tokenizer` object
252
333
  The *tokenizer* is an abstraction of a [stream](https://nodejs.org/api/stream.html), file or [Uint8Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array), allowing _reading_ or _peeking_ from the stream.
253
334
  It can also be translated in chunked reads, as done in [@tokenizer/http](https://github.com/Borewit/tokenizer-http);
@@ -264,9 +345,18 @@ It can also be translated in chunked reads, as done in [@tokenizer/http](https:/
264
345
  _Read_ methods advance the stream pointer, while _peek_ methods do not.
265
346
 
266
347
  There are two kinds of functions:
267
- 1. *read* methods: used to read a *token* or bytes into a buffer from the [*tokenizer*](#tokenizer-object). The position of the *tokenizer-stream* will advance with the number of bytes read.
348
+ 1. *read* methods: used to read a *token* or bytes into a buffer from the [*tokenizer*](#tokenizer-object). After a successful read, `tokenizer.position` is the starting position of the read plus the number of bytes read. An explicit position can skip ahead or, for random-access tokenizers, move backwards.
268
349
  2. *peek* methods: same as the read, but it will *not* advance the pointer. It allows to read (peek) ahead.
269
350
 
351
+ Reads and peeks require the full requested length unless `mayBeLess: true` is passed to
352
+ `readBuffer` or `peekBuffer`. Otherwise, insufficient input rejects with the exported
353
+ `EndOfStreamError`. Token methods always require the full token.
354
+
355
+ A failed exact stream read can consume partial input and advance `tokenizer.position`
356
+ by the number of bytes consumed. A failed exact stream peek leaves `tokenizer.position`
357
+ unchanged and retains the partial bytes for subsequent reads. Caller-provided buffers
358
+ may contain partial data even when the operation rejects.
359
+
270
360
  #### `readBuffer` function
271
361
 
272
362
  Read data from the _tokenizer_ into provided "buffer" (`Uint8Array`).
@@ -342,6 +432,8 @@ readNumber(token: IToken<number>): Promise<number>
342
432
  | token | [IToken<number>](#token-object) | Numeric token to read from the tokenizer-stream. |
343
433
 
344
434
  A promise resolving to a numeric value read and decoded from the *tokenizer-stream*.
435
+ Uses a reusable 8-byte buffer, so `token.len` must be at most 8 bytes.
436
+ For larger tokens or values such as `bigint`, use `readToken` instead.
345
437
 
346
438
  #### `peekNumber` function
347
439
 
@@ -353,10 +445,11 @@ peekNumber(token: IToken<number>): Promise<number>
353
445
 
354
446
  Returns a promise resolving to the decoded numeric value.
355
447
  Like `readNumber`, rejects with `EndOfStreamError` if the token cannot be read in full.
448
+ The same 8-byte token limit applies; use `peekToken` for larger tokens or values such as `bigint`.
356
449
 
357
450
  #### `ignore` function
358
451
 
359
- Advance the offset pointer with the token number of bytes provided.
452
+ Advance the offset pointer by the given number of bytes.
360
453
 
361
454
  ```ts
362
455
  ignore(length: number): Promise<number>
@@ -364,7 +457,7 @@ ignore(length: number): Promise<number>
364
457
 
365
458
  | Parameter | Type | Description |
366
459
  |------------|--------|------------------------------------------------------------------|
367
- | length | number | Non-negative number of bytes to ignore. Advances `tokenizer.position`. |
460
+ | length | number | Non-negative safe integer number of bytes to ignore. Advances `tokenizer.position`. |
368
461
 
369
462
  Returns a promise resolving to the number of bytes ignored.
370
463
  Buffer, blob, and file tokenizers stop at the known file size. Stream tokenizers reject with `EndOfStreamError` if the requested bytes are unavailable.
@@ -390,6 +483,10 @@ abort(): Promise<void>
390
483
 
391
484
  This is a no-op for buffer, blob, and file tokenizers.
392
485
 
486
+ For Node.js streams, pending reads reject with the exported `AbortError`, and buffered
487
+ peek data is discarded. The underlying stream is not destroyed. Calling `close()` or
488
+ aborting the configured `AbortSignal` has the same effect on pending Node.js stream reads.
489
+
393
490
  For Web streams, `abort()` releases a BYOB reader's lock without cancelling the source. A default reader cancels the source but keeps its lock until `close()` is called. An `AbortSignal` invokes the same abort behavior.
394
491
 
395
492
  #### `supportsRandomAccess` function
@@ -401,6 +498,25 @@ supportsRandomAccess(): boolean
401
498
  Returns `true` for buffer, blob, and file tokenizers, and `false` for stream tokenizers.
402
499
  When random access is supported, read and peek methods can use positions before `tokenizer.position`.
403
500
 
501
+ #### `isRandomAccessTokenizer` helper
502
+
503
+ Exported from both `strtok3` and `strtok3/core`:
504
+
505
+ ```ts
506
+ import { isRandomAccessTokenizer, type ITokenizer } from 'strtok3';
507
+
508
+ function skipToEnd(tokenizer: ITokenizer): void {
509
+ if (isRandomAccessTokenizer(tokenizer)) {
510
+ tokenizer.setPosition(tokenizer.fileInfo.size);
511
+ }
512
+ }
513
+ ```
514
+
515
+ Narrows `ITokenizer` to `IRandomAccessTokenizer` by checking `supportsRandomAccess()`,
516
+ a callable `setPosition`, and a numeric file size. A known size alone does not imply
517
+ random access. Existing third-party implementations can keep returning a boolean
518
+ from `supportsRandomAccess()` without changing their interface.
519
+
404
520
  #### `setPosition` function
405
521
 
406
522
  Available on buffer, blob, and file tokenizers (`IRandomAccessTokenizer`).
@@ -471,16 +587,51 @@ try {
471
587
  }
472
588
  ```
473
589
 
590
+ ### `IFromFileOptions` interface
591
+
592
+ Extends [ITokenizerOptions](#itokenizeroptions-interface) for `fromFile()`.
593
+
594
+ | Attribute | Type | Description |
595
+ |-----------|------|-------------|
596
+ | regularFileOnly | `boolean` | When `true`, opens with `O_RDONLY \| O_NONBLOCK` and checks that the opened handle refers to a regular file. Defaults to `false`, preserving existing behavior. |
597
+
598
+ Use this option when non-regular inputs, such as FIFOs, should be rejected without waiting for a writer. Validation uses the opened handle, so replacing the pathname before opening does not bypass the check. Symbolic links to regular files are accepted.
599
+
600
+ If an opened handle is not a regular file, `fromFile()` closes it and rejects with the exported `NotRegularFileError`. Its `path` property identifies the requested path. Opening errors, stat errors, and abort errors continue to propagate; any handle acquired by the factory is closed if setup fails. After success, the caller must close the tokenizer.
601
+
602
+ ```js
603
+ import { fromFile, NotRegularFileError } from 'strtok3';
604
+
605
+ try {
606
+ const tokenizer = await fromFile('somefile.bin', { regularFileOnly: true });
607
+ try {
608
+ // Parse the regular file.
609
+ } finally {
610
+ await tokenizer.close();
611
+ }
612
+ } catch (error) {
613
+ if (!(error instanceof NotRegularFileError)) {
614
+ throw error;
615
+ }
616
+ // Handle an input that is not a regular file.
617
+ }
618
+ ```
619
+
474
620
  ### `IReadChunkOptions` interface
475
621
 
476
622
  Each attribute is optional:
477
623
 
478
624
  | Attribute | Type | Description |
479
625
  |-----------|---------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
480
- | length | number | Requested number of bytes to read or peek. Defaults to the target buffer length. |
481
- | position | number | Byte offset to read or peek from. Defaults to [tokenizer.position](#tokenizer-attributes) when omitted. Earlier positions require random access. |
626
+ | length | number | Requested number of bytes to read or peek. Must be a non-negative safe integer no larger than the target buffer length. Defaults to the target buffer length. |
627
+ | position | number | Byte offset to read or peek from. Must be a non-negative safe integer. Defaults to [tokenizer.position](#tokenizer-attributes) when omitted. Earlier positions require random access. |
482
628
  | mayBeLess | boolean | If `true`, allows fewer than the requested number of bytes to be read or peeked instead of throwing `EndOfStreamError`. Defaults to `false`. |
483
629
 
630
+ Invalid lengths or positions, including a `position + length` that exceeds the safe
631
+ integer range, reject with `RangeError`. Requesting an earlier position on a tokenizer
632
+ without random access rejects with `Error`. Data is written starting at index 0 of the
633
+ target buffer. To write at an offset, pass `buffer.subarray(offset)` as the target buffer.
634
+
484
635
  Example usage:
485
636
  ```js
486
637
  const bytesPeeked = await tokenizer.peekBuffer(buffer, {mayBeLess: true});
@@ -31,7 +31,7 @@ export class BufferTokenizer extends AbstractTokenizer {
31
31
  */
32
32
  async peekBuffer(uint8Array, options) {
33
33
  const normOptions = this.normalizeOptions(uint8Array, options);
34
- const bytes2read = Math.min(this.uint8Array.length - normOptions.position, normOptions.length);
34
+ const bytes2read = Math.max(0, Math.min(this.uint8Array.length - normOptions.position, normOptions.length));
35
35
  if (!normOptions.mayBeLess && bytes2read < normOptions.length) {
36
36
  throw new EndOfStreamError();
37
37
  }
@@ -1,7 +1,9 @@
1
- import { open as fsOpen } from 'node:fs/promises';
1
+ import { constants } from 'node:fs';
2
+ import fs, {} from 'node:fs/promises';
2
3
  import { throwIfAborted } from './AbortSignal.js';
3
4
  import { AbstractTokenizer } from './AbstractTokenizer.js';
4
5
  import { getMaxBufferSize } from './BufferSizeError.js';
6
+ import { NotRegularFileError } from './NotRegularFileError.js';
5
7
  import { EndOfStreamError } from './stream/index.js';
6
8
  export class FileTokenizer extends AbstractTokenizer {
7
9
  /**
@@ -12,9 +14,13 @@ export class FileTokenizer extends AbstractTokenizer {
12
14
  static async fromFile(sourceFilePath, options) {
13
15
  getMaxBufferSize(options);
14
16
  throwIfAborted(options?.abortSignal);
15
- const fileHandle = await fsOpen(sourceFilePath, 'r');
17
+ const flags = options?.regularFileOnly ? constants.O_RDONLY | constants.O_NONBLOCK : 'r';
18
+ const fileHandle = await fs.open(sourceFilePath, flags);
16
19
  try {
17
20
  const stat = await fileHandle.stat();
21
+ if (options?.regularFileOnly && !stat.isFile()) {
22
+ throw new NotRegularFileError(sourceFilePath);
23
+ }
18
24
  return new FileTokenizer(fileHandle, {
19
25
  ...options,
20
26
  fileInfo: { ...options?.fileInfo, path: sourceFilePath, size: stat.size }
@@ -0,0 +1,8 @@
1
+ /** Thrown when regularFileOnly is enabled and the opened handle is not a regular file. */
2
+ export class NotRegularFileError extends Error {
3
+ constructor(path) {
4
+ super(`Not a regular file: ${path}`);
5
+ this.path = path;
6
+ this.name = 'NotRegularFileError';
7
+ }
8
+ }
@@ -32,9 +32,10 @@ export class ReadStreamTokenizer extends AbstractTokenizer {
32
32
  return 0;
33
33
  }
34
34
  let bytesRead = 0;
35
+ // Account for partial input before reporting an exact-read failure.
35
36
  while (bytesRead < normOptions.length) {
36
37
  const chunkLength = Math.min(this.maxBufferSize, normOptions.length - bytesRead);
37
- const count = await this.streamReader.read(uint8Array.subarray(bytesRead, bytesRead + chunkLength), normOptions.mayBeLess);
38
+ const count = await this.streamReader.read(uint8Array.subarray(bytesRead, bytesRead + chunkLength), true);
38
39
  bytesRead += count;
39
40
  this.position += count;
40
41
  if (count < chunkLength) {
@@ -75,7 +76,11 @@ export class ReadStreamTokenizer extends AbstractTokenizer {
75
76
  }
76
77
  if (normOptions.length > 0) {
77
78
  try {
78
- bytesRead = await this.streamReader.peek(uint8Array.subarray(0, normOptions.length), normOptions.mayBeLess);
79
+ // The reader retains this buffer. Keep it independent of caller-owned memory,
80
+ // including partial bytes retained when an exact peek encounters truncation.
81
+ const peekBuffer = new Uint8Array(normOptions.length);
82
+ bytesRead = await this.streamReader.peek(peekBuffer, true);
83
+ uint8Array.set(peekBuffer.subarray(0, bytesRead));
79
84
  }
80
85
  catch (err) {
81
86
  if (options?.mayBeLess && err instanceof EndOfStreamError) {
@@ -0,0 +1,10 @@
1
+ /** A request exceeds a tokenizer view, rather than encountering truncated input. */
2
+ export class TokenizerBoundaryError extends RangeError {
3
+ constructor(position, length, size) {
4
+ super(`Range at position ${position} with length ${length} exceeds tokenizer view size ${size}`);
5
+ this.position = position;
6
+ this.length = length;
7
+ this.size = size;
8
+ this.name = 'TokenizerBoundaryError';
9
+ }
10
+ }