pyright
Version:
Type checker for the Python language
2 lines • 757 kB
JavaScript
/*! For license information please see vendor.js.LICENSE.txt */
exports.id=121,exports.ids=[121],exports.modules={2007:(A,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.AliasFS=void 0;const o=t(5086);class r extends o.ProxiedFS{constructor(A,{baseFs:e,pathUtils:t}){super(t),this.target=A,this.baseFs=e}getRealPath(){return this.target}getBaseFs(){return this.baseFs}mapFromBase(A){return A}mapToBase(A){return A}}e.AliasFS=r},7237:(A,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.CwdFS=void 0;const o=t(6825),r=t(5086),n=t(8169);class i extends r.ProxiedFS{constructor(A,{baseFs:e=new o.NodeFS}={}){super(n.ppath),this.target=this.pathUtils.normalize(A),this.baseFs=e}getRealPath(){return this.pathUtils.resolve(this.baseFs.getRealPath(),this.target)}resolve(A){return this.pathUtils.isAbsolute(A)?n.ppath.normalize(A):this.baseFs.resolve(n.ppath.join(this.target,A))}mapFromBase(A){return A}mapToBase(A){return this.pathUtils.isAbsolute(A)?A:this.pathUtils.join(this.target,A)}}e.CwdFS=i},9860:(A,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.normalizeLineEndings=e.BasePortableFakeFS=e.FakeFS=void 0;const o=t(857),r=t(9801),n=t(8169);class i{constructor(A){this.pathUtils=A}async*genTraversePromise(A,{stableSort:e=!1}={}){const t=[A];for(;t.length>0;){const A=t.shift();if((await this.lstatPromise(A)).isDirectory()){const o=await this.readdirPromise(A);if(!e)throw new Error("Not supported");for(const e of o.sort())t.push(this.pathUtils.join(A,e))}else yield A}}async removePromise(A,{recursive:e=!0,maxRetries:t=5}={}){let o;try{o=await this.lstatPromise(A)}catch(A){if("ENOENT"===A.code)return;throw A}if(o.isDirectory()){if(e){const e=await this.readdirPromise(A);await Promise.all(e.map((e=>this.removePromise(this.pathUtils.resolve(A,e)))))}for(let e=0;e<=t;e++)try{await this.rmdirPromise(A);break}catch(A){if("EBUSY"!==A.code&&"ENOTEMPTY"!==A.code)throw A;e<t&&await new Promise((A=>setTimeout(A,100*e)))}}else await this.unlinkPromise(A)}removeSync(A,{recursive:e=!0}={}){let t;try{t=this.lstatSync(A)}catch(A){if("ENOENT"===A.code)return;throw A}if(t.isDirectory()){if(e)for(const e of this.readdirSync(A))this.removeSync(this.pathUtils.resolve(A,e));this.rmdirSync(A)}else this.unlinkSync(A)}async mkdirpPromise(A,{chmod:e,utimes:t}={}){if((A=this.resolve(A))===this.pathUtils.dirname(A))return;const o=A.split(this.pathUtils.sep);let r;for(let A=2;A<=o.length;++A){const n=o.slice(0,A).join(this.pathUtils.sep);if(!this.existsSync(n)){try{await this.mkdirPromise(n)}catch(A){if("EEXIST"===A.code)continue;throw A}if(null!=r||(r=n),null!=e&&await this.chmodPromise(n,e),null!=t)await this.utimesPromise(n,t[0],t[1]);else{const A=await this.statPromise(this.pathUtils.dirname(n));await this.utimesPromise(n,A.atime,A.mtime)}}}return r}mkdirpSync(A,{chmod:e,utimes:t}={}){if((A=this.resolve(A))===this.pathUtils.dirname(A))return;const o=A.split(this.pathUtils.sep);let r;for(let A=2;A<=o.length;++A){const n=o.slice(0,A).join(this.pathUtils.sep);if(!this.existsSync(n)){try{this.mkdirSync(n)}catch(A){if("EEXIST"===A.code)continue;throw A}if(null!=r||(r=n),null!=e&&this.chmodSync(n,e),null!=t)this.utimesSync(n,t[0],t[1]);else{const A=this.statSync(this.pathUtils.dirname(n));this.utimesSync(n,A.atime,A.mtime)}}}return r}async copyPromise(A,e,{baseFs:t=this,overwrite:o=!0,stableSort:n=!1,stableTime:i=!1,linkStrategy:g=null}={}){return await(0,r.copyPromise)(this,A,t,e,{overwrite:o,stableSort:n,stableTime:i,linkStrategy:g})}copySync(A,e,{baseFs:t=this,overwrite:o=!0}={}){const r=t.lstatSync(e),i=this.existsSync(A);if(r.isDirectory()){this.mkdirpSync(A);const r=t.readdirSync(e);for(const n of r)this.copySync(this.pathUtils.join(A,n),t.pathUtils.join(e,n),{baseFs:t,overwrite:o})}else if(r.isFile()){if(!i||o){i&&this.removeSync(A);const o=t.readFileSync(e);this.writeFileSync(A,o)}}else{if(!r.isSymbolicLink())throw new Error(`Unsupported file type (file: ${e}, mode: 0o${r.mode.toString(8).padStart(6,"0")})`);if(!i||o){i&&this.removeSync(A);const o=t.readlinkSync(e);this.symlinkSync((0,n.convertPath)(this.pathUtils,o),A)}}const g=511&r.mode;this.chmodSync(A,g)}async changeFilePromise(A,e,t={}){return Buffer.isBuffer(e)?this.changeFileBufferPromise(A,e,t):this.changeFileTextPromise(A,e,t)}async changeFileBufferPromise(A,e,{mode:t}={}){let o=Buffer.alloc(0);try{o=await this.readFilePromise(A)}catch(A){}0!==Buffer.compare(o,e)&&await this.writeFilePromise(A,e,{mode:t})}async changeFileTextPromise(A,e,{automaticNewlines:t,mode:o}={}){let r="";try{r=await this.readFilePromise(A,"utf8")}catch(A){}const n=t?g(r,e):e;r!==n&&await this.writeFilePromise(A,n,{mode:o})}changeFileSync(A,e,t={}){return Buffer.isBuffer(e)?this.changeFileBufferSync(A,e,t):this.changeFileTextSync(A,e,t)}changeFileBufferSync(A,e,{mode:t}={}){let o=Buffer.alloc(0);try{o=this.readFileSync(A)}catch(A){}0!==Buffer.compare(o,e)&&this.writeFileSync(A,e,{mode:t})}changeFileTextSync(A,e,{automaticNewlines:t=!1,mode:o}={}){let r="";try{r=this.readFileSync(A,"utf8")}catch(A){}const n=t?g(r,e):e;r!==n&&this.writeFileSync(A,n,{mode:o})}async movePromise(A,e){try{await this.renamePromise(A,e)}catch(t){if("EXDEV"!==t.code)throw t;await this.copyPromise(e,A),await this.removePromise(A)}}moveSync(A,e){try{this.renameSync(A,e)}catch(t){if("EXDEV"!==t.code)throw t;this.copySync(e,A),this.removeSync(A)}}async lockPromise(A,e){const t=`${A}.flock`,o=1e3/60,r=Date.now();let n=null;const i=async()=>{let A;try{[A]=await this.readJsonPromise(t)}catch(A){return Date.now()-r<500}try{return process.kill(A,0),!0}catch(A){return!1}};for(;null===n;)try{n=await this.openPromise(t,"wx")}catch(A){if("EEXIST"!==A.code)throw A;if(!await i())try{await this.unlinkPromise(t);continue}catch(A){}if(!(Date.now()-r<6e4))throw new Error(`Couldn't acquire a lock in a reasonable time (via ${t})`);await new Promise((A=>setTimeout(A,o)))}await this.writePromise(n,JSON.stringify([process.pid]));try{return await e()}finally{try{await this.closePromise(n),await this.unlinkPromise(t)}catch(A){}}}async readJsonPromise(A){const e=await this.readFilePromise(A,"utf8");try{return JSON.parse(e)}catch(e){throw e.message+=` (in ${A})`,e}}readJsonSync(A){const e=this.readFileSync(A,"utf8");try{return JSON.parse(e)}catch(e){throw e.message+=` (in ${A})`,e}}async writeJsonPromise(A,e){return await this.writeFilePromise(A,`${JSON.stringify(e,null,2)}\n`)}writeJsonSync(A,e){return this.writeFileSync(A,`${JSON.stringify(e,null,2)}\n`)}async preserveTimePromise(A,e){const t=await this.lstatPromise(A),o=await e();void 0!==o&&(A=o),this.lutimesPromise?await this.lutimesPromise(A,t.atime,t.mtime):t.isSymbolicLink()||await this.utimesPromise(A,t.atime,t.mtime)}async preserveTimeSync(A,e){const t=this.lstatSync(A),o=e();void 0!==o&&(A=o),this.lutimesSync?this.lutimesSync(A,t.atime,t.mtime):t.isSymbolicLink()||this.utimesSync(A,t.atime,t.mtime)}}function g(A,e){return e.replace(/\r?\n/g,function(A){const e=A.match(/\r?\n/g);if(null===e)return o.EOL;const t=e.filter((A=>"\r\n"===A)).length;return t>e.length-t?"\r\n":"\n"}(A))}e.FakeFS=i,e.BasePortableFakeFS=class extends i{constructor(){super(n.ppath)}},e.normalizeLineEndings=g},8165:(A,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.JailFS=void 0;const o=t(6825),r=t(5086),n=t(8169),i=n.PortablePath.root;class g extends r.ProxiedFS{constructor(A,{baseFs:e=new o.NodeFS}={}){super(n.ppath),this.target=this.pathUtils.resolve(n.PortablePath.root,A),this.baseFs=e}getRealPath(){return this.pathUtils.resolve(this.baseFs.getRealPath(),this.pathUtils.relative(n.PortablePath.root,this.target))}getTarget(){return this.target}getBaseFs(){return this.baseFs}mapToBase(A){const e=this.pathUtils.normalize(A);if(this.pathUtils.isAbsolute(A))return this.pathUtils.resolve(this.target,this.pathUtils.relative(i,A));if(e.match(/^\.\.\/?/))throw new Error(`Resolving this path (${A}) would escape the jail`);return this.pathUtils.resolve(this.target,A)}mapFromBase(A){return this.pathUtils.resolve(i,this.pathUtils.relative(this.target,A))}}e.JailFS=g},1847:(A,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.LazyFS=void 0;const o=t(5086);class r extends o.ProxiedFS{constructor(A,e){super(e),this.instance=null,this.factory=A}get baseFs(){return this.instance||(this.instance=this.factory()),this.instance}set baseFs(A){this.instance=A}mapFromBase(A){return A}mapToBase(A){return A}}e.LazyFS=r},5166:(A,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.NoFS=void 0;const o=t(9860),r=t(8169),n=()=>Object.assign(new Error("ENOSYS: unsupported filesystem access"),{code:"ENOSYS"});class i extends o.FakeFS{constructor(){super(r.ppath)}getExtractHint(){throw n()}getRealPath(){throw n()}resolve(){throw n()}async openPromise(){throw n()}openSync(){throw n()}async opendirPromise(){throw n()}opendirSync(){throw n()}async readPromise(){throw n()}readSync(){throw n()}async writePromise(){throw n()}writeSync(){throw n()}async closePromise(){throw n()}closeSync(){throw n()}createWriteStream(){throw n()}createReadStream(){throw n()}async realpathPromise(){throw n()}realpathSync(){throw n()}async readdirPromise(){throw n()}readdirSync(){throw n()}async existsPromise(A){throw n()}existsSync(A){throw n()}async accessPromise(){throw n()}accessSync(){throw n()}async statPromise(){throw n()}statSync(){throw n()}async fstatPromise(A){throw n()}fstatSync(A){throw n()}async lstatPromise(A){throw n()}lstatSync(A){throw n()}async fchmodPromise(){throw n()}fchmodSync(){throw n()}async chmodPromise(){throw n()}chmodSync(){throw n()}async fchownPromise(){throw n()}fchownSync(){throw n()}async chownPromise(){throw n()}chownSync(){throw n()}async mkdirPromise(){throw n()}mkdirSync(){throw n()}async rmdirPromise(){throw n()}rmdirSync(){throw n()}async linkPromise(){throw n()}linkSync(){throw n()}async symlinkPromise(){throw n()}symlinkSync(){throw n()}async renamePromise(){throw n()}renameSync(){throw n()}async copyFilePromise(){throw n()}copyFileSync(){throw n()}async appendFilePromise(){throw n()}appendFileSync(){throw n()}async writeFilePromise(){throw n()}writeFileSync(){throw n()}async unlinkPromise(){throw n()}unlinkSync(){throw n()}async utimesPromise(){throw n()}utimesSync(){throw n()}async readFilePromise(){throw n()}readFileSync(){throw n()}async readlinkPromise(){throw n()}readlinkSync(){throw n()}async truncatePromise(){throw n()}truncateSync(){throw n()}async ftruncatePromise(A,e){throw n()}ftruncateSync(A,e){throw n()}watch(){throw n()}watchFile(){throw n()}unwatchFile(){throw n()}}e.NoFS=i,i.instance=new i},6825:(A,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.NodeFS=void 0;const o=t(1791).__importDefault(t(9896)),r=t(9860),n=t(4241),i=t(8169);class g extends r.BasePortableFakeFS{constructor(A=o.default){super(),this.realFs=A,void 0!==this.realFs.lutimes&&(this.lutimesPromise=this.lutimesPromiseImpl,this.lutimesSync=this.lutimesSyncImpl)}getExtractHint(){return!1}getRealPath(){return i.PortablePath.root}resolve(A){return i.ppath.resolve(A)}async openPromise(A,e,t){return await new Promise(((o,r)=>{this.realFs.open(i.npath.fromPortablePath(A),e,t,this.makeCallback(o,r))}))}openSync(A,e,t){return this.realFs.openSync(i.npath.fromPortablePath(A),e,t)}async opendirPromise(A,e){return await new Promise(((t,o)=>{void 0!==e?this.realFs.opendir(i.npath.fromPortablePath(A),e,this.makeCallback(t,o)):this.realFs.opendir(i.npath.fromPortablePath(A),this.makeCallback(t,o))})).then((e=>Object.defineProperty(e,"path",{value:A,configurable:!0,writable:!0})))}opendirSync(A,e){const t=void 0!==e?this.realFs.opendirSync(i.npath.fromPortablePath(A),e):this.realFs.opendirSync(i.npath.fromPortablePath(A));return Object.defineProperty(t,"path",{value:A,configurable:!0,writable:!0})}async readPromise(A,e,t=0,o=0,r=-1){return await new Promise(((n,i)=>{this.realFs.read(A,e,t,o,r,((A,e)=>{A?i(A):n(e)}))}))}readSync(A,e,t,o,r){return this.realFs.readSync(A,e,t,o,r)}async writePromise(A,e,t,o,r){return await new Promise(((n,i)=>"string"==typeof e?this.realFs.write(A,e,t,this.makeCallback(n,i)):this.realFs.write(A,e,t,o,r,this.makeCallback(n,i))))}writeSync(A,e,t,o,r){return"string"==typeof e?this.realFs.writeSync(A,e,t):this.realFs.writeSync(A,e,t,o,r)}async closePromise(A){await new Promise(((e,t)=>{this.realFs.close(A,this.makeCallback(e,t))}))}closeSync(A){this.realFs.closeSync(A)}createReadStream(A,e){const t=null!==A?i.npath.fromPortablePath(A):A;return this.realFs.createReadStream(t,e)}createWriteStream(A,e){const t=null!==A?i.npath.fromPortablePath(A):A;return this.realFs.createWriteStream(t,e)}async realpathPromise(A){return await new Promise(((e,t)=>{this.realFs.realpath(i.npath.fromPortablePath(A),{},this.makeCallback(e,t))})).then((A=>i.npath.toPortablePath(A)))}realpathSync(A){return i.npath.toPortablePath(this.realFs.realpathSync(i.npath.fromPortablePath(A),{}))}async existsPromise(A){return await new Promise((e=>{this.realFs.exists(i.npath.fromPortablePath(A),e)}))}accessSync(A,e){return this.realFs.accessSync(i.npath.fromPortablePath(A),e)}async accessPromise(A,e){return await new Promise(((t,o)=>{this.realFs.access(i.npath.fromPortablePath(A),e,this.makeCallback(t,o))}))}existsSync(A){return this.realFs.existsSync(i.npath.fromPortablePath(A))}async statPromise(A,e){return await new Promise(((t,o)=>{e?this.realFs.stat(i.npath.fromPortablePath(A),e,this.makeCallback(t,o)):this.realFs.stat(i.npath.fromPortablePath(A),this.makeCallback(t,o))}))}statSync(A,e){return e?this.realFs.statSync(i.npath.fromPortablePath(A),e):this.realFs.statSync(i.npath.fromPortablePath(A))}async fstatPromise(A,e){return await new Promise(((t,o)=>{e?this.realFs.fstat(A,e,this.makeCallback(t,o)):this.realFs.fstat(A,this.makeCallback(t,o))}))}fstatSync(A,e){return e?this.realFs.fstatSync(A,e):this.realFs.fstatSync(A)}async lstatPromise(A,e){return await new Promise(((t,o)=>{e?this.realFs.lstat(i.npath.fromPortablePath(A),e,this.makeCallback(t,o)):this.realFs.lstat(i.npath.fromPortablePath(A),this.makeCallback(t,o))}))}lstatSync(A,e){return e?this.realFs.lstatSync(i.npath.fromPortablePath(A),e):this.realFs.lstatSync(i.npath.fromPortablePath(A))}async fchmodPromise(A,e){return await new Promise(((t,o)=>{this.realFs.fchmod(A,e,this.makeCallback(t,o))}))}fchmodSync(A,e){return this.realFs.fchmodSync(A,e)}async chmodPromise(A,e){return await new Promise(((t,o)=>{this.realFs.chmod(i.npath.fromPortablePath(A),e,this.makeCallback(t,o))}))}chmodSync(A,e){return this.realFs.chmodSync(i.npath.fromPortablePath(A),e)}async fchownPromise(A,e,t){return await new Promise(((o,r)=>{this.realFs.fchown(A,e,t,this.makeCallback(o,r))}))}fchownSync(A,e,t){return this.realFs.fchownSync(A,e,t)}async chownPromise(A,e,t){return await new Promise(((o,r)=>{this.realFs.chown(i.npath.fromPortablePath(A),e,t,this.makeCallback(o,r))}))}chownSync(A,e,t){return this.realFs.chownSync(i.npath.fromPortablePath(A),e,t)}async renamePromise(A,e){return await new Promise(((t,o)=>{this.realFs.rename(i.npath.fromPortablePath(A),i.npath.fromPortablePath(e),this.makeCallback(t,o))}))}renameSync(A,e){return this.realFs.renameSync(i.npath.fromPortablePath(A),i.npath.fromPortablePath(e))}async copyFilePromise(A,e,t=0){return await new Promise(((o,r)=>{this.realFs.copyFile(i.npath.fromPortablePath(A),i.npath.fromPortablePath(e),t,this.makeCallback(o,r))}))}copyFileSync(A,e,t=0){return this.realFs.copyFileSync(i.npath.fromPortablePath(A),i.npath.fromPortablePath(e),t)}async appendFilePromise(A,e,t){return await new Promise(((o,r)=>{const n="string"==typeof A?i.npath.fromPortablePath(A):A;t?this.realFs.appendFile(n,e,t,this.makeCallback(o,r)):this.realFs.appendFile(n,e,this.makeCallback(o,r))}))}appendFileSync(A,e,t){const o="string"==typeof A?i.npath.fromPortablePath(A):A;t?this.realFs.appendFileSync(o,e,t):this.realFs.appendFileSync(o,e)}async writeFilePromise(A,e,t){return await new Promise(((o,r)=>{const n="string"==typeof A?i.npath.fromPortablePath(A):A;t?this.realFs.writeFile(n,e,t,this.makeCallback(o,r)):this.realFs.writeFile(n,e,this.makeCallback(o,r))}))}writeFileSync(A,e,t){const o="string"==typeof A?i.npath.fromPortablePath(A):A;t?this.realFs.writeFileSync(o,e,t):this.realFs.writeFileSync(o,e)}async unlinkPromise(A){return await new Promise(((e,t)=>{this.realFs.unlink(i.npath.fromPortablePath(A),this.makeCallback(e,t))}))}unlinkSync(A){return this.realFs.unlinkSync(i.npath.fromPortablePath(A))}async utimesPromise(A,e,t){return await new Promise(((o,r)=>{this.realFs.utimes(i.npath.fromPortablePath(A),e,t,this.makeCallback(o,r))}))}utimesSync(A,e,t){this.realFs.utimesSync(i.npath.fromPortablePath(A),e,t)}async lutimesPromiseImpl(A,e,t){const o=this.realFs.lutimes;if(void 0===o)throw(0,n.ENOSYS)("unavailable Node binding",`lutimes '${A}'`);return await new Promise(((r,n)=>{o.call(this.realFs,i.npath.fromPortablePath(A),e,t,this.makeCallback(r,n))}))}lutimesSyncImpl(A,e,t){const o=this.realFs.lutimesSync;if(void 0===o)throw(0,n.ENOSYS)("unavailable Node binding",`lutimes '${A}'`);o.call(this.realFs,i.npath.fromPortablePath(A),e,t)}async mkdirPromise(A,e){return await new Promise(((t,o)=>{this.realFs.mkdir(i.npath.fromPortablePath(A),e,this.makeCallback(t,o))}))}mkdirSync(A,e){return this.realFs.mkdirSync(i.npath.fromPortablePath(A),e)}async rmdirPromise(A,e){return await new Promise(((t,o)=>{e?this.realFs.rmdir(i.npath.fromPortablePath(A),e,this.makeCallback(t,o)):this.realFs.rmdir(i.npath.fromPortablePath(A),this.makeCallback(t,o))}))}rmdirSync(A,e){return this.realFs.rmdirSync(i.npath.fromPortablePath(A),e)}async linkPromise(A,e){return await new Promise(((t,o)=>{this.realFs.link(i.npath.fromPortablePath(A),i.npath.fromPortablePath(e),this.makeCallback(t,o))}))}linkSync(A,e){return this.realFs.linkSync(i.npath.fromPortablePath(A),i.npath.fromPortablePath(e))}async symlinkPromise(A,e,t){return await new Promise(((o,r)=>{this.realFs.symlink(i.npath.fromPortablePath(A.replace(/\/+$/,"")),i.npath.fromPortablePath(e),t,this.makeCallback(o,r))}))}symlinkSync(A,e,t){return this.realFs.symlinkSync(i.npath.fromPortablePath(A.replace(/\/+$/,"")),i.npath.fromPortablePath(e),t)}async readFilePromise(A,e){return await new Promise(((t,o)=>{const r="string"==typeof A?i.npath.fromPortablePath(A):A;this.realFs.readFile(r,e,this.makeCallback(t,o))}))}readFileSync(A,e){const t="string"==typeof A?i.npath.fromPortablePath(A):A;return this.realFs.readFileSync(t,e)}async readdirPromise(A,e){return await new Promise(((t,o)=>{(null==e?void 0:e.withFileTypes)?this.realFs.readdir(i.npath.fromPortablePath(A),{withFileTypes:!0},this.makeCallback(t,o)):this.realFs.readdir(i.npath.fromPortablePath(A),this.makeCallback((A=>t(A)),o))}))}readdirSync(A,e){return(null==e?void 0:e.withFileTypes)?this.realFs.readdirSync(i.npath.fromPortablePath(A),{withFileTypes:!0}):this.realFs.readdirSync(i.npath.fromPortablePath(A))}async readlinkPromise(A){return await new Promise(((e,t)=>{this.realFs.readlink(i.npath.fromPortablePath(A),this.makeCallback(e,t))})).then((A=>i.npath.toPortablePath(A)))}readlinkSync(A){return i.npath.toPortablePath(this.realFs.readlinkSync(i.npath.fromPortablePath(A)))}async truncatePromise(A,e){return await new Promise(((t,o)=>{this.realFs.truncate(i.npath.fromPortablePath(A),e,this.makeCallback(t,o))}))}truncateSync(A,e){return this.realFs.truncateSync(i.npath.fromPortablePath(A),e)}async ftruncatePromise(A,e){return await new Promise(((t,o)=>{this.realFs.ftruncate(A,e,this.makeCallback(t,o))}))}ftruncateSync(A,e){return this.realFs.ftruncateSync(A,e)}watch(A,e,t){return this.realFs.watch(i.npath.fromPortablePath(A),e,t)}watchFile(A,e,t){return this.realFs.watchFile(i.npath.fromPortablePath(A),e,t)}unwatchFile(A,e){return this.realFs.unwatchFile(i.npath.fromPortablePath(A),e)}makeCallback(A,e){return(t,o)=>{t?e(t):A(o)}}}e.NodeFS=g},8970:(A,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.NodePathFS=void 0;const o=t(7016),r=t(9023),n=t(5086),i=t(8169);class g extends n.ProxiedFS{constructor(A){super(i.npath),this.baseFs=A}mapFromBase(A){return A}mapToBase(A){if("string"==typeof A)return A;if(A instanceof o.URL)return(0,o.fileURLToPath)(A);if(Buffer.isBuffer(A)){const e=A.toString();if(Buffer.byteLength(e)!==A.byteLength)throw new Error("Non-utf8 buffers are not supported at the moment. Please upvote the following issue if you encounter this error: https://github.com/yarnpkg/berry/issues/4942");return e}throw new Error(`Unsupported path type: ${(0,r.inspect)(A)}`)}}e.NodePathFS=g},1400:(A,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.PosixFS=void 0;const o=t(5086),r=t(8169);class n extends o.ProxiedFS{constructor(A){super(r.npath),this.baseFs=A}mapFromBase(A){return r.npath.fromPortablePath(A)}mapToBase(A){return r.npath.toPortablePath(A)}}e.PosixFS=n},5086:(A,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ProxiedFS=void 0;const o=t(9860);class r extends o.FakeFS{getExtractHint(A){return this.baseFs.getExtractHint(A)}resolve(A){return this.mapFromBase(this.baseFs.resolve(this.mapToBase(A)))}getRealPath(){return this.mapFromBase(this.baseFs.getRealPath())}async openPromise(A,e,t){return this.baseFs.openPromise(this.mapToBase(A),e,t)}openSync(A,e,t){return this.baseFs.openSync(this.mapToBase(A),e,t)}async opendirPromise(A,e){return Object.assign(await this.baseFs.opendirPromise(this.mapToBase(A),e),{path:A})}opendirSync(A,e){return Object.assign(this.baseFs.opendirSync(this.mapToBase(A),e),{path:A})}async readPromise(A,e,t,o,r){return await this.baseFs.readPromise(A,e,t,o,r)}readSync(A,e,t,o,r){return this.baseFs.readSync(A,e,t,o,r)}async writePromise(A,e,t,o,r){return"string"==typeof e?await this.baseFs.writePromise(A,e,t):await this.baseFs.writePromise(A,e,t,o,r)}writeSync(A,e,t,o,r){return"string"==typeof e?this.baseFs.writeSync(A,e,t):this.baseFs.writeSync(A,e,t,o,r)}async closePromise(A){return this.baseFs.closePromise(A)}closeSync(A){this.baseFs.closeSync(A)}createReadStream(A,e){return this.baseFs.createReadStream(null!==A?this.mapToBase(A):A,e)}createWriteStream(A,e){return this.baseFs.createWriteStream(null!==A?this.mapToBase(A):A,e)}async realpathPromise(A){return this.mapFromBase(await this.baseFs.realpathPromise(this.mapToBase(A)))}realpathSync(A){return this.mapFromBase(this.baseFs.realpathSync(this.mapToBase(A)))}async existsPromise(A){return this.baseFs.existsPromise(this.mapToBase(A))}existsSync(A){return this.baseFs.existsSync(this.mapToBase(A))}accessSync(A,e){return this.baseFs.accessSync(this.mapToBase(A),e)}async accessPromise(A,e){return this.baseFs.accessPromise(this.mapToBase(A),e)}async statPromise(A,e){return this.baseFs.statPromise(this.mapToBase(A),e)}statSync(A,e){return this.baseFs.statSync(this.mapToBase(A),e)}async fstatPromise(A,e){return this.baseFs.fstatPromise(A,e)}fstatSync(A,e){return this.baseFs.fstatSync(A,e)}lstatPromise(A,e){return this.baseFs.lstatPromise(this.mapToBase(A),e)}lstatSync(A,e){return this.baseFs.lstatSync(this.mapToBase(A),e)}async fchmodPromise(A,e){return this.baseFs.fchmodPromise(A,e)}fchmodSync(A,e){return this.baseFs.fchmodSync(A,e)}async chmodPromise(A,e){return this.baseFs.chmodPromise(this.mapToBase(A),e)}chmodSync(A,e){return this.baseFs.chmodSync(this.mapToBase(A),e)}async fchownPromise(A,e,t){return this.baseFs.fchownPromise(A,e,t)}fchownSync(A,e,t){return this.baseFs.fchownSync(A,e,t)}async chownPromise(A,e,t){return this.baseFs.chownPromise(this.mapToBase(A),e,t)}chownSync(A,e,t){return this.baseFs.chownSync(this.mapToBase(A),e,t)}async renamePromise(A,e){return this.baseFs.renamePromise(this.mapToBase(A),this.mapToBase(e))}renameSync(A,e){return this.baseFs.renameSync(this.mapToBase(A),this.mapToBase(e))}async copyFilePromise(A,e,t=0){return this.baseFs.copyFilePromise(this.mapToBase(A),this.mapToBase(e),t)}copyFileSync(A,e,t=0){return this.baseFs.copyFileSync(this.mapToBase(A),this.mapToBase(e),t)}async appendFilePromise(A,e,t){return this.baseFs.appendFilePromise(this.fsMapToBase(A),e,t)}appendFileSync(A,e,t){return this.baseFs.appendFileSync(this.fsMapToBase(A),e,t)}async writeFilePromise(A,e,t){return this.baseFs.writeFilePromise(this.fsMapToBase(A),e,t)}writeFileSync(A,e,t){return this.baseFs.writeFileSync(this.fsMapToBase(A),e,t)}async unlinkPromise(A){return this.baseFs.unlinkPromise(this.mapToBase(A))}unlinkSync(A){return this.baseFs.unlinkSync(this.mapToBase(A))}async utimesPromise(A,e,t){return this.baseFs.utimesPromise(this.mapToBase(A),e,t)}utimesSync(A,e,t){return this.baseFs.utimesSync(this.mapToBase(A),e,t)}async mkdirPromise(A,e){return this.baseFs.mkdirPromise(this.mapToBase(A),e)}mkdirSync(A,e){return this.baseFs.mkdirSync(this.mapToBase(A),e)}async rmdirPromise(A,e){return this.baseFs.rmdirPromise(this.mapToBase(A),e)}rmdirSync(A,e){return this.baseFs.rmdirSync(this.mapToBase(A),e)}async linkPromise(A,e){return this.baseFs.linkPromise(this.mapToBase(A),this.mapToBase(e))}linkSync(A,e){return this.baseFs.linkSync(this.mapToBase(A),this.mapToBase(e))}async symlinkPromise(A,e,t){const o=this.mapToBase(e);if(this.pathUtils.isAbsolute(A))return this.baseFs.symlinkPromise(this.mapToBase(A),o,t);const r=this.mapToBase(this.pathUtils.join(this.pathUtils.dirname(e),A)),n=this.baseFs.pathUtils.relative(this.baseFs.pathUtils.dirname(o),r);return this.baseFs.symlinkPromise(n,o,t)}symlinkSync(A,e,t){const o=this.mapToBase(e);if(this.pathUtils.isAbsolute(A))return this.baseFs.symlinkSync(this.mapToBase(A),o,t);const r=this.mapToBase(this.pathUtils.join(this.pathUtils.dirname(e),A)),n=this.baseFs.pathUtils.relative(this.baseFs.pathUtils.dirname(o),r);return this.baseFs.symlinkSync(n,o,t)}async readFilePromise(A,e){return this.baseFs.readFilePromise(this.fsMapToBase(A),e)}readFileSync(A,e){return this.baseFs.readFileSync(this.fsMapToBase(A),e)}async readdirPromise(A,e){return this.baseFs.readdirPromise(this.mapToBase(A),e)}readdirSync(A,e){return this.baseFs.readdirSync(this.mapToBase(A),e)}async readlinkPromise(A){return this.mapFromBase(await this.baseFs.readlinkPromise(this.mapToBase(A)))}readlinkSync(A){return this.mapFromBase(this.baseFs.readlinkSync(this.mapToBase(A)))}async truncatePromise(A,e){return this.baseFs.truncatePromise(this.mapToBase(A),e)}truncateSync(A,e){return this.baseFs.truncateSync(this.mapToBase(A),e)}async ftruncatePromise(A,e){return this.baseFs.ftruncatePromise(A,e)}ftruncateSync(A,e){return this.baseFs.ftruncateSync(A,e)}watch(A,e,t){return this.baseFs.watch(this.mapToBase(A),e,t)}watchFile(A,e,t){return this.baseFs.watchFile(this.mapToBase(A),e,t)}unwatchFile(A,e){return this.baseFs.unwatchFile(this.mapToBase(A),e)}fsMapToBase(A){return"number"==typeof A?A:this.mapToBase(A)}}e.ProxiedFS=r},6868:(A,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.VirtualFS=void 0;const o=t(6825),r=t(5086),n=t(8169),i=/^[0-9]+$/,g=/^(\/(?:[^/]+\/)*?(?:\$\$virtual|__virtual__))((?:\/((?:[^/]+-)?[a-f0-9]+)(?:\/([^/]+))?)?((?:\/.*)?))$/,s=/^([^/]+-)?[a-f0-9]+$/;class C extends r.ProxiedFS{static makeVirtualPath(A,e,t){if("__virtual__"!==n.ppath.basename(A))throw new Error('Assertion failed: Virtual folders must be named "__virtual__"');if(!n.ppath.basename(e).match(s))throw new Error("Assertion failed: Virtual components must be ended by an hexadecimal hash");const o=n.ppath.relative(n.ppath.dirname(A),t).split("/");let r=0;for(;r<o.length&&".."===o[r];)r+=1;const i=o.slice(r);return n.ppath.join(A,e,String(r),...i)}static resolveVirtual(A){const e=A.match(g);if(!e||!e[3]&&e[5])return A;const t=n.ppath.dirname(e[1]);if(!e[3]||!e[4])return t;if(!i.test(e[4]))return A;const o=Number(e[4]),r="../".repeat(o),s=e[5]||".";return C.resolveVirtual(n.ppath.join(t,r,s))}constructor({baseFs:A=new o.NodeFS}={}){super(n.ppath),this.baseFs=A}getExtractHint(A){return this.baseFs.getExtractHint(A)}getRealPath(){return this.baseFs.getRealPath()}realpathSync(A){const e=A.match(g);if(!e)return this.baseFs.realpathSync(A);if(!e[5])return A;const t=this.baseFs.realpathSync(this.mapToBase(A));return C.makeVirtualPath(e[1],e[3],t)}async realpathPromise(A){const e=A.match(g);if(!e)return await this.baseFs.realpathPromise(A);if(!e[5])return A;const t=await this.baseFs.realpathPromise(this.mapToBase(A));return C.makeVirtualPath(e[1],e[3],t)}mapToBase(A){if(""===A)return A;if(this.pathUtils.isAbsolute(A))return C.resolveVirtual(A);const e=C.resolveVirtual(this.baseFs.resolve(n.PortablePath.dot)),t=C.resolveVirtual(this.baseFs.resolve(A));return n.ppath.relative(e,t)||n.PortablePath.dot}mapFromBase(A){return A}}e.VirtualFS=C},6220:(A,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ZipFS=e.makeEmptyArchive=e.DEFAULT_COMPRESSION_LEVEL=void 0;const o=t(1791),r=t(9896),n=t(2203),i=t(9023),g=o.__importDefault(t(3106)),s=t(9860),C=t(6825),a=t(1832),I=t(725),c=t(6469),E=o.__importStar(t(4241)),l=t(8169),Q=o.__importStar(t(9695));function B(){return Buffer.from([80,75,5,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0])}e.DEFAULT_COMPRESSION_LEVEL="mixed",e.makeEmptyArchive=B;class u extends s.BasePortableFakeFS{constructor(A,t){super(),this.lzSource=null,this.listings=new Map,this.entries=new Map,this.fileSources=new Map,this.fds=new Map,this.nextFd=0,this.ready=!1,this.readOnly=!1,this.libzip=t.libzip;const o=t;if(this.level=void 0!==o.level?o.level:e.DEFAULT_COMPRESSION_LEVEL,null!=A||(A=B()),"string"==typeof A){const{baseFs:e=new C.NodeFS}=o;this.baseFs=e,this.path=A}else this.path=null,this.baseFs=null;if(t.stats)this.stats=t.stats;else if("string"==typeof A)try{this.stats=this.baseFs.statSync(A)}catch(A){if("ENOENT"!==A.code||!o.create)throw A;this.stats=Q.makeDefaultStats()}else this.stats=Q.makeDefaultStats();const r=this.libzip.malloc(4);try{let e=0;if("string"==typeof A&&o.create&&(e|=this.libzip.ZIP_CREATE|this.libzip.ZIP_TRUNCATE),t.readOnly&&(e|=this.libzip.ZIP_RDONLY,this.readOnly=!0),"string"==typeof A)this.zip=this.libzip.open(l.npath.fromPortablePath(A),e,r);else{const t=this.allocateUnattachedSource(A);try{this.zip=this.libzip.openFromSource(t,e,r),this.lzSource=t}catch(A){throw this.libzip.source.free(t),A}}if(0===this.zip){const A=this.libzip.struct.errorS();throw this.libzip.error.initWithCode(A,this.libzip.getValue(r,"i32")),this.makeLibzipError(A)}}finally{this.libzip.free(r)}this.listings.set(l.PortablePath.root,new Set);const n=this.libzip.getNumEntries(this.zip,0);for(let A=0;A<n;++A){const e=this.libzip.getName(this.zip,A,0);if(l.ppath.isAbsolute(e))continue;const t=l.ppath.resolve(l.PortablePath.root,e);this.registerEntry(t,A),e.endsWith("/")&&this.registerListing(t)}if(this.symlinkCount=this.libzip.ext.countSymlinks(this.zip),-1===this.symlinkCount)throw this.makeLibzipError(this.libzip.getError(this.zip));this.ready=!0}makeLibzipError(A){const e=this.libzip.struct.errorCodeZip(A),t=this.libzip.error.strerror(A),o=new E.LibzipError(t,this.libzip.errors[e]);if(e===this.libzip.errors.ZIP_ER_CHANGED)throw new Error(`Assertion failed: Unexpected libzip error: ${o.message}`);return o}getExtractHint(A){for(const e of this.entries.keys()){const t=this.pathUtils.extname(e);if(A.relevantExtensions.has(t))return!0}return!1}getAllFiles(){return Array.from(this.entries.keys())}getRealPath(){if(!this.path)throw new Error("ZipFS don't have real paths when loaded from a buffer");return this.path}getBufferAndClose(){if(this.prepareClose(),!this.lzSource)throw new Error("ZipFS was not created from a Buffer");if(0===this.entries.size)return this.discardAndClose(),B();try{if(this.libzip.source.keep(this.lzSource),-1===this.libzip.close(this.zip))throw this.makeLibzipError(this.libzip.getError(this.zip));if(-1===this.libzip.source.open(this.lzSource))throw this.makeLibzipError(this.libzip.source.error(this.lzSource));if(-1===this.libzip.source.seek(this.lzSource,0,0,this.libzip.SEEK_END))throw this.makeLibzipError(this.libzip.source.error(this.lzSource));const A=this.libzip.source.tell(this.lzSource);if(-1===A)throw this.makeLibzipError(this.libzip.source.error(this.lzSource));if(-1===this.libzip.source.seek(this.lzSource,0,0,this.libzip.SEEK_SET))throw this.makeLibzipError(this.libzip.source.error(this.lzSource));const e=this.libzip.malloc(A);if(!e)throw new Error("Couldn't allocate enough memory");try{const t=this.libzip.source.read(this.lzSource,e,A);if(-1===t)throw this.makeLibzipError(this.libzip.source.error(this.lzSource));if(t<A)throw new Error("Incomplete read");if(t>A)throw new Error("Overread");const o=this.libzip.HEAPU8.subarray(e,e+A);return Buffer.from(o)}finally{this.libzip.free(e)}}finally{this.libzip.source.close(this.lzSource),this.libzip.source.free(this.lzSource),this.ready=!1}}prepareClose(){if(!this.ready)throw E.EBUSY("archive closed, close");(0,I.unwatchAllFiles)(this)}saveAndClose(){if(!this.path||!this.baseFs)throw new Error("ZipFS cannot be saved and must be discarded when loaded from a buffer");if(this.prepareClose(),this.readOnly)return void this.discardAndClose();const A=this.baseFs.existsSync(this.path)||this.stats.mode===Q.DEFAULT_MODE?void 0:this.stats.mode;if(0===this.entries.size)this.discardAndClose(),this.baseFs.writeFileSync(this.path,B(),{mode:A});else{if(-1===this.libzip.close(this.zip))throw this.makeLibzipError(this.libzip.getError(this.zip));void 0!==A&&this.baseFs.chmodSync(this.path,A)}this.ready=!1}discardAndClose(){this.prepareClose(),this.libzip.discard(this.zip),this.ready=!1}resolve(A){return l.ppath.resolve(l.PortablePath.root,A)}async openPromise(A,e,t){return this.openSync(A,e,t)}openSync(A,e,t){const o=this.nextFd++;return this.fds.set(o,{cursor:0,p:A}),o}hasOpenFileHandles(){return!!this.fds.size}async opendirPromise(A,e){return this.opendirSync(A,e)}opendirSync(A,e={}){const t=this.resolveFilename(`opendir '${A}'`,A);if(!this.entries.has(t)&&!this.listings.has(t))throw E.ENOENT(`opendir '${A}'`);const o=this.listings.get(t);if(!o)throw E.ENOTDIR(`opendir '${A}'`);const r=[...o],n=this.openSync(t,"r");return(0,a.opendir)(this,t,r,{onClose:()=>{this.closeSync(n)}})}async readPromise(A,e,t,o,r){return this.readSync(A,e,t,o,r)}readSync(A,e,t=0,o=e.byteLength,r=-1){const n=this.fds.get(A);if(void 0===n)throw E.EBADF("read");const i=-1===r||null===r?n.cursor:r,g=this.readFileSync(n.p);g.copy(e,t,i,i+o);const s=Math.max(0,Math.min(g.length-i,o));return-1!==r&&null!==r||(n.cursor+=s),s}async writePromise(A,e,t,o,r){return"string"==typeof e?this.writeSync(A,e,r):this.writeSync(A,e,t,o,r)}writeSync(A,e,t,o,r){if(void 0===this.fds.get(A))throw E.EBADF("read");throw new Error("Unimplemented")}async closePromise(A){return this.closeSync(A)}closeSync(A){if(void 0===this.fds.get(A))throw E.EBADF("read");this.fds.delete(A)}createReadStream(A,{encoding:e}={}){if(null===A)throw new Error("Unimplemented");const t=this.openSync(A,"r"),o=Object.assign(new n.PassThrough({emitClose:!0,autoDestroy:!0,destroy:(A,e)=>{clearImmediate(r),this.closeSync(t),e(A)}}),{close(){o.destroy()},bytesRead:0,path:A,pending:!1}),r=setImmediate((async()=>{try{const t=await this.readFilePromise(A,e);o.bytesRead=t.length,o.end(t)}catch(A){o.destroy(A)}}));return o}createWriteStream(A,{encoding:e}={}){if(this.readOnly)throw E.EROFS(`open '${A}'`);if(null===A)throw new Error("Unimplemented");const t=[],o=this.openSync(A,"w"),r=Object.assign(new n.PassThrough({autoDestroy:!0,emitClose:!0,destroy:(r,n)=>{try{r?n(r):(this.writeFileSync(A,Buffer.concat(t),e),n(null))}catch(A){n(A)}finally{this.closeSync(o)}}}),{close(){r.destroy()},bytesWritten:0,path:A,pending:!1});return r.on("data",(A=>{const e=Buffer.from(A);r.bytesWritten+=e.length,t.push(e)})),r}async realpathPromise(A){return this.realpathSync(A)}realpathSync(A){const e=this.resolveFilename(`lstat '${A}'`,A);if(!this.entries.has(e)&&!this.listings.has(e))throw E.ENOENT(`lstat '${A}'`);return e}async existsPromise(A){return this.existsSync(A)}existsSync(A){if(!this.ready)throw E.EBUSY(`archive closed, existsSync '${A}'`);if(0===this.symlinkCount){const e=l.ppath.resolve(l.PortablePath.root,A);return this.entries.has(e)||this.listings.has(e)}let e;try{e=this.resolveFilename(`stat '${A}'`,A,void 0,!1)}catch(A){return!1}return void 0!==e&&(this.entries.has(e)||this.listings.has(e))}async accessPromise(A,e){return this.accessSync(A,e)}accessSync(A,e=r.constants.F_OK){const t=this.resolveFilename(`access '${A}'`,A);if(!this.entries.has(t)&&!this.listings.has(t))throw E.ENOENT(`access '${A}'`);if(this.readOnly&&e&r.constants.W_OK)throw E.EROFS(`access '${A}'`)}async statPromise(A,e={bigint:!1}){return e.bigint?this.statSync(A,{bigint:!0}):this.statSync(A)}statSync(A,e={bigint:!1,throwIfNoEntry:!0}){const t=this.resolveFilename(`stat '${A}'`,A,void 0,e.throwIfNoEntry);if(void 0!==t){if(!this.entries.has(t)&&!this.listings.has(t)){if(!1===e.throwIfNoEntry)return;throw E.ENOENT(`stat '${A}'`)}if("/"===A[A.length-1]&&!this.listings.has(t))throw E.ENOTDIR(`stat '${A}'`);return this.statImpl(`stat '${A}'`,t,e)}}async fstatPromise(A,e){return this.fstatSync(A,e)}fstatSync(A,e){const t=this.fds.get(A);if(void 0===t)throw E.EBADF("fstatSync");const{p:o}=t,r=this.resolveFilename(`stat '${o}'`,o);if(!this.entries.has(r)&&!this.listings.has(r))throw E.ENOENT(`stat '${o}'`);if("/"===o[o.length-1]&&!this.listings.has(r))throw E.ENOTDIR(`stat '${o}'`);return this.statImpl(`fstat '${o}'`,r,e)}async lstatPromise(A,e={bigint:!1}){return e.bigint?this.lstatSync(A,{bigint:!0}):this.lstatSync(A)}lstatSync(A,e={bigint:!1,throwIfNoEntry:!0}){const t=this.resolveFilename(`lstat '${A}'`,A,!1,e.throwIfNoEntry);if(void 0!==t){if(!this.entries.has(t)&&!this.listings.has(t)){if(!1===e.throwIfNoEntry)return;throw E.ENOENT(`lstat '${A}'`)}if("/"===A[A.length-1]&&!this.listings.has(t))throw E.ENOTDIR(`lstat '${A}'`);return this.statImpl(`lstat '${A}'`,t,e)}}statImpl(A,e,t={}){const o=this.entries.get(e);if(void 0!==o){const A=this.libzip.struct.statS();if(-1===this.libzip.statIndex(this.zip,o,0,0,A))throw this.makeLibzipError(this.libzip.getError(this.zip));const r=this.stats.uid,n=this.stats.gid,i=this.libzip.struct.statSize(A)>>>0,g=512,s=Math.ceil(i/g),C=1e3*(this.libzip.struct.statMtime(A)>>>0),a=C,I=C,E=C,l=new Date(a),B=new Date(I),u=new Date(E),h=new Date(C),d=this.listings.has(e)?c.S_IFDIR:this.isSymbolicLink(o)?c.S_IFLNK:c.S_IFREG,f=d===c.S_IFDIR?493:420,p=d|511&this.getUnixMode(o,f),w=this.libzip.struct.statCrc(A),m=Object.assign(new Q.StatEntry,{uid:r,gid:n,size:i,blksize:g,blocks:s,atime:l,birthtime:B,ctime:u,mtime:h,atimeMs:a,birthtimeMs:I,ctimeMs:E,mtimeMs:C,mode:p,crc:w});return!0===t.bigint?Q.convertToBigIntStats(m):m}if(this.listings.has(e)){const A=this.stats.uid,e=this.stats.gid,o=0,r=512,n=0,i=this.stats.mtimeMs,g=this.stats.mtimeMs,s=this.stats.mtimeMs,C=this.stats.mtimeMs,a=new Date(i),I=new Date(g),E=new Date(s),l=new Date(C),B=493|c.S_IFDIR,u=0,h=Object.assign(new Q.StatEntry,{uid:A,gid:e,size:o,blksize:r,blocks:n,atime:a,birthtime:I,ctime:E,mtime:l,atimeMs:i,birthtimeMs:g,ctimeMs:s,mtimeMs:C,mode:B,crc:u});return!0===t.bigint?Q.convertToBigIntStats(h):h}throw new Error("Unreachable")}getUnixMode(A,e){if(-1===this.libzip.file.getExternalAttributes(this.zip,A,0,0,this.libzip.uint08S,this.libzip.uint32S))throw this.makeLibzipError(this.libzip.getError(this.zip));return this.libzip.getValue(this.libzip.uint08S,"i8")>>>0!==this.libzip.ZIP_OPSYS_UNIX?e:this.libzip.getValue(this.libzip.uint32S,"i32")>>>16}registerListing(A){const e=this.listings.get(A);if(e)return e;this.registerListing(l.ppath.dirname(A)).add(l.ppath.basename(A));const t=new Set;return this.listings.set(A,t),t}registerEntry(A,e){this.registerListing(l.ppath.dirname(A)).add(l.ppath.basename(A)),this.entries.set(A,e)}unregisterListing(A){this.listings.delete(A);const e=this.listings.get(l.ppath.dirname(A));null==e||e.delete(l.ppath.basename(A))}unregisterEntry(A){this.unregisterListing(A);const e=this.entries.get(A);this.entries.delete(A),void 0!==e&&(this.fileSources.delete(e),this.isSymbolicLink(e)&&this.symlinkCount--)}deleteEntry(A,e){if(this.unregisterEntry(A),-1===this.libzip.delete(this.zip,e))throw this.makeLibzipError(this.libzip.getError(this.zip))}resolveFilename(A,e,t=!0,o=!0){if(!this.ready)throw E.EBUSY(`archive closed, ${A}`);let r=l.ppath.resolve(l.PortablePath.root,e);if("/"===r)return l.PortablePath.root;const n=this.entries.get(r);if(t&&void 0!==n){if(0!==this.symlinkCount&&this.isSymbolicLink(n)){const e=this.getFileSource(n).toString();return this.resolveFilename(A,l.ppath.resolve(l.ppath.dirname(r),e),!0,o)}return r}for(;;){const e=this.resolveFilename(A,l.ppath.dirname(r),!0,o);if(void 0===e)return e;const n=this.listings.has(e),i=this.entries.has(e);if(!n&&!i){if(!1===o)return;throw E.ENOENT(A)}if(!n)throw E.ENOTDIR(A);if(r=l.ppath.resolve(e,l.ppath.basename(r)),!t||0===this.symlinkCount)break;const g=this.libzip.name.locate(this.zip,r.slice(1),0);if(-1===g)break;if(!this.isSymbolicLink(g))break;{const A=this.getFileSource(g).toString();r=l.ppath.resolve(l.ppath.dirname(r),A)}}return r}allocateBuffer(A){Buffer.isBuffer(A)||(A=Buffer.from(A));const e=this.libzip.malloc(A.byteLength);if(!e)throw new Error("Couldn't allocate enough memory");return new Uint8Array(this.libzip.HEAPU8.buffer,e,A.byteLength).set(A),{buffer:e,byteLength:A.byteLength}}allocateUnattachedSource(A){const e=this.libzip.struct.errorS(),{buffer:t,byteLength:o}=this.allocateBuffer(A),r=this.libzip.source.fromUnattachedBuffer(t,o,0,1,e);if(0===r)throw this.libzip.free(e),this.makeLibzipError(e);return r}allocateSource(A){const{buffer:e,byteLength:t}=this.allocateBuffer(A),o=this.libzip.source.fromBuffer(this.zip,e,t,0,1);if(0===o)throw this.libzip.free(e),this.makeLibzipError(this.libzip.getError(this.zip));return o}setFileSource(A,e){const t=Buffer.isBuffer(e)?e:Buffer.from(e),o=l.ppath.relative(l.PortablePath.root,A),r=this.allocateSource(e);try{const A=this.libzip.file.add(this.zip,o,r,this.libzip.ZIP_FL_OVERWRITE);if(-1===A)throw this.makeLibzipError(this.libzip.getError(this.zip));if("mixed"!==this.level){const e=0===this.level?this.libzip.ZIP_CM_STORE:this.libzip.ZIP_CM_DEFLATE;if(-1===this.libzip.file.setCompression(this.zip,A,0,e,this.level))throw this.makeLibzipError(this.libzip.getError(this.zip))}return this.fileSources.set(A,t),A}catch(A){throw this.libzip.source.free(r),A}}isSymbolicLink(A){if(0===this.symlinkCount)return!1;if(-1===this.libzip.file.getExternalAttributes(this.zip,A,0,0,this.libzip.uint08S,this.libzip.uint32S))throw this.makeLibzipError(this.libzip.getError(this.zip));return this.libzip.getValue(this.libzip.uint08S,"i8")>>>0===this.libzip.ZIP_OPSYS_UNIX&&(this.libzip.getValue(this.libzip.uint32S,"i32")>>>16&c.S_IFMT)===c.S_IFLNK}getFileSource(A,e={asyncDecompress:!1}){const t=this.fileSources.get(A);if(void 0!==t)return t;const o=this.libzip.struct.statS();if(-1===this.libzip.statIndex(this.zip,A,0,0,o))throw this.makeLibzipError(this.libzip.getError(this.zip));const r=this.libzip.struct.statCompSize(o),n=this.libzip.struct.statCompMethod(o),i=this.libzip.malloc(r);try{const t=this.libzip.fopenIndex(this.zip,A,0,this.libzip.ZIP_FL_COMPRESSED);if(0===t)throw this.makeLibzipError(this.libzip.getError(this.zip));try{const o=this.libzip.fread(t,i,r,0);if(-1===o)throw this.makeLibzipError(this.libzip.file.getError(t));if(o<r)throw new Error("Incomplete read");if(o>r)throw new Error("Overread");const s=this.libzip.HEAPU8.subarray(i,i+r),C=Buffer.from(s);if(0===n)return this.fileSources.set(A,C),C;if(e.asyncDecompress)return new Promise(((e,t)=>{g.default.inflateRaw(C,((o,r)=>{o?t(o):(this.fileSources.set(A,r),e(r))}))}));{const e=g.default.inflateRawSync(C);return this.fileSources.set(A,e),e}}finally{this.libzip.fclose(t)}}finally{this.libzip.free(i)}}async fchmodPromise(A,e){return this.chmodPromise(this.fdToPath(A,"fchmod"),e)}fchmodSync(A,e){return this.chmodSync(this.fdToPath(A,"fchmodSync"),e)}async chmodPromise(A,e){return this.chmodSync(A,e)}chmodSync(A,e){if(this.readOnly)throw E.EROFS(`chmod '${A}'`);e&=493;const t=this.resolveFilename(`chmod '${A}'`,A,!1),o=this.entries.get(t);if(void 0===o)throw new Error(`Assertion failed: The entry should have been registered (${t})`);const r=-512&this.getUnixMode(o,0|c.S_IFREG)|e;if(-1===this.libzip.file.setExternalAttributes(this.zip,o,0,0,this.libzip.ZIP_OPSYS_UNIX,r<<16))throw this.makeLibzipError(this.libzip.getError(this.zip))}async fchownPromise(A,e,t){return this.chownPromise(this.fdToPath(A,"fchown"),e,t)}fchownSync(A,e,t){return this.chownSync(this.fdToPath(A,"fchownSync"),e,t)}async chownPromise(A,e,t){return this.chownSync(A,e,t)}chownSync(A,e,t){throw new Error("Unimplemented")}async renamePromise(A,e){return this.renameSync(A,e)}renameSync(A,e){throw new Error("Unimplemented")}async copyFilePromise(A,e,t){const{indexSource:o,indexDest:r,resolvedDestP:n}=this.prepareCopyFile(A,e,t),i=await this.getFileSource(o,{asyncDecompress:!0}),g=this.setFileSource(n,i);g!==r&&this.registerEntry(n,g)}copyFileSync(A,e,t=0){const{indexSource:o,indexDest:r,resolvedDestP:n}=this.prepareCopyFile(A,e,t),i=this.getFileSource(o),g=this.setFileSource(n,i);g!==r&&this.registerEntry(n,g)}prepareCopyFile(A,e,t=0){if(this.readOnly)throw E.EROFS(`copyfile '${A} -> '${e}'`);if(t&r.constants.COPYFILE_FICLONE_FORCE)throw E.ENOSYS("unsupported clone operation",`copyfile '${A}' -> ${e}'`);const o=this.resolveFilename(`copyfile '${A} -> ${e}'`,A),n=this.entries.get(o);if(void 0===n)throw E.EINVAL(`copyfile '${A}' -> '${e}'`);const i=this.resolveFilename(`copyfile '${A}' -> ${e}'`,e),g=this.entries.get(i);if(t&(r.constants.COPYFILE_EXCL|r.constants.COPYFILE_FICLONE_FORCE)&&void 0!==g)throw E.EEXIST(`copyfile '${A}' -> '${e}'`);return{indexSource:n,resolvedDestP:i,indexDest:g}}async appendFilePromise(A,e,t){if(this.readOnly)throw E.EROFS(`open '${A}'`);return void 0===t?t={flag:"a"}:"string"==typeof t?t={flag:"a",encoding:t}:void 0===t.flag&&(t={flag:"a",...t}),this.writeFilePromise(A,e,t)}appendFileSync(A,e,t={}){if(this.readOnly)throw E.EROFS(`open '${A}'`);return void 0===t?t={flag:"a"}:"string"==typeof t?t={flag:"a",encoding:t}:void 0===t.flag&&(t={flag:"a",...t}),this.writeFileSync(A,e,t)}fdToPath(A,e){var t;const o=null===(t=this.fds.get(A))||void 0===t?void 0:t.p;if(void 0===o)throw E.EBADF(e);return o}async writeFilePromise(A,e,t){const{encoding:o,mode:r,index:n,resolvedP:i}=this.prepareWriteFile(A,t);void 0!==n&&"object"==typeof t&&t.flag&&t.flag.includes("a")&&(e=Buffer.concat([await this.getFileSource(n,{asyncDecompress:!0}),Buffer.from(e)])),null!==o&&(e=e.toString(o));const g=this.setFileSource(i,e);g!==n&&this.registerEntry(i,g),null!==r&&await this.chmodPromise(i,r)}writeFileSync(A,e,t){const{encoding:o,mode:r,index:n,resolvedP:i}=this.prepareWriteFile(A,t);void 0!==n&&"object"==typeof t&&t.flag&&t.flag.includes("a")&&(e=Buffer.concat([this.getFileSource(n),Buffer.from(e)])),null!==o&&(e=e.toString(o));const g=this.setFileSource(i,e);g!==n&&this.registerEntry(i,g),null!==r&&this.chmodSync(i,r)}prepareWriteFile(A,e){if("number"==typeof A&&(A=this.fdToPath(A,"read")),this.readOnly)throw E.EROFS(`open '${A}'`);const t=this.resolveFilename(`open '${A}'`,A);if(this.listings.has(t))throw E.EISDIR(`open '${A}'`);let o=null,r=null;return"string"==typeof e?o=e:"object"==typeof e&&({encoding:o=null,mode:r=null}=e),{encoding:o,mode:r,resolvedP:t,index:this.entries.get(t)}}async unlinkPromise(A){return this.unlinkSync(A)}unlinkSync(A){if(this.readOnly)throw E.EROFS(`unlink '${A}'`);const e=this.resolveFilename(`unlink '${A}'`,A);if(this.listings.has(e))throw E.EISDIR(`unlink '${A}'`);const t=this.entries.get(e);if(void 0===t)throw E.EINVAL(`unlink '${A}'`);this.deleteEntry(e,t)}async utimesPromise(A,e,t){return this.utimesSync(A,e,t)}utimesSync(A,e,t){if(this.readOnly)throw E.EROFS(`utimes '${A}'`);const o=this.resolveFilename(`utimes '${A}'`,A);this.utimesImpl(o,t)}async lutimesPromise(A,e,t){return this.lutimesSync(A,e,t)}lutimesSync(A,e,t){if(this.readOnly)throw E.EROFS(`lutimes '${A}'`);const o=this.resolveFilename(`utimes '${A}'`,A,!1);this.utimesImpl(o,t)}utimesImpl(A,e){this.listings.has(A)&&(this.entries.has(A)||this.hydrateDirectory(A));const t=this.entries.get(A);if(void 0===t)throw new Error("Unreachable");if(-1===this.libzip.file.setMtime(this.zip,t,0,function(A){if("string"==typeof A&&String(+A)===A)return+A;if("number"==typeof A&&Number.isFinite(A))return A<0?Date.now()/1e3:A;if(i.types.isDate(A))return A.getTime()/1e3;throw new Error("Invalid time")}(e),0))throw this.makeLibzipError(this.libzip.getError(this.zip))}async mkdirPromise(A,e){return this.mkdirSync(A,e)}mkdirSync(A,{mode:e=493,recursive:t=!1}={}){if(t)return this.mkdirpSync(A,{chmod:e});if(this.readOnly)throw E.EROFS(`mkdir '${A}'`);const o=this.resolveFilename(`mkdir '${A}'`,A);if(this.entries.has(o)||this.listings.has(o))throw E.EEXIST(`mkdir '${A}'`);this.hydrateDirectory(o),this.chmodSync(o,e)}async rmdirPromise(A,e){return this.rmdirSync(A,e)}rmdirSync(A,{recursive:e=!1}={}){if(this.readOnly)throw E.EROFS(`rmdir '${A}'`);if(e)return void this.removeSync(A);const t=this.resolveFilename(`rmdir '${A}'`,A),o=this.listings.get(t);if(!o)throw E.ENOTDIR(`rmdir '${A}'`);if(o.size>0)throw E.ENOTEMPTY(`rmdir '${A}'`);const r=this.entries.get(t);if(void 0===r)throw E.EINVAL(`rmdir '${A}'`);this.deleteEntry(A,r)}hydrateDirectory(A){const e=this.libzip.dir.add(this.zip,l.ppath.relative(l.PortablePath.root,A));if(-1===e)throw this.makeLibzipError(this.libzip.getError(this.zip));return this.registerListing(A),this.registerEntry(A,e),e}async linkPromise(A,e){return this.linkSync(A,e)}linkSync(A,e){throw E.EOPNOTSUPP(`link '${A}' -> '${e}'`)}async symlinkPromise(A,e){return this.symlinkSync(A,e)}symlinkSync(A,e){if(this.readOnly)throw E.EROFS(`symlink '${A}' -> '${e}'`);const t=this.resolveFilename(`symlink '${A}' -> '${e}'`,e);if(this.listings.has(t))throw E.EISDIR(`symlink '${A}' -> '${e}'`);if(this.entries.has(t))throw E.EEXIST(`symlink '${A}' -> '${e}'`);const o=this.setFileSource(t,A);if(this.registerEntry(t,o),-1===this.libzip.file.setExternalAttributes(this.zip,o,0,0,this.libzip.ZIP_OPSYS_UNIX,(511|c.S_IFLNK)<<16))throw this.makeLibzipError(this.