et e=this.commands;if(typeof this.index!="undefined"&&this.index>=0&&this.index<e.length&&(e=[e[this.index]]),e.length===0)this.context.stdout.write(this.cli.usage());else if(e.length===1)this.context.stdout.write(this.cli.usage(this.contexts[e[0]].commandClass,{detailed:!0}));else if(e.length>1){this.context.stdout.write(`Multiple commands match your selection:
`),this.context.stdout.write(`
`);let r=0;for(let i of this.commands)this.context.stdout.write(this.cli.usage(this.contexts[i].commandClass,{prefix:`${r++}. `.padStart(5)}));this.context.stdout.write(`
`),this.context.stdout.write(`Run again with -h=<index> to see the longer details of any of those commands.
`)}}};var UU=Symbol("clipanion/errorCommand");function TCe(){return process.env.FORCE_COLOR==="0"?1:process.env.FORCE_COLOR==="1"||typeof process.stdout!="undefined"&&process.stdout.isTTY?8:1}var ys=class{constructor({binaryLabel:e,binaryName:r="...",binaryVersion:i,enableCapture:n=!1,enableColors:s}={}){this.registrations=new Map,this.builder=new dp({binaryName:r}),this.binaryLabel=e,this.binaryName=r,this.binaryVersion=i,this.enableCapture=n,this.enableColors=s}static from(e,r={}){let i=new ys(r);for(let n of e)i.register(n);return i}register(e){var r;let i=new Map,n=new e;for(let l in n){let c=n[l];typeof c=="object"&&c!==null&&c[Re.isOption]&&i.set(l,c)}let s=this.builder.command(),o=s.cliIndex,a=(r=e.paths)!==null&&r!==void 0?r:n.paths;if(typeof a!="undefined")for(let l of a)s.addPath(l);this.registrations.set(e,{specs:i,builder:s,index:o});for(let[l,{definition:c}]of i.entries())c(s,l);s.setContext({commandClass:e})}process(e){let{contexts:r,process:i}=this.builder.compile(),n=i(e);switch(n.selectedIndex){case og:return Cp.from(n,r);default:{let{commandClass:s}=r[n.selectedIndex],o=this.registrations.get(s);if(typeof o=="undefined")throw new Error("Assertion failed: Expected the command class to have been registered.");let a=new s;a.path=n.path;try{for(let[l,{transformer:c}]of o.specs.entries())a[l]=c(o.builder,l,n);return a}catch(l){throw l[UU]=a,l}}break}}async run(e,r){var i;let n,s=N(N({},ys.defaultContext),r),o=(i=this.enableColors)!==null&&i!==void 0?i:s.colorDepth>1;if(!Array.isArray(e))n=e;else try{n=this.process(e)}catch(c){return s.stdout.write(this.error(c,{colored:o})),1}if(n.help)return s.stdout.write(this.usage(n,{colored:o,detailed:!0})),0;n.context=s,n.cli={binaryLabel:this.binaryLabel,binaryName:this.binaryName,binaryVersion:this.binaryVersion,enableCapture:this.enableCapture,enableColors:this.enableColors,definitions:()=>this.definitions(),error:(c,u)=>this.error(c,u),format:c=>this.format(c),process:c=>this.process(c),run:(c,u)=>this.run(c,N(N({},s),u)),usage:(c,u)=>this.usage(c,u)};let a=this.enableCapture?OCe(s):HU,l;try{l=await a(()=>n.validateAndExecute().catch(c=>n.catch(c).then(()=>0)))}catch(c){return s.stdout.write(this.error(c,{colored:o,command:n})),1}return l}async runExit(e,r){process.exitCode=await this.run(e,r)}suggest(e,r){let{suggest:i}=this.builder.compile();return i(e,r)}definitions({colored:e=!1}={}){let r=[];for(let[i,{index:n}]of this.registrations){if(typeof i.usage=="undefined")continue;let{usage:s}=this.getUsageByIndex(n,{detailed:!1}),{usage:o,options:a}=this.getUsageByIndex(n,{detailed:!0,inlineOptions:!1}),l=typeof i.usage.category!="undefined"?Ui(i.usage.category,{format:this.format(e),paragraphs:!1}):void 0,c=typeof i.usage.description!="undefined"?Ui(i.usage.description,{format:this.format(e),paragraphs:!1}):void 0,u=typeof i.usage.details!="undefined"?Ui(i.usage.details,{format:this.format(e),paragraphs:!0}):void 0,g=typeof i.usage.examples!="undefined"?i.usage.examples.map(([f,h])=>[Ui(f,{format:this.format(e),paragraphs:!1}),h.replace(/\$0/g,this.binaryName)]):void 0;r.push({path:s,usage:o,category:l,description:c,details:u,examples:g,options:a})}return r}usage(e=null,{colored:r,detailed:i=!1,prefix:n="$ "}={}){var s;if(e===null){for(let l of this.registrations.keys()){let c=l.paths,u=typeof l.usage!="undefined";if(!c||c.length===0||c.length===1&&c[0].length===0||((s=c==null?void 0:c.some(h=>h.length===0))!==null&&s!==void 0?s:!1))if(e){e=null;break}else e=l;else if(u){e=null;continue}}e&&(i=!0)}let o=e!==null&&e instanceof Re?e.constructor:e,a="";if(o)if(i){let{description:l="",details:c="",examples:u=[]}=o.usage||{};l!==""&&(a+=Ui(l,{format:this.format(r),paragraphs:!1}).replace(/^./,h=>h.toUpperCase()),a+=`
`),(c!==""||u.length>0)&&(a+=`${this.format(r).header("Usage")}
`,a+=`
`);let{usage:g,options:f}=this.getUsageByRegistration(o,{inlineOptions:!1});if(a+=`${this.format(r).bold(n)}${g}
`,f.length>0){a+=`
`,a+=`${hv.header("Options")}
`;let h=f.reduce((p,m)=>Math.max(p,m.definition.length),0);a+=`
`;for(let{definition:p,description:m}of f)a+=`  ${this.format(r).bold(p.padEnd(h))}    ${Ui(m,{format:this.format(r),paragraphs:!1})}`}if(c!==""&&(a+=`
`,a+=`${this.format(r).header("Details")}
`,a+=`
`,a+=Ui(c,{format:this.format(r),paragraphs:!0})),u.length>0){a+=`
`,a+=`${this.format(r).header("Examples")}
`;for(let[h,p]of u)a+=`
`,a+=Ui(h,{format:this.format(r),paragraphs:!1}),a+=`${p.replace(/^/m,`  ${this.format(r).bold(n)}`).replace(/\$0/g,this.binaryName)}
`}}else{let{usage:l}=this.getUsageByRegistration(o);a+=`${this.format(r).bold(n)}${l}
`}else{let l=new Map;for(let[f,{index:h}]of this.registrations.entries()){if(typeof f.usage=="undefined")continue;let p=typeof f.usage.category!="undefined"?Ui(f.usage.category,{format:this.format(r),paragraphs:!1}):null,m=l.get(p);typeof m=="undefined"&&l.set(p,m=[]);let{usage:y}=this.getUsageByIndex(h);m.push({commandClass:f,usage:y})}let c=Array.from(l.keys()).sort((f,h)=>f===null?-1:h===null?1:f.localeCompare(h,"en",{usage:"sort",caseFirst:"upper"})),u=typeof this.binaryLabel!="undefined",g=typeof this.binaryVersion!="undefined";u||g?(u&&g?a+=`${this.format(r).header(`${this.binaryLabel} - ${this.binaryVersion}`)}

`:u?a+=`${this.format(r).header(`${this.binaryLabel}`)}
`:a+=`${this.format(r).header(`${this.binaryVersion}`)}
`,a+=`  ${this.format(r).bold(n)}${this.binaryName} <command>
`):a+=`${this.format(r).bold(n)}${this.binaryName} <command>
`;for(let f of c){let h=l.get(f).slice().sort((m,y)=>m.usage.localeCompare(y.usage,"en",{usage:"sort",caseFirst:"upper"})),p=f!==null?f.trim():"General commands";a+=`
`,a+=`${this.format(r).header(`${p}`)}
`;for(let{commandClass:m,usage:y}of h){let b=m.usage.description||"undocumented";a+=`
`,a+=`  ${this.format(r).bold(y)}
`,a+=`    ${Ui(b,{format:this.format(r),paragraphs:!1})}`}}a+=`
`,a+=Ui("You can also print more details about any of these commands by calling them with the `-h,--help` flag right after the command name.",{format:this.format(r),paragraphs:!0})}return a}error(e,r){var i,{colored:n,command:s=(i=e[UU])!==null&&i!==void 0?i:null}=r===void 0?{}:r;e instanceof Error||(e=new Error(`Execution failed with a non-error rejection (rejected value: ${JSON.stringify(e)})`));let o="",a=e.name.replace(/([a-z])([A-Z])/g,"$1 $2");a==="Error"&&(a="Internal Error"),o+=`${this.format(n).error(a)}: ${e.message}
`;let l=e.clipanion;return typeof l!="undefined"?l.type==="usage"&&(o+=`
`,o+=this.usage(s)):e.stack&&(o+=`${e.stack.replace(/^.*\n/,"")}
`),o}format(e){var r;return((r=e!=null?e:this.enableColors)!==null&&r!==void 0?r:ys.defaultContext.colorDepth>1)?hv:FU}getUsageByRegistration(e,r){let i=this.registrations.get(e);if(typeof i=="undefined")throw new Error("Assertion failed: Unregistered command");return this.getUsageByIndex(i.index,r)}getUsageByIndex(e,r){return this.builder.getBuilderByIndex(e).usage(r)}};ys.defaultContext={stdin:process.stdin,stdout:process.stdout,stderr:process.stderr,colorDepth:"getColorDepth"in Cv.default.WriteStream.prototype?Cv.default.WriteStream.prototype.getColorDepth():TCe()};var GU;function OCe(t){let e=GU;if(typeof e=="undefined"){if(t.stdout===process.stdout&&t.stderr===process.stderr)return HU;let{AsyncLocalStorage:r}=require("async_hooks");e=GU=new r;let i=process.stdout._write;process.stdout._write=function(s,o,a){let l=e.getStore();return typeof l=="undefined"?i.call(this,s,o,a):l.stdout.write(s,o,a)};let n=process.stderr._write;process.stderr._write=function(s,o,a){let l=e.getStore();return typeof l=="undefined"?n.call(this,s,o,a):l.stderr.write(s,o,a)}}return r=>e.run(t,r)}function HU(t){return t()}var mv={};ft(mv,{DefinitionsCommand:()=>yI,HelpCommand:()=>wI,VersionCommand:()=>BI});var yI=class extends Re{async execute(){this.context.stdout.write(`${JSON.stringify(this.cli.definitions(),null,2)}
`)}};yI.paths=[["--clipanion=definitions"]];var wI=class extends Re{async execute(){this.context.stdout.write(this.cli.usage())}};wI.paths=[["-h"],["--help"]];var BI=class extends Re{async execute(){var e;this.context.stdout.write(`${(e=this.cli.binaryVersion)!==null&&e!==void 0?e:"<unknown>"}
`)}};BI.paths=[["-v"],["--version"]];var W={};ft(W,{Array:()=>jU,Boolean:()=>YU,Counter:()=>qU,Proxy:()=>JU,Rest:()=>WU,String:()=>zU,applyValidator:()=>gp,cleanValidationError:()=>CI,formatError:()=>up,isOptionSymbol:()=>cp,makeCommandOption:()=>rn,rerouteArguments:()=>No});function jU(t,e,r){let[i,n]=No(e,r!=null?r:{}),{arity:s=1}=n,o=t.split(","),a=new Set(o);return rn({definition(l){l.addOption({names:o,arity:s,hidden:n==null?void 0:n.hidden,description:n==null?void 0:n.description,required:n.required})},transformer(l,c,u){let g=typeof i!="undefined"?[...i]:void 0;for(let{name:f,value:h}of u.options)!a.has(f)||(g=g!=null?g:[],g.push(h));return g}})}function YU(t,e,r){let[i,n]=No(e,r!=null?r:{}),s=t.split(","),o=new Set(s);return rn({definition(a){a.addOption({names:s,allowBinding:!1,arity:0,hidden:n.hidden,description:n.description,required:n.required})},transformer(a,l,c){let u=i;for(let{name:g,value:f}of c.options)!o.has(g)||(u=f);return u}})}function qU(t,e,r){let[i,n]=No(e,r!=null?r:{}),s=t.split(","),o=new Set(s);return rn({definition(a){a.addOption({names:s,allowBinding:!1,arity:0,hidden:n.hidden,description:n.description,required:n.required})},transformer(a,l,c){let u=i;for(let{name:g,value:f}of c.options)!o.has(g)||(u!=null||(u=0),f?u+=1:u=0);return u}})}function JU(t={}){return rn({definition(e,r){var i;e.addProxy({name:(i=t.name)!==null&&i!==void 0?i:r,required:t.required})},transformer(e,r,i){return i.positionals.map(({value:n})=>n)}})}function WU(t={}){return rn({definition(e,r){var i;e.addRest({name:(i=t.name)!==null&&i!==void 0?i:r,required:t.required})},transformer(e,r,i){let n=o=>{let a=i.positionals[o];return a.extra===Xn||a.extra===!1&&o<e.arity.leading.length},s=0;for(;s<i.positionals.length&&n(s);)s+=1;return i.positionals.splice(0,s).map(({value:o})=>o)}})}function MCe(t,e,r){let[i,n]=No(e,r!=null?r:{}),{arity:s=1}=n,o=t.split(","),a=new Set(o);return rn({definition(l){l.addOption({names:o,arity:n.tolerateBoolean?0:s,hidden:n.hidden,description:n.description,required:n.required})},transformer(l,c,u){let g,f=i;for(let{name:h,value:p}of u.options)!a.has(h)||(g=h,f=p);return typeof f=="string"?gp(g!=null?g:c,f,n.validator):f}})}function KCe(t={}){let{required:e=!0}=t;return rn({definition(r,i){var n;r.addPositional({name:(n=t.name)!==null&&n!==void 0?n:i,required:t.required})},transformer(r,i,n){var s;for(let o=0;o<n.positionals.length;++o){if(n.positionals[o].extra===Xn||e&&n.positionals[o].extra===!0||!e&&n.positionals[o].extra===!1)continue;let[a]=n.positionals.splice(o,1);return gp((s=t.name)!==null&&s!==void 0?s:i,a.value,t.validator)}}})}function zU(t,...e){return typeof t=="string"?MCe(t,...e):KCe(t)}var n4=ge(lg()),Bx=ge(require("stream"));var $;(function(ae){ae[ae.UNNAMED=0]="UNNAMED",ae[ae.EXCEPTION=1]="EXCEPTION",ae[ae.MISSING_PEER_DEPENDENCY=2]="MISSING_PEER_DEPENDENCY",ae[ae.CYCLIC_DEPENDENCIES=3]="CYCLIC_DEPENDENCIES",ae[ae.DISABLED_BUILD_SCRIPTS=4]="DISABLED_BUILD_SCRIPTS",ae[ae.BUILD_DISABLED=5]="BUILD_DISABLED",ae[ae.SOFT_LINK_BUILD=6]="SOFT_LINK_BUILD",ae[ae.MUST_BUILD=7]="MUST_BUILD",ae[ae.MUST_REBUILD=8]="MUST_REBUILD",ae[ae.BUILD_FAILED=9]="BUILD_FAILED",ae[ae.RESOLVER_NOT_FOUND=10]="RESOLVER_NOT_FOUND",ae[ae.FETCHER_NOT_FOUND=11]="FETCHER_NOT_FOUND",ae[ae.LINKER_NOT_FOUND=12]="LINKER_NOT_FOUND",ae[ae.FETCH_NOT_CACHED=13]="FETCH_NOT_CACHED",ae[ae.YARN_IMPORT_FAILED=14]="YARN_IMPORT_FAILED",ae[ae.REMOTE_INVALID=15]="REMOTE_INVALID",ae[ae.REMOTE_NOT_FOUND=16]="REMOTE_NOT_FOUND",ae[ae.RESOLUTION_PACK=17]="RESOLUTION_PACK",ae[ae.CACHE_CHECKSUM_MISMATCH=18]="CACHE_CHECKSUM_MISMATCH",ae[ae.UNUSED_CACHE_ENTRY=19]="UNUSED_CACHE_ENTRY",ae[ae.MISSING_LOCKFILE_ENTRY=20]="MISSING_LOCKFILE_ENTRY",ae[ae.WORKSPACE_NOT_FOUND=21]="WORKSPACE_NOT_FOUND",ae[ae.TOO_MANY_MATCHING_WORKSPACES=22]="TOO_MANY_MATCHING_WORKSPACES",ae[ae.CONSTRAINTS_MISSING_DEPENDENCY=23]="CONSTRAINTS_MISSING_DEPENDENCY",ae[ae.CONSTRAINTS_INCOMPATIBLE_DEPENDENCY=24]="CONSTRAINTS_INCOMPATIBLE_DEPENDENCY",ae[ae.CONSTRAINTS_EXTRANEOUS_DEPENDENCY=25]="CONSTRAINTS_EXTRANEOUS_DEPENDENCY",ae[ae.CONSTRAINTS_INVALID_DEPENDENCY=26]="CONSTRAINTS_INVALID_DEPENDENCY",ae[ae.CANT_SUGGEST_RESOLUTIONS=27]="CANT_SUGGEST_RESOLUTIONS",ae[ae.FROZEN_LOCKFILE_EXCEPTION=28]="FROZEN_LOCKFILE_EXCEPTION",ae[ae.CROSS_DRIVE_VIRTUAL_LOCAL=29]="CROSS_DRIVE_VIRTUAL_LOCAL",ae[ae.FETCH_FAILED=30]="FETCH_FAILED",ae[ae.DANGEROUS_NODE_MODULES=31]="DANGEROUS_NODE_MODULES",ae[ae.NODE_GYP_INJECTED=32]="NODE_GYP_INJECTED",ae[ae.AUTHENTICATION_NOT_FOUND=33]="AUTHENTICATION_NOT_FOUND",ae[ae.INVALID_CONFIGURATION_KEY=34]="INVALID_CONFIGURATION_KEY",ae[ae.NETWORK_ERROR=35]="NETWORK_ERROR",ae[ae.LIFECYCLE_SCRIPT=36]="LIFECYCLE_SCRIPT",ae[ae.CONSTRAINTS_MISSING_FIELD=37]="CONSTRAINTS_MISSING_FIELD",ae[ae.CONSTRAINTS_INCOMPATIBLE_FIELD=38]="CONSTRAINTS_INCOMPATIBLE_FIELD",ae[ae.CONSTRAINTS_EXTRANEOUS_FIELD=39]="CONSTRAINTS_EXTRANEOUS_FIELD",ae[ae.CONSTRAINTS_INVALID_FIELD=40]="CONSTRAINTS_INVALID_FIELD",ae[ae.AUTHENTICATION_INVALID=41]="AUTHENTICATION_INVALID",ae[ae.PROLOG_UNKNOWN_ERROR=42]="PROLOG_UNKNOWN_ERROR",ae[ae.PROLOG_SYNTAX_ERROR=43]="PROLOG_SYNTAX_ERROR",ae[ae.PROLOG_EXISTENCE_ERROR=44]="PROLOG_EXISTENCE_ERROR",ae[ae.STACK_OVERFLOW_RESOLUTION=45]="STACK_OVERFLOW_RESOLUTION",ae[ae.AUTOMERGE_FAILED_TO_PARSE=46]="AUTOMERGE_FAILED_TO_PARSE",ae[ae.AUTOMERGE_IMMUTABLE=47]="AUTOMERGE_IMMUTABLE",ae[ae.AUTOMERGE_SUCCESS=48]="AUTOMERGE_SUCCESS",ae[ae.AUTOMERGE_REQUIRED=49]="AUTOMERGE_REQUIRED",ae[ae.DEPRECATED_CLI_SETTINGS=50]="DEPRECATED_CLI_SETTINGS",ae[ae.PLUGIN_NAME_NOT_FOUND=51]="PLUGIN_NAME_NOT_FOUND",ae[ae.INVALID_PLUGIN_REFERENCE=52]="INVALID_PLUGIN_REFERENCE",ae[ae.CONSTRAINTS_AMBIGUITY=53]="CONSTRAINTS_AMBIGUITY",ae[ae.CACHE_OUTSIDE_PROJECT=54]="CACHE_OUTSIDE_PROJECT",ae[ae.IMMUTABLE_INSTALL=55]="IMMUTABLE_INSTALL",ae[ae.IMMUTABLE_CACHE=56]="IMMUTABLE_CACHE",ae[ae.INVALID_MANIFEST=57]="INVALID_MANIFEST",ae[ae.PACKAGE_PREPARATION_FAILED=58]="PACKAGE_PREPARATION_FAILED",ae[ae.INVALID_RANGE_PEER_DEPENDENCY=59]="INVALID_RANGE_PEER_DEPENDENCY",ae[ae.INCOMPATIBLE_PEER_DEPENDENCY=60]="INCOMPATIBLE_PEER_DEPENDENCY",ae[ae.DEPRECATED_PACKAGE=61]="DEPRECATED_PACKAGE",ae[ae.INCOMPATIBLE_OS=62]="INCOMPATIBLE_OS",ae[ae.INCOMPATIBLE_CPU=63]="INCOMPATIBLE_CPU",ae[ae.FROZEN_ARTIFACT_EXCEPTION=64]="FROZEN_ARTIFACT_EXCEPTION",ae[ae.TELEMETRY_NOTICE=65]="TELEMETRY_NOTICE",ae[ae.PATCH_HUNK_FAILED=66]="PATCH_HUNK_FAILED",ae[ae.INVALID_CONFIGURATION_VALUE=67]="INVALID_CONFIGURATION_VALUE",ae[ae.UNUSED_PACKAGE_EXTENSION=68]="UNUSED_PACKAGE_EXTENSION",ae[ae.REDUNDANT_PACKAGE_EXTENSION=69]="REDUNDANT_PACKAGE_EXTENSION",ae[ae.AUTO_NM_SUCCESS=70]="AUTO_NM_SUCCESS",ae[ae.NM_CANT_INSTALL_EXTERNAL_SOFT_LINK=71]="NM_CANT_INSTALL_EXTERNAL_SOFT_LINK",ae[ae.NM_PRESERVE_SYMLINKS_REQUIRED=72]="NM_PRESERVE_SYMLINKS_REQUIRED",ae[ae.UPDATE_LOCKFILE_ONLY_SKIP_LINK=73]="UPDATE_LOCKFILE_ONLY_SKIP_LINK",ae[ae.NM_HARDLINKS_MODE_DOWNGRADED=74]="NM_HARDLINKS_MODE_DOWNGRADED",ae[ae.PROLOG_INSTANTIATION_ERROR=75]="PROLOG_INSTANTIATION_ERROR",ae[ae.INCOMPATIBLE_ARCHITECTURE=76]="INCOMPATIBLE_ARCHITECTURE",ae[ae.GHOST_ARCHITECTURE=77]="GHOST_ARCHITECTURE"})($||($={}));function qA(t){return`YN${t.toString(10).padStart(4,"0")}`}function bI(t){let e=Number(t.slice(2));if(typeof $[e]=="undefined")throw new Error(`Unknown message name: "${t}"`);return e}var P={};ft(P,{areDescriptorsEqual:()=>u8,areIdentsEqual:()=>hd,areLocatorsEqual:()=>pd,areVirtualPackagesEquivalent:()=>cSe,bindDescriptor:()=>ASe,bindLocator:()=>lSe,convertDescriptorToLocator:()=>gw,convertLocatorToDescriptor:()=>ax,convertPackageToLocator:()=>aSe,convertToIdent:()=>oSe,convertToManifestRange:()=>fSe,copyPackage:()=>ud,devirtualizeDescriptor:()=>gd,devirtualizeLocator:()=>fd,getIdentVendorPath:()=>gx,isPackageCompatible:()=>dw,isVirtualDescriptor:()=>nl,isVirtualLocator:()=>Xo,makeDescriptor:()=>rr,makeIdent:()=>Vo,makeLocator:()=>cn,makeRange:()=>hw,parseDescriptor:()=>sl,parseFileStyleRange:()=>uSe,parseIdent:()=>An,parseLocator:()=>Kc,parseRange:()=>Gg,prettyDependent:()=>WS,prettyDescriptor:()=>sr,prettyIdent:()=>gi,prettyLocator:()=>Bt,prettyLocatorNoColors:()=>ux,prettyRange:()=>uw,prettyReference:()=>Cd,prettyResolution:()=>zS,prettyWorkspace:()=>md,renamePackage:()=>cd,slugifyIdent:()=>cx,slugifyLocator:()=>jg,sortDescriptors:()=>Yg,stringifyDescriptor:()=>Pn,stringifyIdent:()=>Ot,stringifyLocator:()=>Ds,tryParseDescriptor:()=>dd,tryParseIdent:()=>g8,tryParseLocator:()=>fw,virtualizeDescriptor:()=>Ax,virtualizePackage:()=>lx});var Hg=ge(require("querystring")),A8=ge(ri()),l8=ge(QY());var Ae={};ft(Ae,{LogLevel:()=>fo,Style:()=>Dc,Type:()=>Ye,addLogFilterSupport:()=>sd,applyColor:()=>is,applyHyperlink:()=>Lg,applyStyle:()=>Ty,json:()=>Rc,jsonOrPretty:()=>G0e,mark:()=>$S,pretty:()=>et,prettyField:()=>Jo,prettyList:()=>ZS,supportsColor:()=>Ny,supportsHyperlinks:()=>VS,tuple:()=>go});var id=ge(BS()),nd=ge(pc());var vJ=ge(rs()),SJ=ge(fJ());var ve={};ft(ve,{AsyncActions:()=>IJ,BufferStream:()=>EJ,CachingStrategy:()=>Pc,DefaultStream:()=>yJ,allSettledSafe:()=>uo,assertNever:()=>GS,bufferStream:()=>Fg,buildIgnorePattern:()=>M0e,convertMapsToIndexableObjects:()=>Fy,dynamicRequire:()=>Ng,escapeRegExp:()=>F0e,getArrayWithDefault:()=>Pg,getFactoryWithDefault:()=>Ja,getMapWithDefault:()=>Dg,getSetWithDefault:()=>xc,isIndexableObject:()=>jS,isPathLike:()=>K0e,isTaggedYarnVersion:()=>R0e,mapAndFilter:()=>qo,mapAndFind:()=>ed,overrideType:()=>HS,parseBoolean:()=>rd,parseOptionalBoolean:()=>QJ,prettifyAsyncErrors:()=>Rg,prettifySyncErrors:()=>YS,releaseAfterUseAsync:()=>L0e,replaceEnvVariables:()=>qS,sortMap:()=>xn,tryParseOptionalBoolean:()=>JS,validateEnum:()=>N0e});var hJ=ge(rs()),pJ=ge(lg()),dJ=ge(ri()),US=ge(require("stream"));function R0e(t){return!!(dJ.default.valid(t)&&t.match(/^[^-]+(-rc\.[0-9]+)?$/))}function F0e(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function HS(t){}function GS(t){throw new Error(`Assertion failed: Unexpected object '${t}'`)}function N0e(t,e){let r=Object.values(t);if(!r.includes(e))throw new Pe(`Invalid value for enumeration: ${JSON.stringify(e)} (expected one of ${r.map(i=>JSON.stringify(i)).join(", ")})`);return e}function qo(t,e){let r=[];for(let i of t){let n=e(i);n!==CJ&&r.push(n)}return r}var CJ=Symbol();qo.skip=CJ;function ed(t,e){for(let r of t){let i=e(r);if(i!==mJ)return i}}var mJ=Symbol();ed.skip=mJ;function jS(t){return typeof t=="object"&&t!==null}async function uo(t){let e=await Promise.allSettled(t),r=[];for(let i of e){if(i.status==="rejected")throw i.reason;r.push(i.value)}return r}function Fy(t){if(t instanceof Map&&(t=Object.fromEntries(t)),jS(t))for(let e of Object.keys(t)){let r=t[e];jS(r)&&(t[e]=Fy(r))}return t}function Ja(t,e,r){let i=t.get(e);return typeof i=="undefined"&&t.set(e,i=r()),i}function Pg(t,e){let r=t.get(e);return typeof r=="undefined"&&t.set(e,r=[]),r}function xc(t,e){let r=t.get(e);return typeof r=="undefined"&&t.set(e,r=new Set),r}function Dg(t,e){let r=t.get(e);return typeof r=="undefined"&&t.set(e,r=new Map),r}async function L0e(t,e){if(e==null)return await t();try{return await t()}finally{await e()}}async function Rg(t,e){try{return await t()}catch(r){throw r.message=e(r.message),r}}function YS(t,e){try{return t()}catch(r){throw r.message=e(r.message),r}}async function Fg(t){return await new Promise((e,r)=>{let i=[];t.on("error",n=>{r(n)}),t.on("data",n=>{i.push(n)}),t.on("end",()=>{e(Buffer.concat(i))})})}var EJ=class extends US.Transform{constructor(){super(...arguments);this.chunks=[]}_transform(e,r,i){if(r!=="buffer"||!Buffer.isBuffer(e))throw new Error("Assertion failed: BufferStream only accept buffers");this.chunks.push(e),i(null,null)}_flush(e){e(null,Buffer.concat(this.chunks))}};function T0e(){let t,e;return{promise:new Promise((i,n)=>{t=i,e=n}),resolve:t,reject:e}}var IJ=class{constructor(e){this.deferred=new Map;this.promises=new Map;this.limit=(0,pJ.default)(e)}set(e,r){let i=this.deferred.get(e);typeof i=="undefined"&&this.deferred.set(e,i=T0e());let n=this.limit(()=>r());return this.promises.set(e,n),n.then(()=>{this.promises.get(e)===n&&i.resolve()},s=>{this.promises.get(e)===n&&i.reject(s)}),i.promise}reduce(e,r){var n;let i=(n=this.promises.get(e))!=null?n:Promise.resolve();this.set(e,()=>r(i))}async wait(){await Promise.all(this.promises.values())}},yJ=class extends US.Transform{constructor(e=Buffer.alloc(0)){super();this.active=!0;this.ifEmpty=e}_transform(e,r,i){if(r!=="buffer"||!Buffer.isBuffer(e))throw new Error("Assertion failed: DefaultStream only accept buffers");this.active=!1,i(null,e)}_flush(e){this.active&&this.ifEmpty.length>0?e(null,this.ifEmpty):e(null)}},td=eval("require");function wJ(t){return td(H.fromPortablePath(t))}function BJ(path){let physicalPath=H.fromPortablePath(path),currentCacheEntry=td.cache[physicalPath];delete td.cache[physicalPath];let result;try{result=wJ(physicalPath);let freshCacheEntry=td.cache[physicalPath],dynamicModule=eval("module"),freshCacheIndex=dynamicModule.children.indexOf(freshCacheEntry);freshCacheIndex!==-1&&dynamicModule.children.splice(freshCacheIndex,1)}finally{td.cache[physicalPath]=currentCacheEntry}return result}var bJ=new Map;function O0e(t){let e=bJ.get(t),r=K.statSync(t);if((e==null?void 0:e.mtime)===r.mtimeMs)return e.instance;let i=BJ(t);return bJ.set(t,{mtime:r.mtimeMs,instance:i}),i}var Pc;(function(i){i[i.NoCache=0]="NoCache",i[i.FsTime=1]="FsTime",i[i.Node=2]="Node"})(Pc||(Pc={}));function Ng(t,{cachingStrategy:e=2}={}){switch(e){case 0:return BJ(t);case 1:return O0e(t);case 2:return wJ(t);default:throw new Error("Unsupported caching strategy")}}function xn(t,e){let r=Array.from(t);Array.isArray(e)||(e=[e]);let i=[];for(let s of e)i.push(r.map(o=>s(o)));let n=r.map((s,o)=>o);return n.sort((s,o)=>{for(let a of i){let l=a[s]<a[o]?-1:a[s]>a[o]?1:0;if(l!==0)return l}return 0}),n.map(s=>r[s])}function M0e(t){return t.length===0?null:t.map(e=>`(${hJ.default.makeRe(e,{windows:!1,dot:!0}).source})`).join("|")}function qS(t,{env:e}){let r=/\${(?<variableName>[\d\w_]+)(?<colon>:)?(?:-(?<fallback>[^}]*))?}/g;return t.replace(r,(...i)=>{let{variableName:n,colon:s,fallback:o}=i[i.length-1],a=Object.prototype.hasOwnProperty.call(e,n),l=e[n];if(l||a&&!s)return l;if(o!=null)return o;throw new Pe(`Environment variable not found (${n})`)})}function rd(t){switch(t){case"true":case"1":case 1:case!0:return!0;case"false":case"0":case 0:case!1:return!1;default:throw new Error(`Couldn't parse "${t}" as a boolean`)}}function QJ(t){return typeof t=="undefined"?t:rd(t)}function JS(t){try{return QJ(t)}catch{return null}}function K0e(t){return!!(H.isAbsolute(t)||t.match(/^(\.{1,2}|~)\//))}var Qt;(function(r){r.HARD="HARD",r.SOFT="SOFT"})(Qt||(Qt={}));var yi;(function(i){i.Dependency="Dependency",i.PeerDependency="PeerDependency",i.PeerDependencyMeta="PeerDependencyMeta"})(yi||(yi={}));var qi;(function(i){i.Inactive="inactive",i.Redundant="redundant",i.Active="active"})(qi||(qi={}));var Ye={NO_HINT:"NO_HINT",NULL:"NULL",SCOPE:"SCOPE",NAME:"NAME",RANGE:"RANGE",REFERENCE:"REFERENCE",NUMBER:"NUMBER",PATH:"PATH",URL:"URL",ADDED:"ADDED",REMOVED:"REMOVED",CODE:"CODE",DURATION:"DURATION",SIZE:"SIZE",IDENT:"IDENT",DESCRIPTOR:"DESCRIPTOR",LOCATOR:"LOCATOR",RESOLUTION:"RESOLUTION",DEPENDENT:"DEPENDENT",PACKAGE_EXTENSION:"PACKAGE_EXTENSION",SETTING:"SETTING",MARKDOWN:"MARKDOWN"},Dc;(function(e){e[e.BOLD=2]="BOLD"})(Dc||(Dc={}));var _S=nd.default.GITHUB_ACTIONS?{level:2}:id.default.supportsColor?{level:id.default.supportsColor.level}:{level:0},Ny=_S.level!==0,VS=Ny&&!nd.default.GITHUB_ACTIONS&&!nd.default.CIRCLE&&!nd.default.GITLAB,XS=new id.default.Instance(_S),U0e=new Map([[Ye.NO_HINT,null],[Ye.NULL,["#a853b5",129]],[Ye.SCOPE,["#d75f00",166]],[Ye.NAME,["#d7875f",173]],[Ye.RANGE,["#00afaf",37]],[Ye.REFERENCE,["#87afff",111]],[Ye.NUMBER,["#ffd700",220]],[Ye.PATH,["#d75fd7",170]],[Ye.URL,["#d75fd7",170]],[Ye.ADDED,["#5faf00",70]],[Ye.REMOVED,["#d70000",160]],[Ye.CODE,["#87afff",111]],[Ye.SIZE,["#ffd700",220]]]),Rs=t=>t,Ly={[Ye.NUMBER]:Rs({pretty:(t,e)=>`${e}`,json:t=>t}),[Ye.IDENT]:Rs({pretty:(t,e)=>gi(t,e),json:t=>Ot(t)}),[Ye.LOCATOR]:Rs({pretty:(t,e)=>Bt(t,e),json:t=>Ds(t)}),[Ye.DESCRIPTOR]:Rs({pretty:(t,e)=>sr(t,e),json:t=>Pn(t)}),[Ye.RESOLUTION]:Rs({pretty:(t,{descriptor:e,locator:r})=>zS(t,e,r),json:({descriptor:t,locator:e})=>({descriptor:Pn(t),locator:e!==null?Ds(e):null})}),[Ye.DEPENDENT]:Rs({pretty:(t,{locator:e,descriptor:r})=>WS(t,e,r),json:({locator:t,descriptor:e})=>({locator:Ds(t),descriptor:Pn(e)})}),[Ye.PACKAGE_EXTENSION]:Rs({pretty:(t,e)=>{switch(e.type){case yi.Dependency:return`${gi(t,e.parentDescriptor)} \u27A4 ${is(t,"dependencies",Ye.CODE)} \u27A4 ${gi(t,e.descriptor)}`;case yi.PeerDependency:return`${gi(t,e.parentDescriptor)} \u27A4 ${is(t,"peerDependencies",Ye.CODE)} \u27A4 ${gi(t,e.descriptor)}`;case yi.PeerDependencyMeta:return`${gi(t,e.parentDescriptor)} \u27A4 ${is(t,"peerDependenciesMeta",Ye.CODE)} \u27A4 ${gi(t,An(e.selector))} \u27A4 ${is(t,e.key,Ye.CODE)}`;default:throw new Error(`Assertion failed: Unsupported package extension type: ${e.type}`)}},json:t=>{switch(t.type){case yi.Dependency:return`${Ot(t.parentDescriptor)} > ${Ot(t.descriptor)}`;case yi.PeerDependency:return`${Ot(t.parentDescriptor)} >> ${Ot(t.descriptor)}`;case yi.PeerDependencyMeta:return`${Ot(t.parentDescriptor)} >> ${t.selector} / ${t.key}`;default:throw new Error(`Assertion failed: Unsupported package extension type: ${t.type}`)}}}),[Ye.SETTING]:Rs({pretty:(t,e)=>(t.get(e),Lg(t,is(t,e,Ye.CODE),`https://yarnpkg.com/configuration/yarnrc#${e}`)),json:t=>t}),[Ye.DURATION]:Rs({pretty:(t,e)=>{if(e>1e3*60){let r=Math.floor(e/1e3/60),i=Math.ceil((e-r*60*1e3)/1e3);return i===0?`${r}m`:`${r}m ${i}s`}else{let r=Math.floor(e/1e3),i=e-r*1e3;return i===0?`${r}s`:`${r}s ${i}ms`}},json:t=>t}),[Ye.SIZE]:Rs({pretty:(t,e)=>{let r=["KB","MB","GB","TB"],i=r.length;for(;i>1&&e<1024**i;)i-=1;let n=1024**i,s=Math.floor(e*100/n)/100;return is(t,`${s} ${r[i-1]}`,Ye.NUMBER)},json:t=>t}),[Ye.PATH]:Rs({pretty:(t,e)=>is(t,H.fromPortablePath(e),Ye.PATH),json:t=>H.fromPortablePath(t)}),[Ye.MARKDOWN]:Rs({pretty:(t,{text:e,format:r,paragraphs:i})=>Ui(e,{format:r,paragraphs:i}),json:({text:t})=>t})};function go(t,e){return[e,t]}function Ty(t,e,r){return t.get("enableColors")&&r&2&&(e=id.default.bold(e)),e}function is(t,e,r){if(!t.get("enableColors"))return e;let i=U0e.get(r);if(i===null)return e;let n=typeof i=="undefined"?r:_S.level>=3?i[0]:i[1],s=typeof n=="number"?XS.ansi256(n):n.startsWith("#")?XS.hex(n):XS[n];if(typeof s!="function")throw new Error(`Invalid format type ${n}`);return s(e)}var H0e=!!process.env.KONSOLE_VERSION;function Lg(t,e,r){return t.get("enableHyperlinks")?H0e?`