text: define("vs/language/typescript/tsMode",["require","require"],$=>{return(()=>{var i,e,t,s=Object.create,n=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,r=Object.getPrototypeOf,l=Object.prototype.hasOwnProperty,d=e=>n(e,"__esModule",{value:!0}),u=(f=function(e){if(void 0!==$)return $.apply(this,arguments);throw new Error('Dynamic require of "'+e+'" is not supported')},void 0!==$?$:"undefined"!=typeof Proxy?new Proxy(f,{get:(e,t)=>(void 0!==$?$:e)[t]}):f),c=(t,i,s,r)=>{if(i&&"object"==typeof i||"function"==typeof i)for(let e of o(i))l.call(t,e)||!s&&"default"===e||n(t,e,{get:()=>i[e],enumerable:!(r=a(i,e))||r.enumerable});return t},g=(e,t)=>c(d(n(null!=e?s(r(e)):{},"default",!t&&e&&e.__esModule?{get:()=>e.default,enumerable:!0}:{value:e,enumerable:!0})),e),p=(i="undefined"!=typeof WeakMap?new WeakMap:0,(e,t)=>i&&i.get(e)||(t=c(d({}),e,1),i&&i.set(e,t),t)),m=(e,t,i)=>(((e,t,i)=>t in e?n(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i)(e,"symbol"!=typeof t?t+"":t,i),i),b=(e=(e,t)=>{var i=g(u("vs/editor/editor.api"));t.exports=i},()=>(t||e((t={exports:{}}).exports,t),t.exports)),f={};((e,t)=>{for(var i in t)n(e,i,{get:t[i],enumerable:!0})})(f,{Adapter:()=>x,CodeActionAdaptor:()=>V,DefinitionAdapter:()=>P,DiagnosticsAdapter:()=>C,FormatAdapter:()=>H,FormatHelper:()=>E,FormatOnTypeAdapter:()=>W,InlayHintsAdapter:()=>B,Kind:()=>N,LibFiles:()=>k,OccurrencesAdapter:()=>L,OutlineAdapter:()=>T,QuickInfoAdapter:()=>I,ReferenceAdapter:()=>O,RenameAdapter:()=>j,SignatureHelpAdapter:()=>F,SuggestAdapter:()=>D,WorkerManager:()=>_,flattenDiagnosticMessageText:()=>v,getJavaScriptWorker:()=>function(){return new Promise((e,t)=>{if(!K)return t("JavaScript not registered!");e(K)})},getTypeScriptWorker:()=>function(){return new Promise((e,t)=>{if(!R)return t("TypeScript not registered!");e(R)})},setupJavaScript:()=>function(e){K=U(e,"javascript")},setupTypeScript:()=>function(e){R=U(e,"typescript")}});var h={};c(h,g(b()));var _=class{_modeId;_defaults;_configChangeListener;_updateExtraLibsToken;_extraLibsChangeListener;_worker;_client;constructor(e,t){this._modeId=e,this._defaults=t,this._worker=null,this._client=null,this._configChangeListener=this._defaults.onDidChange(()=>this._stopWorker()),this._updateExtraLibsToken=0,this._extraLibsChangeListener=this._defaults.onDidExtraLibsChange(()=>this._updateExtraLibs())}_stopWorker(){this._worker&&(this._worker.dispose(),this._worker=null),this._client=null}dispose(){this._configChangeListener.dispose(),this._extraLibsChangeListener.dispose(),this._stopWorker()}async _updateExtraLibs(){if(this._worker){let e=++this._updateExtraLibsToken,t=await this._worker.getProxy();this._updateExtraLibsToken===e&&t.updateExtraLibs(this._defaults.getExtraLibs())}}_getClient(){if(!this._client){this._worker=h.editor.createWebWorker({moduleId:"vs/language/typescript/tsWorker",label:this._modeId,keepIdleModels:!0,createData:{compilerOptions:this._defaults.getCompilerOptions(),extraLibs:this._defaults.getExtraLibs(),customWorkerPath:this._defaults.workerOptions.customWorkerPath,inlayHintsOptions:this._defaults.inlayHintsOptions}});let e=this._worker.getProxy();this._defaults.getEagerModelSync()&&(e=e.then(e=>this._worker?this._worker.withSyncedResources(h.editor.getModels().filter(e=>e.getLanguageId()===this._modeId).map(e=>e.uri)):e)),this._client=e}return this._client}getLanguageServiceWorker(...t){let i;return this._getClient().then(e=>{i=e}).then(e=>{if(this._worker)return this._worker.withSyncedResources(t)}).then(e=>i)}},y=u("./monaco.contribution"),w={};function v(e,t,i=0){if("string"==typeof e)return e;if(void 0===e)return"";let s="";if(i){s+=t;for(let e=0;e<i;e++)s+="  "}if(s+=e.messageText,i++,e.next)for(var r of e.next)s+=v(r,t,i);return s}function S(e){return e?e.map(e=>e.text).join(""):""}w["lib.d.ts"]=!0,w["lib.dom.d.ts"]=!0,w["lib.dom.iterable.d.ts"]=!0,w["lib.es2015.collection.d.ts"]=!0,w["lib.es2015.core.d.ts"]=!0,w["lib.es2015.d.ts"]=!0,w["lib.es2015.generator.d.ts"]=!0,w["lib.es2015.iterable.d.ts"]=!0,w["lib.es2015.promise.d.ts"]=!0,w["lib.es2015.proxy.d.ts"]=!0,w["lib.es2015.reflect.d.ts"]=!0,w["lib.es2015.symbol.d.ts"]=!0,w["lib.es2015.symbol.wellknown.d.ts"]=!0,w["lib.es2016.array.include.d.ts"]=!0,w["lib.es2016.d.ts"]=!0,w["lib.es2016.full.d.ts"]=!0,w["lib.es2017.d.ts"]=!0,w["lib.es2017.full.d.ts"]=!0,w["lib.es2017.intl.d.ts"]=!0,w["lib.es2017.object.d.ts"]=!0,w["lib.es2017.sharedmemory.d.ts"]=!0,w["lib.es2017.string.d.ts"]=!0,w["lib.es2017.typedarrays.d.ts"]=!0,w["lib.es2018.asyncgenerator.d.ts"]=!0,w["lib.es2018.asynciterable.d.ts"]=!0,w["lib.es2018.d.ts"]=!0,w["lib.es2018.full.d.ts"]=!0,w["lib.es2018.intl.d.ts"]=!0,w["lib.es2018.promise.d.ts"]=!0,w["lib.es2018.regexp.d.ts"]=!0,w["lib.es2019.array.d.ts"]=!0,w["lib.es2019.d.ts"]=!0,w["lib.es2019.full.d.ts"]=!0,w["lib.es2019.object.d.ts"]=!0,w["lib.es2019.string.d.ts"]=!0,w["lib.es2019.symbol.d.ts"]=!0,w["lib.es2020.bigint.d.ts"]=!0,w["lib.es2020.d.ts"]=!0,w["lib.es2020.full.d.ts"]=!0,w["lib.es2020.intl.d.ts"]=!0,w["lib.es2020.promise.d.ts"]=!0,w["lib.es2020.sharedmemory.d.ts"]=!0,w["lib.es2020.string.d.ts"]=!0,w["lib.es2020.symbol.wellknown.d.ts"]=!0,w["lib.es2021.d.ts"]=!0,w["lib.es2021.full.d.ts"]=!0,w["lib.es2021.intl.d.ts"]=!0,w["lib.es2021.promise.d.ts"]=!0,w["lib.es2021.string.d.ts"]=!0,w["lib.es2021.weakref.d.ts"]=!0,w["lib.es5.d.ts"]=!0,w["lib.es6.d.ts"]=!0,w["lib.esnext.d.ts"]=!0,w["lib.esnext.full.d.ts"]=!0,w["lib.esnext.intl.d.ts"]=!0,w["lib.esnext.promise.d.ts"]=!0,w["lib.esnext.string.d.ts"]=!0,w["lib.esnext.weakref.d.ts"]=!0,w["lib.scripthost.d.ts"]=!0,w["lib.webworker.d.ts"]=!0,w["lib.webworker.importscripts.d.ts"]=!0,w["lib.webworker.iterable.d.ts"]=!0;var x=class{constructor(e){this._worker=e}_textSpanToRange(e,t){var{lineNumber:i,column:s}=e.getPositionAt(t.start),{lineNumber:e,column:t}=e.getPositionAt(t.start+t.length);return{startLineNumber:i,startColumn:s,endLineNumber:e,endColumn:t}}},k=class{constructor(e){this._worker=e,this._libFiles={},this._hasFetchedLibFiles=!1,this._fetchLibFilesPromise=null}_libFiles;_hasFetchedLibFiles;_fetchLibFilesPromise;isLibFile(e){return!(!e||0!==e.path.indexOf("/lib."))&&!!w[e.path.slice(1)]}getOrCreateModel(e){let t=h.Uri.parse(e),i=h.editor.getModel(t);if(i)return i;if(this.isLibFile(t)&&this._hasFetchedLibFiles)return h.editor.createModel(this._libFiles[t.path.slice(1)],"typescript",t);e=y.typescriptDefaults.getExtraLibs()[e];return e?h.editor.createModel(e.content,"typescript",t):null}_containsLibFile(e){for(var t of e)if(this.isLibFile(t))return!0;return!1}async fetchLibFilesIfNecessary(e){this._containsLibFile(e)&&await this._fetchLibFiles()}_fetchLibFiles(){return this._fetchLibFilesPromise||(this._fetchLibFilesPromise=this._worker().then(e=>e.getLibFiles()).then(e=>{this._hasFetchedLibFiles=!0,this._libFiles=e})),this._fetchLibFilesPromise}},C=class extends x{constructor(e,t,i,s){super(s),this._libFiles=e,this._defaults=t,this._selector=i;let r=r=>{if(r.getLanguageId()===i){let t=()=>{var e=this._defaults.getDiagnosticsOptions()["onlyVisible"];e&&!r.isAttachedToEditor()||this._doValidate(r)},e,i=r.onDidChangeContent(()=>{clearTimeout(e),e=window.setTimeout(t,500)}),s=r.onDidChangeAttached(()=>{var e=this._defaults.getDiagnosticsOptions()["onlyVisible"];e&&(r.isAttachedToEditor()?t():h.editor.setModelMarkers(r,this._selector,[]))});this._listener[r.uri.toString()]={dispose(){i.dispose(),s.dispose(),clearTimeout(e)}},t()}},n=e=>{h.editor.setModelMarkers(e,this._selector,[]);e=e.uri.toString();this._listener[e]&&(this._listener[e].dispose(),delete this._listener[e])};this._disposables.push(h.editor.onDidCreateModel(e=>r(e))),this._disposables.push(h.editor.onWillDisposeModel(n)),this._disposables.push(h.editor.onDidChangeModelLanguage(e=>{n(e.model),r(e.model)})),this._disposables.push({dispose(){for(var e of h.editor.getModels())n(e)}});t=()=>{for(var e of h.editor.getModels())n(e),r(e)};this._disposables.push(this._defaults.onDidChange(t)),this._disposables.push(this._defaults.onDidExtraLibsChange(t)),h.editor.getModels().forEach(e=>r(e))}_disposables=[];_listener=Object.create(null);dispose(){this._disposables.forEach(e=>e&&e.dispose()),this._disposables=[]}async _doValidate(n){let a=await this._worker(n.uri);if(!n.isDisposed()){let e=[],{noSyntaxValidation:t,noSemanticValidation:i,noSuggestionDiagnostics:s}=this._defaults.getDiagnosticsOptions();t||e.push(a.getSyntacticDiagnostics(n.uri.toString())),i||e.push(a.getSemanticDiagnostics(n.uri.toString())),s||e.push(a.getSuggestionDiagnostics(n.uri.toString()));let r=await Promise.all(e);if(r&&!n.isDisposed()){let e=r.reduce((e,t)=>t.concat(e),[]).filter(e=>-1===(this._defaults.getDiagnosticsOptions().diagnosticCodesToIgnore||[]).indexOf(e.code)),t=e.map(e=>e.relatedInformation||[]).reduce((e,t)=>t.concat(e),[]).map(e=>e.file?h.Uri.parse(e.file.fileName):null);await this._libFiles.fetchLibFilesIfNecessary(t),n.isDisposed()||h.editor.setModelMarkers(n,this._selector,e.map(e=>this._convertDiagnostics(n,e)))}}}_convertDiagnostics(e,t){let i=t.start||0,s=t.length||1,{lineNumber:r,column:n}=e.getPositionAt(i),{lineNumber:a,column:o}=e.getPositionAt(i+s),l=[];return t.reportsUnnecessary&&l.push(h.MarkerTag.Unnecessary),t.reportsDeprecated&&l.push(h.MarkerTag.Deprecated),{severity:this._tsDiagnosticCategoryToMarkerSeverity(t.category),startLineNumber:r,startColumn:n,endLineNumber:a,endColumn:o,message:v(t.messageText,`
  `),code:t.code.toString(),tags:l,relatedInformation:this._convertRelatedInformation(e,t.relatedInformation)}}_convertRelatedInformation(a,e){if(!e)return[];let o=[];return e.forEach(e=>{let t=a;var i,s,r,n;e.file&&(t=this._libFiles.getOrCreateModel(e.file.fileName)),t&&(r=e.start||0,n=e.length||1,{lineNumber:i,column:s}=t.getPositionAt(r),{lineNumber:r,column:n}=t.getPositionAt(r+n),o.push({resource:t.uri,startLineNumber:i,startColumn:s,endLineNumber:r,endColumn:n,message:v(e.messageText,`
  `)}))}),o}_tsDiagnosticCategoryToMarkerSeverity(e){switch(e){case 1:return h.MarkerSeverity.Error;case 3:return h.MarkerSeverity.Info;case 0:return h.MarkerSeverity.Warning;case 2:return h.MarkerSeverity.Hint}return h.MarkerSeverity.Info}},D=class extends x{get triggerCharacters(){return["."]}async provideCompletionItems(n,a,e,t){let i=n.getWordUntilPosition(a),o=new h.Range(a.lineNumber,i.startColumn,a.lineNumber,i.endColumn),l=n.uri,d=n.getOffsetAt(a),s=await this._worker(l);if(!n.isDisposed()){let e=await s.getCompletionsAtPosition(l.toString(),d);return!e||n.isDisposed()?void 0:{suggestions:e.entries.map(e=>{let t=o;var i,s;e.replacementSpan&&(i=n.getPositionAt(e.replacementSpan.start),s=n.getPositionAt(e.replacementSpan.start+e.replacementSpan.length),t=new h.Range(i.lineNumber,i.column,s.lineNumber,s.column));let r=[];return-1!==e.kindModifiers?.indexOf("deprecated")&&r.push(h.languages.CompletionItemTag.Deprecated),{uri:l,position:a,offset:d,range:t,label:e.name,insertText:e.name,sortText:e.sortText,kind:D.convertKind(e.kind),tags:r}})}}}async resolveCompletionItem(e,t){let i=e,s=i.uri,r=i.position,n=i.offset,a=await(await this._worker(s)).getCompletionEntryDetails(s.toString(),n,i.label);return a?{uri:s,position:r,label:a.name,kind:D.convertKind(a.kind),detail:S(a.displayParts),documentation:{value:D.createDocumentationString(a)}}:i}static convertKind(e){switch(e){case N.primitiveType:case N.keyword:return h.languages.CompletionItemKind.Keyword;case N.variable:case N.localVariable:return h.languages.CompletionItemKind.Variable;case N.memberVariable:case N.memberGetAccessor:case N.memberSetAccessor:return h.languages.CompletionItemKind.Field;case N.function:case N.memberFunction:case N.constructSignature:case N.callSignature:case N.indexSignature:return h.languages.CompletionItemKind.Function;case N.enum:return h.languages.CompletionItemKind.Enum;case N.module:return h.languages.CompletionItemKind.Module;case N.class:return h.languages.CompletionItemKind.Class;case N.interface:return h.languages.CompletionItemKind.Interface;case N.warning:return h.languages.CompletionItemKind.File}return h.languages.CompletionItemKind.Property}static createDocumentationString(e){let t=S(e.documentation);if(e.tags)for(var i of e.tags)t+=`
  
  ${A(i)}`;return t}};function A(i){let s=`*@${i.name}*`;if("param"===i.name&&i.text){let[e,...t]=i.text;s+=`\`${e.text}\``,0<t.length&&(s+=` \u2014 ${t.map(e=>e.text).join(" ")}`)}else Array.isArray(i.text)?s+=` \u2014 ${i.text.map(e=>e.text).join(" ")}`:i.text&&(s+=` \u2014 ${i.text}`);return s}var F=class extends x{signatureHelpTriggerCharacters=["(",","];static _toSignatureHelpTriggerReason(e){switch(e.triggerKind){case h.languages.SignatureHelpTriggerKind.TriggerCharacter:return e.triggerCharacter?e.isRetrigger?{kind:"retrigger",triggerCharacter:e.triggerCharacter}:{kind:"characterTyped",triggerCharacter:e.triggerCharacter}:{kind:"invoked"};case h.languages.SignatureHelpTriggerKind.ContentChange:return e.isRetrigger?{kind:"retrigger"}:{kind:"invoked"};default:h.languages.SignatureHelpTriggerKind.Invoke;return{kind:"invoked"}}}async provideSignatureHelp(e,t,i,s){let r=e.uri,n=e.getOffsetAt(t),a=await this._worker(r);if(!e.isDisposed()){let t=await a.getSignatureHelpItems(r.toString(),n,{triggerReason:F._toSignatureHelpTriggerReason(s)});if(t&&!e.isDisposed()){let e={activeSignature:t.selectedItemIndex,activeParameter:t.argumentIndex,signatures:[]};return t.items.forEach(r=>{let n={label:"",parameters:[]};n.documentation={value:S(r.documentation)},n.label+=S(r.prefixDisplayParts),r.parameters.forEach((e,t,i)=>{var s=S(e.displayParts),e={label:s,documentation:{value:S(e.documentation)}};n.label+=s,n.parameters.push(e),t<i.length-1&&(n.label+=S(r.separatorDisplayParts))}),n.label+=S(r.suffixDisplayParts),e.signatures.push(n)}),{value:e,dispose(){}}}}}},I=class extends x{async provideHover(t,i,e){let s=t.uri,r=t.getOffsetAt(i),n=await this._worker(s);if(!t.isDisposed()){let e=await n.getQuickInfoAtPosition(s.toString(),r);if(e&&!t.isDisposed()){var a=S(e.documentation),o=e.tags?e.tags.map(e=>A(e)).join(`  
  
  `):"",i=S(e.displayParts);return{range:this._textSpanToRange(t,e.textSpan),contents:[{value:"```typescript\n"+i+"\n```\n"},{value:a+(o?`
  
  `+o:"")}]}}}}},L=class extends x{async provideDocumentHighlights(t,e,i){let s=t.uri,r=t.getOffsetAt(e),n=await this._worker(s);if(!t.isDisposed()){let e=await n.getOccurrencesAtPosition(s.toString(),r);return e&&!t.isDisposed()?e.map(e=>({range:this._textSpanToRange(t,e.textSpan),kind:e.isWriteAccess?h.languages.DocumentHighlightKind.Write:h.languages.DocumentHighlightKind.Text})):void 0}}},P=class extends x{constructor(e,t){super(t),this._libFiles=e}async provideDefinition(e,t,i){let s=e.uri,r=e.getOffsetAt(t),n=await this._worker(s);if(!e.isDisposed()){let t=await n.getDefinitionAtPosition(s.toString(),r);if(t&&!e.isDisposed()&&(await this._libFiles.fetchLibFilesIfNecessary(t.map(e=>h.Uri.parse(e.fileName))),!e.isDisposed())){let e=[];for(var a of t){var o=this._libFiles.getOrCreateModel(a.fileName);o&&e.push({uri:o.uri,range:this._textSpanToRange(o,a.textSpan)})}return e}}}},O=class extends x{constructor(e,t){super(t),this._libFiles=e}async provideReferences(e,t,i,s){let r=e.uri,n=e.getOffsetAt(t),a=await this._worker(r);if(!e.isDisposed()){let t=await a.getReferencesAtPosition(r.toString(),n);if(t&&!e.isDisposed()&&(await this._libFiles.fetchLibFilesIfNecessary(t.map(e=>h.Uri.parse(e.fileName))),!e.isDisposed())){let e=[];for(var o of t){var l=this._libFiles.getOrCreateModel(o.fileName);l&&e.push({uri:l.uri,range:this._textSpanToRange(l,o.textSpan)})}return e}}}},T=class extends x{async provideDocumentSymbols(a,e){let t=a.uri,i=await this._worker(t);if(!a.isDisposed()){let e=await i.getNavigationBarItems(t.toString());if(e&&!a.isDisposed()){let n=(e,t,i)=>{let s={name:t.text,detail:"",kind:M[t.kind]||h.languages.SymbolKind.Variable,range:this._textSpanToRange(a,t.spans[0]),selectionRange:this._textSpanToRange(a,t.spans[0]),tags:[]};if(i&&(s.containerName=i),t.childItems&&0<t.childItems.length)for(var r of t.childItems)n(e,r,s.name);e.push(s)},t=[];return e.forEach(e=>n(t,e)),t}}}},N=class{};m(N,"unknown",""),m(N,"keyword","keyword"),m(N,"script","script"),m(N,"module","module"),m(N,"class","class"),m(N,"interface","interface"),m(N,"type","type"),m(N,"enum","enum"),m(N,"variable","var"),m(N,"localVariable","local var"),m(N,"function","function"),m(N,"localFunction","local function"),m(N,"memberFunction","method"),m(N,"memberGetAccessor","getter"),m(N,"memberSetAccessor","setter"),m(N,"memberVariable","property"),m(N,"constructorImplementation","constructor"),m(N,"callSignature","call"),m(N,"indexSignature","index"),m(N,"constructSignature","construct"),m(N,"parameter","parameter"),m(N,"typeParameter","type parameter"),m(N,"primitiveType","primitive type"),m(N,"label","label"),m(N,"alias","alias"),m(N,"const","const"),m(N,"let","let"),m(N,"warning","warning");var M=Object.create(null);M[N.module]=h.languages.SymbolKind.Module,M[N.class]=h.languages.SymbolKind.Class,M[N.enum]=h.languages.SymbolKind.Enum,M[N.interface]=h.languages.SymbolKind.Interface,M[N.memberFunction]=h.languages.SymbolKind.Method,M[N.memberVariable]=h.languages.SymbolKind.Property,M[N.memberGetAccessor]=h.languages.SymbolKind.Property,M[N.memberSetAccessor]=h.languages.SymbolKind.Property,M[N.variable]=h.languages.SymbolKind.Variable,M[N.const]=h.languages.SymbolKind.Variable,M[N.localVariable]=h.languages.SymbolKind.Variable,M[N.variable]=h.languages.SymbolKind.Variable,M[N.function]=h.languages.SymbolKind.Function,M[N.localFunction]=h.languages.SymbolKind.Function;var K,R,E=class extends x{static _convertOptions(e){return{ConvertTabsToSpaces:e.insertSpaces,TabSize:e.tabSize,IndentSize:e.tabSize,IndentStyle:2,NewLineCharacter:`
  `,InsertSpaceAfterCommaDelimiter:!0,InsertSpaceAfterSemicolonInForStatements:!0,InsertSpaceBeforeAndAfterBinaryOperators:!0,InsertSpaceAfterKeywordsInControlFlowStatements:!0,InsertSpaceAfterFunctionKeywordForAnonymousFunctions:!0,InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis:!1,InsertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets:!1,InsertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces:!1,PlaceOpenBraceOnNewLineForControlBlocks:!1,PlaceOpenBraceOnNewLineForFunctions:!1}}_convertTextChanges(e,t){return{text:t.newText,range:this._textSpanToRange(e,t.span)}}},H=class extends E{async provideDocumentRangeFormattingEdits(t,e,i,s){let r=t.uri,n=t.getOffsetAt({lineNumber:e.startLineNumber,column:e.startColumn}),a=t.getOffsetAt({lineNumber:e.endLineNumber,column:e.endColumn}),o=await this._worker(r);if(!t.isDisposed()){let e=await o.getFormattingEditsForRange(r.toString(),n,a,E._convertOptions(i));return e&&!t.isDisposed()?e.map(e=>this._convertTextChanges(t,e)):void 0}}},W=class extends E{get autoFormatTriggerCharacters(){return[";","}",`
  `]}async provideOnTypeFormattingEdits(t,e,i,s,r){let n=t.uri,a=t.getOffsetAt(e),o=await this._worker(n);if(!t.isDisposed()){let e=await o.getFormattingEditsAfterKeystroke(n.toString(),a,i,E._convertOptions(s));return e&&!t.isDisposed()?e.map(e=>this._convertTextChanges(t,e)):void 0}}},V=class extends E{async provideCodeActions(t,e,i,s){let r=t.uri,n=t.getOffsetAt({lineNumber:e.startLineNumber,column:e.startColumn}),a=t.getOffsetAt({lineNumber:e.endLineNumber,column:e.endColumn}),o=E._convertOptions(t.getOptions()),l=i.markers.filter(e=>e.code).map(e=>e.code).map(Number),d=await this._worker(r);if(!t.isDisposed()){let e=await d.getCodeFixesAtPosition(r.toString(),n,a,l,o);return!e||t.isDisposed()?{actions:[],dispose:()=>{}}:{actions:e.filter(e=>0===e.changes.filter(e=>e.isNewFile).length).map(e=>this._tsCodeFixActionToMonacoCodeAction(t,i,e)),dispose:()=>{}}}}_tsCodeFixActionToMonacoCodeAction(e,t,i){let s=[];for(var r of i.changes)for(var n of r.textChanges)s.push({resource:e.uri,edit:{range:this._textSpanToRange(e,n.span),text:n.newText}});return{title:i.description,edit:{edits:s},diagnostics:t.markers,kind:"quickfix"}}},j=class extends x{constructor(e,t){super(t),this._libFiles=e}async provideRenameEdits(e,t,i,s){let r=e.uri,n=r.toString(),a=e.getOffsetAt(t),o=await this._worker(r);if(!e.isDisposed()){t=await o.getRenameInfo(n,a,{allowRenameOfImportPath:!1});if(!1===t.canRename)return{edits:[],rejectReason:t.localizedErrorMessage};if(void 0!==t.fileToRename)throw new Error("Renaming files is not supported.");t=await o.findRenameLocations(n,a,!1,!1,!1);if(t&&!e.isDisposed()){let e=[];for(var l of t){var d=this._libFiles.getOrCreateModel(l.fileName);if(!d)throw new Error(`Unknown file ${l.fileName}.`);e.push({resource:d.uri,edit:{range:this._textSpanToRange(d,l.textSpan),text:i}})}return{edits:e}}}}},B=class extends x{async provideInlayHints(t,e,i){let s=t.uri,r=s.toString(),n=t.getOffsetAt({lineNumber:e.startLineNumber,column:e.startColumn}),a=t.getOffsetAt({lineNumber:e.endLineNumber,column:e.endColumn}),o=await this._worker(s);return t.isDisposed()?null:{hints:(await o.provideInlayHints(r,n,a)).map(e=>({...e,label:e.text,position:t.getPositionAt(e.position),kind:this._convertHintKind(e.kind)})),dispose:()=>{}}}_convertHintKind(e){switch(e){case"Parameter":return h.languages.InlayHintKind.Parameter;case"Type":return h.languages.InlayHintKind.Type;default:return h.languages.InlayHintKind.Other}}};function U(e,t){let i=new _(t,e),s=(...e)=>i.getLanguageServiceWorker(...e),r=new k(s);return h.languages.registerCompletionItemProvider(t,new D(s)),h.languages.registerSignatureHelpProvider(t,new F(s)),h.languages.registerHoverProvider(t,new I(s)),h.languages.registerDocumentHighlightProvider(t,new L(s)),h.languages.registerDefinitionProvider(t,new P(r,s)),h.languages.registerReferenceProvider(t,new O(r,s)),h.languages.registerDocumentSymbolProvider(t,new T(s)),h.languages.registerDocumentRangeFormattingEditProvider(t,new H(s)),h.languages.registerOnTypeFormattingEditProvider(t,new W(s)),h.languages.registerCodeActionProvider(t,new V(s)),h.languages.registerRenameProvider(t,new j(r,s)),h.languages.registerInlayHintsProvider(t,new B(s)),new C(r,e,t,s),s}return p(f)})()});