@fabriziosalmi/slopless 1.16.0 → 1.17.0

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
@@ -431,7 +431,7 @@ Project '${m.projectName}' (${yN[m.projectKind]}) ${o}
431
431
  `,o++};this.projectService.externalProjects.forEach(u),this.projectService.configuredProjects.forEach(u),this.projectService.inferredProjects.forEach(u)}}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: ${Kb(t)}`);return}this.writeMessage(t)}writeMessage(t){let n=kve(t,this.logger,this.byteLength,this.host.newLine);this.host.write(n)}event(t,n){this.send(Cve(n,t))}doOutput(t,n,i,s,o,u){let m={seq:0,type:"response",command:n,request_seq:i,success:s,performanceData:o&&a$e(o)};if(s){let p;if(Ps(t))m.body=t,p=t.metadata,delete t.metadata;else if(typeof t=="object")if(t.metadata){let{metadata:x,...b}=t;m.body=b,p=x}else m.body=t;else m.body=t;p&&(m.metadata=p)}else O.assert(t===void 0);u&&(m.message=u),this.send(m)}semanticCheck(t,n){var i,s;let o=Lo();(i=kn)==null||i.push(kn.Phase.Session,"semanticCheck",{file:t,configFilePath:n.canonicalConfigFilePath});let u=Zje(n,t)?Yl:n.getLanguageService().getSemanticDiagnostics(t).filter(m=>!!m.file);this.sendDiagnosticsEvent(t,n,u,"semanticDiag",o),(s=kn)==null||s.pop()}syntacticCheck(t,n){var i,s;let o=Lo();(i=kn)==null||i.push(kn.Phase.Session,"syntacticCheck",{file:t,configFilePath:n.canonicalConfigFilePath}),this.sendDiagnosticsEvent(t,n,n.getLanguageService().getSyntacticDiagnostics(t),"syntaxDiag",o),(s=kn)==null||s.pop()}suggestionCheck(t,n){var i,s;let o=Lo();(i=kn)==null||i.push(kn.Phase.Session,"suggestionCheck",{file:t,configFilePath:n.canonicalConfigFilePath}),this.sendDiagnosticsEvent(t,n,n.getLanguageService().getSuggestionDiagnostics(t),"suggestionDiag",o),(s=kn)==null||s.pop()}regionSemanticCheck(t,n,i){var s,o,u;let m=Lo();(s=kn)==null||s.push(kn.Phase.Session,"regionSemanticCheck",{file:t,configFilePath:n.canonicalConfigFilePath});let p;if(!this.shouldDoRegionCheck(t)||!(p=n.getLanguageService().getRegionSemanticDiagnostics(t,i))){(o=kn)==null||o.pop();return}this.sendDiagnosticsEvent(t,n,p.diagnostics,"regionSemanticDiag",m,p.spans),(u=kn)==null||u.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,u){try{let m=O.checkDefined(n.getScriptInfo(t)),p=Lo()-o,x={file:t,diagnostics:i.map(b=>Kje(t,n,b)),spans:u==null?void 0:u.map(b=>Tg(b,m))};this.event(x,s),this.addDiagnosticsPerformanceData(t,s,p)}catch(m){this.logError(m,s)}}updateErrorCheck(t,n,i,s=!0){if(n.length===0)return;O.assert(!this.suppressDiagnosticEvents);let o=this.changeSeq,u=Math.min(i,200),m=0,p=()=>{if(m++,n.length>m)return t.delay("checkOne",u,b)},x=(T,E)=>{if(this.semanticCheck(T,E),this.changeSeq===o){if(this.getPreferences(T).disableSuggestions)return p();t.immediate("suggestionCheck",()=>{this.suggestionCheck(T,E),p()})}},b=()=>{if(this.changeSeq!==o)return;let T,E=n[m];if(zs(E)?E=this.toPendingErrorCheck(E):"ranges"in E&&(T=E.ranges,E=this.toPendingErrorCheck(E.file)),!E)return p();let{fileName:P,project:N}=E;if($d(N),!!N.containsFile(P,s)&&(this.syntacticCheck(P,N),this.changeSeq===o)){if(N.projectService.serverMode!==0)return p();if(T)return t.immediate("regionSemanticCheck",()=>{let F=this.projectService.getScriptInfoForNormalizedPath(P);F&&this.regionSemanticCheck(P,N,T.map(M=>this.getRange({file:P,...M},F))),this.changeSeq===o&&t.immediate("semanticCheck",()=>x(P,N))});t.immediate("semanticCheck",()=>x(P,N))}};n.length>m&&this.changeSeq===o&&t.delay("checkOne",i,b)}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",Es(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=Po(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(),u=Bn(os(s,o),m=>!!m.file&&m.file.fileName===t);return i?this.convertToDiagnosticsWithLinePositionFromDiagnosticFile(u):Nr(u,m=>Z7(m,!1))}convertToDiagnosticsWithLinePositionFromDiagnosticFile(t){return t.map(n=>({message:yg(n.messageText,this.host.newLine),start:n.start,length:n.length,category:R2(n),code:n.code,source:n.source,startLocation:n.file&&v6(oa(n.file,n.start)),endLocation:n.file&&v6(oa(n.file,n.start+n.length)),reportsUnnecessary:n.reportsUnnecessary,reportsDeprecated:n.reportsDeprecated,relatedInformation:Nr(n.relatedInformation,YQ)}))}getCompilerOptionsDiagnostics(t){let n=this.getProject(t.projectFileName);return this.convertToDiagnosticsWithLinePosition(Bn(n.getLanguageService().getCompilerOptionsDiagnostics(),i=>!i.file),void 0)}convertToDiagnosticsWithLinePosition(t,n){return t.map(i=>({message:yg(i.messageText,this.host.newLine),start:i.start,length:i.length,category:R2(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:Nr(i.relatedInformation,YQ)}))}getDiagnosticsWorker(t,n,i,s){let{project:o,file:u}=this.getFileAndProject(t);if(n&&Zje(o,u))return Yl;let m=o.getScriptInfoForNormalizedPath(u),p=i(o,u);return s?this.convertToDiagnosticsWithLinePosition(p,m):p.map(x=>Kje(u,o,x))}getDefinition(t,n){let{file:i,project:s}=this.getFileAndProject(t),o=this.getPositionInFile(t,i),u=this.mapDefinitionInfoLocations(s.getLanguageService().getDefinitionAtPosition(i,o)||Yl,s);return n?this.mapDefinitionInfo(u,s):u.map(Vne.mapToOriginalLocation)}mapDefinitionInfoLocations(t,n){return t.map(i=>{let s=n$e(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),u=O.checkDefined(s.getScriptInfo(i)),m=s.getLanguageService().getDefinitionAndBoundSpan(i,o);if(!m||!m.definitions)return{definitions:Yl,textSpan:void 0};let p=this.mapDefinitionInfoLocations(m.definitions,s),{textSpan:x}=m;return n?{definitions:this.mapDefinitionInfo(p,s),textSpan:Tg(x,u)}:{definitions:p.map(Vne.mapToOriginalLocation),textSpan:x}}findSourceDefinition(t){var n;let{file:i,project:s}=this.getFileAndProject(t),o=this.getPositionInFile(t,i),u=s.getLanguageService().getDefinitionAtPosition(i,o),m=this.mapDefinitionInfoLocations(u||Yl,s).slice();if(this.projectService.serverMode===0&&(!St(m,P=>Po(P.fileName)!==i&&!P.isAmbient)||St(m,P=>!!P.failedAliasResolution))){let P=tU(j=>j.textSpan.start,pK(this.host.useCaseSensitiveFileNames));m==null||m.forEach(j=>P.add(j));let N=s.getNoDtsResolutionProject(i),F=N.getLanguageService(),M=(n=F.getDefinitionAtPosition(i,o,!0,!1))==null?void 0:n.filter(j=>Po(j.fileName)!==i);if(St(M))for(let j of M){if(j.unverified){let U=T(j,s.getLanguageService().getProgram(),F.getProgram());if(St(U)){for(let J of U)P.add(J);continue}}P.add(j)}else{let j=m.filter(U=>Po(U.fileName)!==i&&U.isAmbient);for(let U of St(j)?j:b()){let J=x(U.fileName,i,N);if(!J)continue;let q=this.projectService.getOrCreateScriptInfoNotOpenedByClient(J,N.currentDirectory,N.directoryStructureHost,!1);if(!q)continue;N.containsScriptInfo(q)||(N.addRoot(q),N.updateGraph());let H=F.getProgram(),te=O.checkDefined(H.getSourceFile(J));for(let se of E(U.name,te,H))P.add(se)}}m=Es(P.values())}return m=m.filter(P=>!P.isAmbient&&!P.failedAliasResolution),this.mapDefinitionInfo(m,s);function x(P,N,F){var M,j,U;let J=yM(P);if(J&&P.lastIndexOf(qh)===J.topLevelNodeModulesIndex){let q=P.substring(0,J.packageRootIndex),H=(M=s.getModuleResolutionCache())==null?void 0:M.getPackageJsonInfoCache(),te=s.getCompilationSettings(),se=k4(ys(q,s.getCurrentDirectory()),T4(H,s,te));if(!se)return;let X=LG(se,{moduleResolution:2},s,s.getModuleResolutionCache()),Te=P.substring(J.topLevelPackageNameIndex+1,J.packageRootIndex),ue=C4(yO(Te)),Q=s.toPath(P);if(X&&St(X,he=>s.toPath(he)===Q))return(j=F.resolutionCache.resolveSingleModuleNameWithoutWatching(ue,N).resolvedModule)==null?void 0:j.resolvedFileName;{let he=P.substring(J.packageRootIndex+1),ge=`${ue}/${N_(he)}`;return(U=F.resolutionCache.resolveSingleModuleNameWithoutWatching(ge,N).resolvedModule)==null?void 0:U.resolvedFileName}}}function b(){let P=s.getLanguageService(),N=P.getProgram(),F=mf(N.getSourceFile(i),o);return(lo(F)||Ke(F))&&Zo(F.parent)&&Pce(F,M=>{var j;if(M===F)return;let U=(j=P.getDefinitionAtPosition(i,M.getStart(),!0,!1))==null?void 0:j.filter(J=>Po(J.fileName)!==i&&J.isAmbient).map(J=>({fileName:J.fileName,name:Xp(F)}));if(St(U))return U})||Yl}function T(P,N,F){var M;let j=F.getSourceFile(P.fileName);if(!j)return;let U=mf(N.getSourceFile(i),o),J=N.getTypeChecker().getSymbolAtLocation(U),q=J&&oc(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(P,N,F){let M=Xo.Core.getTopMostDeclarationNamesInFile(P,N);return rs(M,j=>{let U=F.getTypeChecker().getSymbolAtLocation(j),J=SI(j);if(U&&J)return d6.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=>Z7(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(u=>u.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),u=s.toLineColumnOffset(t,Pc(n));return{file:t,start:{line:o.line+1,offset:o.character+1},end:{line:u.line+1,offset:u.character+1}}}toFileSpanWithContext(t,n,i,s){let o=this.toFileSpan(t,n,s),u=i&&this.toFileSpan(t,i,s);return u?{...o,contextStart:u.start,contextEnd:u.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)||Yl,i);return this.mapDefinitionInfo(o,i)}mapImplementationLocations(t,n){return t.map(i=>{let s=n$e(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),u=this.mapImplementationLocations(s.getLanguageService().getImplementationAtPosition(i,o)||Yl,s);return n?u.map(({fileName:m,textSpan:p,contextSpan:x})=>this.toFileSpanWithContext(m,p,x,s)):u.map(Vne.mapToOriginalLocation)}getSyntacticDiagnosticsSync(t){let{configFile:n}=this.getConfigFileAndProject(t);return n?Yl: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(u=>!!u.file),!!t.includeLinePosition)}getSuggestionDiagnosticsSync(t){let{configFile:n}=this.getConfigFileAndProject(t);return n?Yl: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),u=this.projectService.getScriptInfoForNormalizedPath(n);if(!(u===void 0||o===void 0))return I1t(o,u)}getDocumentHighlights(t,n){let{file:i,project:s}=this.getFileAndProject(t),o=this.getPositionInFile(t,i),u=s.getLanguageService().getDocumentHighlights(i,o,t.filesToSearch);return u?n?u.map(({fileName:m,highlightSpans:p})=>{let x=s.getScriptInfo(m);return{file:m,highlightSpans:p.map(({textSpan:b,kind:T,contextSpan:E})=>({...Eve(b,E,x),kind:T}))}}):u:Yl}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(u=>{let{position:m,displayParts:p}=u;return{...u,position:s.positionToLineOffset(m),displayParts:p==null?void 0:p.map(({text:x,span:b,file:T})=>{if(b){O.assertIsDefined(T,"Target file should be defined together with its span.");let E=this.projectService.getScriptInfo(T);return{text:x,span:{start:E.positionToLineOffset(b.start),end:E.positionToLineOffset(b.start+b.length),file:T}}}else return{text:x}})}})}mapCode(t){var n;let i=this.getHostFormatOptions(),s=this.getHostPreferences(),{file:o,languageService:u}=this.getFileAndLanguageServiceForSyntacticOperation(t),m=this.projectService.getScriptInfoForNormalizedPath(o),p=(n=t.mapping.focusLocations)==null?void 0:n.map(b=>b.map(T=>{let E=m.lineOffsetToPosition(T.start.line,T.start.offset),P=m.lineOffsetToPosition(T.end.line,T.end.offset);return{start:E,length:P-E}})),x=u.mapCode(o,t.mapping.contents,p,i,s);return this.mapTextChangesToCodeEdits(x)}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:u}=this.getFileAndProjectWorker(t,n);return $d(u),{configFileName:u.getProjectName(),languageServiceDisabled:!u.languageServiceEnabled,fileNames:i?u.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,u;return s.seenProjects.forEach((m,p)=>{p!==s.defaultProject&&(m!==3?(o??(o=[])).push(Po(p.getConfigFilePath())):(u??(u=[])).push(Po(p.getConfigFilePath())))}),(n=s.seenConfigs)==null||n.forEach(m=>(o??(o=[])).push(m)),{notMatchedByConfig:o,notInProject:u,defaultProject:s.defaultProject&&Po(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 u=this.getProject(t.projectFileName);u&&(s=[u])}else{let u=n?this.projectService.getScriptInfoEnsuringProjectsUptoDate(t.file):this.projectService.getScriptInfo(t.file);if(u)n||this.projectService.ensureDefaultProjectForFile(u);else return i?Yl:(this.projectService.logErrorForScriptInfoNotFound(t.file),Wy.ThrowNoProject());s=u.containingProjects,o=this.projectService.getSymlinkedProjects(u)}return s=Bn(s,u=>u.languageServiceEnabled&&!u.isOrphan()),!i&&(!s||!s.length)&&!o?(this.projectService.logErrorForScriptInfoNotFound(t.file??t.projectFileName),Wy.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 Wy.ThrowNoProject()}return this.projectService.getScriptInfo(t.file).getDefaultProject()}getRenameLocations(t,n){let i=Po(t.file),s=this.getPositionInFile(t,i),o=this.getProjects(t),u=this.getDefaultProject(t),m=this.getPreferences(i),p=this.mapRenameInfo(u.getLanguageService().getRenameInfo(i,s,m),O.checkDefined(this.projectService.getScriptInfo(i)));if(!p.canRename)return n?{info:p,locs:[]}:[];let x=k1t(o,u,{fileName:t.file,pos:s},!!t.findInStrings,!!t.findInComments,m,this.host.useCaseSensitiveFileNames);return n?{info:p,locs:this.toSpanGroups(x)}:x}mapRenameInfo(t,n){if(t.canRename){let{canRename:i,fileToRename:s,displayName:o,fullDisplayName:u,kind:m,kindModifiers:p,triggerSpan:x}=t;return{canRename:i,fileToRename:s,displayName:o,fullDisplayName:u,kind:m,kindModifiers:p,triggerSpan:Tg(x,n)}}else return t}toSpanGroups(t){let n=new Map;for(let{fileName:i,textSpan:s,contextSpan:o,originalContextSpan:u,originalTextSpan:m,originalFileName:p,...x}of t){let b=n.get(i);b||n.set(i,b={file:i,locs:[]});let T=O.checkDefined(this.projectService.getScriptInfo(i));b.locs.push({...Eve(s,o,T),...x})}return Es(n.values())}getReferences(t,n){let i=Po(t.file),s=this.getProjects(t),o=this.getPositionInFile(t,i),u=C1t(s,this.getDefaultProject(t),{fileName:t.file,pos:o},this.host.useCaseSensitiveFileNames,this.logger);if(!n)return u;let m=this.getPreferences(i),p=this.getDefaultProject(t),x=p.getScriptInfoForNormalizedPath(i),b=p.getLanguageService().getQuickInfoAtPosition(i,o),T=b?v7(b.displayParts):"",E=b&&b.textSpan,P=E?x.positionToLineOffset(E.start).offset:0,N=E?x.getSnapshot().getText(E.start,Pc(E)):"";return{refs:Ga(u,M=>M.references.map(j=>c$e(this.projectService,j,m))),symbolName:N,symbolStartOffset:P,symbolDisplayString:T}}getFileReferences(t,n){let i=this.getProjects(t),s=Po(t.file),o=this.getPreferences(s),u={fileName:s,pos:0},m=wve(i,this.getDefaultProject(t),u,u,e$e,b=>(this.logger.info(`Finding references to file ${s} in project ${b.getProjectName()}`),b.getLanguageService().getFileReferences(s))),p;if(Ps(m))p=m;else{p=[];let b=eY(this.host.useCaseSensitiveFileNames);m.forEach(T=>{for(let E of T)b.has(E)||(p.push(E),b.add(E))})}return n?{refs:p.map(b=>c$e(this.projectService,b,o)),symbolName:`"${t.file}"`}:p}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=Po(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 u=this.projectService.getScriptInfoForNormalizedPath(i);return o.map(m=>({textSpan:Tg(m.textSpan,u),hintSpan:Tg(m.hintSpan,u),bannerText:m.bannerText,autoCollapse:m.autoCollapse,kind:m.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?y6(t.options):this.getFormatOptions(n),u=i.getIndentationAtPosition(n,s,o);return{position:s,indentation:u}}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),u=this.getPreferences(i),m=s.getLanguageService().getQuickInfoAtPosition(i,this.getPosition(t,o),u.maximumHoverLength,t.verbosityLevel);if(!m)return;let p=!!u.displayPartsForJSDoc;if(n){let x=v7(m.displayParts);return{kind:m.kind,kindModifiers:m.kindModifiers,start:o.positionToLineOffset(m.textSpan.start),end:o.positionToLineOffset(Pc(m.textSpan)),displayString:x,documentation:p?this.mapDisplayParts(m.documentation,s):v7(m.documentation),tags:this.mapJSDocTagInfo(m.tags,s,p),canIncreaseVerbosityLevel:m.canIncreaseVerbosityLevel}}else return p?m:{...m,tags:this.mapJSDocTagInfo(m.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),u=s.lineOffsetToPosition(t.endLine,t.endOffset),m=i.getFormattingEditsForRange(n,o,u,this.getFormatOptions(n));if(m)return m.map(p=>this.convertTextChangeToCodeEdit(p,s))}getFormattingEditsForRangeFull(t){let{file:n,languageService:i}=this.getFileAndLanguageServiceForSyntacticOperation(t),s=t.options?y6(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?y6(t.options):this.getFormatOptions(n);return i.getFormattingEditsForDocument(n,s)}getFormattingEditsAfterKeystrokeFull(t){let{file:n,languageService:i}=this.getFileAndLanguageServiceForSyntacticOperation(t),s=t.options?y6(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),u=this.getFormatOptions(n),m=i.getFormattingEditsAfterKeystroke(n,o,t.key,u);if(t.key===`
432
432
  `&&(!m||m.length===0||S1t(m,o))){let{lineText:p,absolutePosition:x}=s.textStorage.getAbsolutePositionAndLineText(t.line);if(p&&p.search("\\S")<0){let b=i.getIndentationAtPosition(n,o,u),T=0,E,P;for(E=0,P=p.length;E<P;E++)if(p.charAt(E)===" ")T++;else if(p.charAt(E)===" ")T+=u.tabSize;else break;if(b!==T){let N=x+E;m.push({span:al(x,N),newText:Ll.getIndentationString(b,u)})}}}if(m)return m.map(p=>({start:s.positionToLineOffset(p.span.start),end:s.positionToLineOffset(Pc(p.span)),newText:p.newText?p.newText:""}))}getCompletions(t,n){let{file:i,project:s}=this.getFileAndProject(t),o=this.projectService.getScriptInfoForNormalizedPath(i),u=this.getPosition(t,o),m=s.getLanguageService().getCompletionsAtPosition(i,u,{...cve(this.getPreferences(i)),triggerCharacter:t.triggerCharacter,triggerKind:t.triggerKind,includeExternalModuleExports:t.includeExternalModuleExports,includeInsertTextCompletions:t.includeInsertTextCompletions},s.projectService.getFormatCodeOptions(i));if(m===void 0)return;if(n==="completions-full")return m;let p=t.prefix||"",x=rs(m.entries,T=>{if(m.isMemberCompletion||us(T.name.toLowerCase(),p.toLowerCase())){let E=T.replacementSpan?Tg(T.replacementSpan,o):void 0;return{...T,replacementSpan:E,hasAction:T.hasAction||void 0,symbol:void 0}}});return n==="completions"?(m.metadata&&(x.metadata=m.metadata),x):{...m,optionalReplacementSpan:m.optionalReplacementSpan&&Tg(m.optionalReplacementSpan,o),entries:x}}getCompletionEntryDetails(t,n){let{file:i,project:s}=this.getFileAndProject(t),o=this.projectService.getScriptInfoForNormalizedPath(i),u=this.getPosition(t,o),m=s.projectService.getFormatCodeOptions(i),p=!!this.getPreferences(i).displayPartsForJSDoc,x=rs(t.entryNames,b=>{let{name:T,source:E,data:P}=typeof b=="string"?{name:b,source:void 0,data:void 0}:b;return s.getLanguageService().getCompletionEntryDetails(i,u,T,m,E,this.getPreferences(i),P?fa(P,L1t):void 0)});return n?p?x:x.map(b=>({...b,tags:this.mapJSDocTagInfo(b.tags,s,!1)})):x.map(b=>({...b,codeActions:Nr(b.codeActions,T=>this.mapCodeAction(T)),documentation:this.mapDisplayParts(b.documentation,s),tags:this.mapJSDocTagInfo(b.tags,s,p)}))}getCompileOnSaveAffectedFileList(t){let n=this.getProjects(t,!0,!0),i=this.projectService.getScriptInfo(t.file);return i?T1t(i,s=>this.projectService.getScriptInfoForPath(s),n,(s,o)=>{if(!s.compileOnSaveEnabled||!s.languageServiceEnabled||s.isOrphan())return;let u=s.getCompilationSettings();if(!(u.noEmit||_u(o.fileName)&&!b1t(u)))return{projectFileName:s.getProjectName(),fileNames:s.getCompileOnSaveAffectedFileList(o),projectUsesOutFile:!!u.outFile}}):Yl}emitFile(t){let{file:n,project:i}=this.getFileAndProject(t);if(i||Wy.ThrowNoProject(),!i.languageServiceEnabled)return t.richResponse?{emitSkipped:!0,diagnostics:[]}:!1;let s=i.getScriptInfo(n),{emitSkipped:o,diagnostics:u}=i.emitFile(s,(m,p,x)=>this.host.writeFile(m,p,x));return t.richResponse?{emitSkipped:o,diagnostics:t.includeLinePosition?this.convertToDiagnosticsWithLinePositionFromDiagnosticFile(u):u.map(m=>Z7(m,!0))}:!o}getSignatureHelpItems(t,n){let{file:i,project:s}=this.getFileAndProject(t),o=this.projectService.getScriptInfoForNormalizedPath(i),u=this.getPosition(t,o),m=s.getLanguageService().getSignatureHelpItems(i,u,t),p=!!this.getPreferences(i).displayPartsForJSDoc;if(m&&n){let x=m.applicableSpan;return{...m,applicableSpan:{start:o.positionToLineOffset(x.start),end:o.positionToLineOffset(x.start+x.length)},items:this.mapSignatureHelpItems(m.items,s,p)}}else return p||!m?m:{...m,items:m.items.map(x=>({...x,tags:this.mapJSDocTagInfo(x.tags,s,!1)}))}}toPendingErrorCheck(t){let n=Po(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,fie({span:{start:i,length:s-i},newText:t.insertString})))}reload(t){let n=Po(t.file),i=t.tmpfile===void 0?void 0:Po(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=ma(t);this.projectService.closeClientFile(n)}mapLocationNavigationBarItems(t,n){return Nr(t,i=>({text:i.text,kind:i.kind,kindModifiers:i.kindModifiers,spans:i.spans.map(s=>Tg(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=>Tg(i,n)),nameSpan:t.nameSpan&&Tg(t.nameSpan,n),childItems:Nr(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?Ga(i,({project:s,navigateToItems:o})=>o.map(u=>{let m=s.getScriptInfo(u.fileName),p={name:u.name,kind:u.kind,kindModifiers:u.kindModifiers,isCaseSensitive:u.isCaseSensitive,matchKind:u.matchKind,file:u.fileName,start:m.positionToLineOffset(u.textSpan.start),end:m.positionToLineOffset(Pc(u.textSpan))};return u.kindModifiers&&u.kindModifiers!==""&&(p.kindModifiers=u.kindModifiers),u.containerName&&u.containerName.length>0&&(p.containerName=u.containerName),u.containerKind&&u.containerKind.length>0&&(p.containerKind=u.containerKind),p})):Ga(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:P}=this.getFileAndProject(t);return[{project:P,navigateToItems:P.getLanguageService().getNavigateToItems(i,s,E)}]}let u=this.getHostPreferences(),m=[],p=new Map;if(!t.file&&!o)this.projectService.loadAncestorProjectTree(),this.projectService.forEachEnabledProject(E=>x(E));else{let E=this.getProjects(t);Yje(E,void 0,P=>x(P))}return m;function x(E){let P=E.getLanguageService().getNavigateToItems(i,s,void 0,E.isNonTsProject(),u.excludeLibrarySymbolsInNavTo),N=Bn(P,F=>b(F)&&!tY(vN(F),E));N.length&&m.push({project:E,navigateToItems:N})}function b(E){let P=E.name;if(!p.has(P))return p.set(P,[E]),!0;let N=p.get(P);for(let F of N)if(T(F,E))return!1;return N.push(E),!0}function T(E,P){return E===P?!0:!E||!P?!1:E.containerKind===P.containerKind&&E.containerName===P.containerName&&E.fileName===P.fileName&&E.isCaseSensitive===P.isCaseSensitive&&E.kind===P.kind&&E.kindModifiers===P.kindModifiers&&E.matchKind===P.matchKind&&E.name===P.name&&E.textSpan.start===P.textSpan.start&&E.textSpan.length===P.textSpan.length}}getSupportedCodeFixes(t){if(!t)return yX();if(t.file){let{file:i,project:s}=this.getFileAndProject(t);return s.getLanguageService().getSupportedCodeFixes(i)}let n=this.getProject(t.projectFileName);return n||Wy.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(u){return u.position!==void 0?u.position:n.lineOffsetToPosition(u.line,u.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(u=>({...u,actions:u.actions.map(m=>({...m,range:m.range?{start:v6({line:m.range.start.line,character:m.range.start.offset}),end:v6({line:m.range.end.line,character:m.range.end.offset})}:void 0}))}))}getEditsForRefactor(t,n){let{file:i,project:s}=this.getFileAndProject(t),o=s.getScriptInfoForNormalizedPath(i),u=s.getLanguageService().getEditsForRefactor(i,this.getFormatOptions(i),this.extractPositionOrRange(t,o),t.refactor,t.action,this.getPreferences(i),t.interactiveRefactorArguments);if(u===void 0)return{edits:[]};if(n){let{renameFilename:m,renameLocation:p,edits:x}=u,b;if(m!==void 0&&p!==void 0){let T=s.getScriptInfoForNormalizedPath(Po(m));b=Dve(dw(T.getSnapshot()),m,p,x)}return{renameLocation:b,renameFilename:m,edits:this.mapTextChangesToCodeEdits(x),notApplicableReason:u.notApplicableReason}}return u}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(hN(n))return;let s=t.copiedFrom?{file:t.copiedFrom.file,range:t.copiedFrom.spans.map(u=>this.getRange({file:t.copiedFrom.file,startLine:u.start.line,startOffset:u.start.offset,endLine:u.end.line,endOffset:u.end.offset},i.getScriptInfoForNormalizedPath(Po(t.copiedFrom.file))))}:void 0,o=i.getLanguageService().getPasteEdits({targetFile:n,pastedText:t.pastedText,pasteLocations:t.pasteLocations.map(u=>this.getRange({file:n,startLine:u.start.line,startOffset:u.start.offset,endLine:u.end.line,endOffset:u.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=Po(t.oldFilePath),s=Po(t.newFilePath),o=this.getHostFormatOptions(),u=this.getHostPreferences(),m=new Set,p=[];return this.projectService.loadAncestorProjectTree(),this.projectService.forEachEnabledProject(x=>{let b=x.getLanguageService().getEditsForFileRename(i,s,o,u),T=[];for(let E of b)m.has(E.fileName)||(p.push(E),T.push(E.fileName));for(let E of T)m.add(E)}),n?p.map(x=>this.mapTextChangeToCodeEdit(x)):p}getCodeFixes(t,n){let{file:i,project:s}=this.getFileAndProject(t),o=s.getScriptInfoForNormalizedPath(i),{startPosition:u,endPosition:m}=this.getStartAndEndPosition(t,o),p;try{p=s.getLanguageService().getCodeFixesAtPosition(i,u,m,t.errorCodes,this.getFormatOptions(i),this.getPreferences(i))}catch(x){let b=x instanceof Error?x:new Error(x),T=s.getLanguageService(),E=[...T.getSyntacticDiagnostics(i),...T.getSemanticDiagnostics(i),...T.getSuggestionDiagnostics(i)].filter(N=>c3(u,m-u,N.start,N.length)).map(N=>N.code),P=t.errorCodes.find(N=>!E.includes(N));throw P!==void 0&&(b.message+=`
433
433
  Additional information: BADCLIENT: Bad error code, ${P} not found in range ${u}..${m} (found: ${E.join(", ")})`),b}return n?p.map(x=>this.mapCodeFixAction(x)):p}getCombinedCodeFix({scope:t,fixId:n},i){O.assert(t.type==="file");let{file:s,project:o}=this.getFileAndProject(t.args),u=o.getLanguageService().getCombinedCodeFix({type:"file",fileName:s},n,this.getFormatOptions(s),this.getPreferences(s));return i?{changes:this.mapTextChangesToCodeEdits(u.changes),commands:u.commands}:u}applyCodeActionCommand(t){let n=t.command;for(let i of Qk(n)){let{file:s,project:o}=this.getFileAndProject(i);o.getLanguageService().applyCodeActionCommand(i,this.getFormatOptions(s)).then(u=>{},u=>{})}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:u}){return{fixName:t,description:n,changes:this.mapTextChangesToCodeEdits(i),commands:s,fixId:o,fixAllDescription:u}}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=>P1t(i,n))}:A1t(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),u=this.getPosition(t,o),m=s.getBraceMatchingAtPosition(i,u);return m?n?m.map(p=>Tg(p,o)):m: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 u=s.filter(F=>!F.includes("lib.d.ts"));if(u.length===0)return;let m=[],p=[],x=[],b=[],T=Po(i),E=this.projectService.ensureDefaultProjectForFile(T);for(let F of u)this.getCanonicalFileName(F)===this.getCanonicalFileName(i)?m.push(F):this.projectService.getScriptInfo(F).isScriptOpen()?p.push(F):_u(F)?b.push(F):x.push(F);let N=[...m,...p,...x,...b].map(F=>({fileName:F,project:E}));this.updateErrorCheck(t,N,n,!1)}configurePlugin(t){this.projectService.configurePlugin(t)}getSmartSelectionRange(t,n){let{locations:i}=t,{file:s,languageService:o}=this.getFileAndLanguageServiceForSyntacticOperation(t),u=O.checkDefined(this.projectService.getScriptInfo(s));return Nr(i,m=>{let p=this.getPosition(m,u),x=o.getSmartSelectionRange(s,p);return n?this.mapSelectionRange(x,u):x})}toggleLineComment(t,n){let{file:i,languageService:s}=this.getFileAndLanguageServiceForSyntacticOperation(t),o=this.projectService.getScriptInfo(i),u=this.getRange(t,o),m=s.toggleLineComment(i,u);if(n){let p=this.projectService.getScriptInfoForNormalizedPath(i);return m.map(x=>this.convertTextChangeToCodeEdit(x,p))}return m}toggleMultilineComment(t,n){let{file:i,languageService:s}=this.getFileAndLanguageServiceForSyntacticOperation(t),o=this.projectService.getScriptInfoForNormalizedPath(i),u=this.getRange(t,o),m=s.toggleMultilineComment(i,u);if(n){let p=this.projectService.getScriptInfoForNormalizedPath(i);return m.map(x=>this.convertTextChangeToCodeEdit(x,p))}return m}commentSelection(t,n){let{file:i,languageService:s}=this.getFileAndLanguageServiceForSyntacticOperation(t),o=this.projectService.getScriptInfoForNormalizedPath(i),u=this.getRange(t,o),m=s.commentSelection(i,u);if(n){let p=this.projectService.getScriptInfoForNormalizedPath(i);return m.map(x=>this.convertTextChangeToCodeEdit(x,p))}return m}uncommentSelection(t,n){let{file:i,languageService:s}=this.getFileAndLanguageServiceForSyntacticOperation(t),o=this.projectService.getScriptInfoForNormalizedPath(i),u=this.getRange(t,o),m=s.uncommentSelection(i,u);if(n){let p=this.projectService.getScriptInfoForNormalizedPath(i);return m.map(x=>this.convertTextChangeToCodeEdit(x,p))}return m}mapSelectionRange(t,n){let i={textSpan:Tg(t.textSpan,n)};return t.parent&&(i.parent=this.mapSelectionRange(t.parent,n)),i}getScriptInfoFromProjectService(t){let n=Po(t),i=this.projectService.getScriptInfoForNormalizedPath(n);return i||(this.projectService.logErrorForScriptInfoNotFound(n),Wy.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:Tg(t.span,n),selectionSpan:Tg(t.selectionSpan,n)}}toProtocolCallHierarchyIncomingCall(t){let n=this.getScriptInfoFromProjectService(t.from.file);return{from:this.toProtocolCallHierarchyItem(t.from),fromSpans:t.fromSpans.map(i=>Tg(i,n))}}toProtocolCallHierarchyOutgoingCall(t,n){return{to:this.toProtocolCallHierarchyItem(t.to),fromSpans:t.fromSpans.map(i=>Tg(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),u=i.getLanguageService().prepareCallHierarchy(n,o);return u&&DK(u,m=>this.toProtocolCallHierarchyItem(m))}}provideCallHierarchyIncomingCalls(t){let{file:n,project:i}=this.getFileAndProject(t),s=this.getScriptInfoFromProjectService(n);return i.getLanguageService().provideCallHierarchyIncomingCalls(n,this.getPosition(t,s)).map(u=>this.toProtocolCallHierarchyIncomingCall(u))}provideCallHierarchyOutgoingCalls(t){let{file:n,project:i}=this.getFileAndProject(t),s=this.getScriptInfoFromProjectService(n);return i.getLanguageService().provideCallHierarchyOutgoingCalls(n,this.getPosition(t,s)).map(u=>this.toProtocolCallHierarchyOutgoingCall(u,s))}getCanonicalFileName(t){let n=this.host.useCaseSensitiveFileNames?t:jv(t);return ma(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:${Kb(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,u,m,p;this.gcTimer.scheduleCollect();let x,b=this.performanceData;this.logger.hasLevel(2)&&(x=this.hrtime(),this.logger.hasLevel(3)&&this.logger.info(`request:${U4(this.toStringMessage(t))}`));let T,E;try{T=this.parseMessage(t),E=T.arguments&&T.arguments.file?T.arguments:void 0,(n=kn)==null||n.instant(kn.Phase.Session,"request",{seq:T.seq,command:T.command}),(i=kn)==null||i.push(kn.Phase.Session,"executeCommand",{seq:T.seq,command:T.command},!0);let{response:P,responseRequired:N,performanceData:F}=this.executeCommand(T);if((s=kn)==null||s.pop(),this.logger.hasLevel(2)){let M=v1t(this.hrtime(x)).toFixed(4);N?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=kn)==null||o.instant(kn.Phase.Session,"response",{seq:T.seq,command:T.command,success:!!P}),P?this.doOutput(P,T.command,T.seq,!0,F):N&&this.doOutput(void 0,T.command,T.seq,!1,F,"No content available.")}catch(P){if((u=kn)==null||u.popAll(),P instanceof $P){(m=kn)==null||m.instant(kn.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(P,this.toStringMessage(t),E),(p=kn)==null||p.instant(kn.Phase.Session,"commandError",{seq:T==null?void 0:T.seq,command:T==null?void 0:T.command,message:P.message}),this.doOutput(void 0,T?T.command:"unknown",T?T.seq:0,!1,this.performanceData,"Error processing request. "+P.message+`
434
- `+P.stack)}finally{this.performanceData=b}}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 a$e(e){let t=e.diagnosticsDuration&&Es(e.diagnosticsDuration,([n,i])=>({...i,file:n}));return{...e,diagnosticsDuration:t}}function Tg(e,t){return{start:t.positionToLineOffset(e.start),end:t.positionToLineOffset(Pc(e))}}function Eve(e,t,n){let i=Tg(e,n),s=t&&Tg(t,n);return s?{...i,contextStart:s.start,contextEnd:s.end}:i}function P1t(e,t){return{start:o$e(t,e.span.start),end:o$e(t,Pc(e.span)),newText:e.newText}}function o$e(e,t){return bve(e)?N1t(e.getLineAndCharacterOfPosition(t)):e.positionToLineOffset(t)}function I1t(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 N1t(e){return{line:e.line+1,offset:e.character+1}}function A1t(e){O.assert(e.textChanges.length===1);let t=Ha(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 Dve(e,t,n,i){let s=O1t(e,t,i),{line:o,character:u}=FE(sC(s),n);return{line:o+1,offset:u+1}}function O1t(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:u,span:{start:m,length:p}}=s[o];e=e.slice(0,m)+u+e.slice(m+p)}return e}function c$e(e,{fileName:t,textSpan:n,contextSpan:i,isWriteAccess:s,isDefinition:o},{disableLineTextInReferences:u}){let m=O.checkDefined(e.getScriptInfo(t)),p=Eve(n,i,m),x=u?void 0:F1t(m,p);return{file:t,...p,lineText:x,isWriteAccess:s,isDefinition:o}}function F1t(e,t){let n=e.lineToTextSpan(t.start.line-1);return e.getSnapshot().getText(n.start,Pc(n)).replace(/\r|\n/g,"")}function L1t(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 b6=4,Pve=(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))(Pve||{}),M1t=class{constructor(){this.goSubtree=!0,this.lineIndex=new K7,this.endBranch=[],this.state=2,this.initialText="",this.trailingText="",this.lineIndex.root=new S6,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=K7.linesFromText(e).lines;i.length>1&&i[i.length-1]===""&&i.pop();let s,o;for(let m=this.endBranch.length-1;m>=0;m--)this.endBranch[m].updateCounts(),this.endBranch[m].charCount()===0&&(o=this.endBranch[m],m>0?s=this.endBranch[m-1]:s=this.branchNode);o&&s.remove(o);let u=this.startPath[this.startPath.length-1];if(i.length>0)if(u.text=i[0],i.length>1){let m=new Array(i.length-1),p=u;for(let T=1;T<i.length;T++)m[T-1]=new ez(i[T]);let x=this.startPath.length-2;for(;x>=0;){let T=this.startPath[x];m=T.insertAt(p,m),x--,p=T}let b=m.length;for(;b>0;){let T=new S6;T.add(this.lineIndex.root),m=T.insertAt(this.lineIndex.root,m),b=m.length,this.lineIndex.root=T}this.lineIndex.root.updateCounts()}else for(let m=this.startPath.length-2;m>=0;m--)this.startPath[m].updateCounts();else{this.startPath[this.startPath.length-2].remove(u);for(let p=this.startPath.length-2;p>=0;p--)this.startPath[p].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 u;function m(p){return p.isLeaf()?new ez(""):new S6}switch(s){case 0:this.goSubtree=!1,this.state!==4&&o.add(n);break;case 1:this.state===4?this.goSubtree=!1:(u=m(n),o.add(u),this.startPath.push(u));break;case 2:this.state!==4?(u=m(n),o.add(u),this.startPath.push(u)):n.isLeaf()||(u=m(n),o.add(u),this.endBranch.push(u));break;case 3:this.goSubtree=!1;break;case 4:this.state!==4?this.goSubtree=!1:n.isLeaf()||(u=m(n),o.add(u),this.endBranch.push(u));break;case 5:this.goSubtree=!1,this.state!==1&&o.add(n);break}this.goSubtree&&this.stack.push(u)}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)}},R1t=class{constructor(e,t,n){this.pos=e,this.deleteLen=t,this.insertedText=n}getTextChangeRange(){return l3(Ou(this.pos,this.deleteLen),this.insertedText?this.insertedText.length:0)}},rY=class Wk{constructor(){this.changes=[],this.versions=new Array(Wk.maxVersions),this.minVersion=0,this.currentVersion=0}versionToIndex(t){if(!(t<this.minVersion||t>this.currentVersion))return t%Wk.maxVersions}currentVersionToIndex(){return this.currentVersion%Wk.maxVersions}edit(t,n,i){this.changes.push(new R1t(t,n,i)),(this.changes.length>Wk.changeNumberThreshold||n>Wk.changeLengthThreshold||i&&i.length>Wk.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 l$e(this.currentVersion+1,this,n,this.changes),this.currentVersion=t.version,this.versions[this.currentVersionToIndex()]=t,this.changes=[],this.currentVersion-this.minVersion>=Wk.maxVersions&&(this.minVersion=this.currentVersion-Wk.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 Ou(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 u of o.changesSincePreviousVersion)i.push(u.getTextChangeRange())}return fae(i)}else return;else return E9}getLineCount(){return this._getSnapshot().index.getLineCount()}static fromString(t){let n=new Wk,i=new l$e(0,n,new K7);n.versions[n.currentVersion]=i;let s=K7.linesFromText(t);return i.index.load(s.lines),n}};rY.changeNumberThreshold=8,rY.changeLengthThreshold=256,rY.maxVersions=8;var nY=rY,l$e=class mQe{constructor(t,n,i,s=Yl){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 mQe&&this.cache===t.cache)return this.version<=t.version?E9:this.cache.getTextChangesBetweenVersions(t.version,this.version)}},K7=class PEe{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 ez(t[i]);this.root=PEe.buildTreeFromBottom(n)}else this.root=new S6}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,u)=>{i=i.concat(u.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,u,m){t(m,o,u)||(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(PEe.linesFromText(i).lines),this):void 0;{let s;if(this.checkEdits){let m=this.getText(0,this.root.charCount());s=m.slice(0,t)+i+m.slice(t+n)}let o=new M1t,u=!1;if(t>=this.root.charCount()){t=this.root.charCount()-1;let m=this.getText(t,1);i?i=m+i:i=m,n=0,u=!0}else if(n>0){let m=t+n,{zeroBasedColumn:p,lineText:x}=this.positionToColumnAndLineText(m);p===0&&(n+=x.length,i=i?i+x:x)}if(this.root.walk(t,n,o),o.insertLines(i,u),this.checkEdits){let m=o.lineIndex.getText(0,o.lineIndex.getLength());O.assert(s===m,"buffer edit mismatch")}return o.lineIndex}}static buildTreeFromBottom(t){if(t.length<b6)return new S6(t);let n=new Array(Math.ceil(t.length/b6)),i=0;for(let s=0;s<n.length;s++){let o=Math.min(i+b6,t.length);n[s]=new S6(t.slice(i,o)),i=o}return this.buildTreeFromBottom(n)}static linesFromText(t){let n=sC(t);if(n.length===0)return{lines:[],lineMap:n};let i=new Array(n.length),s=n.length-1;for(let u=0;u<s;u++)i[u]=t.substring(n[u],n[u+1]);let o=t.substring(n[s]);return o.length>0?i[s]=o:i.pop(),{lines:i,lineMap:n}}},S6=class IEe{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(),u=t;for(;u>=o;)this.skipChild(u,n,s,i,0),u-=o,s++,o=this.children[s].charCount();if(u+n<=o){if(this.execWalk(u,n,i,s,2))return}else{if(this.execWalk(u,o-u,i,s,1))return;let m=n-(o-u);for(s++,o=this.children[s].charCount();m>o;){if(this.execWalk(0,o,i,s,3))return;m-=o,s++,o=this.children[s].charCount()}if(m>0&&this.execWalk(0,m,i,s,4))return}if(i.pre){let m=this.children.length;if(s<m-1)for(let p=s+1;p<m;p++)this.skipChild(0,0,p,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 IEe;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<b6&&i===s-1&&o===1)return this.add(n[0]),this.updateCounts(),[];{let u=this.splitAfter(i),m=0;for(i++;i<b6&&m<o;)this.children[i]=n[m],i++,m++;let p=[],x=0;if(m<o){x=Math.ceil((o-m)/b6),p=new Array(x);let b=0;for(let E=0;E<x;E++)p[E]=new IEe;let T=p[0];for(;m<o;)T.add(n[m]),m++,T.children.length===b6&&(b++,T=p[b]);for(let E=p.length-1;E>=0;E--)p[E].children.length===0&&p.pop()}u&&p.push(u),this.updateCounts();for(let b=0;b<x;b++)p[b].updateCounts();return p}}add(t){this.children.push(t),O.assert(this.children.length<=b6)}charCount(){return this.totalChars}lineCount(){return this.totalLines}},ez=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}},u$e=class gQe{constructor(t,n,i,s,o,u){this.telemetryEnabled=t,this.logger=n,this.host=i,this.globalTypingsCacheLocation=s,this.event=o,this.maxActiveRequestCount=u,this.activeRequestCount=0,this.requestQueue=GA(),this.requestMap=new Map,this.requestedRegistry=!1,this.packageInstallId=0}isKnownTypesPackageName(t){var n;return k1.validatePackageName(t)!==k1.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=M0e(t,n,i);this.logger.hasLevel(3)&&this.logger.info(`TIAdapter:: Scheduling throttled operation:${Kb(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:${Kb(t)}`),t.kind){case EZ:this.typesRegistryCache=new Map(Object.entries(t.typesRegistry));break;case vj:{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 Jpe:{let s={message:t.message};this.event(s,"typesInstallerInitializationFailed");break}case DZ:{let s={eventId:t.eventId,packages:t.packagesToInstall};this.event(s,"beginInstallTypes");break}case PZ:{if(this.telemetryEnabled){let u={telemetryEventName:"typingsInstalled",payload:{installedPackages:t.packagesToInstall.join(","),installSuccess:t.installSuccess,typingsInstallerVersion:t.typingsInstallerVersion}};this.event(u,"telemetry")}let s={eventId:t.eventId,packages:t.packagesToInstall,success:t.installSuccess};this.event(s,"endInstallTypes");break}case yj:{this.projectService.updateTypingsForProject(t);break}case hj:{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 VO: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:${Kb(t)}`),this.installer.send(t)},gQe.requestDelayMillis,`${t.projectName}::${t.kind}`)}};u$e.requestDelayMillis=100;var _$e=u$e,f$e={};v(f$e,{ActionInvalidate:()=>yj,ActionPackageInstalled:()=>vj,ActionSet:()=>hj,ActionWatchTypingLocations:()=>VO,Arguments:()=>IZ,AutoImportProviderProject:()=>nve,AuxiliaryProject:()=>tve,CharRangeSection:()=>Pve,CloseFileWatcherEvent:()=>VQ,CommandNames:()=>Xje,ConfigFileDiagEvent:()=>zQ,ConfiguredProject:()=>ive,ConfiguredProjectLoadKind:()=>uve,CreateDirectoryWatcherEvent:()=>WQ,CreateFileWatcherEvent:()=>UQ,Errors:()=>Wy,EventBeginInstallTypes:()=>DZ,EventEndInstallTypes:()=>PZ,EventInitializationFailed:()=>Jpe,EventTypesRegistry:()=>EZ,ExternalProject:()=>FQ,GcTimer:()=>U0e,InferredProject:()=>eve,LargeFileReferencedEvent:()=>$Q,LineIndex:()=>K7,LineLeaf:()=>ez,LineNode:()=>S6,LogLevel:()=>F0e,Msg:()=>L0e,OpenFileInfoTelemetryEvent:()=>sve,Project:()=>Dw,ProjectInfoTelemetryEvent:()=>JQ,ProjectKind:()=>yN,ProjectLanguageServiceStateEvent:()=>BQ,ProjectLoadingFinishEvent:()=>jQ,ProjectLoadingStartEvent:()=>RQ,ProjectService:()=>vve,ProjectsUpdatedInBackgroundEvent:()=>X$,ScriptInfo:()=>G0e,ScriptVersionCache:()=>nY,Session:()=>s$e,TextStorage:()=>q0e,ThrottledOperations:()=>J0e,TypingsInstallerAdapter:()=>_$e,allFilesAreJsOrDts:()=>X0e,allRootFilesAreJsOrDts:()=>K0e,asNormalizedPath:()=>Tje,convertCompilerOptions:()=>Q$,convertFormatOptions:()=>y6,convertScriptKindName:()=>GQ,convertTypeAcquisition:()=>ove,convertUserPreferences:()=>cve,convertWatchOptions:()=>H7,countEachFileTypes:()=>W7,createInstallTypingsRequest:()=>M0e,createModuleSpecifierCache:()=>xve,createNormalizedPathMap:()=>kje,createPackageJsonCache:()=>Tve,createSortedArray:()=>B0e,emptyArray:()=>Yl,findArgument:()=>kAe,formatDiagnosticToProtocol:()=>Z7,formatMessage:()=>kve,getBaseConfigFileName:()=>OQ,getDetailWatchInfo:()=>XQ,getLocationInNewDocument:()=>Dve,hasArgument:()=>TAe,hasNoTypeScriptSource:()=>Q0e,indent:()=>U4,isBackgroundProject:()=>q7,isConfigFile:()=>bve,isConfiguredProject:()=>H0,isDynamicFileName:()=>hN,isExternalProject:()=>V7,isInferredProject:()=>h6,isInferredProjectName:()=>R0e,isProjectDeferredClose:()=>G7,makeAutoImportProviderProjectName:()=>$0e,makeAuxiliaryProjectName:()=>z0e,makeInferredProjectName:()=>j0e,maxFileSize:()=>MQ,maxProgramSizeForNonTsFiles:()=>LQ,normalizedPathToPath:()=>g6,nowString:()=>CAe,nullCancellationToken:()=>Hje,nullTypingsInstaller:()=>Y$,protocol:()=>W0e,scriptInfoIsContainedByBackgroundProject:()=>H0e,scriptInfoIsContainedByDeferredClosedProject:()=>Z0e,stringifyIndented:()=>Kb,toEvent:()=>Cve,toNormalizedPath:()=>Po,tryConvertScriptKindName:()=>qQ,typingsInstaller:()=>O0e,updateProjectIfDirty:()=>$d}),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 lQe},set exports(c){lQe=c,typeof qne<"u"&&qne.exports&&(qne.exports=c)}})});var uYe=hxe((BJt,lie)=>{"use strict";function nYe(c){return Array.isArray(c)?c:[c]}var t9=void 0,Gk="",YQe=" ",qk="\\",pLt=/^\s+$/,dLt=/(?:[^\\]|^)\\$/,mLt=/^\\!/,gLt=/^\\#/,hLt=/\r?\n/g,yLt="//",r9=47,eYe=46,Hk="/",iYe="node-ignore";typeof Symbol<"u"&&(iYe=Symbol.for("node-ignore"));var sYe=iYe,BA=(c,l,d)=>(Object.defineProperty(c,l,{value:d}),d),aYe=()=>!1,vLt=c=>{let{length:l}=c;return c.slice(0,l-l%2)},bLt={alnum:"0-9A-Za-z",alpha:"A-Za-z",blank:" \\t",cntrl:"\\x00-\\x1f\\x7f",digit:"0-9",graph:"!-.0-~",lower:"a-z",print:" -.0-~",punct:"!-.:-@\\[-`{-~",space:" \\t\\n\\r",upper:"A-Z",xdigit:"0-9A-Fa-f"},SLt="\\]^-[",sie=c=>SLt.indexOf(c)<0?c:qk+c,xLt="(?!\\/)",TLt=(c,l)=>{if(c)return`[^\\/${l}]`;let d=`[${l}]`;return new RegExp(d).test("/")?xLt+d:d},kLt=(c,l)=>{let{length:d}=c,h=l+1,f=Gk,v=c[h];(v==="!"||v==="^")&&(f="^",h++);let D=Gk,$=Gk;for(;;){let ee=c[h];if(ee===t9)return null;if(ee===qk){let fe=c[h+1];if(fe===t9)return null;D+=sie(fe),$=fe,h++}else if(ee==="-"&&$&&h+1<d&&c[h+1]!=="]"){h++;let fe=c[h];fe===qk&&(fe=c[h+=1]),$<=fe&&(D+=`-${sie(fe)}`),$=Gk}else if(ee==="["&&c[h+1]===":"){let fe=h+2,be=fe;for(;be<d&&c[be]!=="]";)be++;if(be===d)return null;if(be>fe&&c[be-1]===":"){let Pe=bLt[c.slice(fe,be-1)];if(Pe===t9)return null;D+=Pe,$=Gk,h=be}else D+=sie("["),$="[",h=fe-2}else D+=sie(ee),$=ee;if(h++,c[h]==="]")return{end:h,source:TLt(f,D)}}},CLt="[]",e9="\0",wLt=new RegExp(`${e9}(\\d+)${e9}`,"g"),ELt=c=>{let l=[],d=D=>`${e9}${l.push(D)-1}${e9}`,{length:h}=c,f=Gk,v=0;for(;v<h;){let D=c[v];if(D===qk)f+=c.slice(v,v+2),v+=2;else if(D===e9)f+=d(`[${e9}]`),v++;else if(D==="["){let $=kLt(c,v);$===null?(f+=d(CLt),v=h):(f+=d($.source),v=$.end+1)}else f+=D,v++}return{source:f,sources:l}},FEe=null,DLt=/\/(?!$)/,PLt=[[/^\uFEFF/,()=>Gk,"\uFEFF"],[/((?:\\\\)*?)(\\?\s+)$/,(c,l,d)=>l+(d.indexOf("\\")===0?YQe:Gk)],[/(\\+?)\s/g,(c,l)=>{let{length:d}=l;return l.slice(0,d-d%2)+YQe}],[/[\\$.|*+(){^]/g,c=>`\\${c}`],[/(?!\\)\?/g,()=>"[^/]","?"],[/^\//,()=>"^",Hk],[/\//g,()=>"\\/",Hk],[/^\^*(?:\\\*\\\*\\\/)+/,()=>"^(?:.*\\/)?","*"],[FEe,(c,l)=>!c||c[0]==="^"?c:(DLt.test(l)?"^":"(?:^|\\/)")+c],[/\\\/\\\*\\\*(?=\\\/|$)/g,(c,l,d)=>l+6<d.length?d.slice(l+6)==="\\/"?"(?:\\/[^\\/]+)+":"(?:\\/[^\\/]+)*":"\\/.+","*"],[/(^|[^\\]+)(\\\*)+(?=.+)/g,(c,l,d)=>{let h=d.replace(/\\\*/g,"[^\\/]*");return l+h},"*"],[/\\\\\\(?=[$.|*+(){^])/g,()=>qk,qk+qk],[/\\\\/g,()=>qk,qk+qk],[/\\\[([^\]/]*?)(\\*)($|\])/g,(c,l,d,h)=>`\\[${l}${vLt(d)}${h}`,"["],[FEe,c=>{let l=c[c.length-1];return!l||l==="*"?c:l===Hk?`${c}$`:`${c}(?=$|\\/$)`}]],ILt=/(^|\\\/)?\\\*$/,aie="regex",oie="checkRegex",tYe="_",NLt={[aie](c,l){return`${l?`${l}[^/]+`:"[^/]*"}(?=$|\\/$)`},[oie](c,l){return`${l?`${l}[^/]*`:"[^/]*"}(?=$|\\/$)`}},ALt=c=>{let{source:l,sources:d}=ELt(c),h=PLt.reduce((f,[v,D,$])=>v===FEe?D(f,c):$!==t9&&f.indexOf($)<0?f:v.test(f)?f.replace(v,D.bind(c)):f,l);return d.length?h.replace(wLt,(f,v)=>d[v]):h},oYe=c=>{let l=c.indexOf(Hk);return l<0||l===c.length-1},OLt=c=>{let l=c.length-1,d=c.lastIndexOf(Hk,c[l]===Hk?l-1:l);return d<0?c:c.slice(d+1)},rYe=c=>{if(c.charCodeAt(0)===r9||c.indexOf(yLt)>=0){let h=c.split(Hk).filter(Boolean);return h.pop(),h.length?h.join(Hk)+Hk:Gk}let l=c.length-1,d=c.lastIndexOf(Hk,c.charCodeAt(l)===r9?l-1:l);return d<0?Gk:c.slice(0,d+1)},cie=c=>typeof c=="string",FLt=c=>c&&cie(c)&&!pLt.test(c)&&!dLt.test(c)&&c.indexOf("#")!==0,LLt=c=>c.split(hLt).filter(Boolean),LEe=class{constructor(l,d,h,f,v,D){this.pattern=l,this.mark=d,this.negative=v,BA(this,"body",h),BA(this,"ignoreCase",f),BA(this,"regexPrefix",D)}get _basenameOnly(){return BA(this,"_basenameOnly",oYe(this.body))}get regex(){let l=tYe+aie;return this[l]?this[l]:this._make(aie,l)}get checkRegex(){let l=tYe+oie;return this[l]?this[l]:this._make(oie,l)}_make(l,d){let h=this.regexPrefix.replace(ILt,NLt[l]),f=this.ignoreCase?new RegExp(h,"i"):new RegExp(h);return BA(this,d,f)}},MLt=({pattern:c,mark:l},d)=>{let h=!1,f=c;f.indexOf("!")===0&&(h=!0,f=f.substr(1)),f=f.replace(mLt,"!").replace(gLt,"#");let v=ALt(f);return new LEe(c,l,f,d,h,v)},MEe=class{constructor(l){this._ignoreCase=l,this._rules=[],this._basenameCount=0}_add(l){if(l&&l[sYe]){this._rules=this._rules.concat(l._rules._rules),this._basenameCount+=l._rules._basenameCount,this._added=!0;return}if(cie(l)&&(l={pattern:l}),FLt(l.pattern)){let d=MLt(l,this._ignoreCase);this._added=!0,this._rules.push(d),oYe(d.body)&&this._basenameCount++}}add(l){return this._added=!1,nYe(cie(l)?LLt(l):l).forEach(this._add,this),this._added}test(l,d,h){let f=!1,v=!1,D,$=this._rules,{length:ee}=$,fe=this._basenameCount*2>=ee,be=fe?OLt(l):l;for(let ie=0;ie<ee;ie++){let ft=$[ie],{negative:Ge}=ft;!(v===Ge&&f!==v||Ge&&!f&&!v&&!d)&&ft[h].test(fe&&ft._basenameOnly?be:l)&&(f=!Ge,v=Ge,D=Ge?t9:ft)}let Pe={ignored:f,unignored:v};return D&&(Pe.rule=D),Pe}},RLt=(c,l)=>{throw new l(c)},kE=(c,l,d)=>cie(c)?c?kE.isNotRelative(c)?d(`path should be a \`path.relative()\`d string, but got "${l}"`,RangeError):!0:d("path must not be empty",TypeError):d(`path must be a string, but got \`${l}\``,TypeError),cYe=c=>{let l=c.charCodeAt(0);if(l===r9)return!0;if(l!==eYe)return!1;if(c.length===1)return!0;let d=c.charCodeAt(1);return d===r9?!0:d!==eYe?!1:c.length===2||c.charCodeAt(2)===r9};kE.isNotRelative=cYe;kE.convert=c=>c;var REe=class{constructor({ignorecase:l=!0,ignoreCase:d=l,allowRelativePaths:h=!1}={}){BA(this,sYe,!0),this._rules=new MEe(d),this._strictPathCheck=!h,this._initCache()}_initCache(){this._ignoreCache=Object.create(null),this._testCache=Object.create(null)}add(l){return this._rules.add(l)&&this._initCache(),this}addPattern(l){return this.add(l)}_test(l,d,h){let f=l&&kE.convert(l);return kE(f,l,this._strictPathCheck?RLt:aYe),this._t(f,d,h)}checkIgnore(l){if(l.charCodeAt(l.length-1)!==r9)return this.test(l);let d=rYe(l);if(d){let h=this._t(d,this._testCache,!0);if(h.ignored)return h}return this._rules.test(l,!1,oie)}_t(l,d,h){if(l in d)return d[l];let f=rYe(l),v=f?this._t(f,d,h):t9;return d[l]=v&&v.ignored?v:this._rules.test(l,h,aie)}ignores(l){return this._test(l,this._ignoreCache,!1).ignored}createFilter(){return l=>!this.ignores(l)}filter(l){return nYe(l).filter(this.createFilter())}test(l){return this._test(l,this._testCache,!0)}},jEe=c=>new REe(c),jLt=c=>kE(c&&kE.convert(c),c,aYe),lYe=()=>{let c=d=>/^\\\\\?\\/.test(d)||/["<>|\u0000-\u001F]+/u.test(d)?d:d.replace(/\\/g,"/");kE.convert=c;let l=/^[a-z]:\//i;kE.isNotRelative=d=>l.test(d)||cYe(d)};typeof process<"u"&&process.platform==="win32"&&lYe();lie.exports=jEe;jEe.default=jEe;lie.exports.isPathValid=jLt;BA(lie.exports,Symbol.for("setupWindows"),lYe)});var fYe=hxe((UJt,$Lt)=>{$Lt.exports={name:"@fabriziosalmi/slopless",version:"1.16.0",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",version:"node scripts/check-changelog.js && node scripts/sync-versions.js && npm run docs:gen && npm run build && git add dist docs README.md packages/*/package.json"},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":"^9.0.0","@types/js-yaml":"^4.0.9","@types/node":"^26.4.0","@vitest/coverage-v8":"^4.0.18",commander:"^15.0.0",glob:"^13.0.6",ignore:"^7.0.5","js-yaml":"^5.4.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 qLt={};Lk(qLt,{NEVER_YOURS:()=>zEe,UsageError:()=>BJ,applyIgnoreRules:()=>_Ye,partitionIgnored:()=>uie,selectRules:()=>mYe});module.exports=PIt(qLt);var sP=class extends Error{constructor(l,d,h){super(h),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=d,this.exitCode=l,this.nestedError=void 0}},fA=class extends sP{constructor(l){super(1,"commander.invalidArgument",l),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};var IB=class{constructor(l,d){switch(this.description=d||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,l[0]){case"<":this.required=!0,this._name=l.slice(1,-1);break;case"[":this.required=!1,this._name=l.slice(1,-1);break;default:this.required=!0,this._name=l;break}this._name.endsWith("...")&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_collectValue(l,d){return d===this.defaultValue||!Array.isArray(d)?[l]:(d.push(l),d)}default(l,d){return this.defaultValue=l,this.defaultValueDescription=d,this}argParser(l){return this.parseArg=l,this}choices(l){return this.argChoices=l.slice(),this.parseArg=(d,h)=>{if(!this.argChoices.includes(d))throw new fA(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._collectValue(d,h):d},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function fte(c){let l=c.name()+(c.variadic===!0?"...":"");return c.required?"<"+l+">":"["+l+"]"}var lqe=require("events"),dte=_l(require("child_process"),1),Mk=_l(require("path"),1),AB=_l(require("fs"),1),Vu=_l(require("process"),1),uqe=require("util");var sqe=require("util"),NB=class{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(l){this.helpWidth=this.helpWidth??l.helpWidth??80}visibleCommands(l){let d=l.commands.filter(f=>!f._hidden),h=l._getHelpCommand();return h&&!h._hidden&&d.push(h),this.sortSubcommands&&d.sort((f,v)=>f.name().localeCompare(v.name())),d}compareOptions(l,d){let h=f=>f.short?f.short.replace(/^-/,""):f.long.replace(/^--/,"");return h(l).localeCompare(h(d))}visibleOptions(l){let d=l.options.filter(f=>!f.hidden),h=l._getHelpOption();if(h&&!h.hidden){let f=h.short&&l._findOption(h.short),v=h.long&&l._findOption(h.long);!f&&!v?d.push(h):h.long&&!v?d.push(l.createOption(h.long,h.description)):h.short&&!f&&d.push(l.createOption(h.short,h.description))}return this.sortOptions&&d.sort(this.compareOptions),d}visibleGlobalOptions(l){if(!this.showGlobalOptions)return[];let d=[];for(let h=l.parent;h;h=h.parent){let f=h.options.filter(v=>!v.hidden);d.push(...f)}return this.sortOptions&&d.sort(this.compareOptions),d}visibleArguments(l){return l._argsDescription&&l.registeredArguments.forEach(d=>{d.description=d.description||l._argsDescription[d.name()]||""}),l.registeredArguments.find(d=>d.description)?l.registeredArguments:[]}subcommandTerm(l){let d=l.registeredArguments.map(h=>fte(h)).join(" ");return l._name+(l._aliases[0]?"|"+l._aliases[0]:"")+(l.options.length?" [options]":"")+(d?" "+d:"")}optionTerm(l){return l.flags}argumentTerm(l){return l.name()}longestSubcommandTermLength(l,d){return d.visibleCommands(l).reduce((h,f)=>Math.max(h,this.displayWidth(d.styleSubcommandTerm(d.subcommandTerm(f)))),0)}longestOptionTermLength(l,d){return d.visibleOptions(l).reduce((h,f)=>Math.max(h,this.displayWidth(d.styleOptionTerm(d.optionTerm(f)))),0)}longestGlobalOptionTermLength(l,d){return d.visibleGlobalOptions(l).reduce((h,f)=>Math.max(h,this.displayWidth(d.styleOptionTerm(d.optionTerm(f)))),0)}longestArgumentTermLength(l,d){return d.visibleArguments(l).reduce((h,f)=>Math.max(h,this.displayWidth(d.styleArgumentTerm(d.argumentTerm(f)))),0)}commandUsage(l){let d=l._name;l._aliases[0]&&(d=d+"|"+l._aliases[0]);let h="";for(let f=l.parent;f;f=f.parent)h=f.name()+" "+h;return h+d+" "+l.usage()}commandDescription(l){return l.description()}subcommandDescription(l){return l.summary()||l.description()}optionDescription(l){let d=[];if(l.argChoices&&d.push(`choices: ${l.argChoices.map(h=>JSON.stringify(h)).join(", ")}`),l.defaultValue!==void 0&&(l.required||l.optional||l.isBoolean()&&typeof l.defaultValue=="boolean")&&d.push(`default: ${l.defaultValueDescription||JSON.stringify(l.defaultValue)}`),l.presetArg!==void 0&&l.optional&&d.push(`preset: ${JSON.stringify(l.presetArg)}`),l.envVar!==void 0&&d.push(`env: ${l.envVar}`),d.length>0){let h=`(${d.join(", ")})`;return l.description?`${l.description} ${h}`:h}return l.description}argumentDescription(l){let d=[];if(l.argChoices&&d.push(`choices: ${l.argChoices.map(h=>JSON.stringify(h)).join(", ")}`),l.defaultValue!==void 0&&d.push(`default: ${l.defaultValueDescription||JSON.stringify(l.defaultValue)}`),d.length>0){let h=`(${d.join(", ")})`;return l.description?`${l.description} ${h}`:h}return l.description}formatItemList(l,d,h){return d.length===0?[]:[h.styleTitle(l),...d,""]}groupItems(l,d,h){let f=new Map;return l.forEach(v=>{let D=h(v);f.has(D)||f.set(D,[])}),d.forEach(v=>{let D=h(v);f.has(D)||f.set(D,[]),f.get(D).push(v)}),f}formatHelp(l,d){let h=d.padWidth(l,d),f=d.helpWidth??80;function v(Pe,ie){return d.formatItem(Pe,h,ie,d)}let D=[`${d.styleTitle("Usage:")} ${d.styleUsage(d.commandUsage(l))}`,""],$=d.commandDescription(l);$.length>0&&(D=D.concat([d.boxWrap(d.styleCommandDescription($),f),""]));let ee=d.visibleArguments(l).map(Pe=>v(d.styleArgumentTerm(d.argumentTerm(Pe)),d.styleArgumentDescription(d.argumentDescription(Pe))));if(D=D.concat(this.formatItemList("Arguments:",ee,d)),this.groupItems(l.options,d.visibleOptions(l),Pe=>Pe.helpGroupHeading??"Options:").forEach((Pe,ie)=>{let ft=Pe.map(Ge=>v(d.styleOptionTerm(d.optionTerm(Ge)),d.styleOptionDescription(d.optionDescription(Ge))));D=D.concat(this.formatItemList(ie,ft,d))}),d.showGlobalOptions){let Pe=d.visibleGlobalOptions(l).map(ie=>v(d.styleOptionTerm(d.optionTerm(ie)),d.styleOptionDescription(d.optionDescription(ie))));D=D.concat(this.formatItemList("Global Options:",Pe,d))}return this.groupItems(l.commands,d.visibleCommands(l),Pe=>Pe.helpGroup()||"Commands:").forEach((Pe,ie)=>{let ft=Pe.map(Ge=>v(d.styleSubcommandTerm(d.subcommandTerm(Ge)),d.styleSubcommandDescription(d.subcommandDescription(Ge))));D=D.concat(this.formatItemList(ie,ft,d))}),D.join(`
434
+ `+P.stack)}finally{this.performanceData=b}}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 a$e(e){let t=e.diagnosticsDuration&&Es(e.diagnosticsDuration,([n,i])=>({...i,file:n}));return{...e,diagnosticsDuration:t}}function Tg(e,t){return{start:t.positionToLineOffset(e.start),end:t.positionToLineOffset(Pc(e))}}function Eve(e,t,n){let i=Tg(e,n),s=t&&Tg(t,n);return s?{...i,contextStart:s.start,contextEnd:s.end}:i}function P1t(e,t){return{start:o$e(t,e.span.start),end:o$e(t,Pc(e.span)),newText:e.newText}}function o$e(e,t){return bve(e)?N1t(e.getLineAndCharacterOfPosition(t)):e.positionToLineOffset(t)}function I1t(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 N1t(e){return{line:e.line+1,offset:e.character+1}}function A1t(e){O.assert(e.textChanges.length===1);let t=Ha(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 Dve(e,t,n,i){let s=O1t(e,t,i),{line:o,character:u}=FE(sC(s),n);return{line:o+1,offset:u+1}}function O1t(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:u,span:{start:m,length:p}}=s[o];e=e.slice(0,m)+u+e.slice(m+p)}return e}function c$e(e,{fileName:t,textSpan:n,contextSpan:i,isWriteAccess:s,isDefinition:o},{disableLineTextInReferences:u}){let m=O.checkDefined(e.getScriptInfo(t)),p=Eve(n,i,m),x=u?void 0:F1t(m,p);return{file:t,...p,lineText:x,isWriteAccess:s,isDefinition:o}}function F1t(e,t){let n=e.lineToTextSpan(t.start.line-1);return e.getSnapshot().getText(n.start,Pc(n)).replace(/\r|\n/g,"")}function L1t(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 b6=4,Pve=(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))(Pve||{}),M1t=class{constructor(){this.goSubtree=!0,this.lineIndex=new K7,this.endBranch=[],this.state=2,this.initialText="",this.trailingText="",this.lineIndex.root=new S6,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=K7.linesFromText(e).lines;i.length>1&&i[i.length-1]===""&&i.pop();let s,o;for(let m=this.endBranch.length-1;m>=0;m--)this.endBranch[m].updateCounts(),this.endBranch[m].charCount()===0&&(o=this.endBranch[m],m>0?s=this.endBranch[m-1]:s=this.branchNode);o&&s.remove(o);let u=this.startPath[this.startPath.length-1];if(i.length>0)if(u.text=i[0],i.length>1){let m=new Array(i.length-1),p=u;for(let T=1;T<i.length;T++)m[T-1]=new ez(i[T]);let x=this.startPath.length-2;for(;x>=0;){let T=this.startPath[x];m=T.insertAt(p,m),x--,p=T}let b=m.length;for(;b>0;){let T=new S6;T.add(this.lineIndex.root),m=T.insertAt(this.lineIndex.root,m),b=m.length,this.lineIndex.root=T}this.lineIndex.root.updateCounts()}else for(let m=this.startPath.length-2;m>=0;m--)this.startPath[m].updateCounts();else{this.startPath[this.startPath.length-2].remove(u);for(let p=this.startPath.length-2;p>=0;p--)this.startPath[p].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 u;function m(p){return p.isLeaf()?new ez(""):new S6}switch(s){case 0:this.goSubtree=!1,this.state!==4&&o.add(n);break;case 1:this.state===4?this.goSubtree=!1:(u=m(n),o.add(u),this.startPath.push(u));break;case 2:this.state!==4?(u=m(n),o.add(u),this.startPath.push(u)):n.isLeaf()||(u=m(n),o.add(u),this.endBranch.push(u));break;case 3:this.goSubtree=!1;break;case 4:this.state!==4?this.goSubtree=!1:n.isLeaf()||(u=m(n),o.add(u),this.endBranch.push(u));break;case 5:this.goSubtree=!1,this.state!==1&&o.add(n);break}this.goSubtree&&this.stack.push(u)}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)}},R1t=class{constructor(e,t,n){this.pos=e,this.deleteLen=t,this.insertedText=n}getTextChangeRange(){return l3(Ou(this.pos,this.deleteLen),this.insertedText?this.insertedText.length:0)}},rY=class Wk{constructor(){this.changes=[],this.versions=new Array(Wk.maxVersions),this.minVersion=0,this.currentVersion=0}versionToIndex(t){if(!(t<this.minVersion||t>this.currentVersion))return t%Wk.maxVersions}currentVersionToIndex(){return this.currentVersion%Wk.maxVersions}edit(t,n,i){this.changes.push(new R1t(t,n,i)),(this.changes.length>Wk.changeNumberThreshold||n>Wk.changeLengthThreshold||i&&i.length>Wk.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 l$e(this.currentVersion+1,this,n,this.changes),this.currentVersion=t.version,this.versions[this.currentVersionToIndex()]=t,this.changes=[],this.currentVersion-this.minVersion>=Wk.maxVersions&&(this.minVersion=this.currentVersion-Wk.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 Ou(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 u of o.changesSincePreviousVersion)i.push(u.getTextChangeRange())}return fae(i)}else return;else return E9}getLineCount(){return this._getSnapshot().index.getLineCount()}static fromString(t){let n=new Wk,i=new l$e(0,n,new K7);n.versions[n.currentVersion]=i;let s=K7.linesFromText(t);return i.index.load(s.lines),n}};rY.changeNumberThreshold=8,rY.changeLengthThreshold=256,rY.maxVersions=8;var nY=rY,l$e=class mQe{constructor(t,n,i,s=Yl){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 mQe&&this.cache===t.cache)return this.version<=t.version?E9:this.cache.getTextChangesBetweenVersions(t.version,this.version)}},K7=class PEe{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 ez(t[i]);this.root=PEe.buildTreeFromBottom(n)}else this.root=new S6}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,u)=>{i=i.concat(u.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,u,m){t(m,o,u)||(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(PEe.linesFromText(i).lines),this):void 0;{let s;if(this.checkEdits){let m=this.getText(0,this.root.charCount());s=m.slice(0,t)+i+m.slice(t+n)}let o=new M1t,u=!1;if(t>=this.root.charCount()){t=this.root.charCount()-1;let m=this.getText(t,1);i?i=m+i:i=m,n=0,u=!0}else if(n>0){let m=t+n,{zeroBasedColumn:p,lineText:x}=this.positionToColumnAndLineText(m);p===0&&(n+=x.length,i=i?i+x:x)}if(this.root.walk(t,n,o),o.insertLines(i,u),this.checkEdits){let m=o.lineIndex.getText(0,o.lineIndex.getLength());O.assert(s===m,"buffer edit mismatch")}return o.lineIndex}}static buildTreeFromBottom(t){if(t.length<b6)return new S6(t);let n=new Array(Math.ceil(t.length/b6)),i=0;for(let s=0;s<n.length;s++){let o=Math.min(i+b6,t.length);n[s]=new S6(t.slice(i,o)),i=o}return this.buildTreeFromBottom(n)}static linesFromText(t){let n=sC(t);if(n.length===0)return{lines:[],lineMap:n};let i=new Array(n.length),s=n.length-1;for(let u=0;u<s;u++)i[u]=t.substring(n[u],n[u+1]);let o=t.substring(n[s]);return o.length>0?i[s]=o:i.pop(),{lines:i,lineMap:n}}},S6=class IEe{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(),u=t;for(;u>=o;)this.skipChild(u,n,s,i,0),u-=o,s++,o=this.children[s].charCount();if(u+n<=o){if(this.execWalk(u,n,i,s,2))return}else{if(this.execWalk(u,o-u,i,s,1))return;let m=n-(o-u);for(s++,o=this.children[s].charCount();m>o;){if(this.execWalk(0,o,i,s,3))return;m-=o,s++,o=this.children[s].charCount()}if(m>0&&this.execWalk(0,m,i,s,4))return}if(i.pre){let m=this.children.length;if(s<m-1)for(let p=s+1;p<m;p++)this.skipChild(0,0,p,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 IEe;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<b6&&i===s-1&&o===1)return this.add(n[0]),this.updateCounts(),[];{let u=this.splitAfter(i),m=0;for(i++;i<b6&&m<o;)this.children[i]=n[m],i++,m++;let p=[],x=0;if(m<o){x=Math.ceil((o-m)/b6),p=new Array(x);let b=0;for(let E=0;E<x;E++)p[E]=new IEe;let T=p[0];for(;m<o;)T.add(n[m]),m++,T.children.length===b6&&(b++,T=p[b]);for(let E=p.length-1;E>=0;E--)p[E].children.length===0&&p.pop()}u&&p.push(u),this.updateCounts();for(let b=0;b<x;b++)p[b].updateCounts();return p}}add(t){this.children.push(t),O.assert(this.children.length<=b6)}charCount(){return this.totalChars}lineCount(){return this.totalLines}},ez=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}},u$e=class gQe{constructor(t,n,i,s,o,u){this.telemetryEnabled=t,this.logger=n,this.host=i,this.globalTypingsCacheLocation=s,this.event=o,this.maxActiveRequestCount=u,this.activeRequestCount=0,this.requestQueue=GA(),this.requestMap=new Map,this.requestedRegistry=!1,this.packageInstallId=0}isKnownTypesPackageName(t){var n;return k1.validatePackageName(t)!==k1.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=M0e(t,n,i);this.logger.hasLevel(3)&&this.logger.info(`TIAdapter:: Scheduling throttled operation:${Kb(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:${Kb(t)}`),t.kind){case EZ:this.typesRegistryCache=new Map(Object.entries(t.typesRegistry));break;case vj:{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 Jpe:{let s={message:t.message};this.event(s,"typesInstallerInitializationFailed");break}case DZ:{let s={eventId:t.eventId,packages:t.packagesToInstall};this.event(s,"beginInstallTypes");break}case PZ:{if(this.telemetryEnabled){let u={telemetryEventName:"typingsInstalled",payload:{installedPackages:t.packagesToInstall.join(","),installSuccess:t.installSuccess,typingsInstallerVersion:t.typingsInstallerVersion}};this.event(u,"telemetry")}let s={eventId:t.eventId,packages:t.packagesToInstall,success:t.installSuccess};this.event(s,"endInstallTypes");break}case yj:{this.projectService.updateTypingsForProject(t);break}case hj:{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 VO: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:${Kb(t)}`),this.installer.send(t)},gQe.requestDelayMillis,`${t.projectName}::${t.kind}`)}};u$e.requestDelayMillis=100;var _$e=u$e,f$e={};v(f$e,{ActionInvalidate:()=>yj,ActionPackageInstalled:()=>vj,ActionSet:()=>hj,ActionWatchTypingLocations:()=>VO,Arguments:()=>IZ,AutoImportProviderProject:()=>nve,AuxiliaryProject:()=>tve,CharRangeSection:()=>Pve,CloseFileWatcherEvent:()=>VQ,CommandNames:()=>Xje,ConfigFileDiagEvent:()=>zQ,ConfiguredProject:()=>ive,ConfiguredProjectLoadKind:()=>uve,CreateDirectoryWatcherEvent:()=>WQ,CreateFileWatcherEvent:()=>UQ,Errors:()=>Wy,EventBeginInstallTypes:()=>DZ,EventEndInstallTypes:()=>PZ,EventInitializationFailed:()=>Jpe,EventTypesRegistry:()=>EZ,ExternalProject:()=>FQ,GcTimer:()=>U0e,InferredProject:()=>eve,LargeFileReferencedEvent:()=>$Q,LineIndex:()=>K7,LineLeaf:()=>ez,LineNode:()=>S6,LogLevel:()=>F0e,Msg:()=>L0e,OpenFileInfoTelemetryEvent:()=>sve,Project:()=>Dw,ProjectInfoTelemetryEvent:()=>JQ,ProjectKind:()=>yN,ProjectLanguageServiceStateEvent:()=>BQ,ProjectLoadingFinishEvent:()=>jQ,ProjectLoadingStartEvent:()=>RQ,ProjectService:()=>vve,ProjectsUpdatedInBackgroundEvent:()=>X$,ScriptInfo:()=>G0e,ScriptVersionCache:()=>nY,Session:()=>s$e,TextStorage:()=>q0e,ThrottledOperations:()=>J0e,TypingsInstallerAdapter:()=>_$e,allFilesAreJsOrDts:()=>X0e,allRootFilesAreJsOrDts:()=>K0e,asNormalizedPath:()=>Tje,convertCompilerOptions:()=>Q$,convertFormatOptions:()=>y6,convertScriptKindName:()=>GQ,convertTypeAcquisition:()=>ove,convertUserPreferences:()=>cve,convertWatchOptions:()=>H7,countEachFileTypes:()=>W7,createInstallTypingsRequest:()=>M0e,createModuleSpecifierCache:()=>xve,createNormalizedPathMap:()=>kje,createPackageJsonCache:()=>Tve,createSortedArray:()=>B0e,emptyArray:()=>Yl,findArgument:()=>kAe,formatDiagnosticToProtocol:()=>Z7,formatMessage:()=>kve,getBaseConfigFileName:()=>OQ,getDetailWatchInfo:()=>XQ,getLocationInNewDocument:()=>Dve,hasArgument:()=>TAe,hasNoTypeScriptSource:()=>Q0e,indent:()=>U4,isBackgroundProject:()=>q7,isConfigFile:()=>bve,isConfiguredProject:()=>H0,isDynamicFileName:()=>hN,isExternalProject:()=>V7,isInferredProject:()=>h6,isInferredProjectName:()=>R0e,isProjectDeferredClose:()=>G7,makeAutoImportProviderProjectName:()=>$0e,makeAuxiliaryProjectName:()=>z0e,makeInferredProjectName:()=>j0e,maxFileSize:()=>MQ,maxProgramSizeForNonTsFiles:()=>LQ,normalizedPathToPath:()=>g6,nowString:()=>CAe,nullCancellationToken:()=>Hje,nullTypingsInstaller:()=>Y$,protocol:()=>W0e,scriptInfoIsContainedByBackgroundProject:()=>H0e,scriptInfoIsContainedByDeferredClosedProject:()=>Z0e,stringifyIndented:()=>Kb,toEvent:()=>Cve,toNormalizedPath:()=>Po,tryConvertScriptKindName:()=>qQ,typingsInstaller:()=>O0e,updateProjectIfDirty:()=>$d}),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 lQe},set exports(c){lQe=c,typeof qne<"u"&&qne.exports&&(qne.exports=c)}})});var uYe=hxe((BJt,lie)=>{"use strict";function nYe(c){return Array.isArray(c)?c:[c]}var t9=void 0,Gk="",YQe=" ",qk="\\",pLt=/^\s+$/,dLt=/(?:[^\\]|^)\\$/,mLt=/^\\!/,gLt=/^\\#/,hLt=/\r?\n/g,yLt="//",r9=47,eYe=46,Hk="/",iYe="node-ignore";typeof Symbol<"u"&&(iYe=Symbol.for("node-ignore"));var sYe=iYe,BA=(c,l,d)=>(Object.defineProperty(c,l,{value:d}),d),aYe=()=>!1,vLt=c=>{let{length:l}=c;return c.slice(0,l-l%2)},bLt={alnum:"0-9A-Za-z",alpha:"A-Za-z",blank:" \\t",cntrl:"\\x00-\\x1f\\x7f",digit:"0-9",graph:"!-.0-~",lower:"a-z",print:" -.0-~",punct:"!-.:-@\\[-`{-~",space:" \\t\\n\\r",upper:"A-Z",xdigit:"0-9A-Fa-f"},SLt="\\]^-[",sie=c=>SLt.indexOf(c)<0?c:qk+c,xLt="(?!\\/)",TLt=(c,l)=>{if(c)return`[^\\/${l}]`;let d=`[${l}]`;return new RegExp(d).test("/")?xLt+d:d},kLt=(c,l)=>{let{length:d}=c,h=l+1,f=Gk,v=c[h];(v==="!"||v==="^")&&(f="^",h++);let D=Gk,$=Gk;for(;;){let ee=c[h];if(ee===t9)return null;if(ee===qk){let fe=c[h+1];if(fe===t9)return null;D+=sie(fe),$=fe,h++}else if(ee==="-"&&$&&h+1<d&&c[h+1]!=="]"){h++;let fe=c[h];fe===qk&&(fe=c[h+=1]),$<=fe&&(D+=`-${sie(fe)}`),$=Gk}else if(ee==="["&&c[h+1]===":"){let fe=h+2,be=fe;for(;be<d&&c[be]!=="]";)be++;if(be===d)return null;if(be>fe&&c[be-1]===":"){let Pe=bLt[c.slice(fe,be-1)];if(Pe===t9)return null;D+=Pe,$=Gk,h=be}else D+=sie("["),$="[",h=fe-2}else D+=sie(ee),$=ee;if(h++,c[h]==="]")return{end:h,source:TLt(f,D)}}},CLt="[]",e9="\0",wLt=new RegExp(`${e9}(\\d+)${e9}`,"g"),ELt=c=>{let l=[],d=D=>`${e9}${l.push(D)-1}${e9}`,{length:h}=c,f=Gk,v=0;for(;v<h;){let D=c[v];if(D===qk)f+=c.slice(v,v+2),v+=2;else if(D===e9)f+=d(`[${e9}]`),v++;else if(D==="["){let $=kLt(c,v);$===null?(f+=d(CLt),v=h):(f+=d($.source),v=$.end+1)}else f+=D,v++}return{source:f,sources:l}},FEe=null,DLt=/\/(?!$)/,PLt=[[/^\uFEFF/,()=>Gk,"\uFEFF"],[/((?:\\\\)*?)(\\?\s+)$/,(c,l,d)=>l+(d.indexOf("\\")===0?YQe:Gk)],[/(\\+?)\s/g,(c,l)=>{let{length:d}=l;return l.slice(0,d-d%2)+YQe}],[/[\\$.|*+(){^]/g,c=>`\\${c}`],[/(?!\\)\?/g,()=>"[^/]","?"],[/^\//,()=>"^",Hk],[/\//g,()=>"\\/",Hk],[/^\^*(?:\\\*\\\*\\\/)+/,()=>"^(?:.*\\/)?","*"],[FEe,(c,l)=>!c||c[0]==="^"?c:(DLt.test(l)?"^":"(?:^|\\/)")+c],[/\\\/\\\*\\\*(?=\\\/|$)/g,(c,l,d)=>l+6<d.length?d.slice(l+6)==="\\/"?"(?:\\/[^\\/]+)+":"(?:\\/[^\\/]+)*":"\\/.+","*"],[/(^|[^\\]+)(\\\*)+(?=.+)/g,(c,l,d)=>{let h=d.replace(/\\\*/g,"[^\\/]*");return l+h},"*"],[/\\\\\\(?=[$.|*+(){^])/g,()=>qk,qk+qk],[/\\\\/g,()=>qk,qk+qk],[/\\\[([^\]/]*?)(\\*)($|\])/g,(c,l,d,h)=>`\\[${l}${vLt(d)}${h}`,"["],[FEe,c=>{let l=c[c.length-1];return!l||l==="*"?c:l===Hk?`${c}$`:`${c}(?=$|\\/$)`}]],ILt=/(^|\\\/)?\\\*$/,aie="regex",oie="checkRegex",tYe="_",NLt={[aie](c,l){return`${l?`${l}[^/]+`:"[^/]*"}(?=$|\\/$)`},[oie](c,l){return`${l?`${l}[^/]*`:"[^/]*"}(?=$|\\/$)`}},ALt=c=>{let{source:l,sources:d}=ELt(c),h=PLt.reduce((f,[v,D,$])=>v===FEe?D(f,c):$!==t9&&f.indexOf($)<0?f:v.test(f)?f.replace(v,D.bind(c)):f,l);return d.length?h.replace(wLt,(f,v)=>d[v]):h},oYe=c=>{let l=c.indexOf(Hk);return l<0||l===c.length-1},OLt=c=>{let l=c.length-1,d=c.lastIndexOf(Hk,c[l]===Hk?l-1:l);return d<0?c:c.slice(d+1)},rYe=c=>{if(c.charCodeAt(0)===r9||c.indexOf(yLt)>=0){let h=c.split(Hk).filter(Boolean);return h.pop(),h.length?h.join(Hk)+Hk:Gk}let l=c.length-1,d=c.lastIndexOf(Hk,c.charCodeAt(l)===r9?l-1:l);return d<0?Gk:c.slice(0,d+1)},cie=c=>typeof c=="string",FLt=c=>c&&cie(c)&&!pLt.test(c)&&!dLt.test(c)&&c.indexOf("#")!==0,LLt=c=>c.split(hLt).filter(Boolean),LEe=class{constructor(l,d,h,f,v,D){this.pattern=l,this.mark=d,this.negative=v,BA(this,"body",h),BA(this,"ignoreCase",f),BA(this,"regexPrefix",D)}get _basenameOnly(){return BA(this,"_basenameOnly",oYe(this.body))}get regex(){let l=tYe+aie;return this[l]?this[l]:this._make(aie,l)}get checkRegex(){let l=tYe+oie;return this[l]?this[l]:this._make(oie,l)}_make(l,d){let h=this.regexPrefix.replace(ILt,NLt[l]),f=this.ignoreCase?new RegExp(h,"i"):new RegExp(h);return BA(this,d,f)}},MLt=({pattern:c,mark:l},d)=>{let h=!1,f=c;f.indexOf("!")===0&&(h=!0,f=f.substr(1)),f=f.replace(mLt,"!").replace(gLt,"#");let v=ALt(f);return new LEe(c,l,f,d,h,v)},MEe=class{constructor(l){this._ignoreCase=l,this._rules=[],this._basenameCount=0}_add(l){if(l&&l[sYe]){this._rules=this._rules.concat(l._rules._rules),this._basenameCount+=l._rules._basenameCount,this._added=!0;return}if(cie(l)&&(l={pattern:l}),FLt(l.pattern)){let d=MLt(l,this._ignoreCase);this._added=!0,this._rules.push(d),oYe(d.body)&&this._basenameCount++}}add(l){return this._added=!1,nYe(cie(l)?LLt(l):l).forEach(this._add,this),this._added}test(l,d,h){let f=!1,v=!1,D,$=this._rules,{length:ee}=$,fe=this._basenameCount*2>=ee,be=fe?OLt(l):l;for(let ie=0;ie<ee;ie++){let ft=$[ie],{negative:Ge}=ft;!(v===Ge&&f!==v||Ge&&!f&&!v&&!d)&&ft[h].test(fe&&ft._basenameOnly?be:l)&&(f=!Ge,v=Ge,D=Ge?t9:ft)}let Pe={ignored:f,unignored:v};return D&&(Pe.rule=D),Pe}},RLt=(c,l)=>{throw new l(c)},kE=(c,l,d)=>cie(c)?c?kE.isNotRelative(c)?d(`path should be a \`path.relative()\`d string, but got "${l}"`,RangeError):!0:d("path must not be empty",TypeError):d(`path must be a string, but got \`${l}\``,TypeError),cYe=c=>{let l=c.charCodeAt(0);if(l===r9)return!0;if(l!==eYe)return!1;if(c.length===1)return!0;let d=c.charCodeAt(1);return d===r9?!0:d!==eYe?!1:c.length===2||c.charCodeAt(2)===r9};kE.isNotRelative=cYe;kE.convert=c=>c;var REe=class{constructor({ignorecase:l=!0,ignoreCase:d=l,allowRelativePaths:h=!1}={}){BA(this,sYe,!0),this._rules=new MEe(d),this._strictPathCheck=!h,this._initCache()}_initCache(){this._ignoreCache=Object.create(null),this._testCache=Object.create(null)}add(l){return this._rules.add(l)&&this._initCache(),this}addPattern(l){return this.add(l)}_test(l,d,h){let f=l&&kE.convert(l);return kE(f,l,this._strictPathCheck?RLt:aYe),this._t(f,d,h)}checkIgnore(l){if(l.charCodeAt(l.length-1)!==r9)return this.test(l);let d=rYe(l);if(d){let h=this._t(d,this._testCache,!0);if(h.ignored)return h}return this._rules.test(l,!1,oie)}_t(l,d,h){if(l in d)return d[l];let f=rYe(l),v=f?this._t(f,d,h):t9;return d[l]=v&&v.ignored?v:this._rules.test(l,h,aie)}ignores(l){return this._test(l,this._ignoreCache,!1).ignored}createFilter(){return l=>!this.ignores(l)}filter(l){return nYe(l).filter(this.createFilter())}test(l){return this._test(l,this._testCache,!0)}},jEe=c=>new REe(c),jLt=c=>kE(c&&kE.convert(c),c,aYe),lYe=()=>{let c=d=>/^\\\\\?\\/.test(d)||/["<>|\u0000-\u001F]+/u.test(d)?d:d.replace(/\\/g,"/");kE.convert=c;let l=/^[a-z]:\//i;kE.isNotRelative=d=>l.test(d)||cYe(d)};typeof process<"u"&&process.platform==="win32"&&lYe();lie.exports=jEe;jEe.default=jEe;lie.exports.isPathValid=jLt;BA(lie.exports,Symbol.for("setupWindows"),lYe)});var fYe=hxe((UJt,$Lt)=>{$Lt.exports={name:"@fabriziosalmi/slopless",version:"1.17.0",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",version:"node scripts/check-changelog.js && node scripts/sync-versions.js && npm run docs:gen && npm run build && git add dist docs README.md packages/*/package.json"},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":"^9.0.0","@types/js-yaml":"^4.0.9","@types/node":"^26.4.0","@vitest/coverage-v8":"^4.0.18",commander:"^15.0.0",glob:"^13.0.6",ignore:"^7.0.5","js-yaml":"^5.4.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 qLt={};Lk(qLt,{NEVER_YOURS:()=>zEe,UsageError:()=>BJ,applyIgnoreRules:()=>_Ye,partitionIgnored:()=>uie,selectRules:()=>mYe});module.exports=PIt(qLt);var sP=class extends Error{constructor(l,d,h){super(h),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=d,this.exitCode=l,this.nestedError=void 0}},fA=class extends sP{constructor(l){super(1,"commander.invalidArgument",l),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};var IB=class{constructor(l,d){switch(this.description=d||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,l[0]){case"<":this.required=!0,this._name=l.slice(1,-1);break;case"[":this.required=!1,this._name=l.slice(1,-1);break;default:this.required=!0,this._name=l;break}this._name.endsWith("...")&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_collectValue(l,d){return d===this.defaultValue||!Array.isArray(d)?[l]:(d.push(l),d)}default(l,d){return this.defaultValue=l,this.defaultValueDescription=d,this}argParser(l){return this.parseArg=l,this}choices(l){return this.argChoices=l.slice(),this.parseArg=(d,h)=>{if(!this.argChoices.includes(d))throw new fA(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._collectValue(d,h):d},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function fte(c){let l=c.name()+(c.variadic===!0?"...":"");return c.required?"<"+l+">":"["+l+"]"}var lqe=require("events"),dte=_l(require("child_process"),1),Mk=_l(require("path"),1),AB=_l(require("fs"),1),Vu=_l(require("process"),1),uqe=require("util");var sqe=require("util"),NB=class{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(l){this.helpWidth=this.helpWidth??l.helpWidth??80}visibleCommands(l){let d=l.commands.filter(f=>!f._hidden),h=l._getHelpCommand();return h&&!h._hidden&&d.push(h),this.sortSubcommands&&d.sort((f,v)=>f.name().localeCompare(v.name())),d}compareOptions(l,d){let h=f=>f.short?f.short.replace(/^-/,""):f.long.replace(/^--/,"");return h(l).localeCompare(h(d))}visibleOptions(l){let d=l.options.filter(f=>!f.hidden),h=l._getHelpOption();if(h&&!h.hidden){let f=h.short&&l._findOption(h.short),v=h.long&&l._findOption(h.long);!f&&!v?d.push(h):h.long&&!v?d.push(l.createOption(h.long,h.description)):h.short&&!f&&d.push(l.createOption(h.short,h.description))}return this.sortOptions&&d.sort(this.compareOptions),d}visibleGlobalOptions(l){if(!this.showGlobalOptions)return[];let d=[];for(let h=l.parent;h;h=h.parent){let f=h.options.filter(v=>!v.hidden);d.push(...f)}return this.sortOptions&&d.sort(this.compareOptions),d}visibleArguments(l){return l._argsDescription&&l.registeredArguments.forEach(d=>{d.description=d.description||l._argsDescription[d.name()]||""}),l.registeredArguments.find(d=>d.description)?l.registeredArguments:[]}subcommandTerm(l){let d=l.registeredArguments.map(h=>fte(h)).join(" ");return l._name+(l._aliases[0]?"|"+l._aliases[0]:"")+(l.options.length?" [options]":"")+(d?" "+d:"")}optionTerm(l){return l.flags}argumentTerm(l){return l.name()}longestSubcommandTermLength(l,d){return d.visibleCommands(l).reduce((h,f)=>Math.max(h,this.displayWidth(d.styleSubcommandTerm(d.subcommandTerm(f)))),0)}longestOptionTermLength(l,d){return d.visibleOptions(l).reduce((h,f)=>Math.max(h,this.displayWidth(d.styleOptionTerm(d.optionTerm(f)))),0)}longestGlobalOptionTermLength(l,d){return d.visibleGlobalOptions(l).reduce((h,f)=>Math.max(h,this.displayWidth(d.styleOptionTerm(d.optionTerm(f)))),0)}longestArgumentTermLength(l,d){return d.visibleArguments(l).reduce((h,f)=>Math.max(h,this.displayWidth(d.styleArgumentTerm(d.argumentTerm(f)))),0)}commandUsage(l){let d=l._name;l._aliases[0]&&(d=d+"|"+l._aliases[0]);let h="";for(let f=l.parent;f;f=f.parent)h=f.name()+" "+h;return h+d+" "+l.usage()}commandDescription(l){return l.description()}subcommandDescription(l){return l.summary()||l.description()}optionDescription(l){let d=[];if(l.argChoices&&d.push(`choices: ${l.argChoices.map(h=>JSON.stringify(h)).join(", ")}`),l.defaultValue!==void 0&&(l.required||l.optional||l.isBoolean()&&typeof l.defaultValue=="boolean")&&d.push(`default: ${l.defaultValueDescription||JSON.stringify(l.defaultValue)}`),l.presetArg!==void 0&&l.optional&&d.push(`preset: ${JSON.stringify(l.presetArg)}`),l.envVar!==void 0&&d.push(`env: ${l.envVar}`),d.length>0){let h=`(${d.join(", ")})`;return l.description?`${l.description} ${h}`:h}return l.description}argumentDescription(l){let d=[];if(l.argChoices&&d.push(`choices: ${l.argChoices.map(h=>JSON.stringify(h)).join(", ")}`),l.defaultValue!==void 0&&d.push(`default: ${l.defaultValueDescription||JSON.stringify(l.defaultValue)}`),d.length>0){let h=`(${d.join(", ")})`;return l.description?`${l.description} ${h}`:h}return l.description}formatItemList(l,d,h){return d.length===0?[]:[h.styleTitle(l),...d,""]}groupItems(l,d,h){let f=new Map;return l.forEach(v=>{let D=h(v);f.has(D)||f.set(D,[])}),d.forEach(v=>{let D=h(v);f.has(D)||f.set(D,[]),f.get(D).push(v)}),f}formatHelp(l,d){let h=d.padWidth(l,d),f=d.helpWidth??80;function v(Pe,ie){return d.formatItem(Pe,h,ie,d)}let D=[`${d.styleTitle("Usage:")} ${d.styleUsage(d.commandUsage(l))}`,""],$=d.commandDescription(l);$.length>0&&(D=D.concat([d.boxWrap(d.styleCommandDescription($),f),""]));let ee=d.visibleArguments(l).map(Pe=>v(d.styleArgumentTerm(d.argumentTerm(Pe)),d.styleArgumentDescription(d.argumentDescription(Pe))));if(D=D.concat(this.formatItemList("Arguments:",ee,d)),this.groupItems(l.options,d.visibleOptions(l),Pe=>Pe.helpGroupHeading??"Options:").forEach((Pe,ie)=>{let ft=Pe.map(Ge=>v(d.styleOptionTerm(d.optionTerm(Ge)),d.styleOptionDescription(d.optionDescription(Ge))));D=D.concat(this.formatItemList(ie,ft,d))}),d.showGlobalOptions){let Pe=d.visibleGlobalOptions(l).map(ie=>v(d.styleOptionTerm(d.optionTerm(ie)),d.styleOptionDescription(d.optionDescription(ie))));D=D.concat(this.formatItemList("Global Options:",Pe,d))}return this.groupItems(l.commands,d.visibleCommands(l),Pe=>Pe.helpGroup()||"Commands:").forEach((Pe,ie)=>{let ft=Pe.map(Ge=>v(d.styleSubcommandTerm(d.subcommandTerm(Ge)),d.styleSubcommandDescription(d.subcommandDescription(Ge))));D=D.concat(this.formatItemList(ie,ft,d))}),D.join(`
435
435
  `)}displayWidth(l){return(0,sqe.stripVTControlCharacters)(l).length}styleTitle(l){return l}styleUsage(l){return l.split(" ").map(d=>d==="[options]"?this.styleOptionText(d):d==="[command]"?this.styleSubcommandText(d):d[0]==="["||d[0]==="<"?this.styleArgumentText(d):this.styleCommandText(d)).join(" ")}styleCommandDescription(l){return this.styleDescriptionText(l)}styleOptionDescription(l){return this.styleDescriptionText(l)}styleSubcommandDescription(l){return this.styleDescriptionText(l)}styleArgumentDescription(l){return this.styleDescriptionText(l)}styleDescriptionText(l){return l}styleOptionTerm(l){return this.styleOptionText(l)}styleSubcommandTerm(l){return l.split(" ").map(d=>d==="[options]"?this.styleOptionText(d):d[0]==="["||d[0]==="<"?this.styleArgumentText(d):this.styleSubcommandText(d)).join(" ")}styleArgumentTerm(l){return this.styleArgumentText(l)}styleOptionText(l){return l}styleArgumentText(l){return l}styleSubcommandText(l){return l}styleCommandText(l){return l}padWidth(l,d){return Math.max(d.longestOptionTermLength(l,d),d.longestGlobalOptionTermLength(l,d),d.longestSubcommandTermLength(l,d),d.longestArgumentTermLength(l,d))}preformatted(l){return/\n[^\S\r\n]/.test(l)}formatItem(l,d,h,f){let D=" ".repeat(2);if(!h)return D+l;let $=l.padEnd(d+l.length-f.displayWidth(l)),ee=2,be=(this.helpWidth??80)-d-ee-2,Pe;return be<this.minWidthToWrap||f.preformatted(h)?Pe=h:Pe=f.boxWrap(h,be).replace(/\n/g,`
436
436
  `+" ".repeat(d+ee)),D+$+" ".repeat(ee)+Pe.replace(/\n/g,`
437
437
  ${D}`)}boxWrap(l,d){if(d<this.minWidthToWrap)return l;let h=l.split(/\r\n|\n/),f=/[\s]*[^\s]+/g,v=[];return h.forEach(D=>{let $=D.match(f);if($===null){v.push("");return}let ee=[$.shift()],fe=this.displayWidth(ee[0]);$.forEach(be=>{let Pe=this.displayWidth(be);if(fe+Pe<=d){ee.push(be),fe+=Pe;return}v.push(ee.join(""));let ie=be.trimStart();ee=[ie],fe=this.displayWidth(ie)}),v.push(ee.join(""))}),v.join(`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fabriziosalmi/slopless",
3
- "version": "1.16.0",
3
+ "version": "1.17.0",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "bin": {