@wallabyjs/cli 1.0.11 → 1.0.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -3,6 +3,6 @@
3
3
  Package for running [Wallaby](https://wallabyjs.com/) in Standalone mode. This enables you to run Wallaby UI with any editor without Wallaby.js extension/plugin.
4
4
 
5
5
  ```
6
- npm install -g @wallabyjs/cli
6
+ pnpm add -g @wallabyjs/cli
7
7
  npx wallaby
8
8
  ```
package/bin/index.js CHANGED
@@ -1,3 +1,5 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- require('..');
3
+ import * as cli from '../dist/index.mjs';
4
+
5
+ void cli;
package/dist/index.mjs ADDED
@@ -0,0 +1,69 @@
1
+ import{createRequire as e}from"node:module";import t,{basename as n,dirname as r,join as i,parse as a,posix as o,resolve as s}from"node:path";import c,{homedir as l,tmpdir as u}from"node:os";import d,{createWriteStream as f,existsSync as p,mkdirSync as m,readFileSync as h,readdirSync as g}from"node:fs";import{fileURLToPath as _}from"node:url";import v,{constants as y,mkdir as b,readdir as x,rename as S,rm as C,stat as w,unlink as T,writeFile as E}from"node:fs/promises";import{Writable as D}from"node:stream";import O,{cwd as k}from"node:process";import A from"node:crypto";import{Agent as j}from"node:https";import M,{exec as N,execFile as P,spawn as ee}from"node:child_process";import{format as F,promisify as I}from"node:util";import{Buffer as te}from"node:buffer";var L=Object.create,ne=Object.defineProperty,re=Object.getOwnPropertyDescriptor,ie=Object.getOwnPropertyNames,ae=Object.getPrototypeOf,oe=Object.prototype.hasOwnProperty,R=(e,t)=>()=>(e&&(t=e(e=0)),t),z=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),se=(e,t)=>{let n={};for(var r in e)ne(n,r,{get:e[r],enumerable:!0});return t||ne(n,Symbol.toStringTag,{value:`Module`}),n},ce=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=ie(t),a=0,o=i.length,s;a<o;a++)s=i[a],!oe.call(e,s)&&s!==n&&ne(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=re(t,s))||r.enumerable});return e},le=(e,t,n)=>(n=e==null?{}:L(ae(e)),ce(t||!e||!e.__esModule?ne(n,`default`,{value:e,enumerable:!0}):n,e)),B=e(import.meta.url),V=z((e=>{e.fromCallback=function(e){return Object.defineProperty(function(...t){if(typeof t[t.length-1]==`function`)e.apply(this,t);else return new Promise((n,r)=>{t.push((e,t)=>e==null?n(t):r(e)),e.apply(this,t)})},`name`,{value:e.name})},e.fromPromise=function(e){return Object.defineProperty(function(...t){let n=t[t.length-1];if(typeof n!=`function`)return e.apply(this,t);t.pop(),e.apply(this,t).then(e=>n(null,e),n)},`name`,{value:e.name})}})),ue=z(((e,t)=>{var n=B(`constants`),r=process.cwd,i=null,a=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return i||=r.call(process),i};try{process.cwd()}catch{}if(typeof process.chdir==`function`){var o=process.chdir;process.chdir=function(e){i=null,o.call(process,e)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,o)}t.exports=s;function s(e){n.hasOwnProperty(`O_SYMLINK`)&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)&&t(e),e.lutimes||r(e),e.chown=s(e.chown),e.fchown=s(e.fchown),e.lchown=s(e.lchown),e.chmod=i(e.chmod),e.fchmod=i(e.fchmod),e.lchmod=i(e.lchmod),e.chownSync=c(e.chownSync),e.fchownSync=c(e.fchownSync),e.lchownSync=c(e.lchownSync),e.chmodSync=o(e.chmodSync),e.fchmodSync=o(e.fchmodSync),e.lchmodSync=o(e.lchmodSync),e.stat=l(e.stat),e.fstat=l(e.fstat),e.lstat=l(e.lstat),e.statSync=u(e.statSync),e.fstatSync=u(e.fstatSync),e.lstatSync=u(e.lstatSync),e.chmod&&!e.lchmod&&(e.lchmod=function(e,t,n){n&&process.nextTick(n)},e.lchmodSync=function(){}),e.chown&&!e.lchown&&(e.lchown=function(e,t,n,r){r&&process.nextTick(r)},e.lchownSync=function(){}),a===`win32`&&(e.rename=typeof e.rename==`function`?(function(t){function n(n,r,i){var a=Date.now(),o=0;t(n,r,function s(c){if(c&&(c.code===`EACCES`||c.code===`EPERM`||c.code===`EBUSY`)&&Date.now()-a<6e4){setTimeout(function(){e.stat(r,function(e,a){e&&e.code===`ENOENT`?t(n,r,s):i(c)})},o),o<100&&(o+=10);return}i&&i(c)})}return Object.setPrototypeOf&&Object.setPrototypeOf(n,t),n})(e.rename):e.rename),e.read=typeof e.read==`function`?(function(t){function n(n,r,i,a,o,s){var c;if(s&&typeof s==`function`){var l=0;c=function(u,d,f){if(u&&u.code===`EAGAIN`&&l<10)return l++,t.call(e,n,r,i,a,o,c);s.apply(this,arguments)}}return t.call(e,n,r,i,a,o,c)}return Object.setPrototypeOf&&Object.setPrototypeOf(n,t),n})(e.read):e.read,e.readSync=typeof e.readSync==`function`?(function(t){return function(n,r,i,a,o){for(var s=0;;)try{return t.call(e,n,r,i,a,o)}catch(e){if(e.code===`EAGAIN`&&s<10){s++;continue}throw e}}})(e.readSync):e.readSync;function t(e){e.lchmod=function(t,r,i){e.open(t,n.O_WRONLY|n.O_SYMLINK,r,function(t,n){if(t){i&&i(t);return}e.fchmod(n,r,function(t){e.close(n,function(e){i&&i(t||e)})})})},e.lchmodSync=function(t,r){var i=e.openSync(t,n.O_WRONLY|n.O_SYMLINK,r),a=!0,o;try{o=e.fchmodSync(i,r),a=!1}finally{if(a)try{e.closeSync(i)}catch{}else e.closeSync(i)}return o}}function r(e){n.hasOwnProperty(`O_SYMLINK`)&&e.futimes?(e.lutimes=function(t,r,i,a){e.open(t,n.O_SYMLINK,function(t,n){if(t){a&&a(t);return}e.futimes(n,r,i,function(t){e.close(n,function(e){a&&a(t||e)})})})},e.lutimesSync=function(t,r,i){var a=e.openSync(t,n.O_SYMLINK),o,s=!0;try{o=e.futimesSync(a,r,i),s=!1}finally{if(s)try{e.closeSync(a)}catch{}else e.closeSync(a)}return o}):e.futimes&&(e.lutimes=function(e,t,n,r){r&&process.nextTick(r)},e.lutimesSync=function(){})}function i(t){return t&&function(n,r,i){return t.call(e,n,r,function(e){d(e)&&(e=null),i&&i.apply(this,arguments)})}}function o(t){return t&&function(n,r){try{return t.call(e,n,r)}catch(e){if(!d(e))throw e}}}function s(t){return t&&function(n,r,i,a){return t.call(e,n,r,i,function(e){d(e)&&(e=null),a&&a.apply(this,arguments)})}}function c(t){return t&&function(n,r,i){try{return t.call(e,n,r,i)}catch(e){if(!d(e))throw e}}}function l(t){return t&&function(n,r,i){typeof r==`function`&&(i=r,r=null);function a(e,t){t&&(t.uid<0&&(t.uid+=4294967296),t.gid<0&&(t.gid+=4294967296)),i&&i.apply(this,arguments)}return r?t.call(e,n,r,a):t.call(e,n,a)}}function u(t){return t&&function(n,r){var i=r?t.call(e,n,r):t.call(e,n);return i&&(i.uid<0&&(i.uid+=4294967296),i.gid<0&&(i.gid+=4294967296)),i}}function d(e){return!e||e.code===`ENOSYS`||(!process.getuid||process.getuid()!==0)&&(e.code===`EINVAL`||e.code===`EPERM`)}}})),de=z(((e,t)=>{var n=B(`stream`).Stream;t.exports=r;function r(e){return{ReadStream:t,WriteStream:r};function t(r,i){if(!(this instanceof t))return new t(r,i);n.call(this);var a=this;this.path=r,this.fd=null,this.readable=!0,this.paused=!1,this.flags=`r`,this.mode=438,this.bufferSize=64*1024,i||={};for(var o=Object.keys(i),s=0,c=o.length;s<c;s++){var l=o[s];this[l]=i[l]}if(this.encoding&&this.setEncoding(this.encoding),this.start!==void 0){if(typeof this.start!=`number`)throw TypeError(`start must be a Number`);if(this.end===void 0)this.end=1/0;else if(typeof this.end!=`number`)throw TypeError(`end must be a Number`);if(this.start>this.end)throw Error(`start must be <= end`);this.pos=this.start}if(this.fd!==null){process.nextTick(function(){a._read()});return}e.open(this.path,this.flags,this.mode,function(e,t){if(e){a.emit(`error`,e),a.readable=!1;return}a.fd=t,a.emit(`open`,t),a._read()})}function r(t,i){if(!(this instanceof r))return new r(t,i);n.call(this),this.path=t,this.fd=null,this.writable=!0,this.flags=`w`,this.encoding=`binary`,this.mode=438,this.bytesWritten=0,i||={};for(var a=Object.keys(i),o=0,s=a.length;o<s;o++){var c=a[o];this[c]=i[c]}if(this.start!==void 0){if(typeof this.start!=`number`)throw TypeError(`start must be a Number`);if(this.start<0)throw Error(`start must be >= zero`);this.pos=this.start}this.busy=!1,this._queue=[],this.fd===null&&(this._open=e.open,this._queue.push([this._open,this.path,this.flags,this.mode,void 0]),this.flush())}}})),fe=z(((e,t)=>{t.exports=r;var n=Object.getPrototypeOf||function(e){return e.__proto__};function r(e){if(typeof e!=`object`||!e)return e;if(e instanceof Object)var t={__proto__:n(e)};else var t=Object.create(null);return Object.getOwnPropertyNames(e).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))}),t}})),pe=z(((e,t)=>{var n=B(`fs`),r=ue(),i=de(),a=fe(),o=B(`util`),s,c;typeof Symbol==`function`&&typeof Symbol.for==`function`?(s=Symbol.for(`graceful-fs.queue`),c=Symbol.for(`graceful-fs.previous`)):(s=`___graceful-fs.queue`,c=`___graceful-fs.previous`);function l(){}function u(e,t){Object.defineProperty(e,s,{get:function(){return t}})}var d=l;o.debuglog?d=o.debuglog(`gfs4`):/\bgfs4\b/i.test(process.env.NODE_DEBUG||``)&&(d=function(){var e=o.format.apply(o,arguments);e=`GFS4: `+e.split(/\n/).join(`
2
+ GFS4: `),console.error(e)}),n[s]||(u(n,global[s]||[]),n.close=(function(e){function t(t,r){return e.call(n,t,function(e){e||h(),typeof r==`function`&&r.apply(this,arguments)})}return Object.defineProperty(t,c,{value:e}),t})(n.close),n.closeSync=(function(e){function t(t){e.apply(n,arguments),h()}return Object.defineProperty(t,c,{value:e}),t})(n.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||``)&&process.on(`exit`,function(){d(n[s]),B(`assert`).equal(n[s].length,0)})),global[s]||u(global,n[s]),t.exports=f(a(n)),process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!n.__patched&&(t.exports=f(n),n.__patched=!0);function f(e){r(e),e.gracefulify=f,e.createReadStream=T,e.createWriteStream=E;var t=e.readFile;e.readFile=n;function n(e,n,r){return typeof n==`function`&&(r=n,n=null),i(e,n,r);function i(e,n,r,a){return t(e,n,function(t){t&&(t.code===`EMFILE`||t.code===`ENFILE`)?p([i,[e,n,r],t,a||Date.now(),Date.now()]):typeof r==`function`&&r.apply(this,arguments)})}}var a=e.writeFile;e.writeFile=o;function o(e,t,n,r){return typeof n==`function`&&(r=n,n=null),i(e,t,n,r);function i(e,t,n,r,o){return a(e,t,n,function(a){a&&(a.code===`EMFILE`||a.code===`ENFILE`)?p([i,[e,t,n,r],a,o||Date.now(),Date.now()]):typeof r==`function`&&r.apply(this,arguments)})}}var s=e.appendFile;s&&(e.appendFile=c);function c(e,t,n,r){return typeof n==`function`&&(r=n,n=null),i(e,t,n,r);function i(e,t,n,r,a){return s(e,t,n,function(o){o&&(o.code===`EMFILE`||o.code===`ENFILE`)?p([i,[e,t,n,r],o,a||Date.now(),Date.now()]):typeof r==`function`&&r.apply(this,arguments)})}}var l=e.copyFile;l&&(e.copyFile=u);function u(e,t,n,r){return typeof n==`function`&&(r=n,n=0),i(e,t,n,r);function i(e,t,n,r,a){return l(e,t,n,function(o){o&&(o.code===`EMFILE`||o.code===`ENFILE`)?p([i,[e,t,n,r],o,a||Date.now(),Date.now()]):typeof r==`function`&&r.apply(this,arguments)})}}var d=e.readdir;e.readdir=h;var m=/^v[0-5]\./;function h(e,t,n){typeof t==`function`&&(n=t,t=null);var r=m.test(process.version)?function(e,t,n,r){return d(e,i(e,t,n,r))}:function(e,t,n,r){return d(e,t,i(e,t,n,r))};return r(e,t,n);function i(e,t,n,i){return function(a,o){a&&(a.code===`EMFILE`||a.code===`ENFILE`)?p([r,[e,t,n],a,i||Date.now(),Date.now()]):(o&&o.sort&&o.sort(),typeof n==`function`&&n.call(this,a,o))}}}if(process.version.substr(0,4)===`v0.8`){var g=i(e);x=g.ReadStream,C=g.WriteStream}var _=e.ReadStream;_&&(x.prototype=Object.create(_.prototype),x.prototype.open=S);var v=e.WriteStream;v&&(C.prototype=Object.create(v.prototype),C.prototype.open=w),Object.defineProperty(e,`ReadStream`,{get:function(){return x},set:function(e){x=e},enumerable:!0,configurable:!0}),Object.defineProperty(e,`WriteStream`,{get:function(){return C},set:function(e){C=e},enumerable:!0,configurable:!0});var y=x;Object.defineProperty(e,`FileReadStream`,{get:function(){return y},set:function(e){y=e},enumerable:!0,configurable:!0});var b=C;Object.defineProperty(e,`FileWriteStream`,{get:function(){return b},set:function(e){b=e},enumerable:!0,configurable:!0});function x(e,t){return this instanceof x?(_.apply(this,arguments),this):x.apply(Object.create(x.prototype),arguments)}function S(){var e=this;O(e.path,e.flags,e.mode,function(t,n){t?(e.autoClose&&e.destroy(),e.emit(`error`,t)):(e.fd=n,e.emit(`open`,n),e.read())})}function C(e,t){return this instanceof C?(v.apply(this,arguments),this):C.apply(Object.create(C.prototype),arguments)}function w(){var e=this;O(e.path,e.flags,e.mode,function(t,n){t?(e.destroy(),e.emit(`error`,t)):(e.fd=n,e.emit(`open`,n))})}function T(t,n){return new e.ReadStream(t,n)}function E(t,n){return new e.WriteStream(t,n)}var D=e.open;e.open=O;function O(e,t,n,r){return typeof n==`function`&&(r=n,n=null),i(e,t,n,r);function i(e,t,n,r,a){return D(e,t,n,function(o,s){o&&(o.code===`EMFILE`||o.code===`ENFILE`)?p([i,[e,t,n,r],o,a||Date.now(),Date.now()]):typeof r==`function`&&r.apply(this,arguments)})}}return e}function p(e){d(`ENQUEUE`,e[0].name,e[1]),n[s].push(e),g()}var m;function h(){for(var e=Date.now(),t=0;t<n[s].length;++t)n[s][t].length>2&&(n[s][t][3]=e,n[s][t][4]=e);g()}function g(){if(clearTimeout(m),m=void 0,n[s].length!==0){var e=n[s].shift(),t=e[0],r=e[1],i=e[2],a=e[3],o=e[4];if(a===void 0)d(`RETRY`,t.name,r),t.apply(null,r);else if(Date.now()-a>=6e4){d(`TIMEOUT`,t.name,r);var c=r.pop();typeof c==`function`&&c.call(null,i)}else{var l=Date.now()-o,u=Math.max(o-a,1);l>=Math.min(u*1.2,100)?(d(`RETRY`,t.name,r),t.apply(null,r.concat([a]))):n[s].push(e)}m===void 0&&(m=setTimeout(g,0))}}})),H=z((e=>{let t=V().fromCallback,n=pe(),r=`access.appendFile.chmod.chown.close.copyFile.cp.fchmod.fchown.fdatasync.fstat.fsync.ftruncate.futimes.glob.lchmod.lchown.lutimes.link.lstat.mkdir.mkdtemp.open.opendir.readdir.readFile.readlink.realpath.rename.rm.rmdir.stat.statfs.symlink.truncate.unlink.utimes.writeFile`.split(`.`).filter(e=>typeof n[e]==`function`);Object.assign(e,n),r.forEach(r=>{e[r]=t(n[r])}),e.exists=function(e,t){return typeof t==`function`?n.exists(e,t):new Promise(t=>n.exists(e,t))},e.read=function(e,t,r,i,a,o){return typeof o==`function`?n.read(e,t,r,i,a,o):new Promise((o,s)=>{n.read(e,t,r,i,a,(e,t,n)=>{if(e)return s(e);o({bytesRead:t,buffer:n})})})},e.write=function(e,t,...r){return typeof r[r.length-1]==`function`?n.write(e,t,...r):new Promise((i,a)=>{n.write(e,t,...r,(e,t,n)=>{if(e)return a(e);i({bytesWritten:t,buffer:n})})})},e.readv=function(e,t,...r){return typeof r[r.length-1]==`function`?n.readv(e,t,...r):new Promise((i,a)=>{n.readv(e,t,...r,(e,t,n)=>{if(e)return a(e);i({bytesRead:t,buffers:n})})})},e.writev=function(e,t,...r){return typeof r[r.length-1]==`function`?n.writev(e,t,...r):new Promise((i,a)=>{n.writev(e,t,...r,(e,t,n)=>{if(e)return a(e);i({bytesWritten:t,buffers:n})})})},typeof n.realpath.native==`function`?e.realpath.native=t(n.realpath.native):process.emitWarning(`fs.realpath.native is not a function. Is fs being monkey-patched?`,`Warning`,`fs-extra-WARN0003`)})),me=z(((e,t)=>{let n=B(`path`);t.exports.checkPath=function(e){if(process.platform===`win32`&&/[<>:"|?*]/.test(e.replace(n.parse(e).root,``))){let t=Error(`Path contains invalid characters: ${e}`);throw t.code=`EINVAL`,t}}})),he=z(((e,t)=>{let n=H(),{checkPath:r}=me(),i=e=>typeof e==`number`?e:{mode:511,...e}.mode;t.exports.makeDir=async(e,t)=>(r(e),n.mkdir(e,{mode:i(t),recursive:!0})),t.exports.makeDirSync=(e,t)=>(r(e),n.mkdirSync(e,{mode:i(t),recursive:!0}))})),U=z(((e,t)=>{let n=V().fromPromise,{makeDir:r,makeDirSync:i}=he(),a=n(r);t.exports={mkdirs:a,mkdirsSync:i,mkdirp:a,mkdirpSync:i,ensureDir:a,ensureDirSync:i}})),ge=z(((e,t)=>{let n=V().fromPromise,r=H();function i(e){return r.access(e).then(()=>!0).catch(()=>!1)}t.exports={pathExists:n(i),pathExistsSync:r.existsSync}})),_e=z(((e,t)=>{let n=H(),r=V().fromPromise;async function i(e,t,r){let i=await n.open(e,`r+`),a=null;try{await n.futimes(i,t,r)}finally{try{await n.close(i)}catch(e){a=e}}if(a)throw a}function a(e,t,r){let i=n.openSync(e,`r+`);return n.futimesSync(i,t,r),n.closeSync(i)}t.exports={utimesMillis:r(i),utimesMillisSync:a}})),ve=z(((e,t)=>{let n=H(),r=B(`path`),i=V().fromPromise;function a(e,t,r){let i=r.dereference?e=>n.stat(e,{bigint:!0}):e=>n.lstat(e,{bigint:!0});return Promise.all([i(e),i(t).catch(e=>{if(e.code===`ENOENT`)return null;throw e})]).then(([e,t])=>({srcStat:e,destStat:t}))}function o(e,t,r){let i,a=r.dereference?e=>n.statSync(e,{bigint:!0}):e=>n.lstatSync(e,{bigint:!0}),o=a(e);try{i=a(t)}catch(e){if(e.code===`ENOENT`)return{srcStat:o,destStat:null};throw e}return{srcStat:o,destStat:i}}async function s(e,t,n,i){let{srcStat:o,destStat:s}=await a(e,t,i);if(s){if(d(o,s)){let i=r.basename(e),a=r.basename(t);if(n===`move`&&i!==a&&i.toLowerCase()===a.toLowerCase())return{srcStat:o,destStat:s,isChangingCase:!0};throw Error(`Source and destination must not be the same.`)}if(o.isDirectory()&&!s.isDirectory())throw Error(`Cannot overwrite non-directory '${t}' with directory '${e}'.`);if(!o.isDirectory()&&s.isDirectory())throw Error(`Cannot overwrite directory '${t}' with non-directory '${e}'.`)}if(o.isDirectory()&&f(e,t))throw Error(p(e,t,n));return{srcStat:o,destStat:s}}function c(e,t,n,i){let{srcStat:a,destStat:s}=o(e,t,i);if(s){if(d(a,s)){let i=r.basename(e),o=r.basename(t);if(n===`move`&&i!==o&&i.toLowerCase()===o.toLowerCase())return{srcStat:a,destStat:s,isChangingCase:!0};throw Error(`Source and destination must not be the same.`)}if(a.isDirectory()&&!s.isDirectory())throw Error(`Cannot overwrite non-directory '${t}' with directory '${e}'.`);if(!a.isDirectory()&&s.isDirectory())throw Error(`Cannot overwrite directory '${t}' with non-directory '${e}'.`)}if(a.isDirectory()&&f(e,t))throw Error(p(e,t,n));return{srcStat:a,destStat:s}}async function l(e,t,i,a){let o=r.resolve(r.dirname(e)),s=r.resolve(r.dirname(i));if(s===o||s===r.parse(s).root)return;let c;try{c=await n.stat(s,{bigint:!0})}catch(e){if(e.code===`ENOENT`)return;throw e}if(d(t,c))throw Error(p(e,i,a));return l(e,t,s,a)}function u(e,t,i,a){let o=r.resolve(r.dirname(e)),s=r.resolve(r.dirname(i));if(s===o||s===r.parse(s).root)return;let c;try{c=n.statSync(s,{bigint:!0})}catch(e){if(e.code===`ENOENT`)return;throw e}if(d(t,c))throw Error(p(e,i,a));return u(e,t,s,a)}function d(e,t){return t.ino!==void 0&&t.dev!==void 0&&t.ino===e.ino&&t.dev===e.dev}function f(e,t){let n=r.resolve(e).split(r.sep).filter(e=>e),i=r.resolve(t).split(r.sep).filter(e=>e);return n.every((e,t)=>i[t]===e)}function p(e,t,n){return`Cannot ${n} '${e}' to a subdirectory of itself, '${t}'.`}t.exports={checkPaths:i(s),checkPathsSync:c,checkParentPaths:i(l),checkParentPathsSync:u,isSrcSubdir:f,areIdentical:d}})),ye=z(((e,t)=>{async function n(e,t){let n=[];for await(let r of e)n.push(t(r).then(()=>null,e=>e??Error(`unknown error`)));await Promise.all(n.map(e=>e.then(e=>{if(e!==null)throw e})))}t.exports={asyncIteratorConcurrentProcess:n}})),be=z(((e,t)=>{let n=H(),r=B(`path`),{mkdirs:i}=U(),{pathExists:a}=ge(),{utimesMillis:o}=_e(),s=ve(),{asyncIteratorConcurrentProcess:c}=ye();async function l(e,t,n={}){typeof n==`function`&&(n={filter:n}),n.clobber=`clobber`in n?!!n.clobber:!0,n.overwrite=`overwrite`in n?!!n.overwrite:n.clobber,n.preserveTimestamps&&process.arch===`ia32`&&process.emitWarning(`Using the preserveTimestamps option in 32-bit node is not recommended;
3
+
4
+ see https://github.com/jprichardson/node-fs-extra/issues/269`,`Warning`,`fs-extra-WARN0001`);let{srcStat:o,destStat:c}=await s.checkPaths(e,t,`copy`,n);if(await s.checkParentPaths(e,o,t,`copy`),!await u(e,t,n))return;let l=r.dirname(t);await a(l)||await i(l),await d(c,e,t,n)}async function u(e,t,n){return n.filter?n.filter(e,t):!0}async function d(e,t,r,i){let a=await(i.dereference?n.stat:n.lstat)(t);if(a.isDirectory())return g(a,e,t,r,i);if(a.isFile()||a.isCharacterDevice()||a.isBlockDevice())return f(a,e,t,r,i);if(a.isSymbolicLink())return _(e,t,r,i);throw a.isSocket()?Error(`Cannot copy a socket file: ${t}`):a.isFIFO()?Error(`Cannot copy a FIFO pipe: ${t}`):Error(`Unknown file: ${t}`)}async function f(e,t,r,i,a){if(!t)return p(e,r,i,a);if(a.overwrite)return await n.unlink(i),p(e,r,i,a);if(a.errorOnExist)throw Error(`'${i}' already exists`)}async function p(e,t,r,i){if(await n.copyFile(t,r),i.preserveTimestamps){m(e.mode)&&await h(r,e.mode);let i=await n.stat(t);await o(r,i.atime,i.mtime)}return n.chmod(r,e.mode)}function m(e){return(e&128)==0}function h(e,t){return n.chmod(e,t|128)}async function g(e,t,i,a,o){t||await n.mkdir(a),await c(await n.opendir(i),async e=>{let t=r.join(i,e.name),n=r.join(a,e.name);if(await u(t,n,o)){let{destStat:e}=await s.checkPaths(t,n,`copy`,o);await d(e,t,n,o)}}),t||await n.chmod(a,e.mode)}async function _(e,t,i,a){let o=await n.readlink(t);if(a.dereference&&(o=r.resolve(process.cwd(),o)),!e)return n.symlink(o,i);let c=null;try{c=await n.readlink(i)}catch(e){if(e.code===`EINVAL`||e.code===`UNKNOWN`)return n.symlink(o,i);throw e}if(a.dereference&&(c=r.resolve(process.cwd(),c)),o!==c){if(s.isSrcSubdir(o,c))throw Error(`Cannot copy '${o}' to a subdirectory of itself, '${c}'.`);if(s.isSrcSubdir(c,o))throw Error(`Cannot overwrite '${c}' with '${o}'.`)}return await n.unlink(i),n.symlink(o,i)}t.exports=l})),xe=z(((e,t)=>{let n=pe(),r=B(`path`),i=U().mkdirsSync,a=_e().utimesMillisSync,o=ve();function s(e,t,a){typeof a==`function`&&(a={filter:a}),a||={},a.clobber=`clobber`in a?!!a.clobber:!0,a.overwrite=`overwrite`in a?!!a.overwrite:a.clobber,a.preserveTimestamps&&process.arch===`ia32`&&process.emitWarning(`Using the preserveTimestamps option in 32-bit node is not recommended;
5
+
6
+ see https://github.com/jprichardson/node-fs-extra/issues/269`,`Warning`,`fs-extra-WARN0002`);let{srcStat:s,destStat:l}=o.checkPathsSync(e,t,`copy`,a);if(o.checkParentPathsSync(e,s,t,`copy`),a.filter&&!a.filter(e,t))return;let u=r.dirname(t);return n.existsSync(u)||i(u),c(l,e,t,a)}function c(e,t,r,i){let a=(i.dereference?n.statSync:n.lstatSync)(t);if(a.isDirectory())return _(a,e,t,r,i);if(a.isFile()||a.isCharacterDevice()||a.isBlockDevice())return l(a,e,t,r,i);if(a.isSymbolicLink())return x(e,t,r,i);throw a.isSocket()?Error(`Cannot copy a socket file: ${t}`):a.isFIFO()?Error(`Cannot copy a FIFO pipe: ${t}`):Error(`Unknown file: ${t}`)}function l(e,t,n,r,i){return t?u(e,n,r,i):d(e,n,r,i)}function u(e,t,r,i){if(i.overwrite)return n.unlinkSync(r),d(e,t,r,i);if(i.errorOnExist)throw Error(`'${r}' already exists`)}function d(e,t,r,i){return n.copyFileSync(t,r),i.preserveTimestamps&&f(e.mode,t,r),h(r,e.mode)}function f(e,t,n){return p(e)&&m(n,e),g(t,n)}function p(e){return(e&128)==0}function m(e,t){return h(e,t|128)}function h(e,t){return n.chmodSync(e,t)}function g(e,t){let r=n.statSync(e);return a(t,r.atime,r.mtime)}function _(e,t,n,r,i){return t?y(n,r,i):v(e.mode,n,r,i)}function v(e,t,r,i){return n.mkdirSync(r),y(t,r,i),h(r,e)}function y(e,t,r){let i=n.opendirSync(e);try{let n;for(;(n=i.readSync())!==null;)b(n.name,e,t,r)}finally{i.closeSync()}}function b(e,t,n,i){let a=r.join(t,e),s=r.join(n,e);if(i.filter&&!i.filter(a,s))return;let{destStat:l}=o.checkPathsSync(a,s,`copy`,i);return c(l,a,s,i)}function x(e,t,i,a){let s=n.readlinkSync(t);if(a.dereference&&(s=r.resolve(process.cwd(),s)),e){let e;try{e=n.readlinkSync(i)}catch(e){if(e.code===`EINVAL`||e.code===`UNKNOWN`)return n.symlinkSync(s,i);throw e}if(a.dereference&&(e=r.resolve(process.cwd(),e)),s!==e){if(o.isSrcSubdir(s,e))throw Error(`Cannot copy '${s}' to a subdirectory of itself, '${e}'.`);if(o.isSrcSubdir(e,s))throw Error(`Cannot overwrite '${e}' with '${s}'.`)}return S(s,i)}else return n.symlinkSync(s,i)}function S(e,t){return n.unlinkSync(t),n.symlinkSync(e,t)}t.exports=s})),Se=z(((e,t)=>{let n=V().fromPromise;t.exports={copy:n(be()),copySync:xe()}})),Ce=z(((e,t)=>{let n=pe(),r=V().fromCallback;function i(e,t){n.rm(e,{recursive:!0,force:!0},t)}function a(e){n.rmSync(e,{recursive:!0,force:!0})}t.exports={remove:r(i),removeSync:a}})),we=z(((e,t)=>{let n=V().fromPromise,r=H(),i=B(`path`),a=U(),o=Ce(),s=n(async function(e){let t;try{t=await r.readdir(e)}catch{return a.mkdirs(e)}return Promise.all(t.map(t=>o.remove(i.join(e,t))))});function c(e){let t;try{t=r.readdirSync(e)}catch{return a.mkdirsSync(e)}t.forEach(t=>{t=i.join(e,t),o.removeSync(t)})}t.exports={emptyDirSync:c,emptydirSync:c,emptyDir:s,emptydir:s}})),Te=z(((e,t)=>{let n=V().fromPromise,r=B(`path`),i=H(),a=U();async function o(e){let t;try{t=await i.stat(e)}catch{}if(t&&t.isFile())return;let n=r.dirname(e),o=null;try{o=await i.stat(n)}catch(t){if(t.code===`ENOENT`){await a.mkdirs(n),await i.writeFile(e,``);return}else throw t}o.isDirectory()?await i.writeFile(e,``):await i.readdir(n)}function s(e){let t;try{t=i.statSync(e)}catch{}if(t&&t.isFile())return;let n=r.dirname(e);try{i.statSync(n).isDirectory()||i.readdirSync(n)}catch(e){if(e&&e.code===`ENOENT`)a.mkdirsSync(n);else throw e}i.writeFileSync(e,``)}t.exports={createFile:n(o),createFileSync:s}})),Ee=z(((e,t)=>{let n=V().fromPromise,r=B(`path`),i=H(),a=U(),{pathExists:o}=ge(),{areIdentical:s}=ve();async function c(e,t){let n;try{n=await i.lstat(t)}catch{}let c;try{c=await i.lstat(e)}catch(e){throw e.message=e.message.replace(`lstat`,`ensureLink`),e}if(n&&s(c,n))return;let l=r.dirname(t);await o(l)||await a.mkdirs(l),await i.link(e,t)}function l(e,t){let n;try{n=i.lstatSync(t)}catch{}try{let t=i.lstatSync(e);if(n&&s(t,n))return}catch(e){throw e.message=e.message.replace(`lstat`,`ensureLink`),e}let o=r.dirname(t);return i.existsSync(o)||a.mkdirsSync(o),i.linkSync(e,t)}t.exports={createLink:n(c),createLinkSync:l}})),De=z(((e,t)=>{let n=B(`path`),r=H(),{pathExists:i}=ge(),a=V().fromPromise;async function o(e,t){if(n.isAbsolute(e)){try{await r.lstat(e)}catch(e){throw e.message=e.message.replace(`lstat`,`ensureSymlink`),e}return{toCwd:e,toDst:e}}let a=n.dirname(t),o=n.join(a,e);if(await i(o))return{toCwd:o,toDst:e};try{await r.lstat(e)}catch(e){throw e.message=e.message.replace(`lstat`,`ensureSymlink`),e}return{toCwd:e,toDst:n.relative(a,e)}}function s(e,t){if(n.isAbsolute(e)){if(!r.existsSync(e))throw Error(`absolute srcpath does not exist`);return{toCwd:e,toDst:e}}let i=n.dirname(t),a=n.join(i,e);if(r.existsSync(a))return{toCwd:a,toDst:e};if(!r.existsSync(e))throw Error(`relative srcpath does not exist`);return{toCwd:e,toDst:n.relative(i,e)}}t.exports={symlinkPaths:a(o),symlinkPathsSync:s}})),Oe=z(((e,t)=>{let n=H(),r=V().fromPromise;async function i(e,t){if(t)return t;let r;try{r=await n.lstat(e)}catch{return`file`}return r&&r.isDirectory()?`dir`:`file`}function a(e,t){if(t)return t;let r;try{r=n.lstatSync(e)}catch{return`file`}return r&&r.isDirectory()?`dir`:`file`}t.exports={symlinkType:r(i),symlinkTypeSync:a}})),ke=z(((e,t)=>{let n=V().fromPromise,r=B(`path`),i=H(),{mkdirs:a,mkdirsSync:o}=U(),{symlinkPaths:s,symlinkPathsSync:c}=De(),{symlinkType:l,symlinkTypeSync:u}=Oe(),{pathExists:d}=ge(),{areIdentical:f}=ve();async function p(e,t,n){let o;try{o=await i.lstat(t)}catch{}if(o&&o.isSymbolicLink()){let n;if(r.isAbsolute(e))n=await i.stat(e);else{let a=r.dirname(t),o=r.join(a,e);try{n=await i.stat(o)}catch{n=await i.stat(e)}}let a=await i.stat(t);if(f(n,a))return}let c=await s(e,t);e=c.toDst;let u=await l(c.toCwd,n),p=r.dirname(t);return await d(p)||await a(p),i.symlink(e,t,u)}function m(e,t,n){let a;try{a=i.lstatSync(t)}catch{}if(a&&a.isSymbolicLink()){let n;if(r.isAbsolute(e))n=i.statSync(e);else{let a=r.dirname(t),o=r.join(a,e);try{n=i.statSync(o)}catch{n=i.statSync(e)}}let a=i.statSync(t);if(f(n,a))return}let s=c(e,t);e=s.toDst,n=u(s.toCwd,n);let l=r.dirname(t);return i.existsSync(l)||o(l),i.symlinkSync(e,t,n)}t.exports={createSymlink:n(p),createSymlinkSync:m}})),Ae=z(((e,t)=>{let{createFile:n,createFileSync:r}=Te(),{createLink:i,createLinkSync:a}=Ee(),{createSymlink:o,createSymlinkSync:s}=ke();t.exports={createFile:n,createFileSync:r,ensureFile:n,ensureFileSync:r,createLink:i,createLinkSync:a,ensureLink:i,ensureLinkSync:a,createSymlink:o,createSymlinkSync:s,ensureSymlink:o,ensureSymlinkSync:s}})),je=z(((e,t)=>{function n(e,{EOL:t=`
7
+ `,finalEOL:n=!0,replacer:r=null,spaces:i}={}){let a=n?t:``,o=JSON.stringify(e,r,i);if(o===void 0)throw TypeError(`Converting ${typeof e} value to JSON is not supported`);return o.replace(/\n/g,t)+a}function r(e){return Buffer.isBuffer(e)&&(e=e.toString(`utf8`)),e.replace(/^\uFEFF/,``)}t.exports={stringify:n,stripBom:r}})),Me=z(((e,t)=>{let n;try{n=pe()}catch{n=B(`fs`)}let r=V(),{stringify:i,stripBom:a}=je();async function o(e,t={}){typeof t==`string`&&(t={encoding:t});let i=t.fs||n,o=`throws`in t?t.throws:!0,s=await r.fromCallback(i.readFile)(e,t);s=a(s);let c;try{c=JSON.parse(s,t?t.reviver:null)}catch(t){if(o)throw t.message=`${e}: ${t.message}`,t;return null}return c}let s=r.fromPromise(o);function c(e,t={}){typeof t==`string`&&(t={encoding:t});let r=t.fs||n,i=`throws`in t?t.throws:!0;try{let n=r.readFileSync(e,t);return n=a(n),JSON.parse(n,t.reviver)}catch(t){if(i)throw t.message=`${e}: ${t.message}`,t;return null}}async function l(e,t,a={}){let o=a.fs||n,s=i(t,a);await r.fromCallback(o.writeFile)(e,s,a)}let u=r.fromPromise(l);function d(e,t,r={}){let a=r.fs||n,o=i(t,r);return a.writeFileSync(e,o,r)}t.exports={readFile:s,readFileSync:c,writeFile:u,writeFileSync:d}})),Ne=z(((e,t)=>{let n=Me();t.exports={readJson:n.readFile,readJsonSync:n.readFileSync,writeJson:n.writeFile,writeJsonSync:n.writeFileSync}})),Pe=z(((e,t)=>{let n=V().fromPromise,r=H(),i=B(`path`),a=U(),o=ge().pathExists;async function s(e,t,n=`utf-8`){let s=i.dirname(e);return await o(s)||await a.mkdirs(s),r.writeFile(e,t,n)}function c(e,...t){let n=i.dirname(e);r.existsSync(n)||a.mkdirsSync(n),r.writeFileSync(e,...t)}t.exports={outputFile:n(s),outputFileSync:c}})),Fe=z(((e,t)=>{let{stringify:n}=je(),{outputFile:r}=Pe();async function i(e,t,i={}){await r(e,n(t,i),i)}t.exports=i})),Ie=z(((e,t)=>{let{stringify:n}=je(),{outputFileSync:r}=Pe();function i(e,t,i){r(e,n(t,i),i)}t.exports=i})),Le=z(((e,t)=>{let n=V().fromPromise,r=Ne();r.outputJson=n(Fe()),r.outputJsonSync=Ie(),r.outputJSON=r.outputJson,r.outputJSONSync=r.outputJsonSync,r.writeJSON=r.writeJson,r.writeJSONSync=r.writeJsonSync,r.readJSON=r.readJson,r.readJSONSync=r.readJsonSync,t.exports=r})),Re=z(((e,t)=>{let n=H(),r=B(`path`),{copy:i}=Se(),{remove:a}=Ce(),{mkdirp:o}=U(),{pathExists:s}=ge(),c=ve();async function l(e,t,n={}){let i=n.overwrite||n.clobber||!1,{srcStat:a,isChangingCase:s=!1}=await c.checkPaths(e,t,`move`,n);await c.checkParentPaths(e,a,t,`move`);let l=r.dirname(t);return r.parse(l).root!==l&&await o(l),u(e,t,i,s)}async function u(e,t,r,i){if(!i){if(r)await a(t);else if(await s(t))throw Error(`dest already exists.`)}try{await n.rename(e,t)}catch(n){if(n.code!==`EXDEV`)throw n;await d(e,t,r)}}async function d(e,t,n){return await i(e,t,{overwrite:n,errorOnExist:!0,preserveTimestamps:!0}),a(e)}t.exports=l})),ze=z(((e,t)=>{let n=pe(),r=B(`path`),i=Se().copySync,a=Ce().removeSync,o=U().mkdirpSync,s=ve();function c(e,t,n){n||={};let i=n.overwrite||n.clobber||!1,{srcStat:a,isChangingCase:c=!1}=s.checkPathsSync(e,t,`move`,n);return s.checkParentPathsSync(e,a,t,`move`),l(t)||o(r.dirname(t)),u(e,t,i,c)}function l(e){let t=r.dirname(e);return r.parse(t).root===t}function u(e,t,r,i){if(i)return d(e,t,r);if(r)return a(t),d(e,t,r);if(n.existsSync(t))throw Error(`dest already exists.`);return d(e,t,r)}function d(e,t,r){try{n.renameSync(e,t)}catch(n){if(n.code!==`EXDEV`)throw n;return f(e,t,r)}}function f(e,t,n){return i(e,t,{overwrite:n,errorOnExist:!0,preserveTimestamps:!0}),a(e)}t.exports=c})),Be=z(((e,t)=>{let n=V().fromPromise;t.exports={move:n(Re()),moveSync:ze()}})),Ve=z(((e,t)=>{t.exports={...H(),...Se(),...we(),...Ae(),...Le(),...U(),...Be(),...Pe(),...ge(),...Ce()}})),He=z(((e,t)=>{let n=process||{},r=n.argv||[],i=n.env||{},a=!(i.NO_COLOR||r.includes(`--no-color`))&&(!!i.FORCE_COLOR||r.includes(`--color`)||n.platform===`win32`||(n.stdout||{}).isTTY&&i.TERM!==`dumb`||!!i.CI),o=(e,t,n=e)=>r=>{let i=``+r,a=i.indexOf(t,e.length);return~a?e+s(i,t,n,a)+t:e+i+t},s=(e,t,n,r)=>{let i=``,a=0;do i+=e.substring(a,r)+n,a=r+t.length,r=e.indexOf(t,a);while(~r);return i+e.substring(a)},c=(e=a)=>{let t=e?o:()=>String;return{isColorSupported:e,reset:t(`\x1B[0m`,`\x1B[0m`),bold:t(`\x1B[1m`,`\x1B[22m`,`\x1B[22m\x1B[1m`),dim:t(`\x1B[2m`,`\x1B[22m`,`\x1B[22m\x1B[2m`),italic:t(`\x1B[3m`,`\x1B[23m`),underline:t(`\x1B[4m`,`\x1B[24m`),inverse:t(`\x1B[7m`,`\x1B[27m`),hidden:t(`\x1B[8m`,`\x1B[28m`),strikethrough:t(`\x1B[9m`,`\x1B[29m`),black:t(`\x1B[30m`,`\x1B[39m`),red:t(`\x1B[31m`,`\x1B[39m`),green:t(`\x1B[32m`,`\x1B[39m`),yellow:t(`\x1B[33m`,`\x1B[39m`),blue:t(`\x1B[34m`,`\x1B[39m`),magenta:t(`\x1B[35m`,`\x1B[39m`),cyan:t(`\x1B[36m`,`\x1B[39m`),white:t(`\x1B[37m`,`\x1B[39m`),gray:t(`\x1B[90m`,`\x1B[39m`),bgBlack:t(`\x1B[40m`,`\x1B[49m`),bgRed:t(`\x1B[41m`,`\x1B[49m`),bgGreen:t(`\x1B[42m`,`\x1B[49m`),bgYellow:t(`\x1B[43m`,`\x1B[49m`),bgBlue:t(`\x1B[44m`,`\x1B[49m`),bgMagenta:t(`\x1B[45m`,`\x1B[49m`),bgCyan:t(`\x1B[46m`,`\x1B[49m`),bgWhite:t(`\x1B[47m`,`\x1B[49m`),blackBright:t(`\x1B[90m`,`\x1B[39m`),redBright:t(`\x1B[91m`,`\x1B[39m`),greenBright:t(`\x1B[92m`,`\x1B[39m`),yellowBright:t(`\x1B[93m`,`\x1B[39m`),blueBright:t(`\x1B[94m`,`\x1B[39m`),magentaBright:t(`\x1B[95m`,`\x1B[39m`),cyanBright:t(`\x1B[96m`,`\x1B[39m`),whiteBright:t(`\x1B[97m`,`\x1B[39m`),bgBlackBright:t(`\x1B[100m`,`\x1B[49m`),bgRedBright:t(`\x1B[101m`,`\x1B[49m`),bgGreenBright:t(`\x1B[102m`,`\x1B[49m`),bgYellowBright:t(`\x1B[103m`,`\x1B[49m`),bgBlueBright:t(`\x1B[104m`,`\x1B[49m`),bgMagentaBright:t(`\x1B[105m`,`\x1B[49m`),bgCyanBright:t(`\x1B[106m`,`\x1B[49m`),bgWhiteBright:t(`\x1B[107m`,`\x1B[49m`)}};t.exports=c(),t.exports.createColors=c})),W=le(Ve(),1),G=le(He(),1);function Ue(e){return e==null?[]:Array.isArray(e)?e:[e]}function We(e,t,n,r){var i,a=e[t],o=~r.string.indexOf(t)?n==null||n===!0?``:String(n):typeof n==`boolean`?n:~r.boolean.indexOf(t)?n===`false`?!1:n===`true`||(e._.push((i=+n,i*0==0?i:n)),!!n):(i=+n,i*0==0?i:n);e[t]=a==null?o:Array.isArray(a)?a.concat(o):[a,o]}function Ge(e,t){e||=[],t||={};var n,r,i,a,o,s={_:[]},c=0,l=0,u=0,d=e.length;let f=t.alias!==void 0,p=t.unknown!==void 0,m=t.default!==void 0;if(t.alias=t.alias||{},t.string=Ue(t.string),t.boolean=Ue(t.boolean),f)for(n in t.alias)for(r=t.alias[n]=Ue(t.alias[n]),c=0;c<r.length;c++)(t.alias[r[c]]=r.concat(n)).splice(c,1);for(c=t.boolean.length;c-- >0;)for(r=t.alias[t.boolean[c]]||[],l=r.length;l-- >0;)t.boolean.push(r[l]);for(c=t.string.length;c-- >0;)for(r=t.alias[t.string[c]]||[],l=r.length;l-- >0;)t.string.push(r[l]);if(m){for(n in t.default)if(a=typeof t.default[n],r=t.alias[n]=t.alias[n]||[],t[a]!==void 0)for(t[a].push(n),c=0;c<r.length;c++)t[a].push(r[c])}let h=p?Object.keys(t.alias):[];for(c=0;c<d;c++){if(i=e[c],i===`--`){s._=s._.concat(e.slice(++c));break}for(l=0;l<i.length&&i.charCodeAt(l)===45;l++);if(l===0)s._.push(i);else if(i.substring(l,l+3)===`no-`){if(a=i.substring(l+3),p&&!~h.indexOf(a))return t.unknown(i);s[a]=!1}else{for(u=l+1;u<i.length&&i.charCodeAt(u)!==61;u++);for(a=i.substring(l,u),o=i.substring(++u)||c+1===d||(``+e[c+1]).charCodeAt(0)===45||e[++c],r=l===2?[a]:a,u=0;u<r.length;u++){if(a=r[u],p&&!~h.indexOf(a))return t.unknown(`-`.repeat(l)+a);We(s,a,u+1<r.length||o,t)}}}if(m)for(n in t.default)s[n]===void 0&&(s[n]=t.default[n]);if(f)for(n in s)for(r=t.alias[n]||[];r.length>0;)s[r.shift()]=s[n];return s}function Ke(e){return e.replace(/[<[].+/,``).trim()}function qe(e){let t=/<([^>]+)>/g,n=/\[([^\]]+)\]/g,r=[],i=e=>{let t=!1,n=e[1];return n.startsWith(`...`)&&(n=n.slice(3),t=!0),{required:e[0].startsWith(`<`),value:n,variadic:t}},a;for(;a=t.exec(e);)r.push(i(a));let o;for(;o=n.exec(e);)r.push(i(o));return r}function Je(e){let t={alias:{},boolean:[]};for(let[n,r]of e.entries())r.names.length>1&&(t.alias[r.names[0]]=r.names.slice(1)),r.isBoolean&&(r.negated&&e.some((e,t)=>t!==n&&e.names.some(e=>r.names.includes(e))&&typeof e.required==`boolean`)||t.boolean.push(r.names[0]));return t}function Ye(e){return e.sort((e,t)=>e.length>t.length?-1:1)[0]}function Xe(e,t){return e.length>=t?e:`${e}${` `.repeat(t-e.length)}`}function Ze(e){return e.replaceAll(/([a-z])-([a-z])/g,(e,t,n)=>t+n.toUpperCase())}function Qe(e,t,n){let r=e;for(let e=0;e<t.length;e++){let i=t[e];if(e===t.length-1){r[i]=n;return}if(r[i]==null){let n=+t[e+1]>-1;r[i]=n?[]:{}}r=r[i]}}function $e(e,t){for(let n of Object.keys(t)){let r=t[n];r.shouldTransform&&(e[n]=[e[n]].flat(),typeof r.transformFunction==`function`&&(e[n]=e[n].map(r.transformFunction)))}}function et(e){let t=/([^\\/]+)$/.exec(e);return t?t[1]:``}function tt(e){return e.split(`.`).map((e,t)=>t===0?Ze(e):e).join(`.`)}var nt=class extends Error{constructor(e){super(e),this.name=`CACError`,typeof Error.captureStackTrace!=`function`&&(this.stack=Error(e).stack)}},rt=class{rawName;description;name;names;isBoolean;required;config;negated;constructor(e,t,n){this.rawName=e,this.description=t,this.config=Object.assign({},n),e=e.replaceAll(`.*`,``),this.negated=!1,this.names=Ke(e).split(`,`).map(e=>{let t=e.trim().replace(/^-{1,2}/,``);return t.startsWith(`no-`)&&(this.negated=!0,t=t.replace(/^no-/,``)),tt(t)}).sort((e,t)=>e.length>t.length?1:-1),this.name=this.names.at(-1),this.negated&&this.config.default==null&&(this.config.default=!0),e.includes(`<`)?this.required=!0:e.includes(`[`)?this.required=!1:this.isBoolean=!0}};let it,at;if(typeof process<`u`){let e;e=typeof Deno<`u`&&typeof Deno.version?.deno==`string`?`deno`:typeof Bun<`u`&&typeof Bun.version==`string`?`bun`:`node`,at=`${process.platform}-${process.arch} ${e}-${process.version}`,it=process.argv}else at=typeof navigator>`u`?`unknown`:`${navigator.platform} ${navigator.userAgent}`;var ot=class{rawName;description;config;cli;options;aliasNames;name;args;commandAction;usageText;versionNumber;examples;helpCallback;globalCommand;constructor(e,t,n={},r){this.rawName=e,this.description=t,this.config=n,this.cli=r,this.options=[],this.aliasNames=[],this.name=Ke(e),this.args=qe(e),this.examples=[]}usage(e){return this.usageText=e,this}allowUnknownOptions(){return this.config.allowUnknownOptions=!0,this}ignoreOptionDefaultValue(){return this.config.ignoreOptionDefaultValue=!0,this}version(e,t=`-v, --version`){return this.versionNumber=e,this.option(t,`Display version number`),this}example(e){return this.examples.push(e),this}option(e,t,n){let r=new rt(e,t,n);return this.options.push(r),this}alias(e){return this.aliasNames.push(e),this}action(e){return this.commandAction=e,this}isMatched(e){return this.name===e||this.aliasNames.includes(e)}get isDefaultCommand(){return this.name===``||this.aliasNames.includes(`!`)}get isGlobalCommand(){return this instanceof st}hasOption(e){return e=e.split(`.`)[0],this.options.find(t=>t.names.includes(e))}outputHelp(){let{name:e,commands:t}=this.cli,{versionNumber:n,options:r,helpCallback:i}=this.cli.globalCommand,a=[{body:`${e}${n?`/${n}`:``}`}];if(a.push({title:`Usage`,body:` $ ${e} ${this.usageText||this.rawName}`}),(this.isGlobalCommand||this.isDefaultCommand)&&t.length>0){let n=Ye(t.map(e=>e.rawName));a.push({title:`Commands`,body:t.map(e=>` ${Xe(e.rawName,n.length)} ${e.description}`).join(`
8
+ `)},{title:"For more info, run any command with the `--help` flag",body:t.map(t=>` $ ${e}${t.name===``?``:` ${t.name}`} --help`).join(`
9
+ `)})}let o=this.isGlobalCommand?r:[...this.options,...r||[]];if(!this.isGlobalCommand&&!this.isDefaultCommand&&(o=o.filter(e=>e.name!==`version`)),o.length>0){let e=Ye(o.map(e=>e.rawName));a.push({title:`Options`,body:o.map(t=>` ${Xe(t.rawName,e.length)} ${t.description} ${t.config.default===void 0?``:`(default: ${t.config.default})`}`).join(`
10
+ `)})}this.examples.length>0&&a.push({title:`Examples`,body:this.examples.map(t=>typeof t==`function`?t(e):t).join(`
11
+ `)}),i&&(a=i(a)||a),console.info(a.map(e=>e.title?`${e.title}:\n${e.body}`:e.body).join(`
12
+
13
+ `))}outputVersion(){let{name:e}=this.cli,{versionNumber:t}=this.cli.globalCommand;t&&console.info(`${e}/${t} ${at}`)}checkRequiredArgs(){let e=this.args.filter(e=>e.required).length;if(this.cli.args.length<e)throw new nt(`missing required args for command \`${this.rawName}\``)}checkUnknownOptions(){let{options:e,globalCommand:t}=this.cli;if(!this.config.allowUnknownOptions){for(let n of Object.keys(e))if(n!==`--`&&!this.hasOption(n)&&!t.hasOption(n))throw new nt(`Unknown option \`${n.length>1?`--${n}`:`-${n}`}\``)}}checkOptionValue(){let{options:e,globalCommand:t}=this.cli,n=[...t.options,...this.options];for(let t of n){let r=e[t.name.split(`.`)[0]];if(t.required){let e=n.some(e=>e.negated&&e.names.includes(t.name));if(r===!0||r===!1&&!e)throw new nt(`option \`${t.rawName}\` value is missing`)}}}checkUnusedArgs(){let e=this.args.some(e=>e.variadic)?1/0:this.args.length;if(e<this.cli.args.length)throw new nt(`Unused args: ${this.cli.args.slice(e).map(e=>`\`${e}\``).join(`, `)}`)}},st=class extends ot{constructor(e){super(`@@global@@`,``,{},e)}},ct=class extends EventTarget{name;commands;globalCommand;matchedCommand;matchedCommandName;rawArgs;args;options;showHelpOnExit;showVersionOnExit;constructor(e=``){super(),this.name=e,this.commands=[],this.rawArgs=[],this.args=[],this.options={},this.globalCommand=new st(this),this.globalCommand.usage(`<command> [options]`)}usage(e){return this.globalCommand.usage(e),this}command(e,t,n){let r=new ot(e,t||``,n,this);return r.globalCommand=this.globalCommand,this.commands.push(r),r}option(e,t,n){return this.globalCommand.option(e,t,n),this}help(e){return this.globalCommand.option(`-h, --help`,`Display this message`),this.globalCommand.helpCallback=e,this.showHelpOnExit=!0,this}version(e,t=`-v, --version`){return this.globalCommand.version(e,t),this.showVersionOnExit=!0,this}example(e){return this.globalCommand.example(e),this}outputHelp(){this.matchedCommand?this.matchedCommand.outputHelp():this.globalCommand.outputHelp()}outputVersion(){this.globalCommand.outputVersion()}setParsedInfo({args:e,options:t},n,r){return this.args=e,this.options=t,n&&(this.matchedCommand=n),r&&(this.matchedCommandName=r),this}unsetMatchedCommand(){this.matchedCommand=void 0,this.matchedCommandName=void 0}parse(e,{run:t=!0}={}){if(!e){if(!it)throw Error(`No argv provided and runtime process argv is not available.`);e=it}this.rawArgs=e,this.name||=e[1]?et(e[1]):`cli`;let n=!0;for(let t of this.commands){let r=this.mri(e.slice(2),t),i=r.args[0];if(t.isMatched(i)){n=!1;let e={...r,args:r.args.slice(1)};this.setParsedInfo(e,t,i),this.dispatchEvent(new CustomEvent(`command:${i}`,{detail:t}))}}if(n){for(let t of this.commands)if(t.isDefaultCommand){n=!1;let r=this.mri(e.slice(2),t);this.setParsedInfo(r,t),this.dispatchEvent(new CustomEvent(`command:!`,{detail:t}))}}if(n){let t=this.mri(e.slice(2));this.setParsedInfo(t)}this.options.help&&this.showHelpOnExit&&(this.outputHelp(),t=!1,this.unsetMatchedCommand()),this.options.version&&this.showVersionOnExit&&this.matchedCommandName==null&&(this.outputVersion(),t=!1,this.unsetMatchedCommand());let r={args:this.args,options:this.options};return t&&this.runMatchedCommand(),!this.matchedCommand&&this.args[0]&&this.dispatchEvent(new CustomEvent(`command:*`,{detail:this.args[0]})),r}mri(e,t){let n=[...this.globalCommand.options,...t?t.options:[]],r=Je(n),i=[],a=e.indexOf(`--`);a!==-1&&(i=e.slice(a+1),e=e.slice(0,a));let o=Ge(e,r);o=Object.keys(o).reduce((e,t)=>({...e,[tt(t)]:o[t]}),{_:[]});let s=o._,c={"--":i},l=t&&t.config.ignoreOptionDefaultValue?t.config.ignoreOptionDefaultValue:this.globalCommand.config.ignoreOptionDefaultValue,u=Object.create(null);for(let e of n){if(!l&&e.config.default!==void 0)for(let t of e.names)c[t]=e.config.default;Array.isArray(e.config.type)&&u[e.name]===void 0&&(u[e.name]=Object.create(null),u[e.name].shouldTransform=!0,u[e.name].transformFunction=e.config.type[0])}for(let e of Object.keys(o))e!==`_`&&(Qe(c,e.split(`.`),o[e]),$e(c,u));return{args:s,options:c}}runMatchedCommand(){let{args:e,options:t,matchedCommand:n}=this;if(!n||!n.commandAction)return;n.checkUnknownOptions(),n.checkOptionValue(),n.checkRequiredArgs(),n.checkUnusedArgs();let r=[];return n.args.forEach((t,n)=>{t.variadic?r.push(e.slice(n)):r.push(e[n])}),r.push(t),n.commandAction.apply(this,r)}};const lt=(e=``)=>new ct(e);function ut(e){switch(e){case`strict`:return`strict`;case`relaxed`:return`relaxed`;case`off`:return`off`;default:throw Error(`Invalid value for --ssl: ${e}. Expected one of: strict, relaxed, off.`)}}function dt(e){return Array.isArray(e)?e[e.length-1]:e}function ft(e){if(e===`true`)return`latest`;if(e!==`undefined`)return e}function pt(e,t){let n=mt(t);return{config:dt(e.config),force:dt(e.force)??!1,ui:dt(e.ui),smart:n.length>0?!0:dt(e.smart),update:ft(dt(e.update)),ssl:ut(dt(e.ssl)),notifications:dt(e.notifications),paths:n}}function mt(e){return(Array.isArray(e)?e:[]).filter(e=>e!==``&&!e.startsWith(`--`))}function ht(e,t){let n=lt(`wallaby`),r,i=n.command(`[start] [...paths]`,`Start Wallaby`).usage(`[start]`).alias(`start`).option(`--config <path>`,`Use config file: https://wallabyjs.com/docs/config/overview.html`).option(`--ui`,`Open browser on startup`,{default:!0}).option(`--smart`,`Use smart (lazy) start to run tests of modified test files only: https://wallabyjs.com/docs/intro/smart-start.html`).option(`--force`,`Start a new Wallaby instance even if one is already running`,{default:!1}).option(`--update [version]`,`Update Wallaby to the latest version before starting, or install and pin the specified version`,{type:[String]}).option(`--ssl <mode>`,`Set SSL mode for downloads: strict, relaxed, or off`,{default:`strict`,type:[String]}).option(`--notifications`,`Notify about license expiration`,{default:!0}).action((e,t,n)=>{r={action:`start`,options:pt(n,[])}});return i.rawName=`[start]`,n.help(),n.version(t),n.parse(e),r}var gt=z(((e,t)=>{let n=e=>e&&typeof e.message==`string`,r=e=>{if(!e)return;let t=e.cause;if(typeof t==`function`){let t=e.cause();return n(t)?t:void 0}else return n(t)?t:void 0},i=(e,t)=>{if(!n(e))return``;let a=e.stack||``;if(t.has(e))return a+`
14
+ causes have become circular...`;let o=r(e);return o?(t.add(e),a+`
15
+ caused by: `+i(o,t)):a},a=e=>i(e,new Set),o=(e,t,i)=>{if(!n(e))return``;let a=i?``:e.message||``;if(t.has(e))return a+`: ...`;let s=r(e);if(s){t.add(e);let n=typeof e.cause==`function`;return a+(n?``:`: `)+o(s,t,n)}else return a};t.exports={isErrorLike:n,getErrorCause:r,stackWithCauses:a,messageWithCauses:e=>o(e,new Set)}})),_t=z(((e,t)=>{let n=Symbol(`circular-ref-tag`),r=Symbol(`pino-raw-err-ref`),i=Object.create({},{type:{enumerable:!0,writable:!0,value:void 0},message:{enumerable:!0,writable:!0,value:void 0},stack:{enumerable:!0,writable:!0,value:void 0},aggregateErrors:{enumerable:!0,writable:!0,value:void 0},raw:{enumerable:!1,get:function(){return this[r]},set:function(e){this[r]=e}}});Object.defineProperty(i,r,{writable:!0,value:{}}),t.exports={pinoErrProto:i,pinoErrorSymbols:{seen:n,rawSymbol:r}}})),vt=z(((e,t)=>{t.exports=l;let{messageWithCauses:n,stackWithCauses:r,isErrorLike:i}=gt(),{pinoErrProto:a,pinoErrorSymbols:o}=_t(),{seen:s}=o,{toString:c}=Object.prototype;function l(e){if(!i(e))return e;e[s]=void 0;let t=Object.create(a);t.type=c.call(e.constructor)===`[object Function]`?e.constructor.name:e.name,t.message=n(e),t.stack=r(e),Array.isArray(e.errors)&&(t.aggregateErrors=e.errors.map(e=>l(e)));for(let n in e)if(t[n]===void 0){let r=e[n];i(r)?n!==`cause`&&!Object.prototype.hasOwnProperty.call(r,s)&&(t[n]=l(r)):t[n]=r}return delete e[s],t.raw=e,t}})),yt=z(((e,t)=>{t.exports=s;let{isErrorLike:n}=gt(),{pinoErrProto:r,pinoErrorSymbols:i}=_t(),{seen:a}=i,{toString:o}=Object.prototype;function s(e){if(!n(e))return e;e[a]=void 0;let t=Object.create(r);t.type=o.call(e.constructor)===`[object Function]`?e.constructor.name:e.name,t.message=e.message,t.stack=e.stack,Array.isArray(e.errors)&&(t.aggregateErrors=e.errors.map(e=>s(e))),n(e.cause)&&!Object.prototype.hasOwnProperty.call(e.cause,a)&&(t.cause=s(e.cause));for(let r in e)if(t[r]===void 0){let i=e[r];n(i)?Object.prototype.hasOwnProperty.call(i,a)||(t[r]=s(i)):t[r]=i}return delete e[a],t.raw=e,t}})),bt=z(((e,t)=>{t.exports={mapHttpRequest:a,reqSerializer:i};let n=Symbol(`pino-raw-req-ref`),r=Object.create({},{id:{enumerable:!0,writable:!0,value:``},method:{enumerable:!0,writable:!0,value:``},url:{enumerable:!0,writable:!0,value:``},query:{enumerable:!0,writable:!0,value:``},params:{enumerable:!0,writable:!0,value:``},headers:{enumerable:!0,writable:!0,value:{}},remoteAddress:{enumerable:!0,writable:!0,value:``},remotePort:{enumerable:!0,writable:!0,value:``},raw:{enumerable:!1,get:function(){return this[n]},set:function(e){this[n]=e}}});Object.defineProperty(r,n,{writable:!0,value:{}});function i(e){let t=e.info||e.socket,n=Object.create(r);if(n.id=typeof e.id==`function`?e.id():e.id||(e.info?e.info.id:void 0),n.method=e.method,e.originalUrl)n.url=e.originalUrl;else{let t=e.path;n.url=typeof t==`string`?t:e.url?e.url.path||e.url:void 0}return e.query&&(n.query=e.query),e.params&&(n.params=e.params),n.headers=e.headers,n.remoteAddress=t&&t.remoteAddress,n.remotePort=t&&t.remotePort,n.raw=e.raw||e,n}function a(e){return{req:i(e)}}})),xt=z(((e,t)=>{t.exports={mapHttpResponse:a,resSerializer:i};let n=Symbol(`pino-raw-res-ref`),r=Object.create({},{statusCode:{enumerable:!0,writable:!0,value:0},headers:{enumerable:!0,writable:!0,value:``},raw:{enumerable:!1,get:function(){return this[n]},set:function(e){this[n]=e}}});Object.defineProperty(r,n,{writable:!0,value:{}});function i(e){let t=Object.create(r);return t.statusCode=e.headersSent?e.statusCode:null,t.headers=e.getHeaders?e.getHeaders():e._headers,t.raw=e,t}function a(e){return{res:i(e)}}})),St=z(((e,t)=>{let n=vt(),r=yt(),i=bt(),a=xt();t.exports={err:n,errWithCause:r,mapHttpRequest:i.mapHttpRequest,mapHttpResponse:a.mapHttpResponse,req:i.reqSerializer,res:a.resSerializer,wrapErrorSerializer:function(e){return e===n?e:function(t){return e(n(t))}},wrapRequestSerializer:function(e){return e===i.reqSerializer?e:function(t){return e(i.reqSerializer(t))}},wrapResponseSerializer:function(e){return e===a.resSerializer?e:function(t){return e(a.resSerializer(t))}}}})),Ct=z(((e,t)=>{function n(e,t){return t}t.exports=function(){let e=Error.prepareStackTrace;Error.prepareStackTrace=n;let t=Error().stack;if(Error.prepareStackTrace=e,!Array.isArray(t))return;let r=t.slice(2),i=[];for(let e of r)e&&i.push(e.getFileName());return i}})),wt=z(((e,t)=>{function n(e){if(typeof e!=`object`||!e)return e;if(e instanceof Date)return new Date(e.getTime());if(e instanceof Array){let t=[];for(let r=0;r<e.length;r++)t[r]=n(e[r]);return t}if(typeof e==`object`){let t=Object.create(Object.getPrototypeOf(e));for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=n(e[r]));return t}return e}function r(e){let t=[],n=``,r=!1,i=!1,a=``;for(let o=0;o<e.length;o++){let s=e[o];!r&&s===`.`?n&&=(t.push(n),``):s===`[`?(n&&=(t.push(n),``),r=!0):s===`]`&&r?(t.push(n),n=``,r=!1,i=!1):(s===`"`||s===`'`)&&r?i?s===a?(i=!1,a=``):n+=s:(i=!0,a=s):n+=s}return n&&t.push(n),t}function i(e,t,n){let r=e;for(let e=0;e<t.length-1;e++){let n=t[e];if(typeof r!=`object`||!r||!(n in r)||typeof r[n]!=`object`||r[n]===null)return!1;r=r[n]}let i=t[t.length-1];if(i===`*`){if(Array.isArray(r))for(let e=0;e<r.length;e++)r[e]=n;else if(typeof r==`object`&&r)for(let e in r)Object.prototype.hasOwnProperty.call(r,e)&&(r[e]=n)}else typeof r==`object`&&r&&i in r&&Object.prototype.hasOwnProperty.call(r,i)&&(r[i]=n);return!0}function a(e,t){let n=e;for(let e=0;e<t.length-1;e++){let r=t[e];if(typeof n!=`object`||!n||!(r in n)||typeof n[r]!=`object`||n[r]===null)return!1;n=n[r]}let r=t[t.length-1];if(r===`*`){if(Array.isArray(n))for(let e=0;e<n.length;e++)n[e]=void 0;else if(typeof n==`object`&&n)for(let e in n)Object.prototype.hasOwnProperty.call(n,e)&&delete n[e]}else typeof n==`object`&&n&&r in n&&Object.prototype.hasOwnProperty.call(n,r)&&delete n[r];return!0}let o=Symbol(`PATH_NOT_FOUND`);function s(e,t){let n=e;for(let e of t){if(typeof n!=`object`||!n||!n||!(e in n))return o;n=n[e]}return n}function c(e,t){let n=e;for(let e of t){if(typeof n!=`object`||!n||!n)return;n=n[e]}return n}function l(e,t,n,c=!1){for(let l of t){let t=r(l);if(t.includes(`*`))u(e,t,n,l,c);else if(c)a(e,t);else{let r=s(e,t);if(r===o)continue;i(e,t,typeof n==`function`?n(r,t):n)}}}function u(e,t,n,r,i=!1){let a=t.indexOf(`*`);if(a===t.length-1){let r=t.slice(0,-1),a=e;for(let e of r){if(typeof a!=`object`||!a||!a)return;a=a[e]}if(Array.isArray(a))if(i)for(let e=0;e<a.length;e++)a[e]=void 0;else for(let e=0;e<a.length;e++){let t=[...r,e.toString()],i=typeof n==`function`?n(a[e],t):n;a[e]=i}else if(typeof a==`object`&&a)if(i){let e=[];for(let t in a)Object.prototype.hasOwnProperty.call(a,t)&&e.push(t);for(let t of e)delete a[t]}else for(let e in a){let t=[...r,e],i=typeof n==`function`?n(a[e],t):n;a[e]=i}}else d(e,t,n,a,r,i)}function d(e,t,n,r,o,s=!1){let l=t.slice(0,r),d=t.slice(r+1),f=[];function p(e,t){if(t===l.length){if(Array.isArray(e))for(let n=0;n<e.length;n++)f[t]=n.toString(),p(e[n],t+1);else if(typeof e==`object`&&e)for(let n in e)f[t]=n,p(e[n],t+1)}else if(t<l.length){let n=l[t];e&&typeof e==`object`&&e&&n in e&&(f[t]=n,p(e[n],t+1))}else d.includes(`*`)?u(e,d,typeof n==`function`?(e,r)=>n(e,[...f.slice(0,t),...r]):n,o,s):s?a(e,d):i(e,d,typeof n==`function`?n(c(e,d),[...f.slice(0,t),...d]):n)}if(l.length===0)p(e,0);else{let t=e;for(let e=0;e<l.length;e++){let n=l[e];if(typeof t!=`object`||!t||!t)return;t=t[n],f[e]=n}t!=null&&p(t,l.length)}}function f(e){if(e.length===0)return null;let t=new Map;for(let n of e){let e=r(n),i=t;for(let t=0;t<e.length;t++){let n=e[t];i.has(n)||i.set(n,new Map),i=i.get(n)}}return t}function p(e,t){if(!t)return e;function n(e,t,r=0){if(!t||t.size===0||typeof e!=`object`||!e)return e;if(e instanceof Date)return new Date(e.getTime());if(Array.isArray(e)){let r=[];for(let i=0;i<e.length;i++){let a=i.toString();t.has(a)||t.has(`*`)?r[i]=n(e[i],t.get(a)||t.get(`*`)):r[i]=e[i]}return r}let i=Object.create(Object.getPrototypeOf(e));for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t.has(r)||t.has(`*`)?i[r]=n(e[r],t.get(r)||t.get(`*`)):i[r]=e[r]);return i}return n(e,t)}function m(e){if(typeof e!=`string`)throw Error(`Paths must be (non-empty) strings`);if(e===``)throw Error(`Invalid redaction path ()`);if(e.includes(`..`)||e.includes(`,`))throw Error(`Invalid redaction path (${e})`);let t=0,n=!1,r=``;for(let i=0;i<e.length;i++){let a=e[i];if((a===`"`||a===`'`)&&t>0)n?a===r&&(n=!1,r=``):(n=!0,r=a);else if(a===`[`&&!n)t++;else if(a===`]`&&!n&&(t--,t<0))throw Error(`Invalid redaction path (${e})`)}if(t!==0)throw Error(`Invalid redaction path (${e})`)}function h(e){if(!Array.isArray(e))throw TypeError(`paths must be an array`);for(let t of e)m(t)}function g(e={}){let{paths:t=[],censor:r=`[REDACTED]`,serialize:i=JSON.stringify,strict:a=!0,remove:o=!1}=e;h(t);let s=f(t);return function(e){if(a&&(typeof e!=`object`||!e)&&(typeof e!=`object`||!e))return i?i(e):e;let c=p(e,s),u=e,d=r;return typeof r==`function`&&(d=r),l(c,t,d,o),i===!1?(c.restore=function(){return n(u)},c):typeof i==`function`?i(c):JSON.stringify(c)}}t.exports=g})),Tt=z(((e,t)=>{let n=Symbol(`pino.setLevel`),r=Symbol(`pino.getLevel`),i=Symbol(`pino.levelVal`),a=Symbol(`pino.levelComp`),o=Symbol(`pino.useLevelLabels`),s=Symbol(`pino.useOnlyCustomLevels`),c=Symbol(`pino.mixin`),l=Symbol(`pino.lsCache`),u=Symbol(`pino.chindings`),d=Symbol(`pino.asJson`),f=Symbol(`pino.write`),p=Symbol(`pino.redactFmt`),m=Symbol(`pino.time`),h=Symbol(`pino.timeSliceIndex`),g=Symbol(`pino.stream`),_=Symbol(`pino.stringify`),v=Symbol(`pino.stringifySafe`),y=Symbol(`pino.stringifiers`),b=Symbol(`pino.end`),x=Symbol(`pino.formatOpts`),S=Symbol(`pino.messageKey`),C=Symbol(`pino.errorKey`),w=Symbol(`pino.nestedKey`),T=Symbol(`pino.nestedKeyStr`),E=Symbol(`pino.mixinMergeStrategy`),D=Symbol(`pino.msgPrefix`),O=Symbol(`pino.wildcardFirst`),k=Symbol.for(`pino.serializers`),A=Symbol.for(`pino.formatters`),j=Symbol.for(`pino.hooks`);t.exports={setLevelSym:n,getLevelSym:r,levelValSym:i,levelCompSym:a,useLevelLabelsSym:o,mixinSym:c,lsCacheSym:l,chindingsSym:u,asJsonSym:d,writeSym:f,serializersSym:k,redactFmtSym:p,timeSym:m,timeSliceIndexSym:h,streamSym:g,stringifySym:_,stringifySafeSym:v,stringifiersSym:y,endSym:b,formatOptsSym:x,messageKeySym:S,errorKeySym:C,nestedKeySym:w,wildcardFirstSym:O,needsMetadataGsym:Symbol.for(`pino.metadata`),useOnlyCustomLevelsSym:s,formattersSym:A,hooksSym:j,nestedKeyStrSym:T,mixinMergeStrategySym:E,msgPrefixSym:D}})),Et=z(((e,t)=>{let n=wt(),{redactFmtSym:r,wildcardFirstSym:i}=Tt(),a=/[^.[\]]+|\[([^[\]]*?)\]/g,o=`[Redacted]`;function s(e,t){let{paths:o,censor:s,remove:l}=c(e),u=o.reduce((e,t)=>{a.lastIndex=0;let n=a.exec(t),r=a.exec(t),o=n[1]===void 0?n[0]:n[1].replace(/^(?:"|'|`)(.*)(?:"|'|`)$/,`$1`);if(o===`*`&&(o=i),r===null)return e[o]=null,e;if(e[o]===null)return e;let{index:s}=r,c=`${t.substr(s,t.length-1)}`;return e[o]=e[o]||[],o!==i&&e[o].length===0&&e[o].push(...e[i]||[]),o===i&&Object.keys(e).forEach(function(t){e[t]&&e[t].push(c)}),e[o].push(c),e},{}),d={[r]:n({paths:o,censor:s,serialize:t,strict:!1,remove:l})},f=(...e)=>t(typeof s==`function`?s(...e):s);return[...Object.keys(u),...Object.getOwnPropertySymbols(u)].reduce((e,r)=>{if(u[r]===null)e[r]=e=>f(e,[r]);else{let i=typeof s==`function`?(e,t)=>s(e,[r,...t]):s;e[r]=n({paths:u[r],censor:i,serialize:t,strict:!1,remove:l})}return e},d)}function c(e){if(Array.isArray(e))return e={paths:e,censor:o},e;let{paths:t,censor:n=o,remove:r}=e;if(Array.isArray(t)===!1)throw Error(`pino – redact must contain an array of strings`);return r===!0&&(n=void 0),{paths:t,censor:n,remove:r}}t.exports=s})),Dt=z(((e,t)=>{let n=()=>``,r=()=>`,"time":${Date.now()}`,i=()=>`,"time":${Math.round(Date.now()/1e3)}`,a=()=>`,"time":"${new Date(Date.now()).toISOString()}"`,o=1000000000n,s=BigInt(Date.now())*1000000n,c=process.hrtime.bigint();t.exports={nullTime:n,epochTime:r,unixTime:i,isoTime:a,isoTimeNano:()=>{let e=s+(process.hrtime.bigint()-c),t=e/o,n=e%o,r=Number(t*1000n+n/1000000n),i=new Date(r);return`,"time":"${i.getUTCFullYear()}-${(i.getUTCMonth()+1).toString().padStart(2,`0`)}-${i.getUTCDate().toString().padStart(2,`0`)}T${i.getUTCHours().toString().padStart(2,`0`)}:${i.getUTCMinutes().toString().padStart(2,`0`)}:${i.getUTCSeconds().toString().padStart(2,`0`)}.${n.toString().padStart(9,`0`)}Z"`}}})),Ot=z(((e,t)=>{function n(e){try{return JSON.stringify(e)}catch{return`"[Circular]"`}}t.exports=r;function r(e,t,r){var i=r&&r.stringify||n,a=1;if(typeof e==`object`&&e){var o=t.length+a;if(o===1)return e;var s=Array(o);s[0]=i(e);for(var c=1;c<o;c++)s[c]=i(t[c]);return s.join(` `)}if(typeof e!=`string`)return e;var l=t.length;if(l===0)return e;for(var u=``,d=1-a,f=-1,p=e&&e.length||0,m=0;m<p;){if(e.charCodeAt(m)===37&&m+1<p){switch(f=f>-1?f:0,e.charCodeAt(m+1)){case 100:case 102:if(d>=l||t[d]==null)break;f<m&&(u+=e.slice(f,m)),u+=Number(t[d]),f=m+2,m++;break;case 105:if(d>=l||t[d]==null)break;f<m&&(u+=e.slice(f,m)),u+=Math.floor(Number(t[d])),f=m+2,m++;break;case 79:case 111:case 106:if(d>=l||t[d]===void 0)break;f<m&&(u+=e.slice(f,m));var h=typeof t[d];if(h===`string`){u+=`'`+t[d]+`'`,f=m+2,m++;break}if(h===`function`){u+=t[d].name||`<anonymous>`,f=m+2,m++;break}u+=i(t[d]),f=m+2,m++;break;case 115:if(d>=l)break;f<m&&(u+=e.slice(f,m)),u+=String(t[d]),f=m+2,m++;break;case 37:f<m&&(u+=e.slice(f,m)),u+=`%`,f=m+2,m++,d--;break}++d}++m}return f===-1?e:(f<p&&(u+=e.slice(f)),u)}})),kt=z(((e,t)=>{if(typeof SharedArrayBuffer<`u`&&typeof Atomics<`u`){let e=new Int32Array(new SharedArrayBuffer(4));function n(t){if(!(t>0&&t<1/0))throw typeof t!=`number`&&typeof t!=`bigint`?TypeError(`sleep: ms must be a number`):RangeError(`sleep: ms must be a number that is greater than 0 but less than Infinity`);Atomics.wait(e,0,0,Number(t))}t.exports=n}else{function e(e){if(!(e>0&&e<1/0))throw typeof e!=`number`&&typeof e!=`bigint`?TypeError(`sleep: ms must be a number`):RangeError(`sleep: ms must be a number that is greater than 0 but less than Infinity`);let t=Date.now()+Number(e);for(;t>Date.now(););}t.exports=e}})),At=z(((e,t)=>{let n=B(`fs`),r=B(`events`),i=B(`util`).inherits,a=B(`path`),o=kt(),s=B(`assert`),c=Buffer.allocUnsafe(0),l=`buffer`,u=`utf8`,[d,f]=(process.versions.node||`0.0`).split(`.`).map(Number),p=d>=22&&f>=7;function m(e,t){t._opening=!0,t._writing=!0,t._asyncDrainScheduled=!1;function r(n,r){if(n){t._reopening=!1,t._writing=!1,t._opening=!1,t.sync?process.nextTick(()=>{t.listenerCount(`error`)>0&&t.emit(`error`,n)}):t.emit(`error`,n);return}let i=t._reopening;t.fd=r,t.file=e,t._reopening=!1,t._opening=!1,t._writing=!1,t.sync?process.nextTick(()=>t.emit(`ready`)):t.emit(`ready`),!t.destroyed&&(!t._writing&&t._len>t.minLength||t._flushPending?t._actualWrite():i&&process.nextTick(()=>t.emit(`drain`)))}let i=t.append?`a`:`w`,o=t.mode;if(t.sync)try{t.mkdir&&n.mkdirSync(a.dirname(e),{recursive:!0}),r(null,n.openSync(e,i,o))}catch(e){throw r(e),e}else t.mkdir?n.mkdir(a.dirname(e),{recursive:!0},t=>{if(t)return r(t);n.open(e,i,o,r)}):n.open(e,i,o,r)}function h(e){if(!(this instanceof h))return new h(e);let{fd:t,dest:r,minLength:i,maxLength:a,maxWrite:s,periodicFlush:d,sync:f,append:p=!0,mkdir:v,retryEAGAIN:x,fsync:k,contentMode:A,mode:j}=e||{};t||=r,this._len=0,this.fd=-1,this._bufs=[],this._lens=[],this._writing=!1,this._ending=!1,this._reopening=!1,this._asyncDrainScheduled=!1,this._flushPending=!1,this._hwm=Math.max(i||0,16387),this.file=null,this.destroyed=!1,this.minLength=i||0,this.maxLength=a||0,this.maxWrite=s||16384,this._periodicFlush=d||0,this._periodicFlushTimer=void 0,this.sync=f||!1,this.writable=!0,this._fsync=k||!1,this.append=p||!1,this.mode=j,this.retryEAGAIN=x||(()=>!0),this.mkdir=v||!1;let M,N;if(A===l)this._writingBuf=c,this.write=b,this.flush=C,this.flushSync=T,this._actualWrite=D,M=()=>n.writeSync(this.fd,this._writingBuf),N=()=>n.write(this.fd,this._writingBuf,this.release);else if(A===void 0||A===u)this._writingBuf=``,this.write=y,this.flush=S,this.flushSync=w,this._actualWrite=E,M=()=>Buffer.isBuffer(this._writingBuf)?n.writeSync(this.fd,this._writingBuf):n.writeSync(this.fd,this._writingBuf,`utf8`),N=()=>Buffer.isBuffer(this._writingBuf)?n.write(this.fd,this._writingBuf,this.release):n.write(this.fd,this._writingBuf,`utf8`,this.release);else throw Error(`SonicBoom supports "${u}" and "${l}", but passed ${A}`);if(typeof t==`number`)this.fd=t,process.nextTick(()=>this.emit(`ready`));else if(typeof t==`string`)m(t,this);else throw Error(`SonicBoom supports only file descriptors and files`);if(this.minLength>=this.maxWrite)throw Error(`minLength should be smaller than maxWrite (${this.maxWrite})`);this.release=(e,t)=>{if(e){if((e.code===`EAGAIN`||e.code===`EBUSY`)&&this.retryEAGAIN(e,this._writingBuf.length,this._len-this._writingBuf.length))if(this.sync)try{o(100),this.release(void 0,0)}catch(e){this.release(e)}else setTimeout(N,100);else this._writing=!1,this.emit(`error`,e);return}this.emit(`write`,t);let r=g(this._writingBuf,this._len,t);if(this._len=r.len,this._writingBuf=r.writingBuf,this._writingBuf.length){if(!this.sync){N();return}try{do{let e=M(),t=g(this._writingBuf,this._len,e);this._len=t.len,this._writingBuf=t.writingBuf}while(this._writingBuf.length)}catch(e){this.release(e);return}}this._fsync&&n.fsyncSync(this.fd);let i=this._len;this._reopening?(this._writing=!1,this._reopening=!1,this.reopen()):i>this.minLength?this._actualWrite():this._ending?i>0?this._actualWrite():(this._writing=!1,O(this)):(this._writing=!1,this.sync?this._asyncDrainScheduled||(this._asyncDrainScheduled=!0,process.nextTick(_,this)):this.emit(`drain`))},this.on(`newListener`,function(e){e===`drain`&&(this._asyncDrainScheduled=!1)}),this._periodicFlush!==0&&(this._periodicFlushTimer=setInterval(()=>this.flush(null),this._periodicFlush),this._periodicFlushTimer.unref())}function g(e,t,n){return typeof e==`string`&&(e=Buffer.from(e)),t=Math.max(t-n,0),e=e.subarray(n),{writingBuf:e,len:t}}function _(e){e.listenerCount(`drain`)>0&&(e._asyncDrainScheduled=!1,e.emit(`drain`))}i(h,r);function v(e,t){return e.length===0?c:e.length===1?e[0]:Buffer.concat(e,t)}function y(e){if(this.destroyed)throw Error(`SonicBoom destroyed`);e=``+e;let t=Buffer.byteLength(e),n=this._len+t,r=this._bufs;return this.maxLength&&n>this.maxLength?(this.emit(`drop`,e),this._len<this._hwm):(r.length===0||Buffer.byteLength(r[r.length-1])+t>this.maxWrite?r.push(e):r[r.length-1]+=e,this._len=n,!this._writing&&this._len>=this.minLength&&this._actualWrite(),this._len<this._hwm)}function b(e){if(this.destroyed)throw Error(`SonicBoom destroyed`);let t=this._len+e.length,n=this._bufs,r=this._lens;return this.maxLength&&t>this.maxLength?(this.emit(`drop`,e),this._len<this._hwm):(n.length===0||r[r.length-1]+e.length>this.maxWrite?(n.push([e]),r.push(e.length)):(n[n.length-1].push(e),r[r.length-1]+=e.length),this._len=t,!this._writing&&this._len>=this.minLength&&this._actualWrite(),this._len<this._hwm)}function x(e){this._flushPending=!0;let t=()=>{if(this._fsync)this._flushPending=!1,e();else try{n.fsync(this.fd,t=>{this._flushPending=!1,e(t)})}catch(t){e(t)}this.off(`error`,r)},r=n=>{this._flushPending=!1,e(n),this.off(`drain`,t)};this.once(`drain`,t),this.once(`error`,r)}function S(e){if(e!=null&&typeof e!=`function`)throw Error(`flush cb must be a function`);if(this.destroyed){let t=Error(`SonicBoom destroyed`);if(e){e(t);return}throw t}if(this.minLength<=0){e?.();return}e&&x.call(this,e),!this._writing&&(this._bufs.length===0&&this._bufs.push(``),this._actualWrite())}function C(e){if(e!=null&&typeof e!=`function`)throw Error(`flush cb must be a function`);if(this.destroyed){let t=Error(`SonicBoom destroyed`);if(e){e(t);return}throw t}if(this.minLength<=0){e?.();return}e&&x.call(this,e),!this._writing&&(this._bufs.length===0&&(this._bufs.push([]),this._lens.push(0)),this._actualWrite())}h.prototype.reopen=function(e){if(this.destroyed)throw Error(`SonicBoom destroyed`);if(this._opening){this.once(`ready`,()=>{this.reopen(e)});return}if(this._ending)return;if(!this.file)throw Error(`Unable to reopen a file descriptor, you must pass a file to SonicBoom`);if(e&&(this.file=e),this._reopening=!0,this._writing)return;let t=this.fd;this.once(`ready`,()=>{t!==this.fd&&n.close(t,e=>{if(e)return this.emit(`error`,e)})}),m(this.file,this)},h.prototype.end=function(){if(this.destroyed)throw Error(`SonicBoom destroyed`);if(this._opening){this.once(`ready`,()=>{this.end()});return}this._ending||(this._ending=!0,!this._writing&&(this._len>0&&this.fd>=0?this._actualWrite():O(this)))};function w(){if(this.destroyed)throw Error(`SonicBoom destroyed`);if(this.fd<0)throw Error(`sonic boom is not ready yet`);!this._writing&&this._writingBuf.length>0&&(this._bufs.unshift(this._writingBuf),this._writingBuf=``);let e=``;for(;this._bufs.length||e.length;){e.length<=0&&(e=this._bufs[0]);try{let t=Buffer.isBuffer(e)?n.writeSync(this.fd,e):n.writeSync(this.fd,e,`utf8`),r=g(e,this._len,t);e=r.writingBuf,this._len=r.len,e.length<=0&&this._bufs.shift()}catch(t){if((t.code===`EAGAIN`||t.code===`EBUSY`)&&!this.retryEAGAIN(t,e.length,this._len-e.length))throw t;o(100)}}try{n.fsyncSync(this.fd)}catch{}}function T(){if(this.destroyed)throw Error(`SonicBoom destroyed`);if(this.fd<0)throw Error(`sonic boom is not ready yet`);!this._writing&&this._writingBuf.length>0&&(this._bufs.unshift([this._writingBuf]),this._writingBuf=c);let e=c;for(;this._bufs.length||e.length;){e.length<=0&&(e=v(this._bufs[0],this._lens[0]));try{let t=n.writeSync(this.fd,e);e=e.subarray(t),this._len=Math.max(this._len-t,0),e.length<=0&&(this._bufs.shift(),this._lens.shift())}catch(t){if((t.code===`EAGAIN`||t.code===`EBUSY`)&&!this.retryEAGAIN(t,e.length,this._len-e.length))throw t;o(100)}}}h.prototype.destroy=function(){this.destroyed||O(this)};function E(){let e=this.release;if(this._writing=!0,this._writingBuf=this._writingBuf.length?this._writingBuf:this._bufs.shift()||``,this.sync)try{e(null,Buffer.isBuffer(this._writingBuf)?n.writeSync(this.fd,this._writingBuf):n.writeSync(this.fd,this._writingBuf,`utf8`))}catch(t){e(t)}else n.write(this.fd,this._writingBuf,e)}function D(){let e=this.release;if(this._writing=!0,this._writingBuf=this._writingBuf.length?this._writingBuf:v(this._bufs.shift(),this._lens.shift()),this.sync)try{e(null,n.writeSync(this.fd,this._writingBuf))}catch(t){e(t)}else p&&(this._writingBuf=Buffer.from(this._writingBuf)),n.write(this.fd,this._writingBuf,e)}function O(e){if(e.fd===-1){e.once(`ready`,O.bind(null,e));return}e._periodicFlushTimer!==void 0&&clearInterval(e._periodicFlushTimer),e.destroyed=!0,e._bufs=[],e._lens=[],s(typeof e.fd==`number`,`sonic.fd must be a number, got ${typeof e.fd}`);try{n.fsync(e.fd,t)}catch{}function t(){e.fd!==1&&e.fd!==2?n.close(e.fd,r):r()}function r(t){if(t){e.emit(`error`,t);return}e._ending&&!e._writing&&e.emit(`finish`),e.emit(`close`)}}h.SonicBoom=h,h.default=h,t.exports=h})),jt=z(((e,t)=>{let n={exit:[],beforeExit:[]},r={exit:c,beforeExit:l},i;function a(){i===void 0&&(i=new FinalizationRegistry(d))}function o(e){n[e].length>0||process.on(e,r[e])}function s(e){n[e].length>0||(process.removeListener(e,r[e]),n.exit.length===0&&n.beforeExit.length===0&&(i=void 0))}function c(){u(`exit`)}function l(){u(`beforeExit`)}function u(e){for(let t of n[e]){let n=t.deref(),r=t.fn;n!==void 0&&r(n,e)}n[e]=[]}function d(e){for(let t of[`exit`,`beforeExit`]){let r=n[t].indexOf(e);n[t].splice(r,r+1),s(t)}}function f(e,t,r){if(t===void 0)throw Error(`the object can't be undefined`);o(e);let s=new WeakRef(t);s.fn=r,a(),i.register(t,s),n[e].push(s)}function p(e,t){f(`exit`,e,t)}function m(e,t){f(`beforeExit`,e,t)}function h(e){if(i!==void 0){i.unregister(e);for(let t of[`exit`,`beforeExit`])n[t]=n[t].filter(t=>{let n=t.deref();return n&&n!==e}),s(t)}}t.exports={register:p,registerBeforeExit:m,unregister:h}})),Mt=z(((e,t)=>{t.exports={name:`thread-stream`,version:`4.0.0`,description:`A streaming way to send data to a Node.js Worker Thread`,main:`index.js`,types:`index.d.ts`,engines:{node:`>=20`},dependencies:{"real-require":`^0.2.0`},devDependencies:{"@types/node":`^22.0.0`,"@yao-pkg/pkg":`^6.0.0`,borp:`^0.21.0`,desm:`^1.3.0`,eslint:`^9.39.1`,fastbench:`^1.0.1`,husky:`^9.0.6`,neostandard:`^0.12.2`,"pino-elasticsearch":`^8.0.0`,"sonic-boom":`^4.0.1`,"ts-node":`^10.8.0`,typescript:`~5.7.3`},scripts:{build:`tsc --noEmit`,lint:`eslint`,test:`npm run lint && npm run build && npm run transpile && borp --pattern 'test/*.test.{js,mjs}'`,"test:ci":`npm run lint && npm run transpile && borp --pattern 'test/*.test.{js,mjs}'`,"test:yarn":`npm run transpile && borp --pattern 'test/*.test.js'`,transpile:`sh ./test/ts/transpile.sh`,prepare:`husky install`},repository:{type:`git`,url:`git+https://github.com/mcollina/thread-stream.git`},keywords:[`worker`,`thread`,`threads`,`stream`],author:`Matteo Collina <hello@matteocollina.com>`,license:`MIT`,bugs:{url:`https://github.com/mcollina/thread-stream/issues`},homepage:`https://github.com/mcollina/thread-stream#readme`}})),Nt=z(((e,t)=>{let n=1e4;function r(e,t,r,i,a){let o=i===1/0?1/0:Date.now()+i,s=()=>{let i=Atomics.load(e,t);if(i===r){a(null,`ok`);return}if(o!==1/0&&Date.now()>o){a(null,`timed-out`);return}let c=o===1/0?n:Math.min(n,Math.max(1,o-Date.now())),l=Atomics.waitAsync(e,t,i,c);l.async?l.value.then(s):setImmediate(s)};s()}function i(e,t,r,i,a){let o=i===1/0?1/0:Date.now()+i,s=()=>{if(Atomics.load(e,t)!==r){a(null,`ok`);return}if(o!==1/0&&Date.now()>o){a(null,`timed-out`);return}let i=o===1/0?n:Math.min(n,Math.max(1,o-Date.now())),c=Atomics.waitAsync(e,t,r,i);c.async?c.value.then(s):setImmediate(s)};s()}t.exports={wait:r,waitDiff:i}})),Pt=z(((e,t)=>{t.exports={WRITE_INDEX:4,READ_INDEX:8}})),Ft=z(((e,t)=>{let{version:n}=Mt(),{EventEmitter:r}=B(`events`),{Worker:i}=B(`worker_threads`),{join:a}=B(`path`),{pathToFileURL:o}=B(`url`),{wait:s}=Nt(),{WRITE_INDEX:c,READ_INDEX:l}=Pt(),u=B(`buffer`),d=B(`assert`),f=Symbol(`kImpl`),p=u.constants.MAX_STRING_LENGTH;var m=class{constructor(e){this._value=e}deref(){return this._value}},h=class{register(){}unregister(){}};let g=process.env.NODE_V8_COVERAGE?h:global.FinalizationRegistry||h,_=process.env.NODE_V8_COVERAGE?m:global.WeakRef||m,v=new g(e=>{e.exited||e.terminate()});function y(e,t){let{filename:r,workerData:s}=t,c=new i((`__bundlerPathsOverrides`in globalThis?globalThis.__bundlerPathsOverrides:{})[`thread-stream-worker`]||a(__dirname,`lib`,`worker.js`),{...t.workerOpts,trackUnmanagedFds:!1,workerData:{filename:r.indexOf(`file://`)===0?r:o(r).href,dataBuf:e[f].dataBuf,stateBuf:e[f].stateBuf,workerData:{$context:{threadStreamVersion:n},...s}}});return c.stream=new m(e),c.on(`message`,S),c.on(`exit`,C),v.register(e,c),c}function b(e){d(!e[f].sync),e[f].needDrain&&(e[f].needDrain=!1,e.emit(`drain`))}function x(e){let t=Atomics.load(e[f].state,c),n=e[f].data.length-t;if(n>0){if(e[f].buf.length===0){e[f].flushing=!1,e[f].ending?O(e):e[f].needDrain&&process.nextTick(b,e);return}let t=e[f].buf.slice(0,n),r=Buffer.byteLength(t);r<=n?(e[f].buf=e[f].buf.slice(n),D(e,t,x.bind(null,e))):e.flush(()=>{if(!e.destroyed){for(Atomics.store(e[f].state,l,0),Atomics.store(e[f].state,c,0),Atomics.notify(e[f].state,l);r>e[f].data.length;)n/=2,t=e[f].buf.slice(0,n),r=Buffer.byteLength(t);e[f].buf=e[f].buf.slice(n),D(e,t,x.bind(null,e))}})}else if(n===0){if(t===0&&e[f].buf.length===0)return;e.flush(()=>{Atomics.store(e[f].state,l,0),Atomics.store(e[f].state,c,0),Atomics.notify(e[f].state,l),x(e)})}else E(e,Error(`overwritten`))}function S(e){let t=this.stream.deref();if(t===void 0){this.exited=!0,this.terminate();return}switch(e.code){case`READY`:this.stream=new _(t),t.flush(()=>{t[f].ready=!0,t.emit(`ready`)});break;case`ERROR`:E(t,e.err);break;case`EVENT`:Array.isArray(e.args)?t.emit(e.name,...e.args):t.emit(e.name,e.args);break;case`WARNING`:process.emitWarning(e.err);break;default:E(t,Error(`this should not happen: `+e.code))}}function C(e){let t=this.stream.deref();t!==void 0&&(v.unregister(t),t.worker.exited=!0,t.worker.off(`exit`,C),E(t,e===0?null:Error(`the worker thread exited`)))}var w=class extends r{constructor(e={}){if(super(),e.bufferSize<4)throw Error(`bufferSize must at least fit a 4-byte utf-8 char`);this[f]={},this[f].stateBuf=new SharedArrayBuffer(128),this[f].state=new Int32Array(this[f].stateBuf),this[f].dataBuf=new SharedArrayBuffer(e.bufferSize||4*1024*1024),this[f].data=Buffer.from(this[f].dataBuf),this[f].sync=e.sync||!1,this[f].ending=!1,this[f].ended=!1,this[f].needDrain=!1,this[f].destroyed=!1,this[f].flushing=!1,this[f].ready=!1,this[f].finished=!1,this[f].errored=null,this[f].closed=!1,this[f].buf=``,this.worker=y(this,e),this.on(`message`,(e,t)=>{this.worker.postMessage(e,t)})}write(e){if(this[f].destroyed)return T(this,Error(`the worker has exited`)),!1;if(this[f].ending)return T(this,Error(`the worker is ending`)),!1;if(this[f].flushing&&this[f].buf.length+e.length>=p)try{k(this),this[f].flushing=!0}catch(e){return E(this,e),!1}if(this[f].buf+=e,this[f].sync)try{return k(this),!0}catch(e){return E(this,e),!1}return this[f].flushing||(this[f].flushing=!0,setImmediate(x,this)),this[f].needDrain=this[f].data.length-this[f].buf.length-Atomics.load(this[f].state,c)<=0,!this[f].needDrain}end(){this[f].destroyed||(this[f].ending=!0,O(this))}flush(e){if(this[f].destroyed){typeof e==`function`&&process.nextTick(e,Error(`the worker has exited`));return}let t=Atomics.load(this[f].state,c);s(this[f].state,l,t,1/0,(t,n)=>{if(t){E(this,t),process.nextTick(e,t);return}if(n===`not-equal`){this.flush(e);return}process.nextTick(e)})}flushSync(){this[f].destroyed||(k(this),A(this))}unref(){this.worker.unref()}ref(){this.worker.ref()}get ready(){return this[f].ready}get destroyed(){return this[f].destroyed}get closed(){return this[f].closed}get writable(){return!this[f].destroyed&&!this[f].ending}get writableEnded(){return this[f].ending}get writableFinished(){return this[f].finished}get writableNeedDrain(){return this[f].needDrain}get writableObjectMode(){return!1}get writableErrored(){return this[f].errored}};function T(e,t){setImmediate(()=>{e.emit(`error`,t)})}function E(e,t){e[f].destroyed||(e[f].destroyed=!0,t&&(e[f].errored=t,T(e,t)),e.worker.exited?setImmediate(()=>{e[f].closed=!0,e.emit(`close`)}):e.worker.terminate().catch(()=>{}).then(()=>{e[f].closed=!0,e.emit(`close`)}))}function D(e,t,n){let r=Atomics.load(e[f].state,c),i=Buffer.byteLength(t);return e[f].data.write(t,r),Atomics.store(e[f].state,c,r+i),Atomics.notify(e[f].state,c),n(),!0}function O(e){if(!(e[f].ended||!e[f].ending||e[f].flushing)){e[f].ended=!0;try{e.flushSync();let t=Atomics.load(e[f].state,l);Atomics.store(e[f].state,c,-1),Atomics.notify(e[f].state,c);let n=0;for(;t!==-1;){if(Atomics.wait(e[f].state,l,t,1e3),t=Atomics.load(e[f].state,l),t===-2){E(e,Error(`end() failed`));return}if(++n===10){E(e,Error(`end() took too long (10s)`));return}}process.nextTick(()=>{e[f].finished=!0,e.emit(`finish`)})}catch(t){E(e,t)}}}function k(e){let t=()=>{e[f].ending?O(e):e[f].needDrain&&process.nextTick(b,e)};for(e[f].flushing=!1;e[f].buf.length!==0;){let n=Atomics.load(e[f].state,c),r=e[f].data.length-n;if(r===0){A(e),Atomics.store(e[f].state,l,0),Atomics.store(e[f].state,c,0),Atomics.notify(e[f].state,l);continue}else if(r<0)throw Error(`overwritten`);let i=e[f].buf.slice(0,r),a=Buffer.byteLength(i);if(a<=r)e[f].buf=e[f].buf.slice(r),D(e,i,t);else{for(A(e),Atomics.store(e[f].state,l,0),Atomics.store(e[f].state,c,0),Atomics.notify(e[f].state,l);a>e[f].buf.length;)r/=2,i=e[f].buf.slice(0,r),a=Buffer.byteLength(i);e[f].buf=e[f].buf.slice(r),D(e,i,t)}}}function A(e){if(e[f].flushing)throw Error(`unable to flush while flushing`);let t=Atomics.load(e[f].state,c),n=0;for(;;){let r=Atomics.load(e[f].state,l);if(r===-2)throw Error(`_flushSync failed`);if(r!==t)Atomics.wait(e[f].state,l,r,1e3);else break;if(++n===10)throw Error(`_flushSync took too long (10s)`)}}t.exports=w})),It=z(((e,t)=>{let{createRequire:n}=B(`module`),{existsSync:r}=B(`node:fs`),i=Ct(),{join:a,isAbsolute:o,sep:s}=B(`node:path`),{fileURLToPath:c}=B(`node:url`),l=kt(),u=jt(),d=Ft();function f(e){u.register(e,v),u.registerBeforeExit(e,y),e.on(`close`,function(){u.unregister(e)})}function p(){let e=process.execArgv;for(let t=0;t<e.length;t++){let n=e[t];if(n===`--import`||n===`--require`||n===`-r`||n.startsWith(`--import=`)||n.startsWith(`--require=`)||n.startsWith(`-r=`))return!0}return!1}function m(e){let t=e.match(/(?:[^\s"']+|"[^"]*"|'[^']*')+/g);if(!t)return e;let n=[],r=!1;for(let e=0;e<t.length;e++){let i=t[e];if(i===`--require`||i===`-r`||i===`--import`){let a=t[e+1];if(a&&h(a)){r=!0,e++;continue}n.push(i),a&&(n.push(a),e++);continue}if((i.startsWith(`--require=`)||i.startsWith(`-r=`)||i.startsWith(`--import=`))&&h(i.slice(i.indexOf(`=`)+1))){r=!0;continue}n.push(i)}return r?n.join(` `):e}function h(e){let t=g(e);if(!t)return!1;let n=t;if(n.startsWith(`file://`))try{n=c(n)}catch{return!1}return o(n)&&!r(n)}function g(e){let t=e[0],n=e[e.length-1];return t===`"`&&n===`"`||t===`'`&&n===`'`?e.slice(1,-1):e}function _(e,t,n,r,i){if(!n.execArgv&&p()&&B.main===void 0&&(n={...n,execArgv:[]}),!n.env&&process.env.NODE_OPTIONS){let e=m(process.env.NODE_OPTIONS);e!==process.env.NODE_OPTIONS&&(n={...n,env:{...process.env,NODE_OPTIONS:e}})}n={...n,name:i};let a=new d({filename:e,workerData:t,workerOpts:n,sync:r});a.on(`ready`,o),a.on(`close`,function(){process.removeListener(`exit`,s)}),process.on(`exit`,s);function o(){process.removeListener(`exit`,s),a.unref(),n.autoEnd!==!1&&f(a)}function s(){a.closed||(a.flushSync(),l(100),a.end())}return a}function v(e){e.ref(),e.flushSync(),e.end(),e.once(`close`,function(){e.unref()})}function y(e){e.flushSync()}function b(e){let{pipeline:t,targets:r,levels:c,dedupe:l,worker:u={},caller:d=i(),sync:f=!1}=e,p={...e.options},m=typeof d==`string`?[d]:d,h=typeof globalThis==`object`&&Object.prototype.hasOwnProperty.call(globalThis,`__bundlerPathsOverrides`)&&globalThis.__bundlerPathsOverrides&&typeof globalThis.__bundlerPathsOverrides==`object`?globalThis.__bundlerPathsOverrides:Object.create(null),g=e.target;if(g&&r)throw Error(`only one of target or targets can be specified`);r?(g=h[`pino-worker`]||a(__dirname,`worker.js`),p.targets=r.filter(e=>e.target).map(e=>({...e,target:y(e.target)})),p.pipelines=r.filter(e=>e.pipeline).map(e=>e.pipeline.map(t=>({...t,level:e.level,target:y(t.target)})))):t&&(g=h[`pino-worker`]||a(__dirname,`worker.js`),p.pipelines=[t.map(e=>({...e,target:y(e.target)}))]),c&&(p.levels=c),l&&(p.dedupe=l),p.pinoWillSendConfig=!0;let v=r||t?`pino.transport`:g;return _(y(g),p,u,f,v);function y(e){if(e=h[e]||e,o(e)||e.indexOf(`file://`)===0)return e;if(e===`pino/file`)return a(__dirname,`..`,`file.js`);let t;for(let r of m)try{t=n(r===`node:repl`?process.cwd()+s:r).resolve(e);break}catch{continue}if(!t)throw Error(`unable to determine transport target for "${e}"`);return t}}t.exports=b})),Lt=z(((e,t)=>{let n=B(`node:diagnostics_channel`),r=Ot(),{mapHttpRequest:i,mapHttpResponse:a}=St(),o=At(),s=jt(),{lsCacheSym:c,chindingsSym:l,writeSym:u,serializersSym:d,formatOptsSym:f,endSym:p,stringifiersSym:m,stringifySym:h,stringifySafeSym:g,wildcardFirstSym:_,nestedKeySym:v,formattersSym:y,messageKeySym:b,errorKeySym:x,nestedKeyStrSym:S,msgPrefixSym:C}=Tt(),{isMainThread:w}=B(`worker_threads`),T=It(),[E]=process.versions.node.split(`.`).map(e=>Number(e)),D=n.tracingChannel(`pino_asJson`),O=E>=25?e=>JSON.stringify(e):j;function k(){}function A(e,t){if(!t)return n;return function(...r){t.call(this,r,n,e)};function n(t,...n){if(typeof t==`object`){let o=t;t!==null&&(t.method&&t.headers&&t.socket?t=i(t):typeof t.setHeader==`function`&&(t=a(t)));let s;o===null&&n.length===0?s=[null]:(o=n.shift(),s=n),typeof this[C]==`string`&&o!=null&&(o=this[C]+o),this[u](t,r(o,s,this[f]),e)}else{let i=t===void 0?n.shift():t;typeof this[C]==`string`&&i!=null&&(i=this[C]+i),this[u](null,r(i,n,this[f]),e)}}}function j(e){let t=``,n=0,r=!1,i=255,a=e.length;if(a>100)return JSON.stringify(e);for(var o=0;o<a&&i>=32;o++)i=e.charCodeAt(o),(i===34||i===92)&&(t+=e.slice(n,o)+`\\`,n=o,r=!0);return r?t+=e.slice(n):t=e,i<32?JSON.stringify(e):`"`+t+`"`}function M(e,t,n,r){if(D.hasSubscribers===!1)return N.call(this,e,t,n,r);let i={instance:this,arguments};return D.traceSync(N,i,this,e,t,n,r)}function N(e,t,n,r){let i=this[h],a=this[g],o=this[m],s=this[p],u=this[l],f=this[d],C=this[y],w=this[b],T=this[x],E=this[c][n]+r;E+=u;let D;C.log&&(e=C.log(e));let k=o[_],A=``;for(let t in e)if(D=e[t],Object.prototype.hasOwnProperty.call(e,t)&&D!==void 0){f[t]?D=f[t](D):t===T&&f.err&&(D=f.err(D));let e=o[t]||k;switch(typeof D){case`undefined`:case`function`:continue;case`number`:Number.isFinite(D)===!1&&(D=null);case`boolean`:e&&(D=e(D));break;case`string`:D=(e||O)(D);break;default:D=(e||i)(D,a)}if(D===void 0)continue;let n=O(t);A+=`,`+n+`:`+D}let j=``;if(t!==void 0){D=f[w]?f[w](t):t;let e=o[w]||k;switch(typeof D){case`function`:break;case`number`:Number.isFinite(D)===!1&&(D=null);case`boolean`:e&&(D=e(D)),j=`,"`+w+`":`+D;break;case`string`:D=(e||O)(D),j=`,"`+w+`":`+D;break;default:D=(e||i)(D,a),j=`,"`+w+`":`+D}}return this[v]&&A?E+this[S]+A.slice(1)+`}`+j+s:E+A+j+s}function P(e,t){let n,r=e[l],i=e[h],a=e[g],o=e[m],s=o[_],c=e[d],u=e[y].bindings;t=u(t);for(let e in t)if(n=t[e],((e.length<5||e!==`level`&&e!==`serializers`&&e!==`formatters`&&e!==`customLevels`)&&t.hasOwnProperty(e)&&n!==void 0)===!0){if(n=c[e]?c[e](n):n,n=(o[e]||s||i)(n,a),n===void 0)continue;r+=`,"`+e+`":`+n}return r}function ee(e){return e.write!==e.constructor.prototype.write}function F(e){let t=new o(e);return t.on(`error`,n),!e.sync&&w&&(s.register(t,I),t.on(`close`,function(){s.unregister(t)})),t;function n(e){if(e.code===`EPIPE`){t.write=k,t.end=k,t.flushSync=k,t.destroy=k;return}t.removeListener(`error`,n),t.emit(`error`,e)}}function I(e,t){e.destroyed||(t===`beforeExit`?(e.flush(),e.on(`drain`,function(){e.end()})):e.flushSync())}function te(e){return function(t,n,r={},i){if(typeof r==`string`)i=F({dest:r}),r={};else if(typeof i==`string`){if(r&&r.transport)throw Error(`only one of option.transport or stream can be specified`);i=F({dest:i})}else if(r instanceof o||r.writable||r._writableState)i=r,r={};else if(r.transport){if(r.transport instanceof o||r.transport.writable||r.transport._writableState)throw Error(`option.transport do not allow stream, please pass to option directly. e.g. pino(transport)`);if(r.transport.targets&&r.transport.targets.length&&r.formatters&&typeof r.formatters.level==`function`)throw Error(`option.transport.targets do not allow custom level formatters`);let e;r.customLevels&&(e=r.useOnlyCustomLevels?r.customLevels:Object.assign({},r.levels,r.customLevels)),i=T({caller:n,...r.transport,levels:e})}if(r=Object.assign({},e,r),r.serializers=Object.assign({},e.serializers,r.serializers),r.formatters=Object.assign({},e.formatters,r.formatters),r.prettyPrint)throw Error(`prettyPrint option is no longer supported, see the pino-pretty package (https://github.com/pinojs/pino-pretty)`);let{enabled:a,onChild:s}=r;return a===!1&&(r.level=`silent`),s||(r.onChild=k),i||=ee(process.stdout)?process.stdout:F({fd:process.stdout.fd||1}),{opts:r,stream:i}}}function L(e,t){try{return JSON.stringify(e)}catch{try{return(t||this[g])(e)}catch{return`"[unable to serialize, circular reference is too complex to analyze]"`}}}function ne(e,t,n){return{level:e,bindings:t,log:n}}function re(e){let t=Number(e);return typeof e==`string`&&Number.isFinite(t)?t:e===void 0?1:e}t.exports={noop:k,buildSafeSonicBoom:F,asChindings:P,asJson:M,genLog:A,createArgsNormalizer:te,stringify:L,buildFormatters:ne,normalizeDestFileDescriptor:re}})),Rt=z(((e,t)=>{t.exports={DEFAULT_LEVELS:{trace:10,debug:20,info:30,warn:40,error:50,fatal:60},SORTING_ORDER:{ASC:`ASC`,DESC:`DESC`}}})),zt=z(((e,t)=>{let{lsCacheSym:n,levelValSym:r,useOnlyCustomLevelsSym:i,streamSym:a,formattersSym:o,hooksSym:s,levelCompSym:c}=Tt(),{noop:l,genLog:u}=Lt(),{DEFAULT_LEVELS:d,SORTING_ORDER:f}=Rt(),p={fatal:e=>{let t=u(d.fatal,e);return function(...e){let n=this[a];if(t.call(this,...e),typeof n.flushSync==`function`)try{n.flushSync()}catch{}}},error:e=>u(d.error,e),warn:e=>u(d.warn,e),info:e=>u(d.info,e),debug:e=>u(d.debug,e),trace:e=>u(d.trace,e)},m=Object.keys(d).reduce((e,t)=>(e[d[t]]=t,e),{}),h=Object.keys(m).reduce((e,t)=>(e[t]=`{"level":`+Number(t),e),{});function g(e){let t=e[o].level,{labels:r}=e.levels,i={};for(let e in r){let n=t(r[e],Number(e));i[e]=JSON.stringify(n).slice(0,-1)}return e[n]=i,e}function _(e,t){if(t)return!1;switch(e){case`fatal`:case`error`:case`warn`:case`info`:case`debug`:case`trace`:return!0;default:return!1}}function v(e){let{labels:t,values:n}=this.levels;if(typeof e==`number`){if(t[e]===void 0)throw Error(`unknown level value`+e);e=t[e]}if(n[e]===void 0)throw Error(`unknown level `+e);let a=this[r],o=this[r]=n[e],d=this[i],f=this[c],m=this[s].logMethod;for(let e in n){if(f(n[e],o)===!1){this[e]=l;continue}this[e]=_(e,d)?p[e](m):u(n[e],m)}this.emit(`level-change`,e,o,t[a],a,this)}function y(e){let{levels:t,levelVal:n}=this;return t&&t.labels?t.labels[n]:``}function b(e){let{values:t}=this.levels,n=t[e];return n!==void 0&&this[c](n,this[r])}function x(e,t,n){return e===f.DESC?t<=n:t>=n}function S(e){return typeof e==`string`?x.bind(null,e):e}function C(e=null,t=!1){let n=e?Object.keys(e).reduce((t,n)=>(t[e[n]]=n,t),{}):null;return{labels:Object.assign(Object.create(Object.prototype,{Infinity:{value:`silent`}}),t?null:m,n),values:Object.assign(Object.create(Object.prototype,{silent:{value:1/0}}),t?null:d,e)}}function w(e,t,n){if(typeof e==`number`){if(![].concat(Object.keys(t||{}).map(e=>t[e]),n?[]:Object.keys(m).map(e=>+e),1/0).includes(e))throw Error(`default level:${e} must be included in custom levels`);return}if(!(e in Object.assign(Object.create(Object.prototype,{silent:{value:1/0}}),n?null:d,t)))throw Error(`default level:${e} must be included in custom levels`)}function T(e,t){let{labels:n,values:r}=e;for(let e in t){if(e in r)throw Error(`levels cannot be overridden`);if(t[e]in n)throw Error(`pre-existing level values cannot be used for new levels`)}}function E(e){if(typeof e!=`function`&&!(typeof e==`string`&&Object.values(f).includes(e)))throw Error(`Levels comparison should be one of "ASC", "DESC" or "function" type`)}t.exports={initialLsCache:h,genLsCache:g,levelMethods:p,getLevel:y,setLevel:v,isLevelEnabled:b,mappings:C,assertNoLevelCollisions:T,assertDefaultLevelFound:w,genLevelComparison:S,assertLevelComparison:E}})),Bt=z(((e,t)=>{t.exports={version:`10.3.1`}})),Vt=z(((e,t)=>{let{EventEmitter:n}=B(`node:events`),{lsCacheSym:r,levelValSym:i,setLevelSym:a,getLevelSym:o,chindingsSym:s,mixinSym:c,asJsonSym:l,writeSym:u,mixinMergeStrategySym:d,timeSym:f,timeSliceIndexSym:p,streamSym:m,serializersSym:h,formattersSym:g,errorKeySym:_,messageKeySym:v,useOnlyCustomLevelsSym:y,needsMetadataGsym:b,redactFmtSym:x,stringifySym:S,formatOptsSym:C,stringifiersSym:w,msgPrefixSym:T,hooksSym:E}=Tt(),{getLevel:D,setLevel:O,isLevelEnabled:k,mappings:A,initialLsCache:j,genLsCache:M,assertNoLevelCollisions:N}=zt(),{asChindings:P,asJson:ee,buildFormatters:F,stringify:I,noop:te}=Lt(),{version:L}=Bt(),ne=Et(),re={constructor:class{},child:ae,bindings:oe,setBindings:R,flush:ce,isLevelEnabled:k,version:L,get level(){return this[o]()},set level(e){this[a](e)},get levelVal(){return this[i]},set levelVal(e){throw Error(`levelVal is read-only`)},get msgPrefix(){return this[T]},get[Symbol.toStringTag](){return`Pino`},[r]:j,[u]:se,[l]:ee,[o]:D,[a]:O};Object.setPrototypeOf(re,n.prototype),t.exports=function(){return Object.create(re)};let ie=e=>e;function ae(e,t){if(!e)throw Error(`missing bindings for child Pino`);let n=this[h],r=this[g],i=Object.create(this);if(t==null)return i[g].bindings!==ie&&(i[g]=F(r.level,ie,r.log)),i[s]=P(i,e),this.onChild!==te&&this.onChild(i),i;if(t.hasOwnProperty(`serializers`)===!0){i[h]=Object.create(null);for(let e in n)i[h][e]=n[e];let e=Object.getOwnPropertySymbols(n);for(var o=0;o<e.length;o++){let t=e[o];i[h][t]=n[t]}for(let e in t.serializers)i[h][e]=t.serializers[e];let r=Object.getOwnPropertySymbols(t.serializers);for(var c=0;c<r.length;c++){let e=r[c];i[h][e]=t.serializers[e]}}else i[h]=n;if(t.hasOwnProperty(`formatters`)){let{level:e,bindings:n,log:a}=t.formatters;i[g]=F(e||r.level,n||ie,a||r.log)}else i[g]=F(r.level,ie,r.log);if(t.hasOwnProperty(`customLevels`)===!0&&(N(this.levels,t.customLevels),i.levels=A(t.customLevels,i[y]),M(i)),typeof t.redact==`object`&&t.redact!==null||Array.isArray(t.redact)){i.redact=t.redact;let e=ne(i.redact,I),n={stringify:e[x]};i[S]=I,i[w]=e,i[C]=n}if(typeof t.msgPrefix==`string`&&(i[T]=(this[T]||``)+t.msgPrefix),i[s]=P(i,e),t.level!==void 0&&t.level!==this.level||t.hasOwnProperty(`customLevels`)){let e=t.level||this.level;i[a](e)}return this.onChild(i),i}function oe(){let e=`{${this[s].substr(1)}}`,t=JSON.parse(e);return delete t.pid,delete t.hostname,t}function R(e){let t=P(this,e);this[s]=t}function z(e,t){return Object.assign(t,e)}function se(e,t,n){let r=this[f](),i=this[c],a=this[_],o=this[v],s=this[d]||z,u,h=this[E].streamWrite;e==null?u={}:e instanceof Error?(u={[a]:e},t===void 0&&(t=e.message)):(u=e,t===void 0&&e[o]===void 0&&e[a]&&(t=e[a].message)),i&&(u=s(u,i(u,n,this)));let g=this[l](u,t,n,r),y=this[m];y[b]===!0&&(y.lastLevel=n,y.lastObj=u,y.lastMsg=t,y.lastTime=r.slice(this[p]),y.lastLogger=this),y.write(h?h(g):g)}function ce(e){if(e!=null&&typeof e!=`function`)throw Error(`callback must be a function`);let t=this[m];typeof t.flush==`function`?t.flush(e||te):e&&e()}})),Ht=z(((e,t)=>{let{hasOwnProperty:n}=Object.prototype,r=_();r.configure=_,r.stringify=r,r.default=r,e.stringify=r,e.configure=_,t.exports=r;let i=/[\u0000-\u001f\u0022\u005c\ud800-\udfff]/;function a(e){return e.length<5e3&&!i.test(e)?`"${e}"`:JSON.stringify(e)}function o(e,t){if(e.length>200||t)return e.sort(t);for(let t=1;t<e.length;t++){let n=e[t],r=t;for(;r!==0&&e[r-1]>n;)e[r]=e[r-1],r--;e[r]=n}return e}let s=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Object.getPrototypeOf(new Int8Array)),Symbol.toStringTag).get;function c(e){return s.call(e)!==void 0&&e.length!==0}function l(e,t,n){e.length<n&&(n=e.length);let r=t===`,`?``:` `,i=`"0":${r}${e[0]}`;for(let a=1;a<n;a++)i+=`${t}"${a}":${r}${e[a]}`;return i}function u(e){if(n.call(e,`circularValue`)){let t=e.circularValue;if(typeof t==`string`)return`"${t}"`;if(t==null)return t;if(t===Error||t===TypeError)return{toString(){throw TypeError(`Converting circular structure to JSON`)}};throw TypeError(`The "circularValue" argument must be of type string or the value null or undefined`)}return`"[Circular]"`}function d(e){let t;if(n.call(e,`deterministic`)&&(t=e.deterministic,typeof t!=`boolean`&&typeof t!=`function`))throw TypeError(`The "deterministic" argument must be of type boolean or comparator function`);return t===void 0?!0:t}function f(e,t){let r;if(n.call(e,t)&&(r=e[t],typeof r!=`boolean`))throw TypeError(`The "${t}" argument must be of type boolean`);return r===void 0?!0:r}function p(e,t){let r;if(n.call(e,t)){if(r=e[t],typeof r!=`number`)throw TypeError(`The "${t}" argument must be of type number`);if(!Number.isInteger(r))throw TypeError(`The "${t}" argument must be an integer`);if(r<1)throw RangeError(`The "${t}" argument must be >= 1`)}return r===void 0?1/0:r}function m(e){return e===1?`1 item`:`${e} items`}function h(e){let t=new Set;for(let n of e)(typeof n==`string`||typeof n==`number`)&&t.add(String(n));return t}function g(e){if(n.call(e,`strict`)){let t=e.strict;if(typeof t!=`boolean`)throw TypeError(`The "strict" argument must be of type boolean`);if(t)return e=>{let t=`Object can not safely be stringified. Received type ${typeof e}`;throw typeof e!=`function`&&(t+=` (${e.toString()})`),Error(t)}}}function _(e){e={...e};let t=g(e);t&&(e.bigint===void 0&&(e.bigint=!1),`circularValue`in e||(e.circularValue=Error));let n=u(e),r=f(e,`bigint`),i=d(e),s=typeof i==`function`?i:void 0,_=p(e,`maximumDepth`),v=p(e,`maximumBreadth`);function y(e,l,u,d,f,p){let h=l[e];switch(typeof h==`object`&&h&&typeof h.toJSON==`function`&&(h=h.toJSON(e)),h=d.call(l,e,h),typeof h){case`string`:return a(h);case`object`:{if(h===null)return`null`;if(u.indexOf(h)!==-1)return n;let e=``,t=`,`,r=p;if(Array.isArray(h)){if(h.length===0)return`[]`;if(_<u.length+1)return`"[Array]"`;u.push(h),f!==``&&(p+=f,e+=`\n${p}`,t=`,\n${p}`);let n=Math.min(h.length,v),i=0;for(;i<n-1;i++){let n=y(String(i),h,u,d,f,p);e+=n===void 0?`null`:n,e+=t}let a=y(String(i),h,u,d,f,p);if(e+=a===void 0?`null`:a,h.length-1>v){let n=h.length-v-1;e+=`${t}"... ${m(n)} not stringified"`}return f!==``&&(e+=`\n${r}`),u.pop(),`[${e}]`}let l=Object.keys(h),g=l.length;if(g===0)return`{}`;if(_<u.length+1)return`"[Object]"`;let b=``,x=``;f!==``&&(p+=f,t=`,\n${p}`,b=` `);let S=Math.min(g,v);i&&!c(h)&&(l=o(l,s)),u.push(h);for(let n=0;n<S;n++){let r=l[n],i=y(r,h,u,d,f,p);i!==void 0&&(e+=`${x}${a(r)}:${b}${i}`,x=t)}if(g>v){let n=g-v;e+=`${x}"...":${b}"${m(n)} not stringified"`,x=t}return f!==``&&x.length>1&&(e=`\n${p}${e}\n${r}`),u.pop(),`{${e}}`}case`number`:return isFinite(h)?String(h):t?t(h):`null`;case`boolean`:return h===!0?`true`:`false`;case`undefined`:return;case`bigint`:if(r)return String(h);default:return t?t(h):void 0}}function b(e,i,o,s,c,l){switch(typeof i==`object`&&i&&typeof i.toJSON==`function`&&(i=i.toJSON(e)),typeof i){case`string`:return a(i);case`object`:{if(i===null)return`null`;if(o.indexOf(i)!==-1)return n;let e=l,t=``,r=`,`;if(Array.isArray(i)){if(i.length===0)return`[]`;if(_<o.length+1)return`"[Array]"`;o.push(i),c!==``&&(l+=c,t+=`\n${l}`,r=`,\n${l}`);let n=Math.min(i.length,v),a=0;for(;a<n-1;a++){let e=b(String(a),i[a],o,s,c,l);t+=e===void 0?`null`:e,t+=r}let u=b(String(a),i[a],o,s,c,l);if(t+=u===void 0?`null`:u,i.length-1>v){let e=i.length-v-1;t+=`${r}"... ${m(e)} not stringified"`}return c!==``&&(t+=`\n${e}`),o.pop(),`[${t}]`}o.push(i);let u=``;c!==``&&(l+=c,r=`,\n${l}`,u=` `);let d=``;for(let e of s){let n=b(e,i[e],o,s,c,l);n!==void 0&&(t+=`${d}${a(e)}:${u}${n}`,d=r)}return c!==``&&d.length>1&&(t=`\n${l}${t}\n${e}`),o.pop(),`{${t}}`}case`number`:return isFinite(i)?String(i):t?t(i):`null`;case`boolean`:return i===!0?`true`:`false`;case`undefined`:return;case`bigint`:if(r)return String(i);default:return t?t(i):void 0}}function x(e,u,d,f,p){switch(typeof u){case`string`:return a(u);case`object`:{if(u===null)return`null`;if(typeof u.toJSON==`function`){if(u=u.toJSON(e),typeof u!=`object`)return x(e,u,d,f,p);if(u===null)return`null`}if(d.indexOf(u)!==-1)return n;let t=p;if(Array.isArray(u)){if(u.length===0)return`[]`;if(_<d.length+1)return`"[Array]"`;d.push(u),p+=f;let e=`\n${p}`,n=`,\n${p}`,r=Math.min(u.length,v),i=0;for(;i<r-1;i++){let t=x(String(i),u[i],d,f,p);e+=t===void 0?`null`:t,e+=n}let a=x(String(i),u[i],d,f,p);if(e+=a===void 0?`null`:a,u.length-1>v){let t=u.length-v-1;e+=`${n}"... ${m(t)} not stringified"`}return e+=`\n${t}`,d.pop(),`[${e}]`}let r=Object.keys(u),h=r.length;if(h===0)return`{}`;if(_<d.length+1)return`"[Object]"`;p+=f;let g=`,\n${p}`,y=``,b=``,S=Math.min(h,v);c(u)&&(y+=l(u,g,v),r=r.slice(u.length),S-=u.length,b=g),i&&(r=o(r,s)),d.push(u);for(let e=0;e<S;e++){let t=r[e],n=x(t,u[t],d,f,p);n!==void 0&&(y+=`${b}${a(t)}: ${n}`,b=g)}if(h>v){let e=h-v;y+=`${b}"...": "${m(e)} not stringified"`,b=g}return b!==``&&(y=`\n${p}${y}\n${t}`),d.pop(),`{${y}}`}case`number`:return isFinite(u)?String(u):t?t(u):`null`;case`boolean`:return u===!0?`true`:`false`;case`undefined`:return;case`bigint`:if(r)return String(u);default:return t?t(u):void 0}}function S(e,u,d){switch(typeof u){case`string`:return a(u);case`object`:{if(u===null)return`null`;if(typeof u.toJSON==`function`){if(u=u.toJSON(e),typeof u!=`object`)return S(e,u,d);if(u===null)return`null`}if(d.indexOf(u)!==-1)return n;let t=``,r=u.length!==void 0;if(r&&Array.isArray(u)){if(u.length===0)return`[]`;if(_<d.length+1)return`"[Array]"`;d.push(u);let e=Math.min(u.length,v),n=0;for(;n<e-1;n++){let e=S(String(n),u[n],d);t+=e===void 0?`null`:e,t+=`,`}let r=S(String(n),u[n],d);if(t+=r===void 0?`null`:r,u.length-1>v){let e=u.length-v-1;t+=`,"... ${m(e)} not stringified"`}return d.pop(),`[${t}]`}let f=Object.keys(u),p=f.length;if(p===0)return`{}`;if(_<d.length+1)return`"[Object]"`;let h=``,g=Math.min(p,v);r&&c(u)&&(t+=l(u,`,`,v),f=f.slice(u.length),g-=u.length,h=`,`),i&&(f=o(f,s)),d.push(u);for(let e=0;e<g;e++){let n=f[e],r=S(n,u[n],d);r!==void 0&&(t+=`${h}${a(n)}:${r}`,h=`,`)}if(p>v){let e=p-v;t+=`${h}"...":"${m(e)} not stringified"`}return d.pop(),`{${t}}`}case`number`:return isFinite(u)?String(u):t?t(u):`null`;case`boolean`:return u===!0?`true`:`false`;case`undefined`:return;case`bigint`:if(r)return String(u);default:return t?t(u):void 0}}function C(e,t,n){if(arguments.length>1){let r=``;if(typeof n==`number`?r=` `.repeat(Math.min(n,10)):typeof n==`string`&&(r=n.slice(0,10)),t!=null){if(typeof t==`function`)return y(``,{"":e},[],t,r,``);if(Array.isArray(t))return b(``,e,[],h(t),r,``)}if(r.length!==0)return x(``,e,[],r,``)}return S(``,e,[])}return C}})),Ut=z(((e,t)=>{let n=Symbol.for(`pino.metadata`),{DEFAULT_LEVELS:r}=Rt(),i=r.info;function a(e,t){e||=[],t||={dedupe:!1};let a=Object.create(r);a.silent=1/0,t.levels&&typeof t.levels==`object`&&Object.keys(t.levels).forEach(e=>{a[e]=t.levels[e]});let u={write:d,add:m,remove:h,emit:f,flushSync:p,end:g,minLevel:0,lastId:0,streams:[],clone:_,[n]:!0,streamLevels:a};return Array.isArray(e)?e.forEach(m,u):m.call(u,e),e=null,u;function d(e){let r,i=this.lastLevel,{streams:a}=this,o=0,u;for(let d=s(a.length,t.dedupe);l(d,a.length,t.dedupe);d=c(d,t.dedupe))if(r=a[d],r.level<=i){if(o!==0&&o!==r.level)break;if(u=r.stream,u[n]){let{lastTime:e,lastMsg:t,lastObj:n,lastLogger:r}=this;u.lastLevel=i,u.lastTime=e,u.lastMsg=t,u.lastObj=n,u.lastLogger=r}u.write(e),t.dedupe&&(o=r.level)}else if(!t.dedupe)break}function f(...e){for(let{stream:t}of this.streams)typeof t.emit==`function`&&t.emit(...e)}function p(){for(let{stream:e}of this.streams)typeof e.flushSync==`function`&&e.flushSync()}function m(e){if(!e)return u;let t=typeof e.write==`function`||e.stream,n=e.write?e:e.stream;if(!t)throw Error(`stream object needs to implement either StreamEntry or DestinationStream interface`);let{streams:r,streamLevels:a}=this,s;s=typeof e.levelVal==`number`?e.levelVal:typeof e.level==`string`?a[e.level]:typeof e.level==`number`?e.level:i;let c={stream:n,level:s,levelVal:void 0,id:++u.lastId};return r.unshift(c),r.sort(o),this.minLevel=r[0].level,u}function h(e){let{streams:t}=this,n=t.findIndex(t=>t.id===e);return n>=0&&(t.splice(n,1),t.sort(o),this.minLevel=t.length>0?t[0].level:-1),u}function g(){for(let{stream:e}of this.streams)typeof e.flushSync==`function`&&e.flushSync(),e.end()}function _(e){let t=Array(this.streams.length);for(let n=0;n<t.length;n++)t[n]={level:e,stream:this.streams[n].stream};return{write:d,add:m,remove:h,minLevel:e,streams:t,clone:_,emit:f,flushSync:p,[n]:!0}}}function o(e,t){return e.level-t.level}function s(e,t){return t?e-1:0}function c(e,t){return t?e-1:e+1}function l(e,t,n){return n?e>=0:e<t}t.exports=a})),Wt=le(z(((e,t)=>{let n=B(`node:os`),r=St(),i=Ct(),a=Et(),o=Dt(),s=Vt(),c=Tt(),{configure:l}=Ht(),{assertDefaultLevelFound:u,mappings:d,genLsCache:f,genLevelComparison:p,assertLevelComparison:m}=zt(),{DEFAULT_LEVELS:h,SORTING_ORDER:g}=Rt(),{createArgsNormalizer:_,asChindings:v,buildSafeSonicBoom:y,buildFormatters:b,stringify:x,normalizeDestFileDescriptor:S,noop:C}=Lt(),{version:w}=Bt(),{chindingsSym:T,redactFmtSym:E,serializersSym:D,timeSym:O,timeSliceIndexSym:k,streamSym:A,stringifySym:j,stringifySafeSym:M,stringifiersSym:N,setLevelSym:P,endSym:ee,formatOptsSym:F,messageKeySym:I,errorKeySym:te,nestedKeySym:L,mixinSym:ne,levelCompSym:re,useOnlyCustomLevelsSym:ie,formattersSym:ae,hooksSym:oe,nestedKeyStrSym:R,mixinMergeStrategySym:z,msgPrefixSym:se}=c,{epochTime:ce,nullTime:le}=o,{pid:V}=process,ue=n.hostname(),de=r.err,fe=_({level:`info`,levelComparison:g.ASC,levels:h,messageKey:`msg`,errorKey:`err`,nestedKey:null,enabled:!0,base:{pid:V,hostname:ue},serializers:Object.assign(Object.create(null),{err:de}),formatters:Object.assign(Object.create(null),{bindings(e){return e},level(e,t){return{level:t}}}),hooks:{logMethod:void 0,streamWrite:void 0},timestamp:ce,name:void 0,redact:null,customLevels:null,useOnlyCustomLevels:!1,depthLimit:5,edgeLimit:100}),pe=Object.assign(Object.create(null),r);function H(...e){let t={},{opts:n,stream:r}=fe(t,i(),...e);n.level&&typeof n.level==`string`&&h[n.level.toLowerCase()]!==void 0&&(n.level=n.level.toLowerCase());let{redact:o,crlf:c,serializers:g,timestamp:_,messageKey:y,errorKey:S,nestedKey:w,base:B,name:V,level:ue,customLevels:de,levelComparison:pe,mixin:H,mixinMergeStrategy:me,useOnlyCustomLevels:he,formatters:U,hooks:ge,depthLimit:_e,edgeLimit:ve,onChild:ye,msgPrefix:be}=n,xe=l({maximumDepth:_e,maximumBreadth:ve}),Se=b(U.level,U.bindings,U.log),Ce=x.bind({[M]:xe}),we=o?a(o,Ce):{},Te=o?{stringify:we[E]}:{stringify:Ce},Ee=`}`+(c?`\r
16
+ `:`
17
+ `),De=v.bind(null,{[T]:``,[D]:g,[N]:we,[j]:x,[M]:xe,[ae]:Se}),Oe=``;B!==null&&(Oe=De(V===void 0?B:Object.assign({},B,{name:V})));let ke=_ instanceof Function?_:_?ce:le,Ae=ke().indexOf(`:`)+1;if(he&&!de)throw Error(`customLevels is required if useOnlyCustomLevels is set true`);if(H&&typeof H!=`function`)throw Error(`Unknown mixin type "${typeof H}" - expected "function"`);if(be&&typeof be!=`string`)throw Error(`Unknown msgPrefix type "${typeof be}" - expected "string"`);u(ue,de,he);let je=d(de,he);typeof r.emit==`function`&&r.emit(`message`,{code:`PINO_CONFIG`,config:{levels:je,messageKey:y,errorKey:S}}),m(pe);let Me=p(pe);return Object.assign(t,{levels:je,[re]:Me,[ie]:he,[A]:r,[O]:ke,[k]:Ae,[j]:x,[M]:xe,[N]:we,[ee]:Ee,[F]:Te,[I]:y,[te]:S,[L]:w,[R]:w?`,${JSON.stringify(w)}:{`:``,[D]:g,[ne]:H,[z]:me,[T]:Oe,[ae]:Se,[oe]:ge,silent:C,onChild:ye,[se]:be}),Object.setPrototypeOf(t,s()),f(t),t[P](ue),t}t.exports=H,t.exports.destination=(e=process.stdout.fd)=>typeof e==`object`?(e.dest=S(e.dest||process.stdout.fd),y(e)):y({dest:S(e),minLength:0}),t.exports.transport=It(),t.exports.multistream=Ut(),t.exports.levels=d(),t.exports.stdSerializers=pe,t.exports.stdTimeFunctions=Object.assign({},o),t.exports.symbols=c,t.exports.version=w,t.exports.default=H,t.exports.pino=H}))(),1),Gt=class extends D{_filePath;_fileDir;_fileExt;_fileStem;_fileBaseName;_options;_label;_size=0;_stream;_init;constructor(e,t={}){if(super(),!e)throw Error(`A log filename is required`);let r=a(e);this._filePath=e,this._fileDir=r.dir,this._fileExt=r.ext,this._fileStem=r.name,this._fileBaseName=n(e),this._options={size:t.size??0,backups:t.backups??1,flags:t.flags??`a`,mode:t.mode??384,encoding:t.encoding??`utf8`},this._label=this._format(new Date),this._init=this._initialize()}_write(e,t,n){this._writeChunk(e,t).then(()=>n(),n)}_final(e){this._close().then(()=>e(),e)}async _initialize(){await b(this._fileDir,{recursive:!0});let e=await Jt(this._filePath);if(e){let t=this._format(e.mtime),n=t!==this._label,r=this._options.size>0&&e.size>=this._options.size;n||r?await this._rotateHotFile(t):this._size=e.size}this._stream=this._open()}async _writeChunk(e,t){await this._init;let n=Buffer.isBuffer(e)?e.byteLength:Buffer.byteLength(e,t);await this._rotateIfNeeded(),await new Promise((n,r)=>{this._stream.write(e,t,e=>{e?r(e):n()})}),this._size+=n}_open(){let e=f(this._filePath,{flags:this._options.flags,mode:this._options.mode,encoding:this._options.encoding});return e.on(`error`,e=>{this.destroy(e)}),e}async _close(){if(await this._init.catch(()=>void 0),!this._stream)return;let e=this._stream;this._stream=void 0,await new Promise((t,n)=>{let r=()=>{e.off(`error`,i),t()},i=t=>{e.off(`close`,r),n(t)};e.once(`close`,r),e.once(`error`,i),e.end()})}async _rotateIfNeeded(){let e=this._format(new Date),t=e!==this._label,n=this._options.size>0&&this._size>=this._options.size;if(!t&&!n)return;await this._close();let r=await Jt(this._filePath);r&&r.size>0&&await this._rotateHotFile(this._label),this._label=e,this._size=0,this._stream=this._open()}async _rotateHotFile(e){if(!await Jt(this._filePath))return;let t=await this._getNextRotatedPath(e);await S(this._filePath,t),await this._pruneBackups()}async _getNextRotatedPath(e){let t=(await this._listRotatedFiles()).filter(t=>t.label===e).reduce((e,t)=>Math.max(e,t.index),0)+1;return i(this._fileDir,this._buildRotatedFileName(e,t))}_buildRotatedFileName(e,t){return this._fileExt?`${this._fileStem}.${e}.${t}${this._fileExt}`:`${this._fileBaseName}.${e}.${t}`}async _pruneBackups(){let e=(await this._listRotatedFiles()).sort((e,t)=>e.label===t.label?t.index-e.index:t.label.localeCompare(e.label)).slice(this._options.backups);await Promise.all(e.map(e=>C(e.path,{force:!0})))}async _listRotatedFiles(){let e=await x(this._fileDir),t=[],n=this._getRotatedFilePattern();for(let r of e){let e=n.exec(r);e?.groups&&t.push({label:e.groups.label,index:Number.parseInt(e.groups.index,10),path:i(this._fileDir,r)})}return t}_getRotatedFilePattern(){return this._fileExt?RegExp(`^${qt(this._fileStem)}\\.(?<label>.+)\\.(?<index>\\d+)${qt(this._fileExt)}$`,`u`):RegExp(`^${qt(this._fileBaseName)}\\.(?<label>.+)\\.(?<index>\\d+)$`,`u`)}_format(e){return`${Kt(e.getFullYear(),4)}-${Kt(e.getMonth()+1)}-${Kt(e.getDate())}`}};function Kt(e,t=2){return e.toString().padStart(t,`0`)}function qt(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}async function Jt(e){try{return await w(e)}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`)return;throw e}}let Yt;var Xt=class{_category;_factory;_logger;constructor(e){this._category=e}trace(...e){this._log?.trace(...e)}debug(...e){this._log?.debug(...e)}info(...e){this._log?.info(...e)}warn(...e){this._log?.warn(...e)}error(...e){this._log?.error(...e)}fatal(...e){this._log?.fatal(...e)}get _log(){if(!Yt){this._factory=void 0,this._logger=void 0;return}return(this._factory!==Yt||!this._logger)&&(this._factory=Yt,this._logger=Yt.create(this._category)),this._logger}};function Zt(e){switch(e=e?.toLowerCase(),e){case`trace`:case`debug`:case`info`:case`warn`:case`error`:case`fatal`:case`silent`:return e;default:return`info`}}function Qt(e){let t=process.env.WALLABY_CLI_LOG_PATH;function n(){let e=process.env.WALLABY_CLI_LOG_LEVEL;return e?Zt(e):`info`}function r(e,t){let n=Number.parseInt(e??``,10);return Number.isInteger(n)&&n>0?n:t}return{path:e?.path??t??i(u(),`wallaby-cli.log`),level:e?.level??n(),size:e?.size??r(process.env.WALLABY_CLI_LOG_MAX_SIZE,10*1024*1024),backups:e?.backups??r(process.env.WALLABY_CLI_LOG_MAX_BACKUPS,7)}}function $t(e){if(Yt)throw Error(`Logger is already initialized`);e=Qt(e),W.default.ensureDirSync(r(e.path));let t=new Gt(e.path,{size:e.size,backups:e.backups,flags:`a`,mode:384,encoding:`utf8`});function n(e){process.stderr.write(`[logger] ${e.stack||e.message}\n`)}t.on(`error`,n);function i(e){let t=(t,n)=>{e.fatal({err:t,origin:n},`Uncaught exception`)},n=t=>{e.error({reason:t},`Unhandled promise rejection`)};return process.on(`uncaughtExceptionMonitor`,t),process.on(`unhandledRejection`,n),()=>{process.off(`uncaughtExceptionMonitor`,t),process.off(`unhandledRejection`,n)}}let a=(0,Wt.default)({level:e.level,timestamp:Wt.default.stdTimeFunctions.isoTime,base:{pid:process.pid},errorKey:`error`,formatters:{level(e){return{level:e}}}},t),o=i(a);Yt={create(e){return a.child({category:e})},async close(){o(),t.off(`error`,n),await new Promise((e,n)=>{t.end(t=>{t?n(t):e()})})}},a.debug(`Initialized CLI logger`)}function en(e){return new Xt(e)}async function tn(){let e=Yt;e&&(Yt=void 0,await e.close())}var K={initialize:$t,create:en,shutdown:tn};const nn=_(import.meta.url),rn=process.platform===`win32`,an=ln(),on=rn?e=>e.replace(/\\/g,o.sep):e=>e,sn=an?e=>e:e=>e.toLowerCase(),cn=e=>o.normalize(sn(on(e)));function ln(){return rn?!1:!p(un(nn))}function un(e){return e.replace(/\w/g,e=>{let t=e.toUpperCase();return e===t?e.toLowerCase():t})}var dn=z(((e,t)=>{t.exports=[`|/-\\`,`⠂-–—–-`,`◐◓◑◒`,`◴◷◶◵`,`◰◳◲◱`,`▖▘▝▗`,`■□▪▫`,`▌▀▐▄`,`▉▊▋▌▍▎▏▎▍▌▋▊▉`,`▁▃▄▅▆▇█▇▆▅▄▃`,`←↖↑↗→↘↓↙`,`┤┘┴└├┌┬┐`,`◢◣◤◥`,`.oO°Oo.`,`.oO@*`,[`🌍`,`🌎`,`🌏`],`◡◡ ⊙⊙ ◠◠`,`☱☲☴`,`⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏`,`⠋⠙⠚⠞⠖⠦⠴⠲⠳⠓`,`⠄⠆⠇⠋⠙⠸⠰⠠⠰⠸⠙⠋⠇⠆`,`⠋⠙⠚⠒⠂⠂⠒⠲⠴⠦⠖⠒⠐⠐⠒⠓⠋`,`⠁⠉⠙⠚⠒⠂⠂⠒⠲⠴⠤⠄⠄⠤⠴⠲⠒⠂⠂⠒⠚⠙⠉⠁`,`⠈⠉⠋⠓⠒⠐⠐⠒⠖⠦⠤⠠⠠⠤⠦⠖⠒⠐⠐⠒⠓⠋⠉⠈`,`⠁⠁⠉⠙⠚⠒⠂⠂⠒⠲⠴⠤⠄⠄⠤⠠⠠⠤⠦⠖⠒⠐⠐⠒⠓⠋⠉⠈⠈`,`⢄⢂⢁⡁⡈⡐⡠`,`⢹⢺⢼⣸⣇⡧⡗⡏`,`⣾⣽⣻⢿⡿⣟⣯⣷`,`⠁⠂⠄⡀⢀⠠⠐⠈`,[`🌑`,`🌒`,`🌓`,`🌔`,`🌕`,`🌝`,`🌖`,`🌗`,`🌘`,`🌚`],[`🕛`,`🕐`,`🕑`,`🕒`,`🕓`,`🕔`,`🕕`,`🕖`,`🕗`,`🕘`,`🕙`,`🕚`]]})),fn=z((e=>{var t=B(`readline`),n=0,r=60;function i(e){this.clearLine(this.stream),this.stream.write(e)}var a=function(e){if(!(this instanceof a))return new a(e);typeof e==`string`?e={text:e}:e||={},this.text=e.text||``,this.setSpinnerString(n),this.setSpinnerDelay(r),this.onTick=e.onTick||i,this.stream=e.stream||process.stdout};a.spinners=dn(),a.setDefaultSpinnerString=function(e){return n=e,this},a.setDefaultSpinnerDelay=function(e){return r=e,this},a.prototype.start=function(){if(this.stream===process.stdout&&this.stream.isTTY!==!0)return this;var e=0,t=this,n=function(){var n=t.text.indexOf(`%s`)>-1?t.text.replace(`%s`,t.chars[e]):t.chars[e]+` `+t.text;t.onTick(n),e=++e%t.chars.length};return n(),this.id=setInterval(n,this.delay),this},a.prototype.isSpinning=function(){return this.id!==void 0},a.prototype.setSpinnerDelay=function(e){return this.delay=e,this},a.prototype.setSpinnerString=function(e){let t=s(e,this.spinners);return this.chars=Array.isArray(t)?t:t.split(``),this},a.prototype.setSpinnerTitle=function(e){return this.text=e,this},a.prototype.stop=function(e){return this.isSpinning===!1?this:(clearInterval(this.id),this.id=void 0,e&&this.clearLine(this.stream),this)},a.prototype.clearLine=function(e){return t.clearLine(e,0),t.cursorTo(e,0),this};function o(e){return typeof e==`number`&&e%1==0}function s(e,t){if(!o(e))return e+``;var n=a.spinners.length;return e=e>=n?0:e,e=e<0?n+e:e,a.spinners[e]}e.Spinner=a})),pn=z(((e,t)=>{t.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:16,MAX_SAFE_BUILD_LENGTH:250,MAX_SAFE_INTEGER:2**53-1||9007199254740991,RELEASE_TYPES:[`major`,`premajor`,`minor`,`preminor`,`patch`,`prepatch`,`prerelease`],SEMVER_SPEC_VERSION:`2.0.0`,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}})),mn=z(((e,t)=>{t.exports=typeof process==`object`&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error(`SEMVER`,...e):()=>{}})),hn=z(((e,t)=>{let{MAX_SAFE_COMPONENT_LENGTH:n,MAX_SAFE_BUILD_LENGTH:r,MAX_LENGTH:i}=pn(),a=mn();e=t.exports={};let o=e.re=[],s=e.safeRe=[],c=e.src=[],l=e.safeSrc=[],u=e.t={},d=0,f=`[a-zA-Z0-9-]`,p=[[`\\s`,1],[`\\d`,i],[f,r]],m=e=>{for(let[t,n]of p)e=e.split(`${t}*`).join(`${t}{0,${n}}`).split(`${t}+`).join(`${t}{1,${n}}`);return e},h=(e,t,n)=>{let r=m(t),i=d++;a(e,i,t),u[e]=i,c[i]=t,l[i]=r,o[i]=new RegExp(t,n?`g`:void 0),s[i]=new RegExp(r,n?`g`:void 0)};h(`NUMERICIDENTIFIER`,`0|[1-9]\\d*`),h(`NUMERICIDENTIFIERLOOSE`,`\\d+`),h(`NONNUMERICIDENTIFIER`,`\\d*[a-zA-Z-]${f}*`),h(`MAINVERSION`,`(${c[u.NUMERICIDENTIFIER]})\\.(${c[u.NUMERICIDENTIFIER]})\\.(${c[u.NUMERICIDENTIFIER]})`),h(`MAINVERSIONLOOSE`,`(${c[u.NUMERICIDENTIFIERLOOSE]})\\.(${c[u.NUMERICIDENTIFIERLOOSE]})\\.(${c[u.NUMERICIDENTIFIERLOOSE]})`),h(`PRERELEASEIDENTIFIER`,`(?:${c[u.NONNUMERICIDENTIFIER]}|${c[u.NUMERICIDENTIFIER]})`),h(`PRERELEASEIDENTIFIERLOOSE`,`(?:${c[u.NONNUMERICIDENTIFIER]}|${c[u.NUMERICIDENTIFIERLOOSE]})`),h(`PRERELEASE`,`(?:-(${c[u.PRERELEASEIDENTIFIER]}(?:\\.${c[u.PRERELEASEIDENTIFIER]})*))`),h(`PRERELEASELOOSE`,`(?:-?(${c[u.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${c[u.PRERELEASEIDENTIFIERLOOSE]})*))`),h(`BUILDIDENTIFIER`,`${f}+`),h(`BUILD`,`(?:\\+(${c[u.BUILDIDENTIFIER]}(?:\\.${c[u.BUILDIDENTIFIER]})*))`),h(`FULLPLAIN`,`v?${c[u.MAINVERSION]}${c[u.PRERELEASE]}?${c[u.BUILD]}?`),h(`FULL`,`^${c[u.FULLPLAIN]}$`),h(`LOOSEPLAIN`,`[v=\\s]*${c[u.MAINVERSIONLOOSE]}${c[u.PRERELEASELOOSE]}?${c[u.BUILD]}?`),h(`LOOSE`,`^${c[u.LOOSEPLAIN]}$`),h(`GTLT`,`((?:<|>)?=?)`),h(`XRANGEIDENTIFIERLOOSE`,`${c[u.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),h(`XRANGEIDENTIFIER`,`${c[u.NUMERICIDENTIFIER]}|x|X|\\*`),h(`XRANGEPLAIN`,`[v=\\s]*(${c[u.XRANGEIDENTIFIER]})(?:\\.(${c[u.XRANGEIDENTIFIER]})(?:\\.(${c[u.XRANGEIDENTIFIER]})(?:${c[u.PRERELEASE]})?${c[u.BUILD]}?)?)?`),h(`XRANGEPLAINLOOSE`,`[v=\\s]*(${c[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[u.XRANGEIDENTIFIERLOOSE]})(?:${c[u.PRERELEASELOOSE]})?${c[u.BUILD]}?)?)?`),h(`XRANGE`,`^${c[u.GTLT]}\\s*${c[u.XRANGEPLAIN]}$`),h(`XRANGELOOSE`,`^${c[u.GTLT]}\\s*${c[u.XRANGEPLAINLOOSE]}$`),h(`COERCEPLAIN`,`(^|[^\\d])(\\d{1,${n}})(?:\\.(\\d{1,${n}}))?(?:\\.(\\d{1,${n}}))?`),h(`COERCE`,`${c[u.COERCEPLAIN]}(?:$|[^\\d])`),h(`COERCEFULL`,c[u.COERCEPLAIN]+`(?:${c[u.PRERELEASE]})?(?:${c[u.BUILD]})?(?:$|[^\\d])`),h(`COERCERTL`,c[u.COERCE],!0),h(`COERCERTLFULL`,c[u.COERCEFULL],!0),h(`LONETILDE`,`(?:~>?)`),h(`TILDETRIM`,`(\\s*)${c[u.LONETILDE]}\\s+`,!0),e.tildeTrimReplace=`$1~`,h(`TILDE`,`^${c[u.LONETILDE]}${c[u.XRANGEPLAIN]}$`),h(`TILDELOOSE`,`^${c[u.LONETILDE]}${c[u.XRANGEPLAINLOOSE]}$`),h(`LONECARET`,`(?:\\^)`),h(`CARETTRIM`,`(\\s*)${c[u.LONECARET]}\\s+`,!0),e.caretTrimReplace=`$1^`,h(`CARET`,`^${c[u.LONECARET]}${c[u.XRANGEPLAIN]}$`),h(`CARETLOOSE`,`^${c[u.LONECARET]}${c[u.XRANGEPLAINLOOSE]}$`),h(`COMPARATORLOOSE`,`^${c[u.GTLT]}\\s*(${c[u.LOOSEPLAIN]})$|^$`),h(`COMPARATOR`,`^${c[u.GTLT]}\\s*(${c[u.FULLPLAIN]})$|^$`),h(`COMPARATORTRIM`,`(\\s*)${c[u.GTLT]}\\s*(${c[u.LOOSEPLAIN]}|${c[u.XRANGEPLAIN]})`,!0),e.comparatorTrimReplace=`$1$2$3`,h(`HYPHENRANGE`,`^\\s*(${c[u.XRANGEPLAIN]})\\s+-\\s+(${c[u.XRANGEPLAIN]})\\s*$`),h(`HYPHENRANGELOOSE`,`^\\s*(${c[u.XRANGEPLAINLOOSE]})\\s+-\\s+(${c[u.XRANGEPLAINLOOSE]})\\s*$`),h(`STAR`,`(<|>)?=?\\s*\\*`),h(`GTE0`,`^\\s*>=\\s*0\\.0\\.0\\s*$`),h(`GTE0PRE`,`^\\s*>=\\s*0\\.0\\.0-0\\s*$`)})),gn=z(((e,t)=>{let n=Object.freeze({loose:!0}),r=Object.freeze({});t.exports=e=>e?typeof e==`object`?e:n:r})),_n=z(((e,t)=>{let n=/^[0-9]+$/,r=(e,t)=>{if(typeof e==`number`&&typeof t==`number`)return e===t?0:e<t?-1:1;let r=n.test(e),i=n.test(t);return r&&i&&(e=+e,t=+t),e===t?0:r&&!i?-1:i&&!r?1:e<t?-1:1};t.exports={compareIdentifiers:r,rcompareIdentifiers:(e,t)=>r(t,e)}})),q=z(((e,t)=>{let n=mn(),{MAX_LENGTH:r,MAX_SAFE_INTEGER:i}=pn(),{safeRe:a,t:o}=hn(),s=gn(),{compareIdentifiers:c}=_n();t.exports=class e{constructor(t,c){if(c=s(c),t instanceof e){if(t.loose===!!c.loose&&t.includePrerelease===!!c.includePrerelease)return t;t=t.version}else if(typeof t!=`string`)throw TypeError(`Invalid version. Must be a string. Got type "${typeof t}".`);if(t.length>r)throw TypeError(`version is longer than ${r} characters`);n(`SemVer`,t,c),this.options=c,this.loose=!!c.loose,this.includePrerelease=!!c.includePrerelease;let l=t.trim().match(c.loose?a[o.LOOSE]:a[o.FULL]);if(!l)throw TypeError(`Invalid Version: ${t}`);if(this.raw=t,this.major=+l[1],this.minor=+l[2],this.patch=+l[3],this.major>i||this.major<0)throw TypeError(`Invalid major version`);if(this.minor>i||this.minor<0)throw TypeError(`Invalid minor version`);if(this.patch>i||this.patch<0)throw TypeError(`Invalid patch version`);l[4]?this.prerelease=l[4].split(`.`).map(e=>{if(/^[0-9]+$/.test(e)){let t=+e;if(t>=0&&t<i)return t}return e}):this.prerelease=[],this.build=l[5]?l[5].split(`.`):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(`.`)}`),this.version}toString(){return this.version}compare(t){if(n(`SemVer.compare`,this.version,this.options,t),!(t instanceof e)){if(typeof t==`string`&&t===this.version)return 0;t=new e(t,this.options)}return t.version===this.version?0:this.compareMain(t)||this.comparePre(t)}compareMain(t){return t instanceof e||(t=new e(t,this.options)),this.major<t.major?-1:this.major>t.major?1:this.minor<t.minor?-1:this.minor>t.minor?1:this.patch<t.patch?-1:+(this.patch>t.patch)}comparePre(t){if(t instanceof e||(t=new e(t,this.options)),this.prerelease.length&&!t.prerelease.length)return-1;if(!this.prerelease.length&&t.prerelease.length)return 1;if(!this.prerelease.length&&!t.prerelease.length)return 0;let r=0;do{let e=this.prerelease[r],i=t.prerelease[r];if(n(`prerelease compare`,r,e,i),e===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(e===void 0)return-1;if(e===i)continue;return c(e,i)}while(++r)}compareBuild(t){t instanceof e||(t=new e(t,this.options));let r=0;do{let e=this.build[r],i=t.build[r];if(n(`build compare`,r,e,i),e===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(e===void 0)return-1;if(e===i)continue;return c(e,i)}while(++r)}inc(e,t,n){if(e.startsWith(`pre`)){if(!t&&n===!1)throw Error(`invalid increment argument: identifier is empty`);if(t){let e=`-${t}`.match(this.options.loose?a[o.PRERELEASELOOSE]:a[o.PRERELEASE]);if(!e||e[1]!==t)throw Error(`invalid identifier: ${t}`)}}switch(e){case`premajor`:this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc(`pre`,t,n);break;case`preminor`:this.prerelease.length=0,this.patch=0,this.minor++,this.inc(`pre`,t,n);break;case`prepatch`:this.prerelease.length=0,this.inc(`patch`,t,n),this.inc(`pre`,t,n);break;case`prerelease`:this.prerelease.length===0&&this.inc(`patch`,t,n),this.inc(`pre`,t,n);break;case`release`:if(this.prerelease.length===0)throw Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case`major`:(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case`minor`:(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case`patch`:this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case`pre`:{let e=+!!Number(n);if(this.prerelease.length===0)this.prerelease=[e];else{let r=this.prerelease.length;for(;--r>=0;)typeof this.prerelease[r]==`number`&&(this.prerelease[r]++,r=-2);if(r===-1){if(t===this.prerelease.join(`.`)&&n===!1)throw Error(`invalid increment argument: identifier already exists`);this.prerelease.push(e)}}if(t){let r=[t,e];n===!1&&(r=[t]),c(this.prerelease[0],t)===0?isNaN(this.prerelease[1])&&(this.prerelease=r):this.prerelease=r}break}default:throw Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(`.`)}`),this}}})),vn=z(((e,t)=>{let n=q();t.exports=(e,t,r=!1)=>{if(e instanceof n)return e;try{return new n(e,t)}catch(e){if(!r)return null;throw e}}})),yn=z(((e,t)=>{let n=vn();t.exports=(e,t)=>{let r=n(e,t);return r?r.version:null}})),bn=z(((e,t)=>{let n=vn();t.exports=(e,t)=>{let r=n(e.trim().replace(/^[=v]+/,``),t);return r?r.version:null}})),xn=z(((e,t)=>{let n=q();t.exports=(e,t,r,i,a)=>{typeof r==`string`&&(a=i,i=r,r=void 0);try{return new n(e instanceof n?e.version:e,r).inc(t,i,a).version}catch{return null}}})),Sn=z(((e,t)=>{let n=vn();t.exports=(e,t)=>{let r=n(e,null,!0),i=n(t,null,!0),a=r.compare(i);if(a===0)return null;let o=a>0,s=o?r:i,c=o?i:r,l=!!s.prerelease.length;if(c.prerelease.length&&!l){if(!c.patch&&!c.minor)return`major`;if(c.compareMain(s)===0)return c.minor&&!c.patch?`minor`:`patch`}let u=l?`pre`:``;return r.major===i.major?r.minor===i.minor?r.patch===i.patch?`prerelease`:u+`patch`:u+`minor`:u+`major`}})),Cn=z(((e,t)=>{let n=q();t.exports=(e,t)=>new n(e,t).major})),wn=z(((e,t)=>{let n=q();t.exports=(e,t)=>new n(e,t).minor})),Tn=z(((e,t)=>{let n=q();t.exports=(e,t)=>new n(e,t).patch})),En=z(((e,t)=>{let n=vn();t.exports=(e,t)=>{let r=n(e,t);return r&&r.prerelease.length?r.prerelease:null}})),J=z(((e,t)=>{let n=q();t.exports=(e,t,r)=>new n(e,r).compare(new n(t,r))})),Dn=z(((e,t)=>{let n=J();t.exports=(e,t,r)=>n(t,e,r)})),On=z(((e,t)=>{let n=J();t.exports=(e,t)=>n(e,t,!0)})),kn=z(((e,t)=>{let n=q();t.exports=(e,t,r)=>{let i=new n(e,r),a=new n(t,r);return i.compare(a)||i.compareBuild(a)}})),An=z(((e,t)=>{let n=kn();t.exports=(e,t)=>e.sort((e,r)=>n(e,r,t))})),jn=z(((e,t)=>{let n=kn();t.exports=(e,t)=>e.sort((e,r)=>n(r,e,t))})),Mn=z(((e,t)=>{let n=J();t.exports=(e,t,r)=>n(e,t,r)>0})),Nn=z(((e,t)=>{let n=J();t.exports=(e,t,r)=>n(e,t,r)<0})),Pn=z(((e,t)=>{let n=J();t.exports=(e,t,r)=>n(e,t,r)===0})),Fn=z(((e,t)=>{let n=J();t.exports=(e,t,r)=>n(e,t,r)!==0})),In=z(((e,t)=>{let n=J();t.exports=(e,t,r)=>n(e,t,r)>=0})),Ln=z(((e,t)=>{let n=J();t.exports=(e,t,r)=>n(e,t,r)<=0})),Rn=z(((e,t)=>{let n=Pn(),r=Fn(),i=Mn(),a=In(),o=Nn(),s=Ln();t.exports=(e,t,c,l)=>{switch(t){case`===`:return typeof e==`object`&&(e=e.version),typeof c==`object`&&(c=c.version),e===c;case`!==`:return typeof e==`object`&&(e=e.version),typeof c==`object`&&(c=c.version),e!==c;case``:case`=`:case`==`:return n(e,c,l);case`!=`:return r(e,c,l);case`>`:return i(e,c,l);case`>=`:return a(e,c,l);case`<`:return o(e,c,l);case`<=`:return s(e,c,l);default:throw TypeError(`Invalid operator: ${t}`)}}})),zn=z(((e,t)=>{let n=q(),r=vn(),{safeRe:i,t:a}=hn();t.exports=(e,t)=>{if(e instanceof n)return e;if(typeof e==`number`&&(e=String(e)),typeof e!=`string`)return null;t||={};let o=null;if(!t.rtl)o=e.match(t.includePrerelease?i[a.COERCEFULL]:i[a.COERCE]);else{let n=t.includePrerelease?i[a.COERCERTLFULL]:i[a.COERCERTL],r;for(;(r=n.exec(e))&&(!o||o.index+o[0].length!==e.length);)(!o||r.index+r[0].length!==o.index+o[0].length)&&(o=r),n.lastIndex=r.index+r[1].length+r[2].length;n.lastIndex=-1}if(o===null)return null;let s=o[2];return r(`${s}.${o[3]||`0`}.${o[4]||`0`}${t.includePrerelease&&o[5]?`-${o[5]}`:``}${t.includePrerelease&&o[6]?`+${o[6]}`:``}`,t)}})),Bn=z(((e,t)=>{t.exports=class{constructor(){this.max=1e3,this.map=new Map}get(e){let t=this.map.get(e);if(t!==void 0)return this.map.delete(e),this.map.set(e,t),t}delete(e){return this.map.delete(e)}set(e,t){if(!this.delete(e)&&t!==void 0){if(this.map.size>=this.max){let e=this.map.keys().next().value;this.delete(e)}this.map.set(e,t)}return this}}})),Y=z(((e,t)=>{let n=/\s+/g;t.exports=class e{constructor(t,r){if(r=i(r),t instanceof e)return t.loose===!!r.loose&&t.includePrerelease===!!r.includePrerelease?t:new e(t.raw,r);if(t instanceof a)return this.raw=t.value,this.set=[[t]],this.formatted=void 0,this;if(this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease,this.raw=t.trim().replace(n,` `),this.set=this.raw.split(`||`).map(e=>this.parseRange(e.trim())).filter(e=>e.length),!this.set.length)throw TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let e=this.set[0];if(this.set=this.set.filter(e=>!h(e[0])),this.set.length===0)this.set=[e];else if(this.set.length>1){for(let e of this.set)if(e.length===1&&g(e[0])){this.set=[e];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted=``;for(let e=0;e<this.set.length;e++){e>0&&(this.formatted+=`||`);let t=this.set[e];for(let e=0;e<t.length;e++)e>0&&(this.formatted+=` `),this.formatted+=t[e].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(e){let t=((this.options.includePrerelease&&p)|(this.options.loose&&m))+`:`+e,n=r.get(t);if(n)return n;let i=this.options.loose,s=i?c[l.HYPHENRANGELOOSE]:c[l.HYPHENRANGE];e=e.replace(s,O(this.options.includePrerelease)),o(`hyphen replace`,e),e=e.replace(c[l.COMPARATORTRIM],u),o(`comparator trim`,e),e=e.replace(c[l.TILDETRIM],d),o(`tilde trim`,e),e=e.replace(c[l.CARETTRIM],f),o(`caret trim`,e);let g=e.split(` `).map(e=>v(e,this.options)).join(` `).split(/\s+/).map(e=>D(e,this.options));i&&(g=g.filter(e=>(o(`loose invalid filter`,e,this.options),!!e.match(c[l.COMPARATORLOOSE])))),o(`range list`,g);let _=new Map,y=g.map(e=>new a(e,this.options));for(let e of y){if(h(e))return[e];_.set(e.value,e)}_.size>1&&_.has(``)&&_.delete(``);let b=[..._.values()];return r.set(t,b),b}intersects(t,n){if(!(t instanceof e))throw TypeError(`a Range is required`);return this.set.some(e=>_(e,n)&&t.set.some(t=>_(t,n)&&e.every(e=>t.every(t=>e.intersects(t,n)))))}test(e){if(!e)return!1;if(typeof e==`string`)try{e=new s(e,this.options)}catch{return!1}for(let t=0;t<this.set.length;t++)if(k(this.set[t],e,this.options))return!0;return!1}};let r=new(Bn()),i=gn(),a=Vn(),o=mn(),s=q(),{safeRe:c,t:l,comparatorTrimReplace:u,tildeTrimReplace:d,caretTrimReplace:f}=hn(),{FLAG_INCLUDE_PRERELEASE:p,FLAG_LOOSE:m}=pn(),h=e=>e.value===`<0.0.0-0`,g=e=>e.value===``,_=(e,t)=>{let n=!0,r=e.slice(),i=r.pop();for(;n&&r.length;)n=r.every(e=>i.intersects(e,t)),i=r.pop();return n},v=(e,t)=>(e=e.replace(c[l.BUILD],``),o(`comp`,e,t),e=S(e,t),o(`caret`,e),e=b(e,t),o(`tildes`,e),e=w(e,t),o(`xrange`,e),e=E(e,t),o(`stars`,e),e),y=e=>!e||e.toLowerCase()===`x`||e===`*`,b=(e,t)=>e.trim().split(/\s+/).map(e=>x(e,t)).join(` `),x=(e,t)=>{let n=t.loose?c[l.TILDELOOSE]:c[l.TILDE];return e.replace(n,(t,n,r,i,a)=>{o(`tilde`,e,t,n,r,i,a);let s;return y(n)?s=``:y(r)?s=`>=${n}.0.0 <${+n+1}.0.0-0`:y(i)?s=`>=${n}.${r}.0 <${n}.${+r+1}.0-0`:a?(o(`replaceTilde pr`,a),s=`>=${n}.${r}.${i}-${a} <${n}.${+r+1}.0-0`):s=`>=${n}.${r}.${i} <${n}.${+r+1}.0-0`,o(`tilde return`,s),s})},S=(e,t)=>e.trim().split(/\s+/).map(e=>C(e,t)).join(` `),C=(e,t)=>{o(`caret`,e,t);let n=t.loose?c[l.CARETLOOSE]:c[l.CARET],r=t.includePrerelease?`-0`:``;return e.replace(n,(t,n,i,a,s)=>{o(`caret`,e,t,n,i,a,s);let c;return y(n)?c=``:y(i)?c=`>=${n}.0.0${r} <${+n+1}.0.0-0`:y(a)?c=n===`0`?`>=${n}.${i}.0${r} <${n}.${+i+1}.0-0`:`>=${n}.${i}.0${r} <${+n+1}.0.0-0`:s?(o(`replaceCaret pr`,s),c=n===`0`?i===`0`?`>=${n}.${i}.${a}-${s} <${n}.${i}.${+a+1}-0`:`>=${n}.${i}.${a}-${s} <${n}.${+i+1}.0-0`:`>=${n}.${i}.${a}-${s} <${+n+1}.0.0-0`):(o(`no pr`),c=n===`0`?i===`0`?`>=${n}.${i}.${a}${r} <${n}.${i}.${+a+1}-0`:`>=${n}.${i}.${a}${r} <${n}.${+i+1}.0-0`:`>=${n}.${i}.${a} <${+n+1}.0.0-0`),o(`caret return`,c),c})},w=(e,t)=>(o(`replaceXRanges`,e,t),e.split(/\s+/).map(e=>T(e,t)).join(` `)),T=(e,t)=>{e=e.trim();let n=t.loose?c[l.XRANGELOOSE]:c[l.XRANGE];return e.replace(n,(n,r,i,a,s,c)=>{o(`xRange`,e,n,r,i,a,s,c);let l=y(i),u=l||y(a),d=u||y(s),f=d;return r===`=`&&f&&(r=``),c=t.includePrerelease?`-0`:``,l?n=r===`>`||r===`<`?`<0.0.0-0`:`*`:r&&f?(u&&(a=0),s=0,r===`>`?(r=`>=`,u?(i=+i+1,a=0,s=0):(a=+a+1,s=0)):r===`<=`&&(r=`<`,u?i=+i+1:a=+a+1),r===`<`&&(c=`-0`),n=`${r+i}.${a}.${s}${c}`):u?n=`>=${i}.0.0${c} <${+i+1}.0.0-0`:d&&(n=`>=${i}.${a}.0${c} <${i}.${+a+1}.0-0`),o(`xRange return`,n),n})},E=(e,t)=>(o(`replaceStars`,e,t),e.trim().replace(c[l.STAR],``)),D=(e,t)=>(o(`replaceGTE0`,e,t),e.trim().replace(c[t.includePrerelease?l.GTE0PRE:l.GTE0],``)),O=e=>(t,n,r,i,a,o,s,c,l,u,d,f)=>(n=y(r)?``:y(i)?`>=${r}.0.0${e?`-0`:``}`:y(a)?`>=${r}.${i}.0${e?`-0`:``}`:o?`>=${n}`:`>=${n}${e?`-0`:``}`,c=y(l)?``:y(u)?`<${+l+1}.0.0-0`:y(d)?`<${l}.${+u+1}.0-0`:f?`<=${l}.${u}.${d}-${f}`:e?`<${l}.${u}.${+d+1}-0`:`<=${c}`,`${n} ${c}`.trim()),k=(e,t,n)=>{for(let n=0;n<e.length;n++)if(!e[n].test(t))return!1;if(t.prerelease.length&&!n.includePrerelease){for(let n=0;n<e.length;n++)if(o(e[n].semver),e[n].semver!==a.ANY&&e[n].semver.prerelease.length>0){let r=e[n].semver;if(r.major===t.major&&r.minor===t.minor&&r.patch===t.patch)return!0}return!1}return!0}})),Vn=z(((e,t)=>{let n=Symbol(`SemVer ANY`);t.exports=class e{static get ANY(){return n}constructor(t,i){if(i=r(i),t instanceof e){if(t.loose===!!i.loose)return t;t=t.value}t=t.trim().split(/\s+/).join(` `),s(`comparator`,t,i),this.options=i,this.loose=!!i.loose,this.parse(t),this.semver===n?this.value=``:this.value=this.operator+this.semver.version,s(`comp`,this)}parse(e){let t=this.options.loose?i[a.COMPARATORLOOSE]:i[a.COMPARATOR],r=e.match(t);if(!r)throw TypeError(`Invalid comparator: ${e}`);this.operator=r[1]===void 0?``:r[1],this.operator===`=`&&(this.operator=``),r[2]?this.semver=new c(r[2],this.options.loose):this.semver=n}toString(){return this.value}test(e){if(s(`Comparator.test`,e,this.options.loose),this.semver===n||e===n)return!0;if(typeof e==`string`)try{e=new c(e,this.options)}catch{return!1}return o(e,this.operator,this.semver,this.options)}intersects(t,n){if(!(t instanceof e))throw TypeError(`a Comparator is required`);return this.operator===``?this.value===``?!0:new l(t.value,n).test(this.value):t.operator===``?t.value===``?!0:new l(this.value,n).test(t.semver):(n=r(n),n.includePrerelease&&(this.value===`<0.0.0-0`||t.value===`<0.0.0-0`)||!n.includePrerelease&&(this.value.startsWith(`<0.0.0`)||t.value.startsWith(`<0.0.0`))?!1:!!(this.operator.startsWith(`>`)&&t.operator.startsWith(`>`)||this.operator.startsWith(`<`)&&t.operator.startsWith(`<`)||this.semver.version===t.semver.version&&this.operator.includes(`=`)&&t.operator.includes(`=`)||o(this.semver,`<`,t.semver,n)&&this.operator.startsWith(`>`)&&t.operator.startsWith(`<`)||o(this.semver,`>`,t.semver,n)&&this.operator.startsWith(`<`)&&t.operator.startsWith(`>`)))}};let r=gn(),{safeRe:i,t:a}=hn(),o=Rn(),s=mn(),c=q(),l=Y()})),Hn=z(((e,t)=>{let n=Y();t.exports=(e,t,r)=>{try{t=new n(t,r)}catch{return!1}return t.test(e)}})),Un=z(((e,t)=>{let n=Y();t.exports=(e,t)=>new n(e,t).set.map(e=>e.map(e=>e.value).join(` `).trim().split(` `))})),Wn=z(((e,t)=>{let n=q(),r=Y();t.exports=(e,t,i)=>{let a=null,o=null,s=null;try{s=new r(t,i)}catch{return null}return e.forEach(e=>{s.test(e)&&(!a||o.compare(e)===-1)&&(a=e,o=new n(a,i))}),a}})),Gn=z(((e,t)=>{let n=q(),r=Y();t.exports=(e,t,i)=>{let a=null,o=null,s=null;try{s=new r(t,i)}catch{return null}return e.forEach(e=>{s.test(e)&&(!a||o.compare(e)===1)&&(a=e,o=new n(a,i))}),a}})),Kn=z(((e,t)=>{let n=q(),r=Y(),i=Mn();t.exports=(e,t)=>{e=new r(e,t);let a=new n(`0.0.0`);if(e.test(a)||(a=new n(`0.0.0-0`),e.test(a)))return a;a=null;for(let t=0;t<e.set.length;++t){let r=e.set[t],o=null;r.forEach(e=>{let t=new n(e.semver.version);switch(e.operator){case`>`:t.prerelease.length===0?t.patch++:t.prerelease.push(0),t.raw=t.format();case``:case`>=`:(!o||i(t,o))&&(o=t);break;case`<`:case`<=`:break;default:throw Error(`Unexpected operation: ${e.operator}`)}}),o&&(!a||i(a,o))&&(a=o)}return a&&e.test(a)?a:null}})),qn=z(((e,t)=>{let n=Y();t.exports=(e,t)=>{try{return new n(e,t).range||`*`}catch{return null}}})),Jn=z(((e,t)=>{let n=q(),r=Vn(),{ANY:i}=r,a=Y(),o=Hn(),s=Mn(),c=Nn(),l=Ln(),u=In();t.exports=(e,t,d,f)=>{e=new n(e,f),t=new a(t,f);let p,m,h,g,_;switch(d){case`>`:p=s,m=l,h=c,g=`>`,_=`>=`;break;case`<`:p=c,m=u,h=s,g=`<`,_=`<=`;break;default:throw TypeError(`Must provide a hilo val of "<" or ">"`)}if(o(e,t,f))return!1;for(let n=0;n<t.set.length;++n){let a=t.set[n],o=null,s=null;if(a.forEach(e=>{e.semver===i&&(e=new r(`>=0.0.0`)),o||=e,s||=e,p(e.semver,o.semver,f)?o=e:h(e.semver,s.semver,f)&&(s=e)}),o.operator===g||o.operator===_||(!s.operator||s.operator===g)&&m(e,s.semver)||s.operator===_&&h(e,s.semver))return!1}return!0}})),Yn=z(((e,t)=>{let n=Jn();t.exports=(e,t,r)=>n(e,t,`>`,r)})),Xn=z(((e,t)=>{let n=Jn();t.exports=(e,t,r)=>n(e,t,`<`,r)})),Zn=z(((e,t)=>{let n=Y();t.exports=(e,t,r)=>(e=new n(e,r),t=new n(t,r),e.intersects(t,r))})),Qn=z(((e,t)=>{let n=Hn(),r=J();t.exports=(e,t,i)=>{let a=[],o=null,s=null,c=e.sort((e,t)=>r(e,t,i));for(let e of c)n(e,t,i)?(s=e,o||=e):(s&&a.push([o,s]),s=null,o=null);o&&a.push([o,null]);let l=[];for(let[e,t]of a)e===t?l.push(e):!t&&e===c[0]?l.push(`*`):t?e===c[0]?l.push(`<=${t}`):l.push(`${e} - ${t}`):l.push(`>=${e}`);let u=l.join(` || `),d=typeof t.raw==`string`?t.raw:String(t);return u.length<d.length?u:t}})),$n=z(((e,t)=>{let n=Y(),r=Vn(),{ANY:i}=r,a=Hn(),o=J(),s=(e,t,r={})=>{if(e===t)return!0;e=new n(e,r),t=new n(t,r);let i=!1;OUTER:for(let n of e.set){for(let e of t.set){let t=u(n,e,r);if(i||=t!==null,t)continue OUTER}if(i)return!1}return!0},c=[new r(`>=0.0.0-0`)],l=[new r(`>=0.0.0`)],u=(e,t,n)=>{if(e===t)return!0;if(e.length===1&&e[0].semver===i){if(t.length===1&&t[0].semver===i)return!0;e=n.includePrerelease?c:l}if(t.length===1&&t[0].semver===i){if(n.includePrerelease)return!0;t=l}let r=new Set,s,u;for(let t of e)t.operator===`>`||t.operator===`>=`?s=d(s,t,n):t.operator===`<`||t.operator===`<=`?u=f(u,t,n):r.add(t.semver);if(r.size>1)return null;let p;if(s&&u&&(p=o(s.semver,u.semver,n),p>0||p===0&&(s.operator!==`>=`||u.operator!==`<=`)))return null;for(let e of r){if(s&&!a(e,String(s),n)||u&&!a(e,String(u),n))return null;for(let r of t)if(!a(e,String(r),n))return!1;return!0}let m,h,g,_,v=u&&!n.includePrerelease&&u.semver.prerelease.length?u.semver:!1,y=s&&!n.includePrerelease&&s.semver.prerelease.length?s.semver:!1;v&&v.prerelease.length===1&&u.operator===`<`&&v.prerelease[0]===0&&(v=!1);for(let e of t){if(_=_||e.operator===`>`||e.operator===`>=`,g=g||e.operator===`<`||e.operator===`<=`,s){if(y&&e.semver.prerelease&&e.semver.prerelease.length&&e.semver.major===y.major&&e.semver.minor===y.minor&&e.semver.patch===y.patch&&(y=!1),e.operator===`>`||e.operator===`>=`){if(m=d(s,e,n),m===e&&m!==s)return!1}else if(s.operator===`>=`&&!a(s.semver,String(e),n))return!1}if(u){if(v&&e.semver.prerelease&&e.semver.prerelease.length&&e.semver.major===v.major&&e.semver.minor===v.minor&&e.semver.patch===v.patch&&(v=!1),e.operator===`<`||e.operator===`<=`){if(h=f(u,e,n),h===e&&h!==u)return!1}else if(u.operator===`<=`&&!a(u.semver,String(e),n))return!1}if(!e.operator&&(u||s)&&p!==0)return!1}return!(s&&g&&!u&&p!==0||u&&_&&!s&&p!==0||y||v)},d=(e,t,n)=>{if(!e)return t;let r=o(e.semver,t.semver,n);return r>0?e:r<0||t.operator===`>`&&e.operator===`>=`?t:e},f=(e,t,n)=>{if(!e)return t;let r=o(e.semver,t.semver,n);return r<0?e:r>0||t.operator===`<`&&e.operator===`<=`?t:e};t.exports=s})),er=z(((e,t)=>{let n=hn(),r=pn(),i=q(),a=_n();t.exports={parse:vn(),valid:yn(),clean:bn(),inc:xn(),diff:Sn(),major:Cn(),minor:wn(),patch:Tn(),prerelease:En(),compare:J(),rcompare:Dn(),compareLoose:On(),compareBuild:kn(),sort:An(),rsort:jn(),gt:Mn(),lt:Nn(),eq:Pn(),neq:Fn(),gte:In(),lte:Ln(),cmp:Rn(),coerce:zn(),Comparator:Vn(),Range:Y(),satisfies:Hn(),toComparators:Un(),maxSatisfying:Wn(),minSatisfying:Gn(),minVersion:Kn(),validRange:qn(),outside:Jn(),gtr:Yn(),ltr:Xn(),intersects:Zn(),simplifyRange:Qn(),subset:$n(),SemVer:i,re:n.re,src:n.src,tokens:n.t,SEMVER_SPEC_VERSION:r.SEMVER_SPEC_VERSION,RELEASE_TYPES:r.RELEASE_TYPES,compareIdentifiers:a.compareIdentifiers,rcompareIdentifiers:a.rcompareIdentifiers}})),tr=fn(),nr=er();const rr=K.create(`downloader`);async function ir(e,t,n,r,i){let a=`This may occur when you are behind proxy.`,o={headers:{"User-Agent":`node `+process.version}};rr.debug({name:e,from:t,to:n,size:r,strict:i},`Downloading file`),t.startsWith(`https:`)&&i===!1&&(o.agent=new j({rejectUnauthorized:!1}));let s=await fetch(t,o);if(rr.debug({name:e,from:t,to:n,size:r,strict:i,status:s.status},`Received download response`),!s.ok||s.status!==200)throw rr.debug({from:t,name:e,status:s.status},`Download failed`),Error(`Error while downloading ${e}, status code: ${s.status}. ${a}`);let c=s.headers.get(`content-length`);if(r&&c&&Number.parseInt(c,10)<r)throw rr.debug({name:e,from:t,to:n,size:r,strict:i,length:c},`Download failed size validation`),Error(`Error while downloading ${e}, file is corrupt. ${a}`);let l=await s.arrayBuffer();return await E(n,new Uint8Array(l)),rr.debug({name:e,from:t,to:n,size:r,strict:i,bytes:l.byteLength},`Downloaded file`),n}var ar=z((e=>{e.require=function(){var e=B(`fs`);if(process.versions.electron)try{e=B(`original-fs`)}catch{}return e}})),or=z(((e,t)=>{t.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,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,FLG_ENC:0,FLG_COMP1:1,FLG_COMP2:2,FLG_DESC:4,FLG_ENH:8,FLG_STR:16,FLG_LNG:1024,FLG_MSK:4096,FILE:0,BUFFER:1,NONE:2,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}})),sr=z(((e,t)=>{t.exports={INVALID_LOC:`Invalid LOC header (bad signature)`,INVALID_CEN:`Invalid CEN header (bad signature)`,INVALID_END:`Invalid END header (bad signature)`,NO_DATA:`Nothing to decompress`,BAD_CRC:`CRC32 checksum failed`,FILE_IN_THE_WAY:`There is a file in the way: %s`,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`,NO_ZIP:`No zip file was loaded`,NO_ENTRY:`Entry doesn't exist`,DIRECTORY_CONTENT_ERROR:`A directory cannot have content`,FILE_NOT_FOUND:`File not found: %s`,NOT_IMPLEMENTED:`Not implemented`,INVALID_FILENAME:`Invalid filename`,INVALID_FORMAT:`Invalid or unsupported zip format. No END header found`}})),cr=z(((e,t)=>{var n=ar().require(),r=B(`path`);n.existsSync=n.existsSync||r.existsSync,t.exports=(function(){var e=[],t=or(),i=sr(),a=r.sep;function o(e){var t=e.split(a)[0];e.split(a).forEach(function(e){if(!(!e||e.substr(-1,1)===`:`)){t+=a+e;var r;try{r=n.statSync(t)}catch{n.mkdirSync(t)}if(r&&r.isFile())throw i.FILE_IN_THE_WAY.replace(`%s`,t)}})}function s(e,t,i){typeof t==`boolean`&&(i=t,t=void 0);var o=[];return n.readdirSync(e).forEach(function(c){var l=r.join(e,c);n.statSync(l).isDirectory()&&i&&(o=o.concat(s(l,t,i))),(!t||t.test(l))&&o.push(r.normalize(l)+(n.statSync(l).isDirectory()?a:``))}),o}return{makeDir:function(e){o(e)},crc32:function(t){typeof t==`string`&&(t=Buffer.alloc(t.length,t));var n=Buffer.alloc(4);if(!e.length)for(var r=0;r<256;r++){for(var i=r,a=8;--a>=0;)i&1?i=3988292384^i>>>1:i>>>=1;i<0&&(n.writeInt32LE(i,0),i=n.readUInt32LE(0)),e[r]=i}for(var o=0,s=0,c=t.length,l=~o;--c>=0;)l=e[(l^t[s++])&255]^l>>>8;return o=~l,n.writeInt32LE(o&4294967295,0),n.readUInt32LE(0)},methodToString:function(e){switch(e){case t.STORED:return`STORED (`+e+`)`;case t.DEFLATED:return`DEFLATED (`+e+`)`;default:return`UNSUPPORTED (`+e+`)`}},writeFileTo:function(e,t,i,a){if(n.existsSync(e)&&(!i||n.statSync(e).isDirectory()))return!1;var s=r.dirname(e);n.existsSync(s)||o(s);var c;try{c=n.openSync(e,`w`,438)}catch{n.chmodSync(e,438),c=n.openSync(e,`w`,438)}if(c)try{n.writeSync(c,t,0,t.length,0)}catch(e){throw e}finally{n.closeSync(c)}return n.chmodSync(e,a||438),!0},writeFileToAsync:function(e,t,i,a,s){typeof a==`function`&&(s=a,a=void 0),n.exists(e,function(c){if(c&&!i)return s(!1);n.stat(e,function(i,l){if(c&&l.isDirectory())return s(!1);var u=r.dirname(e);n.exists(u,function(r){r||o(u),n.open(e,`w`,438,function(r,i){r?n.chmod(e,438,function(){n.open(e,`w`,438,function(r,i){n.write(i,t,0,t.length,0,function(){n.close(i,function(){n.chmod(e,a||438,function(){s(!0)})})})})}):i?n.write(i,t,0,t.length,0,function(){n.close(i,function(){n.chmod(e,a||438,function(){s(!0)})})}):n.chmod(e,a||438,function(){s(!0)})})})})})},findFiles:function(e){return s(e,!0)},getAttributes:function(e){},setAttributes:function(e){},toBuffer:function(e){return Buffer.isBuffer(e)?e:e.length===0?Buffer.alloc(0):Buffer.alloc(e.length,e,`utf8`)},Constants:t,Errors:i}})()})),lr=z(((e,t)=>{var n=ar().require(),r=B(`path`);n.existsSync=n.existsSync||r.existsSync,t.exports=function(e){var t=e||``,i=o(),a=null;function o(){return{directory:!1,readonly:!1,hidden:!1,executable:!1,mtime:0,atime:0}}return t&&n.existsSync(t)?(a=n.statSync(t),i.directory=a.isDirectory(),i.mtime=a.mtime,i.atime=a.atime,i.executable=!!(1&parseInt((a.mode&511).toString(8)[0])),i.readonly=!!(2&parseInt((a.mode&511).toString(8)[0])),i.hidden=r.basename(t)[0]===`.`):console.warn(`Invalid path: `+t),{get directory(){return i.directory},get readOnly(){return i.readonly},get hidden(){return i.hidden},get mtime(){return i.mtime},get atime(){return i.atime},get executable(){return i.executable},decodeAttributes:function(e){},encodeAttributes:function(e){},toString:function(){return`{
18
+ "path" : "`+t+`,
19
+ "isDirectory" : `+i.directory+`,
20
+ "isReadOnly" : `+i.readonly+`,
21
+ "isHidden" : `+i.hidden+`,
22
+ "isExecutable" : `+i.executable+`,
23
+ "mTime" : `+i.mtime+`
24
+ "aTime" : `+i.atime+`
25
+ }`}}}})),ur=z(((e,t)=>{t.exports=cr(),t.exports.FileSystem=ar(),t.exports.Constants=or(),t.exports.Errors=sr(),t.exports.FileAttr=lr()})),dr=z(((e,t)=>{var n=ur(),r=n.Constants;t.exports=function(){var e=10,t=10,i=0,a=0,o=0,s=0,c=0,l=0,u=0,d=0,f=0,p=0,m=0,h=0,g=0,_={};function v(e){e=new Date(e),o=(e.getFullYear()-1980&127)<<25|e.getMonth()+1<<21|e.getDate()<<16|e.getHours()<<11|e.getMinutes()<<5|e.getSeconds()>>1}return v(+new Date),{get made(){return e},set made(t){e=t},get version(){return t},set version(e){t=e},get flags(){return i},set flags(e){i=e},get method(){return a},set method(e){a=e},get time(){return new Date((o>>25&127)+1980,(o>>21&15)-1,o>>16&31,o>>11&31,o>>5&63,(o&31)<<1)},set time(e){v(e)},get crc(){return s},set crc(e){s=e},get compressedSize(){return c},set compressedSize(e){c=e},get size(){return l},set size(e){l=e},get fileNameLength(){return u},set fileNameLength(e){u=e},get extraLength(){return d},set extraLength(e){d=e},get commentLength(){return f},set commentLength(e){f=e},get diskNumStart(){return p},set diskNumStart(e){p=e},get inAttr(){return m},set inAttr(e){m=e},get attr(){return h},set attr(e){h=e},get offset(){return g},set offset(e){g=e},get encripted(){return(i&1)==1},get entryHeaderSize(){return r.CENHDR+u+d+f},get realDataOffset(){return g+r.LOCHDR+_.fnameLen+_.extraLen},get dataHeader(){return _},loadDataHeaderFromBinary:function(e){var t=e.slice(g,g+r.LOCHDR);if(t.readUInt32LE(0)!==r.LOCSIG)throw n.Errors.INVALID_LOC;_={version:t.readUInt16LE(r.LOCVER),flags:t.readUInt16LE(r.LOCFLG),method:t.readUInt16LE(r.LOCHOW),time:t.readUInt32LE(r.LOCTIM),crc:t.readUInt32LE(r.LOCCRC),compressedSize:t.readUInt32LE(r.LOCSIZ),size:t.readUInt32LE(r.LOCLEN),fnameLen:t.readUInt16LE(r.LOCNAM),extraLen:t.readUInt16LE(r.LOCEXT)}},loadFromBinary:function(_){if(_.length!==r.CENHDR||_.readUInt32LE(0)!==r.CENSIG)throw n.Errors.INVALID_CEN;e=_.readUInt16LE(r.CENVEM),t=_.readUInt16LE(r.CENVER),i=_.readUInt16LE(r.CENFLG),a=_.readUInt16LE(r.CENHOW),o=_.readUInt32LE(r.CENTIM),s=_.readUInt32LE(r.CENCRC),c=_.readUInt32LE(r.CENSIZ),l=_.readUInt32LE(r.CENLEN),u=_.readUInt16LE(r.CENNAM),d=_.readUInt16LE(r.CENEXT),f=_.readUInt16LE(r.CENCOM),p=_.readUInt16LE(r.CENDSK),m=_.readUInt16LE(r.CENATT),h=_.readUInt32LE(r.CENATX),g=_.readUInt32LE(r.CENOFF)},dataHeaderToBinary:function(){var e=Buffer.alloc(r.LOCHDR);return e.writeUInt32LE(r.LOCSIG,0),e.writeUInt16LE(t,r.LOCVER),e.writeUInt16LE(i,r.LOCFLG),e.writeUInt16LE(a,r.LOCHOW),e.writeUInt32LE(o,r.LOCTIM),e.writeUInt32LE(s,r.LOCCRC),e.writeUInt32LE(c,r.LOCSIZ),e.writeUInt32LE(l,r.LOCLEN),e.writeUInt16LE(u,r.LOCNAM),e.writeUInt16LE(d,r.LOCEXT),e},entryHeaderToBinary:function(){var n=Buffer.alloc(r.CENHDR+u+d+f);return n.writeUInt32LE(r.CENSIG,0),n.writeUInt16LE(e,r.CENVEM),n.writeUInt16LE(t,r.CENVER),n.writeUInt16LE(i,r.CENFLG),n.writeUInt16LE(a,r.CENHOW),n.writeUInt32LE(o,r.CENTIM),n.writeUInt32LE(s,r.CENCRC),n.writeUInt32LE(c,r.CENSIZ),n.writeUInt32LE(l,r.CENLEN),n.writeUInt16LE(u,r.CENNAM),n.writeUInt16LE(d,r.CENEXT),n.writeUInt16LE(f,r.CENCOM),n.writeUInt16LE(p,r.CENDSK),n.writeUInt16LE(m,r.CENATT),n.writeUInt32LE(h,r.CENATX),n.writeUInt32LE(g,r.CENOFF),n.fill(0,r.CENHDR),n},toString:function(){return`{
26
+ "made" : `+e+`,
27
+ "version" : `+t+`,
28
+ "flags" : `+i+`,
29
+ "method" : `+n.methodToString(a)+`,
30
+ "time" : `+this.time+`,
31
+ "crc" : 0x`+s.toString(16).toUpperCase()+`,
32
+ "compressedSize" : `+c+` bytes,
33
+ "size" : `+l+` bytes,
34
+ "fileNameLength" : `+u+`,
35
+ "extraLength" : `+d+` bytes,
36
+ "commentLength" : `+f+` bytes,
37
+ "diskNumStart" : `+p+`,
38
+ "inAttr" : `+m+`,
39
+ "attr" : `+h+`,
40
+ "offset" : `+g+`,
41
+ "entryHeaderSize" : `+(r.CENHDR+u+d+f)+` bytes
42
+ }`}}}})),fr=z(((e,t)=>{var n=ur(),r=n.Constants;t.exports=function(){var e=0,t=0,i=0,a=0,o=0;return{get diskEntries(){return e},set diskEntries(n){e=t=n},get totalEntries(){return t},set totalEntries(n){t=e=n},get size(){return i},set size(e){i=e},get offset(){return a},set offset(e){a=e},get commentLength(){return o},set commentLength(e){o=e},get mainHeaderSize(){return r.ENDHDR+o},loadFromBinary:function(s){if(s.length!==r.ENDHDR||s.readUInt32LE(0)!==r.ENDSIG)throw n.Errors.INVALID_END;e=s.readUInt16LE(r.ENDSUB),t=s.readUInt16LE(r.ENDTOT),i=s.readUInt32LE(r.ENDSIZ),a=s.readUInt32LE(r.ENDOFF),o=s.readUInt16LE(r.ENDCOM)},toBinary:function(){var n=Buffer.alloc(r.ENDHDR+o);return n.writeUInt32LE(r.ENDSIG,0),n.writeUInt32LE(0,4),n.writeUInt16LE(e,r.ENDSUB),n.writeUInt16LE(t,r.ENDTOT),n.writeUInt32LE(i,r.ENDSIZ),n.writeUInt32LE(a,r.ENDOFF),n.writeUInt16LE(o,r.ENDCOM),n.fill(` `,r.ENDHDR),n},toString:function(){return`{
43
+ "diskEntries" : `+e+`,
44
+ "totalEntries" : `+t+`,
45
+ "size" : `+i+` bytes,
46
+ "offset" : 0x`+a.toString(16).toUpperCase()+`,
47
+ "commentLength" : 0x`+o+`
48
+ }`}}}})),pr=z((e=>{e.EntryHeader=dr(),e.MainHeader=fr()})),mr=z((()=>{})),hr=z(((e,t)=>{var n=B(`buffer`).Buffer;function r(e){var t=32768,r=n.alloc(65536),i=0,a=null,o,s,c=0,l=0,u=-1,d=!1,f=0,p=0,m,h,g,_,v=0,y=[0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535],b=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],x=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,99,99],S=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577],C=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],w=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];function T(e,t,n,r,i,a){this.status=0,this.r=null,this.maxbit=0;var o,s,c,l=[],u=[],d=[],f=[],p={extra:0,bitcnt:0,lbase:0,next:null};c=this.r=null;for(var m=0;m<17;m++)u[m]=0,d[m]=0,l[m]=0;for(m=0;m<288;m++)f[m]=0;o=t>256?e[256]:16;for(var h=-1;++h<t;)u[e[h]]++;if(u[0]!==t){for(var g=1;g<=16&&u[g]===0;g++);var _=g;for(m=16;m!==0&&u[m]===0;m--);var v=m;a<g&&(a=g);for(var y=1<<g;g<m;g++,y<<=1)if((y-=u[g])<0){this.status=2,this.maxbit=a;return}if((y-=u[m])<0){this.status=2,this.maxbit=a;return}u[m]+=y,l[1]=g=0,h=1;for(var b=2;--m>0;)l[b++]=g+=u[h++];h=0,m=0;do(g=e[h++])&&(f[l[g]++]=m);while(++m<t);t=l[v],l[0]=m=0,h=0;for(var x=-1,S=d[0]=0,C=null,w=0,T=[];_<=v;_++)for(var E=u[_];E-- >0;){for(;_>S+d[1+x];){if(S+=d[1+x],x++,w=(w=v-S)>a?a:w,(s=1<<(g=_-S))>E+1)for(s-=E+1,b=_;++g<w&&!((s<<=1)<=u[++b]);)s-=u[b];for(S+g>o&&S<o&&(g=o-S),w=1<<g,d[1+x]=g,C=[];C.length<w;)C.push({extra:0,bitcnt:0,lbase:0,next:null});c=c==null?this.r={next:null,list:null}:c.next={next:null,list:null},c.next=null,c.list=C,T[x]=C,x>0&&(l[x]=m,p.bitcnt=d[x],p.extra=16+g,p.next=C,g=(m&(1<<S)-1)>>S-d[x],T[x-1][g].extra=p.extra,T[x-1][g].bitcnt=p.bitcnt,T[x-1][g].lbase=p.lbase,T[x-1][g].next=p.next)}for(p.bitcnt=_-S,h>=t?p.extra=99:f[h]<n?(p.extra=f[h]<256?16:15,p.lbase=f[h++]):(p.extra=i[f[h]-n],p.lbase=r[f[h++]-n]),s=1<<_-S,g=m>>S;g<w;g+=s)C[g].extra=p.extra,C[g].bitcnt=p.bitcnt,C[g].lbase=p.lbase,C[g].next=p.next;for(g=1<<_-1;(m&g)!==0;g>>=1)m^=g;for(m^=g;(m&(1<<S)-1)!==l[x];)S-=d[x],x--}this.maxbit=d[1],this.status=+(y!==0&&v!==1)}}function E(t){for(;l<t;)c|=e[v++]<<l,l+=8;return c}function D(e){return l-=e,c>>=e}function O(t){for(;l<t;)c|=e[v++]<<l,l+=8;var n=c&y[t];return c>>=t,l-=t,n}function k(e,n,a){var o,s;if(a===0)return 0;for(var c=0;;){for(s=m.list[E(g)&y[g]],o=s.extra;o>16;){if(o===99)return-1;D(s.bitcnt),o-=16,s=s.next[E(o)&y[o]],o=s.extra}if(D(s.bitcnt),o===16){if(i&=t-1,e[n+ c++]=r[i++]=s.lbase,c===a)return a;continue}if(o===15)break;for(f=s.lbase+O(o),s=h.list[E(_)&y[_]],o=s.extra;o>16;){if(o===99)return-1;D(s.bitcnt),o-=16,s=s.next[E(o)&y[o]],o=s.extra}for(D(s.bitcnt),p=i-s.lbase-O(o);f>0&&c<a;)f--,p&=t-1,i&=t-1,e[n+ c++]=r[i++]=r[p++];if(c===a)return a}return u=-1,c}function A(e,n,a){D(l&7);var o=O(16);if(o!==(~O(16)&65535))return-1;for(f=o,o=0;f>0&&o<a;)f--,i&=t-1,e[n+ o++]=r[i++]=O(8);return f===0&&(u=-1),o}function j(e,t,n){var r=0;if(a==null){for(var i=[],c=0;c<144;c++)i[c]=8;for(;c<256;c++)i[c]=9;for(;c<280;c++)i[c]=7;for(;c<288;c++)i[c]=8;s=7;var l=new T(i,288,257,b,x,s);if(l.status!==0)return-1;for(a=l.r,s=l.maxbit,c=0;c<30;c++)i[c]=5;if(r=5,l=new T(i,30,0,S,C,r),l.status>1)return a=null,-1;o=l.r,r=l.maxbit}return m=a,h=o,g=s,_=r,k(e,t,n)}function M(e,t,n){for(var r=Array(572),i=0;i<572;i++)r[i]=0;var a=257+O(5),o=1+O(5),s=4+O(4);if(a>286||o>30)return-1;for(var c=0;c<s;c++)r[w[c]]=O(3);for(;c<19;c++)r[w[c]]=0;g=7;var l=new T(r,19,19,null,null,g);if(l.status!==0)return-1;m=l.r,g=l.maxbit;for(var u=a+o,d=0,f=0;d<u;){var p=m.list[E(g)&y[g]];if(c=p.bitcnt,D(c),c=p.lbase,c<16)r[d++]=f=c;else if(c===16){if(c=3+O(2),d+c>u)return-1;for(;c-- >0;)r[d++]=f}else if(c===17){if(c=3+O(3),d+c>u)return-1;for(;c-- >0;)r[d++]=0;f=0}else{if(c=11+O(7),d+c>u)return-1;for(;c-- >0;)r[d++]=0;f=0}}if(g=9,l=new T(r,a,257,b,x,g),g===0&&(l.status=1),l.status!==0)return-1;for(m=l.r,g=l.maxbit,d=0;d<o;d++)r[d]=r[d+a];return _=6,l=new T(r,o,0,S,C,_),h=l.r,_=l.maxbit,_===0&&a>257||l.status!==0?-1:k(e,t,n)}return{inflate:function(e){m=null;for(var n=e.length,a=0,o;a<n;){if(d&&u===-1)return;if(f>0){if(u!==0)for(;f>0&&a<n;)f--,p&=t-1,i&=t-1,e[a++]=r[i++]=r[p++];else{for(;f>0&&a<n;)f--,i&=t-1,e[a++]=r[i++]=O(8);f===0&&(u=-1)}if(a===n)return}if(u===-1){if(d)break;d=O(1)!==0,u=O(2),m=null,f=0}switch(u){case 0:o=A(e,a,n-a);break;case 1:o=m==null?j(e,a,n-a):k(e,a,n-a);break;case 2:o=m==null?M(e,a,n-a):k(e,a,n-a);break;default:o=-1;break}if(o===-1)return;a+=o}}}}t.exports=function(e){var t=B(`zlib`);return{inflateAsync:function(r){var i=t.createInflateRaw(),a=[],o=0;i.on(`data`,function(e){a.push(e),o+=e.length}),i.on(`end`,function(){var e=n.alloc(o),t=0;e.fill(0);for(var i=0;i<a.length;i++){var s=a[i];s.copy(e,t),t+=s.length}r&&r(e)}),i.end(e)},inflate:function(t){var n={x:new r(e)};n.x.inflate(t),delete n.x}}}})),gr=z((e=>{e.Deflater=mr(),e.Inflater=hr()})),_r=z(((e,t)=>{var n=ur(),r=pr(),i=n.Constants,a=gr();t.exports=function(e){var t=new r.EntryHeader,o=Buffer.alloc(0),s=Buffer.alloc(0),c=!1,l=null,u=Buffer.alloc(0);function d(){return!e||!Buffer.isBuffer(e)?Buffer.alloc(0):(t.loadDataHeaderFromBinary(e),e.slice(t.realDataOffset,t.realDataOffset+t.compressedSize))}function f(e){return!((t.flags&8)!=8&&n.crc32(e)!==t.crc)}function p(e,r,i){if(r===void 0&&typeof e==`string`&&(i=e,e=void 0),c)return e&&r&&r(Buffer.alloc(0),n.Errors.DIRECTORY_CONTENT_ERROR),Buffer.alloc(0);var s=d();if(s.length===0)return e&&r&&r(s,n.Errors.NO_DATA),s;var l=Buffer.alloc(t.size);switch(t.method){case n.Constants.STORED:return s.copy(l),f(l)?(e&&r&&r(l),l):(e&&r&&r(l,n.Errors.BAD_CRC),n.Errors.BAD_CRC);case n.Constants.DEFLATED:var u=new a.Inflater(s);if(e)u.inflateAsync(function(e){e.copy(l,0),f(l)?r&&r(l):r&&r(l,n.Errors.BAD_CRC)});else return u.inflate(l),f(l)||console.warn(n.Errors.BAD_CRC+` `+o.toString()),l;break;default:return e&&r&&r(Buffer.alloc(0),n.Errors.UNKNOWN_METHOD),n.Errors.UNKNOWN_METHOD}}function m(r,i){if((!l||!l.length)&&Buffer.isBuffer(e))return r&&i&&i(d()),d();if(l.length&&!c){var o;switch(t.method){case n.Constants.STORED:return t.compressedSize=t.size,o=Buffer.alloc(l.length),l.copy(o),r&&i&&i(o),o;default:case n.Constants.DEFLATED:var s=new a.Deflater(l);if(r)s.deflateAsync(function(e){o=Buffer.alloc(e.length),t.compressedSize=e.length,e.copy(o),i&&i(o)});else{var u=s.deflate();return t.compressedSize=u.length,u}s=null;break}}else if(r&&i)i(Buffer.alloc(0));else return Buffer.alloc(0)}function h(e,t){return(e.readUInt32LE(t+4)<<4)+e.readUInt32LE(t)}function g(e){for(var t=0,n,r,a;t<e.length;)n=e.readUInt16LE(t),t+=2,r=e.readUInt16LE(t),t+=2,a=e.slice(t,t+r),t+=r,i.ID_ZIP64===n&&_(a)}function _(e){var n,r,a,o;e.length>=i.EF_ZIP64_SCOMP&&(n=h(e,i.EF_ZIP64_SUNCOMP),t.size===i.EF_ZIP64_OR_32&&(t.size=n)),e.length>=i.EF_ZIP64_RHO&&(r=h(e,i.EF_ZIP64_SCOMP),t.compressedSize===i.EF_ZIP64_OR_32&&(t.compressedSize=r)),e.length>=i.EF_ZIP64_DSN&&(a=h(e,i.EF_ZIP64_RHO),t.offset===i.EF_ZIP64_OR_32&&(t.offset=a)),e.length>=i.EF_ZIP64_DSN+4&&(o=e.readUInt32LE(i.EF_ZIP64_DSN),t.diskNumStart===i.EF_ZIP64_OR_16&&(t.diskNumStart=o))}return{get entryName(){return o.toString()},get rawEntryName(){return o},set entryName(e){o=n.toBuffer(e);var r=o[o.length-1];c=r===47||r===92,t.fileNameLength=o.length},get extra(){return u},set extra(e){u=e,t.extraLength=e.length,g(e)},get comment(){return s.toString()},set comment(e){s=n.toBuffer(e),t.commentLength=s.length},get name(){var e=o.toString();return c?e.substr(e.length-1).split(`/`).pop():e.split(`/`).pop()},get isDirectory(){return c},getCompressedData:function(){return m(!1,null)},getCompressedDataAsync:function(e){m(!0,e)},setData:function(e){l=n.toBuffer(e),!c&&l.length?(t.size=l.length,t.method=n.Constants.STORED,t.crc=n.crc32(e),t.changed=!0):t.method=n.Constants.STORED},getData:function(e){return t.changed?l:p(!1,null,e)},getDataAsync:function(e,n){t.changed?e(l):p(!0,e,n)},set attr(e){t.attr=e},get attr(){return t.attr},set header(e){t.loadFromBinary(e)},get header(){return t},packHeader:function(){var e=t.entryHeaderToBinary();return o.copy(e,n.Constants.CENHDR),t.extraLength&&u.copy(e,n.Constants.CENHDR+o.length),t.commentLength&&s.copy(e,n.Constants.CENHDR+o.length+t.extraLength,s.length),e},toString:function(){return`{
49
+ "entryName" : "`+o.toString()+`",
50
+ "name" : "`+(c?o.toString().replace(/\/$/,``).split(`/`).pop():o.toString().split(`/`).pop())+`",
51
+ "comment" : "`+s.toString()+`",
52
+ "isDirectory" : `+c+`,
53
+ "header" : `+t.toString().replace(/\t/gm,` `).replace(/}/gm,` }`)+`,
54
+ "compressedData" : <`+(e&&e.length+` bytes buffer`||`null`)+`>
55
+ "data" : <`+(l&&l.length+` bytes buffer`||`null`)+`>
56
+ }`}}}})),vr=z(((e,t)=>{var n=_r(),r=pr(),i=ur();t.exports=function(e,t){var a=[],o={},s=Buffer.alloc(0),c=``,l=i.FileSystem.require(),u=null,d=new r.MainHeader;t===i.Constants.FILE?(c=e,u=l.readFileSync(c),p()):t===i.Constants.BUFFER&&(u=e,p());function f(){o={},a=Array(d.diskEntries);for(var e=d.offset,t=0;t<a.length;t++){var r=e,s=new n(u);s.header=u.slice(r,r+=i.Constants.CENHDR),s.entryName=u.slice(r,r+=s.header.fileNameLength),s.header.extraLength&&(s.extra=u.slice(r,r+=s.header.extraLength)),s.header.commentLength&&(s.comment=u.slice(r,r+s.header.commentLength)),e+=s.header.entryHeaderSize,a[t]=s,o[s.entryName]=s}}function p(){for(var e=u.length-i.Constants.ENDHDR,t=Math.max(0,e-65535),n=-1;e>=t;e--)if(u[e]===80&&u.readUInt32LE(e)===i.Constants.ENDSIG){n=e;break}if(!~n)throw i.Errors.INVALID_FORMAT;d.loadFromBinary(u.slice(n,n+i.Constants.ENDHDR)),d.commentLength&&(s=u.slice(n+i.Constants.ENDHDR)),f()}return{get entries(){return a},get comment(){return s.toString()},set comment(e){d.commentLength=e.length,s=e},getEntry:function(e){return o[e]||null},setEntry:function(e){a.push(e),o[e.entryName]=e,d.totalEntries=a.length},deleteEntry:function(e){var t=o[e];if(t&&t.isDirectory){var n=this;this.getEntryChildren(t).forEach(function(t){t.entryName!==e&&n.deleteEntry(t.entryName)})}a.splice(a.indexOf(t),1),delete o[e],d.totalEntries=a.length},getEntryChildren:function(e){if(e.isDirectory){var t=[],n=e.entryName,r=n.length;return a.forEach(function(e){e.entryName.substr(0,r)===n&&t.push(e)}),t}return[]},compressToBuffer:function(){a.length>1&&a.sort(function(e,t){var n=e.entryName.toLowerCase(),r=t.entryName.toLowerCase();return n<r?-1:+(n>r)});var e=0,t=[],n=[],r=0;d.size=0,d.offset=0,a.forEach(function(i){var a=i.getCompressedData();i.header.offset=r;var o=i.header.dataHeaderToBinary(),s=i.entryName+i.extra.toString(),c=Buffer.alloc(s.length,s),l=o.length+c.length+a.length;r+=l,t.push(o),t.push(c),t.push(a);var u=i.packHeader();n.push(u),d.size+=u.length,e+=l+u.length}),e+=d.mainHeaderSize,d.offset=r,r=0;var o=Buffer.alloc(e);t.forEach(function(e){e.copy(o,r),r+=e.length}),n.forEach(function(e){e.copy(o,r),r+=e.length});var c=d.toBinary();return s&&s.copy(c,i.Constants.ENDHDR),c.copy(o,r),o},toAsyncBuffer:function(e,t,n,r){a.length>1&&a.sort(function(e,t){var n=e.entryName.toLowerCase(),r=t.entryName.toLowerCase();return n>r?-1:+(n<r)});var o=0,c=[],l=[],u=0;d.size=0,d.offset=0,function(t){var a=arguments.callee;if(t.length){var f=t.pop(),p=f.entryName+f.extra.toString();n&&n(p),f.getCompressedDataAsync(function(n){r&&r(p),f.header.offset=u;var m=f.header.dataHeaderToBinary(),h=Buffer.alloc(p),g=m.length+h.length+n.length;u+=g,c.push(m),c.push(h),c.push(n);var _=f.packHeader();if(l.push(_),d.size+=_.length,o+=g+_.length,t.length)a(t);else{o+=d.mainHeaderSize,d.offset=u,u=0;var v=Buffer.alloc(o);c.forEach(function(e){e.copy(v,u),u+=e.length}),l.forEach(function(e){e.copy(v,u),u+=e.length});var y=d.toBinary();s&&s.copy(y,i.Constants.ENDHDR),y.copy(v,u),e(v)}})}}(a)}}}})),yr=le(z(((e,t)=>{var n=ur(),r=n.FileSystem.require(),i=B(`path`);r.existsSync=r.existsSync||i.existsSync;var a=_r(),o=vr();/^win/.test(process.platform),t.exports=function(e){var t=void 0,s=``;if(e&&typeof e==`string`)if(r.existsSync(e))s=e,t=new o(e,n.Constants.FILE);else throw n.Errors.INVALID_FILENAME;else t=e&&Buffer.isBuffer(e)?new o(e,n.Constants.BUFFER):new o(null,n.Constants.NONE);function c(e,t){e=i.resolve(i.normalize(e));for(var n=t.split(`/`),r=0,a=n.length;r<a;r++){var o=i.normalize(i.join(e,n.slice(r,a).join(i.sep)));if(o.indexOf(e)===0)return o}return i.normalize(i.join(e,i.basename(t)))}function l(e){if(e&&t){var n;if(typeof e==`string`&&(n=t.getEntry(e)),typeof e==`object`&&e.entryName!==void 0&&e.header!==void 0&&(n=t.getEntry(e.entryName)),n)return n}return null}return{readFile:function(e){var t=l(e);return t&&t.getData()||null},readFileAsync:function(e,t){var n=l(e);n?n.getDataAsync(t):t(null,`getEntry failed for:`+e)},readAsText:function(e,t){var n=l(e);if(n){var r=n.getData();if(r&&r.length)return r.toString(t||`utf8`)}return``},readAsTextAsync:function(e,t,n){var r=l(e);r?r.getDataAsync(function(e){e&&e.length?t(e.toString(n||`utf8`)):t(``)}):t(``)},deleteFile:function(e){var n=l(e);n&&t.deleteEntry(n.entryName)},addZipComment:function(e){t.comment=e},getZipComment:function(){return t.comment||``},addZipEntryComment:function(e,t){var n=l(e);n&&(n.comment=t)},getZipEntryComment:function(e){var t=l(e);return t&&t.comment||``},updateFile:function(e,t){var n=l(e);n&&n.setData(t)},addLocalFile:function(e,t,i){if(r.existsSync(e)){t?(t=t.split(`\\`).join(`/`),t.charAt(t.length-1)!==`/`&&(t+=`/`)):t=``;var a=e.split(`\\`).join(`/`).split(`/`).pop();i?this.addFile(t+i,r.readFileSync(e),``,0):this.addFile(t+a,r.readFileSync(e),``,0)}else throw n.Errors.FILE_NOT_FOUND.replace(`%s`,e)},addLocalFolder:function(e,t,a){if(a===void 0?a=function(){return!0}:a instanceof RegExp&&(a=function(e){return function(t){return e.test(t)}}(a)),t?(t=t.split(`\\`).join(`/`),t.charAt(t.length-1)!==`/`&&(t+=`/`)):t=``,e=i.normalize(e),e=e.split(`\\`).join(`/`),e.charAt(e.length-1)!==`/`&&(e+=`/`),r.existsSync(e)){var o=n.findFiles(e),s=this;o.length&&o.forEach(function(n){var i=n.split(`\\`).join(`/`).replace(new RegExp(e.replace(/(\(|\))/g,`\\$1`),`i`),``);a(i)&&(i.charAt(i.length-1)===`/`?s.addFile(t+i,Buffer.alloc(0),``,0):s.addFile(t+i,r.readFileSync(n),``,0))})}else throw n.Errors.FILE_NOT_FOUND.replace(`%s`,e)},addFile:function(e,n,r,i){var o=new a;o.entryName=e,o.comment=r||``,i||=o.isDirectory?1106051088:420<<16,o.attr=i,o.setData(n),t.setEntry(o)},getEntries:function(){return t?t.entries:[]},getEntry:function(e){return l(e)},extractEntryTo:function(e,a,o,s){s||=!1,o=o===void 0?!0:o;var u=l(e);if(!u)throw n.Errors.NO_ENTRY;var d=u.entryName,f=c(a,o?d:i.basename(d));if(u.isDirectory)return f=i.resolve(f,`..`),t.getEntryChildren(u).forEach(function(e){if(!e.isDirectory){var t=e.getData();if(!t)throw n.Errors.CANT_EXTRACT_FILE;var r=c(a,o?e.entryName:i.basename(e.entryName));n.writeFileTo(r,t,s)}}),!0;var p=u.getData();if(!p)throw n.Errors.CANT_EXTRACT_FILE;if(r.existsSync(f)&&!s)throw n.Errors.CANT_OVERRIDE;return n.writeFileTo(f,p,s),!0},test:function(){if(!t)return!1;for(var e in t.entries)try{if(e.isDirectory)continue;if(!t.entries[e].getData())return!1}catch{return!1}return!0},extractAllTo:function(e,i){if(i||=!1,!t)throw n.Errors.NO_ZIP;t.entries.forEach(function(t){var a=c(e,t.entryName.toString());if(t.isDirectory){n.makeDir(a);return}var o=t.getData();if(!o)throw n.Errors.CANT_EXTRACT_FILE;n.writeFileTo(a,o,i),r.utimesSync(a,t.header.time,t.header.time)})},extractAllToAsync:function(e,a,o){if(o||=function(){},a||=!1,!t){o(Error(n.Errors.NO_ZIP));return}var s=t.entries,l=s.length;s.forEach(function(t){if(!(l<=0)){var s=i.normalize(t.entryName.toString());if(t.isDirectory){n.makeDir(c(e,s)),--l===0&&o(void 0);return}t.getDataAsync(function(u){if(!(l<=0)){if(!u){l=0,o(Error(n.Errors.CANT_EXTRACT_FILE));return}n.writeFileToAsync(c(e,s),u,a,function(n){if(r.utimesSync(i.resolve(e,s),t.header.time,t.header.time),!(l<=0)){if(!n){l=0,o(Error(`Unable to write`));return}--l===0&&o(void 0)}})}})}})},writeZip:function(e,r){if(arguments.length===1&&typeof e==`function`&&(r=e,e=``),!e&&s&&(e=s),e){var i=t.compressToBuffer();if(i){var a=n.writeFileTo(e,i,!0);typeof r==`function`&&r(a?null:Error(`failed`),``)}}},toBuffer:function(e,n,r,i){return this.valueOf=2,typeof e==`function`?(t.toAsyncBuffer(e,n,r,i),null):t.compressToBuffer()}}}}))(),1);const br=K.create(`zip`);var xr=class{},Sr=class extends xr{constructor(e){super(),this.signature=e}verify(e){let t=this.signature.path,n=e.getEntries();n.sort((e,t)=>e.entryName.localeCompare(t.entryName));let r=e.readAsText(t),i=A.createVerify(`RSA-SHA512`);return n.forEach(e=>{e.entryName!==t&&i.update(new Uint8Array(e.getData()))}),i.verify(this.signature.key,r,`base64`)}};async function Cr(e){let t=new yr.default(e.from);if(br.debug({from:e.from,to:e.to},`Extracting zip archive`),await wr(e.to),e.verifier&&!await e.verifier.verify(t))throw br.error({from:e.from},`Archive signature verification failed`),Error(`Could not verify archive signature`);return e.verifier&&br.debug({from:e.from},`Verified archive signature`),await new Promise((n,r)=>{t.extractAllToAsync(e.to,!0,e=>{e?r(e):n()})}),br.debug({from:e.from,to:e.to},`Extracted zip archive`),{extractTo:e.to}}async function wr(e){try{if(!(await w(e)).isDirectory())throw Error(`Extraction target must be a directory: ${e}`)}catch(e){if(!(e instanceof Error)||!(`code`in e)||e.code!==`ENOENT`)throw e}}const Tr=_(new URL(`..`,import.meta.url));var X={version:JSON.parse(h(i(Tr,`package.json`),`utf-8`)).version,paths:{dirs:{package:{bin:i(Tr,`bin`)},home:i(l(),`.wallaby`),current:i(l(),`.wallaby`,`cli`)}}};const Er=i(X.paths.dirs.home,`key.lic`),Z=K.create(`core/installer`),Dr={downloads:i(X.paths.dirs.current,`downloads`),versions:i(X.paths.dirs.current,`wallaby.json`),manifest:i(X.paths.dirs.current,`core.json`),pinned:i(X.paths.dirs.current,`pinned.version`)};function Or(){try{let e=e=>e&&e.replace(/^\s+|\s+$/gm,``),t=W.default.readFileSync(Er).toString();if(t){let n=t.split(`:`);n.length===2&&(t=e(n[1]))}return Buffer.from(t,`base64`).toString().split(`
57
+ `)[2]}catch{}}var kr=class extends Sr{version=``;date=new Date(NaN);constructor(){super({path:`signature.txt`,key:`-----BEGIN RSA PUBLIC KEY-----
58
+ MIIBCgKCAQEAngwMnSkF1zlHJggr7kXXO02ytYIlzMdvQxHu6hli+TFIeO72HNfK
59
+ P27g+f8EtlPRB0UwnpAHtkJHNCdwpo04eU8hS8g9vbmNf00luUJGuUHnf62Pp0EI
60
+ KbGKJvzkdPgfs62MItfi4uf+XiHa8rN0Bk7hRbddI1zA4Wupf/E0wZ7UorgCE9XB
61
+ EM6VULphGdHorpmHBW5deeCHIledtMOpOfDSM5lvjiqgVqmjNYT+WXCwjN8yCcyU
62
+ oedY3afSHTyqiuInKcpXd+VJQb2+d7y583Pb3+kDGraBMGFJaWGewm7+IYIlgk5C
63
+ uk54FsjCvwvaa0SKr2rkIBKuyFX3ZGymyQIDAQAB
64
+ -----END RSA PUBLIC KEY-----`})}verify(e){this.version=JSON.parse(e.readAsText(`package.json`)).version,this.date=new Date(e.getEntry(`package.json`).header.time),this.date.setMinutes(this.date.getMinutes()-this.date.getTimezoneOffset());let[t,n,r]=this.version.split(`.`).map(e=>Number.parseInt(e,10));return t>1||n>0||r>1091?super.verify(e):!0}};async function Ar(e,t,n,r){let a=!1;Z.debug({path:t,latest:n,reuse:r,ssl:e},`Resolving distribution with update policy`);let o=new Nr,s=Or(),c=e===`off`?`http`:`https`,l=`${c}://update.wallabyjs.com/`,u=l,d=t=>ir(`version`,`${t}wallaby.json?${s?`expiry=`+s.replace(/\//g,`-`):``}`,Dr.versions,void 0,e!==`relaxed`),f=o.pinned,p=n?!1:!!t&&W.default.existsSync(t),m=i(Dr.downloads,`wallaby.zip`);if(!p&&!n&&W.default.existsSync(m))try{t=await Mr(m),p=!!t&&W.default.existsSync(t),a=!0,Z.debug({path:t},`Recovered from cached archive`)}catch(e){Z.info({error:e,distFilePath:m},`Failed to recover from cached archive`)}let h;if(r&&p)h=o.read(t),Z.debug({path:t,latestVersion:h},`Using installed version`);else{let e=Fr(`Downloading version file`);try{try{await d(l)}catch{u=`${c}://s3.amazonaws.com/wallaby-downloads/`,Z.debug({downloadUrl:u},`Falling back to S3 metadata endpoint`),await d(`http://update.wallabyjs.com/`)}}finally{e()}h=o.latest,Z.debug({latestVersion:h},`Fetched latest version`)}if(f&&(h&&(0,nr.gt)(f,h)?await o.unpin():h=f,Z.debug({pinnedVersion:f,latestVersion:h},`Applied pinned version policy`)),!(p&&o.read(t)===h))try{t=await jr(`core`,`${u}wallaby-v${h}.zip`,e),a=!0}catch{Z.info({latestVersion:h},`Primary download failed, falling back to S3 archive`),t=await jr(`core`,`${c}://s3.amazonaws.com/wallaby-downloads/wallaby-v${h}.zip`,e),a=!0}return Z.debug({path:t,updated:a,latestVersion:h},`Resolved dist`),{path:t,updated:a,type:`dist`}}async function jr(e,t,n){Z.debug({name:e,from:t,ssl:n},`Downloading and extracting dist`);let r=Fr(`Downloading core`),a=i(Dr.downloads,`wallaby.zip`);try{W.default.ensureDirSync(Dr.downloads),await ir(e,t,a,2e6,n!==`relaxed`)}finally{r()}let o=Fr(`Extracting core`);try{return await Mr(a)}catch(t){throw Z.error({error:t,downloadedArchiveFilePath:a},`Failed to extract archive`),Error(`Error while unzipping wallaby.js ${e} file: ${t instanceof Error?t.message:String(t)}`,{cause:t})}finally{o()}}async function Mr(e){let t=A.randomBytes(3).toString(`hex`),n=i(X.paths.dirs.current,`wallaby`+t);for(;W.default.existsSync(n);)t=A.randomBytes(3).toString(`hex`),n=i(X.paths.dirs.current,`wallaby`+t);let r=new kr;await Cr({from:e,to:n,verifier:r});let a=new Nr().register(t,r.date.getTime());return Z.debug({from:e,to:{extracted:n,registered:a}},`Extracted dist`),a}var Nr=class{_logger=K.create(`core/installer/vm`);_paths;constructor(e){this._paths={pinned:e?.pinned??Dr.pinned,manifest:e?.manifest??Dr.manifest,versions:e?.versions??Dr.versions}}get pinned(){if(W.default.existsSync(this._paths.pinned)){let e=W.default.readFileSync(this._paths.pinned,`utf-8`);return this._logger.debug({version:e},`Read pinned version`),e}}get latest(){let e=JSON.parse(W.default.readFileSync(this._paths.versions).toString()),t;return e.latestServer.forEach(e=>{e.substring(0,e.lastIndexOf(`.`))===X.version.substring(0,e.lastIndexOf(`.`))&&(t=e)}),this._logger.debug({latest:t},`Resolved latest known version`),t}async pin(e){this._logger.info({version:e},`Pinning version`),await E(this._paths.pinned,e)}async unpin(){if(W.default.existsSync(this._paths.pinned))return this._logger.debug(`Removing pinned version`),await T(this._paths.pinned)}refresh(e,t=!1){let n;if(!e)try{e=JSON.parse(W.default.readFileSync(this._paths.manifest).toString())}catch{}e||={},this._logger.debug({manifestEntries:Object.keys(e).length},`Resolving installed core from manifest`);let a;try{let[e,t,n]=Or().split(`/`);a=new Date(Date.UTC(Number.parseInt(n,10),Number.parseInt(t,10)-1,Number.parseInt(e,10))).getTime()}catch{}let o=this.pinned,s=Object.keys(e).map(t=>{let n=i(i(X.paths.dirs.current,`wallaby`+t),`package.json`),r=o&&W.default.existsSync(n)?JSON.parse(W.default.readFileSync(n,`utf-8`)).version:void 0;return{id:t,pinned:o?r===o:!1,package:n,...e[t]}}).sort((e,t)=>t.releaseDate-e.releaseDate),c=new Date().getTime()-1e3*60*60*24*5;s.forEach(n=>{W.default.existsSync(n.package)?!n.pinned&&n.invalidated&&Object.keys(n.expiry).length===0&&n.invalidated<c&&(t=!0,delete e[n.id],W.default.remove(r(n.package)).catch(e=>{this._logger.warn({error:e,path:n.package},`Failed to remove invalidated core directory`)})):(t=!0,delete e[n.id])});let l=s.filter(t=>(!a||t.releaseDate<a)&&e[t.id]);if(l.length){if(a&&a<new Date().getTime()&&!e[l[0].id].expiry[a]){e[l[0].id].expiry[a]=!0;for(let t=1;t<l.length;t++)delete e[l[t].id].expiry[a];t=!0}let r=o?(l.find(e=>e.pinned)||l.find(e=>!e.invalidated)||l[0]).id:(l.find(e=>!e.invalidated)||l[0]).id;n=i(X.paths.dirs.current,`wallaby`+r),this._logger.debug({coreFolder:n,pinnedVersion:o},`Selected installed core folder`)}return t&&(W.default.writeFileSync(this._paths.manifest,JSON.stringify(e)),this._logger.debug({coreVersionManifest:this._paths.manifest},`Saved updated core manifest`)),n}register(e,t){let n;try{n=JSON.parse(W.default.readFileSync(this._paths.manifest).toString());let e=new Date().getTime();Object.keys(n).forEach(r=>{!n[r].invalidated&&n[r].releaseDate<=t&&(n[r].invalidated=e)})}catch{n={}}return n[e]={releaseDate:t,invalidated:!1,expiry:{}},this._logger.debug({id:e,releaseDate:t},`Added new core version to manifest`),this.refresh(n,!0)}read(e){let t=JSON.parse(W.default.readFileSync(i(e,`package.json`)).toString()).version;return this._logger.debug({path:e,version:t},`Read version`),t}async handle(e){return e=e?.trim(),e?e===`0`?{update:!1,fresh:!0}:e===`latest`?(await this.unpin(),{update:!0,fresh:!0}):(await this.pin(e.startsWith(`v`)?e.slice(1):e),{update:!1,fresh:!0}):{update:!1,fresh:!1}}},Pr=class{_timeout;_retry=0;_dist;_restarter;get dist(){return this._dist}clear(){this._dist=void 0}set restarter(e){this._restarter=e}stop(){clearTimeout(this._timeout),this._timeout=void 0}async check(e,t){try{Z.debug({path:e},`Performing update check`);let n=await Ar(t,e);if(n.updated){this._dist=n;let e=new Nr().read(n.path);Z.debug({path:n.path,version:e},`Core update downloaded`),this._restarter?.restart(e),this._retry=0}}catch(t){this._retry++,Z.info({error:t,path:e,retry:this._retry},`Scheduled update check failed`)}finally{this._retry<=3?this.schedule(this._dist?.path||e,t):Z.warn({path:e,retry:this._retry},`Stopped scheduling update checks after repeated failures`)}}schedule(e,t){this.stop(),Z.debug({path:e},`Scheduled update check`),this._timeout=setTimeout(async()=>await this.check(e,t),600*1e3)}};function Fr(e){let t=new tr.Spinner;return t.setSpinnerString(4),t.setSpinnerDelay(250),t.setSpinnerTitle(` ${G.default.green(`%s`)} ${e}`),t.start(),()=>t.stop(!0)}const Ir=K.create(`core/locator`),Lr=e(import.meta.url);r(_(import.meta.url));async function Rr(e){try{let e=Lr.resolve(`@wallabyjs/core`);if(await W.default.pathExists(e))return Ir.info({path:e},`Using installed @wallabyjs/core package`),{path:e,type:`npm`}}catch(e){Ir.debug({error:e},`No installed @wallabyjs/core package found`)}let t=await e();if(!t)throw Error(`Could not locate installed Wallaby Core`);return t}const Q=K.create(`core/launcher`);var zr=class e{location;version;_process;_ready=e._createDeferred();_exited=e._createDeferred();_stopping=e._createDeferred();_interrupted=!1;_cleaned=!1;_tail=``;constructor(e,t,n){this._process=e,this.location=t,this.version=n,this._attach(),e.pid||this._fail(Error(`Failed to start Wallaby process: no PID`))}async exited(){let e=this._exited.promise,{promise:t,cleanup:n}=this._waitShutdown();try{await Promise.race([this.ready,t,e]),await e}finally{n()}}get ready(){return this._ready.promise}get stopping(){return this._stopping.promise}release(){Q.debug({pid:this._process.pid},`Releasing process handle`),this._cleanup(),this._process.stdout.destroy(),this._process.stderr.destroy(),this._process.unref()}async stop(){if(!this._interrupted&&(this._interrupted=!0,this._stopping.resolve(),Q.debug({pid:this._process.pid},`Stopping process`),!(this._process.exitCode!==null||this._process.signalCode!==null)&&!this._process.kill(`SIGINT`)))throw Error(`Failed to terminate Wallaby process`)}_attach(){this._process.stdout.on(`data`,this._onStdOut),this._process.stderr.on(`data`,this._onStdError),this._process.on(`error`,this._onError),this._process.on(`exit`,this._onExit)}_waitShutdown(){let e=new Map,t=!1,n=[`SIGINT`,`SIGTERM`];return{promise:new Promise((r,i)=>{for(let a of n){let n=()=>{t||(t=!0,this._handleShutdown(a).then(r,i))};e.set(a,n),process.on(a,n)}}),cleanup:()=>{for(let[t,n]of e)process.off(t,n)}}}async _handleShutdown(e){Q.debug({signal:e},`Received shutdown signal`),await this.stop()}_onStdOut=e=>{if(this._tail===void 0)return;let t=this._tail+e.toString(`utf8`),n=t.match(/wallaby\.js started, port=(\d+)/);if(n){delete this._tail,this._process.stdout.off(`data`,this._onStdOut),this._ready.resolve(Number.parseInt(n[1],10));return}this._tail=t};_onStdError=e=>{let t=e.toString(`utf8`);Q.warn({stderr:t}),this._tail!==void 0&&process.stdout.write(t)};_onError=e=>{Q.error({error:e},`Process emitted an error`),this._fail(e,this._tail===void 0?`Wallaby process crashed`:`Wallaby process failed to start`),this._cleanup()};_onExit=(t,n)=>{Q.info({code:t,signal:n},`Process exited`),this._tail!==void 0&&this._ready.reject(e._createExitError(`Wallaby exited unexpectedly before startup completed`,t,n)),this._interrupted?this._exited.resolve():this._exited.reject(e._createExitError(`Wallaby exited unexpectedly`,t,n)),this._cleanup()};_cleanup(){this._cleaned||(this._cleaned=!0,this._process.stdout.off(`data`,this._onStdOut),this._process.stderr.off(`data`,this._onStdError),this._process.off(`error`,this._onError),this._process.off(`exit`,this._onExit))}_fail(e,t){let n=t?Error(`${t}: ${e.message}`):e;this._ready.reject(n),this._interrupted?this._exited.resolve():this._exited.reject(n)}static _createDeferred(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}static _createExitError(e,t,n){let r=``;return n&&(r=` (signal: ${n})`),t!==null&&(r=` (code: ${t})`),Error(`${e}${r}.`)}};async function Br(e,t,n){n?.stop();let r=await t.handle(e.update);r.fresh&&n?.clear();let a=async()=>await Ar(e.ssl,t.refresh(),r.update,!0),o=r.fresh?await Rr(a):n?.dist||await Rr(a);Q.debug({...o},`Located target to launch`);let s=Vr(e,t.pinned),c=t.read(o.path),[,,l]=c.split(`.`);if(Number.parseInt(l,10)<2033)throw Q.debug({revision:l},`Refusing to start unsupported version`),Error(`Wallaby Core v${c} is not supported by Wallaby CLI v ${X.version}.\nRun with --update flag to get the latest version of Wallaby Core.`);Q.info({args:s,revision:l},`Launching process`);let u=ee(process.execPath,[i(o.path,`server.js`),`extended-core-ws`,...s],{stdio:[`ignore`,`pipe`,`pipe`]});return Q.info({pid:u.pid},`Launched process`),new zr(u,o,c)}function Vr(e,t){let n=[`--port=0`,`--lkp=${Er}`,`--cli=${X.version}`,`--customNodeVersion=0`,`--capabilities=js`];return e.config&&n.push(`--configPath=${s(e.config)}`),e.smart&&n.push(`--smartStart=true`),t&&n.push(`--pinned=`+t),e.ignoreRunResultCache&&n.push(`--ignoreRunResultCache`),e.skill&&n.push(`--skill`),n}const Hr=K.create(`core/registry`);var Ur=class{constructor(e=i(X.paths.dirs.home,`registry`)){this._storeDirPath=e,p(this._storeDirPath)||m(this._storeDirPath,{recursive:!0})}get manifests(){let e=[];try{for(let t of g(this._storeDirPath))if(t.endsWith(`.json`))try{let n=JSON.parse(h(i(this._storeDirPath,t),`utf8`));e.push(n)}catch(e){Hr.trace({error:e},`Failed to read manifest`)}}catch(e){Hr.error({error:e},`Failed to read registry directory`)}return e}},Wr=z(((e,t)=>{let n=[`nodebuffer`,`arraybuffer`,`fragments`],r=typeof Blob<`u`;r&&n.push(`blob`),t.exports={BINARY_TYPES:n,CLOSE_TIMEOUT:3e4,EMPTY_BUFFER:Buffer.alloc(0),GUID:`258EAFA5-E914-47DA-95CA-C5AB0DC85B11`,hasBlob:r,kForOnEventAttribute:Symbol(`kIsForOnEventAttribute`),kListener:Symbol(`kListener`),kStatusCode:Symbol(`status-code`),kWebSocket:Symbol(`websocket`),NOOP:()=>{}}})),Gr=z(((e,t)=>{let{EMPTY_BUFFER:n}=Wr(),r=Buffer[Symbol.species];function i(e,t){if(e.length===0)return n;if(e.length===1)return e[0];let i=Buffer.allocUnsafe(t),a=0;for(let t=0;t<e.length;t++){let n=e[t];i.set(n,a),a+=n.length}return a<t?new r(i.buffer,i.byteOffset,a):i}function a(e,t,n,r,i){for(let a=0;a<i;a++)n[r+a]=e[a]^t[a&3]}function o(e,t){for(let n=0;n<e.length;n++)e[n]^=t[n&3]}function s(e){return e.length===e.buffer.byteLength?e.buffer:e.buffer.slice(e.byteOffset,e.byteOffset+e.length)}function c(e){if(c.readOnly=!0,Buffer.isBuffer(e))return e;let t;return e instanceof ArrayBuffer?t=new r(e):ArrayBuffer.isView(e)?t=new r(e.buffer,e.byteOffset,e.byteLength):(t=Buffer.from(e),c.readOnly=!1),t}if(t.exports={concat:i,mask:a,toArrayBuffer:s,toBuffer:c,unmask:o},!process.env.WS_NO_BUFFER_UTIL)try{let e=B(`bufferutil`);t.exports.mask=function(t,n,r,i,o){o<48?a(t,n,r,i,o):e.mask(t,n,r,i,o)},t.exports.unmask=function(t,n){t.length<32?o(t,n):e.unmask(t,n)}}catch{}})),Kr=z(((e,t)=>{let n=Symbol(`kDone`),r=Symbol(`kRun`);t.exports=class{constructor(e){this[n]=()=>{this.pending--,this[r]()},this.concurrency=e||1/0,this.jobs=[],this.pending=0}add(e){this.jobs.push(e),this[r]()}[r](){if(this.pending!==this.concurrency&&this.jobs.length){let e=this.jobs.shift();this.pending++,e(this[n])}}}})),qr=z(((e,t)=>{let n=B(`zlib`),r=Gr(),i=Kr(),{kStatusCode:a}=Wr(),o=Buffer[Symbol.species],s=Buffer.from([0,0,255,255]),c=Symbol(`permessage-deflate`),l=Symbol(`total-length`),u=Symbol(`callback`),d=Symbol(`buffers`),f=Symbol(`error`),p;t.exports=class{constructor(e){this._options=e||{},this._threshold=this._options.threshold===void 0?1024:this._options.threshold,this._maxPayload=this._options.maxPayload|0,this._isServer=!!this._options.isServer,this._deflate=null,this._inflate=null,this.params=null,p||=new i(this._options.concurrencyLimit===void 0?10:this._options.concurrencyLimit)}static get extensionName(){return`permessage-deflate`}offer(){let e={};return this._options.serverNoContextTakeover&&(e.server_no_context_takeover=!0),this._options.clientNoContextTakeover&&(e.client_no_context_takeover=!0),this._options.serverMaxWindowBits&&(e.server_max_window_bits=this._options.serverMaxWindowBits),this._options.clientMaxWindowBits?e.client_max_window_bits=this._options.clientMaxWindowBits:this._options.clientMaxWindowBits??(e.client_max_window_bits=!0),e}accept(e){return e=this.normalizeParams(e),this.params=this._isServer?this.acceptAsServer(e):this.acceptAsClient(e),this.params}cleanup(){if(this._inflate&&=(this._inflate.close(),null),this._deflate){let e=this._deflate[u];this._deflate.close(),this._deflate=null,e&&e(Error(`The deflate stream was closed while data was being processed`))}}acceptAsServer(e){let t=this._options,n=e.find(e=>!(t.serverNoContextTakeover===!1&&e.server_no_context_takeover||e.server_max_window_bits&&(t.serverMaxWindowBits===!1||typeof t.serverMaxWindowBits==`number`&&t.serverMaxWindowBits>e.server_max_window_bits)||typeof t.clientMaxWindowBits==`number`&&!e.client_max_window_bits));if(!n)throw Error(`None of the extension offers can be accepted`);return t.serverNoContextTakeover&&(n.server_no_context_takeover=!0),t.clientNoContextTakeover&&(n.client_no_context_takeover=!0),typeof t.serverMaxWindowBits==`number`&&(n.server_max_window_bits=t.serverMaxWindowBits),typeof t.clientMaxWindowBits==`number`?n.client_max_window_bits=t.clientMaxWindowBits:(n.client_max_window_bits===!0||t.clientMaxWindowBits===!1)&&delete n.client_max_window_bits,n}acceptAsClient(e){let t=e[0];if(this._options.clientNoContextTakeover===!1&&t.client_no_context_takeover)throw Error(`Unexpected parameter "client_no_context_takeover"`);if(!t.client_max_window_bits)typeof this._options.clientMaxWindowBits==`number`&&(t.client_max_window_bits=this._options.clientMaxWindowBits);else if(this._options.clientMaxWindowBits===!1||typeof this._options.clientMaxWindowBits==`number`&&t.client_max_window_bits>this._options.clientMaxWindowBits)throw Error(`Unexpected or invalid parameter "client_max_window_bits"`);return t}normalizeParams(e){return e.forEach(e=>{Object.keys(e).forEach(t=>{let n=e[t];if(n.length>1)throw Error(`Parameter "${t}" must have only a single value`);if(n=n[0],t===`client_max_window_bits`){if(n!==!0){let e=+n;if(!Number.isInteger(e)||e<8||e>15)throw TypeError(`Invalid value for parameter "${t}": ${n}`);n=e}else if(!this._isServer)throw TypeError(`Invalid value for parameter "${t}": ${n}`)}else if(t===`server_max_window_bits`){let e=+n;if(!Number.isInteger(e)||e<8||e>15)throw TypeError(`Invalid value for parameter "${t}": ${n}`);n=e}else if(t===`client_no_context_takeover`||t===`server_no_context_takeover`){if(n!==!0)throw TypeError(`Invalid value for parameter "${t}": ${n}`)}else throw Error(`Unknown parameter "${t}"`);e[t]=n})}),e}decompress(e,t,n){p.add(r=>{this._decompress(e,t,(e,t)=>{r(),n(e,t)})})}compress(e,t,n){p.add(r=>{this._compress(e,t,(e,t)=>{r(),n(e,t)})})}_decompress(e,t,i){let a=this._isServer?`client`:`server`;if(!this._inflate){let e=`${a}_max_window_bits`,t=typeof this.params[e]==`number`?this.params[e]:n.Z_DEFAULT_WINDOWBITS;this._inflate=n.createInflateRaw({...this._options.zlibInflateOptions,windowBits:t}),this._inflate[c]=this,this._inflate[l]=0,this._inflate[d]=[],this._inflate.on(`error`,g),this._inflate.on(`data`,h)}this._inflate[u]=i,this._inflate.write(e),t&&this._inflate.write(s),this._inflate.flush(()=>{let e=this._inflate[f];if(e){this._inflate.close(),this._inflate=null,i(e);return}let n=r.concat(this._inflate[d],this._inflate[l]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[l]=0,this._inflate[d]=[],t&&this.params[`${a}_no_context_takeover`]&&this._inflate.reset()),i(null,n)})}_compress(e,t,i){let a=this._isServer?`server`:`client`;if(!this._deflate){let e=`${a}_max_window_bits`,t=typeof this.params[e]==`number`?this.params[e]:n.Z_DEFAULT_WINDOWBITS;this._deflate=n.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:t}),this._deflate[l]=0,this._deflate[d]=[],this._deflate.on(`data`,m)}this._deflate[u]=i,this._deflate.write(e),this._deflate.flush(n.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let e=r.concat(this._deflate[d],this._deflate[l]);t&&(e=new o(e.buffer,e.byteOffset,e.length-4)),this._deflate[u]=null,this._deflate[l]=0,this._deflate[d]=[],t&&this.params[`${a}_no_context_takeover`]&&this._deflate.reset(),i(null,e)})}};function m(e){this[d].push(e),this[l]+=e.length}function h(e){if(this[l]+=e.length,this[c]._maxPayload<1||this[l]<=this[c]._maxPayload){this[d].push(e);return}this[f]=RangeError(`Max payload size exceeded`),this[f].code=`WS_ERR_UNSUPPORTED_MESSAGE_LENGTH`,this[f][a]=1009,this.removeListener(`data`,h),this.reset()}function g(e){if(this[c]._inflate=null,this[f]){this[u](this[f]);return}e[a]=1007,this[u](e)}})),Jr=z(((e,t)=>{let{isUtf8:n}=B(`buffer`),{hasBlob:r}=Wr(),i=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0];function a(e){return e>=1e3&&e<=1014&&e!==1004&&e!==1005&&e!==1006||e>=3e3&&e<=4999}function o(e){let t=e.length,n=0;for(;n<t;)if(!(e[n]&128))n++;else if((e[n]&224)==192){if(n+1===t||(e[n+1]&192)!=128||(e[n]&254)==192)return!1;n+=2}else if((e[n]&240)==224){if(n+2>=t||(e[n+1]&192)!=128||(e[n+2]&192)!=128||e[n]===224&&(e[n+1]&224)==128||e[n]===237&&(e[n+1]&224)==160)return!1;n+=3}else if((e[n]&248)==240){if(n+3>=t||(e[n+1]&192)!=128||(e[n+2]&192)!=128||(e[n+3]&192)!=128||e[n]===240&&(e[n+1]&240)==128||e[n]===244&&e[n+1]>143||e[n]>244)return!1;n+=4}else return!1;return!0}function s(e){return r&&typeof e==`object`&&typeof e.arrayBuffer==`function`&&typeof e.type==`string`&&typeof e.stream==`function`&&(e[Symbol.toStringTag]===`Blob`||e[Symbol.toStringTag]===`File`)}if(t.exports={isBlob:s,isValidStatusCode:a,isValidUTF8:o,tokenChars:i},n)t.exports.isValidUTF8=function(e){return e.length<24?o(e):n(e)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let e=B(`utf-8-validate`);t.exports.isValidUTF8=function(t){return t.length<32?o(t):e(t)}}catch{}})),Yr=z(((e,t)=>{let{Writable:n}=B(`stream`),r=qr(),{BINARY_TYPES:i,EMPTY_BUFFER:a,kStatusCode:o,kWebSocket:s}=Wr(),{concat:c,toArrayBuffer:l,unmask:u}=Gr(),{isValidStatusCode:d,isValidUTF8:f}=Jr(),p=Buffer[Symbol.species];t.exports=class extends n{constructor(e={}){super(),this._allowSynchronousEvents=e.allowSynchronousEvents===void 0?!0:e.allowSynchronousEvents,this._binaryType=e.binaryType||i[0],this._extensions=e.extensions||{},this._isServer=!!e.isServer,this._maxPayload=e.maxPayload|0,this._skipUTF8Validation=!!e.skipUTF8Validation,this[s]=void 0,this._bufferedBytes=0,this._buffers=[],this._compressed=!1,this._payloadLength=0,this._mask=void 0,this._fragmented=0,this._masked=!1,this._fin=!1,this._opcode=0,this._totalPayloadLength=0,this._messageLength=0,this._fragments=[],this._errored=!1,this._loop=!1,this._state=0}_write(e,t,n){if(this._opcode===8&&this._state==0)return n();this._bufferedBytes+=e.length,this._buffers.push(e),this.startLoop(n)}consume(e){if(this._bufferedBytes-=e,e===this._buffers[0].length)return this._buffers.shift();if(e<this._buffers[0].length){let t=this._buffers[0];return this._buffers[0]=new p(t.buffer,t.byteOffset+e,t.length-e),new p(t.buffer,t.byteOffset,e)}let t=Buffer.allocUnsafe(e);do{let n=this._buffers[0],r=t.length-e;e>=n.length?t.set(this._buffers.shift(),r):(t.set(new Uint8Array(n.buffer,n.byteOffset,e),r),this._buffers[0]=new p(n.buffer,n.byteOffset+e,n.length-e)),e-=n.length}while(e>0);return t}startLoop(e){this._loop=!0;do switch(this._state){case 0:this.getInfo(e);break;case 1:this.getPayloadLength16(e);break;case 2:this.getPayloadLength64(e);break;case 3:this.getMask();break;case 4:this.getData(e);break;case 5:case 6:this._loop=!1;return}while(this._loop);this._errored||e()}getInfo(e){if(this._bufferedBytes<2){this._loop=!1;return}let t=this.consume(2);if(t[0]&48){e(this.createError(RangeError,`RSV2 and RSV3 must be clear`,!0,1002,`WS_ERR_UNEXPECTED_RSV_2_3`));return}let n=(t[0]&64)==64;if(n&&!this._extensions[r.extensionName]){e(this.createError(RangeError,`RSV1 must be clear`,!0,1002,`WS_ERR_UNEXPECTED_RSV_1`));return}if(this._fin=(t[0]&128)==128,this._opcode=t[0]&15,this._payloadLength=t[1]&127,this._opcode===0){if(n){e(this.createError(RangeError,`RSV1 must be clear`,!0,1002,`WS_ERR_UNEXPECTED_RSV_1`));return}if(!this._fragmented){e(this.createError(RangeError,`invalid opcode 0`,!0,1002,`WS_ERR_INVALID_OPCODE`));return}this._opcode=this._fragmented}else if(this._opcode===1||this._opcode===2){if(this._fragmented){e(this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,`WS_ERR_INVALID_OPCODE`));return}this._compressed=n}else if(this._opcode>7&&this._opcode<11){if(!this._fin){e(this.createError(RangeError,`FIN must be set`,!0,1002,`WS_ERR_EXPECTED_FIN`));return}if(n){e(this.createError(RangeError,`RSV1 must be clear`,!0,1002,`WS_ERR_UNEXPECTED_RSV_1`));return}if(this._payloadLength>125||this._opcode===8&&this._payloadLength===1){e(this.createError(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,`WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH`));return}}else{e(this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,`WS_ERR_INVALID_OPCODE`));return}if(!this._fin&&!this._fragmented&&(this._fragmented=this._opcode),this._masked=(t[1]&128)==128,this._isServer){if(!this._masked){e(this.createError(RangeError,`MASK must be set`,!0,1002,`WS_ERR_EXPECTED_MASK`));return}}else if(this._masked){e(this.createError(RangeError,`MASK must be clear`,!0,1002,`WS_ERR_UNEXPECTED_MASK`));return}this._payloadLength===126?this._state=1:this._payloadLength===127?this._state=2:this.haveLength(e)}getPayloadLength16(e){if(this._bufferedBytes<2){this._loop=!1;return}this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength(e)}getPayloadLength64(e){if(this._bufferedBytes<8){this._loop=!1;return}let t=this.consume(8),n=t.readUInt32BE(0);if(n>2**21-1){e(this.createError(RangeError,`Unsupported WebSocket frame: payload length > 2^53 - 1`,!1,1009,`WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH`));return}this._payloadLength=n*2**32+t.readUInt32BE(4),this.haveLength(e)}haveLength(e){if(this._payloadLength&&this._opcode<8&&(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0)){e(this.createError(RangeError,`Max payload size exceeded`,!1,1009,`WS_ERR_UNSUPPORTED_MESSAGE_LENGTH`));return}this._masked?this._state=3:this._state=4}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=4}getData(e){let t=a;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength){this._loop=!1;return}t=this.consume(this._payloadLength),this._masked&&(this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3])!==0&&u(t,this._mask)}if(this._opcode>7){this.controlMessage(t,e);return}if(this._compressed){this._state=5,this.decompress(t,e);return}t.length&&(this._messageLength=this._totalPayloadLength,this._fragments.push(t)),this.dataMessage(e)}decompress(e,t){this._extensions[r.extensionName].decompress(e,this._fin,(e,n)=>{if(e)return t(e);if(n.length){if(this._messageLength+=n.length,this._messageLength>this._maxPayload&&this._maxPayload>0){t(this.createError(RangeError,`Max payload size exceeded`,!1,1009,`WS_ERR_UNSUPPORTED_MESSAGE_LENGTH`));return}this._fragments.push(n)}this.dataMessage(t),this._state===0&&this.startLoop(t)})}dataMessage(e){if(!this._fin){this._state=0;return}let t=this._messageLength,n=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._fragments=[],this._opcode===2){let r;r=this._binaryType===`nodebuffer`?c(n,t):this._binaryType===`arraybuffer`?l(c(n,t)):this._binaryType===`blob`?new Blob(n):n,this._allowSynchronousEvents?(this.emit(`message`,r,!0),this._state=0):(this._state=6,setImmediate(()=>{this.emit(`message`,r,!0),this._state=0,this.startLoop(e)}))}else{let r=c(n,t);if(!this._skipUTF8Validation&&!f(r)){e(this.createError(Error,`invalid UTF-8 sequence`,!0,1007,`WS_ERR_INVALID_UTF8`));return}this._state===5||this._allowSynchronousEvents?(this.emit(`message`,r,!1),this._state=0):(this._state=6,setImmediate(()=>{this.emit(`message`,r,!1),this._state=0,this.startLoop(e)}))}}controlMessage(e,t){if(this._opcode===8){if(e.length===0)this._loop=!1,this.emit(`conclude`,1005,a),this.end();else{let n=e.readUInt16BE(0);if(!d(n)){t(this.createError(RangeError,`invalid status code ${n}`,!0,1002,`WS_ERR_INVALID_CLOSE_CODE`));return}let r=new p(e.buffer,e.byteOffset+2,e.length-2);if(!this._skipUTF8Validation&&!f(r)){t(this.createError(Error,`invalid UTF-8 sequence`,!0,1007,`WS_ERR_INVALID_UTF8`));return}this._loop=!1,this.emit(`conclude`,n,r),this.end()}this._state=0;return}this._allowSynchronousEvents?(this.emit(this._opcode===9?`ping`:`pong`,e),this._state=0):(this._state=6,setImmediate(()=>{this.emit(this._opcode===9?`ping`:`pong`,e),this._state=0,this.startLoop(t)}))}createError(e,t,n,r,i){this._loop=!1,this._errored=!0;let a=new e(n?`Invalid WebSocket frame: ${t}`:t);return Error.captureStackTrace(a,this.createError),a.code=i,a[o]=r,a}}})),Xr=z(((e,t)=>{let{Duplex:n}=B(`stream`),{randomFillSync:r}=B(`crypto`),i=qr(),{EMPTY_BUFFER:a,kWebSocket:o,NOOP:s}=Wr(),{isBlob:c,isValidStatusCode:l}=Jr(),{mask:u,toBuffer:d}=Gr(),f=Symbol(`kByteLength`),p=Buffer.alloc(4),m=8*1024,h,g=m;t.exports=class e{constructor(e,t,n){this._extensions=t||{},n&&(this._generateMask=n,this._maskBuffer=Buffer.alloc(4)),this._socket=e,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._queue=[],this._state=0,this.onerror=s,this[o]=void 0}static frame(e,t){let n,i=!1,a=2,o=!1;t.mask&&(n=t.maskBuffer||p,t.generateMask?t.generateMask(n):(g===m&&(h===void 0&&(h=Buffer.alloc(m)),r(h,0,m),g=0),n[0]=h[g++],n[1]=h[g++],n[2]=h[g++],n[3]=h[g++]),o=(n[0]|n[1]|n[2]|n[3])===0,a=6);let s;typeof e==`string`?(!t.mask||o)&&t[f]!==void 0?s=t[f]:(e=Buffer.from(e),s=e.length):(s=e.length,i=t.mask&&t.readOnly&&!o);let c=s;s>=65536?(a+=8,c=127):s>125&&(a+=2,c=126);let l=Buffer.allocUnsafe(i?s+a:a);return l[0]=t.fin?t.opcode|128:t.opcode,t.rsv1&&(l[0]|=64),l[1]=c,c===126?l.writeUInt16BE(s,2):c===127&&(l[2]=l[3]=0,l.writeUIntBE(s,4,6)),!t.mask||(l[1]|=128,l[a-4]=n[0],l[a-3]=n[1],l[a-2]=n[2],l[a-1]=n[3],o)?[l,e]:i?(u(e,n,l,a,s),[l]):(u(e,n,e,0,s),[l,e])}close(t,n,r,i){let o;if(t===void 0)o=a;else if(typeof t!=`number`||!l(t))throw TypeError(`First argument must be a valid error code number`);else if(n===void 0||!n.length)o=Buffer.allocUnsafe(2),o.writeUInt16BE(t,0);else{let e=Buffer.byteLength(n);if(e>123)throw RangeError(`The message must not be greater than 123 bytes`);o=Buffer.allocUnsafe(2+e),o.writeUInt16BE(t,0),typeof n==`string`?o.write(n,2):o.set(n,2)}let s={[f]:o.length,fin:!0,generateMask:this._generateMask,mask:r,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._state===0?this.sendFrame(e.frame(o,s),i):this.enqueue([this.dispatch,o,!1,s,i])}ping(t,n,r){let i,a;if(typeof t==`string`?(i=Buffer.byteLength(t),a=!1):c(t)?(i=t.size,a=!1):(t=d(t),i=t.length,a=d.readOnly),i>125)throw RangeError(`The data size must not be greater than 125 bytes`);let o={[f]:i,fin:!0,generateMask:this._generateMask,mask:n,maskBuffer:this._maskBuffer,opcode:9,readOnly:a,rsv1:!1};c(t)?this._state===0?this.getBlobData(t,!1,o,r):this.enqueue([this.getBlobData,t,!1,o,r]):this._state===0?this.sendFrame(e.frame(t,o),r):this.enqueue([this.dispatch,t,!1,o,r])}pong(t,n,r){let i,a;if(typeof t==`string`?(i=Buffer.byteLength(t),a=!1):c(t)?(i=t.size,a=!1):(t=d(t),i=t.length,a=d.readOnly),i>125)throw RangeError(`The data size must not be greater than 125 bytes`);let o={[f]:i,fin:!0,generateMask:this._generateMask,mask:n,maskBuffer:this._maskBuffer,opcode:10,readOnly:a,rsv1:!1};c(t)?this._state===0?this.getBlobData(t,!1,o,r):this.enqueue([this.getBlobData,t,!1,o,r]):this._state===0?this.sendFrame(e.frame(t,o),r):this.enqueue([this.dispatch,t,!1,o,r])}send(e,t,n){let r=this._extensions[i.extensionName],a=t.binary?2:1,o=t.compress,s,l;typeof e==`string`?(s=Buffer.byteLength(e),l=!1):c(e)?(s=e.size,l=!1):(e=d(e),s=e.length,l=d.readOnly),this._firstFragment?(this._firstFragment=!1,o&&r&&r.params[r._isServer?`server_no_context_takeover`:`client_no_context_takeover`]&&(o=s>=r._threshold),this._compress=o):(o=!1,a=0),t.fin&&(this._firstFragment=!0);let u={[f]:s,fin:t.fin,generateMask:this._generateMask,mask:t.mask,maskBuffer:this._maskBuffer,opcode:a,readOnly:l,rsv1:o};c(e)?this._state===0?this.getBlobData(e,this._compress,u,n):this.enqueue([this.getBlobData,e,this._compress,u,n]):this._state===0?this.dispatch(e,this._compress,u,n):this.enqueue([this.dispatch,e,this._compress,u,n])}getBlobData(t,n,r,i){this._bufferedBytes+=r[f],this._state=2,t.arrayBuffer().then(t=>{if(this._socket.destroyed){let e=Error(`The socket was closed while the blob was being read`);process.nextTick(_,this,e,i);return}this._bufferedBytes-=r[f];let a=d(t);n?this.dispatch(a,n,r,i):(this._state=0,this.sendFrame(e.frame(a,r),i),this.dequeue())}).catch(e=>{process.nextTick(v,this,e,i)})}dispatch(t,n,r,a){if(!n){this.sendFrame(e.frame(t,r),a);return}let o=this._extensions[i.extensionName];this._bufferedBytes+=r[f],this._state=1,o.compress(t,r.fin,(t,n)=>{if(this._socket.destroyed){let e=Error(`The socket was closed while data was being compressed`);_(this,e,a);return}this._bufferedBytes-=r[f],this._state=0,r.readOnly=!1,this.sendFrame(e.frame(n,r),a),this.dequeue()})}dequeue(){for(;this._state===0&&this._queue.length;){let e=this._queue.shift();this._bufferedBytes-=e[3][f],Reflect.apply(e[0],this,e.slice(1))}}enqueue(e){this._bufferedBytes+=e[3][f],this._queue.push(e)}sendFrame(e,t){e.length===2?(this._socket.cork(),this._socket.write(e[0]),this._socket.write(e[1],t),this._socket.uncork()):this._socket.write(e[0],t)}};function _(e,t,n){typeof n==`function`&&n(t);for(let n=0;n<e._queue.length;n++){let r=e._queue[n],i=r[r.length-1];typeof i==`function`&&i(t)}}function v(e,t,n){_(e,t,n),e.onerror(t)}})),Zr=z(((e,t)=>{let{kForOnEventAttribute:n,kListener:r}=Wr(),i=Symbol(`kCode`),a=Symbol(`kData`),o=Symbol(`kError`),s=Symbol(`kMessage`),c=Symbol(`kReason`),l=Symbol(`kTarget`),u=Symbol(`kType`),d=Symbol(`kWasClean`);var f=class{constructor(e){this[l]=null,this[u]=e}get target(){return this[l]}get type(){return this[u]}};Object.defineProperty(f.prototype,`target`,{enumerable:!0}),Object.defineProperty(f.prototype,`type`,{enumerable:!0});var p=class extends f{constructor(e,t={}){super(e),this[i]=t.code===void 0?0:t.code,this[c]=t.reason===void 0?``:t.reason,this[d]=t.wasClean===void 0?!1:t.wasClean}get code(){return this[i]}get reason(){return this[c]}get wasClean(){return this[d]}};Object.defineProperty(p.prototype,`code`,{enumerable:!0}),Object.defineProperty(p.prototype,`reason`,{enumerable:!0}),Object.defineProperty(p.prototype,`wasClean`,{enumerable:!0});var m=class extends f{constructor(e,t={}){super(e),this[o]=t.error===void 0?null:t.error,this[s]=t.message===void 0?``:t.message}get error(){return this[o]}get message(){return this[s]}};Object.defineProperty(m.prototype,`error`,{enumerable:!0}),Object.defineProperty(m.prototype,`message`,{enumerable:!0});var h=class extends f{constructor(e,t={}){super(e),this[a]=t.data===void 0?null:t.data}get data(){return this[a]}};Object.defineProperty(h.prototype,`data`,{enumerable:!0}),t.exports={CloseEvent:p,ErrorEvent:m,Event:f,EventTarget:{addEventListener(e,t,i={}){for(let a of this.listeners(e))if(!i[n]&&a[r]===t&&!a[n])return;let a;if(e===`message`)a=function(e,n){let r=new h(`message`,{data:n?e:e.toString()});r[l]=this,g(t,this,r)};else if(e===`close`)a=function(e,n){let r=new p(`close`,{code:e,reason:n.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});r[l]=this,g(t,this,r)};else if(e===`error`)a=function(e){let n=new m(`error`,{error:e,message:e.message});n[l]=this,g(t,this,n)};else if(e===`open`)a=function(){let e=new f(`open`);e[l]=this,g(t,this,e)};else return;a[n]=!!i[n],a[r]=t,i.once?this.once(e,a):this.on(e,a)},removeEventListener(e,t){for(let i of this.listeners(e))if(i[r]===t&&!i[n]){this.removeListener(e,i);break}}},MessageEvent:h};function g(e,t,n){typeof e==`object`&&e.handleEvent?e.handleEvent.call(e,n):e.call(t,n)}})),Qr=z(((e,t)=>{let{tokenChars:n}=Jr();function r(e,t,n){e[t]===void 0?e[t]=[n]:e[t].push(n)}function i(e){let t=Object.create(null),i=Object.create(null),a=!1,o=!1,s=!1,c,l,u=-1,d=-1,f=-1,p=0;for(;p<e.length;p++)if(d=e.charCodeAt(p),c===void 0)if(f===-1&&n[d]===1)u===-1&&(u=p);else if(p!==0&&(d===32||d===9))f===-1&&u!==-1&&(f=p);else if(d===59||d===44){if(u===-1)throw SyntaxError(`Unexpected character at index ${p}`);f===-1&&(f=p);let n=e.slice(u,f);d===44?(r(t,n,i),i=Object.create(null)):c=n,u=f=-1}else throw SyntaxError(`Unexpected character at index ${p}`);else if(l===void 0)if(f===-1&&n[d]===1)u===-1&&(u=p);else if(d===32||d===9)f===-1&&u!==-1&&(f=p);else if(d===59||d===44){if(u===-1)throw SyntaxError(`Unexpected character at index ${p}`);f===-1&&(f=p),r(i,e.slice(u,f),!0),d===44&&(r(t,c,i),i=Object.create(null),c=void 0),u=f=-1}else if(d===61&&u!==-1&&f===-1)l=e.slice(u,p),u=f=-1;else throw SyntaxError(`Unexpected character at index ${p}`);else if(o){if(n[d]!==1)throw SyntaxError(`Unexpected character at index ${p}`);u===-1?u=p:a||=!0,o=!1}else if(s)if(n[d]===1)u===-1&&(u=p);else if(d===34&&u!==-1)s=!1,f=p;else if(d===92)o=!0;else throw SyntaxError(`Unexpected character at index ${p}`);else if(d===34&&e.charCodeAt(p-1)===61)s=!0;else if(f===-1&&n[d]===1)u===-1&&(u=p);else if(u!==-1&&(d===32||d===9))f===-1&&(f=p);else if(d===59||d===44){if(u===-1)throw SyntaxError(`Unexpected character at index ${p}`);f===-1&&(f=p);let n=e.slice(u,f);a&&=(n=n.replace(/\\/g,``),!1),r(i,l,n),d===44&&(r(t,c,i),i=Object.create(null),c=void 0),l=void 0,u=f=-1}else throw SyntaxError(`Unexpected character at index ${p}`);if(u===-1||s||d===32||d===9)throw SyntaxError(`Unexpected end of input`);f===-1&&(f=p);let m=e.slice(u,f);return c===void 0?r(t,m,i):(l===void 0?r(i,m,!0):a?r(i,l,m.replace(/\\/g,``)):r(i,l,m),r(t,c,i)),t}function a(e){return Object.keys(e).map(t=>{let n=e[t];return Array.isArray(n)||(n=[n]),n.map(e=>[t].concat(Object.keys(e).map(t=>{let n=e[t];return Array.isArray(n)||(n=[n]),n.map(e=>e===!0?t:`${t}=${e}`).join(`; `)})).join(`; `)).join(`, `)}).join(`, `)}t.exports={format:a,parse:i}})),$r=z(((e,t)=>{let n=B(`events`),r=B(`https`),i=B(`http`),a=B(`net`),o=B(`tls`),{randomBytes:s,createHash:c}=B(`crypto`),{Duplex:l,Readable:u}=B(`stream`),{URL:d}=B(`url`),f=qr(),p=Yr(),m=Xr(),{isBlob:h}=Jr(),{BINARY_TYPES:g,CLOSE_TIMEOUT:_,EMPTY_BUFFER:v,GUID:y,kForOnEventAttribute:b,kListener:x,kStatusCode:S,kWebSocket:C,NOOP:w}=Wr(),{EventTarget:{addEventListener:T,removeEventListener:E}}=Zr(),{format:D,parse:O}=Qr(),{toBuffer:k}=Gr(),A=Symbol(`kAborted`),j=[8,13],M=[`CONNECTING`,`OPEN`,`CLOSING`,`CLOSED`],N=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/;var P=class e extends n{constructor(t,n,r){super(),this._binaryType=g[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=v,this._closeTimer=null,this._errorEmitted=!1,this._extensions={},this._paused=!1,this._protocol=``,this._readyState=e.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,t===null?(this._autoPong=r.autoPong,this._closeTimeout=r.closeTimeout,this._isServer=!0):(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,n===void 0?n=[]:Array.isArray(n)||(typeof n==`object`&&n?(r=n,n=[]):n=[n]),ee(this,t,n,r))}get binaryType(){return this._binaryType}set binaryType(e){g.includes(e)&&(this._binaryType=e,this._receiver&&(this._receiver._binaryType=e))}get bufferedAmount(){return this._socket?this._socket._writableState.length+this._sender._bufferedBytes:this._bufferedAmount}get extensions(){return Object.keys(this._extensions).join()}get isPaused(){return this._paused}get onclose(){return null}get onerror(){return null}get onopen(){return null}get onmessage(){return null}get protocol(){return this._protocol}get readyState(){return this._readyState}get url(){return this._url}setSocket(t,n,r){let i=new p({allowSynchronousEvents:r.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxPayload:r.maxPayload,skipUTF8Validation:r.skipUTF8Validation}),a=new m(t,this._extensions,r.generateMask);this._receiver=i,this._sender=a,this._socket=t,i[C]=this,a[C]=this,t[C]=this,i.on(`conclude`,re),i.on(`drain`,ie),i.on(`error`,ae),i.on(`message`,R),i.on(`ping`,z),i.on(`pong`,se),a.onerror=le,t.setTimeout&&t.setTimeout(0),t.setNoDelay&&t.setNoDelay(),n.length>0&&t.unshift(n),t.on(`close`,ue),t.on(`data`,de),t.on(`end`,fe),t.on(`error`,pe),this._readyState=e.OPEN,this.emit(`open`)}emitClose(){if(!this._socket){this._readyState=e.CLOSED,this.emit(`close`,this._closeCode,this._closeMessage);return}this._extensions[f.extensionName]&&this._extensions[f.extensionName].cleanup(),this._receiver.removeAllListeners(),this._readyState=e.CLOSED,this.emit(`close`,this._closeCode,this._closeMessage)}close(t,n){if(this.readyState!==e.CLOSED){if(this.readyState===e.CONNECTING){L(this,this._req,`WebSocket was closed before the connection was established`);return}if(this.readyState===e.CLOSING){this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end();return}this._readyState=e.CLOSING,this._sender.close(t,n,!this._isServer,e=>{e||(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())}),V(this)}}pause(){this.readyState===e.CONNECTING||this.readyState===e.CLOSED||(this._paused=!0,this._socket.pause())}ping(t,n,r){if(this.readyState===e.CONNECTING)throw Error(`WebSocket is not open: readyState 0 (CONNECTING)`);if(typeof t==`function`?(r=t,t=n=void 0):typeof n==`function`&&(r=n,n=void 0),typeof t==`number`&&(t=t.toString()),this.readyState!==e.OPEN){ne(this,t,r);return}n===void 0&&(n=!this._isServer),this._sender.ping(t||v,n,r)}pong(t,n,r){if(this.readyState===e.CONNECTING)throw Error(`WebSocket is not open: readyState 0 (CONNECTING)`);if(typeof t==`function`?(r=t,t=n=void 0):typeof n==`function`&&(r=n,n=void 0),typeof t==`number`&&(t=t.toString()),this.readyState!==e.OPEN){ne(this,t,r);return}n===void 0&&(n=!this._isServer),this._sender.pong(t||v,n,r)}resume(){this.readyState===e.CONNECTING||this.readyState===e.CLOSED||(this._paused=!1,this._receiver._writableState.needDrain||this._socket.resume())}send(t,n,r){if(this.readyState===e.CONNECTING)throw Error(`WebSocket is not open: readyState 0 (CONNECTING)`);if(typeof n==`function`&&(r=n,n={}),typeof t==`number`&&(t=t.toString()),this.readyState!==e.OPEN){ne(this,t,r);return}let i={binary:typeof t!=`string`,mask:!this._isServer,compress:!0,fin:!0,...n};this._extensions[f.extensionName]||(i.compress=!1),this._sender.send(t||v,i,r)}terminate(){if(this.readyState!==e.CLOSED){if(this.readyState===e.CONNECTING){L(this,this._req,`WebSocket was closed before the connection was established`);return}this._socket&&(this._readyState=e.CLOSING,this._socket.destroy())}}};Object.defineProperty(P,`CONNECTING`,{enumerable:!0,value:M.indexOf(`CONNECTING`)}),Object.defineProperty(P.prototype,`CONNECTING`,{enumerable:!0,value:M.indexOf(`CONNECTING`)}),Object.defineProperty(P,`OPEN`,{enumerable:!0,value:M.indexOf(`OPEN`)}),Object.defineProperty(P.prototype,`OPEN`,{enumerable:!0,value:M.indexOf(`OPEN`)}),Object.defineProperty(P,`CLOSING`,{enumerable:!0,value:M.indexOf(`CLOSING`)}),Object.defineProperty(P.prototype,`CLOSING`,{enumerable:!0,value:M.indexOf(`CLOSING`)}),Object.defineProperty(P,`CLOSED`,{enumerable:!0,value:M.indexOf(`CLOSED`)}),Object.defineProperty(P.prototype,`CLOSED`,{enumerable:!0,value:M.indexOf(`CLOSED`)}),[`binaryType`,`bufferedAmount`,`extensions`,`isPaused`,`protocol`,`readyState`,`url`].forEach(e=>{Object.defineProperty(P.prototype,e,{enumerable:!0})}),[`open`,`error`,`close`,`message`].forEach(e=>{Object.defineProperty(P.prototype,`on${e}`,{enumerable:!0,get(){for(let t of this.listeners(e))if(t[b])return t[x];return null},set(t){for(let t of this.listeners(e))if(t[b]){this.removeListener(e,t);break}typeof t==`function`&&this.addEventListener(e,t,{[b]:!0})}})}),P.prototype.addEventListener=T,P.prototype.removeEventListener=E,t.exports=P;function ee(e,t,n,a){let o={allowSynchronousEvents:!0,autoPong:!0,closeTimeout:_,protocolVersion:j[1],maxPayload:100*1024*1024,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...a,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:`GET`,host:void 0,path:void 0,port:void 0};if(e._autoPong=o.autoPong,e._closeTimeout=o.closeTimeout,!j.includes(o.protocolVersion))throw RangeError(`Unsupported protocol version: ${o.protocolVersion} (supported versions: ${j.join(`, `)})`);let l;if(t instanceof d)l=t;else try{l=new d(t)}catch{throw SyntaxError(`Invalid URL: ${t}`)}l.protocol===`http:`?l.protocol=`ws:`:l.protocol===`https:`&&(l.protocol=`wss:`),e._url=l.href;let u=l.protocol===`wss:`,p=l.protocol===`ws+unix:`,m;if(l.protocol!==`ws:`&&!u&&!p?m=`The URL's protocol must be one of "ws:", "wss:", "http:", "https:", or "ws+unix:"`:p&&!l.pathname?m=`The URL's pathname is empty`:l.hash&&(m=`The URL contains a fragment identifier`),m){let t=SyntaxError(m);if(e._redirects===0)throw t;F(e,t);return}let h=u?443:80,g=s(16).toString(`base64`),v=u?r.request:i.request,b=new Set,x;if(o.createConnection=o.createConnection||(u?te:I),o.defaultPort=o.defaultPort||h,o.port=l.port||h,o.host=l.hostname.startsWith(`[`)?l.hostname.slice(1,-1):l.hostname,o.headers={...o.headers,"Sec-WebSocket-Version":o.protocolVersion,"Sec-WebSocket-Key":g,Connection:`Upgrade`,Upgrade:`websocket`},o.path=l.pathname+l.search,o.timeout=o.handshakeTimeout,o.perMessageDeflate&&(x=new f({...o.perMessageDeflate,isServer:!1,maxPayload:o.maxPayload}),o.headers[`Sec-WebSocket-Extensions`]=D({[f.extensionName]:x.offer()})),n.length){for(let e of n){if(typeof e!=`string`||!N.test(e)||b.has(e))throw SyntaxError(`An invalid or duplicated subprotocol was specified`);b.add(e)}o.headers[`Sec-WebSocket-Protocol`]=n.join(`,`)}if(o.origin&&(o.protocolVersion<13?o.headers[`Sec-WebSocket-Origin`]=o.origin:o.headers.Origin=o.origin),(l.username||l.password)&&(o.auth=`${l.username}:${l.password}`),p){let e=o.path.split(`:`);o.socketPath=e[0],o.path=e[1]}let S;if(o.followRedirects){if(e._redirects===0){e._originalIpc=p,e._originalSecure=u,e._originalHostOrSocketPath=p?o.socketPath:l.host;let t=a&&a.headers;if(a={...a,headers:{}},t)for(let[e,n]of Object.entries(t))a.headers[e.toLowerCase()]=n}else if(e.listenerCount(`redirect`)===0){let t=p?e._originalIpc?o.socketPath===e._originalHostOrSocketPath:!1:e._originalIpc?!1:l.host===e._originalHostOrSocketPath;(!t||e._originalSecure&&!u)&&(delete o.headers.authorization,delete o.headers.cookie,t||delete o.headers.host,o.auth=void 0)}o.auth&&!a.headers.authorization&&(a.headers.authorization=`Basic `+Buffer.from(o.auth).toString(`base64`)),S=e._req=v(o),e._redirects&&e.emit(`redirect`,e.url,S)}else S=e._req=v(o);o.timeout&&S.on(`timeout`,()=>{L(e,S,`Opening handshake has timed out`)}),S.on(`error`,t=>{S===null||S[A]||(S=e._req=null,F(e,t))}),S.on(`response`,r=>{let i=r.headers.location,s=r.statusCode;if(i&&o.followRedirects&&s>=300&&s<400){if(++e._redirects>o.maxRedirects){L(e,S,`Maximum redirects exceeded`);return}S.abort();let r;try{r=new d(i,t)}catch{F(e,SyntaxError(`Invalid URL: ${i}`));return}ee(e,r,n,a)}else e.emit(`unexpected-response`,S,r)||L(e,S,`Unexpected server response: ${r.statusCode}`)}),S.on(`upgrade`,(t,n,r)=>{if(e.emit(`upgrade`,t),e.readyState!==P.CONNECTING)return;S=e._req=null;let i=t.headers.upgrade;if(i===void 0||i.toLowerCase()!==`websocket`){L(e,n,`Invalid Upgrade header`);return}let a=c(`sha1`).update(g+y).digest(`base64`);if(t.headers[`sec-websocket-accept`]!==a){L(e,n,`Invalid Sec-WebSocket-Accept header`);return}let s=t.headers[`sec-websocket-protocol`],l;if(s===void 0?b.size&&(l=`Server sent no subprotocol`):b.size?b.has(s)||(l=`Server sent an invalid subprotocol`):l=`Server sent a subprotocol but none was requested`,l){L(e,n,l);return}s&&(e._protocol=s);let u=t.headers[`sec-websocket-extensions`];if(u!==void 0){if(!x){L(e,n,`Server sent a Sec-WebSocket-Extensions header but no extension was requested`);return}let t;try{t=O(u)}catch{L(e,n,`Invalid Sec-WebSocket-Extensions header`);return}let r=Object.keys(t);if(r.length!==1||r[0]!==f.extensionName){L(e,n,`Server indicated an extension that was not requested`);return}try{x.accept(t[f.extensionName])}catch{L(e,n,`Invalid Sec-WebSocket-Extensions header`);return}e._extensions[f.extensionName]=x}e.setSocket(n,r,{allowSynchronousEvents:o.allowSynchronousEvents,generateMask:o.generateMask,maxPayload:o.maxPayload,skipUTF8Validation:o.skipUTF8Validation})}),o.finishRequest?o.finishRequest(S,e):S.end()}function F(e,t){e._readyState=P.CLOSING,e._errorEmitted=!0,e.emit(`error`,t),e.emitClose()}function I(e){return e.path=e.socketPath,a.connect(e)}function te(e){return e.path=void 0,!e.servername&&e.servername!==``&&(e.servername=a.isIP(e.host)?``:e.host),o.connect(e)}function L(e,t,n){e._readyState=P.CLOSING;let r=Error(n);Error.captureStackTrace(r,L),t.setHeader?(t[A]=!0,t.abort(),t.socket&&!t.socket.destroyed&&t.socket.destroy(),process.nextTick(F,e,r)):(t.destroy(r),t.once(`error`,e.emit.bind(e,`error`)),t.once(`close`,e.emitClose.bind(e)))}function ne(e,t,n){if(t){let n=h(t)?t.size:k(t).length;e._socket?e._sender._bufferedBytes+=n:e._bufferedAmount+=n}if(n){let t=Error(`WebSocket is not open: readyState ${e.readyState} (${M[e.readyState]})`);process.nextTick(n,t)}}function re(e,t){let n=this[C];n._closeFrameReceived=!0,n._closeMessage=t,n._closeCode=e,n._socket[C]!==void 0&&(n._socket.removeListener(`data`,de),process.nextTick(ce,n._socket),e===1005?n.close():n.close(e,t))}function ie(){let e=this[C];e.isPaused||e._socket.resume()}function ae(e){let t=this[C];t._socket[C]!==void 0&&(t._socket.removeListener(`data`,de),process.nextTick(ce,t._socket),t.close(e[S])),t._errorEmitted||(t._errorEmitted=!0,t.emit(`error`,e))}function oe(){this[C].emitClose()}function R(e,t){this[C].emit(`message`,e,t)}function z(e){let t=this[C];t._autoPong&&t.pong(e,!this._isServer,w),t.emit(`ping`,e)}function se(e){this[C].emit(`pong`,e)}function ce(e){e.resume()}function le(e){let t=this[C];t.readyState!==P.CLOSED&&(t.readyState===P.OPEN&&(t._readyState=P.CLOSING,V(t)),this._socket.end(),t._errorEmitted||(t._errorEmitted=!0,t.emit(`error`,e)))}function V(e){e._closeTimer=setTimeout(e._socket.destroy.bind(e._socket),e._closeTimeout)}function ue(){let e=this[C];if(this.removeListener(`close`,ue),this.removeListener(`data`,de),this.removeListener(`end`,fe),e._readyState=P.CLOSING,!this._readableState.endEmitted&&!e._closeFrameReceived&&!e._receiver._writableState.errorEmitted&&this._readableState.length!==0){let t=this.read(this._readableState.length);e._receiver.write(t)}e._receiver.end(),this[C]=void 0,clearTimeout(e._closeTimer),e._receiver._writableState.finished||e._receiver._writableState.errorEmitted?e.emitClose():(e._receiver.on(`error`,oe),e._receiver.on(`finish`,oe))}function de(e){this[C]._receiver.write(e)||this.pause()}function fe(){let e=this[C];e._readyState=P.CLOSING,e._receiver.end(),this.end()}function pe(){let e=this[C];this.removeListener(`error`,pe),this.on(`error`,w),e&&(e._readyState=P.CLOSING,this.destroy())}})),ei=z(((e,t)=>{$r();let{Duplex:n}=B(`stream`);function r(e){e.emit(`close`)}function i(){!this.destroyed&&this._writableState.finished&&this.destroy()}function a(e){this.removeListener(`error`,a),this.destroy(),this.listenerCount(`error`)===0&&this.emit(`error`,e)}function o(e,t){let o=!0,s=new n({...t,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return e.on(`message`,function(t,n){let r=!n&&s._readableState.objectMode?t.toString():t;s.push(r)||e.pause()}),e.once(`error`,function(e){s.destroyed||(o=!1,s.destroy(e))}),e.once(`close`,function(){s.destroyed||s.push(null)}),s._destroy=function(t,n){if(e.readyState===e.CLOSED){n(t),process.nextTick(r,s);return}let i=!1;e.once(`error`,function(e){i=!0,n(e)}),e.once(`close`,function(){i||n(t),process.nextTick(r,s)}),o&&e.terminate()},s._final=function(t){if(e.readyState===e.CONNECTING){e.once(`open`,function(){s._final(t)});return}e._socket!==null&&(e._socket._writableState.finished?(t(),s._readableState.endEmitted&&s.destroy()):(e._socket.once(`finish`,function(){t()}),e.close()))},s._read=function(){e.isPaused&&e.resume()},s._write=function(t,n,r){if(e.readyState===e.CONNECTING){e.once(`open`,function(){s._write(t,n,r)});return}e.send(t,r)},s.on(`end`,i),s.on(`error`,a),s}t.exports=o})),ti=z(((e,t)=>{let{tokenChars:n}=Jr();function r(e){let t=new Set,r=-1,i=-1,a=0;for(;a<e.length;a++){let o=e.charCodeAt(a);if(i===-1&&n[o]===1)r===-1&&(r=a);else if(a!==0&&(o===32||o===9))i===-1&&r!==-1&&(i=a);else if(o===44){if(r===-1)throw SyntaxError(`Unexpected character at index ${a}`);i===-1&&(i=a);let n=e.slice(r,i);if(t.has(n))throw SyntaxError(`The "${n}" subprotocol is duplicated`);t.add(n),r=i=-1}else throw SyntaxError(`Unexpected character at index ${a}`)}if(r===-1||i!==-1)throw SyntaxError(`Unexpected end of input`);let o=e.slice(r,a);if(t.has(o))throw SyntaxError(`The "${o}" subprotocol is duplicated`);return t.add(o),t}t.exports={parse:r}})),ni=z(((e,t)=>{let n=B(`events`),r=B(`http`),{Duplex:i}=B(`stream`),{createHash:a}=B(`crypto`),o=Qr(),s=qr(),c=ti(),l=$r(),{CLOSE_TIMEOUT:u,GUID:d,kWebSocket:f}=Wr(),p=/^[+/0-9A-Za-z]{22}==$/;t.exports=class extends n{constructor(e,t){if(super(),e={allowSynchronousEvents:!0,autoPong:!0,maxPayload:100*1024*1024,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,closeTimeout:u,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:l,...e},e.port==null&&!e.server&&!e.noServer||e.port!=null&&(e.server||e.noServer)||e.server&&e.noServer)throw TypeError(`One and only one of the "port", "server", or "noServer" options must be specified`);if(e.port==null?e.server&&(this._server=e.server):(this._server=r.createServer((e,t)=>{let n=r.STATUS_CODES[426];t.writeHead(426,{"Content-Length":n.length,"Content-Type":`text/plain`}),t.end(n)}),this._server.listen(e.port,e.host,e.backlog,t)),this._server){let e=this.emit.bind(this,`connection`);this._removeListeners=m(this._server,{listening:this.emit.bind(this,`listening`),error:this.emit.bind(this,`error`),upgrade:(t,n,r)=>{this.handleUpgrade(t,n,r,e)}})}e.perMessageDeflate===!0&&(e.perMessageDeflate={}),e.clientTracking&&(this.clients=new Set,this._shouldEmitClose=!1),this.options=e,this._state=0}address(){if(this.options.noServer)throw Error(`The server is operating in "noServer" mode`);return this._server?this._server.address():null}close(e){if(this._state===2){e&&this.once(`close`,()=>{e(Error(`The server is not running`))}),process.nextTick(h,this);return}if(e&&this.once(`close`,e),this._state!==1)if(this._state=1,this.options.noServer||this.options.server)this._server&&(this._removeListeners(),this._removeListeners=this._server=null),this.clients&&this.clients.size?this._shouldEmitClose=!0:process.nextTick(h,this);else{let e=this._server;this._removeListeners(),this._removeListeners=this._server=null,e.close(()=>{h(this)})}}shouldHandle(e){if(this.options.path){let t=e.url.indexOf(`?`);if((t===-1?e.url:e.url.slice(0,t))!==this.options.path)return!1}return!0}handleUpgrade(e,t,n,r){t.on(`error`,g);let i=e.headers[`sec-websocket-key`],a=e.headers.upgrade,l=+e.headers[`sec-websocket-version`];if(e.method!==`GET`){v(this,e,t,405,`Invalid HTTP method`);return}if(a===void 0||a.toLowerCase()!==`websocket`){v(this,e,t,400,`Invalid Upgrade header`);return}if(i===void 0||!p.test(i)){v(this,e,t,400,`Missing or invalid Sec-WebSocket-Key header`);return}if(l!==13&&l!==8){v(this,e,t,400,`Missing or invalid Sec-WebSocket-Version header`,{"Sec-WebSocket-Version":`13, 8`});return}if(!this.shouldHandle(e)){_(t,400);return}let u=e.headers[`sec-websocket-protocol`],d=new Set;if(u!==void 0)try{d=c.parse(u)}catch{v(this,e,t,400,`Invalid Sec-WebSocket-Protocol header`);return}let f=e.headers[`sec-websocket-extensions`],m={};if(this.options.perMessageDeflate&&f!==void 0){let n=new s({...this.options.perMessageDeflate,isServer:!0,maxPayload:this.options.maxPayload});try{let e=o.parse(f);e[s.extensionName]&&(n.accept(e[s.extensionName]),m[s.extensionName]=n)}catch{v(this,e,t,400,`Invalid or unacceptable Sec-WebSocket-Extensions header`);return}}if(this.options.verifyClient){let a={origin:e.headers[`${l===8?`sec-websocket-origin`:`origin`}`],secure:!!(e.socket.authorized||e.socket.encrypted),req:e};if(this.options.verifyClient.length===2){this.options.verifyClient(a,(a,o,s,c)=>{if(!a)return _(t,o||401,s,c);this.completeUpgrade(m,i,d,e,t,n,r)});return}if(!this.options.verifyClient(a))return _(t,401)}this.completeUpgrade(m,i,d,e,t,n,r)}completeUpgrade(e,t,n,r,i,c,l){if(!i.readable||!i.writable)return i.destroy();if(i[f])throw Error(`server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration`);if(this._state>0)return _(i,503);let u=[`HTTP/1.1 101 Switching Protocols`,`Upgrade: websocket`,`Connection: Upgrade`,`Sec-WebSocket-Accept: ${a(`sha1`).update(t+d).digest(`base64`)}`],p=new this.options.WebSocket(null,void 0,this.options);if(n.size){let e=this.options.handleProtocols?this.options.handleProtocols(n,r):n.values().next().value;e&&(u.push(`Sec-WebSocket-Protocol: ${e}`),p._protocol=e)}if(e[s.extensionName]){let t=e[s.extensionName].params,n=o.format({[s.extensionName]:[t]});u.push(`Sec-WebSocket-Extensions: ${n}`),p._extensions=e}this.emit(`headers`,u,r),i.write(u.concat(`\r
65
+ `).join(`\r
66
+ `)),i.removeListener(`error`,g),p.setSocket(i,c,{allowSynchronousEvents:this.options.allowSynchronousEvents,maxPayload:this.options.maxPayload,skipUTF8Validation:this.options.skipUTF8Validation}),this.clients&&(this.clients.add(p),p.on(`close`,()=>{this.clients.delete(p),this._shouldEmitClose&&!this.clients.size&&process.nextTick(h,this)})),l(p,r)}};function m(e,t){for(let n of Object.keys(t))e.on(n,t[n]);return function(){for(let n of Object.keys(t))e.removeListener(n,t[n])}}function h(e){e._state=2,e.emit(`close`)}function g(){this.destroy()}function _(e,t,n,i){n||=r.STATUS_CODES[t],i={Connection:`close`,"Content-Type":`text/html`,"Content-Length":Buffer.byteLength(n),...i},e.once(`finish`,e.destroy),e.end(`HTTP/1.1 ${t} ${r.STATUS_CODES[t]}\r\n`+Object.keys(i).map(e=>`${e}: ${i[e]}`).join(`\r
67
+ `)+`\r
68
+ \r
69
+ `+n)}function v(e,t,n,r,i,a){if(e.listenerCount(`wsClientError`)){let r=Error(i);Error.captureStackTrace(r,v),e.emit(`wsClientError`,r,n,t)}else _(n,r,i,a)}}));ei(),Qr(),qr(),Yr(),Xr(),ti();var ri=le($r(),1);ni();function ii(e){if(!(e instanceof Error))return e;let t=e;return{...Object.keys(e).reduce((e,n)=>(e[n]=t[n],e),{}),name:e.name,message:e.message,stack:e.stack}}function ai(e){if(e instanceof Error)return e;if(typeof e==`object`&&e){let t=e,n=Error(typeof t.message==`string`?t.message:String(e));return typeof t.name==`string`&&t.name&&(n.name=t.name),typeof t.stack==`string`&&t.stack&&(n.stack=t.stack),Object.assign(n,e),n}return Error(String(e))}var oi=class e{static nextId=0;id;sequenceNumber=1;awaitingPromises={};sendAcknowledgement=!0;remoteApiAcknowledgement=!0;inboundApi;_api;_originalProcessMessageReceived;constructor(t,n){this.properties=n;let r=this;this.id=e.nextId++,this._api=new Proxy({},{get:function(e,t){return async(...e)=>await r.sendInternal({method:t,args:e})}}),this.inboundApi=t(this)}get api(){return this._api}async processMethod(e,t,n){n?this.sendAcknowledgement&&e.sequenceNumber&&this.sendMessage({sequenceNumber:e.sequenceNumber,error:ii(n)}):this.sendAcknowledgement&&e.sequenceNumber&&this.sendMessage({sequenceNumber:e.sequenceNumber,result:{value:t}})}async processResult(e,t,n,r){t(r)}async processError(e,t,n,r){n(ai(r))}async processMessageReceived(e){if(e.method)try{let t=await this.inboundApi[e.method].apply(this.inboundApi,e.args);await this.processMethod(e,t,void 0)}catch(t){t||=Error(`An unknown error occurred`),await this.processMethod(e,void 0,t)}else if(e.result){let{sequenceNumber:t,result:n}=e;if(this.awaitingPromises[t]){let{resolve:r,reject:i}=this.awaitingPromises[t];delete this.awaitingPromises[t],r&&n&&await this.processResult(e,r,i,n.value)}}else if(e.error){let{sequenceNumber:t,error:n}=e;if(this.awaitingPromises[t]){let{resolve:r,reject:i}=this.awaitingPromises[t];delete this.awaitingPromises[t],r&&i&&await this.processError(e,r,i,n)}}}rejectAwaitingPromises(e){Object.values(this.awaitingPromises).forEach(({reject:t})=>t(e))}async onMessageReceived(e){this.processMessageReceived(e)}async sendInternal(e){if(this.remoteApiAcknowledgement&&(this.remoteApiAcknowledgement===!0||this.remoteApiAcknowledgement(e)))return e.sequenceNumber=this.sequenceNumber++,await new Promise(async(t,n)=>{this.awaitingPromises[e.sequenceNumber]={resolve:t,reject:n};try{await this.sendMessage(e)}catch(t){delete this.awaitingPromises[e.sequenceNumber],n(t)}});try{await this.sendMessage(e)}catch{}}dispose(){this.onDisposeListeners.map(e=>e()),this.onDisposeListeners=[],this.onConnectedListeners=[],this.onVersionMismatchListeners=[],this.rejectAwaitingPromises(Error(`Channel disposed`))}onConnectedListeners=[];subscribeOnConnected(e){this.onConnectedListeners.push(e)}unsubscribeOnConnected(e){this.onConnectedListeners=this.onConnectedListeners.filter(t=>t!==e)}connected(){this.onConnectedListeners.map(e=>e()),this.onConnectedListeners=[]}onVersionMismatchListeners=[];subscribeOnVersionMismatch(e){this.onVersionMismatchListeners.push(e)}unsubscribeOnVersionMismatch(e){this.onVersionMismatchListeners=this.onVersionMismatchListeners.filter(t=>t!==e)}versionMismatch(e,t){this.onVersionMismatchListeners.map(n=>n(e,t))}onDisposeListeners=[];subscribeOnDispose(e){this.onDisposeListeners.push(e)}unsubscribeOnDispose(e){this.onDisposeListeners=this.onDisposeListeners.filter(t=>t!==e)}replaceReceiver(e){this._originalProcessMessageReceived||=this.processMessageReceived;let t=e.allowedCalls;this.processMessageReceived=n=>{if(e.filter(n)){if(t<=0)return e.replacement(n);t--}return this._originalProcessMessageReceived.bind(this)(n)}}restoreReceiver(){this.processMessageReceived=(this._originalProcessMessageReceived||this.processMessageReceived).bind(this),delete this._originalProcessMessageReceived}},si=class{_channels=[];get channels(){return[...this._channels]}constructor(e,t){this.inboundApiFactory=e,this.channelBaseConstructor=t}createChannel(e){let t=new this.channelBaseConstructor(this.inboundApiFactory,e);return this._channels.push(t),t.connected(),t}destroyChannel(e){let t=this._channels.indexOf(e);t!==-1&&this._channels.splice(t,1)[0].dispose()}dispose(){this.channels.map(e=>this.destroyChannel(e))}};function ci(e){return e instanceof Error?e.message:String(e)}function li(e){return e instanceof Error?e.toString():String(e)}function ui(e){return e instanceof Error?e:Error(String(e))}var di=class extends oi{remoteApiAcknowledgement;_disposed=!1;_version=``;_onChannelError=()=>{};setOptions(e,t){this._onChannelError=e,this._version=t}constructor(e,t){super(e,t),this.properties=t,this.remoteApiAcknowledgement=t.remoteApiAcknowledgement}async sendMessage(e){if(this._disposed){this._onChannelError(Error(`Channel has been disposed`));return}try{this._version&&typeof e==`object`&&e&&(e.version=this._version);let t=JSON.stringify(e);if(t===void 0)throw TypeError(`Failed to serialize RPC message`);this.properties.socket.send(t,e=>{e&&this.properties.logger.trace(`send callback error:%s`,ci(e))})}catch(e){throw this.properties.logger.trace(`failed to send message: %s`,ci(e)),e}}async processMethod(e,t,n){await super.processMethod(e,t,n)}async processError(e,t,n,r){r&&this.properties.logger.trace(`error processing message: %s, %s`,e,li(r)),await super.processError(e,t,n,r)}async processMessageReceived(e){e.method&&this.properties.logger.trace(`received method call: %s`,e.method),await super.processMessageReceived(e)}dispose(){if(this._disposed=!0,super.dispose(),!this.properties.socket.CLOSED)try{this.properties.socket.close()}catch{}}};function fi(e,t,n){e.on(`message`,e=>{try{t(JSON.parse(e.toString()))}catch(e){n(ui(e))}})}function pi(e,t,n,r){let{secure:i,host:a,port:o,secret:s,onError:c,onClose:l}=e,u={};e.from&&(u.headers={from:e.from});let d=i?`wss://`:`ws://`,f=o?`:${o}`:``,p=s?`?secret=${s}`:``,m=new ri.default(d+(a||`localhost`)+f+p,u);return n&&fi(m,n,e=>{r.trace(`incoming message processing error: %s`,e?.message)}),m.onclose=({code:e,reason:t})=>{r.trace(`client disconnected: %s %s`,e,t);try{l&&l(m,e,t?.toString())}catch(e){r.trace(`error when closing connection: %s`,ci(e))}},m.onerror=e=>{try{r.trace(`connection error: %s`,e.error),c&&c(e.error)}catch(e){r.trace(`error when processing connection error: %s`,ci(e))}},m.onopen=()=>{t()},m}var mi=class extends si{_socket;constructor(e,t){super(t,di),e.onChannelError||=e=>{this.channels.forEach(t=>{t.rejectAwaitingPromises(e),this.destroyChannel(t)})},e.onError||=e=>{this.channels.forEach(t=>{t.rejectAwaitingPromises(e),this.destroyChannel(t)})},e.onClose||=(e,t,n)=>{this.channels.forEach(e=>{e.rejectAwaitingPromises(Error(`WebSocket closed with code ${t} and reason ${n}`)),this.destroyChannel(e)})},this._socket=pi(e,()=>{this.createChannel({socket:this._socket,remoteApiAcknowledgement:!0,logger:e.logger}).setOptions(e.onChannelError,e.version)},e=>{this.channels.forEach(t=>{t.onMessageReceived(e)})},e.logger)}dispose(){this._socket?.close(),super.dispose()}};const hi=K.create(`core/session`);var gi=class{_client;_alive=vi();_api;_disposed=!1;_deactivated=!1;_interrupted=!1;constructor(e,t){this._client=e,this._api=t(()=>this._client.channels)}get alive(){return this._alive.promise}get api(){return this._api}deactivate(){this._deactivated=!0}interrupt(e){if(!this._interrupted){if(this._interrupted=!0,this._deactivated||this._disposed){this._alive.resolve();return}this._alive.reject(e)}}dispose(){this._disposed||(this._disposed=!0,this._interrupted||(this._interrupted=!0,this._alive.resolve()),this._client.dispose())}};async function _i(e,t,n){let r=!1,i=!1,a,o=vi(),s=e=>{if(!r){r=!0,o.reject(e);return}i&&a.interrupt(e)};a=new gi(new mi({port:e,from:`cli`,logger:{trace:(...e)=>{let[t,n,...r]=e;if(typeof t==`string`){hi.trace(F(t,n,...r));return}if(typeof n==`string`||n===void 0){hi.trace(t,n,...r);return}hi.trace({args:e},`Websocket`)}},version:`1.0.0`,onError:e=>{hi.debug({error:e},`Socket error`),s(e)},onChannelError:e=>{hi.debug({error:e},`Channel error`),s(e)},onClose:(e,t,n)=>{hi.debug({code:t,reason:n},`Socket closed`),s(Error(`Socket closed with code ${t} and reason: ${n}`))}},n=>(n.subscribeOnConnected(async()=>{r||(i=!0,r=!0,hi.debug({port:e},`Connected`),o.resolve())}),t)),n);try{return await o.promise,a}catch(e){throw a.dispose(),e}}function vi(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}const yi=new Pr;var bi=class{_logger=K.create(`commands/run/incoming`);constructor(e,t,n){this._options=e,this._path=t,this._restart=n}ping(){}notify(e){}restart(){this._logger.info(`Restart requested`),this._restart()}launched(e){this._logger.info({port:e},`UI launched`)}relicensed(){this._logger.info(`Relicensed`),this._path&&(yi.stop(),yi.check(this._path,this._options.ssl))}stopped(e){}},xi=class{constructor(e){this._channels=e}get _channel(){let[e]=this._channels();if(!e)throw Error(`Core RPC channel is not available`);return e}handshake(e){return this._channel.api.handshake(e)}signal(e){this._channel.api.signal(e)}run(e){return this._channel.api.run(e)}export(e){return this._channel.api.export(e)}},Si=class{_logger=K.create(`commands/run`);async execute(e){this._logger.info({cwd:k(),options:e},`Executing run command`);let t=await this._execute(e);return this._logger.info({result:t},`Executed run command`),t}async _execute(e){let t=await this._cycle(e);return t?`restarted`in t?(this._logger.info(`Restarting process`),await this._execute(e)):(console.info(t.message),t.success):!1}async _cycle(e){let t=!1,n=!1,r,i,a,o=()=>{t=!0},s=await this._attach(e,()=>new bi(e,void 0,()=>{n||r!==void 0||(n=!0,o())}),e=>new xi(e));if(!s)return await this._launch(e);let{manifest:c,session:l}=s;this._logger.info({id:c.id,pid:c.pids.primary,port:c.ports.primary},`Connected to active process from registry`),o=()=>{t||(t=!0,l.deactivate())};let u=this._run(l,e).then(async()=>await l.api.export({format:`llm`})).then(e=>{n||r!==void 0||(r=e,o())}).catch(e=>{n||t||(i=e,o())}),d=l.alive.catch(e=>{t||(a=e,o())});try{await u}finally{o(),l.dispose(),await d}if(n)return{restarted:!0};if(a)throw a;if(i)throw i;return r}async _launch(e){let t=await Br({...e,skill:!0,smart:e.smart||e.paths.length>0},new Nr,yi),n=t.exited(),r=await Promise.race([t.ready,n.then(()=>void 0)]);if(r===void 0)return;let i,a,o,s,c,l=!1,u=!1,d=!1,f,p,m,h,g=()=>(h?.(),p||(p=t.stop(),p.catch(()=>{})),p);try{m=await _i(r,new bi(e,t.location.path,()=>{u||c!==void 0||(u=!0,g())}),e=>new xi(e)),yi.restarter={restart(e){m.api.signal({type:`update`,version:e})}},h=()=>{l||(l=!0,m.deactivate())}}catch(e){try{await t.stop(),await n}catch(e){this._logger.warn({error:e},`Failed to stop process after connection failure`)}throw e}t.stopping.then(()=>{h?.()}),f=this._run(m,e).then(async()=>await m.api.export({format:`llm`})).then(t=>{if(!(u||c!==void 0)){if(c=t,e.exit)return g();d=!0,h?.()}}).catch(async e=>{if(!(u||l)){o=e;try{await g()}catch(e){this._logger.warn({error:e},`Failed to stop process after run/export failure`)}}});let _=m.alive.catch(async e=>{if(!l){a=e;try{await g()}catch(e){this._logger.warn({error:e},`Failed to stop process after connection loss`)}}});try{if(f&&await f,d&&t.release(),!d)try{await n}catch(e){i=e}}finally{if(yi.restarter=void 0,m.dispose(),await _,p)try{await p}catch(e){s=e}}if(s)throw s;if(u)return{restarted:!0};if(i)throw i;if(a)throw a;if(o)throw o;if(c)return c}async _attach(e,t,n){if(e.new)return;let r=this._find(e);if(r.length===0)return;let i=await this._connect(r,t,n);if(i)return i;throw Error(`Failed to attach to active Wallaby instance for the specified config.`)}async _connect([e,...t],n,r){if(e){this._logger.info({id:e.id,pid:e.pids.primary,port:e.ports.primary},`Trying to connect to active process from registry`);try{return{manifest:e,session:await _i(e.ports.primary,n(e),r)}}catch(i){return this._logger.warn({error:i,id:e.id,pid:e.pids.primary,port:e.ports.primary},`Failed to connect to active process from registry`),await this._connect(t,n,r)}}}async _run(e,t){await e.api.run({paths:t.paths})}_find(e){let t=cn(s(e.config?e.config:i(k(),`auto.detect`)));return new Ur().manifests.filter(e=>e.paths.config===t).sort((e,t)=>t.timestamps.refreshed-e.timestamps.refreshed).filter(e=>{try{return process.kill(e.pids.primary,0),!0}catch(e){return(typeof e==`object`&&e&&`code`in e?e.code:void 0)===`EPERM`}})}},Ci=z(((e,t)=>{t.exports=a,a.sync=o;var n=B(`fs`);function r(e,t){var n=t.pathExt===void 0?process.env.PATHEXT:t.pathExt;if(!n||(n=n.split(`;`),n.indexOf(``)!==-1))return!0;for(var r=0;r<n.length;r++){var i=n[r].toLowerCase();if(i&&e.substr(-i.length).toLowerCase()===i)return!0}return!1}function i(e,t,n){return!e.isSymbolicLink()&&!e.isFile()?!1:r(t,n)}function a(e,t,r){n.stat(e,function(n,a){r(n,n?!1:i(a,e,t))})}function o(e,t){return i(n.statSync(e),e,t)}})),wi=z(((e,t)=>{t.exports=r,r.sync=i;var n=B(`fs`);function r(e,t,r){n.stat(e,function(e,n){r(e,e?!1:a(n,t))})}function i(e,t){return a(n.statSync(e),t)}function a(e,t){return e.isFile()&&o(e,t)}function o(e,t){var n=e.mode,r=e.uid,i=e.gid,a=t.uid===void 0?process.getuid&&process.getuid():t.uid,o=t.gid===void 0?process.getgid&&process.getgid():t.gid,s=64,c=8,l=1,u=s|c;return n&l||n&c&&i===o||n&s&&r===a||n&u&&a===0}})),Ti=z(((e,t)=>{B(`fs`);var n=process.platform===`win32`||global.TESTING_WINDOWS?Ci():wi();t.exports=r,r.sync=i;function r(e,t,i){if(typeof t==`function`&&(i=t,t={}),!i){if(typeof Promise!=`function`)throw TypeError(`callback not provided`);return new Promise(function(n,i){r(e,t||{},function(e,t){e?i(e):n(t)})})}n(e,t||{},function(e,n){e&&(e.code===`EACCES`||t&&t.ignoreErrors)&&(e=null,n=!1),i(e,n)})}function i(e,t){try{return n.sync(e,t||{})}catch(e){if(t&&t.ignoreErrors||e.code===`EACCES`)return!1;throw e}}})),Ei=z(((e,t)=>{let n=process.platform===`win32`||process.env.OSTYPE===`cygwin`||process.env.OSTYPE===`msys`,r=B(`path`),i=n?`;`:`:`,a=Ti(),o=e=>Object.assign(Error(`not found: ${e}`),{code:`ENOENT`}),s=(e,t)=>{let r=t.colon||i,a=e.match(/\//)||n&&e.match(/\\/)?[``]:[...n?[process.cwd()]:[],...(t.path||process.env.PATH||``).split(r)],o=n?t.pathExt||process.env.PATHEXT||`.EXE;.CMD;.BAT;.COM`:``,s=n?o.split(r):[``];return n&&e.indexOf(`.`)!==-1&&s[0]!==``&&s.unshift(``),{pathEnv:a,pathExt:s,pathExtExe:o}},c=(e,t,n)=>{typeof t==`function`&&(n=t,t={}),t||={};let{pathEnv:i,pathExt:c,pathExtExe:l}=s(e,t),u=[],d=n=>new Promise((a,s)=>{if(n===i.length)return t.all&&u.length?a(u):s(o(e));let c=i[n],l=/^".*"$/.test(c)?c.slice(1,-1):c,d=r.join(l,e);a(f(!l&&/^\.[\\\/]/.test(e)?e.slice(0,2)+d:d,n,0))}),f=(e,n,r)=>new Promise((i,o)=>{if(r===c.length)return i(d(n+1));let s=c[r];a(e+s,{pathExt:l},(a,o)=>{if(!a&&o)if(t.all)u.push(e+s);else return i(e+s);return i(f(e,n,r+1))})});return n?d(0).then(e=>n(null,e),n):d(0)};t.exports=c,c.sync=(e,t)=>{t||={};let{pathEnv:n,pathExt:i,pathExtExe:c}=s(e,t),l=[];for(let o=0;o<n.length;o++){let s=n[o],u=/^".*"$/.test(s)?s.slice(1,-1):s,d=r.join(u,e),f=!u&&/^\.[\\\/]/.test(e)?e.slice(0,2)+d:d;for(let e=0;e<i.length;e++){let n=f+i[e];try{if(a.sync(n,{pathExt:c}))if(t.all)l.push(n);else return n}catch{}}}if(t.all&&l.length)return l;if(t.nothrow)return null;throw o(e)}})),Di=z(((e,t)=>{let n=(e={})=>{let t=e.env||process.env;return(e.platform||process.platform)===`win32`?Object.keys(t).reverse().find(e=>e.toUpperCase()===`PATH`)||`Path`:`PATH`};t.exports=n,t.exports.default=n})),Oi=z(((e,t)=>{let n=B(`path`),r=Ei(),i=Di();function a(e,t){let a=e.options.env||process.env,o=process.cwd(),s=e.options.cwd!=null,c=s&&process.chdir!==void 0&&!process.chdir.disabled;if(c)try{process.chdir(e.options.cwd)}catch{}let l;try{l=r.sync(e.command,{path:a[i({env:a})],pathExt:t?n.delimiter:void 0})}catch{}finally{c&&process.chdir(o)}return l&&=n.resolve(s?e.options.cwd:``,l),l}function o(e){return a(e)||a(e,!0)}t.exports=o})),ki=z(((e,t)=>{let n=/([()\][%!^"`<>&|;, *?])/g;function r(e){return e=e.replace(n,`^$1`),e}function i(e,t){return e=`${e}`,e=e.replace(/(?=(\\+?)?)\1"/g,`$1$1\\"`),e=e.replace(/(?=(\\+?)?)\1$/,`$1$1`),e=`"${e}"`,e=e.replace(n,`^$1`),t&&(e=e.replace(n,`^$1`)),e}t.exports.command=r,t.exports.argument=i})),Ai=z(((e,t)=>{t.exports=/^#!(.*)/})),ji=z(((e,t)=>{let n=Ai();t.exports=(e=``)=>{let t=e.match(n);if(!t)return null;let[r,i]=t[0].replace(/#! ?/,``).split(` `),a=r.split(`/`).pop();return a===`env`?i:i?`${a} ${i}`:a}})),Mi=z(((e,t)=>{let n=B(`fs`),r=ji();function i(e){let t=Buffer.alloc(150),i;try{i=n.openSync(e,`r`),n.readSync(i,t,0,150,0),n.closeSync(i)}catch{}return r(t.toString())}t.exports=i})),Ni=z(((e,t)=>{let n=B(`path`),r=Oi(),i=ki(),a=Mi(),o=process.platform===`win32`,s=/\.(?:com|exe)$/i,c=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function l(e){e.file=r(e);let t=e.file&&a(e.file);return t?(e.args.unshift(e.file),e.command=t,r(e)):e.file}function u(e){if(!o)return e;let t=l(e),r=!s.test(t);if(e.options.forceShell||r){let r=c.test(t);e.command=n.normalize(e.command),e.command=i.command(e.command),e.args=e.args.map(e=>i.argument(e,r)),e.args=[`/d`,`/s`,`/c`,`"${[e.command].concat(e.args).join(` `)}"`],e.command=process.env.comspec||`cmd.exe`,e.options.windowsVerbatimArguments=!0}return e}function d(e,t,n){t&&!Array.isArray(t)&&(n=t,t=null),t=t?t.slice(0):[],n=Object.assign({},n);let r={command:e,args:t,options:n,file:void 0,original:{command:e,args:t}};return n.shell?r:u(r)}t.exports=d})),Pi=z(((e,t)=>{let n=process.platform===`win32`;function r(e,t){return Object.assign(Error(`${t} ${e.command} ENOENT`),{code:`ENOENT`,errno:`ENOENT`,syscall:`${t} ${e.command}`,path:e.command,spawnargs:e.args})}function i(e,t){if(!n)return;let r=e.emit;e.emit=function(n,i){if(n===`exit`){let n=a(i,t);if(n)return r.call(e,`error`,n)}return r.apply(e,arguments)}}function a(e,t){return n&&e===1&&!t.file?r(t.original,`spawn`):null}function o(e,t){return n&&e===1&&!t.file?r(t.original,`spawnSync`):null}t.exports={hookChildProcess:i,verifyENOENT:a,verifyENOENTSync:o,notFoundError:r}})),Fi=z(((e,t)=>{let n=B(`child_process`),r=Ni(),i=Pi();function a(e,t,a){let o=r(e,t,a),s=n.spawn(o.command,o.args,o.options);return i.hookChildProcess(s,o),s}function o(e,t,a){let o=r(e,t,a),s=n.spawnSync(o.command,o.args,o.options);return s.error=s.error||i.verifyENOENTSync(s.status,o),s}t.exports=a,t.exports.spawn=a,t.exports.sync=o,t.exports._parse=r,t.exports._enoent=i}));function Ii(){try{return d.statSync(`/.dockerenv`),!0}catch{return!1}}function Li(){try{return d.readFileSync(`/proc/self/cgroup`,`utf8`).includes(`docker`)}catch{return!1}}function Ri(){return zi===void 0&&(zi=Ii()||Li()),zi}var zi,Bi=R((()=>{}));function Vi(){return Hi===void 0&&(Hi=Ui()||Ri()),Hi}var Hi,Ui,Wi=R((()=>{Bi(),Ui=()=>{try{return d.statSync(`/run/.containerenv`),!0}catch{return!1}}})),Gi,Ki,qi=R((()=>{Wi(),Gi=()=>{if(O.platform!==`linux`)return!1;if(c.release().toLowerCase().includes(`microsoft`))return!Vi();try{if(d.readFileSync(`/proc/version`,`utf8`).toLowerCase().includes(`microsoft`))return!Vi()}catch{}return d.existsSync(`/proc/sys/fs/binfmt_misc/WSLInterop`)||d.existsSync(`/run/WSL`)?!Vi():!1},Ki=O.env.__IS_WSL_TEST__?Gi:Gi()})),Ji,Yi,Xi,Zi=R((()=>{qi(),Ji=(()=>{let e=`/mnt/`,t;return async function(){if(t)return t;let n=`/etc/wsl.conf`,r=!1;try{await v.access(n,y.F_OK),r=!0}catch{}if(!r)return e;let i=await v.readFile(n,{encoding:`utf8`}),a=/(?<!#.*)root\s*=\s*(?<mountPoint>.*)/g.exec(i);return a?(t=a.groups.mountPoint.trim(),t=t.endsWith(`/`)?t:`${t}/`,t):e}})(),Yi=async()=>`${await Ji()}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`,Xi=async()=>Ki?Yi():`${O.env.SYSTEMROOT||O.env.windir||String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`}));function Qi(e,t,n){let r=n=>Object.defineProperty(e,t,{value:n,enumerable:!0,writable:!0});return Object.defineProperty(e,t,{configurable:!0,enumerable:!0,get(){let e=n();return r(e),e},set(e){r(e)}}),e}var $i=R((()=>{}));async function ea(){if(O.platform!==`darwin`)throw Error(`macOS only`);let{stdout:e}=await ta(`defaults`,[`read`,`com.apple.LaunchServices/com.apple.launchservices.secure`,`LSHandlers`]),t=/LSHandlerRoleAll = "(?!-)(?<id>[^"]+?)";\s+?LSHandlerURLScheme = (?:http|https);/.exec(e)?.groups.id??`com.apple.Safari`;return t===`com.apple.safari`?`com.apple.Safari`:t}var ta,na=R((()=>{ta=I(P)}));async function ra(e,{humanReadableOutput:t=!0,signal:n}={}){if(O.platform!==`darwin`)throw Error(`macOS only`);let r=t?[]:[`-ss`],i={};n&&(i.signal=n);let{stdout:a}=await ia(`osascript`,[`-e`,e,r],i);return a.trim()}var ia,aa=R((()=>{ia=I(P)}));async function oa(e){return ra(`tell application "Finder" to set app_path to application file id "${e}" as string\ntell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`)}var sa=R((()=>{aa()}));async function ca(e=la){let{stdout:t}=await e(`reg`,[`QUERY`,` HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\http\\UserChoice`,`/v`,`ProgId`]),n=/ProgId\s*REG_SZ\s*(?<id>\S+)/.exec(t);if(!n)throw new da(`Cannot find Windows browser in stdout: ${JSON.stringify(t)}`);let{id:r}=n.groups,i=r.lastIndexOf(`.`),a=r.lastIndexOf(`-`),o=i===-1?void 0:r.slice(0,i),s=a===-1?void 0:r.slice(0,a);return ua[r]??ua[o]??ua[s]??{name:r,id:r}}var la,ua,da,fa=R((()=>{la=I(P),ua={MSEdgeHTM:{name:`Edge`,id:`com.microsoft.edge`},MSEdgeBHTML:{name:`Edge Beta`,id:`com.microsoft.edge.beta`},MSEdgeDHTML:{name:`Edge Dev`,id:`com.microsoft.edge.dev`},AppXq0fevzme2pys62n3e0fbqa7peapykr8v:{name:`Edge`,id:`com.microsoft.edge.old`},ChromeHTML:{name:`Chrome`,id:`com.google.chrome`},ChromeBHTML:{name:`Chrome Beta`,id:`com.google.chrome.beta`},ChromeDHTML:{name:`Chrome Dev`,id:`com.google.chrome.dev`},ChromiumHTM:{name:`Chromium`,id:`org.chromium.Chromium`},BraveHTML:{name:`Brave`,id:`com.brave.Browser`},BraveBHTML:{name:`Brave Beta`,id:`com.brave.Browser.beta`},BraveDHTML:{name:`Brave Dev`,id:`com.brave.Browser.dev`},BraveSSHTM:{name:`Brave Nightly`,id:`com.brave.Browser.nightly`},FirefoxURL:{name:`Firefox`,id:`org.mozilla.firefox`},OperaStable:{name:`Opera`,id:`com.operasoftware.Opera`},VivaldiHTM:{name:`Vivaldi`,id:`com.vivaldi.Vivaldi`},"IE.HTTP":{name:`Internet Explorer`,id:`com.microsoft.ie`}},new Map(Object.entries(ua)),da=class extends Error{}}));async function pa(){if(O.platform===`darwin`){let e=await ea();return{name:await oa(e),id:e}}if(O.platform===`linux`){let{stdout:e}=await ma(`xdg-mime`,[`query`,`default`,`x-scheme-handler/http`]),t=e.trim();return{name:ha(t.replace(/.desktop$/,``).replace(`-`,` `)),id:t}}if(O.platform===`win32`)return ca();throw Error(`Only macOS, Linux, and Windows are supported`)}var ma,ha,ga=R((()=>{na(),sa(),fa(),ma=I(P),ha=e=>e.toLowerCase().replaceAll(/(?:^|\s|-)\S/g,e=>e.toUpperCase())})),_a=se({apps:()=>Aa,default:()=>Oa,openApp:()=>ka});async function va(){let e=await Xi(),t=String.raw`(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice").ProgId`,{stdout:n}=await xa(e,[`-NoProfile`,`-NonInteractive`,`-ExecutionPolicy`,`Bypass`,`-EncodedCommand`,te.from(t,`utf16le`).toString(`base64`)],{encoding:`utf8`}),r=n.trim(),i={ChromeHTML:`com.google.chrome`,BraveHTML:`com.brave.Browser`,MSEdgeHTM:`com.microsoft.edge`,FirefoxURL:`org.mozilla.firefox`};return i[r]?{id:i[r]}:{}}function ya(e){if(typeof e==`string`||Array.isArray(e))return e;let{[Ta]:t}=e;if(!t)throw Error(`${Ta} is not supported`);return t}function ba({[wa]:e},{wsl:t}){if(t&&Ki)return ya(t);if(!e)throw Error(`${wa} is not supported`);return ya(e)}var xa,Sa,Ca,wa,Ta,Ea,Da,Oa,ka,Aa,ja=R((()=>{Zi(),$i(),ga(),Wi(),xa=I(M.execFile),Sa=t.dirname(_(import.meta.url)),Ca=t.join(Sa,`xdg-open`),{platform:wa,arch:Ta}=O,Ea=async(e,t)=>{let n;for(let r of e)try{return await t(r)}catch(e){n=e}throw n},Da=async e=>{if(e={wait:!1,background:!1,newInstance:!1,allowNonzeroExitCode:!1,...e},Array.isArray(e.app))return Ea(e.app,t=>Da({...e,app:t}));let{name:t,arguments:n=[]}=e.app??{};if(n=[...n],Array.isArray(t))return Ea(t,t=>Da({...e,app:{name:t,arguments:n}}));if(t===`browser`||t===`browserPrivate`){let r={"com.google.chrome":`chrome`,"google-chrome.desktop":`chrome`,"com.brave.Browser":`brave`,"org.mozilla.firefox":`firefox`,"firefox.desktop":`firefox`,"com.microsoft.msedge":`edge`,"com.microsoft.edge":`edge`,"com.microsoft.edgemac":`edge`,"microsoft-edge.desktop":`edge`},i={chrome:`--incognito`,brave:`--incognito`,firefox:`--private-window`,edge:`--inPrivate`},a=Ki?await va():await pa();if(a.id in r){let o=r[a.id];return t===`browserPrivate`&&n.push(i[o]),Da({...e,app:{name:Aa[o],arguments:n}})}throw Error(`${a.name} is not supported as a default browser`)}let r,i=[],a={};if(wa===`darwin`)r=`open`,e.wait&&i.push(`--wait-apps`),e.background&&i.push(`--background`),e.newInstance&&i.push(`--new`),t&&i.push(`-a`,t);else if(wa===`win32`||Ki&&!Vi()&&!t){r=await Xi(),i.push(`-NoProfile`,`-NonInteractive`,`-ExecutionPolicy`,`Bypass`,`-EncodedCommand`),Ki||(a.windowsVerbatimArguments=!0);let o=[`Start`];e.wait&&o.push(`-Wait`),t?(o.push(`"\`"${t}\`""`),e.target&&n.push(e.target)):e.target&&o.push(`"${e.target}"`),n.length>0&&(n=n.map(e=>`"\`"${e}\`""`),o.push(`-ArgumentList`,n.join(`,`))),e.target=te.from(o.join(` `),`utf16le`).toString(`base64`)}else{if(t)r=t;else{let e=!Sa||Sa===`/`,t=!1;try{await v.access(Ca,y.X_OK),t=!0}catch{}r=O.versions.electron??(wa===`android`||e||!t)?`xdg-open`:Ca}n.length>0&&i.push(...n),e.wait||(a.stdio=`ignore`,a.detached=!0)}wa===`darwin`&&n.length>0&&i.push(`--args`,...n),e.target&&i.push(e.target);let o=M.spawn(r,i,a);return e.wait?new Promise((t,n)=>{o.once(`error`,n),o.once(`close`,r=>{if(!e.allowNonzeroExitCode&&r>0){n(Error(`Exited with code ${r}`));return}t(o)})}):(o.unref(),o)},Oa=(e,t)=>{if(typeof e!=`string`)throw TypeError("Expected a `target`");return Da({...t,target:e})},ka=(e,t)=>{if(typeof e!=`string`&&!Array.isArray(e))throw TypeError("Expected a valid `name`");let{arguments:n=[]}=t??{};if(n!=null&&!Array.isArray(n))throw TypeError("Expected `appArguments` as Array type");return Da({...t,app:{name:e,arguments:n}})},Aa={},Qi(Aa,`chrome`,()=>ba({darwin:`google chrome`,win32:`chrome`,linux:[`google-chrome`,`google-chrome-stable`,`chromium`]},{wsl:{ia32:`/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe`,x64:[`/mnt/c/Program Files/Google/Chrome/Application/chrome.exe`,`/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe`]}})),Qi(Aa,`brave`,()=>ba({darwin:`brave browser`,win32:`brave`,linux:[`brave-browser`,`brave`]},{wsl:{ia32:`/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe`,x64:[`/mnt/c/Program Files/BraveSoftware/Brave-Browser/Application/brave.exe`,`/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe`]}})),Qi(Aa,`firefox`,()=>ba({darwin:`firefox`,win32:String.raw`C:\Program Files\Mozilla Firefox\firefox.exe`,linux:`firefox`},{wsl:`/mnt/c/Program Files/Mozilla Firefox/firefox.exe`})),Qi(Aa,`edge`,()=>ba({darwin:`microsoft edge`,win32:`msedge`,linux:[`microsoft-edge`,`microsoft-edge-dev`]},{wsl:`/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe`})),Qi(Aa,`browser`,()=>`browser`),Qi(Aa,`browserPrivate`,()=>`browserPrivate`)})),Ma=le(Fi(),1);const $=K.create(`browser`);function Na(e){let t=process.env.BROWSER||``;$.info({url:e,browser:t||`default`},`Opening browser`),t.toLowerCase().endsWith(`.js`)?Fa(t,e):t.toLowerCase()===`none`?$.debug({url:e},`Browser auto-open disabled by environment`):La(t,process.env.BROWSER_ARGS?process.env.BROWSER_ARGS.split(` `):[],e)}function Pa(e,t){return new Promise((n,r)=>{$.debug({command:e,cwd:t?.cwd},`Executing shell command`),N(e,t,(i,a)=>{i?($.error({err:i,command:e,cwd:t?.cwd},`Shell command failed`),r(i)):($.debug({command:e,cwd:t?.cwd},`Shell command completed`),n(a.toString()))})})}function Fa(e,t){let n=process.argv.slice(2);$.debug({scriptPath:e,url:t,extraArgs:n},`Launching browser script`);let r=(0,Ma.default)(process.execPath,[e,...n,t],{stdio:`inherit`});r.on(`error`,n=>{$.error({err:n,scriptPath:e,url:t},`Browser script process failed to start`)}),r.on(`close`,n=>{n===0?$.debug({scriptPath:e,url:t},`Browser script completed successfully`):($.warn({code:n,scriptPath:e,url:t},`Browser script exited with a non-zero status`),process.stdout.write(G.default.red(`\nThe script specified as BROWSER environment variable failed.\n\n${G.default.cyan(e)} exited with code ${n}.`)))})}const Ia=[`Google Chrome Canary`,`Google Chrome Dev`,`Google Chrome Beta`,`Google Chrome`,`Microsoft Edge`,`Brave Browser`,`Vivaldi`,`Chromium`];async function La(e,t,n){let r=e===`google chrome`?`Google Chrome`:e,i=process.platform===`darwin`&&(!r||Ia.includes(r));if($.debug({browser:r,browserArgs:t,url:n},`Starting browser process`),i)try{let e=await Pa(`ps cax`),t=r&&e.includes(r)?r:Ia.find(t=>e.includes(t));if(t)return await Pa(`osascript openChrome.applescript "${encodeURI(n)}" "${t}"`,{cwd:X.paths.dirs.package.bin}),$.debug({openedBrowser:t,url:n},`Opened browser via AppleScript`),!0}catch(e){$.debug({err:e,url:n},`AppleScript browser reuse attempt failed`)}process.platform===`darwin`&&e===`open`&&(e=void 0);try{let r=e?{app:{name:e,arguments:t}}:{},i;try{i=(await Promise.resolve().then(()=>(ja(),_a))).default}catch(e){$.error({err:e},`Failed to import browser opener`)}if(i)try{let t=await i(n,r);$.debug({url:n,browser:e||`default`},`Opened browser with open package`),t.on(`error`,e=>{$.error({err:e,url:n},`Browser subprocess reported an error`),process.stderr.write(e.stack||e.message)})}catch(e){$.error({err:e,url:n},`Failed to open browser`),process.stderr.write(e instanceof Error?e.stack||e.message:String(e))}else $.warn({url:n},`Browser opener module was unavailable`);return!0}catch(t){return $.warn({err:t,url:n,browser:e||`default`},`Browser launch failed`),!1}}const Ra=K.create(`core/notifications`);function za(e,t){if(!t.text){Ra.trace({type:t.type},`Skipping empty notification`);return}Ra.debug({type:t.type,button:!!t.button},`Received notification from core`);let n=[];if(~t.text.indexOf(`expire`)&&t.type===`warning`&&e.notifications===!1){Ra.trace({type:t.type},`Suppressed expiration notification`);return}let r=`http://localhost:${e.port}`;~t.text.indexOf(`activate-link`)&&e.port&&n.push({title:`Enter License`,url:r}),~t.text.indexOf(`continue-trial-link`)&&e.port&&n.push({title:`Continue Trial`,url:r}),t.button&&n.push({title:t.button.label,url:t.button.link}),t.text=t.text.replace(/<br\/><br\/>/g,` `).replace(/<br\/>/g,` `).replace(/<a\s+(?:[^>]*?\s+)?href=['"]([^'"]*)['"]/g,(e,t)=>(t.startsWith(`http`)&&n.push({url:t}),e)).replace(/<[^>]*>/g,``);let i=t.type===`error`?G.default.red:t.type===`warning`?G.default.yellow:G.default.green;if(process.stdout.write(i(`\n ⚑ ${t.text}\n\n`)),n.length)for(let e of n)process.stdout.write(`${G.default.green(` ➜ `)}${G.default.bold(G.default.yellow(e.title?e.title+`: `:``))}${G.default.cyan(e.url)}\n`);Ra.trace({links:n},`Rendered notification links`)}const Ba=new Pr;var Va=class{_logger=K.create(`commands/start/incoming`);_port;constructor(e,t,n,r){this._options=e,this._path=t,this._version=n,this._restart=r}ping(){}notify(e){za({notifications:this._options.notifications,port:this._port,ui:this._options.ui},e)}restart(){this._logger.info(`Restart requested`),this._restart()}launched(e){this._logger.info({port:e},`UI launched`),this._port=e;let t=`http://localhost:${e}`;process.stdout.write(G.default.green(` ${G.default.bold(`WALLABY CORE`)}${this._version?` v${this._version}`:``}\n`)),process.stdout.write(`${G.default.green(` ➜ `)}${G.default.bold(G.default.yellow(`UI:`))} ${G.default.cyan(t)}\n`),process.stdout.write(`${G.default.green(` ➜ `)}${G.default.bold(G.default.dim(`Docs:`))} ${G.default.cyan(`https://wallabyjs.com/docs`)}\n`),this._options.ui!==!1&&Na(t)}relicensed(){this._logger.info(`Relicensed`),this._path&&(Ba.stop(),Ba.check(this._path,this._options.ssl))}stopped(e){}},Ha=class{constructor(e){this._channels=e}get _channel(){let[e]=this._channels();if(!e)throw Error(`Core RPC channel is not available`);return e}handshake(e){return this._channel.api.handshake(e)}signal(e){this._channel.api.signal(e)}run(e){return this._channel.api.run(e)}export(e){return this._channel.api.export(e)}},Ua=class{_logger=K.create(`commands/start`);async execute(e){this._logger.info({cwd:k(),options:e},`Executing start command`);let t=await this._execute(e);return this._logger.info({result:t},`Executed start command`),t}async _execute(e){return await this._cycle(e)?(this._logger.info(`Restarting process`),await this._execute(e)):!0}async _cycle(e){if(!e.force){let t=this._find(e)[0];if(t)return this._logger.info({id:t.id,pid:t.pids.primary,port:t.ports.primary},`Active process is already running for the specified config`),console.warn(`Wallaby Core is already started.`),!1}let t=await Br({...e,smart:e.smart||e.paths.length>0},new Nr,Ba),n=t.exited(),r=await Promise.race([t.ready,n.then(()=>void 0)]);if(r===void 0)return!1;let i,a,o,s,c=!1,l,u,d=()=>(l||(l=t.stop(),l.catch(()=>{})),l);try{u=await _i(r,new Va(e,t.location.path,t.version,()=>{c||(c=!0,d())}),e=>new Ha(e)),Ba.restarter={restart(e){u.api.signal({type:`update`,version:e})}}}catch(e){try{await t.stop(),await n}catch(e){this._logger.warn({error:e},`Failed to stop process after connection failure`)}throw e}t.stopping.then(()=>u.deactivate());let f=u.alive.catch(async e=>{a=e;try{await d()}catch(e){this._logger.warn({error:e},`Failed to stop process after connection loss`)}});try{await this._handshake(u),t.location.type===`dist`&&Ba.schedule(t.location.path,e.ssl),await this._run(u,e).catch(async e=>{if(!c){o=e;try{await d()}catch(e){this._logger.warn({error:e},`Failed to stop process after run failure`)}}}),await n}catch(e){if(i=e,!c)try{await d(),await n.catch(()=>{})}catch(e){this._logger.warn({error:e},`Failed to stop process after startup failure`)}}finally{if(Ba.restarter=void 0,u.dispose(),await f,l)try{await l}catch(e){s=e}}if(s)throw s;if(i)throw i;if(o)throw o;if(a&&!(a instanceof Error&&a.message.startsWith(`Socket closed with code 1006 and reason:`)))throw a;return c}async _run(e,t){t.paths.length!==0&&await e.api.run({paths:t.paths})}async _handshake(e){let t=await e.api.handshake(X.version);if(!t.compatible)throw Error(t.message||`Wallaby CLI v${X.version} is not compatible with the running Wallaby Core.`)}_find(e){let t=cn(s(e.config?e.config:i(k(),`auto.detect`)));return new Ur().manifests.filter(e=>e.paths.config===t).sort((e,t)=>t.timestamps.refreshed-e.timestamps.refreshed).filter(e=>{try{return process.kill(e.pids.primary,0),!0}catch(e){return(typeof e==`object`&&e&&`code`in e?e.code:void 0)===`EPERM`}})}},Wa=class{_logger=K.create(`commands/stop`);async execute(e){this._logger.info({cwd:k(),options:e},`Executing stop command`);let t=cn(s(e.config?e.config:i(k(),`auto.detect`)));this._logger.info({config:t},`Determined config path and config directory`);let n=new Ur().manifests.filter(n=>e.all?!0:e.config?n.paths.config===t:r(n.paths.config)===r(t));if(n.length!==0)for(let e of n)this._stop(e);else this._logger.info(`No running processes matched stop criteria`);this._logger.info({count:n.length},`Executed stop command`)}_stop(e){this._logger.info({id:e.id,pid:e.pids.primary,config:e.paths.config},`Stopping process from registry`);try{process.kill(e.pids.primary,`SIGTERM`)}catch(e){this._logger.info({error:e},`Failed to send SIGTERM to process, it may have already stopped`)}this._logger.info({id:e.id,pid:e.pids.primary},`Stopped process from registry`)}};K.initialize({path:i(X.paths.dirs.current,`logs`,`wallaby-cli.log`)});const Ga=K.create(`cli`);async function Ka(){Ga.trace({argv:process.argv.slice(2),version:X.version},`Parsing CLI arguments`);let e=ht(process.argv,X.version);if(e){if(await W.default.ensureDir(X.paths.dirs.current),e.action===`stop`){await new Wa().execute(e.options);return}if(e.action===`run`){let t=await new Si().execute(e.options);process.exitCode=+!t;return}await new Ua().execute(e.options)}}async function qa(){try{await Ka()}catch(e){Ga.error({error:e},`Wallaby CLI failed`),console.error(G.default.red(e instanceof Error?e.message:String(e))),process.exitCode=1}finally{try{await K.shutdown()}catch(e){process.stderr.write(`[logger] ${e instanceof Error?e.stack||e.message:String(e)}\n`),process.exitCode=1}}}qa();export{};
package/package.json CHANGED
@@ -1,22 +1,26 @@
1
1
  {
2
2
  "name": "@wallabyjs/cli",
3
- "version": "1.0.11",
4
- "main": "./index.js",
3
+ "version": "1.0.13",
5
4
  "description": "Wallaby CLI",
6
5
  "homepage": "https://wallabyjs.com",
7
- "author": "Wallaby Team <hello@wallabyjs.com>",
8
6
  "bugs": {
9
7
  "url": "https://github.com/wallabyjs/public/issues"
10
8
  },
9
+ "author": "Wallaby Team <hello@wallabyjs.com>",
11
10
  "bin": {
12
11
  "wallaby": "bin/index.js"
13
12
  },
14
13
  "files": [
15
- "bin",
16
- "index.js",
14
+ "bin/index.js",
15
+ "bin/openChrome.applescript",
16
+ "dist",
17
17
  "README.md"
18
18
  ],
19
+ "type": "module",
19
20
  "publishConfig": {
20
21
  "access": "public"
22
+ },
23
+ "engines": {
24
+ "node": ">=22"
21
25
  }
22
26
  }
package/index.js DELETED
@@ -1,76 +0,0 @@
1
- var Ju=Object.create;var qt=Object.defineProperty;var Qu=Object.getOwnPropertyDescriptor;var el=Object.getOwnPropertyNames;var tl=Object.getPrototypeOf,rl=Object.prototype.hasOwnProperty;var Ae=(t,e)=>()=>(t&&(e=t(t=0)),e);var y=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),nl=(t,e)=>{for(var r in e)qt(t,r,{get:e[r],enumerable:!0})},Mn=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of el(e))!rl.call(t,i)&&i!==r&&qt(t,i,{get:()=>e[i],enumerable:!(n=Qu(e,i))||n.enumerable});return t};var Q=(t,e,r)=>(r=t!=null?Ju(tl(t)):{},Mn(e||!t||!t.__esModule?qt(r,"default",{value:t,enumerable:!0}):r,t)),il=t=>Mn(qt({},"__esModule",{value:!0}),t);var te=y(vr=>{"use strict";vr.fromCallback=function(t){return Object.defineProperty(function(...e){if(typeof e[e.length-1]=="function")t.apply(this,e);else return new Promise((r,n)=>{e.push((i,s)=>i!=null?n(i):r(s)),t.apply(this,e)})},"name",{value:t.name})};vr.fromPromise=function(t){return Object.defineProperty(function(...e){let r=e[e.length-1];if(typeof r!="function")return t.apply(this,e);e.pop(),t.apply(this,e).then(n=>r(null,n),r)},"name",{value:t.name})}});var Gn=y((RE,Hn)=>{var Be=require("constants"),sl=process.cwd,_t=null,ol=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return _t||(_t=sl.call(process)),_t};try{process.cwd()}catch{}typeof process.chdir=="function"&&(Cr=process.chdir,process.chdir=function(t){_t=null,Cr.call(process,t)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,Cr));var Cr;Hn.exports=al;function al(t){Be.hasOwnProperty("O_SYMLINK")&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)&&e(t),t.lutimes||r(t),t.chown=s(t.chown),t.fchown=s(t.fchown),t.lchown=s(t.lchown),t.chmod=n(t.chmod),t.fchmod=n(t.fchmod),t.lchmod=n(t.lchmod),t.chownSync=o(t.chownSync),t.fchownSync=o(t.fchownSync),t.lchownSync=o(t.lchownSync),t.chmodSync=i(t.chmodSync),t.fchmodSync=i(t.fchmodSync),t.lchmodSync=i(t.lchmodSync),t.stat=a(t.stat),t.fstat=a(t.fstat),t.lstat=a(t.lstat),t.statSync=c(t.statSync),t.fstatSync=c(t.fstatSync),t.lstatSync=c(t.lstatSync),t.chmod&&!t.lchmod&&(t.lchmod=function(l,f,m){m&&process.nextTick(m)},t.lchmodSync=function(){}),t.chown&&!t.lchown&&(t.lchown=function(l,f,m,d){d&&process.nextTick(d)},t.lchownSync=function(){}),ol==="win32"&&(t.rename=typeof t.rename!="function"?t.rename:function(l){function f(m,d,h){var E=Date.now(),w=0;l(m,d,function p(S){if(S&&(S.code==="EACCES"||S.code==="EPERM"||S.code==="EBUSY")&&Date.now()-E<6e4){setTimeout(function(){t.stat(d,function(A,V){A&&A.code==="ENOENT"?l(m,d,p):h(S)})},w),w<100&&(w+=10);return}h&&h(S)})}return Object.setPrototypeOf&&Object.setPrototypeOf(f,l),f}(t.rename)),t.read=typeof t.read!="function"?t.read:function(l){function f(m,d,h,E,w,p){var S;if(p&&typeof p=="function"){var A=0;S=function(V,Ce,ee){if(V&&V.code==="EAGAIN"&&A<10)return A++,l.call(t,m,d,h,E,w,S);p.apply(this,arguments)}}return l.call(t,m,d,h,E,w,S)}return Object.setPrototypeOf&&Object.setPrototypeOf(f,l),f}(t.read),t.readSync=typeof t.readSync!="function"?t.readSync:function(l){return function(f,m,d,h,E){for(var w=0;;)try{return l.call(t,f,m,d,h,E)}catch(p){if(p.code==="EAGAIN"&&w<10){w++;continue}throw p}}}(t.readSync);function e(l){l.lchmod=function(f,m,d){l.open(f,Be.O_WRONLY|Be.O_SYMLINK,m,function(h,E){if(h){d&&d(h);return}l.fchmod(E,m,function(w){l.close(E,function(p){d&&d(w||p)})})})},l.lchmodSync=function(f,m){var d=l.openSync(f,Be.O_WRONLY|Be.O_SYMLINK,m),h=!0,E;try{E=l.fchmodSync(d,m),h=!1}finally{if(h)try{l.closeSync(d)}catch{}else l.closeSync(d)}return E}}function r(l){Be.hasOwnProperty("O_SYMLINK")&&l.futimes?(l.lutimes=function(f,m,d,h){l.open(f,Be.O_SYMLINK,function(E,w){if(E){h&&h(E);return}l.futimes(w,m,d,function(p){l.close(w,function(S){h&&h(p||S)})})})},l.lutimesSync=function(f,m,d){var h=l.openSync(f,Be.O_SYMLINK),E,w=!0;try{E=l.futimesSync(h,m,d),w=!1}finally{if(w)try{l.closeSync(h)}catch{}else l.closeSync(h)}return E}):l.futimes&&(l.lutimes=function(f,m,d,h){h&&process.nextTick(h)},l.lutimesSync=function(){})}function n(l){return l&&function(f,m,d){return l.call(t,f,m,function(h){u(h)&&(h=null),d&&d.apply(this,arguments)})}}function i(l){return l&&function(f,m){try{return l.call(t,f,m)}catch(d){if(!u(d))throw d}}}function s(l){return l&&function(f,m,d,h){return l.call(t,f,m,d,function(E){u(E)&&(E=null),h&&h.apply(this,arguments)})}}function o(l){return l&&function(f,m,d){try{return l.call(t,f,m,d)}catch(h){if(!u(h))throw h}}}function a(l){return l&&function(f,m,d){typeof m=="function"&&(d=m,m=null);function h(E,w){w&&(w.uid<0&&(w.uid+=4294967296),w.gid<0&&(w.gid+=4294967296)),d&&d.apply(this,arguments)}return m?l.call(t,f,m,h):l.call(t,f,h)}}function c(l){return l&&function(f,m){var d=m?l.call(t,f,m):l.call(t,f);return d&&(d.uid<0&&(d.uid+=4294967296),d.gid<0&&(d.gid+=4294967296)),d}}function u(l){if(!l||l.code==="ENOSYS")return!0;var f=!process.getuid||process.getuid()!==0;return!!(f&&(l.code==="EINVAL"||l.code==="EPERM"))}}});var jn=y((bE,Wn)=>{var Vn=require("stream").Stream;Wn.exports=cl;function cl(t){return{ReadStream:e,WriteStream:r};function e(n,i){if(!(this instanceof e))return new e(n,i);Vn.call(this);var s=this;this.path=n,this.fd=null,this.readable=!0,this.paused=!1,this.flags="r",this.mode=438,this.bufferSize=64*1024,i=i||{};for(var o=Object.keys(i),a=0,c=o.length;a<c;a++){var u=o[a];this[u]=i[u]}if(this.encoding&&this.setEncoding(this.encoding),this.start!==void 0){if(typeof this.start!="number")throw TypeError("start must be a Number");if(this.end===void 0)this.end=1/0;else if(typeof this.end!="number")throw TypeError("end must be a Number");if(this.start>this.end)throw new Error("start must be <= end");this.pos=this.start}if(this.fd!==null){process.nextTick(function(){s._read()});return}t.open(this.path,this.flags,this.mode,function(l,f){if(l){s.emit("error",l),s.readable=!1;return}s.fd=f,s.emit("open",f),s._read()})}function r(n,i){if(!(this instanceof r))return new r(n,i);Vn.call(this),this.path=n,this.fd=null,this.writable=!0,this.flags="w",this.encoding="binary",this.mode=438,this.bytesWritten=0,i=i||{};for(var s=Object.keys(i),o=0,a=s.length;o<a;o++){var c=s[o];this[c]=i[c]}if(this.start!==void 0){if(typeof this.start!="number")throw TypeError("start must be a Number");if(this.start<0)throw new Error("start must be >= zero");this.pos=this.start}this.busy=!1,this._queue=[],this.fd===null&&(this._open=t.open,this._queue.push([this._open,this.path,this.flags,this.mode,void 0]),this.flush())}}});var zn=y((TE,Xn)=>{"use strict";Xn.exports=ll;var ul=Object.getPrototypeOf||function(t){return t.__proto__};function ll(t){if(t===null||typeof t!="object")return t;if(t instanceof Object)var e={__proto__:ul(t)};else var e=Object.create(null);return Object.getOwnPropertyNames(t).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}});var Je=y((AE,Or)=>{var X=require("fs"),fl=Gn(),hl=jn(),dl=zn(),Pt=require("util"),se,Ut;typeof Symbol=="function"&&typeof Symbol.for=="function"?(se=Symbol.for("graceful-fs.queue"),Ut=Symbol.for("graceful-fs.previous")):(se="___graceful-fs.queue",Ut="___graceful-fs.previous");function ml(){}function Kn(t,e){Object.defineProperty(t,se,{get:function(){return e}})}var We=ml;Pt.debuglog?We=Pt.debuglog("gfs4"):/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&(We=function(){var t=Pt.format.apply(Pt,arguments);t="GFS4: "+t.split(/\n/).join(`
2
- GFS4: `),console.error(t)});X[se]||(Zn=global[se]||[],Kn(X,Zn),X.close=function(t){function e(r,n){return t.call(X,r,function(i){i||Yn(),typeof n=="function"&&n.apply(this,arguments)})}return Object.defineProperty(e,Ut,{value:t}),e}(X.close),X.closeSync=function(t){function e(r){t.apply(X,arguments),Yn()}return Object.defineProperty(e,Ut,{value:t}),e}(X.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",function(){We(X[se]),require("assert").equal(X[se].length,0)}));var Zn;global[se]||Kn(global,X[se]);Or.exports=Ir(dl(X));process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!X.__patched&&(Or.exports=Ir(X),X.__patched=!0);function Ir(t){fl(t),t.gracefulify=Ir,t.createReadStream=Ce,t.createWriteStream=ee;var e=t.readFile;t.readFile=r;function r(O,b,D){return typeof b=="function"&&(D=b,b=null),B(O,b,D);function B(G,W,_,I){return e(G,W,function(N){N&&(N.code==="EMFILE"||N.code==="ENFILE")?Ke([B,[G,W,_],N,I||Date.now(),Date.now()]):typeof _=="function"&&_.apply(this,arguments)})}}var n=t.writeFile;t.writeFile=i;function i(O,b,D,B){return typeof D=="function"&&(B=D,D=null),G(O,b,D,B);function G(W,_,I,N,L){return n(W,_,I,function(g){g&&(g.code==="EMFILE"||g.code==="ENFILE")?Ke([G,[W,_,I,N],g,L||Date.now(),Date.now()]):typeof N=="function"&&N.apply(this,arguments)})}}var s=t.appendFile;s&&(t.appendFile=o);function o(O,b,D,B){return typeof D=="function"&&(B=D,D=null),G(O,b,D,B);function G(W,_,I,N,L){return s(W,_,I,function(g){g&&(g.code==="EMFILE"||g.code==="ENFILE")?Ke([G,[W,_,I,N],g,L||Date.now(),Date.now()]):typeof N=="function"&&N.apply(this,arguments)})}}var a=t.copyFile;a&&(t.copyFile=c);function c(O,b,D,B){return typeof D=="function"&&(B=D,D=0),G(O,b,D,B);function G(W,_,I,N,L){return a(W,_,I,function(g){g&&(g.code==="EMFILE"||g.code==="ENFILE")?Ke([G,[W,_,I,N],g,L||Date.now(),Date.now()]):typeof N=="function"&&N.apply(this,arguments)})}}var u=t.readdir;t.readdir=f;var l=/^v[0-5]\./;function f(O,b,D){typeof b=="function"&&(D=b,b=null);var B=l.test(process.version)?function(_,I,N,L){return u(_,G(_,I,N,L))}:function(_,I,N,L){return u(_,I,G(_,I,N,L))};return B(O,b,D);function G(W,_,I,N){return function(L,g){L&&(L.code==="EMFILE"||L.code==="ENFILE")?Ke([B,[W,_,I],L,N||Date.now(),Date.now()]):(g&&g.sort&&g.sort(),typeof I=="function"&&I.call(this,L,g))}}}if(process.version.substr(0,4)==="v0.8"){var m=hl(t);p=m.ReadStream,A=m.WriteStream}var d=t.ReadStream;d&&(p.prototype=Object.create(d.prototype),p.prototype.open=S);var h=t.WriteStream;h&&(A.prototype=Object.create(h.prototype),A.prototype.open=V),Object.defineProperty(t,"ReadStream",{get:function(){return p},set:function(O){p=O},enumerable:!0,configurable:!0}),Object.defineProperty(t,"WriteStream",{get:function(){return A},set:function(O){A=O},enumerable:!0,configurable:!0});var E=p;Object.defineProperty(t,"FileReadStream",{get:function(){return E},set:function(O){E=O},enumerable:!0,configurable:!0});var w=A;Object.defineProperty(t,"FileWriteStream",{get:function(){return w},set:function(O){w=O},enumerable:!0,configurable:!0});function p(O,b){return this instanceof p?(d.apply(this,arguments),this):p.apply(Object.create(p.prototype),arguments)}function S(){var O=this;Ie(O.path,O.flags,O.mode,function(b,D){b?(O.autoClose&&O.destroy(),O.emit("error",b)):(O.fd=D,O.emit("open",D),O.read())})}function A(O,b){return this instanceof A?(h.apply(this,arguments),this):A.apply(Object.create(A.prototype),arguments)}function V(){var O=this;Ie(O.path,O.flags,O.mode,function(b,D){b?(O.destroy(),O.emit("error",b)):(O.fd=D,O.emit("open",D))})}function Ce(O,b){return new t.ReadStream(O,b)}function ee(O,b){return new t.WriteStream(O,b)}var fe=t.open;t.open=Ie;function Ie(O,b,D,B){return typeof D=="function"&&(B=D,D=null),G(O,b,D,B);function G(W,_,I,N,L){return fe(W,_,I,function(g,q){g&&(g.code==="EMFILE"||g.code==="ENFILE")?Ke([G,[W,_,I,N],g,L||Date.now(),Date.now()]):typeof N=="function"&&N.apply(this,arguments)})}}return t}function Ke(t){We("ENQUEUE",t[0].name,t[1]),X[se].push(t),Nr()}var kt;function Yn(){for(var t=Date.now(),e=0;e<X[se].length;++e)X[se][e].length>2&&(X[se][e][3]=t,X[se][e][4]=t);Nr()}function Nr(){if(clearTimeout(kt),kt=void 0,X[se].length!==0){var t=X[se].shift(),e=t[0],r=t[1],n=t[2],i=t[3],s=t[4];if(i===void 0)We("RETRY",e.name,r),e.apply(null,r);else if(Date.now()-i>=6e4){We("TIMEOUT",e.name,r);var o=r.pop();typeof o=="function"&&o.call(null,n)}else{var a=Date.now()-s,c=Math.max(s-i,1),u=Math.min(c*1.2,100);a>=u?(We("RETRY",e.name,r),e.apply(null,r.concat([i]))):X[se].push(t)}kt===void 0&&(kt=setTimeout(Nr,0))}}});var de=y(_e=>{"use strict";var Jn=te().fromCallback,he=Je(),pl=["access","appendFile","chmod","chown","close","copyFile","fchmod","fchown","fdatasync","fstat","fsync","ftruncate","futimes","lchmod","lchown","link","lstat","mkdir","mkdtemp","open","opendir","readdir","readFile","readlink","realpath","rename","rm","rmdir","stat","symlink","truncate","unlink","utimes","writeFile"].filter(t=>typeof he[t]=="function");Object.assign(_e,he);pl.forEach(t=>{_e[t]=Jn(he[t])});_e.exists=function(t,e){return typeof e=="function"?he.exists(t,e):new Promise(r=>he.exists(t,r))};_e.read=function(t,e,r,n,i,s){return typeof s=="function"?he.read(t,e,r,n,i,s):new Promise((o,a)=>{he.read(t,e,r,n,i,(c,u,l)=>{if(c)return a(c);o({bytesRead:u,buffer:l})})})};_e.write=function(t,e,...r){return typeof r[r.length-1]=="function"?he.write(t,e,...r):new Promise((n,i)=>{he.write(t,e,...r,(s,o,a)=>{if(s)return i(s);n({bytesWritten:o,buffer:a})})})};_e.readv=function(t,e,...r){return typeof r[r.length-1]=="function"?he.readv(t,e,...r):new Promise((n,i)=>{he.readv(t,e,...r,(s,o,a)=>{if(s)return i(s);n({bytesRead:o,buffers:a})})})};_e.writev=function(t,e,...r){return typeof r[r.length-1]=="function"?he.writev(t,e,...r):new Promise((n,i)=>{he.writev(t,e,...r,(s,o,a)=>{if(s)return i(s);n({bytesWritten:o,buffers:a})})})};typeof he.realpath.native=="function"?_e.realpath.native=Jn(he.realpath.native):process.emitWarning("fs.realpath.native is not a function. Is fs being monkey-patched?","Warning","fs-extra-WARN0003")});var ei=y((FE,Qn)=>{"use strict";var El=require("path");Qn.exports.checkPath=function(e){if(process.platform==="win32"&&/[<>:"|?*]/.test(e.replace(El.parse(e).root,""))){let n=new Error(`Path contains invalid characters: ${e}`);throw n.code="EINVAL",n}}});var ii=y((qE,Lr)=>{"use strict";var ti=de(),{checkPath:ri}=ei(),ni=t=>{let e={mode:511};return typeof t=="number"?t:{...e,...t}.mode};Lr.exports.makeDir=async(t,e)=>(ri(t),ti.mkdir(t,{mode:ni(e),recursive:!0}));Lr.exports.makeDirSync=(t,e)=>(ri(t),ti.mkdirSync(t,{mode:ni(e),recursive:!0}))});var De=y((_E,si)=>{"use strict";var yl=te().fromPromise,{makeDir:gl,makeDirSync:Dr}=ii(),Rr=yl(gl);si.exports={mkdirs:Rr,mkdirsSync:Dr,mkdirp:Rr,mkdirpSync:Dr,ensureDir:Rr,ensureDirSync:Dr}});var Me=y((PE,ai)=>{"use strict";var wl=te().fromPromise,oi=de();function Sl(t){return oi.access(t).then(()=>!0).catch(()=>!1)}ai.exports={pathExists:wl(Sl),pathExistsSync:oi.existsSync}});var br=y((kE,ci)=>{"use strict";var Qe=de(),xl=te().fromPromise;async function vl(t,e,r){let n=await Qe.open(t,"r+"),i=null;try{await Qe.futimes(n,e,r)}finally{try{await Qe.close(n)}catch(s){i=s}}if(i)throw i}function Cl(t,e,r){let n=Qe.openSync(t,"r+");return Qe.futimesSync(n,e,r),Qe.closeSync(n)}ci.exports={utimesMillis:xl(vl),utimesMillisSync:Cl}});var je=y((UE,hi)=>{"use strict";var et=de(),re=require("path"),ui=te().fromPromise;function Il(t,e,r){let n=r.dereference?i=>et.stat(i,{bigint:!0}):i=>et.lstat(i,{bigint:!0});return Promise.all([n(t),n(e).catch(i=>{if(i.code==="ENOENT")return null;throw i})]).then(([i,s])=>({srcStat:i,destStat:s}))}function Nl(t,e,r){let n,i=r.dereference?o=>et.statSync(o,{bigint:!0}):o=>et.lstatSync(o,{bigint:!0}),s=i(t);try{n=i(e)}catch(o){if(o.code==="ENOENT")return{srcStat:s,destStat:null};throw o}return{srcStat:s,destStat:n}}async function Ol(t,e,r,n){let{srcStat:i,destStat:s}=await Il(t,e,n);if(s){if(ht(i,s)){let o=re.basename(t),a=re.basename(e);if(r==="move"&&o!==a&&o.toLowerCase()===a.toLowerCase())return{srcStat:i,destStat:s,isChangingCase:!0};throw new Error("Source and destination must not be the same.")}if(i.isDirectory()&&!s.isDirectory())throw new Error(`Cannot overwrite non-directory '${e}' with directory '${t}'.`);if(!i.isDirectory()&&s.isDirectory())throw new Error(`Cannot overwrite directory '${e}' with non-directory '${t}'.`)}if(i.isDirectory()&&Tr(t,e))throw new Error(Bt(t,e,r));return{srcStat:i,destStat:s}}function Ll(t,e,r,n){let{srcStat:i,destStat:s}=Nl(t,e,n);if(s){if(ht(i,s)){let o=re.basename(t),a=re.basename(e);if(r==="move"&&o!==a&&o.toLowerCase()===a.toLowerCase())return{srcStat:i,destStat:s,isChangingCase:!0};throw new Error("Source and destination must not be the same.")}if(i.isDirectory()&&!s.isDirectory())throw new Error(`Cannot overwrite non-directory '${e}' with directory '${t}'.`);if(!i.isDirectory()&&s.isDirectory())throw new Error(`Cannot overwrite directory '${e}' with non-directory '${t}'.`)}if(i.isDirectory()&&Tr(t,e))throw new Error(Bt(t,e,r));return{srcStat:i,destStat:s}}async function li(t,e,r,n){let i=re.resolve(re.dirname(t)),s=re.resolve(re.dirname(r));if(s===i||s===re.parse(s).root)return;let o;try{o=await et.stat(s,{bigint:!0})}catch(a){if(a.code==="ENOENT")return;throw a}if(ht(e,o))throw new Error(Bt(t,r,n));return li(t,e,s,n)}function fi(t,e,r,n){let i=re.resolve(re.dirname(t)),s=re.resolve(re.dirname(r));if(s===i||s===re.parse(s).root)return;let o;try{o=et.statSync(s,{bigint:!0})}catch(a){if(a.code==="ENOENT")return;throw a}if(ht(e,o))throw new Error(Bt(t,r,n));return fi(t,e,s,n)}function ht(t,e){return e.ino&&e.dev&&e.ino===t.ino&&e.dev===t.dev}function Tr(t,e){let r=re.resolve(t).split(re.sep).filter(i=>i),n=re.resolve(e).split(re.sep).filter(i=>i);return r.every((i,s)=>n[s]===i)}function Bt(t,e,r){return`Cannot ${r} '${t}' to a subdirectory of itself, '${e}'.`}hi.exports={checkPaths:ui(Ol),checkPathsSync:Ll,checkParentPaths:ui(li),checkParentPathsSync:fi,isSrcSubdir:Tr,areIdentical:ht}});var yi=y((BE,Ei)=>{"use strict";var ae=de(),dt=require("path"),{mkdirs:Dl}=De(),{pathExists:Rl}=Me(),{utimesMillis:bl}=br(),mt=je();async function Tl(t,e,r={}){typeof r=="function"&&(r={filter:r}),r.clobber="clobber"in r?!!r.clobber:!0,r.overwrite="overwrite"in r?!!r.overwrite:r.clobber,r.preserveTimestamps&&process.arch==="ia32"&&process.emitWarning(`Using the preserveTimestamps option in 32-bit node is not recommended;
3
-
4
- see https://github.com/jprichardson/node-fs-extra/issues/269`,"Warning","fs-extra-WARN0001");let{srcStat:n,destStat:i}=await mt.checkPaths(t,e,"copy",r);if(await mt.checkParentPaths(t,n,e,"copy"),!await mi(t,e,r))return;let o=dt.dirname(e);await Rl(o)||await Dl(o),await pi(i,t,e,r)}async function mi(t,e,r){return r.filter?r.filter(t,e):!0}async function pi(t,e,r,n){let s=await(n.dereference?ae.stat:ae.lstat)(e);if(s.isDirectory())return ql(s,t,e,r,n);if(s.isFile()||s.isCharacterDevice()||s.isBlockDevice())return Al(s,t,e,r,n);if(s.isSymbolicLink())return _l(t,e,r,n);throw s.isSocket()?new Error(`Cannot copy a socket file: ${e}`):s.isFIFO()?new Error(`Cannot copy a FIFO pipe: ${e}`):new Error(`Unknown file: ${e}`)}async function Al(t,e,r,n,i){if(!e)return di(t,r,n,i);if(i.overwrite)return await ae.unlink(n),di(t,r,n,i);if(i.errorOnExist)throw new Error(`'${n}' already exists`)}async function di(t,e,r,n){if(await ae.copyFile(e,r),n.preserveTimestamps){$l(t.mode)&&await Fl(r,t.mode);let i=await ae.stat(e);await bl(r,i.atime,i.mtime)}return ae.chmod(r,t.mode)}function $l(t){return(t&128)===0}function Fl(t,e){return ae.chmod(t,e|128)}async function ql(t,e,r,n,i){e||await ae.mkdir(n);let s=await ae.readdir(r);await Promise.all(s.map(async o=>{let a=dt.join(r,o),c=dt.join(n,o);if(!await mi(a,c,i))return;let{destStat:l}=await mt.checkPaths(a,c,"copy",i);return pi(l,a,c,i)})),e||await ae.chmod(n,t.mode)}async function _l(t,e,r,n){let i=await ae.readlink(e);if(n.dereference&&(i=dt.resolve(process.cwd(),i)),!t)return ae.symlink(i,r);let s=null;try{s=await ae.readlink(r)}catch(o){if(o.code==="EINVAL"||o.code==="UNKNOWN")return ae.symlink(i,r);throw o}if(n.dereference&&(s=dt.resolve(process.cwd(),s)),mt.isSrcSubdir(i,s))throw new Error(`Cannot copy '${i}' to a subdirectory of itself, '${s}'.`);if(mt.isSrcSubdir(s,i))throw new Error(`Cannot overwrite '${s}' with '${i}'.`);return await ae.unlink(r),ae.symlink(i,r)}Ei.exports=Tl});var vi=y((ME,xi)=>{"use strict";var me=Je(),pt=require("path"),Pl=De().mkdirsSync,kl=br().utimesMillisSync,Et=je();function Ul(t,e,r){typeof r=="function"&&(r={filter:r}),r=r||{},r.clobber="clobber"in r?!!r.clobber:!0,r.overwrite="overwrite"in r?!!r.overwrite:r.clobber,r.preserveTimestamps&&process.arch==="ia32"&&process.emitWarning(`Using the preserveTimestamps option in 32-bit node is not recommended;
5
-
6
- see https://github.com/jprichardson/node-fs-extra/issues/269`,"Warning","fs-extra-WARN0002");let{srcStat:n,destStat:i}=Et.checkPathsSync(t,e,"copy",r);if(Et.checkParentPathsSync(t,n,e,"copy"),r.filter&&!r.filter(t,e))return;let s=pt.dirname(e);return me.existsSync(s)||Pl(s),gi(i,t,e,r)}function gi(t,e,r,n){let s=(n.dereference?me.statSync:me.lstatSync)(e);if(s.isDirectory())return jl(s,t,e,r,n);if(s.isFile()||s.isCharacterDevice()||s.isBlockDevice())return Bl(s,t,e,r,n);if(s.isSymbolicLink())return Zl(t,e,r,n);throw s.isSocket()?new Error(`Cannot copy a socket file: ${e}`):s.isFIFO()?new Error(`Cannot copy a FIFO pipe: ${e}`):new Error(`Unknown file: ${e}`)}function Bl(t,e,r,n,i){return e?Ml(t,r,n,i):wi(t,r,n,i)}function Ml(t,e,r,n){if(n.overwrite)return me.unlinkSync(r),wi(t,e,r,n);if(n.errorOnExist)throw new Error(`'${r}' already exists`)}function wi(t,e,r,n){return me.copyFileSync(e,r),n.preserveTimestamps&&Hl(t.mode,e,r),Ar(r,t.mode)}function Hl(t,e,r){return Gl(t)&&Vl(r,t),Wl(e,r)}function Gl(t){return(t&128)===0}function Vl(t,e){return Ar(t,e|128)}function Ar(t,e){return me.chmodSync(t,e)}function Wl(t,e){let r=me.statSync(t);return kl(e,r.atime,r.mtime)}function jl(t,e,r,n,i){return e?Si(r,n,i):Xl(t.mode,r,n,i)}function Xl(t,e,r,n){return me.mkdirSync(r),Si(e,r,n),Ar(r,t)}function Si(t,e,r){me.readdirSync(t).forEach(n=>zl(n,t,e,r))}function zl(t,e,r,n){let i=pt.join(e,t),s=pt.join(r,t);if(n.filter&&!n.filter(i,s))return;let{destStat:o}=Et.checkPathsSync(i,s,"copy",n);return gi(o,i,s,n)}function Zl(t,e,r,n){let i=me.readlinkSync(e);if(n.dereference&&(i=pt.resolve(process.cwd(),i)),t){let s;try{s=me.readlinkSync(r)}catch(o){if(o.code==="EINVAL"||o.code==="UNKNOWN")return me.symlinkSync(i,r);throw o}if(n.dereference&&(s=pt.resolve(process.cwd(),s)),Et.isSrcSubdir(i,s))throw new Error(`Cannot copy '${i}' to a subdirectory of itself, '${s}'.`);if(Et.isSrcSubdir(s,i))throw new Error(`Cannot overwrite '${s}' with '${i}'.`);return Yl(i,r)}else return me.symlinkSync(i,r)}function Yl(t,e){return me.unlinkSync(e),me.symlinkSync(t,e)}xi.exports=Ul});var Mt=y((HE,Ci)=>{"use strict";var Kl=te().fromPromise;Ci.exports={copy:Kl(yi()),copySync:vi()}});var yt=y((GE,Ni)=>{"use strict";var Ii=Je(),Jl=te().fromCallback;function Ql(t,e){Ii.rm(t,{recursive:!0,force:!0},e)}function ef(t){Ii.rmSync(t,{recursive:!0,force:!0})}Ni.exports={remove:Jl(Ql),removeSync:ef}});var $i=y((VE,Ai)=>{"use strict";var tf=te().fromPromise,Di=de(),Ri=require("path"),bi=De(),Ti=yt(),Oi=tf(async function(e){let r;try{r=await Di.readdir(e)}catch{return bi.mkdirs(e)}return Promise.all(r.map(n=>Ti.remove(Ri.join(e,n))))});function Li(t){let e;try{e=Di.readdirSync(t)}catch{return bi.mkdirsSync(t)}e.forEach(r=>{r=Ri.join(t,r),Ti.removeSync(r)})}Ai.exports={emptyDirSync:Li,emptydirSync:Li,emptyDir:Oi,emptydir:Oi}});var Pi=y((WE,_i)=>{"use strict";var rf=te().fromPromise,Fi=require("path"),Pe=de(),qi=De();async function nf(t){let e;try{e=await Pe.stat(t)}catch{}if(e&&e.isFile())return;let r=Fi.dirname(t),n=null;try{n=await Pe.stat(r)}catch(i){if(i.code==="ENOENT"){await qi.mkdirs(r),await Pe.writeFile(t,"");return}else throw i}n.isDirectory()?await Pe.writeFile(t,""):await Pe.readdir(r)}function sf(t){let e;try{e=Pe.statSync(t)}catch{}if(e&&e.isFile())return;let r=Fi.dirname(t);try{Pe.statSync(r).isDirectory()||Pe.readdirSync(r)}catch(n){if(n&&n.code==="ENOENT")qi.mkdirsSync(r);else throw n}Pe.writeFileSync(t,"")}_i.exports={createFile:rf(nf),createFileSync:sf}});var Hi=y((jE,Mi)=>{"use strict";var of=te().fromPromise,ki=require("path"),He=de(),Ui=De(),{pathExists:af}=Me(),{areIdentical:Bi}=je();async function cf(t,e){let r;try{r=await He.lstat(e)}catch{}let n;try{n=await He.lstat(t)}catch(o){throw o.message=o.message.replace("lstat","ensureLink"),o}if(r&&Bi(n,r))return;let i=ki.dirname(e);await af(i)||await Ui.mkdirs(i),await He.link(t,e)}function uf(t,e){let r;try{r=He.lstatSync(e)}catch{}try{let s=He.lstatSync(t);if(r&&Bi(s,r))return}catch(s){throw s.message=s.message.replace("lstat","ensureLink"),s}let n=ki.dirname(e);return He.existsSync(n)||Ui.mkdirsSync(n),He.linkSync(t,e)}Mi.exports={createLink:of(cf),createLinkSync:uf}});var Vi=y((XE,Gi)=>{"use strict";var Ge=require("path"),gt=de(),{pathExists:lf}=Me(),ff=te().fromPromise;async function hf(t,e){if(Ge.isAbsolute(t)){try{await gt.lstat(t)}catch(s){throw s.message=s.message.replace("lstat","ensureSymlink"),s}return{toCwd:t,toDst:t}}let r=Ge.dirname(e),n=Ge.join(r,t);if(await lf(n))return{toCwd:n,toDst:t};try{await gt.lstat(t)}catch(s){throw s.message=s.message.replace("lstat","ensureSymlink"),s}return{toCwd:t,toDst:Ge.relative(r,t)}}function df(t,e){if(Ge.isAbsolute(t)){if(!gt.existsSync(t))throw new Error("absolute srcpath does not exist");return{toCwd:t,toDst:t}}let r=Ge.dirname(e),n=Ge.join(r,t);if(gt.existsSync(n))return{toCwd:n,toDst:t};if(!gt.existsSync(t))throw new Error("relative srcpath does not exist");return{toCwd:t,toDst:Ge.relative(r,t)}}Gi.exports={symlinkPaths:ff(hf),symlinkPathsSync:df}});var Xi=y((zE,ji)=>{"use strict";var Wi=de(),mf=te().fromPromise;async function pf(t,e){if(e)return e;let r;try{r=await Wi.lstat(t)}catch{return"file"}return r&&r.isDirectory()?"dir":"file"}function Ef(t,e){if(e)return e;let r;try{r=Wi.lstatSync(t)}catch{return"file"}return r&&r.isDirectory()?"dir":"file"}ji.exports={symlinkType:mf(pf),symlinkTypeSync:Ef}});var Ki=y((ZE,Yi)=>{"use strict";var yf=te().fromPromise,zi=require("path"),$e=de(),{mkdirs:gf,mkdirsSync:wf}=De(),{symlinkPaths:Sf,symlinkPathsSync:xf}=Vi(),{symlinkType:vf,symlinkTypeSync:Cf}=Xi(),{pathExists:If}=Me(),{areIdentical:Zi}=je();async function Nf(t,e,r){let n;try{n=await $e.lstat(e)}catch{}if(n&&n.isSymbolicLink()){let[a,c]=await Promise.all([$e.stat(t),$e.stat(e)]);if(Zi(a,c))return}let i=await Sf(t,e);t=i.toDst;let s=await vf(i.toCwd,r),o=zi.dirname(e);return await If(o)||await gf(o),$e.symlink(t,e,s)}function Of(t,e,r){let n;try{n=$e.lstatSync(e)}catch{}if(n&&n.isSymbolicLink()){let a=$e.statSync(t),c=$e.statSync(e);if(Zi(a,c))return}let i=xf(t,e);t=i.toDst,r=Cf(i.toCwd,r);let s=zi.dirname(e);return $e.existsSync(s)||wf(s),$e.symlinkSync(t,e,r)}Yi.exports={createSymlink:yf(Nf),createSymlinkSync:Of}});var ss=y((YE,is)=>{"use strict";var{createFile:Ji,createFileSync:Qi}=Pi(),{createLink:es,createLinkSync:ts}=Hi(),{createSymlink:rs,createSymlinkSync:ns}=Ki();is.exports={createFile:Ji,createFileSync:Qi,ensureFile:Ji,ensureFileSync:Qi,createLink:es,createLinkSync:ts,ensureLink:es,ensureLinkSync:ts,createSymlink:rs,createSymlinkSync:ns,ensureSymlink:rs,ensureSymlinkSync:ns}});var Ht=y((KE,os)=>{function Lf(t,{EOL:e=`
7
- `,finalEOL:r=!0,replacer:n=null,spaces:i}={}){let s=r?e:"";return JSON.stringify(t,n,i).replace(/\n/g,e)+s}function Df(t){return Buffer.isBuffer(t)&&(t=t.toString("utf8")),t.replace(/^\uFEFF/,"")}os.exports={stringify:Lf,stripBom:Df}});var ls=y((JE,us)=>{var tt;try{tt=Je()}catch{tt=require("fs")}var Gt=te(),{stringify:as,stripBom:cs}=Ht();async function Rf(t,e={}){typeof e=="string"&&(e={encoding:e});let r=e.fs||tt,n="throws"in e?e.throws:!0,i=await Gt.fromCallback(r.readFile)(t,e);i=cs(i);let s;try{s=JSON.parse(i,e?e.reviver:null)}catch(o){if(n)throw o.message=`${t}: ${o.message}`,o;return null}return s}var bf=Gt.fromPromise(Rf);function Tf(t,e={}){typeof e=="string"&&(e={encoding:e});let r=e.fs||tt,n="throws"in e?e.throws:!0;try{let i=r.readFileSync(t,e);return i=cs(i),JSON.parse(i,e.reviver)}catch(i){if(n)throw i.message=`${t}: ${i.message}`,i;return null}}async function Af(t,e,r={}){let n=r.fs||tt,i=as(e,r);await Gt.fromCallback(n.writeFile)(t,i,r)}var $f=Gt.fromPromise(Af);function Ff(t,e,r={}){let n=r.fs||tt,i=as(e,r);return n.writeFileSync(t,i,r)}var qf={readFile:bf,readFileSync:Tf,writeFile:$f,writeFileSync:Ff};us.exports=qf});var hs=y((QE,fs)=>{"use strict";var Vt=ls();fs.exports={readJson:Vt.readFile,readJsonSync:Vt.readFileSync,writeJson:Vt.writeFile,writeJsonSync:Vt.writeFileSync}});var Wt=y((ey,ps)=>{"use strict";var _f=te().fromPromise,$r=de(),ds=require("path"),ms=De(),Pf=Me().pathExists;async function kf(t,e,r="utf-8"){let n=ds.dirname(t);return await Pf(n)||await ms.mkdirs(n),$r.writeFile(t,e,r)}function Uf(t,...e){let r=ds.dirname(t);$r.existsSync(r)||ms.mkdirsSync(r),$r.writeFileSync(t,...e)}ps.exports={outputFile:_f(kf),outputFileSync:Uf}});var ys=y((ty,Es)=>{"use strict";var{stringify:Bf}=Ht(),{outputFile:Mf}=Wt();async function Hf(t,e,r={}){let n=Bf(e,r);await Mf(t,n,r)}Es.exports=Hf});var ws=y((ry,gs)=>{"use strict";var{stringify:Gf}=Ht(),{outputFileSync:Vf}=Wt();function Wf(t,e,r){let n=Gf(e,r);Vf(t,n,r)}gs.exports=Wf});var xs=y((ny,Ss)=>{"use strict";var jf=te().fromPromise,pe=hs();pe.outputJson=jf(ys());pe.outputJsonSync=ws();pe.outputJSON=pe.outputJson;pe.outputJSONSync=pe.outputJsonSync;pe.writeJSON=pe.writeJson;pe.writeJSONSync=pe.writeJsonSync;pe.readJSON=pe.readJson;pe.readJSONSync=pe.readJsonSync;Ss.exports=pe});var Os=y((iy,Ns)=>{"use strict";var Xf=de(),vs=require("path"),{copy:zf}=Mt(),{remove:Is}=yt(),{mkdirp:Zf}=De(),{pathExists:Yf}=Me(),Cs=je();async function Kf(t,e,r={}){let n=r.overwrite||r.clobber||!1,{srcStat:i,isChangingCase:s=!1}=await Cs.checkPaths(t,e,"move",r);await Cs.checkParentPaths(t,i,e,"move");let o=vs.dirname(e);return vs.parse(o).root!==o&&await Zf(o),Jf(t,e,n,s)}async function Jf(t,e,r,n){if(!n){if(r)await Is(e);else if(await Yf(e))throw new Error("dest already exists.")}try{await Xf.rename(t,e)}catch(i){if(i.code!=="EXDEV")throw i;await Qf(t,e,r)}}async function Qf(t,e,r){return await zf(t,e,{overwrite:r,errorOnExist:!0,preserveTimestamps:!0}),Is(t)}Ns.exports=Kf});var Ts=y((sy,bs)=>{"use strict";var Ds=Je(),qr=require("path"),eh=Mt().copySync,Rs=yt().removeSync,th=De().mkdirpSync,Ls=je();function rh(t,e,r){r=r||{};let n=r.overwrite||r.clobber||!1,{srcStat:i,isChangingCase:s=!1}=Ls.checkPathsSync(t,e,"move",r);return Ls.checkParentPathsSync(t,i,e,"move"),nh(e)||th(qr.dirname(e)),ih(t,e,n,s)}function nh(t){let e=qr.dirname(t);return qr.parse(e).root===e}function ih(t,e,r,n){if(n)return Fr(t,e,r);if(r)return Rs(e),Fr(t,e,r);if(Ds.existsSync(e))throw new Error("dest already exists.");return Fr(t,e,r)}function Fr(t,e,r){try{Ds.renameSync(t,e)}catch(n){if(n.code!=="EXDEV")throw n;return sh(t,e,r)}}function sh(t,e,r){return eh(t,e,{overwrite:r,errorOnExist:!0,preserveTimestamps:!0}),Rs(t)}bs.exports=rh});var $s=y((oy,As)=>{"use strict";var oh=te().fromPromise;As.exports={move:oh(Os()),moveSync:Ts()}});var qs=y((ay,Fs)=>{"use strict";Fs.exports={...de(),...Mt(),...$i(),...ss(),...xs(),...De(),...$s(),...Wt(),...Me(),...yt()}});var St=y((uy,Hs)=>{"use strict";var yh="2.0.0",gh=Number.MAX_SAFE_INTEGER||9007199254740991,wh=16,Sh=250,xh=["major","premajor","minor","preminor","patch","prepatch","prerelease"];Hs.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:wh,MAX_SAFE_BUILD_LENGTH:Sh,MAX_SAFE_INTEGER:gh,RELEASE_TYPES:xh,SEMVER_SPEC_VERSION:yh,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var xt=y((ly,Gs)=>{"use strict";var vh=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...t)=>console.error("SEMVER",...t):()=>{};Gs.exports=vh});var rt=y((Fe,Vs)=>{"use strict";var{MAX_SAFE_COMPONENT_LENGTH:Ur,MAX_SAFE_BUILD_LENGTH:Ch,MAX_LENGTH:Ih}=St(),Nh=xt();Fe=Vs.exports={};var Oh=Fe.re=[],Lh=Fe.safeRe=[],x=Fe.src=[],Dh=Fe.safeSrc=[],v=Fe.t={},Rh=0,Br="[a-zA-Z0-9-]",bh=[["\\s",1],["\\d",Ih],[Br,Ch]],Th=t=>{for(let[e,r]of bh)t=t.split(`${e}*`).join(`${e}{0,${r}}`).split(`${e}+`).join(`${e}{1,${r}}`);return t},R=(t,e,r)=>{let n=Th(e),i=Rh++;Nh(t,i,e),v[t]=i,x[i]=e,Dh[i]=n,Oh[i]=new RegExp(e,r?"g":void 0),Lh[i]=new RegExp(n,r?"g":void 0)};R("NUMERICIDENTIFIER","0|[1-9]\\d*");R("NUMERICIDENTIFIERLOOSE","\\d+");R("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${Br}*`);R("MAINVERSION",`(${x[v.NUMERICIDENTIFIER]})\\.(${x[v.NUMERICIDENTIFIER]})\\.(${x[v.NUMERICIDENTIFIER]})`);R("MAINVERSIONLOOSE",`(${x[v.NUMERICIDENTIFIERLOOSE]})\\.(${x[v.NUMERICIDENTIFIERLOOSE]})\\.(${x[v.NUMERICIDENTIFIERLOOSE]})`);R("PRERELEASEIDENTIFIER",`(?:${x[v.NONNUMERICIDENTIFIER]}|${x[v.NUMERICIDENTIFIER]})`);R("PRERELEASEIDENTIFIERLOOSE",`(?:${x[v.NONNUMERICIDENTIFIER]}|${x[v.NUMERICIDENTIFIERLOOSE]})`);R("PRERELEASE",`(?:-(${x[v.PRERELEASEIDENTIFIER]}(?:\\.${x[v.PRERELEASEIDENTIFIER]})*))`);R("PRERELEASELOOSE",`(?:-?(${x[v.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${x[v.PRERELEASEIDENTIFIERLOOSE]})*))`);R("BUILDIDENTIFIER",`${Br}+`);R("BUILD",`(?:\\+(${x[v.BUILDIDENTIFIER]}(?:\\.${x[v.BUILDIDENTIFIER]})*))`);R("FULLPLAIN",`v?${x[v.MAINVERSION]}${x[v.PRERELEASE]}?${x[v.BUILD]}?`);R("FULL",`^${x[v.FULLPLAIN]}$`);R("LOOSEPLAIN",`[v=\\s]*${x[v.MAINVERSIONLOOSE]}${x[v.PRERELEASELOOSE]}?${x[v.BUILD]}?`);R("LOOSE",`^${x[v.LOOSEPLAIN]}$`);R("GTLT","((?:<|>)?=?)");R("XRANGEIDENTIFIERLOOSE",`${x[v.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);R("XRANGEIDENTIFIER",`${x[v.NUMERICIDENTIFIER]}|x|X|\\*`);R("XRANGEPLAIN",`[v=\\s]*(${x[v.XRANGEIDENTIFIER]})(?:\\.(${x[v.XRANGEIDENTIFIER]})(?:\\.(${x[v.XRANGEIDENTIFIER]})(?:${x[v.PRERELEASE]})?${x[v.BUILD]}?)?)?`);R("XRANGEPLAINLOOSE",`[v=\\s]*(${x[v.XRANGEIDENTIFIERLOOSE]})(?:\\.(${x[v.XRANGEIDENTIFIERLOOSE]})(?:\\.(${x[v.XRANGEIDENTIFIERLOOSE]})(?:${x[v.PRERELEASELOOSE]})?${x[v.BUILD]}?)?)?`);R("XRANGE",`^${x[v.GTLT]}\\s*${x[v.XRANGEPLAIN]}$`);R("XRANGELOOSE",`^${x[v.GTLT]}\\s*${x[v.XRANGEPLAINLOOSE]}$`);R("COERCEPLAIN",`(^|[^\\d])(\\d{1,${Ur}})(?:\\.(\\d{1,${Ur}}))?(?:\\.(\\d{1,${Ur}}))?`);R("COERCE",`${x[v.COERCEPLAIN]}(?:$|[^\\d])`);R("COERCEFULL",x[v.COERCEPLAIN]+`(?:${x[v.PRERELEASE]})?(?:${x[v.BUILD]})?(?:$|[^\\d])`);R("COERCERTL",x[v.COERCE],!0);R("COERCERTLFULL",x[v.COERCEFULL],!0);R("LONETILDE","(?:~>?)");R("TILDETRIM",`(\\s*)${x[v.LONETILDE]}\\s+`,!0);Fe.tildeTrimReplace="$1~";R("TILDE",`^${x[v.LONETILDE]}${x[v.XRANGEPLAIN]}$`);R("TILDELOOSE",`^${x[v.LONETILDE]}${x[v.XRANGEPLAINLOOSE]}$`);R("LONECARET","(?:\\^)");R("CARETTRIM",`(\\s*)${x[v.LONECARET]}\\s+`,!0);Fe.caretTrimReplace="$1^";R("CARET",`^${x[v.LONECARET]}${x[v.XRANGEPLAIN]}$`);R("CARETLOOSE",`^${x[v.LONECARET]}${x[v.XRANGEPLAINLOOSE]}$`);R("COMPARATORLOOSE",`^${x[v.GTLT]}\\s*(${x[v.LOOSEPLAIN]})$|^$`);R("COMPARATOR",`^${x[v.GTLT]}\\s*(${x[v.FULLPLAIN]})$|^$`);R("COMPARATORTRIM",`(\\s*)${x[v.GTLT]}\\s*(${x[v.LOOSEPLAIN]}|${x[v.XRANGEPLAIN]})`,!0);Fe.comparatorTrimReplace="$1$2$3";R("HYPHENRANGE",`^\\s*(${x[v.XRANGEPLAIN]})\\s+-\\s+(${x[v.XRANGEPLAIN]})\\s*$`);R("HYPHENRANGELOOSE",`^\\s*(${x[v.XRANGEPLAINLOOSE]})\\s+-\\s+(${x[v.XRANGEPLAINLOOSE]})\\s*$`);R("STAR","(<|>)?=?\\s*\\*");R("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");R("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var Zt=y((fy,Ws)=>{"use strict";var Ah=Object.freeze({loose:!0}),$h=Object.freeze({}),Fh=t=>t?typeof t!="object"?Ah:t:$h;Ws.exports=Fh});var Mr=y((hy,zs)=>{"use strict";var js=/^[0-9]+$/,Xs=(t,e)=>{if(typeof t=="number"&&typeof e=="number")return t===e?0:t<e?-1:1;let r=js.test(t),n=js.test(e);return r&&n&&(t=+t,e=+e),t===e?0:r&&!n?-1:n&&!r?1:t<e?-1:1},qh=(t,e)=>Xs(e,t);zs.exports={compareIdentifiers:Xs,rcompareIdentifiers:qh}});var ce=y((dy,Ys)=>{"use strict";var Yt=xt(),{MAX_LENGTH:Zs,MAX_SAFE_INTEGER:Kt}=St(),{safeRe:Jt,t:Qt}=rt(),_h=Zt(),{compareIdentifiers:Hr}=Mr(),Gr=class t{constructor(e,r){if(r=_h(r),e instanceof t){if(e.loose===!!r.loose&&e.includePrerelease===!!r.includePrerelease)return e;e=e.version}else if(typeof e!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof e}".`);if(e.length>Zs)throw new TypeError(`version is longer than ${Zs} characters`);Yt("SemVer",e,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;let n=e.trim().match(r.loose?Jt[Qt.LOOSE]:Jt[Qt.FULL]);if(!n)throw new TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+n[1],this.minor=+n[2],this.patch=+n[3],this.major>Kt||this.major<0)throw new TypeError("Invalid major version");if(this.minor>Kt||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>Kt||this.patch<0)throw new TypeError("Invalid patch version");n[4]?this.prerelease=n[4].split(".").map(i=>{if(/^[0-9]+$/.test(i)){let s=+i;if(s>=0&&s<Kt)return s}return i}):this.prerelease=[],this.build=n[5]?n[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(e){if(Yt("SemVer.compare",this.version,this.options,e),!(e instanceof t)){if(typeof e=="string"&&e===this.version)return 0;e=new t(e,this.options)}return e.version===this.version?0:this.compareMain(e)||this.comparePre(e)}compareMain(e){return e instanceof t||(e=new t(e,this.options)),this.major<e.major?-1:this.major>e.major?1:this.minor<e.minor?-1:this.minor>e.minor?1:this.patch<e.patch?-1:this.patch>e.patch?1:0}comparePre(e){if(e instanceof t||(e=new t(e,this.options)),this.prerelease.length&&!e.prerelease.length)return-1;if(!this.prerelease.length&&e.prerelease.length)return 1;if(!this.prerelease.length&&!e.prerelease.length)return 0;let r=0;do{let n=this.prerelease[r],i=e.prerelease[r];if(Yt("prerelease compare",r,n,i),n===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(n===void 0)return-1;if(n===i)continue;return Hr(n,i)}while(++r)}compareBuild(e){e instanceof t||(e=new t(e,this.options));let r=0;do{let n=this.build[r],i=e.build[r];if(Yt("build compare",r,n,i),n===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(n===void 0)return-1;if(n===i)continue;return Hr(n,i)}while(++r)}inc(e,r,n){if(e.startsWith("pre")){if(!r&&n===!1)throw new Error("invalid increment argument: identifier is empty");if(r){let i=`-${r}`.match(this.options.loose?Jt[Qt.PRERELEASELOOSE]:Jt[Qt.PRERELEASE]);if(!i||i[1]!==r)throw new Error(`invalid identifier: ${r}`)}}switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",r,n);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",r,n);break;case"prepatch":this.prerelease.length=0,this.inc("patch",r,n),this.inc("pre",r,n);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",r,n),this.inc("pre",r,n);break;case"release":if(this.prerelease.length===0)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{let i=Number(n)?1:0;if(this.prerelease.length===0)this.prerelease=[i];else{let s=this.prerelease.length;for(;--s>=0;)typeof this.prerelease[s]=="number"&&(this.prerelease[s]++,s=-2);if(s===-1){if(r===this.prerelease.join(".")&&n===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(i)}}if(r){let s=[r,i];n===!1&&(s=[r]),Hr(this.prerelease[0],r)===0?isNaN(this.prerelease[1])&&(this.prerelease=s):this.prerelease=s}break}default:throw new Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};Ys.exports=Gr});var Xe=y((my,Js)=>{"use strict";var Ks=ce(),Ph=(t,e,r=!1)=>{if(t instanceof Ks)return t;try{return new Ks(t,e)}catch(n){if(!r)return null;throw n}};Js.exports=Ph});var eo=y((py,Qs)=>{"use strict";var kh=Xe(),Uh=(t,e)=>{let r=kh(t,e);return r?r.version:null};Qs.exports=Uh});var ro=y((Ey,to)=>{"use strict";var Bh=Xe(),Mh=(t,e)=>{let r=Bh(t.trim().replace(/^[=v]+/,""),e);return r?r.version:null};to.exports=Mh});var so=y((yy,io)=>{"use strict";var no=ce(),Hh=(t,e,r,n,i)=>{typeof r=="string"&&(i=n,n=r,r=void 0);try{return new no(t instanceof no?t.version:t,r).inc(e,n,i).version}catch{return null}};io.exports=Hh});var co=y((gy,ao)=>{"use strict";var oo=Xe(),Gh=(t,e)=>{let r=oo(t,null,!0),n=oo(e,null,!0),i=r.compare(n);if(i===0)return null;let s=i>0,o=s?r:n,a=s?n:r,c=!!o.prerelease.length;if(!!a.prerelease.length&&!c){if(!a.patch&&!a.minor)return"major";if(a.compareMain(o)===0)return a.minor&&!a.patch?"minor":"patch"}let l=c?"pre":"";return r.major!==n.major?l+"major":r.minor!==n.minor?l+"minor":r.patch!==n.patch?l+"patch":"prerelease"};ao.exports=Gh});var lo=y((wy,uo)=>{"use strict";var Vh=ce(),Wh=(t,e)=>new Vh(t,e).major;uo.exports=Wh});var ho=y((Sy,fo)=>{"use strict";var jh=ce(),Xh=(t,e)=>new jh(t,e).minor;fo.exports=Xh});var po=y((xy,mo)=>{"use strict";var zh=ce(),Zh=(t,e)=>new zh(t,e).patch;mo.exports=Zh});var yo=y((vy,Eo)=>{"use strict";var Yh=Xe(),Kh=(t,e)=>{let r=Yh(t,e);return r&&r.prerelease.length?r.prerelease:null};Eo.exports=Kh});var Oe=y((Cy,wo)=>{"use strict";var go=ce(),Jh=(t,e,r)=>new go(t,r).compare(new go(e,r));wo.exports=Jh});var xo=y((Iy,So)=>{"use strict";var Qh=Oe(),ed=(t,e,r)=>Qh(e,t,r);So.exports=ed});var Co=y((Ny,vo)=>{"use strict";var td=Oe(),rd=(t,e)=>td(t,e,!0);vo.exports=rd});var er=y((Oy,No)=>{"use strict";var Io=ce(),nd=(t,e,r)=>{let n=new Io(t,r),i=new Io(e,r);return n.compare(i)||n.compareBuild(i)};No.exports=nd});var Lo=y((Ly,Oo)=>{"use strict";var id=er(),sd=(t,e)=>t.sort((r,n)=>id(r,n,e));Oo.exports=sd});var Ro=y((Dy,Do)=>{"use strict";var od=er(),ad=(t,e)=>t.sort((r,n)=>od(n,r,e));Do.exports=ad});var vt=y((Ry,bo)=>{"use strict";var cd=Oe(),ud=(t,e,r)=>cd(t,e,r)>0;bo.exports=ud});var tr=y((by,To)=>{"use strict";var ld=Oe(),fd=(t,e,r)=>ld(t,e,r)<0;To.exports=fd});var Vr=y((Ty,Ao)=>{"use strict";var hd=Oe(),dd=(t,e,r)=>hd(t,e,r)===0;Ao.exports=dd});var Wr=y((Ay,$o)=>{"use strict";var md=Oe(),pd=(t,e,r)=>md(t,e,r)!==0;$o.exports=pd});var rr=y(($y,Fo)=>{"use strict";var Ed=Oe(),yd=(t,e,r)=>Ed(t,e,r)>=0;Fo.exports=yd});var nr=y((Fy,qo)=>{"use strict";var gd=Oe(),wd=(t,e,r)=>gd(t,e,r)<=0;qo.exports=wd});var jr=y((qy,_o)=>{"use strict";var Sd=Vr(),xd=Wr(),vd=vt(),Cd=rr(),Id=tr(),Nd=nr(),Od=(t,e,r,n)=>{switch(e){case"===":return typeof t=="object"&&(t=t.version),typeof r=="object"&&(r=r.version),t===r;case"!==":return typeof t=="object"&&(t=t.version),typeof r=="object"&&(r=r.version),t!==r;case"":case"=":case"==":return Sd(t,r,n);case"!=":return xd(t,r,n);case">":return vd(t,r,n);case">=":return Cd(t,r,n);case"<":return Id(t,r,n);case"<=":return Nd(t,r,n);default:throw new TypeError(`Invalid operator: ${e}`)}};_o.exports=Od});var ko=y((_y,Po)=>{"use strict";var Ld=ce(),Dd=Xe(),{safeRe:ir,t:sr}=rt(),Rd=(t,e)=>{if(t instanceof Ld)return t;if(typeof t=="number"&&(t=String(t)),typeof t!="string")return null;e=e||{};let r=null;if(!e.rtl)r=t.match(e.includePrerelease?ir[sr.COERCEFULL]:ir[sr.COERCE]);else{let c=e.includePrerelease?ir[sr.COERCERTLFULL]:ir[sr.COERCERTL],u;for(;(u=c.exec(t))&&(!r||r.index+r[0].length!==t.length);)(!r||u.index+u[0].length!==r.index+r[0].length)&&(r=u),c.lastIndex=u.index+u[1].length+u[2].length;c.lastIndex=-1}if(r===null)return null;let n=r[2],i=r[3]||"0",s=r[4]||"0",o=e.includePrerelease&&r[5]?`-${r[5]}`:"",a=e.includePrerelease&&r[6]?`+${r[6]}`:"";return Dd(`${n}.${i}.${s}${o}${a}`,e)};Po.exports=Rd});var Bo=y((Py,Uo)=>{"use strict";var Xr=class{constructor(){this.max=1e3,this.map=new Map}get(e){let r=this.map.get(e);if(r!==void 0)return this.map.delete(e),this.map.set(e,r),r}delete(e){return this.map.delete(e)}set(e,r){if(!this.delete(e)&&r!==void 0){if(this.map.size>=this.max){let i=this.map.keys().next().value;this.delete(i)}this.map.set(e,r)}return this}};Uo.exports=Xr});var Le=y((ky,Vo)=>{"use strict";var bd=/\s+/g,zr=class t{constructor(e,r){if(r=Ad(r),e instanceof t)return e.loose===!!r.loose&&e.includePrerelease===!!r.includePrerelease?e:new t(e.raw,r);if(e instanceof Zr)return this.raw=e.value,this.set=[[e]],this.formatted=void 0,this;if(this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease,this.raw=e.trim().replace(bd," "),this.set=this.raw.split("||").map(n=>this.parseRange(n.trim())).filter(n=>n.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let n=this.set[0];if(this.set=this.set.filter(i=>!Ho(i[0])),this.set.length===0)this.set=[n];else if(this.set.length>1){for(let i of this.set)if(i.length===1&&Ud(i[0])){this.set=[i];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let e=0;e<this.set.length;e++){e>0&&(this.formatted+="||");let r=this.set[e];for(let n=0;n<r.length;n++)n>0&&(this.formatted+=" "),this.formatted+=r[n].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(e){let n=((this.options.includePrerelease&&Pd)|(this.options.loose&&kd))+":"+e,i=Mo.get(n);if(i)return i;let s=this.options.loose,o=s?Ee[ue.HYPHENRANGELOOSE]:Ee[ue.HYPHENRANGE];e=e.replace(o,Zd(this.options.includePrerelease)),M("hyphen replace",e),e=e.replace(Ee[ue.COMPARATORTRIM],Fd),M("comparator trim",e),e=e.replace(Ee[ue.TILDETRIM],qd),M("tilde trim",e),e=e.replace(Ee[ue.CARETTRIM],_d),M("caret trim",e);let a=e.split(" ").map(f=>Bd(f,this.options)).join(" ").split(/\s+/).map(f=>zd(f,this.options));s&&(a=a.filter(f=>(M("loose invalid filter",f,this.options),!!f.match(Ee[ue.COMPARATORLOOSE])))),M("range list",a);let c=new Map,u=a.map(f=>new Zr(f,this.options));for(let f of u){if(Ho(f))return[f];c.set(f.value,f)}c.size>1&&c.has("")&&c.delete("");let l=[...c.values()];return Mo.set(n,l),l}intersects(e,r){if(!(e instanceof t))throw new TypeError("a Range is required");return this.set.some(n=>Go(n,r)&&e.set.some(i=>Go(i,r)&&n.every(s=>i.every(o=>s.intersects(o,r)))))}test(e){if(!e)return!1;if(typeof e=="string")try{e=new $d(e,this.options)}catch{return!1}for(let r=0;r<this.set.length;r++)if(Yd(this.set[r],e,this.options))return!0;return!1}};Vo.exports=zr;var Td=Bo(),Mo=new Td,Ad=Zt(),Zr=Ct(),M=xt(),$d=ce(),{safeRe:Ee,t:ue,comparatorTrimReplace:Fd,tildeTrimReplace:qd,caretTrimReplace:_d}=rt(),{FLAG_INCLUDE_PRERELEASE:Pd,FLAG_LOOSE:kd}=St(),Ho=t=>t.value==="<0.0.0-0",Ud=t=>t.value==="",Go=(t,e)=>{let r=!0,n=t.slice(),i=n.pop();for(;r&&n.length;)r=n.every(s=>i.intersects(s,e)),i=n.pop();return r},Bd=(t,e)=>(t=t.replace(Ee[ue.BUILD],""),M("comp",t,e),t=Gd(t,e),M("caret",t),t=Md(t,e),M("tildes",t),t=Wd(t,e),M("xrange",t),t=Xd(t,e),M("stars",t),t),ye=t=>!t||t.toLowerCase()==="x"||t==="*",Md=(t,e)=>t.trim().split(/\s+/).map(r=>Hd(r,e)).join(" "),Hd=(t,e)=>{let r=e.loose?Ee[ue.TILDELOOSE]:Ee[ue.TILDE];return t.replace(r,(n,i,s,o,a)=>{M("tilde",t,n,i,s,o,a);let c;return ye(i)?c="":ye(s)?c=`>=${i}.0.0 <${+i+1}.0.0-0`:ye(o)?c=`>=${i}.${s}.0 <${i}.${+s+1}.0-0`:a?(M("replaceTilde pr",a),c=`>=${i}.${s}.${o}-${a} <${i}.${+s+1}.0-0`):c=`>=${i}.${s}.${o} <${i}.${+s+1}.0-0`,M("tilde return",c),c})},Gd=(t,e)=>t.trim().split(/\s+/).map(r=>Vd(r,e)).join(" "),Vd=(t,e)=>{M("caret",t,e);let r=e.loose?Ee[ue.CARETLOOSE]:Ee[ue.CARET],n=e.includePrerelease?"-0":"";return t.replace(r,(i,s,o,a,c)=>{M("caret",t,i,s,o,a,c);let u;return ye(s)?u="":ye(o)?u=`>=${s}.0.0${n} <${+s+1}.0.0-0`:ye(a)?s==="0"?u=`>=${s}.${o}.0${n} <${s}.${+o+1}.0-0`:u=`>=${s}.${o}.0${n} <${+s+1}.0.0-0`:c?(M("replaceCaret pr",c),s==="0"?o==="0"?u=`>=${s}.${o}.${a}-${c} <${s}.${o}.${+a+1}-0`:u=`>=${s}.${o}.${a}-${c} <${s}.${+o+1}.0-0`:u=`>=${s}.${o}.${a}-${c} <${+s+1}.0.0-0`):(M("no pr"),s==="0"?o==="0"?u=`>=${s}.${o}.${a}${n} <${s}.${o}.${+a+1}-0`:u=`>=${s}.${o}.${a}${n} <${s}.${+o+1}.0-0`:u=`>=${s}.${o}.${a} <${+s+1}.0.0-0`),M("caret return",u),u})},Wd=(t,e)=>(M("replaceXRanges",t,e),t.split(/\s+/).map(r=>jd(r,e)).join(" ")),jd=(t,e)=>{t=t.trim();let r=e.loose?Ee[ue.XRANGELOOSE]:Ee[ue.XRANGE];return t.replace(r,(n,i,s,o,a,c)=>{M("xRange",t,n,i,s,o,a,c);let u=ye(s),l=u||ye(o),f=l||ye(a),m=f;return i==="="&&m&&(i=""),c=e.includePrerelease?"-0":"",u?i===">"||i==="<"?n="<0.0.0-0":n="*":i&&m?(l&&(o=0),a=0,i===">"?(i=">=",l?(s=+s+1,o=0,a=0):(o=+o+1,a=0)):i==="<="&&(i="<",l?s=+s+1:o=+o+1),i==="<"&&(c="-0"),n=`${i+s}.${o}.${a}${c}`):l?n=`>=${s}.0.0${c} <${+s+1}.0.0-0`:f&&(n=`>=${s}.${o}.0${c} <${s}.${+o+1}.0-0`),M("xRange return",n),n})},Xd=(t,e)=>(M("replaceStars",t,e),t.trim().replace(Ee[ue.STAR],"")),zd=(t,e)=>(M("replaceGTE0",t,e),t.trim().replace(Ee[e.includePrerelease?ue.GTE0PRE:ue.GTE0],"")),Zd=t=>(e,r,n,i,s,o,a,c,u,l,f,m)=>(ye(n)?r="":ye(i)?r=`>=${n}.0.0${t?"-0":""}`:ye(s)?r=`>=${n}.${i}.0${t?"-0":""}`:o?r=`>=${r}`:r=`>=${r}${t?"-0":""}`,ye(u)?c="":ye(l)?c=`<${+u+1}.0.0-0`:ye(f)?c=`<${u}.${+l+1}.0-0`:m?c=`<=${u}.${l}.${f}-${m}`:t?c=`<${u}.${l}.${+f+1}-0`:c=`<=${c}`,`${r} ${c}`.trim()),Yd=(t,e,r)=>{for(let n=0;n<t.length;n++)if(!t[n].test(e))return!1;if(e.prerelease.length&&!r.includePrerelease){for(let n=0;n<t.length;n++)if(M(t[n].semver),t[n].semver!==Zr.ANY&&t[n].semver.prerelease.length>0){let i=t[n].semver;if(i.major===e.major&&i.minor===e.minor&&i.patch===e.patch)return!0}return!1}return!0}});var Ct=y((Uy,Yo)=>{"use strict";var It=Symbol("SemVer ANY"),Jr=class t{static get ANY(){return It}constructor(e,r){if(r=Wo(r),e instanceof t){if(e.loose===!!r.loose)return e;e=e.value}e=e.trim().split(/\s+/).join(" "),Kr("comparator",e,r),this.options=r,this.loose=!!r.loose,this.parse(e),this.semver===It?this.value="":this.value=this.operator+this.semver.version,Kr("comp",this)}parse(e){let r=this.options.loose?jo[Xo.COMPARATORLOOSE]:jo[Xo.COMPARATOR],n=e.match(r);if(!n)throw new TypeError(`Invalid comparator: ${e}`);this.operator=n[1]!==void 0?n[1]:"",this.operator==="="&&(this.operator=""),n[2]?this.semver=new zo(n[2],this.options.loose):this.semver=It}toString(){return this.value}test(e){if(Kr("Comparator.test",e,this.options.loose),this.semver===It||e===It)return!0;if(typeof e=="string")try{e=new zo(e,this.options)}catch{return!1}return Yr(e,this.operator,this.semver,this.options)}intersects(e,r){if(!(e instanceof t))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new Zo(e.value,r).test(this.value):e.operator===""?e.value===""?!0:new Zo(this.value,r).test(e.semver):(r=Wo(r),r.includePrerelease&&(this.value==="<0.0.0-0"||e.value==="<0.0.0-0")||!r.includePrerelease&&(this.value.startsWith("<0.0.0")||e.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&e.operator.startsWith(">")||this.operator.startsWith("<")&&e.operator.startsWith("<")||this.semver.version===e.semver.version&&this.operator.includes("=")&&e.operator.includes("=")||Yr(this.semver,"<",e.semver,r)&&this.operator.startsWith(">")&&e.operator.startsWith("<")||Yr(this.semver,">",e.semver,r)&&this.operator.startsWith("<")&&e.operator.startsWith(">")))}};Yo.exports=Jr;var Wo=Zt(),{safeRe:jo,t:Xo}=rt(),Yr=jr(),Kr=xt(),zo=ce(),Zo=Le()});var Nt=y((By,Ko)=>{"use strict";var Kd=Le(),Jd=(t,e,r)=>{try{e=new Kd(e,r)}catch{return!1}return e.test(t)};Ko.exports=Jd});var Qo=y((My,Jo)=>{"use strict";var Qd=Le(),em=(t,e)=>new Qd(t,e).set.map(r=>r.map(n=>n.value).join(" ").trim().split(" "));Jo.exports=em});var ta=y((Hy,ea)=>{"use strict";var tm=ce(),rm=Le(),nm=(t,e,r)=>{let n=null,i=null,s=null;try{s=new rm(e,r)}catch{return null}return t.forEach(o=>{s.test(o)&&(!n||i.compare(o)===-1)&&(n=o,i=new tm(n,r))}),n};ea.exports=nm});var na=y((Gy,ra)=>{"use strict";var im=ce(),sm=Le(),om=(t,e,r)=>{let n=null,i=null,s=null;try{s=new sm(e,r)}catch{return null}return t.forEach(o=>{s.test(o)&&(!n||i.compare(o)===1)&&(n=o,i=new im(n,r))}),n};ra.exports=om});var oa=y((Vy,sa)=>{"use strict";var Qr=ce(),am=Le(),ia=vt(),cm=(t,e)=>{t=new am(t,e);let r=new Qr("0.0.0");if(t.test(r)||(r=new Qr("0.0.0-0"),t.test(r)))return r;r=null;for(let n=0;n<t.set.length;++n){let i=t.set[n],s=null;i.forEach(o=>{let a=new Qr(o.semver.version);switch(o.operator){case">":a.prerelease.length===0?a.patch++:a.prerelease.push(0),a.raw=a.format();case"":case">=":(!s||ia(a,s))&&(s=a);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${o.operator}`)}}),s&&(!r||ia(r,s))&&(r=s)}return r&&t.test(r)?r:null};sa.exports=cm});var ca=y((Wy,aa)=>{"use strict";var um=Le(),lm=(t,e)=>{try{return new um(t,e).range||"*"}catch{return null}};aa.exports=lm});var or=y((jy,ha)=>{"use strict";var fm=ce(),fa=Ct(),{ANY:hm}=fa,dm=Le(),mm=Nt(),ua=vt(),la=tr(),pm=nr(),Em=rr(),ym=(t,e,r,n)=>{t=new fm(t,n),e=new dm(e,n);let i,s,o,a,c;switch(r){case">":i=ua,s=pm,o=la,a=">",c=">=";break;case"<":i=la,s=Em,o=ua,a="<",c="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(mm(t,e,n))return!1;for(let u=0;u<e.set.length;++u){let l=e.set[u],f=null,m=null;if(l.forEach(d=>{d.semver===hm&&(d=new fa(">=0.0.0")),f=f||d,m=m||d,i(d.semver,f.semver,n)?f=d:o(d.semver,m.semver,n)&&(m=d)}),f.operator===a||f.operator===c||(!m.operator||m.operator===a)&&s(t,m.semver))return!1;if(m.operator===c&&o(t,m.semver))return!1}return!0};ha.exports=ym});var ma=y((Xy,da)=>{"use strict";var gm=or(),wm=(t,e,r)=>gm(t,e,">",r);da.exports=wm});var Ea=y((zy,pa)=>{"use strict";var Sm=or(),xm=(t,e,r)=>Sm(t,e,"<",r);pa.exports=xm});var wa=y((Zy,ga)=>{"use strict";var ya=Le(),vm=(t,e,r)=>(t=new ya(t,r),e=new ya(e,r),t.intersects(e,r));ga.exports=vm});var xa=y((Yy,Sa)=>{"use strict";var Cm=Nt(),Im=Oe();Sa.exports=(t,e,r)=>{let n=[],i=null,s=null,o=t.sort((l,f)=>Im(l,f,r));for(let l of o)Cm(l,e,r)?(s=l,i||(i=l)):(s&&n.push([i,s]),s=null,i=null);i&&n.push([i,null]);let a=[];for(let[l,f]of n)l===f?a.push(l):!f&&l===o[0]?a.push("*"):f?l===o[0]?a.push(`<=${f}`):a.push(`${l} - ${f}`):a.push(`>=${l}`);let c=a.join(" || "),u=typeof e.raw=="string"?e.raw:String(e);return c.length<u.length?c:e}});var La=y((Ky,Oa)=>{"use strict";var va=Le(),tn=Ct(),{ANY:en}=tn,Ot=Nt(),rn=Oe(),Nm=(t,e,r={})=>{if(t===e)return!0;t=new va(t,r),e=new va(e,r);let n=!1;e:for(let i of t.set){for(let s of e.set){let o=Lm(i,s,r);if(n=n||o!==null,o)continue e}if(n)return!1}return!0},Om=[new tn(">=0.0.0-0")],Ca=[new tn(">=0.0.0")],Lm=(t,e,r)=>{if(t===e)return!0;if(t.length===1&&t[0].semver===en){if(e.length===1&&e[0].semver===en)return!0;r.includePrerelease?t=Om:t=Ca}if(e.length===1&&e[0].semver===en){if(r.includePrerelease)return!0;e=Ca}let n=new Set,i,s;for(let d of t)d.operator===">"||d.operator===">="?i=Ia(i,d,r):d.operator==="<"||d.operator==="<="?s=Na(s,d,r):n.add(d.semver);if(n.size>1)return null;let o;if(i&&s){if(o=rn(i.semver,s.semver,r),o>0)return null;if(o===0&&(i.operator!==">="||s.operator!=="<="))return null}for(let d of n){if(i&&!Ot(d,String(i),r)||s&&!Ot(d,String(s),r))return null;for(let h of e)if(!Ot(d,String(h),r))return!1;return!0}let a,c,u,l,f=s&&!r.includePrerelease&&s.semver.prerelease.length?s.semver:!1,m=i&&!r.includePrerelease&&i.semver.prerelease.length?i.semver:!1;f&&f.prerelease.length===1&&s.operator==="<"&&f.prerelease[0]===0&&(f=!1);for(let d of e){if(l=l||d.operator===">"||d.operator===">=",u=u||d.operator==="<"||d.operator==="<=",i){if(m&&d.semver.prerelease&&d.semver.prerelease.length&&d.semver.major===m.major&&d.semver.minor===m.minor&&d.semver.patch===m.patch&&(m=!1),d.operator===">"||d.operator===">="){if(a=Ia(i,d,r),a===d&&a!==i)return!1}else if(i.operator===">="&&!Ot(i.semver,String(d),r))return!1}if(s){if(f&&d.semver.prerelease&&d.semver.prerelease.length&&d.semver.major===f.major&&d.semver.minor===f.minor&&d.semver.patch===f.patch&&(f=!1),d.operator==="<"||d.operator==="<="){if(c=Na(s,d,r),c===d&&c!==s)return!1}else if(s.operator==="<="&&!Ot(s.semver,String(d),r))return!1}if(!d.operator&&(s||i)&&o!==0)return!1}return!(i&&u&&!s&&o!==0||s&&l&&!i&&o!==0||m||f)},Ia=(t,e,r)=>{if(!t)return e;let n=rn(t.semver,e.semver,r);return n>0?t:n<0||e.operator===">"&&t.operator===">="?e:t},Na=(t,e,r)=>{if(!t)return e;let n=rn(t.semver,e.semver,r);return n<0?t:n>0||e.operator==="<"&&t.operator==="<="?e:t};Oa.exports=Nm});var Ta=y((Jy,ba)=>{"use strict";var nn=rt(),Da=St(),Dm=ce(),Ra=Mr(),Rm=Xe(),bm=eo(),Tm=ro(),Am=so(),$m=co(),Fm=lo(),qm=ho(),_m=po(),Pm=yo(),km=Oe(),Um=xo(),Bm=Co(),Mm=er(),Hm=Lo(),Gm=Ro(),Vm=vt(),Wm=tr(),jm=Vr(),Xm=Wr(),zm=rr(),Zm=nr(),Ym=jr(),Km=ko(),Jm=Ct(),Qm=Le(),ep=Nt(),tp=Qo(),rp=ta(),np=na(),ip=oa(),sp=ca(),op=or(),ap=ma(),cp=Ea(),up=wa(),lp=xa(),fp=La();ba.exports={parse:Rm,valid:bm,clean:Tm,inc:Am,diff:$m,major:Fm,minor:qm,patch:_m,prerelease:Pm,compare:km,rcompare:Um,compareLoose:Bm,compareBuild:Mm,sort:Hm,rsort:Gm,gt:Vm,lt:Wm,eq:jm,neq:Xm,gte:zm,lte:Zm,cmp:Ym,coerce:Km,Comparator:Jm,Range:Qm,satisfies:ep,toComparators:tp,maxSatisfying:rp,minSatisfying:np,minVersion:ip,validRange:sp,outside:op,gtr:ap,ltr:cp,intersects:up,simplifyRange:lp,subset:fp,SemVer:Dm,re:nn.re,src:nn.src,tokens:nn.t,SEMVER_SPEC_VERSION:Da.SEMVER_SPEC_VERSION,RELEASE_TYPES:Da.RELEASE_TYPES,compareIdentifiers:Ra.compareIdentifiers,rcompareIdentifiers:Ra.rcompareIdentifiers}});var Fa=y((Qy,sn)=>{var Aa=process.argv||[],ar=process.env,hp=!("NO_COLOR"in ar||Aa.includes("--no-color"))&&("FORCE_COLOR"in ar||Aa.includes("--color")||process.platform==="win32"||require!=null&&require("tty").isatty(1)&&ar.TERM!=="dumb"||"CI"in ar),dp=(t,e,r=t)=>n=>{let i=""+n,s=i.indexOf(e,t.length);return~s?t+mp(i,e,r,s)+e:t+i+e},mp=(t,e,r,n)=>{let i="",s=0;do i+=t.substring(s,n)+r,s=n+e.length,n=t.indexOf(e,s);while(~n);return i+t.substring(s)},$a=(t=hp)=>{let e=t?dp:()=>String;return{isColorSupported:t,reset:e("\x1B[0m","\x1B[0m"),bold:e("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:e("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:e("\x1B[3m","\x1B[23m"),underline:e("\x1B[4m","\x1B[24m"),inverse:e("\x1B[7m","\x1B[27m"),hidden:e("\x1B[8m","\x1B[28m"),strikethrough:e("\x1B[9m","\x1B[29m"),black:e("\x1B[30m","\x1B[39m"),red:e("\x1B[31m","\x1B[39m"),green:e("\x1B[32m","\x1B[39m"),yellow:e("\x1B[33m","\x1B[39m"),blue:e("\x1B[34m","\x1B[39m"),magenta:e("\x1B[35m","\x1B[39m"),cyan:e("\x1B[36m","\x1B[39m"),white:e("\x1B[37m","\x1B[39m"),gray:e("\x1B[90m","\x1B[39m"),bgBlack:e("\x1B[40m","\x1B[49m"),bgRed:e("\x1B[41m","\x1B[49m"),bgGreen:e("\x1B[42m","\x1B[49m"),bgYellow:e("\x1B[43m","\x1B[49m"),bgBlue:e("\x1B[44m","\x1B[49m"),bgMagenta:e("\x1B[45m","\x1B[49m"),bgCyan:e("\x1B[46m","\x1B[49m"),bgWhite:e("\x1B[47m","\x1B[49m")}};sn.exports=$a();sn.exports.createColors=$a});var Ua=y((eg,ka)=>{ka.exports=Pa;Pa.sync=Ep;var qa=require("fs");function pp(t,e){var r=e.pathExt!==void 0?e.pathExt:process.env.PATHEXT;if(!r||(r=r.split(";"),r.indexOf("")!==-1))return!0;for(var n=0;n<r.length;n++){var i=r[n].toLowerCase();if(i&&t.substr(-i.length).toLowerCase()===i)return!0}return!1}function _a(t,e,r){return!t.isSymbolicLink()&&!t.isFile()?!1:pp(e,r)}function Pa(t,e,r){qa.stat(t,function(n,i){r(n,n?!1:_a(i,t,e))})}function Ep(t,e){return _a(qa.statSync(t),t,e)}});var Va=y((tg,Ga)=>{Ga.exports=Ma;Ma.sync=yp;var Ba=require("fs");function Ma(t,e,r){Ba.stat(t,function(n,i){r(n,n?!1:Ha(i,e))})}function yp(t,e){return Ha(Ba.statSync(t),e)}function Ha(t,e){return t.isFile()&&gp(t,e)}function gp(t,e){var r=t.mode,n=t.uid,i=t.gid,s=e.uid!==void 0?e.uid:process.getuid&&process.getuid(),o=e.gid!==void 0?e.gid:process.getgid&&process.getgid(),a=parseInt("100",8),c=parseInt("010",8),u=parseInt("001",8),l=a|c,f=r&u||r&c&&i===o||r&a&&n===s||r&l&&s===0;return f}});var ja=y((ng,Wa)=>{var rg=require("fs"),cr;process.platform==="win32"||global.TESTING_WINDOWS?cr=Ua():cr=Va();Wa.exports=on;on.sync=wp;function on(t,e,r){if(typeof e=="function"&&(r=e,e={}),!r){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(n,i){on(t,e||{},function(s,o){s?i(s):n(o)})})}cr(t,e||{},function(n,i){n&&(n.code==="EACCES"||e&&e.ignoreErrors)&&(n=null,i=!1),r(n,i)})}function wp(t,e){try{return cr.sync(t,e||{})}catch(r){if(e&&e.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var Qa=y((ig,Ja)=>{var nt=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",Xa=require("path"),Sp=nt?";":":",za=ja(),Za=t=>Object.assign(new Error(`not found: ${t}`),{code:"ENOENT"}),Ya=(t,e)=>{let r=e.colon||Sp,n=t.match(/\//)||nt&&t.match(/\\/)?[""]:[...nt?[process.cwd()]:[],...(e.path||process.env.PATH||"").split(r)],i=nt?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",s=nt?i.split(r):[""];return nt&&t.indexOf(".")!==-1&&s[0]!==""&&s.unshift(""),{pathEnv:n,pathExt:s,pathExtExe:i}},Ka=(t,e,r)=>{typeof e=="function"&&(r=e,e={}),e||(e={});let{pathEnv:n,pathExt:i,pathExtExe:s}=Ya(t,e),o=[],a=u=>new Promise((l,f)=>{if(u===n.length)return e.all&&o.length?l(o):f(Za(t));let m=n[u],d=/^".*"$/.test(m)?m.slice(1,-1):m,h=Xa.join(d,t),E=!d&&/^\.[\\\/]/.test(t)?t.slice(0,2)+h:h;l(c(E,u,0))}),c=(u,l,f)=>new Promise((m,d)=>{if(f===i.length)return m(a(l+1));let h=i[f];za(u+h,{pathExt:s},(E,w)=>{if(!E&&w)if(e.all)o.push(u+h);else return m(u+h);return m(c(u,l,f+1))})});return r?a(0).then(u=>r(null,u),r):a(0)},xp=(t,e)=>{e=e||{};let{pathEnv:r,pathExt:n,pathExtExe:i}=Ya(t,e),s=[];for(let o=0;o<r.length;o++){let a=r[o],c=/^".*"$/.test(a)?a.slice(1,-1):a,u=Xa.join(c,t),l=!c&&/^\.[\\\/]/.test(t)?t.slice(0,2)+u:u;for(let f=0;f<n.length;f++){let m=l+n[f];try{if(za.sync(m,{pathExt:i}))if(e.all)s.push(m);else return m}catch{}}}if(e.all&&s.length)return s;if(e.nothrow)return null;throw Za(t)};Ja.exports=Ka;Ka.sync=xp});var tc=y((sg,an)=>{"use strict";var ec=(t={})=>{let e=t.env||process.env;return(t.platform||process.platform)!=="win32"?"PATH":Object.keys(e).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"};an.exports=ec;an.exports.default=ec});var sc=y((og,ic)=>{"use strict";var rc=require("path"),vp=Qa(),Cp=tc();function nc(t,e){let r=t.options.env||process.env,n=process.cwd(),i=t.options.cwd!=null,s=i&&process.chdir!==void 0&&!process.chdir.disabled;if(s)try{process.chdir(t.options.cwd)}catch{}let o;try{o=vp.sync(t.command,{path:r[Cp({env:r})],pathExt:e?rc.delimiter:void 0})}catch{}finally{s&&process.chdir(n)}return o&&(o=rc.resolve(i?t.options.cwd:"",o)),o}function Ip(t){return nc(t)||nc(t,!0)}ic.exports=Ip});var oc=y((ag,un)=>{"use strict";var cn=/([()\][%!^"`<>&|;, *?])/g;function Np(t){return t=t.replace(cn,"^$1"),t}function Op(t,e){return t=`${t}`,t=t.replace(/(\\*)"/g,'$1$1\\"'),t=t.replace(/(\\*)$/,"$1$1"),t=`"${t}"`,t=t.replace(cn,"^$1"),e&&(t=t.replace(cn,"^$1")),t}un.exports.command=Np;un.exports.argument=Op});var cc=y((cg,ac)=>{"use strict";ac.exports=/^#!(.*)/});var lc=y((ug,uc)=>{"use strict";var Lp=cc();uc.exports=(t="")=>{let e=t.match(Lp);if(!e)return null;let[r,n]=e[0].replace(/#! ?/,"").split(" "),i=r.split("/").pop();return i==="env"?n:n?`${i} ${n}`:i}});var hc=y((lg,fc)=>{"use strict";var ln=require("fs"),Dp=lc();function Rp(t){let r=Buffer.alloc(150),n;try{n=ln.openSync(t,"r"),ln.readSync(n,r,0,150,0),ln.closeSync(n)}catch{}return Dp(r.toString())}fc.exports=Rp});var Ec=y((fg,pc)=>{"use strict";var bp=require("path"),dc=sc(),mc=oc(),Tp=hc(),Ap=process.platform==="win32",$p=/\.(?:com|exe)$/i,Fp=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function qp(t){t.file=dc(t);let e=t.file&&Tp(t.file);return e?(t.args.unshift(t.file),t.command=e,dc(t)):t.file}function _p(t){if(!Ap)return t;let e=qp(t),r=!$p.test(e);if(t.options.forceShell||r){let n=Fp.test(e);t.command=bp.normalize(t.command),t.command=mc.command(t.command),t.args=t.args.map(s=>mc.argument(s,n));let i=[t.command].concat(t.args).join(" ");t.args=["/d","/s","/c",`"${i}"`],t.command=process.env.comspec||"cmd.exe",t.options.windowsVerbatimArguments=!0}return t}function Pp(t,e,r){e&&!Array.isArray(e)&&(r=e,e=null),e=e?e.slice(0):[],r=Object.assign({},r);let n={command:t,args:e,options:r,file:void 0,original:{command:t,args:e}};return r.shell?n:_p(n)}pc.exports=Pp});var wc=y((hg,gc)=>{"use strict";var fn=process.platform==="win32";function hn(t,e){return Object.assign(new Error(`${e} ${t.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${e} ${t.command}`,path:t.command,spawnargs:t.args})}function kp(t,e){if(!fn)return;let r=t.emit;t.emit=function(n,i){if(n==="exit"){let s=yc(i,e,"spawn");if(s)return r.call(t,"error",s)}return r.apply(t,arguments)}}function yc(t,e){return fn&&t===1&&!e.file?hn(e.original,"spawn"):null}function Up(t,e){return fn&&t===1&&!e.file?hn(e.original,"spawnSync"):null}gc.exports={hookChildProcess:kp,verifyENOENT:yc,verifyENOENTSync:Up,notFoundError:hn}});var vc=y((dg,it)=>{"use strict";var Sc=require("child_process"),dn=Ec(),mn=wc();function xc(t,e,r){let n=dn(t,e,r),i=Sc.spawn(n.command,n.args,n.options);return mn.hookChildProcess(i,n),i}function Bp(t,e,r){let n=dn(t,e,r),i=Sc.spawnSync(n.command,n.args,n.options);return i.error=i.error||mn.verifyENOENTSync(i.status,n),i}it.exports=xc;it.exports.spawn=xc;it.exports.sync=Bp;it.exports._parse=dn;it.exports._enoent=mn});var Cc=y((mg,Mp)=>{Mp.exports=["|/-\\","\u2802-\u2013\u2014\u2013-","\u25D0\u25D3\u25D1\u25D2","\u25F4\u25F7\u25F6\u25F5","\u25F0\u25F3\u25F2\u25F1","\u2596\u2598\u259D\u2597","\u25A0\u25A1\u25AA\u25AB","\u258C\u2580\u2590\u2584","\u2589\u258A\u258B\u258C\u258D\u258E\u258F\u258E\u258D\u258C\u258B\u258A\u2589","\u2581\u2583\u2584\u2585\u2586\u2587\u2588\u2587\u2586\u2585\u2584\u2583","\u2190\u2196\u2191\u2197\u2192\u2198\u2193\u2199","\u2524\u2518\u2534\u2514\u251C\u250C\u252C\u2510","\u25E2\u25E3\u25E4\u25E5",".oO\xB0Oo.",".oO@*",["\u{1F30D}","\u{1F30E}","\u{1F30F}"],"\u25E1\u25E1 \u2299\u2299 \u25E0\u25E0","\u2631\u2632\u2634","\u280B\u2819\u2839\u2838\u283C\u2834\u2826\u2827\u2807\u280F","\u280B\u2819\u281A\u281E\u2816\u2826\u2834\u2832\u2833\u2813","\u2804\u2806\u2807\u280B\u2819\u2838\u2830\u2820\u2830\u2838\u2819\u280B\u2807\u2806","\u280B\u2819\u281A\u2812\u2802\u2802\u2812\u2832\u2834\u2826\u2816\u2812\u2810\u2810\u2812\u2813\u280B","\u2801\u2809\u2819\u281A\u2812\u2802\u2802\u2812\u2832\u2834\u2824\u2804\u2804\u2824\u2834\u2832\u2812\u2802\u2802\u2812\u281A\u2819\u2809\u2801","\u2808\u2809\u280B\u2813\u2812\u2810\u2810\u2812\u2816\u2826\u2824\u2820\u2820\u2824\u2826\u2816\u2812\u2810\u2810\u2812\u2813\u280B\u2809\u2808","\u2801\u2801\u2809\u2819\u281A\u2812\u2802\u2802\u2812\u2832\u2834\u2824\u2804\u2804\u2824\u2820\u2820\u2824\u2826\u2816\u2812\u2810\u2810\u2812\u2813\u280B\u2809\u2808\u2808","\u2884\u2882\u2881\u2841\u2848\u2850\u2860","\u28B9\u28BA\u28BC\u28F8\u28C7\u2867\u2857\u284F","\u28FE\u28FD\u28FB\u28BF\u287F\u28DF\u28EF\u28F7","\u2801\u2802\u2804\u2840\u2880\u2820\u2810\u2808",["\u{1F311}","\u{1F312}","\u{1F313}","\u{1F314}","\u{1F315}","\u{1F31D}","\u{1F316}","\u{1F317}","\u{1F318}","\u{1F31A}"],["\u{1F55B}","\u{1F550}","\u{1F551}","\u{1F552}","\u{1F553}","\u{1F554}","\u{1F555}","\u{1F556}","\u{1F557}","\u{1F558}","\u{1F559}","\u{1F55A}"]]});var Dc=y(Lc=>{var Ic=require("readline"),Nc=0,Oc=60;function Hp(t){this.clearLine(this.stream),this.stream.write(t)}var ge=function(t){if(!(this instanceof ge))return new ge(t);typeof t=="string"?t={text:t}:t||(t={}),this.text=t.text||"",this.setSpinnerString(Nc),this.setSpinnerDelay(Oc),this.onTick=t.onTick||Hp,this.stream=t.stream||process.stdout};ge.spinners=Cc();ge.setDefaultSpinnerString=function(t){return Nc=t,this};ge.setDefaultSpinnerDelay=function(t){return Oc=t,this};ge.prototype.start=function(){if(this.stream===process.stdout&&this.stream.isTTY!==!0)return this;var t=0,e=this,r=function(){var n=e.text.indexOf("%s")>-1?e.text.replace("%s",e.chars[t]):e.chars[t]+" "+e.text;e.onTick(n),t=++t%e.chars.length};return r(),this.id=setInterval(r,this.delay),this};ge.prototype.isSpinning=function(){return this.id!==void 0};ge.prototype.setSpinnerDelay=function(t){return this.delay=t,this};ge.prototype.setSpinnerString=function(t){let e=Vp(t,this.spinners);return this.chars=Array.isArray(e)?e:e.split(""),this};ge.prototype.setSpinnerTitle=function(t){return this.text=t,this};ge.prototype.stop=function(t){return this.isSpinning===!1?this:(clearInterval(this.id),this.id=void 0,t&&this.clearLine(this.stream),this)};ge.prototype.clearLine=function(t){return Ic.clearLine(t,0),Ic.cursorTo(t,0),this};function Gp(t){return typeof t=="number"&&t%1===0}function Vp(t,e){if(!Gp(t))return t+"";var r=ge.spinners.length;return t=t>=r?0:t,t=t<0?r+t:t,ge.spinners[t]}Lc.Spinner=ge});function Wp(){try{return En.default.statSync("/.dockerenv"),!0}catch{return!1}}function jp(){try{return En.default.readFileSync("/proc/self/cgroup","utf8").includes("docker")}catch{return!1}}function yn(){return pn===void 0&&(pn=Wp()||jp()),pn}var En,pn,Rc=Ae(()=>{En=Q(require("node:fs"),1)});function st(){return gn===void 0&&(gn=Xp()||yn()),gn}var bc,gn,Xp,wn=Ae(()=>{bc=Q(require("node:fs"),1);Rc();Xp=()=>{try{return bc.default.statSync("/run/.containerenv"),!0}catch{return!1}}});var Sn,Ac,$c,Tc,Lt,Fc=Ae(()=>{Sn=Q(require("node:process"),1),Ac=Q(require("node:os"),1),$c=Q(require("node:fs"),1);wn();Tc=()=>{if(Sn.default.platform!=="linux")return!1;if(Ac.default.release().toLowerCase().includes("microsoft"))return!st();try{return $c.default.readFileSync("/proc/version","utf8").toLowerCase().includes("microsoft")?!st():!1}catch{return!1}},Lt=Sn.default.env.__IS_WSL_TEST__?Tc:Tc()});function ze(t,e,r){let n=i=>Object.defineProperty(t,e,{value:i,enumerable:!0,writable:!0});return Object.defineProperty(t,e,{configurable:!0,enumerable:!0,get(){let i=r();return n(i),i},set(i){n(i)}}),t}var qc=Ae(()=>{});async function xn(){if(Pc.default.platform!=="darwin")throw new Error("macOS only");let{stdout:t}=await zp("defaults",["read","com.apple.LaunchServices/com.apple.launchservices.secure","LSHandlers"]);return/LSHandlerRoleAll = "(?!-)(?<id>[^"]+?)";\s+?LSHandlerURLScheme = (?:http|https);/.exec(t)?.groups.id??"com.apple.Safari"}var _c,Pc,kc,zp,Uc=Ae(()=>{_c=require("node:util"),Pc=Q(require("node:process"),1),kc=require("node:child_process"),zp=(0,_c.promisify)(kc.execFile)});async function Hc(t,{humanReadableOutput:e=!0}={}){if(Bc.default.platform!=="darwin")throw new Error("macOS only");let r=e?[]:["-ss"],{stdout:n}=await Zp("osascript",["-e",t,r]);return n.trim()}var Bc,Mc,vn,Zp,Gc=Ae(()=>{Bc=Q(require("node:process"),1),Mc=require("node:util"),vn=require("node:child_process"),Zp=(0,Mc.promisify)(vn.execFile)});async function Cn(t){return Hc(`tell application "Finder" to set app_path to application file id "${t}" as string
8
- tell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`)}var Vc=Ae(()=>{Gc()});async function In(t=Yp){let{stdout:e}=await t("reg",["QUERY"," HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\http\\UserChoice","/v","ProgId"]),r=/ProgId\s*REG_SZ\s*(?<id>\S+)/.exec(e);if(!r)throw new ur(`Cannot find Windows browser in stdout: ${JSON.stringify(e)}`);let{id:n}=r.groups,i=Kp[n];if(!i)throw new ur(`Unknown browser ID: ${n}`);return i}var Wc,jc,Yp,Kp,ur,Xc=Ae(()=>{Wc=require("node:util"),jc=require("node:child_process"),Yp=(0,Wc.promisify)(jc.execFile),Kp={AppXq0fevzme2pys62n3e0fbqa7peapykr8v:{name:"Edge",id:"com.microsoft.edge.old"},MSEdgeDHTML:{name:"Edge",id:"com.microsoft.edge"},MSEdgeHTM:{name:"Edge",id:"com.microsoft.edge"},"IE.HTTP":{name:"Internet Explorer",id:"com.microsoft.ie"},FirefoxURL:{name:"Firefox",id:"org.mozilla.firefox"},ChromeHTML:{name:"Chrome",id:"com.google.chrome"},BraveHTML:{name:"Brave",id:"com.brave.Browser"},BraveBHTML:{name:"Brave Beta",id:"com.brave.Browser.beta"},BraveSSHTM:{name:"Brave Nightly",id:"com.brave.Browser.nightly"}},ur=class extends Error{}});async function Nn(){if(lr.default.platform==="darwin"){let t=await xn();return{name:await Cn(t),id:t}}if(lr.default.platform==="linux"){let{stdout:t}=await Jp("xdg-mime",["query","default","x-scheme-handler/http"]),e=t.trim();return{name:Qp(e.replace(/.desktop$/,"").replace("-"," ")),id:e}}if(lr.default.platform==="win32")return In();throw new Error("Only macOS, Linux, and Windows are supported")}var zc,lr,Zc,Jp,Qp,Yc=Ae(()=>{zc=require("node:util"),lr=Q(require("node:process"),1),Zc=require("node:child_process");Uc();Vc();Xc();Jp=(0,zc.promisify)(Zc.execFile),Qp=t=>t.toLowerCase().replaceAll(/(?:^|\s|-)\S/g,e=>e.toUpperCase())});var iu={};nl(iu,{apps:()=>Ye,default:()=>nE,openApp:()=>rE});function eu(t){if(typeof t=="string"||Array.isArray(t))return t;let{[Jc]:e}=t;if(!e)throw new Error(`${Jc} is not supported`);return e}function On({[ot]:t},{wsl:e}){if(e&&Lt)return eu(e);if(!t)throw new Error(`${ot} is not supported`);return eu(t)}var Dt,tu,ru,nu,Ze,Kc,ot,Jc,eE,Qc,Rt,tE,rE,Ye,nE,su=Ae(()=>{Dt=Q(require("node:process"),1),tu=require("node:buffer"),ru=Q(require("node:path"),1),nu=Q(require("node:child_process"),1),Ze=Q(require("node:fs/promises"),1);Fc();qc();Yc();wn();Kc=ru.default.join(__dirname,"xdg-open"),{platform:ot,arch:Jc}=Dt.default,eE=(()=>{let t="/mnt/",e;return async function(){if(e)return e;let r="/etc/wsl.conf",n=!1;try{await Ze.default.access(r,Ze.constants.F_OK),n=!0}catch{}if(!n)return t;let i=await Ze.default.readFile(r,{encoding:"utf8"}),s=/(?<!#.*)root\s*=\s*(?<mountPoint>.*)/g.exec(i);return s?(e=s.groups.mountPoint.trim(),e=e.endsWith("/")?e:`${e}/`,e):t}})(),Qc=async(t,e)=>{let r;for(let n of t)try{return await e(n)}catch(i){r=i}throw r},Rt=async t=>{if(t={wait:!1,background:!1,newInstance:!1,allowNonzeroExitCode:!1,...t},Array.isArray(t.app))return Qc(t.app,a=>Rt({...t,app:a}));let{name:e,arguments:r=[]}=t.app??{};if(r=[...r],Array.isArray(e))return Qc(e,a=>Rt({...t,app:{name:a,arguments:r}}));if(e==="browser"||e==="browserPrivate"){let a={"com.google.chrome":"chrome","google-chrome.desktop":"chrome","org.mozilla.firefox":"firefox","firefox.desktop":"firefox","com.microsoft.msedge":"edge","com.microsoft.edge":"edge","microsoft-edge.desktop":"edge"},c={chrome:"--incognito",firefox:"--private-window",edge:"--inPrivate"},u=await Nn();if(u.id in a){let l=a[u.id];return e==="browserPrivate"&&r.push(c[l]),Rt({...t,app:{name:Ye[l],arguments:r}})}throw new Error(`${u.name} is not supported as a default browser`)}let n,i=[],s={};if(ot==="darwin")n="open",t.wait&&i.push("--wait-apps"),t.background&&i.push("--background"),t.newInstance&&i.push("--new"),e&&i.push("-a",e);else if(ot==="win32"||Lt&&!st()&&!e){let a=await eE();n=Lt?`${a}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`:`${Dt.default.env.SYSTEMROOT||Dt.default.env.windir||"C:\\Windows"}\\System32\\WindowsPowerShell\\v1.0\\powershell`,i.push("-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-EncodedCommand"),Lt||(s.windowsVerbatimArguments=!0);let c=["Start"];t.wait&&c.push("-Wait"),e?(c.push(`"\`"${e}\`""`),t.target&&r.push(t.target)):t.target&&c.push(`"${t.target}"`),r.length>0&&(r=r.map(u=>`"\`"${u}\`""`),c.push("-ArgumentList",r.join(","))),t.target=tu.Buffer.from(c.join(" "),"utf16le").toString("base64")}else{if(e)n=e;else{let a=!__dirname||__dirname==="/",c=!1;try{await Ze.default.access(Kc,Ze.constants.X_OK),c=!0}catch{}n=Dt.default.versions.electron??(ot==="android"||a||!c)?"xdg-open":Kc}r.length>0&&i.push(...r),t.wait||(s.stdio="ignore",s.detached=!0)}ot==="darwin"&&r.length>0&&i.push("--args",...r),t.target&&i.push(t.target);let o=nu.default.spawn(n,i,s);return t.wait?new Promise((a,c)=>{o.once("error",c),o.once("close",u=>{if(!t.allowNonzeroExitCode&&u>0){c(new Error(`Exited with code ${u}`));return}a(o)})}):(o.unref(),o)},tE=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a `target`");return Rt({...e,target:t})},rE=(t,e)=>{if(typeof t!="string"&&!Array.isArray(t))throw new TypeError("Expected a valid `name`");let{arguments:r=[]}=e??{};if(r!=null&&!Array.isArray(r))throw new TypeError("Expected `appArguments` as Array type");return Rt({...e,app:{name:t,arguments:r}})};Ye={};ze(Ye,"chrome",()=>On({darwin:"google chrome",win32:"chrome",linux:["google-chrome","google-chrome-stable","chromium"]},{wsl:{ia32:"/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe",x64:["/mnt/c/Program Files/Google/Chrome/Application/chrome.exe","/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe"]}}));ze(Ye,"firefox",()=>On({darwin:"firefox",win32:"C:\\Program Files\\Mozilla Firefox\\firefox.exe",linux:"firefox"},{wsl:"/mnt/c/Program Files/Mozilla Firefox/firefox.exe"}));ze(Ye,"edge",()=>On({darwin:"microsoft edge",win32:"msedge",linux:["microsoft-edge","microsoft-edge-dev"]},{wsl:"/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"}));ze(Ye,"browser",()=>"browser");ze(Ye,"browserPrivate",()=>"browserPrivate");nE=tE});var fr=y(ou=>{ou.require=function(){var t=require("fs");if(process.versions.electron)try{t=require("original-fs")}catch{}return t}});var Ln=y((_g,au)=>{au.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,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,FLG_ENC:0,FLG_COMP1:1,FLG_COMP2:2,FLG_DESC:4,FLG_ENH:8,FLG_STR:16,FLG_LNG:1024,FLG_MSK:4096,FILE:0,BUFFER:1,NONE:2,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 Dn=y((Pg,cu)=>{cu.exports={INVALID_LOC:"Invalid LOC header (bad signature)",INVALID_CEN:"Invalid CEN header (bad signature)",INVALID_END:"Invalid END header (bad signature)",NO_DATA:"Nothing to decompress",BAD_CRC:"CRC32 checksum failed",FILE_IN_THE_WAY:"There is a file in the way: %s",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",NO_ZIP:"No zip file was loaded",NO_ENTRY:"Entry doesn't exist",DIRECTORY_CONTENT_ERROR:"A directory cannot have content",FILE_NOT_FOUND:"File not found: %s",NOT_IMPLEMENTED:"Not implemented",INVALID_FILENAME:"Invalid filename",INVALID_FORMAT:"Invalid or unsupported zip format. No END header found"}});var lu=y((kg,uu)=>{var U=fr().require(),at=require("path");U.existsSync=U.existsSync||at.existsSync;uu.exports=function(){var t=[],e=Ln(),r=Dn(),n=at.sep;function i(o){var a=o.split(n)[0];o.split(n).forEach(function(c){if(!(!c||c.substr(-1,1)===":")){a+=n+c;var u;try{u=U.statSync(a)}catch{U.mkdirSync(a)}if(u&&u.isFile())throw r.FILE_IN_THE_WAY.replace("%s",a)}})}function s(o,a,c){typeof a=="boolean"&&(c=a,a=void 0);var u=[];return U.readdirSync(o).forEach(function(l){var f=at.join(o,l);U.statSync(f).isDirectory()&&c&&(u=u.concat(s(f,a,c))),(!a||a.test(f))&&u.push(at.normalize(f)+(U.statSync(f).isDirectory()?n:""))}),u}return{makeDir:function(o){i(o)},crc32:function(o){typeof o=="string"&&(o=Buffer.alloc(o.length,o));var a=Buffer.alloc(4);if(!t.length)for(var c=0;c<256;c++){for(var u=c,l=8;--l>=0;)u&1?u=3988292384^u>>>1:u=u>>>1;u<0&&(a.writeInt32LE(u,0),u=a.readUInt32LE(0)),t[c]=u}for(var f=0,m=0,d=o.length,h=~f;--d>=0;)h=t[(h^o[m++])&255]^h>>>8;return f=~h,a.writeInt32LE(f&4294967295,0),a.readUInt32LE(0)},methodToString:function(o){switch(o){case e.STORED:return"STORED ("+o+")";case e.DEFLATED:return"DEFLATED ("+o+")";default:return"UNSUPPORTED ("+o+")"}},writeFileTo:function(o,a,c,u){if(U.existsSync(o)){if(!c)return!1;var l=U.statSync(o);if(l.isDirectory())return!1}var f=at.dirname(o);U.existsSync(f)||i(f);var m;try{m=U.openSync(o,"w",438)}catch{U.chmodSync(o,438),m=U.openSync(o,"w",438)}if(m)try{U.writeSync(m,a,0,a.length,0)}catch(d){throw d}finally{U.closeSync(m)}return U.chmodSync(o,u||438),!0},writeFileToAsync:function(o,a,c,u,l){typeof u=="function"&&(l=u,u=void 0),U.exists(o,function(f){if(f&&!c)return l(!1);U.stat(o,function(m,d){if(f&&d.isDirectory())return l(!1);var h=at.dirname(o);U.exists(h,function(E){E||i(h),U.open(o,"w",438,function(w,p){w?U.chmod(o,438,function(){U.open(o,"w",438,function(S,A){U.write(A,a,0,a.length,0,function(){U.close(A,function(){U.chmod(o,u||438,function(){l(!0)})})})})}):p?U.write(p,a,0,a.length,0,function(){U.close(p,function(){U.chmod(o,u||438,function(){l(!0)})})}):U.chmod(o,u||438,function(){l(!0)})})})})})},findFiles:function(o){return s(o,!0)},getAttributes:function(o){},setAttributes:function(o){},toBuffer:function(o){return Buffer.isBuffer(o)?o:o.length===0?Buffer.alloc(0):Buffer.alloc(o.length,o,"utf8")},Constants:e,Errors:r}}()});var du=y((Ug,hu)=>{var hr=fr().require(),fu=require("path");hr.existsSync=hr.existsSync||fu.existsSync;hu.exports=function(t){var e=t||"",r=0,n=s(),i=null;function s(){return{directory:!1,readonly:!1,hidden:!1,executable:!1,mtime:0,atime:0}}return e&&hr.existsSync(e)?(i=hr.statSync(e),n.directory=i.isDirectory(),n.mtime=i.mtime,n.atime=i.atime,n.executable=!!(1&parseInt((i.mode&parseInt("777",8)).toString(8)[0])),n.readonly=!!(2&parseInt((i.mode&parseInt("777",8)).toString(8)[0])),n.hidden=fu.basename(e)[0]==="."):console.warn("Invalid path: "+e),{get directory(){return n.directory},get readOnly(){return n.readonly},get hidden(){return n.hidden},get mtime(){return n.mtime},get atime(){return n.atime},get executable(){return n.executable},decodeAttributes:function(o){},encodeAttributes:function(o){},toString:function(){return`{
9
- "path" : "`+e+`,
10
- "isDirectory" : `+n.directory+`,
11
- "isReadOnly" : `+n.readonly+`,
12
- "isHidden" : `+n.hidden+`,
13
- "isExecutable" : `+n.executable+`,
14
- "mTime" : `+n.mtime+`
15
- "aTime" : `+n.atime+`
16
- }`}}}});var ut=y((Bg,ct)=>{ct.exports=lu();ct.exports.FileSystem=fr();ct.exports.Constants=Ln();ct.exports.Errors=Dn();ct.exports.FileAttr=du()});var pu=y((Mg,mu)=>{var dr=ut(),C=dr.Constants;mu.exports=function(){var t=10,e=10,r=0,n=0,i=0,s=0,o=0,a=0,c=0,u=0,l=0,f=0,m=0,d=0,h=0,E={};function w(p){p=new Date(p),i=(p.getFullYear()-1980&127)<<25|p.getMonth()+1<<21|p.getDate()<<16|p.getHours()<<11|p.getMinutes()<<5|p.getSeconds()>>1}return w(+new Date),{get made(){return t},set made(p){t=p},get version(){return e},set version(p){e=p},get flags(){return r},set flags(p){r=p},get method(){return n},set method(p){n=p},get time(){return new Date((i>>25&127)+1980,(i>>21&15)-1,i>>16&31,i>>11&31,i>>5&63,(i&31)<<1)},set time(p){w(p)},get crc(){return s},set crc(p){s=p},get compressedSize(){return o},set compressedSize(p){o=p},get size(){return a},set size(p){a=p},get fileNameLength(){return c},set fileNameLength(p){c=p},get extraLength(){return u},set extraLength(p){u=p},get commentLength(){return l},set commentLength(p){l=p},get diskNumStart(){return f},set diskNumStart(p){f=p},get inAttr(){return m},set inAttr(p){m=p},get attr(){return d},set attr(p){d=p},get offset(){return h},set offset(p){h=p},get encripted(){return(r&1)===1},get entryHeaderSize(){return C.CENHDR+c+u+l},get realDataOffset(){return h+C.LOCHDR+E.fnameLen+E.extraLen},get dataHeader(){return E},loadDataHeaderFromBinary:function(p){var S=p.slice(h,h+C.LOCHDR);if(S.readUInt32LE(0)!==C.LOCSIG)throw dr.Errors.INVALID_LOC;E={version:S.readUInt16LE(C.LOCVER),flags:S.readUInt16LE(C.LOCFLG),method:S.readUInt16LE(C.LOCHOW),time:S.readUInt32LE(C.LOCTIM),crc:S.readUInt32LE(C.LOCCRC),compressedSize:S.readUInt32LE(C.LOCSIZ),size:S.readUInt32LE(C.LOCLEN),fnameLen:S.readUInt16LE(C.LOCNAM),extraLen:S.readUInt16LE(C.LOCEXT)}},loadFromBinary:function(p){if(p.length!==C.CENHDR||p.readUInt32LE(0)!==C.CENSIG)throw dr.Errors.INVALID_CEN;t=p.readUInt16LE(C.CENVEM),e=p.readUInt16LE(C.CENVER),r=p.readUInt16LE(C.CENFLG),n=p.readUInt16LE(C.CENHOW),i=p.readUInt32LE(C.CENTIM),s=p.readUInt32LE(C.CENCRC),o=p.readUInt32LE(C.CENSIZ),a=p.readUInt32LE(C.CENLEN),c=p.readUInt16LE(C.CENNAM),u=p.readUInt16LE(C.CENEXT),l=p.readUInt16LE(C.CENCOM),f=p.readUInt16LE(C.CENDSK),m=p.readUInt16LE(C.CENATT),d=p.readUInt32LE(C.CENATX),h=p.readUInt32LE(C.CENOFF)},dataHeaderToBinary:function(){var p=Buffer.alloc(C.LOCHDR);return p.writeUInt32LE(C.LOCSIG,0),p.writeUInt16LE(e,C.LOCVER),p.writeUInt16LE(r,C.LOCFLG),p.writeUInt16LE(n,C.LOCHOW),p.writeUInt32LE(i,C.LOCTIM),p.writeUInt32LE(s,C.LOCCRC),p.writeUInt32LE(o,C.LOCSIZ),p.writeUInt32LE(a,C.LOCLEN),p.writeUInt16LE(c,C.LOCNAM),p.writeUInt16LE(u,C.LOCEXT),p},entryHeaderToBinary:function(){var p=Buffer.alloc(C.CENHDR+c+u+l);return p.writeUInt32LE(C.CENSIG,0),p.writeUInt16LE(t,C.CENVEM),p.writeUInt16LE(e,C.CENVER),p.writeUInt16LE(r,C.CENFLG),p.writeUInt16LE(n,C.CENHOW),p.writeUInt32LE(i,C.CENTIM),p.writeUInt32LE(s,C.CENCRC),p.writeUInt32LE(o,C.CENSIZ),p.writeUInt32LE(a,C.CENLEN),p.writeUInt16LE(c,C.CENNAM),p.writeUInt16LE(u,C.CENEXT),p.writeUInt16LE(l,C.CENCOM),p.writeUInt16LE(f,C.CENDSK),p.writeUInt16LE(m,C.CENATT),p.writeUInt32LE(d,C.CENATX),p.writeUInt32LE(h,C.CENOFF),p.fill(0,C.CENHDR),p},toString:function(){return`{
17
- "made" : `+t+`,
18
- "version" : `+e+`,
19
- "flags" : `+r+`,
20
- "method" : `+dr.methodToString(n)+`,
21
- "time" : `+this.time+`,
22
- "crc" : 0x`+s.toString(16).toUpperCase()+`,
23
- "compressedSize" : `+o+` bytes,
24
- "size" : `+a+` bytes,
25
- "fileNameLength" : `+c+`,
26
- "extraLength" : `+u+` bytes,
27
- "commentLength" : `+l+` bytes,
28
- "diskNumStart" : `+f+`,
29
- "inAttr" : `+m+`,
30
- "attr" : `+d+`,
31
- "offset" : `+h+`,
32
- "entryHeaderSize" : `+(C.CENHDR+c+u+l)+` bytes
33
- }`}}}});var gu=y((Hg,yu)=>{var Eu=ut(),le=Eu.Constants;yu.exports=function(){var t=0,e=0,r=0,n=0,i=0;return{get diskEntries(){return t},set diskEntries(s){t=e=s},get totalEntries(){return e},set totalEntries(s){e=t=s},get size(){return r},set size(s){r=s},get offset(){return n},set offset(s){n=s},get commentLength(){return i},set commentLength(s){i=s},get mainHeaderSize(){return le.ENDHDR+i},loadFromBinary:function(s){if(s.length!==le.ENDHDR||s.readUInt32LE(0)!==le.ENDSIG)throw Eu.Errors.INVALID_END;t=s.readUInt16LE(le.ENDSUB),e=s.readUInt16LE(le.ENDTOT),r=s.readUInt32LE(le.ENDSIZ),n=s.readUInt32LE(le.ENDOFF),i=s.readUInt16LE(le.ENDCOM)},toBinary:function(){var s=Buffer.alloc(le.ENDHDR+i);return s.writeUInt32LE(le.ENDSIG,0),s.writeUInt32LE(0,4),s.writeUInt16LE(t,le.ENDSUB),s.writeUInt16LE(e,le.ENDTOT),s.writeUInt32LE(r,le.ENDSIZ),s.writeUInt32LE(n,le.ENDOFF),s.writeUInt16LE(i,le.ENDCOM),s.fill(" ",le.ENDHDR),s},toString:function(){return`{
34
- "diskEntries" : `+t+`,
35
- "totalEntries" : `+e+`,
36
- "size" : `+r+` bytes,
37
- "offset" : 0x`+n.toString(16).toUpperCase()+`,
38
- "commentLength" : 0x`+i+`
39
- }`}}}});var bn=y(Rn=>{Rn.EntryHeader=pu();Rn.MainHeader=gu()});var wu=y(()=>{});var vu=y((jg,xu)=>{var Su=require("buffer").Buffer;function iE(t){var e=32768,r=Su.alloc(65536),n=0,i=null,s,o,a=0,c=0,u=-1,l=!1,f=0,m=0,d,h,E,w,p=0,S=[0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535],A=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],V=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,99,99],Ce=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577],ee=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],fe=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];function Ie(I,N,L,g,q,$){this.status=0,this.r=null,this.maxbit=0;var ne,Ue,P,K=[],ie=[],j=[],Ne=[],J={extra:0,bitcnt:0,lbase:0,next:null};P=this.r=null;for(var k=0;k<17;k++)ie[k]=0,j[k]=0,K[k]=0;for(k=0;k<288;k++)Ne[k]=0;ne=N>256?I[256]:16;for(var xe=-1;++xe<N;)ie[I[xe]]++;if(ie[0]!==N){for(var T=1;T<=16&&ie[T]===0;T++);var qe=T;for(k=16;k!==0&&ie[k]===0;k--);var $t=k;$<T&&($=T);for(var lt=1<<T;T<k;T++,lt<<=1)if((lt-=ie[T])<0){this.status=2,this.maxbit=$;return}if((lt-=ie[k])<0){this.status=2,this.maxbit=$;return}ie[k]+=lt,K[1]=T=0,xe=1;for(var Ft=2;--k>0;)K[Ft++]=T+=ie[xe++];xe=0,k=0;do(T=I[xe++])&&(Ne[K[T]++]=k);while(++k<N);N=K[$t],K[0]=k=0,xe=0;for(var oe=-1,Se=j[0]=0,Te=null,Ve=0,ft=[];qe<=$t;qe++)for(var xr=ie[qe];xr-- >0;){for(;qe>Se+j[1+oe];){if(Se+=j[1+oe],oe++,Ve=(Ve=$t-Se)>$?$:Ve,(Ue=1<<(T=qe-Se))>xr+1)for(Ue-=xr+1,Ft=qe;++T<Ve&&!((Ue<<=1)<=ie[++Ft]);)Ue-=ie[Ft];for(Se+T>ne&&Se<ne&&(T=ne-Se),Ve=1<<T,j[1+oe]=T,Te=[];Te.length<Ve;)Te.push({extra:0,bitcnt:0,lbase:0,next:null});P==null?P=this.r={next:null,list:null}:P=P.next={next:null,list:null},P.next=null,P.list=Te,ft[oe]=Te,oe>0&&(K[oe]=k,J.bitcnt=j[oe],J.extra=16+T,J.next=Te,T=(k&(1<<Se)-1)>>Se-j[oe],ft[oe-1][T].extra=J.extra,ft[oe-1][T].bitcnt=J.bitcnt,ft[oe-1][T].lbase=J.lbase,ft[oe-1][T].next=J.next)}for(J.bitcnt=qe-Se,xe>=N?J.extra=99:Ne[xe]<L?(J.extra=Ne[xe]<256?16:15,J.lbase=Ne[xe++]):(J.extra=q[Ne[xe]-L],J.lbase=g[Ne[xe++]-L]),Ue=1<<qe-Se,T=k>>Se;T<Ve;T+=Ue)Te[T].extra=J.extra,Te[T].bitcnt=J.bitcnt,Te[T].lbase=J.lbase,Te[T].next=J.next;for(T=1<<qe-1;k&T;T>>=1)k^=T;for(k^=T;(k&(1<<Se)-1)!==K[oe];)Se-=j[oe],oe--}this.maxbit=j[1],this.status=lt!==0&&$t!==1?1:0}}function O(I){for(;c<I;)a|=t[p++]<<c,c+=8;return a}function b(I){return c-=I,a>>=I}function D(I){for(;c<I;)a|=t[p++]<<c,c+=8;var N=a&S[I];return a>>=I,c-=I,N}function B(I,N,L){var g,q;if(L===0)return 0;for(var $=0;;){for(q=d.list[O(E)&S[E]],g=q.extra;g>16;){if(g===99)return-1;b(q.bitcnt),g-=16,q=q.next[O(g)&S[g]],g=q.extra}if(b(q.bitcnt),g===16){if(n&=e-1,I[N+$++]=r[n++]=q.lbase,$===L)return L;continue}if(g===15)break;for(f=q.lbase+D(g),q=h.list[O(w)&S[w]],g=q.extra;g>16;){if(g===99)return-1;b(q.bitcnt),g-=16,q=q.next[O(g)&S[g]],g=q.extra}for(b(q.bitcnt),m=n-q.lbase-D(g);f>0&&$<L;)f--,m&=e-1,n&=e-1,I[N+$++]=r[n++]=r[m++];if($===L)return L}return u=-1,$}function G(I,N,L){b(c&7);var g=D(16);if(g!==(~D(16)&65535))return-1;for(f=g,g=0;f>0&&g<L;)f--,n&=e-1,I[N+g++]=r[n++]=D(8);return f===0&&(u=-1),g}function W(I,N,L){var g=0;if(i==null){for(var q=[],$=0;$<144;$++)q[$]=8;for(;$<256;$++)q[$]=9;for(;$<280;$++)q[$]=7;for(;$<288;$++)q[$]=8;o=7;var ne=new Ie(q,288,257,A,V,o);if(ne.status!==0)return-1;for(i=ne.r,o=ne.maxbit,$=0;$<30;$++)q[$]=5;if(g=5,ne=new Ie(q,30,0,Ce,ee,g),ne.status>1)return i=null,-1;s=ne.r,g=ne.maxbit}return d=i,h=s,E=o,w=g,B(I,N,L)}function _(I,N,L){for(var g=new Array(572),q=0;q<572;q++)g[q]=0;var $=257+D(5),ne=1+D(5),Ue=4+D(4);if($>286||ne>30)return-1;for(var P=0;P<Ue;P++)g[fe[P]]=D(3);for(;P<19;P++)g[fe[P]]=0;E=7;var K=new Ie(g,19,19,null,null,E);if(K.status!==0)return-1;d=K.r,E=K.maxbit;for(var ie=$+ne,j=0,Ne=0;j<ie;){var J=d.list[O(E)&S[E]];if(P=J.bitcnt,b(P),P=J.lbase,P<16)g[j++]=Ne=P;else if(P===16){if(P=3+D(2),j+P>ie)return-1;for(;P-- >0;)g[j++]=Ne}else if(P===17){if(P=3+D(3),j+P>ie)return-1;for(;P-- >0;)g[j++]=0;Ne=0}else{if(P=11+D(7),j+P>ie)return-1;for(;P-- >0;)g[j++]=0;Ne=0}}if(E=9,K=new Ie(g,$,257,A,V,E),E===0&&(K.status=1),K.status!==0)return-1;for(d=K.r,E=K.maxbit,j=0;j<ne;j++)g[j]=g[j+$];return w=6,K=new Ie(g,ne,0,Ce,ee,w),h=K.r,w=K.maxbit,w===0&&$>257||K.status!==0?-1:B(I,N,L)}return{inflate:function(I){d=null;for(var N=I.length,L=0,g;L<N;){if(l&&u===-1)return;if(f>0){if(u!==0)for(;f>0&&L<N;)f--,m&=e-1,n&=e-1,I[L++]=r[n++]=r[m++];else{for(;f>0&&L<N;)f--,n&=e-1,I[L++]=r[n++]=D(8);f===0&&(u=-1)}if(L===N)return}if(u===-1){if(l)break;l=D(1)!==0,u=D(2),d=null,f=0}switch(u){case 0:g=G(I,L,N-L);break;case 1:g=d!=null?B(I,L,N-L):W(I,L,N-L);break;case 2:g=d!=null?B(I,L,N-L):_(I,L,N-L);break;default:g=-1;break}if(g===-1)return;L+=g}}}}xu.exports=function(t){var e=require("zlib");return{inflateAsync:function(r){var n=e.createInflateRaw(),i=[],s=0;n.on("data",function(o){i.push(o),s+=o.length}),n.on("end",function(){var o=Su.alloc(s),a=0;o.fill(0);for(var c=0;c<i.length;c++){var u=i[c];u.copy(o,a),a+=u.length}r&&r(o)}),n.end(t)},inflate:function(r){var n={x:new iE(t)};n.x.inflate(r),delete n.x}}}});var Cu=y(Tn=>{Tn.Deflater=wu();Tn.Inflater=vu()});var An=y((zg,Nu)=>{var z=ut(),sE=bn(),ve=z.Constants,Iu=Cu();Nu.exports=function(t){var e=new sE.EntryHeader,r=Buffer.alloc(0),n=Buffer.alloc(0),i=!1,s=null,o=Buffer.alloc(0);function a(){return!t||!Buffer.isBuffer(t)?Buffer.alloc(0):(e.loadDataHeaderFromBinary(t),t.slice(e.realDataOffset,e.realDataOffset+e.compressedSize))}function c(h){return!((e.flags&8)!==8&&z.crc32(h)!==e.crc)}function u(h,E,w){if(typeof E>"u"&&typeof h=="string"&&(w=h,h=void 0),i)return h&&E&&E(Buffer.alloc(0),z.Errors.DIRECTORY_CONTENT_ERROR),Buffer.alloc(0);var p=a();if(p.length===0)return h&&E&&E(p,z.Errors.NO_DATA),p;var S=Buffer.alloc(e.size);switch(e.method){case z.Constants.STORED:return p.copy(S),c(S)?(h&&E&&E(S),S):(h&&E&&E(S,z.Errors.BAD_CRC),z.Errors.BAD_CRC);case z.Constants.DEFLATED:var A=new Iu.Inflater(p);if(h)A.inflateAsync(function(V){V.copy(S,0),c(S)?E&&E(S):E&&E(S,z.Errors.BAD_CRC)});else return A.inflate(S),c(S)||console.warn(z.Errors.BAD_CRC+" "+r.toString()),S;break;default:return h&&E&&E(Buffer.alloc(0),z.Errors.UNKNOWN_METHOD),z.Errors.UNKNOWN_METHOD}}function l(h,E){if((!s||!s.length)&&Buffer.isBuffer(t))return h&&E&&E(a()),a();if(s.length&&!i){var w;switch(e.method){case z.Constants.STORED:return e.compressedSize=e.size,w=Buffer.alloc(s.length),s.copy(w),h&&E&&E(w),w;default:case z.Constants.DEFLATED:var p=new Iu.Deflater(s);if(h)p.deflateAsync(function(A){w=Buffer.alloc(A.length),e.compressedSize=A.length,A.copy(w),E&&E(w)});else{var S=p.deflate();return e.compressedSize=S.length,S}p=null;break}}else if(h&&E)E(Buffer.alloc(0));else return Buffer.alloc(0)}function f(h,E){return(h.readUInt32LE(E+4)<<4)+h.readUInt32LE(E)}function m(h){for(var E=0,w,p,S;E<h.length;)w=h.readUInt16LE(E),E+=2,p=h.readUInt16LE(E),E+=2,S=h.slice(E,E+p),E+=p,ve.ID_ZIP64===w&&d(S)}function d(h){var E,w,p,S;h.length>=ve.EF_ZIP64_SCOMP&&(E=f(h,ve.EF_ZIP64_SUNCOMP),e.size===ve.EF_ZIP64_OR_32&&(e.size=E)),h.length>=ve.EF_ZIP64_RHO&&(w=f(h,ve.EF_ZIP64_SCOMP),e.compressedSize===ve.EF_ZIP64_OR_32&&(e.compressedSize=w)),h.length>=ve.EF_ZIP64_DSN&&(p=f(h,ve.EF_ZIP64_RHO),e.offset===ve.EF_ZIP64_OR_32&&(e.offset=p)),h.length>=ve.EF_ZIP64_DSN+4&&(S=h.readUInt32LE(ve.EF_ZIP64_DSN),e.diskNumStart===ve.EF_ZIP64_OR_16&&(e.diskNumStart=S))}return{get entryName(){return r.toString()},get rawEntryName(){return r},set entryName(h){r=z.toBuffer(h);var E=r[r.length-1];i=E===47||E===92,e.fileNameLength=r.length},get extra(){return o},set extra(h){o=h,e.extraLength=h.length,m(h)},get comment(){return n.toString()},set comment(h){n=z.toBuffer(h),e.commentLength=n.length},get name(){var h=r.toString();return i?h.substr(h.length-1).split("/").pop():h.split("/").pop()},get isDirectory(){return i},getCompressedData:function(){return l(!1,null)},getCompressedDataAsync:function(h){l(!0,h)},setData:function(h){s=z.toBuffer(h),!i&&s.length?(e.size=s.length,e.method=z.Constants.STORED,e.crc=z.crc32(h),e.changed=!0):e.method=z.Constants.STORED},getData:function(h){return e.changed?s:u(!1,null,h)},getDataAsync:function(h,E){e.changed?h(s):u(!0,h,E)},set attr(h){e.attr=h},get attr(){return e.attr},set header(h){e.loadFromBinary(h)},get header(){return e},packHeader:function(){var h=e.entryHeaderToBinary();return r.copy(h,z.Constants.CENHDR),e.extraLength&&o.copy(h,z.Constants.CENHDR+r.length),e.commentLength&&n.copy(h,z.Constants.CENHDR+r.length+e.extraLength,n.length),h},toString:function(){return`{
40
- "entryName" : "`+r.toString()+`",
41
- "name" : "`+(i?r.toString().replace(/\/$/,"").split("/").pop():r.toString().split("/").pop())+`",
42
- "comment" : "`+n.toString()+`",
43
- "isDirectory" : `+i+`,
44
- "header" : `+e.toString().replace(/\t/mg," ").replace(/}/mg," }")+`,
45
- "compressedData" : <`+(t&&t.length+" bytes buffer"||"null")+`>
46
- "data" : <`+(s&&s.length+" bytes buffer"||"null")+`>
47
- }`}}}});var Lu=y((Zg,Ou)=>{var oE=An(),aE=bn(),Re=ut();Ou.exports=function(t,e){var r=[],n={},i=Buffer.alloc(0),s="",o=Re.FileSystem.require(),a=null,c=new aE.MainHeader;e===Re.Constants.FILE?(s=t,a=o.readFileSync(s),l()):e===Re.Constants.BUFFER&&(a=t,l());function u(){n={},r=new Array(c.diskEntries);for(var f=c.offset,m=0;m<r.length;m++){var d=f,h=new oE(a);h.header=a.slice(d,d+=Re.Constants.CENHDR),h.entryName=a.slice(d,d+=h.header.fileNameLength),h.header.extraLength&&(h.extra=a.slice(d,d+=h.header.extraLength)),h.header.commentLength&&(h.comment=a.slice(d,d+h.header.commentLength)),f+=h.header.entryHeaderSize,r[m]=h,n[h.entryName]=h}}function l(){var f=a.length-Re.Constants.ENDHDR,m=Math.max(0,f-65535),d=-1;for(f;f>=m;f--)if(a[f]===80&&a.readUInt32LE(f)===Re.Constants.ENDSIG){d=f;break}if(!~d)throw Re.Errors.INVALID_FORMAT;c.loadFromBinary(a.slice(d,d+Re.Constants.ENDHDR)),c.commentLength&&(i=a.slice(d+Re.Constants.ENDHDR)),u()}return{get entries(){return r},get comment(){return i.toString()},set comment(f){c.commentLength=f.length,i=f},getEntry:function(f){return n[f]||null},setEntry:function(f){r.push(f),n[f.entryName]=f,c.totalEntries=r.length},deleteEntry:function(f){var m=n[f];if(m&&m.isDirectory){var d=this;this.getEntryChildren(m).forEach(function(h){h.entryName!==f&&d.deleteEntry(h.entryName)})}r.splice(r.indexOf(m),1),delete n[f],c.totalEntries=r.length},getEntryChildren:function(f){if(f.isDirectory){var m=[],d=f.entryName,h=d.length;return r.forEach(function(E){E.entryName.substr(0,h)===d&&m.push(E)}),m}return[]},compressToBuffer:function(){r.length>1&&r.sort(function(p,S){var A=p.entryName.toLowerCase(),V=S.entryName.toLowerCase();return A<V?-1:A>V?1:0});var f=0,m=[],d=[],h=0;c.size=0,c.offset=0,r.forEach(function(p){var S=p.getCompressedData();p.header.offset=h;var A=p.header.dataHeaderToBinary(),V=p.entryName+p.extra.toString(),Ce=Buffer.alloc(V.length,V),ee=A.length+Ce.length+S.length;h+=ee,m.push(A),m.push(Ce),m.push(S);var fe=p.packHeader();d.push(fe),c.size+=fe.length,f+=ee+fe.length}),f+=c.mainHeaderSize,c.offset=h,h=0;var E=Buffer.alloc(f);m.forEach(function(p){p.copy(E,h),h+=p.length}),d.forEach(function(p){p.copy(E,h),h+=p.length});var w=c.toBinary();return i&&i.copy(w,Re.Constants.ENDHDR),w.copy(E,h),E},toAsyncBuffer:function(f,m,d,h){r.length>1&&r.sort(function(V,Ce){var ee=V.entryName.toLowerCase(),fe=Ce.entryName.toLowerCase();return ee>fe?-1:ee<fe?1:0});var E=0,w=[],p=[],S=0;c.size=0,c.offset=0;var A=function(V){var Ce=arguments.callee;if(V.length){var ee=V.pop(),fe=ee.entryName+ee.extra.toString();d&&d(fe),ee.getCompressedDataAsync(function(Ie){h&&h(fe),ee.header.offset=S;var O=ee.header.dataHeaderToBinary(),b=Buffer.alloc(fe),D=O.length+b.length+Ie.length;S+=D,w.push(O),w.push(b),w.push(Ie);var B=ee.packHeader();if(p.push(B),c.size+=B.length,E+=D+B.length,V.length)Ce(V);else{E+=c.mainHeaderSize,c.offset=S,S=0;var G=Buffer.alloc(E);w.forEach(function(_){_.copy(G,S),S+=_.length}),p.forEach(function(_){_.copy(G,S),S+=_.length});var W=c.toBinary();i&&i.copy(W,Re.Constants.ENDHDR),W.copy(G,S),f(G)}})}};A(r)}}}});var Ru=y((Kg,Du)=>{var Z=ut(),be=Z.FileSystem.require(),we=require("path");be.existsSync=be.existsSync||we.existsSync;var cE=An(),$n=Lu(),Yg=/^win/.test(process.platform);Du.exports=function(t){var e=void 0,r="";if(t&&typeof t=="string")if(be.existsSync(t))r=t,e=new $n(t,Z.Constants.FILE);else throw Z.Errors.INVALID_FILENAME;else t&&Buffer.isBuffer(t)?e=new $n(t,Z.Constants.BUFFER):e=new $n(null,Z.Constants.NONE);function n(s,o){s=we.resolve(we.normalize(s));for(var a=o.split("/"),c=0,u=a.length;c<u;c++){var l=we.normalize(we.join(s,a.slice(c,u).join(we.sep)));if(l.indexOf(s)===0)return l}return we.normalize(we.join(s,we.basename(o)))}function i(s){if(s&&e){var o;if(typeof s=="string"&&(o=e.getEntry(s)),typeof s=="object"&&typeof s.entryName<"u"&&typeof s.header<"u"&&(o=e.getEntry(s.entryName)),o)return o}return null}return{readFile:function(s){var o=i(s);return o&&o.getData()||null},readFileAsync:function(s,o){var a=i(s);a?a.getDataAsync(o):o(null,"getEntry failed for:"+s)},readAsText:function(s,o){var a=i(s);if(a){var c=a.getData();if(c&&c.length)return c.toString(o||"utf8")}return""},readAsTextAsync:function(s,o,a){var c=i(s);c?c.getDataAsync(function(u){u&&u.length?o(u.toString(a||"utf8")):o("")}):o("")},deleteFile:function(s){var o=i(s);o&&e.deleteEntry(o.entryName)},addZipComment:function(s){e.comment=s},getZipComment:function(){return e.comment||""},addZipEntryComment:function(s,o){var a=i(s);a&&(a.comment=o)},getZipEntryComment:function(s){var o=i(s);return o&&o.comment||""},updateFile:function(s,o){var a=i(s);a&&a.setData(o)},addLocalFile:function(s,o,a){if(be.existsSync(s)){o?(o=o.split("\\").join("/"),o.charAt(o.length-1)!=="/"&&(o+="/")):o="";var c=s.split("\\").join("/").split("/").pop();a?this.addFile(o+a,be.readFileSync(s),"",0):this.addFile(o+c,be.readFileSync(s),"",0)}else throw Z.Errors.FILE_NOT_FOUND.replace("%s",s)},addLocalFolder:function(s,o,a){if(a===void 0?a=function(){return!0}:a instanceof RegExp&&(a=function(l){return function(f){return l.test(f)}}(a)),o?(o=o.split("\\").join("/"),o.charAt(o.length-1)!=="/"&&(o+="/")):o="",s=we.normalize(s),s=s.split("\\").join("/"),s.charAt(s.length-1)!=="/"&&(s+="/"),be.existsSync(s)){var c=Z.findFiles(s),u=this;c.length&&c.forEach(function(l){var f=l.split("\\").join("/").replace(new RegExp(s.replace(/(\(|\))/g,"\\$1"),"i"),"");a(f)&&(f.charAt(f.length-1)!=="/"?u.addFile(o+f,be.readFileSync(l),"",0):u.addFile(o+f,Buffer.alloc(0),"",0))})}else throw Z.Errors.FILE_NOT_FOUND.replace("%s",s)},addFile:function(s,o,a,c){var u=new cE;u.entryName=s,u.comment=a||"",c||(u.isDirectory?c=16877<<16|16:c=420<<16),u.attr=c,u.setData(o),e.setEntry(u)},getEntries:function(){return e?e.entries:[]},getEntry:function(s){return i(s)},extractEntryTo:function(s,o,a,c){c=c||!1,a=typeof a>"u"?!0:a;var u=i(s);if(!u)throw Z.Errors.NO_ENTRY;var l=u.entryName,f=n(o,a?l:we.basename(l));if(u.isDirectory){f=we.resolve(f,"..");var m=e.getEntryChildren(u);return m.forEach(function(h){if(!h.isDirectory){var E=h.getData();if(!E)throw Z.Errors.CANT_EXTRACT_FILE;var w=n(o,a?h.entryName:we.basename(h.entryName));Z.writeFileTo(w,E,c)}}),!0}var d=u.getData();if(!d)throw Z.Errors.CANT_EXTRACT_FILE;if(be.existsSync(f)&&!c)throw Z.Errors.CANT_OVERRIDE;return Z.writeFileTo(f,d,c),!0},test:function(){if(!e)return!1;for(var s in e.entries)try{if(s.isDirectory)continue;var o=e.entries[s].getData();if(!o)return!1}catch{return!1}return!0},extractAllTo:function(s,o){if(o=o||!1,!e)throw Z.Errors.NO_ZIP;e.entries.forEach(function(a){var c=n(s,a.entryName.toString());if(a.isDirectory){Z.makeDir(c);return}var u=a.getData();if(!u)throw Z.Errors.CANT_EXTRACT_FILE;Z.writeFileTo(c,u,o),be.utimesSync(c,a.header.time,a.header.time)})},extractAllToAsync:function(s,o,a){if(a||(a=function(){}),o=o||!1,!e){a(new Error(Z.Errors.NO_ZIP));return}var c=e.entries,u=c.length;c.forEach(function(l){if(!(u<=0)){var f=we.normalize(l.entryName.toString());if(l.isDirectory){Z.makeDir(n(s,f)),--u===0&&a(void 0);return}l.getDataAsync(function(m){if(!(u<=0)){if(!m){u=0,a(new Error(Z.Errors.CANT_EXTRACT_FILE));return}Z.writeFileToAsync(n(s,f),m,o,function(d){if(be.utimesSync(we.resolve(s,f),l.header.time,l.header.time),!(u<=0)){if(!d){u=0,a(new Error("Unable to write"));return}--u===0&&a(void 0)}})}})}})},writeZip:function(s,o){if(arguments.length===1&&typeof s=="function"&&(o=s,s=""),!s&&r&&(s=r),!!s){var a=e.compressToBuffer();if(a){var c=Z.writeFileTo(s,a,!0);typeof o=="function"&&o(c?null:new Error("failed"),"")}}},toBuffer:function(s,o,a,c){return this.valueOf=2,typeof s=="function"?(e.toAsyncBuffer(s,o,a,c),null):e.compressToBuffer()}}}});var H=require("node:path"),yr=require("node:fs/promises"),gr=require("node:child_process"),Fu=require("node:os"),Y=Q(qs());var ks=require("events");function _r(t){return t==null?[]:Array.isArray(t)?t:[t]}function ah(t,e,r,n){var i,s=t[e],o=~n.string.indexOf(e)?r==null||r===!0?"":String(r):typeof r=="boolean"?r:~n.boolean.indexOf(e)?r==="false"?!1:r==="true"||(t._.push((i=+r,i*0===0?i:r)),!!r):(i=+r,i*0===0?i:r);t[e]=s==null?o:Array.isArray(s)?s.concat(o):[s,o]}function ch(t,e){t=t||[],e=e||{};var r,n,i,s,o,a={_:[]},c=0,u=0,l=0,f=t.length;let m=e.alias!==void 0,d=e.unknown!==void 0,h=e.default!==void 0;if(e.alias=e.alias||{},e.string=_r(e.string),e.boolean=_r(e.boolean),m)for(r in e.alias)for(n=e.alias[r]=_r(e.alias[r]),c=0;c<n.length;c++)(e.alias[n[c]]=n.concat(r)).splice(c,1);for(c=e.boolean.length;c-- >0;)for(n=e.alias[e.boolean[c]]||[],u=n.length;u-- >0;)e.boolean.push(n[u]);for(c=e.string.length;c-- >0;)for(n=e.alias[e.string[c]]||[],u=n.length;u-- >0;)e.string.push(n[u]);if(h){for(r in e.default)if(s=typeof e.default[r],n=e.alias[r]=e.alias[r]||[],e[s]!==void 0)for(e[s].push(r),c=0;c<n.length;c++)e[s].push(n[c])}let E=d?Object.keys(e.alias):[];for(c=0;c<f;c++){if(i=t[c],i==="--"){a._=a._.concat(t.slice(++c));break}for(u=0;u<i.length&&i.charCodeAt(u)===45;u++);if(u===0)a._.push(i);else if(i.substring(u,u+3)==="no-"){if(s=i.substring(u+3),d&&!~E.indexOf(s))return e.unknown(i);a[s]=!1}else{for(l=u+1;l<i.length&&i.charCodeAt(l)!==61;l++);for(s=i.substring(u,l),o=i.substring(++l)||c+1===f||(""+t[c+1]).charCodeAt(0)===45||t[++c],n=u===2?[s]:s,l=0;l<n.length;l++){if(s=n[l],d&&!~E.indexOf(s))return e.unknown("-".repeat(u)+s);ah(a,s,l+1<n.length||o,e)}}}if(h)for(r in e.default)a[r]===void 0&&(a[r]=e.default[r]);if(m)for(r in a)for(n=e.alias[r]||[];n.length>0;)a[n.shift()]=a[r];return a}var Us=t=>t.replace(/[<[].+/,"").trim(),uh=t=>{let e=/<([^>]+)>/g,r=/\[([^\]]+)\]/g,n=[],i=a=>{let c=!1,u=a[1];return u.startsWith("...")&&(u=u.slice(3),c=!0),{required:a[0].startsWith("<"),value:u,variadic:c}},s;for(;s=e.exec(t);)n.push(i(s));let o;for(;o=r.exec(t);)n.push(i(o));return n},lh=t=>{let e={alias:{},boolean:[]};for(let[r,n]of t.entries())n.names.length>1&&(e.alias[n.names[0]]=n.names.slice(1)),n.isBoolean&&(n.negated&&t.some((s,o)=>o!==r&&s.names.some(a=>n.names.includes(a))&&typeof s.required=="boolean")||e.boolean.push(n.names[0]));return e},_s=t=>t.sort((e,r)=>e.length>r.length?-1:1)[0],Ps=(t,e)=>t.length>=e?t:`${t}${" ".repeat(e-t.length)}`,fh=t=>t.replace(/([a-z])-([a-z])/g,(e,r,n)=>r+n.toUpperCase()),hh=(t,e,r)=>{let n=0,i=e.length,s=t,o;for(;n<i;++n)o=s[e[n]],s=s[e[n]]=n===i-1?r:o??(~e[n+1].indexOf(".")||!(+e[n+1]>-1)?{}:[])},dh=(t,e)=>{for(let r of Object.keys(e)){let n=e[r];n.shouldTransform&&(t[r]=Array.prototype.concat.call([],t[r]),typeof n.transformFunction=="function"&&(t[r]=t[r].map(n.transformFunction)))}},mh=t=>{let e=/([^\\\/]+)$/.exec(t);return e?e[1]:""},Bs=t=>t.split(".").map((e,r)=>r===0?fh(e):e).join("."),wt=class extends Error{constructor(e){super(e),this.name=this.constructor.name,typeof Error.captureStackTrace=="function"?Error.captureStackTrace(this,this.constructor):this.stack=new Error(e).stack}},Pr=class{constructor(e,r,n){this.rawName=e,this.description=r,this.config=Object.assign({},n),e=e.replace(/\.\*/g,""),this.negated=!1,this.names=Us(e).split(",").map(i=>{let s=i.trim().replace(/^-{1,2}/,"");return s.startsWith("no-")&&(this.negated=!0,s=s.replace(/^no-/,"")),Bs(s)}).sort((i,s)=>i.length>s.length?1:-1),this.name=this.names[this.names.length-1],this.negated&&this.config.default==null&&(this.config.default=!0),e.includes("<")?this.required=!0:e.includes("[")?this.required=!1:this.isBoolean=!0}},ph=process.argv,Eh=`${process.platform}-${process.arch} node-${process.version}`,Xt=class{constructor(e,r,n={},i){this.rawName=e,this.description=r,this.config=n,this.cli=i,this.options=[],this.aliasNames=[],this.name=Us(e),this.args=uh(e),this.examples=[]}usage(e){return this.usageText=e,this}allowUnknownOptions(){return this.config.allowUnknownOptions=!0,this}ignoreOptionDefaultValue(){return this.config.ignoreOptionDefaultValue=!0,this}version(e,r="-v, --version"){return this.versionNumber=e,this.option(r,"Display version number"),this}example(e){return this.examples.push(e),this}option(e,r,n){let i=new Pr(e,r,n);return this.options.push(i),this}alias(e){return this.aliasNames.push(e),this}action(e){return this.commandAction=e,this}isMatched(e){return this.name===e||this.aliasNames.includes(e)}get isDefaultCommand(){return this.name===""||this.aliasNames.includes("!")}get isGlobalCommand(){return this instanceof zt}hasOption(e){return e=e.split(".")[0],this.options.find(r=>r.names.includes(e))}outputHelp(){let{name:e,commands:r}=this.cli,{versionNumber:n,options:i,helpCallback:s}=this.cli.globalCommand,o=[{body:`${e}${n?`/${n}`:""}`}];if(o.push({title:"Usage",body:` $ ${e} ${this.usageText||this.rawName}`}),(this.isGlobalCommand||this.isDefaultCommand)&&r.length>0){let u=_s(r.map(l=>l.rawName));o.push({title:"Commands",body:r.map(l=>` ${Ps(l.rawName,u.length)} ${l.description}`).join(`
48
- `)}),o.push({title:"For more info, run any command with the `--help` flag",body:r.map(l=>` $ ${e}${l.name===""?"":` ${l.name}`} --help`).join(`
49
- `)})}let c=this.isGlobalCommand?i:[...this.options,...i||[]];if(!this.isGlobalCommand&&!this.isDefaultCommand&&(c=c.filter(u=>u.name!=="version")),c.length>0){let u=_s(c.map(l=>l.rawName));o.push({title:"Options",body:c.map(l=>` ${Ps(l.rawName,u.length)} ${l.description} ${l.config.default===void 0?"":`(default: ${l.config.default})`}`).join(`
50
- `)})}this.examples.length>0&&o.push({title:"Examples",body:this.examples.map(u=>typeof u=="function"?u(e):u).join(`
51
- `)}),s&&(o=s(o)||o),console.log(o.map(u=>u.title?`${u.title}:
52
- ${u.body}`:u.body).join(`
53
-
54
- `))}outputVersion(){let{name:e}=this.cli,{versionNumber:r}=this.cli.globalCommand;r&&console.log(`${e}/${r} ${Eh}`)}checkRequiredArgs(){let e=this.args.filter(r=>r.required).length;if(this.cli.args.length<e)throw new wt(`missing required args for command \`${this.rawName}\``)}checkUnknownOptions(){let{options:e,globalCommand:r}=this.cli;if(!this.config.allowUnknownOptions){for(let n of Object.keys(e))if(n!=="--"&&!this.hasOption(n)&&!r.hasOption(n))throw new wt(`Unknown option \`${n.length>1?`--${n}`:`-${n}`}\``)}}checkOptionValue(){let{options:e,globalCommand:r}=this.cli,n=[...r.options,...this.options];for(let i of n){let s=e[i.name.split(".")[0]];if(i.required){let o=n.some(a=>a.negated&&a.names.includes(i.name));if(s===!0||s===!1&&!o)throw new wt(`option \`${i.rawName}\` value is missing`)}}}},zt=class extends Xt{constructor(e){super("@@global@@","",{},e)}},jt=Object.assign,kr=class extends ks.EventEmitter{constructor(e=""){super(),this.name=e,this.commands=[],this.rawArgs=[],this.args=[],this.options={},this.globalCommand=new zt(this),this.globalCommand.usage("<command> [options]")}usage(e){return this.globalCommand.usage(e),this}command(e,r,n){let i=new Xt(e,r||"",n,this);return i.globalCommand=this.globalCommand,this.commands.push(i),i}option(e,r,n){return this.globalCommand.option(e,r,n),this}help(e){return this.globalCommand.option("-h, --help","Display this message"),this.globalCommand.helpCallback=e,this.showHelpOnExit=!0,this}version(e,r="-v, --version"){return this.globalCommand.version(e,r),this.showVersionOnExit=!0,this}example(e){return this.globalCommand.example(e),this}outputHelp(){this.matchedCommand?this.matchedCommand.outputHelp():this.globalCommand.outputHelp()}outputVersion(){this.globalCommand.outputVersion()}setParsedInfo({args:e,options:r},n,i){return this.args=e,this.options=r,n&&(this.matchedCommand=n),i&&(this.matchedCommandName=i),this}unsetMatchedCommand(){this.matchedCommand=void 0,this.matchedCommandName=void 0}parse(e=ph,{run:r=!0}={}){this.rawArgs=e,this.name||(this.name=e[1]?mh(e[1]):"cli");let n=!0;for(let s of this.commands){let o=this.mri(e.slice(2),s),a=o.args[0];if(s.isMatched(a)){n=!1;let c=jt(jt({},o),{args:o.args.slice(1)});this.setParsedInfo(c,s,a),this.emit(`command:${a}`,s)}}if(n){for(let s of this.commands)if(s.name===""){n=!1;let o=this.mri(e.slice(2),s);this.setParsedInfo(o,s),this.emit("command:!",s)}}if(n){let s=this.mri(e.slice(2));this.setParsedInfo(s)}this.options.help&&this.showHelpOnExit&&(this.outputHelp(),r=!1,this.unsetMatchedCommand()),this.options.version&&this.showVersionOnExit&&this.matchedCommandName==null&&(this.outputVersion(),r=!1,this.unsetMatchedCommand());let i={args:this.args,options:this.options};return r&&this.runMatchedCommand(),!this.matchedCommand&&this.args[0]&&this.emit("command:*"),i}mri(e,r){let n=[...this.globalCommand.options,...r?r.options:[]],i=lh(n),s=[],o=e.indexOf("--");o>-1&&(s=e.slice(o+1),e=e.slice(0,o));let a=ch(e,i);a=Object.keys(a).reduce((m,d)=>jt(jt({},m),{[Bs(d)]:a[d]}),{_:[]});let c=a._,u={"--":s},l=r&&r.config.ignoreOptionDefaultValue?r.config.ignoreOptionDefaultValue:this.globalCommand.config.ignoreOptionDefaultValue,f=Object.create(null);for(let m of n){if(!l&&m.config.default!==void 0)for(let d of m.names)u[d]=m.config.default;Array.isArray(m.config.type)&&f[m.name]===void 0&&(f[m.name]=Object.create(null),f[m.name].shouldTransform=!0,f[m.name].transformFunction=m.config.type[0])}for(let m of Object.keys(a))if(m!=="_"){let d=m.split(".");hh(u,d,a[m]),dh(u,f)}return{args:c,options:u}}runMatchedCommand(){let{args:e,options:r,matchedCommand:n}=this;if(!n||!n.commandAction)return;n.checkUnknownOptions(),n.checkOptionValue(),n.checkRequiredArgs();let i=[];return n.args.forEach((s,o)=>{s.variadic?i.push(e.slice(o)):i.push(e[o])}),i.push(r),n.commandAction.apply(this,i)}},Ms=(t="")=>new kr(t);var wr=Q(Ta()),F=Q(Fa()),qu=Q(vc()),_u=Q(Dc()),uE=!1,mr="https",Pu=!0,ku=__dirname,lE=(0,H.join)(ku,"bin"),Sr=Ms("wallaby"),Uu=require((0,H.join)(ku,"package.json")).version,Un=(0,H.join)((0,Fu.homedir)(),".wallaby"),ke=(0,H.join)(Un,"cli"),qn=(0,H.join)(ke,"downloads"),Bu=(0,H.join)(Un,"key.lic"),Mu=(0,H.join)(ke,"wallaby.json"),_n=(0,H.join)(ke,"core.json"),At=(0,H.join)(ke,"pinned.version"),bu=()=>mr+"://update.wallabyjs.com/",Hu="server.js",fE=10*60*1e3,pr,Fn=0,bt,Tt;Sr.command("[start]","start wallaby").alias("start").option("--doNotOpen","do not open browser on startup").option("--smart","use smart (lazy) start to run tests of modified test files only: https://wallabyjs.com/docs/intro/smart-start.html").option("--config <path>","use config file: https://wallabyjs.com/docs/config/overview.html").option("--update <version>","if no version is provided, forces a Wallaby Core update to the latest version before starting. Otherwise, installs and pins the specified Wallaby Core version before starting",{type:[String]}).option("--useHttp","use http instead of https for downloading Wallaby dependencies").option("--useNonStrictSSL","do not use strict SSL for downloading Wallaby dependencies").option("--suppressExpirationNotifications","do not notify about license expiration").action(async(t,e)=>{gE(e),e.useHttp&&(mr="http"),e.useNonStrictSSL&&(Pu=!1),Y.default.ensureDirSync(Un),Y.default.ensureDirSync(ke),await Wu(e)});Sr.help();Sr.version(Uu);Sr.parse();function Gu(t){clearTimeout(pr),pr=setTimeout(async()=>{await Vu(t)},fE)}async function Vu(t){try{Tt=await Zu(t),Tt?.updated&&(bt?.process.send({type:"coreUpdated",version:Er(Tt.path)}),Fn=0)}catch{Fn++}finally{Fn<=3&&Gu(Tt?.path||t)}}async function Wu(t){clearTimeout(pr),bt?.process.removeAllListeners(),bt?.process.kill();let e=!1,r=t.update?.trim();if(r==="undefined"||r==="0")e=!1;else if(r==="true")await Pn(),e=!0;else if(r){let s=r.startsWith("v")?r.replace("v",""):r;e=!1,(0,wr.valid)(s)?await OE(s):await Pn()}let{path:n,type:i}=Tt||await dE({forceUpdate:e});bt=hE(n,t),i==="dist"&&Gu(bt.path)}function hE(t,e){let r=["--cli=true","--lkp="+Bu];e.smart&&r.push("--smartStart=true"),e.config&&r.push("--configPath="+(0,H.resolve)(e.config));let n=Bn();n&&r.push("--pinned="+n);let i=Er(t),[,,s]=i.split(".");parseInt(s,10)<1608&&(process.stdout.write(F.red(`${F.bold("Wallaby Core")} v${i} is not supported.
55
- `)),process.stdout.write(F.red(`Run with ${F.bold("--update")} flag to get the latest version of Wallaby Core.
56
- `)),process.exit(1));let o=(0,gr.fork)(t,r,{env:process.env,silent:!0});return e.printLinks=!0,o.on("message",a=>{switch(a?.type){case"uiStarted":e.port=a.port,yE(e,i);break;case"notification":EE(e,a.notification);break;case"restart":Wu(e);break;case"licenseChanged":clearTimeout(pr),Vu(t);break;case"stopped":break;default:break}}),o.on("exit",()=>{process.stdout.write(F.gray(`
57
- ${F.bold("WALLABY CORE")} stopped
58
- `))}),{process:o,path:t}}async function dE(t){if(uE)return{path:require.resolve("../wallaby/server"),type:"dev"};let e=mE();return e?{path:e,type:"npm"}:{path:await pE(t),type:"dist"}}function mE(){try{let t=require.resolve("@wallabyjs/core"),e=(0,H.join)(t,Hu);if(Y.default.existsSync(e))return e}catch{}}async function pE(t){let e=zu(),r=await Zu(e,{forceLatestVersion:t?.forceUpdate,useInstalledVersion:!0});if(!r)throw new Error("Could not resolve Wallaby Core");return(0,H.join)(r.path,"server.js")}function EE(t,e){if(!e.text)return;let r=[];if(~e.text.indexOf("expire")&&e.type==="warning"&&t.suppressExpirationNotifications)return;let n=`http://localhost:${t.port}`;~e.text.indexOf("activate-link")&&t.port&&r.push({title:"Enter License",url:n}),~e.text.indexOf("continue-trial-link")&&t.port&&r.push({title:"Continue Trial",url:n}),e.button&&r.push({title:e.button.label,url:e.button.link}),e.text=e.text.replace(/<br\/><br\/>/g," ").replace(/<br\/>/g," ").replace(/<a\s+(?:[^>]*?\s+)?href=['"]([^'"]*)['"]/g,(s,o)=>(o.startsWith("http")&&r.push({url:o}),s)).replace(/<[^>]*>/g,"");let i=e.type==="error"?F.red:e.type==="warning"?F.yellow:F.green;if(process.stdout.write(i(`
59
- \u2691 ${e.text}
60
-
61
- `)),r.length)for(let s of r)process.stdout.write(`${F.green(" \u279C ")}${F.bold(F.yellow(s.title?s.title+": ":""))}${F.cyan(s.url)}
62
- `)}function yE(t,e){let r=`http://localhost:${t.port}`;process.stdout.write(F.green(` ${F.bold("WALLABY CORE")} v${e}
63
- `)),t.printLinks&&(process.stdout.write(`${F.green(" \u279C ")}${F.bold(F.yellow("UI:"))} ${F.cyan(r)}
64
- `),process.stdout.write(`${F.green(" \u279C ")}${F.bold(F.dim("Docs:"))} ${F.cyan("https://wallabyjs.com/docs")}
65
- `)),t.doNotOpen||wE(r)}function gE(t){for(let[e,r]of Object.entries(t))Array.isArray(r)&&(t[e]=r[r.length-1])}function wE(t){let e=process.env.BROWSER||"";if(e.toLowerCase().endsWith(".js"))SE(e,t);else if(e.toLowerCase()!=="none"){let r=process.env.BROWSER_ARGS?process.env.BROWSER_ARGS.split(" "):[];xE(e,r,t)}}function SE(t,e){let r=process.argv.slice(2);(0,qu.default)(process.execPath,[t,...r,e],{stdio:"inherit"}).on("close",i=>{i!==0&&process.stdout.write(F.red(`
66
- The script specified as BROWSER environment variable failed.
67
-
68
- ${F.cyan(t)} exited with code ${i}.`))})}var Tu=["Google Chrome Canary","Google Chrome Dev","Google Chrome Beta","Google Chrome","Microsoft Edge","Brave Browser","Vivaldi","Chromium"];async function xE(t,e,r){let n=t==="google chrome"?"Google Chrome":t;if(process.platform==="darwin"&&(!n||Tu.includes(n)))try{let s=await Au("ps cax"),o=n&&s.includes(n)?n:Tu.find(a=>s.includes(a));if(o)return await Au(`osascript openChrome.applescript "${encodeURI(r)}" "${o}"`,{cwd:lE}),!0}catch{}process.platform==="darwin"&&t==="open"&&(t=void 0);try{let s=t?{app:{name:t,arguments:e}}:{};return new Promise(async(o,a)=>{let c;try{c=(su(),il(iu)).default}catch{try{c=(await eval?.("import('open')")).default}catch{}}c&&c(r,s).then(u=>{u.on("error",a)}).catch(a)}).catch(o=>{process.stderr.write(o.stack||o.message)}),!0}catch{return!1}}function Au(t,e){return new Promise((r,n)=>{(0,gr.exec)(t,e,(i,s)=>{i?n(i):r(s.toString())})})}function ju(){try{let t=r=>r&&r.replace(/^\s+|\s+$/gm,""),e=Y.default.readFileSync(Bu).toString();if(e){let r=e.split(":");r.length===2&&(e=t(r[1]))}return Buffer.from(e,"base64").toString().split(`
69
- `)[2]}catch{}}function vE(){try{let[t,e,r]=ju().split("/");return new Date(Date.UTC(parseInt(r,10),parseInt(e,10)-1,parseInt(t,10)))}catch{}}async function Xu(t,e){try{await Y.default.remove(t)}catch(r){if(e)throw r;await Xu(t,!0)}}function zu(t,e){let r;if(!t)try{t=JSON.parse(Y.default.readFileSync(_n).toString())}catch{}t||(t={});let n=vE()?.getTime(),i=Bn(),s=Object.keys(t).map(c=>{let u=(0,H.join)(ke,"wallaby"+c),l=(0,H.join)(u,"package.json"),f=i&&Y.default.existsSync(l)?require(l).version:void 0;return{id:c,pinned:i?f===i:!1,package:l,...t[c]}}).sort((c,u)=>u.releaseDate-c.releaseDate),o=new Date().getTime()-1e3*60*60*24*5;s.forEach(c=>{if(!Y.default.existsSync(c.package))e=!0,delete t[c.id];else if(!c.pinned&&c.invalidated&&Object.keys(c.expiry).length===0&&c.invalidated<o){e=!0,delete t[c.id];try{Xu((0,H.dirname)(c.package),!0)}catch{}}});let a=s.filter(c=>(!n||c.releaseDate<n)&&t[c.id]);if(a.length){if(n&&n<new Date().getTime()&&!t[a[0].id].expiry[n]){t[a[0].id].expiry[n]=!0;for(let u=1;u<a.length;u++)delete t[a[u].id].expiry[n];e=!0}let c=i?(a.find(u=>u.pinned)||a.find(u=>!u.invalidated)||a[0]).id:(a.find(u=>!u.invalidated)||a[0]).id;r=(0,H.join)(ke,"wallaby"+c)}return e&&Y.default.writeFileSync(_n,JSON.stringify(t)),r}async function Zu(t,e){let r=!1,n=t,i=e?.forceLatestVersion,s=e?.useInstalledVersion,o=ju(),a=bu(),c=d=>IE({name:"version",from:`${d}wallaby.json?${o?"expiry="+o.replace(/\//g,"-"):""}`,to:Mu}),u=Bn(),l=i?!1:n&&Y.default.existsSync(n),f=(0,H.join)(qn,"wallaby.zip");if(!l&&!i&&Y.default.existsSync(f))try{n=await Ku(f),l=!!n&&Y.default.existsSync(n),r=!0}catch{}let m;if(s&&l)m={core:l&&Er(n)||"unknown"};else{let d=kn("Downloading version file");try{try{await c(bu())}catch{a=`${mr}://s3.amazonaws.com/wallaby-downloads/`,await c("http://update.wallabyjs.com/")}}finally{d()}m=CE()}if(u&&(m.core&&(0,wr.gt)(u,m.core)?await Pn():m.core=u),!(l&&Er(n)===m.core))try{n=await $u({name:"core",from:`${a}wallaby-v${m.core}.zip`}),r=!0}catch{n=await $u({name:"core",from:`${mr}://s3.amazonaws.com/wallaby-downloads/wallaby-v${m.core}.zip`}),r=!0}return{path:n,updated:r,type:"dist"}}function CE(){let t=JSON.parse(Y.default.readFileSync(Mu).toString()),e;return t.latestServer.forEach(r=>{r.substring(0,r.lastIndexOf("."))===Uu.substring(0,r.lastIndexOf("."))&&(e=r)}),{core:e}}function Er(t){return t.endsWith(Hu)&&(t=(0,H.dirname)(t)),JSON.parse(Y.default.readFileSync((0,H.join)(t,"package.json")).toString()).version}async function $u(t){let e=kn("Downloading core"),r=(0,H.join)(qn,"wallaby.zip");try{Y.default.ensureDirSync(qn),await Yu(t.from,t.name,r,2e6)}finally{e()}let n=kn("Extracting core");try{return await Ku(r)}catch(i){throw new Error(`Error while unzipping wallaby.js ${t.name} file: ${i.message}`)}finally{n()}}async function IE(t){return await Yu(t.from,t.name,t.to)}function Yu(t,e,r,n){let i=!1,s=()=>!i&&(i=!0),o="This may occur when you are behind proxy.";return new Promise(async(a,c)=>{try{let u=global.fetch,l={headers:{"User-Agent":"node "+process.version},agent:void 0};if(t.startsWith("https:")){let m=require("https");Pu===!1&&(l.agent=new m.Agent({rejectUnauthorized:!1}))}let f=await u(t,l);if(!f.ok||f.status!==200)throw new Error(`Error while downloading wallaby.js ${e}, status code: ${f.status}. ${o}`);if(n&&f.headers.get("content-length")&&parseInt(f.headers.get("content-length"),10)<n)throw new Error(`Error while downloading wallaby.js ${e}, file is corrupt. ${o}`);{let m=await f.arrayBuffer();Y.default.writeFileSync(r,Buffer.from(m)),s()&&a(r)}}catch(u){s()&&c(u)}})}async function Ku(t){let e=Ru(),r=new e(t),n=new Date(r.getEntry("package.json").header.time);n.setMinutes(n.getMinutes()-n.getTimezoneOffset());let i=JSON.parse(r.readAsText("package.json")).version,[s,o,a]=i.split(".").map(m=>parseInt(m)),c=require("crypto");if(s>1||o>0||a>1091){let m=`-----BEGIN RSA PUBLIC KEY-----
70
- MIIBCgKCAQEAngwMnSkF1zlHJggr7kXXO02ytYIlzMdvQxHu6hli+TFIeO72HNfK
71
- P27g+f8EtlPRB0UwnpAHtkJHNCdwpo04eU8hS8g9vbmNf00luUJGuUHnf62Pp0EI
72
- KbGKJvzkdPgfs62MItfi4uf+XiHa8rN0Bk7hRbddI1zA4Wupf/E0wZ7UorgCE9XB
73
- EM6VULphGdHorpmHBW5deeCHIledtMOpOfDSM5lvjiqgVqmjNYT+WXCwjN8yCcyU
74
- oedY3afSHTyqiuInKcpXd+VJQb2+d7y583Pb3+kDGraBMGFJaWGewm7+IYIlgk5C
75
- uk54FsjCvwvaa0SKr2rkIBKuyFX3ZGymyQIDAQAB
76
- -----END RSA PUBLIC KEY-----`,d=r.getEntries();d.sort((w,p)=>w.entryName.localeCompare(p.entryName));let h=r.readAsText("signature.txt"),E=c.createVerify("RSA-SHA512");if(d.forEach(w=>{w.entryName!=="signature.txt"&&E.update(w.getData())}),!E.verify(m,Buffer.from(h,"base64")))throw new Error("could not verify core version")}let l=c.randomBytes(3).toString("hex");for(;Y.default.existsSync((0,H.join)(ke,"wallaby"+l));)l=c.randomBytes(3).toString("hex");let f=(0,H.join)(ke,"wallaby"+l);return await new Promise((m,d)=>{r.extractAllToAsync(f,!0,h=>{h?d(h):m(void 0)})}),NE(l,n.getTime())}function NE(t,e){let r;try{r=JSON.parse(Y.default.readFileSync(_n).toString());let n=new Date().getTime();Object.keys(r).forEach(i=>{!r[i].invalidated&&r[i].releaseDate<=e&&(r[i].invalidated=n)})}catch{r={}}return r[t]={releaseDate:e,invalidated:!1,expiry:{}},zu(r,!0)}async function OE(t){await(0,yr.writeFile)(At,t)}async function Pn(){if(Y.default.existsSync(At))return await(0,yr.unlink)(At)}function Bn(){if(Y.default.existsSync(At))return Y.default.readFileSync(At,"utf-8")}function kn(t){var e=new _u.Spinner;return e.setSpinnerString(4),e.setSpinnerDelay(250),e.setSpinnerTitle(` ${F.green("%s")} ${t}`),e.start(),()=>e.stop(!0)}