@fabriziosalmi/slopless 1.4.2 → 1.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +1 -1
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -456,7 +456,7 @@ Project '${d.projectName}' (${EA[d.projectKind]}) ${o}
456
456
  `,o++};this.projectService.externalProjects.forEach(c),this.projectService.configuredProjects.forEach(c),this.projectService.inferredProjects.forEach(c)}}this.logger.msg(s,"Err")}send(t){if(t.type==="event"&&!this.canUseEvents){this.logger.hasLevel(3)&&this.logger.info(`Session does not support events: ignored event: ${nS(t)}`);return}this.writeMessage(t)}writeMessage(t){let n=O0e(t,this.logger,this.byteLength,this.host.newLine);this.host.write(n)}event(t,n){this.send(F0e(n,t))}doOutput(t,n,i,s,o,c){let d={seq:0,type:"response",command:n,request_seq:i,success:s,performanceData:o&&Pje(o)};if(s){let f;if(Js(t))d.body=t,f=t.metadata,delete t.metadata;else if(typeof t=="object")if(t.metadata){let{metadata:S,...y}=t;d.body=y,f=S}else d.body=t;else d.body=t;f&&(d.metadata=f)}else O.assert(t===void 0);c&&(d.message=c),this.send(d)}semanticCheck(t,n){var i,s;let o=Ho();(i=In)==null||i.push(In.Phase.Session,"semanticCheck",{file:t,configFilePath:n.canonicalConfigFilePath});let c=yje(n,t)?lu:n.getLanguageService().getSemanticDiagnostics(t).filter(d=>!!d.file);this.sendDiagnosticsEvent(t,n,c,"semanticDiag",o),(s=In)==null||s.pop()}syntacticCheck(t,n){var i,s;let o=Ho();(i=In)==null||i.push(In.Phase.Session,"syntacticCheck",{file:t,configFilePath:n.canonicalConfigFilePath}),this.sendDiagnosticsEvent(t,n,n.getLanguageService().getSyntacticDiagnostics(t),"syntaxDiag",o),(s=In)==null||s.pop()}suggestionCheck(t,n){var i,s;let o=Ho();(i=In)==null||i.push(In.Phase.Session,"suggestionCheck",{file:t,configFilePath:n.canonicalConfigFilePath}),this.sendDiagnosticsEvent(t,n,n.getLanguageService().getSuggestionDiagnostics(t),"suggestionDiag",o),(s=In)==null||s.pop()}regionSemanticCheck(t,n,i){var s,o,c;let d=Ho();(s=In)==null||s.push(In.Phase.Session,"regionSemanticCheck",{file:t,configFilePath:n.canonicalConfigFilePath});let f;if(!this.shouldDoRegionCheck(t)||!(f=n.getLanguageService().getRegionSemanticDiagnostics(t,i))){(o=In)==null||o.pop();return}this.sendDiagnosticsEvent(t,n,f.diagnostics,"regionSemanticDiag",d,f.spans),(c=In)==null||c.pop()}shouldDoRegionCheck(t){var n;let i=(n=this.projectService.getScriptInfoForNormalizedPath(t))==null?void 0:n.textStorage.getLineInfo().getLineCount();return!!(i&&i>=this.regionDiagLineCountThreshold)}sendDiagnosticsEvent(t,n,i,s,o,c){try{let d=O.checkDefined(n.getScriptInfo(t)),f=Ho()-o,S={file:t,diagnostics:i.map(y=>vje(t,n,y)),spans:c==null?void 0:c.map(y=>Mg(y,d))};this.event(S,s),this.addDiagnosticsPerformanceData(t,s,f)}catch(d){this.logError(d,s)}}updateErrorCheck(t,n,i,s=!0){if(n.length===0)return;O.assert(!this.suppressDiagnosticEvents);let o=this.changeSeq,c=Math.min(i,200),d=0,f=()=>{if(d++,n.length>d)return t.delay("checkOne",c,y)},S=(T,E)=>{if(this.semanticCheck(T,E),this.changeSeq===o){if(this.getPreferences(T).disableSuggestions)return f();t.immediate("suggestionCheck",()=>{this.suggestionCheck(T,E),f()})}},y=()=>{if(this.changeSeq!==o)return;let T,E=n[d];if(Ys(E)?E=this.toPendingErrorCheck(E):"ranges"in E&&(T=E.ranges,E=this.toPendingErrorCheck(E.file)),!E)return f();let{fileName:D,project:A}=E;if(Gd(A),!!A.containsFile(D,s)&&(this.syntacticCheck(D,A),this.changeSeq===o)){if(A.projectService.serverMode!==0)return f();if(T)return t.immediate("regionSemanticCheck",()=>{let F=this.projectService.getScriptInfoForNormalizedPath(D);F&&this.regionSemanticCheck(D,A,T.map(M=>this.getRange({file:D,...M},F))),this.changeSeq===o&&t.immediate("semanticCheck",()=>S(D,A))});t.immediate("semanticCheck",()=>S(D,A))}};n.length>d&&this.changeSeq===o&&t.delay("checkOne",i,y)}cleanProjects(t,n){if(n){this.logger.info(`cleaning ${t}`);for(let i of n)i.getLanguageService(!1).cleanupSemanticCache(),i.cleanupProgram()}}cleanup(){this.cleanProjects("inferred projects",this.projectService.inferredProjects),this.cleanProjects("configured projects",zs(this.projectService.configuredProjects.values())),this.cleanProjects("external projects",this.projectService.externalProjects),this.host.gc&&(this.logger.info("host.gc()"),this.host.gc())}getEncodedSyntacticClassifications(t){let{file:n,languageService:i}=this.getFileAndLanguageServiceForSyntacticOperation(t);return i.getEncodedSyntacticClassifications(n,t)}getEncodedSemanticClassifications(t){let{file:n,project:i}=this.getFileAndProject(t),s=t.format==="2020"?"2020":"original";return i.getLanguageService().getEncodedSemanticClassifications(n,t,s)}getProject(t){return t===void 0?void 0:this.projectService.findProject(t)}getConfigFileAndProject(t){let n=this.getProject(t.projectFileName),i=Wo(t.file);return{configFile:n&&n.hasConfigFile(i)?i:void 0,project:n}}getConfigFileDiagnostics(t,n,i){let s=n.getAllProjectErrors(),o=n.getLanguageService().getCompilerOptionsDiagnostics(),c=Cn(ds(s,o),d=>!!d.file&&d.file.fileName===t);return i?this.convertToDiagnosticsWithLinePositionFromDiagnosticFile(c):Dr(c,d=>QO(d,!1))}convertToDiagnosticsWithLinePositionFromDiagnosticFile(t){return t.map(n=>({message:Ag(n.messageText,this.host.newLine),start:n.start,length:n.length,category:Zx(n),code:n.code,source:n.source,startLocation:n.file&&ND(Sa(n.file,n.start)),endLocation:n.file&&ND(Sa(n.file,n.start+n.length)),reportsUnnecessary:n.reportsUnnecessary,reportsDeprecated:n.reportsDeprecated,relatedInformation:Dr(n.relatedInformation,wK)}))}getCompilerOptionsDiagnostics(t){let n=this.getProject(t.projectFileName);return this.convertToDiagnosticsWithLinePosition(Cn(n.getLanguageService().getCompilerOptionsDiagnostics(),i=>!i.file),void 0)}convertToDiagnosticsWithLinePosition(t,n){return t.map(i=>({message:Ag(i.messageText,this.host.newLine),start:i.start,length:i.length,category:Zx(i),code:i.code,source:i.source,startLocation:n&&n.positionToLineOffset(i.start),endLocation:n&&n.positionToLineOffset(i.start+i.length),reportsUnnecessary:i.reportsUnnecessary,reportsDeprecated:i.reportsDeprecated,relatedInformation:Dr(i.relatedInformation,wK)}))}getDiagnosticsWorker(t,n,i,s){let{project:o,file:c}=this.getFileAndProject(t);if(n&&yje(o,c))return lu;let d=o.getScriptInfoForNormalizedPath(c),f=i(o,c);return s?this.convertToDiagnosticsWithLinePosition(f,d):f.map(S=>vje(c,o,S))}getDefinition(t,n){let{file:i,project:s}=this.getFileAndProject(t),o=this.getPositionInFile(t,i),c=this.mapDefinitionInfoLocations(s.getLanguageService().getDefinitionAtPosition(i,o)||lu,s);return n?this.mapDefinitionInfo(c,s):c.map(gne.mapToOriginalLocation)}mapDefinitionInfoLocations(t,n){return t.map(i=>{let s=wje(i,n);return s?{...s,containerKind:i.containerKind,containerName:i.containerName,kind:i.kind,name:i.name,failedAliasResolution:i.failedAliasResolution,...i.unverified&&{unverified:i.unverified}}:i})}getDefinitionAndBoundSpan(t,n){let{file:i,project:s}=this.getFileAndProject(t),o=this.getPositionInFile(t,i),c=O.checkDefined(s.getScriptInfo(i)),d=s.getLanguageService().getDefinitionAndBoundSpan(i,o);if(!d||!d.definitions)return{definitions:lu,textSpan:void 0};let f=this.mapDefinitionInfoLocations(d.definitions,s),{textSpan:S}=d;return n?{definitions:this.mapDefinitionInfo(f,s),textSpan:Mg(S,c)}:{definitions:f.map(gne.mapToOriginalLocation),textSpan:S}}findSourceDefinition(t){var n;let{file:i,project:s}=this.getFileAndProject(t),o=this.getPositionInFile(t,i),c=s.getLanguageService().getDefinitionAtPosition(i,o),d=this.mapDefinitionInfoLocations(c||lu,s).slice();if(this.projectService.serverMode===0&&(!Tt(d,D=>Wo(D.fileName)!==i&&!D.isAmbient)||Tt(d,D=>!!D.failedAliasResolution))){let D=DJ(j=>j.textSpan.start,zZ(this.host.useCaseSensitiveFileNames));d==null||d.forEach(j=>D.add(j));let A=s.getNoDtsResolutionProject(i),F=A.getLanguageService(),M=(n=F.getDefinitionAtPosition(i,o,!0,!1))==null?void 0:n.filter(j=>Wo(j.fileName)!==i);if(Tt(M))for(let j of M){if(j.unverified){let U=T(j,s.getLanguageService().getProgram(),F.getProgram());if(Tt(U)){for(let J of U)D.add(J);continue}}D.add(j)}else{let j=d.filter(U=>Wo(U.fileName)!==i&&U.isAmbient);for(let U of Tt(j)?j:y()){let J=S(U.fileName,i,A);if(!J)continue;let q=this.projectService.getOrCreateScriptInfoNotOpenedByClient(J,A.currentDirectory,A.directoryStructureHost,!1);if(!q)continue;A.containsScriptInfo(q)||(A.addRoot(q),A.updateGraph());let H=F.getProgram(),ee=O.checkDefined(H.getSourceFile(J));for(let ie of E(U.name,ee,H))D.add(ie)}}d=zs(D.values())}return d=d.filter(D=>!D.isAmbient&&!D.failedAliasResolution),this.mapDefinitionInfo(d,s);function S(D,A,F){var M,j,U;let J=aM(D);if(J&&D.lastIndexOf(ay)===J.topLevelNodeModulesIndex){let q=D.substring(0,J.packageRootIndex),H=(M=s.getModuleResolutionCache())==null?void 0:M.getPackageJsonInfoCache(),ee=s.getCompilationSettings(),ie=OI(Ns(q,s.getCurrentDirectory()),NI(H,s,ee));if(!ie)return;let Q=cG(ie,{moduleResolution:2},s,s.getModuleResolutionCache()),ke=D.substring(J.topLevelPackageNameIndex+1,J.packageRootIndex),ue=FI(b7(ke)),K=s.toPath(D);if(Q&&Tt(Q,ye=>s.toPath(ye)===K))return(j=F.resolutionCache.resolveSingleModuleNameWithoutWatching(ue,A).resolvedModule)==null?void 0:j.resolvedFileName;{let ye=D.substring(J.packageRootIndex+1),he=`${ue}/${z_(ye)}`;return(U=F.resolutionCache.resolveSingleModuleNameWithoutWatching(he,A).resolvedModule)==null?void 0:U.resolvedFileName}}}function y(){let D=s.getLanguageService(),A=D.getProgram(),F=wf(A.getSourceFile(i),o);return(ko(F)||Qe(F))&&cc(F.parent)&&joe(F,M=>{var j;if(M===F)return;let U=(j=D.getDefinitionAtPosition(i,M.getStart(),!0,!1))==null?void 0:j.filter(J=>Wo(J.fileName)!==i&&J.isAmbient).map(J=>({fileName:J.fileName,name:cd(F)}));if(Tt(U))return U})||lu}function T(D,A,F){var M;let j=F.getSourceFile(D.fileName);if(!j)return;let U=wf(A.getSourceFile(i),o),J=A.getTypeChecker().getSymbolAtLocation(U),q=J&&vc(J,277);if(!q)return;let H=((M=q.propertyName)==null?void 0:M.text)||q.name.text;return E(H,j,F)}function E(D,A,F){let M=uc.Core.getTopMostDeclarationNamesInFile(D,A);return Zi(M,j=>{let U=F.getTypeChecker().getSymbolAtLocation(j),J=I4(j);if(U&&J)return ED.createDefinitionInfo(J,F.getTypeChecker(),U,J,!0)})}}getEmitOutput(t){let{file:n,project:i}=this.getFileAndProject(t);if(!i.shouldEmitFile(i.getScriptInfo(n)))return{emitSkipped:!0,outputFiles:[],diagnostics:[]};let s=i.getLanguageService().getEmitOutput(n);return t.richResponse?{...s,diagnostics:t.includeLinePosition?this.convertToDiagnosticsWithLinePositionFromDiagnosticFile(s.diagnostics):s.diagnostics.map(o=>QO(o,!0))}:s}mapJSDocTagInfo(t,n,i){return t?t.map(s=>{var o;return{...s,text:i?this.mapDisplayParts(s.text,n):(o=s.text)==null?void 0:o.map(c=>c.text).join("")}}):[]}mapDisplayParts(t,n){return t?t.map(i=>i.kind!=="linkName"?i:{...i,target:this.toFileSpan(i.target.fileName,i.target.textSpan,n)}):[]}mapSignatureHelpItems(t,n,i){return t.map(s=>({...s,documentation:this.mapDisplayParts(s.documentation,n),parameters:s.parameters.map(o=>({...o,documentation:this.mapDisplayParts(o.documentation,n)})),tags:this.mapJSDocTagInfo(s.tags,n,i)}))}mapDefinitionInfo(t,n){return t.map(i=>({...this.toFileSpanWithContext(i.fileName,i.textSpan,i.contextSpan,n),...i.unverified&&{unverified:i.unverified}}))}static mapToOriginalLocation(t){return t.originalFileName?(O.assert(t.originalTextSpan!==void 0,"originalTextSpan should be present if originalFileName is"),{...t,fileName:t.originalFileName,textSpan:t.originalTextSpan,targetFileName:t.fileName,targetTextSpan:t.textSpan,contextSpan:t.originalContextSpan,targetContextSpan:t.contextSpan}):t}toFileSpan(t,n,i){let s=i.getLanguageService(),o=s.toLineColumnOffset(t,n.start),c=s.toLineColumnOffset(t,Jc(n));return{file:t,start:{line:o.line+1,offset:o.character+1},end:{line:c.line+1,offset:c.character+1}}}toFileSpanWithContext(t,n,i,s){let o=this.toFileSpan(t,n,s),c=i&&this.toFileSpan(t,i,s);return c?{...o,contextStart:c.start,contextEnd:c.end}:o}getTypeDefinition(t){let{file:n,project:i}=this.getFileAndProject(t),s=this.getPositionInFile(t,n),o=this.mapDefinitionInfoLocations(i.getLanguageService().getTypeDefinitionAtPosition(n,s)||lu,i);return this.mapDefinitionInfo(o,i)}mapImplementationLocations(t,n){return t.map(i=>{let s=wje(i,n);return s?{...s,kind:i.kind,displayParts:i.displayParts}:i})}getImplementation(t,n){let{file:i,project:s}=this.getFileAndProject(t),o=this.getPositionInFile(t,i),c=this.mapImplementationLocations(s.getLanguageService().getImplementationAtPosition(i,o)||lu,s);return n?c.map(({fileName:d,textSpan:f,contextSpan:S})=>this.toFileSpanWithContext(d,f,S,s)):c.map(gne.mapToOriginalLocation)}getSyntacticDiagnosticsSync(t){let{configFile:n}=this.getConfigFileAndProject(t);return n?lu:this.getDiagnosticsWorker(t,!1,(i,s)=>i.getLanguageService().getSyntacticDiagnostics(s),!!t.includeLinePosition)}getSemanticDiagnosticsSync(t){let{configFile:n,project:i}=this.getConfigFileAndProject(t);return n?this.getConfigFileDiagnostics(n,i,!!t.includeLinePosition):this.getDiagnosticsWorker(t,!0,(s,o)=>s.getLanguageService().getSemanticDiagnostics(o).filter(c=>!!c.file),!!t.includeLinePosition)}getSuggestionDiagnosticsSync(t){let{configFile:n}=this.getConfigFileAndProject(t);return n?lu:this.getDiagnosticsWorker(t,!0,(i,s)=>i.getLanguageService().getSuggestionDiagnostics(s),!!t.includeLinePosition)}getJsxClosingTag(t){let{file:n,languageService:i}=this.getFileAndLanguageServiceForSyntacticOperation(t),s=this.getPositionInFile(t,n),o=i.getJsxClosingTagAtPosition(n,s);return o===void 0?void 0:{newText:o.newText,caretOffset:0}}getLinkedEditingRange(t){let{file:n,languageService:i}=this.getFileAndLanguageServiceForSyntacticOperation(t),s=this.getPositionInFile(t,n),o=i.getLinkedEditingRangeAtPosition(n,s),c=this.projectService.getScriptInfoForNormalizedPath(n);if(!(c===void 0||o===void 0))return Uvt(o,c)}getDocumentHighlights(t,n){let{file:i,project:s}=this.getFileAndProject(t),o=this.getPositionInFile(t,i),c=s.getLanguageService().getDocumentHighlights(i,o,t.filesToSearch);return c?n?c.map(({fileName:d,highlightSpans:f})=>{let S=s.getScriptInfo(d);return{file:d,highlightSpans:f.map(({textSpan:y,kind:T,contextSpan:E})=>({...M0e(y,E,S),kind:T}))}}):c:lu}provideInlayHints(t){let{file:n,project:i}=this.getFileAndProject(t),s=this.projectService.getScriptInfoForNormalizedPath(n);return i.getLanguageService().provideInlayHints(n,t,this.getPreferences(n)).map(c=>{let{position:d,displayParts:f}=c;return{...c,position:s.positionToLineOffset(d),displayParts:f==null?void 0:f.map(({text:S,span:y,file:T})=>{if(y){O.assertIsDefined(T,"Target file should be defined together with its span.");let E=this.projectService.getScriptInfo(T);return{text:S,span:{start:E.positionToLineOffset(y.start),end:E.positionToLineOffset(y.start+y.length),file:T}}}else return{text:S}})}})}mapCode(t){var n;let i=this.getHostFormatOptions(),s=this.getHostPreferences(),{file:o,languageService:c}=this.getFileAndLanguageServiceForSyntacticOperation(t),d=this.projectService.getScriptInfoForNormalizedPath(o),f=(n=t.mapping.focusLocations)==null?void 0:n.map(y=>y.map(T=>{let E=d.lineOffsetToPosition(T.start.line,T.start.offset),D=d.lineOffsetToPosition(T.end.line,T.end.offset);return{start:E,length:D-E}})),S=c.mapCode(o,t.mapping.contents,f,i,s);return this.mapTextChangesToCodeEdits(S)}getCopilotRelatedInfo(){return{relatedFiles:[]}}setCompilerOptionsForInferredProjects(t){this.projectService.setCompilerOptionsForInferredProjects(t.options,t.projectRootPath)}getProjectInfo(t){return this.getProjectInfoWorker(t.file,t.projectFileName,t.needFileNameList,t.needDefaultConfiguredProjectInfo,!1)}getProjectInfoWorker(t,n,i,s,o){let{project:c}=this.getFileAndProjectWorker(t,n);return Gd(c),{configFileName:c.getProjectName(),languageServiceDisabled:!c.languageServiceEnabled,fileNames:i?c.getFileNames(!1,o):void 0,configuredProjectInfo:s?this.getDefaultConfiguredProjectInfo(t):void 0}}getDefaultConfiguredProjectInfo(t){var n;let i=this.projectService.getScriptInfo(t);if(!i)return;let s=this.projectService.findDefaultConfiguredProjectWorker(i,3);if(!s)return;let o,c;return s.seenProjects.forEach((d,f)=>{f!==s.defaultProject&&(d!==3?(o??(o=[])).push(Wo(f.getConfigFilePath())):(c??(c=[])).push(Wo(f.getConfigFilePath())))}),(n=s.seenConfigs)==null||n.forEach(d=>(o??(o=[])).push(d)),{notMatchedByConfig:o,notInProject:c,defaultProject:s.defaultProject&&Wo(s.defaultProject.getConfigFilePath())}}getRenameInfo(t){let{file:n,project:i}=this.getFileAndProject(t),s=this.getPositionInFile(t,n),o=this.getPreferences(n);return i.getLanguageService().getRenameInfo(n,s,o)}getProjects(t,n,i){let s,o;if(t.projectFileName){let c=this.getProject(t.projectFileName);c&&(s=[c])}else{let c=n?this.projectService.getScriptInfoEnsuringProjectsUptoDate(t.file):this.projectService.getScriptInfo(t.file);if(c)n||this.projectService.ensureDefaultProjectForFile(c);else return i?lu:(this.projectService.logErrorForScriptInfoNotFound(t.file),t0.ThrowNoProject());s=c.containingProjects,o=this.projectService.getSymlinkedProjects(c)}return s=Cn(s,c=>c.languageServiceEnabled&&!c.isOrphan()),!i&&(!s||!s.length)&&!o?(this.projectService.logErrorForScriptInfoNotFound(t.file??t.projectFileName),t0.ThrowNoProject()):o?{projects:s,symLinkedProjects:o}:s}getDefaultProject(t){if(t.projectFileName){let i=this.getProject(t.projectFileName);if(i)return i;if(!t.file)return t0.ThrowNoProject()}return this.projectService.getScriptInfo(t.file).getDefaultProject()}getRenameLocations(t,n){let i=Wo(t.file),s=this.getPositionInFile(t,i),o=this.getProjects(t),c=this.getDefaultProject(t),d=this.getPreferences(i),f=this.mapRenameInfo(c.getLanguageService().getRenameInfo(i,s,d),O.checkDefined(this.projectService.getScriptInfo(i)));if(!f.canRename)return n?{info:f,locs:[]}:[];let S=Rvt(o,c,{fileName:t.file,pos:s},!!t.findInStrings,!!t.findInComments,d,this.host.useCaseSensitiveFileNames);return n?{info:f,locs:this.toSpanGroups(S)}:S}mapRenameInfo(t,n){if(t.canRename){let{canRename:i,fileToRename:s,displayName:o,fullDisplayName:c,kind:d,kindModifiers:f,triggerSpan:S}=t;return{canRename:i,fileToRename:s,displayName:o,fullDisplayName:c,kind:d,kindModifiers:f,triggerSpan:Mg(S,n)}}else return t}toSpanGroups(t){let n=new Map;for(let{fileName:i,textSpan:s,contextSpan:o,originalContextSpan:c,originalTextSpan:d,originalFileName:f,...S}of t){let y=n.get(i);y||n.set(i,y={file:i,locs:[]});let T=O.checkDefined(this.projectService.getScriptInfo(i));y.locs.push({...M0e(s,o,T),...S})}return zs(n.values())}getReferences(t,n){let i=Wo(t.file),s=this.getProjects(t),o=this.getPositionInFile(t,i),c=jvt(s,this.getDefaultProject(t),{fileName:t.file,pos:o},this.host.useCaseSensitiveFileNames,this.logger);if(!n)return c;let d=this.getPreferences(i),f=this.getDefaultProject(t),S=f.getScriptInfoForNormalizedPath(i),y=f.getLanguageService().getQuickInfoAtPosition(i,o),T=y?SO(y.displayParts):"",E=y&&y.textSpan,D=E?S.positionToLineOffset(E.start).offset:0,A=E?S.getSnapshot().getText(E.start,Jc(E)):"";return{refs:Ha(c,M=>M.references.map(j=>Aje(this.projectService,j,d))),symbolName:A,symbolStartOffset:D,symbolDisplayString:T}}getFileReferences(t,n){let i=this.getProjects(t),s=Wo(t.file),o=this.getPreferences(s),c={fileName:s,pos:0},d=L0e(i,this.getDefaultProject(t),c,c,Tje,y=>(this.logger.info(`Finding references to file ${s} in project ${y.getProjectName()}`),y.getLanguageService().getFileReferences(s))),f;if(Js(d))f=d;else{f=[];let y=EK(this.host.useCaseSensitiveFileNames);d.forEach(T=>{for(let E of T)y.has(E)||(f.push(E),y.add(E))})}return n?{refs:f.map(y=>Aje(this.projectService,y,o)),symbolName:`"${t.file}"`}:f}openClientFile(t,n,i,s){this.projectService.openClientFileWithNormalizedPath(t,n,i,!1,s)}getPosition(t,n){return t.position!==void 0?t.position:n.lineOffsetToPosition(t.line,t.offset)}getPositionInFile(t,n){let i=this.projectService.getScriptInfoForNormalizedPath(n);return this.getPosition(t,i)}getFileAndProject(t){return this.getFileAndProjectWorker(t.file,t.projectFileName)}getFileAndLanguageServiceForSyntacticOperation(t){let{file:n,project:i}=this.getFileAndProject(t);return{file:n,languageService:i.getLanguageService(!1)}}getFileAndProjectWorker(t,n){let i=Wo(t),s=this.getProject(n)||this.projectService.ensureDefaultProjectForFile(i);return{file:i,project:s}}getOutliningSpans(t,n){let{file:i,languageService:s}=this.getFileAndLanguageServiceForSyntacticOperation(t),o=s.getOutliningSpans(i);if(n){let c=this.projectService.getScriptInfoForNormalizedPath(i);return o.map(d=>({textSpan:Mg(d.textSpan,c),hintSpan:Mg(d.hintSpan,c),bannerText:d.bannerText,autoCollapse:d.autoCollapse,kind:d.kind}))}else return o}getTodoComments(t){let{file:n,project:i}=this.getFileAndProject(t);return i.getLanguageService().getTodoComments(n,t.descriptors)}getDocCommentTemplate(t){let{file:n,languageService:i}=this.getFileAndLanguageServiceForSyntacticOperation(t),s=this.getPositionInFile(t,n);return i.getDocCommentTemplateAtPosition(n,s,this.getPreferences(n),this.getFormatOptions(n))}getSpanOfEnclosingComment(t){let{file:n,languageService:i}=this.getFileAndLanguageServiceForSyntacticOperation(t),s=t.onlyMultiLine,o=this.getPositionInFile(t,n);return i.getSpanOfEnclosingComment(n,o,s)}getIndentation(t){let{file:n,languageService:i}=this.getFileAndLanguageServiceForSyntacticOperation(t),s=this.getPositionInFile(t,n),o=t.options?AD(t.options):this.getFormatOptions(n),c=i.getIndentationAtPosition(n,s,o);return{position:s,indentation:c}}getBreakpointStatement(t){let{file:n,languageService:i}=this.getFileAndLanguageServiceForSyntacticOperation(t),s=this.getPositionInFile(t,n);return i.getBreakpointStatementAtPosition(n,s)}getNameOrDottedNameSpan(t){let{file:n,languageService:i}=this.getFileAndLanguageServiceForSyntacticOperation(t),s=this.getPositionInFile(t,n);return i.getNameOrDottedNameSpan(n,s,s)}isValidBraceCompletion(t){let{file:n,languageService:i}=this.getFileAndLanguageServiceForSyntacticOperation(t),s=this.getPositionInFile(t,n);return i.isValidBraceCompletionAtPosition(n,s,t.openingBrace.charCodeAt(0))}getQuickInfoWorker(t,n){let{file:i,project:s}=this.getFileAndProject(t),o=this.projectService.getScriptInfoForNormalizedPath(i),c=this.getPreferences(i),d=s.getLanguageService().getQuickInfoAtPosition(i,this.getPosition(t,o),c.maximumHoverLength,t.verbosityLevel);if(!d)return;let f=!!c.displayPartsForJSDoc;if(n){let S=SO(d.displayParts);return{kind:d.kind,kindModifiers:d.kindModifiers,start:o.positionToLineOffset(d.textSpan.start),end:o.positionToLineOffset(Jc(d.textSpan)),displayString:S,documentation:f?this.mapDisplayParts(d.documentation,s):SO(d.documentation),tags:this.mapJSDocTagInfo(d.tags,s,f),canIncreaseVerbosityLevel:d.canIncreaseVerbosityLevel}}else return f?d:{...d,tags:this.mapJSDocTagInfo(d.tags,s,!1)}}getFormattingEditsForRange(t){let{file:n,languageService:i}=this.getFileAndLanguageServiceForSyntacticOperation(t),s=this.projectService.getScriptInfoForNormalizedPath(n),o=s.lineOffsetToPosition(t.line,t.offset),c=s.lineOffsetToPosition(t.endLine,t.endOffset),d=i.getFormattingEditsForRange(n,o,c,this.getFormatOptions(n));if(d)return d.map(f=>this.convertTextChangeToCodeEdit(f,s))}getFormattingEditsForRangeFull(t){let{file:n,languageService:i}=this.getFileAndLanguageServiceForSyntacticOperation(t),s=t.options?AD(t.options):this.getFormatOptions(n);return i.getFormattingEditsForRange(n,t.position,t.endPosition,s)}getFormattingEditsForDocumentFull(t){let{file:n,languageService:i}=this.getFileAndLanguageServiceForSyntacticOperation(t),s=t.options?AD(t.options):this.getFormatOptions(n);return i.getFormattingEditsForDocument(n,s)}getFormattingEditsAfterKeystrokeFull(t){let{file:n,languageService:i}=this.getFileAndLanguageServiceForSyntacticOperation(t),s=t.options?AD(t.options):this.getFormatOptions(n);return i.getFormattingEditsAfterKeystroke(n,t.position,t.key,s)}getFormattingEditsAfterKeystroke(t){let{file:n,languageService:i}=this.getFileAndLanguageServiceForSyntacticOperation(t),s=this.projectService.getScriptInfoForNormalizedPath(n),o=s.lineOffsetToPosition(t.line,t.offset),c=this.getFormatOptions(n),d=i.getFormattingEditsAfterKeystroke(n,o,t.key,c);if(t.key===`
457
457
  `&&(!d||d.length===0||Fvt(d,o))){let{lineText:f,absolutePosition:S}=s.textStorage.getAbsolutePositionAndLineText(t.line);if(f&&f.search("\\S")<0){let y=i.getIndentationAtPosition(n,o,c),T=0,E,D;for(E=0,D=f.length;E<D;E++)if(f.charAt(E)===" ")T++;else if(f.charAt(E)===" ")T+=c.tabSize;else break;if(y!==T){let A=S+E;d.push({span:Sl(S,A),newText:ql.getIndentationString(y,c)})}}}if(d)return d.map(f=>({start:s.positionToLineOffset(f.span.start),end:s.positionToLineOffset(Jc(f.span)),newText:f.newText?f.newText:""}))}getCompletions(t,n){let{file:i,project:s}=this.getFileAndProject(t),o=this.projectService.getScriptInfoForNormalizedPath(i),c=this.getPosition(t,o),d=s.getLanguageService().getCompletionsAtPosition(i,c,{...h0e(this.getPreferences(i)),triggerCharacter:t.triggerCharacter,triggerKind:t.triggerKind,includeExternalModuleExports:t.includeExternalModuleExports,includeInsertTextCompletions:t.includeInsertTextCompletions},s.projectService.getFormatCodeOptions(i));if(d===void 0)return;if(n==="completions-full")return d;let f=t.prefix||"",S=Zi(d.entries,T=>{if(d.isMemberCompletion||Cs(T.name.toLowerCase(),f.toLowerCase())){let E=T.replacementSpan?Mg(T.replacementSpan,o):void 0;return{...T,replacementSpan:E,hasAction:T.hasAction||void 0,symbol:void 0}}});return n==="completions"?(d.metadata&&(S.metadata=d.metadata),S):{...d,optionalReplacementSpan:d.optionalReplacementSpan&&Mg(d.optionalReplacementSpan,o),entries:S}}getCompletionEntryDetails(t,n){let{file:i,project:s}=this.getFileAndProject(t),o=this.projectService.getScriptInfoForNormalizedPath(i),c=this.getPosition(t,o),d=s.projectService.getFormatCodeOptions(i),f=!!this.getPreferences(i).displayPartsForJSDoc,S=Zi(t.entryNames,y=>{let{name:T,source:E,data:D}=typeof y=="string"?{name:y,source:void 0,data:void 0}:y;return s.getLanguageService().getCompletionEntryDetails(i,c,T,d,E,this.getPreferences(i),D?wa(D,Hvt):void 0)});return n?f?S:S.map(y=>({...y,tags:this.mapJSDocTagInfo(y.tags,s,!1)})):S.map(y=>({...y,codeActions:Dr(y.codeActions,T=>this.mapCodeAction(T)),documentation:this.mapDisplayParts(y.documentation,s),tags:this.mapJSDocTagInfo(y.tags,s,f)}))}getCompileOnSaveAffectedFileList(t){let n=this.getProjects(t,!0,!0),i=this.projectService.getScriptInfo(t.file);return i?Mvt(i,s=>this.projectService.getScriptInfoForPath(s),n,(s,o)=>{if(!s.compileOnSaveEnabled||!s.languageServiceEnabled||s.isOrphan())return;let c=s.getCompilationSettings();if(!(c.noEmit||Su(o.fileName)&&!Ovt(c)))return{projectFileName:s.getProjectName(),fileNames:s.getCompileOnSaveAffectedFileList(o),projectUsesOutFile:!!c.outFile}}):lu}emitFile(t){let{file:n,project:i}=this.getFileAndProject(t);if(i||t0.ThrowNoProject(),!i.languageServiceEnabled)return t.richResponse?{emitSkipped:!0,diagnostics:[]}:!1;let s=i.getScriptInfo(n),{emitSkipped:o,diagnostics:c}=i.emitFile(s,(d,f,S)=>this.host.writeFile(d,f,S));return t.richResponse?{emitSkipped:o,diagnostics:t.includeLinePosition?this.convertToDiagnosticsWithLinePositionFromDiagnosticFile(c):c.map(d=>QO(d,!0))}:!o}getSignatureHelpItems(t,n){let{file:i,project:s}=this.getFileAndProject(t),o=this.projectService.getScriptInfoForNormalizedPath(i),c=this.getPosition(t,o),d=s.getLanguageService().getSignatureHelpItems(i,c,t),f=!!this.getPreferences(i).displayPartsForJSDoc;if(d&&n){let S=d.applicableSpan;return{...d,applicableSpan:{start:o.positionToLineOffset(S.start),end:o.positionToLineOffset(S.start+S.length)},items:this.mapSignatureHelpItems(d.items,s,f)}}else return f||!d?d:{...d,items:d.items.map(S=>({...S,tags:this.mapJSDocTagInfo(S.tags,s,!1)}))}}toPendingErrorCheck(t){let n=Wo(t),i=this.projectService.tryGetDefaultProjectForFile(n);return i&&{fileName:n,project:i}}getDiagnostics(t,n,i){this.suppressDiagnosticEvents||i.length>0&&this.updateErrorCheck(t,i,n)}change(t){let n=this.projectService.getScriptInfo(t.file);O.assert(!!n),n.textStorage.switchToScriptVersionCache();let i=n.lineOffsetToPosition(t.line,t.offset),s=n.lineOffsetToPosition(t.endLine,t.endOffset);i>=0&&(this.changeSeq++,this.projectService.applyChangesToFile(n,Mf({span:{start:i,length:s-i},newText:t.insertString})))}reload(t){let n=Wo(t.file),i=t.tmpfile===void 0?void 0:Wo(t.tmpfile),s=this.projectService.getScriptInfoForNormalizedPath(n);s&&(this.changeSeq++,s.reloadFromFile(i))}saveToTmp(t,n){let i=this.projectService.getScriptInfo(t);i&&i.saveTo(n)}closeClientFile(t){if(!t)return;let n=Pa(t);this.projectService.closeClientFile(n)}mapLocationNavigationBarItems(t,n){return Dr(t,i=>({text:i.text,kind:i.kind,kindModifiers:i.kindModifiers,spans:i.spans.map(s=>Mg(s,n)),childItems:this.mapLocationNavigationBarItems(i.childItems,n),indent:i.indent}))}getNavigationBarItems(t,n){let{file:i,languageService:s}=this.getFileAndLanguageServiceForSyntacticOperation(t),o=s.getNavigationBarItems(i);return o?n?this.mapLocationNavigationBarItems(o,this.projectService.getScriptInfoForNormalizedPath(i)):o:void 0}toLocationNavigationTree(t,n){return{text:t.text,kind:t.kind,kindModifiers:t.kindModifiers,spans:t.spans.map(i=>Mg(i,n)),nameSpan:t.nameSpan&&Mg(t.nameSpan,n),childItems:Dr(t.childItems,i=>this.toLocationNavigationTree(i,n))}}getNavigationTree(t,n){let{file:i,languageService:s}=this.getFileAndLanguageServiceForSyntacticOperation(t),o=s.getNavigationTree(i);return o?n?this.toLocationNavigationTree(o,this.projectService.getScriptInfoForNormalizedPath(i)):o:void 0}getNavigateToItems(t,n){let i=this.getFullNavigateToItems(t);return n?Ha(i,({project:s,navigateToItems:o})=>o.map(c=>{let d=s.getScriptInfo(c.fileName),f={name:c.name,kind:c.kind,kindModifiers:c.kindModifiers,isCaseSensitive:c.isCaseSensitive,matchKind:c.matchKind,file:c.fileName,start:d.positionToLineOffset(c.textSpan.start),end:d.positionToLineOffset(Jc(c.textSpan))};return c.kindModifiers&&c.kindModifiers!==""&&(f.kindModifiers=c.kindModifiers),c.containerName&&c.containerName.length>0&&(f.containerName=c.containerName),c.containerKind&&c.containerKind.length>0&&(f.containerKind=c.containerKind),f})):Ha(i,({navigateToItems:s})=>s)}getFullNavigateToItems(t){let{currentFileOnly:n,searchValue:i,maxResultCount:s,projectFileName:o}=t;if(n){O.assertIsDefined(t.file);let{file:E,project:D}=this.getFileAndProject(t);return[{project:D,navigateToItems:D.getLanguageService().getNavigateToItems(i,s,E)}]}let c=this.getHostPreferences(),d=[],f=new Map;if(!t.file&&!o)this.projectService.loadAncestorProjectTree(),this.projectService.forEachEnabledProject(E=>S(E));else{let E=this.getProjects(t);xje(E,void 0,D=>S(D))}return d;function S(E){let D=E.getLanguageService().getNavigateToItems(i,s,void 0,E.isNonTsProject(),c.excludeLibrarySymbolsInNavTo),A=Cn(D,F=>y(F)&&!DK(DA(F),E));A.length&&d.push({project:E,navigateToItems:A})}function y(E){let D=E.name;if(!f.has(D))return f.set(D,[E]),!0;let A=f.get(D);for(let F of A)if(T(F,E))return!1;return A.push(E),!0}function T(E,D){return E===D?!0:!E||!D?!1:E.containerKind===D.containerKind&&E.containerName===D.containerName&&E.fileName===D.fileName&&E.isCaseSensitive===D.isCaseSensitive&&E.kind===D.kind&&E.kindModifiers===D.kindModifiers&&E.matchKind===D.matchKind&&E.name===D.name&&E.textSpan.start===D.textSpan.start&&E.textSpan.length===D.textSpan.length}}getSupportedCodeFixes(t){if(!t)return VX();if(t.file){let{file:i,project:s}=this.getFileAndProject(t);return s.getLanguageService().getSupportedCodeFixes(i)}let n=this.getProject(t.projectFileName);return n||t0.ThrowNoProject(),n.getLanguageService().getSupportedCodeFixes()}isLocation(t){return t.line!==void 0}extractPositionOrRange(t,n){let i,s;return this.isLocation(t)?i=o(t):s=this.getRange(t,n),O.checkDefined(i===void 0?s:i);function o(c){return c.position!==void 0?c.position:n.lineOffsetToPosition(c.line,c.offset)}}getRange(t,n){let{startPosition:i,endPosition:s}=this.getStartAndEndPosition(t,n);return{pos:i,end:s}}getApplicableRefactors(t){let{file:n,project:i}=this.getFileAndProject(t),s=i.getScriptInfoForNormalizedPath(n);return i.getLanguageService().getApplicableRefactors(n,this.extractPositionOrRange(t,s),this.getPreferences(n),t.triggerReason,t.kind,t.includeInteractiveActions).map(c=>({...c,actions:c.actions.map(d=>({...d,range:d.range?{start:ND({line:d.range.start.line,character:d.range.start.offset}),end:ND({line:d.range.end.line,character:d.range.end.offset})}:void 0}))}))}getEditsForRefactor(t,n){let{file:i,project:s}=this.getFileAndProject(t),o=s.getScriptInfoForNormalizedPath(i),c=s.getLanguageService().getEditsForRefactor(i,this.getFormatOptions(i),this.extractPositionOrRange(t,o),t.refactor,t.action,this.getPreferences(i),t.interactiveRefactorArguments);if(c===void 0)return{edits:[]};if(n){let{renameFilename:d,renameLocation:f,edits:S}=c,y;if(d!==void 0&&f!==void 0){let T=s.getScriptInfoForNormalizedPath(Wo(d));y=R0e(ww(T.getSnapshot()),d,f,S)}return{renameLocation:y,renameFilename:d,edits:this.mapTextChangesToCodeEdits(S),notApplicableReason:c.notApplicableReason}}return c}getMoveToRefactoringFileSuggestions(t){let{file:n,project:i}=this.getFileAndProject(t),s=i.getScriptInfoForNormalizedPath(n);return i.getLanguageService().getMoveToRefactoringFileSuggestions(n,this.extractPositionOrRange(t,s),this.getPreferences(n))}preparePasteEdits(t){let{file:n,project:i}=this.getFileAndProject(t);return i.getLanguageService().preparePasteEditsForFile(n,t.copiedTextSpan.map(s=>this.getRange({file:n,startLine:s.start.line,startOffset:s.start.offset,endLine:s.end.line,endOffset:s.end.offset},this.projectService.getScriptInfoForNormalizedPath(n))))}getPasteEdits(t){let{file:n,project:i}=this.getFileAndProject(t);if(wA(n))return;let s=t.copiedFrom?{file:t.copiedFrom.file,range:t.copiedFrom.spans.map(c=>this.getRange({file:t.copiedFrom.file,startLine:c.start.line,startOffset:c.start.offset,endLine:c.end.line,endOffset:c.end.offset},i.getScriptInfoForNormalizedPath(Wo(t.copiedFrom.file))))}:void 0,o=i.getLanguageService().getPasteEdits({targetFile:n,pastedText:t.pastedText,pasteLocations:t.pasteLocations.map(c=>this.getRange({file:n,startLine:c.start.line,startOffset:c.start.offset,endLine:c.end.line,endOffset:c.end.offset},i.getScriptInfoForNormalizedPath(n))),copiedFrom:s,preferences:this.getPreferences(n)},this.getFormatOptions(n));return o&&this.mapPasteEditsAction(o)}organizeImports(t,n){O.assert(t.scope.type==="file");let{file:i,project:s}=this.getFileAndProject(t.scope.args),o=s.getLanguageService().organizeImports({fileName:i,mode:t.mode??(t.skipDestructiveCodeActions?"SortAndCombine":void 0),type:"file"},this.getFormatOptions(i),this.getPreferences(i));return n?this.mapTextChangesToCodeEdits(o):o}getEditsForFileRename(t,n){let i=Wo(t.oldFilePath),s=Wo(t.newFilePath),o=this.getHostFormatOptions(),c=this.getHostPreferences(),d=new Set,f=[];return this.projectService.loadAncestorProjectTree(),this.projectService.forEachEnabledProject(S=>{let y=S.getLanguageService().getEditsForFileRename(i,s,o,c),T=[];for(let E of y)d.has(E.fileName)||(f.push(E),T.push(E.fileName));for(let E of T)d.add(E)}),n?f.map(S=>this.mapTextChangeToCodeEdit(S)):f}getCodeFixes(t,n){let{file:i,project:s}=this.getFileAndProject(t),o=s.getScriptInfoForNormalizedPath(i),{startPosition:c,endPosition:d}=this.getStartAndEndPosition(t,o),f;try{f=s.getLanguageService().getCodeFixesAtPosition(i,c,d,t.errorCodes,this.getFormatOptions(i),this.getPreferences(i))}catch(S){let y=S instanceof Error?S:new Error(S),T=s.getLanguageService(),E=[...T.getSyntacticDiagnostics(i),...T.getSemanticDiagnostics(i),...T.getSuggestionDiagnostics(i)].filter(A=>u3(c,d-c,A.start,A.length)).map(A=>A.code),D=t.errorCodes.find(A=>!E.includes(A));throw D!==void 0&&(y.message+=`
458
458
  Additional information: BADCLIENT: Bad error code, ${D} not found in range ${c}..${d} (found: ${E.join(", ")})`),y}return n?f.map(S=>this.mapCodeFixAction(S)):f}getCombinedCodeFix({scope:t,fixId:n},i){O.assert(t.type==="file");let{file:s,project:o}=this.getFileAndProject(t.args),c=o.getLanguageService().getCombinedCodeFix({type:"file",fileName:s},n,this.getFormatOptions(s),this.getPreferences(s));return i?{changes:this.mapTextChangesToCodeEdits(c.changes),commands:c.commands}:c}applyCodeActionCommand(t){let n=t.command;for(let i of uC(n)){let{file:s,project:o}=this.getFileAndProject(i);o.getLanguageService().applyCodeActionCommand(i,this.getFormatOptions(s)).then(c=>{},c=>{})}return{}}getStartAndEndPosition(t,n){let i,s;return t.startPosition!==void 0?i=t.startPosition:(i=n.lineOffsetToPosition(t.startLine,t.startOffset),t.startPosition=i),t.endPosition!==void 0?s=t.endPosition:(s=n.lineOffsetToPosition(t.endLine,t.endOffset),t.endPosition=s),{startPosition:i,endPosition:s}}mapCodeAction({description:t,changes:n,commands:i}){return{description:t,changes:this.mapTextChangesToCodeEdits(n),commands:i}}mapCodeFixAction({fixName:t,description:n,changes:i,commands:s,fixId:o,fixAllDescription:c}){return{fixName:t,description:n,changes:this.mapTextChangesToCodeEdits(i),commands:s,fixId:o,fixAllDescription:c}}mapPasteEditsAction({edits:t,fixId:n}){return{edits:this.mapTextChangesToCodeEdits(t),fixId:n}}mapTextChangesToCodeEdits(t){return t.map(n=>this.mapTextChangeToCodeEdit(n))}mapTextChangeToCodeEdit(t){let n=this.projectService.getScriptInfoOrConfig(t.fileName);return!!t.isNewFile==!!n&&(n||this.projectService.logErrorForScriptInfoNotFound(t.fileName),O.fail("Expected isNewFile for (only) new files. "+JSON.stringify({isNewFile:!!t.isNewFile,hasScriptInfo:!!n}))),n?{fileName:t.fileName,textChanges:t.textChanges.map(i=>Jvt(i,n))}:Vvt(t)}convertTextChangeToCodeEdit(t,n){return{start:n.positionToLineOffset(t.span.start),end:n.positionToLineOffset(t.span.start+t.span.length),newText:t.newText?t.newText:""}}getBraceMatching(t,n){let{file:i,languageService:s}=this.getFileAndLanguageServiceForSyntacticOperation(t),o=this.projectService.getScriptInfoForNormalizedPath(i),c=this.getPosition(t,o),d=s.getBraceMatchingAtPosition(i,c);return d?n?d.map(f=>Mg(f,o)):d:void 0}getDiagnosticsForProject(t,n,i){if(this.suppressDiagnosticEvents)return;let{fileNames:s,languageServiceDisabled:o}=this.getProjectInfoWorker(i,void 0,!0,void 0,!0);if(o)return;let c=s.filter(F=>!F.includes("lib.d.ts"));if(c.length===0)return;let d=[],f=[],S=[],y=[],T=Wo(i),E=this.projectService.ensureDefaultProjectForFile(T);for(let F of c)this.getCanonicalFileName(F)===this.getCanonicalFileName(i)?d.push(F):this.projectService.getScriptInfo(F).isScriptOpen()?f.push(F):Su(F)?y.push(F):S.push(F);let A=[...d,...f,...S,...y].map(F=>({fileName:F,project:E}));this.updateErrorCheck(t,A,n,!1)}configurePlugin(t){this.projectService.configurePlugin(t)}getSmartSelectionRange(t,n){let{locations:i}=t,{file:s,languageService:o}=this.getFileAndLanguageServiceForSyntacticOperation(t),c=O.checkDefined(this.projectService.getScriptInfo(s));return Dr(i,d=>{let f=this.getPosition(d,c),S=o.getSmartSelectionRange(s,f);return n?this.mapSelectionRange(S,c):S})}toggleLineComment(t,n){let{file:i,languageService:s}=this.getFileAndLanguageServiceForSyntacticOperation(t),o=this.projectService.getScriptInfo(i),c=this.getRange(t,o),d=s.toggleLineComment(i,c);if(n){let f=this.projectService.getScriptInfoForNormalizedPath(i);return d.map(S=>this.convertTextChangeToCodeEdit(S,f))}return d}toggleMultilineComment(t,n){let{file:i,languageService:s}=this.getFileAndLanguageServiceForSyntacticOperation(t),o=this.projectService.getScriptInfoForNormalizedPath(i),c=this.getRange(t,o),d=s.toggleMultilineComment(i,c);if(n){let f=this.projectService.getScriptInfoForNormalizedPath(i);return d.map(S=>this.convertTextChangeToCodeEdit(S,f))}return d}commentSelection(t,n){let{file:i,languageService:s}=this.getFileAndLanguageServiceForSyntacticOperation(t),o=this.projectService.getScriptInfoForNormalizedPath(i),c=this.getRange(t,o),d=s.commentSelection(i,c);if(n){let f=this.projectService.getScriptInfoForNormalizedPath(i);return d.map(S=>this.convertTextChangeToCodeEdit(S,f))}return d}uncommentSelection(t,n){let{file:i,languageService:s}=this.getFileAndLanguageServiceForSyntacticOperation(t),o=this.projectService.getScriptInfoForNormalizedPath(i),c=this.getRange(t,o),d=s.uncommentSelection(i,c);if(n){let f=this.projectService.getScriptInfoForNormalizedPath(i);return d.map(S=>this.convertTextChangeToCodeEdit(S,f))}return d}mapSelectionRange(t,n){let i={textSpan:Mg(t.textSpan,n)};return t.parent&&(i.parent=this.mapSelectionRange(t.parent,n)),i}getScriptInfoFromProjectService(t){let n=Wo(t),i=this.projectService.getScriptInfoForNormalizedPath(n);return i||(this.projectService.logErrorForScriptInfoNotFound(n),t0.ThrowNoProject())}toProtocolCallHierarchyItem(t){let n=this.getScriptInfoFromProjectService(t.file);return{name:t.name,kind:t.kind,kindModifiers:t.kindModifiers,file:t.file,containerName:t.containerName,span:Mg(t.span,n),selectionSpan:Mg(t.selectionSpan,n)}}toProtocolCallHierarchyIncomingCall(t){let n=this.getScriptInfoFromProjectService(t.from.file);return{from:this.toProtocolCallHierarchyItem(t.from),fromSpans:t.fromSpans.map(i=>Mg(i,n))}}toProtocolCallHierarchyOutgoingCall(t,n){return{to:this.toProtocolCallHierarchyItem(t.to),fromSpans:t.fromSpans.map(i=>Mg(i,n))}}prepareCallHierarchy(t){let{file:n,project:i}=this.getFileAndProject(t),s=this.projectService.getScriptInfoForNormalizedPath(n);if(s){let o=this.getPosition(t,s),c=i.getLanguageService().prepareCallHierarchy(n,o);return c&&tX(c,d=>this.toProtocolCallHierarchyItem(d))}}provideCallHierarchyIncomingCalls(t){let{file:n,project:i}=this.getFileAndProject(t),s=this.getScriptInfoFromProjectService(n);return i.getLanguageService().provideCallHierarchyIncomingCalls(n,this.getPosition(t,s)).map(c=>this.toProtocolCallHierarchyIncomingCall(c))}provideCallHierarchyOutgoingCalls(t){let{file:n,project:i}=this.getFileAndProject(t),s=this.getScriptInfoFromProjectService(n);return i.getLanguageService().provideCallHierarchyOutgoingCalls(n,this.getPosition(t,s)).map(c=>this.toProtocolCallHierarchyOutgoingCall(c,s))}getCanonicalFileName(t){let n=this.host.useCaseSensitiveFileNames?t:Gv(t);return Pa(n)}exit(){}notRequired(t){return t&&this.doOutput(void 0,t.command,t.seq,!0,this.performanceData),{responseRequired:!1,performanceData:this.performanceData}}requiredResponse(t){return{response:t,responseRequired:!0,performanceData:this.performanceData}}addProtocolHandler(t,n){if(this.handlers.has(t))throw new Error(`Protocol handler already exists for command "${t}"`);this.handlers.set(t,n)}setCurrentRequest(t){O.assert(this.currentRequestId===void 0),this.currentRequestId=t,this.cancellationToken.setRequest(t)}resetCurrentRequest(t){O.assert(this.currentRequestId===t),this.currentRequestId=void 0,this.cancellationToken.resetRequest(t)}executeWithRequestId(t,n,i){let s=this.performanceData;try{return this.performanceData=i,this.setCurrentRequest(t),n()}finally{this.resetCurrentRequest(t),this.performanceData=s}}executeCommand(t){let n=this.handlers.get(t.command);if(n){let i=this.executeWithRequestId(t.seq,()=>n(t),void 0);return this.projectService.enableRequestedPlugins(),i}else return this.logger.msg(`Unrecognized JSON command:${nS(t)}`,"Err"),this.doOutput(void 0,"unknown",t.seq,!1,void 0,`Unrecognized JSON command: ${t.command}`),{responseRequired:!1}}onMessage(t){var n,i,s,o,c,d,f;this.gcTimer.scheduleCollect();let S,y=this.performanceData;this.logger.hasLevel(2)&&(S=this.hrtime(),this.logger.hasLevel(3)&&this.logger.info(`request:${KI(this.toStringMessage(t))}`));let T,E;try{T=this.parseMessage(t),E=T.arguments&&T.arguments.file?T.arguments:void 0,(n=In)==null||n.instant(In.Phase.Session,"request",{seq:T.seq,command:T.command}),(i=In)==null||i.push(In.Phase.Session,"executeCommand",{seq:T.seq,command:T.command},!0);let{response:D,responseRequired:A,performanceData:F}=this.executeCommand(T);if((s=In)==null||s.pop(),this.logger.hasLevel(2)){let M=Nvt(this.hrtime(S)).toFixed(4);A?this.logger.perftrc(`${T.seq}::${T.command}: elapsed time (in milliseconds) ${M}`):this.logger.perftrc(`${T.seq}::${T.command}: async elapsed time (in milliseconds) ${M}`)}(o=In)==null||o.instant(In.Phase.Session,"response",{seq:T.seq,command:T.command,success:!!D}),D?this.doOutput(D,T.command,T.seq,!0,F):A&&this.doOutput(void 0,T.command,T.seq,!1,F,"No content available.")}catch(D){if((c=In)==null||c.popAll(),D instanceof HP){(d=In)==null||d.instant(In.Phase.Session,"commandCanceled",{seq:T==null?void 0:T.seq,command:T==null?void 0:T.command}),this.doOutput({canceled:!0},T.command,T.seq,!0,this.performanceData);return}this.logErrorWorker(D,this.toStringMessage(t),E),(f=In)==null||f.instant(In.Phase.Session,"commandError",{seq:T==null?void 0:T.seq,command:T==null?void 0:T.command,message:D.message}),this.doOutput(void 0,T?T.command:"unknown",T?T.seq:0,!1,this.performanceData,"Error processing request. "+D.message+`
459
- `+D.stack)}finally{this.performanceData=y}}parseMessage(t){return JSON.parse(t)}toStringMessage(t){return t}getFormatOptions(t){return this.projectService.getFormatCodeOptions(t)}getPreferences(t){return this.projectService.getPreferences(t)}getHostFormatOptions(){return this.projectService.getHostFormatCodeOptions()}getHostPreferences(){return this.projectService.getHostPreferences()}};function Pje(e){let t=e.diagnosticsDuration&&zs(e.diagnosticsDuration,([n,i])=>({...i,file:n}));return{...e,diagnosticsDuration:t}}function Mg(e,t){return{start:t.positionToLineOffset(e.start),end:t.positionToLineOffset(Jc(e))}}function M0e(e,t,n){let i=Mg(e,n),s=t&&Mg(t,n);return s?{...i,contextStart:s.start,contextEnd:s.end}:i}function Jvt(e,t){return{start:Ije(t,e.span.start),end:Ije(t,Jc(e.span)),newText:e.newText}}function Ije(e,t){return P0e(e)?Wvt(e.getLineAndCharacterOfPosition(t)):e.positionToLineOffset(t)}function Uvt(e,t){let n=e.ranges.map(i=>({start:t.positionToLineOffset(i.start),end:t.positionToLineOffset(i.start+i.length)}));return e.wordPattern?{ranges:n,wordPattern:e.wordPattern}:{ranges:n}}function Wvt(e){return{line:e.line+1,offset:e.character+1}}function Vvt(e){O.assert(e.textChanges.length===1);let t=qn(e.textChanges);return O.assert(t.span.start===0&&t.span.length===0),{fileName:e.fileName,textChanges:[{start:{line:0,offset:0},end:{line:0,offset:0},newText:t.newText}]}}function R0e(e,t,n,i){let s=qvt(e,t,i),{line:o,character:c}=GE(hC(s),n);return{line:o+1,offset:c+1}}function qvt(e,t,n){for(let{fileName:i,textChanges:s}of n)if(i===t)for(let o=s.length-1;o>=0;o--){let{newText:c,span:{start:d,length:f}}=s[o];e=e.slice(0,d)+c+e.slice(d+f)}return e}function Aje(e,{fileName:t,textSpan:n,contextSpan:i,isWriteAccess:s,isDefinition:o},{disableLineTextInReferences:c}){let d=O.checkDefined(e.getScriptInfo(t)),f=M0e(n,i,d),S=c?void 0:Gvt(d,f);return{file:t,...f,lineText:S,isWriteAccess:s,isDefinition:o}}function Gvt(e,t){let n=e.lineToTextSpan(t.start.line-1);return e.getSnapshot().getText(n.start,Jc(n)).replace(/\r|\n/g,"")}function Hvt(e){return e===void 0||e&&typeof e=="object"&&typeof e.exportName=="string"&&(e.fileName===void 0||typeof e.fileName=="string")&&(e.ambientModuleName===void 0||typeof e.ambientModuleName=="string"&&(e.isPackageJsonImport===void 0||typeof e.isPackageJsonImport=="boolean"))}var OD=4,j0e=(e=>(e[e.PreStart=0]="PreStart",e[e.Start=1]="Start",e[e.Entire=2]="Entire",e[e.Mid=3]="Mid",e[e.End=4]="End",e[e.PostEnd=5]="PostEnd",e))(j0e||{}),Zvt=class{constructor(){this.goSubtree=!0,this.lineIndex=new KO,this.endBranch=[],this.state=2,this.initialText="",this.trailingText="",this.lineIndex.root=new FD,this.startPath=[this.lineIndex.root],this.stack=[this.lineIndex.root]}get done(){return!1}insertLines(e,t){t&&(this.trailingText=""),e?e=this.initialText+e+this.trailingText:e=this.initialText+this.trailingText;let i=KO.linesFromText(e).lines;i.length>1&&i[i.length-1]===""&&i.pop();let s,o;for(let d=this.endBranch.length-1;d>=0;d--)this.endBranch[d].updateCounts(),this.endBranch[d].charCount()===0&&(o=this.endBranch[d],d>0?s=this.endBranch[d-1]:s=this.branchNode);o&&s.remove(o);let c=this.startPath[this.startPath.length-1];if(i.length>0)if(c.text=i[0],i.length>1){let d=new Array(i.length-1),f=c;for(let T=1;T<i.length;T++)d[T-1]=new J$(i[T]);let S=this.startPath.length-2;for(;S>=0;){let T=this.startPath[S];d=T.insertAt(f,d),S--,f=T}let y=d.length;for(;y>0;){let T=new FD;T.add(this.lineIndex.root),d=T.insertAt(this.lineIndex.root,d),y=d.length,this.lineIndex.root=T}this.lineIndex.root.updateCounts()}else for(let d=this.startPath.length-2;d>=0;d--)this.startPath[d].updateCounts();else{this.startPath[this.startPath.length-2].remove(c);for(let f=this.startPath.length-2;f>=0;f--)this.startPath[f].updateCounts()}return this.lineIndex}post(e,t,n){n===this.lineCollectionAtBranch&&(this.state=4),this.stack.pop()}pre(e,t,n,i,s){let o=this.stack[this.stack.length-1];this.state===2&&s===1&&(this.state=1,this.branchNode=o,this.lineCollectionAtBranch=n);let c;function d(f){return f.isLeaf()?new J$(""):new FD}switch(s){case 0:this.goSubtree=!1,this.state!==4&&o.add(n);break;case 1:this.state===4?this.goSubtree=!1:(c=d(n),o.add(c),this.startPath.push(c));break;case 2:this.state!==4?(c=d(n),o.add(c),this.startPath.push(c)):n.isLeaf()||(c=d(n),o.add(c),this.endBranch.push(c));break;case 3:this.goSubtree=!1;break;case 4:this.state!==4?this.goSubtree=!1:n.isLeaf()||(c=d(n),o.add(c),this.endBranch.push(c));break;case 5:this.goSubtree=!1,this.state!==1&&o.add(n);break}this.goSubtree&&this.stack.push(c)}leaf(e,t,n){this.state===1?this.initialText=n.text.substring(0,e):this.state===2?(this.initialText=n.text.substring(0,e),this.trailingText=n.text.substring(e+t)):this.trailingText=n.text.substring(e+t)}},Xvt=class{constructor(e,t,n){this.pos=e,this.deleteLen=t,this.insertedText=n}getTextChangeRange(){return _3(Ju(this.pos,this.deleteLen),this.insertedText?this.insertedText.length:0)}},PK=class aC{constructor(){this.changes=[],this.versions=new Array(aC.maxVersions),this.minVersion=0,this.currentVersion=0}versionToIndex(t){if(!(t<this.minVersion||t>this.currentVersion))return t%aC.maxVersions}currentVersionToIndex(){return this.currentVersion%aC.maxVersions}edit(t,n,i){this.changes.push(new Xvt(t,n,i)),(this.changes.length>aC.changeNumberThreshold||n>aC.changeLengthThreshold||i&&i.length>aC.changeLengthThreshold)&&this.getSnapshot()}getSnapshot(){return this._getSnapshot()}_getSnapshot(){let t=this.versions[this.currentVersionToIndex()];if(this.changes.length>0){let n=t.index;for(let i of this.changes)n=n.edit(i.pos,i.deleteLen,i.insertedText);t=new Nje(this.currentVersion+1,this,n,this.changes),this.currentVersion=t.version,this.versions[this.currentVersionToIndex()]=t,this.changes=[],this.currentVersion-this.minVersion>=aC.maxVersions&&(this.minVersion=this.currentVersion-aC.maxVersions+1)}return t}getSnapshotVersion(){return this._getSnapshot().version}getAbsolutePositionAndLineText(t){return this._getSnapshot().index.lineNumberToInfo(t)}lineOffsetToPosition(t,n){return this._getSnapshot().index.absolutePositionOfStartOfLine(t)+(n-1)}positionToLineOffset(t){return this._getSnapshot().index.positionToLineOffset(t)}lineToTextSpan(t){let n=this._getSnapshot().index,{lineText:i,absolutePosition:s}=n.lineNumberToInfo(t+1),o=i!==void 0?i.length:n.absolutePositionOfStartOfLine(t+2)-s;return Ju(s,o)}getTextChangesBetweenVersions(t,n){if(t<n)if(t>=this.minVersion){let i=[];for(let s=t+1;s<=n;s++){let o=this.versions[this.versionToIndex(s)];for(let c of o.changesSincePreviousVersion)i.push(c.getTextChangeRange())}return Sse(i)}else return;else return m9}getLineCount(){return this._getSnapshot().index.getLineCount()}static fromString(t){let n=new aC,i=new Nje(0,n,new KO);n.versions[n.currentVersion]=i;let s=KO.linesFromText(t);return i.index.load(s.lines),n}};PK.changeNumberThreshold=8,PK.changeLengthThreshold=256,PK.maxVersions=8;var IK=PK,Nje=class aKe{constructor(t,n,i,s=lu){this.version=t,this.cache=n,this.index=i,this.changesSincePreviousVersion=s}getText(t,n){return this.index.getText(t,n-t)}getLength(){return this.index.getLength()}getChangeRange(t){if(t instanceof aKe&&this.cache===t.cache)return this.version<=t.version?m9:this.cache.getTextChangesBetweenVersions(t.version,this.version)}},KO=class oEe{constructor(){this.checkEdits=!1}absolutePositionOfStartOfLine(t){return this.lineNumberToInfo(t).absolutePosition}positionToLineOffset(t){let{oneBasedLine:n,zeroBasedColumn:i}=this.root.charOffsetToLineInfo(1,t);return{line:n,offset:i+1}}positionToColumnAndLineText(t){return this.root.charOffsetToLineInfo(1,t)}getLineCount(){return this.root.lineCount()}lineNumberToInfo(t){let n=this.getLineCount();if(t<=n){let{position:i,leaf:s}=this.root.lineNumberToInfo(t,0);return{absolutePosition:i,lineText:s&&s.text}}else return{absolutePosition:this.root.charCount(),lineText:void 0}}load(t){if(t.length>0){let n=[];for(let i=0;i<t.length;i++)n[i]=new J$(t[i]);this.root=oEe.buildTreeFromBottom(n)}else this.root=new FD}walk(t,n,i){this.root.walk(t,n,i)}getText(t,n){let i="";return n>0&&t<this.root.charCount()&&this.walk(t,n,{goSubtree:!0,done:!1,leaf:(s,o,c)=>{i=i.concat(c.text.substring(s,s+o))}}),i}getLength(){return this.root.charCount()}every(t,n,i){i||(i=this.root.charCount());let s={goSubtree:!0,done:!1,leaf(o,c,d){t(d,o,c)||(this.done=!0)}};return this.walk(n,i-n,s),!s.done}edit(t,n,i){if(this.root.charCount()===0)return O.assert(n===0),i!==void 0?(this.load(oEe.linesFromText(i).lines),this):void 0;{let s;if(this.checkEdits){let d=this.getText(0,this.root.charCount());s=d.slice(0,t)+i+d.slice(t+n)}let o=new Zvt,c=!1;if(t>=this.root.charCount()){t=this.root.charCount()-1;let d=this.getText(t,1);i?i=d+i:i=d,n=0,c=!0}else if(n>0){let d=t+n,{zeroBasedColumn:f,lineText:S}=this.positionToColumnAndLineText(d);f===0&&(n+=S.length,i=i?i+S:S)}if(this.root.walk(t,n,o),o.insertLines(i,c),this.checkEdits){let d=o.lineIndex.getText(0,o.lineIndex.getLength());O.assert(s===d,"buffer edit mismatch")}return o.lineIndex}}static buildTreeFromBottom(t){if(t.length<OD)return new FD(t);let n=new Array(Math.ceil(t.length/OD)),i=0;for(let s=0;s<n.length;s++){let o=Math.min(i+OD,t.length);n[s]=new FD(t.slice(i,o)),i=o}return this.buildTreeFromBottom(n)}static linesFromText(t){let n=hC(t);if(n.length===0)return{lines:[],lineMap:n};let i=new Array(n.length),s=n.length-1;for(let c=0;c<s;c++)i[c]=t.substring(n[c],n[c+1]);let o=t.substring(n[s]);return o.length>0?i[s]=o:i.pop(),{lines:i,lineMap:n}}},FD=class cEe{constructor(t=[]){this.children=t,this.totalChars=0,this.totalLines=0,t.length&&this.updateCounts()}isLeaf(){return!1}updateCounts(){this.totalChars=0,this.totalLines=0;for(let t of this.children)this.totalChars+=t.charCount(),this.totalLines+=t.lineCount()}execWalk(t,n,i,s,o){return i.pre&&i.pre(t,n,this.children[s],this,o),i.goSubtree?(this.children[s].walk(t,n,i),i.post&&i.post(t,n,this.children[s],this,o)):i.goSubtree=!0,i.done}skipChild(t,n,i,s,o){s.pre&&!s.done&&(s.pre(t,n,this.children[i],this,o),s.goSubtree=!0)}walk(t,n,i){if(this.children.length===0)return;let s=0,o=this.children[s].charCount(),c=t;for(;c>=o;)this.skipChild(c,n,s,i,0),c-=o,s++,o=this.children[s].charCount();if(c+n<=o){if(this.execWalk(c,n,i,s,2))return}else{if(this.execWalk(c,o-c,i,s,1))return;let d=n-(o-c);for(s++,o=this.children[s].charCount();d>o;){if(this.execWalk(0,o,i,s,3))return;d-=o,s++,o=this.children[s].charCount()}if(d>0&&this.execWalk(0,d,i,s,4))return}if(i.pre){let d=this.children.length;if(s<d-1)for(let f=s+1;f<d;f++)this.skipChild(0,0,f,i,5)}}charOffsetToLineInfo(t,n){if(this.children.length===0)return{oneBasedLine:t,zeroBasedColumn:n,lineText:void 0};for(let o of this.children){if(o.charCount()>n)return o.isLeaf()?{oneBasedLine:t,zeroBasedColumn:n,lineText:o.text}:o.charOffsetToLineInfo(t,n);n-=o.charCount(),t+=o.lineCount()}let i=this.lineCount();if(i===0)return{oneBasedLine:1,zeroBasedColumn:0,lineText:void 0};let s=O.checkDefined(this.lineNumberToInfo(i,0).leaf);return{oneBasedLine:i,zeroBasedColumn:s.charCount(),lineText:void 0}}lineNumberToInfo(t,n){for(let i of this.children){let s=i.lineCount();if(s>=t)return i.isLeaf()?{position:n,leaf:i}:i.lineNumberToInfo(t,n);t-=s,n+=i.charCount()}return{position:n,leaf:void 0}}splitAfter(t){let n,i=this.children.length;t++;let s=t;if(t<i){for(n=new cEe;t<i;)n.add(this.children[t]),t++;n.updateCounts()}return this.children.length=s,n}remove(t){let n=this.findChildIndex(t),i=this.children.length;if(n<i-1)for(let s=n;s<i-1;s++)this.children[s]=this.children[s+1];this.children.pop()}findChildIndex(t){let n=this.children.indexOf(t);return O.assert(n!==-1),n}insertAt(t,n){let i=this.findChildIndex(t),s=this.children.length,o=n.length;if(s<OD&&i===s-1&&o===1)return this.add(n[0]),this.updateCounts(),[];{let c=this.splitAfter(i),d=0;for(i++;i<OD&&d<o;)this.children[i]=n[d],i++,d++;let f=[],S=0;if(d<o){S=Math.ceil((o-d)/OD),f=new Array(S);let y=0;for(let E=0;E<S;E++)f[E]=new cEe;let T=f[0];for(;d<o;)T.add(n[d]),d++,T.children.length===OD&&(y++,T=f[y]);for(let E=f.length-1;E>=0;E--)f[E].children.length===0&&f.pop()}c&&f.push(c),this.updateCounts();for(let y=0;y<S;y++)f[y].updateCounts();return f}}add(t){this.children.push(t),O.assert(this.children.length<=OD)}charCount(){return this.totalChars}lineCount(){return this.totalLines}},J$=class{constructor(e){this.text=e}isLeaf(){return!0}walk(e,t,n){n.leaf(e,t,this)}charCount(){return this.text.length}lineCount(){return 1}},Oje=class oKe{constructor(t,n,i,s,o,c){this.telemetryEnabled=t,this.logger=n,this.host=i,this.globalTypingsCacheLocation=s,this.event=o,this.maxActiveRequestCount=c,this.activeRequestCount=0,this.requestQueue=ZN(),this.requestMap=new Map,this.requestedRegistry=!1,this.packageInstallId=0}isKnownTypesPackageName(t){var n;return O1.validatePackageName(t)!==O1.NameValidationResult.Ok?!1:(this.requestedRegistry||(this.requestedRegistry=!0,this.installer.send({kind:"typesRegistry"})),!!((n=this.typesRegistryCache)!=null&&n.has(t)))}installPackage(t){this.packageInstallId++;let n={kind:"installPackage",...t,id:this.packageInstallId},i=new Promise((s,o)=>{(this.packageInstalledPromise??(this.packageInstalledPromise=new Map)).set(this.packageInstallId,{resolve:s,reject:o})});return this.installer.send(n),i}attach(t){this.projectService=t,this.installer=this.createInstallerProcess()}onProjectClosed(t){this.installer.send({projectName:t.getProjectName(),kind:"closeProject"})}enqueueInstallTypingsRequest(t,n,i){let s=Vye(t,n,i);this.logger.hasLevel(3)&&this.logger.info(`TIAdapter:: Scheduling throttled operation:${nS(s)}`),this.activeRequestCount<this.maxActiveRequestCount?this.scheduleRequest(s):(this.logger.hasLevel(3)&&this.logger.info(`TIAdapter:: Deferring request for: ${s.projectName}`),this.requestQueue.enqueue(s),this.requestMap.set(s.projectName,s))}handleMessage(t){var n,i;switch(this.logger.hasLevel(3)&&this.logger.info(`TIAdapter:: Received response:${nS(t)}`),t.kind){case eZ:this.typesRegistryCache=new Map(Object.entries(t.typesRegistry));break;case oj:{let s=(n=this.packageInstalledPromise)==null?void 0:n.get(t.id);O.assertIsDefined(s,"Should find the promise for package install"),(i=this.packageInstalledPromise)==null||i.delete(t.id),t.success?s.resolve({successMessage:t.message}):s.reject(t.message),this.projectService.updateTypingsForProject(t),this.event(t,"setTypings");break}case Qfe:{let s={message:t.message};this.event(s,"typesInstallerInitializationFailed");break}case tZ:{let s={eventId:t.eventId,packages:t.packagesToInstall};this.event(s,"beginInstallTypes");break}case rZ:{if(this.telemetryEnabled){let c={telemetryEventName:"typingsInstalled",payload:{installedPackages:t.packagesToInstall.join(","),installSuccess:t.installSuccess,typingsInstallerVersion:t.typingsInstallerVersion}};this.event(c,"telemetry")}let s={eventId:t.eventId,packages:t.packagesToInstall,success:t.installSuccess};this.event(s,"endInstallTypes");break}case aj:{this.projectService.updateTypingsForProject(t);break}case sj:{for(this.activeRequestCount>0?this.activeRequestCount--:O.fail("TIAdapter:: Received too many responses");!this.requestQueue.isEmpty();){let s=this.requestQueue.dequeue();if(this.requestMap.get(s.projectName)===s){this.requestMap.delete(s.projectName),this.scheduleRequest(s);break}this.logger.hasLevel(3)&&this.logger.info(`TIAdapter:: Skipping defunct request for: ${s.projectName}`)}this.projectService.updateTypingsForProject(t),this.event(t,"setTypings");break}case G7:this.projectService.watchTypingLocations(t);break;default:}}scheduleRequest(t){this.logger.hasLevel(3)&&this.logger.info(`TIAdapter:: Scheduling request for: ${t.projectName}`),this.activeRequestCount++,this.host.setTimeout(()=>{this.logger.hasLevel(3)&&this.logger.info(`TIAdapter:: Sending request:${nS(t)}`),this.installer.send(t)},oKe.requestDelayMillis,`${t.projectName}::${t.kind}`)}};Oje.requestDelayMillis=100;var Fje=Oje,Lje={};x(Lje,{ActionInvalidate:()=>aj,ActionPackageInstalled:()=>oj,ActionSet:()=>sj,ActionWatchTypingLocations:()=>G7,Arguments:()=>nZ,AutoImportProviderProject:()=>f0e,AuxiliaryProject:()=>u0e,CharRangeSection:()=>j0e,CloseFileWatcherEvent:()=>yK,CommandNames:()=>bje,ConfigFileDiagEvent:()=>pK,ConfiguredProject:()=>p0e,ConfiguredProjectLoadKind:()=>v0e,CreateDirectoryWatcherEvent:()=>hK,CreateFileWatcherEvent:()=>gK,Errors:()=>t0,EventBeginInstallTypes:()=>tZ,EventEndInstallTypes:()=>rZ,EventInitializationFailed:()=>Qfe,EventTypesRegistry:()=>eZ,ExternalProject:()=>oK,GcTimer:()=>Kye,InferredProject:()=>l0e,LargeFileReferencedEvent:()=>fK,LineIndex:()=>KO,LineLeaf:()=>J$,LineNode:()=>FD,LogLevel:()=>Uye,Msg:()=>Wye,OpenFileInfoTelemetryEvent:()=>d0e,Project:()=>zw,ProjectInfoTelemetryEvent:()=>mK,ProjectKind:()=>EA,ProjectLanguageServiceStateEvent:()=>dK,ProjectLoadingFinishEvent:()=>_K,ProjectLoadingStartEvent:()=>uK,ProjectService:()=>D0e,ProjectsUpdatedInBackgroundEvent:()=>$$,ScriptInfo:()=>r0e,ScriptVersionCache:()=>IK,Session:()=>Dje,TextStorage:()=>t0e,ThrottledOperations:()=>Qye,TypingsInstallerAdapter:()=>Fje,allFilesAreJsOrDts:()=>a0e,allRootFilesAreJsOrDts:()=>s0e,asNormalizedPath:()=>qRe,convertCompilerOptions:()=>z$,convertFormatOptions:()=>AD,convertScriptKindName:()=>bK,convertTypeAcquisition:()=>g0e,convertUserPreferences:()=>h0e,convertWatchOptions:()=>XO,countEachFileTypes:()=>qO,createInstallTypingsRequest:()=>Vye,createModuleSpecifierCache:()=>A0e,createNormalizedPathMap:()=>GRe,createPackageJsonCache:()=>N0e,createSortedArray:()=>Xye,emptyArray:()=>lu,findArgument:()=>GAe,formatDiagnosticToProtocol:()=>QO,formatMessage:()=>O0e,getBaseConfigFileName:()=>aK,getDetailWatchInfo:()=>kK,getLocationInNewDocument:()=>R0e,hasArgument:()=>qAe,hasNoTypeScriptSource:()=>o0e,indent:()=>KI,isBackgroundProject:()=>HO,isConfigFile:()=>P0e,isConfiguredProject:()=>ov,isDynamicFileName:()=>wA,isExternalProject:()=>GO,isInferredProject:()=>ID,isInferredProjectName:()=>qye,isProjectDeferredClose:()=>ZO,makeAutoImportProviderProjectName:()=>Hye,makeAuxiliaryProjectName:()=>Zye,makeInferredProjectName:()=>Gye,maxFileSize:()=>lK,maxProgramSizeForNonTsFiles:()=>cK,normalizedPathToPath:()=>PD,nowString:()=>HAe,nullCancellationToken:()=>hje,nullTypingsInstaller:()=>B$,protocol:()=>Yye,scriptInfoIsContainedByBackgroundProject:()=>n0e,scriptInfoIsContainedByDeferredClosedProject:()=>i0e,stringifyIndented:()=>nS,toEvent:()=>F0e,toNormalizedPath:()=>Wo,tryConvertScriptKindName:()=>vK,typingsInstaller:()=>Jye,updateProjectIfDirty:()=>Gd}),typeof console<"u"&&(O.loggingHost={log(e,t){switch(e){case 1:return console.error(t);case 2:return console.warn(t);case 3:return console.log(t);case 4:return console.log(t)}}})})({get exports(){return eKe},set exports(_){eKe=_,typeof hne<"u"&&hne.exports&&(hne.exports=_)}})});var DKe=Gk((zjt,yFt)=>{yFt.exports={name:"@fabriziosalmi/slopless",version:"1.4.2",description:"",main:"dist/index.js",bin:{slopless:"dist/index.js"},files:["dist","rules"],scripts:{test:"vitest run","test:watch":"vitest","test:coverage":"vitest run --coverage",build:"tsup","docs:dev":"npm run docs:gen && vitepress dev docs","docs:gen":"ts-node scripts/generate-rule-docs.ts","docs:build":"npm run docs:gen && vitepress build docs","docs:preview":"vitepress preview docs","verify:bundle":"node scripts/verify-bundle.js","verify:action":"bash scripts/run-action-locally.sh . 'src/**/*.ts'","release:prep":"npm run docs:gen && npm run build && npm test && npm run verify:bundle"},keywords:["linter","static-analysis","anti-vibecoding","sarif"],author:"Fabrizio Salmi",license:"MIT",repository:{type:"git",url:"git+https://github.com/fabriziosalmi/slopless.git"},homepage:"https://fabriziosalmi.github.io/slopless/",bugs:{url:"https://github.com/fabriziosalmi/slopless/issues"},type:"commonjs",devDependencies:{"@types/glob":"^8.1.0","@types/js-yaml":"^4.0.9","@types/node":"^25.3.0","@vitest/coverage-v8":"^4.0.18",commander:"^14.0.3",glob:"^13.0.6",ignore:"^7.0.5","js-yaml":"^4.1.1",minimatch:"^10.2.6","ts-node":"^10.9.2",tsup:"^8.5.1",typescript:"^5.9.3",vitepress:"^1.6.4",vitest:"^4.1.11",zod:"^4.3.6"},allowScripts:{esbuild:!0,fsevents:!0},publishConfig:{access:"public"}}});var CFt={};Hk(CFt,{applyIgnoreRules:()=>NKe,selectRules:()=>OKe});module.exports=JPt(CFt);var zVe=Z_($Ve(),1),{program:LFt,createCommand:MFt,createArgument:RFt,createOption:jFt,CommanderError:$Ft,InvalidArgumentError:zFt,InvalidOptionArgumentError:BFt,Command:BVe,Argument:JFt,Option:UFt,Help:WFt}=zVe.default;var kqe=require("url"),s5=require("path"),Pqe=require("url"),Qk=require("fs"),lIt=Z_(require("fs"),1),SP=require("fs/promises"),rte=require("events"),e2e=Z_(require("stream"),1),Iqe=require("string_decoder"),fqe=(_,l,g)=>{let b=_ instanceof RegExp?JVe(_,g):_,p=l instanceof RegExp?JVe(l,g):l,x=b!==null&&p!=null&&i4t(b,p,g);return x&&{start:x[0],end:x[1],pre:g.slice(0,x[0]),body:g.slice(x[0]+b.length,x[1]),post:g.slice(x[1]+p.length)}},JVe=(_,l)=>{let g=l.match(_);return g?g[0]:null},i4t=(_,l,g)=>{let b,p,x,P,B,re=g.indexOf(_),_e=g.indexOf(l,re+1),ge=re;if(re>=0&&_e>0){if(_===l)return[re,_e];for(b=[],x=g.length;ge>=0&&!B;){if(ge===re)b.push(ge),re=g.indexOf(_,ge+1);else if(b.length===1){let we=b.pop();we!==void 0&&(B=[we,_e])}else p=b.pop(),p!==void 0&&p<x&&(x=p,P=_e),_e=g.indexOf(l,ge+1);ge=re<_e&&re>=0?re:_e}b.length&&P!==void 0&&(B=[x,P])}return B},pqe="\0SLASH"+Math.random()+"\0",dqe="\0OPEN"+Math.random()+"\0",KSe="\0CLOSE"+Math.random()+"\0",mqe="\0COMMA"+Math.random()+"\0",gqe="\0PERIOD"+Math.random()+"\0",s4t=new RegExp(pqe,"g"),a4t=new RegExp(dqe,"g"),o4t=new RegExp(KSe,"g"),c4t=new RegExp(mqe,"g"),l4t=new RegExp(gqe,"g"),u4t=/\\\\/g,_4t=/\\{/g,f4t=/\\}/g,p4t=/\\,/g,d4t=/\\./g,m4t=1e5;function USe(_){return isNaN(_)?_.charCodeAt(0):parseInt(_,10)}function g4t(_){return _.replace(u4t,pqe).replace(_4t,dqe).replace(f4t,KSe).replace(p4t,mqe).replace(d4t,gqe)}function h4t(_){return _.replace(s4t,"\\").replace(a4t,"{").replace(o4t,"}").replace(c4t,",").replace(l4t,".")}function hqe(_){if(!_)return[""];let l=[],g=fqe("{","}",_);if(!g)return _.split(",");let{pre:b,body:p,post:x}=g,P=b.split(",");P[P.length-1]+="{"+p+"}";let B=hqe(x);return x.length&&(P[P.length-1]+=B.shift(),P.push.apply(P,B)),l.push.apply(l,P),l}function y4t(_,l={}){if(!_)return[];let{max:g=m4t}=l;return _.slice(0,2)==="{}"&&(_="\\{\\}"+_.slice(2)),CB(g4t(_),g,!0).map(h4t)}function v4t(_){return"{"+_+"}"}function b4t(_){return/^-?0\d/.test(_)}function S4t(_,l){return _<=l}function x4t(_,l){return _>=l}function CB(_,l,g){let b=[],p=fqe("{","}",_);if(!p)return[_];let x=p.pre,P=p.post.length?CB(p.post,l,!1):[""];if(/\$$/.test(p.pre))for(let B=0;B<P.length&&B<l;B++){let re=x+"{"+p.body+"}"+P[B];b.push(re)}else{let B=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(p.body),re=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(p.body),_e=B||re,ge=p.body.indexOf(",")>=0;if(!_e&&!ge)return p.post.match(/,(?!,).*\}/)?(_=p.pre+"{"+p.body+KSe+p.post,CB(_,l,!0)):[_];let we;if(_e)we=p.body.split(/\.\./);else if(we=hqe(p.body),we.length===1&&we[0]!==void 0&&(we=CB(we[0],l,!1).map(v4t),we.length===1))return P.map(gt=>p.pre+we[0]+gt);let ae;if(_e&&we[0]!==void 0&&we[1]!==void 0){let gt=USe(we[0]),Ve=USe(we[1]),qe=Math.max(we[0].length,we[1].length),fn=we.length===3&&we[2]!==void 0?Math.abs(USe(we[2])):1,Mr=S4t;Ve<gt&&(fn*=-1,Mr=x4t);let _i=we.some(b4t);ae=[];for(let oi=gt;Mr(oi,Ve);oi+=fn){let di;if(re)di=String.fromCharCode(oi),di==="\\"&&(di="");else if(di=String(oi),_i){let Ba=qe-di.length;if(Ba>0){let Ti=new Array(Ba+1).join("0");oi<0?di="-"+Ti+di.slice(1):di=Ti+di}}ae.push(di)}}else{ae=[];for(let gt=0;gt<we.length;gt++)ae.push.apply(ae,CB(we[gt],l,!1))}for(let gt=0;gt<ae.length;gt++)for(let Ve=0;Ve<P.length&&b.length<l;Ve++){let qe=x+ae[gt]+P[Ve];(!g||_e||qe)&&b.push(qe)}}return b}var Kee=_=>{if(typeof _!="string")throw new TypeError("invalid pattern");if(_.length>65536)throw new TypeError("pattern is too long")},T4t={"[:alnum:]":["\\p{L}\\p{Nl}\\p{Nd}",!0],"[:alpha:]":["\\p{L}\\p{Nl}",!0],"[:ascii:]":["\\x00-\\x7f",!1],"[:blank:]":["\\p{Zs}\\t",!0],"[:cntrl:]":["\\p{Cc}",!0],"[:digit:]":["\\p{Nd}",!0],"[:graph:]":["\\p{Z}\\p{C}",!0,!0],"[:lower:]":["\\p{Ll}",!0],"[:print:]":["\\p{C}",!0],"[:punct:]":["\\p{P}",!0],"[:space:]":["\\p{Z}\\t\\r\\n\\v\\f",!0],"[:upper:]":["\\p{Lu}",!0],"[:word:]":["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}",!0],"[:xdigit:]":["A-Fa-f0-9",!1]},vB=_=>_.replace(/[[\]\\-]/g,"\\$&"),k4t=_=>_.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),UVe=_=>_.join(""),C4t=(_,l)=>{let g=l;if(_.charAt(g)!=="[")throw new Error("not in a brace expression");let b=[],p=[],x=g+1,P=!1,B=!1,re=!1,_e=!1,ge=g,we="";e:for(;x<_.length;){let Ve=_.charAt(x);if((Ve==="!"||Ve==="^")&&x===g+1){_e=!0,x++;continue}if(Ve==="]"&&P&&!re){ge=x+1;break}if(P=!0,Ve==="\\"&&!re){re=!0,x++;continue}if(Ve==="["&&!re){for(let[qe,[fn,Mr,_i]]of Object.entries(T4t))if(_.startsWith(qe,x)){if(we)return["$.",!1,_.length-g,!0];x+=qe.length,_i?p.push(fn):b.push(fn),B=B||Mr;continue e}}if(re=!1,we){Ve>we?b.push(vB(we)+"-"+vB(Ve)):Ve===we&&b.push(vB(Ve)),we="",x++;continue}if(_.startsWith("-]",x+1)){b.push(vB(Ve+"-")),x+=2;continue}if(_.startsWith("-",x+1)){we=Ve,x+=2;continue}b.push(vB(Ve)),x++}if(ge<x)return["",!1,0,!1];if(!b.length&&!p.length)return["$.",!1,_.length-g,!0];if(p.length===0&&b.length===1&&/^\\?.$/.test(b[0])&&!_e){let Ve=b[0].length===2?b[0].slice(-1):b[0];return[k4t(Ve),!1,ge-g,!1]}let ae="["+(_e?"^":"")+UVe(b)+"]",gt="["+(_e?"":"^")+UVe(p)+"]";return[b.length&&p.length?"("+ae+"|"+gt+")":b.length?ae:gt,B,ge-g,!0]},i5=(_,{windowsPathsNoEscape:l=!1,magicalBraces:g=!0}={})=>g?l?_.replace(/\[([^\/\\])\]/g,"$1"):_.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1"):l?_.replace(/\[([^\/\\{}])\]/g,"$1"):_.replace(/((?!\\).|^)\[([^\/\\{}])\]/g,"$1$2").replace(/\\([^\/{}])/g,"$1"),w4t=new Set(["!","?","+","*","@"]),WVe=_=>w4t.has(_),E4t="(?!(?:^|/)\\.\\.?(?:$|/))",Jee="(?!\\.)",D4t=new Set(["[","."]),P4t=new Set(["..","."]),I4t=new Set("().*{}+?[]^$\\!"),A4t=_=>_.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),YSe="[^/]",VVe=YSe+"*?",qVe=YSe+"+?",yqe=class gb{type;#e;#r;#i=!1;#t=[];#n;#m;#p;#c=!1;#o;#u;#_=!1;constructor(l,g,b={}){this.type=l,l&&(this.#r=!0),this.#n=g,this.#e=this.#n?this.#n.#e:this,this.#o=this.#e===this?b:this.#e.#o,this.#p=this.#e===this?[]:this.#e.#p,l==="!"&&!this.#e.#c&&this.#p.push(this),this.#m=this.#n?this.#n.#t.length:0}get hasMagic(){if(this.#r!==void 0)return this.#r;for(let l of this.#t)if(typeof l!="string"&&(l.type||l.hasMagic))return this.#r=!0;return this.#r}toString(){return this.#u!==void 0?this.#u:this.type?this.#u=this.type+"("+this.#t.map(l=>String(l)).join("|")+")":this.#u=this.#t.map(l=>String(l)).join("")}#l(){if(this!==this.#e)throw new Error("should only call on root");if(this.#c)return this;this.toString(),this.#c=!0;let l;for(;l=this.#p.pop();){if(l.type!=="!")continue;let g=l,b=g.#n;for(;b;){for(let p=g.#m+1;!b.type&&p<b.#t.length;p++)for(let x of l.#t){if(typeof x=="string")throw new Error("string part in extglob AST??");x.copyIn(b.#t[p])}g=b,b=g.#n}}return this}push(...l){for(let g of l)if(g!==""){if(typeof g!="string"&&!(g instanceof gb&&g.#n===this))throw new Error("invalid part: "+g);this.#t.push(g)}}toJSON(){var g;let l=this.type===null?this.#t.slice().map(b=>typeof b=="string"?b:b.toJSON()):[this.type,...this.#t.map(b=>b.toJSON())];return this.isStart()&&!this.type&&l.unshift([]),this.isEnd()&&(this===this.#e||this.#e.#c&&((g=this.#n)==null?void 0:g.type)==="!")&&l.push({}),l}isStart(){var g;if(this.#e===this)return!0;if(!((g=this.#n)!=null&&g.isStart()))return!1;if(this.#m===0)return!0;let l=this.#n;for(let b=0;b<this.#m;b++){let p=l.#t[b];if(!(p instanceof gb&&p.type==="!"))return!1}return!0}isEnd(){var g,b,p;if(this.#e===this||((g=this.#n)==null?void 0:g.type)==="!")return!0;if(!((b=this.#n)!=null&&b.isEnd()))return!1;if(!this.type)return(p=this.#n)==null?void 0:p.isEnd();let l=this.#n?this.#n.#t.length:0;return this.#m===l-1}copyIn(l){typeof l=="string"?this.push(l):this.push(l.clone(this))}clone(l){let g=new gb(this.type,l);for(let b of this.#t)g.copyIn(b);return g}static#a(l,g,b,p){let x=!1,P=!1,B=-1,re=!1;if(g.type===null){let gt=b,Ve="";for(;gt<l.length;){let qe=l.charAt(gt++);if(x||qe==="\\"){x=!x,Ve+=qe;continue}if(P){gt===B+1?(qe==="^"||qe==="!")&&(re=!0):qe==="]"&&!(gt===B+2&&re)&&(P=!1),Ve+=qe;continue}else if(qe==="["){P=!0,B=gt,re=!1,Ve+=qe;continue}if(!p.noext&&WVe(qe)&&l.charAt(gt)==="("){g.push(Ve),Ve="";let fn=new gb(qe,g);gt=gb.#a(l,fn,gt,p),g.push(fn);continue}Ve+=qe}return g.push(Ve),gt}let _e=b+1,ge=new gb(null,g),we=[],ae="";for(;_e<l.length;){let gt=l.charAt(_e++);if(x||gt==="\\"){x=!x,ae+=gt;continue}if(P){_e===B+1?(gt==="^"||gt==="!")&&(re=!0):gt==="]"&&!(_e===B+2&&re)&&(P=!1),ae+=gt;continue}else if(gt==="["){P=!0,B=_e,re=!1,ae+=gt;continue}if(WVe(gt)&&l.charAt(_e)==="("){ge.push(ae),ae="";let Ve=new gb(gt,ge);ge.push(Ve),_e=gb.#a(l,Ve,_e,p);continue}if(gt==="|"){ge.push(ae),ae="",we.push(ge),ge=new gb(null,g);continue}if(gt===")")return ae===""&&g.#t.length===0&&(g.#_=!0),ge.push(ae),ae="",g.push(...we,ge),_e;ae+=gt}return g.type=null,g.#r=void 0,g.#t=[l.substring(b-1)],_e}static fromGlob(l,g={}){let b=new gb(null,void 0,g);return gb.#a(l,b,0,g),b}toMMPattern(){if(this!==this.#e)return this.#e.toMMPattern();let l=this.toString(),[g,b,p,x]=this.toRegExpSource();if(!(p||this.#r||this.#o.nocase&&!this.#o.nocaseMagicOnly&&l.toUpperCase()!==l.toLowerCase()))return b;let P=(this.#o.nocase?"i":"")+(x?"u":"");return Object.assign(new RegExp(`^${g}$`,P),{_src:g,_glob:l})}get options(){return this.#o}toRegExpSource(l){var re;let g=l??!!this.#o.dot;if(this.#e===this&&this.#l(),!this.type){let _e=this.isStart()&&this.isEnd()&&!this.#t.some(gt=>typeof gt!="string"),ge=this.#t.map(gt=>{let[Ve,qe,fn,Mr]=typeof gt=="string"?gb.#S(gt,this.#r,_e):gt.toRegExpSource(l);return this.#r=this.#r||fn,this.#i=this.#i||Mr,Ve}).join(""),we="";if(this.isStart()&&typeof this.#t[0]=="string"&&!(this.#t.length===1&&P4t.has(this.#t[0]))){let gt=D4t,Ve=g&&gt.has(ge.charAt(0))||ge.startsWith("\\.")&&gt.has(ge.charAt(2))||ge.startsWith("\\.\\.")&&gt.has(ge.charAt(4)),qe=!g&&!l&&gt.has(ge.charAt(0));we=Ve?E4t:qe?Jee:""}let ae="";return this.isEnd()&&this.#e.#c&&((re=this.#n)==null?void 0:re.type)==="!"&&(ae="(?:$|\\/)"),[we+ge+ae,i5(ge),this.#r=!!this.#r,this.#i]}let b=this.type==="*"||this.type==="+",p=this.type==="!"?"(?:(?!(?:":"(?:",x=this.#g(g);if(this.isStart()&&this.isEnd()&&!x&&this.type!=="!"){let _e=this.toString();return this.#t=[_e],this.type=null,this.#r=void 0,[_e,i5(this.toString()),!1,!1]}let P=!b||l||g||!Jee?"":this.#g(!0);P===x&&(P=""),P&&(x=`(?:${x})(?:${P})*?`);let B="";if(this.type==="!"&&this.#_)B=(this.isStart()&&!g?Jee:"")+qVe;else{let _e=this.type==="!"?"))"+(this.isStart()&&!g&&!l?Jee:"")+VVe+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&P?")":this.type==="*"&&P?")?":`)${this.type}`;B=p+x+_e}return[B,i5(x),this.#r=!!this.#r,this.#i]}#g(l){return this.#t.map(g=>{if(typeof g=="string")throw new Error("string type in extglob ast??");let[b,p,x,P]=g.toRegExpSource(l);return this.#i=this.#i||P,b}).filter(g=>!(this.isStart()&&this.isEnd())||!!g).join("|")}static#S(l,g,b=!1){let p=!1,x="",P=!1,B=!1;for(let re=0;re<l.length;re++){let _e=l.charAt(re);if(p){p=!1,x+=(I4t.has(_e)?"\\":"")+_e;continue}if(_e==="*"){if(B)continue;B=!0,x+=b&&/^[*]+$/.test(l)?qVe:VVe,g=!0;continue}else B=!1;if(_e==="\\"){re===l.length-1?x+="\\\\":p=!0;continue}if(_e==="["){let[ge,we,ae,gt]=C4t(l,re);if(ae){x+=ge,P=P||we,re+=ae-1,g=g||gt;continue}}if(_e==="?"){x+=YSe,g=!0;continue}x+=A4t(_e)}return[x,i5(l),!!g,P]}},vqe=(_,{windowsPathsNoEscape:l=!1,magicalBraces:g=!1}={})=>g?l?_.replace(/[?*()[\]{}]/g,"[$&]"):_.replace(/[?*()[\]\\{}]/g,"\\$&"):l?_.replace(/[?*()[\]]/g,"[$&]"):_.replace(/[?*()[\]\\]/g,"\\$&"),P0=(_,l,g={})=>(Kee(l),!g.nocomment&&l.charAt(0)==="#"?!1:new bP(l,g).match(_)),N4t=/^\*+([^+@!?\*\[\(]*)$/,O4t=_=>l=>!l.startsWith(".")&&l.endsWith(_),F4t=_=>l=>l.endsWith(_),L4t=_=>(_=_.toLowerCase(),l=>!l.startsWith(".")&&l.toLowerCase().endsWith(_)),M4t=_=>(_=_.toLowerCase(),l=>l.toLowerCase().endsWith(_)),R4t=/^\*+\.\*+$/,j4t=_=>!_.startsWith(".")&&_.includes("."),$4t=_=>_!=="."&&_!==".."&&_.includes("."),z4t=/^\.\*+$/,B4t=_=>_!=="."&&_!==".."&&_.startsWith("."),J4t=/^\*+$/,U4t=_=>_.length!==0&&!_.startsWith("."),W4t=_=>_.length!==0&&_!=="."&&_!=="..",V4t=/^\?+([^+@!?\*\[\(]*)?$/,q4t=([_,l=""])=>{let g=bqe([_]);return l?(l=l.toLowerCase(),b=>g(b)&&b.toLowerCase().endsWith(l)):g},G4t=([_,l=""])=>{let g=Sqe([_]);return l?(l=l.toLowerCase(),b=>g(b)&&b.toLowerCase().endsWith(l)):g},H4t=([_,l=""])=>{let g=Sqe([_]);return l?b=>g(b)&&b.endsWith(l):g},Z4t=([_,l=""])=>{let g=bqe([_]);return l?b=>g(b)&&b.endsWith(l):g},bqe=([_])=>{let l=_.length;return g=>g.length===l&&!g.startsWith(".")},Sqe=([_])=>{let l=_.length;return g=>g.length===l&&g!=="."&&g!==".."},xqe=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",GVe={win32:{sep:"\\"},posix:{sep:"/"}},X4t=xqe==="win32"?GVe.win32.sep:GVe.posix.sep;P0.sep=X4t;var D0=Symbol("globstar **");P0.GLOBSTAR=D0;var Q4t="[^/]",K4t=Q4t+"*?",Y4t="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",eIt="(?:(?!(?:\\/|^)\\.).)*?",tIt=(_,l={})=>g=>P0(g,_,l);P0.filter=tIt;var e2=(_,l={})=>Object.assign({},_,l),rIt=_=>{if(!_||typeof _!="object"||!Object.keys(_).length)return P0;let l=P0;return Object.assign((g,b,p={})=>l(g,b,e2(_,p)),{Minimatch:class extends l.Minimatch{constructor(g,b={}){super(g,e2(_,b))}static defaults(g){return l.defaults(e2(_,g)).Minimatch}},AST:class extends l.AST{constructor(g,b,p={}){super(g,b,e2(_,p))}static fromGlob(g,b={}){return l.AST.fromGlob(g,e2(_,b))}},unescape:(g,b={})=>l.unescape(g,e2(_,b)),escape:(g,b={})=>l.escape(g,e2(_,b)),filter:(g,b={})=>l.filter(g,e2(_,b)),defaults:g=>l.defaults(e2(_,g)),makeRe:(g,b={})=>l.makeRe(g,e2(_,b)),braceExpand:(g,b={})=>l.braceExpand(g,e2(_,b)),match:(g,b,p={})=>l.match(g,b,e2(_,p)),sep:l.sep,GLOBSTAR:D0})};P0.defaults=rIt;var Tqe=(_,l={})=>(Kee(_),l.nobrace||!/\{(?:(?!\{).)*\}/.test(_)?[_]:y4t(_,{max:l.braceExpandMax}));P0.braceExpand=Tqe;var nIt=(_,l={})=>new bP(_,l).makeRe();P0.makeRe=nIt;var iIt=(_,l,g={})=>{let b=new bP(l,g);return _=_.filter(p=>b.match(p)),b.options.nonull&&!_.length&&_.push(l),_};P0.match=iIt;var HVe=/[?*]|[+@!]\(.*?\)|\[|\]/,sIt=_=>_.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),bP=class{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;regexp;constructor(_,l={}){Kee(_),l=l||{},this.options=l,this.pattern=_,this.platform=l.platform||xqe,this.isWindows=this.platform==="win32";let g="allowWindowsEscape";this.windowsPathsNoEscape=!!l.windowsPathsNoEscape||l[g]===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!l.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!l.nonegate,this.comment=!1,this.empty=!1,this.partial=!!l.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=l.windowsNoMagicRoot!==void 0?l.windowsNoMagicRoot:!!(this.isWindows&&this.nocase),this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let _ of this.set)for(let l of _)if(typeof l!="string")return!0;return!1}debug(..._){}make(){let _=this.pattern,l=this.options;if(!l.nocomment&&_.charAt(0)==="#"){this.comment=!0;return}if(!_){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],l.debug&&(this.debug=(...p)=>console.error(...p)),this.debug(this.pattern,this.globSet);let g=this.globSet.map(p=>this.slashSplit(p));this.globParts=this.preprocess(g),this.debug(this.pattern,this.globParts);let b=this.globParts.map((p,x,P)=>{if(this.isWindows&&this.windowsNoMagicRoot){let B=p[0]===""&&p[1]===""&&(p[2]==="?"||!HVe.test(p[2]))&&!HVe.test(p[3]),re=/^[a-z]:/i.test(p[0]);if(B)return[...p.slice(0,4),...p.slice(4).map(_e=>this.parse(_e))];if(re)return[p[0],...p.slice(1).map(_e=>this.parse(_e))]}return p.map(B=>this.parse(B))});if(this.debug(this.pattern,b),this.set=b.filter(p=>p.indexOf(!1)===-1),this.isWindows)for(let p=0;p<this.set.length;p++){let x=this.set[p];x[0]===""&&x[1]===""&&this.globParts[p][2]==="?"&&typeof x[3]=="string"&&/^[a-z]:$/i.test(x[3])&&(x[2]="?")}this.debug(this.pattern,this.set)}preprocess(_){if(this.options.noglobstar)for(let g=0;g<_.length;g++)for(let b=0;b<_[g].length;b++)_[g][b]==="**"&&(_[g][b]="*");let{optimizationLevel:l=1}=this.options;return l>=2?(_=this.firstPhasePreProcess(_),_=this.secondPhasePreProcess(_)):l>=1?_=this.levelOneOptimize(_):_=this.adjascentGlobstarOptimize(_),_}adjascentGlobstarOptimize(_){return _.map(l=>{let g=-1;for(;(g=l.indexOf("**",g+1))!==-1;){let b=g;for(;l[b+1]==="**";)b++;b!==g&&l.splice(g,b-g)}return l})}levelOneOptimize(_){return _.map(l=>(l=l.reduce((g,b)=>{let p=g[g.length-1];return b==="**"&&p==="**"?g:b===".."&&p&&p!==".."&&p!=="."&&p!=="**"?(g.pop(),g):(g.push(b),g)},[]),l.length===0?[""]:l))}levelTwoFileOptimize(_){Array.isArray(_)||(_=this.slashSplit(_));let l=!1;do{if(l=!1,!this.preserveMultipleSlashes){for(let b=1;b<_.length-1;b++){let p=_[b];b===1&&p===""&&_[0]===""||(p==="."||p==="")&&(l=!0,_.splice(b,1),b--)}_[0]==="."&&_.length===2&&(_[1]==="."||_[1]==="")&&(l=!0,_.pop())}let g=0;for(;(g=_.indexOf("..",g+1))!==-1;){let b=_[g-1];b&&b!=="."&&b!==".."&&b!=="**"&&(l=!0,_.splice(g-1,2),g-=2)}}while(l);return _.length===0?[""]:_}firstPhasePreProcess(_){let l=!1;do{l=!1;for(let g of _){let b=-1;for(;(b=g.indexOf("**",b+1))!==-1;){let x=b;for(;g[x+1]==="**";)x++;x>b&&g.splice(b+1,x-b);let P=g[b+1],B=g[b+2],re=g[b+3];if(P!==".."||!B||B==="."||B===".."||!re||re==="."||re==="..")continue;l=!0,g.splice(b,1);let _e=g.slice(0);_e[b]="**",_.push(_e),b--}if(!this.preserveMultipleSlashes){for(let x=1;x<g.length-1;x++){let P=g[x];x===1&&P===""&&g[0]===""||(P==="."||P==="")&&(l=!0,g.splice(x,1),x--)}g[0]==="."&&g.length===2&&(g[1]==="."||g[1]==="")&&(l=!0,g.pop())}let p=0;for(;(p=g.indexOf("..",p+1))!==-1;){let x=g[p-1];if(x&&x!=="."&&x!==".."&&x!=="**"){l=!0;let P=p===1&&g[p+1]==="**"?["."]:[];g.splice(p-1,2,...P),g.length===0&&g.push(""),p-=2}}}}while(l);return _}secondPhasePreProcess(_){for(let l=0;l<_.length-1;l++)for(let g=l+1;g<_.length;g++){let b=this.partsMatch(_[l],_[g],!this.preserveMultipleSlashes);if(b){_[l]=[],_[g]=b;break}}return _.filter(l=>l.length)}partsMatch(_,l,g=!1){let b=0,p=0,x=[],P="";for(;b<_.length&&p<l.length;)if(_[b]===l[p])x.push(P==="b"?l[p]:_[b]),b++,p++;else if(g&&_[b]==="**"&&l[p]===_[b+1])x.push(_[b]),b++;else if(g&&l[p]==="**"&&_[b]===l[p+1])x.push(l[p]),p++;else if(_[b]==="*"&&l[p]&&(this.options.dot||!l[p].startsWith("."))&&l[p]!=="**"){if(P==="b")return!1;P="a",x.push(_[b]),b++,p++}else if(l[p]==="*"&&_[b]&&(this.options.dot||!_[b].startsWith("."))&&_[b]!=="**"){if(P==="a")return!1;P="b",x.push(l[p]),b++,p++}else return!1;return _.length===l.length&&x}parseNegate(){if(this.nonegate)return;let _=this.pattern,l=!1,g=0;for(let b=0;b<_.length&&_.charAt(b)==="!";b++)l=!l,g++;g&&(this.pattern=_.slice(g)),this.negate=l}matchOne(_,l,g=!1){let b=this.options;if(this.isWindows){let Ve=typeof _[0]=="string"&&/^[a-z]:$/i.test(_[0]),qe=!Ve&&_[0]===""&&_[1]===""&&_[2]==="?"&&/^[a-z]:$/i.test(_[3]),fn=typeof l[0]=="string"&&/^[a-z]:$/i.test(l[0]),Mr=!fn&&l[0]===""&&l[1]===""&&l[2]==="?"&&typeof l[3]=="string"&&/^[a-z]:$/i.test(l[3]),_i=qe?3:Ve?0:void 0,oi=Mr?3:fn?0:void 0;if(typeof _i=="number"&&typeof oi=="number"){let[di,Ba]=[_[_i],l[oi]];di.toLowerCase()===Ba.toLowerCase()&&(l[oi]=di,oi>_i?l=l.slice(oi):_i>oi&&(_=_.slice(_i)))}}let{optimizationLevel:p=1}=this.options;p>=2&&(_=this.levelTwoFileOptimize(_)),this.debug("matchOne",this,{file:_,pattern:l}),this.debug("matchOne",_.length,l.length);for(var x=0,P=0,B=_.length,re=l.length;x<B&&P<re;x++,P++){this.debug("matchOne loop");var _e=l[P],ge=_[x];if(this.debug(l,_e,ge),_e===!1)return!1;if(_e===D0){this.debug("GLOBSTAR",[l,_e,ge]);var we=x,ae=P+1;if(ae===re){for(this.debug("** at the end");x<B;x++)if(_[x]==="."||_[x]===".."||!b.dot&&_[x].charAt(0)===".")return!1;return!0}for(;we<B;){var gt=_[we];if(this.debug(`
459
+ `+D.stack)}finally{this.performanceData=y}}parseMessage(t){return JSON.parse(t)}toStringMessage(t){return t}getFormatOptions(t){return this.projectService.getFormatCodeOptions(t)}getPreferences(t){return this.projectService.getPreferences(t)}getHostFormatOptions(){return this.projectService.getHostFormatCodeOptions()}getHostPreferences(){return this.projectService.getHostPreferences()}};function Pje(e){let t=e.diagnosticsDuration&&zs(e.diagnosticsDuration,([n,i])=>({...i,file:n}));return{...e,diagnosticsDuration:t}}function Mg(e,t){return{start:t.positionToLineOffset(e.start),end:t.positionToLineOffset(Jc(e))}}function M0e(e,t,n){let i=Mg(e,n),s=t&&Mg(t,n);return s?{...i,contextStart:s.start,contextEnd:s.end}:i}function Jvt(e,t){return{start:Ije(t,e.span.start),end:Ije(t,Jc(e.span)),newText:e.newText}}function Ije(e,t){return P0e(e)?Wvt(e.getLineAndCharacterOfPosition(t)):e.positionToLineOffset(t)}function Uvt(e,t){let n=e.ranges.map(i=>({start:t.positionToLineOffset(i.start),end:t.positionToLineOffset(i.start+i.length)}));return e.wordPattern?{ranges:n,wordPattern:e.wordPattern}:{ranges:n}}function Wvt(e){return{line:e.line+1,offset:e.character+1}}function Vvt(e){O.assert(e.textChanges.length===1);let t=qn(e.textChanges);return O.assert(t.span.start===0&&t.span.length===0),{fileName:e.fileName,textChanges:[{start:{line:0,offset:0},end:{line:0,offset:0},newText:t.newText}]}}function R0e(e,t,n,i){let s=qvt(e,t,i),{line:o,character:c}=GE(hC(s),n);return{line:o+1,offset:c+1}}function qvt(e,t,n){for(let{fileName:i,textChanges:s}of n)if(i===t)for(let o=s.length-1;o>=0;o--){let{newText:c,span:{start:d,length:f}}=s[o];e=e.slice(0,d)+c+e.slice(d+f)}return e}function Aje(e,{fileName:t,textSpan:n,contextSpan:i,isWriteAccess:s,isDefinition:o},{disableLineTextInReferences:c}){let d=O.checkDefined(e.getScriptInfo(t)),f=M0e(n,i,d),S=c?void 0:Gvt(d,f);return{file:t,...f,lineText:S,isWriteAccess:s,isDefinition:o}}function Gvt(e,t){let n=e.lineToTextSpan(t.start.line-1);return e.getSnapshot().getText(n.start,Jc(n)).replace(/\r|\n/g,"")}function Hvt(e){return e===void 0||e&&typeof e=="object"&&typeof e.exportName=="string"&&(e.fileName===void 0||typeof e.fileName=="string")&&(e.ambientModuleName===void 0||typeof e.ambientModuleName=="string"&&(e.isPackageJsonImport===void 0||typeof e.isPackageJsonImport=="boolean"))}var OD=4,j0e=(e=>(e[e.PreStart=0]="PreStart",e[e.Start=1]="Start",e[e.Entire=2]="Entire",e[e.Mid=3]="Mid",e[e.End=4]="End",e[e.PostEnd=5]="PostEnd",e))(j0e||{}),Zvt=class{constructor(){this.goSubtree=!0,this.lineIndex=new KO,this.endBranch=[],this.state=2,this.initialText="",this.trailingText="",this.lineIndex.root=new FD,this.startPath=[this.lineIndex.root],this.stack=[this.lineIndex.root]}get done(){return!1}insertLines(e,t){t&&(this.trailingText=""),e?e=this.initialText+e+this.trailingText:e=this.initialText+this.trailingText;let i=KO.linesFromText(e).lines;i.length>1&&i[i.length-1]===""&&i.pop();let s,o;for(let d=this.endBranch.length-1;d>=0;d--)this.endBranch[d].updateCounts(),this.endBranch[d].charCount()===0&&(o=this.endBranch[d],d>0?s=this.endBranch[d-1]:s=this.branchNode);o&&s.remove(o);let c=this.startPath[this.startPath.length-1];if(i.length>0)if(c.text=i[0],i.length>1){let d=new Array(i.length-1),f=c;for(let T=1;T<i.length;T++)d[T-1]=new J$(i[T]);let S=this.startPath.length-2;for(;S>=0;){let T=this.startPath[S];d=T.insertAt(f,d),S--,f=T}let y=d.length;for(;y>0;){let T=new FD;T.add(this.lineIndex.root),d=T.insertAt(this.lineIndex.root,d),y=d.length,this.lineIndex.root=T}this.lineIndex.root.updateCounts()}else for(let d=this.startPath.length-2;d>=0;d--)this.startPath[d].updateCounts();else{this.startPath[this.startPath.length-2].remove(c);for(let f=this.startPath.length-2;f>=0;f--)this.startPath[f].updateCounts()}return this.lineIndex}post(e,t,n){n===this.lineCollectionAtBranch&&(this.state=4),this.stack.pop()}pre(e,t,n,i,s){let o=this.stack[this.stack.length-1];this.state===2&&s===1&&(this.state=1,this.branchNode=o,this.lineCollectionAtBranch=n);let c;function d(f){return f.isLeaf()?new J$(""):new FD}switch(s){case 0:this.goSubtree=!1,this.state!==4&&o.add(n);break;case 1:this.state===4?this.goSubtree=!1:(c=d(n),o.add(c),this.startPath.push(c));break;case 2:this.state!==4?(c=d(n),o.add(c),this.startPath.push(c)):n.isLeaf()||(c=d(n),o.add(c),this.endBranch.push(c));break;case 3:this.goSubtree=!1;break;case 4:this.state!==4?this.goSubtree=!1:n.isLeaf()||(c=d(n),o.add(c),this.endBranch.push(c));break;case 5:this.goSubtree=!1,this.state!==1&&o.add(n);break}this.goSubtree&&this.stack.push(c)}leaf(e,t,n){this.state===1?this.initialText=n.text.substring(0,e):this.state===2?(this.initialText=n.text.substring(0,e),this.trailingText=n.text.substring(e+t)):this.trailingText=n.text.substring(e+t)}},Xvt=class{constructor(e,t,n){this.pos=e,this.deleteLen=t,this.insertedText=n}getTextChangeRange(){return _3(Ju(this.pos,this.deleteLen),this.insertedText?this.insertedText.length:0)}},PK=class aC{constructor(){this.changes=[],this.versions=new Array(aC.maxVersions),this.minVersion=0,this.currentVersion=0}versionToIndex(t){if(!(t<this.minVersion||t>this.currentVersion))return t%aC.maxVersions}currentVersionToIndex(){return this.currentVersion%aC.maxVersions}edit(t,n,i){this.changes.push(new Xvt(t,n,i)),(this.changes.length>aC.changeNumberThreshold||n>aC.changeLengthThreshold||i&&i.length>aC.changeLengthThreshold)&&this.getSnapshot()}getSnapshot(){return this._getSnapshot()}_getSnapshot(){let t=this.versions[this.currentVersionToIndex()];if(this.changes.length>0){let n=t.index;for(let i of this.changes)n=n.edit(i.pos,i.deleteLen,i.insertedText);t=new Nje(this.currentVersion+1,this,n,this.changes),this.currentVersion=t.version,this.versions[this.currentVersionToIndex()]=t,this.changes=[],this.currentVersion-this.minVersion>=aC.maxVersions&&(this.minVersion=this.currentVersion-aC.maxVersions+1)}return t}getSnapshotVersion(){return this._getSnapshot().version}getAbsolutePositionAndLineText(t){return this._getSnapshot().index.lineNumberToInfo(t)}lineOffsetToPosition(t,n){return this._getSnapshot().index.absolutePositionOfStartOfLine(t)+(n-1)}positionToLineOffset(t){return this._getSnapshot().index.positionToLineOffset(t)}lineToTextSpan(t){let n=this._getSnapshot().index,{lineText:i,absolutePosition:s}=n.lineNumberToInfo(t+1),o=i!==void 0?i.length:n.absolutePositionOfStartOfLine(t+2)-s;return Ju(s,o)}getTextChangesBetweenVersions(t,n){if(t<n)if(t>=this.minVersion){let i=[];for(let s=t+1;s<=n;s++){let o=this.versions[this.versionToIndex(s)];for(let c of o.changesSincePreviousVersion)i.push(c.getTextChangeRange())}return Sse(i)}else return;else return m9}getLineCount(){return this._getSnapshot().index.getLineCount()}static fromString(t){let n=new aC,i=new Nje(0,n,new KO);n.versions[n.currentVersion]=i;let s=KO.linesFromText(t);return i.index.load(s.lines),n}};PK.changeNumberThreshold=8,PK.changeLengthThreshold=256,PK.maxVersions=8;var IK=PK,Nje=class aKe{constructor(t,n,i,s=lu){this.version=t,this.cache=n,this.index=i,this.changesSincePreviousVersion=s}getText(t,n){return this.index.getText(t,n-t)}getLength(){return this.index.getLength()}getChangeRange(t){if(t instanceof aKe&&this.cache===t.cache)return this.version<=t.version?m9:this.cache.getTextChangesBetweenVersions(t.version,this.version)}},KO=class oEe{constructor(){this.checkEdits=!1}absolutePositionOfStartOfLine(t){return this.lineNumberToInfo(t).absolutePosition}positionToLineOffset(t){let{oneBasedLine:n,zeroBasedColumn:i}=this.root.charOffsetToLineInfo(1,t);return{line:n,offset:i+1}}positionToColumnAndLineText(t){return this.root.charOffsetToLineInfo(1,t)}getLineCount(){return this.root.lineCount()}lineNumberToInfo(t){let n=this.getLineCount();if(t<=n){let{position:i,leaf:s}=this.root.lineNumberToInfo(t,0);return{absolutePosition:i,lineText:s&&s.text}}else return{absolutePosition:this.root.charCount(),lineText:void 0}}load(t){if(t.length>0){let n=[];for(let i=0;i<t.length;i++)n[i]=new J$(t[i]);this.root=oEe.buildTreeFromBottom(n)}else this.root=new FD}walk(t,n,i){this.root.walk(t,n,i)}getText(t,n){let i="";return n>0&&t<this.root.charCount()&&this.walk(t,n,{goSubtree:!0,done:!1,leaf:(s,o,c)=>{i=i.concat(c.text.substring(s,s+o))}}),i}getLength(){return this.root.charCount()}every(t,n,i){i||(i=this.root.charCount());let s={goSubtree:!0,done:!1,leaf(o,c,d){t(d,o,c)||(this.done=!0)}};return this.walk(n,i-n,s),!s.done}edit(t,n,i){if(this.root.charCount()===0)return O.assert(n===0),i!==void 0?(this.load(oEe.linesFromText(i).lines),this):void 0;{let s;if(this.checkEdits){let d=this.getText(0,this.root.charCount());s=d.slice(0,t)+i+d.slice(t+n)}let o=new Zvt,c=!1;if(t>=this.root.charCount()){t=this.root.charCount()-1;let d=this.getText(t,1);i?i=d+i:i=d,n=0,c=!0}else if(n>0){let d=t+n,{zeroBasedColumn:f,lineText:S}=this.positionToColumnAndLineText(d);f===0&&(n+=S.length,i=i?i+S:S)}if(this.root.walk(t,n,o),o.insertLines(i,c),this.checkEdits){let d=o.lineIndex.getText(0,o.lineIndex.getLength());O.assert(s===d,"buffer edit mismatch")}return o.lineIndex}}static buildTreeFromBottom(t){if(t.length<OD)return new FD(t);let n=new Array(Math.ceil(t.length/OD)),i=0;for(let s=0;s<n.length;s++){let o=Math.min(i+OD,t.length);n[s]=new FD(t.slice(i,o)),i=o}return this.buildTreeFromBottom(n)}static linesFromText(t){let n=hC(t);if(n.length===0)return{lines:[],lineMap:n};let i=new Array(n.length),s=n.length-1;for(let c=0;c<s;c++)i[c]=t.substring(n[c],n[c+1]);let o=t.substring(n[s]);return o.length>0?i[s]=o:i.pop(),{lines:i,lineMap:n}}},FD=class cEe{constructor(t=[]){this.children=t,this.totalChars=0,this.totalLines=0,t.length&&this.updateCounts()}isLeaf(){return!1}updateCounts(){this.totalChars=0,this.totalLines=0;for(let t of this.children)this.totalChars+=t.charCount(),this.totalLines+=t.lineCount()}execWalk(t,n,i,s,o){return i.pre&&i.pre(t,n,this.children[s],this,o),i.goSubtree?(this.children[s].walk(t,n,i),i.post&&i.post(t,n,this.children[s],this,o)):i.goSubtree=!0,i.done}skipChild(t,n,i,s,o){s.pre&&!s.done&&(s.pre(t,n,this.children[i],this,o),s.goSubtree=!0)}walk(t,n,i){if(this.children.length===0)return;let s=0,o=this.children[s].charCount(),c=t;for(;c>=o;)this.skipChild(c,n,s,i,0),c-=o,s++,o=this.children[s].charCount();if(c+n<=o){if(this.execWalk(c,n,i,s,2))return}else{if(this.execWalk(c,o-c,i,s,1))return;let d=n-(o-c);for(s++,o=this.children[s].charCount();d>o;){if(this.execWalk(0,o,i,s,3))return;d-=o,s++,o=this.children[s].charCount()}if(d>0&&this.execWalk(0,d,i,s,4))return}if(i.pre){let d=this.children.length;if(s<d-1)for(let f=s+1;f<d;f++)this.skipChild(0,0,f,i,5)}}charOffsetToLineInfo(t,n){if(this.children.length===0)return{oneBasedLine:t,zeroBasedColumn:n,lineText:void 0};for(let o of this.children){if(o.charCount()>n)return o.isLeaf()?{oneBasedLine:t,zeroBasedColumn:n,lineText:o.text}:o.charOffsetToLineInfo(t,n);n-=o.charCount(),t+=o.lineCount()}let i=this.lineCount();if(i===0)return{oneBasedLine:1,zeroBasedColumn:0,lineText:void 0};let s=O.checkDefined(this.lineNumberToInfo(i,0).leaf);return{oneBasedLine:i,zeroBasedColumn:s.charCount(),lineText:void 0}}lineNumberToInfo(t,n){for(let i of this.children){let s=i.lineCount();if(s>=t)return i.isLeaf()?{position:n,leaf:i}:i.lineNumberToInfo(t,n);t-=s,n+=i.charCount()}return{position:n,leaf:void 0}}splitAfter(t){let n,i=this.children.length;t++;let s=t;if(t<i){for(n=new cEe;t<i;)n.add(this.children[t]),t++;n.updateCounts()}return this.children.length=s,n}remove(t){let n=this.findChildIndex(t),i=this.children.length;if(n<i-1)for(let s=n;s<i-1;s++)this.children[s]=this.children[s+1];this.children.pop()}findChildIndex(t){let n=this.children.indexOf(t);return O.assert(n!==-1),n}insertAt(t,n){let i=this.findChildIndex(t),s=this.children.length,o=n.length;if(s<OD&&i===s-1&&o===1)return this.add(n[0]),this.updateCounts(),[];{let c=this.splitAfter(i),d=0;for(i++;i<OD&&d<o;)this.children[i]=n[d],i++,d++;let f=[],S=0;if(d<o){S=Math.ceil((o-d)/OD),f=new Array(S);let y=0;for(let E=0;E<S;E++)f[E]=new cEe;let T=f[0];for(;d<o;)T.add(n[d]),d++,T.children.length===OD&&(y++,T=f[y]);for(let E=f.length-1;E>=0;E--)f[E].children.length===0&&f.pop()}c&&f.push(c),this.updateCounts();for(let y=0;y<S;y++)f[y].updateCounts();return f}}add(t){this.children.push(t),O.assert(this.children.length<=OD)}charCount(){return this.totalChars}lineCount(){return this.totalLines}},J$=class{constructor(e){this.text=e}isLeaf(){return!0}walk(e,t,n){n.leaf(e,t,this)}charCount(){return this.text.length}lineCount(){return 1}},Oje=class oKe{constructor(t,n,i,s,o,c){this.telemetryEnabled=t,this.logger=n,this.host=i,this.globalTypingsCacheLocation=s,this.event=o,this.maxActiveRequestCount=c,this.activeRequestCount=0,this.requestQueue=ZN(),this.requestMap=new Map,this.requestedRegistry=!1,this.packageInstallId=0}isKnownTypesPackageName(t){var n;return O1.validatePackageName(t)!==O1.NameValidationResult.Ok?!1:(this.requestedRegistry||(this.requestedRegistry=!0,this.installer.send({kind:"typesRegistry"})),!!((n=this.typesRegistryCache)!=null&&n.has(t)))}installPackage(t){this.packageInstallId++;let n={kind:"installPackage",...t,id:this.packageInstallId},i=new Promise((s,o)=>{(this.packageInstalledPromise??(this.packageInstalledPromise=new Map)).set(this.packageInstallId,{resolve:s,reject:o})});return this.installer.send(n),i}attach(t){this.projectService=t,this.installer=this.createInstallerProcess()}onProjectClosed(t){this.installer.send({projectName:t.getProjectName(),kind:"closeProject"})}enqueueInstallTypingsRequest(t,n,i){let s=Vye(t,n,i);this.logger.hasLevel(3)&&this.logger.info(`TIAdapter:: Scheduling throttled operation:${nS(s)}`),this.activeRequestCount<this.maxActiveRequestCount?this.scheduleRequest(s):(this.logger.hasLevel(3)&&this.logger.info(`TIAdapter:: Deferring request for: ${s.projectName}`),this.requestQueue.enqueue(s),this.requestMap.set(s.projectName,s))}handleMessage(t){var n,i;switch(this.logger.hasLevel(3)&&this.logger.info(`TIAdapter:: Received response:${nS(t)}`),t.kind){case eZ:this.typesRegistryCache=new Map(Object.entries(t.typesRegistry));break;case oj:{let s=(n=this.packageInstalledPromise)==null?void 0:n.get(t.id);O.assertIsDefined(s,"Should find the promise for package install"),(i=this.packageInstalledPromise)==null||i.delete(t.id),t.success?s.resolve({successMessage:t.message}):s.reject(t.message),this.projectService.updateTypingsForProject(t),this.event(t,"setTypings");break}case Qfe:{let s={message:t.message};this.event(s,"typesInstallerInitializationFailed");break}case tZ:{let s={eventId:t.eventId,packages:t.packagesToInstall};this.event(s,"beginInstallTypes");break}case rZ:{if(this.telemetryEnabled){let c={telemetryEventName:"typingsInstalled",payload:{installedPackages:t.packagesToInstall.join(","),installSuccess:t.installSuccess,typingsInstallerVersion:t.typingsInstallerVersion}};this.event(c,"telemetry")}let s={eventId:t.eventId,packages:t.packagesToInstall,success:t.installSuccess};this.event(s,"endInstallTypes");break}case aj:{this.projectService.updateTypingsForProject(t);break}case sj:{for(this.activeRequestCount>0?this.activeRequestCount--:O.fail("TIAdapter:: Received too many responses");!this.requestQueue.isEmpty();){let s=this.requestQueue.dequeue();if(this.requestMap.get(s.projectName)===s){this.requestMap.delete(s.projectName),this.scheduleRequest(s);break}this.logger.hasLevel(3)&&this.logger.info(`TIAdapter:: Skipping defunct request for: ${s.projectName}`)}this.projectService.updateTypingsForProject(t),this.event(t,"setTypings");break}case G7:this.projectService.watchTypingLocations(t);break;default:}}scheduleRequest(t){this.logger.hasLevel(3)&&this.logger.info(`TIAdapter:: Scheduling request for: ${t.projectName}`),this.activeRequestCount++,this.host.setTimeout(()=>{this.logger.hasLevel(3)&&this.logger.info(`TIAdapter:: Sending request:${nS(t)}`),this.installer.send(t)},oKe.requestDelayMillis,`${t.projectName}::${t.kind}`)}};Oje.requestDelayMillis=100;var Fje=Oje,Lje={};x(Lje,{ActionInvalidate:()=>aj,ActionPackageInstalled:()=>oj,ActionSet:()=>sj,ActionWatchTypingLocations:()=>G7,Arguments:()=>nZ,AutoImportProviderProject:()=>f0e,AuxiliaryProject:()=>u0e,CharRangeSection:()=>j0e,CloseFileWatcherEvent:()=>yK,CommandNames:()=>bje,ConfigFileDiagEvent:()=>pK,ConfiguredProject:()=>p0e,ConfiguredProjectLoadKind:()=>v0e,CreateDirectoryWatcherEvent:()=>hK,CreateFileWatcherEvent:()=>gK,Errors:()=>t0,EventBeginInstallTypes:()=>tZ,EventEndInstallTypes:()=>rZ,EventInitializationFailed:()=>Qfe,EventTypesRegistry:()=>eZ,ExternalProject:()=>oK,GcTimer:()=>Kye,InferredProject:()=>l0e,LargeFileReferencedEvent:()=>fK,LineIndex:()=>KO,LineLeaf:()=>J$,LineNode:()=>FD,LogLevel:()=>Uye,Msg:()=>Wye,OpenFileInfoTelemetryEvent:()=>d0e,Project:()=>zw,ProjectInfoTelemetryEvent:()=>mK,ProjectKind:()=>EA,ProjectLanguageServiceStateEvent:()=>dK,ProjectLoadingFinishEvent:()=>_K,ProjectLoadingStartEvent:()=>uK,ProjectService:()=>D0e,ProjectsUpdatedInBackgroundEvent:()=>$$,ScriptInfo:()=>r0e,ScriptVersionCache:()=>IK,Session:()=>Dje,TextStorage:()=>t0e,ThrottledOperations:()=>Qye,TypingsInstallerAdapter:()=>Fje,allFilesAreJsOrDts:()=>a0e,allRootFilesAreJsOrDts:()=>s0e,asNormalizedPath:()=>qRe,convertCompilerOptions:()=>z$,convertFormatOptions:()=>AD,convertScriptKindName:()=>bK,convertTypeAcquisition:()=>g0e,convertUserPreferences:()=>h0e,convertWatchOptions:()=>XO,countEachFileTypes:()=>qO,createInstallTypingsRequest:()=>Vye,createModuleSpecifierCache:()=>A0e,createNormalizedPathMap:()=>GRe,createPackageJsonCache:()=>N0e,createSortedArray:()=>Xye,emptyArray:()=>lu,findArgument:()=>GAe,formatDiagnosticToProtocol:()=>QO,formatMessage:()=>O0e,getBaseConfigFileName:()=>aK,getDetailWatchInfo:()=>kK,getLocationInNewDocument:()=>R0e,hasArgument:()=>qAe,hasNoTypeScriptSource:()=>o0e,indent:()=>KI,isBackgroundProject:()=>HO,isConfigFile:()=>P0e,isConfiguredProject:()=>ov,isDynamicFileName:()=>wA,isExternalProject:()=>GO,isInferredProject:()=>ID,isInferredProjectName:()=>qye,isProjectDeferredClose:()=>ZO,makeAutoImportProviderProjectName:()=>Hye,makeAuxiliaryProjectName:()=>Zye,makeInferredProjectName:()=>Gye,maxFileSize:()=>lK,maxProgramSizeForNonTsFiles:()=>cK,normalizedPathToPath:()=>PD,nowString:()=>HAe,nullCancellationToken:()=>hje,nullTypingsInstaller:()=>B$,protocol:()=>Yye,scriptInfoIsContainedByBackgroundProject:()=>n0e,scriptInfoIsContainedByDeferredClosedProject:()=>i0e,stringifyIndented:()=>nS,toEvent:()=>F0e,toNormalizedPath:()=>Wo,tryConvertScriptKindName:()=>vK,typingsInstaller:()=>Jye,updateProjectIfDirty:()=>Gd}),typeof console<"u"&&(O.loggingHost={log(e,t){switch(e){case 1:return console.error(t);case 2:return console.warn(t);case 3:return console.log(t);case 4:return console.log(t)}}})})({get exports(){return eKe},set exports(_){eKe=_,typeof hne<"u"&&hne.exports&&(hne.exports=_)}})});var DKe=Gk((zjt,yFt)=>{yFt.exports={name:"@fabriziosalmi/slopless",version:"1.4.3",description:"",main:"dist/index.js",bin:{slopless:"dist/index.js"},files:["dist","rules"],scripts:{test:"vitest run","test:watch":"vitest","test:coverage":"vitest run --coverage",build:"tsup","docs:dev":"npm run docs:gen && vitepress dev docs","docs:gen":"ts-node scripts/generate-rule-docs.ts","docs:build":"npm run docs:gen && vitepress build docs","docs:preview":"vitepress preview docs","verify:bundle":"node scripts/verify-bundle.js","verify:action":"bash scripts/run-action-locally.sh . 'src/**/*.ts'","release:prep":"npm run docs:gen && npm run build && npm test && npm run verify:bundle"},keywords:["linter","static-analysis","anti-vibecoding","sarif"],author:"Fabrizio Salmi",license:"MIT",repository:{type:"git",url:"git+https://github.com/fabriziosalmi/slopless.git"},homepage:"https://fabriziosalmi.github.io/slopless/",bugs:{url:"https://github.com/fabriziosalmi/slopless/issues"},type:"commonjs",devDependencies:{"@types/glob":"^8.1.0","@types/js-yaml":"^4.0.9","@types/node":"^25.3.0","@vitest/coverage-v8":"^4.0.18",commander:"^14.0.3",glob:"^13.0.6",ignore:"^7.0.5","js-yaml":"^4.1.1",minimatch:"^10.2.6","ts-node":"^10.9.2",tsup:"^8.5.1",typescript:"^5.9.3",vitepress:"^1.6.4",vitest:"^4.1.11",zod:"^4.3.6"},allowScripts:{esbuild:!0,fsevents:!0},publishConfig:{access:"public"}}});var CFt={};Hk(CFt,{applyIgnoreRules:()=>NKe,selectRules:()=>OKe});module.exports=JPt(CFt);var zVe=Z_($Ve(),1),{program:LFt,createCommand:MFt,createArgument:RFt,createOption:jFt,CommanderError:$Ft,InvalidArgumentError:zFt,InvalidOptionArgumentError:BFt,Command:BVe,Argument:JFt,Option:UFt,Help:WFt}=zVe.default;var kqe=require("url"),s5=require("path"),Pqe=require("url"),Qk=require("fs"),lIt=Z_(require("fs"),1),SP=require("fs/promises"),rte=require("events"),e2e=Z_(require("stream"),1),Iqe=require("string_decoder"),fqe=(_,l,g)=>{let b=_ instanceof RegExp?JVe(_,g):_,p=l instanceof RegExp?JVe(l,g):l,x=b!==null&&p!=null&&i4t(b,p,g);return x&&{start:x[0],end:x[1],pre:g.slice(0,x[0]),body:g.slice(x[0]+b.length,x[1]),post:g.slice(x[1]+p.length)}},JVe=(_,l)=>{let g=l.match(_);return g?g[0]:null},i4t=(_,l,g)=>{let b,p,x,P,B,re=g.indexOf(_),_e=g.indexOf(l,re+1),ge=re;if(re>=0&&_e>0){if(_===l)return[re,_e];for(b=[],x=g.length;ge>=0&&!B;){if(ge===re)b.push(ge),re=g.indexOf(_,ge+1);else if(b.length===1){let we=b.pop();we!==void 0&&(B=[we,_e])}else p=b.pop(),p!==void 0&&p<x&&(x=p,P=_e),_e=g.indexOf(l,ge+1);ge=re<_e&&re>=0?re:_e}b.length&&P!==void 0&&(B=[x,P])}return B},pqe="\0SLASH"+Math.random()+"\0",dqe="\0OPEN"+Math.random()+"\0",KSe="\0CLOSE"+Math.random()+"\0",mqe="\0COMMA"+Math.random()+"\0",gqe="\0PERIOD"+Math.random()+"\0",s4t=new RegExp(pqe,"g"),a4t=new RegExp(dqe,"g"),o4t=new RegExp(KSe,"g"),c4t=new RegExp(mqe,"g"),l4t=new RegExp(gqe,"g"),u4t=/\\\\/g,_4t=/\\{/g,f4t=/\\}/g,p4t=/\\,/g,d4t=/\\./g,m4t=1e5;function USe(_){return isNaN(_)?_.charCodeAt(0):parseInt(_,10)}function g4t(_){return _.replace(u4t,pqe).replace(_4t,dqe).replace(f4t,KSe).replace(p4t,mqe).replace(d4t,gqe)}function h4t(_){return _.replace(s4t,"\\").replace(a4t,"{").replace(o4t,"}").replace(c4t,",").replace(l4t,".")}function hqe(_){if(!_)return[""];let l=[],g=fqe("{","}",_);if(!g)return _.split(",");let{pre:b,body:p,post:x}=g,P=b.split(",");P[P.length-1]+="{"+p+"}";let B=hqe(x);return x.length&&(P[P.length-1]+=B.shift(),P.push.apply(P,B)),l.push.apply(l,P),l}function y4t(_,l={}){if(!_)return[];let{max:g=m4t}=l;return _.slice(0,2)==="{}"&&(_="\\{\\}"+_.slice(2)),CB(g4t(_),g,!0).map(h4t)}function v4t(_){return"{"+_+"}"}function b4t(_){return/^-?0\d/.test(_)}function S4t(_,l){return _<=l}function x4t(_,l){return _>=l}function CB(_,l,g){let b=[],p=fqe("{","}",_);if(!p)return[_];let x=p.pre,P=p.post.length?CB(p.post,l,!1):[""];if(/\$$/.test(p.pre))for(let B=0;B<P.length&&B<l;B++){let re=x+"{"+p.body+"}"+P[B];b.push(re)}else{let B=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(p.body),re=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(p.body),_e=B||re,ge=p.body.indexOf(",")>=0;if(!_e&&!ge)return p.post.match(/,(?!,).*\}/)?(_=p.pre+"{"+p.body+KSe+p.post,CB(_,l,!0)):[_];let we;if(_e)we=p.body.split(/\.\./);else if(we=hqe(p.body),we.length===1&&we[0]!==void 0&&(we=CB(we[0],l,!1).map(v4t),we.length===1))return P.map(gt=>p.pre+we[0]+gt);let ae;if(_e&&we[0]!==void 0&&we[1]!==void 0){let gt=USe(we[0]),Ve=USe(we[1]),qe=Math.max(we[0].length,we[1].length),fn=we.length===3&&we[2]!==void 0?Math.abs(USe(we[2])):1,Mr=S4t;Ve<gt&&(fn*=-1,Mr=x4t);let _i=we.some(b4t);ae=[];for(let oi=gt;Mr(oi,Ve);oi+=fn){let di;if(re)di=String.fromCharCode(oi),di==="\\"&&(di="");else if(di=String(oi),_i){let Ba=qe-di.length;if(Ba>0){let Ti=new Array(Ba+1).join("0");oi<0?di="-"+Ti+di.slice(1):di=Ti+di}}ae.push(di)}}else{ae=[];for(let gt=0;gt<we.length;gt++)ae.push.apply(ae,CB(we[gt],l,!1))}for(let gt=0;gt<ae.length;gt++)for(let Ve=0;Ve<P.length&&b.length<l;Ve++){let qe=x+ae[gt]+P[Ve];(!g||_e||qe)&&b.push(qe)}}return b}var Kee=_=>{if(typeof _!="string")throw new TypeError("invalid pattern");if(_.length>65536)throw new TypeError("pattern is too long")},T4t={"[:alnum:]":["\\p{L}\\p{Nl}\\p{Nd}",!0],"[:alpha:]":["\\p{L}\\p{Nl}",!0],"[:ascii:]":["\\x00-\\x7f",!1],"[:blank:]":["\\p{Zs}\\t",!0],"[:cntrl:]":["\\p{Cc}",!0],"[:digit:]":["\\p{Nd}",!0],"[:graph:]":["\\p{Z}\\p{C}",!0,!0],"[:lower:]":["\\p{Ll}",!0],"[:print:]":["\\p{C}",!0],"[:punct:]":["\\p{P}",!0],"[:space:]":["\\p{Z}\\t\\r\\n\\v\\f",!0],"[:upper:]":["\\p{Lu}",!0],"[:word:]":["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}",!0],"[:xdigit:]":["A-Fa-f0-9",!1]},vB=_=>_.replace(/[[\]\\-]/g,"\\$&"),k4t=_=>_.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),UVe=_=>_.join(""),C4t=(_,l)=>{let g=l;if(_.charAt(g)!=="[")throw new Error("not in a brace expression");let b=[],p=[],x=g+1,P=!1,B=!1,re=!1,_e=!1,ge=g,we="";e:for(;x<_.length;){let Ve=_.charAt(x);if((Ve==="!"||Ve==="^")&&x===g+1){_e=!0,x++;continue}if(Ve==="]"&&P&&!re){ge=x+1;break}if(P=!0,Ve==="\\"&&!re){re=!0,x++;continue}if(Ve==="["&&!re){for(let[qe,[fn,Mr,_i]]of Object.entries(T4t))if(_.startsWith(qe,x)){if(we)return["$.",!1,_.length-g,!0];x+=qe.length,_i?p.push(fn):b.push(fn),B=B||Mr;continue e}}if(re=!1,we){Ve>we?b.push(vB(we)+"-"+vB(Ve)):Ve===we&&b.push(vB(Ve)),we="",x++;continue}if(_.startsWith("-]",x+1)){b.push(vB(Ve+"-")),x+=2;continue}if(_.startsWith("-",x+1)){we=Ve,x+=2;continue}b.push(vB(Ve)),x++}if(ge<x)return["",!1,0,!1];if(!b.length&&!p.length)return["$.",!1,_.length-g,!0];if(p.length===0&&b.length===1&&/^\\?.$/.test(b[0])&&!_e){let Ve=b[0].length===2?b[0].slice(-1):b[0];return[k4t(Ve),!1,ge-g,!1]}let ae="["+(_e?"^":"")+UVe(b)+"]",gt="["+(_e?"":"^")+UVe(p)+"]";return[b.length&&p.length?"("+ae+"|"+gt+")":b.length?ae:gt,B,ge-g,!0]},i5=(_,{windowsPathsNoEscape:l=!1,magicalBraces:g=!0}={})=>g?l?_.replace(/\[([^\/\\])\]/g,"$1"):_.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1"):l?_.replace(/\[([^\/\\{}])\]/g,"$1"):_.replace(/((?!\\).|^)\[([^\/\\{}])\]/g,"$1$2").replace(/\\([^\/{}])/g,"$1"),w4t=new Set(["!","?","+","*","@"]),WVe=_=>w4t.has(_),E4t="(?!(?:^|/)\\.\\.?(?:$|/))",Jee="(?!\\.)",D4t=new Set(["[","."]),P4t=new Set(["..","."]),I4t=new Set("().*{}+?[]^$\\!"),A4t=_=>_.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),YSe="[^/]",VVe=YSe+"*?",qVe=YSe+"+?",yqe=class gb{type;#e;#r;#i=!1;#t=[];#n;#m;#p;#c=!1;#o;#u;#_=!1;constructor(l,g,b={}){this.type=l,l&&(this.#r=!0),this.#n=g,this.#e=this.#n?this.#n.#e:this,this.#o=this.#e===this?b:this.#e.#o,this.#p=this.#e===this?[]:this.#e.#p,l==="!"&&!this.#e.#c&&this.#p.push(this),this.#m=this.#n?this.#n.#t.length:0}get hasMagic(){if(this.#r!==void 0)return this.#r;for(let l of this.#t)if(typeof l!="string"&&(l.type||l.hasMagic))return this.#r=!0;return this.#r}toString(){return this.#u!==void 0?this.#u:this.type?this.#u=this.type+"("+this.#t.map(l=>String(l)).join("|")+")":this.#u=this.#t.map(l=>String(l)).join("")}#l(){if(this!==this.#e)throw new Error("should only call on root");if(this.#c)return this;this.toString(),this.#c=!0;let l;for(;l=this.#p.pop();){if(l.type!=="!")continue;let g=l,b=g.#n;for(;b;){for(let p=g.#m+1;!b.type&&p<b.#t.length;p++)for(let x of l.#t){if(typeof x=="string")throw new Error("string part in extglob AST??");x.copyIn(b.#t[p])}g=b,b=g.#n}}return this}push(...l){for(let g of l)if(g!==""){if(typeof g!="string"&&!(g instanceof gb&&g.#n===this))throw new Error("invalid part: "+g);this.#t.push(g)}}toJSON(){var g;let l=this.type===null?this.#t.slice().map(b=>typeof b=="string"?b:b.toJSON()):[this.type,...this.#t.map(b=>b.toJSON())];return this.isStart()&&!this.type&&l.unshift([]),this.isEnd()&&(this===this.#e||this.#e.#c&&((g=this.#n)==null?void 0:g.type)==="!")&&l.push({}),l}isStart(){var g;if(this.#e===this)return!0;if(!((g=this.#n)!=null&&g.isStart()))return!1;if(this.#m===0)return!0;let l=this.#n;for(let b=0;b<this.#m;b++){let p=l.#t[b];if(!(p instanceof gb&&p.type==="!"))return!1}return!0}isEnd(){var g,b,p;if(this.#e===this||((g=this.#n)==null?void 0:g.type)==="!")return!0;if(!((b=this.#n)!=null&&b.isEnd()))return!1;if(!this.type)return(p=this.#n)==null?void 0:p.isEnd();let l=this.#n?this.#n.#t.length:0;return this.#m===l-1}copyIn(l){typeof l=="string"?this.push(l):this.push(l.clone(this))}clone(l){let g=new gb(this.type,l);for(let b of this.#t)g.copyIn(b);return g}static#a(l,g,b,p){let x=!1,P=!1,B=-1,re=!1;if(g.type===null){let gt=b,Ve="";for(;gt<l.length;){let qe=l.charAt(gt++);if(x||qe==="\\"){x=!x,Ve+=qe;continue}if(P){gt===B+1?(qe==="^"||qe==="!")&&(re=!0):qe==="]"&&!(gt===B+2&&re)&&(P=!1),Ve+=qe;continue}else if(qe==="["){P=!0,B=gt,re=!1,Ve+=qe;continue}if(!p.noext&&WVe(qe)&&l.charAt(gt)==="("){g.push(Ve),Ve="";let fn=new gb(qe,g);gt=gb.#a(l,fn,gt,p),g.push(fn);continue}Ve+=qe}return g.push(Ve),gt}let _e=b+1,ge=new gb(null,g),we=[],ae="";for(;_e<l.length;){let gt=l.charAt(_e++);if(x||gt==="\\"){x=!x,ae+=gt;continue}if(P){_e===B+1?(gt==="^"||gt==="!")&&(re=!0):gt==="]"&&!(_e===B+2&&re)&&(P=!1),ae+=gt;continue}else if(gt==="["){P=!0,B=_e,re=!1,ae+=gt;continue}if(WVe(gt)&&l.charAt(_e)==="("){ge.push(ae),ae="";let Ve=new gb(gt,ge);ge.push(Ve),_e=gb.#a(l,Ve,_e,p);continue}if(gt==="|"){ge.push(ae),ae="",we.push(ge),ge=new gb(null,g);continue}if(gt===")")return ae===""&&g.#t.length===0&&(g.#_=!0),ge.push(ae),ae="",g.push(...we,ge),_e;ae+=gt}return g.type=null,g.#r=void 0,g.#t=[l.substring(b-1)],_e}static fromGlob(l,g={}){let b=new gb(null,void 0,g);return gb.#a(l,b,0,g),b}toMMPattern(){if(this!==this.#e)return this.#e.toMMPattern();let l=this.toString(),[g,b,p,x]=this.toRegExpSource();if(!(p||this.#r||this.#o.nocase&&!this.#o.nocaseMagicOnly&&l.toUpperCase()!==l.toLowerCase()))return b;let P=(this.#o.nocase?"i":"")+(x?"u":"");return Object.assign(new RegExp(`^${g}$`,P),{_src:g,_glob:l})}get options(){return this.#o}toRegExpSource(l){var re;let g=l??!!this.#o.dot;if(this.#e===this&&this.#l(),!this.type){let _e=this.isStart()&&this.isEnd()&&!this.#t.some(gt=>typeof gt!="string"),ge=this.#t.map(gt=>{let[Ve,qe,fn,Mr]=typeof gt=="string"?gb.#S(gt,this.#r,_e):gt.toRegExpSource(l);return this.#r=this.#r||fn,this.#i=this.#i||Mr,Ve}).join(""),we="";if(this.isStart()&&typeof this.#t[0]=="string"&&!(this.#t.length===1&&P4t.has(this.#t[0]))){let gt=D4t,Ve=g&&gt.has(ge.charAt(0))||ge.startsWith("\\.")&&gt.has(ge.charAt(2))||ge.startsWith("\\.\\.")&&gt.has(ge.charAt(4)),qe=!g&&!l&&gt.has(ge.charAt(0));we=Ve?E4t:qe?Jee:""}let ae="";return this.isEnd()&&this.#e.#c&&((re=this.#n)==null?void 0:re.type)==="!"&&(ae="(?:$|\\/)"),[we+ge+ae,i5(ge),this.#r=!!this.#r,this.#i]}let b=this.type==="*"||this.type==="+",p=this.type==="!"?"(?:(?!(?:":"(?:",x=this.#g(g);if(this.isStart()&&this.isEnd()&&!x&&this.type!=="!"){let _e=this.toString();return this.#t=[_e],this.type=null,this.#r=void 0,[_e,i5(this.toString()),!1,!1]}let P=!b||l||g||!Jee?"":this.#g(!0);P===x&&(P=""),P&&(x=`(?:${x})(?:${P})*?`);let B="";if(this.type==="!"&&this.#_)B=(this.isStart()&&!g?Jee:"")+qVe;else{let _e=this.type==="!"?"))"+(this.isStart()&&!g&&!l?Jee:"")+VVe+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&P?")":this.type==="*"&&P?")?":`)${this.type}`;B=p+x+_e}return[B,i5(x),this.#r=!!this.#r,this.#i]}#g(l){return this.#t.map(g=>{if(typeof g=="string")throw new Error("string type in extglob ast??");let[b,p,x,P]=g.toRegExpSource(l);return this.#i=this.#i||P,b}).filter(g=>!(this.isStart()&&this.isEnd())||!!g).join("|")}static#S(l,g,b=!1){let p=!1,x="",P=!1,B=!1;for(let re=0;re<l.length;re++){let _e=l.charAt(re);if(p){p=!1,x+=(I4t.has(_e)?"\\":"")+_e;continue}if(_e==="*"){if(B)continue;B=!0,x+=b&&/^[*]+$/.test(l)?qVe:VVe,g=!0;continue}else B=!1;if(_e==="\\"){re===l.length-1?x+="\\\\":p=!0;continue}if(_e==="["){let[ge,we,ae,gt]=C4t(l,re);if(ae){x+=ge,P=P||we,re+=ae-1,g=g||gt;continue}}if(_e==="?"){x+=YSe,g=!0;continue}x+=A4t(_e)}return[x,i5(l),!!g,P]}},vqe=(_,{windowsPathsNoEscape:l=!1,magicalBraces:g=!1}={})=>g?l?_.replace(/[?*()[\]{}]/g,"[$&]"):_.replace(/[?*()[\]\\{}]/g,"\\$&"):l?_.replace(/[?*()[\]]/g,"[$&]"):_.replace(/[?*()[\]\\]/g,"\\$&"),P0=(_,l,g={})=>(Kee(l),!g.nocomment&&l.charAt(0)==="#"?!1:new bP(l,g).match(_)),N4t=/^\*+([^+@!?\*\[\(]*)$/,O4t=_=>l=>!l.startsWith(".")&&l.endsWith(_),F4t=_=>l=>l.endsWith(_),L4t=_=>(_=_.toLowerCase(),l=>!l.startsWith(".")&&l.toLowerCase().endsWith(_)),M4t=_=>(_=_.toLowerCase(),l=>l.toLowerCase().endsWith(_)),R4t=/^\*+\.\*+$/,j4t=_=>!_.startsWith(".")&&_.includes("."),$4t=_=>_!=="."&&_!==".."&&_.includes("."),z4t=/^\.\*+$/,B4t=_=>_!=="."&&_!==".."&&_.startsWith("."),J4t=/^\*+$/,U4t=_=>_.length!==0&&!_.startsWith("."),W4t=_=>_.length!==0&&_!=="."&&_!=="..",V4t=/^\?+([^+@!?\*\[\(]*)?$/,q4t=([_,l=""])=>{let g=bqe([_]);return l?(l=l.toLowerCase(),b=>g(b)&&b.toLowerCase().endsWith(l)):g},G4t=([_,l=""])=>{let g=Sqe([_]);return l?(l=l.toLowerCase(),b=>g(b)&&b.toLowerCase().endsWith(l)):g},H4t=([_,l=""])=>{let g=Sqe([_]);return l?b=>g(b)&&b.endsWith(l):g},Z4t=([_,l=""])=>{let g=bqe([_]);return l?b=>g(b)&&b.endsWith(l):g},bqe=([_])=>{let l=_.length;return g=>g.length===l&&!g.startsWith(".")},Sqe=([_])=>{let l=_.length;return g=>g.length===l&&g!=="."&&g!==".."},xqe=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",GVe={win32:{sep:"\\"},posix:{sep:"/"}},X4t=xqe==="win32"?GVe.win32.sep:GVe.posix.sep;P0.sep=X4t;var D0=Symbol("globstar **");P0.GLOBSTAR=D0;var Q4t="[^/]",K4t=Q4t+"*?",Y4t="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",eIt="(?:(?!(?:\\/|^)\\.).)*?",tIt=(_,l={})=>g=>P0(g,_,l);P0.filter=tIt;var e2=(_,l={})=>Object.assign({},_,l),rIt=_=>{if(!_||typeof _!="object"||!Object.keys(_).length)return P0;let l=P0;return Object.assign((g,b,p={})=>l(g,b,e2(_,p)),{Minimatch:class extends l.Minimatch{constructor(g,b={}){super(g,e2(_,b))}static defaults(g){return l.defaults(e2(_,g)).Minimatch}},AST:class extends l.AST{constructor(g,b,p={}){super(g,b,e2(_,p))}static fromGlob(g,b={}){return l.AST.fromGlob(g,e2(_,b))}},unescape:(g,b={})=>l.unescape(g,e2(_,b)),escape:(g,b={})=>l.escape(g,e2(_,b)),filter:(g,b={})=>l.filter(g,e2(_,b)),defaults:g=>l.defaults(e2(_,g)),makeRe:(g,b={})=>l.makeRe(g,e2(_,b)),braceExpand:(g,b={})=>l.braceExpand(g,e2(_,b)),match:(g,b,p={})=>l.match(g,b,e2(_,p)),sep:l.sep,GLOBSTAR:D0})};P0.defaults=rIt;var Tqe=(_,l={})=>(Kee(_),l.nobrace||!/\{(?:(?!\{).)*\}/.test(_)?[_]:y4t(_,{max:l.braceExpandMax}));P0.braceExpand=Tqe;var nIt=(_,l={})=>new bP(_,l).makeRe();P0.makeRe=nIt;var iIt=(_,l,g={})=>{let b=new bP(l,g);return _=_.filter(p=>b.match(p)),b.options.nonull&&!_.length&&_.push(l),_};P0.match=iIt;var HVe=/[?*]|[+@!]\(.*?\)|\[|\]/,sIt=_=>_.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),bP=class{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;regexp;constructor(_,l={}){Kee(_),l=l||{},this.options=l,this.pattern=_,this.platform=l.platform||xqe,this.isWindows=this.platform==="win32";let g="allowWindowsEscape";this.windowsPathsNoEscape=!!l.windowsPathsNoEscape||l[g]===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!l.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!l.nonegate,this.comment=!1,this.empty=!1,this.partial=!!l.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=l.windowsNoMagicRoot!==void 0?l.windowsNoMagicRoot:!!(this.isWindows&&this.nocase),this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let _ of this.set)for(let l of _)if(typeof l!="string")return!0;return!1}debug(..._){}make(){let _=this.pattern,l=this.options;if(!l.nocomment&&_.charAt(0)==="#"){this.comment=!0;return}if(!_){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],l.debug&&(this.debug=(...p)=>console.error(...p)),this.debug(this.pattern,this.globSet);let g=this.globSet.map(p=>this.slashSplit(p));this.globParts=this.preprocess(g),this.debug(this.pattern,this.globParts);let b=this.globParts.map((p,x,P)=>{if(this.isWindows&&this.windowsNoMagicRoot){let B=p[0]===""&&p[1]===""&&(p[2]==="?"||!HVe.test(p[2]))&&!HVe.test(p[3]),re=/^[a-z]:/i.test(p[0]);if(B)return[...p.slice(0,4),...p.slice(4).map(_e=>this.parse(_e))];if(re)return[p[0],...p.slice(1).map(_e=>this.parse(_e))]}return p.map(B=>this.parse(B))});if(this.debug(this.pattern,b),this.set=b.filter(p=>p.indexOf(!1)===-1),this.isWindows)for(let p=0;p<this.set.length;p++){let x=this.set[p];x[0]===""&&x[1]===""&&this.globParts[p][2]==="?"&&typeof x[3]=="string"&&/^[a-z]:$/i.test(x[3])&&(x[2]="?")}this.debug(this.pattern,this.set)}preprocess(_){if(this.options.noglobstar)for(let g=0;g<_.length;g++)for(let b=0;b<_[g].length;b++)_[g][b]==="**"&&(_[g][b]="*");let{optimizationLevel:l=1}=this.options;return l>=2?(_=this.firstPhasePreProcess(_),_=this.secondPhasePreProcess(_)):l>=1?_=this.levelOneOptimize(_):_=this.adjascentGlobstarOptimize(_),_}adjascentGlobstarOptimize(_){return _.map(l=>{let g=-1;for(;(g=l.indexOf("**",g+1))!==-1;){let b=g;for(;l[b+1]==="**";)b++;b!==g&&l.splice(g,b-g)}return l})}levelOneOptimize(_){return _.map(l=>(l=l.reduce((g,b)=>{let p=g[g.length-1];return b==="**"&&p==="**"?g:b===".."&&p&&p!==".."&&p!=="."&&p!=="**"?(g.pop(),g):(g.push(b),g)},[]),l.length===0?[""]:l))}levelTwoFileOptimize(_){Array.isArray(_)||(_=this.slashSplit(_));let l=!1;do{if(l=!1,!this.preserveMultipleSlashes){for(let b=1;b<_.length-1;b++){let p=_[b];b===1&&p===""&&_[0]===""||(p==="."||p==="")&&(l=!0,_.splice(b,1),b--)}_[0]==="."&&_.length===2&&(_[1]==="."||_[1]==="")&&(l=!0,_.pop())}let g=0;for(;(g=_.indexOf("..",g+1))!==-1;){let b=_[g-1];b&&b!=="."&&b!==".."&&b!=="**"&&(l=!0,_.splice(g-1,2),g-=2)}}while(l);return _.length===0?[""]:_}firstPhasePreProcess(_){let l=!1;do{l=!1;for(let g of _){let b=-1;for(;(b=g.indexOf("**",b+1))!==-1;){let x=b;for(;g[x+1]==="**";)x++;x>b&&g.splice(b+1,x-b);let P=g[b+1],B=g[b+2],re=g[b+3];if(P!==".."||!B||B==="."||B===".."||!re||re==="."||re==="..")continue;l=!0,g.splice(b,1);let _e=g.slice(0);_e[b]="**",_.push(_e),b--}if(!this.preserveMultipleSlashes){for(let x=1;x<g.length-1;x++){let P=g[x];x===1&&P===""&&g[0]===""||(P==="."||P==="")&&(l=!0,g.splice(x,1),x--)}g[0]==="."&&g.length===2&&(g[1]==="."||g[1]==="")&&(l=!0,g.pop())}let p=0;for(;(p=g.indexOf("..",p+1))!==-1;){let x=g[p-1];if(x&&x!=="."&&x!==".."&&x!=="**"){l=!0;let P=p===1&&g[p+1]==="**"?["."]:[];g.splice(p-1,2,...P),g.length===0&&g.push(""),p-=2}}}}while(l);return _}secondPhasePreProcess(_){for(let l=0;l<_.length-1;l++)for(let g=l+1;g<_.length;g++){let b=this.partsMatch(_[l],_[g],!this.preserveMultipleSlashes);if(b){_[l]=[],_[g]=b;break}}return _.filter(l=>l.length)}partsMatch(_,l,g=!1){let b=0,p=0,x=[],P="";for(;b<_.length&&p<l.length;)if(_[b]===l[p])x.push(P==="b"?l[p]:_[b]),b++,p++;else if(g&&_[b]==="**"&&l[p]===_[b+1])x.push(_[b]),b++;else if(g&&l[p]==="**"&&_[b]===l[p+1])x.push(l[p]),p++;else if(_[b]==="*"&&l[p]&&(this.options.dot||!l[p].startsWith("."))&&l[p]!=="**"){if(P==="b")return!1;P="a",x.push(_[b]),b++,p++}else if(l[p]==="*"&&_[b]&&(this.options.dot||!_[b].startsWith("."))&&_[b]!=="**"){if(P==="a")return!1;P="b",x.push(l[p]),b++,p++}else return!1;return _.length===l.length&&x}parseNegate(){if(this.nonegate)return;let _=this.pattern,l=!1,g=0;for(let b=0;b<_.length&&_.charAt(b)==="!";b++)l=!l,g++;g&&(this.pattern=_.slice(g)),this.negate=l}matchOne(_,l,g=!1){let b=this.options;if(this.isWindows){let Ve=typeof _[0]=="string"&&/^[a-z]:$/i.test(_[0]),qe=!Ve&&_[0]===""&&_[1]===""&&_[2]==="?"&&/^[a-z]:$/i.test(_[3]),fn=typeof l[0]=="string"&&/^[a-z]:$/i.test(l[0]),Mr=!fn&&l[0]===""&&l[1]===""&&l[2]==="?"&&typeof l[3]=="string"&&/^[a-z]:$/i.test(l[3]),_i=qe?3:Ve?0:void 0,oi=Mr?3:fn?0:void 0;if(typeof _i=="number"&&typeof oi=="number"){let[di,Ba]=[_[_i],l[oi]];di.toLowerCase()===Ba.toLowerCase()&&(l[oi]=di,oi>_i?l=l.slice(oi):_i>oi&&(_=_.slice(_i)))}}let{optimizationLevel:p=1}=this.options;p>=2&&(_=this.levelTwoFileOptimize(_)),this.debug("matchOne",this,{file:_,pattern:l}),this.debug("matchOne",_.length,l.length);for(var x=0,P=0,B=_.length,re=l.length;x<B&&P<re;x++,P++){this.debug("matchOne loop");var _e=l[P],ge=_[x];if(this.debug(l,_e,ge),_e===!1)return!1;if(_e===D0){this.debug("GLOBSTAR",[l,_e,ge]);var we=x,ae=P+1;if(ae===re){for(this.debug("** at the end");x<B;x++)if(_[x]==="."||_[x]===".."||!b.dot&&_[x].charAt(0)===".")return!1;return!0}for(;we<B;){var gt=_[we];if(this.debug(`
460
460
  globstar while`,_,we,l,ae,gt),this.matchOne(_.slice(we),l.slice(ae),g))return this.debug("globstar found match!",we,B,gt),!0;if(gt==="."||gt===".."||!b.dot&&gt.charAt(0)==="."){this.debug("dot detected!",_,we,l,ae);break}this.debug("globstar swallow a segment, and continue"),we++}return!!(g&&(this.debug(`
461
461
  >>> no match, partial?`,_,we,l,ae),we===B))}let Ve;if(typeof _e=="string"?(Ve=ge===_e,this.debug("string match",_e,ge,Ve)):(Ve=_e.test(ge),this.debug("pattern match",_e,ge,Ve)),!Ve)return!1}if(x===B&&P===re)return!0;if(x===B)return g;if(P===re)return x===B-1&&_[x]==="";throw new Error("wtf?")}braceExpand(){return Tqe(this.pattern,this.options)}parse(_){Kee(_);let l=this.options;if(_==="**")return D0;if(_==="")return"";let g,b=null;(g=_.match(J4t))?b=l.dot?W4t:U4t:(g=_.match(N4t))?b=(l.nocase?l.dot?M4t:L4t:l.dot?F4t:O4t)(g[1]):(g=_.match(V4t))?b=(l.nocase?l.dot?G4t:q4t:l.dot?H4t:Z4t)(g):(g=_.match(R4t))?b=l.dot?$4t:j4t:(g=_.match(z4t))&&(b=B4t);let p=yqe.fromGlob(_,this.options).toMMPattern();return b&&typeof p=="object"&&Reflect.defineProperty(p,"test",{value:b}),p}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let _=this.set;if(!_.length)return this.regexp=!1,this.regexp;let l=this.options,g=l.noglobstar?K4t:l.dot?Y4t:eIt,b=new Set(l.nocase?["i"]:[]),p=_.map(B=>{let re=B.map(ge=>{if(ge instanceof RegExp)for(let we of ge.flags.split(""))b.add(we);return typeof ge=="string"?sIt(ge):ge===D0?D0:ge._src});re.forEach((ge,we)=>{let ae=re[we+1],gt=re[we-1];ge!==D0||gt===D0||(gt===void 0?ae!==void 0&&ae!==D0?re[we+1]="(?:\\/|"+g+"\\/)?"+ae:re[we]=g:ae===void 0?re[we-1]=gt+"(?:\\/|\\/"+g+")?":ae!==D0&&(re[we-1]=gt+"(?:\\/|\\/"+g+"\\/)"+ae,re[we+1]=D0))});let _e=re.filter(ge=>ge!==D0);if(this.partial&&_e.length>=1){let ge=[];for(let we=1;we<=_e.length;we++)ge.push(_e.slice(0,we).join("/"));return"(?:"+ge.join("|")+")"}return _e.join("/")}).join("|"),[x,P]=_.length>1?["(?:",")"]:["",""];p="^"+x+p+P+"$",this.partial&&(p="^(?:\\/|"+x+p.slice(1,-1)+P+")$"),this.negate&&(p="^(?!"+p+").+$");try{this.regexp=new RegExp(p,[...b].join(""))}catch{this.regexp=!1}return this.regexp}slashSplit(_){return this.preserveMultipleSlashes?_.split("/"):this.isWindows&&/^\/\/[^\/]+/.test(_)?["",..._.split(/\/+/)]:_.split(/\/+/)}match(_,l=this.partial){if(this.debug("match",_,this.pattern),this.comment)return!1;if(this.empty)return _==="";if(_==="/"&&l)return!0;let g=this.options;this.isWindows&&(_=_.split("\\").join("/"));let b=this.slashSplit(_);this.debug(this.pattern,"split",b);let p=this.set;this.debug(this.pattern,"set",p);let x=b[b.length-1];if(!x)for(let P=b.length-2;!x&&P>=0;P--)x=b[P];for(let P=0;P<p.length;P++){let B=p[P],re=b;if(g.matchBase&&B.length===1&&(re=[x]),this.matchOne(re,B,l))return g.flipNegate?!0:!this.negate}return g.flipNegate?!1:this.negate}static defaults(_){return P0.defaults(_).Minimatch}};P0.AST=yqe;P0.Minimatch=bP;P0.escape=vqe;P0.unescape=i5;var aIt=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,Cqe=new Set,QSe=typeof process=="object"&&process?process:{},wqe=(_,l,g,b)=>{typeof QSe.emitWarning=="function"?QSe.emitWarning(_,l,g,b):console.error(`[${g}] ${l}: ${_}`)},Yee=globalThis.AbortController,ZVe=globalThis.AbortSignal,_qe;if(typeof Yee>"u"){ZVe=class{onabort;_onabort=[];reason;aborted=!1;addEventListener(g,b){this._onabort.push(b)}},Yee=class{constructor(){l()}signal=new ZVe;abort(g){var b,p;if(!this.signal.aborted){this.signal.reason=g,this.signal.aborted=!0;for(let x of this.signal._onabort)x(g);(p=(b=this.signal).onabort)==null||p.call(b,g)}}};let _=((_qe=QSe.env)==null?void 0:_qe.LRU_CACHE_IGNORE_AC_WARNING)!=="1",l=()=>{_&&(_=!1,wqe("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",l))}}var oIt=_=>!Cqe.has(_),vP=_=>_&&_===Math.floor(_)&&_>0&&isFinite(_),Eqe=_=>vP(_)?_<=Math.pow(2,8)?Uint8Array:_<=Math.pow(2,16)?Uint16Array:_<=Math.pow(2,32)?Uint32Array:_<=Number.MAX_SAFE_INTEGER?Xee:null:null,Xee=class extends Array{constructor(_){super(_),this.fill(0)}},cIt=class wB{heap;length;static#e=!1;static create(l){let g=Eqe(l);if(!g)return[];wB.#e=!0;let b=new wB(l,g);return wB.#e=!1,b}constructor(l,g){if(!wB.#e)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new g(l),this.length=0}push(l){this.heap[this.length++]=l}pop(){return this.heap[--this.length]}},tte=class Dqe{#e;#r;#i;#t;#n;#m;#p;#c;get perf(){return this.#c}ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#o;#u;#_;#l;#a;#g;#S;#h;#y;#w;#v;#T;#k;#d;#b;#x;#E;#s;#F;static unsafeExposeInternals(l){return{starts:l.#k,ttls:l.#d,autopurgeTimers:l.#b,sizes:l.#T,keyMap:l.#_,keyList:l.#l,valList:l.#a,next:l.#g,prev:l.#S,get head(){return l.#h},get tail(){return l.#y},free:l.#w,isBackgroundFetch:g=>l.#f(g),backgroundFetch:(g,b,p,x)=>l.#J(g,b,p,x),moveToTail:g=>l.#M(g),indexes:g=>l.#I(g),rindexes:g=>l.#A(g),isStale:g=>l.#C(g)}}get max(){return this.#e}get maxSize(){return this.#r}get calculatedSize(){return this.#u}get size(){return this.#o}get fetchMethod(){return this.#m}get memoMethod(){return this.#p}get dispose(){return this.#i}get onInsert(){return this.#t}get disposeAfter(){return this.#n}constructor(l){let{max:g=0,ttl:b,ttlResolution:p=1,ttlAutopurge:x,updateAgeOnGet:P,updateAgeOnHas:B,allowStale:re,dispose:_e,onInsert:ge,disposeAfter:we,noDisposeOnSet:ae,noUpdateTTL:gt,maxSize:Ve=0,maxEntrySize:qe=0,sizeCalculation:fn,fetchMethod:Mr,memoMethod:_i,noDeleteOnFetchRejection:oi,noDeleteOnStaleGet:di,allowStaleOnFetchRejection:Ba,allowStaleOnFetchAbort:Ti,ignoreFetchAbort:un,perf:jo}=l;if(jo!==void 0&&typeof(jo==null?void 0:jo.now)!="function")throw new TypeError("perf option must have a now() method if specified");if(this.#c=jo??aIt,g!==0&&!vP(g))throw new TypeError("max option must be a nonnegative integer");let Ga=g?Eqe(g):Array;if(!Ga)throw new Error("invalid max value: "+g);if(this.#e=g,this.#r=Ve,this.maxEntrySize=qe||this.#r,this.sizeCalculation=fn,this.sizeCalculation){if(!this.#r&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(_i!==void 0&&typeof _i!="function")throw new TypeError("memoMethod must be a function if defined");if(this.#p=_i,Mr!==void 0&&typeof Mr!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#m=Mr,this.#E=!!Mr,this.#_=new Map,this.#l=new Array(g).fill(void 0),this.#a=new Array(g).fill(void 0),this.#g=new Ga(g),this.#S=new Ga(g),this.#h=0,this.#y=0,this.#w=cIt.create(g),this.#o=0,this.#u=0,typeof _e=="function"&&(this.#i=_e),typeof ge=="function"&&(this.#t=ge),typeof we=="function"?(this.#n=we,this.#v=[]):(this.#n=void 0,this.#v=void 0),this.#x=!!this.#i,this.#F=!!this.#t,this.#s=!!this.#n,this.noDisposeOnSet=!!ae,this.noUpdateTTL=!!gt,this.noDeleteOnFetchRejection=!!oi,this.allowStaleOnFetchRejection=!!Ba,this.allowStaleOnFetchAbort=!!Ti,this.ignoreFetchAbort=!!un,this.maxEntrySize!==0){if(this.#r!==0&&!vP(this.#r))throw new TypeError("maxSize must be a positive integer if specified");if(!vP(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#W()}if(this.allowStale=!!re,this.noDeleteOnStaleGet=!!di,this.updateAgeOnGet=!!P,this.updateAgeOnHas=!!B,this.ttlResolution=vP(p)||p===0?p:1,this.ttlAutopurge=!!x,this.ttl=b||0,this.ttl){if(!vP(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#N()}if(this.#e===0&&this.ttl===0&&this.#r===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#e&&!this.#r){let eh="LRU_CACHE_UNBOUNDED";oIt(eh)&&(Cqe.add(eh),wqe("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",eh,Dqe))}}getRemainingTTL(l){return this.#_.has(l)?1/0:0}#N(){let l=new Xee(this.#e),g=new Xee(this.#e);this.#d=l,this.#k=g;let b=this.ttlAutopurge?new Array(this.#e):void 0;this.#b=b,this.#j=(P,B,re=this.#c.now())=>{if(g[P]=B!==0?re:0,l[P]=B,b!=null&&b[P]&&(clearTimeout(b[P]),b[P]=void 0),B!==0&&b){let _e=setTimeout(()=>{this.#C(P)&&this.#P(this.#l[P],"expire")},B+1);_e.unref&&_e.unref(),b[P]=_e}},this.#D=P=>{g[P]=l[P]!==0?this.#c.now():0},this.#O=(P,B)=>{if(l[B]){let re=l[B],_e=g[B];if(!re||!_e)return;P.ttl=re,P.start=_e,P.now=p||x();let ge=P.now-_e;P.remainingTTL=re-ge}};let p=0,x=()=>{let P=this.#c.now();if(this.ttlResolution>0){p=P;let B=setTimeout(()=>p=0,this.ttlResolution);B.unref&&B.unref()}return P};this.getRemainingTTL=P=>{let B=this.#_.get(P);if(B===void 0)return 0;let re=l[B],_e=g[B];if(!re||!_e)return 1/0;let ge=(p||x())-_e;return re-ge},this.#C=P=>{let B=g[P],re=l[P];return!!re&&!!B&&(p||x())-B>re}}#D=()=>{};#O=()=>{};#j=()=>{};#C=()=>!1;#W(){let l=new Xee(this.#e);this.#u=0,this.#T=l,this.#R=g=>{this.#u-=l[g],l[g]=0},this.#$=(g,b,p,x)=>{if(this.#f(b))return 0;if(!vP(p))if(x){if(typeof x!="function")throw new TypeError("sizeCalculation must be a function");if(p=x(b,g),!vP(p))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return p},this.#L=(g,b,p)=>{if(l[g]=b,this.#r){let x=this.#r-l[g];for(;this.#u>x;)this.#B(!0)}this.#u+=l[g],p&&(p.entrySize=b,p.totalCalculatedSize=this.#u)}}#R=l=>{};#L=(l,g,b)=>{};#$=(l,g,b,p)=>{if(b||p)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#I({allowStale:l=this.allowStale}={}){if(this.#o)for(let g=this.#y;!(!this.#z(g)||((l||!this.#C(g))&&(yield g),g===this.#h));)g=this.#S[g]}*#A({allowStale:l=this.allowStale}={}){if(this.#o)for(let g=this.#h;!(!this.#z(g)||((l||!this.#C(g))&&(yield g),g===this.#y));)g=this.#g[g]}#z(l){return l!==void 0&&this.#_.get(this.#l[l])===l}*entries(){for(let l of this.#I())this.#a[l]!==void 0&&this.#l[l]!==void 0&&!this.#f(this.#a[l])&&(yield[this.#l[l],this.#a[l]])}*rentries(){for(let l of this.#A())this.#a[l]!==void 0&&this.#l[l]!==void 0&&!this.#f(this.#a[l])&&(yield[this.#l[l],this.#a[l]])}*keys(){for(let l of this.#I()){let g=this.#l[l];g!==void 0&&!this.#f(this.#a[l])&&(yield g)}}*rkeys(){for(let l of this.#A()){let g=this.#l[l];g!==void 0&&!this.#f(this.#a[l])&&(yield g)}}*values(){for(let l of this.#I())this.#a[l]!==void 0&&!this.#f(this.#a[l])&&(yield this.#a[l])}*rvalues(){for(let l of this.#A())this.#a[l]!==void 0&&!this.#f(this.#a[l])&&(yield this.#a[l])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(l,g={}){for(let b of this.#I()){let p=this.#a[b],x=this.#f(p)?p.__staleWhileFetching:p;if(x!==void 0&&l(x,this.#l[b],this))return this.get(this.#l[b],g)}}forEach(l,g=this){for(let b of this.#I()){let p=this.#a[b],x=this.#f(p)?p.__staleWhileFetching:p;x!==void 0&&l.call(g,x,this.#l[b],this)}}rforEach(l,g=this){for(let b of this.#A()){let p=this.#a[b],x=this.#f(p)?p.__staleWhileFetching:p;x!==void 0&&l.call(g,x,this.#l[b],this)}}purgeStale(){let l=!1;for(let g of this.#A({allowStale:!0}))this.#C(g)&&(this.#P(this.#l[g],"expire"),l=!0);return l}info(l){let g=this.#_.get(l);if(g===void 0)return;let b=this.#a[g],p=this.#f(b)?b.__staleWhileFetching:b;if(p===void 0)return;let x={value:p};if(this.#d&&this.#k){let P=this.#d[g],B=this.#k[g];if(P&&B){let re=P-(this.#c.now()-B);x.ttl=re,x.start=Date.now()}}return this.#T&&(x.size=this.#T[g]),x}dump(){let l=[];for(let g of this.#I({allowStale:!0})){let b=this.#l[g],p=this.#a[g],x=this.#f(p)?p.__staleWhileFetching:p;if(x===void 0||b===void 0)continue;let P={value:x};if(this.#d&&this.#k){P.ttl=this.#d[g];let B=this.#c.now()-this.#k[g];P.start=Math.floor(Date.now()-B)}this.#T&&(P.size=this.#T[g]),l.unshift([b,P])}return l}load(l){this.clear();for(let[g,b]of l){if(b.start){let p=Date.now()-b.start;b.start=this.#c.now()-p}this.set(g,b.value,b)}}set(l,g,b={}){var ae,gt,Ve,qe,fn,Mr,_i;if(g===void 0)return this.delete(l),this;let{ttl:p=this.ttl,start:x,noDisposeOnSet:P=this.noDisposeOnSet,sizeCalculation:B=this.sizeCalculation,status:re}=b,{noUpdateTTL:_e=this.noUpdateTTL}=b,ge=this.#$(l,g,b.size||0,B);if(this.maxEntrySize&&ge>this.maxEntrySize)return re&&(re.set="miss",re.maxEntrySizeExceeded=!0),this.#P(l,"set"),this;let we=this.#o===0?void 0:this.#_.get(l);if(we===void 0)we=this.#o===0?this.#y:this.#w.length!==0?this.#w.pop():this.#o===this.#e?this.#B(!1):this.#o,this.#l[we]=l,this.#a[we]=g,this.#_.set(l,we),this.#g[this.#y]=we,this.#S[we]=this.#y,this.#y=we,this.#o++,this.#L(we,ge,re),re&&(re.set="add"),_e=!1,this.#F&&((ae=this.#t)==null||ae.call(this,g,l,"add"));else{this.#M(we);let oi=this.#a[we];if(g!==oi){if(this.#E&&this.#f(oi)){oi.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:di}=oi;di!==void 0&&!P&&(this.#x&&((gt=this.#i)==null||gt.call(this,di,l,"set")),this.#s&&((Ve=this.#v)==null||Ve.push([di,l,"set"])))}else P||(this.#x&&((qe=this.#i)==null||qe.call(this,oi,l,"set")),this.#s&&((fn=this.#v)==null||fn.push([oi,l,"set"])));if(this.#R(we),this.#L(we,ge,re),this.#a[we]=g,re){re.set="replace";let di=oi&&this.#f(oi)?oi.__staleWhileFetching:oi;di!==void 0&&(re.oldValue=di)}}else re&&(re.set="update");this.#F&&((Mr=this.onInsert)==null||Mr.call(this,g,l,g===oi?"update":"replace"))}if(p!==0&&!this.#d&&this.#N(),this.#d&&(_e||this.#j(we,p,x),re&&this.#O(re,we)),!P&&this.#s&&this.#v){let oi=this.#v,di;for(;di=oi==null?void 0:oi.shift();)(_i=this.#n)==null||_i.call(this,...di)}return this}pop(){var l;try{for(;this.#o;){let g=this.#a[this.#h];if(this.#B(!0),this.#f(g)){if(g.__staleWhileFetching)return g.__staleWhileFetching}else if(g!==void 0)return g}}finally{if(this.#s&&this.#v){let g=this.#v,b;for(;b=g==null?void 0:g.shift();)(l=this.#n)==null||l.call(this,...b)}}}#B(l){var x,P,B;let g=this.#h,b=this.#l[g],p=this.#a[g];return this.#E&&this.#f(p)?p.__abortController.abort(new Error("evicted")):(this.#x||this.#s)&&(this.#x&&((x=this.#i)==null||x.call(this,p,b,"evict")),this.#s&&((P=this.#v)==null||P.push([p,b,"evict"]))),this.#R(g),(B=this.#b)!=null&&B[g]&&(clearTimeout(this.#b[g]),this.#b[g]=void 0),l&&(this.#l[g]=void 0,this.#a[g]=void 0,this.#w.push(g)),this.#o===1?(this.#h=this.#y=0,this.#w.length=0):this.#h=this.#g[g],this.#_.delete(b),this.#o--,g}has(l,g={}){let{updateAgeOnHas:b=this.updateAgeOnHas,status:p}=g,x=this.#_.get(l);if(x!==void 0){let P=this.#a[x];if(this.#f(P)&&P.__staleWhileFetching===void 0)return!1;if(this.#C(x))p&&(p.has="stale",this.#O(p,x));else return b&&this.#D(x),p&&(p.has="hit",this.#O(p,x)),!0}else p&&(p.has="miss");return!1}peek(l,g={}){let{allowStale:b=this.allowStale}=g,p=this.#_.get(l);if(p===void 0||!b&&this.#C(p))return;let x=this.#a[p];return this.#f(x)?x.__staleWhileFetching:x}#J(l,g,b,p){let x=g===void 0?void 0:this.#a[g];if(this.#f(x))return x;let P=new Yee,{signal:B}=b;B==null||B.addEventListener("abort",()=>P.abort(B.reason),{signal:P.signal});let re={signal:P.signal,options:b,context:p},_e=(qe,fn=!1)=>{let{aborted:Mr}=P.signal,_i=b.ignoreFetchAbort&&qe!==void 0,oi=b.ignoreFetchAbort||!!(b.allowStaleOnFetchAbort&&qe!==void 0);if(b.status&&(Mr&&!fn?(b.status.fetchAborted=!0,b.status.fetchError=P.signal.reason,_i&&(b.status.fetchAbortIgnored=!0)):b.status.fetchResolved=!0),Mr&&!_i&&!fn)return we(P.signal.reason,oi);let di=gt,Ba=this.#a[g];return(Ba===gt||_i&&fn&&Ba===void 0)&&(qe===void 0?di.__staleWhileFetching!==void 0?this.#a[g]=di.__staleWhileFetching:this.#P(l,"fetch"):(b.status&&(b.status.fetchUpdated=!0),this.set(l,qe,re.options))),qe},ge=qe=>(b.status&&(b.status.fetchRejected=!0,b.status.fetchError=qe),we(qe,!1)),we=(qe,fn)=>{let{aborted:Mr}=P.signal,_i=Mr&&b.allowStaleOnFetchAbort,oi=_i||b.allowStaleOnFetchRejection,di=oi||b.noDeleteOnFetchRejection,Ba=gt;if(this.#a[g]===gt&&(!di||!fn&&Ba.__staleWhileFetching===void 0?this.#P(l,"fetch"):_i||(this.#a[g]=Ba.__staleWhileFetching)),oi)return b.status&&Ba.__staleWhileFetching!==void 0&&(b.status.returnedStale=!0),Ba.__staleWhileFetching;if(Ba.__returned===Ba)throw qe},ae=(qe,fn)=>{var _i;let Mr=(_i=this.#m)==null?void 0:_i.call(this,l,x,re);Mr&&Mr instanceof Promise&&Mr.then(oi=>qe(oi===void 0?void 0:oi),fn),P.signal.addEventListener("abort",()=>{(!b.ignoreFetchAbort||b.allowStaleOnFetchAbort)&&(qe(void 0),b.allowStaleOnFetchAbort&&(qe=oi=>_e(oi,!0)))})};b.status&&(b.status.fetchDispatched=!0);let gt=new Promise(ae).then(_e,ge),Ve=Object.assign(gt,{__abortController:P,__staleWhileFetching:x,__returned:void 0});return g===void 0?(this.set(l,Ve,{...re.options,status:void 0}),g=this.#_.get(l)):this.#a[g]=Ve,Ve}#f(l){if(!this.#E)return!1;let g=l;return!!g&&g instanceof Promise&&g.hasOwnProperty("__staleWhileFetching")&&g.__abortController instanceof Yee}async fetch(l,g={}){let{allowStale:b=this.allowStale,updateAgeOnGet:p=this.updateAgeOnGet,noDeleteOnStaleGet:x=this.noDeleteOnStaleGet,ttl:P=this.ttl,noDisposeOnSet:B=this.noDisposeOnSet,size:re=0,sizeCalculation:_e=this.sizeCalculation,noUpdateTTL:ge=this.noUpdateTTL,noDeleteOnFetchRejection:we=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:ae=this.allowStaleOnFetchRejection,ignoreFetchAbort:gt=this.ignoreFetchAbort,allowStaleOnFetchAbort:Ve=this.allowStaleOnFetchAbort,context:qe,forceRefresh:fn=!1,status:Mr,signal:_i}=g;if(!this.#E)return Mr&&(Mr.fetch="get"),this.get(l,{allowStale:b,updateAgeOnGet:p,noDeleteOnStaleGet:x,status:Mr});let oi={allowStale:b,updateAgeOnGet:p,noDeleteOnStaleGet:x,ttl:P,noDisposeOnSet:B,size:re,sizeCalculation:_e,noUpdateTTL:ge,noDeleteOnFetchRejection:we,allowStaleOnFetchRejection:ae,allowStaleOnFetchAbort:Ve,ignoreFetchAbort:gt,status:Mr,signal:_i},di=this.#_.get(l);if(di===void 0){Mr&&(Mr.fetch="miss");let Ba=this.#J(l,di,oi,qe);return Ba.__returned=Ba}else{let Ba=this.#a[di];if(this.#f(Ba)){let Ga=b&&Ba.__staleWhileFetching!==void 0;return Mr&&(Mr.fetch="inflight",Ga&&(Mr.returnedStale=!0)),Ga?Ba.__staleWhileFetching:Ba.__returned=Ba}let Ti=this.#C(di);if(!fn&&!Ti)return Mr&&(Mr.fetch="hit"),this.#M(di),p&&this.#D(di),Mr&&this.#O(Mr,di),Ba;let un=this.#J(l,di,oi,qe),jo=un.__staleWhileFetching!==void 0&&b;return Mr&&(Mr.fetch=Ti?"stale":"refresh",jo&&Ti&&(Mr.returnedStale=!0)),jo?un.__staleWhileFetching:un.__returned=un}}async forceFetch(l,g={}){let b=await this.fetch(l,g);if(b===void 0)throw new Error("fetch() returned undefined");return b}memo(l,g={}){let b=this.#p;if(!b)throw new Error("no memoMethod provided to constructor");let{context:p,forceRefresh:x,...P}=g,B=this.get(l,P);if(!x&&B!==void 0)return B;let re=b(l,B,{options:P,context:p});return this.set(l,re,P),re}get(l,g={}){let{allowStale:b=this.allowStale,updateAgeOnGet:p=this.updateAgeOnGet,noDeleteOnStaleGet:x=this.noDeleteOnStaleGet,status:P}=g,B=this.#_.get(l);if(B!==void 0){let re=this.#a[B],_e=this.#f(re);return P&&this.#O(P,B),this.#C(B)?(P&&(P.get="stale"),_e?(P&&b&&re.__staleWhileFetching!==void 0&&(P.returnedStale=!0),b?re.__staleWhileFetching:void 0):(x||this.#P(l,"expire"),P&&b&&(P.returnedStale=!0),b?re:void 0)):(P&&(P.get="hit"),_e?re.__staleWhileFetching:(this.#M(B),p&&this.#D(B),re))}else P&&(P.get="miss")}#U(l,g){this.#S[g]=l,this.#g[l]=g}#M(l){l!==this.#y&&(l===this.#h?this.#h=this.#g[l]:this.#U(this.#S[l],this.#g[l]),this.#U(this.#y,l),this.#y=l)}delete(l){return this.#P(l,"delete")}#P(l,g){var p,x,P,B,re,_e;let b=!1;if(this.#o!==0){let ge=this.#_.get(l);if(ge!==void 0)if((p=this.#b)!=null&&p[ge]&&(clearTimeout((x=this.#b)==null?void 0:x[ge]),this.#b[ge]=void 0),b=!0,this.#o===1)this.#V(g);else{this.#R(ge);let we=this.#a[ge];if(this.#f(we)?we.__abortController.abort(new Error("deleted")):(this.#x||this.#s)&&(this.#x&&((P=this.#i)==null||P.call(this,we,l,g)),this.#s&&((B=this.#v)==null||B.push([we,l,g]))),this.#_.delete(l),this.#l[ge]=void 0,this.#a[ge]=void 0,ge===this.#y)this.#y=this.#S[ge];else if(ge===this.#h)this.#h=this.#g[ge];else{let ae=this.#S[ge];this.#g[ae]=this.#g[ge];let gt=this.#g[ge];this.#S[gt]=this.#S[ge]}this.#o--,this.#w.push(ge)}}if(this.#s&&((re=this.#v)!=null&&re.length)){let ge=this.#v,we;for(;we=ge==null?void 0:ge.shift();)(_e=this.#n)==null||_e.call(this,...we)}return b}clear(){return this.#V("delete")}#V(l){var g,b,p,x;for(let P of this.#A({allowStale:!0})){let B=this.#a[P];if(this.#f(B))B.__abortController.abort(new Error("deleted"));else{let re=this.#l[P];this.#x&&((g=this.#i)==null||g.call(this,B,re,l)),this.#s&&((b=this.#v)==null||b.push([B,re,l]))}}if(this.#_.clear(),this.#a.fill(void 0),this.#l.fill(void 0),this.#d&&this.#k){this.#d.fill(0),this.#k.fill(0);for(let P of this.#b??[])P!==void 0&&clearTimeout(P);(p=this.#b)==null||p.fill(void 0)}if(this.#T&&this.#T.fill(0),this.#h=0,this.#y=0,this.#w.length=0,this.#u=0,this.#o=0,this.#s&&this.#v){let P=this.#v,B;for(;B=P==null?void 0:P.shift();)(x=this.#n)==null||x.call(this,...B)}}},XVe=typeof process=="object"&&process?process:{stdout:null,stderr:null},uIt=_=>!!_&&typeof _=="object"&&(_ instanceof ete||_ instanceof e2e.default||_It(_)||fIt(_)),_It=_=>!!_&&typeof _=="object"&&_ instanceof rte.EventEmitter&&typeof _.pipe=="function"&&_.pipe!==e2e.default.Writable.prototype.pipe,fIt=_=>!!_&&typeof _=="object"&&_ instanceof rte.EventEmitter&&typeof _.write=="function"&&typeof _.end=="function",NE=Symbol("EOF"),OE=Symbol("maybeEmitEnd"),yP=Symbol("emittedEnd"),Uee=Symbol("emittingEnd"),bB=Symbol("emittedError"),Wee=Symbol("closed"),QVe=Symbol("read"),Vee=Symbol("flush"),KVe=Symbol("flushChunk"),jx=Symbol("encoding"),r5=Symbol("decoder"),Zg=Symbol("flowing"),SB=Symbol("paused"),n5=Symbol("resume"),Xg=Symbol("buffer"),E0=Symbol("pipes"),Qg=Symbol("bufferLength"),WSe=Symbol("bufferPush"),qee=Symbol("bufferShift"),Py=Symbol("objectMode"),nm=Symbol("destroyed"),VSe=Symbol("error"),qSe=Symbol("emitData"),YVe=Symbol("emitEnd"),GSe=Symbol("emitEnd2"),Zk=Symbol("async"),HSe=Symbol("abort"),Gee=Symbol("aborted"),xB=Symbol("signal"),SN=Symbol("dataListeners"),mb=Symbol("discarded"),TB=_=>Promise.resolve().then(_),pIt=_=>_(),dIt=_=>_==="end"||_==="finish"||_==="prefinish",mIt=_=>_ instanceof ArrayBuffer||!!_&&typeof _=="object"&&_.constructor&&_.constructor.name==="ArrayBuffer"&&_.byteLength>=0,gIt=_=>!Buffer.isBuffer(_)&&ArrayBuffer.isView(_),Aqe=class{src;dest;opts;ondrain;constructor(_,l,g){this.src=_,this.dest=l,this.opts=g,this.ondrain=()=>_[n5](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(_){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},hIt=class extends Aqe{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(_,l,g){super(_,l,g),this.proxyErrors=b=>this.dest.emit("error",b),_.on("error",this.proxyErrors)}},yIt=_=>!!_.objectMode,vIt=_=>!_.objectMode&&!!_.encoding&&_.encoding!=="buffer",ete=class extends rte.EventEmitter{[Zg]=!1;[SB]=!1;[E0]=[];[Xg]=[];[Py];[jx];[Zk];[r5];[NE]=!1;[yP]=!1;[Uee]=!1;[Wee]=!1;[bB]=null;[Qg]=0;[nm]=!1;[xB];[Gee]=!1;[SN]=0;[mb]=!1;writable=!0;readable=!0;constructor(..._){let l=_[0]||{};if(super(),l.objectMode&&typeof l.encoding=="string")throw new TypeError("Encoding and objectMode may not be used together");yIt(l)?(this[Py]=!0,this[jx]=null):vIt(l)?(this[jx]=l.encoding,this[Py]=!1):(this[Py]=!1,this[jx]=null),this[Zk]=!!l.async,this[r5]=this[jx]?new Iqe.StringDecoder(this[jx]):null,l&&l.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:()=>this[Xg]}),l&&l.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:()=>this[E0]});let{signal:g}=l;g&&(this[xB]=g,g.aborted?this[HSe]():g.addEventListener("abort",()=>this[HSe]()))}get bufferLength(){return this[Qg]}get encoding(){return this[jx]}set encoding(_){throw new Error("Encoding must be set at instantiation time")}setEncoding(_){throw new Error("Encoding must be set at instantiation time")}get objectMode(){return this[Py]}set objectMode(_){throw new Error("objectMode must be set at instantiation time")}get async(){return this[Zk]}set async(_){this[Zk]=this[Zk]||!!_}[HSe](){var _,l;this[Gee]=!0,this.emit("abort",(_=this[xB])==null?void 0:_.reason),this.destroy((l=this[xB])==null?void 0:l.reason)}get aborted(){return this[Gee]}set aborted(_){}write(_,l,g){var p;if(this[Gee])return!1;if(this[NE])throw new Error("write after end");if(this[nm])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;typeof l=="function"&&(g=l,l="utf8"),l||(l="utf8");let b=this[Zk]?TB:pIt;if(!this[Py]&&!Buffer.isBuffer(_)){if(gIt(_))_=Buffer.from(_.buffer,_.byteOffset,_.byteLength);else if(mIt(_))_=Buffer.from(_);else if(typeof _!="string")throw new Error("Non-contiguous data written to non-objectMode stream")}return this[Py]?(this[Zg]&&this[Qg]!==0&&this[Vee](!0),this[Zg]?this.emit("data",_):this[WSe](_),this[Qg]!==0&&this.emit("readable"),g&&b(g),this[Zg]):_.length?(typeof _=="string"&&!(l===this[jx]&&!((p=this[r5])!=null&&p.lastNeed))&&(_=Buffer.from(_,l)),Buffer.isBuffer(_)&&this[jx]&&(_=this[r5].write(_)),this[Zg]&&this[Qg]!==0&&this[Vee](!0),this[Zg]?this.emit("data",_):this[WSe](_),this[Qg]!==0&&this.emit("readable"),g&&b(g),this[Zg]):(this[Qg]!==0&&this.emit("readable"),g&&b(g),this[Zg])}read(_){if(this[nm])return null;if(this[mb]=!1,this[Qg]===0||_===0||_&&_>this[Qg])return this[OE](),null;this[Py]&&(_=null),this[Xg].length>1&&!this[Py]&&(this[Xg]=[this[jx]?this[Xg].join(""):Buffer.concat(this[Xg],this[Qg])]);let l=this[QVe](_||null,this[Xg][0]);return this[OE](),l}[QVe](_,l){if(this[Py])this[qee]();else{let g=l;_===g.length||_===null?this[qee]():typeof g=="string"?(this[Xg][0]=g.slice(_),l=g.slice(0,_),this[Qg]-=_):(this[Xg][0]=g.subarray(_),l=g.subarray(0,_),this[Qg]-=_)}return this.emit("data",l),!this[Xg].length&&!this[NE]&&this.emit("drain"),l}end(_,l,g){return typeof _=="function"&&(g=_,_=void 0),typeof l=="function"&&(g=l,l="utf8"),_!==void 0&&this.write(_,l),g&&this.once("end",g),this[NE]=!0,this.writable=!1,(this[Zg]||!this[SB])&&this[OE](),this}[n5](){this[nm]||(!this[SN]&&!this[E0].length&&(this[mb]=!0),this[SB]=!1,this[Zg]=!0,this.emit("resume"),this[Xg].length?this[Vee]():this[NE]?this[OE]():this.emit("drain"))}resume(){return this[n5]()}pause(){this[Zg]=!1,this[SB]=!0,this[mb]=!1}get destroyed(){return this[nm]}get flowing(){return this[Zg]}get paused(){return this[SB]}[WSe](_){this[Py]?this[Qg]+=1:this[Qg]+=_.length,this[Xg].push(_)}[qee](){return this[Py]?this[Qg]-=1:this[Qg]-=this[Xg][0].length,this[Xg].shift()}[Vee](_=!1){do;while(this[KVe](this[qee]())&&this[Xg].length);!_&&!this[Xg].length&&!this[NE]&&this.emit("drain")}[KVe](_){return this.emit("data",_),this[Zg]}pipe(_,l){if(this[nm])return _;this[mb]=!1;let g=this[yP];return l=l||{},_===XVe.stdout||_===XVe.stderr?l.end=!1:l.end=l.end!==!1,l.proxyErrors=!!l.proxyErrors,g?l.end&&_.end():(this[E0].push(l.proxyErrors?new hIt(this,_,l):new Aqe(this,_,l)),this[Zk]?TB(()=>this[n5]()):this[n5]()),_}unpipe(_){let l=this[E0].find(g=>g.dest===_);l&&(this[E0].length===1?(this[Zg]&&this[SN]===0&&(this[Zg]=!1),this[E0]=[]):this[E0].splice(this[E0].indexOf(l),1),l.unpipe())}addListener(_,l){return this.on(_,l)}on(_,l){let g=super.on(_,l);if(_==="data")this[mb]=!1,this[SN]++,!this[E0].length&&!this[Zg]&&this[n5]();else if(_==="readable"&&this[Qg]!==0)super.emit("readable");else if(dIt(_)&&this[yP])super.emit(_),this.removeAllListeners(_);else if(_==="error"&&this[bB]){let b=l;this[Zk]?TB(()=>b.call(this,this[bB])):b.call(this,this[bB])}return g}removeListener(_,l){return this.off(_,l)}off(_,l){let g=super.off(_,l);return _==="data"&&(this[SN]=this.listeners("data").length,this[SN]===0&&!this[mb]&&!this[E0].length&&(this[Zg]=!1)),g}removeAllListeners(_){let l=super.removeAllListeners(_);return(_==="data"||_===void 0)&&(this[SN]=0,!this[mb]&&!this[E0].length&&(this[Zg]=!1)),l}get emittedEnd(){return this[yP]}[OE](){!this[Uee]&&!this[yP]&&!this[nm]&&this[Xg].length===0&&this[NE]&&(this[Uee]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[Wee]&&this.emit("close"),this[Uee]=!1)}emit(_,...l){let g=l[0];if(_!=="error"&&_!=="close"&&_!==nm&&this[nm])return!1;if(_==="data")return!this[Py]&&!g?!1:this[Zk]?(TB(()=>this[qSe](g)),!0):this[qSe](g);if(_==="end")return this[YVe]();if(_==="close"){if(this[Wee]=!0,!this[yP]&&!this[nm])return!1;let p=super.emit("close");return this.removeAllListeners("close"),p}else if(_==="error"){this[bB]=g,super.emit(VSe,g);let p=!this[xB]||this.listeners("error").length?super.emit("error",g):!1;return this[OE](),p}else if(_==="resume"){let p=super.emit("resume");return this[OE](),p}else if(_==="finish"||_==="prefinish"){let p=super.emit(_);return this.removeAllListeners(_),p}let b=super.emit(_,...l);return this[OE](),b}[qSe](_){for(let g of this[E0])g.dest.write(_)===!1&&this.pause();let l=this[mb]?!1:super.emit("data",_);return this[OE](),l}[YVe](){return this[yP]?!1:(this[yP]=!0,this.readable=!1,this[Zk]?(TB(()=>this[GSe]()),!0):this[GSe]())}[GSe](){if(this[r5]){let l=this[r5].end();if(l){for(let g of this[E0])g.dest.write(l);this[mb]||super.emit("data",l)}}for(let l of this[E0])l.end();let _=super.emit("end");return this.removeAllListeners("end"),_}async collect(){let _=Object.assign([],{dataLength:0});this[Py]||(_.dataLength=0);let l=this.promise();return this.on("data",g=>{_.push(g),this[Py]||(_.dataLength+=g.length)}),await l,_}async concat(){if(this[Py])throw new Error("cannot concat in objectMode");let _=await this.collect();return this[jx]?_.join(""):Buffer.concat(_,_.dataLength)}async promise(){return new Promise((_,l)=>{this.on(nm,()=>l(new Error("stream destroyed"))),this.on("error",g=>l(g)),this.on("end",()=>_())})}[Symbol.asyncIterator](){this[mb]=!1;let _=!1,l=async()=>(this.pause(),_=!0,{value:void 0,done:!0});return{next:()=>{if(_)return l();let g=this.read();if(g!==null)return Promise.resolve({done:!1,value:g});if(this[NE])return l();let b,p,x=_e=>{this.off("data",P),this.off("end",B),this.off(nm,re),l(),p(_e)},P=_e=>{this.off("error",x),this.off("end",B),this.off(nm,re),this.pause(),b({value:_e,done:!!this[NE]})},B=()=>{this.off("error",x),this.off("data",P),this.off(nm,re),l(),b({done:!0,value:void 0})},re=()=>x(new Error("stream destroyed"));return new Promise((_e,ge)=>{p=ge,b=_e,this.once(nm,re),this.once("error",x),this.once("end",B),this.once("data",P)})},throw:l,return:l,[Symbol.asyncIterator](){return this},[Symbol.asyncDispose]:async()=>{}}}[Symbol.iterator](){this[mb]=!1;let _=!1,l=()=>(this.pause(),this.off(VSe,l),this.off(nm,l),this.off("end",l),_=!0,{done:!0,value:void 0}),g=()=>{if(_)return l();let b=this.read();return b===null?l():{done:!1,value:b}};return this.once("end",l),this.once(VSe,l),this.once(nm,l),{next:g,throw:l,return:l,[Symbol.iterator](){return this},[Symbol.dispose]:()=>{}}}destroy(_){if(this[nm])return _?this.emit("error",_):this.emit(nm),this;this[nm]=!0,this[mb]=!0,this[Xg].length=0,this[Qg]=0;let l=this;return typeof l.close=="function"&&!this[Wee]&&l.close(),_?this.emit("error",_):this.emit(nm),this}static get isStream(){return uIt}},bIt=Qk.realpathSync.native,EB={lstatSync:Qk.lstatSync,readdir:Qk.readdir,readdirSync:Qk.readdirSync,readlinkSync:Qk.readlinkSync,realpathSync:bIt,promises:{lstat:SP.lstat,readdir:SP.readdir,readlink:SP.readlink,realpath:SP.realpath}},Nqe=_=>!_||_===EB||_===lIt?EB:{...EB,..._,promises:{...EB.promises,..._.promises||{}}},Oqe=/^\\\\\?\\([a-z]:)\\?$/i,SIt=_=>_.replace(/\//g,"\\").replace(Oqe,"$1\\"),xIt=/[\\\/]/,r2=0,Fqe=1,Lqe=2,Xk=4,Mqe=6,Rqe=8,xN=10,jqe=12,t2=15,kB=~t2,ZSe=16,eqe=32,DB=64,$x=128,Hee=256,Qee=512,tqe=DB|$x|Qee,TIt=1023,XSe=_=>_.isFile()?Rqe:_.isDirectory()?Xk:_.isSymbolicLink()?xN:_.isCharacterDevice()?Lqe:_.isBlockDevice()?Mqe:_.isSocket()?jqe:_.isFIFO()?Fqe:r2,rqe=new tte({max:2**12}),PB=_=>{let l=rqe.get(_);if(l)return l;let g=_.normalize("NFKD");return rqe.set(_,g),g},nqe=new tte({max:2**12}),Zee=_=>{let l=nqe.get(_);if(l)return l;let g=PB(_.toLowerCase());return nqe.set(_,g),g},iqe=class extends tte{constructor(){super({max:256})}},kIt=class extends tte{constructor(_=16*1024){super({maxSize:_,sizeCalculation:l=>l.length+1})}},$qe=Symbol("PathScurry setAsCwd"),Mv=class{name;root;roots;parent;nocase;isCWD=!1;#e;#r;get dev(){return this.#r}#i;get mode(){return this.#i}#t;get nlink(){return this.#t}#n;get uid(){return this.#n}#m;get gid(){return this.#m}#p;get rdev(){return this.#p}#c;get blksize(){return this.#c}#o;get ino(){return this.#o}#u;get size(){return this.#u}#_;get blocks(){return this.#_}#l;get atimeMs(){return this.#l}#a;get mtimeMs(){return this.#a}#g;get ctimeMs(){return this.#g}#S;get birthtimeMs(){return this.#S}#h;get atime(){return this.#h}#y;get mtime(){return this.#y}#w;get ctime(){return this.#w}#v;get birthtime(){return this.#v}#T;#k;#d;#b;#x;#E;#s;#F;#N;#D;get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}constructor(_,l=r2,g,b,p,x,P){this.name=_,this.#T=p?Zee(_):PB(_),this.#s=l&TIt,this.nocase=p,this.roots=b,this.root=g||this,this.#F=x,this.#d=P.fullpath,this.#x=P.relative,this.#E=P.relativePosix,this.parent=P.parent,this.parent?this.#e=this.parent.#e:this.#e=Nqe(P.fs)}depth(){return this.#k!==void 0?this.#k:this.parent?this.#k=this.parent.depth()+1:this.#k=0}childrenCache(){return this.#F}resolve(_){if(!_)return this;let l=this.getRootString(_),g=_.substring(l.length).split(this.splitSep);return l?this.getRoot(l).#O(g):this.#O(g)}#O(_){let l=this;for(let g of _)l=l.child(g);return l}children(){let _=this.#F.get(this);if(_)return _;let l=Object.assign([],{provisional:0});return this.#F.set(this,l),this.#s&=~ZSe,l}child(_,l){if(_===""||_===".")return this;if(_==="..")return this.parent||this;let g=this.children(),b=this.nocase?Zee(_):PB(_);for(let B of g)if(B.#T===b)return B;let p=this.parent?this.sep:"",x=this.#d?this.#d+p+_:void 0,P=this.newChild(_,r2,{...l,parent:this,fullpath:x});return this.canReaddir()||(P.#s|=$x),g.push(P),P}relative(){if(this.isCWD)return"";if(this.#x!==void 0)return this.#x;let _=this.name,l=this.parent;if(!l)return this.#x=this.name;let g=l.relative();return g+(!g||!l.parent?"":this.sep)+_}relativePosix(){if(this.sep==="/")return this.relative();if(this.isCWD)return"";if(this.#E!==void 0)return this.#E;let _=this.name,l=this.parent;if(!l)return this.#E=this.fullpathPosix();let g=l.relativePosix();return g+(!g||!l.parent?"":"/")+_}fullpath(){if(this.#d!==void 0)return this.#d;let _=this.name,l=this.parent;if(!l)return this.#d=this.name;let g=l.fullpath()+(l.parent?this.sep:"")+_;return this.#d=g}fullpathPosix(){if(this.#b!==void 0)return this.#b;if(this.sep==="/")return this.#b=this.fullpath();if(!this.parent){let b=this.fullpath().replace(/\\/g,"/");return/^[a-z]:\//i.test(b)?this.#b=`//?/${b}`:this.#b=b}let _=this.parent,l=_.fullpathPosix(),g=l+(!l||!_.parent?"":"/")+this.name;return this.#b=g}isUnknown(){return(this.#s&t2)===r2}isType(_){return this[`is${_}`]()}getType(){return this.isUnknown()?"Unknown":this.isDirectory()?"Directory":this.isFile()?"File":this.isSymbolicLink()?"SymbolicLink":this.isFIFO()?"FIFO":this.isCharacterDevice()?"CharacterDevice":this.isBlockDevice()?"BlockDevice":this.isSocket()?"Socket":"Unknown"}isFile(){return(this.#s&t2)===Rqe}isDirectory(){return(this.#s&t2)===Xk}isCharacterDevice(){return(this.#s&t2)===Lqe}isBlockDevice(){return(this.#s&t2)===Mqe}isFIFO(){return(this.#s&t2)===Fqe}isSocket(){return(this.#s&t2)===jqe}isSymbolicLink(){return(this.#s&xN)===xN}lstatCached(){return this.#s&eqe?this:void 0}readlinkCached(){return this.#N}realpathCached(){return this.#D}readdirCached(){let _=this.children();return _.slice(0,_.provisional)}canReadlink(){if(this.#N)return!0;if(!this.parent)return!1;let _=this.#s&t2;return!(_!==r2&&_!==xN||this.#s&Hee||this.#s&$x)}calledReaddir(){return!!(this.#s&ZSe)}isENOENT(){return!!(this.#s&$x)}isNamed(_){return this.nocase?this.#T===Zee(_):this.#T===PB(_)}async readlink(){var l;let _=this.#N;if(_)return _;if(this.canReadlink()&&this.parent)try{let g=await this.#e.promises.readlink(this.fullpath()),b=(l=await this.parent.realpath())==null?void 0:l.resolve(g);if(b)return this.#N=b}catch(g){this.#A(g.code);return}}readlinkSync(){var l;let _=this.#N;if(_)return _;if(this.canReadlink()&&this.parent)try{let g=this.#e.readlinkSync(this.fullpath()),b=(l=this.parent.realpathSync())==null?void 0:l.resolve(g);if(b)return this.#N=b}catch(g){this.#A(g.code);return}}#j(_){this.#s|=ZSe;for(let l=_.provisional;l<_.length;l++){let g=_[l];g&&g.#C()}}#C(){this.#s&$x||(this.#s=(this.#s|$x)&kB,this.#W())}#W(){let _=this.children();_.provisional=0;for(let l of _)l.#C()}#R(){this.#s|=Qee,this.#L()}#L(){if(this.#s&DB)return;let _=this.#s;(_&t2)===Xk&&(_&=kB),this.#s=_|DB,this.#W()}#$(_=""){_==="ENOTDIR"||_==="EPERM"?this.#L():_==="ENOENT"?this.#C():this.children().provisional=0}#I(_=""){_==="ENOTDIR"?this.parent.#L():_==="ENOENT"&&this.#C()}#A(_=""){let l=this.#s;l|=Hee,_==="ENOENT"&&(l|=$x),(_==="EINVAL"||_==="UNKNOWN")&&(l&=kB),this.#s=l,_==="ENOTDIR"&&this.parent&&this.parent.#L()}#z(_,l){return this.#J(_,l)||this.#B(_,l)}#B(_,l){let g=XSe(_),b=this.newChild(_.name,g,{parent:this}),p=b.#s&t2;return p!==Xk&&p!==xN&&p!==r2&&(b.#s|=DB),l.unshift(b),l.provisional++,b}#J(_,l){for(let g=l.provisional;g<l.length;g++){let b=l[g];if((this.nocase?Zee(_.name):PB(_.name))===b.#T)return this.#f(_,b,g,l)}}#f(_,l,g,b){let p=l.name;return l.#s=l.#s&kB|XSe(_),p!==_.name&&(l.name=_.name),g!==b.provisional&&(g===b.length-1?b.pop():b.splice(g,1),b.unshift(l)),b.provisional++,l}async lstat(){if((this.#s&$x)===0)try{return this.#U(await this.#e.promises.lstat(this.fullpath())),this}catch(_){this.#I(_.code)}}lstatSync(){if((this.#s&$x)===0)try{return this.#U(this.#e.lstatSync(this.fullpath())),this}catch(_){this.#I(_.code)}}#U(_){let{atime:l,atimeMs:g,birthtime:b,birthtimeMs:p,blksize:x,blocks:P,ctime:B,ctimeMs:re,dev:_e,gid:ge,ino:we,mode:ae,mtime:gt,mtimeMs:Ve,nlink:qe,rdev:fn,size:Mr,uid:_i}=_;this.#h=l,this.#l=g,this.#v=b,this.#S=p,this.#c=x,this.#_=P,this.#w=B,this.#g=re,this.#r=_e,this.#m=ge,this.#o=we,this.#i=ae,this.#y=gt,this.#a=Ve,this.#t=qe,this.#p=fn,this.#u=Mr,this.#n=_i;let oi=XSe(_);this.#s=this.#s&kB|oi|eqe,oi!==r2&&oi!==Xk&&oi!==xN&&(this.#s|=DB)}#M=[];#P=!1;#V(_){this.#P=!1;let l=this.#M.slice();this.#M.length=0,l.forEach(g=>g(null,_))}readdirCB(_,l=!1){if(!this.canReaddir()){l?_(null,[]):queueMicrotask(()=>_(null,[]));return}let g=this.children();if(this.calledReaddir()){let p=g.slice(0,g.provisional);l?_(null,p):queueMicrotask(()=>_(null,p));return}if(this.#M.push(_),this.#P)return;this.#P=!0;let b=this.fullpath();this.#e.readdir(b,{withFileTypes:!0},(p,x)=>{if(p)this.#$(p.code),g.provisional=0;else{for(let P of x)this.#z(P,g);this.#j(g)}this.#V(g.slice(0,g.provisional))})}#q;async readdir(){if(!this.canReaddir())return[];let _=this.children();if(this.calledReaddir())return _.slice(0,_.provisional);let l=this.fullpath();if(this.#q)await this.#q;else{let g=()=>{};this.#q=new Promise(b=>g=b);try{for(let b of await this.#e.promises.readdir(l,{withFileTypes:!0}))this.#z(b,_);this.#j(_)}catch(b){this.#$(b.code),_.provisional=0}this.#q=void 0,g()}return _.slice(0,_.provisional)}readdirSync(){if(!this.canReaddir())return[];let _=this.children();if(this.calledReaddir())return _.slice(0,_.provisional);let l=this.fullpath();try{for(let g of this.#e.readdirSync(l,{withFileTypes:!0}))this.#z(g,_);this.#j(_)}catch(g){this.#$(g.code),_.provisional=0}return _.slice(0,_.provisional)}canReaddir(){if(this.#s&tqe)return!1;let _=t2&this.#s;return _===r2||_===Xk||_===xN}shouldWalk(_,l){return(this.#s&Xk)===Xk&&!(this.#s&tqe)&&!_.has(this)&&(!l||l(this))}async realpath(){if(this.#D)return this.#D;if(!((Qee|Hee|$x)&this.#s))try{let _=await this.#e.promises.realpath(this.fullpath());return this.#D=this.resolve(_)}catch{this.#R()}}realpathSync(){if(this.#D)return this.#D;if(!((Qee|Hee|$x)&this.#s))try{let _=this.#e.realpathSync(this.fullpath());return this.#D=this.resolve(_)}catch{this.#R()}}[$qe](_){if(_===this)return;_.isCWD=!1,this.isCWD=!0;let l=new Set([]),g=[],b=this;for(;b&&b.parent;)l.add(b),b.#x=g.join(this.sep),b.#E=g.join("/"),b=b.parent,g.push("..");for(b=_;b&&b.parent&&!l.has(b);)b.#x=void 0,b.#E=void 0,b=b.parent}},zqe=class Bqe extends Mv{sep="\\";splitSep=xIt;constructor(l,g=r2,b,p,x,P,B){super(l,g,b,p,x,P,B)}newChild(l,g=r2,b={}){return new Bqe(l,g,this.root,this.roots,this.nocase,this.childrenCache(),b)}getRootString(l){return s5.win32.parse(l).root}getRoot(l){if(l=SIt(l.toUpperCase()),l===this.root.name)return this.root;for(let[g,b]of Object.entries(this.roots))if(this.sameRoot(l,g))return this.roots[l]=b;return this.roots[l]=new t2e(l,this).root}sameRoot(l,g=this.root.name){return l=l.toUpperCase().replace(/\//g,"\\").replace(Oqe,"$1\\"),l===g}},Jqe=class Uqe extends Mv{splitSep="/";sep="/";constructor(l,g=r2,b,p,x,P,B){super(l,g,b,p,x,P,B)}getRootString(l){return l.startsWith("/")?"/":""}getRoot(l){return this.root}newChild(l,g=r2,b={}){return new Uqe(l,g,this.root,this.roots,this.nocase,this.childrenCache(),b)}},Wqe=class{root;rootPath;roots;cwd;#e;#r;#i;nocase;#t;constructor(_=process.cwd(),l,g,{nocase:b,childrenCacheSize:p=16*1024,fs:x=EB}={}){this.#t=Nqe(x),(_ instanceof URL||_.startsWith("file://"))&&(_=(0,Pqe.fileURLToPath)(_));let P=l.resolve(_);this.roots=Object.create(null),this.rootPath=this.parseRootPath(P),this.#e=new iqe,this.#r=new iqe,this.#i=new kIt(p);let B=P.substring(this.rootPath.length).split(g);if(B.length===1&&!B[0]&&B.pop(),b===void 0)throw new TypeError("must provide nocase setting to PathScurryBase ctor");this.nocase=b,this.root=this.newRoot(this.#t),this.roots[this.rootPath]=this.root;let re=this.root,_e=B.length-1,ge=l.sep,we=this.rootPath,ae=!1;for(let gt of B){let Ve=_e--;re=re.child(gt,{relative:new Array(Ve).fill("..").join(ge),relativePosix:new Array(Ve).fill("..").join("/"),fullpath:we+=(ae?"":ge)+gt}),ae=!0}this.cwd=re}depth(_=this.cwd){return typeof _=="string"&&(_=this.cwd.resolve(_)),_.depth()}childrenCache(){return this.#i}resolve(..._){let l="";for(let p=_.length-1;p>=0;p--){let x=_[p];if(!(!x||x===".")&&(l=l?`${x}/${l}`:x,this.isAbsolute(x)))break}let g=this.#e.get(l);if(g!==void 0)return g;let b=this.cwd.resolve(l).fullpath();return this.#e.set(l,b),b}resolvePosix(..._){let l="";for(let p=_.length-1;p>=0;p--){let x=_[p];if(!(!x||x===".")&&(l=l?`${x}/${l}`:x,this.isAbsolute(x)))break}let g=this.#r.get(l);if(g!==void 0)return g;let b=this.cwd.resolve(l).fullpathPosix();return this.#r.set(l,b),b}relative(_=this.cwd){return typeof _=="string"&&(_=this.cwd.resolve(_)),_.relative()}relativePosix(_=this.cwd){return typeof _=="string"&&(_=this.cwd.resolve(_)),_.relativePosix()}basename(_=this.cwd){return typeof _=="string"&&(_=this.cwd.resolve(_)),_.name}dirname(_=this.cwd){return typeof _=="string"&&(_=this.cwd.resolve(_)),(_.parent||_).fullpath()}async readdir(_=this.cwd,l={withFileTypes:!0}){typeof _=="string"?_=this.cwd.resolve(_):_ instanceof Mv||(l=_,_=this.cwd);let{withFileTypes:g}=l;if(_.canReaddir()){let b=await _.readdir();return g?b:b.map(p=>p.name)}else return[]}readdirSync(_=this.cwd,l={withFileTypes:!0}){typeof _=="string"?_=this.cwd.resolve(_):_ instanceof Mv||(l=_,_=this.cwd);let{withFileTypes:g=!0}=l;return _.canReaddir()?g?_.readdirSync():_.readdirSync().map(b=>b.name):[]}async lstat(_=this.cwd){return typeof _=="string"&&(_=this.cwd.resolve(_)),_.lstat()}lstatSync(_=this.cwd){return typeof _=="string"&&(_=this.cwd.resolve(_)),_.lstatSync()}async readlink(_=this.cwd,{withFileTypes:l}={withFileTypes:!1}){typeof _=="string"?_=this.cwd.resolve(_):_ instanceof Mv||(l=_.withFileTypes,_=this.cwd);let g=await _.readlink();return l?g:g==null?void 0:g.fullpath()}readlinkSync(_=this.cwd,{withFileTypes:l}={withFileTypes:!1}){typeof _=="string"?_=this.cwd.resolve(_):_ instanceof Mv||(l=_.withFileTypes,_=this.cwd);let g=_.readlinkSync();return l?g:g==null?void 0:g.fullpath()}async realpath(_=this.cwd,{withFileTypes:l}={withFileTypes:!1}){typeof _=="string"?_=this.cwd.resolve(_):_ instanceof Mv||(l=_.withFileTypes,_=this.cwd);let g=await _.realpath();return l?g:g==null?void 0:g.fullpath()}realpathSync(_=this.cwd,{withFileTypes:l}={withFileTypes:!1}){typeof _=="string"?_=this.cwd.resolve(_):_ instanceof Mv||(l=_.withFileTypes,_=this.cwd);let g=_.realpathSync();return l?g:g==null?void 0:g.fullpath()}async walk(_=this.cwd,l={}){typeof _=="string"?_=this.cwd.resolve(_):_ instanceof Mv||(l=_,_=this.cwd);let{withFileTypes:g=!0,follow:b=!1,filter:p,walkFilter:x}=l,P=[];(!p||p(_))&&P.push(g?_:_.fullpath());let B=new Set,re=(ge,we)=>{B.add(ge),ge.readdirCB((ae,gt)=>{if(ae)return we(ae);let Ve=gt.length;if(!Ve)return we();let qe=()=>{--Ve===0&&we()};for(let fn of gt)(!p||p(fn))&&P.push(g?fn:fn.fullpath()),b&&fn.isSymbolicLink()?fn.realpath().then(Mr=>Mr!=null&&Mr.isUnknown()?Mr.lstat():Mr).then(Mr=>Mr!=null&&Mr.shouldWalk(B,x)?re(Mr,qe):qe()):fn.shouldWalk(B,x)?re(fn,qe):qe()},!0)},_e=_;return new Promise((ge,we)=>{re(_e,ae=>{if(ae)return we(ae);ge(P)})})}walkSync(_=this.cwd,l={}){typeof _=="string"?_=this.cwd.resolve(_):_ instanceof Mv||(l=_,_=this.cwd);let{withFileTypes:g=!0,follow:b=!1,filter:p,walkFilter:x}=l,P=[];(!p||p(_))&&P.push(g?_:_.fullpath());let B=new Set([_]);for(let re of B){let _e=re.readdirSync();for(let ge of _e){(!p||p(ge))&&P.push(g?ge:ge.fullpath());let we=ge;if(ge.isSymbolicLink()){if(!(b&&(we=ge.realpathSync())))continue;we.isUnknown()&&we.lstatSync()}we.shouldWalk(B,x)&&B.add(we)}}return P}[Symbol.asyncIterator](){return this.iterate()}iterate(_=this.cwd,l={}){return typeof _=="string"?_=this.cwd.resolve(_):_ instanceof Mv||(l=_,_=this.cwd),this.stream(_,l)[Symbol.asyncIterator]()}[Symbol.iterator](){return this.iterateSync()}*iterateSync(_=this.cwd,l={}){typeof _=="string"?_=this.cwd.resolve(_):_ instanceof Mv||(l=_,_=this.cwd);let{withFileTypes:g=!0,follow:b=!1,filter:p,walkFilter:x}=l;(!p||p(_))&&(yield g?_:_.fullpath());let P=new Set([_]);for(let B of P){let re=B.readdirSync();for(let _e of re){(!p||p(_e))&&(yield g?_e:_e.fullpath());let ge=_e;if(_e.isSymbolicLink()){if(!(b&&(ge=_e.realpathSync())))continue;ge.isUnknown()&&ge.lstatSync()}ge.shouldWalk(P,x)&&P.add(ge)}}}stream(_=this.cwd,l={}){typeof _=="string"?_=this.cwd.resolve(_):_ instanceof Mv||(l=_,_=this.cwd);let{withFileTypes:g=!0,follow:b=!1,filter:p,walkFilter:x}=l,P=new ete({objectMode:!0});(!p||p(_))&&P.write(g?_:_.fullpath());let B=new Set,re=[_],_e=0,ge=()=>{let we=!1;for(;!we;){let ae=re.shift();if(!ae){_e===0&&P.end();return}_e++,B.add(ae);let gt=(qe,fn,Mr=!1)=>{if(qe)return P.emit("error",qe);if(b&&!Mr){let _i=[];for(let oi of fn)oi.isSymbolicLink()&&_i.push(oi.realpath().then(di=>di!=null&&di.isUnknown()?di.lstat():di));if(_i.length){Promise.all(_i).then(()=>gt(null,fn,!0));return}}for(let _i of fn)_i&&(!p||p(_i))&&(P.write(g?_i:_i.fullpath())||(we=!0));_e--;for(let _i of fn){let oi=_i.realpathCached()||_i;oi.shouldWalk(B,x)&&re.push(oi)}we&&!P.flowing?P.once("drain",ge):Ve||ge()},Ve=!0;ae.readdirCB(gt,!0),Ve=!1}};return ge(),P}streamSync(_=this.cwd,l={}){typeof _=="string"?_=this.cwd.resolve(_):_ instanceof Mv||(l=_,_=this.cwd);let{withFileTypes:g=!0,follow:b=!1,filter:p,walkFilter:x}=l,P=new ete({objectMode:!0}),B=new Set;(!p||p(_))&&P.write(g?_:_.fullpath());let re=[_],_e=0,ge=()=>{let we=!1;for(;!we;){let ae=re.shift();if(!ae){_e===0&&P.end();return}_e++,B.add(ae);let gt=ae.readdirSync();for(let Ve of gt)(!p||p(Ve))&&(P.write(g?Ve:Ve.fullpath())||(we=!0));_e--;for(let Ve of gt){let qe=Ve;if(Ve.isSymbolicLink()){if(!(b&&(qe=Ve.realpathSync())))continue;qe.isUnknown()&&qe.lstatSync()}qe.shouldWalk(B,x)&&re.push(qe)}}we&&!P.flowing&&P.once("drain",ge)};return ge(),P}chdir(_=this.cwd){let l=this.cwd;this.cwd=typeof _=="string"?this.cwd.resolve(_):_,this.cwd[$qe](l)}},t2e=class extends Wqe{sep="\\";constructor(_=process.cwd(),l={}){let{nocase:g=!0}=l;super(_,s5.win32,"\\",{...l,nocase:g}),this.nocase=g;for(let b=this.cwd;b;b=b.parent)b.nocase=this.nocase}parseRootPath(_){return s5.win32.parse(_).root.toUpperCase()}newRoot(_){return new zqe(this.rootPath,Xk,void 0,this.roots,this.nocase,this.childrenCache(),{fs:_})}isAbsolute(_){return _.startsWith("/")||_.startsWith("\\")||/^[a-z]:(\/|\\)/i.test(_)}},r2e=class extends Wqe{sep="/";constructor(_=process.cwd(),l={}){let{nocase:g=!1}=l;super(_,s5.posix,"/",{...l,nocase:g}),this.nocase=g}parseRootPath(_){return"/"}newRoot(_){return new Jqe(this.rootPath,Xk,void 0,this.roots,this.nocase,this.childrenCache(),{fs:_})}isAbsolute(_){return _.startsWith("/")}},Vqe=class extends r2e{constructor(_=process.cwd(),l={}){let{nocase:g=!0}=l;super(_,{...l,nocase:g})}},qFt=process.platform==="win32"?zqe:Jqe,CIt=process.platform==="win32"?t2e:process.platform==="darwin"?Vqe:r2e,wIt=_=>_.length>=1,EIt=_=>_.length>=1,DIt=Symbol.for("nodejs.util.inspect.custom"),qqe=class Gqe{#e;#r;#i;length;#t;#n;#m;#p;#c;#o;#u=!0;constructor(l,g,b,p){if(!wIt(l))throw new TypeError("empty pattern list");if(!EIt(g))throw new TypeError("empty glob list");if(g.length!==l.length)throw new TypeError("mismatched pattern list and glob list lengths");if(this.length=l.length,b<0||b>=this.length)throw new TypeError("index out of range");if(this.#e=l,this.#r=g,this.#i=b,this.#t=p,this.#i===0){if(this.isUNC()){let[x,P,B,re,..._e]=this.#e,[ge,we,ae,gt,...Ve]=this.#r;_e[0]===""&&(_e.shift(),Ve.shift());let qe=[x,P,B,re,""].join("/"),fn=[ge,we,ae,gt,""].join("/");this.#e=[qe,..._e],this.#r=[fn,...Ve],this.length=this.#e.length}else if(this.isDrive()||this.isAbsolute()){let[x,...P]=this.#e,[B,...re]=this.#r;P[0]===""&&(P.shift(),re.shift());let _e=x+"/",ge=B+"/";this.#e=[_e,...P],this.#r=[ge,...re],this.length=this.#e.length}}}[DIt](){return"Pattern <"+this.#r.slice(this.#i).join("/")+">"}pattern(){return this.#e[this.#i]}isString(){return typeof this.#e[this.#i]=="string"}isGlobstar(){return this.#e[this.#i]===D0}isRegExp(){return this.#e[this.#i]instanceof RegExp}globString(){return this.#m=this.#m||(this.#i===0?this.isAbsolute()?this.#r[0]+this.#r.slice(1).join("/"):this.#r.join("/"):this.#r.slice(this.#i).join("/"))}hasMore(){return this.length>this.#i+1}rest(){return this.#n!==void 0?this.#n:this.hasMore()?(this.#n=new Gqe(this.#e,this.#r,this.#i+1,this.#t),this.#n.#o=this.#o,this.#n.#c=this.#c,this.#n.#p=this.#p,this.#n):this.#n=null}isUNC(){let l=this.#e;return this.#c!==void 0?this.#c:this.#c=this.#t==="win32"&&this.#i===0&&l[0]===""&&l[1]===""&&typeof l[2]=="string"&&!!l[2]&&typeof l[3]=="string"&&!!l[3]}isDrive(){let l=this.#e;return this.#p!==void 0?this.#p:this.#p=this.#t==="win32"&&this.#i===0&&this.length>1&&typeof l[0]=="string"&&/^[a-z]:$/i.test(l[0])}isAbsolute(){let l=this.#e;return this.#o!==void 0?this.#o:this.#o=l[0]===""&&l.length>1||this.isDrive()||this.isUNC()}root(){let l=this.#e[0];return typeof l=="string"&&this.isAbsolute()&&this.#i===0?l:""}checkFollowGlobstar(){return!(this.#i===0||!this.isGlobstar()||!this.#u)}markFollowGlobstar(){return this.#i===0||!this.isGlobstar()||!this.#u?!1:(this.#u=!1,!0)}},PIt=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",sqe=class{relative;relativeChildren;absolute;absoluteChildren;platform;mmopts;constructor(_,{nobrace:l,nocase:g,noext:b,noglobstar:p,platform:x=PIt}){this.relative=[],this.absolute=[],this.relativeChildren=[],this.absoluteChildren=[],this.platform=x,this.mmopts={dot:!0,nobrace:l,nocase:g,noext:b,noglobstar:p,optimizationLevel:2,platform:x,nocomment:!0,nonegate:!0};for(let P of _)this.add(P)}add(_){let l=new bP(_,this.mmopts);for(let g=0;g<l.set.length;g++){let b=l.set[g],p=l.globParts[g];if(!b||!p)throw new Error("invalid pattern object");for(;b[0]==="."&&p[0]===".";)b.shift(),p.shift();let x=new qqe(b,p,0,this.platform),P=new bP(x.globString(),this.mmopts),B=p[p.length-1]==="**",re=x.isAbsolute();re?this.absolute.push(P):this.relative.push(P),B&&(re?this.absoluteChildren.push(P):this.relativeChildren.push(P))}}ignored(_){let l=_.fullpath(),g=`${l}/`,b=_.relative()||".",p=`${b}/`;for(let x of this.relative)if(x.match(b)||x.match(p))return!0;for(let x of this.absolute)if(x.match(l)||x.match(g))return!0;return!1}childrenIgnored(_){let l=_.fullpath()+"/",g=(_.relative()||".")+"/";for(let b of this.relativeChildren)if(b.match(g))return!0;for(let b of this.absoluteChildren)if(b.match(l))return!0;return!1}},IIt=class Hqe{store;constructor(l=new Map){this.store=l}copy(){return new Hqe(new Map(this.store))}hasWalked(l,g){var b;return(b=this.store.get(l.fullpath()))==null?void 0:b.has(g.globString())}storeWalked(l,g){let b=l.fullpath(),p=this.store.get(b);p?p.add(g.globString()):this.store.set(b,new Set([g.globString()]))}},AIt=class{store=new Map;add(_,l,g){let b=(l?2:0)|(g?1:0),p=this.store.get(_);this.store.set(_,p===void 0?b:b&p)}entries(){return[...this.store.entries()].map(([_,l])=>[_,!!(l&2),!!(l&1)])}},NIt=class{store=new Map;add(_,l){if(!_.canReaddir())return;let g=this.store.get(_);g?g.find(b=>b.globString()===l.globString())||g.push(l):this.store.set(_,[l])}get(_){let l=this.store.get(_);if(!l)throw new Error("attempting to walk unknown path");return l}entries(){return this.keys().map(_=>[_,this.store.get(_)])}keys(){return[...this.store.keys()].filter(_=>_.canReaddir())}},aqe=class Zqe{hasWalkedCache;matches=new AIt;subwalks=new NIt;patterns;follow;dot;opts;constructor(l,g){this.opts=l,this.follow=!!l.follow,this.dot=!!l.dot,this.hasWalkedCache=g?g.copy():new IIt}processPatterns(l,g){this.patterns=g;let b=g.map(p=>[l,p]);for(let[p,x]of b){this.hasWalkedCache.storeWalked(p,x);let P=x.root(),B=x.isAbsolute()&&this.opts.absolute!==!1;if(P){p=p.resolve(P==="/"&&this.opts.root!==void 0?this.opts.root:P);let we=x.rest();if(we)x=we;else{this.matches.add(p,!0,!1);continue}}if(p.isENOENT())continue;let re,_e,ge=!1;for(;typeof(re=x.pattern())=="string"&&(_e=x.rest());)p=p.resolve(re),x=_e,ge=!0;if(re=x.pattern(),_e=x.rest(),ge){if(this.hasWalkedCache.hasWalked(p,x))continue;this.hasWalkedCache.storeWalked(p,x)}if(typeof re=="string"){let we=re===".."||re===""||re===".";this.matches.add(p.resolve(re),B,we);continue}else if(re===D0){(!p.isSymbolicLink()||this.follow||x.checkFollowGlobstar())&&this.subwalks.add(p,x);let we=_e==null?void 0:_e.pattern(),ae=_e==null?void 0:_e.rest();if(!_e||(we===""||we===".")&&!ae)this.matches.add(p,B,we===""||we===".");else if(we===".."){let gt=p.parent||p;ae?this.hasWalkedCache.hasWalked(gt,ae)||this.subwalks.add(gt,ae):this.matches.add(gt,B,!0)}}else re instanceof RegExp&&this.subwalks.add(p,x)}return this}subwalkTargets(){return this.subwalks.keys()}child(){return new Zqe(this.opts,this.hasWalkedCache)}filterEntries(l,g){let b=this.subwalks.get(l),p=this.child();for(let x of g)for(let P of b){let B=P.isAbsolute(),re=P.pattern(),_e=P.rest();re===D0?p.testGlobstar(x,P,_e,B):re instanceof RegExp?p.testRegExp(x,re,_e,B):p.testString(x,re,_e,B)}return p}testGlobstar(l,g,b,p){if((this.dot||!l.name.startsWith("."))&&(g.hasMore()||this.matches.add(l,p,!1),l.canReaddir()&&(this.follow||!l.isSymbolicLink()?this.subwalks.add(l,g):l.isSymbolicLink()&&(b&&g.checkFollowGlobstar()?this.subwalks.add(l,b):g.markFollowGlobstar()&&this.subwalks.add(l,g)))),b){let x=b.pattern();if(typeof x=="string"&&x!==".."&&x!==""&&x!==".")this.testString(l,x,b.rest(),p);else if(x===".."){let P=l.parent||l;this.subwalks.add(P,b)}else x instanceof RegExp&&this.testRegExp(l,x,b.rest(),p)}}testRegExp(l,g,b,p){g.test(l.name)&&(b?this.subwalks.add(l,b):this.matches.add(l,p,!1))}testString(l,g,b,p){l.isNamed(g)&&(b?this.subwalks.add(l,b):this.matches.add(l,p,!1))}},OIt=(_,l)=>typeof _=="string"?new sqe([_],l):Array.isArray(_)?new sqe(_,l):_,Xqe=class{path;patterns;opts;seen=new Set;paused=!1;aborted=!1;#e=[];#r;#i;signal;maxDepth;includeChildMatches;constructor(_,l,g){if(this.patterns=_,this.path=l,this.opts=g,this.#i=!g.posix&&g.platform==="win32"?"\\":"/",this.includeChildMatches=g.includeChildMatches!==!1,(g.ignore||!this.includeChildMatches)&&(this.#r=OIt(g.ignore??[],g),!this.includeChildMatches&&typeof this.#r.add!="function")){let b="cannot ignore child matches, ignore lacks add() method.";throw new Error(b)}this.maxDepth=g.maxDepth||1/0,g.signal&&(this.signal=g.signal,this.signal.addEventListener("abort",()=>{this.#e.length=0}))}#t(_){var l,g;return this.seen.has(_)||!!((g=(l=this.#r)==null?void 0:l.ignored)!=null&&g.call(l,_))}#n(_){var l,g;return!!((g=(l=this.#r)==null?void 0:l.childrenIgnored)!=null&&g.call(l,_))}pause(){this.paused=!0}resume(){var l;if((l=this.signal)!=null&&l.aborted)return;this.paused=!1;let _;for(;!this.paused&&(_=this.#e.shift());)_()}onResume(_){var l;(l=this.signal)!=null&&l.aborted||(this.paused?this.#e.push(_):_())}async matchCheck(_,l){if(l&&this.opts.nodir)return;let g;if(this.opts.realpath){if(g=_.realpathCached()||await _.realpath(),!g)return;_=g}let b=_.isUnknown()||this.opts.stat?await _.lstat():_;if(this.opts.follow&&this.opts.nodir&&(b!=null&&b.isSymbolicLink())){let p=await b.realpath();p&&(p.isUnknown()||this.opts.stat)&&await p.lstat()}return this.matchCheckTest(b,l)}matchCheckTest(_,l){var g;return _&&(this.maxDepth===1/0||_.depth()<=this.maxDepth)&&(!l||_.canReaddir())&&(!this.opts.nodir||!_.isDirectory())&&(!this.opts.nodir||!this.opts.follow||!_.isSymbolicLink()||!((g=_.realpathCached())!=null&&g.isDirectory()))&&!this.#t(_)?_:void 0}matchCheckSync(_,l){if(l&&this.opts.nodir)return;let g;if(this.opts.realpath){if(g=_.realpathCached()||_.realpathSync(),!g)return;_=g}let b=_.isUnknown()||this.opts.stat?_.lstatSync():_;if(this.opts.follow&&this.opts.nodir&&(b!=null&&b.isSymbolicLink())){let p=b.realpathSync();p&&(p!=null&&p.isUnknown()||this.opts.stat)&&p.lstatSync()}return this.matchCheckTest(b,l)}matchFinish(_,l){var p;if(this.#t(_))return;if(!this.includeChildMatches&&((p=this.#r)!=null&&p.add)){let x=`${_.relativePosix()}/**`;this.#r.add(x)}let g=this.opts.absolute===void 0?l:this.opts.absolute;this.seen.add(_);let b=this.opts.mark&&_.isDirectory()?this.#i:"";if(this.opts.withFileTypes)this.matchEmit(_);else if(g){let x=this.opts.posix?_.fullpathPosix():_.fullpath();this.matchEmit(x+b)}else{let x=this.opts.posix?_.relativePosix():_.relative(),P=this.opts.dotRelative&&!x.startsWith(".."+this.#i)?"."+this.#i:"";this.matchEmit(x?P+x+b:"."+b)}}async match(_,l,g){let b=await this.matchCheck(_,g);b&&this.matchFinish(b,l)}matchSync(_,l,g){let b=this.matchCheckSync(_,g);b&&this.matchFinish(b,l)}walkCB(_,l,g){var b;(b=this.signal)!=null&&b.aborted&&g(),this.walkCB2(_,l,new aqe(this.opts),g)}walkCB2(_,l,g,b){var P;if(this.#n(_))return b();if((P=this.signal)!=null&&P.aborted&&b(),this.paused){this.onResume(()=>this.walkCB2(_,l,g,b));return}g.processPatterns(_,l);let p=1,x=()=>{--p===0&&b()};for(let[B,re,_e]of g.matches.entries())this.#t(B)||(p++,this.match(B,re,_e).then(()=>x()));for(let B of g.subwalkTargets()){if(this.maxDepth!==1/0&&B.depth()>=this.maxDepth)continue;p++;let re=B.readdirCached();B.calledReaddir()?this.walkCB3(B,re,g,x):B.readdirCB((_e,ge)=>this.walkCB3(B,ge,g,x),!0)}x()}walkCB3(_,l,g,b){g=g.filterEntries(_,l);let p=1,x=()=>{--p===0&&b()};for(let[P,B,re]of g.matches.entries())this.#t(P)||(p++,this.match(P,B,re).then(()=>x()));for(let[P,B]of g.subwalks.entries())p++,this.walkCB2(P,B,g.child(),x);x()}walkCBSync(_,l,g){var b;(b=this.signal)!=null&&b.aborted&&g(),this.walkCB2Sync(_,l,new aqe(this.opts),g)}walkCB2Sync(_,l,g,b){var P;if(this.#n(_))return b();if((P=this.signal)!=null&&P.aborted&&b(),this.paused){this.onResume(()=>this.walkCB2Sync(_,l,g,b));return}g.processPatterns(_,l);let p=1,x=()=>{--p===0&&b()};for(let[B,re,_e]of g.matches.entries())this.#t(B)||this.matchSync(B,re,_e);for(let B of g.subwalkTargets()){if(this.maxDepth!==1/0&&B.depth()>=this.maxDepth)continue;p++;let re=B.readdirSync();this.walkCB3Sync(B,re,g,x)}x()}walkCB3Sync(_,l,g,b){g=g.filterEntries(_,l);let p=1,x=()=>{--p===0&&b()};for(let[P,B,re]of g.matches.entries())this.#t(P)||this.matchSync(P,B,re);for(let[P,B]of g.subwalks.entries())p++,this.walkCB2Sync(P,B,g.child(),x);x()}},oqe=class extends Xqe{matches=new Set;constructor(_,l,g){super(_,l,g)}matchEmit(_){this.matches.add(_)}async walk(){var _;if((_=this.signal)!=null&&_.aborted)throw this.signal.reason;return this.path.isUnknown()&&await this.path.lstat(),await new Promise((l,g)=>{this.walkCB(this.path,this.patterns,()=>{var b;(b=this.signal)!=null&&b.aborted?g(this.signal.reason):l(this.matches)})}),this.matches}walkSync(){var _;if((_=this.signal)!=null&&_.aborted)throw this.signal.reason;return this.path.isUnknown()&&this.path.lstatSync(),this.walkCBSync(this.path,this.patterns,()=>{var l;if((l=this.signal)!=null&&l.aborted)throw this.signal.reason}),this.matches}},cqe=class extends Xqe{results;constructor(_,l,g){super(_,l,g),this.results=new ete({signal:this.signal,objectMode:!0}),this.results.on("drain",()=>this.resume()),this.results.on("resume",()=>this.resume())}matchEmit(_){this.results.write(_),this.results.flowing||this.pause()}stream(){let _=this.path;return _.isUnknown()?_.lstat().then(()=>{this.walkCB(_,this.patterns,()=>this.results.end())}):this.walkCB(_,this.patterns,()=>this.results.end()),this.results}streamSync(){return this.path.isUnknown()&&this.path.lstatSync(),this.walkCBSync(this.path,this.patterns,()=>this.results.end()),this.results}},FIt=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",TN=class{absolute;cwd;root;dot;dotRelative;follow;ignore;magicalBraces;mark;matchBase;maxDepth;nobrace;nocase;nodir;noext;noglobstar;pattern;platform;realpath;scurry;stat;signal;windowsPathsNoEscape;withFileTypes;includeChildMatches;opts;patterns;constructor(_,l){if(!l)throw new TypeError("glob options required");if(this.withFileTypes=!!l.withFileTypes,this.signal=l.signal,this.follow=!!l.follow,this.dot=!!l.dot,this.dotRelative=!!l.dotRelative,this.nodir=!!l.nodir,this.mark=!!l.mark,l.cwd?(l.cwd instanceof URL||l.cwd.startsWith("file://"))&&(l.cwd=(0,kqe.fileURLToPath)(l.cwd)):this.cwd="",this.cwd=l.cwd||"",this.root=l.root,this.magicalBraces=!!l.magicalBraces,this.nobrace=!!l.nobrace,this.noext=!!l.noext,this.realpath=!!l.realpath,this.absolute=l.absolute,this.includeChildMatches=l.includeChildMatches!==!1,this.noglobstar=!!l.noglobstar,this.matchBase=!!l.matchBase,this.maxDepth=typeof l.maxDepth=="number"?l.maxDepth:1/0,this.stat=!!l.stat,this.ignore=l.ignore,this.withFileTypes&&this.absolute!==void 0)throw new Error("cannot set absolute and withFileTypes:true");if(typeof _=="string"&&(_=[_]),this.windowsPathsNoEscape=!!l.windowsPathsNoEscape||l.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(_=_.map(B=>B.replace(/\\/g,"/"))),this.matchBase){if(l.noglobstar)throw new TypeError("base matching requires globstar");_=_.map(B=>B.includes("/")?B:`./**/${B}`)}if(this.pattern=_,this.platform=l.platform||FIt,this.opts={...l,platform:this.platform},l.scurry){if(this.scurry=l.scurry,l.nocase!==void 0&&l.nocase!==l.scurry.nocase)throw new Error("nocase option contradicts provided scurry option")}else{let B=l.platform==="win32"?t2e:l.platform==="darwin"?Vqe:l.platform?r2e:CIt;this.scurry=new B(this.cwd,{nocase:l.nocase,fs:l.fs})}this.nocase=this.scurry.nocase;let g=this.platform==="darwin"||this.platform==="win32",b={braceExpandMax:1e4,...l,dot:this.dot,matchBase:this.matchBase,nobrace:this.nobrace,nocase:this.nocase,nocaseMagicOnly:g,nocomment:!0,noext:this.noext,nonegate:!0,optimizationLevel:2,platform:this.platform,windowsPathsNoEscape:this.windowsPathsNoEscape,debug:!!this.opts.debug},p=this.pattern.map(B=>new bP(B,b)),[x,P]=p.reduce((B,re)=>(B[0].push(...re.set),B[1].push(...re.globParts),B),[[],[]]);this.patterns=x.map((B,re)=>{let _e=P[re];if(!_e)throw new Error("invalid pattern object");return new qqe(B,_e,0,this.platform)})}async walk(){return[...await new oqe(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).walk()]}walkSync(){return[...new oqe(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).walkSync()]}stream(){return new cqe(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).stream()}streamSync(){return new cqe(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).streamSync()}iterateSync(){return this.streamSync()[Symbol.iterator]()}[Symbol.iterator](){return this.iterateSync()}iterate(){return this.stream()[Symbol.asyncIterator]()}[Symbol.asyncIterator](){return this.iterate()}},LIt=(_,l={})=>{Array.isArray(_)||(_=[_]);for(let g of _)if(new bP(g,l).hasMagic())return!0;return!1};function nte(_,l={}){return new TN(_,l).streamSync()}function Qqe(_,l={}){return new TN(_,l).stream()}function ite(_,l={}){return new TN(_,l).walkSync()}async function lqe(_,l={}){return new TN(_,l).walk()}function ste(_,l={}){return new TN(_,l).iterateSync()}function Kqe(_,l={}){return new TN(_,l).iterate()}var MIt=nte,RIt=Object.assign(Qqe,{sync:nte}),jIt=ste,$It=Object.assign(Kqe,{sync:ste}),zIt=Object.assign(ite,{stream:nte,iterate:ste}),uqe=Object.assign(lqe,{glob:lqe,globSync:ite,sync:zIt,globStream:Qqe,stream:RIt,globStreamSync:nte,streamSync:MIt,globIterate:Kqe,iterate:$It,globIterateSync:ste,iterateSync:jIt,Glob:TN,hasMagic:LIt,escape:vqe,unescape:i5});uqe.glob=uqe;var PKe=Z_(uGe()),L0=Z_(require("fs")),o2=Z_(require("path")),IKe=Z_(require("child_process")),AKe=Z_(require("os"));var MP=Z_(require("fs")),OQe=Z_(require("path"));function pAt(_){return _&&_.__esModule&&Object.prototype.hasOwnProperty.call(_,"default")?_.default:_}var Iy={},_te={},xP={},_Ge;function IB(){if(_Ge)return xP;_Ge=1;function _(P){return typeof P>"u"||P===null}function l(P){return typeof P=="object"&&P!==null}function g(P){return Array.isArray(P)?P:_(P)?[]:[P]}function b(P,B){if(B){let re=Object.keys(B);for(let _e=0,ge=re.length;_e<ge;_e+=1){let we=re[_e];P[we]=B[we]}}return P}function p(P,B){let re="";for(let _e=0;_e<B;_e+=1)re+=P;return re}function x(P){return P===0&&Number.NEGATIVE_INFINITY===1/P}return xP.isNothing=_,xP.isObject=l,xP.toArray=g,xP.repeat=p,xP.isNegativeZero=x,xP.extend=b,xP}var c2e,fGe;function AB(){if(fGe)return c2e;fGe=1;function _(g,b){let p="",x=g.reason||"(unknown reason)";return g.mark?(g.mark.name&&(p+='in "'+g.mark.name+'" '),p+="("+(g.mark.line+1)+":"+(g.mark.column+1)+")",!b&&g.mark.snippet&&(p+=`
462
462
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fabriziosalmi/slopless",
3
- "version": "1.4.2",
3
+ "version": "1.4.3",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "bin": {