chromatic
Version:
Automate visual testing across browsers. Gather UI feedback. Versioned documentation.
58 lines • 131 kB
JavaScript
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="f2fbe96c-a1e9-5bfe-8f00-a7b6fe03a174")}catch(e){}}();
const e=require(`./chunk-gGpyby2o.cjs`),t=require(`./meow-BcLCtnkU.cjs`);let n=require(`fs`);n=e.a(n,1);let r=require(`path`);r=e.a(r,1);let i=require(`tty`);i=e.a(i,1);let a=require(`os`);a=e.a(a,1);let o=require(`events`);o=e.a(o,1);let s=require(`child_process`);s=e.a(s,1);let c=require(`node:util`),l=require(`node:child_process`);l=e.a(l,1);let u=require(`node:fs`);u=e.a(u,1);let d=require(`node:os`);d=e.a(d,1);let f=require(`node:path`);f=e.a(f,1);let p=require(`node:process`);p=e.a(p,1);let m=require(`node:fs/promises`);m=e.a(m,1);let h=require(`node:url`);h=e.a(h,1);let g=require(`node:buffer`),_=require(`node:timers/promises`),v=require(`stream`);v=e.a(v,1);let y=require(`fs/promises`);y=e.a(y,1);let b=require(`readline`);b=e.a(b,1);const ee=e=>e instanceof URL?(0,h.fileURLToPath)(e):e;async function x(e,{cwd:t=p.default.cwd(),type:n=`file`,stopAt:r}={}){let i=f.default.resolve(ee(t)??``),{root:a}=f.default.parse(i);r=f.default.resolve(i,ee(r??a));let o=f.default.isAbsolute(e);for(;i;){let t=o?e:f.default.join(i,e);try{let e=await m.default.stat(t);if(n===`file`&&e.isFile()||n===`directory`&&e.isDirectory())return t}catch{}if(i===r||i===a)break;i=f.default.dirname(i)}}var te=t.f();const ne=({oneBased:e,oneBasedLine:t=e,oneBasedColumn:n=e}={})=>[+!!t,+!!n];function re(e,t,n){let r=t===0?-1:e.lastIndexOf(`
`,t-1),[i,a]=ne(n);return{line:r===-1?i:e.slice(0,r+1).match(/\n/g).length+i,column:t-r-1+a}}function ie(e,t,n){if(typeof e!=`string`)throw TypeError(`Text parameter should be a string`);if(!Number.isInteger(t))throw TypeError(`Index parameter should be an integer`);if(t<0||t>e.length)throw RangeError(`Index out of bounds`);return re(e,t,n)}const ae=e=>`\\u{${e.codePointAt(0).toString(16)}}`;var oe=class e extends Error{name=`JSONError`;fileName;#e;#t;#n;#r;#i;constructor(t){if(typeof t==`string`)super(),this.#n=t;else{let{jsonParseError:e,fileName:n,input:r}=t;super(void 0,{cause:e}),this.#e=r,this.#t=e,this.fileName=n}Error.captureStackTrace?.(this,e)}get message(){this.#n??=`${ce(this.#t.message)}${this.#e===``?` while parsing empty string`:``}`;let{codeFrame:e}=this;return`${this.#n}${this.fileName?` in ${this.fileName}`:``}${e?`\n\n${e}\n`:``}`}set message(e){this.#n=e}#a(e){if(!this.#t)return;let t=this.#e,n=se(t,this.#t.message);if(n)return(0,te.codeFrameColumns)(t,{start:n},{highlightCode:e})}get codeFrame(){return this.#r??=this.#a(!0),this.#r}get rawCodeFrame(){return this.#i??=this.#a(!1),this.#i}};const se=(e,t)=>{let n=t.match(/in JSON at position (?<index>\d+)(?: \(line (?<line>\d+) column (?<column>\d+)\))?$/);if(!n)return;let{index:r,line:i,column:a}=n.groups;return i&&a?{line:Number(i),column:Number(a)}:ie(e,Number(r),{oneBased:!0})},ce=e=>e.replace(/(?<=^Unexpected token )(?<quote>')?(.)\k<quote>/,(e,t,n)=>`"${n}"(${ae(n)})`);function le(e,t,n){typeof t==`string`&&(n=t,t=void 0);try{return JSON.parse(e,t)}catch(t){throw new oe({jsonParseError:t,fileName:n,input:e})}}var ue=e.t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.LRUCache=void 0;let t=typeof performance==`object`&&performance&&typeof performance.now==`function`?performance:Date,n=new Set,r=typeof process==`object`&&process?process:{},i=(e,t,n,i)=>{typeof r.emitWarning==`function`?r.emitWarning(e,t,n,i):console.error(`[${n}] ${t}: ${e}`)},a=globalThis.AbortController,o=globalThis.AbortSignal;if(a===void 0){o=class{onabort;_onabort=[];reason;aborted=!1;addEventListener(e,t){this._onabort.push(t)}},a=class{constructor(){t()}signal=new o;abort(e){if(!this.signal.aborted){this.signal.reason=e,this.signal.aborted=!0;for(let t of this.signal._onabort)t(e);this.signal.onabort?.(e)}}};let e=r.env?.LRU_CACHE_IGNORE_AC_WARNING!==`1`,t=()=>{e&&(e=!1,i("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.",`NO_ABORT_CONTROLLER`,`ENOTSUP`,t))}}let s=e=>!n.has(e),c=e=>e&&e===Math.floor(e)&&e>0&&isFinite(e),l=e=>c(e)?e<=2**8?Uint8Array:e<=2**16?Uint16Array:e<=2**32?Uint32Array:e<=2**53-1?u:null:null;var u=class extends Array{constructor(e){super(e),this.fill(0)}},d=class e{heap;length;static#e=!1;static create(t){let n=l(t);if(!n)return[];e.#e=!0;let r=new e(t,n);return e.#e=!1,r}constructor(t,n){if(!e.#e)throw TypeError(`instantiate Stack using Stack.create(n)`);this.heap=new n(t),this.length=0}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}};e.LRUCache=class e{#e;#t;#n;#r;#i;#a;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#o;#s;#c;#l;#u;#d;#f;#p;#m;#h;#g;#_;#v;#y;#b;#x;#S;static unsafeExposeInternals(e){return{starts:e.#v,ttls:e.#y,sizes:e.#_,keyMap:e.#c,keyList:e.#l,valList:e.#u,next:e.#d,prev:e.#f,get head(){return e.#p},get tail(){return e.#m},free:e.#h,isBackgroundFetch:t=>e.#L(t),backgroundFetch:(t,n,r,i)=>e.#I(t,n,r,i),moveToTail:t=>e.#z(t),indexes:t=>e.#M(t),rindexes:t=>e.#N(t),isStale:t=>e.#D(t)}}get max(){return this.#e}get maxSize(){return this.#t}get calculatedSize(){return this.#s}get size(){return this.#o}get fetchMethod(){return this.#i}get memoMethod(){return this.#a}get dispose(){return this.#n}get disposeAfter(){return this.#r}constructor(t){let{max:r=0,ttl:a,ttlResolution:o=1,ttlAutopurge:u,updateAgeOnGet:f,updateAgeOnHas:p,allowStale:m,dispose:h,disposeAfter:g,noDisposeOnSet:_,noUpdateTTL:v,maxSize:y=0,maxEntrySize:b=0,sizeCalculation:ee,fetchMethod:x,memoMethod:te,noDeleteOnFetchRejection:ne,noDeleteOnStaleGet:re,allowStaleOnFetchRejection:ie,allowStaleOnFetchAbort:ae,ignoreFetchAbort:oe}=t;if(r!==0&&!c(r))throw TypeError(`max option must be a nonnegative integer`);let se=r?l(r):Array;if(!se)throw Error(`invalid max value: `+r);if(this.#e=r,this.#t=y,this.maxEntrySize=b||this.#t,this.sizeCalculation=ee,this.sizeCalculation){if(!this.#t&&!this.maxEntrySize)throw TypeError(`cannot set sizeCalculation without setting maxSize or maxEntrySize`);if(typeof this.sizeCalculation!=`function`)throw TypeError(`sizeCalculation set to non-function`)}if(te!==void 0&&typeof te!=`function`)throw TypeError(`memoMethod must be a function if defined`);if(this.#a=te,x!==void 0&&typeof x!=`function`)throw TypeError(`fetchMethod must be a function if specified`);if(this.#i=x,this.#x=!!x,this.#c=new Map,this.#l=Array(r).fill(void 0),this.#u=Array(r).fill(void 0),this.#d=new se(r),this.#f=new se(r),this.#p=0,this.#m=0,this.#h=d.create(r),this.#o=0,this.#s=0,typeof h==`function`&&(this.#n=h),typeof g==`function`?(this.#r=g,this.#g=[]):(this.#r=void 0,this.#g=void 0),this.#b=!!this.#n,this.#S=!!this.#r,this.noDisposeOnSet=!!_,this.noUpdateTTL=!!v,this.noDeleteOnFetchRejection=!!ne,this.allowStaleOnFetchRejection=!!ie,this.allowStaleOnFetchAbort=!!ae,this.ignoreFetchAbort=!!oe,this.maxEntrySize!==0){if(this.#t!==0&&!c(this.#t))throw TypeError(`maxSize must be a positive integer if specified`);if(!c(this.maxEntrySize))throw TypeError(`maxEntrySize must be a positive integer if specified`);this.#O()}if(this.allowStale=!!m,this.noDeleteOnStaleGet=!!re,this.updateAgeOnGet=!!f,this.updateAgeOnHas=!!p,this.ttlResolution=c(o)||o===0?o:1,this.ttlAutopurge=!!u,this.ttl=a||0,this.ttl){if(!c(this.ttl))throw TypeError(`ttl must be a positive integer if specified`);this.#C()}if(this.#e===0&&this.ttl===0&&this.#t===0)throw TypeError(`At least one of max, maxSize, or ttl is required`);if(!this.ttlAutopurge&&!this.#e&&!this.#t){let t=`LRU_CACHE_UNBOUNDED`;s(t)&&(n.add(t),i(`TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.`,`UnboundedCacheWarning`,t,e))}}getRemainingTTL(e){return this.#c.has(e)?1/0:0}#C(){let e=new u(this.#e),n=new u(this.#e);this.#y=e,this.#v=n,this.#E=(r,i,a=t.now())=>{if(n[r]=i===0?0:a,e[r]=i,i!==0&&this.ttlAutopurge){let e=setTimeout(()=>{this.#D(r)&&this.#B(this.#l[r],`expire`)},i+1);e.unref&&e.unref()}},this.#w=r=>{n[r]=e[r]===0?0:t.now()},this.#T=(t,a)=>{if(e[a]){let o=e[a],s=n[a];if(!o||!s)return;t.ttl=o,t.start=s,t.now=r||i(),t.remainingTTL=o-(t.now-s)}};let r=0,i=()=>{let e=t.now();if(this.ttlResolution>0){r=e;let t=setTimeout(()=>r=0,this.ttlResolution);t.unref&&t.unref()}return e};this.getRemainingTTL=t=>{let a=this.#c.get(t);if(a===void 0)return 0;let o=e[a],s=n[a];return!o||!s?1/0:o-((r||i())-s)},this.#D=t=>{let a=n[t],o=e[t];return!!o&&!!a&&(r||i())-a>o}}#w=()=>{};#T=()=>{};#E=()=>{};#D=()=>!1;#O(){let e=new u(this.#e);this.#s=0,this.#_=e,this.#k=t=>{this.#s-=e[t],e[t]=0},this.#j=(e,t,n,r)=>{if(this.#L(t))return 0;if(!c(n))if(r){if(typeof r!=`function`)throw TypeError(`sizeCalculation must be a function`);if(n=r(t,e),!c(n))throw TypeError(`sizeCalculation return invalid (expect positive integer)`)}else throw TypeError(`invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.`);return n},this.#A=(t,n,r)=>{if(e[t]=n,this.#t){let n=this.#t-e[t];for(;this.#s>n;)this.#F(!0)}this.#s+=e[t],r&&(r.entrySize=n,r.totalCalculatedSize=this.#s)}}#k=e=>{};#A=(e,t,n)=>{};#j=(e,t,n,r)=>{if(n||r)throw TypeError(`cannot set size without setting maxSize or maxEntrySize on cache`);return 0};*#M({allowStale:e=this.allowStale}={}){if(this.#o)for(let t=this.#m;!(!this.#P(t)||((e||!this.#D(t))&&(yield t),t===this.#p));)t=this.#f[t]}*#N({allowStale:e=this.allowStale}={}){if(this.#o)for(let t=this.#p;!(!this.#P(t)||((e||!this.#D(t))&&(yield t),t===this.#m));)t=this.#d[t]}#P(e){return e!==void 0&&this.#c.get(this.#l[e])===e}*entries(){for(let e of this.#M())this.#u[e]!==void 0&&this.#l[e]!==void 0&&!this.#L(this.#u[e])&&(yield[this.#l[e],this.#u[e]])}*rentries(){for(let e of this.#N())this.#u[e]!==void 0&&this.#l[e]!==void 0&&!this.#L(this.#u[e])&&(yield[this.#l[e],this.#u[e]])}*keys(){for(let e of this.#M()){let t=this.#l[e];t!==void 0&&!this.#L(this.#u[e])&&(yield t)}}*rkeys(){for(let e of this.#N()){let t=this.#l[e];t!==void 0&&!this.#L(this.#u[e])&&(yield t)}}*values(){for(let e of this.#M())this.#u[e]!==void 0&&!this.#L(this.#u[e])&&(yield this.#u[e])}*rvalues(){for(let e of this.#N())this.#u[e]!==void 0&&!this.#L(this.#u[e])&&(yield this.#u[e])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]=`LRUCache`;find(e,t={}){for(let n of this.#M()){let r=this.#u[n],i=this.#L(r)?r.__staleWhileFetching:r;if(i!==void 0&&e(i,this.#l[n],this))return this.get(this.#l[n],t)}}forEach(e,t=this){for(let n of this.#M()){let r=this.#u[n],i=this.#L(r)?r.__staleWhileFetching:r;i!==void 0&&e.call(t,i,this.#l[n],this)}}rforEach(e,t=this){for(let n of this.#N()){let r=this.#u[n],i=this.#L(r)?r.__staleWhileFetching:r;i!==void 0&&e.call(t,i,this.#l[n],this)}}purgeStale(){let e=!1;for(let t of this.#N({allowStale:!0}))this.#D(t)&&(this.#B(this.#l[t],`expire`),e=!0);return e}info(e){let n=this.#c.get(e);if(n===void 0)return;let r=this.#u[n],i=this.#L(r)?r.__staleWhileFetching:r;if(i===void 0)return;let a={value:i};if(this.#y&&this.#v){let e=this.#y[n],r=this.#v[n];e&&r&&(a.ttl=e-(t.now()-r),a.start=Date.now())}return this.#_&&(a.size=this.#_[n]),a}dump(){let e=[];for(let n of this.#M({allowStale:!0})){let r=this.#l[n],i=this.#u[n],a=this.#L(i)?i.__staleWhileFetching:i;if(a===void 0||r===void 0)continue;let o={value:a};if(this.#y&&this.#v){o.ttl=this.#y[n];let e=t.now()-this.#v[n];o.start=Math.floor(Date.now()-e)}this.#_&&(o.size=this.#_[n]),e.unshift([r,o])}return e}load(e){this.clear();for(let[n,r]of e){if(r.start){let e=Date.now()-r.start;r.start=t.now()-e}this.set(n,r.value,r)}}set(e,t,n={}){if(t===void 0)return this.delete(e),this;let{ttl:r=this.ttl,start:i,noDisposeOnSet:a=this.noDisposeOnSet,sizeCalculation:o=this.sizeCalculation,status:s}=n,{noUpdateTTL:c=this.noUpdateTTL}=n,l=this.#j(e,t,n.size||0,o);if(this.maxEntrySize&&l>this.maxEntrySize)return s&&(s.set=`miss`,s.maxEntrySizeExceeded=!0),this.#B(e,`set`),this;let u=this.#o===0?void 0:this.#c.get(e);if(u===void 0)u=this.#o===0?this.#m:this.#h.length===0?this.#o===this.#e?this.#F(!1):this.#o:this.#h.pop(),this.#l[u]=e,this.#u[u]=t,this.#c.set(e,u),this.#d[this.#m]=u,this.#f[u]=this.#m,this.#m=u,this.#o++,this.#A(u,l,s),s&&(s.set=`add`),c=!1;else{this.#z(u);let n=this.#u[u];if(t!==n){if(this.#x&&this.#L(n)){n.__abortController.abort(Error(`replaced`));let{__staleWhileFetching:t}=n;t!==void 0&&!a&&(this.#b&&this.#n?.(t,e,`set`),this.#S&&this.#g?.push([t,e,`set`]))}else a||(this.#b&&this.#n?.(n,e,`set`),this.#S&&this.#g?.push([n,e,`set`]));if(this.#k(u),this.#A(u,l,s),this.#u[u]=t,s){s.set=`replace`;let e=n&&this.#L(n)?n.__staleWhileFetching:n;e!==void 0&&(s.oldValue=e)}}else s&&(s.set=`update`)}if(r!==0&&!this.#y&&this.#C(),this.#y&&(c||this.#E(u,r,i),s&&this.#T(s,u)),!a&&this.#S&&this.#g){let e=this.#g,t;for(;t=e?.shift();)this.#r?.(...t)}return this}pop(){try{for(;this.#o;){let e=this.#u[this.#p];if(this.#F(!0),this.#L(e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(this.#S&&this.#g){let e=this.#g,t;for(;t=e?.shift();)this.#r?.(...t)}}}#F(e){let t=this.#p,n=this.#l[t],r=this.#u[t];return this.#x&&this.#L(r)?r.__abortController.abort(Error(`evicted`)):(this.#b||this.#S)&&(this.#b&&this.#n?.(r,n,`evict`),this.#S&&this.#g?.push([r,n,`evict`])),this.#k(t),e&&(this.#l[t]=void 0,this.#u[t]=void 0,this.#h.push(t)),this.#o===1?(this.#p=this.#m=0,this.#h.length=0):this.#p=this.#d[t],this.#c.delete(n),this.#o--,t}has(e,t={}){let{updateAgeOnHas:n=this.updateAgeOnHas,status:r}=t,i=this.#c.get(e);if(i!==void 0){let e=this.#u[i];if(this.#L(e)&&e.__staleWhileFetching===void 0)return!1;if(this.#D(i))r&&(r.has=`stale`,this.#T(r,i));else return n&&this.#w(i),r&&(r.has=`hit`,this.#T(r,i)),!0}else r&&(r.has=`miss`);return!1}peek(e,t={}){let{allowStale:n=this.allowStale}=t,r=this.#c.get(e);if(r===void 0||!n&&this.#D(r))return;let i=this.#u[r];return this.#L(i)?i.__staleWhileFetching:i}#I(e,t,n,r){let i=t===void 0?void 0:this.#u[t];if(this.#L(i))return i;let o=new a,{signal:s}=n;s?.addEventListener(`abort`,()=>o.abort(s.reason),{signal:o.signal});let c={signal:o.signal,options:n,context:r},l=(r,i=!1)=>{let{aborted:a}=o.signal,s=n.ignoreFetchAbort&&r!==void 0;if(n.status&&(a&&!i?(n.status.fetchAborted=!0,n.status.fetchError=o.signal.reason,s&&(n.status.fetchAbortIgnored=!0)):n.status.fetchResolved=!0),a&&!s&&!i)return d(o.signal.reason);let l=p;return this.#u[t]===p&&(r===void 0?l.__staleWhileFetching?this.#u[t]=l.__staleWhileFetching:this.#B(e,`fetch`):(n.status&&(n.status.fetchUpdated=!0),this.set(e,r,c.options))),r},u=e=>(n.status&&(n.status.fetchRejected=!0,n.status.fetchError=e),d(e)),d=r=>{let{aborted:i}=o.signal,a=i&&n.allowStaleOnFetchAbort,s=a||n.allowStaleOnFetchRejection,c=s||n.noDeleteOnFetchRejection,l=p;if(this.#u[t]===p&&(!c||l.__staleWhileFetching===void 0?this.#B(e,`fetch`):a||(this.#u[t]=l.__staleWhileFetching)),s)return n.status&&l.__staleWhileFetching!==void 0&&(n.status.returnedStale=!0),l.__staleWhileFetching;if(l.__returned===l)throw r},f=(t,r)=>{let a=this.#i?.(e,i,c);a&&a instanceof Promise&&a.then(e=>t(e===void 0?void 0:e),r),o.signal.addEventListener(`abort`,()=>{(!n.ignoreFetchAbort||n.allowStaleOnFetchAbort)&&(t(void 0),n.allowStaleOnFetchAbort&&(t=e=>l(e,!0)))})};n.status&&(n.status.fetchDispatched=!0);let p=new Promise(f).then(l,u),m=Object.assign(p,{__abortController:o,__staleWhileFetching:i,__returned:void 0});return t===void 0?(this.set(e,m,{...c.options,status:void 0}),t=this.#c.get(e)):this.#u[t]=m,m}#L(e){if(!this.#x)return!1;let t=e;return!!t&&t instanceof Promise&&t.hasOwnProperty(`__staleWhileFetching`)&&t.__abortController instanceof a}async fetch(e,t={}){let{allowStale:n=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:i=this.noDeleteOnStaleGet,ttl:a=this.ttl,noDisposeOnSet:o=this.noDisposeOnSet,size:s=0,sizeCalculation:c=this.sizeCalculation,noUpdateTTL:l=this.noUpdateTTL,noDeleteOnFetchRejection:u=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:d=this.allowStaleOnFetchRejection,ignoreFetchAbort:f=this.ignoreFetchAbort,allowStaleOnFetchAbort:p=this.allowStaleOnFetchAbort,context:m,forceRefresh:h=!1,status:g,signal:_}=t;if(!this.#x)return g&&(g.fetch=`get`),this.get(e,{allowStale:n,updateAgeOnGet:r,noDeleteOnStaleGet:i,status:g});let v={allowStale:n,updateAgeOnGet:r,noDeleteOnStaleGet:i,ttl:a,noDisposeOnSet:o,size:s,sizeCalculation:c,noUpdateTTL:l,noDeleteOnFetchRejection:u,allowStaleOnFetchRejection:d,allowStaleOnFetchAbort:p,ignoreFetchAbort:f,status:g,signal:_},y=this.#c.get(e);if(y===void 0){g&&(g.fetch=`miss`);let t=this.#I(e,y,v,m);return t.__returned=t}else{let t=this.#u[y];if(this.#L(t)){let e=n&&t.__staleWhileFetching!==void 0;return g&&(g.fetch=`inflight`,e&&(g.returnedStale=!0)),e?t.__staleWhileFetching:t.__returned=t}let i=this.#D(y);if(!h&&!i)return g&&(g.fetch=`hit`),this.#z(y),r&&this.#w(y),g&&this.#T(g,y),t;let a=this.#I(e,y,v,m),o=a.__staleWhileFetching!==void 0&&n;return g&&(g.fetch=i?`stale`:`refresh`,o&&i&&(g.returnedStale=!0)),o?a.__staleWhileFetching:a.__returned=a}}async forceFetch(e,t={}){let n=await this.fetch(e,t);if(n===void 0)throw Error(`fetch() returned undefined`);return n}memo(e,t={}){let n=this.#a;if(!n)throw Error(`no memoMethod provided to constructor`);let{context:r,forceRefresh:i,...a}=t,o=this.get(e,a);if(!i&&o!==void 0)return o;let s=n(e,o,{options:a,context:r});return this.set(e,s,a),s}get(e,t={}){let{allowStale:n=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:i=this.noDeleteOnStaleGet,status:a}=t,o=this.#c.get(e);if(o!==void 0){let t=this.#u[o],s=this.#L(t);return a&&this.#T(a,o),this.#D(o)?(a&&(a.get=`stale`),s?(a&&n&&t.__staleWhileFetching!==void 0&&(a.returnedStale=!0),n?t.__staleWhileFetching:void 0):(i||this.#B(e,`expire`),a&&n&&(a.returnedStale=!0),n?t:void 0)):(a&&(a.get=`hit`),s?t.__staleWhileFetching:(this.#z(o),r&&this.#w(o),t))}else a&&(a.get=`miss`)}#R(e,t){this.#f[t]=e,this.#d[e]=t}#z(e){e!==this.#m&&(e===this.#p?this.#p=this.#d[e]:this.#R(this.#f[e],this.#d[e]),this.#R(this.#m,e),this.#m=e)}delete(e){return this.#B(e,`delete`)}#B(e,t){let n=!1;if(this.#o!==0){let r=this.#c.get(e);if(r!==void 0)if(n=!0,this.#o===1)this.#V(t);else{this.#k(r);let n=this.#u[r];if(this.#L(n)?n.__abortController.abort(Error(`deleted`)):(this.#b||this.#S)&&(this.#b&&this.#n?.(n,e,t),this.#S&&this.#g?.push([n,e,t])),this.#c.delete(e),this.#l[r]=void 0,this.#u[r]=void 0,r===this.#m)this.#m=this.#f[r];else if(r===this.#p)this.#p=this.#d[r];else{let e=this.#f[r];this.#d[e]=this.#d[r];let t=this.#d[r];this.#f[t]=this.#f[r]}this.#o--,this.#h.push(r)}}if(this.#S&&this.#g?.length){let e=this.#g,t;for(;t=e?.shift();)this.#r?.(...t)}return n}clear(){return this.#V(`delete`)}#V(e){for(let t of this.#N({allowStale:!0})){let n=this.#u[t];if(this.#L(n))n.__abortController.abort(Error(`deleted`));else{let r=this.#l[t];this.#b&&this.#n?.(n,r,e),this.#S&&this.#g?.push([n,r,e])}}if(this.#c.clear(),this.#u.fill(void 0),this.#l.fill(void 0),this.#y&&this.#v&&(this.#y.fill(0),this.#v.fill(0)),this.#_&&this.#_.fill(0),this.#p=0,this.#m=0,this.#h.length=0,this.#s=0,this.#o=0,this.#S&&this.#g){let e=this.#g,t;for(;t=e?.shift();)this.#r?.(...t)}}}})),de=e.t(((e,t)=>{let n=(...e)=>e.every(e=>e)?e.join(``):``,r=e=>e?encodeURIComponent(e):``,i=e=>e.toLowerCase().replace(/^\W+|\/|\W+$/g,``).replace(/\W+/g,`-`),a={sshtemplate:({domain:e,user:t,project:r,committish:i})=>`git@${e}:${t}/${r}.git${n(`#`,i)}`,sshurltemplate:({domain:e,user:t,project:r,committish:i})=>`git+ssh://git@${e}/${t}/${r}.git${n(`#`,i)}`,edittemplate:({domain:e,user:t,project:i,committish:a,editpath:o,path:s})=>`https://${e}/${t}/${i}${n(`/`,o,`/`,r(a||`HEAD`),`/`,s)}`,browsetemplate:({domain:e,user:t,project:i,committish:a,treepath:o})=>`https://${e}/${t}/${i}${n(`/`,o,`/`,r(a))}`,browsetreetemplate:({domain:e,user:t,project:i,committish:a,treepath:o,path:s,fragment:c,hashformat:l})=>`https://${e}/${t}/${i}/${o}/${r(a||`HEAD`)}/${s}${n(`#`,l(c||``))}`,browseblobtemplate:({domain:e,user:t,project:i,committish:a,blobpath:o,path:s,fragment:c,hashformat:l})=>`https://${e}/${t}/${i}/${o}/${r(a||`HEAD`)}/${s}${n(`#`,l(c||``))}`,docstemplate:({domain:e,user:t,project:i,treepath:a,committish:o})=>`https://${e}/${t}/${i}${n(`/`,a,`/`,r(o))}#readme`,httpstemplate:({auth:e,domain:t,user:r,project:i,committish:a})=>`git+https://${n(e,`@`)}${t}/${r}/${i}.git${n(`#`,a)}`,filetemplate:({domain:e,user:t,project:n,committish:i,path:a})=>`https://${e}/${t}/${n}/raw/${r(i||`HEAD`)}/${a}`,shortcuttemplate:({type:e,user:t,project:r,committish:i})=>`${e}:${t}/${r}${n(`#`,i)}`,pathtemplate:({user:e,project:t,committish:r})=>`${e}/${t}${n(`#`,r)}`,bugstemplate:({domain:e,user:t,project:n})=>`https://${e}/${t}/${n}/issues`,hashformat:i},o={};o.github={protocols:[`git:`,`http:`,`git+ssh:`,`git+https:`,`ssh:`,`https:`],domain:`github.com`,treepath:`tree`,blobpath:`blob`,editpath:`edit`,filetemplate:({auth:e,user:t,project:i,committish:a,path:o})=>`https://${n(e,`@`)}raw.githubusercontent.com/${t}/${i}/${r(a||`HEAD`)}/${o}`,gittemplate:({auth:e,domain:t,user:r,project:i,committish:a})=>`git://${n(e,`@`)}${t}/${r}/${i}.git${n(`#`,a)}`,tarballtemplate:({domain:e,user:t,project:n,committish:i})=>`https://codeload.${e}/${t}/${n}/tar.gz/${r(i||`HEAD`)}`,extract:e=>{let[,t,n,r,i]=e.pathname.split(`/`,5);if(!(r&&r!==`tree`)&&(r||(i=e.hash.slice(1)),n&&n.endsWith(`.git`)&&(n=n.slice(0,-4)),!(!t||!n)))return{user:t,project:n,committish:i}}},o.bitbucket={protocols:[`git+ssh:`,`git+https:`,`ssh:`,`https:`],domain:`bitbucket.org`,treepath:`src`,blobpath:`src`,editpath:`?mode=edit`,edittemplate:({domain:e,user:t,project:i,committish:a,treepath:o,path:s,editpath:c})=>`https://${e}/${t}/${i}${n(`/`,o,`/`,r(a||`HEAD`),`/`,s,c)}`,tarballtemplate:({domain:e,user:t,project:n,committish:i})=>`https://${e}/${t}/${n}/get/${r(i||`HEAD`)}.tar.gz`,extract:e=>{let[,t,n,r]=e.pathname.split(`/`,4);if(![`get`].includes(r)&&(n&&n.endsWith(`.git`)&&(n=n.slice(0,-4)),!(!t||!n)))return{user:t,project:n,committish:e.hash.slice(1)}}},o.gitlab={protocols:[`git+ssh:`,`git+https:`,`ssh:`,`https:`],domain:`gitlab.com`,treepath:`tree`,blobpath:`tree`,editpath:`-/edit`,httpstemplate:({auth:e,domain:t,user:r,project:i,committish:a})=>`git+https://${n(e,`@`)}${t}/${r}/${i}.git${n(`#`,a)}`,tarballtemplate:({domain:e,user:t,project:n,committish:i})=>`https://${e}/${t}/${n}/repository/archive.tar.gz?ref=${r(i||`HEAD`)}`,extract:e=>{let t=e.pathname.slice(1);if(t.includes(`/-/`)||t.includes(`/archive.tar.gz`))return;let n=t.split(`/`),r=n.pop();r.endsWith(`.git`)&&(r=r.slice(0,-4));let i=n.join(`/`);if(!(!i||!r))return{user:i,project:r,committish:e.hash.slice(1)}}},o.gist={protocols:[`git:`,`git+ssh:`,`git+https:`,`ssh:`,`https:`],domain:`gist.github.com`,editpath:`edit`,sshtemplate:({domain:e,project:t,committish:r})=>`git@${e}:${t}.git${n(`#`,r)}`,sshurltemplate:({domain:e,project:t,committish:r})=>`git+ssh://git@${e}/${t}.git${n(`#`,r)}`,edittemplate:({domain:e,user:t,project:i,committish:a,editpath:o})=>`https://${e}/${t}/${i}${n(`/`,r(a))}/${o}`,browsetemplate:({domain:e,project:t,committish:i})=>`https://${e}/${t}${n(`/`,r(i))}`,browsetreetemplate:({domain:e,project:t,committish:i,path:a,hashformat:o})=>`https://${e}/${t}${n(`/`,r(i))}${n(`#`,o(a))}`,browseblobtemplate:({domain:e,project:t,committish:i,path:a,hashformat:o})=>`https://${e}/${t}${n(`/`,r(i))}${n(`#`,o(a))}`,docstemplate:({domain:e,project:t,committish:i})=>`https://${e}/${t}${n(`/`,r(i))}`,httpstemplate:({domain:e,project:t,committish:r})=>`git+https://${e}/${t}.git${n(`#`,r)}`,filetemplate:({user:e,project:t,committish:i,path:a})=>`https://gist.githubusercontent.com/${e}/${t}/raw${n(`/`,r(i))}/${a}`,shortcuttemplate:({type:e,project:t,committish:r})=>`${e}:${t}${n(`#`,r)}`,pathtemplate:({project:e,committish:t})=>`${e}${n(`#`,t)}`,bugstemplate:({domain:e,project:t})=>`https://${e}/${t}`,gittemplate:({domain:e,project:t,committish:r})=>`git://${e}/${t}.git${n(`#`,r)}`,tarballtemplate:({project:e,committish:t})=>`https://codeload.github.com/gist/${e}/tar.gz/${r(t||`HEAD`)}`,extract:e=>{let[,t,n,r]=e.pathname.split(`/`,4);if(r!==`raw`){if(!n){if(!t)return;n=t,t=null}return n.endsWith(`.git`)&&(n=n.slice(0,-4)),{user:t,project:n,committish:e.hash.slice(1)}}},hashformat:function(e){return e&&`file-`+i(e)}},o.sourcehut={protocols:[`git+ssh:`,`https:`],domain:`git.sr.ht`,treepath:`tree`,blobpath:`tree`,filetemplate:({domain:e,user:t,project:n,committish:i,path:a})=>`https://${e}/${t}/${n}/blob/${r(i)||`HEAD`}/${a}`,httpstemplate:({domain:e,user:t,project:r,committish:i})=>`https://${e}/${t}/${r}.git${n(`#`,i)}`,tarballtemplate:({domain:e,user:t,project:n,committish:i})=>`https://${e}/${t}/${n}/archive/${r(i)||`HEAD`}.tar.gz`,bugstemplate:()=>null,extract:e=>{let[,t,n,r]=e.pathname.split(`/`,4);if(![`archive`].includes(r)&&(n&&n.endsWith(`.git`)&&(n=n.slice(0,-4)),!(!t||!n)))return{user:t,project:n,committish:e.hash.slice(1)}}};for(let[e,t]of Object.entries(o))o[e]=Object.assign({},a,t);t.exports=o})),fe=e.t(((e,t)=>{let n=require(`url`),r=(e,t,n)=>{let r=e.indexOf(n);return e.lastIndexOf(t,r>-1?r:1/0)},i=e=>{try{return new n.URL(e)}catch{}},a=(e,t)=>{let n=e.indexOf(`:`),r=e.slice(0,n+1);if(Object.prototype.hasOwnProperty.call(t,r))return e;let i=e.indexOf(`@`);return i>-1?i>n?`git+ssh://${e}`:e:e.indexOf(`//`)===n+1?e:`${e.slice(0,n+1)}//${e.slice(n+1)}`},o=e=>{let t=r(e,`@`,`#`),n=r(e,`:`,`#`);return n>t&&(e=e.slice(0,n)+`/`+e.slice(n+1)),r(e,`:`,`#`)===-1&&e.indexOf(`//`)===-1&&(e=`git+ssh://${e}`),e};t.exports=(e,t)=>{let n=t?a(e,t):e;return i(n)||i(o(n))}})),pe=e.t(((e,t)=>{let n=fe(),r=e=>{let t=e.indexOf(`#`),n=e.indexOf(`/`),r=e.indexOf(`/`,n+1),i=e.indexOf(`:`),a=/\s/.exec(e),o=e.indexOf(`@`),s=!a||t>-1&&a.index>t,c=o===-1||t>-1&&o>t,l=i===-1||t>-1&&i>t,u=r===-1||t>-1&&r>t,d=n>0,f=t>-1?e[t-1]!==`/`:!e.endsWith(`/`),p=!e.startsWith(`.`);return s&&d&&f&&p&&c&&l&&u};t.exports=(e,t,{gitHosts:i,protocols:a})=>{if(!e)return;let o=n(r(e)?`github:${e}`:e,a);if(!o)return;let s=i.byShortcut[o.protocol],c=i.byDomain[o.hostname.startsWith(`www.`)?o.hostname.slice(4):o.hostname],l=s||c;if(!l)return;let u=i[s||c],d=null;a[o.protocol]?.auth&&(o.username||o.password)&&(d=`${o.username}${o.password?`:`+o.password:``}`);let f=null,p=null,m=null,h=null;try{if(s){let e=o.pathname.startsWith(`/`)?o.pathname.slice(1):o.pathname,t=e.indexOf(`@`);t>-1&&(e=e.slice(t+1));let n=e.lastIndexOf(`/`);n>-1?(p=decodeURIComponent(e.slice(0,n)),p||=null,m=decodeURIComponent(e.slice(n+1))):m=decodeURIComponent(e),m.endsWith(`.git`)&&(m=m.slice(0,-4)),o.hash&&(f=decodeURIComponent(o.hash.slice(1))),h=`shortcut`}else{if(!u.protocols.includes(o.protocol))return;let e=u.extract(o);if(!e)return;p=e.user&&decodeURIComponent(e.user),m=decodeURIComponent(e.project),f=decodeURIComponent(e.committish),h=a[o.protocol]?.name||o.protocol.slice(0,-1)}}catch(e){if(e instanceof URIError)return;throw e}return[l,p,d,m,f,h,t]}})),me=e.t(((e,t)=>{let{LRUCache:n}=ue(),r=de(),i=pe(),a=fe(),o=new n({max:1e3});var s=class e{constructor(t,n,r,i,a,o,s={}){Object.assign(this,e.#e[t],{type:t,user:n,auth:r,project:i,committish:a,default:o,opts:s})}static#e={byShortcut:{},byDomain:{}};static#t={"git+ssh:":{name:`sshurl`},"ssh:":{name:`sshurl`},"git+https:":{name:`https`,auth:!0},"git:":{auth:!0},"http:":{auth:!0},"https:":{auth:!0},"git+http:":{auth:!0}};static addHost(t,n){e.#e[t]=n,e.#e.byDomain[n.domain]=t,e.#e.byShortcut[`${t}:`]=t,e.#t[`${t}:`]={name:t}}static fromUrl(t,n){if(typeof t!=`string`)return;let r=t+JSON.stringify(n||{});if(!o.has(r)){let a=i(t,n,{gitHosts:e.#e,protocols:e.#t});o.set(r,a?new e(...a):void 0)}return o.get(r)}static parseUrl(e){return a(e)}#n(e,t){if(typeof e!=`function`)return null;let n={...this,...this.opts,...t};n.path||=``,n.path.startsWith(`/`)&&(n.path=n.path.slice(1)),n.noCommittish&&(n.committish=null);let r=e(n);return n.noGitPlus&&r.startsWith(`git+`)?r.slice(4):r}hash(){return this.committish?`#${this.committish}`:``}ssh(e){return this.#n(this.sshtemplate,e)}sshurl(e){return this.#n(this.sshurltemplate,e)}browse(e,...t){return typeof e==`string`?typeof t[0]==`string`?this.#n(this.browsetreetemplate,{...t[1],fragment:t[0],path:e}):this.#n(this.browsetreetemplate,{...t[0],path:e}):this.#n(this.browsetemplate,e)}browseFile(e,...t){return typeof t[0]==`string`?this.#n(this.browseblobtemplate,{...t[1],fragment:t[0],path:e}):this.#n(this.browseblobtemplate,{...t[0],path:e})}docs(e){return this.#n(this.docstemplate,e)}bugs(e){return this.#n(this.bugstemplate,e)}https(e){return this.#n(this.httpstemplate,e)}git(e){return this.#n(this.gittemplate,e)}shortcut(e){return this.#n(this.shortcuttemplate,e)}path(e){return this.#n(this.pathtemplate,e)}tarball(e){return this.#n(this.tarballtemplate,{...e,noCommittish:!1})}file(e,t){return this.#n(this.filetemplate,{...t,path:e})}edit(e,t){return this.#n(this.edittemplate,{...t,path:e})}getDefaultRepresentation(){return this.default}toString(e){return this.default&&typeof this[this.default]==`function`?this[this.default](e):this.sshurl(e)}};for(let[e,t]of Object.entries(r))s.addHost(e,t);t.exports=s})),he=e.t(((e,t)=>{t.exports=n;function n(e){if(!e||e===`ERROR: No README data found!`)return;e=e.trim().split(`
`);let t=0;for(;e[t]&&e[t].trim().match(/^(#|$)/);)t++;let n=e.length,r=t+1;for(;r<n&&e[r].trim();)r++;return e.slice(t,r).join(` `).trim()}})),ge=e.t(((e,t)=>{t.exports={topLevel:{dependancies:`dependencies`,dependecies:`dependencies`,depdenencies:`dependencies`,devEependencies:`devDependencies`,depends:`dependencies`,"dev-dependencies":`devDependencies`,devDependences:`devDependencies`,devDepenencies:`devDependencies`,devdependencies:`devDependencies`,repostitory:`repository`,repo:`repository`,prefereGlobal:`preferGlobal`,hompage:`homepage`,hampage:`homepage`,autohr:`author`,autor:`author`,contributers:`contributors`,publicationConfig:`publishConfig`,script:`scripts`},bugs:{web:`url`,name:`url`},script:{server:`start`,tests:`test`}}})),_e=e.t(((e,n)=>{var r=require(`semver/functions/valid.js`),i=require(`semver/functions/clean.js`),a=t.d(),o=me(),s=require(`node:module`),c=[`dependencies`,`devDependencies`,`optionalDependencies`],l=he(),u=require(`url`),d=ge(),f=e=>e.includes(`@`)&&e.indexOf(`@`)<e.lastIndexOf(`.`);n.exports={warn:function(){},fixRepositoryField:function(e){if(e.repositories&&(this.warn(`repositories`),e.repository=e.repositories[0]),!e.repository)return this.warn(`missingRepository`);typeof e.repository==`string`&&(e.repository={type:`git`,url:e.repository});var t=e.repository.url||``;if(t){var n=o.fromUrl(t);n&&(t=e.repository.url=n.getDefaultRepresentation()===`shortcut`?n.https():n.toString())}t.match(/github.com\/[^/]+\/[^/]+\.git\.git$/)&&this.warn(`brokenGitUrl`,t)},fixTypos:function(e){Object.keys(d.topLevel).forEach(function(t){Object.prototype.hasOwnProperty.call(e,t)&&this.warn(`typo`,t,d.topLevel[t])},this)},fixScriptsField:function(e){if(e.scripts){if(typeof e.scripts!=`object`){this.warn(`nonObjectScripts`),delete e.scripts;return}Object.keys(e.scripts).forEach(function(t){typeof e.scripts[t]==`string`?d.script[t]&&!e.scripts[d.script[t]]&&this.warn(`typo`,t,d.script[t],`scripts`):(this.warn(`nonStringScript`),delete e.scripts[t])},this)}},fixFilesField:function(e){var t=e.files;t&&!Array.isArray(t)?(this.warn(`nonArrayFiles`),delete e.files):e.files&&=e.files.filter(function(e){return!e||typeof e!=`string`?(this.warn(`invalidFilename`,e),!1):!0},this)},fixBinField:function(e){if(e.bin&&typeof e.bin==`string`){var t={},n;(n=e.name.match(/^@[^/]+[/](.*)$/))?t[n[1]]=e.bin:t[e.name]=e.bin,e.bin=t}},fixManField:function(e){e.man&&typeof e.man==`string`&&(e.man=[e.man])},fixBundleDependenciesField:function(e){var t=`bundledDependencies`,n=`bundleDependencies`;e[t]&&!e[n]&&(e[n]=e[t],delete e[t]),e[n]&&!Array.isArray(e[n])?(this.warn(`nonArrayBundleDependencies`),delete e[n]):e[n]&&(e[n]=e[n].filter(function(t){return!t||typeof t!=`string`?(this.warn(`nonStringBundleDependency`,t),!1):(e.dependencies||={},Object.prototype.hasOwnProperty.call(e.dependencies,t)||(this.warn(`nonDependencyBundleDependency`,t),e.dependencies[t]=`*`),!0)},this))},fixDependencies:function(e){ee(e,this.warn),y(e,this.warn),this.fixBundleDependenciesField(e),[`dependencies`,`devDependencies`].forEach(function(t){if(t in e){if(!e[t]||typeof e[t]!=`object`){this.warn(`nonObjectDependencies`,t),delete e[t];return}Object.keys(e[t]).forEach(function(n){var r=e[t][n];typeof r!=`string`&&(this.warn(`nonStringDependency`,n,JSON.stringify(r)),delete e[t][n]);var i=o.fromUrl(e[t][n]);i&&(e[t][n]=i.toString())},this)}},this)},fixModulesField:function(e){e.modules&&(this.warn(`deprecatedModules`),delete e.modules)},fixKeywordsField:function(e){typeof e.keywords==`string`&&(e.keywords=e.keywords.split(/,\s+/)),e.keywords&&!Array.isArray(e.keywords)?(delete e.keywords,this.warn(`nonArrayKeywords`)):e.keywords&&=e.keywords.filter(function(e){return typeof e!=`string`||!e?(this.warn(`nonStringKeyword`),!1):!0},this)},fixVersionField:function(e,t){var n=!t;if(!e.version)return e.version=``,!0;if(!r(e.version,n))throw Error(`Invalid version: "`+e.version+`"`);return e.version=i(e.version,n),!0},fixPeople:function(e){g(e,_),g(e,v)},fixNameField:function(e,t){typeof t==`boolean`?t={strict:t}:t===void 0&&(t={});var n=t.strict;if(!e.name&&!n){e.name=``;return}if(typeof e.name!=`string`)throw Error(`name field must be a string.`);n||(e.name=e.name.trim()),h(e.name,n,t.allowLegacyCase),s.builtinModules.includes(e.name)&&this.warn(`conflictingName`,e.name)},fixDescriptionField:function(e){e.description&&typeof e.description!=`string`&&(this.warn(`nonStringDescription`),delete e.description),e.readme&&!e.description&&(e.description=l(e.readme)),e.description===void 0&&delete e.description,e.description||this.warn(`missingDescription`)},fixReadmeField:function(e){e.readme||=(this.warn(`missingReadme`),`ERROR: No README data found!`)},fixBugsField:function(e){if(!e.bugs&&e.repository&&e.repository.url){var t=o.fromUrl(e.repository.url);t&&t.bugs()&&(e.bugs={url:t.bugs()})}else if(e.bugs){if(typeof e.bugs==`string`)f(e.bugs)?e.bugs={email:e.bugs}:u.parse(e.bugs).protocol?e.bugs={url:e.bugs}:this.warn(`nonEmailUrlBugsString`);else{x(e.bugs,this.warn);var n=e.bugs;e.bugs={},n.url&&(typeof n.url==`string`&&u.parse(n.url).protocol?e.bugs.url=n.url:this.warn(`nonUrlBugsUrlField`)),n.email&&(typeof n.email==`string`&&f(n.email)?e.bugs.email=n.email:this.warn(`nonEmailBugsEmailField`))}!e.bugs.email&&!e.bugs.url&&(delete e.bugs,this.warn(`emptyNormalizedBugs`))}},fixHomepageField:function(e){if(!e.homepage&&e.repository&&e.repository.url){var t=o.fromUrl(e.repository.url);t&&t.docs()&&(e.homepage=t.docs())}if(e.homepage){if(typeof e.homepage!=`string`)return this.warn(`nonUrlHomepage`),delete e.homepage;u.parse(e.homepage).protocol||(e.homepage=`http://`+e.homepage)}},fixLicenseField:function(e){let t=e.license||e.licence;if(!t)return this.warn(`missingLicense`);if(typeof t!=`string`||t.length<1||t.trim()===``||!a(t).validForNewPackages)return this.warn(`invalidLicense`)}};function p(e){if(e.charAt(0)!==`@`)return!1;var t=e.slice(1).split(`/`);return t.length===2?t[0]&&t[1]&&t[0]===encodeURIComponent(t[0])&&t[1]===encodeURIComponent(t[1]):!1}function m(e){return!e.match(/[/@\s+%:]/)&&e===encodeURIComponent(e)}function h(e,t,n){if(e.charAt(0)===`.`||!(p(e)||m(e))||t&&!n&&e!==e.toLowerCase()||e.toLowerCase()===`node_modules`||e.toLowerCase()===`favicon.ico`)throw Error(`Invalid name: `+JSON.stringify(e))}function g(e,t){return e.author&&=t(e.author),[`maintainers`,`contributors`].forEach(function(n){Array.isArray(e[n])&&(e[n]=e[n].map(t))}),e}function _(e){if(typeof e==`string`)return e;var t=e.name||``,n=e.url||e.web,r=n?` (`+n+`)`:``,i=e.email||e.mail;return t+(i?` <`+i+`>`:``)+r}function v(e){if(typeof e!=`string`)return e;var t=e.match(/^([^(<]+)/),n=e.match(/\(([^()]+)\)/),r=e.match(/<([^<>]+)>/),i={};return t&&t[0].trim()&&(i.name=t[0].trim()),r&&(i.email=r[1]),n&&(i.url=n[1]),i}function y(e){var t=e.optionalDependencies;if(t){var n=e.dependencies||{};Object.keys(t).forEach(function(e){n[e]=t[e]}),e.dependencies=n}}function b(e,t,n){if(!e)return{};if(typeof e==`string`&&(e=e.trim().split(/[\n\r\s\t ,]+/)),!Array.isArray(e))return e;n(`deprecatedArrayDependencies`,t);var r={};return e.filter(function(e){return typeof e==`string`}).forEach(function(e){e=e.trim().split(/(:?[@\s><=])/);var t=e.shift(),n=e.join(``);n=n.trim(),n=n.replace(/^@/,``),r[t]=n}),r}function ee(e,t){c.forEach(function(n){e[n]&&(e[n]=b(e[n],n,t))})}function x(e,t){e&&Object.keys(e).forEach(function(n){d.bugs[n]&&(t(`typo`,n,d.bugs[n],`bugs`),e[d.bugs[n]]=e[n],delete e[n])})}})),ve=e.t(((e,t)=>{t.exports={repositories:`'repositories' (plural) Not supported. Please pick one as the 'repository' field`,missingRepository:`No repository field.`,brokenGitUrl:`Probably broken git url: %s`,nonObjectScripts:`scripts must be an object`,nonStringScript:`script values must be string commands`,nonArrayFiles:`Invalid 'files' member`,invalidFilename:`Invalid filename in 'files' list: %s`,nonArrayBundleDependencies:`Invalid 'bundleDependencies' list. Must be array of package names`,nonStringBundleDependency:`Invalid bundleDependencies member: %s`,nonDependencyBundleDependency:`Non-dependency in bundleDependencies: %s`,nonObjectDependencies:`%s field must be an object`,nonStringDependency:`Invalid dependency: %s %s`,deprecatedArrayDependencies:`specifying %s as array is deprecated`,deprecatedModules:`modules field is deprecated`,nonArrayKeywords:`keywords should be an array of strings`,nonStringKeyword:`keywords should be an array of strings`,conflictingName:`%s is also the name of a node core module.`,nonStringDescription:`'description' field should be a string`,missingDescription:`No description`,missingReadme:`No README data`,missingLicense:`No license field.`,nonEmailUrlBugsString:`Bug string field must be url, email, or {email,url}`,nonUrlBugsUrlField:`bugs.url field must be a string url. Deleted.`,nonEmailBugsEmailField:`bugs.email field must be a string email. Deleted.`,emptyNormalizedBugs:`Normalized value of bugs field is an empty object. Deleted.`,nonUrlHomepage:`homepage field must be a string url. Deleted.`,invalidLicense:`license should be a valid SPDX license expression`,typo:`%s should probably be %s.`}})),ye=e.t(((e,t)=>{var n=require(`util`),r=ve();t.exports=function(){var e=Array.prototype.slice.call(arguments,0),t=e.shift();if(t===`typo`)return i.apply(null,e);var a=r[t]?r[t]:t+`: '%s'`;return e.unshift(a),n.format.apply(null,e)};function i(e,t,i){return i&&(e=i+`['`+e+`']`,t=i+`['`+t+`']`),n.format(r.typo,e,t)}})),be=e.t(((e,t)=>{t.exports=s;var n=_e();s.fixer=n;var r=ye(),i=[`name`,`version`,`description`,`repository`,`modules`,`scripts`,`files`,`bin`,`man`,`bugs`,`keywords`,`readme`,`homepage`,`license`],a=[`dependencies`,`people`,`typos`],o=i.map(function(e){return c(e)+`Field`});o=o.concat(a);function s(e,t,i){t===!0&&(t=null,i=!0),i||=!1,(!t||e.private)&&(t=function(){}),e.scripts&&e.scripts.install===`node-gyp rebuild`&&!e.scripts.preinstall&&(e.gypfile=!0),n.warn=function(){t(r.apply(null,arguments))},o.forEach(function(t){n[`fix`+c(t)](e,i)}),e._id=e.name+`@`+e.version}function c(e){return e.charAt(0).toUpperCase()+e.slice(1)}})),xe=e.a(be(),1);function Se(e){return e instanceof URL?(0,h.fileURLToPath)(e):e}const Ce=e=>f.default.resolve(Se(e)??`.`,`package.json`),we=(e,t)=>{let n=typeof e==`string`?le(e):e;return t&&(0,xe.default)(n),n};async function Te({cwd:e,normalize:t=!0}={}){return we(await m.default.readFile(Ce(e),`utf8`),t)}async function Ee(e){let t=await x(`package.json`,e);if(t)return{packageJson:await Te({...e,cwd:f.default.dirname(t)}),path:t}}var De=e.t(((e,t)=>{let n={to(e,t){return t?`[${t+1};${e+1}H`:`[${e+1}G`},move(e,t){let n=``;return e<0?n+=`[${-e}D`:e>0&&(n+=`[${e}C`),t<0?n+=`[${-t}A`:t>0&&(n+=`[${t}B`),n},up:(e=1)=>`[${e}A`,down:(e=1)=>`[${e}B`,forward:(e=1)=>`[${e}C`,backward:(e=1)=>`[${e}D`,nextLine:(e=1)=>`\x1B[E`.repeat(e),prevLine:(e=1)=>`\x1B[F`.repeat(e),left:`\x1B[G`,hide:`\x1B[?25l`,show:`\x1B[?25h`,save:`\x1B7`,restore:`\x1B8`};t.exports={cursor:n,scroll:{up:(e=1)=>`\x1B[S`.repeat(e),down:(e=1)=>`\x1B[T`.repeat(e)},erase:{screen:`\x1B[2J`,up:(e=1)=>`\x1B[1J`.repeat(e),down:(e=1)=>`\x1B[J`.repeat(e),line:`\x1B[2K`,lineEnd:`\x1B[K`,lineStart:`\x1B[1K`,lines(e){let t=``;for(let r=0;r<e;r++)t+=this.line+(r<e-1?n.up():``);return e&&(t+=n.left),t}},beep:`\x07`}}));const Oe=(e=0)=>t=>`\u001B[${t+e}m`,ke=(e=0)=>t=>`\u001B[${38+e};5;${t}m`,Ae=(e=0)=>(t,n,r)=>`\u001B[${38+e};2;${t};${n};${r}m`,S={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};Object.keys(S.modifier);const je=Object.keys(S.color),Me=Object.keys(S.bgColor);[...je,...Me];function Ne(){let e=new Map;for(let[t,n]of Object.entries(S)){for(let[t,r]of Object.entries(n))S[t]={open:`\u001B[${r[0]}m`,close:`\u001B[${r[1]}m`},n[t]=S[t],e.set(r[0],r[1]);Object.defineProperty(S,t,{value:n,enumerable:!1})}return Object.defineProperty(S,`codes`,{value:e,enumerable:!1}),S.color.close=`\x1B[39m`,S.bgColor.close=`\x1B[49m`,S.color.ansi=Oe(),S.color.ansi256=ke(),S.color.ansi16m=Ae(),S.bgColor.ansi=Oe(10),S.bgColor.ansi256=ke(10),S.bgColor.ansi16m=Ae(10),Object.defineProperties(S,{rgbToAnsi256:{value(e,t,n){return e===t&&t===n?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(t/255*5)+Math.round(n/255*5)},enumerable:!1},hexToRgb:{value(e){let t=/[a-f\d]{6}|[a-f\d]{3}/i.exec(e.toString(16));if(!t)return[0,0,0];let[n]=t;n.length===3&&(n=[...n].map(e=>e+e).join(``));let r=Number.parseInt(n,16);return[r>>16&255,r>>8&255,r&255]},enumerable:!1},hexToAnsi256:{value:e=>S.rgbToAnsi256(...S.hexToRgb(e)),enumerable:!1},ansi256ToAnsi:{value(e){if(e<8)return 30+e;if(e<16)return 90+(e-8);let t,n,r;if(e>=232)t=((e-232)*10+8)/255,n=t,r=t;else{e-=16;let i=e%36;t=Math.floor(e/36)/5,n=Math.floor(i/6)/5,r=i%6/5}let i=Math.max(t,n,r)*2;if(i===0)return 30;let a=30+(Math.round(r)<<2|Math.round(n)<<1|Math.round(t));return i===2&&(a+=60),a},enumerable:!1},rgbToAnsi:{value:(e,t,n)=>S.ansi256ToAnsi(S.rgbToAnsi256(e,t,n)),enumerable:!1},hexToAnsi:{value:e=>S.ansi256ToAnsi(S.hexToAnsi256(e)),enumerable:!1}}),S}const Pe=Ne();function Fe(e){return t=>t.length>1?`${e} run ${t[0]} -- ${t.slice(1).join(` `)}`:`${e} run ${t[0]}`}const Ie={agent:`yarn {0}`,run:`yarn run {0}`,install:`yarn install {0}`,frozen:`yarn install --frozen-lockfile`,global:`yarn global add {0}`,add:`yarn add {0}`,upgrade:`yarn upgrade {0}`,"upgrade-interactive":`yarn upgrade-interactive {0}`,execute:`npx {0}`,uninstall:`yarn remove {0}`,global_uninstall:`yarn global remove {0}`},Le={agent:`pnpm {0}`,run:`pnpm run {0}`,install:`pnpm i {0}`,frozen:`pnpm i --frozen-lockfile`,global:`pnpm add -g {0}`,add:`pnpm add {0}`,upgrade:`pnpm update {0}`,"upgrade-interactive":`pnpm update -i {0}`,execute:`pnpm dlx {0}`,uninstall:`pnpm remove {0}`,global_uninstall:`pnpm remove --global {0}`},Re={agent:`bun {0}`,run:`bun run {0}`,install:`bun install {0}`,frozen:`bun install --no-save`,global:`bun add -g {0}`,add:`bun add {0}`,upgrade:`bun update {0}`,"upgrade-interactive":`bun update {0}`,execute:`bunx {0}`,uninstall:`bun remove {0}`,global_uninstall:`bun remove -g {0}`},ze={npm:{agent:`npm {0}`,run:Fe(`npm`),install:`npm i {0}`,frozen:`npm ci`,global:`npm i -g {0}`,add:`npm i {0}`,upgrade:`npm update {0}`,"upgrade-interactive":null,execute:`npx {0}`,uninstall:`npm uninstall {0}`,global_uninstall:`npm uninstall -g {0}`},yarn:Ie,"yarn@berry":{...Ie,frozen:`yarn install --immutable`,upgrade:`yarn up {0}`,"upgrade-interactive":`yarn up -i {0}`,execute:`yarn dlx {0}`,global:`npm i -g {0}`,global_uninstall:`npm uninstall -g {0}`},pnpm:Le,"pnpm@6":{...Le,run:Fe(`pnpm`)},bun:Re},Be=Object.keys(ze),Ve={"bun.lockb":`bun`,"pnpm-lock.yaml":`pnpm`,"yarn.lock":`yarn`,"package-lock.json":`npm`,"npm-shrinkwrap.json":`npm`},He={bun:`https://bun.sh`,pnpm:`https://pnpm.io/installation`,"pnpm@6":`https://pnpm.io/6.x/installation`,yarn:`https://classic.yarnpkg.com/en/docs/install`,"yarn@berry":`https://yarnpkg.com/getting-started/install`,npm:`https://docs.npmjs.com/cli/v8/configuring-npm/install`};var C=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{};function w(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,`default`)?e.default:e}const{hasOwnProperty:Ue}=Object.prototype,We=(e,t={})=>{typeof t==`string`&&(t={section:t}),t.align=t.align===!0,t.newline=t.newline===!0,t.sort=t.sort===!0,t.whitespace=t.whitespace===!0||t.align===!0,t.platform=t.platform||typeof process<`u`&&process.platform,t.bracketedArray=t.bracketedArray!==!1;let n=t.platform===`win32`?`\r
`:`
`,r=t.whitespace?` = `:`=`,i=[],a=t.sort?Object.keys(e).sort():Object.keys(e),o=0;t.align&&(o=T(a.filter(t=>e[t]===null||Array.isArray(e[t])||typeof e[t]!=`object`).map(t=>Array.isArray(e[t])?`${t}[]`:t).concat([``]).reduce((e,t)=>T(e).length>=T(t).length?e:t)).length);let s=``,c=t.bracketedArray?`[]`:``;for(let t of a){let a=e[t];if(a&&Array.isArray(a))for(let e of a)s+=T(`${t}${c}`).padEnd(o,` `)+r+T(e)+n;else a&&typeof a==`object`?i.push(t):s+=T(t).padEnd(o,` `)+r+T(a)+n}t.section&&s.length&&(s=`[`+T(t.section)+`]`+(t.newline?n+n:n)+s);for(let r of i){let i=Ge(r,`.`).join(`\\.`),a=(t.section?t.section+`.`:``)+i,o=We(e[r],{...t,section:a});s.length&&o.length&&(s+=n),s+=o}return s};function Ge(e,t){var n=0,r=0,i=0,a=[];do if(i=e.indexOf(t,n),i!==-1){if(n=i+t.length,i>0&&e[i-1]===`\\`)continue;a.push(e.slice(r,i)),r=i+t.length}while(i!==-1);return a.push(e.slice(r)),a}const Ke=(e,t={})=>{t.bracketedArray=t.bracketedArray!==!1;let n=Object.create(null),r=n,i=null,a=/^\[([^\]]*)\]\s*$|^([^=]+)(=(.*))?$/i,o=e.split(/[\r\n]+/g),s={};for(let e of o){if(!e||e.match(/^\s*[;#]/)||e.match(/^\s*$/))continue;let o=e.match(a);if(!o)continue;if(o[1]!==void 0){if(i=Je(o[1]),i===`__proto__`){r=Object.create(null);continue}r=n[i]=n[i]||Object.create(null);continue}let c=Je(o[2]),l;t.bracketedArray?l=c.length>2&&c.slice(-2)===`[]`:(s[c]=(s?.[c]||0)+1,l=s[c]>1);let u=l?c.slice(0,-2):c;if(u===`__proto__`)continue;let d=o[3]?Je(o[4]):!0,f=d===`true`||d===`false`||d===`null`?JSON.parse(d):d;l&&(Ue.call(r,u)?Array.isArray(r[u])||(r[u]=[r[u]]):r[u]=[]),Array.isArray(r[u])?r[u].push(f):r[u]=f}let c=[];for(let e of Object.keys(n)){if(!Ue.call(n,e)||typeof n[e]!=`object`||Array.isArray(n[e]))continue;let t=Ge(e,`.`);r=n;let i=t.pop(),a=i.replace(/\\\./g,`.`);for(let e of t)e!==`__proto__`&&((!Ue.call(r,e)||typeof r[e]!=`object`)&&(r[e]=Object.create(null)),r=r[e]);r===n&&a===i||(r[a]=n[e],c.push(e))}for(let e of c)delete n[e];return n},qe=e=>e.startsWith(`"`)&&e.endsWith(`"`)||e.startsWith(`'`)&&e.endsWith(`'`),T=e=>typeof e!=`string`||e.match(/[=\r\n]/)||e.match(/^\[/)||e.length>1&&qe(e)||e!==e.trim()?JSON.stringify(e):e.split(`;`).join(`\\;`).split(`#`).join(`\\#`),Je=(e,t)=>{if(e=(e||``).trim(),qe(e)){e.charAt(0)===`'`&&(e=e.slice(1,-1));try{e=JSON.parse(e)}catch{}}else{let t=!1,n=``;for(let r=0,i=e.length;r<i;r++){let i=e.charAt(r);if(t)`\\;#`.indexOf(i)===-1?n+=`\\`+i:n+=i,t=!1;else if(`;#`.indexOf(i)!==-1)break;else i===`\\`?t=!0:n+=i}return t&&(n+=`\\`),n.trim()}return e},Ye=w({parse:Ke,decode:Ke,stringify:We,encode:We,safe:T,unsafe:Je});var E={exports:{}},Xe,Ze;function Qe(){if(Ze)return Xe;Ze=1,Xe=i,i.sync=a;var e=n.default;function t(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 r(e,n,r){return!e.isSymbolicLink()&&!e.isFile()?!1:t(n,r)}function i(t,n,i){e.stat(t,function(e,a){i(e,e?!1:r(a,t,n))})}function a(t,n){return r(e.statSync(t),t,n)}return Xe}var $e,et;function tt(){if(et)return $e;et=1,$e=t,t.sync=r;var e=n.default;function t(t,n,r){e.stat(t,function(e,t){r(e,e?!1:i(t,n))})}function r(t,n){return i(e.statSync(t),n)}function i(e,t){return e.isFile()&&a(e,t)}function a(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}return $e}var nt=process.platform===`win32`||C.TESTING_WINDOWS?Qe():tt(),rt=it;it.sync=at;function it(e,t,n){if(typeof t==`function`&&(n=t,t={}),!n){if(typeof Promise!=`function`)throw TypeError(`callback not provided`);return new Promise(function(n,r){it(e,t||{},function(e,t){e?r(e):n(t)})})}nt(e,t||{},function(e,r){e&&(e.code===`EACCES`||t&&t.ignoreErrors)&&(e=null,r=!1),n(e,r)})}function at(e,t){try{return nt.sync(e,t||{})}catch(e){if(t&&t.ignoreErrors||e.code===`EACCES`)return!1;throw e}}const D=process.platform===`win32`||process.env.OSTYPE===`cygwin`||process.env.OSTYPE===`msys`,ot=r.default,st=D?`;`:`:`,ct=rt,lt=e=>Object.assign(Error(`not found: ${e}`),{code:`ENOENT`}),ut=(e,t)=>{let n=t.colon||st,r=e.match(/\//)||D&&e.match(/\\/)?[``]:[...D?[process.cwd()]:[],...(t.path||process.env.PATH||``).split(n)],i=D?t.pathExt||process.env.PATHEXT||`.EXE;.CMD;.BAT;.COM`:``,a=D?i.split(n):[``];return D&&e.indexOf(`.`)!==-1&&a[0]!==``&&a.unshift(``),{pathEnv:r,pathExt:a,pathExtExe:i}},dt=(e,t,n)=>{typeof t==`function`&&(n=t,t={}),t||={};let{pathEnv:r,pathExt:i,pathExtExe:a}=ut(e,t),o=[],s=n=>new Promise((i,a)=>{if(n===r.length)return t.all&&o.length?i(o):a(lt(e));let s=r[n],l=/^".*"$/.test(s)?s.slice(1,-1):s,u=ot.join(l,e);i(c(!l&&/^\.[\\\/]/.test(e)?e.slice(0,2)+u:u,n,0))}),c=(e,n,r)=>new Promise((l,u)=>{if(r===i.length)return l(s(n+1));let d=i[r];ct(e+d,{pathExt:a},(i,a)=>{if(!i&&a)if(t.all)o.push(e+d);else return l(e+d);return l(c(e,n,r+1))})});return n?s(0).then(e=>n(null,e),n):s(0)},ft=(e,t)=>{t||={};let{pathEnv:n,pathExt:r,pathExtExe:i}=ut(e,t),a=[];for(let o=0;o<n.length;o++){let s=n[o],c=/^".*"$/.test(s)?s.slice(1,-1):s,l=ot.join(c,e),u=!c&&/^\.[\\\/]/.test(e)?e.slice(0,2)+l:l;for(let e=0;e<r.length;e++){let n=u+r[e];try{if(ct.sync(n,{pathExt:i}))if(t.all)a.push(n);else return n}catch{}}}if(t.all&&a.length)return a;if(t.nothrow)return null;throw lt(e)};var pt=dt;dt.sync=ft;var mt={exports:{}};const ht=(e={})=>{let t=e.env||process.env;return(e.platform||process.platform)===`win32`?Object.keys(t).reverse().find(e=>e.toUpperCase()===`PATH`)||`Path`:`PATH`};mt.exports=ht,mt.exports.default=ht;var gt=mt.exports;const _t=r.default,vt=pt,yt=gt;function bt(e,t){let n=e.options.env||process.env,r=process.cwd(),i=e.options.cwd!=null,a=i&&process.chdir!==void 0&&!process.chdir.disabled;if(a)try{process.chdir(e.options.cwd)}catch{}let o;try{o=vt.sync(e.command,{path:n[yt({env:n})],pathExt:t?_t.delimiter:void 0})}catch{}finally{a&&process.chdir(r)}return o&&=_t.resolve(i?e.options.cwd:``,o),o}function xt(e){return bt(e)||bt(e,!0)}var St=xt,Ct={};const wt=/([()\][%!^"`<>&|;, *?])/g;function Tt(e){return e=e.replace(wt,`^$1`),e}function Et(e,t){return e=`${e}`,e=e.replace(/(\\*)"/g,`$1$1\\"`),e=e.replace(/(\\*)$/,`$1$1`),e=`"${e}"`,e=e.replace(wt,`^$1`),t&&(e=e.replace(wt,`^$1`)),e}Ct.command=Tt,Ct.argument=Et;const Dt=/^#!(.*)/;var Ot=(e=``)=>{let t=e.match(Dt);if(!t)return null;let[n,r]=t[0].replace(/#! ?/,``).split(` `),i=n.split(`/`).pop();return i===`env`?r:r?`${i} ${r}`:i};const kt=n.default,At=Ot;function jt(e){let t=Buffer.alloc(150),n;try{n=kt.openSync(e,`r`),kt.readSync(n,t,0,150,0),kt.closeSync(n)}catch{}return At(t.toString())}var Mt=jt;const Nt=r.default,Pt=St,Ft=Ct,It=Mt,Lt=process.platform===`win32`,Rt=/\.(?:com|exe)$/i,zt=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function Bt(e){e.file=Pt(e);let t=e.file&&It(e.file);return t?(e.args.unshift(e.file),e.command=t,Pt(e)):e.file}function Vt(e){if(!Lt)return e;let t=Bt(e),n=!Rt.test(t);if(e.options.forceShell||n){let n=zt.test(t);e.command=Nt.normalize(e.command),e.command=Ft.command(e.command),e.args=e.args.map(e=>Ft.argument(e,n)),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 Ht(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:Vt(r)}var Ut=Ht;const Wt=process.platform===`win32`;function Gt(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 Kt(e,t){if(!Wt)return;let n=e.emit;e.emit=function(r,i){if(r===`exit`){let r=qt(i,t);if(r)return n.call(e,`error`,r)}return n.apply(e,arguments)}}function qt(e,t){return Wt&&e===1&&!t.file?Gt(t.original,`spawn`):null}function Jt(e,t){return Wt&&e===1&&!t.file?Gt(t.original,`spawnSync`):null}var Yt={hookChildProcess:Kt,verifyENOENT:qt,verifyENOENTSync:Jt,notFoundError:Gt};const Xt=s.default,Zt=Ut,Qt=Yt;function $t(e,t,n){let r=Zt(e,t,n),i=Xt.spawn(r.command,r.args,r.options);return Qt.hookChildProcess(i,r),i}function en(e,t,n){let r=Zt(e,t,n),i=Xt.spawnSync(r.command,r.args,r.options);return i.error=i.error||Qt.verifyENOENTSync(i.status,r),i}E.exports=$t,E.exports.spawn=$t,E.exports.sync=en,E.exports._parse=Zt,E.exports._enoent=Qt;var tn=E.exports;const nn=w(tn);function rn(e){let t=typeof e==`string`?`
`:10,n=typeof e==`string`?`\r`:13;return e[e.length-1]===t&&(e=e.slice(0,-1)),e[e.length-1]===n&&(e=e.slice(0,-1)),e}function an(e={}){let{env:t=process.env,platform:n=process.platform}=e;return n===`win32`?Object.keys(t).reverse().find(e=>e.toUpperCase()===`PATH`)||`Path`:`PATH`}function on(e={}){let{cwd:t=p.default.cwd(),path:n=p.default.env[an()],execPath:r=p.default.execPath}=e,i,a=t instanceof URL?h.default.fileURLToPath(t):t,o=f.default.resolve(a),s=[];for(;i!==o;)s.push(f.default.join(o,`node_modules/.bin`)),i=o,o=f.default.resolve(o,`..`);return s.push(f.default.resolve(a,r,`..`)),[...s,n].join(f.default.delimiter)}function sn({env:e=p.default.env,...t}={}){e={...e};let n=an({env:e});return t.path=e[n],e[n]=on(t),e}const cn=(e,t,n,r)=>{if(n===`length`||n===`prototype`||n===`arguments`||n===`caller`)return;let i=Object.getOwnPropertyDescriptor(e,n),a=Object.getOwnPropertyDescriptor(t,n);!ln(i,a)&&r||Object.defineProperty(e,n,a)},ln=function(e,t){return e===void 0||e.configurable||e.writable===t.writable&&e.enumerable===t.enumerable&&e.configurable===t.configurable&&(e.writable||e.value===t.value)},un=(e,t)=>{let n=Object.getPrototypeOf(t);n!==Object.getPrototypeOf(e)&&Object.setPrototypeOf(e,n)},dn=(e,t)=>`/* Wrapped ${e}*/\n${t}`,fn=Object.getOwnPropertyDescriptor(Function.prototype,`toString`),pn=Object.getOwnPropertyDescriptor(Function.prototype.toString,`name`),mn=(e,t,n)=>{let r=n===``?``:`with ${n.trim()}() `,i=dn.bind(null,r,t.toString());Object.defineProperty(i,`name`,pn),Object.defineProperty(e,`toString`,{...fn,value:i})};function hn(e,t,{ignoreNonConfigurable:n=!1}={}){let{name:r}=e;for(let r of Reflect.ownKeys(t))cn(e,t,r,n);return un(e,t),mn(e,t,r),e}const gn=new WeakMap,_n=(e,t={})=>{if(typeof e!=`function`)throw TypeError(`Expected a function`);let n,r=0,i=e.displayName||e.name||`<anonymous>`,a=function(...o){if(gn.set(a,++r),r===1)n=e.apply(this,o),e=null;else if(t.throw===!0)throw Error(`Function \`${i}\` can only be called once`);return n};return hn(a,e),gn.set(a,r),a};_n.callCount=e=>{if(!gn.has(e))throw Error(`The given function \`${e.name}\` is not wrapped by the \`onetime\` package`);return gn.get(e)};const vn=()=>{let e=xn-bn+1;return Array.from({length:e},yn)},yn=(e,t)=>({name:`SIGRT${t+1}`,number:bn+t,action:`terminate`,description:`Application-specific signal (realtime)`,standard:`posix`}),bn=34,xn=64,Sn=[{name:`SIGHUP`,number:1,action:`terminate`,description:`Terminal closed`,standard:`posix`},{name:`SIGINT`,number:2,action:`terminate`,description:`User interruption with CTRL-C`,standard:`ansi`},{name:`SIGQUIT`,number:3,action:`core`,description:`User interruption with CTRL-\\`,standard:`posix`},{name:`SIGILL`,number:4,action:`core`,description:`Invalid machine instruction`,standard:`ansi`},{name:`SIGTRAP`,number:5,action:`core`,description:`Debugger breakpoint`,standard:`posix`},{name:`SIGABRT`,number:6,action:`core`,description:`Aborted`,standard:`ansi`},{name:`SIGIOT`,number:6,action:`core`,description:`Aborted`,standard:`bsd`},{name:`SIGBUS`,number:7,action:`core`,description:`Bus error due to misaligned, non-existing address or paging error`,standard:`bsd`},{name:`SIGEMT`,number:7,action:`terminate`,description:`Command should be emulated but is not implemented`,standard:`other`},{name:`SIGFPE`,number:8,action:`core`,description:`Floating point arithmetic error`,standard:`ansi`},{name:`SIGKILL`,number:9,action:`terminate`,description:`Forced termination`,standard:`posix`,forced:!0},{name:`SIGUSR1`,number:10,action:`terminate`,description:`Application-specific signal`,standard:`posix`},{name:`SIGSEGV`,number:11,action:`core`,description:`Segmentation fault`,standard:`ansi`},{name:`SIGUSR2`,number:12,action:`terminate`,description:`Application-specific signal`,standard:`posix`},{name:`SIGPIPE`,number:13,action:`terminate`,description:`Broken pipe or socket`,standard:`posix`},{name:`SIGALRM`,number:14,action:`terminate`,description:`Timeout or timer`,standard:`posix`},{name:`SIGTERM`,number:15,action:`terminate`,description:`Termination`,standard:`ansi`},{name:`SIGSTKFLT`,number:16,action:`terminate`,description:`Stack is empty or overflowed`,standard:`other`},{name:`SIGCHLD`,number:17,action:`ignore`,description:`Child process terminated, paused or unpaused`,standard:`posix`},{name:`SIGCLD`,number:17,action:`ignore`,description:`Child process terminated, paused or unpaused`,standard:`other`},{name:`SIGCONT`,number:18,action:`unpause`,description:`Unpaused`,standard:`posix`,forced:!0},{name:`SIGSTOP`,number:19,action:`pause`,description:`Paused`,standard:`posix`,forced:!0},{name:`SIGTSTP`,number:20,action:`pause`,description:`Paused using CTRL-Z or "suspend"`,standard:`posix`},{name:`SIGTTIN`,number:21,action:`pause`,description:`Background process cannot read terminal input`,standard:`posix`},{name:`SIGBREAK`,number:21,action:`terminate`,description:`User interruption with CTRL-BREAK`,standard:`other`},{name:`SIGTTOU`,number:22,action:`pause`,description:`Background process cannot write to terminal output`,standard:`posix`},{name:`SIGURG`,number:23,action:`ignore`,description:`Socket received out-of-band data`,standard:`bsd`},{name:`SIGXCPU`,number:24,action:`core`,description:`Process timed out`,standard:`bsd`},{name:`SIGXFSZ`,number:25,action:`core`,description:`File too big`,standard:`bsd`},{name:`SIGVTALRM`,number:26,action:`terminate`,description:`Timeout or timer`,standard:`bsd`},{name:`SIGPROF`,number:27,action:`terminate`,description:`Timeout or timer`,standard:`bsd`},{name:`SIGWINCH`,number:28,action:`ignore`,description:`Terminal window size changed`,standard:`bsd`},{name:`SIGIO`,number:29,action:`terminate`,description:`I/O is available`,standard:`other`},{name:`SIGPOLL`,number:29,action:`terminate`,description:`Watched event`,standard:`other`},{name:`SIGINFO`,number:29,action:`ignore`,description:`Request for process information`,standard:`other`},{name:`SIGPWR`,number:30,action:`terminate`,description:`Device running out of power`,standard:`systemv`},{name:`SIGSYS`,number:31,action:`core`,description:`Invalid system call`,standard:`other`},{name:`SIGUNUSED`,number:31,action:`terminate`,description:`Invalid system call`,standard:`other`}],Cn=()=>{let e=vn();return[...Sn,...e].map(wn)},wn=({name:e,number:t,description:n,action:r,forced:i=!1,standard:a})=>{let{signals:{[e]:o}}=d.constants,s=o!==void 0;return{name:e,number:s?o:t,description:n,supported:s,action:r,forced:i,standard:a}},Tn=()=>{let e=Cn();return Object.fromEntries(e.map(En))},En=({name:e,number:t,description:n,supported:r,action:i,forced:a,standard:o})=>[e,{name:e,number:t,description:n,supported:r,action:i,forced:a,standard:o}],Dn=Tn(),On=()=>{let e=Cn(),t=Array.from({length:65},(t,n)=>kn(n,e));return Object.assign({},...t)},kn=(e,t)=>{let n=An(e,t);if(n===void 0)return{};let{name:r,description:i,supported:a,action:o,forced:s,standard:c}=n;return{[e]:{name:r,number:e,description:i,supported:a,action:o,forced:s,standard:c}}},An=(e,t)=>{let n=t.find(({name:t})=>d.constants.signals[t]===e);return n===void 0?t.find(t=>t.number===e):n};On();const jn=({timedOut:e,timeout:t,errorCode:n,signal:r,signalDescription:i,exitCode:a,isCanceled:o})=>e?`timed out after ${t} milliseconds`:o?`was canceled`:n===void 0?r===void 0?a===void 0?`failed`:`failed with exit code ${a}`:`was killed with ${r} (${i})`:`failed with ${n}`,Mn=({stdout:e,stderr:t,all:n,error:r,signal:i,exitCode:a,command:o,escapedCommand:s,timedOut:c,isCanceled:l,killed:u,parsed:{options:{timeout:d,cwd:f=p.default.cwd()}}})=>{a=a===null?void 0:a,i=i===null?void 0:i;let m=i===void 0?void 0:Dn[i].description,h=`Command ${jn({timedOut:c,timeout:d,errorCode:r&&r.code,signal:i,signalDescription:m,exitCode:a,isCanceled:l})}: ${o}`,g=Object.prototype.toString.call(r)===`[object Error]`,_=g?`${h}\n${r.message}`:h,v=[_,t,e].filter(Boolean).join(`
`);return g?(r.originalMessage=r.message,r.message=v):r=Error(v),r.shortMessage=_,r.command=o,r.escapedCommand=s,r.exitCode=a,r.signal=i,r.signalDescription=m,r.stdout=e,r.stderr=t,r.cwd=f,n!==void 0&&(r.all=n),`bufferedData`in r&&delete r.bufferedData,r.failed=!0,r.timedOut=!!c,r.isCanceled=l,r.killed=u&&!c,r},Nn=[`stdin`,`stdout`,`stderr`],Pn=e=>Nn.some(t=>e[t]!==void 0),Fn=e=>{if(!e)return;let{stdio:t}=e;if(t===void 0)return Nn.map(t=>e[t]);if(Pn(e))throw Error(`It's not possible to provide \`stdio\` in combination with one of ${Nn.map(e=>`\`${e}\``).join(`, `)}`);if(typeof t==`string`)return t;if(!Array.isArray(t))throw TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof t}\``);let n=Math.max(t.length,Nn.length);return Array.from({length:n},(e,n)=>t[n])},O=[];O.push(`SIGHUP`,`SIGINT`,`SIGTERM`),process.platform!==`win32`&&O.push(`SIGALRM`,`SIGABRT`,`SIGVTALRM`,`SIGXCPU`,`SIGXFSZ`,`SIGUSR2`,`SIGTRAP`,`SIGSYS`,`SIGQUIT`,`SIGIOT`),process.platform===`linux`&&O.push(`SIGIO`,`SIGPOLL`,`SIGPWR`,`SIGSTKFLT`);const In=e=>!!e&&typeof e==`object`&&typeof e.removeListener==`function`&&typeof e.emit==`function`&&typeof e.reallyExit==`function`&&typeof e.listeners==`function`&&typeof e.kill==`function`&&typeof e.pid==`number`&&typeof e.on==`function`,Ln=Symbol.for(`signal-exit emitter`),Rn=globalThis,zn=Object.defineProperty.bind(Object);var Bn=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(Rn[Ln])return Rn[Ln];zn(Rn,Ln,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(e,t){this.listeners[e].push(t)}removeListener(e,t){let n=this.listeners[e],r=n.indexOf(t);r!==-1&&(r===0&&n.length===1?n.length=0:n.splice(r,1))}emit(e,t,n){if(this.emitted[e])return!1;this.emitted[e]=!0;let r=!1;for(let i of this.listeners[e])r=i(t,n)===!0||r;return e===`exit`&&(r=this.emit(`afterExit`,t,n)||r),r}},Vn=class{};const Hn=e=>({onExit(t,n){return e.onExit(t,n)},load(){return e.load()},unload(){return e.unload()}});var Un=class extends Vn{onExit(){return()=>{}}load(){}unload(){}},Wn=class extends Vn{#e=Gn.platform===`win32`?`SIGINT`:`SIGHUP`;#t=new Bn;#n;#r;#i;#a={};#o=!1;constructor(e){super(),this.#n=e,this.#a={};for(let t of O)this.#a[t]=()=>{let n=this.#n.listeners(t),{count:r}=this.#t,i=e;if(typeof i.__signal_exit_emitter__==`object`&&typeof i.__signal_exit_emitter__.count==`number`&&(r+=i.__signal_exit_emitter__.count),n.length===r){this.unload();let n=this.#t.emit(`exit`,null,t),r=t===`SIGHUP`?this.#e:t;n||e.kill(e.pid,r)}};this.#i=e.reallyExit,this.#r=e.emit}onExit(e,t){if(!In(this.#n))return()=>{};this.#o===!1&&this.load();let n=t?.alwaysLast?`afterExit`:`exit`;return this.#t.on(n,e),()=>{this.#t.removeListener(n,e),this.#t.listeners.exit.length===0&&this.#t.listeners.afterExit.length===0&&this.unload()}}load(){if(!this.#o){this.#o=!0,this.#t.count+=1;for(let e of O)try{let t=this.#a[e];t&&this.#n.on(e,t)}catch{}this.#n.emit=(e,...t)=>this.#c(e,...t),this.#n.reallyExit=e=>this.#s(e)}}unload(){this.#o&&(this.#o=!1,O.forEach(e=>{let t=this.#a[e];if(!t)throw Error(`Listener not defined for signal: `+e);try{this.#n.removeListener(e,t)}catch{}}),this.#n.emit=this.#r,this.#n.reallyExit=this.#i,--this.#t.count)}#s(e){return In(this.#n)?(this.#n.exitCode=e||0,this.#t.emit(`exit`,this.#n.exitCode,null),this.#i.call(this.#n,this.#n.exitCode)):0}#c(e,...t){let n=this.#r;if(e===`exit`&&In(this.#n)){typeof t[0]==`number`&&(this.#n.exitCode=t[0]);let r=n.call(this.#n,e,...t);return this.#t.emit(`exit`,this.#n.exitCode,null),r}else return n.call(this.#n,e,...t)}};const Gn=globalThis.process,{onExit:Kn,load:qn,unload:Jn}=Hn(In(Gn)?new Wn(Gn):new Un),Yn=(e,t=`SIGTERM`,n={})=>{let r=e(t);return Xn(e,t,n,r),r},Xn=(e,t,n,r)=>{if(!Zn(t,n,r))return;let i=$n(n),a=setTimeout(()=>{e(`SIGKILL`)},i);a.unref&&a.unref()},Zn=(e,{forceKillAfterTimeout:t},n)=>Qn(e)&&t!==!1&&n,Qn=e=>e===d.default.constants.signals.SIGTERM||typeof e==`string`&&e.toUpperCase()===`SIGTERM`,$n=({forceKillAfterTimeout:e=!0})=>{if(e===!0)return 5e3;if(!Number.isFinite(e)||e<0)throw TypeError(`Expected the \`forceKillAfterTimeout\` option to be a non-negative integer, got \`${e}\` (${typeof e})`);return e},er=(e,t)=>{e.kill()&&(t.isCanceled=!0)},tr=(e,t,n)=>{e.kill(t),n(Object.assign(Error(`Timed out`),{timedOut:!0,signal:t}))},nr=(e,{timeout:t,killSignal:n=`SIGTERM`},r)=>{if(t===0||t===void 0)return r;let i,a=new Promise((r,a)=>{i=setTimeout(()=>{tr(e,n,a)},t)}),o=r.finally(()=>{clearTimeout(i)});return Promise.race([a,o])},rr=({timeout:e})=>{if(e!==void 0&&(!Number.isFinite(e)||e<0))throw TypeError(`Expected the \`timeout\` option to be a non-negative integer, got \`${e}\` (${typeof e})`)},ir=async(e,{cleanup:t,detached:n},r)=>{if(!t||n)return r;let i=Kn(()=>{e.kill()});return r.finally(()=>{i()})};function ar(e){return typeof e==`object`&&!!e&&typeof e.pipe==`function`}function or(e){return ar(e)&&e.writable!==!1&&typeof e._write==`function`&&typeof e._writableState==`object`}const sr=e=>e instanceof l.ChildProcess&&typeof e.then==`function`,cr=(e,t,n)=>{if(typeof n==`string`)return e[t].pipe((0,u.createWriteStream)(n)),e;if(or(n))return e[t].pipe(n),e;if(!sr(n))throw TypeError(`The second argument must be a string, a stream or an Execa child process.`);if(!or(n.stdin))throw TypeError(`The target child process's stdin must be available.`);return e[t].pipe(n.stdin),n},lr=e=>{e.stdout!==null&&(e.pipeStdout=cr.bind(void 0,e,`stdout`)),e.stderr!==null&&(e.pipeStderr=cr.bind(void 0,e,`stderr`)),e.all!==void 0&&(e.pipeAll=cr.bind(void 0,e,`all`))},ur=async(e,{init:t,convertChunk:n,getSize:r,truncateChunk:i,addChunk:a,getFinalChunk:o,finalize:s},{maxBuffer:c=1/0}={})=>{if(!mr(e))throw Error(`The first argument must be a Readable, a ReadableStream, or an async iterable.`);let l=t();l.length=0;try{for await(let t of e)fr({convertedChunk:n[hr(t)](t,l),state:l,getSize:r,truncateChunk:i,addChunk:a,maxBuffer:c});return dr({state:l,convertChunk:n,getSize:r,truncateChunk:i,addChunk:a,getFinalChunk:o,maxBuffer:c}),s(l)}catch(e){throw e.bufferedData=s(l),e}},dr=({state:e,getSize:t,truncateChunk:n,addChunk:r,getFinalChunk:i,maxBuffer:a})=>{let o=i(e);o!==void 0&&fr({convertedChunk:o,state:e,getSize:t,truncateChunk:n,addChunk:r,maxBuffer:a})},fr=({convertedChunk:e,state:t,getSize:n,truncateChunk:r,addChunk:i,maxBuffer:a})=>{let o=n(e),s=t.length+o;if(s<=a){pr(e,t,i,s);return}let c=r(e,a-t.length);throw c!==void 0&&pr(c,t,i,a),new _r},pr=(e,t,n,r)=>{t.contents=n(e,t,r),t.length=r},mr=e=>typeof e==`object`&&!!e&&typeof e[Symbol.asyncIterator]==`function`,hr=e=>{let t=typeof e;if(t===`string`)return`string`;if(t!==`object`||e===null)return`others`;if(globalThis.Buffer?.isBuffer(e))return`buffer`;let n=gr.call(e);return n===`[object ArrayBuffer]`?`arrayBuffer`:n===`[object DataView]`?`dataView`:Number.isInteger(e.byteLength)&&Number.isInteger(e.byteOffset)&&gr.call(e.buffer)===`[object ArrayBuffer]`?`typedArray`:`others`},{toString:gr}=Object.prototype;var _r=class extends Error{name=`MaxBufferError`;constructor(){super(`maxBuffer exceeded`)}};const vr=e=>e,yr=()=>void 0,br=({contents:e})=>e,xr=e=>{throw Error(`Streams in object mode are not supported: ${String(e)}`)},Sr=e=>e.length;async function Cr(e,t){return ur(e,Lr,t)}const wr=()=>({contents:new ArrayBuffer(0)}),Tr=e=>Er.encode(e),Er=new TextEncoder,Dr=e=>new Uint8Array(e),Or=e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength),kr=(e,t)=>e.slice(0,t),Ar=(e,{contents:t,length:n},r)=>{let i=Ir()?Mr(t,r):jr(t,r);return new Uint8Array(i).set(e,n),i},jr=(e,t)=>{if(t<=e.byteLength)return e;let n=new ArrayBuffer(Nr(t));return new Uint8Array(n).set(new Uint8Array(e),0),n},Mr=(e,t)=>{if(t<=e.maxByteLength)return e.resize(t),e;let n=new ArrayBuffer(t,{maxByteLength:Nr(t)});return new Uint8Array(n).set(new Uint8Array(e),0),n},Nr=e=>Pr**Math.ceil(Math.log(e)/Math.log(Pr)),Pr=2,Fr=({contents:e,length:t})=>Ir()?e:e.slice(0,t),Ir=()=>`resize`in ArrayBuffer.prototype,Lr={init:wr,convertChunk:{string:Tr,buffer:Dr,arrayBuffer:Dr,dataView:Or,typedArray:Or,others:xr},getSize:Sr,truncateChunk:kr,addChunk:Ar,getFinalChunk:yr,finalize:Fr};async function Rr(e,t){if(!(`Buffer`in globalThis))throw Error(`getStreamAsBuffer() is only supported in Node.js`);try{return zr(await Cr(e,t))}catch(e){throw e.bufferedData!==void 0&&(e.bufferedData=zr(e.bufferedData)),e}}const zr=e=>globalThis.Buffer.from(e);async function Br(e,t){return ur(e,Ur,t)}const Vr=()=>({contents:``,textDecoder:new TextDecoder}),Hr=(e,{textDecoder:t})=>t.decode(e,{stream:!0}),Ur={init:Vr,convertChunk:{string:vr,buffer:Hr,arrayBuffer:Hr,dataView:Hr,typedArray:Hr,others:xr},getSize:Sr,truncateChunk:(e,t)=>e.slice(0,t),addChunk:(e,{contents:t})=>t+e,getFinalChunk:({textDecoder:e})=>{let t=e.decode();return t===``?void 0:t},finalize:br},{PassThrough:Wr}=v.default,Gr=w(function(){var e=[],t=new Wr({objectMode:!0});return t.setMaxListeners(0),t.add=n,t.isEmpty=r,t.on(`unpipe`,i),Array.prototype.slice.call(arguments).forEach(n),t;function n(r){return Array.isArray(r)?(r.forEach(n),this):(e.push(r),r.once(`end`,i.bind(null,r)),r.once(`error`,t.emit.bind(t,`error`)),r.pipe(t,{end:!1}),this)}function r(){return e.length==0}function i(n){e=e.filter(function(e){return e!==n}),!e.length&&t.readable&&t.end()}}),Kr=e=>{if(e!==void 0)throw TypeError("The `input` and `inputFile` options cannot be both set.")},qr=({input:e,inputFile:t})=>typeof t==`string`?(Kr(e),(0,u.createReadStream)(t)):e,Jr=(e,t)=>{let n=qr(t);n!==void 0&&(ar(n)?n.pipe(e.stdin):e.stdin.end(n))},Yr=(e,{all:t})=>{if(!t||!e.stdout&&!e.stderr)return;let n=Gr();return e.stdout&&n.add(e.stdout),e.stderr&&n.add(e.stderr),n},Xr=async(e,t)=>{if(!(!e||t===void 0)){await(0,_.setTimeout)(0),e.destroy();try{return await t}catch(e){return e.bufferedData}}},Zr=(e,{encoding:t,buffer:n,maxBuffer:r})=>{if(!(!e||!n))return t===`utf8`||t===`utf-8`?Br(e,{maxBuffer:r}):t===null||t===`buffer`?Rr(e,{maxBuffer:r}):Qr(e,r,t)},Qr=async(e,t,n)=>(await Rr(e,{maxBuffer:t})).toString(n),$r=async({stdout:e,stderr:t,all:n},{encoding:r,buffer:i,maxBuffer:a},o)=>{let s=Zr(e,{encoding:r,buffer:i,maxBuffer:a}),c=Zr(t,{encoding:r,buffer:i,maxBuffer:a}),l=Zr(n,{encoding:r,buffer:i,maxBuffer:a*2});try{return await Promise.all([o,s,c,l])}catch(r){return Promise.all([{error:r,signal:r.signal,timedOut:r.timedOut},Xr(e,s),Xr(t,c),Xr(n,l)])}},ei=(async()=>{})().constructor.prototype,ti=[`then`,`catch`,`finally`].map(e=>[e,Reflect.getOwnPropertyDescriptor(ei,e)]),ni=(e,t)=>{for(let[n,r]of ti){let i=typeof t==`function`?(...e)=>Reflect.apply(r.value,t(),e):r.value.bind(t);Reflect.defineProperty(e,n,{...r,value:i})}},ri=e=>new Promise((t,n)=>{e.on(`exit`,(e,n)=>{t({exitCode:e,signal:n})}),e.on(`error`,e=>{n(e)}),e.stdin&&e.stdin.on(`error`,e=>{n(e)})}),ii=(e,t=[])=>Array.isArray(t)?[e,...t]:[e],ai=/^[\w.-]+$/,oi=e=>typeof e!=`string`||ai.test(e)?e:`"${e.replaceAll(`"`,`\\"`)}"`,si=(e,t)=>ii(e,t).join(` `),ci=(e,t)=>ii(e,t).map(e=>oi(e)).join(` `),li=/ +/g,ui=e=>{let t=[];for(let n of e.trim().split(li)){let e=t.at(-1);e&&e.endsWith(`\\`)?t[t.length-1]=`${e.slice(0,-1)} ${n}`:t.push(n)}return t},di=(0,c.debuglog)(`execa`).enabled,fi=(e,t)=>String(e).padStart(t,`0`),pi=()=>{let e=new Date;return`${fi(e.getHours(),2)}:${fi(e.getMinutes(),2)}:${fi(e.getSeconds(),2)}.${fi(e.getMilliseconds(),3)}`},mi=(e,{verbose:t})=>{t&&p.default.stderr.write(`[${pi()}] ${e}\n`)},hi=({env:e,extendEnv:t,preferLocal:n,localDir:r,execPath:i})=>{let a=t?{...p.default.env,...e}:e;return n?sn({env:a,cwd:r,execPath:i}):a},gi=(e,t,n={})=>{let r=nn._parse(e,t,n);return e=r.command,t=r.args,n=r.options,n={maxBuffer:1e8,buffer:!0,stripFinalNewline:!0,extendEnv:!0,preferLocal:!1,localDir:n.cwd||p.default.cwd(),execPath:p.default.execPath,encoding:`utf8`,reject:!0,cleanup:!0,all:!1,windowsHide:!0,verbose:di,...n},n.env=hi(n),n.stdio=Fn(n),p.default.platform===`win32`&&f.default.basename(e,`.exe`)===`cmd`&&t.unshift(`/q`),{file:e,args:t,options:n,parsed:r}},_i=(e,t,n)=>typeof t!=`string`&&!g.Buffer.isBuffer(t)?n===void 0?void 0:``:e.stripFinalNewline?rn(t):t;function vi(e,t,n){let r=gi(e,t,n),i=si(e,t),a=ci(e,t);mi(a,r.options),rr(r.options);let o;try{o=l.default.spawn(r.file,r.args,r.options)}catch(e){let t=new l.default.ChildProcess;return ni(t,Promise.reject(Mn({error:e,stdout:``,stderr:``,all:``,command:i,escapedCommand:a,parsed:r,timedOut:!1,isCanceled:!1,killed:!1}))),t}let s=ri(o),c=nr(o,r.options,s),u=ir(o,r.options,c);o.kill=Yn.bind(null,o.kill.bind(o)),o.cancel=er.bind(null,o,{isCanceled:!1});let d=_n(async()=>{let[{error:e,exitCode:t,signal:n,timedOut:s},c,l,d]=await $r(o,r.options,u),f=_i(r.options,c),p=_i(r.options,l),m=_i(r.options,d);if(e||t!==0||n!==null){let c=Mn({error:e,exitCode:t,signal:n,stdout:f,stderr:p,all:m,command:i,escapedCommand:a,parsed:r,timedOut:s,isCanceled:r.options.signal?r.options.signal.aborted:!1,killed:o.killed});if(!r.options.reject)return c;throw c}return{command:i,escapedCommand:a,exitCode:0,stdout:f,stderr:p,all:m,failed:!1,timedOut:!1,isCanceled:!1,killed:!1}});return Jr(o,r.options),o.all=Yr(o,r.options),lr(o),ni(o,d),o}function yi(e,t){let[n,...r]=ui(e);return vi(n,r,t)}var bi=class{value;next;constructor(e){this.value=e}},xi=class{#e;#t;#n;constructor(){this.clear()}enqueue(e){let t=new bi(e);this.#e?(this.#t.next=t,this.#t=t):(this.#e=t,this.#t=t),this.#n++}dequeue(){let e=this.#e;if(e)return this.#e=this.#e.next,this.#n--,e.value}clear(){this.#e=void 0,this.#t=void 0,this.#n=0}get size(){return this.#n}*[Symbol.iterator](){let e=this.#e;for(;e;)yield e.value,e=e.next}};function Si(e){if(!((Number.isInteger(e)||e===1/0)&&e>0))throw TypeError("Expected `concurrency` to be a number from 1 and up");let t=new xi,n=0,r=()=>{n--,t.size>0&&t.dequeue()()},i=async(e,t,i)=>{n++;let a=(async()=>e(...i))();t(a);try{await a}catch{}r()},a=(r,a,o)=>{t.enqueue(i.bind(void 0,r,a,o)),(async()=>{await Promise.resolve(),n<e&&t.size>0&&t.dequeue()()})()},o=(e,...t)=>new Promise(n=>{a(e,n,t)});return Object.defineProperties(o,{activeCount:{get:()=>n},pendingCount:{get:()=>t.size},clearQueue:{value:()=>{t.clear()}}}),o}var Ci=class extends Error{constructor(e){super(),this.value=e}};const wi=async(e,t)=>t(await e),Ti=async e=>{let t=await Promise.all(e);if(t[1]===!0)throw new Ci(t[0]);return!1};async function Ei(e,t,{concurrency:n=1/0,preserveOrder:r=!0}={}){let i=Si(n),a=[...e].map(e=>[e,i(wi,e,t)]),o=Si(r?1:1/0);try{await Promise.all(a.map(e=>o(Ti,e)))}catch(e){if(e instanceof Ci)return e.value;throw e}}const Di={directory:`isDirectory`,file:`isFile`};function Oi(e){if(!Object.hasOwnProperty.call(Di,e))throw Error(`Invalid type specified: ${e}`)}const ki=(e,t)=>t[Di[e]](),Ai=e=>e instanceof URL?(0,h.fileURLToPath)(e):e;async function ji(e,{cwd:t=p.default.cwd(),type:n=`file`,allowSymlinks:r=!0,concurrency:i,preserveOrder:a}={}){Oi(n),t=Ai(t);let o=r?u.promises.stat:u.promises.lstat;return Ei(e,async e=>{try{return ki(n,await o(f.default.resolve(t,e)))}catch{return!1}},{concurrency:i,preserveOrder:a})}const Mi=e=>e instanceof URL?(0,h.fileURLToPath)(e):e,Ni=Symbol(`findUpStop`);async function Pi(e,t={}){let n=f.default.resolve(Mi(t.cwd)||``),{root:r}=f.default.parse(n),i=f.default.resolve(n,t.stopAt||r),a=t.limit||1/0,o=[e].flat(),s=async t=>{if(typeof e!=`function`)return ji(o,t);let n=await e(t.cwd);return typeof n==`string`?ji([n],t):n},c=[];for(;;){let e=await s({...t,cwd:n});if(e===Ni||(e&&c.push(f.default.resolve(n,e)),n===i||c.length>=a))break;n=f.default.dirname(n)}return c}async function Fi(e,t={}){return(await Pi(e,{...t,limit:1}))[0]}const Ii=process.env.TERM_PROGRAM===`Apple_Terminal`,k={};k.cursorTo=(e,t)=>{if(typeof e!=`number`)throw TypeError("The `x` argument is required");return typeof t==`number`?`\x1B[`+(t+1)+`;`+(e+1)+`H`:`\x1B[`+(e+1)+`G`},k.cursorMove=(e,t)=>{if(typeof e!=`number`)throw TypeError("The `x` argument is required");let n=``;return e<0?n+=`\x1B[`+-e+`D`:e>0&&(n+=`\x1B[`+e+`C`),t<0?n+=`\x1B[`+-t+`A`:t>0&&(n+=`\x1B[`+t+`B`),n},k.cursorUp=(e=1)=>`\x1B[`+e+`A`,k.cursorDown=(e=1)=>`\x1B[`+e+`B`,k.cursorForward=(e=1)=>`\x1B[`+e+`C`,k.cursorBackward=(e=1)=>`\x1B[`+e+`D`,k.cursorLeft=`\x1B[G`,k.cursorSavePosition=Ii?`\x1B7`:`\x1B[s`,k.cursorRestorePosition=Ii?`\x1B8`:`\x1B[u`,k.cursorGetPosition=`\x1B[6n`,k.cursorNextLine=`\x1B[E`,k.cursorPrevLine=`\x1B[F`,k.cursorHide=`\x1B[?25l`,k.cursorShow=`\x1B[?25h`,k.eraseLines=e=>{let t=``;for(let n=0;n<e;n++)t+=k.eraseLine+(n<e-1?k.cursorUp():``);return e&&(t+=k.cursorLeft),t},k.eraseEndLine=`\x1B[K`,k.eraseStartLine=`\x1B[1K`,k.eraseLine=`\x1B[2K`,k.eraseDown=`\x1B[J`,k.eraseUp=`\x1B[1J`,k.eraseScreen=`\x1B[2J`,k.scrollUp=`\x1B[S`,k.scrollDown=`\x1B[T`,k.clearScreen=`\x1Bc`,k.clearTerminal=process.platform===`win32`?`${k.eraseScreen}[0f`:`${k.eraseScreen}[3J[H`,k.beep=`\x07`,k.link=(e,t)=>[`\x1B]`,`8`,`;`,`;`,t,`\x07`,e,`\x1B]`,`8`,`;`,`;`,`\x07`].join(``),k.image=(e,t={})=>{let n=`\x1B]1337;File=inline=1`;return t.width&&(n+=`;width=${t.width}`),t.height&&(n+=`;height=${t.height}`),t.preserveAspectRatio===!1&&(n+=`;preserveAspectRatio=0`),n+`:`+e.toString(`base64`)+`\x07`},k.iTerm={setCwd:(e=process.cwd())=>`]50;CurrentDir=${e}`,annotation:(e,t={})=>{let n=`\x1B]1337;`,r=t.x!==void 0,i=t.y!==void 0;if((r||i)&&!(r&&i&&t.length!==void 0))throw Error("`x`, `y` and `length` must be defined when `x` or `y` is defined");return e=e.replace(/\|/g,``),n+=t.isHidden?`AddHiddenAnnotation=`:`AddAnnotation=`,t.length>0?n+=(r?[e,t.length,t.x,t.y]:[t.length,e]).join(`|`):n+=e,n+`\x07`}};var Li=(e,t=process.argv)=>{let n=e.startsWith(`-`)?``:e.length===1?`-`:`--`,r=t.indexOf(n+e),i=t.indexOf(`--`);return r!==-1&&(i===-1||r<i)};const Ri=a.default,zi=i.default,A=Li,{env:j}=process;let M;A(`no-color`)||A(`no-colors`)||A(`color=false`)||A(`color=never`)?M=0:(A(`color`)||A(`colors`)||A(`color=true`)||A(`color=always`))&&(M=1),`FORCE_COLOR`in j&&(M=j.FORCE_COLOR===`true`?1:j.FORCE_COLOR===`false`?0:j.FORCE_COLOR.length===0?1:Math.min(parseInt(j.FORCE_COLOR,10),3));function Bi(e){return e===0?!1:{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function Vi(e,t){if(M===0)return 0;if(A(`color=16m`)||A(`color=full`)||A(`color=truecolor`))return 3;if(A(`color=256`))return 2;if(e&&!t&&M===void 0)return 0;let n=M||0;if(j.TERM===`dumb`)return n;if(process.platform===`win32`){let e=Ri.release().split(`.`);return Number(e[0])>=10&&Number(e[2])>=10586?Number(e[2])>=14931?3:2:1}if(`CI`in j)return[`TRAVIS`,`CIRCLECI`,`APPVEYOR`,`GITLAB_CI`,`GITHUB_ACTIONS`,`BUILDKITE`].some(e=>e in j)||j.CI_NAME===`codeship`?1:n;if(`TEAMCITY_VERSION`in j)return+!!/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(j.TEAMCITY_VERSION);if(j.COLORTERM===`truecolor`)return 3;if(`TERM_PROGRAM`in j){let e=parseInt((j.TERM_PROGRAM_VERSION||``).split(`.`)[0],10);switch(j.TERM_PROGRAM){case`iTerm.app`:return e>=3?3:2;case`Apple_Terminal`:return 2}}return/-256(color)?$/i.test(j.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(j.TERM)||`COLORTERM`in j?1:n}function Hi(e){return Bi(Vi(e,e&&e.isTTY))}const Ui={supportsColor:Hi,stdout:Bi(Vi(!0,zi.isatty(1))),stderr:Bi(Vi(!0,zi.isatty(2)))},N=Li;function Wi(e){if(/^\d{3,4}$/.test(e)){let t=/(\d{1,2})(\d{2})/.exec(e);return{major:0,minor:parseInt(t[1],10),patch:parseInt(t[2],10)}}let t=(e||``).split(`.`).map(e=>parseInt(e,10));return{major:t[0],minor:t[1],patch:t[2]}}function Gi(e){let{env:t}=process;if(`FORCE_HYPERLINK`in t)return!(t.FORCE_HYPERLINK.length>0&&parseInt(t.FORCE_HYPERLINK,10)===0);if(N(`no-hyperlink`)||N(`no-hyperlinks`)||N(`hyperlink=false`)||N(`hyperlink=never`))return!1;if(N(`hyperlink=true`)||N(`hyperlink=always`))return!0;if(!Ui.supportsColor(e)||e&&!e.isTTY||process.platform===`win32`)return!1;if(`NETLIFY`in t)return!0;if(`CI`in t||`TEAMCITY_VERSION`in t)return!1;if(`TERM_PROGRAM`in t){let e=Wi(t.TERM_PROGRAM_VERSION);switch(t.TERM_PROGRAM){case`iTerm.app`:return e.major===3?e.minor>=1:e.major>3}}if(`VTE_VERSION`in t){if(t.VTE_VERSION===`0.50.0`)return!1;let e=Wi(t.VTE_VERSION);return e.major>0||e.minor>=50}return!1}const Ki=w({supportsHyperlink:Gi,stdout:Gi(process.stdout),stderr:Gi(process.stderr)});function qi(e,t,{target:n=`stdout`,...r}={}){return Ki[n]?k.link(e,t):r.fallback===!1?e:typeof r.fallback==`function`?r.fallback(e,t):`${e} (\u200B${t}\u200B)`}qi.isSupported=Ki.stdout,qi.stderr=(e,t,n={})=>qi(e,t,{target:`stderr`,...n}),qi.stderr.isSupported=Ki.stderr;var Ji={};let Yi,Xi,Zi,Qi,$i=!0;typeof process<`u`&&({FORCE_COLOR:Yi,NODE_DISABLE_COLORS:Xi,NO_COLOR:Zi,TERM:Qi}=process.env||{},$i=process.stdout&&process.stdout.isTTY);const P={enabled:!Xi&&Zi==null&&Qi!==`dumb`&&(Yi!=null&&Yi!==`0`||$i),reset:F(0,0),bold:F(1,22),dim:F(2,22),italic:F(3,23),underline:F(4,24),inverse:F(7,27),hidden:F(8,28),strikethrough:F(9,29),black:F(30,39),red:F(31,39),green:F(32,39),yellow:F(33,39),blue:F(34,39),magenta:F(35,39),cyan:F(36,39),white:F(37,39),gray:F(90,39),grey:F(90,39),bgBlack:F(40,49),bgRed:F(41,49),bgGreen:F(42,49),bgYellow:F(43,49),bgBlue:F(44,49),bgMagenta:F(45,49),bgCyan:F(46,49),bgWhite:F(47,49)};function ea(e,t){let n=0,r,i=``,a=``;for(;n<e.length;n++)r=e[n],i+=r.open,a+=r.close,~t.indexOf(r.close)&&(t=t.replace(r.rgx,r.close+r.open));return i+t+a}function ta(e,t){let n={has:e,keys:t};return n.reset=P.reset.bind(n),n.bold=P.bold.bind(n),n.dim=P.dim.bind(n),n.italic=P.italic.bind(n),n.underline=P.underline.bind(n),n.inverse=P.inverse.bind(n),n.hidden=P.hidden.bind(n),n.strikethrough=P.strikethrough.bind(n),n.black=P.black.bind(n),n.red=P.red.bind(n),n.green=P.green.bind(n),n.yellow=P.yellow.bind(n),n.blue=P.blue.bind(n),n.magenta=P.magenta.bind(n),n.cyan=P.cyan.bind(n),n.white=P.white.bind(n),n.gray=P.gray.bind(n),n.grey=P.grey.bind(n),n.bgBlack=P.bgBlack.bind(n),n.bgRed=P.bgRed.bind(n),n.bgGreen=P.bgGreen.bind(n),n.bgYellow=P.bgYellow.bind(n),n.bgBlue=P.bgBlue.bind(n),n.bgMagenta=P.bgMagenta.bind(n),n.bgCyan=P.bgCyan.bind(n),n.bgWhite=P.bgWhite.bind(n),n}function F(e,t){let n={open:`\x1b[${e}m`,close:`\x1b[${t}m`,rgx:RegExp(`\\x1b\\[${t}m`,`g`)};return function(t){return this!==void 0&&this.has!==void 0?(~this.has.indexOf(e)||(this.has.push(e),this.keys.push(n)),t===void 0?this:P.enabled?ea(this.keys,t+``):t+``):t===void 0?ta([e],[n]):P.enabled?ea([n],t+``):t+``}}var I=P,na=(e,t)=>{if(!(e.meta&&e.name!==`escape`)){if(e.ctrl)return e.name===`a`?`first`:e.name===`c`||e.name===`d`?`abort`:e.name===`e`?`last`:e.name===`g`?`reset`:e.name===`n`?`down`:e.name===`p`?`up`:void 0;if(t){if(e.name===`j`)return`down`;if(e.name===`k`)return`up`}return e.name===`return`||e.name===`enter`?`submit`:e.name===`backspace`?`delete`:e.name===`delete`?`deleteForward`:e.name===`abort`?`abort`:e.name===`escape`?`exit`:e.name===`tab`?`next`:e.name===`pagedown`?`nextPage`:e.name===`pageup`?`prevPage`:e.name===`home`?`home`:e.name===`end`?`end`:e.name===`up`?`up`:e.name===`down`?`down`:e.name===`right`?`right`:e.name===`left`?`left`:!1}},ra=e=>{let t=[`[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)`,`(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))`].join(`|`),n=new RegExp(t,`g`);return typeof e==`string`?e.replace(n,``):e};const ia={to(e,t){return t?`[${t+1};${e+1}H`:`[${e+1}G`},move(e,t){let n=``;return e<0?n+=`[${-e}D`:e>0&&(n+=`[${e}C`),t<0?n+=`[${-t}A`:t>0&&(n+=`[${t}B`),n},up:(e=1)=>`[${e}A`,down:(e=1)=>`[${e}B`,forward:(e=1)=>`[${e}C`,backward:(e=1)=>`[${e}D`,nextLine:(e=1)=>`\x1B[E`.repeat(e),prevLine:(e=1)=>`\x1B[F`.repeat(e),left:`\x1B[G`,hide:`\x1B[?25l`,show:`\x1B[?25h`,save:`\x1B7`,restore:`\x1B8`};var L={cursor:ia,scroll:{up:(e=1)=>`\x1B[S`.repeat(e),down:(e=1)=>`\x1B[T`.repeat(e)},erase:{screen:`\x1B[2J`,up:(e=1)=>`\x1B[1J`.repeat(e),down:(e=1)=>`\x1B[J`.repeat(e),line:`\x1B[2K`,lineEnd:`\x1B[K`,lineStart:`\x1B[1K`,lines(e){let t=``;for(let n=0;n<e;n++)t+=this.line+(n<e-1?ia.up():``);return e&&(t+=ia.left),t}},beep:`\x07`};const aa=ra,{erase:oa,cursor:sa}=L,ca=e=>[...aa(e)].length;var la=function(e,t){if(!t)return oa.line+sa.to(0);let n=0,r=e.split(/\r?\n/);for(let e of r)n+=1+Math.floor(Math.max(ca(e)-1,0)/t);return oa.lines(n)};const ua={arrowUp:`↑`,arrowDown:`↓`,arrowLeft:`←`,arrowRight:`→`,radioOn:`◉`,radioOff:`◯`,tick:`✔`,cross:`✖`,ellipsis:`…`,pointerSmall:`›`,line:`─`,pointer:`❯`},da={arrowUp:ua.arrowUp,arrowDown:ua.arrowDown,arrowLeft:ua.arrowLeft,arrowRight:ua.arrowRight,radioOn:`(*)`,radioOff:`( )`,tick:`√`,cross:`×`,ellipsis:`...`,pointerSmall:`»`,line:`─`,pointer:`>`};var fa=process.platform===`win32`?da:ua;const R=I,z=fa,pa=Object.freeze({password:{scale:1,render:e=>`*`.repeat(e.length)},emoji:{scale:2,render:e=>`😃`.repeat(e.length)},invisible:{scale:0,render:e=>``},default:{scale:1,render:e=>`${e}`}}),ma=e=>pa[e]||pa.default,ha=Object.freeze({aborted:R.red(z.cross),done:R.green(z.tick),exited:R.yellow(z.cross),default:R.cyan(`?`)});var ga={styles:pa,render:ma,symbols:ha,symbol:(e,t,n)=>t?ha.aborted:n?ha.exited:e?ha.done:ha.default,delimiter:e=>R.gray(e?z.ellipsis:z.pointerSmall),item:(e,t)=>R.gray(e?t?z.pointerSmall:`+`:z.line)};const _a=ra;var B={action:na,clear:la,style:ga,strip:ra,figures:fa,lines:function(e,t){let n=String(_a(e)||``).split(/\r?\n/);return t?n.map(e=>Math.ceil(e.length/t)).reduce((e,t)=>e+t):n.length},wrap:(e,t={})=>{let n=Number.isSafeInteger(parseInt(t.margin))?Array(parseInt(t.margin)).fill(` `).join(``):t.margin||``,r=t.width;return(e||``).split(/\r?\n/g).map(e=>e.split(/\s+/g).reduce((e,t)=>(t.length+n.length>=r||e[e.length-1].length+t.length+1<r?e[e.length-1]+=` ${t}`:e.push(`${n}${t}`),e),[n]).join(`
`)).join(`
`)},entriesToDisplay:(e,t,n)=>{n||=t;let r=Math.min(t-n,e-Math.floor(n/2));r<0&&(r=0);let i=Math.min(r+n,t);return{startIndex:r,endIndex:i}}};const va=b.default,{action:ya}=B,ba=o.default,{beep:xa,cursor:Sa}=L,Ca=I;var V=class extends ba{constructor(e={}){super(),this.firstRender=!0,this.in=e.stdin||process.stdin,this.out=e.stdout||process.stdout,this.onRender=(e.onRender||(()=>void 0)).bind(this);let t=va.createInterface({input:this.in,escapeCodeTimeout:50});va.emitKeypressEvents(this.in,t),this.in.isTTY&&this.in.setRawMode(!0);let n=[`SelectPrompt`,`MultiselectPrompt`].indexOf(this.constructor.name)>-1,r=(e,t)=>{let r=ya(t,n);r===!1?this._&&this._(e,t):typeof this[r]==`function`?this[r](t):this.bell()};this.close=()=>{this.out.write(Sa.show),this.in.removeListener(`keypress`,r),this.in.isTTY&&this.in.setRawMode(!1),t.close(),this.emit(this.aborted?`abort`:this.exited?`exit`:`submit`,this.value),this.closed=!0},this.in.on(`keypress`,r)}fire(){this.emit(`state`,{value:this.value,aborted:!!this.aborted,exited:!!this.exited})}bell(){this.out.write(xa)}render(){this.onRender(Ca),this.firstRender&&=!1}};const wa=I,Ta=V,{erase:Ea,cursor:Da}=L,{style:Oa,clear:ka,lines:Aa,figures:ja}=B;var Ma=class extends Ta{constructor(e={}){super(e),this.transform=Oa.render(e.style),this.scale=this.transform.scale,this.msg=e.message,this.initial=e.initial||``,this.validator=e.validate||(()=>!0),this.value=``,this.errorMsg=e.error||`Please Enter A Valid Value`,this.cursor=Number(!!this.initial),this.cursorOffset=0,this.clear=ka(``,this.out.columns),this.render()}set value(e){!e&&this.initial?(this.placeholder=!0,this.rendered=wa.gray(this.transform.render(this.initial))):(this.placeholder=!1,this.rendered=this.transform.render(e)),this._value=e,this.fire()}get value(){return this._value}reset(){this.value=``,this.cursor=Number(!!this.initial),this.cursorOffset=0,this.fire(),this.render()}exit(){this.abort()}abort(){this.value=this.value||this.initial,this.done=this.aborted=!0,this.error=!1,this.red=!1,this.fire(),this.render(),this.out.write(`
`),this.close()}async validate(){let e=await this.validator(this.value);typeof e==`string`&&(this.errorMsg=e,e=!1),this.error=!e}async submit(){if(this.value=this.value||this.initial,this.cursorOffset=0,this.cursor=this.rendered.length,await this.validate(),this.error){this.red=!0,this.fire(),this.render();return}this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
`),this.close()}next(){if(!this.placeholder)return this.bell();this.value=this.initial,this.cursor=this.rendered.length,this.fire(),this.render()}moveCursor(e){this.placeholder||(this.cursor+=e,this.cursorOffset+=e)}_(e,t){let n=this.value.slice(0,this.cursor),r=this.value.slice(this.cursor);this.value=`${n}${e}${r}`,this.red=!1,this.cursor=this.placeholder?0:n.length+1,this.render()}delete(){if(this.isCursorAtStart())return this.bell();let e=this.value.slice(0,this.cursor-1),t=this.value.slice(this.cursor);this.value=`${e}${t}`,this.red=!1,this.isCursorAtStart()?this.cursorOffset=0:(this.cursorOffset++,this.moveCursor(-1)),this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();let e=this.value.slice(0,this.cursor),t=this.value.slice(this.cursor+1);this.value=`${e}${t}`,this.red=!1,this.isCursorAtEnd()?this.cursorOffset=0:this.cursorOffset++,this.render()}first(){this.cursor=0,this.render()}last(){this.cursor=this.value.length,this.render()}left(){if(this.cursor<=0||this.placeholder)return this.bell();this.moveCursor(-1),this.render()}right(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();this.moveCursor(1),this.render()}isCursorAtStart(){return this.cursor===0||this.placeholder&&this.cursor===1}isCursorAtEnd(){return this.cursor===this.rendered.length||this.placeholder&&this.cursor===this.rendered.length+1}render(){this.closed||(this.firstRender||(this.outputError&&this.out.write(Da.down(Aa(this.outputError,this.out.columns)-1)+ka(this.outputError,this.out.columns)),this.out.write(ka(this.outputText,this.out.columns))),super.render(),this.outputError=``,this.outputText=[Oa.symbol(this.done,this.aborted),wa.bold(this.msg),Oa.delimiter(this.done),this.red?wa.red(this.rendered):this.rendered].join(` `),this.error&&(this.outputError+=this.errorMsg.split(`
`).reduce((e,t,n)=>e+`\n${n?` `:ja.pointerSmall} ${wa.red().italic(t)}`,``)),this.out.write(Ea.line+Da.to(0)+this.outputText+Da.save+this.outputError+Da.restore+Da.move(this.cursorOffset,0)))}};const H=I,Na=V,{style:Pa,clear:Fa,figures:Ia,wrap:La,entriesToDisplay:Ra}=B,{cursor:za}=L;var Ba=class extends Na{constructor(e={}){super(e),this.msg=e.message,this.hint=e.hint||`- Use arrow-keys. Return to submit.`,this.warn=e.warn||`- This option is disabled`,this.cursor=e.initial||0,this.choices=e.choices.map((e,t)=>(typeof e==`string`&&(e={title:e,value:t}),{title:e&&(e.title||e.value||e),value:e&&(e.value===void 0?t:e.value),description:e&&e.description,selected:e&&e.selected,disabled:e&&e.disabled})),this.optionsPerPage=e.optionsPerPage||10,this.value=(this.choices[this.cursor]||{}).value,this.clear=Fa(``,this.out.columns),this.render()}moveCursor(e){this.cursor=e,this.value=this.choices[e].value,this.fire()}reset(){this.moveCursor(0),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
`),this.close()}submit(){this.selection.disabled?this.bell():(this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
`),this.close())}first(){this.moveCursor(0),this.render()}last(){this.moveCursor(this.choices.length-1),this.render()}up(){this.cursor===0?this.moveCursor(this.choices.length-1):this.moveCursor(this.cursor-1),this.render()}down(){this.cursor===this.choices.length-1?this.moveCursor(0):this.moveCursor(this.cursor+1),this.render()}next(){this.moveCursor((this.cursor+1)%this.choices.length),this.render()}_(e,t){if(e===` `)return this.submit()}get selection(){return this.choices[this.cursor]}render(){if(this.closed)return;this.firstRender?this.out.write(za.hide):this.out.write(Fa(this.outputText,this.out.columns)),super.render();let{startIndex:e,endIndex:t}=Ra(this.cursor,this.choices.length,this.optionsPerPage);if(this.outputText=[Pa.symbol(this.done,this.aborted),H.bold(this.msg),Pa.delimiter(!1),this.done?this.selection.title:this.selection.disabled?H.yellow(this.warn):H.gray(this.hint)].join(` `),!this.done){this.outputText+=`
`;for(let n=e;n<t;n++){let r,i,a=``,o=this.choices[n];i=n===e&&e>0?Ia.arrowUp:n===t-1&&t<this.choices.length?Ia.arrowDown:` `,o.disabled?(r=this.cursor===n?H.gray().underline(o.title):H.strikethrough().gray(o.title),i=(this.cursor===n?H.bold().gray(Ia.pointer)+` `:` `)+i):(r=this.cursor===n?H.cyan().underline(o.title):o.title,i=(this.cursor===n?H.cyan(Ia.pointer)+` `:` `)+i,o.description&&this.cursor===n&&(a=` - ${o.description}`,(i.length+r.length+a.length>=this.out.columns||o.description.split(/\r?\n/).length>1)&&(a=`
`+La(o.description,{margin:3,width:this.out.columns})))),this.outputText+=`${i} ${r}${H.gray(a)}\n`}}this.out.write(this.outputText)}};const Va=I,Ha=V,{style:Ua,clear:Wa}=B,{cursor:Ga,erase:Ka}=L;var qa=class extends Ha{constructor(e={}){super(e),this.msg=e.message,this.value=!!e.initial,this.active=e.active||`on`,this.inactive=e.inactive||`off`,this.initialValue=this.value,this.render()}reset(){this.value=this.initialValue,this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
`),this.close()}submit(){this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
`),this.close()}deactivate(){if(this.value===!1)return this.bell();this.value=!1,this.render()}activate(){if(this.value===!0)return this.bell();this.value=!0,this.render()}delete(){this.deactivate()}left(){this.deactivate()}right(){this.activate()}down(){this.deactivate()}up(){this.activate()}next(){this.value=!this.value,this.fire(),this.render()}_(e,t){if(e===` `)this.value=!this.value;else if(e===`1`)this.value=!0;else if(e===`0`)this.value=!1;else return this.bell();this.render()}render(){this.closed||(this.firstRender?this.out.write(Ga.hide):this.out.write(Wa(this.outputText,this.out.columns)),super.render(),this.outputText=[Ua.symbol(this.done,this.aborted),Va.bold(this.msg),Ua.delimiter(this.done),this.value?this.inactive:Va.cyan().underline(this.inactive),Va.gray(`/`),this.value?Va.cyan().underline(this.active):this.active].join(` `),this.out.write(Ka.line+Ga.to(0)+this.outputText))}},U=class e{constructor({token:e,date:t,parts:n,locales:r}){this.token=e,this.date=t||new Date,this.parts=n||[this],this.locales=r||{}}up(){}down(){}next(){let t=this.parts.indexOf(this);return this.parts.find((n,r)=>r>t&&n instanceof e)}setTo(e){}prev(){let t=[].concat(this.parts).reverse(),n=t.indexOf(this);return t.find((t,r)=>r>n&&t instanceof e)}toString(){return String(this.date)}};const Ja=U;var Ya=class extends Ja{constructor(e={}){super(e)}up(){this.date.setHours((this.date.getHours()+12)%24)}down(){this.up()}toString(){let e=this.date.getHours()>12?`pm`:`am`;return/\A/.test(this.token)?e.toUpperCase():e}};const Xa=U,Za=e=>(e%=10,e===1?`st`:e===2?`nd`:e===3?`rd`:`th`);var Qa=class extends Xa{constructor(e={}){super(e)}up(){this.date.setDate(this.date.getDate()+1)}down(){this.date.setDate(this.date.getDate()-1)}setTo(e){this.date.setDate(parseInt(e.substr(-2)))}toString(){let e=this.date.getDate(),t=this.date.getDay();return this.token===`DD`?String(e).padStart(2,`0`):this.token===`Do`?e+Za(e):this.token===`d`?t+1:this.token===`ddd`?this.locales.weekdaysShort[t]:this.token===`dddd`?this.locales.weekdays[t]:e}};const $a=U;var eo=class extends $a{constructor(e={}){super(e)}up(){this.date.setHours(this.date.getHours()+1)}down(){this.date.setHours(this.date.getHours()-1)}setTo(e){this.date.setHours(parseInt(e.substr(-2)))}toString(){let e=this.date.getHours();return/h/.test(this.token)&&(e=e%12||12),this.token.length>1?String(e).padStart(2,`0`):e}};const to=U;var no=class extends to{constructor(e={}){super(e)}up(){this.date.setMilliseconds(this.date.getMilliseconds()+1)}down(){this.date.setMilliseconds(this.date.getMilliseconds()-1)}setTo(e){this.date.setMilliseconds(parseInt(e.substr(-this.token.length)))}toString(){return String(this.date.getMilliseconds()).padStart(4,`0`).substr(0,this.token.length)}};const ro=U;var io=class extends ro{constructor(e={}){super(e)}up(){this.date.setMinutes(this.date.getMinutes()+1)}down(){this.date.setMinutes(this.date.getMinutes()-1)}setTo(e){this.date.setMinutes(parseInt(e.substr(-2)))}toString(){let e=this.date.getMinutes();return this.token.length>1?String(e).padStart(2,`0`):e}};const ao=U;var oo=class extends ao{constructor(e={}){super(e)}up(){this.date.setMonth(this.date.getMonth()+1)}down(){this.date.setMonth(this.date.getMonth()-1)}setTo(e){e=parseInt(e.substr(-2))-1,this.date.setMonth(e<0?0:e)}toString(){let e=this.date.getMonth(),t=this.token.length;return t===2?String(e+1).padStart(2,`0`):t===3?this.locales.monthsShort[e]:t===4?this.locales.months[e]:String(e+1)}};const so=U;var co=class extends so{constructor(e={}){super(e)}up(){this.date.setSeconds(this.date.getSeconds()+1)}down(){this.date.setSeconds(this.date.getSeconds()-1)}setTo(e){this.date.setSeconds(parseInt(e.substr(-2)))}toString(){let e=this.date.getSeconds();return this.token.length>1?String(e).padStart(2,`0`):e}};const lo=U;var uo={DatePart:U,Meridiem:Ya,Day:Qa,Hours:eo,Milliseconds:no,Minutes:io,Month:oo,Seconds:co,Year:class extends lo{constructor(e={}){super(e)}up(){this.date.setFullYear(this.date.getFullYear()+1)}down(){this.date.setFullYear(this.date.getFullYear()-1)}setTo(e){this.date.setFullYear(e.substr(-4))}toString(){let e=String(this.date.getFullYear()).padStart(4,`0`);return this.token.length===2?e.substr(-2):e}}};const fo=I,po=V,{style:mo,clear:ho,figures:go}=B,{erase:_o,cursor:vo}=L,{DatePart:yo,Meridiem:bo,Day:xo,Hours:So,Milliseconds:Co,Minutes:wo,Month:To,Seconds:Eo,Year:Do}=uo,Oo=/\\(.)|"((?:\\["\\]|[^"])+)"|(D[Do]?|d{3,4}|d)|(M{1,4})|(YY(?:YY)?)|([aA])|([Hh]{1,2})|(m{1,2})|(s{1,2})|(S{1,4})|./g,ko={1:({token:e})=>e.replace(/\\(.)/g,`$1`),2:e=>new xo(e),3:e=>new To(e),4:e=>new Do(e),5:e=>new bo(e),6:e=>new So(e),7:e=>new wo(e),8:e=>new Eo(e),9:e=>new Co(e)},Ao={months:`January,February,March,April,May,June,July,August,September,October,November,December`.split(`,`),monthsShort:`Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec`.split(`,`),weekdays:`Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday`.split(`,`),weekdaysShort:`Sun,Mon,Tue,Wed,Thu,Fri,Sat`.split(`,`)};var jo=class extends po{constructor(e={}){super(e),this.msg=e.message,this.cursor=0,this.typed=``,this.locales=Object.assign(Ao,e.locales),this._date=e.initial||new Date,this.errorMsg=e.error||`Please Enter A Valid Value`,this.validator=e.validate||(()=>!0),this.mask=e.mask||`YYYY-MM-DD HH:mm:ss`,this.clear=ho(``,this.out.columns),this.render()}get value(){return this.date}get date(){return this._date}set date(e){e&&this._date.setTime(e.getTime())}set mask(e){let t;for(this.parts=[];t=Oo.exec(e);){let e=t.shift(),n=t.findIndex(e=>e!=null);this.parts.push(n in ko?ko[n]({token:t[n]||e,date:this.date,parts:this.parts,locales:this.locales}):t[n]||e)}let n=this.parts.reduce((e,t)=>(typeof t==`string`&&typeof e[e.length-1]==`string`?e[e.length-1]+=t:e.push(t),e),[]);this.parts.splice(0),this.parts.push(...n),this.reset()}moveCursor(e){this.typed=``,this.cursor=e,this.fire()}reset(){this.moveCursor(this.parts.findIndex(e=>e instanceof yo)),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
`),this.close()}async validate(){let e=await this.validator(this.value);typeof e==`string`&&(this.errorMsg=e,e=!1),this.error=!e}async submit(){if(await this.validate(),this.error){this.color=`red`,this.fire(),this.render();return}this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
`),this.close()}up(){this.typed=``,this.parts[this.cursor].up(),this.render()}down(){this.typed=``,this.parts[this.cursor].down(),this.render()}left(){let e=this.parts[this.cursor].prev();if(e==null)return this.bell();this.moveCursor(this.parts.indexOf(e)),this.render()}right(){let e=this.parts[this.cursor].next();if(e==null)return this.bell();this.moveCursor(this.parts.indexOf(e)),this.render()}next(){let e=this.parts[this.cursor].next();this.moveCursor(e?this.parts.indexOf(e):this.parts.findIndex(e=>e instanceof yo)),this.render()}_(e){/\d/.test(e)&&(this.typed+=e,this.parts[this.cursor].setTo(this.typed),this.render())}render(){this.closed||(this.firstRender?this.out.write(vo.hide):this.out.write(ho(this.outputText,this.out.columns)),super.render(),this.outputText=[mo.symbol(this.done,this.aborted),fo.bold(this.msg),mo.delimiter(!1),this.parts.reduce((e,t,n)=>e.concat(n===this.cursor&&!this.done?fo.cyan().underline(t.toString()):t),[]).join(``)].join(` `),this.error&&(this.outputText+=this.errorMsg.split(`
`).reduce((e,t,n)=>e+`\n${n?` `:go.pointerSmall} ${fo.red().italic(t)}`,``)),this.out.write(_o.line+vo.to(0)+this.outputText))}};const Mo=I,No=V,{cursor:Po,erase:Fo}=L,{style:Io,figures:Lo,clear:Ro,lines:zo}=B,Bo=/[0-9]/,Vo=e=>e!==void 0,Ho=(e,t)=>{let n=10**t;return Math.round(e*n)/n};var Uo=class extends No{constructor(e={}){super(e),this.transform=Io.render(e.style),this.msg=e.message,this.initial=Vo(e.initial)?e.initial:``,this.float=!!e.float,this.round=e.round||2,this.inc=e.increment||1,this.min=Vo(e.min)?e.min:-1/0,this.max=Vo(e.max)?e.max:1/0,this.errorMsg=e.error||`Please Enter A Valid Value`,this.validator=e.validate||(()=>!0),this.color=`cyan`,this.value=``,this.typed=``,this.lastHit=0,this.render()}set value(e){!e&&e!==0?(this.placeholder=!0,this.rendered=Mo.gray(this.transform.render(`${this.initial}`)),this._value=``):(this.placeholder=!1,this.rendered=this.transform.render(`${Ho(e,this.round)}`),this._value=Ho(e,this.round)),this.fire()}get value(){return this._value}parse(e){return this.float?parseFloat(e):parseInt(e)}valid(e){return e===`-`||e===`.`&&this.float||Bo.test(e)}reset(){this.typed=``,this.value=``,this.fire(),this.render()}exit(){this.abort()}abort(){let e=this.value;this.value=e===``?this.initial:e,this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
`),this.close()}async validate(){let e=await this.validator(this.value);typeof e==`string`&&(this.errorMsg=e,e=!1),this.error=!e}async submit(){if(await this.validate(),this.error){this.color=`red`,this.fire(),this.render();return}let e=this.value;this.value=e===``?this.initial:e,this.done=!0,this.aborted=!1,this.error=!1,this.fire(),this.render(),this.out.write(`
`),this.close()}up(){if(this.typed=``,this.value===``&&(this.value=this.min-this.inc),this.value>=this.max)return this.bell();this.value+=this.inc,this.color=`cyan`,this.fire(),this.render()}down(){if(this.typed=``,this.value===``&&(this.value=this.min+this.inc),this.value<=this.min)return this.bell();this.value-=this.inc,this.color=`cyan`,this.fire(),this.render()}delete(){let e=this.value.toString();if(e.length===0)return this.bell();this.value=this.parse(e=e.slice(0,-1))||``,this.value!==``&&this.value<this.min&&(this.value=this.min),this.color=`cyan`,this.fire(),this.render()}next(){this.value=this.initial,this.fire(),this.render()}_(e,t){if(!this.valid(e))return this.bell();let n=Date.now();if(n-this.lastHit>1e3&&(this.typed=``),this.typed+=e,this.lastHit=n,this.color=`cyan`,e===`.`)return this.fire();this.value=Math.min(this.parse(this.typed),this.max),this.value>this.max&&(this.value=this.max),this.value<this.min&&(this.value=this.min),this.fire(),this.render()}render(){this.closed||(this.firstRender||(this.outputError&&this.out.write(Po.down(zo(this.outputError,this.out.columns)-1)+Ro(this.outputError,this.out.columns)),this.out.write(Ro(this.outputText,this.out.columns))),super.render(),this.outputError=``,this.outputText=[Io.symbol(this.done,this.aborted),Mo.bold(this.msg),Io.delimiter(this.done),!this.done||!this.done&&!this.placeholder?Mo[this.color]().underline(this.rendered):this.rendered].join(` `),this.error&&(this.outputError+=this.errorMsg.split(`
`).reduce((e,t,n)=>e+`\n${n?` `:Lo.pointerSmall} ${Mo.red().italic(t)}`,``)),this.out.write(Fo.line+Po.to(0)+this.outputText+Po.save+this.outputError+Po.restore))}};const W=I,{cursor:Wo}=L,Go=V,{clear:Ko,figures:G,style:qo,wrap:Jo,entriesToDisplay:Yo}=B;var Xo=class extends Go{constructor(e={}){super(e),this.msg=e.message,this.cursor=e.cursor||0,this.scrollIndex=e.cursor||0,this.hint=e.hint||``,this.warn=e.warn||`- This option is disabled -`,this.minSelected=e.min,this.showMinError=!1,this.maxChoices=e.max,this.instructions=e.instructions,this.optionsPerPage=e.optionsPerPage||10,this.value=e.choices.map((e,t)=>(typeof e==`string`&&(e={title:e,value:t}),{title:e&&(e.title||e.value||e),description:e&&e.description,value:e&&(e.value===void 0?t:e.value),selected:e&&e.selected,disabled:e&&e.disabled})),this.clear=Ko(``,this.out.columns),e.overrideRender||this.render()}reset(){this.value.map(e=>!e.selected),this.cursor=0,this.fire(),this.render()}selected(){return this.value.filter(e=>e.selected)}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
`),this.close()}submit(){let e=this.value.filter(e=>e.selected);this.minSelected&&e.length<this.minSelected?(this.showMinError=!0,this.render()):(this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
`),this.close())}first(){this.cursor=0,this.render()}last(){this.cursor=this.value.length-1,this.render()}next(){this.cursor=(this.cursor+1)%this.value.length,this.render()}up(){this.cursor===0?this.cursor=this.value.length-1:this.cursor--,this.render()}down(){this.cursor===this.value.length-1?this.cursor=0:this.cursor++,this.render()}left(){this.value[this.cursor].selected=!1,this.render()}right(){if(this.value.filter(e=>e.selected).length>=this.maxChoices)return this.bell();this.value[this.cursor].selected=!0,this.render()}handleSpaceToggle(){let e=this.value[this.cursor];if(e.selected)e.selected=!1,this.render();else if(e.disabled||this.value.filter(e=>e.selected).length>=this.maxChoices)return this.bell();else e.selected=!0,this.render()}toggleAll(){if(this.maxChoices!==void 0||this.value[this.cursor].disabled)return this.bell();let e=!this.value[this.cursor].selected;this.value.filter(e=>!e.disabled).forEach(t=>t.selected=e),this.render()}_(e,t){if(e===` `)this.handleSpaceToggle();else if(e===`a`)this.toggleAll();else return this.bell()}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions==`string`?this.instructions:`
Instructions:
${G.arrowUp}/${G.arrowDown}: Highlight option\n ${G.arrowLeft}/${G.arrowRight}/[space]: Toggle selection\n`+(this.maxChoices===void 0?` a: Toggle all
`:``)+` enter/return: Complete answer`:``}renderOption(e,t,n,r){let i=(t.selected?W.green(G.radioOn):G.radioOff)+` `+r+` `,a,o;return t.disabled?a=e===n?W.gray().underline(t.title):W.strikethrough().gray(t.title):(a=e===n?W.cyan().underline(t.title):t.title,e===n&&t.description&&(o=` - ${t.description}`,(i.length+a.length+o.length>=this.out.columns||t.description.split(/\r?\n/).length>1)&&(o=`
`+Jo(t.description,{margin:i.length,width:this.out.columns})))),i+a+W.gray(o||``)}paginateOptions(e){if(e.length===0)return W.red(`No matches for this query.`);let{startIndex:t,endIndex:n}=Yo(this.cursor,e.length,this.optionsPerPage),r,i=[];for(let a=t;a<n;a++)r=a===t&&t>0?G.arrowUp:a===n-1&&n<e.length?G.arrowDown:` `,i.push(this.renderOption(this.cursor,e[a],a,r));return`
`+i.join(`
`)}renderOptions(e){return this.done?``:this.paginateOptions(e)}renderDoneOrInstructions(){if(this.done)return this.value.filter(e=>e.selected).map(e=>e.title).join(`, `);let e=[W.gray(this.hint),this.renderInstructions()];return this.value[this.cursor].disabled&&e.push(W.yellow(this.warn)),e.join(` `)}render(){if(this.closed)return;this.firstRender&&this.out.write(Wo.hide),super.render();let e=[qo.symbol(this.done,this.aborted),W.bold(this.msg),qo.delimiter(!1),this.renderDoneOrInstructions()].join(` `);this.showMinError&&=(e+=W.red(`You must select a minimum of ${this.minSelected} choices.`),!1),e+=this.renderOptions(this.value),this.out.write(this.clear+e),this.clear=Ko(e,this.out.columns)}};const Zo=I,Qo=V,{erase:$o,cursor:es}=L,{style:ts,clear:ns,figures:rs,wrap:is,entriesToDisplay:as}=B,os=(e,t)=>e[t]&&(e[t].value||e[t].title||e[t]),ss=(e,t)=>e[t]&&(e[t].title||e[t].value||e[t]),cs=(e,t)=>{let n=e.findIndex(e=>e.value===t||e.title===t);return n>-1?n:void 0};var ls=class extends Qo{constructor(e={}){super(e),this.msg=e.message,this.suggest=e.suggest,this.choices=e.choices,this.initial=typeof e.initial==`number`?e.initial:cs(e.choices,e.initial),this.select=this.initial||e.cursor||0,this.i18n={noMatches:e.noMatches||`no matches found`},this.fallback=e.fallback||this.initial,this.clearFirst=e.clearFirst||!1,this.suggestions=[],this.input=``,this.limit=e.limit||10,this.cursor=0,this.transform=ts.render(e.style),this.scale=this.transform.scale,this.render=this.render.bind(this),this.complete=this.complete.bind(this),this.clear=ns(``,this.out.columns),this.complete(this.render),this.render()}set fallback(e){this._fb=Number.isSafeInteger(parseInt(e))?parseInt(e):e}get fallback(){let e;return typeof this._fb==`number`?e=this.choices[this._fb]:typeof this._fb==`string`&&(e={title:this._fb}),e||this._fb||{title:this.i18n.noMatches}}moveSelect(e){this.select=e,this.suggestions.length>0?this.value=os(this.suggestions,e):this.value=this.fallback.value,this.fire()}async complete(e){let t=this.completing=this.suggest(this.input,this.choices),n=await t;if(this.completing!==t)return;this.suggestions=n.map((e,t,n)=>({title:ss(n,t),value:os(n,t),description:e.description})),this.completing=!1;let r=Math.max(n.length-1,0);this.moveSelect(Math.min(r,this.select)),e&&e()}reset(){this.input=``,this.complete(()=>{this.moveSelect(this.initial===void 0?0:this.initial),this.render()}),this.render()}exit(){this.clearFirst&&this.input.length>0?this.reset():(this.done=this.exited=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
`),this.close())}abort(){this.done=this.aborted=!0,this.exited=!1,this.fire(),this.render(),this.out.write(`
`),this.close()}submit(){this.done=!0,this.aborted=this.exited=!1,this.fire(),this.render(),this.out.write(`
`),this.close()}_(e,t){let n=this.input.slice(0,this.cursor),r=this.input.slice(this.cursor);this.input=`${n}${e}${r}`,this.cursor=n.length+1,this.complete(this.render),this.render()}delete(){if(this.cursor===0)return this.bell();let e=this.input.slice(0,this.cursor-1),t=this.input.slice(this.cursor);this.input=`${e}${t}`,this.complete(this.render),--this.cursor,this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();let e=this.input.slice(0,this.cursor),t=this.input.slice(this.cursor+1);this.input=`${e}${t}`,this.complete(this.render),this.render()}first(){this.moveSelect(0),this.render()}last(){this.moveSelect(this.suggestions.length-1),this.render()}up(){this.select===0?this.moveSelect(this.suggestions.length-1):this.moveSelect(this.select-1),this.render()}down(){this.select===this.suggestions.length-1?this.moveSelect(0):this.moveSelect(this.select+1),this.render()}next(){this.select===this.suggestions.length-1?this.moveSelect(0):this.moveSelect(this.select+1),this.render()}nextPage(){this.moveSelect(Math.min(this.select+this.limit,this.suggestions.length-1)),this.render()}prevPage(){this.moveSelect(Math.max(this.select-this.limit,0)),this.render()}left(){if(this.cursor<=0)return this.bell();--this.cursor,this.render()}right(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();this.cursor+=1,this.render()}renderOption(e,t,n,r){let i,a=n?rs.arrowUp:r?rs.arrowDown:` `,o=t?Zo.cyan().underline(e.title):e.title;return a=(t?Zo.cyan(rs.pointer)+` `:` `)+a,e.description&&(i=` - ${e.description}`,(a.length+o.length+i.length>=this.out.columns||e.description.split(/\r?\n/).length>1)&&(i=`
`+is(e.description,{margin:3,width:this.out.columns}))),a+` `+o+Zo.gray(i||``)}render(){if(this.closed)return;this.firstRender?this.out.write(es.hide):this.out.write(ns(this.outputText,this.out.columns)),super.render();let{startIndex:e,endIndex:t}=as(this.select,this.choices.length,this.limit);if(this.outputText=[ts.symbol(this.done,this.aborted,this.exited),Zo.bold(this.msg),ts.delimiter(this.completing),this.done&&this.suggestions[this.select]?this.suggestions[this.select].title:this.rendered=this.transform.render(this.input)].join(` `),!this.done){let n=this.suggestions.slice(e,t).map((n,r)=>this.renderOption(n,this.select===r+e,r===0&&e>0,r+e===t-1&&t<this.choices.length)).join(`
`);this.outputText+=`
`+(n||Zo.gray(this.fallback.title))}this.out.write($o.line+es.to(0)+this.outputText)}};const K=I,{cursor:us}=L,ds=Xo,{clear:fs,style:ps,figures:q}=B;var ms=class extends ds{constructor(e={}){e.overrideRender=!0,super(e),this.inputValue=``,this.clear=fs(``,this.out.columns),this.filteredOptions=this.value,this.render()}last(){this.cursor=this.filteredOptions.length-1,this.render()}next(){this.cursor=(this.cursor+1)%this.filteredOptions.length,this.render()}up(){this.cursor===0?this.cursor=this.filteredOptions.length-1:this.cursor--,this.render()}down(){this.cursor===this.filteredOptions.length-1?this.cursor=0:this.cursor++,this.render()}left(){this.filteredOptions[this.cursor].selected=!1,this.render()}right(){if(this.value.filter(e=>e.selected).length>=this.maxChoices)return this.bell();this.filteredOptions[this.cursor].selected=!0,this.render()}delete(){this.inputValue.length&&(this.inputValue=this.inputValue.substr(0,this.inputValue.length-1),this.updateFilteredOptions())}updateFilteredOptions(){let e=this.filteredOptions[this.cursor];this.filteredOptions=this.value.filter(e=>this.inputValue?!!(typeof e.title==`string`&&e.title.toLowerCase().includes(this.inputValue.toLowerCase())||typeof e.value==`string`&&e.value.toLowerCase().includes(this.inputValue.toLowerCase())):!0);let t=this.filteredOptions.findIndex(t=>t===e);this.cursor=t<0?0:t,this.render()}handleSpaceToggle(){let e=this.filteredOptions[this.cursor];if(e.selected)e.selected=!1,this.render();else if(e.disabled||this.value.filter(e=>e.selected).length>=this.maxChoices)return this.bell();else e.selected=!0,this.render()}handleInputChange(e){this.inputValue+=e,this.updateFilteredOptions()}_(e,t){e===` `?this.handleSpaceToggle():this.handleInputChange(e)}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions==`string`?this.instructions:`
Instructions:
${q.arrowUp}/${q.arrowDown}: Highlight option
${q.arrowLeft}/${q.arrowRight}/[space]: Toggle selection
[a,b,c]/delete: Filter choices
enter/return: Complete answer
`:``}renderCurrentInput(){return`
Filtered results for: ${this.inputValue?this.inputValue:K.gray(`Enter something to filter`)}\n`}renderOption(e,t,n,r){let i=(t.selected?K.green(q.radioOn):q.radioOff)+` `+r+` `,a;return a=t.disabled?e===n?K.gray().underline(t.title):K.strikethrough().gray(t.title):e===n?K.cyan().underline(t.title):t.title,i+a}renderDoneOrInstructions(){if(this.done)return this.value.filter(e=>e.selected).map(e=>e.title).join(`, `);let e=[K.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];return this.filteredOptions.length&&this.filteredOptions[this.cursor].disabled&&e.push(K.yellow(this.warn)),e.join(` `)}render(){if(this.closed)return;this.firstRender&&this.out.write(us.hide),super.render();let e=[ps.symbol(this.done,this.aborted),K.bold(this.msg),ps.delimiter(!1),this.renderDoneOrInstructions()].join(` `);this.showMinError&&=(e+=K.red(`You must select a minimum of ${this.minSelected} choices.`),!1),e+=this.renderOptions(this.filteredOptions),this.out.write(this.clear+e),this.clear=fs(e,this.out.columns)}};const hs=I,gs=V,{style:_s,clear:vs}=B,{erase:ys,cursor:bs}=L;var xs={TextPrompt:Ma,SelectPrompt:Ba,TogglePrompt:qa,DatePrompt:jo,NumberPrompt:Uo,MultiselectPrompt:Xo,AutocompletePrompt:ls,AutocompleteMultiselectPrompt:ms,ConfirmPrompt:class extends gs{constructor(e={}){super(e),this.msg=e.message,this.value=e.initial,this.initialValue=!!e.initial,this.yesMsg=e.yes||`yes`,this.yesOption=e.yesOption||`(Y/n)`,this.noMsg=e.no||`no`,this.noOption=e.noOption||`(y/N)`,this.render()}reset(){this.value=this.initialValue,this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
`),this.close()}submit(){this.value=this.value||!1,this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
`),this.close()}_(e,t){return e.toLowerCase()===`y`?(this.value=!0,this.submit()):e.toLowerCase()===`n`?(this.value=!1,this.submit()):this.bell()}render(){this.closed||(this.firstRender?this.out.write(bs.hide):this.out.write(vs(this.outputText,this.out.columns)),super.render(),this.outputText=[_s.symbol(this.done,this.aborted),hs.bold(this.msg),_s.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:hs.gray(this.initialValue?this.yesOption:this.noOption)].join(` `),this.out.write(ys.line+bs.to(0)+this.outputText))}}};(function(e){let t=e,n=xs,r=e=>e;function i(e,t,i={}){return new Promise((a,o)=>{let s=new n[e](t),c=i.onAbort||r,l=i.onSubmit||r,u=i.onExit||r;s.on(`state`,t.onState||r),s.on(`submit`,e=>a(l(e))),s.on(`exit`,e=>a(u(e))),s.on(`abort`,e=>o(c(e)))})}t.text=e=>i(`TextPrompt`,e),t.password=e=>(e.style=`password`,t.text(e)),t.invisible=e=>(e.style=`invisible`,t.text(e)),t.number=e=>i(`NumberPrompt`,e),t.date=e=>i(`DatePrompt`,e),t.confirm=e=>i(`ConfirmPrompt`,e),t.list=e=>{let t=e.separator||`,`;return i(`TextPrompt`,e,{onSubmit:e=>e.split(t).map(e=>e.trim())})},t.toggle=e=>i(`TogglePrompt`,e),t.select=e=>i(`SelectPrompt`,e),t.multiselect=e=>{e.choices=[].concat(e.choices||[]);let t=e=>e.filter(e=>e.selected).map(e=>e.value);return i(`MultiselectPrompt`,e,{onAbort:t,onSubmit:t})},t.autocompleteMultiselect=e=>{e.choices=[].concat(e.choices||[]);let t=e=>e.filter(e=>e.selected).map(e=>e.value);return i(`AutocompleteMultiselectPrompt`,e,{onAbort:t,onSubmit:t})};let a=(e,t)=>Promise.resolve(t.filter(t=>t.title.slice(0,e.length).toLowerCase()===e.toLowerCase()));t.autocomplete=e=>(e.suggest=e.suggest||a,e.choices=[].concat(e.choices||[]),i(`AutocompletePrompt`,e))})(Ji);const Ss=Ji,Cs=[`suggest`,`format`,`onState`,`validate`,`onRender`,`type`],ws=()=>{};async function J(e=[],{onSubmit:t=ws,onCancel:n=ws}={}){let r={},i=J._override||{};e=[].concat(e);let a,o,s,c,l,u,d=async(e,t,n=!1)=>{if(!(!n&&e.validate&&e.validate(t)!==!0))return e.format?await e.format(t,r):t};for(o of e)if({name:c,type:l}=o,typeof l==`function`&&(l=await l(a,{...r},o),o.type=l),l){for(let e in o){if(Cs.includes(e))continue;let t=o[e];o[e]=typeof t==`function`?await t(a,{...r},u):t}if(u=o,typeof o.message!=`string`)throw Error(`prompt message is required`);if({name:c,type:l}=o,Ss[l]===void 0)throw Error(`prompt type (${l}) is not defined`);if(i[o.name]!==void 0&&(a=await d(o,i[o.name]),a!==void 0)){r[c]=a;continue}try{a=J._injected?Ts(J._injected,o.initial):await Ss[l](o),r[c]=a=await d(o,a,!0),s=await t(o,a,r)}catch{s=!await n(o,r)}if(s)return r}return r}function Ts(e,t){let n=e.shift();if(n instanceof Error)throw n;return n===void 0?t:n}function Es(e){J._injected=(J._injected||[]).concat(e)}function Ds(e){J._override=Object.assign({},e)}const Os=w(Object.assign(J,{prompt:J,prompts:Ss,inject:Es,override:Ds}));var ks={},Y={};Object.defineProperty(Y,`__esModule`,{value:!0}),Y.sync=Y.isexe=void 0;const As=n.default,js=y.default;Y.isexe=async(e,t={})=>{let{ignoreErrors:n=!1}=t;try{return Ms(await(0,js.stat)(e),t)}catch(e){let t=e;if(n||t.code===`EACCES`)return!1;throw t}},Y.sync=(e,t={})=>{let{ignoreErrors:n=!1}=t;try{return Ms((0,As.statSync)(e),t)}catch(e){let t=e;if(n||t.code===`EACCES`)return!1;throw t}};const Ms=(e,t)=>e.isFile()&&Ns(e,t),Ns=(e,t)=>{let n=t.uid??process.getuid?.(),r=t.groups??process.getgroups?.()??[],i=t.gid??process.getgid?.()??r[0];if(n===void 0||i===void 0)throw Error(`cannot get uid or gid`);let a=new Set([i,...r]),o=e.mode,s=e.uid,c=e.gid;return!!(o&1||o&8&&a.has(c)||o&64&&s===n||o&72&&n===0)};var X={};Object.defineProperty(X,`__esModule`,{value:!0}),X.sync=X.isexe=void 0;const Ps=n.default,Fs=y.default;X.isexe=async(e,t={})=>{let{ignoreErrors:n=!1}=t;try{return Ls(await(0,Fs.stat)(e),e,t)}catch(e){let t=e;if(n||t.code===`EACCES`)return!1;throw t}},X.sync=(e,t={})=>{let{ignoreErrors:n=!1}=t;try{return Ls((0,Ps.statSync)(e),e,t)}catch(e){let t=e;if(n||t.code===`EACCES`)return!1;throw t}};const Is=(e,t)=>{let{pathExt:n=process.env.PATHEXT||``}=t,r=n.split(`;`);if(r.indexOf(``)!==-1)return!0;for(let t=0;t<r.length;t++){let n=r[t].toLowerCase(),i=e.substring(e.length-n.length).toLowerCase();if(n&&i===n)return!0}return!1},Ls=(e,t,n)=>e.isFile()&&Is(t,n);var Rs={};Object.defineProperty(Rs,`__esModule`,{value:!0}),(function(e){var t=C&&C.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),n=C&&C.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,`default`,{enumerable:!0,value:t})}):function(e,t){e.default=t}),r=C&&C.__importStar||function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var i in e)i!==`default`&&Object.prototype.hasOwnProperty.call(e,i)&&t(r,e,i);return n(r,e),r},i=C&&C.__exportStar||function(e,n){for(var r in e)r!==`default`&&!Object.prototype.hasOwnProperty.call(n,r)&&t(n,e,r)};Object.defineProperty(e,`__esModule`,{value:!0}),e.sync=e.isexe=e.posix=e.win32=void 0;let a=r(Y);e.posix=a;let o=r(X);e.win32=o,i(Rs,e);let s=(process.env._ISEXE_TEST_PLATFORM_||process.platform)===`win32`?o:a;e.isexe=s.isexe,e.sync=s.sync})(ks);const{isexe:zs,sync:Bs}=ks,{join:Vs,delimiter:Hs,sep:Us,posix:Ws}=r.default,Gs=process.platform===`win32`,Ks=new RegExp(`[${Ws.sep}${Us===Ws.sep?``:Us}]`.replace(/(\\)/g,`\\$1`)),qs=RegExp(`^\\.${Ks.source}`),Js=e=>Object.assign(Error(`not found: ${e}`),{code:`ENOENT`}),Ys=(e,{path:t=process.env.PATH,pathExt:n=process.env.PATHEXT,delimiter:r=Hs})=>{let i=e.match(Ks)?[``]:[...Gs?[process.cwd()]:[],...(t||``).split(r)];if(Gs){let t=n||[`.EXE`,`.CMD`,`.BAT`,`.COM`].join(r),a=t.split(r).flatMap(e=>[e,e.toLowerCase()]);return e.includes(`.`)&&a[0]!==``&&a.unshift(``),{pathEnv:i,pathExt:a,pathExtExe:t}}return{pathEnv:i,pathExt:[``]}},Xs=(e,t)=>{let n=/^".*"$/.test(e)?e.slice(1,-1):e;return(!n&&qs.test(t)?t.slice(0,2):``)+Vs(n,t)},Zs=async(e,t={})=>{let{pathEnv:n,pathExt:r,pathExtExe:i}=Ys(e,t),a=[];for(let o of n){let n=Xs(o,e);for(let e of r){let r=n+e;if(await zs(r,{pathExt:i,ignoreErrors:!0})){if(!t.all)return r;a.push(r)}}}if(t.all&&a.length)return a;if(t.nothrow)return null;throw Js(e)},Qs=(e,t={})=>{let{pathEnv:n,pathExt:r,pathExtExe:i}=Ys(e,t),a=[];for(let o of n){let n=Xs(o,e);for(let e of r){let r=n+e;if(Bs(r,{pathExt:i,ignoreErrors:!0})){if(!t.all)return r;a.push(r)}}}if(t.all&&a.length)return a;if(t.nothrow)return null;throw Js(e)};var $s=Zs;Zs.sync=Qs;const ec=w($s);(0,f.join)(d.default.tmpdir(),`antfu-ni`);function tc(e,t){return e.slice().filter(e=>e!==t)}function nc(e){return ec.sync(e,{nothrow:!0})!==null}async function rc({autoInstall:e,programmatic:t,cwd:n}={}){let r=null,i=null,a=await Fi(Object.keys(Ve),{cwd:n}),o;if(o=a?f.default.resolve(a,`../package.json`):await Fi(`package.json`,{cwd:n}),o&&u.default.existsSync(o))try{let e=JSON.parse(u.default.readFileSync(o,`utf8`));if(typeof e.packageManager==`string`){let[n,a]=e.packageManager.replace(/^\^/,``).split(`@`);i=a,n===`yarn`&&Number.parseInt(a)>1?(r=`yarn@berry`,i=`berry`):n===`pnpm`&&Number.parseInt(a)<7?r=`pnpm@6`:n in ze?r=n:t||console.warn(`[ni] Unknown packageManager:`,e.packageManager)}}catch{}if(!r&&a&&(r=Ve[f.default.basename(a)]),r&&!nc(r.split(`@`)[0])&&!t){if(!e){console.warn(`[ni] Detected ${r} but it doesn't seem to be installed.
`),p.default.env.CI&&p.default.exit(1);let{tryInstall:e}=await Os({name:`tryInstall`,type:`confirm`,message:`Would you like to globally install ${qi(r,He[r])}?`});e||p.default.exit(1)}await yi(`npm i -g ${r.split(`@`)[0]}${i?`@${i}`:``}`,{stdio:`inherit`,cwd:n})}return r}const ic=p.default.env.NI_CONFIG_FILE,ac=p.default.platform===`win32`?p.default.env.USERPROFILE:p.default.env.HOME,oc=f.default.join(ac||`~/`,`.nirc`),sc=ic||oc,cc={defaultAgent:`prompt`,globalAgent:`npm`};let lc;async function uc(){if(!lc){lc=Object.assign({},cc,u.default.existsSync(sc)?Ye.parse(u.default.readFileSync(sc,`utf-8`)):null);let e=await rc({programmatic:!0});e&&(lc.defaultAgent=e)}return lc}async function dc(e){let{defaultAgent:t}=await uc();return t===`prompt`&&(e||p.default.env.CI)?`npm`:t}async function fc(){let{globalAgent:e}=await uc();return e}var pc=class extends Error{constructor({agent:e,command:t}){super(`Command "${t}" is not support by agent "${e}"`)}};function Z(e,t,n=[]){if(!(e in ze))throw Error(`Unsupported agent "${e}"`);let r=ze[e][t];if(typeof r==`function`)return r(n);if(!r)throw new pc({agent:e,command:t});return r.replace(`{0}`,n.map(e=>!e.startsWith(`--`)&&e.includes(` `)?JSON.stringify(e):e).join(` `)).trim()}const mc=(e,t,n)=>(e===`bun`&&(t=t.map(e=>e===`-D`?`-d`:e)),t.includes(`-g`)?Z(e,`global`,tc(t,`-g`)):t.includes(`--frozen-if-present`)?(t=tc(t,`--frozen-if-present`),Z(e,n?.hasLock?`frozen`:`install`,t)):t.includes(`--frozen`)?Z(e,`frozen`,tc(t,`--frozen`)):t.length===0||t.every(e=>e.startsWith(`-`))?Z(e,`install`,t):Z(e,`add`,t)),hc=(e,t)=>(t.length===0&&t.push(`start`),t.includes(`--if-present`)&&(t=tc(t,`--if-present`),t[0]=`--if-present ${t[0]}`),Z(e,`run`,t)),gc=(e,t)=>Z(e,`agent`,t);let _c,vc,yc,bc,xc=!0;typeof process<`u`&&({FORCE_COLOR:_c,NODE_DISABLE_COLORS:vc,NO_COLOR:yc,TERM:bc}=process.env||{},xc=process.stdout&&process.stdout.isTTY);const Q={enabled:!vc&&yc==null&&bc!==`dumb`&&(_c!=null&&_c!==`0`||xc),reset:$(0,0),bold:$(1,22),dim:$(2,22),italic:$(3,23),underline:$(4,24),inverse:$(7,27),hidden:$(8,28),strikethrough:$(9,29),black:$(30,39),red:$(31,39),green:$(32,39),yellow:$(33,39),blue:$(34,39),magenta:$(35,39),cyan:$(36,39),white:$(37,39),gray:$(90,39),grey:$(90,39),bgBlack:$(40,49),bgRed:$(41,49),bgGreen:$(42,49),bgYellow:$(43,49),bgBlue:$(44,49),bgMagenta:$(45,49),bgCyan:$(46,49),bgWhite:$(47,49)};function Sc(e,t){let n=0,r,i=``,a=``;for(;n<e.length;n++)r=e[n],i+=r.open,a+=r.close,~t.indexOf(r.close)&&(t=t.replace(r.rgx,r.close+r.open));return i+t+a}function Cc(e,t){let n={has:e,keys:t};return n.reset=Q.reset.bind(n),n.bold=Q.bold.bind(n),n.dim=Q.dim.bind(n),n.italic=Q.italic.bind(n),n.underline=Q.underline.bind(n),n.inverse=Q.inverse.bind(n),n.hidden=Q.hidden.bind(n),n.strikethrough=Q.strikethrough.bind(n),n.black=Q.black.bind(n),n.red=Q.red.bind(n),n.green=Q.green.bind(n),n.yellow=Q.yellow.bind(n),n.blue=Q.blue.bind(n),n.magenta=Q.magenta.bind(n),n.cyan=Q.cyan.bind(n),n.white=Q.white.bind(n),n.gray=Q.gray.bind(n),n.grey=Q.grey.bind(n),n.bgBlack=Q.bgBlack.bind(n),n.bgRed=Q.bgRed.bind(n),n.bgGreen=Q.bgGreen.bind(n),n.bgYellow=Q.bgYellow.bind(n),n.bgBlue=Q.bgBlue.bind(n),n.bgMagenta=Q.bgMagenta.bind(n),n.bgCyan=Q.bgCyan.bind(n),n.bgWhite=Q.bgWhite.bind(n),n}function $(e,t){let n={open:`\x1b[${e}m`,close:`\x1b[${t}m`,rgx:RegExp(`\\x1b\\[${t}m`,`g`)};return function(t){return this!==void 0&&this.has!==void 0?(~this.has.indexOf(e)||(this.has.push(e),this.keys.push(n)),t===void 0?this:Q.enabled?Sc(this.keys,t+``):t+``):t===void 0?Cc([e],[n]):Q.enabled?Sc([n],t+``):t+``}}async function wc(e,t,n={},r=n.cwd??p.default.cwd()){if(t.includes(`-g`))return await e(await fc(),t);let i=await rc({...n,cwd:r})||await dc(n.programmatic);if(!(i===`prompt`&&(i=(await Os({name:`agent`,type:`select`,message:`Choose the agent`,choices:Be.filter(e=>!e.includes(`@`)).map(e=>({title:e,value:e}))})).agent,!i)))return await e(i,t,{programmatic:n.programmatic,hasLock:!!i,cwd:r})}var Tc=e.a(t.u()),Ec=t.l(),Dc=()=>(0,Ec.dedent)(Tc.default`
${t.a} {bold No package.json found}
Chromatic only works from inside a JavaScript project.
We expected to find a package.json somewhere up the directory tree.
Are you sure you're running from your project directory?
`);Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return hc}}),Object.defineProperty(exports,`c`,{enumerable:!0,get:function(){return Ee}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return mc}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return wc}}),Object.defineProperty(exports,`o`,{enumerable:!0,get:function(){return Pe}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return gc}}),Object.defineProperty(exports,`s`,{enumerable:!0,get:function(){return De}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return Dc}});
//# sourceMappingURL=noPackageJson-XI_fi2hi.cjs.map
//# debugId=f2fbe96c-a1e9-5bfe-8f00-a7b6fe03a174