admins-components 3.9.5 → 3.9.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/admins-components.cjs +1 -1
- package/dist/admins-components.js +4291 -4289
- package/package.json +1 -1
|
@@ -477,4 +477,4 @@ Project '${d.projectName}' (${LI[d.projectKind]}) ${o}
|
|
|
477
477
|
`,o++};this.projectService.externalProjects.forEach(c),this.projectService.configuredProjects.forEach(c),this.projectService.inferredProjects.forEach(c)}}this.logger.msg(a,"Err")}send(t){if(t.type==="event"&&!this.canUseEvents){this.logger.hasLevel(3)&&this.logger.info(`Session does not support events: ignored event: ${bT(t)}`);return}this.writeMessage(t)}writeMessage(t){const n=kye(t,this.logger,this.byteLength,this.host.newLine);this.host.write(n)}event(t,n){this.send(Cye(n,t))}doOutput(t,n,i,a,o,c){const d={seq:0,type:"response",command:n,request_seq:i,success:a,performanceData:o&&DMe(o)};if(a){let p;if(Ja(t))d.body=t,p=t.metadata,delete t.metadata;else if(typeof t=="object")if(t.metadata){const{metadata:y,...b}=t;d.body=b,p=y}else d.body=t;else d.body=t;p&&(d.metadata=p)}else O.assert(t===void 0);c&&(d.message=c),this.send(d)}semanticCheck(t,n){var i,a;const o=Lc();(i=$n)==null||i.push($n.Phase.Session,"semanticCheck",{file:t,configFilePath:n.canonicalConfigFilePath});const c=hMe(n,t)?of:n.getLanguageService().getSemanticDiagnostics(t).filter(d=>!!d.file);this.sendDiagnosticsEvent(t,n,c,"semanticDiag",o),(a=$n)==null||a.pop()}syntacticCheck(t,n){var i,a;const o=Lc();(i=$n)==null||i.push($n.Phase.Session,"syntacticCheck",{file:t,configFilePath:n.canonicalConfigFilePath}),this.sendDiagnosticsEvent(t,n,n.getLanguageService().getSyntacticDiagnostics(t),"syntaxDiag",o),(a=$n)==null||a.pop()}suggestionCheck(t,n){var i,a;const o=Lc();(i=$n)==null||i.push($n.Phase.Session,"suggestionCheck",{file:t,configFilePath:n.canonicalConfigFilePath}),this.sendDiagnosticsEvent(t,n,n.getLanguageService().getSuggestionDiagnostics(t),"suggestionDiag",o),(a=$n)==null||a.pop()}regionSemanticCheck(t,n,i){var a,o,c;const d=Lc();(a=$n)==null||a.push($n.Phase.Session,"regionSemanticCheck",{file:t,configFilePath:n.canonicalConfigFilePath});let p;if(!this.shouldDoRegionCheck(t)||!(p=n.getLanguageService().getRegionSemanticDiagnostics(t,i))){(o=$n)==null||o.pop();return}this.sendDiagnosticsEvent(t,n,p.diagnostics,"regionSemanticDiag",d,p.spans),(c=$n)==null||c.pop()}shouldDoRegionCheck(t){var n;const i=(n=this.projectService.getScriptInfoForNormalizedPath(t))==null?void 0:n.textStorage.getLineInfo().getLineCount();return!!(i&&i>=this.regionDiagLineCountThreshold)}sendDiagnosticsEvent(t,n,i,a,o,c){try{const d=O.checkDefined(n.getScriptInfo(t)),p=Lc()-o,y={file:t,diagnostics:i.map(b=>vMe(t,n,b)),spans:c==null?void 0:c.map(b=>M0(b,d))};this.event(y,a),this.addDiagnosticsPerformanceData(t,a,p)}catch(d){this.logError(d,a)}}updateErrorCheck(t,n,i,a=!0){if(n.length===0)return;O.assert(!this.suppressDiagnosticEvents);const o=this.changeSeq,c=Math.min(i,200);let d=0;const p=()=>{if(d++,n.length>d)return t.delay("checkOne",c,b)},y=(S,E)=>{if(this.semanticCheck(S,E),this.changeSeq===o){if(this.getPreferences(S).disableSuggestions)return p();t.immediate("suggestionCheck",()=>{this.suggestionCheck(S,E),p()})}},b=()=>{if(this.changeSeq!==o)return;let S,E=n[d];if(ha(E)?E=this.toPendingErrorCheck(E):"ranges"in E&&(S=E.ranges,E=this.toPendingErrorCheck(E.file)),!E)return p();const{fileName:D,project:I}=E;if(jg(I),!!I.containsFile(D,a)&&(this.syntacticCheck(D,I),this.changeSeq===o)){if(I.projectService.serverMode!==0)return p();if(S)return t.immediate("regionSemanticCheck",()=>{const M=this.projectService.getScriptInfoForNormalizedPath(D);M&&this.regionSemanticCheck(D,I,S.map(L=>this.getRange({file:D,...L},M))),this.changeSeq===o&&t.immediate("semanticCheck",()=>y(D,I))});t.immediate("semanticCheck",()=>y(D,I))}};n.length>d&&this.changeSeq===o&&t.delay("checkOne",i,b)}cleanProjects(t,n){if(n){this.logger.info(`cleaning ${t}`);for(const i of n)i.getLanguageService(!1).cleanupSemanticCache(),i.cleanupProgram()}}cleanup(){this.cleanProjects("inferred projects",this.projectService.inferredProjects),this.cleanProjects("configured projects",_a(this.projectService.configuredProjects.values())),this.cleanProjects("external projects",this.projectService.externalProjects),this.host.gc&&(this.logger.info("host.gc()"),this.host.gc())}getEncodedSyntacticClassifications(t){const{file:n,languageService:i}=this.getFileAndLanguageServiceForSyntacticOperation(t);return i.getEncodedSyntacticClassifications(n,t)}getEncodedSemanticClassifications(t){const{file:n,project:i}=this.getFileAndProject(t),a=t.format==="2020"?"2020":"original";return i.getLanguageService().getEncodedSemanticClassifications(n,t,a)}getProject(t){return t===void 0?void 0:this.projectService.findProject(t)}getConfigFileAndProject(t){const n=this.getProject(t.projectFileName),i=Dc(t.file);return{configFile:n&&n.hasConfigFile(i)?i:void 0,project:n}}getConfigFileDiagnostics(t,n,i){const a=n.getAllProjectErrors(),o=n.getLanguageService().getCompilerOptionsDiagnostics(),c=sr(bn(a,o),d=>!!d.file&&d.file.fileName===t);return i?this.convertToDiagnosticsWithLinePositionFromDiagnosticFile(c):Dt(c,d=>i9(d,!1))}convertToDiagnosticsWithLinePositionFromDiagnosticFile(t){return t.map(n=>({message:N0(n.messageText,this.host.newLine),start:n.start,length:n.length,category:dC(n),code:n.code,source:n.source,startLocation:n.file&&X4(to(n.file,n.start)),endLocation:n.file&&X4(to(n.file,n.start+n.length)),reportsUnnecessary:n.reportsUnnecessary,reportsDeprecated:n.reportsDeprecated,relatedInformation:Dt(n.relatedInformation,Tee)}))}getCompilerOptionsDiagnostics(t){const n=this.getProject(t.projectFileName);return this.convertToDiagnosticsWithLinePosition(sr(n.getLanguageService().getCompilerOptionsDiagnostics(),i=>!i.file),void 0)}convertToDiagnosticsWithLinePosition(t,n){return t.map(i=>({message:N0(i.messageText,this.host.newLine),start:i.start,length:i.length,category:dC(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:Dt(i.relatedInformation,Tee)}))}getDiagnosticsWorker(t,n,i,a){const{project:o,file:c}=this.getFileAndProject(t);if(n&&hMe(o,c))return of;const d=o.getScriptInfoForNormalizedPath(c),p=i(o,c);return a?this.convertToDiagnosticsWithLinePosition(p,d):p.map(y=>vMe(c,o,y))}getDefinition(t,n){const{file:i,project:a}=this.getFileAndProject(t),o=this.getPositionInFile(t,i),c=this.mapDefinitionInfoLocations(a.getLanguageService().getDefinitionAtPosition(i,o)||of,a);return n?this.mapDefinitionInfo(c,a):c.map(une.mapToOriginalLocation)}mapDefinitionInfoLocations(t,n){return t.map(i=>{const a=CMe(i,n);return a?{...a,containerKind:i.containerKind,containerName:i.containerName,kind:i.kind,name:i.name,failedAliasResolution:i.failedAliasResolution,...i.unverified&&{unverified:i.unverified}}:i})}getDefinitionAndBoundSpan(t,n){const{file:i,project:a}=this.getFileAndProject(t),o=this.getPositionInFile(t,i),c=O.checkDefined(a.getScriptInfo(i)),d=a.getLanguageService().getDefinitionAndBoundSpan(i,o);if(!d||!d.definitions)return{definitions:of,textSpan:void 0};const p=this.mapDefinitionInfoLocations(d.definitions,a),{textSpan:y}=d;return n?{definitions:this.mapDefinitionInfo(p,a),textSpan:M0(y,c)}:{definitions:p.map(une.mapToOriginalLocation),textSpan:y}}findSourceDefinition(t){var n;const{file:i,project:a}=this.getFileAndProject(t),o=this.getPositionInFile(t,i),c=a.getLanguageService().getDefinitionAtPosition(i,o);let d=this.mapDefinitionInfoLocations(c||of,a).slice();if(this.projectService.serverMode===0&&(!ht(d,D=>Dc(D.fileName)!==i&&!D.isAmbient)||ht(d,D=>!!D.failedAliasResolution))){const D=Zd(J=>J.textSpan.start,FQ(this.host.useCaseSensitiveFileNames));d==null||d.forEach(J=>D.add(J));const I=a.getNoDtsResolutionProject(i),M=I.getLanguageService(),L=(n=M.getDefinitionAtPosition(i,o,!0,!1))==null?void 0:n.filter(J=>Dc(J.fileName)!==i);if(ht(L))for(const J of L){if(J.unverified){const V=S(J,a.getLanguageService().getProgram(),M.getProgram());if(ht(V)){for(const q of V)D.add(q);continue}}D.add(J)}else{const J=d.filter(V=>Dc(V.fileName)!==i&&V.isAmbient);for(const V of ht(J)?J:b()){const q=y(V.fileName,i,I);if(!q)continue;const G=this.projectService.getOrCreateScriptInfoNotOpenedByClient(q,I.currentDirectory,I.directoryStructureHost,!1);if(!G)continue;I.containsScriptInfo(G)||(I.addRoot(G),I.updateGraph());const K=M.getProgram(),ne=O.checkDefined(K.getSourceFile(q));for(const oe of E(V.name,ne,K))D.add(oe)}}d=_a(D.values())}return d=d.filter(D=>!D.isAmbient&&!D.failedAliasResolution),this.mapDefinitionInfo(d,a);function y(D,I,M){var L,J,V;const q=mj(D);if(q&&D.lastIndexOf(fy)===q.topLevelNodeModulesIndex){const G=D.substring(0,q.packageRootIndex),K=(L=a.getModuleResolutionCache())==null?void 0:L.getPackageJsonInfoCache(),ne=a.getCompilationSettings(),oe=qN(es(G,a.getCurrentDirectory()),zN(K,a,ne));if(!oe)return;const re=tY(oe,{moduleResolution:2},a,a.getModuleResolutionCache()),Ee=D.substring(q.topLevelPackageNameIndex+1,q.packageRootIndex),pe=VN(wF(Ee)),Z=a.toPath(D);if(re&&ht(re,ve=>a.toPath(ve)===Z))return(J=M.resolutionCache.resolveSingleModuleNameWithoutWatching(pe,I).resolvedModule)==null?void 0:J.resolvedFileName;{const ve=D.substring(q.packageRootIndex+1),ge=`${pe}/${gp(ve)}`;return(V=M.resolutionCache.resolveSingleModuleNameWithoutWatching(ge,I).resolvedModule)==null?void 0:V.resolvedFileName}}}function b(){const D=a.getLanguageService(),I=D.getProgram(),M=Vp(I.getSourceFile(i),o);return(rc(M)||Ke(M))&&Yc(M.parent)&&wce(M,L=>{var J;if(L===M)return;const V=(J=D.getDefinitionAtPosition(i,L.getStart(),!0,!1))==null?void 0:J.filter(q=>Dc(q.fileName)!==i&&q.isAmbient).map(q=>({fileName:q.fileName,name:Xm(M)}));if(ht(V))return V})||of}function S(D,I,M){var L;const J=M.getSourceFile(D.fileName);if(!J)return;const V=Vp(I.getSourceFile(i),o),q=I.getTypeChecker().getSymbolAtLocation(V),G=q&&_l(q,276);if(!G)return;const K=((L=G.propertyName)==null?void 0:L.text)||G.name.text;return E(K,J,M)}function E(D,I,M){const L=Qc.Core.getTopMostDeclarationNamesInFile(D,I);return Rn(L,J=>{const V=M.getTypeChecker().getSymbolAtLocation(J),q=z3(J);if(V&&q)return U4.createDefinitionInfo(q,M.getTypeChecker(),V,q,!0)})}}getEmitOutput(t){const{file:n,project:i}=this.getFileAndProject(t);if(!i.shouldEmitFile(i.getScriptInfo(n)))return{emitSkipped:!0,outputFiles:[],diagnostics:[]};const a=i.getLanguageService().getEmitOutput(n);return t.richResponse?{...a,diagnostics:t.includeLinePosition?this.convertToDiagnosticsWithLinePositionFromDiagnosticFile(a.diagnostics):a.diagnostics.map(o=>i9(o,!0))}:a}mapJSDocTagInfo(t,n,i){return t?t.map(a=>{var o;return{...a,text:i?this.mapDisplayParts(a.text,n):(o=a.text)==null?void 0:o.map(c=>c.text).join("")}}):[]}mapDisplayParts(t,n){return t?t.map(i=>i.kind!=="linkName"?i:{...i,target:this.toFileSpan(i.target.fileName,i.target.textSpan,n)}):[]}mapSignatureHelpItems(t,n,i){return t.map(a=>({...a,documentation:this.mapDisplayParts(a.documentation,n),parameters:a.parameters.map(o=>({...o,documentation:this.mapDisplayParts(o.documentation,n)})),tags:this.mapJSDocTagInfo(a.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){const a=i.getLanguageService(),o=a.toLineColumnOffset(t,n.start),c=a.toLineColumnOffset(t,Il(n));return{file:t,start:{line:o.line+1,offset:o.character+1},end:{line:c.line+1,offset:c.character+1}}}toFileSpanWithContext(t,n,i,a){const o=this.toFileSpan(t,n,a),c=i&&this.toFileSpan(t,i,a);return c?{...o,contextStart:c.start,contextEnd:c.end}:o}getTypeDefinition(t){const{file:n,project:i}=this.getFileAndProject(t),a=this.getPositionInFile(t,n),o=this.mapDefinitionInfoLocations(i.getLanguageService().getTypeDefinitionAtPosition(n,a)||of,i);return this.mapDefinitionInfo(o,i)}mapImplementationLocations(t,n){return t.map(i=>{const a=CMe(i,n);return a?{...a,kind:i.kind,displayParts:i.displayParts}:i})}getImplementation(t,n){const{file:i,project:a}=this.getFileAndProject(t),o=this.getPositionInFile(t,i),c=this.mapImplementationLocations(a.getLanguageService().getImplementationAtPosition(i,o)||of,a);return n?c.map(({fileName:d,textSpan:p,contextSpan:y})=>this.toFileSpanWithContext(d,p,y,a)):c.map(une.mapToOriginalLocation)}getSyntacticDiagnosticsSync(t){const{configFile:n}=this.getConfigFileAndProject(t);return n?of:this.getDiagnosticsWorker(t,!1,(i,a)=>i.getLanguageService().getSyntacticDiagnostics(a),!!t.includeLinePosition)}getSemanticDiagnosticsSync(t){const{configFile:n,project:i}=this.getConfigFileAndProject(t);return n?this.getConfigFileDiagnostics(n,i,!!t.includeLinePosition):this.getDiagnosticsWorker(t,!0,(a,o)=>a.getLanguageService().getSemanticDiagnostics(o).filter(c=>!!c.file),!!t.includeLinePosition)}getSuggestionDiagnosticsSync(t){const{configFile:n}=this.getConfigFileAndProject(t);return n?of:this.getDiagnosticsWorker(t,!0,(i,a)=>i.getLanguageService().getSuggestionDiagnostics(a),!!t.includeLinePosition)}getJsxClosingTag(t){const{file:n,languageService:i}=this.getFileAndLanguageServiceForSyntacticOperation(t),a=this.getPositionInFile(t,n),o=i.getJsxClosingTagAtPosition(n,a);return o===void 0?void 0:{newText:o.newText,caretOffset:0}}getLinkedEditingRange(t){const{file:n,languageService:i}=this.getFileAndLanguageServiceForSyntacticOperation(t),a=this.getPositionInFile(t,n),o=i.getLinkedEditingRangeAtPosition(n,a),c=this.projectService.getScriptInfoForNormalizedPath(n);if(!(c===void 0||o===void 0))return uvt(o,c)}getDocumentHighlights(t,n){const{file:i,project:a}=this.getFileAndProject(t),o=this.getPositionInFile(t,i),c=a.getLanguageService().getDocumentHighlights(i,o,t.filesToSearch);return c?n?c.map(({fileName:d,highlightSpans:p})=>{const y=a.getScriptInfo(d);return{file:d,highlightSpans:p.map(({textSpan:b,kind:S,contextSpan:E})=>({...wye(b,E,y),kind:S}))}}):c:of}provideInlayHints(t){const{file:n,project:i}=this.getFileAndProject(t),a=this.projectService.getScriptInfoForNormalizedPath(n);return i.getLanguageService().provideInlayHints(n,t,this.getPreferences(n)).map(c=>{const{position:d,displayParts:p}=c;return{...c,position:a.positionToLineOffset(d),displayParts:p==null?void 0:p.map(({text:y,span:b,file:S})=>{if(b){O.assertIsDefined(S,"Target file should be defined together with its span.");const E=this.projectService.getScriptInfo(S);return{text:y,span:{start:E.positionToLineOffset(b.start),end:E.positionToLineOffset(b.start+b.length),file:S}}}else return{text:y}})}})}mapCode(t){var n;const i=this.getHostFormatOptions(),a=this.getHostPreferences(),{file:o,languageService:c}=this.getFileAndLanguageServiceForSyntacticOperation(t),d=this.projectService.getScriptInfoForNormalizedPath(o),p=(n=t.mapping.focusLocations)==null?void 0:n.map(b=>b.map(S=>{const E=d.lineOffsetToPosition(S.start.line,S.start.offset),D=d.lineOffsetToPosition(S.end.line,S.end.offset);return{start:E,length:D-E}})),y=c.mapCode(o,t.mapping.contents,p,i,a);return this.mapTextChangesToCodeEdits(y)}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,a,o){const{project:c}=this.getFileAndProjectWorker(t,n);return jg(c),{configFileName:c.getProjectName(),languageServiceDisabled:!c.languageServiceEnabled,fileNames:i?c.getFileNames(!1,o):void 0,configuredProjectInfo:a?this.getDefaultConfiguredProjectInfo(t):void 0}}getDefaultConfiguredProjectInfo(t){var n;const i=this.projectService.getScriptInfo(t);if(!i)return;const a=this.projectService.findDefaultConfiguredProjectWorker(i,3);if(!a)return;let o,c;return a.seenProjects.forEach((d,p)=>{p!==a.defaultProject&&(d!==3?(o??(o=[])).push(Dc(p.getConfigFilePath())):(c??(c=[])).push(Dc(p.getConfigFilePath())))}),(n=a.seenConfigs)==null||n.forEach(d=>(o??(o=[])).push(d)),{notMatchedByConfig:o,notInProject:c,defaultProject:a.defaultProject&&Dc(a.defaultProject.getConfigFilePath())}}getRenameInfo(t){const{file:n,project:i}=this.getFileAndProject(t),a=this.getPositionInFile(t,n),o=this.getPreferences(n);return i.getLanguageService().getRenameInfo(n,a,o)}getProjects(t,n,i){let a,o;if(t.projectFileName){const c=this.getProject(t.projectFileName);c&&(a=[c])}else{const c=n?this.projectService.getScriptInfoEnsuringProjectsUptoDate(t.file):this.projectService.getScriptInfo(t.file);if(c)n||this.projectService.ensureDefaultProjectForFile(c);else return i?of:(this.projectService.logErrorForScriptInfoNotFound(t.file),f1.ThrowNoProject());a=c.containingProjects,o=this.projectService.getSymlinkedProjects(c)}return a=sr(a,c=>c.languageServiceEnabled&&!c.isOrphan()),!i&&(!a||!a.length)&&!o?(this.projectService.logErrorForScriptInfoNotFound(t.file??t.projectFileName),f1.ThrowNoProject()):o?{projects:a,symLinkedProjects:o}:a}getDefaultProject(t){if(t.projectFileName){const i=this.getProject(t.projectFileName);if(i)return i;if(!t.file)return f1.ThrowNoProject()}return this.projectService.getScriptInfo(t.file).getDefaultProject()}getRenameLocations(t,n){const i=Dc(t.file),a=this.getPositionInFile(t,i),o=this.getProjects(t),c=this.getDefaultProject(t),d=this.getPreferences(i),p=this.mapRenameInfo(c.getLanguageService().getRenameInfo(i,a,d),O.checkDefined(this.projectService.getScriptInfo(i)));if(!p.canRename)return n?{info:p,locs:[]}:[];const y=ivt(o,c,{fileName:t.file,pos:a},!!t.findInStrings,!!t.findInComments,d,this.host.useCaseSensitiveFileNames);return n?{info:p,locs:this.toSpanGroups(y)}:y}mapRenameInfo(t,n){if(t.canRename){const{canRename:i,fileToRename:a,displayName:o,fullDisplayName:c,kind:d,kindModifiers:p,triggerSpan:y}=t;return{canRename:i,fileToRename:a,displayName:o,fullDisplayName:c,kind:d,kindModifiers:p,triggerSpan:M0(y,n)}}else return t}toSpanGroups(t){const n=new Map;for(const{fileName:i,textSpan:a,contextSpan:o,originalContextSpan:c,originalTextSpan:d,originalFileName:p,...y}of t){let b=n.get(i);b||n.set(i,b={file:i,locs:[]});const S=O.checkDefined(this.projectService.getScriptInfo(i));b.locs.push({...wye(a,o,S),...y})}return _a(n.values())}getReferences(t,n){const i=Dc(t.file),a=this.getProjects(t),o=this.getPositionInFile(t,i),c=avt(a,this.getDefaultProject(t),{fileName:t.file,pos:o},this.host.useCaseSensitiveFileNames,this.logger);if(!n)return c;const d=this.getPreferences(i),p=this.getDefaultProject(t),y=p.getScriptInfoForNormalizedPath(i),b=p.getLanguageService().getQuickInfoAtPosition(i,o),S=b?D5(b.displayParts):"",E=b&&b.textSpan,D=E?y.positionToLineOffset(E.start).offset:0,I=E?y.getSnapshot().getText(E.start,Il(E)):"";return{refs:un(c,L=>L.references.map(J=>PMe(this.projectService,J,d))),symbolName:I,symbolStartOffset:D,symbolDisplayString:S}}getFileReferences(t,n){const i=this.getProjects(t),a=Dc(t.file),o=this.getPreferences(a),c={fileName:a,pos:0},d=Eye(i,this.getDefaultProject(t),c,c,TMe,b=>(this.logger.info(`Finding references to file ${a} in project ${b.getProjectName()}`),b.getLanguageService().getFileReferences(a)));let p;if(Ja(d))p=d;else{p=[];const b=xee(this.host.useCaseSensitiveFileNames);d.forEach(S=>{for(const E of S)b.has(E)||(p.push(E),b.add(E))})}return n?{refs:p.map(b=>PMe(this.projectService,b,o)),symbolName:`"${t.file}"`}:p}openClientFile(t,n,i,a){this.projectService.openClientFileWithNormalizedPath(t,n,i,!1,a)}getPosition(t,n){return t.position!==void 0?t.position:n.lineOffsetToPosition(t.line,t.offset)}getPositionInFile(t,n){const i=this.projectService.getScriptInfoForNormalizedPath(n);return this.getPosition(t,i)}getFileAndProject(t){return this.getFileAndProjectWorker(t.file,t.projectFileName)}getFileAndLanguageServiceForSyntacticOperation(t){const{file:n,project:i}=this.getFileAndProject(t);return{file:n,languageService:i.getLanguageService(!1)}}getFileAndProjectWorker(t,n){const i=Dc(t),a=this.getProject(n)||this.projectService.ensureDefaultProjectForFile(i);return{file:i,project:a}}getOutliningSpans(t,n){const{file:i,languageService:a}=this.getFileAndLanguageServiceForSyntacticOperation(t),o=a.getOutliningSpans(i);if(n){const c=this.projectService.getScriptInfoForNormalizedPath(i);return o.map(d=>({textSpan:M0(d.textSpan,c),hintSpan:M0(d.hintSpan,c),bannerText:d.bannerText,autoCollapse:d.autoCollapse,kind:d.kind}))}else return o}getTodoComments(t){const{file:n,project:i}=this.getFileAndProject(t);return i.getLanguageService().getTodoComments(n,t.descriptors)}getDocCommentTemplate(t){const{file:n,languageService:i}=this.getFileAndLanguageServiceForSyntacticOperation(t),a=this.getPositionInFile(t,n);return i.getDocCommentTemplateAtPosition(n,a,this.getPreferences(n),this.getFormatOptions(n))}getSpanOfEnclosingComment(t){const{file:n,languageService:i}=this.getFileAndLanguageServiceForSyntacticOperation(t),a=t.onlyMultiLine,o=this.getPositionInFile(t,n);return i.getSpanOfEnclosingComment(n,o,a)}getIndentation(t){const{file:n,languageService:i}=this.getFileAndLanguageServiceForSyntacticOperation(t),a=this.getPositionInFile(t,n),o=t.options?Y4(t.options):this.getFormatOptions(n),c=i.getIndentationAtPosition(n,a,o);return{position:a,indentation:c}}getBreakpointStatement(t){const{file:n,languageService:i}=this.getFileAndLanguageServiceForSyntacticOperation(t),a=this.getPositionInFile(t,n);return i.getBreakpointStatementAtPosition(n,a)}getNameOrDottedNameSpan(t){const{file:n,languageService:i}=this.getFileAndLanguageServiceForSyntacticOperation(t),a=this.getPositionInFile(t,n);return i.getNameOrDottedNameSpan(n,a,a)}isValidBraceCompletion(t){const{file:n,languageService:i}=this.getFileAndLanguageServiceForSyntacticOperation(t),a=this.getPositionInFile(t,n);return i.isValidBraceCompletionAtPosition(n,a,t.openingBrace.charCodeAt(0))}getQuickInfoWorker(t,n){const{file:i,project:a}=this.getFileAndProject(t),o=this.projectService.getScriptInfoForNormalizedPath(i),c=a.getLanguageService().getQuickInfoAtPosition(i,this.getPosition(t,o));if(!c)return;const d=!!this.getPreferences(i).displayPartsForJSDoc;if(n){const p=D5(c.displayParts);return{kind:c.kind,kindModifiers:c.kindModifiers,start:o.positionToLineOffset(c.textSpan.start),end:o.positionToLineOffset(Il(c.textSpan)),displayString:p,documentation:d?this.mapDisplayParts(c.documentation,a):D5(c.documentation),tags:this.mapJSDocTagInfo(c.tags,a,d)}}else return d?c:{...c,tags:this.mapJSDocTagInfo(c.tags,a,!1)}}getFormattingEditsForRange(t){const{file:n,languageService:i}=this.getFileAndLanguageServiceForSyntacticOperation(t),a=this.projectService.getScriptInfoForNormalizedPath(n),o=a.lineOffsetToPosition(t.line,t.offset),c=a.lineOffsetToPosition(t.endLine,t.endOffset),d=i.getFormattingEditsForRange(n,o,c,this.getFormatOptions(n));if(d)return d.map(p=>this.convertTextChangeToCodeEdit(p,a))}getFormattingEditsForRangeFull(t){const{file:n,languageService:i}=this.getFileAndLanguageServiceForSyntacticOperation(t),a=t.options?Y4(t.options):this.getFormatOptions(n);return i.getFormattingEditsForRange(n,t.position,t.endPosition,a)}getFormattingEditsForDocumentFull(t){const{file:n,languageService:i}=this.getFileAndLanguageServiceForSyntacticOperation(t),a=t.options?Y4(t.options):this.getFormatOptions(n);return i.getFormattingEditsForDocument(n,a)}getFormattingEditsAfterKeystrokeFull(t){const{file:n,languageService:i}=this.getFileAndLanguageServiceForSyntacticOperation(t),a=t.options?Y4(t.options):this.getFormatOptions(n);return i.getFormattingEditsAfterKeystroke(n,t.position,t.key,a)}getFormattingEditsAfterKeystroke(t){const{file:n,languageService:i}=this.getFileAndLanguageServiceForSyntacticOperation(t),a=this.projectService.getScriptInfoForNormalizedPath(n),o=a.lineOffsetToPosition(t.line,t.offset),c=this.getFormatOptions(n),d=i.getFormattingEditsAfterKeystroke(n,o,t.key,c);if(t.key===`
|
|
478
478
|
`&&(!d||d.length===0||tvt(d,o))){const{lineText:p,absolutePosition:y}=a.textStorage.getAbsolutePositionAndLineText(t.line);if(p&&p.search("\\S")<0){const b=i.getIndentationAtPosition(n,o,c);let S=0,E,D;for(E=0,D=p.length;E<D;E++)if(p.charAt(E)===" ")S++;else if(p.charAt(E)===" ")S+=c.tabSize;else break;if(b!==S){const I=y+E;d.push({span:su(y,I),newText:Lu.getIndentationString(b,c)})}}}if(d)return d.map(p=>({start:a.positionToLineOffset(p.span.start),end:a.positionToLineOffset(Il(p.span)),newText:p.newText?p.newText:""}))}getCompletions(t,n){const{file:i,project:a}=this.getFileAndProject(t),o=this.projectService.getScriptInfoForNormalizedPath(i),c=this.getPosition(t,o),d=a.getLanguageService().getCompletionsAtPosition(i,c,{...cye(this.getPreferences(i)),triggerCharacter:t.triggerCharacter,triggerKind:t.triggerKind,includeExternalModuleExports:t.includeExternalModuleExports,includeInsertTextCompletions:t.includeInsertTextCompletions},a.projectService.getFormatCodeOptions(i));if(d===void 0)return;if(n==="completions-full")return d;const p=t.prefix||"",y=Rn(d.entries,S=>{if(d.isMemberCompletion||za(S.name.toLowerCase(),p.toLowerCase())){const E=S.replacementSpan?M0(S.replacementSpan,o):void 0;return{...S,replacementSpan:E,hasAction:S.hasAction||void 0,symbol:void 0}}});return n==="completions"?(d.metadata&&(y.metadata=d.metadata),y):{...d,optionalReplacementSpan:d.optionalReplacementSpan&&M0(d.optionalReplacementSpan,o),entries:y}}getCompletionEntryDetails(t,n){const{file:i,project:a}=this.getFileAndProject(t),o=this.projectService.getScriptInfoForNormalizedPath(i),c=this.getPosition(t,o),d=a.projectService.getFormatCodeOptions(i),p=!!this.getPreferences(i).displayPartsForJSDoc,y=Rn(t.entryNames,b=>{const{name:S,source:E,data:D}=typeof b=="string"?{name:b,source:void 0,data:void 0}:b;return a.getLanguageService().getCompletionEntryDetails(i,c,S,d,E,this.getPreferences(i),D?Is(D,mvt):void 0)});return n?p?y:y.map(b=>({...b,tags:this.mapJSDocTagInfo(b.tags,a,!1)})):y.map(b=>({...b,codeActions:Dt(b.codeActions,S=>this.mapCodeAction(S)),documentation:this.mapDisplayParts(b.documentation,a),tags:this.mapJSDocTagInfo(b.tags,a,p)}))}getCompileOnSaveAffectedFileList(t){const n=this.getProjects(t,!0,!0),i=this.projectService.getScriptInfo(t.file);return i?nvt(i,a=>this.projectService.getScriptInfoForPath(a),n,(a,o)=>{if(!a.compileOnSaveEnabled||!a.languageServiceEnabled||a.isOrphan())return;const c=a.getCompilationSettings();if(!(c.noEmit||sf(o.fileName)&&!evt(c)))return{projectFileName:a.getProjectName(),fileNames:a.getCompileOnSaveAffectedFileList(o),projectUsesOutFile:!!c.outFile}}):of}emitFile(t){const{file:n,project:i}=this.getFileAndProject(t);if(i||f1.ThrowNoProject(),!i.languageServiceEnabled)return t.richResponse?{emitSkipped:!0,diagnostics:[]}:!1;const a=i.getScriptInfo(n),{emitSkipped:o,diagnostics:c}=i.emitFile(a,(d,p,y)=>this.host.writeFile(d,p,y));return t.richResponse?{emitSkipped:o,diagnostics:t.includeLinePosition?this.convertToDiagnosticsWithLinePositionFromDiagnosticFile(c):c.map(d=>i9(d,!0))}:!o}getSignatureHelpItems(t,n){const{file:i,project:a}=this.getFileAndProject(t),o=this.projectService.getScriptInfoForNormalizedPath(i),c=this.getPosition(t,o),d=a.getLanguageService().getSignatureHelpItems(i,c,t),p=!!this.getPreferences(i).displayPartsForJSDoc;if(d&&n){const y=d.applicableSpan;return{...d,applicableSpan:{start:o.positionToLineOffset(y.start),end:o.positionToLineOffset(y.start+y.length)},items:this.mapSignatureHelpItems(d.items,a,p)}}else return p||!d?d:{...d,items:d.items.map(y=>({...y,tags:this.mapJSDocTagInfo(y.tags,a,!1)}))}}toPendingErrorCheck(t){const n=Dc(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){const n=this.projectService.getScriptInfo(t.file);O.assert(!!n),n.textStorage.switchToScriptVersionCache();const i=n.lineOffsetToPosition(t.line,t.offset),a=n.lineOffsetToPosition(t.endLine,t.endOffset);i>=0&&(this.changeSeq++,this.projectService.applyChangesToFile(n,Wa({span:{start:i,length:a-i},newText:t.insertString})))}reload(t){const n=Dc(t.file),i=t.tmpfile===void 0?void 0:Dc(t.tmpfile),a=this.projectService.getScriptInfoForNormalizedPath(n);a&&(this.changeSeq++,a.reloadFromFile(i))}saveToTmp(t,n){const i=this.projectService.getScriptInfo(t);i&&i.saveTo(n)}closeClientFile(t){if(!t)return;const n=oo(t);this.projectService.closeClientFile(n)}mapLocationNavigationBarItems(t,n){return Dt(t,i=>({text:i.text,kind:i.kind,kindModifiers:i.kindModifiers,spans:i.spans.map(a=>M0(a,n)),childItems:this.mapLocationNavigationBarItems(i.childItems,n),indent:i.indent}))}getNavigationBarItems(t,n){const{file:i,languageService:a}=this.getFileAndLanguageServiceForSyntacticOperation(t),o=a.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=>M0(i,n)),nameSpan:t.nameSpan&&M0(t.nameSpan,n),childItems:Dt(t.childItems,i=>this.toLocationNavigationTree(i,n))}}getNavigationTree(t,n){const{file:i,languageService:a}=this.getFileAndLanguageServiceForSyntacticOperation(t),o=a.getNavigationTree(i);return o?n?this.toLocationNavigationTree(o,this.projectService.getScriptInfoForNormalizedPath(i)):o:void 0}getNavigateToItems(t,n){const i=this.getFullNavigateToItems(t);return n?un(i,({project:a,navigateToItems:o})=>o.map(c=>{const d=a.getScriptInfo(c.fileName),p={name:c.name,kind:c.kind,kindModifiers:c.kindModifiers,isCaseSensitive:c.isCaseSensitive,matchKind:c.matchKind,file:c.fileName,start:d.positionToLineOffset(c.textSpan.start),end:d.positionToLineOffset(Il(c.textSpan))};return c.kindModifiers&&c.kindModifiers!==""&&(p.kindModifiers=c.kindModifiers),c.containerName&&c.containerName.length>0&&(p.containerName=c.containerName),c.containerKind&&c.containerKind.length>0&&(p.containerKind=c.containerKind),p})):un(i,({navigateToItems:a})=>a)}getFullNavigateToItems(t){const{currentFileOnly:n,searchValue:i,maxResultCount:a,projectFileName:o}=t;if(n){O.assertIsDefined(t.file);const{file:E,project:D}=this.getFileAndProject(t);return[{project:D,navigateToItems:D.getLanguageService().getNavigateToItems(i,a,E)}]}const c=this.getHostPreferences(),d=[],p=new Map;if(!t.file&&!o)this.projectService.loadAncestorProjectTree(),this.projectService.forEachEnabledProject(E=>y(E));else{const E=this.getProjects(t);SMe(E,void 0,D=>y(D))}return d;function y(E){const D=E.getLanguageService().getNavigateToItems(i,a,void 0,E.isNonTsProject(),c.excludeLibrarySymbolsInNavTo),I=sr(D,M=>b(M)&&!kee(RI(M),E));I.length&&d.push({project:E,navigateToItems:I})}function b(E){const D=E.name;if(!p.has(D))return p.set(D,[E]),!0;const I=p.get(D);for(const M of I)if(S(M,E))return!1;return I.push(E),!0}function S(E,D){return E===D?!0:!E||!D?!1:E.containerKind===D.containerKind&&E.containerName===D.containerName&&E.fileName===D.fileName&&E.isCaseSensitive===D.isCaseSensitive&&E.kind===D.kind&&E.kindModifiers===D.kindModifiers&&E.matchKind===D.matchKind&&E.name===D.name&&E.textSpan.start===D.textSpan.start&&E.textSpan.length===D.textSpan.length}}getSupportedCodeFixes(t){if(!t)return JZ();if(t.file){const{file:i,project:a}=this.getFileAndProject(t);return a.getLanguageService().getSupportedCodeFixes(i)}const n=this.getProject(t.projectFileName);return n||f1.ThrowNoProject(),n.getLanguageService().getSupportedCodeFixes()}isLocation(t){return t.line!==void 0}extractPositionOrRange(t,n){let i,a;return this.isLocation(t)?i=o(t):a=this.getRange(t,n),O.checkDefined(i===void 0?a:i);function o(c){return c.position!==void 0?c.position:n.lineOffsetToPosition(c.line,c.offset)}}getRange(t,n){const{startPosition:i,endPosition:a}=this.getStartAndEndPosition(t,n);return{pos:i,end:a}}getApplicableRefactors(t){const{file:n,project:i}=this.getFileAndProject(t),a=i.getScriptInfoForNormalizedPath(n);return i.getLanguageService().getApplicableRefactors(n,this.extractPositionOrRange(t,a),this.getPreferences(n),t.triggerReason,t.kind,t.includeInteractiveActions).map(c=>({...c,actions:c.actions.map(d=>({...d,range:d.range?{start:X4({line:d.range.start.line,character:d.range.start.offset}),end:X4({line:d.range.end.line,character:d.range.end.offset})}:void 0}))}))}getEditsForRefactor(t,n){const{file:i,project:a}=this.getFileAndProject(t),o=a.getScriptInfoForNormalizedPath(i),c=a.getLanguageService().getEditsForRefactor(i,this.getFormatOptions(i),this.extractPositionOrRange(t,o),t.refactor,t.action,this.getPreferences(i),t.interactiveRefactorArguments);if(c===void 0)return{edits:[]};if(n){const{renameFilename:d,renameLocation:p,edits:y}=c;let b;if(d!==void 0&&p!==void 0){const S=a.getScriptInfoForNormalizedPath(Dc(d));b=Dye(LD(S.getSnapshot()),d,p,y)}return{renameLocation:b,renameFilename:d,edits:this.mapTextChangesToCodeEdits(y),notApplicableReason:c.notApplicableReason}}return c}getMoveToRefactoringFileSuggestions(t){const{file:n,project:i}=this.getFileAndProject(t),a=i.getScriptInfoForNormalizedPath(n);return i.getLanguageService().getMoveToRefactoringFileSuggestions(n,this.extractPositionOrRange(t,a),this.getPreferences(n))}preparePasteEdits(t){const{file:n,project:i}=this.getFileAndProject(t);return i.getLanguageService().preparePasteEditsForFile(n,t.copiedTextSpan.map(a=>this.getRange({file:n,startLine:a.start.line,startOffset:a.start.offset,endLine:a.end.line,endOffset:a.end.offset},this.projectService.getScriptInfoForNormalizedPath(n))))}getPasteEdits(t){const{file:n,project:i}=this.getFileAndProject(t);if(MI(n))return;const a=t.copiedFrom?{file:t.copiedFrom.file,range:t.copiedFrom.spans.map(c=>this.getRange({file:t.copiedFrom.file,startLine:c.start.line,startOffset:c.start.offset,endLine:c.end.line,endOffset:c.end.offset},i.getScriptInfoForNormalizedPath(Dc(t.copiedFrom.file))))}:void 0,o=i.getLanguageService().getPasteEdits({targetFile:n,pastedText:t.pastedText,pasteLocations:t.pasteLocations.map(c=>this.getRange({file:n,startLine:c.start.line,startOffset:c.start.offset,endLine:c.end.line,endOffset:c.end.offset},i.getScriptInfoForNormalizedPath(n))),copiedFrom:a,preferences:this.getPreferences(n)},this.getFormatOptions(n));return o&&this.mapPasteEditsAction(o)}organizeImports(t,n){O.assert(t.scope.type==="file");const{file:i,project:a}=this.getFileAndProject(t.scope.args),o=a.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){const i=Dc(t.oldFilePath),a=Dc(t.newFilePath),o=this.getHostFormatOptions(),c=this.getHostPreferences(),d=new Set,p=[];return this.projectService.loadAncestorProjectTree(),this.projectService.forEachEnabledProject(y=>{const b=y.getLanguageService().getEditsForFileRename(i,a,o,c),S=[];for(const E of b)d.has(E.fileName)||(p.push(E),S.push(E.fileName));for(const E of S)d.add(E)}),n?p.map(y=>this.mapTextChangeToCodeEdit(y)):p}getCodeFixes(t,n){const{file:i,project:a}=this.getFileAndProject(t),o=a.getScriptInfoForNormalizedPath(i),{startPosition:c,endPosition:d}=this.getStartAndEndPosition(t,o);let p;try{p=a.getLanguageService().getCodeFixesAtPosition(i,c,d,t.errorCodes,this.getFormatOptions(i),this.getPreferences(i))}catch(y){const b=a.getLanguageService(),S=[...b.getSyntacticDiagnostics(i),...b.getSemanticDiagnostics(i),...b.getSuggestionDiagnostics(i)].map(D=>h7(c,d-c,D.start,D.length)&&D.code),E=t.errorCodes.find(D=>!S.includes(D));throw E!==void 0&&(y.message=`BADCLIENT: Bad error code, ${E} not found in range ${c}..${d} (found: ${S.join(", ")}); could have caused this error:
|
|
479
479
|
${y.message}`),y}return n?p.map(y=>this.mapCodeFixAction(y)):p}getCombinedCodeFix({scope:t,fixId:n},i){O.assert(t.type==="file");const{file:a,project:o}=this.getFileAndProject(t.args),c=o.getLanguageService().getCombinedCodeFix({type:"file",fileName:a},n,this.getFormatOptions(a),this.getPreferences(a));return i?{changes:this.mapTextChangesToCodeEdits(c.changes),commands:c.commands}:c}applyCodeActionCommand(t){const n=t.command;for(const i of kh(n)){const{file:a,project:o}=this.getFileAndProject(i);o.getLanguageService().applyCodeActionCommand(i,this.getFormatOptions(a)).then(c=>{},c=>{})}return{}}getStartAndEndPosition(t,n){let i,a;return t.startPosition!==void 0?i=t.startPosition:(i=n.lineOffsetToPosition(t.startLine,t.startOffset),t.startPosition=i),t.endPosition!==void 0?a=t.endPosition:(a=n.lineOffsetToPosition(t.endLine,t.endOffset),t.endPosition=a),{startPosition:i,endPosition:a}}mapCodeAction({description:t,changes:n,commands:i}){return{description:t,changes:this.mapTextChangesToCodeEdits(n),commands:i}}mapCodeFixAction({fixName:t,description:n,changes:i,commands:a,fixId:o,fixAllDescription:c}){return{fixName:t,description:n,changes:this.mapTextChangesToCodeEdits(i),commands:a,fixId:o,fixAllDescription:c}}mapPasteEditsAction({edits:t,fixId:n}){return{edits:this.mapTextChangesToCodeEdits(t),fixId:n}}mapTextChangesToCodeEdits(t){return t.map(n=>this.mapTextChangeToCodeEdit(n))}mapTextChangeToCodeEdit(t){const 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=>lvt(i,n))}:_vt(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){const{file:i,languageService:a}=this.getFileAndLanguageServiceForSyntacticOperation(t),o=this.projectService.getScriptInfoForNormalizedPath(i),c=this.getPosition(t,o),d=a.getBraceMatchingAtPosition(i,c);return d?n?d.map(p=>M0(p,o)):d:void 0}getDiagnosticsForProject(t,n,i){if(this.suppressDiagnosticEvents)return;const{fileNames:a,languageServiceDisabled:o}=this.getProjectInfoWorker(i,void 0,!0,void 0,!0);if(o)return;const c=a.filter(M=>!M.includes("lib.d.ts"));if(c.length===0)return;const d=[],p=[],y=[],b=[],S=Dc(i),E=this.projectService.ensureDefaultProjectForFile(S);for(const M of c)this.getCanonicalFileName(M)===this.getCanonicalFileName(i)?d.push(M):this.projectService.getScriptInfo(M).isScriptOpen()?p.push(M):sf(M)?b.push(M):y.push(M);const I=[...d,...p,...y,...b].map(M=>({fileName:M,project:E}));this.updateErrorCheck(t,I,n,!1)}configurePlugin(t){this.projectService.configurePlugin(t)}getSmartSelectionRange(t,n){const{locations:i}=t,{file:a,languageService:o}=this.getFileAndLanguageServiceForSyntacticOperation(t),c=O.checkDefined(this.projectService.getScriptInfo(a));return Dt(i,d=>{const p=this.getPosition(d,c),y=o.getSmartSelectionRange(a,p);return n?this.mapSelectionRange(y,c):y})}toggleLineComment(t,n){const{file:i,languageService:a}=this.getFileAndLanguageServiceForSyntacticOperation(t),o=this.projectService.getScriptInfo(i),c=this.getRange(t,o),d=a.toggleLineComment(i,c);if(n){const p=this.projectService.getScriptInfoForNormalizedPath(i);return d.map(y=>this.convertTextChangeToCodeEdit(y,p))}return d}toggleMultilineComment(t,n){const{file:i,languageService:a}=this.getFileAndLanguageServiceForSyntacticOperation(t),o=this.projectService.getScriptInfoForNormalizedPath(i),c=this.getRange(t,o),d=a.toggleMultilineComment(i,c);if(n){const p=this.projectService.getScriptInfoForNormalizedPath(i);return d.map(y=>this.convertTextChangeToCodeEdit(y,p))}return d}commentSelection(t,n){const{file:i,languageService:a}=this.getFileAndLanguageServiceForSyntacticOperation(t),o=this.projectService.getScriptInfoForNormalizedPath(i),c=this.getRange(t,o),d=a.commentSelection(i,c);if(n){const p=this.projectService.getScriptInfoForNormalizedPath(i);return d.map(y=>this.convertTextChangeToCodeEdit(y,p))}return d}uncommentSelection(t,n){const{file:i,languageService:a}=this.getFileAndLanguageServiceForSyntacticOperation(t),o=this.projectService.getScriptInfoForNormalizedPath(i),c=this.getRange(t,o),d=a.uncommentSelection(i,c);if(n){const p=this.projectService.getScriptInfoForNormalizedPath(i);return d.map(y=>this.convertTextChangeToCodeEdit(y,p))}return d}mapSelectionRange(t,n){const i={textSpan:M0(t.textSpan,n)};return t.parent&&(i.parent=this.mapSelectionRange(t.parent,n)),i}getScriptInfoFromProjectService(t){const n=Dc(t),i=this.projectService.getScriptInfoForNormalizedPath(n);return i||(this.projectService.logErrorForScriptInfoNotFound(n),f1.ThrowNoProject())}toProtocolCallHierarchyItem(t){const n=this.getScriptInfoFromProjectService(t.file);return{name:t.name,kind:t.kind,kindModifiers:t.kindModifiers,file:t.file,containerName:t.containerName,span:M0(t.span,n),selectionSpan:M0(t.selectionSpan,n)}}toProtocolCallHierarchyIncomingCall(t){const n=this.getScriptInfoFromProjectService(t.from.file);return{from:this.toProtocolCallHierarchyItem(t.from),fromSpans:t.fromSpans.map(i=>M0(i,n))}}toProtocolCallHierarchyOutgoingCall(t,n){return{to:this.toProtocolCallHierarchyItem(t.to),fromSpans:t.fromSpans.map(i=>M0(i,n))}}prepareCallHierarchy(t){const{file:n,project:i}=this.getFileAndProject(t),a=this.projectService.getScriptInfoForNormalizedPath(n);if(a){const o=this.getPosition(t,a),c=i.getLanguageService().prepareCallHierarchy(n,o);return c&&QQ(c,d=>this.toProtocolCallHierarchyItem(d))}}provideCallHierarchyIncomingCalls(t){const{file:n,project:i}=this.getFileAndProject(t),a=this.getScriptInfoFromProjectService(n);return i.getLanguageService().provideCallHierarchyIncomingCalls(n,this.getPosition(t,a)).map(c=>this.toProtocolCallHierarchyIncomingCall(c))}provideCallHierarchyOutgoingCalls(t){const{file:n,project:i}=this.getFileAndProject(t),a=this.getScriptInfoFromProjectService(n);return i.getLanguageService().provideCallHierarchyOutgoingCalls(n,this.getPosition(t,a)).map(c=>this.toProtocolCallHierarchyOutgoingCall(c,a))}getCanonicalFileName(t){const n=this.host.useCaseSensitiveFileNames?t:f0(t);return oo(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){const a=this.performanceData;try{return this.performanceData=i,this.setCurrentRequest(t),n()}finally{this.resetCurrentRequest(t),this.performanceData=a}}executeCommand(t){const n=this.handlers.get(t.command);if(n){const i=this.executeWithRequestId(t.seq,()=>n(t),void 0);return this.projectService.enableRequestedPlugins(),i}else return this.logger.msg(`Unrecognized JSON command:${bT(t)}`,"Err"),this.doOutput(void 0,"unknown",t.seq,!1,void 0,`Unrecognized JSON command: ${t.command}`),{responseRequired:!1}}onMessage(t){var n,i,a,o,c,d,p;this.gcTimer.scheduleCollect();let y;const b=this.performanceData;this.logger.hasLevel(2)&&(y=this.hrtime(),this.logger.hasLevel(3)&&this.logger.info(`request:${oI(this.toStringMessage(t))}`));let S,E;try{S=this.parseMessage(t),E=S.arguments&&S.arguments.file?S.arguments:void 0,(n=$n)==null||n.instant($n.Phase.Session,"request",{seq:S.seq,command:S.command}),(i=$n)==null||i.push($n.Phase.Session,"executeCommand",{seq:S.seq,command:S.command},!0);const{response:D,responseRequired:I,performanceData:M}=this.executeCommand(S);if((a=$n)==null||a.pop(),this.logger.hasLevel(2)){const L=K0t(this.hrtime(y)).toFixed(4);I?this.logger.perftrc(`${S.seq}::${S.command}: elapsed time (in milliseconds) ${L}`):this.logger.perftrc(`${S.seq}::${S.command}: async elapsed time (in milliseconds) ${L}`)}(o=$n)==null||o.instant($n.Phase.Session,"response",{seq:S.seq,command:S.command,success:!!D}),D?this.doOutput(D,S.command,S.seq,!0,M):I&&this.doOutput(void 0,S.command,S.seq,!1,M,"No content available.")}catch(D){if((c=$n)==null||c.popAll(),D instanceof s3){(d=$n)==null||d.instant($n.Phase.Session,"commandCanceled",{seq:S==null?void 0:S.seq,command:S==null?void 0:S.command}),this.doOutput({canceled:!0},S.command,S.seq,!0,this.performanceData);return}this.logErrorWorker(D,this.toStringMessage(t),E),(p=$n)==null||p.instant($n.Phase.Session,"commandError",{seq:S==null?void 0:S.seq,command:S==null?void 0:S.command,message:D.message}),this.doOutput(void 0,S?S.command:"unknown",S?S.seq:0,!1,this.performanceData,"Error processing request. "+D.message+`
|
|
480
|
-
`+D.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 DMe(e){const t=e.diagnosticsDuration&&_a(e.diagnosticsDuration,([n,i])=>({...i,file:n}));return{...e,diagnosticsDuration:t}}function M0(e,t){return{start:t.positionToLineOffset(e.start),end:t.positionToLineOffset(Il(e))}}function wye(e,t,n){const i=M0(e,n),a=t&&M0(t,n);return a?{...i,contextStart:a.start,contextEnd:a.end}:i}function lvt(e,t){return{start:AMe(t,e.span.start),end:AMe(t,Il(e.span)),newText:e.newText}}function AMe(e,t){return bye(e)?fvt(e.getLineAndCharacterOfPosition(t)):e.positionToLineOffset(t)}function uvt(e,t){const 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 fvt(e){return{line:e.line+1,offset:e.character+1}}function _vt(e){O.assert(e.textChanges.length===1);const t=Ns(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 Dye(e,t,n,i){const a=pvt(e,t,i),{line:o,character:c}=_A(Ew(a),n);return{line:o+1,offset:c+1}}function pvt(e,t,n){for(const{fileName:i,textChanges:a}of n)if(i===t)for(let o=a.length-1;o>=0;o--){const{newText:c,span:{start:d,length:p}}=a[o];e=e.slice(0,d)+c+e.slice(d+p)}return e}function PMe(e,{fileName:t,textSpan:n,contextSpan:i,isWriteAccess:a,isDefinition:o},{disableLineTextInReferences:c}){const d=O.checkDefined(e.getScriptInfo(t)),p=wye(n,i,d),y=c?void 0:dvt(d,p);return{file:t,...p,lineText:y,isWriteAccess:a,isDefinition:o}}function dvt(e,t){const n=e.lineToTextSpan(t.start.line-1);return e.getSnapshot().getText(n.start,Il(n)).replace(/\r|\n/g,"")}function mvt(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 Q4=4,Aye=(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))(Aye||{}),gvt=class{constructor(){this.goSubtree=!0,this.lineIndex=new a9,this.endBranch=[],this.state=2,this.initialText="",this.trailingText="",this.lineIndex.root=new Z4,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;const i=a9.linesFromText(e).lines;i.length>1&&i[i.length-1]===""&&i.pop();let a,o;for(let d=this.endBranch.length-1;d>=0;d--)this.endBranch[d].updateCounts(),this.endBranch[d].charCount()===0&&(o=this.endBranch[d],d>0?a=this.endBranch[d-1]:a=this.branchNode);o&&a.remove(o);const c=this.startPath[this.startPath.length-1];if(i.length>0)if(c.text=i[0],i.length>1){let d=new Array(i.length-1),p=c;for(let S=1;S<i.length;S++)d[S-1]=new nz(i[S]);let y=this.startPath.length-2;for(;y>=0;){const S=this.startPath[y];d=S.insertAt(p,d),y--,p=S}let b=d.length;for(;b>0;){const S=new Z4;S.add(this.lineIndex.root),d=S.insertAt(this.lineIndex.root,d),b=d.length,this.lineIndex.root=S}this.lineIndex.root.updateCounts()}else for(let d=this.startPath.length-2;d>=0;d--)this.startPath[d].updateCounts();else{this.startPath[this.startPath.length-2].remove(c);for(let 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,a){const o=this.stack[this.stack.length-1];this.state===2&&a===1&&(this.state=1,this.branchNode=o,this.lineCollectionAtBranch=n);let c;function d(p){return p.isLeaf()?new nz(""):new Z4}switch(a){case 0:this.goSubtree=!1,this.state!==4&&o.add(n);break;case 1:this.state===4?this.goSubtree=!1:(c=d(n),o.add(c),this.startPath.push(c));break;case 2:this.state!==4?(c=d(n),o.add(c),this.startPath.push(c)):n.isLeaf()||(c=d(n),o.add(c),this.endBranch.push(c));break;case 3:this.goSubtree=!1;break;case 4:this.state!==4?this.goSubtree=!1:n.isLeaf()||(c=d(n),o.add(c),this.endBranch.push(c));break;case 5:this.goSubtree=!1,this.state!==1&&o.add(n);break}this.goSubtree&&this.stack.push(c)}leaf(e,t,n){this.state===1?this.initialText=n.text.substring(0,e):this.state===2?(this.initialText=n.text.substring(0,e),this.trailingText=n.text.substring(e+t)):this.trailingText=n.text.substring(e+t)}},hvt=class{constructor(e,t,n){this.pos=e,this.deleteLen=t,this.insertedText=n}getTextChangeRange(){return v7(Gf(this.pos,this.deleteLen),this.insertedText?this.insertedText.length:0)}},Cee=class fw{constructor(){this.changes=[],this.versions=new Array(fw.maxVersions),this.minVersion=0,this.currentVersion=0}versionToIndex(t){if(!(t<this.minVersion||t>this.currentVersion))return t%fw.maxVersions}currentVersionToIndex(){return this.currentVersion%fw.maxVersions}edit(t,n,i){this.changes.push(new hvt(t,n,i)),(this.changes.length>fw.changeNumberThreshold||n>fw.changeLengthThreshold||i&&i.length>fw.changeLengthThreshold)&&this.getSnapshot()}getSnapshot(){return this._getSnapshot()}_getSnapshot(){let t=this.versions[this.currentVersionToIndex()];if(this.changes.length>0){let n=t.index;for(const i of this.changes)n=n.edit(i.pos,i.deleteLen,i.insertedText);t=new NMe(this.currentVersion+1,this,n,this.changes),this.currentVersion=t.version,this.versions[this.currentVersionToIndex()]=t,this.changes=[],this.currentVersion-this.minVersion>=fw.maxVersions&&(this.minVersion=this.currentVersion-fw.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){const n=this._getSnapshot().index,{lineText:i,absolutePosition:a}=n.lineNumberToInfo(t+1),o=i!==void 0?i.length:n.absolutePositionOfStartOfLine(t+2)-a;return Gf(a,o)}getTextChangesBetweenVersions(t,n){if(t<n)if(t>=this.minVersion){const i=[];for(let a=t+1;a<=n;a++){const o=this.versions[this.versionToIndex(a)];for(const c of o.changesSincePreviousVersion)i.push(c.getTextChangeRange())}return use(i)}else return;else return SL}getLineCount(){return this._getSnapshot().index.getLineCount()}static fromString(t){const n=new fw,i=new NMe(0,n,new a9);n.versions[n.currentVersion]=i;const a=a9.linesFromText(t);return i.index.load(a.lines),n}};Cee.changeNumberThreshold=8,Cee.changeLengthThreshold=256,Cee.maxVersions=8;var Eee=Cee,NMe=class cQe{constructor(t,n,i,a=of){this.version=t,this.cache=n,this.index=i,this.changesSincePreviousVersion=a}getText(t,n){return this.index.getText(t,n-t)}getLength(){return this.index.getLength()}getChangeRange(t){if(t instanceof cQe&&this.cache===t.cache)return this.version<=t.version?SL:this.cache.getTextChangesBetweenVersions(t.version,this.version)}},a9=class FTe{constructor(){this.checkEdits=!1}absolutePositionOfStartOfLine(t){return this.lineNumberToInfo(t).absolutePosition}positionToLineOffset(t){const{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){const n=this.getLineCount();if(t<=n){const{position:i,leaf:a}=this.root.lineNumberToInfo(t,0);return{absolutePosition:i,lineText:a&&a.text}}else return{absolutePosition:this.root.charCount(),lineText:void 0}}load(t){if(t.length>0){const n=[];for(let i=0;i<t.length;i++)n[i]=new nz(t[i]);this.root=FTe.buildTreeFromBottom(n)}else this.root=new Z4}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:(a,o,c)=>{i=i.concat(c.text.substring(a,a+o))}}),i}getLength(){return this.root.charCount()}every(t,n,i){i||(i=this.root.charCount());const a={goSubtree:!0,done:!1,leaf(o,c,d){t(d,o,c)||(this.done=!0)}};return this.walk(n,i-n,a),!a.done}edit(t,n,i){if(this.root.charCount()===0)return O.assert(n===0),i!==void 0?(this.load(FTe.linesFromText(i).lines),this):void 0;{let a;if(this.checkEdits){const d=this.getText(0,this.root.charCount());a=d.slice(0,t)+i+d.slice(t+n)}const o=new gvt;let c=!1;if(t>=this.root.charCount()){t=this.root.charCount()-1;const d=this.getText(t,1);i?i=d+i:i=d,n=0,c=!0}else if(n>0){const d=t+n,{zeroBasedColumn:p,lineText:y}=this.positionToColumnAndLineText(d);p===0&&(n+=y.length,i=i?i+y:y)}if(this.root.walk(t,n,o),o.insertLines(i,c),this.checkEdits){const d=o.lineIndex.getText(0,o.lineIndex.getLength());O.assert(a===d,"buffer edit mismatch")}return o.lineIndex}}static buildTreeFromBottom(t){if(t.length<Q4)return new Z4(t);const n=new Array(Math.ceil(t.length/Q4));let i=0;for(let a=0;a<n.length;a++){const o=Math.min(i+Q4,t.length);n[a]=new Z4(t.slice(i,o)),i=o}return this.buildTreeFromBottom(n)}static linesFromText(t){const n=Ew(t);if(n.length===0)return{lines:[],lineMap:n};const i=new Array(n.length),a=n.length-1;for(let c=0;c<a;c++)i[c]=t.substring(n[c],n[c+1]);const o=t.substring(n[a]);return o.length>0?i[a]=o:i.pop(),{lines:i,lineMap:n}}},Z4=class MTe{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(const t of this.children)this.totalChars+=t.charCount(),this.totalLines+=t.lineCount()}execWalk(t,n,i,a,o){return i.pre&&i.pre(t,n,this.children[a],this,o),i.goSubtree?(this.children[a].walk(t,n,i),i.post&&i.post(t,n,this.children[a],this,o)):i.goSubtree=!0,i.done}skipChild(t,n,i,a,o){a.pre&&!a.done&&(a.pre(t,n,this.children[i],this,o),a.goSubtree=!0)}walk(t,n,i){if(this.children.length===0)return;let a=0,o=this.children[a].charCount(),c=t;for(;c>=o;)this.skipChild(c,n,a,i,0),c-=o,a++,o=this.children[a].charCount();if(c+n<=o){if(this.execWalk(c,n,i,a,2))return}else{if(this.execWalk(c,o-c,i,a,1))return;let d=n-(o-c);for(a++,o=this.children[a].charCount();d>o;){if(this.execWalk(0,o,i,a,3))return;d-=o,a++,o=this.children[a].charCount()}if(d>0&&this.execWalk(0,d,i,a,4))return}if(i.pre){const d=this.children.length;if(a<d-1)for(let p=a+1;p<d;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(const 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()}const i=this.lineCount();if(i===0)return{oneBasedLine:1,zeroBasedColumn:0,lineText:void 0};const a=O.checkDefined(this.lineNumberToInfo(i,0).leaf);return{oneBasedLine:i,zeroBasedColumn:a.charCount(),lineText:void 0}}lineNumberToInfo(t,n){for(const i of this.children){const a=i.lineCount();if(a>=t)return i.isLeaf()?{position:n,leaf:i}:i.lineNumberToInfo(t,n);t-=a,n+=i.charCount()}return{position:n,leaf:void 0}}splitAfter(t){let n;const i=this.children.length;t++;const a=t;if(t<i){for(n=new MTe;t<i;)n.add(this.children[t]),t++;n.updateCounts()}return this.children.length=a,n}remove(t){const n=this.findChildIndex(t),i=this.children.length;if(n<i-1)for(let a=n;a<i-1;a++)this.children[a]=this.children[a+1];this.children.pop()}findChildIndex(t){const n=this.children.indexOf(t);return O.assert(n!==-1),n}insertAt(t,n){let i=this.findChildIndex(t);const a=this.children.length,o=n.length;if(a<Q4&&i===a-1&&o===1)return this.add(n[0]),this.updateCounts(),[];{const c=this.splitAfter(i);let d=0;for(i++;i<Q4&&d<o;)this.children[i]=n[d],i++,d++;let p=[],y=0;if(d<o){y=Math.ceil((o-d)/Q4),p=new Array(y);let b=0;for(let E=0;E<y;E++)p[E]=new MTe;let S=p[0];for(;d<o;)S.add(n[d]),d++,S.children.length===Q4&&(b++,S=p[b]);for(let E=p.length-1;E>=0;E--)p[E].children.length===0&&p.pop()}c&&p.push(c),this.updateCounts();for(let b=0;b<y;b++)p[b].updateCounts();return p}}add(t){this.children.push(t),O.assert(this.children.length<=Q4)}charCount(){return this.totalChars}lineCount(){return this.totalLines}},nz=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}},IMe=class lQe{constructor(t,n,i,a,o,c){this.telemetryEnabled=t,this.logger=n,this.host=i,this.globalTypingsCacheLocation=a,this.event=o,this.maxActiveRequestCount=c,this.activeRequestCount=0,this.requestQueue=Op(),this.requestMap=new Map,this.requestedRegistry=!1,this.packageInstallId=0}isKnownTypesPackageName(t){var n;return Z2.validatePackageName(t)!==Z2.NameValidationResult.Ok?!1:(this.requestedRegistry||(this.requestedRegistry=!0,this.installer.send({kind:"typesRegistry"})),!!((n=this.typesRegistryCache)!=null&&n.has(t)))}installPackage(t){this.packageInstallId++;const n={kind:"installPackage",...t,id:this.packageInstallId},i=new Promise((a,o)=>{(this.packageInstalledPromise??(this.packageInstalledPromise=new Map)).set(this.packageInstallId,{resolve:a,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){const a=Lve(t,n,i);this.logger.hasLevel(3)&&this.logger.info(`TIAdapter:: Scheduling throttled operation:${bT(a)}`),this.activeRequestCount<this.maxActiveRequestCount?this.scheduleRequest(a):(this.logger.hasLevel(3)&&this.logger.info(`TIAdapter:: Deferring request for: ${a.projectName}`),this.requestQueue.enqueue(a),this.requestMap.set(a.projectName,a))}handleMessage(t){var n,i;switch(this.logger.hasLevel(3)&&this.logger.info(`TIAdapter:: Received response:${bT(t)}`),t.kind){case GX:this.typesRegistryCache=new Map(Object.entries(t.typesRegistry));break;case S$:{const a=(n=this.packageInstalledPromise)==null?void 0:n.get(t.id);O.assertIsDefined(a,"Should find the promise for package install"),(i=this.packageInstalledPromise)==null||i.delete(t.id),t.success?a.resolve({successMessage:t.message}):a.reject(t.message),this.projectService.updateTypingsForProject(t),this.event(t,"setTypings");break}case $pe:{const a={message:t.message};this.event(a,"typesInstallerInitializationFailed");break}case YX:{const a={eventId:t.eventId,packages:t.packagesToInstall};this.event(a,"beginInstallTypes");break}case XX:{if(this.telemetryEnabled){const c={telemetryEventName:"typingsInstalled",payload:{installedPackages:t.packagesToInstall.join(","),installSuccess:t.installSuccess,typingsInstallerVersion:t.typingsInstallerVersion}};this.event(c,"telemetry")}const a={eventId:t.eventId,packages:t.packagesToInstall,success:t.installSuccess};this.event(a,"endInstallTypes");break}case b$:{this.projectService.updateTypingsForProject(t);break}case y$:{for(this.activeRequestCount>0?this.activeRequestCount--:O.fail("TIAdapter:: Received too many responses");!this.requestQueue.isEmpty();){const a=this.requestQueue.dequeue();if(this.requestMap.get(a.projectName)===a){this.requestMap.delete(a.projectName),this.scheduleRequest(a);break}this.logger.hasLevel(3)&&this.logger.info(`TIAdapter:: Skipping defunct request for: ${a.projectName}`)}this.projectService.updateTypingsForProject(t),this.event(t,"setTypings");break}case KF:this.projectService.watchTypingLocations(t);break}}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:${bT(t)}`),this.installer.send(t)},lQe.requestDelayMillis,`${t.projectName}::${t.kind}`)}};IMe.requestDelayMillis=100;var OMe=IMe,FMe={};x(FMe,{ActionInvalidate:()=>b$,ActionPackageInstalled:()=>S$,ActionSet:()=>y$,ActionWatchTypingLocations:()=>KF,Arguments:()=>QX,AutoImportProviderProject:()=>nye,AuxiliaryProject:()=>tye,CharRangeSection:()=>Aye,CloseFileWatcherEvent:()=>dee,CommandNames:()=>yMe,ConfigFileDiagEvent:()=>lee,ConfiguredProject:()=>iye,ConfiguredProjectLoadKind:()=>uye,CreateDirectoryWatcherEvent:()=>pee,CreateFileWatcherEvent:()=>_ee,Errors:()=>f1,EventBeginInstallTypes:()=>YX,EventEndInstallTypes:()=>XX,EventInitializationFailed:()=>$pe,EventTypesRegistry:()=>GX,ExternalProject:()=>nee,GcTimer:()=>qve,InferredProject:()=>eye,LargeFileReferencedEvent:()=>cee,LineIndex:()=>a9,LineLeaf:()=>nz,LineNode:()=>Z4,LogLevel:()=>Fve,Msg:()=>Mve,OpenFileInfoTelemetryEvent:()=>aye,Project:()=>XD,ProjectInfoTelemetryEvent:()=>fee,ProjectKind:()=>LI,ProjectLanguageServiceStateEvent:()=>uee,ProjectLoadingFinishEvent:()=>oee,ProjectLoadingStartEvent:()=>see,ProjectService:()=>yye,ProjectsUpdatedInBackgroundEvent:()=>ez,ScriptInfo:()=>Hve,ScriptVersionCache:()=>Eee,Session:()=>wMe,TextStorage:()=>Wve,ThrottledOperations:()=>zve,TypingsInstallerAdapter:()=>OMe,allFilesAreJsOrDts:()=>Qve,allRootFilesAreJsOrDts:()=>Xve,asNormalizedPath:()=>U9e,convertCompilerOptions:()=>tz,convertFormatOptions:()=>Y4,convertScriptKindName:()=>gee,convertTypeAcquisition:()=>oye,convertUserPreferences:()=>cye,convertWatchOptions:()=>n9,countEachFileTypes:()=>K5,createInstallTypingsRequest:()=>Lve,createModuleSpecifierCache:()=>Tye,createNormalizedPathMap:()=>W9e,createPackageJsonCache:()=>xye,createSortedArray:()=>Jve,emptyArray:()=>of,findArgument:()=>WAe,formatDiagnosticToProtocol:()=>i9,formatMessage:()=>kye,getBaseConfigFileName:()=>ree,getDetailWatchInfo:()=>bee,getLocationInNewDocument:()=>Dye,hasArgument:()=>UAe,hasNoTypeScriptSource:()=>Zve,indent:()=>oI,isBackgroundProject:()=>t9,isConfigFile:()=>bye,isConfiguredProject:()=>Db,isDynamicFileName:()=>MI,isExternalProject:()=>e9,isInferredProject:()=>G4,isInferredProjectName:()=>Rve,isProjectDeferredClose:()=>r9,makeAutoImportProviderProjectName:()=>Bve,makeAuxiliaryProjectName:()=>$ve,makeInferredProjectName:()=>jve,maxFileSize:()=>aee,maxProgramSizeForNonTsFiles:()=>iee,normalizedPathToPath:()=>H4,nowString:()=>HAe,nullCancellationToken:()=>gMe,nullTypingsInstaller:()=>rz,protocol:()=>Vve,scriptInfoIsContainedByBackgroundProject:()=>Gve,scriptInfoIsContainedByDeferredClosedProject:()=>Yve,stringifyIndented:()=>bT,toEvent:()=>Cye,toNormalizedPath:()=>Dc,tryConvertScriptKindName:()=>mee,typingsInstaller:()=>Ove,updateProjectIfDirty:()=>jg}),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 f},set exports(_){f=_,l.exports&&(l.exports=_)}})})(QSe)),QSe.exports}Frr();const Mrr=oA({name:"PartnerPickerElement",setup(l,f){const{value:_}=f.element,h=w.ref(""),x=w.ref("");w.watch(_,H=>{H&&F(H)},{deep:!0});const P=exports.ppeconfig.onFetchData,F=H=>{H&&exports.ppeconfig.onFetchData(H,$)},$=(H,ee,j)=>{h.value=ee,x.value=j,_.value!=H&&(_.value=H)};return{logoUrl:h,pname:x,value:_,fetchData:F,onFetchData:P,gotData:$}}}),Lrr={class:"d-flex flex-column flex-md-row gap-2"},Rrr={class:"d-flex flex-row gap-2 w-100"},jrr=["src"],Brr={class:"w-100"},$rr=["value"],Jrr={class:"w-100"},zrr=["value"];function qrr(l,f,_,h,x,P){const F=w.resolveComponent("ElementLayout");return w.openBlock(),w.createBlock(F,null,w.createSlots({element:w.withCtx(()=>[w.createElementVNode("div",Lrr,[w.createElementVNode("div",Rrr,[w.createElementVNode("img",{class:"partner-picker__logo__preview",alt:"",src:l.logoUrl},null,8,jrr),w.createElementVNode("div",Brr,[w.createElementVNode("input",{type:"text",class:"form-control",value:l.pname,disabled:"",placeholder:"Neve"},null,8,$rr)])]),w.createElementVNode("div",Jrr,[w.createElementVNode("input",{id:"partner-id",type:"text",class:"form-control",value:l.value,onChange:f[0]||(f[0]=$=>l.fetchData($.target.value)),placeholder:"Azonoító"},null,40,zrr)])])]),_:2},[w.renderList(l.elementSlots,($,H)=>({name:H,fn:w.withCtx(()=>[w.renderSlot(l.$slots,H,{el$:l.el$},()=>[(w.openBlock(),w.createBlock(w.resolveDynamicComponent($),{el$:l.el$},null,8,["el$"]))])])}))]),1024)}const Vrr=sC(Mrr,[["render",qrr]]);exports.gisConfig=void 0;const Urr=l=>(exports.gisConfig=l,exports.gisConfig),Wrr=oA({name:"GalleryImageSelectorElement",setup(l,f){const{value:_}=f.element,h=w.ref([]);w.onMounted(()=>{console.debug("GalleryImageSelectorElement mounted",_.value)});const x=$=>{console.debug("GalleryImageSelectorElement onGalleryIdChanged",{ev:$.target.value,value:_.value,items:h.value}),_.value.galleryId=$.target.value};w.watch(()=>_.value,($,H)=>{console.debug("GalleryImageSelectorElement watch galleryId",{newVal:$,oldVal:H,value:_.value,items:h.value}),!(!$||($==null?void 0:$.galleryId)===(H==null?void 0:H.galleryId))&&(_.value.activeImageIndex=0,exports.gisConfig.onFetchGallery($==null?void 0:$.galleryId,ee=>{h.value=ee.items||[],F()}))},{immediate:!0,deep:!0});const P=$=>{console.debug("GalleryImageSelectorElement onActiveIndexChanged",{ev:$.target.value,value:_.value,items:h.value}),_.value.activeImageIndex=$.target.value,F()},F=()=>{var $;if(console.debug("GalleryImageSelectorElement updateImageUrl",{value:_.value,items:h.value}),h.value&&_.value.activeImageIndex>=0){const H=($=h.value[_.value.activeImageIndex])==null?void 0:$.url;_.value.activeImageUrl=H;return}_.value.activeImageUrl=null};return{onGalleryIdChanged:x,onActiveIndexChanged:P,value:_}}}),Hrr={key:0},Grr=["src"],Yrr={key:1},Xrr=["value"],Qrr=["value"];function Zrr(l,f,_,h,x,P){const F=w.resolveComponent("ElementLayout");return w.openBlock(),w.createBlock(F,null,w.createSlots({_:2},[l.value?{name:"element",fn:w.withCtx(()=>[l.value.activeImageUrl?(w.openBlock(),w.createElementBlock("div",Hrr,[w.createElementVNode("img",{class:"gallery__preview",alt:"",src:l.value.activeImageUrl},null,8,Grr)])):w.createCommentVNode("",!0),l.value.activeImageUrl?w.createCommentVNode("",!0):(w.openBlock(),w.createElementBlock("div",Yrr,[...f[2]||(f[2]=[w.createElementVNode("p",{class:"gallery__preview-empty"},"Nincs kép kiválasztva!",-1)])])),w.createElementVNode("div",null,[f[3]||(f[3]=w.createElementVNode("label",{for:"galleryId",class:"form-label"},"Galéria azonosító",-1)),w.createElementVNode("input",{type:"text",id:"galleryId",placeholder:"Galéria azonosító",class:"form-control",value:l.value.galleryId,onInput:f[0]||(f[0]=$=>l.onGalleryIdChanged($))},null,40,Xrr)]),w.createElementVNode("div",null,[f[4]||(f[4]=w.createElementVNode("label",{for:"activeImageIndex",class:"form-label"},"Aktív kép index",-1)),w.createElementVNode("input",{type:"number",id:"activeImageIndex",placeholder:"Aktív kép index",class:"form-control",value:l.value.activeImageIndex,onInput:f[1]||(f[1]=$=>l.onActiveIndexChanged($))},null,40,Qrr)])]),key:"0"}:void 0,w.renderList(l.elementSlots,($,H)=>({name:H,fn:w.withCtx(()=>[w.renderSlot(l.$slots,H,{el$:l.el$},()=>[(w.openBlock(),w.createBlock(w.resolveDynamicComponent($),{el$:l.el$},null,8,["el$"]))])])}))]),1024)}const Krr=sC(Wrr,[["render",Zrr]]);function enr(l){window.dispatchEvent(new CustomEvent("toast-notification-message",{detail:l}))}const tnr={CheckBox:rV,CheckBoxList:JVe,DropDown:_V,DropDownMenu:Ine,DropDownCallBack:LTe,ExternalArticleOfferComponent:UTe,FilterCompact:RTe,FilterControl:BTe,IconButton:L8,ImagePickerComponent:BM,InternalArticleOfferComponent:VTe,PaginatorControl:$Te,RadioButton:JTe,RadioButtonGroup:HVe,SpinningProgress:zTe,TableToList:GVe,TableToListOptions:YVe,TextListBox:XVe,ToastComponent:qTe,ToastWrapper:QVe,CalendarComponent:jTe,HeaderComponent:ZVe},rnr={install(l){Object.entries(tnr).forEach(([f,_])=>{l.component(f,_)})}};exports.ArticleEditorService=WVe;exports.ArticleOfferElement=Utr;exports.ArticlePickerElement=_rr;exports.CalendarComponent=jTe;exports.CheckBox=rV;exports.CheckBoxList=JVe;exports.ConfigService=UVe;exports.DateTimePickerElement=Arr;exports.DropDown=_V;exports.DropDownCallBack=LTe;exports.DropDownMenu=Ine;exports.ExternalArticleOfferComponent=UTe;exports.ExternalArticleOfferElement=Err;exports.FetchDetails=I8;exports.FetchError=One;exports.FilterCompact=RTe;exports.FilterControl=BTe;exports.FilterDate=AAt;exports.FilterDropDown=DAt;exports.FilterText=wAt;exports.GalleryImageSelectorElement=Krr;exports.HeaderComponent=ZVe;exports.IconButton=L8;exports.ImagePickerComponent=BM;exports.ImagePickerDetailsElement=vrr;exports.ImagePickerElement=mrr;exports.InternalArticleOfferComponent=VTe;exports.InternalArticleOfferElement=Trr;exports.Methods=V6;exports.PaginatorControl=$Te;exports.PartnerPickerElement=Vrr;exports.RadioButton=JTe;exports.RadioButtonGroup=HVe;exports.SpinningProgress=zTe;exports.TableToList=GVe;exports.TableToListOptions=YVe;exports.TableToListOptionsPersister=eTe;exports.TextListBox=XVe;exports.ToastComponent=qTe;exports.ToastWrapper=QVe;exports.configureArticleOfferElement=Ftr;exports.configureArticlePickerElement=Wtr;exports.configureExternalArticleOfferElement=xrr;exports.configureGalleryImageSelectorElement=Urr;exports.configureImagePickerElement=Htr;exports.configureInternalArticleOfferElement=yrr;exports.configurePartnerPickerElement=Prr;exports.debounce=G6t;exports.default=rnr;exports.initRequest=O8;exports.localDateTimeToDate=W6t;exports.localDateTimeToUTC=V6t;exports.localDateTimeToUTCDate=U6t;exports.localToDateStr=nV;exports.localToStr=VVe;exports.localToUtcStr=_ne;exports.sendMsgToToast=enr;exports.toDateString=$6t;exports.toDateStringFromUtc=q6t;exports.toDateTimeString=J6t;exports.toDateTimeStringFromUtc=z6t;exports.useArticleEditorService=Y6t;exports.useConfigService=H6t;
|
|
480
|
+
`+D.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 DMe(e){const t=e.diagnosticsDuration&&_a(e.diagnosticsDuration,([n,i])=>({...i,file:n}));return{...e,diagnosticsDuration:t}}function M0(e,t){return{start:t.positionToLineOffset(e.start),end:t.positionToLineOffset(Il(e))}}function wye(e,t,n){const i=M0(e,n),a=t&&M0(t,n);return a?{...i,contextStart:a.start,contextEnd:a.end}:i}function lvt(e,t){return{start:AMe(t,e.span.start),end:AMe(t,Il(e.span)),newText:e.newText}}function AMe(e,t){return bye(e)?fvt(e.getLineAndCharacterOfPosition(t)):e.positionToLineOffset(t)}function uvt(e,t){const 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 fvt(e){return{line:e.line+1,offset:e.character+1}}function _vt(e){O.assert(e.textChanges.length===1);const t=Ns(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 Dye(e,t,n,i){const a=pvt(e,t,i),{line:o,character:c}=_A(Ew(a),n);return{line:o+1,offset:c+1}}function pvt(e,t,n){for(const{fileName:i,textChanges:a}of n)if(i===t)for(let o=a.length-1;o>=0;o--){const{newText:c,span:{start:d,length:p}}=a[o];e=e.slice(0,d)+c+e.slice(d+p)}return e}function PMe(e,{fileName:t,textSpan:n,contextSpan:i,isWriteAccess:a,isDefinition:o},{disableLineTextInReferences:c}){const d=O.checkDefined(e.getScriptInfo(t)),p=wye(n,i,d),y=c?void 0:dvt(d,p);return{file:t,...p,lineText:y,isWriteAccess:a,isDefinition:o}}function dvt(e,t){const n=e.lineToTextSpan(t.start.line-1);return e.getSnapshot().getText(n.start,Il(n)).replace(/\r|\n/g,"")}function mvt(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 Q4=4,Aye=(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))(Aye||{}),gvt=class{constructor(){this.goSubtree=!0,this.lineIndex=new a9,this.endBranch=[],this.state=2,this.initialText="",this.trailingText="",this.lineIndex.root=new Z4,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;const i=a9.linesFromText(e).lines;i.length>1&&i[i.length-1]===""&&i.pop();let a,o;for(let d=this.endBranch.length-1;d>=0;d--)this.endBranch[d].updateCounts(),this.endBranch[d].charCount()===0&&(o=this.endBranch[d],d>0?a=this.endBranch[d-1]:a=this.branchNode);o&&a.remove(o);const c=this.startPath[this.startPath.length-1];if(i.length>0)if(c.text=i[0],i.length>1){let d=new Array(i.length-1),p=c;for(let S=1;S<i.length;S++)d[S-1]=new nz(i[S]);let y=this.startPath.length-2;for(;y>=0;){const S=this.startPath[y];d=S.insertAt(p,d),y--,p=S}let b=d.length;for(;b>0;){const S=new Z4;S.add(this.lineIndex.root),d=S.insertAt(this.lineIndex.root,d),b=d.length,this.lineIndex.root=S}this.lineIndex.root.updateCounts()}else for(let d=this.startPath.length-2;d>=0;d--)this.startPath[d].updateCounts();else{this.startPath[this.startPath.length-2].remove(c);for(let 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,a){const o=this.stack[this.stack.length-1];this.state===2&&a===1&&(this.state=1,this.branchNode=o,this.lineCollectionAtBranch=n);let c;function d(p){return p.isLeaf()?new nz(""):new Z4}switch(a){case 0:this.goSubtree=!1,this.state!==4&&o.add(n);break;case 1:this.state===4?this.goSubtree=!1:(c=d(n),o.add(c),this.startPath.push(c));break;case 2:this.state!==4?(c=d(n),o.add(c),this.startPath.push(c)):n.isLeaf()||(c=d(n),o.add(c),this.endBranch.push(c));break;case 3:this.goSubtree=!1;break;case 4:this.state!==4?this.goSubtree=!1:n.isLeaf()||(c=d(n),o.add(c),this.endBranch.push(c));break;case 5:this.goSubtree=!1,this.state!==1&&o.add(n);break}this.goSubtree&&this.stack.push(c)}leaf(e,t,n){this.state===1?this.initialText=n.text.substring(0,e):this.state===2?(this.initialText=n.text.substring(0,e),this.trailingText=n.text.substring(e+t)):this.trailingText=n.text.substring(e+t)}},hvt=class{constructor(e,t,n){this.pos=e,this.deleteLen=t,this.insertedText=n}getTextChangeRange(){return v7(Gf(this.pos,this.deleteLen),this.insertedText?this.insertedText.length:0)}},Cee=class fw{constructor(){this.changes=[],this.versions=new Array(fw.maxVersions),this.minVersion=0,this.currentVersion=0}versionToIndex(t){if(!(t<this.minVersion||t>this.currentVersion))return t%fw.maxVersions}currentVersionToIndex(){return this.currentVersion%fw.maxVersions}edit(t,n,i){this.changes.push(new hvt(t,n,i)),(this.changes.length>fw.changeNumberThreshold||n>fw.changeLengthThreshold||i&&i.length>fw.changeLengthThreshold)&&this.getSnapshot()}getSnapshot(){return this._getSnapshot()}_getSnapshot(){let t=this.versions[this.currentVersionToIndex()];if(this.changes.length>0){let n=t.index;for(const i of this.changes)n=n.edit(i.pos,i.deleteLen,i.insertedText);t=new NMe(this.currentVersion+1,this,n,this.changes),this.currentVersion=t.version,this.versions[this.currentVersionToIndex()]=t,this.changes=[],this.currentVersion-this.minVersion>=fw.maxVersions&&(this.minVersion=this.currentVersion-fw.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){const n=this._getSnapshot().index,{lineText:i,absolutePosition:a}=n.lineNumberToInfo(t+1),o=i!==void 0?i.length:n.absolutePositionOfStartOfLine(t+2)-a;return Gf(a,o)}getTextChangesBetweenVersions(t,n){if(t<n)if(t>=this.minVersion){const i=[];for(let a=t+1;a<=n;a++){const o=this.versions[this.versionToIndex(a)];for(const c of o.changesSincePreviousVersion)i.push(c.getTextChangeRange())}return use(i)}else return;else return SL}getLineCount(){return this._getSnapshot().index.getLineCount()}static fromString(t){const n=new fw,i=new NMe(0,n,new a9);n.versions[n.currentVersion]=i;const a=a9.linesFromText(t);return i.index.load(a.lines),n}};Cee.changeNumberThreshold=8,Cee.changeLengthThreshold=256,Cee.maxVersions=8;var Eee=Cee,NMe=class cQe{constructor(t,n,i,a=of){this.version=t,this.cache=n,this.index=i,this.changesSincePreviousVersion=a}getText(t,n){return this.index.getText(t,n-t)}getLength(){return this.index.getLength()}getChangeRange(t){if(t instanceof cQe&&this.cache===t.cache)return this.version<=t.version?SL:this.cache.getTextChangesBetweenVersions(t.version,this.version)}},a9=class FTe{constructor(){this.checkEdits=!1}absolutePositionOfStartOfLine(t){return this.lineNumberToInfo(t).absolutePosition}positionToLineOffset(t){const{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){const n=this.getLineCount();if(t<=n){const{position:i,leaf:a}=this.root.lineNumberToInfo(t,0);return{absolutePosition:i,lineText:a&&a.text}}else return{absolutePosition:this.root.charCount(),lineText:void 0}}load(t){if(t.length>0){const n=[];for(let i=0;i<t.length;i++)n[i]=new nz(t[i]);this.root=FTe.buildTreeFromBottom(n)}else this.root=new Z4}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:(a,o,c)=>{i=i.concat(c.text.substring(a,a+o))}}),i}getLength(){return this.root.charCount()}every(t,n,i){i||(i=this.root.charCount());const a={goSubtree:!0,done:!1,leaf(o,c,d){t(d,o,c)||(this.done=!0)}};return this.walk(n,i-n,a),!a.done}edit(t,n,i){if(this.root.charCount()===0)return O.assert(n===0),i!==void 0?(this.load(FTe.linesFromText(i).lines),this):void 0;{let a;if(this.checkEdits){const d=this.getText(0,this.root.charCount());a=d.slice(0,t)+i+d.slice(t+n)}const o=new gvt;let c=!1;if(t>=this.root.charCount()){t=this.root.charCount()-1;const d=this.getText(t,1);i?i=d+i:i=d,n=0,c=!0}else if(n>0){const d=t+n,{zeroBasedColumn:p,lineText:y}=this.positionToColumnAndLineText(d);p===0&&(n+=y.length,i=i?i+y:y)}if(this.root.walk(t,n,o),o.insertLines(i,c),this.checkEdits){const d=o.lineIndex.getText(0,o.lineIndex.getLength());O.assert(a===d,"buffer edit mismatch")}return o.lineIndex}}static buildTreeFromBottom(t){if(t.length<Q4)return new Z4(t);const n=new Array(Math.ceil(t.length/Q4));let i=0;for(let a=0;a<n.length;a++){const o=Math.min(i+Q4,t.length);n[a]=new Z4(t.slice(i,o)),i=o}return this.buildTreeFromBottom(n)}static linesFromText(t){const n=Ew(t);if(n.length===0)return{lines:[],lineMap:n};const i=new Array(n.length),a=n.length-1;for(let c=0;c<a;c++)i[c]=t.substring(n[c],n[c+1]);const o=t.substring(n[a]);return o.length>0?i[a]=o:i.pop(),{lines:i,lineMap:n}}},Z4=class MTe{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(const t of this.children)this.totalChars+=t.charCount(),this.totalLines+=t.lineCount()}execWalk(t,n,i,a,o){return i.pre&&i.pre(t,n,this.children[a],this,o),i.goSubtree?(this.children[a].walk(t,n,i),i.post&&i.post(t,n,this.children[a],this,o)):i.goSubtree=!0,i.done}skipChild(t,n,i,a,o){a.pre&&!a.done&&(a.pre(t,n,this.children[i],this,o),a.goSubtree=!0)}walk(t,n,i){if(this.children.length===0)return;let a=0,o=this.children[a].charCount(),c=t;for(;c>=o;)this.skipChild(c,n,a,i,0),c-=o,a++,o=this.children[a].charCount();if(c+n<=o){if(this.execWalk(c,n,i,a,2))return}else{if(this.execWalk(c,o-c,i,a,1))return;let d=n-(o-c);for(a++,o=this.children[a].charCount();d>o;){if(this.execWalk(0,o,i,a,3))return;d-=o,a++,o=this.children[a].charCount()}if(d>0&&this.execWalk(0,d,i,a,4))return}if(i.pre){const d=this.children.length;if(a<d-1)for(let p=a+1;p<d;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(const 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()}const i=this.lineCount();if(i===0)return{oneBasedLine:1,zeroBasedColumn:0,lineText:void 0};const a=O.checkDefined(this.lineNumberToInfo(i,0).leaf);return{oneBasedLine:i,zeroBasedColumn:a.charCount(),lineText:void 0}}lineNumberToInfo(t,n){for(const i of this.children){const a=i.lineCount();if(a>=t)return i.isLeaf()?{position:n,leaf:i}:i.lineNumberToInfo(t,n);t-=a,n+=i.charCount()}return{position:n,leaf:void 0}}splitAfter(t){let n;const i=this.children.length;t++;const a=t;if(t<i){for(n=new MTe;t<i;)n.add(this.children[t]),t++;n.updateCounts()}return this.children.length=a,n}remove(t){const n=this.findChildIndex(t),i=this.children.length;if(n<i-1)for(let a=n;a<i-1;a++)this.children[a]=this.children[a+1];this.children.pop()}findChildIndex(t){const n=this.children.indexOf(t);return O.assert(n!==-1),n}insertAt(t,n){let i=this.findChildIndex(t);const a=this.children.length,o=n.length;if(a<Q4&&i===a-1&&o===1)return this.add(n[0]),this.updateCounts(),[];{const c=this.splitAfter(i);let d=0;for(i++;i<Q4&&d<o;)this.children[i]=n[d],i++,d++;let p=[],y=0;if(d<o){y=Math.ceil((o-d)/Q4),p=new Array(y);let b=0;for(let E=0;E<y;E++)p[E]=new MTe;let S=p[0];for(;d<o;)S.add(n[d]),d++,S.children.length===Q4&&(b++,S=p[b]);for(let E=p.length-1;E>=0;E--)p[E].children.length===0&&p.pop()}c&&p.push(c),this.updateCounts();for(let b=0;b<y;b++)p[b].updateCounts();return p}}add(t){this.children.push(t),O.assert(this.children.length<=Q4)}charCount(){return this.totalChars}lineCount(){return this.totalLines}},nz=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}},IMe=class lQe{constructor(t,n,i,a,o,c){this.telemetryEnabled=t,this.logger=n,this.host=i,this.globalTypingsCacheLocation=a,this.event=o,this.maxActiveRequestCount=c,this.activeRequestCount=0,this.requestQueue=Op(),this.requestMap=new Map,this.requestedRegistry=!1,this.packageInstallId=0}isKnownTypesPackageName(t){var n;return Z2.validatePackageName(t)!==Z2.NameValidationResult.Ok?!1:(this.requestedRegistry||(this.requestedRegistry=!0,this.installer.send({kind:"typesRegistry"})),!!((n=this.typesRegistryCache)!=null&&n.has(t)))}installPackage(t){this.packageInstallId++;const n={kind:"installPackage",...t,id:this.packageInstallId},i=new Promise((a,o)=>{(this.packageInstalledPromise??(this.packageInstalledPromise=new Map)).set(this.packageInstallId,{resolve:a,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){const a=Lve(t,n,i);this.logger.hasLevel(3)&&this.logger.info(`TIAdapter:: Scheduling throttled operation:${bT(a)}`),this.activeRequestCount<this.maxActiveRequestCount?this.scheduleRequest(a):(this.logger.hasLevel(3)&&this.logger.info(`TIAdapter:: Deferring request for: ${a.projectName}`),this.requestQueue.enqueue(a),this.requestMap.set(a.projectName,a))}handleMessage(t){var n,i;switch(this.logger.hasLevel(3)&&this.logger.info(`TIAdapter:: Received response:${bT(t)}`),t.kind){case GX:this.typesRegistryCache=new Map(Object.entries(t.typesRegistry));break;case S$:{const a=(n=this.packageInstalledPromise)==null?void 0:n.get(t.id);O.assertIsDefined(a,"Should find the promise for package install"),(i=this.packageInstalledPromise)==null||i.delete(t.id),t.success?a.resolve({successMessage:t.message}):a.reject(t.message),this.projectService.updateTypingsForProject(t),this.event(t,"setTypings");break}case $pe:{const a={message:t.message};this.event(a,"typesInstallerInitializationFailed");break}case YX:{const a={eventId:t.eventId,packages:t.packagesToInstall};this.event(a,"beginInstallTypes");break}case XX:{if(this.telemetryEnabled){const c={telemetryEventName:"typingsInstalled",payload:{installedPackages:t.packagesToInstall.join(","),installSuccess:t.installSuccess,typingsInstallerVersion:t.typingsInstallerVersion}};this.event(c,"telemetry")}const a={eventId:t.eventId,packages:t.packagesToInstall,success:t.installSuccess};this.event(a,"endInstallTypes");break}case b$:{this.projectService.updateTypingsForProject(t);break}case y$:{for(this.activeRequestCount>0?this.activeRequestCount--:O.fail("TIAdapter:: Received too many responses");!this.requestQueue.isEmpty();){const a=this.requestQueue.dequeue();if(this.requestMap.get(a.projectName)===a){this.requestMap.delete(a.projectName),this.scheduleRequest(a);break}this.logger.hasLevel(3)&&this.logger.info(`TIAdapter:: Skipping defunct request for: ${a.projectName}`)}this.projectService.updateTypingsForProject(t),this.event(t,"setTypings");break}case KF:this.projectService.watchTypingLocations(t);break}}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:${bT(t)}`),this.installer.send(t)},lQe.requestDelayMillis,`${t.projectName}::${t.kind}`)}};IMe.requestDelayMillis=100;var OMe=IMe,FMe={};x(FMe,{ActionInvalidate:()=>b$,ActionPackageInstalled:()=>S$,ActionSet:()=>y$,ActionWatchTypingLocations:()=>KF,Arguments:()=>QX,AutoImportProviderProject:()=>nye,AuxiliaryProject:()=>tye,CharRangeSection:()=>Aye,CloseFileWatcherEvent:()=>dee,CommandNames:()=>yMe,ConfigFileDiagEvent:()=>lee,ConfiguredProject:()=>iye,ConfiguredProjectLoadKind:()=>uye,CreateDirectoryWatcherEvent:()=>pee,CreateFileWatcherEvent:()=>_ee,Errors:()=>f1,EventBeginInstallTypes:()=>YX,EventEndInstallTypes:()=>XX,EventInitializationFailed:()=>$pe,EventTypesRegistry:()=>GX,ExternalProject:()=>nee,GcTimer:()=>qve,InferredProject:()=>eye,LargeFileReferencedEvent:()=>cee,LineIndex:()=>a9,LineLeaf:()=>nz,LineNode:()=>Z4,LogLevel:()=>Fve,Msg:()=>Mve,OpenFileInfoTelemetryEvent:()=>aye,Project:()=>XD,ProjectInfoTelemetryEvent:()=>fee,ProjectKind:()=>LI,ProjectLanguageServiceStateEvent:()=>uee,ProjectLoadingFinishEvent:()=>oee,ProjectLoadingStartEvent:()=>see,ProjectService:()=>yye,ProjectsUpdatedInBackgroundEvent:()=>ez,ScriptInfo:()=>Hve,ScriptVersionCache:()=>Eee,Session:()=>wMe,TextStorage:()=>Wve,ThrottledOperations:()=>zve,TypingsInstallerAdapter:()=>OMe,allFilesAreJsOrDts:()=>Qve,allRootFilesAreJsOrDts:()=>Xve,asNormalizedPath:()=>U9e,convertCompilerOptions:()=>tz,convertFormatOptions:()=>Y4,convertScriptKindName:()=>gee,convertTypeAcquisition:()=>oye,convertUserPreferences:()=>cye,convertWatchOptions:()=>n9,countEachFileTypes:()=>K5,createInstallTypingsRequest:()=>Lve,createModuleSpecifierCache:()=>Tye,createNormalizedPathMap:()=>W9e,createPackageJsonCache:()=>xye,createSortedArray:()=>Jve,emptyArray:()=>of,findArgument:()=>WAe,formatDiagnosticToProtocol:()=>i9,formatMessage:()=>kye,getBaseConfigFileName:()=>ree,getDetailWatchInfo:()=>bee,getLocationInNewDocument:()=>Dye,hasArgument:()=>UAe,hasNoTypeScriptSource:()=>Zve,indent:()=>oI,isBackgroundProject:()=>t9,isConfigFile:()=>bye,isConfiguredProject:()=>Db,isDynamicFileName:()=>MI,isExternalProject:()=>e9,isInferredProject:()=>G4,isInferredProjectName:()=>Rve,isProjectDeferredClose:()=>r9,makeAutoImportProviderProjectName:()=>Bve,makeAuxiliaryProjectName:()=>$ve,makeInferredProjectName:()=>jve,maxFileSize:()=>aee,maxProgramSizeForNonTsFiles:()=>iee,normalizedPathToPath:()=>H4,nowString:()=>HAe,nullCancellationToken:()=>gMe,nullTypingsInstaller:()=>rz,protocol:()=>Vve,scriptInfoIsContainedByBackgroundProject:()=>Gve,scriptInfoIsContainedByDeferredClosedProject:()=>Yve,stringifyIndented:()=>bT,toEvent:()=>Cye,toNormalizedPath:()=>Dc,tryConvertScriptKindName:()=>mee,typingsInstaller:()=>Ove,updateProjectIfDirty:()=>jg}),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 f},set exports(_){f=_,l.exports&&(l.exports=_)}})})(QSe)),QSe.exports}Frr();const Mrr=oA({name:"PartnerPickerElement",setup(l,f){const{value:_}=f.element,h=w.ref(""),x=w.ref("");w.watch(_,H=>{H&&F(H)},{deep:!0});const P=exports.ppeconfig.onFetchData,F=H=>{H&&exports.ppeconfig.onFetchData(H,$)},$=(H,ee,j)=>{h.value=ee,x.value=j,_.value!=H&&(_.value=H)};return{logoUrl:h,pname:x,value:_,fetchData:F,onFetchData:P,gotData:$}}}),Lrr={class:"d-flex flex-column flex-md-row gap-2"},Rrr={class:"d-flex flex-row gap-2 w-100"},jrr=["src"],Brr={class:"w-100"},$rr=["value"],Jrr={class:"w-100"},zrr=["value"];function qrr(l,f,_,h,x,P){const F=w.resolveComponent("ElementLayout");return w.openBlock(),w.createBlock(F,null,w.createSlots({element:w.withCtx(()=>[w.createElementVNode("div",Lrr,[w.createElementVNode("div",Rrr,[w.createElementVNode("img",{class:"partner-picker__logo__preview",alt:"",src:l.logoUrl},null,8,jrr),w.createElementVNode("div",Brr,[w.createElementVNode("input",{type:"text",class:"form-control",value:l.pname,disabled:"",placeholder:"Neve"},null,8,$rr)])]),w.createElementVNode("div",Jrr,[w.createElementVNode("input",{id:"partner-id",type:"text",class:"form-control",value:l.value,onChange:f[0]||(f[0]=$=>l.fetchData($.target.value)),placeholder:"Azonoító"},null,40,zrr)])])]),_:2},[w.renderList(l.elementSlots,($,H)=>({name:H,fn:w.withCtx(()=>[w.renderSlot(l.$slots,H,{el$:l.el$},()=>[(w.openBlock(),w.createBlock(w.resolveDynamicComponent($),{el$:l.el$},null,8,["el$"]))])])}))]),1024)}const Vrr=sC(Mrr,[["render",qrr]]);exports.gisConfig=void 0;const Urr=l=>(exports.gisConfig=l,exports.gisConfig),Wrr=oA({name:"GalleryImageSelectorElement",setup(l,f){const{value:_}=f.element,h=w.ref([]);w.onMounted(()=>{console.debug("GalleryImageSelectorElement mounted",_.value)});const x=$=>{console.debug("GalleryImageSelectorElement onGalleryIdChanged",{ev:$.target.value,value:_.value,items:h.value}),_.value.activeImageIndex=0,_.value.galleryId=$.target.value,exports.gisConfig.onFetchGallery($.target.value,H=>{h.value=H.items||[],F()})};w.watch(()=>_.value,($,H)=>{console.debug("GalleryImageSelectorElement watch galleryId",{newVal:$,oldVal:H,value:_.value,items:h.value}),!(!$||($==null?void 0:$.galleryId)===(H==null?void 0:H.galleryId))&&exports.gisConfig.onFetchGallery($==null?void 0:$.galleryId,ee=>{h.value=ee.items||[],F()})},{immediate:!0,deep:!0});const P=$=>{console.debug("GalleryImageSelectorElement onActiveIndexChanged",{ev:$.target.value,value:_.value,items:h.value}),_.value.activeImageIndex=$.target.value,F()},F=()=>{var $;if(console.debug("GalleryImageSelectorElement updateImageUrl",{value:_.value,items:h.value}),h.value&&_.value.activeImageIndex>=0){const H=($=h.value[_.value.activeImageIndex])==null?void 0:$.url;_.value.activeImageUrl=H;return}_.value.activeImageUrl=null};return{onGalleryIdChanged:x,onActiveIndexChanged:P,value:_}}}),Hrr={key:0},Grr=["src"],Yrr={key:1},Xrr=["value"],Qrr=["value"];function Zrr(l,f,_,h,x,P){const F=w.resolveComponent("ElementLayout");return w.openBlock(),w.createBlock(F,null,w.createSlots({_:2},[l.value?{name:"element",fn:w.withCtx(()=>[l.value.activeImageUrl?(w.openBlock(),w.createElementBlock("div",Hrr,[w.createElementVNode("img",{class:"gallery__preview",alt:"",src:l.value.activeImageUrl},null,8,Grr)])):w.createCommentVNode("",!0),l.value.activeImageUrl?w.createCommentVNode("",!0):(w.openBlock(),w.createElementBlock("div",Yrr,[...f[2]||(f[2]=[w.createElementVNode("p",{class:"gallery__preview-empty"},"Nincs kép kiválasztva!",-1)])])),w.createElementVNode("div",null,[f[3]||(f[3]=w.createElementVNode("label",{for:"galleryId",class:"form-label"},"Galéria azonosító",-1)),w.createElementVNode("input",{type:"text",id:"galleryId",placeholder:"Galéria azonosító",class:"form-control",value:l.value.galleryId,onInput:f[0]||(f[0]=$=>l.onGalleryIdChanged($))},null,40,Xrr)]),w.createElementVNode("div",null,[f[4]||(f[4]=w.createElementVNode("label",{for:"activeImageIndex",class:"form-label"},"Aktív kép index",-1)),w.createElementVNode("input",{type:"number",id:"activeImageIndex",placeholder:"Aktív kép index",class:"form-control",value:l.value.activeImageIndex,onInput:f[1]||(f[1]=$=>l.onActiveIndexChanged($))},null,40,Qrr)])]),key:"0"}:void 0,w.renderList(l.elementSlots,($,H)=>({name:H,fn:w.withCtx(()=>[w.renderSlot(l.$slots,H,{el$:l.el$},()=>[(w.openBlock(),w.createBlock(w.resolveDynamicComponent($),{el$:l.el$},null,8,["el$"]))])])}))]),1024)}const Krr=sC(Wrr,[["render",Zrr]]);function enr(l){window.dispatchEvent(new CustomEvent("toast-notification-message",{detail:l}))}const tnr={CheckBox:rV,CheckBoxList:JVe,DropDown:_V,DropDownMenu:Ine,DropDownCallBack:LTe,ExternalArticleOfferComponent:UTe,FilterCompact:RTe,FilterControl:BTe,IconButton:L8,ImagePickerComponent:BM,InternalArticleOfferComponent:VTe,PaginatorControl:$Te,RadioButton:JTe,RadioButtonGroup:HVe,SpinningProgress:zTe,TableToList:GVe,TableToListOptions:YVe,TextListBox:XVe,ToastComponent:qTe,ToastWrapper:QVe,CalendarComponent:jTe,HeaderComponent:ZVe},rnr={install(l){Object.entries(tnr).forEach(([f,_])=>{l.component(f,_)})}};exports.ArticleEditorService=WVe;exports.ArticleOfferElement=Utr;exports.ArticlePickerElement=_rr;exports.CalendarComponent=jTe;exports.CheckBox=rV;exports.CheckBoxList=JVe;exports.ConfigService=UVe;exports.DateTimePickerElement=Arr;exports.DropDown=_V;exports.DropDownCallBack=LTe;exports.DropDownMenu=Ine;exports.ExternalArticleOfferComponent=UTe;exports.ExternalArticleOfferElement=Err;exports.FetchDetails=I8;exports.FetchError=One;exports.FilterCompact=RTe;exports.FilterControl=BTe;exports.FilterDate=AAt;exports.FilterDropDown=DAt;exports.FilterText=wAt;exports.GalleryImageSelectorElement=Krr;exports.HeaderComponent=ZVe;exports.IconButton=L8;exports.ImagePickerComponent=BM;exports.ImagePickerDetailsElement=vrr;exports.ImagePickerElement=mrr;exports.InternalArticleOfferComponent=VTe;exports.InternalArticleOfferElement=Trr;exports.Methods=V6;exports.PaginatorControl=$Te;exports.PartnerPickerElement=Vrr;exports.RadioButton=JTe;exports.RadioButtonGroup=HVe;exports.SpinningProgress=zTe;exports.TableToList=GVe;exports.TableToListOptions=YVe;exports.TableToListOptionsPersister=eTe;exports.TextListBox=XVe;exports.ToastComponent=qTe;exports.ToastWrapper=QVe;exports.configureArticleOfferElement=Ftr;exports.configureArticlePickerElement=Wtr;exports.configureExternalArticleOfferElement=xrr;exports.configureGalleryImageSelectorElement=Urr;exports.configureImagePickerElement=Htr;exports.configureInternalArticleOfferElement=yrr;exports.configurePartnerPickerElement=Prr;exports.debounce=G6t;exports.default=rnr;exports.initRequest=O8;exports.localDateTimeToDate=W6t;exports.localDateTimeToUTC=V6t;exports.localDateTimeToUTCDate=U6t;exports.localToDateStr=nV;exports.localToStr=VVe;exports.localToUtcStr=_ne;exports.sendMsgToToast=enr;exports.toDateString=$6t;exports.toDateStringFromUtc=q6t;exports.toDateTimeString=J6t;exports.toDateTimeStringFromUtc=z6t;exports.useArticleEditorService=Y6t;exports.useConfigService=H6t;
|